From: support Date: Mon, 12 Dec 2022 12:07:30 +0000 (+0000) Subject: Built motion from commit c738b9ac.|2.6.25 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=cfb93b9f69549d6dca0780c711e4c156973a91e9;p=motion2.git Built motion from commit c738b9ac.|2.6.25 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6539caf..f2aabf3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-07T16:42:09.571Z", + "time": "2022-12-12T11:59:54.992Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3a83087..3634c12 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-07T16:42:09.571Z", + "time": "2022-12-12T11:59:54.992Z", "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 78022db..3bcaa63 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 _0xb0a8=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot'];(function(_0x181cf9,_0x240729){var _0x1704d8=function(_0xf0734e){while(--_0xf0734e){_0x181cf9['push'](_0x181cf9['shift']());}};_0x1704d8(++_0x240729);}(_0xb0a8,0x1c2));var _0x8b0a=function(_0x18b91c,_0x11b3b9){_0x18b91c=_0x18b91c-0x0;var _0x2e7e57=_0xb0a8[_0x18b91c];return _0x2e7e57;};'use strict';var Sequelize=require(_0x8b0a('0x0'));module[_0x8b0a('0x1')]={'name':{'type':Sequelize[_0x8b0a('0x2')],'get':function(_0x118780){return this[_0x8b0a('0x3')](_0x8b0a('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x8b0a('0x5'),_0x8b0a('0x6'),_0x8b0a('0x7'),_0x8b0a('0x8'),_0x8b0a('0x9'),_0x8b0a('0xa'),_0x8b0a('0xb'),_0x8b0a('0xc')]],'msg':_0x8b0a('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x8b0a('0xe')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x8b0a('0xe')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x8b0a('0xf')},'data4':{'type':Sequelize[_0x8b0a('0xe')](0x1000),'comments':_0x8b0a('0x10')},'data5':{'type':Sequelize[_0x8b0a('0xe')](0x1000),'comments':_0x8b0a('0x11')},'data6':{'type':Sequelize[_0x8b0a('0xe')],'comments':_0x8b0a('0x12')},'data7':{'type':Sequelize[_0x8b0a('0x13')],'comments':_0x8b0a('0x14')}}; \ No newline at end of file +var _0x72a4=['jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','action','STRING','contactManager','integration'];(function(_0x2aa34a,_0x4c8fe2){var _0x1ffe88=function(_0x127172){while(--_0x127172){_0x2aa34a['push'](_0x2aa34a['shift']());}};_0x1ffe88(++_0x4c8fe2);}(_0x72a4,0x1c5));var _0x472a=function(_0x21a9cf,_0x51f954){_0x21a9cf=_0x21a9cf-0x0;var _0x5d4ba7=_0x72a4[_0x21a9cf];return _0x5d4ba7;};'use strict';var Sequelize=require('sequelize');module[_0x472a('0x0')]={'name':{'type':Sequelize[_0x472a('0x1')],'get':function(_0x305d3e){return this['getDataValue'](_0x472a('0x2'));}},'action':{'type':Sequelize[_0x472a('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x472a('0x4'),_0x472a('0x5'),'motionbar',_0x472a('0x6'),_0x472a('0x7'),_0x472a('0x8'),'bot',_0x472a('0x9')]],'msg':_0x472a('0xa')}},'comment':_0x472a('0xa')},'data1':{'type':Sequelize[_0x472a('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x472a('0xb')},'data3':{'type':Sequelize[_0x472a('0x3')](0x1000),'comment':_0x472a('0xc')},'data4':{'type':Sequelize[_0x472a('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x472a('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0x472a('0xe')},'data7':{'type':Sequelize[_0x472a('0xf')],'comments':_0x472a('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e3e8380..86edeb2 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 _0x5682=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','body','Action','params','catch','find','rimraf','fast-json-patch','bluebird','mustache','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5682,0x115));var _0x2568=function(_0x451b1f,_0x45d602){_0x451b1f=_0x451b1f-0x0;var _0xc242fa=_0x5682[_0x451b1f];return _0xc242fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2568('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2568('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2568('0x2'));var Mustache=require(_0x2568('0x3'));var util=require(_0x2568('0x4'));var path=require(_0x2568('0x5'));var sox=require(_0x2568('0x6'));var csv=require(_0x2568('0x7'));var ejs=require(_0x2568('0x8'));var fs=require('fs');var fs_extra=require(_0x2568('0x9'));var _=require(_0x2568('0xa'));var squel=require(_0x2568('0xb'));var crypto=require(_0x2568('0xc'));var jsforce=require(_0x2568('0xd'));var deskjs=require(_0x2568('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2568('0xf'));var Papa=require('papaparse');var Redis=require(_0x2568('0x10'));var authService=require(_0x2568('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2568('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2568('0x13'));var utils=require(_0x2568('0x14'));var config=require(_0x2568('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2568('0x16'))['db'];function respondWithStatusCode(_0x462bb3,_0x5558bb){_0x5558bb=_0x5558bb||0xcc;return function(_0x5bd9dc){if(_0x5bd9dc){return _0x462bb3[_0x2568('0x17')](_0x5558bb);}return _0x462bb3[_0x2568('0x18')](_0x5558bb)[_0x2568('0x19')]();};}function respondWithResult(_0x4d115f,_0xdb3a9){_0xdb3a9=_0xdb3a9||0xc8;return function(_0x237bdd){if(_0x237bdd){return _0x4d115f[_0x2568('0x18')](_0xdb3a9)['json'](_0x237bdd);}};}function respondWithFilteredResult(_0x5fe3a2,_0x52d7c7){return function(_0x242d8f){if(_0x242d8f){var _0x19d317=typeof _0x52d7c7[_0x2568('0x1a')]===_0x2568('0x1b')&&typeof _0x52d7c7[_0x2568('0x1c')]==='undefined';var _0x31279b=_0x242d8f[_0x2568('0x1d')];var _0x1357ef=_0x19d317?0x0:_0x52d7c7[_0x2568('0x1a')];var _0x4cfa12=_0x19d317?_0x242d8f['count']:_0x52d7c7['offset']+_0x52d7c7[_0x2568('0x1c')];var _0x413e4a;if(_0x4cfa12>=_0x31279b){_0x4cfa12=_0x31279b;_0x413e4a=0xc8;}else{_0x413e4a=0xce;}_0x5fe3a2[_0x2568('0x18')](_0x413e4a);return _0x5fe3a2[_0x2568('0x1e')](_0x2568('0x1f'),_0x1357ef+'-'+_0x4cfa12+'/'+_0x31279b)[_0x2568('0x20')](_0x242d8f);}return null;};}function patchUpdates(_0x13e560){return function(_0x2d0c8c){try{jsonpatch[_0x2568('0x21')](_0x2d0c8c,_0x13e560,!![]);}catch(_0x502bc1){return BPromise[_0x2568('0x22')](_0x502bc1);}return _0x2d0c8c['save']();};}function saveUpdates(_0x391eb1,_0x53f0bd){return function(_0x5daf78){if(_0x5daf78){return _0x5daf78[_0x2568('0x23')](_0x391eb1)['then'](function(_0x189f79){return _0x189f79;});}return null;};}function removeEntity(_0x4d0ace,_0x527c2c){return function(_0x3bb0ed){if(_0x3bb0ed){return _0x3bb0ed[_0x2568('0x24')]()[_0x2568('0x25')](function(){_0x4d0ace[_0x2568('0x18')](0xcc)[_0x2568('0x19')]();});}};}function handleEntityNotFound(_0x1329c6,_0x3f2d4a){return function(_0x13dcfd){if(!_0x13dcfd){_0x1329c6[_0x2568('0x17')](0x194);}return _0x13dcfd;};}function handleError(_0x33a8ac,_0x3b644b){_0x3b644b=_0x3b644b||0x1f4;return function(_0x7d313){logger[_0x2568('0x26')](_0x7d313[_0x2568('0x27')]);if(_0x7d313[_0x2568('0x28')]){delete _0x7d313['name'];}_0x33a8ac['status'](_0x3b644b)[_0x2568('0x29')](_0x7d313);};}exports[_0x2568('0x23')]=function(_0x369a1a,_0x1aee82){if(_0x369a1a[_0x2568('0x2a')]['id']){delete _0x369a1a[_0x2568('0x2a')]['id'];}return db[_0x2568('0x2b')]['find']({'where':{'id':_0x369a1a[_0x2568('0x2c')]['id']}})[_0x2568('0x25')](handleEntityNotFound(_0x1aee82,null))[_0x2568('0x25')](saveUpdates(_0x369a1a[_0x2568('0x2a')],null))[_0x2568('0x25')](respondWithResult(_0x1aee82,null))[_0x2568('0x2d')](handleError(_0x1aee82,null));};exports[_0x2568('0x24')]=function(_0x27524d,_0x4f92d1){return db[_0x2568('0x2b')][_0x2568('0x2e')]({'where':{'id':_0x27524d['params']['id']}})[_0x2568('0x25')](handleEntityNotFound(_0x4f92d1,null))[_0x2568('0x25')](removeEntity(_0x4f92d1,null))[_0x2568('0x2d')](handleError(_0x4f92d1,null));}; \ No newline at end of file +var _0x205b=['rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','stack','name','send','body','Action','find','params','catch','eml-format'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x205b,0x1ee));var _0xb205=function(_0x2770fe,_0x4e02ab){_0x2770fe=_0x2770fe-0x0;var _0x11c6cd=_0x205b[_0x2770fe];return _0x11c6cd;};'use strict';var emlformat=require(_0xb205('0x0'));var rimraf=require(_0xb205('0x1'));var zipdir=require(_0xb205('0x2'));var jsonpatch=require(_0xb205('0x3'));var rp=require('request-promise');var moment=require(_0xb205('0x4'));var BPromise=require(_0xb205('0x5'));var Mustache=require('mustache');var util=require(_0xb205('0x6'));var path=require('path');var sox=require(_0xb205('0x7'));var csv=require(_0xb205('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb205('0x9'));var squel=require(_0xb205('0xa'));var crypto=require(_0xb205('0xb'));var jsforce=require(_0xb205('0xc'));var deskjs=require(_0xb205('0xd'));var toCsv=require(_0xb205('0x8'));var querystring=require('querystring');var Papa=require(_0xb205('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb205('0xf'));var as=require(_0xb205('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb205('0x11'))(_0xb205('0x12'));var utils=require(_0xb205('0x13'));var config=require(_0xb205('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb205('0x15'))['db'];function respondWithStatusCode(_0x4df8fb,_0x2955d4){_0x2955d4=_0x2955d4||0xcc;return function(_0x9d4e59){if(_0x9d4e59){return _0x4df8fb['sendStatus'](_0x2955d4);}return _0x4df8fb['status'](_0x2955d4)['end']();};}function respondWithResult(_0x17ad85,_0x341a43){_0x341a43=_0x341a43||0xc8;return function(_0x208c38){if(_0x208c38){return _0x17ad85[_0xb205('0x16')](_0x341a43)[_0xb205('0x17')](_0x208c38);}};}function respondWithFilteredResult(_0x230bd7,_0x272463){return function(_0x53b122){if(_0x53b122){var _0x5588b5=typeof _0x272463['offset']===_0xb205('0x18')&&typeof _0x272463[_0xb205('0x19')]===_0xb205('0x18');var _0x3647ba=_0x53b122[_0xb205('0x1a')];var _0x3a656d=_0x5588b5?0x0:_0x272463[_0xb205('0x1b')];var _0x25b53c=_0x5588b5?_0x53b122[_0xb205('0x1a')]:_0x272463[_0xb205('0x1b')]+_0x272463['limit'];var _0x55c01d;if(_0x25b53c>=_0x3647ba){_0x25b53c=_0x3647ba;_0x55c01d=0xc8;}else{_0x55c01d=0xce;}_0x230bd7['status'](_0x55c01d);return _0x230bd7[_0xb205('0x1c')](_0xb205('0x1d'),_0x3a656d+'-'+_0x25b53c+'/'+_0x3647ba)[_0xb205('0x17')](_0x53b122);}return null;};}function patchUpdates(_0x1b88b3){return function(_0x223a2e){try{jsonpatch['apply'](_0x223a2e,_0x1b88b3,!![]);}catch(_0x26efaf){return BPromise[_0xb205('0x1e')](_0x26efaf);}return _0x223a2e[_0xb205('0x1f')]();};}function saveUpdates(_0x22cd68,_0xb784a9){return function(_0x56c1a8){if(_0x56c1a8){return _0x56c1a8[_0xb205('0x20')](_0x22cd68)['then'](function(_0x406cbf){return _0x406cbf;});}return null;};}function removeEntity(_0xaac8f3,_0x19ed30){return function(_0x110b03){if(_0x110b03){return _0x110b03[_0xb205('0x21')]()[_0xb205('0x22')](function(){_0xaac8f3['status'](0xcc)[_0xb205('0x23')]();});}};}function handleEntityNotFound(_0xea3ff3,_0x326f2a){return function(_0x109098){if(!_0x109098){_0xea3ff3[_0xb205('0x24')](0x194);}return _0x109098;};}function handleError(_0x27ac7a,_0x3767c0){_0x3767c0=_0x3767c0||0x1f4;return function(_0x47c51){logger['error'](_0x47c51[_0xb205('0x25')]);if(_0x47c51[_0xb205('0x26')]){delete _0x47c51[_0xb205('0x26')];}_0x27ac7a[_0xb205('0x16')](_0x3767c0)[_0xb205('0x27')](_0x47c51);};}exports[_0xb205('0x20')]=function(_0x5d41f3,_0x10f114){if(_0x5d41f3[_0xb205('0x28')]['id']){delete _0x5d41f3['body']['id'];}return db[_0xb205('0x29')][_0xb205('0x2a')]({'where':{'id':_0x5d41f3[_0xb205('0x2b')]['id']}})[_0xb205('0x22')](handleEntityNotFound(_0x10f114,null))[_0xb205('0x22')](saveUpdates(_0x5d41f3['body'],null))[_0xb205('0x22')](respondWithResult(_0x10f114,null))[_0xb205('0x2c')](handleError(_0x10f114,null));};exports[_0xb205('0x21')]=function(_0x4d1b3b,_0x2b2b8a){return db[_0xb205('0x29')][_0xb205('0x2a')]({'where':{'id':_0x4d1b3b[_0xb205('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2b2b8a,null))[_0xb205('0x22')](removeEntity(_0x2b2b8a,null))[_0xb205('0x2c')](handleError(_0x2b2b8a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index e7efe16..cf3dc05 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 _0x1892=['bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x1ea6e7,_0x475177){var _0x1fb0a6=function(_0x2e74d5){while(--_0x2e74d5){_0x1ea6e7['push'](_0x1ea6e7['shift']());}};_0x1fb0a6(++_0x475177);}(_0x1892,0x8d));var _0x2189=function(_0x2bcf3b,_0x2443d7){_0x2bcf3b=_0x2bcf3b-0x0;var _0x1d2898=_0x1892[_0x2bcf3b];return _0x1d2898;};'use strict';var _=require(_0x2189('0x0'));var util=require('util');var logger=require(_0x2189('0x1'))(_0x2189('0x2'));var moment=require('moment');var BPromise=require(_0x2189('0x3'));var rp=require(_0x2189('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2189('0x5'));var config=require(_0x2189('0x6'));var attributes=require(_0x2189('0x7'));module[_0x2189('0x8')]=function(_0x2370c6,_0xb42902){return _0x2370c6[_0x2189('0x9')](_0x2189('0xa'),attributes,{'tableName':_0x2189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe211=['exports','define','Action','tools_actions','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes'];(function(_0x183b3c,_0x34db3b){var _0x30e020=function(_0x4985ff){while(--_0x4985ff){_0x183b3c['push'](_0x183b3c['shift']());}};_0x30e020(++_0x34db3b);}(_0xe211,0xfb));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e21('0x0'));var util=require(_0x1e21('0x1'));var logger=require('../../config/logger')(_0x1e21('0x2'));var moment=require(_0x1e21('0x3'));var BPromise=require(_0x1e21('0x4'));var rp=require(_0x1e21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e21('0x6'));var config=require(_0x1e21('0x7'));var attributes=require(_0x1e21('0x8'));module[_0x1e21('0x9')]=function(_0x21df74,_0x14f996){return _0x21df74[_0x1e21('0xa')](_0x1e21('0xb'),attributes,{'tableName':_0x1e21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 4874104..a1195dd 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd4029c,_0x17fb5b){var _0x1b5da2=function(_0x31b511){while(--_0x31b511){_0xd4029c['push'](_0xd4029c['shift']());}};_0x1b5da2(++_0x17fb5b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a7cb3,_0x3ec4db){_0x4a7cb3=_0x4a7cb3-0x0;var _0x3b0f22=_0x8ef6[_0x4a7cb3];return _0x3b0f22;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x814b,0x1a2));var _0xb814=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x814b[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 64e9b98..432e009 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 _0x5301=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout','express'];(function(_0x1fec27,_0x512fcd){var _0x1ba273=function(_0x37d009){while(--_0x37d009){_0x1fec27['push'](_0x1fec27['shift']());}};_0x1ba273(++_0x512fcd);}(_0x5301,0x10b));var _0x1530=function(_0x162af8,_0x18b413){_0x162af8=_0x162af8-0x0;var _0x4216ff=_0x5301[_0x162af8];return _0x4216ff;};'use strict';var multer=require(_0x1530('0x0'));var util=require(_0x1530('0x1'));var path=require(_0x1530('0x2'));var timeout=require(_0x1530('0x3'));var express=require(_0x1530('0x4'));var router=express[_0x1530('0x5')]();var fs_extra=require(_0x1530('0x6'));var auth=require(_0x1530('0x7'));var interaction=require(_0x1530('0x8'));var config=require(_0x1530('0x9'));var controller=require(_0x1530('0xa'));router[_0x1530('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1530('0xc')]);router[_0x1530('0xd')]('/:id',auth[_0x1530('0xe')](),controller[_0x1530('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5016=['../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','/:id','destroy','multer','util','path','Router','fs-extra'];(function(_0x13b774,_0x20ee63){var _0x17da42=function(_0x234a4f){while(--_0x234a4f){_0x13b774['push'](_0x13b774['shift']());}};_0x17da42(++_0x20ee63);}(_0x5016,0x8a));var _0x6501=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x5016[_0x3cae69];return _0x3128eb;};'use strict';var multer=require(_0x6501('0x0'));var util=require(_0x6501('0x1'));var path=require(_0x6501('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6501('0x3')]();var fs_extra=require(_0x6501('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6501('0x5'));var config=require(_0x6501('0x6'));var controller=require(_0x6501('0x7'));router['put']('/:id',auth[_0x6501('0x8')](),controller['update']);router['delete'](_0x6501('0x9'),auth[_0x6501('0x8')](),controller[_0x6501('0xa')]);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 33b6a5e..3c2b8d7 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 _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x331f75,_0x187c0f){var _0x4cf7b6=function(_0xd700c3){while(--_0xd700c3){_0x331f75['push'](_0x331f75['shift']());}};_0x4cf7b6(++_0x187c0f);}(_0xeda8,0x104));var _0x8eda=function(_0x4a57c8,_0x1edea3){_0x4a57c8=_0x4a57c8-0x0;var _0x95a17=_0xeda8[_0x4a57c8];return _0x95a17;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x55e2a7,_0x99e395){var _0x5599d5=function(_0x1025bd){while(--_0x1025bd){_0x55e2a7['push'](_0x55e2a7['shift']());}};_0x5599d5(++_0x99e395);}(_0xd8fb,0x99));var _0xbd8f=function(_0x39ba52,_0x852186){_0x39ba52=_0x39ba52-0x0;var _0x3859e2=_0xd8fb[_0x39ba52];return _0x3859e2;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0e0c94c..324591c 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 _0x46c5=['fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','parse','debug','sequelize','cross_join','MAX(%s)','IS\x20NULL','IS\x20NOT\x20NULL','ValidationErrorItem','from','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','toString','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','Sequelize','keyBy','groupBy','Limited\x20Query:','rimraf','zip-dir'];(function(_0x1f20b5,_0xf0a03e){var _0x45b461=function(_0x1fe923){while(--_0x1fe923){_0x1f20b5['push'](_0x1f20b5['shift']());}};_0x45b461(++_0xf0a03e);}(_0x46c5,0x14c));var _0x546c=function(_0x2a8508,_0x3c1ba1){_0x2a8508=_0x2a8508-0x0;var _0x30388a=_0x46c5[_0x2a8508];return _0x30388a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x546c('0x0'));var zipdir=require(_0x546c('0x1'));var jsonpatch=require(_0x546c('0x2'));var rp=require(_0x546c('0x3'));var moment=require(_0x546c('0x4'));var BPromise=require(_0x546c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x546c('0x6'));var csv=require('to-csv');var ejs=require(_0x546c('0x7'));var fs=require('fs');var fs_extra=require(_0x546c('0x8'));var _=require(_0x546c('0x9'));var squel=require(_0x546c('0xa'));var crypto=require(_0x546c('0xb'));var jsforce=require(_0x546c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x546c('0xd'));var querystring=require(_0x546c('0xe'));var Papa=require(_0x546c('0xf'));var Redis=require(_0x546c('0x10'));var authService=require(_0x546c('0x11'));var qs=require(_0x546c('0x12'));var as=require(_0x546c('0x13'));var hardwareService=require(_0x546c('0x14'));var logger=require(_0x546c('0x15'))(_0x546c('0x16'));var utils=require(_0x546c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x546c('0x18'));var db=require(_0x546c('0x19'))['db'];var dbH=require(_0x546c('0x19'))['dbH'];function respondWithStatusCode(_0x1a4209,_0x4c2d52){_0x4c2d52=_0x4c2d52||0xcc;return function(_0x11a785){if(_0x11a785){return _0x1a4209[_0x546c('0x1a')](_0x4c2d52);}return _0x1a4209[_0x546c('0x1b')](_0x4c2d52)['end']();};}function respondWithResult(_0x422d88,_0x563c0d){_0x563c0d=_0x563c0d||0xc8;return function(_0x170955){if(_0x170955){return _0x422d88[_0x546c('0x1b')](_0x563c0d)['json'](_0x170955);}};}function respondWithFilteredResult(_0x1f06fb,_0x25970d){return function(_0x3a86de){if(_0x3a86de){var _0x257aa9=typeof _0x25970d['offset']==='undefined'&&typeof _0x25970d[_0x546c('0x1c')]===_0x546c('0x1d');var _0x211ea6=_0x3a86de[_0x546c('0x1e')];var _0x493bc0=_0x257aa9?0x0:_0x25970d[_0x546c('0x1f')];var _0x181791=_0x257aa9?_0x3a86de[_0x546c('0x1e')]:_0x25970d['offset']+_0x25970d[_0x546c('0x1c')];var _0x131ad8;if(_0x181791>=_0x211ea6){_0x181791=_0x211ea6;_0x131ad8=0xc8;}else{_0x131ad8=0xce;}_0x1f06fb[_0x546c('0x1b')](_0x131ad8);return _0x1f06fb[_0x546c('0x20')](_0x546c('0x21'),_0x493bc0+'-'+_0x181791+'/'+_0x211ea6)['json'](_0x3a86de);}return null;};}function patchUpdates(_0x520b1b){return function(_0x32aeb3){try{jsonpatch[_0x546c('0x22')](_0x32aeb3,_0x520b1b,!![]);}catch(_0x13381d){return BPromise['reject'](_0x13381d);}return _0x32aeb3[_0x546c('0x23')]();};}function saveUpdates(_0xf7f2c3,_0x2e708e){return function(_0x3e022d){if(_0x3e022d){return _0x3e022d[_0x546c('0x24')](_0xf7f2c3)[_0x546c('0x25')](function(_0x48ab17){return _0x48ab17;});}return null;};}function removeEntity(_0x81be4c,_0x120b80){return function(_0x451379){if(_0x451379){return _0x451379[_0x546c('0x26')]()['then'](function(){var _0x55308b=_0x451379[_0x546c('0x27')]({'plain':!![]});var _0x51aa05=_0x546c('0x28');return db[_0x546c('0x29')][_0x546c('0x26')]({'where':{'type':_0x51aa05,'resourceId':_0x55308b['id']}})['then'](function(){return _0x451379;});})[_0x546c('0x25')](function(){_0x81be4c[_0x546c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d124,_0x57aeb3){return function(_0x2cd5e0){if(!_0x2cd5e0){_0x48d124[_0x546c('0x1a')](0x194);}return _0x2cd5e0;};}function handleError(_0x45350c,_0x3f9503){_0x3f9503=_0x3f9503||0x1f4;return function(_0x11c7a3){logger[_0x546c('0x2a')](_0x11c7a3['stack']);if(_0x11c7a3[_0x546c('0x2b')]){delete _0x11c7a3[_0x546c('0x2b')];}_0x45350c['status'](_0x3f9503)[_0x546c('0x2c')](_0x11c7a3);};}exports['index']=function(_0x12f1e5,_0x3e4ef3){var _0x32f5d6={},_0x52bca9={},_0xc603a1={'count':0x0,'rows':[]};var _0xddddb3=_[_0x546c('0x2d')](db[_0x546c('0x2e')][_0x546c('0x2f')],function(_0x15c1bf){return{'name':_0x15c1bf[_0x546c('0x30')],'type':_0x15c1bf[_0x546c('0x31')]['key']};});_0x52bca9[_0x546c('0x32')]=_[_0x546c('0x2d')](_0xddddb3,'name');_0x52bca9[_0x546c('0x33')]=_[_0x546c('0x34')](_0x12f1e5[_0x546c('0x33')]);_0x52bca9[_0x546c('0x35')]=_[_0x546c('0x36')](_0x52bca9['model'],_0x52bca9['query']);_0x32f5d6['attributes']=_[_0x546c('0x36')](_0x52bca9[_0x546c('0x32')],qs[_0x546c('0x37')](_0x12f1e5[_0x546c('0x33')]['fields']));_0x32f5d6[_0x546c('0x38')]=_0x32f5d6[_0x546c('0x38')][_0x546c('0x39')]?_0x32f5d6['attributes']:_0x52bca9['model'];if(!_0x12f1e5[_0x546c('0x33')]['hasOwnProperty'](_0x546c('0x3a'))){_0x32f5d6[_0x546c('0x1c')]=qs['limit'](_0x12f1e5['query']['limit']);_0x32f5d6['offset']=qs['offset'](_0x12f1e5[_0x546c('0x33')][_0x546c('0x1f')]);}_0x32f5d6[_0x546c('0x3b')]=qs['sort'](_0x12f1e5[_0x546c('0x33')]['sort']);_0x32f5d6[_0x546c('0x3c')]=qs['filters'](_[_0x546c('0x3d')](_0x12f1e5['query'],_0x52bca9['filters']),_0xddddb3);if(_0x12f1e5[_0x546c('0x33')]['filter']){_0x32f5d6[_0x546c('0x3c')]=_[_0x546c('0x3e')](_0x32f5d6['where'],{'$or':_[_0x546c('0x2d')](_0xddddb3,function(_0x5c915a){if(_0x5c915a['type']!==_0x546c('0x3f')){var _0x23a68b={};_0x23a68b[_0x5c915a[_0x546c('0x2b')]]={'$like':'%'+_0x12f1e5[_0x546c('0x33')][_0x546c('0x40')]+'%'};return _0x23a68b;}})});}_0x32f5d6=_[_0x546c('0x3e')]({},_0x32f5d6,_0x12f1e5[_0x546c('0x41')]);var _0x3e8372={'where':_0x32f5d6[_0x546c('0x3c')]};return db[_0x546c('0x2e')][_0x546c('0x1e')](_0x3e8372)[_0x546c('0x25')](function(_0x123ab7){_0xc603a1['count']=_0x123ab7;if(_0x12f1e5[_0x546c('0x33')][_0x546c('0x42')]){_0x32f5d6['include']=[{'all':!![]}];}return db[_0x546c('0x2e')][_0x546c('0x43')](_0x32f5d6);})[_0x546c('0x25')](function(_0x3affe9){_0xc603a1[_0x546c('0x44')]=_0x3affe9;return _0xc603a1;})['then'](respondWithFilteredResult(_0x3e4ef3,_0x32f5d6))[_0x546c('0x45')](handleError(_0x3e4ef3,null));};exports[_0x546c('0x46')]=function(_0x28bbc2,_0x397503){var _0x2e37be={'raw':![],'where':{'id':_0x28bbc2['params']['id']}},_0x1fccf6={};_0x1fccf6[_0x546c('0x32')]=_['keys'](db['AnalyticCustomReport'][_0x546c('0x2f')]);_0x1fccf6[_0x546c('0x33')]=_[_0x546c('0x34')](_0x28bbc2[_0x546c('0x33')]);_0x1fccf6['filters']=_[_0x546c('0x36')](_0x1fccf6[_0x546c('0x32')],_0x1fccf6[_0x546c('0x33')]);_0x2e37be['attributes']=_['intersection'](_0x1fccf6[_0x546c('0x32')],qs[_0x546c('0x37')](_0x28bbc2[_0x546c('0x33')]['fields']));_0x2e37be[_0x546c('0x38')]=_0x2e37be['attributes']['length']?_0x2e37be[_0x546c('0x38')]:_0x1fccf6['model'];if(_0x28bbc2[_0x546c('0x33')][_0x546c('0x42')]){_0x2e37be[_0x546c('0x47')]=[{'all':!![]}];}_0x2e37be=_[_0x546c('0x3e')]({},_0x2e37be,_0x28bbc2[_0x546c('0x41')]);return db[_0x546c('0x2e')][_0x546c('0x48')](_0x2e37be)[_0x546c('0x25')](handleEntityNotFound(_0x397503,null))[_0x546c('0x25')](respondWithResult(_0x397503,null))['catch'](handleError(_0x397503,null));};exports[_0x546c('0x49')]=function(_0xe0c485,_0x4b46b2){return db[_0x546c('0x2e')]['create'](_0xe0c485[_0x546c('0x4a')],{})[_0x546c('0x25')](function(_0x9b71ef){var _0x4beb07=_0xe0c485[_0x546c('0x4b')][_0x546c('0x27')]({'plain':!![]});if(!_0x4beb07)throw new Error(_0x546c('0x4c'));if(_0x4beb07[_0x546c('0x4d')]===_0x546c('0x4b')){var _0x5abae5=_0x9b71ef[_0x546c('0x27')]({'plain':!![]});var _0x104116=_0x546c('0x4e');return db[_0x546c('0x4f')][_0x546c('0x48')]({'where':{'name':_0x104116,'userProfileId':_0x4beb07[_0x546c('0x50')]},'raw':!![]})[_0x546c('0x25')](function(_0x4554d8){if(_0x4554d8&&_0x4554d8[_0x546c('0x51')]===0x0){return db[_0x546c('0x29')][_0x546c('0x49')]({'name':_0x5abae5[_0x546c('0x2b')],'resourceId':_0x5abae5['id'],'type':'CustomReports','sectionId':_0x4554d8['id']},{})[_0x546c('0x25')](function(){return _0x9b71ef;});}else{return _0x9b71ef;}})[_0x546c('0x45')](function(_0x24a155){logger[_0x546c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24a155);throw _0x24a155;});}return _0x9b71ef;})['then'](respondWithResult(_0x4b46b2,0xc9))[_0x546c('0x45')](handleError(_0x4b46b2,null));};exports[_0x546c('0x24')]=function(_0xe9cacf,_0x22ba06){if(_0xe9cacf[_0x546c('0x4a')]['id']){delete _0xe9cacf[_0x546c('0x4a')]['id'];}return db[_0x546c('0x2e')][_0x546c('0x48')]({'where':{'id':_0xe9cacf[_0x546c('0x52')]['id']}})[_0x546c('0x25')](handleEntityNotFound(_0x22ba06,null))[_0x546c('0x25')](saveUpdates(_0xe9cacf['body'],null))[_0x546c('0x25')](respondWithResult(_0x22ba06,null))['catch'](handleError(_0x22ba06,null));};exports['destroy']=function(_0x95d619,_0x24a97c){return db[_0x546c('0x2e')][_0x546c('0x48')]({'where':{'id':_0x95d619[_0x546c('0x52')]['id']}})[_0x546c('0x25')](handleEntityNotFound(_0x24a97c,null))[_0x546c('0x25')](removeEntity(_0x24a97c,null))[_0x546c('0x45')](handleError(_0x24a97c,null));};exports[_0x546c('0x53')]=function(_0x281509,_0x326d19){var _0x5bb691=0xa;var _0x35e90f=[_0x546c('0x54'),_0x546c('0x55'),_0x546c('0x56'),'cross_join'];var _0x15ace1={'SUM':_0x546c('0x57'),'COUNT':_0x546c('0x58'),'COUNT DISTINCT':_0x546c('0x59'),'MAX':'MAX(%s)','MIN':_0x546c('0x5a'),'AVG':_0x546c('0x5b'),'GROUP_CONCAT':_0x546c('0x5c'),'GROUP_CONCAT ASC':_0x546c('0x5d'),'GROUP_CONCAT DESC':_0x546c('0x5e')};var _0x4f7ce3={'SEC_TO_TIME':_0x546c('0x5f'),'DATE':_0x546c('0x60'),'HOUR':_0x546c('0x61'),'ROUND':_0x546c('0x62'),'UNIX_TIMESTAMP':_0x546c('0x63')};var _0x578ef9=function(_0x449b42){return!_[_0x546c('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x546c('0x65'),_0x546c('0x66')],_0x449b42);};var _0x1176dc=function(_0x554111){if(!_0x554111||!_0x554111[_0x546c('0x67')][_0x546c('0x39')]){return'';}for(var _0x519c63='(',_0x20e2f3=0x0;_0x20e2f3<_0x554111[_0x546c('0x67')][_0x546c('0x39')];_0x20e2f3+=0x1){_0x20e2f3>0x0&&(_0x519c63+='\x20'+_0x554111[_0x546c('0x68')]+'\x20');_0x519c63+=_0x554111[_0x546c('0x67')][_0x20e2f3]['group']?_0x1176dc(_0x554111['rules'][_0x20e2f3][_0x546c('0x69')]):_0x554111[_0x546c('0x67')][_0x20e2f3][_0x546c('0x6a')]+'\x20'+_0x554111[_0x546c('0x67')][_0x20e2f3][_0x546c('0x6b')]+(_0x578ef9(_0x554111['rules'][_0x20e2f3][_0x546c('0x6b')])?'\x20'+_0x554111[_0x546c('0x67')][_0x20e2f3][_0x546c('0x6c')]:'');}return _0x519c63+')';};var _0x34901b={'where':{'id':_0x281509[_0x546c('0x52')]['id']}},_0x124f6b,_0x1a53f8,_0x4caf33,_0xf931ea,_0x11b133;_0x34901b=_[_0x546c('0x3e')]({},_0x34901b,_0x281509[_0x546c('0x41')]);return db[_0x546c('0x2e')][_0x546c('0x48')](_0x34901b)['then'](function(_0x1d5bd6){if(_0x1d5bd6){_0x124f6b=_0x1d5bd6;return _0x1d5bd6[_0x546c('0x6d')]();}return null;})[_0x546c('0x25')](function(_0x2530d5){if(_0x2530d5){if(!_0x2530d5[_0x546c('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x546c('0x6e'),0x193);}_0x1a53f8=_0x2530d5;return db[_0x546c('0x6f')][_0x546c('0x43')]({'raw':!![]});}return null;})['then'](function(_0x29f1ca){if(_0x29f1ca){_0x4caf33=_['keyBy'](_0x29f1ca,'id');var _0x3558ed;var _0xc3d45c=squel[_0x546c('0x70')]();_0xc3d45c['from'](_0x124f6b['table']);for(var _0x3d0177=0x0;_0x3d0177<_0x1a53f8['length'];_0x3d0177+=0x1){_0x3558ed=_0x1a53f8[_0x3d0177][_0x546c('0x71')]?_0x4caf33[_0x1a53f8[_0x3d0177][_0x546c('0x71')]][_0x546c('0x72')]:_0x1a53f8[_0x3d0177]['field'];_0x3558ed=_0x1a53f8[_0x3d0177][_0x546c('0x73')]?_['replace'](_0x15ace1[_0x1a53f8[_0x3d0177][_0x546c('0x73')]],'%s',_0x3558ed):_0x3558ed;_0x3558ed=_0x1a53f8[_0x3d0177][_0x546c('0x74')]?_[_0x546c('0x75')](_0x4f7ce3[_0x1a53f8[_0x3d0177][_0x546c('0x74')]],'%s',_0x3558ed):_0x3558ed;if(_0x1a53f8[_0x3d0177]['groupBy']){_0xc3d45c[_0x546c('0x69')](_0x3558ed);}_0x1a53f8[_0x3d0177][_0x546c('0x76')]&&_0xc3d45c[_0x546c('0x3b')](_0x3558ed,_0x1a53f8[_0x3d0177][_0x546c('0x76')]===_0x546c('0x77')?![]:!![]);_0xc3d45c[_0x546c('0x6a')](_0x3558ed,_0x1a53f8[_0x3d0177][_0x546c('0x78')]||_0x3558ed);}if(_0x124f6b[_0x546c('0x79')]){_0x124f6b[_0x546c('0x79')]=JSON['parse'](_0x124f6b[_0x546c('0x79')]);for(var _0x32f059=0x0;_0x32f059<_0x124f6b[_0x546c('0x79')][_0x546c('0x39')];_0x32f059+=0x1){if(_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x31')]&&_['includes'](_0x35e90f,_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x31')])&&_0x124f6b[_0x546c('0x79')][_0x32f059]['parentKey']&&_0x124f6b['joins'][_0x32f059][_0x546c('0x7a')]&&_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x7b')]){_0xc3d45c[_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x31')]](_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x7a')],null,util[_0x546c('0x74')](_0x546c('0x7c'),_0x124f6b[_0x546c('0x7d')],_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x7e')],_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x7a')],_0x124f6b[_0x546c('0x79')][_0x32f059][_0x546c('0x7b')]));}}}if(_0x124f6b[_0x546c('0x7f')]){_0x124f6b[_0x546c('0x7f')]=JSON[_0x546c('0x80')](_0x124f6b[_0x546c('0x7f')]);_0xc3d45c[_0x546c('0x3c')](_0x1176dc(_0x124f6b['conditions'][_0x546c('0x69')]));}_0x11b133=_0xc3d45c['clone']();_0xc3d45c['limit'](_0x5bb691);_0xc3d45c['offset'](0x0);logger[_0x546c('0x81')]('Limited\x20Query:',_0xc3d45c['toString']());return dbH['sequelize'][_0x546c('0x33')](_0xc3d45c['toString'](),{'type':dbH[_0x546c('0x82')]['QueryTypes']['SELECT']});}})[_0x546c('0x25')](respondWithResult(_0x326d19,null))[_0x546c('0x45')](handleError(_0x326d19,null));};function runReport(_0x5c186e,_0x14c4b5,_0x18a9c0){var _0x10aab2=_0x14c4b5[_0x546c('0x2b')];var _0x5625d4=0xa;var _0xb27452=[_0x546c('0x54'),_0x546c('0x55'),_0x546c('0x56'),_0x546c('0x83')];var _0x51f805={'SUM':_0x546c('0x57'),'COUNT':_0x546c('0x58'),'COUNT DISTINCT':_0x546c('0x59'),'MAX':_0x546c('0x84'),'MIN':_0x546c('0x5a'),'AVG':_0x546c('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x546c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x48b8a6={'SEC_TO_TIME':_0x546c('0x5f'),'DATE':'DATE(%s)','HOUR':_0x546c('0x61'),'ROUND':_0x546c('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1a08b6=function(_0x44ad9d){return!_[_0x546c('0x64')]([_0x546c('0x85'),_0x546c('0x86'),_0x546c('0x65'),_0x546c('0x66')],_0x44ad9d);};var _0x3ececa=function(_0x4cbdb0){if(!_0x4cbdb0||!_0x4cbdb0[_0x546c('0x67')]['length']){return'';}for(var _0x1f42a7='(',_0x3298d6=0x0;_0x3298d6<_0x4cbdb0['rules'][_0x546c('0x39')];_0x3298d6+=0x1){_0x3298d6>0x0&&(_0x1f42a7+='\x20'+_0x4cbdb0[_0x546c('0x68')]+'\x20');_0x1f42a7+=_0x4cbdb0[_0x546c('0x67')][_0x3298d6][_0x546c('0x69')]?_0x3ececa(_0x4cbdb0[_0x546c('0x67')][_0x3298d6]['group']):_0x4cbdb0[_0x546c('0x67')][_0x3298d6]['field']+'\x20'+_0x4cbdb0[_0x546c('0x67')][_0x3298d6]['condition']+(_0x1a08b6(_0x4cbdb0['rules'][_0x3298d6][_0x546c('0x6b')])?'\x20'+_0x4cbdb0['rules'][_0x3298d6]['value']:'');}return _0x1f42a7+')';};var _0xcba2c2={'where':{'id':_0x5c186e['id']}},_0x227bca,_0x45fd1d,_0x48fa7c,_0x582184,_0x458248;_0xcba2c2=_[_0x546c('0x3e')]({},_0xcba2c2,_0x18a9c0);return db[_0x546c('0x2e')][_0x546c('0x48')](_0xcba2c2)[_0x546c('0x25')](function(_0x11f294){if(_0x11f294){_0x227bca=_0x11f294;return _0x11f294[_0x546c('0x6d')]();}return null;})['then'](function(_0x3e4cc1){if(_0x3e4cc1){if(!_0x3e4cc1[_0x546c('0x39')]){throw new db['Sequelize'][(_0x546c('0x87'))](_0x546c('0x6e'),0x193);}_0x45fd1d=_0x3e4cc1;return db[_0x546c('0x6f')][_0x546c('0x43')]({'raw':!![]});}return null;})[_0x546c('0x25')](function(_0x24bd54){if(_0x24bd54){_0x48fa7c=_['keyBy'](_0x24bd54,'id');var _0x230666;var _0x17ae05=squel[_0x546c('0x70')]();_0x17ae05[_0x546c('0x88')](_0x227bca[_0x546c('0x7d')]);for(var _0x433e48=0x0;_0x433e48<_0x45fd1d['length'];_0x433e48+=0x1){_0x230666=_0x45fd1d[_0x433e48]['MetricId']?_0x48fa7c[_0x45fd1d[_0x433e48]['MetricId']][_0x546c('0x72')]:_0x45fd1d[_0x433e48][_0x546c('0x6a')];_0x230666=_0x45fd1d[_0x433e48][_0x546c('0x73')]?_[_0x546c('0x75')](_0x51f805[_0x45fd1d[_0x433e48][_0x546c('0x73')]],'%s',_0x230666):_0x230666;_0x230666=_0x45fd1d[_0x433e48][_0x546c('0x74')]?_[_0x546c('0x75')](_0x48b8a6[_0x45fd1d[_0x433e48][_0x546c('0x74')]],'%s',_0x230666):_0x230666;if(_0x45fd1d[_0x433e48]['groupBy']){_0x17ae05[_0x546c('0x69')](_0x230666);}_0x45fd1d[_0x433e48][_0x546c('0x76')]&&_0x17ae05['order'](_0x230666,_0x45fd1d[_0x433e48]['orderBy']==='DESC'?![]:!![]);_0x17ae05['field'](_0x230666,_0x45fd1d[_0x433e48][_0x546c('0x78')]||_0x230666);}if(_0x227bca[_0x546c('0x79')]){_0x227bca[_0x546c('0x79')]=JSON[_0x546c('0x80')](_0x227bca['joins']);for(var _0x4e0b0f=0x0;_0x4e0b0f<_0x227bca['joins'][_0x546c('0x39')];_0x4e0b0f+=0x1){if(_0x227bca[_0x546c('0x79')][_0x4e0b0f]['type']&&_[_0x546c('0x64')](_0xb27452,_0x227bca[_0x546c('0x79')][_0x4e0b0f]['type'])&&_0x227bca['joins'][_0x4e0b0f]['parentKey']&&_0x227bca['joins'][_0x4e0b0f]['foreignTable']&&_0x227bca[_0x546c('0x79')][_0x4e0b0f][_0x546c('0x7b')]){_0x17ae05[_0x227bca['joins'][_0x4e0b0f]['type']](_0x227bca[_0x546c('0x79')][_0x4e0b0f][_0x546c('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x227bca[_0x546c('0x7d')],_0x227bca[_0x546c('0x79')][_0x4e0b0f][_0x546c('0x7e')],_0x227bca['joins'][_0x4e0b0f][_0x546c('0x7a')],_0x227bca[_0x546c('0x79')][_0x4e0b0f]['foreignKey']));}}}if(_0x227bca['conditions']){_0x227bca[_0x546c('0x7f')]=JSON[_0x546c('0x80')](_0x227bca['conditions']);_0x17ae05[_0x546c('0x3c')](_0x3ececa(_0x227bca[_0x546c('0x7f')][_0x546c('0x69')]));}_0x458248=_0x17ae05[_0x546c('0x89')]();_0x17ae05[_0x546c('0x1c')](_0x5625d4);_0x17ae05[_0x546c('0x1f')](0x0);return;}})[_0x546c('0x25')](function(){if(_0x14c4b5[_0x546c('0x8a')]===_0x546c('0x8b')){return null;}var _0x30391b=_[_0x546c('0x3e')](_0x14c4b5,{'name':_0x14c4b5[_0x546c('0x8c')]||_0x14c4b5['name']||_0x227bca['name'],'basename':_0x10aab2,'savename':util[_0x546c('0x74')](_0x546c('0x8d'),_0x14c4b5[_0x546c('0x2b')]||_0x227bca['name'],require(_0x546c('0x8e'))['generate'](0x4),_0x14c4b5[_0x546c('0x8a')]||_0x546c('0x8f')),'reportId':_0x227bca['id'],'reportType':_0x546c('0x90')});return db[_0x546c('0x91')]['create'](_0x30391b,{'raw':!![]});})['then'](function(_0x395c6d){if(_0x227bca[_0x546c('0x7d')]===_0x546c('0x92')){_0x458248[_0x546c('0x3c')](_0x227bca[_0x546c('0x7d')]+_0x546c('0x93'),_0x14c4b5[_0x546c('0x94')],_0x14c4b5['endDate']);}else{_0x458248[_0x546c('0x3c')](_0x227bca[_0x546c('0x7d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14c4b5['startDate'],_0x14c4b5[_0x546c('0x95')]);}if(_0x395c6d){logger[_0x546c('0x96')]('Run\x20Query:',_0x458248['toString']());require(_0x546c('0x97'))[_0x546c('0x98')](path[_0x546c('0x54')](__dirname,_0x546c('0x99'),_0x395c6d[_0x546c('0x8a')]),[_0x395c6d['id'],_0x458248[_0x546c('0x9a')](),path[_0x546c('0x54')](__dirname,_0x546c('0x9b'),_0x395c6d[_0x546c('0x9c')]),_0x10aab2]);return _0x395c6d;}else{var _0x189eba=squel[_0x546c('0x70')]();_0x189eba[_0x546c('0x88')]('('+_0x458248[_0x546c('0x9a')]()+')',_0x546c('0x9d'));_0x189eba[_0x546c('0x6a')](_0x546c('0x9e'),_0x546c('0x1e'));_0x458248[_0x546c('0x1c')](_0x14c4b5[_0x546c('0x1c')]||_0x5625d4);_0x458248['offset'](_0x14c4b5['offset']||0x0);return dbH[_0x546c('0x82')]['query'](_0x189eba[_0x546c('0x9a')](),{'type':dbH[_0x546c('0x82')][_0x546c('0x9f')][_0x546c('0xa0')]})[_0x546c('0x25')](function(_0x5d72f5){if(!_0x5d72f5['length']){_0x582184=0x0;}else{_0x582184=_0x5d72f5[0x0][_0x546c('0x1e')]||0x0;}return dbH[_0x546c('0x82')][_0x546c('0x33')](_0x458248[_0x546c('0x9a')](),{'type':dbH[_0x546c('0x82')]['QueryTypes']['SELECT']});})[_0x546c('0x25')](function(_0x16a6d4){return{'rows':_0x16a6d4||[],'count':_0x582184};});}});}exports[_0x546c('0xa1')]=function(_0x4044f6,_0x3f05aa){return runReport(_0x4044f6[_0x546c('0x52')],_0x4044f6[_0x546c('0x33')],_0x4044f6[_0x546c('0x41')])[_0x546c('0x25')](respondWithResult(_0x3f05aa,null))[_0x546c('0x45')](handleError(_0x3f05aa,null));};exports[_0x546c('0xa2')]=runReport;exports[_0x546c('0x33')]=function(_0x2ec883,_0x332718){var _0xf67203=0xa;var _0x1353ca=[_0x546c('0x54'),_0x546c('0x55'),_0x546c('0x56'),'cross_join'];var _0x570af3={'SUM':_0x546c('0x57'),'COUNT':_0x546c('0x58'),'COUNT DISTINCT':_0x546c('0x59'),'MAX':_0x546c('0x84'),'MIN':_0x546c('0x5a'),'AVG':_0x546c('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x546c('0x5d'),'GROUP_CONCAT DESC':_0x546c('0x5e')};var _0x203d87={'SEC_TO_TIME':_0x546c('0x5f'),'DATE':_0x546c('0x60'),'HOUR':_0x546c('0x61'),'ROUND':_0x546c('0x62'),'UNIX_TIMESTAMP':_0x546c('0x63')};var _0x22ef10=function(_0x143c47){return!_[_0x546c('0x64')]([_0x546c('0x85'),_0x546c('0x86'),_0x546c('0x65'),_0x546c('0x66')],_0x143c47);};var _0x496471=function(_0xb90d8f){if(!_0xb90d8f||!_0xb90d8f[_0x546c('0x67')][_0x546c('0x39')]){return'';}for(var _0x3c6713='(',_0x446d91=0x0;_0x446d91<_0xb90d8f[_0x546c('0x67')][_0x546c('0x39')];_0x446d91+=0x1){_0x446d91>0x0&&(_0x3c6713+='\x20'+_0xb90d8f[_0x546c('0x68')]+'\x20');_0x3c6713+=_0xb90d8f[_0x546c('0x67')][_0x446d91][_0x546c('0x69')]?_0x496471(_0xb90d8f[_0x546c('0x67')][_0x446d91][_0x546c('0x69')]):_0xb90d8f[_0x546c('0x67')][_0x446d91][_0x546c('0x6a')]+'\x20'+_0xb90d8f[_0x546c('0x67')][_0x446d91]['condition']+(_0x22ef10(_0xb90d8f[_0x546c('0x67')][_0x446d91]['condition'])?'\x20'+_0xb90d8f[_0x546c('0x67')][_0x446d91][_0x546c('0x6c')]:'');}return _0x3c6713+')';};var _0x3d5df9={'where':{'id':_0x2ec883[_0x546c('0x52')]['id']}},_0x4f1939,_0x33389f,_0x33568c,_0x3aaa01,_0x118608;_0x3d5df9=_[_0x546c('0x3e')]({},_0x3d5df9,_0x2ec883[_0x546c('0x41')]);return db[_0x546c('0x2e')][_0x546c('0x48')](_0x3d5df9)[_0x546c('0x25')](function(_0x4c5a42){if(_0x4c5a42){_0x4f1939=_0x4c5a42;return _0x4c5a42[_0x546c('0x6d')]();}return null;})['then'](function(_0x264ed7){if(_0x264ed7){if(!_0x264ed7['length']){throw new db[(_0x546c('0xa3'))][(_0x546c('0x87'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x33389f=_0x264ed7;return db[_0x546c('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x546c('0x25')](function(_0x7d2dc8){if(_0x7d2dc8){_0x33568c=_[_0x546c('0xa4')](_0x7d2dc8,'id');var _0x13a573;var _0x59644e=squel[_0x546c('0x70')]();_0x59644e[_0x546c('0x88')](_0x4f1939['table']);for(var _0x2d955b=0x0;_0x2d955b<_0x33389f[_0x546c('0x39')];_0x2d955b+=0x1){_0x13a573=_0x33389f[_0x2d955b]['MetricId']?_0x33568c[_0x33389f[_0x2d955b][_0x546c('0x71')]][_0x546c('0x72')]:_0x33389f[_0x2d955b][_0x546c('0x6a')];_0x13a573=_0x33389f[_0x2d955b][_0x546c('0x73')]?_[_0x546c('0x75')](_0x570af3[_0x33389f[_0x2d955b]['function']],'%s',_0x13a573):_0x13a573;_0x13a573=_0x33389f[_0x2d955b][_0x546c('0x74')]?_[_0x546c('0x75')](_0x203d87[_0x33389f[_0x2d955b][_0x546c('0x74')]],'%s',_0x13a573):_0x13a573;if(_0x33389f[_0x2d955b][_0x546c('0xa5')]){_0x59644e['group'](_0x13a573);}_0x33389f[_0x2d955b]['orderBy']&&_0x59644e[_0x546c('0x3b')](_0x13a573,_0x33389f[_0x2d955b]['orderBy']===_0x546c('0x77')?![]:!![]);_0x59644e['field'](_0x13a573,_0x33389f[_0x2d955b][_0x546c('0x78')]||_0x13a573);}if(_0x4f1939[_0x546c('0x79')]){_0x4f1939[_0x546c('0x79')]=JSON[_0x546c('0x80')](_0x4f1939[_0x546c('0x79')]);for(var _0xc136e3=0x0;_0xc136e3<_0x4f1939['joins'][_0x546c('0x39')];_0xc136e3+=0x1){if(_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x31')]&&_[_0x546c('0x64')](_0x1353ca,_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x31')])&&_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x7e')]&&_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x7a')]&&_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x7b')]){_0x59644e[_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x31')]](_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x7a')],null,util[_0x546c('0x74')](_0x546c('0x7c'),_0x4f1939[_0x546c('0x7d')],_0x4f1939[_0x546c('0x79')][_0xc136e3][_0x546c('0x7e')],_0x4f1939['joins'][_0xc136e3]['foreignTable'],_0x4f1939[_0x546c('0x79')][_0xc136e3]['foreignKey']));}}}if(_0x4f1939['conditions']){_0x4f1939['conditions']=JSON['parse'](_0x4f1939[_0x546c('0x7f')]);_0x59644e[_0x546c('0x3c')](_0x496471(_0x4f1939[_0x546c('0x7f')][_0x546c('0x69')]));}_0x118608=_0x59644e[_0x546c('0x89')]();_0x59644e[_0x546c('0x1c')](_0xf67203);_0x59644e[_0x546c('0x1f')](0x0);logger[_0x546c('0x81')](_0x546c('0xa6'),_0x59644e[_0x546c('0x9a')]());return dbH['sequelize'][_0x546c('0x33')](_0x59644e[_0x546c('0x9a')](),{'type':dbH[_0x546c('0x82')]['QueryTypes'][_0x546c('0xa0')]});}})['then'](function(){return{'sql':_0x118608[_0x546c('0x9a')]()};})[_0x546c('0x25')](respondWithResult(_0x332718,null))[_0x546c('0x45')](handleError(_0x332718,null));}; \ No newline at end of file +var _0xe3e7=['value','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','UNIX_TIMESTAMP(%s)','operator','getFields','Sequelize','metric','DESC','web','fullPath','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','reject','then','destroy','CustomReports','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0xe3e7,0xe0));var _0x7e3e=function(_0x4a3f01,_0x20687d){_0x4a3f01=_0x4a3f01-0x0;var _0x14fd54=_0xe3e7[_0x4a3f01];return _0x14fd54;};'use strict';var emlformat=require(_0x7e3e('0x0'));var rimraf=require(_0x7e3e('0x1'));var zipdir=require(_0x7e3e('0x2'));var jsonpatch=require(_0x7e3e('0x3'));var rp=require(_0x7e3e('0x4'));var moment=require(_0x7e3e('0x5'));var BPromise=require(_0x7e3e('0x6'));var Mustache=require('mustache');var util=require(_0x7e3e('0x7'));var path=require(_0x7e3e('0x8'));var sox=require(_0x7e3e('0x9'));var csv=require(_0x7e3e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e3e('0xb'));var _=require(_0x7e3e('0xc'));var squel=require(_0x7e3e('0xd'));var crypto=require(_0x7e3e('0xe'));var jsforce=require(_0x7e3e('0xf'));var deskjs=require(_0x7e3e('0x10'));var toCsv=require(_0x7e3e('0xa'));var querystring=require(_0x7e3e('0x11'));var Papa=require(_0x7e3e('0x12'));var Redis=require(_0x7e3e('0x13'));var authService=require(_0x7e3e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7e3e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e3e('0x16'))(_0x7e3e('0x17'));var utils=require(_0x7e3e('0x18'));var config=require(_0x7e3e('0x19'));var licenseUtil=require(_0x7e3e('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7e3e('0x1b'))['dbH'];function respondWithStatusCode(_0x29d33e,_0x4e65a5){_0x4e65a5=_0x4e65a5||0xcc;return function(_0x3005e9){if(_0x3005e9){return _0x29d33e['sendStatus'](_0x4e65a5);}return _0x29d33e['status'](_0x4e65a5)['end']();};}function respondWithResult(_0xd7edff,_0x59d785){_0x59d785=_0x59d785||0xc8;return function(_0xc0f7ca){if(_0xc0f7ca){return _0xd7edff[_0x7e3e('0x1c')](_0x59d785)[_0x7e3e('0x1d')](_0xc0f7ca);}};}function respondWithFilteredResult(_0x3c7313,_0xa62ace){return function(_0x4757fe){if(_0x4757fe){var _0x5bf61e=typeof _0xa62ace[_0x7e3e('0x1e')]===_0x7e3e('0x1f')&&typeof _0xa62ace['limit']==='undefined';var _0x47c04c=_0x4757fe[_0x7e3e('0x20')];var _0x368288=_0x5bf61e?0x0:_0xa62ace[_0x7e3e('0x1e')];var _0x15fba6=_0x5bf61e?_0x4757fe[_0x7e3e('0x20')]:_0xa62ace[_0x7e3e('0x1e')]+_0xa62ace['limit'];var _0x272cff;if(_0x15fba6>=_0x47c04c){_0x15fba6=_0x47c04c;_0x272cff=0xc8;}else{_0x272cff=0xce;}_0x3c7313[_0x7e3e('0x1c')](_0x272cff);return _0x3c7313['set'](_0x7e3e('0x21'),_0x368288+'-'+_0x15fba6+'/'+_0x47c04c)[_0x7e3e('0x1d')](_0x4757fe);}return null;};}function patchUpdates(_0x172997){return function(_0x47b832){try{jsonpatch[_0x7e3e('0x22')](_0x47b832,_0x172997,!![]);}catch(_0x18d1a9){return BPromise[_0x7e3e('0x23')](_0x18d1a9);}return _0x47b832['save']();};}function saveUpdates(_0x2b94a7,_0x4a3a6f){return function(_0x506e5c){if(_0x506e5c){return _0x506e5c['update'](_0x2b94a7)[_0x7e3e('0x24')](function(_0x353f30){return _0x353f30;});}return null;};}function removeEntity(_0x1a1854,_0x3a723f){return function(_0x1e82ab){if(_0x1e82ab){return _0x1e82ab[_0x7e3e('0x25')]()[_0x7e3e('0x24')](function(){var _0x11deea=_0x1e82ab['get']({'plain':!![]});var _0x3fb5d3=_0x7e3e('0x26');return db[_0x7e3e('0x27')]['destroy']({'where':{'type':_0x3fb5d3,'resourceId':_0x11deea['id']}})[_0x7e3e('0x24')](function(){return _0x1e82ab;});})[_0x7e3e('0x24')](function(){_0x1a1854[_0x7e3e('0x1c')](0xcc)[_0x7e3e('0x28')]();});}};}function handleEntityNotFound(_0x567040,_0x16361d){return function(_0x1fefc0){if(!_0x1fefc0){_0x567040[_0x7e3e('0x29')](0x194);}return _0x1fefc0;};}function handleError(_0x5e38de,_0x4f44a0){_0x4f44a0=_0x4f44a0||0x1f4;return function(_0x1bd40e){logger[_0x7e3e('0x2a')](_0x1bd40e[_0x7e3e('0x2b')]);if(_0x1bd40e[_0x7e3e('0x2c')]){delete _0x1bd40e['name'];}_0x5e38de[_0x7e3e('0x1c')](_0x4f44a0)[_0x7e3e('0x2d')](_0x1bd40e);};}exports[_0x7e3e('0x2e')]=function(_0x4a4b7d,_0x4e2d89){var _0x3e75ab={},_0x72a15f={},_0x34b68f={'count':0x0,'rows':[]};var _0x1624a4=_[_0x7e3e('0x2f')](db[_0x7e3e('0x30')][_0x7e3e('0x31')],function(_0x417585){return{'name':_0x417585[_0x7e3e('0x32')],'type':_0x417585['type'][_0x7e3e('0x33')]};});_0x72a15f[_0x7e3e('0x34')]=_[_0x7e3e('0x2f')](_0x1624a4,_0x7e3e('0x2c'));_0x72a15f[_0x7e3e('0x35')]=_[_0x7e3e('0x36')](_0x4a4b7d[_0x7e3e('0x35')]);_0x72a15f[_0x7e3e('0x37')]=_[_0x7e3e('0x38')](_0x72a15f[_0x7e3e('0x34')],_0x72a15f['query']);_0x3e75ab['attributes']=_['intersection'](_0x72a15f[_0x7e3e('0x34')],qs[_0x7e3e('0x39')](_0x4a4b7d[_0x7e3e('0x35')]['fields']));_0x3e75ab['attributes']=_0x3e75ab['attributes']['length']?_0x3e75ab[_0x7e3e('0x3a')]:_0x72a15f[_0x7e3e('0x34')];if(!_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x3b')](_0x7e3e('0x3c'))){_0x3e75ab[_0x7e3e('0x3d')]=qs[_0x7e3e('0x3d')](_0x4a4b7d['query'][_0x7e3e('0x3d')]);_0x3e75ab[_0x7e3e('0x1e')]=qs[_0x7e3e('0x1e')](_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x1e')]);}_0x3e75ab[_0x7e3e('0x3e')]=qs[_0x7e3e('0x3f')](_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x3f')]);_0x3e75ab[_0x7e3e('0x40')]=qs[_0x7e3e('0x37')](_['pick'](_0x4a4b7d[_0x7e3e('0x35')],_0x72a15f[_0x7e3e('0x37')]),_0x1624a4);if(_0x4a4b7d[_0x7e3e('0x35')][_0x7e3e('0x41')]){_0x3e75ab[_0x7e3e('0x40')]=_[_0x7e3e('0x42')](_0x3e75ab[_0x7e3e('0x40')],{'$or':_[_0x7e3e('0x2f')](_0x1624a4,function(_0x5a16bc){if(_0x5a16bc[_0x7e3e('0x43')]!==_0x7e3e('0x44')){var _0x4e91c0={};_0x4e91c0[_0x5a16bc['name']]={'$like':'%'+_0x4a4b7d[_0x7e3e('0x35')]['filter']+'%'};return _0x4e91c0;}})});}_0x3e75ab=_['merge']({},_0x3e75ab,_0x4a4b7d[_0x7e3e('0x45')]);var _0x1dedc9={'where':_0x3e75ab[_0x7e3e('0x40')]};return db[_0x7e3e('0x30')][_0x7e3e('0x20')](_0x1dedc9)[_0x7e3e('0x24')](function(_0x871427){_0x34b68f['count']=_0x871427;if(_0x4a4b7d[_0x7e3e('0x35')]['includeAll']){_0x3e75ab[_0x7e3e('0x46')]=[{'all':!![]}];}return db[_0x7e3e('0x30')][_0x7e3e('0x47')](_0x3e75ab);})[_0x7e3e('0x24')](function(_0x2662a9){_0x34b68f[_0x7e3e('0x48')]=_0x2662a9;return _0x34b68f;})[_0x7e3e('0x24')](respondWithFilteredResult(_0x4e2d89,_0x3e75ab))[_0x7e3e('0x49')](handleError(_0x4e2d89,null));};exports['show']=function(_0x557f10,_0x5158a0){var _0x5f44bd={'raw':![],'where':{'id':_0x557f10[_0x7e3e('0x4a')]['id']}},_0x37729f={};_0x37729f[_0x7e3e('0x34')]=_['keys'](db['AnalyticCustomReport'][_0x7e3e('0x31')]);_0x37729f[_0x7e3e('0x35')]=_['keys'](_0x557f10[_0x7e3e('0x35')]);_0x37729f[_0x7e3e('0x37')]=_[_0x7e3e('0x38')](_0x37729f[_0x7e3e('0x34')],_0x37729f[_0x7e3e('0x35')]);_0x5f44bd[_0x7e3e('0x3a')]=_['intersection'](_0x37729f[_0x7e3e('0x34')],qs[_0x7e3e('0x39')](_0x557f10[_0x7e3e('0x35')][_0x7e3e('0x39')]));_0x5f44bd['attributes']=_0x5f44bd['attributes']['length']?_0x5f44bd['attributes']:_0x37729f[_0x7e3e('0x34')];if(_0x557f10['query'][_0x7e3e('0x4b')]){_0x5f44bd[_0x7e3e('0x46')]=[{'all':!![]}];}_0x5f44bd=_[_0x7e3e('0x42')]({},_0x5f44bd,_0x557f10['options']);return db[_0x7e3e('0x30')][_0x7e3e('0x4c')](_0x5f44bd)[_0x7e3e('0x24')](handleEntityNotFound(_0x5158a0,null))[_0x7e3e('0x24')](respondWithResult(_0x5158a0,null))['catch'](handleError(_0x5158a0,null));};exports['create']=function(_0x436743,_0x3144a6){return db[_0x7e3e('0x30')][_0x7e3e('0x4d')](_0x436743[_0x7e3e('0x4e')],{})[_0x7e3e('0x24')](function(_0x561501){var _0x42b7f7=_0x436743[_0x7e3e('0x4f')][_0x7e3e('0x50')]({'plain':!![]});if(!_0x42b7f7)throw new Error(_0x7e3e('0x51'));if(_0x42b7f7['role']===_0x7e3e('0x4f')){var _0x745c6d=_0x561501[_0x7e3e('0x50')]({'plain':!![]});var _0x199f0c=_0x7e3e('0x52');return db[_0x7e3e('0x53')][_0x7e3e('0x4c')]({'where':{'name':_0x199f0c,'userProfileId':_0x42b7f7['userProfileId']},'raw':!![]})[_0x7e3e('0x24')](function(_0x3f1caf){if(_0x3f1caf&&_0x3f1caf[_0x7e3e('0x54')]===0x0){return db[_0x7e3e('0x27')][_0x7e3e('0x4d')]({'name':_0x745c6d[_0x7e3e('0x2c')],'resourceId':_0x745c6d['id'],'type':_0x7e3e('0x26'),'sectionId':_0x3f1caf['id']},{})['then'](function(){return _0x561501;});}else{return _0x561501;}})[_0x7e3e('0x49')](function(_0x1ce5b2){logger[_0x7e3e('0x2a')](_0x7e3e('0x55'),_0x1ce5b2);throw _0x1ce5b2;});}return _0x561501;})['then'](respondWithResult(_0x3144a6,0xc9))[_0x7e3e('0x49')](handleError(_0x3144a6,null));};exports['update']=function(_0x48aaf8,_0x472679){if(_0x48aaf8['body']['id']){delete _0x48aaf8[_0x7e3e('0x4e')]['id'];}return db[_0x7e3e('0x30')][_0x7e3e('0x4c')]({'where':{'id':_0x48aaf8[_0x7e3e('0x4a')]['id']}})[_0x7e3e('0x24')](handleEntityNotFound(_0x472679,null))['then'](saveUpdates(_0x48aaf8[_0x7e3e('0x4e')],null))[_0x7e3e('0x24')](respondWithResult(_0x472679,null))[_0x7e3e('0x49')](handleError(_0x472679,null));};exports['destroy']=function(_0x371844,_0x5bc668){return db[_0x7e3e('0x30')][_0x7e3e('0x4c')]({'where':{'id':_0x371844['params']['id']}})[_0x7e3e('0x24')](handleEntityNotFound(_0x5bc668,null))['then'](removeEntity(_0x5bc668,null))['catch'](handleError(_0x5bc668,null));};exports['preview']=function(_0x3a650c,_0x277577){var _0x523360=0xa;var _0x18c115=[_0x7e3e('0x56'),'left_join',_0x7e3e('0x57'),_0x7e3e('0x58')];var _0x504896={'SUM':_0x7e3e('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e3e('0x5a'),'MIN':_0x7e3e('0x5b'),'AVG':_0x7e3e('0x5c'),'GROUP_CONCAT':_0x7e3e('0x5d'),'GROUP_CONCAT ASC':_0x7e3e('0x5e'),'GROUP_CONCAT DESC':_0x7e3e('0x5f')};var _0x15273a={'SEC_TO_TIME':_0x7e3e('0x60'),'DATE':_0x7e3e('0x61'),'HOUR':_0x7e3e('0x62'),'ROUND':_0x7e3e('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x416cc7=function(_0x145889){return!_[_0x7e3e('0x64')]([_0x7e3e('0x65'),_0x7e3e('0x66'),'IS\x20EMPTY',_0x7e3e('0x67')],_0x145889);};var _0x263f72=function(_0x778929){if(!_0x778929||!_0x778929[_0x7e3e('0x68')][_0x7e3e('0x69')]){return'';}for(var _0x1a5ad6='(',_0x27d987=0x0;_0x27d987<_0x778929[_0x7e3e('0x68')][_0x7e3e('0x69')];_0x27d987+=0x1){_0x27d987>0x0&&(_0x1a5ad6+='\x20'+_0x778929['operator']+'\x20');_0x1a5ad6+=_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6a')]?_0x263f72(_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6a')]):_0x778929['rules'][_0x27d987]['field']+'\x20'+_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6b')]+(_0x416cc7(_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6b')])?'\x20'+_0x778929[_0x7e3e('0x68')][_0x27d987][_0x7e3e('0x6c')]:'');}return _0x1a5ad6+')';};var _0x4881d3={'where':{'id':_0x3a650c[_0x7e3e('0x4a')]['id']}},_0x243f98,_0xa2f3c0,_0x544cd3,_0x37efac,_0x31dcc3;_0x4881d3=_[_0x7e3e('0x42')]({},_0x4881d3,_0x3a650c[_0x7e3e('0x45')]);return db[_0x7e3e('0x30')]['find'](_0x4881d3)[_0x7e3e('0x24')](function(_0x57ceb9){if(_0x57ceb9){_0x243f98=_0x57ceb9;return _0x57ceb9['getFields']();}return null;})[_0x7e3e('0x24')](function(_0xa3c747){if(_0xa3c747){if(!_0xa3c747[_0x7e3e('0x69')]){throw new db['Sequelize'][(_0x7e3e('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa2f3c0=_0xa3c747;return db[_0x7e3e('0x6e')][_0x7e3e('0x47')]({'raw':!![]});}return null;})[_0x7e3e('0x24')](function(_0x7074ee){if(_0x7074ee){_0x544cd3=_[_0x7e3e('0x6f')](_0x7074ee,'id');var _0x1ef028;var _0x2d6f44=squel[_0x7e3e('0x70')]();_0x2d6f44[_0x7e3e('0x71')](_0x243f98[_0x7e3e('0x72')]);for(var _0x31328f=0x0;_0x31328f<_0xa2f3c0[_0x7e3e('0x69')];_0x31328f+=0x1){_0x1ef028=_0xa2f3c0[_0x31328f][_0x7e3e('0x73')]?_0x544cd3[_0xa2f3c0[_0x31328f][_0x7e3e('0x73')]]['metric']:_0xa2f3c0[_0x31328f][_0x7e3e('0x74')];_0x1ef028=_0xa2f3c0[_0x31328f][_0x7e3e('0x75')]?_[_0x7e3e('0x76')](_0x504896[_0xa2f3c0[_0x31328f][_0x7e3e('0x75')]],'%s',_0x1ef028):_0x1ef028;_0x1ef028=_0xa2f3c0[_0x31328f]['format']?_['replace'](_0x15273a[_0xa2f3c0[_0x31328f][_0x7e3e('0x77')]],'%s',_0x1ef028):_0x1ef028;if(_0xa2f3c0[_0x31328f][_0x7e3e('0x78')]){_0x2d6f44[_0x7e3e('0x6a')](_0x1ef028);}_0xa2f3c0[_0x31328f][_0x7e3e('0x79')]&&_0x2d6f44[_0x7e3e('0x3e')](_0x1ef028,_0xa2f3c0[_0x31328f]['orderBy']==='DESC'?![]:!![]);_0x2d6f44['field'](_0x1ef028,_0xa2f3c0[_0x31328f][_0x7e3e('0x7a')]||_0x1ef028);}if(_0x243f98['joins']){_0x243f98[_0x7e3e('0x7b')]=JSON[_0x7e3e('0x7c')](_0x243f98['joins']);for(var _0x4b2296=0x0;_0x4b2296<_0x243f98[_0x7e3e('0x7b')][_0x7e3e('0x69')];_0x4b2296+=0x1){if(_0x243f98[_0x7e3e('0x7b')][_0x4b2296]['type']&&_[_0x7e3e('0x64')](_0x18c115,_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x43')])&&_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7d')]&&_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7e')]&&_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7f')]){_0x2d6f44[_0x243f98['joins'][_0x4b2296]['type']](_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7e')],null,util[_0x7e3e('0x77')](_0x7e3e('0x80'),_0x243f98[_0x7e3e('0x72')],_0x243f98['joins'][_0x4b2296][_0x7e3e('0x7d')],_0x243f98[_0x7e3e('0x7b')][_0x4b2296]['foreignTable'],_0x243f98[_0x7e3e('0x7b')][_0x4b2296][_0x7e3e('0x7f')]));}}}if(_0x243f98[_0x7e3e('0x81')]){_0x243f98[_0x7e3e('0x81')]=JSON['parse'](_0x243f98[_0x7e3e('0x81')]);_0x2d6f44[_0x7e3e('0x40')](_0x263f72(_0x243f98[_0x7e3e('0x81')][_0x7e3e('0x6a')]));}_0x31dcc3=_0x2d6f44[_0x7e3e('0x82')]();_0x2d6f44[_0x7e3e('0x3d')](_0x523360);_0x2d6f44[_0x7e3e('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x2d6f44[_0x7e3e('0x83')]());return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x2d6f44['toString'](),{'type':dbH['sequelize'][_0x7e3e('0x85')][_0x7e3e('0x86')]});}})[_0x7e3e('0x24')](respondWithResult(_0x277577,null))[_0x7e3e('0x49')](handleError(_0x277577,null));};function runReport(_0x5ac425,_0x3bb96d,_0x3ec1c2){var _0x31ff60=_0x3bb96d['name'];var _0x3a6056=0xa;var _0x57939b=['join','left_join','right_join',_0x7e3e('0x58')];var _0x111cd0={'SUM':_0x7e3e('0x59'),'COUNT':_0x7e3e('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e3e('0x5a'),'MIN':_0x7e3e('0x5b'),'AVG':_0x7e3e('0x5c'),'GROUP_CONCAT':_0x7e3e('0x5d'),'GROUP_CONCAT ASC':_0x7e3e('0x5e'),'GROUP_CONCAT DESC':_0x7e3e('0x5f')};var _0x443439={'SEC_TO_TIME':_0x7e3e('0x60'),'DATE':'DATE(%s)','HOUR':_0x7e3e('0x62'),'ROUND':_0x7e3e('0x63'),'UNIX_TIMESTAMP':_0x7e3e('0x88')};var _0x2f7659=function(_0x11529c){return!_[_0x7e3e('0x64')]([_0x7e3e('0x65'),_0x7e3e('0x66'),'IS\x20EMPTY',_0x7e3e('0x67')],_0x11529c);};var _0x3c6988=function(_0x57bb00){if(!_0x57bb00||!_0x57bb00[_0x7e3e('0x68')]['length']){return'';}for(var _0x5a767e='(',_0x283f4f=0x0;_0x283f4f<_0x57bb00[_0x7e3e('0x68')][_0x7e3e('0x69')];_0x283f4f+=0x1){_0x283f4f>0x0&&(_0x5a767e+='\x20'+_0x57bb00[_0x7e3e('0x89')]+'\x20');_0x5a767e+=_0x57bb00[_0x7e3e('0x68')][_0x283f4f]['group']?_0x3c6988(_0x57bb00[_0x7e3e('0x68')][_0x283f4f]['group']):_0x57bb00[_0x7e3e('0x68')][_0x283f4f][_0x7e3e('0x74')]+'\x20'+_0x57bb00[_0x7e3e('0x68')][_0x283f4f][_0x7e3e('0x6b')]+(_0x2f7659(_0x57bb00[_0x7e3e('0x68')][_0x283f4f][_0x7e3e('0x6b')])?'\x20'+_0x57bb00[_0x7e3e('0x68')][_0x283f4f]['value']:'');}return _0x5a767e+')';};var _0xa1e13e={'where':{'id':_0x5ac425['id']}},_0x36df4b,_0x251633,_0x3f0eec,_0x3bc987,_0x3fc085;_0xa1e13e=_[_0x7e3e('0x42')]({},_0xa1e13e,_0x3ec1c2);return db[_0x7e3e('0x30')]['find'](_0xa1e13e)[_0x7e3e('0x24')](function(_0x44a558){if(_0x44a558){_0x36df4b=_0x44a558;return _0x44a558[_0x7e3e('0x8a')]();}return null;})[_0x7e3e('0x24')](function(_0x39bf5e){if(_0x39bf5e){if(!_0x39bf5e[_0x7e3e('0x69')]){throw new db[(_0x7e3e('0x8b'))][(_0x7e3e('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x251633=_0x39bf5e;return db['AnalyticMetric'][_0x7e3e('0x47')]({'raw':!![]});}return null;})[_0x7e3e('0x24')](function(_0x5492e6){if(_0x5492e6){_0x3f0eec=_[_0x7e3e('0x6f')](_0x5492e6,'id');var _0x10b209;var _0x3a91d4=squel[_0x7e3e('0x70')]();_0x3a91d4['from'](_0x36df4b[_0x7e3e('0x72')]);for(var _0x369ae4=0x0;_0x369ae4<_0x251633[_0x7e3e('0x69')];_0x369ae4+=0x1){_0x10b209=_0x251633[_0x369ae4]['MetricId']?_0x3f0eec[_0x251633[_0x369ae4][_0x7e3e('0x73')]][_0x7e3e('0x8c')]:_0x251633[_0x369ae4]['field'];_0x10b209=_0x251633[_0x369ae4][_0x7e3e('0x75')]?_[_0x7e3e('0x76')](_0x111cd0[_0x251633[_0x369ae4][_0x7e3e('0x75')]],'%s',_0x10b209):_0x10b209;_0x10b209=_0x251633[_0x369ae4][_0x7e3e('0x77')]?_['replace'](_0x443439[_0x251633[_0x369ae4]['format']],'%s',_0x10b209):_0x10b209;if(_0x251633[_0x369ae4]['groupBy']){_0x3a91d4[_0x7e3e('0x6a')](_0x10b209);}_0x251633[_0x369ae4][_0x7e3e('0x79')]&&_0x3a91d4['order'](_0x10b209,_0x251633[_0x369ae4]['orderBy']===_0x7e3e('0x8d')?![]:!![]);_0x3a91d4[_0x7e3e('0x74')](_0x10b209,_0x251633[_0x369ae4][_0x7e3e('0x7a')]||_0x10b209);}if(_0x36df4b[_0x7e3e('0x7b')]){_0x36df4b[_0x7e3e('0x7b')]=JSON[_0x7e3e('0x7c')](_0x36df4b['joins']);for(var _0x4fabcc=0x0;_0x4fabcc<_0x36df4b[_0x7e3e('0x7b')]['length'];_0x4fabcc+=0x1){if(_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x43')]&&_[_0x7e3e('0x64')](_0x57939b,_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x43')])&&_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7d')]&&_0x36df4b['joins'][_0x4fabcc][_0x7e3e('0x7e')]&&_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7f')]){_0x3a91d4[_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x43')]](_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7e')],null,util['format'](_0x7e3e('0x80'),_0x36df4b[_0x7e3e('0x72')],_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7d')],_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7e')],_0x36df4b[_0x7e3e('0x7b')][_0x4fabcc][_0x7e3e('0x7f')]));}}}if(_0x36df4b[_0x7e3e('0x81')]){_0x36df4b['conditions']=JSON[_0x7e3e('0x7c')](_0x36df4b[_0x7e3e('0x81')]);_0x3a91d4[_0x7e3e('0x40')](_0x3c6988(_0x36df4b[_0x7e3e('0x81')][_0x7e3e('0x6a')]));}_0x3fc085=_0x3a91d4[_0x7e3e('0x82')]();_0x3a91d4[_0x7e3e('0x3d')](_0x3a6056);_0x3a91d4[_0x7e3e('0x1e')](0x0);return;}})[_0x7e3e('0x24')](function(){if(_0x3bb96d['output']===_0x7e3e('0x8e')){return null;}var _0xb76605=_[_0x7e3e('0x42')](_0x3bb96d,{'name':_0x3bb96d[_0x7e3e('0x8f')]||_0x3bb96d[_0x7e3e('0x2c')]||_0x36df4b[_0x7e3e('0x2c')],'basename':_0x31ff60,'savename':util[_0x7e3e('0x77')]('%s-%s.%s',_0x3bb96d[_0x7e3e('0x2c')]||_0x36df4b['name'],require(_0x7e3e('0x90'))[_0x7e3e('0x91')](0x4),_0x3bb96d[_0x7e3e('0x92')]||_0x7e3e('0x93')),'reportId':_0x36df4b['id'],'reportType':_0x7e3e('0x94')});return db[_0x7e3e('0x95')][_0x7e3e('0x4d')](_0xb76605,{'raw':!![]});})[_0x7e3e('0x24')](function(_0x49d1ac){if(_0x36df4b[_0x7e3e('0x72')]===_0x7e3e('0x96')){_0x3fc085['where'](_0x36df4b['table']+_0x7e3e('0x97'),_0x3bb96d[_0x7e3e('0x98')],_0x3bb96d['endDate']);}else{_0x3fc085[_0x7e3e('0x40')](_0x36df4b[_0x7e3e('0x72')]+_0x7e3e('0x99'),_0x3bb96d[_0x7e3e('0x98')],_0x3bb96d[_0x7e3e('0x9a')]);}if(_0x49d1ac){logger[_0x7e3e('0x9b')](_0x7e3e('0x9c'),_0x3fc085[_0x7e3e('0x83')]());require(_0x7e3e('0x9d'))[_0x7e3e('0x9e')](path[_0x7e3e('0x56')](__dirname,'../../components/export/',_0x49d1ac[_0x7e3e('0x92')]),[_0x49d1ac['id'],_0x3fc085[_0x7e3e('0x83')](),path[_0x7e3e('0x56')](__dirname,_0x7e3e('0x9f'),_0x49d1ac[_0x7e3e('0xa0')]),_0x31ff60]);return _0x49d1ac;}else{var _0x53ce02=squel[_0x7e3e('0x70')]();_0x53ce02[_0x7e3e('0x71')]('('+_0x3fc085[_0x7e3e('0x83')]()+')',_0x7e3e('0xa1'));_0x53ce02['field'](_0x7e3e('0xa2'),_0x7e3e('0x20'));_0x3fc085['limit'](_0x3bb96d[_0x7e3e('0x3d')]||_0x3a6056);_0x3fc085[_0x7e3e('0x1e')](_0x3bb96d['offset']||0x0);return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x53ce02[_0x7e3e('0x83')](),{'type':dbH[_0x7e3e('0x84')][_0x7e3e('0x85')][_0x7e3e('0x86')]})[_0x7e3e('0x24')](function(_0x302003){if(!_0x302003['length']){_0x3bc987=0x0;}else{_0x3bc987=_0x302003[0x0][_0x7e3e('0x20')]||0x0;}return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x3fc085[_0x7e3e('0x83')](),{'type':dbH[_0x7e3e('0x84')]['QueryTypes'][_0x7e3e('0x86')]});})[_0x7e3e('0x24')](function(_0x422aa7){return{'rows':_0x422aa7||[],'count':_0x3bc987};});}});}exports[_0x7e3e('0xa3')]=function(_0x31b506,_0x1d73a6){return runReport(_0x31b506[_0x7e3e('0x4a')],_0x31b506[_0x7e3e('0x35')],_0x31b506[_0x7e3e('0x45')])[_0x7e3e('0x24')](respondWithResult(_0x1d73a6,null))[_0x7e3e('0x49')](handleError(_0x1d73a6,null));};exports['runReport']=runReport;exports[_0x7e3e('0x35')]=function(_0x498fab,_0x1d5200){var _0x572f3f=0xa;var _0x29fe13=[_0x7e3e('0x56'),'left_join',_0x7e3e('0x57'),_0x7e3e('0x58')];var _0x370e92={'SUM':_0x7e3e('0x59'),'COUNT':_0x7e3e('0x87'),'COUNT DISTINCT':_0x7e3e('0xa4'),'MAX':_0x7e3e('0x5a'),'MIN':_0x7e3e('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7e3e('0x5d'),'GROUP_CONCAT ASC':_0x7e3e('0x5e'),'GROUP_CONCAT DESC':_0x7e3e('0x5f')};var _0xc221f={'SEC_TO_TIME':_0x7e3e('0x60'),'DATE':_0x7e3e('0x61'),'HOUR':_0x7e3e('0x62'),'ROUND':_0x7e3e('0x63'),'UNIX_TIMESTAMP':_0x7e3e('0x88')};var _0x221511=function(_0x1020c6){return!_[_0x7e3e('0x64')]([_0x7e3e('0x65'),_0x7e3e('0x66'),_0x7e3e('0xa5'),_0x7e3e('0x67')],_0x1020c6);};var _0x53afe7=function(_0x32d65c){if(!_0x32d65c||!_0x32d65c['rules'][_0x7e3e('0x69')]){return'';}for(var _0x90fcd2='(',_0x48ed9e=0x0;_0x48ed9e<_0x32d65c[_0x7e3e('0x68')]['length'];_0x48ed9e+=0x1){_0x48ed9e>0x0&&(_0x90fcd2+='\x20'+_0x32d65c[_0x7e3e('0x89')]+'\x20');_0x90fcd2+=_0x32d65c['rules'][_0x48ed9e]['group']?_0x53afe7(_0x32d65c[_0x7e3e('0x68')][_0x48ed9e][_0x7e3e('0x6a')]):_0x32d65c[_0x7e3e('0x68')][_0x48ed9e][_0x7e3e('0x74')]+'\x20'+_0x32d65c[_0x7e3e('0x68')][_0x48ed9e][_0x7e3e('0x6b')]+(_0x221511(_0x32d65c['rules'][_0x48ed9e][_0x7e3e('0x6b')])?'\x20'+_0x32d65c['rules'][_0x48ed9e]['value']:'');}return _0x90fcd2+')';};var _0x460b07={'where':{'id':_0x498fab[_0x7e3e('0x4a')]['id']}},_0x17f769,_0x27b1a8,_0x14b123,_0x238495,_0x1dd59e;_0x460b07=_[_0x7e3e('0x42')]({},_0x460b07,_0x498fab[_0x7e3e('0x45')]);return db[_0x7e3e('0x30')][_0x7e3e('0x4c')](_0x460b07)[_0x7e3e('0x24')](function(_0x2edc81){if(_0x2edc81){_0x17f769=_0x2edc81;return _0x2edc81[_0x7e3e('0x8a')]();}return null;})['then'](function(_0x280031){if(_0x280031){if(!_0x280031[_0x7e3e('0x69')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x27b1a8=_0x280031;return db[_0x7e3e('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x7e3e('0x24')](function(_0x4dc56e){if(_0x4dc56e){_0x14b123=_['keyBy'](_0x4dc56e,'id');var _0x26133f;var _0x492aaa=squel[_0x7e3e('0x70')]();_0x492aaa['from'](_0x17f769[_0x7e3e('0x72')]);for(var _0xf21490=0x0;_0xf21490<_0x27b1a8[_0x7e3e('0x69')];_0xf21490+=0x1){_0x26133f=_0x27b1a8[_0xf21490][_0x7e3e('0x73')]?_0x14b123[_0x27b1a8[_0xf21490][_0x7e3e('0x73')]][_0x7e3e('0x8c')]:_0x27b1a8[_0xf21490][_0x7e3e('0x74')];_0x26133f=_0x27b1a8[_0xf21490]['function']?_[_0x7e3e('0x76')](_0x370e92[_0x27b1a8[_0xf21490][_0x7e3e('0x75')]],'%s',_0x26133f):_0x26133f;_0x26133f=_0x27b1a8[_0xf21490]['format']?_[_0x7e3e('0x76')](_0xc221f[_0x27b1a8[_0xf21490]['format']],'%s',_0x26133f):_0x26133f;if(_0x27b1a8[_0xf21490][_0x7e3e('0x78')]){_0x492aaa[_0x7e3e('0x6a')](_0x26133f);}_0x27b1a8[_0xf21490][_0x7e3e('0x79')]&&_0x492aaa['order'](_0x26133f,_0x27b1a8[_0xf21490][_0x7e3e('0x79')]===_0x7e3e('0x8d')?![]:!![]);_0x492aaa[_0x7e3e('0x74')](_0x26133f,_0x27b1a8[_0xf21490][_0x7e3e('0x7a')]||_0x26133f);}if(_0x17f769[_0x7e3e('0x7b')]){_0x17f769[_0x7e3e('0x7b')]=JSON[_0x7e3e('0x7c')](_0x17f769[_0x7e3e('0x7b')]);for(var _0x123e20=0x0;_0x123e20<_0x17f769['joins']['length'];_0x123e20+=0x1){if(_0x17f769['joins'][_0x123e20][_0x7e3e('0x43')]&&_['includes'](_0x29fe13,_0x17f769['joins'][_0x123e20][_0x7e3e('0x43')])&&_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7d')]&&_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7e')]&&_0x17f769['joins'][_0x123e20][_0x7e3e('0x7f')]){_0x492aaa[_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x43')]](_0x17f769[_0x7e3e('0x7b')][_0x123e20]['foreignTable'],null,util[_0x7e3e('0x77')](_0x7e3e('0x80'),_0x17f769[_0x7e3e('0x72')],_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7d')],_0x17f769[_0x7e3e('0x7b')][_0x123e20]['foreignTable'],_0x17f769[_0x7e3e('0x7b')][_0x123e20][_0x7e3e('0x7f')]));}}}if(_0x17f769[_0x7e3e('0x81')]){_0x17f769[_0x7e3e('0x81')]=JSON['parse'](_0x17f769['conditions']);_0x492aaa[_0x7e3e('0x40')](_0x53afe7(_0x17f769[_0x7e3e('0x81')][_0x7e3e('0x6a')]));}_0x1dd59e=_0x492aaa[_0x7e3e('0x82')]();_0x492aaa[_0x7e3e('0x3d')](_0x572f3f);_0x492aaa['offset'](0x0);logger['debug']('Limited\x20Query:',_0x492aaa[_0x7e3e('0x83')]());return dbH[_0x7e3e('0x84')][_0x7e3e('0x35')](_0x492aaa[_0x7e3e('0x83')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x7e3e('0x24')](function(){return{'sql':_0x1dd59e[_0x7e3e('0x83')]()};})[_0x7e3e('0x24')](respondWithResult(_0x1d5200,null))[_0x7e3e('0x49')](handleError(_0x1d5200,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 69c68cf..56d1def 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 _0xad7a=['util','../../config/logger','api','moment','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x1b7890,_0x354ed1){var _0x5675d7=function(_0x8d13be){while(--_0x8d13be){_0x1b7890['push'](_0x1b7890['shift']());}};_0x5675d7(++_0x354ed1);}(_0xad7a,0x196));var _0xaad7=function(_0x141297,_0xc9ba96){_0x141297=_0x141297-0x0;var _0x237cfa=_0xad7a[_0x141297];return _0x237cfa;};'use strict';var _=require(_0xaad7('0x0'));var util=require(_0xaad7('0x1'));var logger=require(_0xaad7('0x2'))(_0xaad7('0x3'));var moment=require(_0xaad7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaad7('0x5'));var config=require(_0xaad7('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xaad7('0x7')]=function(_0x4d8f3b,_0x1d2ee5){return _0x4d8f3b[_0xaad7('0x8')](_0xaad7('0x9'),attributes,{'tableName':_0xaad7('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd502=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger','moment'];(function(_0x597e6c,_0x37ddaa){var _0x10bc1c=function(_0x1a5fda){while(--_0x1a5fda){_0x597e6c['push'](_0x597e6c['shift']());}};_0x10bc1c(++_0x37ddaa);}(_0xd502,0x135));var _0x2d50=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0xd502[_0x5c8628];return _0xcbd50e;};'use strict';var _=require(_0x2d50('0x0'));var util=require('util');var logger=require(_0x2d50('0x1'))('api');var moment=require(_0x2d50('0x2'));var BPromise=require(_0x2d50('0x3'));var rp=require(_0x2d50('0x4'));var fs=require('fs');var path=require(_0x2d50('0x5'));var rimraf=require(_0x2d50('0x6'));var config=require(_0x2d50('0x7'));var attributes=require(_0x2d50('0x8'));module[_0x2d50('0x9')]=function(_0x137dce,_0x1e6624){return _0x137dce[_0x2d50('0xa')](_0x2d50('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 0ba3c04..b738d66 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 _0xa8f8=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xa8f8,0x71));var _0x8a8f=function(_0x23d0a1,_0x5011a){_0x23d0a1=_0x23d0a1-0x0;var _0x1ef866=_0xa8f8[_0x23d0a1];return _0x1ef866;};'use strict';var _=require(_0x8a8f('0x0'));var util=require(_0x8a8f('0x1'));var moment=require('moment');var BPromise=require(_0x8a8f('0x2'));var rs=require(_0x8a8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a8f('0x5'))(_0x8a8f('0x6'));var config=require(_0x8a8f('0x7'));var jayson=require(_0x8a8f('0x8'));var client=jayson[_0x8a8f('0x9')][_0x8a8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45ce76,_0x198340,_0x27f074){return new BPromise(function(_0x33edd1,_0x3f4d16){return client[_0x8a8f('0xb')](_0x45ce76,_0x27f074)['then'](function(_0x29652f){logger['info'](_0x8a8f('0xc'),_0x198340,_0x8a8f('0xd'));logger[_0x8a8f('0xe')](_0x8a8f('0xf'),_0x198340,_0x8a8f('0xd'),JSON[_0x8a8f('0x10')](_0x29652f));if(_0x29652f[_0x8a8f('0x11')]){if(_0x29652f[_0x8a8f('0x11')][_0x8a8f('0x12')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x198340,_0x29652f[_0x8a8f('0x11')][_0x8a8f('0x13')]);return _0x3f4d16(_0x29652f[_0x8a8f('0x11')][_0x8a8f('0x13')]);}logger[_0x8a8f('0x11')](_0x8a8f('0xc'),_0x198340,_0x29652f['error'][_0x8a8f('0x13')]);return _0x33edd1(_0x29652f[_0x8a8f('0x11')][_0x8a8f('0x13')]);}else{logger[_0x8a8f('0x14')](_0x8a8f('0xc'),_0x198340,_0x8a8f('0xd'));_0x33edd1(_0x29652f[_0x8a8f('0x15')][_0x8a8f('0x13')]);}})[_0x8a8f('0x16')](function(_0x4e0884){logger[_0x8a8f('0x11')](_0x8a8f('0xc'),_0x198340,_0x4e0884);_0x3f4d16(_0x4e0884);});});} \ No newline at end of file +var _0xbf37=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf37,0xfd));var _0x7bf3=function(_0x105a77,_0x39b87b){_0x105a77=_0x105a77-0x0;var _0x3e8155=_0xbf37[_0x105a77];return _0x3e8155;};'use strict';var _=require(_0x7bf3('0x0'));var util=require(_0x7bf3('0x1'));var moment=require(_0x7bf3('0x2'));var BPromise=require(_0x7bf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf3('0x4'));var db=require(_0x7bf3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bf3('0x6'))(_0x7bf3('0x7'));var config=require('../../config/environment');var jayson=require(_0x7bf3('0x8'));var client=jayson[_0x7bf3('0x9')][_0x7bf3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x386b07,_0x2da045,_0x2ed1de){return new BPromise(function(_0x39a35f,_0x5a5063){return client['request'](_0x386b07,_0x2ed1de)[_0x7bf3('0xb')](function(_0x248bcf){logger[_0x7bf3('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2da045,'request\x20sent');logger['debug'](_0x7bf3('0xd'),_0x2da045,_0x7bf3('0xe'),JSON['stringify'](_0x248bcf));if(_0x248bcf[_0x7bf3('0xf')]){if(_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x10')]===0x1f4){logger[_0x7bf3('0xf')](_0x7bf3('0x11'),_0x2da045,_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x12')]);return _0x5a5063(_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x12')]);}logger[_0x7bf3('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2da045,_0x248bcf[_0x7bf3('0xf')][_0x7bf3('0x12')]);return _0x39a35f(_0x248bcf['error'][_0x7bf3('0x12')]);}else{logger[_0x7bf3('0xc')](_0x7bf3('0x11'),_0x2da045,_0x7bf3('0xe'));_0x39a35f(_0x248bcf[_0x7bf3('0x13')]['message']);}})[_0x7bf3('0x14')](function(_0x81a9eb){logger[_0x7bf3('0xf')](_0x7bf3('0x11'),_0x2da045,_0x81a9eb);_0x5a5063(_0x81a9eb);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 367de83..4c80a16 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 _0x6177=['fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3b6873,_0x5eef7f){var _0x322c5e=function(_0x187a5b){while(--_0x187a5b){_0x3b6873['push'](_0x3b6873['shift']());}};_0x322c5e(++_0x5eef7f);}(_0x6177,0xf6));var _0x7617=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x6177[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0x7617('0x0'));var util=require(_0x7617('0x1'));var path=require(_0x7617('0x2'));var timeout=require(_0x7617('0x3'));var express=require(_0x7617('0x4'));var router=express[_0x7617('0x5')]();var fs_extra=require(_0x7617('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7617('0x7'));var config=require(_0x7617('0x8'));var controller=require(_0x7617('0x9'));router[_0x7617('0xa')]('/',auth[_0x7617('0xb')](),controller[_0x7617('0xc')]);router['get'](_0x7617('0xd'),auth[_0x7617('0xb')](),controller[_0x7617('0xe')]);router[_0x7617('0xa')](_0x7617('0xf'),auth['isAuthenticated'](),controller[_0x7617('0x10')]);router[_0x7617('0xa')](_0x7617('0x11'),auth['isAuthenticated'](),controller[_0x7617('0x12')]);router[_0x7617('0xa')](_0x7617('0x13'),auth['isAuthenticated'](),controller[_0x7617('0x14')]);router[_0x7617('0x15')]('/',auth[_0x7617('0xb')](),controller[_0x7617('0x16')]);router[_0x7617('0x17')](_0x7617('0xd'),auth[_0x7617('0xb')](),controller[_0x7617('0x18')]);router[_0x7617('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x7617('0x1a')]);module[_0x7617('0x1b')]=router; \ No newline at end of file +var _0x4134=['get','show','preview','isAuthenticated','run','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x4134,0x139));var _0x4413=function(_0x13056b,_0x14fe2b){_0x13056b=_0x13056b-0x0;var _0x38b789=_0x4134[_0x13056b];return _0x38b789;};'use strict';var multer=require(_0x4413('0x0'));var util=require(_0x4413('0x1'));var path=require(_0x4413('0x2'));var timeout=require(_0x4413('0x3'));var express=require(_0x4413('0x4'));var router=express['Router']();var fs_extra=require(_0x4413('0x5'));var auth=require(_0x4413('0x6'));var interaction=require(_0x4413('0x7'));var config=require('../../config/environment');var controller=require(_0x4413('0x8'));router[_0x4413('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4413('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4413('0xa')]);router[_0x4413('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x4413('0xb')]);router[_0x4413('0x9')]('/:id/run',auth[_0x4413('0xc')](),controller[_0x4413('0xd')]);router[_0x4413('0x9')]('/:id/query',auth[_0x4413('0xc')](),controller[_0x4413('0xe')]);router[_0x4413('0xf')]('/',auth[_0x4413('0xc')](),controller[_0x4413('0x10')]);router[_0x4413('0x11')](_0x4413('0x12'),auth[_0x4413('0xc')](),controller[_0x4413('0x13')]);router[_0x4413('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4413('0x15')]);module[_0x4413('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index cc3b698..ea522e1 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 _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0x5075,0x73));var _0x5507=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0x5075[_0x2bf5bd];return _0xc810c0;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x038b=['exports','STRING','TEXT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x038b,0x114));var _0xb038=function(_0x31ffde,_0x212061){_0x31ffde=_0x31ffde-0x0;var _0x4ea5dc=_0x038b[_0x31ffde];return _0x4ea5dc;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 922b5d0..e68b6cb 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x179630,_0x2929e1){var _0x1d5ee0=function(_0x30c6c7){while(--_0x30c6c7){_0x179630['push'](_0x179630['shift']());}};_0x1d5ee0(++_0x2929e1);}(_0x2675,0x75));var _0x5267=function(_0x3fbc8f,_0x22fc47){_0x3fbc8f=_0x3fbc8f-0x0;var _0x2b6e81=_0x2675[_0x3fbc8f];return _0x2b6e81;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x39f11f,_0xa18250){var _0x387198=function(_0x4d0b1f){while(--_0x4d0b1f){_0x39f11f['push'](_0x39f11f['shift']());}};_0x387198(++_0xa18250);}(_0x187d,0x93));var _0xd187=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x187d[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a25ab0a..aedc5a1 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 _0x9ad9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','../../config/logger'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x9ad9,0xbe));var _0x99ad=function(_0x1188a8,_0xc1498d){_0x1188a8=_0x1188a8-0x0;var _0x50c1c1=_0x9ad9[_0x1188a8];return _0x50c1c1;};'use strict';var _=require(_0x99ad('0x0'));var util=require('util');var logger=require(_0x99ad('0x1'))('api');var moment=require(_0x99ad('0x2'));var BPromise=require(_0x99ad('0x3'));var rp=require(_0x99ad('0x4'));var fs=require('fs');var path=require(_0x99ad('0x5'));var rimraf=require(_0x99ad('0x6'));var config=require(_0x99ad('0x7'));var attributes=require(_0x99ad('0x8'));module[_0x99ad('0x9')]=function(_0x538573,_0x2b49ff){return _0x538573[_0x99ad('0xa')](_0x99ad('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b10=['analytics_default_reports','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0xd31621,_0x17b567){var _0x2e7ac0=function(_0x3c5a8d){while(--_0x3c5a8d){_0xd31621['push'](_0xd31621['shift']());}};_0x2e7ac0(++_0x17b567);}(_0x6b10,0x115));var _0x06b1=function(_0x1bac6b,_0x4891cd){_0x1bac6b=_0x1bac6b-0x0;var _0x6a71be=_0x6b10[_0x1bac6b];return _0x6a71be;};'use strict';var _=require(_0x06b1('0x0'));var util=require('util');var logger=require(_0x06b1('0x1'))('api');var moment=require(_0x06b1('0x2'));var BPromise=require(_0x06b1('0x3'));var rp=require(_0x06b1('0x4'));var fs=require('fs');var path=require(_0x06b1('0x5'));var rimraf=require(_0x06b1('0x6'));var config=require(_0x06b1('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x06b1('0x8')]=function(_0x53fbff,_0x1a0334){return _0x53fbff[_0x06b1('0x9')](_0x06b1('0xa'),attributes,{'tableName':_0x06b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index f49f689..a41a2a3 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 _0x11a2=['ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x43be21,_0x1a1140){var _0x535370=function(_0x5a8d39){while(--_0x5a8d39){_0x43be21['push'](_0x43be21['shift']());}};_0x535370(++_0x1a1140);}(_0x11a2,0x1b0));var _0x211a=function(_0x286ce6,_0xba727b){_0x286ce6=_0x286ce6-0x0;var _0x1b53a4=_0x11a2[_0x286ce6];return _0x1b53a4;};'use strict';var _=require(_0x211a('0x0'));var util=require(_0x211a('0x1'));var moment=require(_0x211a('0x2'));var BPromise=require(_0x211a('0x3'));var rs=require(_0x211a('0x4'));var fs=require('fs');var Redis=require(_0x211a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x211a('0x6'))('rpc');var config=require(_0x211a('0x7'));var jayson=require(_0x211a('0x8'));var client=jayson['client'][_0x211a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5963d2,_0x416e15,_0x83d36c){return new BPromise(function(_0x1a2d64,_0x8da155){return client[_0x211a('0xa')](_0x5963d2,_0x83d36c)[_0x211a('0xb')](function(_0xc8697d){logger['info'](_0x211a('0xc'),_0x416e15,_0x211a('0xd'));logger[_0x211a('0xe')](_0x211a('0xf'),_0x416e15,_0x211a('0xd'),JSON[_0x211a('0x10')](_0xc8697d));if(_0xc8697d[_0x211a('0x11')]){if(_0xc8697d[_0x211a('0x11')][_0x211a('0x12')]===0x1f4){logger[_0x211a('0x11')](_0x211a('0xc'),_0x416e15,_0xc8697d[_0x211a('0x11')][_0x211a('0x13')]);return _0x8da155(_0xc8697d[_0x211a('0x11')][_0x211a('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x416e15,_0xc8697d[_0x211a('0x11')]['message']);return _0x1a2d64(_0xc8697d[_0x211a('0x11')][_0x211a('0x13')]);}else{logger[_0x211a('0x14')](_0x211a('0xc'),_0x416e15,_0x211a('0xd'));_0x1a2d64(_0xc8697d[_0x211a('0x15')][_0x211a('0x13')]);}})[_0x211a('0x16')](function(_0x3b2bb0){logger[_0x211a('0x11')](_0x211a('0xc'),_0x416e15,_0x3b2bb0);_0x8da155(_0x3b2bb0);});});} \ No newline at end of file +var _0x3c00=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x3c00,0x1d4));var _0x03c0=function(_0x86782f,_0x436231){_0x86782f=_0x86782f-0x0;var _0x2d50b5=_0x3c00[_0x86782f];return _0x2d50b5;};'use strict';var _=require('lodash');var util=require(_0x03c0('0x0'));var moment=require(_0x03c0('0x1'));var BPromise=require(_0x03c0('0x2'));var rs=require(_0x03c0('0x3'));var fs=require('fs');var Redis=require(_0x03c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03c0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x03c0('0x6'));var jayson=require(_0x03c0('0x7'));var client=jayson[_0x03c0('0x8')][_0x03c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b4827,_0x2bbb03,_0x3dd539){return new BPromise(function(_0x2bdb2e,_0x22730b){return client[_0x03c0('0xa')](_0x1b4827,_0x3dd539)[_0x03c0('0xb')](function(_0x4e5048){logger[_0x03c0('0xc')](_0x03c0('0xd'),_0x2bbb03,'request\x20sent');logger[_0x03c0('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2bbb03,'request\x20sent',JSON['stringify'](_0x4e5048));if(_0x4e5048['error']){if(_0x4e5048[_0x03c0('0xf')][_0x03c0('0x10')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2bbb03,_0x4e5048['error']['message']);return _0x22730b(_0x4e5048[_0x03c0('0xf')][_0x03c0('0x11')]);}logger[_0x03c0('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2bbb03,_0x4e5048[_0x03c0('0xf')][_0x03c0('0x11')]);return _0x2bdb2e(_0x4e5048['error'][_0x03c0('0x11')]);}else{logger[_0x03c0('0xc')](_0x03c0('0xd'),_0x2bbb03,_0x03c0('0x12'));_0x2bdb2e(_0x4e5048['result']['message']);}})['catch'](function(_0x18d3ca){logger[_0x03c0('0xf')](_0x03c0('0xd'),_0x2bbb03,_0x18d3ca);_0x22730b(_0x18d3ca);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 92724ec..516b22f 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 _0x3b1a=['/:id/run','run','query','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview'];(function(_0x3751d3,_0x78104d){var _0xa19b11=function(_0x4da3c6){while(--_0x4da3c6){_0x3751d3['push'](_0x3751d3['shift']());}};_0xa19b11(++_0x78104d);}(_0x3b1a,0x9e));var _0xa3b1=function(_0xf98ec1,_0x4c73b8){_0xf98ec1=_0xf98ec1-0x0;var _0x514b6a=_0x3b1a[_0xf98ec1];return _0x514b6a;};'use strict';var multer=require(_0xa3b1('0x0'));var util=require(_0xa3b1('0x1'));var path=require(_0xa3b1('0x2'));var timeout=require(_0xa3b1('0x3'));var express=require(_0xa3b1('0x4'));var router=express[_0xa3b1('0x5')]();var fs_extra=require(_0xa3b1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa3b1('0x7'));var config=require(_0xa3b1('0x8'));var controller=require(_0xa3b1('0x9'));router['get']('/',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xb')]);router[_0xa3b1('0xc')](_0xa3b1('0xd'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0xe')]);router[_0xa3b1('0xc')](_0xa3b1('0xf'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0x10')]);router[_0xa3b1('0xc')](_0xa3b1('0x11'),auth['isAuthenticated'](),controller[_0xa3b1('0x12')]);router[_0xa3b1('0xc')]('/:id/query',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0x13')]);router['post']('/',auth[_0xa3b1('0xa')](),controller[_0xa3b1('0x14')]);router[_0xa3b1('0x15')](_0xa3b1('0xd'),auth[_0xa3b1('0xa')](),controller[_0xa3b1('0x16')]);router[_0xa3b1('0x17')](_0xa3b1('0xd'),auth['isAuthenticated'](),controller[_0xa3b1('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb344=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','run','query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b6983,_0x53d5f9){var _0x1e2978=function(_0x44f668){while(--_0x44f668){_0x5b6983['push'](_0x5b6983['shift']());}};_0x1e2978(++_0x53d5f9);}(_0xb344,0x152));var _0x4b34=function(_0x59aecc,_0x255014){_0x59aecc=_0x59aecc-0x0;var _0x46b112=_0xb344[_0x59aecc];return _0x46b112;};'use strict';var multer=require(_0x4b34('0x0'));var util=require(_0x4b34('0x1'));var path=require(_0x4b34('0x2'));var timeout=require(_0x4b34('0x3'));var express=require(_0x4b34('0x4'));var router=express[_0x4b34('0x5')]();var fs_extra=require(_0x4b34('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4b34('0x7'));var config=require(_0x4b34('0x8'));var controller=require(_0x4b34('0x9'));router['get']('/',auth[_0x4b34('0xa')](),controller[_0x4b34('0xb')]);router['get'](_0x4b34('0xc'),auth['isAuthenticated'](),controller[_0x4b34('0xd')]);router[_0x4b34('0xe')]('/:id/preview',auth[_0x4b34('0xa')](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x4b34('0xf')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x4b34('0x10')]);router[_0x4b34('0x11')]('/',auth[_0x4b34('0xa')](),controller[_0x4b34('0x12')]);router[_0x4b34('0x13')](_0x4b34('0xc'),auth[_0x4b34('0xa')](),controller[_0x4b34('0x14')]);router[_0x4b34('0x15')](_0x4b34('0xc'),auth[_0x4b34('0xa')](),controller['destroy']);module[_0x4b34('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 12a7c29..c55b90d 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 _0x60d7=['Loading','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x60d7,0x131));var _0x760d=function(_0x5468c2,_0x22dd1e){_0x5468c2=_0x5468c2-0x0;var _0x445aa3=_0x60d7[_0x5468c2];return _0x445aa3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x760d('0x0'));module[_0x760d('0x1')]={'name':{'type':Sequelize[_0x760d('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x760d('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x760d('0x3')](_0x760d('0x4'),_0x760d('0x5'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x760d('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x760d('0x7')},'type':{'type':Sequelize[_0x760d('0x3')](_0x760d('0x8'),_0x760d('0x9')),'allowNull':![],'defaultValue':_0x760d('0x8')},'reportId':{'type':Sequelize[_0x760d('0xa')](0xb)[_0x760d('0xb')]},'reportType':{'type':Sequelize[_0x760d('0x2')]}}; \ No newline at end of file +var _0xbed8=['csv','pdf','xlsx','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','STRING','ENUM'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbed8,0x80));var _0x8bed=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0xbed8[_0x398d85];return _0x33c2bb;};'use strict';var Sequelize=require(_0x8bed('0x0'));var moment=require(_0x8bed('0x1'));module['exports']={'name':{'type':Sequelize[_0x8bed('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8bed('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8bed('0x3')](_0x8bed('0x4'),_0x8bed('0x5'),_0x8bed('0x6')),'allowNull':![],'defaultValue':_0x8bed('0x4')},'savename':{'type':Sequelize[_0x8bed('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8bed('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8bed('0x8')},'type':{'type':Sequelize[_0x8bed('0x3')]('manual',_0x8bed('0x9')),'allowNull':![],'defaultValue':_0x8bed('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x8bed('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index aa28a5b..c14ef58 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 _0xf368=['limit','offset','count','Content-Range','apply','update','destroy','then','get','UserProfileResource','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','role','user','ExtractedReports','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xf368,0x1bd));var _0x8f36=function(_0xe34682,_0x1da5bd){_0xe34682=_0xe34682-0x0;var _0x48490c=_0xf368[_0xe34682];return _0x48490c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f36('0x0'));var zipdir=require(_0x8f36('0x1'));var jsonpatch=require(_0x8f36('0x2'));var rp=require(_0x8f36('0x3'));var moment=require(_0x8f36('0x4'));var BPromise=require(_0x8f36('0x5'));var Mustache=require(_0x8f36('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8f36('0x7'));var csv=require(_0x8f36('0x8'));var ejs=require(_0x8f36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f36('0xa'));var squel=require(_0x8f36('0xb'));var crypto=require(_0x8f36('0xc'));var jsforce=require(_0x8f36('0xd'));var deskjs=require(_0x8f36('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f36('0xf'));var Redis=require(_0x8f36('0x10'));var authService=require(_0x8f36('0x11'));var qs=require(_0x8f36('0x12'));var as=require(_0x8f36('0x13'));var hardwareService=require(_0x8f36('0x14'));var logger=require('../../config/logger')(_0x8f36('0x15'));var utils=require(_0x8f36('0x16'));var config=require(_0x8f36('0x17'));var licenseUtil=require(_0x8f36('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a5c3a,_0x3013de){_0x3013de=_0x3013de||0xcc;return function(_0x4f3de7){if(_0x4f3de7){return _0x2a5c3a[_0x8f36('0x19')](_0x3013de);}return _0x2a5c3a['status'](_0x3013de)[_0x8f36('0x1a')]();};}function respondWithResult(_0x6e24af,_0x1d5e21){_0x1d5e21=_0x1d5e21||0xc8;return function(_0x545bc7){if(_0x545bc7){return _0x6e24af[_0x8f36('0x1b')](_0x1d5e21)[_0x8f36('0x1c')](_0x545bc7);}};}function respondWithFilteredResult(_0x5c6bd5,_0x58fb35){return function(_0xf03ea0){if(_0xf03ea0){var _0x84f1d9=typeof _0x58fb35['offset']===_0x8f36('0x1d')&&typeof _0x58fb35[_0x8f36('0x1e')]===_0x8f36('0x1d');var _0x2b6951=_0xf03ea0['count'];var _0x1bcbcc=_0x84f1d9?0x0:_0x58fb35[_0x8f36('0x1f')];var _0x14fd8e=_0x84f1d9?_0xf03ea0[_0x8f36('0x20')]:_0x58fb35['offset']+_0x58fb35[_0x8f36('0x1e')];var _0x33fd84;if(_0x14fd8e>=_0x2b6951){_0x14fd8e=_0x2b6951;_0x33fd84=0xc8;}else{_0x33fd84=0xce;}_0x5c6bd5[_0x8f36('0x1b')](_0x33fd84);return _0x5c6bd5['set'](_0x8f36('0x21'),_0x1bcbcc+'-'+_0x14fd8e+'/'+_0x2b6951)[_0x8f36('0x1c')](_0xf03ea0);}return null;};}function patchUpdates(_0x185a76){return function(_0x95c50e){try{jsonpatch[_0x8f36('0x22')](_0x95c50e,_0x185a76,!![]);}catch(_0xd71f55){return BPromise['reject'](_0xd71f55);}return _0x95c50e['save']();};}function saveUpdates(_0x3046a3,_0x110009){return function(_0x44d534){if(_0x44d534){return _0x44d534[_0x8f36('0x23')](_0x3046a3)['then'](function(_0x563338){return _0x563338;});}return null;};}function removeEntity(_0x7cd973,_0x3bcb6b){return function(_0x4bd83f){if(_0x4bd83f){return _0x4bd83f[_0x8f36('0x24')]()[_0x8f36('0x25')](function(){var _0x20ad72=_0x4bd83f[_0x8f36('0x26')]({'plain':!![]});var _0x3fa817='ExtractedReports';return db[_0x8f36('0x27')][_0x8f36('0x24')]({'where':{'type':_0x3fa817,'resourceId':_0x20ad72['id']}})[_0x8f36('0x25')](function(){return _0x4bd83f;});})[_0x8f36('0x25')](function(){_0x7cd973[_0x8f36('0x1b')](0xcc)[_0x8f36('0x1a')]();});}};}function handleEntityNotFound(_0x22d21b,_0x175ae0){return function(_0xa09196){if(!_0xa09196){_0x22d21b[_0x8f36('0x19')](0x194);}return _0xa09196;};}function handleError(_0x2d0ff8,_0x3259e9){_0x3259e9=_0x3259e9||0x1f4;return function(_0x166f11){logger['error'](_0x166f11[_0x8f36('0x28')]);if(_0x166f11[_0x8f36('0x29')]){delete _0x166f11[_0x8f36('0x29')];}_0x2d0ff8['status'](_0x3259e9)[_0x8f36('0x2a')](_0x166f11);};}exports['index']=function(_0x27b8d3,_0x17bfcf){var _0x16de3f={},_0x554176={},_0x197079={'count':0x0,'rows':[]};var _0x2f1967=_[_0x8f36('0x2b')](db[_0x8f36('0x2c')]['rawAttributes'],function(_0x54a4b1){return{'name':_0x54a4b1[_0x8f36('0x2d')],'type':_0x54a4b1[_0x8f36('0x2e')][_0x8f36('0x2f')]};});_0x554176[_0x8f36('0x30')]=_['map'](_0x2f1967,'name');_0x554176[_0x8f36('0x31')]=_[_0x8f36('0x32')](_0x27b8d3['query']);_0x554176[_0x8f36('0x33')]=_[_0x8f36('0x34')](_0x554176[_0x8f36('0x30')],_0x554176['query']);_0x16de3f['attributes']=_[_0x8f36('0x34')](_0x554176[_0x8f36('0x30')],qs[_0x8f36('0x35')](_0x27b8d3[_0x8f36('0x31')][_0x8f36('0x35')]));_0x16de3f['attributes']=_0x16de3f[_0x8f36('0x36')][_0x8f36('0x37')]?_0x16de3f[_0x8f36('0x36')]:_0x554176[_0x8f36('0x30')];if(!_0x27b8d3['query'][_0x8f36('0x38')](_0x8f36('0x39'))){_0x16de3f['limit']=qs['limit'](_0x27b8d3[_0x8f36('0x31')][_0x8f36('0x1e')]);_0x16de3f[_0x8f36('0x1f')]=qs[_0x8f36('0x1f')](_0x27b8d3['query'][_0x8f36('0x1f')]);}_0x16de3f['order']=qs[_0x8f36('0x3a')](_0x27b8d3['query']['sort']);_0x16de3f[_0x8f36('0x3b')]=qs[_0x8f36('0x33')](_['pick'](_0x27b8d3[_0x8f36('0x31')],_0x554176[_0x8f36('0x33')]),_0x2f1967);if(_0x27b8d3[_0x8f36('0x31')]['filter']){_0x16de3f[_0x8f36('0x3b')]=_[_0x8f36('0x3c')](_0x16de3f['where'],{'$or':_[_0x8f36('0x2b')](_0x2f1967,function(_0x418143){if(_0x418143['type']!==_0x8f36('0x3d')){var _0x1fe6de={};_0x1fe6de[_0x418143[_0x8f36('0x29')]]={'$like':'%'+_0x27b8d3[_0x8f36('0x31')][_0x8f36('0x3e')]+'%'};return _0x1fe6de;}})});}_0x16de3f=_[_0x8f36('0x3c')]({},_0x16de3f,_0x27b8d3[_0x8f36('0x3f')]);var _0x148590={'where':_0x16de3f[_0x8f36('0x3b')]};return db[_0x8f36('0x2c')][_0x8f36('0x20')](_0x148590)['then'](function(_0x256fd3){_0x197079[_0x8f36('0x20')]=_0x256fd3;if(_0x27b8d3[_0x8f36('0x31')][_0x8f36('0x40')]){_0x16de3f[_0x8f36('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x16de3f);})[_0x8f36('0x25')](function(_0x4cfc95){_0x197079[_0x8f36('0x42')]=_0x4cfc95;return _0x197079;})[_0x8f36('0x25')](respondWithFilteredResult(_0x17bfcf,_0x16de3f))['catch'](handleError(_0x17bfcf,null));};exports[_0x8f36('0x43')]=function(_0x2fc67e,_0xff83bb){var _0x45aece={'raw':!![],'where':{'id':_0x2fc67e[_0x8f36('0x44')]['id']}},_0x137b6c={};_0x137b6c[_0x8f36('0x30')]=_[_0x8f36('0x32')](db[_0x8f36('0x2c')][_0x8f36('0x45')]);_0x137b6c['query']=_[_0x8f36('0x32')](_0x2fc67e['query']);_0x137b6c[_0x8f36('0x33')]=_['intersection'](_0x137b6c[_0x8f36('0x30')],_0x137b6c['query']);_0x45aece[_0x8f36('0x36')]=_[_0x8f36('0x34')](_0x137b6c[_0x8f36('0x30')],qs[_0x8f36('0x35')](_0x2fc67e[_0x8f36('0x31')][_0x8f36('0x35')]));_0x45aece[_0x8f36('0x36')]=_0x45aece[_0x8f36('0x36')]['length']?_0x45aece['attributes']:_0x137b6c[_0x8f36('0x30')];if(_0x2fc67e[_0x8f36('0x31')]['includeAll']){_0x45aece[_0x8f36('0x41')]=[{'all':!![]}];}_0x45aece=_[_0x8f36('0x3c')]({},_0x45aece,_0x2fc67e[_0x8f36('0x3f')]);return db[_0x8f36('0x2c')][_0x8f36('0x46')](_0x45aece)['then'](handleEntityNotFound(_0xff83bb,null))[_0x8f36('0x25')](respondWithResult(_0xff83bb,null))[_0x8f36('0x47')](handleError(_0xff83bb,null));};exports[_0x8f36('0x48')]=function(_0x314d5a,_0x3c06f8){return db[_0x8f36('0x2c')]['create'](_0x314d5a['body'],{})[_0x8f36('0x25')](function(_0x1b6991){var _0x154384=_0x314d5a['user'][_0x8f36('0x26')]({'plain':!![]});if(!_0x154384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154384[_0x8f36('0x49')]===_0x8f36('0x4a')){var _0x4a670b=_0x1b6991[_0x8f36('0x26')]({'plain':!![]});var _0x1a5ead=_0x8f36('0x4b');return db['UserProfileSection'][_0x8f36('0x46')]({'where':{'name':_0x1a5ead,'userProfileId':_0x154384[_0x8f36('0x4c')]},'raw':!![]})['then'](function(_0x4b8ff2){if(_0x4b8ff2&&_0x4b8ff2[_0x8f36('0x4d')]===0x0){return db[_0x8f36('0x27')][_0x8f36('0x48')]({'name':_0x4a670b[_0x8f36('0x29')],'resourceId':_0x4a670b['id'],'type':_0x4b8ff2[_0x8f36('0x29')],'sectionId':_0x4b8ff2['id']},{})[_0x8f36('0x25')](function(){return _0x1b6991;});}else{return _0x1b6991;}})[_0x8f36('0x47')](function(_0x48cf95){logger[_0x8f36('0x4e')](_0x8f36('0x4f'),_0x48cf95);throw _0x48cf95;});}return _0x1b6991;})[_0x8f36('0x25')](respondWithResult(_0x3c06f8,0xc9))[_0x8f36('0x47')](handleError(_0x3c06f8,null));};exports[_0x8f36('0x23')]=function(_0x22851e,_0x3343db){if(_0x22851e[_0x8f36('0x50')]['id']){delete _0x22851e['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x22851e[_0x8f36('0x44')]['id']}})[_0x8f36('0x25')](handleEntityNotFound(_0x3343db,null))['then'](saveUpdates(_0x22851e[_0x8f36('0x50')],null))[_0x8f36('0x25')](respondWithResult(_0x3343db,null))[_0x8f36('0x47')](handleError(_0x3343db,null));};exports[_0x8f36('0x24')]=function(_0x10105a,_0x3f896c){return db[_0x8f36('0x2c')]['find']({'where':{'id':_0x10105a[_0x8f36('0x44')]['id']}})[_0x8f36('0x25')](handleEntityNotFound(_0x3f896c,null))[_0x8f36('0x25')](removeEntity(_0x3f896c,null))[_0x8f36('0x47')](handleError(_0x3f896c,null));};exports[_0x8f36('0x51')]=function(_0x417470,_0x4ab7e6,_0x1b35a6){return db[_0x8f36('0x2c')][_0x8f36('0x46')]({'where':{'id':_0x417470[_0x8f36('0x44')]['id']},'attributes':[_0x8f36('0x29'),_0x8f36('0x52'),'savename',_0x8f36('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x4ab7e6,null))[_0x8f36('0x25')](function(_0xc70224){if(_0xc70224){if(!fs[_0x8f36('0x54')](path[_0x8f36('0x55')](config[_0x8f36('0x56')],_0x8f36('0x57'),_0xc70224[_0x8f36('0x58')]))){throw new db[(_0x8f36('0x59'))][(_0x8f36('0x5a'))](_0x8f36('0x5b'));}if(_0x417470['query'][_0x8f36('0x5c')]){return _0x4ab7e6[_0x8f36('0x19')](0xc8);}return _0x4ab7e6[_0x8f36('0x51')](path[_0x8f36('0x55')](config[_0x8f36('0x56')],_0x8f36('0x57'),_0xc70224[_0x8f36('0x58')]),util['format'](_0x8f36('0x5d'),_0xc70224[_0x8f36('0x52')]||_0xc70224['name'],_0xc70224[_0x8f36('0x53')][_0x8f36('0x5e')]()));}})['catch'](handleError(_0x4ab7e6,null));}; \ No newline at end of file +var _0x57f4=['set','apply','reject','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','AnalyticExtractedReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','download','params','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','root','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit'];(function(_0x8f4ca2,_0xc4ac52){var _0x126663=function(_0x1eebee){while(--_0x1eebee){_0x8f4ca2['push'](_0x8f4ca2['shift']());}};_0x126663(++_0xc4ac52);}(_0x57f4,0x1b6));var _0x457f=function(_0x5b872c,_0x521dc6){_0x5b872c=_0x5b872c-0x0;var _0x4ffc94=_0x57f4[_0x5b872c];return _0x4ffc94;};'use strict';var emlformat=require(_0x457f('0x0'));var rimraf=require(_0x457f('0x1'));var zipdir=require(_0x457f('0x2'));var jsonpatch=require(_0x457f('0x3'));var rp=require(_0x457f('0x4'));var moment=require(_0x457f('0x5'));var BPromise=require(_0x457f('0x6'));var Mustache=require(_0x457f('0x7'));var util=require(_0x457f('0x8'));var path=require('path');var sox=require(_0x457f('0x9'));var csv=require('to-csv');var ejs=require(_0x457f('0xa'));var fs=require('fs');var fs_extra=require(_0x457f('0xb'));var _=require(_0x457f('0xc'));var squel=require('squel');var crypto=require(_0x457f('0xd'));var jsforce=require(_0x457f('0xe'));var deskjs=require(_0x457f('0xf'));var toCsv=require(_0x457f('0x10'));var querystring=require(_0x457f('0x11'));var Papa=require(_0x457f('0x12'));var Redis=require(_0x457f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x457f('0x14'));var logger=require(_0x457f('0x15'))('api');var utils=require(_0x457f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x457f('0x17'))['db'];function respondWithStatusCode(_0x59d093,_0x561e52){_0x561e52=_0x561e52||0xcc;return function(_0x1ffc30){if(_0x1ffc30){return _0x59d093[_0x457f('0x18')](_0x561e52);}return _0x59d093[_0x457f('0x19')](_0x561e52)[_0x457f('0x1a')]();};}function respondWithResult(_0x1acb6a,_0x492708){_0x492708=_0x492708||0xc8;return function(_0x36d745){if(_0x36d745){return _0x1acb6a[_0x457f('0x19')](_0x492708)[_0x457f('0x1b')](_0x36d745);}};}function respondWithFilteredResult(_0x2499a9,_0x5d7d0f){return function(_0x476838){if(_0x476838){var _0x92b8e0=typeof _0x5d7d0f['offset']===_0x457f('0x1c')&&typeof _0x5d7d0f['limit']===_0x457f('0x1c');var _0x12c6bd=_0x476838[_0x457f('0x1d')];var _0x47b349=_0x92b8e0?0x0:_0x5d7d0f[_0x457f('0x1e')];var _0x2abd3f=_0x92b8e0?_0x476838[_0x457f('0x1d')]:_0x5d7d0f[_0x457f('0x1e')]+_0x5d7d0f[_0x457f('0x1f')];var _0xc6b218;if(_0x2abd3f>=_0x12c6bd){_0x2abd3f=_0x12c6bd;_0xc6b218=0xc8;}else{_0xc6b218=0xce;}_0x2499a9[_0x457f('0x19')](_0xc6b218);return _0x2499a9[_0x457f('0x20')]('Content-Range',_0x47b349+'-'+_0x2abd3f+'/'+_0x12c6bd)[_0x457f('0x1b')](_0x476838);}return null;};}function patchUpdates(_0xfc9273){return function(_0x202183){try{jsonpatch[_0x457f('0x21')](_0x202183,_0xfc9273,!![]);}catch(_0x1ac777){return BPromise[_0x457f('0x22')](_0x1ac777);}return _0x202183['save']();};}function saveUpdates(_0x436cdd,_0x2b555c){return function(_0x496cf1){if(_0x496cf1){return _0x496cf1[_0x457f('0x23')](_0x436cdd)[_0x457f('0x24')](function(_0x2319d7){return _0x2319d7;});}return null;};}function removeEntity(_0x471fac,_0xe44762){return function(_0x111aeb){if(_0x111aeb){return _0x111aeb[_0x457f('0x25')]()[_0x457f('0x24')](function(){var _0x18447a=_0x111aeb[_0x457f('0x26')]({'plain':!![]});var _0x1753af=_0x457f('0x27');return db['UserProfileResource'][_0x457f('0x25')]({'where':{'type':_0x1753af,'resourceId':_0x18447a['id']}})['then'](function(){return _0x111aeb;});})[_0x457f('0x24')](function(){_0x471fac[_0x457f('0x19')](0xcc)[_0x457f('0x1a')]();});}};}function handleEntityNotFound(_0x5c951b,_0x4a4364){return function(_0x1e6e81){if(!_0x1e6e81){_0x5c951b['sendStatus'](0x194);}return _0x1e6e81;};}function handleError(_0x2148a5,_0x16b947){_0x16b947=_0x16b947||0x1f4;return function(_0xd330e4){logger[_0x457f('0x28')](_0xd330e4[_0x457f('0x29')]);if(_0xd330e4[_0x457f('0x2a')]){delete _0xd330e4[_0x457f('0x2a')];}_0x2148a5['status'](_0x16b947)[_0x457f('0x2b')](_0xd330e4);};}exports[_0x457f('0x2c')]=function(_0x41bda9,_0x28f3d3){var _0x57f9de={},_0x3def51={},_0xe96095={'count':0x0,'rows':[]};var _0x21a148=_['map'](db[_0x457f('0x2d')]['rawAttributes'],function(_0x3354af){return{'name':_0x3354af['fieldName'],'type':_0x3354af[_0x457f('0x2e')][_0x457f('0x2f')]};});_0x3def51[_0x457f('0x30')]=_['map'](_0x21a148,_0x457f('0x2a'));_0x3def51[_0x457f('0x31')]=_[_0x457f('0x32')](_0x41bda9[_0x457f('0x31')]);_0x3def51[_0x457f('0x33')]=_[_0x457f('0x34')](_0x3def51[_0x457f('0x30')],_0x3def51['query']);_0x57f9de[_0x457f('0x35')]=_[_0x457f('0x34')](_0x3def51[_0x457f('0x30')],qs[_0x457f('0x36')](_0x41bda9[_0x457f('0x31')][_0x457f('0x36')]));_0x57f9de['attributes']=_0x57f9de[_0x457f('0x35')][_0x457f('0x37')]?_0x57f9de[_0x457f('0x35')]:_0x3def51['model'];if(!_0x41bda9[_0x457f('0x31')][_0x457f('0x38')](_0x457f('0x39'))){_0x57f9de['limit']=qs['limit'](_0x41bda9[_0x457f('0x31')][_0x457f('0x1f')]);_0x57f9de[_0x457f('0x1e')]=qs[_0x457f('0x1e')](_0x41bda9[_0x457f('0x31')][_0x457f('0x1e')]);}_0x57f9de[_0x457f('0x3a')]=qs[_0x457f('0x3b')](_0x41bda9[_0x457f('0x31')][_0x457f('0x3b')]);_0x57f9de[_0x457f('0x3c')]=qs[_0x457f('0x33')](_[_0x457f('0x3d')](_0x41bda9[_0x457f('0x31')],_0x3def51[_0x457f('0x33')]),_0x21a148);if(_0x41bda9['query'][_0x457f('0x3e')]){_0x57f9de[_0x457f('0x3c')]=_[_0x457f('0x3f')](_0x57f9de['where'],{'$or':_[_0x457f('0x40')](_0x21a148,function(_0x4c7126){if(_0x4c7126[_0x457f('0x2e')]!==_0x457f('0x41')){var _0x34e466={};_0x34e466[_0x4c7126['name']]={'$like':'%'+_0x41bda9[_0x457f('0x31')][_0x457f('0x3e')]+'%'};return _0x34e466;}})});}_0x57f9de=_[_0x457f('0x3f')]({},_0x57f9de,_0x41bda9[_0x457f('0x42')]);var _0x1fbf17={'where':_0x57f9de[_0x457f('0x3c')]};return db[_0x457f('0x2d')]['count'](_0x1fbf17)['then'](function(_0x27eadb){_0xe96095[_0x457f('0x1d')]=_0x27eadb;if(_0x41bda9['query'][_0x457f('0x43')]){_0x57f9de['include']=[{'all':!![]}];}return db[_0x457f('0x2d')][_0x457f('0x44')](_0x57f9de);})[_0x457f('0x24')](function(_0x320154){_0xe96095['rows']=_0x320154;return _0xe96095;})[_0x457f('0x24')](respondWithFilteredResult(_0x28f3d3,_0x57f9de))[_0x457f('0x45')](handleError(_0x28f3d3,null));};exports[_0x457f('0x46')]=function(_0x1d7d5d,_0x5483d2){var _0x27bb2f={'raw':!![],'where':{'id':_0x1d7d5d['params']['id']}},_0x2d448e={};_0x2d448e[_0x457f('0x30')]=_[_0x457f('0x32')](db['AnalyticExtractedReport']['rawAttributes']);_0x2d448e[_0x457f('0x31')]=_[_0x457f('0x32')](_0x1d7d5d[_0x457f('0x31')]);_0x2d448e['filters']=_[_0x457f('0x34')](_0x2d448e[_0x457f('0x30')],_0x2d448e['query']);_0x27bb2f['attributes']=_['intersection'](_0x2d448e[_0x457f('0x30')],qs[_0x457f('0x36')](_0x1d7d5d[_0x457f('0x31')][_0x457f('0x36')]));_0x27bb2f[_0x457f('0x35')]=_0x27bb2f[_0x457f('0x35')]['length']?_0x27bb2f[_0x457f('0x35')]:_0x2d448e[_0x457f('0x30')];if(_0x1d7d5d['query']['includeAll']){_0x27bb2f[_0x457f('0x47')]=[{'all':!![]}];}_0x27bb2f=_[_0x457f('0x3f')]({},_0x27bb2f,_0x1d7d5d[_0x457f('0x42')]);return db['AnalyticExtractedReport'][_0x457f('0x48')](_0x27bb2f)[_0x457f('0x24')](handleEntityNotFound(_0x5483d2,null))[_0x457f('0x24')](respondWithResult(_0x5483d2,null))[_0x457f('0x45')](handleError(_0x5483d2,null));};exports['create']=function(_0x5ae21c,_0x1174d6){return db[_0x457f('0x2d')][_0x457f('0x49')](_0x5ae21c[_0x457f('0x4a')],{})[_0x457f('0x24')](function(_0x132b40){var _0x3a4fa3=_0x5ae21c[_0x457f('0x4b')]['get']({'plain':!![]});if(!_0x3a4fa3)throw new Error(_0x457f('0x4c'));if(_0x3a4fa3['role']===_0x457f('0x4b')){var _0x4ec2d8=_0x132b40['get']({'plain':!![]});var _0x236464=_0x457f('0x27');return db[_0x457f('0x4d')][_0x457f('0x48')]({'where':{'name':_0x236464,'userProfileId':_0x3a4fa3[_0x457f('0x4e')]},'raw':!![]})[_0x457f('0x24')](function(_0x13ff08){if(_0x13ff08&&_0x13ff08[_0x457f('0x4f')]===0x0){return db[_0x457f('0x50')]['create']({'name':_0x4ec2d8[_0x457f('0x2a')],'resourceId':_0x4ec2d8['id'],'type':_0x13ff08[_0x457f('0x2a')],'sectionId':_0x13ff08['id']},{})['then'](function(){return _0x132b40;});}else{return _0x132b40;}})[_0x457f('0x45')](function(_0x1dea73){logger[_0x457f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dea73);throw _0x1dea73;});}return _0x132b40;})['then'](respondWithResult(_0x1174d6,0xc9))[_0x457f('0x45')](handleError(_0x1174d6,null));};exports[_0x457f('0x23')]=function(_0x4aa58b,_0x160dce){if(_0x4aa58b[_0x457f('0x4a')]['id']){delete _0x4aa58b[_0x457f('0x4a')]['id'];}return db[_0x457f('0x2d')][_0x457f('0x48')]({'where':{'id':_0x4aa58b['params']['id']}})['then'](handleEntityNotFound(_0x160dce,null))[_0x457f('0x24')](saveUpdates(_0x4aa58b[_0x457f('0x4a')],null))[_0x457f('0x24')](respondWithResult(_0x160dce,null))[_0x457f('0x45')](handleError(_0x160dce,null));};exports[_0x457f('0x25')]=function(_0x1044e9,_0x6e2881){return db['AnalyticExtractedReport'][_0x457f('0x48')]({'where':{'id':_0x1044e9['params']['id']}})[_0x457f('0x24')](handleEntityNotFound(_0x6e2881,null))[_0x457f('0x24')](removeEntity(_0x6e2881,null))[_0x457f('0x45')](handleError(_0x6e2881,null));};exports[_0x457f('0x51')]=function(_0x4b673b,_0x5680d5,_0x5173d2){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4b673b[_0x457f('0x52')]['id']},'attributes':[_0x457f('0x2a'),_0x457f('0x53'),_0x457f('0x54'),_0x457f('0x55')],'raw':!![]})[_0x457f('0x24')](handleEntityNotFound(_0x5680d5,null))[_0x457f('0x24')](function(_0x2683f2){if(_0x2683f2){if(!fs[_0x457f('0x56')](path[_0x457f('0x57')](config['root'],_0x457f('0x58'),_0x2683f2['savename']))){throw new db[(_0x457f('0x59'))][(_0x457f('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x4b673b['query']['exists']){return _0x5680d5[_0x457f('0x18')](0xc8);}return _0x5680d5[_0x457f('0x51')](path[_0x457f('0x57')](config[_0x457f('0x5b')],_0x457f('0x58'),_0x2683f2[_0x457f('0x54')]),util[_0x457f('0x5c')](_0x457f('0x5d'),_0x2683f2['basename']||_0x2683f2[_0x457f('0x2a')],_0x2683f2[_0x457f('0x55')]['toLowerCase']()));}})['catch'](handleError(_0x5680d5,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9635658..e4dbdc4 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 _0x3767=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x1cc1fd,_0x33f9f1){var _0x5e3d41=function(_0x356881){while(--_0x356881){_0x1cc1fd['push'](_0x1cc1fd['shift']());}};_0x5e3d41(++_0x33f9f1);}(_0x3767,0xdc));var _0x7376=function(_0x5b3566,_0x204f01){_0x5b3566=_0x5b3566-0x0;var _0xea8eb2=_0x3767[_0x5b3566];return _0xea8eb2;};'use strict';var _=require(_0x7376('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7376('0x1'));var moment=require('moment');var BPromise=require(_0x7376('0x2'));var rp=require(_0x7376('0x3'));var fs=require('fs');var path=require(_0x7376('0x4'));var rimraf=require(_0x7376('0x5'));var config=require(_0x7376('0x6'));var attributes=require(_0x7376('0x7'));module[_0x7376('0x8')]=function(_0x2f89b0,_0x7d9242){return _0x2f89b0[_0x7376('0x9')](_0x7376('0xa'),attributes,{'tableName':_0x7376('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab3a=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xab3a,0xb9));var _0xaab3=function(_0x4452a1,_0x1d50fa){_0x4452a1=_0x4452a1-0x0;var _0x2e5604=_0xab3a[_0x4452a1];return _0x2e5604;};'use strict';var _=require(_0xaab3('0x0'));var util=require('util');var logger=require(_0xaab3('0x1'))(_0xaab3('0x2'));var moment=require(_0xaab3('0x3'));var BPromise=require('bluebird');var rp=require(_0xaab3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaab3('0x5'));var config=require(_0xaab3('0x6'));var attributes=require(_0xaab3('0x7'));module[_0xaab3('0x8')]=function(_0x30a442,_0x315675){return _0x30a442[_0xaab3('0x9')](_0xaab3('0xa'),attributes,{'tableName':_0xaab3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 2ce6109..6bf1bb6 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 _0x8ce1=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0xf2d3c2,_0x4d39ca){var _0x277ca1=function(_0x302918){while(--_0x302918){_0xf2d3c2['push'](_0xf2d3c2['shift']());}};_0x277ca1(++_0x4d39ca);}(_0x8ce1,0xc7));var _0x18ce=function(_0x3711a2,_0x15047d){_0x3711a2=_0x3711a2-0x0;var _0x43d931=_0x8ce1[_0x3711a2];return _0x43d931;};'use strict';var _=require(_0x18ce('0x0'));var util=require('util');var moment=require(_0x18ce('0x1'));var BPromise=require(_0x18ce('0x2'));var rs=require(_0x18ce('0x3'));var fs=require('fs');var Redis=require(_0x18ce('0x4'));var db=require(_0x18ce('0x5'))['db'];var utils=require(_0x18ce('0x6'));var logger=require(_0x18ce('0x7'))(_0x18ce('0x8'));var config=require('../../config/environment');var jayson=require(_0x18ce('0x9'));var client=jayson[_0x18ce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31f7c4,_0x37334e,_0x5843b1){return new BPromise(function(_0x367129,_0x2a5a41){return client[_0x18ce('0xb')](_0x31f7c4,_0x5843b1)['then'](function(_0x437b22){logger[_0x18ce('0xc')](_0x18ce('0xd'),_0x37334e,_0x18ce('0xe'));logger[_0x18ce('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x37334e,_0x18ce('0xe'),JSON[_0x18ce('0x10')](_0x437b22));if(_0x437b22[_0x18ce('0x11')]){if(_0x437b22[_0x18ce('0x11')][_0x18ce('0x12')]===0x1f4){logger[_0x18ce('0x11')](_0x18ce('0xd'),_0x37334e,_0x437b22[_0x18ce('0x11')]['message']);return _0x2a5a41(_0x437b22[_0x18ce('0x11')][_0x18ce('0x13')]);}logger['error'](_0x18ce('0xd'),_0x37334e,_0x437b22[_0x18ce('0x11')]['message']);return _0x367129(_0x437b22[_0x18ce('0x11')][_0x18ce('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x37334e,'request\x20sent');_0x367129(_0x437b22[_0x18ce('0x14')][_0x18ce('0x13')]);}})[_0x18ce('0x15')](function(_0x2f33cc){logger[_0x18ce('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x37334e,_0x2f33cc);_0x2a5a41(_0x2f33cc);});});} \ No newline at end of file +var _0x87ed=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17bb5b,_0x36806f){var _0x3dddc8=function(_0x3084d4){while(--_0x3084d4){_0x17bb5b['push'](_0x17bb5b['shift']());}};_0x3dddc8(++_0x36806f);}(_0x87ed,0x88));var _0xd87e=function(_0x16946b,_0x5ea65a){_0x16946b=_0x16946b-0x0;var _0x322ea3=_0x87ed[_0x16946b];return _0x322ea3;};'use strict';var _=require(_0xd87e('0x0'));var util=require(_0xd87e('0x1'));var moment=require(_0xd87e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd87e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd87e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd87e('0x5'));var jayson=require(_0xd87e('0x6'));var client=jayson['client'][_0xd87e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c43f2,_0x22073e,_0x275705){return new BPromise(function(_0x52d938,_0x55bbf3){return client[_0xd87e('0x8')](_0x4c43f2,_0x275705)['then'](function(_0x436bb6){logger[_0xd87e('0x9')](_0xd87e('0xa'),_0x22073e,_0xd87e('0xb'));logger[_0xd87e('0xc')](_0xd87e('0xd'),_0x22073e,_0xd87e('0xb'),JSON['stringify'](_0x436bb6));if(_0x436bb6[_0xd87e('0xe')]){if(_0x436bb6['error'][_0xd87e('0xf')]===0x1f4){logger[_0xd87e('0xe')](_0xd87e('0xa'),_0x22073e,_0x436bb6['error'][_0xd87e('0x10')]);return _0x55bbf3(_0x436bb6['error'][_0xd87e('0x10')]);}logger['error'](_0xd87e('0xa'),_0x22073e,_0x436bb6[_0xd87e('0xe')][_0xd87e('0x10')]);return _0x52d938(_0x436bb6[_0xd87e('0xe')][_0xd87e('0x10')]);}else{logger['info'](_0xd87e('0xa'),_0x22073e,_0xd87e('0xb'));_0x52d938(_0x436bb6[_0xd87e('0x11')]['message']);}})[_0xd87e('0x12')](function(_0xed36a4){logger[_0xd87e('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x22073e,_0xed36a4);_0x55bbf3(_0xed36a4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ec009f1..067c981 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 _0xed63=['isAuthenticated','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/:id','show','get','download','post'];(function(_0x216e9a,_0x4b4bca){var _0xe0ac8c=function(_0x182483){while(--_0x182483){_0x216e9a['push'](_0x216e9a['shift']());}};_0xe0ac8c(++_0x4b4bca);}(_0xed63,0x124));var _0x3ed6=function(_0x27ff11,_0x2f5554){_0x27ff11=_0x27ff11-0x0;var _0x205817=_0xed63[_0x27ff11];return _0x205817;};'use strict';var multer=require(_0x3ed6('0x0'));var util=require('util');var path=require(_0x3ed6('0x1'));var timeout=require(_0x3ed6('0x2'));var express=require(_0x3ed6('0x3'));var router=express[_0x3ed6('0x4')]();var fs_extra=require(_0x3ed6('0x5'));var auth=require(_0x3ed6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3ed6('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3ed6('0x8')]);router['get'](_0x3ed6('0x9'),auth['isAuthenticated'](),controller[_0x3ed6('0xa')]);router[_0x3ed6('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x3ed6('0xc')]);router[_0x3ed6('0xd')]('/',auth[_0x3ed6('0xe')](),controller['create']);router[_0x3ed6('0xf')](_0x3ed6('0x9'),auth[_0x3ed6('0xe')](),controller[_0x3ed6('0x10')]);router['delete'](_0x3ed6('0x9'),auth[_0x3ed6('0xe')](),controller['destroy']);module[_0x3ed6('0x11')]=router; \ No newline at end of file +var _0xeca1=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller'];(function(_0x28449c,_0x40bdbd){var _0x96cc9e=function(_0x15667b){while(--_0x15667b){_0x28449c['push'](_0x28449c['shift']());}};_0x96cc9e(++_0x40bdbd);}(_0xeca1,0x85));var _0x1eca=function(_0x40724e,_0x23f01c){_0x40724e=_0x40724e-0x0;var _0x42b101=_0xeca1[_0x40724e];return _0x42b101;};'use strict';var multer=require(_0x1eca('0x0'));var util=require(_0x1eca('0x1'));var path=require(_0x1eca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1eca('0x3'));var auth=require(_0x1eca('0x4'));var interaction=require(_0x1eca('0x5'));var config=require('../../config/environment');var controller=require(_0x1eca('0x6'));router[_0x1eca('0x7')]('/',auth[_0x1eca('0x8')](),controller[_0x1eca('0x9')]);router[_0x1eca('0x7')](_0x1eca('0xa'),auth[_0x1eca('0x8')](),controller[_0x1eca('0xb')]);router[_0x1eca('0x7')](_0x1eca('0xc'),auth['isAuthenticated'](),controller[_0x1eca('0xd')]);router[_0x1eca('0xe')]('/',auth[_0x1eca('0x8')](),controller[_0x1eca('0xf')]);router[_0x1eca('0x10')](_0x1eca('0xa'),auth['isAuthenticated'](),controller[_0x1eca('0x11')]);router['delete'](_0x1eca('0xa'),auth['isAuthenticated'](),controller[_0x1eca('0x12')]);module[_0x1eca('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 337732b..afaec42 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 _0x4df4=['BOOLEAN','sequelize','exports','STRING'];(function(_0x302b76,_0x1b4466){var _0x296a6b=function(_0x328098){while(--_0x328098){_0x302b76['push'](_0x302b76['shift']());}};_0x296a6b(++_0x1b4466);}(_0x4df4,0x169));var _0x44df=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x4df4[_0x13187a];return _0x65b85f;};'use strict';var Sequelize=require(_0x44df('0x0'));module[_0x44df('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x44df('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x44df('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x44df('0x2')]},'custom':{'type':Sequelize[_0x44df('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xaf80=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x42004d,_0x127961){var _0xb47cd4=function(_0x5a3b8d){while(--_0x5a3b8d){_0x42004d['push'](_0x42004d['shift']());}};_0xb47cd4(++_0x127961);}(_0xaf80,0x92));var _0x0af8=function(_0x1f12a9,_0x3457fc){_0x1f12a9=_0x1f12a9-0x0;var _0x1e3b99=_0xaf80[_0x1f12a9];return _0x1e3b99;};'use strict';var Sequelize=require(_0x0af8('0x0'));module['exports']={'field':{'type':Sequelize[_0x0af8('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x0af8('0x2')]},'format':{'type':Sequelize[_0x0af8('0x2')]},'groupBy':{'type':Sequelize[_0x0af8('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0af8('0x2')]},'custom':{'type':Sequelize[_0x0af8('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 de77364..f8f2293 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 _0x0df3=['create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','rows','catch','show','params','include','find'];(function(_0x4ee2b7,_0x1d9273){var _0x11a40e=function(_0x58e930){while(--_0x58e930){_0x4ee2b7['push'](_0x4ee2b7['shift']());}};_0x11a40e(++_0x1d9273);}(_0x0df3,0x14b));var _0x30df=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x0df3[_0x15ea09];return _0x3e9c78;};'use strict';var emlformat=require(_0x30df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30df('0x1'));var rp=require(_0x30df('0x2'));var moment=require(_0x30df('0x3'));var BPromise=require(_0x30df('0x4'));var Mustache=require(_0x30df('0x5'));var util=require(_0x30df('0x6'));var path=require('path');var sox=require(_0x30df('0x7'));var csv=require(_0x30df('0x8'));var ejs=require(_0x30df('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30df('0xa'));var squel=require(_0x30df('0xb'));var crypto=require(_0x30df('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x30df('0x8'));var querystring=require(_0x30df('0xd'));var Papa=require(_0x30df('0xe'));var Redis=require('ioredis');var authService=require(_0x30df('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x30df('0x10'));var hardwareService=require(_0x30df('0x11'));var logger=require(_0x30df('0x12'))('api');var utils=require(_0x30df('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x30df('0x14'));var db=require(_0x30df('0x15'))['db'];function respondWithStatusCode(_0x3dfd11,_0x381457){_0x381457=_0x381457||0xcc;return function(_0x25fc48){if(_0x25fc48){return _0x3dfd11[_0x30df('0x16')](_0x381457);}return _0x3dfd11['status'](_0x381457)[_0x30df('0x17')]();};}function respondWithResult(_0x3930e2,_0x4ae6df){_0x4ae6df=_0x4ae6df||0xc8;return function(_0x5840ba){if(_0x5840ba){return _0x3930e2[_0x30df('0x18')](_0x4ae6df)[_0x30df('0x19')](_0x5840ba);}};}function respondWithFilteredResult(_0x118fa5,_0xf6a888){return function(_0xe230d5){if(_0xe230d5){var _0x279bc5=typeof _0xf6a888[_0x30df('0x1a')]==='undefined'&&typeof _0xf6a888[_0x30df('0x1b')]===_0x30df('0x1c');var _0x34b8ab=_0xe230d5['count'];var _0x1ab648=_0x279bc5?0x0:_0xf6a888[_0x30df('0x1a')];var _0x3159a5=_0x279bc5?_0xe230d5[_0x30df('0x1d')]:_0xf6a888[_0x30df('0x1a')]+_0xf6a888[_0x30df('0x1b')];var _0xa2bca6;if(_0x3159a5>=_0x34b8ab){_0x3159a5=_0x34b8ab;_0xa2bca6=0xc8;}else{_0xa2bca6=0xce;}_0x118fa5[_0x30df('0x18')](_0xa2bca6);return _0x118fa5[_0x30df('0x1e')](_0x30df('0x1f'),_0x1ab648+'-'+_0x3159a5+'/'+_0x34b8ab)[_0x30df('0x19')](_0xe230d5);}return null;};}function patchUpdates(_0x304f04){return function(_0x2aaee8){try{jsonpatch[_0x30df('0x20')](_0x2aaee8,_0x304f04,!![]);}catch(_0x28b514){return BPromise[_0x30df('0x21')](_0x28b514);}return _0x2aaee8['save']();};}function saveUpdates(_0x50d01d,_0x3bb072){return function(_0x18459e){if(_0x18459e){return _0x18459e['update'](_0x50d01d)['then'](function(_0x586721){return _0x586721;});}return null;};}function removeEntity(_0x17f0b9,_0xb6b87e){return function(_0x225fd5){if(_0x225fd5){return _0x225fd5[_0x30df('0x22')]()[_0x30df('0x23')](function(){_0x17f0b9[_0x30df('0x18')](0xcc)[_0x30df('0x17')]();});}};}function handleEntityNotFound(_0x6d1f7f,_0x16527e){return function(_0x5dbe90){if(!_0x5dbe90){_0x6d1f7f[_0x30df('0x16')](0x194);}return _0x5dbe90;};}function handleError(_0x515dcf,_0x11ab36){_0x11ab36=_0x11ab36||0x1f4;return function(_0x3a4984){logger['error'](_0x3a4984[_0x30df('0x24')]);if(_0x3a4984['name']){delete _0x3a4984[_0x30df('0x25')];}_0x515dcf['status'](_0x11ab36)['send'](_0x3a4984);};}exports[_0x30df('0x26')]=function(_0x271bd4,_0x3c2b28){var _0x4d7438={},_0x371bc7={},_0x1f6fa6={'count':0x0,'rows':[]};var _0x1cc2c1=_[_0x30df('0x27')](db['AnalyticFieldReport'][_0x30df('0x28')],function(_0x11c909){return{'name':_0x11c909[_0x30df('0x29')],'type':_0x11c909[_0x30df('0x2a')][_0x30df('0x2b')]};});_0x371bc7['model']=_[_0x30df('0x27')](_0x1cc2c1,'name');_0x371bc7['query']=_[_0x30df('0x2c')](_0x271bd4[_0x30df('0x2d')]);_0x371bc7['filters']=_[_0x30df('0x2e')](_0x371bc7[_0x30df('0x2f')],_0x371bc7['query']);_0x4d7438['attributes']=_[_0x30df('0x2e')](_0x371bc7[_0x30df('0x2f')],qs[_0x30df('0x30')](_0x271bd4[_0x30df('0x2d')][_0x30df('0x30')]));_0x4d7438[_0x30df('0x31')]=_0x4d7438[_0x30df('0x31')][_0x30df('0x32')]?_0x4d7438[_0x30df('0x31')]:_0x371bc7['model'];if(!_0x271bd4[_0x30df('0x2d')][_0x30df('0x33')]('nolimit')){_0x4d7438[_0x30df('0x1b')]=qs[_0x30df('0x1b')](_0x271bd4[_0x30df('0x2d')][_0x30df('0x1b')]);_0x4d7438[_0x30df('0x1a')]=qs[_0x30df('0x1a')](_0x271bd4['query'][_0x30df('0x1a')]);}_0x4d7438[_0x30df('0x34')]=qs[_0x30df('0x35')](_0x271bd4['query'][_0x30df('0x35')]);_0x4d7438[_0x30df('0x36')]=qs[_0x30df('0x37')](_[_0x30df('0x38')](_0x271bd4['query'],_0x371bc7[_0x30df('0x37')]),_0x1cc2c1);if(_0x271bd4[_0x30df('0x2d')][_0x30df('0x39')]){_0x4d7438[_0x30df('0x36')]=_['merge'](_0x4d7438[_0x30df('0x36')],{'$or':_[_0x30df('0x27')](_0x1cc2c1,function(_0x11f9ea){if(_0x11f9ea['type']!==_0x30df('0x3a')){var _0x2fbb04={};_0x2fbb04[_0x11f9ea[_0x30df('0x25')]]={'$like':'%'+_0x271bd4['query'][_0x30df('0x39')]+'%'};return _0x2fbb04;}})});}_0x4d7438=_[_0x30df('0x3b')]({},_0x4d7438,_0x271bd4[_0x30df('0x3c')]);var _0x31c924={'where':_0x4d7438['where']};return db[_0x30df('0x3d')]['count'](_0x31c924)[_0x30df('0x23')](function(_0x2c18b0){_0x1f6fa6['count']=_0x2c18b0;if(_0x271bd4[_0x30df('0x2d')][_0x30df('0x3e')]){_0x4d7438['include']=[{'all':!![]}];}return db[_0x30df('0x3d')]['findAll'](_0x4d7438);})[_0x30df('0x23')](function(_0x41c8ab){_0x1f6fa6[_0x30df('0x3f')]=_0x41c8ab;return _0x1f6fa6;})['then'](respondWithFilteredResult(_0x3c2b28,_0x4d7438))[_0x30df('0x40')](handleError(_0x3c2b28,null));};exports[_0x30df('0x41')]=function(_0x2f2f75,_0x2c6280){var _0x3dea55={'raw':![],'where':{'id':_0x2f2f75[_0x30df('0x42')]['id']}},_0x20af54={};_0x20af54[_0x30df('0x2f')]=_[_0x30df('0x2c')](db['AnalyticFieldReport'][_0x30df('0x28')]);_0x20af54['query']=_[_0x30df('0x2c')](_0x2f2f75[_0x30df('0x2d')]);_0x20af54[_0x30df('0x37')]=_[_0x30df('0x2e')](_0x20af54[_0x30df('0x2f')],_0x20af54[_0x30df('0x2d')]);_0x3dea55[_0x30df('0x31')]=_[_0x30df('0x2e')](_0x20af54[_0x30df('0x2f')],qs['fields'](_0x2f2f75['query'][_0x30df('0x30')]));_0x3dea55[_0x30df('0x31')]=_0x3dea55['attributes'][_0x30df('0x32')]?_0x3dea55['attributes']:_0x20af54[_0x30df('0x2f')];if(_0x2f2f75['query'][_0x30df('0x3e')]){_0x3dea55[_0x30df('0x43')]=[{'all':!![]}];}_0x3dea55=_['merge']({},_0x3dea55,_0x2f2f75[_0x30df('0x3c')]);return db[_0x30df('0x3d')][_0x30df('0x44')](_0x3dea55)[_0x30df('0x23')](handleEntityNotFound(_0x2c6280,null))[_0x30df('0x23')](respondWithResult(_0x2c6280,null))[_0x30df('0x40')](handleError(_0x2c6280,null));};exports[_0x30df('0x45')]=function(_0x3904aa,_0x3a4f28){return db[_0x30df('0x3d')]['create'](_0x3904aa[_0x30df('0x46')],{})['then'](respondWithResult(_0x3a4f28,0xc9))[_0x30df('0x40')](handleError(_0x3a4f28,null));};exports[_0x30df('0x47')]=function(_0x26fb74,_0x52f66f){return db[_0x30df('0x3d')][_0x30df('0x47')](_0x26fb74[_0x30df('0x46')],{'raw':![],'individualHooks':!![]})[_0x30df('0x23')](respondWithResult(_0x52f66f,0xc9))['catch'](handleError(_0x52f66f,null));};exports['update']=function(_0x51c9d5,_0x53bde5){if(_0x51c9d5[_0x30df('0x46')]['id']){delete _0x51c9d5['body']['id'];}return db[_0x30df('0x3d')][_0x30df('0x44')]({'where':{'id':_0x51c9d5[_0x30df('0x42')]['id']}})['then'](handleEntityNotFound(_0x53bde5,null))[_0x30df('0x23')](saveUpdates(_0x51c9d5['body'],null))[_0x30df('0x23')](respondWithResult(_0x53bde5,null))[_0x30df('0x40')](handleError(_0x53bde5,null));};exports[_0x30df('0x22')]=function(_0x2bdf5b,_0x4439ef){return db[_0x30df('0x3d')]['find']({'where':{'id':_0x2bdf5b[_0x30df('0x42')]['id']}})[_0x30df('0x23')](handleEntityNotFound(_0x4439ef,null))[_0x30df('0x23')](removeEntity(_0x4439ef,null))[_0x30df('0x40')](handleError(_0x4439ef,null));};exports[_0x30df('0x48')]=function(_0x384b52,_0x57505d){return db[_0x30df('0x3d')][_0x30df('0x22')]({'where':{'id':_0x384b52[_0x30df('0x2d')][_0x30df('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x30df('0x23')](respondWithResult(_0x57505d,0xcc))[_0x30df('0x40')](handleError(_0x57505d,null));};exports[_0x30df('0x4a')]=function(_0x4bfe12,_0x46e2e9,_0xd0ed84){return db[_0x30df('0x4b')][_0x30df('0x4c')]({'where':{'id':_0x4bfe12['params']['id']}})[_0x30df('0x23')](handleEntityNotFound(_0x46e2e9,null))[_0x30df('0x23')](function(_0x5d678e){if(_0x5d678e){return db[_0x30df('0x4d')][_0x30df('0x4e')](function(_0x21e508){return db[_0x30df('0x3d')]['destroy']({'where':{'CustomReportId':_0x4bfe12[_0x30df('0x42')]['id']},'transaction':_0x21e508})[_0x30df('0x23')](function(_0x351292){var _0x4ea476=_[_0x30df('0x27')](_0x4bfe12[_0x30df('0x46')],function(_0x959fa8){delete _0x959fa8['id'];_0x959fa8[_0x30df('0x4f')]=_0x4bfe12[_0x30df('0x42')]['id'];return _0x959fa8;});return db['AnalyticFieldReport'][_0x30df('0x47')](_0x4ea476,{'transaction':_0x21e508});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x4bfe12['params']['id']}});});}})[_0x30df('0x23')](respondWithResult(_0x46e2e9,null))[_0x30df('0x40')](handleError(_0x46e2e9,null));}; \ No newline at end of file +var _0xebd5=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','bulkCreate','body','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','save','then','destroy','error','name','send','index','map','AnalyticFieldReport'];(function(_0x1d4934,_0x273e2b){var _0x3603f7=function(_0x41f762){while(--_0x41f762){_0x1d4934['push'](_0x1d4934['shift']());}};_0x3603f7(++_0x273e2b);}(_0xebd5,0x71));var _0x5ebd=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xebd5[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x5ebd('0x0'));var rimraf=require(_0x5ebd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ebd('0x2'));var moment=require(_0x5ebd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ebd('0x4'));var path=require(_0x5ebd('0x5'));var sox=require(_0x5ebd('0x6'));var csv=require('to-csv');var ejs=require(_0x5ebd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ebd('0x8'));var squel=require('squel');var crypto=require(_0x5ebd('0x9'));var jsforce=require(_0x5ebd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ebd('0xb'));var Papa=require(_0x5ebd('0xc'));var Redis=require(_0x5ebd('0xd'));var authService=require(_0x5ebd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5ebd('0xf'));var hardwareService=require(_0x5ebd('0x10'));var logger=require('../../config/logger')(_0x5ebd('0x11'));var utils=require(_0x5ebd('0x12'));var config=require(_0x5ebd('0x13'));var licenseUtil=require(_0x5ebd('0x14'));var db=require(_0x5ebd('0x15'))['db'];function respondWithStatusCode(_0x315f39,_0x30c24f){_0x30c24f=_0x30c24f||0xcc;return function(_0x5c9925){if(_0x5c9925){return _0x315f39[_0x5ebd('0x16')](_0x30c24f);}return _0x315f39['status'](_0x30c24f)[_0x5ebd('0x17')]();};}function respondWithResult(_0x3d6b1a,_0x3481db){_0x3481db=_0x3481db||0xc8;return function(_0x4ce10a){if(_0x4ce10a){return _0x3d6b1a['status'](_0x3481db)[_0x5ebd('0x18')](_0x4ce10a);}};}function respondWithFilteredResult(_0x12c306,_0x3f9ab3){return function(_0x981d23){if(_0x981d23){var _0x47a85c=typeof _0x3f9ab3[_0x5ebd('0x19')]===_0x5ebd('0x1a')&&typeof _0x3f9ab3['limit']===_0x5ebd('0x1a');var _0x155e88=_0x981d23[_0x5ebd('0x1b')];var _0x18217f=_0x47a85c?0x0:_0x3f9ab3[_0x5ebd('0x19')];var _0x28308d=_0x47a85c?_0x981d23[_0x5ebd('0x1b')]:_0x3f9ab3[_0x5ebd('0x19')]+_0x3f9ab3[_0x5ebd('0x1c')];var _0x2a06e8;if(_0x28308d>=_0x155e88){_0x28308d=_0x155e88;_0x2a06e8=0xc8;}else{_0x2a06e8=0xce;}_0x12c306[_0x5ebd('0x1d')](_0x2a06e8);return _0x12c306[_0x5ebd('0x1e')](_0x5ebd('0x1f'),_0x18217f+'-'+_0x28308d+'/'+_0x155e88)[_0x5ebd('0x18')](_0x981d23);}return null;};}function patchUpdates(_0x30547b){return function(_0xdac639){try{jsonpatch['apply'](_0xdac639,_0x30547b,!![]);}catch(_0x55be72){return BPromise['reject'](_0x55be72);}return _0xdac639[_0x5ebd('0x20')]();};}function saveUpdates(_0x43e542,_0x39eff1){return function(_0x151ffa){if(_0x151ffa){return _0x151ffa['update'](_0x43e542)[_0x5ebd('0x21')](function(_0x338f97){return _0x338f97;});}return null;};}function removeEntity(_0x4ddcc2,_0x160509){return function(_0x6e869b){if(_0x6e869b){return _0x6e869b[_0x5ebd('0x22')]()[_0x5ebd('0x21')](function(){_0x4ddcc2[_0x5ebd('0x1d')](0xcc)[_0x5ebd('0x17')]();});}};}function handleEntityNotFound(_0x59cc2e,_0x547f35){return function(_0x35f1c4){if(!_0x35f1c4){_0x59cc2e[_0x5ebd('0x16')](0x194);}return _0x35f1c4;};}function handleError(_0x3ebc2c,_0x4614f1){_0x4614f1=_0x4614f1||0x1f4;return function(_0x25e6f9){logger[_0x5ebd('0x23')](_0x25e6f9['stack']);if(_0x25e6f9[_0x5ebd('0x24')]){delete _0x25e6f9[_0x5ebd('0x24')];}_0x3ebc2c['status'](_0x4614f1)[_0x5ebd('0x25')](_0x25e6f9);};}exports[_0x5ebd('0x26')]=function(_0x4fd9bd,_0x3e8e28){var _0x7128e9={},_0x2ed99b={},_0x11c38a={'count':0x0,'rows':[]};var _0x1128b5=_[_0x5ebd('0x27')](db[_0x5ebd('0x28')]['rawAttributes'],function(_0x5665a9){return{'name':_0x5665a9[_0x5ebd('0x29')],'type':_0x5665a9[_0x5ebd('0x2a')]['key']};});_0x2ed99b[_0x5ebd('0x2b')]=_['map'](_0x1128b5,_0x5ebd('0x24'));_0x2ed99b[_0x5ebd('0x2c')]=_[_0x5ebd('0x2d')](_0x4fd9bd['query']);_0x2ed99b[_0x5ebd('0x2e')]=_[_0x5ebd('0x2f')](_0x2ed99b['model'],_0x2ed99b[_0x5ebd('0x2c')]);_0x7128e9[_0x5ebd('0x30')]=_[_0x5ebd('0x2f')](_0x2ed99b[_0x5ebd('0x2b')],qs[_0x5ebd('0x31')](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x31')]));_0x7128e9[_0x5ebd('0x30')]=_0x7128e9[_0x5ebd('0x30')]['length']?_0x7128e9[_0x5ebd('0x30')]:_0x2ed99b[_0x5ebd('0x2b')];if(!_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x32')](_0x5ebd('0x33'))){_0x7128e9['limit']=qs['limit'](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x1c')]);_0x7128e9['offset']=qs[_0x5ebd('0x19')](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x19')]);}_0x7128e9[_0x5ebd('0x34')]=qs['sort'](_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x35')]);_0x7128e9[_0x5ebd('0x36')]=qs['filters'](_[_0x5ebd('0x37')](_0x4fd9bd['query'],_0x2ed99b[_0x5ebd('0x2e')]),_0x1128b5);if(_0x4fd9bd[_0x5ebd('0x2c')][_0x5ebd('0x38')]){_0x7128e9[_0x5ebd('0x36')]=_[_0x5ebd('0x39')](_0x7128e9['where'],{'$or':_[_0x5ebd('0x27')](_0x1128b5,function(_0x380310){if(_0x380310[_0x5ebd('0x2a')]!==_0x5ebd('0x3a')){var _0x247f04={};_0x247f04[_0x380310['name']]={'$like':'%'+_0x4fd9bd['query'][_0x5ebd('0x38')]+'%'};return _0x247f04;}})});}_0x7128e9=_[_0x5ebd('0x39')]({},_0x7128e9,_0x4fd9bd[_0x5ebd('0x3b')]);var _0x5970a0={'where':_0x7128e9[_0x5ebd('0x36')]};return db[_0x5ebd('0x28')][_0x5ebd('0x1b')](_0x5970a0)[_0x5ebd('0x21')](function(_0x45fe2f){_0x11c38a[_0x5ebd('0x1b')]=_0x45fe2f;if(_0x4fd9bd['query'][_0x5ebd('0x3c')]){_0x7128e9[_0x5ebd('0x3d')]=[{'all':!![]}];}return db[_0x5ebd('0x28')]['findAll'](_0x7128e9);})[_0x5ebd('0x21')](function(_0x108cf8){_0x11c38a[_0x5ebd('0x3e')]=_0x108cf8;return _0x11c38a;})[_0x5ebd('0x21')](respondWithFilteredResult(_0x3e8e28,_0x7128e9))[_0x5ebd('0x3f')](handleError(_0x3e8e28,null));};exports[_0x5ebd('0x40')]=function(_0x20be2d,_0x25d7c7){var _0x58f29b={'raw':![],'where':{'id':_0x20be2d[_0x5ebd('0x41')]['id']}},_0x130c42={};_0x130c42[_0x5ebd('0x2b')]=_[_0x5ebd('0x2d')](db['AnalyticFieldReport'][_0x5ebd('0x42')]);_0x130c42['query']=_['keys'](_0x20be2d[_0x5ebd('0x2c')]);_0x130c42[_0x5ebd('0x2e')]=_[_0x5ebd('0x2f')](_0x130c42[_0x5ebd('0x2b')],_0x130c42['query']);_0x58f29b[_0x5ebd('0x30')]=_[_0x5ebd('0x2f')](_0x130c42[_0x5ebd('0x2b')],qs[_0x5ebd('0x31')](_0x20be2d['query'][_0x5ebd('0x31')]));_0x58f29b['attributes']=_0x58f29b['attributes']['length']?_0x58f29b['attributes']:_0x130c42['model'];if(_0x20be2d['query'][_0x5ebd('0x3c')]){_0x58f29b[_0x5ebd('0x3d')]=[{'all':!![]}];}_0x58f29b=_[_0x5ebd('0x39')]({},_0x58f29b,_0x20be2d['options']);return db[_0x5ebd('0x28')][_0x5ebd('0x43')](_0x58f29b)['then'](handleEntityNotFound(_0x25d7c7,null))['then'](respondWithResult(_0x25d7c7,null))[_0x5ebd('0x3f')](handleError(_0x25d7c7,null));};exports[_0x5ebd('0x44')]=function(_0x1cd137,_0x33f94d){return db[_0x5ebd('0x28')][_0x5ebd('0x44')](_0x1cd137['body'],{})[_0x5ebd('0x21')](respondWithResult(_0x33f94d,0xc9))['catch'](handleError(_0x33f94d,null));};exports['bulkCreate']=function(_0x758bfa,_0x2bf8f5){return db[_0x5ebd('0x28')][_0x5ebd('0x45')](_0x758bfa[_0x5ebd('0x46')],{'raw':![],'individualHooks':!![]})[_0x5ebd('0x21')](respondWithResult(_0x2bf8f5,0xc9))[_0x5ebd('0x3f')](handleError(_0x2bf8f5,null));};exports['update']=function(_0xaad01,_0x288a92){if(_0xaad01[_0x5ebd('0x46')]['id']){delete _0xaad01[_0x5ebd('0x46')]['id'];}return db[_0x5ebd('0x28')][_0x5ebd('0x43')]({'where':{'id':_0xaad01['params']['id']}})[_0x5ebd('0x21')](handleEntityNotFound(_0x288a92,null))[_0x5ebd('0x21')](saveUpdates(_0xaad01[_0x5ebd('0x46')],null))['then'](respondWithResult(_0x288a92,null))['catch'](handleError(_0x288a92,null));};exports[_0x5ebd('0x22')]=function(_0x42c793,_0x1b96c0){return db['AnalyticFieldReport'][_0x5ebd('0x43')]({'where':{'id':_0x42c793[_0x5ebd('0x41')]['id']}})[_0x5ebd('0x21')](handleEntityNotFound(_0x1b96c0,null))[_0x5ebd('0x21')](removeEntity(_0x1b96c0,null))[_0x5ebd('0x3f')](handleError(_0x1b96c0,null));};exports['bulkDestroy']=function(_0x3812a3,_0x20b6b7){return db[_0x5ebd('0x28')][_0x5ebd('0x22')]({'where':{'id':_0x3812a3[_0x5ebd('0x2c')][_0x5ebd('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x5ebd('0x21')](respondWithResult(_0x20b6b7,0xcc))['catch'](handleError(_0x20b6b7,null));};exports[_0x5ebd('0x48')]=function(_0x3edf69,_0x52223a,_0xe92951){return db[_0x5ebd('0x49')]['findOne']({'where':{'id':_0x3edf69['params']['id']}})[_0x5ebd('0x21')](handleEntityNotFound(_0x52223a,null))['then'](function(_0x456a99){if(_0x456a99){return db[_0x5ebd('0x4a')][_0x5ebd('0x4b')](function(_0x2d3bac){return db[_0x5ebd('0x28')]['destroy']({'where':{'CustomReportId':_0x3edf69[_0x5ebd('0x41')]['id']},'transaction':_0x2d3bac})['then'](function(_0x43c1a3){var _0x2c3f2f=_[_0x5ebd('0x27')](_0x3edf69[_0x5ebd('0x46')],function(_0x125e32){delete _0x125e32['id'];_0x125e32[_0x5ebd('0x4c')]=_0x3edf69[_0x5ebd('0x41')]['id'];return _0x125e32;});return db[_0x5ebd('0x28')][_0x5ebd('0x45')](_0x2c3f2f,{'transaction':_0x2d3bac});});})['then'](function(){return db[_0x5ebd('0x28')]['findAll']({'where':{'CustomReportId':_0x3edf69['params']['id']}});});}})[_0x5ebd('0x21')](respondWithResult(_0x52223a,null))[_0x5ebd('0x3f')](handleError(_0x52223a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index cae9df2..ede983f 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 _0x2066=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x561f8b,_0x403380){var _0x56b1e3=function(_0x1341c1){while(--_0x1341c1){_0x561f8b['push'](_0x561f8b['shift']());}};_0x56b1e3(++_0x403380);}(_0x2066,0xda));var _0x6206=function(_0x3d1463,_0xe10dab){_0x3d1463=_0x3d1463-0x0;var _0x2d2616=_0x2066[_0x3d1463];return _0x2d2616;};'use strict';var _=require(_0x6206('0x0'));var util=require('util');var logger=require(_0x6206('0x1'))(_0x6206('0x2'));var moment=require(_0x6206('0x3'));var BPromise=require(_0x6206('0x4'));var rp=require(_0x6206('0x5'));var fs=require('fs');var path=require(_0x6206('0x6'));var rimraf=require(_0x6206('0x7'));var config=require(_0x6206('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x6206('0x9')]=function(_0x41bd4e,_0x505a30){return _0x41bd4e['define'](_0x6206('0xa'),attributes,{'tableName':_0x6206('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20c3=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c179f,_0x4b6186){var _0x500640=function(_0x1e486b){while(--_0x1e486b){_0x4c179f['push'](_0x4c179f['shift']());}};_0x500640(++_0x4b6186);}(_0x20c3,0x70));var _0x320c=function(_0x220253,_0x408ef7){_0x220253=_0x220253-0x0;var _0x1ce4a0=_0x20c3[_0x220253];return _0x1ce4a0;};'use strict';var _=require(_0x320c('0x0'));var util=require(_0x320c('0x1'));var logger=require(_0x320c('0x2'))(_0x320c('0x3'));var moment=require(_0x320c('0x4'));var BPromise=require(_0x320c('0x5'));var rp=require(_0x320c('0x6'));var fs=require('fs');var path=require(_0x320c('0x7'));var rimraf=require(_0x320c('0x8'));var config=require(_0x320c('0x9'));var attributes=require(_0x320c('0xa'));module[_0x320c('0xb')]=function(_0x19832e,_0x525ebd){return _0x19832e[_0x320c('0xc')](_0x320c('0xd'),attributes,{'tableName':_0x320c('0xe'),'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 79c6529..c7cc69a 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 _0x1552=['stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x125a62,_0x34e156){var _0x497b28=function(_0x504bbf){while(--_0x504bbf){_0x125a62['push'](_0x125a62['shift']());}};_0x497b28(++_0x34e156);}(_0x1552,0x97));var _0x2155=function(_0x284d8f,_0x1afc9e){_0x284d8f=_0x284d8f-0x0;var _0x6acf64=_0x1552[_0x284d8f];return _0x6acf64;};'use strict';var _=require(_0x2155('0x0'));var util=require(_0x2155('0x1'));var moment=require(_0x2155('0x2'));var BPromise=require('bluebird');var rs=require(_0x2155('0x3'));var fs=require('fs');var Redis=require(_0x2155('0x4'));var db=require(_0x2155('0x5'))['db'];var utils=require(_0x2155('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2155('0x7'));var jayson=require(_0x2155('0x8'));var client=jayson[_0x2155('0x9')][_0x2155('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2873a1,_0x2c2a75,_0x2deacf){return new BPromise(function(_0x81ecff,_0x5c25e1){return client['request'](_0x2873a1,_0x2deacf)[_0x2155('0xb')](function(_0x29e119){logger[_0x2155('0xc')](_0x2155('0xd'),_0x2c2a75,_0x2155('0xe'));logger[_0x2155('0xf')](_0x2155('0x10'),_0x2c2a75,_0x2155('0xe'),JSON[_0x2155('0x11')](_0x29e119));if(_0x29e119[_0x2155('0x12')]){if(_0x29e119[_0x2155('0x12')]['code']===0x1f4){logger[_0x2155('0x12')](_0x2155('0xd'),_0x2c2a75,_0x29e119[_0x2155('0x12')][_0x2155('0x13')]);return _0x5c25e1(_0x29e119[_0x2155('0x12')]['message']);}logger[_0x2155('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2c2a75,_0x29e119['error']['message']);return _0x81ecff(_0x29e119['error'][_0x2155('0x13')]);}else{logger[_0x2155('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2c2a75,_0x2155('0xe'));_0x81ecff(_0x29e119[_0x2155('0x14')]['message']);}})['catch'](function(_0xfdd0f8){logger[_0x2155('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2c2a75,_0xfdd0f8);_0x5c25e1(_0xfdd0f8);});});} \ No newline at end of file +var _0xabcc=['request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x7e6cf7,_0x4c8e23){var _0x18d4ee=function(_0x14b2fc){while(--_0x14b2fc){_0x7e6cf7['push'](_0x7e6cf7['shift']());}};_0x18d4ee(++_0x4c8e23);}(_0xabcc,0x7b));var _0xcabc=function(_0x1f2941,_0x3544ce){_0x1f2941=_0x1f2941-0x0;var _0x31e313=_0xabcc[_0x1f2941];return _0x31e313;};'use strict';var _=require('lodash');var util=require(_0xcabc('0x0'));var moment=require(_0xcabc('0x1'));var BPromise=require(_0xcabc('0x2'));var rs=require(_0xcabc('0x3'));var fs=require('fs');var Redis=require(_0xcabc('0x4'));var db=require(_0xcabc('0x5'))['db'];var utils=require(_0xcabc('0x6'));var logger=require(_0xcabc('0x7'))(_0xcabc('0x8'));var config=require(_0xcabc('0x9'));var jayson=require(_0xcabc('0xa'));var client=jayson[_0xcabc('0xb')][_0xcabc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5df19b,_0x6f7393,_0x596ef9){return new BPromise(function(_0x234d01,_0x23fb36){return client[_0xcabc('0xd')](_0x5df19b,_0x596ef9)['then'](function(_0xe97cd2){logger['info'](_0xcabc('0xe'),_0x6f7393,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x6f7393,_0xcabc('0xf'),JSON[_0xcabc('0x10')](_0xe97cd2));if(_0xe97cd2[_0xcabc('0x11')]){if(_0xe97cd2[_0xcabc('0x11')][_0xcabc('0x12')]===0x1f4){logger[_0xcabc('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x6f7393,_0xe97cd2[_0xcabc('0x11')]['message']);return _0x23fb36(_0xe97cd2[_0xcabc('0x11')][_0xcabc('0x13')]);}logger[_0xcabc('0x11')](_0xcabc('0xe'),_0x6f7393,_0xe97cd2[_0xcabc('0x11')]['message']);return _0x234d01(_0xe97cd2[_0xcabc('0x11')][_0xcabc('0x13')]);}else{logger[_0xcabc('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x6f7393,_0xcabc('0xf'));_0x234d01(_0xe97cd2[_0xcabc('0x15')]['message']);}})[_0xcabc('0x16')](function(_0x4d9738){logger[_0xcabc('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x6f7393,_0x4d9738);_0x23fb36(_0x4d9738);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f7c5283..367c0e2 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(_0x581f95,_0x341948){var _0x1c57f9=function(_0x1f943b){while(--_0x1f943b){_0x581f95['push'](_0x581f95['shift']());}};_0x1c57f9(++_0x341948);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x13bbf5,_0x3c3cc2){var _0x2d9e20=function(_0x31ff82){while(--_0x31ff82){_0x13bbf5['push'](_0x13bbf5['shift']());}};_0x2d9e20(++_0x3c3cc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 b5ee246..cecb3d4 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 _0x9e9b=['name','STRING','TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x9e9b[_0x28d225];return _0x1f79e1;};'use strict';var Sequelize=require(_0xb9e9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb9e9('0x1')},'table':{'type':Sequelize[_0xb9e9('0x2')]},'metric':{'type':Sequelize[_0xb9e9('0x3')]},'description':{'type':Sequelize[_0xb9e9('0x2')]}}; \ No newline at end of file +var _0xbee0=['STRING','name','TEXT','exports'];(function(_0x204774,_0x572ffc){var _0x9f6e47=function(_0x590321){while(--_0x590321){_0x204774['push'](_0x204774['shift']());}};_0x9f6e47(++_0x572ffc);}(_0xbee0,0x147));var _0x0bee=function(_0x3fa4ec,_0x3387d3){_0x3fa4ec=_0x3fa4ec-0x0;var _0x4df5f0=_0xbee0[_0x3fa4ec];return _0x4df5f0;};'use strict';var Sequelize=require('sequelize');module[_0x0bee('0x0')]={'name':{'type':Sequelize[_0x0bee('0x1')],'allowNull':![],'unique':_0x0bee('0x2')},'table':{'type':Sequelize[_0x0bee('0x1')]},'metric':{'type':Sequelize[_0x0bee('0x3')]},'description':{'type':Sequelize[_0x0bee('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e21dbca..7e9f8e0 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 _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x5c2e2a,_0x468cb1){var _0x172203=function(_0x29e8e8){while(--_0x29e8e8){_0x5c2e2a['push'](_0x5c2e2a['shift']());}};_0x172203(++_0x468cb1);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x28c03c,_0x299fd3){_0x28c03c=_0x28c03c-0x0;var _0x1f5454=_0xd6d6[_0x28c03c];return _0x1f5454;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc187f4,_0x406145){var _0x1dc539=function(_0x48fc22){while(--_0x48fc22){_0xc187f4['push'](_0xc187f4['shift']());}};_0x1dc539(++_0x406145);}(_0x8ef6,0xf2));var _0x68ef=function(_0x57f20c,_0x33aa60){_0x57f20c=_0x57f20c-0x0;var _0x3e36e9=_0x8ef6[_0x57f20c];return _0x3e36e9;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4e71227..2d2f477 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 _0xbea5=['moment','bluebird','request-promise','path','./analyticMetric.attributes','AnalyticMetric','lodash','util','api'];(function(_0x50b1f0,_0x39b616){var _0x347b7c=function(_0x15e3de){while(--_0x15e3de){_0x50b1f0['push'](_0x50b1f0['shift']());}};_0x347b7c(++_0x39b616);}(_0xbea5,0x177));var _0x5bea=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0xbea5[_0x3ee1fe];return _0x1ae57a;};'use strict';var _=require(_0x5bea('0x0'));var util=require(_0x5bea('0x1'));var logger=require('../../config/logger')(_0x5bea('0x2'));var moment=require(_0x5bea('0x3'));var BPromise=require(_0x5bea('0x4'));var rp=require(_0x5bea('0x5'));var fs=require('fs');var path=require(_0x5bea('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5bea('0x7'));module['exports']=function(_0x156737,_0x51ac31){return _0x156737['define'](_0x5bea('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['moment','request-promise','../../config/environment','./analyticMetric.attributes','define','analytics_metrics','util','../../config/logger','api'];(function(_0x2d0057,_0x24db80){var _0x2881ca=function(_0x42c8a4){while(--_0x42c8a4){_0x2d0057['push'](_0x2d0057['shift']());}};_0x2881ca(++_0x24db80);}(_0xb091,0x16e));var _0x1b09=function(_0x486876,_0x76fa8a){_0x486876=_0x486876-0x0;var _0x1dc1c2=_0xb091[_0x486876];return _0x1dc1c2;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('AnalyticMetric',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 35d2d70..4007d93 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 _0xddc2=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x445e32,_0x178189){var _0xa4bef0=function(_0x8c8565){while(--_0x8c8565){_0x445e32['push'](_0x445e32['shift']());}};_0xa4bef0(++_0x178189);}(_0xddc2,0x17b));var _0x2ddc=function(_0x431e18,_0x35c3a0){_0x431e18=_0x431e18-0x0;var _0x466f84=_0xddc2[_0x431e18];return _0x466f84;};'use strict';var _=require('lodash');var util=require(_0x2ddc('0x0'));var moment=require(_0x2ddc('0x1'));var BPromise=require(_0x2ddc('0x2'));var rs=require(_0x2ddc('0x3'));var fs=require('fs');var Redis=require(_0x2ddc('0x4'));var db=require(_0x2ddc('0x5'))['db'];var utils=require(_0x2ddc('0x6'));var logger=require(_0x2ddc('0x7'))(_0x2ddc('0x8'));var config=require(_0x2ddc('0x9'));var jayson=require(_0x2ddc('0xa'));var client=jayson['client'][_0x2ddc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa07d3a,_0x5e61b5,_0x4dc4ba){return new BPromise(function(_0x240b7c,_0xc8f21f){return client[_0x2ddc('0xc')](_0xa07d3a,_0x4dc4ba)[_0x2ddc('0xd')](function(_0x47e754){logger[_0x2ddc('0xe')](_0x2ddc('0xf'),_0x5e61b5,_0x2ddc('0x10'));logger[_0x2ddc('0x11')](_0x2ddc('0x12'),_0x5e61b5,_0x2ddc('0x10'),JSON[_0x2ddc('0x13')](_0x47e754));if(_0x47e754[_0x2ddc('0x14')]){if(_0x47e754['error'][_0x2ddc('0x15')]===0x1f4){logger[_0x2ddc('0x14')](_0x2ddc('0xf'),_0x5e61b5,_0x47e754[_0x2ddc('0x14')]['message']);return _0xc8f21f(_0x47e754[_0x2ddc('0x14')][_0x2ddc('0x16')]);}logger['error'](_0x2ddc('0xf'),_0x5e61b5,_0x47e754['error'][_0x2ddc('0x16')]);return _0x240b7c(_0x47e754['error'][_0x2ddc('0x16')]);}else{logger[_0x2ddc('0xe')](_0x2ddc('0xf'),_0x5e61b5,_0x2ddc('0x10'));_0x240b7c(_0x47e754[_0x2ddc('0x17')][_0x2ddc('0x16')]);}})[_0x2ddc('0x18')](function(_0x54284b){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x5e61b5,_0x54284b);_0xc8f21f(_0x54284b);});});} \ No newline at end of file +var _0xa3f8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xa3f8,0x1df));var _0x8a3f=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0xa3f8[_0x55fb83];return _0x59a87a;};'use strict';var _=require(_0x8a3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a3f('0x1'));var rs=require(_0x8a3f('0x2'));var fs=require('fs');var Redis=require(_0x8a3f('0x3'));var db=require(_0x8a3f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a3f('0x5'))(_0x8a3f('0x6'));var config=require(_0x8a3f('0x7'));var jayson=require(_0x8a3f('0x8'));var client=jayson[_0x8a3f('0x9')][_0x8a3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c8a81,_0x3f5cc9,_0x1c457a){return new BPromise(function(_0x19b46f,_0x1a7a3a){return client[_0x8a3f('0xb')](_0x8c8a81,_0x1c457a)[_0x8a3f('0xc')](function(_0x315b7c){logger[_0x8a3f('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x3f5cc9,_0x8a3f('0xe'));logger[_0x8a3f('0xf')](_0x8a3f('0x10'),_0x3f5cc9,_0x8a3f('0xe'),JSON['stringify'](_0x315b7c));if(_0x315b7c[_0x8a3f('0x11')]){if(_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x12')]===0x1f4){logger[_0x8a3f('0x11')](_0x8a3f('0x13'),_0x3f5cc9,_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x14')]);return _0x1a7a3a(_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x14')]);}logger[_0x8a3f('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x3f5cc9,_0x315b7c['error']['message']);return _0x19b46f(_0x315b7c[_0x8a3f('0x11')][_0x8a3f('0x14')]);}else{logger[_0x8a3f('0xd')](_0x8a3f('0x13'),_0x3f5cc9,'request\x20sent');_0x19b46f(_0x315b7c['result'][_0x8a3f('0x14')]);}})['catch'](function(_0x33e575){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3f5cc9,_0x33e575);_0x1a7a3a(_0x33e575);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3f6cf11..b7d5b2e 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 _0x8a8b=['get','isAuthenticated','post','create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./analyticMetric.controller'];(function(_0x183f49,_0x21a84b){var _0x17d97c=function(_0x432668){while(--_0x432668){_0x183f49['push'](_0x183f49['shift']());}};_0x17d97c(++_0x21a84b);}(_0x8a8b,0xae));var _0xb8a8=function(_0x5e8ea0,_0x4a9a8a){_0x5e8ea0=_0x5e8ea0-0x0;var _0x5b0619=_0x8a8b[_0x5e8ea0];return _0x5b0619;};'use strict';var multer=require(_0xb8a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb8a8('0x1'));var express=require(_0xb8a8('0x2'));var router=express['Router']();var fs_extra=require(_0xb8a8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb8a8('0x4'));var config=require('../../config/environment');var controller=require(_0xb8a8('0x5'));router[_0xb8a8('0x6')]('/',auth[_0xb8a8('0x7')](),controller['index']);router[_0xb8a8('0x6')]('/:id',auth[_0xb8a8('0x7')](),controller['show']);router[_0xb8a8('0x8')]('/',auth[_0xb8a8('0x7')](),controller[_0xb8a8('0x9')]);router['put'](_0xb8a8('0xa'),auth[_0xb8a8('0x7')](),controller[_0xb8a8('0xb')]);router[_0xb8a8('0xc')](_0xb8a8('0xa'),auth[_0xb8a8('0x7')](),controller[_0xb8a8('0xd')]);module[_0xb8a8('0xe')]=router; \ No newline at end of file +var _0xdbf7=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xf9a547,_0x40ab32){var _0x573d08=function(_0x4b23ef){while(--_0x4b23ef){_0xf9a547['push'](_0xf9a547['shift']());}};_0x573d08(++_0x40ab32);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x188ee2,_0xb845f6){_0x188ee2=_0x188ee2-0x0;var _0x336576=_0xdbf7[_0x188ee2];return _0x336576;};'use strict';var multer=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var path=require(_0x7dbf('0x2'));var timeout=require(_0x7dbf('0x3'));var express=require(_0x7dbf('0x4'));var router=express[_0x7dbf('0x5')]();var fs_extra=require(_0x7dbf('0x6'));var auth=require(_0x7dbf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7dbf('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xa')]);router[_0x7dbf('0xb')](_0x7dbf('0xc'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xd')]);router[_0x7dbf('0xe')]('/',auth[_0x7dbf('0x9')](),controller[_0x7dbf('0xf')]);router[_0x7dbf('0x10')](_0x7dbf('0xc'),auth[_0x7dbf('0x9')](),controller[_0x7dbf('0x11')]);router[_0x7dbf('0x12')](_0x7dbf('0xc'),auth['isAuthenticated'](),controller[_0x7dbf('0x13')]);module[_0x7dbf('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 354fe70..beac5fb 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 _0xa610=['TEXT','sequelize','exports'];(function(_0x5483cc,_0x494e01){var _0xe66a31=function(_0xf17e2b){while(--_0xf17e2b){_0x5483cc['push'](_0x5483cc['shift']());}};_0xe66a31(++_0x494e01);}(_0xa610,0x6a));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a61('0x0'));module[_0x0a61('0x1')]={'tree':{'type':Sequelize[_0x0a61('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9c08=['sequelize','exports','TEXT'];(function(_0x47d69f,_0x460801){var _0xd1a4b5=function(_0x51a661){while(--_0x51a661){_0x47d69f['push'](_0x47d69f['shift']());}};_0xd1a4b5(++_0x460801);}(_0x9c08,0x147));var _0x89c0=function(_0x5c425d,_0x12caad){_0x5c425d=_0x5c425d-0x0;var _0x21b646=_0x9c08[_0x5c425d];return _0x21b646;};'use strict';var Sequelize=require(_0x89c0('0x0'));module[_0x89c0('0x1')]={'tree':{'type':Sequelize[_0x89c0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 17bd9b6..3296c61 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 _0xdd3c=['mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','then','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x236b34,_0x298581){var _0x5da74d=function(_0x26c81d){while(--_0x26c81d){_0x236b34['push'](_0x236b34['shift']());}};_0x5da74d(++_0x298581);}(_0xdd3c,0x87));var _0xcdd3=function(_0x2a1ebb,_0x5d4d0e){_0x2a1ebb=_0x2a1ebb-0x0;var _0x3f70c5=_0xdd3c[_0x2a1ebb];return _0x3f70c5;};'use strict';var emlformat=require(_0xcdd3('0x0'));var rimraf=require(_0xcdd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcdd3('0x2'));var moment=require(_0xcdd3('0x3'));var BPromise=require(_0xcdd3('0x4'));var Mustache=require(_0xcdd3('0x5'));var util=require(_0xcdd3('0x6'));var path=require(_0xcdd3('0x7'));var sox=require(_0xcdd3('0x8'));var csv=require('to-csv');var ejs=require(_0xcdd3('0x9'));var fs=require('fs');var fs_extra=require(_0xcdd3('0xa'));var _=require('lodash');var squel=require(_0xcdd3('0xb'));var crypto=require(_0xcdd3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcdd3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd3('0xe'));var authService=require(_0xcdd3('0xf'));var qs=require(_0xcdd3('0x10'));var as=require(_0xcdd3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdd3('0x12'));var utils=require(_0xcdd3('0x13'));var config=require(_0xcdd3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdd3('0x15'))['db'];function respondWithStatusCode(_0x55d7e9,_0x55c92c){_0x55c92c=_0x55c92c||0xcc;return function(_0x1f175e){if(_0x1f175e){return _0x55d7e9[_0xcdd3('0x16')](_0x55c92c);}return _0x55d7e9[_0xcdd3('0x17')](_0x55c92c)[_0xcdd3('0x18')]();};}function respondWithResult(_0x24e668,_0x2ccfa2){_0x2ccfa2=_0x2ccfa2||0xc8;return function(_0xe1038f){if(_0xe1038f){return _0x24e668[_0xcdd3('0x17')](_0x2ccfa2)['json'](_0xe1038f);}};}function respondWithFilteredResult(_0x590c82,_0x242ae1){return function(_0x2b0adf){if(_0x2b0adf){var _0x4dcfc1=typeof _0x242ae1[_0xcdd3('0x19')]===_0xcdd3('0x1a')&&typeof _0x242ae1['limit']===_0xcdd3('0x1a');var _0x22c109=_0x2b0adf[_0xcdd3('0x1b')];var _0x2cd860=_0x4dcfc1?0x0:_0x242ae1[_0xcdd3('0x19')];var _0x5b5082=_0x4dcfc1?_0x2b0adf[_0xcdd3('0x1b')]:_0x242ae1['offset']+_0x242ae1[_0xcdd3('0x1c')];var _0x555198;if(_0x5b5082>=_0x22c109){_0x5b5082=_0x22c109;_0x555198=0xc8;}else{_0x555198=0xce;}_0x590c82['status'](_0x555198);return _0x590c82[_0xcdd3('0x1d')](_0xcdd3('0x1e'),_0x2cd860+'-'+_0x5b5082+'/'+_0x22c109)['json'](_0x2b0adf);}return null;};}function patchUpdates(_0x5d9038){return function(_0x26dc07){try{jsonpatch[_0xcdd3('0x1f')](_0x26dc07,_0x5d9038,!![]);}catch(_0x3cc575){return BPromise[_0xcdd3('0x20')](_0x3cc575);}return _0x26dc07[_0xcdd3('0x21')]();};}function saveUpdates(_0x2613eb,_0x66f7e){return function(_0x23f8a7){if(_0x23f8a7){return _0x23f8a7[_0xcdd3('0x22')](_0x2613eb)['then'](function(_0x483a0a){return _0x483a0a;});}return null;};}function removeEntity(_0x172ae9,_0xd6a9ad){return function(_0x169049){if(_0x169049){return _0x169049['destroy']()['then'](function(){_0x172ae9['status'](0xcc)[_0xcdd3('0x18')]();});}};}function handleEntityNotFound(_0x202b1e,_0x5c20e5){return function(_0xb03647){if(!_0xb03647){_0x202b1e[_0xcdd3('0x16')](0x194);}return _0xb03647;};}function handleError(_0x522971,_0x57202a){_0x57202a=_0x57202a||0x1f4;return function(_0x403353){logger['error'](_0x403353['stack']);if(_0x403353[_0xcdd3('0x23')]){delete _0x403353['name'];}_0x522971[_0xcdd3('0x17')](_0x57202a)[_0xcdd3('0x24')](_0x403353);};}exports[_0xcdd3('0x25')]=function(_0x430150,_0x2c0991){var _0x4e0eaf={},_0x523932={},_0x544f23={'count':0x0,'rows':[]};var _0x440d0c=_[_0xcdd3('0x26')](db[_0xcdd3('0x27')][_0xcdd3('0x28')],function(_0x427615){return{'name':_0x427615['fieldName'],'type':_0x427615[_0xcdd3('0x29')][_0xcdd3('0x2a')]};});_0x523932[_0xcdd3('0x2b')]=_[_0xcdd3('0x26')](_0x440d0c,_0xcdd3('0x23'));_0x523932[_0xcdd3('0x2c')]=_[_0xcdd3('0x2d')](_0x430150[_0xcdd3('0x2c')]);_0x523932[_0xcdd3('0x2e')]=_[_0xcdd3('0x2f')](_0x523932[_0xcdd3('0x2b')],_0x523932[_0xcdd3('0x2c')]);_0x4e0eaf['attributes']=_['intersection'](_0x523932[_0xcdd3('0x2b')],qs[_0xcdd3('0x30')](_0x430150['query'][_0xcdd3('0x30')]));_0x4e0eaf[_0xcdd3('0x31')]=_0x4e0eaf[_0xcdd3('0x31')][_0xcdd3('0x32')]?_0x4e0eaf['attributes']:_0x523932[_0xcdd3('0x2b')];if(!_0x430150[_0xcdd3('0x2c')][_0xcdd3('0x33')](_0xcdd3('0x34'))){_0x4e0eaf[_0xcdd3('0x1c')]=qs[_0xcdd3('0x1c')](_0x430150[_0xcdd3('0x2c')]['limit']);_0x4e0eaf[_0xcdd3('0x19')]=qs[_0xcdd3('0x19')](_0x430150['query'][_0xcdd3('0x19')]);}_0x4e0eaf[_0xcdd3('0x35')]=qs[_0xcdd3('0x36')](_0x430150[_0xcdd3('0x2c')][_0xcdd3('0x36')]);_0x4e0eaf[_0xcdd3('0x37')]=qs['filters'](_['pick'](_0x430150[_0xcdd3('0x2c')],_0x523932[_0xcdd3('0x2e')]),_0x440d0c);if(_0x430150[_0xcdd3('0x2c')][_0xcdd3('0x38')]){_0x4e0eaf[_0xcdd3('0x37')]=_[_0xcdd3('0x39')](_0x4e0eaf[_0xcdd3('0x37')],{'$or':_[_0xcdd3('0x26')](_0x440d0c,function(_0x53545e){if(_0x53545e[_0xcdd3('0x29')]!=='VIRTUAL'){var _0x4cb4f8={};_0x4cb4f8[_0x53545e[_0xcdd3('0x23')]]={'$like':'%'+_0x430150[_0xcdd3('0x2c')][_0xcdd3('0x38')]+'%'};return _0x4cb4f8;}})});}_0x4e0eaf=_['merge']({},_0x4e0eaf,_0x430150['options']);var _0x1b0819={'where':_0x4e0eaf[_0xcdd3('0x37')]};return db[_0xcdd3('0x27')][_0xcdd3('0x1b')](_0x1b0819)['then'](function(_0x551d21){_0x544f23['count']=_0x551d21;if(_0x430150['query'][_0xcdd3('0x3a')]){_0x4e0eaf[_0xcdd3('0x3b')]=[{'all':!![]}];}return db[_0xcdd3('0x27')][_0xcdd3('0x3c')](_0x4e0eaf);})[_0xcdd3('0x3d')](function(_0x2cb821){_0x544f23[_0xcdd3('0x3e')]=_0x2cb821;return _0x544f23;})[_0xcdd3('0x3d')](respondWithFilteredResult(_0x2c0991,_0x4e0eaf))[_0xcdd3('0x3f')](handleError(_0x2c0991,null));};exports['show']=function(_0x558f73,_0x153051){var _0x115258={'raw':!![],'where':{'id':_0x558f73[_0xcdd3('0x40')]['id']}},_0x2fbc58={};_0x2fbc58[_0xcdd3('0x2b')]=_['keys'](db[_0xcdd3('0x27')][_0xcdd3('0x28')]);_0x2fbc58[_0xcdd3('0x2c')]=_[_0xcdd3('0x2d')](_0x558f73['query']);_0x2fbc58[_0xcdd3('0x2e')]=_['intersection'](_0x2fbc58['model'],_0x2fbc58[_0xcdd3('0x2c')]);_0x115258[_0xcdd3('0x31')]=_['intersection'](_0x2fbc58[_0xcdd3('0x2b')],qs[_0xcdd3('0x30')](_0x558f73['query'][_0xcdd3('0x30')]));_0x115258[_0xcdd3('0x31')]=_0x115258['attributes']['length']?_0x115258[_0xcdd3('0x31')]:_0x2fbc58['model'];if(_0x558f73['query']['includeAll']){_0x115258['include']=[{'all':!![]}];}_0x115258=_['merge']({},_0x115258,_0x558f73[_0xcdd3('0x41')]);return db[_0xcdd3('0x27')][_0xcdd3('0x42')](_0x115258)[_0xcdd3('0x3d')](handleEntityNotFound(_0x153051,null))['then'](respondWithResult(_0x153051,null))[_0xcdd3('0x3f')](handleError(_0x153051,null));};exports[_0xcdd3('0x43')]=function(_0x50d422,_0x277a94){return db[_0xcdd3('0x27')]['create'](_0x50d422['body'],{})[_0xcdd3('0x3d')](respondWithResult(_0x277a94,0xc9))[_0xcdd3('0x3f')](handleError(_0x277a94,null));};exports[_0xcdd3('0x22')]=function(_0x38a952,_0x2dcd51){if(_0x38a952['body']['id']){delete _0x38a952[_0xcdd3('0x44')]['id'];}return db[_0xcdd3('0x27')][_0xcdd3('0x42')]({'where':{'id':_0x38a952[_0xcdd3('0x40')]['id']}})[_0xcdd3('0x3d')](handleEntityNotFound(_0x2dcd51,null))[_0xcdd3('0x3d')](saveUpdates(_0x38a952[_0xcdd3('0x44')],null))[_0xcdd3('0x3d')](respondWithResult(_0x2dcd51,null))['catch'](handleError(_0x2dcd51,null));};exports[_0xcdd3('0x45')]=function(_0x385991,_0x80cf29){return db[_0xcdd3('0x27')][_0xcdd3('0x42')]({'where':{'id':_0x385991[_0xcdd3('0x40')]['id']}})[_0xcdd3('0x3d')](handleEntityNotFound(_0x80cf29,null))[_0xcdd3('0x3d')](removeEntity(_0x80cf29,null))['catch'](handleError(_0x80cf29,null));}; \ No newline at end of file +var _0xd64f=['body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','update','destroy','then','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','catch','show','params','keys','create'];(function(_0x33e5fe,_0x307a4b){var _0x195b9a=function(_0x48c555){while(--_0x48c555){_0x33e5fe['push'](_0x33e5fe['shift']());}};_0x195b9a(++_0x307a4b);}(_0xd64f,0x1ac));var _0xfd64=function(_0x1492f9,_0xfe7389){_0x1492f9=_0x1492f9-0x0;var _0x1dc8a8=_0xd64f[_0x1492f9];return _0x1dc8a8;};'use strict';var emlformat=require(_0xfd64('0x0'));var rimraf=require(_0xfd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd64('0x2'));var rp=require(_0xfd64('0x3'));var moment=require(_0xfd64('0x4'));var BPromise=require(_0xfd64('0x5'));var Mustache=require(_0xfd64('0x6'));var util=require(_0xfd64('0x7'));var path=require(_0xfd64('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd64('0x9'));var squel=require('squel');var crypto=require(_0xfd64('0xa'));var jsforce=require(_0xfd64('0xb'));var deskjs=require(_0xfd64('0xc'));var toCsv=require(_0xfd64('0xd'));var querystring=require(_0xfd64('0xe'));var Papa=require(_0xfd64('0xf'));var Redis=require(_0xfd64('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd64('0x11'));var as=require(_0xfd64('0x12'));var hardwareService=require(_0xfd64('0x13'));var logger=require(_0xfd64('0x14'))('api');var utils=require(_0xfd64('0x15'));var config=require(_0xfd64('0x16'));var licenseUtil=require(_0xfd64('0x17'));var db=require(_0xfd64('0x18'))['db'];function respondWithStatusCode(_0x5cf0d7,_0x47017f){_0x47017f=_0x47017f||0xcc;return function(_0x329a4a){if(_0x329a4a){return _0x5cf0d7[_0xfd64('0x19')](_0x47017f);}return _0x5cf0d7['status'](_0x47017f)[_0xfd64('0x1a')]();};}function respondWithResult(_0xcb3cb3,_0x198a75){_0x198a75=_0x198a75||0xc8;return function(_0x3d700d){if(_0x3d700d){return _0xcb3cb3[_0xfd64('0x1b')](_0x198a75)[_0xfd64('0x1c')](_0x3d700d);}};}function respondWithFilteredResult(_0x3ab6d8,_0x36d48a){return function(_0x3f7217){if(_0x3f7217){var _0xadf334=typeof _0x36d48a['offset']==='undefined'&&typeof _0x36d48a[_0xfd64('0x1d')]===_0xfd64('0x1e');var _0x366944=_0x3f7217[_0xfd64('0x1f')];var _0x136990=_0xadf334?0x0:_0x36d48a[_0xfd64('0x20')];var _0x4cc9c2=_0xadf334?_0x3f7217[_0xfd64('0x1f')]:_0x36d48a['offset']+_0x36d48a[_0xfd64('0x1d')];var _0x19cac7;if(_0x4cc9c2>=_0x366944){_0x4cc9c2=_0x366944;_0x19cac7=0xc8;}else{_0x19cac7=0xce;}_0x3ab6d8[_0xfd64('0x1b')](_0x19cac7);return _0x3ab6d8['set'](_0xfd64('0x21'),_0x136990+'-'+_0x4cc9c2+'/'+_0x366944)[_0xfd64('0x1c')](_0x3f7217);}return null;};}function patchUpdates(_0x5ab395){return function(_0x95d98f){try{jsonpatch[_0xfd64('0x22')](_0x95d98f,_0x5ab395,!![]);}catch(_0x447a04){return BPromise['reject'](_0x447a04);}return _0x95d98f['save']();};}function saveUpdates(_0x694a83,_0x1ec056){return function(_0x5c8fd){if(_0x5c8fd){return _0x5c8fd[_0xfd64('0x23')](_0x694a83)['then'](function(_0x853463){return _0x853463;});}return null;};}function removeEntity(_0x45dba0,_0x1a33f7){return function(_0x2d2273){if(_0x2d2273){return _0x2d2273[_0xfd64('0x24')]()[_0xfd64('0x25')](function(){_0x45dba0['status'](0xcc)[_0xfd64('0x1a')]();});}};}function handleEntityNotFound(_0x47e6fd,_0x1eb6f9){return function(_0x52218a){if(!_0x52218a){_0x47e6fd[_0xfd64('0x19')](0x194);}return _0x52218a;};}function handleError(_0x2cba05,_0x323f62){_0x323f62=_0x323f62||0x1f4;return function(_0x104e77){logger[_0xfd64('0x26')](_0x104e77[_0xfd64('0x27')]);if(_0x104e77['name']){delete _0x104e77[_0xfd64('0x28')];}_0x2cba05[_0xfd64('0x1b')](_0x323f62)['send'](_0x104e77);};}exports[_0xfd64('0x29')]=function(_0x237e6d,_0x41da45){var _0x211501={},_0x2ea267={},_0x49b43a={'count':0x0,'rows':[]};var _0x15dd5f=_[_0xfd64('0x2a')](db[_0xfd64('0x2b')][_0xfd64('0x2c')],function(_0x4ab988){return{'name':_0x4ab988['fieldName'],'type':_0x4ab988['type']['key']};});_0x2ea267['model']=_['map'](_0x15dd5f,_0xfd64('0x28'));_0x2ea267[_0xfd64('0x2d')]=_['keys'](_0x237e6d[_0xfd64('0x2d')]);_0x2ea267[_0xfd64('0x2e')]=_[_0xfd64('0x2f')](_0x2ea267[_0xfd64('0x30')],_0x2ea267[_0xfd64('0x2d')]);_0x211501[_0xfd64('0x31')]=_[_0xfd64('0x2f')](_0x2ea267['model'],qs[_0xfd64('0x32')](_0x237e6d['query']['fields']));_0x211501['attributes']=_0x211501[_0xfd64('0x31')][_0xfd64('0x33')]?_0x211501['attributes']:_0x2ea267['model'];if(!_0x237e6d['query'][_0xfd64('0x34')]('nolimit')){_0x211501['limit']=qs[_0xfd64('0x1d')](_0x237e6d[_0xfd64('0x2d')][_0xfd64('0x1d')]);_0x211501[_0xfd64('0x20')]=qs[_0xfd64('0x20')](_0x237e6d[_0xfd64('0x2d')]['offset']);}_0x211501[_0xfd64('0x35')]=qs[_0xfd64('0x36')](_0x237e6d['query'][_0xfd64('0x36')]);_0x211501['where']=qs['filters'](_[_0xfd64('0x37')](_0x237e6d[_0xfd64('0x2d')],_0x2ea267[_0xfd64('0x2e')]),_0x15dd5f);if(_0x237e6d[_0xfd64('0x2d')][_0xfd64('0x38')]){_0x211501['where']=_[_0xfd64('0x39')](_0x211501[_0xfd64('0x3a')],{'$or':_[_0xfd64('0x2a')](_0x15dd5f,function(_0x5ac6a5){if(_0x5ac6a5[_0xfd64('0x3b')]!=='VIRTUAL'){var _0x314080={};_0x314080[_0x5ac6a5[_0xfd64('0x28')]]={'$like':'%'+_0x237e6d[_0xfd64('0x2d')][_0xfd64('0x38')]+'%'};return _0x314080;}})});}_0x211501=_['merge']({},_0x211501,_0x237e6d[_0xfd64('0x3c')]);var _0x21abbc={'where':_0x211501[_0xfd64('0x3a')]};return db[_0xfd64('0x2b')][_0xfd64('0x1f')](_0x21abbc)['then'](function(_0x44340a){_0x49b43a[_0xfd64('0x1f')]=_0x44340a;if(_0x237e6d['query'][_0xfd64('0x3d')]){_0x211501[_0xfd64('0x3e')]=[{'all':!![]}];}return db[_0xfd64('0x2b')][_0xfd64('0x3f')](_0x211501);})[_0xfd64('0x25')](function(_0x5876e0){_0x49b43a['rows']=_0x5876e0;return _0x49b43a;})['then'](respondWithFilteredResult(_0x41da45,_0x211501))[_0xfd64('0x40')](handleError(_0x41da45,null));};exports[_0xfd64('0x41')]=function(_0xd49fc9,_0x14506a){var _0x24f2a2={'raw':!![],'where':{'id':_0xd49fc9[_0xfd64('0x42')]['id']}},_0xa6a7d0={};_0xa6a7d0['model']=_[_0xfd64('0x43')](db[_0xfd64('0x2b')]['rawAttributes']);_0xa6a7d0['query']=_[_0xfd64('0x43')](_0xd49fc9[_0xfd64('0x2d')]);_0xa6a7d0['filters']=_['intersection'](_0xa6a7d0[_0xfd64('0x30')],_0xa6a7d0['query']);_0x24f2a2['attributes']=_[_0xfd64('0x2f')](_0xa6a7d0[_0xfd64('0x30')],qs['fields'](_0xd49fc9['query'][_0xfd64('0x32')]));_0x24f2a2['attributes']=_0x24f2a2[_0xfd64('0x31')][_0xfd64('0x33')]?_0x24f2a2[_0xfd64('0x31')]:_0xa6a7d0[_0xfd64('0x30')];if(_0xd49fc9[_0xfd64('0x2d')][_0xfd64('0x3d')]){_0x24f2a2[_0xfd64('0x3e')]=[{'all':!![]}];}_0x24f2a2=_[_0xfd64('0x39')]({},_0x24f2a2,_0xd49fc9['options']);return db[_0xfd64('0x2b')]['find'](_0x24f2a2)[_0xfd64('0x25')](handleEntityNotFound(_0x14506a,null))['then'](respondWithResult(_0x14506a,null))[_0xfd64('0x40')](handleError(_0x14506a,null));};exports[_0xfd64('0x44')]=function(_0x3d0f97,_0xe2dd37){return db[_0xfd64('0x2b')]['create'](_0x3d0f97[_0xfd64('0x45')],{})[_0xfd64('0x25')](respondWithResult(_0xe2dd37,0xc9))[_0xfd64('0x40')](handleError(_0xe2dd37,null));};exports[_0xfd64('0x23')]=function(_0x54dcb9,_0xa69fba){if(_0x54dcb9['body']['id']){delete _0x54dcb9[_0xfd64('0x45')]['id'];}return db[_0xfd64('0x2b')][_0xfd64('0x46')]({'where':{'id':_0x54dcb9[_0xfd64('0x42')]['id']}})[_0xfd64('0x25')](handleEntityNotFound(_0xa69fba,null))[_0xfd64('0x25')](saveUpdates(_0x54dcb9[_0xfd64('0x45')],null))[_0xfd64('0x25')](respondWithResult(_0xa69fba,null))[_0xfd64('0x40')](handleError(_0xa69fba,null));};exports[_0xfd64('0x24')]=function(_0x4f97e2,_0x5d4ff1){return db['AnalyticTreeReport'][_0xfd64('0x46')]({'where':{'id':_0x4f97e2['params']['id']}})[_0xfd64('0x25')](handleEntityNotFound(_0x5d4ff1,null))[_0xfd64('0x25')](removeEntity(_0x5d4ff1,null))['catch'](handleError(_0x5d4ff1,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9b6466f..0995fc8 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 _0xee23=['api','bluebird','request-promise','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0xee23,0x1d7));var _0x3ee2=function(_0x4a80a0,_0x21eea3){_0x4a80a0=_0x4a80a0-0x0;var _0x2a04f2=_0xee23[_0x4a80a0];return _0x2a04f2;};'use strict';var _=require(_0x3ee2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3ee2('0x1'));var moment=require('moment');var BPromise=require(_0x3ee2('0x2'));var rp=require(_0x3ee2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3ee2('0x4'));module[_0x3ee2('0x5')]=function(_0x39f4d7,_0x264860){return _0x39f4d7[_0x3ee2('0x6')]('AnalyticTreeReport',attributes,{'tableName':_0x3ee2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11f3=['../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3828e2,_0x2ef6d6){var _0x2fa385=function(_0x2b8040){while(--_0x2b8040){_0x3828e2['push'](_0x3828e2['shift']());}};_0x2fa385(++_0x2ef6d6);}(_0x11f3,0x118));var _0x311f=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0x11f3[_0x3a7bdf];return _0x35a9a8;};'use strict';var _=require(_0x311f('0x0'));var util=require('util');var logger=require(_0x311f('0x1'))(_0x311f('0x2'));var moment=require(_0x311f('0x3'));var BPromise=require(_0x311f('0x4'));var rp=require(_0x311f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x311f('0x6'));var attributes=require(_0x311f('0x7'));module['exports']=function(_0x49d494,_0x1539be){return _0x49d494[_0x311f('0x8')](_0x311f('0x9'),attributes,{'tableName':_0x311f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 4789c36..2711899 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x329908,_0x14e1ca){var _0x22e271=function(_0x4915c3){while(--_0x4915c3){_0x329908['push'](_0x329908['shift']());}};_0x22e271(++_0x14e1ca);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'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')]('AnalyticTreeReport,\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 +var _0x7a54=['info','AnalyticTreeReport,\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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0xad82c8,_0x5bc74a){_0xad82c8=_0xad82c8-0x0;var _0x43b405=_0x7a54[_0xad82c8];return _0x43b405;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1b94d9b..424d726 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 _0x4e9a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xc3c34c,_0x7d58c2){var _0x3300e4=function(_0x564389){while(--_0x564389){_0xc3c34c['push'](_0xc3c34c['shift']());}};_0x3300e4(++_0x7d58c2);}(_0x4e9a,0x1df));var _0xa4e9=function(_0x381017,_0x1c5974){_0x381017=_0x381017-0x0;var _0x3fb76d=_0x4e9a[_0x381017];return _0x3fb76d;};'use strict';var multer=require(_0xa4e9('0x0'));var util=require(_0xa4e9('0x1'));var path=require(_0xa4e9('0x2'));var timeout=require(_0xa4e9('0x3'));var express=require(_0xa4e9('0x4'));var router=express[_0xa4e9('0x5')]();var fs_extra=require(_0xa4e9('0x6'));var auth=require(_0xa4e9('0x7'));var interaction=require(_0xa4e9('0x8'));var config=require(_0xa4e9('0x9'));var controller=require(_0xa4e9('0xa'));router['get']('/',auth[_0xa4e9('0xb')](),controller[_0xa4e9('0xc')]);router[_0xa4e9('0xd')](_0xa4e9('0xe'),auth[_0xa4e9('0xb')](),controller[_0xa4e9('0xf')]);router[_0xa4e9('0x10')]('/',auth[_0xa4e9('0xb')](),controller[_0xa4e9('0x11')]);router[_0xa4e9('0x12')](_0xa4e9('0xe'),auth[_0xa4e9('0xb')](),controller[_0xa4e9('0x13')]);router['delete'](_0xa4e9('0xe'),auth[_0xa4e9('0xb')](),controller[_0xa4e9('0x14')]);module[_0xa4e9('0x15')]=router; \ No newline at end of file +var _0xe81f=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe81f,0x126));var _0xfe81=function(_0x3071b5,_0xa4b97d){_0x3071b5=_0x3071b5-0x0;var _0x43af37=_0xe81f[_0x3071b5];return _0x43af37;};'use strict';var multer=require(_0xfe81('0x0'));var util=require('util');var path=require(_0xfe81('0x1'));var timeout=require(_0xfe81('0x2'));var express=require('express');var router=express[_0xfe81('0x3')]();var fs_extra=require(_0xfe81('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe81('0x5'));var config=require(_0xfe81('0x6'));var controller=require(_0xfe81('0x7'));router[_0xfe81('0x8')]('/',auth[_0xfe81('0x9')](),controller['index']);router[_0xfe81('0x8')](_0xfe81('0xa'),auth[_0xfe81('0x9')](),controller[_0xfe81('0xb')]);router['post']('/',auth[_0xfe81('0x9')](),controller['create']);router[_0xfe81('0xc')](_0xfe81('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xfe81('0xd')](_0xfe81('0xa'),auth['isAuthenticated'](),controller[_0xfe81('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a4cbc3b..b408ea1 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 _0x7f42=['STRING','sequelize'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7f42,0x1dd));var _0x27f4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7f42[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x27f4('0x0'));module['exports']={'name':{'type':Sequelize[_0x27f4('0x1')]},'basename':{'type':Sequelize[_0x27f4('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8135=['STRING','exports'];(function(_0x1b22b3,_0x99ea09){var _0x1678f1=function(_0x4fc986){while(--_0x4fc986){_0x1b22b3['push'](_0x1b22b3['shift']());}};_0x1678f1(++_0x99ea09);}(_0x8135,0x99));var _0x5813=function(_0x3725fc,_0x98ba1e){_0x3725fc=_0x3725fc-0x0;var _0xe49d8d=_0x8135[_0x3725fc];return _0xe49d8d;};'use strict';var Sequelize=require('sequelize');module[_0x5813('0x0')]={'name':{'type':Sequelize[_0x5813('0x1')]},'basename':{'type':Sequelize[_0x5813('0x1')]},'type':{'type':Sequelize[_0x5813('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 42445cb..0cb9d55 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 _0xa9a6=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','keys','find','clone','params','options','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','findOne','join','root','offline-chat/','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9a6,0xaa));var _0x6a9a=function(_0x146c59,_0xf9ea1d){_0x146c59=_0x146c59-0x0;var _0x46d7c1=_0xa9a6[_0x146c59];return _0x46d7c1;};'use strict';var emlformat=require(_0x6a9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a9a('0x1'));var jsonpatch=require(_0x6a9a('0x2'));var rp=require(_0x6a9a('0x3'));var moment=require(_0x6a9a('0x4'));var BPromise=require(_0x6a9a('0x5'));var Mustache=require(_0x6a9a('0x6'));var util=require(_0x6a9a('0x7'));var path=require(_0x6a9a('0x8'));var sox=require('sox');var csv=require(_0x6a9a('0x9'));var ejs=require(_0x6a9a('0xa'));var fs=require('fs');var fs_extra=require(_0x6a9a('0xb'));var _=require(_0x6a9a('0xc'));var squel=require(_0x6a9a('0xd'));var crypto=require(_0x6a9a('0xe'));var jsforce=require(_0x6a9a('0xf'));var deskjs=require(_0x6a9a('0x10'));var toCsv=require(_0x6a9a('0x9'));var querystring=require(_0x6a9a('0x11'));var Papa=require(_0x6a9a('0x12'));var Redis=require('ioredis');var authService=require(_0x6a9a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a9a('0x14'));var logger=require(_0x6a9a('0x15'))('api');var utils=require(_0x6a9a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6a9a('0x17'));var db=require(_0x6a9a('0x18'))['db'];function respondWithStatusCode(_0x47ed9c,_0x18c9f4){_0x18c9f4=_0x18c9f4||0xcc;return function(_0x3e5b11){if(_0x3e5b11){return _0x47ed9c[_0x6a9a('0x19')](_0x18c9f4);}return _0x47ed9c['status'](_0x18c9f4)[_0x6a9a('0x1a')]();};}function respondWithResult(_0x728b08,_0x9156cb){_0x9156cb=_0x9156cb||0xc8;return function(_0x35fbcf){if(_0x35fbcf){return _0x728b08[_0x6a9a('0x1b')](_0x9156cb)[_0x6a9a('0x1c')](_0x35fbcf);}};}function respondWithFilteredResult(_0x152cf7,_0x4d45a8){return function(_0xe95188){if(_0xe95188){var _0x2502bc=typeof _0x4d45a8[_0x6a9a('0x1d')]===_0x6a9a('0x1e')&&typeof _0x4d45a8[_0x6a9a('0x1f')]===_0x6a9a('0x1e');var _0x58c255=_0xe95188[_0x6a9a('0x20')];var _0x275bd6=_0x2502bc?0x0:_0x4d45a8[_0x6a9a('0x1d')];var _0x197032=_0x2502bc?_0xe95188['count']:_0x4d45a8[_0x6a9a('0x1d')]+_0x4d45a8['limit'];var _0x4c2f9d;if(_0x197032>=_0x58c255){_0x197032=_0x58c255;_0x4c2f9d=0xc8;}else{_0x4c2f9d=0xce;}_0x152cf7[_0x6a9a('0x1b')](_0x4c2f9d);return _0x152cf7['set'](_0x6a9a('0x21'),_0x275bd6+'-'+_0x197032+'/'+_0x58c255)[_0x6a9a('0x1c')](_0xe95188);}return null;};}function patchUpdates(_0x205e1b){return function(_0x2d525b){try{jsonpatch[_0x6a9a('0x22')](_0x2d525b,_0x205e1b,!![]);}catch(_0x147d0b){return BPromise[_0x6a9a('0x23')](_0x147d0b);}return _0x2d525b[_0x6a9a('0x24')]();};}function saveUpdates(_0x1f56c1,_0xb37d){return function(_0x23fa82){if(_0x23fa82){return _0x23fa82[_0x6a9a('0x25')](_0x1f56c1)[_0x6a9a('0x26')](function(_0x5b7e55){return _0x5b7e55;});}return null;};}function removeEntity(_0x16b616,_0x203eb4){return function(_0x3a1f31){if(_0x3a1f31){return _0x3a1f31[_0x6a9a('0x27')]()[_0x6a9a('0x26')](function(){_0x16b616[_0x6a9a('0x1b')](0xcc)[_0x6a9a('0x1a')]();});}};}function handleEntityNotFound(_0x7d8236,_0x53bdce){return function(_0x35385d){if(!_0x35385d){_0x7d8236[_0x6a9a('0x19')](0x194);}return _0x35385d;};}function handleError(_0x3919d5,_0x516eab){_0x516eab=_0x516eab||0x1f4;return function(_0x1ed93e){logger['error'](_0x1ed93e[_0x6a9a('0x28')]);if(_0x1ed93e['name']){delete _0x1ed93e[_0x6a9a('0x29')];}_0x3919d5[_0x6a9a('0x1b')](_0x516eab)['send'](_0x1ed93e);};}exports[_0x6a9a('0x2a')]=function(_0x397eaa,_0x26b551){var _0x13001c={},_0x5c7293={},_0x39f23={'count':0x0,'rows':[]};var _0x283012=_[_0x6a9a('0x2b')](db[_0x6a9a('0x2c')][_0x6a9a('0x2d')],function(_0x55fffb){return{'name':_0x55fffb[_0x6a9a('0x2e')],'type':_0x55fffb[_0x6a9a('0x2f')][_0x6a9a('0x30')]};});_0x5c7293[_0x6a9a('0x31')]=_[_0x6a9a('0x2b')](_0x283012,_0x6a9a('0x29'));_0x5c7293[_0x6a9a('0x32')]=_['keys'](_0x397eaa['query']);_0x5c7293[_0x6a9a('0x33')]=_['intersection'](_0x5c7293[_0x6a9a('0x31')],_0x5c7293[_0x6a9a('0x32')]);_0x13001c[_0x6a9a('0x34')]=_[_0x6a9a('0x35')](_0x5c7293[_0x6a9a('0x31')],qs[_0x6a9a('0x36')](_0x397eaa[_0x6a9a('0x32')][_0x6a9a('0x36')]));_0x13001c[_0x6a9a('0x34')]=_0x13001c['attributes'][_0x6a9a('0x37')]?_0x13001c[_0x6a9a('0x34')]:_0x5c7293[_0x6a9a('0x31')];if(!_0x397eaa[_0x6a9a('0x32')][_0x6a9a('0x38')](_0x6a9a('0x39'))){_0x13001c[_0x6a9a('0x1f')]=qs[_0x6a9a('0x1f')](_0x397eaa['query'][_0x6a9a('0x1f')]);_0x13001c[_0x6a9a('0x1d')]=qs[_0x6a9a('0x1d')](_0x397eaa[_0x6a9a('0x32')][_0x6a9a('0x1d')]);}_0x13001c[_0x6a9a('0x3a')]=qs[_0x6a9a('0x3b')](_0x397eaa[_0x6a9a('0x32')][_0x6a9a('0x3b')]);_0x13001c[_0x6a9a('0x3c')]=qs['filters'](_[_0x6a9a('0x3d')](_0x397eaa[_0x6a9a('0x32')],_0x5c7293[_0x6a9a('0x33')]),_0x283012);if(_0x397eaa[_0x6a9a('0x32')][_0x6a9a('0x3e')]){_0x13001c['where']=_[_0x6a9a('0x3f')](_0x13001c[_0x6a9a('0x3c')],{'$or':_['map'](_0x283012,function(_0x23c0ec){if(_0x23c0ec[_0x6a9a('0x2f')]!==_0x6a9a('0x40')){var _0x515cd5={};_0x515cd5[_0x23c0ec[_0x6a9a('0x29')]]={'$like':'%'+_0x397eaa['query']['filter']+'%'};return _0x515cd5;}})});}_0x13001c=_[_0x6a9a('0x3f')]({},_0x13001c,_0x397eaa['options']);var _0x4f6702={'where':_0x13001c[_0x6a9a('0x3c')]};return db[_0x6a9a('0x2c')][_0x6a9a('0x20')](_0x4f6702)[_0x6a9a('0x26')](function(_0x214569){_0x39f23[_0x6a9a('0x20')]=_0x214569;if(_0x397eaa[_0x6a9a('0x32')][_0x6a9a('0x41')]){_0x13001c[_0x6a9a('0x42')]=[{'all':!![]}];}return db[_0x6a9a('0x2c')]['findAll'](_0x13001c);})['then'](function(_0x5299bf){_0x39f23[_0x6a9a('0x43')]=_0x5299bf;return _0x39f23;})['then'](respondWithFilteredResult(_0x26b551,_0x13001c))[_0x6a9a('0x44')](handleError(_0x26b551,null));};exports[_0x6a9a('0x45')]=function(_0x43bd78,_0x15ddba){var _0x44f8fd={'raw':!![],'where':{'id':_0x43bd78['params']['id']}},_0x5a936b={};_0x5a936b[_0x6a9a('0x31')]=_[_0x6a9a('0x46')](db[_0x6a9a('0x2c')][_0x6a9a('0x2d')]);_0x5a936b[_0x6a9a('0x32')]=_['keys'](_0x43bd78[_0x6a9a('0x32')]);_0x5a936b[_0x6a9a('0x33')]=_[_0x6a9a('0x35')](_0x5a936b[_0x6a9a('0x31')],_0x5a936b['query']);_0x44f8fd['attributes']=_[_0x6a9a('0x35')](_0x5a936b['model'],qs[_0x6a9a('0x36')](_0x43bd78[_0x6a9a('0x32')]['fields']));_0x44f8fd[_0x6a9a('0x34')]=_0x44f8fd['attributes'][_0x6a9a('0x37')]?_0x44f8fd[_0x6a9a('0x34')]:_0x5a936b['model'];if(_0x43bd78[_0x6a9a('0x32')][_0x6a9a('0x41')]){_0x44f8fd[_0x6a9a('0x42')]=[{'all':!![]}];}_0x44f8fd=_['merge']({},_0x44f8fd,_0x43bd78['options']);return db[_0x6a9a('0x2c')][_0x6a9a('0x47')](_0x44f8fd)[_0x6a9a('0x26')](handleEntityNotFound(_0x15ddba,null))['then'](respondWithResult(_0x15ddba,null))[_0x6a9a('0x44')](handleError(_0x15ddba,null));};exports[_0x6a9a('0x48')]=function(_0x2d0602,_0x3d17f8){var _0x632adc={'where':{'id':_0x2d0602[_0x6a9a('0x49')]['id']}},_0x160312={};_0x160312[_0x6a9a('0x31')]=_['keys'](db[_0x6a9a('0x2c')][_0x6a9a('0x2d')]);_0x632adc[_0x6a9a('0x34')]=_['intersection'](_0x160312['model'],qs[_0x6a9a('0x36')](_0x2d0602[_0x6a9a('0x32')][_0x6a9a('0x36')]));_0x632adc[_0x6a9a('0x34')]=_0x632adc['attributes']['length']?_0x632adc[_0x6a9a('0x34')]:_0x160312[_0x6a9a('0x31')];if(_0x2d0602['query'][_0x6a9a('0x41')]){_0x632adc['include']=[{'all':!![]}];}_0x632adc=_['merge']({},_0x632adc,_0x2d0602[_0x6a9a('0x4a')]);return db[_0x6a9a('0x2c')][_0x6a9a('0x47')](_0x632adc)['then'](handleEntityNotFound(_0x3d17f8,null))[_0x6a9a('0x26')](function(_0x45e350){if(_0x45e350){var _0x519f57=_0x45e350[_0x6a9a('0x4b')]({'plain':!![]});_0x519f57=qs[_0x6a9a('0x4c')](_0x519f57,['id',_0x6a9a('0x4d'),_0x6a9a('0x4e')]);_0x2d0602['body']=_['omit'](_0x2d0602[_0x6a9a('0x4f')],['id','createdAt',_0x6a9a('0x4e')]);return db[_0x6a9a('0x2c')][_0x6a9a('0x50')](_[_0x6a9a('0x3f')](_0x519f57,_0x2d0602[_0x6a9a('0x4f')]),{'include':_0x2d0602[_0x6a9a('0x32')][_0x6a9a('0x41')]?[{'all':!![]}]:undefined});}})[_0x6a9a('0x26')](respondWithResult(_0x3d17f8,0xc9))['catch'](handleError(_0x3d17f8,null));};exports['update']=function(_0xf76359,_0x3f27d7){if(_0xf76359[_0x6a9a('0x4f')]['id']){delete _0xf76359[_0x6a9a('0x4f')]['id'];}return db[_0x6a9a('0x2c')][_0x6a9a('0x47')]({'where':{'id':_0xf76359[_0x6a9a('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f27d7,null))[_0x6a9a('0x26')](saveUpdates(_0xf76359[_0x6a9a('0x4f')],null))['then'](respondWithResult(_0x3f27d7,null))[_0x6a9a('0x44')](handleError(_0x3f27d7,null));};exports[_0x6a9a('0x27')]=function(_0x25cce3,_0x151eb6){return db[_0x6a9a('0x2c')][_0x6a9a('0x47')]({'where':{'id':_0x25cce3[_0x6a9a('0x49')]['id']}})[_0x6a9a('0x26')](handleEntityNotFound(_0x151eb6,null))[_0x6a9a('0x26')](removeEntity(_0x151eb6,null))['catch'](handleError(_0x151eb6,null));};exports['create']=function(_0x253167,_0x4e2d58,_0x20a8d6){_0x253167[_0x6a9a('0x4f')][_0x6a9a('0x29')]=_0x253167[_0x6a9a('0x51')][_0x6a9a('0x52')];_0x253167['body'][_0x6a9a('0x53')]=_0x253167[_0x6a9a('0x51')][_0x6a9a('0x54')];_0x253167['body']['type']=_0x253167['file']['mimetype'];return db[_0x6a9a('0x2c')][_0x6a9a('0x50')](_0x253167[_0x6a9a('0x4f')])[_0x6a9a('0x26')](respondWithResult(_0x4e2d58,0xc9))['catch'](handleError(_0x4e2d58,null));};exports['download']=function(_0x59be96,_0x1c9ab3,_0x4bc08f){return db[_0x6a9a('0x2c')][_0x6a9a('0x55')]({'where':{'id':_0x59be96[_0x6a9a('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1c9ab3,null))[_0x6a9a('0x26')](function(_0x5d4356){if(_0x5d4356){var _0x3b3820=_0x5d4356['ChatOfflineMessageId']!==null;var _0x58e4c2=path[_0x6a9a('0x56')](config[_0x6a9a('0x57')],'server/files/attachments/');if(_0x3b3820){_0x58e4c2=path['join'](_0x58e4c2,_0x6a9a('0x58'));}var _0x564fa2=path['join'](_0x58e4c2,_0x5d4356[_0x6a9a('0x53')]);return _0x1c9ab3[_0x6a9a('0x59')](_0x564fa2);}})[_0x6a9a('0x44')](handleError(_0x1c9ab3,null));}; \ No newline at end of file +var _0xefb5=['show','params','rawAttributes','find','omit','body','create','file','originalname','type','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','Attachment','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x278111,_0x44e763){var _0x34edb0=function(_0x585faf){while(--_0x585faf){_0x278111['push'](_0x278111['shift']());}};_0x34edb0(++_0x44e763);}(_0xefb5,0x10b));var _0x5efb=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xefb5[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x5efb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5efb('0x1'));var jsonpatch=require(_0x5efb('0x2'));var rp=require(_0x5efb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5efb('0x4'));var util=require('util');var path=require(_0x5efb('0x5'));var sox=require(_0x5efb('0x6'));var csv=require(_0x5efb('0x7'));var ejs=require(_0x5efb('0x8'));var fs=require('fs');var fs_extra=require(_0x5efb('0x9'));var _=require('lodash');var squel=require(_0x5efb('0xa'));var crypto=require(_0x5efb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5efb('0xc'));var toCsv=require(_0x5efb('0x7'));var querystring=require(_0x5efb('0xd'));var Papa=require(_0x5efb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5efb('0xf'));var as=require(_0x5efb('0x10'));var hardwareService=require(_0x5efb('0x11'));var logger=require(_0x5efb('0x12'))(_0x5efb('0x13'));var utils=require('../../config/utils');var config=require(_0x5efb('0x14'));var licenseUtil=require(_0x5efb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16351f,_0x5cd8f8){_0x5cd8f8=_0x5cd8f8||0xcc;return function(_0x4e8c2a){if(_0x4e8c2a){return _0x16351f[_0x5efb('0x16')](_0x5cd8f8);}return _0x16351f[_0x5efb('0x17')](_0x5cd8f8)[_0x5efb('0x18')]();};}function respondWithResult(_0x2641ef,_0x5c1732){_0x5c1732=_0x5c1732||0xc8;return function(_0x4b0328){if(_0x4b0328){return _0x2641ef[_0x5efb('0x17')](_0x5c1732)[_0x5efb('0x19')](_0x4b0328);}};}function respondWithFilteredResult(_0x255365,_0xf415f0){return function(_0xc49129){if(_0xc49129){var _0x2b0ab9=typeof _0xf415f0[_0x5efb('0x1a')]===_0x5efb('0x1b')&&typeof _0xf415f0[_0x5efb('0x1c')]===_0x5efb('0x1b');var _0x324f4d=_0xc49129[_0x5efb('0x1d')];var _0x2a591a=_0x2b0ab9?0x0:_0xf415f0[_0x5efb('0x1a')];var _0x35ff7d=_0x2b0ab9?_0xc49129[_0x5efb('0x1d')]:_0xf415f0[_0x5efb('0x1a')]+_0xf415f0[_0x5efb('0x1c')];var _0x3c3e7a;if(_0x35ff7d>=_0x324f4d){_0x35ff7d=_0x324f4d;_0x3c3e7a=0xc8;}else{_0x3c3e7a=0xce;}_0x255365[_0x5efb('0x17')](_0x3c3e7a);return _0x255365[_0x5efb('0x1e')](_0x5efb('0x1f'),_0x2a591a+'-'+_0x35ff7d+'/'+_0x324f4d)[_0x5efb('0x19')](_0xc49129);}return null;};}function patchUpdates(_0x3da8d7){return function(_0xc9a640){try{jsonpatch[_0x5efb('0x20')](_0xc9a640,_0x3da8d7,!![]);}catch(_0xf8a70c){return BPromise[_0x5efb('0x21')](_0xf8a70c);}return _0xc9a640['save']();};}function saveUpdates(_0x4f3b80,_0x4badd8){return function(_0xee5caf){if(_0xee5caf){return _0xee5caf[_0x5efb('0x22')](_0x4f3b80)['then'](function(_0x58247a){return _0x58247a;});}return null;};}function removeEntity(_0x267932,_0xe5de8a){return function(_0x2e1f09){if(_0x2e1f09){return _0x2e1f09[_0x5efb('0x23')]()[_0x5efb('0x24')](function(){_0x267932[_0x5efb('0x17')](0xcc)[_0x5efb('0x18')]();});}};}function handleEntityNotFound(_0x5714fd,_0x1411b0){return function(_0x2f4a17){if(!_0x2f4a17){_0x5714fd['sendStatus'](0x194);}return _0x2f4a17;};}function handleError(_0x240189,_0x4ed1b7){_0x4ed1b7=_0x4ed1b7||0x1f4;return function(_0xc0d95f){logger['error'](_0xc0d95f[_0x5efb('0x25')]);if(_0xc0d95f[_0x5efb('0x26')]){delete _0xc0d95f[_0x5efb('0x26')];}_0x240189[_0x5efb('0x17')](_0x4ed1b7)[_0x5efb('0x27')](_0xc0d95f);};}exports[_0x5efb('0x28')]=function(_0x2886cd,_0x6cc841){var _0xc560b1={},_0x208bfe={},_0x6b0356={'count':0x0,'rows':[]};var _0x4dfc2c=_['map'](db[_0x5efb('0x29')]['rawAttributes'],function(_0x3c88ba){return{'name':_0x3c88ba['fieldName'],'type':_0x3c88ba['type'][_0x5efb('0x2a')]};});_0x208bfe[_0x5efb('0x2b')]=_[_0x5efb('0x2c')](_0x4dfc2c,'name');_0x208bfe[_0x5efb('0x2d')]=_[_0x5efb('0x2e')](_0x2886cd['query']);_0x208bfe[_0x5efb('0x2f')]=_['intersection'](_0x208bfe['model'],_0x208bfe[_0x5efb('0x2d')]);_0xc560b1[_0x5efb('0x30')]=_[_0x5efb('0x31')](_0x208bfe[_0x5efb('0x2b')],qs[_0x5efb('0x32')](_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x32')]));_0xc560b1[_0x5efb('0x30')]=_0xc560b1['attributes'][_0x5efb('0x33')]?_0xc560b1['attributes']:_0x208bfe[_0x5efb('0x2b')];if(!_0x2886cd[_0x5efb('0x2d')]['hasOwnProperty'](_0x5efb('0x34'))){_0xc560b1[_0x5efb('0x1c')]=qs[_0x5efb('0x1c')](_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x1c')]);_0xc560b1[_0x5efb('0x1a')]=qs[_0x5efb('0x1a')](_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x1a')]);}_0xc560b1[_0x5efb('0x35')]=qs[_0x5efb('0x36')](_0x2886cd['query'][_0x5efb('0x36')]);_0xc560b1[_0x5efb('0x37')]=qs[_0x5efb('0x2f')](_[_0x5efb('0x38')](_0x2886cd[_0x5efb('0x2d')],_0x208bfe[_0x5efb('0x2f')]),_0x4dfc2c);if(_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x39')]){_0xc560b1[_0x5efb('0x37')]=_[_0x5efb('0x3a')](_0xc560b1[_0x5efb('0x37')],{'$or':_[_0x5efb('0x2c')](_0x4dfc2c,function(_0x2a68f6){if(_0x2a68f6['type']!==_0x5efb('0x3b')){var _0x5718ff={};_0x5718ff[_0x2a68f6[_0x5efb('0x26')]]={'$like':'%'+_0x2886cd['query'][_0x5efb('0x39')]+'%'};return _0x5718ff;}})});}_0xc560b1=_[_0x5efb('0x3a')]({},_0xc560b1,_0x2886cd[_0x5efb('0x3c')]);var _0x127163={'where':_0xc560b1['where']};return db[_0x5efb('0x29')]['count'](_0x127163)['then'](function(_0x3b9602){_0x6b0356[_0x5efb('0x1d')]=_0x3b9602;if(_0x2886cd[_0x5efb('0x2d')][_0x5efb('0x3d')]){_0xc560b1[_0x5efb('0x3e')]=[{'all':!![]}];}return db[_0x5efb('0x29')][_0x5efb('0x3f')](_0xc560b1);})[_0x5efb('0x24')](function(_0xb4c804){_0x6b0356['rows']=_0xb4c804;return _0x6b0356;})[_0x5efb('0x24')](respondWithFilteredResult(_0x6cc841,_0xc560b1))[_0x5efb('0x40')](handleError(_0x6cc841,null));};exports[_0x5efb('0x41')]=function(_0x4c6fa0,_0x172f53){var _0x2e91c7={'raw':!![],'where':{'id':_0x4c6fa0[_0x5efb('0x42')]['id']}},_0x30d9f0={};_0x30d9f0['model']=_['keys'](db['Attachment'][_0x5efb('0x43')]);_0x30d9f0[_0x5efb('0x2d')]=_['keys'](_0x4c6fa0[_0x5efb('0x2d')]);_0x30d9f0[_0x5efb('0x2f')]=_[_0x5efb('0x31')](_0x30d9f0[_0x5efb('0x2b')],_0x30d9f0['query']);_0x2e91c7['attributes']=_['intersection'](_0x30d9f0[_0x5efb('0x2b')],qs[_0x5efb('0x32')](_0x4c6fa0[_0x5efb('0x2d')][_0x5efb('0x32')]));_0x2e91c7['attributes']=_0x2e91c7[_0x5efb('0x30')][_0x5efb('0x33')]?_0x2e91c7[_0x5efb('0x30')]:_0x30d9f0[_0x5efb('0x2b')];if(_0x4c6fa0[_0x5efb('0x2d')][_0x5efb('0x3d')]){_0x2e91c7[_0x5efb('0x3e')]=[{'all':!![]}];}_0x2e91c7=_[_0x5efb('0x3a')]({},_0x2e91c7,_0x4c6fa0[_0x5efb('0x3c')]);return db[_0x5efb('0x29')]['find'](_0x2e91c7)[_0x5efb('0x24')](handleEntityNotFound(_0x172f53,null))[_0x5efb('0x24')](respondWithResult(_0x172f53,null))[_0x5efb('0x40')](handleError(_0x172f53,null));};exports['clone']=function(_0x195bd2,_0x3058ae){var _0x1ab7aa={'where':{'id':_0x195bd2[_0x5efb('0x42')]['id']}},_0x5370b2={};_0x5370b2[_0x5efb('0x2b')]=_[_0x5efb('0x2e')](db[_0x5efb('0x29')][_0x5efb('0x43')]);_0x1ab7aa['attributes']=_[_0x5efb('0x31')](_0x5370b2['model'],qs['fields'](_0x195bd2['query'][_0x5efb('0x32')]));_0x1ab7aa[_0x5efb('0x30')]=_0x1ab7aa[_0x5efb('0x30')][_0x5efb('0x33')]?_0x1ab7aa['attributes']:_0x5370b2[_0x5efb('0x2b')];if(_0x195bd2[_0x5efb('0x2d')]['includeAll']){_0x1ab7aa['include']=[{'all':!![]}];}_0x1ab7aa=_[_0x5efb('0x3a')]({},_0x1ab7aa,_0x195bd2['options']);return db['Attachment'][_0x5efb('0x44')](_0x1ab7aa)[_0x5efb('0x24')](handleEntityNotFound(_0x3058ae,null))[_0x5efb('0x24')](function(_0x204433){if(_0x204433){var _0x25fc97=_0x204433['get']({'plain':!![]});_0x25fc97=qs[_0x5efb('0x45')](_0x25fc97,['id','createdAt','updatedAt']);_0x195bd2['body']=_[_0x5efb('0x45')](_0x195bd2[_0x5efb('0x46')],['id','createdAt','updatedAt']);return db[_0x5efb('0x29')][_0x5efb('0x47')](_[_0x5efb('0x3a')](_0x25fc97,_0x195bd2[_0x5efb('0x46')]),{'include':_0x195bd2['query'][_0x5efb('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3058ae,0xc9))[_0x5efb('0x40')](handleError(_0x3058ae,null));};exports[_0x5efb('0x22')]=function(_0x134a96,_0x479720){if(_0x134a96[_0x5efb('0x46')]['id']){delete _0x134a96['body']['id'];}return db[_0x5efb('0x29')][_0x5efb('0x44')]({'where':{'id':_0x134a96['params']['id']}})[_0x5efb('0x24')](handleEntityNotFound(_0x479720,null))[_0x5efb('0x24')](saveUpdates(_0x134a96[_0x5efb('0x46')],null))[_0x5efb('0x24')](respondWithResult(_0x479720,null))['catch'](handleError(_0x479720,null));};exports[_0x5efb('0x23')]=function(_0xc8ed46,_0x33639e){return db[_0x5efb('0x29')][_0x5efb('0x44')]({'where':{'id':_0xc8ed46[_0x5efb('0x42')]['id']}})[_0x5efb('0x24')](handleEntityNotFound(_0x33639e,null))[_0x5efb('0x24')](removeEntity(_0x33639e,null))[_0x5efb('0x40')](handleError(_0x33639e,null));};exports['create']=function(_0x3b8516,_0x12eac6,_0x3c1c24){_0x3b8516['body'][_0x5efb('0x26')]=_0x3b8516[_0x5efb('0x48')][_0x5efb('0x49')];_0x3b8516[_0x5efb('0x46')]['basename']=_0x3b8516['file']['filename'];_0x3b8516[_0x5efb('0x46')][_0x5efb('0x4a')]=_0x3b8516[_0x5efb('0x48')][_0x5efb('0x4b')];return db[_0x5efb('0x29')][_0x5efb('0x47')](_0x3b8516['body'])[_0x5efb('0x24')](respondWithResult(_0x12eac6,0xc9))['catch'](handleError(_0x12eac6,null));};exports[_0x5efb('0x4c')]=function(_0x549309,_0x5be08f,_0xf96c67){return db['Attachment'][_0x5efb('0x4d')]({'where':{'id':_0x549309[_0x5efb('0x42')]['id']},'raw':!![]})[_0x5efb('0x24')](handleEntityNotFound(_0x5be08f,null))['then'](function(_0x22a3da){if(_0x22a3da){var _0x2f587e=_0x22a3da[_0x5efb('0x4e')]!==null;var _0xfe62ec=path[_0x5efb('0x4f')](config['root'],_0x5efb('0x50'));if(_0x2f587e){_0xfe62ec=path[_0x5efb('0x4f')](_0xfe62ec,_0x5efb('0x51'));}var _0x250f19=path[_0x5efb('0x4f')](_0xfe62ec,_0x22a3da[_0x5efb('0x52')]);return _0x5be08f[_0x5efb('0x4c')](_0x250f19);}})[_0x5efb('0x40')](handleError(_0x5be08f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0edf7b9..8455976 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 _0x59c9=['define','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4eec16,_0x4339c7){var _0x33e9ce=function(_0x40274b){while(--_0x40274b){_0x4eec16['push'](_0x4eec16['shift']());}};_0x33e9ce(++_0x4339c7);}(_0x59c9,0x1c9));var _0x959c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x59c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x959c('0x0'));var util=require(_0x959c('0x1'));var logger=require(_0x959c('0x2'))(_0x959c('0x3'));var moment=require(_0x959c('0x4'));var BPromise=require(_0x959c('0x5'));var rp=require(_0x959c('0x6'));var fs=require('fs');var path=require(_0x959c('0x7'));var rimraf=require(_0x959c('0x8'));var config=require(_0x959c('0x9'));var attributes=require('./attachment.attributes');module[_0x959c('0xa')]=function(_0x17e391,_0x365b16){return _0x17e391[_0x959c('0xb')]('Attachment',attributes,{'tableName':_0x959c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e1a=['api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger'];(function(_0x1f9c93,_0x533398){var _0x226ac2=function(_0x24412c){while(--_0x24412c){_0x1f9c93['push'](_0x1f9c93['shift']());}};_0x226ac2(++_0x533398);}(_0x7e1a,0x195));var _0xa7e1=function(_0x316da5,_0x34ddb6){_0x316da5=_0x316da5-0x0;var _0xbd1248=_0x7e1a[_0x316da5];return _0xbd1248;};'use strict';var _=require(_0xa7e1('0x0'));var util=require(_0xa7e1('0x1'));var logger=require(_0xa7e1('0x2'))(_0xa7e1('0x3'));var moment=require('moment');var BPromise=require(_0xa7e1('0x4'));var rp=require(_0xa7e1('0x5'));var fs=require('fs');var path=require(_0xa7e1('0x6'));var rimraf=require(_0xa7e1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7e1('0x8'));module[_0xa7e1('0x9')]=function(_0x334c92,_0x49e036){return _0x334c92[_0xa7e1('0xa')]('Attachment',attributes,{'tableName':_0xa7e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 6d312b4..fc78d03 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 _0x202c=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment','options','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x256b67,_0x14e47b){var _0x3e2d99=function(_0x4a4c5f){while(--_0x4a4c5f){_0x256b67['push'](_0x256b67['shift']());}};_0x3e2d99(++_0x14e47b);}(_0x202c,0x178));var _0xc202=function(_0x567fb5,_0x143dde){_0x567fb5=_0x567fb5-0x0;var _0x3d3977=_0x202c[_0x567fb5];return _0x3d3977;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Attachment,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});}exports[_0xc202('0x16')]=function(_0x9620a0){var _0x591ecc=this;return new Promise(function(_0x16ec7c,_0x2c5557){return db[_0xc202('0x17')]['create'](_0x9620a0['body'],{'raw':_0x9620a0[_0xc202('0x18')]?_0x9620a0[_0xc202('0x18')][_0xc202('0x19')]===undefined?!![]:![]:!![]})[_0xc202('0xb')](function(_0x2ae3c1){logger['info']('CreateAttachment',_0x9620a0);logger[_0xc202('0xf')]('CreateAttachment',_0x9620a0,JSON[_0xc202('0x11')](_0x2ae3c1));_0x16ec7c(_0x2ae3c1);})[_0xc202('0x15')](function(_0x56e979){logger['error'](_0xc202('0x16'),_0x56e979['message'],_0x9620a0);_0x2c5557(_0x591ecc[_0xc202('0x12')](0x1f4,_0x56e979[_0xc202('0x14')]));});});}; \ No newline at end of file +var _0x4fef=['debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0x4fef,0x10f));var _0xf4fe=function(_0x196b4b,_0x41613f){_0x196b4b=_0x196b4b-0x0;var _0xefe3b0=_0x4fef[_0x196b4b];return _0xefe3b0;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Attachment,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Attachment,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});}exports[_0xf4fe('0x17')]=function(_0x5ad86c){var _0x519f1d=this;return new Promise(function(_0x24c818,_0x2b58dd){return db[_0xf4fe('0x18')][_0xf4fe('0x19')](_0x5ad86c[_0xf4fe('0x1a')],{'raw':_0x5ad86c[_0xf4fe('0x1b')]?_0x5ad86c[_0xf4fe('0x1b')][_0xf4fe('0x1c')]===undefined?!![]:![]:!![]})[_0xf4fe('0xc')](function(_0x223676){logger[_0xf4fe('0xd')](_0xf4fe('0x17'),_0x5ad86c);logger[_0xf4fe('0x1d')](_0xf4fe('0x17'),_0x5ad86c,JSON['stringify'](_0x223676));_0x24c818(_0x223676);})[_0xf4fe('0x16')](function(_0x5e8e18){logger['error']('CreateAttachment',_0x5e8e18[_0xf4fe('0x14')],_0x5ad86c);_0x2b58dd(_0x519f1d['error'](0x1f4,_0x5e8e18['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 057bb42..ba61bc8 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x3d7076,_0x4d777a){var _0x588fc8=function(_0xbbc87c){while(--_0xbbc87c){_0x3d7076['push'](_0x3d7076['shift']());}};_0x588fc8(++_0x4d777a);}(_0xadb5,0xad));var _0x5adb=function(_0x11a23b,_0x4c797b){_0x11a23b=_0x11a23b-0x0;var _0x6cb5f0=_0xadb5[_0x11a23b];return _0x6cb5f0;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x28fd8c,_0x6826b2){var _0x26bd61=function(_0x3d717b){while(--_0x3d717b){_0x28fd8c['push'](_0x28fd8c['shift']());}};_0x26bd61(++_0x6826b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x595151,_0x1f1f72){_0x595151=_0x595151-0x0;var _0x5776df=_0xb10b[_0x595151];return _0x5776df;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index e0046d1..f2de981 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85a1=['admin','user','agent','then','blockDuration','add','minutes','clearBlockUser','getLicense','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','adSsoEnabled','name','password','salt','disabled','blocked','blockedAt','online'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0x85a1,0x1f2));var _0x185a=function(_0x55c291,_0x54188b){_0x55c291=_0x55c291-0x0;var _0x275ea9=_0x85a1[_0x55c291];return _0x275ea9;};'use strict';var passport=require(_0x185a('0x0'));var LocalStrategy=require(_0x185a('0x1'))[_0x185a('0x2')];var moment=require(_0x185a('0x3'));var ActiveDirectory=require(_0x185a('0x4'));var BPromise=require(_0x185a('0x5'));var util=require(_0x185a('0x6'));var db=require(_0x185a('0x7'))['db'];var authService=require(_0x185a('0x8'));var utils=require('../../config/utils');var config=require(_0x185a('0x9'));var logger=require(_0x185a('0xa'))(_0x185a('0xb'));function isActiveDirectoryConfigured(_0x4cde5c){var _0x13ae4c=![];if(typeof _0x4cde5c[_0x185a('0xc')]!==_0x185a('0xd')){_0x13ae4c=_0x4cde5c[_0x185a('0xc')][_0x185a('0xe')]&&_0x4cde5c['activedirectory'][_0x185a('0xf')]&&_0x4cde5c['activedirectory'][_0x185a('0x10')];}return _0x13ae4c;}function adAuthenticate(_0x49b6f5,_0x3530de,_0x47a23a){return new BPromise(function(_0x583555,_0x1ab3a4){try{var _0x3de8e8=new ActiveDirectory(_0x49b6f5);_0x3de8e8[_0x185a('0x11')](_0x3530de,_0x47a23a,function(_0x19ec03,_0x5ddf3b){if(_0x19ec03){logger[_0x185a('0x12')]('Error\x20authenticate\x20%s:\x20%s',_0x3530de,util['inspect'](_0x19ec03,{'showHidden':![],'depth':null}));_0x1ab3a4(_0x185a('0x13'));}else if(!_0x5ddf3b){logger[_0x185a('0x12')](_0x185a('0x14'),_0x3530de);_0x1ab3a4(_0x185a('0x13'));}else{_0x583555(_0x5ddf3b);}});}catch(_0x380345){_0x1ab3a4(_0x380345);}});}function ActiveDirectoryAuthenticate(_0xe6bef1,_0x8622d1,_0x4885e9,_0x166c33){var _0x3fbb9d,_0x3beebd;if(!isActiveDirectoryConfigured(config)){logger[_0x185a('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x8622d1);return _0x166c33(null,![],{'message':_0x185a('0x13')});}return db['Setting'][_0x185a('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})['then'](function(_0x11b2a7){_0x3fbb9d=_0x11b2a7;if(!_0x3fbb9d[_0x185a('0x16')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x8622d1);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xe6bef1[_0x185a('0x15')]({'attributes':['id',_0x185a('0x17'),_0x185a('0x18'),_0x185a('0x19'),'role',_0x185a('0x1a'),_0x185a('0x1b'),_0x185a('0x1c'),_0x185a('0x1d')],'where':{'name':_0x8622d1,'role':{'$or':[_0x185a('0x1e'),_0x185a('0x1f'),_0x185a('0x20')]},'adSsoEnabled':!![]}});})[_0x185a('0x21')](function(_0x5be0f){if(!_0x5be0f||_0x5be0f&&_0x5be0f[_0x185a('0x17')]!==_0x8622d1){throw new Error(_0x185a('0x13'));}_0x3beebd=_0x5be0f;var _0x305e4a=_0x3beebd['name']+'@'+config[_0x185a('0xc')]['domain'];return adAuthenticate(config[_0x185a('0xc')],_0x305e4a,_0x4885e9);})['then'](function(_0x5ee30c){if(_0x3beebd[_0x185a('0x1a')]){throw new Error(_0x185a('0x13'));}if(_0x3fbb9d[_0x185a('0x22')]>0x0){if(_0x3beebd['blocked']){if(moment(_0x3beebd[_0x185a('0x1c')])[_0x185a('0x23')](_0x3fbb9d[_0x185a('0x22')],_0x185a('0x24'))>moment()){throw new Error(_0x185a('0x13'));}return utils[_0x185a('0x25')](_0x3beebd,0x0,![],null)[_0x185a('0x21')](function(){return utils['getLicense'](_0x3beebd);})[_0x185a('0x21')](function(){return _0x166c33(null,_0x3beebd);});}else{return utils['getLicense'](_0x3beebd)[_0x185a('0x21')](function(){return _0x166c33(null,_0x3beebd);});}}else{return utils[_0x185a('0x26')](_0x3beebd)['then'](function(){return _0x166c33(null,_0x3beebd);});}})['catch'](function(_0x2d18e9){return _0x166c33(null,![],_0x2d18e9);});}function handleError(_0x38d67f,_0x28bd9f,_0x183a68){return _0x38d67f['status'](_0x28bd9f||0x1f4)[_0x185a('0x27')]({'message':_0x183a68?_0x183a68[_0x185a('0x28')]||_0x183a68:''});}exports[_0x185a('0x29')]=function(_0x4c7869,_0x233652,_0x2cf117){passport[_0x185a('0x11')](_0x185a('0x2a'),function(_0x40e5a9,_0x105dae,_0x38f7be){var _0x4bac33=_0x40e5a9||_0x38f7be;if(_0x4bac33){return handleError(_0x233652,0x191,_0x4bac33);}if(!_0x105dae){return handleError(_0x233652,0x194,{'message':_0x185a('0x2b')});}else{var _0x313f27={'payload':{'id':_0x105dae['id'],'role':_0x105dae[_0x185a('0x2c')]},'options':{'expiresIn':0x15180}};return authService[_0x185a('0x2d')](_0x313f27)[_0x185a('0x21')](function(_0xebbe3f){_0x233652[_0x185a('0x2e')]({'id':_0x105dae['id'],'token':_0xebbe3f,'statusCall':'','isAlreadyLogged':_0x105dae['online']});});}})(_0x4c7869,_0x233652,_0x2cf117);};passport[_0x185a('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0x185a('0x17'),'passwordField':_0x185a('0x18')},function(_0x37a110,_0x21f2a4,_0x33646c){return ActiveDirectoryAuthenticate(db['User'],_0x37a110,_0x21f2a4,_0x33646c);})); \ No newline at end of file +var _0x7355=['role','json','online','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','Error\x20authenticate\x20%s:\x20%s','inspect','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','findOne','name','password','salt','blocked','blockedAt','admin','user','agent','then','disabled','add','getLicense','catch','send','message','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x2000c8,_0x4550cc){var _0x39e30c=function(_0x2d79a4){while(--_0x2d79a4){_0x2000c8['push'](_0x2000c8['shift']());}};_0x39e30c(++_0x4550cc);}(_0x7355,0x91));var _0x5735=function(_0x1035c3,_0x1072dc){_0x1035c3=_0x1035c3-0x0;var _0x2aeba6=_0x7355[_0x1035c3];return _0x2aeba6;};'use strict';var passport=require(_0x5735('0x0'));var LocalStrategy=require(_0x5735('0x1'))[_0x5735('0x2')];var moment=require(_0x5735('0x3'));var ActiveDirectory=require(_0x5735('0x4'));var BPromise=require(_0x5735('0x5'));var util=require('util');var db=require(_0x5735('0x6'))['db'];var authService=require(_0x5735('0x7'));var utils=require(_0x5735('0x8'));var config=require(_0x5735('0x9'));var logger=require(_0x5735('0xa'))(_0x5735('0xb'));function isActiveDirectoryConfigured(_0x2c1aa3){var _0x186b2a=![];if(typeof _0x2c1aa3[_0x5735('0xc')]!==_0x5735('0xd')){_0x186b2a=_0x2c1aa3[_0x5735('0xc')][_0x5735('0xe')]&&_0x2c1aa3[_0x5735('0xc')]['url']&&_0x2c1aa3['activedirectory'][_0x5735('0xf')];}return _0x186b2a;}function adAuthenticate(_0x391f7d,_0x1cd8dd,_0x257a8e){return new BPromise(function(_0x52967e,_0x38b5f3){try{var _0x5c9bd9=new ActiveDirectory(_0x391f7d);_0x5c9bd9['authenticate'](_0x1cd8dd,_0x257a8e,function(_0x520186,_0x51172a){if(_0x520186){logger['error'](_0x5735('0x10'),_0x1cd8dd,util[_0x5735('0x11')](_0x520186,{'showHidden':![],'depth':null}));_0x38b5f3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x51172a){logger[_0x5735('0x12')](_0x5735('0x13'),_0x1cd8dd);_0x38b5f3(_0x5735('0x14'));}else{_0x52967e(_0x51172a);}});}catch(_0x25f5d1){_0x38b5f3(_0x25f5d1);}});}function ActiveDirectoryAuthenticate(_0x377850,_0x1d4793,_0x2b5988,_0x12e200){var _0x295472,_0x184e0b;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x5735('0x15'),_0x1d4793);return _0x12e200(null,![],{'message':_0x5735('0x14')});}return db[_0x5735('0x16')]['findOne']({'where':{'id':0x1},'attributes':[_0x5735('0x17'),_0x5735('0x18')],'raw':!![]})['then'](function(_0x24314a){_0x295472=_0x24314a;if(!_0x295472[_0x5735('0x17')]){logger[_0x5735('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1d4793);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x377850[_0x5735('0x19')]({'attributes':['id',_0x5735('0x1a'),_0x5735('0x1b'),_0x5735('0x1c'),'role','disabled',_0x5735('0x1d'),_0x5735('0x1e'),'online'],'where':{'name':_0x1d4793,'role':{'$or':[_0x5735('0x1f'),_0x5735('0x20'),_0x5735('0x21')]},'adSsoEnabled':!![]}});})[_0x5735('0x22')](function(_0x1838eb){if(!_0x1838eb||_0x1838eb&&_0x1838eb['name']!==_0x1d4793){throw new Error(_0x5735('0x14'));}_0x184e0b=_0x1838eb;var _0x4b1242=_0x184e0b['name']+'@'+config[_0x5735('0xc')][_0x5735('0xf')];return adAuthenticate(config[_0x5735('0xc')],_0x4b1242,_0x2b5988);})[_0x5735('0x22')](function(_0x5d855a){if(_0x184e0b[_0x5735('0x23')]){throw new Error(_0x5735('0x14'));}if(_0x295472[_0x5735('0x18')]>0x0){if(_0x184e0b[_0x5735('0x1d')]){if(moment(_0x184e0b['blockedAt'])[_0x5735('0x24')](_0x295472[_0x5735('0x18')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x184e0b,0x0,![],null)['then'](function(){return utils[_0x5735('0x25')](_0x184e0b);})[_0x5735('0x22')](function(){return _0x12e200(null,_0x184e0b);});}else{return utils['getLicense'](_0x184e0b)[_0x5735('0x22')](function(){return _0x12e200(null,_0x184e0b);});}}else{return utils[_0x5735('0x25')](_0x184e0b)[_0x5735('0x22')](function(){return _0x12e200(null,_0x184e0b);});}})[_0x5735('0x26')](function(_0x315e1f){return _0x12e200(null,![],_0x315e1f);});}function handleError(_0x45f6b0,_0x37a04b,_0x384f53){return _0x45f6b0['status'](_0x37a04b||0x1f4)[_0x5735('0x27')]({'message':_0x384f53?_0x384f53[_0x5735('0x28')]||_0x384f53:''});}exports['login']=function(_0x185627,_0x11c6f6,_0x55c3e9){passport[_0x5735('0x29')]('ad-login',function(_0x1d70b2,_0x5dbf35,_0x552349){var _0x5bcf77=_0x1d70b2||_0x552349;if(_0x5bcf77){return handleError(_0x11c6f6,0x191,_0x5bcf77);}if(!_0x5dbf35){return handleError(_0x11c6f6,0x194,{'message':_0x5735('0x2a')});}else{var _0x5303af={'payload':{'id':_0x5dbf35['id'],'role':_0x5dbf35[_0x5735('0x2b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5303af)[_0x5735('0x22')](function(_0x8e2547){_0x11c6f6[_0x5735('0x2c')]({'id':_0x5dbf35['id'],'token':_0x8e2547,'statusCall':'','isAlreadyLogged':_0x5dbf35[_0x5735('0x2d')]});});}})(_0x185627,_0x11c6f6,_0x55c3e9);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x5735('0x1a'),'passwordField':_0x5735('0x1b')},function(_0x18e17f,_0x35fb01,_0x5a383a){return ActiveDirectoryAuthenticate(db[_0x5735('0x2e')],_0x18e17f,_0x35fb01,_0x5a383a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 47e8338..d55faba 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff0d=['exports','express','Router','./authActiveDirectory.controller'];(function(_0x3e4fbe,_0x1a550d){var _0x158ba5=function(_0x446f40){while(--_0x446f40){_0x3e4fbe['push'](_0x3e4fbe['shift']());}};_0x158ba5(++_0x1a550d);}(_0xff0d,0x1b5));var _0xdff0=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xff0d[_0x365e54];return _0x13317a;};'use strict';var express=require(_0xdff0('0x0'));var router=express[_0xdff0('0x1')]();var controller=require(_0xdff0('0x2'));router['post']('/',controller['login']);module[_0xdff0('0x3')]=router; \ No newline at end of file +var _0x81c3=['./authActiveDirectory.controller','post','exports','express'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x81c3,0x18b));var _0x381c=function(_0x5d9b60,_0x11579a){_0x5d9b60=_0x5d9b60-0x0;var _0x8b8632=_0x81c3[_0x5d9b60];return _0x8b8632;};'use strict';var express=require(_0x381c('0x0'));var router=express['Router']();var controller=require(_0x381c('0x1'));router[_0x381c('0x2')]('/',controller['login']);module[_0x381c('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index dd8c206..c730952 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x56accf,_0xe7b533){var _0x1770c8=function(_0x57798b){while(--_0x57798b){_0x56accf['push'](_0x56accf['shift']());}};_0x1770c8(++_0xe7b533);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x7a54,0x106));var _0x47a5=function(_0x26db4b,_0x314d28){_0x26db4b=_0x26db4b-0x0;var _0x1f64c9=_0x7a54[_0x26db4b];return _0x1f64c9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 48aa9cd..842fc58 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 _0x0677=['express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie'];(function(_0x56b352,_0x329a00){var _0x4c7f22=function(_0x3ab334){while(--_0x3ab334){_0x56b352['push'](_0x56b352['shift']());}};_0x4c7f22(++_0x329a00);}(_0x0677,0x105));var _0x7067=function(_0x4018d0,_0x10df66){_0x4018d0=_0x4018d0-0x0;var _0x229c58=_0x0677[_0x4018d0];return _0x229c58;};'use strict';var express=require(_0x7067('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x7067('0x1'));var userController=require(_0x7067('0x2'));var authService=require(_0x7067('0x3'));router[_0x7067('0x4')]('/',controller[_0x7067('0x5')]);router[_0x7067('0x4')](_0x7067('0x6'),controller['callback'],authService[_0x7067('0x7')],userController['login'],authService[_0x7067('0x8')]);module['exports']=router; \ No newline at end of file +var _0x9d5d=['login','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../../components/auth/service','get'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x9d5d,0x1bd));var _0xd9d5=function(_0x38ca9d,_0x3118ff){_0x38ca9d=_0x38ca9d-0x0;var _0x573132=_0x9d5d[_0x38ca9d];return _0x573132;};'use strict';var express=require(_0xd9d5('0x0'));var passport=require(_0xd9d5('0x1'));var router=express['Router']();var controller=require(_0xd9d5('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xd9d5('0x3'));router[_0xd9d5('0x4')]('/',controller[_0xd9d5('0x5')]);router['get']('/callback',controller['callback'],authService[_0xd9d5('0x6')],userController[_0xd9d5('0x5')],authService[_0xd9d5('0x7')]);module[_0xd9d5('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 23f2b12..787edd2 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 _0x5b97=['SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','use','util','passport','passport-local','Strategy','jayson/promise','moment','../../mysqldb','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','role','disabled','blockedAt','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','name','email','Smtp','CloudProvider','getSmtpOptions','merge','format','request'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x5b97,0x1d6));var _0x75b9=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x5b97[_0x2442b9];return _0x31b571;};'use strict';var util=require(_0x75b9('0x0'));var passport=require(_0x75b9('0x1'));var LocalStrategy=require(_0x75b9('0x2'))[_0x75b9('0x3')];var jayson=require(_0x75b9('0x4'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x75b9('0x5'));var db=require(_0x75b9('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x75b9('0x7')][_0x75b9('0x8')]({'port':0x232b});function localAuthenticate(_0x10faca,_0x24ce05,_0x40e514,_0x4d5fec){var _0x202161,_0x1e2c39;return db[_0x75b9('0x9')][_0x75b9('0xa')]({'where':{'id':0x1},'attributes':[_0x75b9('0xb'),_0x75b9('0xc')],'raw':!![]})['then'](function(_0x2c9ce4){_0x202161=_0x2c9ce4;return _0x10faca[_0x75b9('0xa')]({'attributes':['id','name',_0x75b9('0xd'),_0x75b9('0xe'),_0x75b9('0xf'),_0x75b9('0x10'),'blocked',_0x75b9('0x11'),'loginAttempts'],'where':{'name':_0x24ce05,'role':{'$or':[_0x75b9('0x12'),_0x75b9('0x13'),_0x75b9('0x14')]}}});})[_0x75b9('0x15')](function(_0x5d69a3){if(!_0x5d69a3||_0x5d69a3&&_0x5d69a3['name']!==_0x24ce05){throw new Error(_0x75b9('0x16'));}else{_0x1e2c39=_0x5d69a3;return _0x1e2c39;}})[_0x75b9('0x15')](function(){_0x1e2c39['authenticate'](_0x40e514,function(_0x41a9cc,_0x21f536){var _0x7fe96b=_0x1e2c39[_0x75b9('0x17')]+0x1;if(_0x41a9cc){return _0x4d5fec(_0x41a9cc);}else if(!_0x21f536){if(_0x1e2c39[_0x75b9('0x10')]){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});}else if(_0x202161[_0x75b9('0xb')]>0x0){if(_0x1e2c39[_0x75b9('0x18')]){if(_0x202161['blockDuration']>0x0){if(moment(_0x1e2c39[_0x75b9('0x11')])[_0x75b9('0x19')](_0x202161[_0x75b9('0xc')],_0x75b9('0x1a'))>moment()){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});}else{return utils['clearBlockUser'](_0x1e2c39,_0x7fe96b,![],null)[_0x75b9('0x15')](function(){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});});}}else{return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});}}else{if(_0x7fe96b>=_0x202161['allowedLoginAttempts']){return utils['clearBlockUser'](_0x1e2c39,0x0,!![],moment())[_0x75b9('0x15')](function(){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});});}else{return utils[_0x75b9('0x1b')](_0x1e2c39,_0x7fe96b,![],null)[_0x75b9('0x15')](function(){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});});}}}else{return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});}}else{if(_0x1e2c39[_0x75b9('0x10')]){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});}else if(_0x202161[_0x75b9('0xb')]>0x0){if(_0x1e2c39[_0x75b9('0x18')]){if(_0x202161[_0x75b9('0xc')]>0x0){if(moment(_0x1e2c39[_0x75b9('0x11')])[_0x75b9('0x19')](_0x202161[_0x75b9('0xc')],_0x75b9('0x1a'))>moment()){return _0x4d5fec(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x75b9('0x1b')](_0x1e2c39,0x0,![],null)['then'](function(){return utils[_0x75b9('0x1c')](_0x1e2c39);})[_0x75b9('0x15')](function(){return _0x4d5fec(null,_0x1e2c39);});}}else{return _0x4d5fec(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x75b9('0x1b')](_0x1e2c39,0x0,![],null)[_0x75b9('0x15')](function(){return utils[_0x75b9('0x1c')](_0x1e2c39);})['then'](function(){return _0x4d5fec(null,_0x1e2c39);})[_0x75b9('0x1d')](function(_0x26e4fc){return _0x4d5fec(null,![],_0x26e4fc);});}}else{if(_0x1e2c39[_0x75b9('0x18')]){return _0x4d5fec(null,![],{'message':_0x75b9('0x16')});}else{return utils[_0x75b9('0x1c')](_0x1e2c39)[_0x75b9('0x15')](function(){return _0x4d5fec(null,_0x1e2c39);});}}}});})['catch'](function(_0x3789f7){return _0x4d5fec(null,![],_0x3789f7);});}function sendServiceMail(_0x43d2f0){return db[_0x75b9('0x1e')][_0x75b9('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x75b9('0x20'),_0x75b9('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x75b9('0x22'),'include':[{'model':db[_0x75b9('0x23')],'as':_0x75b9('0x23')}]}]})['then'](function(_0x2fc919){if(!_0x2fc919){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x134812=_0x2fc919[_0x75b9('0x24')]();var _0x5889e1={'account':_0x134812,'message':_[_0x75b9('0x25')]({'from':util[_0x75b9('0x26')]('\x22%s\x22\x20<%s>',_0x2fc919[_0x75b9('0x20')],_0x2fc919['email']||_0x2fc919[_0x75b9('0x22')][_0x75b9('0x13')])},_0x43d2f0)};return client[_0x75b9('0x27')](_0x75b9('0x28'),_0x5889e1);})[_0x75b9('0x15')](function(_0x3ad13e){if(_0x3ad13e[_0x75b9('0x29')]){throw new Error(util['format'](_0x75b9('0x2a'),_0x3ad13e[_0x75b9('0x29')][_0x75b9('0x2b')]||JSON[_0x75b9('0x2c')](_0x3ad13e[_0x75b9('0x29')])));}return!![];});}function handleError(_0x17f8e3,_0x3f115f,_0x54a3cd){return _0x17f8e3['status'](_0x3f115f||0x1f4)[_0x75b9('0x2d')]({'message':_0x54a3cd?_0x54a3cd['message']||_0x54a3cd:''});}exports['login']=function(_0x3ada18,_0x2e42a8,_0x56b626){passport[_0x75b9('0x2e')](_0x75b9('0x2f'),function(_0x5eb7fa,_0x466533,_0x59c8a9){var _0x385141=_0x5eb7fa||_0x59c8a9;if(_0x385141){return handleError(_0x2e42a8,0x191,_0x385141);}if(!_0x466533){return handleError(_0x2e42a8,0x194,{'message':_0x75b9('0x30')});}else{var _0x30f30e={'payload':{'id':_0x466533['id'],'role':_0x466533[_0x75b9('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x75b9('0x31')](_0x30f30e)['then'](function(_0x1a1c09){_0x2e42a8[_0x75b9('0x32')]({'id':_0x466533['id'],'token':_0x1a1c09,'statusCall':'','isAlreadyLogged':_0x466533[_0x75b9('0x33')]});});}})(_0x3ada18,_0x2e42a8,_0x56b626);};exports[_0x75b9('0x34')]=function(_0x7c1d0f,_0x3df744){if(!_0x7c1d0f['body'][_0x75b9('0x21')]){return handleError(_0x3df744,0x1f4,{'message':_0x75b9('0x35')});}var _0x3b6c25=rs[_0x75b9('0x36')]();_0x7c1d0f[_0x75b9('0x37')][_0x75b9('0x21')]=_0x7c1d0f[_0x75b9('0x37')]['email'][_0x75b9('0x38')]()[_0x75b9('0x39')]();var _0x4e4c93;return db['Setting'][_0x75b9('0xa')]({'where':{'id':0x1},'attributes':[_0x75b9('0xb'),_0x75b9('0xc')],'raw':!![]})[_0x75b9('0x15')](function(_0x11f822){_0x4e4c93=_0x11f822;return db[_0x75b9('0x3a')][_0x75b9('0x1f')]({'where':{'email':_0x7c1d0f[_0x75b9('0x37')][_0x75b9('0x21')]}});})['then'](function(_0x638c80){if(!_0x638c80){throw new Error(_0x75b9('0x3b'));}if(_0x638c80[_0x75b9('0x10')]){throw new Error(_0x75b9('0x3c'));}if(_0x638c80[_0x75b9('0x18')]){if(moment(_0x638c80[_0x75b9('0x11')])[_0x75b9('0x19')](_0x4e4c93[_0x75b9('0xc')],_0x75b9('0x1a'))>moment()){throw new Error(_0x75b9('0x3d'));}else{_0x638c80[_0x75b9('0x18')]=![];_0x638c80[_0x75b9('0x11')]=null;}}_0x638c80[_0x75b9('0x3e')]=_0x3b6c25;_0x638c80['resetPasswordExpires']=Date[_0x75b9('0x3f')]()+0x36ee80;return _0x638c80[_0x75b9('0x40')]();})[_0x75b9('0x15')](function(){return sendServiceMail({'to':_0x7c1d0f['body'][_0x75b9('0x21')],'subject':_0x75b9('0x41'),'text':_0x75b9('0x42')+_0x75b9('0x43')+_0x75b9('0x44')+_0x7c1d0f[_0x75b9('0x45')][_0x75b9('0x46')]+_0x75b9('0x47')+_0x3b6c25+'\x0a\x0a'+_0x75b9('0x48')});})[_0x75b9('0x15')](function(){_0x3df744[_0x75b9('0x49')](0xc8)[_0x75b9('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0x75b9('0x1d')](function(_0x437d22){return handleError(_0x3df744,0x1f4,_0x437d22);});};exports[_0x75b9('0x4a')]=function(_0x240711,_0x208629){return db['User'][_0x75b9('0x1f')]({'where':{'resetPasswordToken':_0x240711[_0x75b9('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date[_0x75b9('0x3f')]()}}})[_0x75b9('0x15')](function(_0x236dab){if(!_0x236dab){throw new Error(_0x75b9('0x4c'));}return db[_0x75b9('0x9')]['findOne']({'attributes':['id',_0x75b9('0x4d'),_0x75b9('0x4e'),_0x75b9('0x4f')]})[_0x75b9('0x15')](function(_0x55cc5e){if(_0x55cc5e[_0x75b9('0x4d')])authService[_0x75b9('0x50')](_0x240711[_0x75b9('0x37')][_0x75b9('0xd')]);if(!_0x55cc5e[_0x75b9('0x4e')]||!_0x236dab[_0x75b9('0x51')])return _0x236dab;authService[_0x75b9('0x52')](_0x240711[_0x75b9('0x37')][_0x75b9('0xd')],_0x236dab[_0x75b9('0x51')],_0x55cc5e['passwordHistoryLimit']);return _0x236dab;})[_0x75b9('0x15')](function(){_0x236dab[_0x75b9('0xd')]=_0x240711['body'][_0x75b9('0xd')];_0x236dab[_0x75b9('0x3e')]=null;_0x236dab[_0x75b9('0x53')]=null;return _0x236dab['save']();});})[_0x75b9('0x15')](function(){_0x208629[_0x75b9('0x49')](0xc8)[_0x75b9('0x2d')]({'message':'Password\x20reset!'});})[_0x75b9('0x1d')](function(_0x1d473b){return handleError(_0x208629,0x1f4,_0x1d473b);});};passport[_0x75b9('0x54')](_0x75b9('0x2f'),new LocalStrategy({'usernameField':_0x75b9('0x20'),'passwordField':_0x75b9('0xd')},function(_0x286f6e,_0x1884b9,_0xa7d257){return localAuthenticate(db[_0x75b9('0x3a')],_0x286f6e,_0x1884b9,_0xa7d257);})); \ No newline at end of file +var _0x94e1=['body','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','allowedLoginAttempts','blockDuration','findOne','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','then','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','status','send','local-login','signToken','forgot','generate'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x94e1,0x1e1));var _0x194e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94e1[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x194e('0x0'));var passport=require(_0x194e('0x1'));var LocalStrategy=require(_0x194e('0x2'))[_0x194e('0x3')];var jayson=require(_0x194e('0x4'));var _=require(_0x194e('0x5'));var rs=require(_0x194e('0x6'));var moment=require(_0x194e('0x7'));var db=require(_0x194e('0x8'))['db'];var authService=require(_0x194e('0x9'));var utils=require('../../config/utils');var client=jayson[_0x194e('0xa')]['http']({'port':0x232b});function localAuthenticate(_0xebafa0,_0x118a27,_0x51c941,_0x3d99cd){var _0x56007b,_0x3c065a;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x194e('0xb'),_0x194e('0xc')],'raw':!![]})['then'](function(_0x1d647b){_0x56007b=_0x1d647b;return _0xebafa0[_0x194e('0xd')]({'attributes':['id',_0x194e('0xe'),_0x194e('0xf'),'salt',_0x194e('0x10'),_0x194e('0x11'),_0x194e('0x12'),_0x194e('0x13'),_0x194e('0x14')],'where':{'name':_0x118a27,'role':{'$or':[_0x194e('0x15'),_0x194e('0x16'),'agent']}}});})['then'](function(_0xcb40f4){if(!_0xcb40f4||_0xcb40f4&&_0xcb40f4[_0x194e('0xe')]!==_0x118a27){throw new Error(_0x194e('0x17'));}else{_0x3c065a=_0xcb40f4;return _0x3c065a;}})['then'](function(){_0x3c065a[_0x194e('0x18')](_0x51c941,function(_0x5adcf8,_0x2f26a1){var _0x131b15=_0x3c065a[_0x194e('0x14')]+0x1;if(_0x5adcf8){return _0x3d99cd(_0x5adcf8);}else if(!_0x2f26a1){if(_0x3c065a[_0x194e('0x11')]){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else if(_0x56007b[_0x194e('0xb')]>0x0){if(_0x3c065a[_0x194e('0x12')]){if(_0x56007b[_0x194e('0xc')]>0x0){if(moment(_0x3c065a[_0x194e('0x13')])['add'](_0x56007b['blockDuration'],_0x194e('0x19'))>moment()){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else{return utils[_0x194e('0x1a')](_0x3c065a,_0x131b15,![],null)['then'](function(){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});});}}else{return _0x3d99cd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x131b15>=_0x56007b[_0x194e('0xb')]){return utils[_0x194e('0x1a')](_0x3c065a,0x0,!![],moment())[_0x194e('0x1b')](function(){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});});}else{return utils[_0x194e('0x1a')](_0x3c065a,_0x131b15,![],null)[_0x194e('0x1b')](function(){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});});}}}else{return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}}else{if(_0x3c065a[_0x194e('0x11')]){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else if(_0x56007b[_0x194e('0xb')]>0x0){if(_0x3c065a[_0x194e('0x12')]){if(_0x56007b[_0x194e('0xc')]>0x0){if(moment(_0x3c065a[_0x194e('0x13')])[_0x194e('0x1c')](_0x56007b['blockDuration'],'minutes')>moment()){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else{return utils[_0x194e('0x1a')](_0x3c065a,0x0,![],null)[_0x194e('0x1b')](function(){return utils[_0x194e('0x1d')](_0x3c065a);})['then'](function(){return _0x3d99cd(null,_0x3c065a);});}}else{return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}}else{return utils['clearBlockUser'](_0x3c065a,0x0,![],null)[_0x194e('0x1b')](function(){return utils[_0x194e('0x1d')](_0x3c065a);})['then'](function(){return _0x3d99cd(null,_0x3c065a);})[_0x194e('0x1e')](function(_0x30fae9){return _0x3d99cd(null,![],_0x30fae9);});}}else{if(_0x3c065a[_0x194e('0x12')]){return _0x3d99cd(null,![],{'message':_0x194e('0x17')});}else{return utils[_0x194e('0x1d')](_0x3c065a)[_0x194e('0x1b')](function(){return _0x3d99cd(null,_0x3c065a);});}}}});})[_0x194e('0x1e')](function(_0x271c23){return _0x3d99cd(null,![],_0x271c23);});}function sendServiceMail(_0x250a37){return db['MailAccount'][_0x194e('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x194e('0xe'),_0x194e('0x20')],'include':[{'model':db[_0x194e('0x21')],'as':_0x194e('0x22'),'include':[{'model':db[_0x194e('0x23')],'as':'CloudProvider'}]}]})[_0x194e('0x1b')](function(_0x1871f5){if(!_0x1871f5){throw new Error(_0x194e('0x24'));}var _0x14c06c=_0x1871f5[_0x194e('0x25')]();var _0x572753={'account':_0x14c06c,'message':_['merge']({'from':util[_0x194e('0x26')](_0x194e('0x27'),_0x1871f5[_0x194e('0xe')],_0x1871f5[_0x194e('0x20')]||_0x1871f5[_0x194e('0x22')][_0x194e('0x16')])},_0x250a37)};return client[_0x194e('0x28')](_0x194e('0x29'),_0x572753);})[_0x194e('0x1b')](function(_0x1b4a09){if(_0x1b4a09['error']){throw new Error(util[_0x194e('0x26')](_0x194e('0x2a'),_0x1b4a09[_0x194e('0x2b')][_0x194e('0x2c')]||JSON['stringify'](_0x1b4a09['error'])));}return!![];});}function handleError(_0x2e10f5,_0x3a1c49,_0x3c4e79){return _0x2e10f5[_0x194e('0x2d')](_0x3a1c49||0x1f4)[_0x194e('0x2e')]({'message':_0x3c4e79?_0x3c4e79['message']||_0x3c4e79:''});}exports['login']=function(_0x4d50b3,_0x4cca9b,_0x25add5){passport[_0x194e('0x18')](_0x194e('0x2f'),function(_0x2e69d5,_0x590292,_0x25d138){var _0x1565de=_0x2e69d5||_0x25d138;if(_0x1565de){return handleError(_0x4cca9b,0x191,_0x1565de);}if(!_0x590292){return handleError(_0x4cca9b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x117a1b={'payload':{'id':_0x590292['id'],'role':_0x590292[_0x194e('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x194e('0x30')](_0x117a1b)[_0x194e('0x1b')](function(_0xc3c53e){_0x4cca9b['json']({'id':_0x590292['id'],'token':_0xc3c53e,'statusCall':'','isAlreadyLogged':_0x590292['online']});});}})(_0x4d50b3,_0x4cca9b,_0x25add5);};exports[_0x194e('0x31')]=function(_0x30c2a9,_0x2c54b5){if(!_0x30c2a9['body'][_0x194e('0x20')]){return handleError(_0x2c54b5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1abdf9=rs[_0x194e('0x32')]();_0x30c2a9['body'][_0x194e('0x20')]=_0x30c2a9[_0x194e('0x33')][_0x194e('0x20')]['trim']()[_0x194e('0x34')]();var _0x3f2e26;return db[_0x194e('0x35')][_0x194e('0xd')]({'where':{'id':0x1},'attributes':[_0x194e('0xb'),_0x194e('0xc')],'raw':!![]})[_0x194e('0x1b')](function(_0x5ad9ba){_0x3f2e26=_0x5ad9ba;return db[_0x194e('0x36')][_0x194e('0x1f')]({'where':{'email':_0x30c2a9[_0x194e('0x33')][_0x194e('0x20')]}});})[_0x194e('0x1b')](function(_0x33b01b){if(!_0x33b01b){throw new Error(_0x194e('0x37'));}if(_0x33b01b[_0x194e('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x33b01b['blocked']){if(moment(_0x33b01b[_0x194e('0x13')])['add'](_0x3f2e26['blockDuration'],_0x194e('0x19'))>moment()){throw new Error(_0x194e('0x38'));}else{_0x33b01b[_0x194e('0x12')]=![];_0x33b01b['blockedAt']=null;}}_0x33b01b['resetPasswordToken']=_0x1abdf9;_0x33b01b[_0x194e('0x39')]=Date[_0x194e('0x3a')]()+0x36ee80;return _0x33b01b[_0x194e('0x3b')]();})[_0x194e('0x1b')](function(){return sendServiceMail({'to':_0x30c2a9[_0x194e('0x33')][_0x194e('0x20')],'subject':_0x194e('0x3c'),'text':_0x194e('0x3d')+_0x194e('0x3e')+_0x194e('0x3f')+_0x30c2a9['headers']['host']+_0x194e('0x40')+_0x1abdf9+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x194e('0x1b')](function(){_0x2c54b5['status'](0xc8)[_0x194e('0x2e')]({'message':_0x194e('0x41')});})['catch'](function(_0x474dd1){return handleError(_0x2c54b5,0x1f4,_0x474dd1);});};exports['reset']=function(_0x12e97b,_0x526790){return db[_0x194e('0x36')]['find']({'where':{'resetPasswordToken':_0x12e97b[_0x194e('0x42')][_0x194e('0x43')],'resetPasswordExpires':{'$gt':Date[_0x194e('0x3a')]()}}})[_0x194e('0x1b')](function(_0x1aad56){if(!_0x1aad56){throw new Error(_0x194e('0x44'));}return db[_0x194e('0x35')][_0x194e('0xd')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x194e('0x45')]})[_0x194e('0x1b')](function(_0x190443){if(_0x190443[_0x194e('0x46')])authService[_0x194e('0x47')](_0x12e97b[_0x194e('0x33')][_0x194e('0xf')]);if(!_0x190443[_0x194e('0x48')]||!_0x1aad56[_0x194e('0x49')])return _0x1aad56;authService['validatePasswordHistory'](_0x12e97b[_0x194e('0x33')][_0x194e('0xf')],_0x1aad56[_0x194e('0x49')],_0x190443[_0x194e('0x45')]);return _0x1aad56;})['then'](function(){_0x1aad56[_0x194e('0xf')]=_0x12e97b[_0x194e('0x33')][_0x194e('0xf')];_0x1aad56['resetPasswordToken']=null;_0x1aad56['resetPasswordExpires']=null;return _0x1aad56[_0x194e('0x3b')]();});})['then'](function(){_0x526790[_0x194e('0x2d')](0xc8)[_0x194e('0x2e')]({'message':_0x194e('0x4a')});})[_0x194e('0x1e')](function(_0x369310){return handleError(_0x526790,0x1f4,_0x369310);});};passport[_0x194e('0x4b')](_0x194e('0x2f'),new LocalStrategy({'usernameField':_0x194e('0xe'),'passwordField':_0x194e('0xf')},function(_0x57b09c,_0x7c3dd0,_0x1ae8a0){return localAuthenticate(db['User'],_0x57b09c,_0x7c3dd0,_0x1ae8a0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a999974..93efb4b 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 _0x171e=['post','login','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0xd8e9f5,_0x29df60){var _0x4b915e=function(_0xb395cb){while(--_0xb395cb){_0xd8e9f5['push'](_0xd8e9f5['shift']());}};_0x4b915e(++_0x29df60);}(_0x171e,0x1c8));var _0xe171=function(_0x2cb521,_0x14f3f1){_0x2cb521=_0x2cb521-0x0;var _0x2db33e=_0x171e[_0x2cb521];return _0x2db33e;};'use strict';var express=require(_0xe171('0x0'));var router=express[_0xe171('0x1')]();var controller=require(_0xe171('0x2'));router[_0xe171('0x3')]('/',controller[_0xe171('0x4')]);router['post'](_0xe171('0x5'),controller[_0xe171('0x6')]);router[_0xe171('0x3')](_0xe171('0x7'),controller[_0xe171('0x8')]);module['exports']=router; \ No newline at end of file +var _0xd335=['/reset/:token','exports','express','Router','login','post','/forgot','forgot'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xd335,0x19a));var _0x5d33=function(_0x229b9e,_0x4e863a){_0x229b9e=_0x229b9e-0x0;var _0x3ae42d=_0xd335[_0x229b9e];return _0x3ae42d;};'use strict';var express=require(_0x5d33('0x0'));var router=express[_0x5d33('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x5d33('0x2')]);router[_0x5d33('0x3')](_0x5d33('0x4'),controller[_0x5d33('0x5')]);router[_0x5d33('0x3')](_0x5d33('0x6'),controller['reset']);module[_0x5d33('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 039d5eb..34246f7 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 _0x63bd=['INTEGER','STRING','BOOLEAN'];(function(_0x48d7ca,_0x2a0874){var _0x39caf9=function(_0x2fc780){while(--_0x2fc780){_0x48d7ca['push'](_0x48d7ca['shift']());}};_0x39caf9(++_0x2a0874);}(_0x63bd,0x181));var _0xd63b=function(_0x427174,_0x4334ea){_0x427174=_0x427174-0x0;var _0x32775a=_0x63bd[_0x427174];return _0x32775a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xd63b('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd63b('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd63b('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x062a=['INTEGER','STRING'];(function(_0x3fd7ab,_0x3dd0bc){var _0x56cb4b=function(_0x2cd862){while(--_0x2cd862){_0x3fd7ab['push'](_0x3fd7ab['shift']());}};_0x56cb4b(++_0x3dd0bc);}(_0x062a,0x16b));var _0xa062=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x062a[_0x1ed116];return _0x574066;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa062('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xa062('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa062('0x1')],'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 7c3d506..cdcd911 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 _0x5fdc=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','count','includeAll','include','rows','show','params','create','body','catch','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','find','getActions','rimraf','zip-dir','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','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','type','key','map','query','keys','filters','model'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5fdc,0x121));var _0xc5fd=function(_0x569d33,_0x161576){_0x569d33=_0x569d33-0x0;var _0x3bab14=_0x5fdc[_0x569d33];return _0x3bab14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5fd('0x0'));var zipdir=require(_0xc5fd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5fd('0x2'));var moment=require(_0xc5fd('0x3'));var BPromise=require(_0xc5fd('0x4'));var Mustache=require(_0xc5fd('0x5'));var util=require(_0xc5fd('0x6'));var path=require(_0xc5fd('0x7'));var sox=require(_0xc5fd('0x8'));var csv=require(_0xc5fd('0x9'));var ejs=require(_0xc5fd('0xa'));var fs=require('fs');var fs_extra=require(_0xc5fd('0xb'));var _=require('lodash');var squel=require(_0xc5fd('0xc'));var crypto=require(_0xc5fd('0xd'));var jsforce=require(_0xc5fd('0xe'));var deskjs=require(_0xc5fd('0xf'));var toCsv=require(_0xc5fd('0x9'));var querystring=require(_0xc5fd('0x10'));var Papa=require(_0xc5fd('0x11'));var Redis=require(_0xc5fd('0x12'));var authService=require(_0xc5fd('0x13'));var qs=require(_0xc5fd('0x14'));var as=require(_0xc5fd('0x15'));var hardwareService=require(_0xc5fd('0x16'));var logger=require(_0xc5fd('0x17'))('api');var utils=require(_0xc5fd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc5fd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3de768,_0x248a96){_0x248a96=_0x248a96||0xcc;return function(_0x5f0b83){if(_0x5f0b83){return _0x3de768[_0xc5fd('0x1a')](_0x248a96);}return _0x3de768[_0xc5fd('0x1b')](_0x248a96)['end']();};}function respondWithResult(_0x143551,_0x18d96f){_0x18d96f=_0x18d96f||0xc8;return function(_0x319eb5){if(_0x319eb5){return _0x143551[_0xc5fd('0x1b')](_0x18d96f)[_0xc5fd('0x1c')](_0x319eb5);}};}function respondWithFilteredResult(_0x3b7f09,_0x1c5835){return function(_0x3c07c1){if(_0x3c07c1){var _0x11a104=typeof _0x1c5835[_0xc5fd('0x1d')]===_0xc5fd('0x1e')&&typeof _0x1c5835[_0xc5fd('0x1f')]===_0xc5fd('0x1e');var _0x2aeb31=_0x3c07c1['count'];var _0x3f393b=_0x11a104?0x0:_0x1c5835['offset'];var _0x1cd1f7=_0x11a104?_0x3c07c1['count']:_0x1c5835[_0xc5fd('0x1d')]+_0x1c5835[_0xc5fd('0x1f')];var _0x23f654;if(_0x1cd1f7>=_0x2aeb31){_0x1cd1f7=_0x2aeb31;_0x23f654=0xc8;}else{_0x23f654=0xce;}_0x3b7f09[_0xc5fd('0x1b')](_0x23f654);return _0x3b7f09['set']('Content-Range',_0x3f393b+'-'+_0x1cd1f7+'/'+_0x2aeb31)[_0xc5fd('0x1c')](_0x3c07c1);}return null;};}function patchUpdates(_0x1b91ee){return function(_0x577c2c){try{jsonpatch[_0xc5fd('0x20')](_0x577c2c,_0x1b91ee,!![]);}catch(_0x22de03){return BPromise[_0xc5fd('0x21')](_0x22de03);}return _0x577c2c[_0xc5fd('0x22')]();};}function saveUpdates(_0x5e08ab,_0x42acf0){return function(_0x56f29a){if(_0x56f29a){return _0x56f29a[_0xc5fd('0x23')](_0x5e08ab)['then'](function(_0x59dabb){return _0x59dabb;});}return null;};}function removeEntity(_0x44bcca,_0x6dff8){return function(_0x3f6850){if(_0x3f6850){return _0x3f6850[_0xc5fd('0x24')]()[_0xc5fd('0x25')](function(){_0x44bcca[_0xc5fd('0x1b')](0xcc)[_0xc5fd('0x26')]();});}};}function handleEntityNotFound(_0x3bb30e,_0x1e1ca){return function(_0x332816){if(!_0x332816){_0x3bb30e[_0xc5fd('0x1a')](0x194);}return _0x332816;};}function handleError(_0x2c59b3,_0x206a37){_0x206a37=_0x206a37||0x1f4;return function(_0x506525){logger[_0xc5fd('0x27')](_0x506525[_0xc5fd('0x28')]);if(_0x506525[_0xc5fd('0x29')]){delete _0x506525[_0xc5fd('0x29')];}_0x2c59b3['status'](_0x206a37)[_0xc5fd('0x2a')](_0x506525);};}exports['index']=function(_0x1bfc86,_0x3e9c13){var _0x3018a8={},_0x211ffe={},_0x2cc442={'count':0x0,'rows':[]};var _0x13e84d=_['map'](db['Automation'][_0xc5fd('0x2b')],function(_0x235397){return{'name':_0x235397['fieldName'],'type':_0x235397[_0xc5fd('0x2c')][_0xc5fd('0x2d')]};});_0x211ffe['model']=_[_0xc5fd('0x2e')](_0x13e84d,_0xc5fd('0x29'));_0x211ffe[_0xc5fd('0x2f')]=_[_0xc5fd('0x30')](_0x1bfc86[_0xc5fd('0x2f')]);_0x211ffe[_0xc5fd('0x31')]=_['intersection'](_0x211ffe[_0xc5fd('0x32')],_0x211ffe[_0xc5fd('0x2f')]);_0x3018a8[_0xc5fd('0x33')]=_[_0xc5fd('0x34')](_0x211ffe[_0xc5fd('0x32')],qs[_0xc5fd('0x35')](_0x1bfc86[_0xc5fd('0x2f')][_0xc5fd('0x35')]));_0x3018a8[_0xc5fd('0x33')]=_0x3018a8[_0xc5fd('0x33')][_0xc5fd('0x36')]?_0x3018a8[_0xc5fd('0x33')]:_0x211ffe[_0xc5fd('0x32')];if(!_0x1bfc86[_0xc5fd('0x2f')][_0xc5fd('0x37')]('nolimit')){_0x3018a8[_0xc5fd('0x1f')]=qs[_0xc5fd('0x1f')](_0x1bfc86['query'][_0xc5fd('0x1f')]);_0x3018a8['offset']=qs[_0xc5fd('0x1d')](_0x1bfc86[_0xc5fd('0x2f')][_0xc5fd('0x1d')]);}_0x3018a8[_0xc5fd('0x38')]=qs['sort'](_0x1bfc86['query'][_0xc5fd('0x39')]);_0x3018a8[_0xc5fd('0x3a')]=qs[_0xc5fd('0x31')](_[_0xc5fd('0x3b')](_0x1bfc86[_0xc5fd('0x2f')],_0x211ffe['filters']),_0x13e84d);if(_0x1bfc86[_0xc5fd('0x2f')][_0xc5fd('0x3c')]){_0x3018a8[_0xc5fd('0x3a')]=_[_0xc5fd('0x3d')](_0x3018a8[_0xc5fd('0x3a')],{'$or':_[_0xc5fd('0x2e')](_0x13e84d,function(_0x5a27ad){if(_0x5a27ad[_0xc5fd('0x2c')]!==_0xc5fd('0x3e')){var _0x28deee={};_0x28deee[_0x5a27ad[_0xc5fd('0x29')]]={'$like':'%'+_0x1bfc86['query'][_0xc5fd('0x3c')]+'%'};return _0x28deee;}})});}_0x3018a8=_[_0xc5fd('0x3d')]({},_0x3018a8,_0x1bfc86[_0xc5fd('0x3f')]);var _0x57b07a={'where':_0x3018a8[_0xc5fd('0x3a')]};return db[_0xc5fd('0x40')][_0xc5fd('0x41')](_0x57b07a)[_0xc5fd('0x25')](function(_0x581640){_0x2cc442[_0xc5fd('0x41')]=_0x581640;if(_0x1bfc86[_0xc5fd('0x2f')][_0xc5fd('0x42')]){_0x3018a8[_0xc5fd('0x43')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x3018a8);})[_0xc5fd('0x25')](function(_0x5e0291){_0x2cc442[_0xc5fd('0x44')]=_0x5e0291;return _0x2cc442;})[_0xc5fd('0x25')](respondWithFilteredResult(_0x3e9c13,_0x3018a8))['catch'](handleError(_0x3e9c13,null));};exports[_0xc5fd('0x45')]=function(_0xbc999c,_0x4f8868){var _0xefe27a={'raw':![],'where':{'id':_0xbc999c[_0xc5fd('0x46')]['id']}},_0x5e5423={};_0x5e5423[_0xc5fd('0x32')]=_[_0xc5fd('0x30')](db[_0xc5fd('0x40')][_0xc5fd('0x2b')]);_0x5e5423[_0xc5fd('0x2f')]=_[_0xc5fd('0x30')](_0xbc999c[_0xc5fd('0x2f')]);_0x5e5423['filters']=_['intersection'](_0x5e5423['model'],_0x5e5423[_0xc5fd('0x2f')]);_0xefe27a[_0xc5fd('0x33')]=_[_0xc5fd('0x34')](_0x5e5423[_0xc5fd('0x32')],qs[_0xc5fd('0x35')](_0xbc999c[_0xc5fd('0x2f')][_0xc5fd('0x35')]));_0xefe27a[_0xc5fd('0x33')]=_0xefe27a[_0xc5fd('0x33')][_0xc5fd('0x36')]?_0xefe27a[_0xc5fd('0x33')]:_0x5e5423[_0xc5fd('0x32')];if(_0xbc999c[_0xc5fd('0x2f')][_0xc5fd('0x42')]){_0xefe27a[_0xc5fd('0x43')]=[{'all':!![]}];}_0xefe27a=_[_0xc5fd('0x3d')]({},_0xefe27a,_0xbc999c[_0xc5fd('0x3f')]);return db[_0xc5fd('0x40')]['find'](_0xefe27a)['then'](handleEntityNotFound(_0x4f8868,null))['then'](respondWithResult(_0x4f8868,null))['catch'](handleError(_0x4f8868,null));};exports[_0xc5fd('0x47')]=function(_0x22230b,_0x288a89){return db[_0xc5fd('0x40')][_0xc5fd('0x47')](_0x22230b[_0xc5fd('0x48')],{})[_0xc5fd('0x25')](respondWithResult(_0x288a89,0xc9))[_0xc5fd('0x49')](handleError(_0x288a89,null));};exports[_0xc5fd('0x23')]=function(_0x3c47e4,_0x2ac430){if(_0x3c47e4[_0xc5fd('0x48')]['id']){delete _0x3c47e4[_0xc5fd('0x48')]['id'];}return db['Automation']['find']({'where':{'id':_0x3c47e4[_0xc5fd('0x46')]['id']}})[_0xc5fd('0x25')](handleEntityNotFound(_0x2ac430,null))[_0xc5fd('0x25')](saveUpdates(_0x3c47e4[_0xc5fd('0x48')],null))[_0xc5fd('0x25')](respondWithResult(_0x2ac430,null))[_0xc5fd('0x49')](handleError(_0x2ac430,null));};exports[_0xc5fd('0x24')]=function(_0x28df45,_0xf640f5){return db['Automation']['find']({'where':{'id':_0x28df45[_0xc5fd('0x46')]['id']}})['then'](handleEntityNotFound(_0xf640f5,null))[_0xc5fd('0x25')](removeEntity(_0xf640f5,null))[_0xc5fd('0x49')](handleError(_0xf640f5,null));};exports[_0xc5fd('0x4a')]=function(_0xc2237e,_0x263501,_0x58774b){return db[_0xc5fd('0x4b')]['find']({'where':{'id':_0xc2237e[_0xc5fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x263501,null))[_0xc5fd('0x25')](function(_0x292f5b){if(_0x292f5b){return _0x292f5b[_0xc5fd('0x4a')](_0xc2237e[_0xc5fd('0x48')][_0xc5fd('0x4c')],_[_0xc5fd('0x4d')](_0xc2237e[_0xc5fd('0x48')],[_0xc5fd('0x4c'),'id'])||{});}})[_0xc5fd('0x25')](respondWithResult(_0x263501,null))[_0xc5fd('0x49')](handleError(_0x263501,null));};exports[_0xc5fd('0x4e')]=function(_0x12a059,_0x459aa5,_0x112f39){var _0x14bcb7={};var _0x575bdb={};var _0x1615e0;var _0x7b6883;return db[_0xc5fd('0x40')][_0xc5fd('0x4f')]({'where':{'id':_0x12a059[_0xc5fd('0x46')]['id']}})[_0xc5fd('0x25')](handleEntityNotFound(_0x459aa5,null))[_0xc5fd('0x25')](function(_0x212e2f){if(_0x212e2f){_0x1615e0=_0x212e2f;_0x575bdb['model']=_[_0xc5fd('0x30')](db[_0xc5fd('0x4b')][_0xc5fd('0x2b')]);_0x575bdb[_0xc5fd('0x2f')]=_[_0xc5fd('0x30')](_0x12a059['query']);_0x575bdb[_0xc5fd('0x31')]=_[_0xc5fd('0x34')](_0x575bdb[_0xc5fd('0x32')],_0x575bdb[_0xc5fd('0x2f')]);_0x14bcb7[_0xc5fd('0x33')]=_['intersection'](_0x575bdb[_0xc5fd('0x32')],qs[_0xc5fd('0x35')](_0x12a059[_0xc5fd('0x2f')][_0xc5fd('0x35')]));_0x14bcb7[_0xc5fd('0x33')]=_0x14bcb7[_0xc5fd('0x33')][_0xc5fd('0x36')]?_0x14bcb7[_0xc5fd('0x33')]:_0x575bdb[_0xc5fd('0x32')];_0x14bcb7['order']=qs['sort'](_0x12a059[_0xc5fd('0x2f')][_0xc5fd('0x39')]);_0x14bcb7[_0xc5fd('0x3a')]=qs[_0xc5fd('0x31')](_[_0xc5fd('0x3b')](_0x12a059[_0xc5fd('0x2f')],_0x575bdb[_0xc5fd('0x31')]));if(_0x12a059[_0xc5fd('0x2f')][_0xc5fd('0x3c')]){_0x14bcb7[_0xc5fd('0x3a')]=_['merge'](_0x14bcb7['where'],{'$or':_[_0xc5fd('0x2e')](_0x14bcb7[_0xc5fd('0x33')],function(_0x4e8413){var _0x1a9840={};_0x1a9840[_0x4e8413]={'$like':'%'+_0x12a059[_0xc5fd('0x2f')][_0xc5fd('0x3c')]+'%'};return _0x1a9840;})});}_0x14bcb7=_[_0xc5fd('0x3d')]({},_0x14bcb7,_0x12a059[_0xc5fd('0x3f')]);return _0x1615e0[_0xc5fd('0x4e')](_0x14bcb7);}})[_0xc5fd('0x25')](function(_0x416314){if(_0x416314){_0x7b6883=_0x416314['length'];if(!_0x12a059[_0xc5fd('0x2f')][_0xc5fd('0x37')](_0xc5fd('0x50'))){_0x14bcb7[_0xc5fd('0x1f')]=qs[_0xc5fd('0x1f')](_0x12a059[_0xc5fd('0x2f')]['limit']);_0x14bcb7['offset']=qs[_0xc5fd('0x1d')](_0x12a059['query'][_0xc5fd('0x1d')]);}return _0x1615e0[_0xc5fd('0x4e')](_0x14bcb7);}})[_0xc5fd('0x25')](function(_0xcf0fd1){if(_0xcf0fd1){return _0xcf0fd1?{'count':_0x7b6883,'rows':_0xcf0fd1}:null;}})[_0xc5fd('0x25')](respondWithResult(_0x459aa5,null))['catch'](handleError(_0x459aa5,null));};exports[_0xc5fd('0x51')]=function(_0xa9cc4c,_0x2e8255,_0x1b1860){return db[_0xc5fd('0x52')][_0xc5fd('0x53')]({'where':{'id':_0xa9cc4c[_0xc5fd('0x46')]['id']}})[_0xc5fd('0x25')](handleEntityNotFound(_0x2e8255,null))[_0xc5fd('0x25')](function(_0x2dcb8c){if(_0x2dcb8c){return _0x2dcb8c[_0xc5fd('0x51')](_0xa9cc4c[_0xc5fd('0x48')][_0xc5fd('0x4c')],_['omit'](_0xa9cc4c['body'],[_0xc5fd('0x4c'),'id'])||{});}})[_0xc5fd('0x25')](respondWithResult(_0x2e8255,null))[_0xc5fd('0x49')](handleError(_0x2e8255,null));};exports[_0xc5fd('0x54')]=function(_0x5f53b0,_0x38c403,_0x2c0511){var _0x1d01ab={};var _0x14c54a={};var _0x47f930;var _0x1cd17b;return db['Automation'][_0xc5fd('0x4f')]({'where':{'id':_0x5f53b0[_0xc5fd('0x46')]['id']}})[_0xc5fd('0x25')](handleEntityNotFound(_0x38c403,null))[_0xc5fd('0x25')](function(_0x19758a){if(_0x19758a){_0x47f930=_0x19758a;_0x14c54a[_0xc5fd('0x32')]=_[_0xc5fd('0x30')](db['Action'][_0xc5fd('0x2b')]);_0x14c54a['query']=_[_0xc5fd('0x30')](_0x5f53b0[_0xc5fd('0x2f')]);_0x14c54a['filters']=_['intersection'](_0x14c54a[_0xc5fd('0x32')],_0x14c54a[_0xc5fd('0x2f')]);_0x1d01ab[_0xc5fd('0x33')]=_[_0xc5fd('0x34')](_0x14c54a['model'],qs[_0xc5fd('0x35')](_0x5f53b0[_0xc5fd('0x2f')][_0xc5fd('0x35')]));_0x1d01ab['attributes']=_0x1d01ab[_0xc5fd('0x33')][_0xc5fd('0x36')]?_0x1d01ab[_0xc5fd('0x33')]:_0x14c54a['model'];_0x1d01ab[_0xc5fd('0x38')]=qs[_0xc5fd('0x39')](_0x5f53b0['query'][_0xc5fd('0x39')]);_0x1d01ab[_0xc5fd('0x3a')]=qs[_0xc5fd('0x31')](_[_0xc5fd('0x3b')](_0x5f53b0[_0xc5fd('0x2f')],_0x14c54a[_0xc5fd('0x31')]));if(_0x5f53b0[_0xc5fd('0x2f')][_0xc5fd('0x3c')]){_0x1d01ab['where']=_[_0xc5fd('0x3d')](_0x1d01ab[_0xc5fd('0x3a')],{'$or':_['map'](_0x1d01ab['attributes'],function(_0x5abc76){var _0x56cd85={};_0x56cd85[_0x5abc76]={'$like':'%'+_0x5f53b0[_0xc5fd('0x2f')][_0xc5fd('0x3c')]+'%'};return _0x56cd85;})});}_0x1d01ab=_['merge']({},_0x1d01ab,_0x5f53b0[_0xc5fd('0x3f')]);return _0x47f930[_0xc5fd('0x54')](_0x1d01ab);}})[_0xc5fd('0x25')](function(_0xed0b2f){if(_0xed0b2f){_0x1cd17b=_0xed0b2f[_0xc5fd('0x36')];if(!_0x5f53b0[_0xc5fd('0x2f')][_0xc5fd('0x37')](_0xc5fd('0x50'))){_0x1d01ab['limit']=qs[_0xc5fd('0x1f')](_0x5f53b0[_0xc5fd('0x2f')][_0xc5fd('0x1f')]);_0x1d01ab[_0xc5fd('0x1d')]=qs[_0xc5fd('0x1d')](_0x5f53b0['query'][_0xc5fd('0x1d')]);}return _0x47f930[_0xc5fd('0x54')](_0x1d01ab);}})[_0xc5fd('0x25')](function(_0x3565a4){if(_0x3565a4){return _0x3565a4?{'count':_0x1cd17b,'rows':_0x3565a4}:null;}})[_0xc5fd('0x25')](respondWithResult(_0x38c403,null))[_0xc5fd('0x49')](handleError(_0x38c403,null));}; \ No newline at end of file +var _0xe545=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','keys','intersection','query','attributes','fields','model','nolimit','order','sort','where','pick','filters','merge','options','count','includeAll','include','findAll','catch','params','length','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','filter','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe545,0x17f));var _0x5e54=function(_0x3e3ba7,_0x531288){_0x3e3ba7=_0x3e3ba7-0x0;var _0x2f6d9d=_0xe545[_0x3e3ba7];return _0x2f6d9d;};'use strict';var emlformat=require(_0x5e54('0x0'));var rimraf=require(_0x5e54('0x1'));var zipdir=require(_0x5e54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e54('0x3'));var moment=require(_0x5e54('0x4'));var BPromise=require(_0x5e54('0x5'));var Mustache=require(_0x5e54('0x6'));var util=require(_0x5e54('0x7'));var path=require('path');var sox=require(_0x5e54('0x8'));var csv=require('to-csv');var ejs=require(_0x5e54('0x9'));var fs=require('fs');var fs_extra=require(_0x5e54('0xa'));var _=require('lodash');var squel=require(_0x5e54('0xb'));var crypto=require(_0x5e54('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5e54('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e54('0xe'));var Papa=require(_0x5e54('0xf'));var Redis=require(_0x5e54('0x10'));var authService=require(_0x5e54('0x11'));var qs=require(_0x5e54('0x12'));var as=require(_0x5e54('0x13'));var hardwareService=require(_0x5e54('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e54('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dc37a,_0x1acb17){_0x1acb17=_0x1acb17||0xcc;return function(_0x3dee05){if(_0x3dee05){return _0x1dc37a[_0x5e54('0x16')](_0x1acb17);}return _0x1dc37a[_0x5e54('0x17')](_0x1acb17)[_0x5e54('0x18')]();};}function respondWithResult(_0x1053e1,_0x4cba04){_0x4cba04=_0x4cba04||0xc8;return function(_0x1bfaa5){if(_0x1bfaa5){return _0x1053e1[_0x5e54('0x17')](_0x4cba04)['json'](_0x1bfaa5);}};}function respondWithFilteredResult(_0x2c1a3b,_0x31dc8c){return function(_0x538336){if(_0x538336){var _0x29ee90=typeof _0x31dc8c[_0x5e54('0x19')]===_0x5e54('0x1a')&&typeof _0x31dc8c['limit']==='undefined';var _0x1af620=_0x538336['count'];var _0x35d1b5=_0x29ee90?0x0:_0x31dc8c[_0x5e54('0x19')];var _0x4b5625=_0x29ee90?_0x538336['count']:_0x31dc8c[_0x5e54('0x19')]+_0x31dc8c[_0x5e54('0x1b')];var _0x4fa4f3;if(_0x4b5625>=_0x1af620){_0x4b5625=_0x1af620;_0x4fa4f3=0xc8;}else{_0x4fa4f3=0xce;}_0x2c1a3b['status'](_0x4fa4f3);return _0x2c1a3b['set'](_0x5e54('0x1c'),_0x35d1b5+'-'+_0x4b5625+'/'+_0x1af620)[_0x5e54('0x1d')](_0x538336);}return null;};}function patchUpdates(_0x1b7d06){return function(_0x438fdf){try{jsonpatch[_0x5e54('0x1e')](_0x438fdf,_0x1b7d06,!![]);}catch(_0x5a6967){return BPromise[_0x5e54('0x1f')](_0x5a6967);}return _0x438fdf['save']();};}function saveUpdates(_0x506afe,_0x4f0b65){return function(_0x3b0772){if(_0x3b0772){return _0x3b0772[_0x5e54('0x20')](_0x506afe)[_0x5e54('0x21')](function(_0x3f9c62){return _0x3f9c62;});}return null;};}function removeEntity(_0x4e1ed7,_0x353570){return function(_0x444c9c){if(_0x444c9c){return _0x444c9c[_0x5e54('0x22')]()[_0x5e54('0x21')](function(){_0x4e1ed7[_0x5e54('0x17')](0xcc)[_0x5e54('0x18')]();});}};}function handleEntityNotFound(_0x441f25,_0x10a9f6){return function(_0x15c738){if(!_0x15c738){_0x441f25[_0x5e54('0x16')](0x194);}return _0x15c738;};}function handleError(_0x555716,_0x27b073){_0x27b073=_0x27b073||0x1f4;return function(_0x46a02f){logger[_0x5e54('0x23')](_0x46a02f[_0x5e54('0x24')]);if(_0x46a02f['name']){delete _0x46a02f[_0x5e54('0x25')];}_0x555716['status'](_0x27b073)[_0x5e54('0x26')](_0x46a02f);};}exports[_0x5e54('0x27')]=function(_0x284ed8,_0x4ee581){var _0x1ab497={},_0x2bb8e2={},_0x5b303d={'count':0x0,'rows':[]};var _0x2d28c0=_[_0x5e54('0x28')](db[_0x5e54('0x29')][_0x5e54('0x2a')],function(_0x17bb90){return{'name':_0x17bb90[_0x5e54('0x2b')],'type':_0x17bb90[_0x5e54('0x2c')]['key']};});_0x2bb8e2['model']=_['map'](_0x2d28c0,_0x5e54('0x25'));_0x2bb8e2['query']=_[_0x5e54('0x2d')](_0x284ed8['query']);_0x2bb8e2['filters']=_[_0x5e54('0x2e')](_0x2bb8e2['model'],_0x2bb8e2[_0x5e54('0x2f')]);_0x1ab497[_0x5e54('0x30')]=_['intersection'](_0x2bb8e2['model'],qs[_0x5e54('0x31')](_0x284ed8['query'][_0x5e54('0x31')]));_0x1ab497[_0x5e54('0x30')]=_0x1ab497[_0x5e54('0x30')]['length']?_0x1ab497[_0x5e54('0x30')]:_0x2bb8e2[_0x5e54('0x32')];if(!_0x284ed8[_0x5e54('0x2f')]['hasOwnProperty'](_0x5e54('0x33'))){_0x1ab497[_0x5e54('0x1b')]=qs[_0x5e54('0x1b')](_0x284ed8['query']['limit']);_0x1ab497[_0x5e54('0x19')]=qs[_0x5e54('0x19')](_0x284ed8[_0x5e54('0x2f')][_0x5e54('0x19')]);}_0x1ab497[_0x5e54('0x34')]=qs['sort'](_0x284ed8['query'][_0x5e54('0x35')]);_0x1ab497[_0x5e54('0x36')]=qs['filters'](_[_0x5e54('0x37')](_0x284ed8[_0x5e54('0x2f')],_0x2bb8e2[_0x5e54('0x38')]),_0x2d28c0);if(_0x284ed8['query']['filter']){_0x1ab497[_0x5e54('0x36')]=_[_0x5e54('0x39')](_0x1ab497[_0x5e54('0x36')],{'$or':_[_0x5e54('0x28')](_0x2d28c0,function(_0x5e49d8){if(_0x5e49d8['type']!=='VIRTUAL'){var _0x2e9752={};_0x2e9752[_0x5e49d8[_0x5e54('0x25')]]={'$like':'%'+_0x284ed8[_0x5e54('0x2f')]['filter']+'%'};return _0x2e9752;}})});}_0x1ab497=_['merge']({},_0x1ab497,_0x284ed8[_0x5e54('0x3a')]);var _0x1173cd={'where':_0x1ab497['where']};return db[_0x5e54('0x29')][_0x5e54('0x3b')](_0x1173cd)[_0x5e54('0x21')](function(_0x218c11){_0x5b303d[_0x5e54('0x3b')]=_0x218c11;if(_0x284ed8[_0x5e54('0x2f')][_0x5e54('0x3c')]){_0x1ab497[_0x5e54('0x3d')]=[{'all':!![]}];}return db[_0x5e54('0x29')][_0x5e54('0x3e')](_0x1ab497);})[_0x5e54('0x21')](function(_0x523487){_0x5b303d['rows']=_0x523487;return _0x5b303d;})[_0x5e54('0x21')](respondWithFilteredResult(_0x4ee581,_0x1ab497))[_0x5e54('0x3f')](handleError(_0x4ee581,null));};exports['show']=function(_0x55aa73,_0x3a89fc){var _0x22f4a5={'raw':![],'where':{'id':_0x55aa73[_0x5e54('0x40')]['id']}},_0x7a288b={};_0x7a288b[_0x5e54('0x32')]=_[_0x5e54('0x2d')](db[_0x5e54('0x29')][_0x5e54('0x2a')]);_0x7a288b[_0x5e54('0x2f')]=_[_0x5e54('0x2d')](_0x55aa73[_0x5e54('0x2f')]);_0x7a288b[_0x5e54('0x38')]=_[_0x5e54('0x2e')](_0x7a288b[_0x5e54('0x32')],_0x7a288b[_0x5e54('0x2f')]);_0x22f4a5[_0x5e54('0x30')]=_[_0x5e54('0x2e')](_0x7a288b[_0x5e54('0x32')],qs[_0x5e54('0x31')](_0x55aa73[_0x5e54('0x2f')]['fields']));_0x22f4a5[_0x5e54('0x30')]=_0x22f4a5[_0x5e54('0x30')][_0x5e54('0x41')]?_0x22f4a5['attributes']:_0x7a288b['model'];if(_0x55aa73[_0x5e54('0x2f')][_0x5e54('0x3c')]){_0x22f4a5[_0x5e54('0x3d')]=[{'all':!![]}];}_0x22f4a5=_[_0x5e54('0x39')]({},_0x22f4a5,_0x55aa73[_0x5e54('0x3a')]);return db[_0x5e54('0x29')][_0x5e54('0x42')](_0x22f4a5)['then'](handleEntityNotFound(_0x3a89fc,null))[_0x5e54('0x21')](respondWithResult(_0x3a89fc,null))['catch'](handleError(_0x3a89fc,null));};exports[_0x5e54('0x43')]=function(_0xa70f22,_0x40412c){return db[_0x5e54('0x29')][_0x5e54('0x43')](_0xa70f22[_0x5e54('0x44')],{})['then'](respondWithResult(_0x40412c,0xc9))[_0x5e54('0x3f')](handleError(_0x40412c,null));};exports[_0x5e54('0x20')]=function(_0x4312b2,_0x54cdd1){if(_0x4312b2[_0x5e54('0x44')]['id']){delete _0x4312b2[_0x5e54('0x44')]['id'];}return db['Automation']['find']({'where':{'id':_0x4312b2['params']['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x54cdd1,null))[_0x5e54('0x21')](saveUpdates(_0x4312b2[_0x5e54('0x44')],null))[_0x5e54('0x21')](respondWithResult(_0x54cdd1,null))['catch'](handleError(_0x54cdd1,null));};exports[_0x5e54('0x22')]=function(_0x41d468,_0x558891){return db[_0x5e54('0x29')]['find']({'where':{'id':_0x41d468[_0x5e54('0x40')]['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x558891,null))['then'](removeEntity(_0x558891,null))[_0x5e54('0x3f')](handleError(_0x558891,null));};exports[_0x5e54('0x45')]=function(_0x78cbc2,_0x5cb661,_0xebdee1){return db[_0x5e54('0x46')]['find']({'where':{'id':_0x78cbc2[_0x5e54('0x40')]['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x5cb661,null))[_0x5e54('0x21')](function(_0x4633bf){if(_0x4633bf){return _0x4633bf[_0x5e54('0x45')](_0x78cbc2[_0x5e54('0x44')][_0x5e54('0x47')],_[_0x5e54('0x48')](_0x78cbc2[_0x5e54('0x44')],[_0x5e54('0x47'),'id'])||{});}})[_0x5e54('0x21')](respondWithResult(_0x5cb661,null))['catch'](handleError(_0x5cb661,null));};exports[_0x5e54('0x49')]=function(_0x327216,_0x28c193,_0x108224){var _0x12ad30={};var _0x7547b2={};var _0x29d410;var _0x154537;return db[_0x5e54('0x29')][_0x5e54('0x4a')]({'where':{'id':_0x327216[_0x5e54('0x40')]['id']}})['then'](handleEntityNotFound(_0x28c193,null))['then'](function(_0x2e0fe7){if(_0x2e0fe7){_0x29d410=_0x2e0fe7;_0x7547b2[_0x5e54('0x32')]=_[_0x5e54('0x2d')](db[_0x5e54('0x46')][_0x5e54('0x2a')]);_0x7547b2[_0x5e54('0x2f')]=_['keys'](_0x327216[_0x5e54('0x2f')]);_0x7547b2['filters']=_[_0x5e54('0x2e')](_0x7547b2['model'],_0x7547b2['query']);_0x12ad30[_0x5e54('0x30')]=_['intersection'](_0x7547b2['model'],qs[_0x5e54('0x31')](_0x327216[_0x5e54('0x2f')][_0x5e54('0x31')]));_0x12ad30[_0x5e54('0x30')]=_0x12ad30[_0x5e54('0x30')]['length']?_0x12ad30[_0x5e54('0x30')]:_0x7547b2[_0x5e54('0x32')];_0x12ad30[_0x5e54('0x34')]=qs[_0x5e54('0x35')](_0x327216[_0x5e54('0x2f')][_0x5e54('0x35')]);_0x12ad30[_0x5e54('0x36')]=qs['filters'](_[_0x5e54('0x37')](_0x327216['query'],_0x7547b2['filters']));if(_0x327216[_0x5e54('0x2f')][_0x5e54('0x4b')]){_0x12ad30[_0x5e54('0x36')]=_['merge'](_0x12ad30[_0x5e54('0x36')],{'$or':_[_0x5e54('0x28')](_0x12ad30['attributes'],function(_0x1e5192){var _0x2cefb1={};_0x2cefb1[_0x1e5192]={'$like':'%'+_0x327216[_0x5e54('0x2f')]['filter']+'%'};return _0x2cefb1;})});}_0x12ad30=_[_0x5e54('0x39')]({},_0x12ad30,_0x327216[_0x5e54('0x3a')]);return _0x29d410[_0x5e54('0x49')](_0x12ad30);}})[_0x5e54('0x21')](function(_0x1e1eee){if(_0x1e1eee){_0x154537=_0x1e1eee[_0x5e54('0x41')];if(!_0x327216[_0x5e54('0x2f')][_0x5e54('0x4c')](_0x5e54('0x33'))){_0x12ad30[_0x5e54('0x1b')]=qs['limit'](_0x327216[_0x5e54('0x2f')]['limit']);_0x12ad30[_0x5e54('0x19')]=qs[_0x5e54('0x19')](_0x327216[_0x5e54('0x2f')]['offset']);}return _0x29d410[_0x5e54('0x49')](_0x12ad30);}})[_0x5e54('0x21')](function(_0x213898){if(_0x213898){return _0x213898?{'count':_0x154537,'rows':_0x213898}:null;}})['then'](respondWithResult(_0x28c193,null))[_0x5e54('0x3f')](handleError(_0x28c193,null));};exports[_0x5e54('0x4d')]=function(_0x62770f,_0x59796c,_0x80ca22){return db[_0x5e54('0x4e')][_0x5e54('0x42')]({'where':{'id':_0x62770f[_0x5e54('0x40')]['id']}})['then'](handleEntityNotFound(_0x59796c,null))[_0x5e54('0x21')](function(_0x563c05){if(_0x563c05){return _0x563c05[_0x5e54('0x4d')](_0x62770f[_0x5e54('0x44')][_0x5e54('0x47')],_[_0x5e54('0x48')](_0x62770f['body'],[_0x5e54('0x47'),'id'])||{});}})['then'](respondWithResult(_0x59796c,null))[_0x5e54('0x3f')](handleError(_0x59796c,null));};exports[_0x5e54('0x4f')]=function(_0x5c0794,_0x48f8fc,_0x11ef9f){var _0x5170e9={};var _0x18942d={};var _0x331eab;var _0x2b4536;return db[_0x5e54('0x29')][_0x5e54('0x4a')]({'where':{'id':_0x5c0794[_0x5e54('0x40')]['id']}})[_0x5e54('0x21')](handleEntityNotFound(_0x48f8fc,null))[_0x5e54('0x21')](function(_0x2ae7a1){if(_0x2ae7a1){_0x331eab=_0x2ae7a1;_0x18942d[_0x5e54('0x32')]=_[_0x5e54('0x2d')](db['Action'][_0x5e54('0x2a')]);_0x18942d[_0x5e54('0x2f')]=_['keys'](_0x5c0794[_0x5e54('0x2f')]);_0x18942d[_0x5e54('0x38')]=_[_0x5e54('0x2e')](_0x18942d[_0x5e54('0x32')],_0x18942d[_0x5e54('0x2f')]);_0x5170e9['attributes']=_['intersection'](_0x18942d['model'],qs['fields'](_0x5c0794['query']['fields']));_0x5170e9[_0x5e54('0x30')]=_0x5170e9[_0x5e54('0x30')][_0x5e54('0x41')]?_0x5170e9[_0x5e54('0x30')]:_0x18942d[_0x5e54('0x32')];_0x5170e9[_0x5e54('0x34')]=qs[_0x5e54('0x35')](_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x35')]);_0x5170e9[_0x5e54('0x36')]=qs['filters'](_['pick'](_0x5c0794[_0x5e54('0x2f')],_0x18942d[_0x5e54('0x38')]));if(_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x4b')]){_0x5170e9[_0x5e54('0x36')]=_[_0x5e54('0x39')](_0x5170e9[_0x5e54('0x36')],{'$or':_[_0x5e54('0x28')](_0x5170e9['attributes'],function(_0x467847){var _0x1df71f={};_0x1df71f[_0x467847]={'$like':'%'+_0x5c0794['query'][_0x5e54('0x4b')]+'%'};return _0x1df71f;})});}_0x5170e9=_['merge']({},_0x5170e9,_0x5c0794[_0x5e54('0x3a')]);return _0x331eab[_0x5e54('0x4f')](_0x5170e9);}})[_0x5e54('0x21')](function(_0x1d8118){if(_0x1d8118){_0x2b4536=_0x1d8118['length'];if(!_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x4c')](_0x5e54('0x33'))){_0x5170e9[_0x5e54('0x1b')]=qs['limit'](_0x5c0794[_0x5e54('0x2f')]['limit']);_0x5170e9[_0x5e54('0x19')]=qs[_0x5e54('0x19')](_0x5c0794[_0x5e54('0x2f')][_0x5e54('0x19')]);}return _0x331eab[_0x5e54('0x4f')](_0x5170e9);}})['then'](function(_0x2226c4){if(_0x2226c4){return _0x2226c4?{'count':_0x2b4536,'rows':_0x2226c4}:null;}})['then'](respondWithResult(_0x48f8fc,null))[_0x5e54('0x3f')](handleError(_0x48f8fc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 9d729c9..4ba50cd 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 _0xcb45=['bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb45,0x11c));var _0x5cb4=function(_0x431876,_0x5c896a){_0x431876=_0x431876-0x0;var _0x157c61=_0xcb45[_0x431876];return _0x157c61;};'use strict';var _=require(_0x5cb4('0x0'));var util=require(_0x5cb4('0x1'));var logger=require('../../config/logger')(_0x5cb4('0x2'));var moment=require(_0x5cb4('0x3'));var BPromise=require(_0x5cb4('0x4'));var rp=require(_0x5cb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cb4('0x6'));var config=require(_0x5cb4('0x7'));var attributes=require(_0x5cb4('0x8'));module['exports']=function(_0x39041b,_0x7d0e18){return _0x39041b[_0x5cb4('0x9')](_0x5cb4('0xa'),attributes,{'tableName':_0x5cb4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ea7=['lodash','../../config/logger','request-promise','path','../../config/environment','./automation.attributes','define'];(function(_0x288a14,_0x5300db){var _0x1e15f2=function(_0x30fb34){while(--_0x30fb34){_0x288a14['push'](_0x288a14['shift']());}};_0x1e15f2(++_0x5300db);}(_0x9ea7,0x165));var _0x79ea=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x9ea7[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0x79ea('0x0'));var util=require('util');var logger=require(_0x79ea('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79ea('0x2'));var fs=require('fs');var path=require(_0x79ea('0x3'));var rimraf=require('rimraf');var config=require(_0x79ea('0x4'));var attributes=require(_0x79ea('0x5'));module['exports']=function(_0x32938b,_0x5cd579){return _0x32938b[_0x79ea('0x6')]('Automation',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 1d44177..1abe74d 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 _0x6bab=['../../config/logger','rpc','jayson/promise','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x6bab[_0x16337a];return _0x422365;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var moment=require(_0xb6ba('0x2'));var BPromise=require(_0xb6ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ba('0x4'));var db=require(_0xb6ba('0x5'))['db'];var utils=require(_0xb6ba('0x6'));var logger=require(_0xb6ba('0x7'))(_0xb6ba('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6ba('0x9'));var client=jayson['client'][_0xb6ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389a0d,_0x3fd283,_0xbce6f){return new BPromise(function(_0xa0b5c7,_0x469e81){return client[_0xb6ba('0xb')](_0x389a0d,_0xbce6f)[_0xb6ba('0xc')](function(_0x36bdc2){logger['info'](_0xb6ba('0xd'),_0x3fd283,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3fd283,_0xb6ba('0xe'),JSON[_0xb6ba('0xf')](_0x36bdc2));if(_0x36bdc2[_0xb6ba('0x10')]){if(_0x36bdc2['error'][_0xb6ba('0x11')]===0x1f4){logger[_0xb6ba('0x10')](_0xb6ba('0xd'),_0x3fd283,_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);return _0x469e81(_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);}logger[_0xb6ba('0x10')](_0xb6ba('0xd'),_0x3fd283,_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);return _0xa0b5c7(_0x36bdc2[_0xb6ba('0x10')][_0xb6ba('0x12')]);}else{logger[_0xb6ba('0x13')](_0xb6ba('0xd'),_0x3fd283,_0xb6ba('0xe'));_0xa0b5c7(_0x36bdc2[_0xb6ba('0x14')][_0xb6ba('0x12')]);}})[_0xb6ba('0x15')](function(_0x5313d4){logger[_0xb6ba('0x10')]('Automation,\x20%s,\x20%s',_0x3fd283,_0x5313d4);_0x469e81(_0x5313d4);});});} \ No newline at end of file +var _0x1410=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1410,0x130));var _0x0141=function(_0x39153c,_0x293109){_0x39153c=_0x39153c-0x0;var _0x246bac=_0x1410[_0x39153c];return _0x246bac;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c38187a..5ee12f0 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 _0xe57e=['update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions'];(function(_0x53a6e4,_0x1e2424){var _0x40896a=function(_0x5fc1aa){while(--_0x5fc1aa){_0x53a6e4['push'](_0x53a6e4['shift']());}};_0x40896a(++_0x1e2424);}(_0xe57e,0xf2));var _0xee57=function(_0x2f4205,_0x1993b1){_0x2f4205=_0x2f4205-0x0;var _0x40d284=_0xe57e[_0x2f4205];return _0x40d284;};'use strict';var multer=require(_0xee57('0x0'));var util=require('util');var path=require(_0xee57('0x1'));var timeout=require(_0xee57('0x2'));var express=require(_0xee57('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee57('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee57('0x5'));var controller=require(_0xee57('0x6'));router[_0xee57('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee57('0x7')](_0xee57('0x8'),auth[_0xee57('0x9')](),controller[_0xee57('0xa')]);router[_0xee57('0x7')](_0xee57('0xb'),auth[_0xee57('0x9')](),controller['getConditions']);router['get'](_0xee57('0xc'),auth[_0xee57('0x9')](),controller[_0xee57('0xd')]);router[_0xee57('0xe')]('/',auth[_0xee57('0x9')](),controller[_0xee57('0xf')]);router[_0xee57('0xe')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xee57('0x10')]);router[_0xee57('0xe')](_0xee57('0xc'),auth[_0xee57('0x9')](),controller[_0xee57('0x11')]);router['put'](_0xee57('0x8'),auth['isAuthenticated'](),controller[_0xee57('0x12')]);router['delete'](_0xee57('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xee57('0x13')]=router; \ No newline at end of file +var _0xbbb8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x51d26e,_0x5bc3ae){var _0x10c10a=function(_0x21a675){while(--_0x21a675){_0x51d26e['push'](_0x51d26e['shift']());}};_0x10c10a(++_0x5bc3ae);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x113dfd,_0x48eae8){_0x113dfd=_0x113dfd-0x0;var _0xb7a4ed=_0xbbb8[_0x113dfd];return _0xb7a4ed;};'use strict';var multer=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var path=require('path');var timeout=require(_0x8bbb('0x2'));var express=require(_0x8bbb('0x3'));var router=express['Router']();var fs_extra=require(_0x8bbb('0x4'));var auth=require(_0x8bbb('0x5'));var interaction=require(_0x8bbb('0x6'));var config=require(_0x8bbb('0x7'));var controller=require(_0x8bbb('0x8'));router[_0x8bbb('0x9')]('/',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0xb')]);router[_0x8bbb('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8bbb('0x9')](_0x8bbb('0xc'),auth[_0x8bbb('0xa')](),controller[_0x8bbb('0xd')]);router[_0x8bbb('0x9')](_0x8bbb('0xe'),auth[_0x8bbb('0xa')](),controller[_0x8bbb('0xf')]);router['post']('/',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x10')]);router[_0x8bbb('0x11')]('/:id/conditions',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x12')]);router[_0x8bbb('0x11')]('/:id/actions',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x13')]);router[_0x8bbb('0x14')](_0x8bbb('0x15'),auth['isAuthenticated'](),controller[_0x8bbb('0x16')]);router[_0x8bbb('0x17')]('/:id',auth[_0x8bbb('0xa')](),controller[_0x8bbb('0x18')]);module[_0x8bbb('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index fb5056b..e75626f 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 _0x84a3=['#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x51e6a2,_0x3652ae){var _0xaf39a2=function(_0x4d2cd){while(--_0x4d2cd){_0x51e6a2['push'](_0x51e6a2['shift']());}};_0xaf39a2(++_0x3652ae);}(_0x84a3,0x189));var _0x384a=function(_0x4c0db8,_0x15f00d){_0x4c0db8=_0x4c0db8-0x0;var _0x431184=_0x84a3[_0x4c0db8];return _0x431184;};'use strict';var Sequelize=require(_0x384a('0x0'));module[_0x384a('0x1')]={'name':{'type':Sequelize[_0x384a('0x2')],'unique':_0x384a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x384a('0x4')](_0x384a('0x5')),'allowNull':![],'defaultValue':_0x384a('0x5')},'description':{'type':Sequelize[_0x384a('0x2')]},'active':{'type':Sequelize[_0x384a('0x6')],'defaultValue':0x0,'comment':_0x384a('0x7')},'limitCalls':{'type':Sequelize[_0x384a('0x8')](0x4)[_0x384a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x384a('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x384a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x384a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x384a('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x384a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x384a('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x384a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x384a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x384a('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'defaultValue':0x3,'comment':_0x384a('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x384a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x384a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x384a('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x384a('0x4')](_0x384a('0x10'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x384a('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x384a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x384a('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x384a('0x8')](0x9)[_0x384a('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x384a('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x384a('0x8')](0x9)[_0x384a('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x384a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x384a('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x384a('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x384a('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x384a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x384a('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x384a('0x8')](0x5)[_0x384a('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x384a('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x384a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x384a('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x384a('0x19'),_0x384a('0x1a')),'defaultValue':_0x384a('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x384a('0x1b')},'dialCutDigit':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x384a('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x384a('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x384a('0x8')](0x5)[_0x384a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x384a('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x384a('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x384a('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x384a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x384a('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)[_0x384a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x384a('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x384a('0x8')](0x5)[_0x384a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x384a('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x384a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x384a('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x384a('0x8')](0x5)[_0x384a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x048e=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen'];(function(_0x2f1696,_0x429c06){var _0x2f08e4=function(_0x36bef6){while(--_0x36bef6){_0x2f1696['push'](_0x2f1696['shift']());}};_0x2f08e4(++_0x429c06);}(_0x048e,0x1aa));var _0xe048=function(_0x59dfe7,_0x925008){_0x59dfe7=_0x59dfe7-0x0;var _0x572f2e=_0x048e[_0x59dfe7];return _0x572f2e;};'use strict';var Sequelize=require(_0xe048('0x0'));module['exports']={'name':{'type':Sequelize[_0xe048('0x1')],'unique':_0xe048('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe048('0x3')](_0xe048('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xe048('0x1')]},'active':{'type':Sequelize[_0xe048('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xe048('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe048('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe048('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xe048('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe048('0xe')},'dialTimezone':{'type':Sequelize[_0xe048('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe048('0x1')],'defaultValue':_0xe048('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xe048('0x10'),'never',_0xe048('0x11')),'defaultValue':_0xe048('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe048('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xe048('0x9')](0x9)[_0xe048('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe048('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xe048('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe048('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe048('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe048('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe048('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe048('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xe048('0x9')](0x9)[_0xe048('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe048('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe048('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe048('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe048('0x9')](0x9)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe048('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe048('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe048('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe048('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe048('0x3')](_0xe048('0x1c'),_0xe048('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xe048('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe048('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe048('0x9')](0x3)[_0xe048('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe048('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe048('0x9')](0x5)[_0xe048('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe048('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ba32a8c..4ef6578 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 _0x6a47=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','end','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','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','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','nolimit','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','fromQuery','ListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x39a610,_0x36ca88){var _0x5942c3=function(_0x5bbd58){while(--_0x5bbd58){_0x39a610['push'](_0x39a610['shift']());}};_0x5942c3(++_0x36ca88);}(_0x6a47,0x112));var _0x76a4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6a47[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x76a4('0x0'));var rimraf=require(_0x76a4('0x1'));var zipdir=require(_0x76a4('0x2'));var jsonpatch=require(_0x76a4('0x3'));var rp=require(_0x76a4('0x4'));var moment=require('moment');var BPromise=require(_0x76a4('0x5'));var Mustache=require(_0x76a4('0x6'));var util=require('util');var path=require(_0x76a4('0x7'));var sox=require(_0x76a4('0x8'));var csv=require('to-csv');var ejs=require(_0x76a4('0x9'));var fs=require('fs');var fs_extra=require(_0x76a4('0xa'));var _=require('lodash');var squel=require(_0x76a4('0xb'));var crypto=require(_0x76a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x76a4('0xd'));var toCsv=require(_0x76a4('0xe'));var querystring=require(_0x76a4('0xf'));var Papa=require('papaparse');var Redis=require(_0x76a4('0x10'));var authService=require(_0x76a4('0x11'));var qs=require(_0x76a4('0x12'));var as=require(_0x76a4('0x13'));var hardwareService=require(_0x76a4('0x14'));var logger=require(_0x76a4('0x15'))(_0x76a4('0x16'));var utils=require(_0x76a4('0x17'));var config=require(_0x76a4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x76a4('0x19'))['db'];function respondWithStatusCode(_0xfe603f,_0x421ed2){_0x421ed2=_0x421ed2||0xcc;return function(_0x48e8a7){if(_0x48e8a7){return _0xfe603f[_0x76a4('0x1a')](_0x421ed2);}return _0xfe603f[_0x76a4('0x1b')](_0x421ed2)['end']();};}function respondWithResult(_0x3ec54f,_0x42e0c2){_0x42e0c2=_0x42e0c2||0xc8;return function(_0x5a729a){if(_0x5a729a){return _0x3ec54f['status'](_0x42e0c2)[_0x76a4('0x1c')](_0x5a729a);}};}function respondWithFilteredResult(_0x6213d3,_0x5261de){return function(_0x1ecb5c){if(_0x1ecb5c){var _0x3aed77=typeof _0x5261de[_0x76a4('0x1d')]===_0x76a4('0x1e')&&typeof _0x5261de[_0x76a4('0x1f')]===_0x76a4('0x1e');var _0x147a68=_0x1ecb5c[_0x76a4('0x20')];var _0x52e81f=_0x3aed77?0x0:_0x5261de[_0x76a4('0x1d')];var _0x52cc5f=_0x3aed77?_0x1ecb5c[_0x76a4('0x20')]:_0x5261de['offset']+_0x5261de['limit'];var _0x297064;if(_0x52cc5f>=_0x147a68){_0x52cc5f=_0x147a68;_0x297064=0xc8;}else{_0x297064=0xce;}_0x6213d3['status'](_0x297064);return _0x6213d3[_0x76a4('0x21')](_0x76a4('0x22'),_0x52e81f+'-'+_0x52cc5f+'/'+_0x147a68)[_0x76a4('0x1c')](_0x1ecb5c);}return null;};}function patchUpdates(_0x30c770){return function(_0x18fa98){try{jsonpatch['apply'](_0x18fa98,_0x30c770,!![]);}catch(_0x5a52c7){return BPromise[_0x76a4('0x23')](_0x5a52c7);}return _0x18fa98[_0x76a4('0x24')]();};}function saveUpdates(_0x5ab74a,_0xae96cc){return function(_0x3eee72){if(_0x3eee72){return _0x3eee72[_0x76a4('0x25')](_0x5ab74a)[_0x76a4('0x26')](function(_0x2892f2){return _0x2892f2;});}return null;};}function removeEntity(_0x367164,_0x229cbe){return function(_0x53ec55){if(_0x53ec55){return _0x53ec55['destroy']()['then'](function(){var _0x4fd6eb=_0x53ec55[_0x76a4('0x27')]({'plain':!![]});var _0x4570a0=_0x76a4('0x28');return db[_0x76a4('0x29')][_0x76a4('0x2a')]({'where':{'type':_0x4570a0,'resourceId':_0x4fd6eb['id']}})['then'](function(){return _0x53ec55;});})['then'](function(){_0x367164[_0x76a4('0x1b')](0xcc)[_0x76a4('0x2b')]();});}};}function handleEntityNotFound(_0x4a2b41,_0x5b2e28){return function(_0x41d8f8){if(!_0x41d8f8){_0x4a2b41[_0x76a4('0x1a')](0x194);}return _0x41d8f8;};}function handleError(_0x43ce16,_0x6f89b4){_0x6f89b4=_0x6f89b4||0x1f4;return function(_0x228c34){logger[_0x76a4('0x2c')](_0x228c34['stack']);if(_0x228c34['name']){delete _0x228c34[_0x76a4('0x2d')];}_0x43ce16[_0x76a4('0x1b')](_0x6f89b4)[_0x76a4('0x2e')](_0x228c34);};}exports[_0x76a4('0x2f')]=function(_0x183f0b,_0x3ba49c){var _0x78ce67={},_0x4afff6={},_0x553738={'count':0x0,'rows':[]};var _0x16dc67=_[_0x76a4('0x30')](db[_0x76a4('0x31')][_0x76a4('0x32')],function(_0x65eb1f){return{'name':_0x65eb1f[_0x76a4('0x33')],'type':_0x65eb1f[_0x76a4('0x34')]['key']};});_0x4afff6['model']=_[_0x76a4('0x30')](_0x16dc67,_0x76a4('0x2d'));_0x4afff6[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x183f0b['query']);_0x4afff6[_0x76a4('0x37')]=_[_0x76a4('0x38')](_0x4afff6[_0x76a4('0x39')],_0x4afff6[_0x76a4('0x35')]);_0x78ce67[_0x76a4('0x3a')]=_[_0x76a4('0x38')](_0x4afff6['model'],qs[_0x76a4('0x3b')](_0x183f0b['query'][_0x76a4('0x3b')]));_0x78ce67[_0x76a4('0x3a')]=_0x78ce67['attributes'][_0x76a4('0x3c')]?_0x78ce67[_0x76a4('0x3a')]:_0x4afff6[_0x76a4('0x39')];if(!_0x183f0b[_0x76a4('0x35')][_0x76a4('0x3d')]('nolimit')){_0x78ce67['limit']=qs[_0x76a4('0x1f')](_0x183f0b['query'][_0x76a4('0x1f')]);_0x78ce67[_0x76a4('0x1d')]=qs[_0x76a4('0x1d')](_0x183f0b[_0x76a4('0x35')][_0x76a4('0x1d')]);}_0x78ce67[_0x76a4('0x3e')]=qs['sort'](_0x183f0b['query'][_0x76a4('0x3f')]);_0x78ce67[_0x76a4('0x40')]=qs['filters'](_[_0x76a4('0x41')](_0x183f0b[_0x76a4('0x35')],_0x4afff6[_0x76a4('0x37')]),_0x16dc67);if(_0x183f0b['query'][_0x76a4('0x42')]){_0x78ce67[_0x76a4('0x40')]=_['merge'](_0x78ce67[_0x76a4('0x40')],{'$or':_[_0x76a4('0x30')](_0x16dc67,function(_0x91df79){if(_0x91df79['type']!=='VIRTUAL'){var _0x3b149a={};_0x3b149a[_0x91df79['name']]={'$like':'%'+_0x183f0b['query'][_0x76a4('0x42')]+'%'};return _0x3b149a;}})});}_0x78ce67=_['merge']({},_0x78ce67,_0x183f0b[_0x76a4('0x43')]);var _0x3b7c6b={'where':_0x78ce67[_0x76a4('0x40')]};return db['Campaign'][_0x76a4('0x20')](_0x3b7c6b)[_0x76a4('0x26')](function(_0x51d94b){_0x553738[_0x76a4('0x20')]=_0x51d94b;if(_0x183f0b[_0x76a4('0x35')][_0x76a4('0x44')]){_0x78ce67[_0x76a4('0x45')]=[{'all':!![]}];}return db[_0x76a4('0x31')][_0x76a4('0x46')](_0x78ce67);})[_0x76a4('0x26')](function(_0x361abe){_0x553738[_0x76a4('0x47')]=_0x361abe;return _0x553738;})[_0x76a4('0x26')](respondWithFilteredResult(_0x3ba49c,_0x78ce67))[_0x76a4('0x48')](handleError(_0x3ba49c,null));};exports[_0x76a4('0x49')]=function(_0x442431,_0x26ed8f){var _0x51f8b7={'raw':![],'where':{'id':_0x442431[_0x76a4('0x4a')]['id']}},_0x193ad1={};_0x193ad1[_0x76a4('0x39')]=_[_0x76a4('0x36')](db[_0x76a4('0x31')][_0x76a4('0x32')]);_0x193ad1[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x442431['query']);_0x193ad1[_0x76a4('0x37')]=_['intersection'](_0x193ad1[_0x76a4('0x39')],_0x193ad1['query']);_0x51f8b7[_0x76a4('0x3a')]=_[_0x76a4('0x38')](_0x193ad1['model'],qs[_0x76a4('0x3b')](_0x442431['query'][_0x76a4('0x3b')]));_0x51f8b7['attributes']=_0x51f8b7['attributes'][_0x76a4('0x3c')]?_0x51f8b7[_0x76a4('0x3a')]:_0x193ad1['model'];if(_0x442431[_0x76a4('0x35')][_0x76a4('0x44')]){_0x51f8b7['include']=[{'all':!![]}];}_0x51f8b7=_[_0x76a4('0x4b')]({},_0x51f8b7,_0x442431[_0x76a4('0x43')]);return db[_0x76a4('0x31')][_0x76a4('0x4c')](_0x51f8b7)['then'](handleEntityNotFound(_0x26ed8f,null))[_0x76a4('0x26')](respondWithResult(_0x26ed8f,null))['catch'](handleError(_0x26ed8f,null));};exports['create']=function(_0x4275ff,_0x1dea2d){return db[_0x76a4('0x31')][_0x76a4('0x4d')](_0x4275ff[_0x76a4('0x4e')],{})[_0x76a4('0x26')](function(_0x5687b3){var _0x180761=_0x4275ff[_0x76a4('0x4f')][_0x76a4('0x27')]({'plain':!![]});if(!_0x180761)throw new Error(_0x76a4('0x50'));if(_0x180761[_0x76a4('0x51')]===_0x76a4('0x4f')){var _0x513325=_0x5687b3[_0x76a4('0x27')]({'plain':!![]});var _0xdf968b='IvrCampaigns';return db[_0x76a4('0x52')][_0x76a4('0x4c')]({'where':{'name':_0xdf968b,'userProfileId':_0x180761[_0x76a4('0x53')]},'raw':!![]})[_0x76a4('0x26')](function(_0x2f9abf){if(_0x2f9abf&&_0x2f9abf[_0x76a4('0x54')]===0x0){return db[_0x76a4('0x29')][_0x76a4('0x4d')]({'name':_0x513325['name'],'resourceId':_0x513325['id'],'type':_0x2f9abf[_0x76a4('0x2d')],'sectionId':_0x2f9abf['id']},{})[_0x76a4('0x26')](function(){return _0x5687b3;});}else{return _0x5687b3;}})[_0x76a4('0x48')](function(_0x2cac9c){logger[_0x76a4('0x2c')](_0x76a4('0x55'),_0x2cac9c);throw _0x2cac9c;});}return _0x5687b3;})[_0x76a4('0x26')](respondWithResult(_0x1dea2d,0xc9))[_0x76a4('0x48')](handleError(_0x1dea2d,null));};exports[_0x76a4('0x56')]=function(_0x1512b2,_0x3a6f9d){var _0x6a2ec0={'where':{'id':_0x1512b2[_0x76a4('0x4a')]['id']}},_0x576c0c={};_0x576c0c['model']=_[_0x76a4('0x36')](db[_0x76a4('0x31')][_0x76a4('0x32')]);_0x6a2ec0[_0x76a4('0x3a')]=_[_0x76a4('0x38')](_0x576c0c['model'],qs[_0x76a4('0x3b')](_0x1512b2[_0x76a4('0x35')][_0x76a4('0x3b')]));_0x6a2ec0['attributes']=_0x6a2ec0[_0x76a4('0x3a')]['length']?_0x6a2ec0['attributes']:_0x576c0c[_0x76a4('0x39')];if(_0x1512b2[_0x76a4('0x35')]['includeAll']){_0x6a2ec0[_0x76a4('0x45')]=[{'all':!![]}];}_0x6a2ec0=_[_0x76a4('0x4b')]({},_0x6a2ec0,_0x1512b2[_0x76a4('0x43')]);return db[_0x76a4('0x31')][_0x76a4('0x4c')](_0x6a2ec0)[_0x76a4('0x26')](handleEntityNotFound(_0x3a6f9d,null))[_0x76a4('0x26')](function(_0x554b83){if(_0x554b83){var _0x1a5478=_0x554b83['get']({'plain':!![]});_0x1a5478=qs[_0x76a4('0x57')](_0x1a5478,['id',_0x76a4('0x58'),_0x76a4('0x59')]);_0x1512b2[_0x76a4('0x4e')]=_[_0x76a4('0x57')](_0x1512b2[_0x76a4('0x4e')],['id',_0x76a4('0x58'),'updatedAt']);return db['Campaign'][_0x76a4('0x4d')](_[_0x76a4('0x4b')](_0x1a5478,_0x1512b2[_0x76a4('0x4e')]),{'include':_0x1512b2[_0x76a4('0x35')][_0x76a4('0x44')]?[{'all':!![]}]:undefined})[_0x76a4('0x26')](function(_0x581886){var _0x4298ba=_0x1512b2[_0x76a4('0x4f')]['get']({'plain':!![]});if(!_0x4298ba)throw new Error(_0x76a4('0x50'));if(_0x4298ba[_0x76a4('0x51')]===_0x76a4('0x4f')){var _0xc2a60b=_0x581886['get']({'plain':!![]});var _0x194ebc='IvrCampaigns';return db[_0x76a4('0x52')][_0x76a4('0x4c')]({'where':{'name':_0x194ebc,'userProfileId':_0x4298ba['userProfileId']},'raw':!![]})[_0x76a4('0x26')](function(_0x5d112a){if(_0x5d112a&&_0x5d112a[_0x76a4('0x54')]===0x0){return db['UserProfileResource'][_0x76a4('0x4d')]({'name':_0xc2a60b['name'],'resourceId':_0xc2a60b['id'],'type':_0x5d112a['name'],'sectionId':_0x5d112a['id']},{})[_0x76a4('0x26')](function(){return _0x581886;});}else{return _0x581886;}})[_0x76a4('0x48')](function(_0x396eb4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x396eb4);throw _0x396eb4;});}return _0x581886;});}})['then'](respondWithResult(_0x3a6f9d,0xc9))[_0x76a4('0x48')](handleError(_0x3a6f9d,null));};exports[_0x76a4('0x25')]=function(_0x5d1dda,_0x394a52){if(_0x5d1dda['body']['id']){delete _0x5d1dda[_0x76a4('0x4e')]['id'];}return db[_0x76a4('0x31')][_0x76a4('0x4c')]({'where':{'id':_0x5d1dda[_0x76a4('0x4a')]['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x394a52,null))['then'](saveUpdates(_0x5d1dda[_0x76a4('0x4e')],null))[_0x76a4('0x26')](respondWithResult(_0x394a52,null))[_0x76a4('0x48')](handleError(_0x394a52,null));};exports[_0x76a4('0x2a')]=function(_0x533999,_0x3c60a7){return db[_0x76a4('0x31')][_0x76a4('0x4c')]({'where':{'id':_0x533999[_0x76a4('0x4a')]['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x3c60a7,null))[_0x76a4('0x26')](removeEntity(_0x3c60a7,null))[_0x76a4('0x48')](handleError(_0x3c60a7,null));};exports[_0x76a4('0x5a')]=function(_0x45719b,_0x3eacdb,_0x401289){var _0x52c468={'raw':!![],'where':{}};var _0x39a6e4={};var _0x4972ed={'count':0x0,'rows':[]};return db[_0x76a4('0x31')][_0x76a4('0x5b')]({'where':{'id':_0x45719b[_0x76a4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3eacdb,null))[_0x76a4('0x26')](function(_0x2ec71f){if(_0x2ec71f){_0x39a6e4[_0x76a4('0x39')]=_[_0x76a4('0x36')](db[_0x76a4('0x5c')][_0x76a4('0x32')]);_0x39a6e4[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x45719b[_0x76a4('0x35')]);_0x39a6e4[_0x76a4('0x37')]=_['intersection'](_0x39a6e4[_0x76a4('0x39')],_0x39a6e4['query']);_0x52c468['attributes']=_['intersection'](_0x39a6e4['model'],qs['fields'](_0x45719b[_0x76a4('0x35')]['fields']));_0x52c468[_0x76a4('0x3a')]=_0x52c468[_0x76a4('0x3a')][_0x76a4('0x3c')]?_0x52c468[_0x76a4('0x3a')]:_0x39a6e4[_0x76a4('0x39')];if(!_0x45719b[_0x76a4('0x35')]['hasOwnProperty'](_0x76a4('0x5d'))){_0x52c468['limit']=qs[_0x76a4('0x1f')](_0x45719b['query'][_0x76a4('0x1f')]);_0x52c468[_0x76a4('0x1d')]=qs[_0x76a4('0x1d')](_0x45719b[_0x76a4('0x35')]['offset']);}_0x52c468[_0x76a4('0x3e')]=qs['sort'](_0x45719b['query'][_0x76a4('0x3f')]);_0x52c468[_0x76a4('0x40')]=qs[_0x76a4('0x37')](_[_0x76a4('0x41')](_0x45719b[_0x76a4('0x35')],_0x39a6e4[_0x76a4('0x37')]));_0x52c468[_0x76a4('0x40')][_0x76a4('0x5e')]=_0x2ec71f['id'];if(_0x45719b[_0x76a4('0x35')][_0x76a4('0x42')]){_0x52c468[_0x76a4('0x40')]=_['merge'](_0x52c468[_0x76a4('0x40')],{'$or':_[_0x76a4('0x30')](_0x52c468[_0x76a4('0x3a')],function(_0x572566){var _0x44017f={};_0x44017f[_0x572566]={'$like':'%'+_0x45719b[_0x76a4('0x35')]['filter']+'%'};return _0x44017f;})});}_0x52c468=_['merge']({},_0x52c468,_0x45719b[_0x76a4('0x43')]);return db[_0x76a4('0x5c')][_0x76a4('0x20')]({'where':_0x52c468['where']})[_0x76a4('0x26')](function(_0x5e6b39){_0x4972ed[_0x76a4('0x20')]=_0x5e6b39;if(_0x45719b[_0x76a4('0x35')][_0x76a4('0x44')]){_0x52c468[_0x76a4('0x45')]=[{'all':!![]}];}return db[_0x76a4('0x5c')][_0x76a4('0x46')](_0x52c468);})[_0x76a4('0x26')](function(_0x4d2e02){_0x4972ed[_0x76a4('0x47')]=_0x4d2e02;return _0x4972ed;});}})[_0x76a4('0x26')](respondWithFilteredResult(_0x3eacdb,_0x52c468))[_0x76a4('0x48')](handleError(_0x3eacdb,null));};exports['getHopperHistories']=function(_0x490f07,_0x2d39b8,_0xed0ab4){var _0x2ffd0b={'raw':!![],'where':{}};var _0x12ca48={};var _0x464855={'count':0x0,'rows':[]};return db[_0x76a4('0x31')]['findOne']({'where':{'id':_0x490f07[_0x76a4('0x4a')]['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x2d39b8,null))[_0x76a4('0x26')](function(_0x4bcca7){if(_0x4bcca7){_0x12ca48[_0x76a4('0x39')]=_['keys'](db[_0x76a4('0x5f')][_0x76a4('0x32')]);_0x12ca48[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x490f07['query']);_0x12ca48[_0x76a4('0x37')]=_[_0x76a4('0x38')](_0x12ca48['model'],_0x12ca48[_0x76a4('0x35')]);_0x2ffd0b['attributes']=_[_0x76a4('0x38')](_0x12ca48[_0x76a4('0x39')],qs[_0x76a4('0x3b')](_0x490f07[_0x76a4('0x35')][_0x76a4('0x3b')]));_0x2ffd0b['attributes']=_0x2ffd0b['attributes'][_0x76a4('0x3c')]?_0x2ffd0b[_0x76a4('0x3a')]:_0x12ca48[_0x76a4('0x39')];if(!_0x490f07[_0x76a4('0x35')][_0x76a4('0x3d')](_0x76a4('0x5d'))){_0x2ffd0b['limit']=qs[_0x76a4('0x1f')](_0x490f07[_0x76a4('0x35')][_0x76a4('0x1f')]);_0x2ffd0b[_0x76a4('0x1d')]=qs[_0x76a4('0x1d')](_0x490f07[_0x76a4('0x35')][_0x76a4('0x1d')]);}_0x2ffd0b[_0x76a4('0x3e')]=qs[_0x76a4('0x3f')](_0x490f07[_0x76a4('0x35')]['sort']);_0x2ffd0b[_0x76a4('0x40')]=qs[_0x76a4('0x37')](_['pick'](_0x490f07[_0x76a4('0x35')],_0x12ca48['filters']));_0x2ffd0b['where'][_0x76a4('0x5e')]=_0x4bcca7['id'];if(_0x490f07['query'][_0x76a4('0x42')]){_0x2ffd0b[_0x76a4('0x40')]=_['merge'](_0x2ffd0b['where'],{'$or':_[_0x76a4('0x30')](_0x2ffd0b[_0x76a4('0x3a')],function(_0x5b5db8){var _0x4160d1={};_0x4160d1[_0x5b5db8]={'$like':'%'+_0x490f07[_0x76a4('0x35')][_0x76a4('0x42')]+'%'};return _0x4160d1;})});}_0x2ffd0b=_[_0x76a4('0x4b')]({},_0x2ffd0b,_0x490f07[_0x76a4('0x43')]);return db['CmHopperHistory'][_0x76a4('0x20')]({'where':_0x2ffd0b[_0x76a4('0x40')]})[_0x76a4('0x26')](function(_0x2e8399){_0x464855['count']=_0x2e8399;if(_0x490f07['query']['includeAll']){_0x2ffd0b[_0x76a4('0x45')]=[{'all':!![]}];}return db[_0x76a4('0x5f')][_0x76a4('0x46')](_0x2ffd0b);})[_0x76a4('0x26')](function(_0x66b40){_0x464855[_0x76a4('0x47')]=_0x66b40;return _0x464855;});}})[_0x76a4('0x26')](respondWithFilteredResult(_0x2d39b8,_0x2ffd0b))[_0x76a4('0x48')](handleError(_0x2d39b8,null));};exports[_0x76a4('0x60')]=function(_0x280e10,_0x5c27e0,_0xa49a50){var _0x44c0f3={'raw':!![],'where':{}};var _0xe9fd35={};var _0x231c5a={'count':0x0,'rows':[]};return db['Campaign'][_0x76a4('0x5b')]({'where':{'id':_0x280e10[_0x76a4('0x4a')]['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x5c27e0,null))[_0x76a4('0x26')](function(_0x5b5268){if(_0x5b5268){_0xe9fd35[_0x76a4('0x39')]=_['keys'](db[_0x76a4('0x61')][_0x76a4('0x32')]);_0xe9fd35[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x280e10[_0x76a4('0x35')]);_0xe9fd35['filters']=_[_0x76a4('0x38')](_0xe9fd35[_0x76a4('0x39')],_0xe9fd35[_0x76a4('0x35')]);_0x44c0f3[_0x76a4('0x3a')]=_['intersection'](_0xe9fd35['model'],qs['fields'](_0x280e10['query'][_0x76a4('0x3b')]));_0x44c0f3[_0x76a4('0x3a')]=_0x44c0f3[_0x76a4('0x3a')][_0x76a4('0x3c')]?_0x44c0f3[_0x76a4('0x3a')]:_0xe9fd35[_0x76a4('0x39')];if(!_0x280e10[_0x76a4('0x35')][_0x76a4('0x3d')]('nolimit')){_0x44c0f3[_0x76a4('0x1f')]=qs[_0x76a4('0x1f')](_0x280e10['query'][_0x76a4('0x1f')]);_0x44c0f3[_0x76a4('0x1d')]=qs[_0x76a4('0x1d')](_0x280e10['query'][_0x76a4('0x1d')]);}_0x44c0f3['order']=qs[_0x76a4('0x3f')](_0x280e10[_0x76a4('0x35')][_0x76a4('0x3f')]);_0x44c0f3[_0x76a4('0x40')]=qs[_0x76a4('0x37')](_[_0x76a4('0x41')](_0x280e10[_0x76a4('0x35')],_0xe9fd35[_0x76a4('0x37')]));_0x44c0f3[_0x76a4('0x40')][_0x76a4('0x5e')]=_0x5b5268['id'];if(_0x280e10[_0x76a4('0x35')][_0x76a4('0x42')]){_0x44c0f3['where']=_['merge'](_0x44c0f3[_0x76a4('0x40')],{'$or':_[_0x76a4('0x30')](_0x44c0f3['attributes'],function(_0x459c23){var _0xb00b69={};_0xb00b69[_0x459c23]={'$like':'%'+_0x280e10['query'][_0x76a4('0x42')]+'%'};return _0xb00b69;})});}_0x44c0f3=_[_0x76a4('0x4b')]({},_0x44c0f3,_0x280e10[_0x76a4('0x43')]);return db[_0x76a4('0x61')]['count']({'where':_0x44c0f3[_0x76a4('0x40')]})[_0x76a4('0x26')](function(_0x78152b){_0x231c5a[_0x76a4('0x20')]=_0x78152b;if(_0x280e10['query'][_0x76a4('0x44')]){_0x44c0f3[_0x76a4('0x45')]=[{'all':!![]}];}return db[_0x76a4('0x61')][_0x76a4('0x46')](_0x44c0f3);})[_0x76a4('0x26')](function(_0x2828aa){_0x231c5a['rows']=_0x2828aa;return _0x231c5a;});}})['then'](respondWithFilteredResult(_0x5c27e0,_0x44c0f3))[_0x76a4('0x48')](handleError(_0x5c27e0,null));};exports[_0x76a4('0x62')]=function(_0x7e94bf,_0x1c4dd5,_0x52482c){var _0x448fec={'raw':!![],'where':{}};var _0x519bf6={};var _0x22fd87={'count':0x0,'rows':[]};return db[_0x76a4('0x31')][_0x76a4('0x5b')]({'where':{'id':_0x7e94bf[_0x76a4('0x4a')]['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x1c4dd5,null))[_0x76a4('0x26')](function(_0x574e4e){if(_0x574e4e){_0x519bf6[_0x76a4('0x39')]=_['keys'](db['CmHopperBlack'][_0x76a4('0x32')]);_0x519bf6[_0x76a4('0x35')]=_['keys'](_0x7e94bf[_0x76a4('0x35')]);_0x519bf6[_0x76a4('0x37')]=_['intersection'](_0x519bf6[_0x76a4('0x39')],_0x519bf6[_0x76a4('0x35')]);_0x448fec[_0x76a4('0x3a')]=_['intersection'](_0x519bf6[_0x76a4('0x39')],qs[_0x76a4('0x3b')](_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x3b')]));_0x448fec[_0x76a4('0x3a')]=_0x448fec['attributes'][_0x76a4('0x3c')]?_0x448fec['attributes']:_0x519bf6[_0x76a4('0x39')];if(!_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x3d')](_0x76a4('0x5d'))){_0x448fec[_0x76a4('0x1f')]=qs['limit'](_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x1f')]);_0x448fec[_0x76a4('0x1d')]=qs[_0x76a4('0x1d')](_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x1d')]);}_0x448fec['order']=qs[_0x76a4('0x3f')](_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x3f')]);_0x448fec[_0x76a4('0x40')]=qs['filters'](_[_0x76a4('0x41')](_0x7e94bf[_0x76a4('0x35')],_0x519bf6['filters']));_0x448fec[_0x76a4('0x40')][_0x76a4('0x5e')]=_0x574e4e['id'];if(_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x42')]){_0x448fec[_0x76a4('0x40')]=_[_0x76a4('0x4b')](_0x448fec[_0x76a4('0x40')],{'$or':_['map'](_0x448fec['attributes'],function(_0x18f4f7){var _0x5e3e70={};_0x5e3e70[_0x18f4f7]={'$like':'%'+_0x7e94bf[_0x76a4('0x35')]['filter']+'%'};return _0x5e3e70;})});}_0x448fec=_[_0x76a4('0x4b')]({},_0x448fec,_0x7e94bf[_0x76a4('0x43')]);return db[_0x76a4('0x63')][_0x76a4('0x20')]({'where':_0x448fec[_0x76a4('0x40')]})['then'](function(_0x55e39c){_0x22fd87['count']=_0x55e39c;if(_0x7e94bf[_0x76a4('0x35')][_0x76a4('0x44')]){_0x448fec[_0x76a4('0x45')]=[{'all':!![]}];}return db[_0x76a4('0x63')][_0x76a4('0x46')](_0x448fec);})[_0x76a4('0x26')](function(_0x1923a8){_0x22fd87['rows']=_0x1923a8;return _0x22fd87;});}})[_0x76a4('0x26')](respondWithFilteredResult(_0x1c4dd5,_0x448fec))[_0x76a4('0x48')](handleError(_0x1c4dd5,null));};exports['getLists']=function(_0x4f0aa2,_0x11bcba,_0x1b0c2e){var _0x1ca3a0={};var _0x24fcd1={};var _0xb26574;var _0xfe873;return db['Campaign']['findOne']({'where':{'id':_0x4f0aa2['params']['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x11bcba,null))[_0x76a4('0x26')](function(_0x2cbfbd){if(_0x2cbfbd){_0xb26574=_0x2cbfbd;_0x24fcd1[_0x76a4('0x39')]=_[_0x76a4('0x36')](db[_0x76a4('0x64')]['rawAttributes']);_0x24fcd1[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x4f0aa2['query']);_0x24fcd1[_0x76a4('0x37')]=_[_0x76a4('0x38')](_0x24fcd1['model'],_0x24fcd1[_0x76a4('0x35')]);_0x1ca3a0[_0x76a4('0x3a')]=_['intersection'](_0x24fcd1[_0x76a4('0x39')],qs[_0x76a4('0x3b')](_0x4f0aa2['query'][_0x76a4('0x3b')]));_0x1ca3a0['attributes']=_0x1ca3a0[_0x76a4('0x3a')][_0x76a4('0x3c')]?_0x1ca3a0[_0x76a4('0x3a')]:_0x24fcd1[_0x76a4('0x39')];_0x1ca3a0[_0x76a4('0x3e')]=qs[_0x76a4('0x3f')](_0x4f0aa2[_0x76a4('0x35')][_0x76a4('0x3f')]);_0x1ca3a0[_0x76a4('0x40')]=qs['filters'](_[_0x76a4('0x41')](_0x4f0aa2[_0x76a4('0x35')],_0x24fcd1[_0x76a4('0x37')]));if(_0x4f0aa2[_0x76a4('0x35')][_0x76a4('0x42')]){_0x1ca3a0[_0x76a4('0x40')]=_[_0x76a4('0x4b')](_0x1ca3a0[_0x76a4('0x40')],{'$or':_[_0x76a4('0x30')](_0x1ca3a0['attributes'],function(_0x2b0cad){var _0xb9c2ce={};_0xb9c2ce[_0x2b0cad]={'$like':'%'+_0x4f0aa2[_0x76a4('0x35')]['filter']+'%'};return _0xb9c2ce;})});}_0x1ca3a0=_['merge']({},_0x1ca3a0,_0x4f0aa2['options']);return _0xb26574[_0x76a4('0x65')](_0x1ca3a0);}})['then'](function(_0x10dd3f){if(_0x10dd3f){_0xfe873=_0x10dd3f[_0x76a4('0x3c')];if(!_0x4f0aa2[_0x76a4('0x35')][_0x76a4('0x3d')](_0x76a4('0x5d'))){_0x1ca3a0[_0x76a4('0x1f')]=qs[_0x76a4('0x1f')](_0x4f0aa2[_0x76a4('0x35')][_0x76a4('0x1f')]);_0x1ca3a0[_0x76a4('0x1d')]=qs['offset'](_0x4f0aa2[_0x76a4('0x35')][_0x76a4('0x1d')]);}return _0xb26574['getLists'](_0x1ca3a0);}})[_0x76a4('0x26')](function(_0xeb9dd5){if(_0xeb9dd5){return _0xeb9dd5?{'count':_0xfe873,'rows':_0xeb9dd5}:null;}})['then'](respondWithResult(_0x11bcba,null))[_0x76a4('0x48')](handleError(_0x11bcba,null));};exports['addLists']=function(_0xc1abde,_0x5184de,_0x2e8095){var _0x3e0d0b,_0x18bf06;var _0x529699=[];var _0x294ebe=moment()[_0x76a4('0x66')](_0x76a4('0x67'));return db[_0x76a4('0x31')]['find']({'where':{'id':_0xc1abde['params']['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x5184de,null))[_0x76a4('0x26')](function(_0x24278c){if(_0x24278c){_0x18bf06=_0x24278c;return _0x24278c[_0x76a4('0x68')](_0xc1abde[_0x76a4('0x4e')][_0x76a4('0x69')],_['omit'](_0xc1abde[_0x76a4('0x4e')],[_0x76a4('0x69'),'id'])||{});}return null;})[_0x76a4('0x6a')](function(_0xa161a4){var _0x351c9f;var _0xb948a9;_0x3e0d0b=_0xa161a4||[];var _0x5e58da=[];if(_0xa161a4){for(var _0x23a24e=0x0;_0x23a24e<_0xa161a4[_0x76a4('0x3c')];_0x23a24e+=0x1){var _0x39b005=_0xa161a4[_0x23a24e][_0x76a4('0x27')]({'plain':!![]});_0x18bf06[_0x76a4('0x6b')]=_0xc1abde[_0x76a4('0x4e')][_0x76a4('0x6b')]?_0xc1abde['body'][_0x76a4('0x6b')]:_0x18bf06[_0x76a4('0x6b')];switch(_0x18bf06[_0x76a4('0x6b')]){case _0x76a4('0x6c'):_0x351c9f=squel[_0x76a4('0x6d')]()[_0x76a4('0x6e')]('cm_hopper')['fromQuery']([_0x76a4('0x6f'),_0x76a4('0x70'),_0x76a4('0x71'),'ListId',_0x76a4('0x5e'),_0x76a4('0x58'),'updatedAt'],squel[_0x76a4('0x72')]()[_0x76a4('0x73')](_0x76a4('0x6f'),'phone')[_0x76a4('0x73')](_0x76a4('0x74'),_0x76a4('0x70'))[_0x76a4('0x73')]('id',_0x76a4('0x71'))[_0x76a4('0x73')](_0x39b005['CmListId']['toString'](),'ListId')[_0x76a4('0x73')](_0xc1abde['params']['id'][_0x76a4('0x75')](),_0x76a4('0x5e'))[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27',_0x76a4('0x58'))[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27',_0x76a4('0x59'))[_0x76a4('0x76')](_0x76a4('0x77'))[_0x76a4('0x40')](_0x76a4('0x78'))[_0x76a4('0x40')](_0x76a4('0x79'),_0x39b005[_0x76a4('0x7a')]['toString']())[_0x76a4('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x76a4('0x40')](_0x76a4('0x7b'),squel[_0x76a4('0x72')]()[_0x76a4('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x76a4('0x76')]('cm_hopper_final')[_0x76a4('0x40')]('CampaignId\x20=\x20?',_0xc1abde[_0x76a4('0x4a')]['id'][_0x76a4('0x75')]()))['where'](_0x76a4('0x7b'),squel[_0x76a4('0x72')]()[_0x76a4('0x73')](_0x76a4('0x7c'))[_0x76a4('0x76')]('cm_hopper')['where'](_0x76a4('0x7d'),_0xc1abde[_0x76a4('0x4a')]['id']['toString']())))[_0x76a4('0x75')]();break;case _0x76a4('0x7e'):_0x351c9f=squel['insert']()[_0x76a4('0x6e')](_0x76a4('0x7f'))[_0x76a4('0x80')](['phone',_0x76a4('0x70'),_0x76a4('0x71'),_0x76a4('0x81'),_0x76a4('0x5e'),_0x76a4('0x58'),'updatedAt'],squel[_0x76a4('0x72')]()[_0x76a4('0x73')](_0x76a4('0x6f'),_0x76a4('0x6f'))[_0x76a4('0x73')](_0x76a4('0x74'),'scheduledAt')['field']('id',_0x76a4('0x71'))[_0x76a4('0x73')](_0x39b005['CmListId'][_0x76a4('0x75')](),'ListId')[_0x76a4('0x73')](_0xc1abde['params']['id'][_0x76a4('0x75')](),_0x76a4('0x5e'))[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27',_0x76a4('0x58'))[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27','updatedAt')[_0x76a4('0x76')](_0x76a4('0x77'))['where'](_0x76a4('0x78'))[_0x76a4('0x40')]('ListId\x20=\x20?',_0x39b005['CmListId']['toString']())[_0x76a4('0x40')](_0x76a4('0x82'))[_0x76a4('0x40')](_0x76a4('0x7b'),squel[_0x76a4('0x72')]()[_0x76a4('0x73')](_0x76a4('0x7c'))[_0x76a4('0x76')](_0x76a4('0x7f'))[_0x76a4('0x40')]('CampaignId\x20=\x20?',_0xc1abde[_0x76a4('0x4a')]['id'][_0x76a4('0x75')]())))['toString']();break;default:_0x351c9f=squel[_0x76a4('0x6d')]()[_0x76a4('0x6e')](_0x76a4('0x7f'))[_0x76a4('0x80')]([_0x76a4('0x6f'),_0x76a4('0x70'),_0x76a4('0x71'),'ListId','CampaignId',_0x76a4('0x58'),'updatedAt'],squel['select']()['field'](_0x76a4('0x6f'),_0x76a4('0x6f'))[_0x76a4('0x73')]('NOW()',_0x76a4('0x70'))['field']('id','ContactId')[_0x76a4('0x73')](_0x39b005[_0x76a4('0x7a')][_0x76a4('0x75')](),_0x76a4('0x81'))[_0x76a4('0x73')](_0xc1abde[_0x76a4('0x4a')]['id'][_0x76a4('0x75')](),'CampaignId')[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27','createdAt')[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27','updatedAt')[_0x76a4('0x76')]('cm_contacts')[_0x76a4('0x40')](_0x76a4('0x78'))[_0x76a4('0x40')]('ListId\x20=\x20?',_0x39b005[_0x76a4('0x7a')]['toString']())[_0x76a4('0x40')](_0x76a4('0x82')))[_0x76a4('0x75')]();}_0xb948a9=squel[_0x76a4('0x6d')]()[_0x76a4('0x6e')](_0x76a4('0x83'))[_0x76a4('0x80')](['cmHopperId','scheduledAt',_0x76a4('0x6f'),_0x76a4('0x84'),_0x76a4('0x58'),_0x76a4('0x59')],squel['select']()['field'](_0x76a4('0x85'),'id')[_0x76a4('0x73')]('NOW()',_0x76a4('0x70'))[_0x76a4('0x73')](_0x76a4('0x86'),_0x76a4('0x6f'))[_0x76a4('0x73')]('ci.OrderBY','OrderBy')['field']('\x27'+_0x294ebe+'\x27','createdAt')[_0x76a4('0x73')]('\x27'+_0x294ebe+'\x27',_0x76a4('0x59'))['from'](_0x76a4('0x87'),'ci')[_0x76a4('0x88')](_0x76a4('0x7f'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x76a4('0x40')](_0x76a4('0x89'),_0x39b005[_0x76a4('0x7a')][_0x76a4('0x75')]())[_0x76a4('0x40')](_0x76a4('0x8a'),_0xc1abde[_0x76a4('0x4a')]['id'][_0x76a4('0x75')]())[_0x76a4('0x40')](_0x76a4('0x8b'),_0x294ebe))[_0x76a4('0x75')]();_0x5e58da[_0x76a4('0x8c')](db['sequelize'][_0x76a4('0x35')](_0x351c9f));_0x529699[_0x76a4('0x8c')](db[_0x76a4('0x8d')][_0x76a4('0x35')](_0xb948a9));}return BPromise[_0x76a4('0x8e')](_0x5e58da);}})[_0x76a4('0x26')](function(){return BPromise['all'](_0x529699);})[_0x76a4('0x26')](function(){return _0x3e0d0b;})[_0x76a4('0x26')](respondWithResult(_0x5184de,null))['catch'](handleError(_0x5184de,null));};exports[_0x76a4('0x8f')]=function(_0x450518,_0x139892,_0x2a01e4){return db['Campaign'][_0x76a4('0x4c')]({'where':{'id':_0x450518[_0x76a4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x139892,null))[_0x76a4('0x26')](function(_0xf7c07a){if(_0xf7c07a){return _0xf7c07a[_0x76a4('0x8f')](_0x450518[_0x76a4('0x35')]['ids']);}})[_0x76a4('0x26')](function(_0x1aa7f0){if(_0x1aa7f0){return db['CmHopper'][_0x76a4('0x2a')]({'where':{'ListId':_0x450518[_0x76a4('0x35')][_0x76a4('0x69')],'CampaignId':_0x450518['params']['id']}})[_0x76a4('0x26')](function(){return _0x1aa7f0;});}})[_0x76a4('0x26')](respondWithStatusCode(_0x139892,null))[_0x76a4('0x48')](handleError(_0x139892,null));};exports['getBlackLists']=function(_0x3110f5,_0x2f2fe2,_0x745983){var _0x5c808d={};var _0x543219={};var _0x4db85d;var _0x100da3;return db[_0x76a4('0x31')]['findOne']({'where':{'id':_0x3110f5[_0x76a4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2f2fe2,null))[_0x76a4('0x26')](function(_0x5f0167){if(_0x5f0167){_0x4db85d=_0x5f0167;_0x543219[_0x76a4('0x39')]=_[_0x76a4('0x36')](db[_0x76a4('0x64')]['rawAttributes']);_0x543219[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x3110f5[_0x76a4('0x35')]);_0x543219[_0x76a4('0x37')]=_[_0x76a4('0x38')](_0x543219[_0x76a4('0x39')],_0x543219[_0x76a4('0x35')]);_0x5c808d['attributes']=_[_0x76a4('0x38')](_0x543219[_0x76a4('0x39')],qs['fields'](_0x3110f5[_0x76a4('0x35')][_0x76a4('0x3b')]));_0x5c808d['attributes']=_0x5c808d[_0x76a4('0x3a')][_0x76a4('0x3c')]?_0x5c808d[_0x76a4('0x3a')]:_0x543219['model'];_0x5c808d[_0x76a4('0x3e')]=qs[_0x76a4('0x3f')](_0x3110f5[_0x76a4('0x35')]['sort']);_0x5c808d[_0x76a4('0x40')]=qs[_0x76a4('0x37')](_[_0x76a4('0x41')](_0x3110f5[_0x76a4('0x35')],_0x543219[_0x76a4('0x37')]));if(_0x3110f5[_0x76a4('0x35')][_0x76a4('0x42')]){_0x5c808d[_0x76a4('0x40')]=_[_0x76a4('0x4b')](_0x5c808d[_0x76a4('0x40')],{'$or':_['map'](_0x5c808d[_0x76a4('0x3a')],function(_0x522f64){var _0x417a7d={};_0x417a7d[_0x522f64]={'$like':'%'+_0x3110f5[_0x76a4('0x35')][_0x76a4('0x42')]+'%'};return _0x417a7d;})});}_0x5c808d=_[_0x76a4('0x4b')]({},_0x5c808d,_0x3110f5[_0x76a4('0x43')]);return _0x4db85d['getBlackLists'](_0x5c808d);}})[_0x76a4('0x26')](function(_0x2b116a){if(_0x2b116a){_0x100da3=_0x2b116a[_0x76a4('0x3c')];if(!_0x3110f5[_0x76a4('0x35')]['hasOwnProperty'](_0x76a4('0x5d'))){_0x5c808d[_0x76a4('0x1f')]=qs[_0x76a4('0x1f')](_0x3110f5['query']['limit']);_0x5c808d['offset']=qs[_0x76a4('0x1d')](_0x3110f5['query']['offset']);}return _0x4db85d[_0x76a4('0x90')](_0x5c808d);}})[_0x76a4('0x26')](function(_0x2094ed){if(_0x2094ed){return _0x2094ed?{'count':_0x100da3,'rows':_0x2094ed}:null;}})['then'](respondWithResult(_0x2f2fe2,null))[_0x76a4('0x48')](handleError(_0x2f2fe2,null));};exports[_0x76a4('0x91')]=function(_0x29c2ab,_0x2a204a,_0x18cdaa){var _0x3a7c01,_0xc07122;var _0x30c180=[];var _0x1834f3=moment()[_0x76a4('0x66')](_0x76a4('0x67'));return db[_0x76a4('0x31')][_0x76a4('0x4c')]({'where':{'id':_0x29c2ab[_0x76a4('0x4a')]['id']}})[_0x76a4('0x26')](handleEntityNotFound(_0x2a204a,null))[_0x76a4('0x26')](function(_0x51f367){if(_0x51f367){_0xc07122=_0x51f367;return _0x51f367[_0x76a4('0x91')](_0x29c2ab[_0x76a4('0x4e')][_0x76a4('0x69')],_[_0x76a4('0x57')](_0x29c2ab[_0x76a4('0x4e')],[_0x76a4('0x69'),'id'])||{});}return null;})[_0x76a4('0x6a')](function(_0x528ae2){var _0xcd1023;var _0x123d0a;_0x3a7c01=_0x528ae2||[];var _0x46433e=[];if(_0x528ae2){for(var _0x5a2b88=0x0;_0x5a2b88<_0x528ae2['length'];_0x5a2b88+=0x1){var _0x347f68=_0x528ae2[_0x5a2b88]['get']({'plain':!![]});_0xcd1023=squel[_0x76a4('0x6d')]()[_0x76a4('0x6e')](_0x76a4('0x92'))['fromQuery']([_0x76a4('0x6f'),_0x76a4('0x71'),'ListId',_0x76a4('0x5e'),_0x76a4('0x58'),'updatedAt'],squel[_0x76a4('0x72')]()['field'](_0x76a4('0x6f'),_0x76a4('0x6f'))[_0x76a4('0x73')]('id',_0x76a4('0x71'))[_0x76a4('0x73')](_0x347f68['CmListId'][_0x76a4('0x75')](),_0x76a4('0x81'))[_0x76a4('0x73')](_0x29c2ab[_0x76a4('0x4a')]['id'][_0x76a4('0x75')](),_0x76a4('0x5e'))[_0x76a4('0x73')](_0x76a4('0x74'),_0x76a4('0x58'))[_0x76a4('0x73')]('NOW()',_0x76a4('0x59'))['from'](_0x76a4('0x77'))[_0x76a4('0x40')](_0x76a4('0x78'))['where'](_0x76a4('0x79'),_0x347f68[_0x76a4('0x7a')][_0x76a4('0x75')]())[_0x76a4('0x40')](_0x76a4('0x82')))[_0x76a4('0x75')]();_0x46433e[_0x76a4('0x8c')](db[_0x76a4('0x8d')]['query'](_0xcd1023));}return BPromise[_0x76a4('0x8e')](_0x46433e);}})[_0x76a4('0x26')](function(){return _0x3a7c01;})[_0x76a4('0x26')](respondWithResult(_0x2a204a,null))[_0x76a4('0x48')](handleError(_0x2a204a,null));};exports[_0x76a4('0x93')]=function(_0x5114a0,_0x2d8f1a,_0xdf273b){return db[_0x76a4('0x31')][_0x76a4('0x4c')]({'where':{'id':_0x5114a0['params']['id']}})['then'](handleEntityNotFound(_0x2d8f1a,null))[_0x76a4('0x26')](function(_0xa23a02){if(_0xa23a02){return _0xa23a02[_0x76a4('0x93')](_0x5114a0[_0x76a4('0x35')][_0x76a4('0x69')]);}})[_0x76a4('0x26')](function(_0x27502d){if(_0x27502d){return db[_0x76a4('0x63')]['destroy']({'where':{'ListId':_0x5114a0[_0x76a4('0x35')][_0x76a4('0x69')],'CampaignId':_0x5114a0['params']['id']}})['then'](function(){return _0x27502d;});}})[_0x76a4('0x26')](respondWithStatusCode(_0x2d8f1a,null))[_0x76a4('0x48')](handleError(_0x2d8f1a,null));}; \ No newline at end of file +var _0x7543=['createdAt','updatedAt','role','userProfileId','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','include','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into','cm_hopper','scheduledAt','ContactId','ListId','select','field','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','fromQuery','NOW()','ListId\x20=\x20?','cmHopperId','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','status','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','Campaign','includeAll','rows','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7543,0xca));var _0x3754=function(_0x2052cc,_0x4f76dc){_0x2052cc=_0x2052cc-0x0;var _0x58609f=_0x7543[_0x2052cc];return _0x58609f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3754('0x0'));var zipdir=require(_0x3754('0x1'));var jsonpatch=require(_0x3754('0x2'));var rp=require(_0x3754('0x3'));var moment=require(_0x3754('0x4'));var BPromise=require(_0x3754('0x5'));var Mustache=require(_0x3754('0x6'));var util=require(_0x3754('0x7'));var path=require(_0x3754('0x8'));var sox=require(_0x3754('0x9'));var csv=require(_0x3754('0xa'));var ejs=require(_0x3754('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3754('0xc'));var squel=require(_0x3754('0xd'));var crypto=require(_0x3754('0xe'));var jsforce=require(_0x3754('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3754('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3754('0x10'));var authService=require(_0x3754('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3754('0x12'));var hardwareService=require(_0x3754('0x13'));var logger=require(_0x3754('0x14'))(_0x3754('0x15'));var utils=require(_0x3754('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3754('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318523,_0x416fd8){_0x416fd8=_0x416fd8||0xcc;return function(_0x4879da){if(_0x4879da){return _0x318523['sendStatus'](_0x416fd8);}return _0x318523['status'](_0x416fd8)['end']();};}function respondWithResult(_0x367e4a,_0x5c5152){_0x5c5152=_0x5c5152||0xc8;return function(_0x46d0e3){if(_0x46d0e3){return _0x367e4a['status'](_0x5c5152)[_0x3754('0x18')](_0x46d0e3);}};}function respondWithFilteredResult(_0x24a2a5,_0x5cb2a5){return function(_0x89d91f){if(_0x89d91f){var _0x5ce0d0=typeof _0x5cb2a5[_0x3754('0x19')]===_0x3754('0x1a')&&typeof _0x5cb2a5[_0x3754('0x1b')]===_0x3754('0x1a');var _0x208200=_0x89d91f[_0x3754('0x1c')];var _0x571225=_0x5ce0d0?0x0:_0x5cb2a5[_0x3754('0x19')];var _0x4983cc=_0x5ce0d0?_0x89d91f[_0x3754('0x1c')]:_0x5cb2a5['offset']+_0x5cb2a5[_0x3754('0x1b')];var _0x36f2b1;if(_0x4983cc>=_0x208200){_0x4983cc=_0x208200;_0x36f2b1=0xc8;}else{_0x36f2b1=0xce;}_0x24a2a5['status'](_0x36f2b1);return _0x24a2a5[_0x3754('0x1d')](_0x3754('0x1e'),_0x571225+'-'+_0x4983cc+'/'+_0x208200)[_0x3754('0x18')](_0x89d91f);}return null;};}function patchUpdates(_0x5762cc){return function(_0x31999f){try{jsonpatch[_0x3754('0x1f')](_0x31999f,_0x5762cc,!![]);}catch(_0xbe0cfc){return BPromise[_0x3754('0x20')](_0xbe0cfc);}return _0x31999f['save']();};}function saveUpdates(_0x1d3f2f,_0x24bd78){return function(_0x20ed49){if(_0x20ed49){return _0x20ed49[_0x3754('0x21')](_0x1d3f2f)[_0x3754('0x22')](function(_0x41e49d){return _0x41e49d;});}return null;};}function removeEntity(_0x17ce16,_0x4ff03d){return function(_0x2751f1){if(_0x2751f1){return _0x2751f1[_0x3754('0x23')]()['then'](function(){var _0x43a878=_0x2751f1[_0x3754('0x24')]({'plain':!![]});var _0x1ca092=_0x3754('0x25');return db[_0x3754('0x26')][_0x3754('0x23')]({'where':{'type':_0x1ca092,'resourceId':_0x43a878['id']}})[_0x3754('0x22')](function(){return _0x2751f1;});})['then'](function(){_0x17ce16[_0x3754('0x27')](0xcc)[_0x3754('0x28')]();});}};}function handleEntityNotFound(_0x78f082,_0x16d172){return function(_0x510783){if(!_0x510783){_0x78f082[_0x3754('0x29')](0x194);}return _0x510783;};}function handleError(_0x29c3b9,_0x2a4d0c){_0x2a4d0c=_0x2a4d0c||0x1f4;return function(_0x27a327){logger[_0x3754('0x2a')](_0x27a327[_0x3754('0x2b')]);if(_0x27a327['name']){delete _0x27a327[_0x3754('0x2c')];}_0x29c3b9[_0x3754('0x27')](_0x2a4d0c)[_0x3754('0x2d')](_0x27a327);};}exports[_0x3754('0x2e')]=function(_0x335f4e,_0x181977){var _0x5311a6={},_0x578958={},_0x2fe498={'count':0x0,'rows':[]};var _0x1688eb=_[_0x3754('0x2f')](db['Campaign'][_0x3754('0x30')],function(_0x48426c){return{'name':_0x48426c[_0x3754('0x31')],'type':_0x48426c[_0x3754('0x32')][_0x3754('0x33')]};});_0x578958[_0x3754('0x34')]=_[_0x3754('0x2f')](_0x1688eb,_0x3754('0x2c'));_0x578958[_0x3754('0x35')]=_['keys'](_0x335f4e[_0x3754('0x35')]);_0x578958['filters']=_[_0x3754('0x36')](_0x578958['model'],_0x578958[_0x3754('0x35')]);_0x5311a6[_0x3754('0x37')]=_[_0x3754('0x36')](_0x578958[_0x3754('0x34')],qs[_0x3754('0x38')](_0x335f4e['query'][_0x3754('0x38')]));_0x5311a6[_0x3754('0x37')]=_0x5311a6[_0x3754('0x37')][_0x3754('0x39')]?_0x5311a6[_0x3754('0x37')]:_0x578958[_0x3754('0x34')];if(!_0x335f4e[_0x3754('0x35')][_0x3754('0x3a')](_0x3754('0x3b'))){_0x5311a6[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x335f4e['query'][_0x3754('0x1b')]);_0x5311a6[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x335f4e[_0x3754('0x35')][_0x3754('0x19')]);}_0x5311a6[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x335f4e[_0x3754('0x35')][_0x3754('0x3d')]);_0x5311a6[_0x3754('0x3e')]=qs[_0x3754('0x3f')](_[_0x3754('0x40')](_0x335f4e[_0x3754('0x35')],_0x578958[_0x3754('0x3f')]),_0x1688eb);if(_0x335f4e[_0x3754('0x35')]['filter']){_0x5311a6[_0x3754('0x3e')]=_[_0x3754('0x41')](_0x5311a6[_0x3754('0x3e')],{'$or':_['map'](_0x1688eb,function(_0xa95b07){if(_0xa95b07['type']!=='VIRTUAL'){var _0x55c205={};_0x55c205[_0xa95b07['name']]={'$like':'%'+_0x335f4e[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x55c205;}})});}_0x5311a6=_[_0x3754('0x41')]({},_0x5311a6,_0x335f4e[_0x3754('0x43')]);var _0x3a60c5={'where':_0x5311a6[_0x3754('0x3e')]};return db[_0x3754('0x44')][_0x3754('0x1c')](_0x3a60c5)['then'](function(_0x54bd3a){_0x2fe498[_0x3754('0x1c')]=_0x54bd3a;if(_0x335f4e[_0x3754('0x35')][_0x3754('0x45')]){_0x5311a6['include']=[{'all':!![]}];}return db[_0x3754('0x44')]['findAll'](_0x5311a6);})[_0x3754('0x22')](function(_0x5e41c4){_0x2fe498[_0x3754('0x46')]=_0x5e41c4;return _0x2fe498;})[_0x3754('0x22')](respondWithFilteredResult(_0x181977,_0x5311a6))['catch'](handleError(_0x181977,null));};exports['show']=function(_0x1b4f9c,_0x3e54b7){var _0x3b881e={'raw':![],'where':{'id':_0x1b4f9c[_0x3754('0x47')]['id']}},_0x2b06e1={};_0x2b06e1[_0x3754('0x34')]=_[_0x3754('0x48')](db[_0x3754('0x44')][_0x3754('0x30')]);_0x2b06e1['query']=_['keys'](_0x1b4f9c[_0x3754('0x35')]);_0x2b06e1[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x2b06e1['model'],_0x2b06e1[_0x3754('0x35')]);_0x3b881e['attributes']=_[_0x3754('0x36')](_0x2b06e1[_0x3754('0x34')],qs[_0x3754('0x38')](_0x1b4f9c[_0x3754('0x35')][_0x3754('0x38')]));_0x3b881e[_0x3754('0x37')]=_0x3b881e[_0x3754('0x37')][_0x3754('0x39')]?_0x3b881e[_0x3754('0x37')]:_0x2b06e1[_0x3754('0x34')];if(_0x1b4f9c[_0x3754('0x35')][_0x3754('0x45')]){_0x3b881e['include']=[{'all':!![]}];}_0x3b881e=_['merge']({},_0x3b881e,_0x1b4f9c[_0x3754('0x43')]);return db['Campaign'][_0x3754('0x49')](_0x3b881e)[_0x3754('0x22')](handleEntityNotFound(_0x3e54b7,null))['then'](respondWithResult(_0x3e54b7,null))[_0x3754('0x4a')](handleError(_0x3e54b7,null));};exports[_0x3754('0x4b')]=function(_0xad7f3a,_0x4d9d89){return db[_0x3754('0x44')]['create'](_0xad7f3a[_0x3754('0x4c')],{})[_0x3754('0x22')](function(_0x4648d1){var _0x440893=_0xad7f3a[_0x3754('0x4d')][_0x3754('0x24')]({'plain':!![]});if(!_0x440893)throw new Error(_0x3754('0x4e'));if(_0x440893['role']==='user'){var _0x42ab00=_0x4648d1[_0x3754('0x24')]({'plain':!![]});var _0x218b7b='IvrCampaigns';return db[_0x3754('0x4f')][_0x3754('0x49')]({'where':{'name':_0x218b7b,'userProfileId':_0x440893['userProfileId']},'raw':!![]})[_0x3754('0x22')](function(_0x38a4f7){if(_0x38a4f7&&_0x38a4f7[_0x3754('0x50')]===0x0){return db[_0x3754('0x26')]['create']({'name':_0x42ab00[_0x3754('0x2c')],'resourceId':_0x42ab00['id'],'type':_0x38a4f7[_0x3754('0x2c')],'sectionId':_0x38a4f7['id']},{})[_0x3754('0x22')](function(){return _0x4648d1;});}else{return _0x4648d1;}})[_0x3754('0x4a')](function(_0x4a6f88){logger[_0x3754('0x2a')](_0x3754('0x51'),_0x4a6f88);throw _0x4a6f88;});}return _0x4648d1;})[_0x3754('0x22')](respondWithResult(_0x4d9d89,0xc9))[_0x3754('0x4a')](handleError(_0x4d9d89,null));};exports[_0x3754('0x52')]=function(_0x284e8e,_0x4e2cbd){var _0x5deb09={'where':{'id':_0x284e8e['params']['id']}},_0x38e1fc={};_0x38e1fc['model']=_[_0x3754('0x48')](db[_0x3754('0x44')][_0x3754('0x30')]);_0x5deb09[_0x3754('0x37')]=_[_0x3754('0x36')](_0x38e1fc[_0x3754('0x34')],qs['fields'](_0x284e8e[_0x3754('0x35')][_0x3754('0x38')]));_0x5deb09['attributes']=_0x5deb09[_0x3754('0x37')][_0x3754('0x39')]?_0x5deb09[_0x3754('0x37')]:_0x38e1fc['model'];if(_0x284e8e[_0x3754('0x35')]['includeAll']){_0x5deb09['include']=[{'all':!![]}];}_0x5deb09=_[_0x3754('0x41')]({},_0x5deb09,_0x284e8e['options']);return db[_0x3754('0x44')][_0x3754('0x49')](_0x5deb09)[_0x3754('0x22')](handleEntityNotFound(_0x4e2cbd,null))[_0x3754('0x22')](function(_0x1d683b){if(_0x1d683b){var _0x3f4540=_0x1d683b[_0x3754('0x24')]({'plain':!![]});_0x3f4540=qs[_0x3754('0x53')](_0x3f4540,['id',_0x3754('0x54'),_0x3754('0x55')]);_0x284e8e['body']=_[_0x3754('0x53')](_0x284e8e['body'],['id',_0x3754('0x54'),_0x3754('0x55')]);return db['Campaign']['create'](_[_0x3754('0x41')](_0x3f4540,_0x284e8e[_0x3754('0x4c')]),{'include':_0x284e8e[_0x3754('0x35')][_0x3754('0x45')]?[{'all':!![]}]:undefined})[_0x3754('0x22')](function(_0x12e47f){var _0x1cf88c=_0x284e8e['user']['get']({'plain':!![]});if(!_0x1cf88c)throw new Error(_0x3754('0x4e'));if(_0x1cf88c[_0x3754('0x56')]===_0x3754('0x4d')){var _0x36922e=_0x12e47f['get']({'plain':!![]});var _0x584d40=_0x3754('0x25');return db[_0x3754('0x4f')]['find']({'where':{'name':_0x584d40,'userProfileId':_0x1cf88c[_0x3754('0x57')]},'raw':!![]})[_0x3754('0x22')](function(_0x4915f9){if(_0x4915f9&&_0x4915f9[_0x3754('0x50')]===0x0){return db['UserProfileResource'][_0x3754('0x4b')]({'name':_0x36922e['name'],'resourceId':_0x36922e['id'],'type':_0x4915f9[_0x3754('0x2c')],'sectionId':_0x4915f9['id']},{})[_0x3754('0x22')](function(){return _0x12e47f;});}else{return _0x12e47f;}})[_0x3754('0x4a')](function(_0x56edc8){logger[_0x3754('0x2a')](_0x3754('0x51'),_0x56edc8);throw _0x56edc8;});}return _0x12e47f;});}})[_0x3754('0x22')](respondWithResult(_0x4e2cbd,0xc9))[_0x3754('0x4a')](handleError(_0x4e2cbd,null));};exports[_0x3754('0x21')]=function(_0x3ac683,_0x307ade){if(_0x3ac683[_0x3754('0x4c')]['id']){delete _0x3ac683['body']['id'];}return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0x3ac683[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x307ade,null))['then'](saveUpdates(_0x3ac683[_0x3754('0x4c')],null))[_0x3754('0x22')](respondWithResult(_0x307ade,null))[_0x3754('0x4a')](handleError(_0x307ade,null));};exports['destroy']=function(_0x19670a,_0x298ef1){return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0x19670a[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x298ef1,null))['then'](removeEntity(_0x298ef1,null))[_0x3754('0x4a')](handleError(_0x298ef1,null));};exports[_0x3754('0x58')]=function(_0x2f9418,_0x59ca00,_0xda5db3){var _0x46ec64={'raw':!![],'where':{}};var _0x4d6db2={};var _0x1832e9={'count':0x0,'rows':[]};return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x2f9418[_0x3754('0x47')]['id']}})['then'](handleEntityNotFound(_0x59ca00,null))[_0x3754('0x22')](function(_0x395760){if(_0x395760){_0x4d6db2[_0x3754('0x34')]=_[_0x3754('0x48')](db[_0x3754('0x5a')][_0x3754('0x30')]);_0x4d6db2['query']=_[_0x3754('0x48')](_0x2f9418[_0x3754('0x35')]);_0x4d6db2[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x4d6db2[_0x3754('0x34')],_0x4d6db2[_0x3754('0x35')]);_0x46ec64[_0x3754('0x37')]=_['intersection'](_0x4d6db2[_0x3754('0x34')],qs[_0x3754('0x38')](_0x2f9418['query'][_0x3754('0x38')]));_0x46ec64[_0x3754('0x37')]=_0x46ec64[_0x3754('0x37')][_0x3754('0x39')]?_0x46ec64['attributes']:_0x4d6db2[_0x3754('0x34')];if(!_0x2f9418[_0x3754('0x35')][_0x3754('0x3a')](_0x3754('0x3b'))){_0x46ec64['limit']=qs[_0x3754('0x1b')](_0x2f9418[_0x3754('0x35')][_0x3754('0x1b')]);_0x46ec64[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x2f9418['query'][_0x3754('0x19')]);}_0x46ec64[_0x3754('0x3c')]=qs['sort'](_0x2f9418[_0x3754('0x35')]['sort']);_0x46ec64['where']=qs['filters'](_[_0x3754('0x40')](_0x2f9418[_0x3754('0x35')],_0x4d6db2['filters']));_0x46ec64[_0x3754('0x3e')][_0x3754('0x5b')]=_0x395760['id'];if(_0x2f9418[_0x3754('0x35')][_0x3754('0x42')]){_0x46ec64[_0x3754('0x3e')]=_[_0x3754('0x41')](_0x46ec64['where'],{'$or':_[_0x3754('0x2f')](_0x46ec64[_0x3754('0x37')],function(_0x546d3a){var _0x4edcc={};_0x4edcc[_0x546d3a]={'$like':'%'+_0x2f9418[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x4edcc;})});}_0x46ec64=_[_0x3754('0x41')]({},_0x46ec64,_0x2f9418['options']);return db[_0x3754('0x5a')][_0x3754('0x1c')]({'where':_0x46ec64[_0x3754('0x3e')]})[_0x3754('0x22')](function(_0x33236c){_0x1832e9[_0x3754('0x1c')]=_0x33236c;if(_0x2f9418['query'][_0x3754('0x45')]){_0x46ec64['include']=[{'all':!![]}];}return db[_0x3754('0x5a')][_0x3754('0x5c')](_0x46ec64);})['then'](function(_0x57d507){_0x1832e9['rows']=_0x57d507;return _0x1832e9;});}})[_0x3754('0x22')](respondWithFilteredResult(_0x59ca00,_0x46ec64))['catch'](handleError(_0x59ca00,null));};exports[_0x3754('0x5d')]=function(_0x5dda69,_0x2c3733,_0x4668a3){var _0xeeffed={'raw':!![],'where':{}};var _0x3a4d3e={};var _0x2df519={'count':0x0,'rows':[]};return db['Campaign'][_0x3754('0x59')]({'where':{'id':_0x5dda69[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x2c3733,null))[_0x3754('0x22')](function(_0x287028){if(_0x287028){_0x3a4d3e['model']=_[_0x3754('0x48')](db['CmHopperHistory']['rawAttributes']);_0x3a4d3e[_0x3754('0x35')]=_[_0x3754('0x48')](_0x5dda69['query']);_0x3a4d3e['filters']=_[_0x3754('0x36')](_0x3a4d3e['model'],_0x3a4d3e[_0x3754('0x35')]);_0xeeffed['attributes']=_[_0x3754('0x36')](_0x3a4d3e['model'],qs[_0x3754('0x38')](_0x5dda69[_0x3754('0x35')][_0x3754('0x38')]));_0xeeffed[_0x3754('0x37')]=_0xeeffed['attributes']['length']?_0xeeffed['attributes']:_0x3a4d3e[_0x3754('0x34')];if(!_0x5dda69['query']['hasOwnProperty']('nolimit')){_0xeeffed['limit']=qs[_0x3754('0x1b')](_0x5dda69[_0x3754('0x35')][_0x3754('0x1b')]);_0xeeffed[_0x3754('0x19')]=qs['offset'](_0x5dda69[_0x3754('0x35')][_0x3754('0x19')]);}_0xeeffed[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x5dda69[_0x3754('0x35')][_0x3754('0x3d')]);_0xeeffed['where']=qs['filters'](_[_0x3754('0x40')](_0x5dda69[_0x3754('0x35')],_0x3a4d3e[_0x3754('0x3f')]));_0xeeffed[_0x3754('0x3e')]['CampaignId']=_0x287028['id'];if(_0x5dda69[_0x3754('0x35')][_0x3754('0x42')]){_0xeeffed[_0x3754('0x3e')]=_['merge'](_0xeeffed[_0x3754('0x3e')],{'$or':_['map'](_0xeeffed[_0x3754('0x37')],function(_0x30499e){var _0x4c4e86={};_0x4c4e86[_0x30499e]={'$like':'%'+_0x5dda69[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x4c4e86;})});}_0xeeffed=_[_0x3754('0x41')]({},_0xeeffed,_0x5dda69[_0x3754('0x43')]);return db[_0x3754('0x5e')][_0x3754('0x1c')]({'where':_0xeeffed[_0x3754('0x3e')]})[_0x3754('0x22')](function(_0x491261){_0x2df519[_0x3754('0x1c')]=_0x491261;if(_0x5dda69[_0x3754('0x35')]['includeAll']){_0xeeffed['include']=[{'all':!![]}];}return db[_0x3754('0x5e')]['findAll'](_0xeeffed);})[_0x3754('0x22')](function(_0x2f65bd){_0x2df519['rows']=_0x2f65bd;return _0x2df519;});}})['then'](respondWithFilteredResult(_0x2c3733,_0xeeffed))[_0x3754('0x4a')](handleError(_0x2c3733,null));};exports[_0x3754('0x5f')]=function(_0x2ceb89,_0x5d96f2,_0x66703f){var _0x2c90d1={'raw':!![],'where':{}};var _0x136107={};var _0x11516e={'count':0x0,'rows':[]};return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x2ceb89[_0x3754('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d96f2,null))[_0x3754('0x22')](function(_0x3409ed){if(_0x3409ed){_0x136107['model']=_['keys'](db[_0x3754('0x60')][_0x3754('0x30')]);_0x136107[_0x3754('0x35')]=_[_0x3754('0x48')](_0x2ceb89[_0x3754('0x35')]);_0x136107[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x136107[_0x3754('0x34')],_0x136107[_0x3754('0x35')]);_0x2c90d1[_0x3754('0x37')]=_[_0x3754('0x36')](_0x136107[_0x3754('0x34')],qs[_0x3754('0x38')](_0x2ceb89[_0x3754('0x35')]['fields']));_0x2c90d1['attributes']=_0x2c90d1[_0x3754('0x37')][_0x3754('0x39')]?_0x2c90d1[_0x3754('0x37')]:_0x136107[_0x3754('0x34')];if(!_0x2ceb89[_0x3754('0x35')][_0x3754('0x3a')](_0x3754('0x3b'))){_0x2c90d1[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x2ceb89[_0x3754('0x35')]['limit']);_0x2c90d1[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x2ceb89[_0x3754('0x35')][_0x3754('0x19')]);}_0x2c90d1[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x2ceb89[_0x3754('0x35')]['sort']);_0x2c90d1[_0x3754('0x3e')]=qs['filters'](_[_0x3754('0x40')](_0x2ceb89[_0x3754('0x35')],_0x136107[_0x3754('0x3f')]));_0x2c90d1[_0x3754('0x3e')][_0x3754('0x5b')]=_0x3409ed['id'];if(_0x2ceb89[_0x3754('0x35')][_0x3754('0x42')]){_0x2c90d1[_0x3754('0x3e')]=_['merge'](_0x2c90d1['where'],{'$or':_['map'](_0x2c90d1[_0x3754('0x37')],function(_0x2f6b4e){var _0x4afb7e={};_0x4afb7e[_0x2f6b4e]={'$like':'%'+_0x2ceb89[_0x3754('0x35')]['filter']+'%'};return _0x4afb7e;})});}_0x2c90d1=_[_0x3754('0x41')]({},_0x2c90d1,_0x2ceb89[_0x3754('0x43')]);return db[_0x3754('0x60')][_0x3754('0x1c')]({'where':_0x2c90d1[_0x3754('0x3e')]})['then'](function(_0x4025e0){_0x11516e['count']=_0x4025e0;if(_0x2ceb89[_0x3754('0x35')][_0x3754('0x45')]){_0x2c90d1[_0x3754('0x61')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3754('0x5c')](_0x2c90d1);})[_0x3754('0x22')](function(_0x53d0b7){_0x11516e['rows']=_0x53d0b7;return _0x11516e;});}})[_0x3754('0x22')](respondWithFilteredResult(_0x5d96f2,_0x2c90d1))[_0x3754('0x4a')](handleError(_0x5d96f2,null));};exports['getHopperBlacks']=function(_0x5665d5,_0x2a48ce,_0x5f1a4d){var _0x23b949={'raw':!![],'where':{}};var _0x3b2249={};var _0x50b74a={'count':0x0,'rows':[]};return db['Campaign'][_0x3754('0x59')]({'where':{'id':_0x5665d5['params']['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x2a48ce,null))[_0x3754('0x22')](function(_0x4b3810){if(_0x4b3810){_0x3b2249[_0x3754('0x34')]=_[_0x3754('0x48')](db['CmHopperBlack'][_0x3754('0x30')]);_0x3b2249[_0x3754('0x35')]=_[_0x3754('0x48')](_0x5665d5[_0x3754('0x35')]);_0x3b2249[_0x3754('0x3f')]=_[_0x3754('0x36')](_0x3b2249[_0x3754('0x34')],_0x3b2249['query']);_0x23b949[_0x3754('0x37')]=_[_0x3754('0x36')](_0x3b2249[_0x3754('0x34')],qs[_0x3754('0x38')](_0x5665d5[_0x3754('0x35')][_0x3754('0x38')]));_0x23b949['attributes']=_0x23b949[_0x3754('0x37')][_0x3754('0x39')]?_0x23b949[_0x3754('0x37')]:_0x3b2249[_0x3754('0x34')];if(!_0x5665d5['query'][_0x3754('0x3a')]('nolimit')){_0x23b949[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x5665d5[_0x3754('0x35')][_0x3754('0x1b')]);_0x23b949[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x5665d5['query'][_0x3754('0x19')]);}_0x23b949['order']=qs[_0x3754('0x3d')](_0x5665d5[_0x3754('0x35')][_0x3754('0x3d')]);_0x23b949[_0x3754('0x3e')]=qs['filters'](_['pick'](_0x5665d5['query'],_0x3b2249[_0x3754('0x3f')]));_0x23b949[_0x3754('0x3e')][_0x3754('0x5b')]=_0x4b3810['id'];if(_0x5665d5[_0x3754('0x35')]['filter']){_0x23b949[_0x3754('0x3e')]=_['merge'](_0x23b949['where'],{'$or':_[_0x3754('0x2f')](_0x23b949[_0x3754('0x37')],function(_0x1b43d9){var _0x51374c={};_0x51374c[_0x1b43d9]={'$like':'%'+_0x5665d5[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x51374c;})});}_0x23b949=_[_0x3754('0x41')]({},_0x23b949,_0x5665d5[_0x3754('0x43')]);return db[_0x3754('0x62')][_0x3754('0x1c')]({'where':_0x23b949['where']})[_0x3754('0x22')](function(_0x239b57){_0x50b74a[_0x3754('0x1c')]=_0x239b57;if(_0x5665d5['query'][_0x3754('0x45')]){_0x23b949[_0x3754('0x61')]=[{'all':!![]}];}return db[_0x3754('0x62')][_0x3754('0x5c')](_0x23b949);})[_0x3754('0x22')](function(_0x40c5f9){_0x50b74a[_0x3754('0x46')]=_0x40c5f9;return _0x50b74a;});}})['then'](respondWithFilteredResult(_0x2a48ce,_0x23b949))[_0x3754('0x4a')](handleError(_0x2a48ce,null));};exports[_0x3754('0x63')]=function(_0x27a6a2,_0x5adb27,_0x4501fc){var _0x9aa437={};var _0x4f8ade={};var _0x239a2d;var _0x480e8b;return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x27a6a2[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x5adb27,null))['then'](function(_0xc1a9){if(_0xc1a9){_0x239a2d=_0xc1a9;_0x4f8ade[_0x3754('0x34')]=_['keys'](db[_0x3754('0x64')][_0x3754('0x30')]);_0x4f8ade[_0x3754('0x35')]=_[_0x3754('0x48')](_0x27a6a2[_0x3754('0x35')]);_0x4f8ade[_0x3754('0x3f')]=_['intersection'](_0x4f8ade[_0x3754('0x34')],_0x4f8ade['query']);_0x9aa437[_0x3754('0x37')]=_[_0x3754('0x36')](_0x4f8ade['model'],qs['fields'](_0x27a6a2[_0x3754('0x35')]['fields']));_0x9aa437['attributes']=_0x9aa437[_0x3754('0x37')][_0x3754('0x39')]?_0x9aa437[_0x3754('0x37')]:_0x4f8ade['model'];_0x9aa437[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x27a6a2[_0x3754('0x35')][_0x3754('0x3d')]);_0x9aa437['where']=qs['filters'](_[_0x3754('0x40')](_0x27a6a2[_0x3754('0x35')],_0x4f8ade[_0x3754('0x3f')]));if(_0x27a6a2['query'][_0x3754('0x42')]){_0x9aa437['where']=_[_0x3754('0x41')](_0x9aa437[_0x3754('0x3e')],{'$or':_[_0x3754('0x2f')](_0x9aa437[_0x3754('0x37')],function(_0x24398c){var _0x33ee06={};_0x33ee06[_0x24398c]={'$like':'%'+_0x27a6a2[_0x3754('0x35')][_0x3754('0x42')]+'%'};return _0x33ee06;})});}_0x9aa437=_['merge']({},_0x9aa437,_0x27a6a2[_0x3754('0x43')]);return _0x239a2d[_0x3754('0x63')](_0x9aa437);}})[_0x3754('0x22')](function(_0x35c428){if(_0x35c428){_0x480e8b=_0x35c428[_0x3754('0x39')];if(!_0x27a6a2[_0x3754('0x35')][_0x3754('0x3a')]('nolimit')){_0x9aa437[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x27a6a2[_0x3754('0x35')][_0x3754('0x1b')]);_0x9aa437[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x27a6a2[_0x3754('0x35')]['offset']);}return _0x239a2d[_0x3754('0x63')](_0x9aa437);}})[_0x3754('0x22')](function(_0x454664){if(_0x454664){return _0x454664?{'count':_0x480e8b,'rows':_0x454664}:null;}})[_0x3754('0x22')](respondWithResult(_0x5adb27,null))[_0x3754('0x4a')](handleError(_0x5adb27,null));};exports[_0x3754('0x65')]=function(_0x459c3d,_0xb4a03b,_0x56947a){var _0x3f6b0c,_0xf4d907;var _0x1d906a=[];var _0x18f7fa=moment()[_0x3754('0x66')](_0x3754('0x67'));return db['Campaign']['find']({'where':{'id':_0x459c3d[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0xb4a03b,null))[_0x3754('0x22')](function(_0x13bed4){if(_0x13bed4){_0xf4d907=_0x13bed4;return _0x13bed4[_0x3754('0x65')](_0x459c3d[_0x3754('0x4c')]['ids'],_[_0x3754('0x53')](_0x459c3d[_0x3754('0x4c')],[_0x3754('0x68'),'id'])||{});}return null;})[_0x3754('0x69')](function(_0x5a4e12){var _0x24e85a;var _0x487f75;_0x3f6b0c=_0x5a4e12||[];var _0x101fa8=[];if(_0x5a4e12){for(var _0x4f4a9f=0x0;_0x4f4a9f<_0x5a4e12['length'];_0x4f4a9f+=0x1){var _0x472e03=_0x5a4e12[_0x4f4a9f]['get']({'plain':!![]});_0xf4d907['dialCheckDuplicateType']=_0x459c3d[_0x3754('0x4c')]['dialCheckDuplicateType']?_0x459c3d[_0x3754('0x4c')][_0x3754('0x6a')]:_0xf4d907[_0x3754('0x6a')];switch(_0xf4d907[_0x3754('0x6a')]){case'always':_0x24e85a=squel['insert']()[_0x3754('0x6b')](_0x3754('0x6c'))['fromQuery'](['phone',_0x3754('0x6d'),_0x3754('0x6e'),_0x3754('0x6f'),_0x3754('0x5b'),_0x3754('0x54'),_0x3754('0x55')],squel[_0x3754('0x70')]()[_0x3754('0x71')](_0x3754('0x72'),'phone')[_0x3754('0x71')]('NOW()','scheduledAt')[_0x3754('0x71')]('id',_0x3754('0x6e'))[_0x3754('0x71')](_0x472e03[_0x3754('0x73')][_0x3754('0x74')](),_0x3754('0x6f'))[_0x3754('0x71')](_0x459c3d[_0x3754('0x47')]['id'][_0x3754('0x74')](),_0x3754('0x5b'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27','createdAt')['field']('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x76'))[_0x3754('0x3e')](_0x3754('0x77'))[_0x3754('0x3e')]('ListId\x20=\x20?',_0x472e03[_0x3754('0x73')][_0x3754('0x74')]())[_0x3754('0x3e')](_0x3754('0x78'))['where'](_0x3754('0x79'),squel['select']()[_0x3754('0x71')](_0x3754('0x7a'))[_0x3754('0x75')](_0x3754('0x7b'))[_0x3754('0x3e')]('CampaignId\x20=\x20?',_0x459c3d['params']['id']['toString']()))[_0x3754('0x3e')](_0x3754('0x79'),squel['select']()[_0x3754('0x71')](_0x3754('0x7c'))[_0x3754('0x75')](_0x3754('0x6c'))[_0x3754('0x3e')]('CampaignId\x20=\x20?',_0x459c3d[_0x3754('0x47')]['id'][_0x3754('0x74')]())))[_0x3754('0x74')]();break;case'onlyIfOpen':_0x24e85a=squel[_0x3754('0x7d')]()[_0x3754('0x6b')]('cm_hopper')[_0x3754('0x7e')]([_0x3754('0x72'),_0x3754('0x6d'),_0x3754('0x6e'),_0x3754('0x6f'),_0x3754('0x5b'),_0x3754('0x54'),_0x3754('0x55')],squel[_0x3754('0x70')]()['field'](_0x3754('0x72'),_0x3754('0x72'))[_0x3754('0x71')](_0x3754('0x7f'),'scheduledAt')['field']('id',_0x3754('0x6e'))['field'](_0x472e03['CmListId'][_0x3754('0x74')](),_0x3754('0x6f'))[_0x3754('0x71')](_0x459c3d[_0x3754('0x47')]['id']['toString'](),'CampaignId')[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x54'))['field']('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x76'))[_0x3754('0x3e')](_0x3754('0x77'))[_0x3754('0x3e')](_0x3754('0x80'),_0x472e03[_0x3754('0x73')]['toString']())[_0x3754('0x3e')](_0x3754('0x78'))[_0x3754('0x3e')](_0x3754('0x79'),squel[_0x3754('0x70')]()[_0x3754('0x71')](_0x3754('0x7c'))['from'](_0x3754('0x6c'))[_0x3754('0x3e')]('CampaignId\x20=\x20?',_0x459c3d['params']['id'][_0x3754('0x74')]())))[_0x3754('0x74')]();break;default:_0x24e85a=squel[_0x3754('0x7d')]()[_0x3754('0x6b')](_0x3754('0x6c'))['fromQuery']([_0x3754('0x72'),_0x3754('0x6d'),_0x3754('0x6e'),_0x3754('0x6f'),_0x3754('0x5b'),'createdAt',_0x3754('0x55')],squel['select']()[_0x3754('0x71')](_0x3754('0x72'),_0x3754('0x72'))['field'](_0x3754('0x7f'),_0x3754('0x6d'))[_0x3754('0x71')]('id','ContactId')['field'](_0x472e03[_0x3754('0x73')]['toString'](),_0x3754('0x6f'))['field'](_0x459c3d['params']['id'][_0x3754('0x74')](),_0x3754('0x5b'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x54'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x76'))[_0x3754('0x3e')]('deletedAt\x20IS\x20NULL')[_0x3754('0x3e')](_0x3754('0x80'),_0x472e03['CmListId'][_0x3754('0x74')]())['where'](_0x3754('0x78')))[_0x3754('0x74')]();}_0x487f75=squel[_0x3754('0x7d')]()[_0x3754('0x6b')]('cm_hopper_additional_phones')['fromQuery']([_0x3754('0x81'),_0x3754('0x6d'),_0x3754('0x72'),_0x3754('0x82'),'createdAt','updatedAt'],squel[_0x3754('0x70')]()[_0x3754('0x71')]('h.id','id')[_0x3754('0x71')](_0x3754('0x7f'),'scheduledAt')['field']('ci.item',_0x3754('0x72'))[_0x3754('0x71')](_0x3754('0x83'),_0x3754('0x82'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x54'))[_0x3754('0x71')]('\x27'+_0x18f7fa+'\x27',_0x3754('0x55'))[_0x3754('0x75')](_0x3754('0x84'),'ci')[_0x3754('0x85')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x3754('0x3e')]('h.ListId\x20=\x20?',_0x472e03[_0x3754('0x73')][_0x3754('0x74')]())[_0x3754('0x3e')](_0x3754('0x86'),_0x459c3d[_0x3754('0x47')]['id']['toString']())[_0x3754('0x3e')](_0x3754('0x87'),_0x18f7fa))[_0x3754('0x74')]();_0x101fa8[_0x3754('0x88')](db[_0x3754('0x89')][_0x3754('0x35')](_0x24e85a));_0x1d906a[_0x3754('0x88')](db[_0x3754('0x89')][_0x3754('0x35')](_0x487f75));}return BPromise['all'](_0x101fa8);}})[_0x3754('0x22')](function(){return BPromise[_0x3754('0x8a')](_0x1d906a);})[_0x3754('0x22')](function(){return _0x3f6b0c;})['then'](respondWithResult(_0xb4a03b,null))[_0x3754('0x4a')](handleError(_0xb4a03b,null));};exports['removeLists']=function(_0xed1e23,_0x33f9ac,_0x104c22){return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0xed1e23['params']['id']}})['then'](handleEntityNotFound(_0x33f9ac,null))[_0x3754('0x22')](function(_0x4f2436){if(_0x4f2436){return _0x4f2436['removeLists'](_0xed1e23[_0x3754('0x35')][_0x3754('0x68')]);}})[_0x3754('0x22')](function(_0x5580a0){if(_0x5580a0){return db[_0x3754('0x5a')]['destroy']({'where':{'ListId':_0xed1e23[_0x3754('0x35')][_0x3754('0x68')],'CampaignId':_0xed1e23['params']['id']}})[_0x3754('0x22')](function(){return _0x5580a0;});}})[_0x3754('0x22')](respondWithStatusCode(_0x33f9ac,null))[_0x3754('0x4a')](handleError(_0x33f9ac,null));};exports['getBlackLists']=function(_0x32a77e,_0x332db5,_0x4c5979){var _0x49c99b={};var _0x337729={};var _0x54edb3;var _0x59c5f3;return db[_0x3754('0x44')][_0x3754('0x59')]({'where':{'id':_0x32a77e[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x332db5,null))['then'](function(_0x3820ef){if(_0x3820ef){_0x54edb3=_0x3820ef;_0x337729[_0x3754('0x34')]=_[_0x3754('0x48')](db[_0x3754('0x64')][_0x3754('0x30')]);_0x337729[_0x3754('0x35')]=_[_0x3754('0x48')](_0x32a77e[_0x3754('0x35')]);_0x337729[_0x3754('0x3f')]=_['intersection'](_0x337729[_0x3754('0x34')],_0x337729[_0x3754('0x35')]);_0x49c99b[_0x3754('0x37')]=_['intersection'](_0x337729[_0x3754('0x34')],qs[_0x3754('0x38')](_0x32a77e[_0x3754('0x35')][_0x3754('0x38')]));_0x49c99b[_0x3754('0x37')]=_0x49c99b['attributes'][_0x3754('0x39')]?_0x49c99b['attributes']:_0x337729['model'];_0x49c99b[_0x3754('0x3c')]=qs[_0x3754('0x3d')](_0x32a77e[_0x3754('0x35')][_0x3754('0x3d')]);_0x49c99b[_0x3754('0x3e')]=qs['filters'](_[_0x3754('0x40')](_0x32a77e['query'],_0x337729['filters']));if(_0x32a77e['query'][_0x3754('0x42')]){_0x49c99b[_0x3754('0x3e')]=_[_0x3754('0x41')](_0x49c99b['where'],{'$or':_['map'](_0x49c99b[_0x3754('0x37')],function(_0x3f2448){var _0x275cc0={};_0x275cc0[_0x3f2448]={'$like':'%'+_0x32a77e['query'][_0x3754('0x42')]+'%'};return _0x275cc0;})});}_0x49c99b=_[_0x3754('0x41')]({},_0x49c99b,_0x32a77e[_0x3754('0x43')]);return _0x54edb3[_0x3754('0x8b')](_0x49c99b);}})[_0x3754('0x22')](function(_0x47f680){if(_0x47f680){_0x59c5f3=_0x47f680['length'];if(!_0x32a77e['query'][_0x3754('0x3a')](_0x3754('0x3b'))){_0x49c99b[_0x3754('0x1b')]=qs[_0x3754('0x1b')](_0x32a77e[_0x3754('0x35')][_0x3754('0x1b')]);_0x49c99b[_0x3754('0x19')]=qs[_0x3754('0x19')](_0x32a77e[_0x3754('0x35')][_0x3754('0x19')]);}return _0x54edb3[_0x3754('0x8b')](_0x49c99b);}})['then'](function(_0x349e62){if(_0x349e62){return _0x349e62?{'count':_0x59c5f3,'rows':_0x349e62}:null;}})[_0x3754('0x22')](respondWithResult(_0x332db5,null))[_0x3754('0x4a')](handleError(_0x332db5,null));};exports[_0x3754('0x8c')]=function(_0x15dbd4,_0x3ca8f2,_0x1d5560){var _0x1d4776,_0xdebc6c;var _0x5edf22=[];var _0x1a8d1d=moment()[_0x3754('0x66')](_0x3754('0x67'));return db[_0x3754('0x44')][_0x3754('0x49')]({'where':{'id':_0x15dbd4[_0x3754('0x47')]['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x3ca8f2,null))[_0x3754('0x22')](function(_0x9357c2){if(_0x9357c2){_0xdebc6c=_0x9357c2;return _0x9357c2[_0x3754('0x8c')](_0x15dbd4[_0x3754('0x4c')][_0x3754('0x68')],_[_0x3754('0x53')](_0x15dbd4[_0x3754('0x4c')],['ids','id'])||{});}return null;})['spread'](function(_0x5215bc){var _0x2ccd63;var _0x39c621;_0x1d4776=_0x5215bc||[];var _0x5150fc=[];if(_0x5215bc){for(var _0xd77e01=0x0;_0xd77e01<_0x5215bc[_0x3754('0x39')];_0xd77e01+=0x1){var _0x31e5f4=_0x5215bc[_0xd77e01][_0x3754('0x24')]({'plain':!![]});_0x2ccd63=squel['insert']()[_0x3754('0x6b')](_0x3754('0x8d'))['fromQuery'](['phone','ContactId','ListId',_0x3754('0x5b'),'createdAt',_0x3754('0x55')],squel[_0x3754('0x70')]()['field'](_0x3754('0x72'),'phone')[_0x3754('0x71')]('id',_0x3754('0x6e'))[_0x3754('0x71')](_0x31e5f4['CmListId']['toString'](),_0x3754('0x6f'))[_0x3754('0x71')](_0x15dbd4[_0x3754('0x47')]['id'][_0x3754('0x74')](),'CampaignId')[_0x3754('0x71')](_0x3754('0x7f'),_0x3754('0x54'))[_0x3754('0x71')](_0x3754('0x7f'),'updatedAt')[_0x3754('0x75')](_0x3754('0x76'))['where'](_0x3754('0x77'))[_0x3754('0x3e')](_0x3754('0x80'),_0x31e5f4['CmListId']['toString']())['where'](_0x3754('0x78')))[_0x3754('0x74')]();_0x5150fc[_0x3754('0x88')](db[_0x3754('0x89')][_0x3754('0x35')](_0x2ccd63));}return BPromise['all'](_0x5150fc);}})[_0x3754('0x22')](function(){return _0x1d4776;})['then'](respondWithResult(_0x3ca8f2,null))[_0x3754('0x4a')](handleError(_0x3ca8f2,null));};exports[_0x3754('0x8e')]=function(_0x4fa2fa,_0x294b20,_0x526138){return db['Campaign']['find']({'where':{'id':_0x4fa2fa['params']['id']}})[_0x3754('0x22')](handleEntityNotFound(_0x294b20,null))[_0x3754('0x22')](function(_0x2aff7c){if(_0x2aff7c){return _0x2aff7c[_0x3754('0x8e')](_0x4fa2fa[_0x3754('0x35')][_0x3754('0x68')]);}})[_0x3754('0x22')](function(_0x5f04f0){if(_0x5f04f0){return db['CmHopperBlack'][_0x3754('0x23')]({'where':{'ListId':_0x4fa2fa[_0x3754('0x35')][_0x3754('0x68')],'CampaignId':_0x4fa2fa['params']['id']}})[_0x3754('0x22')](function(){return _0x5f04f0;});}})[_0x3754('0x22')](respondWithStatusCode(_0x294b20,null))['catch'](handleError(_0x294b20,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index de050e4..7b48770 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(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0xb509c2,_0xc778dd){var _0x1a63e1=function(_0x29b224){while(--_0x29b224){_0xb509c2['push'](_0xb509c2['shift']());}};_0x1a63e1(++_0xc778dd);}(_0x7a54,0x106));var _0x47a5=function(_0x192b30,_0x5c7525){_0x192b30=_0x192b30-0x0;var _0x1873fb=_0x7a54[_0x192b30];return _0x1873fb;};'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 0694116..112f5f9 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 _0x18a9=['raw','where','attributes','include','model','map','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','options'];(function(_0x4c4d44,_0x199ab7){var _0x23af06=function(_0x1168c6){while(--_0x1168c6){_0x4c4d44['push'](_0x4c4d44['shift']());}};_0x23af06(++_0x199ab7);}(_0x18a9,0x15b));var _0x918a=function(_0x57d41c,_0x4a16e8){_0x57d41c=_0x57d41c-0x0;var _0x5d9d9e=_0x18a9[_0x57d41c];return _0x5d9d9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x918a('0x0'));var BPromise=require(_0x918a('0x1'));var rs=require(_0x918a('0x2'));var fs=require('fs');var Redis=require(_0x918a('0x3'));var db=require(_0x918a('0x4'))['db'];var utils=require(_0x918a('0x5'));var logger=require(_0x918a('0x6'))(_0x918a('0x7'));var config=require(_0x918a('0x8'));var jayson=require(_0x918a('0x9'));var client=jayson[_0x918a('0xa')][_0x918a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492c39,_0xdb8dd8,_0x266256){return new BPromise(function(_0x51caca,_0x40518f){return client[_0x918a('0xc')](_0x492c39,_0x266256)[_0x918a('0xd')](function(_0x224a87){logger[_0x918a('0xe')](_0x918a('0xf'),_0xdb8dd8,_0x918a('0x10'));logger['debug'](_0x918a('0x11'),_0xdb8dd8,_0x918a('0x10'),JSON[_0x918a('0x12')](_0x224a87));if(_0x224a87[_0x918a('0x13')]){if(_0x224a87['error'][_0x918a('0x14')]===0x1f4){logger[_0x918a('0x13')]('Campaign,\x20%s,\x20%s',_0xdb8dd8,_0x224a87[_0x918a('0x13')][_0x918a('0x15')]);return _0x40518f(_0x224a87[_0x918a('0x13')][_0x918a('0x15')]);}logger['error'](_0x918a('0xf'),_0xdb8dd8,_0x224a87['error'][_0x918a('0x15')]);return _0x51caca(_0x224a87['error']['message']);}else{logger[_0x918a('0xe')](_0x918a('0xf'),_0xdb8dd8,'request\x20sent');_0x51caca(_0x224a87[_0x918a('0x16')]['message']);}})[_0x918a('0x17')](function(_0x17f988){logger[_0x918a('0x13')]('Campaign,\x20%s,\x20%s',_0xdb8dd8,_0x17f988);_0x40518f(_0x17f988);});});}exports[_0x918a('0x18')]=function(_0x51e467){var _0x199eb1=this;return new Promise(function(_0x22e347,_0x38ca45){return db[_0x918a('0x19')]['findAll']({'raw':_0x51e467[_0x918a('0x1a')]?_0x51e467[_0x918a('0x1a')][_0x918a('0x1b')]===undefined?!![]:![]:!![],'where':_0x51e467[_0x918a('0x1a')]?_0x51e467[_0x918a('0x1a')][_0x918a('0x1c')]||null:null,'attributes':_0x51e467[_0x918a('0x1a')]?_0x51e467['options'][_0x918a('0x1d')]||null:null,'limit':_0x51e467['options']?_0x51e467[_0x918a('0x1a')]['limit']||null:null,'include':_0x51e467['options']?_0x51e467['options'][_0x918a('0x1e')]?_['map'](_0x51e467[_0x918a('0x1a')][_0x918a('0x1e')],function(_0xadd3bc){return{'model':db[_0xadd3bc[_0x918a('0x1f')]],'as':_0xadd3bc['as'],'attributes':_0xadd3bc[_0x918a('0x1d')],'include':_0xadd3bc[_0x918a('0x1e')]?_[_0x918a('0x20')](_0xadd3bc[_0x918a('0x1e')],function(_0xfdad4a){return{'model':db[_0xfdad4a[_0x918a('0x1f')]],'as':_0xfdad4a['as'],'attributes':_0xfdad4a['attributes'],'include':_0xfdad4a[_0x918a('0x1e')]?_[_0x918a('0x20')](_0xfdad4a[_0x918a('0x1e')],function(_0x4a77c6){return{'model':db[_0x4a77c6[_0x918a('0x1f')]],'as':_0x4a77c6['as'],'attributes':_0x4a77c6[_0x918a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x918a('0xd')](function(_0x549cb4){logger[_0x918a('0xe')](_0x918a('0x18'),_0x51e467);logger[_0x918a('0x21')](_0x918a('0x18'),_0x51e467,JSON[_0x918a('0x12')](_0x549cb4));_0x22e347(_0x549cb4);})[_0x918a('0x17')](function(_0x51361c){logger['error']('GetCampaign',_0x51361c[_0x918a('0x15')],_0x51e467);_0x38ca45(_0x199eb1[_0x918a('0x13')](0x1f4,_0x51361c['message']));});});}; \ No newline at end of file +var _0x4156=['request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','GetCampaign','Campaign','raw','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x580843,_0x1840bb){var _0x12a1e2=function(_0x5f02c5){while(--_0x5f02c5){_0x580843['push'](_0x580843['shift']());}};_0x12a1e2(++_0x1840bb);}(_0x4156,0xf1));var _0x6415=function(_0x359055,_0x20f62d){_0x359055=_0x359055-0x0;var _0xc50b4b=_0x4156[_0x359055];return _0xc50b4b;};'use strict';var _=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var moment=require(_0x6415('0x2'));var BPromise=require(_0x6415('0x3'));var rs=require(_0x6415('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6415('0x5'))['db'];var utils=require(_0x6415('0x6'));var logger=require(_0x6415('0x7'))(_0x6415('0x8'));var config=require(_0x6415('0x9'));var jayson=require(_0x6415('0xa'));var client=jayson[_0x6415('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24cb0,_0x47ec13,_0x4045ec){return new BPromise(function(_0x266237,_0x5bc51b){return client[_0x6415('0xc')](_0x24cb0,_0x4045ec)[_0x6415('0xd')](function(_0x3383d2){logger[_0x6415('0xe')]('Campaign,\x20%s,\x20%s',_0x47ec13,_0x6415('0xf'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x47ec13,_0x6415('0xf'),JSON[_0x6415('0x10')](_0x3383d2));if(_0x3383d2[_0x6415('0x11')]){if(_0x3383d2[_0x6415('0x11')][_0x6415('0x12')]===0x1f4){logger[_0x6415('0x11')](_0x6415('0x13'),_0x47ec13,_0x3383d2['error']['message']);return _0x5bc51b(_0x3383d2[_0x6415('0x11')][_0x6415('0x14')]);}logger[_0x6415('0x11')](_0x6415('0x13'),_0x47ec13,_0x3383d2[_0x6415('0x11')]['message']);return _0x266237(_0x3383d2['error'][_0x6415('0x14')]);}else{logger[_0x6415('0xe')]('Campaign,\x20%s,\x20%s',_0x47ec13,_0x6415('0xf'));_0x266237(_0x3383d2[_0x6415('0x15')]['message']);}})['catch'](function(_0x352a04){logger[_0x6415('0x11')](_0x6415('0x13'),_0x47ec13,_0x352a04);_0x5bc51b(_0x352a04);});});}exports[_0x6415('0x16')]=function(_0x2ef73b){var _0xa3d00a=this;return new Promise(function(_0x2c74c6,_0x468dc2){return db[_0x6415('0x17')]['findAll']({'raw':_0x2ef73b['options']?_0x2ef73b['options'][_0x6415('0x18')]===undefined?!![]:![]:!![],'where':_0x2ef73b[_0x6415('0x19')]?_0x2ef73b[_0x6415('0x19')][_0x6415('0x1a')]||null:null,'attributes':_0x2ef73b['options']?_0x2ef73b[_0x6415('0x19')][_0x6415('0x1b')]||null:null,'limit':_0x2ef73b[_0x6415('0x19')]?_0x2ef73b['options'][_0x6415('0x1c')]||null:null,'include':_0x2ef73b[_0x6415('0x19')]?_0x2ef73b[_0x6415('0x19')][_0x6415('0x1d')]?_[_0x6415('0x1e')](_0x2ef73b[_0x6415('0x19')][_0x6415('0x1d')],function(_0x41c266){return{'model':db[_0x41c266[_0x6415('0x1f')]],'as':_0x41c266['as'],'attributes':_0x41c266['attributes'],'include':_0x41c266[_0x6415('0x1d')]?_[_0x6415('0x1e')](_0x41c266['include'],function(_0x15be31){return{'model':db[_0x15be31[_0x6415('0x1f')]],'as':_0x15be31['as'],'attributes':_0x15be31[_0x6415('0x1b')],'include':_0x15be31[_0x6415('0x1d')]?_[_0x6415('0x1e')](_0x15be31['include'],function(_0x30d857){return{'model':db[_0x30d857['model']],'as':_0x30d857['as'],'attributes':_0x30d857[_0x6415('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6415('0xd')](function(_0x25d459){logger['info']('GetCampaign',_0x2ef73b);logger['debug'](_0x6415('0x16'),_0x2ef73b,JSON[_0x6415('0x10')](_0x25d459));_0x2c74c6(_0x25d459);})['catch'](function(_0x5bf08d){logger[_0x6415('0x11')](_0x6415('0x16'),_0x5bf08d[_0x6415('0x14')],_0x2ef73b);_0x468dc2(_0xa3d00a[_0x6415('0x11')](0x1f4,_0x5bf08d[_0x6415('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e50392b..7f7e6ad 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 _0x436b=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','destroy','delete','exports','util'];(function(_0x49a438,_0xc61035){var _0xb10dea=function(_0x1e8710){while(--_0x1e8710){_0x49a438['push'](_0x49a438['shift']());}};_0xb10dea(++_0xc61035);}(_0x436b,0x9a));var _0xb436=function(_0x3fa59c,_0x2302f9){_0x3fa59c=_0x3fa59c-0x0;var _0x239a2c=_0x436b[_0x3fa59c];return _0x239a2c;};'use strict';var multer=require('multer');var util=require(_0xb436('0x0'));var path=require(_0xb436('0x1'));var timeout=require(_0xb436('0x2'));var express=require(_0xb436('0x3'));var router=express['Router']();var fs_extra=require(_0xb436('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb436('0x5'));var config=require(_0xb436('0x6'));var controller=require(_0xb436('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb436('0x8')](_0xb436('0x9'),auth[_0xb436('0xa')](),controller['show']);router[_0xb436('0x8')]('/:id/hoppers',auth[_0xb436('0xa')](),controller[_0xb436('0xb')]);router[_0xb436('0x8')](_0xb436('0xc'),auth[_0xb436('0xa')](),controller['getHopperHistories']);router[_0xb436('0x8')](_0xb436('0xd'),auth[_0xb436('0xa')](),controller[_0xb436('0xe')]);router['get']('/:id/hopper_black',auth[_0xb436('0xa')](),controller[_0xb436('0xf')]);router[_0xb436('0x8')]('/:id/lists',auth[_0xb436('0xa')](),controller[_0xb436('0x10')]);router[_0xb436('0x8')](_0xb436('0x11'),auth['isAuthenticated'](),controller[_0xb436('0x12')]);router[_0xb436('0x13')]('/',auth['isAuthenticated'](),controller[_0xb436('0x14')]);router[_0xb436('0x13')](_0xb436('0x15'),auth[_0xb436('0xa')](),controller[_0xb436('0x16')]);router[_0xb436('0x13')](_0xb436('0x17'),auth[_0xb436('0xa')](),controller[_0xb436('0x18')]);router[_0xb436('0x13')](_0xb436('0x11'),auth['isAuthenticated'](),controller[_0xb436('0x19')]);router[_0xb436('0x1a')]('/:id',auth[_0xb436('0xa')](),controller[_0xb436('0x1b')]);router['delete'](_0xb436('0x9'),auth[_0xb436('0xa')](),controller[_0xb436('0x1c')]);router[_0xb436('0x1d')](_0xb436('0x17'),auth['isAuthenticated'](),controller['removeLists']);router[_0xb436('0x1d')](_0xb436('0x11'),auth[_0xb436('0xa')](),controller['removeBlackLists']);module[_0xb436('0x1e')]=router; \ No newline at end of file +var _0xb722=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','put','update','destroy','delete','removeLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x4ca602,_0x330765){var _0xefb7f7=function(_0x2ef10a){while(--_0x2ef10a){_0x4ca602['push'](_0x4ca602['shift']());}};_0xefb7f7(++_0x330765);}(_0xb722,0x191));var _0x2b72=function(_0xf5190e,_0xad681){_0xf5190e=_0xf5190e-0x0;var _0x3d6caa=_0xb722[_0xf5190e];return _0x3d6caa;};'use strict';var multer=require(_0x2b72('0x0'));var util=require('util');var path=require(_0x2b72('0x1'));var timeout=require(_0x2b72('0x2'));var express=require(_0x2b72('0x3'));var router=express[_0x2b72('0x4')]();var fs_extra=require(_0x2b72('0x5'));var auth=require(_0x2b72('0x6'));var interaction=require(_0x2b72('0x7'));var config=require('../../config/environment');var controller=require(_0x2b72('0x8'));router[_0x2b72('0x9')]('/',auth[_0x2b72('0xa')](),controller[_0x2b72('0xb')]);router[_0x2b72('0x9')](_0x2b72('0xc'),auth[_0x2b72('0xa')](),controller[_0x2b72('0xd')]);router['get'](_0x2b72('0xe'),auth[_0x2b72('0xa')](),controller[_0x2b72('0xf')]);router[_0x2b72('0x9')](_0x2b72('0x10'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x11')]);router[_0x2b72('0x9')](_0x2b72('0x12'),auth[_0x2b72('0xa')](),controller['getHopperFinals']);router[_0x2b72('0x9')](_0x2b72('0x13'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x14')]);router[_0x2b72('0x9')](_0x2b72('0x15'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x16')]);router[_0x2b72('0x9')]('/:id/blacklists',auth[_0x2b72('0xa')](),controller[_0x2b72('0x17')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2b72('0x18')](_0x2b72('0x19'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x1a')]);router[_0x2b72('0x18')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2b72('0x1b')]);router['post'](_0x2b72('0x1c'),auth[_0x2b72('0xa')](),controller['addBlackLists']);router[_0x2b72('0x1d')](_0x2b72('0xc'),auth['isAuthenticated'](),controller[_0x2b72('0x1e')]);router['delete']('/:id',auth[_0x2b72('0xa')](),controller[_0x2b72('0x1f')]);router[_0x2b72('0x20')](_0x2b72('0x15'),auth[_0x2b72('0xa')](),controller[_0x2b72('0x21')]);router[_0x2b72('0x20')](_0x2b72('0x1c'),auth[_0x2b72('0xa')](),controller['removeBlackLists']);module[_0x2b72('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 7ccda98..6ec1554 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 _0xc94a=['sequelize','exports','STRING','TEXT','getDataValue','key'];(function(_0x5e3ef6,_0x20d4f4){var _0x1fdc92=function(_0x1d68d4){while(--_0x1d68d4){_0x5e3ef6['push'](_0x5e3ef6['shift']());}};_0x1fdc92(++_0x20d4f4);}(_0xc94a,0x66));var _0xac94=function(_0x188822,_0x3e6635){_0x188822=_0x188822-0x0;var _0x426c69=_0xc94a[_0x188822];return _0x426c69;};'use strict';var Sequelize=require(_0xac94('0x0'));module[_0xac94('0x1')]={'key':{'type':Sequelize[_0xac94('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xac94('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xac94('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xac94('0x4')](_0xac94('0x5'));}}}; \ No newline at end of file +var _0x0448=['key','sequelize','exports','STRING','medium','VIRTUAL','getDataValue'];(function(_0x79b25c,_0x280b81){var _0x16d6c4=function(_0x23ae51){while(--_0x23ae51){_0x79b25c['push'](_0x79b25c['shift']());}};_0x16d6c4(++_0x280b81);}(_0x0448,0x16d));var _0x8044=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x0448[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x8044('0x0'));module[_0x8044('0x1')]={'key':{'type':Sequelize[_0x8044('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x8044('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8044('0x2')]},'name':{'type':Sequelize[_0x8044('0x4')],'get':function(){return this[_0x8044('0x5')](_0x8044('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 503534b..9ae4a2f 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 _0x90d7=['crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','json','apply','reject','save','then','get','CannedAnswers','UserProfileResource','destroy','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','count','findAll','rows','catch','show','params','includeAll','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel'];(function(_0x2769e6,_0x38ef8d){var _0x1211d2=function(_0x4f6c98){while(--_0x4f6c98){_0x2769e6['push'](_0x2769e6['shift']());}};_0x1211d2(++_0x38ef8d);}(_0x90d7,0xfc));var _0x790d=function(_0x5b77df,_0xe63706){_0x5b77df=_0x5b77df-0x0;var _0xabcf56=_0x90d7[_0x5b77df];return _0xabcf56;};'use strict';var emlformat=require(_0x790d('0x0'));var rimraf=require(_0x790d('0x1'));var zipdir=require(_0x790d('0x2'));var jsonpatch=require(_0x790d('0x3'));var rp=require(_0x790d('0x4'));var moment=require(_0x790d('0x5'));var BPromise=require(_0x790d('0x6'));var Mustache=require('mustache');var util=require(_0x790d('0x7'));var path=require('path');var sox=require(_0x790d('0x8'));var csv=require(_0x790d('0x9'));var ejs=require(_0x790d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x790d('0xb'));var crypto=require(_0x790d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x790d('0x9'));var querystring=require('querystring');var Papa=require(_0x790d('0xd'));var Redis=require(_0x790d('0xe'));var authService=require(_0x790d('0xf'));var qs=require(_0x790d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x790d('0x11'));var utils=require(_0x790d('0x12'));var config=require(_0x790d('0x13'));var licenseUtil=require(_0x790d('0x14'));var db=require(_0x790d('0x15'))['db'];function respondWithStatusCode(_0x20420d,_0x588477){_0x588477=_0x588477||0xcc;return function(_0x4591ad){if(_0x4591ad){return _0x20420d[_0x790d('0x16')](_0x588477);}return _0x20420d[_0x790d('0x17')](_0x588477)[_0x790d('0x18')]();};}function respondWithResult(_0x1df5c4,_0x52f31f){_0x52f31f=_0x52f31f||0xc8;return function(_0x1894ab){if(_0x1894ab){return _0x1df5c4[_0x790d('0x17')](_0x52f31f)['json'](_0x1894ab);}};}function respondWithFilteredResult(_0x1951cc,_0xfeee96){return function(_0x3c62cf){if(_0x3c62cf){var _0x2ecb7a=typeof _0xfeee96[_0x790d('0x19')]===_0x790d('0x1a')&&typeof _0xfeee96['limit']===_0x790d('0x1a');var _0x5b45b7=_0x3c62cf['count'];var _0x400990=_0x2ecb7a?0x0:_0xfeee96[_0x790d('0x19')];var _0x760331=_0x2ecb7a?_0x3c62cf['count']:_0xfeee96[_0x790d('0x19')]+_0xfeee96['limit'];var _0x421c09;if(_0x760331>=_0x5b45b7){_0x760331=_0x5b45b7;_0x421c09=0xc8;}else{_0x421c09=0xce;}_0x1951cc[_0x790d('0x17')](_0x421c09);return _0x1951cc[_0x790d('0x1b')](_0x790d('0x1c'),_0x400990+'-'+_0x760331+'/'+_0x5b45b7)[_0x790d('0x1d')](_0x3c62cf);}return null;};}function patchUpdates(_0xeeb62d){return function(_0x3bbad8){try{jsonpatch[_0x790d('0x1e')](_0x3bbad8,_0xeeb62d,!![]);}catch(_0x585959){return BPromise[_0x790d('0x1f')](_0x585959);}return _0x3bbad8[_0x790d('0x20')]();};}function saveUpdates(_0x5ef190,_0x17b660){return function(_0x46b1e6){if(_0x46b1e6){return _0x46b1e6['update'](_0x5ef190)[_0x790d('0x21')](function(_0x5d66f3){return _0x5d66f3;});}return null;};}function removeEntity(_0x587358,_0x6594f){return function(_0x4b1a3a){if(_0x4b1a3a){return _0x4b1a3a['destroy']()[_0x790d('0x21')](function(){var _0x3e6585=_0x4b1a3a[_0x790d('0x22')]({'plain':!![]});var _0x5c576a=_0x790d('0x23');return db[_0x790d('0x24')][_0x790d('0x25')]({'where':{'type':_0x5c576a,'resourceId':_0x3e6585['id']}})[_0x790d('0x21')](function(){return _0x4b1a3a;});})[_0x790d('0x21')](function(){_0x587358[_0x790d('0x17')](0xcc)[_0x790d('0x18')]();});}};}function handleEntityNotFound(_0x35d8cc,_0x65e8b9){return function(_0xc463d1){if(!_0xc463d1){_0x35d8cc[_0x790d('0x16')](0x194);}return _0xc463d1;};}function handleError(_0x21cd8e,_0x37f083){_0x37f083=_0x37f083||0x1f4;return function(_0x5101b0){logger['error'](_0x5101b0[_0x790d('0x26')]);if(_0x5101b0[_0x790d('0x27')]){delete _0x5101b0[_0x790d('0x27')];}_0x21cd8e[_0x790d('0x17')](_0x37f083)[_0x790d('0x28')](_0x5101b0);};}exports[_0x790d('0x29')]=function(_0x5b7e18,_0x17f7d8){var _0x116e51={},_0x1cab50={},_0x234c3e={'count':0x0,'rows':[]};var _0x2914ec=_[_0x790d('0x2a')](db[_0x790d('0x2b')][_0x790d('0x2c')],function(_0x375439){return{'name':_0x375439['fieldName'],'type':_0x375439[_0x790d('0x2d')][_0x790d('0x2e')]};});_0x1cab50['model']=_[_0x790d('0x2a')](_0x2914ec,'name');_0x1cab50[_0x790d('0x2f')]=_[_0x790d('0x30')](_0x5b7e18['query']);_0x1cab50[_0x790d('0x31')]=_['intersection'](_0x1cab50[_0x790d('0x32')],_0x1cab50['query']);_0x116e51[_0x790d('0x33')]=_[_0x790d('0x34')](_0x1cab50['model'],qs[_0x790d('0x35')](_0x5b7e18['query'][_0x790d('0x35')]));_0x116e51['attributes']=_0x116e51[_0x790d('0x33')][_0x790d('0x36')]?_0x116e51[_0x790d('0x33')]:_0x1cab50[_0x790d('0x32')];if(!_0x5b7e18[_0x790d('0x2f')][_0x790d('0x37')](_0x790d('0x38'))){_0x116e51[_0x790d('0x39')]=qs[_0x790d('0x39')](_0x5b7e18['query'][_0x790d('0x39')]);_0x116e51[_0x790d('0x19')]=qs[_0x790d('0x19')](_0x5b7e18[_0x790d('0x2f')]['offset']);}_0x116e51[_0x790d('0x3a')]=qs[_0x790d('0x3b')](_0x5b7e18['query'][_0x790d('0x3b')]);_0x116e51[_0x790d('0x3c')]=qs[_0x790d('0x31')](_['pick'](_0x5b7e18['query'],_0x1cab50[_0x790d('0x31')]),_0x2914ec);if(_0x5b7e18[_0x790d('0x2f')][_0x790d('0x3d')]){_0x116e51[_0x790d('0x3c')]=_[_0x790d('0x3e')](_0x116e51[_0x790d('0x3c')],{'$or':[{'key':{'$like':'%'+_0x5b7e18['query'][_0x790d('0x3d')]+'%'}},{'value':{'$like':'%'+_0x5b7e18[_0x790d('0x2f')]['filter']+'%'}}]});}_0x116e51=_[_0x790d('0x3e')]({},_0x116e51,_0x5b7e18[_0x790d('0x3f')]);var _0x4ba941={'where':_0x116e51[_0x790d('0x3c')]};return db[_0x790d('0x2b')]['count'](_0x4ba941)[_0x790d('0x21')](function(_0x3c157b){_0x234c3e[_0x790d('0x40')]=_0x3c157b;if(_0x5b7e18['query']['includeAll']){_0x116e51['include']=[{'all':!![]}];}return db[_0x790d('0x2b')][_0x790d('0x41')](_0x116e51);})[_0x790d('0x21')](function(_0x3085ba){_0x234c3e[_0x790d('0x42')]=_0x3085ba;return _0x234c3e;})[_0x790d('0x21')](respondWithFilteredResult(_0x17f7d8,_0x116e51))[_0x790d('0x43')](handleError(_0x17f7d8,null));};exports[_0x790d('0x44')]=function(_0x1b3a72,_0x16ed43){var _0x213e65={'raw':!![],'where':{'id':_0x1b3a72[_0x790d('0x45')]['id']}},_0x99c39e={};_0x99c39e['model']=_[_0x790d('0x30')](db[_0x790d('0x2b')][_0x790d('0x2c')]);_0x99c39e[_0x790d('0x2f')]=_[_0x790d('0x30')](_0x1b3a72[_0x790d('0x2f')]);_0x99c39e[_0x790d('0x31')]=_[_0x790d('0x34')](_0x99c39e[_0x790d('0x32')],_0x99c39e['query']);_0x213e65['attributes']=_[_0x790d('0x34')](_0x99c39e['model'],qs[_0x790d('0x35')](_0x1b3a72[_0x790d('0x2f')][_0x790d('0x35')]));_0x213e65[_0x790d('0x33')]=_0x213e65[_0x790d('0x33')][_0x790d('0x36')]?_0x213e65[_0x790d('0x33')]:_0x99c39e[_0x790d('0x32')];if(_0x1b3a72[_0x790d('0x2f')][_0x790d('0x46')]){_0x213e65['include']=[{'all':!![]}];}_0x213e65=_[_0x790d('0x3e')]({},_0x213e65,_0x1b3a72['options']);return db[_0x790d('0x2b')][_0x790d('0x47')](_0x213e65)[_0x790d('0x21')](handleEntityNotFound(_0x16ed43,null))[_0x790d('0x21')](respondWithResult(_0x16ed43,null))[_0x790d('0x43')](handleError(_0x16ed43,null));};exports[_0x790d('0x48')]=function(_0x10ccbb,_0x229b3f){if(_0x10ccbb[_0x790d('0x49')]['id']){delete _0x10ccbb[_0x790d('0x49')]['id'];}return db['CannedAnswer'][_0x790d('0x47')]({'where':{'id':_0x10ccbb['params']['id']}})['then'](handleEntityNotFound(_0x229b3f,null))[_0x790d('0x21')](saveUpdates(_0x10ccbb[_0x790d('0x49')],null))[_0x790d('0x21')](respondWithResult(_0x229b3f,null))['catch'](handleError(_0x229b3f,null));};exports[_0x790d('0x25')]=function(_0x1c25ea,_0x4ca87a){return db[_0x790d('0x2b')]['find']({'where':{'id':_0x1c25ea[_0x790d('0x45')]['id']}})[_0x790d('0x21')](handleEntityNotFound(_0x4ca87a,null))[_0x790d('0x21')](removeEntity(_0x4ca87a,null))[_0x790d('0x43')](handleError(_0x4ca87a,null));};exports[_0x790d('0x4a')]=function(_0x2bde73,_0xe6c84f){var _0x5a35f1={'key':_0x2bde73[_0x790d('0x49')][_0x790d('0x2e')]};if(_0x2bde73[_0x790d('0x49')][_0x790d('0x4b')]){_0x5a35f1[_0x790d('0x4b')]=_0x2bde73[_0x790d('0x49')][_0x790d('0x4b')];}else if(_0x2bde73[_0x790d('0x49')][_0x790d('0x4c')]){_0x5a35f1['SmsAccountId']=_0x2bde73['body'][_0x790d('0x4c')];}else if(_0x2bde73[_0x790d('0x49')][_0x790d('0x4d')]){_0x5a35f1[_0x790d('0x4d')]=_0x2bde73[_0x790d('0x49')][_0x790d('0x4d')];}else if(_0x2bde73['body'][_0x790d('0x4e')]){_0x5a35f1[_0x790d('0x4e')]=_0x2bde73['body'][_0x790d('0x4e')];}return db[_0x790d('0x2b')]['find']({'where':_0x5a35f1})['then'](function(_0x446ff5){if(_0x446ff5){throw new db['Sequelize'][(_0x790d('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x790d('0x2b')]['create'](_0x2bde73[_0x790d('0x49')]);})['then'](function(_0x1219e1){var _0x38b47f=_0x2bde73[_0x790d('0x50')]['get']({'plain':!![]});if(!_0x38b47f)throw new Error(_0x790d('0x51'));if(_0x38b47f[_0x790d('0x52')]===_0x790d('0x50')){var _0x5d6687=_0x1219e1[_0x790d('0x22')]({'plain':!![]});return db[_0x790d('0x53')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x38b47f[_0x790d('0x54')]},'raw':!![]})['then'](function(_0xafd5e9){if(_0xafd5e9&&_0xafd5e9[_0x790d('0x55')]===0x0){return db[_0x790d('0x24')][_0x790d('0x4a')]({'name':_0x5d6687[_0x790d('0x27')],'resourceId':_0x5d6687['id'],'type':_0xafd5e9[_0x790d('0x27')],'sectionId':_0xafd5e9['id']},{})[_0x790d('0x21')](function(){return _0x1219e1;});}else{return _0x1219e1;}})[_0x790d('0x43')](function(_0x2ae6dd){logger[_0x790d('0x56')](_0x790d('0x57'),_0x2ae6dd);throw _0x2ae6dd;});}return _0x1219e1;})['then'](respondWithResult(_0xe6c84f,0xc9))[_0x790d('0x43')](handleError(_0xe6c84f,null));}; \ No newline at end of file +var _0x519b=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','CannedAnswer','include','findAll','rows','catch','show','params','includeAll','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x519b,0x19d));var _0xb519=function(_0x449b54,_0x3776f3){_0x449b54=_0x449b54-0x0;var _0x32d6b9=_0x519b[_0x449b54];return _0x32d6b9;};'use strict';var emlformat=require(_0xb519('0x0'));var rimraf=require(_0xb519('0x1'));var zipdir=require(_0xb519('0x2'));var jsonpatch=require(_0xb519('0x3'));var rp=require(_0xb519('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb519('0x5'));var util=require(_0xb519('0x6'));var path=require(_0xb519('0x7'));var sox=require(_0xb519('0x8'));var csv=require(_0xb519('0x9'));var ejs=require(_0xb519('0xa'));var fs=require('fs');var fs_extra=require(_0xb519('0xb'));var _=require(_0xb519('0xc'));var squel=require(_0xb519('0xd'));var crypto=require(_0xb519('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb519('0xf'));var toCsv=require(_0xb519('0x9'));var querystring=require(_0xb519('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb519('0x11'));var qs=require(_0xb519('0x12'));var as=require(_0xb519('0x13'));var hardwareService=require(_0xb519('0x14'));var logger=require(_0xb519('0x15'))(_0xb519('0x16'));var utils=require(_0xb519('0x17'));var config=require(_0xb519('0x18'));var licenseUtil=require(_0xb519('0x19'));var db=require(_0xb519('0x1a'))['db'];function respondWithStatusCode(_0x3f99a0,_0x17d365){_0x17d365=_0x17d365||0xcc;return function(_0x4dd12a){if(_0x4dd12a){return _0x3f99a0['sendStatus'](_0x17d365);}return _0x3f99a0[_0xb519('0x1b')](_0x17d365)[_0xb519('0x1c')]();};}function respondWithResult(_0x45f63c,_0x34a076){_0x34a076=_0x34a076||0xc8;return function(_0x8e82a3){if(_0x8e82a3){return _0x45f63c[_0xb519('0x1b')](_0x34a076)[_0xb519('0x1d')](_0x8e82a3);}};}function respondWithFilteredResult(_0x276c6f,_0x224200){return function(_0x124965){if(_0x124965){var _0x44a882=typeof _0x224200[_0xb519('0x1e')]===_0xb519('0x1f')&&typeof _0x224200[_0xb519('0x20')]===_0xb519('0x1f');var _0x1258f7=_0x124965[_0xb519('0x21')];var _0x11f96c=_0x44a882?0x0:_0x224200[_0xb519('0x1e')];var _0x35cb95=_0x44a882?_0x124965[_0xb519('0x21')]:_0x224200['offset']+_0x224200[_0xb519('0x20')];var _0x4bf1a9;if(_0x35cb95>=_0x1258f7){_0x35cb95=_0x1258f7;_0x4bf1a9=0xc8;}else{_0x4bf1a9=0xce;}_0x276c6f[_0xb519('0x1b')](_0x4bf1a9);return _0x276c6f[_0xb519('0x22')](_0xb519('0x23'),_0x11f96c+'-'+_0x35cb95+'/'+_0x1258f7)[_0xb519('0x1d')](_0x124965);}return null;};}function patchUpdates(_0x4b4398){return function(_0x4a7e54){try{jsonpatch[_0xb519('0x24')](_0x4a7e54,_0x4b4398,!![]);}catch(_0x970e97){return BPromise[_0xb519('0x25')](_0x970e97);}return _0x4a7e54[_0xb519('0x26')]();};}function saveUpdates(_0x54352a,_0x13a7d1){return function(_0x182842){if(_0x182842){return _0x182842[_0xb519('0x27')](_0x54352a)[_0xb519('0x28')](function(_0xd16956){return _0xd16956;});}return null;};}function removeEntity(_0x251ef5,_0x3d4d0e){return function(_0x2bb354){if(_0x2bb354){return _0x2bb354[_0xb519('0x29')]()[_0xb519('0x28')](function(){var _0x2db1ec=_0x2bb354['get']({'plain':!![]});var _0x2b90b1=_0xb519('0x2a');return db['UserProfileResource'][_0xb519('0x29')]({'where':{'type':_0x2b90b1,'resourceId':_0x2db1ec['id']}})[_0xb519('0x28')](function(){return _0x2bb354;});})['then'](function(){_0x251ef5[_0xb519('0x1b')](0xcc)[_0xb519('0x1c')]();});}};}function handleEntityNotFound(_0x1eceb4,_0x68acef){return function(_0x5da2fb){if(!_0x5da2fb){_0x1eceb4['sendStatus'](0x194);}return _0x5da2fb;};}function handleError(_0x4a1cc4,_0x4e1fd2){_0x4e1fd2=_0x4e1fd2||0x1f4;return function(_0x52e493){logger['error'](_0x52e493['stack']);if(_0x52e493[_0xb519('0x2b')]){delete _0x52e493[_0xb519('0x2b')];}_0x4a1cc4['status'](_0x4e1fd2)[_0xb519('0x2c')](_0x52e493);};}exports[_0xb519('0x2d')]=function(_0x8f29f3,_0x4ecebb){var _0x537143={},_0x29ed43={},_0x5c3892={'count':0x0,'rows':[]};var _0x52f992=_[_0xb519('0x2e')](db['CannedAnswer'][_0xb519('0x2f')],function(_0x54118b){return{'name':_0x54118b[_0xb519('0x30')],'type':_0x54118b['type'][_0xb519('0x31')]};});_0x29ed43[_0xb519('0x32')]=_[_0xb519('0x2e')](_0x52f992,_0xb519('0x2b'));_0x29ed43['query']=_[_0xb519('0x33')](_0x8f29f3['query']);_0x29ed43['filters']=_[_0xb519('0x34')](_0x29ed43[_0xb519('0x32')],_0x29ed43[_0xb519('0x35')]);_0x537143[_0xb519('0x36')]=_['intersection'](_0x29ed43['model'],qs[_0xb519('0x37')](_0x8f29f3[_0xb519('0x35')]['fields']));_0x537143[_0xb519('0x36')]=_0x537143[_0xb519('0x36')][_0xb519('0x38')]?_0x537143[_0xb519('0x36')]:_0x29ed43['model'];if(!_0x8f29f3['query']['hasOwnProperty'](_0xb519('0x39'))){_0x537143[_0xb519('0x20')]=qs[_0xb519('0x20')](_0x8f29f3[_0xb519('0x35')][_0xb519('0x20')]);_0x537143[_0xb519('0x1e')]=qs['offset'](_0x8f29f3[_0xb519('0x35')]['offset']);}_0x537143[_0xb519('0x3a')]=qs[_0xb519('0x3b')](_0x8f29f3['query'][_0xb519('0x3b')]);_0x537143[_0xb519('0x3c')]=qs['filters'](_['pick'](_0x8f29f3[_0xb519('0x35')],_0x29ed43[_0xb519('0x3d')]),_0x52f992);if(_0x8f29f3['query'][_0xb519('0x3e')]){_0x537143['where']=_[_0xb519('0x3f')](_0x537143[_0xb519('0x3c')],{'$or':[{'key':{'$like':'%'+_0x8f29f3[_0xb519('0x35')][_0xb519('0x3e')]+'%'}},{'value':{'$like':'%'+_0x8f29f3[_0xb519('0x35')][_0xb519('0x3e')]+'%'}}]});}_0x537143=_['merge']({},_0x537143,_0x8f29f3[_0xb519('0x40')]);var _0x5030fc={'where':_0x537143[_0xb519('0x3c')]};return db[_0xb519('0x41')]['count'](_0x5030fc)[_0xb519('0x28')](function(_0x255310){_0x5c3892[_0xb519('0x21')]=_0x255310;if(_0x8f29f3[_0xb519('0x35')]['includeAll']){_0x537143[_0xb519('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb519('0x43')](_0x537143);})[_0xb519('0x28')](function(_0x5f190a){_0x5c3892[_0xb519('0x44')]=_0x5f190a;return _0x5c3892;})[_0xb519('0x28')](respondWithFilteredResult(_0x4ecebb,_0x537143))[_0xb519('0x45')](handleError(_0x4ecebb,null));};exports[_0xb519('0x46')]=function(_0x4d94d9,_0xa5d370){var _0x1c083d={'raw':!![],'where':{'id':_0x4d94d9[_0xb519('0x47')]['id']}},_0x11a4d5={};_0x11a4d5[_0xb519('0x32')]=_['keys'](db['CannedAnswer'][_0xb519('0x2f')]);_0x11a4d5[_0xb519('0x35')]=_[_0xb519('0x33')](_0x4d94d9['query']);_0x11a4d5[_0xb519('0x3d')]=_[_0xb519('0x34')](_0x11a4d5[_0xb519('0x32')],_0x11a4d5[_0xb519('0x35')]);_0x1c083d[_0xb519('0x36')]=_[_0xb519('0x34')](_0x11a4d5[_0xb519('0x32')],qs[_0xb519('0x37')](_0x4d94d9[_0xb519('0x35')][_0xb519('0x37')]));_0x1c083d[_0xb519('0x36')]=_0x1c083d[_0xb519('0x36')][_0xb519('0x38')]?_0x1c083d[_0xb519('0x36')]:_0x11a4d5[_0xb519('0x32')];if(_0x4d94d9[_0xb519('0x35')][_0xb519('0x48')]){_0x1c083d[_0xb519('0x42')]=[{'all':!![]}];}_0x1c083d=_[_0xb519('0x3f')]({},_0x1c083d,_0x4d94d9['options']);return db[_0xb519('0x41')][_0xb519('0x49')](_0x1c083d)[_0xb519('0x28')](handleEntityNotFound(_0xa5d370,null))[_0xb519('0x28')](respondWithResult(_0xa5d370,null))['catch'](handleError(_0xa5d370,null));};exports[_0xb519('0x27')]=function(_0x213c77,_0x259b90){if(_0x213c77['body']['id']){delete _0x213c77[_0xb519('0x4a')]['id'];}return db[_0xb519('0x41')][_0xb519('0x49')]({'where':{'id':_0x213c77[_0xb519('0x47')]['id']}})['then'](handleEntityNotFound(_0x259b90,null))[_0xb519('0x28')](saveUpdates(_0x213c77[_0xb519('0x4a')],null))[_0xb519('0x28')](respondWithResult(_0x259b90,null))[_0xb519('0x45')](handleError(_0x259b90,null));};exports[_0xb519('0x29')]=function(_0x85f790,_0x4b04bc){return db[_0xb519('0x41')][_0xb519('0x49')]({'where':{'id':_0x85f790['params']['id']}})['then'](handleEntityNotFound(_0x4b04bc,null))['then'](removeEntity(_0x4b04bc,null))[_0xb519('0x45')](handleError(_0x4b04bc,null));};exports['create']=function(_0xb028b7,_0xa360c6){var _0x27680f={'key':_0xb028b7[_0xb519('0x4a')][_0xb519('0x31')]};if(_0xb028b7[_0xb519('0x4a')][_0xb519('0x4b')]){_0x27680f['MailAccountId']=_0xb028b7['body'][_0xb519('0x4b')];}else if(_0xb028b7[_0xb519('0x4a')][_0xb519('0x4c')]){_0x27680f[_0xb519('0x4c')]=_0xb028b7['body']['SmsAccountId'];}else if(_0xb028b7[_0xb519('0x4a')][_0xb519('0x4d')]){_0x27680f[_0xb519('0x4d')]=_0xb028b7['body']['OpenchannelAccountId'];}else if(_0xb028b7['body'][_0xb519('0x4e')]){_0x27680f['ChatWebsiteId']=_0xb028b7[_0xb519('0x4a')][_0xb519('0x4e')];}return db[_0xb519('0x41')]['find']({'where':_0x27680f})[_0xb519('0x28')](function(_0x3c0e96){if(_0x3c0e96){throw new db['Sequelize'][(_0xb519('0x4f'))](_0xb519('0x50'));}return db[_0xb519('0x41')]['create'](_0xb028b7[_0xb519('0x4a')]);})[_0xb519('0x28')](function(_0x1afa81){var _0x3221c6=_0xb028b7[_0xb519('0x51')][_0xb519('0x52')]({'plain':!![]});if(!_0x3221c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3221c6[_0xb519('0x53')]===_0xb519('0x51')){var _0x368165=_0x1afa81[_0xb519('0x52')]({'plain':!![]});return db[_0xb519('0x54')][_0xb519('0x49')]({'where':{'name':_0xb519('0x2a'),'userProfileId':_0x3221c6[_0xb519('0x55')]},'raw':!![]})[_0xb519('0x28')](function(_0x54fd04){if(_0x54fd04&&_0x54fd04['autoAssociation']===0x0){return db['UserProfileResource'][_0xb519('0x56')]({'name':_0x368165[_0xb519('0x2b')],'resourceId':_0x368165['id'],'type':_0x54fd04[_0xb519('0x2b')],'sectionId':_0x54fd04['id']},{})[_0xb519('0x28')](function(){return _0x1afa81;});}else{return _0x1afa81;}})[_0xb519('0x45')](function(_0x166977){logger[_0xb519('0x57')](_0xb519('0x58'),_0x166977);throw _0x166977;});}return _0x1afa81;})[_0xb519('0x28')](respondWithResult(_0xa360c6,0xc9))[_0xb519('0x45')](handleError(_0xa360c6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 680e44d..5eefd35 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 _0x8d44=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x1d61de,_0x2a303d){var _0x446d8f=function(_0xee1c0d){while(--_0xee1c0d){_0x1d61de['push'](_0x1d61de['shift']());}};_0x446d8f(++_0x2a303d);}(_0x8d44,0x161));var _0x48d4=function(_0xad23c5,_0x2d7c1e){_0xad23c5=_0xad23c5-0x0;var _0x3d1c3d=_0x8d44[_0xad23c5];return _0x3d1c3d;};'use strict';var _=require(_0x48d4('0x0'));var util=require(_0x48d4('0x1'));var logger=require('../../config/logger')(_0x48d4('0x2'));var moment=require(_0x48d4('0x3'));var BPromise=require(_0x48d4('0x4'));var rp=require(_0x48d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x48d4('0x7'));module[_0x48d4('0x8')]=function(_0x4c7a24,_0x32354d){return _0x4c7a24[_0x48d4('0x9')](_0x48d4('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48d4('0xb'),'collate':_0x48d4('0xc')});}; \ No newline at end of file +var _0x39aa=['moment','bluebird','request-promise','path','rimraf','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x47cd82,_0x526cc0){var _0x32ad55=function(_0x18ca6f){while(--_0x18ca6f){_0x47cd82['push'](_0x47cd82['shift']());}};_0x32ad55(++_0x526cc0);}(_0x39aa,0x11b));var _0xa39a=function(_0x2e846d,_0x370cd6){_0x2e846d=_0x2e846d-0x0;var _0x10a6ab=_0x39aa[_0x2e846d];return _0x10a6ab;};'use strict';var _=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var logger=require('../../config/logger')(_0xa39a('0x2'));var moment=require(_0xa39a('0x3'));var BPromise=require(_0xa39a('0x4'));var rp=require(_0xa39a('0x5'));var fs=require('fs');var path=require(_0xa39a('0x6'));var rimraf=require(_0xa39a('0x7'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x3dba2c,_0x911d67){return _0x3dba2c[_0xa39a('0x8')](_0xa39a('0x9'),attributes,{'tableName':_0xa39a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa39a('0xb'),'collate':_0xa39a('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 861e689..d8cdc5e 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(_0xad034c,_0x3cf087){var _0x34b2d8=function(_0xf90315){while(--_0xf90315){_0xad034c['push'](_0xad034c['shift']());}};_0x34b2d8(++_0x3cf087);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x3284fd,_0x547a9e){var _0x506e20=function(_0x26cc53){while(--_0x26cc53){_0x3284fd['push'](_0x3284fd['shift']());}};_0x506e20(++_0x547a9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 15cc6c3..5370a54 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 _0xe40a=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','../../components/auth/service'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0xe40a,0x140));var _0xae40=function(_0x2e835b,_0x337521){_0x2e835b=_0x2e835b-0x0;var _0x1749cb=_0xe40a[_0x2e835b];return _0x1749cb;};'use strict';var multer=require(_0xae40('0x0'));var util=require(_0xae40('0x1'));var path=require(_0xae40('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xae40('0x3'));var interaction=require(_0xae40('0x4'));var config=require(_0xae40('0x5'));var controller=require(_0xae40('0x6'));router[_0xae40('0x7')]('/',auth['isAuthenticated'](),controller[_0xae40('0x8')]);router[_0xae40('0x7')](_0xae40('0x9'),auth[_0xae40('0xa')](),controller[_0xae40('0xb')]);router[_0xae40('0xc')]('/',auth[_0xae40('0xa')](),controller[_0xae40('0xd')]);router[_0xae40('0xe')](_0xae40('0x9'),auth[_0xae40('0xa')](),controller['update']);router[_0xae40('0xf')](_0xae40('0x9'),auth[_0xae40('0xa')](),controller[_0xae40('0x10')]);module[_0xae40('0x11')]=router; \ No newline at end of file +var _0x6717=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','destroy','exports','multer'];(function(_0x631c23,_0x3e18bc){var _0x37f536=function(_0x2a0d53){while(--_0x2a0d53){_0x631c23['push'](_0x631c23['shift']());}};_0x37f536(++_0x3e18bc);}(_0x6717,0x1ef));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7671('0x0'));var util=require('util');var path=require(_0x7671('0x1'));var timeout=require(_0x7671('0x2'));var express=require('express');var router=express[_0x7671('0x3')]();var fs_extra=require(_0x7671('0x4'));var auth=require(_0x7671('0x5'));var interaction=require(_0x7671('0x6'));var config=require('../../config/environment');var controller=require(_0x7671('0x7'));router[_0x7671('0x8')]('/',auth[_0x7671('0x9')](),controller[_0x7671('0xa')]);router['get'](_0x7671('0xb'),auth[_0x7671('0x9')](),controller[_0x7671('0xc')]);router['post']('/',auth[_0x7671('0x9')](),controller[_0x7671('0xd')]);router['put'](_0x7671('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7671('0xb'),auth[_0x7671('0x9')](),controller[_0x7671('0xe')]);module[_0x7671('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3eca3f9..6a74431 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 _0x8801=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x583ceb,_0x28ed3e){var _0x446926=function(_0x400b5c){while(--_0x400b5c){_0x583ceb['push'](_0x583ceb['shift']());}};_0x446926(++_0x28ed3e);}(_0x8801,0x116));var _0x1880=function(_0x5def8c,_0x38cf36){_0x5def8c=_0x5def8c-0x0;var _0x14caae=_0x8801[_0x5def8c];return _0x14caae;};'use strict';var Sequelize=require(_0x1880('0x0'));module[_0x1880('0x1')]={'calldate':{'type':Sequelize[_0x1880('0x2')],'allowNull':![],'defaultValue':_0x1880('0x3')},'clid':{'type':Sequelize[_0x1880('0x4')]},'src':{'type':Sequelize[_0x1880('0x4')]},'dst':{'type':Sequelize[_0x1880('0x4')]},'dcontext':{'type':Sequelize[_0x1880('0x4')]},'channel':{'type':Sequelize[_0x1880('0x4')]},'dstchannel':{'type':Sequelize[_0x1880('0x4')]},'lastapp':{'type':Sequelize[_0x1880('0x4')]},'lastdata':{'type':Sequelize[_0x1880('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1880('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1880('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1880('0x4')]},'userfield':{'type':Sequelize[_0x1880('0x4')]},'uniqueid':{'type':Sequelize[_0x1880('0x4')]},'linkedid':{'type':Sequelize[_0x1880('0x4')]},'sequence':{'type':Sequelize[_0x1880('0x4')]},'peeraccount':{'type':Sequelize[_0x1880('0x4')]},'type':{'type':Sequelize[_0x1880('0x4')]},'tag':{'type':Sequelize[_0x1880('0x4')]}}; \ No newline at end of file +var _0xda1c=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4c8c4d,_0x170fc3){var _0x7c72d2=function(_0x249fd1){while(--_0x249fd1){_0x4c8c4d['push'](_0x4c8c4d['shift']());}};_0x7c72d2(++_0x170fc3);}(_0xda1c,0x68));var _0xcda1=function(_0x136a97,_0x140d35){_0x136a97=_0x136a97-0x0;var _0x42f478=_0xda1c[_0x136a97];return _0x42f478;};'use strict';var Sequelize=require(_0xcda1('0x0'));module[_0xcda1('0x1')]={'calldate':{'type':Sequelize[_0xcda1('0x2')],'allowNull':![],'defaultValue':_0xcda1('0x3')},'clid':{'type':Sequelize[_0xcda1('0x4')]},'src':{'type':Sequelize[_0xcda1('0x4')]},'dst':{'type':Sequelize[_0xcda1('0x4')]},'dcontext':{'type':Sequelize[_0xcda1('0x4')]},'channel':{'type':Sequelize[_0xcda1('0x4')]},'dstchannel':{'type':Sequelize[_0xcda1('0x4')]},'lastapp':{'type':Sequelize[_0xcda1('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xcda1('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xcda1('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcda1('0x4')]},'amaflags':{'type':Sequelize[_0xcda1('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcda1('0x4')]},'userfield':{'type':Sequelize[_0xcda1('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xcda1('0x4')]},'sequence':{'type':Sequelize[_0xcda1('0x4')]},'peeraccount':{'type':Sequelize[_0xcda1('0x4')]},'type':{'type':Sequelize[_0xcda1('0x4')]},'tag':{'type':Sequelize[_0xcda1('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 97822ae..2860f77 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 _0x6eed=['stack','name','index','map','Cdr','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','end','error'];(function(_0x38946c,_0x5bccfc){var _0x33cdb3=function(_0x1a8217){while(--_0x1a8217){_0x38946c['push'](_0x38946c['shift']());}};_0x33cdb3(++_0x5bccfc);}(_0x6eed,0xff));var _0xd6ee=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x6eed[_0x280f4a];return _0x1bb157;};'use strict';var emlformat=require(_0xd6ee('0x0'));var rimraf=require(_0xd6ee('0x1'));var zipdir=require(_0xd6ee('0x2'));var jsonpatch=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var moment=require('moment');var BPromise=require(_0xd6ee('0x5'));var Mustache=require(_0xd6ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6ee('0x7'));var csv=require(_0xd6ee('0x8'));var ejs=require(_0xd6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd6ee('0xa'));var _=require(_0xd6ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6ee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6ee('0xd'));var Redis=require(_0xd6ee('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd6ee('0xf'));var as=require(_0xd6ee('0x10'));var hardwareService=require(_0xd6ee('0x11'));var logger=require(_0xd6ee('0x12'))('api');var utils=require(_0xd6ee('0x13'));var config=require(_0xd6ee('0x14'));var licenseUtil=require(_0xd6ee('0x15'));var db=require(_0xd6ee('0x16'))['db'];function respondWithStatusCode(_0x268dd1,_0x3fd1df){_0x3fd1df=_0x3fd1df||0xcc;return function(_0x48be63){if(_0x48be63){return _0x268dd1[_0xd6ee('0x17')](_0x3fd1df);}return _0x268dd1[_0xd6ee('0x18')](_0x3fd1df)['end']();};}function respondWithResult(_0x369b4a,_0x15918d){_0x15918d=_0x15918d||0xc8;return function(_0x2bf3b2){if(_0x2bf3b2){return _0x369b4a[_0xd6ee('0x18')](_0x15918d)[_0xd6ee('0x19')](_0x2bf3b2);}};}function respondWithFilteredResult(_0xe66d0d,_0x49bafc){return function(_0x1c2e51){if(_0x1c2e51){var _0xb99b70=typeof _0x49bafc[_0xd6ee('0x1a')]==='undefined'&&typeof _0x49bafc[_0xd6ee('0x1b')]==='undefined';var _0x3a82bf=_0x1c2e51[_0xd6ee('0x1c')];var _0x81d533=_0xb99b70?0x0:_0x49bafc['offset'];var _0x8a2718=_0xb99b70?_0x1c2e51['count']:_0x49bafc[_0xd6ee('0x1a')]+_0x49bafc['limit'];var _0x31ae0f;if(_0x8a2718>=_0x3a82bf){_0x8a2718=_0x3a82bf;_0x31ae0f=0xc8;}else{_0x31ae0f=0xce;}_0xe66d0d[_0xd6ee('0x18')](_0x31ae0f);return _0xe66d0d[_0xd6ee('0x1d')](_0xd6ee('0x1e'),_0x81d533+'-'+_0x8a2718+'/'+_0x3a82bf)[_0xd6ee('0x19')](_0x1c2e51);}return null;};}function patchUpdates(_0x4b33f1){return function(_0xe2f8c4){try{jsonpatch['apply'](_0xe2f8c4,_0x4b33f1,!![]);}catch(_0x17e011){return BPromise[_0xd6ee('0x1f')](_0x17e011);}return _0xe2f8c4[_0xd6ee('0x20')]();};}function saveUpdates(_0x1abedc,_0xec9287){return function(_0x48e6ad){if(_0x48e6ad){return _0x48e6ad['update'](_0x1abedc)[_0xd6ee('0x21')](function(_0x511c18){return _0x511c18;});}return null;};}function removeEntity(_0x2bae66,_0x519373){return function(_0x391844){if(_0x391844){return _0x391844[_0xd6ee('0x22')]()[_0xd6ee('0x21')](function(){_0x2bae66[_0xd6ee('0x18')](0xcc)[_0xd6ee('0x23')]();});}};}function handleEntityNotFound(_0x5476f2,_0x4b1926){return function(_0x2f438c){if(!_0x2f438c){_0x5476f2[_0xd6ee('0x17')](0x194);}return _0x2f438c;};}function handleError(_0x4edb7d,_0x2c9b30){_0x2c9b30=_0x2c9b30||0x1f4;return function(_0xa1e700){logger[_0xd6ee('0x24')](_0xa1e700[_0xd6ee('0x25')]);if(_0xa1e700[_0xd6ee('0x26')]){delete _0xa1e700[_0xd6ee('0x26')];}_0x4edb7d[_0xd6ee('0x18')](_0x2c9b30)['send'](_0xa1e700);};}exports[_0xd6ee('0x27')]=function(_0x124ab7,_0x50b786){var _0x5bcdd6={},_0x1578b3={},_0x4580a7={'count':0x0,'rows':[]};var _0xddca=_[_0xd6ee('0x28')](db[_0xd6ee('0x29')]['rawAttributes'],function(_0x414015){return{'name':_0x414015[_0xd6ee('0x2a')],'type':_0x414015[_0xd6ee('0x2b')]['key']};});_0x1578b3[_0xd6ee('0x2c')]=_[_0xd6ee('0x28')](_0xddca,_0xd6ee('0x26'));_0x1578b3['query']=_[_0xd6ee('0x2d')](_0x124ab7[_0xd6ee('0x2e')]);_0x1578b3[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],_0x1578b3[_0xd6ee('0x2e')]);_0x5bcdd6['attributes']=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x124ab7[_0xd6ee('0x2e')]['fields']));_0x5bcdd6[_0xd6ee('0x32')]=_0x5bcdd6[_0xd6ee('0x32')][_0xd6ee('0x33')]?_0x5bcdd6['attributes']:_0x1578b3['model'];if(!_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x34')](_0xd6ee('0x35'))){_0x5bcdd6[_0xd6ee('0x1b')]=qs[_0xd6ee('0x1b')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1b')]);_0x5bcdd6[_0xd6ee('0x1a')]=qs[_0xd6ee('0x1a')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1a')]);}_0x5bcdd6[_0xd6ee('0x36')]=qs[_0xd6ee('0x37')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x37')]);_0x5bcdd6['where']=qs[_0xd6ee('0x2f')](_[_0xd6ee('0x38')](_0x124ab7[_0xd6ee('0x2e')],_0x1578b3['filters']),_0xddca);if(_0x124ab7['query']['filter']){_0x5bcdd6['where']=_[_0xd6ee('0x39')](_0x5bcdd6[_0xd6ee('0x3a')],{'$or':_[_0xd6ee('0x28')](_0xddca,function(_0x2a6d2f){if(_0x2a6d2f[_0xd6ee('0x2b')]!==_0xd6ee('0x3b')){var _0x2c975a={};_0x2c975a[_0x2a6d2f['name']]={'$like':'%'+_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x3c')]+'%'};return _0x2c975a;}})});}_0x5bcdd6=_[_0xd6ee('0x39')]({},_0x5bcdd6,_0x124ab7[_0xd6ee('0x3d')]);var _0x407748={'where':_0x5bcdd6[_0xd6ee('0x3a')]};return db[_0xd6ee('0x29')][_0xd6ee('0x1c')](_0x407748)[_0xd6ee('0x21')](function(_0x24a7cb){_0x4580a7['count']=_0x24a7cb;if(_0x124ab7['query']['includeAll']){_0x5bcdd6[_0xd6ee('0x3e')]=[{'all':!![]}];}return db['Cdr'][_0xd6ee('0x3f')](_0x5bcdd6);})[_0xd6ee('0x21')](function(_0x96aa7f){_0x4580a7[_0xd6ee('0x40')]=_0x96aa7f;return _0x4580a7;})[_0xd6ee('0x21')](respondWithFilteredResult(_0x50b786,_0x5bcdd6))['catch'](handleError(_0x50b786,null));};exports['show']=function(_0x4db1e9,_0x557936){var _0x3337a1={'raw':!![],'where':{'id':_0x4db1e9[_0xd6ee('0x41')]['id']}},_0xf38fc4={};_0xf38fc4[_0xd6ee('0x2c')]=_[_0xd6ee('0x2d')](db[_0xd6ee('0x29')][_0xd6ee('0x42')]);_0xf38fc4[_0xd6ee('0x2e')]=_[_0xd6ee('0x2d')](_0x4db1e9['query']);_0xf38fc4[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0xf38fc4['model'],_0xf38fc4[_0xd6ee('0x2e')]);_0x3337a1['attributes']=_['intersection'](_0xf38fc4[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x4db1e9[_0xd6ee('0x2e')][_0xd6ee('0x31')]));_0x3337a1[_0xd6ee('0x32')]=_0x3337a1[_0xd6ee('0x32')]['length']?_0x3337a1['attributes']:_0xf38fc4[_0xd6ee('0x2c')];if(_0x4db1e9[_0xd6ee('0x2e')]['includeAll']){_0x3337a1[_0xd6ee('0x3e')]=[{'all':!![]}];}_0x3337a1=_['merge']({},_0x3337a1,_0x4db1e9[_0xd6ee('0x3d')]);return db[_0xd6ee('0x29')][_0xd6ee('0x43')](_0x3337a1)[_0xd6ee('0x21')](handleEntityNotFound(_0x557936,null))[_0xd6ee('0x21')](respondWithResult(_0x557936,null))[_0xd6ee('0x44')](handleError(_0x557936,null));};exports[_0xd6ee('0x45')]=function(_0x1b02c4,_0x37c3ba){return db[_0xd6ee('0x29')][_0xd6ee('0x45')](_0x1b02c4['body'],{})[_0xd6ee('0x21')](respondWithResult(_0x37c3ba,0xc9))[_0xd6ee('0x44')](handleError(_0x37c3ba,null));};exports[_0xd6ee('0x46')]=function(_0x360e34,_0x418680){if(_0x360e34[_0xd6ee('0x47')]['id']){delete _0x360e34[_0xd6ee('0x47')]['id'];}return db[_0xd6ee('0x29')][_0xd6ee('0x43')]({'where':{'id':_0x360e34[_0xd6ee('0x41')]['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x418680,null))[_0xd6ee('0x21')](saveUpdates(_0x360e34['body'],null))[_0xd6ee('0x21')](respondWithResult(_0x418680,null))[_0xd6ee('0x44')](handleError(_0x418680,null));};exports[_0xd6ee('0x22')]=function(_0x52dfd3,_0x2f1bef){return db['Cdr'][_0xd6ee('0x43')]({'where':{'id':_0x52dfd3['params']['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x2f1bef,null))[_0xd6ee('0x21')](removeEntity(_0x2f1bef,null))['catch'](handleError(_0x2f1bef,null));};exports[_0xd6ee('0x48')]=function(_0x164df4,_0xaef499){return db['Cdr'][_0xd6ee('0x48')]()[_0xd6ee('0x21')](respondWithResult(_0xaef499,null))['catch'](handleError(_0xaef499,null));}; \ No newline at end of file +var _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x1dda71,_0x2bb545){var _0x5f2f56=function(_0x12b250){while(--_0x12b250){_0x1dda71['push'](_0x1dda71['shift']());}};_0x5f2f56(++_0x2bb545);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2f1bf92..ec10ab3 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(_0x9b51cd,_0x11c283){var _0x1613af=function(_0x591678){while(--_0x591678){_0x9b51cd['push'](_0x9b51cd['shift']());}};_0x1613af(++_0x11c283);}(_0x7a54,0x106));var _0x47a5=function(_0x1c69e0,_0x611d3f){_0x1c69e0=_0x1c69e0-0x0;var _0x241a55=_0x7a54[_0x1c69e0];return _0x241a55;};'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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3b49ee,_0x4c25f5){var _0x3e07b5=function(_0x38bed4){while(--_0x38bed4){_0x3b49ee['push'](_0x3b49ee['shift']());}};_0x3e07b5(++_0x4c25f5);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a964793..eb3b12e 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 _0xd5f1=['../../config/environment','jayson/promise','client','request','Cdr,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x73862b,_0x53772f){var _0x5616b1=function(_0x276e16){while(--_0x276e16){_0x73862b['push'](_0x73862b['shift']());}};_0x5616b1(++_0x53772f);}(_0xd5f1,0xb4));var _0x1d5f=function(_0x4108e9,_0x58da63){_0x4108e9=_0x4108e9-0x0;var _0x369cc4=_0xd5f1[_0x4108e9];return _0x369cc4;};'use strict';var _=require(_0x1d5f('0x0'));var util=require(_0x1d5f('0x1'));var moment=require('moment');var BPromise=require(_0x1d5f('0x2'));var rs=require(_0x1d5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d5f('0x4'))['db'];var utils=require(_0x1d5f('0x5'));var logger=require(_0x1d5f('0x6'))('rpc');var config=require(_0x1d5f('0x7'));var jayson=require(_0x1d5f('0x8'));var client=jayson[_0x1d5f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26496f,_0x11c2c7,_0x54e033){return new BPromise(function(_0x15813d,_0xcfe34e){return client[_0x1d5f('0xa')](_0x26496f,_0x54e033)['then'](function(_0x4ed6f2){logger['info'](_0x1d5f('0xb'),_0x11c2c7,_0x1d5f('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x11c2c7,_0x1d5f('0xc'),JSON['stringify'](_0x4ed6f2));if(_0x4ed6f2[_0x1d5f('0xd')]){if(_0x4ed6f2[_0x1d5f('0xd')][_0x1d5f('0xe')]===0x1f4){logger[_0x1d5f('0xd')](_0x1d5f('0xb'),_0x11c2c7,_0x4ed6f2[_0x1d5f('0xd')][_0x1d5f('0xf')]);return _0xcfe34e(_0x4ed6f2[_0x1d5f('0xd')][_0x1d5f('0xf')]);}logger[_0x1d5f('0xd')](_0x1d5f('0xb'),_0x11c2c7,_0x4ed6f2[_0x1d5f('0xd')][_0x1d5f('0xf')]);return _0x15813d(_0x4ed6f2[_0x1d5f('0xd')][_0x1d5f('0xf')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x11c2c7,_0x1d5f('0xc'));_0x15813d(_0x4ed6f2[_0x1d5f('0x10')][_0x1d5f('0xf')]);}})['catch'](function(_0x5cd938){logger[_0x1d5f('0xd')](_0x1d5f('0xb'),_0x11c2c7,_0x5cd938);_0xcfe34e(_0x5cd938);});});} \ No newline at end of file +var _0xe852=['info','request\x20sent','debug','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe852,0x15a));var _0x2e85=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe852[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x2e85('0x0'));var util=require(_0x2e85('0x1'));var moment=require('moment');var BPromise=require(_0x2e85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2e85('0x3'));var logger=require(_0x2e85('0x4'))(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var jayson=require(_0x2e85('0x7'));var client=jayson[_0x2e85('0x8')][_0x2e85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8907ba,_0x3778ad,_0x388fd6){return new BPromise(function(_0x520552,_0x2efc7c){return client[_0x2e85('0xa')](_0x8907ba,_0x388fd6)['then'](function(_0x2f7237){logger[_0x2e85('0xb')]('Cdr,\x20%s,\x20%s',_0x3778ad,_0x2e85('0xc'));logger[_0x2e85('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3778ad,'request\x20sent',JSON[_0x2e85('0xe')](_0x2f7237));if(_0x2f7237[_0x2e85('0xf')]){if(_0x2f7237[_0x2e85('0xf')][_0x2e85('0x10')]===0x1f4){logger['error'](_0x2e85('0x11'),_0x3778ad,_0x2f7237['error'][_0x2e85('0x12')]);return _0x2efc7c(_0x2f7237[_0x2e85('0xf')][_0x2e85('0x12')]);}logger[_0x2e85('0xf')](_0x2e85('0x11'),_0x3778ad,_0x2f7237[_0x2e85('0xf')][_0x2e85('0x12')]);return _0x520552(_0x2f7237[_0x2e85('0xf')][_0x2e85('0x12')]);}else{logger[_0x2e85('0xb')]('Cdr,\x20%s,\x20%s',_0x3778ad,_0x2e85('0xc'));_0x520552(_0x2f7237[_0x2e85('0x13')][_0x2e85('0x12')]);}})[_0x2e85('0x14')](function(_0x18004d){logger[_0x2e85('0xf')](_0x2e85('0x11'),_0x3778ad,_0x18004d);_0x2efc7c(_0x18004d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 27c4845..c3ee563 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2d595f,_0xdfdb46){var _0x1e26a2=function(_0x17f26a){while(--_0x17f26a){_0x2d595f['push'](_0x2d595f['shift']());}};_0x1e26a2(++_0xdfdb46);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x437ea9,_0x55c4cd){var _0x5c04b4=function(_0x8d7a4a){while(--_0x8d7a4a){_0x437ea9['push'](_0x437ea9['shift']());}};_0x5c04b4(++_0x55c4cd);}(_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 548ea8a..cabdbdd 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 _0xa128=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x17b9b7,_0x4e4f73){var _0x8b11f7=function(_0xb599cb){while(--_0xb599cb){_0x17b9b7['push'](_0x17b9b7['shift']());}};_0x8b11f7(++_0x4e4f73);}(_0xa128,0x16c));var _0x8a12=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa128[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x8a12('0x0'));module[_0x8a12('0x1')]={'priority':{'type':Sequelize[_0x8a12('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8a12('0x3')]()},'description':{'type':Sequelize[_0x8a12('0x4')]},'interval':{'type':Sequelize[_0x8a12('0x4')],'defaultValue':_0x8a12('0x5')}}; \ No newline at end of file +var _0x874b=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x874b,0x147));var _0xb874=function(_0x9166ea,_0x1f21b0){_0x9166ea=_0x9166ea-0x0;var _0xdceec9=_0x874b[_0x9166ea];return _0xdceec9;};'use strict';var Sequelize=require(_0xb874('0x0'));module[_0xb874('0x1')]={'priority':{'type':Sequelize[_0xb874('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb874('0x3')]()},'description':{'type':Sequelize[_0xb874('0x4')]},'interval':{'type':Sequelize[_0xb874('0x4')],'defaultValue':_0xb874('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index aed48b7..f6590ca 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 _0x7035=['then','error','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll','include','merge','find','catch','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x7035,0x15e));var _0x5703=function(_0x21d4b3,_0x965f71){_0x21d4b3=_0x21d4b3-0x0;var _0x367832=_0x7035[_0x21d4b3];return _0x367832;};'use strict';var emlformat=require(_0x5703('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5703('0x1'));var jsonpatch=require(_0x5703('0x2'));var rp=require('request-promise');var moment=require(_0x5703('0x3'));var BPromise=require(_0x5703('0x4'));var Mustache=require(_0x5703('0x5'));var util=require(_0x5703('0x6'));var path=require(_0x5703('0x7'));var sox=require('sox');var csv=require(_0x5703('0x8'));var ejs=require(_0x5703('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5703('0xa'));var squel=require(_0x5703('0xb'));var crypto=require(_0x5703('0xc'));var jsforce=require(_0x5703('0xd'));var deskjs=require(_0x5703('0xe'));var toCsv=require(_0x5703('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5703('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5703('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5703('0x11'))(_0x5703('0x12'));var utils=require(_0x5703('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5703('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b5b4,_0x360cc8){_0x360cc8=_0x360cc8||0xcc;return function(_0x4868ad){if(_0x4868ad){return _0x36b5b4[_0x5703('0x15')](_0x360cc8);}return _0x36b5b4[_0x5703('0x16')](_0x360cc8)[_0x5703('0x17')]();};}function respondWithResult(_0xac9482,_0x3e0cac){_0x3e0cac=_0x3e0cac||0xc8;return function(_0x2e845b){if(_0x2e845b){return _0xac9482[_0x5703('0x16')](_0x3e0cac)[_0x5703('0x18')](_0x2e845b);}};}function respondWithFilteredResult(_0x4a3e78,_0x6dbb73){return function(_0x2f6305){if(_0x2f6305){var _0x46dbca=typeof _0x6dbb73[_0x5703('0x19')]===_0x5703('0x1a')&&typeof _0x6dbb73[_0x5703('0x1b')]===_0x5703('0x1a');var _0x8d0996=_0x2f6305[_0x5703('0x1c')];var _0x595fca=_0x46dbca?0x0:_0x6dbb73[_0x5703('0x19')];var _0xba6348=_0x46dbca?_0x2f6305['count']:_0x6dbb73['offset']+_0x6dbb73[_0x5703('0x1b')];var _0x9ab50a;if(_0xba6348>=_0x8d0996){_0xba6348=_0x8d0996;_0x9ab50a=0xc8;}else{_0x9ab50a=0xce;}_0x4a3e78['status'](_0x9ab50a);return _0x4a3e78[_0x5703('0x1d')]('Content-Range',_0x595fca+'-'+_0xba6348+'/'+_0x8d0996)[_0x5703('0x18')](_0x2f6305);}return null;};}function patchUpdates(_0x33d30a){return function(_0x1d5a40){try{jsonpatch[_0x5703('0x1e')](_0x1d5a40,_0x33d30a,!![]);}catch(_0x2a23a3){return BPromise[_0x5703('0x1f')](_0x2a23a3);}return _0x1d5a40[_0x5703('0x20')]();};}function saveUpdates(_0x4f5ebe,_0x4f90e7){return function(_0x2f4d83){if(_0x2f4d83){return _0x2f4d83[_0x5703('0x21')](_0x4f5ebe)['then'](function(_0x28ff84){return _0x28ff84;});}return null;};}function removeEntity(_0x245abf,_0x48746a){return function(_0x27da08){if(_0x27da08){return _0x27da08[_0x5703('0x22')]()[_0x5703('0x23')](function(){_0x245abf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5326dc,_0x1dbf0d){return function(_0x495db2){if(!_0x495db2){_0x5326dc[_0x5703('0x15')](0x194);}return _0x495db2;};}function handleError(_0x1c1e18,_0x46ad74){_0x46ad74=_0x46ad74||0x1f4;return function(_0x25e518){logger[_0x5703('0x24')](_0x25e518['stack']);if(_0x25e518[_0x5703('0x25')]){delete _0x25e518['name'];}_0x1c1e18[_0x5703('0x16')](_0x46ad74)[_0x5703('0x26')](_0x25e518);};}exports[_0x5703('0x27')]=function(_0x4b23ed,_0x4352c1){var _0x2e2a25={'raw':!![],'where':{'id':_0x4b23ed[_0x5703('0x28')]['id']}},_0x4c1bcd={};_0x4c1bcd[_0x5703('0x29')]=_[_0x5703('0x2a')](db[_0x5703('0x2b')]['rawAttributes']);_0x4c1bcd['query']=_[_0x5703('0x2a')](_0x4b23ed[_0x5703('0x2c')]);_0x4c1bcd[_0x5703('0x2d')]=_[_0x5703('0x2e')](_0x4c1bcd[_0x5703('0x29')],_0x4c1bcd[_0x5703('0x2c')]);_0x2e2a25[_0x5703('0x2f')]=_[_0x5703('0x2e')](_0x4c1bcd[_0x5703('0x29')],qs[_0x5703('0x30')](_0x4b23ed[_0x5703('0x2c')][_0x5703('0x30')]));_0x2e2a25[_0x5703('0x2f')]=_0x2e2a25['attributes']['length']?_0x2e2a25['attributes']:_0x4c1bcd[_0x5703('0x29')];if(_0x4b23ed[_0x5703('0x2c')][_0x5703('0x31')]){_0x2e2a25[_0x5703('0x32')]=[{'all':!![]}];}_0x2e2a25=_[_0x5703('0x33')]({},_0x2e2a25,_0x4b23ed['options']);return db[_0x5703('0x2b')][_0x5703('0x34')](_0x2e2a25)[_0x5703('0x23')](handleEntityNotFound(_0x4352c1,null))['then'](respondWithResult(_0x4352c1,null))[_0x5703('0x35')](handleError(_0x4352c1,null));};exports[_0x5703('0x21')]=function(_0x2351ac,_0x2eab10){if(_0x2351ac['body']['id']){delete _0x2351ac[_0x5703('0x36')]['id'];}return db[_0x5703('0x2b')]['find']({'where':{'id':_0x2351ac[_0x5703('0x28')]['id']}})[_0x5703('0x23')](handleEntityNotFound(_0x2eab10,null))[_0x5703('0x23')](saveUpdates(_0x2351ac['body'],null))[_0x5703('0x23')](respondWithResult(_0x2eab10,null))['catch'](handleError(_0x2eab10,null));};exports[_0x5703('0x22')]=function(_0x319aa6,_0x171748){return db[_0x5703('0x2b')]['find']({'where':{'id':_0x319aa6['params']['id']}})[_0x5703('0x23')](handleEntityNotFound(_0x171748,null))[_0x5703('0x23')](removeEntity(_0x171748,null))[_0x5703('0x35')](handleError(_0x171748,null));}; \ No newline at end of file +var _0xdb76=['Content-Range','apply','reject','save','then','destroy','end','error','stack','send','show','params','model','ChatApplication','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x2a033e,_0x150109){var _0xed1d3c=function(_0x5e8c88){while(--_0x5e8c88){_0x2a033e['push'](_0x2a033e['shift']());}};_0xed1d3c(++_0x150109);}(_0xdb76,0x1be));var _0x6db7=function(_0x3de5ab,_0x40a1d8){_0x3de5ab=_0x3de5ab-0x0;var _0x28be50=_0xdb76[_0x3de5ab];return _0x28be50;};'use strict';var emlformat=require(_0x6db7('0x0'));var rimraf=require(_0x6db7('0x1'));var zipdir=require(_0x6db7('0x2'));var jsonpatch=require(_0x6db7('0x3'));var rp=require(_0x6db7('0x4'));var moment=require('moment');var BPromise=require(_0x6db7('0x5'));var Mustache=require(_0x6db7('0x6'));var util=require(_0x6db7('0x7'));var path=require(_0x6db7('0x8'));var sox=require('sox');var csv=require(_0x6db7('0x9'));var ejs=require(_0x6db7('0xa'));var fs=require('fs');var fs_extra=require(_0x6db7('0xb'));var _=require(_0x6db7('0xc'));var squel=require(_0x6db7('0xd'));var crypto=require('crypto');var jsforce=require(_0x6db7('0xe'));var deskjs=require(_0x6db7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6db7('0x10'));var Papa=require(_0x6db7('0x11'));var Redis=require(_0x6db7('0x12'));var authService=require(_0x6db7('0x13'));var qs=require(_0x6db7('0x14'));var as=require(_0x6db7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6db7('0x16'));var utils=require(_0x6db7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6db7('0x18'));var db=require(_0x6db7('0x19'))['db'];function respondWithStatusCode(_0x421d28,_0x1658dd){_0x1658dd=_0x1658dd||0xcc;return function(_0x375f4a){if(_0x375f4a){return _0x421d28[_0x6db7('0x1a')](_0x1658dd);}return _0x421d28['status'](_0x1658dd)['end']();};}function respondWithResult(_0x426d31,_0x348ccf){_0x348ccf=_0x348ccf||0xc8;return function(_0x167384){if(_0x167384){return _0x426d31[_0x6db7('0x1b')](_0x348ccf)[_0x6db7('0x1c')](_0x167384);}};}function respondWithFilteredResult(_0x28dd67,_0x144684){return function(_0x43f66c){if(_0x43f66c){var _0x1432ac=typeof _0x144684[_0x6db7('0x1d')]===_0x6db7('0x1e')&&typeof _0x144684[_0x6db7('0x1f')]==='undefined';var _0x3c97b2=_0x43f66c[_0x6db7('0x20')];var _0x331e92=_0x1432ac?0x0:_0x144684[_0x6db7('0x1d')];var _0x37ffe3=_0x1432ac?_0x43f66c[_0x6db7('0x20')]:_0x144684[_0x6db7('0x1d')]+_0x144684[_0x6db7('0x1f')];var _0x3f8575;if(_0x37ffe3>=_0x3c97b2){_0x37ffe3=_0x3c97b2;_0x3f8575=0xc8;}else{_0x3f8575=0xce;}_0x28dd67[_0x6db7('0x1b')](_0x3f8575);return _0x28dd67[_0x6db7('0x21')](_0x6db7('0x22'),_0x331e92+'-'+_0x37ffe3+'/'+_0x3c97b2)['json'](_0x43f66c);}return null;};}function patchUpdates(_0x1cae66){return function(_0x206aa2){try{jsonpatch[_0x6db7('0x23')](_0x206aa2,_0x1cae66,!![]);}catch(_0x46a383){return BPromise[_0x6db7('0x24')](_0x46a383);}return _0x206aa2[_0x6db7('0x25')]();};}function saveUpdates(_0x4a78f7,_0x1b0f04){return function(_0x2795ab){if(_0x2795ab){return _0x2795ab['update'](_0x4a78f7)[_0x6db7('0x26')](function(_0x1ba956){return _0x1ba956;});}return null;};}function removeEntity(_0x7ca54f,_0x48e3af){return function(_0x24d818){if(_0x24d818){return _0x24d818[_0x6db7('0x27')]()['then'](function(){_0x7ca54f[_0x6db7('0x1b')](0xcc)[_0x6db7('0x28')]();});}};}function handleEntityNotFound(_0x2d6fca,_0x558d58){return function(_0x559e14){if(!_0x559e14){_0x2d6fca[_0x6db7('0x1a')](0x194);}return _0x559e14;};}function handleError(_0x105b81,_0xdbd9f1){_0xdbd9f1=_0xdbd9f1||0x1f4;return function(_0x4f28e9){logger[_0x6db7('0x29')](_0x4f28e9[_0x6db7('0x2a')]);if(_0x4f28e9['name']){delete _0x4f28e9['name'];}_0x105b81[_0x6db7('0x1b')](_0xdbd9f1)[_0x6db7('0x2b')](_0x4f28e9);};}exports[_0x6db7('0x2c')]=function(_0x3890f0,_0x11185d){var _0xc4f615={'raw':!![],'where':{'id':_0x3890f0[_0x6db7('0x2d')]['id']}},_0x4fb6dd={};_0x4fb6dd[_0x6db7('0x2e')]=_['keys'](db[_0x6db7('0x2f')]['rawAttributes']);_0x4fb6dd[_0x6db7('0x30')]=_[_0x6db7('0x31')](_0x3890f0[_0x6db7('0x30')]);_0x4fb6dd[_0x6db7('0x32')]=_['intersection'](_0x4fb6dd[_0x6db7('0x2e')],_0x4fb6dd[_0x6db7('0x30')]);_0xc4f615[_0x6db7('0x33')]=_[_0x6db7('0x34')](_0x4fb6dd[_0x6db7('0x2e')],qs['fields'](_0x3890f0[_0x6db7('0x30')][_0x6db7('0x35')]));_0xc4f615[_0x6db7('0x33')]=_0xc4f615['attributes'][_0x6db7('0x36')]?_0xc4f615[_0x6db7('0x33')]:_0x4fb6dd[_0x6db7('0x2e')];if(_0x3890f0['query'][_0x6db7('0x37')]){_0xc4f615['include']=[{'all':!![]}];}_0xc4f615=_[_0x6db7('0x38')]({},_0xc4f615,_0x3890f0['options']);return db['ChatApplication'][_0x6db7('0x39')](_0xc4f615)[_0x6db7('0x26')](handleEntityNotFound(_0x11185d,null))[_0x6db7('0x26')](respondWithResult(_0x11185d,null))[_0x6db7('0x3a')](handleError(_0x11185d,null));};exports['update']=function(_0x5cfca3,_0x3f7973){if(_0x5cfca3[_0x6db7('0x3b')]['id']){delete _0x5cfca3['body']['id'];}return db[_0x6db7('0x2f')]['find']({'where':{'id':_0x5cfca3[_0x6db7('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3f7973,null))[_0x6db7('0x26')](saveUpdates(_0x5cfca3['body'],null))['then'](respondWithResult(_0x3f7973,null))[_0x6db7('0x3a')](handleError(_0x3f7973,null));};exports[_0x6db7('0x27')]=function(_0x384fbf,_0x20b875){return db[_0x6db7('0x2f')]['find']({'where':{'id':_0x384fbf[_0x6db7('0x2d')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x20b875,null))[_0x6db7('0x26')](removeEntity(_0x20b875,null))[_0x6db7('0x3a')](handleError(_0x20b875,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2fd5d84..4bc71df 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 _0x5a8b=['request-promise','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','api','moment','bluebird'];(function(_0x5df5e1,_0x3e0305){var _0x2fffd3=function(_0x532a7c){while(--_0x532a7c){_0x5df5e1['push'](_0x5df5e1['shift']());}};_0x2fffd3(++_0x3e0305);}(_0x5a8b,0x103));var _0xb5a8=function(_0x3f7a65,_0x284f1c){_0x3f7a65=_0x3f7a65-0x0;var _0x1915f5=_0x5a8b[_0x3f7a65];return _0x1915f5;};'use strict';var _=require('lodash');var util=require(_0xb5a8('0x0'));var logger=require(_0xb5a8('0x1'))(_0xb5a8('0x2'));var moment=require(_0xb5a8('0x3'));var BPromise=require(_0xb5a8('0x4'));var rp=require(_0xb5a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5a8('0x6'));var attributes=require(_0xb5a8('0x7'));module[_0xb5a8('0x8')]=function(_0x7acf58,_0x36de42){return _0x7acf58['define'](_0xb5a8('0x9'),attributes,{'tableName':_0xb5a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb5a8('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9ef8=['util','api','moment','bluebird','path','rimraf','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1cf825,_0x35f9ae){var _0x3f739f=function(_0x573ca3){while(--_0x573ca3){_0x1cf825['push'](_0x1cf825['shift']());}};_0x3f739f(++_0x35f9ae);}(_0x9ef8,0x17f));var _0x89ef=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x9ef8[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var logger=require('../../config/logger')(_0x89ef('0x2'));var moment=require(_0x89ef('0x3'));var BPromise=require(_0x89ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ef('0x5'));var rimraf=require(_0x89ef('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module['exports']=function(_0x383019,_0x2e117e){return _0x383019[_0x89ef('0x7')](_0x89ef('0x8'),attributes,{'tableName':_0x89ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x89ef('0xa'),'collate':_0x89ef('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 52a2f12..9c23ac2 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 _0x6ea4=['ChatApplication,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x6ea4,0x1ac));var _0x46ea=function(_0x47fd6e,_0x4e4e0c){_0x47fd6e=_0x47fd6e-0x0;var _0x4ca7ca=_0x6ea4[_0x47fd6e];return _0x4ca7ca;};'use strict';var _=require(_0x46ea('0x0'));var util=require('util');var moment=require(_0x46ea('0x1'));var BPromise=require(_0x46ea('0x2'));var rs=require(_0x46ea('0x3'));var fs=require('fs');var Redis=require(_0x46ea('0x4'));var db=require(_0x46ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46ea('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x46ea('0x7'));var client=jayson[_0x46ea('0x8')][_0x46ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x330559,_0x2dfd19,_0x2bbce){return new BPromise(function(_0x39237e,_0x29d1e7){return client[_0x46ea('0xa')](_0x330559,_0x2bbce)[_0x46ea('0xb')](function(_0x2d8ccf){logger['info'](_0x46ea('0xc'),_0x2dfd19,'request\x20sent');logger[_0x46ea('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2dfd19,_0x46ea('0xe'),JSON['stringify'](_0x2d8ccf));if(_0x2d8ccf[_0x46ea('0xf')]){if(_0x2d8ccf[_0x46ea('0xf')]['code']===0x1f4){logger[_0x46ea('0xf')](_0x46ea('0xc'),_0x2dfd19,_0x2d8ccf[_0x46ea('0xf')][_0x46ea('0x10')]);return _0x29d1e7(_0x2d8ccf['error'][_0x46ea('0x10')]);}logger['error'](_0x46ea('0xc'),_0x2dfd19,_0x2d8ccf[_0x46ea('0xf')][_0x46ea('0x10')]);return _0x39237e(_0x2d8ccf[_0x46ea('0xf')][_0x46ea('0x10')]);}else{logger[_0x46ea('0x11')](_0x46ea('0xc'),_0x2dfd19,_0x46ea('0xe'));_0x39237e(_0x2d8ccf[_0x46ea('0x12')]['message']);}})[_0x46ea('0x13')](function(_0x16654d){logger[_0x46ea('0xf')]('ChatApplication,\x20%s,\x20%s',_0x2dfd19,_0x16654d);_0x29d1e7(_0x16654d);});});} \ No newline at end of file +var _0x1b51=['stringify','error','code','message','info','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4aae6b,_0x386b16){var _0x22bc72=function(_0x309479){while(--_0x309479){_0x4aae6b['push'](_0x4aae6b['shift']());}};_0x22bc72(++_0x386b16);}(_0x1b51,0xed));var _0x11b5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1b51[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x11b5('0x0'));var util=require('util');var moment=require(_0x11b5('0x1'));var BPromise=require('bluebird');var rs=require(_0x11b5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11b5('0x3'))['db'];var utils=require(_0x11b5('0x4'));var logger=require('../../config/logger')(_0x11b5('0x5'));var config=require(_0x11b5('0x6'));var jayson=require(_0x11b5('0x7'));var client=jayson[_0x11b5('0x8')][_0x11b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2020e5,_0x1a498b,_0x8d461a){return new BPromise(function(_0x5e90d3,_0x121be4){return client['request'](_0x2020e5,_0x8d461a)[_0x11b5('0xa')](function(_0x1a6000){logger['info'](_0x11b5('0xb'),_0x1a498b,_0x11b5('0xc'));logger[_0x11b5('0xd')](_0x11b5('0xe'),_0x1a498b,_0x11b5('0xc'),JSON[_0x11b5('0xf')](_0x1a6000));if(_0x1a6000[_0x11b5('0x10')]){if(_0x1a6000[_0x11b5('0x10')][_0x11b5('0x11')]===0x1f4){logger[_0x11b5('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1a498b,_0x1a6000['error'][_0x11b5('0x12')]);return _0x121be4(_0x1a6000[_0x11b5('0x10')][_0x11b5('0x12')]);}logger['error'](_0x11b5('0xb'),_0x1a498b,_0x1a6000[_0x11b5('0x10')][_0x11b5('0x12')]);return _0x5e90d3(_0x1a6000['error']['message']);}else{logger[_0x11b5('0x13')](_0x11b5('0xb'),_0x1a498b,_0x11b5('0xc'));_0x5e90d3(_0x1a6000['result'][_0x11b5('0x12')]);}})[_0x11b5('0x14')](function(_0x47ca8e){logger[_0x11b5('0x10')](_0x11b5('0xb'),_0x1a498b,_0x47ca8e);_0x121be4(_0x47ca8e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b55442e..397a97e 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 _0xaad5=['../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ad55b,_0x53df62){var _0x239956=function(_0x249bb8){while(--_0x249bb8){_0x3ad55b['push'](_0x3ad55b['shift']());}};_0x239956(++_0x53df62);}(_0xaad5,0x13c));var _0x5aad=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xaad5[_0x609988];return _0x159984;};'use strict';var multer=require(_0x5aad('0x0'));var util=require(_0x5aad('0x1'));var path=require(_0x5aad('0x2'));var timeout=require('connect-timeout');var express=require(_0x5aad('0x3'));var router=express[_0x5aad('0x4')]();var fs_extra=require(_0x5aad('0x5'));var auth=require(_0x5aad('0x6'));var interaction=require(_0x5aad('0x7'));var config=require(_0x5aad('0x8'));var controller=require(_0x5aad('0x9'));router[_0x5aad('0xa')](_0x5aad('0xb'),auth[_0x5aad('0xc')](),controller[_0x5aad('0xd')]);router[_0x5aad('0xe')](_0x5aad('0xb'),auth[_0x5aad('0xc')](),controller[_0x5aad('0xf')]);router['delete'](_0x5aad('0xb'),auth['isAuthenticated'](),controller[_0x5aad('0x10')]);module[_0x5aad('0x11')]=router; \ No newline at end of file +var _0xbd4e=['update','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd4e,0x7b));var _0xebd4=function(_0x32365c,_0x453f9f){_0x32365c=_0x32365c-0x0;var _0x34ff18=_0xbd4e[_0x32365c];return _0x34ff18;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xebd4('0x0'));var router=express[_0xebd4('0x1')]();var fs_extra=require(_0xebd4('0x2'));var auth=require(_0xebd4('0x3'));var interaction=require(_0xebd4('0x4'));var config=require(_0xebd4('0x5'));var controller=require(_0xebd4('0x6'));router[_0xebd4('0x7')](_0xebd4('0x8'),auth[_0xebd4('0x9')](),controller[_0xebd4('0xa')]);router[_0xebd4('0xb')](_0xebd4('0x8'),auth[_0xebd4('0x9')](),controller[_0xebd4('0xc')]);router['delete'](_0xebd4('0x8'),auth[_0xebd4('0x9')](),controller[_0xebd4('0xd')]);module[_0xebd4('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 4d9ccec..f916ad0 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 _0x62fd=['BOOLEAN','sequelize','STRING'];(function(_0x57ff9f,_0x43f627){var _0x14be3d=function(_0x2a21eb){while(--_0x2a21eb){_0x57ff9f['push'](_0x57ff9f['shift']());}};_0x14be3d(++_0x43f627);}(_0x62fd,0x14b));var _0xd62f=function(_0x51effc,_0x49310e){_0x51effc=_0x51effc-0x0;var _0x13e119=_0x62fd[_0x51effc];return _0x13e119;};'use strict';var Sequelize=require(_0xd62f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd62f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xd62f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2b0a=['sequelize','exports','STRING'];(function(_0x687c0a,_0x3aac82){var _0x8fdcb5=function(_0x318f0b){while(--_0x318f0b){_0x687c0a['push'](_0x687c0a['shift']());}};_0x8fdcb5(++_0x3aac82);}(_0x2b0a,0x84));var _0xa2b0=function(_0x1ac237,_0x515063){_0x1ac237=_0x1ac237-0x0;var _0x752098=_0x2b0a[_0x1ac237];return _0x752098;};'use strict';var Sequelize=require(_0xa2b0('0x0'));module[_0xa2b0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa2b0('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index d33317a..3a790ee 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 _0xcd9a=['YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','filter','VIRTUAL','merge','ChatGroup','includeAll','include','findAll','rows','show','params','length','options','find','create','body','catch','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','pick','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','order','$gte','split','format'];(function(_0x4fb485,_0x11f189){var _0x5c9872=function(_0x2a3fe0){while(--_0x2a3fe0){_0x4fb485['push'](_0x4fb485['shift']());}};_0x5c9872(++_0x11f189);}(_0xcd9a,0x64));var _0xacd9=function(_0x379ebb,_0x3e7bd5){_0x379ebb=_0x379ebb-0x0;var _0x1623d0=_0xcd9a[_0x379ebb];return _0x1623d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xacd9('0x0'));var zipdir=require(_0xacd9('0x1'));var jsonpatch=require(_0xacd9('0x2'));var rp=require(_0xacd9('0x3'));var moment=require(_0xacd9('0x4'));var BPromise=require(_0xacd9('0x5'));var Mustache=require(_0xacd9('0x6'));var util=require('util');var path=require(_0xacd9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacd9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacd9('0x9'));var squel=require(_0xacd9('0xa'));var crypto=require(_0xacd9('0xb'));var jsforce=require(_0xacd9('0xc'));var deskjs=require(_0xacd9('0xd'));var toCsv=require(_0xacd9('0xe'));var querystring=require(_0xacd9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xacd9('0x10'));var as=require(_0xacd9('0x11'));var hardwareService=require(_0xacd9('0x12'));var logger=require(_0xacd9('0x13'))('api');var utils=require(_0xacd9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xacd9('0x15'));var db=require('../../mysqldb')['db'];config[_0xacd9('0x16')]=_[_0xacd9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xacd9('0x18'))(new Redis(config['redis']));require(_0xacd9('0x19'))[_0xacd9('0x1a')](socket);function respondWithStatusCode(_0x2c9f52,_0x125247){_0x125247=_0x125247||0xcc;return function(_0x97794a){if(_0x97794a){return _0x2c9f52[_0xacd9('0x1b')](_0x125247);}return _0x2c9f52[_0xacd9('0x1c')](_0x125247)[_0xacd9('0x1d')]();};}function respondWithResult(_0x44a2ee,_0x44d71d){_0x44d71d=_0x44d71d||0xc8;return function(_0x25a23e){if(_0x25a23e){return _0x44a2ee[_0xacd9('0x1c')](_0x44d71d)[_0xacd9('0x1e')](_0x25a23e);}};}function respondWithFilteredResult(_0x19a362,_0x51b6ef){return function(_0x2ba8e9){if(_0x2ba8e9){var _0x1bc760=typeof _0x51b6ef[_0xacd9('0x1f')]===_0xacd9('0x20')&&typeof _0x51b6ef['limit']===_0xacd9('0x20');var _0x35ea9b=_0x2ba8e9[_0xacd9('0x21')];var _0x119ee3=_0x1bc760?0x0:_0x51b6ef[_0xacd9('0x1f')];var _0x475c04=_0x1bc760?_0x2ba8e9[_0xacd9('0x21')]:_0x51b6ef[_0xacd9('0x1f')]+_0x51b6ef[_0xacd9('0x22')];var _0x1d08fd;if(_0x475c04>=_0x35ea9b){_0x475c04=_0x35ea9b;_0x1d08fd=0xc8;}else{_0x1d08fd=0xce;}_0x19a362['status'](_0x1d08fd);return _0x19a362[_0xacd9('0x23')](_0xacd9('0x24'),_0x119ee3+'-'+_0x475c04+'/'+_0x35ea9b)[_0xacd9('0x1e')](_0x2ba8e9);}return null;};}function patchUpdates(_0x21a6a9){return function(_0x1d734d){try{jsonpatch[_0xacd9('0x25')](_0x1d734d,_0x21a6a9,!![]);}catch(_0x387c33){return BPromise[_0xacd9('0x26')](_0x387c33);}return _0x1d734d[_0xacd9('0x27')]();};}function saveUpdates(_0x3714be,_0x1e8709){return function(_0xc19fde){if(_0xc19fde){return _0xc19fde[_0xacd9('0x28')](_0x3714be)['then'](function(_0x239edd){return _0x239edd;});}return null;};}function removeEntity(_0x3e154d,_0x199c5c){return function(_0x51780b){if(_0x51780b){return _0x51780b[_0xacd9('0x29')]()[_0xacd9('0x2a')](function(){_0x3e154d[_0xacd9('0x1c')](0xcc)[_0xacd9('0x1d')]();});}};}function handleEntityNotFound(_0x478a98,_0x4e39a3){return function(_0x388a85){if(!_0x388a85){_0x478a98['sendStatus'](0x194);}return _0x388a85;};}function handleError(_0x466b0f,_0x32ebf5){_0x32ebf5=_0x32ebf5||0x1f4;return function(_0x2e4109){logger[_0xacd9('0x2b')](_0x2e4109[_0xacd9('0x2c')]);if(_0x2e4109[_0xacd9('0x2d')]){delete _0x2e4109['name'];}_0x466b0f[_0xacd9('0x1c')](_0x32ebf5)[_0xacd9('0x2e')](_0x2e4109);};}exports[_0xacd9('0x2f')]=function(_0x17f1e0,_0x1a91a){var _0x589e53={},_0x3cc2da={},_0x1d5ed4={'count':0x0,'rows':[]};var _0x2a70fd=_['map'](db['ChatGroup'][_0xacd9('0x30')],function(_0x3abe26){return{'name':_0x3abe26[_0xacd9('0x31')],'type':_0x3abe26[_0xacd9('0x32')]['key']};});_0x3cc2da[_0xacd9('0x33')]=_[_0xacd9('0x34')](_0x2a70fd,_0xacd9('0x2d'));_0x3cc2da[_0xacd9('0x35')]=_[_0xacd9('0x36')](_0x17f1e0[_0xacd9('0x35')]);_0x3cc2da['filters']=_[_0xacd9('0x37')](_0x3cc2da[_0xacd9('0x33')],_0x3cc2da[_0xacd9('0x35')]);_0x589e53[_0xacd9('0x38')]=_[_0xacd9('0x37')](_0x3cc2da['model'],qs[_0xacd9('0x39')](_0x17f1e0[_0xacd9('0x35')][_0xacd9('0x39')]));_0x589e53[_0xacd9('0x38')]=_0x589e53[_0xacd9('0x38')]['length']?_0x589e53[_0xacd9('0x38')]:_0x3cc2da[_0xacd9('0x33')];if(!_0x17f1e0['query']['hasOwnProperty'](_0xacd9('0x3a'))){_0x589e53[_0xacd9('0x22')]=qs[_0xacd9('0x22')](_0x17f1e0[_0xacd9('0x35')][_0xacd9('0x22')]);_0x589e53[_0xacd9('0x1f')]=qs['offset'](_0x17f1e0['query'][_0xacd9('0x1f')]);}_0x589e53['order']=qs['sort'](_0x17f1e0[_0xacd9('0x35')][_0xacd9('0x3b')]);_0x589e53[_0xacd9('0x3c')]=qs[_0xacd9('0x3d')](_['pick'](_0x17f1e0[_0xacd9('0x35')],_0x3cc2da[_0xacd9('0x3d')]),_0x2a70fd);if(_0x17f1e0[_0xacd9('0x35')][_0xacd9('0x3e')]){_0x589e53[_0xacd9('0x3c')]=_['merge'](_0x589e53[_0xacd9('0x3c')],{'$or':_[_0xacd9('0x34')](_0x2a70fd,function(_0x5ee828){if(_0x5ee828['type']!==_0xacd9('0x3f')){var _0x32d521={};_0x32d521[_0x5ee828[_0xacd9('0x2d')]]={'$like':'%'+_0x17f1e0[_0xacd9('0x35')][_0xacd9('0x3e')]+'%'};return _0x32d521;}})});}_0x589e53=_[_0xacd9('0x40')]({},_0x589e53,_0x17f1e0['options']);var _0x14feb5={'where':_0x589e53[_0xacd9('0x3c')]};return db[_0xacd9('0x41')][_0xacd9('0x21')](_0x14feb5)[_0xacd9('0x2a')](function(_0x533409){_0x1d5ed4[_0xacd9('0x21')]=_0x533409;if(_0x17f1e0['query'][_0xacd9('0x42')]){_0x589e53[_0xacd9('0x43')]=[{'all':!![]}];}return db[_0xacd9('0x41')][_0xacd9('0x44')](_0x589e53);})[_0xacd9('0x2a')](function(_0x174d14){_0x1d5ed4[_0xacd9('0x45')]=_0x174d14;return _0x1d5ed4;})[_0xacd9('0x2a')](respondWithFilteredResult(_0x1a91a,_0x589e53))['catch'](handleError(_0x1a91a,null));};exports[_0xacd9('0x46')]=function(_0x19bed7,_0x1ece7a){var _0x227722={'raw':!![],'where':{'id':_0x19bed7[_0xacd9('0x47')]['id']}},_0xc98739={};_0xc98739[_0xacd9('0x33')]=_['keys'](db['ChatGroup']['rawAttributes']);_0xc98739[_0xacd9('0x35')]=_['keys'](_0x19bed7[_0xacd9('0x35')]);_0xc98739['filters']=_['intersection'](_0xc98739['model'],_0xc98739[_0xacd9('0x35')]);_0x227722['attributes']=_[_0xacd9('0x37')](_0xc98739[_0xacd9('0x33')],qs['fields'](_0x19bed7[_0xacd9('0x35')][_0xacd9('0x39')]));_0x227722['attributes']=_0x227722['attributes'][_0xacd9('0x48')]?_0x227722[_0xacd9('0x38')]:_0xc98739['model'];if(_0x19bed7['query'][_0xacd9('0x42')]){_0x227722['include']=[{'all':!![]}];}_0x227722=_[_0xacd9('0x40')]({},_0x227722,_0x19bed7[_0xacd9('0x49')]);return db['ChatGroup'][_0xacd9('0x4a')](_0x227722)[_0xacd9('0x2a')](handleEntityNotFound(_0x1ece7a,null))[_0xacd9('0x2a')](respondWithResult(_0x1ece7a,null))['catch'](handleError(_0x1ece7a,null));};exports[_0xacd9('0x4b')]=function(_0x48433c,_0x13af03){return db[_0xacd9('0x41')][_0xacd9('0x4b')](_0x48433c[_0xacd9('0x4c')],{})[_0xacd9('0x2a')](respondWithResult(_0x13af03,0xc9))['catch'](handleError(_0x13af03,null));};exports[_0xacd9('0x28')]=function(_0x24fbce,_0x3d48c7){if(_0x24fbce['body']['id']){delete _0x24fbce[_0xacd9('0x4c')]['id'];}return db['ChatGroup'][_0xacd9('0x4a')]({'where':{'id':_0x24fbce['params']['id']}})['then'](handleEntityNotFound(_0x3d48c7,null))[_0xacd9('0x2a')](saveUpdates(_0x24fbce['body'],null))[_0xacd9('0x2a')](respondWithResult(_0x3d48c7,null))[_0xacd9('0x4d')](handleError(_0x3d48c7,null));};exports[_0xacd9('0x29')]=function(_0x4a7810,_0x8c5b3f){return db[_0xacd9('0x41')]['find']({'where':{'id':_0x4a7810['params']['id']}})[_0xacd9('0x2a')](handleEntityNotFound(_0x8c5b3f,null))[_0xacd9('0x2a')](removeEntity(_0x8c5b3f,null))[_0xacd9('0x4d')](handleError(_0x8c5b3f,null));};exports['describe']=function(_0x476e07,_0x15d8e2){return db[_0xacd9('0x41')]['describe']()[_0xacd9('0x2a')](respondWithResult(_0x15d8e2,null))['catch'](handleError(_0x15d8e2,null));};exports[_0xacd9('0x4e')]=function(_0x243c9c,_0x3c9001,_0x45c97e){return db[_0xacd9('0x4f')][_0xacd9('0x21')]({'where':{'ChatGroupId':_0x243c9c[_0xacd9('0x47')]['id'],'ToId':_0x243c9c[_0xacd9('0x50')]['id'],'read':![]}})['then'](function(_0x4a0f33){return{'id':_[_0xacd9('0x51')](_0x243c9c[_0xacd9('0x47')]['id']),'count':_0x4a0f33};})[_0xacd9('0x2a')](respondWithResult(_0x3c9001,null))[_0xacd9('0x4d')](handleError(_0x3c9001,null));};exports[_0xacd9('0x52')]=function(_0xc17dab,_0x397cf3,_0x501de4){return db[_0xacd9('0x41')]['find']({'where':{'id':_0xc17dab[_0xacd9('0x47')]['id']}})[_0xacd9('0x2a')](handleEntityNotFound(_0x397cf3,null))['then'](function(_0x3c01fe){if(_0x3c01fe){return _0x3c01fe[_0xacd9('0x52')](_0xc17dab[_0xacd9('0x4c')]['ids'],_[_0xacd9('0x53')](_0xc17dab[_0xacd9('0x4c')],[_0xacd9('0x54'),'id'])||{});}})[_0xacd9('0x2a')](respondWithResult(_0x397cf3,null))[_0xacd9('0x4d')](handleError(_0x397cf3,null));};exports[_0xacd9('0x55')]=function(_0x429e76,_0x31ecad,_0x311e0a){var _0x78821a={};var _0x1ffa72={};var _0x397308;var _0x1ea4c5;return db['ChatGroup'][_0xacd9('0x56')]({'where':{'id':_0x429e76[_0xacd9('0x47')]['id']}})['then'](handleEntityNotFound(_0x31ecad,null))[_0xacd9('0x2a')](function(_0x26fe27){if(_0x26fe27){_0x397308=_0x26fe27;_0x1ffa72['model']=_[_0xacd9('0x36')](db[_0xacd9('0x57')][_0xacd9('0x30')]);_0x1ffa72[_0xacd9('0x35')]=_[_0xacd9('0x36')](_0x429e76[_0xacd9('0x35')]);_0x1ffa72[_0xacd9('0x3d')]=_[_0xacd9('0x37')](_0x1ffa72[_0xacd9('0x33')],_0x1ffa72[_0xacd9('0x35')]);_0x78821a['attributes']=_['intersection'](_0x1ffa72['model'],qs[_0xacd9('0x39')](_0x429e76[_0xacd9('0x35')][_0xacd9('0x39')]));_0x78821a[_0xacd9('0x38')]=_0x78821a[_0xacd9('0x38')][_0xacd9('0x48')]?_0x78821a[_0xacd9('0x38')]:_0x1ffa72[_0xacd9('0x33')];_0x78821a['order']=qs[_0xacd9('0x3b')](_0x429e76[_0xacd9('0x35')]['sort']);_0x78821a[_0xacd9('0x3c')]=qs[_0xacd9('0x3d')](_[_0xacd9('0x58')](_0x429e76[_0xacd9('0x35')],_0x1ffa72[_0xacd9('0x3d')]));if(_0x429e76[_0xacd9('0x35')]['filter']){_0x78821a[_0xacd9('0x3c')]=_[_0xacd9('0x40')](_0x78821a[_0xacd9('0x3c')],{'$or':_['map'](_0x78821a[_0xacd9('0x38')],function(_0x572fb9){var _0xcddde8={};_0xcddde8[_0x572fb9]={'$like':'%'+_0x429e76[_0xacd9('0x35')][_0xacd9('0x3e')]+'%'};return _0xcddde8;})});}_0x78821a=_[_0xacd9('0x40')]({},_0x78821a,_0x429e76['options']);return _0x397308[_0xacd9('0x55')](_0x78821a);}})['then'](function(_0x75d238){if(_0x75d238){_0x1ea4c5=_0x75d238[_0xacd9('0x48')];if(!_0x429e76['query'][_0xacd9('0x59')]('nolimit')){_0x78821a[_0xacd9('0x22')]=qs[_0xacd9('0x22')](_0x429e76[_0xacd9('0x35')]['limit']);_0x78821a[_0xacd9('0x1f')]=qs[_0xacd9('0x1f')](_0x429e76[_0xacd9('0x35')][_0xacd9('0x1f')]);}return _0x397308[_0xacd9('0x55')](_0x78821a);}})[_0xacd9('0x2a')](function(_0x2622ab){if(_0x2622ab){return _0x2622ab?{'count':_0x1ea4c5,'rows':_0x2622ab}:null;}})[_0xacd9('0x2a')](respondWithResult(_0x31ecad,null))[_0xacd9('0x4d')](handleError(_0x31ecad,null));};exports['removeMembers']=function(_0x2cf0b2,_0x4985bf,_0x432d7d){return db[_0xacd9('0x41')][_0xacd9('0x4a')]({'where':{'id':_0x2cf0b2[_0xacd9('0x47')]['id']}})[_0xacd9('0x2a')](handleEntityNotFound(_0x4985bf,null))[_0xacd9('0x2a')](function(_0x16a134){if(_0x16a134){return _0x16a134[_0xacd9('0x5a')](_0x2cf0b2[_0xacd9('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x4985bf,null))[_0xacd9('0x4d')](handleError(_0x4985bf,null));};exports[_0xacd9('0x5b')]=function(_0x250826,_0x5db9c4,_0x392c25){if(_0x250826['body']['id']){delete _0x250826[_0xacd9('0x4c')]['id'];}return db[_0xacd9('0x41')][_0xacd9('0x4a')]({'where':{'id':_0x250826[_0xacd9('0x47')]['id']}})[_0xacd9('0x2a')](handleEntityNotFound(_0x5db9c4,null))[_0xacd9('0x2a')](function(_0x2e477f){if(_0x2e477f){_0x250826[_0xacd9('0x4c')][_0xacd9('0x5c')]=_0x2e477f['id'];return db['ChatInternalMessage'][_0xacd9('0x4b')](_0x250826['body']);}})[_0xacd9('0x2a')](respondWithResult(_0x5db9c4,null))['catch'](handleError(_0x5db9c4,null));};exports[_0xacd9('0x5d')]=function(_0x47f74b,_0x30cfa8,_0x17d254){var _0x3e0637={};var _0xebebb4={};var _0x5cad45;var _0x11e734;return db[_0xacd9('0x41')][_0xacd9('0x56')]({'where':{'id':_0x47f74b[_0xacd9('0x47')]['id']}})[_0xacd9('0x2a')](handleEntityNotFound(_0x30cfa8,null))['then'](function(_0x414cb3){if(_0x414cb3){_0x5cad45=_0x414cb3;_0xebebb4['model']=_[_0xacd9('0x36')](db['ChatInternalMessage'][_0xacd9('0x30')]);_0xebebb4[_0xacd9('0x35')]=_[_0xacd9('0x36')](_0x47f74b[_0xacd9('0x35')]);_0xebebb4[_0xacd9('0x3d')]=_[_0xacd9('0x37')](_0xebebb4[_0xacd9('0x33')],_0xebebb4[_0xacd9('0x35')]);_0x3e0637['attributes']=_[_0xacd9('0x37')](_0xebebb4[_0xacd9('0x33')],qs[_0xacd9('0x39')](_0x47f74b[_0xacd9('0x35')][_0xacd9('0x39')]));_0x3e0637[_0xacd9('0x38')]=_0x3e0637[_0xacd9('0x38')][_0xacd9('0x48')]?_0x3e0637[_0xacd9('0x38')]:_0xebebb4[_0xacd9('0x33')];_0x3e0637[_0xacd9('0x5e')]=qs[_0xacd9('0x3b')](_0x47f74b['query']['sort']);_0x3e0637[_0xacd9('0x3c')]=qs[_0xacd9('0x3d')](_['pick'](_0x47f74b['query'],_0xebebb4[_0xacd9('0x3d')]));if(_0x47f74b[_0xacd9('0x35')][_0xacd9('0x3e')]){_0x3e0637['where']=_[_0xacd9('0x40')](_0x3e0637[_0xacd9('0x3c')],{'$or':_['map'](_0x3e0637[_0xacd9('0x38')],function(_0x4a9f68){var _0x5d946f={};_0x5d946f[_0x4a9f68]={'$like':'%'+_0x47f74b[_0xacd9('0x35')][_0xacd9('0x3e')]+'%'};return _0x5d946f;})});}if(_0x47f74b[_0xacd9('0x35')][_0xacd9('0x5f')]){var _0x123158=_0x47f74b[_0xacd9('0x35')]['$gte'][_0xacd9('0x60')](',');var _0x27f06={};_0x27f06[_0x123158[0x0]]={'$gte':moment(_0x123158[0x1])[_0xacd9('0x61')](_0xacd9('0x62'))};_0x3e0637[_0xacd9('0x3c')]=_[_0xacd9('0x40')](_0x3e0637[_0xacd9('0x3c')],_0x27f06);}_0x3e0637=_[_0xacd9('0x40')]({},_0x3e0637,_0x47f74b[_0xacd9('0x49')]);return _0x5cad45[_0xacd9('0x5d')](_0x3e0637);}})[_0xacd9('0x2a')](function(_0x1bcea9){if(_0x1bcea9){_0x11e734=_0x1bcea9[_0xacd9('0x48')];if(!_0x47f74b[_0xacd9('0x35')][_0xacd9('0x59')](_0xacd9('0x3a'))){_0x3e0637['limit']=qs[_0xacd9('0x22')](_0x47f74b[_0xacd9('0x35')]['limit']);_0x3e0637[_0xacd9('0x1f')]=qs[_0xacd9('0x1f')](_0x47f74b[_0xacd9('0x35')][_0xacd9('0x1f')]);}return _0x5cad45[_0xacd9('0x5d')](_0x3e0637);}})[_0xacd9('0x2a')](function(_0x3e93e3){if(_0x3e93e3){return _0x3e93e3?{'count':_0x11e734,'rows':_0x3e93e3}:null;}})[_0xacd9('0x2a')](respondWithResult(_0x30cfa8,null))[_0xacd9('0x4d')](handleError(_0x30cfa8,null));}; \ No newline at end of file +var _0xa114=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','findAll','catch','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','$gte','format','getMessages','eml-format'];(function(_0x1c7a62,_0x374c5b){var _0x46b20=function(_0x50c9b9){while(--_0x50c9b9){_0x1c7a62['push'](_0x1c7a62['shift']());}};_0x46b20(++_0x374c5b);}(_0xa114,0x187));var _0x4a11=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xa114[_0x525af9];return _0x129fbf;};'use strict';var emlformat=require(_0x4a11('0x0'));var rimraf=require(_0x4a11('0x1'));var zipdir=require(_0x4a11('0x2'));var jsonpatch=require(_0x4a11('0x3'));var rp=require(_0x4a11('0x4'));var moment=require(_0x4a11('0x5'));var BPromise=require(_0x4a11('0x6'));var Mustache=require(_0x4a11('0x7'));var util=require(_0x4a11('0x8'));var path=require(_0x4a11('0x9'));var sox=require(_0x4a11('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a11('0xb'));var _=require(_0x4a11('0xc'));var squel=require('squel');var crypto=require(_0x4a11('0xd'));var jsforce=require(_0x4a11('0xe'));var deskjs=require(_0x4a11('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a11('0x10'));var Papa=require(_0x4a11('0x11'));var Redis=require(_0x4a11('0x12'));var authService=require(_0x4a11('0x13'));var qs=require(_0x4a11('0x14'));var as=require(_0x4a11('0x15'));var hardwareService=require(_0x4a11('0x16'));var logger=require(_0x4a11('0x17'))(_0x4a11('0x18'));var utils=require(_0x4a11('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4a11('0x1a'));var db=require(_0x4a11('0x1b'))['db'];config['redis']=_['defaults'](config[_0x4a11('0x1c')],{'host':_0x4a11('0x1d'),'port':0x18eb});var socket=require(_0x4a11('0x1e'))(new Redis(config[_0x4a11('0x1c')]));require(_0x4a11('0x1f'))[_0x4a11('0x20')](socket);function respondWithStatusCode(_0x365d1c,_0x3ff435){_0x3ff435=_0x3ff435||0xcc;return function(_0x42dec9){if(_0x42dec9){return _0x365d1c[_0x4a11('0x21')](_0x3ff435);}return _0x365d1c['status'](_0x3ff435)[_0x4a11('0x22')]();};}function respondWithResult(_0x268d34,_0x3ecc29){_0x3ecc29=_0x3ecc29||0xc8;return function(_0xe336de){if(_0xe336de){return _0x268d34[_0x4a11('0x23')](_0x3ecc29)[_0x4a11('0x24')](_0xe336de);}};}function respondWithFilteredResult(_0x2bcb1d,_0x27703b){return function(_0x20a6eb){if(_0x20a6eb){var _0x43ec84=typeof _0x27703b[_0x4a11('0x25')]===_0x4a11('0x26')&&typeof _0x27703b['limit']===_0x4a11('0x26');var _0x58b9a1=_0x20a6eb['count'];var _0x25a10d=_0x43ec84?0x0:_0x27703b[_0x4a11('0x25')];var _0x4c4e65=_0x43ec84?_0x20a6eb[_0x4a11('0x27')]:_0x27703b[_0x4a11('0x25')]+_0x27703b[_0x4a11('0x28')];var _0x42f1a5;if(_0x4c4e65>=_0x58b9a1){_0x4c4e65=_0x58b9a1;_0x42f1a5=0xc8;}else{_0x42f1a5=0xce;}_0x2bcb1d[_0x4a11('0x23')](_0x42f1a5);return _0x2bcb1d[_0x4a11('0x29')](_0x4a11('0x2a'),_0x25a10d+'-'+_0x4c4e65+'/'+_0x58b9a1)[_0x4a11('0x24')](_0x20a6eb);}return null;};}function patchUpdates(_0x3015ec){return function(_0x18e393){try{jsonpatch['apply'](_0x18e393,_0x3015ec,!![]);}catch(_0x91817f){return BPromise[_0x4a11('0x2b')](_0x91817f);}return _0x18e393[_0x4a11('0x2c')]();};}function saveUpdates(_0x38dc7b,_0x56b6eb){return function(_0x429527){if(_0x429527){return _0x429527[_0x4a11('0x2d')](_0x38dc7b)[_0x4a11('0x2e')](function(_0xb3950){return _0xb3950;});}return null;};}function removeEntity(_0xd5b915,_0x3c64da){return function(_0x3614f9){if(_0x3614f9){return _0x3614f9[_0x4a11('0x2f')]()[_0x4a11('0x2e')](function(){_0xd5b915['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53367d,_0x1473bd){return function(_0x52b79d){if(!_0x52b79d){_0x53367d[_0x4a11('0x21')](0x194);}return _0x52b79d;};}function handleError(_0x3f8684,_0x2c13d4){_0x2c13d4=_0x2c13d4||0x1f4;return function(_0x2b25d9){logger[_0x4a11('0x30')](_0x2b25d9[_0x4a11('0x31')]);if(_0x2b25d9[_0x4a11('0x32')]){delete _0x2b25d9[_0x4a11('0x32')];}_0x3f8684['status'](_0x2c13d4)['send'](_0x2b25d9);};}exports[_0x4a11('0x33')]=function(_0x5e32,_0xd180ee){var _0x3a2246={},_0x2f46d2={},_0x1faed3={'count':0x0,'rows':[]};var _0x57d45f=_[_0x4a11('0x34')](db['ChatGroup'][_0x4a11('0x35')],function(_0x1f7c7a){return{'name':_0x1f7c7a['fieldName'],'type':_0x1f7c7a['type'][_0x4a11('0x36')]};});_0x2f46d2['model']=_[_0x4a11('0x34')](_0x57d45f,'name');_0x2f46d2[_0x4a11('0x37')]=_['keys'](_0x5e32['query']);_0x2f46d2[_0x4a11('0x38')]=_[_0x4a11('0x39')](_0x2f46d2[_0x4a11('0x3a')],_0x2f46d2[_0x4a11('0x37')]);_0x3a2246['attributes']=_[_0x4a11('0x39')](_0x2f46d2[_0x4a11('0x3a')],qs[_0x4a11('0x3b')](_0x5e32[_0x4a11('0x37')][_0x4a11('0x3b')]));_0x3a2246[_0x4a11('0x3c')]=_0x3a2246[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0x3a2246['attributes']:_0x2f46d2['model'];if(!_0x5e32[_0x4a11('0x37')][_0x4a11('0x3e')](_0x4a11('0x3f'))){_0x3a2246[_0x4a11('0x28')]=qs[_0x4a11('0x28')](_0x5e32[_0x4a11('0x37')][_0x4a11('0x28')]);_0x3a2246[_0x4a11('0x25')]=qs[_0x4a11('0x25')](_0x5e32[_0x4a11('0x37')][_0x4a11('0x25')]);}_0x3a2246[_0x4a11('0x40')]=qs[_0x4a11('0x41')](_0x5e32[_0x4a11('0x37')]['sort']);_0x3a2246[_0x4a11('0x42')]=qs['filters'](_[_0x4a11('0x43')](_0x5e32['query'],_0x2f46d2[_0x4a11('0x38')]),_0x57d45f);if(_0x5e32['query'][_0x4a11('0x44')]){_0x3a2246[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0x3a2246[_0x4a11('0x42')],{'$or':_[_0x4a11('0x34')](_0x57d45f,function(_0x58e7de){if(_0x58e7de[_0x4a11('0x46')]!==_0x4a11('0x47')){var _0x25e5ba={};_0x25e5ba[_0x58e7de[_0x4a11('0x32')]]={'$like':'%'+_0x5e32[_0x4a11('0x37')][_0x4a11('0x44')]+'%'};return _0x25e5ba;}})});}_0x3a2246=_[_0x4a11('0x45')]({},_0x3a2246,_0x5e32[_0x4a11('0x48')]);var _0x16d9f3={'where':_0x3a2246[_0x4a11('0x42')]};return db[_0x4a11('0x49')][_0x4a11('0x27')](_0x16d9f3)['then'](function(_0x5c869e){_0x1faed3['count']=_0x5c869e;if(_0x5e32['query'][_0x4a11('0x4a')]){_0x3a2246[_0x4a11('0x4b')]=[{'all':!![]}];}return db[_0x4a11('0x49')][_0x4a11('0x4c')](_0x3a2246);})[_0x4a11('0x2e')](function(_0x4291e9){_0x1faed3['rows']=_0x4291e9;return _0x1faed3;})[_0x4a11('0x2e')](respondWithFilteredResult(_0xd180ee,_0x3a2246))[_0x4a11('0x4d')](handleError(_0xd180ee,null));};exports['show']=function(_0x313041,_0x1e7603){var _0x316433={'raw':!![],'where':{'id':_0x313041[_0x4a11('0x4e')]['id']}},_0x9b7a25={};_0x9b7a25[_0x4a11('0x3a')]=_[_0x4a11('0x4f')](db[_0x4a11('0x49')]['rawAttributes']);_0x9b7a25[_0x4a11('0x37')]=_[_0x4a11('0x4f')](_0x313041[_0x4a11('0x37')]);_0x9b7a25[_0x4a11('0x38')]=_[_0x4a11('0x39')](_0x9b7a25['model'],_0x9b7a25[_0x4a11('0x37')]);_0x316433[_0x4a11('0x3c')]=_[_0x4a11('0x39')](_0x9b7a25[_0x4a11('0x3a')],qs[_0x4a11('0x3b')](_0x313041[_0x4a11('0x37')][_0x4a11('0x3b')]));_0x316433[_0x4a11('0x3c')]=_0x316433[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0x316433[_0x4a11('0x3c')]:_0x9b7a25[_0x4a11('0x3a')];if(_0x313041['query'][_0x4a11('0x4a')]){_0x316433[_0x4a11('0x4b')]=[{'all':!![]}];}_0x316433=_[_0x4a11('0x45')]({},_0x316433,_0x313041['options']);return db[_0x4a11('0x49')][_0x4a11('0x50')](_0x316433)[_0x4a11('0x2e')](handleEntityNotFound(_0x1e7603,null))[_0x4a11('0x2e')](respondWithResult(_0x1e7603,null))['catch'](handleError(_0x1e7603,null));};exports[_0x4a11('0x51')]=function(_0x4fe772,_0x4db92a){return db[_0x4a11('0x49')]['create'](_0x4fe772[_0x4a11('0x52')],{})[_0x4a11('0x2e')](respondWithResult(_0x4db92a,0xc9))['catch'](handleError(_0x4db92a,null));};exports['update']=function(_0x475071,_0x5f3f67){if(_0x475071[_0x4a11('0x52')]['id']){delete _0x475071[_0x4a11('0x52')]['id'];}return db[_0x4a11('0x49')][_0x4a11('0x50')]({'where':{'id':_0x475071[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x5f3f67,null))[_0x4a11('0x2e')](saveUpdates(_0x475071[_0x4a11('0x52')],null))[_0x4a11('0x2e')](respondWithResult(_0x5f3f67,null))[_0x4a11('0x4d')](handleError(_0x5f3f67,null));};exports['destroy']=function(_0x5bc350,_0x2eefc2){return db[_0x4a11('0x49')][_0x4a11('0x50')]({'where':{'id':_0x5bc350[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x2eefc2,null))['then'](removeEntity(_0x2eefc2,null))[_0x4a11('0x4d')](handleError(_0x2eefc2,null));};exports[_0x4a11('0x53')]=function(_0x86508f,_0x83755e){return db[_0x4a11('0x49')][_0x4a11('0x53')]()[_0x4a11('0x2e')](respondWithResult(_0x83755e,null))[_0x4a11('0x4d')](handleError(_0x83755e,null));};exports[_0x4a11('0x54')]=function(_0x286818,_0x1e72c2,_0x43036f){return db[_0x4a11('0x55')][_0x4a11('0x27')]({'where':{'ChatGroupId':_0x286818[_0x4a11('0x4e')]['id'],'ToId':_0x286818[_0x4a11('0x56')]['id'],'read':![]}})[_0x4a11('0x2e')](function(_0x59e4e7){return{'id':_[_0x4a11('0x57')](_0x286818[_0x4a11('0x4e')]['id']),'count':_0x59e4e7};})['then'](respondWithResult(_0x1e72c2,null))[_0x4a11('0x4d')](handleError(_0x1e72c2,null));};exports[_0x4a11('0x58')]=function(_0x3098a9,_0x35222f,_0x291d0c){return db[_0x4a11('0x49')]['find']({'where':{'id':_0x3098a9[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x35222f,null))['then'](function(_0x5bc607){if(_0x5bc607){return _0x5bc607[_0x4a11('0x58')](_0x3098a9[_0x4a11('0x52')][_0x4a11('0x59')],_[_0x4a11('0x5a')](_0x3098a9['body'],[_0x4a11('0x59'),'id'])||{});}})['then'](respondWithResult(_0x35222f,null))[_0x4a11('0x4d')](handleError(_0x35222f,null));};exports[_0x4a11('0x5b')]=function(_0x2c954f,_0x327776,_0x36f3bd){var _0xd23cb4={};var _0x268eb8={};var _0x22bc2c;var _0x3d7931;return db[_0x4a11('0x49')][_0x4a11('0x5c')]({'where':{'id':_0x2c954f['params']['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x327776,null))[_0x4a11('0x2e')](function(_0x1acf1b){if(_0x1acf1b){_0x22bc2c=_0x1acf1b;_0x268eb8[_0x4a11('0x3a')]=_[_0x4a11('0x4f')](db[_0x4a11('0x5d')][_0x4a11('0x35')]);_0x268eb8[_0x4a11('0x37')]=_[_0x4a11('0x4f')](_0x2c954f[_0x4a11('0x37')]);_0x268eb8['filters']=_[_0x4a11('0x39')](_0x268eb8[_0x4a11('0x3a')],_0x268eb8[_0x4a11('0x37')]);_0xd23cb4[_0x4a11('0x3c')]=_[_0x4a11('0x39')](_0x268eb8[_0x4a11('0x3a')],qs['fields'](_0x2c954f[_0x4a11('0x37')]['fields']));_0xd23cb4[_0x4a11('0x3c')]=_0xd23cb4[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0xd23cb4[_0x4a11('0x3c')]:_0x268eb8[_0x4a11('0x3a')];_0xd23cb4[_0x4a11('0x40')]=qs[_0x4a11('0x41')](_0x2c954f[_0x4a11('0x37')][_0x4a11('0x41')]);_0xd23cb4['where']=qs[_0x4a11('0x38')](_[_0x4a11('0x43')](_0x2c954f['query'],_0x268eb8[_0x4a11('0x38')]));if(_0x2c954f['query'][_0x4a11('0x44')]){_0xd23cb4[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0xd23cb4[_0x4a11('0x42')],{'$or':_[_0x4a11('0x34')](_0xd23cb4['attributes'],function(_0x820267){var _0x44a502={};_0x44a502[_0x820267]={'$like':'%'+_0x2c954f['query'][_0x4a11('0x44')]+'%'};return _0x44a502;})});}_0xd23cb4=_['merge']({},_0xd23cb4,_0x2c954f[_0x4a11('0x48')]);return _0x22bc2c[_0x4a11('0x5b')](_0xd23cb4);}})[_0x4a11('0x2e')](function(_0x37ee2f){if(_0x37ee2f){_0x3d7931=_0x37ee2f['length'];if(!_0x2c954f[_0x4a11('0x37')][_0x4a11('0x3e')](_0x4a11('0x3f'))){_0xd23cb4['limit']=qs['limit'](_0x2c954f[_0x4a11('0x37')]['limit']);_0xd23cb4['offset']=qs[_0x4a11('0x25')](_0x2c954f[_0x4a11('0x37')][_0x4a11('0x25')]);}return _0x22bc2c[_0x4a11('0x5b')](_0xd23cb4);}})[_0x4a11('0x2e')](function(_0x2f6077){if(_0x2f6077){return _0x2f6077?{'count':_0x3d7931,'rows':_0x2f6077}:null;}})[_0x4a11('0x2e')](respondWithResult(_0x327776,null))[_0x4a11('0x4d')](handleError(_0x327776,null));};exports[_0x4a11('0x5e')]=function(_0x7a0364,_0x842393,_0x3a7fcd){return db['ChatGroup']['find']({'where':{'id':_0x7a0364[_0x4a11('0x4e')]['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x842393,null))[_0x4a11('0x2e')](function(_0x3b16c9){if(_0x3b16c9){return _0x3b16c9['removeMembers'](_0x7a0364[_0x4a11('0x37')]['ids']);}})[_0x4a11('0x2e')](respondWithStatusCode(_0x842393,null))[_0x4a11('0x4d')](handleError(_0x842393,null));};exports['addMessage']=function(_0x1e7eeb,_0x24ccbc,_0x54be14){if(_0x1e7eeb['body']['id']){delete _0x1e7eeb[_0x4a11('0x52')]['id'];}return db['ChatGroup'][_0x4a11('0x50')]({'where':{'id':_0x1e7eeb['params']['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x24ccbc,null))['then'](function(_0x3e07d9){if(_0x3e07d9){_0x1e7eeb[_0x4a11('0x52')]['ChatGroupId']=_0x3e07d9['id'];return db['ChatInternalMessage'][_0x4a11('0x51')](_0x1e7eeb['body']);}})['then'](respondWithResult(_0x24ccbc,null))[_0x4a11('0x4d')](handleError(_0x24ccbc,null));};exports['getMessages']=function(_0x508894,_0x231fd4,_0x298043){var _0x2efd9f={};var _0x355ef7={};var _0x3e45d5;var _0x28f43c;return db[_0x4a11('0x49')][_0x4a11('0x5c')]({'where':{'id':_0x508894['params']['id']}})[_0x4a11('0x2e')](handleEntityNotFound(_0x231fd4,null))[_0x4a11('0x2e')](function(_0x350030){if(_0x350030){_0x3e45d5=_0x350030;_0x355ef7[_0x4a11('0x3a')]=_['keys'](db['ChatInternalMessage'][_0x4a11('0x35')]);_0x355ef7['query']=_['keys'](_0x508894['query']);_0x355ef7[_0x4a11('0x38')]=_[_0x4a11('0x39')](_0x355ef7[_0x4a11('0x3a')],_0x355ef7[_0x4a11('0x37')]);_0x2efd9f[_0x4a11('0x3c')]=_['intersection'](_0x355ef7[_0x4a11('0x3a')],qs[_0x4a11('0x3b')](_0x508894[_0x4a11('0x37')][_0x4a11('0x3b')]));_0x2efd9f[_0x4a11('0x3c')]=_0x2efd9f[_0x4a11('0x3c')][_0x4a11('0x3d')]?_0x2efd9f[_0x4a11('0x3c')]:_0x355ef7[_0x4a11('0x3a')];_0x2efd9f[_0x4a11('0x40')]=qs['sort'](_0x508894[_0x4a11('0x37')][_0x4a11('0x41')]);_0x2efd9f[_0x4a11('0x42')]=qs[_0x4a11('0x38')](_[_0x4a11('0x43')](_0x508894['query'],_0x355ef7['filters']));if(_0x508894[_0x4a11('0x37')][_0x4a11('0x44')]){_0x2efd9f[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0x2efd9f[_0x4a11('0x42')],{'$or':_[_0x4a11('0x34')](_0x2efd9f['attributes'],function(_0x55631b){var _0x4951b9={};_0x4951b9[_0x55631b]={'$like':'%'+_0x508894[_0x4a11('0x37')][_0x4a11('0x44')]+'%'};return _0x4951b9;})});}if(_0x508894['query']['$gte']){var _0x39578f=_0x508894[_0x4a11('0x37')][_0x4a11('0x5f')]['split'](',');var _0x23166c={};_0x23166c[_0x39578f[0x0]]={'$gte':moment(_0x39578f[0x1])[_0x4a11('0x60')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2efd9f[_0x4a11('0x42')]=_[_0x4a11('0x45')](_0x2efd9f[_0x4a11('0x42')],_0x23166c);}_0x2efd9f=_[_0x4a11('0x45')]({},_0x2efd9f,_0x508894['options']);return _0x3e45d5[_0x4a11('0x61')](_0x2efd9f);}})[_0x4a11('0x2e')](function(_0x335b72){if(_0x335b72){_0x28f43c=_0x335b72[_0x4a11('0x3d')];if(!_0x508894[_0x4a11('0x37')][_0x4a11('0x3e')]('nolimit')){_0x2efd9f[_0x4a11('0x28')]=qs['limit'](_0x508894['query'][_0x4a11('0x28')]);_0x2efd9f['offset']=qs[_0x4a11('0x25')](_0x508894[_0x4a11('0x37')][_0x4a11('0x25')]);}return _0x3e45d5[_0x4a11('0x61')](_0x2efd9f);}})[_0x4a11('0x2e')](function(_0x248475){if(_0x248475){return _0x248475?{'count':_0x28f43c,'rows':_0x248475}:null;}})[_0x4a11('0x2e')](respondWithResult(_0x231fd4,null))['catch'](handleError(_0x231fd4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f2d36c8..4052aba 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 _0xfca0=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xfca0,0x171));var _0x0fca=function(_0x4c5418,_0x4a9f2f){_0x4c5418=_0x4c5418-0x0;var _0x165b5c=_0xfca0[_0x4c5418];return _0x165b5c;};'use strict';var EventEmitter=require(_0x0fca('0x0'));var ChatGroup=require(_0x0fca('0x1'))['db'][_0x0fca('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0fca('0x3')](0x0);var events={'afterCreate':_0x0fca('0x4'),'afterUpdate':_0x0fca('0x5'),'afterDestroy':_0x0fca('0x6')};function emitEvent(_0x214c33){return function(_0x52cfba,_0x226056,_0xb474bc){ChatGroupEvents[_0x0fca('0x7')](_0x214c33+':'+_0x52cfba['id'],_0x52cfba);ChatGroupEvents[_0x0fca('0x7')](_0x214c33,_0x52cfba);_0xb474bc(null);};}for(var e in events){if(events[_0x0fca('0x8')](e)){var event=events[e];ChatGroup[_0x0fca('0x9')](e,emitEvent(event));}}module[_0x0fca('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x1033=['update','remove','emit','hasOwnProperty','hook','exports','ChatGroup','setMaxListeners','save'];(function(_0x2b5081,_0x45207e){var _0x5545e5=function(_0x271076){while(--_0x271076){_0x2b5081['push'](_0x2b5081['shift']());}};_0x5545e5(++_0x45207e);}(_0x1033,0x11d));var _0x3103=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1033[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0x3103('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3103('0x1')](0x0);var events={'afterCreate':_0x3103('0x2'),'afterUpdate':_0x3103('0x3'),'afterDestroy':_0x3103('0x4')};function emitEvent(_0x4b7881){return function(_0x592134,_0x431007,_0x5b10c1){ChatGroupEvents['emit'](_0x4b7881+':'+_0x592134['id'],_0x592134);ChatGroupEvents[_0x3103('0x5')](_0x4b7881,_0x592134);_0x5b10c1(null);};}for(var e in events){if(events[_0x3103('0x6')](e)){var event=events[e];ChatGroup[_0x3103('0x7')](e,emitEvent(event));}}module[_0x3103('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 9fa3872..aecd7fc 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 _0x5d11=['request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','api','moment','bluebird'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x5d11,0xbd));var _0x15d1=function(_0x163555,_0x27ce78){_0x163555=_0x163555-0x0;var _0x250307=_0x5d11[_0x163555];return _0x250307;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x15d1('0x0'));var moment=require(_0x15d1('0x1'));var BPromise=require(_0x15d1('0x2'));var rp=require(_0x15d1('0x3'));var fs=require('fs');var path=require(_0x15d1('0x4'));var rimraf=require(_0x15d1('0x5'));var config=require(_0x15d1('0x6'));var attributes=require(_0x15d1('0x7'));module[_0x15d1('0x8')]=function(_0x412470,_0x5bf397){return _0x412470[_0x15d1('0x9')](_0x15d1('0xa'),attributes,{'tableName':_0x15d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e8d=['api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x4b8505,_0x52433b){var _0x592308=function(_0x311e09){while(--_0x311e09){_0x4b8505['push'](_0x4b8505['shift']());}};_0x592308(++_0x52433b);}(_0x5e8d,0x1a1));var _0xd5e8=function(_0x41b117,_0x239cfa){_0x41b117=_0x41b117-0x0;var _0x37e4ed=_0x5e8d[_0x41b117];return _0x37e4ed;};'use strict';var _=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var logger=require(_0xd5e8('0x2'))(_0xd5e8('0x3'));var moment=require(_0xd5e8('0x4'));var BPromise=require(_0xd5e8('0x5'));var rp=require(_0xd5e8('0x6'));var fs=require('fs');var path=require(_0xd5e8('0x7'));var rimraf=require(_0xd5e8('0x8'));var config=require('../../config/environment');var attributes=require(_0xd5e8('0x9'));module[_0xd5e8('0xa')]=function(_0x285f62,_0x226357){return _0x285f62[_0xd5e8('0xb')](_0xd5e8('0xc'),attributes,{'tableName':_0xd5e8('0xd'),'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 c576042..bd0bd36 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 _0x3561=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x2b261b,_0x379957){var _0x18b255=function(_0x42c953){while(--_0x42c953){_0x2b261b['push'](_0x2b261b['shift']());}};_0x18b255(++_0x379957);}(_0x3561,0x94));var _0x1356=function(_0x1eca77,_0x3055f2){_0x1eca77=_0x1eca77-0x0;var _0x280625=_0x3561[_0x1eca77];return _0x280625;};'use strict';var _=require(_0x1356('0x0'));var util=require('util');var moment=require(_0x1356('0x1'));var BPromise=require(_0x1356('0x2'));var rs=require(_0x1356('0x3'));var fs=require('fs');var Redis=require(_0x1356('0x4'));var db=require(_0x1356('0x5'))['db'];var utils=require(_0x1356('0x6'));var logger=require(_0x1356('0x7'))(_0x1356('0x8'));var config=require(_0x1356('0x9'));var jayson=require(_0x1356('0xa'));var client=jayson[_0x1356('0xb')][_0x1356('0xc')]({'port':0x232a});config[_0x1356('0xd')]=_['defaults'](config[_0x1356('0xd')],{'host':_0x1356('0xe'),'port':0x18eb});var socket=require(_0x1356('0xf'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x1356('0x10')](socket);function respondWithRpcPromise(_0x101c23,_0x4f2abe,_0x46349e){return new BPromise(function(_0x4b3afa,_0x301f64){return client[_0x1356('0x11')](_0x101c23,_0x46349e)['then'](function(_0x3bbd0c){logger[_0x1356('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4f2abe,_0x1356('0x13'));logger[_0x1356('0x14')](_0x1356('0x15'),_0x4f2abe,_0x1356('0x13'),JSON[_0x1356('0x16')](_0x3bbd0c));if(_0x3bbd0c[_0x1356('0x17')]){if(_0x3bbd0c[_0x1356('0x17')][_0x1356('0x18')]===0x1f4){logger[_0x1356('0x17')](_0x1356('0x19'),_0x4f2abe,_0x3bbd0c[_0x1356('0x17')][_0x1356('0x1a')]);return _0x301f64(_0x3bbd0c[_0x1356('0x17')]['message']);}logger['error'](_0x1356('0x19'),_0x4f2abe,_0x3bbd0c[_0x1356('0x17')][_0x1356('0x1a')]);return _0x4b3afa(_0x3bbd0c['error'][_0x1356('0x1a')]);}else{logger[_0x1356('0x12')](_0x1356('0x19'),_0x4f2abe,_0x1356('0x13'));_0x4b3afa(_0x3bbd0c[_0x1356('0x1b')][_0x1356('0x1a')]);}})[_0x1356('0x1c')](function(_0x210b85){logger[_0x1356('0x17')](_0x1356('0x19'),_0x4f2abe,_0x210b85);_0x301f64(_0x210b85);});});} \ No newline at end of file +var _0xe14f=['then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14f,0xea));var _0xfe14=function(_0x73e513,_0x30624a){_0x73e513=_0x73e513-0x0;var _0x4a4e7a=_0xe14f[_0x73e513];return _0x4a4e7a;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var moment=require(_0xfe14('0x2'));var BPromise=require(_0xfe14('0x3'));var rs=require(_0xfe14('0x4'));var fs=require('fs');var Redis=require(_0xfe14('0x5'));var db=require(_0xfe14('0x6'))['db'];var utils=require(_0xfe14('0x7'));var logger=require(_0xfe14('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe14('0x9'));var client=jayson['client'][_0xfe14('0xa')]({'port':0x232a});config[_0xfe14('0xb')]=_[_0xfe14('0xc')](config[_0xfe14('0xb')],{'host':_0xfe14('0xd'),'port':0x18eb});var socket=require(_0xfe14('0xe'))(new Redis(config[_0xfe14('0xb')]));require(_0xfe14('0xf'))[_0xfe14('0x10')](socket);function respondWithRpcPromise(_0x540586,_0x2a85b0,_0x3a8713){return new BPromise(function(_0x2bc525,_0x403478){return client[_0xfe14('0x11')](_0x540586,_0x3a8713)[_0xfe14('0x12')](function(_0x4ae9a6){logger[_0xfe14('0x13')]('ChatGroup,\x20%s,\x20%s',_0x2a85b0,_0xfe14('0x14'));logger[_0xfe14('0x15')](_0xfe14('0x16'),_0x2a85b0,_0xfe14('0x14'),JSON[_0xfe14('0x17')](_0x4ae9a6));if(_0x4ae9a6[_0xfe14('0x18')]){if(_0x4ae9a6['error']['code']===0x1f4){logger[_0xfe14('0x18')](_0xfe14('0x19'),_0x2a85b0,_0x4ae9a6[_0xfe14('0x18')]['message']);return _0x403478(_0x4ae9a6[_0xfe14('0x18')]['message']);}logger[_0xfe14('0x18')](_0xfe14('0x19'),_0x2a85b0,_0x4ae9a6[_0xfe14('0x18')][_0xfe14('0x1a')]);return _0x2bc525(_0x4ae9a6[_0xfe14('0x18')][_0xfe14('0x1a')]);}else{logger[_0xfe14('0x13')](_0xfe14('0x19'),_0x2a85b0,_0xfe14('0x14'));_0x2bc525(_0x4ae9a6['result']['message']);}})[_0xfe14('0x1b')](function(_0x44435d){logger[_0xfe14('0x18')](_0xfe14('0x19'),_0x2a85b0,_0x44435d);_0x403478(_0x44435d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0e84a67..5c328bc 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 _0x08e6=['register','length','chatGroup:','./chatGroup.events','remove','update','removeListener'];(function(_0x14da70,_0x49391f){var _0x3929dc=function(_0x4005ab){while(--_0x4005ab){_0x14da70['push'](_0x14da70['shift']());}};_0x3929dc(++_0x49391f);}(_0x08e6,0xf1));var _0x608e=function(_0x33769e,_0x1668e6){_0x33769e=_0x33769e-0x0;var _0x32b0b8=_0x08e6[_0x33769e];return _0x32b0b8;};'use strict';var ChatGroupEvents=require(_0x608e('0x0'));var events=['save',_0x608e('0x1'),_0x608e('0x2')];function createListener(_0x292be6,_0x165721){return function(_0x194f3d){_0x165721['emit'](_0x292be6,_0x194f3d);};}function removeListener(_0x3b2176,_0x2f530c){return function(){ChatGroupEvents[_0x608e('0x3')](_0x3b2176,_0x2f530c);};}exports[_0x608e('0x4')]=function(_0x57116d){for(var _0x152436=0x0,_0x4b9627=events[_0x608e('0x5')];_0x152436<_0x4b9627;_0x152436++){var _0x5d8ef7=events[_0x152436];var _0x47b178=createListener(_0x608e('0x6')+_0x5d8ef7,_0x57116d);ChatGroupEvents['on'](_0x5d8ef7,_0x47b178);}}; \ No newline at end of file +var _0xc79f=['remove','removeListener','register','length','chatGroup:','save'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xc79f,0x15b));var _0xfc79=function(_0x31ff63,_0x15ab56){_0x31ff63=_0x31ff63-0x0;var _0x445ba1=_0xc79f[_0x31ff63];return _0x445ba1;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xfc79('0x0'),_0xfc79('0x1'),'update'];function createListener(_0x21e7aa,_0x25f1c6){return function(_0x4e2237){_0x25f1c6['emit'](_0x21e7aa,_0x4e2237);};}function removeListener(_0x448b27,_0x48e2f5){return function(){ChatGroupEvents[_0xfc79('0x2')](_0x448b27,_0x48e2f5);};}exports[_0xfc79('0x3')]=function(_0xb435a1){for(var _0x25174c=0x0,_0x1c4272=events[_0xfc79('0x4')];_0x25174c<_0x1c4272;_0x25174c++){var _0x33f788=events[_0x25174c];var _0x191acd=createListener(_0xfc79('0x5')+_0x33f788,_0xb435a1);ChatGroupEvents['on'](_0x33f788,_0x191acd);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fd8f317..e39320a 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 _0xdac4=['isAuthenticated','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get'];(function(_0x2dae7,_0x316db3){var _0x2e7960=function(_0x40aab7){while(--_0x40aab7){_0x2dae7['push'](_0x2dae7['shift']());}};_0x2e7960(++_0x316db3);}(_0xdac4,0xf2));var _0x4dac=function(_0x500785,_0x5b1b06){_0x500785=_0x500785-0x0;var _0x5e9ea1=_0xdac4[_0x500785];return _0x5e9ea1;};'use strict';var multer=require(_0x4dac('0x0'));var util=require(_0x4dac('0x1'));var path=require(_0x4dac('0x2'));var timeout=require(_0x4dac('0x3'));var express=require('express');var router=express[_0x4dac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4dac('0x5'));var interaction=require(_0x4dac('0x6'));var config=require(_0x4dac('0x7'));var controller=require(_0x4dac('0x8'));router[_0x4dac('0x9')]('/',auth[_0x4dac('0xa')](),controller['index']);router[_0x4dac('0x9')](_0x4dac('0xb'),auth[_0x4dac('0xa')](),controller['describe']);router[_0x4dac('0x9')](_0x4dac('0xc'),auth[_0x4dac('0xa')](),controller[_0x4dac('0xd')]);router['get'](_0x4dac('0xe'),auth[_0x4dac('0xa')](),controller[_0x4dac('0xf')]);router[_0x4dac('0x9')](_0x4dac('0x10'),auth[_0x4dac('0xa')](),controller[_0x4dac('0x11')]);router[_0x4dac('0x9')](_0x4dac('0x12'),auth[_0x4dac('0xa')](),controller[_0x4dac('0x13')]);router[_0x4dac('0x14')]('/',auth['isAuthenticated'](),controller[_0x4dac('0x15')]);router[_0x4dac('0x14')](_0x4dac('0x10'),auth['isAuthenticated'](),controller[_0x4dac('0x16')]);router[_0x4dac('0x14')](_0x4dac('0x12'),auth[_0x4dac('0xa')](),controller['addMessage']);router[_0x4dac('0x17')](_0x4dac('0xc'),auth['isAuthenticated'](),controller[_0x4dac('0x18')]);router[_0x4dac('0x19')]('/:id',auth[_0x4dac('0xa')](),controller['destroy']);router[_0x4dac('0x19')](_0x4dac('0x10'),auth['isAuthenticated'](),controller[_0x4dac('0x1a')]);module[_0x4dac('0x1b')]=router; \ No newline at end of file +var _0xe101=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','destroy','removeMembers','exports','path'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe101,0x112));var _0x1e10=function(_0x29f8dc,_0x356c82){_0x29f8dc=_0x29f8dc-0x0;var _0x5d48c4=_0xe101[_0x29f8dc];return _0x5d48c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e10('0x0'));var timeout=require(_0x1e10('0x1'));var express=require(_0x1e10('0x2'));var router=express[_0x1e10('0x3')]();var fs_extra=require(_0x1e10('0x4'));var auth=require(_0x1e10('0x5'));var interaction=require(_0x1e10('0x6'));var config=require(_0x1e10('0x7'));var controller=require('./chatGroup.controller');router[_0x1e10('0x8')]('/',auth[_0x1e10('0x9')](),controller[_0x1e10('0xa')]);router[_0x1e10('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e10('0xb')]);router['get'](_0x1e10('0xc'),auth[_0x1e10('0x9')](),controller[_0x1e10('0xd')]);router[_0x1e10('0x8')]('/:id/unread',auth[_0x1e10('0x9')](),controller[_0x1e10('0xe')]);router['get'](_0x1e10('0xf'),auth[_0x1e10('0x9')](),controller[_0x1e10('0x10')]);router[_0x1e10('0x8')]('/:id/messages',auth[_0x1e10('0x9')](),controller[_0x1e10('0x11')]);router[_0x1e10('0x12')]('/',auth['isAuthenticated'](),controller[_0x1e10('0x13')]);router[_0x1e10('0x12')](_0x1e10('0xf'),auth['isAuthenticated'](),controller[_0x1e10('0x14')]);router[_0x1e10('0x12')]('/:id/messages',auth[_0x1e10('0x9')](),controller[_0x1e10('0x15')]);router['put'](_0x1e10('0xc'),auth[_0x1e10('0x9')](),controller['update']);router['delete'](_0x1e10('0xc'),auth[_0x1e10('0x9')](),controller[_0x1e10('0x16')]);router['delete']('/:id/members',auth[_0x1e10('0x9')](),controller[_0x1e10('0x17')]);module[_0x1e10('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index fea9275..c894be9 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 _0x2311=['thumb','TEXT','DATE','STRING','long','out','sequelize','INTEGER','ENUM','star'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x2311,0x150));var _0x1231=function(_0x1d2d58,_0x59fa7e){_0x1d2d58=_0x1d2d58-0x0;var _0x234c1c=_0x2311[_0x1d2d58];return _0x234c1c;};'use strict';var Sequelize=require(_0x1231('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1231('0x1')]},'ratingType':{'type':Sequelize[_0x1231('0x2')](_0x1231('0x3'),_0x1231('0x4')),'defaultValue':_0x1231('0x3')},'ratingMessage':{'type':Sequelize[_0x1231('0x5')]},'pathTranscript':{'type':Sequelize[_0x1231('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1231('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1231('0x7')]},'thirdDisposition':{'type':Sequelize[_0x1231('0x7')]},'note':{'type':Sequelize[_0x1231('0x7')]},'browserName':{'type':Sequelize[_0x1231('0x7')]},'browserVersion':{'type':Sequelize[_0x1231('0x7')]},'osName':{'type':Sequelize[_0x1231('0x7')]},'osVersion':{'type':Sequelize[_0x1231('0x7')]},'deviceModel':{'type':Sequelize[_0x1231('0x7')]},'deviceVendor':{'type':Sequelize[_0x1231('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x1231('0x5')]},'customerIp':{'type':Sequelize[_0x1231('0x7')]},'formData':{'type':Sequelize[_0x1231('0x5')](_0x1231('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1231('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x1231('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1231('0x1')]}}; \ No newline at end of file +var _0x60a6=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','out','BOOLEAN'];(function(_0x396db1,_0x1a6cad){var _0x1b6beb=function(_0x56b3d2){while(--_0x56b3d2){_0x396db1['push'](_0x396db1['shift']());}};_0x1b6beb(++_0x1a6cad);}(_0x60a6,0xe9));var _0x660a=function(_0x54abb1,_0x2dac29){_0x54abb1=_0x54abb1-0x0;var _0x3f2ea1=_0x60a6[_0x54abb1];return _0x3f2ea1;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x660a('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x660a('0x1')]},'ratingType':{'type':Sequelize[_0x660a('0x2')](_0x660a('0x3'),_0x660a('0x4')),'defaultValue':_0x660a('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x660a('0x5')]},'mailTranscript':{'type':Sequelize[_0x660a('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x660a('0x7')]},'disposition':{'type':Sequelize[_0x660a('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x660a('0x6')]},'browserName':{'type':Sequelize[_0x660a('0x6')]},'browserVersion':{'type':Sequelize[_0x660a('0x6')]},'osName':{'type':Sequelize[_0x660a('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x660a('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x660a('0x6')]},'referer':{'type':Sequelize[_0x660a('0x5')]},'customerIp':{'type':Sequelize[_0x660a('0x6')]},'formData':{'type':Sequelize[_0x660a('0x5')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x660a('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x660a('0x2')]('in',_0x660a('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x660a('0x6')]},'customerPort':{'type':Sequelize[_0x660a('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x660a('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x660a('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1a65636..9fec3fc 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 _0x27fb=['closedAt','browserName','osName','referer','customerPort','existsSync','createReadStream','pipe','lastName','value','renderFile','downloadInteraction.ejs','.pdf','Chat','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','end','stack','name','merge','body','contact','agent','interaction','account','index','map','fieldName','key','getOptions','chat','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','ChatInteraction','create','destroy','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','email','vidaooTopic','isNull','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','find','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','agentAlias','System','customer','%s%d','Visitor','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','addMessage','ChatMessage','ids','omit','rawAttributes','hasOwnProperty','nolimit','limit','sort','where','filter','$gte','split','findAll','rows','getMyMessages','pick','ChatInteractionId','includeAgent','push','setTags','spread','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','createdAt','read','get','mkdirSync','Account','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3394cc,_0x1d42e8){var _0x5c59de=function(_0x3097da){while(--_0x3097da){_0x3394cc['push'](_0x3394cc['shift']());}};_0x5c59de(++_0x1d42e8);}(_0x27fb,0x1bc));var _0xb27f=function(_0x26aa07,_0x55175f){_0x26aa07=_0x26aa07-0x0;var _0x3683e9=_0x27fb[_0x26aa07];return _0x3683e9;};'use strict';var rimraf=require(_0xb27f('0x0'));var zipdir=require(_0xb27f('0x1'));var rp=require(_0xb27f('0x2'));var moment=require(_0xb27f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb27f('0x4'));var util=require(_0xb27f('0x5'));var path=require(_0xb27f('0x6'));var ejs=require(_0xb27f('0x7'));var fs=require('fs');var _=require(_0xb27f('0x8'));var Redis=require(_0xb27f('0x9'));var interaction=require(_0xb27f('0xa'));var qs=require(_0xb27f('0xb'));var pdf=require(_0xb27f('0xc'));var logger=require('../../config/logger')(_0xb27f('0xd'));var config=require(_0xb27f('0xe'));var db=require(_0xb27f('0xf'))['db'];config[_0xb27f('0x10')]=_[_0xb27f('0x11')](config[_0xb27f('0x10')],{'host':_0xb27f('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb27f('0x10')]));require(_0xb27f('0x13'))[_0xb27f('0x14')](socket);var jayson=require(_0xb27f('0x15'));var client=jayson[_0xb27f('0x16')][_0xb27f('0x17')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x4e09ec,_0x534384,_0x501fba,_0x50a440){return new BPromise(function(_0x5b4031,_0x47d649){var _0x1ffb41=_0x50a440||client;return _0x1ffb41[_0xb27f('0x18')](_0x4e09ec,_0x501fba)[_0xb27f('0x19')](function(_0x24b92a){logger[_0xb27f('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x534384,_0xb27f('0x1b'));logger[_0xb27f('0x1c')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x534384,'request\x20sent',JSON[_0xb27f('0x1d')](_0x24b92a));if(_0x24b92a[_0xb27f('0x1e')]){if(_0x24b92a[_0xb27f('0x1e')][_0xb27f('0x1f')]===0x1f4){logger[_0xb27f('0x1e')](_0xb27f('0x20'),_0x534384,_0x24b92a[_0xb27f('0x1e')][_0xb27f('0x21')]);return _0x47d649(_0x24b92a[_0xb27f('0x1e')][_0xb27f('0x21')]);}logger[_0xb27f('0x1e')](_0xb27f('0x20'),_0x534384,_0x24b92a['error'][_0xb27f('0x21')]);return _0x5b4031(_0x24b92a[_0xb27f('0x1e')][_0xb27f('0x21')]);}else{logger[_0xb27f('0x1a')](_0xb27f('0x20'),_0x534384,_0xb27f('0x1b'));_0x5b4031(_0x24b92a[_0xb27f('0x22')][_0xb27f('0x21')]);}})[_0xb27f('0x23')](function(_0x5d68c0){logger[_0xb27f('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x534384,_0x5d68c0);_0x47d649(_0x5d68c0);});});}function respondWithStatusCode(_0x2546ac,_0x2b5171){_0x2b5171=_0x2b5171||0xcc;return function(_0x7ff55d){if(_0x7ff55d){return _0x2546ac[_0xb27f('0x24')](_0x2b5171);}return _0x2546ac['status'](_0x2b5171)['end']();};}function respondWithResult(_0xbfdf34,_0x24acd4){_0x24acd4=_0x24acd4||0xc8;return function(_0x5a82fa){if(_0x5a82fa){return _0xbfdf34[_0xb27f('0x25')](_0x24acd4)[_0xb27f('0x26')](_0x5a82fa);}};}function respondWithFilteredResult(_0x4c9c8c,_0x55d9b3){return function(_0x5e2b30){if(_0x5e2b30){var _0x2731a3=typeof _0x55d9b3[_0xb27f('0x27')]==='undefined'&&typeof _0x55d9b3['limit']===_0xb27f('0x28');var _0xea873f=_0x5e2b30[_0xb27f('0x29')];var _0x2f8549=_0x2731a3?0x0:_0x55d9b3[_0xb27f('0x27')];var _0xd7dc77=_0x2731a3?_0x5e2b30[_0xb27f('0x29')]:_0x55d9b3[_0xb27f('0x27')]+_0x55d9b3['limit'];var _0x26afd4;if(_0xd7dc77>=_0xea873f){_0xd7dc77=_0xea873f;_0x26afd4=0xc8;}else{_0x26afd4=0xce;}_0x4c9c8c[_0xb27f('0x25')](_0x26afd4);return _0x4c9c8c[_0xb27f('0x2a')](_0xb27f('0x2b'),_0x2f8549+'-'+_0xd7dc77+'/'+_0xea873f)[_0xb27f('0x26')](_0x5e2b30);}return null;};}function saveUpdates(_0x3dfb8e){return function(_0x11b351){if(_0x11b351){return _0x11b351[_0xb27f('0x2c')](_0x3dfb8e)['then'](function(_0x4beebf){return _0x4beebf;});}return null;};}function removeEntity(_0x44cb50){return function(_0x3f29b6){if(_0x3f29b6){return _0x3f29b6['destroy']()[_0xb27f('0x19')](function(){_0x44cb50[_0xb27f('0x25')](0xcc)[_0xb27f('0x2d')]();});}};}function handleEntityNotFound(_0x3a7c73){return function(_0x13ad51){if(!_0x13ad51){_0x3a7c73[_0xb27f('0x24')](0x194);}return _0x13ad51;};}function handleError(_0x548780,_0x128b2e){_0x128b2e=_0x128b2e||0x1f4;return function(_0xfc2e11){logger['error'](_0xfc2e11[_0xb27f('0x2e')]);if(_0xfc2e11[_0xb27f('0x2f')]){delete _0xfc2e11['name'];}_0x548780[_0xb27f('0x25')](_0x128b2e)['send'](_0xfc2e11);};}function getMustacheRender(_0x365c25,_0x1d5f5a){return Mustache['render'](_0x365c25,_[_0xb27f('0x30')](_0x1d5f5a[_0xb27f('0x31')],{'contact':_0x1d5f5a[_0xb27f('0x32')],'message':_0x1d5f5a[_0xb27f('0x21')],'agent':_0x1d5f5a[_0xb27f('0x33')],'interaction':_0x1d5f5a[_0xb27f('0x34')],'account':_0x1d5f5a[_0xb27f('0x35')]}))||'';}exports[_0xb27f('0x36')]=function(_0x5d647b,_0xd807be){var _0x2d42a8={};var _0x1b55e7=_[_0xb27f('0x37')](db['ChatInteraction']['rawAttributes'],function(_0xb9b449){return{'name':_0xb9b449[_0xb27f('0x38')],'type':_0xb9b449['type'][_0xb27f('0x39')]};});_0x2d42a8=qs[_0xb27f('0x3a')](_0x1b55e7,_0x5d647b);return interaction['findAll'](_0xb27f('0x3b'),_0x5d647b[_0xb27f('0x3c')],_0x5d647b[_0xb27f('0x3d')],_0x2d42a8,_0x1b55e7)[_0xb27f('0x19')](respondWithFilteredResult(_0xd807be,_0x2d42a8))[_0xb27f('0x23')](handleError(_0xd807be,null));};exports[_0xb27f('0x3e')]=function(_0x1f491e,_0x54a9f1){var _0x2f6d5c={'raw':![],'where':{'id':_0x1f491e[_0xb27f('0x3f')]['id']}},_0x32b33={};_0x32b33[_0xb27f('0x40')]=_[_0xb27f('0x41')](db['ChatInteraction']['rawAttributes']);_0x32b33[_0xb27f('0x3c')]=_[_0xb27f('0x41')](_0x1f491e[_0xb27f('0x3c')]);_0x32b33[_0xb27f('0x42')]=_[_0xb27f('0x43')](_0x32b33[_0xb27f('0x40')],_0x32b33['query']);_0x2f6d5c[_0xb27f('0x44')]=_[_0xb27f('0x43')](_0x32b33['model'],qs['fields'](_0x1f491e[_0xb27f('0x3c')][_0xb27f('0x45')]));_0x2f6d5c[_0xb27f('0x44')]=_0x2f6d5c[_0xb27f('0x44')][_0xb27f('0x46')]?_0x2f6d5c[_0xb27f('0x44')]:_0x32b33[_0xb27f('0x40')];if(_0x1f491e[_0xb27f('0x3c')][_0xb27f('0x47')]){_0x2f6d5c[_0xb27f('0x48')]=[{'all':!![]}];}_0x2f6d5c=_[_0xb27f('0x30')]({},_0x2f6d5c,_0x1f491e[_0xb27f('0x49')]);return db[_0xb27f('0x4a')]['find'](_0x2f6d5c)['then'](handleEntityNotFound(_0x54a9f1,null))[_0xb27f('0x19')](respondWithResult(_0x54a9f1,null))[_0xb27f('0x23')](handleError(_0x54a9f1,null));};exports['create']=function(_0x50df04,_0xc780c3){return db[_0xb27f('0x4a')][_0xb27f('0x4b')](_0x50df04['body'],{})[_0xb27f('0x19')](respondWithResult(_0xc780c3,0xc9))['catch'](handleError(_0xc780c3,null));};exports['update']=function(_0x4fa62d,_0x22373e){if(_0x4fa62d[_0xb27f('0x31')]['id']){delete _0x4fa62d[_0xb27f('0x31')]['id'];}return db[_0xb27f('0x4a')]['find']({'where':{'id':_0x4fa62d[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](handleEntityNotFound(_0x22373e,null))[_0xb27f('0x19')](saveUpdates(_0x4fa62d[_0xb27f('0x31')],null))[_0xb27f('0x19')](respondWithResult(_0x22373e,null))[_0xb27f('0x23')](handleError(_0x22373e,null));};exports[_0xb27f('0x4c')]=function(_0x3de820,_0x144da9){return db['ChatInteraction']['find']({'where':{'id':_0x3de820[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](handleEntityNotFound(_0x144da9,null))[_0xb27f('0x19')](removeEntity(_0x144da9,null))[_0xb27f('0x23')](handleError(_0x144da9,null));};exports['describe']=function(_0x33ab5f,_0x243267){return db[_0xb27f('0x4a')][_0xb27f('0x4d')]()['then'](respondWithResult(_0x243267,null))[_0xb27f('0x23')](handleError(_0x243267,null));};exports['createVidaooSession']=function(_0x4d448a,_0x65f094){var _0x2b337f=_0x4d448a[_0xb27f('0x3f')]['id'];var _0xd9bcf2;var _0x59c12d;var _0x1e80f9;return db[_0xb27f('0x4a')][_0xb27f('0x4e')]({'where':{'id':_0x2b337f}})[_0xb27f('0x19')](function(_0x2b7c5a){_0xd9bcf2=_0x2b7c5a;return db[_0xb27f('0x4f')]['findOne']({'where':{'id':_0x2b7c5a[_0xb27f('0x50')]},'attributes':['id',_0xb27f('0x51'),_0xb27f('0x52'),'vidaooTopic',_0xb27f('0x53'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x216b5e){if(_0x216b5e&&_0x216b5e['vidaooApiKey']&&_0x216b5e['vidaooEscalation']){_0x59c12d=_0x216b5e;var _0x1e3113={'interaction':{'id':_0x2b337f},'agent':{'id':_0x4d448a['user']['id'],'name':_0x4d448a[_0xb27f('0x3d')][_0xb27f('0x2f')],'fullname':_0x4d448a[_0xb27f('0x3d')]['fullname'],'email':_0x4d448a[_0xb27f('0x3d')]['email']},'contact':_0x4d448a[_0xb27f('0x31')]['contact'],'account':_0x4d448a[_0xb27f('0x31')]['account']};var _0x5c5994={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x216b5e[_0xb27f('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d448a[_0xb27f('0x3d')][_0xb27f('0x54')]],'buttons':null,'topic':_0x59c12d[_0xb27f('0x55')],'note':_[_0xb27f('0x56')](_0x59c12d[_0xb27f('0x53')])?null:getMustacheRender(_0x59c12d[_0xb27f('0x53')],_0x1e3113),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xb27f('0x56')](_0x59c12d['vidaooMetadata'])){var _0x10855a=getMustacheRender(_0x59c12d[_0xb27f('0x57')],_0x1e3113);var _0x1f8634=JSON[_0xb27f('0x58')](_0x10855a);_0x5c5994[_0xb27f('0x31')][_0xb27f('0x59')]=_0x1f8634;}}catch(_0x3b6951){throw new db[(_0xb27f('0x5a'))][(_0xb27f('0x5b'))](_0xb27f('0x5c'));}return rp(_0x5c5994);}else{throw new db[(_0xb27f('0x5a'))][(_0xb27f('0x5b'))](_0xb27f('0x5d'));}})[_0xb27f('0x19')](function(_0x4be623){_0x1e80f9=_0x4be623;if(_0x1e80f9['id']){var _0xa9d355={'body':_0x1e80f9[_0xb27f('0x5e')],'ChatWebsiteId':_0x59c12d['id'],'ChatInteractionId':_0xd9bcf2['id'],'direction':_0xb27f('0x5f'),'UserId':_0x4d448a['user']['id']};return db['ChatMessage'][_0xb27f('0x4b')](_0xa9d355,{});}else{throw new db[(_0xb27f('0x5a'))][(_0xb27f('0x5b'))](_0xb27f('0x60'));}})[_0xb27f('0x19')](function(){return _0xd9bcf2[_0xb27f('0x61')]({'vidaooSessionId':_0x1e80f9['id']});})[_0xb27f('0x19')](respondWithResult(_0x65f094,null))[_0xb27f('0x23')](handleError(_0x65f094,null));};exports['customUpdate']=function(_0x2ea4be,_0x3a9b97){if(_0x2ea4be[_0xb27f('0x31')]['id']){delete _0x2ea4be['body']['id'];}return db[_0xb27f('0x4a')][_0xb27f('0x62')]({'where':{'id':_0x2ea4be[_0xb27f('0x3f')]['id']},'include':[{'model':db[_0xb27f('0x63')],'as':_0xb27f('0x64')}]})['then'](handleEntityNotFound(_0x3a9b97,null))[_0xb27f('0x19')](saveUpdates(_0x2ea4be[_0xb27f('0x31')],null))['then'](respondWithResult(_0x3a9b97,null))[_0xb27f('0x23')](handleError(_0x3a9b97,null));};exports['abandon']=function(_0x2d58b2,_0x200a58){if(_0x2d58b2[_0xb27f('0x31')]['id']){delete _0x2d58b2[_0xb27f('0x31')]['id'];}return db[_0xb27f('0x4a')][_0xb27f('0x62')]({'where':{'id':_0x2d58b2[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](function(_0x324c4f){if(!_0x324c4f){logger[_0xb27f('0x1e')](_0xb27f('0x65'),'abandon',0x194,_0xb27f('0x66'));_0x200a58[_0xb27f('0x24')](0x194);}else{if(_0x324c4f[_0xb27f('0x67')]){throw new db[(_0xb27f('0x5a'))][(_0xb27f('0x5b'))](_0xb27f('0x68'));}}return _0x324c4f;})['then'](function(_0x3d997e){if(_0x3d997e){return _0x3d997e[_0xb27f('0x2c')]({'closed':_0x2d58b2['body'][_0xb27f('0x69')],'disposition':_0x2d58b2[_0xb27f('0x31')][_0xb27f('0x6a')]})[_0xb27f('0x19')](function(_0x538b69){return _0x538b69;});}})[_0xb27f('0x19')](function(){return respondWithRpcPromise(_0xb27f('0x6b'),_0xb27f('0x6c'),_0x2d58b2[_0xb27f('0x31')],client9004);})[_0xb27f('0x19')](respondWithResult(_0x200a58,null))['catch'](handleError(_0x200a58,null));};exports[_0xb27f('0x6d')]=function(_0xdd9098,_0x10ecb1){_0xdd9098[_0xb27f('0x31')][_0xb27f('0x2f')]=_0xdd9098[_0xb27f('0x6e')][_0xb27f('0x6f')];_0xdd9098['body']['basename']=_0xdd9098[_0xb27f('0x6e')][_0xb27f('0x70')];_0xdd9098['body'][_0xb27f('0x71')]=_0xdd9098[_0xb27f('0x6e')][_0xb27f('0x72')];return db[_0xb27f('0x73')]['create'](_0xdd9098[_0xb27f('0x31')])[_0xb27f('0x19')](respondWithResult(_0x10ecb1,0xc9))[_0xb27f('0x23')](handleError(_0x10ecb1,null));};exports[_0xb27f('0x74')]=function(_0x3c1e1e,_0x354e0b){return db['ChatInteraction']['findOne']({'where':{'id':_0x3c1e1e['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x354e0b,null))['then'](function(_0x476fbf){if(_0x476fbf){if(_0x476fbf['closed']){return _0x354e0b[_0xb27f('0x25')](0x193)['json']({'status':0x193,'message':_0xb27f('0x75')});}return db[_0xb27f('0x73')][_0xb27f('0x4e')]({'where':{'id':_0x3c1e1e[_0xb27f('0x3c')][_0xb27f('0x76')]},'raw':!![]})[_0xb27f('0x19')](handleEntityNotFound(_0x354e0b,null));}})[_0xb27f('0x19')](function(_0x2d4520){if(_0x2d4520){var _0xa881e3=_0x2d4520[_0xb27f('0x77')]!==null;var _0x3fd6f3=path[_0xb27f('0x78')](config['root'],_0xb27f('0x79'));if(_0xa881e3){_0x3fd6f3=path[_0xb27f('0x78')](_0x3fd6f3,_0xb27f('0x7a'));}var _0x44a443=path['join'](_0x3fd6f3,_0x2d4520[_0xb27f('0x7b')]);return _0x354e0b['download'](_0x44a443);}})[_0xb27f('0x23')](handleError(_0x354e0b,null));};exports['close']=function(_0x3734f3,_0x25e1a7){var _0x1d14eb=null;var _0x14c1e2=null;var _0x55c0f3=null;if(_0x3734f3[_0xb27f('0x31')]['id']){delete _0x3734f3['body']['id'];}if(_0x3734f3[_0xb27f('0x31')][_0xb27f('0x7c')]){_0x55c0f3=path[_0xb27f('0x78')](config['root'],_0xb27f('0x7d'),util[_0xb27f('0x7e')](_0xb27f('0x7f'),Date[_0xb27f('0x80')]()));_0x3734f3[_0xb27f('0x31')][_0xb27f('0x81')]=_0x55c0f3;}return db[_0xb27f('0x4a')][_0xb27f('0x62')]({'where':{'id':_0x3734f3[_0xb27f('0x3f')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb27f('0x82'),'include':[{'model':db[_0xb27f('0x83')],'as':_0xb27f('0x83')}]}]})['then'](handleEntityNotFound(_0x25e1a7,null))['then'](saveUpdates(_0x3734f3[_0xb27f('0x31')],null))[_0xb27f('0x19')](function(_0x45b2d2){if(_0x45b2d2){_0x1d14eb=_0x45b2d2;return db[_0xb27f('0x4f')][_0xb27f('0x62')]({'where':{'id':_0x1d14eb[_0xb27f('0x50')]}});}})['then'](function(_0x3fd0ce){if(_0x3fd0ce){_0x14c1e2=_0x3fd0ce;return db[_0xb27f('0x63')]['find']({'where':{'id':_0x1d14eb[_0xb27f('0x84')]}});}})[_0xb27f('0x19')](function(_0xff0a6a){if(_0xff0a6a){if(_0x55c0f3){var _0x29c2a4=null;for(var _0x121909=0x1;_0x121909<_0x1d14eb[_0xb27f('0x82')][_0xb27f('0x46')];++_0x121909){_0x29c2a4=_0x1d14eb[_0xb27f('0x82')][_0x121909];var _0x18c58c=_0x29c2a4[_0xb27f('0x67')]?util[_0xb27f('0x7e')]('%s%d',_0x14c1e2[_0xb27f('0x85')],_0x29c2a4['UserId']):_0xb27f('0x86');var _0x24d73d=_0x3734f3[_0xb27f('0x31')][_0xb27f('0x87')]||util[_0xb27f('0x7e')](_0xb27f('0x88'),_0xb27f('0x89'),_0x29c2a4[_0xb27f('0x84')]);switch(_0x14c1e2['agentIdentifier']){case _0xb27f('0x8a'):_0x18c58c=_0x29c2a4[_0xb27f('0x67')]?util[_0xb27f('0x7e')](_0xb27f('0x88'),_0x14c1e2[_0xb27f('0x85')],_0x29c2a4[_0xb27f('0x67')]):_0xb27f('0x86');break;case _0xb27f('0x8b'):_0x18c58c=_0x29c2a4['UserId']?_0x29c2a4[_0xb27f('0x83')][_0xb27f('0x8c')]||_0x29c2a4[_0xb27f('0x83')]['fullname']:_0xb27f('0x86');break;case _0xb27f('0x8d'):_0x18c58c=_0x29c2a4[_0xb27f('0x67')]?_0x29c2a4[_0xb27f('0x83')][_0xb27f('0x8e')]:_0xb27f('0x86');break;default:_0x18c58c=_0x29c2a4[_0xb27f('0x67')]?util['format'](_0xb27f('0x88'),_0x14c1e2[_0xb27f('0x85')],_0x29c2a4['UserId']):'System';}var _0x120faf=util[_0xb27f('0x7e')](_0xb27f('0x8f'),moment(_0x29c2a4['createdAt'])[_0xb27f('0x7e')](_0xb27f('0x90')),_0x29c2a4[_0xb27f('0x91')]==='in'?_0x24d73d:_0x18c58c,_0x29c2a4['body']);if(!_0x29c2a4[_0xb27f('0x92')]){fs[_0xb27f('0x93')](_0x55c0f3,_0x120faf);}}return db[_0xb27f('0x94')][_0xb27f('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0xb27f('0x95')],'as':_0xb27f('0x96'),'raw':!![],'include':[{'model':db[_0xb27f('0x97')],'as':_0xb27f('0x97'),'raw':!![]}]}]});}}})[_0xb27f('0x19')](function(_0x402c6e){if(!_0x402c6e||!_0x402c6e[_0xb27f('0x96')]||!_0x3734f3[_0xb27f('0x31')])return _0x1d14eb;var _0x1e5005=_0x402c6e[_0xb27f('0x98')]();return respondWithRpcPromise(_0xb27f('0x99'),_0xb27f('0x9a'),{'account':_0x1e5005,'message':{'from':util[_0xb27f('0x7e')]('\x22%s\x22\x20<%s>',_0x402c6e[_0xb27f('0x2f')],_0x402c6e['email']||_0x402c6e['Smtp']['user']),'to':_0x3734f3[_0xb27f('0x31')]['mailTranscript'],'subject':_0xb27f('0x9b'),'text':util[_0xb27f('0x7e')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x3734f3[_0xb27f('0x31')][_0xb27f('0x7c')]),'attachments':[{'path':_0x55c0f3}]}})[_0xb27f('0x19')](function(){return _0x1d14eb;})[_0xb27f('0x23')](function(_0x56c1d4){logger[_0xb27f('0x1e')](_0x56c1d4);});})[_0xb27f('0x19')](respondWithStatusCode(_0x25e1a7,0xc8))[_0xb27f('0x23')](handleError(_0x25e1a7,null));};exports[_0xb27f('0x9c')]=function(_0x49d53e,_0x39efe3){return db[_0xb27f('0x9d')][_0xb27f('0x62')]({'where':{'id':_0x49d53e[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](handleEntityNotFound(_0x39efe3,null))[_0xb27f('0x19')](function(_0x13e928){if(_0x13e928){return _0x13e928[_0xb27f('0x9c')](_0x49d53e[_0xb27f('0x31')][_0xb27f('0x9e')],_[_0xb27f('0x9f')](_0x49d53e['body'],[_0xb27f('0x9e'),'id'])||{});}})[_0xb27f('0x19')](respondWithResult(_0x39efe3,null))[_0xb27f('0x23')](handleError(_0x39efe3,null));};exports['getMessages']=function(_0xa30a0,_0x25aee9){var _0x4d5701={'raw':![],'where':{}};var _0xb93f9e={};var _0x2cceb4={'count':0x0,'rows':[]};return db[_0xb27f('0x4a')][_0xb27f('0x4e')]({'where':{'id':_0xa30a0[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](handleEntityNotFound(_0x25aee9,null))['then'](function(_0x453a9f){if(_0x453a9f){_0xb93f9e[_0xb27f('0x40')]=_[_0xb27f('0x41')](db['ChatMessage'][_0xb27f('0xa0')]);_0xb93f9e[_0xb27f('0x3c')]=_[_0xb27f('0x41')](_0xa30a0['query']);_0xb93f9e[_0xb27f('0x42')]=_[_0xb27f('0x43')](_0xb93f9e[_0xb27f('0x40')],_0xb93f9e[_0xb27f('0x3c')]);_0x4d5701[_0xb27f('0x44')]=_[_0xb27f('0x43')](_0xb93f9e[_0xb27f('0x40')],qs[_0xb27f('0x45')](_0xa30a0['query']['fields']));_0x4d5701['attributes']=_0x4d5701[_0xb27f('0x44')][_0xb27f('0x46')]?_0x4d5701['attributes']:_0xb93f9e['model'];if(!_0xa30a0[_0xb27f('0x3c')][_0xb27f('0xa1')](_0xb27f('0xa2'))){_0x4d5701[_0xb27f('0xa3')]=qs['limit'](_0xa30a0['query'][_0xb27f('0xa3')]);_0x4d5701[_0xb27f('0x27')]=qs[_0xb27f('0x27')](_0xa30a0[_0xb27f('0x3c')]['offset']);}_0x4d5701['order']=qs[_0xb27f('0xa4')](_0xa30a0[_0xb27f('0x3c')][_0xb27f('0xa4')]);_0x4d5701[_0xb27f('0xa5')]=qs['filters'](_['pick'](_0xa30a0[_0xb27f('0x3c')],_0xb93f9e[_0xb27f('0x42')]));_0x4d5701['where']['ChatInteractionId']=_0x453a9f['id'];if(_0xa30a0[_0xb27f('0x3c')][_0xb27f('0xa6')]){_0x4d5701[_0xb27f('0xa5')]=_[_0xb27f('0x30')](_0x4d5701[_0xb27f('0xa5')],{'$or':_[_0xb27f('0x37')](_0x4d5701[_0xb27f('0x44')],function(_0x3fd3de){var _0x50251a={};_0x50251a[_0x3fd3de]={'$like':'%'+_0xa30a0['query'][_0xb27f('0xa6')]+'%'};return _0x50251a;})});}if(_0xa30a0[_0xb27f('0x3c')][_0xb27f('0xa7')]){var _0x497a18=_0xa30a0['query'][_0xb27f('0xa7')][_0xb27f('0xa8')](',');var _0x5f072c={};_0x5f072c[_0x497a18[0x0]]={'$gte':moment(_0x497a18[0x1])[_0xb27f('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4d5701[_0xb27f('0xa5')]=_['merge'](_0x4d5701[_0xb27f('0xa5')],_0x5f072c);}_0x4d5701=_['merge']({},_0x4d5701,_0xa30a0['options']);return db[_0xb27f('0x9d')][_0xb27f('0x29')]({'where':_0x4d5701['where']})[_0xb27f('0x19')](function(_0x75df41){_0x2cceb4[_0xb27f('0x29')]=_0x75df41;if(_0xa30a0[_0xb27f('0x3c')][_0xb27f('0x47')]){_0x4d5701[_0xb27f('0x48')]=[{'all':!![]}];}return db[_0xb27f('0x9d')][_0xb27f('0xa9')](_0x4d5701);})[_0xb27f('0x19')](function(_0x2d6c74){_0x2cceb4[_0xb27f('0xaa')]=_0x2d6c74;return _0x2cceb4;});}})[_0xb27f('0x19')](respondWithFilteredResult(_0x25aee9,_0x4d5701))[_0xb27f('0x23')](handleError(_0x25aee9,null));};exports[_0xb27f('0xab')]=function(_0x19f5e6,_0x177103){var _0x4f29d5={'where':{}},_0x5a4957={},_0x3e016a={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb27f('0x4e')]({'where':{'id':_0x19f5e6[_0xb27f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x177103,null))[_0xb27f('0x19')](function(_0x3d2c3c){if(_0x3d2c3c){_0x5a4957[_0xb27f('0x40')]=_[_0xb27f('0x41')](db['ChatMessage'][_0xb27f('0xa0')]);_0x5a4957['query']=_[_0xb27f('0x41')](_0x19f5e6[_0xb27f('0x3c')]);_0x5a4957['filters']=_[_0xb27f('0x43')](_0x5a4957[_0xb27f('0x40')],_0x5a4957['query']);_0x4f29d5[_0xb27f('0x44')]=_['intersection'](_0x5a4957[_0xb27f('0x40')],qs[_0xb27f('0x45')](_0x19f5e6[_0xb27f('0x3c')]['fields']));_0x4f29d5['attributes']=_0x4f29d5[_0xb27f('0x44')][_0xb27f('0x46')]?_0x4f29d5[_0xb27f('0x44')]:_0x5a4957[_0xb27f('0x40')];if(!_0x19f5e6[_0xb27f('0x3c')][_0xb27f('0xa1')](_0xb27f('0xa2'))){_0x4f29d5[_0xb27f('0xa3')]=qs['limit'](_0x19f5e6[_0xb27f('0x3c')][_0xb27f('0xa3')]);_0x4f29d5[_0xb27f('0x27')]=qs[_0xb27f('0x27')](_0x19f5e6[_0xb27f('0x3c')]['offset']);}_0x4f29d5['order']=qs[_0xb27f('0xa4')](_0x19f5e6[_0xb27f('0x3c')][_0xb27f('0xa4')]);_0x4f29d5[_0xb27f('0xa5')]=qs[_0xb27f('0x42')](_[_0xb27f('0xac')](_0x19f5e6[_0xb27f('0x3c')],_0x5a4957[_0xb27f('0x42')]));_0x4f29d5[_0xb27f('0xa5')][_0xb27f('0xad')]=_0x3d2c3c['id'];if(_0x19f5e6[_0xb27f('0x3c')]['filter']){_0x4f29d5['where']=_['merge'](_0x4f29d5[_0xb27f('0xa5')],{'$or':_[_0xb27f('0x37')](_0x4f29d5[_0xb27f('0x44')],function(_0x34694f){var _0x249885={};_0x249885[_0x34694f]={'$like':'%'+_0x19f5e6[_0xb27f('0x3c')]['filter']+'%'};return _0x249885;})});}_0x4f29d5[_0xb27f('0xa5')]['secret']=![];if(_0x19f5e6[_0xb27f('0x3c')]['id']){_0x4f29d5[_0xb27f('0xa5')]['id']={'$gt':_0x19f5e6[_0xb27f('0x3c')]['id']};}_0x4f29d5=_['merge']({},_0x4f29d5,_0x19f5e6[_0xb27f('0x49')]);return db['ChatMessage'][_0xb27f('0x29')]({'where':_0x4f29d5[_0xb27f('0xa5')]})[_0xb27f('0x19')](function(_0x42dfd3){_0x3e016a[_0xb27f('0x29')]=_0x42dfd3;_0x4f29d5[_0xb27f('0x48')]=[];if(_0x19f5e6[_0xb27f('0x3c')][_0xb27f('0xae')]){_0x4f29d5[_0xb27f('0x48')][_0xb27f('0xaf')]({'model':db['User'],'as':_0xb27f('0x83'),'attributes':['id',_0xb27f('0x8e'),'alias']});}if(_0x19f5e6[_0xb27f('0x3c')][_0xb27f('0x47')]){_0x4f29d5[_0xb27f('0x48')]=[{'all':!![]}];}return db[_0xb27f('0x9d')][_0xb27f('0xa9')](_0x4f29d5);})[_0xb27f('0x19')](function(_0x325af3){_0x3e016a['rows']=_0x325af3;return _0x3e016a;});}})['then'](respondWithFilteredResult(_0x177103,_0x4f29d5))[_0xb27f('0x23')](handleError(_0x177103,null));};exports['addTags']=function(_0x4ce46d,_0x29d0f5){return db['ChatInteraction'][_0xb27f('0x62')]({'where':{'id':_0x4ce46d[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](handleEntityNotFound(_0x29d0f5,null))[_0xb27f('0x19')](function(_0x446370){if(_0x446370){return _0x446370[_0xb27f('0xb0')](_0x4ce46d[_0xb27f('0x31')][_0xb27f('0x9e')],_[_0xb27f('0x9f')](_0x4ce46d[_0xb27f('0x31')],[_0xb27f('0x9e'),'id'])||{})[_0xb27f('0xb1')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xb27f('0xb2')],'where':{'id':_0x4ce46d['body']['ids']}});})[_0xb27f('0x19')](function(_0x11cb83){socket[_0xb27f('0xb3')](_0xb27f('0xb4'),{'id':Number(_0x4ce46d[_0xb27f('0x3f')]['id']),'tags':_0x11cb83||[]});return{'id':Number(_0x4ce46d[_0xb27f('0x3f')]['id']),'tags':_0x11cb83||[]};});}})['then'](respondWithResult(_0x29d0f5,null))[_0xb27f('0x23')](handleError(_0x29d0f5,null));};exports[_0xb27f('0xb5')]=function(_0x452966,_0x130cec){return db[_0xb27f('0x4a')]['find']({'where':{'id':_0x452966[_0xb27f('0x3f')]['id']}})[_0xb27f('0x19')](handleEntityNotFound(_0x130cec,null))[_0xb27f('0x19')](function(_0x1ed471){if(_0x1ed471){return _0x1ed471['removeTags'](_0x452966[_0xb27f('0x3c')][_0xb27f('0x9e')]);}})['then'](respondWithStatusCode(_0x130cec,null))['catch'](handleError(_0x130cec,null));};exports[_0xb27f('0xb6')]=function(_0x5817ae,_0x5168a0){var _0x4630ce=moment()[_0xb27f('0xb7')]()[_0xb27f('0xb8')]();var _0x11d114=path[_0xb27f('0x78')](config[_0xb27f('0xb9')],_0xb27f('0xba'),_0xb27f('0xbb'),_0xb27f('0xbc'));var _0x10eb8a=path[_0xb27f('0x78')](config['root'],_0xb27f('0xba'),_0xb27f('0xbb'),_0xb27f('0xbd'));var _0x58ec98=path[_0xb27f('0x78')](_0x11d114,_0x4630ce);var _0x38cc29=util['format'](_0xb27f('0xbe'),_0x5817ae['params']['id'],_0x4630ce);var _0x2712c7=path[_0xb27f('0x78')](_0x11d114,_0x38cc29);var _0x28b6cf=[];_0x28b6cf['push']({'model':db[_0xb27f('0x83')],'as':_0xb27f('0x83'),'attributes':['id',_0xb27f('0x8e')],'raw':!![]});_0x28b6cf[_0xb27f('0xaf')]({'model':db[_0xb27f('0x63')],'as':_0xb27f('0x64'),'attributes':['id',_0xb27f('0xbf'),'lastName'],'raw':!![]});if(_0x5817ae[_0xb27f('0x3c')]['attachments']){_0x28b6cf[_0xb27f('0xaf')]({'model':db[_0xb27f('0x73')],'as':_0xb27f('0x73'),'raw':!![]});}var _0x1e65aa=[{'model':db[_0xb27f('0x9d')],'as':_0xb27f('0x82'),'attributes':['id',_0xb27f('0x31'),_0xb27f('0xc0'),_0xb27f('0x91'),_0xb27f('0x92'),_0xb27f('0xc1')],'include':_0x28b6cf}];_0x1e65aa[_0xb27f('0xaf')]({'model':db[_0xb27f('0x4f')],'as':'Account','attributes':['id',_0xb27f('0x2f')]});_0x1e65aa[_0xb27f('0xaf')]({'model':db[_0xb27f('0x83')],'as':'Owner','attributes':['id',_0xb27f('0x8e')]});return db['ChatInteraction'][_0xb27f('0x62')]({'where':{'id':_0x5817ae['params']['id']},'include':_0x1e65aa})[_0xb27f('0x19')](handleEntityNotFound(_0x5168a0,null))['then'](function(_0x401b38){if(_0x401b38){var _0x23ed52=_0x401b38[_0xb27f('0xc2')]({'plain':!![]});fs[_0xb27f('0xc3')](_0x58ec98);var _0x24101d={'channel':'Chat','account':_0x23ed52[_0xb27f('0xc4')][_0xb27f('0x2f')],'agent':_0x23ed52['Owner']?_0x23ed52['Owner'][_0xb27f('0x8e')]:'N.A.','createdAt':moment(_0x23ed52[_0xb27f('0xc0')])[_0xb27f('0x7e')](_0xb27f('0xc5'))[_0xb27f('0xb8')](),'closedAt':_0x23ed52[_0xb27f('0x69')]?moment(_0x23ed52[_0xb27f('0xc6')])[_0xb27f('0x7e')](_0xb27f('0xc5'))[_0xb27f('0xb8')]():'','disposition':_0x23ed52[_0xb27f('0x6a')],'chatInfo':{'browser':_0x23ed52[_0xb27f('0xc7')],'os':_0x23ed52[_0xb27f('0xc8')],'referer':_0x23ed52[_0xb27f('0xc9')],'customerIp':_0x23ed52['customerIp'],'customerPort':_0x23ed52['customerPort']?_0x23ed52[_0xb27f('0xca')]:'N.A.'},'messages':_(_0x23ed52[_0xb27f('0x82')])['tail']()[_0xb27f('0xa6')]({'secret':![]})['map'](function(_0x478ec3){if(_0x478ec3[_0xb27f('0x73')]){var _0x48bba0=path[_0xb27f('0x78')](_0x10eb8a,_0x478ec3[_0xb27f('0x73')][_0xb27f('0x7b')]);if(fs[_0xb27f('0xcb')](_0x48bba0)){fs[_0xb27f('0xcc')](_0x48bba0)[_0xb27f('0xcd')](fs['createWriteStream'](path['join'](_0x58ec98,_0x478ec3[_0xb27f('0x73')][_0xb27f('0x7b')])));}}return{'date':moment(_0x478ec3[_0xb27f('0xc0')])[_0xb27f('0x7e')](_0xb27f('0xc5'))['toString'](),'sender':_0x478ec3[_0xb27f('0x91')]===_0xb27f('0x5f')?_0x478ec3[_0xb27f('0x83')]?_0x478ec3[_0xb27f('0x83')]['fullname']:_0xb27f('0x86'):_0x478ec3[_0xb27f('0x64')][_0xb27f('0xbf')]+(_0x478ec3[_0xb27f('0x64')][_0xb27f('0xce')]?'\x20'+_0x478ec3[_0xb27f('0x64')][_0xb27f('0xce')]:''),'body':_0x478ec3['Attachment']?_0x478ec3[_0xb27f('0x73')]['basename']:_0x478ec3[_0xb27f('0x31')],'direction':_0x478ec3[_0xb27f('0x91')]===_0xb27f('0x5f')?'A':'C','secret':_0x478ec3[_0xb27f('0x92')],'read':_0x478ec3[_0xb27f('0xc1')],'attachment':_0x478ec3[_0xb27f('0x73')]};})[_0xb27f('0xcf')]()};return ejs[_0xb27f('0xd0')](path[_0xb27f('0x78')](config[_0xb27f('0xb9')],_0xb27f('0xba'),'views',_0xb27f('0xd1')),{'interaction':_0x24101d})['then'](function(_0x139767){var _0x5a5306=path[_0xb27f('0x78')](_0x58ec98,'transcript-'+_0x23ed52['id']+'-'+_0x4630ce+_0xb27f('0xd2'));var _0x1389c4={'path':_0x5a5306,'channel':_0xb27f('0xd3'),'interactionId':_0x23ed52['id']};return pdf[_0xb27f('0xd4')](_0x139767,_0x1389c4);})[_0xb27f('0x19')](function(){return new Promise(function(_0x8e4bdb,_0x4c488b){zipdir(_0x58ec98,{'saveTo':_0x2712c7},function(_0x5ab579,_0x55bc5c){if(_0x5ab579)return _0x4c488b(_0x5ab579);return _0x8e4bdb(_0x55bc5c);});})[_0xb27f('0x19')](function(){return new BPromise(function(_0x1d5ece,_0x58198e){rimraf(_0x58ec98,function(_0x28e5d6){if(_0x28e5d6)_0x58198e(_0x28e5d6);return _0x1d5ece();});});})[_0xb27f('0x19')](function(){return _0x5168a0[_0xb27f('0xb6')](_0x2712c7,_0x38cc29,function(_0x206c1c){if(_0x206c1c){logger[_0xb27f('0x1e')](_0xb27f('0xd5'),_0x206c1c);}else{fs['unlinkSync'](_0x2712c7);}});});});}else{return _0x5168a0[_0xb27f('0x24')](0xc8);}})[_0xb27f('0x23')](handleError(_0x5168a0,null));}; \ No newline at end of file +var _0x3acb=['value','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','end','stack','name','body','index','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','findAll','chat','show','model','query','keys','filters','intersection','attributes','fields','length','include','merge','options','create','params','find','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooApiKey','user','fullname','email','contact','account','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','parse','metadata','Sequelize','ValidationError','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','filename','mimetype','Attachment','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','Messages','User','ContactId','format','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','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','hasOwnProperty','nolimit','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','order','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','Chat','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createWriteStream','out','basename'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3acb,0x19a));var _0xb3ac=function(_0x4c12a8,_0x55d973){_0x4c12a8=_0x4c12a8-0x0;var _0x177947=_0x3acb[_0x4c12a8];return _0x177947;};'use strict';var rimraf=require(_0xb3ac('0x0'));var zipdir=require(_0xb3ac('0x1'));var rp=require(_0xb3ac('0x2'));var moment=require(_0xb3ac('0x3'));var BPromise=require(_0xb3ac('0x4'));var Mustache=require(_0xb3ac('0x5'));var util=require('util');var path=require(_0xb3ac('0x6'));var ejs=require(_0xb3ac('0x7'));var fs=require('fs');var _=require(_0xb3ac('0x8'));var Redis=require(_0xb3ac('0x9'));var interaction=require(_0xb3ac('0xa'));var qs=require(_0xb3ac('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0xb3ac('0xc'))(_0xb3ac('0xd'));var config=require(_0xb3ac('0xe'));var db=require(_0xb3ac('0xf'))['db'];config['redis']=_[_0xb3ac('0x10')](config[_0xb3ac('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3ac('0x12'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xb3ac('0x13')](socket);var jayson=require(_0xb3ac('0x14'));var client=jayson[_0xb3ac('0x15')][_0xb3ac('0x16')]({'port':0x232b});var client9004=jayson[_0xb3ac('0x15')][_0xb3ac('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x20ab48,_0x585e2d,_0x357417,_0x3451ef){return new BPromise(function(_0x4499d1,_0x4fa2e7){var _0x4b41a5=_0x3451ef||client;return _0x4b41a5['request'](_0x20ab48,_0x357417)[_0xb3ac('0x17')](function(_0x333ec0){logger[_0xb3ac('0x18')](_0xb3ac('0x19'),_0x585e2d,_0xb3ac('0x1a'));logger[_0xb3ac('0x1b')](_0xb3ac('0x1c'),_0x585e2d,_0xb3ac('0x1a'),JSON['stringify'](_0x333ec0));if(_0x333ec0[_0xb3ac('0x1d')]){if(_0x333ec0[_0xb3ac('0x1d')]['code']===0x1f4){logger[_0xb3ac('0x1d')](_0xb3ac('0x19'),_0x585e2d,_0x333ec0[_0xb3ac('0x1d')][_0xb3ac('0x1e')]);return _0x4fa2e7(_0x333ec0[_0xb3ac('0x1d')][_0xb3ac('0x1e')]);}logger[_0xb3ac('0x1d')](_0xb3ac('0x19'),_0x585e2d,_0x333ec0['error'][_0xb3ac('0x1e')]);return _0x4499d1(_0x333ec0[_0xb3ac('0x1d')][_0xb3ac('0x1e')]);}else{logger['info'](_0xb3ac('0x19'),_0x585e2d,_0xb3ac('0x1a'));_0x4499d1(_0x333ec0[_0xb3ac('0x1f')]['message']);}})[_0xb3ac('0x20')](function(_0x54178d){logger[_0xb3ac('0x1d')](_0xb3ac('0x19'),_0x585e2d,_0x54178d);_0x4fa2e7(_0x54178d);});});}function respondWithStatusCode(_0x2dee1b,_0x5ef209){_0x5ef209=_0x5ef209||0xcc;return function(_0x5574f8){if(_0x5574f8){return _0x2dee1b[_0xb3ac('0x21')](_0x5ef209);}return _0x2dee1b[_0xb3ac('0x22')](_0x5ef209)['end']();};}function respondWithResult(_0x160453,_0x1f4479){_0x1f4479=_0x1f4479||0xc8;return function(_0x3353e6){if(_0x3353e6){return _0x160453[_0xb3ac('0x22')](_0x1f4479)[_0xb3ac('0x23')](_0x3353e6);}};}function respondWithFilteredResult(_0x2e336b,_0x50d730){return function(_0x226444){if(_0x226444){var _0x1a50d2=typeof _0x50d730[_0xb3ac('0x24')]===_0xb3ac('0x25')&&typeof _0x50d730[_0xb3ac('0x26')]===_0xb3ac('0x25');var _0x97292=_0x226444['count'];var _0x24cfd0=_0x1a50d2?0x0:_0x50d730[_0xb3ac('0x24')];var _0x24ca0c=_0x1a50d2?_0x226444[_0xb3ac('0x27')]:_0x50d730['offset']+_0x50d730[_0xb3ac('0x26')];var _0x3dec8e;if(_0x24ca0c>=_0x97292){_0x24ca0c=_0x97292;_0x3dec8e=0xc8;}else{_0x3dec8e=0xce;}_0x2e336b['status'](_0x3dec8e);return _0x2e336b[_0xb3ac('0x28')](_0xb3ac('0x29'),_0x24cfd0+'-'+_0x24ca0c+'/'+_0x97292)[_0xb3ac('0x23')](_0x226444);}return null;};}function saveUpdates(_0xa58835){return function(_0xb15e34){if(_0xb15e34){return _0xb15e34[_0xb3ac('0x2a')](_0xa58835)[_0xb3ac('0x17')](function(_0x9d2b80){return _0x9d2b80;});}return null;};}function removeEntity(_0x3138d3){return function(_0x38375c){if(_0x38375c){return _0x38375c['destroy']()[_0xb3ac('0x17')](function(){_0x3138d3[_0xb3ac('0x22')](0xcc)[_0xb3ac('0x2b')]();});}};}function handleEntityNotFound(_0x15e530){return function(_0x441c99){if(!_0x441c99){_0x15e530['sendStatus'](0x194);}return _0x441c99;};}function handleError(_0x2300e0,_0x4edf99){_0x4edf99=_0x4edf99||0x1f4;return function(_0x188a15){logger['error'](_0x188a15[_0xb3ac('0x2c')]);if(_0x188a15['name']){delete _0x188a15[_0xb3ac('0x2d')];}_0x2300e0['status'](_0x4edf99)['send'](_0x188a15);};}function getMustacheRender(_0xcd85bf,_0x4703a7){return Mustache['render'](_0xcd85bf,_['merge'](_0x4703a7[_0xb3ac('0x2e')],{'contact':_0x4703a7['contact'],'message':_0x4703a7[_0xb3ac('0x1e')],'agent':_0x4703a7['agent'],'interaction':_0x4703a7['interaction'],'account':_0x4703a7['account']}))||'';}exports[_0xb3ac('0x2f')]=function(_0x21d3c9,_0xb93fc6){var _0x28be53={};var _0x3347e0=_[_0xb3ac('0x30')](db[_0xb3ac('0x31')][_0xb3ac('0x32')],function(_0x5c28d9){return{'name':_0x5c28d9[_0xb3ac('0x33')],'type':_0x5c28d9['type'][_0xb3ac('0x34')]};});_0x28be53=qs[_0xb3ac('0x35')](_0x3347e0,_0x21d3c9);return interaction[_0xb3ac('0x36')](_0xb3ac('0x37'),_0x21d3c9['query'],_0x21d3c9['user'],_0x28be53,_0x3347e0)[_0xb3ac('0x17')](respondWithFilteredResult(_0xb93fc6,_0x28be53))[_0xb3ac('0x20')](handleError(_0xb93fc6,null));};exports[_0xb3ac('0x38')]=function(_0x21e678,_0x31bff6){var _0x229fbf={'raw':![],'where':{'id':_0x21e678['params']['id']}},_0x5972d3={};_0x5972d3[_0xb3ac('0x39')]=_['keys'](db[_0xb3ac('0x31')][_0xb3ac('0x32')]);_0x5972d3[_0xb3ac('0x3a')]=_[_0xb3ac('0x3b')](_0x21e678[_0xb3ac('0x3a')]);_0x5972d3[_0xb3ac('0x3c')]=_[_0xb3ac('0x3d')](_0x5972d3[_0xb3ac('0x39')],_0x5972d3['query']);_0x229fbf[_0xb3ac('0x3e')]=_['intersection'](_0x5972d3['model'],qs[_0xb3ac('0x3f')](_0x21e678[_0xb3ac('0x3a')][_0xb3ac('0x3f')]));_0x229fbf['attributes']=_0x229fbf[_0xb3ac('0x3e')][_0xb3ac('0x40')]?_0x229fbf[_0xb3ac('0x3e')]:_0x5972d3['model'];if(_0x21e678[_0xb3ac('0x3a')]['includeAll']){_0x229fbf[_0xb3ac('0x41')]=[{'all':!![]}];}_0x229fbf=_[_0xb3ac('0x42')]({},_0x229fbf,_0x21e678[_0xb3ac('0x43')]);return db[_0xb3ac('0x31')]['find'](_0x229fbf)[_0xb3ac('0x17')](handleEntityNotFound(_0x31bff6,null))[_0xb3ac('0x17')](respondWithResult(_0x31bff6,null))[_0xb3ac('0x20')](handleError(_0x31bff6,null));};exports[_0xb3ac('0x44')]=function(_0x10be85,_0x26f382){return db['ChatInteraction'][_0xb3ac('0x44')](_0x10be85[_0xb3ac('0x2e')],{})[_0xb3ac('0x17')](respondWithResult(_0x26f382,0xc9))[_0xb3ac('0x20')](handleError(_0x26f382,null));};exports[_0xb3ac('0x2a')]=function(_0x2ed300,_0x5bccf1){if(_0x2ed300[_0xb3ac('0x2e')]['id']){delete _0x2ed300[_0xb3ac('0x2e')]['id'];}return db[_0xb3ac('0x31')]['find']({'where':{'id':_0x2ed300[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x5bccf1,null))['then'](saveUpdates(_0x2ed300[_0xb3ac('0x2e')],null))[_0xb3ac('0x17')](respondWithResult(_0x5bccf1,null))[_0xb3ac('0x20')](handleError(_0x5bccf1,null));};exports['destroy']=function(_0x516d6c,_0x4112af){return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x516d6c[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x4112af,null))[_0xb3ac('0x17')](removeEntity(_0x4112af,null))[_0xb3ac('0x20')](handleError(_0x4112af,null));};exports[_0xb3ac('0x47')]=function(_0x18594a,_0x4fe068){return db[_0xb3ac('0x31')]['describe']()[_0xb3ac('0x17')](respondWithResult(_0x4fe068,null))[_0xb3ac('0x20')](handleError(_0x4fe068,null));};exports['createVidaooSession']=function(_0x178e8a,_0x56d61b){var _0x6b2e32=_0x178e8a[_0xb3ac('0x45')]['id'];var _0x408551;var _0x42592c;var _0x26d748;return db[_0xb3ac('0x31')][_0xb3ac('0x48')]({'where':{'id':_0x6b2e32}})[_0xb3ac('0x17')](function(_0x58932e){_0x408551=_0x58932e;return db[_0xb3ac('0x49')][_0xb3ac('0x48')]({'where':{'id':_0x58932e[_0xb3ac('0x4a')]},'attributes':['id','vidaooApiKey',_0xb3ac('0x4b'),'vidaooTopic','vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xb3ac('0x17')](function(_0x39518e){if(_0x39518e&&_0x39518e[_0xb3ac('0x4c')]&&_0x39518e[_0xb3ac('0x4b')]){_0x42592c=_0x39518e;var _0x454e13={'interaction':{'id':_0x6b2e32},'agent':{'id':_0x178e8a[_0xb3ac('0x4d')]['id'],'name':_0x178e8a['user']['name'],'fullname':_0x178e8a[_0xb3ac('0x4d')][_0xb3ac('0x4e')],'email':_0x178e8a[_0xb3ac('0x4d')][_0xb3ac('0x4f')]},'contact':_0x178e8a['body'][_0xb3ac('0x50')],'account':_0x178e8a[_0xb3ac('0x2e')][_0xb3ac('0x51')]};var _0x495f2b={'rejectUnauthorized':![],'method':'POST','url':_0xb3ac('0x52'),'headers':{'X-APIKEY':_0x39518e[_0xb3ac('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x178e8a[_0xb3ac('0x4d')][_0xb3ac('0x4f')]],'buttons':null,'topic':_0x42592c['vidaooTopic'],'note':_['isNull'](_0x42592c['vidaooNote'])?null:getMustacheRender(_0x42592c[_0xb3ac('0x53')],_0x454e13),'metadata':null},'redirect':_0xb3ac('0x54'),'json':!![]};try{if(!_[_0xb3ac('0x55')](_0x42592c['vidaooMetadata'])){var _0x11f437=getMustacheRender(_0x42592c['vidaooMetadata'],_0x454e13);var _0x12877d=JSON[_0xb3ac('0x56')](_0x11f437);_0x495f2b[_0xb3ac('0x2e')][_0xb3ac('0x57')]=_0x12877d;}}catch(_0x4c2b7c){throw new db[(_0xb3ac('0x58'))][(_0xb3ac('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x495f2b);}else{throw new db[(_0xb3ac('0x58'))][(_0xb3ac('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xb3ac('0x17')](function(_0x2ffc33){_0x26d748=_0x2ffc33;if(_0x26d748['id']){var _0x52dd94={'body':_0x26d748['join_url'],'ChatWebsiteId':_0x42592c['id'],'ChatInteractionId':_0x408551['id'],'direction':'out','UserId':_0x178e8a['user']['id']};return db[_0xb3ac('0x5a')][_0xb3ac('0x44')](_0x52dd94,{});}else{throw new db[(_0xb3ac('0x58'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xb3ac('0x17')](function(){return _0x408551[_0xb3ac('0x5b')]({'vidaooSessionId':_0x26d748['id']});})[_0xb3ac('0x17')](respondWithResult(_0x56d61b,null))[_0xb3ac('0x20')](handleError(_0x56d61b,null));};exports[_0xb3ac('0x5c')]=function(_0x55d0db,_0x4d679d){if(_0x55d0db['body']['id']){delete _0x55d0db[_0xb3ac('0x2e')]['id'];}return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x55d0db[_0xb3ac('0x45')]['id']},'include':[{'model':db[_0xb3ac('0x5d')],'as':_0xb3ac('0x5e')}]})[_0xb3ac('0x17')](handleEntityNotFound(_0x4d679d,null))[_0xb3ac('0x17')](saveUpdates(_0x55d0db[_0xb3ac('0x2e')],null))[_0xb3ac('0x17')](respondWithResult(_0x4d679d,null))['catch'](handleError(_0x4d679d,null));};exports[_0xb3ac('0x5f')]=function(_0x3adcee,_0x43f19f){if(_0x3adcee[_0xb3ac('0x2e')]['id']){delete _0x3adcee[_0xb3ac('0x2e')]['id'];}return db[_0xb3ac('0x31')]['find']({'where':{'id':_0x3adcee[_0xb3ac('0x45')]['id']}})['then'](function(_0x3b8589){if(!_0x3b8589){logger[_0xb3ac('0x1d')](_0xb3ac('0x60'),'abandon',0x194,_0xb3ac('0x61'));_0x43f19f[_0xb3ac('0x21')](0x194);}else{if(_0x3b8589[_0xb3ac('0x62')]){throw new db[(_0xb3ac('0x58'))][(_0xb3ac('0x59'))](_0xb3ac('0x63'));}}return _0x3b8589;})[_0xb3ac('0x17')](function(_0x1967c2){if(_0x1967c2){return _0x1967c2[_0xb3ac('0x2a')]({'closed':_0x3adcee[_0xb3ac('0x2e')][_0xb3ac('0x64')],'disposition':_0x3adcee[_0xb3ac('0x2e')]['disposition']})[_0xb3ac('0x17')](function(_0x22a03a){return _0x22a03a;});}})[_0xb3ac('0x17')](function(){return respondWithRpcPromise('AbandonInteraction',_0xb3ac('0x5f'),_0x3adcee['body'],client9004);})[_0xb3ac('0x17')](respondWithResult(_0x43f19f,null))['catch'](handleError(_0x43f19f,null));};exports[_0xb3ac('0x65')]=function(_0x4ca5b3,_0xc6db11){_0x4ca5b3[_0xb3ac('0x2e')]['name']=_0x4ca5b3[_0xb3ac('0x66')][_0xb3ac('0x67')];_0x4ca5b3['body']['basename']=_0x4ca5b3[_0xb3ac('0x66')][_0xb3ac('0x68')];_0x4ca5b3['body']['type']=_0x4ca5b3[_0xb3ac('0x66')][_0xb3ac('0x69')];return db[_0xb3ac('0x6a')][_0xb3ac('0x44')](_0x4ca5b3['body'])['then'](respondWithResult(_0xc6db11,0xc9))[_0xb3ac('0x20')](handleError(_0xc6db11,null));};exports['attachmentDownload']=function(_0x42a3ac,_0x50006c){return db[_0xb3ac('0x31')][_0xb3ac('0x48')]({'where':{'id':_0x42a3ac['params']['id']},'raw':!![]})[_0xb3ac('0x17')](handleEntityNotFound(_0x50006c,null))['then'](function(_0x26a6be){if(_0x26a6be){if(_0x26a6be[_0xb3ac('0x64')]){return _0x50006c[_0xb3ac('0x22')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xb3ac('0x6a')][_0xb3ac('0x48')]({'where':{'id':_0x42a3ac['query']['attachId']},'raw':!![]})[_0xb3ac('0x17')](handleEntityNotFound(_0x50006c,null));}})['then'](function(_0x3e9d2b){if(_0x3e9d2b){var _0x1e0056=_0x3e9d2b[_0xb3ac('0x6b')]!==null;var _0x2c3271=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],'server/files/attachments/');if(_0x1e0056){_0x2c3271=path[_0xb3ac('0x6c')](_0x2c3271,'offline-chat/');}var _0x3a4acc=path[_0xb3ac('0x6c')](_0x2c3271,_0x3e9d2b['basename']);return _0x50006c[_0xb3ac('0x6e')](_0x3a4acc);}})['catch'](handleError(_0x50006c,null));};exports[_0xb3ac('0x6f')]=function(_0x23973b,_0x2c3af3){var _0x1b23c9=null;var _0x52811=null;var _0x1337fb=null;if(_0x23973b['body']['id']){delete _0x23973b[_0xb3ac('0x2e')]['id'];}if(_0x23973b[_0xb3ac('0x2e')][_0xb3ac('0x70')]){_0x1337fb=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],_0xb3ac('0x71'),util['format'](_0xb3ac('0x72'),Date[_0xb3ac('0x73')]()));_0x23973b[_0xb3ac('0x2e')]['pathTranscript']=_0x1337fb;}return db['ChatInteraction'][_0xb3ac('0x46')]({'where':{'id':_0x23973b[_0xb3ac('0x45')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb3ac('0x74'),'include':[{'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0x75')}]}]})[_0xb3ac('0x17')](handleEntityNotFound(_0x2c3af3,null))[_0xb3ac('0x17')](saveUpdates(_0x23973b[_0xb3ac('0x2e')],null))['then'](function(_0x31991c){if(_0x31991c){_0x1b23c9=_0x31991c;return db[_0xb3ac('0x49')][_0xb3ac('0x46')]({'where':{'id':_0x1b23c9[_0xb3ac('0x4a')]}});}})['then'](function(_0x27f1c4){if(_0x27f1c4){_0x52811=_0x27f1c4;return db[_0xb3ac('0x5d')][_0xb3ac('0x46')]({'where':{'id':_0x1b23c9[_0xb3ac('0x76')]}});}})[_0xb3ac('0x17')](function(_0x2579df){if(_0x2579df){if(_0x1337fb){var _0x5e5a37=null;for(var _0x3729dc=0x1;_0x3729dc<_0x1b23c9['Messages'][_0xb3ac('0x40')];++_0x3729dc){_0x5e5a37=_0x1b23c9[_0xb3ac('0x74')][_0x3729dc];var _0x198853=_0x5e5a37[_0xb3ac('0x62')]?util[_0xb3ac('0x77')](_0xb3ac('0x78'),_0x52811[_0xb3ac('0x79')],_0x5e5a37[_0xb3ac('0x62')]):_0xb3ac('0x7a');var _0x44a6b3=_0x23973b[_0xb3ac('0x2e')]['customer']||util[_0xb3ac('0x77')]('%s%d',_0xb3ac('0x7b'),_0x5e5a37[_0xb3ac('0x76')]);switch(_0x52811[_0xb3ac('0x7c')]){case _0xb3ac('0x7d'):_0x198853=_0x5e5a37[_0xb3ac('0x62')]?util[_0xb3ac('0x77')](_0xb3ac('0x78'),_0x52811[_0xb3ac('0x79')],_0x5e5a37[_0xb3ac('0x62')]):_0xb3ac('0x7a');break;case _0xb3ac('0x7e'):_0x198853=_0x5e5a37['UserId']?_0x5e5a37[_0xb3ac('0x75')]['alias']||_0x5e5a37[_0xb3ac('0x75')]['fullname']:_0xb3ac('0x7a');break;case _0xb3ac('0x7f'):_0x198853=_0x5e5a37[_0xb3ac('0x62')]?_0x5e5a37[_0xb3ac('0x75')][_0xb3ac('0x4e')]:_0xb3ac('0x7a');break;default:_0x198853=_0x5e5a37[_0xb3ac('0x62')]?util['format'](_0xb3ac('0x78'),_0x52811[_0xb3ac('0x79')],_0x5e5a37['UserId']):_0xb3ac('0x7a');}var _0x37d8bf=util[_0xb3ac('0x77')](_0xb3ac('0x80'),moment(_0x5e5a37[_0xb3ac('0x81')])[_0xb3ac('0x77')](_0xb3ac('0x82')),_0x5e5a37[_0xb3ac('0x83')]==='in'?_0x44a6b3:_0x198853,_0x5e5a37['body']);if(!_0x5e5a37[_0xb3ac('0x84')]){fs[_0xb3ac('0x85')](_0x1337fb,_0x37d8bf);}}return db[_0xb3ac('0x86')][_0xb3ac('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0xb3ac('0x87')],'as':_0xb3ac('0x88'),'raw':!![],'include':[{'model':db[_0xb3ac('0x89')],'as':_0xb3ac('0x89'),'raw':!![]}]}]});}}})['then'](function(_0x1774c8){if(!_0x1774c8||!_0x1774c8[_0xb3ac('0x88')]||!_0x23973b['body'])return _0x1b23c9;var _0x132788=_0x1774c8[_0xb3ac('0x8a')]();return respondWithRpcPromise(_0xb3ac('0x8b'),'sendMail',{'account':_0x132788,'message':{'from':util[_0xb3ac('0x77')](_0xb3ac('0x8c'),_0x1774c8[_0xb3ac('0x2d')],_0x1774c8['email']||_0x1774c8[_0xb3ac('0x88')][_0xb3ac('0x4d')]),'to':_0x23973b['body'][_0xb3ac('0x70')],'subject':_0xb3ac('0x8d'),'text':util[_0xb3ac('0x77')](_0xb3ac('0x8e'),_0x23973b[_0xb3ac('0x2e')]['mailTranscript']),'attachments':[{'path':_0x1337fb}]}})[_0xb3ac('0x17')](function(){return _0x1b23c9;})[_0xb3ac('0x20')](function(_0x344255){logger['error'](_0x344255);});})[_0xb3ac('0x17')](respondWithStatusCode(_0x2c3af3,0xc8))[_0xb3ac('0x20')](handleError(_0x2c3af3,null));};exports[_0xb3ac('0x8f')]=function(_0x1518fb,_0x4cd2b7){return db['ChatMessage']['find']({'where':{'id':_0x1518fb[_0xb3ac('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cd2b7,null))[_0xb3ac('0x17')](function(_0x3976db){if(_0x3976db){return _0x3976db[_0xb3ac('0x8f')](_0x1518fb[_0xb3ac('0x2e')][_0xb3ac('0x90')],_[_0xb3ac('0x91')](_0x1518fb[_0xb3ac('0x2e')],[_0xb3ac('0x90'),'id'])||{});}})[_0xb3ac('0x17')](respondWithResult(_0x4cd2b7,null))[_0xb3ac('0x20')](handleError(_0x4cd2b7,null));};exports['getMessages']=function(_0x5d23b6,_0x2896f1){var _0xfc9245={'raw':![],'where':{}};var _0x125d90={};var _0x57ebc1={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb3ac('0x48')]({'where':{'id':_0x5d23b6[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x2896f1,null))['then'](function(_0x372480){if(_0x372480){_0x125d90['model']=_[_0xb3ac('0x3b')](db[_0xb3ac('0x5a')][_0xb3ac('0x32')]);_0x125d90[_0xb3ac('0x3a')]=_[_0xb3ac('0x3b')](_0x5d23b6[_0xb3ac('0x3a')]);_0x125d90[_0xb3ac('0x3c')]=_[_0xb3ac('0x3d')](_0x125d90[_0xb3ac('0x39')],_0x125d90[_0xb3ac('0x3a')]);_0xfc9245[_0xb3ac('0x3e')]=_[_0xb3ac('0x3d')](_0x125d90[_0xb3ac('0x39')],qs[_0xb3ac('0x3f')](_0x5d23b6[_0xb3ac('0x3a')]['fields']));_0xfc9245[_0xb3ac('0x3e')]=_0xfc9245[_0xb3ac('0x3e')][_0xb3ac('0x40')]?_0xfc9245[_0xb3ac('0x3e')]:_0x125d90[_0xb3ac('0x39')];if(!_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x92')](_0xb3ac('0x93'))){_0xfc9245['limit']=qs[_0xb3ac('0x26')](_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x26')]);_0xfc9245[_0xb3ac('0x24')]=qs[_0xb3ac('0x24')](_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x24')]);}_0xfc9245['order']=qs[_0xb3ac('0x94')](_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x94')]);_0xfc9245['where']=qs['filters'](_[_0xb3ac('0x95')](_0x5d23b6[_0xb3ac('0x3a')],_0x125d90['filters']));_0xfc9245[_0xb3ac('0x96')][_0xb3ac('0x97')]=_0x372480['id'];if(_0x5d23b6[_0xb3ac('0x3a')]['filter']){_0xfc9245[_0xb3ac('0x96')]=_[_0xb3ac('0x42')](_0xfc9245[_0xb3ac('0x96')],{'$or':_[_0xb3ac('0x30')](_0xfc9245[_0xb3ac('0x3e')],function(_0x1c6c41){var _0x21a76b={};_0x21a76b[_0x1c6c41]={'$like':'%'+_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x98')]+'%'};return _0x21a76b;})});}if(_0x5d23b6[_0xb3ac('0x3a')][_0xb3ac('0x99')]){var _0x4d1113=_0x5d23b6[_0xb3ac('0x3a')]['$gte'][_0xb3ac('0x9a')](',');var _0x5f37bb={};_0x5f37bb[_0x4d1113[0x0]]={'$gte':moment(_0x4d1113[0x1])[_0xb3ac('0x77')](_0xb3ac('0x9b'))};_0xfc9245[_0xb3ac('0x96')]=_['merge'](_0xfc9245[_0xb3ac('0x96')],_0x5f37bb);}_0xfc9245=_[_0xb3ac('0x42')]({},_0xfc9245,_0x5d23b6[_0xb3ac('0x43')]);return db[_0xb3ac('0x5a')][_0xb3ac('0x27')]({'where':_0xfc9245[_0xb3ac('0x96')]})[_0xb3ac('0x17')](function(_0x5828f5){_0x57ebc1['count']=_0x5828f5;if(_0x5d23b6['query']['includeAll']){_0xfc9245['include']=[{'all':!![]}];}return db[_0xb3ac('0x5a')]['findAll'](_0xfc9245);})[_0xb3ac('0x17')](function(_0x1a5bb4){_0x57ebc1['rows']=_0x1a5bb4;return _0x57ebc1;});}})[_0xb3ac('0x17')](respondWithFilteredResult(_0x2896f1,_0xfc9245))[_0xb3ac('0x20')](handleError(_0x2896f1,null));};exports[_0xb3ac('0x9c')]=function(_0x20e8e6,_0x539907){var _0x1f5bb2={'where':{}},_0x538f83={},_0x2eb1d5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb3ac('0x48')]({'where':{'id':_0x20e8e6[_0xb3ac('0x45')]['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x539907,null))['then'](function(_0xb0e600){if(_0xb0e600){_0x538f83[_0xb3ac('0x39')]=_['keys'](db[_0xb3ac('0x5a')][_0xb3ac('0x32')]);_0x538f83[_0xb3ac('0x3a')]=_[_0xb3ac('0x3b')](_0x20e8e6[_0xb3ac('0x3a')]);_0x538f83[_0xb3ac('0x3c')]=_[_0xb3ac('0x3d')](_0x538f83[_0xb3ac('0x39')],_0x538f83[_0xb3ac('0x3a')]);_0x1f5bb2['attributes']=_[_0xb3ac('0x3d')](_0x538f83[_0xb3ac('0x39')],qs['fields'](_0x20e8e6[_0xb3ac('0x3a')][_0xb3ac('0x3f')]));_0x1f5bb2['attributes']=_0x1f5bb2[_0xb3ac('0x3e')][_0xb3ac('0x40')]?_0x1f5bb2['attributes']:_0x538f83['model'];if(!_0x20e8e6[_0xb3ac('0x3a')]['hasOwnProperty'](_0xb3ac('0x93'))){_0x1f5bb2[_0xb3ac('0x26')]=qs['limit'](_0x20e8e6['query']['limit']);_0x1f5bb2[_0xb3ac('0x24')]=qs[_0xb3ac('0x24')](_0x20e8e6['query'][_0xb3ac('0x24')]);}_0x1f5bb2[_0xb3ac('0x9d')]=qs[_0xb3ac('0x94')](_0x20e8e6['query']['sort']);_0x1f5bb2[_0xb3ac('0x96')]=qs['filters'](_[_0xb3ac('0x95')](_0x20e8e6['query'],_0x538f83[_0xb3ac('0x3c')]));_0x1f5bb2[_0xb3ac('0x96')][_0xb3ac('0x97')]=_0xb0e600['id'];if(_0x20e8e6[_0xb3ac('0x3a')][_0xb3ac('0x98')]){_0x1f5bb2['where']=_[_0xb3ac('0x42')](_0x1f5bb2[_0xb3ac('0x96')],{'$or':_[_0xb3ac('0x30')](_0x1f5bb2[_0xb3ac('0x3e')],function(_0x4a6db7){var _0x17a267={};_0x17a267[_0x4a6db7]={'$like':'%'+_0x20e8e6['query'][_0xb3ac('0x98')]+'%'};return _0x17a267;})});}_0x1f5bb2['where'][_0xb3ac('0x84')]=![];if(_0x20e8e6['query']['id']){_0x1f5bb2[_0xb3ac('0x96')]['id']={'$gt':_0x20e8e6[_0xb3ac('0x3a')]['id']};}_0x1f5bb2=_['merge']({},_0x1f5bb2,_0x20e8e6['options']);return db['ChatMessage'][_0xb3ac('0x27')]({'where':_0x1f5bb2[_0xb3ac('0x96')]})[_0xb3ac('0x17')](function(_0x1b8dbb){_0x2eb1d5[_0xb3ac('0x27')]=_0x1b8dbb;_0x1f5bb2[_0xb3ac('0x41')]=[];if(_0x20e8e6['query'][_0xb3ac('0x9e')]){_0x1f5bb2[_0xb3ac('0x41')][_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0x75'),'attributes':['id','fullname','alias']});}if(_0x20e8e6[_0xb3ac('0x3a')]['includeAll']){_0x1f5bb2['include']=[{'all':!![]}];}return db[_0xb3ac('0x5a')][_0xb3ac('0x36')](_0x1f5bb2);})[_0xb3ac('0x17')](function(_0x38dedd){_0x2eb1d5[_0xb3ac('0xa0')]=_0x38dedd;return _0x2eb1d5;});}})[_0xb3ac('0x17')](respondWithFilteredResult(_0x539907,_0x1f5bb2))['catch'](handleError(_0x539907,null));};exports[_0xb3ac('0xa1')]=function(_0x456e3c,_0x5975b2){return db[_0xb3ac('0x31')]['find']({'where':{'id':_0x456e3c['params']['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x5975b2,null))['then'](function(_0x25d731){if(_0x25d731){return _0x25d731[_0xb3ac('0xa2')](_0x456e3c[_0xb3ac('0x2e')][_0xb3ac('0x90')],_[_0xb3ac('0x91')](_0x456e3c['body'],['ids','id'])||{})[_0xb3ac('0xa3')](function(){return db[_0xb3ac('0xa4')][_0xb3ac('0x36')]({'attributes':['id',_0xb3ac('0x2d'),_0xb3ac('0xa5')],'where':{'id':_0x456e3c[_0xb3ac('0x2e')][_0xb3ac('0x90')]}});})[_0xb3ac('0x17')](function(_0x40c627){socket[_0xb3ac('0xa6')](_0xb3ac('0xa7'),{'id':Number(_0x456e3c[_0xb3ac('0x45')]['id']),'tags':_0x40c627||[]});return{'id':Number(_0x456e3c[_0xb3ac('0x45')]['id']),'tags':_0x40c627||[]};});}})[_0xb3ac('0x17')](respondWithResult(_0x5975b2,null))[_0xb3ac('0x20')](handleError(_0x5975b2,null));};exports[_0xb3ac('0xa8')]=function(_0x278530,_0x4848cc){return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x278530['params']['id']}})[_0xb3ac('0x17')](handleEntityNotFound(_0x4848cc,null))[_0xb3ac('0x17')](function(_0x562411){if(_0x562411){return _0x562411['removeTags'](_0x278530[_0xb3ac('0x3a')][_0xb3ac('0x90')]);}})[_0xb3ac('0x17')](respondWithStatusCode(_0x4848cc,null))[_0xb3ac('0x20')](handleError(_0x4848cc,null));};exports[_0xb3ac('0x6e')]=function(_0x4114bb,_0x1cc0f2){var _0xcb9495=moment()[_0xb3ac('0xa9')]()['toString']();var _0x48c21e=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],'server',_0xb3ac('0xaa'),_0xb3ac('0xab'));var _0x32dc8d=path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],'server','files',_0xb3ac('0xac'));var _0x1f7118=path[_0xb3ac('0x6c')](_0x48c21e,_0xcb9495);var _0x30a678=util['format'](_0xb3ac('0xad'),_0x4114bb['params']['id'],_0xcb9495);var _0x3ad17f=path[_0xb3ac('0x6c')](_0x48c21e,_0x30a678);var _0x220b35=[];_0x220b35[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x220b35[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x5d')],'as':_0xb3ac('0x5e'),'attributes':['id',_0xb3ac('0xae'),_0xb3ac('0xaf')],'raw':!![]});if(_0x4114bb[_0xb3ac('0x3a')][_0xb3ac('0xac')]){_0x220b35[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x6a')],'as':_0xb3ac('0x6a'),'raw':!![]});}var _0x2d3f7a=[{'model':db[_0xb3ac('0x5a')],'as':_0xb3ac('0x74'),'attributes':['id',_0xb3ac('0x2e'),_0xb3ac('0x81'),_0xb3ac('0x83'),_0xb3ac('0x84'),_0xb3ac('0xb0')],'include':_0x220b35}];_0x2d3f7a['push']({'model':db[_0xb3ac('0x49')],'as':_0xb3ac('0xb1'),'attributes':['id',_0xb3ac('0x2d')]});_0x2d3f7a[_0xb3ac('0x9f')]({'model':db[_0xb3ac('0x75')],'as':_0xb3ac('0xb2'),'attributes':['id',_0xb3ac('0x4e')]});return db[_0xb3ac('0x31')][_0xb3ac('0x46')]({'where':{'id':_0x4114bb[_0xb3ac('0x45')]['id']},'include':_0x2d3f7a})[_0xb3ac('0x17')](handleEntityNotFound(_0x1cc0f2,null))[_0xb3ac('0x17')](function(_0x442b98){if(_0x442b98){var _0x223ee9=_0x442b98[_0xb3ac('0xb3')]({'plain':!![]});fs['mkdirSync'](_0x1f7118);var _0x426b1d={'channel':_0xb3ac('0xb4'),'account':_0x223ee9['Account'][_0xb3ac('0x2d')],'agent':_0x223ee9[_0xb3ac('0xb2')]?_0x223ee9[_0xb3ac('0xb2')][_0xb3ac('0x4e')]:_0xb3ac('0xb5'),'createdAt':moment(_0x223ee9[_0xb3ac('0x81')])[_0xb3ac('0x77')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb3ac('0xb6')](),'closedAt':_0x223ee9[_0xb3ac('0x64')]?moment(_0x223ee9[_0xb3ac('0xb7')])['format'](_0xb3ac('0x9b'))[_0xb3ac('0xb6')]():'','disposition':_0x223ee9['disposition'],'chatInfo':{'browser':_0x223ee9[_0xb3ac('0xb8')],'os':_0x223ee9[_0xb3ac('0xb9')],'referer':_0x223ee9[_0xb3ac('0xba')],'customerIp':_0x223ee9[_0xb3ac('0xbb')],'customerPort':_0x223ee9[_0xb3ac('0xbc')]?_0x223ee9[_0xb3ac('0xbc')]:_0xb3ac('0xb5')},'messages':_(_0x223ee9['Messages'])[_0xb3ac('0xbd')]()[_0xb3ac('0x98')]({'secret':![]})[_0xb3ac('0x30')](function(_0x50cb12){if(_0x50cb12[_0xb3ac('0x6a')]){var _0x3c5c85=path[_0xb3ac('0x6c')](_0x32dc8d,_0x50cb12['Attachment']['basename']);if(fs['existsSync'](_0x3c5c85)){fs['createReadStream'](_0x3c5c85)['pipe'](fs[_0xb3ac('0xbe')](path[_0xb3ac('0x6c')](_0x1f7118,_0x50cb12[_0xb3ac('0x6a')]['basename'])));}}return{'date':moment(_0x50cb12[_0xb3ac('0x81')])['format'](_0xb3ac('0x9b'))[_0xb3ac('0xb6')](),'sender':_0x50cb12['direction']===_0xb3ac('0xbf')?_0x50cb12['User']?_0x50cb12[_0xb3ac('0x75')]['fullname']:'System':_0x50cb12[_0xb3ac('0x5e')][_0xb3ac('0xae')]+(_0x50cb12['Contact'][_0xb3ac('0xaf')]?'\x20'+_0x50cb12['Contact'][_0xb3ac('0xaf')]:''),'body':_0x50cb12[_0xb3ac('0x6a')]?_0x50cb12[_0xb3ac('0x6a')][_0xb3ac('0xc0')]:_0x50cb12['body'],'direction':_0x50cb12['direction']===_0xb3ac('0xbf')?'A':'C','secret':_0x50cb12[_0xb3ac('0x84')],'read':_0x50cb12[_0xb3ac('0xb0')],'attachment':_0x50cb12['Attachment']};})[_0xb3ac('0xc1')]()};return ejs['renderFile'](path[_0xb3ac('0x6c')](config[_0xb3ac('0x6d')],_0xb3ac('0xc2'),_0xb3ac('0xc3'),_0xb3ac('0xc4')),{'interaction':_0x426b1d})[_0xb3ac('0x17')](function(_0x268a55){var _0xc23090=path['join'](_0x1f7118,_0xb3ac('0xc5')+_0x223ee9['id']+'-'+_0xcb9495+_0xb3ac('0xc6'));var _0x54bf2c={'path':_0xc23090,'channel':_0xb3ac('0xb4'),'interactionId':_0x223ee9['id']};return pdf[_0xb3ac('0xc7')](_0x268a55,_0x54bf2c);})[_0xb3ac('0x17')](function(){return new Promise(function(_0x19c6f6,_0x1fa70b){zipdir(_0x1f7118,{'saveTo':_0x3ad17f},function(_0x52b735,_0x2599da){if(_0x52b735)return _0x1fa70b(_0x52b735);return _0x19c6f6(_0x2599da);});})['then'](function(){return new BPromise(function(_0x4dbe77,_0x545f41){rimraf(_0x1f7118,function(_0x2d7a6a){if(_0x2d7a6a)_0x545f41(_0x2d7a6a);return _0x4dbe77();});});})[_0xb3ac('0x17')](function(){return _0x1cc0f2[_0xb3ac('0x6e')](_0x3ad17f,_0x30a678,function(_0x2871a9){if(_0x2871a9){logger[_0xb3ac('0x1d')](_0xb3ac('0xc8'),_0x2871a9);}else{fs['unlinkSync'](_0x3ad17f);}});});});}else{return _0x1cc0f2[_0xb3ac('0x21')](0xc8);}})[_0xb3ac('0x20')](handleError(_0x1cc0f2,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d289eb7..49ab354 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 _0x8b21=['then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers'];(function(_0x14aec5,_0x3d93f5){var _0x3f0d77=function(_0x5af2d5){while(--_0x5af2d5){_0x14aec5['push'](_0x14aec5['shift']());}};_0x3f0d77(++_0x3d93f5);}(_0x8b21,0x1a2));var _0x18b2=function(_0x3cb11d,_0x1d44bd){_0x3cb11d=_0x3cb11d-0x0;var _0x3e2c4c=_0x8b21[_0x3cb11d];return _0x3e2c4c;};'use strict';var EventEmitter=require(_0x18b2('0x0'));var ChatInteraction=require(_0x18b2('0x1'))['db'][_0x18b2('0x2')];var ChatMessage=require(_0x18b2('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x18b2('0x3')](0x0);var events={'afterCreate':_0x18b2('0x4'),'afterUpdate':_0x18b2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41976f){return function(_0xbdb845,_0x46aa1a,_0x3006d7){_0xbdb845[_0x18b2('0x6')]({'attributes':['id'],'raw':!![]})[_0x18b2('0x7')](function(_0x5f31d9){_0xbdb845[_0x18b2('0x8')](_0x18b2('0x9'),_0x5f31d9[_0x18b2('0xa')](function(_0x28a7d4){return{'id':_0x28a7d4['id']};}));return ChatMessage[_0x18b2('0xb')]({'where':{'ChatInteractionId':_0xbdb845['id'],'direction':'in','read':![]},'raw':!![]});})[_0x18b2('0x7')](function(_0x4f5d8f){_0xbdb845['setDataValue']('unreadMessages',_0x4f5d8f[_0x18b2('0xc')]);ChatInteractionEvents[_0x18b2('0xd')](_0x41976f+':'+_0xbdb845['id'],_0xbdb845);ChatInteractionEvents[_0x18b2('0xd')](_0x41976f,_0xbdb845);_0x3006d7(null);})[_0x18b2('0xe')](_0x3006d7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x18b2('0xf')](e,emitEvent(event));}}module[_0x18b2('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xbabf=['map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','setDataValue'];(function(_0x40a726,_0x1664ff){var _0x3bcb60=function(_0x11aadd){while(--_0x11aadd){_0x40a726['push'](_0x40a726['shift']());}};_0x3bcb60(++_0x1664ff);}(_0xbabf,0xbd));var _0xfbab=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbabf[_0xc4001c];return _0x49f7bc;};'use strict';var EventEmitter=require(_0xfbab('0x0'));var ChatInteraction=require(_0xfbab('0x1'))['db'][_0xfbab('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xfbab('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfbab('0x4')](0x0);var events={'afterCreate':_0xfbab('0x5'),'afterUpdate':'update','afterDestroy':_0xfbab('0x6')};function emitEvent(_0x4138e7){return function(_0x5ccf8d,_0x257411,_0x4a39b4){_0x5ccf8d[_0xfbab('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x178932){_0x5ccf8d[_0xfbab('0x8')]('Users',_0x178932[_0xfbab('0x9')](function(_0x2182ce){return{'id':_0x2182ce['id']};}));return ChatMessage[_0xfbab('0xa')]({'where':{'ChatInteractionId':_0x5ccf8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfbab('0xb')](function(_0x2226bb){_0x5ccf8d['setDataValue']('unreadMessages',_0x2226bb[_0xfbab('0xc')]);ChatInteractionEvents['emit'](_0x4138e7+':'+_0x5ccf8d['id'],_0x5ccf8d);ChatInteractionEvents[_0xfbab('0xd')](_0x4138e7,_0x5ccf8d);_0x4a39b4(null);})[_0xfbab('0xe')](_0x4a39b4(null));};}for(var e in events){if(events[_0xfbab('0xf')](e)){var event=events[e];ChatInteraction[_0xfbab('0x10')](e,emitEvent(event));}}module[_0xfbab('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1329a12..a80d4eb 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 _0x01f2=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x23069e,_0x2cfdb4){var _0x47649c=function(_0x14df37){while(--_0x14df37){_0x23069e['push'](_0x23069e['shift']());}};_0x47649c(++_0x2cfdb4);}(_0x01f2,0x111));var _0x201f=function(_0x440496,_0x49e03b){_0x440496=_0x440496-0x0;var _0x444630=_0x01f2[_0x440496];return _0x444630;};'use strict';var _=require(_0x201f('0x0'));var util=require(_0x201f('0x1'));var logger=require('../../config/logger')(_0x201f('0x2'));var moment=require(_0x201f('0x3'));var BPromise=require(_0x201f('0x4'));var rp=require(_0x201f('0x5'));var fs=require('fs');var path=require(_0x201f('0x6'));var rimraf=require('rimraf');var config=require(_0x201f('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x201f('0x8')]=function(_0x3a1db2,_0x38546d){return _0x3a1db2[_0x201f('0x9')](_0x201f('0xa'),attributes,{'tableName':_0x201f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb5d654,_0x430c14,_0x51c774){if(_0xb5d654[_0x201f('0xc')](_0x201f('0xd'))){_0xb5d654[_0x201f('0xe')]=moment()[_0x201f('0xf')](_0x201f('0x10'));}_0x51c774(null,_0xb5d654);}},'charset':_0x201f('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x11b2=['rimraf','../../config/environment','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x11b2,0x1a2));var _0x211b=function(_0x512363,_0x44048d){_0x512363=_0x512363-0x0;var _0x38d1fd=_0x11b2[_0x512363];return _0x38d1fd;};'use strict';var _=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var logger=require(_0x211b('0x2'))('api');var moment=require(_0x211b('0x3'));var BPromise=require(_0x211b('0x4'));var rp=require(_0x211b('0x5'));var fs=require('fs');var path=require(_0x211b('0x6'));var rimraf=require(_0x211b('0x7'));var config=require(_0x211b('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x211b('0x9')]=function(_0x4ca473,_0x46795f){return _0x4ca473[_0x211b('0xa')](_0x211b('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x95ea11,_0x583e18,_0x33d673){if(_0x95ea11[_0x211b('0xc')](_0x211b('0xd'))){_0x95ea11[_0x211b('0xe')]=moment()['format'](_0x211b('0xf'));}_0x33d673(null,_0x95ea11);}},'charset':_0x211b('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 47513c8..c1e1c87 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 _0x4620=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','options','raw','attributes','UpdateChatInteraction','debug','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','randomstring'];(function(_0x21a268,_0x57219b){var _0x573dfb=function(_0x36372b){while(--_0x36372b){_0x21a268['push'](_0x21a268['shift']());}};_0x573dfb(++_0x57219b);}(_0x4620,0x78));var _0x0462=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x4620[_0x11ca63];return _0x41f1f6;};'use strict';var _=require('lodash');var util=require(_0x0462('0x0'));var moment=require(_0x0462('0x1'));var BPromise=require('bluebird');var rs=require(_0x0462('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0462('0x3'))['db'];var utils=require(_0x0462('0x4'));var logger=require(_0x0462('0x5'))(_0x0462('0x6'));var config=require(_0x0462('0x7'));var jayson=require(_0x0462('0x8'));var client=jayson[_0x0462('0x9')][_0x0462('0xa')]({'port':0x232a});config[_0x0462('0xb')]=_[_0x0462('0xc')](config[_0x0462('0xb')],{'host':_0x0462('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0462('0xe'))['register'](socket);function respondWithRpcPromise(_0x1b7a38,_0x53c6e8,_0x1138fa){return new BPromise(function(_0x1b57a5,_0xa88c21){return client[_0x0462('0xf')](_0x1b7a38,_0x1138fa)[_0x0462('0x10')](function(_0x28f95f){logger[_0x0462('0x11')](_0x0462('0x12'),_0x53c6e8,_0x0462('0x13'));logger['debug'](_0x0462('0x14'),_0x53c6e8,'request\x20sent',JSON[_0x0462('0x15')](_0x28f95f));if(_0x28f95f[_0x0462('0x16')]){if(_0x28f95f[_0x0462('0x16')][_0x0462('0x17')]===0x1f4){logger[_0x0462('0x16')](_0x0462('0x12'),_0x53c6e8,_0x28f95f['error'][_0x0462('0x18')]);return _0xa88c21(_0x28f95f[_0x0462('0x16')][_0x0462('0x18')]);}logger[_0x0462('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x53c6e8,_0x28f95f[_0x0462('0x16')][_0x0462('0x18')]);return _0x1b57a5(_0x28f95f[_0x0462('0x16')][_0x0462('0x18')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x53c6e8,'request\x20sent');_0x1b57a5(_0x28f95f[_0x0462('0x19')]['message']);}})[_0x0462('0x1a')](function(_0x4db2a1){logger[_0x0462('0x16')](_0x0462('0x12'),_0x53c6e8,_0x4db2a1);_0xa88c21(_0x4db2a1);});});}exports['UpdateChatInteraction']=function(_0x465259){var _0x4bfc39=this;return new Promise(function(_0x4a6cce,_0x278cf3){return db[_0x0462('0x1b')]['update'](_0x465259['body'],{'raw':_0x465259[_0x0462('0x1c')]?_0x465259[_0x0462('0x1c')][_0x0462('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x465259['options']?_0x465259[_0x0462('0x1c')]['where']||null:null,'attributes':_0x465259[_0x0462('0x1c')]?_0x465259['options'][_0x0462('0x1e')]||null:null,'limit':_0x465259[_0x0462('0x1c')]?_0x465259[_0x0462('0x1c')]['limit']||null:null})['then'](function(_0x4aab7c){logger[_0x0462('0x11')](_0x0462('0x1f'),_0x465259);logger[_0x0462('0x20')](_0x0462('0x1f'),_0x465259,JSON[_0x0462('0x15')](_0x4aab7c));_0x4a6cce(_0x4aab7c);})['catch'](function(_0x5ee94c){logger[_0x0462('0x16')]('UpdateChatInteraction',_0x5ee94c['message'],_0x465259);_0x278cf3(_0x4bfc39[_0x0462('0x16')](0x1f4,_0x5ee94c['message']));});});};exports[_0x0462('0x21')]=function(_0x1ad819){return new Promise(function(_0x5e640a,_0x3cab5a){return db[_0x0462('0x1b')][_0x0462('0x22')]({'where':_0x1ad819[_0x0462('0x1c')]?_0x1ad819[_0x0462('0x1c')][_0x0462('0x23')]||null:null})['then'](function(_0x276305){if(_0x276305){return _0x276305[_0x0462('0x24')](_0x1ad819['body'][_0x0462('0x25')],_[_0x0462('0x26')](_0x1ad819['body'],[_0x0462('0x25'),'id'])||{});}})[_0x0462('0x27')](function(_0x446eb0){logger[_0x0462('0x11')](_0x0462('0x28'),_0x1ad819);logger[_0x0462('0x20')]('AddTags',_0x1ad819,JSON[_0x0462('0x15')](_0x446eb0));_0x5e640a(_0x446eb0);})[_0x0462('0x1a')](function(_0x178db6){logger[_0x0462('0x16')]('AddTags',_0x178db6[_0x0462('0x18')],_0x1ad819);_0x3cab5a(_this[_0x0462('0x16')](0x1f4,_0x178db6[_0x0462('0x18')]));});});}; \ No newline at end of file +var _0xebce=['register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','attributes','limit','AddTagsToChatInteraction','find','where','body','omit','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x49c481,_0x1f5ec5){var _0x58e5d3=function(_0x5f090d){while(--_0x5f090d){_0x49c481['push'](_0x49c481['shift']());}};_0x58e5d3(++_0x1f5ec5);}(_0xebce,0x118));var _0xeebc=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0xebce[_0x4a77e4];return _0x1c68d8;};'use strict';var _=require('lodash');var util=require(_0xeebc('0x0'));var moment=require(_0xeebc('0x1'));var BPromise=require(_0xeebc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeebc('0x3'));var db=require(_0xeebc('0x4'))['db'];var utils=require(_0xeebc('0x5'));var logger=require(_0xeebc('0x6'))('rpc');var config=require(_0xeebc('0x7'));var jayson=require(_0xeebc('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xeebc('0x9')]=_[_0xeebc('0xa')](config['redis'],{'host':_0xeebc('0xb'),'port':0x18eb});var socket=require(_0xeebc('0xc'))(new Redis(config[_0xeebc('0x9')]));require(_0xeebc('0xd'))[_0xeebc('0xe')](socket);function respondWithRpcPromise(_0x49286d,_0x3e8cfa,_0x4f22aa){return new BPromise(function(_0x52bd87,_0x56a0be){return client[_0xeebc('0xf')](_0x49286d,_0x4f22aa)[_0xeebc('0x10')](function(_0x20cf3c){logger[_0xeebc('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x3e8cfa,_0xeebc('0x12'));logger[_0xeebc('0x13')](_0xeebc('0x14'),_0x3e8cfa,_0xeebc('0x12'),JSON[_0xeebc('0x15')](_0x20cf3c));if(_0x20cf3c[_0xeebc('0x16')]){if(_0x20cf3c['error'][_0xeebc('0x17')]===0x1f4){logger[_0xeebc('0x16')](_0xeebc('0x18'),_0x3e8cfa,_0x20cf3c[_0xeebc('0x16')][_0xeebc('0x19')]);return _0x56a0be(_0x20cf3c[_0xeebc('0x16')]['message']);}logger['error'](_0xeebc('0x18'),_0x3e8cfa,_0x20cf3c[_0xeebc('0x16')][_0xeebc('0x19')]);return _0x52bd87(_0x20cf3c[_0xeebc('0x16')]['message']);}else{logger[_0xeebc('0x11')](_0xeebc('0x18'),_0x3e8cfa,_0xeebc('0x12'));_0x52bd87(_0x20cf3c[_0xeebc('0x1a')]['message']);}})[_0xeebc('0x1b')](function(_0x232845){logger[_0xeebc('0x16')](_0xeebc('0x18'),_0x3e8cfa,_0x232845);_0x56a0be(_0x232845);});});}exports[_0xeebc('0x1c')]=function(_0x428830){var _0x385395=this;return new Promise(function(_0x3c702f,_0x2c1acc){return db[_0xeebc('0x1d')][_0xeebc('0x1e')](_0x428830['body'],{'raw':_0x428830[_0xeebc('0x1f')]?_0x428830['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x428830[_0xeebc('0x1f')]?_0x428830['options']['where']||null:null,'attributes':_0x428830['options']?_0x428830['options'][_0xeebc('0x20')]||null:null,'limit':_0x428830[_0xeebc('0x1f')]?_0x428830[_0xeebc('0x1f')][_0xeebc('0x21')]||null:null})[_0xeebc('0x10')](function(_0x5ed569){logger[_0xeebc('0x11')](_0xeebc('0x1c'),_0x428830);logger['debug'](_0xeebc('0x1c'),_0x428830,JSON['stringify'](_0x5ed569));_0x3c702f(_0x5ed569);})[_0xeebc('0x1b')](function(_0x41c2b3){logger['error'](_0xeebc('0x1c'),_0x41c2b3[_0xeebc('0x19')],_0x428830);_0x2c1acc(_0x385395[_0xeebc('0x16')](0x1f4,_0x41c2b3[_0xeebc('0x19')]));});});};exports[_0xeebc('0x22')]=function(_0x37600c){return new Promise(function(_0x4f231c,_0x162244){return db[_0xeebc('0x1d')][_0xeebc('0x23')]({'where':_0x37600c[_0xeebc('0x1f')]?_0x37600c[_0xeebc('0x1f')][_0xeebc('0x24')]||null:null})[_0xeebc('0x10')](function(_0xa687fb){if(_0xa687fb){return _0xa687fb['addTags'](_0x37600c[_0xeebc('0x25')]['ids'],_[_0xeebc('0x26')](_0x37600c['body'],[_0xeebc('0x27'),'id'])||{});}})[_0xeebc('0x28')](function(_0xb1ad6b){logger[_0xeebc('0x11')]('AddTags',_0x37600c);logger['debug'](_0xeebc('0x29'),_0x37600c,JSON['stringify'](_0xb1ad6b));_0x4f231c(_0xb1ad6b);})[_0xeebc('0x1b')](function(_0x3850eb){logger['error'](_0xeebc('0x29'),_0x3850eb[_0xeebc('0x19')],_0x37600c);_0x162244(_this[_0xeebc('0x16')](0x1f4,_0x3850eb[_0xeebc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 47c2df6..d782db7 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 _0xfb31=['save','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x1a1e44,_0x502559){var _0x1caa60=function(_0x196636){while(--_0x196636){_0x1a1e44['push'](_0x1a1e44['shift']());}};_0x1caa60(++_0x502559);}(_0xfb31,0x14f));var _0x1fb3=function(_0x44707a,_0x561498){_0x44707a=_0x44707a-0x0;var _0x1084b7=_0xfb31[_0x44707a];return _0x1084b7;};'use strict';var ChatInteractionEvents=require(_0x1fb3('0x0'));var events=[_0x1fb3('0x1'),'remove',_0x1fb3('0x2')];function createListener(_0x25290f,_0x20d0d6){return function(_0x1e71bf){_0x20d0d6[_0x1fb3('0x3')](_0x25290f,_0x1e71bf);};}function removeListener(_0xb17f0b,_0x4913a9){return function(){ChatInteractionEvents[_0x1fb3('0x4')](_0xb17f0b,_0x4913a9);};}exports[_0x1fb3('0x5')]=function(_0x5ce233){for(var _0x463c60=0x0,_0x16fbfb=events[_0x1fb3('0x6')];_0x463c60<_0x16fbfb;_0x463c60++){var _0x4cd848=events[_0x463c60];var _0x2e0c82=createListener(_0x1fb3('0x7')+_0x4cd848,_0x5ce233);ChatInteractionEvents['on'](_0x4cd848,_0x2e0c82);}}; \ No newline at end of file +var _0x0f9b=['remove','update','emit','removeListener','register','length','chatInteraction:','save'];(function(_0x4183ea,_0xeb7bb3){var _0x3873e4=function(_0x40efd6){while(--_0x40efd6){_0x4183ea['push'](_0x4183ea['shift']());}};_0x3873e4(++_0xeb7bb3);}(_0x0f9b,0xd7));var _0xb0f9=function(_0x328b7a,_0x20d32c){_0x328b7a=_0x328b7a-0x0;var _0x22e45a=_0x0f9b[_0x328b7a];return _0x22e45a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xb0f9('0x0'),_0xb0f9('0x1'),_0xb0f9('0x2')];function createListener(_0xd0ae53,_0x3ba07b){return function(_0x17d3f3){_0x3ba07b[_0xb0f9('0x3')](_0xd0ae53,_0x17d3f3);};}function removeListener(_0x5e5ebf,_0x16dd2){return function(){ChatInteractionEvents[_0xb0f9('0x4')](_0x5e5ebf,_0x16dd2);};}exports[_0xb0f9('0x5')]=function(_0x59efb3){for(var _0x1cdacb=0x0,_0x2dc803=events[_0xb0f9('0x6')];_0x1cdacb<_0x2dc803;_0x1cdacb++){var _0x58739e=events[_0x1cdacb];var _0x3ab299=createListener(_0xb0f9('0x7')+_0x58739e,_0x59efb3);ChatInteractionEvents['on'](_0x58739e,_0x3ab299);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bff4d68..7de1e72 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 _0x15b6=['createVidaooSession','join','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo'];(function(_0x506e4e,_0x1e893b){var _0x23719c=function(_0x33e3c0){while(--_0x33e3c0){_0x506e4e['push'](_0x506e4e['shift']());}};_0x23719c(++_0x1e893b);}(_0x15b6,0x119));var _0x615b=function(_0xfb6a2b,_0x2626b8){_0xfb6a2b=_0xfb6a2b-0x0;var _0x27902f=_0x15b6[_0xfb6a2b];return _0x27902f;};'use strict';var multer=require(_0x615b('0x0'));var util=require(_0x615b('0x1'));var path=require(_0x615b('0x2'));var timeout=require(_0x615b('0x3'));var express=require(_0x615b('0x4'));var router=express['Router']();var fs_extra=require(_0x615b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x615b('0x6'));var config=require(_0x615b('0x7'));var controller=require(_0x615b('0x8'));router['get']('/',auth[_0x615b('0x9')](),controller[_0x615b('0xa')]);router[_0x615b('0xb')](_0x615b('0xc'),auth[_0x615b('0x9')](),controller[_0x615b('0xd')]);router[_0x615b('0xb')](_0x615b('0xe'),auth[_0x615b('0xf')](),controller[_0x615b('0x10')]);router[_0x615b('0xb')](_0x615b('0x11'),auth[_0x615b('0xf')](),controller['attachmentDownload']);router[_0x615b('0xb')](_0x615b('0x12'),auth[_0x615b('0x9')](),controller['getMessages']);router[_0x615b('0xb')]('/:id/my_messages',auth[_0x615b('0xf')](),controller[_0x615b('0x13')]);router['get'](_0x615b('0x14'),auth[_0x615b('0x9')](),controller[_0x615b('0x15')]);router['post']('/',auth[_0x615b('0x9')](),controller[_0x615b('0x16')]);router[_0x615b('0x17')](_0x615b('0x18'),auth['isAuthenticated'](),controller[_0x615b('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5659db,_0x170ae9,_0x9b4301){_0x9b4301(null,path[_0x615b('0x1a')](config['root'],_0x615b('0x1b')));},'filename':function(_0xe4bf91,_0x512733,_0x237844){_0x237844(null,util[_0x615b('0x1c')]('%s-%s',Date['now'](),_0x512733[_0x615b('0x1d')][_0x615b('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x615b('0x17')](_0x615b('0x1f'),upload['single']('file'),controller[_0x615b('0x20')]);router[_0x615b('0x17')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x615b('0x21')]);router['post'](_0x615b('0x22'),auth[_0x615b('0x9')](),interaction[_0x615b('0x23')](_0x615b('0x24'),_0x615b('0x25')),controller[_0x615b('0x26')]);router[_0x615b('0x27')](_0x615b('0xe'),auth[_0x615b('0x9')](),interaction[_0x615b('0x23')]('chat',_0x615b('0x28')),controller['update']);router[_0x615b('0x27')](_0x615b('0x29'),controller[_0x615b('0x2a')]);router[_0x615b('0x27')](_0x615b('0x2b'),auth[_0x615b('0xf')](),controller[_0x615b('0x2c')]);router[_0x615b('0x27')](_0x615b('0x2d'),controller[_0x615b('0x2e')]);router[_0x615b('0x2f')](_0x615b('0xe'),auth['isAuthenticated'](),interaction[_0x615b('0x23')](_0x615b('0x24'),_0x615b('0x30')),controller[_0x615b('0x31')]);router['delete'](_0x615b('0x22'),auth['isAuthenticated'](),controller[_0x615b('0x32')]);module['exports']=router; \ No newline at end of file +var _0x942d=['file','attachmentUpload','addMessage','chat','chatinteraction:addtags','put','tracked','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages','download','post','create','/:id/vidaoo','diskStorage','join','root','format','now','originalname','replace','/:id/attachment_upload','single'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x942d,0xe2));var _0xd942=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x942d[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xd942('0x0'));var util=require(_0xd942('0x1'));var path=require('path');var timeout=require(_0xd942('0x2'));var express=require(_0xd942('0x3'));var router=express[_0xd942('0x4')]();var fs_extra=require(_0xd942('0x5'));var auth=require(_0xd942('0x6'));var interaction=require(_0xd942('0x7'));var config=require(_0xd942('0x8'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xd942('0x9')](),controller[_0xd942('0xa')]);router[_0xd942('0xb')](_0xd942('0xc'),auth[_0xd942('0x9')](),controller[_0xd942('0xd')]);router['get'](_0xd942('0xe'),auth[_0xd942('0xf')](),controller[_0xd942('0x10')]);router[_0xd942('0xb')](_0xd942('0x11'),auth[_0xd942('0xf')](),controller[_0xd942('0x12')]);router[_0xd942('0xb')](_0xd942('0x13'),auth[_0xd942('0x9')](),controller['getMessages']);router[_0xd942('0xb')]('/:id/my_messages',auth[_0xd942('0xf')](),controller[_0xd942('0x14')]);router[_0xd942('0xb')]('/:id/download',auth[_0xd942('0x9')](),controller[_0xd942('0x15')]);router[_0xd942('0x16')]('/',auth[_0xd942('0x9')](),controller[_0xd942('0x17')]);router['post'](_0xd942('0x18'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd942('0x19')]({'destination':function(_0x17c6b4,_0x1f7d59,_0x3de292){_0x3de292(null,path[_0xd942('0x1a')](config[_0xd942('0x1b')],'server/files/attachments/'));},'filename':function(_0x22f6f1,_0x5a5612,_0xf423b9){_0xf423b9(null,util[_0xd942('0x1c')]('%s-%s',Date[_0xd942('0x1d')](),_0x5a5612[_0xd942('0x1e')][_0xd942('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd942('0x16')](_0xd942('0x20'),upload[_0xd942('0x21')](_0xd942('0x22')),controller[_0xd942('0x23')]);router[_0xd942('0x16')]('/:id/messages',auth[_0xd942('0xf')](),controller[_0xd942('0x24')]);router[_0xd942('0x16')]('/:id/tags',auth[_0xd942('0x9')](),interaction['tracked'](_0xd942('0x25'),_0xd942('0x26')),controller['addTags']);router[_0xd942('0x27')](_0xd942('0xe'),auth[_0xd942('0x9')](),interaction[_0xd942('0x28')](_0xd942('0x25'),_0xd942('0x29')),controller[_0xd942('0x2a')]);router[_0xd942('0x27')](_0xd942('0x2b'),controller['customUpdate']);router[_0xd942('0x27')]('/:id/abandon',auth[_0xd942('0xf')](),controller[_0xd942('0x2c')]);router[_0xd942('0x27')](_0xd942('0x2d'),controller[_0xd942('0x2e')]);router[_0xd942('0x2f')](_0xd942('0xe'),auth[_0xd942('0x9')](),interaction['tracked'](_0xd942('0x25'),_0xd942('0x30')),controller[_0xd942('0x31')]);router[_0xd942('0x2f')](_0xd942('0x32'),auth[_0xd942('0x9')](),controller['removeTags']);module[_0xd942('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5be6ff8..7200730 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 _0x8adb=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x4f8f23,_0x1178e8){var _0x251c3a=function(_0x5dffd4){while(--_0x5dffd4){_0x4f8f23['push'](_0x4f8f23['shift']());}};_0x251c3a(++_0x1178e8);}(_0x8adb,0xe7));var _0xb8ad=function(_0x24383a,_0x298ec7){_0x24383a=_0x24383a-0x0;var _0x2a713f=_0x8adb[_0x24383a];return _0x2a713f;};'use strict';var Sequelize=require(_0xb8ad('0x0'));module[_0xb8ad('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb8ad('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb8ad('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb8ad('0x4')]}}; \ No newline at end of file +var _0x6121=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x4a2183,_0x53e74d){var _0xc7c01d=function(_0x526d67){while(--_0x526d67){_0x4a2183['push'](_0x4a2183['shift']());}};_0xc7c01d(++_0x53e74d);}(_0x6121,0x1b5));var _0x1612=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6121[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x1612('0x0'));module[_0x1612('0x1')]={'body':{'type':Sequelize[_0x1612('0x2')](_0x1612('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1612('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1612('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 2efc775..a59c331 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 _0x7a8b=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','ChatInternalMessage','then','include','findAll','catch','show','rawAttributes','options','find','create','params','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','fullname','role','userpic','internal','online','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','read','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','error','stack','name','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a8b,0x1d5));var _0xb7a8=function(_0xf70963,_0x5b55fa){_0xf70963=_0xf70963-0x0;var _0x5eac14=_0x7a8b[_0xf70963];return _0x5eac14;};'use strict';var emlformat=require(_0xb7a8('0x0'));var rimraf=require(_0xb7a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7a8('0x2'));var rp=require(_0xb7a8('0x3'));var moment=require(_0xb7a8('0x4'));var BPromise=require(_0xb7a8('0x5'));var Mustache=require(_0xb7a8('0x6'));var util=require(_0xb7a8('0x7'));var path=require(_0xb7a8('0x8'));var sox=require(_0xb7a8('0x9'));var csv=require(_0xb7a8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7a8('0xb'));var _=require('lodash');var squel=require(_0xb7a8('0xc'));var crypto=require('crypto');var jsforce=require(_0xb7a8('0xd'));var deskjs=require(_0xb7a8('0xe'));var toCsv=require(_0xb7a8('0xa'));var querystring=require(_0xb7a8('0xf'));var Papa=require('papaparse');var Redis=require(_0xb7a8('0x10'));var authService=require(_0xb7a8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7a8('0x12'));var logger=require(_0xb7a8('0x13'))('api');var utils=require(_0xb7a8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb7a8('0x15'))['db'];config[_0xb7a8('0x16')]=_[_0xb7a8('0x17')](config[_0xb7a8('0x16')],{'host':_0xb7a8('0x18'),'port':0x18eb});var socket=require(_0xb7a8('0x19'))(new Redis(config[_0xb7a8('0x16')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x185f84,_0x20ccad){_0x20ccad=_0x20ccad||0xcc;return function(_0x3f89cc){if(_0x3f89cc){return _0x185f84[_0xb7a8('0x1a')](_0x20ccad);}return _0x185f84[_0xb7a8('0x1b')](_0x20ccad)['end']();};}function respondWithResult(_0x2eb927,_0x3abfee){_0x3abfee=_0x3abfee||0xc8;return function(_0x49458c){if(_0x49458c){return _0x2eb927[_0xb7a8('0x1b')](_0x3abfee)['json'](_0x49458c);}};}function respondWithFilteredResult(_0x142d56,_0x586fe1){return function(_0x1a6420){if(_0x1a6420){var _0x62657e=typeof _0x586fe1['offset']===_0xb7a8('0x1c')&&typeof _0x586fe1[_0xb7a8('0x1d')]===_0xb7a8('0x1c');var _0x4b993f=_0x1a6420[_0xb7a8('0x1e')];var _0xa2e189=_0x62657e?0x0:_0x586fe1[_0xb7a8('0x1f')];var _0xcb9fb5=_0x62657e?_0x1a6420[_0xb7a8('0x1e')]:_0x586fe1[_0xb7a8('0x1f')]+_0x586fe1[_0xb7a8('0x1d')];var _0xc6a3c4;if(_0xcb9fb5>=_0x4b993f){_0xcb9fb5=_0x4b993f;_0xc6a3c4=0xc8;}else{_0xc6a3c4=0xce;}_0x142d56['status'](_0xc6a3c4);return _0x142d56[_0xb7a8('0x20')](_0xb7a8('0x21'),_0xa2e189+'-'+_0xcb9fb5+'/'+_0x4b993f)[_0xb7a8('0x22')](_0x1a6420);}return null;};}function patchUpdates(_0x101af0){return function(_0x248a7f){try{jsonpatch[_0xb7a8('0x23')](_0x248a7f,_0x101af0,!![]);}catch(_0x4ab709){return BPromise['reject'](_0x4ab709);}return _0x248a7f['save']();};}function saveUpdates(_0x4cfd87,_0x43e3de){return function(_0x5bd236){if(_0x5bd236){return _0x5bd236[_0xb7a8('0x24')](_0x4cfd87)['then'](function(_0x46ba0f){return _0x46ba0f;});}return null;};}function removeEntity(_0x461257,_0x5b08f2){return function(_0x3e298f){if(_0x3e298f){return _0x3e298f['destroy']()['then'](function(){_0x461257[_0xb7a8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acef9,_0xe684a9){return function(_0x48d16d){if(!_0x48d16d){_0x5acef9[_0xb7a8('0x1a')](0x194);}return _0x48d16d;};}function handleError(_0x52ee87,_0x5d574c){_0x5d574c=_0x5d574c||0x1f4;return function(_0x18d167){logger[_0xb7a8('0x25')](_0x18d167[_0xb7a8('0x26')]);if(_0x18d167['name']){delete _0x18d167[_0xb7a8('0x27')];}_0x52ee87[_0xb7a8('0x1b')](_0x5d574c)['send'](_0x18d167);};}exports['index']=function(_0x1b668c,_0x382b88){var _0x47748a={},_0x3bcb4c={},_0x220c88={'count':0x0,'rows':[]};var _0xc344e=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x3daf49){return{'name':_0x3daf49[_0xb7a8('0x28')],'type':_0x3daf49[_0xb7a8('0x29')][_0xb7a8('0x2a')]};});_0x3bcb4c[_0xb7a8('0x2b')]=_[_0xb7a8('0x2c')](_0xc344e,_0xb7a8('0x27'));_0x3bcb4c[_0xb7a8('0x2d')]=_[_0xb7a8('0x2e')](_0x1b668c[_0xb7a8('0x2d')]);_0x3bcb4c['filters']=_['intersection'](_0x3bcb4c['model'],_0x3bcb4c[_0xb7a8('0x2d')]);_0x47748a[_0xb7a8('0x2f')]=_[_0xb7a8('0x30')](_0x3bcb4c[_0xb7a8('0x2b')],qs[_0xb7a8('0x31')](_0x1b668c[_0xb7a8('0x2d')][_0xb7a8('0x31')]));_0x47748a[_0xb7a8('0x2f')]=_0x47748a[_0xb7a8('0x2f')][_0xb7a8('0x32')]?_0x47748a['attributes']:_0x3bcb4c[_0xb7a8('0x2b')];if(!_0x1b668c[_0xb7a8('0x2d')][_0xb7a8('0x33')](_0xb7a8('0x34'))){_0x47748a[_0xb7a8('0x1d')]=qs[_0xb7a8('0x1d')](_0x1b668c['query'][_0xb7a8('0x1d')]);_0x47748a['offset']=qs[_0xb7a8('0x1f')](_0x1b668c[_0xb7a8('0x2d')][_0xb7a8('0x1f')]);}_0x47748a['order']=qs[_0xb7a8('0x35')](_0x1b668c['query'][_0xb7a8('0x35')]);_0x47748a[_0xb7a8('0x36')]=qs[_0xb7a8('0x37')](_[_0xb7a8('0x38')](_0x1b668c[_0xb7a8('0x2d')],_0x3bcb4c[_0xb7a8('0x37')]),_0xc344e);if(_0x1b668c[_0xb7a8('0x2d')][_0xb7a8('0x39')]){_0x47748a[_0xb7a8('0x36')]=_[_0xb7a8('0x3a')](_0x47748a['where'],{'$or':_[_0xb7a8('0x2c')](_0xc344e,function(_0x35dc87){if(_0x35dc87[_0xb7a8('0x29')]!==_0xb7a8('0x3b')){var _0x2ced68={};_0x2ced68[_0x35dc87[_0xb7a8('0x27')]]={'$like':'%'+_0x1b668c[_0xb7a8('0x2d')][_0xb7a8('0x39')]+'%'};return _0x2ced68;}})});}_0x47748a=_[_0xb7a8('0x3a')]({},_0x47748a,_0x1b668c['options']);var _0x39cbb4={'where':_0x47748a[_0xb7a8('0x36')]};return db[_0xb7a8('0x3c')][_0xb7a8('0x1e')](_0x39cbb4)[_0xb7a8('0x3d')](function(_0x58503d){_0x220c88['count']=_0x58503d;if(_0x1b668c[_0xb7a8('0x2d')]['includeAll']){_0x47748a[_0xb7a8('0x3e')]=[{'all':!![]}];}return db[_0xb7a8('0x3c')][_0xb7a8('0x3f')](_0x47748a);})[_0xb7a8('0x3d')](function(_0x189a9e){_0x220c88['rows']=_0x189a9e;return _0x220c88;})['then'](respondWithFilteredResult(_0x382b88,_0x47748a))[_0xb7a8('0x40')](handleError(_0x382b88,null));};exports[_0xb7a8('0x41')]=function(_0x22d6bb,_0x5b4ffb){var _0x59b9e1={'raw':!![],'where':{'id':_0x22d6bb['params']['id']}},_0x8ab1b0={};_0x8ab1b0[_0xb7a8('0x2b')]=_[_0xb7a8('0x2e')](db[_0xb7a8('0x3c')][_0xb7a8('0x42')]);_0x8ab1b0[_0xb7a8('0x2d')]=_[_0xb7a8('0x2e')](_0x22d6bb[_0xb7a8('0x2d')]);_0x8ab1b0[_0xb7a8('0x37')]=_[_0xb7a8('0x30')](_0x8ab1b0[_0xb7a8('0x2b')],_0x8ab1b0[_0xb7a8('0x2d')]);_0x59b9e1[_0xb7a8('0x2f')]=_[_0xb7a8('0x30')](_0x8ab1b0[_0xb7a8('0x2b')],qs['fields'](_0x22d6bb[_0xb7a8('0x2d')][_0xb7a8('0x31')]));_0x59b9e1['attributes']=_0x59b9e1[_0xb7a8('0x2f')][_0xb7a8('0x32')]?_0x59b9e1[_0xb7a8('0x2f')]:_0x8ab1b0[_0xb7a8('0x2b')];if(_0x22d6bb[_0xb7a8('0x2d')]['includeAll']){_0x59b9e1[_0xb7a8('0x3e')]=[{'all':!![]}];}_0x59b9e1=_[_0xb7a8('0x3a')]({},_0x59b9e1,_0x22d6bb[_0xb7a8('0x43')]);return db[_0xb7a8('0x3c')][_0xb7a8('0x44')](_0x59b9e1)[_0xb7a8('0x3d')](handleEntityNotFound(_0x5b4ffb,null))[_0xb7a8('0x3d')](respondWithResult(_0x5b4ffb,null))['catch'](handleError(_0x5b4ffb,null));};exports['create']=function(_0x5325be,_0xa99f28){return db[_0xb7a8('0x3c')][_0xb7a8('0x45')](_0x5325be['body'],{})[_0xb7a8('0x3d')](respondWithResult(_0xa99f28,0xc9))[_0xb7a8('0x40')](handleError(_0xa99f28,null));};exports[_0xb7a8('0x24')]=function(_0x564c67,_0x971620){if(_0x564c67['body']['id']){delete _0x564c67['body']['id'];}return db['ChatInternalMessage'][_0xb7a8('0x44')]({'where':{'id':_0x564c67[_0xb7a8('0x46')]['id']}})[_0xb7a8('0x3d')](handleEntityNotFound(_0x971620,null))[_0xb7a8('0x3d')](saveUpdates(_0x564c67[_0xb7a8('0x47')],null))[_0xb7a8('0x3d')](respondWithResult(_0x971620,null))['catch'](handleError(_0x971620,null));};exports[_0xb7a8('0x48')]=function(_0x45176c,_0x36820b){return db[_0xb7a8('0x3c')]['find']({'where':{'id':_0x45176c[_0xb7a8('0x46')]['id']}})[_0xb7a8('0x3d')](handleEntityNotFound(_0x36820b,null))[_0xb7a8('0x3d')](removeEntity(_0x36820b,null))[_0xb7a8('0x40')](handleError(_0x36820b,null));};exports[_0xb7a8('0x49')]=function(_0x158e47,_0x1e6da7){return db[_0xb7a8('0x3c')]['describe']()[_0xb7a8('0x3d')](respondWithResult(_0x1e6da7,null))[_0xb7a8('0x40')](handleError(_0x1e6da7,null));};function wrapUser(_0x13962e){return function(_0x4a86d1){var _0xcb37e0=_0x13962e[_0xb7a8('0x4a')]({'plain':!![]});_0xcb37e0[_0xb7a8('0x4b')]=[];if(_0x4a86d1){_0xcb37e0[_0xb7a8('0x4c')]=_0x4a86d1[_0xb7a8('0x4d')];_0xcb37e0[_0xb7a8('0x4e')]=_0x4a86d1;}else{_0xcb37e0[_0xb7a8('0x4c')]=moment(0x0)[_0xb7a8('0x4f')](_0xb7a8('0x50'));_0xcb37e0[_0xb7a8('0x4e')]={};}return _0xcb37e0;};}exports['getUsers']=function(_0x1d4b7c,_0x3bee70,_0x8ee3e5){var _0x5b1c54=[];return db[_0xb7a8('0x51')][_0xb7a8('0x3f')]({'where':{'role':[_0xb7a8('0x52'),_0xb7a8('0x53'),'user']},'attributes':['id',_0xb7a8('0x54'),'name',_0xb7a8('0x55'),_0xb7a8('0x56'),_0xb7a8('0x57'),_0xb7a8('0x58'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0xb7a8('0x35')](_0xb7a8('0x59')),'include':[{'model':db[_0xb7a8('0x5a')],'as':_0xb7a8('0x5b'),'attributes':['id',_0xb7a8('0x27'),_0xb7a8('0x29')],'through':{'attributes':[]}}]})['then'](function(_0x42746d){if(_0x42746d){var _0x569531=_0x1d4b7c['user'][_0xb7a8('0x4a')]({'plain':!![]});if(!_0x569531)throw new Error(_0xb7a8('0x5c'));if(_0x569531[_0xb7a8('0x55')]===_0xb7a8('0x5d')){return db[_0xb7a8('0x5e')][_0xb7a8('0x44')]({'where':{'name':_0xb7a8('0x5f'),'userProfileId':_0x569531[_0xb7a8('0x60')]},'raw':!![]})[_0xb7a8('0x3d')](function(_0x420eb6){if(_0x420eb6){if(_0x420eb6[_0xb7a8('0x61')]===0x0){return db[_0xb7a8('0x62')]['findAll']({'where':{'sectionId':_0x420eb6['id']},'raw':!![]})['then'](function(_0x4e7183){var _0x190122=[];if(_[_0xb7a8('0x63')](_0x4e7183)){_0x190122=_[_0xb7a8('0x39')](_0x42746d,function(_0x97322){if(_0x97322[_0xb7a8('0x55')]!==_0xb7a8('0x52')){return _0x97322;}});return _0x190122;}else{for(var _0x491ea3=0x0;_0x491ea3<_0x42746d[_0xb7a8('0x32')];_0x491ea3++){var _0x541747=_0x42746d[_0x491ea3];if(_0x541747[_0xb7a8('0x55')]===_0xb7a8('0x52')){var _0x2b3ce5=_[_0xb7a8('0x44')](_0x4e7183,function(_0x179401){return _0x179401['resourceId']===_0x541747['id'];});if(_0x2b3ce5)_0x190122['push'](_0x541747);}else{_0x190122[_0xb7a8('0x64')](_0x541747);}}return _0x190122;}});}else{return _0x42746d;}}else{var _0x46928f=_['filter'](_0x42746d,function(_0x207621){if(_0x207621['role']!==_0xb7a8('0x52')){return _0x207621;}});return _0x46928f;}});}else{return _0x42746d;}}})[_0xb7a8('0x3d')](function(_0x344c9e){var _0x4ce92f=[];if(_0x344c9e){_0x5b1c54=_0x344c9e;for(var _0x101aed=0x0;_0x101aed<_0x344c9e['length'];_0x101aed+=0x1){_0x5b1c54[_0x101aed][_0xb7a8('0x4b')]=[];_0x4ce92f[_0xb7a8('0x64')](db['ChatInternalMessage'][_0xb7a8('0x44')]({'where':{'FromId':[_0x1d4b7c[_0xb7a8('0x5d')]['id'],_0x344c9e[_0x101aed]['id']],'ToId':[_0x1d4b7c['user']['id'],_0x344c9e[_0x101aed]['id']],'ChatGroupId':null},'attributes':['id',_0xb7a8('0x4d'),_0xb7a8('0x65'),_0xb7a8('0x66'),_0xb7a8('0x67'),_0xb7a8('0x47')],'order':qs[_0xb7a8('0x35')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb7a8('0x3d')](wrapUser(_0x344c9e[_0x101aed])));}return BPromise['all'](_0x4ce92f);}return[];})[_0xb7a8('0x3d')](function(_0x1edcc6){return{'rows':_0x1edcc6,'count':_0x1edcc6['length']};})[_0xb7a8('0x3d')](respondWithResult(_0x3bee70,null))[_0xb7a8('0x40')](handleError(_0x3bee70,null));}; \ No newline at end of file +var _0x9708=['format','getUsers','agent','admin','user','fullname','lastLoginAt','allowmessenger','showWebBar','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','isEmpty','push','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','send','index','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','map','type','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','params','describe','messages','createdAt','lastMessageAt'];(function(_0x416bb4,_0x3e9428){var _0x27ddf6=function(_0x41eb9f){while(--_0x41eb9f){_0x416bb4['push'](_0x416bb4['shift']());}};_0x27ddf6(++_0x3e9428);}(_0x9708,0x14d));var _0x8970=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x9708[_0x100682];return _0xcb6e87;};'use strict';var emlformat=require(_0x8970('0x0'));var rimraf=require(_0x8970('0x1'));var zipdir=require(_0x8970('0x2'));var jsonpatch=require(_0x8970('0x3'));var rp=require(_0x8970('0x4'));var moment=require(_0x8970('0x5'));var BPromise=require(_0x8970('0x6'));var Mustache=require(_0x8970('0x7'));var util=require(_0x8970('0x8'));var path=require('path');var sox=require(_0x8970('0x9'));var csv=require(_0x8970('0xa'));var ejs=require(_0x8970('0xb'));var fs=require('fs');var fs_extra=require(_0x8970('0xc'));var _=require(_0x8970('0xd'));var squel=require(_0x8970('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8970('0xf'));var toCsv=require(_0x8970('0xa'));var querystring=require(_0x8970('0x10'));var Papa=require(_0x8970('0x11'));var Redis=require(_0x8970('0x12'));var authService=require(_0x8970('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8970('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8970('0x15'))(_0x8970('0x16'));var utils=require(_0x8970('0x17'));var config=require(_0x8970('0x18'));var licenseUtil=require(_0x8970('0x19'));var db=require(_0x8970('0x1a'))['db'];config[_0x8970('0x1b')]=_[_0x8970('0x1c')](config['redis'],{'host':_0x8970('0x1d'),'port':0x18eb});var socket=require(_0x8970('0x1e'))(new Redis(config[_0x8970('0x1b')]));require(_0x8970('0x1f'))[_0x8970('0x20')](socket);function respondWithStatusCode(_0x23e152,_0x513719){_0x513719=_0x513719||0xcc;return function(_0x540981){if(_0x540981){return _0x23e152[_0x8970('0x21')](_0x513719);}return _0x23e152[_0x8970('0x22')](_0x513719)[_0x8970('0x23')]();};}function respondWithResult(_0x149fdb,_0xe74c6b){_0xe74c6b=_0xe74c6b||0xc8;return function(_0x30418f){if(_0x30418f){return _0x149fdb[_0x8970('0x22')](_0xe74c6b)['json'](_0x30418f);}};}function respondWithFilteredResult(_0x32dc12,_0x485f42){return function(_0x1abd90){if(_0x1abd90){var _0x57fc41=typeof _0x485f42[_0x8970('0x24')]===_0x8970('0x25')&&typeof _0x485f42[_0x8970('0x26')]===_0x8970('0x25');var _0x536c25=_0x1abd90[_0x8970('0x27')];var _0x2155cd=_0x57fc41?0x0:_0x485f42[_0x8970('0x24')];var _0x32871e=_0x57fc41?_0x1abd90[_0x8970('0x27')]:_0x485f42[_0x8970('0x24')]+_0x485f42['limit'];var _0x1b46fa;if(_0x32871e>=_0x536c25){_0x32871e=_0x536c25;_0x1b46fa=0xc8;}else{_0x1b46fa=0xce;}_0x32dc12[_0x8970('0x22')](_0x1b46fa);return _0x32dc12['set'](_0x8970('0x28'),_0x2155cd+'-'+_0x32871e+'/'+_0x536c25)['json'](_0x1abd90);}return null;};}function patchUpdates(_0x350d51){return function(_0x5675ea){try{jsonpatch['apply'](_0x5675ea,_0x350d51,!![]);}catch(_0x5b4cb7){return BPromise[_0x8970('0x29')](_0x5b4cb7);}return _0x5675ea[_0x8970('0x2a')]();};}function saveUpdates(_0x1f39f4,_0x361d5e){return function(_0x593a25){if(_0x593a25){return _0x593a25[_0x8970('0x2b')](_0x1f39f4)['then'](function(_0x1eaa52){return _0x1eaa52;});}return null;};}function removeEntity(_0x572f0b,_0x67ebef){return function(_0x2fd3cf){if(_0x2fd3cf){return _0x2fd3cf['destroy']()[_0x8970('0x2c')](function(){_0x572f0b[_0x8970('0x22')](0xcc)[_0x8970('0x23')]();});}};}function handleEntityNotFound(_0x3e9d6c,_0x52dd03){return function(_0x344404){if(!_0x344404){_0x3e9d6c['sendStatus'](0x194);}return _0x344404;};}function handleError(_0x1f2c09,_0x317e33){_0x317e33=_0x317e33||0x1f4;return function(_0x1fb90b){logger[_0x8970('0x2d')](_0x1fb90b['stack']);if(_0x1fb90b[_0x8970('0x2e')]){delete _0x1fb90b['name'];}_0x1f2c09[_0x8970('0x22')](_0x317e33)[_0x8970('0x2f')](_0x1fb90b);};}exports[_0x8970('0x30')]=function(_0x32aab6,_0x4b7f5a){var _0x356e53={},_0x5b17a6={},_0x4cdc63={'count':0x0,'rows':[]};var _0x5e205d=_['map'](db['ChatInternalMessage'][_0x8970('0x31')],function(_0x498076){return{'name':_0x498076[_0x8970('0x32')],'type':_0x498076['type']['key']};});_0x5b17a6[_0x8970('0x33')]=_['map'](_0x5e205d,_0x8970('0x2e'));_0x5b17a6[_0x8970('0x34')]=_[_0x8970('0x35')](_0x32aab6['query']);_0x5b17a6['filters']=_[_0x8970('0x36')](_0x5b17a6[_0x8970('0x33')],_0x5b17a6[_0x8970('0x34')]);_0x356e53['attributes']=_[_0x8970('0x36')](_0x5b17a6['model'],qs[_0x8970('0x37')](_0x32aab6[_0x8970('0x34')]['fields']));_0x356e53[_0x8970('0x38')]=_0x356e53[_0x8970('0x38')][_0x8970('0x39')]?_0x356e53[_0x8970('0x38')]:_0x5b17a6[_0x8970('0x33')];if(!_0x32aab6['query']['hasOwnProperty']('nolimit')){_0x356e53['limit']=qs[_0x8970('0x26')](_0x32aab6['query'][_0x8970('0x26')]);_0x356e53[_0x8970('0x24')]=qs[_0x8970('0x24')](_0x32aab6[_0x8970('0x34')][_0x8970('0x24')]);}_0x356e53['order']=qs[_0x8970('0x3a')](_0x32aab6[_0x8970('0x34')][_0x8970('0x3a')]);_0x356e53[_0x8970('0x3b')]=qs[_0x8970('0x3c')](_[_0x8970('0x3d')](_0x32aab6[_0x8970('0x34')],_0x5b17a6[_0x8970('0x3c')]),_0x5e205d);if(_0x32aab6[_0x8970('0x34')][_0x8970('0x3e')]){_0x356e53[_0x8970('0x3b')]=_[_0x8970('0x3f')](_0x356e53[_0x8970('0x3b')],{'$or':_[_0x8970('0x40')](_0x5e205d,function(_0x4a9683){if(_0x4a9683[_0x8970('0x41')]!=='VIRTUAL'){var _0x32f810={};_0x32f810[_0x4a9683[_0x8970('0x2e')]]={'$like':'%'+_0x32aab6[_0x8970('0x34')][_0x8970('0x3e')]+'%'};return _0x32f810;}})});}_0x356e53=_['merge']({},_0x356e53,_0x32aab6[_0x8970('0x42')]);var _0xb9c3dc={'where':_0x356e53[_0x8970('0x3b')]};return db[_0x8970('0x43')]['count'](_0xb9c3dc)[_0x8970('0x2c')](function(_0x221aa6){_0x4cdc63[_0x8970('0x27')]=_0x221aa6;if(_0x32aab6[_0x8970('0x34')][_0x8970('0x44')]){_0x356e53[_0x8970('0x45')]=[{'all':!![]}];}return db[_0x8970('0x43')][_0x8970('0x46')](_0x356e53);})[_0x8970('0x2c')](function(_0x52e475){_0x4cdc63[_0x8970('0x47')]=_0x52e475;return _0x4cdc63;})[_0x8970('0x2c')](respondWithFilteredResult(_0x4b7f5a,_0x356e53))[_0x8970('0x48')](handleError(_0x4b7f5a,null));};exports[_0x8970('0x49')]=function(_0x4b322f,_0x1a7a8a){var _0x1eb453={'raw':!![],'where':{'id':_0x4b322f['params']['id']}},_0x32874c={};_0x32874c[_0x8970('0x33')]=_[_0x8970('0x35')](db[_0x8970('0x43')]['rawAttributes']);_0x32874c[_0x8970('0x34')]=_['keys'](_0x4b322f[_0x8970('0x34')]);_0x32874c[_0x8970('0x3c')]=_[_0x8970('0x36')](_0x32874c['model'],_0x32874c['query']);_0x1eb453[_0x8970('0x38')]=_[_0x8970('0x36')](_0x32874c['model'],qs['fields'](_0x4b322f[_0x8970('0x34')][_0x8970('0x37')]));_0x1eb453[_0x8970('0x38')]=_0x1eb453[_0x8970('0x38')]['length']?_0x1eb453[_0x8970('0x38')]:_0x32874c[_0x8970('0x33')];if(_0x4b322f['query'][_0x8970('0x44')]){_0x1eb453[_0x8970('0x45')]=[{'all':!![]}];}_0x1eb453=_[_0x8970('0x3f')]({},_0x1eb453,_0x4b322f[_0x8970('0x42')]);return db[_0x8970('0x43')][_0x8970('0x4a')](_0x1eb453)[_0x8970('0x2c')](handleEntityNotFound(_0x1a7a8a,null))[_0x8970('0x2c')](respondWithResult(_0x1a7a8a,null))[_0x8970('0x48')](handleError(_0x1a7a8a,null));};exports['create']=function(_0x3a155b,_0x4e028a){return db[_0x8970('0x43')][_0x8970('0x4b')](_0x3a155b[_0x8970('0x4c')],{})[_0x8970('0x2c')](respondWithResult(_0x4e028a,0xc9))[_0x8970('0x48')](handleError(_0x4e028a,null));};exports[_0x8970('0x2b')]=function(_0x370633,_0x35e5a0){if(_0x370633[_0x8970('0x4c')]['id']){delete _0x370633[_0x8970('0x4c')]['id'];}return db['ChatInternalMessage'][_0x8970('0x4a')]({'where':{'id':_0x370633['params']['id']}})[_0x8970('0x2c')](handleEntityNotFound(_0x35e5a0,null))[_0x8970('0x2c')](saveUpdates(_0x370633[_0x8970('0x4c')],null))['then'](respondWithResult(_0x35e5a0,null))['catch'](handleError(_0x35e5a0,null));};exports[_0x8970('0x4d')]=function(_0x2412f4,_0x26db24){return db[_0x8970('0x43')][_0x8970('0x4a')]({'where':{'id':_0x2412f4[_0x8970('0x4e')]['id']}})[_0x8970('0x2c')](handleEntityNotFound(_0x26db24,null))[_0x8970('0x2c')](removeEntity(_0x26db24,null))[_0x8970('0x48')](handleError(_0x26db24,null));};exports['describe']=function(_0x49f5be,_0xea9f72){return db[_0x8970('0x43')][_0x8970('0x4f')]()['then'](respondWithResult(_0xea9f72,null))[_0x8970('0x48')](handleError(_0xea9f72,null));};function wrapUser(_0x226110){return function(_0x194636){var _0x195a02=_0x226110['get']({'plain':!![]});_0x195a02[_0x8970('0x50')]=[];if(_0x194636){_0x195a02['lastMessageAt']=_0x194636[_0x8970('0x51')];_0x195a02['lastMessage']=_0x194636;}else{_0x195a02[_0x8970('0x52')]=moment(0x0)[_0x8970('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x195a02['lastMessage']={};}return _0x195a02;};}exports[_0x8970('0x54')]=function(_0x5f4e9e,_0x46e7a3,_0x77879f){var _0x338cec=[];return db['User'][_0x8970('0x46')]({'where':{'role':[_0x8970('0x55'),_0x8970('0x56'),_0x8970('0x57')]},'attributes':['id',_0x8970('0x58'),_0x8970('0x2e'),'role','userpic','internal','online',_0x8970('0x59'),_0x8970('0x5a'),_0x8970('0x5b')],'order':qs[_0x8970('0x3a')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name',_0x8970('0x41')],'through':{'attributes':[]}}]})[_0x8970('0x2c')](function(_0x45be82){if(_0x45be82){var _0x2adf9c=_0x5f4e9e[_0x8970('0x57')][_0x8970('0x5c')]({'plain':!![]});if(!_0x2adf9c)throw new Error(_0x8970('0x5d'));if(_0x2adf9c[_0x8970('0x5e')]===_0x8970('0x57')){return db[_0x8970('0x5f')][_0x8970('0x4a')]({'where':{'name':_0x8970('0x60'),'userProfileId':_0x2adf9c[_0x8970('0x61')]},'raw':!![]})[_0x8970('0x2c')](function(_0x2950f4){if(_0x2950f4){if(_0x2950f4['autoAssociation']===0x0){return db['UserProfileResource'][_0x8970('0x46')]({'where':{'sectionId':_0x2950f4['id']},'raw':!![]})[_0x8970('0x2c')](function(_0x8eb506){var _0x6ab893=[];if(_[_0x8970('0x62')](_0x8eb506)){_0x6ab893=_[_0x8970('0x3e')](_0x45be82,function(_0x451d97){if(_0x451d97[_0x8970('0x5e')]!=='agent'){return _0x451d97;}});return _0x6ab893;}else{for(var _0x12ef43=0x0;_0x12ef43<_0x45be82['length'];_0x12ef43++){var _0x18227a=_0x45be82[_0x12ef43];if(_0x18227a[_0x8970('0x5e')]==='agent'){var _0x2042bf=_[_0x8970('0x4a')](_0x8eb506,function(_0x1033f3){return _0x1033f3['resourceId']===_0x18227a['id'];});if(_0x2042bf)_0x6ab893[_0x8970('0x63')](_0x18227a);}else{_0x6ab893[_0x8970('0x63')](_0x18227a);}}return _0x6ab893;}});}else{return _0x45be82;}}else{var _0x58e892=_[_0x8970('0x3e')](_0x45be82,function(_0x509023){if(_0x509023[_0x8970('0x5e')]!==_0x8970('0x55')){return _0x509023;}});return _0x58e892;}});}else{return _0x45be82;}}})[_0x8970('0x2c')](function(_0x23c076){var _0x444a6e=[];if(_0x23c076){_0x338cec=_0x23c076;for(var _0x2ce70f=0x0;_0x2ce70f<_0x23c076[_0x8970('0x39')];_0x2ce70f+=0x1){_0x338cec[_0x2ce70f]['messages']=[];_0x444a6e[_0x8970('0x63')](db[_0x8970('0x43')][_0x8970('0x4a')]({'where':{'FromId':[_0x5f4e9e[_0x8970('0x57')]['id'],_0x23c076[_0x2ce70f]['id']],'ToId':[_0x5f4e9e['user']['id'],_0x23c076[_0x2ce70f]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x8970('0x64'),_0x8970('0x65'),_0x8970('0x4c')],'order':qs[_0x8970('0x3a')](_0x8970('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x23c076[_0x2ce70f])));}return BPromise[_0x8970('0x67')](_0x444a6e);}return[];})[_0x8970('0x2c')](function(_0x330a2e){return{'rows':_0x330a2e,'count':_0x330a2e[_0x8970('0x39')]};})[_0x8970('0x2c')](respondWithResult(_0x46e7a3,null))[_0x8970('0x48')](handleError(_0x46e7a3,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f51630b..f059aa8 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 _0xb7ad=['save','update','remove','emit','hasOwnProperty','hook','events','ChatInternalMessage','setMaxListeners'];(function(_0x5e206f,_0x29329d){var _0x175691=function(_0x1567f9){while(--_0x1567f9){_0x5e206f['push'](_0x5e206f['shift']());}};_0x175691(++_0x29329d);}(_0xb7ad,0x11d));var _0xdb7a=function(_0x2e4795,_0x400e7d){_0x2e4795=_0x2e4795-0x0;var _0x3d88bc=_0xb7ad[_0x2e4795];return _0x3d88bc;};'use strict';var EventEmitter=require(_0xdb7a('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xdb7a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdb7a('0x2')](0x0);var events={'afterCreate':_0xdb7a('0x3'),'afterUpdate':_0xdb7a('0x4'),'afterDestroy':_0xdb7a('0x5')};function emitEvent(_0x5356a5){return function(_0xfcc7a8,_0x143698,_0x4f8416){ChatInternalMessageEvents[_0xdb7a('0x6')](_0x5356a5+':'+_0xfcc7a8['id'],_0xfcc7a8);ChatInternalMessageEvents[_0xdb7a('0x6')](_0x5356a5,_0xfcc7a8);_0x4f8416(null);};}for(var e in events){if(events[_0xdb7a('0x7')](e)){var event=events[e];ChatInternalMessage[_0xdb7a('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xf920=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x5aa04c,_0x453a5e){var _0xe2999c=function(_0x5662c2){while(--_0x5662c2){_0x5aa04c['push'](_0x5aa04c['shift']());}};_0xe2999c(++_0x453a5e);}(_0xf920,0x1e5));var _0x0f92=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0xf920[_0x59342a];return _0x17abc9;};'use strict';var EventEmitter=require(_0x0f92('0x0'));var ChatInternalMessage=require(_0x0f92('0x1'))['db'][_0x0f92('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0f92('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f92('0x4'),'afterDestroy':_0x0f92('0x5')};function emitEvent(_0x29bb21){return function(_0x768fd7,_0x28555a,_0x24caf3){ChatInternalMessageEvents['emit'](_0x29bb21+':'+_0x768fd7['id'],_0x768fd7);ChatInternalMessageEvents[_0x0f92('0x6')](_0x29bb21,_0x768fd7);_0x24caf3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x0f92('0x7')](e,emitEvent(event));}}module[_0x0f92('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 c66dc96..b62b4b6 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 _0x9551=['request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x3417dd,_0x226510){var _0x50914e=function(_0x4981b4){while(--_0x4981b4){_0x3417dd['push'](_0x3417dd['shift']());}};_0x50914e(++_0x226510);}(_0x9551,0x80));var _0x1955=function(_0x3ef8a9,_0x59a7c2){_0x3ef8a9=_0x3ef8a9-0x0;var _0x424f63=_0x9551[_0x3ef8a9];return _0x424f63;};'use strict';var _=require('lodash');var util=require(_0x1955('0x0'));var logger=require(_0x1955('0x1'))(_0x1955('0x2'));var moment=require(_0x1955('0x3'));var BPromise=require('bluebird');var rp=require(_0x1955('0x4'));var fs=require('fs');var path=require(_0x1955('0x5'));var rimraf=require('rimraf');var config=require(_0x1955('0x6'));var attributes=require(_0x1955('0x7'));module[_0x1955('0x8')]=function(_0x3751a4,_0x4477e1){return _0x3751a4[_0x1955('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x1955('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1955('0xb')});}; \ No newline at end of file +var _0x0190=['path','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x0190,0x1e7));var _0x0019=function(_0xe1a284,_0x583d4d){_0xe1a284=_0xe1a284-0x0;var _0x25231c=_0x0190[_0xe1a284];return _0x25231c;};'use strict';var _=require(_0x0019('0x0'));var util=require('util');var logger=require(_0x0019('0x1'))(_0x0019('0x2'));var moment=require('moment');var BPromise=require(_0x0019('0x3'));var rp=require(_0x0019('0x4'));var fs=require('fs');var path=require(_0x0019('0x5'));var rimraf=require('rimraf');var config=require(_0x0019('0x6'));var attributes=require(_0x0019('0x7'));module[_0x0019('0x8')]=function(_0xa88eca,_0x1b0ad3){return _0xa88eca[_0x0019('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x0019('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0019('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 260c1d4..e5dec98 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 _0xab5b=['debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xab5b,0x11a));var _0xbab5=function(_0x250008,_0x572a9e){_0x250008=_0x250008-0x0;var _0x2cd369=_0xab5b[_0x250008];return _0x2cd369;};'use strict';var _=require(_0xbab5('0x0'));var util=require(_0xbab5('0x1'));var moment=require('moment');var BPromise=require(_0xbab5('0x2'));var rs=require(_0xbab5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbab5('0x4'));var logger=require('../../config/logger')(_0xbab5('0x5'));var config=require(_0xbab5('0x6'));var jayson=require(_0xbab5('0x7'));var client=jayson[_0xbab5('0x8')][_0xbab5('0x9')]({'port':0x232a});config['redis']=_[_0xbab5('0xa')](config[_0xbab5('0xb')],{'host':_0xbab5('0xc'),'port':0x18eb});var socket=require(_0xbab5('0xd'))(new Redis(config[_0xbab5('0xb')]));require('./chatInternalMessage.socket')[_0xbab5('0xe')](socket);function respondWithRpcPromise(_0x31f54b,_0x37ccba,_0x4c9350){return new BPromise(function(_0x226c55,_0xfbb62c){return client['request'](_0x31f54b,_0x4c9350)[_0xbab5('0xf')](function(_0x20b3fb){logger[_0xbab5('0x10')](_0xbab5('0x11'),_0x37ccba,'request\x20sent');logger[_0xbab5('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x37ccba,_0xbab5('0x13'),JSON[_0xbab5('0x14')](_0x20b3fb));if(_0x20b3fb[_0xbab5('0x15')]){if(_0x20b3fb[_0xbab5('0x15')][_0xbab5('0x16')]===0x1f4){logger['error'](_0xbab5('0x11'),_0x37ccba,_0x20b3fb[_0xbab5('0x15')][_0xbab5('0x17')]);return _0xfbb62c(_0x20b3fb[_0xbab5('0x15')][_0xbab5('0x17')]);}logger[_0xbab5('0x15')](_0xbab5('0x11'),_0x37ccba,_0x20b3fb[_0xbab5('0x15')][_0xbab5('0x17')]);return _0x226c55(_0x20b3fb['error'][_0xbab5('0x17')]);}else{logger[_0xbab5('0x10')](_0xbab5('0x11'),_0x37ccba,'request\x20sent');_0x226c55(_0x20b3fb['result'][_0xbab5('0x17')]);}})[_0xbab5('0x18')](function(_0x25fbf1){logger[_0xbab5('0x15')](_0xbab5('0x11'),_0x37ccba,_0x25fbf1);_0xfbb62c(_0x25fbf1);});});} \ No newline at end of file +var _0x5acd=['code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x172780,_0x2672e7){var _0x54df9e=function(_0x585f34){while(--_0x585f34){_0x172780['push'](_0x172780['shift']());}};_0x54df9e(++_0x2672e7);}(_0x5acd,0x1f1));var _0xd5ac=function(_0x45839f,_0x522c19){_0x45839f=_0x45839f-0x0;var _0x40de77=_0x5acd[_0x45839f];return _0x40de77;};'use strict';var _=require(_0xd5ac('0x0'));var util=require(_0xd5ac('0x1'));var moment=require(_0xd5ac('0x2'));var BPromise=require(_0xd5ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd5ac('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5ac('0x7')]['http']({'port':0x232a});config[_0xd5ac('0x8')]=_[_0xd5ac('0x9')](config[_0xd5ac('0x8')],{'host':_0xd5ac('0xa'),'port':0x18eb});var socket=require(_0xd5ac('0xb'))(new Redis(config[_0xd5ac('0x8')]));require(_0xd5ac('0xc'))[_0xd5ac('0xd')](socket);function respondWithRpcPromise(_0x7fe90b,_0x393f7b,_0x3a08c7){return new BPromise(function(_0x3250e1,_0x1b5c03){return client[_0xd5ac('0xe')](_0x7fe90b,_0x3a08c7)[_0xd5ac('0xf')](function(_0x3885c7){logger[_0xd5ac('0x10')](_0xd5ac('0x11'),_0x393f7b,_0xd5ac('0x12'));logger[_0xd5ac('0x13')](_0xd5ac('0x14'),_0x393f7b,_0xd5ac('0x12'),JSON[_0xd5ac('0x15')](_0x3885c7));if(_0x3885c7[_0xd5ac('0x16')]){if(_0x3885c7[_0xd5ac('0x16')][_0xd5ac('0x17')]===0x1f4){logger[_0xd5ac('0x16')](_0xd5ac('0x11'),_0x393f7b,_0x3885c7[_0xd5ac('0x16')][_0xd5ac('0x18')]);return _0x1b5c03(_0x3885c7[_0xd5ac('0x16')][_0xd5ac('0x18')]);}logger[_0xd5ac('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x393f7b,_0x3885c7['error'][_0xd5ac('0x18')]);return _0x3250e1(_0x3885c7['error']['message']);}else{logger[_0xd5ac('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x393f7b,_0xd5ac('0x12'));_0x3250e1(_0x3885c7[_0xd5ac('0x19')][_0xd5ac('0x18')]);}})['catch'](function(_0x3ca925){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x393f7b,_0x3ca925);_0x1b5c03(_0x3ca925);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9559e24..e31dcd6 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 _0x5a22=['./chatInternalMessage.events','save','remove','update','emit','removeListener','register','chatInternalMessage:'];(function(_0x16bf05,_0x4f70da){var _0xbcf546=function(_0x70b01d){while(--_0x70b01d){_0x16bf05['push'](_0x16bf05['shift']());}};_0xbcf546(++_0x4f70da);}(_0x5a22,0x1b8));var _0x25a2=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0x5a22[_0x3def1b];return _0x57340e;};'use strict';var ChatInternalMessageEvents=require(_0x25a2('0x0'));var events=[_0x25a2('0x1'),_0x25a2('0x2'),_0x25a2('0x3')];function createListener(_0x35f89e,_0x4f730f){return function(_0x49c991){_0x4f730f[_0x25a2('0x4')](_0x35f89e,_0x49c991);};}function removeListener(_0x3fd5bb,_0x114bc4){return function(){ChatInternalMessageEvents[_0x25a2('0x5')](_0x3fd5bb,_0x114bc4);};}exports[_0x25a2('0x6')]=function(_0x4581cf){for(var _0x24f8f1=0x0,_0x537e6c=events['length'];_0x24f8f1<_0x537e6c;_0x24f8f1++){var _0x400da7=events[_0x24f8f1];var _0x4ec299=createListener(_0x25a2('0x7')+_0x400da7,_0x4581cf);ChatInternalMessageEvents['on'](_0x400da7,_0x4ec299);}}; \ No newline at end of file +var _0xe7d2=['removeListener','register','length','./chatInternalMessage.events'];(function(_0x56402c,_0x2a8c8b){var _0x1b33da=function(_0x4af5a7){while(--_0x4af5a7){_0x56402c['push'](_0x56402c['shift']());}};_0x1b33da(++_0x2a8c8b);}(_0xe7d2,0x16b));var _0x2e7d=function(_0x825d19,_0x4fe030){_0x825d19=_0x825d19-0x0;var _0x2e7502=_0xe7d2[_0x825d19];return _0x2e7502;};'use strict';var ChatInternalMessageEvents=require(_0x2e7d('0x0'));var events=['save','remove','update'];function createListener(_0x2f72b9,_0x4b5229){return function(_0x420e3f){_0x4b5229['emit'](_0x2f72b9,_0x420e3f);};}function removeListener(_0x3871b5,_0x4c1015){return function(){ChatInternalMessageEvents[_0x2e7d('0x1')](_0x3871b5,_0x4c1015);};}exports[_0x2e7d('0x2')]=function(_0x4ddb1f){for(var _0x2ad851=0x0,_0x23fdf8=events[_0x2e7d('0x3')];_0x2ad851<_0x23fdf8;_0x2ad851++){var _0x1589b0=events[_0x2ad851];var _0x1ff055=createListener('chatInternalMessage:'+_0x1589b0,_0x4ddb1f);ChatInternalMessageEvents['on'](_0x1589b0,_0x1ff055);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 82d07fe..da7f147 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 _0x67fe=['get','/describe','describe','/users','isAuthenticated','getUsers','/:id','show','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x15df98,_0xf3c3ad){var _0x3bcfb2=function(_0x19b65d){while(--_0x19b65d){_0x15df98['push'](_0x15df98['shift']());}};_0x3bcfb2(++_0xf3c3ad);}(_0x67fe,0x189));var _0xe67f=function(_0x29ddb1,_0x374564){_0x29ddb1=_0x29ddb1-0x0;var _0x42739e=_0x67fe[_0x29ddb1];return _0x42739e;};'use strict';var multer=require(_0xe67f('0x0'));var util=require(_0xe67f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe67f('0x2'));var router=express[_0xe67f('0x3')]();var fs_extra=require(_0xe67f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe67f('0x5'));var config=require(_0xe67f('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xe67f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe67f('0x7')](_0xe67f('0x8'),auth['isAuthenticated'](),controller[_0xe67f('0x9')]);router[_0xe67f('0x7')](_0xe67f('0xa'),auth[_0xe67f('0xb')](),controller[_0xe67f('0xc')]);router[_0xe67f('0x7')](_0xe67f('0xd'),auth[_0xe67f('0xb')](),controller[_0xe67f('0xe')]);router[_0xe67f('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe67f('0x10')](_0xe67f('0xd'),controller['update']);router[_0xe67f('0x11')](_0xe67f('0xd'),auth[_0xe67f('0xb')](),controller[_0xe67f('0x12')]);module[_0xe67f('0x13')]=router; \ No newline at end of file +var _0x361a=['isAuthenticated','getUsers','show','post','create','put','/:id','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','/describe','describe','/users'];(function(_0x2263cc,_0x2e1dc9){var _0x1ba214=function(_0x2c4fe3){while(--_0x2c4fe3){_0x2263cc['push'](_0x2263cc['shift']());}};_0x1ba214(++_0x2e1dc9);}(_0x361a,0x8e));var _0xa361=function(_0x38fc0f,_0x4658a5){_0x38fc0f=_0x38fc0f-0x0;var _0x23c7c4=_0x361a[_0x38fc0f];return _0x23c7c4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa361('0x0'));var express=require(_0xa361('0x1'));var router=express[_0xa361('0x2')]();var fs_extra=require(_0xa361('0x3'));var auth=require(_0xa361('0x4'));var interaction=require(_0xa361('0x5'));var config=require(_0xa361('0x6'));var controller=require(_0xa361('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa361('0x8')]);router['get'](_0xa361('0x9'),auth['isAuthenticated'](),controller[_0xa361('0xa')]);router['get'](_0xa361('0xb'),auth[_0xa361('0xc')](),controller[_0xa361('0xd')]);router['get']('/:id',auth[_0xa361('0xc')](),controller[_0xa361('0xe')]);router[_0xa361('0xf')]('/',auth['isAuthenticated'](),controller[_0xa361('0x10')]);router[_0xa361('0x11')](_0xa361('0x12'),controller['update']);router[_0xa361('0x13')](_0xa361('0x12'),auth[_0xa361('0xc')](),controller[_0xa361('0x14')]);module[_0xa361('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7b91607..426671f 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 _0x7708=['DATE','TEXT','sequelize','exports','medium','out'];(function(_0x193e07,_0x3c96b8){var _0x3b0663=function(_0x45717c){while(--_0x45717c){_0x193e07['push'](_0x193e07['shift']());}};_0x3b0663(++_0x3c96b8);}(_0x7708,0x188));var _0x8770=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0x7708[_0x705b98];return _0x47b72f;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8770('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8770('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8770('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8770('0x5')]}}; \ No newline at end of file +var _0xed3c=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0xeba5c0,_0x54381f){var _0x35b566=function(_0x136f70){while(--_0x136f70){_0xeba5c0['push'](_0xeba5c0['shift']());}};_0x35b566(++_0x54381f);}(_0xed3c,0x1a6));var _0xced3=function(_0x297dcf,_0x448cf5){_0x297dcf=_0x297dcf-0x0;var _0xe1699b=_0xed3c[_0x297dcf];return _0xe1699b;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'body':{'type':Sequelize[_0xced3('0x2')](_0xced3('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xced3('0x5')]('in',_0xced3('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xced3('0x7')]},'providerResponse':{'type':Sequelize[_0xced3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7e3cbc6..32be132 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 _0x4134=['rejectMessage','SELECT','User','email','internal','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','params','options','find','create','body','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','parse','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x3ac16c,_0x54c187){var _0x1204e6=function(_0x25cf2c){while(--_0x25cf2c){_0x3ac16c['push'](_0x3ac16c['shift']());}};_0x1204e6(++_0x54c187);}(_0x4134,0x114));var _0x4413=function(_0x111f0d,_0x37dbc2){_0x111f0d=_0x111f0d-0x0;var _0x108418=_0x4134[_0x111f0d];return _0x108418;};'use strict';var emlformat=require(_0x4413('0x0'));var rimraf=require(_0x4413('0x1'));var zipdir=require(_0x4413('0x2'));var jsonpatch=require(_0x4413('0x3'));var rp=require(_0x4413('0x4'));var moment=require(_0x4413('0x5'));var BPromise=require(_0x4413('0x6'));var Mustache=require(_0x4413('0x7'));var util=require(_0x4413('0x8'));var path=require(_0x4413('0x9'));var sox=require(_0x4413('0xa'));var csv=require('to-csv');var ejs=require(_0x4413('0xb'));var fs=require('fs');var fs_extra=require(_0x4413('0xc'));var _=require('lodash');var squel=require(_0x4413('0xd'));var crypto=require(_0x4413('0xe'));var jsforce=require(_0x4413('0xf'));var deskjs=require(_0x4413('0x10'));var toCsv=require(_0x4413('0x11'));var querystring=require('querystring');var Papa=require(_0x4413('0x12'));var Redis=require('ioredis');var authService=require(_0x4413('0x13'));var qs=require(_0x4413('0x14'));var as=require(_0x4413('0x15'));var hardwareService=require(_0x4413('0x16'));var logger=require(_0x4413('0x17'))(_0x4413('0x18'));var utils=require('../../config/utils');var config=require(_0x4413('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4413('0x1a'))['db'];config[_0x4413('0x1b')]=_[_0x4413('0x1c')](config['redis'],{'host':_0x4413('0x1d'),'port':0x18eb});var socket=require(_0x4413('0x1e'))(new Redis(config[_0x4413('0x1b')]));require(_0x4413('0x1f'))[_0x4413('0x20')](socket);var jayson=require(_0x4413('0x21'));var client=jayson[_0x4413('0x22')]['http']({'port':0x232c});var client9002=jayson['client'][_0x4413('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x7b93c8,_0x48ebe1,_0x41e05f,_0x49366a){return new BPromise(function(_0x290019,_0x18abfe){var _0x1b3489=_0x49366a||client;return _0x1b3489['request'](_0x7b93c8,_0x41e05f)[_0x4413('0x24')](function(_0x149fcb){logger[_0x4413('0x25')](_0x4413('0x26'),_0x48ebe1,'request\x20sent');logger[_0x4413('0x27')](_0x4413('0x28'),_0x48ebe1,'request\x20sent',JSON[_0x4413('0x29')](_0x149fcb));if(_0x149fcb[_0x4413('0x2a')]){if(_0x149fcb['error']['code']===0x1f4){logger[_0x4413('0x2a')](_0x4413('0x26'),_0x48ebe1,_0x149fcb[_0x4413('0x2a')][_0x4413('0x2b')]);return _0x18abfe(_0x149fcb[_0x4413('0x2a')]['message']);}logger[_0x4413('0x2a')](_0x4413('0x26'),_0x48ebe1,_0x149fcb['error'][_0x4413('0x2b')]);return _0x290019(_0x149fcb['error'][_0x4413('0x2b')]);}else{logger['info'](_0x4413('0x26'),_0x48ebe1,_0x4413('0x2c'));_0x290019(_0x149fcb[_0x4413('0x2d')]['message']);}})[_0x4413('0x2e')](function(_0x1af010){logger[_0x4413('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x48ebe1,_0x1af010);_0x18abfe(_0x1af010);});});}function respondWithStatusCode(_0x3782ff,_0x265e1c){_0x265e1c=_0x265e1c||0xcc;return function(_0x26e725){if(_0x26e725){return _0x3782ff['sendStatus'](_0x265e1c);}return _0x3782ff[_0x4413('0x2f')](_0x265e1c)['end']();};}function respondWithResult(_0x1f7d0a,_0x2c3c0b){_0x2c3c0b=_0x2c3c0b||0xc8;return function(_0x57aa55){if(_0x57aa55){return _0x1f7d0a[_0x4413('0x2f')](_0x2c3c0b)[_0x4413('0x30')](_0x57aa55);}};}function respondWithFilteredResult(_0xefe1f2,_0x184fed){return function(_0x30a03c){if(_0x30a03c){var _0x2e69b1=typeof _0x184fed[_0x4413('0x31')]===_0x4413('0x32')&&typeof _0x184fed['limit']===_0x4413('0x32');var _0x3bf4d3=_0x30a03c[_0x4413('0x33')];var _0x283480=_0x2e69b1?0x0:_0x184fed['offset'];var _0x2bf04f=_0x2e69b1?_0x30a03c[_0x4413('0x33')]:_0x184fed[_0x4413('0x31')]+_0x184fed[_0x4413('0x34')];var _0x25bfbf;if(_0x2bf04f>=_0x3bf4d3){_0x2bf04f=_0x3bf4d3;_0x25bfbf=0xc8;}else{_0x25bfbf=0xce;}_0xefe1f2[_0x4413('0x2f')](_0x25bfbf);return _0xefe1f2[_0x4413('0x35')](_0x4413('0x36'),_0x283480+'-'+_0x2bf04f+'/'+_0x3bf4d3)[_0x4413('0x30')](_0x30a03c);}return null;};}function patchUpdates(_0x3f37de){return function(_0x11e72b){try{jsonpatch['apply'](_0x11e72b,_0x3f37de,!![]);}catch(_0xd8516c){return BPromise[_0x4413('0x37')](_0xd8516c);}return _0x11e72b[_0x4413('0x38')]();};}function saveUpdates(_0x2d1c61,_0x5cb3b1){return function(_0x579fcf){if(_0x579fcf){return _0x579fcf[_0x4413('0x39')](_0x2d1c61)[_0x4413('0x24')](function(_0x167106){return _0x167106;});}return null;};}function removeEntity(_0x343dde,_0x1a480e){return function(_0x53237a){if(_0x53237a){return _0x53237a[_0x4413('0x3a')]()[_0x4413('0x24')](function(){_0x343dde[_0x4413('0x2f')](0xcc)[_0x4413('0x3b')]();});}};}function handleEntityNotFound(_0xfd317d,_0x1092d7){return function(_0x351830){if(!_0x351830){_0xfd317d[_0x4413('0x3c')](0x194);}return _0x351830;};}function handleError(_0x4f70f0,_0x36e761){_0x36e761=_0x36e761||0x1f4;return function(_0x481c03){logger['error'](_0x481c03[_0x4413('0x3d')]);if(_0x481c03[_0x4413('0x3e')]){delete _0x481c03['name'];}_0x4f70f0['status'](_0x36e761)[_0x4413('0x3f')](_0x481c03);};}exports['index']=function(_0x25b081,_0x2f0391){var _0x525486={},_0x53a9dc={},_0x3b2a2f={'count':0x0,'rows':[]};var _0x167e17=_[_0x4413('0x40')](db[_0x4413('0x41')][_0x4413('0x42')],function(_0x2c3922){return{'name':_0x2c3922[_0x4413('0x43')],'type':_0x2c3922[_0x4413('0x44')][_0x4413('0x45')]};});_0x53a9dc[_0x4413('0x46')]=_[_0x4413('0x40')](_0x167e17,_0x4413('0x3e'));_0x53a9dc[_0x4413('0x47')]=_[_0x4413('0x48')](_0x25b081[_0x4413('0x47')]);_0x53a9dc[_0x4413('0x49')]=_['intersection'](_0x53a9dc[_0x4413('0x46')],_0x53a9dc['query']);_0x525486[_0x4413('0x4a')]=_[_0x4413('0x4b')](_0x53a9dc['model'],qs[_0x4413('0x4c')](_0x25b081[_0x4413('0x47')][_0x4413('0x4c')]));_0x525486[_0x4413('0x4a')]=_0x525486[_0x4413('0x4a')][_0x4413('0x4d')]?_0x525486[_0x4413('0x4a')]:_0x53a9dc[_0x4413('0x46')];if(!_0x25b081['query'][_0x4413('0x4e')](_0x4413('0x4f'))){_0x525486[_0x4413('0x34')]=qs[_0x4413('0x34')](_0x25b081[_0x4413('0x47')][_0x4413('0x34')]);_0x525486[_0x4413('0x31')]=qs[_0x4413('0x31')](_0x25b081[_0x4413('0x47')]['offset']);}_0x525486[_0x4413('0x50')]=qs[_0x4413('0x51')](_0x25b081['query'][_0x4413('0x51')]);_0x525486[_0x4413('0x52')]=qs[_0x4413('0x49')](_[_0x4413('0x53')](_0x25b081[_0x4413('0x47')],_0x53a9dc[_0x4413('0x49')]),_0x167e17);if(_0x25b081[_0x4413('0x47')][_0x4413('0x54')]){_0x525486[_0x4413('0x52')]=_[_0x4413('0x55')](_0x525486[_0x4413('0x52')],{'$or':_['map'](_0x167e17,function(_0x5aae7a){if(_0x5aae7a[_0x4413('0x44')]!=='VIRTUAL'){var _0x41c8fe={};_0x41c8fe[_0x5aae7a[_0x4413('0x3e')]]={'$like':'%'+_0x25b081[_0x4413('0x47')]['filter']+'%'};return _0x41c8fe;}})});}_0x525486=_['merge']({},_0x525486,_0x25b081['options']);var _0x562c35={'where':_0x525486[_0x4413('0x52')]};return db[_0x4413('0x41')]['count'](_0x562c35)[_0x4413('0x24')](function(_0x56fa74){_0x3b2a2f['count']=_0x56fa74;if(_0x25b081[_0x4413('0x47')][_0x4413('0x56')]){_0x525486[_0x4413('0x57')]=[{'all':!![]}];}return db[_0x4413('0x41')][_0x4413('0x58')](_0x525486);})[_0x4413('0x24')](function(_0x2fd12d){_0x3b2a2f['rows']=_0x2fd12d;return _0x3b2a2f;})[_0x4413('0x24')](respondWithFilteredResult(_0x2f0391,_0x525486))[_0x4413('0x2e')](handleError(_0x2f0391,null));};exports['show']=function(_0x185b46,_0x52d8bc){var _0xd524c1={'raw':!![],'where':{'id':_0x185b46[_0x4413('0x59')]['id']}},_0x25b909={};_0x25b909[_0x4413('0x46')]=_[_0x4413('0x48')](db[_0x4413('0x41')][_0x4413('0x42')]);_0x25b909['query']=_[_0x4413('0x48')](_0x185b46[_0x4413('0x47')]);_0x25b909[_0x4413('0x49')]=_[_0x4413('0x4b')](_0x25b909['model'],_0x25b909[_0x4413('0x47')]);_0xd524c1[_0x4413('0x4a')]=_[_0x4413('0x4b')](_0x25b909['model'],qs[_0x4413('0x4c')](_0x185b46['query'][_0x4413('0x4c')]));_0xd524c1[_0x4413('0x4a')]=_0xd524c1[_0x4413('0x4a')]['length']?_0xd524c1[_0x4413('0x4a')]:_0x25b909[_0x4413('0x46')];if(_0x185b46[_0x4413('0x47')]['includeAll']){_0xd524c1['include']=[{'all':!![]}];}_0xd524c1=_[_0x4413('0x55')]({},_0xd524c1,_0x185b46[_0x4413('0x5a')]);return db[_0x4413('0x41')][_0x4413('0x5b')](_0xd524c1)[_0x4413('0x24')](handleEntityNotFound(_0x52d8bc,null))[_0x4413('0x24')](respondWithResult(_0x52d8bc,null))[_0x4413('0x2e')](handleError(_0x52d8bc,null));};exports[_0x4413('0x5c')]=function(_0x42fd67,_0x322b5a){return db[_0x4413('0x41')]['create'](_0x42fd67['body'],{})[_0x4413('0x24')](respondWithResult(_0x322b5a,0xc9))[_0x4413('0x2e')](handleError(_0x322b5a,null));};exports[_0x4413('0x39')]=function(_0xe9f437,_0x2d1c09){if(_0xe9f437[_0x4413('0x5d')]['id']){delete _0xe9f437[_0x4413('0x5d')]['id'];}return db[_0x4413('0x41')][_0x4413('0x5b')]({'where':{'id':_0xe9f437[_0x4413('0x59')]['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x2d1c09,null))[_0x4413('0x24')](saveUpdates(_0xe9f437[_0x4413('0x5d')],null))[_0x4413('0x24')](respondWithResult(_0x2d1c09,null))[_0x4413('0x2e')](handleError(_0x2d1c09,null));};exports[_0x4413('0x3a')]=function(_0x3c65eb,_0x6aaefd){return db[_0x4413('0x41')][_0x4413('0x5b')]({'where':{'id':_0x3c65eb[_0x4413('0x59')]['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x6aaefd,null))['then'](removeEntity(_0x6aaefd,null))[_0x4413('0x2e')](handleError(_0x6aaefd,null));};exports['describe']=function(_0x1cab2f,_0x57a86a){return db['ChatMessage'][_0x4413('0x5e')]()['then'](respondWithResult(_0x57a86a,null))[_0x4413('0x2e')](handleError(_0x57a86a,null));};var interaction_log=require(_0x4413('0x17'))('chat-interactions');exports[_0x4413('0x5f')]=function(_0x277070,_0x2578a7,_0x5a4bff){var _0x10bffa={'agent':{},'channel':_0x4413('0x60')};if(_0x277070['body']['id']){delete _0x277070[_0x4413('0x5d')]['id'];}_0x277070[_0x4413('0x5d')]['read']=!![];_0x277070[_0x4413('0x5d')][_0x4413('0x61')]=moment()[_0x4413('0x62')](_0x4413('0x63'));_0x277070[_0x4413('0x5d')][_0x4413('0x64')]=_0x277070[_0x4413('0x5d')][_0x4413('0x64')]||_0x277070[_0x4413('0x65')]['id'];_0x10bffa[_0x4413('0x66')]['id']=_0x277070[_0x4413('0x5d')][_0x4413('0x64')];return db[_0x4413('0x41')]['find']({'where':{'id':_0x277070[_0x4413('0x59')]['id'],'UserId':null}})[_0x4413('0x24')](handleEntityNotFound(_0x2578a7,null))[_0x4413('0x24')](saveUpdates(_0x277070[_0x4413('0x5d')],null))[_0x4413('0x24')](function(_0x49bf2c){if(_0x49bf2c){_0x10bffa['message']=_0x49bf2c[_0x4413('0x67')]({'plain':!![]});return db[_0x4413('0x68')][_0x4413('0x5b')]({'where':{'id':_0x49bf2c[_0x4413('0x69')]}});}return null;})[_0x4413('0x24')](handleEntityNotFound(_0x2578a7,null))[_0x4413('0x24')](function(_0x5c9a22){if(_0x5c9a22){return _0x5c9a22['update']({'UserId':_0x277070[_0x4413('0x5d')]['UserId'],'read1stAt':_['isNil'](_0x5c9a22['read1stAt'])?moment()[_0x4413('0x62')](_0x4413('0x63')):undefined});}return null;})['then'](function(_0x2b1883){if(_0x2b1883){_0x10bffa['interaction']=_0x2b1883[_0x4413('0x67')]({'plain':!![]});interaction_log[_0x4413('0x25')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x277070[_0x4413('0x65')]['id'],_0x277070[_0x4413('0x65')][_0x4413('0x3e')],_0x277070[_0x4413('0x65')][_0x4413('0x6a')],_0x10bffa[_0x4413('0x6b')]['id'],_0x277070[_0x4413('0x5d')]?JSON[_0x4413('0x29')](_0x277070[_0x4413('0x5d')]):_0x4413('0x6c'));return respondWithRpcPromise(_0x4413('0x6d'),_0x4413('0x6e'),_0x10bffa);}return null;})[_0x4413('0x24')](function(_0xc95074){var _0x2e9541=_0x4413('0x6f')+_0xc95074[_0x4413('0x2b')][_0x4413('0x70')];return db[_0x4413('0x71')]['query'](_0x2e9541,{'type':db[_0x4413('0x72')][_0x4413('0x73')]['SELECT'],'raw':!![]})[_0x4413('0x24')](function(_0x4baf00){return _0x4baf00;});})[_0x4413('0x24')](function(_0x43114b){if(_0x43114b){_0x10bffa[_0x4413('0x2b')][_0x4413('0x74')]=_0x43114b[0x0];if(!_0x277070[_0x4413('0x5d')][_0x4413('0x64')])return;return db['User'][_0x4413('0x5b')]({'where':{'id':_0x277070['body'][_0x4413('0x64')],'role':_0x4413('0x66')},'attributes':['id','name',_0x4413('0x75'),'email','internal'],'raw':!![]});}return null;})[_0x4413('0x24')](function(_0x2736dc){if(!_0x2736dc)return null;_0x10bffa[_0x4413('0x2b')][_0x4413('0x66')]=_0x2736dc;return _0x10bffa;})[_0x4413('0x24')](function(_0x35165a){if(_0x35165a){if(_0x277070['body']['manual']){_0x10bffa['message'][_0x4413('0x76')]=util[_0x4413('0x62')](_0x4413('0x77'),_0x277070[_0x4413('0x65')][_0x4413('0x3e')]);_0x10bffa['message']['channel']=_0x10bffa['channel'];_0x10bffa[_0x4413('0x2b')][_0x4413('0x78')]=_0x10bffa[_0x4413('0x79')];_0x10bffa[_0x4413('0x2b')][_0x4413('0x7a')]=_0x4413('0x5f');return respondWithRpcPromise(_0x4413('0x7b'),_0x4413('0x7b'),{'event':_0x4413('0x7c'),'message':_[_0x4413('0x55')](_0x10bffa[_0x4413('0x2b')],JSON[_0x4413('0x7d')](_0x10bffa[_0x4413('0x6b')]['formData']))},client9002)[_0x4413('0x24')](function(){return _0x10bffa;});}return _0x10bffa;}return null;})['then'](respondWithResult(_0x2578a7,null))[_0x4413('0x2e')](handleError(_0x2578a7,null));};var interaction_log=require('../../config/logger')(_0x4413('0x7e'));exports[_0x4413('0x37')]=function(_0x24ee95,_0x25411e,_0x1ec83c){var _0x184f71={'agent':{},'channel':_0x4413('0x60')};if(_0x24ee95[_0x4413('0x5d')]['id']){delete _0x24ee95[_0x4413('0x5d')]['id'];}_0x24ee95[_0x4413('0x5d')][_0x4413('0x64')]=_0x24ee95[_0x4413('0x5d')][_0x4413('0x64')]||_0x24ee95[_0x4413('0x65')]['id'];_0x184f71[_0x4413('0x66')]['id']=_0x24ee95['body'][_0x4413('0x64')];return db[_0x4413('0x41')][_0x4413('0x5b')]({'where':{'id':_0x24ee95['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x25411e,null))['then'](function(_0x58d9a3){if(_0x58d9a3){_0x184f71['message']=_0x58d9a3[_0x4413('0x67')]({'plain':!![]});return db[_0x4413('0x68')][_0x4413('0x5b')]({'where':{'id':_0x58d9a3[_0x4413('0x69')]}});}return null;})[_0x4413('0x24')](handleEntityNotFound(_0x25411e,null))[_0x4413('0x24')](function(_0x3b21e1){if(_0x3b21e1){_0x184f71[_0x4413('0x6b')]=_0x3b21e1[_0x4413('0x67')]({'plain':!![]});interaction_log['info'](_0x4413('0x7f'),_0x24ee95[_0x4413('0x65')]['id'],_0x24ee95[_0x4413('0x65')][_0x4413('0x3e')],_0x24ee95['user'][_0x4413('0x6a')],_0x184f71[_0x4413('0x6b')]['id'],_0x24ee95[_0x4413('0x5d')]?JSON['stringify'](_0x24ee95[_0x4413('0x5d')]):'null');return respondWithRpcPromise(_0x4413('0x80'),_0x4413('0x81'),_0x184f71);}return null;})['then'](function(_0x1164e1){var _0x11b455=_0x4413('0x6f')+_0x1164e1[_0x4413('0x2b')][_0x4413('0x70')];return db[_0x4413('0x71')][_0x4413('0x47')](_0x11b455,{'type':db[_0x4413('0x72')][_0x4413('0x73')][_0x4413('0x82')],'raw':!![]})[_0x4413('0x24')](function(_0x445df9){return _0x445df9;});})[_0x4413('0x24')](function(_0x136063){if(_0x136063){_0x184f71[_0x4413('0x2b')][_0x4413('0x74')]=_0x136063[0x0];if(!_0x24ee95[_0x4413('0x5d')][_0x4413('0x64')])return;return db[_0x4413('0x83')][_0x4413('0x5b')]({'where':{'id':_0x24ee95['body'][_0x4413('0x64')],'role':'agent'},'attributes':['id','name',_0x4413('0x75'),_0x4413('0x84'),_0x4413('0x85')],'raw':!![]});}return null;})[_0x4413('0x24')](function(_0x127830){if(!_0x127830)return null;_0x184f71[_0x4413('0x2b')][_0x4413('0x66')]=_0x127830;return _0x184f71;})[_0x4413('0x24')](function(_0x3363bd){if(_0x3363bd){_0x3363bd['message'][_0x4413('0x76')]=util[_0x4413('0x62')](_0x4413('0x77'),_0x24ee95[_0x4413('0x65')][_0x4413('0x3e')]);_0x3363bd[_0x4413('0x2b')][_0x4413('0x79')]=_0x184f71['channel'];_0x3363bd[_0x4413('0x2b')]['motionChannel']=_0x184f71[_0x4413('0x79')];_0x3363bd['message'][_0x4413('0x7a')]=_0x4413('0x37');respondWithRpcPromise('EventManager',_0x4413('0x7b'),{'event':'rejectmessage','message':_[_0x4413('0x55')](_0x184f71[_0x4413('0x2b')],JSON[_0x4413('0x7d')](_0x184f71[_0x4413('0x6b')][_0x4413('0x86')]))},client9002);return _0x184f71;}return null;})[_0x4413('0x24')](respondWithResult(_0x25411e,null))[_0x4413('0x2e')](handleError(_0x25411e,null));}; \ No newline at end of file +var _0x219e=['../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','find','create','body','params','describe','../../config/logger','accept','chat','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions','RejectMessage','sequelize','Sequelize','SELECT','formData','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api'];(function(_0xcd3e25,_0x3778c5){var _0x7164ce=function(_0x360b82){while(--_0x360b82){_0xcd3e25['push'](_0xcd3e25['shift']());}};_0x7164ce(++_0x3778c5);}(_0x219e,0x172));var _0xe219=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x219e[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0xe219('0x0'));var rimraf=require(_0xe219('0x1'));var zipdir=require(_0xe219('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe219('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe219('0x4'));var util=require(_0xe219('0x5'));var path=require(_0xe219('0x6'));var sox=require(_0xe219('0x7'));var csv=require('to-csv');var ejs=require(_0xe219('0x8'));var fs=require('fs');var fs_extra=require(_0xe219('0x9'));var _=require(_0xe219('0xa'));var squel=require(_0xe219('0xb'));var crypto=require('crypto');var jsforce=require(_0xe219('0xc'));var deskjs=require(_0xe219('0xd'));var toCsv=require(_0xe219('0xe'));var querystring=require(_0xe219('0xf'));var Papa=require(_0xe219('0x10'));var Redis=require(_0xe219('0x11'));var authService=require(_0xe219('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe219('0x13'));var utils=require(_0xe219('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe219('0x15'))['db'];config[_0xe219('0x16')]=_[_0xe219('0x17')](config[_0xe219('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe219('0x18'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xe219('0x19')](socket);var jayson=require(_0xe219('0x1a'));var client=jayson[_0xe219('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xe219('0x1b')][_0xe219('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1cc791,_0x37fcc6,_0x121059,_0x1c6aea){return new BPromise(function(_0x28f9e4,_0x6ea9be){var _0x3c78ad=_0x1c6aea||client;return _0x3c78ad[_0xe219('0x1d')](_0x1cc791,_0x121059)['then'](function(_0x5adbe9){logger[_0xe219('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x37fcc6,_0xe219('0x1f'));logger[_0xe219('0x20')](_0xe219('0x21'),_0x37fcc6,'request\x20sent',JSON[_0xe219('0x22')](_0x5adbe9));if(_0x5adbe9['error']){if(_0x5adbe9[_0xe219('0x23')][_0xe219('0x24')]===0x1f4){logger['error'](_0xe219('0x25'),_0x37fcc6,_0x5adbe9[_0xe219('0x23')][_0xe219('0x26')]);return _0x6ea9be(_0x5adbe9['error'][_0xe219('0x26')]);}logger[_0xe219('0x23')](_0xe219('0x25'),_0x37fcc6,_0x5adbe9['error'][_0xe219('0x26')]);return _0x28f9e4(_0x5adbe9['error'][_0xe219('0x26')]);}else{logger[_0xe219('0x1e')](_0xe219('0x25'),_0x37fcc6,_0xe219('0x1f'));_0x28f9e4(_0x5adbe9[_0xe219('0x27')][_0xe219('0x26')]);}})[_0xe219('0x28')](function(_0x1dab92){logger['error'](_0xe219('0x25'),_0x37fcc6,_0x1dab92);_0x6ea9be(_0x1dab92);});});}function respondWithStatusCode(_0x1483b6,_0x2adb15){_0x2adb15=_0x2adb15||0xcc;return function(_0x73611e){if(_0x73611e){return _0x1483b6[_0xe219('0x29')](_0x2adb15);}return _0x1483b6[_0xe219('0x2a')](_0x2adb15)[_0xe219('0x2b')]();};}function respondWithResult(_0x319763,_0x43d2b0){_0x43d2b0=_0x43d2b0||0xc8;return function(_0x145082){if(_0x145082){return _0x319763[_0xe219('0x2a')](_0x43d2b0)[_0xe219('0x2c')](_0x145082);}};}function respondWithFilteredResult(_0x1aee9e,_0x2b042a){return function(_0x8ea90){if(_0x8ea90){var _0x4ce0bc=typeof _0x2b042a['offset']===_0xe219('0x2d')&&typeof _0x2b042a[_0xe219('0x2e')]===_0xe219('0x2d');var _0x1367b3=_0x8ea90[_0xe219('0x2f')];var _0x173e3b=_0x4ce0bc?0x0:_0x2b042a[_0xe219('0x30')];var _0x58d368=_0x4ce0bc?_0x8ea90[_0xe219('0x2f')]:_0x2b042a[_0xe219('0x30')]+_0x2b042a[_0xe219('0x2e')];var _0x4cc639;if(_0x58d368>=_0x1367b3){_0x58d368=_0x1367b3;_0x4cc639=0xc8;}else{_0x4cc639=0xce;}_0x1aee9e[_0xe219('0x2a')](_0x4cc639);return _0x1aee9e[_0xe219('0x31')](_0xe219('0x32'),_0x173e3b+'-'+_0x58d368+'/'+_0x1367b3)[_0xe219('0x2c')](_0x8ea90);}return null;};}function patchUpdates(_0x2f5b25){return function(_0x38e4fe){try{jsonpatch[_0xe219('0x33')](_0x38e4fe,_0x2f5b25,!![]);}catch(_0xab7136){return BPromise[_0xe219('0x34')](_0xab7136);}return _0x38e4fe[_0xe219('0x35')]();};}function saveUpdates(_0x29bc4b,_0x3a43de){return function(_0xd7cc54){if(_0xd7cc54){return _0xd7cc54[_0xe219('0x36')](_0x29bc4b)['then'](function(_0x3e9115){return _0x3e9115;});}return null;};}function removeEntity(_0x4120ff,_0x57b40a){return function(_0x2294a4){if(_0x2294a4){return _0x2294a4['destroy']()[_0xe219('0x37')](function(){_0x4120ff[_0xe219('0x2a')](0xcc)[_0xe219('0x2b')]();});}};}function handleEntityNotFound(_0x4462d3,_0x1d7845){return function(_0x58a4cf){if(!_0x58a4cf){_0x4462d3[_0xe219('0x29')](0x194);}return _0x58a4cf;};}function handleError(_0x4225a7,_0xe66907){_0xe66907=_0xe66907||0x1f4;return function(_0x368798){logger[_0xe219('0x23')](_0x368798[_0xe219('0x38')]);if(_0x368798[_0xe219('0x39')]){delete _0x368798['name'];}_0x4225a7[_0xe219('0x2a')](_0xe66907)['send'](_0x368798);};}exports[_0xe219('0x3a')]=function(_0x3ea303,_0x1f5ef4){var _0x409003={},_0x46d55f={},_0x35c4a8={'count':0x0,'rows':[]};var _0x5ef2ea=_[_0xe219('0x3b')](db[_0xe219('0x3c')][_0xe219('0x3d')],function(_0x2eedaf){return{'name':_0x2eedaf[_0xe219('0x3e')],'type':_0x2eedaf[_0xe219('0x3f')][_0xe219('0x40')]};});_0x46d55f[_0xe219('0x41')]=_[_0xe219('0x3b')](_0x5ef2ea,_0xe219('0x39'));_0x46d55f[_0xe219('0x42')]=_[_0xe219('0x43')](_0x3ea303[_0xe219('0x42')]);_0x46d55f[_0xe219('0x44')]=_[_0xe219('0x45')](_0x46d55f[_0xe219('0x41')],_0x46d55f[_0xe219('0x42')]);_0x409003[_0xe219('0x46')]=_[_0xe219('0x45')](_0x46d55f[_0xe219('0x41')],qs[_0xe219('0x47')](_0x3ea303[_0xe219('0x42')][_0xe219('0x47')]));_0x409003[_0xe219('0x46')]=_0x409003['attributes'][_0xe219('0x48')]?_0x409003[_0xe219('0x46')]:_0x46d55f['model'];if(!_0x3ea303[_0xe219('0x42')]['hasOwnProperty'](_0xe219('0x49'))){_0x409003['limit']=qs[_0xe219('0x2e')](_0x3ea303[_0xe219('0x42')][_0xe219('0x2e')]);_0x409003[_0xe219('0x30')]=qs[_0xe219('0x30')](_0x3ea303[_0xe219('0x42')]['offset']);}_0x409003[_0xe219('0x4a')]=qs['sort'](_0x3ea303['query'][_0xe219('0x4b')]);_0x409003[_0xe219('0x4c')]=qs[_0xe219('0x44')](_[_0xe219('0x4d')](_0x3ea303[_0xe219('0x42')],_0x46d55f[_0xe219('0x44')]),_0x5ef2ea);if(_0x3ea303['query'][_0xe219('0x4e')]){_0x409003[_0xe219('0x4c')]=_[_0xe219('0x4f')](_0x409003[_0xe219('0x4c')],{'$or':_[_0xe219('0x3b')](_0x5ef2ea,function(_0x5767c5){if(_0x5767c5[_0xe219('0x3f')]!=='VIRTUAL'){var _0x44547a={};_0x44547a[_0x5767c5[_0xe219('0x39')]]={'$like':'%'+_0x3ea303[_0xe219('0x42')][_0xe219('0x4e')]+'%'};return _0x44547a;}})});}_0x409003=_[_0xe219('0x4f')]({},_0x409003,_0x3ea303[_0xe219('0x50')]);var _0x2be226={'where':_0x409003[_0xe219('0x4c')]};return db[_0xe219('0x3c')][_0xe219('0x2f')](_0x2be226)[_0xe219('0x37')](function(_0x2675b2){_0x35c4a8[_0xe219('0x2f')]=_0x2675b2;if(_0x3ea303[_0xe219('0x42')][_0xe219('0x51')]){_0x409003[_0xe219('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0xe219('0x53')](_0x409003);})['then'](function(_0x96ae8a){_0x35c4a8['rows']=_0x96ae8a;return _0x35c4a8;})['then'](respondWithFilteredResult(_0x1f5ef4,_0x409003))[_0xe219('0x28')](handleError(_0x1f5ef4,null));};exports[_0xe219('0x54')]=function(_0x241532,_0x5e6053){var _0x35f9e5={'raw':!![],'where':{'id':_0x241532['params']['id']}},_0x56c9b9={};_0x56c9b9[_0xe219('0x41')]=_[_0xe219('0x43')](db['ChatMessage'][_0xe219('0x3d')]);_0x56c9b9[_0xe219('0x42')]=_[_0xe219('0x43')](_0x241532[_0xe219('0x42')]);_0x56c9b9[_0xe219('0x44')]=_[_0xe219('0x45')](_0x56c9b9[_0xe219('0x41')],_0x56c9b9[_0xe219('0x42')]);_0x35f9e5['attributes']=_['intersection'](_0x56c9b9[_0xe219('0x41')],qs[_0xe219('0x47')](_0x241532[_0xe219('0x42')][_0xe219('0x47')]));_0x35f9e5[_0xe219('0x46')]=_0x35f9e5[_0xe219('0x46')][_0xe219('0x48')]?_0x35f9e5[_0xe219('0x46')]:_0x56c9b9[_0xe219('0x41')];if(_0x241532[_0xe219('0x42')][_0xe219('0x51')]){_0x35f9e5[_0xe219('0x52')]=[{'all':!![]}];}_0x35f9e5=_[_0xe219('0x4f')]({},_0x35f9e5,_0x241532['options']);return db[_0xe219('0x3c')][_0xe219('0x55')](_0x35f9e5)[_0xe219('0x37')](handleEntityNotFound(_0x5e6053,null))['then'](respondWithResult(_0x5e6053,null))[_0xe219('0x28')](handleError(_0x5e6053,null));};exports[_0xe219('0x56')]=function(_0x2108b5,_0x595b49){return db['ChatMessage'][_0xe219('0x56')](_0x2108b5['body'],{})[_0xe219('0x37')](respondWithResult(_0x595b49,0xc9))[_0xe219('0x28')](handleError(_0x595b49,null));};exports['update']=function(_0x14fd8b,_0x19a671){if(_0x14fd8b[_0xe219('0x57')]['id']){delete _0x14fd8b[_0xe219('0x57')]['id'];}return db['ChatMessage'][_0xe219('0x55')]({'where':{'id':_0x14fd8b['params']['id']}})[_0xe219('0x37')](handleEntityNotFound(_0x19a671,null))[_0xe219('0x37')](saveUpdates(_0x14fd8b['body'],null))[_0xe219('0x37')](respondWithResult(_0x19a671,null))[_0xe219('0x28')](handleError(_0x19a671,null));};exports['destroy']=function(_0x4ba463,_0x4f8949){return db[_0xe219('0x3c')][_0xe219('0x55')]({'where':{'id':_0x4ba463[_0xe219('0x58')]['id']}})[_0xe219('0x37')](handleEntityNotFound(_0x4f8949,null))['then'](removeEntity(_0x4f8949,null))['catch'](handleError(_0x4f8949,null));};exports[_0xe219('0x59')]=function(_0x374db7,_0x51ba18){return db[_0xe219('0x3c')]['describe']()[_0xe219('0x37')](respondWithResult(_0x51ba18,null))[_0xe219('0x28')](handleError(_0x51ba18,null));};var interaction_log=require(_0xe219('0x5a'))('chat-interactions');exports[_0xe219('0x5b')]=function(_0x1be055,_0x54ee10,_0xf8511e){var _0x6007ae={'agent':{},'channel':_0xe219('0x5c')};if(_0x1be055[_0xe219('0x57')]['id']){delete _0x1be055['body']['id'];}_0x1be055['body']['read']=!![];_0x1be055[_0xe219('0x57')][_0xe219('0x5d')]=moment()[_0xe219('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be055[_0xe219('0x57')][_0xe219('0x5f')]=_0x1be055[_0xe219('0x57')][_0xe219('0x5f')]||_0x1be055[_0xe219('0x60')]['id'];_0x6007ae[_0xe219('0x61')]['id']=_0x1be055[_0xe219('0x57')][_0xe219('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x1be055[_0xe219('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54ee10,null))[_0xe219('0x37')](saveUpdates(_0x1be055[_0xe219('0x57')],null))['then'](function(_0x248d58){if(_0x248d58){_0x6007ae[_0xe219('0x26')]=_0x248d58[_0xe219('0x62')]({'plain':!![]});return db[_0xe219('0x63')][_0xe219('0x55')]({'where':{'id':_0x248d58[_0xe219('0x64')]}});}return null;})[_0xe219('0x37')](handleEntityNotFound(_0x54ee10,null))[_0xe219('0x37')](function(_0x23725e){if(_0x23725e){return _0x23725e['update']({'UserId':_0x1be055[_0xe219('0x57')][_0xe219('0x5f')],'read1stAt':_[_0xe219('0x65')](_0x23725e[_0xe219('0x66')])?moment()[_0xe219('0x5e')](_0xe219('0x67')):undefined});}return null;})['then'](function(_0x439b6a){if(_0x439b6a){_0x6007ae[_0xe219('0x68')]=_0x439b6a['get']({'plain':!![]});interaction_log[_0xe219('0x1e')](_0xe219('0x69'),_0x1be055['user']['id'],_0x1be055['user'][_0xe219('0x39')],_0x1be055[_0xe219('0x60')][_0xe219('0x6a')],_0x6007ae[_0xe219('0x68')]['id'],_0x1be055['body']?JSON[_0xe219('0x22')](_0x1be055[_0xe219('0x57')]):_0xe219('0x6b'));return respondWithRpcPromise(_0xe219('0x6c'),_0xe219('0x6d'),_0x6007ae);}return null;})[_0xe219('0x37')](function(_0x1d882b){var _0xb615ea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d882b[_0xe219('0x26')]['ContactId'];return db['sequelize'][_0xe219('0x42')](_0xb615ea,{'type':db['Sequelize'][_0xe219('0x6e')]['SELECT'],'raw':!![]})[_0xe219('0x37')](function(_0x24703f){return _0x24703f;});})['then'](function(_0x197878){if(_0x197878){_0x6007ae[_0xe219('0x26')][_0xe219('0x6f')]=_0x197878[0x0];if(!_0x1be055[_0xe219('0x57')][_0xe219('0x5f')])return;return db[_0xe219('0x70')][_0xe219('0x55')]({'where':{'id':_0x1be055[_0xe219('0x57')][_0xe219('0x5f')],'role':_0xe219('0x61')},'attributes':['id',_0xe219('0x39'),_0xe219('0x71'),_0xe219('0x72'),_0xe219('0x73')],'raw':!![]});}return null;})['then'](function(_0x27840a){if(!_0x27840a)return null;_0x6007ae[_0xe219('0x26')][_0xe219('0x61')]=_0x27840a;return _0x6007ae;})[_0xe219('0x37')](function(_0x20bee7){if(_0x20bee7){if(_0x1be055[_0xe219('0x57')]['manual']){_0x6007ae['message'][_0xe219('0x74')]=util[_0xe219('0x5e')](_0xe219('0x75'),_0x1be055[_0xe219('0x60')]['name']);_0x6007ae[_0xe219('0x26')][_0xe219('0x76')]=_0x6007ae['channel'];_0x6007ae['message'][_0xe219('0x77')]=_0x6007ae['channel'];_0x6007ae[_0xe219('0x26')][_0xe219('0x78')]='accept';return respondWithRpcPromise(_0xe219('0x79'),_0xe219('0x79'),{'event':_0xe219('0x7a'),'message':_[_0xe219('0x4f')](_0x6007ae['message'],JSON[_0xe219('0x7b')](_0x6007ae[_0xe219('0x68')]['formData']))},client9002)['then'](function(){return _0x6007ae;});}return _0x6007ae;}return null;})[_0xe219('0x37')](respondWithResult(_0x54ee10,null))['catch'](handleError(_0x54ee10,null));};var interaction_log=require(_0xe219('0x5a'))(_0xe219('0x7c'));exports[_0xe219('0x34')]=function(_0x5bdb8e,_0x3c9e92,_0x519d69){var _0x13a16c={'agent':{},'channel':_0xe219('0x5c')};if(_0x5bdb8e[_0xe219('0x57')]['id']){delete _0x5bdb8e[_0xe219('0x57')]['id'];}_0x5bdb8e['body'][_0xe219('0x5f')]=_0x5bdb8e['body'][_0xe219('0x5f')]||_0x5bdb8e['user']['id'];_0x13a16c[_0xe219('0x61')]['id']=_0x5bdb8e[_0xe219('0x57')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x5bdb8e[_0xe219('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c9e92,null))[_0xe219('0x37')](function(_0x329050){if(_0x329050){_0x13a16c[_0xe219('0x26')]=_0x329050[_0xe219('0x62')]({'plain':!![]});return db[_0xe219('0x63')]['find']({'where':{'id':_0x329050['ChatInteractionId']}});}return null;})[_0xe219('0x37')](handleEntityNotFound(_0x3c9e92,null))[_0xe219('0x37')](function(_0x43a2e1){if(_0x43a2e1){_0x13a16c[_0xe219('0x68')]=_0x43a2e1[_0xe219('0x62')]({'plain':!![]});interaction_log[_0xe219('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5bdb8e[_0xe219('0x60')]['id'],_0x5bdb8e[_0xe219('0x60')][_0xe219('0x39')],_0x5bdb8e[_0xe219('0x60')][_0xe219('0x6a')],_0x13a16c[_0xe219('0x68')]['id'],_0x5bdb8e[_0xe219('0x57')]?JSON[_0xe219('0x22')](_0x5bdb8e[_0xe219('0x57')]):_0xe219('0x6b'));return respondWithRpcPromise(_0xe219('0x7d'),'rejectMessage',_0x13a16c);}return null;})['then'](function(_0x49d161){var _0x4075ac='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49d161[_0xe219('0x26')]['ContactId'];return db[_0xe219('0x7e')][_0xe219('0x42')](_0x4075ac,{'type':db[_0xe219('0x7f')][_0xe219('0x6e')][_0xe219('0x80')],'raw':!![]})['then'](function(_0x7e46cb){return _0x7e46cb;});})[_0xe219('0x37')](function(_0x47a05e){if(_0x47a05e){_0x13a16c[_0xe219('0x26')][_0xe219('0x6f')]=_0x47a05e[0x0];if(!_0x5bdb8e[_0xe219('0x57')][_0xe219('0x5f')])return;return db[_0xe219('0x70')][_0xe219('0x55')]({'where':{'id':_0x5bdb8e[_0xe219('0x57')][_0xe219('0x5f')],'role':'agent'},'attributes':['id',_0xe219('0x39'),_0xe219('0x71'),_0xe219('0x72'),_0xe219('0x73')],'raw':!![]});}return null;})[_0xe219('0x37')](function(_0x25a36c){if(!_0x25a36c)return null;_0x13a16c[_0xe219('0x26')][_0xe219('0x61')]=_0x25a36c;return _0x13a16c;})[_0xe219('0x37')](function(_0xbd40a9){if(_0xbd40a9){_0xbd40a9['message']['interface']=util[_0xe219('0x5e')]('SIP/%s',_0x5bdb8e[_0xe219('0x60')][_0xe219('0x39')]);_0xbd40a9['message'][_0xe219('0x76')]=_0x13a16c[_0xe219('0x76')];_0xbd40a9['message'][_0xe219('0x77')]=_0x13a16c[_0xe219('0x76')];_0xbd40a9[_0xe219('0x26')][_0xe219('0x78')]=_0xe219('0x34');respondWithRpcPromise(_0xe219('0x79'),'EventManager',{'event':'rejectmessage','message':_[_0xe219('0x4f')](_0x13a16c[_0xe219('0x26')],JSON[_0xe219('0x7b')](_0x13a16c[_0xe219('0x68')][_0xe219('0x81')]))},client9002);return _0x13a16c;}return null;})[_0xe219('0x37')](respondWithResult(_0x3c9e92,null))[_0xe219('0x28')](handleError(_0x3c9e92,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a13ae20..3fed642 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 _0xa0d0=['exports','../../mysqldb','ChatMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x5436a4,_0x34ebc3){var _0x4b04b5=function(_0x3941c3){while(--_0x3941c3){_0x5436a4['push'](_0x5436a4['shift']());}};_0x4b04b5(++_0x34ebc3);}(_0xa0d0,0x141));var _0x0a0d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa0d0[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0a0d('0x0'))['db'][_0x0a0d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0a0d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a0d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b807c){return function(_0x5e67be,_0x215a10,_0x1c97c0){ChatMessageEvents[_0x0a0d('0x4')](_0x4b807c+':'+_0x5e67be['id'],_0x5e67be);ChatMessageEvents[_0x0a0d('0x4')](_0x4b807c,_0x5e67be);_0x1c97c0(null);};}for(var e in events){if(events[_0x0a0d('0x5')](e)){var event=events[e];ChatMessage[_0x0a0d('0x6')](e,emitEvent(event));}}module[_0x0a0d('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xceeb=['remove','emit','hook','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x4b9488,_0x4544d2){var _0x5f59b8=function(_0x275d00){while(--_0x275d00){_0x4b9488['push'](_0x4b9488['shift']());}};_0x5f59b8(++_0x4544d2);}(_0xceeb,0xb3));var _0xbcee=function(_0x50e38a,_0x10ae4e){_0x50e38a=_0x50e38a-0x0;var _0x1c4785=_0xceeb[_0x50e38a];return _0x1c4785;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xbcee('0x0'))['db'][_0xbcee('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbcee('0x2')](0x0);var events={'afterCreate':_0xbcee('0x3'),'afterUpdate':_0xbcee('0x4'),'afterDestroy':_0xbcee('0x5')};function emitEvent(_0x41def0){return function(_0x27ef66,_0x5295d2,_0x51ed81){ChatMessageEvents[_0xbcee('0x6')](_0x41def0+':'+_0x27ef66['id'],_0x27ef66);ChatMessageEvents[_0xbcee('0x6')](_0x41def0,_0x27ef66);_0x51ed81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xbcee('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5262be6..2d409fd 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 _0xd609=['chat_messages','fti_chat_messages','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd609,0x10b));var _0x9d60=function(_0x3e5fc4,_0x4020d0){_0x3e5fc4=_0x3e5fc4-0x0;var _0x46a24f=_0xd609[_0x3e5fc4];return _0x46a24f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d60('0x0'))('api');var moment=require('moment');var BPromise=require(_0x9d60('0x1'));var rp=require(_0x9d60('0x2'));var fs=require('fs');var path=require(_0x9d60('0x3'));var rimraf=require(_0x9d60('0x4'));var config=require(_0x9d60('0x5'));var attributes=require('./chatMessage.attributes');module[_0x9d60('0x6')]=function(_0x43cabe,_0x43e863){return _0x43cabe[_0x9d60('0x7')]('ChatMessage',attributes,{'tableName':_0x9d60('0x8'),'paranoid':![],'indexes':[{'name':_0x9d60('0x9'),'fields':['body'],'type':_0x9d60('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ec976,_0x394c5a,_0x1e4777){var _0xea8934=_0x43cabe['models'];var _0x482528=_0x1ec976[_0x9d60('0xb')]({'plain':!![]});if(_0x482528['direction'][_0x9d60('0xc')]()==='in'||_0x482528[_0x9d60('0xd')]['toLowerCase']()===_0x9d60('0xe')&&!_0x482528[_0x9d60('0xf')]&&!_[_0x9d60('0x10')](_0x482528[_0x9d60('0x11')])){_0xea8934[_0x9d60('0x12')][_0x9d60('0x13')]({'where':{'id':_0x482528[_0x9d60('0x14')]}})[_0x9d60('0x15')](function(_0x1fe20d){if(_0x1fe20d){_0x1fe20d['update']({'lastMsgAt':_0x482528[_0x9d60('0x16')],'lastMsgDirection':_0x482528[_0x9d60('0xd')][_0x9d60('0xc')]()});}})[_0x9d60('0x17')](function(_0x5b080e){console['error'](_0x5b080e);});}_0x1e4777();}},'charset':_0x9d60('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdade=['then','utf8mb4','lodash','api','moment','path','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId'];(function(_0x5d61e3,_0x5dd19a){var _0xc18c02=function(_0x1809c2){while(--_0x1809c2){_0x5d61e3['push'](_0x5d61e3['shift']());}};_0xc18c02(++_0x5dd19a);}(_0xdade,0x1e6));var _0xedad=function(_0x2467b8,_0x584199){_0x2467b8=_0x2467b8-0x0;var _0x5d3095=_0xdade[_0x2467b8];return _0x5d3095;};'use strict';var _=require(_0xedad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xedad('0x1'));var moment=require(_0xedad('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xedad('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xedad('0x4'));module[_0xedad('0x5')]=function(_0x3ab906,_0x4df785){return _0x3ab906['define'](_0xedad('0x6'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xedad('0x7'),'fields':[_0xedad('0x8')],'type':_0xedad('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35df2d,_0x1486a0,_0x3f913e){var _0x4f5a21=_0x3ab906[_0xedad('0xa')];var _0x46d5f5=_0x35df2d[_0xedad('0xb')]({'plain':!![]});if(_0x46d5f5[_0xedad('0xc')][_0xedad('0xd')]()==='in'||_0x46d5f5[_0xedad('0xc')][_0xedad('0xd')]()===_0xedad('0xe')&&!_0x46d5f5[_0xedad('0xf')]&&!_[_0xedad('0x10')](_0x46d5f5[_0xedad('0x11')])){_0x4f5a21['ChatInteraction'][_0xedad('0x12')]({'where':{'id':_0x46d5f5[_0xedad('0x13')]}})[_0xedad('0x14')](function(_0x46074c){if(_0x46074c){_0x46074c['update']({'lastMsgAt':_0x46d5f5['createdAt'],'lastMsgDirection':_0x46d5f5[_0xedad('0xc')]['toLowerCase']()});}})['catch'](function(_0x31b750){console['error'](_0x31b750);});}_0x3f913e();}},'charset':_0xedad('0x15'),'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 eb0f9cc..2b5e621 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 _0xe27a=['error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatMessage.socket','register','request','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x49e132,_0xaf827a){var _0x6403c2=function(_0x49888b){while(--_0x49888b){_0x49e132['push'](_0x49e132['shift']());}};_0x6403c2(++_0xaf827a);}(_0xe27a,0x6f));var _0xae27=function(_0x5d9089,_0x400e04){_0x5d9089=_0x5d9089-0x0;var _0x47191a=_0xe27a[_0x5d9089];return _0x47191a;};'use strict';var _=require(_0xae27('0x0'));var util=require(_0xae27('0x1'));var moment=require(_0xae27('0x2'));var BPromise=require(_0xae27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae27('0x5'));var logger=require(_0xae27('0x6'))(_0xae27('0x7'));var config=require(_0xae27('0x8'));var jayson=require(_0xae27('0x9'));var client=jayson['client'][_0xae27('0xa')]({'port':0x232a});config['redis']=_[_0xae27('0xb')](config[_0xae27('0xc')],{'host':_0xae27('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xae27('0xe'))[_0xae27('0xf')](socket);function respondWithRpcPromise(_0xea2711,_0x152b64,_0x18c9c6){return new BPromise(function(_0x49c7a4,_0x3050ca){return client[_0xae27('0x10')](_0xea2711,_0x18c9c6)['then'](function(_0x5529df){logger['info']('ChatMessage,\x20%s,\x20%s',_0x152b64,'request\x20sent');logger[_0xae27('0x11')](_0xae27('0x12'),_0x152b64,_0xae27('0x13'),JSON[_0xae27('0x14')](_0x5529df));if(_0x5529df[_0xae27('0x15')]){if(_0x5529df['error'][_0xae27('0x16')]===0x1f4){logger[_0xae27('0x15')](_0xae27('0x17'),_0x152b64,_0x5529df[_0xae27('0x15')][_0xae27('0x18')]);return _0x3050ca(_0x5529df['error'][_0xae27('0x18')]);}logger[_0xae27('0x15')]('ChatMessage,\x20%s,\x20%s',_0x152b64,_0x5529df['error'][_0xae27('0x18')]);return _0x49c7a4(_0x5529df[_0xae27('0x15')][_0xae27('0x18')]);}else{logger[_0xae27('0x19')](_0xae27('0x17'),_0x152b64,'request\x20sent');_0x49c7a4(_0x5529df[_0xae27('0x1a')][_0xae27('0x18')]);}})[_0xae27('0x1b')](function(_0x40d7af){logger[_0xae27('0x15')]('ChatMessage,\x20%s,\x20%s',_0x152b64,_0x40d7af);_0x3050ca(_0x40d7af);});});}exports[_0xae27('0x1c')]=function(_0x362370){var _0x3c876b=this;return new Promise(function(_0x3dbda2,_0x54d099){return db['ChatMessage']['create'](_0x362370[_0xae27('0x1d')],{'raw':_0x362370[_0xae27('0x1e')]?_0x362370[_0xae27('0x1e')][_0xae27('0x1f')]===undefined?!![]:![]:!![]})[_0xae27('0x20')](function(_0x588777){logger[_0xae27('0x19')]('CreateChatMessage',_0x362370);logger[_0xae27('0x11')](_0xae27('0x1c'),_0x362370,JSON[_0xae27('0x14')](_0x588777));_0x3dbda2(_0x588777);})[_0xae27('0x1b')](function(_0x10c90b){logger[_0xae27('0x15')](_0xae27('0x1c'),_0x10c90b[_0xae27('0x18')],_0x362370);_0x54d099(_0x3c876b[_0xae27('0x15')](0x1f4,_0x10c90b[_0xae27('0x18')]));});});}; \ No newline at end of file +var _0xf39e=['socket.io-emitter','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','then','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis','localhost'];(function(_0x437e08,_0x1cab6c){var _0xcf57f2=function(_0x2ef02e){while(--_0x2ef02e){_0x437e08['push'](_0x437e08['shift']());}};_0xcf57f2(++_0x1cab6c);}(_0xf39e,0x18b));var _0xef39=function(_0x258df0,_0x31ce33){_0x258df0=_0x258df0-0x0;var _0x2a96fe=_0xf39e[_0x258df0];return _0x2a96fe;};'use strict';var _=require(_0xef39('0x0'));var util=require(_0xef39('0x1'));var moment=require(_0xef39('0x2'));var BPromise=require('bluebird');var rs=require(_0xef39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef39('0x4'))['db'];var utils=require(_0xef39('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xef39('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xef39('0x7')]['http']({'port':0x232a});config['redis']=_[_0xef39('0x8')](config[_0xef39('0x9')],{'host':_0xef39('0xa'),'port':0x18eb});var socket=require(_0xef39('0xb'))(new Redis(config[_0xef39('0x9')]));require(_0xef39('0xc'))[_0xef39('0xd')](socket);function respondWithRpcPromise(_0x475324,_0x4f5bf0,_0x22dcab){return new BPromise(function(_0x7db2cb,_0x6b306c){return client['request'](_0x475324,_0x22dcab)['then'](function(_0x236ef4){logger[_0xef39('0xe')](_0xef39('0xf'),_0x4f5bf0,'request\x20sent');logger['debug'](_0xef39('0x10'),_0x4f5bf0,_0xef39('0x11'),JSON['stringify'](_0x236ef4));if(_0x236ef4[_0xef39('0x12')]){if(_0x236ef4[_0xef39('0x12')]['code']===0x1f4){logger[_0xef39('0x12')](_0xef39('0xf'),_0x4f5bf0,_0x236ef4[_0xef39('0x12')][_0xef39('0x13')]);return _0x6b306c(_0x236ef4[_0xef39('0x12')][_0xef39('0x13')]);}logger[_0xef39('0x12')]('ChatMessage,\x20%s,\x20%s',_0x4f5bf0,_0x236ef4[_0xef39('0x12')][_0xef39('0x13')]);return _0x7db2cb(_0x236ef4['error'][_0xef39('0x13')]);}else{logger['info'](_0xef39('0xf'),_0x4f5bf0,_0xef39('0x11'));_0x7db2cb(_0x236ef4[_0xef39('0x14')][_0xef39('0x13')]);}})[_0xef39('0x15')](function(_0x56d97a){logger[_0xef39('0x12')]('ChatMessage,\x20%s,\x20%s',_0x4f5bf0,_0x56d97a);_0x6b306c(_0x56d97a);});});}exports[_0xef39('0x16')]=function(_0x79c8b2){var _0x1fec7f=this;return new Promise(function(_0x1bc3e8,_0x6ab6eb){return db[_0xef39('0x17')][_0xef39('0x18')](_0x79c8b2['body'],{'raw':_0x79c8b2[_0xef39('0x19')]?_0x79c8b2['options'][_0xef39('0x1a')]===undefined?!![]:![]:!![]})[_0xef39('0x1b')](function(_0x211abe){logger[_0xef39('0xe')](_0xef39('0x16'),_0x79c8b2);logger[_0xef39('0x1c')](_0xef39('0x16'),_0x79c8b2,JSON['stringify'](_0x211abe));_0x1bc3e8(_0x211abe);})[_0xef39('0x15')](function(_0x40a942){logger['error'](_0xef39('0x16'),_0x40a942[_0xef39('0x13')],_0x79c8b2);_0x6ab6eb(_0x1fec7f['error'](0x1f4,_0x40a942[_0xef39('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 998c6d5..5ee359e 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 _0x9f5a=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x379e3e,_0x5a7950){var _0x367c49=function(_0x1e2c8e){while(--_0x1e2c8e){_0x379e3e['push'](_0x379e3e['shift']());}};_0x367c49(++_0x5a7950);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x1f3074,_0x526a33){_0x1f3074=_0x1f3074-0x0;var _0x4c537f=_0x9f5a[_0x1f3074];return _0x4c537f;};'use strict';var ChatMessageEvents=require(_0xa9f5('0x0'));var events=[_0xa9f5('0x1'),_0xa9f5('0x2'),_0xa9f5('0x3')];function createListener(_0x546306,_0x4268b0){return function(_0x45e3f5){_0x4268b0[_0xa9f5('0x4')](_0x546306,_0x45e3f5);};}function removeListener(_0x4eeedd,_0x20f51f){return function(){ChatMessageEvents['removeListener'](_0x4eeedd,_0x20f51f);};}exports[_0xa9f5('0x5')]=function(_0x219e89){for(var _0x49e337=0x0,_0x6c040d=events[_0xa9f5('0x6')];_0x49e337<_0x6c040d;_0x49e337++){var _0x3f644f=events[_0x49e337];var _0x1f6c78=createListener(_0xa9f5('0x7')+_0x3f644f,_0x219e89);ChatMessageEvents['on'](_0x3f644f,_0x1f6c78);}}; \ No newline at end of file +var _0x448b=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x1f5738,_0x351b9d){var _0x4e0aa3=function(_0x21614f){while(--_0x21614f){_0x1f5738['push'](_0x1f5738['shift']());}};_0x4e0aa3(++_0x351b9d);}(_0x448b,0x125));var _0xb448=function(_0x4095ab,_0x5f0de7){_0x4095ab=_0x4095ab-0x0;var _0x54dcd0=_0x448b[_0x4095ab];return _0x54dcd0;};'use strict';var ChatMessageEvents=require(_0xb448('0x0'));var events=[_0xb448('0x1'),_0xb448('0x2'),_0xb448('0x3')];function createListener(_0x422fa2,_0x51583a){return function(_0x5bf7db){_0x51583a[_0xb448('0x4')](_0x422fa2,_0x5bf7db);};}function removeListener(_0x32bcae,_0x172a89){return function(){ChatMessageEvents[_0xb448('0x5')](_0x32bcae,_0x172a89);};}exports[_0xb448('0x6')]=function(_0x276466){for(var _0x3670cb=0x0,_0x5993ad=events[_0xb448('0x7')];_0x3670cb<_0x5993ad;_0x3670cb++){var _0x2f6f82=events[_0x3670cb];var _0x2c2bdd=createListener(_0xb448('0x8')+_0x2f6f82,_0x276466);ChatMessageEvents['on'](_0x2f6f82,_0x2c2bdd);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 990b0ee..5de8cb8 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 _0x35a8=['../../config/environment','isAuthenticated','index','get','/:id','post','tracked','chat','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x35a8,0x1c1));var _0x835a=function(_0x41915e,_0x40be18){_0x41915e=_0x41915e-0x0;var _0x507810=_0x35a8[_0x41915e];return _0x507810;};'use strict';var multer=require(_0x835a('0x0'));var util=require(_0x835a('0x1'));var path=require(_0x835a('0x2'));var timeout=require(_0x835a('0x3'));var express=require(_0x835a('0x4'));var router=express['Router']();var fs_extra=require(_0x835a('0x5'));var auth=require(_0x835a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x835a('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x835a('0x8')](),controller[_0x835a('0x9')]);router[_0x835a('0xa')]('/describe',auth[_0x835a('0x8')](),controller['describe']);router[_0x835a('0xa')](_0x835a('0xb'),auth[_0x835a('0x8')](),controller['show']);router[_0x835a('0xc')]('/',auth[_0x835a('0x8')](),interaction[_0x835a('0xd')](_0x835a('0xe'),'chatmessage:create'),controller[_0x835a('0xf')]);router[_0x835a('0x10')]('/:id',controller[_0x835a('0x11')]);router[_0x835a('0x10')]('/:id/accept',auth['isAuthenticated'](),controller[_0x835a('0x12')]);router[_0x835a('0x10')](_0x835a('0x13'),auth['isAuthenticated'](),controller[_0x835a('0x14')]);router[_0x835a('0x15')](_0x835a('0xb'),auth['isAuthenticated'](),controller[_0x835a('0x16')]);module[_0x835a('0x17')]=router; \ No newline at end of file +var _0x464d=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','chatmessage:create','create','update','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x177b7b,_0x319e32){var _0x54e536=function(_0x1d2f05){while(--_0x1d2f05){_0x177b7b['push'](_0x177b7b['shift']());}};_0x54e536(++_0x319e32);}(_0x464d,0x15e));var _0xd464=function(_0x2a71d2,_0x35bcda){_0x2a71d2=_0x2a71d2-0x0;var _0x200112=_0x464d[_0x2a71d2];return _0x200112;};'use strict';var multer=require('multer');var util=require(_0xd464('0x0'));var path=require(_0xd464('0x1'));var timeout=require(_0xd464('0x2'));var express=require('express');var router=express[_0xd464('0x3')]();var fs_extra=require(_0xd464('0x4'));var auth=require(_0xd464('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd464('0x6'));var controller=require(_0xd464('0x7'));router['get']('/',auth[_0xd464('0x8')](),controller[_0xd464('0x9')]);router[_0xd464('0xa')](_0xd464('0xb'),auth[_0xd464('0x8')](),controller[_0xd464('0xc')]);router[_0xd464('0xa')](_0xd464('0xd'),auth['isAuthenticated'](),controller[_0xd464('0xe')]);router['post']('/',auth[_0xd464('0x8')](),interaction[_0xd464('0xf')]('chat',_0xd464('0x10')),controller[_0xd464('0x11')]);router['put'](_0xd464('0xd'),controller[_0xd464('0x12')]);router['put']('/:id/accept',auth[_0xd464('0x8')](),controller[_0xd464('0x13')]);router['put'](_0xd464('0x14'),auth['isAuthenticated'](),controller[_0xd464('0x15')]);router[_0xd464('0x16')](_0xd464('0xd'),auth[_0xd464('0x8')](),controller[_0xd464('0x17')]);module[_0xd464('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b63e8ae..4cbefb6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['medium','sequelize','TEXT'];(function(_0x2ca200,_0x1e7fcd){var _0x4ef3d8=function(_0x3af46f){while(--_0x3af46f){_0x2ca200['push'](_0x2ca200['shift']());}};_0x4ef3d8(++_0x1e7fcd);}(_0xb10b,0x12a));var _0xbb10=function(_0x586115,_0x283bd2){_0x586115=_0x586115-0x0;var _0x221bac=_0xb10b[_0x586115];return _0x221bac;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x1f8e45,_0x386c27){var _0x41d697=function(_0x4d213b){while(--_0x4d213b){_0x1f8e45['push'](_0x1f8e45['shift']());}};_0x41d697(++_0x386c27);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0xb10b[_0x2f4d7f];return _0x147ba1;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cb503f2..222016f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1b4bdb,_0x2eb3da){var _0x2097ca=function(_0x282e2f){while(--_0x282e2f){_0x1b4bdb['push'](_0x1b4bdb['shift']());}};_0x2097ca(++_0x2eb3da);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x47561b,_0x5d97db){var _0x218acd=function(_0xd0d9ac){while(--_0xd0d9ac){_0x47561b['push'](_0x47561b['shift']());}};_0x218acd(++_0x5d97db);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 56b5908..c63d6d3 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3432=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3432,0x199));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x2343('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2343('0x1')](0x0);var events={'afterCreate':_0x2343('0x2'),'afterUpdate':_0x2343('0x3'),'afterDestroy':_0x2343('0x4')};function emitEvent(_0x54139b){return function(_0x3a26d0,_0x5d47b3,_0x27eecc){ChatOfflineMessageEvents['emit'](_0x54139b+':'+_0x3a26d0['id'],_0x3a26d0);ChatOfflineMessageEvents[_0x2343('0x5')](_0x54139b,_0x3a26d0);_0x27eecc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x2343('0x6')](e,emitEvent(event));}}module[_0x2343('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xd035=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x376ed9,_0x10d4c0){var _0x1cb970=function(_0xb9f837){while(--_0xb9f837){_0x376ed9['push'](_0x376ed9['shift']());}};_0x1cb970(++_0x10d4c0);}(_0xd035,0xdc));var _0x5d03=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0xd035[_0xdd0313];return _0x2bd7e8;};'use strict';var EventEmitter=require(_0x5d03('0x0'));var ChatOfflineMessage=require(_0x5d03('0x1'))['db'][_0x5d03('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5d03('0x3')](0x0);var events={'afterCreate':_0x5d03('0x4'),'afterUpdate':_0x5d03('0x5'),'afterDestroy':_0x5d03('0x6')};function emitEvent(_0x433e55){return function(_0x112aa1,_0x3c0aba,_0x33ddd8){ChatOfflineMessageEvents[_0x5d03('0x7')](_0x433e55+':'+_0x112aa1['id'],_0x112aa1);ChatOfflineMessageEvents['emit'](_0x433e55,_0x112aa1);_0x33ddd8(null);};}for(var e in events){if(events[_0x5d03('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x5d03('0x9')](e,emitEvent(event));}}module[_0x5d03('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 13f0ee4..48b75d2 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 _0xef19=['./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x33e4bb,_0x29c467){var _0x1be299=function(_0x1fbf59){while(--_0x1fbf59){_0x33e4bb['push'](_0x33e4bb['shift']());}};_0x1be299(++_0x29c467);}(_0xef19,0x162));var _0x9ef1=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0xef19[_0x3a8db5];return _0x2c03cd;};'use strict';var attributes=require(_0x9ef1('0x0'));module[_0x9ef1('0x1')]=function(_0x55a85c){return _0x55a85c['define'](_0x9ef1('0x2'),attributes,{'tableName':_0x9ef1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ef1('0x4'),'collate':_0x9ef1('0x5')});}; \ No newline at end of file +var _0xf5c8=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf5c8,0xd1));var _0x8f5c=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xf5c8[_0x211632];return _0x5a1da1;};'use strict';var attributes=require(_0x8f5c('0x0'));module['exports']=function(_0x52db7b){return _0x52db7b['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f5c('0x1'),'collate':_0x8f5c('0x2')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 9d4f0cf..7c30969 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 _0x2882=['request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x1f0e64,_0x97f73f){var _0xab203c=function(_0x16a85a){while(--_0x16a85a){_0x1f0e64['push'](_0x1f0e64['shift']());}};_0xab203c(++_0x97f73f);}(_0x2882,0x1db));var _0x2288=function(_0x2b0a75,_0x9c00a4){_0x2b0a75=_0x2b0a75-0x0;var _0x29e278=_0x2882[_0x2b0a75];return _0x29e278;};'use strict';var _=require(_0x2288('0x0'));var util=require('util');var moment=require(_0x2288('0x1'));var BPromise=require(_0x2288('0x2'));var rs=require(_0x2288('0x3'));var fs=require('fs');var Redis=require(_0x2288('0x4'));var db=require(_0x2288('0x5'))['db'];var utils=require(_0x2288('0x6'));var logger=require(_0x2288('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x162771,_0x35acd6,_0x2d84ff){return new BPromise(function(_0x5ea93d,_0x4d251b){return client['request'](_0x162771,_0x2d84ff)['then'](function(_0x42f1b0){logger[_0x2288('0x9')](_0x2288('0xa'),_0x35acd6,_0x2288('0xb'));logger[_0x2288('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x35acd6,_0x2288('0xb'),JSON['stringify'](_0x42f1b0));if(_0x42f1b0['error']){if(_0x42f1b0[_0x2288('0xd')][_0x2288('0xe')]===0x1f4){logger[_0x2288('0xd')](_0x2288('0xa'),_0x35acd6,_0x42f1b0[_0x2288('0xd')][_0x2288('0xf')]);return _0x4d251b(_0x42f1b0[_0x2288('0xd')][_0x2288('0xf')]);}logger[_0x2288('0xd')](_0x2288('0xa'),_0x35acd6,_0x42f1b0[_0x2288('0xd')]['message']);return _0x5ea93d(_0x42f1b0[_0x2288('0xd')][_0x2288('0xf')]);}else{logger[_0x2288('0x9')](_0x2288('0xa'),_0x35acd6,_0x2288('0xb'));_0x5ea93d(_0x42f1b0[_0x2288('0x10')][_0x2288('0xf')]);}})[_0x2288('0x11')](function(_0x39805d){logger['error'](_0x2288('0xa'),_0x35acd6,_0x39805d);_0x4d251b(_0x39805d);});});} \ No newline at end of file +var _0xa4c2=['http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1a9740,_0x3cfd32){var _0x383ff6=function(_0x1dd73c){while(--_0x1dd73c){_0x1a9740['push'](_0x1a9740['shift']());}};_0x383ff6(++_0x3cfd32);}(_0xa4c2,0xc1));var _0x2a4c=function(_0x246694,_0x50cae1){_0x246694=_0x246694-0x0;var _0x38f821=_0xa4c2[_0x246694];return _0x38f821;};'use strict';var _=require(_0x2a4c('0x0'));var util=require('util');var moment=require(_0x2a4c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a4c('0x2'));var fs=require('fs');var Redis=require(_0x2a4c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2a4c('0x4'))('rpc');var config=require(_0x2a4c('0x5'));var jayson=require(_0x2a4c('0x6'));var client=jayson['client'][_0x2a4c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d2511,_0x9f8993,_0x41dfad){return new BPromise(function(_0x1f86e5,_0x25f1d3){return client['request'](_0x3d2511,_0x41dfad)[_0x2a4c('0x8')](function(_0x37f2c4){logger[_0x2a4c('0x9')](_0x2a4c('0xa'),_0x9f8993,_0x2a4c('0xb'));logger[_0x2a4c('0xc')](_0x2a4c('0xd'),_0x9f8993,'request\x20sent',JSON[_0x2a4c('0xe')](_0x37f2c4));if(_0x37f2c4['error']){if(_0x37f2c4['error'][_0x2a4c('0xf')]===0x1f4){logger[_0x2a4c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x9f8993,_0x37f2c4[_0x2a4c('0x10')][_0x2a4c('0x11')]);return _0x25f1d3(_0x37f2c4['error'][_0x2a4c('0x11')]);}logger['error'](_0x2a4c('0xa'),_0x9f8993,_0x37f2c4['error'][_0x2a4c('0x11')]);return _0x1f86e5(_0x37f2c4[_0x2a4c('0x10')]['message']);}else{logger[_0x2a4c('0x9')](_0x2a4c('0xa'),_0x9f8993,'request\x20sent');_0x1f86e5(_0x37f2c4[_0x2a4c('0x12')][_0x2a4c('0x11')]);}})[_0x2a4c('0x13')](function(_0x47921d){logger[_0x2a4c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x9f8993,_0x47921d);_0x25f1d3(_0x47921d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 8eec4fd..cb2edb0 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 _0x23b5=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x149383,_0x1ced93){var _0x3d1893=function(_0x778422){while(--_0x778422){_0x149383['push'](_0x149383['shift']());}};_0x3d1893(++_0x1ced93);}(_0x23b5,0x104));var _0x523b=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x23b5[_0xf168d3];return _0x17fb54;};'use strict';var multer=require('multer');var util=require(_0x523b('0x0'));var path=require(_0x523b('0x1'));var timeout=require('connect-timeout');var express=require(_0x523b('0x2'));var router=express[_0x523b('0x3')]();var fs_extra=require(_0x523b('0x4'));var auth=require(_0x523b('0x5'));var interaction=require(_0x523b('0x6'));var config=require(_0x523b('0x7'));var controller=require(_0x523b('0x8'));router[_0x523b('0x9')]('/',auth[_0x523b('0xa')](),controller[_0x523b('0xb')]);router['get'](_0x523b('0xc'),auth[_0x523b('0xa')](),controller['describe']);router[_0x523b('0x9')](_0x523b('0xd'),auth[_0x523b('0xa')](),controller['show']);router['post']('/',auth[_0x523b('0xa')](),controller[_0x523b('0xe')]);router[_0x523b('0xf')](_0x523b('0xd'),auth[_0x523b('0xa')](),controller[_0x523b('0x10')]);router['delete'](_0x523b('0xd'),auth['isAuthenticated'](),controller[_0x523b('0x11')]);module[_0x523b('0x12')]=router; \ No newline at end of file +var _0x824c=['create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x342628,_0xf4352e){var _0x3affa7=function(_0x179e0c){while(--_0x179e0c){_0x342628['push'](_0x342628['shift']());}};_0x3affa7(++_0xf4352e);}(_0x824c,0x6d));var _0xc824=function(_0x2b6730,_0x1bab44){_0x2b6730=_0x2b6730-0x0;var _0x5b6403=_0x824c[_0x2b6730];return _0x5b6403;};'use strict';var multer=require(_0xc824('0x0'));var util=require(_0xc824('0x1'));var path=require(_0xc824('0x2'));var timeout=require(_0xc824('0x3'));var express=require(_0xc824('0x4'));var router=express['Router']();var fs_extra=require(_0xc824('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc824('0x6'));var config=require(_0xc824('0x7'));var controller=require(_0xc824('0x8'));router[_0xc824('0x9')]('/',auth[_0xc824('0xa')](),controller[_0xc824('0xb')]);router[_0xc824('0x9')](_0xc824('0xc'),auth[_0xc824('0xa')](),controller[_0xc824('0xd')]);router[_0xc824('0x9')](_0xc824('0xe'),auth[_0xc824('0xa')](),controller[_0xc824('0xf')]);router[_0xc824('0x10')]('/',auth[_0xc824('0xa')](),controller[_0xc824('0x11')]);router[_0xc824('0x12')](_0xc824('0xe'),auth[_0xc824('0xa')](),controller['update']);router[_0xc824('0x13')]('/:id',auth[_0xc824('0xa')](),controller[_0xc824('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 83a1b0b..f463d89 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 _0x793c=['timeout','INTEGER','exports','STRING','mouseOver'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x793c,0x124));var _0xc793=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x793c[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require('sequelize');module[_0xc793('0x0')]={'name':{'type':Sequelize[_0xc793('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc793('0x2'),_0xc793('0x3')),'defaultValue':_0xc793('0x2')},'selector':{'type':Sequelize[_0xc793('0x1')]},'timeout':{'type':Sequelize[_0xc793('0x4')]}}; \ No newline at end of file +var _0x9c1f=['sequelize','exports','STRING','mouseOver','timeout','INTEGER'];(function(_0x3aa2f5,_0x286fa0){var _0x43cf17=function(_0x7695f5){while(--_0x7695f5){_0x3aa2f5['push'](_0x3aa2f5['shift']());}};_0x43cf17(++_0x286fa0);}(_0x9c1f,0xa2));var _0xf9c1=function(_0x1a6ef7,_0x6bb449){_0x1a6ef7=_0x1a6ef7-0x0;var _0x4f0d4b=_0x9c1f[_0x1a6ef7];return _0x4f0d4b;};'use strict';var Sequelize=require(_0xf9c1('0x0'));module[_0xf9c1('0x1')]={'name':{'type':Sequelize[_0xf9c1('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf9c1('0x3'),_0xf9c1('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xf9c1('0x2')]},'timeout':{'type':Sequelize[_0xf9c1('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index aff85bb..e6f63b3 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 _0x6726=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','error','name','params','keys','rawAttributes','query','filters','model','intersection','fields','attributes','length','include','options','ChatProactiveAction','find','catch','body','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x90795c,_0x1ddffe){var _0x51a942=function(_0x3eb04d){while(--_0x3eb04d){_0x90795c['push'](_0x90795c['shift']());}};_0x51a942(++_0x1ddffe);}(_0x6726,0xdb));var _0x6672=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x6726[_0x15fc7a];return _0x3aa9f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6672('0x0'));var zipdir=require(_0x6672('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6672('0x2'));var moment=require(_0x6672('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6672('0x4'));var util=require('util');var path=require(_0x6672('0x5'));var sox=require(_0x6672('0x6'));var csv=require(_0x6672('0x7'));var ejs=require(_0x6672('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6672('0x9'));var squel=require(_0x6672('0xa'));var crypto=require(_0x6672('0xb'));var jsforce=require(_0x6672('0xc'));var deskjs=require(_0x6672('0xd'));var toCsv=require(_0x6672('0x7'));var querystring=require(_0x6672('0xe'));var Papa=require(_0x6672('0xf'));var Redis=require(_0x6672('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6672('0x11'));var as=require(_0x6672('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6672('0x13'))(_0x6672('0x14'));var utils=require(_0x6672('0x15'));var config=require(_0x6672('0x16'));var licenseUtil=require(_0x6672('0x17'));var db=require(_0x6672('0x18'))['db'];function respondWithStatusCode(_0x182b77,_0x2dbf18){_0x2dbf18=_0x2dbf18||0xcc;return function(_0x2ec0bd){if(_0x2ec0bd){return _0x182b77['sendStatus'](_0x2dbf18);}return _0x182b77[_0x6672('0x19')](_0x2dbf18)[_0x6672('0x1a')]();};}function respondWithResult(_0x3e45de,_0x40f310){_0x40f310=_0x40f310||0xc8;return function(_0x1e3eb0){if(_0x1e3eb0){return _0x3e45de[_0x6672('0x19')](_0x40f310)[_0x6672('0x1b')](_0x1e3eb0);}};}function respondWithFilteredResult(_0x514097,_0xbf2cce){return function(_0x3261c9){if(_0x3261c9){var _0x46b6cb=typeof _0xbf2cce[_0x6672('0x1c')]===_0x6672('0x1d')&&typeof _0xbf2cce[_0x6672('0x1e')]===_0x6672('0x1d');var _0x184a79=_0x3261c9['count'];var _0x1a6d2a=_0x46b6cb?0x0:_0xbf2cce[_0x6672('0x1c')];var _0x344300=_0x46b6cb?_0x3261c9[_0x6672('0x1f')]:_0xbf2cce['offset']+_0xbf2cce[_0x6672('0x1e')];var _0x52b617;if(_0x344300>=_0x184a79){_0x344300=_0x184a79;_0x52b617=0xc8;}else{_0x52b617=0xce;}_0x514097[_0x6672('0x19')](_0x52b617);return _0x514097['set'](_0x6672('0x20'),_0x1a6d2a+'-'+_0x344300+'/'+_0x184a79)[_0x6672('0x1b')](_0x3261c9);}return null;};}function patchUpdates(_0x50e8c2){return function(_0x636fed){try{jsonpatch[_0x6672('0x21')](_0x636fed,_0x50e8c2,!![]);}catch(_0x3c23d5){return BPromise['reject'](_0x3c23d5);}return _0x636fed['save']();};}function saveUpdates(_0x1b221c,_0x12fa16){return function(_0x255212){if(_0x255212){return _0x255212[_0x6672('0x22')](_0x1b221c)[_0x6672('0x23')](function(_0xd2d057){return _0xd2d057;});}return null;};}function removeEntity(_0x35e285,_0x124bb5){return function(_0x1252de){if(_0x1252de){return _0x1252de[_0x6672('0x24')]()[_0x6672('0x23')](function(){_0x35e285[_0x6672('0x19')](0xcc)[_0x6672('0x1a')]();});}};}function handleEntityNotFound(_0x1c2886,_0x387614){return function(_0x37e76e){if(!_0x37e76e){_0x1c2886[_0x6672('0x25')](0x194);}return _0x37e76e;};}function handleError(_0x19d58c,_0x1f4c29){_0x1f4c29=_0x1f4c29||0x1f4;return function(_0x4ed516){logger[_0x6672('0x26')](_0x4ed516['stack']);if(_0x4ed516[_0x6672('0x27')]){delete _0x4ed516['name'];}_0x19d58c[_0x6672('0x19')](_0x1f4c29)['send'](_0x4ed516);};}exports['show']=function(_0x4fcd14,_0x302306){var _0x39da71={'raw':!![],'where':{'id':_0x4fcd14[_0x6672('0x28')]['id']}},_0x2a3e42={};_0x2a3e42['model']=_[_0x6672('0x29')](db['ChatProactiveAction'][_0x6672('0x2a')]);_0x2a3e42[_0x6672('0x2b')]=_[_0x6672('0x29')](_0x4fcd14['query']);_0x2a3e42[_0x6672('0x2c')]=_['intersection'](_0x2a3e42[_0x6672('0x2d')],_0x2a3e42['query']);_0x39da71['attributes']=_[_0x6672('0x2e')](_0x2a3e42[_0x6672('0x2d')],qs[_0x6672('0x2f')](_0x4fcd14[_0x6672('0x2b')][_0x6672('0x2f')]));_0x39da71[_0x6672('0x30')]=_0x39da71[_0x6672('0x30')][_0x6672('0x31')]?_0x39da71[_0x6672('0x30')]:_0x2a3e42[_0x6672('0x2d')];if(_0x4fcd14[_0x6672('0x2b')]['includeAll']){_0x39da71[_0x6672('0x32')]=[{'all':!![]}];}_0x39da71=_['merge']({},_0x39da71,_0x4fcd14[_0x6672('0x33')]);return db[_0x6672('0x34')][_0x6672('0x35')](_0x39da71)['then'](handleEntityNotFound(_0x302306,null))[_0x6672('0x23')](respondWithResult(_0x302306,null))[_0x6672('0x36')](handleError(_0x302306,null));};exports['create']=function(_0x4c5849,_0x4fbe1a){return db['ChatProactiveAction']['create'](_0x4c5849['body'],{})['then'](respondWithResult(_0x4fbe1a,0xc9))[_0x6672('0x36')](handleError(_0x4fbe1a,null));};exports[_0x6672('0x22')]=function(_0x21571e,_0x3da7b8){if(_0x21571e[_0x6672('0x37')]['id']){delete _0x21571e['body']['id'];}return db[_0x6672('0x34')][_0x6672('0x35')]({'where':{'id':_0x21571e['params']['id']}})[_0x6672('0x23')](handleEntityNotFound(_0x3da7b8,null))['then'](saveUpdates(_0x21571e[_0x6672('0x37')],null))['then'](respondWithResult(_0x3da7b8,null))['catch'](handleError(_0x3da7b8,null));};exports[_0x6672('0x24')]=function(_0x2856be,_0x53a382){return db[_0x6672('0x34')]['find']({'where':{'id':_0x2856be[_0x6672('0x28')]['id']}})[_0x6672('0x23')](handleEntityNotFound(_0x53a382,null))[_0x6672('0x23')](removeEntity(_0x53a382,null))['catch'](handleError(_0x53a382,null));}; \ No newline at end of file +var _0xce1a=['name','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create','body','find','params','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce1a,0xbf));var _0xace1=function(_0xdd5f90,_0x39278f){_0xdd5f90=_0xdd5f90-0x0;var _0x1df94d=_0xce1a[_0xdd5f90];return _0x1df94d;};'use strict';var emlformat=require(_0xace1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xace1('0x1'));var moment=require(_0xace1('0x2'));var BPromise=require(_0xace1('0x3'));var Mustache=require(_0xace1('0x4'));var util=require(_0xace1('0x5'));var path=require('path');var sox=require(_0xace1('0x6'));var csv=require('to-csv');var ejs=require(_0xace1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xace1('0x8'));var squel=require(_0xace1('0x9'));var crypto=require(_0xace1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xace1('0xb'));var querystring=require('querystring');var Papa=require(_0xace1('0xc'));var Redis=require(_0xace1('0xd'));var authService=require(_0xace1('0xe'));var qs=require(_0xace1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xace1('0x10'));var logger=require(_0xace1('0x11'))('api');var utils=require(_0xace1('0x12'));var config=require(_0xace1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d771,_0x2e1d19){_0x2e1d19=_0x2e1d19||0xcc;return function(_0x2f59f3){if(_0x2f59f3){return _0x56d771[_0xace1('0x14')](_0x2e1d19);}return _0x56d771['status'](_0x2e1d19)['end']();};}function respondWithResult(_0x4e8389,_0x319d1a){_0x319d1a=_0x319d1a||0xc8;return function(_0x18d9ce){if(_0x18d9ce){return _0x4e8389[_0xace1('0x15')](_0x319d1a)[_0xace1('0x16')](_0x18d9ce);}};}function respondWithFilteredResult(_0x248193,_0x303080){return function(_0x25114d){if(_0x25114d){var _0x6cc04e=typeof _0x303080['offset']==='undefined'&&typeof _0x303080[_0xace1('0x17')]===_0xace1('0x18');var _0x49cb73=_0x25114d[_0xace1('0x19')];var _0x162a79=_0x6cc04e?0x0:_0x303080[_0xace1('0x1a')];var _0x45541e=_0x6cc04e?_0x25114d[_0xace1('0x19')]:_0x303080['offset']+_0x303080['limit'];var _0x1781aa;if(_0x45541e>=_0x49cb73){_0x45541e=_0x49cb73;_0x1781aa=0xc8;}else{_0x1781aa=0xce;}_0x248193['status'](_0x1781aa);return _0x248193[_0xace1('0x1b')](_0xace1('0x1c'),_0x162a79+'-'+_0x45541e+'/'+_0x49cb73)[_0xace1('0x16')](_0x25114d);}return null;};}function patchUpdates(_0x4fe2ba){return function(_0x183941){try{jsonpatch[_0xace1('0x1d')](_0x183941,_0x4fe2ba,!![]);}catch(_0x4fce58){return BPromise[_0xace1('0x1e')](_0x4fce58);}return _0x183941[_0xace1('0x1f')]();};}function saveUpdates(_0xe0bda8,_0x41ab2b){return function(_0x484ac1){if(_0x484ac1){return _0x484ac1[_0xace1('0x20')](_0xe0bda8)[_0xace1('0x21')](function(_0x15f2fb){return _0x15f2fb;});}return null;};}function removeEntity(_0x324b52,_0x120c33){return function(_0x9ff8a0){if(_0x9ff8a0){return _0x9ff8a0[_0xace1('0x22')]()[_0xace1('0x21')](function(){_0x324b52[_0xace1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e99f5,_0x49cacb){return function(_0x937188){if(!_0x937188){_0x5e99f5[_0xace1('0x14')](0x194);}return _0x937188;};}function handleError(_0x4985b2,_0xe8723c){_0xe8723c=_0xe8723c||0x1f4;return function(_0x51ab2c){logger[_0xace1('0x23')](_0x51ab2c[_0xace1('0x24')]);if(_0x51ab2c[_0xace1('0x25')]){delete _0x51ab2c[_0xace1('0x25')];}_0x4985b2['status'](_0xe8723c)['send'](_0x51ab2c);};}exports[_0xace1('0x26')]=function(_0x455286,_0x1dacd0){var _0x2677da={'raw':!![],'where':{'id':_0x455286['params']['id']}},_0x4f52a9={};_0x4f52a9[_0xace1('0x27')]=_[_0xace1('0x28')](db[_0xace1('0x29')][_0xace1('0x2a')]);_0x4f52a9[_0xace1('0x2b')]=_[_0xace1('0x28')](_0x455286[_0xace1('0x2b')]);_0x4f52a9[_0xace1('0x2c')]=_[_0xace1('0x2d')](_0x4f52a9[_0xace1('0x27')],_0x4f52a9[_0xace1('0x2b')]);_0x2677da[_0xace1('0x2e')]=_[_0xace1('0x2d')](_0x4f52a9[_0xace1('0x27')],qs['fields'](_0x455286['query'][_0xace1('0x2f')]));_0x2677da['attributes']=_0x2677da[_0xace1('0x2e')][_0xace1('0x30')]?_0x2677da[_0xace1('0x2e')]:_0x4f52a9[_0xace1('0x27')];if(_0x455286[_0xace1('0x2b')][_0xace1('0x31')]){_0x2677da['include']=[{'all':!![]}];}_0x2677da=_[_0xace1('0x32')]({},_0x2677da,_0x455286[_0xace1('0x33')]);return db[_0xace1('0x29')]['find'](_0x2677da)['then'](handleEntityNotFound(_0x1dacd0,null))[_0xace1('0x21')](respondWithResult(_0x1dacd0,null))[_0xace1('0x34')](handleError(_0x1dacd0,null));};exports[_0xace1('0x35')]=function(_0x626aea,_0x37757a){return db[_0xace1('0x29')][_0xace1('0x35')](_0x626aea[_0xace1('0x36')],{})[_0xace1('0x21')](respondWithResult(_0x37757a,0xc9))[_0xace1('0x34')](handleError(_0x37757a,null));};exports[_0xace1('0x20')]=function(_0x3b6557,_0x374a11){if(_0x3b6557['body']['id']){delete _0x3b6557['body']['id'];}return db['ChatProactiveAction'][_0xace1('0x37')]({'where':{'id':_0x3b6557[_0xace1('0x38')]['id']}})['then'](handleEntityNotFound(_0x374a11,null))[_0xace1('0x21')](saveUpdates(_0x3b6557[_0xace1('0x36')],null))[_0xace1('0x21')](respondWithResult(_0x374a11,null))[_0xace1('0x34')](handleError(_0x374a11,null));};exports[_0xace1('0x22')]=function(_0x5308da,_0x5112dc){return db['ChatProactiveAction'][_0xace1('0x37')]({'where':{'id':_0x5308da[_0xace1('0x38')]['id']}})[_0xace1('0x21')](handleEntityNotFound(_0x5112dc,null))[_0xace1('0x21')](removeEntity(_0x5112dc,null))['catch'](handleError(_0x5112dc,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7a10ddc..6c45b58 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 _0x86c0=['bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x40e870,_0x36d230){var _0x39f73e=function(_0x4feb39){while(--_0x4feb39){_0x40e870['push'](_0x40e870['shift']());}};_0x39f73e(++_0x36d230);}(_0x86c0,0x181));var _0x086c=function(_0x29ecdd,_0x22df23){_0x29ecdd=_0x29ecdd-0x0;var _0x5718ee=_0x86c0[_0x29ecdd];return _0x5718ee;};'use strict';var _=require(_0x086c('0x0'));var util=require(_0x086c('0x1'));var logger=require(_0x086c('0x2'))(_0x086c('0x3'));var moment=require(_0x086c('0x4'));var BPromise=require(_0x086c('0x5'));var rp=require(_0x086c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x086c('0x7'));var config=require(_0x086c('0x8'));var attributes=require(_0x086c('0x9'));module[_0x086c('0xa')]=function(_0x46b7c9,_0x50f8e5){return _0x46b7c9[_0x086c('0xb')]('ChatProactiveAction',attributes,{'tableName':_0x086c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x504b=['moment','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x262baa,_0x283058){var _0x4f2257=function(_0x2cd1c6){while(--_0x2cd1c6){_0x262baa['push'](_0x262baa['shift']());}};_0x4f2257(++_0x283058);}(_0x504b,0x97));var _0xb504=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x504b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb504('0x0'));var util=require(_0xb504('0x1'));var logger=require(_0xb504('0x2'))('api');var moment=require(_0xb504('0x3'));var BPromise=require('bluebird');var rp=require(_0xb504('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb504('0x5'));var config=require(_0xb504('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0xb504('0x7')]=function(_0x6319e7,_0x2b6627){return _0x6319e7[_0xb504('0x8')](_0xb504('0x9'),attributes,{'tableName':_0xb504('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index a7dbd4a..2bc943e 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 _0x9450=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x1f9f0e,_0x27547b){var _0x521d92=function(_0x5e0978){while(--_0x5e0978){_0x1f9f0e['push'](_0x1f9f0e['shift']());}};_0x521d92(++_0x27547b);}(_0x9450,0xcd));var _0x0945=function(_0x23ea67,_0x4774c3){_0x23ea67=_0x23ea67-0x0;var _0x234ff6=_0x9450[_0x23ea67];return _0x234ff6;};'use strict';var _=require(_0x0945('0x0'));var util=require('util');var moment=require(_0x0945('0x1'));var BPromise=require(_0x0945('0x2'));var rs=require(_0x0945('0x3'));var fs=require('fs');var Redis=require(_0x0945('0x4'));var db=require(_0x0945('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0945('0x6'))(_0x0945('0x7'));var config=require(_0x0945('0x8'));var jayson=require(_0x0945('0x9'));var client=jayson[_0x0945('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6127f,_0x200b8f,_0x2aad7c){return new BPromise(function(_0x17101b,_0x47e813){return client[_0x0945('0xb')](_0xe6127f,_0x2aad7c)[_0x0945('0xc')](function(_0x4779c7){logger[_0x0945('0xd')](_0x0945('0xe'),_0x200b8f,_0x0945('0xf'));logger[_0x0945('0x10')](_0x0945('0x11'),_0x200b8f,_0x0945('0xf'),JSON[_0x0945('0x12')](_0x4779c7));if(_0x4779c7['error']){if(_0x4779c7[_0x0945('0x13')]['code']===0x1f4){logger[_0x0945('0x13')](_0x0945('0xe'),_0x200b8f,_0x4779c7[_0x0945('0x13')][_0x0945('0x14')]);return _0x47e813(_0x4779c7[_0x0945('0x13')][_0x0945('0x14')]);}logger[_0x0945('0x13')](_0x0945('0xe'),_0x200b8f,_0x4779c7[_0x0945('0x13')][_0x0945('0x14')]);return _0x17101b(_0x4779c7[_0x0945('0x13')]['message']);}else{logger[_0x0945('0xd')](_0x0945('0xe'),_0x200b8f,'request\x20sent');_0x17101b(_0x4779c7[_0x0945('0x15')][_0x0945('0x14')]);}})['catch'](function(_0x3758ed){logger[_0x0945('0x13')](_0x0945('0xe'),_0x200b8f,_0x3758ed);_0x47e813(_0x3758ed);});});} \ No newline at end of file +var _0x663d=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c7ee5,_0x11bc4c){var _0x202a66=function(_0x1fe31d){while(--_0x1fe31d){_0x3c7ee5['push'](_0x3c7ee5['shift']());}};_0x202a66(++_0x11bc4c);}(_0x663d,0x1d2));var _0xd663=function(_0xdb94db,_0x281c43){_0xdb94db=_0xdb94db-0x0;var _0x567bdb=_0x663d[_0xdb94db];return _0x567bdb;};'use strict';var _=require(_0xd663('0x0'));var util=require(_0xd663('0x1'));var moment=require(_0xd663('0x2'));var BPromise=require(_0xd663('0x3'));var rs=require(_0xd663('0x4'));var fs=require('fs');var Redis=require(_0xd663('0x5'));var db=require(_0xd663('0x6'))['db'];var utils=require(_0xd663('0x7'));var logger=require(_0xd663('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd663('0x9')][_0xd663('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66a9b8,_0x2a6b93,_0x231932){return new BPromise(function(_0x407088,_0x159cc1){return client['request'](_0x66a9b8,_0x231932)[_0xd663('0xb')](function(_0x2b0244){logger[_0xd663('0xc')](_0xd663('0xd'),_0x2a6b93,_0xd663('0xe'));logger[_0xd663('0xf')](_0xd663('0x10'),_0x2a6b93,_0xd663('0xe'),JSON[_0xd663('0x11')](_0x2b0244));if(_0x2b0244[_0xd663('0x12')]){if(_0x2b0244[_0xd663('0x12')][_0xd663('0x13')]===0x1f4){logger[_0xd663('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a6b93,_0x2b0244[_0xd663('0x12')][_0xd663('0x14')]);return _0x159cc1(_0x2b0244[_0xd663('0x12')][_0xd663('0x14')]);}logger[_0xd663('0x12')](_0xd663('0xd'),_0x2a6b93,_0x2b0244[_0xd663('0x12')]['message']);return _0x407088(_0x2b0244[_0xd663('0x12')][_0xd663('0x14')]);}else{logger[_0xd663('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a6b93,_0xd663('0xe'));_0x407088(_0x2b0244[_0xd663('0x15')]['message']);}})['catch'](function(_0x59ea3d){logger[_0xd663('0x12')](_0xd663('0xd'),_0x2a6b93,_0x59ea3d);_0x159cc1(_0x59ea3d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 636eb86..6d2dfce 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 _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x2133a1,_0x561b0a){var _0x4773e7=function(_0x2f2008){while(--_0x2f2008){_0x2133a1['push'](_0x2133a1['shift']());}};_0x4773e7(++_0x561b0a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x37b196,_0x352342){_0x37b196=_0x37b196-0x0;var _0x1c0119=_0xdbf5[_0x37b196];return _0x1c0119;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3d43c4,_0x3e421b){var _0x382f66=function(_0x432e65){while(--_0x432e65){_0x3d43c4['push'](_0x3d43c4['shift']());}};_0x382f66(++_0x3e421b);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4345da9..8c57c95 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 _0x77ab=['sequelize','exports','name','STRING','ENUM','rrmemory','roundrobin'];(function(_0x2b232b,_0x74a60c){var _0x1b0e8f=function(_0x56d511){while(--_0x56d511){_0x2b232b['push'](_0x2b232b['shift']());}};_0x1b0e8f(++_0x74a60c);}(_0x77ab,0x181));var _0xb77a=function(_0x2c2897,_0x40e227){_0x2c2897=_0x2c2897-0x0;var _0x164e24=_0x77ab[_0x2c2897];return _0x164e24;};'use strict';var Sequelize=require(_0xb77a('0x0'));module[_0xb77a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb77a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb77a('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb77a('0x4')](_0xb77a('0x5'),'beepall',_0xb77a('0x6'))}}; \ No newline at end of file +var _0xf008=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x2e8f7b,_0x4121a7){var _0x398c1b=function(_0x104e13){while(--_0x104e13){_0x2e8f7b['push'](_0x2e8f7b['shift']());}};_0x398c1b(++_0x4121a7);}(_0xf008,0xfe));var _0x8f00=function(_0x2a47b5,_0x4d472c){_0x2a47b5=_0x2a47b5-0x0;var _0x1b6764=_0xf008[_0x2a47b5];return _0x1b6764;};'use strict';var Sequelize=require(_0x8f00('0x0'));module[_0x8f00('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f00('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f00('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f00('0x4')]('rrmemory',_0x8f00('0x5'),_0x8f00('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 95ab76f..2477b0c 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 _0x2621=['UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','getOptions','where','ChatQueue','include','query','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','ChatQueueId','filter','merge','options'];(function(_0xbec196,_0x1e46a6){var _0x10972b=function(_0x4da5f5){while(--_0x4da5f5){_0xbec196['push'](_0xbec196['shift']());}};_0x10972b(++_0x1e46a6);}(_0x2621,0x1ae));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x1262('0x0'));var util=require(_0x1262('0x1'));var _=require(_0x1262('0x2'));var squel=require('squel');var Redis=require(_0x1262('0x3'));var qs=require(_0x1262('0x4'));var logger=require(_0x1262('0x5'))(_0x1262('0x6'));var config=require(_0x1262('0x7'));var db=require(_0x1262('0x8'))['db'];config['redis']=_[_0x1262('0x9')](config[_0x1262('0xa')],{'host':_0x1262('0xb'),'port':0x18eb});var socket=require(_0x1262('0xc'))(new Redis(config[_0x1262('0xa')]));require(_0x1262('0xd'))[_0x1262('0xe')](socket);function respondWithStatusCode(_0x22a42c,_0x11dbc7){_0x11dbc7=_0x11dbc7||0xcc;return function(_0x5d94e1){if(_0x5d94e1){return _0x22a42c[_0x1262('0xf')](_0x11dbc7);}return _0x22a42c[_0x1262('0x10')](_0x11dbc7)[_0x1262('0x11')]();};}function respondWithResult(_0x42fa86,_0x2c5bb){_0x2c5bb=_0x2c5bb||0xc8;return function(_0x2b461e){if(_0x2b461e){return _0x42fa86[_0x1262('0x10')](_0x2c5bb)['json'](_0x2b461e);}};}function respondWithFilteredResult(_0x527a0b,_0xabf2f2){return function(_0x3658ba){if(_0x3658ba){var _0x346da9=typeof _0xabf2f2['offset']===_0x1262('0x12')&&typeof _0xabf2f2[_0x1262('0x13')]===_0x1262('0x12');var _0x464da8=_0x3658ba['count'];var _0x37df81=_0x346da9?0x0:_0xabf2f2[_0x1262('0x14')];var _0x25303d=_0x346da9?_0x3658ba[_0x1262('0x15')]:_0xabf2f2[_0x1262('0x14')]+_0xabf2f2['limit'];var _0x1ddea8;if(_0x25303d>=_0x464da8){_0x25303d=_0x464da8;_0x1ddea8=0xc8;}else{_0x1ddea8=0xce;}_0x527a0b['status'](_0x1ddea8);return _0x527a0b[_0x1262('0x16')](_0x1262('0x17'),_0x37df81+'-'+_0x25303d+'/'+_0x464da8)[_0x1262('0x18')](_0x3658ba);}return null;};}function saveUpdates(_0x58ecfe){return function(_0x40aa28){if(_0x40aa28){return _0x40aa28[_0x1262('0x19')](_0x58ecfe)[_0x1262('0x1a')](function(_0x552de1){return _0x552de1;});}return null;};}function removeEntity(_0x456016){return function(_0x237364){if(_0x237364){return _0x237364[_0x1262('0x1b')]()[_0x1262('0x1a')](function(){var _0x165514=_0x237364[_0x1262('0x1c')]({'plain':!![]});var _0x501710=_0x1262('0x1d');return db[_0x1262('0x1e')][_0x1262('0x1b')]({'where':{'type':_0x501710,'resourceId':_0x165514['id']}})['then'](function(){return _0x237364;});})['then'](function(){_0x456016[_0x1262('0x10')](0xcc)[_0x1262('0x11')]();});}};}function handleEntityNotFound(_0x3416dc){return function(_0x35ea8f){if(!_0x35ea8f){_0x3416dc['sendStatus'](0x194);}return _0x35ea8f;};}function handleError(_0x3a6c0f,_0x5aa7b){_0x5aa7b=_0x5aa7b||0x1f4;return function(_0x3e36b2){logger['error'](_0x3e36b2[_0x1262('0x1f')]);if(_0x3e36b2[_0x1262('0x20')]){delete _0x3e36b2[_0x1262('0x20')];}_0x3a6c0f[_0x1262('0x10')](_0x5aa7b)[_0x1262('0x21')](_0x3e36b2);};}exports[_0x1262('0x22')]=function(_0x1cd854,_0x5323b5){var _0x17e1bb={};var _0x1d9663={'count':0x0,'rows':[]};var _0xfa6d05=_[_0x1262('0x23')](db['ChatQueue'][_0x1262('0x24')],function(_0x2d0f55){return{'name':_0x2d0f55[_0x1262('0x25')],'type':_0x2d0f55['type']['key']};});_0x17e1bb=qs[_0x1262('0x26')](_0xfa6d05,_0x1cd854);var _0x5827cd={'where':_0x17e1bb[_0x1262('0x27')]};return db[_0x1262('0x28')][_0x1262('0x15')](_0x5827cd)[_0x1262('0x1a')](function(_0x1547a5){_0x1d9663[_0x1262('0x15')]=_0x1547a5;_0x17e1bb[_0x1262('0x29')]=qs[_0x1262('0x29')](_0x1cd854[_0x1262('0x2a')]);return db[_0x1262('0x28')]['findAll'](_0x17e1bb);})['then'](function(_0xe4191e){_0x1d9663[_0x1262('0x2b')]=_0xe4191e;return _0x1d9663;})[_0x1262('0x1a')](respondWithFilteredResult(_0x5323b5,_0x17e1bb))[_0x1262('0x2c')](handleError(_0x5323b5,null));};exports[_0x1262('0x2d')]=function(_0x22d240,_0x5aee9c){var _0x30d359={'raw':!![],'where':{'id':_0x22d240[_0x1262('0x2e')]['id']}},_0x22bc32={};_0x22bc32[_0x1262('0x2f')]=_[_0x1262('0x30')](db['ChatQueue'][_0x1262('0x24')]);_0x22bc32[_0x1262('0x2a')]=_[_0x1262('0x30')](_0x22d240[_0x1262('0x2a')]);_0x22bc32[_0x1262('0x31')]=_[_0x1262('0x32')](_0x22bc32[_0x1262('0x2f')],_0x22bc32[_0x1262('0x2a')]);_0x30d359['attributes']=_['intersection'](_0x22bc32[_0x1262('0x2f')],qs[_0x1262('0x33')](_0x22d240[_0x1262('0x2a')][_0x1262('0x33')]));_0x30d359[_0x1262('0x34')]=_0x30d359[_0x1262('0x34')][_0x1262('0x35')]?_0x30d359['attributes']:_0x22bc32['model'];if(_0x22d240[_0x1262('0x2a')][_0x1262('0x36')]){_0x30d359[_0x1262('0x29')]=[{'all':!![]}];}_0x30d359=_['merge']({},_0x30d359,_0x22d240['options']);return db[_0x1262('0x28')][_0x1262('0x37')](_0x30d359)[_0x1262('0x1a')](handleEntityNotFound(_0x5aee9c,null))[_0x1262('0x1a')](respondWithResult(_0x5aee9c,null))['catch'](handleError(_0x5aee9c,null));};exports[_0x1262('0x38')]=function(_0x47e35b,_0x104cb3){return db[_0x1262('0x28')][_0x1262('0x38')](_0x47e35b[_0x1262('0x39')],{})[_0x1262('0x1a')](function(_0x17323c){var _0x11da5e=_0x47e35b[_0x1262('0x3a')]['get']({'plain':!![]});if(!_0x11da5e)throw new Error(_0x1262('0x3b'));if(_0x11da5e['role']===_0x1262('0x3a')){var _0x20edd7=_0x17323c[_0x1262('0x1c')]({'plain':!![]});var _0xd61cf='ChatQueues';return db[_0x1262('0x3c')]['find']({'where':{'name':_0xd61cf,'userProfileId':_0x11da5e[_0x1262('0x3d')]},'raw':!![]})[_0x1262('0x1a')](function(_0x1d8a6c){if(_0x1d8a6c&&_0x1d8a6c['autoAssociation']===0x0){return db[_0x1262('0x1e')][_0x1262('0x38')]({'name':_0x20edd7[_0x1262('0x20')],'resourceId':_0x20edd7['id'],'type':_0x1d8a6c[_0x1262('0x20')],'sectionId':_0x1d8a6c['id']},{})[_0x1262('0x1a')](function(){return _0x17323c;});}else{return _0x17323c;}})[_0x1262('0x2c')](function(_0x4dd62a){logger[_0x1262('0x3e')](_0x1262('0x3f'),_0x4dd62a);throw _0x4dd62a;});}return _0x17323c;})[_0x1262('0x1a')](respondWithResult(_0x104cb3,0xc9))[_0x1262('0x2c')](handleError(_0x104cb3,null));};exports[_0x1262('0x19')]=function(_0x414739,_0xe7f9f4){if(_0x414739[_0x1262('0x39')]['id']){delete _0x414739['body']['id'];}return db[_0x1262('0x28')][_0x1262('0x37')]({'where':{'id':_0x414739[_0x1262('0x2e')]['id']}})['then'](handleEntityNotFound(_0xe7f9f4,null))[_0x1262('0x1a')](saveUpdates(_0x414739[_0x1262('0x39')],null))[_0x1262('0x1a')](respondWithResult(_0xe7f9f4,null))[_0x1262('0x2c')](handleError(_0xe7f9f4,null));};exports[_0x1262('0x1b')]=function(_0x5c20c0,_0xfe19e4){return db[_0x1262('0x28')][_0x1262('0x37')]({'where':{'id':_0x5c20c0[_0x1262('0x2e')]['id']}})[_0x1262('0x1a')](handleEntityNotFound(_0xfe19e4,null))[_0x1262('0x1a')](removeEntity(_0xfe19e4,null))[_0x1262('0x2c')](handleError(_0xfe19e4,null));};exports[_0x1262('0x40')]=function(_0x564c13,_0xde2a6c){return db[_0x1262('0x28')][_0x1262('0x40')]()['then'](respondWithResult(_0xde2a6c,null))[_0x1262('0x2c')](handleError(_0xde2a6c,null));};exports[_0x1262('0x41')]=function(_0x5a647f,_0x1a6b88){var _0xa832bc={'raw':!![],'where':{}},_0x5d0be3={},_0x3f0f25;return db[_0x1262('0x28')][_0x1262('0x42')]({'where':{'id':_0x5a647f[_0x1262('0x2e')]['id']}})[_0x1262('0x1a')](handleEntityNotFound(_0x1a6b88,null))[_0x1262('0x1a')](function(_0x5afcbc){if(_0x5afcbc){_0x3f0f25=_0x5afcbc[_0x1262('0x1c')]({'plain':!![]});_0x5d0be3[_0x1262('0x2f')]=_[_0x1262('0x30')](db['UserChatQueue'][_0x1262('0x24')]);_0x5d0be3[_0x1262('0x2a')]=_[_0x1262('0x30')](_0x5a647f['query']);_0x5d0be3[_0x1262('0x31')]=_[_0x1262('0x32')](_0x5d0be3[_0x1262('0x2f')],_0x5d0be3[_0x1262('0x2a')]);_0xa832bc['attributes']=_[_0x1262('0x32')](_0x5d0be3[_0x1262('0x2f')],qs['fields'](_0x5a647f[_0x1262('0x2a')]['fields']));_0xa832bc['attributes']=_0xa832bc['attributes'][_0x1262('0x35')]?_0xa832bc[_0x1262('0x34')]:_0x5d0be3[_0x1262('0x2f')];if(!_0x5a647f[_0x1262('0x2a')][_0x1262('0x43')]('nolimit')){_0xa832bc[_0x1262('0x13')]=qs[_0x1262('0x13')](_0x5a647f['query'][_0x1262('0x13')]);_0xa832bc[_0x1262('0x14')]=qs[_0x1262('0x14')](_0x5a647f['query'][_0x1262('0x14')]);}_0xa832bc[_0x1262('0x44')]=qs[_0x1262('0x45')](_0x5a647f[_0x1262('0x2a')][_0x1262('0x45')]);_0xa832bc[_0x1262('0x27')]=qs[_0x1262('0x31')](_['pick'](_0x5a647f[_0x1262('0x2a')],_0x5d0be3[_0x1262('0x31')]));_0xa832bc[_0x1262('0x27')][_0x1262('0x46')]=_0x5afcbc['id'];if(_0x5a647f[_0x1262('0x2a')][_0x1262('0x47')]){_0xa832bc[_0x1262('0x27')]=_['merge'](_0xa832bc[_0x1262('0x27')],{'$or':_[_0x1262('0x23')](_0xa832bc[_0x1262('0x34')],function(_0x32e6db){var _0x2f5c9f={};_0x2f5c9f[_0x32e6db]={'$like':'%'+_0x5a647f[_0x1262('0x2a')]['filter']+'%'};return _0x2f5c9f;})});}_0xa832bc=_[_0x1262('0x48')]({},_0xa832bc,_0x5a647f[_0x1262('0x49')]);return db[_0x1262('0x4a')][_0x1262('0x4b')](_0xa832bc);}})[_0x1262('0x1a')](function(_0x42611d){if(_0x42611d){return db[_0x1262('0x4c')][_0x1262('0x4d')]({'where':{'id':_[_0x1262('0x23')](_0x42611d,_0x1262('0x4e')),'role':_0x1262('0x4f')},'attributes':['id','name',_0x1262('0x50'),_0x1262('0x51'),_0x1262('0x52')]});}})[_0x1262('0x1a')](function(_0x4f6c9c){if(_0x4f6c9c){return{'count':_0x4f6c9c['count'],'rows':_[_0x1262('0x23')](_0x4f6c9c[_0x1262('0x2b')],function(_0x3c03d9){return{'membername':_0x3c03d9[_0x1262('0x20')],'UserId':_0x3c03d9['id'],'queue_name':_0x3f0f25[_0x1262('0x20')],'ChatQueueId':_0x3f0f25['id'],'interface':util[_0x1262('0x53')]('%s/%s',_0x1262('0x54'),_0x3c03d9[_0x1262('0x20')]),'penalty':0x0,'paused':_0x3c03d9[_0x1262('0x50')],'createdAt':_0x3c03d9[_0x1262('0x52')],'updatedAt':_0x3c03d9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1262('0x1a')](respondWithFilteredResult(_0x1a6b88,_0xa832bc))['catch'](handleError(_0x1a6b88,null));};exports[_0x1262('0x55')]=function(_0x3843e2,_0x5bdc87){var _0x40bd54={};var _0x825a42={};var _0x320490;var _0x5607f1;return db['ChatQueue'][_0x1262('0x42')]({'where':{'id':_0x3843e2['params']['id']}})['then'](handleEntityNotFound(_0x5bdc87,null))[_0x1262('0x1a')](function(_0x1733e6){if(_0x1733e6){_0x320490=_0x1733e6;_0x825a42[_0x1262('0x2f')]=_[_0x1262('0x30')](db[_0x1262('0x56')][_0x1262('0x24')]);_0x825a42[_0x1262('0x2a')]=_[_0x1262('0x30')](_0x3843e2[_0x1262('0x2a')]);_0x825a42[_0x1262('0x31')]=_[_0x1262('0x32')](_0x825a42[_0x1262('0x2f')],_0x825a42['query']);_0x40bd54[_0x1262('0x34')]=_[_0x1262('0x32')](_0x825a42['model'],qs[_0x1262('0x33')](_0x3843e2[_0x1262('0x2a')][_0x1262('0x33')]));_0x40bd54[_0x1262('0x34')]=_0x40bd54[_0x1262('0x34')][_0x1262('0x35')]?_0x40bd54['attributes']:_0x825a42['model'];_0x40bd54[_0x1262('0x44')]=qs[_0x1262('0x45')](_0x3843e2[_0x1262('0x2a')]['sort']);_0x40bd54[_0x1262('0x27')]=qs[_0x1262('0x31')](_[_0x1262('0x57')](_0x3843e2['query'],_0x825a42[_0x1262('0x31')]));if(_0x3843e2['query'][_0x1262('0x47')]){_0x40bd54[_0x1262('0x27')]=_['merge'](_0x40bd54[_0x1262('0x27')],{'$or':_[_0x1262('0x23')](_0x40bd54[_0x1262('0x34')],function(_0x836849){var _0x2194a3={};_0x2194a3[_0x836849]={'$like':'%'+_0x3843e2[_0x1262('0x2a')][_0x1262('0x47')]+'%'};return _0x2194a3;})});}_0x40bd54=_[_0x1262('0x48')]({},_0x40bd54,_0x3843e2[_0x1262('0x49')]);return _0x320490[_0x1262('0x55')](_0x40bd54);}})['then'](function(_0x47c3da){if(_0x47c3da){_0x5607f1=_0x47c3da[_0x1262('0x35')];if(!_0x3843e2['query'][_0x1262('0x43')](_0x1262('0x58'))){_0x40bd54['limit']=qs['limit'](_0x3843e2[_0x1262('0x2a')][_0x1262('0x13')]);_0x40bd54[_0x1262('0x14')]=qs[_0x1262('0x14')](_0x3843e2[_0x1262('0x2a')][_0x1262('0x14')]);}return _0x320490[_0x1262('0x55')](_0x40bd54);}})['then'](function(_0x3e178f){if(_0x3e178f){return _0x3e178f?{'count':_0x5607f1,'rows':_0x3e178f}:null;}})[_0x1262('0x1a')](respondWithResult(_0x5bdc87,null))[_0x1262('0x2c')](handleError(_0x5bdc87,null));};exports[_0x1262('0x59')]=function(_0x3a8309,_0x248e4b){var _0x4363c2=_0x3a8309[_0x1262('0x39')][_0x1262('0x5a')];return db[_0x1262('0x56')][_0x1262('0x4b')]({'where':{'id':_0x4363c2},'attributes':['id'],'include':[{'model':db[_0x1262('0x4c')],'as':_0x1262('0x5b'),'attributes':['id',_0x1262('0x20'),_0x1262('0x5c'),_0x1262('0x5d'),_0x1262('0x5e')],'raw':!![]}]})[_0x1262('0x1a')](function(_0x242367){if(_0x242367){var _0x534fd9=_[_0x1262('0x5f')](_0x242367,function(_0x54fb80){var _0x142b6d=_0x54fb80[_0x1262('0x1c')]({'plain':!![]});return _0x142b6d[_0x1262('0x5b')];});return db[_0x1262('0x28')]['find']({'where':{'id':_0x3a8309[_0x1262('0x2e')]['id']}})['then'](function(_0x583cf1){return db['sequelize'][_0x1262('0x60')](function(_0x526835){return _0x583cf1[_0x1262('0x59')](_0x4363c2,{'transaction':_0x526835})[_0x1262('0x1a')](function(){return BPromise[_0x1262('0x61')](_0x534fd9,function(_0x474c7f){return db[_0x1262('0x4a')]['findOrCreate']({'where':{'UserId':_0x474c7f['id'],'ChatQueueId':_0x3a8309['params']['id']},'transaction':_0x526835});});})[_0x1262('0x1a')](function(){_0x534fd9[_0x1262('0x62')](function(_0x46d148){socket[_0x1262('0x63')](_0x1262('0x64'),{'UserId':_0x46d148['id'],'ChatQueueId':_0x583cf1['id']});});});});});}})['then'](respondWithStatusCode(_0x248e4b,null))[_0x1262('0x2c')](handleError(_0x248e4b,null));};exports[_0x1262('0x65')]=function(_0x54b0b6,_0x2ca424){return db['Team'][_0x1262('0x4b')]({'where':{'id':_0x54b0b6['query'][_0x1262('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1262('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x1262('0x1a')](handleEntityNotFound(_0x2ca424,null))['then'](function(_0x1c83d0){var _0x4b21cf=_[_0x1262('0x23')](_0x1c83d0,'id');var _0x2bacf9=[];var _0x24393d=[];var _0x456f06=squel['select']();_0x456f06[_0x1262('0x66')](_0x1262('0x67'))[_0x1262('0x68')](_0x1262('0x69'),'tq')[_0x1262('0x6a')](_0x1262('0x6b'),'ut',_0x1262('0x6c'))[_0x1262('0x27')](_0x1262('0x6d'),_0x54b0b6['params']['id']);for(var _0x459cef=0x0;_0x459cef<_0x1c83d0['length'];_0x459cef+=0x1){let _0x52fc1f=_0x1c83d0[_0x459cef];for(var _0x2e461d=0x0;_0x2e461d<_0x52fc1f['Agents']['length'];_0x2e461d+=0x1){let _0x32bb46=_0x52fc1f['Agents'][_0x2e461d];var _0x3e94b0=_0x456f06['clone']();_0x3e94b0[_0x1262('0x27')]('ut.UserId\x20=\x20?',_0x32bb46['id']);_0x24393d['push'](db[_0x1262('0x6e')][_0x1262('0x2a')](_0x3e94b0[_0x1262('0x6f')](),{'type':db['sequelize'][_0x1262('0x70')]['SELECT']})[_0x1262('0x1a')](function(_0x330919){if(_0x330919[_0x1262('0x35')]===0x1){return _0x32bb46['id'];}else{var _0x59030f=_[_0x1262('0x71')](_[_0x1262('0x23')](_0x330919,_0x1262('0x72')),function(_0x507885){return _['includes'](_0x4b21cf,_0x507885);});if(_0x59030f){return _0x32bb46['id'];}}}));}}return BPromise[_0x1262('0x73')](_0x24393d)[_0x1262('0x1a')](function(_0x3fa698){_0x2bacf9=_(_0x2bacf9)[_0x1262('0x74')](_0x3fa698)[_0x1262('0x75')]()[_0x1262('0x76')]();return db[_0x1262('0x28')][_0x1262('0x37')]({'where':{'id':_0x54b0b6[_0x1262('0x2e')]['id']}})[_0x1262('0x1a')](function(_0xb7dae){return db[_0x1262('0x6e')]['transaction'](function(_0x70943d){return _0xb7dae['removeTeams'](_0x54b0b6[_0x1262('0x2a')]['ids'],{'transaction':_0x70943d})[_0x1262('0x1a')](function(){if(!_['isEmpty'](_0x2bacf9)){return _0xb7dae[_0x1262('0x77')](_0x2bacf9,{'transaction':_0x70943d});}})[_0x1262('0x1a')](function(){_0x2bacf9['forEach'](function(_0xa5dff4){socket[_0x1262('0x63')]('userChatQueue:remove',{'UserId':_0xa5dff4,'ChatQueueId':_0xb7dae['id']});});});});});});})[_0x1262('0x1a')](respondWithStatusCode(_0x2ca424,null))[_0x1262('0x2c')](handleError(_0x2ca424,null));};exports[_0x1262('0x78')]=function(_0x36282b,_0x4c44b9){return db['ChatQueue'][_0x1262('0x37')]({'where':{'id':_0x36282b[_0x1262('0x2e')]['id']}})[_0x1262('0x1a')](handleEntityNotFound(_0x4c44b9,null))[_0x1262('0x1a')](function(_0x17c42c){if(_0x17c42c){return _0x17c42c[_0x1262('0x78')](_0x36282b[_0x1262('0x39')]['ids'],_[_0x1262('0x79')](_0x36282b['body'],[_0x1262('0x5a'),'id'])||{})[_0x1262('0x7a')](function(_0x4beb67){for(var _0x335118=0x0;_0x335118<_0x36282b['body']['ids']['length'];_0x335118+=0x1){socket[_0x1262('0x63')](_0x1262('0x64'),{'UserId':Number(_0x36282b['body']['ids'][_0x335118]),'ChatQueueId':Number(_0x36282b['params']['id'])});}return _0x4beb67;});}})[_0x1262('0x1a')](respondWithResult(_0x4c44b9,null))[_0x1262('0x2c')](handleError(_0x4c44b9,null));};exports['removeAgents']=function(_0x175dce,_0x165f9e){return db[_0x1262('0x28')]['find']({'where':{'id':_0x175dce[_0x1262('0x2e')]['id']}})['then'](handleEntityNotFound(_0x165f9e,null))['then'](function(_0x412919){if(_0x412919){return _0x412919[_0x1262('0x77')](_0x175dce[_0x1262('0x2a')][_0x1262('0x5a')])[_0x1262('0x1a')](function(){if(_[_0x1262('0x7b')](_0x175dce['query'][_0x1262('0x5a')])){for(var _0xad0de2=0x0;_0xad0de2<_0x175dce[_0x1262('0x2a')][_0x1262('0x5a')][_0x1262('0x35')];_0xad0de2+=0x1){socket[_0x1262('0x63')]('userChatQueue:remove',{'UserId':Number(_0x175dce['query'][_0x1262('0x5a')][_0xad0de2]),'ChatQueueId':Number(_0x175dce['params']['id'])});}}else{socket[_0x1262('0x63')](_0x1262('0x7c'),{'UserId':Number(_0x175dce[_0x1262('0x2a')][_0x1262('0x5a')]),'ChatQueueId':Number(_0x175dce[_0x1262('0x2e')]['id'])});}});}})[_0x1262('0x1a')](respondWithStatusCode(_0x165f9e,null))[_0x1262('0x2c')](handleError(_0x165f9e,null));};exports[_0x1262('0x7d')]=function(_0x30fd12,_0x4c4805){var _0x7bb51a={};var _0x4513c8={};var _0x248308;var _0x520e77;return db[_0x1262('0x28')][_0x1262('0x42')]({'where':{'id':_0x30fd12[_0x1262('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4c4805,null))[_0x1262('0x1a')](function(_0x220b80){if(_0x220b80){_0x248308=_0x220b80;_0x4513c8[_0x1262('0x2f')]=_[_0x1262('0x30')](db[_0x1262('0x4c')][_0x1262('0x24')]);_0x4513c8[_0x1262('0x2a')]=_['keys'](_0x30fd12[_0x1262('0x2a')]);_0x4513c8[_0x1262('0x31')]=_[_0x1262('0x32')](_0x4513c8[_0x1262('0x2f')],_0x4513c8['query']);_0x7bb51a[_0x1262('0x34')]=_[_0x1262('0x32')](_0x4513c8[_0x1262('0x2f')],qs['fields'](_0x30fd12[_0x1262('0x2a')][_0x1262('0x33')]));_0x7bb51a['attributes']=_0x7bb51a[_0x1262('0x34')][_0x1262('0x35')]?_0x7bb51a[_0x1262('0x34')]:_0x4513c8['model'];_0x7bb51a[_0x1262('0x44')]=qs['sort'](_0x30fd12[_0x1262('0x2a')]['sort']);_0x7bb51a['where']=qs[_0x1262('0x31')](_['pick'](_0x30fd12[_0x1262('0x2a')],_0x4513c8[_0x1262('0x31')]));if(_0x30fd12[_0x1262('0x2a')][_0x1262('0x47')]){_0x7bb51a[_0x1262('0x27')]=_['merge'](_0x7bb51a[_0x1262('0x27')],{'$or':_[_0x1262('0x23')](_0x7bb51a['attributes'],function(_0x50fcb7){var _0x44e70b={};_0x44e70b[_0x50fcb7]={'$like':'%'+_0x30fd12['query'][_0x1262('0x47')]+'%'};return _0x44e70b;})});}_0x7bb51a=_['merge']({},_0x7bb51a,_0x30fd12[_0x1262('0x49')]);return _0x248308[_0x1262('0x7d')](_0x7bb51a);}})[_0x1262('0x1a')](function(_0x59f6ca){if(_0x59f6ca){_0x520e77=_0x59f6ca[_0x1262('0x35')];if(!_0x30fd12[_0x1262('0x2a')]['hasOwnProperty'](_0x1262('0x58'))){_0x7bb51a[_0x1262('0x13')]=qs[_0x1262('0x13')](_0x30fd12[_0x1262('0x2a')][_0x1262('0x13')]);_0x7bb51a[_0x1262('0x14')]=qs['offset'](_0x30fd12[_0x1262('0x2a')][_0x1262('0x14')]);}return _0x248308[_0x1262('0x7d')](_0x7bb51a);}})['then'](function(_0x3b4928){if(_0x3b4928){return _0x3b4928?{'count':_0x520e77,'rows':_0x3b4928}:null;}})['then'](respondWithResult(_0x4c4805,null))['catch'](handleError(_0x4c4805,null));}; \ No newline at end of file +var _0x01f1=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','forEach','userChatQueue:save','ids','select','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','emit','addAgents','userChatQueue:remove','getAgents','order','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','get','error','stack','name','send','map','ChatQueue','fieldName','type','getOptions','where','findAll','catch','show','model','rawAttributes','query','keys','filters','fields','length','attributes','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','describe','getMembers','findOne','UserChatQueue','intersection','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','User','UserId','agent','chatPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01f1,0x114));var _0x101f=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x01f1[_0x3ff2f9];return _0x3b0913;};'use strict';var BPromise=require(_0x101f('0x0'));var util=require('util');var _=require(_0x101f('0x1'));var squel=require(_0x101f('0x2'));var Redis=require(_0x101f('0x3'));var qs=require(_0x101f('0x4'));var logger=require('../../config/logger')(_0x101f('0x5'));var config=require(_0x101f('0x6'));var db=require('../../mysqldb')['db'];config[_0x101f('0x7')]=_[_0x101f('0x8')](config[_0x101f('0x7')],{'host':_0x101f('0x9'),'port':0x18eb});var socket=require(_0x101f('0xa'))(new Redis(config[_0x101f('0x7')]));require('./chatQueue.socket')[_0x101f('0xb')](socket);function respondWithStatusCode(_0x53b4fe,_0x17388f){_0x17388f=_0x17388f||0xcc;return function(_0x250b19){if(_0x250b19){return _0x53b4fe[_0x101f('0xc')](_0x17388f);}return _0x53b4fe[_0x101f('0xd')](_0x17388f)['end']();};}function respondWithResult(_0x513695,_0x1ecc5c){_0x1ecc5c=_0x1ecc5c||0xc8;return function(_0x56d6dc){if(_0x56d6dc){return _0x513695[_0x101f('0xd')](_0x1ecc5c)[_0x101f('0xe')](_0x56d6dc);}};}function respondWithFilteredResult(_0x243808,_0x43b920){return function(_0x5cab52){if(_0x5cab52){var _0xf4cb95=typeof _0x43b920[_0x101f('0xf')]===_0x101f('0x10')&&typeof _0x43b920[_0x101f('0x11')]==='undefined';var _0x14ceea=_0x5cab52[_0x101f('0x12')];var _0x5df555=_0xf4cb95?0x0:_0x43b920[_0x101f('0xf')];var _0x5dbba4=_0xf4cb95?_0x5cab52[_0x101f('0x12')]:_0x43b920['offset']+_0x43b920[_0x101f('0x11')];var _0x598e90;if(_0x5dbba4>=_0x14ceea){_0x5dbba4=_0x14ceea;_0x598e90=0xc8;}else{_0x598e90=0xce;}_0x243808['status'](_0x598e90);return _0x243808[_0x101f('0x13')]('Content-Range',_0x5df555+'-'+_0x5dbba4+'/'+_0x14ceea)[_0x101f('0xe')](_0x5cab52);}return null;};}function saveUpdates(_0x2efa9f){return function(_0x4d4643){if(_0x4d4643){return _0x4d4643[_0x101f('0x14')](_0x2efa9f)[_0x101f('0x15')](function(_0x52fc68){return _0x52fc68;});}return null;};}function removeEntity(_0x1e10ad){return function(_0x464429){if(_0x464429){return _0x464429['destroy']()[_0x101f('0x15')](function(){var _0x30254=_0x464429[_0x101f('0x16')]({'plain':!![]});var _0x412b59='ChatQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x412b59,'resourceId':_0x30254['id']}})['then'](function(){return _0x464429;});})[_0x101f('0x15')](function(){_0x1e10ad[_0x101f('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9cee){return function(_0x14088d){if(!_0x14088d){_0x2d9cee[_0x101f('0xc')](0x194);}return _0x14088d;};}function handleError(_0x52061a,_0x29d638){_0x29d638=_0x29d638||0x1f4;return function(_0x1d7dd9){logger[_0x101f('0x17')](_0x1d7dd9[_0x101f('0x18')]);if(_0x1d7dd9['name']){delete _0x1d7dd9[_0x101f('0x19')];}_0x52061a[_0x101f('0xd')](_0x29d638)[_0x101f('0x1a')](_0x1d7dd9);};}exports['index']=function(_0x387b0c,_0x5460de){var _0x30fd4f={};var _0x5dea3d={'count':0x0,'rows':[]};var _0x441c4c=_[_0x101f('0x1b')](db[_0x101f('0x1c')]['rawAttributes'],function(_0x2930f){return{'name':_0x2930f[_0x101f('0x1d')],'type':_0x2930f[_0x101f('0x1e')]['key']};});_0x30fd4f=qs[_0x101f('0x1f')](_0x441c4c,_0x387b0c);var _0x1945b4={'where':_0x30fd4f[_0x101f('0x20')]};return db['ChatQueue']['count'](_0x1945b4)[_0x101f('0x15')](function(_0x5bf754){_0x5dea3d[_0x101f('0x12')]=_0x5bf754;_0x30fd4f['include']=qs['include'](_0x387b0c['query']);return db[_0x101f('0x1c')][_0x101f('0x21')](_0x30fd4f);})['then'](function(_0x1e4111){_0x5dea3d['rows']=_0x1e4111;return _0x5dea3d;})['then'](respondWithFilteredResult(_0x5460de,_0x30fd4f))[_0x101f('0x22')](handleError(_0x5460de,null));};exports[_0x101f('0x23')]=function(_0x2cfa66,_0x1bb2db){var _0x4bd791={'raw':!![],'where':{'id':_0x2cfa66['params']['id']}},_0x17127a={};_0x17127a[_0x101f('0x24')]=_['keys'](db[_0x101f('0x1c')][_0x101f('0x25')]);_0x17127a[_0x101f('0x26')]=_[_0x101f('0x27')](_0x2cfa66['query']);_0x17127a[_0x101f('0x28')]=_['intersection'](_0x17127a[_0x101f('0x24')],_0x17127a[_0x101f('0x26')]);_0x4bd791['attributes']=_['intersection'](_0x17127a[_0x101f('0x24')],qs[_0x101f('0x29')](_0x2cfa66[_0x101f('0x26')][_0x101f('0x29')]));_0x4bd791['attributes']=_0x4bd791['attributes'][_0x101f('0x2a')]?_0x4bd791[_0x101f('0x2b')]:_0x17127a[_0x101f('0x24')];if(_0x2cfa66[_0x101f('0x26')][_0x101f('0x2c')]){_0x4bd791[_0x101f('0x2d')]=[{'all':!![]}];}_0x4bd791=_[_0x101f('0x2e')]({},_0x4bd791,_0x2cfa66[_0x101f('0x2f')]);return db[_0x101f('0x1c')][_0x101f('0x30')](_0x4bd791)[_0x101f('0x15')](handleEntityNotFound(_0x1bb2db,null))[_0x101f('0x15')](respondWithResult(_0x1bb2db,null))['catch'](handleError(_0x1bb2db,null));};exports[_0x101f('0x31')]=function(_0x5385fd,_0x10beea){return db[_0x101f('0x1c')][_0x101f('0x31')](_0x5385fd[_0x101f('0x32')],{})[_0x101f('0x15')](function(_0x5a7d34){var _0xa4d4fb=_0x5385fd[_0x101f('0x33')][_0x101f('0x16')]({'plain':!![]});if(!_0xa4d4fb)throw new Error(_0x101f('0x34'));if(_0xa4d4fb['role']===_0x101f('0x33')){var _0x505433=_0x5a7d34[_0x101f('0x16')]({'plain':!![]});var _0x55290e=_0x101f('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x55290e,'userProfileId':_0xa4d4fb[_0x101f('0x36')]},'raw':!![]})['then'](function(_0x2770b6){if(_0x2770b6&&_0x2770b6[_0x101f('0x37')]===0x0){return db[_0x101f('0x38')]['create']({'name':_0x505433[_0x101f('0x19')],'resourceId':_0x505433['id'],'type':_0x2770b6[_0x101f('0x19')],'sectionId':_0x2770b6['id']},{})[_0x101f('0x15')](function(){return _0x5a7d34;});}else{return _0x5a7d34;}})[_0x101f('0x22')](function(_0x5dcc14){logger[_0x101f('0x17')](_0x101f('0x39'),_0x5dcc14);throw _0x5dcc14;});}return _0x5a7d34;})[_0x101f('0x15')](respondWithResult(_0x10beea,0xc9))[_0x101f('0x22')](handleError(_0x10beea,null));};exports[_0x101f('0x14')]=function(_0x4f0bba,_0x26d86f){if(_0x4f0bba['body']['id']){delete _0x4f0bba[_0x101f('0x32')]['id'];}return db[_0x101f('0x1c')]['find']({'where':{'id':_0x4f0bba['params']['id']}})[_0x101f('0x15')](handleEntityNotFound(_0x26d86f,null))['then'](saveUpdates(_0x4f0bba[_0x101f('0x32')],null))['then'](respondWithResult(_0x26d86f,null))[_0x101f('0x22')](handleError(_0x26d86f,null));};exports[_0x101f('0x3a')]=function(_0x51ac53,_0x57a17a){return db[_0x101f('0x1c')][_0x101f('0x30')]({'where':{'id':_0x51ac53[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0x57a17a,null))[_0x101f('0x15')](removeEntity(_0x57a17a,null))[_0x101f('0x22')](handleError(_0x57a17a,null));};exports[_0x101f('0x3c')]=function(_0x23c78e,_0x5af813){return db[_0x101f('0x1c')][_0x101f('0x3c')]()[_0x101f('0x15')](respondWithResult(_0x5af813,null))[_0x101f('0x22')](handleError(_0x5af813,null));};exports[_0x101f('0x3d')]=function(_0x67dfdb,_0x354ddc){var _0x71a761={'raw':!![],'where':{}},_0x30200b={},_0xbaeb1d;return db[_0x101f('0x1c')][_0x101f('0x3e')]({'where':{'id':_0x67dfdb[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0x354ddc,null))[_0x101f('0x15')](function(_0x4c23b2){if(_0x4c23b2){_0xbaeb1d=_0x4c23b2[_0x101f('0x16')]({'plain':!![]});_0x30200b[_0x101f('0x24')]=_['keys'](db[_0x101f('0x3f')]['rawAttributes']);_0x30200b[_0x101f('0x26')]=_['keys'](_0x67dfdb[_0x101f('0x26')]);_0x30200b[_0x101f('0x28')]=_[_0x101f('0x40')](_0x30200b[_0x101f('0x24')],_0x30200b[_0x101f('0x26')]);_0x71a761[_0x101f('0x2b')]=_[_0x101f('0x40')](_0x30200b['model'],qs['fields'](_0x67dfdb['query'][_0x101f('0x29')]));_0x71a761[_0x101f('0x2b')]=_0x71a761['attributes']['length']?_0x71a761['attributes']:_0x30200b[_0x101f('0x24')];if(!_0x67dfdb[_0x101f('0x26')][_0x101f('0x41')](_0x101f('0x42'))){_0x71a761[_0x101f('0x11')]=qs['limit'](_0x67dfdb['query'][_0x101f('0x11')]);_0x71a761[_0x101f('0xf')]=qs['offset'](_0x67dfdb['query'][_0x101f('0xf')]);}_0x71a761['order']=qs[_0x101f('0x43')](_0x67dfdb[_0x101f('0x26')][_0x101f('0x43')]);_0x71a761[_0x101f('0x20')]=qs[_0x101f('0x28')](_[_0x101f('0x44')](_0x67dfdb['query'],_0x30200b[_0x101f('0x28')]));_0x71a761[_0x101f('0x20')][_0x101f('0x45')]=_0x4c23b2['id'];if(_0x67dfdb[_0x101f('0x26')][_0x101f('0x46')]){_0x71a761[_0x101f('0x20')]=_['merge'](_0x71a761[_0x101f('0x20')],{'$or':_[_0x101f('0x1b')](_0x71a761[_0x101f('0x2b')],function(_0x243741){var _0x5ad259={};_0x5ad259[_0x243741]={'$like':'%'+_0x67dfdb[_0x101f('0x26')][_0x101f('0x46')]+'%'};return _0x5ad259;})});}_0x71a761=_[_0x101f('0x2e')]({},_0x71a761,_0x67dfdb[_0x101f('0x2f')]);return db[_0x101f('0x3f')][_0x101f('0x21')](_0x71a761);}})[_0x101f('0x15')](function(_0x4c81da){if(_0x4c81da){return db[_0x101f('0x47')]['findAndCountAll']({'where':{'id':_['map'](_0x4c81da,_0x101f('0x48')),'role':_0x101f('0x49')},'attributes':['id',_0x101f('0x19'),_0x101f('0x4a'),_0x101f('0x4b'),_0x101f('0x4c')]});}})[_0x101f('0x15')](function(_0x2e5c82){if(_0x2e5c82){return{'count':_0x2e5c82[_0x101f('0x12')],'rows':_[_0x101f('0x1b')](_0x2e5c82['rows'],function(_0x444315){return{'membername':_0x444315['name'],'UserId':_0x444315['id'],'queue_name':_0xbaeb1d[_0x101f('0x19')],'ChatQueueId':_0xbaeb1d['id'],'interface':util[_0x101f('0x4d')](_0x101f('0x4e'),_0x101f('0x4f'),_0x444315[_0x101f('0x19')]),'penalty':0x0,'paused':_0x444315[_0x101f('0x4a')],'createdAt':_0x444315['createdAt'],'updatedAt':_0x444315[_0x101f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x354ddc,_0x71a761))[_0x101f('0x22')](handleError(_0x354ddc,null));};exports[_0x101f('0x50')]=function(_0x40b82f,_0xb7db8d){var _0x3cc5a1={};var _0x7470e3={};var _0x4dad0e;var _0x432652;return db[_0x101f('0x1c')][_0x101f('0x3e')]({'where':{'id':_0x40b82f[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0xb7db8d,null))[_0x101f('0x15')](function(_0x1d20e2){if(_0x1d20e2){_0x4dad0e=_0x1d20e2;_0x7470e3['model']=_['keys'](db[_0x101f('0x51')][_0x101f('0x25')]);_0x7470e3['query']=_[_0x101f('0x27')](_0x40b82f['query']);_0x7470e3['filters']=_[_0x101f('0x40')](_0x7470e3[_0x101f('0x24')],_0x7470e3[_0x101f('0x26')]);_0x3cc5a1[_0x101f('0x2b')]=_['intersection'](_0x7470e3[_0x101f('0x24')],qs[_0x101f('0x29')](_0x40b82f[_0x101f('0x26')][_0x101f('0x29')]));_0x3cc5a1[_0x101f('0x2b')]=_0x3cc5a1[_0x101f('0x2b')]['length']?_0x3cc5a1[_0x101f('0x2b')]:_0x7470e3[_0x101f('0x24')];_0x3cc5a1['order']=qs[_0x101f('0x43')](_0x40b82f[_0x101f('0x26')][_0x101f('0x43')]);_0x3cc5a1[_0x101f('0x20')]=qs['filters'](_[_0x101f('0x44')](_0x40b82f[_0x101f('0x26')],_0x7470e3[_0x101f('0x28')]));if(_0x40b82f[_0x101f('0x26')][_0x101f('0x46')]){_0x3cc5a1[_0x101f('0x20')]=_[_0x101f('0x2e')](_0x3cc5a1['where'],{'$or':_[_0x101f('0x1b')](_0x3cc5a1[_0x101f('0x2b')],function(_0x2d9fae){var _0x3b179e={};_0x3b179e[_0x2d9fae]={'$like':'%'+_0x40b82f[_0x101f('0x26')][_0x101f('0x46')]+'%'};return _0x3b179e;})});}_0x3cc5a1=_[_0x101f('0x2e')]({},_0x3cc5a1,_0x40b82f[_0x101f('0x2f')]);return _0x4dad0e['getTeams'](_0x3cc5a1);}})[_0x101f('0x15')](function(_0xb69fff){if(_0xb69fff){_0x432652=_0xb69fff[_0x101f('0x2a')];if(!_0x40b82f[_0x101f('0x26')][_0x101f('0x41')](_0x101f('0x42'))){_0x3cc5a1[_0x101f('0x11')]=qs[_0x101f('0x11')](_0x40b82f['query'][_0x101f('0x11')]);_0x3cc5a1['offset']=qs['offset'](_0x40b82f[_0x101f('0x26')][_0x101f('0xf')]);}return _0x4dad0e['getTeams'](_0x3cc5a1);}})[_0x101f('0x15')](function(_0x1f4cf2){if(_0x1f4cf2){return _0x1f4cf2?{'count':_0x432652,'rows':_0x1f4cf2}:null;}})[_0x101f('0x15')](respondWithResult(_0xb7db8d,null))[_0x101f('0x22')](handleError(_0xb7db8d,null));};exports[_0x101f('0x52')]=function(_0x1415e9,_0x2e7a88){var _0x382fc6=_0x1415e9['body']['ids'];return db[_0x101f('0x51')][_0x101f('0x21')]({'where':{'id':_0x382fc6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x101f('0x53'),'attributes':['id',_0x101f('0x19'),_0x101f('0x54'),'voicePause',_0x101f('0x55')],'raw':!![]}]})['then'](function(_0x183a58){if(_0x183a58){var _0x47b292=_[_0x101f('0x56')](_0x183a58,function(_0xd3e3a8){var _0x431955=_0xd3e3a8[_0x101f('0x16')]({'plain':!![]});return _0x431955[_0x101f('0x53')];});return db['ChatQueue'][_0x101f('0x30')]({'where':{'id':_0x1415e9[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](function(_0x360ba8){return db[_0x101f('0x57')]['transaction'](function(_0x2c44e8){return _0x360ba8[_0x101f('0x52')](_0x382fc6,{'transaction':_0x2c44e8})[_0x101f('0x15')](function(){return BPromise['each'](_0x47b292,function(_0x4b38fc){return db[_0x101f('0x3f')]['findOrCreate']({'where':{'UserId':_0x4b38fc['id'],'ChatQueueId':_0x1415e9[_0x101f('0x3b')]['id']},'transaction':_0x2c44e8});});})[_0x101f('0x15')](function(){_0x47b292[_0x101f('0x58')](function(_0x4f4ca0){socket['emit'](_0x101f('0x59'),{'UserId':_0x4f4ca0['id'],'ChatQueueId':_0x360ba8['id']});});});});});}})['then'](respondWithStatusCode(_0x2e7a88,null))['catch'](handleError(_0x2e7a88,null));};exports['removeTeams']=function(_0x37c5d0,_0x2b3cb9){return db[_0x101f('0x51')][_0x101f('0x21')]({'where':{'id':_0x37c5d0['query'][_0x101f('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x101f('0x53'),'attributes':['id'],'raw':!![]}]})[_0x101f('0x15')](handleEntityNotFound(_0x2b3cb9,null))['then'](function(_0x2f803f){var _0x129e43=_[_0x101f('0x1b')](_0x2f803f,'id');var _0x5b9995=[];var _0x3ef2cd=[];var _0x1365f1=squel[_0x101f('0x5b')]();_0x1365f1['field']('tq.TeamId')['from'](_0x101f('0x5c'),'tq')[_0x101f('0x5d')](_0x101f('0x5e'),'ut',_0x101f('0x5f'))[_0x101f('0x20')](_0x101f('0x60'),_0x37c5d0['params']['id']);for(var _0x3856c9=0x0;_0x3856c9<_0x2f803f[_0x101f('0x2a')];_0x3856c9+=0x1){let _0x255e49=_0x2f803f[_0x3856c9];for(var _0x3894dc=0x0;_0x3894dc<_0x255e49[_0x101f('0x53')][_0x101f('0x2a')];_0x3894dc+=0x1){let _0x4e4fd0=_0x255e49[_0x101f('0x53')][_0x3894dc];var _0x5133dd=_0x1365f1[_0x101f('0x61')]();_0x5133dd[_0x101f('0x20')](_0x101f('0x62'),_0x4e4fd0['id']);_0x3ef2cd[_0x101f('0x63')](db['sequelize']['query'](_0x5133dd[_0x101f('0x64')](),{'type':db[_0x101f('0x57')][_0x101f('0x65')][_0x101f('0x66')]})[_0x101f('0x15')](function(_0x2a8123){if(_0x2a8123[_0x101f('0x2a')]===0x1){return _0x4e4fd0['id'];}else{var _0xd5ee2=_[_0x101f('0x67')](_[_0x101f('0x1b')](_0x2a8123,_0x101f('0x68')),function(_0x203347){return _['includes'](_0x129e43,_0x203347);});if(_0xd5ee2){return _0x4e4fd0['id'];}}}));}}return BPromise[_0x101f('0x69')](_0x3ef2cd)[_0x101f('0x15')](function(_0x53e7ca){_0x5b9995=_(_0x5b9995)[_0x101f('0x6a')](_0x53e7ca)[_0x101f('0x6b')]()['value']();return db[_0x101f('0x1c')]['find']({'where':{'id':_0x37c5d0[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](function(_0x1e3d08){return db[_0x101f('0x57')][_0x101f('0x6c')](function(_0x115cd9){return _0x1e3d08[_0x101f('0x6d')](_0x37c5d0['query']['ids'],{'transaction':_0x115cd9})[_0x101f('0x15')](function(){if(!_[_0x101f('0x6e')](_0x5b9995)){return _0x1e3d08[_0x101f('0x6f')](_0x5b9995,{'transaction':_0x115cd9});}})[_0x101f('0x15')](function(){_0x5b9995[_0x101f('0x58')](function(_0x44d8ee){socket[_0x101f('0x70')]('userChatQueue:remove',{'UserId':_0x44d8ee,'ChatQueueId':_0x1e3d08['id']});});});});});});})[_0x101f('0x15')](respondWithStatusCode(_0x2b3cb9,null))[_0x101f('0x22')](handleError(_0x2b3cb9,null));};exports[_0x101f('0x71')]=function(_0x26cb19,_0xbc177a){return db['ChatQueue'][_0x101f('0x30')]({'where':{'id':_0x26cb19[_0x101f('0x3b')]['id']}})[_0x101f('0x15')](handleEntityNotFound(_0xbc177a,null))['then'](function(_0x16d8b7){if(_0x16d8b7){return _0x16d8b7[_0x101f('0x71')](_0x26cb19[_0x101f('0x32')][_0x101f('0x5a')],_['omit'](_0x26cb19[_0x101f('0x32')],[_0x101f('0x5a'),'id'])||{})['spread'](function(_0x16f83c){for(var _0x546be6=0x0;_0x546be6<_0x26cb19[_0x101f('0x32')][_0x101f('0x5a')][_0x101f('0x2a')];_0x546be6+=0x1){socket[_0x101f('0x70')](_0x101f('0x59'),{'UserId':Number(_0x26cb19[_0x101f('0x32')][_0x101f('0x5a')][_0x546be6]),'ChatQueueId':Number(_0x26cb19[_0x101f('0x3b')]['id'])});}return _0x16f83c;});}})[_0x101f('0x15')](respondWithResult(_0xbc177a,null))[_0x101f('0x22')](handleError(_0xbc177a,null));};exports['removeAgents']=function(_0x4382d,_0x135150){return db[_0x101f('0x1c')][_0x101f('0x30')]({'where':{'id':_0x4382d[_0x101f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x135150,null))[_0x101f('0x15')](function(_0x2d441a){if(_0x2d441a){return _0x2d441a[_0x101f('0x6f')](_0x4382d[_0x101f('0x26')][_0x101f('0x5a')])[_0x101f('0x15')](function(){if(_['isArray'](_0x4382d[_0x101f('0x26')][_0x101f('0x5a')])){for(var _0x184964=0x0;_0x184964<_0x4382d['query'][_0x101f('0x5a')][_0x101f('0x2a')];_0x184964+=0x1){socket[_0x101f('0x70')](_0x101f('0x72'),{'UserId':Number(_0x4382d[_0x101f('0x26')][_0x101f('0x5a')][_0x184964]),'ChatQueueId':Number(_0x4382d[_0x101f('0x3b')]['id'])});}}else{socket[_0x101f('0x70')](_0x101f('0x72'),{'UserId':Number(_0x4382d['query'][_0x101f('0x5a')]),'ChatQueueId':Number(_0x4382d['params']['id'])});}});}})[_0x101f('0x15')](respondWithStatusCode(_0x135150,null))['catch'](handleError(_0x135150,null));};exports[_0x101f('0x73')]=function(_0x12234f,_0x2b1131){var _0x1a90ac={};var _0x42c31e={};var _0x2596c3;var _0x48b2c0;return db[_0x101f('0x1c')][_0x101f('0x3e')]({'where':{'id':_0x12234f[_0x101f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2b1131,null))[_0x101f('0x15')](function(_0x439378){if(_0x439378){_0x2596c3=_0x439378;_0x42c31e[_0x101f('0x24')]=_[_0x101f('0x27')](db[_0x101f('0x47')][_0x101f('0x25')]);_0x42c31e[_0x101f('0x26')]=_[_0x101f('0x27')](_0x12234f[_0x101f('0x26')]);_0x42c31e['filters']=_['intersection'](_0x42c31e[_0x101f('0x24')],_0x42c31e[_0x101f('0x26')]);_0x1a90ac[_0x101f('0x2b')]=_['intersection'](_0x42c31e['model'],qs[_0x101f('0x29')](_0x12234f[_0x101f('0x26')][_0x101f('0x29')]));_0x1a90ac[_0x101f('0x2b')]=_0x1a90ac[_0x101f('0x2b')]['length']?_0x1a90ac[_0x101f('0x2b')]:_0x42c31e[_0x101f('0x24')];_0x1a90ac[_0x101f('0x74')]=qs['sort'](_0x12234f[_0x101f('0x26')][_0x101f('0x43')]);_0x1a90ac[_0x101f('0x20')]=qs[_0x101f('0x28')](_[_0x101f('0x44')](_0x12234f[_0x101f('0x26')],_0x42c31e[_0x101f('0x28')]));if(_0x12234f[_0x101f('0x26')]['filter']){_0x1a90ac[_0x101f('0x20')]=_[_0x101f('0x2e')](_0x1a90ac['where'],{'$or':_[_0x101f('0x1b')](_0x1a90ac[_0x101f('0x2b')],function(_0x2492f7){var _0x42c465={};_0x42c465[_0x2492f7]={'$like':'%'+_0x12234f[_0x101f('0x26')][_0x101f('0x46')]+'%'};return _0x42c465;})});}_0x1a90ac=_[_0x101f('0x2e')]({},_0x1a90ac,_0x12234f[_0x101f('0x2f')]);return _0x2596c3['getAgents'](_0x1a90ac);}})[_0x101f('0x15')](function(_0x562951){if(_0x562951){_0x48b2c0=_0x562951[_0x101f('0x2a')];if(!_0x12234f[_0x101f('0x26')][_0x101f('0x41')](_0x101f('0x42'))){_0x1a90ac[_0x101f('0x11')]=qs['limit'](_0x12234f['query']['limit']);_0x1a90ac['offset']=qs[_0x101f('0xf')](_0x12234f[_0x101f('0x26')][_0x101f('0xf')]);}return _0x2596c3['getAgents'](_0x1a90ac);}})[_0x101f('0x15')](function(_0xba2d3f){if(_0xba2d3f){return _0xba2d3f?{'count':_0x48b2c0,'rows':_0xba2d3f}:null;}})['then'](respondWithResult(_0x2b1131,null))[_0x101f('0x22')](handleError(_0x2b1131,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1d32b42..b2c6bec 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 _0x3d4a=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x17df1b,_0x4cf1d7){var _0x297263=function(_0x46c3a5){while(--_0x46c3a5){_0x17df1b['push'](_0x17df1b['shift']());}};_0x297263(++_0x4cf1d7);}(_0x3d4a,0x1e6));var _0xa3d4=function(_0x391d16,_0x387823){_0x391d16=_0x391d16-0x0;var _0x21eee6=_0x3d4a[_0x391d16];return _0x21eee6;};'use strict';var EventEmitter=require(_0xa3d4('0x0'));var ChatQueue=require(_0xa3d4('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa3d4('0x2')](0x0);var events={'afterCreate':_0xa3d4('0x3'),'afterUpdate':'update','afterDestroy':_0xa3d4('0x4')};function emitEvent(_0x27f5a6){return function(_0x3597cb,_0x5da5ee,_0x144d85){ChatQueueEvents[_0xa3d4('0x5')](_0x27f5a6+':'+_0x3597cb['id'],_0x3597cb);ChatQueueEvents[_0xa3d4('0x5')](_0x27f5a6,_0x3597cb);_0x144d85(null);};}for(var e in events){if(events[_0xa3d4('0x6')](e)){var event=events[e];ChatQueue[_0xa3d4('0x7')](e,emitEvent(event));}}module[_0xa3d4('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xb776=['exports','events','../../mysqldb','ChatQueue','save','update','remove','emit','hook'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xb776,0x1cc));var _0x6b77=function(_0x59ab10,_0x538141){_0x59ab10=_0x59ab10-0x0;var _0x383f73=_0xb776[_0x59ab10];return _0x383f73;};'use strict';var EventEmitter=require(_0x6b77('0x0'));var ChatQueue=require(_0x6b77('0x1'))['db'][_0x6b77('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b77('0x3'),'afterUpdate':_0x6b77('0x4'),'afterDestroy':_0x6b77('0x5')};function emitEvent(_0x35789c){return function(_0x3663c7,_0xb8ebde,_0x383a47){ChatQueueEvents[_0x6b77('0x6')](_0x35789c+':'+_0x3663c7['id'],_0x3663c7);ChatQueueEvents[_0x6b77('0x6')](_0x35789c,_0x3663c7);_0x383a47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x6b77('0x7')](e,emitEvent(event));}}module[_0x6b77('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 35d22ae..9bd8aa5 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 _0x8d8a=['ChatQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x39cc78,_0x19616b){var _0x21ab23=function(_0x177c92){while(--_0x177c92){_0x39cc78['push'](_0x39cc78['shift']());}};_0x21ab23(++_0x19616b);}(_0x8d8a,0x79));var _0xa8d8=function(_0x579f88,_0xb8632d){_0x579f88=_0x579f88-0x0;var _0xcff854=_0x8d8a[_0x579f88];return _0xcff854;};'use strict';var _=require(_0xa8d8('0x0'));var util=require(_0xa8d8('0x1'));var logger=require(_0xa8d8('0x2'))(_0xa8d8('0x3'));var moment=require('moment');var BPromise=require(_0xa8d8('0x4'));var rp=require(_0xa8d8('0x5'));var fs=require('fs');var path=require(_0xa8d8('0x6'));var rimraf=require(_0xa8d8('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0xa8d8('0x8')]=function(_0x270541,_0x1e70ec){return _0x270541['define'](_0xa8d8('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d2c=['../../config/logger','api','moment','bluebird','request-promise','path','./chatQueue.attributes','exports','lodash','util'];(function(_0x452558,_0x565159){var _0x3027f7=function(_0x198dc7){while(--_0x198dc7){_0x452558['push'](_0x452558['shift']());}};_0x3027f7(++_0x565159);}(_0x7d2c,0x184));var _0xc7d2=function(_0x3c42f0,_0x421a98){_0x3c42f0=_0x3c42f0-0x0;var _0x2e39da=_0x7d2c[_0x3c42f0];return _0x2e39da;};'use strict';var _=require(_0xc7d2('0x0'));var util=require(_0xc7d2('0x1'));var logger=require(_0xc7d2('0x2'))(_0xc7d2('0x3'));var moment=require(_0xc7d2('0x4'));var BPromise=require(_0xc7d2('0x5'));var rp=require(_0xc7d2('0x6'));var fs=require('fs');var path=require(_0xc7d2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc7d2('0x8'));module[_0xc7d2('0x9')]=function(_0x188d37,_0x49c3bc){return _0x188d37['define']('ChatQueue',attributes,{'tableName':'chat_queues','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 4e87acc..7428814 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 _0x47d6=['ChatQueue','raw','options','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetChatQueue'];(function(_0x1f0a78,_0x54ae1f){var _0x2a706d=function(_0x23bf96){while(--_0x23bf96){_0x1f0a78['push'](_0x1f0a78['shift']());}};_0x2a706d(++_0x54ae1f);}(_0x47d6,0x13f));var _0x647d=function(_0x3787e1,_0x325e8c){_0x3787e1=_0x3787e1-0x0;var _0x348771=_0x47d6[_0x3787e1];return _0x348771;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var moment=require(_0x647d('0x2'));var BPromise=require(_0x647d('0x3'));var rs=require(_0x647d('0x4'));var fs=require('fs');var Redis=require(_0x647d('0x5'));var db=require(_0x647d('0x6'))['db'];var utils=require(_0x647d('0x7'));var logger=require(_0x647d('0x8'))(_0x647d('0x9'));var config=require(_0x647d('0xa'));var jayson=require(_0x647d('0xb'));var client=jayson[_0x647d('0xc')][_0x647d('0xd')]({'port':0x232a});config[_0x647d('0xe')]=_[_0x647d('0xf')](config['redis'],{'host':_0x647d('0x10'),'port':0x18eb});var socket=require(_0x647d('0x11'))(new Redis(config[_0x647d('0xe')]));require(_0x647d('0x12'))[_0x647d('0x13')](socket);function respondWithRpcPromise(_0x28bd9b,_0x1984c6,_0x9bd2a3){return new BPromise(function(_0x16ff20,_0xd7db22){return client[_0x647d('0x14')](_0x28bd9b,_0x9bd2a3)[_0x647d('0x15')](function(_0x4c2ae1){logger['info'](_0x647d('0x16'),_0x1984c6,_0x647d('0x17'));logger[_0x647d('0x18')](_0x647d('0x19'),_0x1984c6,_0x647d('0x17'),JSON[_0x647d('0x1a')](_0x4c2ae1));if(_0x4c2ae1[_0x647d('0x1b')]){if(_0x4c2ae1[_0x647d('0x1b')]['code']===0x1f4){logger[_0x647d('0x1b')](_0x647d('0x16'),_0x1984c6,_0x4c2ae1['error'][_0x647d('0x1c')]);return _0xd7db22(_0x4c2ae1[_0x647d('0x1b')][_0x647d('0x1c')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x1984c6,_0x4c2ae1[_0x647d('0x1b')][_0x647d('0x1c')]);return _0x16ff20(_0x4c2ae1[_0x647d('0x1b')]['message']);}else{logger[_0x647d('0x1d')](_0x647d('0x16'),_0x1984c6,'request\x20sent');_0x16ff20(_0x4c2ae1[_0x647d('0x1e')][_0x647d('0x1c')]);}})[_0x647d('0x1f')](function(_0x53000c){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1984c6,_0x53000c);_0xd7db22(_0x53000c);});});}exports[_0x647d('0x20')]=function(_0x3954c5){var _0xd64335=this;return new Promise(function(_0x4991ab,_0x16a1de){return db[_0x647d('0x21')]['findAll']({'raw':_0x3954c5['options']?_0x3954c5['options'][_0x647d('0x22')]===undefined?!![]:![]:!![],'where':_0x3954c5[_0x647d('0x23')]?_0x3954c5['options'][_0x647d('0x24')]||null:null,'attributes':_0x3954c5[_0x647d('0x23')]?_0x3954c5[_0x647d('0x23')][_0x647d('0x25')]||null:null,'limit':_0x3954c5['options']?_0x3954c5['options'][_0x647d('0x26')]||null:null,'include':_0x3954c5['options']?_0x3954c5[_0x647d('0x23')][_0x647d('0x27')]?_[_0x647d('0x28')](_0x3954c5[_0x647d('0x23')][_0x647d('0x27')],function(_0x36cb9f){return{'model':db[_0x36cb9f[_0x647d('0x29')]],'as':_0x36cb9f['as'],'attributes':_0x36cb9f[_0x647d('0x25')],'include':_0x36cb9f[_0x647d('0x27')]?_[_0x647d('0x28')](_0x36cb9f[_0x647d('0x27')],function(_0x11a0c1){return{'model':db[_0x11a0c1[_0x647d('0x29')]],'as':_0x11a0c1['as'],'attributes':_0x11a0c1[_0x647d('0x25')],'include':_0x11a0c1[_0x647d('0x27')]?_[_0x647d('0x28')](_0x11a0c1['include'],function(_0x5b418e){return{'model':db[_0x5b418e['model']],'as':_0x5b418e['as'],'attributes':_0x5b418e[_0x647d('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcd3151){logger[_0x647d('0x1d')]('GetChatQueue',_0x3954c5);logger[_0x647d('0x18')](_0x647d('0x20'),_0x3954c5,JSON[_0x647d('0x1a')](_0xcd3151));_0x4991ab(_0xcd3151);})['catch'](function(_0x45391f){logger[_0x647d('0x1b')](_0x647d('0x20'),_0x45391f['message'],_0x3954c5);_0x16a1de(_0xd64335['error'](0x1f4,_0x45391f[_0x647d('0x1c')]));});});};exports[_0x647d('0x2a')]=function(_0x102f76){var _0x4a220e=this;return new Promise(function(_0x31009c,_0x11c9e8){return db[_0x647d('0x21')][_0x647d('0x2b')]({'raw':_0x102f76[_0x647d('0x23')]?_0x102f76[_0x647d('0x23')][_0x647d('0x22')]===undefined?!![]:![]:!![],'where':_0x102f76[_0x647d('0x23')]?_0x102f76[_0x647d('0x23')][_0x647d('0x24')]||null:null,'attributes':_0x102f76[_0x647d('0x23')]?_0x102f76['options'][_0x647d('0x25')]||null:null,'include':_0x102f76[_0x647d('0x23')]?_0x102f76[_0x647d('0x23')][_0x647d('0x27')]?_[_0x647d('0x28')](_0x102f76[_0x647d('0x23')][_0x647d('0x27')],function(_0xa5baf){return{'model':db[_0xa5baf['model']],'as':_0xa5baf['as'],'attributes':_0xa5baf['attributes'],'include':_0xa5baf[_0x647d('0x27')]?_[_0x647d('0x28')](_0xa5baf[_0x647d('0x27')],function(_0x4624ff){return{'model':db[_0x4624ff['model']],'as':_0x4624ff['as'],'attributes':_0x4624ff[_0x647d('0x25')],'include':_0x4624ff[_0x647d('0x27')]?_['map'](_0x4624ff[_0x647d('0x27')],function(_0x24d363){return{'model':db[_0x24d363['model']],'as':_0x24d363['as'],'attributes':_0x24d363[_0x647d('0x25')]};}):[]};}):[]};}):[]:[]})[_0x647d('0x15')](function(_0x380d4e){logger[_0x647d('0x1d')](_0x647d('0x2a'),_0x102f76);logger[_0x647d('0x18')](_0x647d('0x2a'),_0x102f76,JSON[_0x647d('0x1a')](_0x380d4e));_0x31009c(_0x380d4e);})[_0x647d('0x1f')](function(_0x24470c){logger[_0x647d('0x1b')](_0x647d('0x2a'),_0x24470c[_0x647d('0x1c')],_0x102f76);_0x11c9e8(_0x4a220e[_0x647d('0x1b')](0x1f4,_0x24470c[_0x647d('0x1c')]));});});}; \ No newline at end of file +var _0x236c=['error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','debug','find','ShowChatQueue','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1aaa19,_0x3e7c58){var _0x1dd09e=function(_0x60a6fe){while(--_0x60a6fe){_0x1aaa19['push'](_0x1aaa19['shift']());}};_0x1dd09e(++_0x3e7c58);}(_0x236c,0x155));var _0xc236=function(_0x1fc619,_0x29ad91){_0x1fc619=_0x1fc619-0x0;var _0x3a5129=_0x236c[_0x1fc619];return _0x3a5129;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});config['redis']=_[_0xc236('0xc')](config[_0xc236('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc236('0xe'))['register'](socket);function respondWithRpcPromise(_0x30a28d,_0x381ed1,_0x18f33b){return new BPromise(function(_0x2f8b72,_0xaf651b){return client['request'](_0x30a28d,_0x18f33b)[_0xc236('0xf')](function(_0x3311f7){logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));logger['debug'](_0xc236('0x12'),_0x381ed1,'request\x20sent',JSON['stringify'](_0x3311f7));if(_0x3311f7[_0xc236('0x13')]){if(_0x3311f7[_0xc236('0x13')][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('ChatQueue,\x20%s,\x20%s',_0x381ed1,_0x3311f7[_0xc236('0x13')]['message']);return _0xaf651b(_0x3311f7['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0x10'),_0x381ed1,_0x3311f7[_0xc236('0x13')][_0xc236('0x15')]);return _0x2f8b72(_0x3311f7['error']['message']);}else{logger['info'](_0xc236('0x10'),_0x381ed1,_0xc236('0x11'));_0x2f8b72(_0x3311f7[_0xc236('0x16')]['message']);}})[_0xc236('0x17')](function(_0x506974){logger['error'](_0xc236('0x10'),_0x381ed1,_0x506974);_0xaf651b(_0x506974);});});}exports[_0xc236('0x18')]=function(_0x3a6183){var _0x46bc69=this;return new Promise(function(_0x2b6d3f,_0x27c6ab){return db[_0xc236('0x19')][_0xc236('0x1a')]({'raw':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a6183['options']?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1d')]||null:null,'attributes':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1e')]||null:null,'limit':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x1f')]||null:null,'include':_0x3a6183[_0xc236('0x1b')]?_0x3a6183[_0xc236('0x1b')][_0xc236('0x20')]?_['map'](_0x3a6183[_0xc236('0x1b')][_0xc236('0x20')],function(_0x356042){return{'model':db[_0x356042[_0xc236('0x21')]],'as':_0x356042['as'],'attributes':_0x356042['attributes'],'include':_0x356042[_0xc236('0x20')]?_['map'](_0x356042['include'],function(_0x15ead8){return{'model':db[_0x15ead8['model']],'as':_0x15ead8['as'],'attributes':_0x15ead8[_0xc236('0x1e')],'include':_0x15ead8['include']?_[_0xc236('0x22')](_0x15ead8['include'],function(_0x423842){return{'model':db[_0x423842[_0xc236('0x21')]],'as':_0x423842['as'],'attributes':_0x423842['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x265c8d){logger[_0xc236('0x23')](_0xc236('0x18'),_0x3a6183);logger[_0xc236('0x24')]('GetChatQueue',_0x3a6183,JSON['stringify'](_0x265c8d));_0x2b6d3f(_0x265c8d);})[_0xc236('0x17')](function(_0x53b767){logger[_0xc236('0x13')]('GetChatQueue',_0x53b767[_0xc236('0x15')],_0x3a6183);_0x27c6ab(_0x46bc69[_0xc236('0x13')](0x1f4,_0x53b767['message']));});});};exports['ShowChatQueue']=function(_0x2537f9){var _0x3053a3=this;return new Promise(function(_0xbda858,_0x2f64bd){return db[_0xc236('0x19')][_0xc236('0x25')]({'raw':_0x2537f9[_0xc236('0x1b')]?_0x2537f9[_0xc236('0x1b')][_0xc236('0x1c')]===undefined?!![]:![]:!![],'where':_0x2537f9['options']?_0x2537f9['options']['where']||null:null,'attributes':_0x2537f9[_0xc236('0x1b')]?_0x2537f9[_0xc236('0x1b')][_0xc236('0x1e')]||null:null,'include':_0x2537f9[_0xc236('0x1b')]?_0x2537f9[_0xc236('0x1b')][_0xc236('0x20')]?_[_0xc236('0x22')](_0x2537f9['options'][_0xc236('0x20')],function(_0x3f9b1d){return{'model':db[_0x3f9b1d[_0xc236('0x21')]],'as':_0x3f9b1d['as'],'attributes':_0x3f9b1d['attributes'],'include':_0x3f9b1d[_0xc236('0x20')]?_[_0xc236('0x22')](_0x3f9b1d[_0xc236('0x20')],function(_0x281137){return{'model':db[_0x281137['model']],'as':_0x281137['as'],'attributes':_0x281137[_0xc236('0x1e')],'include':_0x281137[_0xc236('0x20')]?_[_0xc236('0x22')](_0x281137[_0xc236('0x20')],function(_0x3f3785){return{'model':db[_0x3f3785[_0xc236('0x21')]],'as':_0x3f3785['as'],'attributes':_0x3f3785[_0xc236('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc236('0xf')](function(_0x131212){logger[_0xc236('0x23')](_0xc236('0x26'),_0x2537f9);logger[_0xc236('0x24')](_0xc236('0x26'),_0x2537f9,JSON[_0xc236('0x27')](_0x131212));_0xbda858(_0x131212);})[_0xc236('0x17')](function(_0x3973be){logger[_0xc236('0x13')]('ShowChatQueue',_0x3973be['message'],_0x2537f9);_0x2f64bd(_0x3053a3['error'](0x1f4,_0x3973be['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f7f0b03..f9f2cc5 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 _0xe14d=['update','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x28c03c,_0x649360){var _0x3f1235=function(_0x1dbb9c){while(--_0x1dbb9c){_0x28c03c['push'](_0x28c03c['shift']());}};_0x3f1235(++_0x649360);}(_0xe14d,0x1ee));var _0xde14=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe14d[_0x45e98e];return _0x374dba;};'use strict';var ChatQueueEvents=require(_0xde14('0x0'));var events=[_0xde14('0x1'),_0xde14('0x2'),_0xde14('0x3')];function createListener(_0x48b392,_0x1c5b4){return function(_0x28965b){_0x1c5b4['emit'](_0x48b392,_0x28965b);};}function removeListener(_0x1c3e94,_0x13c24e){return function(){ChatQueueEvents[_0xde14('0x4')](_0x1c3e94,_0x13c24e);};}exports[_0xde14('0x5')]=function(_0x461af3){for(var _0xba1514=0x0,_0x4b1f6b=events['length'];_0xba1514<_0x4b1f6b;_0xba1514++){var _0x1bd49d=events[_0xba1514];var _0x115b7d=createListener(_0xde14('0x6')+_0x1bd49d,_0x461af3);ChatQueueEvents['on'](_0x1bd49d,_0x115b7d);}}; \ No newline at end of file +var _0xb7c8=['chatQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x2a9831,_0x599826){var _0x4df16c=function(_0x27bea6){while(--_0x27bea6){_0x2a9831['push'](_0x2a9831['shift']());}};_0x4df16c(++_0x599826);}(_0xb7c8,0x119));var _0x8b7c=function(_0x5bd86b,_0x504b7b){_0x5bd86b=_0x5bd86b-0x0;var _0x74090a=_0xb7c8[_0x5bd86b];return _0x74090a;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8b7c('0x0'),_0x8b7c('0x1'),_0x8b7c('0x2')];function createListener(_0x3a84fc,_0x1dceff){return function(_0x31ad24){_0x1dceff[_0x8b7c('0x3')](_0x3a84fc,_0x31ad24);};}function removeListener(_0x50113e,_0x38672b){return function(){ChatQueueEvents[_0x8b7c('0x4')](_0x50113e,_0x38672b);};}exports[_0x8b7c('0x5')]=function(_0x440900){for(var _0x107428=0x0,_0x12665c=events[_0x8b7c('0x6')];_0x107428<_0x12665c;_0x107428++){var _0x3c8fd6=events[_0x107428];var _0x6afb55=createListener(_0x8b7c('0x7')+_0x3c8fd6,_0x440900);ChatQueueEvents['on'](_0x3c8fd6,_0x6afb55);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 856fa0c..b89264f 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 _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(_0x5f3f9e,_0x110096){var _0x97dd1a=function(_0x584630){while(--_0x584630){_0x5f3f9e['push'](_0x5f3f9e['shift']());}};_0x97dd1a(++_0x110096);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'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 +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5dd5d9,_0x1e4895){var _0xbbeaa7=function(_0x24f203){while(--_0x24f203){_0x5dd5d9['push'](_0x5dd5d9['shift']());}};_0xbbeaa7(++_0x1e4895);}(_0xe14b,0x93));var _0xbe14=function(_0x49d259,_0x297ed6){_0x49d259=_0x49d259-0x0;var _0x11c87e=_0xe14b[_0x49d259];return _0x11c87e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e993f68..d05947b 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 _0x7710=['DATE','sequelize','STRING'];(function(_0x1d3787,_0xe1bbc1){var _0x49bf22=function(_0x23e30b){while(--_0x23e30b){_0x1d3787['push'](_0x1d3787['shift']());}};_0x49bf22(++_0xe1bbc1);}(_0x7710,0x130));var _0x0771=function(_0x4d5d0a,_0x4148dd){_0x4d5d0a=_0x4d5d0a-0x0;var _0x502c59=_0x7710[_0x4d5d0a];return _0x502c59;};'use strict';var moment=require('moment');var Sequelize=require(_0x0771('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0771('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0771('0x1')]},'joinAt':{'type':Sequelize[_0x0771('0x2')]},'leaveAt':{'type':Sequelize[_0x0771('0x2')]},'acceptAt':{'type':Sequelize[_0x0771('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1ac3=['STRING','DATE','moment','sequelize','exports'];(function(_0x6cfb8a,_0x53be6f){var _0x29ba1d=function(_0x104303){while(--_0x104303){_0x6cfb8a['push'](_0x6cfb8a['shift']());}};_0x29ba1d(++_0x53be6f);}(_0x1ac3,0x129));var _0x31ac=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x1ac3[_0x5bd426];return _0x23a7eb;};'use strict';var moment=require(_0x31ac('0x0'));var Sequelize=require(_0x31ac('0x1'));module[_0x31ac('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x31ac('0x3')]},'joinAt':{'type':Sequelize[_0x31ac('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x31ac('0x4')]},'reason':{'type':Sequelize[_0x31ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5fd8e75..6fe45e3 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 _0x014c=['order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','send','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x179636,_0x3c3b50){var _0x168ec9=function(_0x38e960){while(--_0x38e960){_0x179636['push'](_0x179636['shift']());}};_0x168ec9(++_0x3c3b50);}(_0x014c,0x17b));var _0xc014=function(_0x229d7e,_0x5bc489){_0x229d7e=_0x229d7e-0x0;var _0xa78280=_0x014c[_0x229d7e];return _0xa78280;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc014('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc014('0x1'));var rp=require(_0xc014('0x2'));var moment=require(_0xc014('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc014('0x4'));var path=require(_0xc014('0x5'));var sox=require(_0xc014('0x6'));var csv=require(_0xc014('0x7'));var ejs=require(_0xc014('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc014('0x9'));var squel=require(_0xc014('0xa'));var crypto=require('crypto');var jsforce=require(_0xc014('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc014('0x7'));var querystring=require(_0xc014('0xc'));var Papa=require(_0xc014('0xd'));var Redis=require('ioredis');var authService=require(_0xc014('0xe'));var qs=require(_0xc014('0xf'));var as=require(_0xc014('0x10'));var hardwareService=require(_0xc014('0x11'));var logger=require('../../config/logger')(_0xc014('0x12'));var utils=require('../../config/utils');var config=require(_0xc014('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc014('0x14'))['db'];function respondWithStatusCode(_0xcde2d3,_0x2f8ac9){_0x2f8ac9=_0x2f8ac9||0xcc;return function(_0x1686f1){if(_0x1686f1){return _0xcde2d3['sendStatus'](_0x2f8ac9);}return _0xcde2d3[_0xc014('0x15')](_0x2f8ac9)[_0xc014('0x16')]();};}function respondWithResult(_0xe86dd,_0x5ced7d){_0x5ced7d=_0x5ced7d||0xc8;return function(_0x36b26e){if(_0x36b26e){return _0xe86dd['status'](_0x5ced7d)[_0xc014('0x17')](_0x36b26e);}};}function respondWithFilteredResult(_0x1c4d3b,_0x25fdf6){return function(_0x26f264){if(_0x26f264){var _0x9f6a26=typeof _0x25fdf6[_0xc014('0x18')]==='undefined'&&typeof _0x25fdf6[_0xc014('0x19')]===_0xc014('0x1a');var _0x263ad0=_0x26f264[_0xc014('0x1b')];var _0x5a2be0=_0x9f6a26?0x0:_0x25fdf6['offset'];var _0x42f93d=_0x9f6a26?_0x26f264['count']:_0x25fdf6['offset']+_0x25fdf6[_0xc014('0x19')];var _0x4287fe;if(_0x42f93d>=_0x263ad0){_0x42f93d=_0x263ad0;_0x4287fe=0xc8;}else{_0x4287fe=0xce;}_0x1c4d3b['status'](_0x4287fe);return _0x1c4d3b[_0xc014('0x1c')](_0xc014('0x1d'),_0x5a2be0+'-'+_0x42f93d+'/'+_0x263ad0)[_0xc014('0x17')](_0x26f264);}return null;};}function patchUpdates(_0x2dac66){return function(_0x1078c4){try{jsonpatch['apply'](_0x1078c4,_0x2dac66,!![]);}catch(_0xc8b0fb){return BPromise[_0xc014('0x1e')](_0xc8b0fb);}return _0x1078c4[_0xc014('0x1f')]();};}function saveUpdates(_0x3c58cc,_0x450b22){return function(_0x3f28b6){if(_0x3f28b6){return _0x3f28b6[_0xc014('0x20')](_0x3c58cc)['then'](function(_0x1089c6){return _0x1089c6;});}return null;};}function removeEntity(_0x1b905d,_0x16d8f9){return function(_0x174b46){if(_0x174b46){return _0x174b46[_0xc014('0x21')]()[_0xc014('0x22')](function(){_0x1b905d[_0xc014('0x15')](0xcc)[_0xc014('0x16')]();});}};}function handleEntityNotFound(_0xe4c68,_0x2e5c30){return function(_0x4850bb){if(!_0x4850bb){_0xe4c68[_0xc014('0x23')](0x194);}return _0x4850bb;};}function handleError(_0x17b6b4,_0x36b663){_0x36b663=_0x36b663||0x1f4;return function(_0x7f47ef){logger[_0xc014('0x24')](_0x7f47ef['stack']);if(_0x7f47ef[_0xc014('0x25')]){delete _0x7f47ef[_0xc014('0x25')];}_0x17b6b4[_0xc014('0x15')](_0x36b663)[_0xc014('0x26')](_0x7f47ef);};}exports['index']=function(_0x43af57,_0x40cf7c){var _0x151705={},_0x30e97a={},_0x21cd81={'count':0x0,'rows':[]};var _0x289f92=_[_0xc014('0x27')](db[_0xc014('0x28')][_0xc014('0x29')],function(_0x330869){return{'name':_0x330869[_0xc014('0x2a')],'type':_0x330869['type'][_0xc014('0x2b')]};});_0x30e97a['model']=_['map'](_0x289f92,'name');_0x30e97a[_0xc014('0x2c')]=_[_0xc014('0x2d')](_0x43af57['query']);_0x30e97a[_0xc014('0x2e')]=_[_0xc014('0x2f')](_0x30e97a[_0xc014('0x30')],_0x30e97a[_0xc014('0x2c')]);_0x151705[_0xc014('0x31')]=_[_0xc014('0x2f')](_0x30e97a[_0xc014('0x30')],qs[_0xc014('0x32')](_0x43af57[_0xc014('0x2c')][_0xc014('0x32')]));_0x151705[_0xc014('0x31')]=_0x151705[_0xc014('0x31')]['length']?_0x151705[_0xc014('0x31')]:_0x30e97a['model'];if(!_0x43af57[_0xc014('0x2c')][_0xc014('0x33')](_0xc014('0x34'))){_0x151705[_0xc014('0x19')]=qs[_0xc014('0x19')](_0x43af57[_0xc014('0x2c')][_0xc014('0x19')]);_0x151705['offset']=qs[_0xc014('0x18')](_0x43af57['query'][_0xc014('0x18')]);}_0x151705[_0xc014('0x35')]=qs[_0xc014('0x36')](_0x43af57[_0xc014('0x2c')][_0xc014('0x36')]);_0x151705[_0xc014('0x37')]=qs[_0xc014('0x2e')](_['pick'](_0x43af57[_0xc014('0x2c')],_0x30e97a[_0xc014('0x2e')]),_0x289f92);if(_0x43af57[_0xc014('0x2c')]['filter']){_0x151705[_0xc014('0x37')]=_[_0xc014('0x38')](_0x151705[_0xc014('0x37')],{'$or':_['map'](_0x289f92,function(_0x473754){if(_0x473754['type']!==_0xc014('0x39')){var _0x19d374={};_0x19d374[_0x473754[_0xc014('0x25')]]={'$like':'%'+_0x43af57[_0xc014('0x2c')][_0xc014('0x3a')]+'%'};return _0x19d374;}})});}_0x151705=_[_0xc014('0x38')]({},_0x151705,_0x43af57[_0xc014('0x3b')]);var _0xb0149e={'where':_0x151705[_0xc014('0x37')]};return db[_0xc014('0x28')][_0xc014('0x1b')](_0xb0149e)[_0xc014('0x22')](function(_0x565433){_0x21cd81[_0xc014('0x1b')]=_0x565433;if(_0x43af57[_0xc014('0x2c')][_0xc014('0x3c')]){_0x151705[_0xc014('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xc014('0x3e')](_0x151705);})['then'](function(_0x3a7f90){_0x21cd81[_0xc014('0x3f')]=_0x3a7f90;return _0x21cd81;})[_0xc014('0x22')](respondWithFilteredResult(_0x40cf7c,_0x151705))[_0xc014('0x40')](handleError(_0x40cf7c,null));};exports[_0xc014('0x41')]=function(_0x46ea1c,_0x1f7dfb){var _0x2a0265={'raw':!![],'where':{'id':_0x46ea1c[_0xc014('0x42')]['id']}},_0x84720d={};_0x84720d[_0xc014('0x30')]=_['keys'](db[_0xc014('0x28')]['rawAttributes']);_0x84720d['query']=_[_0xc014('0x2d')](_0x46ea1c[_0xc014('0x2c')]);_0x84720d[_0xc014('0x2e')]=_[_0xc014('0x2f')](_0x84720d[_0xc014('0x30')],_0x84720d['query']);_0x2a0265[_0xc014('0x31')]=_[_0xc014('0x2f')](_0x84720d['model'],qs[_0xc014('0x32')](_0x46ea1c[_0xc014('0x2c')][_0xc014('0x32')]));_0x2a0265[_0xc014('0x31')]=_0x2a0265[_0xc014('0x31')][_0xc014('0x43')]?_0x2a0265[_0xc014('0x31')]:_0x84720d[_0xc014('0x30')];if(_0x46ea1c[_0xc014('0x2c')]['includeAll']){_0x2a0265[_0xc014('0x3d')]=[{'all':!![]}];}_0x2a0265=_[_0xc014('0x38')]({},_0x2a0265,_0x46ea1c[_0xc014('0x3b')]);return db[_0xc014('0x28')][_0xc014('0x44')](_0x2a0265)[_0xc014('0x22')](handleEntityNotFound(_0x1f7dfb,null))[_0xc014('0x22')](respondWithResult(_0x1f7dfb,null))[_0xc014('0x40')](handleError(_0x1f7dfb,null));};exports[_0xc014('0x45')]=function(_0x541ad6,_0x2ce299){return db['ChatQueueReport']['create'](_0x541ad6[_0xc014('0x46')],{})['then'](respondWithResult(_0x2ce299,0xc9))[_0xc014('0x40')](handleError(_0x2ce299,null));};exports[_0xc014('0x20')]=function(_0x56595e,_0x359c24){if(_0x56595e[_0xc014('0x46')]['id']){delete _0x56595e[_0xc014('0x46')]['id'];}return db[_0xc014('0x28')][_0xc014('0x44')]({'where':{'id':_0x56595e[_0xc014('0x42')]['id']}})['then'](handleEntityNotFound(_0x359c24,null))[_0xc014('0x22')](saveUpdates(_0x56595e[_0xc014('0x46')],null))[_0xc014('0x22')](respondWithResult(_0x359c24,null))[_0xc014('0x40')](handleError(_0x359c24,null));};exports[_0xc014('0x21')]=function(_0x464d3e,_0x255a3b){return db[_0xc014('0x28')][_0xc014('0x44')]({'where':{'id':_0x464d3e[_0xc014('0x42')]['id']}})['then'](handleEntityNotFound(_0x255a3b,null))[_0xc014('0x22')](removeEntity(_0x255a3b,null))[_0xc014('0x40')](handleError(_0x255a3b,null));};exports[_0xc014('0x47')]=function(_0x1d37be,_0x53676a){return db[_0xc014('0x28')][_0xc014('0x47')]()[_0xc014('0x22')](respondWithResult(_0x53676a,null))[_0xc014('0x40')](handleError(_0x53676a,null));}; \ No newline at end of file +var _0xf562=['map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','ChatQueueReport','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','fieldName','type','key','model'];(function(_0x2ffd34,_0xc660c9){var _0x9d8e89=function(_0x5609fd){while(--_0x5609fd){_0x2ffd34['push'](_0x2ffd34['shift']());}};_0x9d8e89(++_0xc660c9);}(_0xf562,0x100));var _0x2f56=function(_0x3ba963,_0x26436b){_0x3ba963=_0x3ba963-0x0;var _0x5d0bc4=_0xf562[_0x3ba963];return _0x5d0bc4;};'use strict';var emlformat=require(_0x2f56('0x0'));var rimraf=require(_0x2f56('0x1'));var zipdir=require(_0x2f56('0x2'));var jsonpatch=require(_0x2f56('0x3'));var rp=require(_0x2f56('0x4'));var moment=require(_0x2f56('0x5'));var BPromise=require(_0x2f56('0x6'));var Mustache=require(_0x2f56('0x7'));var util=require(_0x2f56('0x8'));var path=require('path');var sox=require(_0x2f56('0x9'));var csv=require('to-csv');var ejs=require(_0x2f56('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f56('0xb'));var squel=require(_0x2f56('0xc'));var crypto=require(_0x2f56('0xd'));var jsforce=require(_0x2f56('0xe'));var deskjs=require(_0x2f56('0xf'));var toCsv=require(_0x2f56('0x10'));var querystring=require(_0x2f56('0x11'));var Papa=require(_0x2f56('0x12'));var Redis=require(_0x2f56('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f56('0x14'));var as=require(_0x2f56('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f56('0x16'))(_0x2f56('0x17'));var utils=require('../../config/utils');var config=require(_0x2f56('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f56('0x19'))['db'];function respondWithStatusCode(_0x519c81,_0xa190b0){_0xa190b0=_0xa190b0||0xcc;return function(_0x3bec3f){if(_0x3bec3f){return _0x519c81[_0x2f56('0x1a')](_0xa190b0);}return _0x519c81[_0x2f56('0x1b')](_0xa190b0)[_0x2f56('0x1c')]();};}function respondWithResult(_0x69fc74,_0x37e55f){_0x37e55f=_0x37e55f||0xc8;return function(_0x3d9cb3){if(_0x3d9cb3){return _0x69fc74['status'](_0x37e55f)[_0x2f56('0x1d')](_0x3d9cb3);}};}function respondWithFilteredResult(_0x42a056,_0x11dd1e){return function(_0x1d2463){if(_0x1d2463){var _0x341045=typeof _0x11dd1e['offset']===_0x2f56('0x1e')&&typeof _0x11dd1e[_0x2f56('0x1f')]===_0x2f56('0x1e');var _0x3e3165=_0x1d2463[_0x2f56('0x20')];var _0x59db1d=_0x341045?0x0:_0x11dd1e[_0x2f56('0x21')];var _0x33b43f=_0x341045?_0x1d2463[_0x2f56('0x20')]:_0x11dd1e[_0x2f56('0x21')]+_0x11dd1e[_0x2f56('0x1f')];var _0x562cea;if(_0x33b43f>=_0x3e3165){_0x33b43f=_0x3e3165;_0x562cea=0xc8;}else{_0x562cea=0xce;}_0x42a056[_0x2f56('0x1b')](_0x562cea);return _0x42a056[_0x2f56('0x22')](_0x2f56('0x23'),_0x59db1d+'-'+_0x33b43f+'/'+_0x3e3165)[_0x2f56('0x1d')](_0x1d2463);}return null;};}function patchUpdates(_0x33dc10){return function(_0x27613f){try{jsonpatch[_0x2f56('0x24')](_0x27613f,_0x33dc10,!![]);}catch(_0x349d55){return BPromise['reject'](_0x349d55);}return _0x27613f[_0x2f56('0x25')]();};}function saveUpdates(_0x497d3f,_0x5bac85){return function(_0x297827){if(_0x297827){return _0x297827[_0x2f56('0x26')](_0x497d3f)[_0x2f56('0x27')](function(_0x4ee4c9){return _0x4ee4c9;});}return null;};}function removeEntity(_0x21f4b0,_0x433f0b){return function(_0x2db586){if(_0x2db586){return _0x2db586['destroy']()['then'](function(){_0x21f4b0[_0x2f56('0x1b')](0xcc)[_0x2f56('0x1c')]();});}};}function handleEntityNotFound(_0x38b366,_0x3e047b){return function(_0x4406ff){if(!_0x4406ff){_0x38b366['sendStatus'](0x194);}return _0x4406ff;};}function handleError(_0x2641d9,_0xaec9e8){_0xaec9e8=_0xaec9e8||0x1f4;return function(_0x861e9c){logger[_0x2f56('0x28')](_0x861e9c[_0x2f56('0x29')]);if(_0x861e9c[_0x2f56('0x2a')]){delete _0x861e9c[_0x2f56('0x2a')];}_0x2641d9[_0x2f56('0x1b')](_0xaec9e8)[_0x2f56('0x2b')](_0x861e9c);};}exports['index']=function(_0x44ff58,_0x49b89c){var _0x4e6dbc={},_0x284252={},_0x60a325={'count':0x0,'rows':[]};var _0x288019=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x61a170){return{'name':_0x61a170[_0x2f56('0x2c')],'type':_0x61a170[_0x2f56('0x2d')][_0x2f56('0x2e')]};});_0x284252[_0x2f56('0x2f')]=_[_0x2f56('0x30')](_0x288019,_0x2f56('0x2a'));_0x284252['query']=_[_0x2f56('0x31')](_0x44ff58[_0x2f56('0x32')]);_0x284252[_0x2f56('0x33')]=_['intersection'](_0x284252[_0x2f56('0x2f')],_0x284252[_0x2f56('0x32')]);_0x4e6dbc[_0x2f56('0x34')]=_[_0x2f56('0x35')](_0x284252[_0x2f56('0x2f')],qs[_0x2f56('0x36')](_0x44ff58[_0x2f56('0x32')]['fields']));_0x4e6dbc[_0x2f56('0x34')]=_0x4e6dbc[_0x2f56('0x34')]['length']?_0x4e6dbc[_0x2f56('0x34')]:_0x284252[_0x2f56('0x2f')];if(!_0x44ff58['query'][_0x2f56('0x37')]('nolimit')){_0x4e6dbc['limit']=qs[_0x2f56('0x1f')](_0x44ff58[_0x2f56('0x32')][_0x2f56('0x1f')]);_0x4e6dbc['offset']=qs[_0x2f56('0x21')](_0x44ff58['query'][_0x2f56('0x21')]);}_0x4e6dbc['order']=qs[_0x2f56('0x38')](_0x44ff58[_0x2f56('0x32')][_0x2f56('0x38')]);_0x4e6dbc['where']=qs[_0x2f56('0x33')](_[_0x2f56('0x39')](_0x44ff58[_0x2f56('0x32')],_0x284252[_0x2f56('0x33')]),_0x288019);if(_0x44ff58[_0x2f56('0x32')][_0x2f56('0x3a')]){_0x4e6dbc['where']=_[_0x2f56('0x3b')](_0x4e6dbc[_0x2f56('0x3c')],{'$or':_[_0x2f56('0x30')](_0x288019,function(_0x27c4ce){if(_0x27c4ce[_0x2f56('0x2d')]!==_0x2f56('0x3d')){var _0x141c09={};_0x141c09[_0x27c4ce[_0x2f56('0x2a')]]={'$like':'%'+_0x44ff58[_0x2f56('0x32')]['filter']+'%'};return _0x141c09;}})});}_0x4e6dbc=_[_0x2f56('0x3b')]({},_0x4e6dbc,_0x44ff58['options']);var _0x12032c={'where':_0x4e6dbc[_0x2f56('0x3c')]};return db[_0x2f56('0x3e')][_0x2f56('0x20')](_0x12032c)[_0x2f56('0x27')](function(_0x197bcc){_0x60a325[_0x2f56('0x20')]=_0x197bcc;if(_0x44ff58['query']['includeAll']){_0x4e6dbc[_0x2f56('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x2f56('0x40')](_0x4e6dbc);})[_0x2f56('0x27')](function(_0x1d3efa){_0x60a325[_0x2f56('0x41')]=_0x1d3efa;return _0x60a325;})[_0x2f56('0x27')](respondWithFilteredResult(_0x49b89c,_0x4e6dbc))[_0x2f56('0x42')](handleError(_0x49b89c,null));};exports[_0x2f56('0x43')]=function(_0x18464b,_0x1de6a7){var _0x5cf160={'raw':!![],'where':{'id':_0x18464b[_0x2f56('0x44')]['id']}},_0x5779a6={};_0x5779a6['model']=_[_0x2f56('0x31')](db[_0x2f56('0x3e')][_0x2f56('0x45')]);_0x5779a6[_0x2f56('0x32')]=_[_0x2f56('0x31')](_0x18464b[_0x2f56('0x32')]);_0x5779a6['filters']=_['intersection'](_0x5779a6['model'],_0x5779a6[_0x2f56('0x32')]);_0x5cf160['attributes']=_[_0x2f56('0x35')](_0x5779a6[_0x2f56('0x2f')],qs['fields'](_0x18464b[_0x2f56('0x32')]['fields']));_0x5cf160[_0x2f56('0x34')]=_0x5cf160['attributes'][_0x2f56('0x46')]?_0x5cf160[_0x2f56('0x34')]:_0x5779a6[_0x2f56('0x2f')];if(_0x18464b[_0x2f56('0x32')]['includeAll']){_0x5cf160[_0x2f56('0x3f')]=[{'all':!![]}];}_0x5cf160=_[_0x2f56('0x3b')]({},_0x5cf160,_0x18464b[_0x2f56('0x47')]);return db[_0x2f56('0x3e')][_0x2f56('0x48')](_0x5cf160)['then'](handleEntityNotFound(_0x1de6a7,null))[_0x2f56('0x27')](respondWithResult(_0x1de6a7,null))[_0x2f56('0x42')](handleError(_0x1de6a7,null));};exports[_0x2f56('0x49')]=function(_0x519790,_0x3218eb){return db['ChatQueueReport'][_0x2f56('0x49')](_0x519790[_0x2f56('0x4a')],{})['then'](respondWithResult(_0x3218eb,0xc9))['catch'](handleError(_0x3218eb,null));};exports[_0x2f56('0x26')]=function(_0x338324,_0x215215){if(_0x338324[_0x2f56('0x4a')]['id']){delete _0x338324[_0x2f56('0x4a')]['id'];}return db['ChatQueueReport'][_0x2f56('0x48')]({'where':{'id':_0x338324[_0x2f56('0x44')]['id']}})[_0x2f56('0x27')](handleEntityNotFound(_0x215215,null))['then'](saveUpdates(_0x338324[_0x2f56('0x4a')],null))[_0x2f56('0x27')](respondWithResult(_0x215215,null))[_0x2f56('0x42')](handleError(_0x215215,null));};exports[_0x2f56('0x4b')]=function(_0x4ad9bf,_0x2e0311){return db[_0x2f56('0x3e')][_0x2f56('0x48')]({'where':{'id':_0x4ad9bf[_0x2f56('0x44')]['id']}})[_0x2f56('0x27')](handleEntityNotFound(_0x2e0311,null))[_0x2f56('0x27')](removeEntity(_0x2e0311,null))[_0x2f56('0x42')](handleError(_0x2e0311,null));};exports['describe']=function(_0x3a4cf4,_0x213d99){return db['ChatQueueReport']['describe']()[_0x2f56('0x27')](respondWithResult(_0x213d99,null))[_0x2f56('0x42')](handleError(_0x213d99,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f7f9cd0..3c140fa 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0xd0a290,_0x55cb33){var _0x377b3d=function(_0x56d2e0){while(--_0x56d2e0){_0xd0a290['push'](_0xd0a290['shift']());}};_0x377b3d(++_0x55cb33);}(_0xb10b,0x12a));var _0xbb10=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xb10b[_0x386525];return _0x14d015;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2f3623,_0x34a5ed){var _0x51e1b3=function(_0x6d6200){while(--_0x6d6200){_0x2f3623['push'](_0x2f3623['shift']());}};_0x51e1b3(++_0x34a5ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xcb91[_0x53bcc3];return _0x47c959;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 74b5940..12d2e34 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 _0xd6f7=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','raw','UpdateChatQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x957c5f,_0x2ec4ae){var _0x42c7cb=function(_0x12adb0){while(--_0x12adb0){_0x957c5f['push'](_0x957c5f['shift']());}};_0x42c7cb(++_0x2ec4ae);}(_0xd6f7,0xed));var _0x7d6f=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0xd6f7[_0x4ec7f2];return _0x118004;};'use strict';var _=require(_0x7d6f('0x0'));var util=require(_0x7d6f('0x1'));var moment=require(_0x7d6f('0x2'));var BPromise=require(_0x7d6f('0x3'));var rs=require(_0x7d6f('0x4'));var fs=require('fs');var Redis=require(_0x7d6f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d6f('0x6'));var logger=require('../../config/logger')(_0x7d6f('0x7'));var config=require(_0x7d6f('0x8'));var jayson=require(_0x7d6f('0x9'));var client=jayson[_0x7d6f('0xa')][_0x7d6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe5f837,_0x5aef59,_0xc5f0be){return new BPromise(function(_0x31b9a9,_0x1ebcb3){return client[_0x7d6f('0xc')](_0xe5f837,_0xc5f0be)[_0x7d6f('0xd')](function(_0x4884d2){logger[_0x7d6f('0xe')](_0x7d6f('0xf'),_0x5aef59,_0x7d6f('0x10'));logger[_0x7d6f('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5aef59,_0x7d6f('0x10'),JSON[_0x7d6f('0x12')](_0x4884d2));if(_0x4884d2[_0x7d6f('0x13')]){if(_0x4884d2[_0x7d6f('0x13')]['code']===0x1f4){logger[_0x7d6f('0x13')](_0x7d6f('0xf'),_0x5aef59,_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);return _0x1ebcb3(_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);}logger['error'](_0x7d6f('0xf'),_0x5aef59,_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);return _0x31b9a9(_0x4884d2[_0x7d6f('0x13')][_0x7d6f('0x14')]);}else{logger[_0x7d6f('0xe')](_0x7d6f('0xf'),_0x5aef59,_0x7d6f('0x10'));_0x31b9a9(_0x4884d2[_0x7d6f('0x15')][_0x7d6f('0x14')]);}})[_0x7d6f('0x16')](function(_0x39e631){logger[_0x7d6f('0x13')](_0x7d6f('0xf'),_0x5aef59,_0x39e631);_0x1ebcb3(_0x39e631);});});}exports[_0x7d6f('0x17')]=function(_0x27082d){var _0x32ad57=this;return new Promise(function(_0x1d8f6d,_0x28df1d){return db[_0x7d6f('0x18')]['create'](_0x27082d['body'],{'raw':_0x27082d['options']?_0x27082d[_0x7d6f('0x19')][_0x7d6f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a0c06){logger[_0x7d6f('0xe')](_0x7d6f('0x17'),_0x27082d);logger[_0x7d6f('0x11')](_0x7d6f('0x17'),_0x27082d,JSON[_0x7d6f('0x12')](_0x4a0c06));_0x1d8f6d(_0x4a0c06);})[_0x7d6f('0x16')](function(_0x560158){logger['error'](_0x7d6f('0x17'),_0x560158[_0x7d6f('0x14')],_0x27082d);_0x28df1d(_0x32ad57[_0x7d6f('0x13')](0x1f4,_0x560158[_0x7d6f('0x14')]));});});};exports[_0x7d6f('0x1b')]=function(_0x1f3673){var _0x50cbc8=this;return new Promise(function(_0x12183e,_0x2b8754){return db[_0x7d6f('0x18')][_0x7d6f('0x1c')](_0x1f3673['body'],{'raw':_0x1f3673[_0x7d6f('0x19')]?_0x1f3673[_0x7d6f('0x19')][_0x7d6f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f3673[_0x7d6f('0x19')]?_0x1f3673['options'][_0x7d6f('0x1d')]||null:null,'attributes':_0x1f3673[_0x7d6f('0x19')]?_0x1f3673[_0x7d6f('0x19')][_0x7d6f('0x1e')]||null:null,'limit':_0x1f3673[_0x7d6f('0x19')]?_0x1f3673[_0x7d6f('0x19')]['limit']||null:null})[_0x7d6f('0xd')](function(_0x4b1f7b){logger[_0x7d6f('0xe')]('UpdateChatQueueReport',_0x1f3673);logger[_0x7d6f('0x11')]('UpdateChatQueueReport',_0x1f3673,JSON['stringify'](_0x4b1f7b));_0x12183e(_0x4b1f7b);})[_0x7d6f('0x16')](function(_0x5b4d01){logger['error'](_0x7d6f('0x1b'),_0x5b4d01[_0x7d6f('0x14')],_0x1f3673);_0x2b8754(_0x50cbc8[_0x7d6f('0x13')](0x1f4,_0x5b4d01['message']));});});}; \ No newline at end of file +var _0xa8f0=['CreateChatQueueReport','options','raw','stringify','UpdateChatQueueReport','body','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0xb51261,_0x51a20c){var _0x217382=function(_0x5e0c81){while(--_0x5e0c81){_0xb51261['push'](_0xb51261['shift']());}};_0x217382(++_0x51a20c);}(_0xa8f0,0x173));var _0x0a8f=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0xa8f0[_0x4d093a];return _0x5d7227;};'use strict';var _=require('lodash');var util=require(_0x0a8f('0x0'));var moment=require(_0x0a8f('0x1'));var BPromise=require(_0x0a8f('0x2'));var rs=require(_0x0a8f('0x3'));var fs=require('fs');var Redis=require(_0x0a8f('0x4'));var db=require(_0x0a8f('0x5'))['db'];var utils=require(_0x0a8f('0x6'));var logger=require(_0x0a8f('0x7'))('rpc');var config=require(_0x0a8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a8f('0x9')][_0x0a8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xca44d2,_0x65bd19,_0x54f2d6){return new BPromise(function(_0x430f12,_0x228e64){return client['request'](_0xca44d2,_0x54f2d6)[_0x0a8f('0xb')](function(_0x128683){logger[_0x0a8f('0xc')](_0x0a8f('0xd'),_0x65bd19,_0x0a8f('0xe'));logger[_0x0a8f('0xf')](_0x0a8f('0x10'),_0x65bd19,_0x0a8f('0xe'),JSON['stringify'](_0x128683));if(_0x128683['error']){if(_0x128683['error'][_0x0a8f('0x11')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x65bd19,_0x128683[_0x0a8f('0x12')][_0x0a8f('0x13')]);return _0x228e64(_0x128683[_0x0a8f('0x12')][_0x0a8f('0x13')]);}logger[_0x0a8f('0x12')](_0x0a8f('0xd'),_0x65bd19,_0x128683[_0x0a8f('0x12')]['message']);return _0x430f12(_0x128683[_0x0a8f('0x12')][_0x0a8f('0x13')]);}else{logger[_0x0a8f('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x65bd19,'request\x20sent');_0x430f12(_0x128683['result'][_0x0a8f('0x13')]);}})[_0x0a8f('0x14')](function(_0x251e6e){logger[_0x0a8f('0x12')](_0x0a8f('0xd'),_0x65bd19,_0x251e6e);_0x228e64(_0x251e6e);});});}exports[_0x0a8f('0x15')]=function(_0x56ec8e){var _0x40c859=this;return new Promise(function(_0x2c2e2d,_0x58d493){return db['ChatQueueReport']['create'](_0x56ec8e['body'],{'raw':_0x56ec8e[_0x0a8f('0x16')]?_0x56ec8e[_0x0a8f('0x16')][_0x0a8f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3bc61c){logger[_0x0a8f('0xc')](_0x0a8f('0x15'),_0x56ec8e);logger[_0x0a8f('0xf')](_0x0a8f('0x15'),_0x56ec8e,JSON[_0x0a8f('0x18')](_0x3bc61c));_0x2c2e2d(_0x3bc61c);})['catch'](function(_0x743a91){logger[_0x0a8f('0x12')]('CreateChatQueueReport',_0x743a91['message'],_0x56ec8e);_0x58d493(_0x40c859['error'](0x1f4,_0x743a91[_0x0a8f('0x13')]));});});};exports[_0x0a8f('0x19')]=function(_0x43c9c3){var _0x41ccf2=this;return new Promise(function(_0x263a2c,_0xbbd479){return db['ChatQueueReport']['update'](_0x43c9c3[_0x0a8f('0x1a')],{'raw':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3[_0x0a8f('0x16')][_0x0a8f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3['options'][_0x0a8f('0x1b')]||null:null,'attributes':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3[_0x0a8f('0x16')]['attributes']||null:null,'limit':_0x43c9c3[_0x0a8f('0x16')]?_0x43c9c3[_0x0a8f('0x16')]['limit']||null:null})[_0x0a8f('0xb')](function(_0x78e1b5){logger[_0x0a8f('0xc')](_0x0a8f('0x19'),_0x43c9c3);logger['debug']('UpdateChatQueueReport',_0x43c9c3,JSON[_0x0a8f('0x18')](_0x78e1b5));_0x263a2c(_0x78e1b5);})['catch'](function(_0x48e8d1){logger[_0x0a8f('0x12')]('UpdateChatQueueReport',_0x48e8d1[_0x0a8f('0x13')],_0x43c9c3);_0xbbd479(_0x41ccf2['error'](0x1f4,_0x48e8d1['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1083fce..c0c836e 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 _0xd5b9=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x4f79bb,_0x2c1762){var _0x8ba35c=function(_0x462470){while(--_0x462470){_0x4f79bb['push'](_0x4f79bb['shift']());}};_0x8ba35c(++_0x2c1762);}(_0xd5b9,0x1c5));var _0x9d5b=function(_0x34e9ec,_0x39831a){_0x34e9ec=_0x34e9ec-0x0;var _0x46e122=_0xd5b9[_0x34e9ec];return _0x46e122;};'use strict';var multer=require(_0x9d5b('0x0'));var util=require('util');var path=require(_0x9d5b('0x1'));var timeout=require(_0x9d5b('0x2'));var express=require(_0x9d5b('0x3'));var router=express[_0x9d5b('0x4')]();var fs_extra=require(_0x9d5b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d5b('0x6'));var config=require(_0x9d5b('0x7'));var controller=require(_0x9d5b('0x8'));router[_0x9d5b('0x9')]('/',auth[_0x9d5b('0xa')](),controller[_0x9d5b('0xb')]);router[_0x9d5b('0x9')](_0x9d5b('0xc'),auth[_0x9d5b('0xa')](),controller[_0x9d5b('0xd')]);router['get'](_0x9d5b('0xe'),auth['isAuthenticated'](),controller[_0x9d5b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9d5b('0x10')]);router[_0x9d5b('0x11')](_0x9d5b('0xe'),auth[_0x9d5b('0xa')](),controller['update']);router[_0x9d5b('0x12')]('/:id',auth[_0x9d5b('0xa')](),controller[_0x9d5b('0x13')]);module[_0x9d5b('0x14')]=router; \ No newline at end of file +var _0x5dd3=['/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','index'];(function(_0x2dcb28,_0x26b688){var _0x314ba5=function(_0x2cf325){while(--_0x2cf325){_0x2dcb28['push'](_0x2dcb28['shift']());}};_0x314ba5(++_0x26b688);}(_0x5dd3,0x1af));var _0x35dd=function(_0x3526a5,_0x56825d){_0x3526a5=_0x3526a5-0x0;var _0x44f869=_0x5dd3[_0x3526a5];return _0x44f869;};'use strict';var multer=require('multer');var util=require(_0x35dd('0x0'));var path=require(_0x35dd('0x1'));var timeout=require(_0x35dd('0x2'));var express=require('express');var router=express[_0x35dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35dd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x35dd('0x5'));var controller=require(_0x35dd('0x6'));router[_0x35dd('0x7')]('/',auth['isAuthenticated'](),controller[_0x35dd('0x8')]);router[_0x35dd('0x7')](_0x35dd('0x9'),auth[_0x35dd('0xa')](),controller[_0x35dd('0xb')]);router[_0x35dd('0x7')](_0x35dd('0xc'),auth[_0x35dd('0xa')](),controller['show']);router[_0x35dd('0xd')]('/',auth[_0x35dd('0xa')](),controller[_0x35dd('0xe')]);router[_0x35dd('0xf')](_0x35dd('0xc'),auth['isAuthenticated'](),controller[_0x35dd('0x10')]);router[_0x35dd('0x11')](_0x35dd('0xc'),auth[_0x35dd('0xa')](),controller[_0x35dd('0x12')]);module[_0x35dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c4317df..0f15a12 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3ac16e,_0x39776c){var _0x57afcb=function(_0x4ebed2){while(--_0x4ebed2){_0x3ac16e['push'](_0x3ac16e['shift']());}};_0x57afcb(++_0x39776c);}(_0x70e0,0x17b));var _0x070e=function(_0x57d3d5,_0x360475){_0x57d3d5=_0x57d3d5-0x0;var _0x21a326=_0x70e0[_0x57d3d5];return _0x21a326;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x230a9b,_0x3bbee7){var _0x28dfd1=function(_0x18f00a){while(--_0x18f00a){_0x230a9b['push'](_0x230a9b['shift']());}};_0x28dfd1(++_0x3bbee7);}(_0x4b84,0x1cc));var _0x44b8=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4b84[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1a6ec38..664b2e1 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 _0xa98c=['reject','save','update','then','destroy','stack','name','send','index','map','ChatTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','filter','merge','where','type','VIRTUAL','options','include','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','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','count','limit','Content-Range'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xa98c,0xbd));var _0xca98=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xa98c[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0xca98('0x0'));var rimraf=require(_0xca98('0x1'));var zipdir=require(_0xca98('0x2'));var jsonpatch=require(_0xca98('0x3'));var rp=require(_0xca98('0x4'));var moment=require(_0xca98('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xca98('0x6'));var util=require(_0xca98('0x7'));var path=require('path');var sox=require(_0xca98('0x8'));var csv=require(_0xca98('0x9'));var ejs=require(_0xca98('0xa'));var fs=require('fs');var fs_extra=require(_0xca98('0xb'));var _=require(_0xca98('0xc'));var squel=require(_0xca98('0xd'));var crypto=require(_0xca98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xca98('0xf'));var toCsv=require(_0xca98('0x9'));var querystring=require('querystring');var Papa=require(_0xca98('0x10'));var Redis=require(_0xca98('0x11'));var authService=require(_0xca98('0x12'));var qs=require(_0xca98('0x13'));var as=require(_0xca98('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca98('0x15'))(_0xca98('0x16'));var utils=require(_0xca98('0x17'));var config=require(_0xca98('0x18'));var licenseUtil=require(_0xca98('0x19'));var db=require(_0xca98('0x1a'))['db'];function respondWithStatusCode(_0x250617,_0x306ba0){_0x306ba0=_0x306ba0||0xcc;return function(_0x3f212f){if(_0x3f212f){return _0x250617[_0xca98('0x1b')](_0x306ba0);}return _0x250617['status'](_0x306ba0)[_0xca98('0x1c')]();};}function respondWithResult(_0x5f0877,_0x4cfadd){_0x4cfadd=_0x4cfadd||0xc8;return function(_0x4884ae){if(_0x4884ae){return _0x5f0877[_0xca98('0x1d')](_0x4cfadd)[_0xca98('0x1e')](_0x4884ae);}};}function respondWithFilteredResult(_0x319162,_0x1c3cf7){return function(_0x4b0533){if(_0x4b0533){var _0x4e5d74=typeof _0x1c3cf7['offset']===_0xca98('0x1f')&&typeof _0x1c3cf7['limit']===_0xca98('0x1f');var _0x501be0=_0x4b0533['count'];var _0x4e8778=_0x4e5d74?0x0:_0x1c3cf7[_0xca98('0x20')];var _0x2b79b8=_0x4e5d74?_0x4b0533[_0xca98('0x21')]:_0x1c3cf7[_0xca98('0x20')]+_0x1c3cf7[_0xca98('0x22')];var _0x77f13b;if(_0x2b79b8>=_0x501be0){_0x2b79b8=_0x501be0;_0x77f13b=0xc8;}else{_0x77f13b=0xce;}_0x319162[_0xca98('0x1d')](_0x77f13b);return _0x319162['set'](_0xca98('0x23'),_0x4e8778+'-'+_0x2b79b8+'/'+_0x501be0)[_0xca98('0x1e')](_0x4b0533);}return null;};}function patchUpdates(_0x10fec6){return function(_0x4885cc){try{jsonpatch['apply'](_0x4885cc,_0x10fec6,!![]);}catch(_0x376050){return BPromise[_0xca98('0x24')](_0x376050);}return _0x4885cc[_0xca98('0x25')]();};}function saveUpdates(_0x2bd1c3,_0x407ba3){return function(_0x24e299){if(_0x24e299){return _0x24e299[_0xca98('0x26')](_0x2bd1c3)[_0xca98('0x27')](function(_0x41f20d){return _0x41f20d;});}return null;};}function removeEntity(_0x5d0630,_0x15ac5d){return function(_0x24e698){if(_0x24e698){return _0x24e698[_0xca98('0x28')]()[_0xca98('0x27')](function(){_0x5d0630[_0xca98('0x1d')](0xcc)[_0xca98('0x1c')]();});}};}function handleEntityNotFound(_0x3ce0aa,_0xa5c493){return function(_0xe6d4c6){if(!_0xe6d4c6){_0x3ce0aa[_0xca98('0x1b')](0x194);}return _0xe6d4c6;};}function handleError(_0x507664,_0x2c5235){_0x2c5235=_0x2c5235||0x1f4;return function(_0x3c8f8d){logger['error'](_0x3c8f8d[_0xca98('0x29')]);if(_0x3c8f8d[_0xca98('0x2a')]){delete _0x3c8f8d[_0xca98('0x2a')];}_0x507664[_0xca98('0x1d')](_0x2c5235)[_0xca98('0x2b')](_0x3c8f8d);};}exports[_0xca98('0x2c')]=function(_0x3231d1,_0x1e035c){var _0x4b369a={},_0xc31a44={},_0x441f3b={'count':0x0,'rows':[]};var _0x565c27=_[_0xca98('0x2d')](db[_0xca98('0x2e')]['rawAttributes'],function(_0x26ded9){return{'name':_0x26ded9[_0xca98('0x2f')],'type':_0x26ded9['type'][_0xca98('0x30')]};});_0xc31a44[_0xca98('0x31')]=_[_0xca98('0x2d')](_0x565c27,'name');_0xc31a44[_0xca98('0x32')]=_[_0xca98('0x33')](_0x3231d1['query']);_0xc31a44[_0xca98('0x34')]=_[_0xca98('0x35')](_0xc31a44['model'],_0xc31a44['query']);_0x4b369a[_0xca98('0x36')]=_['intersection'](_0xc31a44[_0xca98('0x31')],qs[_0xca98('0x37')](_0x3231d1[_0xca98('0x32')]['fields']));_0x4b369a[_0xca98('0x36')]=_0x4b369a[_0xca98('0x36')]['length']?_0x4b369a['attributes']:_0xc31a44[_0xca98('0x31')];if(!_0x3231d1[_0xca98('0x32')][_0xca98('0x38')](_0xca98('0x39'))){_0x4b369a['limit']=qs['limit'](_0x3231d1[_0xca98('0x32')]['limit']);_0x4b369a[_0xca98('0x20')]=qs[_0xca98('0x20')](_0x3231d1[_0xca98('0x32')]['offset']);}_0x4b369a['order']=qs['sort'](_0x3231d1[_0xca98('0x32')]['sort']);_0x4b369a['where']=qs[_0xca98('0x34')](_[_0xca98('0x3a')](_0x3231d1[_0xca98('0x32')],_0xc31a44['filters']),_0x565c27);if(_0x3231d1['query'][_0xca98('0x3b')]){_0x4b369a['where']=_[_0xca98('0x3c')](_0x4b369a[_0xca98('0x3d')],{'$or':_[_0xca98('0x2d')](_0x565c27,function(_0x5a59b2){if(_0x5a59b2[_0xca98('0x3e')]!==_0xca98('0x3f')){var _0x3e6eef={};_0x3e6eef[_0x5a59b2[_0xca98('0x2a')]]={'$like':'%'+_0x3231d1[_0xca98('0x32')]['filter']+'%'};return _0x3e6eef;}})});}_0x4b369a=_[_0xca98('0x3c')]({},_0x4b369a,_0x3231d1[_0xca98('0x40')]);var _0x18cb62={'where':_0x4b369a['where']};return db[_0xca98('0x2e')]['count'](_0x18cb62)[_0xca98('0x27')](function(_0x4483bd){_0x441f3b['count']=_0x4483bd;if(_0x3231d1[_0xca98('0x32')]['includeAll']){_0x4b369a[_0xca98('0x41')]=[{'all':!![]}];}return db[_0xca98('0x2e')]['findAll'](_0x4b369a);})['then'](function(_0x1f33ec){_0x441f3b[_0xca98('0x42')]=_0x1f33ec;return _0x441f3b;})[_0xca98('0x27')](respondWithFilteredResult(_0x1e035c,_0x4b369a))['catch'](handleError(_0x1e035c,null));};exports[_0xca98('0x43')]=function(_0x44aa2c,_0x20b782){var _0x39a5b4={'raw':!![],'where':{'id':_0x44aa2c[_0xca98('0x44')]['id']}},_0xcc02d={};_0xcc02d[_0xca98('0x31')]=_[_0xca98('0x33')](db['ChatTransferReport']['rawAttributes']);_0xcc02d['query']=_[_0xca98('0x33')](_0x44aa2c[_0xca98('0x32')]);_0xcc02d[_0xca98('0x34')]=_[_0xca98('0x35')](_0xcc02d[_0xca98('0x31')],_0xcc02d[_0xca98('0x32')]);_0x39a5b4[_0xca98('0x36')]=_[_0xca98('0x35')](_0xcc02d[_0xca98('0x31')],qs[_0xca98('0x37')](_0x44aa2c[_0xca98('0x32')][_0xca98('0x37')]));_0x39a5b4[_0xca98('0x36')]=_0x39a5b4[_0xca98('0x36')][_0xca98('0x45')]?_0x39a5b4[_0xca98('0x36')]:_0xcc02d['model'];if(_0x44aa2c[_0xca98('0x32')]['includeAll']){_0x39a5b4[_0xca98('0x41')]=[{'all':!![]}];}_0x39a5b4=_[_0xca98('0x3c')]({},_0x39a5b4,_0x44aa2c['options']);return db['ChatTransferReport'][_0xca98('0x46')](_0x39a5b4)['then'](handleEntityNotFound(_0x20b782,null))['then'](respondWithResult(_0x20b782,null))[_0xca98('0x47')](handleError(_0x20b782,null));};exports['create']=function(_0x1a82cd,_0x25c974){return db[_0xca98('0x2e')][_0xca98('0x48')](_0x1a82cd[_0xca98('0x49')],{})[_0xca98('0x27')](respondWithResult(_0x25c974,0xc9))[_0xca98('0x47')](handleError(_0x25c974,null));};exports[_0xca98('0x26')]=function(_0x3fea84,_0x330c3a){if(_0x3fea84[_0xca98('0x49')]['id']){delete _0x3fea84['body']['id'];}return db[_0xca98('0x2e')][_0xca98('0x46')]({'where':{'id':_0x3fea84[_0xca98('0x44')]['id']}})[_0xca98('0x27')](handleEntityNotFound(_0x330c3a,null))['then'](saveUpdates(_0x3fea84[_0xca98('0x49')],null))[_0xca98('0x27')](respondWithResult(_0x330c3a,null))[_0xca98('0x47')](handleError(_0x330c3a,null));};exports[_0xca98('0x28')]=function(_0x489253,_0x216901){return db[_0xca98('0x2e')][_0xca98('0x46')]({'where':{'id':_0x489253[_0xca98('0x44')]['id']}})['then'](handleEntityNotFound(_0x216901,null))[_0xca98('0x27')](removeEntity(_0x216901,null))[_0xca98('0x47')](handleError(_0x216901,null));};exports[_0xca98('0x4a')]=function(_0x54c06f,_0x1adb29){return db['ChatTransferReport'][_0xca98('0x4a')]()[_0xca98('0x27')](respondWithResult(_0x1adb29,null))[_0xca98('0x47')](handleError(_0x1adb29,null));}; \ No newline at end of file +var _0x2ea2=['undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','include','merge','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2199db,_0x64fe69){var _0x1823bc=function(_0x4f849b){while(--_0x4f849b){_0x2199db['push'](_0x2199db['shift']());}};_0x1823bc(++_0x64fe69);}(_0x2ea2,0x73));var _0x22ea=function(_0x23ca4a,_0x491470){_0x23ca4a=_0x23ca4a-0x0;var _0x392a33=_0x2ea2[_0x23ca4a];return _0x392a33;};'use strict';var emlformat=require(_0x22ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22ea('0x1'));var jsonpatch=require(_0x22ea('0x2'));var rp=require(_0x22ea('0x3'));var moment=require(_0x22ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x22ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x22ea('0x6'));var csv=require(_0x22ea('0x7'));var ejs=require(_0x22ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22ea('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x22ea('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x22ea('0x7'));var querystring=require('querystring');var Papa=require(_0x22ea('0xb'));var Redis=require(_0x22ea('0xc'));var authService=require(_0x22ea('0xd'));var qs=require(_0x22ea('0xe'));var as=require(_0x22ea('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22ea('0x10'))(_0x22ea('0x11'));var utils=require(_0x22ea('0x12'));var config=require(_0x22ea('0x13'));var licenseUtil=require(_0x22ea('0x14'));var db=require(_0x22ea('0x15'))['db'];function respondWithStatusCode(_0x1f6f1c,_0x18b0c0){_0x18b0c0=_0x18b0c0||0xcc;return function(_0x444d9f){if(_0x444d9f){return _0x1f6f1c[_0x22ea('0x16')](_0x18b0c0);}return _0x1f6f1c[_0x22ea('0x17')](_0x18b0c0)[_0x22ea('0x18')]();};}function respondWithResult(_0x4b203e,_0x2a245b){_0x2a245b=_0x2a245b||0xc8;return function(_0x3d8982){if(_0x3d8982){return _0x4b203e['status'](_0x2a245b)[_0x22ea('0x19')](_0x3d8982);}};}function respondWithFilteredResult(_0x36d354,_0x307593){return function(_0x2263f7){if(_0x2263f7){var _0xbed39a=typeof _0x307593[_0x22ea('0x1a')]===_0x22ea('0x1b')&&typeof _0x307593[_0x22ea('0x1c')]===_0x22ea('0x1b');var _0x45a6e2=_0x2263f7[_0x22ea('0x1d')];var _0x56b35f=_0xbed39a?0x0:_0x307593[_0x22ea('0x1a')];var _0x152b86=_0xbed39a?_0x2263f7[_0x22ea('0x1d')]:_0x307593['offset']+_0x307593[_0x22ea('0x1c')];var _0x57b0ad;if(_0x152b86>=_0x45a6e2){_0x152b86=_0x45a6e2;_0x57b0ad=0xc8;}else{_0x57b0ad=0xce;}_0x36d354[_0x22ea('0x17')](_0x57b0ad);return _0x36d354['set'](_0x22ea('0x1e'),_0x56b35f+'-'+_0x152b86+'/'+_0x45a6e2)['json'](_0x2263f7);}return null;};}function patchUpdates(_0x4786b4){return function(_0x27cea7){try{jsonpatch[_0x22ea('0x1f')](_0x27cea7,_0x4786b4,!![]);}catch(_0x1b0377){return BPromise[_0x22ea('0x20')](_0x1b0377);}return _0x27cea7[_0x22ea('0x21')]();};}function saveUpdates(_0x4e5e80,_0x12bdf2){return function(_0x486870){if(_0x486870){return _0x486870[_0x22ea('0x22')](_0x4e5e80)['then'](function(_0x4b03eb){return _0x4b03eb;});}return null;};}function removeEntity(_0x4d3f4b,_0x1aa13c){return function(_0x5f0dce){if(_0x5f0dce){return _0x5f0dce[_0x22ea('0x23')]()[_0x22ea('0x24')](function(){_0x4d3f4b[_0x22ea('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x217474,_0x12e51e){return function(_0x758b73){if(!_0x758b73){_0x217474[_0x22ea('0x16')](0x194);}return _0x758b73;};}function handleError(_0x124f7a,_0x255801){_0x255801=_0x255801||0x1f4;return function(_0x4f4d82){logger[_0x22ea('0x25')](_0x4f4d82['stack']);if(_0x4f4d82[_0x22ea('0x26')]){delete _0x4f4d82['name'];}_0x124f7a[_0x22ea('0x17')](_0x255801)['send'](_0x4f4d82);};}exports['index']=function(_0xf3aa34,_0x27ca1b){var _0x1af2b1={},_0x2cb7ce={},_0x31f537={'count':0x0,'rows':[]};var _0x2dfc60=_[_0x22ea('0x27')](db[_0x22ea('0x28')][_0x22ea('0x29')],function(_0x213d9a){return{'name':_0x213d9a[_0x22ea('0x2a')],'type':_0x213d9a[_0x22ea('0x2b')][_0x22ea('0x2c')]};});_0x2cb7ce[_0x22ea('0x2d')]=_[_0x22ea('0x27')](_0x2dfc60,'name');_0x2cb7ce['query']=_[_0x22ea('0x2e')](_0xf3aa34[_0x22ea('0x2f')]);_0x2cb7ce['filters']=_[_0x22ea('0x30')](_0x2cb7ce[_0x22ea('0x2d')],_0x2cb7ce[_0x22ea('0x2f')]);_0x1af2b1['attributes']=_[_0x22ea('0x30')](_0x2cb7ce[_0x22ea('0x2d')],qs['fields'](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x31')]));_0x1af2b1[_0x22ea('0x32')]=_0x1af2b1['attributes'][_0x22ea('0x33')]?_0x1af2b1['attributes']:_0x2cb7ce['model'];if(!_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x34')]('nolimit')){_0x1af2b1['limit']=qs['limit'](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x1c')]);_0x1af2b1[_0x22ea('0x1a')]=qs[_0x22ea('0x1a')](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x1a')]);}_0x1af2b1['order']=qs['sort'](_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x35')]);_0x1af2b1[_0x22ea('0x36')]=qs[_0x22ea('0x37')](_[_0x22ea('0x38')](_0xf3aa34[_0x22ea('0x2f')],_0x2cb7ce[_0x22ea('0x37')]),_0x2dfc60);if(_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x39')]){_0x1af2b1[_0x22ea('0x36')]=_['merge'](_0x1af2b1[_0x22ea('0x36')],{'$or':_[_0x22ea('0x27')](_0x2dfc60,function(_0x5d2a8e){if(_0x5d2a8e['type']!==_0x22ea('0x3a')){var _0x2018fe={};_0x2018fe[_0x5d2a8e[_0x22ea('0x26')]]={'$like':'%'+_0xf3aa34['query']['filter']+'%'};return _0x2018fe;}})});}_0x1af2b1=_['merge']({},_0x1af2b1,_0xf3aa34[_0x22ea('0x3b')]);var _0x1e74ff={'where':_0x1af2b1[_0x22ea('0x36')]};return db[_0x22ea('0x28')]['count'](_0x1e74ff)[_0x22ea('0x24')](function(_0x24a82c){_0x31f537[_0x22ea('0x1d')]=_0x24a82c;if(_0xf3aa34[_0x22ea('0x2f')][_0x22ea('0x3c')]){_0x1af2b1['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x22ea('0x3d')](_0x1af2b1);})[_0x22ea('0x24')](function(_0x3d98cf){_0x31f537['rows']=_0x3d98cf;return _0x31f537;})[_0x22ea('0x24')](respondWithFilteredResult(_0x27ca1b,_0x1af2b1))[_0x22ea('0x3e')](handleError(_0x27ca1b,null));};exports[_0x22ea('0x3f')]=function(_0x350ed9,_0x49d5ab){var _0x28be64={'raw':!![],'where':{'id':_0x350ed9[_0x22ea('0x40')]['id']}},_0x582862={};_0x582862[_0x22ea('0x2d')]=_[_0x22ea('0x2e')](db[_0x22ea('0x28')][_0x22ea('0x29')]);_0x582862[_0x22ea('0x2f')]=_[_0x22ea('0x2e')](_0x350ed9[_0x22ea('0x2f')]);_0x582862[_0x22ea('0x37')]=_['intersection'](_0x582862[_0x22ea('0x2d')],_0x582862['query']);_0x28be64['attributes']=_[_0x22ea('0x30')](_0x582862[_0x22ea('0x2d')],qs['fields'](_0x350ed9['query'][_0x22ea('0x31')]));_0x28be64['attributes']=_0x28be64[_0x22ea('0x32')][_0x22ea('0x33')]?_0x28be64['attributes']:_0x582862[_0x22ea('0x2d')];if(_0x350ed9[_0x22ea('0x2f')]['includeAll']){_0x28be64[_0x22ea('0x41')]=[{'all':!![]}];}_0x28be64=_[_0x22ea('0x42')]({},_0x28be64,_0x350ed9[_0x22ea('0x3b')]);return db['ChatTransferReport'][_0x22ea('0x43')](_0x28be64)[_0x22ea('0x24')](handleEntityNotFound(_0x49d5ab,null))[_0x22ea('0x24')](respondWithResult(_0x49d5ab,null))['catch'](handleError(_0x49d5ab,null));};exports[_0x22ea('0x44')]=function(_0x7f625e,_0x3d3944){return db[_0x22ea('0x28')]['create'](_0x7f625e['body'],{})[_0x22ea('0x24')](respondWithResult(_0x3d3944,0xc9))['catch'](handleError(_0x3d3944,null));};exports[_0x22ea('0x22')]=function(_0x1c108b,_0x2cad54){if(_0x1c108b[_0x22ea('0x45')]['id']){delete _0x1c108b[_0x22ea('0x45')]['id'];}return db[_0x22ea('0x28')][_0x22ea('0x43')]({'where':{'id':_0x1c108b[_0x22ea('0x40')]['id']}})[_0x22ea('0x24')](handleEntityNotFound(_0x2cad54,null))[_0x22ea('0x24')](saveUpdates(_0x1c108b['body'],null))[_0x22ea('0x24')](respondWithResult(_0x2cad54,null))[_0x22ea('0x3e')](handleError(_0x2cad54,null));};exports[_0x22ea('0x23')]=function(_0x64993b,_0xa1eeca){return db[_0x22ea('0x28')][_0x22ea('0x43')]({'where':{'id':_0x64993b[_0x22ea('0x40')]['id']}})[_0x22ea('0x24')](handleEntityNotFound(_0xa1eeca,null))[_0x22ea('0x24')](removeEntity(_0xa1eeca,null))[_0x22ea('0x3e')](handleError(_0xa1eeca,null));};exports[_0x22ea('0x46')]=function(_0x15c8da,_0x381e31){return db[_0x22ea('0x28')]['describe']()[_0x22ea('0x24')](respondWithResult(_0x381e31,null))[_0x22ea('0x3e')](handleError(_0x381e31,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8de4639..ae9b666 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 _0x3c4e=['../../config/logger','api','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x14ebc1,_0x50e244){var _0x25b70f=function(_0x1b3965){while(--_0x1b3965){_0x14ebc1['push'](_0x14ebc1['shift']());}};_0x25b70f(++_0x50e244);}(_0x3c4e,0x184));var _0xe3c4=function(_0x489b27,_0x1131a0){_0x489b27=_0x489b27-0x0;var _0x39cb1b=_0x3c4e[_0x489b27];return _0x39cb1b;};'use strict';var _=require(_0xe3c4('0x0'));var util=require(_0xe3c4('0x1'));var logger=require(_0xe3c4('0x2'))(_0xe3c4('0x3'));var moment=require('moment');var BPromise=require(_0xe3c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3c4('0x5'));var rimraf=require('rimraf');var config=require(_0xe3c4('0x6'));var attributes=require(_0xe3c4('0x7'));module[_0xe3c4('0x8')]=function(_0x567cf6,_0x2e31a4){return _0x567cf6[_0xe3c4('0x9')](_0xe3c4('0xa'),attributes,{'tableName':_0xe3c4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe3c4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9160=['rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x41c19c,_0x43f4ef){var _0x14e900=function(_0xff3679){while(--_0xff3679){_0x41c19c['push'](_0x41c19c['shift']());}};_0x14e900(++_0x43f4ef);}(_0x9160,0x1c2));var _0x0916=function(_0x5df47d,_0x56b70d){_0x5df47d=_0x5df47d-0x0;var _0x503d79=_0x9160[_0x5df47d];return _0x503d79;};'use strict';var _=require(_0x0916('0x0'));var util=require(_0x0916('0x1'));var logger=require(_0x0916('0x2'))(_0x0916('0x3'));var moment=require(_0x0916('0x4'));var BPromise=require('bluebird');var rp=require(_0x0916('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0916('0x6'));var config=require(_0x0916('0x7'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x3214ae,_0x5dacc){return _0x3214ae[_0x0916('0x8')](_0x0916('0x9'),attributes,{'tableName':_0x0916('0xa'),'paranoid':![],'indexes':[{'name':_0x0916('0xb'),'fields':[_0x0916('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 25bc8fd..9e33598 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 _0x12a0=['request','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x12a0,0x90));var _0x012a=function(_0x325bb1,_0x5e82d7){_0x325bb1=_0x325bb1-0x0;var _0x402ab0=_0x12a0[_0x325bb1];return _0x402ab0;};'use strict';var _=require('lodash');var util=require(_0x012a('0x0'));var moment=require(_0x012a('0x1'));var BPromise=require(_0x012a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x012a('0x3'));var db=require(_0x012a('0x4'))['db'];var utils=require(_0x012a('0x5'));var logger=require(_0x012a('0x6'))('rpc');var config=require(_0x012a('0x7'));var jayson=require(_0x012a('0x8'));var client=jayson[_0x012a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18bb00,_0x59ccae,_0x185e10){return new BPromise(function(_0x35dab6,_0x58e59a){return client[_0x012a('0xa')](_0x18bb00,_0x185e10)['then'](function(_0x4e8c21){logger[_0x012a('0xb')](_0x012a('0xc'),_0x59ccae,'request\x20sent');logger[_0x012a('0xd')](_0x012a('0xe'),_0x59ccae,_0x012a('0xf'),JSON[_0x012a('0x10')](_0x4e8c21));if(_0x4e8c21[_0x012a('0x11')]){if(_0x4e8c21['error'][_0x012a('0x12')]===0x1f4){logger['error'](_0x012a('0xc'),_0x59ccae,_0x4e8c21[_0x012a('0x11')][_0x012a('0x13')]);return _0x58e59a(_0x4e8c21[_0x012a('0x11')][_0x012a('0x13')]);}logger[_0x012a('0x11')](_0x012a('0xc'),_0x59ccae,_0x4e8c21[_0x012a('0x11')]['message']);return _0x35dab6(_0x4e8c21['error'][_0x012a('0x13')]);}else{logger[_0x012a('0xb')](_0x012a('0xc'),_0x59ccae,'request\x20sent');_0x35dab6(_0x4e8c21[_0x012a('0x14')][_0x012a('0x13')]);}})[_0x012a('0x15')](function(_0x5791d9){logger['error'](_0x012a('0xc'),_0x59ccae,_0x5791d9);_0x58e59a(_0x5791d9);});});} \ No newline at end of file +var _0x9487=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x9487,0x6c));var _0x7948=function(_0x21f7ee,_0x5c38f0){_0x21f7ee=_0x21f7ee-0x0;var _0x12079a=_0x9487[_0x21f7ee];return _0x12079a;};'use strict';var _=require(_0x7948('0x0'));var util=require('util');var moment=require(_0x7948('0x1'));var BPromise=require(_0x7948('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7948('0x3'))['db'];var utils=require(_0x7948('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7948('0x5'));var client=jayson[_0x7948('0x6')][_0x7948('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c7366,_0x5b399d,_0x1e2368){return new BPromise(function(_0x5ad6f1,_0x2f1e1d){return client[_0x7948('0x8')](_0x4c7366,_0x1e2368)[_0x7948('0x9')](function(_0x9ae07a){logger['info'](_0x7948('0xa'),_0x5b399d,_0x7948('0xb'));logger[_0x7948('0xc')](_0x7948('0xd'),_0x5b399d,_0x7948('0xb'),JSON[_0x7948('0xe')](_0x9ae07a));if(_0x9ae07a[_0x7948('0xf')]){if(_0x9ae07a[_0x7948('0xf')][_0x7948('0x10')]===0x1f4){logger[_0x7948('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x5b399d,_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);return _0x2f1e1d(_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);}logger[_0x7948('0xf')](_0x7948('0xa'),_0x5b399d,_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);return _0x5ad6f1(_0x9ae07a[_0x7948('0xf')][_0x7948('0x11')]);}else{logger[_0x7948('0x12')](_0x7948('0xa'),_0x5b399d,_0x7948('0xb'));_0x5ad6f1(_0x9ae07a['result']['message']);}})[_0x7948('0x13')](function(_0x277395){logger[_0x7948('0xf')](_0x7948('0xa'),_0x5b399d,_0x277395);_0x2f1e1d(_0x277395);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 64127e8..4a50d47 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 _0x11c7=['get','isAuthenticated','/describe','describe','post','create','put','/:id','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x11c7,0x187));var _0x711c=function(_0x18f0f2,_0xae74ba){_0x18f0f2=_0x18f0f2-0x0;var _0x30d497=_0x11c7[_0x18f0f2];return _0x30d497;};'use strict';var multer=require(_0x711c('0x0'));var util=require(_0x711c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x711c('0x2'));var router=express['Router']();var fs_extra=require(_0x711c('0x3'));var auth=require(_0x711c('0x4'));var interaction=require(_0x711c('0x5'));var config=require(_0x711c('0x6'));var controller=require(_0x711c('0x7'));router[_0x711c('0x8')]('/',auth[_0x711c('0x9')](),controller['index']);router['get'](_0x711c('0xa'),auth['isAuthenticated'](),controller[_0x711c('0xb')]);router[_0x711c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x711c('0xc')]('/',auth[_0x711c('0x9')](),controller[_0x711c('0xd')]);router[_0x711c('0xe')](_0x711c('0xf'),auth[_0x711c('0x9')](),controller[_0x711c('0x10')]);router['delete'](_0x711c('0xf'),auth['isAuthenticated'](),controller[_0x711c('0x11')]);module[_0x711c('0x12')]=router; \ No newline at end of file +var _0x0f1f=['index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x41fad2,_0xe2dc0e){var _0x67dac0=function(_0x3271a2){while(--_0x3271a2){_0x41fad2['push'](_0x41fad2['shift']());}};_0x67dac0(++_0xe2dc0e);}(_0x0f1f,0x69));var _0xf0f1=function(_0x464507,_0x28b145){_0x464507=_0x464507-0x0;var _0x3f6072=_0x0f1f[_0x464507];return _0x3f6072;};'use strict';var multer=require('multer');var util=require(_0xf0f1('0x0'));var path=require(_0xf0f1('0x1'));var timeout=require(_0xf0f1('0x2'));var express=require('express');var router=express[_0xf0f1('0x3')]();var fs_extra=require(_0xf0f1('0x4'));var auth=require(_0xf0f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf0f1('0x6'));var controller=require('./chatTransferReport.controller');router[_0xf0f1('0x7')]('/',auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x9')]);router[_0xf0f1('0x7')]('/describe',auth[_0xf0f1('0x8')](),controller['describe']);router[_0xf0f1('0x7')](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xb')]);router[_0xf0f1('0xc')]('/',auth['isAuthenticated'](),controller[_0xf0f1('0xd')]);router[_0xf0f1('0xe')](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xf')]);router[_0xf0f1('0x10')](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x11')]);module[_0xf0f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index f16c8e1..6d61783 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 _0xb86c=['#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','#011F6A'];(function(_0x1989af,_0x14c79e){var _0x442b7d=function(_0x3771a2){while(--_0x3771a2){_0x1989af['push'](_0x1989af['shift']());}};_0x442b7d(++_0x14c79e);}(_0xb86c,0x18b));var _0xcb86=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb86c[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcb86('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![],'unique':_0xcb86('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x3')},'mapKeyOffline':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![],'defaultValue':_0xcb86('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![],'defaultValue':_0xcb86('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![],'defaultValue':_0xcb86('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb86('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcb86('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcb86('0x1')]},'animation':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcb86('0x8')](_0xcb86('0x9'),_0xcb86('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0xb')},'start_chat_button':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0xc')},'offline_chat_button':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0xd')},'header_offline':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcb86('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcb86('0xf')]},'closingQuestion':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x12')},'closingMessage':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x13')},'closingMessageButton':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0xd')},'skipMessageButton':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x14')},'conditionAgreement':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x15')},'ratingType':{'type':Sequelize[_0xcb86('0x8')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xcb86('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcb86('0xf')],'defaultValue':function(){return JSON[_0xcb86('0x16')]({'items':[{'type':_0xcb86('0x17'),'variable':null,'config':{'placeholder':_0xcb86('0x18'),'type':_0xcb86('0x19'),'required':!![]},'props':{'title':_0xcb86('0x18'),'helpText':''}},{'type':_0xcb86('0x17'),'props':{'title':_0xcb86('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcb86('0x3'),'type':_0xcb86('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xcb86('0x1a')]('onlineForm')?JSON[_0xcb86('0x1b')](this[_0xcb86('0x1a')](_0xcb86('0x1c'))):{};},'set':function(_0x618788){return this[_0xcb86('0x1d')](_0xcb86('0x1c'),JSON[_0xcb86('0x16')](_0x618788));}},'offlineForm':{'type':Sequelize[_0xcb86('0xf')],'defaultValue':function(){return JSON[_0xcb86('0x16')]({'items':[{'type':_0xcb86('0x17'),'props':{'title':_0xcb86('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xcb86('0x3'),'type':_0xcb86('0x3')},'variable':null},{'type':_0xcb86('0x1e'),'config':{'placeholder':_0xcb86('0x1f')},'props':{'title':_0xcb86('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xcb86('0x1a')]('offlineForm')?JSON[_0xcb86('0x1b')](this[_0xcb86('0x1a')](_0xcb86('0x20'))):{};},'set':function(_0x1f9893){return this[_0xcb86('0x1d')](_0xcb86('0x20'),JSON[_0xcb86('0x16')](_0x1f9893));}},'token':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':function(){return rs[_0xcb86('0x21')]();}},'autoclose':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcb86('0x1')]},'forwardOffline':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcb86('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xcb86('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcb86('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x24')},'offlineMessageBody':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcb86('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xcb86('0x14')},'sendUnmanaged':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcb86('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcb86('0x1')]},'notificationTemplate':{'type':Sequelize[_0xcb86('0xf')],'defaultValue':function(){return _0xcb86('0x27');}},'notificationSound':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xcb86('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb86('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcb86('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x29')},'verticalAlignment':{'type':Sequelize[_0xcb86('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xcb86('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xcb86('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![],'defaultValue':_0xcb86('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb86('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcb86('0x1')],'defaultValue':_0xcb86('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xcb86('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcb86('0x2d'),'set':function(_0x79998f){if(!_0x79998f)this[_0xcb86('0x1d')](_0xcb86('0x2e'),null);this[_0xcb86('0x1d')](_0xcb86('0x2f'),_0x79998f);}},'vidaooEscalation':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcb86('0x1')]},'vidaooTopic':{'type':Sequelize[_0xcb86('0x1')],'allowNull':![],'defaultValue':_0xcb86('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xcb86('0x31');}},'vidaooMetadata':{'type':Sequelize[_0xcb86('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xcb86('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0aa5=['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','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','onlineForm','getDataValue','setDataValue','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x2971e6,_0x4a962e){var _0x5e6392=function(_0x16e6cf){while(--_0x16e6cf){_0x2971e6['push'](_0x2971e6['shift']());}};_0x5e6392(++_0x4a962e);}(_0x0aa5,0x11b));var _0x50aa=function(_0x54ac7c,_0x219d13){_0x54ac7c=_0x54ac7c-0x0;var _0xa4b01c=_0x0aa5[_0x54ac7c];return _0xa4b01c;};'use strict';var Sequelize=require(_0x50aa('0x0'));var rs=require(_0x50aa('0x1'));module['exports']={'name':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'unique':_0x50aa('0x3')},'description':{'type':Sequelize[_0x50aa('0x2')]},'mapKey':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x4')},'mapKeyOffline':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x4')},'key':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x5')},'customerAlias':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50aa('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x50aa('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x50aa('0xa'),_0x50aa('0xb')),'defaultValue':_0x50aa('0xa')},'header_online':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xc')},'start_chat_button':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xd')},'offline_chat_button':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xe')},'header_offline':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xf')},'download_transcript':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x50aa('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x50aa('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x12')},'placeholderMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x13')},'closingMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x14')},'closingMessageButton':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xe')},'skipMessageButton':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x15')},'conditionAgreement':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x50aa('0x17'),_0x50aa('0x18')),'defaultValue':_0x50aa('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x50aa('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':function(){return JSON[_0x50aa('0x19')]({'items':[{'type':_0x50aa('0x1a'),'variable':null,'config':{'placeholder':_0x50aa('0x1b'),'type':'text','required':!![]},'props':{'title':_0x50aa('0x1b'),'helpText':''}},{'type':_0x50aa('0x1a'),'props':{'title':_0x50aa('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50aa('0x4'),'type':_0x50aa('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x50aa('0x1c'))?JSON['parse'](this[_0x50aa('0x1d')]('onlineForm')):{};},'set':function(_0x4ab514){return this[_0x50aa('0x1e')](_0x50aa('0x1c'),JSON[_0x50aa('0x19')](_0x4ab514));}},'offlineForm':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':function(){return JSON[_0x50aa('0x19')]({'items':[{'type':_0x50aa('0x1a'),'props':{'title':_0x50aa('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50aa('0x4'),'type':'email'},'variable':null},{'type':_0x50aa('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x50aa('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x50aa('0x1d')](_0x50aa('0x21'))?JSON['parse'](this[_0x50aa('0x1d')]('offlineForm')):{};},'set':function(_0x29f9ec){return this[_0x50aa('0x1e')](_0x50aa('0x21'),JSON[_0x50aa('0x19')](_0x29f9ec));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x50aa('0x22')]();}},'autoclose':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x50aa('0x2')]},'forwardOffline':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x50aa('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x26')},'skipUnmanaged':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x15')},'sendUnmanaged':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x50aa('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x50aa('0x2')]},'notificationTemplate':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':function(){return _0x50aa('0x27');}},'notificationSound':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x50aa('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x50aa('0x29')},'messagesAlignment':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':_0x50aa('0x2a')},'defaultTitle':{'type':Sequelize[_0x50aa('0x2')]},'customerAvatar':{'type':Sequelize[_0x50aa('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x50aa('0x2')],'allowNull':![],'defaultValue':_0x50aa('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x50aa('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x50aa('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x50aa('0x8')],'comment':_0x50aa('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4ccaab){if(!_0x4ccaab)this[_0x50aa('0x1e')](_0x50aa('0x2d'),null);this['setDataValue']('mandatoryDisposition',_0x4ccaab);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x50aa('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x50aa('0x2')],'defaultValue':function(){return _0x50aa('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x50aa('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x50aa('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x50aa('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 34f3475..cb33853 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 _0xa571=['stringify','error','code','message','info','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','destroy','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','device','model','%s\x20%s\x20%s','type','vendor','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','ChatWebsite','includeAll','findAll','rows','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','describe','Disposition','getDispositions','findOne','nolimit','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','include','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','systemAvatar','chat','from','From\x20is\x20mandatory','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','mapKey','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','account','list','orderBy','priority','asc','CmContact','contact','headers','threadId','closed','ChatInteraction','externalUrl','interaction','lastName','messageId','created','applications','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','Sequelize','ValidationError','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','fromString','mimetype','server','files','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','originalname','subjectOffline','toPairsIn','offlineMessageSubject','Chat','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','User','Owner','fullname','Tag','Tags','color','tag','getSnippet','getProactiveActions','getLicense','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','utf8','URL','address','3.8.1','x-real-ip','connection','remoteAddress','virtual','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','ISOLATION_LEVELS','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','false','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa571,0x107));var _0x1a57=function(_0x3e57cb,_0xb023b8){_0x3e57cb=_0x3e57cb-0x0;var _0x21468f=_0xa571[_0x3e57cb];return _0x21468f;};'use strict';var Mustache=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var ejs=require(_0x1a57('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a57('0x4'));var querystring=require(_0x1a57('0x5'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var jayson=require(_0x1a57('0x6'));var url=require('url');var qs=require(_0x1a57('0x7'));var logger=require(_0x1a57('0x8'))(_0x1a57('0x9'));var config=require(_0x1a57('0xa'));var APIBadRequestError=require(_0x1a57('0xb'))[_0x1a57('0xc')];var APINotFoundError=require('../../errors/api')[_0x1a57('0xd')];var APIOutOfIntervalError=require(_0x1a57('0xb'))[_0x1a57('0xe')];var APIHandleError=require('../../errors/api')[_0x1a57('0xf')];var APIConflictError=require(_0x1a57('0xb'))[_0x1a57('0x10')];var db=require(_0x1a57('0x11'))['db'];config[_0x1a57('0x12')]=_[_0x1a57('0x13')](config[_0x1a57('0x12')],{'host':_0x1a57('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a57('0x15'))[_0x1a57('0x16')](socket);var client=jayson[_0x1a57('0x17')]['http']({'port':0x232c});var client9002=jayson[_0x1a57('0x17')][_0x1a57('0x18')]({'port':0x232a});var client9003=jayson['client'][_0x1a57('0x18')]({'port':0x232b});var client9001=jayson['client'][_0x1a57('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x17434c,_0x27e824,_0x153d01,_0x5802d6){return new Promise(function(_0x20f7ad,_0x53c61f){var _0x49ee05=_0x5802d6||client;return _0x49ee05[_0x1a57('0x19')](_0x17434c,_0x153d01)[_0x1a57('0x1a')](function(_0x22f400){logger['info'](_0x1a57('0x1b'),_0x27e824,_0x1a57('0x1c'));logger[_0x1a57('0x1d')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x27e824,_0x1a57('0x1c'),JSON[_0x1a57('0x1e')](_0x22f400));if(_0x22f400[_0x1a57('0x1f')]){if(_0x22f400[_0x1a57('0x1f')][_0x1a57('0x20')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x27e824,_0x22f400[_0x1a57('0x1f')][_0x1a57('0x21')]);return _0x53c61f(_0x22f400[_0x1a57('0x1f')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x27e824,_0x22f400[_0x1a57('0x1f')][_0x1a57('0x21')]);return _0x20f7ad(_0x22f400[_0x1a57('0x1f')][_0x1a57('0x21')]);}else{logger[_0x1a57('0x22')](_0x1a57('0x1b'),_0x27e824,_0x1a57('0x1c'));_0x20f7ad(_0x22f400[_0x1a57('0x23')][_0x1a57('0x21')]);}})[_0x1a57('0x24')](function(_0x29e7cd){logger[_0x1a57('0x1f')](_0x1a57('0x1b'),_0x27e824,_0x29e7cd);_0x53c61f(_0x29e7cd);});});}function respondWithStatusCode(_0x1b4cb5,_0x2f9454){_0x2f9454=_0x2f9454||0xcc;return function(_0x182649){if(_0x182649){return _0x1b4cb5[_0x1a57('0x25')](_0x2f9454);}return _0x1b4cb5[_0x1a57('0x26')](_0x2f9454)[_0x1a57('0x27')]();};}function respondWithResult(_0xf6ffef,_0x26584b){_0x26584b=_0x26584b||0xc8;return function(_0x1dd939){if(_0x1dd939){return _0xf6ffef['status'](_0x26584b)['json'](_0x1dd939);}};}function respondWithFilteredResult(_0x139d8c,_0x22549f){return function(_0x545041){if(_0x545041){var _0x46dac6=typeof _0x22549f['offset']===_0x1a57('0x28')&&typeof _0x22549f[_0x1a57('0x29')]==='undefined';var _0x8179a4=_0x545041[_0x1a57('0x2a')];var _0x30527c=_0x46dac6?0x0:_0x22549f[_0x1a57('0x2b')];var _0x492b90=_0x46dac6?_0x545041[_0x1a57('0x2a')]:_0x22549f[_0x1a57('0x2b')]+_0x22549f[_0x1a57('0x29')];var _0x160536;if(_0x492b90>=_0x8179a4){_0x492b90=_0x8179a4;_0x160536=0xc8;}else{_0x160536=0xce;}_0x139d8c['status'](_0x160536);return _0x139d8c[_0x1a57('0x2c')](_0x1a57('0x2d'),_0x30527c+'-'+_0x492b90+'/'+_0x8179a4)[_0x1a57('0x2e')](_0x545041);}return null;};}function saveUpdates(_0x32f79f){return function(_0x3ac6ff){if(_0x3ac6ff){return _0x3ac6ff[_0x1a57('0x2f')](_0x32f79f)[_0x1a57('0x1a')](function(_0x1e7f0d){return _0x1e7f0d;});}return null;};}function removeEntity(_0x154cba){return function(_0x4c1acc){if(_0x4c1acc){return _0x4c1acc[_0x1a57('0x30')]()[_0x1a57('0x1a')](function(){var _0x497488=_0x4c1acc['get']({'plain':!![]});var _0x17b12e=_0x1a57('0x31');return db[_0x1a57('0x32')][_0x1a57('0x30')]({'where':{'type':_0x17b12e,'resourceId':_0x497488['id']}})[_0x1a57('0x1a')](function(){return _0x4c1acc;});})[_0x1a57('0x1a')](function(){_0x154cba[_0x1a57('0x26')](0xcc)[_0x1a57('0x27')]();});}};}function handleEntityNotFound(_0x3f14ca){return function(_0x2a6feb){if(!_0x2a6feb){_0x3f14ca[_0x1a57('0x25')](0x194);}return _0x2a6feb;};}function handleError(_0x24025c,_0x12f3a7){_0x12f3a7=_0x12f3a7||0x1f4;return function(_0x1a6231){logger[_0x1a57('0x1f')](_0x1a6231[_0x1a57('0x33')]);if(_0x1a6231[_0x1a57('0x34')]){delete _0x1a6231[_0x1a57('0x34')];}_0x24025c['status'](_0x12f3a7)[_0x1a57('0x35')](_0x1a6231);};}function createInteractionObject(_0x173671,_0x137920,_0x3dad7c,_0x58b7dc){var _0xf64cb5=require(_0x1a57('0x36'));var _0x23d087=new _0xf64cb5();var _0x1b6514=_0x23d087['setUA'](_0x3dad7c['user-agent'])['getResult']();var _0x50a38c=_0x137920[_0x1a57('0x37')];if(_0x3dad7c[_0x1a57('0x38')]){_0x50a38c=_0x3dad7c[_0x1a57('0x38')];}else if(_0x3dad7c['x-forwarded-for']){_0x50a38c=_[_0x1a57('0x39')](_0x3dad7c[_0x1a57('0x3a')][_0x1a57('0x3b')](','));}return{'ContactId':_0x58b7dc['id'],'ChatWebsiteId':_0x173671,'from':(_0x58b7dc[_0x1a57('0x3c')]||'')+'\x20'+(_0x58b7dc['lastName']||''),'customerIp':_0x50a38c,'customerPort':_0x3dad7c[_0x1a57('0x3d')]?_0x3dad7c['x-real-port']:null,'referer':_0x137920[_0x1a57('0x3e')],'browserName':_0x1b6514[_0x1a57('0x3f')][_0x1a57('0x34')]&&_0x1b6514['browser'][_0x1a57('0x40')]?util[_0x1a57('0x41')](_0x1a57('0x42'),_0x1b6514[_0x1a57('0x3f')][_0x1a57('0x34')],_0x1b6514['browser'][_0x1a57('0x40')]):'unknown','browserVersion':_0x1b6514['browser'][_0x1a57('0x40')]||'unknown','osName':util[_0x1a57('0x41')](_0x1a57('0x42'),_0x1b6514['os'][_0x1a57('0x34')],_0x1b6514['os']['version']),'osVersion':_0x1b6514['os'][_0x1a57('0x40')],'deviceModel':_0x1b6514[_0x1a57('0x43')][_0x1a57('0x44')]&&_0x1b6514[_0x1a57('0x43')]['vendor']?util[_0x1a57('0x41')](_0x1a57('0x45'),_0x1b6514['device'][_0x1a57('0x44')],_0x1b6514['device']['vendor'],_0x1b6514[_0x1a57('0x43')][_0x1a57('0x46')]):null,'deviceVendor':_0x1b6514[_0x1a57('0x43')][_0x1a57('0x47')],'deviceType':_0x1b6514['device'][_0x1a57('0x46')],'formData':JSON[_0x1a57('0x1e')](_0x137920)};}exports[_0x1a57('0x48')]=function(_0x1b4231,_0x473524){var _0x498b30={'include':[{'model':db[_0x1a57('0x49')],'as':_0x1a57('0x4a')}]},_0x400ac3={},_0x1175ca={'count':0x0,'rows':[]};var _0x4e540d=_[_0x1a57('0x4b')](db['ChatWebsite'][_0x1a57('0x4c')],function(_0x36f8dc){return{'name':_0x36f8dc[_0x1a57('0x4d')],'type':_0x36f8dc[_0x1a57('0x46')][_0x1a57('0x4e')]};});_0x400ac3[_0x1a57('0x44')]=_[_0x1a57('0x4b')](_0x4e540d,_0x1a57('0x34'));_0x400ac3[_0x1a57('0x4f')]=_[_0x1a57('0x50')](_0x1b4231[_0x1a57('0x4f')]);_0x400ac3[_0x1a57('0x51')]=_[_0x1a57('0x52')](_0x400ac3['model'],_0x400ac3[_0x1a57('0x4f')]);_0x498b30[_0x1a57('0x53')]=_[_0x1a57('0x52')](_0x400ac3[_0x1a57('0x44')],qs[_0x1a57('0x54')](_0x1b4231[_0x1a57('0x4f')][_0x1a57('0x54')]));_0x498b30[_0x1a57('0x53')]=_0x498b30[_0x1a57('0x53')][_0x1a57('0x55')]?_0x498b30[_0x1a57('0x53')]:_0x400ac3['model'];if(!_0x1b4231[_0x1a57('0x4f')][_0x1a57('0x56')]('nolimit')){_0x498b30[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x1b4231['query'][_0x1a57('0x29')]);_0x498b30[_0x1a57('0x2b')]=qs['offset'](_0x1b4231['query']['offset']);}_0x498b30[_0x1a57('0x57')]=qs[_0x1a57('0x58')](_0x1b4231['query'][_0x1a57('0x58')]);_0x498b30[_0x1a57('0x59')]=qs['filters'](_['pick'](_0x1b4231['query'],_0x400ac3[_0x1a57('0x51')]),_0x4e540d);if(_0x1b4231[_0x1a57('0x4f')][_0x1a57('0x5a')]){_0x498b30[_0x1a57('0x59')]=_[_0x1a57('0x5b')](_0x498b30[_0x1a57('0x59')],{'$or':_[_0x1a57('0x4b')](_0x4e540d,function(_0x1f705b){if(_0x1f705b['type']!=='VIRTUAL'){var _0x48308b={};_0x48308b[_0x1f705b['name']]={'$like':'%'+_0x1b4231['query'][_0x1a57('0x5a')]+'%'};return _0x48308b;}})});}_0x498b30=_[_0x1a57('0x5b')]({},_0x498b30,_0x1b4231[_0x1a57('0x5c')]);var _0xeaa3d4={'where':_0x498b30[_0x1a57('0x59')]};return db[_0x1a57('0x5d')][_0x1a57('0x2a')](_0xeaa3d4)[_0x1a57('0x1a')](function(_0x4b20ed){_0x1175ca['count']=_0x4b20ed;if(_0x1b4231['query'][_0x1a57('0x5e')]){_0x498b30['include']=[{'all':!![]}];}return db[_0x1a57('0x5d')][_0x1a57('0x5f')](_0x498b30);})[_0x1a57('0x1a')](function(_0x352aca){_0x1175ca[_0x1a57('0x60')]=_0x352aca;return _0x1175ca;})[_0x1a57('0x1a')](respondWithFilteredResult(_0x473524,_0x498b30))[_0x1a57('0x24')](handleError(_0x473524,null));};exports['show']=function(_0x4e56b5,_0x4d5b1d){var _0xc936a7={'raw':![],'where':{'id':_0x4e56b5[_0x1a57('0x61')]['id']},'include':[{'model':db[_0x1a57('0x49')],'as':_0x1a57('0x4a')}]},_0x562775={};_0x562775[_0x1a57('0x44')]=_[_0x1a57('0x50')](db['ChatWebsite']['rawAttributes']);_0x562775[_0x1a57('0x4f')]=_[_0x1a57('0x50')](_0x4e56b5[_0x1a57('0x4f')]);_0x562775[_0x1a57('0x51')]=_[_0x1a57('0x52')](_0x562775[_0x1a57('0x44')],_0x562775['query']);_0xc936a7['attributes']=_[_0x1a57('0x52')](_0x562775[_0x1a57('0x44')],qs['fields'](_0x4e56b5['query'][_0x1a57('0x54')]));_0xc936a7[_0x1a57('0x53')]=_0xc936a7[_0x1a57('0x53')][_0x1a57('0x55')]?_0xc936a7[_0x1a57('0x53')]:_0x562775[_0x1a57('0x44')];if(_0x4e56b5[_0x1a57('0x4f')]['includeAll']){_0xc936a7['include']=[{'all':!![]}];}_0xc936a7=_[_0x1a57('0x5b')]({},_0xc936a7,_0x4e56b5[_0x1a57('0x5c')]);return db[_0x1a57('0x5d')][_0x1a57('0x62')](_0xc936a7)['then'](handleEntityNotFound(_0x4d5b1d,null))[_0x1a57('0x1a')](respondWithResult(_0x4d5b1d,null))[_0x1a57('0x24')](handleError(_0x4d5b1d,null));};exports[_0x1a57('0x63')]=function(_0x33c8d4,_0x1f4371){return db['ChatWebsite']['create'](_0x33c8d4['body'],{})[_0x1a57('0x1a')](function(_0x223ba5){var _0x1e2df1=_0x33c8d4[_0x1a57('0x64')][_0x1a57('0x65')]({'plain':!![]});if(!_0x1e2df1)throw new Error(_0x1a57('0x66'));if(_0x1e2df1[_0x1a57('0x67')]===_0x1a57('0x64')){var _0x482508=_0x223ba5[_0x1a57('0x65')]({'plain':!![]});var _0x39399b='ChatWebsites';return db['UserProfileSection'][_0x1a57('0x62')]({'where':{'name':_0x39399b,'userProfileId':_0x1e2df1['userProfileId']},'raw':!![]})[_0x1a57('0x1a')](function(_0x9379e3){if(_0x9379e3&&_0x9379e3[_0x1a57('0x68')]===0x0){return db[_0x1a57('0x32')][_0x1a57('0x63')]({'name':_0x482508[_0x1a57('0x34')],'resourceId':_0x482508['id'],'type':_0x9379e3[_0x1a57('0x34')],'sectionId':_0x9379e3['id']},{})[_0x1a57('0x1a')](function(){return _0x223ba5;});}else{return _0x223ba5;}})['catch'](function(_0x7783ec){logger[_0x1a57('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7783ec);throw _0x7783ec;});}return _0x223ba5;})[_0x1a57('0x1a')](respondWithResult(_0x1f4371,0xc9))[_0x1a57('0x24')](handleError(_0x1f4371,null));};exports[_0x1a57('0x2f')]=function(_0x570674,_0x5c3eb8){if(_0x570674[_0x1a57('0x69')]['id']){delete _0x570674[_0x1a57('0x69')]['id'];}return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x570674['params']['id']},'include':[{'model':db[_0x1a57('0x49')],'as':_0x1a57('0x4a')}]})[_0x1a57('0x1a')](handleEntityNotFound(_0x5c3eb8,null))[_0x1a57('0x1a')](saveUpdates(_0x570674[_0x1a57('0x69')],null))['then'](respondWithResult(_0x5c3eb8,null))[_0x1a57('0x24')](handleError(_0x5c3eb8,null));};exports[_0x1a57('0x30')]=function(_0x3dfe14,_0x2fde6f){return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x3dfe14[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x2fde6f,null))[_0x1a57('0x1a')](removeEntity(_0x2fde6f,null))[_0x1a57('0x24')](handleError(_0x2fde6f,null));};exports[_0x1a57('0x6a')]=function(_0x48a10e,_0xd99f23){return db[_0x1a57('0x5d')]['describe']()[_0x1a57('0x1a')](respondWithResult(_0xd99f23,null))[_0x1a57('0x24')](handleError(_0xd99f23,null));};exports['addDisposition']=function(_0x1d9a08,_0x28dd36){if(_0x1d9a08[_0x1a57('0x69')]['id']){delete _0x1d9a08[_0x1a57('0x69')]['id'];}return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x1d9a08[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x28dd36,null))['then'](function(_0x190631){if(_0x190631){_0x1d9a08[_0x1a57('0x69')]['ChatWebsiteId']=_0x190631['id'];return db[_0x1a57('0x6b')][_0x1a57('0x63')](_0x1d9a08[_0x1a57('0x69')]);}})[_0x1a57('0x1a')](respondWithResult(_0x28dd36,null))[_0x1a57('0x24')](handleError(_0x28dd36,null));};exports[_0x1a57('0x6c')]=function(_0x220725,_0xf61c1d){var _0x44969b={'raw':![],'where':{}};var _0x58bc70={};var _0x3ebec={'count':0x0,'rows':[]};return db[_0x1a57('0x5d')][_0x1a57('0x6d')]({'where':{'id':_0x220725[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0xf61c1d,null))['then'](function(_0x46ab91){if(_0x46ab91){_0x58bc70[_0x1a57('0x44')]=_[_0x1a57('0x50')](db[_0x1a57('0x6b')][_0x1a57('0x4c')]);_0x58bc70[_0x1a57('0x4f')]=_[_0x1a57('0x50')](_0x220725[_0x1a57('0x4f')]);_0x58bc70['filters']=_[_0x1a57('0x52')](_0x58bc70[_0x1a57('0x44')],_0x58bc70[_0x1a57('0x4f')]);_0x44969b[_0x1a57('0x53')]=_['intersection'](_0x58bc70['model'],qs['fields'](_0x220725['query']['fields']));_0x44969b[_0x1a57('0x53')]=_0x44969b[_0x1a57('0x53')]['length']?_0x44969b[_0x1a57('0x53')]:_0x58bc70[_0x1a57('0x44')];if(!_0x220725['query'][_0x1a57('0x56')](_0x1a57('0x6e'))){_0x44969b[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x220725['query'][_0x1a57('0x29')]);_0x44969b[_0x1a57('0x2b')]=qs['offset'](_0x220725[_0x1a57('0x4f')][_0x1a57('0x2b')]);}_0x44969b[_0x1a57('0x57')]=qs[_0x1a57('0x58')](_0x220725[_0x1a57('0x4f')][_0x1a57('0x58')]);_0x44969b[_0x1a57('0x59')]=qs['filters'](_[_0x1a57('0x6f')](_0x220725['query'],_0x58bc70[_0x1a57('0x51')]));_0x44969b[_0x1a57('0x59')][_0x1a57('0x70')]=_0x46ab91['id'];if(_0x220725[_0x1a57('0x4f')]['filter']){_0x44969b[_0x1a57('0x59')]=_[_0x1a57('0x5b')](_0x44969b[_0x1a57('0x59')],{'$or':_['map'](_0x44969b[_0x1a57('0x53')],function(_0x37b681){var _0x3bb5d={};_0x3bb5d[_0x37b681]={'$like':'%'+_0x220725['query'][_0x1a57('0x5a')]+'%'};return _0x3bb5d;})});}_0x44969b=_[_0x1a57('0x5b')]({},_0x44969b,_0x220725[_0x1a57('0x5c')]);return db[_0x1a57('0x6b')][_0x1a57('0x2a')]({'where':_0x44969b[_0x1a57('0x59')]})[_0x1a57('0x1a')](function(_0x3b6a65){_0x3ebec[_0x1a57('0x2a')]=_0x3b6a65;if(_0x220725[_0x1a57('0x4f')][_0x1a57('0x5e')]){_0x44969b['include']=[{'all':!![]}];}return db[_0x1a57('0x6b')]['findAll'](_0x44969b);})[_0x1a57('0x1a')](function(_0x5a6dfd){_0x3ebec['rows']=_0x5a6dfd;return _0x3ebec;});}})['then'](respondWithFilteredResult(_0xf61c1d,_0x44969b))['catch'](handleError(_0xf61c1d,null));};exports[_0x1a57('0x71')]=function(_0x9bb457,_0x361c20){return db['ChatWebsite'][_0x1a57('0x62')]({'where':{'id':_0x9bb457['params']['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x361c20,null))[_0x1a57('0x1a')](function(_0x33317c){if(_0x33317c){return _0x33317c[_0x1a57('0x71')](_0x9bb457[_0x1a57('0x4f')][_0x1a57('0x72')]);}})['then'](respondWithStatusCode(_0x361c20,null))['catch'](handleError(_0x361c20,null));};exports[_0x1a57('0x73')]=function(_0x59c9ce,_0x149f8d){if(_0x59c9ce[_0x1a57('0x69')]['id']){delete _0x59c9ce['body']['id'];}return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x59c9ce['params']['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x149f8d,null))[_0x1a57('0x1a')](function(_0x5d5982){if(_0x5d5982){_0x59c9ce['body'][_0x1a57('0x70')]=_0x5d5982['id'];return db['CannedAnswer'][_0x1a57('0x63')](_0x59c9ce[_0x1a57('0x69')]);}})[_0x1a57('0x1a')](respondWithResult(_0x149f8d,null))[_0x1a57('0x24')](handleError(_0x149f8d,null));};exports[_0x1a57('0x74')]=function(_0x46337f,_0x3770b9){var _0x4db879={'raw':![],'where':{}};var _0xe7a762={};var _0x272589={'count':0x0,'rows':[]};return db[_0x1a57('0x5d')]['findOne']({'where':{'id':_0x46337f['params']['id']}})['then'](handleEntityNotFound(_0x3770b9,null))[_0x1a57('0x1a')](function(_0x297300){if(_0x297300){_0xe7a762['model']=_['keys'](db[_0x1a57('0x75')][_0x1a57('0x4c')]);_0xe7a762[_0x1a57('0x4f')]=_['keys'](_0x46337f[_0x1a57('0x4f')]);_0xe7a762[_0x1a57('0x51')]=_[_0x1a57('0x52')](_0xe7a762[_0x1a57('0x44')],_0xe7a762['query']);_0x4db879[_0x1a57('0x53')]=_[_0x1a57('0x52')](_0xe7a762[_0x1a57('0x44')],qs[_0x1a57('0x54')](_0x46337f[_0x1a57('0x4f')][_0x1a57('0x54')]));_0x4db879[_0x1a57('0x53')]=_0x4db879[_0x1a57('0x53')][_0x1a57('0x55')]?_0x4db879['attributes']:_0xe7a762[_0x1a57('0x44')];if(!_0x46337f[_0x1a57('0x4f')][_0x1a57('0x56')](_0x1a57('0x6e'))){_0x4db879[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x46337f[_0x1a57('0x4f')][_0x1a57('0x29')]);_0x4db879[_0x1a57('0x2b')]=qs[_0x1a57('0x2b')](_0x46337f[_0x1a57('0x4f')][_0x1a57('0x2b')]);}_0x4db879[_0x1a57('0x57')]=qs['sort'](_0x46337f[_0x1a57('0x4f')][_0x1a57('0x58')]);_0x4db879[_0x1a57('0x59')]=qs[_0x1a57('0x51')](_[_0x1a57('0x6f')](_0x46337f[_0x1a57('0x4f')],_0xe7a762['filters']));_0x4db879[_0x1a57('0x59')][_0x1a57('0x70')]=_0x297300['id'];if(_0x46337f[_0x1a57('0x4f')][_0x1a57('0x5a')]){_0x4db879[_0x1a57('0x59')]=_['merge'](_0x4db879[_0x1a57('0x59')],{'$or':_[_0x1a57('0x4b')](_0x4db879['attributes'],function(_0x29bdca){var _0x350dbd={};_0x350dbd[_0x29bdca]={'$like':'%'+_0x46337f[_0x1a57('0x4f')][_0x1a57('0x5a')]+'%'};return _0x350dbd;})});}_0x4db879=_['merge']({},_0x4db879,_0x46337f['options']);return db[_0x1a57('0x75')][_0x1a57('0x2a')]({'where':_0x4db879['where']})[_0x1a57('0x1a')](function(_0x67d85){_0x272589[_0x1a57('0x2a')]=_0x67d85;if(_0x46337f[_0x1a57('0x4f')][_0x1a57('0x5e')]){_0x4db879[_0x1a57('0x76')]=[{'all':!![]}];}return db[_0x1a57('0x75')][_0x1a57('0x5f')](_0x4db879);})[_0x1a57('0x1a')](function(_0x26d7b8){_0x272589[_0x1a57('0x60')]=_0x26d7b8;return _0x272589;});}})[_0x1a57('0x1a')](respondWithFilteredResult(_0x3770b9,_0x4db879))['catch'](handleError(_0x3770b9,null));};exports[_0x1a57('0x77')]=function(_0x31805d,_0x30295e){return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x31805d[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x30295e,null))[_0x1a57('0x1a')](function(_0x39534c){if(_0x39534c){return _0x39534c['removeAnswers'](_0x31805d[_0x1a57('0x4f')][_0x1a57('0x72')]);}})[_0x1a57('0x1a')](respondWithStatusCode(_0x30295e,null))[_0x1a57('0x24')](handleError(_0x30295e,null));};exports[_0x1a57('0x78')]=function(_0x39c13e,_0x3d3d46){_0x39c13e['body'][_0x1a57('0x79')]=_0x39c13e[_0x1a57('0x7a')][_0x1a57('0x7b')];return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x39c13e[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x3d3d46,null))[_0x1a57('0x1a')](saveUpdates(_0x39c13e[_0x1a57('0x69')],null))[_0x1a57('0x1a')](respondWithResult(_0x3d3d46,null))[_0x1a57('0x24')](handleError(_0x3d3d46,null));};exports['addAvatar']=function(_0x500b80,_0x3b979a){_0x500b80['body'][_0x1a57('0x7c')]=_0x500b80[_0x1a57('0x7a')][_0x1a57('0x7b')];return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x500b80[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x3b979a,null))[_0x1a57('0x1a')](saveUpdates(_0x500b80[_0x1a57('0x69')],null))[_0x1a57('0x1a')](respondWithResult(_0x3b979a,null))[_0x1a57('0x24')](handleError(_0x3b979a,null));};exports[_0x1a57('0x7d')]=function(_0x3957c7,_0x4f3349){_0x3957c7['body'][_0x1a57('0x7e')]=_0x3957c7['file'][_0x1a57('0x7b')];return db[_0x1a57('0x5d')]['find']({'where':{'id':_0x3957c7[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x4f3349,null))[_0x1a57('0x1a')](saveUpdates(_0x3957c7[_0x1a57('0x69')],null))[_0x1a57('0x1a')](respondWithResult(_0x4f3349,null))[_0x1a57('0x24')](handleError(_0x4f3349,null));};exports[_0x1a57('0x7f')]=function(_0x519b73,_0x410898){_0x519b73[_0x1a57('0x69')]['systemAvatar']=_0x519b73[_0x1a57('0x7a')][_0x1a57('0x7b')];return db[_0x1a57('0x5d')]['find']({'where':{'id':_0x519b73[_0x1a57('0x61')]['id']}})['then'](handleEntityNotFound(_0x410898,null))['then'](saveUpdates(_0x519b73[_0x1a57('0x69')],null))['then'](respondWithResult(_0x410898,null))['catch'](handleError(_0x410898,null));};exports[_0x1a57('0x80')]=function(_0x2a1245,_0x6f8f41){var _0x2f039e=path['join'](config[_0x1a57('0x81')],_0x1a57('0x82'));var _0x4a6ae2={'where':{'id':_0x2a1245[_0x1a57('0x61')]['id']},'attributes':['id',_0x1a57('0x79')],'raw':!![]};var _0x3a813a=![];return require(_0x1a57('0x83'))['getLicense']()['then'](function(_0x2dbb1e){if(_0x2dbb1e){_0x3a813a=_0x2dbb1e[_0x1a57('0x84')];}})[_0x1a57('0x1a')](function(){return db[_0x1a57('0x5d')]['find'](_0x4a6ae2);})['then'](handleEntityNotFound(_0x6f8f41,null))[_0x1a57('0x1a')](function(_0x57a81e){if(_0x57a81e){if(!_['isNil'](_0x57a81e[_0x1a57('0x79')])){if(fs[_0x1a57('0x85')](path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0x87'),_0x57a81e[_0x1a57('0x79')]))&&_0x3a813a){_0x2f039e=path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0x87'),_0x57a81e[_0x1a57('0x79')]);}}return _0x6f8f41[_0x1a57('0x88')](_0x2f039e);}})[_0x1a57('0x24')](handleError(_0x6f8f41,null));};exports[_0x1a57('0x89')]=function(_0x502cc3,_0x304f50){var _0x272be=path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0x8a'));var _0x51e165={'where':{'id':_0x502cc3[_0x1a57('0x61')]['id']},'attributes':['id',_0x1a57('0x7c')],'raw':!![]};return db[_0x1a57('0x5d')][_0x1a57('0x62')](_0x51e165)['then'](handleEntityNotFound(_0x304f50,null))[_0x1a57('0x1a')](function(_0x3b2982){if(_0x3b2982){if(!_[_0x1a57('0x8b')](_0x3b2982[_0x1a57('0x7c')])){if(fs[_0x1a57('0x85')](path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0x8c'),_0x3b2982['agentAvatar']))){_0x272be=path[_0x1a57('0x86')](config[_0x1a57('0x81')],'server/files/images/avatars/',_0x3b2982[_0x1a57('0x7c')]);}}return _0x304f50[_0x1a57('0x88')](_0x272be);}})[_0x1a57('0x24')](handleError(_0x304f50,null));};exports['getCustomerAvatar']=function(_0xdaf58b,_0x5247c5){var _0x44229f=path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0x8d'));var _0x7cc8f5={'where':{'id':_0xdaf58b['params']['id']},'attributes':['id',_0x1a57('0x7e'),_0x1a57('0x8e')],'raw':!![]};return db[_0x1a57('0x5d')][_0x1a57('0x62')](_0x7cc8f5)[_0x1a57('0x1a')](handleEntityNotFound(_0x5247c5,null))[_0x1a57('0x1a')](function(_0xbf80e9){if(_0xbf80e9){if(!_[_0x1a57('0x8b')](_0xbf80e9[_0x1a57('0x7e')])){if(fs[_0x1a57('0x85')](path[_0x1a57('0x86')](config[_0x1a57('0x81')],'server/files/images/avatars/',_0xbf80e9['customerAvatar']))&&_0xbf80e9[_0x1a57('0x8e')]){_0x44229f=path['join'](config[_0x1a57('0x81')],_0x1a57('0x8c'),_0xbf80e9['customerAvatar']);}}return _0x5247c5[_0x1a57('0x88')](_0x44229f);}})[_0x1a57('0x24')](handleError(_0x5247c5,null));};exports['getSystemAvatar']=function(_0x30c86b,_0x584f30){var _0x38d08b=path[_0x1a57('0x86')](config[_0x1a57('0x81')],'server/files/images/avatars/system_avatar.png');var _0x41d6be={'where':{'id':_0x30c86b[_0x1a57('0x61')]['id']},'attributes':['id',_0x1a57('0x8f')],'raw':!![]};return db[_0x1a57('0x5d')]['find'](_0x41d6be)[_0x1a57('0x1a')](handleEntityNotFound(_0x584f30,null))[_0x1a57('0x1a')](function(_0x540e2c){if(_0x540e2c){if(!_[_0x1a57('0x8b')](_0x540e2c[_0x1a57('0x8f')])){if(fs[_0x1a57('0x85')](path[_0x1a57('0x86')](config['root'],_0x1a57('0x8c'),_0x540e2c[_0x1a57('0x8f')]))){_0x38d08b=path[_0x1a57('0x86')](config['root'],_0x1a57('0x8c'),_0x540e2c[_0x1a57('0x8f')]);}}return _0x584f30[_0x1a57('0x88')](_0x38d08b);}})['catch'](handleError(_0x584f30,null));};exports['notify']=function(_0x34c427,_0x37a1c3){var _0x45715f={'body':_0x34c427['body'],'channel':_0x1a57('0x90')};var _0x52e50b=[];var _0x2439b5=[];var _0x5ddb78={};var _0x5c4b93=![];if(_0x34c427[_0x1a57('0x69')]['id']){delete _0x34c427[_0x1a57('0x69')]['id'];}if(_[_0x1a57('0x8b')](_0x34c427[_0x1a57('0x69')][_0x1a57('0x91')])){throw new APIBadRequestError(_0x1a57('0x92'));}if(_[_0x1a57('0x8b')](_0x34c427[_0x1a57('0x69')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0x34c427[_0x1a57('0x69')]['body'])){throw new APIBadRequestError(_0x1a57('0x93'));}return db['CmContact'][_0x1a57('0x6a')]()[_0x1a57('0x1a')](function(_0x3640e5){if(!_0x3640e5){throw new Error(_0x1a57('0x94'));}_0x52e50b=Object[_0x1a57('0x50')](_0x3640e5)[_0x1a57('0x5a')](function(_0x5c926e){return![_0x1a57('0x95'),_0x1a57('0x96')][_0x1a57('0x97')](_0x5c926e);});_0x2439b5=Object[_0x1a57('0x50')](_0x3640e5)[_0x1a57('0x5a')](function(_0x58d092){return![_0x1a57('0x95'),'updatedAt',_0x1a57('0x98'),_0x1a57('0x99')][_0x1a57('0x97')](_0x58d092);});if(!_[_0x1a57('0x97')](_0x2439b5,_0x34c427['body'][_0x1a57('0x9a')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x2439b5['join'](',\x20'));}_0x5ddb78[_0x34c427[_0x1a57('0x69')][_0x1a57('0x9a')]]=_0x34c427[_0x1a57('0x69')][_0x1a57('0x91')];})['then'](function(){return db['ChatWebsite'][_0x1a57('0x62')]({'where':{'id':_0x34c427[_0x1a57('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x1a57('0x9b'),'include':[{'model':db['CmContact'],'as':_0x1a57('0x9c'),'where':_0x5ddb78,'limit':0x1,'order':[[_0x1a57('0x96'),_0x1a57('0x9d')]]}]},{'model':db[_0x1a57('0x9e')],'as':_0x1a57('0x9f')},{'model':db[_0x1a57('0xa0')],'as':_0x1a57('0xa0'),'include':[{'model':db[_0x1a57('0xa0')],'as':_0x1a57('0xa1'),'attributes':['id',_0x1a57('0xa2')],'raw':!![]}]}]});})[_0x1a57('0x1a')](function(_0x39836d){if(!_0x39836d){throw new APINotFoundError(util[_0x1a57('0x41')](_0x1a57('0xa3'),_0x34c427[_0x1a57('0x61')]['id']));}var _0x54a32e=_0x39836d['Interval'];if(_0x54a32e){var _0x4ad389=_0x39836d[_0x1a57('0xa4')]||undefined;return _0x54a32e[_0x1a57('0xa5')](_0x4ad389)[_0x1a57('0x1a')](function(_0x53c2c8){if(!_0x53c2c8){throw new APIOutOfIntervalError();}return _0x39836d;});}else{return _0x39836d;}})['then'](function(_0x23187d){if(!_0x23187d[_0x1a57('0x9b')]){return;}_0x45715f[_0x1a57('0xa6')]=_0x23187d;_0x45715f[_0x1a57('0xa7')]=_0x23187d[_0x1a57('0x9b')];_0x45715f['applications']=_[_0x1a57('0xa8')](_0x23187d[_0x1a57('0x9f')],[_0x1a57('0xa9')],[_0x1a57('0xaa')]);if(_0x45715f[_0x1a57('0xa6')][_0x1a57('0x9f')]){delete _0x45715f[_0x1a57('0xa6')][_0x1a57('0x9f')];}if(_0x45715f['account']['List']&&_0x45715f['account'][_0x1a57('0x9b')][_0x1a57('0x9c')][_0x1a57('0x55')]){return _0x45715f[_0x1a57('0xa6')][_0x1a57('0x9b')][_0x1a57('0x9c')][0x0];}var _0x32c497=_[_0x1a57('0x13')](_0x34c427[_0x1a57('0x69')],{'firstName':_0x34c427['body'][_0x1a57('0x91')],'ListId':_0x23187d[_0x1a57('0x99')]});_0x32c497[_0x34c427[_0x1a57('0x69')][_0x1a57('0x9a')]]=_0x34c427['body'][_0x1a57('0x91')];return db[_0x1a57('0xab')]['create'](_0x32c497,{'fields':_0x52e50b,'raw':!![]});})[_0x1a57('0x1a')](function(_0x3b0bb6){_0x45715f[_0x1a57('0xac')]=_0x3b0bb6;var _0x4cf0c6=createInteractionObject(_0x34c427['params']['id'],_0x34c427[_0x1a57('0x69')],_0x34c427[_0x1a57('0xad')],_0x3b0bb6);var _0x8450fd={'ChatWebsiteId':_0x34c427[_0x1a57('0x61')]['id']};if(_0x34c427[_0x1a57('0x69')][_0x1a57('0xae')]){_0x8450fd[_0x1a57('0xae')]=_0x34c427['body'][_0x1a57('0xae')];_0x8450fd[_0x1a57('0xaf')]=![];return db[_0x1a57('0xb0')][_0x1a57('0x62')]({'where':_0x8450fd})[_0x1a57('0x1a')](function(_0x59b14d){var _0x57773b=_0x34c427[_0x1a57('0x69')][_0x1a57('0x37')]&&_0x34c427[_0x1a57('0x69')][_0x1a57('0x3e')];if(_0x59b14d){_0x5c4b93=!![];return _0x59b14d;}else if(!_0x57773b&&_0x59b14d&&_0x59b14d[_0x1a57('0xaf')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x4cf0c6[_0x1a57('0xae')]=_0x34c427[_0x1a57('0x69')][_0x1a57('0xae')];_0x4cf0c6[_0x1a57('0xb1')]=_0x34c427[_0x1a57('0x69')][_0x1a57('0xb1')];return db[_0x1a57('0xb0')][_0x1a57('0x63')](_0x4cf0c6);});}_0x8450fd['ContactId']=_0x3b0bb6['id'];if(_0x34c427['body'][_0x1a57('0xb2')]&&_0x34c427[_0x1a57('0x69')][_0x1a57('0xb2')]['id']){_0x8450fd['id']=_0x34c427[_0x1a57('0x69')][_0x1a57('0xb2')]['id'];return db['ChatInteraction']['find']({'where':_0x8450fd})[_0x1a57('0x1a')](function(_0x2f9c6a){if(_0x2f9c6a){_0x5c4b93=!![];return _0x2f9c6a;}return db[_0x1a57('0xb0')][_0x1a57('0x63')](_0x4cf0c6);});}return db['ChatInteraction']['create'](_0x4cf0c6);})[_0x1a57('0x1a')](function(_0x134919){if(!_0x5c4b93){return _0x134919;}var _0x23c4bc={'from':(_0x45715f[_0x1a57('0xac')][_0x1a57('0x3c')]||'')+'\x20'+(_0x45715f[_0x1a57('0xac')][_0x1a57('0xb3')]||'')};if(_0x34c427['body'][_0x1a57('0xae')]&&_0x34c427['body'][_0x1a57('0xb4')]&&_0x34c427[_0x1a57('0x69')][_0x1a57('0xae')]!=_0x34c427[_0x1a57('0x69')][_0x1a57('0xb4')]){_0x23c4bc[_0x1a57('0xae')]=_0x34c427['body'][_0x1a57('0xb4')];}return _0x134919['update'](_0x23c4bc);})[_0x1a57('0x1a')](function(_0x4b8712){_0x45715f[_0x1a57('0xb2')]=_0x4b8712[_0x1a57('0x65')]({'plain':!![]});_0x45715f['interaction'][_0x1a57('0xb5')]=!_0x5c4b93;if(_0x45715f[_0x1a57('0xb2')][_0x1a57('0xb5')]){if(_0x45715f[_0x1a57('0xa6')]['autoclose']){_0x45715f[_0x1a57('0xb6')][_0x1a57('0xb7')]({'id':0x0,'priority':_0x45715f[_0x1a57('0xb6')][_0x1a57('0x55')]+0x1,'app':_0x1a57('0xb8'),'appdata':'unmanaged','interval':_0x1a57('0xb9')});}}return db[_0x1a57('0xba')][_0x1a57('0x63')]({'body':_0x34c427[_0x1a57('0x69')][_0x1a57('0x69')],'ChatWebsiteId':_0x34c427[_0x1a57('0x61')]['id'],'ChatInteractionId':_0x4b8712['id'],'direction':'in','ContactId':_0x45715f[_0x1a57('0xac')]['id'],'AttachmentId':_0x34c427[_0x1a57('0x69')][_0x1a57('0xbb')]});})['then'](function(_0x347b3f){_0x45715f['message']=_0x347b3f;if(!_0x45715f[_0x1a57('0xb2')][_0x1a57('0xbc')]){return;}return db['User'][_0x1a57('0x62')]({'attributes':['id',_0x1a57('0x34')],'where':{'id':_0x45715f[_0x1a57('0xb2')][_0x1a57('0xbc')]}});})['then'](function(_0x9235df){if(_0x9235df){_0x45715f[_0x1a57('0xb6')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1a57('0xbd'),'appdata':_0x9235df[_0x1a57('0x34')]+','+(_0x45715f[_0x1a57('0xa6')][_0x1a57('0xbe')]||0xa),'interval':_0x1a57('0xb9')});_0x45715f[_0x1a57('0xbf')]=!![];}if(!_0x45715f[_0x1a57('0xb2')][_0x1a57('0xc0')]){return;}return db['ChatQueue'][_0x1a57('0x62')]({'attributes':['id','name'],'where':{'id':_0x45715f[_0x1a57('0xb2')][_0x1a57('0xc0')]}});})[_0x1a57('0x1a')](function(_0x12ed7f){if(_0x12ed7f){_0x45715f[_0x1a57('0xb6')][_0x1a57('0xc1')]({'id':0x0,'priority':0x1,'app':_0x1a57('0xc2'),'appdata':_0x12ed7f[_0x1a57('0x34')]+','+(_0x45715f['account'][_0x1a57('0xc3')]||0x12c),'interval':_0x1a57('0xb9')});}return respondWithRpcPromise(_0x1a57('0xc4'),_0x1a57('0xc5'),_0x45715f);})[_0x1a57('0x1a')](function(_0x4896da){respondWithRpcPromise('EventManager',_0x1a57('0xc6'),{'event':_0x1a57('0xc7'),'message':_0x4896da},client9002);return _0x4896da;})[_0x1a57('0x1a')](respondWithResult(_0x37a1c3,null))[_0x1a57('0x24')](APIHandleError(_0x37a1c3));};exports['offline']=function(_0x3c0f17,_0x169d6b){var _0x4a82dc,_0x42f21b,_0x4920b8;var _0x4d7d88=[];var _0x1861ff={};var _0xebc968=_0x3c0f17['files']||[];var _0x722d99=[];var _0x2f033d;return db[_0x1a57('0xab')][_0x1a57('0x6a')]()[_0x1a57('0x1a')](function(_0x224b64){if(!_0x224b64){throw new db[(_0x1a57('0xc8'))][(_0x1a57('0xc9'))](_0x1a57('0xca'));}_0x4d7d88=_['difference'](_[_0x1a57('0x50')](_0x224b64),[_0x1a57('0x95'),_0x1a57('0x96'),_0x1a57('0x98'),_0x1a57('0x99')]);if(_0x3c0f17[_0x1a57('0x69')]['id']){delete _0x3c0f17[_0x1a57('0x69')]['id'];}if(_['isNil'](_0x3c0f17[_0x1a57('0x69')][_0x1a57('0x91')])){throw _0x169d6b[_0x1a57('0x26')](0x1f4)['send'](new db[(_0x1a57('0xc8'))][(_0x1a57('0xc9'))](_0x1a57('0xcb')));}if(_['isNil'](_0x3c0f17[_0x1a57('0x69')]['body'])||_0x3c0f17['body']['body']===''){throw _0x169d6b[_0x1a57('0x26')](0x1f4)[_0x1a57('0x35')](new db[(_0x1a57('0xc8'))][(_0x1a57('0xc9'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1a57('0x8b')](_0x3c0f17[_0x1a57('0x69')][_0x1a57('0xcc')])){throw _0x169d6b['status'](0x1f4)[_0x1a57('0x35')](new db[(_0x1a57('0xc8'))][(_0x1a57('0xc9'))](_0x1a57('0xcd')+_0x4d7d88));}if(!_['includes'](_0x4d7d88,_0x3c0f17[_0x1a57('0x69')][_0x1a57('0xcc')])){throw _0x169d6b[_0x1a57('0x26')](0x1f4)['send'](new db[(_0x1a57('0xc8'))][(_0x1a57('0xc9'))](_0x1a57('0xce')+_0x4d7d88));}_0x1861ff[_0x3c0f17[_0x1a57('0x69')][_0x1a57('0xcc')]]=_0x3c0f17[_0x1a57('0x69')][_0x1a57('0x91')];})[_0x1a57('0x1a')](function(){return db['ChatWebsite'][_0x1a57('0x62')]({'where':{'id':_0x3c0f17[_0x1a57('0x61')]['id']},'include':[{'model':db[_0x1a57('0xcf')],'as':_0x1a57('0x9b')},{'model':db[_0x1a57('0xd0')],'as':'MailAccount'}]});})[_0x1a57('0x1a')](handleEntityNotFound(_0x169d6b,null))['then'](function(_0x2f2698){if(_0x2f2698&&_0x2f2698[_0x1a57('0x9b')]){_0x42f21b=_0x2f2698;var _0x412c11=_[_0x1a57('0x13')](_0x3c0f17[_0x1a57('0x69')],{'firstName':_0x3c0f17['body']['from'],'phone':_0x3c0f17[_0x1a57('0x69')][_0x1a57('0x91')],'ListId':_0x2f2698['ListId']});_0x412c11[_0x3c0f17[_0x1a57('0x69')][_0x1a57('0xcc')]]=_0x3c0f17[_0x1a57('0x69')]['from'];return db['CmContact']['findOrCreate']({'where':_0x1861ff,'defaults':_0x412c11});}})[_0x1a57('0xd1')](function(_0x55fe63){if(_0x55fe63){_0x4920b8=_0x55fe63;var _0x41d89a=fs['readFileSync'](path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0xd2')),'utf8');var _0x549e65=ejs[_0x1a57('0xd3')](_0x41d89a,{'body':_[_0x1a57('0xd4')](_0x3c0f17[_0x1a57('0x69')][_0x1a57('0x69')]),'bodyTitle':_0x42f21b['offlineMessageBody']});return db['ChatOfflineMessage'][_0x1a57('0x63')]({'body':_0x549e65,'plainBody':htmlToText[_0x1a57('0xd5')](_0x549e65),'ContactId':_0x55fe63['id'],'ChatWebsiteId':_0x42f21b['id']});}})['then'](function(_0x40af41){_0x2f033d=_0x40af41;if(_0xebc968[_0x1a57('0x55')]){var _0x2405b0=_0xebc968[_0x1a57('0x4b')](function(_0x19faff){return{'name':_0x19faff['originalname'],'basename':_0x19faff['filename'],'type':_0x19faff[_0x1a57('0xd6')],'ChatOfflineMessageId':_0x40af41['id']};});_0x722d99=_0x2405b0[_0x1a57('0x4b')](_0x5df6d5=>{var _0x1138c3={'filename':_0x5df6d5['name'],'path':path['join'](config[_0x1a57('0x81')],_0x1a57('0xd7'),_0x1a57('0xd8'),_0x1a57('0xd9'),'offline-chat',_0x5df6d5[_0x1a57('0xda')])};return _0x1138c3;});if(!_0x42f21b[_0x1a57('0xdb')]){return db[_0x1a57('0xdc')][_0x1a57('0xdd')](function(_0x558d10){return db[_0x1a57('0xde')][_0x1a57('0xdf')](_0x2405b0,{'transaction':_0x558d10});});}}})[_0x1a57('0x1a')](function(){if(_0x2f033d){_0x4a82dc=_0x2f033d;return db[_0x1a57('0xd0')][_0x1a57('0x6d')]({'where':{'service':!![]},'include':[{'model':db[_0x1a57('0xe0')],'as':_0x1a57('0xe1'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1a57('0xe2'),'raw':!![]}]}]});}})[_0x1a57('0x1a')](function(_0x19200f){if(_0x19200f&&_0x19200f[_0x1a57('0xe1')]&&_0x42f21b['forwardOffline']&&_0x42f21b['forwardOfflineAddress']){var _0x1c27ce=_0x19200f[_0x1a57('0xe3')]();return respondWithRpcPromise(_0x1a57('0xe4'),_0x1a57('0xe5'),{'account':_0x1c27ce,'message':{'from':util[_0x1a57('0x41')](_0x1a57('0xe6'),_0x19200f[_0x1a57('0x34')],_0x19200f[_0x1a57('0xe7')]||_0x19200f['Smtp']['user']),'to':_0x42f21b['forwardOfflineAddress'],'subject':_0x42f21b['offlineMessageSubject'],'html':_0x4a82dc[_0x1a57('0x69')],'attachments':_0x722d99}},client9003)[_0x1a57('0x1a')](function(){return _0x4a82dc;})['catch'](function(_0x1db211){logger[_0x1a57('0x1f')](_0x1db211);});}})[_0x1a57('0x1a')](function(){if(_0x42f21b&&_0x42f21b[_0x1a57('0xdb')]&&_0x42f21b[_0x1a57('0xe8')]){var _0x1f4e77=[];if(_0xebc968[_0x1a57('0x55')]){_0x1f4e77=_0xebc968[_0x1a57('0x4b')](function(_0x2e6b2c){return{'name':_0x2e6b2c[_0x1a57('0xe9')],'basename':_0x2e6b2c[_0x1a57('0x7b')],'type':_0x2e6b2c[_0x1a57('0xd6')],'ChatOfflineMessageId':_0x2f033d['id']};});}var _0xc94180;if(!_[_0x1a57('0x8b')](_0x42f21b[_0x1a57('0xea')])){var _0x8ae8b9=_[_0x1a57('0x4b')](_0x3c0f17['body'],function(_0x3088d0){return _0x3088d0;});var _0x127a5d=_[_0x1a57('0xeb')](_0x8ae8b9)[0x0];var _0x5c0ce9=_['mapValues'](_0x127a5d,function(_0x29cdcb){return _0x29cdcb;});_0xc94180=_0x5c0ce9[0x1][_0x42f21b[_0x1a57('0xea')]];}var _0x3a2416={'from':_0x4920b8[_0x1a57('0xe7')],'firstName':_0x4920b8[_0x1a57('0x3c')],'lastName':_0x4920b8['lastName'],'mapKey':_0x1a57('0xe7'),'message':{'from':_0x4920b8[_0x1a57('0xe7')],'to':_0x42f21b[_0x1a57('0xd0')]['email'],'cc':'','subject':_['isNil'](_0xc94180)?_0x42f21b[_0x1a57('0xec')]:_0xc94180,'messageId':'','sentAt':new Date(),'attach':_0x1f4e77[_0x1a57('0x55')],'attachments':_0x1f4e77,'originChannel':_0x1a57('0xed'),'ChatWebsiteId':_0x42f21b['id'],'ChatOfflineMessageId':_0x4a82dc['id'],'originTo':_0x42f21b[_0x1a57('0xd0')][_0x1a57('0xe7')]},'body':_0x4a82dc[_0x1a57('0x69')]};var _0x3711b9={'account':{'id':_0x42f21b[_0x1a57('0xe8')]},'body':_0x3a2416,'log':_0x1a57('0xee')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x3711b9,client9001)['then'](function(){return _0x4a82dc;})[_0x1a57('0x24')](function(_0x40a62){logger[_0x1a57('0x1f')](_0x40a62);});}return;})[_0x1a57('0x1a')](function(){if(_0x4a82dc){return _0x4a82dc;}})[_0x1a57('0x1a')](respondWithResult(_0x169d6b,null))[_0x1a57('0x24')](function(){for(var _0x1ca03e of _0xebc968){var _0x3d5ab2=path[_0x1a57('0x86')](config[_0x1a57('0x81')],_0x1a57('0xd7'),_0x1a57('0xd8'),_0x1a57('0xd9'),_0x1a57('0xef'),_0x1ca03e[_0x1a57('0x7b')]);fs_extra[_0x1a57('0xf0')](_0x3d5ab2)[_0x1a57('0x24')](function(_0x4b9c98){logger[_0x1a57('0x1f')](_0x1a57('0xf1'),_0x3d5ab2,_0x4b9c98);});}});};exports['addInteraction']=function(_0x1805bc,_0x14c4a0){return db['ChatInteraction'][_0x1a57('0x62')]({'where':{'id':_0x1805bc['params']['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x14c4a0,null))[_0x1a57('0x1a')](function(_0x1b2e59){if(_0x1b2e59){return _0x1b2e59[_0x1a57('0xf2')](_0x1805bc['body'][_0x1a57('0x72')],_[_0x1a57('0xf3')](_0x1805bc[_0x1a57('0x69')],['ids','id'])||{});}})[_0x1a57('0x1a')](respondWithResult(_0x14c4a0,null))[_0x1a57('0x24')](handleError(_0x14c4a0,null));};exports['getInteractions']=function(_0x9a0693,_0x24c43b){var _0x1a6eaf={'raw':![],'where':{}};var _0x5cbd09={};var _0x4ba4d0={'count':0x0,'rows':[]};return db[_0x1a57('0x5d')]['findOne']({'where':{'id':_0x9a0693[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x24c43b,null))[_0x1a57('0x1a')](function(_0x3083e4){if(_0x3083e4){_0x5cbd09[_0x1a57('0x44')]=_['keys'](db[_0x1a57('0xb0')][_0x1a57('0x4c')]);_0x5cbd09[_0x1a57('0x4f')]=_['keys'](_0x9a0693[_0x1a57('0x4f')]);_0x5cbd09[_0x1a57('0x51')]=_[_0x1a57('0x52')](_0x5cbd09[_0x1a57('0x44')],_0x5cbd09['query']);_0x1a6eaf[_0x1a57('0x53')]=_[_0x1a57('0x52')](_0x5cbd09[_0x1a57('0x44')],qs[_0x1a57('0x54')](_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x54')]));_0x1a6eaf[_0x1a57('0x53')]=_0x1a6eaf['attributes'][_0x1a57('0x55')]?_0x1a6eaf['attributes']:_0x5cbd09[_0x1a57('0x44')];if(!_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x56')](_0x1a57('0x6e'))){_0x1a6eaf[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x29')]);_0x1a6eaf['offset']=qs[_0x1a57('0x2b')](_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x2b')]);}_0x1a6eaf[_0x1a57('0x57')]=qs[_0x1a57('0x58')](_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x58')]);_0x1a6eaf[_0x1a57('0x59')]=qs[_0x1a57('0x51')](_[_0x1a57('0x6f')](_0x9a0693[_0x1a57('0x4f')],_0x5cbd09[_0x1a57('0x51')]));_0x1a6eaf[_0x1a57('0x59')]['ChatWebsiteId']=_0x3083e4['id'];if(_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x5a')]){_0x1a6eaf['where']=_[_0x1a57('0x5b')](_0x1a6eaf[_0x1a57('0x59')],{'$or':_[_0x1a57('0x4b')](_0x1a6eaf['attributes'],function(_0x2be3b8){var _0x3f854c={};_0x3f854c[_0x2be3b8]={'$like':'%'+_0x9a0693[_0x1a57('0x4f')][_0x1a57('0x5a')]+'%'};return _0x3f854c;})});}_0x1a6eaf=_[_0x1a57('0x5b')]({},_0x1a6eaf,_0x9a0693[_0x1a57('0x5c')]);return db[_0x1a57('0xb0')]['count']({'where':_0x1a6eaf[_0x1a57('0x59')]})['then'](function(_0x8ac81c){_0x4ba4d0[_0x1a57('0x2a')]=_0x8ac81c;if(_0x9a0693['query']['includeAll']){_0x1a6eaf[_0x1a57('0x76')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1a57('0xf4')],'as':_0x1a57('0xf5'),'attributes':[_0x1a57('0x34'),_0x1a57('0xf6'),'internal'],'required':![]},{'model':db[_0x1a57('0xf7')],'as':_0x1a57('0xf8'),'attributes':['id',_0x1a57('0x34'),_0x1a57('0xf9')],'where':_0x9a0693[_0x1a57('0x4f')][_0x1a57('0xfa')]?{'id':_0x9a0693[_0x1a57('0x4f')][_0x1a57('0xfa')]}:undefined,'required':_0x9a0693[_0x1a57('0x4f')]['tag']?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x1a6eaf);})[_0x1a57('0x1a')](function(_0x427e5d){_0x4ba4d0['rows']=_0x427e5d;return _0x4ba4d0;});}})[_0x1a57('0x1a')](respondWithFilteredResult(_0x24c43b,_0x1a6eaf))[_0x1a57('0x24')](handleError(_0x24c43b,null));};exports[_0x1a57('0xfb')]=function(_0x2e4aab,_0x94a873){var _0x294457=0x0;var _0x412658=0x0;var _0x4b2364=![];var _0x3a58c1;var _0x4987fc;return db['ChatWebsite']['find']({'where':{'id':_0x2e4aab[_0x1a57('0x61')]['id']},'include':[{'model':db[_0x1a57('0xa0')],'as':_0x1a57('0xa0'),'include':[{'model':db['Interval'],'as':_0x1a57('0xa1'),'attributes':['id',_0x1a57('0xa2')]}]}]})[_0x1a57('0x1a')](handleEntityNotFound(_0x94a873,null))[_0x1a57('0x1a')](function(_0x53947f){if(_0x53947f){_0x3a58c1=_0x53947f;return _0x53947f[_0x1a57('0xfc')]({'raw':!![]});}})['then'](function(_0x48e53f){if(_0x3a58c1){if(_0x48e53f){_0x4987fc=_0x48e53f;}}return require('../../config/license/util')[_0x1a57('0xfd')]();})['then'](function(_0x44b0b4){if(_0x44b0b4){_0x412658=_0x44b0b4['virtual'];_0x4b2364=_0x44b0b4['custom'];}})['then'](function(){return db['ChatInteraction'][_0x1a57('0x2a')]({'where':{'closed':![]}});})['then'](function(_0x3c8e60){_0x294457=_0x3c8e60;if(_0x412658&&_0x3c8e60>_0x412658){return db['License'][_0x1a57('0x6d')]({'where':{'id':0x1}})[_0x1a57('0x1a')](function(_0x4e605f){if(_0x4e605f){_0x4e605f[_0x1a57('0xfe')](_0x1a57('0xff'));}});}})[_0x1a57('0x1a')](function(){var _0x1bf023=_0x3a58c1['Interval'];var _0x35ac22=_0x3a58c1['timezone']||undefined;return _0x1bf023?_0x1bf023['ifTime'](_0x35ac22):!![];})[_0x1a57('0x1a')](function(_0x4cf396){var _0x442de0=fs[_0x1a57('0x100')](path['join'](config[_0x1a57('0x81')],_0x1a57('0x101')),_0x1a57('0x102'));var _0x28b99b=new url[(_0x1a57('0x103'))](_0x3a58c1[_0x1a57('0x104')])['origin'];var _0x5e65b8=_0x1a57('0x105');var _0x161c5c=![];var _0x3b1e44={'chatVersion':_0x5e65b8,'chatWebsiteAddressOrigin':_0x28b99b,'remote':_0x3a58c1['remote'],'query':querystring[_0x1a57('0x1e')](_['merge'](_0x3a58c1[_0x1a57('0x65')]({'plain':!![]}),{'customerIp':_0x2e4aab[_0x1a57('0xad')][_0x1a57('0x3a')]||_0x2e4aab[_0x1a57('0xad')][_0x1a57('0x106')]||_0x2e4aab[_0x1a57('0x107')][_0x1a57('0x108')]||_0x2e4aab['ip'],'referer':_0x2e4aab[_0x1a57('0xad')][_0x1a57('0x3e')],'openedInteractions':_0x294457,'maxInteractions':_0x412658,'virtual':_0x4b2364[_0x1a57('0x109')],'online':_0x4cf396,'custom':_0x4b2364}))['replace'](/'/g,'\x5c\x27')};_0x94a873[_0x1a57('0x35')](ejs['render'](Mustache[_0x1a57('0xd3')](_0x442de0,_0x3b1e44),{'proactiveActions':_0x4987fc,'alignment':_0x3a58c1[_0x1a57('0x10a')],'verticalAlignment':_0x3a58c1[_0x1a57('0x10b')],'div_color':_0x3a58c1[_0x1a57('0xf9')],'labelText':_0x3a58c1[_0x1a57('0x10c')],'text_color':_0x3a58c1[_0x1a57('0x10d')],'text_button_color':_0x3a58c1[_0x1a57('0x10e')],'button_color':_0x3a58c1[_0x1a57('0x10f')],'background_color':_0x3a58c1['backgroundColor'],'hideWhenOffline':_0x3a58c1[_0x1a57('0x110')],'intervalId':_0x3a58c1[_0x1a57('0x111')],'isDevelopment':_0x161c5c,'chatVersion':_0x5e65b8}));})[_0x1a57('0x24')](handleError(_0x94a873,null));};exports['addApplications']=function(_0xaa5427,_0x3e7d1f){var _0x15cdc4=_0xaa5427[_0x1a57('0x61')]['id'];var _0xecdf2=_0xaa5427['body'];var _0x299755=0xc8;var _0x5a5528=null;return db[_0x1a57('0xdc')][_0x1a57('0xdd')]({'isolationLevel':db['sequelize']['Transaction'][_0x1a57('0x112')]['READ_COMMITTED']},function(_0x42a2e7){return db['ChatWebsite'][_0x1a57('0x6d')]({'where':{'id':_0x15cdc4},'transaction':_0x42a2e7})['then'](function(_0x4e36a7){if(_0x4e36a7){return db['ChatApplication'][_0x1a57('0x30')]({'where':{'ChatWebsiteId':_0x15cdc4},'transaction':_0x42a2e7})[_0x1a57('0x1a')](function(){var _0x3ac99a=_[_0x1a57('0x4b')](_0xecdf2,function(_0x51b545){_0x51b545[_0x1a57('0x70')]=_0x15cdc4;return _0x51b545;});return db['ChatApplication'][_0x1a57('0xdf')](_0x3ac99a,{'transaction':_0x42a2e7});});}else{_0x299755=0x194;_0x5a5528=[];}});})[_0x1a57('0x1a')](function(){if(_0x299755!==0x194){return db[_0x1a57('0x9e')][_0x1a57('0x113')]({'where':{'ChatWebsiteId':_0x15cdc4},'order':_0x1a57('0xa9')})[_0x1a57('0x1a')](function(_0x41e08a){_0x5a5528=_0x41e08a;});}})[_0x1a57('0x24')](function(_0x50b3d2){_0x299755=0x1f4;logger[_0x1a57('0x1f')](_0x50b3d2['stack']);if(_0x50b3d2[_0x1a57('0x34')]){delete _0x50b3d2[_0x1a57('0x34')];}_0x5a5528=_0x50b3d2;})['finally'](function(){if(_0x5a5528===null){_0x3e7d1f[_0x1a57('0x25')](_0x299755);}else{if(_0x299755===0x1f4){_0x3e7d1f[_0x1a57('0x26')](_0x299755)[_0x1a57('0x35')](_0x5a5528);}else{_0x3e7d1f[_0x1a57('0x26')](_0x299755)[_0x1a57('0x2e')](_0x5a5528);}}});};exports[_0x1a57('0x114')]=function(_0x354b61,_0x2c73a8){var _0x92494d={};var _0x1f40b5={};var _0x41d3dc;var _0x30b3c4;return db[_0x1a57('0x5d')]['findOne']({'where':{'id':_0x354b61[_0x1a57('0x61')]['id']}})['then'](handleEntityNotFound(_0x2c73a8,null))[_0x1a57('0x1a')](function(_0x5b24c6){if(_0x5b24c6){_0x41d3dc=_0x5b24c6;_0x1f40b5[_0x1a57('0x44')]=_[_0x1a57('0x50')](db[_0x1a57('0x9e')][_0x1a57('0x4c')]);_0x1f40b5[_0x1a57('0x4f')]=_[_0x1a57('0x50')](_0x354b61[_0x1a57('0x4f')]);_0x1f40b5['filters']=_[_0x1a57('0x52')](_0x1f40b5[_0x1a57('0x44')],_0x1f40b5[_0x1a57('0x4f')]);_0x92494d['attributes']=_[_0x1a57('0x52')](_0x1f40b5[_0x1a57('0x44')],qs[_0x1a57('0x54')](_0x354b61[_0x1a57('0x4f')][_0x1a57('0x54')]));_0x92494d[_0x1a57('0x53')]=_0x92494d[_0x1a57('0x53')][_0x1a57('0x55')]?_0x92494d[_0x1a57('0x53')]:_0x1f40b5['model'];_0x92494d[_0x1a57('0x57')]=qs[_0x1a57('0x58')](_0x354b61['query'][_0x1a57('0x58')]);_0x92494d[_0x1a57('0x59')]=qs[_0x1a57('0x51')](_['pick'](_0x354b61[_0x1a57('0x4f')],_0x1f40b5['filters']));if(_0x354b61[_0x1a57('0x4f')][_0x1a57('0x5a')]){_0x92494d[_0x1a57('0x59')]=_[_0x1a57('0x5b')](_0x92494d[_0x1a57('0x59')],{'$or':_[_0x1a57('0x4b')](_0x92494d['attributes'],function(_0x44d402){var _0x50c74d={};_0x50c74d[_0x44d402]={'$like':'%'+_0x354b61[_0x1a57('0x4f')]['filter']+'%'};return _0x50c74d;})});}_0x92494d=_[_0x1a57('0x5b')]({},_0x92494d,_0x354b61['options']);return _0x41d3dc[_0x1a57('0x114')](_0x92494d);}})[_0x1a57('0x1a')](function(_0x5f1c31){if(_0x5f1c31){_0x30b3c4=_0x5f1c31['length'];if(!_0x354b61[_0x1a57('0x4f')]['hasOwnProperty']('nolimit')){_0x92494d[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x354b61[_0x1a57('0x4f')][_0x1a57('0x29')]);_0x92494d[_0x1a57('0x2b')]=qs[_0x1a57('0x2b')](_0x354b61[_0x1a57('0x4f')][_0x1a57('0x2b')]);}return _0x41d3dc[_0x1a57('0x114')](_0x92494d);}})[_0x1a57('0x1a')](function(_0x276ad3){if(_0x276ad3){return _0x276ad3?{'count':_0x30b3c4,'rows':_0x276ad3}:null;}})[_0x1a57('0x1a')](respondWithResult(_0x2c73a8,null))[_0x1a57('0x24')](handleError(_0x2c73a8,null));};exports[_0x1a57('0x115')]=function(_0x57c1ff,_0x16f92b){return db[_0x1a57('0x116')][_0x1a57('0x62')]({'where':{'id':_0x57c1ff[_0x1a57('0x61')]['id']}})['then'](handleEntityNotFound(_0x16f92b,null))[_0x1a57('0x1a')](function(_0x4a8ce2){if(_0x4a8ce2){return _0x4a8ce2[_0x1a57('0x115')](_0x57c1ff[_0x1a57('0x69')]['ids'],_['omit'](_0x57c1ff[_0x1a57('0x69')],[_0x1a57('0x72'),'id'])||{});}})['then'](respondWithResult(_0x16f92b,null))[_0x1a57('0x24')](handleError(_0x16f92b,null));};exports['getProactiveActions']=function(_0x2fcec7,_0x162f4c){var _0x261110={};var _0x58b675={};var _0xa53aae;var _0x33c1b4;return db[_0x1a57('0x5d')][_0x1a57('0x6d')]({'where':{'id':_0x2fcec7[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x162f4c,null))[_0x1a57('0x1a')](function(_0x5f573c){if(_0x5f573c){_0xa53aae=_0x5f573c;_0x58b675[_0x1a57('0x44')]=_['keys'](db[_0x1a57('0x117')][_0x1a57('0x4c')]);_0x58b675[_0x1a57('0x4f')]=_[_0x1a57('0x50')](_0x2fcec7[_0x1a57('0x4f')]);_0x58b675['filters']=_[_0x1a57('0x52')](_0x58b675[_0x1a57('0x44')],_0x58b675[_0x1a57('0x4f')]);_0x261110[_0x1a57('0x53')]=_['intersection'](_0x58b675['model'],qs['fields'](_0x2fcec7[_0x1a57('0x4f')][_0x1a57('0x54')]));_0x261110[_0x1a57('0x53')]=_0x261110[_0x1a57('0x53')]['length']?_0x261110[_0x1a57('0x53')]:_0x58b675[_0x1a57('0x44')];_0x261110[_0x1a57('0x57')]=qs[_0x1a57('0x58')](_0x2fcec7['query'][_0x1a57('0x58')]);_0x261110[_0x1a57('0x59')]=qs['filters'](_[_0x1a57('0x6f')](_0x2fcec7['query'],_0x58b675[_0x1a57('0x51')]));if(_0x2fcec7[_0x1a57('0x4f')]['filter']){_0x261110[_0x1a57('0x59')]=_[_0x1a57('0x5b')](_0x261110[_0x1a57('0x59')],{'$or':_['map'](_0x261110[_0x1a57('0x53')],function(_0x2c5125){var _0x477841={};_0x477841[_0x2c5125]={'$like':'%'+_0x2fcec7['query']['filter']+'%'};return _0x477841;})});}_0x261110=_[_0x1a57('0x5b')]({},_0x261110,_0x2fcec7[_0x1a57('0x5c')]);return _0xa53aae[_0x1a57('0xfc')](_0x261110);}})[_0x1a57('0x1a')](function(_0x408278){if(_0x408278){_0x33c1b4=_0x408278['length'];if(!_0x2fcec7[_0x1a57('0x4f')][_0x1a57('0x56')](_0x1a57('0x6e'))){_0x261110[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x2fcec7[_0x1a57('0x4f')][_0x1a57('0x29')]);_0x261110[_0x1a57('0x2b')]=qs['offset'](_0x2fcec7[_0x1a57('0x4f')][_0x1a57('0x2b')]);}return _0xa53aae[_0x1a57('0xfc')](_0x261110);}})['then'](function(_0x5234d2){if(_0x5234d2){return _0x5234d2?{'count':_0x33c1b4,'rows':_0x5234d2}:null;}})[_0x1a57('0x1a')](respondWithResult(_0x162f4c,null))['catch'](handleError(_0x162f4c,null));};exports['getFields']=function(_0x20fb8c,_0x21ef14){var _0x557f51=_0x20fb8c['query']['online']===_0x1a57('0x118')?'offlineForm':'onlineForm';return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'attributes':['id',_0x557f51],'where':{'id':_0x20fb8c[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x21ef14,null))[_0x1a57('0x1a')](function(_0x209280){if(_0x209280){var _0x598583=_0x209280[_0x557f51];var _0x37bdcf=_0x598583&&_0x598583[_0x1a57('0x119')]?_0x598583[_0x1a57('0x119')]:[];_0x21ef14[_0x1a57('0x35')]({'fromKey':_['isNil'](_0x598583[_0x1a57('0x11a')])?undefined:_0x598583[_0x1a57('0x11a')],'count':_0x37bdcf[_0x1a57('0x55')],'rows':_0x37bdcf});}})[_0x1a57('0x24')](handleError(_0x21ef14,null));};exports[_0x1a57('0x11b')]=function(_0x5d11a8,_0x233a03){var _0x5e58e3={'raw':![],'where':{}};var _0x22bbc5={};var _0x5498fc={'count':0x0,'rows':[]};return db[_0x1a57('0x5d')][_0x1a57('0x6d')]({'where':{'id':_0x5d11a8[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x233a03,null))[_0x1a57('0x1a')](function(_0x4f612a){if(_0x4f612a){_0x22bbc5[_0x1a57('0x44')]=_[_0x1a57('0x50')](db[_0x1a57('0x11c')][_0x1a57('0x4c')]);_0x22bbc5[_0x1a57('0x4f')]=_['keys'](_0x5d11a8[_0x1a57('0x4f')]);_0x22bbc5['filters']=_['intersection'](_0x22bbc5[_0x1a57('0x44')],_0x22bbc5['query']);_0x5e58e3[_0x1a57('0x53')]=_[_0x1a57('0x52')](_0x22bbc5[_0x1a57('0x44')],qs[_0x1a57('0x54')](_0x5d11a8[_0x1a57('0x4f')]['fields']));_0x5e58e3[_0x1a57('0x53')]=_0x5e58e3[_0x1a57('0x53')][_0x1a57('0x55')]?_0x5e58e3[_0x1a57('0x53')]:_0x22bbc5['model'];if(!_0x5d11a8[_0x1a57('0x4f')][_0x1a57('0x56')](_0x1a57('0x6e'))){_0x5e58e3[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x5d11a8['query']['limit']);_0x5e58e3[_0x1a57('0x2b')]=qs[_0x1a57('0x2b')](_0x5d11a8[_0x1a57('0x4f')][_0x1a57('0x2b')]);}_0x5e58e3['order']=qs[_0x1a57('0x58')](_0x5d11a8[_0x1a57('0x4f')]['sort']);_0x5e58e3[_0x1a57('0x59')]=qs['filters'](_[_0x1a57('0x6f')](_0x5d11a8['query'],_0x22bbc5['filters']));_0x5e58e3[_0x1a57('0x59')][_0x1a57('0x70')]=_0x4f612a['id'];if(_0x5d11a8['query'][_0x1a57('0x5a')]){_0x5e58e3[_0x1a57('0x59')]=_[_0x1a57('0x5b')](_0x5e58e3[_0x1a57('0x59')],{'$or':_[_0x1a57('0x4b')](_0x5e58e3['attributes'],function(_0x1738d7){var _0x4bb4b1={};_0x4bb4b1[_0x1738d7]={'$like':'%'+_0x5d11a8[_0x1a57('0x4f')][_0x1a57('0x5a')]+'%'};return _0x4bb4b1;})});}_0x5e58e3=_[_0x1a57('0x5b')]({},_0x5e58e3,_0x5d11a8[_0x1a57('0x5c')]);return db['ChatOfflineMessage'][_0x1a57('0x2a')]({'where':_0x5e58e3[_0x1a57('0x59')]})[_0x1a57('0x1a')](function(_0xc7079e){_0x5498fc[_0x1a57('0x2a')]=_0xc7079e;if(_0x5d11a8[_0x1a57('0x4f')][_0x1a57('0x5e')]){_0x5e58e3['include']=[{'all':!![]}];}else{_0x5e58e3[_0x1a57('0x76')]=[{'model':db[_0x1a57('0xab')],'as':_0x1a57('0x11d'),'required':![]},{'model':db[_0x1a57('0xde')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x1a57('0x5f')](_0x5e58e3);})[_0x1a57('0x1a')](function(_0x4e0170){_0x5498fc[_0x1a57('0x60')]=_0x4e0170;return _0x5498fc;});}})[_0x1a57('0x1a')](respondWithFilteredResult(_0x233a03,_0x5e58e3))[_0x1a57('0x24')](handleError(_0x233a03,null));};exports['addAgents']=function(_0x12b08f,_0x413be0){return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0x12b08f[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0x413be0,null))['then'](function(_0x332662){if(_0x332662){return _0x332662[_0x1a57('0x11e')](_0x12b08f[_0x1a57('0x69')][_0x1a57('0x72')],_[_0x1a57('0xf3')](_0x12b08f['body'],[_0x1a57('0x72'),'id'])||{})['spread'](function(_0x54f82f){for(var _0x308945=0x0;_0x308945<_0x12b08f[_0x1a57('0x69')]['ids']['length'];_0x308945+=0x1){socket[_0x1a57('0x11f')](_0x1a57('0x120'),{'UserId':Number(_0x12b08f[_0x1a57('0x69')][_0x1a57('0x72')][_0x308945]),'ChatWebsiteId':Number(_0x12b08f['params']['id'])});}return _0x54f82f;});}})[_0x1a57('0x1a')](respondWithResult(_0x413be0,null))[_0x1a57('0x24')](handleError(_0x413be0,null));};exports[_0x1a57('0x121')]=function(_0xc9e6e5,_0x227c43){return db[_0x1a57('0x5d')][_0x1a57('0x62')]({'where':{'id':_0xc9e6e5[_0x1a57('0x61')]['id']}})['then'](handleEntityNotFound(_0x227c43,null))[_0x1a57('0x1a')](function(_0x54a80f){if(_0x54a80f){return _0x54a80f['removeAgents'](_0xc9e6e5[_0x1a57('0x4f')]['ids'])[_0x1a57('0x1a')](function(){if(_[_0x1a57('0x122')](_0xc9e6e5[_0x1a57('0x4f')][_0x1a57('0x72')])){for(var _0x24ad71=0x0;_0x24ad71<_0xc9e6e5[_0x1a57('0x4f')][_0x1a57('0x72')][_0x1a57('0x55')];_0x24ad71+=0x1){socket['emit'](_0x1a57('0x123'),{'UserId':Number(_0xc9e6e5[_0x1a57('0x4f')][_0x1a57('0x72')][_0x24ad71]),'ChatWebsiteId':Number(_0xc9e6e5[_0x1a57('0x61')]['id'])});}}else{socket[_0x1a57('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0xc9e6e5['query'][_0x1a57('0x72')]),'ChatWebsiteId':Number(_0xc9e6e5[_0x1a57('0x61')]['id'])});}});}})[_0x1a57('0x1a')](respondWithStatusCode(_0x227c43,null))[_0x1a57('0x24')](handleError(_0x227c43,null));};exports['getAgents']=function(_0x4b4000,_0xcefe06){var _0x28a02e={};var _0x4ef607={};var _0x4d04b2;var _0x5951a7;return db[_0x1a57('0x5d')][_0x1a57('0x6d')]({'where':{'id':_0x4b4000[_0x1a57('0x61')]['id']}})[_0x1a57('0x1a')](handleEntityNotFound(_0xcefe06,null))['then'](function(_0x385fbf){if(_0x385fbf){_0x4d04b2=_0x385fbf;_0x4ef607['model']=_[_0x1a57('0x50')](db[_0x1a57('0xf4')][_0x1a57('0x4c')]);_0x4ef607[_0x1a57('0x4f')]=_[_0x1a57('0x50')](_0x4b4000['query']);_0x4ef607['filters']=_[_0x1a57('0x52')](_0x4ef607['model'],_0x4ef607[_0x1a57('0x4f')]);_0x28a02e['attributes']=_[_0x1a57('0x52')](_0x4ef607['model'],qs[_0x1a57('0x54')](_0x4b4000[_0x1a57('0x4f')]['fields']));_0x28a02e[_0x1a57('0x53')]=_0x28a02e['attributes'][_0x1a57('0x55')]?_0x28a02e[_0x1a57('0x53')]:_0x4ef607[_0x1a57('0x44')];_0x28a02e['order']=qs[_0x1a57('0x58')](_0x4b4000[_0x1a57('0x4f')]['sort']);_0x28a02e['where']=qs[_0x1a57('0x51')](_['pick'](_0x4b4000[_0x1a57('0x4f')],_0x4ef607[_0x1a57('0x51')]));if(_0x4b4000[_0x1a57('0x4f')][_0x1a57('0x5a')]){_0x28a02e[_0x1a57('0x59')]=_[_0x1a57('0x5b')](_0x28a02e['where'],{'$or':_['map'](_0x28a02e[_0x1a57('0x53')],function(_0x3d3bcc){var _0xa575c4={};_0xa575c4[_0x3d3bcc]={'$like':'%'+_0x4b4000[_0x1a57('0x4f')][_0x1a57('0x5a')]+'%'};return _0xa575c4;})});}_0x28a02e=_[_0x1a57('0x5b')]({},_0x28a02e,_0x4b4000[_0x1a57('0x5c')]);return _0x4d04b2[_0x1a57('0x124')](_0x28a02e);}})[_0x1a57('0x1a')](function(_0x2cf8f8){if(_0x2cf8f8){_0x5951a7=_0x2cf8f8['length'];if(!_0x4b4000[_0x1a57('0x4f')][_0x1a57('0x56')](_0x1a57('0x6e'))){_0x28a02e[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x4b4000['query'][_0x1a57('0x29')]);_0x28a02e['offset']=qs['offset'](_0x4b4000[_0x1a57('0x4f')][_0x1a57('0x2b')]);}return _0x4d04b2[_0x1a57('0x124')](_0x28a02e);}})[_0x1a57('0x1a')](function(_0x4909d5){if(_0x4909d5){return _0x4909d5?{'count':_0x5951a7,'rows':_0x4909d5}:null;}})[_0x1a57('0x1a')](respondWithResult(_0xcefe06,null))['catch'](handleError(_0xcefe06,null));}; \ No newline at end of file +var _0x1224=['getDispositions','findOne','Disposition','nolimit','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','getLicense','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','existsSync','notify','chat','from','mapKey','isEmpty','Body\x20is\x20mandatory','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmContact','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','timezone','ifTime','List','account','list','orderBy','priority','asc','Contacts','contact','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','applications','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','Sequelize','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','send','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','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','getProactiveActions','../../config/license/util','virtual','custom','License','increment','server/files/chat/iframe.ejs','utf8','origin','remote','headers','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','offlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../config/environment','APIBadRequestError','APINotFoundError','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','redis','defaults','socket.io-emitter','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','offset','limit','count','set','Content-Range','json','destroy','get','ChatWebsites','sendStatus','stack','name','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','device','vendor','model','type','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','body','ChatWebsiteId'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1224,0xc6));var _0x4122=function(_0x4f02a5,_0x154972){_0x4f02a5=_0x4f02a5-0x0;var _0x23ca4f=_0x1224[_0x4f02a5];return _0x23ca4f;};'use strict';var Mustache=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var path=require(_0x4122('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0x4122('0x3'));var htmlToText=require(_0x4122('0x4'));var Redis=require(_0x4122('0x5'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0x4122('0x6'));var logger=require('../../config/logger')(_0x4122('0x7'));var config=require(_0x4122('0x8'));var APIBadRequestError=require('../../errors/api')[_0x4122('0x9')];var APINotFoundError=require('../../errors/api')[_0x4122('0xa')];var APIOutOfIntervalError=require(_0x4122('0xb'))[_0x4122('0xc')];var APIHandleError=require(_0x4122('0xb'))[_0x4122('0xd')];var APIConflictError=require(_0x4122('0xb'))[_0x4122('0xe')];var db=require('../../mysqldb')['db'];config[_0x4122('0xf')]=_[_0x4122('0x10')](config[_0x4122('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x4122('0x11'))(new Redis(config[_0x4122('0xf')]));require('./chatWebsite.socket')[_0x4122('0x12')](socket);var client=jayson[_0x4122('0x13')][_0x4122('0x14')]({'port':0x232c});var client9002=jayson[_0x4122('0x13')]['http']({'port':0x232a});var client9003=jayson[_0x4122('0x13')][_0x4122('0x14')]({'port':0x232b});var client9001=jayson['client'][_0x4122('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x384641,_0x254e35,_0x5d17a6,_0x3b55d9){return new Promise(function(_0x412a1e,_0x457d11){var _0x587c3c=_0x3b55d9||client;return _0x587c3c['request'](_0x384641,_0x5d17a6)[_0x4122('0x15')](function(_0x4c7236){logger[_0x4122('0x16')](_0x4122('0x17'),_0x254e35,_0x4122('0x18'));logger[_0x4122('0x19')](_0x4122('0x1a'),_0x254e35,_0x4122('0x18'),JSON[_0x4122('0x1b')](_0x4c7236));if(_0x4c7236[_0x4122('0x1c')]){if(_0x4c7236[_0x4122('0x1c')][_0x4122('0x1d')]===0x1f4){logger[_0x4122('0x1c')](_0x4122('0x17'),_0x254e35,_0x4c7236[_0x4122('0x1c')][_0x4122('0x1e')]);return _0x457d11(_0x4c7236[_0x4122('0x1c')][_0x4122('0x1e')]);}logger['error'](_0x4122('0x17'),_0x254e35,_0x4c7236[_0x4122('0x1c')][_0x4122('0x1e')]);return _0x412a1e(_0x4c7236['error'][_0x4122('0x1e')]);}else{logger[_0x4122('0x16')](_0x4122('0x17'),_0x254e35,_0x4122('0x18'));_0x412a1e(_0x4c7236[_0x4122('0x1f')][_0x4122('0x1e')]);}})[_0x4122('0x20')](function(_0x2da1d1){logger[_0x4122('0x1c')](_0x4122('0x17'),_0x254e35,_0x2da1d1);_0x457d11(_0x2da1d1);});});}function respondWithStatusCode(_0x52f531,_0x34f5ea){_0x34f5ea=_0x34f5ea||0xcc;return function(_0x5446ce){if(_0x5446ce){return _0x52f531['sendStatus'](_0x34f5ea);}return _0x52f531['status'](_0x34f5ea)[_0x4122('0x21')]();};}function respondWithResult(_0x4e8c7d,_0x2e32f7){_0x2e32f7=_0x2e32f7||0xc8;return function(_0x1c5b14){if(_0x1c5b14){return _0x4e8c7d[_0x4122('0x22')](_0x2e32f7)['json'](_0x1c5b14);}};}function respondWithFilteredResult(_0xbb939f,_0x3691ed){return function(_0x1a11c){if(_0x1a11c){var _0xbf64db=typeof _0x3691ed[_0x4122('0x23')]==='undefined'&&typeof _0x3691ed[_0x4122('0x24')]==='undefined';var _0x518aaa=_0x1a11c[_0x4122('0x25')];var _0x3cbe98=_0xbf64db?0x0:_0x3691ed['offset'];var _0x156fe6=_0xbf64db?_0x1a11c['count']:_0x3691ed[_0x4122('0x23')]+_0x3691ed['limit'];var _0x148a7d;if(_0x156fe6>=_0x518aaa){_0x156fe6=_0x518aaa;_0x148a7d=0xc8;}else{_0x148a7d=0xce;}_0xbb939f[_0x4122('0x22')](_0x148a7d);return _0xbb939f[_0x4122('0x26')](_0x4122('0x27'),_0x3cbe98+'-'+_0x156fe6+'/'+_0x518aaa)[_0x4122('0x28')](_0x1a11c);}return null;};}function saveUpdates(_0x168af5){return function(_0x2881a4){if(_0x2881a4){return _0x2881a4['update'](_0x168af5)[_0x4122('0x15')](function(_0x2e7fce){return _0x2e7fce;});}return null;};}function removeEntity(_0xa8ce1e){return function(_0x58df9c){if(_0x58df9c){return _0x58df9c[_0x4122('0x29')]()[_0x4122('0x15')](function(){var _0x29c0d6=_0x58df9c[_0x4122('0x2a')]({'plain':!![]});var _0x57f13f=_0x4122('0x2b');return db['UserProfileResource'][_0x4122('0x29')]({'where':{'type':_0x57f13f,'resourceId':_0x29c0d6['id']}})['then'](function(){return _0x58df9c;});})[_0x4122('0x15')](function(){_0xa8ce1e[_0x4122('0x22')](0xcc)[_0x4122('0x21')]();});}};}function handleEntityNotFound(_0xa373c6){return function(_0x10379b){if(!_0x10379b){_0xa373c6[_0x4122('0x2c')](0x194);}return _0x10379b;};}function handleError(_0x21257d,_0x1dc688){_0x1dc688=_0x1dc688||0x1f4;return function(_0x594e9c){logger['error'](_0x594e9c[_0x4122('0x2d')]);if(_0x594e9c[_0x4122('0x2e')]){delete _0x594e9c['name'];}_0x21257d['status'](_0x1dc688)['send'](_0x594e9c);};}function createInteractionObject(_0x55707a,_0x2fd4ff,_0x16bd08,_0x219424){var _0x4e9fc5=require(_0x4122('0x2f'));var _0x1cfb27=new _0x4e9fc5();var _0x54030b=_0x1cfb27[_0x4122('0x30')](_0x16bd08[_0x4122('0x31')])[_0x4122('0x32')]();var _0x31168d=_0x2fd4ff[_0x4122('0x33')];if(_0x16bd08['cf-connecting-ip']){_0x31168d=_0x16bd08[_0x4122('0x34')];}else if(_0x16bd08[_0x4122('0x35')]){_0x31168d=_[_0x4122('0x36')](_0x16bd08['x-forwarded-for'][_0x4122('0x37')](','));}return{'ContactId':_0x219424['id'],'ChatWebsiteId':_0x55707a,'from':(_0x219424[_0x4122('0x38')]||'')+'\x20'+(_0x219424[_0x4122('0x39')]||''),'customerIp':_0x31168d,'customerPort':_0x16bd08[_0x4122('0x3a')]?_0x16bd08[_0x4122('0x3a')]:null,'referer':_0x2fd4ff[_0x4122('0x3b')],'browserName':_0x54030b[_0x4122('0x3c')][_0x4122('0x2e')]&&_0x54030b[_0x4122('0x3c')][_0x4122('0x3d')]?util[_0x4122('0x3e')]('%s\x20%s',_0x54030b[_0x4122('0x3c')][_0x4122('0x2e')],_0x54030b[_0x4122('0x3c')]['version']):'unknown','browserVersion':_0x54030b[_0x4122('0x3c')][_0x4122('0x3d')]||_0x4122('0x3f'),'osName':util['format']('%s\x20%s',_0x54030b['os'][_0x4122('0x2e')],_0x54030b['os'][_0x4122('0x3d')]),'osVersion':_0x54030b['os']['version'],'deviceModel':_0x54030b[_0x4122('0x40')]['model']&&_0x54030b['device'][_0x4122('0x41')]?util[_0x4122('0x3e')]('%s\x20%s\x20%s',_0x54030b[_0x4122('0x40')][_0x4122('0x42')],_0x54030b[_0x4122('0x40')][_0x4122('0x41')],_0x54030b[_0x4122('0x40')][_0x4122('0x43')]):null,'deviceVendor':_0x54030b[_0x4122('0x40')]['vendor'],'deviceType':_0x54030b[_0x4122('0x40')][_0x4122('0x43')],'formData':JSON[_0x4122('0x1b')](_0x2fd4ff)};}exports[_0x4122('0x44')]=function(_0x12e99f,_0x2d6ccd){var _0x4bb6ca={'include':[{'model':db[_0x4122('0x45')],'as':_0x4122('0x46')}]},_0x47334e={},_0x19539e={'count':0x0,'rows':[]};var _0x2d86bf=_['map'](db[_0x4122('0x47')]['rawAttributes'],function(_0x242993){return{'name':_0x242993[_0x4122('0x48')],'type':_0x242993['type'][_0x4122('0x49')]};});_0x47334e['model']=_[_0x4122('0x4a')](_0x2d86bf,_0x4122('0x2e'));_0x47334e[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x12e99f[_0x4122('0x4b')]);_0x47334e[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x47334e[_0x4122('0x42')],_0x47334e[_0x4122('0x4b')]);_0x4bb6ca[_0x4122('0x4f')]=_['intersection'](_0x47334e[_0x4122('0x42')],qs[_0x4122('0x50')](_0x12e99f['query']['fields']));_0x4bb6ca[_0x4122('0x4f')]=_0x4bb6ca[_0x4122('0x4f')][_0x4122('0x51')]?_0x4bb6ca[_0x4122('0x4f')]:_0x47334e['model'];if(!_0x12e99f[_0x4122('0x4b')][_0x4122('0x52')]('nolimit')){_0x4bb6ca[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x12e99f[_0x4122('0x4b')]['limit']);_0x4bb6ca[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x12e99f['query'][_0x4122('0x23')]);}_0x4bb6ca[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x12e99f[_0x4122('0x4b')][_0x4122('0x54')]);_0x4bb6ca['where']=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x12e99f[_0x4122('0x4b')],_0x47334e[_0x4122('0x4d')]),_0x2d86bf);if(_0x12e99f[_0x4122('0x4b')][_0x4122('0x56')]){_0x4bb6ca[_0x4122('0x57')]=_[_0x4122('0x58')](_0x4bb6ca[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x2d86bf,function(_0x436f7c){if(_0x436f7c[_0x4122('0x43')]!==_0x4122('0x59')){var _0x54d733={};_0x54d733[_0x436f7c['name']]={'$like':'%'+_0x12e99f['query'][_0x4122('0x56')]+'%'};return _0x54d733;}})});}_0x4bb6ca=_[_0x4122('0x58')]({},_0x4bb6ca,_0x12e99f[_0x4122('0x5a')]);var _0x372d5a={'where':_0x4bb6ca[_0x4122('0x57')]};return db['ChatWebsite'][_0x4122('0x25')](_0x372d5a)['then'](function(_0x12be15){_0x19539e[_0x4122('0x25')]=_0x12be15;if(_0x12e99f['query']['includeAll']){_0x4bb6ca[_0x4122('0x5b')]=[{'all':!![]}];}return db['ChatWebsite'][_0x4122('0x5c')](_0x4bb6ca);})[_0x4122('0x15')](function(_0x4b7491){_0x19539e['rows']=_0x4b7491;return _0x19539e;})['then'](respondWithFilteredResult(_0x2d6ccd,_0x4bb6ca))[_0x4122('0x20')](handleError(_0x2d6ccd,null));};exports[_0x4122('0x5d')]=function(_0x4625aa,_0x3e256){var _0x51633a={'raw':![],'where':{'id':_0x4625aa[_0x4122('0x5e')]['id']},'include':[{'model':db[_0x4122('0x45')],'as':_0x4122('0x46')}]},_0x5cdbc9={};_0x5cdbc9[_0x4122('0x42')]=_['keys'](db[_0x4122('0x47')][_0x4122('0x5f')]);_0x5cdbc9[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x4625aa[_0x4122('0x4b')]);_0x5cdbc9['filters']=_[_0x4122('0x4e')](_0x5cdbc9[_0x4122('0x42')],_0x5cdbc9['query']);_0x51633a['attributes']=_[_0x4122('0x4e')](_0x5cdbc9[_0x4122('0x42')],qs[_0x4122('0x50')](_0x4625aa[_0x4122('0x4b')]['fields']));_0x51633a[_0x4122('0x4f')]=_0x51633a[_0x4122('0x4f')][_0x4122('0x51')]?_0x51633a[_0x4122('0x4f')]:_0x5cdbc9[_0x4122('0x42')];if(_0x4625aa[_0x4122('0x4b')]['includeAll']){_0x51633a[_0x4122('0x5b')]=[{'all':!![]}];}_0x51633a=_[_0x4122('0x58')]({},_0x51633a,_0x4625aa[_0x4122('0x5a')]);return db['ChatWebsite']['find'](_0x51633a)[_0x4122('0x15')](handleEntityNotFound(_0x3e256,null))['then'](respondWithResult(_0x3e256,null))[_0x4122('0x20')](handleError(_0x3e256,null));};exports[_0x4122('0x60')]=function(_0xed30b6,_0x4f8ee1){return db[_0x4122('0x47')][_0x4122('0x60')](_0xed30b6['body'],{})[_0x4122('0x15')](function(_0x3157fa){var _0x58566c=_0xed30b6['user']['get']({'plain':!![]});if(!_0x58566c)throw new Error(_0x4122('0x61'));if(_0x58566c[_0x4122('0x62')]===_0x4122('0x63')){var _0x44fcee=_0x3157fa['get']({'plain':!![]});var _0xf41526=_0x4122('0x2b');return db[_0x4122('0x64')][_0x4122('0x65')]({'where':{'name':_0xf41526,'userProfileId':_0x58566c[_0x4122('0x66')]},'raw':!![]})['then'](function(_0x2fa300){if(_0x2fa300&&_0x2fa300[_0x4122('0x67')]===0x0){return db[_0x4122('0x68')][_0x4122('0x60')]({'name':_0x44fcee[_0x4122('0x2e')],'resourceId':_0x44fcee['id'],'type':_0x2fa300['name'],'sectionId':_0x2fa300['id']},{})[_0x4122('0x15')](function(){return _0x3157fa;});}else{return _0x3157fa;}})[_0x4122('0x20')](function(_0x4e4364){logger[_0x4122('0x1c')](_0x4122('0x69'),_0x4e4364);throw _0x4e4364;});}return _0x3157fa;})[_0x4122('0x15')](respondWithResult(_0x4f8ee1,0xc9))[_0x4122('0x20')](handleError(_0x4f8ee1,null));};exports[_0x4122('0x6a')]=function(_0x3ae015,_0x49d273){if(_0x3ae015['body']['id']){delete _0x3ae015['body']['id'];}return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x3ae015[_0x4122('0x5e')]['id']},'include':[{'model':db[_0x4122('0x45')],'as':_0x4122('0x46')}]})[_0x4122('0x15')](handleEntityNotFound(_0x49d273,null))[_0x4122('0x15')](saveUpdates(_0x3ae015['body'],null))[_0x4122('0x15')](respondWithResult(_0x49d273,null))['catch'](handleError(_0x49d273,null));};exports[_0x4122('0x29')]=function(_0x3376ca,_0x2cc75a){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x3376ca[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x2cc75a,null))['then'](removeEntity(_0x2cc75a,null))['catch'](handleError(_0x2cc75a,null));};exports[_0x4122('0x6b')]=function(_0x5bbfaf,_0x5cc276){return db[_0x4122('0x47')][_0x4122('0x6b')]()['then'](respondWithResult(_0x5cc276,null))['catch'](handleError(_0x5cc276,null));};exports[_0x4122('0x6c')]=function(_0x300254,_0x44b90c){if(_0x300254[_0x4122('0x6d')]['id']){delete _0x300254[_0x4122('0x6d')]['id'];}return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x300254[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x44b90c,null))[_0x4122('0x15')](function(_0x1c051d){if(_0x1c051d){_0x300254[_0x4122('0x6d')][_0x4122('0x6e')]=_0x1c051d['id'];return db['Disposition'][_0x4122('0x60')](_0x300254['body']);}})[_0x4122('0x15')](respondWithResult(_0x44b90c,null))[_0x4122('0x20')](handleError(_0x44b90c,null));};exports[_0x4122('0x6f')]=function(_0x3270d9,_0x3747e8){var _0x376ddf={'raw':![],'where':{}};var _0x122a84={};var _0x57409e={'count':0x0,'rows':[]};return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x3270d9[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x3747e8,null))[_0x4122('0x15')](function(_0x452094){if(_0x452094){_0x122a84[_0x4122('0x42')]=_['keys'](db[_0x4122('0x71')][_0x4122('0x5f')]);_0x122a84[_0x4122('0x4b')]=_['keys'](_0x3270d9[_0x4122('0x4b')]);_0x122a84[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x122a84[_0x4122('0x42')],_0x122a84[_0x4122('0x4b')]);_0x376ddf[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x122a84[_0x4122('0x42')],qs[_0x4122('0x50')](_0x3270d9['query']['fields']));_0x376ddf['attributes']=_0x376ddf[_0x4122('0x4f')]['length']?_0x376ddf[_0x4122('0x4f')]:_0x122a84[_0x4122('0x42')];if(!_0x3270d9[_0x4122('0x4b')]['hasOwnProperty'](_0x4122('0x72'))){_0x376ddf[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x3270d9['query'][_0x4122('0x24')]);_0x376ddf[_0x4122('0x23')]=qs['offset'](_0x3270d9[_0x4122('0x4b')]['offset']);}_0x376ddf['order']=qs['sort'](_0x3270d9[_0x4122('0x4b')]['sort']);_0x376ddf[_0x4122('0x57')]=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x3270d9[_0x4122('0x4b')],_0x122a84[_0x4122('0x4d')]));_0x376ddf[_0x4122('0x57')]['ChatWebsiteId']=_0x452094['id'];if(_0x3270d9[_0x4122('0x4b')][_0x4122('0x56')]){_0x376ddf['where']=_['merge'](_0x376ddf['where'],{'$or':_[_0x4122('0x4a')](_0x376ddf['attributes'],function(_0x909ac0){var _0x5de7fa={};_0x5de7fa[_0x909ac0]={'$like':'%'+_0x3270d9[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x5de7fa;})});}_0x376ddf=_[_0x4122('0x58')]({},_0x376ddf,_0x3270d9[_0x4122('0x5a')]);return db[_0x4122('0x71')]['count']({'where':_0x376ddf[_0x4122('0x57')]})[_0x4122('0x15')](function(_0x3357a8){_0x57409e[_0x4122('0x25')]=_0x3357a8;if(_0x3270d9[_0x4122('0x4b')][_0x4122('0x73')]){_0x376ddf[_0x4122('0x5b')]=[{'all':!![]}];}return db[_0x4122('0x71')][_0x4122('0x5c')](_0x376ddf);})[_0x4122('0x15')](function(_0x15dede){_0x57409e['rows']=_0x15dede;return _0x57409e;});}})['then'](respondWithFilteredResult(_0x3747e8,_0x376ddf))['catch'](handleError(_0x3747e8,null));};exports[_0x4122('0x74')]=function(_0x2d3a6a,_0x5f5c67){return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x2d3a6a[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x5f5c67,null))['then'](function(_0x1e186e){if(_0x1e186e){return _0x1e186e[_0x4122('0x74')](_0x2d3a6a[_0x4122('0x4b')][_0x4122('0x75')]);}})[_0x4122('0x15')](respondWithStatusCode(_0x5f5c67,null))[_0x4122('0x20')](handleError(_0x5f5c67,null));};exports[_0x4122('0x76')]=function(_0x2e497a,_0x4308e8){if(_0x2e497a[_0x4122('0x6d')]['id']){delete _0x2e497a['body']['id'];}return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x2e497a[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4308e8,null))['then'](function(_0x29a62a){if(_0x29a62a){_0x2e497a[_0x4122('0x6d')][_0x4122('0x6e')]=_0x29a62a['id'];return db[_0x4122('0x77')][_0x4122('0x60')](_0x2e497a[_0x4122('0x6d')]);}})['then'](respondWithResult(_0x4308e8,null))['catch'](handleError(_0x4308e8,null));};exports[_0x4122('0x78')]=function(_0x2c6b16,_0x284fda){var _0x1d29b4={'raw':![],'where':{}};var _0xaa0c38={};var _0x2324c6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4122('0x70')]({'where':{'id':_0x2c6b16[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x284fda,null))[_0x4122('0x15')](function(_0x157c6a){if(_0x157c6a){_0xaa0c38[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0x77')][_0x4122('0x5f')]);_0xaa0c38['query']=_[_0x4122('0x4c')](_0x2c6b16[_0x4122('0x4b')]);_0xaa0c38[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0xaa0c38['model'],_0xaa0c38[_0x4122('0x4b')]);_0x1d29b4[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0xaa0c38['model'],qs['fields'](_0x2c6b16[_0x4122('0x4b')]['fields']));_0x1d29b4[_0x4122('0x4f')]=_0x1d29b4[_0x4122('0x4f')][_0x4122('0x51')]?_0x1d29b4[_0x4122('0x4f')]:_0xaa0c38[_0x4122('0x42')];if(!_0x2c6b16['query'][_0x4122('0x52')](_0x4122('0x72'))){_0x1d29b4[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x2c6b16[_0x4122('0x4b')][_0x4122('0x24')]);_0x1d29b4[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x2c6b16[_0x4122('0x4b')][_0x4122('0x23')]);}_0x1d29b4[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x2c6b16[_0x4122('0x4b')][_0x4122('0x54')]);_0x1d29b4[_0x4122('0x57')]=qs['filters'](_[_0x4122('0x55')](_0x2c6b16['query'],_0xaa0c38[_0x4122('0x4d')]));_0x1d29b4[_0x4122('0x57')][_0x4122('0x6e')]=_0x157c6a['id'];if(_0x2c6b16['query'][_0x4122('0x56')]){_0x1d29b4['where']=_[_0x4122('0x58')](_0x1d29b4[_0x4122('0x57')],{'$or':_['map'](_0x1d29b4['attributes'],function(_0x5ba438){var _0x205457={};_0x205457[_0x5ba438]={'$like':'%'+_0x2c6b16[_0x4122('0x4b')]['filter']+'%'};return _0x205457;})});}_0x1d29b4=_[_0x4122('0x58')]({},_0x1d29b4,_0x2c6b16[_0x4122('0x5a')]);return db[_0x4122('0x77')][_0x4122('0x25')]({'where':_0x1d29b4[_0x4122('0x57')]})[_0x4122('0x15')](function(_0x49d235){_0x2324c6[_0x4122('0x25')]=_0x49d235;if(_0x2c6b16[_0x4122('0x4b')][_0x4122('0x73')]){_0x1d29b4[_0x4122('0x5b')]=[{'all':!![]}];}return db[_0x4122('0x77')][_0x4122('0x5c')](_0x1d29b4);})[_0x4122('0x15')](function(_0x2b841f){_0x2324c6[_0x4122('0x79')]=_0x2b841f;return _0x2324c6;});}})['then'](respondWithFilteredResult(_0x284fda,_0x1d29b4))[_0x4122('0x20')](handleError(_0x284fda,null));};exports['removeAnswers']=function(_0x4eb3da,_0x4d91a6){return db['ChatWebsite'][_0x4122('0x65')]({'where':{'id':_0x4eb3da[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x4d91a6,null))[_0x4122('0x15')](function(_0x51fb2d){if(_0x51fb2d){return _0x51fb2d['removeAnswers'](_0x4eb3da['query'][_0x4122('0x75')]);}})[_0x4122('0x15')](respondWithStatusCode(_0x4d91a6,null))[_0x4122('0x20')](handleError(_0x4d91a6,null));};exports[_0x4122('0x7a')]=function(_0x102854,_0x5e3c0f){_0x102854[_0x4122('0x6d')][_0x4122('0x7b')]=_0x102854[_0x4122('0x7c')][_0x4122('0x7d')];return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x102854[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x5e3c0f,null))['then'](saveUpdates(_0x102854[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x5e3c0f,null))[_0x4122('0x20')](handleError(_0x5e3c0f,null));};exports[_0x4122('0x7e')]=function(_0x24b499,_0x2060eb){_0x24b499[_0x4122('0x6d')][_0x4122('0x7f')]=_0x24b499['file'][_0x4122('0x7d')];return db[_0x4122('0x47')]['find']({'where':{'id':_0x24b499['params']['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x2060eb,null))[_0x4122('0x15')](saveUpdates(_0x24b499[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x2060eb,null))[_0x4122('0x20')](handleError(_0x2060eb,null));};exports[_0x4122('0x80')]=function(_0x1489f7,_0x152426){_0x1489f7[_0x4122('0x6d')][_0x4122('0x81')]=_0x1489f7['file'][_0x4122('0x7d')];return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x1489f7[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x152426,null))['then'](saveUpdates(_0x1489f7[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x152426,null))[_0x4122('0x20')](handleError(_0x152426,null));};exports[_0x4122('0x82')]=function(_0x1fc2e6,_0x29e7a2){_0x1fc2e6[_0x4122('0x6d')][_0x4122('0x83')]=_0x1fc2e6['file'][_0x4122('0x7d')];return db[_0x4122('0x47')]['find']({'where':{'id':_0x1fc2e6[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x29e7a2,null))[_0x4122('0x15')](saveUpdates(_0x1fc2e6[_0x4122('0x6d')],null))[_0x4122('0x15')](respondWithResult(_0x29e7a2,null))[_0x4122('0x20')](handleError(_0x29e7a2,null));};exports[_0x4122('0x84')]=function(_0x5b3b35,_0x5e812e){var _0x338382=path[_0x4122('0x85')](config[_0x4122('0x86')],'server/files/images/logos/default_logo.svg');var _0x4eb5c1={'where':{'id':_0x5b3b35[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x7b')],'raw':!![]};var _0x1005a8=![];return require('../../config/license/util')[_0x4122('0x87')]()['then'](function(_0x790b9c){if(_0x790b9c){_0x1005a8=_0x790b9c['custom'];}})[_0x4122('0x15')](function(){return db[_0x4122('0x47')]['find'](_0x4eb5c1);})[_0x4122('0x15')](handleEntityNotFound(_0x5e812e,null))[_0x4122('0x15')](function(_0xea2df4){if(_0xea2df4){if(!_['isNil'](_0xea2df4['sitepic'])){if(fs['existsSync'](path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x88'),_0xea2df4[_0x4122('0x7b')]))&&_0x1005a8){_0x338382=path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x88'),_0xea2df4[_0x4122('0x7b')]);}}return _0x5e812e[_0x4122('0x89')](_0x338382);}})[_0x4122('0x20')](handleError(_0x5e812e,null));};exports[_0x4122('0x8a')]=function(_0xbffd65,_0x39ed0a){var _0xabc7a=path['join'](config[_0x4122('0x86')],'server/files/images/avatars/default_avatar.png');var _0x294f6c={'where':{'id':_0xbffd65[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x7f')],'raw':!![]};return db[_0x4122('0x47')][_0x4122('0x65')](_0x294f6c)[_0x4122('0x15')](handleEntityNotFound(_0x39ed0a,null))[_0x4122('0x15')](function(_0x4b8af0){if(_0x4b8af0){if(!_['isNil'](_0x4b8af0['agentAvatar'])){if(fs['existsSync'](path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x8b'),_0x4b8af0['agentAvatar']))){_0xabc7a=path['join'](config[_0x4122('0x86')],_0x4122('0x8b'),_0x4b8af0[_0x4122('0x7f')]);}}return _0x39ed0a[_0x4122('0x89')](_0xabc7a);}})[_0x4122('0x20')](handleError(_0x39ed0a,null));};exports[_0x4122('0x8c')]=function(_0x3ddf4c,_0x2c3f0d){var _0x105186=path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x8d'));var _0x38eff7={'where':{'id':_0x3ddf4c[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x81'),_0x4122('0x8e')],'raw':!![]};return db['ChatWebsite'][_0x4122('0x65')](_0x38eff7)['then'](handleEntityNotFound(_0x2c3f0d,null))[_0x4122('0x15')](function(_0x26033d){if(_0x26033d){if(!_[_0x4122('0x8f')](_0x26033d[_0x4122('0x81')])){if(fs['existsSync'](path[_0x4122('0x85')](config[_0x4122('0x86')],'server/files/images/avatars/',_0x26033d[_0x4122('0x81')]))&&_0x26033d[_0x4122('0x8e')]){_0x105186=path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x8b'),_0x26033d[_0x4122('0x81')]);}}return _0x2c3f0d[_0x4122('0x89')](_0x105186);}})[_0x4122('0x20')](handleError(_0x2c3f0d,null));};exports[_0x4122('0x90')]=function(_0x539163,_0x5c78c0){var _0xdb77eb=path['join'](config['root'],_0x4122('0x91'));var _0x1cc890={'where':{'id':_0x539163[_0x4122('0x5e')]['id']},'attributes':['id',_0x4122('0x83')],'raw':!![]};return db[_0x4122('0x47')][_0x4122('0x65')](_0x1cc890)[_0x4122('0x15')](handleEntityNotFound(_0x5c78c0,null))[_0x4122('0x15')](function(_0x10e93d){if(_0x10e93d){if(!_['isNil'](_0x10e93d[_0x4122('0x83')])){if(fs[_0x4122('0x92')](path['join'](config[_0x4122('0x86')],_0x4122('0x8b'),_0x10e93d[_0x4122('0x83')]))){_0xdb77eb=path['join'](config[_0x4122('0x86')],_0x4122('0x8b'),_0x10e93d['systemAvatar']);}}return _0x5c78c0['download'](_0xdb77eb);}})[_0x4122('0x20')](handleError(_0x5c78c0,null));};exports[_0x4122('0x93')]=function(_0xb9b23b,_0x3a5d97){var _0x1f2b80={'body':_0xb9b23b[_0x4122('0x6d')],'channel':_0x4122('0x94')};var _0x3d905f=[];var _0x1609fd=[];var _0x1c81f4={};var _0x1cdd7a=![];if(_0xb9b23b['body']['id']){delete _0xb9b23b[_0x4122('0x6d')]['id'];}if(_[_0x4122('0x8f')](_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x4122('0x8f')](_0xb9b23b[_0x4122('0x6d')][_0x4122('0x96')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x4122('0x97')](_0xb9b23b[_0x4122('0x6d')]['body'])){throw new APIBadRequestError(_0x4122('0x98'));}return db['CmContact'][_0x4122('0x6b')]()[_0x4122('0x15')](function(_0x171926){if(!_0x171926){throw new Error(_0x4122('0x99'));}_0x3d905f=Object[_0x4122('0x4c')](_0x171926)[_0x4122('0x56')](function(_0x4ae150){return![_0x4122('0x9a'),'updatedAt']['includes'](_0x4ae150);});_0x1609fd=Object[_0x4122('0x4c')](_0x171926)['filter'](function(_0x3aac12){return!['createdAt',_0x4122('0x9b'),_0x4122('0x9c'),_0x4122('0x9d')][_0x4122('0x9e')](_0x3aac12);});if(!_['includes'](_0x1609fd,_0xb9b23b[_0x4122('0x6d')][_0x4122('0x96')])){throw new APIBadRequestError(_0x4122('0x9f')+_0x1609fd[_0x4122('0x85')](',\x20'));}_0x1c81f4[_0xb9b23b['body']['mapKey']]=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')];})[_0x4122('0x15')](function(){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0xb9b23b['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4122('0xa0')],'as':'Contacts','where':_0x1c81f4,'limit':0x1,'order':[[_0x4122('0x9b'),_0x4122('0xa1')]]}]},{'model':db[_0x4122('0xa2')],'as':_0x4122('0xa3')},{'model':db[_0x4122('0xa4')],'as':_0x4122('0xa4'),'include':[{'model':db[_0x4122('0xa4')],'as':_0x4122('0xa5'),'attributes':['id',_0x4122('0xa6')],'raw':!![]}]}]});})[_0x4122('0x15')](function(_0xac7866){if(!_0xac7866){throw new APINotFoundError(util[_0x4122('0x3e')](_0x4122('0xa7'),_0xb9b23b[_0x4122('0x5e')]['id']));}var _0x530878=_0xac7866[_0x4122('0xa4')];if(_0x530878){var _0x3a9445=_0xac7866[_0x4122('0xa8')]||undefined;return _0x530878[_0x4122('0xa9')](_0x3a9445)['then'](function(_0x355157){if(!_0x355157){throw new APIOutOfIntervalError();}return _0xac7866;});}else{return _0xac7866;}})[_0x4122('0x15')](function(_0x67d048){if(!_0x67d048[_0x4122('0xaa')]){return;}_0x1f2b80[_0x4122('0xab')]=_0x67d048;_0x1f2b80[_0x4122('0xac')]=_0x67d048['List'];_0x1f2b80['applications']=_[_0x4122('0xad')](_0x67d048[_0x4122('0xa3')],[_0x4122('0xae')],[_0x4122('0xaf')]);if(_0x1f2b80[_0x4122('0xab')]['Applications']){delete _0x1f2b80['account'][_0x4122('0xa3')];}if(_0x1f2b80[_0x4122('0xab')][_0x4122('0xaa')]&&_0x1f2b80[_0x4122('0xab')][_0x4122('0xaa')][_0x4122('0xb0')]['length']){return _0x1f2b80[_0x4122('0xab')][_0x4122('0xaa')][_0x4122('0xb0')][0x0];}var _0x4ebef5=_[_0x4122('0x10')](_0xb9b23b[_0x4122('0x6d')],{'firstName':_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')],'ListId':_0x67d048[_0x4122('0x9d')]});_0x4ebef5[_0xb9b23b['body'][_0x4122('0x96')]]=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x95')];return db[_0x4122('0xa0')]['create'](_0x4ebef5,{'fields':_0x3d905f,'raw':!![]});})['then'](function(_0x4d8630){_0x1f2b80[_0x4122('0xb1')]=_0x4d8630;var _0x5a7f9a=createInteractionObject(_0xb9b23b[_0x4122('0x5e')]['id'],_0xb9b23b['body'],_0xb9b23b['headers'],_0x4d8630);var _0x164c12={'ChatWebsiteId':_0xb9b23b[_0x4122('0x5e')]['id']};if(_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb2')]){_0x164c12[_0x4122('0xb2')]=_0xb9b23b[_0x4122('0x6d')]['threadId'];_0x164c12[_0x4122('0xb3')]=![];return db['ChatInteraction']['find']({'where':_0x164c12})['then'](function(_0x2e77f4){var _0xb215b8=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x33')]&&_0xb9b23b[_0x4122('0x6d')]['referer'];if(_0x2e77f4){_0x1cdd7a=!![];return _0x2e77f4;}else if(!_0xb215b8&&_0x2e77f4&&_0x2e77f4[_0x4122('0xb3')]){throw new APIConflictError(_0x4122('0xb4'));}_0x5a7f9a[_0x4122('0xb2')]=_0xb9b23b[_0x4122('0x6d')]['threadId'];_0x5a7f9a[_0x4122('0xb5')]=_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb5')];return db[_0x4122('0xb6')][_0x4122('0x60')](_0x5a7f9a);});}_0x164c12['ContactId']=_0x4d8630['id'];if(_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb7')]&&_0xb9b23b['body'][_0x4122('0xb7')]['id']){_0x164c12['id']=_0xb9b23b['body'][_0x4122('0xb7')]['id'];return db[_0x4122('0xb6')]['find']({'where':_0x164c12})[_0x4122('0x15')](function(_0x5aec89){var _0xddf209=_0xb9b23b[_0x4122('0x6d')][_0x4122('0x33')]&&_0xb9b23b[_0x4122('0x6d')][_0x4122('0x3b')];if(!_0xddf209&&_0x5aec89&&_0x5aec89[_0x4122('0xb3')]){throw new APIConflictError(_0x4122('0xb4'));}else if(_0x5aec89){_0x1cdd7a=!![];return _0x5aec89;}else{return db[_0x4122('0xb6')][_0x4122('0x60')](_0x5a7f9a);}});}return db[_0x4122('0xb6')][_0x4122('0x60')](_0x5a7f9a);})[_0x4122('0x15')](function(_0x14b404){if(!_0x1cdd7a){return _0x14b404;}var _0x28a0fb={'from':(_0x1f2b80['contact'][_0x4122('0x38')]||'')+'\x20'+(_0x1f2b80[_0x4122('0xb1')][_0x4122('0x39')]||'')};if(_0xb9b23b['body'][_0x4122('0xb2')]&&_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb8')]&&_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb2')]!=_0xb9b23b[_0x4122('0x6d')][_0x4122('0xb8')]){_0x28a0fb[_0x4122('0xb2')]=_0xb9b23b[_0x4122('0x6d')]['messageId'];}return _0x14b404['update'](_0x28a0fb);})[_0x4122('0x15')](function(_0x1e88b5){_0x1f2b80[_0x4122('0xb7')]=_0x1e88b5[_0x4122('0x2a')]({'plain':!![]});_0x1f2b80[_0x4122('0xb7')][_0x4122('0xb9')]=!_0x1cdd7a;if(_0x1f2b80[_0x4122('0xb7')][_0x4122('0xb9')]){if(_0x1f2b80[_0x4122('0xab')][_0x4122('0xba')]){_0x1f2b80['applications'][_0x4122('0xbb')]({'id':0x0,'priority':_0x1f2b80[_0x4122('0xbc')]['length']+0x1,'app':_0x4122('0xbd'),'appdata':_0x4122('0xbe'),'interval':_0x4122('0xbf')});}}return db[_0x4122('0xc0')][_0x4122('0x60')]({'body':_0xb9b23b['body'][_0x4122('0x6d')],'ChatWebsiteId':_0xb9b23b[_0x4122('0x5e')]['id'],'ChatInteractionId':_0x1e88b5['id'],'direction':'in','ContactId':_0x1f2b80[_0x4122('0xb1')]['id'],'AttachmentId':_0xb9b23b[_0x4122('0x6d')][_0x4122('0xc1')]});})['then'](function(_0x230f2b){_0x1f2b80['message']=_0x230f2b;if(!_0x1f2b80[_0x4122('0xb7')][_0x4122('0xc2')]){return;}return db[_0x4122('0xc3')][_0x4122('0x65')]({'attributes':['id',_0x4122('0x2e')],'where':{'id':_0x1f2b80[_0x4122('0xb7')][_0x4122('0xc2')]}});})[_0x4122('0x15')](function(_0x1f9496){if(_0x1f9496){_0x1f2b80[_0x4122('0xbc')][_0x4122('0xc4')]({'id':0x0,'priority':0x0,'app':_0x4122('0xc5'),'appdata':_0x1f9496[_0x4122('0x2e')]+','+(_0x1f2b80['account'][_0x4122('0xc6')]||0xa),'interval':_0x4122('0xbf')});_0x1f2b80[_0x4122('0xc7')]=!![];}if(!_0x1f2b80[_0x4122('0xb7')][_0x4122('0xc8')]){return;}return db[_0x4122('0xc9')][_0x4122('0x65')]({'attributes':['id',_0x4122('0x2e')],'where':{'id':_0x1f2b80[_0x4122('0xb7')]['queueId']}});})['then'](function(_0x517373){if(_0x517373){_0x1f2b80[_0x4122('0xbc')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4122('0xca'),'appdata':_0x517373['name']+','+(_0x1f2b80[_0x4122('0xab')][_0x4122('0xcb')]||0x12c),'interval':_0x4122('0xbf')});}return respondWithRpcPromise(_0x4122('0xcc'),_0x4122('0xcd'),_0x1f2b80);})['then'](function(_0x287dcc){respondWithRpcPromise(_0x4122('0xce'),_0x4122('0xce'),{'event':_0x4122('0x93'),'message':_0x287dcc},client9002);return _0x287dcc;})[_0x4122('0x15')](respondWithResult(_0x3a5d97,null))['catch'](APIHandleError(_0x3a5d97));};exports[_0x4122('0xcf')]=function(_0x49570d,_0x4bbde1){var _0x4f5f47,_0x4caa8c,_0x4a12a6;var _0x34bfa1=[];var _0x8d2161={};var _0x5911c6=_0x49570d[_0x4122('0xd0')]||[];var _0x203510=[];var _0x4cafd4;return db['CmContact'][_0x4122('0x6b')]()[_0x4122('0x15')](function(_0x3fb236){if(!_0x3fb236){throw new db[(_0x4122('0xd1'))]['ValidationError']('no\x20available\x20attributes');}_0x34bfa1=_[_0x4122('0xd2')](_['keys'](_0x3fb236),[_0x4122('0x9a'),_0x4122('0x9b'),'CompanyId',_0x4122('0x9d')]);if(_0x49570d[_0x4122('0x6d')]['id']){delete _0x49570d['body']['id'];}if(_['isNil'](_0x49570d[_0x4122('0x6d')][_0x4122('0x95')])){throw _0x4bbde1[_0x4122('0x22')](0x1f4)['send'](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd4')));}if(_[_0x4122('0x8f')](_0x49570d['body'][_0x4122('0x6d')])||_0x49570d[_0x4122('0x6d')][_0x4122('0x6d')]===''){throw _0x4bbde1[_0x4122('0x22')](0x1f4)['send'](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd5')));}if(_[_0x4122('0x8f')](_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')])){throw _0x4bbde1[_0x4122('0x22')](0x1f4)[_0x4122('0xd7')](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd8')+_0x34bfa1));}if(!_[_0x4122('0x9e')](_0x34bfa1,_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')])){throw _0x4bbde1[_0x4122('0x22')](0x1f4)[_0x4122('0xd7')](new db[(_0x4122('0xd1'))][(_0x4122('0xd3'))](_0x4122('0xd9')+_0x34bfa1));}_0x8d2161[_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')]]=_0x49570d[_0x4122('0x6d')][_0x4122('0x95')];})['then'](function(){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x49570d['params']['id']},'include':[{'model':db[_0x4122('0xda')],'as':'List'},{'model':db[_0x4122('0xdb')],'as':'MailAccount'}]});})[_0x4122('0x15')](handleEntityNotFound(_0x4bbde1,null))[_0x4122('0x15')](function(_0x521816){if(_0x521816&&_0x521816[_0x4122('0xaa')]){_0x4caa8c=_0x521816;var _0x35e9a3=_[_0x4122('0x10')](_0x49570d[_0x4122('0x6d')],{'firstName':_0x49570d['body'][_0x4122('0x95')],'phone':_0x49570d[_0x4122('0x6d')]['from'],'ListId':_0x521816[_0x4122('0x9d')]});_0x35e9a3[_0x49570d[_0x4122('0x6d')][_0x4122('0xd6')]]=_0x49570d[_0x4122('0x6d')][_0x4122('0x95')];return db[_0x4122('0xa0')][_0x4122('0xdc')]({'where':_0x8d2161,'defaults':_0x35e9a3});}})[_0x4122('0xdd')](function(_0x1a98a1){if(_0x1a98a1){_0x4a12a6=_0x1a98a1;var _0x15ac3f=fs[_0x4122('0xde')](path['join'](config['root'],_0x4122('0xdf')),'utf8');var _0x51d120=ejs[_0x4122('0xe0')](_0x15ac3f,{'body':_[_0x4122('0xe1')](_0x49570d[_0x4122('0x6d')][_0x4122('0x6d')]),'bodyTitle':_0x4caa8c[_0x4122('0xe2')]});return db[_0x4122('0xe3')][_0x4122('0x60')]({'body':_0x51d120,'plainBody':htmlToText[_0x4122('0xe4')](_0x51d120),'ContactId':_0x1a98a1['id'],'ChatWebsiteId':_0x4caa8c['id']});}})[_0x4122('0x15')](function(_0x6ddac0){_0x4cafd4=_0x6ddac0;if(_0x5911c6[_0x4122('0x51')]){var _0x1747ac=_0x5911c6[_0x4122('0x4a')](function(_0x144fa0){return{'name':_0x144fa0[_0x4122('0xe5')],'basename':_0x144fa0[_0x4122('0x7d')],'type':_0x144fa0[_0x4122('0xe6')],'ChatOfflineMessageId':_0x6ddac0['id']};});_0x203510=_0x1747ac[_0x4122('0x4a')](_0xfbe78d=>{var _0x4390da={'filename':_0xfbe78d[_0x4122('0x2e')],'path':path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0xe7'),_0x4122('0xd0'),_0x4122('0xe8'),_0x4122('0xe9'),_0xfbe78d[_0x4122('0xea')])};return _0x4390da;});if(!_0x4caa8c['openNewInteraction']){return db[_0x4122('0xeb')][_0x4122('0xec')](function(_0x59108b){return db[_0x4122('0xed')][_0x4122('0xee')](_0x1747ac,{'transaction':_0x59108b});});}}})[_0x4122('0x15')](function(){if(_0x4cafd4){_0x4f5f47=_0x4cafd4;return db[_0x4122('0xdb')][_0x4122('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x4122('0xef')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4122('0xf0')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x4122('0x15')](function(_0x496112){if(_0x496112&&_0x496112[_0x4122('0xf1')]&&_0x4caa8c[_0x4122('0xf2')]&&_0x4caa8c['forwardOfflineAddress']){var _0x5b617c=_0x496112[_0x4122('0xf3')]();return respondWithRpcPromise(_0x4122('0xf4'),_0x4122('0xf5'),{'account':_0x5b617c,'message':{'from':util['format'](_0x4122('0xf6'),_0x496112[_0x4122('0x2e')],_0x496112[_0x4122('0xf7')]||_0x496112[_0x4122('0xf1')][_0x4122('0x63')]),'to':_0x4caa8c[_0x4122('0xf8')],'subject':_0x4caa8c[_0x4122('0xf9')],'html':_0x4f5f47[_0x4122('0x6d')],'attachments':_0x203510}},client9003)['then'](function(){return _0x4f5f47;})[_0x4122('0x20')](function(_0x952fe1){logger[_0x4122('0x1c')](_0x952fe1);});}})[_0x4122('0x15')](function(){if(_0x4caa8c&&_0x4caa8c[_0x4122('0xfa')]&&_0x4caa8c[_0x4122('0xfb')]){var _0x1037b0=[];if(_0x5911c6['length']){_0x1037b0=_0x5911c6[_0x4122('0x4a')](function(_0x43c964){return{'name':_0x43c964['originalname'],'basename':_0x43c964[_0x4122('0x7d')],'type':_0x43c964[_0x4122('0xe6')],'ChatOfflineMessageId':_0x4cafd4['id']};});}var _0x32b5ae;if(!_[_0x4122('0x8f')](_0x4caa8c[_0x4122('0xfc')])){var _0x4f0c78=_[_0x4122('0x4a')](_0x49570d['body'],function(_0x873052){return _0x873052;});var _0x4a2338=_[_0x4122('0xfd')](_0x4f0c78)[0x0];var _0x3638b8=_[_0x4122('0xfe')](_0x4a2338,function(_0x5315c8){return _0x5315c8;});_0x32b5ae=_0x3638b8[0x1][_0x4caa8c[_0x4122('0xfc')]];}var _0x287946={'from':_0x4a12a6['email'],'firstName':_0x4a12a6[_0x4122('0x38')],'lastName':_0x4a12a6[_0x4122('0x39')],'mapKey':_0x4122('0xf7'),'message':{'from':_0x4a12a6[_0x4122('0xf7')],'to':_0x4caa8c[_0x4122('0xdb')][_0x4122('0xf7')],'cc':'','subject':_[_0x4122('0x8f')](_0x32b5ae)?_0x4caa8c[_0x4122('0xf9')]:_0x32b5ae,'messageId':'','sentAt':new Date(),'attach':_0x1037b0['length'],'attachments':_0x1037b0,'originChannel':_0x4122('0xff'),'ChatWebsiteId':_0x4caa8c['id'],'ChatOfflineMessageId':_0x4f5f47['id'],'originTo':_0x4caa8c[_0x4122('0xdb')][_0x4122('0xf7')]},'body':_0x4f5f47[_0x4122('0x6d')]};var _0x3d2f91={'account':{'id':_0x4caa8c[_0x4122('0xfb')]},'body':_0x287946,'log':_0x4122('0x100')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x3d2f91,client9001)[_0x4122('0x15')](function(){return _0x4f5f47;})['catch'](function(_0x468460){logger['error'](_0x468460);});}return;})[_0x4122('0x15')](function(){if(_0x4f5f47){return _0x4f5f47;}})[_0x4122('0x15')](respondWithResult(_0x4bbde1,null))[_0x4122('0x20')](function(){for(var _0xc9a468 of _0x5911c6){var _0x4b94f4=path[_0x4122('0x85')](config['root'],_0x4122('0xe7'),_0x4122('0xd0'),_0x4122('0xe8'),'offline-chat',_0xc9a468[_0x4122('0x7d')]);fs_extra['remove'](_0x4b94f4)[_0x4122('0x20')](function(_0x16e1fd){logger[_0x4122('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x4b94f4,_0x16e1fd);});}});};exports[_0x4122('0x101')]=function(_0x370266,_0x589870){return db[_0x4122('0xb6')][_0x4122('0x65')]({'where':{'id':_0x370266['params']['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x589870,null))['then'](function(_0x5d5155){if(_0x5d5155){return _0x5d5155['addInteraction'](_0x370266[_0x4122('0x6d')][_0x4122('0x75')],_[_0x4122('0x102')](_0x370266[_0x4122('0x6d')],[_0x4122('0x75'),'id'])||{});}})[_0x4122('0x15')](respondWithResult(_0x589870,null))['catch'](handleError(_0x589870,null));};exports[_0x4122('0x103')]=function(_0x55ce4a,_0x39d1bc){var _0x224a86={'raw':![],'where':{}};var _0x409bad={};var _0x1bde17={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x55ce4a[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x39d1bc,null))['then'](function(_0x3c4d9a){if(_0x3c4d9a){_0x409bad[_0x4122('0x42')]=_[_0x4122('0x4c')](db['ChatInteraction'][_0x4122('0x5f')]);_0x409bad[_0x4122('0x4b')]=_['keys'](_0x55ce4a['query']);_0x409bad['filters']=_[_0x4122('0x4e')](_0x409bad[_0x4122('0x42')],_0x409bad[_0x4122('0x4b')]);_0x224a86[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x409bad[_0x4122('0x42')],qs[_0x4122('0x50')](_0x55ce4a['query'][_0x4122('0x50')]));_0x224a86[_0x4122('0x4f')]=_0x224a86[_0x4122('0x4f')][_0x4122('0x51')]?_0x224a86[_0x4122('0x4f')]:_0x409bad[_0x4122('0x42')];if(!_0x55ce4a[_0x4122('0x4b')]['hasOwnProperty']('nolimit')){_0x224a86['limit']=qs['limit'](_0x55ce4a[_0x4122('0x4b')][_0x4122('0x24')]);_0x224a86[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x55ce4a[_0x4122('0x4b')][_0x4122('0x23')]);}_0x224a86['order']=qs['sort'](_0x55ce4a['query'][_0x4122('0x54')]);_0x224a86[_0x4122('0x57')]=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x55ce4a['query'],_0x409bad['filters']));_0x224a86['where'][_0x4122('0x6e')]=_0x3c4d9a['id'];if(_0x55ce4a['query']['filter']){_0x224a86['where']=_[_0x4122('0x58')](_0x224a86[_0x4122('0x57')],{'$or':_['map'](_0x224a86[_0x4122('0x4f')],function(_0x989f7){var _0x2e9c92={};_0x2e9c92[_0x989f7]={'$like':'%'+_0x55ce4a[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x2e9c92;})});}_0x224a86=_[_0x4122('0x58')]({},_0x224a86,_0x55ce4a[_0x4122('0x5a')]);return db[_0x4122('0xb6')][_0x4122('0x25')]({'where':_0x224a86[_0x4122('0x57')]})['then'](function(_0x24102e){_0x1bde17['count']=_0x24102e;if(_0x55ce4a[_0x4122('0x4b')][_0x4122('0x73')]){_0x224a86['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4122('0xc3')],'as':_0x4122('0x104'),'attributes':['name',_0x4122('0x105'),_0x4122('0x106')],'required':![]},{'model':db[_0x4122('0x107')],'as':_0x4122('0x108'),'attributes':['id','name',_0x4122('0x109')],'where':_0x55ce4a['query'][_0x4122('0x10a')]?{'id':_0x55ce4a[_0x4122('0x4b')]['tag']}:undefined,'required':_0x55ce4a[_0x4122('0x4b')][_0x4122('0x10a')]?!![]:![]}];}return db[_0x4122('0xb6')]['findAll'](_0x224a86);})['then'](function(_0x297958){_0x1bde17['rows']=_0x297958;return _0x1bde17;});}})[_0x4122('0x15')](respondWithFilteredResult(_0x39d1bc,_0x224a86))['catch'](handleError(_0x39d1bc,null));};exports['getSnippet']=function(_0x15031a,_0x1579ad){var _0x430c5f=0x0;var _0xa3b6bb=0x0;var _0x4f108f=![];var _0x423f9c;var _0x1505f1;return db['ChatWebsite']['find']({'where':{'id':_0x15031a['params']['id']},'include':[{'model':db[_0x4122('0xa4')],'as':_0x4122('0xa4'),'include':[{'model':db[_0x4122('0xa4')],'as':'Intervals','attributes':['id',_0x4122('0xa6')]}]}]})[_0x4122('0x15')](handleEntityNotFound(_0x1579ad,null))[_0x4122('0x15')](function(_0x19837f){if(_0x19837f){_0x423f9c=_0x19837f;return _0x19837f[_0x4122('0x10b')]({'raw':!![]});}})[_0x4122('0x15')](function(_0x30eb51){if(_0x423f9c){if(_0x30eb51){_0x1505f1=_0x30eb51;}}return require(_0x4122('0x10c'))[_0x4122('0x87')]();})['then'](function(_0x3b0aee){if(_0x3b0aee){_0xa3b6bb=_0x3b0aee[_0x4122('0x10d')];_0x4f108f=_0x3b0aee[_0x4122('0x10e')];}})[_0x4122('0x15')](function(){return db[_0x4122('0xb6')][_0x4122('0x25')]({'where':{'closed':![]}});})[_0x4122('0x15')](function(_0x1dbb7a){_0x430c5f=_0x1dbb7a;if(_0xa3b6bb&&_0x1dbb7a>_0xa3b6bb){return db[_0x4122('0x10f')][_0x4122('0x70')]({'where':{'id':0x1}})[_0x4122('0x15')](function(_0x408182){if(_0x408182){_0x408182[_0x4122('0x110')]('chatLicenseExceeded');}});}})['then'](function(){var _0x9d9d73=_0x423f9c[_0x4122('0xa4')];var _0x3fe22e=_0x423f9c[_0x4122('0xa8')]||undefined;return _0x9d9d73?_0x9d9d73[_0x4122('0xa9')](_0x3fe22e):!![];})[_0x4122('0x15')](function(_0xb39b79){var _0x10fbbb=fs[_0x4122('0xde')](path[_0x4122('0x85')](config[_0x4122('0x86')],_0x4122('0x111')),_0x4122('0x112'));var _0x3da13c=new url['URL'](_0x423f9c['address'])[_0x4122('0x113')];var _0x315a59='3.8.1';var _0x31a4cc=![];var _0x2fe24f={'chatVersion':_0x315a59,'chatWebsiteAddressOrigin':_0x3da13c,'remote':_0x423f9c[_0x4122('0x114')],'query':querystring['stringify'](_[_0x4122('0x58')](_0x423f9c[_0x4122('0x2a')]({'plain':!![]}),{'customerIp':_0x15031a['headers'][_0x4122('0x35')]||_0x15031a[_0x4122('0x115')]['x-real-ip']||_0x15031a[_0x4122('0x116')][_0x4122('0x117')]||_0x15031a['ip'],'referer':_0x15031a['headers'][_0x4122('0x3b')],'openedInteractions':_0x430c5f,'maxInteractions':_0xa3b6bb,'virtual':_0x4f108f['virtual'],'online':_0xb39b79,'custom':_0x4f108f}))['replace'](/'/g,'\x5c\x27')};_0x1579ad[_0x4122('0xd7')](ejs[_0x4122('0xe0')](Mustache[_0x4122('0xe0')](_0x10fbbb,_0x2fe24f),{'proactiveActions':_0x1505f1,'alignment':_0x423f9c[_0x4122('0x118')],'verticalAlignment':_0x423f9c[_0x4122('0x119')],'div_color':_0x423f9c[_0x4122('0x109')],'labelText':_0x423f9c[_0x4122('0x11a')],'text_color':_0x423f9c[_0x4122('0x11b')],'text_button_color':_0x423f9c[_0x4122('0x11c')],'button_color':_0x423f9c['color_button'],'background_color':_0x423f9c[_0x4122('0x11d')],'hideWhenOffline':_0x423f9c[_0x4122('0x11e')],'intervalId':_0x423f9c[_0x4122('0x11f')],'isDevelopment':_0x31a4cc,'chatVersion':_0x315a59}));})['catch'](handleError(_0x1579ad,null));};exports[_0x4122('0x120')]=function(_0x18e1c6,_0x540a1d){var _0x1f2086=_0x18e1c6[_0x4122('0x5e')]['id'];var _0x2af064=_0x18e1c6[_0x4122('0x6d')];var _0x202c62=0xc8;var _0x57d164=null;return db[_0x4122('0xeb')][_0x4122('0xec')]({'isolationLevel':db[_0x4122('0xeb')][_0x4122('0x121')]['ISOLATION_LEVELS'][_0x4122('0x122')]},function(_0x4d6344){return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x1f2086},'transaction':_0x4d6344})[_0x4122('0x15')](function(_0x1c99e4){if(_0x1c99e4){return db[_0x4122('0xa2')][_0x4122('0x29')]({'where':{'ChatWebsiteId':_0x1f2086},'transaction':_0x4d6344})['then'](function(){var _0x4fe8b8=_[_0x4122('0x4a')](_0x2af064,function(_0x34760f){_0x34760f[_0x4122('0x6e')]=_0x1f2086;return _0x34760f;});return db[_0x4122('0xa2')]['bulkCreate'](_0x4fe8b8,{'transaction':_0x4d6344});});}else{_0x202c62=0x194;_0x57d164=[];}});})[_0x4122('0x15')](function(){if(_0x202c62!==0x194){return db[_0x4122('0xa2')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1f2086},'order':'priority'})[_0x4122('0x15')](function(_0xd6ba5c){_0x57d164=_0xd6ba5c;});}})[_0x4122('0x20')](function(_0x41d402){_0x202c62=0x1f4;logger['error'](_0x41d402['stack']);if(_0x41d402['name']){delete _0x41d402['name'];}_0x57d164=_0x41d402;})[_0x4122('0x123')](function(){if(_0x57d164===null){_0x540a1d[_0x4122('0x2c')](_0x202c62);}else{if(_0x202c62===0x1f4){_0x540a1d['status'](_0x202c62)['send'](_0x57d164);}else{_0x540a1d[_0x4122('0x22')](_0x202c62)['json'](_0x57d164);}}});};exports[_0x4122('0x124')]=function(_0x5481d7,_0x2badbc){var _0x508af0={};var _0x8c8072={};var _0x534ed3;var _0x405fff;return db['ChatWebsite']['findOne']({'where':{'id':_0x5481d7[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x2badbc,null))[_0x4122('0x15')](function(_0x7a24e3){if(_0x7a24e3){_0x534ed3=_0x7a24e3;_0x8c8072[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0xa2')]['rawAttributes']);_0x8c8072[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x5481d7['query']);_0x8c8072[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x8c8072['model'],_0x8c8072[_0x4122('0x4b')]);_0x508af0[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x8c8072['model'],qs[_0x4122('0x50')](_0x5481d7['query'][_0x4122('0x50')]));_0x508af0[_0x4122('0x4f')]=_0x508af0['attributes'][_0x4122('0x51')]?_0x508af0[_0x4122('0x4f')]:_0x8c8072[_0x4122('0x42')];_0x508af0[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x5481d7['query'][_0x4122('0x54')]);_0x508af0['where']=qs['filters'](_['pick'](_0x5481d7[_0x4122('0x4b')],_0x8c8072['filters']));if(_0x5481d7[_0x4122('0x4b')]['filter']){_0x508af0[_0x4122('0x57')]=_[_0x4122('0x58')](_0x508af0[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x508af0[_0x4122('0x4f')],function(_0x2bfd89){var _0x26f7b1={};_0x26f7b1[_0x2bfd89]={'$like':'%'+_0x5481d7['query'][_0x4122('0x56')]+'%'};return _0x26f7b1;})});}_0x508af0=_['merge']({},_0x508af0,_0x5481d7['options']);return _0x534ed3[_0x4122('0x124')](_0x508af0);}})[_0x4122('0x15')](function(_0x4d428c){if(_0x4d428c){_0x405fff=_0x4d428c[_0x4122('0x51')];if(!_0x5481d7[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x508af0[_0x4122('0x24')]=qs['limit'](_0x5481d7[_0x4122('0x4b')][_0x4122('0x24')]);_0x508af0[_0x4122('0x23')]=qs['offset'](_0x5481d7[_0x4122('0x4b')][_0x4122('0x23')]);}return _0x534ed3[_0x4122('0x124')](_0x508af0);}})['then'](function(_0x2684bd){if(_0x2684bd){return _0x2684bd?{'count':_0x405fff,'rows':_0x2684bd}:null;}})[_0x4122('0x15')](respondWithResult(_0x2badbc,null))['catch'](handleError(_0x2badbc,null));};exports['addProactiveActions']=function(_0x1a03c2,_0x260b3b){return db[_0x4122('0x125')][_0x4122('0x65')]({'where':{'id':_0x1a03c2[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x260b3b,null))[_0x4122('0x15')](function(_0x2d2f31){if(_0x2d2f31){return _0x2d2f31[_0x4122('0x126')](_0x1a03c2['body'][_0x4122('0x75')],_['omit'](_0x1a03c2[_0x4122('0x6d')],[_0x4122('0x75'),'id'])||{});}})[_0x4122('0x15')](respondWithResult(_0x260b3b,null))[_0x4122('0x20')](handleError(_0x260b3b,null));};exports[_0x4122('0x10b')]=function(_0x3c1256,_0x1b8840){var _0x52adcc={};var _0x49875f={};var _0x59cf79;var _0x15826a;return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x3c1256[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x1b8840,null))['then'](function(_0x1df890){if(_0x1df890){_0x59cf79=_0x1df890;_0x49875f[_0x4122('0x42')]=_['keys'](db[_0x4122('0x127')][_0x4122('0x5f')]);_0x49875f[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x3c1256[_0x4122('0x4b')]);_0x49875f[_0x4122('0x4d')]=_['intersection'](_0x49875f[_0x4122('0x42')],_0x49875f[_0x4122('0x4b')]);_0x52adcc[_0x4122('0x4f')]=_[_0x4122('0x4e')](_0x49875f[_0x4122('0x42')],qs['fields'](_0x3c1256[_0x4122('0x4b')][_0x4122('0x50')]));_0x52adcc['attributes']=_0x52adcc[_0x4122('0x4f')][_0x4122('0x51')]?_0x52adcc['attributes']:_0x49875f[_0x4122('0x42')];_0x52adcc[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x3c1256['query'][_0x4122('0x54')]);_0x52adcc[_0x4122('0x57')]=qs[_0x4122('0x4d')](_['pick'](_0x3c1256[_0x4122('0x4b')],_0x49875f[_0x4122('0x4d')]));if(_0x3c1256[_0x4122('0x4b')][_0x4122('0x56')]){_0x52adcc['where']=_[_0x4122('0x58')](_0x52adcc[_0x4122('0x57')],{'$or':_['map'](_0x52adcc[_0x4122('0x4f')],function(_0x564a9b){var _0x2c2522={};_0x2c2522[_0x564a9b]={'$like':'%'+_0x3c1256[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x2c2522;})});}_0x52adcc=_[_0x4122('0x58')]({},_0x52adcc,_0x3c1256[_0x4122('0x5a')]);return _0x59cf79[_0x4122('0x10b')](_0x52adcc);}})[_0x4122('0x15')](function(_0x26fed7){if(_0x26fed7){_0x15826a=_0x26fed7['length'];if(!_0x3c1256[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x52adcc[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x3c1256[_0x4122('0x4b')][_0x4122('0x24')]);_0x52adcc[_0x4122('0x23')]=qs['offset'](_0x3c1256[_0x4122('0x4b')][_0x4122('0x23')]);}return _0x59cf79[_0x4122('0x10b')](_0x52adcc);}})[_0x4122('0x15')](function(_0x1a9d51){if(_0x1a9d51){return _0x1a9d51?{'count':_0x15826a,'rows':_0x1a9d51}:null;}})[_0x4122('0x15')](respondWithResult(_0x1b8840,null))[_0x4122('0x20')](handleError(_0x1b8840,null));};exports[_0x4122('0x128')]=function(_0xbd985d,_0x311464){var _0x1d4714=_0xbd985d['query']['online']==='false'?_0x4122('0x129'):'onlineForm';return db['ChatWebsite'][_0x4122('0x65')]({'attributes':['id',_0x1d4714],'where':{'id':_0xbd985d[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x311464,null))[_0x4122('0x15')](function(_0x1f01a3){if(_0x1f01a3){var _0x4ecbf5=_0x1f01a3[_0x1d4714];var _0x19f6c2=_0x4ecbf5&&_0x4ecbf5[_0x4122('0x12a')]?_0x4ecbf5['items']:[];_0x311464[_0x4122('0xd7')]({'fromKey':_[_0x4122('0x8f')](_0x4ecbf5['fromKey'])?undefined:_0x4ecbf5[_0x4122('0x12b')],'count':_0x19f6c2[_0x4122('0x51')],'rows':_0x19f6c2});}})[_0x4122('0x20')](handleError(_0x311464,null));};exports[_0x4122('0x12c')]=function(_0x19214c,_0x46f8a2){var _0x3fc21c={'raw':![],'where':{}};var _0x4f2c96={};var _0x32b626={'count':0x0,'rows':[]};return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x19214c[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x46f8a2,null))['then'](function(_0x4c6cca){if(_0x4c6cca){_0x4f2c96[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0xe3')][_0x4122('0x5f')]);_0x4f2c96[_0x4122('0x4b')]=_[_0x4122('0x4c')](_0x19214c[_0x4122('0x4b')]);_0x4f2c96[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x4f2c96[_0x4122('0x42')],_0x4f2c96['query']);_0x3fc21c['attributes']=_[_0x4122('0x4e')](_0x4f2c96[_0x4122('0x42')],qs[_0x4122('0x50')](_0x19214c['query']['fields']));_0x3fc21c[_0x4122('0x4f')]=_0x3fc21c[_0x4122('0x4f')][_0x4122('0x51')]?_0x3fc21c[_0x4122('0x4f')]:_0x4f2c96['model'];if(!_0x19214c[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x3fc21c[_0x4122('0x24')]=qs[_0x4122('0x24')](_0x19214c[_0x4122('0x4b')]['limit']);_0x3fc21c['offset']=qs[_0x4122('0x23')](_0x19214c[_0x4122('0x4b')][_0x4122('0x23')]);}_0x3fc21c[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x19214c[_0x4122('0x4b')][_0x4122('0x54')]);_0x3fc21c['where']=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x19214c[_0x4122('0x4b')],_0x4f2c96['filters']));_0x3fc21c[_0x4122('0x57')][_0x4122('0x6e')]=_0x4c6cca['id'];if(_0x19214c[_0x4122('0x4b')]['filter']){_0x3fc21c[_0x4122('0x57')]=_[_0x4122('0x58')](_0x3fc21c[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x3fc21c[_0x4122('0x4f')],function(_0x27441d){var _0x2d8d35={};_0x2d8d35[_0x27441d]={'$like':'%'+_0x19214c[_0x4122('0x4b')]['filter']+'%'};return _0x2d8d35;})});}_0x3fc21c=_[_0x4122('0x58')]({},_0x3fc21c,_0x19214c[_0x4122('0x5a')]);return db['ChatOfflineMessage'][_0x4122('0x25')]({'where':_0x3fc21c[_0x4122('0x57')]})[_0x4122('0x15')](function(_0xd7fdde){_0x32b626[_0x4122('0x25')]=_0xd7fdde;if(_0x19214c[_0x4122('0x4b')]['includeAll']){_0x3fc21c[_0x4122('0x5b')]=[{'all':!![]}];}else{_0x3fc21c[_0x4122('0x5b')]=[{'model':db[_0x4122('0xa0')],'as':_0x4122('0x12d'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x4122('0xe3')]['findAll'](_0x3fc21c);})[_0x4122('0x15')](function(_0x1c23e8){_0x32b626[_0x4122('0x79')]=_0x1c23e8;return _0x32b626;});}})[_0x4122('0x15')](respondWithFilteredResult(_0x46f8a2,_0x3fc21c))[_0x4122('0x20')](handleError(_0x46f8a2,null));};exports[_0x4122('0x12e')]=function(_0x281bd1,_0x5e55e2){return db[_0x4122('0x47')][_0x4122('0x65')]({'where':{'id':_0x281bd1[_0x4122('0x5e')]['id']}})[_0x4122('0x15')](handleEntityNotFound(_0x5e55e2,null))[_0x4122('0x15')](function(_0xa2300c){if(_0xa2300c){return _0xa2300c[_0x4122('0x12e')](_0x281bd1['body'][_0x4122('0x75')],_[_0x4122('0x102')](_0x281bd1[_0x4122('0x6d')],['ids','id'])||{})[_0x4122('0xdd')](function(_0x49b039){for(var _0x107443=0x0;_0x107443<_0x281bd1['body'][_0x4122('0x75')][_0x4122('0x51')];_0x107443+=0x1){socket[_0x4122('0x12f')](_0x4122('0x130'),{'UserId':Number(_0x281bd1[_0x4122('0x6d')]['ids'][_0x107443]),'ChatWebsiteId':Number(_0x281bd1[_0x4122('0x5e')]['id'])});}return _0x49b039;});}})[_0x4122('0x15')](respondWithResult(_0x5e55e2,null))[_0x4122('0x20')](handleError(_0x5e55e2,null));};exports[_0x4122('0x131')]=function(_0x4485b4,_0x219331){return db['ChatWebsite']['find']({'where':{'id':_0x4485b4[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x219331,null))[_0x4122('0x15')](function(_0x437970){if(_0x437970){return _0x437970[_0x4122('0x131')](_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')])[_0x4122('0x15')](function(){if(_[_0x4122('0x132')](_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')])){for(var _0x326c20=0x0;_0x326c20<_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')]['length'];_0x326c20+=0x1){socket[_0x4122('0x12f')](_0x4122('0x133'),{'UserId':Number(_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')][_0x326c20]),'ChatWebsiteId':Number(_0x4485b4[_0x4122('0x5e')]['id'])});}}else{socket['emit'](_0x4122('0x133'),{'UserId':Number(_0x4485b4[_0x4122('0x4b')][_0x4122('0x75')]),'ChatWebsiteId':Number(_0x4485b4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x219331,null))[_0x4122('0x20')](handleError(_0x219331,null));};exports[_0x4122('0x134')]=function(_0x13fad9,_0x1d666e){var _0x58fe14={};var _0x1eed2e={};var _0x29b38e;var _0x33225f;return db[_0x4122('0x47')][_0x4122('0x70')]({'where':{'id':_0x13fad9[_0x4122('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1d666e,null))[_0x4122('0x15')](function(_0x3c3bc6){if(_0x3c3bc6){_0x29b38e=_0x3c3bc6;_0x1eed2e[_0x4122('0x42')]=_[_0x4122('0x4c')](db[_0x4122('0xc3')][_0x4122('0x5f')]);_0x1eed2e[_0x4122('0x4b')]=_['keys'](_0x13fad9[_0x4122('0x4b')]);_0x1eed2e[_0x4122('0x4d')]=_[_0x4122('0x4e')](_0x1eed2e[_0x4122('0x42')],_0x1eed2e[_0x4122('0x4b')]);_0x58fe14[_0x4122('0x4f')]=_['intersection'](_0x1eed2e[_0x4122('0x42')],qs[_0x4122('0x50')](_0x13fad9[_0x4122('0x4b')][_0x4122('0x50')]));_0x58fe14[_0x4122('0x4f')]=_0x58fe14[_0x4122('0x4f')][_0x4122('0x51')]?_0x58fe14['attributes']:_0x1eed2e[_0x4122('0x42')];_0x58fe14[_0x4122('0x53')]=qs[_0x4122('0x54')](_0x13fad9['query'][_0x4122('0x54')]);_0x58fe14['where']=qs[_0x4122('0x4d')](_[_0x4122('0x55')](_0x13fad9[_0x4122('0x4b')],_0x1eed2e[_0x4122('0x4d')]));if(_0x13fad9[_0x4122('0x4b')][_0x4122('0x56')]){_0x58fe14[_0x4122('0x57')]=_['merge'](_0x58fe14[_0x4122('0x57')],{'$or':_[_0x4122('0x4a')](_0x58fe14['attributes'],function(_0x1688eb){var _0x2d6c25={};_0x2d6c25[_0x1688eb]={'$like':'%'+_0x13fad9[_0x4122('0x4b')][_0x4122('0x56')]+'%'};return _0x2d6c25;})});}_0x58fe14=_[_0x4122('0x58')]({},_0x58fe14,_0x13fad9['options']);return _0x29b38e[_0x4122('0x134')](_0x58fe14);}})[_0x4122('0x15')](function(_0x2f8e72){if(_0x2f8e72){_0x33225f=_0x2f8e72[_0x4122('0x51')];if(!_0x13fad9[_0x4122('0x4b')][_0x4122('0x52')](_0x4122('0x72'))){_0x58fe14['limit']=qs[_0x4122('0x24')](_0x13fad9[_0x4122('0x4b')][_0x4122('0x24')]);_0x58fe14[_0x4122('0x23')]=qs[_0x4122('0x23')](_0x13fad9[_0x4122('0x4b')][_0x4122('0x23')]);}return _0x29b38e[_0x4122('0x134')](_0x58fe14);}})['then'](function(_0x30e0b0){if(_0x30e0b0){return _0x30e0b0?{'count':_0x33225f,'rows':_0x30e0b0}:null;}})[_0x4122('0x15')](respondWithResult(_0x1d666e,null))['catch'](handleError(_0x1d666e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9ab3906..5404aa0 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 _0x50a6=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x593351,_0x23c222){var _0x3bb878=function(_0x5cf063){while(--_0x5cf063){_0x593351['push'](_0x593351['shift']());}};_0x3bb878(++_0x23c222);}(_0x50a6,0xa4));var _0x650a=function(_0x131eb1,_0x55b270){_0x131eb1=_0x131eb1-0x0;var _0x3a3b7a=_0x50a6[_0x131eb1];return _0x3a3b7a;};'use strict';var EventEmitter=require(_0x650a('0x0'));var ChatWebsite=require(_0x650a('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x650a('0x2'),'afterUpdate':'update','afterDestroy':_0x650a('0x3')};function emitEvent(_0x15dd02){return function(_0x2c71ba,_0x4a0147,_0xa3311){ChatWebsiteEvents['emit'](_0x15dd02+':'+_0x2c71ba['id'],_0x2c71ba);ChatWebsiteEvents['emit'](_0x15dd02,_0x2c71ba);_0xa3311(null);};}for(var e in events){if(events[_0x650a('0x4')](e)){var event=events[e];ChatWebsite[_0x650a('0x5')](e,emitEvent(event));}}module[_0x650a('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6c96=['exports','events','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c96,0x1c1));var _0x66c9=function(_0x5ab2e6,_0x150c3a){_0x5ab2e6=_0x5ab2e6-0x0;var _0x329b44=_0x6c96[_0x5ab2e6];return _0x329b44;};'use strict';var EventEmitter=require(_0x66c9('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x66c9('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x66c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x66c9('0x3'),'afterDestroy':_0x66c9('0x4')};function emitEvent(_0x3c2e67){return function(_0x37e814,_0x35b830,_0x15aaa6){ChatWebsiteEvents[_0x66c9('0x5')](_0x3c2e67+':'+_0x37e814['id'],_0x37e814);ChatWebsiteEvents['emit'](_0x3c2e67,_0x37e814);_0x15aaa6(null);};}for(var e in events){if(events[_0x66c9('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x66c9('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 802ad08..d83f80b 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 _0x091e=['./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x48f1f2,_0x108484){var _0x3737e8=function(_0x1fb48e){while(--_0x1fb48e){_0x48f1f2['push'](_0x48f1f2['shift']());}};_0x3737e8(++_0x108484);}(_0x091e,0x190));var _0xe091=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x091e[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xe091('0x0'));var util=require(_0xe091('0x1'));var logger=require(_0xe091('0x2'))(_0xe091('0x3'));var moment=require(_0xe091('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe091('0x5'));var config=require(_0xe091('0x6'));var attributes=require(_0xe091('0x7'));module[_0xe091('0x8')]=function(_0x4f18e1,_0x23fbd3){return _0x4f18e1['define'](_0xe091('0x9'),attributes,{'tableName':_0xe091('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf668=['util','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf668,0x1b7));var _0x8f66=function(_0x4f73f5,_0x13bb5e){_0x4f73f5=_0x4f73f5-0x0;var _0x5f3974=_0xf668[_0x4f73f5];return _0x5f3974;};'use strict';var _=require(_0x8f66('0x0'));var util=require(_0x8f66('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8f66('0x2'));var rp=require(_0x8f66('0x3'));var fs=require('fs');var path=require(_0x8f66('0x4'));var rimraf=require('rimraf');var config=require(_0x8f66('0x5'));var attributes=require(_0x8f66('0x6'));module[_0x8f66('0x7')]=function(_0x5053cf,_0x332073){return _0x5053cf[_0x8f66('0x8')](_0x8f66('0x9'),attributes,{'tableName':_0x8f66('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 a78d4e2..2980b7b 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 _0xf6fc=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then'];(function(_0x47cc86,_0x2b31cf){var _0x27f733=function(_0x2bdeaf){while(--_0x2bdeaf){_0x47cc86['push'](_0x47cc86['shift']());}};_0x27f733(++_0x2b31cf);}(_0xf6fc,0x10f));var _0xcf6f=function(_0x587e16,_0x434bb2){_0x587e16=_0x587e16-0x0;var _0x18d56c=_0xf6fc[_0x587e16];return _0x18d56c;};'use strict';var _=require(_0xcf6f('0x0'));var util=require(_0xcf6f('0x1'));var moment=require(_0xcf6f('0x2'));var BPromise=require(_0xcf6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf6f('0x4'));var logger=require('../../config/logger')(_0xcf6f('0x5'));var config=require(_0xcf6f('0x6'));var jayson=require(_0xcf6f('0x7'));var client=jayson['client'][_0xcf6f('0x8')]({'port':0x232a});config['redis']=_[_0xcf6f('0x9')](config[_0xcf6f('0xa')],{'host':_0xcf6f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf6f('0xa')]));require('./chatWebsite.socket')[_0xcf6f('0xc')](socket);function respondWithRpcPromise(_0x1f892c,_0x54216a,_0x504195){return new BPromise(function(_0x4de57e,_0x58a194){return client[_0xcf6f('0xd')](_0x1f892c,_0x504195)[_0xcf6f('0xe')](function(_0x3d3e87){logger[_0xcf6f('0xf')](_0xcf6f('0x10'),_0x54216a,_0xcf6f('0x11'));logger[_0xcf6f('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x54216a,_0xcf6f('0x11'),JSON['stringify'](_0x3d3e87));if(_0x3d3e87[_0xcf6f('0x13')]){if(_0x3d3e87[_0xcf6f('0x13')]['code']===0x1f4){logger[_0xcf6f('0x13')](_0xcf6f('0x10'),_0x54216a,_0x3d3e87[_0xcf6f('0x13')][_0xcf6f('0x14')]);return _0x58a194(_0x3d3e87['error'][_0xcf6f('0x14')]);}logger[_0xcf6f('0x13')](_0xcf6f('0x10'),_0x54216a,_0x3d3e87[_0xcf6f('0x13')][_0xcf6f('0x14')]);return _0x4de57e(_0x3d3e87['error']['message']);}else{logger[_0xcf6f('0xf')](_0xcf6f('0x10'),_0x54216a,_0xcf6f('0x11'));_0x4de57e(_0x3d3e87[_0xcf6f('0x15')][_0xcf6f('0x14')]);}})['catch'](function(_0x54edaa){logger['error'](_0xcf6f('0x10'),_0x54216a,_0x54edaa);_0x58a194(_0x54edaa);});});} \ No newline at end of file +var _0x24c6=['then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register','request'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x24c6,0xa6));var _0x624c=function(_0x159259,_0x5d97a8){_0x159259=_0x159259-0x0;var _0x5e01cd=_0x24c6[_0x159259];return _0x5e01cd;};'use strict';var _=require(_0x624c('0x0'));var util=require(_0x624c('0x1'));var moment=require(_0x624c('0x2'));var BPromise=require(_0x624c('0x3'));var rs=require(_0x624c('0x4'));var fs=require('fs');var Redis=require(_0x624c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x624c('0x6'))(_0x624c('0x7'));var config=require(_0x624c('0x8'));var jayson=require(_0x624c('0x9'));var client=jayson[_0x624c('0xa')][_0x624c('0xb')]({'port':0x232a});config[_0x624c('0xc')]=_['defaults'](config[_0x624c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x624c('0xc')]));require(_0x624c('0xd'))[_0x624c('0xe')](socket);function respondWithRpcPromise(_0x28b2c2,_0x4b7206,_0x14e6bb){return new BPromise(function(_0x34f426,_0x31b5bc){return client[_0x624c('0xf')](_0x28b2c2,_0x14e6bb)[_0x624c('0x10')](function(_0x150022){logger[_0x624c('0x11')](_0x624c('0x12'),_0x4b7206,'request\x20sent');logger[_0x624c('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4b7206,_0x624c('0x14'),JSON[_0x624c('0x15')](_0x150022));if(_0x150022[_0x624c('0x16')]){if(_0x150022[_0x624c('0x16')][_0x624c('0x17')]===0x1f4){logger['error'](_0x624c('0x12'),_0x4b7206,_0x150022['error'][_0x624c('0x18')]);return _0x31b5bc(_0x150022[_0x624c('0x16')][_0x624c('0x18')]);}logger[_0x624c('0x16')](_0x624c('0x12'),_0x4b7206,_0x150022[_0x624c('0x16')]['message']);return _0x34f426(_0x150022[_0x624c('0x16')][_0x624c('0x18')]);}else{logger[_0x624c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4b7206,_0x624c('0x14'));_0x34f426(_0x150022['result'][_0x624c('0x18')]);}})[_0x624c('0x19')](function(_0x545018){logger['error'](_0x624c('0x12'),_0x4b7206,_0x545018);_0x31b5bc(_0x545018);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 79a57ee..3f6d405 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 _0x8280=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x2dfe1c,_0x52165a){var _0x251ca2=function(_0x5ba9ec){while(--_0x5ba9ec){_0x2dfe1c['push'](_0x2dfe1c['shift']());}};_0x251ca2(++_0x52165a);}(_0x8280,0x1ea));var _0x0828=function(_0x988118,_0x34b743){_0x988118=_0x988118-0x0;var _0x48d871=_0x8280[_0x988118];return _0x48d871;};'use strict';var ChatWebsiteEvents=require(_0x0828('0x0'));var events=[_0x0828('0x1'),_0x0828('0x2'),_0x0828('0x3')];function createListener(_0x3410c6,_0x3a1547){return function(_0x5833ac){_0x3a1547[_0x0828('0x4')](_0x3410c6,_0x5833ac);};}function removeListener(_0x2fe2b4,_0x54b723){return function(){ChatWebsiteEvents[_0x0828('0x5')](_0x2fe2b4,_0x54b723);};}exports[_0x0828('0x6')]=function(_0x25e8b3){for(var _0x1931e1=0x0,_0x3b3fb1=events[_0x0828('0x7')];_0x1931e1<_0x3b3fb1;_0x1931e1++){var _0x42a993=events[_0x1931e1];var _0x4bd730=createListener(_0x0828('0x8')+_0x42a993,_0x25e8b3);ChatWebsiteEvents['on'](_0x42a993,_0x4bd730);}}; \ No newline at end of file +var _0x0ff2=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x17ead7,_0x2e8a8a){var _0x44990d=function(_0x52214e){while(--_0x52214e){_0x17ead7['push'](_0x17ead7['shift']());}};_0x44990d(++_0x2e8a8a);}(_0x0ff2,0x137));var _0x20ff=function(_0x27d30a,_0x52eb35){_0x27d30a=_0x27d30a-0x0;var _0x3ee370=_0x0ff2[_0x27d30a];return _0x3ee370;};'use strict';var ChatWebsiteEvents=require(_0x20ff('0x0'));var events=['save',_0x20ff('0x1'),_0x20ff('0x2')];function createListener(_0x36df08,_0x5be3b3){return function(_0x33d52b){_0x5be3b3[_0x20ff('0x3')](_0x36df08,_0x33d52b);};}function removeListener(_0x2321ea,_0x1a0a17){return function(){ChatWebsiteEvents[_0x20ff('0x4')](_0x2321ea,_0x1a0a17);};}exports[_0x20ff('0x5')]=function(_0x450e3e){for(var _0x12346c=0x0,_0x17adaa=events[_0x20ff('0x6')];_0x12346c<_0x17adaa;_0x12346c++){var _0xb1fc09=events[_0x12346c];var _0x42edb6=createListener(_0x20ff('0x7')+_0xb1fc09,_0x450e3e);ChatWebsiteEvents['on'](_0xb1fc09,_0x42edb6);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index dac0fcc..9820ddc 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 _0xceda=['offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','update','destroy','removeDispositions','delete','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','addAvatar','server/files/images/avatars/','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any'];(function(_0x2357c5,_0x39950d){var _0x5bd44c=function(_0x138cb1){while(--_0x138cb1){_0x2357c5['push'](_0x2357c5['shift']());}};_0x5bd44c(++_0x39950d);}(_0xceda,0x1b5));var _0xaced=function(_0x4670cf,_0xc8d12b){_0x4670cf=_0x4670cf-0x0;var _0x234fe9=_0xceda[_0x4670cf];return _0x234fe9;};'use strict';var multer=require(_0xaced('0x0'));var util=require('util');var path=require(_0xaced('0x1'));var timeout=require(_0xaced('0x2'));var express=require(_0xaced('0x3'));var router=express[_0xaced('0x4')]();var fs_extra=require(_0xaced('0x5'));var auth=require(_0xaced('0x6'));var interaction=require(_0xaced('0x7'));var config=require('../../config/environment');var controller=require(_0xaced('0x8'));router[_0xaced('0x9')]('/',auth[_0xaced('0xa')](),controller[_0xaced('0xb')]);router[_0xaced('0x9')]('/describe',auth[_0xaced('0xa')](),controller['describe']);router[_0xaced('0x9')](_0xaced('0xc'),auth[_0xaced('0xa')](),controller[_0xaced('0xd')]);router['get']('/:id/dispositions',auth[_0xaced('0xa')](),controller[_0xaced('0xe')]);router['get'](_0xaced('0xf'),auth[_0xaced('0xa')](),controller[_0xaced('0x10')]);router['get']('/:id/logo',controller[_0xaced('0x11')]);router['get'](_0xaced('0x12'),controller[_0xaced('0x13')]);router['get'](_0xaced('0x14'),controller['getCustomerAvatar']);router[_0xaced('0x9')](_0xaced('0x15'),controller['getSystemAvatar']);router[_0xaced('0x9')](_0xaced('0x16'),auth[_0xaced('0xa')](),controller['getInteractions']);router['get'](_0xaced('0x17'),controller['getSnippet']);router[_0xaced('0x9')](_0xaced('0x18'),auth['isAuthenticated'](),controller[_0xaced('0x19')]);router[_0xaced('0x9')]('/:id/proactive_actions',auth[_0xaced('0xa')](),controller[_0xaced('0x1a')]);router['get'](_0xaced('0x1b'),controller[_0xaced('0x1c')]);router[_0xaced('0x9')](_0xaced('0x1d'),auth[_0xaced('0xa')](),controller[_0xaced('0x1e')]);router[_0xaced('0x9')](_0xaced('0x1f'),auth[_0xaced('0xa')](),controller[_0xaced('0x20')]);router[_0xaced('0x21')]('/',auth[_0xaced('0xa')](),controller[_0xaced('0x22')]);router[_0xaced('0x21')](_0xaced('0x23'),auth['isAuthenticated'](),controller[_0xaced('0x24')]);router['post'](_0xaced('0xf'),auth[_0xaced('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xaced('0x25')]({'destination':function(_0x58e045,_0x5aba11,_0x4bf55f){_0x4bf55f(null,path[_0xaced('0x26')](config[_0xaced('0x27')],_0xaced('0x28')));},'filename':function(_0x908a37,_0x2c94cf,_0x9ccca4){_0x9ccca4(null,util[_0xaced('0x29')](_0xaced('0x2a'),Date[_0xaced('0x2b')](),_0x2c94cf[_0xaced('0x2c')]));}})});router[_0xaced('0x21')](_0xaced('0x2d'),upload[_0xaced('0x2e')](_0xaced('0x2f')),controller[_0xaced('0x30')]);var upload=multer({'storage':multer[_0xaced('0x25')]({'destination':function(_0x43669a,_0x4ada3e,_0x128b57){_0x128b57(null,path[_0xaced('0x26')](config[_0xaced('0x27')],'server/files/images/avatars/'));},'filename':function(_0x188650,_0x154077,_0x51bd7b){_0x51bd7b(null,util[_0xaced('0x29')]('%s-%s',Date[_0xaced('0x2b')](),_0x154077[_0xaced('0x2c')]));}})});router[_0xaced('0x21')](_0xaced('0x12'),upload[_0xaced('0x2e')](_0xaced('0x2f')),controller[_0xaced('0x31')]);var upload=multer({'storage':multer[_0xaced('0x25')]({'destination':function(_0x1108a1,_0x3a437c,_0x5cb14a){_0x5cb14a(null,path['join'](config[_0xaced('0x27')],_0xaced('0x32')));},'filename':function(_0x4ab4e7,_0x92d7ec,_0x2847cb){_0x2847cb(null,util[_0xaced('0x29')]('%s-%s',Date['now'](),_0x92d7ec[_0xaced('0x2c')]));}})});router[_0xaced('0x21')](_0xaced('0x14'),upload[_0xaced('0x2e')](_0xaced('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xaced('0x25')]({'destination':function(_0x4a2633,_0x7bcbb4,_0x539a92){_0x539a92(null,path[_0xaced('0x26')](config[_0xaced('0x27')],_0xaced('0x32')));},'filename':function(_0x4ccf61,_0x3dfe3d,_0x58ef31){_0x58ef31(null,util[_0xaced('0x29')]('%s-%s',Date[_0xaced('0x2b')](),_0x3dfe3d[_0xaced('0x2c')]));}})});router[_0xaced('0x21')]('/:id/system_avatar',upload['single'](_0xaced('0x2f')),controller['addSystemAvatar']);router[_0xaced('0x21')](_0xaced('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xaced('0x25')]({'destination':function(_0x238e36,_0x16e05c,_0x5d5304){const _0x540adc=path[_0xaced('0x26')](config['root'],_0xaced('0x34'),_0xaced('0x35'),_0xaced('0x36'));fs_extra[_0xaced('0x37')](_0x540adc,function(){_0x5d5304(null,_0x540adc);});},'filename':function(_0x450975,_0x54ab77,_0x3dfa98){const _0x5d086a=_0x54ab77[_0xaced('0x2c')][_0xaced('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x26306c=path[_0xaced('0x39')](_0x5d086a);const _0x3184d2=Date['now']()+'-'+_0x5d086a[_0xaced('0x38')](_0x26306c,'')+_0x26306c;_0x3dfa98(null,_0x3184d2);}})});router[_0xaced('0x21')](_0xaced('0x3a'),offlineUploadMulter[_0xaced('0x3b')](),controller[_0xaced('0x3c')]);router['post'](_0xaced('0x16'),auth[_0xaced('0xa')](),controller[_0xaced('0x3d')]);router[_0xaced('0x21')](_0xaced('0x18'),auth[_0xaced('0xa')](),controller[_0xaced('0x3e')]);router[_0xaced('0x21')](_0xaced('0x3f'),auth[_0xaced('0xa')](),controller[_0xaced('0x40')]);router['post']('/:id/users',auth[_0xaced('0xa')](),controller[_0xaced('0x41')]);router['put']('/:id',auth[_0xaced('0xa')](),controller[_0xaced('0x42')]);router['delete'](_0xaced('0xc'),auth[_0xaced('0xa')](),controller[_0xaced('0x43')]);router['delete'](_0xaced('0x23'),auth[_0xaced('0xa')](),controller[_0xaced('0x44')]);router[_0xaced('0x45')](_0xaced('0xf'),auth['isAuthenticated'](),controller[_0xaced('0x46')]);router[_0xaced('0x45')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xab0f=['update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','create','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','/:id/logo','single','server/files/images/avatars/','originalname','file','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','replace','extname','/:id/offline','any','offline','addApplications','/:id/users','addAgents'];(function(_0x4ec945,_0xe9fb7f){var _0x4eb0be=function(_0x4738a9){while(--_0x4738a9){_0x4ec945['push'](_0x4ec945['shift']());}};_0x4eb0be(++_0xe9fb7f);}(_0xab0f,0x118));var _0xfab0=function(_0x3e7346,_0x4f4f45){_0x3e7346=_0x3e7346-0x0;var _0x16bec5=_0xab0f[_0x3e7346];return _0x16bec5;};'use strict';var multer=require(_0xfab0('0x0'));var util=require(_0xfab0('0x1'));var path=require('path');var timeout=require(_0xfab0('0x2'));var express=require('express');var router=express[_0xfab0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfab0('0x4'));var config=require('../../config/environment');var controller=require(_0xfab0('0x5'));router[_0xfab0('0x6')]('/',auth[_0xfab0('0x7')](),controller[_0xfab0('0x8')]);router[_0xfab0('0x6')](_0xfab0('0x9'),auth['isAuthenticated'](),controller[_0xfab0('0xa')]);router[_0xfab0('0x6')](_0xfab0('0xb'),auth[_0xfab0('0x7')](),controller['show']);router[_0xfab0('0x6')]('/:id/dispositions',auth[_0xfab0('0x7')](),controller[_0xfab0('0xc')]);router[_0xfab0('0x6')](_0xfab0('0xd'),auth[_0xfab0('0x7')](),controller[_0xfab0('0xe')]);router['get']('/:id/logo',controller[_0xfab0('0xf')]);router[_0xfab0('0x6')](_0xfab0('0x10'),controller[_0xfab0('0x11')]);router[_0xfab0('0x6')]('/:id/customer_avatar',controller[_0xfab0('0x12')]);router['get'](_0xfab0('0x13'),controller[_0xfab0('0x14')]);router[_0xfab0('0x6')](_0xfab0('0x15'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x16')]);router['get'](_0xfab0('0x17'),controller['getSnippet']);router[_0xfab0('0x6')](_0xfab0('0x18'),auth['isAuthenticated'](),controller[_0xfab0('0x19')]);router['get'](_0xfab0('0x1a'),auth['isAuthenticated'](),controller[_0xfab0('0x1b')]);router[_0xfab0('0x6')](_0xfab0('0x1c'),controller['getFields']);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xfab0('0x1d')]);router['get']('/:id/users',auth[_0xfab0('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xfab0('0x1e')]);router[_0xfab0('0x1f')]('/:id/dispositions',auth[_0xfab0('0x7')](),controller['addDisposition']);router[_0xfab0('0x1f')]('/:id/canned_answers',auth[_0xfab0('0x7')](),controller[_0xfab0('0x20')]);var upload=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0xe85233,_0x49dae8,_0x21b330){_0x21b330(null,path[_0xfab0('0x22')](config[_0xfab0('0x23')],_0xfab0('0x24')));},'filename':function(_0x2744cc,_0x55988d,_0x32d3dc){_0x32d3dc(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x55988d['originalname']));}})});router[_0xfab0('0x1f')](_0xfab0('0x28'),upload[_0xfab0('0x29')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0x15ad99,_0x39b226,_0x377387){_0x377387(null,path[_0xfab0('0x22')](config[_0xfab0('0x23')],_0xfab0('0x2a')));},'filename':function(_0x154005,_0x6fea44,_0x473ef7){_0x473ef7(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x6fea44[_0xfab0('0x2b')]));}})});router[_0xfab0('0x1f')](_0xfab0('0x10'),upload[_0xfab0('0x29')](_0xfab0('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0x397efb,_0x166ce2,_0x49e025){_0x49e025(null,path['join'](config[_0xfab0('0x23')],_0xfab0('0x2a')));},'filename':function(_0x4cad54,_0x5260d4,_0x148863){_0x148863(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x5260d4[_0xfab0('0x2b')]));}})});router['post'](_0xfab0('0x2d'),upload[_0xfab0('0x29')](_0xfab0('0x2c')),controller[_0xfab0('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x361d80,_0x4c76ed,_0x31c351){_0x31c351(null,path[_0xfab0('0x22')](config['root'],_0xfab0('0x2a')));},'filename':function(_0x1a4688,_0x2dc0db,_0x525eba){_0x525eba(null,util[_0xfab0('0x25')](_0xfab0('0x26'),Date[_0xfab0('0x27')](),_0x2dc0db[_0xfab0('0x2b')]));}})});router[_0xfab0('0x1f')](_0xfab0('0x13'),upload[_0xfab0('0x29')](_0xfab0('0x2c')),controller[_0xfab0('0x2f')]);router[_0xfab0('0x1f')](_0xfab0('0x30'),controller[_0xfab0('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xfab0('0x21')]({'destination':function(_0x57f7f1,_0x258e12,_0xd5c598){const _0x7a0359=path[_0xfab0('0x22')](config['root'],_0xfab0('0x32'),_0xfab0('0x33'),'offline-chat');fs_extra['ensureDir'](_0x7a0359,function(){_0xd5c598(null,_0x7a0359);});},'filename':function(_0x41501f,_0x203262,_0x1b0cbd){const _0xe7084a=_0x203262[_0xfab0('0x2b')][_0xfab0('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x52e06a=path[_0xfab0('0x35')](_0xe7084a);const _0x14b508=Date[_0xfab0('0x27')]()+'-'+_0xe7084a[_0xfab0('0x34')](_0x52e06a,'')+_0x52e06a;_0x1b0cbd(null,_0x14b508);}})});router[_0xfab0('0x1f')](_0xfab0('0x36'),offlineUploadMulter[_0xfab0('0x37')](),controller[_0xfab0('0x38')]);router[_0xfab0('0x1f')](_0xfab0('0x15'),auth[_0xfab0('0x7')](),controller['addInteraction']);router[_0xfab0('0x1f')](_0xfab0('0x18'),auth['isAuthenticated'](),controller[_0xfab0('0x39')]);router[_0xfab0('0x1f')](_0xfab0('0x1a'),auth[_0xfab0('0x7')](),controller['addProactiveActions']);router[_0xfab0('0x1f')](_0xfab0('0x3a'),auth['isAuthenticated'](),controller[_0xfab0('0x3b')]);router['put'](_0xfab0('0xb'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x3c')]);router[_0xfab0('0x3d')](_0xfab0('0xb'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x3e')]);router['delete'](_0xfab0('0x3f'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x40')]);router[_0xfab0('0x3d')](_0xfab0('0xd'),auth[_0xfab0('0x7')](),controller[_0xfab0('0x41')]);router[_0xfab0('0x3d')](_0xfab0('0x3a'),auth['isAuthenticated'](),controller[_0xfab0('0x42')]);module[_0xfab0('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index ff0b1fe..f003a18 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c46=['app','get','client-side-logger','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','express','Router','env','production'];(function(_0x435a9f,_0x29c0d1){var _0x34cd48=function(_0x3886a4){while(--_0x3886a4){_0x435a9f['push'](_0x435a9f['shift']());}};_0x34cd48(++_0x29c0d1);}(_0x9c46,0x19f));var _0x69c4=function(_0x503061,_0x2ec426){_0x503061=_0x503061-0x0;var _0x386ebc=_0x9c46[_0x503061];return _0x386ebc;};var beaverLogger=require(_0x69c4('0x0'));var express=require(_0x69c4('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x69c4('0x2')]();var isProduction=config[_0x69c4('0x3')]===_0x69c4('0x4')||![];function clientSideLogs(_0x5393fa,_0x1aac4f,_0x5316da){var _0x1d0b9b=_0x5393fa[_0x69c4('0x5')][_0x69c4('0x6')](_0x69c4('0x7'));if(!_0x1d0b9b){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x69c4('0x8')]({'uri':_0x69c4('0x9'),'logger':_0x1d0b9b,'enableCors':!isProduction})(_0x5393fa,_0x1aac4f,_0x5316da);}router['use'](auth[_0x69c4('0xa')](),clientSideLogs);module[_0x69c4('0xb')]=router; \ No newline at end of file +var _0xf550=['expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x14767e,_0x33a047){var _0x2abce9=function(_0x5527b4){while(--_0x5527b4){_0x14767e['push'](_0x14767e['shift']());}};_0x2abce9(++_0x33a047);}(_0xf550,0x1d9));var _0x0f55=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0xf550[_0x53f402];return _0x45a76d;};var beaverLogger=require(_0x0f55('0x0'));var express=require(_0x0f55('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x0f55('0x2')]();var isProduction=config[_0x0f55('0x3')]===_0x0f55('0x4')||![];function clientSideLogs(_0x5e59ac,_0x44e3bc,_0x24f0ac){var _0x3c3e52=_0x5e59ac[_0x0f55('0x5')]['get'](_0x0f55('0x6'));if(!_0x3c3e52){throw new Error(_0x0f55('0x7'));}return beaverLogger[_0x0f55('0x8')]({'uri':_0x0f55('0x9'),'logger':_0x3c3e52,'enableCors':!isProduction})(_0x5e59ac,_0x44e3bc,_0x24f0ac);}router[_0x0f55('0xa')](auth[_0x0f55('0xb')](),clientSideLogs);module[_0x0f55('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 448c92c..e1288ca 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 _0xc417=['TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','AmazonAWS','Google','Outlook365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token'];(function(_0x5d62f2,_0x17511a){var _0x9a497=function(_0x551be1){while(--_0x551be1){_0x5d62f2['push'](_0x5d62f2['shift']());}};_0x9a497(++_0x17511a);}(_0xc417,0xea));var _0x7c41=function(_0x4b104a,_0x53fd06){_0x4b104a=_0x4b104a-0x0;var _0x5e486c=_0xc417[_0x4b104a];return _0x5e486c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x7c41('0x0'),_0x7c41('0x1'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7c41('0x2'),'Dynamics365')},'data1':{'type':Sequelize[_0x7c41('0x3')],'comment':_0x7c41('0x4')},'data2':{'type':Sequelize[_0x7c41('0x3')],'comment':_0x7c41('0x5')},'data3':{'type':Sequelize[_0x7c41('0x3')],'comment':_0x7c41('0x6')},'data4':{'type':Sequelize[_0x7c41('0x3')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x7c41('0x7')},'data6':{'type':Sequelize[_0x7c41('0x8')],'comment':_0x7c41('0x9')},'data7':{'type':Sequelize['TEXT'],'comment':_0x7c41('0xa')}}; \ No newline at end of file +var _0xaa04=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING'];(function(_0x571fdd,_0x2bc60a){var _0x4f92e7=function(_0x1b7f3b){while(--_0x1b7f3b){_0x571fdd['push'](_0x571fdd['shift']());}};_0x4f92e7(++_0x2bc60a);}(_0xaa04,0x118));var _0x4aa0=function(_0x476dd4,_0x1a59cb){_0x476dd4=_0x476dd4-0x0;var _0x801ef2=_0xaa04[_0x476dd4];return _0x801ef2;};'use strict';var Sequelize=require('sequelize');module[_0x4aa0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4aa0('0x1')](_0x4aa0('0x2'),_0x4aa0('0x3'),_0x4aa0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4aa0('0x1')]('Outlook365',_0x4aa0('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x4aa0('0x6')},'data2':{'type':Sequelize[_0x4aa0('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x4aa0('0x8')},'data4':{'type':Sequelize[_0x4aa0('0x7')],'comment':_0x4aa0('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x4aa0('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x4aa0('0xa')],'comment':_0x4aa0('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0785ea4..c3323da 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 _0x1c2e=['../../components/encryptor','../../config/environment','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','status','end','json','offset','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','create','find','oauth2MicrosoftAuthorize','findOne','user','get','state','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','ioredis'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x1c2e,0x15f));var _0xe1c2=function(_0x24318c,_0x11ec34){_0x24318c=_0x24318c-0x0;var _0x540315=_0x1c2e[_0x24318c];return _0x540315;};'use strict';var _=require('lodash');var Redis=require(_0xe1c2('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xe1c2('0x1'));var config=require(_0xe1c2('0x2'));var logger=require('../../config/logger')('api');var db=require(_0xe1c2('0x3'))['db'];var oauth=require(_0xe1c2('0x4'));config['redis']=_[_0xe1c2('0x5')](config[_0xe1c2('0x6')],{'host':_0xe1c2('0x7'),'port':0x18eb});var socket=require(_0xe1c2('0x8'))(new Redis(config[_0xe1c2('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x2dd30c,_0x407299){_0x407299=_0x407299||0xcc;return function(_0x2316ed){if(_0x2316ed){return _0x2dd30c['sendStatus'](_0x407299);}return _0x2dd30c[_0xe1c2('0x9')](_0x407299)[_0xe1c2('0xa')]();};}function respondWithResult(_0x5ec26a,_0x5b7209){_0x5b7209=_0x5b7209||0xc8;return function(_0x42674b){if(_0x42674b){return _0x5ec26a['status'](_0x5b7209)[_0xe1c2('0xb')](_0x42674b);}};}function respondWithFilteredResult(_0x4075ba,_0x4b2dac){return function(_0x2eef57){if(_0x2eef57){var _0x305281=typeof _0x4b2dac[_0xe1c2('0xc')]==='undefined'&&typeof _0x4b2dac[_0xe1c2('0xd')]==='undefined';var _0x3d879e=_0x2eef57[_0xe1c2('0xe')];var _0x4559a2=_0x305281?0x0:_0x4b2dac['offset'];var _0x185a4b=_0x305281?_0x2eef57[_0xe1c2('0xe')]:_0x4b2dac[_0xe1c2('0xc')]+_0x4b2dac[_0xe1c2('0xd')];var _0x52157c;if(_0x185a4b>=_0x3d879e){_0x185a4b=_0x3d879e;_0x52157c=0xc8;}else{_0x52157c=0xce;}_0x4075ba[_0xe1c2('0x9')](_0x52157c);return _0x4075ba['set'](_0xe1c2('0xf'),_0x4559a2+'-'+_0x185a4b+'/'+_0x3d879e)[_0xe1c2('0xb')](_0x2eef57);}return null;};}function saveUpdates(_0xb7b966){return function(_0x73dab2){if(_0x73dab2){return _0x73dab2[_0xe1c2('0x10')](_0xb7b966)[_0xe1c2('0x11')](function(_0x32c6bb){return _0x32c6bb;});}return null;};}function removeEntity(_0x30932f){return function(_0x171ff6){if(_0x171ff6){return _0x171ff6[_0xe1c2('0x12')]()[_0xe1c2('0x11')](function(){_0x30932f[_0xe1c2('0x9')](0xcc)[_0xe1c2('0xa')]();});}};}function handleEntityNotFound(_0x1a7928){return function(_0x2f722c){if(!_0x2f722c){_0x1a7928[_0xe1c2('0x13')](0x194);}return _0x2f722c;};}function handleError(_0x3e50c3,_0x1f14f4){_0x1f14f4=_0x1f14f4||0x1f4;return function(_0xe2db85){logger[_0xe1c2('0x14')](_0xe2db85[_0xe1c2('0x15')]);if(_0xe2db85[_0xe1c2('0x16')]){delete _0xe2db85[_0xe1c2('0x16')];}_0x3e50c3[_0xe1c2('0x9')](_0x1f14f4)['send'](_0xe2db85);};}function maskClientSecret(_0x58d996){return _[_0xe1c2('0x17')](_0x58d996[_0xe1c2('0x18')](0x0,0x3),0x14,'*');}exports[_0xe1c2('0x19')]=function(_0x21a3eb,_0x906464){var _0x51868e={},_0x507091={},_0x5c9c55={'count':0x0,'rows':[]};var _0x140ea8=_['map'](db[_0xe1c2('0x1a')][_0xe1c2('0x1b')],function(_0x384d06){return{'name':_0x384d06[_0xe1c2('0x1c')],'type':_0x384d06[_0xe1c2('0x1d')]['key']};});_0x507091[_0xe1c2('0x1e')]=_['map'](_0x140ea8,_0xe1c2('0x16'));_0x507091[_0xe1c2('0x1f')]=_[_0xe1c2('0x20')](_0x21a3eb['query']);_0x507091[_0xe1c2('0x21')]=_[_0xe1c2('0x22')](_0x507091[_0xe1c2('0x1e')],_0x507091[_0xe1c2('0x1f')]);_0x51868e['attributes']=_[_0xe1c2('0x22')](_0x507091[_0xe1c2('0x1e')],qs[_0xe1c2('0x23')](_0x21a3eb['query'][_0xe1c2('0x23')]));_0x51868e['attributes']=_0x51868e[_0xe1c2('0x24')][_0xe1c2('0x25')]?_0x51868e[_0xe1c2('0x24')]:_0x507091[_0xe1c2('0x1e')];if(!_0x21a3eb[_0xe1c2('0x1f')]['hasOwnProperty'](_0xe1c2('0x26'))){_0x51868e[_0xe1c2('0xd')]=qs[_0xe1c2('0xd')](_0x21a3eb[_0xe1c2('0x1f')][_0xe1c2('0xd')]);_0x51868e[_0xe1c2('0xc')]=qs[_0xe1c2('0xc')](_0x21a3eb['query'][_0xe1c2('0xc')]);}_0x51868e[_0xe1c2('0x27')]=qs['sort'](_0x21a3eb[_0xe1c2('0x1f')][_0xe1c2('0x28')]);_0x51868e[_0xe1c2('0x29')]=qs['filters'](_[_0xe1c2('0x2a')](_0x21a3eb[_0xe1c2('0x1f')],_0x507091[_0xe1c2('0x21')]),_0x140ea8);if(_0x21a3eb[_0xe1c2('0x1f')][_0xe1c2('0x2b')]){_0x51868e['where']=_[_0xe1c2('0x2c')](_0x51868e[_0xe1c2('0x29')],{'$or':_[_0xe1c2('0x2d')](_0x140ea8,function(_0x5142b0){if(_0x5142b0['type']!=='VIRTUAL'){var _0x132b65={};_0x132b65[_0x5142b0[_0xe1c2('0x16')]]={'$like':'%'+_0x21a3eb[_0xe1c2('0x1f')][_0xe1c2('0x2b')]+'%'};return _0x132b65;}})});}_0x51868e=_[_0xe1c2('0x2c')]({},_0x51868e,_0x21a3eb[_0xe1c2('0x2e')]);var _0x5ca94f={'where':_0x51868e[_0xe1c2('0x29')]};return db[_0xe1c2('0x1a')]['count'](_0x5ca94f)[_0xe1c2('0x11')](function(_0x19a78e){_0x5c9c55['count']=_0x19a78e;if(_0x21a3eb[_0xe1c2('0x1f')][_0xe1c2('0x2f')]){_0x51868e[_0xe1c2('0x30')]=[{'all':!![]}];}return db[_0xe1c2('0x1a')][_0xe1c2('0x31')](_0x51868e);})['then'](function(_0x2a62a5){_0x5c9c55[_0xe1c2('0x32')]=_[_0xe1c2('0x2d')](_0x2a62a5,function(_0x2ec065){if(_0x2ec065[_0xe1c2('0x33')]===_0xe1c2('0x34')){var _0x16f58f=encryptor[_0xe1c2('0x35')](_0x2ec065[_0xe1c2('0x36')]);_0x2ec065[_0xe1c2('0x36')]=maskClientSecret(_0x16f58f);}return _0x2ec065;});return _0x5c9c55;})['then'](respondWithFilteredResult(_0x906464,_0x51868e))[_0xe1c2('0x37')](handleError(_0x906464,null));};exports[_0xe1c2('0x38')]=function(_0x3e3be3,_0x5d5b1d){var _0x35a082={'raw':!![],'where':{'id':_0x3e3be3[_0xe1c2('0x39')]['id']}},_0x4668cf={};_0x4668cf[_0xe1c2('0x1e')]=_[_0xe1c2('0x20')](db[_0xe1c2('0x1a')][_0xe1c2('0x1b')]);_0x4668cf[_0xe1c2('0x1f')]=_[_0xe1c2('0x20')](_0x3e3be3[_0xe1c2('0x1f')]);_0x4668cf['filters']=_[_0xe1c2('0x22')](_0x4668cf[_0xe1c2('0x1e')],_0x4668cf[_0xe1c2('0x1f')]);_0x35a082[_0xe1c2('0x24')]=_['intersection'](_0x4668cf[_0xe1c2('0x1e')],qs['fields'](_0x3e3be3[_0xe1c2('0x1f')][_0xe1c2('0x23')]));_0x35a082[_0xe1c2('0x24')]=_0x35a082[_0xe1c2('0x24')][_0xe1c2('0x25')]?_0x35a082[_0xe1c2('0x24')]:_0x4668cf[_0xe1c2('0x1e')];if(_0x3e3be3[_0xe1c2('0x1f')][_0xe1c2('0x2f')]){_0x35a082[_0xe1c2('0x30')]=[{'all':!![]}];}_0x35a082=_[_0xe1c2('0x2c')]({},_0x35a082,_0x3e3be3[_0xe1c2('0x2e')]);return db[_0xe1c2('0x1a')]['find'](_0x35a082)[_0xe1c2('0x11')](handleEntityNotFound(_0x5d5b1d,null))[_0xe1c2('0x11')](function(_0x3a9b99){if(_0x3a9b99[_0xe1c2('0x33')]===_0xe1c2('0x34')){var _0x3003ee=encryptor[_0xe1c2('0x35')](_0x3a9b99['data3']);_0x3a9b99[_0xe1c2('0x36')]=maskClientSecret(_0x3003ee);}return _0x3a9b99;})[_0xe1c2('0x11')](respondWithResult(_0x5d5b1d,null))['catch'](handleError(_0x5d5b1d,null));};exports['create']=function(_0x2595ed,_0x2c34a7){if(!_0x2595ed[_0xe1c2('0x3a')][_0xe1c2('0x16')])throw new Error(_0xe1c2('0x3b'));if(!_0x2595ed[_0xe1c2('0x3a')][_0xe1c2('0x33')])throw new Error(_0xe1c2('0x3c'));var _0x2e2f99=db[_0xe1c2('0x1a')][_0xe1c2('0x1b')][_0xe1c2('0x33')]['values'];if(!_0x2e2f99[_0xe1c2('0x3d')](_0x2595ed[_0xe1c2('0x3a')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x2e2f99[_0xe1c2('0x3e')](',\x20'));if(_0x2595ed['body'][_0xe1c2('0x33')]==='MicrosoftAzure'&&_0x2595ed['body']['data3']){_0x2595ed[_0xe1c2('0x3a')][_0xe1c2('0x36')]=encryptor[_0xe1c2('0x3f')](_0x2595ed[_0xe1c2('0x3a')][_0xe1c2('0x36')]);}return db['CloudProvider'][_0xe1c2('0x40')](_0x2595ed['body'],{})[_0xe1c2('0x11')](respondWithResult(_0x2c34a7,0xc9))[_0xe1c2('0x37')](handleError(_0x2c34a7,null));};exports[_0xe1c2('0x10')]=function(_0x4fd15f,_0xf6d3b7){if(_0x4fd15f[_0xe1c2('0x3a')]['id']){delete _0x4fd15f[_0xe1c2('0x3a')]['id'];}return db['CloudProvider'][_0xe1c2('0x41')]({'where':{'id':_0x4fd15f[_0xe1c2('0x39')]['id']}})[_0xe1c2('0x11')](handleEntityNotFound(_0xf6d3b7,null))[_0xe1c2('0x11')](function(_0x4893fc){if(_0x4893fc['service']==='MicrosoftAzure'&&_0x4fd15f[_0xe1c2('0x3a')][_0xe1c2('0x36')]){_0x4fd15f[_0xe1c2('0x3a')][_0xe1c2('0x36')]=encryptor[_0xe1c2('0x3f')](_0x4fd15f[_0xe1c2('0x3a')][_0xe1c2('0x36')]);}return _0x4893fc;})[_0xe1c2('0x11')](saveUpdates(_0x4fd15f[_0xe1c2('0x3a')],null))['then'](respondWithResult(_0xf6d3b7,null))[_0xe1c2('0x37')](handleError(_0xf6d3b7,null));};exports[_0xe1c2('0x12')]=function(_0x2a3cf6,_0x5ed654){return db[_0xe1c2('0x1a')][_0xe1c2('0x41')]({'where':{'id':_0x2a3cf6[_0xe1c2('0x39')]['id']}})[_0xe1c2('0x11')](handleEntityNotFound(_0x5ed654,null))[_0xe1c2('0x11')](removeEntity(_0x5ed654,null))[_0xe1c2('0x37')](handleError(_0x5ed654,null));};exports[_0xe1c2('0x42')]=function(_0x4c330e,_0x889157){return db['CloudProvider'][_0xe1c2('0x43')]({'where':{'id':_0x4c330e[_0xe1c2('0x39')]['id']},'raw':!![]})[_0xe1c2('0x11')](function(_0x3b19ec){if(!_0x3b19ec)return _0x889157[_0xe1c2('0x13')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3b19ec,_0x4c330e[_0xe1c2('0x44')]['id'])};})['then'](respondWithResult(_0x889157,null))['catch'](handleError(_0x889157,null));};exports['oauth2MicrosoftCallback']=function(_0x482140,_0xfea8d5){var _0x39319d=_0x482140['body'];var _0x11c0c6;var _0x7bfefa;if(_0x39319d[_0xe1c2('0x14')])throw _0x39319d;redis[_0xe1c2('0x45')](_0x39319d[_0xe1c2('0x46')])[_0xe1c2('0x11')](function(_0x2eca90){if(!_0x2eca90)throw new Error('Invalid\x20state\x20parameter');_0x11c0c6=JSON['parse'](_0x2eca90);var _0x41be2d=Buffer[_0xe1c2('0x47')](_0x39319d[_0xe1c2('0x46')],'base64')[_0xe1c2('0x48')](_0xe1c2('0x49'));_0x7bfefa=JSON['parse'](_0x41be2d);if(!oauth[_0xe1c2('0x4a')](_0x39319d[_0xe1c2('0x4b')],_0x11c0c6[_0xe1c2('0x4c')]))throw new Error(_0xe1c2('0x4d'));redis[_0xe1c2('0x4e')](_0x39319d[_0xe1c2('0x46')]);return oauth['getOauth2MicrosoftAccessToken'](_0x39319d[_0xe1c2('0x4f')],_0x11c0c6);})[_0xe1c2('0x11')](function(_0x28c8a0){_0x11c0c6[_0xe1c2('0x50')]=_0x28c8a0['access_token'];_0x11c0c6[_0xe1c2('0x51')]=_0x28c8a0[_0xe1c2('0x52')];return db['CloudProvider'][_0xe1c2('0x10')]({'data5':_0x11c0c6[_0xe1c2('0x50')],'data6':_0x11c0c6[_0xe1c2('0x51')]},{'where':{'id':_0x11c0c6['id']}});})[_0xe1c2('0x11')](function(){oauth[_0xe1c2('0x53')](_0x11c0c6);socket['emit']('microsoftAuthorization:success',{'id':_0x7bfefa['id']});return;})[_0xe1c2('0x11')](respondWithStatusCode(_0xfea8d5,null))[_0xe1c2('0x37')](function(_0x1f674e){if(_0x7bfefa){socket['emit'](_0xe1c2('0x54'),{'id':_0x7bfefa['id']});}if(!_0x11c0c6){logger['error'](_0xe1c2('0x55'),_0x1f674e);return _0xfea8d5[_0xe1c2('0x9')](0x1f4)[_0xe1c2('0x56')](_0x1f674e[_0xe1c2('0x57')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x11c0c6['id'],JSON['stringify'](_0x1f674e));});}; \ No newline at end of file +var _0x0d27=['Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','from','base64','toString','ascii','parse','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','CloudProvider','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','length','find','create','body'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x0d27,0x189));var _0x70d2=function(_0x135b97,_0x44bee8){_0x135b97=_0x135b97-0x0;var _0x8f5004=_0x0d27[_0x135b97];return _0x8f5004;};'use strict';var _=require(_0x70d2('0x0'));var Redis=require(_0x70d2('0x1'));var qs=require(_0x70d2('0x2'));var encryptor=require(_0x70d2('0x3'));var config=require('../../config/environment');var logger=require(_0x70d2('0x4'))(_0x70d2('0x5'));var db=require(_0x70d2('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x70d2('0x7')]=_[_0x70d2('0x8')](config['redis'],{'host':_0x70d2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70d2('0x7')]));var redis=new Redis(config[_0x70d2('0x7')]);function respondWithStatusCode(_0x43eac9,_0x1febcd){_0x1febcd=_0x1febcd||0xcc;return function(_0x37b481){if(_0x37b481){return _0x43eac9[_0x70d2('0xa')](_0x1febcd);}return _0x43eac9[_0x70d2('0xb')](_0x1febcd)[_0x70d2('0xc')]();};}function respondWithResult(_0x1c6d8d,_0x54e4f1){_0x54e4f1=_0x54e4f1||0xc8;return function(_0x42940f){if(_0x42940f){return _0x1c6d8d[_0x70d2('0xb')](_0x54e4f1)[_0x70d2('0xd')](_0x42940f);}};}function respondWithFilteredResult(_0x391a72,_0x31ad9a){return function(_0x459884){if(_0x459884){var _0x26f496=typeof _0x31ad9a[_0x70d2('0xe')]==='undefined'&&typeof _0x31ad9a['limit']===_0x70d2('0xf');var _0x4a63d3=_0x459884[_0x70d2('0x10')];var _0x2827a2=_0x26f496?0x0:_0x31ad9a['offset'];var _0x1cd305=_0x26f496?_0x459884['count']:_0x31ad9a[_0x70d2('0xe')]+_0x31ad9a[_0x70d2('0x11')];var _0x49dd5e;if(_0x1cd305>=_0x4a63d3){_0x1cd305=_0x4a63d3;_0x49dd5e=0xc8;}else{_0x49dd5e=0xce;}_0x391a72[_0x70d2('0xb')](_0x49dd5e);return _0x391a72[_0x70d2('0x12')](_0x70d2('0x13'),_0x2827a2+'-'+_0x1cd305+'/'+_0x4a63d3)[_0x70d2('0xd')](_0x459884);}return null;};}function saveUpdates(_0x385d46){return function(_0x3501f2){if(_0x3501f2){return _0x3501f2[_0x70d2('0x14')](_0x385d46)['then'](function(_0x12315d){return _0x12315d;});}return null;};}function removeEntity(_0x528e3d){return function(_0x2ee6a9){if(_0x2ee6a9){return _0x2ee6a9[_0x70d2('0x15')]()[_0x70d2('0x16')](function(){_0x528e3d[_0x70d2('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b71c6){return function(_0x3afe50){if(!_0x3afe50){_0x2b71c6['sendStatus'](0x194);}return _0x3afe50;};}function handleError(_0x2fde8c,_0x26a5f3){_0x26a5f3=_0x26a5f3||0x1f4;return function(_0x4bf77d){logger[_0x70d2('0x17')](_0x4bf77d[_0x70d2('0x18')]);if(_0x4bf77d[_0x70d2('0x19')]){delete _0x4bf77d[_0x70d2('0x19')];}_0x2fde8c[_0x70d2('0xb')](_0x26a5f3)[_0x70d2('0x1a')](_0x4bf77d);};}function maskClientSecret(_0x590e14){return _['padEnd'](_0x590e14['slice'](0x0,0x3),0x14,'*');}exports[_0x70d2('0x1b')]=function(_0x373bc9,_0x49f1bd){var _0x191c1d={},_0x34d472={},_0x11626f={'count':0x0,'rows':[]};var _0x57555a=_[_0x70d2('0x1c')](db['CloudProvider'][_0x70d2('0x1d')],function(_0x32d670){return{'name':_0x32d670['fieldName'],'type':_0x32d670[_0x70d2('0x1e')]['key']};});_0x34d472[_0x70d2('0x1f')]=_[_0x70d2('0x1c')](_0x57555a,_0x70d2('0x19'));_0x34d472[_0x70d2('0x20')]=_[_0x70d2('0x21')](_0x373bc9['query']);_0x34d472[_0x70d2('0x22')]=_[_0x70d2('0x23')](_0x34d472[_0x70d2('0x1f')],_0x34d472[_0x70d2('0x20')]);_0x191c1d[_0x70d2('0x24')]=_[_0x70d2('0x23')](_0x34d472[_0x70d2('0x1f')],qs[_0x70d2('0x25')](_0x373bc9[_0x70d2('0x20')][_0x70d2('0x25')]));_0x191c1d[_0x70d2('0x24')]=_0x191c1d[_0x70d2('0x24')]['length']?_0x191c1d[_0x70d2('0x24')]:_0x34d472['model'];if(!_0x373bc9[_0x70d2('0x20')][_0x70d2('0x26')]('nolimit')){_0x191c1d[_0x70d2('0x11')]=qs[_0x70d2('0x11')](_0x373bc9['query'][_0x70d2('0x11')]);_0x191c1d['offset']=qs[_0x70d2('0xe')](_0x373bc9['query'][_0x70d2('0xe')]);}_0x191c1d['order']=qs[_0x70d2('0x27')](_0x373bc9[_0x70d2('0x20')][_0x70d2('0x27')]);_0x191c1d[_0x70d2('0x28')]=qs[_0x70d2('0x22')](_[_0x70d2('0x29')](_0x373bc9[_0x70d2('0x20')],_0x34d472[_0x70d2('0x22')]),_0x57555a);if(_0x373bc9[_0x70d2('0x20')]['filter']){_0x191c1d[_0x70d2('0x28')]=_['merge'](_0x191c1d[_0x70d2('0x28')],{'$or':_[_0x70d2('0x1c')](_0x57555a,function(_0x25d6ac){if(_0x25d6ac[_0x70d2('0x1e')]!=='VIRTUAL'){var _0x55c11e={};_0x55c11e[_0x25d6ac[_0x70d2('0x19')]]={'$like':'%'+_0x373bc9[_0x70d2('0x20')][_0x70d2('0x2a')]+'%'};return _0x55c11e;}})});}_0x191c1d=_[_0x70d2('0x2b')]({},_0x191c1d,_0x373bc9[_0x70d2('0x2c')]);var _0x1289e5={'where':_0x191c1d[_0x70d2('0x28')]};return db[_0x70d2('0x2d')][_0x70d2('0x10')](_0x1289e5)[_0x70d2('0x16')](function(_0xef81f4){_0x11626f[_0x70d2('0x10')]=_0xef81f4;if(_0x373bc9[_0x70d2('0x20')][_0x70d2('0x2e')]){_0x191c1d[_0x70d2('0x2f')]=[{'all':!![]}];}return db[_0x70d2('0x2d')]['findAll'](_0x191c1d);})['then'](function(_0x4f2c07){_0x11626f[_0x70d2('0x30')]=_[_0x70d2('0x1c')](_0x4f2c07,function(_0x516fc4){if(_0x516fc4['service']===_0x70d2('0x31')){var _0x494a15=encryptor[_0x70d2('0x32')](_0x516fc4['data3']);_0x516fc4[_0x70d2('0x33')]=maskClientSecret(_0x494a15);}return _0x516fc4;});return _0x11626f;})[_0x70d2('0x16')](respondWithFilteredResult(_0x49f1bd,_0x191c1d))[_0x70d2('0x34')](handleError(_0x49f1bd,null));};exports['show']=function(_0x478ac3,_0x41963d){var _0x288b6c={'raw':!![],'where':{'id':_0x478ac3['params']['id']}},_0x3d4aad={};_0x3d4aad[_0x70d2('0x1f')]=_['keys'](db['CloudProvider']['rawAttributes']);_0x3d4aad[_0x70d2('0x20')]=_['keys'](_0x478ac3[_0x70d2('0x20')]);_0x3d4aad[_0x70d2('0x22')]=_[_0x70d2('0x23')](_0x3d4aad[_0x70d2('0x1f')],_0x3d4aad['query']);_0x288b6c[_0x70d2('0x24')]=_['intersection'](_0x3d4aad[_0x70d2('0x1f')],qs[_0x70d2('0x25')](_0x478ac3[_0x70d2('0x20')][_0x70d2('0x25')]));_0x288b6c['attributes']=_0x288b6c[_0x70d2('0x24')][_0x70d2('0x35')]?_0x288b6c[_0x70d2('0x24')]:_0x3d4aad[_0x70d2('0x1f')];if(_0x478ac3[_0x70d2('0x20')][_0x70d2('0x2e')]){_0x288b6c[_0x70d2('0x2f')]=[{'all':!![]}];}_0x288b6c=_[_0x70d2('0x2b')]({},_0x288b6c,_0x478ac3['options']);return db['CloudProvider'][_0x70d2('0x36')](_0x288b6c)['then'](handleEntityNotFound(_0x41963d,null))[_0x70d2('0x16')](function(_0x300d0d){if(_0x300d0d['service']===_0x70d2('0x31')){var _0x2e1819=encryptor[_0x70d2('0x32')](_0x300d0d['data3']);_0x300d0d[_0x70d2('0x33')]=maskClientSecret(_0x2e1819);}return _0x300d0d;})['then'](respondWithResult(_0x41963d,null))[_0x70d2('0x34')](handleError(_0x41963d,null));};exports[_0x70d2('0x37')]=function(_0x5292db,_0x1c1932){if(!_0x5292db[_0x70d2('0x38')][_0x70d2('0x19')])throw new Error(_0x70d2('0x39'));if(!_0x5292db['body'][_0x70d2('0x3a')])throw new Error(_0x70d2('0x3b'));var _0x825ed2=db[_0x70d2('0x2d')][_0x70d2('0x1d')][_0x70d2('0x3a')][_0x70d2('0x3c')];if(!_0x825ed2[_0x70d2('0x3d')](_0x5292db['body'][_0x70d2('0x3a')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x825ed2[_0x70d2('0x3e')](',\x20'));if(_0x5292db['body']['service']===_0x70d2('0x31')&&_0x5292db['body'][_0x70d2('0x33')]){_0x5292db[_0x70d2('0x38')][_0x70d2('0x33')]=encryptor[_0x70d2('0x3f')](_0x5292db[_0x70d2('0x38')][_0x70d2('0x33')]);}return db[_0x70d2('0x2d')]['create'](_0x5292db[_0x70d2('0x38')],{})[_0x70d2('0x16')](respondWithResult(_0x1c1932,0xc9))[_0x70d2('0x34')](handleError(_0x1c1932,null));};exports[_0x70d2('0x14')]=function(_0x5bfc5d,_0x4577db){if(_0x5bfc5d[_0x70d2('0x38')]['id']){delete _0x5bfc5d[_0x70d2('0x38')]['id'];}return db[_0x70d2('0x2d')][_0x70d2('0x36')]({'where':{'id':_0x5bfc5d['params']['id']}})[_0x70d2('0x16')](handleEntityNotFound(_0x4577db,null))['then'](function(_0x5bcd2b){if(_0x5bcd2b['service']==='MicrosoftAzure'&&_0x5bfc5d[_0x70d2('0x38')][_0x70d2('0x33')]){_0x5bfc5d[_0x70d2('0x38')][_0x70d2('0x33')]=encryptor[_0x70d2('0x3f')](_0x5bfc5d['body'][_0x70d2('0x33')]);}return _0x5bcd2b;})[_0x70d2('0x16')](saveUpdates(_0x5bfc5d[_0x70d2('0x38')],null))[_0x70d2('0x16')](respondWithResult(_0x4577db,null))['catch'](handleError(_0x4577db,null));};exports['destroy']=function(_0x2893dc,_0x48ce66){return db[_0x70d2('0x2d')][_0x70d2('0x36')]({'where':{'id':_0x2893dc[_0x70d2('0x40')]['id']}})[_0x70d2('0x16')](handleEntityNotFound(_0x48ce66,null))[_0x70d2('0x16')](removeEntity(_0x48ce66,null))[_0x70d2('0x34')](handleError(_0x48ce66,null));};exports[_0x70d2('0x41')]=function(_0x32c95d,_0x489f9e){return db[_0x70d2('0x2d')][_0x70d2('0x42')]({'where':{'id':_0x32c95d[_0x70d2('0x40')]['id']},'raw':!![]})[_0x70d2('0x16')](function(_0x52fbd7){if(!_0x52fbd7)return _0x489f9e[_0x70d2('0xa')](0x194);return{'url':oauth[_0x70d2('0x43')](_0x52fbd7,_0x32c95d[_0x70d2('0x44')]['id'])};})[_0x70d2('0x16')](respondWithResult(_0x489f9e,null))[_0x70d2('0x34')](handleError(_0x489f9e,null));};exports[_0x70d2('0x45')]=function(_0x2028cf,_0x394199){var _0x43092c=_0x2028cf[_0x70d2('0x38')];var _0x5a330a;var _0x6e4d31;if(_0x43092c['error'])throw _0x43092c;redis['get'](_0x43092c[_0x70d2('0x46')])['then'](function(_0x2e8e6e){if(!_0x2e8e6e)throw new Error('Invalid\x20state\x20parameter');_0x5a330a=JSON['parse'](_0x2e8e6e);var _0x1bf41e=Buffer[_0x70d2('0x47')](_0x43092c[_0x70d2('0x46')],_0x70d2('0x48'))[_0x70d2('0x49')](_0x70d2('0x4a'));_0x6e4d31=JSON[_0x70d2('0x4b')](_0x1bf41e);if(!oauth['isValidIdToken'](_0x43092c[_0x70d2('0x4c')],_0x5a330a[_0x70d2('0x4d')]))throw new Error(_0x70d2('0x4e'));redis['del'](_0x43092c['state']);return oauth[_0x70d2('0x4f')](_0x43092c['code'],_0x5a330a);})[_0x70d2('0x16')](function(_0x1007a3){_0x5a330a[_0x70d2('0x50')]=_0x1007a3[_0x70d2('0x51')];_0x5a330a[_0x70d2('0x52')]=_0x1007a3['refresh_token'];return db['CloudProvider']['update']({'data5':_0x5a330a[_0x70d2('0x50')],'data6':_0x5a330a[_0x70d2('0x52')]},{'where':{'id':_0x5a330a['id']}});})[_0x70d2('0x16')](function(){oauth[_0x70d2('0x53')](_0x5a330a);socket['emit'](_0x70d2('0x54'),{'id':_0x6e4d31['id']});return;})[_0x70d2('0x16')](respondWithStatusCode(_0x394199,null))['catch'](function(_0x2d838a){if(_0x6e4d31){socket['emit'](_0x70d2('0x55'),{'id':_0x6e4d31['id']});}if(!_0x5a330a){logger[_0x70d2('0x17')](_0x70d2('0x56'),_0x2d838a);return _0x394199[_0x70d2('0xb')](0x1f4)['send'](_0x2d838a[_0x70d2('0x57')]);}logger[_0x70d2('0x17')](_0x70d2('0x58'),_0x5a330a['id'],JSON[_0x70d2('0x59')](_0x2d838a));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0dd5223..45bb5d4 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 _0x1546=['moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider'];(function(_0x3253ef,_0x29d2c9){var _0x39d2c0=function(_0x4fb9d8){while(--_0x4fb9d8){_0x3253ef['push'](_0x3253ef['shift']());}};_0x39d2c0(++_0x29d2c9);}(_0x1546,0x170));var _0x6154=function(_0x5bfd11,_0x26490b){_0x5bfd11=_0x5bfd11-0x0;var _0x996e58=_0x1546[_0x5bfd11];return _0x996e58;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6154('0x0'));var BPromise=require(_0x6154('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6154('0x2'));var rimraf=require(_0x6154('0x3'));var config=require(_0x6154('0x4'));var attributes=require(_0x6154('0x5'));module[_0x6154('0x6')]=function(_0x389919,_0x9daa18){return _0x389919['define'](_0x6154('0x7'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe8e=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4cdd96,_0x373b18){var _0x48fe61=function(_0x24dd3e){while(--_0x24dd3e){_0x4cdd96['push'](_0x4cdd96['shift']());}};_0x48fe61(++_0x373b18);}(_0xfe8e,0x148));var _0xefe8=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xfe8e[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0xefe8('0x0'));var util=require(_0xefe8('0x1'));var logger=require(_0xefe8('0x2'))(_0xefe8('0x3'));var moment=require(_0xefe8('0x4'));var BPromise=require('bluebird');var rp=require(_0xefe8('0x5'));var fs=require('fs');var path=require(_0xefe8('0x6'));var rimraf=require(_0xefe8('0x7'));var config=require('../../config/environment');var attributes=require(_0xefe8('0x8'));module[_0xefe8('0x9')]=function(_0x2854b9,_0x3d7630){return _0x2854b9[_0xefe8('0xa')](_0xefe8('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 34a0e1a..1c66106 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05b0=['decryptString','POST','access_token','data6','update','data5','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data4','data2','intervals','bind','findAll','all','inspect','error','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/authorize','/token','map','type','Dynamics365','push','data7','/.default','code','stringify','base64','randomBytes','toString','hex','client_id','data1','join','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','iss','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token'];(function(_0x117a44,_0x5dabdc){var _0x2a03c9=function(_0x4516d7){while(--_0x4516d7){_0x117a44['push'](_0x117a44['shift']());}};_0x2a03c9(++_0x5dabdc);}(_0x05b0,0x67));var _0x005b=function(_0x345858,_0x5b0103){_0x345858=_0x345858-0x0;var _0x531ffe=_0x05b0[_0x345858];return _0x531ffe;};'use strict';var _=require(_0x005b('0x0'));var crypto=require(_0x005b('0x1'));var jwt=require(_0x005b('0x2'));var moment=require(_0x005b('0x3'));var Redis=require(_0x005b('0x4'));var rp=require(_0x005b('0x5'));var util=require(_0x005b('0x6'));var encryptor=require(_0x005b('0x7'));var config=require(_0x005b('0x8'));var logger=require(_0x005b('0x9'))(_0x005b('0xa'));var schedule=require(_0x005b('0xb'));var db=require(_0x005b('0xc'))['db'];config[_0x005b('0xd')]=_[_0x005b('0xe')](config[_0x005b('0xd')],{'host':_0x005b('0xf'),'port':0x18eb});var redis=new Redis(config[_0x005b('0xd')]);var MICROSOFT_AUTH_URL=_0x005b('0x10');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x005b('0x11'),_0x005b('0x12'),_0x005b('0x13'),_0x005b('0x14'),_0x005b('0x15'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x005b('0x16'),_0x005b('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x005b('0x17');var MICROSOFT_TOKEN_ENDPOINT=_0x005b('0x18');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xad8f47){var _0x19cb75=_[_0x005b('0x19')](AZURE_AUTH_SCOPES[_0xad8f47[_0x005b('0x1a')]]);if(_0xad8f47[_0x005b('0x1a')]===_0x005b('0x1b'))_0x19cb75[_0x005b('0x1c')](_0xad8f47[_0x005b('0x1d')]+_0x005b('0x1e'));return _0x19cb75['join']('\x20');}function getAccessTokenScope(_0x57da9a){if(_0x57da9a['type']==='Outlook365')return _0x005b('0x14');if(_0x57da9a['type']===_0x005b('0x1b'))return _0x57da9a[_0x005b('0x1d')]+_0x005b('0x1e');}function generateMicrosoftAuthorizationUrl(_0x17f607,_0x4a5eb4){var _0x529a0a=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x17f607['data2']);var _0x345b4a=[_0x005b('0x1f'),'id_token'];var _0x35594e=Buffer['from'](JSON[_0x005b('0x20')]({'id':_0x4a5eb4}))['toString'](_0x005b('0x21'));var _0x2083cc=crypto[_0x005b('0x22')](0x10)[_0x005b('0x23')](_0x005b('0x24'));var _0x5214a2=getAuthorizationScopes(_0x17f607);var _0x5869af=[{'key':_0x005b('0x25'),'value':_0x17f607[_0x005b('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x345b4a[_0x005b('0x27')]('\x20'))},{'key':'redirect_uri','value':_0x17f607['data4']},{'key':_0x005b('0x28'),'value':_0x005b('0x29')},{'key':_0x005b('0x2a'),'value':encodeURIComponent(_0x5214a2)},{'key':_0x005b('0x2b'),'value':_0x35594e},{'key':_0x005b('0x2c'),'value':_0x2083cc},{'key':_0x005b('0x2d'),'value':_0x005b('0x2e')}];var _0x38be49=_0x529a0a+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x005b('0x19')](_0x5869af,function(_0x37c0ed){return _0x37c0ed[_0x005b('0x2f')]+'='+_0x37c0ed[_0x005b('0x30')];})['join']('&');_0x17f607[_0x005b('0x31')]={'issuer':_0x529a0a[_0x005b('0x32')](_0x005b('0x33'),''),'audience':_0x17f607[_0x005b('0x26')],'state':_0x35594e,'nonce':_0x2083cc};redis[_0x005b('0x34')](_0x35594e,JSON[_0x005b('0x20')](_0x17f607));return _0x38be49;}function isValidIdToken(_0x15aa61,_0x16cbdd){try{var _0x283ffa=jwt[_0x005b('0x35')](_0x15aa61,{'complete':!![]});var _0x22ba24=_0x283ffa[_0x005b('0x36')];if(_0x22ba24[_0x005b('0x37')]!==_0x16cbdd['issuer'])return![];if(_0x22ba24[_0x005b('0x38')]!==_0x16cbdd[_0x005b('0x39')])return![];if(_0x22ba24[_0x005b('0x2c')]!==_0x16cbdd['nonce'])return![];if(moment()[_0x005b('0x3a')](moment[_0x005b('0x3b')](_0x22ba24[_0x005b('0x3c')])))return![];return!![];}catch(_0x4a4fef){throw _0x4a4fef;}}function refreshOauth2MicrosoftAccessToken(_0x462417){return Promise[_0x005b('0x3d')]()[_0x005b('0x3e')](function(){if(_0x462417[_0x005b('0x3f')])return _0x462417;return db[_0x005b('0x40')][_0x005b('0x41')]({'where':{'id':_0x462417['id']},'raw':!![]});})[_0x005b('0x3e')](function(_0x720679){var _0x47318d={'grant_type':_0x005b('0x42'),'refresh_token':_0x720679['data6'],'scope':getAccessTokenScope(_0x720679),'redirect_uri':_0x720679['data4'],'client_id':_0x720679['data1'],'client_secret':encryptor[_0x005b('0x43')](_0x720679[_0x005b('0x3f')])};var _0x34e601={'method':_0x005b('0x44'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x720679['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x47318d,'json':!![]};return rp(_0x34e601);})[_0x005b('0x3e')](function(_0x45ed63){_0x462417['data5']=_0x45ed63[_0x005b('0x45')];_0x462417[_0x005b('0x46')]=_0x45ed63[_0x005b('0x42')];return db['CloudProvider'][_0x005b('0x47')]({'data5':_0x462417[_0x005b('0x48')],'data6':_0x462417[_0x005b('0x46')]},{'where':{'id':_0x462417['id']}});})[_0x005b('0x3e')](function(){return _0x462417;})[_0x005b('0x49')](function(_0x3aef7f){logger['error'](_0x005b('0x4a'),_0x462417['id'],_0x3aef7f);});}function getOauth2MicrosoftAccessToken(_0x536053,_0x4ebff1){var _0x3f228a={'grant_type':_0x005b('0x4b'),'code':_0x536053,'scope':getAccessTokenScope(_0x4ebff1),'redirect_uri':_0x4ebff1[_0x005b('0x4c')],'client_id':_0x4ebff1[_0x005b('0x26')],'client_secret':encryptor[_0x005b('0x43')](_0x4ebff1['data3'])};var _0x1f984a={'method':_0x005b('0x44'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x4ebff1[_0x005b('0x4d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f228a,'json':!![]};return rp(_0x1f984a);}function startRefreshInterval(_0x5d0e3b){var _0x366ced=schedule[_0x005b('0x4e')];if(_0x366ced[_0x5d0e3b['id']])clearInterval(_0x366ced[_0x5d0e3b['id']]);_0x366ced[_0x5d0e3b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x005b('0x4f')](this,{'id':_0x5d0e3b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x366ced;}function startAllRefreshIntervals(){return db[_0x005b('0x40')][_0x005b('0x50')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x005b('0x3e')](function(_0x5ac3ec){var _0x140b44=_0x5ac3ec[_0x005b('0x19')](function(_0x36f028){return refreshOauth2MicrosoftAccessToken(_0x36f028)[_0x005b('0x3e')](function(_0x8654b8){startRefreshInterval(_0x8654b8);});});return Promise[_0x005b('0x51')](_0x140b44);})[_0x005b('0x49')](function(_0x4c0e68){var _0xbad772=_0x4c0e68?util[_0x005b('0x52')](_0x4c0e68,{'showHidden':![],'depth':null}):'';logger[_0x005b('0x53')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xbad772);});}module[_0x005b('0x54')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xaf24=['refresh_token','data6','decryptString','{TENANT_ID}','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','join','Outlook365','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','data4','response_mode','scope','state','prompt','key','oauth2/','set','decode','payload','iss','issuer','aud','nonce','unix','data3','CloudProvider','findOne','then'];(function(_0x40a206,_0x46f2c2){var _0x52dabc=function(_0x5c354b){while(--_0x5c354b){_0x40a206['push'](_0x40a206['shift']());}};_0x52dabc(++_0x46f2c2);}(_0xaf24,0x18d));var _0x4af2=function(_0x55b728,_0xe943c2){_0x55b728=_0x55b728-0x0;var _0x54773f=_0xaf24[_0x55b728];return _0x54773f;};'use strict';var _=require(_0x4af2('0x0'));var crypto=require(_0x4af2('0x1'));var jwt=require(_0x4af2('0x2'));var moment=require(_0x4af2('0x3'));var Redis=require('ioredis');var rp=require(_0x4af2('0x4'));var util=require(_0x4af2('0x5'));var encryptor=require(_0x4af2('0x6'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x4af2('0x7'));var schedule=require(_0x4af2('0x8'));var db=require(_0x4af2('0x9'))['db'];config[_0x4af2('0xa')]=_[_0x4af2('0xb')](config[_0x4af2('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x4af2('0xa')]);var MICROSOFT_AUTH_URL=_0x4af2('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4af2('0xd'),_0x4af2('0xe'),'email',_0x4af2('0xf'),_0x4af2('0x10'),_0x4af2('0x11'),_0x4af2('0x12')],'Dynamics365':[_0x4af2('0xd'),_0x4af2('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x4af2('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x82b3b2){var _0x5ec76b=_[_0x4af2('0x14')](AZURE_AUTH_SCOPES[_0x82b3b2[_0x4af2('0x15')]]);if(_0x82b3b2[_0x4af2('0x15')]===_0x4af2('0x16'))_0x5ec76b[_0x4af2('0x17')](_0x82b3b2[_0x4af2('0x18')]+'/.default');return _0x5ec76b[_0x4af2('0x19')]('\x20');}function getAccessTokenScope(_0x41b8b7){if(_0x41b8b7[_0x4af2('0x15')]===_0x4af2('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x41b8b7[_0x4af2('0x15')]===_0x4af2('0x16'))return _0x41b8b7['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x533031,_0x464129){var _0x676bfa=MICROSOFT_AUTH_URL[_0x4af2('0x1b')]('{TENANT_ID}',_0x533031[_0x4af2('0x1c')]);var _0x345d40=[_0x4af2('0x1d'),_0x4af2('0x1e')];var _0x17c20c=Buffer[_0x4af2('0x1f')](JSON[_0x4af2('0x20')]({'id':_0x464129}))[_0x4af2('0x21')](_0x4af2('0x22'));var _0x2f07d2=crypto[_0x4af2('0x23')](0x10)[_0x4af2('0x21')](_0x4af2('0x24'));var _0x2e54cc=getAuthorizationScopes(_0x533031);var _0x431b98=[{'key':_0x4af2('0x25'),'value':_0x533031[_0x4af2('0x26')]},{'key':_0x4af2('0x27'),'value':encodeURIComponent(_0x345d40['join']('\x20'))},{'key':'redirect_uri','value':_0x533031[_0x4af2('0x28')]},{'key':_0x4af2('0x29'),'value':'form_post'},{'key':_0x4af2('0x2a'),'value':encodeURIComponent(_0x2e54cc)},{'key':_0x4af2('0x2b'),'value':_0x17c20c},{'key':'nonce','value':_0x2f07d2},{'key':_0x4af2('0x2c'),'value':'login'}];var _0xf810a=_0x676bfa+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4af2('0x14')](_0x431b98,function(_0x3b896e){return _0x3b896e[_0x4af2('0x2d')]+'='+_0x3b896e['value'];})[_0x4af2('0x19')]('&');_0x533031['oauth2Claims']={'issuer':_0x676bfa[_0x4af2('0x1b')](_0x4af2('0x2e'),''),'audience':_0x533031[_0x4af2('0x26')],'state':_0x17c20c,'nonce':_0x2f07d2};redis[_0x4af2('0x2f')](_0x17c20c,JSON[_0x4af2('0x20')](_0x533031));return _0xf810a;}function isValidIdToken(_0x9f4dfe,_0x49f395){try{var _0x356bcb=jwt[_0x4af2('0x30')](_0x9f4dfe,{'complete':!![]});var _0x50ea97=_0x356bcb[_0x4af2('0x31')];if(_0x50ea97[_0x4af2('0x32')]!==_0x49f395[_0x4af2('0x33')])return![];if(_0x50ea97[_0x4af2('0x34')]!==_0x49f395['audience'])return![];if(_0x50ea97[_0x4af2('0x35')]!==_0x49f395[_0x4af2('0x35')])return![];if(moment()['isAfter'](moment[_0x4af2('0x36')](_0x50ea97['exp'])))return![];return!![];}catch(_0x5ee3e9){throw _0x5ee3e9;}}function refreshOauth2MicrosoftAccessToken(_0x100129){return Promise['resolve']()['then'](function(){if(_0x100129[_0x4af2('0x37')])return _0x100129;return db[_0x4af2('0x38')][_0x4af2('0x39')]({'where':{'id':_0x100129['id']},'raw':!![]});})[_0x4af2('0x3a')](function(_0x8c9fc0){var _0x59fa10={'grant_type':_0x4af2('0x3b'),'refresh_token':_0x8c9fc0[_0x4af2('0x3c')],'scope':getAccessTokenScope(_0x8c9fc0),'redirect_uri':_0x8c9fc0['data4'],'client_id':_0x8c9fc0[_0x4af2('0x26')],'client_secret':encryptor[_0x4af2('0x3d')](_0x8c9fc0[_0x4af2('0x37')])};var _0x443e6b={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x4af2('0x1b')](_0x4af2('0x3e'),_0x8c9fc0[_0x4af2('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x59fa10,'json':!![]};return rp(_0x443e6b);})[_0x4af2('0x3a')](function(_0x4ff0d1){_0x100129[_0x4af2('0x3f')]=_0x4ff0d1[_0x4af2('0x40')];_0x100129[_0x4af2('0x3c')]=_0x4ff0d1[_0x4af2('0x3b')];return db[_0x4af2('0x38')][_0x4af2('0x41')]({'data5':_0x100129[_0x4af2('0x3f')],'data6':_0x100129[_0x4af2('0x3c')]},{'where':{'id':_0x100129['id']}});})[_0x4af2('0x3a')](function(){return _0x100129;})[_0x4af2('0x42')](function(_0x139d20){logger[_0x4af2('0x43')](_0x4af2('0x44'),_0x100129['id'],_0x139d20);});}function getOauth2MicrosoftAccessToken(_0x461c7a,_0x21501b){var _0xf711c5={'grant_type':_0x4af2('0x45'),'code':_0x461c7a,'scope':getAccessTokenScope(_0x21501b),'redirect_uri':_0x21501b[_0x4af2('0x28')],'client_id':_0x21501b[_0x4af2('0x26')],'client_secret':encryptor['decryptString'](_0x21501b[_0x4af2('0x37')])};var _0x1069ee={'method':_0x4af2('0x46'),'uri':MICROSOFT_AUTH_URL[_0x4af2('0x1b')]('{TENANT_ID}',_0x21501b[_0x4af2('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf711c5,'json':!![]};return rp(_0x1069ee);}function startRefreshInterval(_0x1fabad){var _0x41d9fd=schedule[_0x4af2('0x47')];if(_0x41d9fd[_0x1fabad['id']])clearInterval(_0x41d9fd[_0x1fabad['id']]);_0x41d9fd[_0x1fabad['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4af2('0x48')](this,{'id':_0x1fabad['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x41d9fd;}function startAllRefreshIntervals(){return db[_0x4af2('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4af2('0x3a')](function(_0x11095e){var _0x32ac8d=_0x11095e[_0x4af2('0x14')](function(_0x10974b){return refreshOauth2MicrosoftAccessToken(_0x10974b)[_0x4af2('0x3a')](function(_0x4f156b){startRefreshInterval(_0x4f156b);});});return Promise[_0x4af2('0x49')](_0x32ac8d);})[_0x4af2('0x42')](function(_0x17c225){var _0x5c9c4e=_0x17c225?util[_0x4af2('0x4a')](_0x17c225,{'showHidden':![],'depth':null}):'';logger[_0x4af2('0x43')](_0x4af2('0x4b'),_0x5c9c4e);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index b126d55..1aee72e 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 _0x964b=['../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0xd5009a,_0x2a0b5b){var _0x34953f=function(_0x55373c){while(--_0x55373c){_0xd5009a['push'](_0xd5009a['shift']());}};_0x34953f(++_0x2a0b5b);}(_0x964b,0x112));var _0xb964=function(_0x4bb8a6,_0x4ee996){_0x4bb8a6=_0x4bb8a6-0x0;var _0x2b5ea2=_0x964b[_0x4bb8a6];return _0x2b5ea2;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var moment=require('moment');var BPromise=require(_0xb964('0x2'));var rs=require(_0xb964('0x3'));var fs=require('fs');var Redis=require(_0xb964('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb964('0x5'))('rpc');var config=require(_0xb964('0x6'));var jayson=require(_0xb964('0x7'));var client=jayson[_0xb964('0x8')][_0xb964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204c7d,_0xde47d5,_0x3fe401){return new BPromise(function(_0x53b463,_0x58e49e){return client[_0xb964('0xa')](_0x204c7d,_0x3fe401)['then'](function(_0x55e697){logger[_0xb964('0xb')](_0xb964('0xc'),_0xde47d5,_0xb964('0xd'));logger[_0xb964('0xe')](_0xb964('0xf'),_0xde47d5,_0xb964('0xd'),JSON['stringify'](_0x55e697));if(_0x55e697[_0xb964('0x10')]){if(_0x55e697[_0xb964('0x10')][_0xb964('0x11')]===0x1f4){logger[_0xb964('0x10')]('CloudProvider,\x20%s,\x20%s',_0xde47d5,_0x55e697[_0xb964('0x10')]['message']);return _0x58e49e(_0x55e697['error'][_0xb964('0x12')]);}logger[_0xb964('0x10')](_0xb964('0xc'),_0xde47d5,_0x55e697[_0xb964('0x10')][_0xb964('0x12')]);return _0x53b463(_0x55e697[_0xb964('0x10')][_0xb964('0x12')]);}else{logger['info'](_0xb964('0xc'),_0xde47d5,'request\x20sent');_0x53b463(_0x55e697['result'][_0xb964('0x12')]);}})[_0xb964('0x13')](function(_0x26aa2c){logger[_0xb964('0x10')](_0xb964('0xc'),_0xde47d5,_0x26aa2c);_0x58e49e(_0x26aa2c);});});} \ No newline at end of file +var _0x3c91=['client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x3c91,0x1af));var _0x13c9=function(_0x4c45d4,_0x388987){_0x4c45d4=_0x4c45d4-0x0;var _0x1ee8be=_0x3c91[_0x4c45d4];return _0x1ee8be;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var moment=require(_0x13c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c9('0x3'));var db=require(_0x13c9('0x4'))['db'];var utils=require(_0x13c9('0x5'));var logger=require('../../config/logger')(_0x13c9('0x6'));var config=require(_0x13c9('0x7'));var jayson=require(_0x13c9('0x8'));var client=jayson[_0x13c9('0x9')][_0x13c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4332,_0x58b610,_0x44243f){return new BPromise(function(_0x196c2a,_0x5fd23){return client[_0x13c9('0xb')](_0x4c4332,_0x44243f)[_0x13c9('0xc')](function(_0x5370dd){logger['info'](_0x13c9('0xd'),_0x58b610,_0x13c9('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x58b610,_0x13c9('0xe'),JSON[_0x13c9('0xf')](_0x5370dd));if(_0x5370dd[_0x13c9('0x10')]){if(_0x5370dd[_0x13c9('0x10')][_0x13c9('0x11')]===0x1f4){logger[_0x13c9('0x10')](_0x13c9('0xd'),_0x58b610,_0x5370dd['error'][_0x13c9('0x12')]);return _0x5fd23(_0x5370dd['error']['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x58b610,_0x5370dd['error'][_0x13c9('0x12')]);return _0x196c2a(_0x5370dd[_0x13c9('0x10')]['message']);}else{logger[_0x13c9('0x13')](_0x13c9('0xd'),_0x58b610,_0x13c9('0xe'));_0x196c2a(_0x5370dd[_0x13c9('0x14')][_0x13c9('0x12')]);}})[_0x13c9('0x15')](function(_0x238952){logger['error']('CloudProvider,\x20%s,\x20%s',_0x58b610,_0x238952);_0x5fd23(_0x238952);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0f71324..5b05a45 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x5f2f,0x73));var _0xf5f2=function(_0x466994,_0x29ebad){_0x466994=_0x466994-0x0;var _0x5157de=_0x5f2f[_0x466994];return _0x5157de;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x11fc7b,_0x1434e6){var _0x4080e6=function(_0x54ccb0){while(--_0x54ccb0){_0x11fc7b['push'](_0x11fc7b['shift']());}};_0x4080e6(++_0x1434e6);}(_0xdb28,0x106));var _0x8db2=function(_0x4b1edb,_0x39f6d6){_0x4b1edb=_0x4b1edb-0x0;var _0x1c7bb9=_0xdb28[_0x4b1edb];return _0x1c7bb9;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index afd1baa..b965a78 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 _0x8137=['STRING','sequelize'];(function(_0x527628,_0x52c09d){var _0x2d67fd=function(_0x1fe6ec){while(--_0x1fe6ec){_0x527628['push'](_0x527628['shift']());}};_0x2d67fd(++_0x52c09d);}(_0x8137,0x16b));var _0x7813=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x8137[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x7813('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x7813('0x1')]},'website':{'type':Sequelize[_0x7813('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7813('0x1')]},'city':{'type':Sequelize[_0x7813('0x1')]},'country':{'type':Sequelize[_0x7813('0x1')]},'email':{'type':Sequelize[_0x7813('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7813('0x1')]},'sStreet':{'type':Sequelize[_0x7813('0x1')]},'sPostalCode':{'type':Sequelize[_0x7813('0x1')]},'sCity':{'type':Sequelize[_0x7813('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6b4=['sequelize','exports','STRING'];(function(_0xd8fc2d,_0x1c3f81){var _0x281c9e=function(_0x4df715){while(--_0x4df715){_0xd8fc2d['push'](_0xd8fc2d['shift']());}};_0x281c9e(++_0x1c3f81);}(_0xd6b4,0xb4));var _0x4d6b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6b4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4d6b('0x0'));module[_0x4d6b('0x1')]={'name':{'type':Sequelize[_0x4d6b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4d6b('0x2')]},'companyId':{'type':Sequelize[_0x4d6b('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4d6b('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d6b('0x2')]},'street':{'type':Sequelize[_0x4d6b('0x2')]},'postalCode':{'type':Sequelize[_0x4d6b('0x2')]},'city':{'type':Sequelize[_0x4d6b('0x2')]},'country':{'type':Sequelize[_0x4d6b('0x2')]},'email':{'type':Sequelize[_0x4d6b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4d6b('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4d6b('0x2')]},'sCountry':{'type':Sequelize[_0x4d6b('0x2')]},'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 2a23534..b959d78 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 _0x1cd3=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','stack','name','send','index','CmCompany','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','model','fields','length','options','find'];(function(_0x38855c,_0x2d9ec8){var _0x2fa7f8=function(_0x1295c9){while(--_0x1295c9){_0x38855c['push'](_0x38855c['shift']());}};_0x2fa7f8(++_0x2d9ec8);}(_0x1cd3,0xbf));var _0x31cd=function(_0x5e9a7e,_0x531ed7){_0x5e9a7e=_0x5e9a7e-0x0;var _0x1ec42c=_0x1cd3[_0x5e9a7e];return _0x1ec42c;};'use strict';var emlformat=require(_0x31cd('0x0'));var rimraf=require(_0x31cd('0x1'));var zipdir=require(_0x31cd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x31cd('0x4'));var util=require(_0x31cd('0x5'));var path=require(_0x31cd('0x6'));var sox=require(_0x31cd('0x7'));var csv=require(_0x31cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31cd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31cd('0xa'));var deskjs=require(_0x31cd('0xb'));var toCsv=require(_0x31cd('0x8'));var querystring=require('querystring');var Papa=require(_0x31cd('0xc'));var Redis=require(_0x31cd('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x31cd('0xe'));var hardwareService=require(_0x31cd('0xf'));var logger=require(_0x31cd('0x10'))(_0x31cd('0x11'));var utils=require('../../config/utils');var config=require(_0x31cd('0x12'));var licenseUtil=require(_0x31cd('0x13'));var db=require(_0x31cd('0x14'))['db'];function respondWithStatusCode(_0x24268f,_0x937e5c){_0x937e5c=_0x937e5c||0xcc;return function(_0x163e51){if(_0x163e51){return _0x24268f['sendStatus'](_0x937e5c);}return _0x24268f['status'](_0x937e5c)['end']();};}function respondWithResult(_0x19706d,_0x4eb70d){_0x4eb70d=_0x4eb70d||0xc8;return function(_0x1f3cb8){if(_0x1f3cb8){return _0x19706d[_0x31cd('0x15')](_0x4eb70d)[_0x31cd('0x16')](_0x1f3cb8);}};}function respondWithFilteredResult(_0x246522,_0x573ca6){return function(_0x4450e2){if(_0x4450e2){var _0x3a9dc9=typeof _0x573ca6[_0x31cd('0x17')]===_0x31cd('0x18')&&typeof _0x573ca6[_0x31cd('0x19')]===_0x31cd('0x18');var _0x549573=_0x4450e2['count'];var _0x4efb28=_0x3a9dc9?0x0:_0x573ca6[_0x31cd('0x17')];var _0x20f92e=_0x3a9dc9?_0x4450e2['count']:_0x573ca6[_0x31cd('0x17')]+_0x573ca6[_0x31cd('0x19')];var _0x26b1f9;if(_0x20f92e>=_0x549573){_0x20f92e=_0x549573;_0x26b1f9=0xc8;}else{_0x26b1f9=0xce;}_0x246522[_0x31cd('0x15')](_0x26b1f9);return _0x246522[_0x31cd('0x1a')](_0x31cd('0x1b'),_0x4efb28+'-'+_0x20f92e+'/'+_0x549573)[_0x31cd('0x16')](_0x4450e2);}return null;};}function patchUpdates(_0x276a13){return function(_0x21bd1d){try{jsonpatch['apply'](_0x21bd1d,_0x276a13,!![]);}catch(_0x3e2bd4){return BPromise[_0x31cd('0x1c')](_0x3e2bd4);}return _0x21bd1d[_0x31cd('0x1d')]();};}function saveUpdates(_0x5e8d41,_0x5041e6){return function(_0x135c39){if(_0x135c39){return _0x135c39[_0x31cd('0x1e')](_0x5e8d41)[_0x31cd('0x1f')](function(_0x3928b3){return _0x3928b3;});}return null;};}function removeEntity(_0x535cb1,_0x233ac2){return function(_0x334a02){if(_0x334a02){return _0x334a02[_0x31cd('0x20')]()[_0x31cd('0x1f')](function(){var _0x4b3237=_0x334a02[_0x31cd('0x21')]({'plain':!![]});var _0x5499e2=_0x31cd('0x22');return db[_0x31cd('0x23')]['destroy']({'where':{'type':_0x5499e2,'resourceId':_0x4b3237['id']}})[_0x31cd('0x1f')](function(){return _0x334a02;});})[_0x31cd('0x1f')](function(){_0x535cb1['status'](0xcc)[_0x31cd('0x24')]();});}};}function handleEntityNotFound(_0x1db61a,_0x5d60b9){return function(_0x2b423e){if(!_0x2b423e){_0x1db61a['sendStatus'](0x194);}return _0x2b423e;};}function handleError(_0x1a4aaa,_0xa2fa87){_0xa2fa87=_0xa2fa87||0x1f4;return function(_0x20ea31){logger['error'](_0x20ea31[_0x31cd('0x25')]);if(_0x20ea31['name']){delete _0x20ea31[_0x31cd('0x26')];}_0x1a4aaa[_0x31cd('0x15')](_0xa2fa87)[_0x31cd('0x27')](_0x20ea31);};}exports[_0x31cd('0x28')]=function(_0x15d675,_0x44b59d){var _0x131816={},_0x3e174c={},_0x2909d2={'count':0x0,'rows':[]};return db[_0x31cd('0x29')]['describe']()[_0x31cd('0x1f')](function(_0x10f453){_0x3e174c['model']=_[_0x31cd('0x2a')](_0x10f453);_0x3e174c[_0x31cd('0x2b')]=_['keys'](_0x15d675['query']);_0x3e174c[_0x31cd('0x2c')]=_[_0x31cd('0x2d')](_0x3e174c['model'],_0x3e174c[_0x31cd('0x2b')]);_0x131816['attributes']=_['intersection'](_0x3e174c['model'],qs['fields'](_0x15d675[_0x31cd('0x2b')]['fields']));_0x131816[_0x31cd('0x2e')]=_0x131816['attributes']['length']?_0x131816[_0x31cd('0x2e')]:_0x3e174c['model'];if(!_0x15d675[_0x31cd('0x2b')][_0x31cd('0x2f')](_0x31cd('0x30'))){_0x131816[_0x31cd('0x19')]=qs[_0x31cd('0x19')](_0x15d675['query']['limit']);_0x131816['offset']=qs[_0x31cd('0x17')](_0x15d675[_0x31cd('0x2b')][_0x31cd('0x17')]);}_0x131816[_0x31cd('0x31')]=qs[_0x31cd('0x32')](_0x15d675['query'][_0x31cd('0x32')]);_0x131816[_0x31cd('0x33')]=qs[_0x31cd('0x2c')](_[_0x31cd('0x34')](_0x15d675[_0x31cd('0x2b')],_0x3e174c[_0x31cd('0x2c')]),_0x10f453);if(_0x15d675[_0x31cd('0x2b')][_0x31cd('0x35')]){_0x131816[_0x31cd('0x33')]=_[_0x31cd('0x36')](_0x131816[_0x31cd('0x33')],{'$or':_[_0x31cd('0x37')](_0x131816[_0x31cd('0x2e')],function(_0x20254c){var _0x3fe8c2={};_0x3fe8c2[_0x20254c]={'$like':'%'+_0x15d675['query']['filter']+'%'};return _0x3fe8c2;})});}_0x131816=_[_0x31cd('0x36')]({},_0x131816,_0x15d675['options']);var _0xb359d6={'where':_0x131816[_0x31cd('0x33')]};return db['CmCompany'][_0x31cd('0x38')](_0xb359d6)['then'](function(_0x2cbdff){_0x2909d2[_0x31cd('0x38')]=_0x2cbdff;if(_0x15d675[_0x31cd('0x2b')][_0x31cd('0x39')]){_0x131816[_0x31cd('0x3a')]=[{'all':!![]}];}return db[_0x31cd('0x29')][_0x31cd('0x3b')](_0x131816);})[_0x31cd('0x1f')](function(_0x41c895){_0x2909d2[_0x31cd('0x3c')]=_0x41c895;return _0x2909d2;})[_0x31cd('0x1f')](respondWithFilteredResult(_0x44b59d,_0x131816))[_0x31cd('0x3d')](handleError(_0x44b59d,null));})['catch'](handleError(_0x44b59d,null));};exports[_0x31cd('0x3e')]=function(_0x3fa0c1,_0x2ff4cf){var _0x2dd58e={'raw':![],'where':{'id':_0x3fa0c1[_0x31cd('0x3f')]['id']}},_0x124b9d={};_0x124b9d['model']=_['keys'](db[_0x31cd('0x29')][_0x31cd('0x40')]);_0x124b9d[_0x31cd('0x2b')]=_['keys'](_0x3fa0c1['query']);_0x124b9d['filters']=_['intersection'](_0x124b9d[_0x31cd('0x41')],_0x124b9d['query']);_0x2dd58e[_0x31cd('0x2e')]=_[_0x31cd('0x2d')](_0x124b9d[_0x31cd('0x41')],qs[_0x31cd('0x42')](_0x3fa0c1['query'][_0x31cd('0x42')]));_0x2dd58e['attributes']=_0x2dd58e[_0x31cd('0x2e')][_0x31cd('0x43')]?_0x2dd58e['attributes']:_0x124b9d['model'];if(_0x3fa0c1[_0x31cd('0x2b')][_0x31cd('0x39')]){_0x2dd58e[_0x31cd('0x3a')]=[{'all':!![]}];}_0x2dd58e=_[_0x31cd('0x36')]({},_0x2dd58e,_0x3fa0c1[_0x31cd('0x44')]);return db[_0x31cd('0x29')][_0x31cd('0x45')](_0x2dd58e)[_0x31cd('0x1f')](handleEntityNotFound(_0x2ff4cf,null))[_0x31cd('0x1f')](respondWithResult(_0x2ff4cf,null))[_0x31cd('0x3d')](handleError(_0x2ff4cf,null));};exports[_0x31cd('0x46')]=function(_0x4beb14,_0x4eb6b0){return db[_0x31cd('0x29')][_0x31cd('0x46')](_0x4beb14[_0x31cd('0x47')],{})['then'](function(_0x18ba8b){var _0x213190=_0x4beb14[_0x31cd('0x48')][_0x31cd('0x21')]({'plain':!![]});if(!_0x213190)throw new Error(_0x31cd('0x49'));if(_0x213190[_0x31cd('0x4a')]===_0x31cd('0x48')){var _0x4bc398=_0x18ba8b[_0x31cd('0x21')]({'plain':!![]});var _0x39b572=_0x31cd('0x22');return db[_0x31cd('0x4b')]['find']({'where':{'name':_0x39b572,'userProfileId':_0x213190[_0x31cd('0x4c')]},'raw':!![]})['then'](function(_0x5296d0){if(_0x5296d0&&_0x5296d0[_0x31cd('0x4d')]===0x0){return db['UserProfileResource'][_0x31cd('0x46')]({'name':_0x4bc398[_0x31cd('0x26')],'resourceId':_0x4bc398['id'],'type':_0x5296d0[_0x31cd('0x26')],'sectionId':_0x5296d0['id']},{})[_0x31cd('0x1f')](function(){return _0x18ba8b;});}else{return _0x18ba8b;}})[_0x31cd('0x3d')](function(_0x2873b9){logger[_0x31cd('0x4e')](_0x31cd('0x4f'),_0x2873b9);throw _0x2873b9;});}return _0x18ba8b;})[_0x31cd('0x1f')](respondWithResult(_0x4eb6b0,0xc9))['catch'](handleError(_0x4eb6b0,null));};exports[_0x31cd('0x1e')]=function(_0x295ea9,_0x56be05){if(_0x295ea9[_0x31cd('0x47')]['id']){delete _0x295ea9[_0x31cd('0x47')]['id'];}return db[_0x31cd('0x29')][_0x31cd('0x45')]({'where':{'id':_0x295ea9[_0x31cd('0x3f')]['id']}})[_0x31cd('0x1f')](handleEntityNotFound(_0x56be05,null))['then'](saveUpdates(_0x295ea9[_0x31cd('0x47')],null))[_0x31cd('0x1f')](respondWithResult(_0x56be05,null))[_0x31cd('0x3d')](handleError(_0x56be05,null));};exports[_0x31cd('0x20')]=function(_0x88dd47,_0x174d98){return db['CmCompany']['find']({'where':{'id':_0x88dd47[_0x31cd('0x3f')]['id']}})[_0x31cd('0x1f')](handleEntityNotFound(_0x174d98,null))[_0x31cd('0x1f')](removeEntity(_0x174d98,null))['catch'](handleError(_0x174d98,null));};exports['describe']=function(_0x59fc08,_0x536c81){return db[_0x31cd('0x29')][_0x31cd('0x50')]()['then'](respondWithResult(_0x536c81,null))['catch'](handleError(_0x536c81,null));};exports[_0x31cd('0x51')]=function(_0xfbdb35,_0x19dd68,_0x333bd8){return db[_0x31cd('0x52')][_0x31cd('0x45')]({'where':{'id':_0xfbdb35['params']['id']}})[_0x31cd('0x1f')](handleEntityNotFound(_0x19dd68,null))[_0x31cd('0x1f')](function(_0x59c362){if(_0x59c362){return _0x59c362['addContacts'](_0xfbdb35[_0x31cd('0x47')][_0x31cd('0x53')],_[_0x31cd('0x54')](_0xfbdb35[_0x31cd('0x47')],[_0x31cd('0x53'),'id'])||{});}})['then'](respondWithResult(_0x19dd68,null))[_0x31cd('0x3d')](handleError(_0x19dd68,null));};exports[_0x31cd('0x55')]=function(_0x4e6664,_0x26c0ef,_0x48ab97){var _0x584efe={};var _0x24d455={};var _0x54c1fb;var _0x413726;return db['CmCompany'][_0x31cd('0x56')]({'where':{'id':_0x4e6664[_0x31cd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x26c0ef,null))['then'](function(_0x5c7c4e){if(_0x5c7c4e){_0x54c1fb=_0x5c7c4e;_0x24d455[_0x31cd('0x41')]=_[_0x31cd('0x2a')](db['CmContact'][_0x31cd('0x40')]);_0x24d455[_0x31cd('0x2b')]=_['keys'](_0x4e6664['query']);_0x24d455[_0x31cd('0x2c')]=_[_0x31cd('0x2d')](_0x24d455[_0x31cd('0x41')],_0x24d455[_0x31cd('0x2b')]);_0x584efe[_0x31cd('0x2e')]=_[_0x31cd('0x2d')](_0x24d455[_0x31cd('0x41')],qs[_0x31cd('0x42')](_0x4e6664['query'][_0x31cd('0x42')]));_0x584efe[_0x31cd('0x2e')]=_0x584efe[_0x31cd('0x2e')][_0x31cd('0x43')]?_0x584efe[_0x31cd('0x2e')]:_0x24d455[_0x31cd('0x41')];_0x584efe['order']=qs[_0x31cd('0x32')](_0x4e6664[_0x31cd('0x2b')][_0x31cd('0x32')]);_0x584efe[_0x31cd('0x33')]=qs[_0x31cd('0x2c')](_[_0x31cd('0x34')](_0x4e6664[_0x31cd('0x2b')],_0x24d455[_0x31cd('0x2c')]));if(_0x4e6664[_0x31cd('0x2b')][_0x31cd('0x35')]){_0x584efe[_0x31cd('0x33')]=_[_0x31cd('0x36')](_0x584efe[_0x31cd('0x33')],{'$or':_[_0x31cd('0x37')](_0x584efe[_0x31cd('0x2e')],function(_0x3c5e31){var _0xe7f42e={};_0xe7f42e[_0x3c5e31]={'$like':'%'+_0x4e6664[_0x31cd('0x2b')][_0x31cd('0x35')]+'%'};return _0xe7f42e;})});}_0x584efe=_[_0x31cd('0x36')]({},_0x584efe,_0x4e6664[_0x31cd('0x44')]);return _0x54c1fb[_0x31cd('0x55')](_0x584efe);}})[_0x31cd('0x1f')](function(_0x44d75a){if(_0x44d75a){_0x413726=_0x44d75a[_0x31cd('0x43')];if(!_0x4e6664[_0x31cd('0x2b')][_0x31cd('0x2f')](_0x31cd('0x30'))){_0x584efe[_0x31cd('0x19')]=qs[_0x31cd('0x19')](_0x4e6664[_0x31cd('0x2b')][_0x31cd('0x19')]);_0x584efe[_0x31cd('0x17')]=qs['offset'](_0x4e6664['query']['offset']);}return _0x54c1fb[_0x31cd('0x55')](_0x584efe);}})[_0x31cd('0x1f')](function(_0x3b31b6){if(_0x3b31b6){return _0x3b31b6?{'count':_0x413726,'rows':_0x3b31b6}:null;}})[_0x31cd('0x1f')](respondWithResult(_0x26c0ef,null))['catch'](handleError(_0x26c0ef,null));}; \ No newline at end of file +var _0x99ee=['role','userProfileId','autoAssociation','UserProfileResource','params','addContacts','CmContact','ids','getContacts','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','destroy','get','Companies','then','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x522a0c,_0x32ba4e){var _0x194106=function(_0x5691ac){while(--_0x5691ac){_0x522a0c['push'](_0x522a0c['shift']());}};_0x194106(++_0x32ba4e);}(_0x99ee,0x157));var _0xe99e=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x99ee[_0xaa6a4];return _0xdc31a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe99e('0x0'));var zipdir=require(_0xe99e('0x1'));var jsonpatch=require(_0xe99e('0x2'));var rp=require(_0xe99e('0x3'));var moment=require('moment');var BPromise=require(_0xe99e('0x4'));var Mustache=require('mustache');var util=require(_0xe99e('0x5'));var path=require('path');var sox=require(_0xe99e('0x6'));var csv=require(_0xe99e('0x7'));var ejs=require(_0xe99e('0x8'));var fs=require('fs');var fs_extra=require(_0xe99e('0x9'));var _=require(_0xe99e('0xa'));var squel=require('squel');var crypto=require(_0xe99e('0xb'));var jsforce=require(_0xe99e('0xc'));var deskjs=require(_0xe99e('0xd'));var toCsv=require(_0xe99e('0x7'));var querystring=require('querystring');var Papa=require(_0xe99e('0xe'));var Redis=require(_0xe99e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe99e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe99e('0x11'))(_0xe99e('0x12'));var utils=require(_0xe99e('0x13'));var config=require(_0xe99e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe99e('0x15'))['db'];function respondWithStatusCode(_0x2aa1d9,_0x33ea2a){_0x33ea2a=_0x33ea2a||0xcc;return function(_0x27a3d4){if(_0x27a3d4){return _0x2aa1d9[_0xe99e('0x16')](_0x33ea2a);}return _0x2aa1d9[_0xe99e('0x17')](_0x33ea2a)[_0xe99e('0x18')]();};}function respondWithResult(_0x2c8f53,_0x53da2e){_0x53da2e=_0x53da2e||0xc8;return function(_0x2c3299){if(_0x2c3299){return _0x2c8f53['status'](_0x53da2e)['json'](_0x2c3299);}};}function respondWithFilteredResult(_0x1fb223,_0x17e057){return function(_0x528a05){if(_0x528a05){var _0x4b0ad6=typeof _0x17e057[_0xe99e('0x19')]===_0xe99e('0x1a')&&typeof _0x17e057[_0xe99e('0x1b')]===_0xe99e('0x1a');var _0x3156d3=_0x528a05['count'];var _0x54688f=_0x4b0ad6?0x0:_0x17e057[_0xe99e('0x19')];var _0x5e252c=_0x4b0ad6?_0x528a05[_0xe99e('0x1c')]:_0x17e057[_0xe99e('0x19')]+_0x17e057['limit'];var _0x540733;if(_0x5e252c>=_0x3156d3){_0x5e252c=_0x3156d3;_0x540733=0xc8;}else{_0x540733=0xce;}_0x1fb223['status'](_0x540733);return _0x1fb223['set'](_0xe99e('0x1d'),_0x54688f+'-'+_0x5e252c+'/'+_0x3156d3)['json'](_0x528a05);}return null;};}function patchUpdates(_0x29d840){return function(_0x33785f){try{jsonpatch['apply'](_0x33785f,_0x29d840,!![]);}catch(_0x28cff8){return BPromise[_0xe99e('0x1e')](_0x28cff8);}return _0x33785f[_0xe99e('0x1f')]();};}function saveUpdates(_0x10a9ec,_0x5cfd97){return function(_0xf32ac){if(_0xf32ac){return _0xf32ac['update'](_0x10a9ec)['then'](function(_0x271f28){return _0x271f28;});}return null;};}function removeEntity(_0xabe043,_0x432ce1){return function(_0x43360b){if(_0x43360b){return _0x43360b[_0xe99e('0x20')]()['then'](function(){var _0x442365=_0x43360b[_0xe99e('0x21')]({'plain':!![]});var _0x3b3a9a=_0xe99e('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b3a9a,'resourceId':_0x442365['id']}})[_0xe99e('0x23')](function(){return _0x43360b;});})[_0xe99e('0x23')](function(){_0xabe043['status'](0xcc)[_0xe99e('0x18')]();});}};}function handleEntityNotFound(_0x209ea7,_0x54a5ba){return function(_0x12bf5c){if(!_0x12bf5c){_0x209ea7[_0xe99e('0x16')](0x194);}return _0x12bf5c;};}function handleError(_0x21711b,_0x79edd9){_0x79edd9=_0x79edd9||0x1f4;return function(_0x139ab3){logger[_0xe99e('0x24')](_0x139ab3[_0xe99e('0x25')]);if(_0x139ab3[_0xe99e('0x26')]){delete _0x139ab3['name'];}_0x21711b[_0xe99e('0x17')](_0x79edd9)[_0xe99e('0x27')](_0x139ab3);};}exports[_0xe99e('0x28')]=function(_0x566e39,_0x38082e){var _0x9da73d={},_0x2c8c62={},_0x37a374={'count':0x0,'rows':[]};return db[_0xe99e('0x29')][_0xe99e('0x2a')]()[_0xe99e('0x23')](function(_0x2e0c54){_0x2c8c62[_0xe99e('0x2b')]=_['keys'](_0x2e0c54);_0x2c8c62[_0xe99e('0x2c')]=_[_0xe99e('0x2d')](_0x566e39[_0xe99e('0x2c')]);_0x2c8c62[_0xe99e('0x2e')]=_[_0xe99e('0x2f')](_0x2c8c62[_0xe99e('0x2b')],_0x2c8c62[_0xe99e('0x2c')]);_0x9da73d['attributes']=_[_0xe99e('0x2f')](_0x2c8c62[_0xe99e('0x2b')],qs[_0xe99e('0x30')](_0x566e39['query'][_0xe99e('0x30')]));_0x9da73d[_0xe99e('0x31')]=_0x9da73d['attributes'][_0xe99e('0x32')]?_0x9da73d[_0xe99e('0x31')]:_0x2c8c62[_0xe99e('0x2b')];if(!_0x566e39[_0xe99e('0x2c')][_0xe99e('0x33')]('nolimit')){_0x9da73d[_0xe99e('0x1b')]=qs[_0xe99e('0x1b')](_0x566e39['query'][_0xe99e('0x1b')]);_0x9da73d[_0xe99e('0x19')]=qs[_0xe99e('0x19')](_0x566e39[_0xe99e('0x2c')][_0xe99e('0x19')]);}_0x9da73d[_0xe99e('0x34')]=qs[_0xe99e('0x35')](_0x566e39['query'][_0xe99e('0x35')]);_0x9da73d[_0xe99e('0x36')]=qs[_0xe99e('0x2e')](_[_0xe99e('0x37')](_0x566e39['query'],_0x2c8c62[_0xe99e('0x2e')]),_0x2e0c54);if(_0x566e39[_0xe99e('0x2c')][_0xe99e('0x38')]){_0x9da73d[_0xe99e('0x36')]=_[_0xe99e('0x39')](_0x9da73d[_0xe99e('0x36')],{'$or':_[_0xe99e('0x3a')](_0x9da73d[_0xe99e('0x31')],function(_0x21fa60){var _0x49c70a={};_0x49c70a[_0x21fa60]={'$like':'%'+_0x566e39['query']['filter']+'%'};return _0x49c70a;})});}_0x9da73d=_['merge']({},_0x9da73d,_0x566e39[_0xe99e('0x3b')]);var _0x411e5a={'where':_0x9da73d['where']};return db[_0xe99e('0x29')][_0xe99e('0x1c')](_0x411e5a)[_0xe99e('0x23')](function(_0x4b788b){_0x37a374['count']=_0x4b788b;if(_0x566e39[_0xe99e('0x2c')][_0xe99e('0x3c')]){_0x9da73d[_0xe99e('0x3d')]=[{'all':!![]}];}return db[_0xe99e('0x29')][_0xe99e('0x3e')](_0x9da73d);})[_0xe99e('0x23')](function(_0x1f5af4){_0x37a374[_0xe99e('0x3f')]=_0x1f5af4;return _0x37a374;})[_0xe99e('0x23')](respondWithFilteredResult(_0x38082e,_0x9da73d))[_0xe99e('0x40')](handleError(_0x38082e,null));})['catch'](handleError(_0x38082e,null));};exports[_0xe99e('0x41')]=function(_0xdc4438,_0x4408fe){var _0x3cced4={'raw':![],'where':{'id':_0xdc4438['params']['id']}},_0x5c124d={};_0x5c124d[_0xe99e('0x2b')]=_[_0xe99e('0x2d')](db['CmCompany'][_0xe99e('0x42')]);_0x5c124d[_0xe99e('0x2c')]=_[_0xe99e('0x2d')](_0xdc4438['query']);_0x5c124d['filters']=_[_0xe99e('0x2f')](_0x5c124d[_0xe99e('0x2b')],_0x5c124d[_0xe99e('0x2c')]);_0x3cced4['attributes']=_[_0xe99e('0x2f')](_0x5c124d[_0xe99e('0x2b')],qs[_0xe99e('0x30')](_0xdc4438[_0xe99e('0x2c')][_0xe99e('0x30')]));_0x3cced4[_0xe99e('0x31')]=_0x3cced4[_0xe99e('0x31')]['length']?_0x3cced4[_0xe99e('0x31')]:_0x5c124d[_0xe99e('0x2b')];if(_0xdc4438[_0xe99e('0x2c')]['includeAll']){_0x3cced4[_0xe99e('0x3d')]=[{'all':!![]}];}_0x3cced4=_[_0xe99e('0x39')]({},_0x3cced4,_0xdc4438[_0xe99e('0x3b')]);return db[_0xe99e('0x29')][_0xe99e('0x43')](_0x3cced4)['then'](handleEntityNotFound(_0x4408fe,null))[_0xe99e('0x23')](respondWithResult(_0x4408fe,null))['catch'](handleError(_0x4408fe,null));};exports[_0xe99e('0x44')]=function(_0x52a010,_0x55ffc8){return db[_0xe99e('0x29')]['create'](_0x52a010[_0xe99e('0x45')],{})[_0xe99e('0x23')](function(_0x12554f){var _0xd558c4=_0x52a010[_0xe99e('0x46')][_0xe99e('0x21')]({'plain':!![]});if(!_0xd558c4)throw new Error(_0xe99e('0x47'));if(_0xd558c4[_0xe99e('0x48')]==='user'){var _0x71aa43=_0x12554f['get']({'plain':!![]});var _0x35f231=_0xe99e('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x35f231,'userProfileId':_0xd558c4[_0xe99e('0x49')]},'raw':!![]})[_0xe99e('0x23')](function(_0x9058d9){if(_0x9058d9&&_0x9058d9[_0xe99e('0x4a')]===0x0){return db[_0xe99e('0x4b')][_0xe99e('0x44')]({'name':_0x71aa43[_0xe99e('0x26')],'resourceId':_0x71aa43['id'],'type':_0x9058d9[_0xe99e('0x26')],'sectionId':_0x9058d9['id']},{})[_0xe99e('0x23')](function(){return _0x12554f;});}else{return _0x12554f;}})[_0xe99e('0x40')](function(_0x342fc0){logger[_0xe99e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x342fc0);throw _0x342fc0;});}return _0x12554f;})[_0xe99e('0x23')](respondWithResult(_0x55ffc8,0xc9))[_0xe99e('0x40')](handleError(_0x55ffc8,null));};exports['update']=function(_0x5928f3,_0x121492){if(_0x5928f3[_0xe99e('0x45')]['id']){delete _0x5928f3[_0xe99e('0x45')]['id'];}return db[_0xe99e('0x29')][_0xe99e('0x43')]({'where':{'id':_0x5928f3['params']['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x121492,null))[_0xe99e('0x23')](saveUpdates(_0x5928f3[_0xe99e('0x45')],null))[_0xe99e('0x23')](respondWithResult(_0x121492,null))['catch'](handleError(_0x121492,null));};exports[_0xe99e('0x20')]=function(_0xffa9e6,_0x36ad97){return db[_0xe99e('0x29')]['find']({'where':{'id':_0xffa9e6[_0xe99e('0x4c')]['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x36ad97,null))[_0xe99e('0x23')](removeEntity(_0x36ad97,null))['catch'](handleError(_0x36ad97,null));};exports['describe']=function(_0xd77be9,_0x230f02){return db[_0xe99e('0x29')]['describe']()[_0xe99e('0x23')](respondWithResult(_0x230f02,null))[_0xe99e('0x40')](handleError(_0x230f02,null));};exports[_0xe99e('0x4d')]=function(_0x27593e,_0x37cc70,_0x488457){return db[_0xe99e('0x4e')][_0xe99e('0x43')]({'where':{'id':_0x27593e[_0xe99e('0x4c')]['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x37cc70,null))[_0xe99e('0x23')](function(_0x155656){if(_0x155656){return _0x155656[_0xe99e('0x4d')](_0x27593e[_0xe99e('0x45')]['ids'],_['omit'](_0x27593e[_0xe99e('0x45')],[_0xe99e('0x4f'),'id'])||{});}})[_0xe99e('0x23')](respondWithResult(_0x37cc70,null))[_0xe99e('0x40')](handleError(_0x37cc70,null));};exports[_0xe99e('0x50')]=function(_0x199566,_0x28c495,_0x34b871){var _0x24ee36={};var _0x440343={};var _0x430678;var _0x23bc14;return db[_0xe99e('0x29')][_0xe99e('0x51')]({'where':{'id':_0x199566[_0xe99e('0x4c')]['id']}})[_0xe99e('0x23')](handleEntityNotFound(_0x28c495,null))[_0xe99e('0x23')](function(_0x32a3e7){if(_0x32a3e7){_0x430678=_0x32a3e7;_0x440343[_0xe99e('0x2b')]=_['keys'](db[_0xe99e('0x4e')][_0xe99e('0x42')]);_0x440343[_0xe99e('0x2c')]=_[_0xe99e('0x2d')](_0x199566[_0xe99e('0x2c')]);_0x440343[_0xe99e('0x2e')]=_[_0xe99e('0x2f')](_0x440343[_0xe99e('0x2b')],_0x440343[_0xe99e('0x2c')]);_0x24ee36[_0xe99e('0x31')]=_[_0xe99e('0x2f')](_0x440343[_0xe99e('0x2b')],qs[_0xe99e('0x30')](_0x199566[_0xe99e('0x2c')][_0xe99e('0x30')]));_0x24ee36['attributes']=_0x24ee36['attributes']['length']?_0x24ee36[_0xe99e('0x31')]:_0x440343['model'];_0x24ee36[_0xe99e('0x34')]=qs['sort'](_0x199566[_0xe99e('0x2c')][_0xe99e('0x35')]);_0x24ee36[_0xe99e('0x36')]=qs[_0xe99e('0x2e')](_['pick'](_0x199566['query'],_0x440343['filters']));if(_0x199566['query']['filter']){_0x24ee36[_0xe99e('0x36')]=_[_0xe99e('0x39')](_0x24ee36[_0xe99e('0x36')],{'$or':_['map'](_0x24ee36[_0xe99e('0x31')],function(_0x378753){var _0x42c9d1={};_0x42c9d1[_0x378753]={'$like':'%'+_0x199566[_0xe99e('0x2c')][_0xe99e('0x38')]+'%'};return _0x42c9d1;})});}_0x24ee36=_['merge']({},_0x24ee36,_0x199566[_0xe99e('0x3b')]);return _0x430678['getContacts'](_0x24ee36);}})[_0xe99e('0x23')](function(_0x5a7ea5){if(_0x5a7ea5){_0x23bc14=_0x5a7ea5[_0xe99e('0x32')];if(!_0x199566[_0xe99e('0x2c')][_0xe99e('0x33')](_0xe99e('0x52'))){_0x24ee36[_0xe99e('0x1b')]=qs['limit'](_0x199566[_0xe99e('0x2c')][_0xe99e('0x1b')]);_0x24ee36[_0xe99e('0x19')]=qs[_0xe99e('0x19')](_0x199566[_0xe99e('0x2c')][_0xe99e('0x19')]);}return _0x430678[_0xe99e('0x50')](_0x24ee36);}})[_0xe99e('0x23')](function(_0x308d20){if(_0x308d20){return _0x308d20?{'count':_0x23bc14,'rows':_0x308d20}:null;}})[_0xe99e('0x23')](respondWithResult(_0x28c495,null))[_0xe99e('0x40')](handleError(_0x28c495,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7ee02bd..753c040 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 _0x6ad4=['util','../../config/logger','api','moment','request-promise','path','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x55d244,_0x3bf14d){var _0x422d81=function(_0x1bc601){while(--_0x1bc601){_0x55d244['push'](_0x55d244['shift']());}};_0x422d81(++_0x3bf14d);}(_0x6ad4,0xb0));var _0x46ad=function(_0x713a7a,_0x1b8603){_0x713a7a=_0x713a7a-0x0;var _0x5cd8b6=_0x6ad4[_0x713a7a];return _0x5cd8b6;};'use strict';var _=require('lodash');var util=require(_0x46ad('0x0'));var logger=require(_0x46ad('0x1'))(_0x46ad('0x2'));var moment=require(_0x46ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x46ad('0x4'));var fs=require('fs');var path=require(_0x46ad('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x46ad('0x6'));module[_0x46ad('0x7')]=function(_0x2c0ae9,_0x2c54fd){return _0x2c0ae9[_0x46ad('0x8')](_0x46ad('0x9'),attributes,{'tableName':_0x46ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49e9=['util','../../config/logger','request-promise','path','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x482ea4,_0x38e290){var _0x3e7cef=function(_0x41a909){while(--_0x41a909){_0x482ea4['push'](_0x482ea4['shift']());}};_0x3e7cef(++_0x38e290);}(_0x49e9,0x117));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var logger=require(_0x949e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x949e('0x3'));var fs=require('fs');var path=require(_0x949e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x949e('0x5'));module[_0x949e('0x6')]=function(_0x3e97da,_0x1958a2){return _0x3e97da[_0x949e('0x7')](_0x949e('0x8'),attributes,{'tableName':_0x949e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 9144cd7..57f0240 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 _0x6c04=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x6c04,0x78));var _0x46c0=function(_0x1aa188,_0x5a2c1b){_0x1aa188=_0x1aa188-0x0;var _0x40a8e3=_0x6c04[_0x1aa188];return _0x40a8e3;};'use strict';var _=require('lodash');var util=require(_0x46c0('0x0'));var moment=require(_0x46c0('0x1'));var BPromise=require(_0x46c0('0x2'));var rs=require(_0x46c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c0('0x4'))['db'];var utils=require(_0x46c0('0x5'));var logger=require(_0x46c0('0x6'))('rpc');var config=require(_0x46c0('0x7'));var jayson=require(_0x46c0('0x8'));var client=jayson['client'][_0x46c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x75c20b,_0x24f51f,_0x310f96){return new BPromise(function(_0x8f03b2,_0x3900fe){return client[_0x46c0('0xa')](_0x75c20b,_0x310f96)['then'](function(_0x4a6000){logger[_0x46c0('0xb')](_0x46c0('0xc'),_0x24f51f,_0x46c0('0xd'));logger[_0x46c0('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x24f51f,_0x46c0('0xd'),JSON['stringify'](_0x4a6000));if(_0x4a6000[_0x46c0('0xf')]){if(_0x4a6000[_0x46c0('0xf')][_0x46c0('0x10')]===0x1f4){logger[_0x46c0('0xf')]('CmCompany,\x20%s,\x20%s',_0x24f51f,_0x4a6000[_0x46c0('0xf')][_0x46c0('0x11')]);return _0x3900fe(_0x4a6000['error']['message']);}logger['error'](_0x46c0('0xc'),_0x24f51f,_0x4a6000[_0x46c0('0xf')][_0x46c0('0x11')]);return _0x8f03b2(_0x4a6000['error']['message']);}else{logger['info'](_0x46c0('0xc'),_0x24f51f,_0x46c0('0xd'));_0x8f03b2(_0x4a6000[_0x46c0('0x12')][_0x46c0('0x11')]);}})[_0x46c0('0x13')](function(_0x3a7c45){logger['error']('CmCompany,\x20%s,\x20%s',_0x24f51f,_0x3a7c45);_0x3900fe(_0x3a7c45);});});} \ No newline at end of file +var _0x7b4b=['http','then','info','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x49e5bc,_0x22576f){var _0x27c672=function(_0x185798){while(--_0x185798){_0x49e5bc['push'](_0x49e5bc['shift']());}};_0x27c672(++_0x22576f);}(_0x7b4b,0x1ad));var _0xb7b4=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x7b4b[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xb7b4('0x0'));var util=require(_0xb7b4('0x1'));var moment=require(_0xb7b4('0x2'));var BPromise=require(_0xb7b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7b4('0x4'))['db'];var utils=require(_0xb7b4('0x5'));var logger=require(_0xb7b4('0x6'))(_0xb7b4('0x7'));var config=require(_0xb7b4('0x8'));var jayson=require(_0xb7b4('0x9'));var client=jayson[_0xb7b4('0xa')][_0xb7b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x203f2f,_0x5a4ee5,_0x69de6f){return new BPromise(function(_0x864ce9,_0x448747){return client['request'](_0x203f2f,_0x69de6f)[_0xb7b4('0xc')](function(_0x670b20){logger[_0xb7b4('0xd')]('CmCompany,\x20%s,\x20%s',_0x5a4ee5,'request\x20sent');logger['debug'](_0xb7b4('0xe'),_0x5a4ee5,_0xb7b4('0xf'),JSON['stringify'](_0x670b20));if(_0x670b20[_0xb7b4('0x10')]){if(_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x11')]===0x1f4){logger[_0xb7b4('0x10')](_0xb7b4('0x12'),_0x5a4ee5,_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);return _0x448747(_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);}logger[_0xb7b4('0x10')](_0xb7b4('0x12'),_0x5a4ee5,_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);return _0x864ce9(_0x670b20[_0xb7b4('0x10')][_0xb7b4('0x13')]);}else{logger['info'](_0xb7b4('0x12'),_0x5a4ee5,_0xb7b4('0xf'));_0x864ce9(_0x670b20[_0xb7b4('0x14')][_0xb7b4('0x13')]);}})[_0xb7b4('0x15')](function(_0x2d70a5){logger[_0xb7b4('0x10')](_0xb7b4('0x12'),_0x5a4ee5,_0x2d70a5);_0x448747(_0x2d70a5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1f05343..1b6b960 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 _0x003f=['index','get','/describe','describe','/:id','show','getContacts','post','/:id/contacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x003f,0x16c));var _0xf003=function(_0x2046b8,_0x310c75){_0x2046b8=_0x2046b8-0x0;var _0x5ceb92=_0x003f[_0x2046b8];return _0x5ceb92;};'use strict';var multer=require(_0xf003('0x0'));var util=require(_0xf003('0x1'));var path=require(_0xf003('0x2'));var timeout=require(_0xf003('0x3'));var express=require(_0xf003('0x4'));var router=express[_0xf003('0x5')]();var fs_extra=require(_0xf003('0x6'));var auth=require(_0xf003('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf003('0x8'));var controller=require(_0xf003('0x9'));router['get']('/',auth[_0xf003('0xa')](),controller[_0xf003('0xb')]);router[_0xf003('0xc')](_0xf003('0xd'),auth[_0xf003('0xa')](),controller[_0xf003('0xe')]);router['get'](_0xf003('0xf'),auth[_0xf003('0xa')](),controller[_0xf003('0x10')]);router[_0xf003('0xc')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xf003('0x11')]);router[_0xf003('0x12')]('/',auth[_0xf003('0xa')](),controller['create']);router[_0xf003('0x12')](_0xf003('0x13'),auth[_0xf003('0xa')](),controller['addContacts']);router[_0xf003('0x14')](_0xf003('0xf'),auth[_0xf003('0xa')](),controller[_0xf003('0x15')]);router[_0xf003('0x16')](_0xf003('0xf'),auth[_0xf003('0xa')](),controller[_0xf003('0x17')]);module[_0xf003('0x18')]=router; \ No newline at end of file +var _0x7cf6=['create','addContacts','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id/contacts','getContacts','post'];(function(_0xe9c732,_0x125b29){var _0x2e6559=function(_0x1463d5){while(--_0x1463d5){_0xe9c732['push'](_0xe9c732['shift']());}};_0x2e6559(++_0x125b29);}(_0x7cf6,0x125));var _0x67cf=function(_0x2a5297,_0x577f67){_0x2a5297=_0x2a5297-0x0;var _0x261070=_0x7cf6[_0x2a5297];return _0x261070;};'use strict';var multer=require(_0x67cf('0x0'));var util=require('util');var path=require(_0x67cf('0x1'));var timeout=require(_0x67cf('0x2'));var express=require(_0x67cf('0x3'));var router=express['Router']();var fs_extra=require(_0x67cf('0x4'));var auth=require(_0x67cf('0x5'));var interaction=require(_0x67cf('0x6'));var config=require(_0x67cf('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x67cf('0x8')]);router[_0x67cf('0x9')]('/describe',auth[_0x67cf('0xa')](),controller[_0x67cf('0xb')]);router[_0x67cf('0x9')]('/:id',auth[_0x67cf('0xa')](),controller['show']);router[_0x67cf('0x9')](_0x67cf('0xc'),auth[_0x67cf('0xa')](),controller[_0x67cf('0xd')]);router[_0x67cf('0xe')]('/',auth[_0x67cf('0xa')](),controller[_0x67cf('0xf')]);router[_0x67cf('0xe')](_0x67cf('0xc'),auth[_0x67cf('0xa')](),controller[_0x67cf('0x10')]);router['put'](_0x67cf('0x11'),auth[_0x67cf('0xa')](),controller[_0x67cf('0x12')]);router[_0x67cf('0x13')](_0x67cf('0x11'),auth[_0x67cf('0xa')](),controller[_0x67cf('0x14')]);module[_0x67cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 00f81e7..632fd09 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 _0xe185=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe185,0xd9));var _0x5e18=function(_0x32126f,_0x23446b){_0x32126f=_0x32126f-0x0;var _0x9af1be=_0xe185[_0x32126f];return _0x9af1be;};'use strict';var _=require(_0x5e18('0x0'));var Sequelize=require(_0x5e18('0x1'));module[_0x5e18('0x2')]={'firstName':{'type':Sequelize[_0x5e18('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5e18('0x3')]},'street':{'type':Sequelize[_0x5e18('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5e18('0x3')]},'country':{'type':Sequelize[_0x5e18('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5e18('0x3')]},'description':{'type':Sequelize[_0x5e18('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5e18('0x3')]},'fax':{'type':Sequelize[_0x5e18('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x5e18('0x3')]},'facebook':{'type':Sequelize[_0x5e18('0x3')]},'fb_data':{'type':Sequelize[_0x5e18('0x3')]},'twitter':{'type':Sequelize[_0x5e18('0x3')]},'skype':{'type':Sequelize[_0x5e18('0x3')]},'teams':{'type':Sequelize[_0x5e18('0x3')]},'viber':{'type':Sequelize[_0x5e18('0x3')]},'line':{'type':Sequelize[_0x5e18('0x3')]},'wechat':{'type':Sequelize[_0x5e18('0x3')]},'telegram':{'type':Sequelize[_0x5e18('0x3')]},'UserId':{'type':Sequelize[_0x5e18('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x5e18('0x3')]},'priority':{'type':Sequelize[_0x5e18('0x5')](0x2)[_0x5e18('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5e18('0x7')],'defaultValue':Sequelize[_0x5e18('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa4d1=['UNSIGNED','DATE','NOW','STRING','TEXT','INTEGER'];(function(_0x468e6c,_0x5e150b){var _0x54c64b=function(_0x44559f){while(--_0x44559f){_0x468e6c['push'](_0x468e6c['shift']());}};_0x54c64b(++_0x5e150b);}(_0xa4d1,0x17d));var _0x1a4d=function(_0x26764f,_0x43f4e7){_0x26764f=_0x26764f-0x0;var _0x53c715=_0xa4d1[_0x26764f];return _0x53c715;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x1a4d('0x0')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1a4d('0x0')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1a4d('0x0')]},'city':{'type':Sequelize[_0x1a4d('0x0')]},'country':{'type':Sequelize[_0x1a4d('0x0')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a4d('0x1')]},'phone':{'type':Sequelize[_0x1a4d('0x0')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1a4d('0x0')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1a4d('0x0')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1a4d('0x0')]},'viber':{'type':Sequelize[_0x1a4d('0x0')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1a4d('0x0')]},'telegram':{'type':Sequelize[_0x1a4d('0x0')]},'UserId':{'type':Sequelize[_0x1a4d('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x1a4d('0x0')]},'priority':{'type':Sequelize[_0x1a4d('0x2')](0x2)[_0x1a4d('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1a4d('0x4')],'defaultValue':Sequelize[_0x1a4d('0x5')]},'dialTimezone':{'type':Sequelize[_0x1a4d('0x0')]},'utcOffset':{'type':Sequelize[_0x1a4d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b151fa6..9ef9a4d 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 _0x87b8=['all','Tag','Tags','color','CmContactHasItem','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','get','$and','map','format','cf_%d','omit','pickBy','startsWith','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','sequelize','text','phone','CmHopper','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','ids','OrderBy','items','item_types','ItemTypeId','description','item','PHONE','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','rows','getHopperHistories','include','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','file','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','child_process','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','createdAt','DESC','VoiceCallReport','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','count','set','update','then','destroy','sendStatus','error','stack','name','send','index','describe','getOptions','query','user','catch','CmContact','find','params','tags','keys','cf_','columnName','displayName','analytics','CmCustomField','findAll','custom','type','values','info','forEach','hasOwnProperty','merge','body','length','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','isNil','dialTimezone','timezones','utcOffset','create','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','spread','contact'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x87b8,0x1a9));var _0x887b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87b8[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x887b('0x0'));var BPromise=require(_0x887b('0x1'));var util=require(_0x887b('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x887b('0x3'));var squel=require(_0x887b('0x4'));var Papa=require(_0x887b('0x5'));var Redis=require(_0x887b('0x6'));var contacts=require('../../components/contacts');var qs=require(_0x887b('0x7'));var logger=require(_0x887b('0x8'))(_0x887b('0x9'));var config=require(_0x887b('0xa'));var shared=require('../../config/environment/shared');var db=require(_0x887b('0xb'))['db'];config[_0x887b('0xc')]=_[_0x887b('0xd')](config[_0x887b('0xc')],{'host':_0x887b('0xe'),'port':0x18eb});var socket=require(_0x887b('0xf'))(new Redis(config[_0x887b('0xc')]));require(_0x887b('0x10'))[_0x887b('0x11')](socket);function respondWithResult(_0xc4eae5,_0x108261){_0x108261=_0x108261||0xc8;return function(_0x4b47d9){if(_0x4b47d9){return _0xc4eae5[_0x887b('0x12')](_0x108261)[_0x887b('0x13')](_0x4b47d9);}};}function respondWithFilteredResult(_0x59cdf3,_0x295ec6){return function(_0x3746a9){if(_0x3746a9){var _0x9d7929=typeof _0x295ec6[_0x887b('0x14')]==='undefined'&&typeof _0x295ec6[_0x887b('0x15')]==='undefined';var _0x29f35c=_0x3746a9[_0x887b('0x16')];var _0xe58c50=_0x9d7929?0x0:_0x295ec6['offset'];var _0x278ed8=_0x9d7929?_0x3746a9[_0x887b('0x16')]:_0x295ec6[_0x887b('0x14')]+_0x295ec6['limit'];var _0x114dde;if(_0x278ed8>=_0x29f35c){_0x278ed8=_0x29f35c;_0x114dde=0xc8;}else{_0x114dde=0xce;}_0x59cdf3[_0x887b('0x12')](_0x114dde);return _0x59cdf3[_0x887b('0x17')]('Content-Range',_0xe58c50+'-'+_0x278ed8+'/'+_0x29f35c)[_0x887b('0x13')](_0x3746a9);}return null;};}function saveUpdates(_0x58697f){return function(_0x44e68f){if(_0x44e68f){return _0x44e68f[_0x887b('0x18')](_0x58697f)[_0x887b('0x19')](function(_0x3acbe4){return _0x3acbe4;});}return null;};}function removeEntity(_0x572c2e){return function(_0x306333){if(_0x306333){return _0x306333[_0x887b('0x1a')]()[_0x887b('0x19')](function(){_0x572c2e[_0x887b('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43318a){return function(_0x676317){if(!_0x676317){_0x43318a[_0x887b('0x1b')](0x194);}return _0x676317;};}function handleError(_0x151b77,_0x441ca7){_0x441ca7=_0x441ca7||0x1f4;return function(_0x4cfbe7){logger[_0x887b('0x1c')](_0x4cfbe7[_0x887b('0x1d')]);if(_0x4cfbe7[_0x887b('0x1e')]){delete _0x4cfbe7[_0x887b('0x1e')];}_0x151b77['status'](_0x441ca7)[_0x887b('0x1f')](_0x4cfbe7);};}exports[_0x887b('0x20')]=function(_0x411720,_0x46a145){var _0x384c3f={};return contacts[_0x887b('0x21')]()[_0x887b('0x19')](function(_0x86d671){_0x384c3f=qs[_0x887b('0x22')](_0x86d671,_0x411720);return contacts['findAll'](_0x411720[_0x887b('0x23')],_0x411720[_0x887b('0x24')],_0x384c3f,_0x86d671);})[_0x887b('0x19')](respondWithFilteredResult(_0x46a145,_0x384c3f))[_0x887b('0x25')](handleError(_0x46a145,null));};exports[_0x887b('0x1a')]=function(_0x9d5611,_0x512f0d){return db[_0x887b('0x26')][_0x887b('0x27')]({'where':{'id':_0x9d5611[_0x887b('0x28')]['id']}})[_0x887b('0x19')](handleEntityNotFound(_0x512f0d,null))['then'](removeEntity(_0x512f0d,null))[_0x887b('0x25')](handleError(_0x512f0d,null));};exports['describe']=function(_0x54f683,_0x2c467a){return db[_0x887b('0x26')]['describe']()['then'](function(_0x2b5b82){delete _0x2b5b82[_0x887b('0x29')];for(var _0x3f8bf1=0x0;_0x3f8bf10x0){return new Promise(function(_0x43a406){var _0x529fb7=[];for(var _0x29e49f=0x0;_0x29e49f<_0x13b294[_0x887b('0x39')];_0x29e49f++){_0x529fb7[_0x887b('0x60')](insertAdditionalPhones(_0x13b294[_0x29e49f][_0x887b('0x64')],_0x13b294[_0x29e49f]['additionalPhones']));}Promise[_0x887b('0x65')](_0x529fb7)[_0x887b('0x19')](function(){_0x43a406(0x1);});})[_0x887b('0x19')](function(){return{'success':_0x4a2ea9,'failure':_0x254b90,'duplicates':_0x2eb594};});}else{return{'success':_0x4a2ea9,'failure':_0x254b90,'duplicates':_0x2eb594};}}})[_0x887b('0x19')](respondWithResult(_0x4c06b5,0xc9))[_0x887b('0x25')](handleError(_0x4c06b5,null));};exports['show']=function(_0x5f20c8,_0x136328){var _0x18becf;return db['CmContact'][_0x887b('0x21')]()[_0x887b('0x19')](function(_0x2a8747){return db[_0x887b('0x26')]['find']({'where':{'id':_0x5f20c8[_0x887b('0x28')]['id']},'include':[{'model':db[_0x887b('0x66')],'as':_0x887b('0x67'),'attributes':['id',_0x887b('0x1e'),_0x887b('0x68')],'required':_0x5f20c8['query']['tag']?!![]:![]},{'model':db[_0x887b('0x69')],'as':_0x887b('0x6a'),'where':{'CmContactId':_0x5f20c8[_0x887b('0x28')]['id']},'required':![],'include':[{'model':db[_0x887b('0x6b')],'as':_0x887b('0x6c')}]}],'order':[db['sequelize'][_0x887b('0x6d')](_0x887b('0x6e'))],'attributes':_[_0x887b('0x2a')](_0x2a8747)});})[_0x887b('0x19')](function(_0x5d3f25){if(!_[_0x887b('0x56')](_0x5d3f25)){_0x18becf=_0x5d3f25[_0x887b('0x6f')]({'plain':!![]});var _0x14234e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5d3f25&&_0x5d3f25[_0x887b('0x62')]){if(_0x5d3f25[_0x887b('0x62')]){_0x14234e[_0x887b('0x61')][_0x887b('0x70')][_0x887b('0x60')]({'ListId':{'$ne':_0x5d3f25['ListId']}});}}return db['CmCustomField'][_0x887b('0x30')](_0x14234e);}})[_0x887b('0x19')](function(_0x59e0fc){if(!_[_0x887b('0x56')](_0x59e0fc)){return _['omit'](_0x18becf,_[_0x887b('0x71')](_0x59e0fc,function(_0x356b02){return util[_0x887b('0x72')](_0x887b('0x73'),_0x356b02['id']);}));}})[_0x887b('0x19')](handleEntityNotFound(_0x136328,null))['then'](respondWithResult(_0x136328,null))['catch'](handleError(_0x136328,null));};exports[_0x887b('0x18')]=function(_0x2b977f,_0x35b739){var _0x5e0fb1;if(_0x2b977f[_0x887b('0x38')]['id']){delete _0x2b977f[_0x887b('0x38')]['id'];}if(!_[_0x887b('0x56')](_0x2b977f['body'][_0x887b('0x57')])){var _0x31564a=_0x2b977f[_0x887b('0x38')][_0x887b('0x57')];if(!_[_0x887b('0x56')](shared['timezones'][_0x31564a]))_0x2b977f[_0x887b('0x38')][_0x887b('0x59')]=shared[_0x887b('0x58')][_0x31564a][_0x887b('0x59')];}return db[_0x887b('0x26')]['find']({'where':{'id':_0x2b977f['params']['id']}})[_0x887b('0x19')](handleEntityNotFound(_0x35b739,null))[_0x887b('0x19')](saveUpdates(_0x2b977f[_0x887b('0x38')],null))[_0x887b('0x19')](function(_0x3a0a8f){_0x5e0fb1=_0x3a0a8f;var _0x13c9de={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3a0a8f&&_0x3a0a8f['ListId']){if(_0x3a0a8f[_0x887b('0x62')]){_0x13c9de[_0x887b('0x61')][_0x887b('0x70')][_0x887b('0x60')]({'ListId':{'$ne':_0x3a0a8f['ListId']}});}}return db[_0x887b('0x2f')]['findAll'](_0x13c9de);})[_0x887b('0x19')](function(_0x221178){if(_0x221178){return _[_0x887b('0x74')](_[_0x887b('0x75')](_0x2b977f['body'],function(_0x7d3f76,_0x170d0e){return _[_0x887b('0x76')](_0x170d0e,_0x887b('0x2b'));}),_[_0x887b('0x71')](_0x221178,function(_0x1a0065){return util[_0x887b('0x72')](_0x887b('0x73'),_0x1a0065['id']);}));}})[_0x887b('0x19')](function(_0x73dc28){if(_0x73dc28&&!_[_0x887b('0x77')](_0x73dc28)){var _0x432022=squel[_0x887b('0x18')]()['table'](_0x887b('0x78'))[_0x887b('0x79')](_0x73dc28)[_0x887b('0x61')](_0x887b('0x7a'),_0x2b977f[_0x887b('0x28')]['id'])[_0x887b('0x7b')]();return db[_0x887b('0x7c')][_0x887b('0x23')](_0x432022[_0x887b('0x7d')],{'replacements':_0x432022['values']});}})[_0x887b('0x19')](function(){if(_0x2b977f[_0x887b('0x38')][_0x887b('0x7e')]&&_0x5e0fb1){return db[_0x887b('0x7f')][_0x887b('0x18')]({'phone':_0x2b977f[_0x887b('0x38')][_0x887b('0x7e')],'OrderBy':0x0},{'where':{'ContactId':_0x5e0fb1['id']}});}})[_0x887b('0x19')](function(){return _0x5e0fb1;})[_0x887b('0x19')](respondWithResult(_0x35b739,null))[_0x887b('0x25')](handleError(_0x35b739,null));};exports[_0x887b('0x80')]=function(_0x8a283d,_0x48245a){var _0x5b1fc4={};var _0xd8a7e2={};var _0x1975d2;var _0x453621;return db['CmContact'][_0x887b('0x81')]({'where':{'id':_0x8a283d[_0x887b('0x28')]['id']}})[_0x887b('0x19')](handleEntityNotFound(_0x48245a,null))[_0x887b('0x19')](function(_0x5bc235){if(_0x5bc235){_0x1975d2=_0x5bc235;_0xd8a7e2[_0x887b('0x82')]=_[_0x887b('0x2a')](db[_0x887b('0x66')][_0x887b('0x83')]);_0xd8a7e2['query']=_['keys'](_0x8a283d[_0x887b('0x23')]);_0xd8a7e2[_0x887b('0x84')]=_[_0x887b('0x85')](_0xd8a7e2[_0x887b('0x82')],_0xd8a7e2[_0x887b('0x23')]);_0x5b1fc4[_0x887b('0x86')]=_[_0x887b('0x85')](_0xd8a7e2[_0x887b('0x82')],qs[_0x887b('0x87')](_0x8a283d[_0x887b('0x23')][_0x887b('0x87')]));_0x5b1fc4[_0x887b('0x86')]=_0x5b1fc4[_0x887b('0x86')]['length']?_0x5b1fc4[_0x887b('0x86')]:_0xd8a7e2[_0x887b('0x82')];_0x5b1fc4[_0x887b('0x88')]=qs[_0x887b('0x89')](_0x8a283d[_0x887b('0x23')][_0x887b('0x89')]);_0x5b1fc4[_0x887b('0x61')]=qs[_0x887b('0x84')](_[_0x887b('0x8a')](_0x8a283d[_0x887b('0x23')],_0xd8a7e2[_0x887b('0x84')]));if(_0x8a283d['query'][_0x887b('0x8b')]){_0x5b1fc4[_0x887b('0x61')]=_[_0x887b('0x37')](_0x5b1fc4['where'],{'$or':_[_0x887b('0x71')](_0x5b1fc4[_0x887b('0x86')],function(_0x246a91){var _0x3acea8={};_0x3acea8[_0x246a91]={'$like':'%'+_0x8a283d[_0x887b('0x23')]['filter']+'%'};return _0x3acea8;})});}_0x5b1fc4=_[_0x887b('0x37')]({},_0x5b1fc4,_0x8a283d[_0x887b('0x8c')]);return _0x1975d2[_0x887b('0x80')](_0x5b1fc4);}})[_0x887b('0x19')](function(_0x31e9aa){if(_0x31e9aa){_0x453621=_0x31e9aa['length'];if(!_0x8a283d[_0x887b('0x23')][_0x887b('0x36')](_0x887b('0x8d'))){_0x5b1fc4[_0x887b('0x15')]=qs[_0x887b('0x15')](_0x8a283d[_0x887b('0x23')]['limit']);_0x5b1fc4['offset']=qs[_0x887b('0x14')](_0x8a283d[_0x887b('0x23')][_0x887b('0x14')]);}return _0x1975d2[_0x887b('0x80')](_0x5b1fc4);}})[_0x887b('0x19')](function(_0x5d2ff7){if(_0x5d2ff7){return _0x5d2ff7?{'count':_0x453621,'rows':_0x5d2ff7}:null;}})[_0x887b('0x19')](respondWithResult(_0x48245a,null))[_0x887b('0x25')](handleError(_0x48245a,null));};exports['setTags']=function(_0x48415c,_0x318e5e){if(_0x48415c[_0x887b('0x38')]['id']){delete _0x48415c[_0x887b('0x38')]['id'];}return db[_0x887b('0x26')][_0x887b('0x81')]({'where':{'id':_0x48415c[_0x887b('0x28')]['id']}})[_0x887b('0x19')](handleEntityNotFound(_0x318e5e,null))[_0x887b('0x19')](function(_0x3eab44){if(_0x3eab44){return _0x3eab44['setTags'](_0x48415c[_0x887b('0x38')][_0x887b('0x8e')]||[]);}return null;})[_0x887b('0x19')](respondWithResult(_0x318e5e,null))[_0x887b('0x25')](handleError(_0x318e5e,null));};exports['setAdditionalPhones']=function(_0x3d275d,_0x1e4456){var _0x5300c1=[];_0x5300c1[_0x887b('0x60')](addAdditionalPhones(_0x3d275d[_0x887b('0x38')]));Promise[_0x887b('0x65')](_0x5300c1)[_0x887b('0x19')](function(){_0x5300c1=[];_0x5300c1[_0x887b('0x60')](deleteCmHopperPhones(_0x3d275d[_0x887b('0x38')]['id']));_0x5300c1[_0x887b('0x60')](addCmHopperPhones(_0x3d275d[_0x887b('0x38')]['id']));Promise[_0x887b('0x65')](_0x5300c1)[_0x887b('0x19')](function(){return[0x1];})[_0x887b('0x19')](respondWithResult(_0x1e4456,null));});};function addAdditionalPhones(_0x55f9b9){var _0x37cefb;return new Promise(function(_0x1bb8c5){return db['CmContactHasItem'][_0x887b('0x1a')]({'where':{'CmContactId':_0x55f9b9['id']}})[_0x887b('0x19')](function(){db[_0x887b('0x6b')][_0x887b('0x30')]({'raw':!![],'attributes':['id',_0x887b('0x8f')]})[_0x887b('0x19')](function(_0x215e94){var _0x4fb630=[];for(var _0x2dd96a=0x0;_0x2dd96a<_0x55f9b9[_0x887b('0x90')][_0x887b('0x39')];_0x2dd96a++){var _0x46703b=_0x55f9b9[_0x887b('0x91')]?_[_0x887b('0x56')](_0x55f9b9[_0x887b('0x91')][_0x2dd96a])?'':_0x55f9b9[_0x887b('0x91')][_0x2dd96a]:_0x55f9b9[_0x887b('0x90')][_0x2dd96a][_0x887b('0x92')]?_0x55f9b9[_0x887b('0x90')][_0x2dd96a][_0x887b('0x92')]:'';var _0xea5cc1=_[_0x887b('0x56')](_0x55f9b9[_0x887b('0x90')][_0x2dd96a][_0x887b('0x93')])?'':_0x55f9b9['items'][_0x2dd96a]['description'];var _0x3d53ed=_0x46703b+':'+_0x55f9b9[_0x887b('0x90')][_0x2dd96a][_0x887b('0x7e')]+'§'+_0xea5cc1;if(_[_0x887b('0x56')](_0x37cefb))_0x37cefb=_0x3d53ed;else _0x37cefb+=';'+_0x3d53ed;var _0x4ad767=null;var _0x14b1d3=null;if(_0x55f9b9[_0x887b('0x91')]){if(!_[_0x887b('0x56')](_0x55f9b9[_0x887b('0x91')][_0x2dd96a])){_0x14b1d3=_[_0x887b('0x27')](_0x215e94,function(_0xfd0f5c){return _0xfd0f5c['id']===_0x55f9b9[_0x887b('0x91')][_0x2dd96a];});if(!_[_0x887b('0x56')](_0x14b1d3)){_0x4ad767=_0x14b1d3['OrderBy'];}}}else{if(!_[_0x887b('0x56')](_0x55f9b9[_0x887b('0x90')][_0x2dd96a])){_0x14b1d3=_['find'](_0x215e94,function(_0x37d844){return _0x37d844['id']===_0x55f9b9[_0x887b('0x90')][_0x2dd96a]['ItemTypeId'];});if(!_['isNil'](_0x14b1d3)){_0x4ad767=_0x2dd96a;}}}if(_[_0x887b('0x56')](_0x4ad767)){_0x4ad767=0x64;}_0x4fb630[_0x887b('0x60')](addAdditionalPhone(_0x55f9b9['id'],_0x55f9b9[_0x887b('0x90')][_0x2dd96a]['phone'],_0x55f9b9['item_types']?_[_0x887b('0x56')](_0x55f9b9[_0x887b('0x91')][_0x2dd96a])?null:_0x55f9b9['item_types'][_0x2dd96a]:_0x55f9b9[_0x887b('0x90')][_0x2dd96a][_0x887b('0x92')]?_0x55f9b9['items'][_0x2dd96a][_0x887b('0x92')]:null,_0x4ad767,_0xea5cc1));}Promise[_0x887b('0x65')](_0x4fb630)['then'](function(){db[_0x887b('0x26')][_0x887b('0x18')]({'AdditionalPhones':_0x37cefb},{'where':{'id':_0x55f9b9['id']}})[_0x887b('0x19')](function(){_0x1bb8c5(0x1);});});});});});}function addAdditionalPhone(_0x1dfb13,_0x3424c7,_0x27b9e2,_0x5c2db9,_0x15ad93){return db[_0x887b('0x69')][_0x887b('0x27')]({'where':{'CmContactId':_0x1dfb13,'item':_0x3424c7}})[_0x887b('0x19')](function(_0x3e8792){if(_0x3e8792)logger[_0x887b('0x34')]('contact\x20phone\x20exists',_0x3e8792);else{db[_0x887b('0x69')][_0x887b('0x5a')]({'CmContactId':_0x1dfb13,'item':_0x3424c7,'ItemTypeId':_0x27b9e2,'OrderBy':_0x5c2db9,'ItemClass':'PHONE','description':_0x15ad93});}});}function deleteCmHopperPhones(_0x5026dd){return new Promise(function(_0x479b72){return db['CmHopper'][_0x887b('0x30')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5026dd}})[_0x887b('0x19')](function(_0x182525){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x887b('0x71')](_0x182525,'id')}}});})['then'](function(){_0x479b72(0x1);});});}function addCmHopperPhones(_0x2c4122){return new Promise(function(_0x274706){return db[_0x887b('0x7f')][_0x887b('0x30')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2c4122}})[_0x887b('0x19')](function(_0x4922a1){var _0x35e6e8=[];_['map'](_0x4922a1,function(_0x1f3468){_0x35e6e8[_0x887b('0x60')](createCmHopperPhone(_0x2c4122,_0x1f3468['id']));});Promise[_0x887b('0x65')](_0x35e6e8)[_0x887b('0x19')](function(){_0x274706(0x1);});});});}function createCmHopperPhone(_0x383aa8,_0x52e24c){return new Promise(function(_0x29fb76){db[_0x887b('0x69')][_0x887b('0x30')]({'raw':!![],'attributes':[_0x887b('0x94'),_0x887b('0x8f')],'where':{'CmContactId':_0x383aa8,'ItemClass':_0x887b('0x95')},'include':[{'model':db[_0x887b('0x6b')],'attributes':[_0x887b('0x8f')],'as':_0x887b('0x6c')}],'order':[_0x887b('0x8f'),db[_0x887b('0x7c')][_0x887b('0x6d')](_0x887b('0x96'))]})[_0x887b('0x19')](function(_0x3b5b30){var _0x4b4c5f=0x1;var _0x2399a8=_[_0x887b('0x71')](_0x3b5b30,function(_0x2f6958){_0x2f6958[_0x887b('0x97')]=_0x52e24c;_0x2f6958[_0x887b('0x7e')]=_0x2f6958[_0x887b('0x94')];_0x2f6958[_0x887b('0x8f')]=_0x4b4c5f;delete _0x2f6958['ItemType.OrderBy'];_0x4b4c5f=_0x4b4c5f+0x1;return _0x2f6958;});return db[_0x887b('0x98')][_0x887b('0x5c')](_0x2399a8,{});})[_0x887b('0x19')](function(){_0x29fb76(0x1);});});}function insertAdditionalPhones(_0x3c4218,_0x1b4bbb){return new Promise(function(_0x54c7a7){var _0xbb78d7=[];for(var _0x326ea5=0x0;_0x326ea5<_0x1b4bbb['length'];_0x326ea5++){var _0x4301fe=_0x1b4bbb[_0x326ea5];_0xbb78d7[_0x887b('0x60')](parseContactItemType(_0x4301fe));}Promise['all'](_0xbb78d7)['then'](function(){var _0x2c4e6e={'id':_0x3c4218['id'],'items':_0x1b4bbb};return addAdditionalPhones(_0x2c4e6e)[_0x887b('0x19')](function(){return addCmHopperPhones(_0x3c4218['id']);});})[_0x887b('0x19')](function(){_0x54c7a7(_0x3c4218);});});}function parseContactItemType(_0x2730c9){return new Promise(function(_0x53fc91){if(_0x2730c9[_0x887b('0x36')]('ItemTypeId')){_0x53fc91(_0x2730c9);}else{return db[_0x887b('0x6b')][_0x887b('0x27')]({'where':{'name':_0x2730c9[_0x887b('0x6c')]}})[_0x887b('0x19')](function(_0x543da3){if(_['isNil'](_0x543da3))_0x2730c9[_0x887b('0x92')]=null;else _0x2730c9[_0x887b('0x92')]=_0x543da3['id'];_0x53fc91(_0x2730c9);});}});}exports['getAdditionalPhones']=function(_0x30f5b1,_0x16428d){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x30f5b1['params']['id'],'ItemClass':_0x887b('0x95')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x887b('0x7c')][_0x887b('0x6d')](_0x887b('0x96'))]]})[_0x887b('0x19')](function(_0x24dab){return _0x24dab;})[_0x887b('0x19')](respondWithResult(_0x16428d,null))[_0x887b('0x25')](handleError(_0x16428d,null));};exports[_0x887b('0x99')]=function(_0x9d1beb,_0x557f32){return db[_0x887b('0x69')]['findAll']({'raw':!![],'where':{'CmContactId':_0x9d1beb[_0x887b('0x38')][_0x887b('0x9a')]}})[_0x887b('0x19')](function(_0x113917){var _0x53d172=_[_0x887b('0x71')](_0x113917,function(_0x75bfb6){_0x75bfb6[_0x887b('0x9b')]=_0x9d1beb[_0x887b('0x38')]['toContactId'];return _0x75bfb6;});return db[_0x887b('0x69')][_0x887b('0x5c')](_0x53d172,{});})[_0x887b('0x19')](function(){return addCmHopperPhones(_0x9d1beb['body'][_0x887b('0x9c')]);})[_0x887b('0x19')](function(){return['ok'];})[_0x887b('0x19')](respondWithResult(_0x557f32,null))[_0x887b('0x25')](handleError(_0x557f32,null));};exports[_0x887b('0x9d')]=function(_0x32af2e,_0x162995){var _0x6091de=[];_0x6091de[_0x887b('0x60')](createCmHopperPhone(_0x32af2e[_0x887b('0x38')]['id'],_0x32af2e['body'][_0x887b('0x9e')]));Promise[_0x887b('0x65')](_0x6091de)[_0x887b('0x19')](function(){return[0x1];})[_0x887b('0x19')](respondWithResult(_0x162995,null));};exports[_0x887b('0x9f')]=function(_0x2f056b,_0x104740){var _0x3676f1={'raw':![],'where':{}};var _0x4008f8={};var _0x58de98={'count':0x0,'rows':[]};return db[_0x887b('0x26')][_0x887b('0x81')]({'where':{'id':_0x2f056b[_0x887b('0x28')]['id']}})['then'](handleEntityNotFound(_0x104740,null))['then'](function(_0x5ae5d9){if(_0x5ae5d9){_0x4008f8[_0x887b('0x82')]=_[_0x887b('0x2a')](db[_0x887b('0x7f')][_0x887b('0x83')]);_0x4008f8[_0x887b('0x23')]=_['keys'](_0x2f056b[_0x887b('0x23')]);_0x4008f8[_0x887b('0x84')]=_[_0x887b('0x85')](_0x4008f8['model'],_0x4008f8[_0x887b('0x23')]);_0x3676f1[_0x887b('0x86')]=_['intersection'](_0x4008f8[_0x887b('0x82')],qs[_0x887b('0x87')](_0x2f056b[_0x887b('0x23')][_0x887b('0x87')]));_0x3676f1['attributes']=_0x3676f1[_0x887b('0x86')][_0x887b('0x39')]?_0x3676f1[_0x887b('0x86')]:_0x4008f8['model'];if(!_0x2f056b[_0x887b('0x23')][_0x887b('0x36')](_0x887b('0x8d'))){_0x3676f1[_0x887b('0x15')]=qs['limit'](_0x2f056b[_0x887b('0x23')][_0x887b('0x15')]);_0x3676f1[_0x887b('0x14')]=qs[_0x887b('0x14')](_0x2f056b[_0x887b('0x23')][_0x887b('0x14')]);}_0x3676f1[_0x887b('0x88')]=qs['sort'](_0x2f056b['query'][_0x887b('0x89')]);_0x3676f1[_0x887b('0x61')]=qs['filters'](_[_0x887b('0x8a')](_0x2f056b[_0x887b('0x23')],_0x4008f8[_0x887b('0x84')]));_0x3676f1[_0x887b('0x61')][_0x887b('0xa0')]=_0x5ae5d9['id'];if(_0x2f056b[_0x887b('0x23')][_0x887b('0x8b')]){_0x3676f1[_0x887b('0x61')]=_['merge'](_0x3676f1['where'],{'$or':_[_0x887b('0x71')](_0x3676f1[_0x887b('0x86')],function(_0x2dc263){var _0x1f8a5d={};_0x1f8a5d[_0x2dc263]={'$like':'%'+_0x2f056b['query']['filter']+'%'};return _0x1f8a5d;})});}_0x3676f1=_[_0x887b('0x37')]({},_0x3676f1,_0x2f056b['options']);return db['CmHopper'][_0x887b('0x16')]({'where':_0x3676f1[_0x887b('0x61')]})[_0x887b('0x19')](function(_0x29eabc){_0x58de98['count']=_0x29eabc;if(_0x2f056b[_0x887b('0x23')][_0x887b('0xa1')]){_0x3676f1['include']=[{'all':!![]}];}return db['CmHopper'][_0x887b('0x30')](_0x3676f1);})[_0x887b('0x19')](function(_0x50b7c5){_0x58de98[_0x887b('0xa2')]=_0x50b7c5;return _0x58de98;});}})['then'](respondWithFilteredResult(_0x104740,_0x3676f1))[_0x887b('0x25')](handleError(_0x104740,null));};exports[_0x887b('0xa3')]=function(_0x58c2e5,_0x11ed02){var _0x165292={'raw':!![],'where':{}};var _0x5d0dfb={};var _0x228536={'count':0x0,'rows':[]};return db[_0x887b('0x26')]['findOne']({'where':{'id':_0x58c2e5[_0x887b('0x28')]['id']}})['then'](handleEntityNotFound(_0x11ed02,null))['then'](function(_0x1ab077){if(_0x1ab077){_0x5d0dfb[_0x887b('0x82')]=_['keys'](db['CmHopperHistory'][_0x887b('0x83')]);_0x5d0dfb[_0x887b('0x23')]=_[_0x887b('0x2a')](_0x58c2e5[_0x887b('0x23')]);_0x5d0dfb['filters']=_[_0x887b('0x85')](_0x5d0dfb[_0x887b('0x82')],_0x5d0dfb[_0x887b('0x23')]);_0x165292[_0x887b('0x86')]=_[_0x887b('0x85')](_0x5d0dfb[_0x887b('0x82')],qs[_0x887b('0x87')](_0x58c2e5[_0x887b('0x23')][_0x887b('0x87')]));_0x165292[_0x887b('0x86')]=_0x165292[_0x887b('0x86')][_0x887b('0x39')]?_0x165292[_0x887b('0x86')]:_0x5d0dfb[_0x887b('0x82')];if(!_0x58c2e5['query'][_0x887b('0x36')]('nolimit')){_0x165292[_0x887b('0x15')]=qs[_0x887b('0x15')](_0x58c2e5[_0x887b('0x23')][_0x887b('0x15')]);_0x165292[_0x887b('0x14')]=qs[_0x887b('0x14')](_0x58c2e5[_0x887b('0x23')]['offset']);}_0x165292[_0x887b('0x88')]=qs[_0x887b('0x89')](_0x58c2e5[_0x887b('0x23')][_0x887b('0x89')]);_0x165292[_0x887b('0x61')]=qs['filters'](_['pick'](_0x58c2e5[_0x887b('0x23')],_0x5d0dfb[_0x887b('0x84')]));_0x165292[_0x887b('0x61')][_0x887b('0xa0')]=_0x1ab077['id'];if(_0x58c2e5[_0x887b('0x23')][_0x887b('0x8b')]){_0x165292[_0x887b('0x61')]=_[_0x887b('0x37')](_0x165292['where'],{'$or':_[_0x887b('0x71')](_0x165292['attributes'],function(_0x57ae75){var _0xcbce01={};_0xcbce01[_0x57ae75]={'$like':'%'+_0x58c2e5['query'][_0x887b('0x8b')]+'%'};return _0xcbce01;})});}_0x165292=_[_0x887b('0x37')]({},_0x165292,_0x58c2e5[_0x887b('0x8c')]);return db['CmHopperHistory'][_0x887b('0x16')]({'where':_0x165292[_0x887b('0x61')]})[_0x887b('0x19')](function(_0x107070){_0x228536['count']=_0x107070;if(_0x58c2e5['query'][_0x887b('0xa1')]){_0x165292[_0x887b('0xa4')]=[{'all':!![]}];}return db[_0x887b('0x4b')][_0x887b('0x30')](_0x165292);})[_0x887b('0x19')](function(_0x1a92a2){_0x228536[_0x887b('0xa2')]=_0x1a92a2;return _0x228536;});}})['then'](respondWithFilteredResult(_0x11ed02,_0x165292))[_0x887b('0x25')](handleError(_0x11ed02,null));};exports['getHopperFinals']=function(_0x24e720,_0x514e21){var _0x4de13c={'raw':!![],'where':{}};var _0x1ec462={};var _0x165cc9={'count':0x0,'rows':[]};return db[_0x887b('0x26')][_0x887b('0x81')]({'where':{'id':_0x24e720['params']['id']}})['then'](handleEntityNotFound(_0x514e21,null))[_0x887b('0x19')](function(_0x59bb69){if(_0x59bb69){_0x1ec462['model']=_[_0x887b('0x2a')](db[_0x887b('0x4a')][_0x887b('0x83')]);_0x1ec462['query']=_[_0x887b('0x2a')](_0x24e720[_0x887b('0x23')]);_0x1ec462[_0x887b('0x84')]=_[_0x887b('0x85')](_0x1ec462[_0x887b('0x82')],_0x1ec462[_0x887b('0x23')]);_0x4de13c['attributes']=_[_0x887b('0x85')](_0x1ec462['model'],qs[_0x887b('0x87')](_0x24e720['query']['fields']));_0x4de13c[_0x887b('0x86')]=_0x4de13c[_0x887b('0x86')]['length']?_0x4de13c[_0x887b('0x86')]:_0x1ec462[_0x887b('0x82')];if(!_0x24e720[_0x887b('0x23')][_0x887b('0x36')](_0x887b('0x8d'))){_0x4de13c[_0x887b('0x15')]=qs[_0x887b('0x15')](_0x24e720[_0x887b('0x23')][_0x887b('0x15')]);_0x4de13c['offset']=qs[_0x887b('0x14')](_0x24e720[_0x887b('0x23')]['offset']);}_0x4de13c[_0x887b('0x88')]=qs[_0x887b('0x89')](_0x24e720[_0x887b('0x23')][_0x887b('0x89')]);_0x4de13c[_0x887b('0x61')]=qs[_0x887b('0x84')](_['pick'](_0x24e720[_0x887b('0x23')],_0x1ec462[_0x887b('0x84')]));_0x4de13c[_0x887b('0x61')][_0x887b('0xa0')]=_0x59bb69['id'];if(_0x24e720['query'][_0x887b('0x8b')]){_0x4de13c[_0x887b('0x61')]=_[_0x887b('0x37')](_0x4de13c['where'],{'$or':_[_0x887b('0x71')](_0x4de13c[_0x887b('0x86')],function(_0x288557){var _0x1b6049={};_0x1b6049[_0x288557]={'$like':'%'+_0x24e720[_0x887b('0x23')][_0x887b('0x8b')]+'%'};return _0x1b6049;})});}_0x4de13c=_[_0x887b('0x37')]({},_0x4de13c,_0x24e720[_0x887b('0x8c')]);return db[_0x887b('0x4a')][_0x887b('0x16')]({'where':_0x4de13c['where']})['then'](function(_0x27bf92){_0x165cc9[_0x887b('0x16')]=_0x27bf92;if(_0x24e720[_0x887b('0x23')]['includeAll']){_0x4de13c[_0x887b('0xa4')]=[{'all':!![]}];}return db[_0x887b('0x4a')]['findAll'](_0x4de13c);})[_0x887b('0x19')](function(_0x5695f5){_0x165cc9[_0x887b('0xa2')]=_0x5695f5;return _0x165cc9;});}})['then'](respondWithFilteredResult(_0x514e21,_0x4de13c))[_0x887b('0x25')](handleError(_0x514e21,null));};exports['getJscriptySessions']=function(_0x10d79e,_0x2389ea){var _0x1f43fb={'raw':!![],'where':{}};var _0x56af49={};var _0x539495={'count':0x0,'rows':[]};return db[_0x887b('0x26')][_0x887b('0x81')]({'where':{'id':_0x10d79e[_0x887b('0x28')]['id']}})[_0x887b('0x19')](handleEntityNotFound(_0x2389ea,null))[_0x887b('0x19')](function(_0xe233bc){if(_0xe233bc){_0x56af49[_0x887b('0x82')]=_[_0x887b('0x2a')](db['JscriptySessionReport'][_0x887b('0x83')]);_0x56af49['query']=_[_0x887b('0x2a')](_0x10d79e['query']);_0x56af49[_0x887b('0x84')]=_[_0x887b('0x85')](_0x56af49[_0x887b('0x82')],_0x56af49[_0x887b('0x23')]);_0x1f43fb['attributes']=_['intersection'](_0x56af49['model'],qs[_0x887b('0x87')](_0x10d79e['query'][_0x887b('0x87')]));_0x1f43fb[_0x887b('0x86')]=_0x1f43fb[_0x887b('0x86')][_0x887b('0x39')]?_0x1f43fb[_0x887b('0x86')]:_0x56af49[_0x887b('0x82')];if(!_0x10d79e['query'][_0x887b('0x36')]('nolimit')){_0x1f43fb[_0x887b('0x15')]=qs['limit'](_0x10d79e[_0x887b('0x23')]['limit']);_0x1f43fb[_0x887b('0x14')]=qs[_0x887b('0x14')](_0x10d79e[_0x887b('0x23')][_0x887b('0x14')]);}_0x1f43fb[_0x887b('0x88')]=qs[_0x887b('0x89')](_0x10d79e[_0x887b('0x23')][_0x887b('0x89')]);_0x1f43fb['where']=qs[_0x887b('0x84')](_[_0x887b('0x8a')](_0x10d79e['query'],_0x56af49['filters']));_0x1f43fb[_0x887b('0x61')][_0x887b('0xa0')]=_0xe233bc['id'];if(_0x10d79e[_0x887b('0x23')]['filter']){_0x1f43fb['where']=_['merge'](_0x1f43fb[_0x887b('0x61')],{'$or':_[_0x887b('0x71')](_0x1f43fb[_0x887b('0x86')],function(_0x69e801){var _0x2afeb8={};_0x2afeb8[_0x69e801]={'$like':'%'+_0x10d79e[_0x887b('0x23')]['filter']+'%'};return _0x2afeb8;})});}_0x1f43fb=_[_0x887b('0x37')]({},_0x1f43fb,_0x10d79e['options']);return db['JscriptySessionReport']['count']({'where':_0x1f43fb[_0x887b('0x61')]})[_0x887b('0x19')](function(_0x347900){_0x539495[_0x887b('0x16')]=_0x347900;if(_0x10d79e['query'][_0x887b('0xa1')]){_0x1f43fb[_0x887b('0xa4')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x887b('0x30')](_0x1f43fb);})[_0x887b('0x19')](function(_0x4c6ecd){_0x539495[_0x887b('0xa2')]=_0x4c6ecd;return _0x539495;});}})[_0x887b('0x19')](respondWithFilteredResult(_0x2389ea,_0x1f43fb))[_0x887b('0x25')](handleError(_0x2389ea,null));};exports['uploadCsv']=function(_0x4f0f0b,_0x2b9919){try{if(!_0x4f0f0b[_0x887b('0x38')]['ListId']){throw new Error(_0x887b('0xa5'));}if(!_0x4f0f0b[_0x887b('0x38')][_0x887b('0xa6')]){throw new Error(_0x887b('0xa7'));}if(!_0x4f0f0b[_0x887b('0x38')][_0x887b('0xa8')]){throw new Error(_0x887b('0xa9'));}if(!_0x4f0f0b['body'][_0x887b('0xaa')]){throw new Error(_0x887b('0xab'));}var _0x3c2888=_0x4f0f0b['body'][_0x887b('0xa6')][_0x887b('0xac')](',');var _0x123777=_0x4f0f0b['body'][_0x887b('0xa8')]['split'](',');if(!_0x3c2888[_0x887b('0x39')]||!_0x123777['length']||_0x3c2888['length']!==_0x123777[_0x887b('0x39')]){throw new Error(_0x887b('0xad'));}_0x4f0f0b[_0x887b('0x38')][_0x887b('0x87')]=_[_0x887b('0xae')](_0x3c2888,_0x123777);if(!_0x4f0f0b['body'][_0x887b('0x87')][_0x887b('0x7e')]){throw new Error(_0x887b('0xaf'));}if(!_0x4f0f0b['body'][_0x887b('0x87')][_0x887b('0xb0')]){throw new Error(_0x887b('0xb1'));}var _0x57abfa=path[_0x887b('0x3b')](config[_0x887b('0xb2')],_0x887b('0xb3'),_0x4f0f0b['file'][_0x887b('0xb4')]);fs['chmodSync'](_0x57abfa,parseInt(_0x887b('0xb5'),0x8));var _0xd28ee3=require('child_process')[_0x887b('0xb6')](path['join'](__dirname,_0x887b('0xb7')),[_0x57abfa,_0x4f0f0b[_0x887b('0x38')]['binding_keys'],_0x4f0f0b[_0x887b('0x38')][_0x887b('0xa8')],_0x4f0f0b['body'][_0x887b('0x62')],_0x4f0f0b[_0x887b('0x38')][_0x887b('0xb8')],_0x4f0f0b[_0x887b('0x38')][_0x887b('0x5e')],_0x4f0f0b[_0x887b('0x38')][_0x887b('0xaa')]]);return _0x2b9919[_0x887b('0x12')](0xc8)[_0x887b('0x13')]({'message':_0x887b('0xb9'),'pid':_0xd28ee3['pid']});}catch(_0x5d5593){return _0x2b9919['status'](0x1f4)['send'](_0x5d5593);}};exports[_0x887b('0xba')]=function(_0x232bd6,_0x9bb0d1){var _0x2625f2=fs['createReadStream'](_0x232bd6[_0x887b('0xbb')]['path']);Papa['parse'](_0x2625f2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x25502e){return _0x9bb0d1[_0x887b('0x12')](0xc8)['json']({'file':_0x232bd6['file'],'fields':_0x25502e['meta'][_0x887b('0x87')]});}});};exports[_0x887b('0xbc')]=function(_0x91a0ce,_0x21fd49){return db[_0x887b('0xbd')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x887b('0xbe')}})[_0x887b('0x19')](function(_0x4991cd){var _0x285fae=![];if(!_0x91a0ce['body'][_0x887b('0x62')]){throw new Error(_0x887b('0xa5'));}if(!_0x91a0ce[_0x887b('0x38')][_0x887b('0xbf')][_0x887b('0x7e')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x91a0ce['body'][_0x887b('0xbf')][_0x887b('0xb0')]){throw new Error(_0x887b('0xb1'));}if(!_0x91a0ce[_0x887b('0x38')][_0x887b('0xaa')]){throw new Error(_0x887b('0xab'));}var _0x1bcabb=require('child_process')[_0x887b('0xb6')](path[_0x887b('0x3b')](__dirname,_0x887b('0xc0')),[_0x91a0ce[_0x887b('0x28')]['id'],JSON[_0x887b('0xc1')](_0x91a0ce[_0x887b('0x38')]),JSON[_0x887b('0xc1')](_0x4991cd)]);_0x1bcabb['on'](_0x887b('0xc2'),function(){_0x285fae=!![];return _0x21fd49[_0x887b('0x12')](0xc8)['json']({'message':_0x887b('0xc3'),'pid':_0x1bcabb[_0x887b('0xc4')]});});_0x1bcabb['on'](_0x887b('0xc5'),function(_0x2f1279){if(_0x2f1279&&!_0x285fae){return _0x21fd49[_0x887b('0x12')](0x1f4)['json']({'message':_0x887b('0xc6'),'pid':_0x1bcabb[_0x887b('0xc4')]});}});})['catch'](handleError(_0x21fd49,null));};exports[_0x887b('0xc7')]=function(_0x52f2c5,_0x126261){return db['User'][_0x887b('0x30')]({'raw':!![],'attributes':['id'],'where':{'role':_0x887b('0xbe')}})[_0x887b('0x19')](function(_0x5e3198){var _0x42aa21=![];if(!_0x52f2c5[_0x887b('0x38')]['ListId']){throw new Error(_0x887b('0xa5'));}if(!_0x52f2c5[_0x887b('0x38')]['binding'][_0x887b('0x7e')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x52f2c5[_0x887b('0x38')]['binding'][_0x887b('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x52f2c5['body'][_0x887b('0xaa')]){throw new Error(_0x887b('0xab'));}var _0x46b121=require(_0x887b('0xc8'))['fork'](path[_0x887b('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x52f2c5['params']['id'],JSON['stringify'](_0x52f2c5['body']),JSON[_0x887b('0xc1')](_0x5e3198)]);_0x46b121['on'](_0x887b('0xc2'),function(){_0x42aa21=!![];return _0x126261['status'](0xc8)[_0x887b('0x13')]({'message':_0x887b('0xc3'),'pid':_0x46b121[_0x887b('0xc4')]});});_0x46b121['on'](_0x887b('0xc5'),function(_0x5d6ea8){if(_0x5d6ea8&&!_0x42aa21){return _0x126261[_0x887b('0x12')](0x1f4)[_0x887b('0x13')]({'message':_0x887b('0xc6'),'pid':_0x46b121[_0x887b('0xc4')]});}});})['catch'](handleError(_0x126261,null));};exports[_0x887b('0xc9')]=function(_0x3126ed,_0x402847){var _0x1c3d24=[_0x887b('0xca'),_0x887b('0xcb'),_0x887b('0xcc'),'openchannel',_0x887b('0xcd'),_0x887b('0xce'),_0x887b('0xcf')];var _0x35ff23={'offset':0x0,'order':qs[_0x887b('0x89')](_0x887b('0xd0'))},_0x16df0a={'count':0x0,'rows':[]};Promise[_0x887b('0xd1')]()['then'](function(){if(_0x3126ed[_0x887b('0x23')][_0x887b('0xd2')]){if(!_[_0x887b('0xd3')](_0x1c3d24,_0x3126ed[_0x887b('0x23')][_0x887b('0xd2')][_0x887b('0xd4')]())){throw new Error(_0x887b('0xd5'));}_0x1c3d24=[_0x3126ed['query'][_0x887b('0xd2')][_0x887b('0xd4')]()];}if(_0x3126ed['query']['range']){try{var _0x4e526a=JSON[_0x887b('0xd6')](_0x3126ed[_0x887b('0x23')][_0x887b('0xd7')]);if(!moment(_0x4e526a[_0x887b('0x3d')])[_0x887b('0xd8')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4e526a['to'])['isValid']()){throw new Error(_0x887b('0xd9'));}}catch(_0x1690ff){throw new Error(_0x887b('0xda'));}}if(!_0x3126ed[_0x887b('0x23')][_0x887b('0x36')]('nolimit')){_0x35ff23['limit']=qs[_0x887b('0x15')](_0x3126ed[_0x887b('0x23')][_0x887b('0x15')]||0xa);_0x35ff23['offset']=qs[_0x887b('0x14')](_0x3126ed[_0x887b('0x23')]['offset']);}var _0x32231d=_0x1c3d24[_0x887b('0x71')](function(_0x4967a8){if(_0x4967a8==='voice'){var _0x10f578={'attributes':['id','uniqueid',_0x887b('0x32'),_0x887b('0xdb'),_0x887b('0xdc'),_0x887b('0xdd'),_0x887b('0xde'),'endtime',_0x887b('0xdf'),_0x887b('0xe0'),'createdAt',_0x887b('0xe1'),_0x887b('0xe2'),_0x887b('0xe3'),_0x887b('0xe4')],'where':{'ContactId':_0x3126ed['params']['id']},'include':[{'model':db[_0x887b('0xbd')],'as':_0x887b('0xbd'),'attributes':['id',_0x887b('0x1e'),'fullname',_0x887b('0xe5')]}],'order':[[_0x887b('0xe6'),_0x887b('0xe7')]]};if(_0x3126ed[_0x887b('0x23')][_0x887b('0xd7')]){_0x10f578[_0x887b('0x61')][_0x887b('0xe6')]={'$gte':_0x4e526a['from'],'$lte':_0x4e526a['to']};}return db[_0x887b('0xe8')][_0x887b('0xe9')](_0x10f578)['then'](function(_0x2614ab){_0x16df0a[_0x887b('0x16')]+=_0x2614ab[_0x887b('0x16')];return _['map'](_0x2614ab['rows'],function(_0x14dd21){var _0x28e402=_0x14dd21[_0x887b('0x6f')]({'plain':!![]});_0x28e402['channel']=_0x4967a8;if(_0x28e402[_0x887b('0xbd')]){_0x28e402[_0x887b('0xbd')]={'id':_0x28e402[_0x887b('0xbd')]['id'],'name':_0x28e402['User'][_0x887b('0x1e')],'fullname':_0x28e402[_0x887b('0xbd')][_0x887b('0xea')],'alias':_0x28e402[_0x887b('0xbd')][_0x887b('0xe5')]};}return _0x28e402;});});}else{var _0x12b71f=_[_0x887b('0xeb')](_0x4967a8)+(_0x4967a8==='chat'?_0x887b('0xec'):_0x887b('0xed'));var _0x1dbd9b={'attributes':['id',_0x887b('0xee'),_0x887b('0xef'),_0x887b('0xe6'),_0x887b('0xe0'),_0x887b('0xf0'),_0x887b('0xf1'),'thirdDisposition','UserId',_0x12b71f+'Id'],'where':{'ContactId':_0x3126ed[_0x887b('0x28')]['id']},'include':[{'model':db[_0x12b71f],'as':_0x887b('0xed'),'attributes':['id',_0x887b('0x1e'),_0x887b('0xf2')]},{'model':db[_0x887b('0xbd')],'as':_0x887b('0xf3'),'attributes':['id',_0x887b('0x1e'),'fullname']},{'model':db[_0x887b('0x66')],'as':_0x887b('0x67'),'attributes':['id',_0x887b('0x1e'),'color'],'through':{'attributes':[]}}],'order':[['createdAt',_0x887b('0xe7')]]};if(_0x3126ed[_0x887b('0x23')][_0x887b('0xd7')]){_0x1dbd9b['where'][_0x887b('0xe6')]={'$gte':_0x4e526a[_0x887b('0x3d')],'$lte':_0x4e526a['to']};}switch(_0x4967a8){case'chat':_0x1dbd9b[_0x887b('0x86')]['push'](_0x887b('0xf4'),_0x887b('0xf5'),_0x887b('0xf6'),_0x887b('0xf7'),_0x887b('0xf8'),_0x887b('0xf9'),_0x887b('0xfa'),_0x887b('0xfb'),_0x887b('0xfc'));break;case _0x887b('0xca'):_0x1dbd9b['attributes']['push'](_0x887b('0xfd'),_0x887b('0xfe'));break;case _0x887b('0xff'):_0x1dbd9b[_0x887b('0x86')][_0x887b('0x60')](_0x887b('0x100'),_0x887b('0x101'));break;}return db[_[_0x887b('0xeb')](_0x4967a8)+_0x887b('0x102')][_0x887b('0xe9')](_0x1dbd9b)[_0x887b('0x19')](function(_0x5b44a0){_0x16df0a[_0x887b('0x16')]+=_0x5b44a0[_0x887b('0x16')];return _[_0x887b('0x71')](_0x5b44a0[_0x887b('0xa2')],function(_0x5c8cb9){var _0xf490ba=_0x5c8cb9[_0x887b('0x6f')]({'plain':!![]});_0xf490ba[_0x887b('0xd2')]=_0x4967a8;if(_0xf490ba['Owner']){_0xf490ba[_0x887b('0xf3')]={'id':_0xf490ba['Owner']['id'],'name':_0xf490ba[_0x887b('0xf3')][_0x887b('0x1e')],'fullname':_0xf490ba['Owner'][_0x887b('0xea')]};}return _0xf490ba;});});}});return Promise[_0x887b('0x65')](_0x32231d);})[_0x887b('0x19')](function(_0x3018b1){return _(_0x3018b1)[_0x887b('0x103')]()['sortBy'](_0x887b('0xe6'))[_0x887b('0x104')]()[_0x887b('0x105')]();})[_0x887b('0x19')](function(_0x42d597){_0x16df0a[_0x887b('0xa2')]=_0x35ff23['limit']?_0x42d597[_0x887b('0x106')](_0x35ff23['offset'],_0x35ff23[_0x887b('0x14')]+_0x35ff23[_0x887b('0x15')]):_0x42d597;return _0x16df0a;})[_0x887b('0x19')](respondWithFilteredResult(_0x402847,_0x35ff23))[_0x887b('0x25')](handleError(_0x402847,null));}; \ No newline at end of file +var _0x544f=['custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','create','join','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','push','where','ListId','findOrCreate','contact','all','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','sequelize','text','phone','getTags','findOne','model','rawAttributes','attributes','intersection','fields','order','sort','filters','pick','filter','options','setTags','ids','CmContactHasItem','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','firstName','socket_timestamp','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','sms','openchannel','fax','voice','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','Interaction','flatten','reverse','value','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','describe','getOptions','findAll','query','CmContact','find','params','catch','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544f,0x1cd));var _0xf544=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x544f[_0x46698a];return _0x356db0;};'use strict';var moment=require(_0xf544('0x0'));var BPromise=require('bluebird');var util=require(_0xf544('0x1'));var path=require(_0xf544('0x2'));var fs=require('fs');var _=require(_0xf544('0x3'));var squel=require(_0xf544('0x4'));var Papa=require(_0xf544('0x5'));var Redis=require(_0xf544('0x6'));var contacts=require(_0xf544('0x7'));var qs=require(_0xf544('0x8'));var logger=require(_0xf544('0x9'))(_0xf544('0xa'));var config=require(_0xf544('0xb'));var shared=require(_0xf544('0xc'));var db=require('../../mysqldb')['db'];config[_0xf544('0xd')]=_[_0xf544('0xe')](config[_0xf544('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf544('0xf'))(new Redis(config[_0xf544('0xd')]));require('./cmContact.socket')[_0xf544('0x10')](socket);function respondWithResult(_0x3c2f00,_0x38df05){_0x38df05=_0x38df05||0xc8;return function(_0x11cbf7){if(_0x11cbf7){return _0x3c2f00[_0xf544('0x11')](_0x38df05)[_0xf544('0x12')](_0x11cbf7);}};}function respondWithFilteredResult(_0x265a80,_0xb96a0f){return function(_0x138ad6){if(_0x138ad6){var _0x241ca8=typeof _0xb96a0f['offset']===_0xf544('0x13')&&typeof _0xb96a0f[_0xf544('0x14')]==='undefined';var _0x4fb7cd=_0x138ad6[_0xf544('0x15')];var _0x3c7e94=_0x241ca8?0x0:_0xb96a0f[_0xf544('0x16')];var _0x55b37a=_0x241ca8?_0x138ad6[_0xf544('0x15')]:_0xb96a0f[_0xf544('0x16')]+_0xb96a0f[_0xf544('0x14')];var _0x4266c7;if(_0x55b37a>=_0x4fb7cd){_0x55b37a=_0x4fb7cd;_0x4266c7=0xc8;}else{_0x4266c7=0xce;}_0x265a80[_0xf544('0x11')](_0x4266c7);return _0x265a80[_0xf544('0x17')](_0xf544('0x18'),_0x3c7e94+'-'+_0x55b37a+'/'+_0x4fb7cd)[_0xf544('0x12')](_0x138ad6);}return null;};}function saveUpdates(_0x43a93a){return function(_0x2c6ac6){if(_0x2c6ac6){return _0x2c6ac6[_0xf544('0x19')](_0x43a93a)[_0xf544('0x1a')](function(_0x48d441){return _0x48d441;});}return null;};}function removeEntity(_0x350243){return function(_0x5c909f){if(_0x5c909f){return _0x5c909f[_0xf544('0x1b')]()[_0xf544('0x1a')](function(){_0x350243['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8914){return function(_0xeda7b2){if(!_0xeda7b2){_0x3a8914[_0xf544('0x1c')](0x194);}return _0xeda7b2;};}function handleError(_0x235325,_0xf5e5a1){_0xf5e5a1=_0xf5e5a1||0x1f4;return function(_0x9a908){logger[_0xf544('0x1d')](_0x9a908[_0xf544('0x1e')]);if(_0x9a908[_0xf544('0x1f')]){delete _0x9a908[_0xf544('0x1f')];}_0x235325[_0xf544('0x11')](_0xf5e5a1)['send'](_0x9a908);};}exports[_0xf544('0x20')]=function(_0x3598cf,_0x453a9d){var _0x2278b4={};return contacts[_0xf544('0x21')]()['then'](function(_0x20afcd){_0x2278b4=qs[_0xf544('0x22')](_0x20afcd,_0x3598cf);return contacts[_0xf544('0x23')](_0x3598cf[_0xf544('0x24')],_0x3598cf['user'],_0x2278b4,_0x20afcd);})[_0xf544('0x1a')](respondWithFilteredResult(_0x453a9d,_0x2278b4))['catch'](handleError(_0x453a9d,null));};exports['destroy']=function(_0x2c4e96,_0x5d5e2c){return db[_0xf544('0x25')][_0xf544('0x26')]({'where':{'id':_0x2c4e96[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x5d5e2c,null))['then'](removeEntity(_0x5d5e2c,null))[_0xf544('0x28')](handleError(_0x5d5e2c,null));};exports[_0xf544('0x21')]=function(_0x3e748c,_0x42bdc4){return db[_0xf544('0x25')][_0xf544('0x21')]()[_0xf544('0x1a')](function(_0x5b81a4){delete _0x5b81a4['tags'];for(var _0x3c0599=0x0;_0x3c05990x0){return new Promise(function(_0x369eed){var _0x6ea18c=[];for(var _0x4a98f4=0x0;_0x4a98f4<_0x42a4a6[_0xf544('0x2a')];_0x4a98f4++){_0x6ea18c[_0xf544('0x60')](insertAdditionalPhones(_0x42a4a6[_0x4a98f4][_0xf544('0x64')],_0x42a4a6[_0x4a98f4][_0xf544('0x5c')]));}Promise[_0xf544('0x65')](_0x6ea18c)[_0xf544('0x1a')](function(){_0x369eed(0x1);});})[_0xf544('0x1a')](function(){return{'success':_0x171ed3,'failure':_0x2223e2,'duplicates':_0xea5743};});}else{return{'success':_0x171ed3,'failure':_0x2223e2,'duplicates':_0xea5743};}}})[_0xf544('0x1a')](respondWithResult(_0x18457b,0xc9))['catch'](handleError(_0x18457b,null));};exports['show']=function(_0x4f4fd8,_0x4aae20){var _0x42719b;return db['CmContact'][_0xf544('0x21')]()[_0xf544('0x1a')](function(_0x4a4895){return db[_0xf544('0x25')][_0xf544('0x26')]({'where':{'id':_0x4f4fd8[_0xf544('0x27')]['id']},'include':[{'model':db[_0xf544('0x66')],'as':_0xf544('0x67'),'attributes':['id',_0xf544('0x1f'),_0xf544('0x68')],'required':_0x4f4fd8[_0xf544('0x24')][_0xf544('0x69')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xf544('0x6a'),'where':{'CmContactId':_0x4f4fd8[_0xf544('0x27')]['id']},'required':![],'include':[{'model':db[_0xf544('0x6b')],'as':_0xf544('0x6c')}]}],'order':[db['sequelize'][_0xf544('0x6d')](_0xf544('0x6e'))],'attributes':_['keys'](_0x4a4895)});})[_0xf544('0x1a')](function(_0x5a9357){if(!_[_0xf544('0x59')](_0x5a9357)){_0x42719b=_0x5a9357[_0xf544('0x3a')]({'plain':!![]});var _0xc15fe5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5a9357&&_0x5a9357['ListId']){if(_0x5a9357[_0xf544('0x62')]){_0xc15fe5['where'][_0xf544('0x6f')][_0xf544('0x60')]({'ListId':{'$ne':_0x5a9357[_0xf544('0x62')]}});}}return db[_0xf544('0x30')][_0xf544('0x23')](_0xc15fe5);}})['then'](function(_0x5bab53){if(!_[_0xf544('0x59')](_0x5bab53)){return _[_0xf544('0x70')](_0x42719b,_[_0xf544('0x71')](_0x5bab53,function(_0x26830f){return util[_0xf544('0x72')](_0xf544('0x73'),_0x26830f['id']);}));}})[_0xf544('0x1a')](handleEntityNotFound(_0x4aae20,null))['then'](respondWithResult(_0x4aae20,null))['catch'](handleError(_0x4aae20,null));};exports[_0xf544('0x19')]=function(_0x4b63c1,_0x3cc301){var _0x179a26;if(_0x4b63c1[_0xf544('0x38')]['id']){delete _0x4b63c1[_0xf544('0x38')]['id'];}if(!_[_0xf544('0x59')](_0x4b63c1[_0xf544('0x38')][_0xf544('0x58')])){var _0x58a6a4=_0x4b63c1['body'][_0xf544('0x58')];if(!_[_0xf544('0x59')](shared[_0xf544('0x5a')][_0x58a6a4]))_0x4b63c1['body'][_0xf544('0x5b')]=shared[_0xf544('0x5a')][_0x58a6a4][_0xf544('0x5b')];}return db[_0xf544('0x25')][_0xf544('0x26')]({'where':{'id':_0x4b63c1['params']['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x3cc301,null))[_0xf544('0x1a')](saveUpdates(_0x4b63c1[_0xf544('0x38')],null))['then'](function(_0x45863d){_0x179a26=_0x45863d;var _0x55ec7c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x45863d&&_0x45863d[_0xf544('0x62')]){if(_0x45863d[_0xf544('0x62')]){_0x55ec7c[_0xf544('0x61')][_0xf544('0x6f')]['push']({'ListId':{'$ne':_0x45863d[_0xf544('0x62')]}});}}return db['CmCustomField'][_0xf544('0x23')](_0x55ec7c);})[_0xf544('0x1a')](function(_0x5348dd){if(_0x5348dd){return _[_0xf544('0x70')](_[_0xf544('0x74')](_0x4b63c1[_0xf544('0x38')],function(_0x542233,_0x4a8fb0){return _[_0xf544('0x2b')](_0x4a8fb0,_0xf544('0x2c'));}),_[_0xf544('0x71')](_0x5348dd,function(_0x2ca0ba){return util[_0xf544('0x72')]('cf_%d',_0x2ca0ba['id']);}));}})[_0xf544('0x1a')](function(_0x3a0f87){if(_0x3a0f87&&!_['isEmpty'](_0x3a0f87)){var _0x13662f=squel['update']()['table']('cm_contacts')[_0xf544('0x75')](_0x3a0f87)[_0xf544('0x61')](_0xf544('0x76'),_0x4b63c1[_0xf544('0x27')]['id'])[_0xf544('0x77')]();return db[_0xf544('0x78')]['query'](_0x13662f[_0xf544('0x79')],{'replacements':_0x13662f[_0xf544('0x33')]});}})[_0xf544('0x1a')](function(){if(_0x4b63c1[_0xf544('0x38')][_0xf544('0x7a')]&&_0x179a26){return db[_0xf544('0x40')][_0xf544('0x19')]({'phone':_0x4b63c1[_0xf544('0x38')][_0xf544('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x179a26['id']}});}})[_0xf544('0x1a')](function(){return _0x179a26;})['then'](respondWithResult(_0x3cc301,null))[_0xf544('0x28')](handleError(_0x3cc301,null));};exports[_0xf544('0x7b')]=function(_0x5338bb,_0xa23214){var _0x1a5ef3={};var _0x45718f={};var _0x1dc3d3;var _0x59aafa;return db['CmContact'][_0xf544('0x7c')]({'where':{'id':_0x5338bb[_0xf544('0x27')]['id']}})['then'](handleEntityNotFound(_0xa23214,null))['then'](function(_0x50ee24){if(_0x50ee24){_0x1dc3d3=_0x50ee24;_0x45718f[_0xf544('0x7d')]=_[_0xf544('0x29')](db[_0xf544('0x66')][_0xf544('0x7e')]);_0x45718f[_0xf544('0x24')]=_[_0xf544('0x29')](_0x5338bb[_0xf544('0x24')]);_0x45718f['filters']=_['intersection'](_0x45718f['model'],_0x45718f[_0xf544('0x24')]);_0x1a5ef3[_0xf544('0x7f')]=_[_0xf544('0x80')](_0x45718f[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x5338bb[_0xf544('0x24')]['fields']));_0x1a5ef3[_0xf544('0x7f')]=_0x1a5ef3[_0xf544('0x7f')][_0xf544('0x2a')]?_0x1a5ef3[_0xf544('0x7f')]:_0x45718f[_0xf544('0x7d')];_0x1a5ef3[_0xf544('0x82')]=qs[_0xf544('0x83')](_0x5338bb[_0xf544('0x24')][_0xf544('0x83')]);_0x1a5ef3[_0xf544('0x61')]=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0x5338bb[_0xf544('0x24')],_0x45718f[_0xf544('0x84')]));if(_0x5338bb['query'][_0xf544('0x86')]){_0x1a5ef3[_0xf544('0x61')]=_[_0xf544('0x37')](_0x1a5ef3[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x1a5ef3[_0xf544('0x7f')],function(_0x2542df){var _0x2b71e7={};_0x2b71e7[_0x2542df]={'$like':'%'+_0x5338bb['query']['filter']+'%'};return _0x2b71e7;})});}_0x1a5ef3=_[_0xf544('0x37')]({},_0x1a5ef3,_0x5338bb[_0xf544('0x87')]);return _0x1dc3d3[_0xf544('0x7b')](_0x1a5ef3);}})['then'](function(_0x2a6c4d){if(_0x2a6c4d){_0x59aafa=_0x2a6c4d[_0xf544('0x2a')];if(!_0x5338bb[_0xf544('0x24')]['hasOwnProperty']('nolimit')){_0x1a5ef3[_0xf544('0x14')]=qs[_0xf544('0x14')](_0x5338bb[_0xf544('0x24')][_0xf544('0x14')]);_0x1a5ef3[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x5338bb[_0xf544('0x24')][_0xf544('0x16')]);}return _0x1dc3d3[_0xf544('0x7b')](_0x1a5ef3);}})['then'](function(_0x58bb18){if(_0x58bb18){return _0x58bb18?{'count':_0x59aafa,'rows':_0x58bb18}:null;}})[_0xf544('0x1a')](respondWithResult(_0xa23214,null))[_0xf544('0x28')](handleError(_0xa23214,null));};exports[_0xf544('0x88')]=function(_0x5f3c33,_0x3bb5f2){if(_0x5f3c33[_0xf544('0x38')]['id']){delete _0x5f3c33[_0xf544('0x38')]['id'];}return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0x5f3c33[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x3bb5f2,null))[_0xf544('0x1a')](function(_0x35c7c7){if(_0x35c7c7){return _0x35c7c7[_0xf544('0x88')](_0x5f3c33[_0xf544('0x38')][_0xf544('0x89')]||[]);}return null;})['then'](respondWithResult(_0x3bb5f2,null))['catch'](handleError(_0x3bb5f2,null));};exports['setAdditionalPhones']=function(_0x2c0a9e,_0x36417c){var _0x230d9c=[];_0x230d9c['push'](addAdditionalPhones(_0x2c0a9e['body']));Promise['all'](_0x230d9c)[_0xf544('0x1a')](function(){_0x230d9c=[];_0x230d9c[_0xf544('0x60')](deleteCmHopperPhones(_0x2c0a9e[_0xf544('0x38')]['id']));_0x230d9c[_0xf544('0x60')](addCmHopperPhones(_0x2c0a9e[_0xf544('0x38')]['id']));Promise[_0xf544('0x65')](_0x230d9c)['then'](function(){return[0x1];})[_0xf544('0x1a')](respondWithResult(_0x36417c,null));});};function addAdditionalPhones(_0x5be731){var _0x5457e0;return new Promise(function(_0x3184f3){return db[_0xf544('0x8a')][_0xf544('0x1b')]({'where':{'CmContactId':_0x5be731['id']}})[_0xf544('0x1a')](function(){db[_0xf544('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0xf544('0x8b')]})[_0xf544('0x1a')](function(_0x45ef48){var _0x1ea216=[];for(var _0x4ae69c=0x0;_0x4ae69c<_0x5be731[_0xf544('0x8c')][_0xf544('0x2a')];_0x4ae69c++){var _0x4a466b=_0x5be731[_0xf544('0x8d')]?_[_0xf544('0x59')](_0x5be731[_0xf544('0x8d')][_0x4ae69c])?'':_0x5be731[_0xf544('0x8d')][_0x4ae69c]:_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')]?_0x5be731[_0xf544('0x8c')][_0x4ae69c]['ItemTypeId']:'';var _0x30c1b7=_['isNil'](_0x5be731[_0xf544('0x8c')][_0x4ae69c]['description'])?'':_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8f')];var _0x1382e5=_0x4a466b+':'+_0x5be731[_0xf544('0x8c')][_0x4ae69c]['phone']+'§'+_0x30c1b7;if(_[_0xf544('0x59')](_0x5457e0))_0x5457e0=_0x1382e5;else _0x5457e0+=';'+_0x1382e5;var _0x2ee894=null;var _0x52f96d=null;if(_0x5be731[_0xf544('0x8d')]){if(!_[_0xf544('0x59')](_0x5be731[_0xf544('0x8d')][_0x4ae69c])){_0x52f96d=_[_0xf544('0x26')](_0x45ef48,function(_0x4ff713){return _0x4ff713['id']===_0x5be731[_0xf544('0x8d')][_0x4ae69c];});if(!_[_0xf544('0x59')](_0x52f96d)){_0x2ee894=_0x52f96d[_0xf544('0x8b')];}}}else{if(!_[_0xf544('0x59')](_0x5be731['items'][_0x4ae69c])){_0x52f96d=_['find'](_0x45ef48,function(_0xbab3bb){return _0xbab3bb['id']===_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')];});if(!_[_0xf544('0x59')](_0x52f96d)){_0x2ee894=_0x4ae69c;}}}if(_['isNil'](_0x2ee894)){_0x2ee894=0x64;}_0x1ea216[_0xf544('0x60')](addAdditionalPhone(_0x5be731['id'],_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x7a')],_0x5be731[_0xf544('0x8d')]?_['isNil'](_0x5be731[_0xf544('0x8d')][_0x4ae69c])?null:_0x5be731[_0xf544('0x8d')][_0x4ae69c]:_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')]?_0x5be731[_0xf544('0x8c')][_0x4ae69c][_0xf544('0x8e')]:null,_0x2ee894,_0x30c1b7));}Promise[_0xf544('0x65')](_0x1ea216)[_0xf544('0x1a')](function(){db['CmContact'][_0xf544('0x19')]({'AdditionalPhones':_0x5457e0},{'where':{'id':_0x5be731['id']}})['then'](function(){_0x3184f3(0x1);});});});});});}function addAdditionalPhone(_0x23369e,_0xaa6413,_0x5366c1,_0x234866,_0x499577){return db[_0xf544('0x8a')][_0xf544('0x26')]({'where':{'CmContactId':_0x23369e,'item':_0xaa6413}})[_0xf544('0x1a')](function(_0x2fe537){if(_0x2fe537)logger['info'](_0xf544('0x90'),_0x2fe537);else{db[_0xf544('0x8a')][_0xf544('0x56')]({'CmContactId':_0x23369e,'item':_0xaa6413,'ItemTypeId':_0x5366c1,'OrderBy':_0x234866,'ItemClass':'PHONE','description':_0x499577});}});}function deleteCmHopperPhones(_0x209688){return new Promise(function(_0x33a9c5){return db[_0xf544('0x40')][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x209688}})[_0xf544('0x1a')](function(_0x597783){db[_0xf544('0x91')][_0xf544('0x1b')]({'where':{'CmHopperId':{'$in':_[_0xf544('0x71')](_0x597783,'id')}}});})[_0xf544('0x1a')](function(){_0x33a9c5(0x1);});});}function addCmHopperPhones(_0x4970fc){return new Promise(function(_0x264cb3){return db[_0xf544('0x40')][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4970fc}})[_0xf544('0x1a')](function(_0x55180c){var _0x3244b0=[];_[_0xf544('0x71')](_0x55180c,function(_0x59dcea){_0x3244b0[_0xf544('0x60')](createCmHopperPhone(_0x4970fc,_0x59dcea['id']));});Promise['all'](_0x3244b0)['then'](function(){_0x264cb3(0x1);});});});}function createCmHopperPhone(_0x12a2c3,_0x53e0ab){return new Promise(function(_0x227028){db[_0xf544('0x8a')][_0xf544('0x23')]({'raw':!![],'attributes':[_0xf544('0x92'),_0xf544('0x8b')],'where':{'CmContactId':_0x12a2c3,'ItemClass':_0xf544('0x93')},'include':[{'model':db[_0xf544('0x6b')],'attributes':[_0xf544('0x8b')],'as':'ItemType'}],'order':[_0xf544('0x8b'),db[_0xf544('0x78')][_0xf544('0x6d')]('`ItemType`.OrderBy')]})['then'](function(_0x39f54b){var _0xcfa1a5=0x1;var _0x57697d=_[_0xf544('0x71')](_0x39f54b,function(_0x1faf9b){_0x1faf9b[_0xf544('0x94')]=_0x53e0ab;_0x1faf9b[_0xf544('0x7a')]=_0x1faf9b[_0xf544('0x92')];_0x1faf9b[_0xf544('0x8b')]=_0xcfa1a5;delete _0x1faf9b[_0xf544('0x95')];_0xcfa1a5=_0xcfa1a5+0x1;return _0x1faf9b;});return db[_0xf544('0x91')][_0xf544('0x5d')](_0x57697d,{});})['then'](function(){_0x227028(0x1);});});}function insertAdditionalPhones(_0x5b30ed,_0x4ff8f8){return new Promise(function(_0x3911d7){var _0x327721=[];for(var _0x39f66a=0x0;_0x39f66a<_0x4ff8f8['length'];_0x39f66a++){var _0x303ac9=_0x4ff8f8[_0x39f66a];_0x327721[_0xf544('0x60')](parseContactItemType(_0x303ac9));}Promise[_0xf544('0x65')](_0x327721)['then'](function(){var _0x48f17d={'id':_0x5b30ed['id'],'items':_0x4ff8f8};return addAdditionalPhones(_0x48f17d)[_0xf544('0x1a')](function(){return addCmHopperPhones(_0x5b30ed['id']);});})[_0xf544('0x1a')](function(){_0x3911d7(_0x5b30ed);});});}function parseContactItemType(_0x58ea43){return new Promise(function(_0x175ed4){if(_0x58ea43[_0xf544('0x36')](_0xf544('0x8e'))){_0x175ed4(_0x58ea43);}else{return db['ContactItemType'][_0xf544('0x26')]({'where':{'name':_0x58ea43[_0xf544('0x6c')]}})[_0xf544('0x1a')](function(_0x796721){if(_[_0xf544('0x59')](_0x796721))_0x58ea43[_0xf544('0x8e')]=null;else _0x58ea43[_0xf544('0x8e')]=_0x796721['id'];_0x175ed4(_0x58ea43);});}});}exports[_0xf544('0x96')]=function(_0x3a6cd2,_0x5cbde9){return db[_0xf544('0x8a')][_0xf544('0x23')]({'raw':!![],'where':{'CmContactId':_0x3a6cd2[_0xf544('0x27')]['id'],'ItemClass':_0xf544('0x93')},'include':[{'model':db[_0xf544('0x6b')],'as':_0xf544('0x6c')}],'order':[[_0xf544('0x8b')],[db[_0xf544('0x78')][_0xf544('0x6d')]('`ItemType`.OrderBy')]]})['then'](function(_0x15984d){return _0x15984d;})[_0xf544('0x1a')](respondWithResult(_0x5cbde9,null))[_0xf544('0x28')](handleError(_0x5cbde9,null));};exports[_0xf544('0x97')]=function(_0x3da223,_0x37a6e3){return db[_0xf544('0x8a')][_0xf544('0x23')]({'raw':!![],'where':{'CmContactId':_0x3da223['body'][_0xf544('0x98')]}})[_0xf544('0x1a')](function(_0x1e3b20){var _0x1ad0ce=_[_0xf544('0x71')](_0x1e3b20,function(_0x2b5bae){_0x2b5bae['CmContactId']=_0x3da223[_0xf544('0x38')][_0xf544('0x99')];return _0x2b5bae;});return db['CmContactHasItem']['bulkCreate'](_0x1ad0ce,{});})[_0xf544('0x1a')](function(){return addCmHopperPhones(_0x3da223[_0xf544('0x38')][_0xf544('0x99')]);})[_0xf544('0x1a')](function(){return['ok'];})[_0xf544('0x1a')](respondWithResult(_0x37a6e3,null))[_0xf544('0x28')](handleError(_0x37a6e3,null));};exports[_0xf544('0x9a')]=function(_0x153399,_0x25fe64){var _0x8b28fb=[];_0x8b28fb[_0xf544('0x60')](createCmHopperPhone(_0x153399['body']['id'],_0x153399[_0xf544('0x38')][_0xf544('0x9b')]));Promise[_0xf544('0x65')](_0x8b28fb)[_0xf544('0x1a')](function(){return[0x1];})['then'](respondWithResult(_0x25fe64,null));};exports[_0xf544('0x9c')]=function(_0x33c96d,_0xaf437e){var _0x51afbb={'raw':![],'where':{}};var _0x505471={};var _0x27c99b={'count':0x0,'rows':[]};return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0x33c96d[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0xaf437e,null))[_0xf544('0x1a')](function(_0x5da7ea){if(_0x5da7ea){_0x505471[_0xf544('0x7d')]=_[_0xf544('0x29')](db[_0xf544('0x40')][_0xf544('0x7e')]);_0x505471[_0xf544('0x24')]=_['keys'](_0x33c96d['query']);_0x505471[_0xf544('0x84')]=_[_0xf544('0x80')](_0x505471['model'],_0x505471['query']);_0x51afbb[_0xf544('0x7f')]=_[_0xf544('0x80')](_0x505471[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x33c96d[_0xf544('0x24')]['fields']));_0x51afbb['attributes']=_0x51afbb['attributes'][_0xf544('0x2a')]?_0x51afbb[_0xf544('0x7f')]:_0x505471[_0xf544('0x7d')];if(!_0x33c96d[_0xf544('0x24')][_0xf544('0x36')](_0xf544('0x9d'))){_0x51afbb['limit']=qs[_0xf544('0x14')](_0x33c96d[_0xf544('0x24')]['limit']);_0x51afbb[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x33c96d['query'][_0xf544('0x16')]);}_0x51afbb[_0xf544('0x82')]=qs['sort'](_0x33c96d['query'][_0xf544('0x83')]);_0x51afbb[_0xf544('0x61')]=qs[_0xf544('0x84')](_['pick'](_0x33c96d[_0xf544('0x24')],_0x505471[_0xf544('0x84')]));_0x51afbb[_0xf544('0x61')][_0xf544('0x9e')]=_0x5da7ea['id'];if(_0x33c96d[_0xf544('0x24')][_0xf544('0x86')]){_0x51afbb[_0xf544('0x61')]=_[_0xf544('0x37')](_0x51afbb[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x51afbb[_0xf544('0x7f')],function(_0xb481d3){var _0x25ac19={};_0x25ac19[_0xb481d3]={'$like':'%'+_0x33c96d[_0xf544('0x24')][_0xf544('0x86')]+'%'};return _0x25ac19;})});}_0x51afbb=_[_0xf544('0x37')]({},_0x51afbb,_0x33c96d[_0xf544('0x87')]);return db[_0xf544('0x40')][_0xf544('0x15')]({'where':_0x51afbb['where']})[_0xf544('0x1a')](function(_0x52f8f6){_0x27c99b['count']=_0x52f8f6;if(_0x33c96d['query'][_0xf544('0x9f')]){_0x51afbb[_0xf544('0xa0')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x51afbb);})[_0xf544('0x1a')](function(_0x318682){_0x27c99b[_0xf544('0xa1')]=_0x318682;return _0x27c99b;});}})['then'](respondWithFilteredResult(_0xaf437e,_0x51afbb))[_0xf544('0x28')](handleError(_0xaf437e,null));};exports[_0xf544('0xa2')]=function(_0xc14583,_0x3811e2){var _0x478b57={'raw':!![],'where':{}};var _0x4d64d8={};var _0x432769={'count':0x0,'rows':[]};return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0xc14583['params']['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x3811e2,null))[_0xf544('0x1a')](function(_0x3e6f09){if(_0x3e6f09){_0x4d64d8[_0xf544('0x7d')]=_[_0xf544('0x29')](db[_0xf544('0x4e')][_0xf544('0x7e')]);_0x4d64d8[_0xf544('0x24')]=_[_0xf544('0x29')](_0xc14583[_0xf544('0x24')]);_0x4d64d8[_0xf544('0x84')]=_[_0xf544('0x80')](_0x4d64d8[_0xf544('0x7d')],_0x4d64d8[_0xf544('0x24')]);_0x478b57['attributes']=_[_0xf544('0x80')](_0x4d64d8[_0xf544('0x7d')],qs['fields'](_0xc14583['query'][_0xf544('0x81')]));_0x478b57[_0xf544('0x7f')]=_0x478b57[_0xf544('0x7f')][_0xf544('0x2a')]?_0x478b57[_0xf544('0x7f')]:_0x4d64d8[_0xf544('0x7d')];if(!_0xc14583[_0xf544('0x24')][_0xf544('0x36')](_0xf544('0x9d'))){_0x478b57[_0xf544('0x14')]=qs[_0xf544('0x14')](_0xc14583[_0xf544('0x24')][_0xf544('0x14')]);_0x478b57[_0xf544('0x16')]=qs['offset'](_0xc14583[_0xf544('0x24')][_0xf544('0x16')]);}_0x478b57[_0xf544('0x82')]=qs[_0xf544('0x83')](_0xc14583[_0xf544('0x24')][_0xf544('0x83')]);_0x478b57['where']=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0xc14583['query'],_0x4d64d8[_0xf544('0x84')]));_0x478b57[_0xf544('0x61')][_0xf544('0x9e')]=_0x3e6f09['id'];if(_0xc14583[_0xf544('0x24')]['filter']){_0x478b57[_0xf544('0x61')]=_[_0xf544('0x37')](_0x478b57['where'],{'$or':_[_0xf544('0x71')](_0x478b57['attributes'],function(_0x3ec87e){var _0x2972f2={};_0x2972f2[_0x3ec87e]={'$like':'%'+_0xc14583['query'][_0xf544('0x86')]+'%'};return _0x2972f2;})});}_0x478b57=_['merge']({},_0x478b57,_0xc14583[_0xf544('0x87')]);return db['CmHopperHistory'][_0xf544('0x15')]({'where':_0x478b57[_0xf544('0x61')]})[_0xf544('0x1a')](function(_0x4fbf1a){_0x432769['count']=_0x4fbf1a;if(_0xc14583[_0xf544('0x24')][_0xf544('0x9f')]){_0x478b57['include']=[{'all':!![]}];}return db[_0xf544('0x4e')][_0xf544('0x23')](_0x478b57);})[_0xf544('0x1a')](function(_0xc59676){_0x432769[_0xf544('0xa1')]=_0xc59676;return _0x432769;});}})[_0xf544('0x1a')](respondWithFilteredResult(_0x3811e2,_0x478b57))[_0xf544('0x28')](handleError(_0x3811e2,null));};exports[_0xf544('0xa3')]=function(_0x51112f,_0x52e3fe){var _0x41a7ab={'raw':!![],'where':{}};var _0x27bbb1={};var _0x5ec8b8={'count':0x0,'rows':[]};return db['CmContact'][_0xf544('0x7c')]({'where':{'id':_0x51112f[_0xf544('0x27')]['id']}})['then'](handleEntityNotFound(_0x52e3fe,null))[_0xf544('0x1a')](function(_0xe7e4e9){if(_0xe7e4e9){_0x27bbb1[_0xf544('0x7d')]=_['keys'](db[_0xf544('0x4d')][_0xf544('0x7e')]);_0x27bbb1['query']=_[_0xf544('0x29')](_0x51112f[_0xf544('0x24')]);_0x27bbb1[_0xf544('0x84')]=_['intersection'](_0x27bbb1[_0xf544('0x7d')],_0x27bbb1[_0xf544('0x24')]);_0x41a7ab[_0xf544('0x7f')]=_['intersection'](_0x27bbb1[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x51112f['query']['fields']));_0x41a7ab['attributes']=_0x41a7ab['attributes'][_0xf544('0x2a')]?_0x41a7ab[_0xf544('0x7f')]:_0x27bbb1[_0xf544('0x7d')];if(!_0x51112f[_0xf544('0x24')][_0xf544('0x36')]('nolimit')){_0x41a7ab[_0xf544('0x14')]=qs[_0xf544('0x14')](_0x51112f['query'][_0xf544('0x14')]);_0x41a7ab[_0xf544('0x16')]=qs['offset'](_0x51112f['query'][_0xf544('0x16')]);}_0x41a7ab[_0xf544('0x82')]=qs['sort'](_0x51112f['query'][_0xf544('0x83')]);_0x41a7ab[_0xf544('0x61')]=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0x51112f['query'],_0x27bbb1[_0xf544('0x84')]));_0x41a7ab[_0xf544('0x61')][_0xf544('0x9e')]=_0xe7e4e9['id'];if(_0x51112f[_0xf544('0x24')]['filter']){_0x41a7ab[_0xf544('0x61')]=_[_0xf544('0x37')](_0x41a7ab[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x41a7ab[_0xf544('0x7f')],function(_0x1a4826){var _0x2d5ac8={};_0x2d5ac8[_0x1a4826]={'$like':'%'+_0x51112f[_0xf544('0x24')][_0xf544('0x86')]+'%'};return _0x2d5ac8;})});}_0x41a7ab=_[_0xf544('0x37')]({},_0x41a7ab,_0x51112f[_0xf544('0x87')]);return db[_0xf544('0x4d')][_0xf544('0x15')]({'where':_0x41a7ab[_0xf544('0x61')]})[_0xf544('0x1a')](function(_0x4eef30){_0x5ec8b8[_0xf544('0x15')]=_0x4eef30;if(_0x51112f['query'][_0xf544('0x9f')]){_0x41a7ab[_0xf544('0xa0')]=[{'all':!![]}];}return db[_0xf544('0x4d')]['findAll'](_0x41a7ab);})[_0xf544('0x1a')](function(_0x6376c5){_0x5ec8b8[_0xf544('0xa1')]=_0x6376c5;return _0x5ec8b8;});}})['then'](respondWithFilteredResult(_0x52e3fe,_0x41a7ab))[_0xf544('0x28')](handleError(_0x52e3fe,null));};exports[_0xf544('0xa4')]=function(_0x98b7db,_0x35376b){var _0x5a2d15={'raw':!![],'where':{}};var _0x4ef714={};var _0x4bff5c={'count':0x0,'rows':[]};return db[_0xf544('0x25')][_0xf544('0x7c')]({'where':{'id':_0x98b7db[_0xf544('0x27')]['id']}})[_0xf544('0x1a')](handleEntityNotFound(_0x35376b,null))[_0xf544('0x1a')](function(_0x3301e8){if(_0x3301e8){_0x4ef714[_0xf544('0x7d')]=_['keys'](db['JscriptySessionReport'][_0xf544('0x7e')]);_0x4ef714[_0xf544('0x24')]=_[_0xf544('0x29')](_0x98b7db[_0xf544('0x24')]);_0x4ef714['filters']=_['intersection'](_0x4ef714[_0xf544('0x7d')],_0x4ef714[_0xf544('0x24')]);_0x5a2d15[_0xf544('0x7f')]=_[_0xf544('0x80')](_0x4ef714[_0xf544('0x7d')],qs[_0xf544('0x81')](_0x98b7db[_0xf544('0x24')][_0xf544('0x81')]));_0x5a2d15['attributes']=_0x5a2d15[_0xf544('0x7f')][_0xf544('0x2a')]?_0x5a2d15[_0xf544('0x7f')]:_0x4ef714['model'];if(!_0x98b7db['query'][_0xf544('0x36')](_0xf544('0x9d'))){_0x5a2d15[_0xf544('0x14')]=qs['limit'](_0x98b7db[_0xf544('0x24')][_0xf544('0x14')]);_0x5a2d15[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x98b7db[_0xf544('0x24')][_0xf544('0x16')]);}_0x5a2d15[_0xf544('0x82')]=qs[_0xf544('0x83')](_0x98b7db[_0xf544('0x24')]['sort']);_0x5a2d15['where']=qs[_0xf544('0x84')](_[_0xf544('0x85')](_0x98b7db[_0xf544('0x24')],_0x4ef714['filters']));_0x5a2d15['where'][_0xf544('0x9e')]=_0x3301e8['id'];if(_0x98b7db[_0xf544('0x24')]['filter']){_0x5a2d15['where']=_['merge'](_0x5a2d15[_0xf544('0x61')],{'$or':_[_0xf544('0x71')](_0x5a2d15[_0xf544('0x7f')],function(_0x372cd0){var _0x861ba0={};_0x861ba0[_0x372cd0]={'$like':'%'+_0x98b7db[_0xf544('0x24')][_0xf544('0x86')]+'%'};return _0x861ba0;})});}_0x5a2d15=_[_0xf544('0x37')]({},_0x5a2d15,_0x98b7db[_0xf544('0x87')]);return db[_0xf544('0x54')][_0xf544('0x15')]({'where':_0x5a2d15[_0xf544('0x61')]})[_0xf544('0x1a')](function(_0x1718ed){_0x4bff5c['count']=_0x1718ed;if(_0x98b7db[_0xf544('0x24')][_0xf544('0x9f')]){_0x5a2d15[_0xf544('0xa0')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5a2d15);})[_0xf544('0x1a')](function(_0x3900f8){_0x4bff5c[_0xf544('0xa1')]=_0x3900f8;return _0x4bff5c;});}})[_0xf544('0x1a')](respondWithFilteredResult(_0x35376b,_0x5a2d15))[_0xf544('0x28')](handleError(_0x35376b,null));};exports['uploadCsv']=function(_0x3dd560,_0x2c2586){try{if(!_0x3dd560[_0xf544('0x38')][_0xf544('0x62')]){throw new Error(_0xf544('0xa5'));}if(!_0x3dd560[_0xf544('0x38')][_0xf544('0xa6')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3dd560[_0xf544('0x38')][_0xf544('0xa7')]){throw new Error(_0xf544('0xa8'));}if(!_0x3dd560['body']['socket_timestamp']){throw new Error(_0xf544('0xa9'));}var _0x3197ac=_0x3dd560[_0xf544('0x38')][_0xf544('0xa6')][_0xf544('0xaa')](',');var _0x312703=_0x3dd560[_0xf544('0x38')][_0xf544('0xa7')]['split'](',');if(!_0x3197ac['length']||!_0x312703[_0xf544('0x2a')]||_0x3197ac[_0xf544('0x2a')]!==_0x312703['length']){throw new Error(_0xf544('0xab'));}_0x3dd560[_0xf544('0x38')][_0xf544('0x81')]=_[_0xf544('0xac')](_0x3197ac,_0x312703);if(!_0x3dd560[_0xf544('0x38')][_0xf544('0x81')][_0xf544('0x7a')]){throw new Error(_0xf544('0xad'));}if(!_0x3dd560[_0xf544('0x38')][_0xf544('0x81')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x3d7918=path[_0xf544('0x57')](config[_0xf544('0xae')],_0xf544('0xaf'),_0x3dd560[_0xf544('0xb0')]['filename']);fs[_0xf544('0xb1')](_0x3d7918,parseInt(_0xf544('0xb2'),0x8));var _0x3c83de=require(_0xf544('0xb3'))[_0xf544('0xb4')](path[_0xf544('0x57')](__dirname,'../../components/import/cm/csv'),[_0x3d7918,_0x3dd560[_0xf544('0x38')][_0xf544('0xa6')],_0x3dd560[_0xf544('0x38')][_0xf544('0xa7')],_0x3dd560['body'][_0xf544('0x62')],_0x3dd560['body']['CompanyId'],_0x3dd560[_0xf544('0x38')][_0xf544('0x5e')],_0x3dd560[_0xf544('0x38')]['socket_timestamp']]);return _0x2c2586['status'](0xc8)[_0xf544('0x12')]({'message':_0xf544('0xb5'),'pid':_0x3c83de[_0xf544('0xb6')]});}catch(_0x24a0b2){return _0x2c2586[_0xf544('0x11')](0x1f4)[_0xf544('0xb7')](_0x24a0b2);}};exports[_0xf544('0xb8')]=function(_0x24d1f9,_0x3e6b08){var _0x155102=fs[_0xf544('0xb9')](_0x24d1f9['file'][_0xf544('0x2')]);Papa[_0xf544('0xba')](_0x155102,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x708b31){return _0x3e6b08[_0xf544('0x11')](0xc8)[_0xf544('0x12')]({'file':_0x24d1f9[_0xf544('0xb0')],'fields':_0x708b31[_0xf544('0xbb')][_0xf544('0x81')]});}});};exports[_0xf544('0xbc')]=function(_0x18c527,_0x48bb12){return db[_0xf544('0xbd')][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0xf544('0xbe')}})[_0xf544('0x1a')](function(_0x1fa9e5){var _0x10df7f=![];if(!_0x18c527['body']['ListId']){throw new Error(_0xf544('0xa5'));}if(!_0x18c527[_0xf544('0x38')][_0xf544('0xbf')][_0xf544('0x7a')]){throw new Error(_0xf544('0xad'));}if(!_0x18c527[_0xf544('0x38')]['binding']['firstName']){throw new Error(_0xf544('0xc0'));}if(!_0x18c527['body']['socket_timestamp']){throw new Error(_0xf544('0xa9'));}var _0x50993e=require(_0xf544('0xb3'))[_0xf544('0xb4')](path[_0xf544('0x57')](__dirname,_0xf544('0xc1')),[_0x18c527['params']['id'],JSON['stringify'](_0x18c527[_0xf544('0x38')]),JSON[_0xf544('0xc2')](_0x1fa9e5)]);_0x50993e['on']('message',function(){_0x10df7f=!![];return _0x48bb12[_0xf544('0x11')](0xc8)['json']({'message':_0xf544('0xc3'),'pid':_0x50993e['pid']});});_0x50993e['on'](_0xf544('0xc4'),function(_0x16432e){if(_0x16432e&&!_0x10df7f){return _0x48bb12[_0xf544('0x11')](0x1f4)['json']({'message':_0xf544('0xc5'),'pid':_0x50993e['pid']});}});})[_0xf544('0x28')](handleError(_0x48bb12,null));};exports[_0xf544('0xc6')]=function(_0x141aa3,_0xc63f22){return db['User'][_0xf544('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xf544('0x1a')](function(_0xf82ec5){var _0x2bf7e6=![];if(!_0x141aa3[_0xf544('0x38')]['ListId']){throw new Error(_0xf544('0xa5'));}if(!_0x141aa3[_0xf544('0x38')]['binding'][_0xf544('0x7a')]){throw new Error(_0xf544('0xad'));}if(!_0x141aa3[_0xf544('0x38')][_0xf544('0xbf')][_0xf544('0xc7')]){throw new Error(_0xf544('0xc0'));}if(!_0x141aa3['body'][_0xf544('0xc8')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3bc341=require(_0xf544('0xb3'))[_0xf544('0xb4')](path[_0xf544('0x57')](__dirname,_0xf544('0xc9')),[_0x141aa3[_0xf544('0x27')]['id'],JSON[_0xf544('0xc2')](_0x141aa3[_0xf544('0x38')]),JSON['stringify'](_0xf82ec5)]);_0x3bc341['on'](_0xf544('0xca'),function(){_0x2bf7e6=!![];return _0xc63f22['status'](0xc8)[_0xf544('0x12')]({'message':_0xf544('0xc3'),'pid':_0x3bc341['pid']});});_0x3bc341['on'](_0xf544('0xc4'),function(_0x4481ed){if(_0x4481ed&&!_0x2bf7e6){return _0xc63f22['status'](0x1f4)[_0xf544('0x12')]({'message':_0xf544('0xc5'),'pid':_0x3bc341[_0xf544('0xb6')]});}});})[_0xf544('0x28')](handleError(_0xc63f22,null));};exports[_0xf544('0xcb')]=function(_0x395e32,_0x16f5ca){var _0x425ae9=[_0xf544('0xcc'),_0xf544('0xcd'),_0xf544('0xce'),_0xf544('0xcf'),_0xf544('0xd0'),'whatsapp',_0xf544('0xd1')];var _0x178aa7={'offset':0x0,'order':qs[_0xf544('0x83')](_0xf544('0xd2'))},_0x3a87ce={'count':0x0,'rows':[]};Promise[_0xf544('0xd3')]()[_0xf544('0x1a')](function(){if(_0x395e32['query'][_0xf544('0xd4')]){if(!_[_0xf544('0xd5')](_0x425ae9,_0x395e32[_0xf544('0x24')][_0xf544('0xd4')][_0xf544('0xd6')]())){throw new Error('Invalid\x20channel');}_0x425ae9=[_0x395e32[_0xf544('0x24')][_0xf544('0xd4')]['toLowerCase']()];}if(_0x395e32[_0xf544('0x24')][_0xf544('0xd7')]){try{var _0xe0402c=JSON['parse'](_0x395e32[_0xf544('0x24')][_0xf544('0xd7')]);if(!moment(_0xe0402c[_0xf544('0x39')])[_0xf544('0xd8')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0xe0402c['to'])[_0xf544('0xd8')]()){throw new Error(_0xf544('0xd9'));}}catch(_0x5bb631){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x395e32[_0xf544('0x24')][_0xf544('0x36')](_0xf544('0x9d'))){_0x178aa7[_0xf544('0x14')]=qs[_0xf544('0x14')](_0x395e32[_0xf544('0x24')][_0xf544('0x14')]||0xa);_0x178aa7[_0xf544('0x16')]=qs[_0xf544('0x16')](_0x395e32[_0xf544('0x24')]['offset']);}var _0x4c1155=_0x425ae9['map'](function(_0x49f785){if(_0x49f785===_0xf544('0xd1')){var _0x59141d={'attributes':['id',_0xf544('0xda'),_0xf544('0x32'),_0xf544('0xdb'),_0xf544('0xdc'),'callerid',_0xf544('0xdd'),_0xf544('0xde'),_0xf544('0xdf'),_0xf544('0xe0'),_0xf544('0xe1'),_0xf544('0xe2'),'userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x395e32['params']['id']},'include':[{'model':db[_0xf544('0xbd')],'as':'User','attributes':['id',_0xf544('0x1f'),_0xf544('0xe3'),_0xf544('0xe4')]}],'order':[[_0xf544('0xe1'),_0xf544('0xe5')]]};if(_0x395e32[_0xf544('0x24')][_0xf544('0xd7')]){_0x59141d[_0xf544('0x61')]['createdAt']={'$gte':_0xe0402c[_0xf544('0x39')],'$lte':_0xe0402c['to']};}return db['VoiceCallReport'][_0xf544('0xe6')](_0x59141d)[_0xf544('0x1a')](function(_0x21c3cd){_0x3a87ce['count']+=_0x21c3cd[_0xf544('0x15')];return _[_0xf544('0x71')](_0x21c3cd[_0xf544('0xa1')],function(_0x5013a0){var _0x19eb82=_0x5013a0[_0xf544('0x3a')]({'plain':!![]});_0x19eb82['channel']=_0x49f785;if(_0x19eb82[_0xf544('0xbd')]){_0x19eb82['User']={'id':_0x19eb82[_0xf544('0xbd')]['id'],'name':_0x19eb82['User'][_0xf544('0x1f')],'fullname':_0x19eb82[_0xf544('0xbd')][_0xf544('0xe3')],'alias':_0x19eb82[_0xf544('0xbd')][_0xf544('0xe4')]};}return _0x19eb82;});});}else{var _0x330df9=_[_0xf544('0xe7')](_0x49f785)+(_0x49f785===_0xf544('0xcd')?_0xf544('0xe8'):_0xf544('0xe9'));var _0x3085b3={'attributes':['id',_0xf544('0xea'),_0xf544('0xeb'),'createdAt',_0xf544('0xe0'),_0xf544('0xec'),'secondDisposition',_0xf544('0xed'),'UserId',_0x330df9+'Id'],'where':{'ContactId':_0x395e32[_0xf544('0x27')]['id']},'include':[{'model':db[_0x330df9],'as':_0xf544('0xe9'),'attributes':['id','name',_0xf544('0xee')]},{'model':db[_0xf544('0xbd')],'as':_0xf544('0xef'),'attributes':['id',_0xf544('0x1f'),_0xf544('0xe3')]},{'model':db[_0xf544('0x66')],'as':_0xf544('0x67'),'attributes':['id','name',_0xf544('0x68')],'through':{'attributes':[]}}],'order':[[_0xf544('0xe1'),_0xf544('0xe5')]]};if(_0x395e32['query'][_0xf544('0xd7')]){_0x3085b3[_0xf544('0x61')][_0xf544('0xe1')]={'$gte':_0xe0402c['from'],'$lte':_0xe0402c['to']};}switch(_0x49f785){case _0xf544('0xcd'):_0x3085b3[_0xf544('0x7f')][_0xf544('0x60')](_0xf544('0xf0'),_0xf544('0xf1'),_0xf544('0xf2'),_0xf544('0xf3'),_0xf544('0xf4'),_0xf544('0xf5'),'ratingType',_0xf544('0xf6'),_0xf544('0xf7'));break;case _0xf544('0xcc'):_0x3085b3['attributes']['push'](_0xf544('0xf8'),_0xf544('0xf9'));break;case'openchannel':_0x3085b3[_0xf544('0x7f')][_0xf544('0x60')](_0xf544('0xfa'),'threadId');break;}return db[_[_0xf544('0xe7')](_0x49f785)+_0xf544('0xfb')]['findAndCountAll'](_0x3085b3)[_0xf544('0x1a')](function(_0x19f619){_0x3a87ce[_0xf544('0x15')]+=_0x19f619[_0xf544('0x15')];return _['map'](_0x19f619[_0xf544('0xa1')],function(_0x5d8498){var _0x2183c1=_0x5d8498[_0xf544('0x3a')]({'plain':!![]});_0x2183c1[_0xf544('0xd4')]=_0x49f785;if(_0x2183c1['Owner']){_0x2183c1[_0xf544('0xef')]={'id':_0x2183c1['Owner']['id'],'name':_0x2183c1[_0xf544('0xef')][_0xf544('0x1f')],'fullname':_0x2183c1['Owner']['fullname']};}return _0x2183c1;});});}});return Promise[_0xf544('0x65')](_0x4c1155);})[_0xf544('0x1a')](function(_0x518636){return _(_0x518636)[_0xf544('0xfc')]()['sortBy']('createdAt')[_0xf544('0xfd')]()[_0xf544('0xfe')]();})['then'](function(_0x4224a4){_0x3a87ce[_0xf544('0xa1')]=_0x178aa7['limit']?_0x4224a4['slice'](_0x178aa7['offset'],_0x178aa7[_0xf544('0x16')]+_0x178aa7[_0xf544('0x14')]):_0x4224a4;return _0x3a87ce;})[_0xf544('0x1a')](respondWithFilteredResult(_0x16f5ca,_0x178aa7))[_0xf544('0x28')](handleError(_0x16f5ca,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 382993a..b97ef4d 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cda=['hook','exports','events','../../mysqldb','CmContact','save','update','remove','emit'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x7cda,0xda));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa7cd('0x0'));var CmContact=require(_0xa7cd('0x1'))['db'][_0xa7cd('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7cd('0x3'),'afterUpdate':_0xa7cd('0x4'),'afterDestroy':_0xa7cd('0x5')};function emitEvent(_0x25189c){return function(_0x18fe6f,_0x535eca,_0x338244){CmContactEvents[_0xa7cd('0x6')](_0x25189c+':'+_0x18fe6f['id'],_0x18fe6f);CmContactEvents[_0xa7cd('0x6')](_0x25189c,_0x18fe6f);_0x338244(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xa7cd('0x7')](e,emitEvent(event));}}module[_0xa7cd('0x8')]=CmContactEvents; \ No newline at end of file +var _0xef6a=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1f7f6e,_0x103a61){var _0x2747df=function(_0x35a06e){while(--_0x35a06e){_0x1f7f6e['push'](_0x1f7f6e['shift']());}};_0x2747df(++_0x103a61);}(_0xef6a,0x119));var _0xaef6=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xef6a[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xaef6('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xaef6('0x1')](0x0);var events={'afterCreate':_0xaef6('0x2'),'afterUpdate':_0xaef6('0x3'),'afterDestroy':_0xaef6('0x4')};function emitEvent(_0x364601){return function(_0x2c8221,_0x1cb82c,_0x20f444){CmContactEvents[_0xaef6('0x5')](_0x364601+':'+_0x2c8221['id'],_0x2c8221);CmContactEvents[_0xaef6('0x5')](_0x364601,_0x2c8221);_0x20f444(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xaef6('0x6')](e,emitEvent(event));}}module[_0xaef6('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 2fff03a..0fde338 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd31d=['firstName','lastName','fax','email','utf8mb4','utf8mb4_unicode_ci','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','minutes','CmHopper','findOne','create','ListId','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','Campaign','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','length','get','always','onlyIfOpen','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Lists','message','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone'];(function(_0x486151,_0x34d13b){var _0x853b27=function(_0x4b5f8a){while(--_0x4b5f8a){_0x486151['push'](_0x486151['shift']());}};_0x853b27(++_0x34d13b);}(_0xd31d,0x155));var _0xdd31=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xd31d[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0xdd31('0x0'));var util=require(_0xdd31('0x1'));var logger=require('../../config/logger')(_0xdd31('0x2'));var moment=require(_0xdd31('0x3'));var BPromise=require(_0xdd31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd31('0x5'));var rimraf=require(_0xdd31('0x6'));var config=require(_0xdd31('0x7'));var shared=require(_0xdd31('0x8'));var attributes=require(_0xdd31('0x9'));module[_0xdd31('0xa')]=function(_0x4cb934,_0x1004d7){return _0x4cb934['define'](_0xdd31('0xb'),attributes,{'tableName':_0xdd31('0xc'),'paranoid':!![],'indexes':[{'name':_0xdd31('0xd'),'fields':[_0xdd31('0xd')]},{'name':'fti_cm_contacts','fields':[_0xdd31('0xe'),_0xdd31('0xf'),_0xdd31('0xd'),'mobile',_0xdd31('0x10'),_0xdd31('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xdd31('0x12'),'collate':_0xdd31('0x13'),'hooks':{'afterCreate':function(_0x440226,_0x14c9bf,_0x8c2896){var _0x3c991b=_0x4cb934['models'];var _0x39df8b=_0x440226['get']({'plain':!![]});function _0x4601ca(){return function(_0x2ef430){logger[_0xdd31('0x14')]('cmContact',_0xdd31('0x15'),util[_0xdd31('0x16')](_0x2ef430,{'showHidden':![],'depth':null}));};}function _0x19b904(_0x471b86,_0x4039f6){var _0x3d17c0=_0x4039f6[_0xdd31('0x17')]?_0x4039f6[_0xdd31('0x17')]:moment()[_0xdd31('0x18')](_0xdd31('0x19'));return new BPromise(function(_0x16f2d2,_0x426c16){if(_[_0xdd31('0x1a')](_0x4039f6[_0xdd31('0x1b')])){_0x16f2d2({'ret':_0x3d17c0});}else{_0x3c991b[_0xdd31('0x1c')]['findOne']({'where':{'id':_0x471b86['id']}})[_0xdd31('0x1d')](function(_0x506c6d){if(!_['isNil'](_0x506c6d)){var _0x1ddddd=_0x506c6d[_0xdd31('0x1b')];if(!_[_0xdd31('0x1a')](_0x1ddddd)){var _0x2a0d7a=shared[_0xdd31('0x1e')];var _0x4fc038=_0x2a0d7a[_0x1ddddd];var _0x265f33=_0x2a0d7a[_0x4039f6['dialTimezone']];if(!_['isNil'](_0x4fc038)&&!_[_0xdd31('0x1a')](_0x265f33)){var _0x8ef0fe=_0x4fc038[_0xdd31('0x1f')]-_0x265f33['utcOffset'];_0x3d17c0=_0x4039f6[_0xdd31('0x17')]?_0x4039f6[_0xdd31('0x17')]:moment();var _0x14c3fa=moment(_0x3d17c0)[_0xdd31('0x20')](_0x8ef0fe,_0xdd31('0x21'));_0x16f2d2({'ret':_0x14c3fa[_0xdd31('0x18')](_0xdd31('0x19'))});}else _0x16f2d2({'ret':_0x3d17c0});}else _0x16f2d2({'ret':_0x3d17c0});}else{_0x16f2d2({'ret':_0x3d17c0});}});}});return 0xa;}var _0xd055a4=function(_0x60d1aa){return new BPromise(function(_0x6f5b6f,_0x54e9bd){_0x19b904(_0x60d1aa,_0x39df8b)[_0xdd31('0x1d')](function(_0x3dc932){_0x39df8b[_0xdd31('0x17')]=_0x3dc932['ret'];_0x3c991b[_0xdd31('0x22')][_0xdd31('0x23')]({'where':{'phone':_0x39df8b[_0xdd31('0xd')],'VoiceQueueId':_0x60d1aa['id']}})[_0xdd31('0x1d')](function(_0xe5b17f){if(!_['isNil'](_0xe5b17f)){throw new Error('cmContact,\x20afterCreate\x20'+_0x39df8b[_0xdd31('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x60d1aa['id']);}return _0x3c991b[_0xdd31('0x22')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'priority':_0x39df8b[_0xdd31('0x26')]?_0x39df8b[_0xdd31('0x26')]:0x2,'scheduledat':_0x39df8b[_0xdd31('0x17')]?_0x39df8b[_0xdd31('0x17')]:moment()['format'](_0xdd31('0x19')),'callback':_0x39df8b[_0xdd31('0x27')]?!![]:![],'callbackuniqueid':_0x39df8b[_0xdd31('0x27')]?_0x39df8b[_0xdd31('0x27')]:undefined,'callbackat':_0x39df8b[_0xdd31('0x27')]?moment()[_0xdd31('0x18')](_0xdd31('0x19')):undefined,'VoiceQueueId':_0x60d1aa['id']});})[_0xdd31('0x28')](function(_0x54e3a8){_0x54e9bd(_0x54e3a8);});});});};var _0x3cc8e9=function(_0x152c8c){return new BPromise(function(_0x1a8d70,_0x26189b){_0x19b904(_0x152c8c,_0x39df8b)['then'](function(_0x3eeb10){_0x39df8b[_0xdd31('0x17')]=_0x3eeb10[_0xdd31('0x29')];_0x3c991b[_0xdd31('0x22')][_0xdd31('0x23')]({'where':{'phone':_0x39df8b[_0xdd31('0xd')],'VoiceQueueId':_0x152c8c['id']}})[_0xdd31('0x1d')](function(_0x3767aa){if(!_[_0xdd31('0x1a')](_0x3767aa)){throw new Error('cmContact,\x20afterCreate\x20'+_0x39df8b[_0xdd31('0xd')]+_0xdd31('0x2a')+_0x152c8c['id']);}return _0x3c991b[_0xdd31('0x2b')][_0xdd31('0x23')]({'where':{'calleridnum':_0x39df8b[_0xdd31('0xd')],'VoiceQueueId':_0x152c8c['id']}});})[_0xdd31('0x1d')](function(_0x5b546f){if(!_[_0xdd31('0x1a')](_0x5b546f)){throw new Error(_0xdd31('0x2c')+_0x39df8b[_0xdd31('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x152c8c['id']);}return _0x3c991b[_0xdd31('0x22')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'priority':_0x39df8b['priority']?_0x39df8b[_0xdd31('0x26')]:0x2,'scheduledat':_0x39df8b[_0xdd31('0x17')]?_0x39df8b['scheduledat']:moment()[_0xdd31('0x18')](_0xdd31('0x19')),'callback':_0x39df8b[_0xdd31('0x27')]?!![]:![],'callbackuniqueid':_0x39df8b[_0xdd31('0x27')]?_0x39df8b['callbackUniqueid']:undefined,'callbackat':_0x39df8b[_0xdd31('0x27')]?moment()[_0xdd31('0x18')](_0xdd31('0x19')):undefined,'VoiceQueueId':_0x152c8c['id']});})[_0xdd31('0x28')](function(_0x4ea766){_0x26189b(_0x4ea766);});});});};function _0x249d54(){return function(_0x54812d){logger['error']('cmContact','afterCreate',util[_0xdd31('0x16')](_0x54812d,{'showHidden':![],'depth':null}));};}function _0x29942d(_0x9c1e01,_0xa2befd){var _0x485e5b=_0xa2befd['scheduledat']?_0xa2befd['scheduledat']:moment()[_0xdd31('0x18')](_0xdd31('0x19'));return new BPromise(function(_0x2969ce,_0x5c7511){if(_['isNil'](_0xa2befd[_0xdd31('0x1b')])){_0x2969ce({'ret':_0x485e5b});}else{_0x3c991b[_0xdd31('0x2d')][_0xdd31('0x23')]({'where':{'id':_0x9c1e01['id']}})[_0xdd31('0x1d')](function(_0x373d5b){if(!_['isNil'](_0x373d5b)){var _0x317324=_0x373d5b[_0xdd31('0x1b')];if(!_[_0xdd31('0x1a')](_0x317324)){var _0x46c7cf=shared[_0xdd31('0x1e')];var _0x3766df=_0x46c7cf[_0x317324];var _0x1a1f53=_0x46c7cf[_0xa2befd[_0xdd31('0x1b')]];if(!_[_0xdd31('0x1a')](_0x3766df)&&!_[_0xdd31('0x1a')](_0x1a1f53)){var _0xbbc139=_0x3766df[_0xdd31('0x1f')]-_0x1a1f53[_0xdd31('0x1f')];_0x485e5b=_0xa2befd[_0xdd31('0x17')]?_0xa2befd['scheduledat']:moment();var _0x1d1956=moment(_0x485e5b)[_0xdd31('0x20')](_0xbbc139,'minutes');_0x2969ce({'ret':_0x1d1956[_0xdd31('0x18')](_0xdd31('0x19'))});}else _0x2969ce({'ret':_0x485e5b});}else _0x2969ce({'ret':_0x485e5b});}else{_0x2969ce({'ret':_0x485e5b});}});}});return 0xa;}var _0x5cd31f=function(_0x43b175){return new BPromise(function(_0x2e23a4,_0xe49613){_0x29942d(_0x43b175,_0x39df8b)['then'](function(_0x53d083){_0x39df8b[_0xdd31('0x17')]=_0x53d083[_0xdd31('0x29')];_0x3c991b['CmHopper'][_0xdd31('0x23')]({'where':{'phone':_0x39df8b['phone'],'CampaignId':_0x43b175['id']}})['then'](function(_0xcb2d38){if(!_[_0xdd31('0x1a')](_0xcb2d38)){throw new Error(_0xdd31('0x2e')+_0x39df8b[_0xdd31('0xd')]+_0xdd31('0x2f')+_0x43b175['id']);}return _0x3c991b[_0xdd31('0x22')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'priority':_0x39df8b[_0xdd31('0x26')]?_0x39df8b[_0xdd31('0x26')]:0x2,'scheduledat':_0x39df8b[_0xdd31('0x17')]?_0x39df8b[_0xdd31('0x17')]:moment()[_0xdd31('0x18')](_0xdd31('0x19')),'callback':_0x39df8b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x39df8b[_0xdd31('0x27')]?_0x39df8b[_0xdd31('0x27')]:undefined,'callbackat':_0x39df8b['callbackUniqueid']?moment()[_0xdd31('0x18')](_0xdd31('0x19')):undefined,'CampaignId':_0x43b175['id']});})[_0xdd31('0x28')](function(_0x57c658){_0xe49613(_0x57c658);});});});};var _0x8f9a76=function(_0x553d8f){return new BPromise(function(_0x550901,_0x253166){_0x29942d(_0x553d8f,_0x39df8b)[_0xdd31('0x1d')](function(_0x14ec2a){_0x39df8b[_0xdd31('0x17')]=_0x14ec2a['ret'];_0x3c991b[_0xdd31('0x22')]['findOne']({'where':{'phone':_0x39df8b[_0xdd31('0xd')],'CampaignId':_0x553d8f['id']}})['then'](function(_0x177e5f){if(!_[_0xdd31('0x1a')](_0x177e5f)){throw new Error(_0xdd31('0x2e')+_0x39df8b[_0xdd31('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x553d8f['id']);}return _0x3c991b[_0xdd31('0x2b')]['findOne']({'where':{'calleridnum':_0x39df8b[_0xdd31('0xd')],'CampaignId':_0x553d8f['id']}});})[_0xdd31('0x1d')](function(_0x597f5e){if(!_[_0xdd31('0x1a')](_0x597f5e)){throw new Error(_0xdd31('0x2c')+_0x39df8b['phone']+_0xdd31('0x30')+_0x553d8f['id']);}return _0x3c991b['CmHopper'][_0xdd31('0x24')]({'phone':_0x39df8b['phone'],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b['ListId'],'priority':_0x39df8b[_0xdd31('0x26')]?_0x39df8b['priority']:0x2,'scheduledat':_0x39df8b[_0xdd31('0x17')]?_0x39df8b[_0xdd31('0x17')]:moment()[_0xdd31('0x18')](_0xdd31('0x19')),'callback':_0x39df8b[_0xdd31('0x27')]?!![]:![],'callbackuniqueid':_0x39df8b['callbackUniqueid']?_0x39df8b['callbackUniqueid']:undefined,'callbackat':_0x39df8b[_0xdd31('0x27')]?moment()[_0xdd31('0x18')](_0xdd31('0x19')):undefined,'CampaignId':_0x553d8f['id']});})[_0xdd31('0x28')](function(_0x4c859f){_0x253166(_0x4c859f);});});});};if(_0x39df8b[_0xdd31('0x25')]){_0x3c991b[_0xdd31('0x1c')][_0xdd31('0x31')]({'where':{'type':_0xdd31('0x32')},'attributes':['id',_0xdd31('0x33'),'dialTimezone'],'include':[{'model':_0x3c991b['CmList'],'as':'Lists','where':{'id':_0x39df8b[_0xdd31('0x25')]}}]})[_0xdd31('0x1d')](function(_0x35ae65){if(_0x35ae65){var _0x55882d=[];for(var _0x2607e5=0x0,_0x40be7d;_0x2607e5<_0x35ae65[_0xdd31('0x34')];_0x2607e5+=0x1){_0x40be7d=_0x35ae65[_0x2607e5][_0xdd31('0x35')]({'plain':!![]});switch(_0x40be7d['dialCheckDuplicateType']){case _0xdd31('0x36'):_0x3cc8e9(_0x40be7d)[_0xdd31('0x28')](_0x4601ca());break;case _0xdd31('0x37'):_0xd055a4(_0x40be7d)[_0xdd31('0x28')](_0x4601ca());break;default:_0x29942d(_0x40be7d,_0x39df8b)[_0xdd31('0x1d')](function(_0x26aff9){_0x39df8b[_0xdd31('0x17')]=_0x26aff9['ret'];_0x3c991b[_0xdd31('0x22')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'scheduledat':_0x39df8b[_0xdd31('0x17')]?_0x39df8b['scheduledat']:moment()[_0xdd31('0x18')](_0xdd31('0x19')),'priority':_0x39df8b[_0xdd31('0x26')]?_0x39df8b[_0xdd31('0x26')]:0x2,'callback':_0x39df8b[_0xdd31('0x27')]?!![]:![],'callbackuniqueid':_0x39df8b['callbackUniqueid']?_0x39df8b[_0xdd31('0x27')]:undefined,'callbackat':_0x39df8b['callbackUniqueid']?moment()[_0xdd31('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x40be7d['id']})[_0xdd31('0x28')](_0x4601ca());});}}}})[_0xdd31('0x1d')](function(){return _0x3c991b[_0xdd31('0x1c')][_0xdd31('0x31')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x3c991b[_0xdd31('0x38')],'as':_0xdd31('0x39'),'where':{'id':_0x39df8b[_0xdd31('0x25')]}}]})['then'](function(_0x8b488a){if(_0x8b488a){var _0x14e036=[];for(var _0x2cd170=0x0,_0x43bfb1;_0x2cd170<_0x8b488a[_0xdd31('0x34')];_0x2cd170+=0x1){_0x43bfb1=_0x8b488a[_0x2cd170][_0xdd31('0x35')]({'plain':!![]});_0x3c991b[_0xdd31('0x3a')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'VoiceQueueId':_0x43bfb1['id']})[_0xdd31('0x28')](function(_0x506592){logger[_0xdd31('0x14')](_0xdd31('0x3b'),_0xdd31('0x15'),_0x506592['message']);});}}});})[_0xdd31('0x1d')](function(){return _0x3c991b['Campaign'][_0xdd31('0x31')]({'attributes':['id','dialCheckDuplicateType',_0xdd31('0x1b')],'include':[{'model':_0x3c991b[_0xdd31('0x38')],'as':_0xdd31('0x3c'),'where':{'id':_0x39df8b[_0xdd31('0x25')]}}]})[_0xdd31('0x1d')](function(_0x24a435){if(_0x24a435){var _0x3d004c=[];for(var _0x51723c=0x0,_0x12efdf;_0x51723c<_0x24a435[_0xdd31('0x34')];_0x51723c+=0x1){_0x12efdf=_0x24a435[_0x51723c][_0xdd31('0x35')]({'plain':!![]});switch(_0x12efdf[_0xdd31('0x33')]){case'always':_0x8f9a76(_0x12efdf)[_0xdd31('0x28')](_0x249d54());break;case _0xdd31('0x37'):_0x5cd31f(_0x12efdf)[_0xdd31('0x28')](_0x249d54());break;default:_0x3c991b[_0xdd31('0x22')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'scheduledat':_0x39df8b['scheduledat']?_0x39df8b[_0xdd31('0x17')]:moment()[_0xdd31('0x18')](_0xdd31('0x19')),'priority':_0x39df8b[_0xdd31('0x26')]?_0x39df8b[_0xdd31('0x26')]:0x2,'callback':_0x39df8b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x39df8b[_0xdd31('0x27')]?_0x39df8b[_0xdd31('0x27')]:undefined,'callbackat':_0x39df8b[_0xdd31('0x27')]?moment()[_0xdd31('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x12efdf['id']})[_0xdd31('0x28')](_0x249d54());}}}});})[_0xdd31('0x1d')](function(){return _0x3c991b[_0xdd31('0x2d')][_0xdd31('0x31')]({'attributes':['id'],'include':[{'model':_0x3c991b[_0xdd31('0x38')],'as':_0xdd31('0x39'),'where':{'id':_0x39df8b[_0xdd31('0x25')]}}]})[_0xdd31('0x1d')](function(_0xae8841){if(_0xae8841){var _0x3a363a=[];for(var _0x53538e=0x0,_0x47d98f;_0x53538e<_0xae8841[_0xdd31('0x34')];_0x53538e+=0x1){_0x47d98f=_0xae8841[_0x53538e]['get']({'plain':!![]});_0x3c991b[_0xdd31('0x3a')][_0xdd31('0x24')]({'phone':_0x39df8b[_0xdd31('0xd')],'ContactId':_0x39df8b['id'],'ListId':_0x39df8b[_0xdd31('0x25')],'CampaignId':_0x47d98f['id']})[_0xdd31('0x28')](function(_0x3d2563){logger['error'](_0xdd31('0x3b'),_0xdd31('0x15'),_0x3d2563['message']);});}}});})['then'](function(){_0x8c2896();})[_0xdd31('0x28')](function(_0x1a1b7b){logger[_0xdd31('0x14')](_0xdd31('0x3b'),'afterCreate',_0x1a1b7b[_0xdd31('0x3d')]);_0x8c2896(_0x1a1b7b);});}else{_0x8c2896(new Error(_0xdd31('0x3e')));}},'afterDestroy':function(_0x1f0259,_0x18870a,_0x144c84){var _0x4b0f7f=_0x4cb934[_0xdd31('0x3f')];var _0x4862e9=_0x1f0259['get']({'plain':!![]});return _0x4b0f7f['CmHopper'][_0xdd31('0x31')]({'raw':!![],'where':{'ListId':_0x4862e9[_0xdd31('0x25')],'ContactId':_0x4862e9['id']}})[_0xdd31('0x1d')](function(_0x3e0591){if(!_[_0xdd31('0x40')](_0x3e0591)){var _0x3e135e=[];for(var _0x350089=0x0;_0x350089<_0x3e0591[_0xdd31('0x34')];_0x350089+=0x1){var _0x4d0d96=_0x4b0f7f[_0xdd31('0x22')][_0xdd31('0x41')]({'where':{'ListId':_0x3e0591[_0x350089][_0xdd31('0x25')],'ContactId':_0x3e0591[_0x350089][_0xdd31('0x42')],'VoiceQueueId':_0x3e0591[_0x350089][_0xdd31('0x43')],'CampaignId':_0x3e0591[_0x350089][_0xdd31('0x44')]}});_0x3e135e['push'](_0x4d0d96);}return BPromise['all'](_0x3e135e);}})[_0xdd31('0x1d')](function(_0x130667){logger[_0xdd31('0x45')]('[CmContact][afterDestroy][Succesfull]',util[_0xdd31('0x16')](_0x130667,{'showHidden':![],'depth':null}));_0x144c84();})['catch'](function(_0x55d15c){logger['error'](_0xdd31('0x46'),util[_0xdd31('0x16')](_0x55d15c,{'showHidden':![],'depth':null}));_0x144c84(_0x55d15c);});}}});}; \ No newline at end of file +var _0x3973=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','CmHopperBlack','BlackLists','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','push','all','inspect','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','firstName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal'];(function(_0x1d5fb9,_0x43aa73){var _0xd72009=function(_0x44052e){while(--_0x44052e){_0x1d5fb9['push'](_0x1d5fb9['shift']());}};_0xd72009(++_0x43aa73);}(_0x3973,0xdd));var _0x3397=function(_0x54e18b,_0x9e4e7a){_0x54e18b=_0x54e18b-0x0;var _0x199dbd=_0x3973[_0x54e18b];return _0x199dbd;};'use strict';var _=require('lodash');var util=require(_0x3397('0x0'));var logger=require(_0x3397('0x1'))(_0x3397('0x2'));var moment=require(_0x3397('0x3'));var BPromise=require('bluebird');var rp=require(_0x3397('0x4'));var fs=require('fs');var path=require(_0x3397('0x5'));var rimraf=require(_0x3397('0x6'));var config=require(_0x3397('0x7'));var shared=require(_0x3397('0x8'));var attributes=require(_0x3397('0x9'));module[_0x3397('0xa')]=function(_0x24ea45,_0x3ffb6e){return _0x24ea45['define'](_0x3397('0xb'),attributes,{'tableName':_0x3397('0xc'),'paranoid':!![],'indexes':[{'name':_0x3397('0xd'),'fields':[_0x3397('0xd')]},{'name':'fti_cm_contacts','fields':[_0x3397('0xe'),'lastName',_0x3397('0xd'),_0x3397('0xf'),'fax',_0x3397('0x10')],'type':_0x3397('0x11')}],'timestamps':!![],'charset':_0x3397('0x12'),'collate':_0x3397('0x13'),'hooks':{'afterCreate':function(_0xbee250,_0x257f67,_0x24b3c8){var _0x47ed4b=_0x24ea45[_0x3397('0x14')];var _0x44fa91=_0xbee250[_0x3397('0x15')]({'plain':!![]});function _0x403782(){return function(_0x19260b){logger[_0x3397('0x16')]('cmContact',_0x3397('0x17'),util['inspect'](_0x19260b,{'showHidden':![],'depth':null}));};}function _0x4d1bd2(_0x24906a,_0xb15a86){var _0xae0e14=_0xb15a86[_0x3397('0x18')]?_0xb15a86[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a'));return new BPromise(function(_0x20d761,_0x1e4ccf){if(_[_0x3397('0x1b')](_0xb15a86[_0x3397('0x1c')])){_0x20d761({'ret':_0xae0e14});}else{_0x47ed4b[_0x3397('0x1d')][_0x3397('0x1e')]({'where':{'id':_0x24906a['id']}})['then'](function(_0xc1d6cc){if(!_['isNil'](_0xc1d6cc)){var _0x4dd4fb=_0xc1d6cc['dialTimezone'];if(!_[_0x3397('0x1b')](_0x4dd4fb)){var _0x4833d2=shared[_0x3397('0x1f')];var _0x48bcff=_0x4833d2[_0x4dd4fb];var _0x2eb4b9=_0x4833d2[_0xb15a86[_0x3397('0x1c')]];if(!_['isNil'](_0x48bcff)&&!_[_0x3397('0x1b')](_0x2eb4b9)){var _0x582f69=_0x48bcff[_0x3397('0x20')]-_0x2eb4b9[_0x3397('0x20')];_0xae0e14=_0xb15a86[_0x3397('0x18')]?_0xb15a86[_0x3397('0x18')]:moment();var _0x1b1eab=moment(_0xae0e14)[_0x3397('0x21')](_0x582f69,'minutes');_0x20d761({'ret':_0x1b1eab['format'](_0x3397('0x1a'))});}else _0x20d761({'ret':_0xae0e14});}else _0x20d761({'ret':_0xae0e14});}else{_0x20d761({'ret':_0xae0e14});}});}});return 0xa;}var _0x53d4f2=function(_0x5778d5){return new BPromise(function(_0x3c8fa,_0x3cc7fc){_0x4d1bd2(_0x5778d5,_0x44fa91)[_0x3397('0x22')](function(_0x50ff99){_0x44fa91['scheduledat']=_0x50ff99[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')][_0x3397('0x1e')]({'where':{'phone':_0x44fa91[_0x3397('0xd')],'VoiceQueueId':_0x5778d5['id']}})[_0x3397('0x22')](function(_0x1e086a){if(!_[_0x3397('0x1b')](_0x1e086a)){throw new Error(_0x3397('0x25')+_0x44fa91[_0x3397('0xd')]+_0x3397('0x26')+_0x5778d5['id']);}return _0x47ed4b[_0x3397('0x24')][_0x3397('0x27')]({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'priority':_0x44fa91[_0x3397('0x29')]?_0x44fa91['priority']:0x2,'scheduledat':_0x44fa91['scheduledat']?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a')),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'VoiceQueueId':_0x5778d5['id']});})[_0x3397('0x2b')](function(_0x575357){_0x3cc7fc(_0x575357);});});});};var _0x258b62=function(_0xb6662c){return new BPromise(function(_0x3c2faf,_0x1d56ef){_0x4d1bd2(_0xb6662c,_0x44fa91)[_0x3397('0x22')](function(_0x28dc28){_0x44fa91[_0x3397('0x18')]=_0x28dc28[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')][_0x3397('0x1e')]({'where':{'phone':_0x44fa91[_0x3397('0xd')],'VoiceQueueId':_0xb6662c['id']}})[_0x3397('0x22')](function(_0x48dea4){if(!_[_0x3397('0x1b')](_0x48dea4)){throw new Error(_0x3397('0x25')+_0x44fa91[_0x3397('0xd')]+_0x3397('0x2c')+_0xb6662c['id']);}return _0x47ed4b['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x44fa91[_0x3397('0xd')],'VoiceQueueId':_0xb6662c['id']}});})['then'](function(_0x53c541){if(!_[_0x3397('0x1b')](_0x53c541)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x44fa91[_0x3397('0xd')]+_0x3397('0x2d')+_0xb6662c['id']);}return _0x47ed4b['CmHopper']['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'priority':_0x44fa91['priority']?_0x44fa91[_0x3397('0x29')]:0x2,'scheduledat':_0x44fa91[_0x3397('0x18')]?_0x44fa91['scheduledat']:moment()[_0x3397('0x19')](_0x3397('0x1a')),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91['callbackUniqueid']?moment()[_0x3397('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xb6662c['id']});})[_0x3397('0x2b')](function(_0x319ac2){_0x1d56ef(_0x319ac2);});});});};function _0x54246b(){return function(_0x24b59e){logger[_0x3397('0x16')]('cmContact',_0x3397('0x17'),util['inspect'](_0x24b59e,{'showHidden':![],'depth':null}));};}function _0x74c431(_0x154063,_0x2fccd1){var _0x583979=_0x2fccd1[_0x3397('0x18')]?_0x2fccd1[_0x3397('0x18')]:moment()[_0x3397('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xe95129,_0x3d9927){if(_[_0x3397('0x1b')](_0x2fccd1[_0x3397('0x1c')])){_0xe95129({'ret':_0x583979});}else{_0x47ed4b[_0x3397('0x2e')]['findOne']({'where':{'id':_0x154063['id']}})[_0x3397('0x22')](function(_0x3ebd7f){if(!_[_0x3397('0x1b')](_0x3ebd7f)){var _0x1eb4ea=_0x3ebd7f[_0x3397('0x1c')];if(!_[_0x3397('0x1b')](_0x1eb4ea)){var _0x1cbb5d=shared[_0x3397('0x1f')];var _0x3a850a=_0x1cbb5d[_0x1eb4ea];var _0xa53f4c=_0x1cbb5d[_0x2fccd1[_0x3397('0x1c')]];if(!_[_0x3397('0x1b')](_0x3a850a)&&!_[_0x3397('0x1b')](_0xa53f4c)){var _0x4c5ffb=_0x3a850a[_0x3397('0x20')]-_0xa53f4c[_0x3397('0x20')];_0x583979=_0x2fccd1['scheduledat']?_0x2fccd1[_0x3397('0x18')]:moment();var _0x591a93=moment(_0x583979)['add'](_0x4c5ffb,_0x3397('0x2f'));_0xe95129({'ret':_0x591a93[_0x3397('0x19')](_0x3397('0x1a'))});}else _0xe95129({'ret':_0x583979});}else _0xe95129({'ret':_0x583979});}else{_0xe95129({'ret':_0x583979});}});}});return 0xa;}var _0x1e3230=function(_0x7808f9){return new BPromise(function(_0x3b60b3,_0x4085d5){_0x74c431(_0x7808f9,_0x44fa91)[_0x3397('0x22')](function(_0x25a865){_0x44fa91[_0x3397('0x18')]=_0x25a865[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')][_0x3397('0x1e')]({'where':{'phone':_0x44fa91[_0x3397('0xd')],'CampaignId':_0x7808f9['id']}})[_0x3397('0x22')](function(_0x2504a9){if(!_[_0x3397('0x1b')](_0x2504a9)){throw new Error(_0x3397('0x25')+_0x44fa91['phone']+_0x3397('0x30')+_0x7808f9['id']);}return _0x47ed4b[_0x3397('0x24')]['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91['ListId'],'priority':_0x44fa91['priority']?_0x44fa91[_0x3397('0x29')]:0x2,'scheduledat':_0x44fa91['scheduledat']?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91['callbackUniqueid']?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'CampaignId':_0x7808f9['id']});})['catch'](function(_0x28bf59){_0x4085d5(_0x28bf59);});});});};var _0x33e946=function(_0x5b8fea){return new BPromise(function(_0x883c50,_0x2beb02){_0x74c431(_0x5b8fea,_0x44fa91)[_0x3397('0x22')](function(_0x660655){_0x44fa91[_0x3397('0x18')]=_0x660655[_0x3397('0x23')];_0x47ed4b['CmHopper']['findOne']({'where':{'phone':_0x44fa91[_0x3397('0xd')],'CampaignId':_0x5b8fea['id']}})[_0x3397('0x22')](function(_0x2eb10f){if(!_[_0x3397('0x1b')](_0x2eb10f)){throw new Error(_0x3397('0x25')+_0x44fa91['phone']+_0x3397('0x31')+_0x5b8fea['id']);}return _0x47ed4b[_0x3397('0x32')]['findOne']({'where':{'calleridnum':_0x44fa91['phone'],'CampaignId':_0x5b8fea['id']}});})['then'](function(_0x556a95){if(!_[_0x3397('0x1b')](_0x556a95)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x44fa91[_0x3397('0xd')]+_0x3397('0x33')+_0x5b8fea['id']);}return _0x47ed4b[_0x3397('0x24')]['create']({'phone':_0x44fa91['phone'],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91['ListId'],'priority':_0x44fa91[_0x3397('0x29')]?_0x44fa91[_0x3397('0x29')]:0x2,'scheduledat':_0x44fa91['scheduledat']?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a')),'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'CampaignId':_0x5b8fea['id']});})[_0x3397('0x2b')](function(_0x1cbbce){_0x2beb02(_0x1cbbce);});});});};if(_0x44fa91['ListId']){_0x47ed4b[_0x3397('0x1d')][_0x3397('0x34')]({'where':{'type':_0x3397('0x35')},'attributes':['id','dialCheckDuplicateType',_0x3397('0x1c')],'include':[{'model':_0x47ed4b[_0x3397('0x36')],'as':_0x3397('0x37'),'where':{'id':_0x44fa91['ListId']}}]})['then'](function(_0x42e065){if(_0x42e065){var _0x2999b3=[];for(var _0x32736d=0x0,_0x2dd4a7;_0x32736d<_0x42e065[_0x3397('0x38')];_0x32736d+=0x1){_0x2dd4a7=_0x42e065[_0x32736d][_0x3397('0x15')]({'plain':!![]});switch(_0x2dd4a7[_0x3397('0x39')]){case'always':_0x258b62(_0x2dd4a7)[_0x3397('0x2b')](_0x403782());break;case'onlyIfOpen':_0x53d4f2(_0x2dd4a7)['catch'](_0x403782());break;default:_0x74c431(_0x2dd4a7,_0x44fa91)[_0x3397('0x22')](function(_0x3191b9){_0x44fa91[_0x3397('0x18')]=_0x3191b9[_0x3397('0x23')];_0x47ed4b[_0x3397('0x24')]['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'scheduledat':_0x44fa91[_0x3397('0x18')]?_0x44fa91['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x44fa91['priority']?_0x44fa91[_0x3397('0x29')]:0x2,'callback':_0x44fa91[_0x3397('0x2a')]?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()[_0x3397('0x19')](_0x3397('0x1a')):undefined,'VoiceQueueId':_0x2dd4a7['id']})[_0x3397('0x2b')](_0x403782());});}}}})[_0x3397('0x22')](function(){return _0x47ed4b[_0x3397('0x1d')]['findAll']({'where':{'type':_0x3397('0x35')},'attributes':['id'],'include':[{'model':_0x47ed4b['CmList'],'as':'BlackLists','where':{'id':_0x44fa91['ListId']}}]})['then'](function(_0x36accb){if(_0x36accb){var _0x26050b=[];for(var _0x4c92f9=0x0,_0x467db3;_0x4c92f9<_0x36accb['length'];_0x4c92f9+=0x1){_0x467db3=_0x36accb[_0x4c92f9][_0x3397('0x15')]({'plain':!![]});_0x47ed4b[_0x3397('0x3a')]['create']({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'VoiceQueueId':_0x467db3['id']})['catch'](function(_0x32aa05){logger[_0x3397('0x16')]('cmContact,\x20%s,\x20%s',_0x3397('0x17'),_0x32aa05['message']);});}}});})['then'](function(){return _0x47ed4b[_0x3397('0x2e')]['findAll']({'attributes':['id',_0x3397('0x39'),_0x3397('0x1c')],'include':[{'model':_0x47ed4b[_0x3397('0x36')],'as':_0x3397('0x37'),'where':{'id':_0x44fa91[_0x3397('0x28')]}}]})[_0x3397('0x22')](function(_0x54e815){if(_0x54e815){var _0x2bcc71=[];for(var _0x24e7d6=0x0,_0x248830;_0x24e7d6<_0x54e815['length'];_0x24e7d6+=0x1){_0x248830=_0x54e815[_0x24e7d6][_0x3397('0x15')]({'plain':!![]});switch(_0x248830[_0x3397('0x39')]){case'always':_0x33e946(_0x248830)[_0x3397('0x2b')](_0x54246b());break;case'onlyIfOpen':_0x1e3230(_0x248830)[_0x3397('0x2b')](_0x54246b());break;default:_0x47ed4b[_0x3397('0x24')][_0x3397('0x27')]({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'scheduledat':_0x44fa91[_0x3397('0x18')]?_0x44fa91[_0x3397('0x18')]:moment()[_0x3397('0x19')](_0x3397('0x1a')),'priority':_0x44fa91[_0x3397('0x29')]?_0x44fa91[_0x3397('0x29')]:0x2,'callback':_0x44fa91['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x44fa91[_0x3397('0x2a')]?_0x44fa91[_0x3397('0x2a')]:undefined,'callbackat':_0x44fa91[_0x3397('0x2a')]?moment()['format'](_0x3397('0x1a')):undefined,'CampaignId':_0x248830['id']})[_0x3397('0x2b')](_0x54246b());}}}});})[_0x3397('0x22')](function(){return _0x47ed4b[_0x3397('0x2e')][_0x3397('0x34')]({'attributes':['id'],'include':[{'model':_0x47ed4b[_0x3397('0x36')],'as':_0x3397('0x3b'),'where':{'id':_0x44fa91['ListId']}}]})['then'](function(_0x4fa213){if(_0x4fa213){var _0x386db9=[];for(var _0x5a3a6f=0x0,_0x4f8aec;_0x5a3a6f<_0x4fa213[_0x3397('0x38')];_0x5a3a6f+=0x1){_0x4f8aec=_0x4fa213[_0x5a3a6f][_0x3397('0x15')]({'plain':!![]});_0x47ed4b['CmHopperBlack'][_0x3397('0x27')]({'phone':_0x44fa91[_0x3397('0xd')],'ContactId':_0x44fa91['id'],'ListId':_0x44fa91[_0x3397('0x28')],'CampaignId':_0x4f8aec['id']})['catch'](function(_0x17c784){logger['error'](_0x3397('0x3c'),_0x3397('0x17'),_0x17c784[_0x3397('0x3d')]);});}}});})['then'](function(){_0x24b3c8();})[_0x3397('0x2b')](function(_0x4e187b){logger[_0x3397('0x16')](_0x3397('0x3c'),_0x3397('0x17'),_0x4e187b[_0x3397('0x3d')]);_0x24b3c8(_0x4e187b);});}else{_0x24b3c8(new Error(_0x3397('0x3e')));}},'afterDestroy':function(_0xe751b7,_0x3140f2,_0x361863){var _0x274557=_0x24ea45[_0x3397('0x14')];var _0x23e60a=_0xe751b7['get']({'plain':!![]});return _0x274557['CmHopper'][_0x3397('0x34')]({'raw':!![],'where':{'ListId':_0x23e60a[_0x3397('0x28')],'ContactId':_0x23e60a['id']}})[_0x3397('0x22')](function(_0x2223ac){if(!_['isEmpty'](_0x2223ac)){var _0xc044c=[];for(var _0x5cc342=0x0;_0x5cc342<_0x2223ac[_0x3397('0x38')];_0x5cc342+=0x1){var _0x17492c=_0x274557['CmHopper'][_0x3397('0x3f')]({'where':{'ListId':_0x2223ac[_0x5cc342]['ListId'],'ContactId':_0x2223ac[_0x5cc342][_0x3397('0x40')],'VoiceQueueId':_0x2223ac[_0x5cc342]['VoiceQueueId'],'CampaignId':_0x2223ac[_0x5cc342]['CampaignId']}});_0xc044c[_0x3397('0x41')](_0x17492c);}return BPromise[_0x3397('0x42')](_0xc044c);}})[_0x3397('0x22')](function(_0x47a32c){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x3397('0x43')](_0x47a32c,{'showHidden':![],'depth':null}));_0x361863();})[_0x3397('0x2b')](function(_0x45841d){logger[_0x3397('0x16')]('[CmContact][afterDestroy][Error]',util[_0x3397('0x43')](_0x45841d,{'showHidden':![],'depth':null}));_0x361863(_0x45841d);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index a42527a..c7522e9 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x3d5ce6,_0x1417f1){var _0x35ffd5=function(_0x263eca){while(--_0x263eca){_0x3d5ce6['push'](_0x3d5ce6['shift']());}};_0x35ffd5(++_0x1417f1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x44b9b0,_0x595add){var _0x34deeb=function(_0xefd9b0){while(--_0xefd9b0){_0x44b9b0['push'](_0x44b9b0['shift']());}};_0x34deeb(++_0x595add);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 36f1f38..c84a108 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b67=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x15d60e,_0x4e846d){var _0x5c6452=function(_0x1ca41c){while(--_0x1ca41c){_0x15d60e['push'](_0x15d60e['shift']());}};_0x5c6452(++_0x4e846d);}(_0x9b67,0xf6));var _0x79b6=function(_0x628238,_0x45f523){_0x628238=_0x628238-0x0;var _0x58409a=_0x9b67[_0x628238];return _0x58409a;};'use strict';var Sequelize=require(_0x79b6('0x0'));module[_0x79b6('0x1')]={'CmContactId':{'type':Sequelize[_0x79b6('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x79b6('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x79b6('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x79b6('0x4')},'OrderBy':{'type':Sequelize[_0x79b6('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xb18e=['PHONE','INTEGER'];(function(_0xa196f5,_0x1cbaa9){var _0x1db077=function(_0x4b9c43){while(--_0x4b9c43){_0xa196f5['push'](_0xa196f5['shift']());}};_0x1db077(++_0x1cbaa9);}(_0xb18e,0x181));var _0xeb18=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0xb18e[_0x446208];return _0xe49563;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xeb18('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xeb18('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xeb18('0x1')},'OrderBy':{'type':Sequelize[_0xeb18('0x0')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 8780a63..6c906c4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0054=['stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','error'];(function(_0x15f542,_0x430580){var _0x52a4a2=function(_0x462cdf){while(--_0x462cdf){_0x15f542['push'](_0x15f542['shift']());}};_0x52a4a2(++_0x430580);}(_0x0054,0x18f));var _0x4005=function(_0x4e8449,_0x4b09d8){_0x4e8449=_0x4e8449-0x0;var _0xa7a7a9=_0x0054[_0x4e8449];return _0xa7a7a9;};'use strict';var emlformat=require(_0x4005('0x0'));var rimraf=require(_0x4005('0x1'));var zipdir=require(_0x4005('0x2'));var jsonpatch=require(_0x4005('0x3'));var rp=require('request-promise');var moment=require(_0x4005('0x4'));var BPromise=require(_0x4005('0x5'));var Mustache=require(_0x4005('0x6'));var util=require(_0x4005('0x7'));var path=require(_0x4005('0x8'));var sox=require(_0x4005('0x9'));var csv=require(_0x4005('0xa'));var ejs=require(_0x4005('0xb'));var fs=require('fs');var fs_extra=require(_0x4005('0xc'));var _=require(_0x4005('0xd'));var squel=require(_0x4005('0xe'));var crypto=require(_0x4005('0xf'));var jsforce=require(_0x4005('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4005('0xa'));var querystring=require(_0x4005('0x11'));var Papa=require(_0x4005('0x12'));var Redis=require(_0x4005('0x13'));var authService=require(_0x4005('0x14'));var qs=require(_0x4005('0x15'));var as=require(_0x4005('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4005('0x17'))(_0x4005('0x18'));var utils=require(_0x4005('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4005('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f2e3,_0x10f266){_0x10f266=_0x10f266||0xcc;return function(_0x3f9e65){if(_0x3f9e65){return _0x11f2e3[_0x4005('0x1b')](_0x10f266);}return _0x11f2e3['status'](_0x10f266)[_0x4005('0x1c')]();};}function respondWithResult(_0x1cca9a,_0x1c9ea1){_0x1c9ea1=_0x1c9ea1||0xc8;return function(_0x3ddade){if(_0x3ddade){return _0x1cca9a[_0x4005('0x1d')](_0x1c9ea1)[_0x4005('0x1e')](_0x3ddade);}};}function respondWithFilteredResult(_0x2e6141,_0x16fb00){return function(_0x3e4c4b){if(_0x3e4c4b){var _0xc4b284=typeof _0x16fb00[_0x4005('0x1f')]===_0x4005('0x20')&&typeof _0x16fb00['limit']==='undefined';var _0x55ec79=_0x3e4c4b['count'];var _0x516846=_0xc4b284?0x0:_0x16fb00[_0x4005('0x1f')];var _0x247dc0=_0xc4b284?_0x3e4c4b[_0x4005('0x21')]:_0x16fb00[_0x4005('0x1f')]+_0x16fb00[_0x4005('0x22')];var _0x1c51f4;if(_0x247dc0>=_0x55ec79){_0x247dc0=_0x55ec79;_0x1c51f4=0xc8;}else{_0x1c51f4=0xce;}_0x2e6141[_0x4005('0x1d')](_0x1c51f4);return _0x2e6141[_0x4005('0x23')](_0x4005('0x24'),_0x516846+'-'+_0x247dc0+'/'+_0x55ec79)[_0x4005('0x1e')](_0x3e4c4b);}return null;};}function patchUpdates(_0x518155){return function(_0x43d959){try{jsonpatch[_0x4005('0x25')](_0x43d959,_0x518155,!![]);}catch(_0x88e285){return BPromise[_0x4005('0x26')](_0x88e285);}return _0x43d959[_0x4005('0x27')]();};}function saveUpdates(_0x42d8e4,_0x32c6b7){return function(_0x33e854){if(_0x33e854){return _0x33e854['update'](_0x42d8e4)[_0x4005('0x28')](function(_0x478d91){return _0x478d91;});}return null;};}function removeEntity(_0xf4bac3,_0x31f51a){return function(_0x171c39){if(_0x171c39){return _0x171c39['destroy']()['then'](function(){var _0x392af5=_0x171c39[_0x4005('0x29')]({'plain':!![]});var _0x2f1b11=_0x4005('0x2a');return db[_0x4005('0x2b')][_0x4005('0x2c')]({'where':{'type':_0x2f1b11,'resourceId':_0x392af5['id']}})['then'](function(){return _0x171c39;});})[_0x4005('0x28')](function(){_0xf4bac3[_0x4005('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5538,_0x5f5a2a){return function(_0x37201d){if(!_0x37201d){_0x3a5538['sendStatus'](0x194);}return _0x37201d;};}function handleError(_0x37d115,_0xfb2395){_0xfb2395=_0xfb2395||0x1f4;return function(_0x1e1b4a){logger[_0x4005('0x2d')](_0x1e1b4a[_0x4005('0x2e')]);if(_0x1e1b4a[_0x4005('0x2f')]){delete _0x1e1b4a[_0x4005('0x2f')];}_0x37d115['status'](_0xfb2395)['send'](_0x1e1b4a);};}exports[_0x4005('0x30')]=function(_0x343719,_0x2953f1){var _0x553e3d={},_0x1f1783={},_0x3a605e={'count':0x0,'rows':[]};var _0x47767d=_[_0x4005('0x31')](db[_0x4005('0x32')][_0x4005('0x33')],function(_0x4c7bc0){return{'name':_0x4c7bc0[_0x4005('0x34')],'type':_0x4c7bc0[_0x4005('0x35')][_0x4005('0x36')]};});_0x1f1783['model']=_['map'](_0x47767d,'name');_0x1f1783[_0x4005('0x37')]=_[_0x4005('0x38')](_0x343719[_0x4005('0x37')]);_0x1f1783['filters']=_['intersection'](_0x1f1783[_0x4005('0x39')],_0x1f1783['query']);_0x553e3d[_0x4005('0x3a')]=_['intersection'](_0x1f1783[_0x4005('0x39')],qs[_0x4005('0x3b')](_0x343719[_0x4005('0x37')][_0x4005('0x3b')]));_0x553e3d[_0x4005('0x3a')]=_0x553e3d[_0x4005('0x3a')][_0x4005('0x3c')]?_0x553e3d[_0x4005('0x3a')]:_0x1f1783['model'];if(!_0x343719[_0x4005('0x37')][_0x4005('0x3d')]('nolimit')){_0x553e3d['limit']=qs[_0x4005('0x22')](_0x343719[_0x4005('0x37')][_0x4005('0x22')]);_0x553e3d[_0x4005('0x1f')]=qs[_0x4005('0x1f')](_0x343719[_0x4005('0x37')]['offset']);}_0x553e3d[_0x4005('0x3e')]=qs[_0x4005('0x3f')](_0x343719['query']['sort']);_0x553e3d['where']=qs[_0x4005('0x40')](_[_0x4005('0x41')](_0x343719['query'],_0x1f1783['filters']),_0x47767d);if(_0x343719[_0x4005('0x37')][_0x4005('0x42')]){_0x553e3d[_0x4005('0x43')]=_[_0x4005('0x44')](_0x553e3d[_0x4005('0x43')],{'$or':_[_0x4005('0x31')](_0x47767d,function(_0x1eeabe){if(_0x1eeabe['type']!=='VIRTUAL'){var _0x3a5432={};_0x3a5432[_0x1eeabe[_0x4005('0x2f')]]={'$like':'%'+_0x343719[_0x4005('0x37')][_0x4005('0x42')]+'%'};return _0x3a5432;}})});}_0x553e3d=_[_0x4005('0x44')]({},_0x553e3d,_0x343719[_0x4005('0x45')]);var _0x5f42b2={'where':_0x553e3d[_0x4005('0x43')]};return db['CmContactHasItem']['count'](_0x5f42b2)[_0x4005('0x28')](function(_0x1ca5ac){_0x3a605e[_0x4005('0x21')]=_0x1ca5ac;if(_0x343719[_0x4005('0x37')][_0x4005('0x46')]){_0x553e3d[_0x4005('0x47')]=[{'all':!![]}];}return db[_0x4005('0x32')][_0x4005('0x48')](_0x553e3d);})[_0x4005('0x28')](function(_0x5615f3){_0x3a605e[_0x4005('0x49')]=_0x5615f3;return _0x3a605e;})['then'](respondWithFilteredResult(_0x2953f1,_0x553e3d))[_0x4005('0x4a')](handleError(_0x2953f1,null));};exports[_0x4005('0x4b')]=function(_0x204dec,_0x4eedc1){var _0x39deba={'raw':!![],'where':{'id':_0x204dec[_0x4005('0x4c')]['id']}},_0x4faaa0={};_0x4faaa0[_0x4005('0x39')]=_[_0x4005('0x38')](db[_0x4005('0x32')]['rawAttributes']);_0x4faaa0[_0x4005('0x37')]=_[_0x4005('0x38')](_0x204dec[_0x4005('0x37')]);_0x4faaa0['filters']=_[_0x4005('0x4d')](_0x4faaa0['model'],_0x4faaa0[_0x4005('0x37')]);_0x39deba[_0x4005('0x3a')]=_[_0x4005('0x4d')](_0x4faaa0['model'],qs[_0x4005('0x3b')](_0x204dec[_0x4005('0x37')][_0x4005('0x3b')]));_0x39deba['attributes']=_0x39deba[_0x4005('0x3a')][_0x4005('0x3c')]?_0x39deba['attributes']:_0x4faaa0[_0x4005('0x39')];if(_0x204dec[_0x4005('0x37')][_0x4005('0x46')]){_0x39deba['include']=[{'all':!![]}];}_0x39deba=_[_0x4005('0x44')]({},_0x39deba,_0x204dec[_0x4005('0x45')]);return db[_0x4005('0x32')][_0x4005('0x4e')](_0x39deba)[_0x4005('0x28')](handleEntityNotFound(_0x4eedc1,null))[_0x4005('0x28')](respondWithResult(_0x4eedc1,null))[_0x4005('0x4a')](handleError(_0x4eedc1,null));};exports['create']=function(_0x3ae64b,_0x25dafd){return db[_0x4005('0x32')][_0x4005('0x4f')](_0x3ae64b['body'],{})[_0x4005('0x28')](function(_0x40a7fe){var _0x14b905=_0x3ae64b['user'][_0x4005('0x29')]({'plain':!![]});if(!_0x14b905)throw new Error(_0x4005('0x50'));if(_0x14b905[_0x4005('0x51')]===_0x4005('0x52')){var _0x4435e5=_0x40a7fe[_0x4005('0x29')]({'plain':!![]});var _0xc7b783=_0x4005('0x2a');return db[_0x4005('0x53')][_0x4005('0x4e')]({'where':{'name':_0xc7b783,'userProfileId':_0x14b905[_0x4005('0x54')]},'raw':!![]})[_0x4005('0x28')](function(_0x2fa333){if(_0x2fa333&&_0x2fa333[_0x4005('0x55')]===0x0){return db[_0x4005('0x2b')][_0x4005('0x4f')]({'name':_0x4435e5[_0x4005('0x2f')],'resourceId':_0x4435e5['id'],'type':_0x2fa333[_0x4005('0x2f')],'sectionId':_0x2fa333['id']},{})['then'](function(){return _0x40a7fe;});}else{return _0x40a7fe;}})['catch'](function(_0x226b30){logger['error'](_0x4005('0x56'),_0x226b30);throw _0x226b30;});}return _0x40a7fe;})[_0x4005('0x28')](respondWithResult(_0x25dafd,0xc9))['catch'](handleError(_0x25dafd,null));};exports[_0x4005('0x57')]=function(_0x2bc6bc,_0x3b3f23){if(_0x2bc6bc[_0x4005('0x58')]['id']){delete _0x2bc6bc[_0x4005('0x58')]['id'];}return db[_0x4005('0x32')][_0x4005('0x4e')]({'where':{'id':_0x2bc6bc[_0x4005('0x4c')]['id']}})[_0x4005('0x28')](handleEntityNotFound(_0x3b3f23,null))[_0x4005('0x28')](saveUpdates(_0x2bc6bc[_0x4005('0x58')],null))[_0x4005('0x28')](respondWithResult(_0x3b3f23,null))[_0x4005('0x4a')](handleError(_0x3b3f23,null));};exports['destroy']=function(_0x59119f,_0x311289){return db[_0x4005('0x32')][_0x4005('0x4e')]({'where':{'id':_0x59119f[_0x4005('0x4c')]['id']}})[_0x4005('0x28')](handleEntityNotFound(_0x311289,null))['then'](removeEntity(_0x311289,null))[_0x4005('0x4a')](handleError(_0x311289,null));}; \ No newline at end of file +var _0xdeaf=['rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','CmContactHasItem'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xdeaf,0x110));var _0xfdea=function(_0x5158c3,_0x38e2a4){_0x5158c3=_0x5158c3-0x0;var _0x56cb6e=_0xdeaf[_0x5158c3];return _0x56cb6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdea('0x1'));var rp=require(_0xfdea('0x2'));var moment=require(_0xfdea('0x3'));var BPromise=require(_0xfdea('0x4'));var Mustache=require(_0xfdea('0x5'));var util=require(_0xfdea('0x6'));var path=require(_0xfdea('0x7'));var sox=require(_0xfdea('0x8'));var csv=require('to-csv');var ejs=require(_0xfdea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfdea('0xa'));var crypto=require(_0xfdea('0xb'));var jsforce=require(_0xfdea('0xc'));var deskjs=require(_0xfdea('0xd'));var toCsv=require(_0xfdea('0xe'));var querystring=require('querystring');var Papa=require(_0xfdea('0xf'));var Redis=require('ioredis');var authService=require(_0xfdea('0x10'));var qs=require(_0xfdea('0x11'));var as=require(_0xfdea('0x12'));var hardwareService=require(_0xfdea('0x13'));var logger=require(_0xfdea('0x14'))(_0xfdea('0x15'));var utils=require(_0xfdea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfdea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x231822,_0x1c262d){_0x1c262d=_0x1c262d||0xcc;return function(_0x4cd391){if(_0x4cd391){return _0x231822['sendStatus'](_0x1c262d);}return _0x231822[_0xfdea('0x18')](_0x1c262d)[_0xfdea('0x19')]();};}function respondWithResult(_0xb5630a,_0xe8c244){_0xe8c244=_0xe8c244||0xc8;return function(_0x3d6cef){if(_0x3d6cef){return _0xb5630a[_0xfdea('0x18')](_0xe8c244)['json'](_0x3d6cef);}};}function respondWithFilteredResult(_0x2fd469,_0x352563){return function(_0x13513e){if(_0x13513e){var _0xe11d30=typeof _0x352563[_0xfdea('0x1a')]===_0xfdea('0x1b')&&typeof _0x352563[_0xfdea('0x1c')]==='undefined';var _0x19d364=_0x13513e['count'];var _0xe2ac47=_0xe11d30?0x0:_0x352563[_0xfdea('0x1a')];var _0x265863=_0xe11d30?_0x13513e[_0xfdea('0x1d')]:_0x352563[_0xfdea('0x1a')]+_0x352563[_0xfdea('0x1c')];var _0x3bfcd6;if(_0x265863>=_0x19d364){_0x265863=_0x19d364;_0x3bfcd6=0xc8;}else{_0x3bfcd6=0xce;}_0x2fd469[_0xfdea('0x18')](_0x3bfcd6);return _0x2fd469[_0xfdea('0x1e')](_0xfdea('0x1f'),_0xe2ac47+'-'+_0x265863+'/'+_0x19d364)[_0xfdea('0x20')](_0x13513e);}return null;};}function patchUpdates(_0x3244e1){return function(_0x212caa){try{jsonpatch[_0xfdea('0x21')](_0x212caa,_0x3244e1,!![]);}catch(_0x59a22b){return BPromise[_0xfdea('0x22')](_0x59a22b);}return _0x212caa['save']();};}function saveUpdates(_0x1861fd,_0x1593ab){return function(_0x693e1b){if(_0x693e1b){return _0x693e1b[_0xfdea('0x23')](_0x1861fd)[_0xfdea('0x24')](function(_0x394c59){return _0x394c59;});}return null;};}function removeEntity(_0x3cb3c6,_0x201532){return function(_0x64547f){if(_0x64547f){return _0x64547f[_0xfdea('0x25')]()['then'](function(){var _0x17e26a=_0x64547f[_0xfdea('0x26')]({'plain':!![]});var _0x5e98d6=_0xfdea('0x27');return db[_0xfdea('0x28')][_0xfdea('0x25')]({'where':{'type':_0x5e98d6,'resourceId':_0x17e26a['id']}})[_0xfdea('0x24')](function(){return _0x64547f;});})[_0xfdea('0x24')](function(){_0x3cb3c6['status'](0xcc)[_0xfdea('0x19')]();});}};}function handleEntityNotFound(_0x585324,_0x54bfcd){return function(_0x2c1174){if(!_0x2c1174){_0x585324[_0xfdea('0x29')](0x194);}return _0x2c1174;};}function handleError(_0xcb3241,_0x2a3d82){_0x2a3d82=_0x2a3d82||0x1f4;return function(_0x39343f){logger[_0xfdea('0x2a')](_0x39343f[_0xfdea('0x2b')]);if(_0x39343f['name']){delete _0x39343f[_0xfdea('0x2c')];}_0xcb3241[_0xfdea('0x18')](_0x2a3d82)[_0xfdea('0x2d')](_0x39343f);};}exports[_0xfdea('0x2e')]=function(_0x3a4678,_0x5cd1cb){var _0x4ca38f={},_0x4823e2={},_0x27f5e1={'count':0x0,'rows':[]};var _0x2c77c8=_['map'](db[_0xfdea('0x2f')][_0xfdea('0x30')],function(_0x3a07fc){return{'name':_0x3a07fc[_0xfdea('0x31')],'type':_0x3a07fc['type']['key']};});_0x4823e2['model']=_['map'](_0x2c77c8,_0xfdea('0x2c'));_0x4823e2[_0xfdea('0x32')]=_[_0xfdea('0x33')](_0x3a4678[_0xfdea('0x32')]);_0x4823e2[_0xfdea('0x34')]=_[_0xfdea('0x35')](_0x4823e2['model'],_0x4823e2[_0xfdea('0x32')]);_0x4ca38f[_0xfdea('0x36')]=_[_0xfdea('0x35')](_0x4823e2['model'],qs[_0xfdea('0x37')](_0x3a4678['query']['fields']));_0x4ca38f[_0xfdea('0x36')]=_0x4ca38f[_0xfdea('0x36')][_0xfdea('0x38')]?_0x4ca38f[_0xfdea('0x36')]:_0x4823e2[_0xfdea('0x39')];if(!_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3a')](_0xfdea('0x3b'))){_0x4ca38f[_0xfdea('0x1c')]=qs[_0xfdea('0x1c')](_0x3a4678[_0xfdea('0x32')][_0xfdea('0x1c')]);_0x4ca38f[_0xfdea('0x1a')]=qs[_0xfdea('0x1a')](_0x3a4678[_0xfdea('0x32')][_0xfdea('0x1a')]);}_0x4ca38f['order']=qs[_0xfdea('0x3c')](_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3c')]);_0x4ca38f['where']=qs[_0xfdea('0x34')](_[_0xfdea('0x3d')](_0x3a4678[_0xfdea('0x32')],_0x4823e2[_0xfdea('0x34')]),_0x2c77c8);if(_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3e')]){_0x4ca38f[_0xfdea('0x3f')]=_['merge'](_0x4ca38f[_0xfdea('0x3f')],{'$or':_['map'](_0x2c77c8,function(_0x3d7dd9){if(_0x3d7dd9['type']!=='VIRTUAL'){var _0x45ba0d={};_0x45ba0d[_0x3d7dd9[_0xfdea('0x2c')]]={'$like':'%'+_0x3a4678[_0xfdea('0x32')][_0xfdea('0x3e')]+'%'};return _0x45ba0d;}})});}_0x4ca38f=_[_0xfdea('0x40')]({},_0x4ca38f,_0x3a4678[_0xfdea('0x41')]);var _0x1d4f8f={'where':_0x4ca38f[_0xfdea('0x3f')]};return db[_0xfdea('0x2f')]['count'](_0x1d4f8f)['then'](function(_0x5843b4){_0x27f5e1[_0xfdea('0x1d')]=_0x5843b4;if(_0x3a4678[_0xfdea('0x32')][_0xfdea('0x42')]){_0x4ca38f[_0xfdea('0x43')]=[{'all':!![]}];}return db[_0xfdea('0x2f')][_0xfdea('0x44')](_0x4ca38f);})['then'](function(_0x4460d8){_0x27f5e1[_0xfdea('0x45')]=_0x4460d8;return _0x27f5e1;})[_0xfdea('0x24')](respondWithFilteredResult(_0x5cd1cb,_0x4ca38f))['catch'](handleError(_0x5cd1cb,null));};exports[_0xfdea('0x46')]=function(_0x3b047e,_0x322e8d){var _0x1601cd={'raw':!![],'where':{'id':_0x3b047e['params']['id']}},_0x3074f0={};_0x3074f0[_0xfdea('0x39')]=_['keys'](db[_0xfdea('0x2f')]['rawAttributes']);_0x3074f0[_0xfdea('0x32')]=_[_0xfdea('0x33')](_0x3b047e[_0xfdea('0x32')]);_0x3074f0[_0xfdea('0x34')]=_[_0xfdea('0x35')](_0x3074f0[_0xfdea('0x39')],_0x3074f0[_0xfdea('0x32')]);_0x1601cd[_0xfdea('0x36')]=_[_0xfdea('0x35')](_0x3074f0['model'],qs[_0xfdea('0x37')](_0x3b047e['query']['fields']));_0x1601cd[_0xfdea('0x36')]=_0x1601cd['attributes'][_0xfdea('0x38')]?_0x1601cd[_0xfdea('0x36')]:_0x3074f0[_0xfdea('0x39')];if(_0x3b047e[_0xfdea('0x32')]['includeAll']){_0x1601cd[_0xfdea('0x43')]=[{'all':!![]}];}_0x1601cd=_[_0xfdea('0x40')]({},_0x1601cd,_0x3b047e[_0xfdea('0x41')]);return db[_0xfdea('0x2f')][_0xfdea('0x47')](_0x1601cd)[_0xfdea('0x24')](handleEntityNotFound(_0x322e8d,null))[_0xfdea('0x24')](respondWithResult(_0x322e8d,null))[_0xfdea('0x48')](handleError(_0x322e8d,null));};exports[_0xfdea('0x49')]=function(_0x475a4c,_0x5c4e38){return db['CmContactHasItem'][_0xfdea('0x49')](_0x475a4c['body'],{})['then'](function(_0x4c162b){var _0x15c9ad=_0x475a4c[_0xfdea('0x4a')][_0xfdea('0x26')]({'plain':!![]});if(!_0x15c9ad)throw new Error(_0xfdea('0x4b'));if(_0x15c9ad['role']===_0xfdea('0x4a')){var _0x1816c6=_0x4c162b['get']({'plain':!![]});var _0x12f99d=_0xfdea('0x27');return db[_0xfdea('0x4c')][_0xfdea('0x47')]({'where':{'name':_0x12f99d,'userProfileId':_0x15c9ad[_0xfdea('0x4d')]},'raw':!![]})['then'](function(_0x1f7734){if(_0x1f7734&&_0x1f7734['autoAssociation']===0x0){return db[_0xfdea('0x28')][_0xfdea('0x49')]({'name':_0x1816c6['name'],'resourceId':_0x1816c6['id'],'type':_0x1f7734[_0xfdea('0x2c')],'sectionId':_0x1f7734['id']},{})[_0xfdea('0x24')](function(){return _0x4c162b;});}else{return _0x4c162b;}})[_0xfdea('0x48')](function(_0x17a817){logger[_0xfdea('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a817);throw _0x17a817;});}return _0x4c162b;})[_0xfdea('0x24')](respondWithResult(_0x5c4e38,0xc9))[_0xfdea('0x48')](handleError(_0x5c4e38,null));};exports[_0xfdea('0x23')]=function(_0xb16840,_0x75ed04){if(_0xb16840['body']['id']){delete _0xb16840[_0xfdea('0x4e')]['id'];}return db['CmContactHasItem'][_0xfdea('0x47')]({'where':{'id':_0xb16840[_0xfdea('0x4f')]['id']}})[_0xfdea('0x24')](handleEntityNotFound(_0x75ed04,null))['then'](saveUpdates(_0xb16840[_0xfdea('0x4e')],null))[_0xfdea('0x24')](respondWithResult(_0x75ed04,null))[_0xfdea('0x48')](handleError(_0x75ed04,null));};exports[_0xfdea('0x25')]=function(_0x491b02,_0xf4bc6){return db[_0xfdea('0x2f')]['find']({'where':{'id':_0x491b02[_0xfdea('0x4f')]['id']}})[_0xfdea('0x24')](handleEntityNotFound(_0xf4bc6,null))[_0xfdea('0x24')](removeEntity(_0xf4bc6,null))[_0xfdea('0x48')](handleError(_0xf4bc6,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8196f2f..31ed3b3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x755e=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2390f7,_0x403f06){var _0x71bb31=function(_0x38c04e){while(--_0x38c04e){_0x2390f7['push'](_0x2390f7['shift']());}};_0x71bb31(++_0x403f06);}(_0x755e,0xc9));var _0xe755=function(_0x4b078b,_0x53030c){_0x4b078b=_0x4b078b-0x0;var _0x4bc65c=_0x755e[_0x4b078b];return _0x4bc65c;};'use strict';var _=require(_0xe755('0x0'));var util=require('util');var logger=require(_0xe755('0x1'))(_0xe755('0x2'));var moment=require(_0xe755('0x3'));var BPromise=require(_0xe755('0x4'));var rp=require(_0xe755('0x5'));var fs=require('fs');var path=require(_0xe755('0x6'));var rimraf=require(_0xe755('0x7'));var config=require(_0xe755('0x8'));var attributes=require(_0xe755('0x9'));module[_0xe755('0xa')]=function(_0x30d9ed,_0x3cfa58){return _0x30d9ed[_0xe755('0xb')](_0xe755('0xc'),attributes,{'tableName':_0xe755('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecb1=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x714070,_0x434d9e){var _0x554083=function(_0x39ac52){while(--_0x39ac52){_0x714070['push'](_0x714070['shift']());}};_0x554083(++_0x434d9e);}(_0xecb1,0xc4));var _0x1ecb=function(_0x40f119,_0x2bac8c){_0x40f119=_0x40f119-0x0;var _0x39ad9e=_0xecb1[_0x40f119];return _0x39ad9e;};'use strict';var _=require(_0x1ecb('0x0'));var util=require(_0x1ecb('0x1'));var logger=require(_0x1ecb('0x2'))('api');var moment=require(_0x1ecb('0x3'));var BPromise=require(_0x1ecb('0x4'));var rp=require(_0x1ecb('0x5'));var fs=require('fs');var path=require(_0x1ecb('0x6'));var rimraf=require(_0x1ecb('0x7'));var config=require(_0x1ecb('0x8'));var attributes=require(_0x1ecb('0x9'));module[_0x1ecb('0xa')]=function(_0x22f198,_0xa607e2){return _0x22f198[_0x1ecb('0xb')](_0x1ecb('0xc'),attributes,{'tableName':_0x1ecb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 86044d6..4ac11ba 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37e0=['stringify','error','message','info','catch','lodash','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x510fad,_0x283c39){var _0x249cc9=function(_0x5a9740){while(--_0x5a9740){_0x510fad['push'](_0x510fad['shift']());}};_0x249cc9(++_0x283c39);}(_0x37e0,0x9e));var _0x037e=function(_0x4a6a9c,_0xbe9dbb){_0x4a6a9c=_0x4a6a9c-0x0;var _0x463d02=_0x37e0[_0x4a6a9c];return _0x463d02;};'use strict';var _=require(_0x037e('0x0'));var util=require('util');var moment=require(_0x037e('0x1'));var BPromise=require(_0x037e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x037e('0x3'))(_0x037e('0x4'));var config=require(_0x037e('0x5'));var jayson=require(_0x037e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8e27,_0x4feac9,_0x153eba){return new BPromise(function(_0x3a6313,_0x24679f){return client[_0x037e('0x7')](_0x1c8e27,_0x153eba)[_0x037e('0x8')](function(_0x4f4a44){logger['info'](_0x037e('0x9'),_0x4feac9,_0x037e('0xa'));logger[_0x037e('0xb')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4feac9,_0x037e('0xa'),JSON[_0x037e('0xc')](_0x4f4a44));if(_0x4f4a44[_0x037e('0xd')]){if(_0x4f4a44[_0x037e('0xd')]['code']===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4feac9,_0x4f4a44[_0x037e('0xd')]['message']);return _0x24679f(_0x4f4a44[_0x037e('0xd')]['message']);}logger[_0x037e('0xd')](_0x037e('0x9'),_0x4feac9,_0x4f4a44['error']['message']);return _0x3a6313(_0x4f4a44[_0x037e('0xd')][_0x037e('0xe')]);}else{logger[_0x037e('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x4feac9,'request\x20sent');_0x3a6313(_0x4f4a44['result']['message']);}})[_0x037e('0x10')](function(_0xc736a6){logger[_0x037e('0xd')](_0x037e('0x9'),_0x4feac9,_0xc736a6);_0x24679f(_0xc736a6);});});} \ No newline at end of file +var _0x1e26=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch'];(function(_0x338bc2,_0x1be2e3){var _0x336630=function(_0x27ff61){while(--_0x27ff61){_0x338bc2['push'](_0x338bc2['shift']());}};_0x336630(++_0x1be2e3);}(_0x1e26,0xe7));var _0x61e2=function(_0x280ee0,_0x5e737f){_0x280ee0=_0x280ee0-0x0;var _0x3ad799=_0x1e26[_0x280ee0];return _0x3ad799;};'use strict';var _=require(_0x61e2('0x0'));var util=require(_0x61e2('0x1'));var moment=require(_0x61e2('0x2'));var BPromise=require(_0x61e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x61e2('0x5'))(_0x61e2('0x6'));var config=require('../../config/environment');var jayson=require(_0x61e2('0x7'));var client=jayson[_0x61e2('0x8')][_0x61e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20159e,_0x109822,_0x2cf699){return new BPromise(function(_0x5161d3,_0x3d423a){return client[_0x61e2('0xa')](_0x20159e,_0x2cf699)[_0x61e2('0xb')](function(_0x408646){logger[_0x61e2('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x109822,_0x61e2('0xd'));logger[_0x61e2('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x109822,'request\x20sent',JSON[_0x61e2('0xf')](_0x408646));if(_0x408646['error']){if(_0x408646[_0x61e2('0x10')][_0x61e2('0x11')]===0x1f4){logger[_0x61e2('0x10')](_0x61e2('0x12'),_0x109822,_0x408646['error'][_0x61e2('0x13')]);return _0x3d423a(_0x408646[_0x61e2('0x10')][_0x61e2('0x13')]);}logger[_0x61e2('0x10')](_0x61e2('0x12'),_0x109822,_0x408646['error'][_0x61e2('0x13')]);return _0x5161d3(_0x408646['error'][_0x61e2('0x13')]);}else{logger[_0x61e2('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x109822,'request\x20sent');_0x5161d3(_0x408646['result']['message']);}})[_0x61e2('0x14')](function(_0x16ab6e){logger['error'](_0x61e2('0x12'),_0x109822,_0x16ab6e);_0x3d423a(_0x16ab6e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9bc08e5..fc4f643 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f37=['create','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x13b301,_0x4c75d7){var _0x244981=function(_0x27e465){while(--_0x27e465){_0x13b301['push'](_0x13b301['shift']());}};_0x244981(++_0x4c75d7);}(_0x0f37,0x1c4));var _0x70f3=function(_0x56dd58,_0xb1287d){_0x56dd58=_0x56dd58-0x0;var _0x103e75=_0x0f37[_0x56dd58];return _0x103e75;};'use strict';var multer=require('multer');var util=require(_0x70f3('0x0'));var path=require(_0x70f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x70f3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x70f3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x70f3('0x4'));var controller=require('./cmContactHasItem.controller');router[_0x70f3('0x5')]('/',auth[_0x70f3('0x6')](),controller['index']);router[_0x70f3('0x5')](_0x70f3('0x7'),auth[_0x70f3('0x6')](),controller[_0x70f3('0x8')]);router[_0x70f3('0x9')]('/',auth[_0x70f3('0x6')](),controller[_0x70f3('0xa')]);router['put']('/:id',auth[_0x70f3('0x6')](),controller['update']);router[_0x70f3('0xb')](_0x70f3('0x7'),auth['isAuthenticated'](),controller[_0x70f3('0xc')]);module[_0x70f3('0xd')]=router; \ No newline at end of file +var _0xd95d=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','isAuthenticated','post','create','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd95d,0xf2));var _0xdd95=function(_0x57cf2e,_0x1fc8ca){_0x57cf2e=_0x57cf2e-0x0;var _0x4d1e0e=_0xd95d[_0x57cf2e];return _0x4d1e0e;};'use strict';var multer=require(_0xdd95('0x0'));var util=require(_0xdd95('0x1'));var path=require(_0xdd95('0x2'));var timeout=require(_0xdd95('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd95('0x4'));var config=require(_0xdd95('0x5'));var controller=require(_0xdd95('0x6'));router[_0xdd95('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd95('0x8')]);router['get']('/:id',auth[_0xdd95('0x9')](),controller['show']);router[_0xdd95('0xa')]('/',auth[_0xdd95('0x9')](),controller[_0xdd95('0xb')]);router['put']('/:id',auth[_0xdd95('0x9')](),controller[_0xdd95('0xc')]);router['delete']('/:id',auth[_0xdd95('0x9')](),controller[_0xdd95('0xd')]);module[_0xdd95('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e43407b..bff45cd 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 _0x88db=['ENUM','voice','sequelize','lodash','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x88db,0x1e8));var _0xb88d=function(_0x233fb8,_0x381e9d){_0x233fb8=_0x233fb8-0x0;var _0x3b71c5=_0x88db[_0x233fb8];return _0x3b71c5;};'use strict';var Sequelize=require(_0xb88d('0x0'));var _=require(_0xb88d('0x1'));module[_0xb88d('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x15f6f0){return this[_0xb88d('0x3')](_0xb88d('0x4'));}},'alias':{'type':Sequelize[_0xb88d('0x5')],'allowNull':![],'set':function(_0x403e28){this[_0xb88d('0x6')](_0xb88d('0x4'),_0x403e28?_0x403e28:this[_0xb88d('0x3')](_0xb88d('0x7')));}},'type':{'type':Sequelize[_0xb88d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xb88d('0x8')](_0xb88d('0x9')),'get':function(){if(this[_0xb88d('0x3')]('type')===_0xb88d('0xa')){return JSON[_0xb88d('0xb')](this[_0xb88d('0x3')](_0xb88d('0xc')));}else{return this[_0xb88d('0x3')]('values');}},'set':function(_0x2add7b){if(Array[_0xb88d('0xd')](_0x2add7b)){this[_0xb88d('0x6')](_0xb88d('0xc'),JSON[_0xb88d('0xe')](_0x2add7b));}else{this[_0xb88d('0x6')](_0xb88d('0xc'),_0x2add7b);}}},'required':{'type':Sequelize[_0xb88d('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xb88d('0x10')](_0xb88d('0x11'))}}; \ No newline at end of file +var _0x7f33=['TEXT','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f33,0x171));var _0x37f3=function(_0x40d2a5,_0x5b2281){_0x40d2a5=_0x40d2a5-0x0;var _0x4f1be1=_0x7f33[_0x40d2a5];return _0x4f1be1;};'use strict';var Sequelize=require(_0x37f3('0x0'));var _=require(_0x37f3('0x1'));module[_0x37f3('0x2')]={'name':{'type':Sequelize[_0x37f3('0x3')],'get':function(_0x4773b9){return this[_0x37f3('0x4')](_0x37f3('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x35cd99){this[_0x37f3('0x6')]('alias',_0x35cd99?_0x35cd99:this[_0x37f3('0x4')](_0x37f3('0x7')));}},'type':{'type':Sequelize[_0x37f3('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x37f3('0x9')]('long'),'get':function(){if(this[_0x37f3('0x4')]('type')===_0x37f3('0xa')){return JSON[_0x37f3('0xb')](this[_0x37f3('0x4')](_0x37f3('0xc')));}else{return this['getDataValue'](_0x37f3('0xc'));}},'set':function(_0x513e99){if(Array[_0x37f3('0xd')](_0x513e99)){this[_0x37f3('0x6')](_0x37f3('0xc'),JSON[_0x37f3('0xe')](_0x513e99));}else{this['setDataValue'](_0x37f3('0xc'),_0x513e99);}}},'required':{'type':Sequelize[_0x37f3('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x37f3('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x37f3('0x10')](_0x37f3('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ef0a657..4c3599e 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 _0x49be=['query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','CmCustomField','includeAll','findAll','rows','catch','show','params','include','find','create','sequelize','transaction','body','Sequelize','TEXT','text','INTEGER','defaultValue','queryInterface','cf_%d','eml-format','rimraf','zip-dir','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','fieldName','type','key','differenceBy','map'];(function(_0x58644b,_0x3dd4ba){var _0x3da42d=function(_0x1c11db){while(--_0x1c11db){_0x58644b['push'](_0x58644b['shift']());}};_0x3da42d(++_0x3dd4ba);}(_0x49be,0x175));var _0xe49b=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0x49be[_0x5c9f56];return _0x2a726b;};'use strict';var emlformat=require(_0xe49b('0x0'));var rimraf=require(_0xe49b('0x1'));var zipdir=require(_0xe49b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe49b('0x3'));var util=require(_0xe49b('0x4'));var path=require(_0xe49b('0x5'));var sox=require(_0xe49b('0x6'));var csv=require('to-csv');var ejs=require(_0xe49b('0x7'));var fs=require('fs');var fs_extra=require(_0xe49b('0x8'));var _=require(_0xe49b('0x9'));var squel=require(_0xe49b('0xa'));var crypto=require(_0xe49b('0xb'));var jsforce=require(_0xe49b('0xc'));var deskjs=require(_0xe49b('0xd'));var toCsv=require(_0xe49b('0xe'));var querystring=require(_0xe49b('0xf'));var Papa=require(_0xe49b('0x10'));var Redis=require(_0xe49b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe49b('0x12'));var as=require(_0xe49b('0x13'));var hardwareService=require(_0xe49b('0x14'));var logger=require(_0xe49b('0x15'))(_0xe49b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe49b('0x17'));var db=require(_0xe49b('0x18'))['db'];function respondWithStatusCode(_0x486f18,_0xeb4989){_0xeb4989=_0xeb4989||0xcc;return function(_0x10e0f4){if(_0x10e0f4){return _0x486f18[_0xe49b('0x19')](_0xeb4989);}return _0x486f18[_0xe49b('0x1a')](_0xeb4989)[_0xe49b('0x1b')]();};}function respondWithResult(_0x1cb658,_0x386b7a){_0x386b7a=_0x386b7a||0xc8;return function(_0x5a05b1){if(_0x5a05b1){return _0x1cb658['status'](_0x386b7a)['json'](_0x5a05b1);}};}function respondWithFilteredResult(_0x127240,_0x572fb3){return function(_0x2ba509){if(_0x2ba509){var _0x4b4f51=typeof _0x572fb3[_0xe49b('0x1c')]===_0xe49b('0x1d')&&typeof _0x572fb3['limit']==='undefined';var _0x398253=_0x2ba509['count'];var _0x1948c8=_0x4b4f51?0x0:_0x572fb3[_0xe49b('0x1c')];var _0xc8fbae=_0x4b4f51?_0x2ba509[_0xe49b('0x1e')]:_0x572fb3[_0xe49b('0x1c')]+_0x572fb3['limit'];var _0x4230fb;if(_0xc8fbae>=_0x398253){_0xc8fbae=_0x398253;_0x4230fb=0xc8;}else{_0x4230fb=0xce;}_0x127240[_0xe49b('0x1a')](_0x4230fb);return _0x127240['set'](_0xe49b('0x1f'),_0x1948c8+'-'+_0xc8fbae+'/'+_0x398253)['json'](_0x2ba509);}return null;};}function patchUpdates(_0x47e53d){return function(_0x14e6f1){try{jsonpatch[_0xe49b('0x20')](_0x14e6f1,_0x47e53d,!![]);}catch(_0x6e5630){return BPromise[_0xe49b('0x21')](_0x6e5630);}return _0x14e6f1[_0xe49b('0x22')]();};}function saveUpdates(_0xd9c267,_0x416d98){return function(_0x62e43b){if(_0x62e43b){return _0x62e43b[_0xe49b('0x23')](_0xd9c267)['then'](function(_0x3240bc){return _0x3240bc;});}return null;};}function removeEntity(_0x2a0543,_0x16a87b){return function(_0x2a17d7){if(_0x2a17d7){return _0x2a17d7[_0xe49b('0x24')]()[_0xe49b('0x25')](function(){_0x2a0543[_0xe49b('0x1a')](0xcc)[_0xe49b('0x1b')]();});}};}function handleEntityNotFound(_0x57027c,_0x26d72e){return function(_0x482879){if(!_0x482879){_0x57027c[_0xe49b('0x19')](0x194);}return _0x482879;};}function handleError(_0x47b989,_0x1d72ac){_0x1d72ac=_0x1d72ac||0x1f4;return function(_0x340e47){logger[_0xe49b('0x26')](_0x340e47[_0xe49b('0x27')]);if(_0x340e47[_0xe49b('0x28')]){delete _0x340e47['name'];}_0x47b989['status'](_0x1d72ac)[_0xe49b('0x29')](_0x340e47);};}exports['index']=function(_0x3f7d37,_0xc4eb3f){var _0x5c94d4={},_0x59e164={},_0x28ba6d={'count':0x0,'rows':[]};var _0x59f6b4=_['map'](db['CmCustomField']['rawAttributes'],function(_0x3ecd6e){return{'name':_0x3ecd6e[_0xe49b('0x2a')],'type':_0x3ecd6e[_0xe49b('0x2b')][_0xe49b('0x2c')]};});_0x59e164['model']=_[_0xe49b('0x2d')](_[_0xe49b('0x2e')](_0x59f6b4,_0xe49b('0x28')),['name']);_0x59e164[_0xe49b('0x2f')]=_[_0xe49b('0x30')](_0x3f7d37[_0xe49b('0x2f')]);_0x59e164['filters']=_[_0xe49b('0x31')](_0x59e164[_0xe49b('0x32')],_0x59e164[_0xe49b('0x2f')]);_0x5c94d4[_0xe49b('0x33')]=_[_0xe49b('0x31')](_0x59e164[_0xe49b('0x32')],qs[_0xe49b('0x34')](_0x3f7d37[_0xe49b('0x2f')][_0xe49b('0x34')]));_0x5c94d4['attributes']=_0x5c94d4[_0xe49b('0x33')][_0xe49b('0x35')]?_0x5c94d4[_0xe49b('0x33')]:_0x59e164[_0xe49b('0x32')];if(!_0x3f7d37['query'][_0xe49b('0x36')]('nolimit')){_0x5c94d4['limit']=qs['limit'](_0x3f7d37[_0xe49b('0x2f')][_0xe49b('0x37')]);_0x5c94d4[_0xe49b('0x1c')]=qs[_0xe49b('0x1c')](_0x3f7d37[_0xe49b('0x2f')]['offset']);}_0x5c94d4[_0xe49b('0x38')]=qs[_0xe49b('0x39')](_0x3f7d37[_0xe49b('0x2f')][_0xe49b('0x39')]);_0x5c94d4[_0xe49b('0x3a')]=qs[_0xe49b('0x3b')](_['pick'](_0x3f7d37['query'],_0x59e164[_0xe49b('0x3b')]),_0x59f6b4);if(_0x3f7d37['query'][_0xe49b('0x3c')]){_0x5c94d4[_0xe49b('0x3a')]=_[_0xe49b('0x3d')](_0x5c94d4[_0xe49b('0x3a')],{'$or':_[_0xe49b('0x2e')](_0x59f6b4,function(_0x59934c){if(_0x59934c[_0xe49b('0x2b')]!==_0xe49b('0x3e')){var _0x212ec0={};_0x212ec0[_0x59934c[_0xe49b('0x28')]]={'$like':'%'+_0x3f7d37[_0xe49b('0x2f')]['filter']+'%'};return _0x212ec0;}})});}_0x5c94d4=_[_0xe49b('0x3d')]({},_0x5c94d4,_0x3f7d37[_0xe49b('0x3f')]);var _0x59ecef={'where':_0x5c94d4[_0xe49b('0x3a')]};return db[_0xe49b('0x40')][_0xe49b('0x1e')](_0x59ecef)[_0xe49b('0x25')](function(_0x2421e2){_0x28ba6d[_0xe49b('0x1e')]=_0x2421e2;if(_0x3f7d37[_0xe49b('0x2f')][_0xe49b('0x41')]){_0x5c94d4['include']=[{'all':!![]}];}return db[_0xe49b('0x40')][_0xe49b('0x42')](_0x5c94d4);})[_0xe49b('0x25')](function(_0x222276){_0x28ba6d[_0xe49b('0x43')]=_0x222276;return _0x28ba6d;})[_0xe49b('0x25')](respondWithFilteredResult(_0xc4eb3f,_0x5c94d4))[_0xe49b('0x44')](handleError(_0xc4eb3f,null));};exports[_0xe49b('0x45')]=function(_0x5757dd,_0x4e8fcc){var _0x14158b={'raw':!![],'where':{'id':_0x5757dd[_0xe49b('0x46')]['id']}},_0x4e2fd6={};_0x4e2fd6['model']=_['keys'](db['CmCustomField']['rawAttributes']);_0x4e2fd6[_0xe49b('0x2f')]=_['keys'](_0x5757dd['query']);_0x4e2fd6[_0xe49b('0x3b')]=_[_0xe49b('0x31')](_0x4e2fd6['model'],_0x4e2fd6[_0xe49b('0x2f')]);_0x14158b['attributes']=_['intersection'](_0x4e2fd6[_0xe49b('0x32')],qs[_0xe49b('0x34')](_0x5757dd[_0xe49b('0x2f')][_0xe49b('0x34')]));_0x14158b[_0xe49b('0x33')]=_0x14158b[_0xe49b('0x33')][_0xe49b('0x35')]?_0x14158b[_0xe49b('0x33')]:_0x4e2fd6[_0xe49b('0x32')];if(_0x5757dd['query'][_0xe49b('0x41')]){_0x14158b[_0xe49b('0x47')]=[{'all':!![]}];}_0x14158b=_[_0xe49b('0x3d')]({},_0x14158b,_0x5757dd[_0xe49b('0x3f')]);return db[_0xe49b('0x40')][_0xe49b('0x48')](_0x14158b)[_0xe49b('0x25')](handleEntityNotFound(_0x4e8fcc,null))[_0xe49b('0x25')](respondWithResult(_0x4e8fcc,null))[_0xe49b('0x44')](handleError(_0x4e8fcc,null));};exports[_0xe49b('0x23')]=function(_0x2f3a25,_0x15b4d2){if(_0x2f3a25['body']['id']){delete _0x2f3a25['body']['id'];}return db['CmCustomField'][_0xe49b('0x48')]({'where':{'id':_0x2f3a25['params']['id']}})[_0xe49b('0x25')](handleEntityNotFound(_0x15b4d2,null))['then'](saveUpdates(_0x2f3a25['body'],null))[_0xe49b('0x25')](respondWithResult(_0x15b4d2,null))[_0xe49b('0x44')](handleError(_0x15b4d2,null));};exports[_0xe49b('0x24')]=function(_0x16acb9,_0x36c09c){return db['CmCustomField']['find']({'where':{'id':_0x16acb9[_0xe49b('0x46')]['id']}})[_0xe49b('0x25')](handleEntityNotFound(_0x36c09c,null))[_0xe49b('0x25')](removeEntity(_0x36c09c,null))['catch'](handleError(_0x36c09c,null));};exports[_0xe49b('0x49')]=function(_0x17b22e,_0x4531be){var _0x1df373;return db[_0xe49b('0x4a')][_0xe49b('0x4b')](function(_0x545653){return db[_0xe49b('0x40')]['create'](_0x17b22e[_0xe49b('0x4c')],{'transaction':_0x545653})[_0xe49b('0x25')](function(_0x59950b){_0x1df373=_0x59950b;var _0x406bd8={'type':db[_0xe49b('0x4d')][_0xe49b('0x4e')],'transaction':_0x545653};switch(_0x17b22e[_0xe49b('0x4c')][_0xe49b('0x2b')]){case _0xe49b('0x4f'):_0x406bd8[_0xe49b('0x2b')]=db[_0xe49b('0x4d')][_0xe49b('0x4e')];break;case'number':_0x406bd8[_0xe49b('0x2b')]=db[_0xe49b('0x4d')][_0xe49b('0x50')];break;case'switch':_0x406bd8[_0xe49b('0x2b')]=db[_0xe49b('0x4d')]['BOOLEAN'];_0x406bd8[_0xe49b('0x51')]=![];break;default:}return db[_0xe49b('0x4a')][_0xe49b('0x52')]['addColumn']('cm_contacts',util['format'](_0xe49b('0x53'),_0x1df373['id']),_0x406bd8);})[_0xe49b('0x25')](function(){return _0x1df373;});})['then'](respondWithResult(_0x4531be,0xc9))['catch'](handleError(_0x4531be,null));}; \ No newline at end of file +var _0x206b=['bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','count','include','rows','show','params','includeAll','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x32cd29,_0x29f6bb){var _0x2f7e6e=function(_0x20a924){while(--_0x20a924){_0x32cd29['push'](_0x32cd29['shift']());}};_0x2f7e6e(++_0x29f6bb);}(_0x206b,0xf6));var _0xb206=function(_0x1b79f5,_0x1cf93a){_0x1b79f5=_0x1b79f5-0x0;var _0x26a6f1=_0x206b[_0x1b79f5];return _0x26a6f1;};'use strict';var emlformat=require(_0xb206('0x0'));var rimraf=require(_0xb206('0x1'));var zipdir=require(_0xb206('0x2'));var jsonpatch=require(_0xb206('0x3'));var rp=require(_0xb206('0x4'));var moment=require(_0xb206('0x5'));var BPromise=require(_0xb206('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb206('0x7'));var sox=require(_0xb206('0x8'));var csv=require(_0xb206('0x9'));var ejs=require(_0xb206('0xa'));var fs=require('fs');var fs_extra=require(_0xb206('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb206('0xc'));var jsforce=require(_0xb206('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb206('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb206('0xe'));var authService=require(_0xb206('0xf'));var qs=require(_0xb206('0x10'));var as=require(_0xb206('0x11'));var hardwareService=require(_0xb206('0x12'));var logger=require(_0xb206('0x13'))('api');var utils=require(_0xb206('0x14'));var config=require(_0xb206('0x15'));var licenseUtil=require(_0xb206('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x331664,_0x435972){_0x435972=_0x435972||0xcc;return function(_0x117933){if(_0x117933){return _0x331664[_0xb206('0x17')](_0x435972);}return _0x331664[_0xb206('0x18')](_0x435972)[_0xb206('0x19')]();};}function respondWithResult(_0x40507a,_0xa4a590){_0xa4a590=_0xa4a590||0xc8;return function(_0x3c4fe1){if(_0x3c4fe1){return _0x40507a['status'](_0xa4a590)[_0xb206('0x1a')](_0x3c4fe1);}};}function respondWithFilteredResult(_0x12da30,_0x10a5ea){return function(_0x44697c){if(_0x44697c){var _0x16da21=typeof _0x10a5ea[_0xb206('0x1b')]===_0xb206('0x1c')&&typeof _0x10a5ea[_0xb206('0x1d')]===_0xb206('0x1c');var _0x3c9e02=_0x44697c['count'];var _0x11c3de=_0x16da21?0x0:_0x10a5ea[_0xb206('0x1b')];var _0x256c0c=_0x16da21?_0x44697c['count']:_0x10a5ea[_0xb206('0x1b')]+_0x10a5ea['limit'];var _0x30009d;if(_0x256c0c>=_0x3c9e02){_0x256c0c=_0x3c9e02;_0x30009d=0xc8;}else{_0x30009d=0xce;}_0x12da30['status'](_0x30009d);return _0x12da30[_0xb206('0x1e')](_0xb206('0x1f'),_0x11c3de+'-'+_0x256c0c+'/'+_0x3c9e02)[_0xb206('0x1a')](_0x44697c);}return null;};}function patchUpdates(_0xc632f1){return function(_0x4b7324){try{jsonpatch[_0xb206('0x20')](_0x4b7324,_0xc632f1,!![]);}catch(_0x112c92){return BPromise[_0xb206('0x21')](_0x112c92);}return _0x4b7324[_0xb206('0x22')]();};}function saveUpdates(_0x407ff6,_0x163c2a){return function(_0xb5c735){if(_0xb5c735){return _0xb5c735[_0xb206('0x23')](_0x407ff6)['then'](function(_0x156603){return _0x156603;});}return null;};}function removeEntity(_0x1a22cc,_0x5a9fb3){return function(_0x186610){if(_0x186610){return _0x186610[_0xb206('0x24')]()[_0xb206('0x25')](function(){_0x1a22cc[_0xb206('0x18')](0xcc)[_0xb206('0x19')]();});}};}function handleEntityNotFound(_0x420c3c,_0x2443f8){return function(_0x46b8db){if(!_0x46b8db){_0x420c3c[_0xb206('0x17')](0x194);}return _0x46b8db;};}function handleError(_0x2dbd09,_0x2b699e){_0x2b699e=_0x2b699e||0x1f4;return function(_0x463fc2){logger['error'](_0x463fc2['stack']);if(_0x463fc2[_0xb206('0x26')]){delete _0x463fc2[_0xb206('0x26')];}_0x2dbd09[_0xb206('0x18')](_0x2b699e)[_0xb206('0x27')](_0x463fc2);};}exports[_0xb206('0x28')]=function(_0x576359,_0x52f3fe){var _0x4e40b1={},_0x4d336e={},_0x2cd902={'count':0x0,'rows':[]};var _0x2326ba=_[_0xb206('0x29')](db[_0xb206('0x2a')][_0xb206('0x2b')],function(_0x257e27){return{'name':_0x257e27['fieldName'],'type':_0x257e27[_0xb206('0x2c')]['key']};});_0x4d336e[_0xb206('0x2d')]=_[_0xb206('0x2e')](_[_0xb206('0x29')](_0x2326ba,_0xb206('0x26')),['name']);_0x4d336e[_0xb206('0x2f')]=_[_0xb206('0x30')](_0x576359[_0xb206('0x2f')]);_0x4d336e['filters']=_['intersection'](_0x4d336e[_0xb206('0x2d')],_0x4d336e[_0xb206('0x2f')]);_0x4e40b1[_0xb206('0x31')]=_[_0xb206('0x32')](_0x4d336e[_0xb206('0x2d')],qs[_0xb206('0x33')](_0x576359['query']['fields']));_0x4e40b1['attributes']=_0x4e40b1[_0xb206('0x31')][_0xb206('0x34')]?_0x4e40b1['attributes']:_0x4d336e[_0xb206('0x2d')];if(!_0x576359[_0xb206('0x2f')]['hasOwnProperty'](_0xb206('0x35'))){_0x4e40b1[_0xb206('0x1d')]=qs[_0xb206('0x1d')](_0x576359[_0xb206('0x2f')][_0xb206('0x1d')]);_0x4e40b1['offset']=qs[_0xb206('0x1b')](_0x576359[_0xb206('0x2f')][_0xb206('0x1b')]);}_0x4e40b1[_0xb206('0x36')]=qs[_0xb206('0x37')](_0x576359[_0xb206('0x2f')]['sort']);_0x4e40b1[_0xb206('0x38')]=qs[_0xb206('0x39')](_[_0xb206('0x3a')](_0x576359[_0xb206('0x2f')],_0x4d336e[_0xb206('0x39')]),_0x2326ba);if(_0x576359['query'][_0xb206('0x3b')]){_0x4e40b1['where']=_['merge'](_0x4e40b1[_0xb206('0x38')],{'$or':_[_0xb206('0x29')](_0x2326ba,function(_0x529349){if(_0x529349[_0xb206('0x2c')]!=='VIRTUAL'){var _0x141320={};_0x141320[_0x529349['name']]={'$like':'%'+_0x576359[_0xb206('0x2f')]['filter']+'%'};return _0x141320;}})});}_0x4e40b1=_[_0xb206('0x3c')]({},_0x4e40b1,_0x576359[_0xb206('0x3d')]);var _0x1cec5e={'where':_0x4e40b1[_0xb206('0x38')]};return db[_0xb206('0x2a')][_0xb206('0x3e')](_0x1cec5e)[_0xb206('0x25')](function(_0x46765a){_0x2cd902['count']=_0x46765a;if(_0x576359[_0xb206('0x2f')]['includeAll']){_0x4e40b1[_0xb206('0x3f')]=[{'all':!![]}];}return db[_0xb206('0x2a')]['findAll'](_0x4e40b1);})['then'](function(_0x569eb4){_0x2cd902[_0xb206('0x40')]=_0x569eb4;return _0x2cd902;})['then'](respondWithFilteredResult(_0x52f3fe,_0x4e40b1))['catch'](handleError(_0x52f3fe,null));};exports[_0xb206('0x41')]=function(_0x29329d,_0x3b80bb){var _0x3ec2f0={'raw':!![],'where':{'id':_0x29329d[_0xb206('0x42')]['id']}},_0x35c336={};_0x35c336[_0xb206('0x2d')]=_[_0xb206('0x30')](db[_0xb206('0x2a')]['rawAttributes']);_0x35c336[_0xb206('0x2f')]=_[_0xb206('0x30')](_0x29329d[_0xb206('0x2f')]);_0x35c336['filters']=_[_0xb206('0x32')](_0x35c336[_0xb206('0x2d')],_0x35c336[_0xb206('0x2f')]);_0x3ec2f0[_0xb206('0x31')]=_[_0xb206('0x32')](_0x35c336[_0xb206('0x2d')],qs[_0xb206('0x33')](_0x29329d[_0xb206('0x2f')][_0xb206('0x33')]));_0x3ec2f0[_0xb206('0x31')]=_0x3ec2f0[_0xb206('0x31')][_0xb206('0x34')]?_0x3ec2f0[_0xb206('0x31')]:_0x35c336[_0xb206('0x2d')];if(_0x29329d[_0xb206('0x2f')][_0xb206('0x43')]){_0x3ec2f0['include']=[{'all':!![]}];}_0x3ec2f0=_[_0xb206('0x3c')]({},_0x3ec2f0,_0x29329d['options']);return db['CmCustomField'][_0xb206('0x44')](_0x3ec2f0)[_0xb206('0x25')](handleEntityNotFound(_0x3b80bb,null))['then'](respondWithResult(_0x3b80bb,null))[_0xb206('0x45')](handleError(_0x3b80bb,null));};exports['update']=function(_0x5109a4,_0x20e1dd){if(_0x5109a4[_0xb206('0x46')]['id']){delete _0x5109a4['body']['id'];}return db[_0xb206('0x2a')][_0xb206('0x44')]({'where':{'id':_0x5109a4[_0xb206('0x42')]['id']}})[_0xb206('0x25')](handleEntityNotFound(_0x20e1dd,null))[_0xb206('0x25')](saveUpdates(_0x5109a4[_0xb206('0x46')],null))['then'](respondWithResult(_0x20e1dd,null))[_0xb206('0x45')](handleError(_0x20e1dd,null));};exports[_0xb206('0x24')]=function(_0x461e6b,_0x27fbd9){return db[_0xb206('0x2a')][_0xb206('0x44')]({'where':{'id':_0x461e6b[_0xb206('0x42')]['id']}})[_0xb206('0x25')](handleEntityNotFound(_0x27fbd9,null))[_0xb206('0x25')](removeEntity(_0x27fbd9,null))[_0xb206('0x45')](handleError(_0x27fbd9,null));};exports[_0xb206('0x47')]=function(_0x443c1b,_0x5b7fea){var _0x5aa9be;return db[_0xb206('0x48')][_0xb206('0x49')](function(_0x4232bb){return db[_0xb206('0x2a')][_0xb206('0x47')](_0x443c1b['body'],{'transaction':_0x4232bb})['then'](function(_0x341a72){_0x5aa9be=_0x341a72;var _0x299443={'type':db[_0xb206('0x4a')][_0xb206('0x4b')],'transaction':_0x4232bb};switch(_0x443c1b[_0xb206('0x46')][_0xb206('0x2c')]){case'text':_0x299443[_0xb206('0x2c')]=db[_0xb206('0x4a')]['TEXT'];break;case _0xb206('0x4c'):_0x299443[_0xb206('0x2c')]=db[_0xb206('0x4a')][_0xb206('0x4d')];break;case _0xb206('0x4e'):_0x299443['type']=db['Sequelize'][_0xb206('0x4f')];_0x299443[_0xb206('0x50')]=![];break;default:}return db[_0xb206('0x48')][_0xb206('0x51')]['addColumn'](_0xb206('0x52'),util[_0xb206('0x53')]('cf_%d',_0x5aa9be['id']),_0x299443);})[_0xb206('0x25')](function(){return _0x5aa9be;});})[_0xb206('0x25')](respondWithResult(_0x5b7fea,0xc9))[_0xb206('0x45')](handleError(_0x5b7fea,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9d6e840..683f984 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 _0x5895=['api','moment','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger'];(function(_0xb51852,_0x8f3640){var _0xa5fb6d=function(_0x4c0d71){while(--_0x4c0d71){_0xb51852['push'](_0xb51852['shift']());}};_0xa5fb6d(++_0x8f3640);}(_0x5895,0x147));var _0x5589=function(_0x325a7d,_0x3d34e3){_0x325a7d=_0x325a7d-0x0;var _0x4e8119=_0x5895[_0x325a7d];return _0x4e8119;};'use strict';var _=require(_0x5589('0x0'));var util=require(_0x5589('0x1'));var logger=require(_0x5589('0x2'))(_0x5589('0x3'));var moment=require(_0x5589('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5589('0x5'));var rimraf=require('rimraf');var config=require(_0x5589('0x6'));var attributes=require(_0x5589('0x7'));module[_0x5589('0x8')]=function(_0x1690ec,_0x4fdc53){return _0x1690ec[_0x5589('0x9')](_0x5589('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50b6=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','moment','request-promise','path'];(function(_0x558db1,_0x297625){var _0x3c480d=function(_0x590bab){while(--_0x590bab){_0x558db1['push'](_0x558db1['shift']());}};_0x3c480d(++_0x297625);}(_0x50b6,0xaf));var _0x650b=function(_0x55e12e,_0x5a9ee2){_0x55e12e=_0x55e12e-0x0;var _0x3caa06=_0x50b6[_0x55e12e];return _0x3caa06;};'use strict';var _=require('lodash');var util=require(_0x650b('0x0'));var logger=require(_0x650b('0x1'))('api');var moment=require(_0x650b('0x2'));var BPromise=require('bluebird');var rp=require(_0x650b('0x3'));var fs=require('fs');var path=require(_0x650b('0x4'));var rimraf=require(_0x650b('0x5'));var config=require(_0x650b('0x6'));var attributes=require(_0x650b('0x7'));module[_0x650b('0x8')]=function(_0x3f5018,_0x2fa8c4){return _0x3f5018[_0x650b('0x9')](_0x650b('0xa'),attributes,{'tableName':_0x650b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 6ddbe2b..55b26a7 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 _0x4c65=['error','code','message','request\x20sent','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432471,_0x60b8e2){var _0x37bd1d=function(_0x28f4ec){while(--_0x28f4ec){_0x432471['push'](_0x432471['shift']());}};_0x37bd1d(++_0x60b8e2);}(_0x4c65,0x74));var _0x54c6=function(_0x184b1d,_0x1dea81){_0x184b1d=_0x184b1d-0x0;var _0x36ae4e=_0x4c65[_0x184b1d];return _0x36ae4e;};'use strict';var _=require(_0x54c6('0x0'));var util=require('util');var moment=require(_0x54c6('0x1'));var BPromise=require('bluebird');var rs=require(_0x54c6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54c6('0x3'))['db'];var utils=require(_0x54c6('0x4'));var logger=require(_0x54c6('0x5'))(_0x54c6('0x6'));var config=require(_0x54c6('0x7'));var jayson=require(_0x54c6('0x8'));var client=jayson[_0x54c6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a37bd,_0x2ae7c6,_0x5262b8){return new BPromise(function(_0x5158a7,_0x1f6007){return client[_0x54c6('0xa')](_0x2a37bd,_0x5262b8)[_0x54c6('0xb')](function(_0x3c3c7b){logger[_0x54c6('0xc')](_0x54c6('0xd'),_0x2ae7c6,'request\x20sent');logger['debug'](_0x54c6('0xe'),_0x2ae7c6,'request\x20sent',JSON[_0x54c6('0xf')](_0x3c3c7b));if(_0x3c3c7b['error']){if(_0x3c3c7b[_0x54c6('0x10')][_0x54c6('0x11')]===0x1f4){logger[_0x54c6('0x10')](_0x54c6('0xd'),_0x2ae7c6,_0x3c3c7b['error']['message']);return _0x1f6007(_0x3c3c7b['error'][_0x54c6('0x12')]);}logger[_0x54c6('0x10')](_0x54c6('0xd'),_0x2ae7c6,_0x3c3c7b[_0x54c6('0x10')][_0x54c6('0x12')]);return _0x5158a7(_0x3c3c7b['error'][_0x54c6('0x12')]);}else{logger['info'](_0x54c6('0xd'),_0x2ae7c6,_0x54c6('0x13'));_0x5158a7(_0x3c3c7b[_0x54c6('0x14')][_0x54c6('0x12')]);}})[_0x54c6('0x15')](function(_0x316571){logger[_0x54c6('0x10')]('CmCustomField,\x20%s,\x20%s',_0x2ae7c6,_0x316571);_0x1f6007(_0x316571);});});} \ No newline at end of file +var _0xbd3d=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x50694c,_0x7a7fa9){var _0x535b99=function(_0x3b3063){while(--_0x3b3063){_0x50694c['push'](_0x50694c['shift']());}};_0x535b99(++_0x7a7fa9);}(_0xbd3d,0x165));var _0xdbd3=function(_0x5d1172,_0x2e0796){_0x5d1172=_0x5d1172-0x0;var _0x5aaa6d=_0xbd3d[_0x5d1172];return _0x5aaa6d;};'use strict';var _=require(_0xdbd3('0x0'));var util=require('util');var moment=require(_0xdbd3('0x1'));var BPromise=require(_0xdbd3('0x2'));var rs=require(_0xdbd3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbd3('0x4'));var logger=require(_0xdbd3('0x5'))(_0xdbd3('0x6'));var config=require(_0xdbd3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbd3('0x8')][_0xdbd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1786b2,_0x38be20,_0x14e5fb){return new BPromise(function(_0x575fa7,_0x143b52){return client['request'](_0x1786b2,_0x14e5fb)[_0xdbd3('0xa')](function(_0x1290b3){logger['info'](_0xdbd3('0xb'),_0x38be20,_0xdbd3('0xc'));logger[_0xdbd3('0xd')](_0xdbd3('0xe'),_0x38be20,_0xdbd3('0xc'),JSON['stringify'](_0x1290b3));if(_0x1290b3[_0xdbd3('0xf')]){if(_0x1290b3[_0xdbd3('0xf')][_0xdbd3('0x10')]===0x1f4){logger[_0xdbd3('0xf')]('CmCustomField,\x20%s,\x20%s',_0x38be20,_0x1290b3['error']['message']);return _0x143b52(_0x1290b3[_0xdbd3('0xf')]['message']);}logger[_0xdbd3('0xf')](_0xdbd3('0xb'),_0x38be20,_0x1290b3[_0xdbd3('0xf')][_0xdbd3('0x11')]);return _0x575fa7(_0x1290b3['error'][_0xdbd3('0x11')]);}else{logger['info'](_0xdbd3('0xb'),_0x38be20,_0xdbd3('0xc'));_0x575fa7(_0x1290b3[_0xdbd3('0x12')][_0xdbd3('0x11')]);}})[_0xdbd3('0x13')](function(_0x184307){logger[_0xdbd3('0xf')](_0xdbd3('0xb'),_0x38be20,_0x184307);_0x143b52(_0x184307);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bcc80ca..8e5cefd 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 _0x7412=['delete','destroy','exports','multer','connect-timeout','Router','isAuthenticated','index','get','show','post','put','/:id','update'];(function(_0x2b048e,_0x5abd64){var _0x2f5d57=function(_0x377a1a){while(--_0x377a1a){_0x2b048e['push'](_0x2b048e['shift']());}};_0x2f5d57(++_0x5abd64);}(_0x7412,0x161));var _0x2741=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7412[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x2741('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2741('0x1'));var express=require('express');var router=express[_0x2741('0x2')]();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('./cmCustomField.controller');router['get']('/',auth[_0x2741('0x3')](),controller[_0x2741('0x4')]);router[_0x2741('0x5')]('/:id',auth[_0x2741('0x3')](),controller[_0x2741('0x6')]);router[_0x2741('0x7')]('/',auth[_0x2741('0x3')](),controller['create']);router[_0x2741('0x8')](_0x2741('0x9'),auth[_0x2741('0x3')](),controller[_0x2741('0xa')]);router[_0x2741('0xb')]('/:id',auth[_0x2741('0x3')](),controller[_0x2741('0xc')]);module[_0x2741('0xd')]=router; \ No newline at end of file +var _0xd9ef=['put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9ef,0x95));var _0xfd9e=function(_0xa4fcb6,_0x2fa837){_0xa4fcb6=_0xa4fcb6-0x0;var _0x51cde7=_0xd9ef[_0xa4fcb6];return _0x51cde7;};'use strict';var multer=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var path=require('path');var timeout=require(_0xfd9e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfd9e('0x3'));var interaction=require(_0xfd9e('0x4'));var config=require(_0xfd9e('0x5'));var controller=require(_0xfd9e('0x6'));router[_0xfd9e('0x7')]('/',auth[_0xfd9e('0x8')](),controller[_0xfd9e('0x9')]);router[_0xfd9e('0x7')](_0xfd9e('0xa'),auth[_0xfd9e('0x8')](),controller[_0xfd9e('0xb')]);router[_0xfd9e('0xc')]('/',auth[_0xfd9e('0x8')](),controller['create']);router[_0xfd9e('0xd')](_0xfd9e('0xa'),auth['isAuthenticated'](),controller[_0xfd9e('0xe')]);router[_0xfd9e('0xf')](_0xfd9e('0xa'),auth['isAuthenticated'](),controller[_0xfd9e('0x10')]);module[_0xfd9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7a4287b..74d1ea1 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 _0xcfb1=['INTEGER','UNSIGNED','contactListQueue','DATE','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0xcfb1,0xf6));var _0x1cfb=function(_0x294c1c,_0x567301){_0x294c1c=_0x294c1c-0x0;var _0x1e7943=_0xcfb1[_0x294c1c];return _0x1e7943;};'use strict';var moment=require(_0x1cfb('0x0'));var Sequelize=require(_0x1cfb('0x1'));module[_0x1cfb('0x2')]={'phone':{'type':Sequelize[_0x1cfb('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x1cfb('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x1cfb('0x5')](_0x1cfb('0x6'))},'countbusyretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1cfb('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1cfb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1cfb('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1cfb('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1cfb('0x9')},'ListId':{'type':Sequelize[_0x1cfb('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x1cfb('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x1cfb('0x7')],'unique':_0x1cfb('0x9')},'CampaignId':{'type':Sequelize[_0x1cfb('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1cfb('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1cfb('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1cfb('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1cfb('0xa')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x0a34=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3653c7,_0xadb356){var _0x58a021=function(_0x20b237){while(--_0x20b237){_0x3653c7['push'](_0x3653c7['shift']());}};_0x58a021(++_0xadb356);}(_0x0a34,0x106));var _0x40a3=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0a34[_0x5f1391];return _0x50ebe3;};'use strict';var moment=require(_0x40a3('0x0'));var Sequelize=require(_0x40a3('0x1'));module[_0x40a3('0x2')]={'phone':{'type':Sequelize[_0x40a3('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x40a3('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x40a3('0x5')],'defaultValue':moment()['format'](_0x40a3('0x6'))},'countbusyretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x40a3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x40a3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x40a3('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x40a3('0x7')],'unique':_0x40a3('0x9')},'ListId':{'type':Sequelize[_0x40a3('0x7')],'unique':_0x40a3('0x9')},'UserId':{'type':Sequelize[_0x40a3('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x40a3('0x7')],'unique':_0x40a3('0x9')},'CampaignId':{'type':Sequelize[_0x40a3('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x40a3('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x40a3('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x40a3('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c29039d..c43ee6d 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 _0xe14b=['UPDATE','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','moment','lodash','api','../../config/environment','status','json','offset','count','limit','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','keys','filters','concat','$and','$gt','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$notILike','$contains','$contained','$any','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','statedesc','campaign','membername','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperAdditionalPhone','end','getPreview','user','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','findOne','scheduledat','phone','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall'];(function(_0x27b1b7,_0x15bea1){var _0x477555=function(_0x2f0edb){while(--_0x2f0edb){_0x27b1b7['push'](_0x27b1b7['shift']());}};_0x477555(++_0x15bea1);}(_0xe14b,0x93));var _0xbe14=function(_0xb79909,_0x5c084f){_0xb79909=_0xb79909-0x0;var _0x10ad21=_0xe14b[_0xb79909];return _0x10ad21;};'use strict';var moment=require(_0xbe14('0x0'));var _=require(_0xbe14('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xbe14('0x2'));var shared=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x7d3665,_0x5ce8fb){_0x5ce8fb=_0x5ce8fb||0xc8;return function(_0x496c04){if(_0x496c04){return _0x7d3665[_0xbe14('0x4')](_0x5ce8fb)[_0xbe14('0x5')](_0x496c04);}};}function respondWithFilteredResult(_0x1fe204,_0x1ff100){return function(_0x1d9ade){if(_0x1d9ade){var _0x39387e=typeof _0x1ff100[_0xbe14('0x6')]==='undefined'&&typeof _0x1ff100['limit']==='undefined';var _0x30c355=_0x1d9ade[_0xbe14('0x7')];var _0xd68cd7=_0x39387e?0x0:_0x1ff100[_0xbe14('0x6')];var _0x53c7ea=_0x39387e?_0x1d9ade['count']:_0x1ff100[_0xbe14('0x6')]+_0x1ff100[_0xbe14('0x8')];var _0x4935cc;if(_0x53c7ea>=_0x30c355){_0x53c7ea=_0x30c355;_0x4935cc=0xc8;}else{_0x4935cc=0xce;}_0x1fe204[_0xbe14('0x4')](_0x4935cc);return _0x1fe204[_0xbe14('0x9')](_0xbe14('0xa'),_0xd68cd7+'-'+_0x53c7ea+'/'+_0x30c355)[_0xbe14('0x5')](_0x1d9ade);}return null;};}function saveUpdates(_0x27792f,_0x3b898d){return function(_0x23a730){if(_0x23a730){return _0x23a730[_0xbe14('0xb')](_0x27792f)[_0xbe14('0xc')](function(_0xa2cf72){return _0xa2cf72;});}return null;};}function handleEntityNotFound(_0x1e4826,_0x33fd54){return function(_0x813399){if(!_0x813399){_0x1e4826['sendStatus'](0x194);}return _0x813399;};}function handleError(_0x55b3a7,_0x3f58f5){_0x3f58f5=_0x3f58f5||0x1f4;return function(_0x3dc4a9){logger[_0xbe14('0xd')](_0x3dc4a9[_0xbe14('0xe')]);if(_0x3dc4a9['name']){delete _0x3dc4a9[_0xbe14('0xf')];}_0x55b3a7[_0xbe14('0x4')](_0x3f58f5)[_0xbe14('0x10')](_0x3dc4a9);};}exports[_0xbe14('0x11')]=function(_0x38f1ea,_0x29ab73){var _0x17ae86={},_0x5ea1f8={},_0x137ee5={'count':0x0,'rows':[]};var _0x456ca8=_[_0xbe14('0x12')](db[_0xbe14('0x13')][_0xbe14('0x14')],function(_0x37e4c1){return{'name':_0x37e4c1['fieldName'],'type':_0x37e4c1[_0xbe14('0x15')][_0xbe14('0x16')]};});_0x5ea1f8[_0xbe14('0x17')]=_[_0xbe14('0x12')](_0x456ca8,_0xbe14('0xf'));_0x5ea1f8['query']=_[_0xbe14('0x18')](_0x38f1ea['query']);_0x5ea1f8[_0xbe14('0x19')]=_['intersection'](_0x5ea1f8[_0xbe14('0x17')],_0x5ea1f8['query']);_0x5ea1f8[_0xbe14('0x19')]=_[_0xbe14('0x1a')](_0x5ea1f8['filters'],[_0xbe14('0x1b'),'$or',_0xbe14('0x1c'),'$gte',_0xbe14('0x1d'),_0xbe14('0x1e'),_0xbe14('0x1f'),_0xbe14('0x20'),_0xbe14('0x21'),_0xbe14('0x22'),'$notBetween',_0xbe14('0x23'),_0xbe14('0x24'),_0xbe14('0x25'),_0xbe14('0x26'),'$iLike',_0xbe14('0x27'),_0xbe14('0x25'),'$overlap',_0xbe14('0x28'),_0xbe14('0x29'),_0xbe14('0x2a')]);_0x17ae86[_0xbe14('0x2b')]=_[_0xbe14('0x2c')](_0x5ea1f8[_0xbe14('0x17')],qs[_0xbe14('0x2d')](_0x38f1ea[_0xbe14('0x2e')][_0xbe14('0x2d')]));_0x17ae86[_0xbe14('0x2b')]=_0x17ae86[_0xbe14('0x2b')][_0xbe14('0x2f')]?_0x17ae86[_0xbe14('0x2b')]:_0x5ea1f8[_0xbe14('0x17')];if(!_0x38f1ea[_0xbe14('0x2e')][_0xbe14('0x30')](_0xbe14('0x31'))){_0x17ae86[_0xbe14('0x8')]=qs[_0xbe14('0x8')](_0x38f1ea[_0xbe14('0x2e')]['limit']);_0x17ae86[_0xbe14('0x6')]=qs['offset'](_0x38f1ea['query'][_0xbe14('0x6')]);}_0x17ae86['order']=qs[_0xbe14('0x32')](_0x38f1ea[_0xbe14('0x2e')]['sort']);_0x17ae86['where']=qs['filters'](_[_0xbe14('0x33')](_0x38f1ea[_0xbe14('0x2e')],_0x5ea1f8['filters']),_0x456ca8);if(_0x38f1ea[_0xbe14('0x2e')][_0xbe14('0x34')]){_0x17ae86[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x17ae86[_0xbe14('0x35')],{'$or':_['map'](_0x456ca8,function(_0x591a36){if(_0x591a36[_0xbe14('0x15')]!=='VIRTUAL'){var _0x5dd7aa={};_0x5dd7aa[_0x591a36['name']]={'$like':'%'+_0x38f1ea[_0xbe14('0x2e')][_0xbe14('0x34')]+'%'};return _0x5dd7aa;}})});}_0x17ae86=_[_0xbe14('0x36')]({},_0x17ae86,_0x38f1ea[_0xbe14('0x37')]);var _0x172e79={'where':_0x17ae86[_0xbe14('0x35')]};return db[_0xbe14('0x13')][_0xbe14('0x7')](_0x172e79)[_0xbe14('0xc')](function(_0x2dfd5a){_0x137ee5[_0xbe14('0x7')]=_0x2dfd5a;if(_0x38f1ea[_0xbe14('0x2e')]['includeAll']){_0x17ae86['include']=[{'all':!![]}];}return db[_0xbe14('0x13')][_0xbe14('0x38')](_0x17ae86);})[_0xbe14('0xc')](function(_0x520e09){_0x137ee5[_0xbe14('0x39')]=_0x520e09;return _0x137ee5;})[_0xbe14('0xc')](respondWithFilteredResult(_0x29ab73,_0x17ae86))[_0xbe14('0x3a')](handleError(_0x29ab73,null));};exports[_0xbe14('0x3b')]=function(_0x3bd454,_0x25ee1f){var _0x19fa30={'raw':!![],'where':{'id':_0x3bd454[_0xbe14('0x3c')]['id']}},_0x128843={};_0x128843['model']=_[_0xbe14('0x18')](db[_0xbe14('0x13')][_0xbe14('0x14')]);_0x128843[_0xbe14('0x2e')]=_[_0xbe14('0x18')](_0x3bd454[_0xbe14('0x2e')]);_0x128843['filters']=_[_0xbe14('0x2c')](_0x128843[_0xbe14('0x17')],_0x128843[_0xbe14('0x2e')]);_0x19fa30[_0xbe14('0x2b')]=_['intersection'](_0x128843['model'],qs[_0xbe14('0x2d')](_0x3bd454[_0xbe14('0x2e')][_0xbe14('0x2d')]));_0x19fa30['attributes']=_0x19fa30['attributes'][_0xbe14('0x2f')]?_0x19fa30['attributes']:_0x128843['model'];if(_0x3bd454[_0xbe14('0x2e')][_0xbe14('0x3d')]){_0x19fa30[_0xbe14('0x3e')]=[{'all':!![]}];}_0x19fa30=_['merge']({},_0x19fa30,_0x3bd454['options']);return db['CmHopper'][_0xbe14('0x3f')](_0x19fa30)[_0xbe14('0xc')](handleEntityNotFound(_0x25ee1f,null))[_0xbe14('0xc')](respondWithResult(_0x25ee1f,null))['catch'](handleError(_0x25ee1f,null));};exports[_0xbe14('0x40')]=function(_0xcb0680,_0x32f22e){return db[_0xbe14('0x13')]['create'](_0xcb0680['body'],{})[_0xbe14('0xc')](respondWithResult(_0x32f22e,0xc9))[_0xbe14('0x3a')](handleError(_0x32f22e,null));};exports[_0xbe14('0xb')]=function(_0xb2b285,_0x2550dc){if(_0xb2b285['body']['id']){delete _0xb2b285['body']['id'];}return db[_0xbe14('0x13')][_0xbe14('0x3f')]({'where':{'id':_0xb2b285[_0xbe14('0x3c')]['id']}})[_0xbe14('0xc')](handleEntityNotFound(_0x2550dc,null))['then'](saveUpdates(_0xb2b285[_0xbe14('0x41')],null))[_0xbe14('0xc')](respondWithResult(_0x2550dc,null))['catch'](handleError(_0x2550dc,null));};exports[_0xbe14('0x42')]=function(_0x2a35e5,_0x2d6ee8){return db[_0xbe14('0x13')]['describe']()['then'](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3a')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb;var _0x5d3726=_0x4a1a37[_0xbe14('0x3c')]['id'];return db[_0xbe14('0x13')][_0xbe14('0x3f')]({'where':{'id':_0x4a1a37[_0xbe14('0x3c')]['id']}})[_0xbe14('0xc')](handleEntityNotFound(_0x5acf90,null))['then'](function(_0xf32e93){if(_0xf32e93){return _0xf32e93[_0xbe14('0x43')]()[_0xbe14('0xc')](function(_0x22b1f8){return _0x22b1f8;});}})[_0xbe14('0xc')](function(_0x494c32){_0xca8cdb=_0x494c32;if(_0x494c32){if(_0x494c32[_0xbe14('0x44')]||_0x494c32[_0xbe14('0x45')]){return db[_0x494c32[_0xbe14('0x44')]?_0xbe14('0x46'):_0xbe14('0x47')][_0xbe14('0x3f')]({'where':{'id':_0x494c32['VoiceQueueId']?_0x494c32['VoiceQueueId']:_0x494c32[_0xbe14('0x45')]},'attributes':['id',_0xbe14('0xf')],'raw':!![]});}}})[_0xbe14('0xc')](function(_0x48554a){var _0x497b00={};if(_0x48554a){_[_0xbe14('0x36')](_0x497b00,_[_0xbe14('0x48')](_0xca8cdb['dataValues'],[_0xbe14('0x49'),_0xbe14('0x4a'),'id']));_0x497b00['state']=0x15;_0x497b00[_0xbe14('0x4b')]='deleted';_0x497b00[_0xbe14('0x4c')]=_0x48554a[_0xbe14('0xf')];_0x497b00[_0xbe14('0x4d')]=_0x4a1a37['user'][_0xbe14('0xf')];_0x497b00[_0xbe14('0x4e')]=_0x4a1a37['user']['id'];_0x497b00[_0xbe14('0x4f')]=!![];_0x497b00[_0xbe14('0x50')]=moment()[_0xbe14('0x51')](_0xbe14('0x52'));_0x497b00[_0xbe14('0x53')]=_0xca8cdb['phone'];_0x497b00[_0xbe14('0x54')]=_0xca8cdb[_0xbe14('0x44')]?_0xbe14('0x55'):_0xbe14('0x56');return db[_0xbe14('0x57')][_0xbe14('0x3f')]({'where':{'id':_0x497b00[_0xbe14('0x58')]},'attributes':['firstName',_0xbe14('0x59')]})[_0xbe14('0xc')](function(_0x941ee2){if(!_[_0xbe14('0x5a')](_0x5acf90)&&!_[_0xbe14('0x5a')](_0x941ee2[_0xbe14('0x5b')])){_0x497b00[_0xbe14('0x5c')]=_0x941ee2[_0xbe14('0x5b')];if(!_[_0xbe14('0x5a')](_0x941ee2[_0xbe14('0x59')])){_0x497b00[_0xbe14('0x5c')]+='\x20'+_0x941ee2['lastName'];}}})['finally'](function(){return db['CmHopperFinal'][_0xbe14('0x40')](_0x497b00);});}})[_0xbe14('0xc')](function(_0x2f4e52){return db[_0xbe14('0x5d')][_0xbe14('0x43')]({'where':{'CmHopperId':_0x5d3726}});})[_0xbe14('0xc')](function(){return _0x5acf90[_0xbe14('0x4')](0xcc)[_0xbe14('0x5e')]();})[_0xbe14('0x3a')](handleError(_0x5acf90,null));};exports[_0xbe14('0x5f')]=function(_0x603816,_0x4346e8){var _0x2088e4=[];return db[_0xbe14('0x57')][_0xbe14('0x42')]()[_0xbe14('0xc')](function(_0x179077){_0x2088e4=_[_0xbe14('0x18')](_0x179077);return _0x603816[_0xbe14('0x60')][_0xbe14('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xbe14('0x62')},'attributes':['id',_0xbe14('0x63'),_0xbe14('0x64')],'raw':!![]});})[_0xbe14('0xc')](function(_0x3ee6b7){if(_0x3ee6b7&&_0x3ee6b7[_0xbe14('0x2f')]){return db[_0xbe14('0x65')][_0xbe14('0x66')](function(_0x23cb36){var _0x100d43={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbe14('0x52'))},'VoiceQueueId':{'$in':_[_0xbe14('0x12')](_0x3ee6b7,'id')},'$or':[{'UserId':null},{'UserId':_0x603816[_0xbe14('0x60')]['id']}]};var _0xfd32a3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3ee6b7)[_0xbe14('0x34')](['dialPreviewAutoRecallMe',0x0])[_0xbe14('0x12')]('id')[_0xbe14('0x67')]()},'$or':[{'UserId':null},{'UserId':_0x603816[_0xbe14('0x60')]['id']}]};var _0xd4e1c7={'$or':[_0x100d43,_0xfd32a3]};var _0x46ac9c=[];if(_0x603816['body'][_0xbe14('0x68')]&&_0x603816[_0xbe14('0x41')][_0xbe14('0x68')]===_0xbe14('0x69')){if(!_[_0xbe14('0x6a')](_0x603816[_0xbe14('0x41')][_0xbe14('0x6b')])){_0xd4e1c7['id']={'$in':_0x603816[_0xbe14('0x41')]['hopperIds']};}_0x46ac9c=[[_0xbe14('0x6c'),_0xbe14('0x6d')],[_0xbe14('0x6e'),_0x3ee6b7[0x0][_0xbe14('0x63')]===_0xbe14('0x6d')?_0xbe14('0x6f'):_0xbe14('0x6d')],db['sequelize']['literal'](_0xbe14('0x70')),['id',_0xbe14('0x6f')]];}else{if(!_[_0xbe14('0x6a')](_0x603816[_0xbe14('0x41')][_0xbe14('0x6b')])){_0xd4e1c7['id']={'$notIn':_0x603816[_0xbe14('0x41')][_0xbe14('0x6b')]};}_0x46ac9c=[[_0xbe14('0x6c'),'DESC'],['scheduledAt',_0x3ee6b7[0x0][_0xbe14('0x63')]],db[_0xbe14('0x65')][_0xbe14('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xbe14('0x6d')]];}return db[_0xbe14('0x13')][_0xbe14('0x72')]({'attributes':['id',_0xbe14('0x73'),_0xbe14('0x74'),_0xbe14('0x75')],'where':_0xd4e1c7,'order':_0x46ac9c,'transaction':_0x23cb36,'lock':_0x23cb36[_0xbe14('0x76')]['UPDATE'],'include':[{'model':db[_0xbe14('0x57')],'as':_0xbe14('0x77'),'attributes':_0x2088e4,'include':[{'model':db[_0xbe14('0x78')],'as':_0xbe14('0x79'),'attributes':['id',_0xbe14('0xf')]}]},{'model':db[_0xbe14('0x7a')],'as':_0xbe14('0x7b'),'attributes':['id','name']},{'model':db[_0xbe14('0x46')],'as':_0xbe14('0x7c'),'attributes':['id',_0xbe14('0xf'),_0xbe14('0x7d')]}]})[_0xbe14('0xc')](function(_0x2eb057){if(_0x2eb057){return _0x2eb057[_0xbe14('0xb')]({'UserId':_0x603816[_0xbe14('0x60')]['id']},{'transaction':_0x23cb36});}});});}})['then'](handleEntityNotFound(_0x4346e8,null))[_0xbe14('0xc')](respondWithResult(_0x4346e8,null))[_0xbe14('0x3a')](handleError(_0x4346e8,null));};exports[_0xbe14('0x7e')]=function(_0xb40587,_0x2e0155,_0x17576b){var _0x4d59ce=[];var _0x176099=_0xb40587[_0xbe14('0x3c')]['id'];var _0x1edc66=_0xb40587[_0xbe14('0x60')]['id'];return db['CmContact'][_0xbe14('0x42')]()[_0xbe14('0xc')](function(_0x316542){_0x4d59ce=_[_0xbe14('0x18')](_0x316542);return db[_0xbe14('0x65')][_0xbe14('0x66')](function(_0x3b0828){const _0x55e70f={'id':_0x176099};return db[_0xbe14('0x13')]['findOne']({'attributes':['id',_0xbe14('0x73'),'recallme'],'where':_0x55e70f,'transaction':_0x3b0828,'lock':_0x3b0828[_0xbe14('0x76')][_0xbe14('0x7f')],'include':[{'model':db[_0xbe14('0x57')],'as':'Contact','attributes':_0x4d59ce,'include':[{'model':db[_0xbe14('0x78')],'as':_0xbe14('0x79'),'attributes':['id',_0xbe14('0xf')]}]},{'model':db['CmList'],'as':_0xbe14('0x7b'),'attributes':['id',_0xbe14('0xf')]},{'model':db[_0xbe14('0x46')],'as':_0xbe14('0x7c'),'attributes':['id','name',_0xbe14('0x7d')]}]})[_0xbe14('0xc')](function(_0x34f90b){if(_0x34f90b){return _0x34f90b[_0xbe14('0xb')]({'UserId':_0x1edc66},{'transaction':_0x3b0828});}});});})[_0xbe14('0xc')](handleEntityNotFound(_0x2e0155,null))[_0xbe14('0xc')](respondWithResult(_0x2e0155,null))[_0xbe14('0x3a')](handleError(_0x2e0155,null));};exports['getOpenContacts']=function(_0x2ff94c,_0x123f4f){return _0x2ff94c[_0xbe14('0x60')]['getVoiceQueues']({'where':{'type':_0xbe14('0x80'),'dialActive':!![],'dialMethod':_0xbe14('0x62')},'attributes':['id'],'raw':!![]})[_0xbe14('0xc')](function(_0x5bc52b){if(_0x5bc52b&&_0x5bc52b[_0xbe14('0x2f')]){return db[_0xbe14('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbe14('0x51')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xbe14('0x12')](_0x5bc52b,'id')},'$or':[{'UserId':null},{'UserId':_0x2ff94c[_0xbe14('0x60')]['id']}]}});}return 0x0;})['then'](function(_0x55d729){if(!_[_0xbe14('0x5a')](_0x55d729)&&_[_0xbe14('0x81')](_0x55d729)){return _0x123f4f[_0xbe14('0x4')](0xc8)['json']({'contacts':_0x55d729});}else{logger[_0xbe14('0xd')](_0xbe14('0x82'),_0xbe14('0x83'),0x194,_0xbe14('0x84'));_0x123f4f['sendStatus'](0x194);}})['catch'](handleError(_0x123f4f,null));};exports[_0xbe14('0x85')]=function(_0x6f7a6f,_0xc8d0f6){var _0x215d5b=shared[_0xbe14('0x86')];var _0x1a19a7=[];_[_0xbe14('0x12')](_0x215d5b,function(_0x4e5a63){_0x1a19a7[_0xbe14('0x87')]({'id':_0x4e5a63['name'],'name':_0x4e5a63[_0xbe14('0xf')],'utcOffset':_0x4e5a63[_0xbe14('0x88')]});});return _0xc8d0f6[_0xbe14('0x4')](0xc8)[_0xbe14('0x5')]({'tz':_0x1a19a7});};exports['getTimezone']=function(_0x1e160b,_0xa8dd0c){var _0xdfbd5b=shared['timezones'];var _0x2beb45={};if(!_[_0xbe14('0x5a')](_0xdfbd5b[_0x1e160b[_0xbe14('0x41')]['id']]))_0x2beb45=_0xdfbd5b[_0x1e160b[_0xbe14('0x41')]['id']];return _0xa8dd0c[_0xbe14('0x4')](0xc8)[_0xbe14('0x5')](_0x2beb45);}; \ No newline at end of file +var _0x9957=['Contact','List','Queue','preview','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','getTimezones','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','attributes','model','length','order','sort','pick','filter','where','merge','options','includeAll','include','CmHopper','findAll','catch','show','params','rawAttributes','fields','find','create','body','describe','destroy','VoiceQueueId','Campaign','CampaignId','dataValues','createdAt','updatedAt','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','hopperIds','priority','scheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','CmList','VoiceQueue','dialActive'];(function(_0x404f13,_0x4fa35f){var _0x1f9dbb=function(_0x492b33){while(--_0x492b33){_0x404f13['push'](_0x404f13['shift']());}};_0x1f9dbb(++_0x4fa35f);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var moment=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var qs=require(_0x7995('0x2'));var logger=require(_0x7995('0x3'))('api');var shared=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];function respondWithResult(_0x1902b4,_0x462a03){_0x462a03=_0x462a03||0xc8;return function(_0x576d89){if(_0x576d89){return _0x1902b4[_0x7995('0x6')](_0x462a03)[_0x7995('0x7')](_0x576d89);}};}function respondWithFilteredResult(_0x137b6b,_0x219534){return function(_0xbda126){if(_0xbda126){var _0x326741=typeof _0x219534['offset']===_0x7995('0x8')&&typeof _0x219534[_0x7995('0x9')]==='undefined';var _0xa2e5f0=_0xbda126[_0x7995('0xa')];var _0x18c8a3=_0x326741?0x0:_0x219534[_0x7995('0xb')];var _0x3c1d19=_0x326741?_0xbda126[_0x7995('0xa')]:_0x219534[_0x7995('0xb')]+_0x219534['limit'];var _0x245143;if(_0x3c1d19>=_0xa2e5f0){_0x3c1d19=_0xa2e5f0;_0x245143=0xc8;}else{_0x245143=0xce;}_0x137b6b[_0x7995('0x6')](_0x245143);return _0x137b6b['set'](_0x7995('0xc'),_0x18c8a3+'-'+_0x3c1d19+'/'+_0xa2e5f0)[_0x7995('0x7')](_0xbda126);}return null;};}function saveUpdates(_0x19a27e,_0x385f00){return function(_0x281576){if(_0x281576){return _0x281576[_0x7995('0xd')](_0x19a27e)[_0x7995('0xe')](function(_0x4cc004){return _0x4cc004;});}return null;};}function handleEntityNotFound(_0x58f5ad,_0x2b4e94){return function(_0x2233dd){if(!_0x2233dd){_0x58f5ad[_0x7995('0xf')](0x194);}return _0x2233dd;};}function handleError(_0x321ae8,_0x3f1d3e){_0x3f1d3e=_0x3f1d3e||0x1f4;return function(_0x1a5310){logger[_0x7995('0x10')](_0x1a5310[_0x7995('0x11')]);if(_0x1a5310['name']){delete _0x1a5310[_0x7995('0x12')];}_0x321ae8['status'](_0x3f1d3e)[_0x7995('0x13')](_0x1a5310);};}exports[_0x7995('0x14')]=function(_0x43d4b8,_0x291317){var _0x1e1415={},_0x37a7d4={},_0x4faa60={'count':0x0,'rows':[]};var _0x54c9ae=_[_0x7995('0x15')](db['CmHopper']['rawAttributes'],function(_0x3ec178){return{'name':_0x3ec178[_0x7995('0x16')],'type':_0x3ec178['type'][_0x7995('0x17')]};});_0x37a7d4['model']=_['map'](_0x54c9ae,_0x7995('0x12'));_0x37a7d4[_0x7995('0x18')]=_[_0x7995('0x19')](_0x43d4b8[_0x7995('0x18')]);_0x37a7d4[_0x7995('0x1a')]=_[_0x7995('0x1b')](_0x37a7d4['model'],_0x37a7d4[_0x7995('0x18')]);_0x37a7d4[_0x7995('0x1a')]=_[_0x7995('0x1c')](_0x37a7d4[_0x7995('0x1a')],[_0x7995('0x1d'),_0x7995('0x1e'),_0x7995('0x1f'),_0x7995('0x20'),'$lt',_0x7995('0x21'),_0x7995('0x22'),_0x7995('0x23'),_0x7995('0x24'),_0x7995('0x25'),_0x7995('0x26'),'$in',_0x7995('0x27'),'$like',_0x7995('0x28'),_0x7995('0x29'),_0x7995('0x2a'),_0x7995('0x2b'),_0x7995('0x2c'),'$contains',_0x7995('0x2d'),'$any']);_0x1e1415[_0x7995('0x2e')]=_[_0x7995('0x1b')](_0x37a7d4[_0x7995('0x2f')],qs['fields'](_0x43d4b8['query']['fields']));_0x1e1415[_0x7995('0x2e')]=_0x1e1415[_0x7995('0x2e')][_0x7995('0x30')]?_0x1e1415[_0x7995('0x2e')]:_0x37a7d4[_0x7995('0x2f')];if(!_0x43d4b8[_0x7995('0x18')]['hasOwnProperty']('nolimit')){_0x1e1415[_0x7995('0x9')]=qs['limit'](_0x43d4b8[_0x7995('0x18')][_0x7995('0x9')]);_0x1e1415[_0x7995('0xb')]=qs[_0x7995('0xb')](_0x43d4b8[_0x7995('0x18')]['offset']);}_0x1e1415[_0x7995('0x31')]=qs[_0x7995('0x32')](_0x43d4b8['query']['sort']);_0x1e1415['where']=qs[_0x7995('0x1a')](_[_0x7995('0x33')](_0x43d4b8['query'],_0x37a7d4[_0x7995('0x1a')]),_0x54c9ae);if(_0x43d4b8['query'][_0x7995('0x34')]){_0x1e1415[_0x7995('0x35')]=_[_0x7995('0x36')](_0x1e1415['where'],{'$or':_['map'](_0x54c9ae,function(_0x36d057){if(_0x36d057['type']!=='VIRTUAL'){var _0x3e99cd={};_0x3e99cd[_0x36d057[_0x7995('0x12')]]={'$like':'%'+_0x43d4b8['query'][_0x7995('0x34')]+'%'};return _0x3e99cd;}})});}_0x1e1415=_[_0x7995('0x36')]({},_0x1e1415,_0x43d4b8[_0x7995('0x37')]);var _0x18667c={'where':_0x1e1415[_0x7995('0x35')]};return db['CmHopper'][_0x7995('0xa')](_0x18667c)[_0x7995('0xe')](function(_0xf612e6){_0x4faa60[_0x7995('0xa')]=_0xf612e6;if(_0x43d4b8['query'][_0x7995('0x38')]){_0x1e1415[_0x7995('0x39')]=[{'all':!![]}];}return db[_0x7995('0x3a')][_0x7995('0x3b')](_0x1e1415);})[_0x7995('0xe')](function(_0x1035dc){_0x4faa60['rows']=_0x1035dc;return _0x4faa60;})[_0x7995('0xe')](respondWithFilteredResult(_0x291317,_0x1e1415))[_0x7995('0x3c')](handleError(_0x291317,null));};exports[_0x7995('0x3d')]=function(_0x2ea47f,_0x2e04cd){var _0x298fc2={'raw':!![],'where':{'id':_0x2ea47f[_0x7995('0x3e')]['id']}},_0x14d638={};_0x14d638[_0x7995('0x2f')]=_[_0x7995('0x19')](db[_0x7995('0x3a')][_0x7995('0x3f')]);_0x14d638[_0x7995('0x18')]=_['keys'](_0x2ea47f['query']);_0x14d638[_0x7995('0x1a')]=_[_0x7995('0x1b')](_0x14d638['model'],_0x14d638['query']);_0x298fc2[_0x7995('0x2e')]=_['intersection'](_0x14d638['model'],qs[_0x7995('0x40')](_0x2ea47f[_0x7995('0x18')][_0x7995('0x40')]));_0x298fc2['attributes']=_0x298fc2[_0x7995('0x2e')]['length']?_0x298fc2[_0x7995('0x2e')]:_0x14d638['model'];if(_0x2ea47f['query'][_0x7995('0x38')]){_0x298fc2[_0x7995('0x39')]=[{'all':!![]}];}_0x298fc2=_[_0x7995('0x36')]({},_0x298fc2,_0x2ea47f[_0x7995('0x37')]);return db['CmHopper'][_0x7995('0x41')](_0x298fc2)[_0x7995('0xe')](handleEntityNotFound(_0x2e04cd,null))[_0x7995('0xe')](respondWithResult(_0x2e04cd,null))[_0x7995('0x3c')](handleError(_0x2e04cd,null));};exports['create']=function(_0x5f28e7,_0x1c37c6){return db['CmHopper'][_0x7995('0x42')](_0x5f28e7['body'],{})[_0x7995('0xe')](respondWithResult(_0x1c37c6,0xc9))['catch'](handleError(_0x1c37c6,null));};exports[_0x7995('0xd')]=function(_0x1b0373,_0x4d9245){if(_0x1b0373[_0x7995('0x43')]['id']){delete _0x1b0373[_0x7995('0x43')]['id'];}return db[_0x7995('0x3a')][_0x7995('0x41')]({'where':{'id':_0x1b0373['params']['id']}})[_0x7995('0xe')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0xe')](saveUpdates(_0x1b0373[_0x7995('0x43')],null))['then'](respondWithResult(_0x4d9245,null))[_0x7995('0x3c')](handleError(_0x4d9245,null));};exports[_0x7995('0x44')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x3a')]['describe']()[_0x7995('0xe')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x3c')](handleError(_0x3d8ae3,null));};exports['destroy']=function(_0x3d1dbb,_0x5843ba){var _0x1d87f9;var _0x187735=_0x3d1dbb[_0x7995('0x3e')]['id'];return db[_0x7995('0x3a')][_0x7995('0x41')]({'where':{'id':_0x3d1dbb[_0x7995('0x3e')]['id']}})[_0x7995('0xe')](handleEntityNotFound(_0x5843ba,null))['then'](function(_0x427dcf){if(_0x427dcf){return _0x427dcf[_0x7995('0x45')]()[_0x7995('0xe')](function(_0x4ffc8a){return _0x4ffc8a;});}})[_0x7995('0xe')](function(_0x1fe77e){_0x1d87f9=_0x1fe77e;if(_0x1fe77e){if(_0x1fe77e[_0x7995('0x46')]||_0x1fe77e['CampaignId']){return db[_0x1fe77e['VoiceQueueId']?'VoiceQueue':_0x7995('0x47')][_0x7995('0x41')]({'where':{'id':_0x1fe77e['VoiceQueueId']?_0x1fe77e[_0x7995('0x46')]:_0x1fe77e[_0x7995('0x48')]},'attributes':['id',_0x7995('0x12')],'raw':!![]});}}})[_0x7995('0xe')](function(_0xc04004){var _0x528c8e={};if(_0xc04004){_[_0x7995('0x36')](_0x528c8e,_['omit'](_0x1d87f9[_0x7995('0x49')],[_0x7995('0x4a'),_0x7995('0x4b'),'id']));_0x528c8e['state']=0x15;_0x528c8e['statedesc']='deleted';_0x528c8e['campaign']=_0xc04004[_0x7995('0x12')];_0x528c8e[_0x7995('0x4c')]=_0x3d1dbb[_0x7995('0x4d')][_0x7995('0x12')];_0x528c8e[_0x7995('0x4e')]=_0x3d1dbb[_0x7995('0x4d')]['id'];_0x528c8e[_0x7995('0x4f')]=!![];_0x528c8e[_0x7995('0x50')]=moment()[_0x7995('0x51')](_0x7995('0x52'));_0x528c8e[_0x7995('0x53')]=_0x1d87f9[_0x7995('0x54')];_0x528c8e[_0x7995('0x55')]=_0x1d87f9[_0x7995('0x46')]?_0x7995('0x56'):_0x7995('0x57');return db[_0x7995('0x58')][_0x7995('0x41')]({'where':{'id':_0x528c8e[_0x7995('0x59')]},'attributes':['firstName',_0x7995('0x5a')]})[_0x7995('0xe')](function(_0x3b8a54){if(!_[_0x7995('0x5b')](_0x5843ba)&&!_['isNil'](_0x3b8a54['firstName'])){_0x528c8e[_0x7995('0x5c')]=_0x3b8a54[_0x7995('0x5d')];if(!_[_0x7995('0x5b')](_0x3b8a54[_0x7995('0x5a')])){_0x528c8e['calleridname']+='\x20'+_0x3b8a54[_0x7995('0x5a')];}}})[_0x7995('0x5e')](function(){return db[_0x7995('0x5f')][_0x7995('0x42')](_0x528c8e);});}})['then'](function(_0x5e2d97){return db[_0x7995('0x60')][_0x7995('0x45')]({'where':{'CmHopperId':_0x187735}});})[_0x7995('0xe')](function(){return _0x5843ba[_0x7995('0x6')](0xcc)[_0x7995('0x61')]();})[_0x7995('0x3c')](handleError(_0x5843ba,null));};exports[_0x7995('0x62')]=function(_0x1e2206,_0x984c23){var _0x50caf5=[];return db[_0x7995('0x58')][_0x7995('0x44')]()[_0x7995('0xe')](function(_0x1ecfdb){_0x50caf5=_['keys'](_0x1ecfdb);return _0x1e2206['user'][_0x7995('0x63')]({'where':{'type':_0x7995('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x7995('0x65'),_0x7995('0x66')],'raw':!![]});})[_0x7995('0xe')](function(_0x57727e){if(_0x57727e&&_0x57727e[_0x7995('0x30')]){return db['sequelize'][_0x7995('0x67')](function(_0x564fca){var _0x3e0a46={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7995('0x51')](_0x7995('0x52'))},'VoiceQueueId':{'$in':_[_0x7995('0x15')](_0x57727e,'id')},'$or':[{'UserId':null},{'UserId':_0x1e2206[_0x7995('0x4d')]['id']}]};var _0xeb8920={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x57727e)[_0x7995('0x34')]([_0x7995('0x66'),0x0])[_0x7995('0x15')]('id')[_0x7995('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x1e2206[_0x7995('0x4d')]['id']}]};var _0x234d8d={'$or':[_0x3e0a46,_0xeb8920]};var _0x56eb85=[];if(_0x1e2206[_0x7995('0x43')][_0x7995('0x69')]&&_0x1e2206[_0x7995('0x43')][_0x7995('0x69')]===_0x7995('0x6a')){if(!_['isEmpty'](_0x1e2206['body'][_0x7995('0x6b')])){_0x234d8d['id']={'$in':_0x1e2206[_0x7995('0x43')][_0x7995('0x6b')]};}_0x56eb85=[[_0x7995('0x6c'),'ASC'],[_0x7995('0x6d'),_0x57727e[0x0]['dialOrderByScheduledAt']==='ASC'?_0x7995('0x6e'):_0x7995('0x6f')],db[_0x7995('0x70')][_0x7995('0x71')](_0x7995('0x72')),['id',_0x7995('0x6e')]];}else{if(!_[_0x7995('0x73')](_0x1e2206[_0x7995('0x43')][_0x7995('0x6b')])){_0x234d8d['id']={'$notIn':_0x1e2206[_0x7995('0x43')]['hopperIds']};}_0x56eb85=[[_0x7995('0x6c'),_0x7995('0x6e')],[_0x7995('0x6d'),_0x57727e[0x0]['dialOrderByScheduledAt']],db[_0x7995('0x70')][_0x7995('0x71')](_0x7995('0x74')),['id',_0x7995('0x6f')]];}return db[_0x7995('0x3a')][_0x7995('0x75')]({'attributes':['id',_0x7995('0x76'),_0x7995('0x54'),_0x7995('0x77')],'where':_0x234d8d,'order':_0x56eb85,'transaction':_0x564fca,'lock':_0x564fca[_0x7995('0x78')][_0x7995('0x79')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x50caf5,'include':[{'model':db[_0x7995('0x7a')],'as':_0x7995('0x7b'),'attributes':['id',_0x7995('0x12')]}]},{'model':db[_0x7995('0x7c')],'as':'List','attributes':['id',_0x7995('0x12')]},{'model':db[_0x7995('0x7d')],'as':'Queue','attributes':['id','name',_0x7995('0x7e')]}]})[_0x7995('0xe')](function(_0x555277){if(_0x555277){return _0x555277[_0x7995('0xd')]({'UserId':_0x1e2206['user']['id']},{'transaction':_0x564fca});}});});}})[_0x7995('0xe')](handleEntityNotFound(_0x984c23,null))[_0x7995('0xe')](respondWithResult(_0x984c23,null))['catch'](handleError(_0x984c23,null));};exports['getPreviewRecall']=function(_0x1f01c0,_0x50c1a4,_0x31b9e6){var _0xa41fff=[];var _0x3dd197=_0x1f01c0[_0x7995('0x3e')]['id'];var _0x1a1873=_0x1f01c0[_0x7995('0x4d')]['id'];return db[_0x7995('0x58')][_0x7995('0x44')]()[_0x7995('0xe')](function(_0x117317){_0xa41fff=_[_0x7995('0x19')](_0x117317);return db[_0x7995('0x70')][_0x7995('0x67')](function(_0x1ff436){const _0x36e3a7={'id':_0x3dd197};return db[_0x7995('0x3a')][_0x7995('0x75')]({'attributes':['id',_0x7995('0x76'),_0x7995('0x77')],'where':_0x36e3a7,'transaction':_0x1ff436,'lock':_0x1ff436[_0x7995('0x78')][_0x7995('0x79')],'include':[{'model':db[_0x7995('0x58')],'as':_0x7995('0x7f'),'attributes':_0xa41fff,'include':[{'model':db[_0x7995('0x7a')],'as':_0x7995('0x7b'),'attributes':['id',_0x7995('0x12')]}]},{'model':db[_0x7995('0x7c')],'as':_0x7995('0x80'),'attributes':['id','name']},{'model':db[_0x7995('0x7d')],'as':_0x7995('0x81'),'attributes':['id','name','dialActive']}]})[_0x7995('0xe')](function(_0x3fe8fc){if(_0x3fe8fc){return _0x3fe8fc[_0x7995('0xd')]({'UserId':_0x1a1873},{'transaction':_0x1ff436});}});});})[_0x7995('0xe')](handleEntityNotFound(_0x50c1a4,null))[_0x7995('0xe')](respondWithResult(_0x50c1a4,null))[_0x7995('0x3c')](handleError(_0x50c1a4,null));};exports['getOpenContacts']=function(_0x2f8a2d,_0xb68962){return _0x2f8a2d[_0x7995('0x4d')][_0x7995('0x63')]({'where':{'type':_0x7995('0x64'),'dialActive':!![],'dialMethod':_0x7995('0x82')},'attributes':['id'],'raw':!![]})[_0x7995('0xe')](function(_0xc93dcb){if(_0xc93dcb&&_0xc93dcb['length']){return db[_0x7995('0x3a')][_0x7995('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7995('0x15')](_0xc93dcb,'id')},'$or':[{'UserId':null},{'UserId':_0x2f8a2d[_0x7995('0x4d')]['id']}]}});}return 0x0;})[_0x7995('0xe')](function(_0x3db7a9){if(!_[_0x7995('0x5b')](_0x3db7a9)&&_['isNumber'](_0x3db7a9)){return _0xb68962[_0x7995('0x6')](0xc8)[_0x7995('0x7')]({'contacts':_0x3db7a9});}else{logger['error'](_0x7995('0x83'),_0x7995('0x84'),0x194,'entity\x20not\x20found');_0xb68962[_0x7995('0xf')](0x194);}})['catch'](handleError(_0xb68962,null));};exports[_0x7995('0x85')]=function(_0x2322bf,_0x3ab421){var _0x428a1b=shared[_0x7995('0x86')];var _0x5d16da=[];_[_0x7995('0x15')](_0x428a1b,function(_0x345080){_0x5d16da[_0x7995('0x87')]({'id':_0x345080['name'],'name':_0x345080[_0x7995('0x12')],'utcOffset':_0x345080[_0x7995('0x88')]});});return _0x3ab421[_0x7995('0x6')](0xc8)[_0x7995('0x7')]({'tz':_0x5d16da});};exports['getTimezone']=function(_0x3356fd,_0xf59a39){var _0x3a5f5e=shared['timezones'];var _0x5358d4={};if(!_[_0x7995('0x5b')](_0x3a5f5e[_0x3356fd[_0x7995('0x43')]['id']]))_0x5358d4=_0x3a5f5e[_0x3356fd['body']['id']];return _0xf59a39['status'](0xc8)[_0x7995('0x7')](_0x5358d4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 42a68e6..977ed9e 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 _0xeda8=['exports','define','cm_hopper','scheduledat','phone','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x150b05,_0x4b83a2){var _0x10570d=function(_0x18b9a8){while(--_0x18b9a8){_0x150b05['push'](_0x150b05['shift']());}};_0x10570d(++_0x4b83a2);}(_0xeda8,0x104));var _0x8eda=function(_0x3bd74a,_0x348397){_0x3bd74a=_0x3bd74a-0x0;var _0x480fb2=_0xeda8[_0x3bd74a];return _0x480fb2;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('CmHopper',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('0xd')]},{'name':_0x8eda('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x10445d,_0x416fc6){var _0x178880=function(_0x36b757){while(--_0x36b757){_0x10445d['push'](_0x10445d['shift']());}};_0x178880(++_0x416fc6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 52c0b88..f0ce9f5 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 _0xea5e=['LOCK','UPDATE','keys','Agent','name','voicePause','length','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','create','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','CmList','lodash','util','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','find','where','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xea5e,0x10a));var _0xeea5=function(_0x543728,_0x564488){_0x543728=_0x543728-0x0;var _0x2a3ece=_0xea5e[_0x543728];return _0x2a3ece;};'use strict';var _=require(_0xeea5('0x0'));var util=require(_0xeea5('0x1'));var moment=require('moment');var BPromise=require(_0xeea5('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xeea5('0x3'))(_0xeea5('0x4'));exports[_0xeea5('0x5')]=function(_0x1a5139){var _0x302c56=this;return new Promise(function(_0x2dae7f,_0x16470d){return db[_0xeea5('0x6')][_0xeea5('0x7')]({'raw':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'where':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')]['where']||null:null,'attributes':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0xa')]||null:null,'limit':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0xb')]||null:null,'include':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x1a5139['options'][_0xeea5('0xc')],function(_0x1cfff0){return{'model':db[_0x1cfff0[_0xeea5('0xe')]],'as':_0x1cfff0['as'],'attributes':_0x1cfff0['attributes'],'include':_0x1cfff0[_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x1cfff0['include'],function(_0x5439b8){return{'model':db[_0x5439b8['model']],'as':_0x5439b8['as'],'attributes':_0x5439b8[_0xeea5('0xa')],'include':_0x5439b8[_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x5439b8['include'],function(_0x17e5f4){return{'model':db[_0x17e5f4[_0xeea5('0xe')]],'as':_0x17e5f4['as'],'attributes':_0x17e5f4[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeea5('0xf')](function(_0xb4f018){logger[_0xeea5('0x10')](_0xeea5('0x5'),_0x1a5139);logger[_0xeea5('0x11')](_0xeea5('0x5'),_0x1a5139,JSON[_0xeea5('0x12')](_0xb4f018));_0x2dae7f(_0xb4f018);})[_0xeea5('0x13')](function(_0x420798){logger[_0xeea5('0x14')](_0xeea5('0x5'),_0x420798['message'],_0x1a5139);_0x16470d(_0x302c56['error'](0x1f4,_0x420798[_0xeea5('0x15')]));});});};exports['ShowCmHopper']=function(_0x157da3){var _0x3a796d=this;return new Promise(function(_0x3ff74c,_0x3a17dc){return db['CmHopper'][_0xeea5('0x16')]({'raw':_0x157da3[_0xeea5('0x8')]?_0x157da3[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'where':_0x157da3[_0xeea5('0x8')]?_0x157da3[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x157da3[_0xeea5('0x8')]?_0x157da3['options'][_0xeea5('0xa')]||null:null,'include':_0x157da3[_0xeea5('0x8')]?_0x157da3[_0xeea5('0x8')]['include']?_[_0xeea5('0xd')](_0x157da3[_0xeea5('0x8')]['include'],function(_0x121696){return{'model':db[_0x121696[_0xeea5('0xe')]],'as':_0x121696['as'],'attributes':_0x121696[_0xeea5('0xa')],'include':_0x121696['include']?_[_0xeea5('0xd')](_0x121696['include'],function(_0x3c9200){return{'model':db[_0x3c9200[_0xeea5('0xe')]],'as':_0x3c9200['as'],'attributes':_0x3c9200['attributes'],'include':_0x3c9200['include']?_[_0xeea5('0xd')](_0x3c9200[_0xeea5('0xc')],function(_0x48e1ec){return{'model':db[_0x48e1ec['model']],'as':_0x48e1ec['as'],'attributes':_0x48e1ec[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4339){logger[_0xeea5('0x10')](_0xeea5('0x18'),_0x157da3);logger[_0xeea5('0x11')]('ShowCmHopper',_0x157da3,JSON[_0xeea5('0x12')](_0x1b4339));_0x3ff74c(_0x1b4339);})[_0xeea5('0x13')](function(_0x373c2f){logger[_0xeea5('0x14')](_0xeea5('0x18'),_0x373c2f[_0xeea5('0x15')],_0x157da3);_0x3a17dc(_0x3a796d[_0xeea5('0x14')](0x1f4,_0x373c2f[_0xeea5('0x15')]));});});};exports[_0xeea5('0x19')]=function(_0x322407){var _0x503fee=this;return new Promise(function(_0x24e897,_0x1f078c){return db['CmHopper']['create'](_0x322407[_0xeea5('0x1a')],{'raw':_0x322407[_0xeea5('0x8')]?_0x322407[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![]})[_0xeea5('0xf')](function(_0x65e1d7){logger[_0xeea5('0x10')]('CreateCmHopper',_0x322407);logger['debug'](_0xeea5('0x19'),_0x322407,JSON[_0xeea5('0x12')](_0x65e1d7));_0x24e897(_0x65e1d7);})[_0xeea5('0x13')](function(_0x478ba4){logger[_0xeea5('0x14')](_0xeea5('0x19'),_0x478ba4[_0xeea5('0x15')],_0x322407);_0x1f078c(_0x503fee[_0xeea5('0x14')](0x1f4,_0x478ba4['message']));});});};exports[_0xeea5('0x1b')]=function(_0x1698ea){var _0x45413a=this;return new Promise(function(_0x2faafa,_0x1d4e44){return db[_0xeea5('0x6')][_0xeea5('0x1c')](_0x1698ea[_0xeea5('0x1a')],{'raw':_0x1698ea['options']?_0x1698ea[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1698ea[_0xeea5('0x8')]?_0x1698ea[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x1698ea[_0xeea5('0x8')]?_0x1698ea['options']['attributes']||null:null,'limit':_0x1698ea[_0xeea5('0x8')]?_0x1698ea['options'][_0xeea5('0xb')]||null:null})[_0xeea5('0xf')](function(_0x50d9e1){logger[_0xeea5('0x10')](_0xeea5('0x1b'),_0x1698ea);logger[_0xeea5('0x10')](_0xeea5('0x1d'),JSON['stringify'](_0x1698ea[_0xeea5('0x8')][_0xeea5('0x17')]),_0x1698ea[_0xeea5('0x1a')][_0xeea5('0x1e')]);logger[_0xeea5('0x11')](_0xeea5('0x1b'),_0x1698ea,JSON[_0xeea5('0x12')](_0x50d9e1));_0x2faafa(_0x50d9e1);})[_0xeea5('0x13')](function(_0x5c8bf9){logger[_0xeea5('0x14')]('UpdateCmHopper',_0x5c8bf9[_0xeea5('0x15')],_0x1698ea);_0x1d4e44(_0x45413a[_0xeea5('0x14')](0x1f4,_0x5c8bf9[_0xeea5('0x15')]));});});};exports['DestroyCmHopper']=function(_0x98ed9e){var _0xfa9d88=this;return new Promise(function(_0x3dd2ba,_0x57d640){return db[_0xeea5('0x6')][_0xeea5('0x1f')]({'where':_0x98ed9e['options']?_0x98ed9e[_0xeea5('0x8')][_0xeea5('0x17')]||null:null})[_0xeea5('0xf')](function(_0x3bd28f){logger[_0xeea5('0x10')](_0xeea5('0x20'),_0x98ed9e);logger[_0xeea5('0x11')]('DestroyCmHopper',_0x98ed9e,JSON[_0xeea5('0x12')](_0x3bd28f));_0x3dd2ba(_0x3bd28f);})[_0xeea5('0x13')](function(_0x55ec70){logger[_0xeea5('0x14')](_0xeea5('0x20'),_0x55ec70[_0xeea5('0x15')],_0x98ed9e);_0x57d640(_0xfa9d88[_0xeea5('0x14')](0x1f4,_0x55ec70[_0xeea5('0x15')]));});});};exports[_0xeea5('0x21')]=function(_0x6fe2f6){var _0x2d1b25=this;return new Promise(function(_0x5ea60d,_0x1d6990){return db[_0xeea5('0x22')][_0xeea5('0x23')]()['then'](function(_0x51eecf){return db[_0xeea5('0x24')]['transaction'](function(_0x32a085){return db['CmHopper']['findAll']({'where':_0x6fe2f6['options']?_0x6fe2f6[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x6fe2f6['options']?_0x6fe2f6[_0xeea5('0x8')]['attributes']||null:null,'limit':_0x6fe2f6[_0xeea5('0x8')]?_0x6fe2f6[_0xeea5('0x8')][_0xeea5('0xb')]||null:null,'order':_0x6fe2f6['options']?_0x6fe2f6[_0xeea5('0x8')][_0xeea5('0x25')]||null:null,'transaction':_0x32a085,'lock':_0x32a085[_0xeea5('0x26')][_0xeea5('0x27')],'include':[{'model':db[_0xeea5('0x22')],'as':'Contact','attributes':_[_0xeea5('0x28')](_0x51eecf)},{'model':db['User'],'as':_0xeea5('0x29'),'attributes':['id',_0xeea5('0x2a'),_0xeea5('0x2b')]}]})['then'](function(_0x116277){var _0x2b211f=[];var _0x4d40de=[];for(var _0x3fa8ff=0x0;_0x3fa8ff<_0x116277[_0xeea5('0x2c')];_0x3fa8ff+=0x1){var _0x2d0ee5=_0x116277[_0x3fa8ff][_0xeea5('0x2d')];if(_0x2d0ee5===null){_0x2b211f['push'](_0x116277[_0x3fa8ff]['update'](_0x6fe2f6[_0xeea5('0x1a')],{'transaction':_0x32a085}));}else if(!_0x4d40de[_0xeea5('0x2e')](_0x2d0ee5)){_0x4d40de[_0xeea5('0x2f')](_0x2d0ee5);_0x2b211f[_0xeea5('0x2f')](_0x116277[_0x3fa8ff][_0xeea5('0x1c')](_0x6fe2f6['body'],{'transaction':_0x32a085}));}}return BPromise[_0xeea5('0x30')](_0x2b211f);});})[_0xeea5('0xf')](function(_0x1fdad4){logger[_0xeea5('0x10')](_0xeea5('0x21'),_0x6fe2f6);if(_0x1fdad4[_0xeea5('0x2c')]>0x0){logger['info'](_0xeea5('0x31'),_0x1fdad4[0x0][_0xeea5('0x32')]['id'],_0x1fdad4[0x0]['dataValues'][_0xeea5('0x33')],_0x1fdad4[0x0]['dataValues'][_0xeea5('0x1e')]);}logger['debug']('GetContactDialer',_0x6fe2f6,JSON[_0xeea5('0x12')](_0x1fdad4));_0x5ea60d(_0x1fdad4);})['catch'](function(_0xe0a69d){logger[_0xeea5('0x14')](_0xeea5('0x21'),_0xe0a69d['message'],_0x6fe2f6);_0x1d6990(_0x2d1b25[_0xeea5('0x14')](0x1f4,_0xe0a69d[_0xeea5('0x15')]));});});});};exports[_0xeea5('0x34')]=function(_0x45c08a){var _0x2e705c=this;return new Promise(function(_0x25e91a,_0x5e2d92){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x2e531e){return db['CmHopperFinal'][_0xeea5('0x36')](_0x45c08a[_0xeea5('0x1a')],{'raw':_0x45c08a['options']?_0x45c08a[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'transaction':_0x2e531e})[_0xeea5('0xf')](function(){logger[_0xeea5('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x45c08a[_0xeea5('0x8')][_0xeea5('0x17')]),_0x45c08a[_0xeea5('0x8')]['where'][_0xeea5('0x1e')]);return db[_0xeea5('0x6')]['destroy']({'where':_0x45c08a['options']?_0x45c08a['options']['where']||null:null,'transaction':_0x2e531e});});})['then'](function(_0x7b3e9e){logger[_0xeea5('0x10')](_0xeea5('0x34'),_0x45c08a);logger['debug'](_0xeea5('0x34'),_0x45c08a,JSON[_0xeea5('0x12')](_0x7b3e9e));_0x25e91a(_0x7b3e9e);})[_0xeea5('0x13')](function(_0x3e0c79){logger['error'](_0xeea5('0x34'),_0x3e0c79[_0xeea5('0x15')],_0x45c08a);_0x5e2d92(_0x2e705c[_0xeea5('0x14')](0x1f4,_0x3e0c79[_0xeea5('0x15')]));});});};exports[_0xeea5('0x37')]=function(_0x8df591){var _0x283245=this;return new Promise(function(_0x4a0d1f,_0x4a348b){return db[_0xeea5('0x6')][_0xeea5('0x7')]({'raw':_0x8df591[_0xeea5('0x8')]?_0x8df591[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'where':_0x8df591['options']?_0x8df591[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':[[db[_0xeea5('0x24')]['fn']('COUNT',db[_0xeea5('0x24')]['fn']('IF',db[_0xeea5('0x24')][_0xeea5('0x38')](_0xeea5('0x39')+util['format'](_0xeea5('0x3a'),moment()['format'](_0xeea5('0x3b')))+'\x20,\x201,\x20null'))),_0xeea5('0x3c')]]})['then'](function(_0x28b184){logger[_0xeea5('0x10')](_0xeea5('0x37'),_0x8df591);logger[_0xeea5('0x11')](_0xeea5('0x37'),_0x8df591,JSON[_0xeea5('0x12')](_0x28b184));_0x4a0d1f(_0x28b184);})[_0xeea5('0x13')](function(_0x57e655){logger[_0xeea5('0x14')](_0xeea5('0x37'),_0x57e655['message'],_0x8df591);_0x4a348b(_0x283245[_0xeea5('0x14')](0x1f4,_0x57e655[_0xeea5('0x15')]));});});};exports[_0xeea5('0x3d')]=function(_0x49d871){var _0x1d93b1=this;return new Promise(function(_0x464322,_0x5ea2cb){return db['CmContact'][_0xeea5('0x23')]()[_0xeea5('0xf')](function(){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x1887b4){return db[_0xeea5('0x6')]['findAll']({'where':_0x49d871[_0xeea5('0x8')]?_0x49d871['options']['where']||null:null,'attributes':_0x49d871[_0xeea5('0x8')]?_0x49d871[_0xeea5('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x49d871['options']?_0x49d871['options'][_0xeea5('0x25')]||null:null,'group':db[_0xeea5('0x6')][_0xeea5('0x2d')],'transaction':_0x1887b4,'lock':_0x1887b4[_0xeea5('0x26')][_0xeea5('0x27')],'include':_0x49d871['options']?_0x49d871['options'][_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x49d871[_0xeea5('0x8')][_0xeea5('0xc')],function(_0x5451ed){return{'model':db[_0x5451ed[_0xeea5('0xe')]],'as':_0x5451ed['as'],'attributes':_0x5451ed[_0xeea5('0xa')],'include':_0x5451ed['include']?_[_0xeea5('0xd')](_0x5451ed[_0xeea5('0xc')],function(_0x1dc021){return{'model':db[_0x1dc021['model']],'as':_0x1dc021['as'],'attributes':_0x1dc021[_0xeea5('0xa')],'include':_0x1dc021[_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x1dc021[_0xeea5('0xc')],function(_0x479cee){return{'model':db[_0x479cee[_0xeea5('0xe')]],'as':_0x479cee['as'],'attributes':_0x479cee[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeea5('0xf')](function(_0x1244a8){var _0x3569bb=[];for(var _0x46a23b=0x0;_0x46a23b<_0x1244a8[_0xeea5('0x2c')];_0x46a23b+=0x1){_0x3569bb[_0xeea5('0x2f')](_0x1244a8[_0x46a23b][_0xeea5('0x1c')](_0x49d871[_0xeea5('0x1a')],{'transaction':_0x1887b4}));}return BPromise[_0xeea5('0x30')](_0x3569bb);});})[_0xeea5('0xf')](function(_0x412eb8){logger[_0xeea5('0x10')](_0xeea5('0x3d'),_0x49d871);logger['debug'](_0xeea5('0x3d'),_0x49d871,JSON[_0xeea5('0x12')](_0x412eb8));_0x464322(_0x412eb8);})['catch'](function(_0x46fd54){logger[_0xeea5('0x14')]('GetContactRecallMe',_0x46fd54[_0xeea5('0x15')],_0x49d871);_0x5ea2cb(_0x1d93b1['error'](0x1f4,_0x46fd54[_0xeea5('0x15')]));});});});};exports[_0xeea5('0x3e')]=function(_0x52fa99){var _0x166299=this;return new Promise(function(_0x4d9580,_0xbb991d){db[_0xeea5('0x22')][_0xeea5('0x23')]()[_0xeea5('0xf')](function(_0xae86e4){return db[_0xeea5('0x6')][_0xeea5('0x7')]({'raw':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x52fa99['options']?_0x52fa99['options'][_0xeea5('0xa')]||null:null,'limit':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')][_0xeea5('0xb')]||null:null,'include':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')][_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x52fa99['options'][_0xeea5('0xc')],function(_0x56f775){return{'model':db[_0x56f775[_0xeea5('0xe')]],'as':_0x56f775['as'],'attributes':_0x56f775['as']==='Contact'?_[_0xeea5('0x28')](_0xae86e4):_0x56f775['attributes'],'include':_0x56f775['include']?_[_0xeea5('0xd')](_0x56f775[_0xeea5('0xc')],function(_0x3de056){return{'model':db[_0x3de056[_0xeea5('0xe')]],'as':_0x3de056['as'],'attributes':_0x3de056[_0xeea5('0xa')],'include':_0x3de056['include']?_[_0xeea5('0xd')](_0x3de056['include'],function(_0x2154b7){return{'model':db[_0x2154b7[_0xeea5('0xe')]],'as':_0x2154b7['as'],'attributes':_0x2154b7[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeea5('0xf')](function(_0x2aa3f5){logger[_0xeea5('0x10')](_0xeea5('0x5'),_0x52fa99);logger[_0xeea5('0x11')](_0xeea5('0x5'),_0x52fa99,JSON['stringify'](_0x2aa3f5));_0x4d9580(_0x2aa3f5);})[_0xeea5('0x13')](function(_0x447c84){logger[_0xeea5('0x14')](_0xeea5('0x5'),_0x447c84['message'],_0x52fa99);_0xbb991d(_0x166299[_0xeea5('0x14')](0x1f4,_0x447c84['message']));});});});};exports[_0xeea5('0x3f')]=function(_0x3117d1){var _0x17f648=this;return new Promise(function(_0x232914,_0x15ccfb){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x3117d1[_0xeea5('0x8')][_0xeea5('0x17')]['phone']},'attributes':['id',_0xeea5('0x40')],'order':[['id',_0xeea5('0x41')]]})[_0xeea5('0xf')](function(_0x48ca02){logger[_0xeea5('0x10')]('getContactByPhone',_0x3117d1);logger[_0xeea5('0x11')](_0xeea5('0x42'),_0x3117d1,JSON['stringify'](_0x48ca02));_0x232914(_0x48ca02);})[_0xeea5('0x13')](function(_0x1a4707){logger[_0xeea5('0x14')](_0xeea5('0x42'),_0x1a4707['message'],_0x3117d1);_0x15ccfb(_0x17f648['error'](0x1f4,_0x1a4707[_0xeea5('0x15')]));});});};exports[_0xeea5('0x43')]=function(_0x218503){var _0x10007d=this;return new Promise(function(_0x274fef,_0x2aaaa2){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x47c5e6){var _0x7ca4f1=_0x218503[_0xeea5('0x8')]&&_0x218503['options'][_0xeea5('0x17')]?_0x218503['options'][_0xeea5('0x17')]:{};return db['CmHopper'][_0xeea5('0x1c')](_0x218503[_0xeea5('0x1a')],{'where':_0x7ca4f1,'transaction':_0x47c5e6})[_0xeea5('0xf')](function(_0x40f88b){logger['info'](_0xeea5('0x43'),_0x218503);logger['debug'](_0xeea5('0x43'),_0x218503,JSON[_0xeea5('0x12')](_0x40f88b));_0x274fef(_0x40f88b);})[_0xeea5('0x13')](function(_0x3f8acb){logger[_0xeea5('0x14')](_0xeea5('0x43'),_0x3f8acb[_0xeea5('0x15')],_0x218503);_0x2aaaa2(_0x10007d[_0xeea5('0x14')](0x1f4,_0x3f8acb[_0xeea5('0x15')]));});});});};exports[_0xeea5('0x44')]=function(_0x21f40c){var _0x1234ee=this;var _0x46748a=_0x21f40c[_0xeea5('0x1a')][_0xeea5('0x17')][_0xeea5('0x45')];var _0x203159=_0x21f40c[_0xeea5('0x1a')]['where'][_0xeea5('0x46')];var _0x37f7f4=_0x21f40c[_0xeea5('0x1a')][_0xeea5('0x17')]['availableAgentsIds'];return new Promise(function(_0x10c8a6,_0x416f93){return db['CmHopper'][_0xeea5('0x7')]({'where':{'voiceQueueId':{'$in':_0x46748a},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xeea5('0x24')][_0xeea5('0x38')](_0xeea5('0x47')+_0x203159+_0xeea5('0x48')),'$gt':db[_0xeea5('0x24')]['literal'](_0xeea5('0x49'))}},'UserId':{'$in':_0x37f7f4}},'include':[{'model':db[_0xeea5('0x22')],'as':_0xeea5('0x4a')},{'model':db['User'],'as':_0xeea5('0x29'),'attributes':['id',_0xeea5('0x2a'),_0xeea5('0x2b')]},{'model':db[_0xeea5('0x4b')],'as':'List'}]})['then'](function(_0xd3f18e){if(_0xd3f18e[_0xeea5('0x2c')]>0x0){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x4be2ef){return db[_0xeea5('0x6')][_0xeea5('0x1c')]({'recallmeNotifiedDate':db[_0xeea5('0x24')]['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0xd3f18e,'id')}},'transaction':_0x4be2ef})[_0xeea5('0xf')](function(){_0x10c8a6(_0xd3f18e);})[_0xeea5('0x13')](function(_0x5649f7){logger['error'](_0xeea5('0x44'),_0x5649f7[_0xeea5('0x15')],_0x21f40c);_0x416f93(_0x1234ee['error'](0x1f4,_0x5649f7[_0xeea5('0x15')]));});})['catch'](function(_0x20ddea){logger[_0xeea5('0x14')](_0xeea5('0x44'),_0x20ddea[_0xeea5('0x15')],_0x21f40c);_0x416f93(_0x1234ee[_0xeea5('0x14')](0x1f4,_0x20ddea[_0xeea5('0x15')]));});}else{_0x10c8a6(_0xd3f18e);}});});}; \ No newline at end of file +var _0x1633=['push','includes','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','describe','UPDATE','all','Contact','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','Agent','name','List','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','rpc','CmHopper','options','raw','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','GetCmHopper','message','where','ShowCmHopper','CreateCmHopper','create','update','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','transaction','findAll','order','LOCK','keys','voicePause','UserId'];(function(_0xedba63,_0x319cd4){var _0x84c5ce=function(_0x65607b){while(--_0x65607b){_0xedba63['push'](_0xedba63['shift']());}};_0x84c5ce(++_0x319cd4);}(_0x1633,0x154));var _0x3163=function(_0x46c3d7,_0x45bf58){_0x46c3d7=_0x46c3d7-0x0;var _0x121592=_0x1633[_0x46c3d7];return _0x121592;};'use strict';var _=require(_0x3163('0x0'));var util=require(_0x3163('0x1'));var moment=require('moment');var BPromise=require(_0x3163('0x2'));var db=require(_0x3163('0x3'))['db'];var logger=require('../../config/logger')(_0x3163('0x4'));exports['GetCmHopper']=function(_0x1dbe79){var _0xfaebaa=this;return new Promise(function(_0x12cbfa,_0x47cece){return db[_0x3163('0x5')]['findAll']({'raw':_0x1dbe79[_0x3163('0x6')]?_0x1dbe79['options'][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x1dbe79['options']?_0x1dbe79[_0x3163('0x6')]['where']||null:null,'attributes':_0x1dbe79[_0x3163('0x6')]?_0x1dbe79[_0x3163('0x6')][_0x3163('0x8')]||null:null,'limit':_0x1dbe79['options']?_0x1dbe79['options'][_0x3163('0x9')]||null:null,'include':_0x1dbe79[_0x3163('0x6')]?_0x1dbe79[_0x3163('0x6')][_0x3163('0xa')]?_['map'](_0x1dbe79[_0x3163('0x6')][_0x3163('0xa')],function(_0x5b1b79){return{'model':db[_0x5b1b79[_0x3163('0xb')]],'as':_0x5b1b79['as'],'attributes':_0x5b1b79['attributes'],'include':_0x5b1b79[_0x3163('0xa')]?_[_0x3163('0xc')](_0x5b1b79[_0x3163('0xa')],function(_0x461ca4){return{'model':db[_0x461ca4[_0x3163('0xb')]],'as':_0x461ca4['as'],'attributes':_0x461ca4['attributes'],'include':_0x461ca4[_0x3163('0xa')]?_[_0x3163('0xc')](_0x461ca4[_0x3163('0xa')],function(_0x506113){return{'model':db[_0x506113['model']],'as':_0x506113['as'],'attributes':_0x506113['attributes']};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x1798aa){logger[_0x3163('0xe')]('GetCmHopper',_0x1dbe79);logger[_0x3163('0xf')]('GetCmHopper',_0x1dbe79,JSON[_0x3163('0x10')](_0x1798aa));_0x12cbfa(_0x1798aa);})[_0x3163('0x11')](function(_0x4cfc0c){logger[_0x3163('0x12')](_0x3163('0x13'),_0x4cfc0c[_0x3163('0x14')],_0x1dbe79);_0x47cece(_0xfaebaa[_0x3163('0x12')](0x1f4,_0x4cfc0c[_0x3163('0x14')]));});});};exports['ShowCmHopper']=function(_0x365ee5){var _0x5adcf6=this;return new Promise(function(_0x29e6bd,_0x5b3f73){return db[_0x3163('0x5')]['find']({'raw':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0x8')]||null:null,'include':_0x365ee5[_0x3163('0x6')]?_0x365ee5[_0x3163('0x6')][_0x3163('0xa')]?_[_0x3163('0xc')](_0x365ee5[_0x3163('0x6')]['include'],function(_0x1c0c80){return{'model':db[_0x1c0c80[_0x3163('0xb')]],'as':_0x1c0c80['as'],'attributes':_0x1c0c80['attributes'],'include':_0x1c0c80[_0x3163('0xa')]?_[_0x3163('0xc')](_0x1c0c80[_0x3163('0xa')],function(_0x56cd71){return{'model':db[_0x56cd71[_0x3163('0xb')]],'as':_0x56cd71['as'],'attributes':_0x56cd71[_0x3163('0x8')],'include':_0x56cd71[_0x3163('0xa')]?_[_0x3163('0xc')](_0x56cd71[_0x3163('0xa')],function(_0x226cff){return{'model':db[_0x226cff[_0x3163('0xb')]],'as':_0x226cff['as'],'attributes':_0x226cff[_0x3163('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x356ac8){logger[_0x3163('0xe')]('ShowCmHopper',_0x365ee5);logger[_0x3163('0xf')](_0x3163('0x16'),_0x365ee5,JSON[_0x3163('0x10')](_0x356ac8));_0x29e6bd(_0x356ac8);})[_0x3163('0x11')](function(_0x553ef2){logger[_0x3163('0x12')](_0x3163('0x16'),_0x553ef2[_0x3163('0x14')],_0x365ee5);_0x5b3f73(_0x5adcf6[_0x3163('0x12')](0x1f4,_0x553ef2['message']));});});};exports[_0x3163('0x17')]=function(_0x1b2a96){var _0x529576=this;return new Promise(function(_0x5864b4,_0x126996){return db[_0x3163('0x5')][_0x3163('0x18')](_0x1b2a96['body'],{'raw':_0x1b2a96[_0x3163('0x6')]?_0x1b2a96[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![]})[_0x3163('0xd')](function(_0x3e9c5b){logger[_0x3163('0xe')](_0x3163('0x17'),_0x1b2a96);logger[_0x3163('0xf')](_0x3163('0x17'),_0x1b2a96,JSON[_0x3163('0x10')](_0x3e9c5b));_0x5864b4(_0x3e9c5b);})[_0x3163('0x11')](function(_0x31c620){logger[_0x3163('0x12')](_0x3163('0x17'),_0x31c620[_0x3163('0x14')],_0x1b2a96);_0x126996(_0x529576['error'](0x1f4,_0x31c620[_0x3163('0x14')]));});});};exports['UpdateCmHopper']=function(_0x24eb1d){var _0x42f5b9=this;return new Promise(function(_0x2bb946,_0x51af4e){return db[_0x3163('0x5')][_0x3163('0x19')](_0x24eb1d[_0x3163('0x1a')],{'raw':_0x24eb1d[_0x3163('0x6')]?_0x24eb1d[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24eb1d['options']?_0x24eb1d[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x24eb1d['options']?_0x24eb1d['options'][_0x3163('0x8')]||null:null,'limit':_0x24eb1d[_0x3163('0x6')]?_0x24eb1d[_0x3163('0x6')][_0x3163('0x9')]||null:null})[_0x3163('0xd')](function(_0x2cacd8){logger['info'](_0x3163('0x1b'),_0x24eb1d);logger['info'](_0x3163('0x1c'),JSON[_0x3163('0x10')](_0x24eb1d[_0x3163('0x6')][_0x3163('0x15')]),_0x24eb1d[_0x3163('0x1a')][_0x3163('0x1d')]);logger['debug']('UpdateCmHopper',_0x24eb1d,JSON[_0x3163('0x10')](_0x2cacd8));_0x2bb946(_0x2cacd8);})['catch'](function(_0x271b97){logger[_0x3163('0x12')]('UpdateCmHopper',_0x271b97[_0x3163('0x14')],_0x24eb1d);_0x51af4e(_0x42f5b9[_0x3163('0x12')](0x1f4,_0x271b97['message']));});});};exports[_0x3163('0x1e')]=function(_0x32684e){var _0x4846db=this;return new Promise(function(_0x31d2d6,_0x31ad8d){return db['CmHopper']['destroy']({'where':_0x32684e['options']?_0x32684e[_0x3163('0x6')]['where']||null:null})[_0x3163('0xd')](function(_0x1d2e6f){logger[_0x3163('0xe')](_0x3163('0x1e'),_0x32684e);logger[_0x3163('0xf')]('DestroyCmHopper',_0x32684e,JSON[_0x3163('0x10')](_0x1d2e6f));_0x31d2d6(_0x1d2e6f);})[_0x3163('0x11')](function(_0x5e232c){logger[_0x3163('0x12')](_0x3163('0x1e'),_0x5e232c[_0x3163('0x14')],_0x32684e);_0x31ad8d(_0x4846db[_0x3163('0x12')](0x1f4,_0x5e232c['message']));});});};exports[_0x3163('0x1f')]=function(_0x5ecfa6){var _0x554a09=this;return new Promise(function(_0xb6407d,_0x11bd1e){return db[_0x3163('0x20')]['describe']()[_0x3163('0xd')](function(_0xad9bbc){return db['sequelize'][_0x3163('0x21')](function(_0x15d6ac){return db[_0x3163('0x5')][_0x3163('0x22')]({'where':_0x5ecfa6['options']?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x5ecfa6['options']?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x8')]||null:null,'limit':_0x5ecfa6[_0x3163('0x6')]?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x9')]||null:null,'order':_0x5ecfa6[_0x3163('0x6')]?_0x5ecfa6[_0x3163('0x6')][_0x3163('0x23')]||null:null,'transaction':_0x15d6ac,'lock':_0x15d6ac[_0x3163('0x24')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x3163('0x25')](_0xad9bbc)},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x3163('0x26')]}]})['then'](function(_0x3d739d){var _0x143dbc=[];var _0x51de46=[];for(var _0x371c39=0x0;_0x371c39<_0x3d739d['length'];_0x371c39+=0x1){var _0x1f1cb0=_0x3d739d[_0x371c39][_0x3163('0x27')];if(_0x1f1cb0===null){_0x143dbc[_0x3163('0x28')](_0x3d739d[_0x371c39][_0x3163('0x19')](_0x5ecfa6[_0x3163('0x1a')],{'transaction':_0x15d6ac}));}else if(!_0x51de46[_0x3163('0x29')](_0x1f1cb0)){_0x51de46[_0x3163('0x28')](_0x1f1cb0);_0x143dbc[_0x3163('0x28')](_0x3d739d[_0x371c39][_0x3163('0x19')](_0x5ecfa6[_0x3163('0x1a')],{'transaction':_0x15d6ac}));}}return BPromise['all'](_0x143dbc);});})['then'](function(_0x5f1c29){logger[_0x3163('0xe')](_0x3163('0x1f'),_0x5ecfa6);if(_0x5f1c29[_0x3163('0x2a')]>0x0){logger[_0x3163('0xe')](_0x3163('0x2b'),_0x5f1c29[0x0][_0x3163('0x2c')]['id'],_0x5f1c29[0x0]['dataValues']['ContactId'],_0x5f1c29[0x0][_0x3163('0x2c')][_0x3163('0x1d')]);}logger[_0x3163('0xf')](_0x3163('0x1f'),_0x5ecfa6,JSON['stringify'](_0x5f1c29));_0xb6407d(_0x5f1c29);})[_0x3163('0x11')](function(_0x3fa915){logger[_0x3163('0x12')](_0x3163('0x1f'),_0x3fa915[_0x3163('0x14')],_0x5ecfa6);_0x11bd1e(_0x554a09[_0x3163('0x12')](0x1f4,_0x3fa915['message']));});});});};exports[_0x3163('0x2d')]=function(_0x369568){var _0x2b253e=this;return new Promise(function(_0x3a2885,_0x2a5197){return db['sequelize'][_0x3163('0x21')](function(_0x11997d){return db['CmHopperFinal'][_0x3163('0x18')](_0x369568[_0x3163('0x1a')],{'raw':_0x369568[_0x3163('0x6')]?_0x369568['options'][_0x3163('0x7')]===undefined?!![]:![]:!![],'transaction':_0x11997d})[_0x3163('0xd')](function(){logger['info'](_0x3163('0x2e'),JSON['stringify'](_0x369568['options'][_0x3163('0x15')]),_0x369568['options'][_0x3163('0x15')][_0x3163('0x1d')]);return db[_0x3163('0x5')]['destroy']({'where':_0x369568[_0x3163('0x6')]?_0x369568[_0x3163('0x6')]['where']||null:null,'transaction':_0x11997d});});})[_0x3163('0xd')](function(_0x5463fe){logger[_0x3163('0xe')]('MoveContactManagedDialer',_0x369568);logger['debug'](_0x3163('0x2d'),_0x369568,JSON[_0x3163('0x10')](_0x5463fe));_0x3a2885(_0x5463fe);})[_0x3163('0x11')](function(_0x5bd045){logger['error'](_0x3163('0x2d'),_0x5bd045[_0x3163('0x14')],_0x369568);_0x2a5197(_0x2b253e['error'](0x1f4,_0x5bd045['message']));});});};exports['CountReScheduled']=function(_0x36bb38){var _0x5cdda2=this;return new Promise(function(_0x4abf95,_0x24a579){return db['CmHopper'][_0x3163('0x22')]({'raw':_0x36bb38[_0x3163('0x6')]?_0x36bb38[_0x3163('0x6')][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x36bb38[_0x3163('0x6')]?_0x36bb38[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':[[db[_0x3163('0x2f')]['fn'](_0x3163('0x30'),db['sequelize']['fn']('IF',db[_0x3163('0x2f')][_0x3163('0x31')](_0x3163('0x32')+util[_0x3163('0x33')](_0x3163('0x34'),moment()[_0x3163('0x33')](_0x3163('0x35')))+'\x20,\x201,\x20null'))),_0x3163('0x36')]]})[_0x3163('0xd')](function(_0x4cddb3){logger[_0x3163('0xe')]('CountReScheduled',_0x36bb38);logger[_0x3163('0xf')](_0x3163('0x37'),_0x36bb38,JSON[_0x3163('0x10')](_0x4cddb3));_0x4abf95(_0x4cddb3);})['catch'](function(_0x4f83bb){logger[_0x3163('0x12')]('CountReScheduled',_0x4f83bb[_0x3163('0x14')],_0x36bb38);_0x24a579(_0x5cdda2[_0x3163('0x12')](0x1f4,_0x4f83bb[_0x3163('0x14')]));});});};exports[_0x3163('0x38')]=function(_0xc51cff){var _0x468039=this;return new Promise(function(_0x4051a4,_0x1497b0){return db['CmContact'][_0x3163('0x39')]()['then'](function(){return db['sequelize'][_0x3163('0x21')](function(_0x49da03){return db[_0x3163('0x5')][_0x3163('0x22')]({'where':_0xc51cff[_0x3163('0x6')]?_0xc51cff['options']['where']||null:null,'attributes':_0xc51cff['options']?_0xc51cff['options']['attributes']||null:null,'limit':0x1,'order':_0xc51cff[_0x3163('0x6')]?_0xc51cff['options'][_0x3163('0x23')]||null:null,'group':db[_0x3163('0x5')][_0x3163('0x27')],'transaction':_0x49da03,'lock':_0x49da03['LOCK'][_0x3163('0x3a')],'include':_0xc51cff[_0x3163('0x6')]?_0xc51cff[_0x3163('0x6')]['include']?_['map'](_0xc51cff['options'][_0x3163('0xa')],function(_0x6c2402){return{'model':db[_0x6c2402[_0x3163('0xb')]],'as':_0x6c2402['as'],'attributes':_0x6c2402[_0x3163('0x8')],'include':_0x6c2402[_0x3163('0xa')]?_['map'](_0x6c2402[_0x3163('0xa')],function(_0x48dab0){return{'model':db[_0x48dab0[_0x3163('0xb')]],'as':_0x48dab0['as'],'attributes':_0x48dab0['attributes'],'include':_0x48dab0[_0x3163('0xa')]?_[_0x3163('0xc')](_0x48dab0[_0x3163('0xa')],function(_0x1483d9){return{'model':db[_0x1483d9[_0x3163('0xb')]],'as':_0x1483d9['as'],'attributes':_0x1483d9[_0x3163('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x559981){var _0x480f35=[];for(var _0x1ab91c=0x0;_0x1ab91c<_0x559981[_0x3163('0x2a')];_0x1ab91c+=0x1){_0x480f35['push'](_0x559981[_0x1ab91c][_0x3163('0x19')](_0xc51cff[_0x3163('0x1a')],{'transaction':_0x49da03}));}return BPromise[_0x3163('0x3b')](_0x480f35);});})[_0x3163('0xd')](function(_0x1fc134){logger[_0x3163('0xe')](_0x3163('0x38'),_0xc51cff);logger[_0x3163('0xf')](_0x3163('0x38'),_0xc51cff,JSON[_0x3163('0x10')](_0x1fc134));_0x4051a4(_0x1fc134);})[_0x3163('0x11')](function(_0x521fa3){logger[_0x3163('0x12')](_0x3163('0x38'),_0x521fa3['message'],_0xc51cff);_0x1497b0(_0x468039[_0x3163('0x12')](0x1f4,_0x521fa3['message']));});});});};exports['GetCmHopperPreview']=function(_0x44f6af){var _0x13fa73=this;return new Promise(function(_0x440f08,_0x4b3e54){db['CmContact'][_0x3163('0x39')]()[_0x3163('0xd')](function(_0x522443){return db[_0x3163('0x5')][_0x3163('0x22')]({'raw':_0x44f6af['options']?_0x44f6af['options'][_0x3163('0x7')]===undefined?!![]:![]:!![],'where':_0x44f6af[_0x3163('0x6')]?_0x44f6af[_0x3163('0x6')][_0x3163('0x15')]||null:null,'attributes':_0x44f6af[_0x3163('0x6')]?_0x44f6af['options'][_0x3163('0x8')]||null:null,'limit':_0x44f6af['options']?_0x44f6af[_0x3163('0x6')]['limit']||null:null,'include':_0x44f6af['options']?_0x44f6af[_0x3163('0x6')][_0x3163('0xa')]?_[_0x3163('0xc')](_0x44f6af[_0x3163('0x6')]['include'],function(_0x2b6a49){return{'model':db[_0x2b6a49[_0x3163('0xb')]],'as':_0x2b6a49['as'],'attributes':_0x2b6a49['as']===_0x3163('0x3c')?_[_0x3163('0x25')](_0x522443):_0x2b6a49[_0x3163('0x8')],'include':_0x2b6a49[_0x3163('0xa')]?_['map'](_0x2b6a49[_0x3163('0xa')],function(_0x1ca362){return{'model':db[_0x1ca362[_0x3163('0xb')]],'as':_0x1ca362['as'],'attributes':_0x1ca362[_0x3163('0x8')],'include':_0x1ca362[_0x3163('0xa')]?_[_0x3163('0xc')](_0x1ca362['include'],function(_0x1982e9){return{'model':db[_0x1982e9[_0x3163('0xb')]],'as':_0x1982e9['as'],'attributes':_0x1982e9[_0x3163('0x8')]};}):[]};}):[]};}):[]:[]})[_0x3163('0xd')](function(_0x5b7b85){logger[_0x3163('0xe')](_0x3163('0x13'),_0x44f6af);logger['debug']('GetCmHopper',_0x44f6af,JSON[_0x3163('0x10')](_0x5b7b85));_0x440f08(_0x5b7b85);})[_0x3163('0x11')](function(_0x38ca76){logger['error'](_0x3163('0x13'),_0x38ca76[_0x3163('0x14')],_0x44f6af);_0x4b3e54(_0x13fa73['error'](0x1f4,_0x38ca76[_0x3163('0x14')]));});});});};exports[_0x3163('0x3d')]=function(_0x346da5){var _0x221c28=this;return new Promise(function(_0x424411,_0x4ceac6){return db[_0x3163('0x20')][_0x3163('0x3e')]({'raw':!![],'where':{'phone':_0x346da5['options']['where'][_0x3163('0x3f')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x3163('0xd')](function(_0x782faa){logger[_0x3163('0xe')](_0x3163('0x40'),_0x346da5);logger[_0x3163('0xf')](_0x3163('0x40'),_0x346da5,JSON['stringify'](_0x782faa));_0x424411(_0x782faa);})['catch'](function(_0x359b4d){logger[_0x3163('0x12')](_0x3163('0x40'),_0x359b4d[_0x3163('0x14')],_0x346da5);_0x4ceac6(_0x221c28['error'](0x1f4,_0x359b4d[_0x3163('0x14')]));});});};exports['ResetActiveCalls']=function(_0x3cc6b7){var _0x41a8cb=this;return new Promise(function(_0x595164,_0x1e7934){return db[_0x3163('0x2f')][_0x3163('0x21')](function(_0x177129){var _0x40432a=_0x3cc6b7['options']&&_0x3cc6b7[_0x3163('0x6')][_0x3163('0x15')]?_0x3cc6b7[_0x3163('0x6')][_0x3163('0x15')]:{};return db[_0x3163('0x5')][_0x3163('0x19')](_0x3cc6b7[_0x3163('0x1a')],{'where':_0x40432a,'transaction':_0x177129})[_0x3163('0xd')](function(_0x338392){logger[_0x3163('0xe')](_0x3163('0x41'),_0x3cc6b7);logger[_0x3163('0xf')](_0x3163('0x41'),_0x3cc6b7,JSON[_0x3163('0x10')](_0x338392));_0x595164(_0x338392);})[_0x3163('0x11')](function(_0xbdaba3){logger[_0x3163('0x12')](_0x3163('0x41'),_0xbdaba3['message'],_0x3cc6b7);_0x1e7934(_0x41a8cb[_0x3163('0x12')](0x1f4,_0xbdaba3['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x2102a5){var _0x206014=this;var _0xd85a64=_0x2102a5[_0x3163('0x1a')][_0x3163('0x15')]['voiceQueueIds'];var _0x240958=_0x2102a5[_0x3163('0x1a')][_0x3163('0x15')][_0x3163('0x42')];var _0x11011e=_0x2102a5[_0x3163('0x1a')][_0x3163('0x15')][_0x3163('0x43')];return new Promise(function(_0x570b51,_0xd037d8){return db[_0x3163('0x5')][_0x3163('0x22')]({'where':{'voiceQueueId':{'$in':_0xd85a64},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3163('0x2f')]['literal'](_0x3163('0x44')+_0x240958+_0x3163('0x45')),'$gt':db[_0x3163('0x2f')][_0x3163('0x31')](_0x3163('0x46'))}},'UserId':{'$in':_0x11011e}},'include':[{'model':db[_0x3163('0x20')],'as':_0x3163('0x3c')},{'model':db[_0x3163('0x47')],'as':_0x3163('0x48'),'attributes':['id',_0x3163('0x49'),_0x3163('0x26')]},{'model':db['CmList'],'as':_0x3163('0x4a')}]})[_0x3163('0xd')](function(_0x5d7d92){if(_0x5d7d92['length']>0x0){return db[_0x3163('0x2f')][_0x3163('0x21')](function(_0x1c5dab){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x3163('0x2f')][_0x3163('0x31')](_0x3163('0x46'))},{'where':{'id':{'$in':_[_0x3163('0xc')](_0x5d7d92,'id')}},'transaction':_0x1c5dab})[_0x3163('0xd')](function(){_0x570b51(_0x5d7d92);})['catch'](function(_0x5887e1){logger[_0x3163('0x12')](_0x3163('0x4b'),_0x5887e1[_0x3163('0x14')],_0x2102a5);_0xd037d8(_0x206014[_0x3163('0x12')](0x1f4,_0x5887e1[_0x3163('0x14')]));});})[_0x3163('0x11')](function(_0x489bae){logger[_0x3163('0x12')](_0x3163('0x4b'),_0x489bae['message'],_0x2102a5);_0xd037d8(_0x206014[_0x3163('0x12')](0x1f4,_0x489bae['message']));});}else{_0x570b51(_0x5d7d92);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 4cf4f88..9e4db98 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 _0xa3f0=['exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','/preview','/timezone','update'];(function(_0x5b3939,_0x30c79b){var _0x44201e=function(_0x29b244){while(--_0x29b244){_0x5b3939['push'](_0x5b3939['shift']());}};_0x44201e(++_0x30c79b);}(_0xa3f0,0x8d));var _0x0a3f=function(_0x2de4c3,_0x646aad){_0x2de4c3=_0x2de4c3-0x0;var _0xc324fd=_0xa3f0[_0x2de4c3];return _0xc324fd;};'use strict';var express=require(_0x0a3f('0x0'));var router=express[_0x0a3f('0x1')]();var auth=require(_0x0a3f('0x2'));var controller=require(_0x0a3f('0x3'));router[_0x0a3f('0x4')]('/',auth[_0x0a3f('0x5')](),controller[_0x0a3f('0x6')]);router[_0x0a3f('0x4')](_0x0a3f('0x7'),auth[_0x0a3f('0x5')](),controller[_0x0a3f('0x8')]);router[_0x0a3f('0x4')](_0x0a3f('0x9'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x0a3f('0x4')](_0x0a3f('0xa'),auth[_0x0a3f('0x5')](),controller[_0x0a3f('0xb')]);router[_0x0a3f('0x4')](_0x0a3f('0xc'),auth[_0x0a3f('0x5')](),controller[_0x0a3f('0xd')]);router['get']('/:id/previewrecall',auth[_0x0a3f('0x5')](),controller[_0x0a3f('0xe')]);router[_0x0a3f('0xf')]('/',auth[_0x0a3f('0x5')](),controller['create']);router[_0x0a3f('0xf')](_0x0a3f('0x10'),auth[_0x0a3f('0x5')](),controller['getPreview']);router[_0x0a3f('0xf')](_0x0a3f('0x11'),auth['isAuthenticated'](),controller['getTimezone']);router['put']('/:id',auth[_0x0a3f('0x5')](),controller[_0x0a3f('0x12')]);router['delete'](_0x0a3f('0xc'),auth[_0x0a3f('0x5')](),controller['destroy']);module[_0x0a3f('0x13')]=router; \ No newline at end of file +var _0x5efc=['index','get','/describe','describe','/opencontacts','getOpenContacts','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','express','../../components/auth/service','./cmHopper.controller','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5efc,0x1f4));var _0xc5ef=function(_0x335fe8,_0x45e3c0){_0x335fe8=_0x335fe8-0x0;var _0x43c2b6=_0x5efc[_0x335fe8];return _0x43c2b6;};'use strict';var express=require(_0xc5ef('0x0'));var router=express['Router']();var auth=require(_0xc5ef('0x1'));var controller=require(_0xc5ef('0x2'));router['get']('/',auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x4')]);router[_0xc5ef('0x5')](_0xc5ef('0x6'),auth['isAuthenticated'](),controller[_0xc5ef('0x7')]);router['get'](_0xc5ef('0x8'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x9')]);router[_0xc5ef('0x5')]('/timezones',auth[_0xc5ef('0x3')](),controller[_0xc5ef('0xa')]);router[_0xc5ef('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xc5ef('0xb')]);router[_0xc5ef('0x5')](_0xc5ef('0xc'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0xd')]);router['post']('/',auth[_0xc5ef('0x3')](),controller['create']);router[_0xc5ef('0xe')](_0xc5ef('0xf'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x10')]);router[_0xc5ef('0xe')](_0xc5ef('0x11'),auth['isAuthenticated'](),controller[_0xc5ef('0x12')]);router[_0xc5ef('0x13')](_0xc5ef('0x14'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x15')]);router[_0xc5ef('0x16')](_0xc5ef('0x14'),auth[_0xc5ef('0x3')](),controller[_0xc5ef('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index b34f86a..32c36a8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa529=['moment','sequelize','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x6499d4,_0x4d4840){var _0x501f30=function(_0x43c9f8){while(--_0x43c9f8){_0x6499d4['push'](_0x6499d4['shift']());}};_0x501f30(++_0x4d4840);}(_0xa529,0x1b8));var _0x9a52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa529[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x9a52('0x0'));var Sequelize=require(_0x9a52('0x1'));module[_0x9a52('0x2')]={'CmHopperId':{'type':Sequelize[_0x9a52('0x3')]},'phone':{'type':Sequelize[_0x9a52('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9a52('0x5')],'defaultValue':moment()[_0x9a52('0x6')](_0x9a52('0x7'))},'countbusyretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9a52('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x692d=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','STRING','INTEGER','format'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x692d,0x97));var _0xd692=function(_0xcd0ee7,_0x445a21){_0xcd0ee7=_0xcd0ee7-0x0;var _0x1e0644=_0x692d[_0xcd0ee7];return _0x1e0644;};'use strict';var moment=require(_0xd692('0x0'));var Sequelize=require(_0xd692('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xd692('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd692('0x4')](_0xd692('0x5'))},'countbusyretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd692('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 0cfade6..7aa1d69 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc58=['VIRTUAL','CmHopperAdditionalPhone','includeAll','include','findAll','rows','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge'];(function(_0x3ee3e8,_0x5d1e42){var _0x31a818=function(_0x28d5b0){while(--_0x28d5b0){_0x3ee3e8['push'](_0x3ee3e8['shift']());}};_0x31a818(++_0x5d1e42);}(_0xdc58,0xaf));var _0x8dc5=function(_0x40ec84,_0x25f950){_0x40ec84=_0x40ec84-0x0;var _0x3c230c=_0xdc58[_0x40ec84];return _0x3c230c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8dc5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8dc5('0x1'));var BPromise=require(_0x8dc5('0x2'));var Mustache=require(_0x8dc5('0x3'));var util=require(_0x8dc5('0x4'));var path=require(_0x8dc5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8dc5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8dc5('0x7'));var squel=require(_0x8dc5('0x8'));var crypto=require(_0x8dc5('0x9'));var jsforce=require(_0x8dc5('0xa'));var deskjs=require(_0x8dc5('0xb'));var toCsv=require(_0x8dc5('0xc'));var querystring=require(_0x8dc5('0xd'));var Papa=require(_0x8dc5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8dc5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8dc5('0x10'))(_0x8dc5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8dc5('0x12'));var db=require(_0x8dc5('0x13'))['db'];function respondWithStatusCode(_0x13c1e4,_0x4c2f71){_0x4c2f71=_0x4c2f71||0xcc;return function(_0x3bc253){if(_0x3bc253){return _0x13c1e4[_0x8dc5('0x14')](_0x4c2f71);}return _0x13c1e4[_0x8dc5('0x15')](_0x4c2f71)[_0x8dc5('0x16')]();};}function respondWithResult(_0x24b866,_0x520fb4){_0x520fb4=_0x520fb4||0xc8;return function(_0x479249){if(_0x479249){return _0x24b866[_0x8dc5('0x15')](_0x520fb4)[_0x8dc5('0x17')](_0x479249);}};}function respondWithFilteredResult(_0x581ce0,_0x91b801){return function(_0x32de99){if(_0x32de99){var _0x528d46=typeof _0x91b801[_0x8dc5('0x18')]==='undefined'&&typeof _0x91b801[_0x8dc5('0x19')]===_0x8dc5('0x1a');var _0x56fa9a=_0x32de99[_0x8dc5('0x1b')];var _0x44ff0a=_0x528d46?0x0:_0x91b801[_0x8dc5('0x18')];var _0x103d85=_0x528d46?_0x32de99['count']:_0x91b801[_0x8dc5('0x18')]+_0x91b801[_0x8dc5('0x19')];var _0x3b1fdb;if(_0x103d85>=_0x56fa9a){_0x103d85=_0x56fa9a;_0x3b1fdb=0xc8;}else{_0x3b1fdb=0xce;}_0x581ce0[_0x8dc5('0x15')](_0x3b1fdb);return _0x581ce0['set'](_0x8dc5('0x1c'),_0x44ff0a+'-'+_0x103d85+'/'+_0x56fa9a)['json'](_0x32de99);}return null;};}function patchUpdates(_0x13762e){return function(_0x24db6a){try{jsonpatch[_0x8dc5('0x1d')](_0x24db6a,_0x13762e,!![]);}catch(_0x54918c){return BPromise['reject'](_0x54918c);}return _0x24db6a[_0x8dc5('0x1e')]();};}function saveUpdates(_0x5a8ca9,_0x16c3dc){return function(_0x3fbea8){if(_0x3fbea8){return _0x3fbea8[_0x8dc5('0x1f')](_0x5a8ca9)[_0x8dc5('0x20')](function(_0x5e2ab7){return _0x5e2ab7;});}return null;};}function removeEntity(_0x229d7c,_0x27923a){return function(_0x246718){if(_0x246718){return _0x246718[_0x8dc5('0x21')]()[_0x8dc5('0x20')](function(){var _0x3fd7fa=_0x246718[_0x8dc5('0x22')]({'plain':!![]});var _0x4e5762=_0x8dc5('0x23');return db[_0x8dc5('0x24')][_0x8dc5('0x21')]({'where':{'type':_0x4e5762,'resourceId':_0x3fd7fa['id']}})[_0x8dc5('0x20')](function(){return _0x246718;});})[_0x8dc5('0x20')](function(){_0x229d7c[_0x8dc5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5917b8,_0x33272c){return function(_0x3f8182){if(!_0x3f8182){_0x5917b8[_0x8dc5('0x14')](0x194);}return _0x3f8182;};}function handleError(_0x1860ad,_0x4fc341){_0x4fc341=_0x4fc341||0x1f4;return function(_0x3abe8a){logger[_0x8dc5('0x25')](_0x3abe8a[_0x8dc5('0x26')]);if(_0x3abe8a[_0x8dc5('0x27')]){delete _0x3abe8a['name'];}_0x1860ad['status'](_0x4fc341)[_0x8dc5('0x28')](_0x3abe8a);};}exports[_0x8dc5('0x29')]=function(_0x1f8ff7,_0x2d060e){var _0x128672={},_0x2cf58d={},_0x8855dd={'count':0x0,'rows':[]};var _0x35966f=_[_0x8dc5('0x2a')](db['CmHopperAdditionalPhone'][_0x8dc5('0x2b')],function(_0x4488d1){return{'name':_0x4488d1[_0x8dc5('0x2c')],'type':_0x4488d1[_0x8dc5('0x2d')][_0x8dc5('0x2e')]};});_0x2cf58d[_0x8dc5('0x2f')]=_['map'](_0x35966f,_0x8dc5('0x27'));_0x2cf58d['query']=_[_0x8dc5('0x30')](_0x1f8ff7[_0x8dc5('0x31')]);_0x2cf58d['filters']=_['intersection'](_0x2cf58d[_0x8dc5('0x2f')],_0x2cf58d[_0x8dc5('0x31')]);_0x128672['attributes']=_[_0x8dc5('0x32')](_0x2cf58d[_0x8dc5('0x2f')],qs[_0x8dc5('0x33')](_0x1f8ff7[_0x8dc5('0x31')][_0x8dc5('0x33')]));_0x128672['attributes']=_0x128672[_0x8dc5('0x34')][_0x8dc5('0x35')]?_0x128672['attributes']:_0x2cf58d[_0x8dc5('0x2f')];if(!_0x1f8ff7[_0x8dc5('0x31')][_0x8dc5('0x36')](_0x8dc5('0x37'))){_0x128672[_0x8dc5('0x19')]=qs[_0x8dc5('0x19')](_0x1f8ff7['query'][_0x8dc5('0x19')]);_0x128672[_0x8dc5('0x18')]=qs[_0x8dc5('0x18')](_0x1f8ff7['query']['offset']);}_0x128672[_0x8dc5('0x38')]=qs['sort'](_0x1f8ff7[_0x8dc5('0x31')]['sort']);_0x128672[_0x8dc5('0x39')]=qs[_0x8dc5('0x3a')](_[_0x8dc5('0x3b')](_0x1f8ff7['query'],_0x2cf58d[_0x8dc5('0x3a')]),_0x35966f);if(_0x1f8ff7['query'][_0x8dc5('0x3c')]){_0x128672['where']=_[_0x8dc5('0x3d')](_0x128672[_0x8dc5('0x39')],{'$or':_[_0x8dc5('0x2a')](_0x35966f,function(_0x536177){if(_0x536177[_0x8dc5('0x2d')]!==_0x8dc5('0x3e')){var _0x5ad0a9={};_0x5ad0a9[_0x536177['name']]={'$like':'%'+_0x1f8ff7[_0x8dc5('0x31')][_0x8dc5('0x3c')]+'%'};return _0x5ad0a9;}})});}_0x128672=_['merge']({},_0x128672,_0x1f8ff7['options']);var _0x45c655={'where':_0x128672[_0x8dc5('0x39')]};return db[_0x8dc5('0x3f')][_0x8dc5('0x1b')](_0x45c655)[_0x8dc5('0x20')](function(_0x23ba12){_0x8855dd[_0x8dc5('0x1b')]=_0x23ba12;if(_0x1f8ff7['query'][_0x8dc5('0x40')]){_0x128672[_0x8dc5('0x41')]=[{'all':!![]}];}return db[_0x8dc5('0x3f')][_0x8dc5('0x42')](_0x128672);})['then'](function(_0xc023df){_0x8855dd[_0x8dc5('0x43')]=_0xc023df;return _0x8855dd;})[_0x8dc5('0x20')](respondWithFilteredResult(_0x2d060e,_0x128672))['catch'](handleError(_0x2d060e,null));};exports[_0x8dc5('0x44')]=function(_0x4e15a3,_0x1e92c0){var _0x181eaa={'raw':!![],'where':{'id':_0x4e15a3[_0x8dc5('0x45')]['id']}},_0x18204c={};_0x18204c['model']=_[_0x8dc5('0x30')](db[_0x8dc5('0x3f')][_0x8dc5('0x2b')]);_0x18204c[_0x8dc5('0x31')]=_[_0x8dc5('0x30')](_0x4e15a3['query']);_0x18204c[_0x8dc5('0x3a')]=_[_0x8dc5('0x32')](_0x18204c[_0x8dc5('0x2f')],_0x18204c[_0x8dc5('0x31')]);_0x181eaa[_0x8dc5('0x34')]=_[_0x8dc5('0x32')](_0x18204c['model'],qs['fields'](_0x4e15a3[_0x8dc5('0x31')][_0x8dc5('0x33')]));_0x181eaa[_0x8dc5('0x34')]=_0x181eaa['attributes'][_0x8dc5('0x35')]?_0x181eaa[_0x8dc5('0x34')]:_0x18204c[_0x8dc5('0x2f')];if(_0x4e15a3[_0x8dc5('0x31')]['includeAll']){_0x181eaa[_0x8dc5('0x41')]=[{'all':!![]}];}_0x181eaa=_['merge']({},_0x181eaa,_0x4e15a3[_0x8dc5('0x46')]);return db[_0x8dc5('0x3f')]['find'](_0x181eaa)[_0x8dc5('0x20')](handleEntityNotFound(_0x1e92c0,null))[_0x8dc5('0x20')](respondWithResult(_0x1e92c0,null))[_0x8dc5('0x47')](handleError(_0x1e92c0,null));};exports[_0x8dc5('0x48')]=function(_0x5ebf5c,_0x2492f4){return db['CmHopperAdditionalPhone'][_0x8dc5('0x48')](_0x5ebf5c[_0x8dc5('0x49')],{})[_0x8dc5('0x20')](function(_0x2e41b1){var _0x316822=_0x5ebf5c[_0x8dc5('0x4a')][_0x8dc5('0x22')]({'plain':!![]});if(!_0x316822)throw new Error(_0x8dc5('0x4b'));if(_0x316822[_0x8dc5('0x4c')]===_0x8dc5('0x4a')){var _0x3ec8f6=_0x2e41b1['get']({'plain':!![]});var _0x9c70aa=_0x8dc5('0x23');return db['UserProfileSection'][_0x8dc5('0x4d')]({'where':{'name':_0x9c70aa,'userProfileId':_0x316822['userProfileId']},'raw':!![]})[_0x8dc5('0x20')](function(_0x195628){if(_0x195628&&_0x195628['autoAssociation']===0x0){return db[_0x8dc5('0x24')][_0x8dc5('0x48')]({'name':_0x3ec8f6[_0x8dc5('0x27')],'resourceId':_0x3ec8f6['id'],'type':_0x195628[_0x8dc5('0x27')],'sectionId':_0x195628['id']},{})[_0x8dc5('0x20')](function(){return _0x2e41b1;});}else{return _0x2e41b1;}})['catch'](function(_0x1c788d){logger[_0x8dc5('0x25')](_0x8dc5('0x4e'),_0x1c788d);throw _0x1c788d;});}return _0x2e41b1;})[_0x8dc5('0x20')](respondWithResult(_0x2492f4,0xc9))[_0x8dc5('0x47')](handleError(_0x2492f4,null));};exports[_0x8dc5('0x1f')]=function(_0x2fdbbd,_0x436867){if(_0x2fdbbd[_0x8dc5('0x49')]['id']){delete _0x2fdbbd['body']['id'];}return db[_0x8dc5('0x3f')][_0x8dc5('0x4d')]({'where':{'id':_0x2fdbbd[_0x8dc5('0x45')]['id']}})[_0x8dc5('0x20')](handleEntityNotFound(_0x436867,null))[_0x8dc5('0x20')](saveUpdates(_0x2fdbbd[_0x8dc5('0x49')],null))['then'](respondWithResult(_0x436867,null))['catch'](handleError(_0x436867,null));};exports[_0x8dc5('0x21')]=function(_0x5eb027,_0x5222fc){return db[_0x8dc5('0x3f')]['find']({'where':{'id':_0x5eb027['params']['id']}})[_0x8dc5('0x20')](handleEntityNotFound(_0x5222fc,null))[_0x8dc5('0x20')](removeEntity(_0x5222fc,null))[_0x8dc5('0x47')](handleError(_0x5222fc,null));}; \ No newline at end of file +var _0xace9=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','get','CmHopperAdditionalPhones','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','options','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2d99d4,_0x32db5a){var _0x137524=function(_0x10ed33){while(--_0x10ed33){_0x2d99d4['push'](_0x2d99d4['shift']());}};_0x137524(++_0x32db5a);}(_0xace9,0x142));var _0x9ace=function(_0x4cd362,_0x58295e){_0x4cd362=_0x4cd362-0x0;var _0x24d8ea=_0xace9[_0x4cd362];return _0x24d8ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ace('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ace('0x1'));var rp=require(_0x9ace('0x2'));var moment=require(_0x9ace('0x3'));var BPromise=require(_0x9ace('0x4'));var Mustache=require('mustache');var util=require(_0x9ace('0x5'));var path=require(_0x9ace('0x6'));var sox=require(_0x9ace('0x7'));var csv=require(_0x9ace('0x8'));var ejs=require(_0x9ace('0x9'));var fs=require('fs');var fs_extra=require(_0x9ace('0xa'));var _=require(_0x9ace('0xb'));var squel=require(_0x9ace('0xc'));var crypto=require(_0x9ace('0xd'));var jsforce=require(_0x9ace('0xe'));var deskjs=require(_0x9ace('0xf'));var toCsv=require(_0x9ace('0x8'));var querystring=require(_0x9ace('0x10'));var Papa=require('papaparse');var Redis=require(_0x9ace('0x11'));var authService=require(_0x9ace('0x12'));var qs=require(_0x9ace('0x13'));var as=require(_0x9ace('0x14'));var hardwareService=require(_0x9ace('0x15'));var logger=require(_0x9ace('0x16'))('api');var utils=require(_0x9ace('0x17'));var config=require(_0x9ace('0x18'));var licenseUtil=require(_0x9ace('0x19'));var db=require(_0x9ace('0x1a'))['db'];function respondWithStatusCode(_0x5df801,_0x44e6d2){_0x44e6d2=_0x44e6d2||0xcc;return function(_0x17d1da){if(_0x17d1da){return _0x5df801[_0x9ace('0x1b')](_0x44e6d2);}return _0x5df801[_0x9ace('0x1c')](_0x44e6d2)['end']();};}function respondWithResult(_0x39126e,_0x5b81eb){_0x5b81eb=_0x5b81eb||0xc8;return function(_0x4c6f47){if(_0x4c6f47){return _0x39126e[_0x9ace('0x1c')](_0x5b81eb)[_0x9ace('0x1d')](_0x4c6f47);}};}function respondWithFilteredResult(_0x3198bc,_0x1fe872){return function(_0x400222){if(_0x400222){var _0x1cb202=typeof _0x1fe872['offset']===_0x9ace('0x1e')&&typeof _0x1fe872[_0x9ace('0x1f')]===_0x9ace('0x1e');var _0x481ed4=_0x400222[_0x9ace('0x20')];var _0x52ad50=_0x1cb202?0x0:_0x1fe872[_0x9ace('0x21')];var _0x33a405=_0x1cb202?_0x400222[_0x9ace('0x20')]:_0x1fe872[_0x9ace('0x21')]+_0x1fe872[_0x9ace('0x1f')];var _0x2f74bd;if(_0x33a405>=_0x481ed4){_0x33a405=_0x481ed4;_0x2f74bd=0xc8;}else{_0x2f74bd=0xce;}_0x3198bc[_0x9ace('0x1c')](_0x2f74bd);return _0x3198bc['set'](_0x9ace('0x22'),_0x52ad50+'-'+_0x33a405+'/'+_0x481ed4)[_0x9ace('0x1d')](_0x400222);}return null;};}function patchUpdates(_0x14e481){return function(_0xec4f69){try{jsonpatch[_0x9ace('0x23')](_0xec4f69,_0x14e481,!![]);}catch(_0x5b1fcf){return BPromise['reject'](_0x5b1fcf);}return _0xec4f69[_0x9ace('0x24')]();};}function saveUpdates(_0x40042e,_0x53210f){return function(_0x1b74a9){if(_0x1b74a9){return _0x1b74a9['update'](_0x40042e)[_0x9ace('0x25')](function(_0x2520e7){return _0x2520e7;});}return null;};}function removeEntity(_0x175c6a,_0x5795fc){return function(_0x2a8411){if(_0x2a8411){return _0x2a8411[_0x9ace('0x26')]()[_0x9ace('0x25')](function(){var _0x2263ed=_0x2a8411[_0x9ace('0x27')]({'plain':!![]});var _0x50e077=_0x9ace('0x28');return db['UserProfileResource'][_0x9ace('0x26')]({'where':{'type':_0x50e077,'resourceId':_0x2263ed['id']}})[_0x9ace('0x25')](function(){return _0x2a8411;});})[_0x9ace('0x25')](function(){_0x175c6a[_0x9ace('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ebca,_0x3c8502){return function(_0x2324c1){if(!_0x2324c1){_0x18ebca['sendStatus'](0x194);}return _0x2324c1;};}function handleError(_0x2003a3,_0x1a0498){_0x1a0498=_0x1a0498||0x1f4;return function(_0x2d6dbe){logger['error'](_0x2d6dbe[_0x9ace('0x29')]);if(_0x2d6dbe[_0x9ace('0x2a')]){delete _0x2d6dbe[_0x9ace('0x2a')];}_0x2003a3[_0x9ace('0x1c')](_0x1a0498)[_0x9ace('0x2b')](_0x2d6dbe);};}exports[_0x9ace('0x2c')]=function(_0x37b9ef,_0x5f1286){var _0x1a03eb={},_0x668839={},_0x41a6c5={'count':0x0,'rows':[]};var _0xa876ae=_[_0x9ace('0x2d')](db[_0x9ace('0x2e')][_0x9ace('0x2f')],function(_0x3f8f75){return{'name':_0x3f8f75['fieldName'],'type':_0x3f8f75[_0x9ace('0x30')][_0x9ace('0x31')]};});_0x668839[_0x9ace('0x32')]=_[_0x9ace('0x2d')](_0xa876ae,'name');_0x668839['query']=_[_0x9ace('0x33')](_0x37b9ef[_0x9ace('0x34')]);_0x668839[_0x9ace('0x35')]=_[_0x9ace('0x36')](_0x668839['model'],_0x668839[_0x9ace('0x34')]);_0x1a03eb[_0x9ace('0x37')]=_[_0x9ace('0x36')](_0x668839[_0x9ace('0x32')],qs[_0x9ace('0x38')](_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x38')]));_0x1a03eb[_0x9ace('0x37')]=_0x1a03eb['attributes'][_0x9ace('0x39')]?_0x1a03eb[_0x9ace('0x37')]:_0x668839[_0x9ace('0x32')];if(!_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3a')]('nolimit')){_0x1a03eb[_0x9ace('0x1f')]=qs[_0x9ace('0x1f')](_0x37b9ef['query'][_0x9ace('0x1f')]);_0x1a03eb[_0x9ace('0x21')]=qs['offset'](_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x21')]);}_0x1a03eb[_0x9ace('0x3b')]=qs[_0x9ace('0x3c')](_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3c')]);_0x1a03eb['where']=qs[_0x9ace('0x35')](_[_0x9ace('0x3d')](_0x37b9ef[_0x9ace('0x34')],_0x668839[_0x9ace('0x35')]),_0xa876ae);if(_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3e')]){_0x1a03eb[_0x9ace('0x3f')]=_['merge'](_0x1a03eb[_0x9ace('0x3f')],{'$or':_[_0x9ace('0x2d')](_0xa876ae,function(_0x2d5a2e){if(_0x2d5a2e['type']!==_0x9ace('0x40')){var _0x31c15a={};_0x31c15a[_0x2d5a2e[_0x9ace('0x2a')]]={'$like':'%'+_0x37b9ef[_0x9ace('0x34')][_0x9ace('0x3e')]+'%'};return _0x31c15a;}})});}_0x1a03eb=_[_0x9ace('0x41')]({},_0x1a03eb,_0x37b9ef['options']);var _0x382dac={'where':_0x1a03eb[_0x9ace('0x3f')]};return db[_0x9ace('0x2e')][_0x9ace('0x20')](_0x382dac)[_0x9ace('0x25')](function(_0x33d207){_0x41a6c5[_0x9ace('0x20')]=_0x33d207;if(_0x37b9ef[_0x9ace('0x34')]['includeAll']){_0x1a03eb[_0x9ace('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x9ace('0x43')](_0x1a03eb);})[_0x9ace('0x25')](function(_0x248734){_0x41a6c5[_0x9ace('0x44')]=_0x248734;return _0x41a6c5;})[_0x9ace('0x25')](respondWithFilteredResult(_0x5f1286,_0x1a03eb))[_0x9ace('0x45')](handleError(_0x5f1286,null));};exports['show']=function(_0x59f09e,_0x5d9380){var _0x3a0112={'raw':!![],'where':{'id':_0x59f09e[_0x9ace('0x46')]['id']}},_0x4c9e88={};_0x4c9e88[_0x9ace('0x32')]=_[_0x9ace('0x33')](db[_0x9ace('0x2e')][_0x9ace('0x2f')]);_0x4c9e88['query']=_['keys'](_0x59f09e[_0x9ace('0x34')]);_0x4c9e88[_0x9ace('0x35')]=_['intersection'](_0x4c9e88[_0x9ace('0x32')],_0x4c9e88['query']);_0x3a0112[_0x9ace('0x37')]=_[_0x9ace('0x36')](_0x4c9e88[_0x9ace('0x32')],qs['fields'](_0x59f09e['query'][_0x9ace('0x38')]));_0x3a0112[_0x9ace('0x37')]=_0x3a0112['attributes'][_0x9ace('0x39')]?_0x3a0112[_0x9ace('0x37')]:_0x4c9e88[_0x9ace('0x32')];if(_0x59f09e['query']['includeAll']){_0x3a0112['include']=[{'all':!![]}];}_0x3a0112=_['merge']({},_0x3a0112,_0x59f09e[_0x9ace('0x47')]);return db[_0x9ace('0x2e')][_0x9ace('0x48')](_0x3a0112)[_0x9ace('0x25')](handleEntityNotFound(_0x5d9380,null))['then'](respondWithResult(_0x5d9380,null))[_0x9ace('0x45')](handleError(_0x5d9380,null));};exports[_0x9ace('0x49')]=function(_0x4b0d7c,_0x409e32){return db[_0x9ace('0x2e')][_0x9ace('0x49')](_0x4b0d7c[_0x9ace('0x4a')],{})[_0x9ace('0x25')](function(_0x3f8186){var _0x33622a=_0x4b0d7c[_0x9ace('0x4b')][_0x9ace('0x27')]({'plain':!![]});if(!_0x33622a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33622a[_0x9ace('0x4c')]===_0x9ace('0x4b')){var _0x31cb3e=_0x3f8186[_0x9ace('0x27')]({'plain':!![]});var _0x14fc7d=_0x9ace('0x28');return db['UserProfileSection'][_0x9ace('0x48')]({'where':{'name':_0x14fc7d,'userProfileId':_0x33622a[_0x9ace('0x4d')]},'raw':!![]})[_0x9ace('0x25')](function(_0x471852){if(_0x471852&&_0x471852[_0x9ace('0x4e')]===0x0){return db[_0x9ace('0x4f')][_0x9ace('0x49')]({'name':_0x31cb3e['name'],'resourceId':_0x31cb3e['id'],'type':_0x471852[_0x9ace('0x2a')],'sectionId':_0x471852['id']},{})[_0x9ace('0x25')](function(){return _0x3f8186;});}else{return _0x3f8186;}})[_0x9ace('0x45')](function(_0x3e5a12){logger['error'](_0x9ace('0x50'),_0x3e5a12);throw _0x3e5a12;});}return _0x3f8186;})[_0x9ace('0x25')](respondWithResult(_0x409e32,0xc9))['catch'](handleError(_0x409e32,null));};exports[_0x9ace('0x51')]=function(_0x5a23da,_0x455f4c){if(_0x5a23da[_0x9ace('0x4a')]['id']){delete _0x5a23da[_0x9ace('0x4a')]['id'];}return db[_0x9ace('0x2e')][_0x9ace('0x48')]({'where':{'id':_0x5a23da[_0x9ace('0x46')]['id']}})['then'](handleEntityNotFound(_0x455f4c,null))[_0x9ace('0x25')](saveUpdates(_0x5a23da['body'],null))[_0x9ace('0x25')](respondWithResult(_0x455f4c,null))['catch'](handleError(_0x455f4c,null));};exports['destroy']=function(_0x3de9f8,_0x2e47ff){return db[_0x9ace('0x2e')][_0x9ace('0x48')]({'where':{'id':_0x3de9f8[_0x9ace('0x46')]['id']}})[_0x9ace('0x25')](handleEntityNotFound(_0x2e47ff,null))[_0x9ace('0x25')](removeEntity(_0x2e47ff,null))[_0x9ace('0x45')](handleError(_0x2e47ff,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a464fa8..4105647 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3181=['moment','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','util','api'];(function(_0x270d11,_0x2c3278){var _0x321e13=function(_0x5b6118){while(--_0x5b6118){_0x270d11['push'](_0x270d11['shift']());}};_0x321e13(++_0x2c3278);}(_0x3181,0x142));var _0x1318=function(_0x327e47,_0x1f69a3){_0x327e47=_0x327e47-0x0;var _0xd2b5cd=_0x3181[_0x327e47];return _0xd2b5cd;};'use strict';var _=require('lodash');var util=require(_0x1318('0x0'));var logger=require('../../config/logger')(_0x1318('0x1'));var moment=require(_0x1318('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1318('0x3'));var rimraf=require('rimraf');var config=require(_0x1318('0x4'));var attributes=require(_0x1318('0x5'));module[_0x1318('0x6')]=function(_0x518024,_0x31b02b){return _0x518024[_0x1318('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x1318('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30ef=['moment','request-promise','path','rimraf','exports','define','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0x30ef,0x129));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf30e('0x0'));var util=require(_0xf30e('0x1'));var logger=require(_0xf30e('0x2'))('api');var moment=require(_0xf30e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf30e('0x4'));var fs=require('fs');var path=require(_0xf30e('0x5'));var rimraf=require(_0xf30e('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf30e('0x7')]=function(_0x4419fd,_0x2e97c3){return _0x4419fd[_0xf30e('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xf30e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 044ef0f..676dc31 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86dc=['message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','entity','dialGlobalMaxRetry','countabandonedretry','countmachineretry','countagentrejectretry','SwapAdditionalPhones','waitTime','duration','scheduledat','add','minutes','isNil','countnosuchnumberretry','updatedAt','phone','createdAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x86dc,0x13e));var _0xc86d=function(_0x3b5e96,_0x5ab597){_0x3b5e96=_0x3b5e96-0x0;var _0x3def41=_0x86dc[_0x3b5e96];return _0x3def41;};'use strict';var _=require(_0xc86d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc86d('0x1'));var rs=require(_0xc86d('0x2'));var fs=require('fs');var Redis=require(_0xc86d('0x3'));var db=require(_0xc86d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc86d('0x5'))('rpc');var config=require(_0xc86d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc86d('0x7')][_0xc86d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21114c,_0x56ac0e,_0x17a2b6){return new BPromise(function(_0x59c9a9,_0x20ae2c){return client[_0xc86d('0x9')](_0x21114c,_0x17a2b6)['then'](function(_0x5078d8){logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');logger[_0xc86d('0xc')](_0xc86d('0xd'),_0x56ac0e,_0xc86d('0xe'),JSON[_0xc86d('0xf')](_0x5078d8));if(_0x5078d8[_0xc86d('0x10')]){if(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x11')]===0x1f4){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x20ae2c(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x59c9a9(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}else{logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');_0x59c9a9(_0x5078d8['result']['message']);}})[_0xc86d('0x13')](function(_0x376a90){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x376a90);_0x20ae2c(_0x376a90);});});}exports[_0xc86d('0x14')]=function(_0x3d7e72){var _0x279406=this;return new Promise(function(_0x5f3ece,_0x4d5b38){return db[_0xc86d('0x15')][_0xc86d('0x16')]({'raw':!![],'where':{'ContactId':_0x3d7e72[_0xc86d('0x17')]['ContactId'],'ListId':_0x3d7e72[_0xc86d('0x17')][_0xc86d('0x18')],'VoiceQueueId':_0x3d7e72[_0xc86d('0x17')]['VoiceQueueId']===undefined?null:_0x3d7e72[_0xc86d('0x17')][_0xc86d('0x19')],'CampaignId':_0x3d7e72['body'][_0xc86d('0x1a')]===undefined?null:_0x3d7e72[_0xc86d('0x17')][_0xc86d('0x1a')]}})[_0xc86d('0x1b')](function(_0x57d804){if(_0x57d804!=null){return db[_0xc86d('0x1c')][_0xc86d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x57d804['id'],'OrderBy':{'$gt':_0x57d804[_0xc86d('0x1d')]}},'order':[[_0xc86d('0x1d'),_0xc86d('0x1e')]]})['then'](function(_0x38fb11){var _0x419afa=0x0;if(_0x38fb11){if(_0x38fb11[_0xc86d('0x1f')]+_0x38fb11[_0xc86d('0x20')]+_0x38fb11[_0xc86d('0x21')]+_0x38fb11['countnosuchnumberretry']+_0x38fb11[_0xc86d('0x22')]+_0x38fb11['countabandonedretry']+_0x38fb11['countmachineretry']+_0x38fb11['countagentrejectretry']<_0x3d7e72[_0xc86d('0x23')][_0xc86d('0x24')])_0x419afa=0x1;_0x5f3ece({'additional':_0x419afa});}else{return db[_0xc86d('0x1c')][_0xc86d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x57d804['id']},'order':[[_0xc86d('0x1d'),_0xc86d('0x1e')]]})[_0xc86d('0x1b')](function(_0x2a35b3){var _0x4db581=0x0;if(_0x2a35b3){if(_0x2a35b3[_0xc86d('0x1f')]+_0x2a35b3[_0xc86d('0x20')]+_0x2a35b3['countnoanswerretry']+_0x2a35b3['countnosuchnumberretry']+_0x2a35b3[_0xc86d('0x22')]+_0x2a35b3[_0xc86d('0x25')]+_0x2a35b3[_0xc86d('0x26')]+_0x2a35b3[_0xc86d('0x27')]<_0x3d7e72[_0xc86d('0x23')][_0xc86d('0x24')])_0x4db581=0x1;_0x5f3ece({'additional':_0x4db581});}else{_0x5f3ece({'additional':0x0});}})[_0xc86d('0x13')](function(_0x5a4ef1){logger['error'](_0xc86d('0x14'),_0x5a4ef1[_0xc86d('0x12')]);_0x4d5b38(_0x279406[_0xc86d('0x10')](0x1f4,_0x5a4ef1[_0xc86d('0x12')]));});}})[_0xc86d('0x13')](function(_0x5b80cb){logger[_0xc86d('0x10')]('VerifyAdditionalPhones',_0x5b80cb[_0xc86d('0x12')]);_0x4d5b38(_0x279406[_0xc86d('0x10')](0x1f4,_0x5b80cb[_0xc86d('0x12')]));});}else _0x5f3ece({'additional':0x0});});});};exports[_0xc86d('0x28')]=function(_0x3a469d){var _0x1d7fe8=this;return new Promise(function(_0x119b54,_0x100258){return db[_0xc86d('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x3a469d['body']['ContactId'],'ListId':_0x3a469d['body']['ListId'],'VoiceQueueId':_0x3a469d['body'][_0xc86d('0x19')]===undefined?null:_0x3a469d[_0xc86d('0x17')][_0xc86d('0x19')],'CampaignId':_0x3a469d[_0xc86d('0x17')][_0xc86d('0x1a')]===undefined?null:_0x3a469d[_0xc86d('0x17')]['CampaignId']}})[_0xc86d('0x1b')](function(_0x288c34){if(_0x288c34!=null){return db[_0xc86d('0x1c')][_0xc86d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x288c34['id'],'OrderBy':{'$gte':_0x288c34[_0xc86d('0x1d')]}},'order':[[_0xc86d('0x1d'),_0xc86d('0x1e')]]})[_0xc86d('0x1b')](function(_0xc08626){if(_0xc08626)return activateAdditionalPhone(_0x288c34,_0x3a469d[_0xc86d('0x17')],_0xc08626,_0x3a469d['duration'],_0x3a469d[_0xc86d('0x29')])['then'](function(_0x10b90e){_0x119b54(_0x10b90e);});else{return db[_0xc86d('0x1c')][_0xc86d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x288c34['id']},'order':[['OrderBy',_0xc86d('0x1e')]]})[_0xc86d('0x1b')](function(_0x3202b8){if(_0x3202b8)return activateAdditionalPhone(_0x288c34,_0x3a469d['body'],_0x3202b8,_0x3a469d[_0xc86d('0x2a')],_0x3a469d[_0xc86d('0x29')])[_0xc86d('0x1b')](function(_0x3de4f3){_0x119b54(_0x3de4f3);});else{_0x119b54({'id':_0x288c34['id'],'phone':''});}})[_0xc86d('0x13')](function(_0x5e8cd3){logger[_0xc86d('0x10')](_0xc86d('0x14'),_0x5e8cd3[_0xc86d('0x12')]);_0x100258(_0x1d7fe8[_0xc86d('0x10')](0x1f4,_0x5e8cd3[_0xc86d('0x12')]));});}})[_0xc86d('0x13')](function(_0x562fec){logger[_0xc86d('0x10')]('VerifyAdditionalPhones',_0x562fec[_0xc86d('0x12')]);_0x100258(_0x1d7fe8[_0xc86d('0x10')](0x1f4,_0x562fec[_0xc86d('0x12')]));});}else _0x119b54(0x1);});});};function activateAdditionalPhone(_0x2e5971,_0x4d0057,_0x4d9107,_0x518a47,_0x9841ff){return new Promise(function(_0x1a583b,_0x172f7b){var _0x2c3f3d;if(_['isNil'](_0x4d9107[_0xc86d('0x2b')])){_0x4d9107[_0xc86d('0x2b')]=moment();}if(moment()>moment(_0x4d9107[_0xc86d('0x2b')])){_0x2c3f3d=moment()[_0xc86d('0x2c')](_0x9841ff||0x3,_0xc86d('0x2d'));}else{if(_0x4d9107['OrderBy']==0x0){_0x2c3f3d=moment(_0x4d9107[_0xc86d('0x2b')]);}else{_0x2c3f3d=moment()[_0xc86d('0x2c')](_0x9841ff||0x3,_0xc86d('0x2d'));}}if(_[_0xc86d('0x2e')](_0x2c3f3d)){_0x2c3f3d=moment()['add'](_0x9841ff||0x3,_0xc86d('0x2d'));}var _0x4a91d7={'phone':_0x2e5971['phone'],'active':0x0,'OrderBy':_[_0xc86d('0x2e')](_0x2e5971['OrderBy'])?0x0:_0x2e5971[_0xc86d('0x1d')],'scheduledat':moment()[_0xc86d('0x2c')](_0x518a47||0x1,_0xc86d('0x2d')),'countbusyretry':_0x4d0057[_0xc86d('0x1f')],'countcongestionretry':_0x4d0057['countcongestionretry'],'countnoanswerretry':_0x4d0057[_0xc86d('0x21')],'countnosuchnumberretry':_0x4d0057[_0xc86d('0x2f')],'countdropretry':_0x4d0057[_0xc86d('0x22')],'countabandonedretry':_0x4d0057['countabandonedretry'],'countmachineretry':_0x4d0057['countmachineretry'],'countagentrejectretry':_0x4d0057[_0xc86d('0x27')],'createdAt':_0x4d0057['createdAt'],'updatedAt':_0x4d0057[_0xc86d('0x30')]};var _0x281007={'CmHopperId':_0x2e5971['id'],'phone':_0x4d9107[_0xc86d('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x4d9107['OrderBy'])?0x0:_0x4d9107[_0xc86d('0x1d')],'scheduledat':_0x2c3f3d,'countbusyretry':_0x4d9107[_0xc86d('0x1f')],'countcongestionretry':_0x4d9107[_0xc86d('0x20')],'countnoanswerretry':_0x4d9107['countnoanswerretry'],'countnosuchnumberretry':_0x4d9107[_0xc86d('0x2f')],'countdropretry':_0x4d9107['countdropretry'],'countabandonedretry':_0x4d9107[_0xc86d('0x25')],'countmachineretry':_0x4d9107[_0xc86d('0x26')],'countagentrejectretry':_0x4d9107['countagentrejectretry'],'createdAt':_0x4d9107[_0xc86d('0x32')],'updatedAt':_0x4d9107[_0xc86d('0x30')]};return db['sequelize'][_0xc86d('0x33')](function(_0x5399eb){return db[_0xc86d('0x1c')][_0xc86d('0x34')](_0x4a91d7,{'where':{'id':_0x4d9107['id']}},{'transaction':_0x5399eb})[_0xc86d('0x1b')](function(){return db['CmHopper']['update'](_0x281007,{'where':{'id':_0x2e5971['id']}},{'transaction':_0x5399eb});});})[_0xc86d('0x1b')](function(_0x6408e0){_0x1a583b({'id':_0x2e5971['id'],'phone':_0x4d9107[_0xc86d('0x31')]});})[_0xc86d('0x13')](function(_0x4fdeb8){logger[_0xc86d('0x10')](_0xc86d('0x35'),_0x4fdeb8[_0xc86d('0x12')]);_0x172f7b({'error':_0x4fdeb8[_0xc86d('0x12')]});});});}exports[_0xc86d('0x36')]=function(_0x27362e){var _0x4cce3b=this;return new Promise(function(_0x3a684a,_0x18fa33){return db[_0xc86d('0x15')][_0xc86d('0x34')](_0x27362e[_0xc86d('0x17')][_0xc86d('0x37')],{'where':{'id':_0x27362e[_0xc86d('0x17')]['id']}})[_0xc86d('0x1b')](function(_0x5b6fdb){_0x3a684a(_0x5b6fdb);})['catch'](function(_0x345c35){logger['error'](_0xc86d('0x36'),_0x345c35[_0xc86d('0x12')]);_0x18fa33(_0x4cce3b['error'](0x1f4,_0x345c35[_0xc86d('0x12')]));});});}; \ No newline at end of file +var _0x4cee=['createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','findOne','OrderBy','ASC','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone'];(function(_0x5ce7e2,_0x8dd5de){var _0x5224d1=function(_0x3b04f1){while(--_0x3b04f1){_0x5ce7e2['push'](_0x5ce7e2['shift']());}};_0x5224d1(++_0x8dd5de);}(_0x4cee,0x75));var _0xe4ce=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4cee[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0xe4ce('0x0'));var moment=require('moment');var BPromise=require(_0xe4ce('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4ce('0x3'));var logger=require(_0xe4ce('0x4'))(_0xe4ce('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4ce('0x6')][_0xe4ce('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48d5aa,_0x5b18dd,_0x5a912a){return new BPromise(function(_0x1c7cb4,_0xa947a3){return client[_0xe4ce('0x8')](_0x48d5aa,_0x5a912a)['then'](function(_0x4e854d){logger[_0xe4ce('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5b18dd,_0xe4ce('0xa'));logger[_0xe4ce('0xb')](_0xe4ce('0xc'),_0x5b18dd,'request\x20sent',JSON['stringify'](_0x4e854d));if(_0x4e854d[_0xe4ce('0xd')]){if(_0x4e854d[_0xe4ce('0xd')][_0xe4ce('0xe')]===0x1f4){logger[_0xe4ce('0xd')](_0xe4ce('0xf'),_0x5b18dd,_0x4e854d[_0xe4ce('0xd')][_0xe4ce('0x10')]);return _0xa947a3(_0x4e854d[_0xe4ce('0xd')][_0xe4ce('0x10')]);}logger[_0xe4ce('0xd')](_0xe4ce('0xf'),_0x5b18dd,_0x4e854d[_0xe4ce('0xd')]['message']);return _0x1c7cb4(_0x4e854d['error']['message']);}else{logger[_0xe4ce('0x9')](_0xe4ce('0xf'),_0x5b18dd,_0xe4ce('0xa'));_0x1c7cb4(_0x4e854d[_0xe4ce('0x11')][_0xe4ce('0x10')]);}})['catch'](function(_0x5f1462){logger[_0xe4ce('0xd')](_0xe4ce('0xf'),_0x5b18dd,_0x5f1462);_0xa947a3(_0x5f1462);});});}exports[_0xe4ce('0x12')]=function(_0x4aaf75){var _0x344fef=this;return new Promise(function(_0x536504,_0x2ba6df){return db[_0xe4ce('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x15')],'ListId':_0x4aaf75['body'][_0xe4ce('0x16')],'VoiceQueueId':_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x17')]===undefined?null:_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x17')],'CampaignId':_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x18')]===undefined?null:_0x4aaf75[_0xe4ce('0x14')][_0xe4ce('0x18')]}})['then'](function(_0xaccfba){if(_0xaccfba!=null){return db[_0xe4ce('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xaccfba['id'],'OrderBy':{'$gt':_0xaccfba['OrderBy']}},'order':[['OrderBy','ASC']]})[_0xe4ce('0x1a')](function(_0x23d39e){var _0x294fe6=0x0;if(_0x23d39e){if(_0x23d39e[_0xe4ce('0x1b')]+_0x23d39e[_0xe4ce('0x1c')]+_0x23d39e[_0xe4ce('0x1d')]+_0x23d39e[_0xe4ce('0x1e')]+_0x23d39e[_0xe4ce('0x1f')]+_0x23d39e[_0xe4ce('0x20')]+_0x23d39e[_0xe4ce('0x21')]+_0x23d39e[_0xe4ce('0x22')]<_0x4aaf75['entity'][_0xe4ce('0x23')])_0x294fe6=0x1;_0x536504({'additional':_0x294fe6});}else{return db['CmHopperAdditionalPhone'][_0xe4ce('0x24')]({'raw':!![],'where':{'CmHopperId':_0xaccfba['id']},'order':[[_0xe4ce('0x25'),_0xe4ce('0x26')]]})[_0xe4ce('0x1a')](function(_0x27b915){var _0x50328d=0x0;if(_0x27b915){if(_0x27b915[_0xe4ce('0x1b')]+_0x27b915[_0xe4ce('0x1c')]+_0x27b915['countnoanswerretry']+_0x27b915[_0xe4ce('0x1e')]+_0x27b915['countdropretry']+_0x27b915[_0xe4ce('0x20')]+_0x27b915['countmachineretry']+_0x27b915[_0xe4ce('0x22')]<_0x4aaf75['entity'][_0xe4ce('0x23')])_0x50328d=0x1;_0x536504({'additional':_0x50328d});}else{_0x536504({'additional':0x0});}})[_0xe4ce('0x27')](function(_0x4f3926){logger['error'](_0xe4ce('0x12'),_0x4f3926[_0xe4ce('0x10')]);_0x2ba6df(_0x344fef[_0xe4ce('0xd')](0x1f4,_0x4f3926[_0xe4ce('0x10')]));});}})['catch'](function(_0x545228){logger['error']('VerifyAdditionalPhones',_0x545228[_0xe4ce('0x10')]);_0x2ba6df(_0x344fef[_0xe4ce('0xd')](0x1f4,_0x545228[_0xe4ce('0x10')]));});}else _0x536504({'additional':0x0});});});};exports[_0xe4ce('0x28')]=function(_0x50d1a9){var _0x2883ff=this;return new Promise(function(_0x2c0a64,_0x12e64b){return db[_0xe4ce('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x50d1a9[_0xe4ce('0x14')][_0xe4ce('0x15')],'ListId':_0x50d1a9['body'][_0xe4ce('0x16')],'VoiceQueueId':_0x50d1a9[_0xe4ce('0x14')][_0xe4ce('0x17')]===undefined?null:_0x50d1a9['body'][_0xe4ce('0x17')],'CampaignId':_0x50d1a9[_0xe4ce('0x14')][_0xe4ce('0x18')]===undefined?null:_0x50d1a9['body']['CampaignId']}})[_0xe4ce('0x1a')](function(_0xd1d499){if(_0xd1d499!=null){return db[_0xe4ce('0x19')][_0xe4ce('0x24')]({'raw':!![],'where':{'CmHopperId':_0xd1d499['id'],'OrderBy':{'$gte':_0xd1d499[_0xe4ce('0x25')]}},'order':[[_0xe4ce('0x25'),_0xe4ce('0x26')]]})['then'](function(_0x101c23){if(_0x101c23)return activateAdditionalPhone(_0xd1d499,_0x50d1a9[_0xe4ce('0x14')],_0x101c23,_0x50d1a9['duration'],_0x50d1a9['waitTime'])[_0xe4ce('0x1a')](function(_0x577b97){_0x2c0a64(_0x577b97);});else{return db[_0xe4ce('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xd1d499['id']},'order':[['OrderBy',_0xe4ce('0x26')]]})[_0xe4ce('0x1a')](function(_0x4b72c3){if(_0x4b72c3)return activateAdditionalPhone(_0xd1d499,_0x50d1a9[_0xe4ce('0x14')],_0x4b72c3,_0x50d1a9[_0xe4ce('0x29')],_0x50d1a9[_0xe4ce('0x2a')])[_0xe4ce('0x1a')](function(_0x448677){_0x2c0a64(_0x448677);});else{_0x2c0a64({'id':_0xd1d499['id'],'phone':''});}})[_0xe4ce('0x27')](function(_0x5e88d4){logger[_0xe4ce('0xd')](_0xe4ce('0x12'),_0x5e88d4[_0xe4ce('0x10')]);_0x12e64b(_0x2883ff['error'](0x1f4,_0x5e88d4[_0xe4ce('0x10')]));});}})[_0xe4ce('0x27')](function(_0x1cbb12){logger[_0xe4ce('0xd')]('VerifyAdditionalPhones',_0x1cbb12[_0xe4ce('0x10')]);_0x12e64b(_0x2883ff[_0xe4ce('0xd')](0x1f4,_0x1cbb12[_0xe4ce('0x10')]));});}else _0x2c0a64(0x1);});});};function activateAdditionalPhone(_0x4d7751,_0x34d955,_0x5eafe0,_0x5e209b,_0x552afd){return new Promise(function(_0x3378be,_0x2315cc){var _0x52eb69;if(_[_0xe4ce('0x2b')](_0x5eafe0[_0xe4ce('0x2c')])){_0x5eafe0[_0xe4ce('0x2c')]=moment();}if(moment()>moment(_0x5eafe0[_0xe4ce('0x2c')])){_0x52eb69=moment()[_0xe4ce('0x2d')](_0x552afd||0x3,_0xe4ce('0x2e'));}else{if(_0x5eafe0[_0xe4ce('0x25')]==0x0){_0x52eb69=moment(_0x5eafe0[_0xe4ce('0x2c')]);}else{_0x52eb69=moment()['add'](_0x552afd||0x3,_0xe4ce('0x2e'));}}if(_[_0xe4ce('0x2b')](_0x52eb69)){_0x52eb69=moment()[_0xe4ce('0x2d')](_0x552afd||0x3,_0xe4ce('0x2e'));}var _0x47af5b={'phone':_0x4d7751[_0xe4ce('0x2f')],'active':0x0,'OrderBy':_[_0xe4ce('0x2b')](_0x4d7751[_0xe4ce('0x25')])?0x0:_0x4d7751[_0xe4ce('0x25')],'scheduledat':moment()['add'](_0x5e209b||0x1,'minutes'),'countbusyretry':_0x34d955[_0xe4ce('0x1b')],'countcongestionretry':_0x34d955[_0xe4ce('0x1c')],'countnoanswerretry':_0x34d955[_0xe4ce('0x1d')],'countnosuchnumberretry':_0x34d955[_0xe4ce('0x1e')],'countdropretry':_0x34d955['countdropretry'],'countabandonedretry':_0x34d955[_0xe4ce('0x20')],'countmachineretry':_0x34d955['countmachineretry'],'countagentrejectretry':_0x34d955[_0xe4ce('0x22')],'createdAt':_0x34d955[_0xe4ce('0x30')],'updatedAt':_0x34d955[_0xe4ce('0x31')]};var _0x14210d={'CmHopperId':_0x4d7751['id'],'phone':_0x5eafe0[_0xe4ce('0x2f')],'active':0x0,'OrderBy':_[_0xe4ce('0x2b')](_0x5eafe0[_0xe4ce('0x25')])?0x0:_0x5eafe0[_0xe4ce('0x25')],'scheduledat':_0x52eb69,'countbusyretry':_0x5eafe0[_0xe4ce('0x1b')],'countcongestionretry':_0x5eafe0[_0xe4ce('0x1c')],'countnoanswerretry':_0x5eafe0['countnoanswerretry'],'countnosuchnumberretry':_0x5eafe0[_0xe4ce('0x1e')],'countdropretry':_0x5eafe0['countdropretry'],'countabandonedretry':_0x5eafe0[_0xe4ce('0x20')],'countmachineretry':_0x5eafe0[_0xe4ce('0x21')],'countagentrejectretry':_0x5eafe0[_0xe4ce('0x22')],'createdAt':_0x5eafe0[_0xe4ce('0x30')],'updatedAt':_0x5eafe0['updatedAt']};return db[_0xe4ce('0x32')]['transaction'](function(_0x7ea64d){return db[_0xe4ce('0x19')]['update'](_0x47af5b,{'where':{'id':_0x5eafe0['id']}},{'transaction':_0x7ea64d})[_0xe4ce('0x1a')](function(){return db['CmHopper'][_0xe4ce('0x33')](_0x14210d,{'where':{'id':_0x4d7751['id']}},{'transaction':_0x7ea64d});});})[_0xe4ce('0x1a')](function(_0x19921e){_0x3378be({'id':_0x4d7751['id'],'phone':_0x5eafe0['phone']});})[_0xe4ce('0x27')](function(_0x1d99f8){logger[_0xe4ce('0xd')](_0xe4ce('0x34'),_0x1d99f8[_0xe4ce('0x10')]);_0x2315cc({'error':_0x1d99f8[_0xe4ce('0x10')]});});});}exports[_0xe4ce('0x35')]=function(_0x5c0662){var _0x296c39=this;return new Promise(function(_0xa7c3b7,_0x1cb067){return db[_0xe4ce('0x13')]['update'](_0x5c0662[_0xe4ce('0x14')][_0xe4ce('0x36')],{'where':{'id':_0x5c0662[_0xe4ce('0x14')]['id']}})[_0xe4ce('0x1a')](function(_0x116cda){_0xa7c3b7(_0x116cda);})['catch'](function(_0x13f7d3){logger['error'](_0xe4ce('0x35'),_0x13f7d3[_0xe4ce('0x10')]);_0x1cb067(_0x296c39['error'](0x1f4,_0x13f7d3[_0xe4ce('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index d0b6dee..bbb2eaa 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6dc=['get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller'];(function(_0x4044a4,_0x10d79f){var _0x13946=function(_0x1678ee){while(--_0x1678ee){_0x4044a4['push'](_0x4044a4['shift']());}};_0x13946(++_0x10d79f);}(_0xd6dc,0x184));var _0xcd6d=function(_0x510190,_0x551d2a){_0x510190=_0x510190-0x0;var _0x41e3e8=_0xd6dc[_0x510190];return _0x41e3e8;};'use strict';var multer=require(_0xcd6d('0x0'));var util=require(_0xcd6d('0x1'));var path=require('path');var timeout=require(_0xcd6d('0x2'));var express=require(_0xcd6d('0x3'));var router=express[_0xcd6d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd6d('0x5'));var interaction=require(_0xcd6d('0x6'));var config=require('../../config/environment');var controller=require(_0xcd6d('0x7'));router[_0xcd6d('0x8')]('/',auth['isAuthenticated'](),controller[_0xcd6d('0x9')]);router['get'](_0xcd6d('0xa'),auth[_0xcd6d('0xb')](),controller['show']);router[_0xcd6d('0xc')]('/',auth['isAuthenticated'](),controller[_0xcd6d('0xd')]);router[_0xcd6d('0xe')](_0xcd6d('0xa'),auth[_0xcd6d('0xb')](),controller[_0xcd6d('0xf')]);router['delete'](_0xcd6d('0xa'),auth[_0xcd6d('0xb')](),controller[_0xcd6d('0x10')]);module[_0xcd6d('0x11')]=router; \ No newline at end of file +var _0x5d36=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','/:id','isAuthenticated','show','create','put','multer','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5d36,0x11a));var _0x65d3=function(_0x17e315,_0x361db6){_0x17e315=_0x17e315-0x0;var _0x3e7afb=_0x5d36[_0x17e315];return _0x3e7afb;};'use strict';var multer=require(_0x65d3('0x0'));var util=require(_0x65d3('0x1'));var path=require(_0x65d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x65d3('0x3')]();var fs_extra=require(_0x65d3('0x4'));var auth=require(_0x65d3('0x5'));var interaction=require(_0x65d3('0x6'));var config=require(_0x65d3('0x7'));var controller=require(_0x65d3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x65d3('0x9')]);router['get'](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller[_0x65d3('0xc')]);router['post']('/',auth[_0x65d3('0xb')](),controller[_0x65d3('0xd')]);router[_0x65d3('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x65d3('0xa'),auth[_0x65d3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 03520c5..656c082 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 _0x84cb=['moment','exports','INTEGER','contactListQueue'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x84cb,0xf8));var _0xb84c=function(_0x44b01a,_0x3f4a13){_0x44b01a=_0x44b01a-0x0;var _0x396eb3=_0x84cb[_0x44b01a];return _0x396eb3;};'use strict';var moment=require(_0xb84c('0x0'));var Sequelize=require('sequelize');module[_0xb84c('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb84c('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb84c('0x2')],'unique':_0xb84c('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb84c('0x2')],'unique':_0xb84c('0x3')}}; \ No newline at end of file +var _0x119a=['moment','sequelize','exports','INTEGER','contactListQueue'];(function(_0x395928,_0x51afb0){var _0x4efda4=function(_0x3a422e){while(--_0x3a422e){_0x395928['push'](_0x395928['shift']());}};_0x4efda4(++_0x51afb0);}(_0x119a,0x69));var _0xa119=function(_0x6a2596,_0x28a155){_0x6a2596=_0x6a2596-0x0;var _0x51c246=_0x119a[_0x6a2596];return _0x51c246;};'use strict';var moment=require(_0xa119('0x0'));var Sequelize=require(_0xa119('0x1'));module[_0xa119('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa119('0x3')],'unique':_0xa119('0x4')},'ListId':{'type':Sequelize[_0xa119('0x3')],'unique':_0xa119('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa119('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e4c4de2..fddf841 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 _0xc480=['set','update','then','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0xc480,0xad));var _0x0c48=function(_0x204500,_0x2be429){_0x204500=_0x204500-0x0;var _0x51f7d8=_0xc480[_0x204500];return _0x51f7d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c48('0x0'));var zipdir=require(_0x0c48('0x1'));var jsonpatch=require(_0x0c48('0x2'));var rp=require(_0x0c48('0x3'));var moment=require(_0x0c48('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c48('0x5'));var path=require(_0x0c48('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c48('0x7'));var fs=require('fs');var fs_extra=require(_0x0c48('0x8'));var _=require(_0x0c48('0x9'));var squel=require(_0x0c48('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c48('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0c48('0xc'));var Papa=require(_0x0c48('0xd'));var Redis=require(_0x0c48('0xe'));var authService=require(_0x0c48('0xf'));var qs=require(_0x0c48('0x10'));var as=require(_0x0c48('0x11'));var hardwareService=require(_0x0c48('0x12'));var logger=require(_0x0c48('0x13'))(_0x0c48('0x14'));var utils=require(_0x0c48('0x15'));var config=require(_0x0c48('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c48('0x17'))['db'];function respondWithStatusCode(_0x22df0b,_0x2c5eff){_0x2c5eff=_0x2c5eff||0xcc;return function(_0x212718){if(_0x212718){return _0x22df0b[_0x0c48('0x18')](_0x2c5eff);}return _0x22df0b[_0x0c48('0x19')](_0x2c5eff)[_0x0c48('0x1a')]();};}function respondWithResult(_0x3c10f9,_0x136947){_0x136947=_0x136947||0xc8;return function(_0x762603){if(_0x762603){return _0x3c10f9['status'](_0x136947)[_0x0c48('0x1b')](_0x762603);}};}function respondWithFilteredResult(_0x4fd636,_0x553c98){return function(_0x7b87f7){if(_0x7b87f7){var _0x2a34d5=typeof _0x553c98[_0x0c48('0x1c')]==='undefined'&&typeof _0x553c98['limit']==='undefined';var _0x26f137=_0x7b87f7[_0x0c48('0x1d')];var _0x2a045f=_0x2a34d5?0x0:_0x553c98[_0x0c48('0x1c')];var _0x5f4435=_0x2a34d5?_0x7b87f7['count']:_0x553c98[_0x0c48('0x1c')]+_0x553c98[_0x0c48('0x1e')];var _0x45beb3;if(_0x5f4435>=_0x26f137){_0x5f4435=_0x26f137;_0x45beb3=0xc8;}else{_0x45beb3=0xce;}_0x4fd636['status'](_0x45beb3);return _0x4fd636[_0x0c48('0x1f')]('Content-Range',_0x2a045f+'-'+_0x5f4435+'/'+_0x26f137)[_0x0c48('0x1b')](_0x7b87f7);}return null;};}function patchUpdates(_0x547ce5){return function(_0x121add){try{jsonpatch['apply'](_0x121add,_0x547ce5,!![]);}catch(_0x1ab866){return BPromise['reject'](_0x1ab866);}return _0x121add['save']();};}function saveUpdates(_0x430f41,_0xbc72d6){return function(_0x48a6b3){if(_0x48a6b3){return _0x48a6b3[_0x0c48('0x20')](_0x430f41)[_0x0c48('0x21')](function(_0x5beba6){return _0x5beba6;});}return null;};}function removeEntity(_0x2fce93,_0x87e6aa){return function(_0x115ea0){if(_0x115ea0){return _0x115ea0['destroy']()[_0x0c48('0x21')](function(){_0x2fce93['status'](0xcc)[_0x0c48('0x1a')]();});}};}function handleEntityNotFound(_0x283ac1,_0x1740b3){return function(_0x4691d8){if(!_0x4691d8){_0x283ac1[_0x0c48('0x18')](0x194);}return _0x4691d8;};}function handleError(_0x1aacfb,_0x58a783){_0x58a783=_0x58a783||0x1f4;return function(_0x5c5b4f){logger[_0x0c48('0x22')](_0x5c5b4f['stack']);if(_0x5c5b4f[_0x0c48('0x23')]){delete _0x5c5b4f[_0x0c48('0x23')];}_0x1aacfb[_0x0c48('0x19')](_0x58a783)[_0x0c48('0x24')](_0x5c5b4f);};}exports['index']=function(_0xcfcb72,_0xff3f34){var _0x2a418a={},_0x162cd9={},_0x293141={'count':0x0,'rows':[]};var _0x4843d8=_[_0x0c48('0x25')](db[_0x0c48('0x26')][_0x0c48('0x27')],function(_0x3a43f7){return{'name':_0x3a43f7[_0x0c48('0x28')],'type':_0x3a43f7[_0x0c48('0x29')][_0x0c48('0x2a')]};});_0x162cd9[_0x0c48('0x2b')]=_[_0x0c48('0x25')](_0x4843d8,'name');_0x162cd9['query']=_['keys'](_0xcfcb72[_0x0c48('0x2c')]);_0x162cd9[_0x0c48('0x2d')]=_[_0x0c48('0x2e')](_0x162cd9['model'],_0x162cd9[_0x0c48('0x2c')]);_0x2a418a[_0x0c48('0x2f')]=_[_0x0c48('0x2e')](_0x162cd9[_0x0c48('0x2b')],qs[_0x0c48('0x30')](_0xcfcb72['query'][_0x0c48('0x30')]));_0x2a418a[_0x0c48('0x2f')]=_0x2a418a[_0x0c48('0x2f')][_0x0c48('0x31')]?_0x2a418a[_0x0c48('0x2f')]:_0x162cd9[_0x0c48('0x2b')];if(!_0xcfcb72[_0x0c48('0x2c')][_0x0c48('0x32')]('nolimit')){_0x2a418a[_0x0c48('0x1e')]=qs[_0x0c48('0x1e')](_0xcfcb72[_0x0c48('0x2c')][_0x0c48('0x1e')]);_0x2a418a[_0x0c48('0x1c')]=qs[_0x0c48('0x1c')](_0xcfcb72[_0x0c48('0x2c')]['offset']);}_0x2a418a['order']=qs['sort'](_0xcfcb72[_0x0c48('0x2c')][_0x0c48('0x33')]);_0x2a418a[_0x0c48('0x34')]=qs[_0x0c48('0x2d')](_['pick'](_0xcfcb72[_0x0c48('0x2c')],_0x162cd9[_0x0c48('0x2d')]),_0x4843d8);if(_0xcfcb72[_0x0c48('0x2c')][_0x0c48('0x35')]){_0x2a418a[_0x0c48('0x34')]=_[_0x0c48('0x36')](_0x2a418a[_0x0c48('0x34')],{'$or':_[_0x0c48('0x25')](_0x4843d8,function(_0x3061fe){if(_0x3061fe[_0x0c48('0x29')]!==_0x0c48('0x37')){var _0x315874={};_0x315874[_0x3061fe[_0x0c48('0x23')]]={'$like':'%'+_0xcfcb72[_0x0c48('0x2c')][_0x0c48('0x35')]+'%'};return _0x315874;}})});}_0x2a418a=_['merge']({},_0x2a418a,_0xcfcb72[_0x0c48('0x38')]);var _0x504268={'where':_0x2a418a[_0x0c48('0x34')]};return db[_0x0c48('0x26')][_0x0c48('0x1d')](_0x504268)[_0x0c48('0x21')](function(_0x2ee7dd){_0x293141[_0x0c48('0x1d')]=_0x2ee7dd;if(_0xcfcb72[_0x0c48('0x2c')][_0x0c48('0x39')]){_0x2a418a['include']=[{'all':!![]}];}return db[_0x0c48('0x26')][_0x0c48('0x3a')](_0x2a418a);})[_0x0c48('0x21')](function(_0x2e1b26){_0x293141[_0x0c48('0x3b')]=_0x2e1b26;return _0x293141;})[_0x0c48('0x21')](respondWithFilteredResult(_0xff3f34,_0x2a418a))[_0x0c48('0x3c')](handleError(_0xff3f34,null));};exports[_0x0c48('0x3d')]=function(_0x2320e5,_0x2c9c94){var _0x2d2923={'raw':!![],'where':{'id':_0x2320e5[_0x0c48('0x3e')]['id']}},_0x5afae2={};_0x5afae2['model']=_[_0x0c48('0x3f')](db[_0x0c48('0x26')][_0x0c48('0x27')]);_0x5afae2[_0x0c48('0x2c')]=_[_0x0c48('0x3f')](_0x2320e5[_0x0c48('0x2c')]);_0x5afae2['filters']=_[_0x0c48('0x2e')](_0x5afae2[_0x0c48('0x2b')],_0x5afae2['query']);_0x2d2923[_0x0c48('0x2f')]=_[_0x0c48('0x2e')](_0x5afae2[_0x0c48('0x2b')],qs[_0x0c48('0x30')](_0x2320e5[_0x0c48('0x2c')][_0x0c48('0x30')]));_0x2d2923[_0x0c48('0x2f')]=_0x2d2923[_0x0c48('0x2f')][_0x0c48('0x31')]?_0x2d2923[_0x0c48('0x2f')]:_0x5afae2[_0x0c48('0x2b')];if(_0x2320e5[_0x0c48('0x2c')][_0x0c48('0x39')]){_0x2d2923['include']=[{'all':!![]}];}_0x2d2923=_[_0x0c48('0x36')]({},_0x2d2923,_0x2320e5['options']);return db[_0x0c48('0x26')][_0x0c48('0x40')](_0x2d2923)['then'](handleEntityNotFound(_0x2c9c94,null))[_0x0c48('0x21')](respondWithResult(_0x2c9c94,null))[_0x0c48('0x3c')](handleError(_0x2c9c94,null));};exports[_0x0c48('0x20')]=function(_0x26d974,_0xf1da6a){if(_0x26d974[_0x0c48('0x41')]['id']){delete _0x26d974[_0x0c48('0x41')]['id'];}return db[_0x0c48('0x26')][_0x0c48('0x40')]({'where':{'id':_0x26d974['params']['id']}})[_0x0c48('0x21')](handleEntityNotFound(_0xf1da6a,null))[_0x0c48('0x21')](saveUpdates(_0x26d974[_0x0c48('0x41')],null))[_0x0c48('0x21')](respondWithResult(_0xf1da6a,null))[_0x0c48('0x3c')](handleError(_0xf1da6a,null));};exports[_0x0c48('0x42')]=function(_0x20239a,_0x449e6a){return db['CmHopperBlack'][_0x0c48('0x40')]({'where':{'id':_0x20239a[_0x0c48('0x3e')]['id']}})[_0x0c48('0x21')](handleEntityNotFound(_0x449e6a,null))[_0x0c48('0x21')](removeEntity(_0x449e6a,null))[_0x0c48('0x3c')](handleError(_0x449e6a,null));};exports['describe']=function(_0x2b966e,_0x500cdb){return db[_0x0c48('0x26')][_0x0c48('0x43')]()[_0x0c48('0x21')](respondWithResult(_0x500cdb,null))[_0x0c48('0x3c')](handleError(_0x500cdb,null));}; \ No newline at end of file +var _0xe596=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','reject','save','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xe596,0x1b1));var _0x6e59=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe596[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6e59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e59('0x1'));var jsonpatch=require(_0x6e59('0x2'));var rp=require(_0x6e59('0x3'));var moment=require(_0x6e59('0x4'));var BPromise=require(_0x6e59('0x5'));var Mustache=require(_0x6e59('0x6'));var util=require(_0x6e59('0x7'));var path=require(_0x6e59('0x8'));var sox=require(_0x6e59('0x9'));var csv=require('to-csv');var ejs=require(_0x6e59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e59('0xb'));var squel=require(_0x6e59('0xc'));var crypto=require('crypto');var jsforce=require(_0x6e59('0xd'));var deskjs=require(_0x6e59('0xe'));var toCsv=require(_0x6e59('0xf'));var querystring=require(_0x6e59('0x10'));var Papa=require(_0x6e59('0x11'));var Redis=require(_0x6e59('0x12'));var authService=require(_0x6e59('0x13'));var qs=require(_0x6e59('0x14'));var as=require(_0x6e59('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e59('0x16'))(_0x6e59('0x17'));var utils=require(_0x6e59('0x18'));var config=require(_0x6e59('0x19'));var licenseUtil=require(_0x6e59('0x1a'));var db=require(_0x6e59('0x1b'))['db'];function respondWithStatusCode(_0x107e33,_0x35b242){_0x35b242=_0x35b242||0xcc;return function(_0x447be8){if(_0x447be8){return _0x107e33[_0x6e59('0x1c')](_0x35b242);}return _0x107e33[_0x6e59('0x1d')](_0x35b242)[_0x6e59('0x1e')]();};}function respondWithResult(_0xad44a5,_0x1854d){_0x1854d=_0x1854d||0xc8;return function(_0x1aab95){if(_0x1aab95){return _0xad44a5[_0x6e59('0x1d')](_0x1854d)[_0x6e59('0x1f')](_0x1aab95);}};}function respondWithFilteredResult(_0x136b10,_0x38493e){return function(_0x28980b){if(_0x28980b){var _0x4d9538=typeof _0x38493e['offset']===_0x6e59('0x20')&&typeof _0x38493e['limit']==='undefined';var _0x25348d=_0x28980b[_0x6e59('0x21')];var _0x2f5302=_0x4d9538?0x0:_0x38493e[_0x6e59('0x22')];var _0x5a7fcb=_0x4d9538?_0x28980b[_0x6e59('0x21')]:_0x38493e['offset']+_0x38493e['limit'];var _0x34f084;if(_0x5a7fcb>=_0x25348d){_0x5a7fcb=_0x25348d;_0x34f084=0xc8;}else{_0x34f084=0xce;}_0x136b10[_0x6e59('0x1d')](_0x34f084);return _0x136b10[_0x6e59('0x23')]('Content-Range',_0x2f5302+'-'+_0x5a7fcb+'/'+_0x25348d)[_0x6e59('0x1f')](_0x28980b);}return null;};}function patchUpdates(_0x5cb05b){return function(_0x3b05fb){try{jsonpatch['apply'](_0x3b05fb,_0x5cb05b,!![]);}catch(_0x3ab5c4){return BPromise[_0x6e59('0x24')](_0x3ab5c4);}return _0x3b05fb[_0x6e59('0x25')]();};}function saveUpdates(_0x3ce7a2,_0x11bcd0){return function(_0x4eb36b){if(_0x4eb36b){return _0x4eb36b['update'](_0x3ce7a2)[_0x6e59('0x26')](function(_0x548cc8){return _0x548cc8;});}return null;};}function removeEntity(_0x2fb587,_0x173a83){return function(_0x39efbe){if(_0x39efbe){return _0x39efbe[_0x6e59('0x27')]()[_0x6e59('0x26')](function(){_0x2fb587[_0x6e59('0x1d')](0xcc)[_0x6e59('0x1e')]();});}};}function handleEntityNotFound(_0xa9383f,_0x4602b1){return function(_0x56fa5d){if(!_0x56fa5d){_0xa9383f[_0x6e59('0x1c')](0x194);}return _0x56fa5d;};}function handleError(_0x1f3e6c,_0x4204b2){_0x4204b2=_0x4204b2||0x1f4;return function(_0x428a51){logger[_0x6e59('0x28')](_0x428a51[_0x6e59('0x29')]);if(_0x428a51[_0x6e59('0x2a')]){delete _0x428a51['name'];}_0x1f3e6c['status'](_0x4204b2)[_0x6e59('0x2b')](_0x428a51);};}exports[_0x6e59('0x2c')]=function(_0x1feb0f,_0x4ce586){var _0x2bd515={},_0x566adb={},_0x233de9={'count':0x0,'rows':[]};var _0xcab3db=_['map'](db[_0x6e59('0x2d')][_0x6e59('0x2e')],function(_0x109531){return{'name':_0x109531[_0x6e59('0x2f')],'type':_0x109531[_0x6e59('0x30')][_0x6e59('0x31')]};});_0x566adb[_0x6e59('0x32')]=_[_0x6e59('0x33')](_0xcab3db,_0x6e59('0x2a'));_0x566adb[_0x6e59('0x34')]=_[_0x6e59('0x35')](_0x1feb0f[_0x6e59('0x34')]);_0x566adb[_0x6e59('0x36')]=_[_0x6e59('0x37')](_0x566adb[_0x6e59('0x32')],_0x566adb[_0x6e59('0x34')]);_0x2bd515[_0x6e59('0x38')]=_[_0x6e59('0x37')](_0x566adb[_0x6e59('0x32')],qs['fields'](_0x1feb0f[_0x6e59('0x34')][_0x6e59('0x39')]));_0x2bd515[_0x6e59('0x38')]=_0x2bd515[_0x6e59('0x38')][_0x6e59('0x3a')]?_0x2bd515[_0x6e59('0x38')]:_0x566adb[_0x6e59('0x32')];if(!_0x1feb0f[_0x6e59('0x34')]['hasOwnProperty']('nolimit')){_0x2bd515[_0x6e59('0x3b')]=qs[_0x6e59('0x3b')](_0x1feb0f[_0x6e59('0x34')][_0x6e59('0x3b')]);_0x2bd515[_0x6e59('0x22')]=qs['offset'](_0x1feb0f[_0x6e59('0x34')]['offset']);}_0x2bd515[_0x6e59('0x3c')]=qs[_0x6e59('0x3d')](_0x1feb0f[_0x6e59('0x34')]['sort']);_0x2bd515[_0x6e59('0x3e')]=qs['filters'](_['pick'](_0x1feb0f[_0x6e59('0x34')],_0x566adb['filters']),_0xcab3db);if(_0x1feb0f['query'][_0x6e59('0x3f')]){_0x2bd515[_0x6e59('0x3e')]=_[_0x6e59('0x40')](_0x2bd515['where'],{'$or':_[_0x6e59('0x33')](_0xcab3db,function(_0x24ff03){if(_0x24ff03[_0x6e59('0x30')]!=='VIRTUAL'){var _0x1b3728={};_0x1b3728[_0x24ff03['name']]={'$like':'%'+_0x1feb0f['query'][_0x6e59('0x3f')]+'%'};return _0x1b3728;}})});}_0x2bd515=_['merge']({},_0x2bd515,_0x1feb0f['options']);var _0xbce8={'where':_0x2bd515[_0x6e59('0x3e')]};return db[_0x6e59('0x2d')]['count'](_0xbce8)['then'](function(_0x1fe0c5){_0x233de9[_0x6e59('0x21')]=_0x1fe0c5;if(_0x1feb0f['query'][_0x6e59('0x41')]){_0x2bd515['include']=[{'all':!![]}];}return db[_0x6e59('0x2d')][_0x6e59('0x42')](_0x2bd515);})['then'](function(_0x3f7238){_0x233de9[_0x6e59('0x43')]=_0x3f7238;return _0x233de9;})[_0x6e59('0x26')](respondWithFilteredResult(_0x4ce586,_0x2bd515))[_0x6e59('0x44')](handleError(_0x4ce586,null));};exports[_0x6e59('0x45')]=function(_0x9599fd,_0x5dca60){var _0x2ec8d4={'raw':!![],'where':{'id':_0x9599fd['params']['id']}},_0xfb3ff9={};_0xfb3ff9['model']=_[_0x6e59('0x35')](db[_0x6e59('0x2d')][_0x6e59('0x2e')]);_0xfb3ff9['query']=_[_0x6e59('0x35')](_0x9599fd[_0x6e59('0x34')]);_0xfb3ff9[_0x6e59('0x36')]=_[_0x6e59('0x37')](_0xfb3ff9[_0x6e59('0x32')],_0xfb3ff9['query']);_0x2ec8d4[_0x6e59('0x38')]=_[_0x6e59('0x37')](_0xfb3ff9[_0x6e59('0x32')],qs['fields'](_0x9599fd[_0x6e59('0x34')][_0x6e59('0x39')]));_0x2ec8d4[_0x6e59('0x38')]=_0x2ec8d4[_0x6e59('0x38')][_0x6e59('0x3a')]?_0x2ec8d4['attributes']:_0xfb3ff9['model'];if(_0x9599fd[_0x6e59('0x34')][_0x6e59('0x41')]){_0x2ec8d4['include']=[{'all':!![]}];}_0x2ec8d4=_[_0x6e59('0x40')]({},_0x2ec8d4,_0x9599fd[_0x6e59('0x46')]);return db[_0x6e59('0x2d')][_0x6e59('0x47')](_0x2ec8d4)[_0x6e59('0x26')](handleEntityNotFound(_0x5dca60,null))[_0x6e59('0x26')](respondWithResult(_0x5dca60,null))[_0x6e59('0x44')](handleError(_0x5dca60,null));};exports['update']=function(_0x1ed749,_0x325160){if(_0x1ed749[_0x6e59('0x48')]['id']){delete _0x1ed749['body']['id'];}return db[_0x6e59('0x2d')][_0x6e59('0x47')]({'where':{'id':_0x1ed749[_0x6e59('0x49')]['id']}})['then'](handleEntityNotFound(_0x325160,null))[_0x6e59('0x26')](saveUpdates(_0x1ed749[_0x6e59('0x48')],null))[_0x6e59('0x26')](respondWithResult(_0x325160,null))[_0x6e59('0x44')](handleError(_0x325160,null));};exports[_0x6e59('0x27')]=function(_0x1afc64,_0x4a1cab){return db['CmHopperBlack'][_0x6e59('0x47')]({'where':{'id':_0x1afc64[_0x6e59('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a1cab,null))[_0x6e59('0x26')](removeEntity(_0x4a1cab,null))[_0x6e59('0x44')](handleError(_0x4a1cab,null));};exports[_0x6e59('0x4a')]=function(_0x3876d6,_0x2c9522){return db[_0x6e59('0x2d')][_0x6e59('0x4a')]()[_0x6e59('0x26')](respondWithResult(_0x2c9522,null))['catch'](handleError(_0x2c9522,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b007805..29c987f 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 _0x4c2c=['bluebird','request-promise','path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x4c2c,0xe0));var _0xc4c2=function(_0x4cd7bd,_0x33b3e1){_0x4cd7bd=_0x4cd7bd-0x0;var _0x3833b7=_0x4c2c[_0x4cd7bd];return _0x3833b7;};'use strict';var _=require(_0xc4c2('0x0'));var util=require(_0xc4c2('0x1'));var logger=require(_0xc4c2('0x2'))('api');var moment=require(_0xc4c2('0x3'));var BPromise=require(_0xc4c2('0x4'));var rp=require(_0xc4c2('0x5'));var fs=require('fs');var path=require(_0xc4c2('0x6'));var rimraf=require(_0xc4c2('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xc4c2('0x8')]=function(_0xc2a6f8,_0x1422c5){return _0xc2a6f8[_0xc4c2('0x9')](_0xc4c2('0xa'),attributes,{'tableName':_0xc4c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b3d=['CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x441874,_0x292fdb){var _0x357378=function(_0x3df16a){while(--_0x3df16a){_0x441874['push'](_0x441874['shift']());}};_0x357378(++_0x292fdb);}(_0x3b3d,0x1ee));var _0xd3b3=function(_0x45b55e,_0x3213a0){_0x45b55e=_0x45b55e-0x0;var _0x437be0=_0x3b3d[_0x45b55e];return _0x437be0;};'use strict';var _=require(_0xd3b3('0x0'));var util=require('util');var logger=require(_0xd3b3('0x1'))(_0xd3b3('0x2'));var moment=require('moment');var BPromise=require(_0xd3b3('0x3'));var rp=require(_0xd3b3('0x4'));var fs=require('fs');var path=require(_0xd3b3('0x5'));var rimraf=require(_0xd3b3('0x6'));var config=require(_0xd3b3('0x7'));var attributes=require(_0xd3b3('0x8'));module[_0xd3b3('0x9')]=function(_0x176215,_0xe8efde){return _0x176215['define'](_0xd3b3('0xa'),attributes,{'tableName':_0xd3b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index c91ffbe..93cd345 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 _0x74aa=['then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','update','raw','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x32e758,_0x13c271){var _0x349316=function(_0x27a9da){while(--_0x27a9da){_0x32e758['push'](_0x32e758['shift']());}};_0x349316(++_0x13c271);}(_0x74aa,0x1a1));var _0xa74a=function(_0x4d0086,_0xd05b7c){_0x4d0086=_0x4d0086-0x0;var _0x485cab=_0x74aa[_0x4d0086];return _0x485cab;};'use strict';var _=require(_0xa74a('0x0'));var util=require(_0xa74a('0x1'));var moment=require(_0xa74a('0x2'));var BPromise=require(_0xa74a('0x3'));var rs=require(_0xa74a('0x4'));var fs=require('fs');var Redis=require(_0xa74a('0x5'));var db=require(_0xa74a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa74a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa74a('0x8'));var client=jayson[_0xa74a('0x9')][_0xa74a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c639,_0x228d22,_0x30ce27){return new BPromise(function(_0x4ee7b5,_0x43f11e){return client[_0xa74a('0xb')](_0x47c639,_0x30ce27)[_0xa74a('0xc')](function(_0x12df5e){logger[_0xa74a('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x228d22,_0xa74a('0xe'));logger['debug'](_0xa74a('0xf'),_0x228d22,_0xa74a('0xe'),JSON[_0xa74a('0x10')](_0x12df5e));if(_0x12df5e['error']){if(_0x12df5e[_0xa74a('0x11')][_0xa74a('0x12')]===0x1f4){logger[_0xa74a('0x11')](_0xa74a('0x13'),_0x228d22,_0x12df5e[_0xa74a('0x11')]['message']);return _0x43f11e(_0x12df5e['error']['message']);}logger[_0xa74a('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x228d22,_0x12df5e[_0xa74a('0x11')][_0xa74a('0x14')]);return _0x4ee7b5(_0x12df5e[_0xa74a('0x11')][_0xa74a('0x14')]);}else{logger['info'](_0xa74a('0x13'),_0x228d22,'request\x20sent');_0x4ee7b5(_0x12df5e[_0xa74a('0x15')][_0xa74a('0x14')]);}})[_0xa74a('0x16')](function(_0x5ccc68){logger['error'](_0xa74a('0x13'),_0x228d22,_0x5ccc68);_0x43f11e(_0x5ccc68);});});}exports[_0xa74a('0x17')]=function(_0x4f1de4){var _0x5377f1=this;return new Promise(function(_0x13d5b0,_0x3214e5){return db[_0xa74a('0x18')][_0xa74a('0x19')]({'raw':_0x4f1de4[_0xa74a('0x1a')]?_0x4f1de4[_0xa74a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f1de4[_0xa74a('0x1a')]?_0x4f1de4[_0xa74a('0x1a')]['where']||null:null,'attributes':_0x4f1de4[_0xa74a('0x1a')]?_0x4f1de4[_0xa74a('0x1a')][_0xa74a('0x1b')]||null:null,'limit':_0x4f1de4[_0xa74a('0x1a')]?_0x4f1de4['options'][_0xa74a('0x1c')]||null:null,'include':_0x4f1de4[_0xa74a('0x1a')]?_0x4f1de4[_0xa74a('0x1a')][_0xa74a('0x1d')]?_[_0xa74a('0x1e')](_0x4f1de4['options'][_0xa74a('0x1d')],function(_0x1cb852){return{'model':db[_0x1cb852[_0xa74a('0x1f')]],'as':_0x1cb852['as'],'attributes':_0x1cb852['attributes'],'include':_0x1cb852[_0xa74a('0x1d')]?_[_0xa74a('0x1e')](_0x1cb852[_0xa74a('0x1d')],function(_0x41dee7){return{'model':db[_0x41dee7[_0xa74a('0x1f')]],'as':_0x41dee7['as'],'attributes':_0x41dee7['attributes'],'include':_0x41dee7['include']?_[_0xa74a('0x1e')](_0x41dee7['include'],function(_0x5cf8dc){return{'model':db[_0x5cf8dc[_0xa74a('0x1f')]],'as':_0x5cf8dc['as'],'attributes':_0x5cf8dc['attributes']};}):[]};}):[]};}):[]:[]})[_0xa74a('0xc')](function(_0x2f7aca){logger[_0xa74a('0xd')](_0xa74a('0x17'),_0x4f1de4);logger[_0xa74a('0x20')](_0xa74a('0x17'),_0x4f1de4,JSON[_0xa74a('0x10')](_0x2f7aca));_0x13d5b0(_0x2f7aca);})[_0xa74a('0x16')](function(_0x3769ef){logger[_0xa74a('0x11')]('GetCmHopperBlack',_0x3769ef[_0xa74a('0x14')],_0x4f1de4);_0x3214e5(_0x5377f1[_0xa74a('0x11')](0x1f4,_0x3769ef['message']));});});};exports[_0xa74a('0x21')]=function(_0x2bb10e){var _0x3adeed=this;return new Promise(function(_0x18bb1a,_0x505e70){return db[_0xa74a('0x18')][_0xa74a('0x22')](_0x2bb10e['body'],{'raw':_0x2bb10e[_0xa74a('0x1a')]?_0x2bb10e['options'][_0xa74a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bb10e[_0xa74a('0x1a')]?_0x2bb10e[_0xa74a('0x1a')][_0xa74a('0x24')]||null:null,'attributes':_0x2bb10e['options']?_0x2bb10e[_0xa74a('0x1a')]['attributes']||null:null,'limit':_0x2bb10e[_0xa74a('0x1a')]?_0x2bb10e[_0xa74a('0x1a')][_0xa74a('0x1c')]||null:null})[_0xa74a('0xc')](function(_0x5589ce){logger[_0xa74a('0xd')](_0xa74a('0x21'),_0x2bb10e);logger[_0xa74a('0x20')](_0xa74a('0x21'),_0x2bb10e,JSON[_0xa74a('0x10')](_0x5589ce));_0x18bb1a(_0x5589ce);})['catch'](function(_0x213714){logger[_0xa74a('0x11')](_0xa74a('0x21'),_0x213714[_0xa74a('0x14')],_0x2bb10e);_0x505e70(_0x3adeed['error'](0x1f4,_0x213714[_0xa74a('0x14')]));});});};exports[_0xa74a('0x25')]=function(_0x41c648){var _0x2a3887=this;return new Promise(function(_0x146b24,_0x31e5a1){return db[_0xa74a('0x18')][_0xa74a('0x26')]({'where':_0x41c648['options']?_0x41c648[_0xa74a('0x1a')]['where']||null:null})[_0xa74a('0xc')](function(_0x2cd16d){logger[_0xa74a('0xd')](_0xa74a('0x25'),_0x41c648);logger['debug'](_0xa74a('0x25'),_0x41c648,JSON[_0xa74a('0x10')](_0x2cd16d));_0x146b24(_0x2cd16d);})[_0xa74a('0x16')](function(_0x40b7ee){logger[_0xa74a('0x11')](_0xa74a('0x25'),_0x40b7ee[_0xa74a('0x14')],_0x41c648);_0x31e5a1(_0x2a3887['error'](0x1f4,_0x40b7ee[_0xa74a('0x14')]));});});}; \ No newline at end of file +var _0x78af=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map','model','include','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78af,0x1e4));var _0xf78a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x78af[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xf78a('0x0'));var util=require('util');var moment=require(_0xf78a('0x1'));var BPromise=require(_0xf78a('0x2'));var rs=require(_0xf78a('0x3'));var fs=require('fs');var Redis=require(_0xf78a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf78a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf78a('0x6'));var jayson=require(_0xf78a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26b6c3,_0x573cbd,_0x58a26e){return new BPromise(function(_0x278635,_0x14022d){return client[_0xf78a('0x8')](_0x26b6c3,_0x58a26e)[_0xf78a('0x9')](function(_0x23beec){logger['info'](_0xf78a('0xa'),_0x573cbd,_0xf78a('0xb'));logger[_0xf78a('0xc')](_0xf78a('0xd'),_0x573cbd,_0xf78a('0xb'),JSON[_0xf78a('0xe')](_0x23beec));if(_0x23beec[_0xf78a('0xf')]){if(_0x23beec[_0xf78a('0xf')][_0xf78a('0x10')]===0x1f4){logger[_0xf78a('0xf')](_0xf78a('0xa'),_0x573cbd,_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);return _0x14022d(_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);}logger[_0xf78a('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x573cbd,_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);return _0x278635(_0x23beec[_0xf78a('0xf')][_0xf78a('0x11')]);}else{logger[_0xf78a('0x12')](_0xf78a('0xa'),_0x573cbd,_0xf78a('0xb'));_0x278635(_0x23beec[_0xf78a('0x13')][_0xf78a('0x11')]);}})[_0xf78a('0x14')](function(_0x4fc5ef){logger[_0xf78a('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x573cbd,_0x4fc5ef);_0x14022d(_0x4fc5ef);});});}exports[_0xf78a('0x15')]=function(_0x252c6c){var _0x54fec0=this;return new Promise(function(_0x89634c,_0x591734){return db[_0xf78a('0x16')][_0xf78a('0x17')]({'raw':_0x252c6c[_0xf78a('0x18')]?_0x252c6c['options'][_0xf78a('0x19')]===undefined?!![]:![]:!![],'where':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')][_0xf78a('0x1a')]||null:null,'attributes':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')][_0xf78a('0x1b')]||null:null,'limit':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')][_0xf78a('0x1c')]||null:null,'include':_0x252c6c[_0xf78a('0x18')]?_0x252c6c[_0xf78a('0x18')]['include']?_[_0xf78a('0x1d')](_0x252c6c[_0xf78a('0x18')]['include'],function(_0x1283f7){return{'model':db[_0x1283f7[_0xf78a('0x1e')]],'as':_0x1283f7['as'],'attributes':_0x1283f7[_0xf78a('0x1b')],'include':_0x1283f7[_0xf78a('0x1f')]?_[_0xf78a('0x1d')](_0x1283f7['include'],function(_0x45d2b9){return{'model':db[_0x45d2b9[_0xf78a('0x1e')]],'as':_0x45d2b9['as'],'attributes':_0x45d2b9[_0xf78a('0x1b')],'include':_0x45d2b9['include']?_[_0xf78a('0x1d')](_0x45d2b9[_0xf78a('0x1f')],function(_0x19d576){return{'model':db[_0x19d576[_0xf78a('0x1e')]],'as':_0x19d576['as'],'attributes':_0x19d576[_0xf78a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf78a('0x9')](function(_0x4a4573){logger['info']('GetCmHopperBlack',_0x252c6c);logger[_0xf78a('0xc')](_0xf78a('0x15'),_0x252c6c,JSON[_0xf78a('0xe')](_0x4a4573));_0x89634c(_0x4a4573);})['catch'](function(_0x2935ca){logger[_0xf78a('0xf')](_0xf78a('0x15'),_0x2935ca['message'],_0x252c6c);_0x591734(_0x54fec0[_0xf78a('0xf')](0x1f4,_0x2935ca[_0xf78a('0x11')]));});});};exports[_0xf78a('0x20')]=function(_0x13ddde){var _0x2dee6b=this;return new Promise(function(_0x1752d8,_0xee6f28){return db['CmHopperBlack'][_0xf78a('0x21')](_0x13ddde[_0xf78a('0x22')],{'raw':_0x13ddde['options']?_0x13ddde['options'][_0xf78a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13ddde[_0xf78a('0x18')]?_0x13ddde['options']['where']||null:null,'attributes':_0x13ddde['options']?_0x13ddde['options'][_0xf78a('0x1b')]||null:null,'limit':_0x13ddde['options']?_0x13ddde['options'][_0xf78a('0x1c')]||null:null})[_0xf78a('0x9')](function(_0x51b345){logger['info'](_0xf78a('0x20'),_0x13ddde);logger[_0xf78a('0xc')](_0xf78a('0x20'),_0x13ddde,JSON[_0xf78a('0xe')](_0x51b345));_0x1752d8(_0x51b345);})[_0xf78a('0x14')](function(_0x190ed5){logger[_0xf78a('0xf')](_0xf78a('0x20'),_0x190ed5[_0xf78a('0x11')],_0x13ddde);_0xee6f28(_0x2dee6b[_0xf78a('0xf')](0x1f4,_0x190ed5[_0xf78a('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x5a2f79){var _0x23ba71=this;return new Promise(function(_0x595bff,_0x1d1cb6){return db[_0xf78a('0x16')]['destroy']({'where':_0x5a2f79[_0xf78a('0x18')]?_0x5a2f79[_0xf78a('0x18')][_0xf78a('0x1a')]||null:null})['then'](function(_0x18ab18){logger[_0xf78a('0x12')](_0xf78a('0x23'),_0x5a2f79);logger[_0xf78a('0xc')]('DestroyCmHopperBlack',_0x5a2f79,JSON['stringify'](_0x18ab18));_0x595bff(_0x18ab18);})[_0xf78a('0x14')](function(_0x5651a6){logger[_0xf78a('0xf')](_0xf78a('0x23'),_0x5651a6[_0xf78a('0x11')],_0x5a2f79);_0x1d1cb6(_0x23ba71[_0xf78a('0xf')](0x1f4,_0x5651a6[_0xf78a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7b55389..a5e9ad6 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 _0xacf4=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','put','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0xacf4,0xe7));var _0x4acf=function(_0x2df805,_0x8ae564){_0x2df805=_0x2df805-0x0;var _0x2c1a80=_0xacf4[_0x2df805];return _0x2c1a80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0xd')](_0x4acf('0xe'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0xf')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0x10')]=router; \ No newline at end of file +var _0x3d04=['show','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id'];(function(_0x92c03c,_0x413eca){var _0x5bd89d=function(_0x15ff21){while(--_0x15ff21){_0x92c03c['push'](_0x92c03c['shift']());}};_0x5bd89d(++_0x413eca);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['put']('/:id',auth[_0x43d0('0xb')](),controller['update']);router['delete'](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xf')]);module[_0x43d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9d83794..2e8b4a9 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 _0x07b0=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','diff','seconds','BOOLEAN'];(function(_0x54783e,_0xe85a52){var _0x4b03f4=function(_0x4095ba){while(--_0x4095ba){_0x54783e['push'](_0x54783e['shift']());}};_0x4b03f4(++_0xe85a52);}(_0x07b0,0x1dd));var _0x007b=function(_0x29cc17,_0x14aab3){_0x29cc17=_0x29cc17-0x0;var _0x37501a=_0x07b0[_0x29cc17];return _0x37501a;};'use strict';var Sequelize=require(_0x007b('0x0'));var moment=require(_0x007b('0x1'));module['exports']={'state':{'type':Sequelize[_0x007b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x007b('0x3')]},'scheduledat':{'type':Sequelize[_0x007b('0x4')]},'countbusyretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x007b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x007b('0x3')]},'originatecalleridname':{'type':Sequelize[_0x007b('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x007b('0x3')]},'starttime':{'type':Sequelize[_0x007b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x007b('0x4')]},'ringtime':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x007b('0x3')]},'campaign':{'type':Sequelize[_0x007b('0x3')]},'campaigntype':{'type':Sequelize[_0x007b('0x3')]},'membername':{'type':Sequelize[_0x007b('0x3')]},'reason':{'type':Sequelize[_0x007b('0x3')]},'disposition':{'type':Sequelize[_0x007b('0x3')]},'secondDisposition':{'type':Sequelize[_0x007b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x007b('0x3')]},'dispositionat':{'type':Sequelize[_0x007b('0x4')],'set':function(_0x3cc45a){var _0x1cb633=this[_0x007b('0x5')]('endtime');if(_0x1cb633&&_0x3cc45a){this['setDataValue']('followuptime',moment(_0x3cc45a)[_0x007b('0x6')](moment(_0x1cb633),_0x007b('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x007b('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x007b('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x007b('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x007b('0x4')]},'callback':{'type':Sequelize[_0x007b('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x007b('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x007b('0x4')]},'recallme':{'type':Sequelize[_0x007b('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x007b('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x007b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa016=['setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime'];(function(_0x61115c,_0x221d6f){var _0x465b64=function(_0x2bdb07){while(--_0x2bdb07){_0x61115c['push'](_0x61115c['shift']());}};_0x465b64(++_0x221d6f);}(_0xa016,0x72));var _0x6a01=function(_0x4fd37b,_0x4a6ee6){_0x4fd37b=_0x4fd37b-0x0;var _0x1b4ea1=_0xa016[_0x4fd37b];return _0x1b4ea1;};'use strict';var Sequelize=require(_0x6a01('0x0'));var moment=require(_0x6a01('0x1'));module[_0x6a01('0x2')]={'state':{'type':Sequelize[_0x6a01('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6a01('0x4')]},'scheduledat':{'type':Sequelize[_0x6a01('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x6a01('0x4')]},'calleridnum':{'type':Sequelize[_0x6a01('0x4')]},'calleridname':{'type':Sequelize[_0x6a01('0x4')]},'starttime':{'type':Sequelize[_0x6a01('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6a01('0x5')]},'droptime':{'type':Sequelize[_0x6a01('0x5')]},'endtime':{'type':Sequelize[_0x6a01('0x5')]},'ringtime':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6a01('0x4')]},'campaign':{'type':Sequelize[_0x6a01('0x4')]},'campaigntype':{'type':Sequelize[_0x6a01('0x4')]},'membername':{'type':Sequelize[_0x6a01('0x4')]},'reason':{'type':Sequelize[_0x6a01('0x4')]},'disposition':{'type':Sequelize[_0x6a01('0x4')]},'secondDisposition':{'type':Sequelize[_0x6a01('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6a01('0x5')],'set':function(_0x506f4b){var _0x2d1579=this['getDataValue'](_0x6a01('0x6'));if(_0x2d1579&&_0x506f4b){this[_0x6a01('0x7')](_0x6a01('0x8'),moment(_0x506f4b)[_0x6a01('0x9')](moment(_0x2d1579),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6a01('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6a01('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6a01('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6a01('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6a01('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6a01('0x5')]},'deleted':{'type':Sequelize[_0x6a01('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6a01('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6a01('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6a01('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index c4126f9..fc2216a 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 _0x781d=['length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x4b4844,_0x2f0dfb){var _0x575192=function(_0x13ee1b){while(--_0x13ee1b){_0x4b4844['push'](_0x4b4844['shift']());}};_0x575192(++_0x2f0dfb);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['describe']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['describe']()[_0xd781('0x26')](respondWithResult(_0x16d16e,null))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x39ecdb,_0x336d30){if(_0x39ecdb[_0xd781('0x44')][_0xd781('0x45')]){delete _0x39ecdb['body'][_0xd781('0x45')];}return db[_0xd781('0x2c')][_0xd781('0x46')]({'where':{'uniqueid':_0x39ecdb['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x336d30,null))[_0xd781('0x26')](saveUpdates(_0x39ecdb['body'],null))[_0xd781('0x26')](respondWithResult(_0x336d30,null))[_0xd781('0x3f')](handleError(_0x336d30,null));};exports[_0xd781('0x47')]=function(_0x207546,_0x42a2f9,_0x599915){return db[_0xd781('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x207546[_0xd781('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xd781('0x4b')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xd781('0x4c')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal'](_0xd781('0x4f')))),_0xd781('0x50')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd781('0x53')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x54')))),_0xd781('0x55')]]})['then'](handleEntityNotFound(_0x42a2f9,null))[_0xd781('0x26')](respondWithResult(_0x42a2f9,null))[_0xd781('0x3f')](handleError(_0x42a2f9,null));};exports[_0xd781('0x56')]=function(_0x2c4874,_0x2e8bab,_0x38bd3e){return db[_0xd781('0x2c')][_0xd781('0x57')]({'raw':![],'where':{'CampaignId':_0x2c4874[_0xd781('0x41')]['id']},'attributes':[[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x58')))),_0xd781('0x59')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5a')))),_0xd781('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4f')))),_0xd781('0x50')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5b')))),_0xd781('0x53')],[db['sequelize']['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xd781('0x26')](handleEntityNotFound(_0x2e8bab,null))[_0xd781('0x26')](respondWithResult(_0x2e8bab,null))[_0xd781('0x3f')](handleError(_0x2e8bab,null));};exports[_0xd781('0x5c')]=function(_0x26a0a9,_0x172a05,_0x2e0401){return db[_0xd781('0x5d')][_0xd781('0x46')]({'where':{'id':_0x26a0a9['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x172a05,null))[_0xd781('0x26')](function(_0x4c712f){var _0x24e3f5;if(_0x4c712f){_0x24e3f5=squel['insert']()[_0xd781('0x5e')](_0xd781('0x5f'))['fromQuery'](['phone',_0xd781('0x60'),_0xd781('0x61'),_0xd781('0x62'),_0xd781('0x63'),_0xd781('0x64'),_0xd781('0x65')],squel['select']()[_0xd781('0x66')](_0xd781('0x67'),_0xd781('0x68'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),'ListId')[_0xd781('0x66')]('ANY_VALUE(VoiceQueueId)',_0xd781('0x63'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x65'))[_0xd781('0x6c')](_0xd781('0x6d'))[_0xd781('0x39')]('VoiceQueueId\x20=\x20?',_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]())['where'](_0xd781('0x6f'),_0x26a0a9[_0xd781('0x44')][_0xd781('0x70')]['toString']())['where'](_0xd781('0x71'))['where'](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x68'))[_0xd781('0x6c')]('cm_hopper')[_0xd781('0x39')](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))[_0xd781('0x6c')](_0xd781('0x6d'))['where'](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id']['toString']())[_0xd781('0x39')](_0xd781('0x76')))[_0xd781('0x77')]('ContactId'))[_0xd781('0x6e')]();return db[_0xd781('0x49')]['query'](_0x24e3f5);}return[];})[_0xd781('0x26')](respondWithResult(_0x172a05,null))['catch'](handleError(_0x172a05,null));};exports[_0xd781('0x78')]=function(_0x23dba5,_0x3e0749,_0x192c95){return db[_0xd781('0x79')]['find']({'where':{'id':_0x23dba5[_0xd781('0x41')]['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x3e0749,null))[_0xd781('0x26')](function(_0x3897bf){var _0xaa945b;if(_0x3897bf){_0xaa945b=squel[_0xd781('0x7a')]()['into'](_0xd781('0x5f'))[_0xd781('0x7b')](['phone',_0xd781('0x60'),_0xd781('0x61'),'ListId',_0xd781('0x7c'),_0xd781('0x64'),_0xd781('0x65')],squel[_0xd781('0x73')]()[_0xd781('0x66')]('ANY_VALUE(calleridnum)','phone')['field'](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),_0xd781('0x62'))[_0xd781('0x66')]('ANY_VALUE(CampaignId)',_0xd781('0x7c'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')]('NOW()','updatedAt')['from'](_0xd781('0x6d'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id']['toString']())['where'](_0xd781('0x6f'),_0x23dba5[_0xd781('0x44')][_0xd781('0x70')][_0xd781('0x6e')]())['where'](_0xd781('0x71'))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')]('phone')[_0xd781('0x6c')](_0xd781('0x5f'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))['from']('cm_hopper_final')[_0xd781('0x39')](_0xd781('0x7d'),_0x23dba5['params']['id'][_0xd781('0x6e')]())[_0xd781('0x39')]('state\x20=\x204'))[_0xd781('0x77')](_0xd781('0x61')))['toString']();return db[_0xd781('0x49')]['query'](_0xaa945b);}return[];})[_0xd781('0x26')](respondWithResult(_0x3e0749,null))[_0xd781('0x3f')](handleError(_0x3e0749,null));};exports[_0xd781('0x7e')]=function(_0x52b9c6,_0x5a2252,_0x356c56){return db[_0xd781('0x7f')]['findOne']({'where':{'VoiceQueueId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x63')],'CampaignId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x7c')],'ContactId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x61')]}})[_0xd781('0x26')](handleEntityNotFound(_0x5a2252,null))[_0xd781('0x26')](function(_0x532fd8){if(_0x532fd8){return _0x532fd8;}return null;})[_0xd781('0x26')](respondWithResult(_0x5a2252,null))[_0xd781('0x3f')](handleError(_0x5a2252,null));}; \ No newline at end of file +var _0x9536=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`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','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0xe4528a,_0x12c141){var _0x35c55c=function(_0x4d63cc){while(--_0x4d63cc){_0xe4528a['push'](_0xe4528a['shift']());}};_0x35c55c(++_0x12c141);}(_0x9536,0x179));var _0x6953=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0x9536[_0x5235dd];return _0x13059d;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 19b2993..8766302 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 _0x396f=['api','moment','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x396f,0xdd));var _0xf396=function(_0x1bdc5d,_0x59143f){_0x1bdc5d=_0x1bdc5d-0x0;var _0x4566b4=_0x396f[_0x1bdc5d];return _0x4566b4;};'use strict';var _=require(_0xf396('0x0'));var util=require(_0xf396('0x1'));var logger=require(_0xf396('0x2'))(_0xf396('0x3'));var moment=require(_0xf396('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf396('0x5'));var rimraf=require('rimraf');var config=require(_0xf396('0x6'));var attributes=require(_0xf396('0x7'));module[_0xf396('0x8')]=function(_0x371b11,_0xcfbc06){return _0x371b11[_0xf396('0x9')](_0xf396('0xa'),attributes,{'tableName':_0xf396('0xb'),'paranoid':![],'indexes':[{'name':_0xf396('0xc'),'fields':[_0xf396('0xc')]},{'name':'uniqueid','fields':[_0xf396('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa898=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api'];(function(_0x133289,_0x1cfb37){var _0x408b6f=function(_0x44d826){while(--_0x44d826){_0x133289['push'](_0x133289['shift']());}};_0x408b6f(++_0x1cfb37);}(_0xa898,0x10b));var _0x8a89=function(_0x9f64c0,_0x436b3b){_0x9f64c0=_0x9f64c0-0x0;var _0x230a21=_0xa898[_0x9f64c0];return _0x230a21;};'use strict';var _=require('lodash');var util=require(_0x8a89('0x0'));var logger=require(_0x8a89('0x1'))(_0x8a89('0x2'));var moment=require(_0x8a89('0x3'));var BPromise=require(_0x8a89('0x4'));var rp=require(_0x8a89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a89('0x6'));var config=require(_0x8a89('0x7'));var attributes=require(_0x8a89('0x8'));module[_0x8a89('0x9')]=function(_0x4aad08,_0x5b2878){return _0x4aad08[_0x8a89('0xa')](_0x8a89('0xb'),attributes,{'tableName':_0x8a89('0xc'),'paranoid':![],'indexes':[{'name':_0x8a89('0xd'),'fields':[_0x8a89('0xd')]},{'name':'uniqueid','fields':[_0x8a89('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index fef4745..7e59eb3 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 _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(_0x119778,_0x108fc){var _0x2855c5=function(_0x309bfc){while(--_0x309bfc){_0x119778['push'](_0x119778['shift']());}};_0x2855c5(++_0x108fc);}(_0x7a54,0x106));var _0x47a5=function(_0x2c8ad2,_0x35942a){_0x2c8ad2=_0x2c8ad2-0x0;var _0x41ee03=_0x7a54[_0x2c8ad2];return _0x41ee03;};'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 +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(_0x48ca51,_0x57f990){var _0x7bb6f5=function(_0x4d9fd9){while(--_0x4d9fd9){_0x48ca51['push'](_0x48ca51['shift']());}};_0x7bb6f5(++_0x57f990);}(_0x7a54,0x106));var _0x47a5=function(_0x3f3ec4,_0x21870e){_0x3f3ec4=_0x3f3ec4-0x0;var _0x29c3ab=_0x7a54[_0x3f3ec4];return _0x29c3ab;};'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 c637efb..eed7780 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 _0x547e=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports'];(function(_0x3ddba3,_0x1d5d24){var _0x34add3=function(_0x3d6c80){while(--_0x3d6c80){_0x3ddba3['push'](_0x3ddba3['shift']());}};_0x34add3(++_0x1d5d24);}(_0x547e,0xfd));var _0xe547=function(_0x2aa3c0,_0x23556c){_0x2aa3c0=_0x2aa3c0-0x0;var _0x35f63e=_0x547e[_0x2aa3c0];return _0x35f63e;};'use strict';var multer=require(_0xe547('0x0'));var util=require('util');var path=require(_0xe547('0x1'));var timeout=require(_0xe547('0x2'));var express=require('express');var router=express[_0xe547('0x3')]();var fs_extra=require(_0xe547('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe547('0x5'));var config=require(_0xe547('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xe547('0x7')]('/',auth['isAuthenticated'](),controller[_0xe547('0x8')]);router[_0xe547('0x7')]('/describe',auth[_0xe547('0x9')](),controller[_0xe547('0xa')]);router[_0xe547('0x7')](_0xe547('0xb'),auth[_0xe547('0x9')](),controller[_0xe547('0xc')]);router[_0xe547('0x7')](_0xe547('0xd'),auth[_0xe547('0x9')](),controller[_0xe547('0xe')]);router[_0xe547('0x7')](_0xe547('0xf'),auth['isAuthenticated'](),controller[_0xe547('0x10')]);router[_0xe547('0x11')]('/voice/queue/moveContacts/:id',auth[_0xe547('0x9')](),controller[_0xe547('0x12')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xe547('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xe547('0x13'),auth[_0xe547('0x9')](),controller[_0xe547('0x14')]);router[_0xe547('0x15')]('/:id',auth[_0xe547('0x9')](),controller['update']);module[_0xe547('0x16')]=router; \ No newline at end of file +var _0x10b2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','connect-timeout','express'];(function(_0x518c6d,_0x48985e){var _0x2ff6c8=function(_0x52d59f){while(--_0x52d59f){_0x518c6d['push'](_0x518c6d['shift']());}};_0x2ff6c8(++_0x48985e);}(_0x10b2,0x1be));var _0x210b=function(_0xf9901b,_0x4a3270){_0xf9901b=_0xf9901b-0x0;var _0x37b08d=_0x10b2[_0xf9901b];return _0x37b08d;};'use strict';var multer=require(_0x210b('0x0'));var util=require(_0x210b('0x1'));var path=require('path');var timeout=require(_0x210b('0x2'));var express=require(_0x210b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x210b('0x4'));var interaction=require(_0x210b('0x5'));var config=require(_0x210b('0x6'));var controller=require(_0x210b('0x7'));router[_0x210b('0x8')]('/',auth[_0x210b('0x9')](),controller['index']);router[_0x210b('0x8')]('/describe',auth[_0x210b('0x9')](),controller['describe']);router[_0x210b('0x8')](_0x210b('0xa'),auth[_0x210b('0x9')](),controller[_0x210b('0xb')]);router[_0x210b('0x8')](_0x210b('0xc'),auth[_0x210b('0x9')](),controller[_0x210b('0xd')]);router[_0x210b('0x8')](_0x210b('0xe'),auth[_0x210b('0x9')](),controller[_0x210b('0xf')]);router['post'](_0x210b('0x10'),auth['isAuthenticated'](),controller[_0x210b('0x11')]);router[_0x210b('0x12')](_0x210b('0x13'),auth[_0x210b('0x9')](),controller[_0x210b('0x14')]);router['post'](_0x210b('0x15'),auth[_0x210b('0x9')](),controller[_0x210b('0x16')]);router[_0x210b('0x17')]('/:id',auth[_0x210b('0x9')](),controller['update']);module[_0x210b('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b44f7c4..cfdac3a 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 _0x9a6d=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x17a8a3,_0x49a3f3){var _0x42e057=function(_0x157bb0){while(--_0x157bb0){_0x17a8a3['push'](_0x17a8a3['shift']());}};_0x42e057(++_0x49a3f3);}(_0x9a6d,0x10b));var _0xd9a6=function(_0xb7d3c9,_0x1281e2){_0xb7d3c9=_0xb7d3c9-0x0;var _0x3ed275=_0x9a6d[_0xb7d3c9];return _0x3ed275;};'use strict';var Sequelize=require(_0xd9a6('0x0'));module[_0xd9a6('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd9a6('0x2')]},'scheduledat':{'type':Sequelize[_0xd9a6('0x3')]},'countbusyretry':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd9a6('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xd9a6('0x2')]},'originatecalleridname':{'type':Sequelize[_0xd9a6('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd9a6('0x2')]},'starttime':{'type':Sequelize[_0xd9a6('0x3')]},'responsetime':{'type':Sequelize[_0xd9a6('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd9a6('0x3')]},'endtime':{'type':Sequelize[_0xd9a6('0x3')]},'ringtime':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd9a6('0x2')]},'campaign':{'type':Sequelize[_0xd9a6('0x2')]},'campaigntype':{'type':Sequelize[_0xd9a6('0x2')]},'membername':{'type':Sequelize[_0xd9a6('0x2')]},'reason':{'type':Sequelize[_0xd9a6('0x2')]},'amd':{'type':Sequelize[_0xd9a6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd9a6('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd9a6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd9a6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xd9a6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd9a6('0x3')]},'edited':{'type':Sequelize[_0xd9a6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd9a6('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd9a6('0x2')]}}; \ No newline at end of file +var _0xc88f=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc88f,0x19b));var _0xfc88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc88f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc88('0x0'));module[_0xfc88('0x1')]={'state':{'type':Sequelize[_0xfc88('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfc88('0x3')]},'scheduledat':{'type':Sequelize[_0xfc88('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xfc88('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfc88('0x3')]},'calleridname':{'type':Sequelize[_0xfc88('0x3')]},'starttime':{'type':Sequelize[_0xfc88('0x4')]},'responsetime':{'type':Sequelize[_0xfc88('0x4')]},'answertime':{'type':Sequelize[_0xfc88('0x4')]},'droptime':{'type':Sequelize[_0xfc88('0x4')]},'endtime':{'type':Sequelize[_0xfc88('0x4')]},'ringtime':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc88('0x3')]},'campaign':{'type':Sequelize[_0xfc88('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfc88('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xfc88('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xfc88('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc88('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc88('0x4')]},'recallme':{'type':Sequelize[_0xfc88('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfc88('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfc88('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfc88('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4534a8f..a49a7a8 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 _0x7009=['count','set','apply','save','update','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','fields','include','find','create','body','describe','uniqueid','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4e5123,_0x47d4a3){var _0x5e94ac=function(_0x5b6345){while(--_0x5b6345){_0x4e5123['push'](_0x4e5123['shift']());}};_0x5e94ac(++_0x47d4a3);}(_0x7009,0x77));var _0x9700=function(_0x2e5898,_0x3afffe){_0x2e5898=_0x2e5898-0x0;var _0x2054dc=_0x7009[_0x2e5898];return _0x2054dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9700('0x0'));var zipdir=require(_0x9700('0x1'));var jsonpatch=require(_0x9700('0x2'));var rp=require(_0x9700('0x3'));var moment=require(_0x9700('0x4'));var BPromise=require(_0x9700('0x5'));var Mustache=require(_0x9700('0x6'));var util=require('util');var path=require(_0x9700('0x7'));var sox=require(_0x9700('0x8'));var csv=require(_0x9700('0x9'));var ejs=require(_0x9700('0xa'));var fs=require('fs');var fs_extra=require(_0x9700('0xb'));var _=require(_0x9700('0xc'));var squel=require(_0x9700('0xd'));var crypto=require('crypto');var jsforce=require(_0x9700('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9700('0x9'));var querystring=require(_0x9700('0xf'));var Papa=require(_0x9700('0x10'));var Redis=require(_0x9700('0x11'));var authService=require(_0x9700('0x12'));var qs=require(_0x9700('0x13'));var as=require(_0x9700('0x14'));var hardwareService=require(_0x9700('0x15'));var logger=require(_0x9700('0x16'))(_0x9700('0x17'));var utils=require(_0x9700('0x18'));var config=require(_0x9700('0x19'));var licenseUtil=require(_0x9700('0x1a'));var db=require(_0x9700('0x1b'))['db'];function respondWithStatusCode(_0x207a4e,_0x4896fd){_0x4896fd=_0x4896fd||0xcc;return function(_0x8dbb88){if(_0x8dbb88){return _0x207a4e[_0x9700('0x1c')](_0x4896fd);}return _0x207a4e[_0x9700('0x1d')](_0x4896fd)[_0x9700('0x1e')]();};}function respondWithResult(_0x2c02f1,_0x277946){_0x277946=_0x277946||0xc8;return function(_0x350701){if(_0x350701){return _0x2c02f1['status'](_0x277946)[_0x9700('0x1f')](_0x350701);}};}function respondWithFilteredResult(_0x9fa23c,_0x1330ee){return function(_0x5162ac){if(_0x5162ac){var _0x8392ab=typeof _0x1330ee[_0x9700('0x20')]===_0x9700('0x21')&&typeof _0x1330ee[_0x9700('0x22')]==='undefined';var _0x164d5=_0x5162ac[_0x9700('0x23')];var _0x4d24aa=_0x8392ab?0x0:_0x1330ee['offset'];var _0x2b0855=_0x8392ab?_0x5162ac[_0x9700('0x23')]:_0x1330ee['offset']+_0x1330ee['limit'];var _0x285976;if(_0x2b0855>=_0x164d5){_0x2b0855=_0x164d5;_0x285976=0xc8;}else{_0x285976=0xce;}_0x9fa23c[_0x9700('0x1d')](_0x285976);return _0x9fa23c[_0x9700('0x24')]('Content-Range',_0x4d24aa+'-'+_0x2b0855+'/'+_0x164d5)[_0x9700('0x1f')](_0x5162ac);}return null;};}function patchUpdates(_0x149790){return function(_0x5cddad){try{jsonpatch[_0x9700('0x25')](_0x5cddad,_0x149790,!![]);}catch(_0x29c82a){return BPromise['reject'](_0x29c82a);}return _0x5cddad[_0x9700('0x26')]();};}function saveUpdates(_0x29be55,_0x5646a6){return function(_0xdb32a3){if(_0xdb32a3){return _0xdb32a3[_0x9700('0x27')](_0x29be55)[_0x9700('0x28')](function(_0x571094){return _0x571094;});}return null;};}function removeEntity(_0x13f6d1,_0x40781e){return function(_0x565dce){if(_0x565dce){return _0x565dce[_0x9700('0x29')]()[_0x9700('0x28')](function(){_0x13f6d1[_0x9700('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f73bb,_0x34c38d){return function(_0x355bf7){if(!_0x355bf7){_0x9f73bb[_0x9700('0x1c')](0x194);}return _0x355bf7;};}function handleError(_0x148e6a,_0x2c4708){_0x2c4708=_0x2c4708||0x1f4;return function(_0x56b065){logger[_0x9700('0x2a')](_0x56b065[_0x9700('0x2b')]);if(_0x56b065[_0x9700('0x2c')]){delete _0x56b065[_0x9700('0x2c')];}_0x148e6a[_0x9700('0x1d')](_0x2c4708)[_0x9700('0x2d')](_0x56b065);};}exports['index']=function(_0x4390a0,_0x566cad){var _0x36045f={},_0x4199d7={},_0x32bc94={'count':0x0,'rows':[]};var _0x217f0d=_[_0x9700('0x2e')](db[_0x9700('0x2f')][_0x9700('0x30')],function(_0x1e2351){return{'name':_0x1e2351[_0x9700('0x31')],'type':_0x1e2351[_0x9700('0x32')]['key']};});_0x4199d7[_0x9700('0x33')]=_[_0x9700('0x2e')](_0x217f0d,_0x9700('0x2c'));_0x4199d7[_0x9700('0x34')]=_[_0x9700('0x35')](_0x4390a0[_0x9700('0x34')]);_0x4199d7[_0x9700('0x36')]=_['intersection'](_0x4199d7[_0x9700('0x33')],_0x4199d7[_0x9700('0x34')]);_0x36045f['attributes']=_[_0x9700('0x37')](_0x4199d7['model'],qs['fields'](_0x4390a0[_0x9700('0x34')]['fields']));_0x36045f[_0x9700('0x38')]=_0x36045f[_0x9700('0x38')][_0x9700('0x39')]?_0x36045f['attributes']:_0x4199d7[_0x9700('0x33')];if(!_0x4390a0[_0x9700('0x34')][_0x9700('0x3a')](_0x9700('0x3b'))){_0x36045f[_0x9700('0x22')]=qs[_0x9700('0x22')](_0x4390a0[_0x9700('0x34')][_0x9700('0x22')]);_0x36045f[_0x9700('0x20')]=qs[_0x9700('0x20')](_0x4390a0[_0x9700('0x34')]['offset']);}_0x36045f['order']=qs[_0x9700('0x3c')](_0x4390a0[_0x9700('0x34')][_0x9700('0x3c')]);_0x36045f[_0x9700('0x3d')]=qs[_0x9700('0x36')](_['pick'](_0x4390a0['query'],_0x4199d7['filters']),_0x217f0d);if(_0x4390a0[_0x9700('0x34')]['filter']){_0x36045f[_0x9700('0x3d')]=_['merge'](_0x36045f[_0x9700('0x3d')],{'$or':_[_0x9700('0x2e')](_0x217f0d,function(_0x5b5ae4){if(_0x5b5ae4['type']!==_0x9700('0x3e')){var _0x57ca4c={};_0x57ca4c[_0x5b5ae4['name']]={'$like':'%'+_0x4390a0['query']['filter']+'%'};return _0x57ca4c;}})});}_0x36045f=_[_0x9700('0x3f')]({},_0x36045f,_0x4390a0[_0x9700('0x40')]);var _0x24399a={'where':_0x36045f[_0x9700('0x3d')]};return db[_0x9700('0x2f')][_0x9700('0x23')](_0x24399a)[_0x9700('0x28')](function(_0x41d1a6){_0x32bc94[_0x9700('0x23')]=_0x41d1a6;if(_0x4390a0[_0x9700('0x34')][_0x9700('0x41')]){_0x36045f['include']=[{'all':!![]}];}return db[_0x9700('0x2f')][_0x9700('0x42')](_0x36045f);})['then'](function(_0x2385b7){_0x32bc94[_0x9700('0x43')]=_0x2385b7;return _0x32bc94;})['then'](respondWithFilteredResult(_0x566cad,_0x36045f))[_0x9700('0x44')](handleError(_0x566cad,null));};exports['show']=function(_0x12c57c,_0x2c2cb5){var _0x4138da={'raw':!![],'where':{'id':_0x12c57c['params']['id']}},_0x25f314={};_0x25f314['model']=_[_0x9700('0x35')](db[_0x9700('0x2f')][_0x9700('0x30')]);_0x25f314[_0x9700('0x34')]=_[_0x9700('0x35')](_0x12c57c[_0x9700('0x34')]);_0x25f314[_0x9700('0x36')]=_[_0x9700('0x37')](_0x25f314['model'],_0x25f314[_0x9700('0x34')]);_0x4138da[_0x9700('0x38')]=_[_0x9700('0x37')](_0x25f314[_0x9700('0x33')],qs[_0x9700('0x45')](_0x12c57c[_0x9700('0x34')][_0x9700('0x45')]));_0x4138da[_0x9700('0x38')]=_0x4138da[_0x9700('0x38')][_0x9700('0x39')]?_0x4138da[_0x9700('0x38')]:_0x25f314['model'];if(_0x12c57c[_0x9700('0x34')][_0x9700('0x41')]){_0x4138da[_0x9700('0x46')]=[{'all':!![]}];}_0x4138da=_[_0x9700('0x3f')]({},_0x4138da,_0x12c57c[_0x9700('0x40')]);return db[_0x9700('0x2f')][_0x9700('0x47')](_0x4138da)['then'](handleEntityNotFound(_0x2c2cb5,null))[_0x9700('0x28')](respondWithResult(_0x2c2cb5,null))[_0x9700('0x44')](handleError(_0x2c2cb5,null));};exports[_0x9700('0x48')]=function(_0x632d83,_0x51771d){return db[_0x9700('0x2f')][_0x9700('0x48')](_0x632d83[_0x9700('0x49')],{})[_0x9700('0x28')](respondWithResult(_0x51771d,0xc9))[_0x9700('0x44')](handleError(_0x51771d,null));};exports['describe']=function(_0x256702,_0x211905){return db[_0x9700('0x2f')][_0x9700('0x4a')]()[_0x9700('0x28')](respondWithResult(_0x211905,null))[_0x9700('0x44')](handleError(_0x211905,null));};exports['update']=function(_0x1d7d68,_0x180f61){if(_0x1d7d68[_0x9700('0x49')][_0x9700('0x4b')]){delete _0x1d7d68[_0x9700('0x49')][_0x9700('0x4b')];}return db[_0x9700('0x2f')][_0x9700('0x47')]({'where':{'uniqueid':_0x1d7d68[_0x9700('0x4c')]['id']}})['then'](handleEntityNotFound(_0x180f61,null))['then'](saveUpdates(_0x1d7d68['body'],null))[_0x9700('0x28')](respondWithResult(_0x180f61,null))['catch'](handleError(_0x180f61,null));}; \ No newline at end of file +var _0x5e44=['name','send','index','map','CmHopperHistory','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','update','uniqueid','eml-format','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','save','then','destroy','error','stack'];(function(_0x4597f0,_0x526214){var _0x1c78d2=function(_0x38840c){while(--_0x38840c){_0x4597f0['push'](_0x4597f0['shift']());}};_0x1c78d2(++_0x526214);}(_0x5e44,0x147));var _0x45e4=function(_0x9165a,_0x490cac){_0x9165a=_0x9165a-0x0;var _0x582d88=_0x5e44[_0x9165a];return _0x582d88;};'use strict';var emlformat=require(_0x45e4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x45e4('0x1'));var moment=require('moment');var BPromise=require(_0x45e4('0x2'));var Mustache=require(_0x45e4('0x3'));var util=require(_0x45e4('0x4'));var path=require('path');var sox=require(_0x45e4('0x5'));var csv=require('to-csv');var ejs=require(_0x45e4('0x6'));var fs=require('fs');var fs_extra=require(_0x45e4('0x7'));var _=require(_0x45e4('0x8'));var squel=require('squel');var crypto=require(_0x45e4('0x9'));var jsforce=require(_0x45e4('0xa'));var deskjs=require(_0x45e4('0xb'));var toCsv=require(_0x45e4('0xc'));var querystring=require(_0x45e4('0xd'));var Papa=require('papaparse');var Redis=require(_0x45e4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45e4('0xf'));var hardwareService=require(_0x45e4('0x10'));var logger=require(_0x45e4('0x11'))(_0x45e4('0x12'));var utils=require(_0x45e4('0x13'));var config=require(_0x45e4('0x14'));var licenseUtil=require(_0x45e4('0x15'));var db=require(_0x45e4('0x16'))['db'];function respondWithStatusCode(_0x587362,_0x4b04c4){_0x4b04c4=_0x4b04c4||0xcc;return function(_0x5628f7){if(_0x5628f7){return _0x587362[_0x45e4('0x17')](_0x4b04c4);}return _0x587362[_0x45e4('0x18')](_0x4b04c4)[_0x45e4('0x19')]();};}function respondWithResult(_0x85bbce,_0x448411){_0x448411=_0x448411||0xc8;return function(_0x3e28ef){if(_0x3e28ef){return _0x85bbce[_0x45e4('0x18')](_0x448411)[_0x45e4('0x1a')](_0x3e28ef);}};}function respondWithFilteredResult(_0xcf4c3f,_0xee499f){return function(_0x46a9ab){if(_0x46a9ab){var _0x363772=typeof _0xee499f['offset']===_0x45e4('0x1b')&&typeof _0xee499f['limit']===_0x45e4('0x1b');var _0x21ce7b=_0x46a9ab['count'];var _0x22baf9=_0x363772?0x0:_0xee499f[_0x45e4('0x1c')];var _0x3048ac=_0x363772?_0x46a9ab[_0x45e4('0x1d')]:_0xee499f[_0x45e4('0x1c')]+_0xee499f[_0x45e4('0x1e')];var _0x168ddc;if(_0x3048ac>=_0x21ce7b){_0x3048ac=_0x21ce7b;_0x168ddc=0xc8;}else{_0x168ddc=0xce;}_0xcf4c3f['status'](_0x168ddc);return _0xcf4c3f[_0x45e4('0x1f')]('Content-Range',_0x22baf9+'-'+_0x3048ac+'/'+_0x21ce7b)['json'](_0x46a9ab);}return null;};}function patchUpdates(_0xed034a){return function(_0x1bc33d){try{jsonpatch['apply'](_0x1bc33d,_0xed034a,!![]);}catch(_0x20e765){return BPromise[_0x45e4('0x20')](_0x20e765);}return _0x1bc33d[_0x45e4('0x21')]();};}function saveUpdates(_0x4b9ccc,_0x16d995){return function(_0x5d58b7){if(_0x5d58b7){return _0x5d58b7['update'](_0x4b9ccc)[_0x45e4('0x22')](function(_0x2a186b){return _0x2a186b;});}return null;};}function removeEntity(_0x1cd90f,_0x9c7e8c){return function(_0x29f856){if(_0x29f856){return _0x29f856[_0x45e4('0x23')]()[_0x45e4('0x22')](function(){_0x1cd90f['status'](0xcc)[_0x45e4('0x19')]();});}};}function handleEntityNotFound(_0x2519ce,_0x6c78e1){return function(_0x20bb3a){if(!_0x20bb3a){_0x2519ce[_0x45e4('0x17')](0x194);}return _0x20bb3a;};}function handleError(_0x56467e,_0x499cd4){_0x499cd4=_0x499cd4||0x1f4;return function(_0x35d47c){logger[_0x45e4('0x24')](_0x35d47c[_0x45e4('0x25')]);if(_0x35d47c[_0x45e4('0x26')]){delete _0x35d47c['name'];}_0x56467e[_0x45e4('0x18')](_0x499cd4)[_0x45e4('0x27')](_0x35d47c);};}exports[_0x45e4('0x28')]=function(_0x559730,_0x5aa2a7){var _0x3777b6={},_0x45de86={},_0x10f613={'count':0x0,'rows':[]};var _0x5239e6=_[_0x45e4('0x29')](db[_0x45e4('0x2a')]['rawAttributes'],function(_0x4424df){return{'name':_0x4424df['fieldName'],'type':_0x4424df[_0x45e4('0x2b')]['key']};});_0x45de86[_0x45e4('0x2c')]=_[_0x45e4('0x29')](_0x5239e6,_0x45e4('0x26'));_0x45de86[_0x45e4('0x2d')]=_['keys'](_0x559730['query']);_0x45de86[_0x45e4('0x2e')]=_[_0x45e4('0x2f')](_0x45de86[_0x45e4('0x2c')],_0x45de86[_0x45e4('0x2d')]);_0x3777b6[_0x45e4('0x30')]=_['intersection'](_0x45de86['model'],qs[_0x45e4('0x31')](_0x559730['query']['fields']));_0x3777b6[_0x45e4('0x30')]=_0x3777b6['attributes'][_0x45e4('0x32')]?_0x3777b6['attributes']:_0x45de86['model'];if(!_0x559730[_0x45e4('0x2d')][_0x45e4('0x33')]('nolimit')){_0x3777b6[_0x45e4('0x1e')]=qs[_0x45e4('0x1e')](_0x559730['query'][_0x45e4('0x1e')]);_0x3777b6[_0x45e4('0x1c')]=qs[_0x45e4('0x1c')](_0x559730[_0x45e4('0x2d')]['offset']);}_0x3777b6[_0x45e4('0x34')]=qs[_0x45e4('0x35')](_0x559730[_0x45e4('0x2d')][_0x45e4('0x35')]);_0x3777b6[_0x45e4('0x36')]=qs[_0x45e4('0x2e')](_['pick'](_0x559730['query'],_0x45de86[_0x45e4('0x2e')]),_0x5239e6);if(_0x559730['query'][_0x45e4('0x37')]){_0x3777b6['where']=_[_0x45e4('0x38')](_0x3777b6[_0x45e4('0x36')],{'$or':_[_0x45e4('0x29')](_0x5239e6,function(_0xb4a3fb){if(_0xb4a3fb['type']!==_0x45e4('0x39')){var _0x9db649={};_0x9db649[_0xb4a3fb['name']]={'$like':'%'+_0x559730['query']['filter']+'%'};return _0x9db649;}})});}_0x3777b6=_[_0x45e4('0x38')]({},_0x3777b6,_0x559730[_0x45e4('0x3a')]);var _0x5047fb={'where':_0x3777b6['where']};return db[_0x45e4('0x2a')][_0x45e4('0x1d')](_0x5047fb)[_0x45e4('0x22')](function(_0xc2252a){_0x10f613['count']=_0xc2252a;if(_0x559730[_0x45e4('0x2d')]['includeAll']){_0x3777b6[_0x45e4('0x3b')]=[{'all':!![]}];}return db[_0x45e4('0x2a')][_0x45e4('0x3c')](_0x3777b6);})[_0x45e4('0x22')](function(_0x390b07){_0x10f613['rows']=_0x390b07;return _0x10f613;})['then'](respondWithFilteredResult(_0x5aa2a7,_0x3777b6))[_0x45e4('0x3d')](handleError(_0x5aa2a7,null));};exports[_0x45e4('0x3e')]=function(_0x215622,_0x25c932){var _0xdb9f89={'raw':!![],'where':{'id':_0x215622[_0x45e4('0x3f')]['id']}},_0x4a520d={};_0x4a520d['model']=_[_0x45e4('0x40')](db[_0x45e4('0x2a')][_0x45e4('0x41')]);_0x4a520d[_0x45e4('0x2d')]=_[_0x45e4('0x40')](_0x215622[_0x45e4('0x2d')]);_0x4a520d[_0x45e4('0x2e')]=_[_0x45e4('0x2f')](_0x4a520d[_0x45e4('0x2c')],_0x4a520d[_0x45e4('0x2d')]);_0xdb9f89['attributes']=_['intersection'](_0x4a520d[_0x45e4('0x2c')],qs['fields'](_0x215622[_0x45e4('0x2d')]['fields']));_0xdb9f89[_0x45e4('0x30')]=_0xdb9f89[_0x45e4('0x30')][_0x45e4('0x32')]?_0xdb9f89['attributes']:_0x4a520d[_0x45e4('0x2c')];if(_0x215622['query'][_0x45e4('0x42')]){_0xdb9f89[_0x45e4('0x3b')]=[{'all':!![]}];}_0xdb9f89=_[_0x45e4('0x38')]({},_0xdb9f89,_0x215622['options']);return db['CmHopperHistory'][_0x45e4('0x43')](_0xdb9f89)[_0x45e4('0x22')](handleEntityNotFound(_0x25c932,null))['then'](respondWithResult(_0x25c932,null))[_0x45e4('0x3d')](handleError(_0x25c932,null));};exports[_0x45e4('0x44')]=function(_0x2a946b,_0x53f904){return db[_0x45e4('0x2a')][_0x45e4('0x44')](_0x2a946b[_0x45e4('0x45')],{})['then'](respondWithResult(_0x53f904,0xc9))['catch'](handleError(_0x53f904,null));};exports[_0x45e4('0x46')]=function(_0x4e15ac,_0x13acb7){return db[_0x45e4('0x2a')][_0x45e4('0x46')]()['then'](respondWithResult(_0x13acb7,null))['catch'](handleError(_0x13acb7,null));};exports[_0x45e4('0x47')]=function(_0x474204,_0x323619){if(_0x474204['body'][_0x45e4('0x48')]){delete _0x474204[_0x45e4('0x45')]['uniqueid'];}return db['CmHopperHistory'][_0x45e4('0x43')]({'where':{'uniqueid':_0x474204[_0x45e4('0x3f')]['id']}})[_0x45e4('0x22')](handleEntityNotFound(_0x323619,null))[_0x45e4('0x22')](saveUpdates(_0x474204[_0x45e4('0x45')],null))[_0x45e4('0x22')](respondWithResult(_0x323619,null))[_0x45e4('0x3d')](handleError(_0x323619,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0db588a..0bb31a9 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 _0x85de=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5007fa,_0x6f7f31){var _0x29015a=function(_0x2b20d6){while(--_0x2b20d6){_0x5007fa['push'](_0x5007fa['shift']());}};_0x29015a(++_0x6f7f31);}(_0x85de,0x65));var _0xe85d=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x85de[_0x510b98];return _0x45e775;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var logger=require(_0xe85d('0x2'))(_0xe85d('0x3'));var moment=require(_0xe85d('0x4'));var BPromise=require(_0xe85d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe85d('0x6'));var rimraf=require(_0xe85d('0x7'));var config=require(_0xe85d('0x8'));var attributes=require(_0xe85d('0x9'));module['exports']=function(_0x5f12a2,_0x2797cd){return _0x5f12a2[_0xe85d('0xa')](_0xe85d('0xb'),attributes,{'tableName':_0xe85d('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xe85d('0xd')]},{'name':_0xe85d('0xe'),'fields':[_0xe85d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a0=['api','bluebird','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger'];(function(_0x239d1f,_0x367a95){var _0x27e245=function(_0x1dca12){while(--_0x1dca12){_0x239d1f['push'](_0x239d1f['shift']());}};_0x27e245(++_0x367a95);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0xf44b76,_0x10b04c){_0xf44b76=_0xf44b76-0x0;var _0x24d1a4=_0xb8a0[_0xf44b76];return _0x24d1a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b8a('0x0'))(_0x0b8a('0x1'));var moment=require('moment');var BPromise=require(_0x0b8a('0x2'));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(_0x0b8a('0x3'));module[_0x0b8a('0x4')]=function(_0x381b17,_0x165710){return _0x381b17[_0x0b8a('0x5')](_0x0b8a('0x6'),attributes,{'tableName':_0x0b8a('0x7'),'paranoid':![],'indexes':[{'name':_0x0b8a('0x8'),'fields':[_0x0b8a('0x8')]},{'name':_0x0b8a('0x9'),'fields':[_0x0b8a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 903063c..6e235b2 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 _0x462e=['`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','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','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','debug','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','catch','CreateCmHopperHistory','body','options','message','CmHopperHistory','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay'];(function(_0x35d89f,_0x29e3bc){var _0x2aa933=function(_0x2763a4){while(--_0x2763a4){_0x35d89f['push'](_0x35d89f['shift']());}};_0x2aa933(++_0x29e3bc);}(_0x462e,0x13c));var _0xe462=function(_0x8ab258,_0x400ec5){_0x8ab258=_0x8ab258-0x0;var _0x4e7110=_0x462e[_0x8ab258];return _0x4e7110;};'use strict';var _=require(_0xe462('0x0'));var util=require(_0xe462('0x1'));var moment=require(_0xe462('0x2'));var BPromise=require(_0xe462('0x3'));var rs=require(_0xe462('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe462('0x5'))['db'];var utils=require(_0xe462('0x6'));var logger=require(_0xe462('0x7'))(_0xe462('0x8'));var config=require('../../config/environment');var jayson=require(_0xe462('0x9'));var client=jayson[_0xe462('0xa')][_0xe462('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdb3d0b,_0x2b8821,_0x54552c){return new BPromise(function(_0x42838f,_0x253deb){return client[_0xe462('0xc')](_0xdb3d0b,_0x54552c)[_0xe462('0xd')](function(_0x5ced15){logger[_0xe462('0xe')](_0xe462('0xf'),_0x2b8821,_0xe462('0x10'));logger['debug'](_0xe462('0x11'),_0x2b8821,_0xe462('0x10'),JSON[_0xe462('0x12')](_0x5ced15));if(_0x5ced15['error']){if(_0x5ced15[_0xe462('0x13')][_0xe462('0x14')]===0x1f4){logger[_0xe462('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x2b8821,_0x5ced15[_0xe462('0x13')]['message']);return _0x253deb(_0x5ced15[_0xe462('0x13')]['message']);}logger[_0xe462('0x13')](_0xe462('0xf'),_0x2b8821,_0x5ced15[_0xe462('0x13')]['message']);return _0x42838f(_0x5ced15[_0xe462('0x13')]['message']);}else{logger[_0xe462('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x2b8821,_0xe462('0x10'));_0x42838f(_0x5ced15['result']['message']);}})[_0xe462('0x15')](function(_0x5573ed){logger[_0xe462('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x2b8821,_0x5573ed);_0x253deb(_0x5573ed);});});}exports[_0xe462('0x16')]=function(_0x114dbc){var _0x3f1266=this;return new Promise(function(_0x1283f0,_0x1ad7ee){return db['CmHopperHistory']['create'](_0x114dbc[_0xe462('0x17')],{'raw':_0x114dbc[_0xe462('0x18')]?_0x114dbc['options']['raw']===undefined?!![]:![]:!![]})[_0xe462('0xd')](function(_0x5eb4e7){logger[_0xe462('0xe')](_0xe462('0x16'),_0x114dbc);logger['debug'](_0xe462('0x16'),_0x114dbc,JSON['stringify'](_0x5eb4e7));_0x1283f0(_0x5eb4e7);})[_0xe462('0x15')](function(_0x4a8ec4){logger[_0xe462('0x13')]('CreateCmHopperHistory',_0x4a8ec4[_0xe462('0x19')],_0x114dbc);_0x1ad7ee(_0x3f1266[_0xe462('0x13')](0x1f4,_0x4a8ec4[_0xe462('0x19')]));});});};exports['AvgHandleTime']=function(_0x5c605b){var _0x8e2604=this;return new Promise(function(_0x56a283,_0x51a128){return db[_0xe462('0x1a')][_0xe462('0x1b')]({'raw':_0x5c605b[_0xe462('0x18')]?_0x5c605b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c605b['options']?_0x5c605b[_0xe462('0x18')]['where']||null:null,'attributes':[[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db['sequelize'][_0xe462('0x1e')]('id')),_0xe462('0x1f')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db['sequelize'][_0xe462('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xe462('0x21')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db['sequelize']['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0xe462('0x22')],[db[_0xe462('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe462('0x20')](_0xe462('0x23')))),_0xe462('0x24')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x25'),db[_0xe462('0x1c')]['fn']('IF',db['sequelize'][_0xe462('0x20')](_0xe462('0x26')))),'predictiveIntervalAvgHoldtime'],[db[_0xe462('0x1c')]['fn'](_0xe462('0x25'),db[_0xe462('0x1c')]['fn']('IF',db[_0xe462('0x1c')]['literal'](_0xe462('0x27')))),_0xe462('0x28')]]})['then'](function(_0x46769b){logger[_0xe462('0xe')](_0xe462('0x29'),_0x5c605b);logger['debug'](_0xe462('0x29'),_0x5c605b,JSON[_0xe462('0x12')](_0x46769b));_0x56a283(_0x46769b);})[_0xe462('0x15')](function(_0x4d4c02){logger[_0xe462('0x13')]('AvgHandleTime',_0x4d4c02[_0xe462('0x19')],_0x5c605b);_0x51a128(_0x8e2604['error'](0x1f4,_0x4d4c02['message']));});});};exports[_0xe462('0x2a')]=function(_0x15107a){var _0x2fff85=this;return new Promise(function(_0x30bc07,_0xaebfd0){return db[_0xe462('0x1a')][_0xe462('0x1b')]({'raw':_0x15107a['options']?_0x15107a[_0xe462('0x18')][_0xe462('0x2b')]===undefined?!![]:![]:!![],'where':_0x15107a[_0xe462('0x18')]?_0x15107a[_0xe462('0x18')]['where']||null:null,'attributes':[[_0xe462('0x2c'),_0xe462('0x2d')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')](_0xe462('0x2e')))),'outboundNoSuchCallsDay'],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db['sequelize'][_0xe462('0x20')](_0xe462('0x2f')))),_0xe462('0x30')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')](_0xe462('0x31')))),_0xe462('0x32')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0xe462('0x33')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db['sequelize']['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0xe462('0x34')],[db['sequelize']['fn'](_0xe462('0x1d'),db['sequelize']['fn']('IF',db[_0xe462('0x1c')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xe462('0x35')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xe462('0x36')))),_0xe462('0x37')],[db['sequelize']['fn']('COUNT',db[_0xe462('0x1c')]['fn']('IF',db['sequelize'][_0xe462('0x20')](_0xe462('0x38')))),_0xe462('0x39')],[db[_0xe462('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe462('0x3a')))),_0xe462('0x3b')],[db[_0xe462('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe462('0x20')](_0xe462('0x3c')))),_0xe462('0x3d')],[db[_0xe462('0x1c')]['fn']('COUNT',db[_0xe462('0x1c')]['fn']('IF',db['sequelize'][_0xe462('0x20')](_0xe462('0x3e')))),_0xe462('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xe462('0x1c')]['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')](_0xe462('0x40')))),_0xe462('0x41')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db['sequelize']['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')](_0xe462('0x42')))),_0xe462('0x3f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe462('0x1c')][_0xe462('0x20')](_0xe462('0x43')))),'outboundReCallsDay']],'group':[_0xe462('0x2c')]})[_0xe462('0xd')](function(_0x33b5da){logger[_0xe462('0xe')](_0xe462('0x2a'),_0x15107a);logger[_0xe462('0x44')]('GetVoiceQueueHopperHistory',_0x15107a,JSON[_0xe462('0x12')](_0x33b5da));_0x30bc07(_0x33b5da);})['catch'](function(_0x4c4f16){logger[_0xe462('0x13')]('GetVoiceQueueHopperHistory',_0x4c4f16[_0xe462('0x19')],_0x15107a);_0xaebfd0(_0x2fff85['error'](0x1f4,_0x4c4f16[_0xe462('0x19')]));});});};exports[_0xe462('0x45')]=function(_0x20e2c4){var _0x146c73=this;return new Promise(function(_0x40016a,_0x5efc72){return db[_0xe462('0x1a')][_0xe462('0x1b')]({'raw':_0x20e2c4['options']?_0x20e2c4[_0xe462('0x18')][_0xe462('0x2b')]===undefined?!![]:![]:!![],'where':_0x20e2c4[_0xe462('0x18')]?_0x20e2c4['options'][_0xe462('0x46')]||null:null,'attributes':[['campaign',_0xe462('0x2d')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')][_0xe462('0x1e')]('id')),_0xe462('0x47')],[db[_0xe462('0x1c')]['fn'](_0xe462('0x1d'),db[_0xe462('0x1c')]['fn']('IF',db[_0xe462('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xe462('0x48')]],'group':[_0xe462('0x2c')]})['then'](function(_0x104e1c){logger[_0xe462('0xe')]('GetCampaignHopperHistory',_0x20e2c4);logger[_0xe462('0x44')](_0xe462('0x45'),_0x20e2c4,JSON['stringify'](_0x104e1c));_0x40016a(_0x104e1c);})[_0xe462('0x15')](function(_0x474403){logger[_0xe462('0x13')](_0xe462('0x45'),_0x474403[_0xe462('0x19')],_0x20e2c4);_0x5efc72(_0x146c73[_0xe462('0x13')](0x1f4,_0x474403['message']));});});}; \ No newline at end of file +var _0x2083=['info','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','catch','findAll','where','COUNT','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','campaign','name','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2083,0x137));var _0x3208=function(_0x5660cf,_0x56b76f){_0x5660cf=_0x5660cf-0x0;var _0x4053d6=_0x2083[_0x5660cf];return _0x4053d6;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var moment=require('moment');var BPromise=require(_0x3208('0x2'));var rs=require(_0x3208('0x3'));var fs=require('fs');var Redis=require(_0x3208('0x4'));var db=require(_0x3208('0x5'))['db'];var utils=require(_0x3208('0x6'));var logger=require(_0x3208('0x7'))(_0x3208('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3208('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d837d,_0x3d4b9d,_0x17972f){return new BPromise(function(_0x564ff6,_0x165e5e){return client[_0x3208('0xa')](_0x3d837d,_0x17972f)[_0x3208('0xb')](function(_0x4c45f4){logger['info'](_0x3208('0xc'),_0x3d4b9d,_0x3208('0xd'));logger[_0x3208('0xe')](_0x3208('0xf'),_0x3d4b9d,'request\x20sent',JSON['stringify'](_0x4c45f4));if(_0x4c45f4[_0x3208('0x10')]){if(_0x4c45f4[_0x3208('0x10')][_0x3208('0x11')]===0x1f4){logger[_0x3208('0x10')](_0x3208('0xc'),_0x3d4b9d,_0x4c45f4[_0x3208('0x10')][_0x3208('0x12')]);return _0x165e5e(_0x4c45f4[_0x3208('0x10')][_0x3208('0x12')]);}logger[_0x3208('0x10')](_0x3208('0xc'),_0x3d4b9d,_0x4c45f4[_0x3208('0x10')][_0x3208('0x12')]);return _0x564ff6(_0x4c45f4[_0x3208('0x10')]['message']);}else{logger[_0x3208('0x13')](_0x3208('0xc'),_0x3d4b9d,_0x3208('0xd'));_0x564ff6(_0x4c45f4[_0x3208('0x14')][_0x3208('0x12')]);}})['catch'](function(_0x244d19){logger[_0x3208('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3d4b9d,_0x244d19);_0x165e5e(_0x244d19);});});}exports[_0x3208('0x15')]=function(_0x3590c5){var _0x3b45bf=this;return new Promise(function(_0x28e291,_0x26a826){return db[_0x3208('0x16')]['create'](_0x3590c5[_0x3208('0x17')],{'raw':_0x3590c5[_0x3208('0x18')]?_0x3590c5[_0x3208('0x18')][_0x3208('0x19')]===undefined?!![]:![]:!![]})[_0x3208('0xb')](function(_0x46b227){logger[_0x3208('0x13')]('CreateCmHopperHistory',_0x3590c5);logger[_0x3208('0xe')](_0x3208('0x15'),_0x3590c5,JSON['stringify'](_0x46b227));_0x28e291(_0x46b227);})[_0x3208('0x1a')](function(_0x361d1c){logger[_0x3208('0x10')](_0x3208('0x15'),_0x361d1c[_0x3208('0x12')],_0x3590c5);_0x26a826(_0x3b45bf[_0x3208('0x10')](0x1f4,_0x361d1c[_0x3208('0x12')]));});});};exports['AvgHandleTime']=function(_0x54aa98){var _0xd9ad58=this;return new Promise(function(_0x2f2dc3,_0x1c4f3f){return db[_0x3208('0x16')][_0x3208('0x1b')]({'raw':_0x54aa98[_0x3208('0x18')]?_0x54aa98['options'][_0x3208('0x19')]===undefined?!![]:![]:!![],'where':_0x54aa98[_0x3208('0x18')]?_0x54aa98[_0x3208('0x18')][_0x3208('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')][_0x3208('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x21')))),_0x3208('0x22')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x23')))),_0x3208('0x24')],[db['sequelize']['fn']('COUNT',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3208('0x25')],[db[_0x3208('0x1e')]['fn']('AVG',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x26')))),_0x3208('0x27')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x28'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x29')))),_0x3208('0x2a')]]})[_0x3208('0xb')](function(_0x47f46c){logger[_0x3208('0x13')](_0x3208('0x2b'),_0x54aa98);logger['debug'](_0x3208('0x2b'),_0x54aa98,JSON[_0x3208('0x2c')](_0x47f46c));_0x2f2dc3(_0x47f46c);})[_0x3208('0x1a')](function(_0x39ff47){logger['error']('AvgHandleTime',_0x39ff47[_0x3208('0x12')],_0x54aa98);_0x1c4f3f(_0xd9ad58['error'](0x1f4,_0x39ff47[_0x3208('0x12')]));});});};exports[_0x3208('0x2d')]=function(_0x35df97){var _0x2618c0=this;return new Promise(function(_0x419b59,_0x1588f4){return db[_0x3208('0x16')][_0x3208('0x1b')]({'raw':_0x35df97[_0x3208('0x18')]?_0x35df97['options'][_0x3208('0x19')]===undefined?!![]:![]:!![],'where':_0x35df97['options']?_0x35df97[_0x3208('0x18')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x3208('0x1e')]['fn']('COUNT',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x3208('0x2e')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x3208('0x20')](_0x3208('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db['sequelize'][_0x3208('0x20')](_0x3208('0x21')))),_0x3208('0x30')],[db[_0x3208('0x1e')]['fn']('COUNT',db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal'](_0x3208('0x31')))),_0x3208('0x32')],[db[_0x3208('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x33')))),_0x3208('0x34')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3208('0x35')],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3208('0x36')],[db['sequelize']['fn'](_0x3208('0x1d'),db['sequelize']['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x3208('0x37')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal'](_0x3208('0x38')))),_0x3208('0x39')],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')][_0x3208('0x20')](_0x3208('0x3a')))),'outboundRejectCallsDay'],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db['sequelize']['fn']('IF',db[_0x3208('0x1e')]['literal'](_0x3208('0x3b')))),_0x3208('0x3c')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db['sequelize'][_0x3208('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db[_0x3208('0x1e')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3208('0x3d')]],'group':[_0x3208('0x3e')]})['then'](function(_0x3b1b30){logger[_0x3208('0x13')](_0x3208('0x2d'),_0x35df97);logger[_0x3208('0xe')](_0x3208('0x2d'),_0x35df97,JSON[_0x3208('0x2c')](_0x3b1b30));_0x419b59(_0x3b1b30);})[_0x3208('0x1a')](function(_0x4ee3db){logger[_0x3208('0x10')]('GetVoiceQueueHopperHistory',_0x4ee3db[_0x3208('0x12')],_0x35df97);_0x1588f4(_0x2618c0[_0x3208('0x10')](0x1f4,_0x4ee3db[_0x3208('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x17b7d3){var _0x4aeca7=this;return new Promise(function(_0xa5daf1,_0x299f28){return db['CmHopperHistory']['findAll']({'raw':_0x17b7d3[_0x3208('0x18')]?_0x17b7d3['options'][_0x3208('0x19')]===undefined?!![]:![]:!![],'where':_0x17b7d3[_0x3208('0x18')]?_0x17b7d3['options'][_0x3208('0x1c')]||null:null,'attributes':[[_0x3208('0x3e'),_0x3208('0x3f')],[db[_0x3208('0x1e')]['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3208('0x1d'),db[_0x3208('0x1e')]['fn']('IF',db['sequelize'][_0x3208('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x3208('0x40')]],'group':[_0x3208('0x3e')]})[_0x3208('0xb')](function(_0x41ea31){logger['info'](_0x3208('0x41'),_0x17b7d3);logger['debug'](_0x3208('0x41'),_0x17b7d3,JSON[_0x3208('0x2c')](_0x41ea31));_0xa5daf1(_0x41ea31);})['catch'](function(_0x5714c1){logger['error'](_0x3208('0x41'),_0x5714c1[_0x3208('0x12')],_0x17b7d3);_0x299f28(_0x4aeca7[_0x3208('0x10')](0x1f4,_0x5714c1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7b117dc..7f83fb0 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 _0x8a5f=['create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5cf0ad,_0x46089b){var _0x516912=function(_0x52f310){while(--_0x52f310){_0x5cf0ad['push'](_0x5cf0ad['shift']());}};_0x516912(++_0x46089b);}(_0x8a5f,0x193));var _0xf8a5=function(_0x24220b,_0x14b865){_0x24220b=_0x24220b-0x0;var _0x12975c=_0x8a5f[_0x24220b];return _0x12975c;};'use strict';var multer=require(_0xf8a5('0x0'));var util=require(_0xf8a5('0x1'));var path=require('path');var timeout=require(_0xf8a5('0x2'));var express=require(_0xf8a5('0x3'));var router=express[_0xf8a5('0x4')]();var fs_extra=require(_0xf8a5('0x5'));var auth=require(_0xf8a5('0x6'));var interaction=require(_0xf8a5('0x7'));var config=require(_0xf8a5('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xf8a5('0x9')]('/',auth[_0xf8a5('0xa')](),controller[_0xf8a5('0xb')]);router[_0xf8a5('0x9')](_0xf8a5('0xc'),auth['isAuthenticated'](),controller[_0xf8a5('0xd')]);router[_0xf8a5('0x9')](_0xf8a5('0xe'),auth[_0xf8a5('0xa')](),controller[_0xf8a5('0xf')]);router[_0xf8a5('0x10')]('/',auth[_0xf8a5('0xa')](),controller[_0xf8a5('0x11')]);router[_0xf8a5('0x12')](_0xf8a5('0xe'),auth[_0xf8a5('0xa')](),controller[_0xf8a5('0x13')]);module[_0xf8a5('0x14')]=router; \ No newline at end of file +var _0xb651=['post','create','put','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x13fc36,_0x4cdc35){var _0x5937d5=function(_0x17da60){while(--_0x17da60){_0x13fc36['push'](_0x13fc36['shift']());}};_0x5937d5(++_0x4cdc35);}(_0xb651,0x8c));var _0x1b65=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb651[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x1b65('0x0'));var util=require('util');var path=require(_0x1b65('0x1'));var timeout=require(_0x1b65('0x2'));var express=require(_0x1b65('0x3'));var router=express['Router']();var fs_extra=require(_0x1b65('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1b65('0x5'));var config=require(_0x1b65('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1b65('0x7')]('/',auth[_0x1b65('0x8')](),controller[_0x1b65('0x9')]);router[_0x1b65('0x7')]('/describe',auth[_0x1b65('0x8')](),controller[_0x1b65('0xa')]);router['get'](_0x1b65('0xb'),auth[_0x1b65('0x8')](),controller[_0x1b65('0xc')]);router[_0x1b65('0xd')]('/',auth['isAuthenticated'](),controller[_0x1b65('0xe')]);router[_0x1b65('0xf')](_0x1b65('0xb'),auth['isAuthenticated'](),controller['update']);module[_0x1b65('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f792006..c934f21 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 _0xbcba=['STRING','sequelize','exports','name'];(function(_0x294a0d,_0x4ccad7){var _0x49ce49=function(_0x1f4671){while(--_0x1f4671){_0x294a0d['push'](_0x294a0d['shift']());}};_0x49ce49(++_0x4ccad7);}(_0xbcba,0x6d));var _0xabcb=function(_0x334df6,_0x386144){_0x334df6=_0x334df6-0x0;var _0x3cb877=_0xbcba[_0x334df6];return _0x3cb877;};'use strict';var Sequelize=require(_0xabcb('0x0'));module[_0xabcb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xabcb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabcb('0x3')]},'dialPrefix':{'type':Sequelize[_0xabcb('0x3')]}}; \ No newline at end of file +var _0x50b9=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50b9,0x171));var _0x950b=function(_0x3a8ce2,_0x552ad5){_0x3a8ce2=_0x3a8ce2-0x0;var _0x2e5a45=_0x50b9[_0x3a8ce2];return _0x2e5a45;};'use strict';var Sequelize=require(_0x950b('0x0'));module['exports']={'name':{'type':Sequelize[_0x950b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x950b('0x1')]},'dialPrefix':{'type':Sequelize[_0x950b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 3dfac03..e5d2bf4 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 _0xd4eb=['name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','user','role','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','addCustomField','findOne','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./cmList.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','CmList','rawAttributes','type','key'];(function(_0x3b7fda,_0x36ff46){var _0x3fe8d0=function(_0x9d5d44){while(--_0x9d5d44){_0x3b7fda['push'](_0x3b7fda['shift']());}};_0x3fe8d0(++_0x36ff46);}(_0xd4eb,0x68));var _0xbd4e=function(_0x27fb04,_0x241192){_0x27fb04=_0x27fb04-0x0;var _0x4a964b=_0xd4eb[_0x27fb04];return _0x4a964b;};'use strict';var emlformat=require(_0xbd4e('0x0'));var rimraf=require(_0xbd4e('0x1'));var zipdir=require(_0xbd4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd4e('0x3'));var moment=require(_0xbd4e('0x4'));var BPromise=require(_0xbd4e('0x5'));var Mustache=require(_0xbd4e('0x6'));var util=require(_0xbd4e('0x7'));var path=require(_0xbd4e('0x8'));var sox=require(_0xbd4e('0x9'));var csv=require(_0xbd4e('0xa'));var ejs=require(_0xbd4e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd4e('0xc'));var squel=require(_0xbd4e('0xd'));var crypto=require(_0xbd4e('0xe'));var jsforce=require(_0xbd4e('0xf'));var deskjs=require(_0xbd4e('0x10'));var toCsv=require(_0xbd4e('0xa'));var querystring=require(_0xbd4e('0x11'));var Papa=require(_0xbd4e('0x12'));var Redis=require(_0xbd4e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd4e('0x14'));var as=require(_0xbd4e('0x15'));var hardwareService=require(_0xbd4e('0x16'));var logger=require('../../config/logger')(_0xbd4e('0x17'));var utils=require('../../config/utils');var config=require(_0xbd4e('0x18'));var licenseUtil=require(_0xbd4e('0x19'));var db=require(_0xbd4e('0x1a'))['db'];var csv_results;config['redis']=_[_0xbd4e('0x1b')](config[_0xbd4e('0x1c')],{'host':_0xbd4e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd4e('0x1c')]));require(_0xbd4e('0x1e'))[_0xbd4e('0x1f')](socket);function respondWithStatusCode(_0x18ee00,_0x5b8144){_0x5b8144=_0x5b8144||0xcc;return function(_0x55b168){if(_0x55b168){return _0x18ee00[_0xbd4e('0x20')](_0x5b8144);}return _0x18ee00[_0xbd4e('0x21')](_0x5b8144)[_0xbd4e('0x22')]();};}function respondWithResult(_0x484502,_0x148637){_0x148637=_0x148637||0xc8;return function(_0x440c40){if(_0x440c40){return _0x484502[_0xbd4e('0x21')](_0x148637)['json'](_0x440c40);}};}function respondWithFilteredResult(_0x2edfd2,_0x26940d){return function(_0x542e43){if(_0x542e43){var _0x1995d4=typeof _0x26940d[_0xbd4e('0x23')]===_0xbd4e('0x24')&&typeof _0x26940d['limit']===_0xbd4e('0x24');var _0x678381=_0x542e43[_0xbd4e('0x25')];var _0x3168b0=_0x1995d4?0x0:_0x26940d[_0xbd4e('0x23')];var _0x157769=_0x1995d4?_0x542e43['count']:_0x26940d[_0xbd4e('0x23')]+_0x26940d[_0xbd4e('0x26')];var _0x1fc0d7;if(_0x157769>=_0x678381){_0x157769=_0x678381;_0x1fc0d7=0xc8;}else{_0x1fc0d7=0xce;}_0x2edfd2[_0xbd4e('0x21')](_0x1fc0d7);return _0x2edfd2[_0xbd4e('0x27')](_0xbd4e('0x28'),_0x3168b0+'-'+_0x157769+'/'+_0x678381)[_0xbd4e('0x29')](_0x542e43);}return null;};}function patchUpdates(_0x20fe09){return function(_0x2b7c2c){try{jsonpatch[_0xbd4e('0x2a')](_0x2b7c2c,_0x20fe09,!![]);}catch(_0x2aa26c){return BPromise['reject'](_0x2aa26c);}return _0x2b7c2c['save']();};}function saveUpdates(_0x5b0ebd,_0xbd01ee){return function(_0x1a0347){if(_0x1a0347){return _0x1a0347[_0xbd4e('0x2b')](_0x5b0ebd)[_0xbd4e('0x2c')](function(_0x23f8b0){return _0x23f8b0;});}return null;};}function removeEntity(_0x1d437c,_0x4de9cf){return function(_0x191f27){if(_0x191f27){return _0x191f27[_0xbd4e('0x2d')]()[_0xbd4e('0x2c')](function(){var _0x142bd9=_0x191f27[_0xbd4e('0x2e')]({'plain':!![]});var _0x5b9450='Lists';return db[_0xbd4e('0x2f')][_0xbd4e('0x2d')]({'where':{'type':_0x5b9450,'resourceId':_0x142bd9['id']}})[_0xbd4e('0x2c')](function(){return _0x191f27;});})['then'](function(){_0x1d437c['status'](0xcc)[_0xbd4e('0x22')]();});}};}function handleEntityNotFound(_0x4b8a67,_0x3eca9b){return function(_0x20b295){if(!_0x20b295){_0x4b8a67[_0xbd4e('0x20')](0x194);}return _0x20b295;};}function handleError(_0x541241,_0x31b9aa){_0x31b9aa=_0x31b9aa||0x1f4;return function(_0x5bcf7e){logger[_0xbd4e('0x30')](_0x5bcf7e[_0xbd4e('0x31')]);if(_0x5bcf7e['name']){delete _0x5bcf7e['name'];}_0x541241[_0xbd4e('0x21')](_0x31b9aa)[_0xbd4e('0x32')](_0x5bcf7e);};}exports[_0xbd4e('0x33')]=function(_0x41ff1b,_0x460466){var _0x5d7efe={},_0x5e5a69={},_0x595396={'count':0x0,'rows':[]};var _0x582793=_[_0xbd4e('0x34')](db[_0xbd4e('0x35')][_0xbd4e('0x36')],function(_0x54a149){return{'name':_0x54a149['fieldName'],'type':_0x54a149[_0xbd4e('0x37')][_0xbd4e('0x38')]};});_0x5e5a69['model']=_[_0xbd4e('0x34')](_0x582793,_0xbd4e('0x39'));_0x5e5a69[_0xbd4e('0x3a')]=_['keys'](_0x41ff1b[_0xbd4e('0x3a')]);_0x5e5a69[_0xbd4e('0x3b')]=_['intersection'](_0x5e5a69[_0xbd4e('0x3c')],_0x5e5a69['query']);_0x5d7efe[_0xbd4e('0x3d')]=_[_0xbd4e('0x3e')](_0x5e5a69[_0xbd4e('0x3c')],qs[_0xbd4e('0x3f')](_0x41ff1b[_0xbd4e('0x3a')][_0xbd4e('0x3f')]));_0x5d7efe[_0xbd4e('0x3d')]=_0x5d7efe[_0xbd4e('0x3d')][_0xbd4e('0x40')]?_0x5d7efe[_0xbd4e('0x3d')]:_0x5e5a69[_0xbd4e('0x3c')];if(!_0x41ff1b['query'][_0xbd4e('0x41')](_0xbd4e('0x42'))){_0x5d7efe['limit']=qs['limit'](_0x41ff1b[_0xbd4e('0x3a')]['limit']);_0x5d7efe[_0xbd4e('0x23')]=qs[_0xbd4e('0x23')](_0x41ff1b[_0xbd4e('0x3a')][_0xbd4e('0x23')]);}_0x5d7efe[_0xbd4e('0x43')]=qs[_0xbd4e('0x44')](_0x41ff1b[_0xbd4e('0x3a')][_0xbd4e('0x44')]);_0x5d7efe[_0xbd4e('0x45')]=qs[_0xbd4e('0x3b')](_[_0xbd4e('0x46')](_0x41ff1b['query'],_0x5e5a69['filters']),_0x582793);if(_0x41ff1b[_0xbd4e('0x3a')][_0xbd4e('0x47')]){_0x5d7efe['where']=_['merge'](_0x5d7efe[_0xbd4e('0x45')],{'$or':_[_0xbd4e('0x34')](_0x582793,function(_0x38bbc5){if(_0x38bbc5['type']!==_0xbd4e('0x48')){var _0x546424={};_0x546424[_0x38bbc5[_0xbd4e('0x39')]]={'$like':'%'+_0x41ff1b[_0xbd4e('0x3a')][_0xbd4e('0x47')]+'%'};return _0x546424;}})});}_0x5d7efe=_[_0xbd4e('0x49')]({},_0x5d7efe,_0x41ff1b[_0xbd4e('0x4a')]);var _0x446e65={'where':_0x5d7efe[_0xbd4e('0x45')]};return db[_0xbd4e('0x35')]['count'](_0x446e65)[_0xbd4e('0x2c')](function(_0x273d29){_0x595396[_0xbd4e('0x25')]=_0x273d29;if(_0x41ff1b[_0xbd4e('0x3a')][_0xbd4e('0x4b')]){_0x5d7efe['include']=[{'all':!![]}];}return db[_0xbd4e('0x35')][_0xbd4e('0x4c')](_0x5d7efe);})[_0xbd4e('0x2c')](function(_0x164bab){_0x595396[_0xbd4e('0x4d')]=_0x164bab;return _0x595396;})[_0xbd4e('0x2c')](respondWithFilteredResult(_0x460466,_0x5d7efe))[_0xbd4e('0x4e')](handleError(_0x460466,null));};exports[_0xbd4e('0x4f')]=function(_0x411506,_0x11c40a){var _0x3b6434={'raw':![],'where':{'id':_0x411506[_0xbd4e('0x50')]['id']}},_0xbd5130={};_0xbd5130[_0xbd4e('0x3c')]=_[_0xbd4e('0x51')](db[_0xbd4e('0x35')]['rawAttributes']);_0xbd5130['query']=_[_0xbd4e('0x51')](_0x411506[_0xbd4e('0x3a')]);_0xbd5130['filters']=_[_0xbd4e('0x3e')](_0xbd5130[_0xbd4e('0x3c')],_0xbd5130[_0xbd4e('0x3a')]);_0x3b6434[_0xbd4e('0x3d')]=_[_0xbd4e('0x3e')](_0xbd5130[_0xbd4e('0x3c')],qs[_0xbd4e('0x3f')](_0x411506[_0xbd4e('0x3a')][_0xbd4e('0x3f')]));_0x3b6434[_0xbd4e('0x3d')]=_0x3b6434[_0xbd4e('0x3d')][_0xbd4e('0x40')]?_0x3b6434[_0xbd4e('0x3d')]:_0xbd5130[_0xbd4e('0x3c')];if(_0x411506[_0xbd4e('0x3a')][_0xbd4e('0x4b')]){_0x3b6434[_0xbd4e('0x52')]=[{'all':!![]}];}_0x3b6434=_['merge']({},_0x3b6434,_0x411506[_0xbd4e('0x4a')]);return db['CmList'][_0xbd4e('0x53')](_0x3b6434)[_0xbd4e('0x2c')](handleEntityNotFound(_0x11c40a,null))[_0xbd4e('0x2c')](respondWithResult(_0x11c40a,null))['catch'](handleError(_0x11c40a,null));};exports[_0xbd4e('0x54')]=function(_0x1cfb4d,_0x209b73){return db[_0xbd4e('0x35')][_0xbd4e('0x54')](_0x1cfb4d['body'],{})[_0xbd4e('0x2c')](function(_0xb63db0){var _0x2b69fe=_0x1cfb4d[_0xbd4e('0x55')][_0xbd4e('0x2e')]({'plain':!![]});if(!_0x2b69fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b69fe[_0xbd4e('0x56')]===_0xbd4e('0x55')){var _0x4987a4=_0xb63db0[_0xbd4e('0x2e')]({'plain':!![]});var _0x2b77ff=_0xbd4e('0x57');return db['UserProfileSection'][_0xbd4e('0x53')]({'where':{'name':_0x2b77ff,'userProfileId':_0x2b69fe[_0xbd4e('0x58')]},'raw':!![]})[_0xbd4e('0x2c')](function(_0x57842c){if(_0x57842c&&_0x57842c[_0xbd4e('0x59')]===0x0){return db[_0xbd4e('0x2f')][_0xbd4e('0x54')]({'name':_0x4987a4['name'],'resourceId':_0x4987a4['id'],'type':_0x57842c[_0xbd4e('0x39')],'sectionId':_0x57842c['id']},{})['then'](function(){return _0xb63db0;});}else{return _0xb63db0;}})[_0xbd4e('0x4e')](function(_0x5cc241){logger[_0xbd4e('0x30')](_0xbd4e('0x5a'),_0x5cc241);throw _0x5cc241;});}return _0xb63db0;})[_0xbd4e('0x2c')](respondWithResult(_0x209b73,0xc9))[_0xbd4e('0x4e')](handleError(_0x209b73,null));};exports[_0xbd4e('0x2b')]=function(_0x58fa42,_0x2f8986){if(_0x58fa42[_0xbd4e('0x5b')]['id']){delete _0x58fa42[_0xbd4e('0x5b')]['id'];}return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x58fa42['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x2f8986,null))[_0xbd4e('0x2c')](saveUpdates(_0x58fa42['body'],null))[_0xbd4e('0x2c')](respondWithResult(_0x2f8986,null))[_0xbd4e('0x4e')](handleError(_0x2f8986,null));};exports[_0xbd4e('0x2d')]=function(_0x286139,_0x222755){return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x286139['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x222755,null))['then'](removeEntity(_0x222755,null))[_0xbd4e('0x4e')](handleError(_0x222755,null));};exports[_0xbd4e('0x5c')]=function(_0x28b1e0,_0x9487f2){return db[_0xbd4e('0x35')][_0xbd4e('0x5c')]()[_0xbd4e('0x2c')](respondWithResult(_0x9487f2,null))['catch'](handleError(_0x9487f2,null));};exports[_0xbd4e('0x5d')]=function(_0x4ddce1,_0x5022a5,_0x55f18d){if(_0x4ddce1[_0xbd4e('0x5b')]['id']){delete _0x4ddce1[_0xbd4e('0x5b')]['id'];}return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x4ddce1[_0xbd4e('0x50')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x5022a5,null))[_0xbd4e('0x2c')](function(_0x4ba222){if(_0x4ba222){_0x4ddce1[_0xbd4e('0x5b')][_0xbd4e('0x5e')]=_0x4ba222['id'];return db[_0xbd4e('0x5f')][_0xbd4e('0x54')](_0x4ddce1[_0xbd4e('0x5b')]);}})[_0xbd4e('0x2c')](respondWithResult(_0x5022a5,null))['catch'](handleError(_0x5022a5,null));};exports['getDispositions']=function(_0x368566,_0x38b8ed,_0x55666e){var _0x508eb9={'raw':![],'where':{}};var _0x133d66={};var _0xa2b50e={'count':0x0,'rows':[]};return db[_0xbd4e('0x35')]['findOne']({'where':{'id':_0x368566[_0xbd4e('0x50')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x38b8ed,null))[_0xbd4e('0x2c')](function(_0x37a636){if(_0x37a636){_0x133d66[_0xbd4e('0x3c')]=_[_0xbd4e('0x51')](db[_0xbd4e('0x5f')][_0xbd4e('0x36')]);_0x133d66[_0xbd4e('0x3a')]=_[_0xbd4e('0x51')](_0x368566[_0xbd4e('0x3a')]);_0x133d66['filters']=_[_0xbd4e('0x3e')](_0x133d66[_0xbd4e('0x3c')],_0x133d66[_0xbd4e('0x3a')]);_0x508eb9[_0xbd4e('0x3d')]=_['intersection'](_0x133d66[_0xbd4e('0x3c')],qs[_0xbd4e('0x3f')](_0x368566[_0xbd4e('0x3a')]['fields']));_0x508eb9[_0xbd4e('0x3d')]=_0x508eb9[_0xbd4e('0x3d')][_0xbd4e('0x40')]?_0x508eb9[_0xbd4e('0x3d')]:_0x133d66[_0xbd4e('0x3c')];if(!_0x368566['query'][_0xbd4e('0x41')]('nolimit')){_0x508eb9['limit']=qs[_0xbd4e('0x26')](_0x368566['query']['limit']);_0x508eb9[_0xbd4e('0x23')]=qs['offset'](_0x368566['query'][_0xbd4e('0x23')]);}_0x508eb9[_0xbd4e('0x43')]=qs[_0xbd4e('0x44')](_0x368566[_0xbd4e('0x3a')][_0xbd4e('0x44')]);_0x508eb9[_0xbd4e('0x45')]=qs[_0xbd4e('0x3b')](_[_0xbd4e('0x46')](_0x368566[_0xbd4e('0x3a')],_0x133d66[_0xbd4e('0x3b')]));_0x508eb9['where'][_0xbd4e('0x5e')]=_0x37a636['id'];if(_0x368566[_0xbd4e('0x3a')]['filter']){_0x508eb9[_0xbd4e('0x45')]=_[_0xbd4e('0x49')](_0x508eb9[_0xbd4e('0x45')],{'$or':_[_0xbd4e('0x34')](_0x508eb9['attributes'],function(_0x261083){var _0x35574f={};_0x35574f[_0x261083]={'$like':'%'+_0x368566[_0xbd4e('0x3a')][_0xbd4e('0x47')]+'%'};return _0x35574f;})});}_0x508eb9=_[_0xbd4e('0x49')]({},_0x508eb9,_0x368566[_0xbd4e('0x4a')]);return db['Disposition']['count']({'where':_0x508eb9[_0xbd4e('0x45')]})['then'](function(_0xc665cf){_0xa2b50e[_0xbd4e('0x25')]=_0xc665cf;if(_0x368566['query'][_0xbd4e('0x4b')]){_0x508eb9[_0xbd4e('0x52')]=[{'all':!![]}];}return db[_0xbd4e('0x5f')][_0xbd4e('0x4c')](_0x508eb9);})[_0xbd4e('0x2c')](function(_0x29f553){_0xa2b50e[_0xbd4e('0x4d')]=_0x29f553;return _0xa2b50e;});}})[_0xbd4e('0x2c')](respondWithFilteredResult(_0x38b8ed,_0x508eb9))[_0xbd4e('0x4e')](handleError(_0x38b8ed,null));};exports[_0xbd4e('0x60')]=function(_0x3734f5,_0x167887,_0x2ed00d){return db['CmList'][_0xbd4e('0x53')]({'where':{'id':_0x3734f5[_0xbd4e('0x50')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x167887,null))[_0xbd4e('0x2c')](function(_0xa03b14){if(_0xa03b14){return _0xa03b14[_0xbd4e('0x60')](_0x3734f5[_0xbd4e('0x3a')][_0xbd4e('0x61')]);}})[_0xbd4e('0x2c')](respondWithStatusCode(_0x167887,null))[_0xbd4e('0x4e')](handleError(_0x167887,null));};exports[_0xbd4e('0x62')]=function(_0x21d9b7,_0x226595,_0x367c94){return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x21d9b7[_0xbd4e('0x50')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x226595,null))[_0xbd4e('0x2c')](function(_0x50f057){if(_0x50f057){var _0x4def18=[];var _0x4224c0={'success':[],'errors':[]};return db[_0xbd4e('0x63')]['describe']()[_0xbd4e('0x2c')](function(_0x4033f4){if(_0x21d9b7['body']['tags']&&_[_0xbd4e('0x64')](_0x21d9b7[_0xbd4e('0x5b')][_0xbd4e('0x65')])){if(_0x21d9b7[_0xbd4e('0x5b')][_0xbd4e('0x65')][_0xbd4e('0x40')]){_0x21d9b7[_0xbd4e('0x5b')][_0xbd4e('0x65')]=_0x21d9b7[_0xbd4e('0x5b')][_0xbd4e('0x65')][_0xbd4e('0x66')](';')+';';}else{_0x21d9b7[_0xbd4e('0x5b')][_0xbd4e('0x65')]=null;}}else{_0x21d9b7['body'][_0xbd4e('0x65')]=null;}if(_0x21d9b7[_0xbd4e('0x5b')]&&_[_0xbd4e('0x64')](_0x21d9b7[_0xbd4e('0x5b')])){for(var _0x45cd84=0x0;_0x45cd84<_0x21d9b7[_0xbd4e('0x5b')]['length'];_0x45cd84+=0x1){_0x21d9b7[_0xbd4e('0x5b')][_0x45cd84]['ListId']=_0x21d9b7[_0xbd4e('0x50')]['id'];_0x4def18[_0xbd4e('0x67')](_0x21d9b7['body'][_0x45cd84]);}return BPromise[_0xbd4e('0x68')](_0x4def18,function(_0x9fcca){return db[_0xbd4e('0x63')][_0xbd4e('0x54')](_[_0xbd4e('0x69')](_0x9fcca,['ids','id'])||{},{'fields':_[_0xbd4e('0x51')](_0x4033f4),'raw':!![]})[_0xbd4e('0x2c')](function(_0x2506ce){_0x4224c0[_0xbd4e('0x6a')][_0xbd4e('0x67')](_0x2506ce[_0xbd4e('0x6b')]);})[_0xbd4e('0x4e')](function(_0x36cd87){_0x4224c0[_0xbd4e('0x6c')]['push']({'data':_0x9fcca,'error':_0x36cd87[_0xbd4e('0x6d')]});});})['then'](function(_0x5c1a21){return _0x4224c0;})[_0xbd4e('0x4e')](function(_0x478698){return _0x478698;});}else{_0x226595[_0xbd4e('0x21')](0x190)[_0xbd4e('0x29')]({'message':_0xbd4e('0x6e')});}});}})[_0xbd4e('0x2c')](respondWithResult(_0x226595,null))[_0xbd4e('0x4e')](handleError(_0x226595,null));};exports[_0xbd4e('0x6f')]=function(_0x4a6c92,_0xe1197d,_0x486300){var _0x28917c;return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x4a6c92['params']['id']},'include':[{'model':db[_0xbd4e('0x70')],'as':_0xbd4e('0x71')}]})['then'](handleEntityNotFound(_0xe1197d,null))[_0xbd4e('0x2c')](function(_0xc2891b){if(_0xc2891b){_0x28917c=_0xc2891b;return db[_0xbd4e('0x63')][_0xbd4e('0x36')];}})[_0xbd4e('0x2c')](function(_0x54e895){if(_0x54e895){var _0x1449e0={};var _0x27379b={};_0x27379b[_0xbd4e('0x3c')]=_['concat'](_[_0xbd4e('0x51')](_0x54e895),_[_0xbd4e('0x34')](_0x28917c[_0xbd4e('0x71')],function(_0x5e08df){return util[_0xbd4e('0x72')](_0xbd4e('0x73'),_0x5e08df['id']);}));_0x27379b['query']=_[_0xbd4e('0x51')](_0x4a6c92[_0xbd4e('0x3a')]);_0x27379b[_0xbd4e('0x3b')]=_[_0xbd4e('0x3e')](_0x27379b[_0xbd4e('0x3c')],_0x27379b[_0xbd4e('0x3a')]);_0x1449e0[_0xbd4e('0x3d')]=_['intersection'](_0x27379b[_0xbd4e('0x3c')],qs[_0xbd4e('0x3f')](_0x4a6c92[_0xbd4e('0x3a')]['fields']));_0x1449e0[_0xbd4e('0x3d')]=_0x1449e0['attributes'][_0xbd4e('0x40')]?_0x1449e0[_0xbd4e('0x3d')]:_0x27379b[_0xbd4e('0x3c')];if(!_0x4a6c92[_0xbd4e('0x3a')][_0xbd4e('0x41')]('nolimit')){_0x1449e0[_0xbd4e('0x26')]=qs[_0xbd4e('0x26')](_0x4a6c92[_0xbd4e('0x3a')][_0xbd4e('0x26')]);_0x1449e0[_0xbd4e('0x23')]=qs[_0xbd4e('0x23')](_0x4a6c92[_0xbd4e('0x3a')][_0xbd4e('0x23')]);}_0x1449e0[_0xbd4e('0x43')]=qs[_0xbd4e('0x44')](_0x4a6c92[_0xbd4e('0x3a')][_0xbd4e('0x44')]);_0x1449e0[_0xbd4e('0x45')]=qs[_0xbd4e('0x3b')](_[_0xbd4e('0x46')](_0x4a6c92['query'],_0x27379b[_0xbd4e('0x3b')]));_0x1449e0['raw']=!![];if(_0x4a6c92[_0xbd4e('0x3a')][_0xbd4e('0x47')]){_0x1449e0[_0xbd4e('0x45')]=_[_0xbd4e('0x49')](_0x1449e0[_0xbd4e('0x45')],{'$or':_['map'](_0x1449e0[_0xbd4e('0x3d')],function(_0x2fb8de){var _0x52fd65={};_0x52fd65[_0x2fb8de]={'$like':'%'+_0x4a6c92[_0xbd4e('0x3a')][_0xbd4e('0x47')]+'%'};return _0x52fd65;})});}_0x1449e0=_[_0xbd4e('0x49')]({},_0x1449e0,_0x4a6c92[_0xbd4e('0x4a')]);return _0x28917c['getContacts'](_0x1449e0);}})[_0xbd4e('0x2c')](respondWithResult(_0xe1197d,null))['catch'](handleError(_0xe1197d,null));};exports['getContactsCsv']=function(_0x4f45d2,_0x7e049b,_0x33b2e0){var _0xd70b59;var _0x272ce4;var _0x585784;var _0x325b38=_0x4f45d2[_0xbd4e('0x50')]['id'];csv_results=[];return db['ContactItemType'][_0xbd4e('0x4c')]({'attributes':['id',_0xbd4e('0x39')],'raw':!![],'order':['OrderBy']})[_0xbd4e('0x2c')](function(_0x1fe689){_0xd70b59=_0x1fe689;var _0x5c2f40=_[_0xbd4e('0x51')](db['CmContact'][_0xbd4e('0x36')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0xbd4e('0x74')]})[_0xbd4e('0x2c')](function(_0x33f40c){_0x272ce4=_0x33f40c;var _0x51f47b=squel[_0xbd4e('0x75')]()['fields'](_0x5c2f40)[_0xbd4e('0x76')](_0xbd4e('0x77'),'c')['where'](_0xbd4e('0x78'),_0x325b38)[_0xbd4e('0x45')]('c.deletedAt\x20is\x20null')[_0xbd4e('0x79')]();for(var _0x19ab46=0x0;_0x19ab46<_0x272ce4['length'];_0x19ab46++){_0x51f47b[_0xbd4e('0x7a')](_0xbd4e('0x7b')+_0x272ce4[_0x19ab46]['id'],'customField_'+_0x272ce4[_0x19ab46][_0xbd4e('0x74')]);}for(var _0x19ab46=0x0;_0x19ab46<_0xd70b59['length'];_0x19ab46++){_0x51f47b[_0xbd4e('0x7a')](squel[_0xbd4e('0x75')]()[_0xbd4e('0x7a')](_0xbd4e('0x7c'))['from'](_0xbd4e('0x7d'))['where']('ItemTypeId\x20=\x20?',_0xd70b59[_0x19ab46]['id'])[_0xbd4e('0x45')](_0xbd4e('0x7e')),_0xbd4e('0x7f')+_0xd70b59[_0x19ab46][_0xbd4e('0x39')]);_0x51f47b[_0xbd4e('0x7a')](squel[_0xbd4e('0x75')]()[_0xbd4e('0x7a')](_0xbd4e('0x80'))['from'](_0xbd4e('0x7d'))[_0xbd4e('0x45')](_0xbd4e('0x81'),_0xd70b59[_0x19ab46]['id'])['where'](_0xbd4e('0x7e')),_0xbd4e('0x82')+_0xd70b59[_0x19ab46]['name']);}var _0xd84d1f=[];_0xd84d1f[_0xbd4e('0x67')](_0x51f47b[_0xbd4e('0x83')]());BPromise['each'](_0xd84d1f,handleQuery)[_0xbd4e('0x2c')](function(_0x53660d){handleQuery(_0x51f47b[_0xbd4e('0x83')]());var _0x50b8ac=csv_results[0x0];if(!_[_0xbd4e('0x84')](_0x50b8ac)){var _0x3ebc83=toCsv(_0x50b8ac);var _0x210010=Date[_0xbd4e('0x85')]();fs['writeFileSync'](util[_0xbd4e('0x72')](_0xbd4e('0x86'),_0x325b38,_0x210010),_0x3ebc83);_0x7e049b[_0xbd4e('0x87')](_0xbd4e('0x88'),'attachment;\x20filename='+util[_0xbd4e('0x72')](_0xbd4e('0x89'),_0x325b38,_0x210010));_0x7e049b[_0xbd4e('0x87')](_0xbd4e('0x8a'),'text/csv');return _0x7e049b['download'](util[_0xbd4e('0x72')](_0xbd4e('0x86'),_0x325b38,_0x210010));}else{return _0x7e049b[_0xbd4e('0x20')](0xcc);}});});});};exports[_0xbd4e('0x8b')]=function(_0x46d2d6,_0x2d4f89,_0x2bf7bc){var _0x2b9cb9;delete _0x46d2d6[_0xbd4e('0x5b')]['id'];return db[_0xbd4e('0x35')][_0xbd4e('0x8c')]({'where':{'id':_0x46d2d6[_0xbd4e('0x50')]['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x2d4f89,null))[_0xbd4e('0x2c')](function(_0x5ea2e9){if(_0x5ea2e9){return db['sequelize']['transaction'](function(_0x3b67c9){return db[_0xbd4e('0x70')][_0xbd4e('0x54')](_0x46d2d6[_0xbd4e('0x5b')],{'transaction':_0x3b67c9})['then'](function(_0x47ab68){_0x2b9cb9=_0x47ab68;return _0x5ea2e9[_0xbd4e('0x8d')](_0x47ab68,{'transaction':_0x3b67c9});})[_0xbd4e('0x2c')](function(){var _0xc67df={'type':db[_0xbd4e('0x8e')][_0xbd4e('0x8f')],'transaction':_0x3b67c9};switch(_0x46d2d6[_0xbd4e('0x5b')][_0xbd4e('0x37')]){case _0xbd4e('0x90'):_0xc67df['type']=db[_0xbd4e('0x8e')][_0xbd4e('0x8f')];break;case _0xbd4e('0x91'):_0xc67df[_0xbd4e('0x37')]=db[_0xbd4e('0x8e')][_0xbd4e('0x92')];break;case _0xbd4e('0x93'):_0xc67df[_0xbd4e('0x37')]=db['Sequelize'][_0xbd4e('0x94')];_0xc67df[_0xbd4e('0x95')]=![];break;default:}return db[_0xbd4e('0x96')]['queryInterface']['addColumn'](_0xbd4e('0x77'),util['format'](_0xbd4e('0x97'),_0x2b9cb9['id']),_0xc67df);})[_0xbd4e('0x2c')](function(){return _0x2b9cb9;});});}})[_0xbd4e('0x2c')](respondWithResult(_0x2d4f89,null))[_0xbd4e('0x4e')](handleError(_0x2d4f89,null));};exports['getCustomFields']=function(_0x4e852a,_0x48b883,_0x5043f9){var _0x524c8b={};var _0x3aa9ba={};var _0x3bab71;var _0x4a7b1c;return db[_0xbd4e('0x35')][_0xbd4e('0x8c')]({'where':{'id':_0x4e852a['params']['id']}})['then'](handleEntityNotFound(_0x48b883,null))[_0xbd4e('0x2c')](function(_0x31baf0){if(_0x31baf0){_0x3bab71=_0x31baf0;_0x3aa9ba[_0xbd4e('0x3c')]=_[_0xbd4e('0x51')](db[_0xbd4e('0x70')]['rawAttributes']);_0x3aa9ba[_0xbd4e('0x3a')]=_[_0xbd4e('0x51')](_0x4e852a[_0xbd4e('0x3a')]);_0x3aa9ba[_0xbd4e('0x3b')]=_[_0xbd4e('0x3e')](_0x3aa9ba[_0xbd4e('0x3c')],_0x3aa9ba['query']);_0x524c8b['attributes']=_[_0xbd4e('0x3e')](_0x3aa9ba[_0xbd4e('0x3c')],qs['fields'](_0x4e852a[_0xbd4e('0x3a')][_0xbd4e('0x3f')]));_0x524c8b['attributes']=_0x524c8b[_0xbd4e('0x3d')][_0xbd4e('0x40')]?_0x524c8b['attributes']:_0x3aa9ba[_0xbd4e('0x3c')];_0x524c8b[_0xbd4e('0x43')]=qs[_0xbd4e('0x44')](_0x4e852a[_0xbd4e('0x3a')][_0xbd4e('0x44')]);_0x524c8b['where']=qs[_0xbd4e('0x3b')](_[_0xbd4e('0x46')](_0x4e852a['query'],_0x3aa9ba['filters']));_0x524c8b['where']=_[_0xbd4e('0x49')](_0x524c8b[_0xbd4e('0x45')],{'$or':[{'ListId':_0x31baf0['id']},{'ListId':null}]});if(_0x4e852a[_0xbd4e('0x3a')][_0xbd4e('0x47')]){_0x524c8b['where']=_[_0xbd4e('0x49')](_0x524c8b[_0xbd4e('0x45')],{'$or':_[_0xbd4e('0x34')](_0x524c8b[_0xbd4e('0x3d')],function(_0x3991f6){var _0x4fefb1={};_0x4fefb1[_0x3991f6]={'$like':'%'+_0x4e852a[_0xbd4e('0x3a')][_0xbd4e('0x47')]+'%'};return _0x4fefb1;})});}_0x524c8b=_[_0xbd4e('0x49')]({},_0x524c8b,_0x4e852a[_0xbd4e('0x4a')]);return db[_0xbd4e('0x70')][_0xbd4e('0x98')](_0x524c8b);}})[_0xbd4e('0x2c')](respondWithResult(_0x48b883,null))['catch'](handleError(_0x48b883,null));};exports[_0xbd4e('0x99')]=function(_0x590a31,_0x6cac5){return db['CmCustomField'][_0xbd4e('0x98')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x6cac5,null))[_0xbd4e('0x2c')](function(_0x51d420){return _0x51d420;})[_0xbd4e('0x2c')](respondWithResult(_0x6cac5,null))[_0xbd4e('0x4e')](handleError(_0x6cac5,null));};exports[_0xbd4e('0x9a')]=function(_0x3410f9,_0x499b52,_0x119730){return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x3410f9[_0xbd4e('0x50')]['id']}})['then'](handleEntityNotFound(_0x499b52,null))['then'](function(_0x2831e9){if(_0x2831e9){return _0x2831e9[_0xbd4e('0x9a')](_0x3410f9[_0xbd4e('0x5b')][_0xbd4e('0x61')],_['omit'](_0x3410f9[_0xbd4e('0x5b')],[_0xbd4e('0x61'),'id'])||{})[_0xbd4e('0x9b')](function(_0x192b07){for(var _0x3fb890=0x0;_0x3fb890<_0x3410f9[_0xbd4e('0x5b')]['ids'][_0xbd4e('0x40')];_0x3fb890+=0x1){socket[_0xbd4e('0x9c')](_0xbd4e('0x9d'),{'UserId':Number(_0x3410f9[_0xbd4e('0x5b')][_0xbd4e('0x61')][_0x3fb890]),'CmListId':Number(_0x3410f9[_0xbd4e('0x50')]['id'])});}return _0x192b07;});}})['then'](respondWithResult(_0x499b52,null))['catch'](handleError(_0x499b52,null));};exports[_0xbd4e('0x9e')]=function(_0x1bd31a,_0x154711,_0x31de63){return db[_0xbd4e('0x35')][_0xbd4e('0x53')]({'where':{'id':_0x1bd31a['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x154711,null))[_0xbd4e('0x2c')](function(_0x498516){if(_0x498516){return _0x498516[_0xbd4e('0x9e')](_0x1bd31a[_0xbd4e('0x3a')][_0xbd4e('0x61')])[_0xbd4e('0x2c')](function(){if(_[_0xbd4e('0x64')](_0x1bd31a[_0xbd4e('0x3a')][_0xbd4e('0x61')])){for(var _0x43be90=0x0;_0x43be90<_0x1bd31a[_0xbd4e('0x3a')][_0xbd4e('0x61')][_0xbd4e('0x40')];_0x43be90+=0x1){socket[_0xbd4e('0x9c')](_0xbd4e('0x9f'),{'UserId':Number(_0x1bd31a[_0xbd4e('0x3a')][_0xbd4e('0x61')][_0x43be90]),'CmListId':Number(_0x1bd31a[_0xbd4e('0x50')]['id'])});}}else{socket[_0xbd4e('0x9c')](_0xbd4e('0x9f'),{'UserId':Number(_0x1bd31a[_0xbd4e('0x3a')][_0xbd4e('0x61')]),'CmListId':Number(_0x1bd31a['params']['id'])});}});}})[_0xbd4e('0x2c')](respondWithStatusCode(_0x154711,null))[_0xbd4e('0x4e')](handleError(_0x154711,null));};exports['getAgents']=function(_0x1a4e70,_0x1fddd2,_0x49394b){var _0x52f90e={};var _0x56fad8={};var _0x18dcf6;var _0x15575c;return db[_0xbd4e('0x35')][_0xbd4e('0x8c')]({'where':{'id':_0x1a4e70['params']['id']}})[_0xbd4e('0x2c')](handleEntityNotFound(_0x1fddd2,null))[_0xbd4e('0x2c')](function(_0x14a7da){if(_0x14a7da){_0x18dcf6=_0x14a7da;_0x56fad8[_0xbd4e('0x3c')]=_['keys'](db['User']['rawAttributes']);_0x56fad8[_0xbd4e('0x3a')]=_[_0xbd4e('0x51')](_0x1a4e70[_0xbd4e('0x3a')]);_0x56fad8['filters']=_[_0xbd4e('0x3e')](_0x56fad8[_0xbd4e('0x3c')],_0x56fad8['query']);_0x52f90e[_0xbd4e('0x3d')]=_['intersection'](_0x56fad8[_0xbd4e('0x3c')],qs[_0xbd4e('0x3f')](_0x1a4e70[_0xbd4e('0x3a')][_0xbd4e('0x3f')]));_0x52f90e['attributes']=_0x52f90e[_0xbd4e('0x3d')][_0xbd4e('0x40')]?_0x52f90e[_0xbd4e('0x3d')]:_0x56fad8[_0xbd4e('0x3c')];_0x52f90e[_0xbd4e('0x43')]=qs[_0xbd4e('0x44')](_0x1a4e70[_0xbd4e('0x3a')][_0xbd4e('0x44')]);_0x52f90e[_0xbd4e('0x45')]=qs[_0xbd4e('0x3b')](_[_0xbd4e('0x46')](_0x1a4e70[_0xbd4e('0x3a')],_0x56fad8[_0xbd4e('0x3b')]));if(_0x1a4e70[_0xbd4e('0x3a')][_0xbd4e('0x47')]){_0x52f90e[_0xbd4e('0x45')]=_[_0xbd4e('0x49')](_0x52f90e['where'],{'$or':_[_0xbd4e('0x34')](_0x52f90e[_0xbd4e('0x3d')],function(_0x518158){var _0x4f01bd={};_0x4f01bd[_0x518158]={'$like':'%'+_0x1a4e70[_0xbd4e('0x3a')][_0xbd4e('0x47')]+'%'};return _0x4f01bd;})});}_0x52f90e=_[_0xbd4e('0x49')]({},_0x52f90e,_0x1a4e70[_0xbd4e('0x4a')]);return _0x18dcf6[_0xbd4e('0xa0')](_0x52f90e);}})[_0xbd4e('0x2c')](function(_0x430d2a){if(_0x430d2a){_0x15575c=_0x430d2a[_0xbd4e('0x40')];if(!_0x1a4e70[_0xbd4e('0x3a')]['hasOwnProperty'](_0xbd4e('0x42'))){_0x52f90e['limit']=qs[_0xbd4e('0x26')](_0x1a4e70[_0xbd4e('0x3a')][_0xbd4e('0x26')]);_0x52f90e[_0xbd4e('0x23')]=qs[_0xbd4e('0x23')](_0x1a4e70['query'][_0xbd4e('0x23')]);}return _0x18dcf6['getAgents'](_0x52f90e);}})['then'](function(_0x1a2310){if(_0x1a2310){return _0x1a2310?{'count':_0x15575c,'rows':_0x1a2310}:null;}})[_0xbd4e('0x2c')](respondWithResult(_0x1fddd2,null))['catch'](handleError(_0x1fddd2,null));};function handleQuery(_0x298e62){logger['info'](_0x298e62);return db['sequelize']['query'](_0x298e62)[_0xbd4e('0x9b')](function(_0x16ac4c){csv_results[_0xbd4e('0x67')](_0x16ac4c);})['catch'](function(_0x4fcb7c){logger[_0xbd4e('0x30')](_0x4fcb7c[_0xbd4e('0x6d')]);});} \ No newline at end of file +var _0xc18f=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','destroy','error','stack','name','index','CmList','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','create','findOne','hasOwnProperty','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','from','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','transaction','addCustomFields','TEXT','text','type','number','Sequelize','INTEGER','switch','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','info','sequelize','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x7f37b,_0x2753a9){var _0x537068=function(_0x273ce6){while(--_0x273ce6){_0x7f37b['push'](_0x7f37b['shift']());}};_0x537068(++_0x2753a9);}(_0xc18f,0x1dc));var _0xfc18=function(_0x1eaa6a,_0x52d5e7){_0x1eaa6a=_0x1eaa6a-0x0;var _0x5b6238=_0xc18f[_0x1eaa6a];return _0x5b6238;};'use strict';var emlformat=require(_0xfc18('0x0'));var rimraf=require(_0xfc18('0x1'));var zipdir=require(_0xfc18('0x2'));var jsonpatch=require(_0xfc18('0x3'));var rp=require(_0xfc18('0x4'));var moment=require(_0xfc18('0x5'));var BPromise=require(_0xfc18('0x6'));var Mustache=require(_0xfc18('0x7'));var util=require('util');var path=require(_0xfc18('0x8'));var sox=require('sox');var csv=require(_0xfc18('0x9'));var ejs=require(_0xfc18('0xa'));var fs=require('fs');var fs_extra=require(_0xfc18('0xb'));var _=require(_0xfc18('0xc'));var squel=require(_0xfc18('0xd'));var crypto=require(_0xfc18('0xe'));var jsforce=require(_0xfc18('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfc18('0x9'));var querystring=require(_0xfc18('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc18('0x11'));var hardwareService=require(_0xfc18('0x12'));var logger=require(_0xfc18('0x13'))(_0xfc18('0x14'));var utils=require(_0xfc18('0x15'));var config=require(_0xfc18('0x16'));var licenseUtil=require(_0xfc18('0x17'));var db=require(_0xfc18('0x18'))['db'];var csv_results;config[_0xfc18('0x19')]=_['defaults'](config[_0xfc18('0x19')],{'host':_0xfc18('0x1a'),'port':0x18eb});var socket=require(_0xfc18('0x1b'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x3c3299,_0x5ea0ec){_0x5ea0ec=_0x5ea0ec||0xcc;return function(_0x534418){if(_0x534418){return _0x3c3299[_0xfc18('0x1c')](_0x5ea0ec);}return _0x3c3299[_0xfc18('0x1d')](_0x5ea0ec)[_0xfc18('0x1e')]();};}function respondWithResult(_0x1f6936,_0x3fc06d){_0x3fc06d=_0x3fc06d||0xc8;return function(_0x46bbc6){if(_0x46bbc6){return _0x1f6936[_0xfc18('0x1d')](_0x3fc06d)[_0xfc18('0x1f')](_0x46bbc6);}};}function respondWithFilteredResult(_0x81b76b,_0x27ec61){return function(_0x3d0bdd){if(_0x3d0bdd){var _0x156499=typeof _0x27ec61[_0xfc18('0x20')]===_0xfc18('0x21')&&typeof _0x27ec61[_0xfc18('0x22')]==='undefined';var _0x36847b=_0x3d0bdd[_0xfc18('0x23')];var _0x4c068f=_0x156499?0x0:_0x27ec61[_0xfc18('0x20')];var _0x5ba027=_0x156499?_0x3d0bdd[_0xfc18('0x23')]:_0x27ec61[_0xfc18('0x20')]+_0x27ec61[_0xfc18('0x22')];var _0xdaac64;if(_0x5ba027>=_0x36847b){_0x5ba027=_0x36847b;_0xdaac64=0xc8;}else{_0xdaac64=0xce;}_0x81b76b[_0xfc18('0x1d')](_0xdaac64);return _0x81b76b[_0xfc18('0x24')](_0xfc18('0x25'),_0x4c068f+'-'+_0x5ba027+'/'+_0x36847b)[_0xfc18('0x1f')](_0x3d0bdd);}return null;};}function patchUpdates(_0x537beb){return function(_0x330b98){try{jsonpatch['apply'](_0x330b98,_0x537beb,!![]);}catch(_0x3cb01f){return BPromise['reject'](_0x3cb01f);}return _0x330b98[_0xfc18('0x26')]();};}function saveUpdates(_0x477c9f,_0x1b7586){return function(_0x31a433){if(_0x31a433){return _0x31a433[_0xfc18('0x27')](_0x477c9f)[_0xfc18('0x28')](function(_0x2fcc49){return _0x2fcc49;});}return null;};}function removeEntity(_0x2f3b4d,_0x10d6e5){return function(_0x2133f4){if(_0x2133f4){return _0x2133f4['destroy']()[_0xfc18('0x28')](function(){var _0xd425aa=_0x2133f4[_0xfc18('0x29')]({'plain':!![]});var _0x53ef20='Lists';return db['UserProfileResource'][_0xfc18('0x2a')]({'where':{'type':_0x53ef20,'resourceId':_0xd425aa['id']}})[_0xfc18('0x28')](function(){return _0x2133f4;});})['then'](function(){_0x2f3b4d[_0xfc18('0x1d')](0xcc)[_0xfc18('0x1e')]();});}};}function handleEntityNotFound(_0x3cccff,_0x4dc7fe){return function(_0x5228a3){if(!_0x5228a3){_0x3cccff['sendStatus'](0x194);}return _0x5228a3;};}function handleError(_0x34f28d,_0xc60304){_0xc60304=_0xc60304||0x1f4;return function(_0x49040d){logger[_0xfc18('0x2b')](_0x49040d[_0xfc18('0x2c')]);if(_0x49040d['name']){delete _0x49040d[_0xfc18('0x2d')];}_0x34f28d['status'](_0xc60304)['send'](_0x49040d);};}exports[_0xfc18('0x2e')]=function(_0x3f04f1,_0x3de684){var _0x22efc8={},_0x2579a0={},_0x9a4351={'count':0x0,'rows':[]};var _0x56acea=_['map'](db[_0xfc18('0x2f')][_0xfc18('0x30')],function(_0x55e08f){return{'name':_0x55e08f[_0xfc18('0x31')],'type':_0x55e08f['type'][_0xfc18('0x32')]};});_0x2579a0[_0xfc18('0x33')]=_[_0xfc18('0x34')](_0x56acea,_0xfc18('0x2d'));_0x2579a0[_0xfc18('0x35')]=_[_0xfc18('0x36')](_0x3f04f1['query']);_0x2579a0[_0xfc18('0x37')]=_['intersection'](_0x2579a0[_0xfc18('0x33')],_0x2579a0[_0xfc18('0x35')]);_0x22efc8[_0xfc18('0x38')]=_['intersection'](_0x2579a0[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x39')]));_0x22efc8['attributes']=_0x22efc8['attributes'][_0xfc18('0x3a')]?_0x22efc8[_0xfc18('0x38')]:_0x2579a0[_0xfc18('0x33')];if(!_0x3f04f1[_0xfc18('0x35')]['hasOwnProperty'](_0xfc18('0x3b'))){_0x22efc8[_0xfc18('0x22')]=qs[_0xfc18('0x22')](_0x3f04f1[_0xfc18('0x35')]['limit']);_0x22efc8[_0xfc18('0x20')]=qs[_0xfc18('0x20')](_0x3f04f1['query'][_0xfc18('0x20')]);}_0x22efc8[_0xfc18('0x3c')]=qs[_0xfc18('0x3d')](_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x3d')]);_0x22efc8['where']=qs[_0xfc18('0x37')](_['pick'](_0x3f04f1[_0xfc18('0x35')],_0x2579a0[_0xfc18('0x37')]),_0x56acea);if(_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x22efc8[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x22efc8[_0xfc18('0x3f')],{'$or':_['map'](_0x56acea,function(_0x3f71f7){if(_0x3f71f7['type']!==_0xfc18('0x41')){var _0x12fd54={};_0x12fd54[_0x3f71f7[_0xfc18('0x2d')]]={'$like':'%'+_0x3f04f1[_0xfc18('0x35')][_0xfc18('0x3e')]+'%'};return _0x12fd54;}})});}_0x22efc8=_[_0xfc18('0x40')]({},_0x22efc8,_0x3f04f1[_0xfc18('0x42')]);var _0x22f391={'where':_0x22efc8[_0xfc18('0x3f')]};return db['CmList'][_0xfc18('0x23')](_0x22f391)[_0xfc18('0x28')](function(_0x325402){_0x9a4351[_0xfc18('0x23')]=_0x325402;if(_0x3f04f1['query'][_0xfc18('0x43')]){_0x22efc8[_0xfc18('0x44')]=[{'all':!![]}];}return db[_0xfc18('0x2f')][_0xfc18('0x45')](_0x22efc8);})['then'](function(_0x273d51){_0x9a4351[_0xfc18('0x46')]=_0x273d51;return _0x9a4351;})[_0xfc18('0x28')](respondWithFilteredResult(_0x3de684,_0x22efc8))[_0xfc18('0x47')](handleError(_0x3de684,null));};exports['show']=function(_0x110e33,_0x1f0141){var _0x316829={'raw':![],'where':{'id':_0x110e33['params']['id']}},_0x518168={};_0x518168[_0xfc18('0x33')]=_[_0xfc18('0x36')](db[_0xfc18('0x2f')][_0xfc18('0x30')]);_0x518168['query']=_[_0xfc18('0x36')](_0x110e33[_0xfc18('0x35')]);_0x518168[_0xfc18('0x37')]=_['intersection'](_0x518168[_0xfc18('0x33')],_0x518168[_0xfc18('0x35')]);_0x316829[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x518168[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x110e33[_0xfc18('0x35')][_0xfc18('0x39')]));_0x316829[_0xfc18('0x38')]=_0x316829[_0xfc18('0x38')][_0xfc18('0x3a')]?_0x316829['attributes']:_0x518168[_0xfc18('0x33')];if(_0x110e33['query']['includeAll']){_0x316829['include']=[{'all':!![]}];}_0x316829=_[_0xfc18('0x40')]({},_0x316829,_0x110e33[_0xfc18('0x42')]);return db[_0xfc18('0x2f')]['find'](_0x316829)[_0xfc18('0x28')](handleEntityNotFound(_0x1f0141,null))[_0xfc18('0x28')](respondWithResult(_0x1f0141,null))[_0xfc18('0x47')](handleError(_0x1f0141,null));};exports['create']=function(_0xea2331,_0x4d9d95){return db[_0xfc18('0x2f')]['create'](_0xea2331[_0xfc18('0x49')],{})[_0xfc18('0x28')](function(_0x17ad91){var _0x5c6c23=_0xea2331[_0xfc18('0x4a')][_0xfc18('0x29')]({'plain':!![]});if(!_0x5c6c23)throw new Error(_0xfc18('0x4b'));if(_0x5c6c23[_0xfc18('0x4c')]===_0xfc18('0x4a')){var _0x30bb01=_0x17ad91[_0xfc18('0x29')]({'plain':!![]});var _0x25b529=_0xfc18('0x4d');return db[_0xfc18('0x4e')][_0xfc18('0x4f')]({'where':{'name':_0x25b529,'userProfileId':_0x5c6c23[_0xfc18('0x50')]},'raw':!![]})[_0xfc18('0x28')](function(_0x30a99d){if(_0x30a99d&&_0x30a99d[_0xfc18('0x51')]===0x0){return db[_0xfc18('0x52')]['create']({'name':_0x30bb01[_0xfc18('0x2d')],'resourceId':_0x30bb01['id'],'type':_0x30a99d[_0xfc18('0x2d')],'sectionId':_0x30a99d['id']},{})[_0xfc18('0x28')](function(){return _0x17ad91;});}else{return _0x17ad91;}})[_0xfc18('0x47')](function(_0x225c9c){logger[_0xfc18('0x2b')](_0xfc18('0x53'),_0x225c9c);throw _0x225c9c;});}return _0x17ad91;})[_0xfc18('0x28')](respondWithResult(_0x4d9d95,0xc9))['catch'](handleError(_0x4d9d95,null));};exports[_0xfc18('0x27')]=function(_0x1509ec,_0x52bbfb){if(_0x1509ec[_0xfc18('0x49')]['id']){delete _0x1509ec[_0xfc18('0x49')]['id'];}return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x1509ec[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x52bbfb,null))[_0xfc18('0x28')](saveUpdates(_0x1509ec['body'],null))[_0xfc18('0x28')](respondWithResult(_0x52bbfb,null))['catch'](handleError(_0x52bbfb,null));};exports[_0xfc18('0x2a')]=function(_0x476477,_0x16c953){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x476477[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x16c953,null))['then'](removeEntity(_0x16c953,null))[_0xfc18('0x47')](handleError(_0x16c953,null));};exports['describe']=function(_0x2e039c,_0x291b03){return db[_0xfc18('0x2f')][_0xfc18('0x55')]()[_0xfc18('0x28')](respondWithResult(_0x291b03,null))[_0xfc18('0x47')](handleError(_0x291b03,null));};exports[_0xfc18('0x56')]=function(_0x459ab4,_0x107394,_0x40821d){if(_0x459ab4[_0xfc18('0x49')]['id']){delete _0x459ab4['body']['id'];}return db[_0xfc18('0x2f')]['find']({'where':{'id':_0x459ab4[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x107394,null))[_0xfc18('0x28')](function(_0x28ed7f){if(_0x28ed7f){_0x459ab4[_0xfc18('0x49')][_0xfc18('0x57')]=_0x28ed7f['id'];return db[_0xfc18('0x58')][_0xfc18('0x59')](_0x459ab4['body']);}})['then'](respondWithResult(_0x107394,null))[_0xfc18('0x47')](handleError(_0x107394,null));};exports['getDispositions']=function(_0x5ce4d9,_0x1dabcd,_0x2c9dd0){var _0x4df3bc={'raw':![],'where':{}};var _0x597f65={};var _0x543d66={'count':0x0,'rows':[]};return db[_0xfc18('0x2f')][_0xfc18('0x5a')]({'where':{'id':_0x5ce4d9[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x1dabcd,null))['then'](function(_0x18ca35){if(_0x18ca35){_0x597f65[_0xfc18('0x33')]=_[_0xfc18('0x36')](db['Disposition'][_0xfc18('0x30')]);_0x597f65['query']=_[_0xfc18('0x36')](_0x5ce4d9['query']);_0x597f65['filters']=_[_0xfc18('0x48')](_0x597f65[_0xfc18('0x33')],_0x597f65[_0xfc18('0x35')]);_0x4df3bc[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x597f65[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x5ce4d9['query'][_0xfc18('0x39')]));_0x4df3bc[_0xfc18('0x38')]=_0x4df3bc[_0xfc18('0x38')]['length']?_0x4df3bc[_0xfc18('0x38')]:_0x597f65[_0xfc18('0x33')];if(!_0x5ce4d9[_0xfc18('0x35')][_0xfc18('0x5b')]('nolimit')){_0x4df3bc[_0xfc18('0x22')]=qs['limit'](_0x5ce4d9[_0xfc18('0x35')][_0xfc18('0x22')]);_0x4df3bc[_0xfc18('0x20')]=qs[_0xfc18('0x20')](_0x5ce4d9[_0xfc18('0x35')]['offset']);}_0x4df3bc[_0xfc18('0x3c')]=qs[_0xfc18('0x3d')](_0x5ce4d9['query'][_0xfc18('0x3d')]);_0x4df3bc[_0xfc18('0x3f')]=qs[_0xfc18('0x37')](_[_0xfc18('0x5c')](_0x5ce4d9['query'],_0x597f65[_0xfc18('0x37')]));_0x4df3bc['where'][_0xfc18('0x57')]=_0x18ca35['id'];if(_0x5ce4d9[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x4df3bc[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x4df3bc['where'],{'$or':_[_0xfc18('0x34')](_0x4df3bc[_0xfc18('0x38')],function(_0x5b62aa){var _0x53e83c={};_0x53e83c[_0x5b62aa]={'$like':'%'+_0x5ce4d9['query'][_0xfc18('0x3e')]+'%'};return _0x53e83c;})});}_0x4df3bc=_[_0xfc18('0x40')]({},_0x4df3bc,_0x5ce4d9[_0xfc18('0x42')]);return db[_0xfc18('0x58')][_0xfc18('0x23')]({'where':_0x4df3bc[_0xfc18('0x3f')]})[_0xfc18('0x28')](function(_0x21fa8a){_0x543d66[_0xfc18('0x23')]=_0x21fa8a;if(_0x5ce4d9['query'][_0xfc18('0x43')]){_0x4df3bc[_0xfc18('0x44')]=[{'all':!![]}];}return db[_0xfc18('0x58')][_0xfc18('0x45')](_0x4df3bc);})[_0xfc18('0x28')](function(_0xef9705){_0x543d66[_0xfc18('0x46')]=_0xef9705;return _0x543d66;});}})['then'](respondWithFilteredResult(_0x1dabcd,_0x4df3bc))[_0xfc18('0x47')](handleError(_0x1dabcd,null));};exports[_0xfc18('0x5d')]=function(_0x3ad7aa,_0x1ccabe,_0x1a78bc){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x3ad7aa[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x1ccabe,null))[_0xfc18('0x28')](function(_0x5e153a){if(_0x5e153a){return _0x5e153a[_0xfc18('0x5d')](_0x3ad7aa[_0xfc18('0x35')][_0xfc18('0x5e')]);}})[_0xfc18('0x28')](respondWithStatusCode(_0x1ccabe,null))[_0xfc18('0x47')](handleError(_0x1ccabe,null));};exports[_0xfc18('0x5f')]=function(_0x5f2324,_0x5b642f,_0x2e9c2b){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x5f2324[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x5b642f,null))['then'](function(_0x42c10f){if(_0x42c10f){var _0x4911eb=[];var _0x2205fb={'success':[],'errors':[]};return db[_0xfc18('0x60')][_0xfc18('0x55')]()[_0xfc18('0x28')](function(_0x34a289){if(_0x5f2324[_0xfc18('0x49')][_0xfc18('0x61')]&&_[_0xfc18('0x62')](_0x5f2324['body']['tags'])){if(_0x5f2324['body'][_0xfc18('0x61')][_0xfc18('0x3a')]){_0x5f2324[_0xfc18('0x49')]['tags']=_0x5f2324[_0xfc18('0x49')][_0xfc18('0x61')]['join'](';')+';';}else{_0x5f2324['body'][_0xfc18('0x61')]=null;}}else{_0x5f2324[_0xfc18('0x49')][_0xfc18('0x61')]=null;}if(_0x5f2324[_0xfc18('0x49')]&&_[_0xfc18('0x62')](_0x5f2324['body'])){for(var _0x59e991=0x0;_0x59e991<_0x5f2324[_0xfc18('0x49')]['length'];_0x59e991+=0x1){_0x5f2324['body'][_0x59e991][_0xfc18('0x57')]=_0x5f2324['params']['id'];_0x4911eb['push'](_0x5f2324['body'][_0x59e991]);}return BPromise[_0xfc18('0x63')](_0x4911eb,function(_0x4b7a29){return db[_0xfc18('0x60')]['create'](_['omit'](_0x4b7a29,[_0xfc18('0x5e'),'id'])||{},{'fields':_[_0xfc18('0x36')](_0x34a289),'raw':!![]})['then'](function(_0x542a4f){_0x2205fb[_0xfc18('0x64')][_0xfc18('0x65')](_0x542a4f[_0xfc18('0x66')]);})['catch'](function(_0x2de1c0){_0x2205fb[_0xfc18('0x67')]['push']({'data':_0x4b7a29,'error':_0x2de1c0['message']});});})[_0xfc18('0x28')](function(_0x24141b){return _0x2205fb;})[_0xfc18('0x47')](function(_0x4f32d4){return _0x4f32d4;});}else{_0x5b642f[_0xfc18('0x1d')](0x190)[_0xfc18('0x1f')]({'message':_0xfc18('0x68')});}});}})[_0xfc18('0x28')](respondWithResult(_0x5b642f,null))[_0xfc18('0x47')](handleError(_0x5b642f,null));};exports[_0xfc18('0x69')]=function(_0x36b324,_0x3abefe,_0x59f7fb){var _0x1b865b;return db['CmList'][_0xfc18('0x4f')]({'where':{'id':_0x36b324[_0xfc18('0x54')]['id']},'include':[{'model':db[_0xfc18('0x6a')],'as':'CustomFields'}]})[_0xfc18('0x28')](handleEntityNotFound(_0x3abefe,null))[_0xfc18('0x28')](function(_0x476ed8){if(_0x476ed8){_0x1b865b=_0x476ed8;return db[_0xfc18('0x60')][_0xfc18('0x30')];}})['then'](function(_0x249fb1){if(_0x249fb1){var _0x699aba={};var _0x3a9469={};_0x3a9469[_0xfc18('0x33')]=_[_0xfc18('0x6b')](_[_0xfc18('0x36')](_0x249fb1),_[_0xfc18('0x34')](_0x1b865b[_0xfc18('0x6c')],function(_0x245aa4){return util[_0xfc18('0x6d')](_0xfc18('0x6e'),_0x245aa4['id']);}));_0x3a9469[_0xfc18('0x35')]=_[_0xfc18('0x36')](_0x36b324[_0xfc18('0x35')]);_0x3a9469['filters']=_[_0xfc18('0x48')](_0x3a9469[_0xfc18('0x33')],_0x3a9469[_0xfc18('0x35')]);_0x699aba[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x3a9469[_0xfc18('0x33')],qs['fields'](_0x36b324[_0xfc18('0x35')][_0xfc18('0x39')]));_0x699aba[_0xfc18('0x38')]=_0x699aba[_0xfc18('0x38')][_0xfc18('0x3a')]?_0x699aba['attributes']:_0x3a9469['model'];if(!_0x36b324[_0xfc18('0x35')][_0xfc18('0x5b')](_0xfc18('0x3b'))){_0x699aba[_0xfc18('0x22')]=qs[_0xfc18('0x22')](_0x36b324[_0xfc18('0x35')][_0xfc18('0x22')]);_0x699aba[_0xfc18('0x20')]=qs['offset'](_0x36b324['query'][_0xfc18('0x20')]);}_0x699aba[_0xfc18('0x3c')]=qs['sort'](_0x36b324[_0xfc18('0x35')][_0xfc18('0x3d')]);_0x699aba['where']=qs[_0xfc18('0x37')](_[_0xfc18('0x5c')](_0x36b324[_0xfc18('0x35')],_0x3a9469[_0xfc18('0x37')]));_0x699aba[_0xfc18('0x6f')]=!![];if(_0x36b324[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x699aba['where']=_[_0xfc18('0x40')](_0x699aba[_0xfc18('0x3f')],{'$or':_['map'](_0x699aba[_0xfc18('0x38')],function(_0x974802){var _0x5be4aa={};_0x5be4aa[_0x974802]={'$like':'%'+_0x36b324[_0xfc18('0x35')][_0xfc18('0x3e')]+'%'};return _0x5be4aa;})});}_0x699aba=_[_0xfc18('0x40')]({},_0x699aba,_0x36b324[_0xfc18('0x42')]);return _0x1b865b[_0xfc18('0x69')](_0x699aba);}})[_0xfc18('0x28')](respondWithResult(_0x3abefe,null))[_0xfc18('0x47')](handleError(_0x3abefe,null));};exports[_0xfc18('0x70')]=function(_0x9f4b4f,_0x34d063,_0x4315b7){var _0x30251b;var _0x4e6d7f;var _0x402b91;var _0x5998bb=_0x9f4b4f[_0xfc18('0x54')]['id'];csv_results=[];return db['ContactItemType'][_0xfc18('0x45')]({'attributes':['id',_0xfc18('0x2d')],'raw':!![],'order':[_0xfc18('0x71')]})['then'](function(_0xfb112f){_0x30251b=_0xfb112f;var _0x1be2f0=_['keys'](db[_0xfc18('0x60')]['rawAttributes']);return db[_0xfc18('0x6a')][_0xfc18('0x45')]({'raw':!![],'attributes':['id',_0xfc18('0x72')]})[_0xfc18('0x28')](function(_0x123af8){_0x4e6d7f=_0x123af8;var _0x5c1b8f=squel[_0xfc18('0x73')]()[_0xfc18('0x39')](_0x1be2f0)['from'](_0xfc18('0x74'),'c')[_0xfc18('0x3f')]('c.ListId\x20=\x20?',_0x5998bb)[_0xfc18('0x3f')](_0xfc18('0x75'))[_0xfc18('0x76')]();for(var _0x373589=0x0;_0x373589<_0x4e6d7f[_0xfc18('0x3a')];_0x373589++){_0x5c1b8f[_0xfc18('0x77')](_0xfc18('0x78')+_0x4e6d7f[_0x373589]['id'],_0xfc18('0x79')+_0x4e6d7f[_0x373589][_0xfc18('0x72')]);}for(var _0x373589=0x0;_0x373589<_0x30251b['length'];_0x373589++){_0x5c1b8f[_0xfc18('0x77')](squel[_0xfc18('0x73')]()['field'](_0xfc18('0x7a'))['from'](_0xfc18('0x7b'))[_0xfc18('0x3f')](_0xfc18('0x7c'),_0x30251b[_0x373589]['id'])[_0xfc18('0x3f')]('CmContactId\x20=\x20c.id'),_0xfc18('0x7d')+_0x30251b[_0x373589][_0xfc18('0x2d')]);_0x5c1b8f[_0xfc18('0x77')](squel[_0xfc18('0x73')]()['field'](_0xfc18('0x7e'))[_0xfc18('0x7f')](_0xfc18('0x7b'))['where']('ItemTypeId\x20=\x20?',_0x30251b[_0x373589]['id'])[_0xfc18('0x3f')](_0xfc18('0x80')),_0xfc18('0x81')+_0x30251b[_0x373589][_0xfc18('0x2d')]);}var _0x33a256=[];_0x33a256[_0xfc18('0x65')](_0x5c1b8f[_0xfc18('0x82')]());BPromise['each'](_0x33a256,handleQuery)[_0xfc18('0x28')](function(_0x487cc8){handleQuery(_0x5c1b8f[_0xfc18('0x82')]());var _0x3d5875=csv_results[0x0];if(!_['isEmpty'](_0x3d5875)){var _0x2e0ec7=toCsv(_0x3d5875);var _0x68a079=Date[_0xfc18('0x83')]();fs[_0xfc18('0x84')](util[_0xfc18('0x6d')]('/tmp/list_%d_%s.csv',_0x5998bb,_0x68a079),_0x2e0ec7);_0x34d063['setHeader'](_0xfc18('0x85'),_0xfc18('0x86')+util[_0xfc18('0x6d')]('list_%d_%s.csv',_0x5998bb,_0x68a079));_0x34d063[_0xfc18('0x87')](_0xfc18('0x88'),_0xfc18('0x89'));return _0x34d063[_0xfc18('0x8a')](util[_0xfc18('0x6d')](_0xfc18('0x8b'),_0x5998bb,_0x68a079));}else{return _0x34d063['sendStatus'](0xcc);}});});});};exports[_0xfc18('0x8c')]=function(_0x99d5ae,_0x11ad7d,_0x2ee259){var _0x4466dc;delete _0x99d5ae[_0xfc18('0x49')]['id'];return db['CmList'][_0xfc18('0x5a')]({'where':{'id':_0x99d5ae['params']['id']}})['then'](handleEntityNotFound(_0x11ad7d,null))[_0xfc18('0x28')](function(_0x514dc4){if(_0x514dc4){return db['sequelize'][_0xfc18('0x8d')](function(_0x5ec42b){return db['CmCustomField'][_0xfc18('0x59')](_0x99d5ae['body'],{'transaction':_0x5ec42b})[_0xfc18('0x28')](function(_0x432f18){_0x4466dc=_0x432f18;return _0x514dc4[_0xfc18('0x8e')](_0x432f18,{'transaction':_0x5ec42b});})[_0xfc18('0x28')](function(){var _0x4e8dfb={'type':db['Sequelize'][_0xfc18('0x8f')],'transaction':_0x5ec42b};switch(_0x99d5ae[_0xfc18('0x49')]['type']){case _0xfc18('0x90'):_0x4e8dfb[_0xfc18('0x91')]=db['Sequelize'][_0xfc18('0x8f')];break;case _0xfc18('0x92'):_0x4e8dfb[_0xfc18('0x91')]=db[_0xfc18('0x93')][_0xfc18('0x94')];break;case _0xfc18('0x95'):_0x4e8dfb[_0xfc18('0x91')]=db[_0xfc18('0x93')]['BOOLEAN'];_0x4e8dfb['defaultValue']=![];break;default:}return db['sequelize'][_0xfc18('0x96')][_0xfc18('0x97')](_0xfc18('0x74'),util['format'](_0xfc18('0x98'),_0x4466dc['id']),_0x4e8dfb);})[_0xfc18('0x28')](function(){return _0x4466dc;});});}})['then'](respondWithResult(_0x11ad7d,null))['catch'](handleError(_0x11ad7d,null));};exports[_0xfc18('0x99')]=function(_0x2ab46e,_0xd95f9f,_0x3f3e1c){var _0x159e20={};var _0x503e95={};var _0x31f764;var _0x4c2636;return db['CmList'][_0xfc18('0x5a')]({'where':{'id':_0x2ab46e['params']['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0xd95f9f,null))[_0xfc18('0x28')](function(_0xc0175f){if(_0xc0175f){_0x31f764=_0xc0175f;_0x503e95[_0xfc18('0x33')]=_[_0xfc18('0x36')](db['CmCustomField'][_0xfc18('0x30')]);_0x503e95['query']=_[_0xfc18('0x36')](_0x2ab46e[_0xfc18('0x35')]);_0x503e95[_0xfc18('0x37')]=_[_0xfc18('0x48')](_0x503e95[_0xfc18('0x33')],_0x503e95[_0xfc18('0x35')]);_0x159e20[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x503e95[_0xfc18('0x33')],qs[_0xfc18('0x39')](_0x2ab46e[_0xfc18('0x35')][_0xfc18('0x39')]));_0x159e20[_0xfc18('0x38')]=_0x159e20[_0xfc18('0x38')]['length']?_0x159e20[_0xfc18('0x38')]:_0x503e95[_0xfc18('0x33')];_0x159e20[_0xfc18('0x3c')]=qs[_0xfc18('0x3d')](_0x2ab46e['query'][_0xfc18('0x3d')]);_0x159e20[_0xfc18('0x3f')]=qs[_0xfc18('0x37')](_[_0xfc18('0x5c')](_0x2ab46e['query'],_0x503e95[_0xfc18('0x37')]));_0x159e20['where']=_[_0xfc18('0x40')](_0x159e20[_0xfc18('0x3f')],{'$or':[{'ListId':_0xc0175f['id']},{'ListId':null}]});if(_0x2ab46e[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x159e20[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x159e20[_0xfc18('0x3f')],{'$or':_['map'](_0x159e20[_0xfc18('0x38')],function(_0x517a6e){var _0x3b7b14={};_0x3b7b14[_0x517a6e]={'$like':'%'+_0x2ab46e[_0xfc18('0x35')][_0xfc18('0x3e')]+'%'};return _0x3b7b14;})});}_0x159e20=_[_0xfc18('0x40')]({},_0x159e20,_0x2ab46e[_0xfc18('0x42')]);return db[_0xfc18('0x6a')][_0xfc18('0x9a')](_0x159e20);}})['then'](respondWithResult(_0xd95f9f,null))[_0xfc18('0x47')](handleError(_0xd95f9f,null));};exports[_0xfc18('0x9b')]=function(_0x1babaa,_0x35c247){return db[_0xfc18('0x6a')][_0xfc18('0x9a')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x35c247,null))[_0xfc18('0x28')](function(_0xdb0f36){return _0xdb0f36;})[_0xfc18('0x28')](respondWithResult(_0x35c247,null))[_0xfc18('0x47')](handleError(_0x35c247,null));};exports[_0xfc18('0x9c')]=function(_0x4fadd8,_0x500b01,_0x432d0d){return db['CmList']['find']({'where':{'id':_0x4fadd8[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x500b01,null))[_0xfc18('0x28')](function(_0x542f38){if(_0x542f38){return _0x542f38[_0xfc18('0x9c')](_0x4fadd8[_0xfc18('0x49')]['ids'],_[_0xfc18('0x9d')](_0x4fadd8[_0xfc18('0x49')],[_0xfc18('0x5e'),'id'])||{})[_0xfc18('0x9e')](function(_0x5f13e4){for(var _0x47b0de=0x0;_0x47b0de<_0x4fadd8[_0xfc18('0x49')][_0xfc18('0x5e')][_0xfc18('0x3a')];_0x47b0de+=0x1){socket[_0xfc18('0x9f')]('userCmList:save',{'UserId':Number(_0x4fadd8[_0xfc18('0x49')]['ids'][_0x47b0de]),'CmListId':Number(_0x4fadd8['params']['id'])});}return _0x5f13e4;});}})['then'](respondWithResult(_0x500b01,null))[_0xfc18('0x47')](handleError(_0x500b01,null));};exports[_0xfc18('0xa0')]=function(_0x2caf72,_0x39285e,_0x1ad324){return db[_0xfc18('0x2f')][_0xfc18('0x4f')]({'where':{'id':_0x2caf72[_0xfc18('0x54')]['id']}})['then'](handleEntityNotFound(_0x39285e,null))[_0xfc18('0x28')](function(_0x524fd2){if(_0x524fd2){return _0x524fd2['removeAgents'](_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')])[_0xfc18('0x28')](function(){if(_[_0xfc18('0x62')](_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')])){for(var _0x435d7f=0x0;_0x435d7f<_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')][_0xfc18('0x3a')];_0x435d7f+=0x1){socket['emit'](_0xfc18('0xa1'),{'UserId':Number(_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')][_0x435d7f]),'CmListId':Number(_0x2caf72[_0xfc18('0x54')]['id'])});}}else{socket[_0xfc18('0x9f')](_0xfc18('0xa1'),{'UserId':Number(_0x2caf72[_0xfc18('0x35')][_0xfc18('0x5e')]),'CmListId':Number(_0x2caf72[_0xfc18('0x54')]['id'])});}});}})[_0xfc18('0x28')](respondWithStatusCode(_0x39285e,null))['catch'](handleError(_0x39285e,null));};exports[_0xfc18('0xa2')]=function(_0x53ff2b,_0x80bde6,_0x24900f){var _0x5f517f={};var _0x113c86={};var _0x59a115;var _0x5a1c40;return db[_0xfc18('0x2f')][_0xfc18('0x5a')]({'where':{'id':_0x53ff2b[_0xfc18('0x54')]['id']}})[_0xfc18('0x28')](handleEntityNotFound(_0x80bde6,null))[_0xfc18('0x28')](function(_0x1cfb53){if(_0x1cfb53){_0x59a115=_0x1cfb53;_0x113c86[_0xfc18('0x33')]=_[_0xfc18('0x36')](db['User'][_0xfc18('0x30')]);_0x113c86[_0xfc18('0x35')]=_['keys'](_0x53ff2b['query']);_0x113c86['filters']=_[_0xfc18('0x48')](_0x113c86[_0xfc18('0x33')],_0x113c86['query']);_0x5f517f[_0xfc18('0x38')]=_[_0xfc18('0x48')](_0x113c86['model'],qs[_0xfc18('0x39')](_0x53ff2b[_0xfc18('0x35')][_0xfc18('0x39')]));_0x5f517f[_0xfc18('0x38')]=_0x5f517f[_0xfc18('0x38')]['length']?_0x5f517f['attributes']:_0x113c86['model'];_0x5f517f['order']=qs[_0xfc18('0x3d')](_0x53ff2b['query'][_0xfc18('0x3d')]);_0x5f517f['where']=qs[_0xfc18('0x37')](_['pick'](_0x53ff2b[_0xfc18('0x35')],_0x113c86[_0xfc18('0x37')]));if(_0x53ff2b[_0xfc18('0x35')][_0xfc18('0x3e')]){_0x5f517f[_0xfc18('0x3f')]=_[_0xfc18('0x40')](_0x5f517f['where'],{'$or':_[_0xfc18('0x34')](_0x5f517f['attributes'],function(_0x583b43){var _0x1d7cd6={};_0x1d7cd6[_0x583b43]={'$like':'%'+_0x53ff2b['query'][_0xfc18('0x3e')]+'%'};return _0x1d7cd6;})});}_0x5f517f=_[_0xfc18('0x40')]({},_0x5f517f,_0x53ff2b[_0xfc18('0x42')]);return _0x59a115[_0xfc18('0xa2')](_0x5f517f);}})['then'](function(_0xf4b549){if(_0xf4b549){_0x5a1c40=_0xf4b549['length'];if(!_0x53ff2b[_0xfc18('0x35')][_0xfc18('0x5b')](_0xfc18('0x3b'))){_0x5f517f[_0xfc18('0x22')]=qs[_0xfc18('0x22')](_0x53ff2b[_0xfc18('0x35')]['limit']);_0x5f517f[_0xfc18('0x20')]=qs['offset'](_0x53ff2b['query'][_0xfc18('0x20')]);}return _0x59a115['getAgents'](_0x5f517f);}})[_0xfc18('0x28')](function(_0x1fe319){if(_0x1fe319){return _0x1fe319?{'count':_0x5a1c40,'rows':_0x1fe319}:null;}})[_0xfc18('0x28')](respondWithResult(_0x80bde6,null))[_0xfc18('0x47')](handleError(_0x80bde6,null));};function handleQuery(_0x4ee3cc){logger[_0xfc18('0xa3')](_0x4ee3cc);return db[_0xfc18('0xa4')][_0xfc18('0x35')](_0x4ee3cc)[_0xfc18('0x9e')](function(_0x32df0a){csv_results[_0xfc18('0x65')](_0x32df0a);})['catch'](function(_0x1afabf){logger[_0xfc18('0x2b')](_0x1afabf[_0xfc18('0xa5')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4583b51..d548d25 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(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x5fc3[_0x5f09c5];return _0x426ad9;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4f9ca54..051d405 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x25b036,_0x1f1efb){var _0x10344f=function(_0x43de28){while(--_0x43de28){_0x25b036['push'](_0x25b036['shift']());}};_0x10344f(++_0x1f1efb);}(_0x1339,0x1ed));var _0x9133=function(_0x4f247d,_0x14caf3){_0x4f247d=_0x4f247d-0x0;var _0x5ec5b3=_0x1339[_0x4f247d];return _0x5ec5b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd28=['rimraf','./cmList.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x13484b,_0x442853){var _0x1535e7=function(_0x41bec5){while(--_0x41bec5){_0x13484b['push'](_0x13484b['shift']());}};_0x1535e7(++_0x442853);}(_0xfd28,0x148));var _0x8fd2=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xfd28[_0x104e21];return _0x605b37;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2d5a4f8..3e919fa 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 _0x2903=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','CmList,\x20%s,\x20%s','util','moment','randomstring','../../mysqldb'];(function(_0x371f60,_0x1b6185){var _0x505a0d=function(_0x91e4b6){while(--_0x91e4b6){_0x371f60['push'](_0x371f60['shift']());}};_0x505a0d(++_0x1b6185);}(_0x2903,0x188));var _0x3290=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2903[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x3290('0x0'));var moment=require(_0x3290('0x1'));var BPromise=require('bluebird');var rs=require(_0x3290('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3290('0x3'))['db'];var utils=require(_0x3290('0x4'));var logger=require(_0x3290('0x5'))(_0x3290('0x6'));var config=require(_0x3290('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3290('0x8')]['http']({'port':0x232a});config[_0x3290('0x9')]=_[_0x3290('0xa')](config[_0x3290('0x9')],{'host':_0x3290('0xb'),'port':0x18eb});var socket=require(_0x3290('0xc'))(new Redis(config['redis']));require(_0x3290('0xd'))['register'](socket);function respondWithRpcPromise(_0xfda4f3,_0x20a1be,_0x5812c6){return new BPromise(function(_0x2abed6,_0x250f99){return client['request'](_0xfda4f3,_0x5812c6)[_0x3290('0xe')](function(_0x1040a4){logger[_0x3290('0xf')]('CmList,\x20%s,\x20%s',_0x20a1be,_0x3290('0x10'));logger[_0x3290('0x11')](_0x3290('0x12'),_0x20a1be,_0x3290('0x10'),JSON['stringify'](_0x1040a4));if(_0x1040a4['error']){if(_0x1040a4['error']['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x20a1be,_0x1040a4[_0x3290('0x13')][_0x3290('0x14')]);return _0x250f99(_0x1040a4[_0x3290('0x13')][_0x3290('0x14')]);}logger[_0x3290('0x13')](_0x3290('0x15'),_0x20a1be,_0x1040a4[_0x3290('0x13')][_0x3290('0x14')]);return _0x2abed6(_0x1040a4[_0x3290('0x13')]['message']);}else{logger[_0x3290('0xf')](_0x3290('0x15'),_0x20a1be,_0x3290('0x10'));_0x2abed6(_0x1040a4['result']['message']);}})['catch'](function(_0x207532){logger[_0x3290('0x13')]('CmList,\x20%s,\x20%s',_0x20a1be,_0x207532);_0x250f99(_0x207532);});});} \ No newline at end of file +var _0xdaa1=['socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdaa1,0x94));var _0x1daa=function(_0x1dde10,_0x221c4f){_0x1dde10=_0x1dde10-0x0;var _0x5edc65=_0xdaa1[_0x1dde10];return _0x5edc65;};'use strict';var _=require(_0x1daa('0x0'));var util=require(_0x1daa('0x1'));var moment=require(_0x1daa('0x2'));var BPromise=require(_0x1daa('0x3'));var rs=require(_0x1daa('0x4'));var fs=require('fs');var Redis=require(_0x1daa('0x5'));var db=require(_0x1daa('0x6'))['db'];var utils=require(_0x1daa('0x7'));var logger=require(_0x1daa('0x8'))(_0x1daa('0x9'));var config=require('../../config/environment');var jayson=require(_0x1daa('0xa'));var client=jayson['client'][_0x1daa('0xb')]({'port':0x232a});config[_0x1daa('0xc')]=_[_0x1daa('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1daa('0xe'))(new Redis(config[_0x1daa('0xc')]));require(_0x1daa('0xf'))[_0x1daa('0x10')](socket);function respondWithRpcPromise(_0x57618f,_0x277516,_0x554c02){return new BPromise(function(_0x45ebd3,_0x2653df){return client[_0x1daa('0x11')](_0x57618f,_0x554c02)[_0x1daa('0x12')](function(_0xee1770){logger[_0x1daa('0x13')](_0x1daa('0x14'),_0x277516,_0x1daa('0x15'));logger[_0x1daa('0x16')](_0x1daa('0x17'),_0x277516,_0x1daa('0x15'),JSON['stringify'](_0xee1770));if(_0xee1770[_0x1daa('0x18')]){if(_0xee1770['error']['code']===0x1f4){logger[_0x1daa('0x18')](_0x1daa('0x14'),_0x277516,_0xee1770[_0x1daa('0x18')]['message']);return _0x2653df(_0xee1770['error']['message']);}logger['error'](_0x1daa('0x14'),_0x277516,_0xee1770[_0x1daa('0x18')][_0x1daa('0x19')]);return _0x45ebd3(_0xee1770[_0x1daa('0x18')][_0x1daa('0x19')]);}else{logger[_0x1daa('0x13')](_0x1daa('0x14'),_0x277516,_0x1daa('0x15'));_0x45ebd3(_0xee1770[_0x1daa('0x1a')][_0x1daa('0x19')]);}})['catch'](function(_0x788e57){logger[_0x1daa('0x18')](_0x1daa('0x14'),_0x277516,_0x788e57);_0x2653df(_0x788e57);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2332b36..d2235bb 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 _0x2a81=['register','length','cmList:','./cmList.events','update','removeListener'];(function(_0x1c2829,_0x2650fc){var _0x430979=function(_0x5248f6){while(--_0x5248f6){_0x1c2829['push'](_0x1c2829['shift']());}};_0x430979(++_0x2650fc);}(_0x2a81,0xdb));var _0x12a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a81[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0x12a8('0x0'));var events=['save','remove',_0x12a8('0x1')];function createListener(_0x2b5d08,_0x2ce45c){return function(_0x568370){_0x2ce45c['emit'](_0x2b5d08,_0x568370);};}function removeListener(_0x271690,_0x4abe3e){return function(){CmListEvents[_0x12a8('0x2')](_0x271690,_0x4abe3e);};}exports[_0x12a8('0x3')]=function(_0x35f462){for(var _0x2b5ff5=0x0,_0x140b93=events[_0x12a8('0x4')];_0x2b5ff5<_0x140b93;_0x2b5ff5++){var _0x1b3f6b=events[_0x2b5ff5];var _0x560a1e=createListener(_0x12a8('0x5')+_0x1b3f6b,_0x35f462);CmListEvents['on'](_0x1b3f6b,_0x560a1e);}}; \ No newline at end of file +var _0x2dc7=['./cmList.events','save','emit','length','cmList:'];(function(_0x5c4b04,_0x3b364a){var _0x2718e5=function(_0x1e421b){while(--_0x1e421b){_0x5c4b04['push'](_0x5c4b04['shift']());}};_0x2718e5(++_0x3b364a);}(_0x2dc7,0xe1));var _0x72dc=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x2dc7[_0x1e05c1];return _0x15f1ca;};'use strict';var CmListEvents=require(_0x72dc('0x0'));var events=[_0x72dc('0x1'),'remove','update'];function createListener(_0x58be93,_0x30d46e){return function(_0x540f55){_0x30d46e[_0x72dc('0x2')](_0x58be93,_0x540f55);};}function removeListener(_0x244d3d,_0x51c46f){return function(){CmListEvents['removeListener'](_0x244d3d,_0x51c46f);};}exports['register']=function(_0x49a61f){for(var _0x2978ab=0x0,_0x565c3e=events[_0x72dc('0x3')];_0x2978ab<_0x565c3e;_0x2978ab++){var _0x2f964a=events[_0x2978ab];var _0x26df17=createListener(_0x72dc('0x4')+_0x2f964a,_0x49a61f);CmListEvents['on'](_0x2f964a,_0x26df17);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5bb0c26..fa341a5 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 _0xa47e=['create','addDisposition','addContacts','addCustomField','/:id/users','put','update','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','get','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post'];(function(_0x3eef3a,_0x3fe655){var _0x572465=function(_0x1ba9b0){while(--_0x1ba9b0){_0x3eef3a['push'](_0x3eef3a['shift']());}};_0x572465(++_0x3fe655);}(_0xa47e,0x9a));var _0xea47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa47e[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var path=require('path');var timeout=require(_0xea47('0x2'));var express=require(_0xea47('0x3'));var router=express[_0xea47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea47('0x5'));var interaction=require(_0xea47('0x6'));var config=require(_0xea47('0x7'));var controller=require(_0xea47('0x8'));router['get']('/',auth[_0xea47('0x9')](),controller[_0xea47('0xa')]);router['get'](_0xea47('0xb'),auth[_0xea47('0x9')](),controller[_0xea47('0xc')]);router[_0xea47('0xd')]('/global_fields',auth[_0xea47('0x9')](),controller[_0xea47('0xe')]);router[_0xea47('0xd')](_0xea47('0xf'),auth['isAuthenticated'](),controller[_0xea47('0x10')]);router['get'](_0xea47('0x11'),auth['isAuthenticated'](),controller[_0xea47('0x12')]);router[_0xea47('0xd')](_0xea47('0x13'),auth[_0xea47('0x9')](),controller['getContacts']);router[_0xea47('0xd')](_0xea47('0x14'),auth['isAuthenticated'](),controller[_0xea47('0x15')]);router['get'](_0xea47('0x16'),auth[_0xea47('0x9')](),controller[_0xea47('0x17')]);router['get']('/:id/users',auth[_0xea47('0x9')](),controller[_0xea47('0x18')]);router[_0xea47('0x19')]('/',auth[_0xea47('0x9')](),controller[_0xea47('0x1a')]);router[_0xea47('0x19')](_0xea47('0x11'),auth[_0xea47('0x9')](),controller[_0xea47('0x1b')]);router[_0xea47('0x19')]('/:id/contacts',auth[_0xea47('0x9')](),controller[_0xea47('0x1c')]);router[_0xea47('0x19')]('/:id/fields',auth[_0xea47('0x9')](),controller[_0xea47('0x1d')]);router[_0xea47('0x19')](_0xea47('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router[_0xea47('0x1f')](_0xea47('0xf'),auth[_0xea47('0x9')](),controller[_0xea47('0x20')]);router['delete'](_0xea47('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0xea47('0x21')](_0xea47('0x11'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/users',auth[_0xea47('0x9')](),controller[_0xea47('0x22')]);module[_0xea47('0x23')]=router; \ No newline at end of file +var _0x64f6=['../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','/:id/dispositions','addCustomField','addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x592e40,_0x2ed011){var _0x5d4288=function(_0x366e87){while(--_0x366e87){_0x592e40['push'](_0x592e40['shift']());}};_0x5d4288(++_0x2ed011);}(_0x64f6,0xb3));var _0x664f=function(_0x54496d,_0x5b8572){_0x54496d=_0x54496d-0x0;var _0x40e626=_0x64f6[_0x54496d];return _0x40e626;};'use strict';var multer=require(_0x664f('0x0'));var util=require(_0x664f('0x1'));var path=require(_0x664f('0x2'));var timeout=require(_0x664f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x664f('0x4'));var auth=require(_0x664f('0x5'));var interaction=require(_0x664f('0x6'));var config=require(_0x664f('0x7'));var controller=require(_0x664f('0x8'));router[_0x664f('0x9')]('/',auth[_0x664f('0xa')](),controller[_0x664f('0xb')]);router[_0x664f('0x9')](_0x664f('0xc'),auth[_0x664f('0xa')](),controller['describe']);router[_0x664f('0x9')](_0x664f('0xd'),auth[_0x664f('0xa')](),controller[_0x664f('0xe')]);router[_0x664f('0x9')](_0x664f('0xf'),auth[_0x664f('0xa')](),controller['show']);router[_0x664f('0x9')]('/:id/dispositions',auth[_0x664f('0xa')](),controller[_0x664f('0x10')]);router[_0x664f('0x9')](_0x664f('0x11'),auth[_0x664f('0xa')](),controller['getContacts']);router[_0x664f('0x9')](_0x664f('0x12'),auth[_0x664f('0xa')](),controller[_0x664f('0x13')]);router[_0x664f('0x9')](_0x664f('0x14'),auth[_0x664f('0xa')](),controller['getCustomFields']);router[_0x664f('0x9')](_0x664f('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x664f('0x16')]('/',auth[_0x664f('0xa')](),controller['create']);router[_0x664f('0x16')](_0x664f('0x17'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x664f('0x16')](_0x664f('0x11'),auth[_0x664f('0xa')](),controller['addContacts']);router['post']('/:id/fields',auth[_0x664f('0xa')](),controller[_0x664f('0x18')]);router[_0x664f('0x16')]('/:id/users',auth[_0x664f('0xa')](),controller[_0x664f('0x19')]);router['put'](_0x664f('0xf'),auth[_0x664f('0xa')](),controller['update']);router[_0x664f('0x1a')]('/:id',auth[_0x664f('0xa')](),controller[_0x664f('0x1b')]);router['delete'](_0x664f('0x17'),auth[_0x664f('0xa')](),controller[_0x664f('0x1c')]);router['delete']('/:id/users',auth[_0x664f('0xa')](),controller[_0x664f('0x1d')]);module[_0x664f('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 ac96654..a736464 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 _0x5abc=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x1dd895,_0x31f4db){var _0x1de358=function(_0x3aa391){while(--_0x3aa391){_0x1dd895['push'](_0x1dd895['shift']());}};_0x1de358(++_0x31f4db);}(_0x5abc,0x14c));var _0xc5ab=function(_0x23d3a2,_0x543be2){_0x23d3a2=_0x23d3a2-0x0;var _0x25a08d=_0x5abc[_0x23d3a2];return _0x25a08d;};'use strict';var Sequelize=require(_0xc5ab('0x0'));module[_0xc5ab('0x1')]={'name':{'type':Sequelize[_0xc5ab('0x2')],'get':function(_0x32d288){return this[_0xc5ab('0x3')]('field');}},'field':{'type':Sequelize[_0xc5ab('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xc5ab('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xc5ab('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0bbb=['getDataValue','field','STRING','VIRTUAL'];(function(_0x3c49fb,_0xfbc6ac){var _0x536319=function(_0x488308){while(--_0x488308){_0x3c49fb['push'](_0x3c49fb['shift']());}};_0x536319(++_0xfbc6ac);}(_0x0bbb,0x107));var _0xb0bb=function(_0x401554,_0x34b410){_0x401554=_0x401554-0x0;var _0x5b70e9=_0x0bbb[_0x401554];return _0x5b70e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb0bb('0x0')],'get':function(_0x3c7570){return this[_0xb0bb('0x1')](_0xb0bb('0x2'));}},'field':{'type':Sequelize[_0xb0bb('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 70aaa48..8d0930b 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4fa851,_0x42c1d4){var _0x4b5c5b=function(_0x381f6f){while(--_0x381f6f){_0x4fa851['push'](_0x4fa851['shift']());}};_0x4b5c5b(++_0x42c1d4);}(_0x7a54,0x106));var _0x47a5=function(_0x350f0c,_0x9d1c69){_0x350f0c=_0x350f0c-0x0;var _0x49a442=_0x7a54[_0x350f0c];return _0x49a442;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x439c02,_0x382c35){var _0x5681fc=function(_0x1dffe8){while(--_0x1dffe8){_0x439c02['push'](_0x439c02['shift']());}};_0x5681fc(++_0x382c35);}(_0x7a54,0x106));var _0x47a5=function(_0x34a149,_0xf986b5){_0x34a149=_0x34a149-0x0;var _0x50e7ad=_0x7a54[_0x34a149];return _0x50e7ad;};'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 363689a..9bb1105 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 _0x3d8f=['./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3d8f,0x13c));var _0xf3d8=function(_0x5753db,_0x36b067){_0x5753db=_0x5753db-0x0;var _0x5821d7=_0x3d8f[_0x5753db];return _0x5821d7;};'use strict';var _=require(_0xf3d8('0x0'));var util=require(_0xf3d8('0x1'));var logger=require(_0xf3d8('0x2'))(_0xf3d8('0x3'));var moment=require('moment');var BPromise=require(_0xf3d8('0x4'));var rp=require(_0xf3d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3d8('0x6'));var config=require(_0xf3d8('0x7'));var attributes=require(_0xf3d8('0x8'));module['exports']=function(_0x57a21e,_0x3710d0){return _0x57a21e[_0xf3d8('0x9')](_0xf3d8('0xa'),attributes,{'tableName':_0xf3d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72fe=['util','../../config/logger','bluebird','request-promise','path','./condition.attributes','exports','define','Condition','tools_conditions'];(function(_0xf482c1,_0x32cbca){var _0x184548=function(_0x2f8086){while(--_0x2f8086){_0xf482c1['push'](_0xf482c1['shift']());}};_0x184548(++_0x32cbca);}(_0x72fe,0x1f4));var _0xe72f=function(_0x4f77a6,_0x24efcc){_0x4f77a6=_0x4f77a6-0x0;var _0x41e973=_0x72fe[_0x4f77a6];return _0x41e973;};'use strict';var _=require('lodash');var util=require(_0xe72f('0x0'));var logger=require(_0xe72f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe72f('0x2'));var rp=require(_0xe72f('0x3'));var fs=require('fs');var path=require(_0xe72f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe72f('0x5'));module[_0xe72f('0x6')]=function(_0x3fbb33,_0x3dc17c){return _0x3fbb33[_0xe72f('0x7')](_0xe72f('0x8'),attributes,{'tableName':_0xe72f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 9d1b4e1..4bf4cdb 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 _0x168f=['then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x33bcf4,_0xf1dcb7){var _0x25f19e=function(_0x1080af){while(--_0x1080af){_0x33bcf4['push'](_0x33bcf4['shift']());}};_0x25f19e(++_0xf1dcb7);}(_0x168f,0x79));var _0xf168=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x168f[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xf168('0x0'));var util=require(_0xf168('0x1'));var moment=require(_0xf168('0x2'));var BPromise=require(_0xf168('0x3'));var rs=require(_0xf168('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf168('0x5'))['db'];var utils=require(_0xf168('0x6'));var logger=require(_0xf168('0x7'))(_0xf168('0x8'));var config=require(_0xf168('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40c0fd,_0x5455f6,_0x5b8cb4){return new BPromise(function(_0x5cf7c0,_0x4c187f){return client[_0xf168('0xa')](_0x40c0fd,_0x5b8cb4)[_0xf168('0xb')](function(_0x5b14ef){logger[_0xf168('0xc')]('Condition,\x20%s,\x20%s',_0x5455f6,_0xf168('0xd'));logger[_0xf168('0xe')](_0xf168('0xf'),_0x5455f6,'request\x20sent',JSON[_0xf168('0x10')](_0x5b14ef));if(_0x5b14ef[_0xf168('0x11')]){if(_0x5b14ef[_0xf168('0x11')][_0xf168('0x12')]===0x1f4){logger[_0xf168('0x11')]('Condition,\x20%s,\x20%s',_0x5455f6,_0x5b14ef[_0xf168('0x11')][_0xf168('0x13')]);return _0x4c187f(_0x5b14ef['error'][_0xf168('0x13')]);}logger[_0xf168('0x11')](_0xf168('0x14'),_0x5455f6,_0x5b14ef[_0xf168('0x11')]['message']);return _0x5cf7c0(_0x5b14ef[_0xf168('0x11')][_0xf168('0x13')]);}else{logger['info'](_0xf168('0x14'),_0x5455f6,'request\x20sent');_0x5cf7c0(_0x5b14ef[_0xf168('0x15')][_0xf168('0x13')]);}})['catch'](function(_0x13e8f3){logger[_0xf168('0x11')](_0xf168('0x14'),_0x5455f6,_0x13e8f3);_0x4c187f(_0x13e8f3);});});} \ No newline at end of file +var _0xb130=['info','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5489bb,_0x5098b9){var _0x2311f7=function(_0x5e2f70){while(--_0x5e2f70){_0x5489bb['push'](_0x5489bb['shift']());}};_0x2311f7(++_0x5098b9);}(_0xb130,0x6b));var _0x0b13=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xb130[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0x0b13('0x0'));var util=require(_0x0b13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b13('0x2'));var fs=require('fs');var Redis=require(_0x0b13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b13('0x4'));var logger=require(_0x0b13('0x5'))(_0x0b13('0x6'));var config=require(_0x0b13('0x7'));var jayson=require(_0x0b13('0x8'));var client=jayson[_0x0b13('0x9')][_0x0b13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41977b,_0x299b64,_0x42c607){return new BPromise(function(_0x52c72e,_0x33234d){return client[_0x0b13('0xb')](_0x41977b,_0x42c607)['then'](function(_0x33c458){logger['info'](_0x0b13('0xc'),_0x299b64,_0x0b13('0xd'));logger[_0x0b13('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x299b64,'request\x20sent',JSON[_0x0b13('0xf')](_0x33c458));if(_0x33c458[_0x0b13('0x10')]){if(_0x33c458[_0x0b13('0x10')][_0x0b13('0x11')]===0x1f4){logger[_0x0b13('0x10')]('Condition,\x20%s,\x20%s',_0x299b64,_0x33c458[_0x0b13('0x10')]['message']);return _0x33234d(_0x33c458[_0x0b13('0x10')][_0x0b13('0x12')]);}logger[_0x0b13('0x10')](_0x0b13('0xc'),_0x299b64,_0x33c458[_0x0b13('0x10')][_0x0b13('0x12')]);return _0x52c72e(_0x33c458[_0x0b13('0x10')][_0x0b13('0x12')]);}else{logger[_0x0b13('0x13')](_0x0b13('0xc'),_0x299b64,_0x0b13('0xd'));_0x52c72e(_0x33c458[_0x0b13('0x14')][_0x0b13('0x12')]);}})['catch'](function(_0x516f58){logger[_0x0b13('0x10')]('Condition,\x20%s,\x20%s',_0x299b64,_0x516f58);_0x33234d(_0x516f58);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bf3d1fd..06d8b8a 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 _0x62e0=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','destroy'];(function(_0x566550,_0x2c4ba2){var _0x234d97=function(_0x24668e){while(--_0x24668e){_0x566550['push'](_0x566550['shift']());}};_0x234d97(++_0x2c4ba2);}(_0x62e0,0x83));var _0x062e=function(_0x2b6e27,_0x4fba9f){_0x2b6e27=_0x2b6e27-0x0;var _0x239c88=_0x62e0[_0x2b6e27];return _0x239c88;};'use strict';var multer=require('multer');var util=require(_0x062e('0x0'));var path=require(_0x062e('0x1'));var timeout=require(_0x062e('0x2'));var express=require('express');var router=express[_0x062e('0x3')]();var fs_extra=require(_0x062e('0x4'));var auth=require(_0x062e('0x5'));var interaction=require(_0x062e('0x6'));var config=require('../../config/environment');var controller=require(_0x062e('0x7'));router['put'](_0x062e('0x8'),auth[_0x062e('0x9')](),controller[_0x062e('0xa')]);router['delete'](_0x062e('0x8'),auth[_0x062e('0x9')](),controller[_0x062e('0xb')]);module[_0x062e('0xc')]=router; \ No newline at end of file +var _0xeead=['update','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeead,0x11c));var _0xdeea=function(_0x1056de,_0x1c4a59){_0x1056de=_0x1056de-0x0;var _0x58b2a2=_0xeead[_0x1056de];return _0x58b2a2;};'use strict';var multer=require(_0xdeea('0x0'));var util=require(_0xdeea('0x1'));var path=require('path');var timeout=require(_0xdeea('0x2'));var express=require(_0xdeea('0x3'));var router=express[_0xdeea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdeea('0x5'));var interaction=require(_0xdeea('0x6'));var config=require('../../config/environment');var controller=require(_0xdeea('0x7'));router[_0xdeea('0x8')]('/:id',auth[_0xdeea('0x9')](),controller[_0xdeea('0xa')]);router[_0xdeea('0xb')](_0xdeea('0xc'),auth[_0xdeea('0x9')](),controller['destroy']);module[_0xdeea('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index cf530a7..ede92ef 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3e3=['name','INTEGER','exports','STRING'];(function(_0x5654bd,_0xf727){var _0x434937=function(_0x5a04b2){while(--_0x5a04b2){_0x5654bd['push'](_0x5654bd['shift']());}};_0x434937(++_0xf727);}(_0xf3e3,0xf6));var _0x3f3e=function(_0x3556d9,_0x2c7d1a){_0x3556d9=_0x3556d9-0x0;var _0x94803b=_0xf3e3[_0x3556d9];return _0x94803b;};'use strict';var Sequelize=require('sequelize');module[_0x3f3e('0x0')]={'name':{'type':Sequelize[_0x3f3e('0x1')],'allowNull':![],'unique':_0x3f3e('0x2')},'OrderBy':{'type':Sequelize[_0x3f3e('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3f3e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x42c6=['INTEGER'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x42c6,0x15e));var _0x642c=function(_0x1a1ec0,_0x11d446){_0x1a1ec0=_0x1a1ec0-0x0;var _0x106724=_0x42c6[_0x1a1ec0];return _0x106724;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x642c('0x0')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index be4aabb..764ff8d 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7916=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject','update','then','get','destroy','end','error','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x7916,0x128));var _0x6791=function(_0x40a6a5,_0x12ad6b){_0x40a6a5=_0x40a6a5-0x0;var _0x43da72=_0x7916[_0x40a6a5];return _0x43da72;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];function respondWithStatusCode(_0x61ac73,_0x16c62b){_0x16c62b=_0x16c62b||0xcc;return function(_0x423e22){if(_0x423e22){return _0x61ac73[_0x6791('0x17')](_0x16c62b);}return _0x61ac73[_0x6791('0x18')](_0x16c62b)['end']();};}function respondWithResult(_0x4b1719,_0x34b28d){_0x34b28d=_0x34b28d||0xc8;return function(_0x5122f9){if(_0x5122f9){return _0x4b1719[_0x6791('0x18')](_0x34b28d)['json'](_0x5122f9);}};}function respondWithFilteredResult(_0x3be9f0,_0x163898){return function(_0x517910){if(_0x517910){var _0x3e4792=typeof _0x163898['offset']===_0x6791('0x19')&&typeof _0x163898[_0x6791('0x1a')]==='undefined';var _0xbc35d=_0x517910[_0x6791('0x1b')];var _0x5bec14=_0x3e4792?0x0:_0x163898[_0x6791('0x1c')];var _0x4d8a79=_0x3e4792?_0x517910[_0x6791('0x1b')]:_0x163898[_0x6791('0x1c')]+_0x163898[_0x6791('0x1a')];var _0x3a72ce;if(_0x4d8a79>=_0xbc35d){_0x4d8a79=_0xbc35d;_0x3a72ce=0xc8;}else{_0x3a72ce=0xce;}_0x3be9f0[_0x6791('0x18')](_0x3a72ce);return _0x3be9f0[_0x6791('0x1d')](_0x6791('0x1e'),_0x5bec14+'-'+_0x4d8a79+'/'+_0xbc35d)['json'](_0x517910);}return null;};}function patchUpdates(_0x4a2922){return function(_0x306acb){try{jsonpatch['apply'](_0x306acb,_0x4a2922,!![]);}catch(_0x21ef16){return BPromise[_0x6791('0x1f')](_0x21ef16);}return _0x306acb['save']();};}function saveUpdates(_0x17f200,_0x309610){return function(_0x15b9ab){if(_0x15b9ab){return _0x15b9ab[_0x6791('0x20')](_0x17f200)['then'](function(_0x3e17b3){return _0x3e17b3;});}return null;};}function removeEntity(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(_0x53bb44){return _0x53bb44['destroy']()[_0x6791('0x21')](function(){var _0x502043=_0x53bb44[_0x6791('0x22')]({'plain':!![]});var _0x5409f1='ContactItemTypes';return db['UserProfileResource'][_0x6791('0x23')]({'where':{'type':_0x5409f1,'resourceId':_0x502043['id']}})[_0x6791('0x21')](function(){return _0x53bb44;});})[_0x6791('0x21')](function(){_0x1b516d['status'](0xcc)[_0x6791('0x24')]();});}};}function handleEntityNotFound(_0x30cc17,_0x493a59){return function(_0x342107){if(!_0x342107){_0x30cc17['sendStatus'](0x194);}return _0x342107;};}function handleError(_0x424b0e,_0x49dd24){_0x49dd24=_0x49dd24||0x1f4;return function(_0x4fc5d5){logger[_0x6791('0x25')](_0x4fc5d5['stack']);if(_0x4fc5d5[_0x6791('0x26')]){delete _0x4fc5d5[_0x6791('0x26')];}_0x424b0e['status'](_0x49dd24)[_0x6791('0x27')](_0x4fc5d5);};}exports[_0x6791('0x28')]=function(_0x234c5e,_0xd36448){var _0x5d9d54={},_0x4f91d6={},_0x348b9c={'count':0x0,'rows':[]};var _0x5e5ac3=_[_0x6791('0x29')](db[_0x6791('0x2a')][_0x6791('0x2b')],function(_0x2b98b8){return{'name':_0x2b98b8[_0x6791('0x2c')],'type':_0x2b98b8[_0x6791('0x2d')][_0x6791('0x2e')]};});_0x4f91d6[_0x6791('0x2f')]=_[_0x6791('0x29')](_0x5e5ac3,_0x6791('0x26'));_0x4f91d6['query']=_[_0x6791('0x30')](_0x234c5e[_0x6791('0x31')]);_0x4f91d6[_0x6791('0x32')]=_[_0x6791('0x33')](_0x4f91d6[_0x6791('0x2f')],_0x4f91d6[_0x6791('0x31')]);_0x5d9d54['attributes']=_['intersection'](_0x4f91d6['model'],qs[_0x6791('0x34')](_0x234c5e[_0x6791('0x31')][_0x6791('0x34')]));_0x5d9d54['attributes']=_0x5d9d54['attributes'][_0x6791('0x35')]?_0x5d9d54[_0x6791('0x36')]:_0x4f91d6[_0x6791('0x2f')];if(!_0x234c5e[_0x6791('0x31')]['hasOwnProperty'](_0x6791('0x37'))){_0x5d9d54[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x234c5e['query'][_0x6791('0x1a')]);_0x5d9d54['offset']=qs['offset'](_0x234c5e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x5d9d54['order']=qs[_0x6791('0x38')](_0x234c5e[_0x6791('0x31')][_0x6791('0x38')]);_0x5d9d54[_0x6791('0x39')]=qs[_0x6791('0x32')](_['pick'](_0x234c5e[_0x6791('0x31')],_0x4f91d6[_0x6791('0x32')]),_0x5e5ac3);if(_0x234c5e[_0x6791('0x31')]['filter']){_0x5d9d54[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x5d9d54[_0x6791('0x39')],{'$or':_['map'](_0x5e5ac3,function(_0x11a012){if(_0x11a012[_0x6791('0x2d')]!==_0x6791('0x3b')){var _0x122aa5={};_0x122aa5[_0x11a012['name']]={'$like':'%'+_0x234c5e[_0x6791('0x31')][_0x6791('0x3c')]+'%'};return _0x122aa5;}})});}_0x5d9d54=_[_0x6791('0x3a')]({},_0x5d9d54,_0x234c5e[_0x6791('0x3d')]);var _0x12f121={'where':_0x5d9d54[_0x6791('0x39')]};return db[_0x6791('0x2a')][_0x6791('0x1b')](_0x12f121)[_0x6791('0x21')](function(_0x4e4004){_0x348b9c['count']=_0x4e4004;if(_0x234c5e[_0x6791('0x31')][_0x6791('0x3e')]){_0x5d9d54['include']=[{'all':!![]}];}return db[_0x6791('0x2a')][_0x6791('0x3f')](_0x5d9d54);})[_0x6791('0x21')](function(_0x3edb86){_0x348b9c[_0x6791('0x40')]=_0x3edb86;return _0x348b9c;})[_0x6791('0x21')](respondWithFilteredResult(_0xd36448,_0x5d9d54))[_0x6791('0x41')](handleError(_0xd36448,null));};exports['show']=function(_0xb3bea8,_0x4b9fca){var _0x17ecf0={'raw':!![],'where':{'id':_0xb3bea8[_0x6791('0x42')]['id']}},_0xfc170e={};_0xfc170e[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x2a')][_0x6791('0x2b')]);_0xfc170e[_0x6791('0x31')]=_[_0x6791('0x30')](_0xb3bea8[_0x6791('0x31')]);_0xfc170e[_0x6791('0x32')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],_0xfc170e['query']);_0x17ecf0[_0x6791('0x36')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],qs[_0x6791('0x34')](_0xb3bea8['query'][_0x6791('0x34')]));_0x17ecf0[_0x6791('0x36')]=_0x17ecf0['attributes'][_0x6791('0x35')]?_0x17ecf0['attributes']:_0xfc170e[_0x6791('0x2f')];if(_0xb3bea8[_0x6791('0x31')][_0x6791('0x3e')]){_0x17ecf0[_0x6791('0x43')]=[{'all':!![]}];}_0x17ecf0=_[_0x6791('0x3a')]({},_0x17ecf0,_0xb3bea8[_0x6791('0x3d')]);return db[_0x6791('0x2a')][_0x6791('0x44')](_0x17ecf0)[_0x6791('0x21')](handleEntityNotFound(_0x4b9fca,null))['then'](respondWithResult(_0x4b9fca,null))[_0x6791('0x41')](handleError(_0x4b9fca,null));};exports['create']=function(_0x10e806,_0x2bb86a){return db[_0x6791('0x2a')][_0x6791('0x45')](_0x10e806[_0x6791('0x46')],{})['then'](function(_0x2bc08d){var _0x35e087=_0x10e806[_0x6791('0x47')][_0x6791('0x22')]({'plain':!![]});if(!_0x35e087)throw new Error(_0x6791('0x48'));if(_0x35e087['role']===_0x6791('0x47')){var _0x42948b=_0x2bc08d['get']({'plain':!![]});var _0x3df699='ContactItemTypes';return db[_0x6791('0x49')][_0x6791('0x44')]({'where':{'name':_0x3df699,'userProfileId':_0x35e087[_0x6791('0x4a')]},'raw':!![]})[_0x6791('0x21')](function(_0x558069){if(_0x558069&&_0x558069[_0x6791('0x4b')]===0x0){return db[_0x6791('0x4c')]['create']({'name':_0x42948b[_0x6791('0x26')],'resourceId':_0x42948b['id'],'type':_0x558069[_0x6791('0x26')],'sectionId':_0x558069['id']},{})[_0x6791('0x21')](function(){return _0x2bc08d;});}else{return _0x2bc08d;}})['catch'](function(_0x355e97){logger[_0x6791('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x355e97);throw _0x355e97;});}return _0x2bc08d;})[_0x6791('0x21')](respondWithResult(_0x2bb86a,0xc9))[_0x6791('0x41')](handleError(_0x2bb86a,null));};exports['update']=function(_0x169531,_0x216498){if(_0x169531[_0x6791('0x46')]['id']){delete _0x169531[_0x6791('0x46')]['id'];}return db['ContactItemType'][_0x6791('0x44')]({'where':{'id':_0x169531[_0x6791('0x42')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x216498,null))['then'](saveUpdates(_0x169531['body'],null))[_0x6791('0x21')](respondWithResult(_0x216498,null))[_0x6791('0x41')](handleError(_0x216498,null));};exports[_0x6791('0x23')]=function(_0x45756f,_0x288f05){return db['ContactItemType']['find']({'where':{'id':_0x45756f[_0x6791('0x42')]['id']}})['then'](handleEntityNotFound(_0x288f05,null))['then'](db[_0x6791('0x4d')][_0x6791('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x45756f[_0x6791('0x42')]['id']}}))[_0x6791('0x21')](removeEntity(_0x288f05,null))[_0x6791('0x41')](handleError(_0x288f05,null));}; \ No newline at end of file +var _0x7334=['save','update','then','destroy','get','ContactItemTypes','UserProfileResource','name','send','index','map','ContactItemType','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','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','role','UserProfileSection','userProfileId','error','eml-format','rimraf','zip-dir','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7334,0x184));var _0x4733=function(_0x51924e,_0x285e0f){_0x51924e=_0x51924e-0x0;var _0x3a1b9a=_0x7334[_0x51924e];return _0x3a1b9a;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];function respondWithStatusCode(_0x461f74,_0x100ecd){_0x100ecd=_0x100ecd||0xcc;return function(_0x1c146c){if(_0x1c146c){return _0x461f74[_0x4733('0x1a')](_0x100ecd);}return _0x461f74['status'](_0x100ecd)[_0x4733('0x1b')]();};}function respondWithResult(_0x543caf,_0x4327f3){_0x4327f3=_0x4327f3||0xc8;return function(_0x1a22e4){if(_0x1a22e4){return _0x543caf[_0x4733('0x1c')](_0x4327f3)[_0x4733('0x1d')](_0x1a22e4);}};}function respondWithFilteredResult(_0x3813df,_0x167016){return function(_0x12f111){if(_0x12f111){var _0x9fff=typeof _0x167016[_0x4733('0x1e')]==='undefined'&&typeof _0x167016[_0x4733('0x1f')]===_0x4733('0x20');var _0x47b129=_0x12f111[_0x4733('0x21')];var _0x1d2fb6=_0x9fff?0x0:_0x167016[_0x4733('0x1e')];var _0x384e0c=_0x9fff?_0x12f111['count']:_0x167016['offset']+_0x167016[_0x4733('0x1f')];var _0x3b730a;if(_0x384e0c>=_0x47b129){_0x384e0c=_0x47b129;_0x3b730a=0xc8;}else{_0x3b730a=0xce;}_0x3813df['status'](_0x3b730a);return _0x3813df[_0x4733('0x22')](_0x4733('0x23'),_0x1d2fb6+'-'+_0x384e0c+'/'+_0x47b129)[_0x4733('0x1d')](_0x12f111);}return null;};}function patchUpdates(_0x7a4e0){return function(_0x493cd3){try{jsonpatch[_0x4733('0x24')](_0x493cd3,_0x7a4e0,!![]);}catch(_0xb45e1){return BPromise['reject'](_0xb45e1);}return _0x493cd3[_0x4733('0x25')]();};}function saveUpdates(_0x18da47,_0x478e34){return function(_0x15a291){if(_0x15a291){return _0x15a291[_0x4733('0x26')](_0x18da47)[_0x4733('0x27')](function(_0x1a0643){return _0x1a0643;});}return null;};}function removeEntity(_0x3a2542,_0x24db74){return function(_0x180049){if(_0x180049){return _0x180049[_0x4733('0x28')]()['then'](function(){var _0x3e6976=_0x180049[_0x4733('0x29')]({'plain':!![]});var _0x7884e5=_0x4733('0x2a');return db[_0x4733('0x2b')][_0x4733('0x28')]({'where':{'type':_0x7884e5,'resourceId':_0x3e6976['id']}})[_0x4733('0x27')](function(){return _0x180049;});})[_0x4733('0x27')](function(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x521855,_0x3aeb57){return function(_0x4c91bc){if(!_0x4c91bc){_0x521855['sendStatus'](0x194);}return _0x4c91bc;};}function handleError(_0x24e975,_0x49c516){_0x49c516=_0x49c516||0x1f4;return function(_0xcde4f4){logger['error'](_0xcde4f4['stack']);if(_0xcde4f4['name']){delete _0xcde4f4[_0x4733('0x2c')];}_0x24e975[_0x4733('0x1c')](_0x49c516)[_0x4733('0x2d')](_0xcde4f4);};}exports[_0x4733('0x2e')]=function(_0x4fee4a,_0x538a7c){var _0x50f67e={},_0x2b2757={},_0x56872b={'count':0x0,'rows':[]};var _0x5a4814=_[_0x4733('0x2f')](db[_0x4733('0x30')][_0x4733('0x31')],function(_0x59172a){return{'name':_0x59172a['fieldName'],'type':_0x59172a[_0x4733('0x32')][_0x4733('0x33')]};});_0x2b2757[_0x4733('0x34')]=_[_0x4733('0x2f')](_0x5a4814,_0x4733('0x2c'));_0x2b2757['query']=_[_0x4733('0x35')](_0x4fee4a[_0x4733('0x36')]);_0x2b2757[_0x4733('0x37')]=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],_0x2b2757['query']);_0x50f67e['attributes']=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],qs[_0x4733('0x39')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x39')]));_0x50f67e['attributes']=_0x50f67e[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50f67e[_0x4733('0x3a')]:_0x2b2757['model'];if(!_0x4fee4a[_0x4733('0x36')][_0x4733('0x3c')](_0x4733('0x3d'))){_0x50f67e[_0x4733('0x1f')]=qs[_0x4733('0x1f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x1f')]);_0x50f67e[_0x4733('0x1e')]=qs['offset'](_0x4fee4a[_0x4733('0x36')]['offset']);}_0x50f67e[_0x4733('0x3e')]=qs[_0x4733('0x3f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x3f')]);_0x50f67e[_0x4733('0x40')]=qs[_0x4733('0x37')](_[_0x4733('0x41')](_0x4fee4a[_0x4733('0x36')],_0x2b2757['filters']),_0x5a4814);if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x42')]){_0x50f67e['where']=_[_0x4733('0x43')](_0x50f67e[_0x4733('0x40')],{'$or':_['map'](_0x5a4814,function(_0x34aefe){if(_0x34aefe['type']!==_0x4733('0x44')){var _0x4c3073={};_0x4c3073[_0x34aefe[_0x4733('0x2c')]]={'$like':'%'+_0x4fee4a[_0x4733('0x36')]['filter']+'%'};return _0x4c3073;}})});}_0x50f67e=_['merge']({},_0x50f67e,_0x4fee4a[_0x4733('0x45')]);var _0x1d7112={'where':_0x50f67e['where']};return db[_0x4733('0x30')][_0x4733('0x21')](_0x1d7112)[_0x4733('0x27')](function(_0x28ed14){_0x56872b[_0x4733('0x21')]=_0x28ed14;if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x46')]){_0x50f67e[_0x4733('0x47')]=[{'all':!![]}];}return db[_0x4733('0x30')][_0x4733('0x48')](_0x50f67e);})[_0x4733('0x27')](function(_0x1d32df){_0x56872b[_0x4733('0x49')]=_0x1d32df;return _0x56872b;})[_0x4733('0x27')](respondWithFilteredResult(_0x538a7c,_0x50f67e))[_0x4733('0x4a')](handleError(_0x538a7c,null));};exports[_0x4733('0x4b')]=function(_0x297bb1,_0x397088){var _0x50b9cb={'raw':!![],'where':{'id':_0x297bb1[_0x4733('0x4c')]['id']}},_0x1a0c5c={};_0x1a0c5c[_0x4733('0x34')]=_[_0x4733('0x35')](db[_0x4733('0x30')][_0x4733('0x31')]);_0x1a0c5c[_0x4733('0x36')]=_[_0x4733('0x35')](_0x297bb1[_0x4733('0x36')]);_0x1a0c5c[_0x4733('0x37')]=_[_0x4733('0x38')](_0x1a0c5c[_0x4733('0x34')],_0x1a0c5c[_0x4733('0x36')]);_0x50b9cb[_0x4733('0x3a')]=_['intersection'](_0x1a0c5c['model'],qs[_0x4733('0x39')](_0x297bb1[_0x4733('0x36')][_0x4733('0x39')]));_0x50b9cb[_0x4733('0x3a')]=_0x50b9cb[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50b9cb[_0x4733('0x3a')]:_0x1a0c5c[_0x4733('0x34')];if(_0x297bb1[_0x4733('0x36')][_0x4733('0x46')]){_0x50b9cb['include']=[{'all':!![]}];}_0x50b9cb=_['merge']({},_0x50b9cb,_0x297bb1['options']);return db['ContactItemType'][_0x4733('0x4d')](_0x50b9cb)[_0x4733('0x27')](handleEntityNotFound(_0x397088,null))[_0x4733('0x27')](respondWithResult(_0x397088,null))[_0x4733('0x4a')](handleError(_0x397088,null));};exports[_0x4733('0x4e')]=function(_0x45b9cf,_0x1c6abf){return db[_0x4733('0x30')][_0x4733('0x4e')](_0x45b9cf[_0x4733('0x4f')],{})['then'](function(_0x53d70b){var _0x29c93d=_0x45b9cf['user'][_0x4733('0x29')]({'plain':!![]});if(!_0x29c93d)throw new Error(_0x4733('0x50'));if(_0x29c93d[_0x4733('0x51')]==='user'){var _0x3f2a78=_0x53d70b[_0x4733('0x29')]({'plain':!![]});var _0x31ae69=_0x4733('0x2a');return db[_0x4733('0x52')][_0x4733('0x4d')]({'where':{'name':_0x31ae69,'userProfileId':_0x29c93d[_0x4733('0x53')]},'raw':!![]})[_0x4733('0x27')](function(_0x28d428){if(_0x28d428&&_0x28d428['autoAssociation']===0x0){return db[_0x4733('0x2b')][_0x4733('0x4e')]({'name':_0x3f2a78[_0x4733('0x2c')],'resourceId':_0x3f2a78['id'],'type':_0x28d428['name'],'sectionId':_0x28d428['id']},{})[_0x4733('0x27')](function(){return _0x53d70b;});}else{return _0x53d70b;}})[_0x4733('0x4a')](function(_0xafb3f8){logger[_0x4733('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xafb3f8);throw _0xafb3f8;});}return _0x53d70b;})[_0x4733('0x27')](respondWithResult(_0x1c6abf,0xc9))['catch'](handleError(_0x1c6abf,null));};exports[_0x4733('0x26')]=function(_0x3b8165,_0x42405e){if(_0x3b8165[_0x4733('0x4f')]['id']){delete _0x3b8165[_0x4733('0x4f')]['id'];}return db['ContactItemType'][_0x4733('0x4d')]({'where':{'id':_0x3b8165[_0x4733('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42405e,null))['then'](saveUpdates(_0x3b8165[_0x4733('0x4f')],null))[_0x4733('0x27')](respondWithResult(_0x42405e,null))[_0x4733('0x4a')](handleError(_0x42405e,null));};exports[_0x4733('0x28')]=function(_0x422010,_0x972fde){return db[_0x4733('0x30')][_0x4733('0x4d')]({'where':{'id':_0x422010['params']['id']}})['then'](handleEntityNotFound(_0x972fde,null))[_0x4733('0x27')](db['CmContactHasItem'][_0x4733('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x422010[_0x4733('0x4c')]['id']}}))[_0x4733('0x27')](removeEntity(_0x972fde,null))['catch'](handleError(_0x972fde,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 6451a72..2bfa001 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3087=['moment','request-promise','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x43ac73,_0x18174a){var _0x3e7771=function(_0x2df682){while(--_0x2df682){_0x43ac73['push'](_0x43ac73['shift']());}};_0x3e7771(++_0x18174a);}(_0x3087,0x186));var _0x7308=function(_0x2cef42,_0x539945){_0x2cef42=_0x2cef42-0x0;var _0x5e606a=_0x3087[_0x2cef42];return _0x5e606a;};'use strict';var _=require(_0x7308('0x0'));var util=require(_0x7308('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7308('0x2'));var BPromise=require('bluebird');var rp=require(_0x7308('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7308('0x4'));var attributes=require(_0x7308('0x5'));module['exports']=function(_0x2049cf,_0x11817a){return _0x2049cf['define'](_0x7308('0x6'),attributes,{'tableName':_0x7308('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc46a=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x405dd6,_0x59b084){var _0x4692d3=function(_0xe9573c){while(--_0xe9573c){_0x405dd6['push'](_0x405dd6['shift']());}};_0x4692d3(++_0x59b084);}(_0xc46a,0x189));var _0xac46=function(_0x2f06b3,_0x12feb6){_0x2f06b3=_0x2f06b3-0x0;var _0x270d4d=_0xc46a[_0x2f06b3];return _0x270d4d;};'use strict';var _=require(_0xac46('0x0'));var util=require(_0xac46('0x1'));var logger=require(_0xac46('0x2'))(_0xac46('0x3'));var moment=require(_0xac46('0x4'));var BPromise=require(_0xac46('0x5'));var rp=require(_0xac46('0x6'));var fs=require('fs');var path=require(_0xac46('0x7'));var rimraf=require(_0xac46('0x8'));var config=require(_0xac46('0x9'));var attributes=require(_0xac46('0xa'));module[_0xac46('0xb')]=function(_0x4f6b9d,_0x17d005){return _0x4f6b9d[_0xac46('0xc')](_0xac46('0xd'),attributes,{'tableName':_0xac46('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 947f72f..31d0eca 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9990=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d257e,_0x143605){var _0x4fb626=function(_0x120ce3){while(--_0x120ce3){_0x1d257e['push'](_0x1d257e['shift']());}};_0x4fb626(++_0x143605);}(_0x9990,0xf6));var _0x0999=function(_0x2deb01,_0x4e741c){_0x2deb01=_0x2deb01-0x0;var _0x3920b3=_0x9990[_0x2deb01];return _0x3920b3;};'use strict';var _=require('lodash');var util=require(_0x0999('0x0'));var moment=require(_0x0999('0x1'));var BPromise=require(_0x0999('0x2'));var rs=require(_0x0999('0x3'));var fs=require('fs');var Redis=require(_0x0999('0x4'));var db=require(_0x0999('0x5'))['db'];var utils=require(_0x0999('0x6'));var logger=require(_0x0999('0x7'))('rpc');var config=require(_0x0999('0x8'));var jayson=require(_0x0999('0x9'));var client=jayson[_0x0999('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6f23,_0xb1d8f9,_0x3fe805){return new BPromise(function(_0x304f75,_0x384a4e){return client[_0x0999('0xb')](_0x1a6f23,_0x3fe805)[_0x0999('0xc')](function(_0x52d196){logger[_0x0999('0xd')](_0x0999('0xe'),_0xb1d8f9,_0x0999('0xf'));logger['debug'](_0x0999('0x10'),_0xb1d8f9,_0x0999('0xf'),JSON[_0x0999('0x11')](_0x52d196));if(_0x52d196['error']){if(_0x52d196[_0x0999('0x12')]['code']===0x1f4){logger[_0x0999('0x12')](_0x0999('0xe'),_0xb1d8f9,_0x52d196[_0x0999('0x12')][_0x0999('0x13')]);return _0x384a4e(_0x52d196[_0x0999('0x12')]['message']);}logger[_0x0999('0x12')](_0x0999('0xe'),_0xb1d8f9,_0x52d196[_0x0999('0x12')][_0x0999('0x13')]);return _0x304f75(_0x52d196[_0x0999('0x12')]['message']);}else{logger[_0x0999('0xd')](_0x0999('0xe'),_0xb1d8f9,_0x0999('0xf'));_0x304f75(_0x52d196[_0x0999('0x14')][_0x0999('0x13')]);}})[_0x0999('0x15')](function(_0x2fa43e){logger['error'](_0x0999('0xe'),_0xb1d8f9,_0x2fa43e);_0x384a4e(_0x2fa43e);});});} \ No newline at end of file +var _0x9b34=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x22f8a2,_0x3042a8){var _0x3324ba=function(_0x3171ac){while(--_0x3171ac){_0x22f8a2['push'](_0x22f8a2['shift']());}};_0x3324ba(++_0x3042a8);}(_0x9b34,0x9d));var _0x49b3=function(_0x408c05,_0x12d88a){_0x408c05=_0x408c05-0x0;var _0x515e74=_0x9b34[_0x408c05];return _0x515e74;};'use strict';var _=require(_0x49b3('0x0'));var util=require(_0x49b3('0x1'));var moment=require(_0x49b3('0x2'));var BPromise=require(_0x49b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49b3('0x4'));var db=require(_0x49b3('0x5'))['db'];var utils=require(_0x49b3('0x6'));var logger=require(_0x49b3('0x7'))('rpc');var config=require(_0x49b3('0x8'));var jayson=require(_0x49b3('0x9'));var client=jayson[_0x49b3('0xa')][_0x49b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182d49,_0x36c6cb,_0x11105b){return new BPromise(function(_0x486437,_0x36a4d2){return client[_0x49b3('0xc')](_0x182d49,_0x11105b)['then'](function(_0x548c97){logger['info'](_0x49b3('0xd'),_0x36c6cb,_0x49b3('0xe'));logger[_0x49b3('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x36c6cb,_0x49b3('0xe'),JSON['stringify'](_0x548c97));if(_0x548c97['error']){if(_0x548c97[_0x49b3('0x10')][_0x49b3('0x11')]===0x1f4){logger[_0x49b3('0x10')]('ContactItemType,\x20%s,\x20%s',_0x36c6cb,_0x548c97[_0x49b3('0x10')]['message']);return _0x36a4d2(_0x548c97[_0x49b3('0x10')][_0x49b3('0x12')]);}logger[_0x49b3('0x10')](_0x49b3('0xd'),_0x36c6cb,_0x548c97[_0x49b3('0x10')][_0x49b3('0x12')]);return _0x486437(_0x548c97[_0x49b3('0x10')][_0x49b3('0x12')]);}else{logger[_0x49b3('0x13')](_0x49b3('0xd'),_0x36c6cb,_0x49b3('0xe'));_0x486437(_0x548c97[_0x49b3('0x14')][_0x49b3('0x12')]);}})[_0x49b3('0x15')](function(_0x4cdb2b){logger[_0x49b3('0x10')](_0x49b3('0xd'),_0x36c6cb,_0x4cdb2b);_0x36a4d2(_0x4cdb2b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index f2f197b..7f2f2f6 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e83=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','put','update','delete'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9e83,0xca));var _0x39e8=function(_0x166b04,_0x52010c){_0x166b04=_0x166b04-0x0;var _0x446788=_0x9e83[_0x166b04];return _0x446788;};'use strict';var multer=require(_0x39e8('0x0'));var util=require(_0x39e8('0x1'));var path=require(_0x39e8('0x2'));var timeout=require(_0x39e8('0x3'));var express=require(_0x39e8('0x4'));var router=express[_0x39e8('0x5')]();var fs_extra=require(_0x39e8('0x6'));var auth=require(_0x39e8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x39e8('0x8'));var controller=require(_0x39e8('0x9'));router[_0x39e8('0xa')]('/',auth[_0x39e8('0xb')](),controller[_0x39e8('0xc')]);router['get'](_0x39e8('0xd'),auth[_0x39e8('0xb')](),controller[_0x39e8('0xe')]);router['post']('/',auth[_0x39e8('0xb')](),controller['create']);router[_0x39e8('0xf')](_0x39e8('0xd'),auth['isAuthenticated'](),controller[_0x39e8('0x10')]);router[_0x39e8('0x11')](_0x39e8('0xd'),auth[_0x39e8('0xb')](),controller[_0x39e8('0x12')]);module[_0x39e8('0x13')]=router; \ No newline at end of file +var _0x5c11=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x5c11,0xa4));var _0x15c1=function(_0x289e48,_0x2fe387){_0x289e48=_0x289e48-0x0;var _0x56d497=_0x5c11[_0x289e48];return _0x56d497;};'use strict';var multer=require(_0x15c1('0x0'));var util=require(_0x15c1('0x1'));var path=require(_0x15c1('0x2'));var timeout=require(_0x15c1('0x3'));var express=require('express');var router=express[_0x15c1('0x4')]();var fs_extra=require(_0x15c1('0x5'));var auth=require(_0x15c1('0x6'));var interaction=require(_0x15c1('0x7'));var config=require(_0x15c1('0x8'));var controller=require(_0x15c1('0x9'));router[_0x15c1('0xa')]('/',auth['isAuthenticated'](),controller[_0x15c1('0xb')]);router[_0x15c1('0xa')](_0x15c1('0xc'),auth[_0x15c1('0xd')](),controller[_0x15c1('0xe')]);router[_0x15c1('0xf')]('/',auth[_0x15c1('0xd')](),controller['create']);router['put'](_0x15c1('0xc'),auth[_0x15c1('0xd')](),controller[_0x15c1('0x10')]);router[_0x15c1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x15c1('0x12')]);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 3cb91fb..d81cd37 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x42d4b3,_0x280415){var _0x199db0=function(_0x1a937e){while(--_0x1a937e){_0x42d4b3['push'](_0x42d4b3['shift']());}};_0x199db0(++_0x280415);}(_0x757a,0xde));var _0xa757=function(_0x156607,_0x312934){_0x156607=_0x156607-0x0;var _0x41ed1f=_0x757a[_0x156607];return _0x41ed1f;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x424339,_0x3486c2){var _0x3f93e4=function(_0x400a5f){while(--_0x400a5f){_0x424339['push'](_0x424339['shift']());}};_0x3f93e4(++_0x3486c2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 72129be..d95d81f 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 _0x70f9=['limit','count','Content-Range','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','then','rows','show','params','keys','length','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','updatedAt','createdAt','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','register','status','end','json','offset','undefined'];(function(_0x48cc04,_0x37efcb){var _0x9b4bf2=function(_0x469293){while(--_0x469293){_0x48cc04['push'](_0x48cc04['shift']());}};_0x9b4bf2(++_0x37efcb);}(_0x70f9,0x172));var _0x970f=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0x70f9[_0x234318];return _0x1ab719;};'use strict';var emlformat=require(_0x970f('0x0'));var rimraf=require(_0x970f('0x1'));var zipdir=require(_0x970f('0x2'));var jsonpatch=require(_0x970f('0x3'));var rp=require(_0x970f('0x4'));var moment=require(_0x970f('0x5'));var BPromise=require(_0x970f('0x6'));var Mustache=require(_0x970f('0x7'));var util=require(_0x970f('0x8'));var path=require(_0x970f('0x9'));var sox=require(_0x970f('0xa'));var csv=require(_0x970f('0xb'));var ejs=require(_0x970f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x970f('0xd'));var squel=require(_0x970f('0xe'));var crypto=require(_0x970f('0xf'));var jsforce=require(_0x970f('0x10'));var deskjs=require(_0x970f('0x11'));var toCsv=require(_0x970f('0xb'));var querystring=require(_0x970f('0x12'));var Papa=require(_0x970f('0x13'));var Redis=require(_0x970f('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x970f('0x15'));var as=require(_0x970f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x970f('0x17'))(_0x970f('0x18'));var utils=require(_0x970f('0x19'));var config=require(_0x970f('0x1a'));var licenseUtil=require(_0x970f('0x1b'));var db=require(_0x970f('0x1c'))['db'];config[_0x970f('0x1d')]=_[_0x970f('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x970f('0x1d')]));require(_0x970f('0x1f'))[_0x970f('0x20')](socket);function respondWithStatusCode(_0x236409,_0x514ae9){_0x514ae9=_0x514ae9||0xcc;return function(_0x43ad8e){if(_0x43ad8e){return _0x236409['sendStatus'](_0x514ae9);}return _0x236409[_0x970f('0x21')](_0x514ae9)[_0x970f('0x22')]();};}function respondWithResult(_0x539b81,_0x293d39){_0x293d39=_0x293d39||0xc8;return function(_0xb975d3){if(_0xb975d3){return _0x539b81[_0x970f('0x21')](_0x293d39)[_0x970f('0x23')](_0xb975d3);}};}function respondWithFilteredResult(_0x26ce80,_0x5eef3b){return function(_0x26f253){if(_0x26f253){var _0x1806f6=typeof _0x5eef3b[_0x970f('0x24')]===_0x970f('0x25')&&typeof _0x5eef3b[_0x970f('0x26')]===_0x970f('0x25');var _0x415dc9=_0x26f253['count'];var _0x449537=_0x1806f6?0x0:_0x5eef3b['offset'];var _0x46c8b2=_0x1806f6?_0x26f253[_0x970f('0x27')]:_0x5eef3b[_0x970f('0x24')]+_0x5eef3b['limit'];var _0x44699b;if(_0x46c8b2>=_0x415dc9){_0x46c8b2=_0x415dc9;_0x44699b=0xc8;}else{_0x44699b=0xce;}_0x26ce80['status'](_0x44699b);return _0x26ce80['set'](_0x970f('0x28'),_0x449537+'-'+_0x46c8b2+'/'+_0x415dc9)[_0x970f('0x23')](_0x26f253);}return null;};}function patchUpdates(_0x459e51){return function(_0x2d1183){try{jsonpatch[_0x970f('0x29')](_0x2d1183,_0x459e51,!![]);}catch(_0x219d44){return BPromise[_0x970f('0x2a')](_0x219d44);}return _0x2d1183[_0x970f('0x2b')]();};}function saveUpdates(_0x258ed8,_0xd3a25){return function(_0x44ee71){if(_0x44ee71){return _0x44ee71[_0x970f('0x2c')](_0x258ed8)['then'](function(_0x3e02ba){return _0x3e02ba;});}return null;};}function removeEntity(_0x4ffc5f,_0x213696){return function(_0x24e13a){if(_0x24e13a){return _0x24e13a[_0x970f('0x2d')]()['then'](function(){var _0x3b55dc=_0x24e13a[_0x970f('0x2e')]({'plain':!![]});var _0x537cb9=_0x970f('0x2f');return db[_0x970f('0x30')][_0x970f('0x2d')]({'where':{'type':_0x537cb9,'resourceId':_0x3b55dc['id']}})['then'](function(){return _0x24e13a;});})['then'](function(){_0x4ffc5f[_0x970f('0x21')](0xcc)[_0x970f('0x22')]();});}};}function handleEntityNotFound(_0x309cd3,_0x4dc4fe){return function(_0x4fe9bf){if(!_0x4fe9bf){_0x309cd3['sendStatus'](0x194);}return _0x4fe9bf;};}function handleError(_0x5614da,_0x29922f){_0x29922f=_0x29922f||0x1f4;return function(_0x2641dd){logger['error'](_0x2641dd[_0x970f('0x31')]);if(_0x2641dd['name']){delete _0x2641dd[_0x970f('0x32')];}_0x5614da[_0x970f('0x21')](_0x29922f)[_0x970f('0x33')](_0x2641dd);};}exports[_0x970f('0x34')]=function(_0x2fb189,_0x316804){var _0x38bbd6={},_0x3b2026={},_0x33a6b3={'count':0x0,'rows':[]};var _0x52bba9=_['map'](db[_0x970f('0x35')][_0x970f('0x36')],function(_0xa01420){return{'name':_0xa01420[_0x970f('0x37')],'type':_0xa01420[_0x970f('0x38')][_0x970f('0x39')]};});_0x3b2026[_0x970f('0x3a')]=_[_0x970f('0x3b')](_0x52bba9,_0x970f('0x32'));_0x3b2026[_0x970f('0x3c')]=_['keys'](_0x2fb189['query']);_0x3b2026['filters']=_[_0x970f('0x3d')](_0x3b2026[_0x970f('0x3a')],_0x3b2026[_0x970f('0x3c')]);_0x38bbd6[_0x970f('0x3e')]=_[_0x970f('0x3d')](_0x3b2026[_0x970f('0x3a')],qs[_0x970f('0x3f')](_0x2fb189['query'][_0x970f('0x3f')]));_0x38bbd6[_0x970f('0x3e')]=_0x38bbd6['attributes']['length']?_0x38bbd6[_0x970f('0x3e')]:_0x3b2026[_0x970f('0x3a')];if(!_0x2fb189[_0x970f('0x3c')][_0x970f('0x40')](_0x970f('0x41'))){_0x38bbd6[_0x970f('0x26')]=qs['limit'](_0x2fb189['query'][_0x970f('0x26')]);_0x38bbd6[_0x970f('0x24')]=qs[_0x970f('0x24')](_0x2fb189[_0x970f('0x3c')][_0x970f('0x24')]);}_0x38bbd6[_0x970f('0x42')]=qs[_0x970f('0x43')](_0x2fb189[_0x970f('0x3c')][_0x970f('0x43')]);_0x38bbd6[_0x970f('0x44')]=qs[_0x970f('0x45')](_[_0x970f('0x46')](_0x2fb189[_0x970f('0x3c')],_0x3b2026[_0x970f('0x45')]),_0x52bba9);if(_0x2fb189[_0x970f('0x3c')][_0x970f('0x47')]){_0x38bbd6[_0x970f('0x44')]=_['merge'](_0x38bbd6[_0x970f('0x44')],{'$or':_[_0x970f('0x3b')](_0x52bba9,function(_0x42a567){if(_0x42a567['type']!==_0x970f('0x48')){var _0x1e5ee9={};_0x1e5ee9[_0x42a567[_0x970f('0x32')]]={'$like':'%'+_0x2fb189[_0x970f('0x3c')][_0x970f('0x47')]+'%'};return _0x1e5ee9;}})});}_0x38bbd6=_[_0x970f('0x49')]({},_0x38bbd6,_0x2fb189['options']);var _0x4fa095={'where':_0x38bbd6[_0x970f('0x44')]};return db[_0x970f('0x35')][_0x970f('0x27')](_0x4fa095)[_0x970f('0x4a')](function(_0x3285bd){_0x33a6b3[_0x970f('0x27')]=_0x3285bd;if(_0x2fb189['query']['includeAll']){_0x38bbd6['include']=[{'all':!![]}];}return db[_0x970f('0x35')]['findAll'](_0x38bbd6);})[_0x970f('0x4a')](function(_0x2788ca){_0x33a6b3[_0x970f('0x4b')]=_0x2788ca;return _0x33a6b3;})['then'](respondWithFilteredResult(_0x316804,_0x38bbd6))['catch'](handleError(_0x316804,null));};exports[_0x970f('0x4c')]=function(_0x1a4c2f,_0xca35e6){var _0x2899b9={'raw':![],'where':{'id':_0x1a4c2f[_0x970f('0x4d')]['id']}},_0x491928={};_0x491928[_0x970f('0x3a')]=_[_0x970f('0x4e')](db['Dashboard'][_0x970f('0x36')]);_0x491928[_0x970f('0x3c')]=_[_0x970f('0x4e')](_0x1a4c2f[_0x970f('0x3c')]);_0x491928[_0x970f('0x45')]=_[_0x970f('0x3d')](_0x491928[_0x970f('0x3a')],_0x491928[_0x970f('0x3c')]);_0x2899b9[_0x970f('0x3e')]=_[_0x970f('0x3d')](_0x491928[_0x970f('0x3a')],qs[_0x970f('0x3f')](_0x1a4c2f[_0x970f('0x3c')]['fields']));_0x2899b9[_0x970f('0x3e')]=_0x2899b9[_0x970f('0x3e')][_0x970f('0x4f')]?_0x2899b9[_0x970f('0x3e')]:_0x491928['model'];if(_0x1a4c2f[_0x970f('0x3c')]['includeAll']){_0x2899b9[_0x970f('0x50')]=[{'all':!![]}];}_0x2899b9=_[_0x970f('0x49')]({},_0x2899b9,_0x1a4c2f[_0x970f('0x51')]);return db[_0x970f('0x35')]['find'](_0x2899b9)[_0x970f('0x4a')](handleEntityNotFound(_0xca35e6,null))['then'](respondWithResult(_0xca35e6,null))[_0x970f('0x52')](handleError(_0xca35e6,null));};exports[_0x970f('0x53')]=function(_0x22f051,_0x1dfb6f){return db['Dashboard'][_0x970f('0x53')](_0x22f051[_0x970f('0x54')],{})[_0x970f('0x4a')](function(_0x5a904d){var _0x463d3b=_0x22f051[_0x970f('0x55')]['get']({'plain':!![]});if(!_0x463d3b)throw new Error(_0x970f('0x56'));if(_0x463d3b[_0x970f('0x57')]===_0x970f('0x55')){var _0x2a9b86=_0x5a904d[_0x970f('0x2e')]({'plain':!![]});var _0x51eff6=_0x970f('0x2f');return db[_0x970f('0x58')][_0x970f('0x59')]({'where':{'name':_0x51eff6,'userProfileId':_0x463d3b['userProfileId']},'raw':!![]})['then'](function(_0x55bc9c){if(_0x55bc9c&&_0x55bc9c[_0x970f('0x5a')]===0x0){return db[_0x970f('0x30')][_0x970f('0x53')]({'name':_0x2a9b86[_0x970f('0x32')],'resourceId':_0x2a9b86['id'],'type':_0x55bc9c[_0x970f('0x32')],'sectionId':_0x55bc9c['id']},{})[_0x970f('0x4a')](function(){return _0x5a904d;});}else{return _0x5a904d;}})[_0x970f('0x52')](function(_0x5989cf){logger[_0x970f('0x5b')](_0x970f('0x5c'),_0x5989cf);throw _0x5989cf;});}return _0x5a904d;})[_0x970f('0x4a')](respondWithResult(_0x1dfb6f,0xc9))[_0x970f('0x52')](handleError(_0x1dfb6f,null));};exports[_0x970f('0x5d')]=function(_0x2f3b97,_0x579e90){var _0xe73e8f={'where':{'id':_0x2f3b97[_0x970f('0x4d')]['id']}},_0x4b9b6a={};_0x4b9b6a[_0x970f('0x3a')]=_[_0x970f('0x4e')](db[_0x970f('0x35')]['rawAttributes']);_0xe73e8f[_0x970f('0x3e')]=_[_0x970f('0x3d')](_0x4b9b6a[_0x970f('0x3a')],qs['fields'](_0x2f3b97['query'][_0x970f('0x3f')]));_0xe73e8f[_0x970f('0x3e')]=_0xe73e8f[_0x970f('0x3e')][_0x970f('0x4f')]?_0xe73e8f[_0x970f('0x3e')]:_0x4b9b6a[_0x970f('0x3a')];if(_0x2f3b97[_0x970f('0x3c')][_0x970f('0x5e')]){_0xe73e8f[_0x970f('0x50')]=[{'all':!![]}];}_0xe73e8f=_['merge']({},_0xe73e8f,_0x2f3b97['options']);return db['Dashboard'][_0x970f('0x59')](_0xe73e8f)[_0x970f('0x4a')](handleEntityNotFound(_0x579e90,null))[_0x970f('0x4a')](function(_0x2ed37f){if(_0x2ed37f){var _0x163f55=_0x2ed37f['get']({'plain':!![]});_0x163f55=qs[_0x970f('0x5f')](_0x163f55,['id','createdAt',_0x970f('0x60')]);_0x2f3b97['body']=_[_0x970f('0x5f')](_0x2f3b97[_0x970f('0x54')],['id',_0x970f('0x61'),'updatedAt']);return db[_0x970f('0x35')][_0x970f('0x53')](_[_0x970f('0x49')](_0x163f55,_0x2f3b97[_0x970f('0x54')]),{'include':_0x2f3b97['query']['includeAll']?[{'all':!![]}]:undefined})[_0x970f('0x4a')](function(_0x10d461){var _0x1f81fd=_0x2f3b97[_0x970f('0x55')][_0x970f('0x2e')]({'plain':!![]});if(!_0x1f81fd)throw new Error(_0x970f('0x56'));if(_0x1f81fd[_0x970f('0x57')]===_0x970f('0x55')){var _0x19107d=_0x10d461[_0x970f('0x2e')]({'plain':!![]});var _0x63ab00=_0x970f('0x2f');return db[_0x970f('0x58')][_0x970f('0x59')]({'where':{'name':_0x63ab00,'userProfileId':_0x1f81fd[_0x970f('0x62')]},'raw':!![]})[_0x970f('0x4a')](function(_0x4be3ff){if(_0x4be3ff&&_0x4be3ff[_0x970f('0x5a')]===0x0){return db['UserProfileResource'][_0x970f('0x53')]({'name':_0x19107d[_0x970f('0x32')],'resourceId':_0x19107d['id'],'type':_0x4be3ff[_0x970f('0x32')],'sectionId':_0x4be3ff['id']},{})['then'](function(){return _0x10d461;});}else{return _0x10d461;}})[_0x970f('0x52')](function(_0x47abc7){logger['error'](_0x970f('0x5c'),_0x47abc7);throw _0x47abc7;});}return _0x10d461;});}})[_0x970f('0x4a')](respondWithResult(_0x579e90,0xc9))[_0x970f('0x52')](handleError(_0x579e90,null));};exports[_0x970f('0x2c')]=function(_0x43314c,_0x2c1d2e){if(_0x43314c['body']['id']){delete _0x43314c[_0x970f('0x54')]['id'];}return db[_0x970f('0x35')]['find']({'where':{'id':_0x43314c['params']['id']}})[_0x970f('0x4a')](handleEntityNotFound(_0x2c1d2e,null))[_0x970f('0x4a')](saveUpdates(_0x43314c[_0x970f('0x54')],null))[_0x970f('0x4a')](respondWithResult(_0x2c1d2e,null))[_0x970f('0x52')](handleError(_0x2c1d2e,null));};exports[_0x970f('0x2d')]=function(_0x3e5147,_0x34176c){return db['Dashboard'][_0x970f('0x59')]({'where':{'id':_0x3e5147['params']['id']}})[_0x970f('0x4a')](handleEntityNotFound(_0x34176c,null))[_0x970f('0x4a')](removeEntity(_0x34176c,null))[_0x970f('0x52')](handleError(_0x34176c,null));};function widgetAttributes(_0x562f4e){try{switch(_0x562f4e['type']){case _0x970f('0x63'):return[{'name':'attrUrl','value':_0x562f4e[_0x970f('0x64')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x0]?_0x562f4e[_0x970f('0x65')][0x0][_0x970f('0x66')]:undefined)||_0x970f('0x67')}];case _0x970f('0x68'):return[{'name':_0x970f('0x69'),'value':_0x562f4e[_0x970f('0x69')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x0]?_0x562f4e[_0x970f('0x65')][0x0][_0x970f('0x66')]:undefined)||''}];case _0x970f('0x6a'):return[{'name':'attrHourFormat','value':_0x562f4e[_0x970f('0x6b')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x0]?_0x562f4e[_0x970f('0x65')][0x0][_0x970f('0x66')]:undefined)||'HH:mm:ss'},{'name':_0x970f('0x6c'),'value':_0x562f4e[_0x970f('0x6c')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x1]?_0x562f4e[_0x970f('0x65')][0x1]['value']:undefined)||_0x970f('0x6d')},{'name':_0x970f('0x6e'),'value':_0x562f4e['attrFontSize']||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e['attrs'][0x2]?_0x562f4e[_0x970f('0x65')][0x2][_0x970f('0x66')]:undefined)||0xc}];case _0x970f('0x6f'):return[{'name':'attrMetric','value':_0x562f4e[_0x970f('0x70')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x0]?_0x562f4e[_0x970f('0x65')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x562f4e[_0x970f('0x71')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x1]?_0x562f4e['attrs'][0x1][_0x970f('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x562f4e[_0x970f('0x6e')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e['attrs'][0x2]?_0x562f4e['attrs'][0x2][_0x970f('0x66')]:undefined)||0x14},{'name':_0x970f('0x72'),'value':_0x562f4e[_0x970f('0x72')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e['attrs'][0x3]?_0x562f4e[_0x970f('0x65')][0x3][_0x970f('0x66')]:undefined)||_0x970f('0x73')},{'name':_0x970f('0x74'),'value':_0x562f4e[_0x970f('0x74')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e['attrs'][0x4]?_0x562f4e[_0x970f('0x65')][0x4][_0x970f('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x562f4e[_0x970f('0x75')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x5]?_0x562f4e[_0x970f('0x65')][0x5][_0x970f('0x66')]:undefined)||''},{'name':_0x970f('0x76'),'value':_0x562f4e[_0x970f('0x76')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x6]?_0x562f4e[_0x970f('0x65')][0x6]['value']:undefined)||''},{'name':_0x970f('0x77'),'value':_0x562f4e[_0x970f('0x77')]||(_0x562f4e['attrs']&&_0x562f4e[_0x970f('0x65')][0x7]?_0x562f4e['attrs'][0x7][_0x970f('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x562f4e[_0x970f('0x78')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x8]?_0x562f4e[_0x970f('0x65')][0x8]['value']:undefined)||''},{'name':_0x970f('0x79'),'value':_0x562f4e[_0x970f('0x79')]||(_0x562f4e['attrs']&&_0x562f4e[_0x970f('0x65')][0x9]?_0x562f4e[_0x970f('0x65')][0x9][_0x970f('0x66')]:undefined)||''}];case'multibar-chart':case _0x970f('0x7a'):return[{'name':'attrSerie1','value':_0x562f4e[_0x970f('0x7b')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e['attrs'][0x0]?_0x562f4e['attrs'][0x0]['value']:undefined)||_0x970f('0x7c')},{'name':'attrSerie2','value':_0x562f4e['attrSerie2']||(_0x562f4e['attrs']&&_0x562f4e[_0x970f('0x65')][0x1]?_0x562f4e['attrs'][0x1][_0x970f('0x66')]:undefined)||null},{'name':'attrSerie3','value':_0x562f4e[_0x970f('0x7d')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x2]?_0x562f4e[_0x970f('0x65')][0x2]['value']:undefined)||null},{'name':_0x970f('0x71'),'value':_0x562f4e[_0x970f('0x71')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x3]?_0x562f4e[_0x970f('0x65')][0x3][_0x970f('0x66')]:undefined)||[]},{'name':_0x970f('0x72'),'value':_0x562f4e[_0x970f('0x72')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x4]?_0x562f4e[_0x970f('0x65')][0x4][_0x970f('0x66')]:undefined)||_0x970f('0x73')},{'name':_0x970f('0x74'),'value':_0x562f4e[_0x970f('0x74')]||(_0x562f4e['attrs']&&_0x562f4e[_0x970f('0x65')][0x5]?_0x562f4e['attrs'][0x5]['value']:undefined)||''},{'name':_0x970f('0x75'),'value':_0x562f4e['attrFaxAccounts']||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x6]?_0x562f4e['attrs'][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x562f4e['attrSmsAccounts']||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x7]?_0x562f4e[_0x970f('0x65')][0x7][_0x970f('0x66')]:undefined)||''},{'name':_0x970f('0x77'),'value':_0x562f4e[_0x970f('0x77')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x8]?_0x562f4e[_0x970f('0x65')][0x8][_0x970f('0x66')]:undefined)||''},{'name':_0x970f('0x78'),'value':_0x562f4e[_0x970f('0x78')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x9]?_0x562f4e[_0x970f('0x65')][0x9][_0x970f('0x66')]:undefined)||''},{'name':_0x970f('0x79'),'value':_0x562f4e[_0x970f('0x79')]||(_0x562f4e['attrs']&&_0x562f4e[_0x970f('0x65')][0xa]?_0x562f4e[_0x970f('0x65')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x970f('0x7e'),'type':_0x562f4e[_0x970f('0x7f')]||(_0x562f4e['attrs']&&_0x562f4e[_0x970f('0x65')][0x0]?_0x562f4e[_0x970f('0x65')][0x0]['type']:undefined)||null,'value':_0x562f4e['attrReport']||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e[_0x970f('0x65')][0x0]?_0x562f4e['attrs'][0x0][_0x970f('0x66')]:undefined)||null},{'name':_0x970f('0x80'),'value':_0x562f4e[_0x970f('0x80')]||(_0x562f4e[_0x970f('0x65')]&&_0x562f4e['attrs'][0x1]?_0x562f4e[_0x970f('0x65')][0x1][_0x970f('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x13fdfa){logger[_0x970f('0x5b')](_0x970f('0x81'),JSON[_0x970f('0x82')](_0x13fdfa));return[];}}exports[_0x970f('0x83')]=function(_0x302f75,_0x1dd78d,_0x52ce00){if(_0x302f75[_0x970f('0x54')]['id']){delete _0x302f75['body']['id'];}return db[_0x970f('0x35')]['find']({'where':{'id':_0x302f75[_0x970f('0x4d')]['id']}})[_0x970f('0x4a')](handleEntityNotFound(_0x1dd78d,null))['then'](function(_0x216028){if(_0x216028){_0x302f75[_0x970f('0x54')][_0x970f('0x84')]=_0x216028['id'];_0x302f75[_0x970f('0x54')][_0x970f('0x65')]=widgetAttributes(_0x302f75[_0x970f('0x54')]);return db['DashboardItem'][_0x970f('0x53')](_0x302f75[_0x970f('0x54')]);}})['then'](respondWithResult(_0x1dd78d,null))[_0x970f('0x52')](handleError(_0x1dd78d,null));};exports['getItems']=function(_0x42a7d2,_0x3acaba,_0x200a72){var _0x192ed6={};var _0x118146={};var _0x1bca93;var _0x517328;return db[_0x970f('0x35')][_0x970f('0x85')]({'where':{'id':_0x42a7d2[_0x970f('0x4d')]['id']}})[_0x970f('0x4a')](handleEntityNotFound(_0x3acaba,null))[_0x970f('0x4a')](function(_0x40f2da){if(_0x40f2da){_0x1bca93=_0x40f2da;_0x118146['model']=_[_0x970f('0x4e')](db[_0x970f('0x86')][_0x970f('0x36')]);_0x118146[_0x970f('0x3c')]=_[_0x970f('0x4e')](_0x42a7d2[_0x970f('0x3c')]);_0x118146['filters']=_['intersection'](_0x118146['model'],_0x118146[_0x970f('0x3c')]);_0x192ed6['attributes']=_[_0x970f('0x3d')](_0x118146[_0x970f('0x3a')],qs[_0x970f('0x3f')](_0x42a7d2[_0x970f('0x3c')]['fields']));_0x192ed6['attributes']=_0x192ed6[_0x970f('0x3e')][_0x970f('0x4f')]?_0x192ed6['attributes']:_0x118146[_0x970f('0x3a')];_0x192ed6[_0x970f('0x42')]=qs[_0x970f('0x43')](_0x42a7d2[_0x970f('0x3c')][_0x970f('0x43')]);_0x192ed6[_0x970f('0x44')]=qs[_0x970f('0x45')](_['pick'](_0x42a7d2[_0x970f('0x3c')],_0x118146[_0x970f('0x45')]));if(_0x42a7d2['query']['filter']){_0x192ed6[_0x970f('0x44')]=_[_0x970f('0x49')](_0x192ed6[_0x970f('0x44')],{'$or':_[_0x970f('0x3b')](_0x192ed6[_0x970f('0x3e')],function(_0x4daad3){var _0x4df616={};_0x4df616[_0x4daad3]={'$like':'%'+_0x42a7d2['query']['filter']+'%'};return _0x4df616;})});}_0x192ed6=_[_0x970f('0x49')]({},_0x192ed6,_0x42a7d2[_0x970f('0x51')]);return _0x1bca93['getItems'](_0x192ed6);}})[_0x970f('0x4a')](function(_0x3b7d42){if(_0x3b7d42){_0x517328=_0x3b7d42['length'];if(!_0x42a7d2[_0x970f('0x3c')][_0x970f('0x40')]('nolimit')){_0x192ed6[_0x970f('0x26')]=qs[_0x970f('0x26')](_0x42a7d2[_0x970f('0x3c')][_0x970f('0x26')]);_0x192ed6['offset']=qs[_0x970f('0x24')](_0x42a7d2[_0x970f('0x3c')]['offset']);}return _0x1bca93[_0x970f('0x87')](_0x192ed6);}})[_0x970f('0x4a')](function(_0x249a88){if(_0x249a88){return _0x249a88?{'count':_0x517328,'rows':_0x249a88}:null;}})[_0x970f('0x4a')](respondWithResult(_0x3acaba,null))[_0x970f('0x52')](handleError(_0x3acaba,null));}; \ No newline at end of file +var _0x927e=['web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','role','user','userProfileId','create','length','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3'];(function(_0x463d53,_0x59b94d){var _0x528135=function(_0x4d2d70){while(--_0x4d2d70){_0x463d53['push'](_0x463d53['shift']());}};_0x528135(++_0x59b94d);}(_0x927e,0x8e));var _0xe927=function(_0x5557aa,_0x554f79){_0x5557aa=_0x5557aa-0x0;var _0x4148d6=_0x927e[_0x5557aa];return _0x4148d6;};'use strict';var emlformat=require(_0xe927('0x0'));var rimraf=require(_0xe927('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe927('0x2'));var moment=require('moment');var BPromise=require(_0xe927('0x3'));var Mustache=require(_0xe927('0x4'));var util=require('util');var path=require(_0xe927('0x5'));var sox=require(_0xe927('0x6'));var csv=require(_0xe927('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe927('0x8'));var _=require(_0xe927('0x9'));var squel=require(_0xe927('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe927('0xb'));var toCsv=require(_0xe927('0x7'));var querystring=require(_0xe927('0xc'));var Papa=require(_0xe927('0xd'));var Redis=require(_0xe927('0xe'));var authService=require(_0xe927('0xf'));var qs=require(_0xe927('0x10'));var as=require(_0xe927('0x11'));var hardwareService=require(_0xe927('0x12'));var logger=require(_0xe927('0x13'))('api');var utils=require(_0xe927('0x14'));var config=require(_0xe927('0x15'));var licenseUtil=require(_0xe927('0x16'));var db=require(_0xe927('0x17'))['db'];config[_0xe927('0x18')]=_[_0xe927('0x19')](config[_0xe927('0x18')],{'host':_0xe927('0x1a'),'port':0x18eb});var socket=require(_0xe927('0x1b'))(new Redis(config[_0xe927('0x18')]));require('./dashboard.socket')[_0xe927('0x1c')](socket);function respondWithStatusCode(_0xbb816b,_0x4a1bfa){_0x4a1bfa=_0x4a1bfa||0xcc;return function(_0x54090b){if(_0x54090b){return _0xbb816b[_0xe927('0x1d')](_0x4a1bfa);}return _0xbb816b['status'](_0x4a1bfa)[_0xe927('0x1e')]();};}function respondWithResult(_0x124fa5,_0x4d421c){_0x4d421c=_0x4d421c||0xc8;return function(_0x1fb9ab){if(_0x1fb9ab){return _0x124fa5[_0xe927('0x1f')](_0x4d421c)['json'](_0x1fb9ab);}};}function respondWithFilteredResult(_0x34a5c9,_0x43d2af){return function(_0x484e7e){if(_0x484e7e){var _0x5687d9=typeof _0x43d2af[_0xe927('0x20')]===_0xe927('0x21')&&typeof _0x43d2af['limit']===_0xe927('0x21');var _0xad304b=_0x484e7e[_0xe927('0x22')];var _0x21826f=_0x5687d9?0x0:_0x43d2af['offset'];var _0x103776=_0x5687d9?_0x484e7e[_0xe927('0x22')]:_0x43d2af[_0xe927('0x20')]+_0x43d2af[_0xe927('0x23')];var _0x10a657;if(_0x103776>=_0xad304b){_0x103776=_0xad304b;_0x10a657=0xc8;}else{_0x10a657=0xce;}_0x34a5c9[_0xe927('0x1f')](_0x10a657);return _0x34a5c9[_0xe927('0x24')](_0xe927('0x25'),_0x21826f+'-'+_0x103776+'/'+_0xad304b)[_0xe927('0x26')](_0x484e7e);}return null;};}function patchUpdates(_0x2981a9){return function(_0x48b251){try{jsonpatch[_0xe927('0x27')](_0x48b251,_0x2981a9,!![]);}catch(_0x7b5fa2){return BPromise[_0xe927('0x28')](_0x7b5fa2);}return _0x48b251['save']();};}function saveUpdates(_0x37e237,_0x39f1d2){return function(_0x52df6f){if(_0x52df6f){return _0x52df6f[_0xe927('0x29')](_0x37e237)['then'](function(_0x5d31c4){return _0x5d31c4;});}return null;};}function removeEntity(_0x32445c,_0x5ef58e){return function(_0x5ef048){if(_0x5ef048){return _0x5ef048[_0xe927('0x2a')]()[_0xe927('0x2b')](function(){var _0x8e8a78=_0x5ef048[_0xe927('0x2c')]({'plain':!![]});var _0x5bda63=_0xe927('0x2d');return db[_0xe927('0x2e')][_0xe927('0x2a')]({'where':{'type':_0x5bda63,'resourceId':_0x8e8a78['id']}})[_0xe927('0x2b')](function(){return _0x5ef048;});})[_0xe927('0x2b')](function(){_0x32445c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x246606,_0x4e53d8){return function(_0xd294d){if(!_0xd294d){_0x246606[_0xe927('0x1d')](0x194);}return _0xd294d;};}function handleError(_0x9d190d,_0x48ef4c){_0x48ef4c=_0x48ef4c||0x1f4;return function(_0x412d00){logger['error'](_0x412d00[_0xe927('0x2f')]);if(_0x412d00[_0xe927('0x30')]){delete _0x412d00[_0xe927('0x30')];}_0x9d190d[_0xe927('0x1f')](_0x48ef4c)[_0xe927('0x31')](_0x412d00);};}exports[_0xe927('0x32')]=function(_0x1cb9c7,_0x56a743){var _0x57b4bb={},_0x5ea0c7={},_0x410642={'count':0x0,'rows':[]};var _0x373a92=_[_0xe927('0x33')](db[_0xe927('0x34')]['rawAttributes'],function(_0x2cf5e2){return{'name':_0x2cf5e2['fieldName'],'type':_0x2cf5e2[_0xe927('0x35')][_0xe927('0x36')]};});_0x5ea0c7[_0xe927('0x37')]=_[_0xe927('0x33')](_0x373a92,_0xe927('0x30'));_0x5ea0c7['query']=_[_0xe927('0x38')](_0x1cb9c7[_0xe927('0x39')]);_0x5ea0c7['filters']=_[_0xe927('0x3a')](_0x5ea0c7[_0xe927('0x37')],_0x5ea0c7[_0xe927('0x39')]);_0x57b4bb['attributes']=_[_0xe927('0x3a')](_0x5ea0c7[_0xe927('0x37')],qs['fields'](_0x1cb9c7[_0xe927('0x39')][_0xe927('0x3b')]));_0x57b4bb[_0xe927('0x3c')]=_0x57b4bb[_0xe927('0x3c')]['length']?_0x57b4bb[_0xe927('0x3c')]:_0x5ea0c7[_0xe927('0x37')];if(!_0x1cb9c7[_0xe927('0x39')][_0xe927('0x3d')](_0xe927('0x3e'))){_0x57b4bb['limit']=qs[_0xe927('0x23')](_0x1cb9c7['query'][_0xe927('0x23')]);_0x57b4bb['offset']=qs['offset'](_0x1cb9c7['query'][_0xe927('0x20')]);}_0x57b4bb[_0xe927('0x3f')]=qs[_0xe927('0x40')](_0x1cb9c7[_0xe927('0x39')][_0xe927('0x40')]);_0x57b4bb[_0xe927('0x41')]=qs[_0xe927('0x42')](_[_0xe927('0x43')](_0x1cb9c7[_0xe927('0x39')],_0x5ea0c7[_0xe927('0x42')]),_0x373a92);if(_0x1cb9c7['query'][_0xe927('0x44')]){_0x57b4bb['where']=_[_0xe927('0x45')](_0x57b4bb[_0xe927('0x41')],{'$or':_[_0xe927('0x33')](_0x373a92,function(_0x3b1599){if(_0x3b1599['type']!==_0xe927('0x46')){var _0x283816={};_0x283816[_0x3b1599[_0xe927('0x30')]]={'$like':'%'+_0x1cb9c7[_0xe927('0x39')][_0xe927('0x44')]+'%'};return _0x283816;}})});}_0x57b4bb=_[_0xe927('0x45')]({},_0x57b4bb,_0x1cb9c7[_0xe927('0x47')]);var _0x28e216={'where':_0x57b4bb[_0xe927('0x41')]};return db[_0xe927('0x34')][_0xe927('0x22')](_0x28e216)[_0xe927('0x2b')](function(_0x1e9566){_0x410642[_0xe927('0x22')]=_0x1e9566;if(_0x1cb9c7[_0xe927('0x39')][_0xe927('0x48')]){_0x57b4bb[_0xe927('0x49')]=[{'all':!![]}];}return db[_0xe927('0x34')][_0xe927('0x4a')](_0x57b4bb);})[_0xe927('0x2b')](function(_0x45e6ea){_0x410642[_0xe927('0x4b')]=_0x45e6ea;return _0x410642;})[_0xe927('0x2b')](respondWithFilteredResult(_0x56a743,_0x57b4bb))[_0xe927('0x4c')](handleError(_0x56a743,null));};exports[_0xe927('0x4d')]=function(_0x113661,_0x2760c4){var _0x4d92a2={'raw':![],'where':{'id':_0x113661[_0xe927('0x4e')]['id']}},_0x477fea={};_0x477fea['model']=_[_0xe927('0x38')](db[_0xe927('0x34')][_0xe927('0x4f')]);_0x477fea[_0xe927('0x39')]=_[_0xe927('0x38')](_0x113661[_0xe927('0x39')]);_0x477fea[_0xe927('0x42')]=_[_0xe927('0x3a')](_0x477fea[_0xe927('0x37')],_0x477fea[_0xe927('0x39')]);_0x4d92a2[_0xe927('0x3c')]=_[_0xe927('0x3a')](_0x477fea[_0xe927('0x37')],qs[_0xe927('0x3b')](_0x113661[_0xe927('0x39')][_0xe927('0x3b')]));_0x4d92a2[_0xe927('0x3c')]=_0x4d92a2[_0xe927('0x3c')]['length']?_0x4d92a2[_0xe927('0x3c')]:_0x477fea['model'];if(_0x113661[_0xe927('0x39')]['includeAll']){_0x4d92a2[_0xe927('0x49')]=[{'all':!![]}];}_0x4d92a2=_[_0xe927('0x45')]({},_0x4d92a2,_0x113661[_0xe927('0x47')]);return db[_0xe927('0x34')][_0xe927('0x50')](_0x4d92a2)['then'](handleEntityNotFound(_0x2760c4,null))[_0xe927('0x2b')](respondWithResult(_0x2760c4,null))[_0xe927('0x4c')](handleError(_0x2760c4,null));};exports['create']=function(_0x95b1de,_0x3b9438){return db['Dashboard']['create'](_0x95b1de[_0xe927('0x51')],{})[_0xe927('0x2b')](function(_0x46837e){var _0xca8807=_0x95b1de['user'][_0xe927('0x2c')]({'plain':!![]});if(!_0xca8807)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xca8807[_0xe927('0x52')]===_0xe927('0x53')){var _0xcbe613=_0x46837e[_0xe927('0x2c')]({'plain':!![]});var _0x29b975=_0xe927('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x29b975,'userProfileId':_0xca8807[_0xe927('0x54')]},'raw':!![]})[_0xe927('0x2b')](function(_0x224b03){if(_0x224b03&&_0x224b03['autoAssociation']===0x0){return db[_0xe927('0x2e')][_0xe927('0x55')]({'name':_0xcbe613[_0xe927('0x30')],'resourceId':_0xcbe613['id'],'type':_0x224b03[_0xe927('0x30')],'sectionId':_0x224b03['id']},{})[_0xe927('0x2b')](function(){return _0x46837e;});}else{return _0x46837e;}})[_0xe927('0x4c')](function(_0x2d9dba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d9dba);throw _0x2d9dba;});}return _0x46837e;})[_0xe927('0x2b')](respondWithResult(_0x3b9438,0xc9))[_0xe927('0x4c')](handleError(_0x3b9438,null));};exports['clone']=function(_0x3b0727,_0x5d489c){var _0x536ed8={'where':{'id':_0x3b0727[_0xe927('0x4e')]['id']}},_0x4f486a={};_0x4f486a[_0xe927('0x37')]=_[_0xe927('0x38')](db['Dashboard']['rawAttributes']);_0x536ed8[_0xe927('0x3c')]=_[_0xe927('0x3a')](_0x4f486a[_0xe927('0x37')],qs[_0xe927('0x3b')](_0x3b0727[_0xe927('0x39')][_0xe927('0x3b')]));_0x536ed8[_0xe927('0x3c')]=_0x536ed8[_0xe927('0x3c')][_0xe927('0x56')]?_0x536ed8[_0xe927('0x3c')]:_0x4f486a['model'];if(_0x3b0727['query']['includeAll']){_0x536ed8['include']=[{'all':!![]}];}_0x536ed8=_[_0xe927('0x45')]({},_0x536ed8,_0x3b0727[_0xe927('0x47')]);return db[_0xe927('0x34')][_0xe927('0x50')](_0x536ed8)['then'](handleEntityNotFound(_0x5d489c,null))[_0xe927('0x2b')](function(_0x501fb2){if(_0x501fb2){var _0x5310e7=_0x501fb2['get']({'plain':!![]});_0x5310e7=qs[_0xe927('0x57')](_0x5310e7,['id',_0xe927('0x58'),_0xe927('0x59')]);_0x3b0727[_0xe927('0x51')]=_[_0xe927('0x57')](_0x3b0727[_0xe927('0x51')],['id',_0xe927('0x58'),_0xe927('0x59')]);return db['Dashboard'][_0xe927('0x55')](_[_0xe927('0x45')](_0x5310e7,_0x3b0727[_0xe927('0x51')]),{'include':_0x3b0727[_0xe927('0x39')][_0xe927('0x48')]?[{'all':!![]}]:undefined})[_0xe927('0x2b')](function(_0x1b7197){var _0x519570=_0x3b0727[_0xe927('0x53')]['get']({'plain':!![]});if(!_0x519570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x519570[_0xe927('0x52')]===_0xe927('0x53')){var _0x24d4e7=_0x1b7197[_0xe927('0x2c')]({'plain':!![]});var _0x1eb8ba=_0xe927('0x2d');return db[_0xe927('0x5a')]['find']({'where':{'name':_0x1eb8ba,'userProfileId':_0x519570[_0xe927('0x54')]},'raw':!![]})[_0xe927('0x2b')](function(_0x38c400){if(_0x38c400&&_0x38c400[_0xe927('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x24d4e7[_0xe927('0x30')],'resourceId':_0x24d4e7['id'],'type':_0x38c400[_0xe927('0x30')],'sectionId':_0x38c400['id']},{})[_0xe927('0x2b')](function(){return _0x1b7197;});}else{return _0x1b7197;}})[_0xe927('0x4c')](function(_0xb45096){logger[_0xe927('0x5c')](_0xe927('0x5d'),_0xb45096);throw _0xb45096;});}return _0x1b7197;});}})['then'](respondWithResult(_0x5d489c,0xc9))['catch'](handleError(_0x5d489c,null));};exports[_0xe927('0x29')]=function(_0x41afb9,_0x30d61f){if(_0x41afb9[_0xe927('0x51')]['id']){delete _0x41afb9[_0xe927('0x51')]['id'];}return db[_0xe927('0x34')][_0xe927('0x50')]({'where':{'id':_0x41afb9[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x30d61f,null))['then'](saveUpdates(_0x41afb9['body'],null))[_0xe927('0x2b')](respondWithResult(_0x30d61f,null))[_0xe927('0x4c')](handleError(_0x30d61f,null));};exports['destroy']=function(_0x396286,_0x401b0c){return db[_0xe927('0x34')][_0xe927('0x50')]({'where':{'id':_0x396286[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x401b0c,null))[_0xe927('0x2b')](removeEntity(_0x401b0c,null))['catch'](handleError(_0x401b0c,null));};function widgetAttributes(_0x2bf7ee){try{switch(_0x2bf7ee[_0xe927('0x35')]){case'iframe':return[{'name':_0xe927('0x5e'),'value':_0x2bf7ee['attrUrl']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x60')]:undefined)||_0xe927('0x61')}];case _0xe927('0x62'):return[{'name':_0xe927('0x63'),'value':_0x2bf7ee[_0xe927('0x63')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x60')]:undefined)||''}];case _0xe927('0x64'):return[{'name':'attrHourFormat','value':_0x2bf7ee[_0xe927('0x65')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee[_0xe927('0x5f')][0x0][_0xe927('0x60')]:undefined)||_0xe927('0x66')},{'name':_0xe927('0x67'),'value':_0x2bf7ee[_0xe927('0x67')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||_0xe927('0x68')},{'name':_0xe927('0x69'),'value':_0x2bf7ee[_0xe927('0x69')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x2]?_0x2bf7ee[_0xe927('0x5f')][0x2][_0xe927('0x60')]:undefined)||0xc}];case _0xe927('0x6a'):return[{'name':_0xe927('0x6b'),'value':_0x2bf7ee[_0xe927('0x6b')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee[_0xe927('0x5f')][0x0][_0xe927('0x60')]:undefined)||_0xe927('0x6c')},{'name':_0xe927('0x6d'),'value':_0x2bf7ee[_0xe927('0x6d')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||[]},{'name':_0xe927('0x69'),'value':_0x2bf7ee[_0xe927('0x69')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x2]?_0x2bf7ee[_0xe927('0x5f')][0x2][_0xe927('0x60')]:undefined)||0x14},{'name':_0xe927('0x6e'),'value':_0x2bf7ee[_0xe927('0x6e')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x3]?_0x2bf7ee[_0xe927('0x5f')][0x3][_0xe927('0x60')]:undefined)||_0xe927('0x6f')},{'name':_0xe927('0x70'),'value':_0x2bf7ee[_0xe927('0x70')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x4]?_0x2bf7ee['attrs'][0x4][_0xe927('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bf7ee[_0xe927('0x71')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x5]?_0x2bf7ee[_0xe927('0x5f')][0x5][_0xe927('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bf7ee[_0xe927('0x72')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x6]?_0x2bf7ee['attrs'][0x6][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x73'),'value':_0x2bf7ee['attrOpenchannelAccounts']||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x7]?_0x2bf7ee[_0xe927('0x5f')][0x7]['value']:undefined)||''},{'name':_0xe927('0x74'),'value':_0x2bf7ee[_0xe927('0x74')]||(_0x2bf7ee['attrs']&&_0x2bf7ee['attrs'][0x8]?_0x2bf7ee[_0xe927('0x5f')][0x8][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x75'),'value':_0x2bf7ee[_0xe927('0x75')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x9]?_0x2bf7ee[_0xe927('0x5f')][0x9]['value']:undefined)||''}];case _0xe927('0x76'):case _0xe927('0x77'):return[{'name':'attrSerie1','value':_0x2bf7ee['attrSerie1']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee[_0xe927('0x5f')][0x0]['value']:undefined)||_0xe927('0x6c')},{'name':_0xe927('0x78'),'value':_0x2bf7ee[_0xe927('0x78')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x2bf7ee[_0xe927('0x79')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x2]?_0x2bf7ee['attrs'][0x2][_0xe927('0x60')]:undefined)||null},{'name':_0xe927('0x6d'),'value':_0x2bf7ee[_0xe927('0x6d')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x3]?_0x2bf7ee['attrs'][0x3][_0xe927('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x2bf7ee[_0xe927('0x6e')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x4]?_0x2bf7ee[_0xe927('0x5f')][0x4]['value']:undefined)||_0xe927('0x6f')},{'name':_0xe927('0x70'),'value':_0x2bf7ee[_0xe927('0x70')]||(_0x2bf7ee['attrs']&&_0x2bf7ee[_0xe927('0x5f')][0x5]?_0x2bf7ee[_0xe927('0x5f')][0x5][_0xe927('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bf7ee[_0xe927('0x71')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x6]?_0x2bf7ee[_0xe927('0x5f')][0x6][_0xe927('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bf7ee['attrSmsAccounts']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x7]?_0x2bf7ee['attrs'][0x7][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x73'),'value':_0x2bf7ee[_0xe927('0x73')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x8]?_0x2bf7ee['attrs'][0x8][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x74'),'value':_0x2bf7ee['attrWhatsappAccounts']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee['attrs'][0x9]?_0x2bf7ee['attrs'][0x9][_0xe927('0x60')]:undefined)||''},{'name':_0xe927('0x75'),'value':_0x2bf7ee[_0xe927('0x75')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0xa]?_0x2bf7ee[_0xe927('0x5f')][0xa][_0xe927('0x60')]:undefined)||''}];case _0xe927('0x7a'):return[{'name':'attrReport','type':_0x2bf7ee[_0xe927('0x7b')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x35')]:undefined)||null,'value':_0x2bf7ee[_0xe927('0x7c')]||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x0]?_0x2bf7ee['attrs'][0x0][_0xe927('0x60')]:undefined)||null},{'name':_0xe927('0x7d'),'value':_0x2bf7ee['attrRefresh']||(_0x2bf7ee[_0xe927('0x5f')]&&_0x2bf7ee[_0xe927('0x5f')][0x1]?_0x2bf7ee[_0xe927('0x5f')][0x1][_0xe927('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x284bcf){logger['error'](_0xe927('0x7e'),JSON[_0xe927('0x7f')](_0x284bcf));return[];}}exports['addItem']=function(_0x5d6979,_0x5a69df,_0x2b95f2){if(_0x5d6979[_0xe927('0x51')]['id']){delete _0x5d6979['body']['id'];}return db['Dashboard'][_0xe927('0x50')]({'where':{'id':_0x5d6979[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x5a69df,null))[_0xe927('0x2b')](function(_0x35fb5a){if(_0x35fb5a){_0x5d6979[_0xe927('0x51')][_0xe927('0x80')]=_0x35fb5a['id'];_0x5d6979[_0xe927('0x51')]['attrs']=widgetAttributes(_0x5d6979[_0xe927('0x51')]);return db[_0xe927('0x81')][_0xe927('0x55')](_0x5d6979[_0xe927('0x51')]);}})[_0xe927('0x2b')](respondWithResult(_0x5a69df,null))['catch'](handleError(_0x5a69df,null));};exports[_0xe927('0x82')]=function(_0x6fe879,_0x512705,_0x51bb8e){var _0x144517={};var _0x4ec3bb={};var _0x2e157a;var _0x584cfd;return db[_0xe927('0x34')][_0xe927('0x83')]({'where':{'id':_0x6fe879[_0xe927('0x4e')]['id']}})[_0xe927('0x2b')](handleEntityNotFound(_0x512705,null))['then'](function(_0x9b969a){if(_0x9b969a){_0x2e157a=_0x9b969a;_0x4ec3bb[_0xe927('0x37')]=_['keys'](db[_0xe927('0x81')][_0xe927('0x4f')]);_0x4ec3bb[_0xe927('0x39')]=_[_0xe927('0x38')](_0x6fe879[_0xe927('0x39')]);_0x4ec3bb['filters']=_['intersection'](_0x4ec3bb['model'],_0x4ec3bb[_0xe927('0x39')]);_0x144517['attributes']=_[_0xe927('0x3a')](_0x4ec3bb[_0xe927('0x37')],qs['fields'](_0x6fe879['query'][_0xe927('0x3b')]));_0x144517[_0xe927('0x3c')]=_0x144517[_0xe927('0x3c')][_0xe927('0x56')]?_0x144517[_0xe927('0x3c')]:_0x4ec3bb[_0xe927('0x37')];_0x144517[_0xe927('0x3f')]=qs[_0xe927('0x40')](_0x6fe879[_0xe927('0x39')][_0xe927('0x40')]);_0x144517[_0xe927('0x41')]=qs[_0xe927('0x42')](_[_0xe927('0x43')](_0x6fe879[_0xe927('0x39')],_0x4ec3bb[_0xe927('0x42')]));if(_0x6fe879[_0xe927('0x39')][_0xe927('0x44')]){_0x144517[_0xe927('0x41')]=_[_0xe927('0x45')](_0x144517[_0xe927('0x41')],{'$or':_[_0xe927('0x33')](_0x144517[_0xe927('0x3c')],function(_0x540a7b){var _0x27fa89={};_0x27fa89[_0x540a7b]={'$like':'%'+_0x6fe879[_0xe927('0x39')][_0xe927('0x44')]+'%'};return _0x27fa89;})});}_0x144517=_[_0xe927('0x45')]({},_0x144517,_0x6fe879[_0xe927('0x47')]);return _0x2e157a[_0xe927('0x82')](_0x144517);}})['then'](function(_0x2b1411){if(_0x2b1411){_0x584cfd=_0x2b1411[_0xe927('0x56')];if(!_0x6fe879[_0xe927('0x39')][_0xe927('0x3d')](_0xe927('0x3e'))){_0x144517[_0xe927('0x23')]=qs[_0xe927('0x23')](_0x6fe879[_0xe927('0x39')][_0xe927('0x23')]);_0x144517[_0xe927('0x20')]=qs['offset'](_0x6fe879[_0xe927('0x39')][_0xe927('0x20')]);}return _0x2e157a[_0xe927('0x82')](_0x144517);}})['then'](function(_0x2e0231){if(_0x2e0231){return _0x2e0231?{'count':_0x584cfd,'rows':_0x2e0231}:null;}})[_0xe927('0x2b')](respondWithResult(_0x512705,null))[_0xe927('0x4c')](handleError(_0x512705,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d5b7b07..4fbc661 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 _0x0216=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3f528c,_0x8f825f){var _0x1b088d=function(_0xd34d8b){while(--_0xd34d8b){_0x3f528c['push'](_0x3f528c['shift']());}};_0x1b088d(++_0x8f825f);}(_0x0216,0x149));var _0x6021=function(_0xa4f2f0,_0x4b1401){_0xa4f2f0=_0xa4f2f0-0x0;var _0x521925=_0x0216[_0xa4f2f0];return _0x521925;};'use strict';var EventEmitter=require(_0x6021('0x0'));var Dashboard=require(_0x6021('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6021('0x2')](0x0);var events={'afterCreate':_0x6021('0x3'),'afterUpdate':_0x6021('0x4'),'afterDestroy':_0x6021('0x5')};function emitEvent(_0x52ccc6){return function(_0xf988c7,_0xbfc14a,_0xf5c651){DashboardEvents['emit'](_0x52ccc6+':'+_0xf988c7['id'],_0xf988c7);DashboardEvents[_0x6021('0x6')](_0x52ccc6,_0xf988c7);_0xf5c651(null);};}for(var e in events){if(events[_0x6021('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x6021('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb933=['remove','emit','../../mysqldb','Dashboard','save','update'];(function(_0x2db7c0,_0xe25817){var _0x28b197=function(_0x58306f){while(--_0x58306f){_0x2db7c0['push'](_0x2db7c0['shift']());}};_0x28b197(++_0xe25817);}(_0xb933,0x110));var _0x3b93=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xb933[_0x99868f];return _0x27a71b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x3b93('0x0'))['db'][_0x3b93('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b93('0x2'),'afterUpdate':_0x3b93('0x3'),'afterDestroy':_0x3b93('0x4')};function emitEvent(_0x168653){return function(_0x4f274e,_0x2ed053,_0x3f9e38){DashboardEvents[_0x3b93('0x5')](_0x168653+':'+_0x4f274e['id'],_0x4f274e);DashboardEvents[_0x3b93('0x5')](_0x168653,_0x4f274e);_0x3f9e38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](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 c6c07af..e28ef77 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 _0xe81b=['./dashboard.attributes','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x299819,_0x58a570){var _0x39108b=function(_0x259a98){while(--_0x259a98){_0x299819['push'](_0x299819['shift']());}};_0x39108b(++_0x58a570);}(_0xe81b,0xde));var _0xbe81=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xe81b[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xbe81('0x0'));var util=require(_0xbe81('0x1'));var logger=require('../../config/logger')(_0xbe81('0x2'));var moment=require(_0xbe81('0x3'));var BPromise=require(_0xbe81('0x4'));var rp=require(_0xbe81('0x5'));var fs=require('fs');var path=require(_0xbe81('0x6'));var rimraf=require(_0xbe81('0x7'));var config=require(_0xbe81('0x8'));var attributes=require(_0xbe81('0x9'));module['exports']=function(_0x5766d8,_0x41818b){return _0x5766d8[_0xbe81('0xa')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5ab=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xf5ab,0x16c));var _0xbf5a=function(_0x461538,_0x593096){_0x461538=_0x461538-0x0;var _0x570061=_0xf5ab[_0x461538];return _0x570061;};'use strict';var _=require(_0xbf5a('0x0'));var util=require(_0xbf5a('0x1'));var logger=require(_0xbf5a('0x2'))(_0xbf5a('0x3'));var moment=require(_0xbf5a('0x4'));var BPromise=require(_0xbf5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf5a('0x6'));var rimraf=require(_0xbf5a('0x7'));var config=require(_0xbf5a('0x8'));var attributes=require(_0xbf5a('0x9'));module['exports']=function(_0x45334f,_0x152549){return _0x45334f[_0xbf5a('0xa')](_0xbf5a('0xb'),attributes,{'tableName':_0xbf5a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index d35eae5..c0ebcf9 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 _0x3cd8=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cd8,0x150));var _0x83cd=function(_0x209e12,_0x2ce907){_0x209e12=_0x209e12-0x0;var _0x3f5b89=_0x3cd8[_0x209e12];return _0x3f5b89;};'use strict';var _=require(_0x83cd('0x0'));var util=require(_0x83cd('0x1'));var moment=require(_0x83cd('0x2'));var BPromise=require(_0x83cd('0x3'));var rs=require(_0x83cd('0x4'));var fs=require('fs');var Redis=require(_0x83cd('0x5'));var db=require(_0x83cd('0x6'))['db'];var utils=require(_0x83cd('0x7'));var logger=require('../../config/logger')(_0x83cd('0x8'));var config=require(_0x83cd('0x9'));var jayson=require(_0x83cd('0xa'));var client=jayson[_0x83cd('0xb')][_0x83cd('0xc')]({'port':0x232a});config[_0x83cd('0xd')]=_[_0x83cd('0xe')](config[_0x83cd('0xd')],{'host':_0x83cd('0xf'),'port':0x18eb});var socket=require(_0x83cd('0x10'))(new Redis(config[_0x83cd('0xd')]));require(_0x83cd('0x11'))[_0x83cd('0x12')](socket);function respondWithRpcPromise(_0x2d4adb,_0x39b755,_0xf8f9dd){return new BPromise(function(_0x1f05f1,_0x26b989){return client[_0x83cd('0x13')](_0x2d4adb,_0xf8f9dd)[_0x83cd('0x14')](function(_0x49626a){logger[_0x83cd('0x15')](_0x83cd('0x16'),_0x39b755,_0x83cd('0x17'));logger[_0x83cd('0x18')](_0x83cd('0x19'),_0x39b755,_0x83cd('0x17'),JSON[_0x83cd('0x1a')](_0x49626a));if(_0x49626a[_0x83cd('0x1b')]){if(_0x49626a['error'][_0x83cd('0x1c')]===0x1f4){logger[_0x83cd('0x1b')](_0x83cd('0x16'),_0x39b755,_0x49626a[_0x83cd('0x1b')][_0x83cd('0x1d')]);return _0x26b989(_0x49626a[_0x83cd('0x1b')]['message']);}logger['error'](_0x83cd('0x16'),_0x39b755,_0x49626a[_0x83cd('0x1b')][_0x83cd('0x1d')]);return _0x1f05f1(_0x49626a[_0x83cd('0x1b')][_0x83cd('0x1d')]);}else{logger[_0x83cd('0x15')](_0x83cd('0x16'),_0x39b755,_0x83cd('0x17'));_0x1f05f1(_0x49626a['result'][_0x83cd('0x1d')]);}})['catch'](function(_0x3fe83a){logger[_0x83cd('0x1b')](_0x83cd('0x16'),_0x39b755,_0x3fe83a);_0x26b989(_0x3fe83a);});});} \ No newline at end of file +var _0xa1db=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','Dashboard,\x20%s,\x20%s'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0xa1db,0xb0));var _0xba1d=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0xa1db[_0x1f4b18];return _0xde3957;};'use strict';var _=require(_0xba1d('0x0'));var util=require(_0xba1d('0x1'));var moment=require(_0xba1d('0x2'));var BPromise=require(_0xba1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba1d('0x4'))['db'];var utils=require(_0xba1d('0x5'));var logger=require('../../config/logger')(_0xba1d('0x6'));var config=require(_0xba1d('0x7'));var jayson=require(_0xba1d('0x8'));var client=jayson[_0xba1d('0x9')][_0xba1d('0xa')]({'port':0x232a});config[_0xba1d('0xb')]=_[_0xba1d('0xc')](config[_0xba1d('0xb')],{'host':_0xba1d('0xd'),'port':0x18eb});var socket=require(_0xba1d('0xe'))(new Redis(config[_0xba1d('0xb')]));require(_0xba1d('0xf'))[_0xba1d('0x10')](socket);function respondWithRpcPromise(_0x4e9713,_0x13e642,_0x39bcb4){return new BPromise(function(_0x3548c9,_0x280d91){return client[_0xba1d('0x11')](_0x4e9713,_0x39bcb4)[_0xba1d('0x12')](function(_0x34ac7d){logger[_0xba1d('0x13')]('Dashboard,\x20%s,\x20%s',_0x13e642,_0xba1d('0x14'));logger[_0xba1d('0x15')](_0xba1d('0x16'),_0x13e642,_0xba1d('0x14'),JSON[_0xba1d('0x17')](_0x34ac7d));if(_0x34ac7d['error']){if(_0x34ac7d['error'][_0xba1d('0x18')]===0x1f4){logger[_0xba1d('0x19')](_0xba1d('0x1a'),_0x13e642,_0x34ac7d[_0xba1d('0x19')][_0xba1d('0x1b')]);return _0x280d91(_0x34ac7d[_0xba1d('0x19')]['message']);}logger['error'](_0xba1d('0x1a'),_0x13e642,_0x34ac7d[_0xba1d('0x19')][_0xba1d('0x1b')]);return _0x3548c9(_0x34ac7d['error'][_0xba1d('0x1b')]);}else{logger[_0xba1d('0x13')](_0xba1d('0x1a'),_0x13e642,_0xba1d('0x14'));_0x3548c9(_0x34ac7d[_0xba1d('0x1c')][_0xba1d('0x1b')]);}})['catch'](function(_0x3110c2){logger[_0xba1d('0x19')](_0xba1d('0x1a'),_0x13e642,_0x3110c2);_0x280d91(_0x3110c2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 433e3cb..0ce8db1 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 _0xb969=['dashboard:','./dashboard.events','save','remove','update','emit','register','length'];(function(_0x5e25c7,_0x4457c0){var _0x72f56f=function(_0x577a79){while(--_0x577a79){_0x5e25c7['push'](_0x5e25c7['shift']());}};_0x72f56f(++_0x4457c0);}(_0xb969,0x181));var _0x9b96=function(_0x170ffb,_0x2cd30b){_0x170ffb=_0x170ffb-0x0;var _0x2ba9ee=_0xb969[_0x170ffb];return _0x2ba9ee;};'use strict';var DashboardEvents=require(_0x9b96('0x0'));var events=[_0x9b96('0x1'),_0x9b96('0x2'),_0x9b96('0x3')];function createListener(_0x7cbdca,_0x4e0993){return function(_0x16fcb9){_0x4e0993[_0x9b96('0x4')](_0x7cbdca,_0x16fcb9);};}function removeListener(_0x17981a,_0x5a037e){return function(){DashboardEvents['removeListener'](_0x17981a,_0x5a037e);};}exports[_0x9b96('0x5')]=function(_0x1c7070){for(var _0x31aaf9=0x0,_0x56cd5c=events[_0x9b96('0x6')];_0x31aaf9<_0x56cd5c;_0x31aaf9++){var _0x399ab9=events[_0x31aaf9];var _0x1a4071=createListener(_0x9b96('0x7')+_0x399ab9,_0x1c7070);DashboardEvents['on'](_0x399ab9,_0x1a4071);}}; \ No newline at end of file +var _0x8769=['removeListener','register','dashboard:','save','remove','update','emit'];(function(_0x553c03,_0x3fc9ce){var _0x5d244c=function(_0x1243e5){while(--_0x1243e5){_0x553c03['push'](_0x553c03['shift']());}};_0x5d244c(++_0x3fc9ce);}(_0x8769,0x9d));var _0x9876=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x8769[_0x19b3f9];return _0x18c3f6;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x9876('0x0'),_0x9876('0x1'),_0x9876('0x2')];function createListener(_0x164fe5,_0x3de8f5){return function(_0x1ac9fa){_0x3de8f5[_0x9876('0x3')](_0x164fe5,_0x1ac9fa);};}function removeListener(_0x17c8ae,_0x78ada0){return function(){DashboardEvents[_0x9876('0x4')](_0x17c8ae,_0x78ada0);};}exports[_0x9876('0x5')]=function(_0x6e46ab){for(var _0xb5fdc5=0x0,_0x568ad2=events['length'];_0xb5fdc5<_0x568ad2;_0xb5fdc5++){var _0x3a38b7=events[_0xb5fdc5];var _0x3bb999=createListener(_0x9876('0x6')+_0x3a38b7,_0x6e46ab);DashboardEvents['on'](_0x3a38b7,_0x3bb999);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2644c04..d2a1654 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 _0x6a5b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x204047,_0x2df7af){var _0x5956d2=function(_0x2d32a8){while(--_0x2d32a8){_0x204047['push'](_0x204047['shift']());}};_0x5956d2(++_0x2df7af);}(_0x6a5b,0x1b7));var _0xb6a5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6a5b[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xb6a5('0x0'));var path=require(_0xb6a5('0x1'));var timeout=require(_0xb6a5('0x2'));var express=require(_0xb6a5('0x3'));var router=express[_0xb6a5('0x4')]();var fs_extra=require(_0xb6a5('0x5'));var auth=require(_0xb6a5('0x6'));var interaction=require(_0xb6a5('0x7'));var config=require('../../config/environment');var controller=require(_0xb6a5('0x8'));router[_0xb6a5('0x9')]('/',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xb')]);router[_0xb6a5('0x9')](_0xb6a5('0xc'),auth[_0xb6a5('0xa')](),controller[_0xb6a5('0xd')]);router[_0xb6a5('0x9')](_0xb6a5('0xe'),auth['isAuthenticated'](),controller[_0xb6a5('0xf')]);router[_0xb6a5('0x10')]('/',auth[_0xb6a5('0xa')](),controller[_0xb6a5('0x11')]);router['post'](_0xb6a5('0x12'),auth[_0xb6a5('0xa')](),controller[_0xb6a5('0x13')]);router['post'](_0xb6a5('0xe'),auth[_0xb6a5('0xa')](),controller[_0xb6a5('0x14')]);router[_0xb6a5('0x15')](_0xb6a5('0xc'),auth['isAuthenticated'](),controller[_0xb6a5('0x16')]);router[_0xb6a5('0x17')](_0xb6a5('0xc'),auth[_0xb6a5('0xa')](),controller[_0xb6a5('0x18')]);module[_0xb6a5('0x19')]=router; \ No newline at end of file +var _0x9751=['clone','/:id/items','put','update','delete','destroy','exports','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id','show','get','getItems','post','create','/:id/clone'];(function(_0x4c19cc,_0x24e1c4){var _0x2d9319=function(_0x3e6ec8){while(--_0x3e6ec8){_0x4c19cc['push'](_0x4c19cc['shift']());}};_0x2d9319(++_0x24e1c4);}(_0x9751,0x1d5));var _0x1975=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x9751[_0x4c7892];return _0x2a79c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1975('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1975('0x1')]();var fs_extra=require(_0x1975('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1975('0x3'));var config=require(_0x1975('0x4'));var controller=require(_0x1975('0x5'));router['get']('/',auth[_0x1975('0x6')](),controller[_0x1975('0x7')]);router['get'](_0x1975('0x8'),auth[_0x1975('0x6')](),controller[_0x1975('0x9')]);router[_0x1975('0xa')]('/:id/items',auth[_0x1975('0x6')](),controller[_0x1975('0xb')]);router[_0x1975('0xc')]('/',auth[_0x1975('0x6')](),controller[_0x1975('0xd')]);router[_0x1975('0xc')](_0x1975('0xe'),auth[_0x1975('0x6')](),controller[_0x1975('0xf')]);router[_0x1975('0xc')](_0x1975('0x10'),auth['isAuthenticated'](),controller['addItem']);router[_0x1975('0x11')](_0x1975('0x8'),auth[_0x1975('0x6')](),controller[_0x1975('0x12')]);router[_0x1975('0x13')]('/:id',auth[_0x1975('0x6')](),controller[_0x1975('0x14')]);module[_0x1975('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 5d85b19..0783c17 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 _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x3dc5e1,_0xe6cf18){var _0x442407=function(_0x224cb5){while(--_0x224cb5){_0x3dc5e1['push'](_0x3dc5e1['shift']());}};_0x442407(++_0xe6cf18);}(_0x5d58,0x187));var _0x85d5=function(_0x19575e,_0xedf2af){_0x19575e=_0x19575e-0x0;var _0x2587c2=_0x5d58[_0x19575e];return _0x2587c2;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xba34,0x119));var _0x4ba3=function(_0x6024ae,_0x5c5c6d){_0x6024ae=_0x6024ae-0x0;var _0x565f0f=_0xba34[_0x6024ae];return _0x565f0f;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 4024d9d..9f90b21 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 _0x496e=['intersection','fields','attributes','length','includeAll','include','merge','find','catch','destroy','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','params','model','DashboardItem','query','keys','filters'];(function(_0x57108e,_0x4d572a){var _0x457757=function(_0x37e54c){while(--_0x37e54c){_0x57108e['push'](_0x57108e['shift']());}};_0x457757(++_0x4d572a);}(_0x496e,0x1a0));var _0xe496=function(_0x386d6f,_0x379792){_0x386d6f=_0x386d6f-0x0;var _0x348955=_0x496e[_0x386d6f];return _0x348955;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe496('0x0'));var zipdir=require(_0xe496('0x1'));var jsonpatch=require(_0xe496('0x2'));var rp=require(_0xe496('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe496('0x4'));var path=require('path');var sox=require(_0xe496('0x5'));var csv=require(_0xe496('0x6'));var ejs=require(_0xe496('0x7'));var fs=require('fs');var fs_extra=require(_0xe496('0x8'));var _=require(_0xe496('0x9'));var squel=require(_0xe496('0xa'));var crypto=require(_0xe496('0xb'));var jsforce=require(_0xe496('0xc'));var deskjs=require(_0xe496('0xd'));var toCsv=require(_0xe496('0x6'));var querystring=require(_0xe496('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe496('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe496('0x10'));var hardwareService=require(_0xe496('0x11'));var logger=require(_0xe496('0x12'))(_0xe496('0x13'));var utils=require(_0xe496('0x14'));var config=require(_0xe496('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe496('0x16')]=_[_0xe496('0x17')](config['redis'],{'host':_0xe496('0x18'),'port':0x18eb});var socket=require(_0xe496('0x19'))(new Redis(config[_0xe496('0x16')]));require(_0xe496('0x1a'))['register'](socket);function respondWithStatusCode(_0xfa63a3,_0x487b50){_0x487b50=_0x487b50||0xcc;return function(_0xddb0f){if(_0xddb0f){return _0xfa63a3['sendStatus'](_0x487b50);}return _0xfa63a3[_0xe496('0x1b')](_0x487b50)[_0xe496('0x1c')]();};}function respondWithResult(_0x16adfd,_0x46cc5b){_0x46cc5b=_0x46cc5b||0xc8;return function(_0x5b91a2){if(_0x5b91a2){return _0x16adfd[_0xe496('0x1b')](_0x46cc5b)[_0xe496('0x1d')](_0x5b91a2);}};}function respondWithFilteredResult(_0x5268a2,_0x2733dd){return function(_0x29d07c){if(_0x29d07c){var _0x3d3bd6=typeof _0x2733dd[_0xe496('0x1e')]===_0xe496('0x1f')&&typeof _0x2733dd[_0xe496('0x20')]===_0xe496('0x1f');var _0x360a48=_0x29d07c[_0xe496('0x21')];var _0x1993cd=_0x3d3bd6?0x0:_0x2733dd[_0xe496('0x1e')];var _0x3f6436=_0x3d3bd6?_0x29d07c[_0xe496('0x21')]:_0x2733dd['offset']+_0x2733dd[_0xe496('0x20')];var _0x33a497;if(_0x3f6436>=_0x360a48){_0x3f6436=_0x360a48;_0x33a497=0xc8;}else{_0x33a497=0xce;}_0x5268a2[_0xe496('0x1b')](_0x33a497);return _0x5268a2[_0xe496('0x22')](_0xe496('0x23'),_0x1993cd+'-'+_0x3f6436+'/'+_0x360a48)[_0xe496('0x1d')](_0x29d07c);}return null;};}function patchUpdates(_0x3fb384){return function(_0x2337c7){try{jsonpatch['apply'](_0x2337c7,_0x3fb384,!![]);}catch(_0x1af1da){return BPromise['reject'](_0x1af1da);}return _0x2337c7['save']();};}function saveUpdates(_0x4fc3ce,_0x16c08d){return function(_0x26863e){if(_0x26863e){return _0x26863e[_0xe496('0x24')](_0x4fc3ce)[_0xe496('0x25')](function(_0x541173){return _0x541173;});}return null;};}function removeEntity(_0x3f114d,_0x2d122e){return function(_0x25cd2c){if(_0x25cd2c){return _0x25cd2c['destroy']()[_0xe496('0x25')](function(){_0x3f114d[_0xe496('0x1b')](0xcc)[_0xe496('0x1c')]();});}};}function handleEntityNotFound(_0x57dc9d,_0x4701f0){return function(_0x9eb3ab){if(!_0x9eb3ab){_0x57dc9d[_0xe496('0x26')](0x194);}return _0x9eb3ab;};}function handleError(_0xf736dd,_0x5a1d84){_0x5a1d84=_0x5a1d84||0x1f4;return function(_0x2c6ee6){logger[_0xe496('0x27')](_0x2c6ee6[_0xe496('0x28')]);if(_0x2c6ee6[_0xe496('0x29')]){delete _0x2c6ee6[_0xe496('0x29')];}_0xf736dd[_0xe496('0x1b')](_0x5a1d84)[_0xe496('0x2a')](_0x2c6ee6);};}exports['show']=function(_0x24cc17,_0x3b80f7){var _0x11432d={'raw':![],'where':{'id':_0x24cc17[_0xe496('0x2b')]['id']}},_0x3fa5bc={};_0x3fa5bc[_0xe496('0x2c')]=_['keys'](db[_0xe496('0x2d')]['rawAttributes']);_0x3fa5bc[_0xe496('0x2e')]=_[_0xe496('0x2f')](_0x24cc17[_0xe496('0x2e')]);_0x3fa5bc[_0xe496('0x30')]=_[_0xe496('0x31')](_0x3fa5bc[_0xe496('0x2c')],_0x3fa5bc[_0xe496('0x2e')]);_0x11432d['attributes']=_[_0xe496('0x31')](_0x3fa5bc['model'],qs['fields'](_0x24cc17['query'][_0xe496('0x32')]));_0x11432d[_0xe496('0x33')]=_0x11432d[_0xe496('0x33')][_0xe496('0x34')]?_0x11432d[_0xe496('0x33')]:_0x3fa5bc[_0xe496('0x2c')];if(_0x24cc17[_0xe496('0x2e')][_0xe496('0x35')]){_0x11432d[_0xe496('0x36')]=[{'all':!![]}];}_0x11432d=_[_0xe496('0x37')]({},_0x11432d,_0x24cc17['options']);return db[_0xe496('0x2d')][_0xe496('0x38')](_0x11432d)['then'](handleEntityNotFound(_0x3b80f7,null))['then'](respondWithResult(_0x3b80f7,null))[_0xe496('0x39')](handleError(_0x3b80f7,null));};exports[_0xe496('0x3a')]=function(_0xf5b212,_0x591bee){return db[_0xe496('0x2d')][_0xe496('0x38')]({'where':{'id':_0xf5b212[_0xe496('0x2b')]['id']}})['then'](handleEntityNotFound(_0x591bee,null))[_0xe496('0x25')](removeEntity(_0x591bee,null))[_0xe496('0x39')](handleError(_0x591bee,null));};function widgetAttributes(_0x23fd16){try{switch(_0x23fd16['type']){case _0xe496('0x3b'):return[{'name':_0xe496('0x3c'),'value':_0x23fd16[_0xe496('0x3c')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x0]?_0x23fd16[_0xe496('0x3d')][0x0][_0xe496('0x3e')]:undefined)||_0xe496('0x3f')}];case'custom':return[{'name':_0xe496('0x40'),'value':_0x23fd16[_0xe496('0x40')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x0]?_0x23fd16[_0xe496('0x3d')][0x0]['value']:undefined)||''}];case _0xe496('0x41'):return[{'name':_0xe496('0x42'),'value':_0x23fd16[_0xe496('0x42')]||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0x0]?_0x23fd16[_0xe496('0x3d')][0x0]['value']:undefined)||_0xe496('0x43')},{'name':_0xe496('0x44'),'value':_0x23fd16['attrTimezone']||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0x1]?_0x23fd16['attrs'][0x1][_0xe496('0x3e')]:undefined)||_0xe496('0x45')},{'name':_0xe496('0x46'),'value':_0x23fd16[_0xe496('0x46')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x2]?_0x23fd16[_0xe496('0x3d')][0x2]['value']:undefined)||0xc}];case _0xe496('0x47'):return[{'name':_0xe496('0x48'),'value':_0x23fd16[_0xe496('0x48')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x0]?_0x23fd16['attrs'][0x0][_0xe496('0x3e')]:undefined)||_0xe496('0x49')},{'name':'attrVoiceQueues','value':_0x23fd16[_0xe496('0x4a')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x1]?_0x23fd16['attrs'][0x1][_0xe496('0x3e')]:undefined)||[]},{'name':_0xe496('0x46'),'value':_0x23fd16['attrFontSize']||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x2]?_0x23fd16['attrs'][0x2][_0xe496('0x3e')]:undefined)||0x14},{'name':'attrChannel','value':_0x23fd16[_0xe496('0x4b')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x3]?_0x23fd16[_0xe496('0x3d')][0x3][_0xe496('0x3e')]:undefined)||_0xe496('0x4c')},{'name':'attrEmailAccounts','value':_0x23fd16[_0xe496('0x4d')]||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0x4]?_0x23fd16['attrs'][0x4]['value']:undefined)||''},{'name':_0xe496('0x4e'),'value':_0x23fd16[_0xe496('0x4e')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x5]?_0x23fd16['attrs'][0x5][_0xe496('0x3e')]:undefined)||''},{'name':_0xe496('0x4f'),'value':_0x23fd16[_0xe496('0x4f')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x6]?_0x23fd16[_0xe496('0x3d')][0x6][_0xe496('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x23fd16[_0xe496('0x50')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x7]?_0x23fd16[_0xe496('0x3d')][0x7][_0xe496('0x3e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x23fd16[_0xe496('0x51')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x8]?_0x23fd16[_0xe496('0x3d')][0x8][_0xe496('0x3e')]:undefined)||''},{'name':_0xe496('0x52'),'value':_0x23fd16[_0xe496('0x52')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x9]?_0x23fd16[_0xe496('0x3d')][0x9][_0xe496('0x3e')]:undefined)||''}];case'multibar-chart':case _0xe496('0x53'):return[{'name':'attrSerie1','value':_0x23fd16[_0xe496('0x54')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16['attrs'][0x0]?_0x23fd16[_0xe496('0x3d')][0x0]['value']:undefined)||_0xe496('0x49')},{'name':_0xe496('0x55'),'value':_0x23fd16[_0xe496('0x55')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16['attrs'][0x1]?_0x23fd16[_0xe496('0x3d')][0x1][_0xe496('0x3e')]:undefined)||null},{'name':'attrSerie3','value':_0x23fd16['attrSerie3']||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x2]?_0x23fd16[_0xe496('0x3d')][0x2][_0xe496('0x3e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x23fd16[_0xe496('0x4a')]||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0x3]?_0x23fd16[_0xe496('0x3d')][0x3][_0xe496('0x3e')]:undefined)||[]},{'name':'attrChannel','value':_0x23fd16[_0xe496('0x4b')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x4]?_0x23fd16[_0xe496('0x3d')][0x4][_0xe496('0x3e')]:undefined)||_0xe496('0x4c')},{'name':_0xe496('0x4d'),'value':_0x23fd16['attrEmailAccounts']||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16['attrs'][0x5]?_0x23fd16[_0xe496('0x3d')][0x5][_0xe496('0x3e')]:undefined)||''},{'name':_0xe496('0x4e'),'value':_0x23fd16[_0xe496('0x4e')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16['attrs'][0x6]?_0x23fd16[_0xe496('0x3d')][0x6][_0xe496('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x23fd16[_0xe496('0x4f')]||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0x7]?_0x23fd16[_0xe496('0x3d')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x23fd16[_0xe496('0x50')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x8]?_0x23fd16[_0xe496('0x3d')][0x8]['value']:undefined)||''},{'name':_0xe496('0x51'),'value':_0x23fd16[_0xe496('0x51')]||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0x9]?_0x23fd16[_0xe496('0x3d')][0x9][_0xe496('0x3e')]:undefined)||''},{'name':_0xe496('0x52'),'value':_0x23fd16['attrChatWebsites']||(_0x23fd16['attrs']&&_0x23fd16[_0xe496('0x3d')][0xa]?_0x23fd16['attrs'][0xa][_0xe496('0x3e')]:undefined)||''}];case _0xe496('0x56'):return[{'name':_0xe496('0x57'),'type':_0x23fd16[_0xe496('0x58')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x0]?_0x23fd16[_0xe496('0x3d')][0x0]['type']:undefined)||null,'value':_0x23fd16[_0xe496('0x57')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16[_0xe496('0x3d')][0x0]?_0x23fd16[_0xe496('0x3d')][0x0][_0xe496('0x3e')]:undefined)||null},{'name':_0xe496('0x59'),'value':_0x23fd16[_0xe496('0x59')]||(_0x23fd16[_0xe496('0x3d')]&&_0x23fd16['attrs'][0x1]?_0x23fd16[_0xe496('0x3d')][0x1][_0xe496('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x59585b){logger[_0xe496('0x27')](_0xe496('0x5a'),JSON[_0xe496('0x5b')](_0x59585b));return[];}}exports['create']=function(_0x27c56f,_0x4d867b){if(_0x27c56f[_0xe496('0x5c')]){_0x27c56f[_0xe496('0x5c')]['attrs']=widgetAttributes(_0x27c56f[_0xe496('0x5c')]);}return db[_0xe496('0x2d')]['create'](_0x27c56f[_0xe496('0x5c')],{})[_0xe496('0x25')](respondWithResult(_0x4d867b,0xc9))[_0xe496('0x39')](handleError(_0x4d867b,null));};exports[_0xe496('0x24')]=function(_0x4a365f,_0x2241d1){if(_0x4a365f['body']['id']){delete _0x4a365f[_0xe496('0x5c')]['id'];}_0x4a365f[_0xe496('0x5c')][_0xe496('0x3d')]=widgetAttributes(_0x4a365f[_0xe496('0x5c')]);return db[_0xe496('0x2d')][_0xe496('0x38')]({'where':{'id':_0x4a365f['params']['id']}})['then'](handleEntityNotFound(_0x2241d1,null))[_0xe496('0x25')](saveUpdates(_0x4a365f[_0xe496('0x5c')],null))[_0xe496('0x25')](respondWithResult(_0x2241d1,null))[_0xe496('0x39')](handleError(_0x2241d1,null));}; \ No newline at end of file +var _0x2eb2=['0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','status','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','length','includeAll','include','merge','options','DashboardItem','destroy','find','type','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','value'];(function(_0x1159cc,_0x567178){var _0x210403=function(_0x27c347){while(--_0x27c347){_0x1159cc['push'](_0x1159cc['shift']());}};_0x210403(++_0x567178);}(_0x2eb2,0x19f));var _0x22eb=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2eb2[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x22eb('0x16')]=_[_0x22eb('0x17')](config[_0x22eb('0x16')],{'host':_0x22eb('0x18'),'port':0x18eb});var socket=require(_0x22eb('0x19'))(new Redis(config['redis']));require(_0x22eb('0x1a'))['register'](socket);function respondWithStatusCode(_0x1f5089,_0x55ede8){_0x55ede8=_0x55ede8||0xcc;return function(_0x40c8cb){if(_0x40c8cb){return _0x1f5089[_0x22eb('0x1b')](_0x55ede8);}return _0x1f5089['status'](_0x55ede8)['end']();};}function respondWithResult(_0x4bc29a,_0x2ed8a7){_0x2ed8a7=_0x2ed8a7||0xc8;return function(_0x5245fe){if(_0x5245fe){return _0x4bc29a['status'](_0x2ed8a7)[_0x22eb('0x1c')](_0x5245fe);}};}function respondWithFilteredResult(_0x4d9a71,_0x4d9b09){return function(_0xb7a73a){if(_0xb7a73a){var _0x2a55e4=typeof _0x4d9b09[_0x22eb('0x1d')]===_0x22eb('0x1e')&&typeof _0x4d9b09[_0x22eb('0x1f')]==='undefined';var _0x4182a8=_0xb7a73a[_0x22eb('0x20')];var _0x10d182=_0x2a55e4?0x0:_0x4d9b09[_0x22eb('0x1d')];var _0x36be50=_0x2a55e4?_0xb7a73a['count']:_0x4d9b09[_0x22eb('0x1d')]+_0x4d9b09[_0x22eb('0x1f')];var _0x2fc36e;if(_0x36be50>=_0x4182a8){_0x36be50=_0x4182a8;_0x2fc36e=0xc8;}else{_0x2fc36e=0xce;}_0x4d9a71['status'](_0x2fc36e);return _0x4d9a71['set'](_0x22eb('0x21'),_0x10d182+'-'+_0x36be50+'/'+_0x4182a8)[_0x22eb('0x1c')](_0xb7a73a);}return null;};}function patchUpdates(_0x434ecb){return function(_0x44639a){try{jsonpatch[_0x22eb('0x22')](_0x44639a,_0x434ecb,!![]);}catch(_0x3e8c1c){return BPromise[_0x22eb('0x23')](_0x3e8c1c);}return _0x44639a['save']();};}function saveUpdates(_0x2e8f7c,_0x11edbd){return function(_0x3ffa9e){if(_0x3ffa9e){return _0x3ffa9e[_0x22eb('0x24')](_0x2e8f7c)[_0x22eb('0x25')](function(_0x4da252){return _0x4da252;});}return null;};}function removeEntity(_0x12c133,_0x6f8ff3){return function(_0x2f3b39){if(_0x2f3b39){return _0x2f3b39['destroy']()[_0x22eb('0x25')](function(){_0x12c133[_0x22eb('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a4b6,_0x222ef3){return function(_0x1e3015){if(!_0x1e3015){_0x32a4b6[_0x22eb('0x1b')](0x194);}return _0x1e3015;};}function handleError(_0x2da5c6,_0x4f4f56){_0x4f4f56=_0x4f4f56||0x1f4;return function(_0x49dd59){logger[_0x22eb('0x27')](_0x49dd59[_0x22eb('0x28')]);if(_0x49dd59[_0x22eb('0x29')]){delete _0x49dd59[_0x22eb('0x29')];}_0x2da5c6[_0x22eb('0x26')](_0x4f4f56)[_0x22eb('0x2a')](_0x49dd59);};}exports[_0x22eb('0x2b')]=function(_0x13814f,_0x382784){var _0x39cec1={'raw':![],'where':{'id':_0x13814f[_0x22eb('0x2c')]['id']}},_0x24e9dc={};_0x24e9dc['model']=_[_0x22eb('0x2d')](db['DashboardItem'][_0x22eb('0x2e')]);_0x24e9dc[_0x22eb('0x2f')]=_[_0x22eb('0x2d')](_0x13814f[_0x22eb('0x2f')]);_0x24e9dc[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x24e9dc[_0x22eb('0x32')],_0x24e9dc[_0x22eb('0x2f')]);_0x39cec1[_0x22eb('0x33')]=_[_0x22eb('0x31')](_0x24e9dc['model'],qs['fields'](_0x13814f[_0x22eb('0x2f')]['fields']));_0x39cec1['attributes']=_0x39cec1[_0x22eb('0x33')][_0x22eb('0x34')]?_0x39cec1[_0x22eb('0x33')]:_0x24e9dc[_0x22eb('0x32')];if(_0x13814f[_0x22eb('0x2f')][_0x22eb('0x35')]){_0x39cec1[_0x22eb('0x36')]=[{'all':!![]}];}_0x39cec1=_[_0x22eb('0x37')]({},_0x39cec1,_0x13814f[_0x22eb('0x38')]);return db[_0x22eb('0x39')]['find'](_0x39cec1)[_0x22eb('0x25')](handleEntityNotFound(_0x382784,null))['then'](respondWithResult(_0x382784,null))['catch'](handleError(_0x382784,null));};exports[_0x22eb('0x3a')]=function(_0x2b5cb5,_0x48e47e){return db[_0x22eb('0x39')][_0x22eb('0x3b')]({'where':{'id':_0x2b5cb5[_0x22eb('0x2c')]['id']}})[_0x22eb('0x25')](handleEntityNotFound(_0x48e47e,null))[_0x22eb('0x25')](removeEntity(_0x48e47e,null))['catch'](handleError(_0x48e47e,null));};function widgetAttributes(_0x25f140){try{switch(_0x25f140[_0x22eb('0x3c')]){case'iframe':return[{'name':_0x22eb('0x3d'),'value':_0x25f140[_0x22eb('0x3d')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||'https://'}];case _0x22eb('0x3f'):return[{'name':_0x22eb('0x40'),'value':_0x25f140['attrPath']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||''}];case _0x22eb('0x41'):return[{'name':_0x22eb('0x42'),'value':_0x25f140[_0x22eb('0x42')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||_0x22eb('0x43')},{'name':_0x22eb('0x44'),'value':_0x25f140['attrTimezone']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||_0x22eb('0x46')},{'name':_0x22eb('0x47'),'value':_0x25f140[_0x22eb('0x47')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x2]?_0x25f140[_0x22eb('0x3e')][0x2][_0x22eb('0x45')]:undefined)||0xc}];case _0x22eb('0x48'):return[{'name':_0x22eb('0x49'),'value':_0x25f140[_0x22eb('0x49')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0][_0x22eb('0x45')]:undefined)||'total'},{'name':_0x22eb('0x4a'),'value':_0x25f140[_0x22eb('0x4a')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x25f140['attrFontSize']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x2]?_0x25f140['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x22eb('0x4b'),'value':_0x25f140[_0x22eb('0x4b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x3]?_0x25f140[_0x22eb('0x3e')][0x3][_0x22eb('0x45')]:undefined)||_0x22eb('0x4c')},{'name':_0x22eb('0x4d'),'value':_0x25f140['attrEmailAccounts']||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x4]?_0x25f140['attrs'][0x4][_0x22eb('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x25f140[_0x22eb('0x4e')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x5]?_0x25f140['attrs'][0x5]['value']:undefined)||''},{'name':_0x22eb('0x4f'),'value':_0x25f140['attrSmsAccounts']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x6]?_0x25f140['attrs'][0x6][_0x22eb('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x25f140[_0x22eb('0x50')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x7]?_0x25f140[_0x22eb('0x3e')][0x7][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x51'),'value':_0x25f140[_0x22eb('0x51')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x8]?_0x25f140['attrs'][0x8][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x52'),'value':_0x25f140['attrChatWebsites']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x9]?_0x25f140[_0x22eb('0x3e')][0x9][_0x22eb('0x45')]:undefined)||''}];case'multibar-chart':case _0x22eb('0x53'):return[{'name':_0x22eb('0x54'),'value':_0x25f140[_0x22eb('0x54')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140[_0x22eb('0x3e')][0x0]['value']:undefined)||_0x22eb('0x55')},{'name':'attrSerie2','value':_0x25f140[_0x22eb('0x56')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||null},{'name':_0x22eb('0x57'),'value':_0x25f140[_0x22eb('0x57')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x2]?_0x25f140[_0x22eb('0x3e')][0x2][_0x22eb('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x25f140[_0x22eb('0x4a')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x3]?_0x25f140[_0x22eb('0x3e')][0x3][_0x22eb('0x45')]:undefined)||[]},{'name':_0x22eb('0x4b'),'value':_0x25f140[_0x22eb('0x4b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x4]?_0x25f140[_0x22eb('0x3e')][0x4][_0x22eb('0x45')]:undefined)||'voice'},{'name':_0x22eb('0x4d'),'value':_0x25f140[_0x22eb('0x4d')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x5]?_0x25f140[_0x22eb('0x3e')][0x5][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x4e'),'value':_0x25f140[_0x22eb('0x4e')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x6]?_0x25f140[_0x22eb('0x3e')][0x6][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x4f'),'value':_0x25f140[_0x22eb('0x4f')]||(_0x25f140['attrs']&&_0x25f140['attrs'][0x7]?_0x25f140[_0x22eb('0x3e')][0x7][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x50'),'value':_0x25f140[_0x22eb('0x50')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x8]?_0x25f140[_0x22eb('0x3e')][0x8][_0x22eb('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x25f140['attrWhatsappAccounts']||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0x9]?_0x25f140[_0x22eb('0x3e')][0x9][_0x22eb('0x45')]:undefined)||''},{'name':_0x22eb('0x52'),'value':_0x25f140[_0x22eb('0x52')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140[_0x22eb('0x3e')][0xa]?_0x25f140[_0x22eb('0x3e')][0xa][_0x22eb('0x45')]:undefined)||''}];case _0x22eb('0x58'):return[{'name':_0x22eb('0x59'),'type':_0x25f140[_0x22eb('0x5a')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x0]?_0x25f140[_0x22eb('0x3e')][0x0][_0x22eb('0x3c')]:undefined)||null,'value':_0x25f140[_0x22eb('0x59')]||(_0x25f140['attrs']&&_0x25f140[_0x22eb('0x3e')][0x0]?_0x25f140['attrs'][0x0][_0x22eb('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x25f140[_0x22eb('0x5b')]||(_0x25f140[_0x22eb('0x3e')]&&_0x25f140['attrs'][0x1]?_0x25f140[_0x22eb('0x3e')][0x1][_0x22eb('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x538bc0){logger['error'](_0x22eb('0x5c'),JSON[_0x22eb('0x5d')](_0x538bc0));return[];}}exports[_0x22eb('0x5e')]=function(_0x344064,_0x3468ca){if(_0x344064[_0x22eb('0x5f')]){_0x344064['body'][_0x22eb('0x3e')]=widgetAttributes(_0x344064['body']);}return db['DashboardItem'][_0x22eb('0x5e')](_0x344064[_0x22eb('0x5f')],{})[_0x22eb('0x25')](respondWithResult(_0x3468ca,0xc9))[_0x22eb('0x60')](handleError(_0x3468ca,null));};exports[_0x22eb('0x24')]=function(_0x797700,_0x400dbe){if(_0x797700[_0x22eb('0x5f')]['id']){delete _0x797700['body']['id'];}_0x797700['body'][_0x22eb('0x3e')]=widgetAttributes(_0x797700[_0x22eb('0x5f')]);return db['DashboardItem'][_0x22eb('0x3b')]({'where':{'id':_0x797700[_0x22eb('0x2c')]['id']}})[_0x22eb('0x25')](handleEntityNotFound(_0x400dbe,null))[_0x22eb('0x25')](saveUpdates(_0x797700[_0x22eb('0x5f')],null))[_0x22eb('0x25')](respondWithResult(_0x400dbe,null))['catch'](handleError(_0x400dbe,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 31f4940..ce14a5b 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 _0x0f25=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1edaf0,_0x1526f9){var _0x4feedc=function(_0x5c6ddf){while(--_0x5c6ddf){_0x1edaf0['push'](_0x1edaf0['shift']());}};_0x4feedc(++_0x1526f9);}(_0x0f25,0xdf));var _0x50f2=function(_0x42d89c,_0x4cc3c0){_0x42d89c=_0x42d89c-0x0;var _0x302b3e=_0x0f25[_0x42d89c];return _0x302b3e;};'use strict';var EventEmitter=require(_0x50f2('0x0'));var DashboardItem=require(_0x50f2('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x50f2('0x2')](0x0);var events={'afterCreate':_0x50f2('0x3'),'afterUpdate':_0x50f2('0x4'),'afterDestroy':_0x50f2('0x5')};function emitEvent(_0x55e11b){return function(_0x4f72a0,_0x19e72e,_0x101e24){DashboardItemEvents[_0x50f2('0x6')](_0x55e11b+':'+_0x4f72a0['id'],_0x4f72a0);DashboardItemEvents[_0x50f2('0x6')](_0x55e11b,_0x4f72a0);_0x101e24(null);};}for(var e in events){if(events[_0x50f2('0x7')](e)){var event=events[e];DashboardItem[_0x50f2('0x8')](e,emitEvent(event));}}module[_0x50f2('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x52f3=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0xb53f83,_0x39d004){var _0x52cf5=function(_0x1f3fb6){while(--_0x1f3fb6){_0xb53f83['push'](_0xb53f83['shift']());}};_0x52cf5(++_0x39d004);}(_0x52f3,0xba));var _0x352f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x52f3[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x352f('0x0'))['db'][_0x352f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x352f('0x2')](0x0);var events={'afterCreate':_0x352f('0x3'),'afterUpdate':_0x352f('0x4'),'afterDestroy':_0x352f('0x5')};function emitEvent(_0xc89823){return function(_0x117888,_0x46444e,_0x364034){DashboardItemEvents['emit'](_0xc89823+':'+_0x117888['id'],_0x117888);DashboardItemEvents[_0x352f('0x6')](_0xc89823,_0x117888);_0x364034(null);};}for(var e in events){if(events[_0x352f('0x7')](e)){var event=events[e];DashboardItem[_0x352f('0x8')](e,emitEvent(event));}}module[_0x352f('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1f585ad..19f2fda 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 _0xc415=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1b35e4,_0x3ae239){var _0x232d90=function(_0xe0ee5f){while(--_0xe0ee5f){_0x1b35e4['push'](_0x1b35e4['shift']());}};_0x232d90(++_0x3ae239);}(_0xc415,0xd8));var _0x5c41=function(_0x28ff67,_0x499edc){_0x28ff67=_0x28ff67-0x0;var _0x40affa=_0xc415[_0x28ff67];return _0x40affa;};'use strict';var _=require(_0x5c41('0x0'));var util=require(_0x5c41('0x1'));var logger=require(_0x5c41('0x2'))(_0x5c41('0x3'));var moment=require('moment');var BPromise=require(_0x5c41('0x4'));var rp=require(_0x5c41('0x5'));var fs=require('fs');var path=require(_0x5c41('0x6'));var rimraf=require(_0x5c41('0x7'));var config=require(_0x5c41('0x8'));var attributes=require(_0x5c41('0x9'));module[_0x5c41('0xa')]=function(_0x102ea1,_0x379812){return _0x102ea1[_0x5c41('0xb')](_0x5c41('0xc'),attributes,{'tableName':_0x5c41('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c48=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x3c48,0x152));var _0x83c4=function(_0x1e76a8,_0x49cccc){_0x1e76a8=_0x1e76a8-0x0;var _0x56c79a=_0x3c48[_0x1e76a8];return _0x56c79a;};'use strict';var _=require(_0x83c4('0x0'));var util=require(_0x83c4('0x1'));var logger=require(_0x83c4('0x2'))(_0x83c4('0x3'));var moment=require(_0x83c4('0x4'));var BPromise=require(_0x83c4('0x5'));var rp=require(_0x83c4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x83c4('0x7'));var attributes=require(_0x83c4('0x8'));module[_0x83c4('0x9')]=function(_0xff4c6c,_0x19805e){return _0xff4c6c['define'](_0x83c4('0xa'),attributes,{'tableName':_0x83c4('0xb'),'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 0bc24f8..632b4b7 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 _0x0653=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x0653,0xe1));var _0x3065=function(_0x5e68d2,_0x2372c9){_0x5e68d2=_0x5e68d2-0x0;var _0x35375f=_0x0653[_0x5e68d2];return _0x35375f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3065('0x0'));var fs=require('fs');var Redis=require(_0x3065('0x1'));var db=require(_0x3065('0x2'))['db'];var utils=require(_0x3065('0x3'));var logger=require(_0x3065('0x4'))(_0x3065('0x5'));var config=require(_0x3065('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3065('0x7')]({'port':0x232a});config[_0x3065('0x8')]=_[_0x3065('0x9')](config[_0x3065('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3065('0xa'))(new Redis(config[_0x3065('0x8')]));require(_0x3065('0xb'))[_0x3065('0xc')](socket);function respondWithRpcPromise(_0x24e1b1,_0x119781,_0x469023){return new BPromise(function(_0x39c1cc,_0x54edf5){return client[_0x3065('0xd')](_0x24e1b1,_0x469023)[_0x3065('0xe')](function(_0x6dcafc){logger['info'](_0x3065('0xf'),_0x119781,_0x3065('0x10'));logger[_0x3065('0x11')](_0x3065('0x12'),_0x119781,_0x3065('0x10'),JSON[_0x3065('0x13')](_0x6dcafc));if(_0x6dcafc[_0x3065('0x14')]){if(_0x6dcafc['error'][_0x3065('0x15')]===0x1f4){logger['error'](_0x3065('0xf'),_0x119781,_0x6dcafc['error'][_0x3065('0x16')]);return _0x54edf5(_0x6dcafc[_0x3065('0x14')][_0x3065('0x16')]);}logger[_0x3065('0x14')](_0x3065('0xf'),_0x119781,_0x6dcafc[_0x3065('0x14')]['message']);return _0x39c1cc(_0x6dcafc[_0x3065('0x14')][_0x3065('0x16')]);}else{logger[_0x3065('0x17')](_0x3065('0xf'),_0x119781,_0x3065('0x10'));_0x39c1cc(_0x6dcafc[_0x3065('0x18')]['message']);}})['catch'](function(_0x1ae506){logger[_0x3065('0x14')](_0x3065('0xf'),_0x119781,_0x1ae506);_0x54edf5(_0x1ae506);});});} \ No newline at end of file +var _0x35aa=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x1cebd3,_0x18e5f7){var _0x4a51eb=function(_0x56fee9){while(--_0x56fee9){_0x1cebd3['push'](_0x1cebd3['shift']());}};_0x4a51eb(++_0x18e5f7);}(_0x35aa,0xf5));var _0xa35a=function(_0x2d7e09,_0x16be83){_0x2d7e09=_0x2d7e09-0x0;var _0x1ba707=_0x35aa[_0x2d7e09];return _0x1ba707;};'use strict';var _=require(_0xa35a('0x0'));var util=require(_0xa35a('0x1'));var moment=require(_0xa35a('0x2'));var BPromise=require(_0xa35a('0x3'));var rs=require(_0xa35a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa35a('0x5'))['db'];var utils=require(_0xa35a('0x6'));var logger=require(_0xa35a('0x7'))(_0xa35a('0x8'));var config=require(_0xa35a('0x9'));var jayson=require(_0xa35a('0xa'));var client=jayson[_0xa35a('0xb')][_0xa35a('0xc')]({'port':0x232a});config[_0xa35a('0xd')]=_['defaults'](config[_0xa35a('0xd')],{'host':_0xa35a('0xe'),'port':0x18eb});var socket=require(_0xa35a('0xf'))(new Redis(config[_0xa35a('0xd')]));require(_0xa35a('0x10'))[_0xa35a('0x11')](socket);function respondWithRpcPromise(_0x39de9c,_0x32e3c3,_0x31e204){return new BPromise(function(_0x2254bd,_0x37f7b6){return client[_0xa35a('0x12')](_0x39de9c,_0x31e204)[_0xa35a('0x13')](function(_0x47ca5b){logger[_0xa35a('0x14')]('DashboardItem,\x20%s,\x20%s',_0x32e3c3,_0xa35a('0x15'));logger[_0xa35a('0x16')](_0xa35a('0x17'),_0x32e3c3,_0xa35a('0x15'),JSON[_0xa35a('0x18')](_0x47ca5b));if(_0x47ca5b[_0xa35a('0x19')]){if(_0x47ca5b[_0xa35a('0x19')][_0xa35a('0x1a')]===0x1f4){logger['error'](_0xa35a('0x1b'),_0x32e3c3,_0x47ca5b['error'][_0xa35a('0x1c')]);return _0x37f7b6(_0x47ca5b[_0xa35a('0x19')]['message']);}logger[_0xa35a('0x19')](_0xa35a('0x1b'),_0x32e3c3,_0x47ca5b[_0xa35a('0x19')]['message']);return _0x2254bd(_0x47ca5b[_0xa35a('0x19')][_0xa35a('0x1c')]);}else{logger[_0xa35a('0x14')]('DashboardItem,\x20%s,\x20%s',_0x32e3c3,'request\x20sent');_0x2254bd(_0x47ca5b[_0xa35a('0x1d')][_0xa35a('0x1c')]);}})[_0xa35a('0x1e')](function(_0x5b136b){logger[_0xa35a('0x19')](_0xa35a('0x1b'),_0x32e3c3,_0x5b136b);_0x37f7b6(_0x5b136b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4d473fd..464bbe3 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 _0x393a=['dashboardItem:','update','register','length'];(function(_0x140645,_0xaffb2c){var _0x3dd1f7=function(_0x12eb5d){while(--_0x12eb5d){_0x140645['push'](_0x140645['shift']());}};_0x3dd1f7(++_0xaffb2c);}(_0x393a,0x121));var _0xa393=function(_0x1a6c7f,_0x5aee3f){_0x1a6c7f=_0x1a6c7f-0x0;var _0x1d378d=_0x393a[_0x1a6c7f];return _0x1d378d;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0xa393('0x0')];function createListener(_0x46283c,_0x3d3a55){return function(_0x5e6f41){_0x3d3a55['emit'](_0x46283c,_0x5e6f41);};}function removeListener(_0xa3d77b,_0x190340){return function(){DashboardItemEvents['removeListener'](_0xa3d77b,_0x190340);};}exports[_0xa393('0x1')]=function(_0xad9d13){for(var _0x18bce5=0x0,_0x53b7eb=events[_0xa393('0x2')];_0x18bce5<_0x53b7eb;_0x18bce5++){var _0x13fcf0=events[_0x18bce5];var _0x4a3629=createListener(_0xa393('0x3')+_0x13fcf0,_0xad9d13);DashboardItemEvents['on'](_0x13fcf0,_0x4a3629);}}; \ No newline at end of file +var _0xee31=['register','length','dashboardItem:','./dashboardItem.events','save','removeListener'];(function(_0x4946f9,_0x4694e3){var _0x7d8ec1=function(_0x550b4e){while(--_0x550b4e){_0x4946f9['push'](_0x4946f9['shift']());}};_0x7d8ec1(++_0x4694e3);}(_0xee31,0x189));var _0x1ee3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xee31[_0x57b54c];return _0x59cc19;};'use strict';var DashboardItemEvents=require(_0x1ee3('0x0'));var events=[_0x1ee3('0x1'),'remove','update'];function createListener(_0x573c09,_0x440563){return function(_0x351b62){_0x440563['emit'](_0x573c09,_0x351b62);};}function removeListener(_0x507a6a,_0x33c1ae){return function(){DashboardItemEvents[_0x1ee3('0x2')](_0x507a6a,_0x33c1ae);};}exports[_0x1ee3('0x3')]=function(_0x43ddb0){for(var _0x52f12a=0x0,_0x160eba=events[_0x1ee3('0x4')];_0x52f12a<_0x160eba;_0x52f12a++){var _0x1945ad=events[_0x52f12a];var _0x3ca334=createListener(_0x1ee3('0x5')+_0x1945ad,_0x43ddb0);DashboardItemEvents['on'](_0x1945ad,_0x3ca334);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1216488..7ac91e8 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 _0xa5c3=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','post','create','put','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x6d30bc,_0x35cc13){var _0x1933b3=function(_0x469b98){while(--_0x469b98){_0x6d30bc['push'](_0x6d30bc['shift']());}};_0x1933b3(++_0x35cc13);}(_0xa5c3,0x12f));var _0x3a5c=function(_0x6bea9d,_0xba51cb){_0x6bea9d=_0x6bea9d-0x0;var _0x1eedd1=_0xa5c3[_0x6bea9d];return _0x1eedd1;};'use strict';var multer=require(_0x3a5c('0x0'));var util=require('util');var path=require(_0x3a5c('0x1'));var timeout=require(_0x3a5c('0x2'));var express=require(_0x3a5c('0x3'));var router=express[_0x3a5c('0x4')]();var fs_extra=require(_0x3a5c('0x5'));var auth=require(_0x3a5c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a5c('0x7'));var controller=require(_0x3a5c('0x8'));router[_0x3a5c('0x9')](_0x3a5c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3a5c('0xb')]('/',auth['isAuthenticated'](),controller[_0x3a5c('0xc')]);router[_0x3a5c('0xd')]('/:id',auth[_0x3a5c('0xe')](),controller[_0x3a5c('0xf')]);router[_0x3a5c('0x10')](_0x3a5c('0xa'),auth[_0x3a5c('0xe')](),controller[_0x3a5c('0x11')]);module[_0x3a5c('0x12')]=router; \ No newline at end of file +var _0x8e6f=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x141a3b,_0x45b0a3){var _0x2585be=function(_0x335c75){while(--_0x335c75){_0x141a3b['push'](_0x141a3b['shift']());}};_0x2585be(++_0x45b0a3);}(_0x8e6f,0x100));var _0xf8e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e6f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf8e6('0x0'));var util=require('util');var path=require(_0xf8e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8e6('0x2'));var router=express['Router']();var fs_extra=require(_0xf8e6('0x3'));var auth=require(_0xf8e6('0x4'));var interaction=require(_0xf8e6('0x5'));var config=require(_0xf8e6('0x6'));var controller=require(_0xf8e6('0x7'));router[_0xf8e6('0x8')](_0xf8e6('0x9'),auth[_0xf8e6('0xa')](),controller[_0xf8e6('0xb')]);router[_0xf8e6('0xc')]('/',auth[_0xf8e6('0xa')](),controller[_0xf8e6('0xd')]);router[_0xf8e6('0xe')](_0xf8e6('0x9'),auth[_0xf8e6('0xa')](),controller[_0xf8e6('0xf')]);router[_0xf8e6('0x10')](_0xf8e6('0x9'),auth['isAuthenticated'](),controller[_0xf8e6('0x11')]);module[_0xf8e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 82f822a..0b39e9e 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 _0x4e42=['first','second','sequelize','STRING','ENUM'];(function(_0x3096d6,_0x2ba58a){var _0x32c39d=function(_0x117b00){while(--_0x117b00){_0x3096d6['push'](_0x3096d6['shift']());}};_0x32c39d(++_0x2ba58a);}(_0x4e42,0x13d));var _0x24e4=function(_0x160e3c,_0x50f7cb){_0x160e3c=_0x160e3c-0x0;var _0x4aaf9c=_0x4e42[_0x160e3c];return _0x4aaf9c;};'use strict';var Sequelize=require(_0x24e4('0x0'));module['exports']={'name':{'type':Sequelize[_0x24e4('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x24e4('0x2')](_0x24e4('0x3'),_0x24e4('0x4'),'third'),'allowNull':![],'defaultValue':_0x24e4('0x3')},'description':{'type':Sequelize[_0x24e4('0x1')]}}; \ No newline at end of file +var _0xe34d=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x3d83fb,_0x33908e){var _0x4891a5=function(_0x4cbbc6){while(--_0x4cbbc6){_0x3d83fb['push'](_0x3d83fb['shift']());}};_0x4891a5(++_0x33908e);}(_0xe34d,0x65));var _0xde34=function(_0xe0c178,_0xe313ee){_0xe0c178=_0xe0c178-0x0;var _0x4839a1=_0xe34d[_0xe0c178];return _0x4839a1;};'use strict';var Sequelize=require(_0xde34('0x0'));module[_0xde34('0x1')]={'name':{'type':Sequelize[_0xde34('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xde34('0x3')](_0xde34('0x4'),_0xde34('0x5'),_0xde34('0x6')),'allowNull':![],'defaultValue':_0xde34('0x4')},'description':{'type':Sequelize[_0xde34('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 355afcd..fe87d6a 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 _0x603f=['findAll','rows','catch','show','params','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x175acf,_0x21a1ed){var _0x3a13e=function(_0x152144){while(--_0x152144){_0x175acf['push'](_0x175acf['shift']());}};_0x3a13e(++_0x21a1ed);}(_0x603f,0x65));var _0xf603=function(_0x7a8ef,_0xa86119){_0x7a8ef=_0x7a8ef-0x0;var _0x4a69ba=_0x603f[_0x7a8ef];return _0x4a69ba;};'use strict';var emlformat=require(_0xf603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf603('0x1'));var jsonpatch=require(_0xf603('0x2'));var rp=require(_0xf603('0x3'));var moment=require('moment');var BPromise=require(_0xf603('0x4'));var Mustache=require(_0xf603('0x5'));var util=require('util');var path=require(_0xf603('0x6'));var sox=require(_0xf603('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf603('0x8'));var _=require(_0xf603('0x9'));var squel=require(_0xf603('0xa'));var crypto=require(_0xf603('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf603('0xc'));var toCsv=require(_0xf603('0xd'));var querystring=require('querystring');var Papa=require(_0xf603('0xe'));var Redis=require(_0xf603('0xf'));var authService=require(_0xf603('0x10'));var qs=require(_0xf603('0x11'));var as=require(_0xf603('0x12'));var hardwareService=require(_0xf603('0x13'));var logger=require(_0xf603('0x14'))(_0xf603('0x15'));var utils=require(_0xf603('0x16'));var config=require(_0xf603('0x17'));var licenseUtil=require(_0xf603('0x18'));var db=require(_0xf603('0x19'))['db'];function respondWithStatusCode(_0xfc3f21,_0x2e86b6){_0x2e86b6=_0x2e86b6||0xcc;return function(_0x1961d4){if(_0x1961d4){return _0xfc3f21[_0xf603('0x1a')](_0x2e86b6);}return _0xfc3f21[_0xf603('0x1b')](_0x2e86b6)['end']();};}function respondWithResult(_0x277a96,_0x274bfb){_0x274bfb=_0x274bfb||0xc8;return function(_0x200478){if(_0x200478){return _0x277a96[_0xf603('0x1b')](_0x274bfb)[_0xf603('0x1c')](_0x200478);}};}function respondWithFilteredResult(_0x550b07,_0x2364ba){return function(_0x2934b5){if(_0x2934b5){var _0x3a2bb8=typeof _0x2364ba[_0xf603('0x1d')]===_0xf603('0x1e')&&typeof _0x2364ba['limit']===_0xf603('0x1e');var _0x4a9caa=_0x2934b5[_0xf603('0x1f')];var _0x56340f=_0x3a2bb8?0x0:_0x2364ba[_0xf603('0x1d')];var _0x33a0af=_0x3a2bb8?_0x2934b5[_0xf603('0x1f')]:_0x2364ba[_0xf603('0x1d')]+_0x2364ba[_0xf603('0x20')];var _0x1f785b;if(_0x33a0af>=_0x4a9caa){_0x33a0af=_0x4a9caa;_0x1f785b=0xc8;}else{_0x1f785b=0xce;}_0x550b07[_0xf603('0x1b')](_0x1f785b);return _0x550b07[_0xf603('0x21')]('Content-Range',_0x56340f+'-'+_0x33a0af+'/'+_0x4a9caa)['json'](_0x2934b5);}return null;};}function patchUpdates(_0x5be48e){return function(_0x503e1b){try{jsonpatch['apply'](_0x503e1b,_0x5be48e,!![]);}catch(_0x16511e){return BPromise[_0xf603('0x22')](_0x16511e);}return _0x503e1b[_0xf603('0x23')]();};}function saveUpdates(_0x2174e6,_0x3221b3){return function(_0x5284dc){if(_0x5284dc){return _0x5284dc['update'](_0x2174e6)[_0xf603('0x24')](function(_0x5bbbad){return _0x5bbbad;});}return null;};}function removeEntity(_0x25f35b,_0x1afcad){return function(_0x14d7ce){if(_0x14d7ce){return _0x14d7ce[_0xf603('0x25')]()[_0xf603('0x24')](function(){var _0x8e9a44=_0x14d7ce['get']({'plain':!![]});var _0x20e46d=_0xf603('0x26');return db[_0xf603('0x27')][_0xf603('0x25')]({'where':{'type':_0x20e46d,'resourceId':_0x8e9a44['id']}})[_0xf603('0x24')](function(){return _0x14d7ce;});})['then'](function(){_0x25f35b[_0xf603('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3ffb,_0x36ff53){return function(_0x38e265){if(!_0x38e265){_0x1f3ffb['sendStatus'](0x194);}return _0x38e265;};}function handleError(_0x4541af,_0x52702f){_0x52702f=_0x52702f||0x1f4;return function(_0x1f69dd){logger[_0xf603('0x28')](_0x1f69dd[_0xf603('0x29')]);if(_0x1f69dd[_0xf603('0x2a')]){delete _0x1f69dd['name'];}_0x4541af[_0xf603('0x1b')](_0x52702f)[_0xf603('0x2b')](_0x1f69dd);};}exports[_0xf603('0x2c')]=function(_0x32bf4d,_0x13576a){var _0x5f3045={},_0x36a06a={},_0x3564fd={'count':0x0,'rows':[]};var _0x34197d=_[_0xf603('0x2d')](db[_0xf603('0x2e')][_0xf603('0x2f')],function(_0x368ace){return{'name':_0x368ace['fieldName'],'type':_0x368ace[_0xf603('0x30')][_0xf603('0x31')]};});_0x36a06a['model']=_[_0xf603('0x2d')](_0x34197d,_0xf603('0x2a'));_0x36a06a[_0xf603('0x32')]=_[_0xf603('0x33')](_0x32bf4d[_0xf603('0x32')]);_0x36a06a[_0xf603('0x34')]=_[_0xf603('0x35')](_0x36a06a['model'],_0x36a06a['query']);_0x5f3045['attributes']=_[_0xf603('0x35')](_0x36a06a[_0xf603('0x36')],qs['fields'](_0x32bf4d[_0xf603('0x32')][_0xf603('0x37')]));_0x5f3045['attributes']=_0x5f3045[_0xf603('0x38')][_0xf603('0x39')]?_0x5f3045[_0xf603('0x38')]:_0x36a06a[_0xf603('0x36')];if(!_0x32bf4d[_0xf603('0x32')][_0xf603('0x3a')]('nolimit')){_0x5f3045[_0xf603('0x20')]=qs[_0xf603('0x20')](_0x32bf4d['query'][_0xf603('0x20')]);_0x5f3045[_0xf603('0x1d')]=qs[_0xf603('0x1d')](_0x32bf4d['query'][_0xf603('0x1d')]);}_0x5f3045[_0xf603('0x3b')]=qs['sort'](_0x32bf4d[_0xf603('0x32')][_0xf603('0x3c')]);_0x5f3045['where']=qs[_0xf603('0x34')](_[_0xf603('0x3d')](_0x32bf4d[_0xf603('0x32')],_0x36a06a[_0xf603('0x34')]),_0x34197d);if(_0x32bf4d[_0xf603('0x32')][_0xf603('0x3e')]){_0x5f3045['where']=_['merge'](_0x5f3045['where'],{'$or':_['map'](_0x34197d,function(_0x109ee8){if(_0x109ee8['type']!==_0xf603('0x3f')){var _0x35da30={};_0x35da30[_0x109ee8[_0xf603('0x2a')]]={'$like':'%'+_0x32bf4d[_0xf603('0x32')][_0xf603('0x3e')]+'%'};return _0x35da30;}})});}_0x5f3045=_['merge']({},_0x5f3045,_0x32bf4d[_0xf603('0x40')]);var _0x2b45b8={'where':_0x5f3045['where']};return db[_0xf603('0x2e')][_0xf603('0x1f')](_0x2b45b8)[_0xf603('0x24')](function(_0x48891d){_0x3564fd[_0xf603('0x1f')]=_0x48891d;if(_0x32bf4d[_0xf603('0x32')][_0xf603('0x41')]){_0x5f3045[_0xf603('0x42')]=[{'all':!![]}];}return db['Disposition'][_0xf603('0x43')](_0x5f3045);})[_0xf603('0x24')](function(_0x3735be){_0x3564fd[_0xf603('0x44')]=_0x3735be;return _0x3564fd;})[_0xf603('0x24')](respondWithFilteredResult(_0x13576a,_0x5f3045))[_0xf603('0x45')](handleError(_0x13576a,null));};exports[_0xf603('0x46')]=function(_0x56803b,_0x43eaca){var _0x2633fd={'raw':!![],'where':{'id':_0x56803b[_0xf603('0x47')]['id']}},_0x9aa337={};_0x9aa337[_0xf603('0x36')]=_[_0xf603('0x33')](db[_0xf603('0x2e')][_0xf603('0x2f')]);_0x9aa337['query']=_[_0xf603('0x33')](_0x56803b['query']);_0x9aa337['filters']=_[_0xf603('0x35')](_0x9aa337[_0xf603('0x36')],_0x9aa337[_0xf603('0x32')]);_0x2633fd[_0xf603('0x38')]=_[_0xf603('0x35')](_0x9aa337['model'],qs[_0xf603('0x37')](_0x56803b[_0xf603('0x32')][_0xf603('0x37')]));_0x2633fd[_0xf603('0x38')]=_0x2633fd[_0xf603('0x38')][_0xf603('0x39')]?_0x2633fd[_0xf603('0x38')]:_0x9aa337[_0xf603('0x36')];if(_0x56803b[_0xf603('0x32')][_0xf603('0x41')]){_0x2633fd['include']=[{'all':!![]}];}_0x2633fd=_[_0xf603('0x48')]({},_0x2633fd,_0x56803b['options']);return db[_0xf603('0x2e')]['find'](_0x2633fd)['then'](handleEntityNotFound(_0x43eaca,null))[_0xf603('0x24')](respondWithResult(_0x43eaca,null))[_0xf603('0x45')](handleError(_0x43eaca,null));};exports[_0xf603('0x49')]=function(_0xdbf2de,_0x1d8cc9){return db[_0xf603('0x2e')][_0xf603('0x49')](_0xdbf2de[_0xf603('0x4a')],{})[_0xf603('0x24')](function(_0x1c8c98){var _0x3e352c=_0xdbf2de[_0xf603('0x4b')][_0xf603('0x4c')]({'plain':!![]});if(!_0x3e352c)throw new Error(_0xf603('0x4d'));if(_0x3e352c[_0xf603('0x4e')]===_0xf603('0x4b')){var _0x1c9e65=_0x1c8c98['get']({'plain':!![]});var _0x5bada9=_0xf603('0x26');return db[_0xf603('0x4f')][_0xf603('0x50')]({'where':{'name':_0x5bada9,'userProfileId':_0x3e352c[_0xf603('0x51')]},'raw':!![]})['then'](function(_0x1f8609){if(_0x1f8609&&_0x1f8609['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1c9e65[_0xf603('0x2a')],'resourceId':_0x1c9e65['id'],'type':_0x1f8609[_0xf603('0x2a')],'sectionId':_0x1f8609['id']},{})['then'](function(){return _0x1c8c98;});}else{return _0x1c8c98;}})[_0xf603('0x45')](function(_0x21dd9d){logger[_0xf603('0x28')](_0xf603('0x52'),_0x21dd9d);throw _0x21dd9d;});}return _0x1c8c98;})[_0xf603('0x24')](respondWithResult(_0x1d8cc9,0xc9))['catch'](handleError(_0x1d8cc9,null));};exports[_0xf603('0x53')]=function(_0x232c60,_0x267360){if(_0x232c60['body']['id']){delete _0x232c60[_0xf603('0x4a')]['id'];}return db[_0xf603('0x2e')][_0xf603('0x50')]({'where':{'id':_0x232c60['params']['id']}})['then'](handleEntityNotFound(_0x267360,null))['then'](saveUpdates(_0x232c60[_0xf603('0x4a')],null))[_0xf603('0x24')](respondWithResult(_0x267360,null))['catch'](handleError(_0x267360,null));};exports[_0xf603('0x25')]=function(_0x631c4e,_0x17edad){return db[_0xf603('0x2e')][_0xf603('0x50')]({'where':{'id':_0x631c4e[_0xf603('0x47')]['id']}})[_0xf603('0x24')](handleEntityNotFound(_0x17edad,null))[_0xf603('0x24')](removeEntity(_0x17edad,null))['catch'](handleError(_0x17edad,null));}; \ No newline at end of file +var _0xecb2=['sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','Dispositions','UserProfileResource','destroy','end','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','fast-json-patch','bluebird','mustache','util','path'];(function(_0x840016,_0x3325c6){var _0x34ba16=function(_0x3d12a0){while(--_0x3d12a0){_0x840016['push'](_0x840016['shift']());}};_0x34ba16(++_0x3325c6);}(_0xecb2,0xf6));var _0x2ecb=function(_0x4ae710,_0x16c191){_0x4ae710=_0x4ae710-0x0;var _0xa2758e=_0xecb2[_0x4ae710];return _0xa2758e;};'use strict';var emlformat=require(_0x2ecb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ecb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ecb('0x2'));var Mustache=require(_0x2ecb('0x3'));var util=require(_0x2ecb('0x4'));var path=require(_0x2ecb('0x5'));var sox=require(_0x2ecb('0x6'));var csv=require(_0x2ecb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ecb('0x8'));var crypto=require(_0x2ecb('0x9'));var jsforce=require(_0x2ecb('0xa'));var deskjs=require(_0x2ecb('0xb'));var toCsv=require(_0x2ecb('0x7'));var querystring=require('querystring');var Papa=require(_0x2ecb('0xc'));var Redis=require(_0x2ecb('0xd'));var authService=require(_0x2ecb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2ecb('0xf'));var hardwareService=require(_0x2ecb('0x10'));var logger=require(_0x2ecb('0x11'))(_0x2ecb('0x12'));var utils=require(_0x2ecb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2ecb('0x14'));var db=require(_0x2ecb('0x15'))['db'];function respondWithStatusCode(_0x3d74b3,_0x29cb3d){_0x29cb3d=_0x29cb3d||0xcc;return function(_0x59568c){if(_0x59568c){return _0x3d74b3[_0x2ecb('0x16')](_0x29cb3d);}return _0x3d74b3[_0x2ecb('0x17')](_0x29cb3d)['end']();};}function respondWithResult(_0x10bc58,_0x234741){_0x234741=_0x234741||0xc8;return function(_0x48505e){if(_0x48505e){return _0x10bc58[_0x2ecb('0x17')](_0x234741)[_0x2ecb('0x18')](_0x48505e);}};}function respondWithFilteredResult(_0x121f29,_0x3fda3b){return function(_0xe429aa){if(_0xe429aa){var _0x37ea40=typeof _0x3fda3b[_0x2ecb('0x19')]===_0x2ecb('0x1a')&&typeof _0x3fda3b[_0x2ecb('0x1b')]==='undefined';var _0x1c3e62=_0xe429aa[_0x2ecb('0x1c')];var _0x5a1d41=_0x37ea40?0x0:_0x3fda3b[_0x2ecb('0x19')];var _0x4c17cf=_0x37ea40?_0xe429aa[_0x2ecb('0x1c')]:_0x3fda3b[_0x2ecb('0x19')]+_0x3fda3b[_0x2ecb('0x1b')];var _0x3101fa;if(_0x4c17cf>=_0x1c3e62){_0x4c17cf=_0x1c3e62;_0x3101fa=0xc8;}else{_0x3101fa=0xce;}_0x121f29[_0x2ecb('0x17')](_0x3101fa);return _0x121f29[_0x2ecb('0x1d')](_0x2ecb('0x1e'),_0x5a1d41+'-'+_0x4c17cf+'/'+_0x1c3e62)['json'](_0xe429aa);}return null;};}function patchUpdates(_0x8ff004){return function(_0x3aaaae){try{jsonpatch[_0x2ecb('0x1f')](_0x3aaaae,_0x8ff004,!![]);}catch(_0x4c8330){return BPromise[_0x2ecb('0x20')](_0x4c8330);}return _0x3aaaae[_0x2ecb('0x21')]();};}function saveUpdates(_0x4e3d3c,_0x5b9d50){return function(_0x2db610){if(_0x2db610){return _0x2db610['update'](_0x4e3d3c)[_0x2ecb('0x22')](function(_0x2a1834){return _0x2a1834;});}return null;};}function removeEntity(_0xba8379,_0x296ae0){return function(_0x1ff315){if(_0x1ff315){return _0x1ff315['destroy']()['then'](function(){var _0x2e38ee=_0x1ff315['get']({'plain':!![]});var _0x3fa13f=_0x2ecb('0x23');return db[_0x2ecb('0x24')][_0x2ecb('0x25')]({'where':{'type':_0x3fa13f,'resourceId':_0x2e38ee['id']}})[_0x2ecb('0x22')](function(){return _0x1ff315;});})[_0x2ecb('0x22')](function(){_0xba8379[_0x2ecb('0x17')](0xcc)[_0x2ecb('0x26')]();});}};}function handleEntityNotFound(_0x28ee7a,_0x1e2df4){return function(_0x32e88a){if(!_0x32e88a){_0x28ee7a[_0x2ecb('0x16')](0x194);}return _0x32e88a;};}function handleError(_0x45c0ac,_0x211e0f){_0x211e0f=_0x211e0f||0x1f4;return function(_0x75c8cb){logger[_0x2ecb('0x27')](_0x75c8cb[_0x2ecb('0x28')]);if(_0x75c8cb[_0x2ecb('0x29')]){delete _0x75c8cb[_0x2ecb('0x29')];}_0x45c0ac[_0x2ecb('0x17')](_0x211e0f)[_0x2ecb('0x2a')](_0x75c8cb);};}exports[_0x2ecb('0x2b')]=function(_0x4cfa56,_0x52f9f4){var _0x354734={},_0x3c97d1={},_0x8fad28={'count':0x0,'rows':[]};var _0x323328=_['map'](db[_0x2ecb('0x2c')][_0x2ecb('0x2d')],function(_0x3142b0){return{'name':_0x3142b0[_0x2ecb('0x2e')],'type':_0x3142b0[_0x2ecb('0x2f')][_0x2ecb('0x30')]};});_0x3c97d1['model']=_[_0x2ecb('0x31')](_0x323328,'name');_0x3c97d1[_0x2ecb('0x32')]=_[_0x2ecb('0x33')](_0x4cfa56[_0x2ecb('0x32')]);_0x3c97d1[_0x2ecb('0x34')]=_[_0x2ecb('0x35')](_0x3c97d1[_0x2ecb('0x36')],_0x3c97d1[_0x2ecb('0x32')]);_0x354734[_0x2ecb('0x37')]=_[_0x2ecb('0x35')](_0x3c97d1['model'],qs[_0x2ecb('0x38')](_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x38')]));_0x354734['attributes']=_0x354734[_0x2ecb('0x37')][_0x2ecb('0x39')]?_0x354734[_0x2ecb('0x37')]:_0x3c97d1['model'];if(!_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x3a')](_0x2ecb('0x3b'))){_0x354734[_0x2ecb('0x1b')]=qs[_0x2ecb('0x1b')](_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x1b')]);_0x354734[_0x2ecb('0x19')]=qs[_0x2ecb('0x19')](_0x4cfa56[_0x2ecb('0x32')]['offset']);}_0x354734[_0x2ecb('0x3c')]=qs['sort'](_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x3d')]);_0x354734[_0x2ecb('0x3e')]=qs[_0x2ecb('0x34')](_[_0x2ecb('0x3f')](_0x4cfa56[_0x2ecb('0x32')],_0x3c97d1['filters']),_0x323328);if(_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x40')]){_0x354734[_0x2ecb('0x3e')]=_[_0x2ecb('0x41')](_0x354734[_0x2ecb('0x3e')],{'$or':_[_0x2ecb('0x31')](_0x323328,function(_0x36f308){if(_0x36f308[_0x2ecb('0x2f')]!==_0x2ecb('0x42')){var _0x443bfe={};_0x443bfe[_0x36f308[_0x2ecb('0x29')]]={'$like':'%'+_0x4cfa56[_0x2ecb('0x32')][_0x2ecb('0x40')]+'%'};return _0x443bfe;}})});}_0x354734=_['merge']({},_0x354734,_0x4cfa56[_0x2ecb('0x43')]);var _0x5944a0={'where':_0x354734['where']};return db[_0x2ecb('0x2c')][_0x2ecb('0x1c')](_0x5944a0)[_0x2ecb('0x22')](function(_0x818b70){_0x8fad28['count']=_0x818b70;if(_0x4cfa56['query']['includeAll']){_0x354734[_0x2ecb('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x2ecb('0x45')](_0x354734);})[_0x2ecb('0x22')](function(_0x312b35){_0x8fad28[_0x2ecb('0x46')]=_0x312b35;return _0x8fad28;})[_0x2ecb('0x22')](respondWithFilteredResult(_0x52f9f4,_0x354734))[_0x2ecb('0x47')](handleError(_0x52f9f4,null));};exports[_0x2ecb('0x48')]=function(_0xfcdbbb,_0x35001f){var _0x227c25={'raw':!![],'where':{'id':_0xfcdbbb[_0x2ecb('0x49')]['id']}},_0xaa3890={};_0xaa3890['model']=_[_0x2ecb('0x33')](db[_0x2ecb('0x2c')]['rawAttributes']);_0xaa3890[_0x2ecb('0x32')]=_[_0x2ecb('0x33')](_0xfcdbbb[_0x2ecb('0x32')]);_0xaa3890['filters']=_['intersection'](_0xaa3890[_0x2ecb('0x36')],_0xaa3890[_0x2ecb('0x32')]);_0x227c25[_0x2ecb('0x37')]=_[_0x2ecb('0x35')](_0xaa3890['model'],qs[_0x2ecb('0x38')](_0xfcdbbb[_0x2ecb('0x32')][_0x2ecb('0x38')]));_0x227c25[_0x2ecb('0x37')]=_0x227c25[_0x2ecb('0x37')]['length']?_0x227c25[_0x2ecb('0x37')]:_0xaa3890[_0x2ecb('0x36')];if(_0xfcdbbb[_0x2ecb('0x32')][_0x2ecb('0x4a')]){_0x227c25['include']=[{'all':!![]}];}_0x227c25=_[_0x2ecb('0x41')]({},_0x227c25,_0xfcdbbb['options']);return db[_0x2ecb('0x2c')][_0x2ecb('0x4b')](_0x227c25)[_0x2ecb('0x22')](handleEntityNotFound(_0x35001f,null))['then'](respondWithResult(_0x35001f,null))[_0x2ecb('0x47')](handleError(_0x35001f,null));};exports[_0x2ecb('0x4c')]=function(_0x5f5350,_0x3afd6d){return db[_0x2ecb('0x2c')]['create'](_0x5f5350['body'],{})[_0x2ecb('0x22')](function(_0x177ce2){var _0x3f5dd3=_0x5f5350['user'][_0x2ecb('0x4d')]({'plain':!![]});if(!_0x3f5dd3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f5dd3['role']===_0x2ecb('0x4e')){var _0x273286=_0x177ce2[_0x2ecb('0x4d')]({'plain':!![]});var _0x4d9f59=_0x2ecb('0x23');return db['UserProfileSection'][_0x2ecb('0x4b')]({'where':{'name':_0x4d9f59,'userProfileId':_0x3f5dd3[_0x2ecb('0x4f')]},'raw':!![]})[_0x2ecb('0x22')](function(_0x1f8a45){if(_0x1f8a45&&_0x1f8a45[_0x2ecb('0x50')]===0x0){return db['UserProfileResource'][_0x2ecb('0x4c')]({'name':_0x273286['name'],'resourceId':_0x273286['id'],'type':_0x1f8a45['name'],'sectionId':_0x1f8a45['id']},{})[_0x2ecb('0x22')](function(){return _0x177ce2;});}else{return _0x177ce2;}})[_0x2ecb('0x47')](function(_0x32af90){logger[_0x2ecb('0x27')](_0x2ecb('0x51'),_0x32af90);throw _0x32af90;});}return _0x177ce2;})[_0x2ecb('0x22')](respondWithResult(_0x3afd6d,0xc9))[_0x2ecb('0x47')](handleError(_0x3afd6d,null));};exports[_0x2ecb('0x52')]=function(_0x2d4c33,_0x68917f){if(_0x2d4c33[_0x2ecb('0x53')]['id']){delete _0x2d4c33[_0x2ecb('0x53')]['id'];}return db['Disposition'][_0x2ecb('0x4b')]({'where':{'id':_0x2d4c33[_0x2ecb('0x49')]['id']}})[_0x2ecb('0x22')](handleEntityNotFound(_0x68917f,null))[_0x2ecb('0x22')](saveUpdates(_0x2d4c33['body'],null))[_0x2ecb('0x22')](respondWithResult(_0x68917f,null))[_0x2ecb('0x47')](handleError(_0x68917f,null));};exports[_0x2ecb('0x25')]=function(_0x5f4586,_0x4b18b1){return db['Disposition'][_0x2ecb('0x4b')]({'where':{'id':_0x5f4586[_0x2ecb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b18b1,null))[_0x2ecb('0x22')](removeEntity(_0x4b18b1,null))[_0x2ecb('0x47')](handleError(_0x4b18b1,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index add307d..a17be6c 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 _0xe823=['request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x2c42d3,_0xc3c393){var _0x47bb5c=function(_0x548253){while(--_0x548253){_0x2c42d3['push'](_0x2c42d3['shift']());}};_0x47bb5c(++_0xc3c393);}(_0xe823,0x17d));var _0x3e82=function(_0x2267b2,_0x228032){_0x2267b2=_0x2267b2-0x0;var _0x1bb2d6=_0xe823[_0x2267b2];return _0x1bb2d6;};'use strict';var _=require(_0x3e82('0x0'));var util=require(_0x3e82('0x1'));var logger=require(_0x3e82('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e82('0x3'));var fs=require('fs');var path=require(_0x3e82('0x4'));var rimraf=require('rimraf');var config=require(_0x3e82('0x5'));var attributes=require(_0x3e82('0x6'));module[_0x3e82('0x7')]=function(_0xdc5aeb,_0x5128f5){return _0xdc5aeb[_0x3e82('0x8')](_0x3e82('0x9'),attributes,{'tableName':_0x3e82('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3e82('0xb'),'fields':[_0x3e82('0xc'),_0x3e82('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x3e82('0xc'),_0x3e82('0xe')]},{'unique':!![],'name':_0x3e82('0xf'),'fields':[_0x3e82('0xc'),_0x3e82('0x10')]},{'unique':!![],'name':_0x3e82('0x11'),'fields':[_0x3e82('0xc'),_0x3e82('0x12')]},{'unique':!![],'name':_0x3e82('0x13'),'fields':[_0x3e82('0xc'),_0x3e82('0x14')]},{'unique':!![],'name':_0x3e82('0x15'),'fields':[_0x3e82('0xc'),_0x3e82('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x3e82('0xc'),_0x3e82('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['../../config/environment','exports','define','Disposition','tools_dispositions','ListId','name','ChatWebsiteId','name_mail','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2ed296,_0x9be267){var _0x188f8b=function(_0x5c355f){while(--_0x5c355f){_0x2ed296['push'](_0x2ed296['shift']());}};_0x188f8b(++_0x9be267);}(_0xe14d,0xf5));var _0xde14=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xe14d[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require(_0xde14('0x4'));var BPromise=require('bluebird');var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require('./disposition.attributes');module[_0xde14('0x8')]=function(_0x12035e,_0x12d2ec){return _0x12035e[_0xde14('0x9')](_0xde14('0xa'),attributes,{'tableName':_0xde14('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xde14('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0xde14('0xd'),_0xde14('0xe')]},{'unique':!![],'name':_0xde14('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xde14('0xd'),_0xde14('0x10')]},{'unique':!![],'name':'name_fax','fields':['name',_0xde14('0x11')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xde14('0x12')]},{'unique':!![],'name':_0xde14('0x13'),'fields':['name',_0xde14('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e90dd23..a96a3a7 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(_0xdfc1,_0x4e4bbb){var _0x34870e=function(_0x3b230d){while(--_0x3b230d){_0xdfc1['push'](_0xdfc1['shift']());}};_0x34870e(++_0x4e4bbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x5bbfed,_0x401853){var _0x584a1b=function(_0x4eec35){while(--_0x4eec35){_0x5bbfed['push'](_0x5bbfed['shift']());}};_0x584a1b(++_0x401853);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 103791e..57c2211 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 _0xba73=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports'];(function(_0x3a5648,_0x58054e){var _0x34126d=function(_0x3a6476){while(--_0x3a6476){_0x3a5648['push'](_0x3a5648['shift']());}};_0x34126d(++_0x58054e);}(_0xba73,0x18c));var _0x3ba7=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xba73[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x3ba7('0x0'));var util=require(_0x3ba7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3ba7('0x2'));var router=express[_0x3ba7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3ba7('0x4'));var interaction=require(_0x3ba7('0x5'));var config=require(_0x3ba7('0x6'));var controller=require(_0x3ba7('0x7'));router[_0x3ba7('0x8')]('/',auth[_0x3ba7('0x9')](),controller[_0x3ba7('0xa')]);router['get'](_0x3ba7('0xb'),auth[_0x3ba7('0x9')](),controller['show']);router[_0x3ba7('0xc')]('/',auth[_0x3ba7('0x9')](),controller[_0x3ba7('0xd')]);router['put'](_0x3ba7('0xb'),auth[_0x3ba7('0x9')](),controller[_0x3ba7('0xe')]);router[_0x3ba7('0xf')](_0x3ba7('0xb'),auth[_0x3ba7('0x9')](),controller[_0x3ba7('0x10')]);module[_0x3ba7('0x11')]=router; \ No newline at end of file +var _0x5d7c=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x5d7c,0xae));var _0xc5d7=function(_0x3cd774,_0x1c01b1){_0x3cd774=_0x3cd774-0x0;var _0x1f4922=_0x5d7c[_0x3cd774];return _0x1f4922;};'use strict';var multer=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var path=require(_0xc5d7('0x2'));var timeout=require(_0xc5d7('0x3'));var express=require('express');var router=express[_0xc5d7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc5d7('0x5'));var config=require(_0xc5d7('0x6'));var controller=require(_0xc5d7('0x7'));router[_0xc5d7('0x8')]('/',auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xa')]);router['get'](_0xc5d7('0xb'),auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xc')]);router[_0xc5d7('0xd')]('/',auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xe')]);router[_0xc5d7('0xf')](_0xc5d7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc5d7('0x10')]('/:id',auth[_0xc5d7('0x9')](),controller['destroy']);module[_0xc5d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 28f26a3..02a5576 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 _0x9bd9=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x9bd9[_0x4d7a61];return _0x186f73;};'use strict';var Sequelize=require(_0x99bd('0x0'));module[_0x99bd('0x1')]={'name':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x99bd('0x2')]},'ecm':{'type':Sequelize[_0x99bd('0x3')](_0x99bd('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x99bd('0x2')],'unique':_0x99bd('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x99bd('0x6'),_0x99bd('0x7'),_0x99bd('0x8'),_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb')),'defaultValue':_0x99bd('0x7')},'maxrate':{'type':Sequelize[_0x99bd('0x3')](_0x99bd('0x6'),_0x99bd('0x7'),_0x99bd('0x8'),_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x99bd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x99bd('0x3')]('SIP',_0x99bd('0xd'),'DADHI',_0x99bd('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x99bd('0xf')],'defaultValue':function(){return _0x99bd('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99bd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x99bd('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x99bd('0x13'),'set':function(_0x442702){if(!_0x442702)this[_0x99bd('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x99bd('0x15'),_0x442702);}}}; \ No newline at end of file +var _0xa0a1=['4800','7200','9600','12000','14400','2400','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0xd81e3,_0x1d78bb){var _0x59d814=function(_0xec725d){while(--_0xec725d){_0xd81e3['push'](_0xd81e3['shift']());}};_0x59d814(++_0x1d78bb);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x275cf9,_0x307465){_0x275cf9=_0x275cf9-0x0;var _0x2dd275=_0xa0a1[_0x275cf9];return _0x2dd275;};'use strict';var Sequelize=require(_0x1a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a0a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1a0a('0x1')]},'ecm':{'type':Sequelize[_0x1a0a('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':_0x1a0a('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x1a0a('0x4')},'minrate':{'type':Sequelize[_0x1a0a('0x2')]('2400',_0x1a0a('0x5'),_0x1a0a('0x6'),_0x1a0a('0x7'),_0x1a0a('0x8'),_0x1a0a('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x1a0a('0x2')](_0x1a0a('0xa'),_0x1a0a('0x5'),'7200','9600','12000',_0x1a0a('0x9')),'defaultValue':_0x1a0a('0x9')},'modem':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1a0a('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1a0a('0x2')](_0x1a0a('0xc'),_0x1a0a('0xd'),_0x1a0a('0xe'),_0x1a0a('0xf')),'defaultValue':_0x1a0a('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a0a('0x10')],'defaultValue':function(){return _0x1a0a('0x11');}},'notificationSound':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a0a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a0a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a0a('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1a0a('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x54bfbe){if(!_0x54bfbe)this[_0x1a0a('0x13')](_0x1a0a('0x14'),null);this[_0x1a0a('0x13')](_0x1a0a('0x15'),_0x54bfbe);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 95c23d3..1c6b6bf 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 _0xaa90=['redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','stack','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','order','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','includeAll','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','FaxApplication','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x407656,_0x551993){var _0x5706c8=function(_0x2fc8ed){while(--_0x2fc8ed){_0x407656['push'](_0x407656['shift']());}};_0x5706c8(++_0x551993);}(_0xaa90,0x17a));var _0x0aa9=function(_0x550f3e,_0x2a0805){_0x550f3e=_0x550f3e-0x0;var _0x19706f=_0xaa90[_0x550f3e];return _0x19706f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0aa9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0aa9('0x1'));var moment=require(_0x0aa9('0x2'));var BPromise=require(_0x0aa9('0x3'));var Mustache=require(_0x0aa9('0x4'));var util=require(_0x0aa9('0x5'));var path=require(_0x0aa9('0x6'));var sox=require(_0x0aa9('0x7'));var csv=require(_0x0aa9('0x8'));var ejs=require(_0x0aa9('0x9'));var fs=require('fs');var fs_extra=require(_0x0aa9('0xa'));var _=require('lodash');var squel=require(_0x0aa9('0xb'));var crypto=require('crypto');var jsforce=require(_0x0aa9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0aa9('0x8'));var querystring=require(_0x0aa9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0aa9('0xe'));var qs=require(_0x0aa9('0xf'));var as=require(_0x0aa9('0x10'));var hardwareService=require(_0x0aa9('0x11'));var logger=require(_0x0aa9('0x12'))(_0x0aa9('0x13'));var utils=require(_0x0aa9('0x14'));var config=require(_0x0aa9('0x15'));var licenseUtil=require(_0x0aa9('0x16'));var db=require(_0x0aa9('0x17'))['db'];config[_0x0aa9('0x18')]=_[_0x0aa9('0x19')](config['redis'],{'host':_0x0aa9('0x1a'),'port':0x18eb});var socket=require(_0x0aa9('0x1b'))(new Redis(config[_0x0aa9('0x18')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x0aa9('0x1c'));var client=jayson[_0x0aa9('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x0aa9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2f7041,_0x52e9d9,_0x43d7a0,_0x4e8a78){return new BPromise(function(_0x54f00a,_0x4bd8f5){var _0x246f00=_0x4e8a78||client;return _0x246f00['request'](_0x2f7041,_0x43d7a0)[_0x0aa9('0x1f')](function(_0x2361a1){logger['info'](_0x0aa9('0x20'),_0x52e9d9,_0x0aa9('0x21'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x52e9d9,_0x0aa9('0x21'),JSON[_0x0aa9('0x22')](_0x2361a1));if(_0x2361a1[_0x0aa9('0x23')]){if(_0x2361a1['error']['code']===0x1f4){logger[_0x0aa9('0x23')](_0x0aa9('0x20'),_0x52e9d9,_0x2361a1[_0x0aa9('0x23')][_0x0aa9('0x24')]);return _0x4bd8f5(_0x2361a1['error'][_0x0aa9('0x24')]);}logger[_0x0aa9('0x23')](_0x0aa9('0x20'),_0x52e9d9,_0x2361a1[_0x0aa9('0x23')][_0x0aa9('0x24')]);return _0x54f00a(_0x2361a1['error']['message']);}else{logger[_0x0aa9('0x25')]('FaxAccount,\x20%s,\x20%s',_0x52e9d9,_0x0aa9('0x21'));_0x54f00a(_0x2361a1[_0x0aa9('0x26')][_0x0aa9('0x24')]);}})[_0x0aa9('0x27')](function(_0x49a87f){logger[_0x0aa9('0x23')](_0x0aa9('0x20'),_0x52e9d9,_0x49a87f);_0x4bd8f5(_0x49a87f);});});}function respondWithStatusCode(_0x46f536,_0x23ffc9){_0x23ffc9=_0x23ffc9||0xcc;return function(_0xf7832c){if(_0xf7832c){return _0x46f536[_0x0aa9('0x28')](_0x23ffc9);}return _0x46f536[_0x0aa9('0x29')](_0x23ffc9)['end']();};}function respondWithResult(_0x26a1bb,_0x262d5d){_0x262d5d=_0x262d5d||0xc8;return function(_0x8b3a35){if(_0x8b3a35){return _0x26a1bb[_0x0aa9('0x29')](_0x262d5d)[_0x0aa9('0x2a')](_0x8b3a35);}};}function respondWithFilteredResult(_0x57ac6c,_0x1214ff){return function(_0x5571dc){if(_0x5571dc){var _0x34f49f=typeof _0x1214ff[_0x0aa9('0x2b')]===_0x0aa9('0x2c')&&typeof _0x1214ff['limit']===_0x0aa9('0x2c');var _0x356ade=_0x5571dc[_0x0aa9('0x2d')];var _0x38017f=_0x34f49f?0x0:_0x1214ff[_0x0aa9('0x2b')];var _0x23a051=_0x34f49f?_0x5571dc[_0x0aa9('0x2d')]:_0x1214ff[_0x0aa9('0x2b')]+_0x1214ff[_0x0aa9('0x2e')];var _0x17ead0;if(_0x23a051>=_0x356ade){_0x23a051=_0x356ade;_0x17ead0=0xc8;}else{_0x17ead0=0xce;}_0x57ac6c['status'](_0x17ead0);return _0x57ac6c[_0x0aa9('0x2f')](_0x0aa9('0x30'),_0x38017f+'-'+_0x23a051+'/'+_0x356ade)[_0x0aa9('0x2a')](_0x5571dc);}return null;};}function patchUpdates(_0x19ba9c){return function(_0x3c0ea7){try{jsonpatch[_0x0aa9('0x31')](_0x3c0ea7,_0x19ba9c,!![]);}catch(_0x3f9515){return BPromise[_0x0aa9('0x32')](_0x3f9515);}return _0x3c0ea7[_0x0aa9('0x33')]();};}function saveUpdates(_0x295d64,_0x11b983){return function(_0x3c28e5){if(_0x3c28e5){return _0x3c28e5[_0x0aa9('0x34')](_0x295d64)['then'](function(_0x3752bb){return _0x3752bb;});}return null;};}function removeEntity(_0x201d2f,_0xc37aeb){return function(_0xe139c0){if(_0xe139c0){return _0xe139c0[_0x0aa9('0x35')]()[_0x0aa9('0x1f')](function(){var _0x40a5f5=_0xe139c0[_0x0aa9('0x36')]({'plain':!![]});var _0x1e1ae3=_0x0aa9('0x37');return db[_0x0aa9('0x38')][_0x0aa9('0x35')]({'where':{'type':_0x1e1ae3,'resourceId':_0x40a5f5['id']}})[_0x0aa9('0x1f')](function(){return _0xe139c0;});})[_0x0aa9('0x1f')](function(){_0x201d2f[_0x0aa9('0x29')](0xcc)[_0x0aa9('0x39')]();});}};}function handleEntityNotFound(_0x3d5365,_0x1611ca){return function(_0x51ba11){if(!_0x51ba11){_0x3d5365[_0x0aa9('0x28')](0x194);}return _0x51ba11;};}function handleError(_0x3282f0,_0x1c9902){_0x1c9902=_0x1c9902||0x1f4;return function(_0x50f972){logger[_0x0aa9('0x23')](_0x50f972[_0x0aa9('0x3a')]);if(_0x50f972['name']){delete _0x50f972['name'];}_0x3282f0['status'](_0x1c9902)[_0x0aa9('0x3b')](_0x50f972);};}exports[_0x0aa9('0x3c')]=function(_0x13b23e,_0x446701){var _0x33dc11={'include':[{'model':db[_0x0aa9('0x3d')],'as':_0x0aa9('0x3e')}]},_0x29641f={},_0x3d153c={'count':0x0,'rows':[]};var _0x31ef9d=_[_0x0aa9('0x3f')](db[_0x0aa9('0x40')][_0x0aa9('0x41')],function(_0x2c147f){return{'name':_0x2c147f[_0x0aa9('0x42')],'type':_0x2c147f[_0x0aa9('0x43')][_0x0aa9('0x44')]};});_0x29641f[_0x0aa9('0x45')]=_['map'](_0x31ef9d,_0x0aa9('0x46'));_0x29641f['query']=_['keys'](_0x13b23e[_0x0aa9('0x47')]);_0x29641f[_0x0aa9('0x48')]=_['intersection'](_0x29641f[_0x0aa9('0x45')],_0x29641f[_0x0aa9('0x47')]);_0x33dc11[_0x0aa9('0x49')]=_['intersection'](_0x29641f[_0x0aa9('0x45')],qs[_0x0aa9('0x4a')](_0x13b23e['query'][_0x0aa9('0x4a')]));_0x33dc11[_0x0aa9('0x49')]=_0x33dc11[_0x0aa9('0x49')][_0x0aa9('0x4b')]?_0x33dc11[_0x0aa9('0x49')]:_0x29641f[_0x0aa9('0x45')];if(!_0x13b23e[_0x0aa9('0x47')][_0x0aa9('0x4c')](_0x0aa9('0x4d'))){_0x33dc11[_0x0aa9('0x2e')]=qs['limit'](_0x13b23e[_0x0aa9('0x47')]['limit']);_0x33dc11[_0x0aa9('0x2b')]=qs['offset'](_0x13b23e[_0x0aa9('0x47')][_0x0aa9('0x2b')]);}_0x33dc11['order']=qs[_0x0aa9('0x4e')](_0x13b23e[_0x0aa9('0x47')][_0x0aa9('0x4e')]);_0x33dc11[_0x0aa9('0x4f')]=qs[_0x0aa9('0x48')](_[_0x0aa9('0x50')](_0x13b23e[_0x0aa9('0x47')],_0x29641f[_0x0aa9('0x48')]),_0x31ef9d);if(_0x13b23e['query'][_0x0aa9('0x51')]){_0x33dc11[_0x0aa9('0x4f')]=_[_0x0aa9('0x52')](_0x33dc11[_0x0aa9('0x4f')],{'$or':_[_0x0aa9('0x3f')](_0x31ef9d,function(_0x554ab3){if(_0x554ab3[_0x0aa9('0x43')]!==_0x0aa9('0x53')){var _0x2e2910={};_0x2e2910[_0x554ab3['name']]={'$like':'%'+_0x13b23e[_0x0aa9('0x47')][_0x0aa9('0x51')]+'%'};return _0x2e2910;}})});}_0x33dc11=_[_0x0aa9('0x52')]({},_0x33dc11,_0x13b23e['options']);var _0x4cdb13={'where':_0x33dc11[_0x0aa9('0x4f')]};return db[_0x0aa9('0x40')][_0x0aa9('0x2d')](_0x4cdb13)[_0x0aa9('0x1f')](function(_0x31c4fb){_0x3d153c[_0x0aa9('0x2d')]=_0x31c4fb;if(_0x13b23e[_0x0aa9('0x47')]['includeAll']){_0x33dc11[_0x0aa9('0x54')]=[{'all':!![]}];}return db[_0x0aa9('0x40')][_0x0aa9('0x55')](_0x33dc11);})[_0x0aa9('0x1f')](function(_0x2be396){_0x3d153c['rows']=_0x2be396;return _0x3d153c;})[_0x0aa9('0x1f')](respondWithFilteredResult(_0x446701,_0x33dc11))['catch'](handleError(_0x446701,null));};exports[_0x0aa9('0x56')]=function(_0x51fc2d,_0x125d8a){var _0x2758c6={'raw':![],'where':{'id':_0x51fc2d[_0x0aa9('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3affde={};_0x3affde[_0x0aa9('0x45')]=_['keys'](db[_0x0aa9('0x40')][_0x0aa9('0x41')]);_0x3affde[_0x0aa9('0x47')]=_[_0x0aa9('0x58')](_0x51fc2d[_0x0aa9('0x47')]);_0x3affde[_0x0aa9('0x48')]=_[_0x0aa9('0x59')](_0x3affde[_0x0aa9('0x45')],_0x3affde['query']);_0x2758c6[_0x0aa9('0x49')]=_[_0x0aa9('0x59')](_0x3affde[_0x0aa9('0x45')],qs[_0x0aa9('0x4a')](_0x51fc2d[_0x0aa9('0x47')][_0x0aa9('0x4a')]));_0x2758c6[_0x0aa9('0x49')]=_0x2758c6[_0x0aa9('0x49')][_0x0aa9('0x4b')]?_0x2758c6[_0x0aa9('0x49')]:_0x3affde[_0x0aa9('0x45')];if(_0x51fc2d[_0x0aa9('0x47')]['includeAll']){_0x2758c6[_0x0aa9('0x54')]=[{'all':!![]}];}_0x2758c6=_[_0x0aa9('0x52')]({},_0x2758c6,_0x51fc2d[_0x0aa9('0x5a')]);return db['FaxAccount'][_0x0aa9('0x5b')](_0x2758c6)[_0x0aa9('0x1f')](handleEntityNotFound(_0x125d8a,null))[_0x0aa9('0x1f')](respondWithResult(_0x125d8a,null))[_0x0aa9('0x27')](handleError(_0x125d8a,null));};exports[_0x0aa9('0x5c')]=function(_0x41d86b,_0x3e378a){return db[_0x0aa9('0x40')][_0x0aa9('0x5c')](_0x41d86b[_0x0aa9('0x5d')],{})['then'](function(_0x5adff1){var _0x53bd48=_0x41d86b[_0x0aa9('0x5e')][_0x0aa9('0x36')]({'plain':!![]});if(!_0x53bd48)throw new Error(_0x0aa9('0x5f'));if(_0x53bd48[_0x0aa9('0x60')]==='user'){var _0x50ba6c=_0x5adff1[_0x0aa9('0x36')]({'plain':!![]});var _0x38c79c=_0x0aa9('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x38c79c,'userProfileId':_0x53bd48[_0x0aa9('0x61')]},'raw':!![]})[_0x0aa9('0x1f')](function(_0x2d92b0){if(_0x2d92b0&&_0x2d92b0[_0x0aa9('0x62')]===0x0){return db[_0x0aa9('0x38')][_0x0aa9('0x5c')]({'name':_0x50ba6c[_0x0aa9('0x46')],'resourceId':_0x50ba6c['id'],'type':_0x2d92b0[_0x0aa9('0x46')],'sectionId':_0x2d92b0['id']},{})['then'](function(){return _0x5adff1;});}else{return _0x5adff1;}})[_0x0aa9('0x27')](function(_0x2165db){logger[_0x0aa9('0x23')](_0x0aa9('0x63'),_0x2165db);throw _0x2165db;});}return _0x5adff1;})['then'](respondWithResult(_0x3e378a,0xc9))['catch'](handleError(_0x3e378a,null));};exports[_0x0aa9('0x34')]=function(_0x45dbd5,_0x3c258b){if(_0x45dbd5[_0x0aa9('0x5d')]['id']){delete _0x45dbd5[_0x0aa9('0x5d')]['id'];}return db[_0x0aa9('0x40')]['find']({'where':{'id':_0x45dbd5['params']['id']},'include':[{'model':db[_0x0aa9('0x3d')],'as':_0x0aa9('0x3e')}]})[_0x0aa9('0x1f')](handleEntityNotFound(_0x3c258b,null))[_0x0aa9('0x1f')](saveUpdates(_0x45dbd5[_0x0aa9('0x5d')],null))[_0x0aa9('0x1f')](respondWithResult(_0x3c258b,null))[_0x0aa9('0x27')](handleError(_0x3c258b,null));};exports[_0x0aa9('0x35')]=function(_0x25bf75,_0x2c56aa){return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x25bf75[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x2c56aa,null))['then'](removeEntity(_0x2c56aa,null))[_0x0aa9('0x27')](handleError(_0x2c56aa,null));};exports[_0x0aa9('0x64')]=function(_0x524c0f,_0x4afd47){return db[_0x0aa9('0x40')]['describe']()['then'](respondWithResult(_0x4afd47,null))[_0x0aa9('0x27')](handleError(_0x4afd47,null));};exports['addDisposition']=function(_0x291886,_0x1762d9,_0xc2d88){if(_0x291886[_0x0aa9('0x5d')]['id']){delete _0x291886[_0x0aa9('0x5d')]['id'];}return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x291886['params']['id']}})['then'](handleEntityNotFound(_0x1762d9,null))['then'](function(_0x5d35ad){if(_0x5d35ad){_0x291886[_0x0aa9('0x5d')][_0x0aa9('0x65')]=_0x5d35ad['id'];return db[_0x0aa9('0x66')][_0x0aa9('0x5c')](_0x291886['body']);}})[_0x0aa9('0x1f')](respondWithResult(_0x1762d9,null))['catch'](handleError(_0x1762d9,null));};exports[_0x0aa9('0x67')]=function(_0x1abfa1,_0x2e105e,_0xfc230b){var _0x314e43={'raw':![],'where':{}};var _0x73bf01={};var _0x3d1bde={'count':0x0,'rows':[]};return db[_0x0aa9('0x40')]['findOne']({'where':{'id':_0x1abfa1[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x2e105e,null))[_0x0aa9('0x1f')](function(_0x53331f){if(_0x53331f){_0x73bf01[_0x0aa9('0x45')]=_[_0x0aa9('0x58')](db[_0x0aa9('0x66')][_0x0aa9('0x41')]);_0x73bf01[_0x0aa9('0x47')]=_[_0x0aa9('0x58')](_0x1abfa1[_0x0aa9('0x47')]);_0x73bf01[_0x0aa9('0x48')]=_[_0x0aa9('0x59')](_0x73bf01['model'],_0x73bf01[_0x0aa9('0x47')]);_0x314e43[_0x0aa9('0x49')]=_[_0x0aa9('0x59')](_0x73bf01[_0x0aa9('0x45')],qs['fields'](_0x1abfa1['query'][_0x0aa9('0x4a')]));_0x314e43[_0x0aa9('0x49')]=_0x314e43[_0x0aa9('0x49')]['length']?_0x314e43['attributes']:_0x73bf01[_0x0aa9('0x45')];if(!_0x1abfa1[_0x0aa9('0x47')][_0x0aa9('0x4c')](_0x0aa9('0x4d'))){_0x314e43['limit']=qs[_0x0aa9('0x2e')](_0x1abfa1['query']['limit']);_0x314e43[_0x0aa9('0x2b')]=qs['offset'](_0x1abfa1[_0x0aa9('0x47')][_0x0aa9('0x2b')]);}_0x314e43[_0x0aa9('0x68')]=qs[_0x0aa9('0x4e')](_0x1abfa1[_0x0aa9('0x47')]['sort']);_0x314e43[_0x0aa9('0x4f')]=qs['filters'](_[_0x0aa9('0x50')](_0x1abfa1[_0x0aa9('0x47')],_0x73bf01[_0x0aa9('0x48')]));_0x314e43[_0x0aa9('0x4f')][_0x0aa9('0x65')]=_0x53331f['id'];if(_0x1abfa1[_0x0aa9('0x47')][_0x0aa9('0x51')]){_0x314e43[_0x0aa9('0x4f')]=_[_0x0aa9('0x52')](_0x314e43['where'],{'$or':_[_0x0aa9('0x3f')](_0x314e43[_0x0aa9('0x49')],function(_0x47cc3f){var _0x38fef3={};_0x38fef3[_0x47cc3f]={'$like':'%'+_0x1abfa1['query'][_0x0aa9('0x51')]+'%'};return _0x38fef3;})});}_0x314e43=_[_0x0aa9('0x52')]({},_0x314e43,_0x1abfa1['options']);return db['Disposition'][_0x0aa9('0x2d')]({'where':_0x314e43['where']})[_0x0aa9('0x1f')](function(_0xe23a27){_0x3d1bde[_0x0aa9('0x2d')]=_0xe23a27;if(_0x1abfa1[_0x0aa9('0x47')]['includeAll']){_0x314e43[_0x0aa9('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x0aa9('0x55')](_0x314e43);})[_0x0aa9('0x1f')](function(_0x24026b){_0x3d1bde['rows']=_0x24026b;return _0x3d1bde;});}})[_0x0aa9('0x1f')](respondWithFilteredResult(_0x2e105e,_0x314e43))[_0x0aa9('0x27')](handleError(_0x2e105e,null));};exports['removeDispositions']=function(_0x506ee1,_0x36d52f,_0x255e16){return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x506ee1[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x36d52f,null))['then'](function(_0x123463){if(_0x123463){return _0x123463['removeDispositions'](_0x506ee1[_0x0aa9('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x36d52f,null))[_0x0aa9('0x27')](handleError(_0x36d52f,null));};exports[_0x0aa9('0x69')]=function(_0x25ab4d,_0x2e94c9,_0x3cb65f){if(_0x25ab4d['body']['id']){delete _0x25ab4d[_0x0aa9('0x5d')]['id'];}return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x25ab4d[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x2e94c9,null))[_0x0aa9('0x1f')](function(_0x13703f){if(_0x13703f){_0x25ab4d[_0x0aa9('0x5d')]['FaxAccountId']=_0x13703f['id'];return db[_0x0aa9('0x6a')]['create'](_0x25ab4d['body']);}})[_0x0aa9('0x1f')](respondWithResult(_0x2e94c9,null))['catch'](handleError(_0x2e94c9,null));};exports[_0x0aa9('0x6b')]=function(_0x2ae65c,_0x218a7e,_0x5738bb){var _0x349ddc={'raw':![],'where':{}};var _0x25690f={};var _0x281daa={'count':0x0,'rows':[]};return db[_0x0aa9('0x40')][_0x0aa9('0x6c')]({'where':{'id':_0x2ae65c['params']['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x218a7e,null))['then'](function(_0x358ef2){if(_0x358ef2){_0x25690f['model']=_['keys'](db['CannedAnswer'][_0x0aa9('0x41')]);_0x25690f[_0x0aa9('0x47')]=_[_0x0aa9('0x58')](_0x2ae65c[_0x0aa9('0x47')]);_0x25690f['filters']=_['intersection'](_0x25690f[_0x0aa9('0x45')],_0x25690f[_0x0aa9('0x47')]);_0x349ddc[_0x0aa9('0x49')]=_['intersection'](_0x25690f[_0x0aa9('0x45')],qs['fields'](_0x2ae65c[_0x0aa9('0x47')][_0x0aa9('0x4a')]));_0x349ddc['attributes']=_0x349ddc[_0x0aa9('0x49')]['length']?_0x349ddc[_0x0aa9('0x49')]:_0x25690f[_0x0aa9('0x45')];if(!_0x2ae65c[_0x0aa9('0x47')][_0x0aa9('0x4c')]('nolimit')){_0x349ddc['limit']=qs[_0x0aa9('0x2e')](_0x2ae65c[_0x0aa9('0x47')][_0x0aa9('0x2e')]);_0x349ddc[_0x0aa9('0x2b')]=qs[_0x0aa9('0x2b')](_0x2ae65c[_0x0aa9('0x47')][_0x0aa9('0x2b')]);}_0x349ddc[_0x0aa9('0x68')]=qs[_0x0aa9('0x4e')](_0x2ae65c[_0x0aa9('0x47')][_0x0aa9('0x4e')]);_0x349ddc['where']=qs[_0x0aa9('0x48')](_[_0x0aa9('0x50')](_0x2ae65c[_0x0aa9('0x47')],_0x25690f['filters']));_0x349ddc[_0x0aa9('0x4f')][_0x0aa9('0x65')]=_0x358ef2['id'];if(_0x2ae65c[_0x0aa9('0x47')][_0x0aa9('0x51')]){_0x349ddc['where']=_[_0x0aa9('0x52')](_0x349ddc[_0x0aa9('0x4f')],{'$or':_[_0x0aa9('0x3f')](_0x349ddc['attributes'],function(_0x52fbff){var _0x595423={};_0x595423[_0x52fbff]={'$like':'%'+_0x2ae65c[_0x0aa9('0x47')]['filter']+'%'};return _0x595423;})});}_0x349ddc=_[_0x0aa9('0x52')]({},_0x349ddc,_0x2ae65c['options']);return db[_0x0aa9('0x6a')][_0x0aa9('0x2d')]({'where':_0x349ddc['where']})[_0x0aa9('0x1f')](function(_0x2452a9){_0x281daa[_0x0aa9('0x2d')]=_0x2452a9;if(_0x2ae65c[_0x0aa9('0x47')]['includeAll']){_0x349ddc[_0x0aa9('0x54')]=[{'all':!![]}];}return db[_0x0aa9('0x6a')][_0x0aa9('0x55')](_0x349ddc);})[_0x0aa9('0x1f')](function(_0x440035){_0x281daa[_0x0aa9('0x6d')]=_0x440035;return _0x281daa;});}})[_0x0aa9('0x1f')](respondWithFilteredResult(_0x218a7e,_0x349ddc))['catch'](handleError(_0x218a7e,null));};exports[_0x0aa9('0x6e')]=function(_0x396806,_0x38ab1f,_0x2c74ef){return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x396806['params']['id']}})['then'](handleEntityNotFound(_0x38ab1f,null))[_0x0aa9('0x1f')](function(_0x4ee871){if(_0x4ee871){return _0x4ee871[_0x0aa9('0x6e')](_0x396806[_0x0aa9('0x47')]['ids']);}})[_0x0aa9('0x1f')](respondWithStatusCode(_0x38ab1f,null))['catch'](handleError(_0x38ab1f,null));};exports[_0x0aa9('0x6f')]=function(_0x2fd252,_0x4d9ce6,_0x39fa3e){return db[_0x0aa9('0x70')]['find']({'where':{'id':_0x2fd252[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x4d9ce6,null))[_0x0aa9('0x1f')](function(_0x249561){if(_0x249561){return _0x249561[_0x0aa9('0x6f')](_0x2fd252['body'][_0x0aa9('0x71')],_[_0x0aa9('0x72')](_0x2fd252[_0x0aa9('0x5d')],[_0x0aa9('0x71'),'id'])||{});}})['then'](respondWithResult(_0x4d9ce6,null))[_0x0aa9('0x27')](handleError(_0x4d9ce6,null));};exports[_0x0aa9('0x73')]=function(_0x752347,_0x7c2896,_0x2b3ad0){var _0x14fbf0={'raw':![],'where':{}};var _0x2959a6={};var _0x443715={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x752347[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x7c2896,null))[_0x0aa9('0x1f')](function(_0x598c46){if(_0x598c46){_0x2959a6[_0x0aa9('0x45')]=_[_0x0aa9('0x58')](db['FaxInteraction']['rawAttributes']);_0x2959a6[_0x0aa9('0x47')]=_[_0x0aa9('0x58')](_0x752347[_0x0aa9('0x47')]);_0x2959a6[_0x0aa9('0x48')]=_['intersection'](_0x2959a6[_0x0aa9('0x45')],_0x2959a6[_0x0aa9('0x47')]);_0x14fbf0[_0x0aa9('0x49')]=_[_0x0aa9('0x59')](_0x2959a6[_0x0aa9('0x45')],qs[_0x0aa9('0x4a')](_0x752347[_0x0aa9('0x47')][_0x0aa9('0x4a')]));_0x14fbf0[_0x0aa9('0x49')]=_0x14fbf0['attributes'][_0x0aa9('0x4b')]?_0x14fbf0[_0x0aa9('0x49')]:_0x2959a6[_0x0aa9('0x45')];if(!_0x752347[_0x0aa9('0x47')][_0x0aa9('0x4c')](_0x0aa9('0x4d'))){_0x14fbf0[_0x0aa9('0x2e')]=qs[_0x0aa9('0x2e')](_0x752347[_0x0aa9('0x47')]['limit']);_0x14fbf0[_0x0aa9('0x2b')]=qs[_0x0aa9('0x2b')](_0x752347[_0x0aa9('0x47')]['offset']);}_0x14fbf0['order']=qs[_0x0aa9('0x4e')](_0x752347['query'][_0x0aa9('0x4e')]);_0x14fbf0[_0x0aa9('0x4f')]=qs[_0x0aa9('0x48')](_['pick'](_0x752347[_0x0aa9('0x47')],_0x2959a6[_0x0aa9('0x48')]));_0x14fbf0[_0x0aa9('0x4f')][_0x0aa9('0x65')]=_0x598c46['id'];if(_0x752347[_0x0aa9('0x47')]['filter']){_0x14fbf0[_0x0aa9('0x4f')]=_[_0x0aa9('0x52')](_0x14fbf0[_0x0aa9('0x4f')],{'$or':_['map'](_0x14fbf0['attributes'],function(_0x5cbe21){var _0x3ab9bd={};_0x3ab9bd[_0x5cbe21]={'$like':'%'+_0x752347[_0x0aa9('0x47')]['filter']+'%'};return _0x3ab9bd;})});}_0x14fbf0=_['merge']({},_0x14fbf0,_0x752347[_0x0aa9('0x5a')]);return db[_0x0aa9('0x70')][_0x0aa9('0x2d')]({'where':_0x14fbf0['where']})[_0x0aa9('0x1f')](function(_0x2bf2c9){_0x443715[_0x0aa9('0x2d')]=_0x2bf2c9;if(_0x752347['query'][_0x0aa9('0x74')]){_0x14fbf0[_0x0aa9('0x54')]=[{'model':db[_0x0aa9('0x75')],'as':_0x0aa9('0x76'),'required':![]},{'model':db[_0x0aa9('0x77')],'as':'Owner','attributes':['name',_0x0aa9('0x78'),_0x0aa9('0x79')],'required':![]},{'model':db[_0x0aa9('0x7a')],'as':_0x0aa9('0x7b'),'attributes':['id',_0x0aa9('0x46'),_0x0aa9('0x7c')],'where':_0x752347[_0x0aa9('0x47')][_0x0aa9('0x7d')]?{'id':_0x752347[_0x0aa9('0x47')][_0x0aa9('0x7d')]}:undefined,'required':_0x752347[_0x0aa9('0x47')]['tag']?!![]:![]}];}return db[_0x0aa9('0x70')]['findAll'](_0x14fbf0);})['then'](function(_0x4ca2d6){_0x443715[_0x0aa9('0x6d')]=_0x4ca2d6;return _0x443715;});}})['then'](respondWithFilteredResult(_0x7c2896,_0x14fbf0))[_0x0aa9('0x27')](handleError(_0x7c2896,null));};exports[_0x0aa9('0x7e')]=function(_0x42dc77,_0xcb0224){var _0x6f361f=_0x42dc77[_0x0aa9('0x57')]['id'];var _0x4d155f=_0x42dc77['body'];var _0x171bbc=0xc8;var _0xb04a81=null;return db[_0x0aa9('0x7f')]['transaction']({'isolationLevel':db[_0x0aa9('0x7f')][_0x0aa9('0x80')][_0x0aa9('0x81')][_0x0aa9('0x82')]},function(_0x521dee){return db[_0x0aa9('0x40')]['findOne']({'where':{'id':_0x6f361f},'transaction':_0x521dee})[_0x0aa9('0x1f')](function(_0x19743d){if(_0x19743d){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x6f361f},'transaction':_0x521dee})['then'](function(){var _0x1fae85=_[_0x0aa9('0x3f')](_0x4d155f,function(_0x4c62d3){_0x4c62d3[_0x0aa9('0x65')]=_0x6f361f;return _0x4c62d3;});return db['FaxApplication'][_0x0aa9('0x83')](_0x1fae85,{'transaction':_0x521dee});});}else{_0x171bbc=0x194;_0xb04a81=[];}});})['then'](function(){if(_0x171bbc!==0x194){return db[_0x0aa9('0x84')][_0x0aa9('0x85')]({'where':{'FaxAccountId':_0x6f361f},'order':'priority'})[_0x0aa9('0x1f')](function(_0x27f76d){_0xb04a81=_0x27f76d;});}})[_0x0aa9('0x27')](function(_0x373cbc){_0x171bbc=0x1f4;logger[_0x0aa9('0x23')](_0x373cbc[_0x0aa9('0x3a')]);if(_0x373cbc[_0x0aa9('0x46')]){delete _0x373cbc['name'];}_0xb04a81=_0x373cbc;})['finally'](function(){if(_0xb04a81===null){_0xcb0224[_0x0aa9('0x28')](_0x171bbc);}else{if(_0x171bbc===0x1f4){_0xcb0224[_0x0aa9('0x29')](_0x171bbc)[_0x0aa9('0x3b')](_0xb04a81);}else{_0xcb0224[_0x0aa9('0x29')](_0x171bbc)['json'](_0xb04a81);}}});};exports[_0x0aa9('0x86')]=function(_0x50c466,_0x3ff3fe,_0x123b51){var _0x2d7eae={};var _0x49f1f6={};var _0x2a7f50;var _0x59cef1;return db['FaxAccount'][_0x0aa9('0x6c')]({'where':{'id':_0x50c466[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x3ff3fe,null))['then'](function(_0x220845){if(_0x220845){_0x2a7f50=_0x220845;_0x49f1f6['model']=_[_0x0aa9('0x58')](db[_0x0aa9('0x84')][_0x0aa9('0x41')]);_0x49f1f6[_0x0aa9('0x47')]=_[_0x0aa9('0x58')](_0x50c466[_0x0aa9('0x47')]);_0x49f1f6[_0x0aa9('0x48')]=_[_0x0aa9('0x59')](_0x49f1f6['model'],_0x49f1f6['query']);_0x2d7eae['attributes']=_[_0x0aa9('0x59')](_0x49f1f6[_0x0aa9('0x45')],qs[_0x0aa9('0x4a')](_0x50c466[_0x0aa9('0x47')][_0x0aa9('0x4a')]));_0x2d7eae[_0x0aa9('0x49')]=_0x2d7eae[_0x0aa9('0x49')][_0x0aa9('0x4b')]?_0x2d7eae[_0x0aa9('0x49')]:_0x49f1f6[_0x0aa9('0x45')];_0x2d7eae[_0x0aa9('0x68')]=qs[_0x0aa9('0x4e')](_0x50c466[_0x0aa9('0x47')][_0x0aa9('0x4e')]);_0x2d7eae[_0x0aa9('0x4f')]=qs['filters'](_['pick'](_0x50c466[_0x0aa9('0x47')],_0x49f1f6[_0x0aa9('0x48')]));if(_0x50c466[_0x0aa9('0x47')]['filter']){_0x2d7eae[_0x0aa9('0x4f')]=_[_0x0aa9('0x52')](_0x2d7eae[_0x0aa9('0x4f')],{'$or':_[_0x0aa9('0x3f')](_0x2d7eae[_0x0aa9('0x49')],function(_0x4be60b){var _0x516b91={};_0x516b91[_0x4be60b]={'$like':'%'+_0x50c466[_0x0aa9('0x47')][_0x0aa9('0x51')]+'%'};return _0x516b91;})});}_0x2d7eae=_[_0x0aa9('0x52')]({},_0x2d7eae,_0x50c466[_0x0aa9('0x5a')]);return _0x2a7f50[_0x0aa9('0x86')](_0x2d7eae);}})[_0x0aa9('0x1f')](function(_0x1c8d7d){if(_0x1c8d7d){_0x59cef1=_0x1c8d7d[_0x0aa9('0x4b')];if(!_0x50c466[_0x0aa9('0x47')][_0x0aa9('0x4c')](_0x0aa9('0x4d'))){_0x2d7eae[_0x0aa9('0x2e')]=qs[_0x0aa9('0x2e')](_0x50c466[_0x0aa9('0x47')][_0x0aa9('0x2e')]);_0x2d7eae[_0x0aa9('0x2b')]=qs[_0x0aa9('0x2b')](_0x50c466['query'][_0x0aa9('0x2b')]);}return _0x2a7f50[_0x0aa9('0x86')](_0x2d7eae);}})['then'](function(_0x5cb605){if(_0x5cb605){return _0x5cb605?{'count':_0x59cef1,'rows':_0x5cb605}:null;}})[_0x0aa9('0x1f')](respondWithResult(_0x3ff3fe,null))[_0x0aa9('0x27')](handleError(_0x3ff3fe,null));};function Extension(_0x520447,_0x53e8e8,_0x43f425,_0x212d27){this[_0x0aa9('0x87')]=_0x0aa9('0x88');this[_0x0aa9('0x89')]=_0x520447[_0x0aa9('0x8a')];this[_0x0aa9('0x8b')]=_0x212d27;this[_0x0aa9('0x43')]=_0x0aa9('0x8c');this[_0x0aa9('0x8d')]=_0x0aa9('0x8e');this[_0x0aa9('0x65')]=_0x520447['id'];this['priority']=_0x53e8e8;this[_0x0aa9('0x8f')]=_0x43f425;}function createExtensionsReciveFax(_0xc3eaef){var _0x46f602=0x1;var _0xe82b13=[];_0xe82b13[_0x0aa9('0x90')](new Extension(_0xc3eaef,_0x46f602,'','Answer'));_0x46f602+=0x1;_0xe82b13['push'](new Extension(_0xc3eaef,_0x46f602,_0x0aa9('0x91'),_0x0aa9('0x92')));_0x46f602+=0x1;for(var _0x1e6019 in _0xc3eaef){if(_0xc3eaef[_0x0aa9('0x4c')](_0x1e6019)&&(_0x1e6019===_0x0aa9('0x93')||_0x1e6019==='localstationid'||_0x1e6019===_0x0aa9('0x94')||_0x1e6019==='faxdetect'||_0x1e6019==='headerinfo'||_0x1e6019===_0x0aa9('0x95')||_0x1e6019===_0x0aa9('0x96')||_0x1e6019===_0x0aa9('0x97')||_0x1e6019===_0x0aa9('0x98'))){_0xe82b13['push'](new Extension(_0xc3eaef,_0x46f602,'FAXOPT('+_0x1e6019+')='+_0xc3eaef[_0x1e6019],'Set'));_0x46f602+=0x1;}}_0xe82b13[_0x0aa9('0x90')](new Extension(_0xc3eaef,_0x46f602,'6',_0x0aa9('0x99')));_0x46f602+=0x1;_0xe82b13[_0x0aa9('0x90')](new Extension(_0xc3eaef,_0x46f602,_0x0aa9('0x9a'),'ReceiveFax'));_0x46f602=0x0;return _0xe82b13;}exports[_0x0aa9('0x9b')]=function(_0xe3315,_0x30bee7,_0x319276){var _0x1abef4;return db[_0x0aa9('0x7f')][_0x0aa9('0x9c')](function(_0x349ca0){return db['FaxAccount'][_0x0aa9('0x5c')](_0xe3315[_0x0aa9('0x5d')],{'transaction':_0x349ca0})[_0x0aa9('0x1f')](function(_0x3b0e94){_0x1abef4=_0x3b0e94['get']({'plain':!![]});return db[_0x0aa9('0x9d')][_0x0aa9('0x83')](createExtensionsReciveFax(_0x1abef4),{'transaction':_0x349ca0});});})[_0x0aa9('0x1f')](function(){return _0x1abef4;})[_0x0aa9('0x1f')](respondWithResult(_0x30bee7,null))['catch'](handleError(_0x30bee7,null));};exports[_0x0aa9('0x9e')]=function(_0x319d2e,_0x471149,_0x3159df){var _0x2a1721;return db['sequelize'][_0x0aa9('0x9c')](function(_0x5263d8){return db[_0x0aa9('0x40')]['update'](_0x319d2e[_0x0aa9('0x5d')],{'where':{'id':_0x319d2e[_0x0aa9('0x5d')]['id']},'transaction':_0x5263d8})['then'](function(_0x51f5b0){return db[_0x0aa9('0x9d')][_0x0aa9('0x35')]({'where':{'FaxAccountId':_0x319d2e[_0x0aa9('0x5d')]['id']},'transaction':_0x5263d8})[_0x0aa9('0x1f')](function(_0x6e3bfd){return db[_0x0aa9('0x9d')][_0x0aa9('0x83')](createExtensionsReciveFax(_['omit'](_0x319d2e['body'],[_0x0aa9('0x9f'),_0x0aa9('0x44'),_0x0aa9('0xa0'),'updatedAt',_0x0aa9('0xa1'),'ListId'])),{'transaction':_0x5263d8});});});})[_0x0aa9('0x1f')](function(){return db[_0x0aa9('0x40')][_0x0aa9('0xa2')](_0x319d2e[_0x0aa9('0x5d')]['id']);})[_0x0aa9('0x1f')](respondWithResult(_0x471149,null))[_0x0aa9('0x27')](handleError(_0x471149,null));};exports[_0x0aa9('0xa3')]=function(_0x22f0b7,_0xea108,_0x2b6170){var _0x1e4f04={'raw':!![],'where':{}};var _0x2a8674={};var _0x4b5dfb={'count':0x0,'rows':[]};return db[_0x0aa9('0x40')][_0x0aa9('0x6c')]({'where':{'id':_0x22f0b7[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0xea108,null))[_0x0aa9('0x1f')](function(_0xf17fc4){if(_0xf17fc4){_0x2a8674[_0x0aa9('0x45')]=_['keys'](db['FaxMessage'][_0x0aa9('0x41')]);_0x2a8674[_0x0aa9('0x47')]=_[_0x0aa9('0x58')](_0x22f0b7[_0x0aa9('0x47')]);_0x2a8674[_0x0aa9('0x48')]=_[_0x0aa9('0x59')](_0x2a8674[_0x0aa9('0x45')],_0x2a8674[_0x0aa9('0x47')]);_0x1e4f04[_0x0aa9('0x49')]=_[_0x0aa9('0x59')](_0x2a8674[_0x0aa9('0x45')],qs[_0x0aa9('0x4a')](_0x22f0b7[_0x0aa9('0x47')][_0x0aa9('0x4a')]));_0x1e4f04[_0x0aa9('0x49')]=_0x1e4f04['attributes'][_0x0aa9('0x4b')]?_0x1e4f04[_0x0aa9('0x49')]:_0x2a8674[_0x0aa9('0x45')];if(!_0x22f0b7['query'][_0x0aa9('0x4c')]('nolimit')){_0x1e4f04[_0x0aa9('0x2e')]=qs['limit'](_0x22f0b7[_0x0aa9('0x47')][_0x0aa9('0x2e')]);_0x1e4f04['offset']=qs['offset'](_0x22f0b7[_0x0aa9('0x47')][_0x0aa9('0x2b')]);}_0x1e4f04['order']=qs['sort'](_0x22f0b7[_0x0aa9('0x47')]['sort']);_0x1e4f04[_0x0aa9('0x4f')]=qs['filters'](_[_0x0aa9('0x50')](_0x22f0b7[_0x0aa9('0x47')],_0x2a8674[_0x0aa9('0x48')]));_0x1e4f04['where'][_0x0aa9('0x65')]=_0xf17fc4['id'];if(_0x22f0b7[_0x0aa9('0x47')]['filter']){_0x1e4f04[_0x0aa9('0x4f')]=_['merge'](_0x1e4f04[_0x0aa9('0x4f')],{'$or':_['map'](_0x1e4f04[_0x0aa9('0x49')],function(_0x5f361f){var _0x1e2cd3={};_0x1e2cd3[_0x5f361f]={'$like':'%'+_0x22f0b7[_0x0aa9('0x47')]['filter']+'%'};return _0x1e2cd3;})});}if(_0x22f0b7[_0x0aa9('0x47')][_0x0aa9('0xa4')]){var _0x4b8fcc=_0x22f0b7[_0x0aa9('0x47')][_0x0aa9('0xa4')][_0x0aa9('0xa5')](',');var _0x5593eb={};_0x5593eb[_0x4b8fcc[0x0]]={'$gte':moment(_0x4b8fcc[0x1])['format'](_0x0aa9('0xa6'))};_0x1e4f04['where']=_['merge'](_0x1e4f04[_0x0aa9('0x4f')],_0x5593eb);}_0x1e4f04=_[_0x0aa9('0x52')]({},_0x1e4f04,_0x22f0b7['options']);return db[_0x0aa9('0xa7')][_0x0aa9('0x2d')]({'where':_0x1e4f04['where']})[_0x0aa9('0x1f')](function(_0x4cb3b3){_0x4b5dfb[_0x0aa9('0x2d')]=_0x4cb3b3;if(_0x22f0b7['query'][_0x0aa9('0x74')]){_0x1e4f04[_0x0aa9('0x54')]=[{'all':!![]}];}return db[_0x0aa9('0xa7')]['findAll'](_0x1e4f04);})[_0x0aa9('0x1f')](function(_0x5c4d72){_0x4b5dfb[_0x0aa9('0x6d')]=_0x5c4d72;return _0x4b5dfb;});}})[_0x0aa9('0x1f')](respondWithFilteredResult(_0xea108,_0x1e4f04))[_0x0aa9('0x27')](handleError(_0xea108,null));};exports[_0x0aa9('0x3b')]=function(_0x4f4ed1,_0x1c5b12,_0x269cd0){var _0x1d0118,_0x301dc3={},_0x1dbaec;if(_0x4f4ed1[_0x0aa9('0x5d')]['to']){_0x1dbaec=_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0];}return db['FaxAccount'][_0x0aa9('0x5b')]({'where':{'id':_0x4f4ed1[_0x0aa9('0x57')]['id']},'include':[{'model':db[_0x0aa9('0xa8')],'as':_0x0aa9('0xa9'),'include':[{'model':db[_0x0aa9('0x75')],'as':_0x0aa9('0xaa'),'where':{'fax':_0x1dbaec},'limit':0x1,'order':[[_0x0aa9('0xab'),_0x0aa9('0xac')]]}]}]})[_0x0aa9('0x1f')](handleEntityNotFound(_0x1c5b12,null))[_0x0aa9('0x1f')](function(_0x5a95c4){_0x1d0118=_0x5a95c4;if(_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')]&&_0x4f4ed1[_0x0aa9('0x5d')]['attachments']['length']){for(var _0x1d8769=0x0;_0x1d8769<_0x4f4ed1['body'][_0x0aa9('0xad')][_0x0aa9('0x4b')];_0x1d8769+=0x1){_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')][_0x1d8769]={'filename':_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')][_0x1d8769][_0x0aa9('0x46')],'id':_0x4f4ed1['body'][_0x0aa9('0xad')][_0x1d8769]['id'],'path':path[_0x0aa9('0xae')](config[_0x0aa9('0xaf')],'server/files/attachments',_0x4f4ed1['body']['attachments'][_0x1d8769][_0x0aa9('0xb0')])};}}return respondWithRpcPromise('CheckAfterSend',_0x0aa9('0xb1'),{'FaxAccountId':_[_0x0aa9('0xb2')](_0x4f4ed1['params']['id'])?undefined:_0x4f4ed1['params']['id'],'path':_[_0x0aa9('0xb2')](_0x4f4ed1[_0x0aa9('0x5d')]['attachments'][0x0]['path'])?undefined:_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')][0x0][_0x0aa9('0x6')],'fax':_[_0x0aa9('0xb2')](_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0])?undefined:_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0]},client9002);})[_0x0aa9('0x1f')](function(){if(_0x1d0118){if(_[_0x0aa9('0xb2')](_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xb3')])){_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xb3')]=util[_0x0aa9('0xb4')](_0x0aa9('0xb5'),_0x1d0118[_0x0aa9('0x46')],_0x1d0118[_0x0aa9('0xb6')]);}if(_0x1d0118[_0x0aa9('0xa9')]){if(_0x1d0118[_0x0aa9('0xa9')][_0x0aa9('0xaa')][_0x0aa9('0x4b')]){return _0x1d0118[_0x0aa9('0xa9')]['Contacts'][0x0];}else{return db['CmContact'][_0x0aa9('0x5c')](_[_0x0aa9('0x19')](_0x4f4ed1[_0x0aa9('0x5d')],{'firstName':_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0],'phone':_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0],'fax':_0x4f4ed1['body']['to'][0x0],'ListId':_0x1d0118[_0x0aa9('0xb7')]}));}}else{throw new Error(_0x0aa9('0xb8'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x1653b3){if(_0x1653b3){return db[_0x0aa9('0x70')][_0x0aa9('0x5b')]({'where':{'ContactId':_0x1653b3['id'],'closed':![],'FaxAccountId':_0x1d0118['id']}})[_0x0aa9('0x1f')](function(_0x58b450){if(_0x58b450){return[_0x58b450,![]];}return db[_0x0aa9('0x70')]['create']({'UserId':_0x4f4ed1[_0x0aa9('0x5e')]['id'],'ContactId':_0x1653b3['id'],'FaxAccountId':_0x1d0118['id'],'fax':_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0aa9('0x52')](_0x4f4ed1[_0x0aa9('0x5d')],{'read':![],'body':_0x4f4ed1['body'][_0x0aa9('0xad')][0x0][_0x0aa9('0xb9')],'FaxAccountId':_0x1d0118['id'],'UserId':_0x4f4ed1['user']['id'],'ContactId':_0x1653b3['id'],'AttachmentId':_0x4f4ed1['body'][_0x0aa9('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x0aa9('0xa7')],'as':_0x0aa9('0xba')}]})[_0x0aa9('0x1f')](function(_0x2a8498){return[_0x2a8498,!![]];});});}else{throw new Error(_0x0aa9('0xbb'));}})['spread'](function(_0x447512,_0x20c1bb){if(_0x20c1bb){return _0x447512;}return db[_0x0aa9('0xa7')][_0x0aa9('0x5c')]({'direction':_0x0aa9('0xbc'),'read':![],'body':_0x4f4ed1[_0x0aa9('0x5d')]['attachments'][0x0][_0x0aa9('0xb9')],'FaxAccountId':_0x1d0118['id'],'FaxInteractionId':_0x447512['id'],'UserId':_0x4f4ed1[_0x0aa9('0x5e')]['id'],'ContactId':_0x447512[_0x0aa9('0xbd')],'AttachmentId':_0x4f4ed1[_0x0aa9('0x5d')]['attachments'][0x0]['id']})[_0x0aa9('0x1f')](function(_0x41ddcd){_0x447512[_0x0aa9('0xbe')][_0x0aa9('0xba')]=[];_0x447512[_0x0aa9('0xbe')][_0x0aa9('0xba')][_0x0aa9('0x90')](_0x41ddcd[_0x0aa9('0xbe')]);return _0x447512;});})[_0x0aa9('0x1f')](function(_0x2115a9){respondWithRpcPromise(_0x0aa9('0xbf'),'SendFax',{'FaxAccountId':_[_0x0aa9('0xb2')](_0x4f4ed1[_0x0aa9('0x57')]['id'])?undefined:_0x4f4ed1['params']['id'],'path':_[_0x0aa9('0xb2')](_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')][0x0][_0x0aa9('0x6')])?undefined:_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')][0x0][_0x0aa9('0x6')],'fax':_['isNil'](_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0])?undefined:_0x4f4ed1[_0x0aa9('0x5d')]['to'][0x0],'AttachmentId':_0x4f4ed1[_0x0aa9('0x5d')][_0x0aa9('0xad')][0x0]['id']},client9002)[_0x0aa9('0x1f')](function(_0x3a1c88){logger['info']('SendFaxRpc,\x20%s',_0x3a1c88);})[_0x0aa9('0x27')](function(_0x77f26a){logger[_0x0aa9('0x25')](_0x0aa9('0xc0'),_0x77f26a);});return _0x2115a9;})[_0x0aa9('0x1f')](respondWithResult(_0x1c5b12,null))[_0x0aa9('0x27')](handleError(_0x1c5b12,null));};exports[_0x0aa9('0xc1')]=function(_0x147acf,_0x6818db,_0x1ba1f9){return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x147acf[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x6818db,null))[_0x0aa9('0x1f')](function(_0x2d6c7a){if(_0x2d6c7a){return _0x2d6c7a[_0x0aa9('0xc1')](_0x147acf[_0x0aa9('0x5d')]['ids'],_['omit'](_0x147acf[_0x0aa9('0x5d')],[_0x0aa9('0x71'),'id'])||{})[_0x0aa9('0xc2')](function(_0x4f4841){for(var _0x5061ab=0x0;_0x5061ab<_0x147acf[_0x0aa9('0x5d')][_0x0aa9('0x71')][_0x0aa9('0x4b')];_0x5061ab+=0x1){socket[_0x0aa9('0xc3')](_0x0aa9('0xc4'),{'UserId':Number(_0x147acf[_0x0aa9('0x5d')][_0x0aa9('0x71')][_0x5061ab]),'FaxAccountId':Number(_0x147acf[_0x0aa9('0x57')]['id'])});}return _0x4f4841;});}})[_0x0aa9('0x1f')](respondWithResult(_0x6818db,null))[_0x0aa9('0x27')](handleError(_0x6818db,null));};exports[_0x0aa9('0xc5')]=function(_0x512d36,_0x596ef9,_0x32565b){return db[_0x0aa9('0x40')][_0x0aa9('0x5b')]({'where':{'id':_0x512d36[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x596ef9,null))[_0x0aa9('0x1f')](function(_0x4dfcb9){if(_0x4dfcb9){return _0x4dfcb9[_0x0aa9('0xc5')](_0x512d36[_0x0aa9('0x47')][_0x0aa9('0x71')])[_0x0aa9('0x1f')](function(){if(_[_0x0aa9('0xc6')](_0x512d36[_0x0aa9('0x47')][_0x0aa9('0x71')])){for(var _0x151773=0x0;_0x151773<_0x512d36[_0x0aa9('0x47')]['ids'][_0x0aa9('0x4b')];_0x151773+=0x1){socket[_0x0aa9('0xc3')](_0x0aa9('0xc7'),{'UserId':Number(_0x512d36[_0x0aa9('0x47')][_0x0aa9('0x71')][_0x151773]),'FaxAccountId':Number(_0x512d36[_0x0aa9('0x57')]['id'])});}}else{socket[_0x0aa9('0xc3')](_0x0aa9('0xc7'),{'UserId':Number(_0x512d36[_0x0aa9('0x47')][_0x0aa9('0x71')]),'FaxAccountId':Number(_0x512d36['params']['id'])});}});}})[_0x0aa9('0x1f')](respondWithStatusCode(_0x596ef9,null))[_0x0aa9('0x27')](handleError(_0x596ef9,null));};exports[_0x0aa9('0xc8')]=function(_0x7fac1f,_0x4d7518,_0x377ae3){var _0x57593e={};var _0x5735ef={};var _0x5e8813;var _0x55c229;return db[_0x0aa9('0x40')]['findOne']({'where':{'id':_0x7fac1f[_0x0aa9('0x57')]['id']}})[_0x0aa9('0x1f')](handleEntityNotFound(_0x4d7518,null))[_0x0aa9('0x1f')](function(_0x8699d6){if(_0x8699d6){_0x5e8813=_0x8699d6;_0x5735ef[_0x0aa9('0x45')]=_[_0x0aa9('0x58')](db['User'][_0x0aa9('0x41')]);_0x5735ef[_0x0aa9('0x47')]=_['keys'](_0x7fac1f[_0x0aa9('0x47')]);_0x5735ef[_0x0aa9('0x48')]=_[_0x0aa9('0x59')](_0x5735ef[_0x0aa9('0x45')],_0x5735ef[_0x0aa9('0x47')]);_0x57593e[_0x0aa9('0x49')]=_[_0x0aa9('0x59')](_0x5735ef[_0x0aa9('0x45')],qs[_0x0aa9('0x4a')](_0x7fac1f['query'][_0x0aa9('0x4a')]));_0x57593e['attributes']=_0x57593e[_0x0aa9('0x49')][_0x0aa9('0x4b')]?_0x57593e['attributes']:_0x5735ef[_0x0aa9('0x45')];_0x57593e[_0x0aa9('0x68')]=qs[_0x0aa9('0x4e')](_0x7fac1f['query']['sort']);_0x57593e[_0x0aa9('0x4f')]=qs['filters'](_[_0x0aa9('0x50')](_0x7fac1f['query'],_0x5735ef[_0x0aa9('0x48')]));if(_0x7fac1f['query'][_0x0aa9('0x51')]){_0x57593e[_0x0aa9('0x4f')]=_[_0x0aa9('0x52')](_0x57593e[_0x0aa9('0x4f')],{'$or':_[_0x0aa9('0x3f')](_0x57593e['attributes'],function(_0x1a2f61){var _0x10d92e={};_0x10d92e[_0x1a2f61]={'$like':'%'+_0x7fac1f[_0x0aa9('0x47')]['filter']+'%'};return _0x10d92e;})});}_0x57593e=_['merge']({},_0x57593e,_0x7fac1f['options']);return _0x5e8813['getAgents'](_0x57593e);}})[_0x0aa9('0x1f')](function(_0x1718a5){if(_0x1718a5){_0x55c229=_0x1718a5[_0x0aa9('0x4b')];if(!_0x7fac1f[_0x0aa9('0x47')][_0x0aa9('0x4c')](_0x0aa9('0x4d'))){_0x57593e[_0x0aa9('0x2e')]=qs[_0x0aa9('0x2e')](_0x7fac1f[_0x0aa9('0x47')][_0x0aa9('0x2e')]);_0x57593e[_0x0aa9('0x2b')]=qs[_0x0aa9('0x2b')](_0x7fac1f[_0x0aa9('0x47')][_0x0aa9('0x2b')]);}return _0x5e8813[_0x0aa9('0xc8')](_0x57593e);}})[_0x0aa9('0x1f')](function(_0x338922){if(_0x338922){return _0x338922?{'count':_0x55c229,'rows':_0x338922}:null;}})[_0x0aa9('0x1f')](respondWithResult(_0x4d7518,null))[_0x0aa9('0x27')](handleError(_0x4d7518,null));}; \ No newline at end of file +var _0xa459=['limit','count','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addInteraction','FaxInteraction','CmContact','User','Owner','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','omit','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0xa459,0x95));var _0x9a45=function(_0x25a71f,_0x4814c8){_0x25a71f=_0x25a71f-0x0;var _0x5ddc15=_0xa459[_0x25a71f];return _0x5ddc15;};'use strict';var emlformat=require(_0x9a45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a45('0x1'));var jsonpatch=require(_0x9a45('0x2'));var rp=require(_0x9a45('0x3'));var moment=require('moment');var BPromise=require(_0x9a45('0x4'));var Mustache=require(_0x9a45('0x5'));var util=require('util');var path=require(_0x9a45('0x6'));var sox=require(_0x9a45('0x7'));var csv=require(_0x9a45('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a45('0x9'));var _=require(_0x9a45('0xa'));var squel=require(_0x9a45('0xb'));var crypto=require(_0x9a45('0xc'));var jsforce=require(_0x9a45('0xd'));var deskjs=require(_0x9a45('0xe'));var toCsv=require(_0x9a45('0x8'));var querystring=require(_0x9a45('0xf'));var Papa=require(_0x9a45('0x10'));var Redis=require(_0x9a45('0x11'));var authService=require(_0x9a45('0x12'));var qs=require(_0x9a45('0x13'));var as=require(_0x9a45('0x14'));var hardwareService=require(_0x9a45('0x15'));var logger=require(_0x9a45('0x16'))(_0x9a45('0x17'));var utils=require(_0x9a45('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9a45('0x19'));var db=require(_0x9a45('0x1a'))['db'];config[_0x9a45('0x1b')]=_[_0x9a45('0x1c')](config[_0x9a45('0x1b')],{'host':_0x9a45('0x1d'),'port':0x18eb});var socket=require(_0x9a45('0x1e'))(new Redis(config[_0x9a45('0x1b')]));require('./faxAccount.socket')[_0x9a45('0x1f')](socket);var jayson=require(_0x9a45('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x9a45('0x21')][_0x9a45('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3c1641,_0x5ef119,_0x475de7,_0xcf6070){return new BPromise(function(_0x445261,_0x58074d){var _0x429045=_0xcf6070||client;return _0x429045['request'](_0x3c1641,_0x475de7)[_0x9a45('0x23')](function(_0xc135fd){logger[_0x9a45('0x24')](_0x9a45('0x25'),_0x5ef119,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5ef119,_0x9a45('0x26'),JSON[_0x9a45('0x27')](_0xc135fd));if(_0xc135fd[_0x9a45('0x28')]){if(_0xc135fd[_0x9a45('0x28')][_0x9a45('0x29')]===0x1f4){logger[_0x9a45('0x28')]('FaxAccount,\x20%s,\x20%s',_0x5ef119,_0xc135fd[_0x9a45('0x28')][_0x9a45('0x2a')]);return _0x58074d(_0xc135fd[_0x9a45('0x28')][_0x9a45('0x2a')]);}logger['error'](_0x9a45('0x25'),_0x5ef119,_0xc135fd[_0x9a45('0x28')]['message']);return _0x445261(_0xc135fd[_0x9a45('0x28')][_0x9a45('0x2a')]);}else{logger[_0x9a45('0x24')]('FaxAccount,\x20%s,\x20%s',_0x5ef119,'request\x20sent');_0x445261(_0xc135fd[_0x9a45('0x2b')][_0x9a45('0x2a')]);}})['catch'](function(_0x108f97){logger[_0x9a45('0x28')](_0x9a45('0x25'),_0x5ef119,_0x108f97);_0x58074d(_0x108f97);});});}function respondWithStatusCode(_0x14093d,_0x42772e){_0x42772e=_0x42772e||0xcc;return function(_0xe643a0){if(_0xe643a0){return _0x14093d[_0x9a45('0x2c')](_0x42772e);}return _0x14093d[_0x9a45('0x2d')](_0x42772e)[_0x9a45('0x2e')]();};}function respondWithResult(_0x538a51,_0x33ecf4){_0x33ecf4=_0x33ecf4||0xc8;return function(_0x3a0825){if(_0x3a0825){return _0x538a51[_0x9a45('0x2d')](_0x33ecf4)[_0x9a45('0x2f')](_0x3a0825);}};}function respondWithFilteredResult(_0x57f965,_0x20894b){return function(_0x1e9c4b){if(_0x1e9c4b){var _0x3fd3b9=typeof _0x20894b[_0x9a45('0x30')]===_0x9a45('0x31')&&typeof _0x20894b[_0x9a45('0x32')]==='undefined';var _0x3e3114=_0x1e9c4b['count'];var _0x52c8cb=_0x3fd3b9?0x0:_0x20894b[_0x9a45('0x30')];var _0x1b503a=_0x3fd3b9?_0x1e9c4b[_0x9a45('0x33')]:_0x20894b[_0x9a45('0x30')]+_0x20894b[_0x9a45('0x32')];var _0x508191;if(_0x1b503a>=_0x3e3114){_0x1b503a=_0x3e3114;_0x508191=0xc8;}else{_0x508191=0xce;}_0x57f965[_0x9a45('0x2d')](_0x508191);return _0x57f965['set'](_0x9a45('0x34'),_0x52c8cb+'-'+_0x1b503a+'/'+_0x3e3114)['json'](_0x1e9c4b);}return null;};}function patchUpdates(_0x280b23){return function(_0x57aec9){try{jsonpatch[_0x9a45('0x35')](_0x57aec9,_0x280b23,!![]);}catch(_0x2fe2a2){return BPromise[_0x9a45('0x36')](_0x2fe2a2);}return _0x57aec9[_0x9a45('0x37')]();};}function saveUpdates(_0x4459dd,_0x28cf06){return function(_0x33995d){if(_0x33995d){return _0x33995d[_0x9a45('0x38')](_0x4459dd)[_0x9a45('0x23')](function(_0x2c5675){return _0x2c5675;});}return null;};}function removeEntity(_0x35600c,_0x336a09){return function(_0x42a4c2){if(_0x42a4c2){return _0x42a4c2[_0x9a45('0x39')]()[_0x9a45('0x23')](function(){var _0x40973c=_0x42a4c2[_0x9a45('0x3a')]({'plain':!![]});var _0x22002a=_0x9a45('0x3b');return db[_0x9a45('0x3c')][_0x9a45('0x39')]({'where':{'type':_0x22002a,'resourceId':_0x40973c['id']}})[_0x9a45('0x23')](function(){return _0x42a4c2;});})[_0x9a45('0x23')](function(){_0x35600c[_0x9a45('0x2d')](0xcc)[_0x9a45('0x2e')]();});}};}function handleEntityNotFound(_0x3d3499,_0x3b1eb5){return function(_0x45f113){if(!_0x45f113){_0x3d3499[_0x9a45('0x2c')](0x194);}return _0x45f113;};}function handleError(_0x11e1c4,_0x91812c){_0x91812c=_0x91812c||0x1f4;return function(_0x231d11){logger['error'](_0x231d11[_0x9a45('0x3d')]);if(_0x231d11[_0x9a45('0x3e')]){delete _0x231d11[_0x9a45('0x3e')];}_0x11e1c4[_0x9a45('0x2d')](_0x91812c)[_0x9a45('0x3f')](_0x231d11);};}exports[_0x9a45('0x40')]=function(_0x41a15b,_0x2c0c86){var _0x18df90={'include':[{'model':db[_0x9a45('0x41')],'as':_0x9a45('0x42')}]},_0x513f93={},_0x2e08d7={'count':0x0,'rows':[]};var _0x13a77b=_[_0x9a45('0x43')](db[_0x9a45('0x44')]['rawAttributes'],function(_0x245da0){return{'name':_0x245da0['fieldName'],'type':_0x245da0[_0x9a45('0x45')]['key']};});_0x513f93[_0x9a45('0x46')]=_[_0x9a45('0x43')](_0x13a77b,_0x9a45('0x3e'));_0x513f93[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x41a15b['query']);_0x513f93[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x513f93[_0x9a45('0x46')],_0x513f93['query']);_0x18df90[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x513f93['model'],qs[_0x9a45('0x4c')](_0x41a15b[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x18df90[_0x9a45('0x4b')]=_0x18df90[_0x9a45('0x4b')]['length']?_0x18df90[_0x9a45('0x4b')]:_0x513f93[_0x9a45('0x46')];if(!_0x41a15b[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x18df90[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x41a15b[_0x9a45('0x47')]['limit']);_0x18df90[_0x9a45('0x30')]=qs[_0x9a45('0x30')](_0x41a15b['query'][_0x9a45('0x30')]);}_0x18df90[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x41a15b[_0x9a45('0x47')]['sort']);_0x18df90[_0x9a45('0x51')]=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0x41a15b[_0x9a45('0x47')],_0x513f93[_0x9a45('0x49')]),_0x13a77b);if(_0x41a15b[_0x9a45('0x47')]['filter']){_0x18df90[_0x9a45('0x51')]=_[_0x9a45('0x53')](_0x18df90[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x13a77b,function(_0x15bedc){if(_0x15bedc['type']!==_0x9a45('0x54')){var _0x5b6939={};_0x5b6939[_0x15bedc[_0x9a45('0x3e')]]={'$like':'%'+_0x41a15b['query']['filter']+'%'};return _0x5b6939;}})});}_0x18df90=_[_0x9a45('0x53')]({},_0x18df90,_0x41a15b[_0x9a45('0x55')]);var _0x21b5de={'where':_0x18df90[_0x9a45('0x51')]};return db[_0x9a45('0x44')][_0x9a45('0x33')](_0x21b5de)[_0x9a45('0x23')](function(_0x28bc1a){_0x2e08d7[_0x9a45('0x33')]=_0x28bc1a;if(_0x41a15b[_0x9a45('0x47')][_0x9a45('0x56')]){_0x18df90[_0x9a45('0x57')]=[{'all':!![]}];}return db[_0x9a45('0x44')][_0x9a45('0x58')](_0x18df90);})[_0x9a45('0x23')](function(_0x2e85a7){_0x2e08d7['rows']=_0x2e85a7;return _0x2e08d7;})[_0x9a45('0x23')](respondWithFilteredResult(_0x2c0c86,_0x18df90))[_0x9a45('0x59')](handleError(_0x2c0c86,null));};exports[_0x9a45('0x5a')]=function(_0x141159,_0x6e2ee7){var _0x128194={'raw':![],'where':{'id':_0x141159[_0x9a45('0x5b')]['id']},'include':[{'model':db[_0x9a45('0x41')],'as':_0x9a45('0x42')}]},_0x1fc4f7={};_0x1fc4f7[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x44')][_0x9a45('0x5c')]);_0x1fc4f7[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x141159[_0x9a45('0x47')]);_0x1fc4f7[_0x9a45('0x49')]=_['intersection'](_0x1fc4f7[_0x9a45('0x46')],_0x1fc4f7[_0x9a45('0x47')]);_0x128194[_0x9a45('0x4b')]=_['intersection'](_0x1fc4f7[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x141159['query'][_0x9a45('0x4c')]));_0x128194['attributes']=_0x128194['attributes'][_0x9a45('0x5d')]?_0x128194[_0x9a45('0x4b')]:_0x1fc4f7['model'];if(_0x141159['query'][_0x9a45('0x56')]){_0x128194[_0x9a45('0x57')]=[{'all':!![]}];}_0x128194=_[_0x9a45('0x53')]({},_0x128194,_0x141159['options']);return db[_0x9a45('0x44')]['find'](_0x128194)[_0x9a45('0x23')](handleEntityNotFound(_0x6e2ee7,null))[_0x9a45('0x23')](respondWithResult(_0x6e2ee7,null))[_0x9a45('0x59')](handleError(_0x6e2ee7,null));};exports['create']=function(_0x4ce984,_0x48617c){return db[_0x9a45('0x44')]['create'](_0x4ce984[_0x9a45('0x5e')],{})[_0x9a45('0x23')](function(_0x5b29cd){var _0x151a00=_0x4ce984[_0x9a45('0x5f')][_0x9a45('0x3a')]({'plain':!![]});if(!_0x151a00)throw new Error(_0x9a45('0x60'));if(_0x151a00['role']===_0x9a45('0x5f')){var _0x24a689=_0x5b29cd[_0x9a45('0x3a')]({'plain':!![]});var _0x1fc0b0=_0x9a45('0x3b');return db[_0x9a45('0x61')][_0x9a45('0x62')]({'where':{'name':_0x1fc0b0,'userProfileId':_0x151a00['userProfileId']},'raw':!![]})[_0x9a45('0x23')](function(_0x41a467){if(_0x41a467&&_0x41a467[_0x9a45('0x63')]===0x0){return db[_0x9a45('0x3c')][_0x9a45('0x64')]({'name':_0x24a689['name'],'resourceId':_0x24a689['id'],'type':_0x41a467[_0x9a45('0x3e')],'sectionId':_0x41a467['id']},{})[_0x9a45('0x23')](function(){return _0x5b29cd;});}else{return _0x5b29cd;}})['catch'](function(_0x4dbf54){logger['error'](_0x9a45('0x65'),_0x4dbf54);throw _0x4dbf54;});}return _0x5b29cd;})['then'](respondWithResult(_0x48617c,0xc9))[_0x9a45('0x59')](handleError(_0x48617c,null));};exports[_0x9a45('0x38')]=function(_0x1bd8a0,_0x39c683){if(_0x1bd8a0[_0x9a45('0x5e')]['id']){delete _0x1bd8a0[_0x9a45('0x5e')]['id'];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x1bd8a0['params']['id']},'include':[{'model':db[_0x9a45('0x41')],'as':_0x9a45('0x42')}]})['then'](handleEntityNotFound(_0x39c683,null))[_0x9a45('0x23')](saveUpdates(_0x1bd8a0[_0x9a45('0x5e')],null))[_0x9a45('0x23')](respondWithResult(_0x39c683,null))['catch'](handleError(_0x39c683,null));};exports[_0x9a45('0x39')]=function(_0x3ab2f9,_0x35a1ab){return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x3ab2f9[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x35a1ab,null))[_0x9a45('0x23')](removeEntity(_0x35a1ab,null))['catch'](handleError(_0x35a1ab,null));};exports[_0x9a45('0x66')]=function(_0x2a2fad,_0x25c130){return db[_0x9a45('0x44')][_0x9a45('0x66')]()[_0x9a45('0x23')](respondWithResult(_0x25c130,null))['catch'](handleError(_0x25c130,null));};exports[_0x9a45('0x67')]=function(_0x3502da,_0x583c99,_0x1dba7b){if(_0x3502da[_0x9a45('0x5e')]['id']){delete _0x3502da[_0x9a45('0x5e')]['id'];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x3502da[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x583c99,null))[_0x9a45('0x23')](function(_0x4cb20c){if(_0x4cb20c){_0x3502da['body'][_0x9a45('0x68')]=_0x4cb20c['id'];return db[_0x9a45('0x69')][_0x9a45('0x64')](_0x3502da[_0x9a45('0x5e')]);}})[_0x9a45('0x23')](respondWithResult(_0x583c99,null))[_0x9a45('0x59')](handleError(_0x583c99,null));};exports['getDispositions']=function(_0x311f05,_0x2d02c8,_0xef089d){var _0x46f76f={'raw':![],'where':{}};var _0x2d2e65={};var _0x3dd8f8={'count':0x0,'rows':[]};return db[_0x9a45('0x44')]['findOne']({'where':{'id':_0x311f05[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x2d02c8,null))[_0x9a45('0x23')](function(_0xd24dcb){if(_0xd24dcb){_0x2d2e65[_0x9a45('0x46')]=_[_0x9a45('0x48')](db['Disposition']['rawAttributes']);_0x2d2e65[_0x9a45('0x47')]=_['keys'](_0x311f05[_0x9a45('0x47')]);_0x2d2e65['filters']=_[_0x9a45('0x4a')](_0x2d2e65[_0x9a45('0x46')],_0x2d2e65[_0x9a45('0x47')]);_0x46f76f['attributes']=_[_0x9a45('0x4a')](_0x2d2e65[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x311f05[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x46f76f[_0x9a45('0x4b')]=_0x46f76f[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x46f76f[_0x9a45('0x4b')]:_0x2d2e65[_0x9a45('0x46')];if(!_0x311f05[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x46f76f[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x311f05[_0x9a45('0x47')][_0x9a45('0x32')]);_0x46f76f['offset']=qs[_0x9a45('0x30')](_0x311f05[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x46f76f[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x311f05[_0x9a45('0x47')]['sort']);_0x46f76f['where']=qs[_0x9a45('0x49')](_['pick'](_0x311f05[_0x9a45('0x47')],_0x2d2e65[_0x9a45('0x49')]));_0x46f76f[_0x9a45('0x51')][_0x9a45('0x68')]=_0xd24dcb['id'];if(_0x311f05[_0x9a45('0x47')]['filter']){_0x46f76f['where']=_[_0x9a45('0x53')](_0x46f76f[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x46f76f[_0x9a45('0x4b')],function(_0x31fa17){var _0x5149bd={};_0x5149bd[_0x31fa17]={'$like':'%'+_0x311f05[_0x9a45('0x47')][_0x9a45('0x6a')]+'%'};return _0x5149bd;})});}_0x46f76f=_[_0x9a45('0x53')]({},_0x46f76f,_0x311f05[_0x9a45('0x55')]);return db[_0x9a45('0x69')][_0x9a45('0x33')]({'where':_0x46f76f[_0x9a45('0x51')]})[_0x9a45('0x23')](function(_0x2f0fcf){_0x3dd8f8['count']=_0x2f0fcf;if(_0x311f05[_0x9a45('0x47')][_0x9a45('0x56')]){_0x46f76f[_0x9a45('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x9a45('0x58')](_0x46f76f);})[_0x9a45('0x23')](function(_0x4ee44a){_0x3dd8f8[_0x9a45('0x6b')]=_0x4ee44a;return _0x3dd8f8;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x2d02c8,_0x46f76f))['catch'](handleError(_0x2d02c8,null));};exports['removeDispositions']=function(_0x28c5d9,_0x5ac278,_0x248deb){return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x28c5d9['params']['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x5ac278,null))[_0x9a45('0x23')](function(_0x1c7a4a){if(_0x1c7a4a){return _0x1c7a4a[_0x9a45('0x6c')](_0x28c5d9['query'][_0x9a45('0x6d')]);}})[_0x9a45('0x23')](respondWithStatusCode(_0x5ac278,null))[_0x9a45('0x59')](handleError(_0x5ac278,null));};exports[_0x9a45('0x6e')]=function(_0x2b3116,_0x311ec6,_0xc84f80){if(_0x2b3116[_0x9a45('0x5e')]['id']){delete _0x2b3116[_0x9a45('0x5e')]['id'];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x2b3116[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x311ec6,null))['then'](function(_0x15eca1){if(_0x15eca1){_0x2b3116[_0x9a45('0x5e')][_0x9a45('0x68')]=_0x15eca1['id'];return db[_0x9a45('0x6f')][_0x9a45('0x64')](_0x2b3116[_0x9a45('0x5e')]);}})[_0x9a45('0x23')](respondWithResult(_0x311ec6,null))[_0x9a45('0x59')](handleError(_0x311ec6,null));};exports[_0x9a45('0x70')]=function(_0x36c6e6,_0x20ba85,_0xb4ed08){var _0x16dda1={'raw':![],'where':{}};var _0x4448b2={};var _0x2301b9={'count':0x0,'rows':[]};return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0x36c6e6[_0x9a45('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20ba85,null))[_0x9a45('0x23')](function(_0x2150e5){if(_0x2150e5){_0x4448b2[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x6f')][_0x9a45('0x5c')]);_0x4448b2[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x36c6e6[_0x9a45('0x47')]);_0x4448b2[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x4448b2[_0x9a45('0x46')],_0x4448b2[_0x9a45('0x47')]);_0x16dda1[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x4448b2[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x16dda1[_0x9a45('0x4b')]=_0x16dda1['attributes']['length']?_0x16dda1[_0x9a45('0x4b')]:_0x4448b2[_0x9a45('0x46')];if(!_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x16dda1[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x32')]);_0x16dda1[_0x9a45('0x30')]=qs['offset'](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x16dda1[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x50')]);_0x16dda1[_0x9a45('0x51')]=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0x36c6e6['query'],_0x4448b2['filters']));_0x16dda1['where'][_0x9a45('0x68')]=_0x2150e5['id'];if(_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x16dda1['where']=_['merge'](_0x16dda1[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x16dda1[_0x9a45('0x4b')],function(_0x39238b){var _0x5f3c95={};_0x5f3c95[_0x39238b]={'$like':'%'+_0x36c6e6[_0x9a45('0x47')]['filter']+'%'};return _0x5f3c95;})});}_0x16dda1=_['merge']({},_0x16dda1,_0x36c6e6['options']);return db[_0x9a45('0x6f')]['count']({'where':_0x16dda1[_0x9a45('0x51')]})['then'](function(_0x39bce7){_0x2301b9[_0x9a45('0x33')]=_0x39bce7;if(_0x36c6e6[_0x9a45('0x47')][_0x9a45('0x56')]){_0x16dda1[_0x9a45('0x57')]=[{'all':!![]}];}return db[_0x9a45('0x6f')][_0x9a45('0x58')](_0x16dda1);})[_0x9a45('0x23')](function(_0x34462d){_0x2301b9['rows']=_0x34462d;return _0x2301b9;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x20ba85,_0x16dda1))[_0x9a45('0x59')](handleError(_0x20ba85,null));};exports['removeAnswers']=function(_0x1f785d,_0xf057b0,_0x2a4aee){return db[_0x9a45('0x44')]['find']({'where':{'id':_0x1f785d[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0xf057b0,null))[_0x9a45('0x23')](function(_0x20f41b){if(_0x20f41b){return _0x20f41b['removeAnswers'](_0x1f785d['query'][_0x9a45('0x6d')]);}})['then'](respondWithStatusCode(_0xf057b0,null))[_0x9a45('0x59')](handleError(_0xf057b0,null));};exports[_0x9a45('0x72')]=function(_0x488aef,_0xb4899c,_0x4c5d4f){return db[_0x9a45('0x73')][_0x9a45('0x62')]({'where':{'id':_0x488aef[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0xb4899c,null))[_0x9a45('0x23')](function(_0x6607f8){if(_0x6607f8){return _0x6607f8[_0x9a45('0x72')](_0x488aef[_0x9a45('0x5e')]['ids'],_['omit'](_0x488aef['body'],[_0x9a45('0x6d'),'id'])||{});}})[_0x9a45('0x23')](respondWithResult(_0xb4899c,null))[_0x9a45('0x59')](handleError(_0xb4899c,null));};exports['getInteractions']=function(_0x2b9594,_0x17ea55,_0x243c67){var _0x342e0a={'raw':![],'where':{}};var _0x2a9eff={};var _0x47e0ed={'count':0x0,'rows':[]};return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0x2b9594[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x17ea55,null))[_0x9a45('0x23')](function(_0x1883b2){if(_0x1883b2){_0x2a9eff['model']=_[_0x9a45('0x48')](db['FaxInteraction'][_0x9a45('0x5c')]);_0x2a9eff['query']=_['keys'](_0x2b9594[_0x9a45('0x47')]);_0x2a9eff['filters']=_[_0x9a45('0x4a')](_0x2a9eff[_0x9a45('0x46')],_0x2a9eff[_0x9a45('0x47')]);_0x342e0a[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x2a9eff[_0x9a45('0x46')],qs['fields'](_0x2b9594[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x342e0a['attributes']=_0x342e0a['attributes']['length']?_0x342e0a[_0x9a45('0x4b')]:_0x2a9eff[_0x9a45('0x46')];if(!_0x2b9594[_0x9a45('0x47')][_0x9a45('0x4d')]('nolimit')){_0x342e0a[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x2b9594[_0x9a45('0x47')]['limit']);_0x342e0a[_0x9a45('0x30')]=qs[_0x9a45('0x30')](_0x2b9594[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x342e0a[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x2b9594[_0x9a45('0x47')]['sort']);_0x342e0a['where']=qs['filters'](_[_0x9a45('0x52')](_0x2b9594[_0x9a45('0x47')],_0x2a9eff[_0x9a45('0x49')]));_0x342e0a['where'][_0x9a45('0x68')]=_0x1883b2['id'];if(_0x2b9594[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x342e0a['where']=_[_0x9a45('0x53')](_0x342e0a[_0x9a45('0x51')],{'$or':_[_0x9a45('0x43')](_0x342e0a[_0x9a45('0x4b')],function(_0x32c184){var _0x48e2f4={};_0x48e2f4[_0x32c184]={'$like':'%'+_0x2b9594[_0x9a45('0x47')][_0x9a45('0x6a')]+'%'};return _0x48e2f4;})});}_0x342e0a=_[_0x9a45('0x53')]({},_0x342e0a,_0x2b9594['options']);return db['FaxInteraction'][_0x9a45('0x33')]({'where':_0x342e0a[_0x9a45('0x51')]})['then'](function(_0x19ba65){_0x47e0ed[_0x9a45('0x33')]=_0x19ba65;if(_0x2b9594['query'][_0x9a45('0x56')]){_0x342e0a[_0x9a45('0x57')]=[{'model':db[_0x9a45('0x74')],'as':'Contact','required':![]},{'model':db[_0x9a45('0x75')],'as':_0x9a45('0x76'),'attributes':[_0x9a45('0x3e'),'fullname',_0x9a45('0x77')],'required':![]},{'model':db['Tag'],'as':_0x9a45('0x78'),'attributes':['id',_0x9a45('0x3e'),_0x9a45('0x79')],'where':_0x2b9594[_0x9a45('0x47')][_0x9a45('0x7a')]?{'id':_0x2b9594['query']['tag']}:undefined,'required':_0x2b9594[_0x9a45('0x47')][_0x9a45('0x7a')]?!![]:![]}];}return db[_0x9a45('0x73')][_0x9a45('0x58')](_0x342e0a);})[_0x9a45('0x23')](function(_0x22724b){_0x47e0ed[_0x9a45('0x6b')]=_0x22724b;return _0x47e0ed;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x17ea55,_0x342e0a))[_0x9a45('0x59')](handleError(_0x17ea55,null));};exports[_0x9a45('0x7b')]=function(_0x43cb27,_0x314282){var _0xe106f3=_0x43cb27[_0x9a45('0x5b')]['id'];var _0x286199=_0x43cb27[_0x9a45('0x5e')];var _0x2527ec=0xc8;var _0x2b49e9=null;return db[_0x9a45('0x7c')]['transaction']({'isolationLevel':db[_0x9a45('0x7c')][_0x9a45('0x7d')][_0x9a45('0x7e')][_0x9a45('0x7f')]},function(_0x2f083c){return db[_0x9a45('0x44')]['findOne']({'where':{'id':_0xe106f3},'transaction':_0x2f083c})[_0x9a45('0x23')](function(_0x4626bb){if(_0x4626bb){return db['FaxApplication'][_0x9a45('0x39')]({'where':{'FaxAccountId':_0xe106f3},'transaction':_0x2f083c})[_0x9a45('0x23')](function(){var _0x5878dd=_[_0x9a45('0x43')](_0x286199,function(_0x5111af){_0x5111af[_0x9a45('0x68')]=_0xe106f3;return _0x5111af;});return db[_0x9a45('0x80')][_0x9a45('0x81')](_0x5878dd,{'transaction':_0x2f083c});});}else{_0x2527ec=0x194;_0x2b49e9=[];}});})[_0x9a45('0x23')](function(){if(_0x2527ec!==0x194){return db['FaxApplication'][_0x9a45('0x82')]({'where':{'FaxAccountId':_0xe106f3},'order':_0x9a45('0x83')})[_0x9a45('0x23')](function(_0x2a5c11){_0x2b49e9=_0x2a5c11;});}})['catch'](function(_0x669d30){_0x2527ec=0x1f4;logger[_0x9a45('0x28')](_0x669d30['stack']);if(_0x669d30[_0x9a45('0x3e')]){delete _0x669d30['name'];}_0x2b49e9=_0x669d30;})[_0x9a45('0x84')](function(){if(_0x2b49e9===null){_0x314282[_0x9a45('0x2c')](_0x2527ec);}else{if(_0x2527ec===0x1f4){_0x314282[_0x9a45('0x2d')](_0x2527ec)[_0x9a45('0x3f')](_0x2b49e9);}else{_0x314282[_0x9a45('0x2d')](_0x2527ec)[_0x9a45('0x2f')](_0x2b49e9);}}});};exports['getApplications']=function(_0xd38736,_0x245c0a,_0x5adb2e){var _0x38aaa8={};var _0x38695f={};var _0x3255cc;var _0x192e58;return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0xd38736[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x245c0a,null))['then'](function(_0x392759){if(_0x392759){_0x3255cc=_0x392759;_0x38695f[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x80')]['rawAttributes']);_0x38695f['query']=_['keys'](_0xd38736['query']);_0x38695f[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x38695f['model'],_0x38695f[_0x9a45('0x47')]);_0x38aaa8[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x38695f[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0xd38736[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x38aaa8[_0x9a45('0x4b')]=_0x38aaa8[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x38aaa8[_0x9a45('0x4b')]:_0x38695f[_0x9a45('0x46')];_0x38aaa8[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0xd38736[_0x9a45('0x47')][_0x9a45('0x50')]);_0x38aaa8[_0x9a45('0x51')]=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0xd38736[_0x9a45('0x47')],_0x38695f[_0x9a45('0x49')]));if(_0xd38736[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x38aaa8['where']=_[_0x9a45('0x53')](_0x38aaa8[_0x9a45('0x51')],{'$or':_['map'](_0x38aaa8[_0x9a45('0x4b')],function(_0x458322){var _0x3f7f65={};_0x3f7f65[_0x458322]={'$like':'%'+_0xd38736['query'][_0x9a45('0x6a')]+'%'};return _0x3f7f65;})});}_0x38aaa8=_[_0x9a45('0x53')]({},_0x38aaa8,_0xd38736[_0x9a45('0x55')]);return _0x3255cc['getApplications'](_0x38aaa8);}})[_0x9a45('0x23')](function(_0x471893){if(_0x471893){_0x192e58=_0x471893[_0x9a45('0x5d')];if(!_0xd38736[_0x9a45('0x47')][_0x9a45('0x4d')]('nolimit')){_0x38aaa8[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0xd38736['query']['limit']);_0x38aaa8['offset']=qs[_0x9a45('0x30')](_0xd38736[_0x9a45('0x47')][_0x9a45('0x30')]);}return _0x3255cc[_0x9a45('0x85')](_0x38aaa8);}})[_0x9a45('0x23')](function(_0x5d54e0){if(_0x5d54e0){return _0x5d54e0?{'count':_0x192e58,'rows':_0x5d54e0}:null;}})[_0x9a45('0x23')](respondWithResult(_0x245c0a,null))['catch'](handleError(_0x245c0a,null));};function Extension(_0xc99a5d,_0x517778,_0x3032d8,_0x4c5782){this[_0x9a45('0x86')]=_0x9a45('0x87');this[_0x9a45('0x88')]=_0xc99a5d[_0x9a45('0x89')];this[_0x9a45('0x8a')]=_0x4c5782;this[_0x9a45('0x45')]=_0x9a45('0x8b');this[_0x9a45('0x8c')]=_0x9a45('0x8d');this[_0x9a45('0x68')]=_0xc99a5d['id'];this[_0x9a45('0x83')]=_0x517778;this[_0x9a45('0x8e')]=_0x3032d8;}function createExtensionsReciveFax(_0x2c71bd){var _0x284741=0x1;var _0x3370f5=[];_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,'',_0x9a45('0x90')));_0x284741+=0x1;_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,_0x9a45('0x91'),_0x9a45('0x92')));_0x284741+=0x1;for(var _0x442b2e in _0x2c71bd){if(_0x2c71bd[_0x9a45('0x4d')](_0x442b2e)&&(_0x442b2e===_0x9a45('0x93')||_0x442b2e===_0x9a45('0x89')||_0x442b2e==='gateway'||_0x442b2e===_0x9a45('0x94')||_0x442b2e==='headerinfo'||_0x442b2e===_0x9a45('0x95')||_0x442b2e==='minrate'||_0x442b2e==='modem'||_0x442b2e===_0x9a45('0x96'))){_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,_0x9a45('0x97')+_0x442b2e+')='+_0x2c71bd[_0x442b2e],_0x9a45('0x92')));_0x284741+=0x1;}}_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,'6',_0x9a45('0x98')));_0x284741+=0x1;_0x3370f5[_0x9a45('0x8f')](new Extension(_0x2c71bd,_0x284741,'/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',_0x9a45('0x99')));_0x284741=0x0;return _0x3370f5;}exports[_0x9a45('0x9a')]=function(_0x514b2f,_0x5c4b4a,_0x3acecc){var _0x14a37b;return db[_0x9a45('0x7c')][_0x9a45('0x9b')](function(_0x5f0042){return db[_0x9a45('0x44')][_0x9a45('0x64')](_0x514b2f[_0x9a45('0x5e')],{'transaction':_0x5f0042})[_0x9a45('0x23')](function(_0x15b5f7){_0x14a37b=_0x15b5f7[_0x9a45('0x3a')]({'plain':!![]});return db[_0x9a45('0x9c')][_0x9a45('0x81')](createExtensionsReciveFax(_0x14a37b),{'transaction':_0x5f0042});});})[_0x9a45('0x23')](function(){return _0x14a37b;})[_0x9a45('0x23')](respondWithResult(_0x5c4b4a,null))[_0x9a45('0x59')](handleError(_0x5c4b4a,null));};exports[_0x9a45('0x9d')]=function(_0x9a013e,_0x581be0,_0x4d6282){var _0x5cfd96;return db['sequelize']['transaction'](function(_0x1fd0d6){return db[_0x9a45('0x44')][_0x9a45('0x38')](_0x9a013e['body'],{'where':{'id':_0x9a013e['body']['id']},'transaction':_0x1fd0d6})[_0x9a45('0x23')](function(_0x423c93){return db[_0x9a45('0x9c')][_0x9a45('0x39')]({'where':{'FaxAccountId':_0x9a013e[_0x9a45('0x5e')]['id']},'transaction':_0x1fd0d6})['then'](function(_0x35c6bc){return db[_0x9a45('0x9c')][_0x9a45('0x81')](createExtensionsReciveFax(_[_0x9a45('0x9e')](_0x9a013e[_0x9a45('0x5e')],[_0x9a45('0x9f'),_0x9a45('0xa0'),_0x9a45('0xa1'),_0x9a45('0xa2'),_0x9a45('0xa3'),_0x9a45('0xa4')])),{'transaction':_0x1fd0d6});});});})[_0x9a45('0x23')](function(){return db[_0x9a45('0x44')][_0x9a45('0xa5')](_0x9a013e[_0x9a45('0x5e')]['id']);})[_0x9a45('0x23')](respondWithResult(_0x581be0,null))['catch'](handleError(_0x581be0,null));};exports[_0x9a45('0xa6')]=function(_0x3f31c1,_0x41a54d,_0x16802b){var _0x3f70d5={'raw':!![],'where':{}};var _0x20491c={};var _0x3819aa={'count':0x0,'rows':[]};return db[_0x9a45('0x44')][_0x9a45('0x71')]({'where':{'id':_0x3f31c1[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x41a54d,null))[_0x9a45('0x23')](function(_0x2713da){if(_0x2713da){_0x20491c[_0x9a45('0x46')]=_['keys'](db[_0x9a45('0xa7')][_0x9a45('0x5c')]);_0x20491c[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x3f31c1[_0x9a45('0x47')]);_0x20491c[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x20491c[_0x9a45('0x46')],_0x20491c[_0x9a45('0x47')]);_0x3f70d5[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x20491c[_0x9a45('0x46')],qs['fields'](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x3f70d5[_0x9a45('0x4b')]=_0x3f70d5[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x3f70d5[_0x9a45('0x4b')]:_0x20491c['model'];if(!_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x4d')](_0x9a45('0x4e'))){_0x3f70d5[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x32')]);_0x3f70d5[_0x9a45('0x30')]=qs[_0x9a45('0x30')](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x30')]);}_0x3f70d5[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x3f31c1[_0x9a45('0x47')][_0x9a45('0x50')]);_0x3f70d5['where']=qs['filters'](_['pick'](_0x3f31c1[_0x9a45('0x47')],_0x20491c[_0x9a45('0x49')]));_0x3f70d5['where'][_0x9a45('0x68')]=_0x2713da['id'];if(_0x3f31c1[_0x9a45('0x47')]['filter']){_0x3f70d5[_0x9a45('0x51')]=_[_0x9a45('0x53')](_0x3f70d5['where'],{'$or':_[_0x9a45('0x43')](_0x3f70d5[_0x9a45('0x4b')],function(_0x58ae15){var _0x35b7dd={};_0x35b7dd[_0x58ae15]={'$like':'%'+_0x3f31c1['query']['filter']+'%'};return _0x35b7dd;})});}if(_0x3f31c1[_0x9a45('0x47')][_0x9a45('0xa8')]){var _0x27ecdc=_0x3f31c1[_0x9a45('0x47')]['$gte'][_0x9a45('0xa9')](',');var _0x1586cb={};_0x1586cb[_0x27ecdc[0x0]]={'$gte':moment(_0x27ecdc[0x1])[_0x9a45('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f70d5[_0x9a45('0x51')]=_['merge'](_0x3f70d5[_0x9a45('0x51')],_0x1586cb);}_0x3f70d5=_[_0x9a45('0x53')]({},_0x3f70d5,_0x3f31c1[_0x9a45('0x55')]);return db[_0x9a45('0xa7')][_0x9a45('0x33')]({'where':_0x3f70d5['where']})['then'](function(_0x1722a1){_0x3819aa[_0x9a45('0x33')]=_0x1722a1;if(_0x3f31c1[_0x9a45('0x47')]['includeAll']){_0x3f70d5[_0x9a45('0x57')]=[{'all':!![]}];}return db[_0x9a45('0xa7')][_0x9a45('0x58')](_0x3f70d5);})['then'](function(_0x5f2a29){_0x3819aa[_0x9a45('0x6b')]=_0x5f2a29;return _0x3819aa;});}})[_0x9a45('0x23')](respondWithFilteredResult(_0x41a54d,_0x3f70d5))[_0x9a45('0x59')](handleError(_0x41a54d,null));};exports[_0x9a45('0x3f')]=function(_0x344941,_0x108115,_0x1d4dfb){var _0x56fd21,_0x1bfc62={},_0x3742e3;if(_0x344941[_0x9a45('0x5e')]['to']){_0x3742e3=_0x344941[_0x9a45('0x5e')]['to'][0x0];}return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x344941['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9a45('0x74')],'as':_0x9a45('0xab'),'where':{'fax':_0x3742e3},'limit':0x1,'order':[[_0x9a45('0xa2'),_0x9a45('0xac')]]}]}]})[_0x9a45('0x23')](handleEntityNotFound(_0x108115,null))[_0x9a45('0x23')](function(_0x3ad724){_0x56fd21=_0x3ad724;if(_0x344941['body'][_0x9a45('0xad')]&&_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][_0x9a45('0x5d')]){for(var _0x169b16=0x0;_0x169b16<_0x344941[_0x9a45('0x5e')]['attachments']['length'];_0x169b16+=0x1){_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][_0x169b16]={'filename':_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][_0x169b16][_0x9a45('0x3e')],'id':_0x344941[_0x9a45('0x5e')]['attachments'][_0x169b16]['id'],'path':path['join'](config[_0x9a45('0xae')],_0x9a45('0xaf'),_0x344941[_0x9a45('0x5e')]['attachments'][_0x169b16]['basename'])};}}return respondWithRpcPromise(_0x9a45('0xb0'),_0x9a45('0xb0'),{'FaxAccountId':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5b')]['id'])?undefined:_0x344941['params']['id'],'path':_['isNil'](_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0][_0x9a45('0x6')])?undefined:_0x344941[_0x9a45('0x5e')]['attachments'][0x0][_0x9a45('0x6')],'fax':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5e')]['to'][0x0])?undefined:_0x344941[_0x9a45('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x56fd21){if(_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5e')][_0x9a45('0xb2')])){_0x344941[_0x9a45('0x5e')][_0x9a45('0xb2')]=util[_0x9a45('0xaa')](_0x9a45('0xb3'),_0x56fd21[_0x9a45('0x3e')],_0x56fd21[_0x9a45('0xb4')]);}if(_0x56fd21[_0x9a45('0xb5')]){if(_0x56fd21[_0x9a45('0xb5')][_0x9a45('0xab')][_0x9a45('0x5d')]){return _0x56fd21['List'][_0x9a45('0xab')][0x0];}else{return db[_0x9a45('0x74')][_0x9a45('0x64')](_[_0x9a45('0x1c')](_0x344941[_0x9a45('0x5e')],{'firstName':_0x344941[_0x9a45('0x5e')]['to'][0x0],'phone':_0x344941[_0x9a45('0x5e')]['to'][0x0],'fax':_0x344941['body']['to'][0x0],'ListId':_0x56fd21[_0x9a45('0xa4')]}));}}else{throw new Error(_0x9a45('0xb6'));}}else{throw new Error(_0x9a45('0xb7'));}})[_0x9a45('0x23')](function(_0x2eef85){if(_0x2eef85){return db['FaxInteraction'][_0x9a45('0x62')]({'where':{'ContactId':_0x2eef85['id'],'closed':![],'FaxAccountId':_0x56fd21['id']}})[_0x9a45('0x23')](function(_0x15139e){if(_0x15139e){return[_0x15139e,![]];}return db['FaxInteraction'][_0x9a45('0x64')]({'UserId':_0x344941[_0x9a45('0x5f')]['id'],'ContactId':_0x2eef85['id'],'FaxAccountId':_0x56fd21['id'],'fax':_0x344941[_0x9a45('0x5e')]['to'][0x0],'firstMsgDirection':_0x9a45('0xb8'),'Messages':[_[_0x9a45('0x53')](_0x344941['body'],{'read':![],'body':_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0][_0x9a45('0xb9')],'FaxAccountId':_0x56fd21['id'],'UserId':_0x344941[_0x9a45('0x5f')]['id'],'ContactId':_0x2eef85['id'],'AttachmentId':_0x344941['body'][_0x9a45('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x9a45('0xba')}]})[_0x9a45('0x23')](function(_0x355e2a){return[_0x355e2a,!![]];});});}else{throw new Error(_0x9a45('0xbb'));}})['spread'](function(_0xf8c2,_0x4a719f){if(_0x4a719f){return _0xf8c2;}return db[_0x9a45('0xa7')][_0x9a45('0x64')]({'direction':'out','read':![],'body':_0x344941[_0x9a45('0x5e')]['attachments'][0x0][_0x9a45('0xb9')],'FaxAccountId':_0x56fd21['id'],'FaxInteractionId':_0xf8c2['id'],'UserId':_0x344941[_0x9a45('0x5f')]['id'],'ContactId':_0xf8c2[_0x9a45('0xbc')],'AttachmentId':_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0]['id']})[_0x9a45('0x23')](function(_0x58e8d1){_0xf8c2[_0x9a45('0xbd')][_0x9a45('0xba')]=[];_0xf8c2[_0x9a45('0xbd')]['Messages'][_0x9a45('0x8f')](_0x58e8d1[_0x9a45('0xbd')]);return _0xf8c2;});})['then'](function(_0x248104){respondWithRpcPromise(_0x9a45('0xbe'),'SendFax',{'FaxAccountId':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5b')]['id'])?undefined:_0x344941['params']['id'],'path':_[_0x9a45('0xb1')](_0x344941[_0x9a45('0x5e')]['attachments'][0x0]['path'])?undefined:_0x344941[_0x9a45('0x5e')][_0x9a45('0xad')][0x0]['path'],'fax':_['isNil'](_0x344941[_0x9a45('0x5e')]['to'][0x0])?undefined:_0x344941[_0x9a45('0x5e')]['to'][0x0],'AttachmentId':_0x344941['body']['attachments'][0x0]['id']},client9002)['then'](function(_0x39419b){logger['info']('SendFaxRpc,\x20%s',_0x39419b);})[_0x9a45('0x59')](function(_0x4a155e){logger[_0x9a45('0x24')]('SendFaxRpc,\x20%s',_0x4a155e);});return _0x248104;})['then'](respondWithResult(_0x108115,null))[_0x9a45('0x59')](handleError(_0x108115,null));};exports[_0x9a45('0xbf')]=function(_0x20634a,_0x431a57,_0x585c14){return db['FaxAccount'][_0x9a45('0x62')]({'where':{'id':_0x20634a[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x431a57,null))[_0x9a45('0x23')](function(_0x42f71c){if(_0x42f71c){return _0x42f71c['addAgents'](_0x20634a[_0x9a45('0x5e')][_0x9a45('0x6d')],_[_0x9a45('0x9e')](_0x20634a[_0x9a45('0x5e')],[_0x9a45('0x6d'),'id'])||{})[_0x9a45('0xc0')](function(_0x1fb51b){for(var _0x5c83e6=0x0;_0x5c83e6<_0x20634a[_0x9a45('0x5e')][_0x9a45('0x6d')]['length'];_0x5c83e6+=0x1){socket[_0x9a45('0xc1')](_0x9a45('0xc2'),{'UserId':Number(_0x20634a[_0x9a45('0x5e')][_0x9a45('0x6d')][_0x5c83e6]),'FaxAccountId':Number(_0x20634a[_0x9a45('0x5b')]['id'])});}return _0x1fb51b;});}})['then'](respondWithResult(_0x431a57,null))[_0x9a45('0x59')](handleError(_0x431a57,null));};exports['removeAgents']=function(_0x44166b,_0x1781e7,_0x4fc4d5){return db[_0x9a45('0x44')][_0x9a45('0x62')]({'where':{'id':_0x44166b[_0x9a45('0x5b')]['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x1781e7,null))[_0x9a45('0x23')](function(_0xe88084){if(_0xe88084){return _0xe88084[_0x9a45('0xc3')](_0x44166b[_0x9a45('0x47')]['ids'])[_0x9a45('0x23')](function(){if(_[_0x9a45('0xc4')](_0x44166b[_0x9a45('0x47')][_0x9a45('0x6d')])){for(var _0x1ebb34=0x0;_0x1ebb34<_0x44166b[_0x9a45('0x47')][_0x9a45('0x6d')][_0x9a45('0x5d')];_0x1ebb34+=0x1){socket[_0x9a45('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x44166b[_0x9a45('0x47')]['ids'][_0x1ebb34]),'FaxAccountId':Number(_0x44166b['params']['id'])});}}else{socket[_0x9a45('0xc1')](_0x9a45('0xc5'),{'UserId':Number(_0x44166b['query'][_0x9a45('0x6d')]),'FaxAccountId':Number(_0x44166b[_0x9a45('0x5b')]['id'])});}});}})[_0x9a45('0x23')](respondWithStatusCode(_0x1781e7,null))[_0x9a45('0x59')](handleError(_0x1781e7,null));};exports[_0x9a45('0xc6')]=function(_0x2defe0,_0x574c8b,_0x484657){var _0x72eaa8={};var _0x48341e={};var _0x3398b9;var _0x4171a6;return db[_0x9a45('0x44')]['findOne']({'where':{'id':_0x2defe0['params']['id']}})[_0x9a45('0x23')](handleEntityNotFound(_0x574c8b,null))[_0x9a45('0x23')](function(_0x5c6c41){if(_0x5c6c41){_0x3398b9=_0x5c6c41;_0x48341e[_0x9a45('0x46')]=_[_0x9a45('0x48')](db[_0x9a45('0x75')][_0x9a45('0x5c')]);_0x48341e[_0x9a45('0x47')]=_[_0x9a45('0x48')](_0x2defe0[_0x9a45('0x47')]);_0x48341e[_0x9a45('0x49')]=_[_0x9a45('0x4a')](_0x48341e[_0x9a45('0x46')],_0x48341e[_0x9a45('0x47')]);_0x72eaa8[_0x9a45('0x4b')]=_[_0x9a45('0x4a')](_0x48341e[_0x9a45('0x46')],qs[_0x9a45('0x4c')](_0x2defe0[_0x9a45('0x47')][_0x9a45('0x4c')]));_0x72eaa8[_0x9a45('0x4b')]=_0x72eaa8[_0x9a45('0x4b')][_0x9a45('0x5d')]?_0x72eaa8['attributes']:_0x48341e[_0x9a45('0x46')];_0x72eaa8[_0x9a45('0x4f')]=qs[_0x9a45('0x50')](_0x2defe0[_0x9a45('0x47')]['sort']);_0x72eaa8['where']=qs[_0x9a45('0x49')](_[_0x9a45('0x52')](_0x2defe0['query'],_0x48341e['filters']));if(_0x2defe0[_0x9a45('0x47')][_0x9a45('0x6a')]){_0x72eaa8[_0x9a45('0x51')]=_[_0x9a45('0x53')](_0x72eaa8[_0x9a45('0x51')],{'$or':_['map'](_0x72eaa8[_0x9a45('0x4b')],function(_0x804970){var _0x20c15b={};_0x20c15b[_0x804970]={'$like':'%'+_0x2defe0['query']['filter']+'%'};return _0x20c15b;})});}_0x72eaa8=_[_0x9a45('0x53')]({},_0x72eaa8,_0x2defe0[_0x9a45('0x55')]);return _0x3398b9[_0x9a45('0xc6')](_0x72eaa8);}})[_0x9a45('0x23')](function(_0x4e4cee){if(_0x4e4cee){_0x4171a6=_0x4e4cee[_0x9a45('0x5d')];if(!_0x2defe0[_0x9a45('0x47')][_0x9a45('0x4d')]('nolimit')){_0x72eaa8[_0x9a45('0x32')]=qs['limit'](_0x2defe0[_0x9a45('0x47')]['limit']);_0x72eaa8[_0x9a45('0x30')]=qs['offset'](_0x2defe0[_0x9a45('0x47')]['offset']);}return _0x3398b9[_0x9a45('0xc6')](_0x72eaa8);}})['then'](function(_0x2684fd){if(_0x2684fd){return _0x2684fd?{'count':_0x4171a6,'rows':_0x2684fd}:null;}})['then'](respondWithResult(_0x574c8b,null))[_0x9a45('0x59')](handleError(_0x574c8b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 935e873..00058e2 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 _0xad59=['FaxAccount','setMaxListeners','update','remove','emit','hook','events'];(function(_0x2d719c,_0x59b346){var _0x16c7e8=function(_0x2cd5a8){while(--_0x2cd5a8){_0x2d719c['push'](_0x2d719c['shift']());}};_0x16c7e8(++_0x59b346);}(_0xad59,0x84));var _0x9ad5=function(_0x3c6589,_0x544590){_0x3c6589=_0x3c6589-0x0;var _0x47e86f=_0xad59[_0x3c6589];return _0x47e86f;};'use strict';var EventEmitter=require(_0x9ad5('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x9ad5('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9ad5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9ad5('0x3'),'afterDestroy':_0x9ad5('0x4')};function emitEvent(_0xc96280){return function(_0x4d53c9,_0x1bb54e,_0x1a584e){FaxAccountEvents[_0x9ad5('0x5')](_0xc96280+':'+_0x4d53c9['id'],_0x4d53c9);FaxAccountEvents[_0x9ad5('0x5')](_0xc96280,_0x4d53c9);_0x1a584e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9ad5('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xb40d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1d41a5,_0x24c811){var _0xe0f359=function(_0x3d7c4d){while(--_0x3d7c4d){_0x1d41a5['push'](_0x1d41a5['shift']());}};_0xe0f359(++_0x24c811);}(_0xb40d,0xc8));var _0xdb40=function(_0x4dd56c,_0x3841c2){_0x4dd56c=_0x4dd56c-0x0;var _0x15eb34=_0xb40d[_0x4dd56c];return _0x15eb34;};'use strict';var EventEmitter=require(_0xdb40('0x0'));var FaxAccount=require(_0xdb40('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdb40('0x2')](0x0);var events={'afterCreate':_0xdb40('0x3'),'afterUpdate':_0xdb40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x272601){return function(_0x5888c9,_0x8f71a4,_0x47311a){FaxAccountEvents['emit'](_0x272601+':'+_0x5888c9['id'],_0x5888c9);FaxAccountEvents[_0xdb40('0x5')](_0x272601,_0x5888c9);_0x47311a(null);};}for(var e in events){if(events[_0xdb40('0x6')](e)){var event=events[e];FaxAccount[_0xdb40('0x7')](e,emitEvent(event));}}module[_0xdb40('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ab279e1..3168c8b 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 _0xcacf=['fax_accounts','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','define','FaxAccount'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0xcacf,0x156));var _0xfcac=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xcacf[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfcac('0x0'))(_0xfcac('0x1'));var moment=require(_0xfcac('0x2'));var BPromise=require(_0xfcac('0x3'));var rp=require(_0xfcac('0x4'));var fs=require('fs');var path=require(_0xfcac('0x5'));var rimraf=require('rimraf');var config=require(_0xfcac('0x6'));var attributes=require(_0xfcac('0x7'));module['exports']=function(_0xd84ab3,_0x4adaa1){return _0xd84ab3[_0xfcac('0x8')](_0xfcac('0x9'),attributes,{'tableName':_0xfcac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9bf=['request-promise','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x9979f9,_0x22dba0){var _0x53b7fe=function(_0x36dd9c){while(--_0x36dd9c){_0x9979f9['push'](_0x9979f9['shift']());}};_0x53b7fe(++_0x22dba0);}(_0xf9bf,0xa7));var _0xff9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9bf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xff9b('0x0'));var util=require(_0xff9b('0x1'));var logger=require(_0xff9b('0x2'))(_0xff9b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xff9b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xff9b('0x5')]=function(_0x300bae,_0x28e625){return _0x300bae[_0xff9b('0x6')](_0xff9b('0x7'),attributes,{'tableName':_0xff9b('0x8'),'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 484c5c9..55ff5da 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 _0xdd6b=['findAll','options','raw','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','createdAt','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','DESC','FaxApplication','Applications','List','get','applications','orderBy','priority','Contacts','length','ListId','from','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','User','UserId','unshift','agent','queueId','FaxQueue','name','waitForTheAssignedQueue','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount'];(function(_0xc7aa55,_0xffa02){var _0x3177aa=function(_0x4905b0){while(--_0x4905b0){_0xc7aa55['push'](_0xc7aa55['shift']());}};_0x3177aa(++_0xffa02);}(_0xdd6b,0xec));var _0xbdd6=function(_0x162030,_0x290cfa){_0x162030=_0x162030-0x0;var _0x52580b=_0xdd6b[_0x162030];return _0x52580b;};'use strict';var _=require(_0xbdd6('0x0'));var util=require(_0xbdd6('0x1'));var moment=require(_0xbdd6('0x2'));var BPromise=require(_0xbdd6('0x3'));var rs=require(_0xbdd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdd6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdd6('0x6'))(_0xbdd6('0x7'));var config=require('../../config/environment');var jayson=require(_0xbdd6('0x8'));var client=jayson[_0xbdd6('0x9')][_0xbdd6('0xa')]({'port':0x232c});config[_0xbdd6('0xb')]=_[_0xbdd6('0xc')](config[_0xbdd6('0xb')],{'host':_0xbdd6('0xd'),'port':0x18eb});var socket=require(_0xbdd6('0xe'))(new Redis(config[_0xbdd6('0xb')]));require(_0xbdd6('0xf'))['register'](socket);function respondWithRpcPromise(_0x4dd838,_0x5730ee,_0x4766d0){return new BPromise(function(_0x339047,_0x48b1ef){return client['request'](_0x4dd838,_0x4766d0)[_0xbdd6('0x10')](function(_0x143ecd){logger[_0xbdd6('0x11')](_0xbdd6('0x12'),_0x5730ee,_0xbdd6('0x13'));logger['debug'](_0xbdd6('0x14'),_0x5730ee,_0xbdd6('0x13'),JSON[_0xbdd6('0x15')](_0x143ecd));if(_0x143ecd['error']){if(_0x143ecd[_0xbdd6('0x16')]['code']===0x1f4){logger[_0xbdd6('0x16')](_0xbdd6('0x12'),_0x5730ee,_0x143ecd[_0xbdd6('0x16')][_0xbdd6('0x17')]);return _0x48b1ef(_0x143ecd[_0xbdd6('0x16')][_0xbdd6('0x17')]);}logger[_0xbdd6('0x16')](_0xbdd6('0x12'),_0x5730ee,_0x143ecd[_0xbdd6('0x16')][_0xbdd6('0x17')]);return _0x339047(_0x143ecd[_0xbdd6('0x16')][_0xbdd6('0x17')]);}else{logger[_0xbdd6('0x11')](_0xbdd6('0x12'),_0x5730ee,_0xbdd6('0x13'));_0x339047(_0x143ecd[_0xbdd6('0x18')]['message']);}})[_0xbdd6('0x19')](function(_0x1b611a){logger[_0xbdd6('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5730ee,_0x1b611a);_0x48b1ef(_0x1b611a);});});}exports[_0xbdd6('0x1a')]=function(_0x26a5c7){var _0x1d169b=this;return new Promise(function(_0x4cb177,_0x391119){return db[_0xbdd6('0x1b')][_0xbdd6('0x1c')]({'raw':_0x26a5c7[_0xbdd6('0x1d')]?_0x26a5c7[_0xbdd6('0x1d')][_0xbdd6('0x1e')]===undefined?!![]:![]:!![],'where':_0x26a5c7[_0xbdd6('0x1d')]?_0x26a5c7[_0xbdd6('0x1d')]['where']||null:null,'attributes':_0x26a5c7[_0xbdd6('0x1d')]?_0x26a5c7[_0xbdd6('0x1d')][_0xbdd6('0x1f')]||null:null,'limit':_0x26a5c7['options']?_0x26a5c7[_0xbdd6('0x1d')][_0xbdd6('0x20')]||null:null,'include':_0x26a5c7['options']?_0x26a5c7[_0xbdd6('0x1d')][_0xbdd6('0x21')]?_[_0xbdd6('0x22')](_0x26a5c7['options'][_0xbdd6('0x21')],function(_0x5a83b9){return{'model':db[_0x5a83b9[_0xbdd6('0x23')]],'as':_0x5a83b9['as'],'attributes':_0x5a83b9[_0xbdd6('0x1f')],'include':_0x5a83b9['include']?_[_0xbdd6('0x22')](_0x5a83b9[_0xbdd6('0x21')],function(_0x107b55){return{'model':db[_0x107b55['model']],'as':_0x107b55['as'],'attributes':_0x107b55['attributes'],'include':_0x107b55[_0xbdd6('0x21')]?_[_0xbdd6('0x22')](_0x107b55[_0xbdd6('0x21')],function(_0x389e8d){return{'model':db[_0x389e8d[_0xbdd6('0x23')]],'as':_0x389e8d['as'],'attributes':_0x389e8d[_0xbdd6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbdd6('0x10')](function(_0x5a20c3){logger['info']('GetFaxAccount',_0x26a5c7);logger[_0xbdd6('0x24')](_0xbdd6('0x1a'),_0x26a5c7,JSON['stringify'](_0x5a20c3));_0x4cb177(_0x5a20c3);})['catch'](function(_0x5ad4f7){logger[_0xbdd6('0x16')](_0xbdd6('0x1a'),_0x5ad4f7[_0xbdd6('0x17')],_0x26a5c7);_0x391119(_0x1d169b[_0xbdd6('0x16')](0x1f4,_0x5ad4f7[_0xbdd6('0x17')]));});});};exports[_0xbdd6('0x25')]=function(_0x195dac,_0x180a0f,_0x4d48c8){var _0x48d23e=this;return new Promise(function(_0x1c2da3,_0x5527c4){var _0x2a1c2e={'body':_0x195dac[_0xbdd6('0x26')],'channel':'fax'};var _0x5cc39e=[];var _0x50c938=[];var _0x323ccb={};return db[_0xbdd6('0x27')][_0xbdd6('0x28')]()['then'](function(_0x274892){if(!_0x274892){throw new db[(_0xbdd6('0x29'))][(_0xbdd6('0x2a'))](_0xbdd6('0x2b'));}_0x5cc39e=_['difference'](_[_0xbdd6('0x2c')](_0x274892),['createdAt',_0xbdd6('0x2d')]);_0x50c938=_['difference'](_[_0xbdd6('0x2c')](_0x274892),[_0xbdd6('0x2e'),_0xbdd6('0x2d'),'CompanyId','ListId']);if(_0x195dac['body']['id']){delete _0x195dac[_0xbdd6('0x26')]['id'];}if(_[_0xbdd6('0x2f')](_0x195dac[_0xbdd6('0x26')]['from'])){throw new db[(_0xbdd6('0x29'))][(_0xbdd6('0x2a'))]('from\x20is\x20mandatory');}if(_[_0xbdd6('0x2f')](_0x195dac[_0xbdd6('0x26')][_0xbdd6('0x26')])||_0x195dac[_0xbdd6('0x26')][_0xbdd6('0x26')]===''){throw new db[(_0xbdd6('0x29'))]['ValidationError'](_0xbdd6('0x30'));}if(_[_0xbdd6('0x2f')](_0x195dac[_0xbdd6('0x26')][_0xbdd6('0x31')])){throw new db[(_0xbdd6('0x29'))][(_0xbdd6('0x2a'))](_0xbdd6('0x32')+_0x50c938);}if(!_['includes'](_0x50c938,_0x195dac[_0xbdd6('0x26')]['mapKey'])){throw new db[(_0xbdd6('0x29'))][(_0xbdd6('0x2a'))](_0xbdd6('0x33')+_0x50c938);}_0x323ccb[_0x195dac['body'][_0xbdd6('0x31')]]=_0x195dac[_0xbdd6('0x26')]['from'];})[_0xbdd6('0x10')](function(){return db[_0xbdd6('0x1b')][_0xbdd6('0x34')]({'where':{'id':_0x195dac[_0xbdd6('0x35')]['id']},'include':[{'model':db[_0xbdd6('0x36')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x323ccb,'limit':0x1,'order':[[_0xbdd6('0x2d'),_0xbdd6('0x37')]]}]},{'model':db[_0xbdd6('0x38')],'as':_0xbdd6('0x39')}]});})['then'](function(_0x247e72){if(_0x247e72&&_0x247e72[_0xbdd6('0x3a')]){var _0x3305b6=_0x247e72[_0xbdd6('0x3b')]({'plain':!![]});_0x2a1c2e[_0xbdd6('0x35')]=_0x3305b6;_0x2a1c2e[_0xbdd6('0x3c')]=_0x3305b6[_0xbdd6('0x39')];_0x2a1c2e['list']=_0x3305b6[_0xbdd6('0x3a')];_0x2a1c2e['applications']=_[_0xbdd6('0x3d')](_0x2a1c2e['applications'],[_0xbdd6('0x3e')],['asc']);if(_0x2a1c2e[_0xbdd6('0x35')][_0xbdd6('0x39')]){delete _0x2a1c2e[_0xbdd6('0x35')][_0xbdd6('0x39')];}if(_0x2a1c2e[_0xbdd6('0x35')][_0xbdd6('0x3a')]&&_0x2a1c2e['account'][_0xbdd6('0x3a')][_0xbdd6('0x3f')][_0xbdd6('0x40')]){return _0x2a1c2e[_0xbdd6('0x35')][_0xbdd6('0x3a')][_0xbdd6('0x3f')][0x0];}var _0x516601=_[_0xbdd6('0xc')](_0x195dac[_0xbdd6('0x26')],{'firstName':_0x195dac[_0xbdd6('0x26')]['from'],'ListId':_0x3305b6[_0xbdd6('0x41')]});_0x516601[_0x195dac[_0xbdd6('0x26')][_0xbdd6('0x31')]]=_0x195dac[_0xbdd6('0x26')][_0xbdd6('0x42')];return db[_0xbdd6('0x27')][_0xbdd6('0x43')](_0x516601,{'fields':_0x5cc39e,'raw':!![]});}})[_0xbdd6('0x10')](function(_0x28a251){_0x2a1c2e[_0xbdd6('0x44')]=_0x28a251;if(_0x28a251){var _0x410df0={'ContactId':_0x28a251['id'],'FaxAccountId':_0x195dac[_0xbdd6('0x35')]['id'],'fax':_0x28a251['fax']};return db['FaxInteraction'][_0xbdd6('0x34')]({'where':{'ContactId':_0x28a251['id'],'closed':![],'FaxAccountId':_0x195dac[_0xbdd6('0x35')]['id']}})[_0xbdd6('0x10')](function(_0x3d4a32){if(_0x3d4a32){return[_0x3d4a32,![]];}return db[_0xbdd6('0x45')][_0xbdd6('0x43')](_0x410df0)[_0xbdd6('0x10')](function(_0xee0ab8){return[_0xee0ab8,!![]];});});}else{throw new Error(_0xbdd6('0x46'));}})[_0xbdd6('0x47')](function(_0x9056a3,_0x1da564){var _0x576e93=_0x9056a3[_0xbdd6('0x3b')]({'plain':!![]});if(_0x1da564){if(_0x2a1c2e[_0xbdd6('0x35')][_0xbdd6('0x48')]){_0x2a1c2e[_0xbdd6('0x3c')][_0xbdd6('0x49')]({'id':0x0,'priority':_0x2a1c2e[_0xbdd6('0x3c')][_0xbdd6('0x40')]+0x1,'app':_0xbdd6('0x4a'),'appdata':_0xbdd6('0x4b'),'interval':_0xbdd6('0x4c')});}_0x576e93[_0xbdd6('0x4d')]=!![];}else{_0x576e93['created']=![];}_0x2a1c2e[_0xbdd6('0x4e')]=_0x576e93;return db['FaxMessage'][_0xbdd6('0x43')]({'body':_0x195dac['body'][_0xbdd6('0x26')],'FaxAccountId':_0x195dac[_0xbdd6('0x35')]['id'],'FaxInteractionId':_0x9056a3['id'],'direction':'in','ContactId':_0x9056a3['ContactId'],'AttachmentId':_0x195dac[_0xbdd6('0x26')]['AttachmentId']});})['then'](function(_0x95a584){_0x2a1c2e[_0xbdd6('0x17')]=_0x95a584;if(!_0x2a1c2e[_0xbdd6('0x4e')]['UserId'])return;return db[_0xbdd6('0x4f')]['find']({'attributes':['id','name'],'where':{'id':_0x2a1c2e[_0xbdd6('0x4e')][_0xbdd6('0x50')]}});})[_0xbdd6('0x10')](function(_0x1b13ad){if(_0x1b13ad){_0x2a1c2e[_0xbdd6('0x3c')][_0xbdd6('0x51')]({'id':0x0,'priority':0x0,'app':_0xbdd6('0x52'),'appdata':_0x1b13ad['name']+','+(_0x2a1c2e['account']['waitForTheAssignedAgent']||0xa),'interval':_0xbdd6('0x4c')});}if(!_0x2a1c2e[_0xbdd6('0x4e')][_0xbdd6('0x53')])return;return db[_0xbdd6('0x54')][_0xbdd6('0x34')]({'attributes':['id',_0xbdd6('0x55')],'where':{'id':_0x2a1c2e[_0xbdd6('0x4e')][_0xbdd6('0x53')]}});})[_0xbdd6('0x10')](function(_0x404041){if(_0x404041){_0x2a1c2e['applications'][_0xbdd6('0x51')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x404041[_0xbdd6('0x55')]+','+(_0x2a1c2e['account'][_0xbdd6('0x56')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xbdd6('0x57'),_0x2a1c2e);})[_0xbdd6('0x10')](function(_0x326557){_0x1c2da3(_0x326557);})[_0xbdd6('0x19')](function(_0x385fa4){_0x5527c4(_0x48d23e[_0xbdd6('0x16')](0x1f4,_0x385fa4[_0xbdd6('0x17')]));});});}; \ No newline at end of file +var _0x4e48=['queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','findAll','options','raw','where','limit','include','attributes','model','map','GetFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','Applications','list','applications','orderBy','priority','asc','length','defaults','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','waitForTheAssignedAgent'];(function(_0x5f416b,_0x2d8810){var _0x14c815=function(_0x1fd5d2){while(--_0x1fd5d2){_0x5f416b['push'](_0x5f416b['shift']());}};_0x14c815(++_0x2d8810);}(_0x4e48,0xc0));var _0x84e4=function(_0x505a31,_0x14e2df){_0x505a31=_0x505a31-0x0;var _0x1e693c=_0x4e48[_0x505a31];return _0x1e693c;};'use strict';var _=require('lodash');var util=require(_0x84e4('0x0'));var moment=require('moment');var BPromise=require(_0x84e4('0x1'));var rs=require(_0x84e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84e4('0x3'))['db'];var utils=require(_0x84e4('0x4'));var logger=require('../../config/logger')(_0x84e4('0x5'));var config=require(_0x84e4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x84e4('0x7')]({'port':0x232c});config[_0x84e4('0x8')]=_['defaults'](config['redis'],{'host':_0x84e4('0x9'),'port':0x18eb});var socket=require(_0x84e4('0xa'))(new Redis(config[_0x84e4('0x8')]));require(_0x84e4('0xb'))[_0x84e4('0xc')](socket);function respondWithRpcPromise(_0x57a9af,_0x280024,_0x6ef245){return new BPromise(function(_0x2cf4d8,_0x2c9204){return client[_0x84e4('0xd')](_0x57a9af,_0x6ef245)[_0x84e4('0xe')](function(_0x386c65){logger[_0x84e4('0xf')](_0x84e4('0x10'),_0x280024,_0x84e4('0x11'));logger[_0x84e4('0x12')](_0x84e4('0x13'),_0x280024,_0x84e4('0x11'),JSON[_0x84e4('0x14')](_0x386c65));if(_0x386c65['error']){if(_0x386c65[_0x84e4('0x15')][_0x84e4('0x16')]===0x1f4){logger[_0x84e4('0x15')]('FaxAccount,\x20%s,\x20%s',_0x280024,_0x386c65[_0x84e4('0x15')][_0x84e4('0x17')]);return _0x2c9204(_0x386c65[_0x84e4('0x15')]['message']);}logger[_0x84e4('0x15')](_0x84e4('0x10'),_0x280024,_0x386c65[_0x84e4('0x15')]['message']);return _0x2cf4d8(_0x386c65[_0x84e4('0x15')]['message']);}else{logger[_0x84e4('0xf')](_0x84e4('0x10'),_0x280024,_0x84e4('0x11'));_0x2cf4d8(_0x386c65['result'][_0x84e4('0x17')]);}})[_0x84e4('0x18')](function(_0x133bb0){logger[_0x84e4('0x15')](_0x84e4('0x10'),_0x280024,_0x133bb0);_0x2c9204(_0x133bb0);});});}exports['GetFaxAccount']=function(_0x38a3dc){var _0x5b2c53=this;return new Promise(function(_0x43bf37,_0xe05efb){return db[_0x84e4('0x19')][_0x84e4('0x1a')]({'raw':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc['options'][_0x84e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc[_0x84e4('0x1b')][_0x84e4('0x1d')]||null:null,'attributes':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc[_0x84e4('0x1b')]['attributes']||null:null,'limit':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc['options'][_0x84e4('0x1e')]||null:null,'include':_0x38a3dc[_0x84e4('0x1b')]?_0x38a3dc[_0x84e4('0x1b')][_0x84e4('0x1f')]?_['map'](_0x38a3dc[_0x84e4('0x1b')]['include'],function(_0x8276ea){return{'model':db[_0x8276ea['model']],'as':_0x8276ea['as'],'attributes':_0x8276ea[_0x84e4('0x20')],'include':_0x8276ea[_0x84e4('0x1f')]?_['map'](_0x8276ea[_0x84e4('0x1f')],function(_0x54dc43){return{'model':db[_0x54dc43[_0x84e4('0x21')]],'as':_0x54dc43['as'],'attributes':_0x54dc43[_0x84e4('0x20')],'include':_0x54dc43[_0x84e4('0x1f')]?_[_0x84e4('0x22')](_0x54dc43[_0x84e4('0x1f')],function(_0x38e9d2){return{'model':db[_0x38e9d2['model']],'as':_0x38e9d2['as'],'attributes':_0x38e9d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x84e4('0xe')](function(_0x2c7993){logger[_0x84e4('0xf')](_0x84e4('0x23'),_0x38a3dc);logger[_0x84e4('0x12')]('GetFaxAccount',_0x38a3dc,JSON[_0x84e4('0x14')](_0x2c7993));_0x43bf37(_0x2c7993);})[_0x84e4('0x18')](function(_0x1887f2){logger[_0x84e4('0x15')](_0x84e4('0x23'),_0x1887f2[_0x84e4('0x17')],_0x38a3dc);_0xe05efb(_0x5b2c53[_0x84e4('0x15')](0x1f4,_0x1887f2[_0x84e4('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x3feda6,_0x37cb08,_0x77404d){var _0x5bfc48=this;return new Promise(function(_0x2bbeed,_0x3a4ed0){var _0x4c581d={'body':_0x3feda6[_0x84e4('0x24')],'channel':'fax'};var _0x385c22=[];var _0x5e5f09=[];var _0xcea2b6={};return db[_0x84e4('0x25')][_0x84e4('0x26')]()['then'](function(_0x1633d7){if(!_0x1633d7){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))](_0x84e4('0x29'));}_0x385c22=_[_0x84e4('0x2a')](_[_0x84e4('0x2b')](_0x1633d7),[_0x84e4('0x2c'),'updatedAt']);_0x5e5f09=_[_0x84e4('0x2a')](_[_0x84e4('0x2b')](_0x1633d7),[_0x84e4('0x2c'),'updatedAt',_0x84e4('0x2d'),_0x84e4('0x2e')]);if(_0x3feda6['body']['id']){delete _0x3feda6[_0x84e4('0x24')]['id'];}if(_[_0x84e4('0x2f')](_0x3feda6[_0x84e4('0x24')][_0x84e4('0x30')])){throw new db['Sequelize'][(_0x84e4('0x28'))]('from\x20is\x20mandatory');}if(_[_0x84e4('0x2f')](_0x3feda6[_0x84e4('0x24')]['body'])||_0x3feda6['body'][_0x84e4('0x24')]===''){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x84e4('0x2f')](_0x3feda6['body'][_0x84e4('0x31')])){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e5f09);}if(!_[_0x84e4('0x32')](_0x5e5f09,_0x3feda6[_0x84e4('0x24')][_0x84e4('0x31')])){throw new db[(_0x84e4('0x27'))][(_0x84e4('0x28'))](_0x84e4('0x33')+_0x5e5f09);}_0xcea2b6[_0x3feda6['body'][_0x84e4('0x31')]]=_0x3feda6[_0x84e4('0x24')]['from'];})[_0x84e4('0xe')](function(){return db['FaxAccount'][_0x84e4('0x34')]({'where':{'id':_0x3feda6[_0x84e4('0x35')]['id']},'include':[{'model':db[_0x84e4('0x36')],'as':_0x84e4('0x37'),'include':[{'model':db['CmContact'],'as':_0x84e4('0x38'),'where':_0xcea2b6,'limit':0x1,'order':[[_0x84e4('0x39'),_0x84e4('0x3a')]]}]},{'model':db[_0x84e4('0x3b')],'as':_0x84e4('0x3c')}]});})[_0x84e4('0xe')](function(_0x5d3db7){if(_0x5d3db7&&_0x5d3db7['List']){var _0xe12687=_0x5d3db7['get']({'plain':!![]});_0x4c581d[_0x84e4('0x35')]=_0xe12687;_0x4c581d['applications']=_0xe12687[_0x84e4('0x3c')];_0x4c581d[_0x84e4('0x3d')]=_0xe12687['List'];_0x4c581d[_0x84e4('0x3e')]=_[_0x84e4('0x3f')](_0x4c581d[_0x84e4('0x3e')],[_0x84e4('0x40')],[_0x84e4('0x41')]);if(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x3c')]){delete _0x4c581d[_0x84e4('0x35')][_0x84e4('0x3c')];}if(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x37')]&&_0x4c581d[_0x84e4('0x35')][_0x84e4('0x37')][_0x84e4('0x38')][_0x84e4('0x42')]){return _0x4c581d[_0x84e4('0x35')][_0x84e4('0x37')]['Contacts'][0x0];}var _0x592b48=_[_0x84e4('0x43')](_0x3feda6['body'],{'firstName':_0x3feda6['body'][_0x84e4('0x30')],'ListId':_0xe12687[_0x84e4('0x2e')]});_0x592b48[_0x3feda6[_0x84e4('0x24')][_0x84e4('0x31')]]=_0x3feda6[_0x84e4('0x24')][_0x84e4('0x30')];return db[_0x84e4('0x25')][_0x84e4('0x44')](_0x592b48,{'fields':_0x385c22,'raw':!![]});}})[_0x84e4('0xe')](function(_0x2b948d){_0x4c581d[_0x84e4('0x45')]=_0x2b948d;if(_0x2b948d){var _0x383da6={'ContactId':_0x2b948d['id'],'FaxAccountId':_0x3feda6[_0x84e4('0x35')]['id'],'fax':_0x2b948d[_0x84e4('0x46')]};return db[_0x84e4('0x47')][_0x84e4('0x34')]({'where':{'ContactId':_0x2b948d['id'],'closed':![],'FaxAccountId':_0x3feda6[_0x84e4('0x35')]['id']}})[_0x84e4('0xe')](function(_0x84cbf0){if(_0x84cbf0){return[_0x84cbf0,![]];}return db[_0x84e4('0x47')][_0x84e4('0x44')](_0x383da6)[_0x84e4('0xe')](function(_0x5e14d3){return[_0x5e14d3,!![]];});});}else{throw new Error(_0x84e4('0x48'));}})[_0x84e4('0x49')](function(_0x1802e9,_0x1bbbb1){var _0x3ac135=_0x1802e9[_0x84e4('0x4a')]({'plain':!![]});if(_0x1bbbb1){if(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x4b')]){_0x4c581d[_0x84e4('0x3e')][_0x84e4('0x4c')]({'id':0x0,'priority':_0x4c581d['applications'][_0x84e4('0x42')]+0x1,'app':'close','appdata':_0x84e4('0x4d'),'interval':_0x84e4('0x4e')});}_0x3ac135[_0x84e4('0x4f')]=!![];}else{_0x3ac135['created']=![];}_0x4c581d['interaction']=_0x3ac135;return db[_0x84e4('0x50')][_0x84e4('0x44')]({'body':_0x3feda6[_0x84e4('0x24')][_0x84e4('0x24')],'FaxAccountId':_0x3feda6['account']['id'],'FaxInteractionId':_0x1802e9['id'],'direction':'in','ContactId':_0x1802e9[_0x84e4('0x51')],'AttachmentId':_0x3feda6['body']['AttachmentId']});})[_0x84e4('0xe')](function(_0x3dc9c4){_0x4c581d[_0x84e4('0x17')]=_0x3dc9c4;if(!_0x4c581d[_0x84e4('0x52')][_0x84e4('0x53')])return;return db[_0x84e4('0x54')]['find']({'attributes':['id','name'],'where':{'id':_0x4c581d['interaction'][_0x84e4('0x53')]}});})['then'](function(_0x18e8e2){if(_0x18e8e2){_0x4c581d[_0x84e4('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x18e8e2[_0x84e4('0x55')]+','+(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x56')]||0xa),'interval':'*,*,*,*'});}if(!_0x4c581d[_0x84e4('0x52')]['queueId'])return;return db['FaxQueue'][_0x84e4('0x34')]({'attributes':['id',_0x84e4('0x55')],'where':{'id':_0x4c581d['interaction'][_0x84e4('0x57')]}});})['then'](function(_0x169fc6){if(_0x169fc6){_0x4c581d[_0x84e4('0x3e')][_0x84e4('0x58')]({'id':0x0,'priority':0x1,'app':_0x84e4('0x59'),'appdata':_0x169fc6['name']+','+(_0x4c581d[_0x84e4('0x35')][_0x84e4('0x5a')]||0x12c),'interval':_0x84e4('0x4e')});}return respondWithRpcPromise(_0x84e4('0x5b'),_0x84e4('0x5c'),_0x4c581d);})[_0x84e4('0xe')](function(_0xdebd15){_0x2bbeed(_0xdebd15);})['catch'](function(_0x1e5885){_0x3a4ed0(_0x5bfc48[_0x84e4('0x15')](0x1f4,_0x1e5885['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e3ff731..23b2310 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 _0x16c8=['remove','emit','register','length','faxAccount:'];(function(_0xe14a55,_0x18771){var _0x36c55b=function(_0x48be7f){while(--_0x48be7f){_0xe14a55['push'](_0xe14a55['shift']());}};_0x36c55b(++_0x18771);}(_0x16c8,0x78));var _0x816c=function(_0x5b7e57,_0xc38d2a){_0x5b7e57=_0x5b7e57-0x0;var _0x5bfd74=_0x16c8[_0x5b7e57];return _0x5bfd74;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x816c('0x0'),'update'];function createListener(_0x1d946e,_0x346bc1){return function(_0x1500f8){_0x346bc1[_0x816c('0x1')](_0x1d946e,_0x1500f8);};}function removeListener(_0x41bd34,_0x2c2bbe){return function(){FaxAccountEvents['removeListener'](_0x41bd34,_0x2c2bbe);};}exports[_0x816c('0x2')]=function(_0x548288){for(var _0x1ab159=0x0,_0x4b3782=events[_0x816c('0x3')];_0x1ab159<_0x4b3782;_0x1ab159++){var _0x260d42=events[_0x1ab159];var _0x737ca8=createListener(_0x816c('0x4')+_0x260d42,_0x548288);FaxAccountEvents['on'](_0x260d42,_0x737ca8);}}; \ No newline at end of file +var _0x1c40=['emit','register','length','faxAccount:','./faxAccount.events','save','update'];(function(_0x362d5d,_0x44a708){var _0x54f2ec=function(_0x58d6bb){while(--_0x58d6bb){_0x362d5d['push'](_0x362d5d['shift']());}};_0x54f2ec(++_0x44a708);}(_0x1c40,0x10e));var _0x01c4=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x1c40[_0x5db657];return _0x2d6e70;};'use strict';var FaxAccountEvents=require(_0x01c4('0x0'));var events=[_0x01c4('0x1'),'remove',_0x01c4('0x2')];function createListener(_0x326c19,_0x17ec1c){return function(_0x1361f1){_0x17ec1c[_0x01c4('0x3')](_0x326c19,_0x1361f1);};}function removeListener(_0x1a02e3,_0xc564d3){return function(){FaxAccountEvents['removeListener'](_0x1a02e3,_0xc564d3);};}exports[_0x01c4('0x4')]=function(_0x2ccfa4){for(var _0x17d883=0x0,_0x3ab822=events[_0x01c4('0x5')];_0x17d883<_0x3ab822;_0x17d883++){var _0x69a309=events[_0x17d883];var _0x545b32=createListener(_0x01c4('0x6')+_0x69a309,_0x2ccfa4);FaxAccountEvents['on'](_0x69a309,_0x545b32);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6159aad..2c45565 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 _0x6476=['/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6476,0x181));var _0x6647=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x6476[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x6647('0x0'));var util=require(_0x6647('0x1'));var path=require(_0x6647('0x2'));var timeout=require(_0x6647('0x3'));var express=require(_0x6647('0x4'));var router=express[_0x6647('0x5')]();var fs_extra=require(_0x6647('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6647('0x7'));var config=require(_0x6647('0x8'));var controller=require('./faxAccount.controller');router[_0x6647('0x9')]('/',auth['isAuthenticated'](),controller[_0x6647('0xa')]);router[_0x6647('0x9')](_0x6647('0xb'),auth[_0x6647('0xc')](),controller[_0x6647('0xd')]);router[_0x6647('0x9')](_0x6647('0xe'),auth[_0x6647('0xc')](),controller[_0x6647('0xf')]);router[_0x6647('0x9')](_0x6647('0x10'),auth[_0x6647('0xc')](),controller[_0x6647('0x11')]);router['get'](_0x6647('0x12'),auth[_0x6647('0xc')](),controller[_0x6647('0x13')]);router['get'](_0x6647('0x14'),auth[_0x6647('0xc')](),controller[_0x6647('0x15')]);router[_0x6647('0x9')]('/:id/applications',auth[_0x6647('0xc')](),controller['getApplications']);router[_0x6647('0x9')](_0x6647('0x16'),auth['isAuthenticated'](),controller[_0x6647('0x17')]);router[_0x6647('0x9')](_0x6647('0x18'),auth[_0x6647('0xc')](),controller['getAgents']);router[_0x6647('0x19')]('/',auth[_0x6647('0xc')](),controller[_0x6647('0x1a')]);router[_0x6647('0x19')](_0x6647('0x10'),auth[_0x6647('0xc')](),controller[_0x6647('0x1b')]);router['post']('/:id/canned_answers',auth[_0x6647('0xc')](),controller[_0x6647('0x1c')]);router[_0x6647('0x19')](_0x6647('0x14'),auth[_0x6647('0xc')](),controller[_0x6647('0x1d')]);router['post'](_0x6647('0x1e'),auth[_0x6647('0xc')](),controller[_0x6647('0x1f')]);router[_0x6647('0x19')](_0x6647('0x20'),auth[_0x6647('0xc')](),controller[_0x6647('0x21')]);router[_0x6647('0x19')](_0x6647('0x22'),auth[_0x6647('0xc')](),controller[_0x6647('0x23')]);router['post'](_0x6647('0x24'),auth[_0x6647('0xc')](),controller['send']);router[_0x6647('0x19')](_0x6647('0x18'),auth[_0x6647('0xc')](),controller[_0x6647('0x25')]);router['put'](_0x6647('0xe'),auth[_0x6647('0xc')](),controller[_0x6647('0x26')]);router['delete'](_0x6647('0xe'),auth['isAuthenticated'](),controller[_0x6647('0x27')]);router[_0x6647('0x28')](_0x6647('0x10'),auth[_0x6647('0xc')](),controller[_0x6647('0x29')]);router[_0x6647('0x28')](_0x6647('0x12'),auth[_0x6647('0xc')](),controller[_0x6647('0x2a')]);router['delete'](_0x6647('0x18'),auth[_0x6647('0xc')](),controller[_0x6647('0x2b')]);module[_0x6647('0x2c')]=router; \ No newline at end of file +var _0x5335=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5335,0xec));var _0x5533=function(_0x1a7c70,_0x1d29fb){_0x1a7c70=_0x1a7c70-0x0;var _0x552e98=_0x5335[_0x1a7c70];return _0x552e98;};'use strict';var multer=require(_0x5533('0x0'));var util=require('util');var path=require(_0x5533('0x1'));var timeout=require(_0x5533('0x2'));var express=require(_0x5533('0x3'));var router=express['Router']();var fs_extra=require(_0x5533('0x4'));var auth=require(_0x5533('0x5'));var interaction=require(_0x5533('0x6'));var config=require(_0x5533('0x7'));var controller=require('./faxAccount.controller');router[_0x5533('0x8')]('/',auth['isAuthenticated'](),controller[_0x5533('0x9')]);router[_0x5533('0x8')](_0x5533('0xa'),auth[_0x5533('0xb')](),controller[_0x5533('0xc')]);router[_0x5533('0x8')](_0x5533('0xd'),auth[_0x5533('0xb')](),controller['show']);router[_0x5533('0x8')](_0x5533('0xe'),auth[_0x5533('0xb')](),controller['getDispositions']);router[_0x5533('0x8')](_0x5533('0xf'),auth['isAuthenticated'](),controller[_0x5533('0x10')]);router[_0x5533('0x8')](_0x5533('0x11'),auth[_0x5533('0xb')](),controller[_0x5533('0x12')]);router[_0x5533('0x8')]('/:id/applications',auth[_0x5533('0xb')](),controller['getApplications']);router[_0x5533('0x8')](_0x5533('0x13'),auth['isAuthenticated'](),controller[_0x5533('0x14')]);router[_0x5533('0x8')](_0x5533('0x15'),auth[_0x5533('0xb')](),controller[_0x5533('0x16')]);router[_0x5533('0x17')]('/',auth['isAuthenticated'](),controller[_0x5533('0x18')]);router['post'](_0x5533('0xe'),auth[_0x5533('0xb')](),controller[_0x5533('0x19')]);router[_0x5533('0x17')](_0x5533('0xf'),auth[_0x5533('0xb')](),controller[_0x5533('0x1a')]);router['post'](_0x5533('0x11'),auth[_0x5533('0xb')](),controller['addInteraction']);router[_0x5533('0x17')]('/:id/applications',auth[_0x5533('0xb')](),controller[_0x5533('0x1b')]);router['post'](_0x5533('0x1c'),auth['isAuthenticated'](),controller[_0x5533('0x1d')]);router[_0x5533('0x17')](_0x5533('0x1e'),auth[_0x5533('0xb')](),controller[_0x5533('0x1f')]);router[_0x5533('0x17')](_0x5533('0x20'),auth[_0x5533('0xb')](),controller[_0x5533('0x21')]);router['post']('/:id/users',auth[_0x5533('0xb')](),controller['addAgents']);router[_0x5533('0x22')]('/:id',auth[_0x5533('0xb')](),controller[_0x5533('0x23')]);router[_0x5533('0x24')](_0x5533('0xd'),auth[_0x5533('0xb')](),controller[_0x5533('0x25')]);router[_0x5533('0x24')](_0x5533('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5533('0x24')](_0x5533('0xf'),auth[_0x5533('0xb')](),controller['removeAnswers']);router[_0x5533('0x24')](_0x5533('0x15'),auth[_0x5533('0xb')](),controller[_0x5533('0x26')]);module[_0x5533('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index cb7e08b..7a428a1 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 _0x904d=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0x904d,0x110));var _0xd904=function(_0x1e7d0b,_0x395352){_0x1e7d0b=_0x1e7d0b-0x0;var _0x261b3d=_0x904d[_0x1e7d0b];return _0x261b3d;};'use strict';var Sequelize=require(_0xd904('0x0'));module[_0xd904('0x1')]={'priority':{'type':Sequelize[_0xd904('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd904('0x3')],'allowNull':![],'defaultValue':_0xd904('0x4')},'appdata':{'type':Sequelize[_0xd904('0x5')]()},'description':{'type':Sequelize[_0xd904('0x3')]},'interval':{'type':Sequelize[_0xd904('0x3')],'defaultValue':_0xd904('0x6')}}; \ No newline at end of file +var _0xaee5=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x39623d,_0x6a237c){var _0x54de83=function(_0x325e15){while(--_0x325e15){_0x39623d['push'](_0x39623d['shift']());}};_0x54de83(++_0x6a237c);}(_0xaee5,0x1c4));var _0x5aee=function(_0x593ea7,_0x1977ae){_0x593ea7=_0x593ea7-0x0;var _0x2e3138=_0xaee5[_0x593ea7];return _0x2e3138;};'use strict';var Sequelize=require(_0x5aee('0x0'));module[_0x5aee('0x1')]={'priority':{'type':Sequelize[_0x5aee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5aee('0x3')],'allowNull':![],'defaultValue':_0x5aee('0x4')},'appdata':{'type':Sequelize[_0x5aee('0x5')]()},'description':{'type':Sequelize[_0x5aee('0x3')]},'interval':{'type':Sequelize[_0x5aee('0x3')],'defaultValue':_0x5aee('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 79b6673..ae6f0fe 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 _0x7c93=['stack','name','send','index','FaxApplication','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','rimraf','zip-dir','request-promise','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error'];(function(_0x47f400,_0x4eaa7d){var _0x31946a=function(_0x487ee4){while(--_0x487ee4){_0x47f400['push'](_0x47f400['shift']());}};_0x31946a(++_0x4eaa7d);}(_0x7c93,0xfb));var _0x37c9=function(_0x42c5dd,_0x412185){_0x42c5dd=_0x42c5dd-0x0;var _0x39395e=_0x7c93[_0x42c5dd];return _0x39395e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37c9('0x0'));var zipdir=require(_0x37c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37c9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x37c9('0x3'));var sox=require(_0x37c9('0x4'));var csv=require(_0x37c9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37c9('0x6'));var squel=require(_0x37c9('0x7'));var crypto=require(_0x37c9('0x8'));var jsforce=require(_0x37c9('0x9'));var deskjs=require(_0x37c9('0xa'));var toCsv=require(_0x37c9('0x5'));var querystring=require(_0x37c9('0xb'));var Papa=require(_0x37c9('0xc'));var Redis=require(_0x37c9('0xd'));var authService=require(_0x37c9('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37c9('0xf'));var logger=require(_0x37c9('0x10'))(_0x37c9('0x11'));var utils=require(_0x37c9('0x12'));var config=require(_0x37c9('0x13'));var licenseUtil=require(_0x37c9('0x14'));var db=require(_0x37c9('0x15'))['db'];function respondWithStatusCode(_0x3c8618,_0x1882fb){_0x1882fb=_0x1882fb||0xcc;return function(_0x92fb40){if(_0x92fb40){return _0x3c8618[_0x37c9('0x16')](_0x1882fb);}return _0x3c8618[_0x37c9('0x17')](_0x1882fb)[_0x37c9('0x18')]();};}function respondWithResult(_0x330b53,_0x31432a){_0x31432a=_0x31432a||0xc8;return function(_0x16821c){if(_0x16821c){return _0x330b53[_0x37c9('0x17')](_0x31432a)[_0x37c9('0x19')](_0x16821c);}};}function respondWithFilteredResult(_0x21e637,_0x30ac72){return function(_0x348486){if(_0x348486){var _0x348031=typeof _0x30ac72['offset']===_0x37c9('0x1a')&&typeof _0x30ac72['limit']===_0x37c9('0x1a');var _0x2108a4=_0x348486[_0x37c9('0x1b')];var _0x4dd3cb=_0x348031?0x0:_0x30ac72[_0x37c9('0x1c')];var _0x23b490=_0x348031?_0x348486[_0x37c9('0x1b')]:_0x30ac72[_0x37c9('0x1c')]+_0x30ac72[_0x37c9('0x1d')];var _0x4d272a;if(_0x23b490>=_0x2108a4){_0x23b490=_0x2108a4;_0x4d272a=0xc8;}else{_0x4d272a=0xce;}_0x21e637['status'](_0x4d272a);return _0x21e637['set'](_0x37c9('0x1e'),_0x4dd3cb+'-'+_0x23b490+'/'+_0x2108a4)['json'](_0x348486);}return null;};}function patchUpdates(_0x292162){return function(_0x5b8bec){try{jsonpatch[_0x37c9('0x1f')](_0x5b8bec,_0x292162,!![]);}catch(_0x188d2e){return BPromise[_0x37c9('0x20')](_0x188d2e);}return _0x5b8bec['save']();};}function saveUpdates(_0x35e7e9,_0x2d167b){return function(_0x52a618){if(_0x52a618){return _0x52a618[_0x37c9('0x21')](_0x35e7e9)['then'](function(_0x4bfd0c){return _0x4bfd0c;});}return null;};}function removeEntity(_0x31a770,_0x5d0312){return function(_0x3c0697){if(_0x3c0697){return _0x3c0697[_0x37c9('0x22')]()[_0x37c9('0x23')](function(){_0x31a770[_0x37c9('0x17')](0xcc)[_0x37c9('0x18')]();});}};}function handleEntityNotFound(_0x2f9627,_0x2e359b){return function(_0x3f4f4c){if(!_0x3f4f4c){_0x2f9627[_0x37c9('0x16')](0x194);}return _0x3f4f4c;};}function handleError(_0x379fbe,_0x14fb60){_0x14fb60=_0x14fb60||0x1f4;return function(_0x6df5a2){logger[_0x37c9('0x24')](_0x6df5a2[_0x37c9('0x25')]);if(_0x6df5a2[_0x37c9('0x26')]){delete _0x6df5a2[_0x37c9('0x26')];}_0x379fbe['status'](_0x14fb60)[_0x37c9('0x27')](_0x6df5a2);};}exports[_0x37c9('0x28')]=function(_0x88c27f,_0x3d8398){var _0x412630={},_0x2f6665={},_0x32eaed={'count':0x0,'rows':[]};var _0x150bad=_['map'](db[_0x37c9('0x29')]['rawAttributes'],function(_0x2c205e){return{'name':_0x2c205e[_0x37c9('0x2a')],'type':_0x2c205e['type'][_0x37c9('0x2b')]};});_0x2f6665[_0x37c9('0x2c')]=_[_0x37c9('0x2d')](_0x150bad,_0x37c9('0x26'));_0x2f6665['query']=_[_0x37c9('0x2e')](_0x88c27f[_0x37c9('0x2f')]);_0x2f6665[_0x37c9('0x30')]=_[_0x37c9('0x31')](_0x2f6665[_0x37c9('0x2c')],_0x2f6665['query']);_0x412630[_0x37c9('0x32')]=_[_0x37c9('0x31')](_0x2f6665[_0x37c9('0x2c')],qs[_0x37c9('0x33')](_0x88c27f[_0x37c9('0x2f')]['fields']));_0x412630[_0x37c9('0x32')]=_0x412630[_0x37c9('0x32')][_0x37c9('0x34')]?_0x412630[_0x37c9('0x32')]:_0x2f6665['model'];if(!_0x88c27f['query']['hasOwnProperty'](_0x37c9('0x35'))){_0x412630[_0x37c9('0x1d')]=qs[_0x37c9('0x1d')](_0x88c27f[_0x37c9('0x2f')][_0x37c9('0x1d')]);_0x412630[_0x37c9('0x1c')]=qs[_0x37c9('0x1c')](_0x88c27f[_0x37c9('0x2f')][_0x37c9('0x1c')]);}_0x412630[_0x37c9('0x36')]=qs[_0x37c9('0x37')](_0x88c27f[_0x37c9('0x2f')]['sort']);_0x412630[_0x37c9('0x38')]=qs[_0x37c9('0x30')](_['pick'](_0x88c27f[_0x37c9('0x2f')],_0x2f6665[_0x37c9('0x30')]),_0x150bad);if(_0x88c27f[_0x37c9('0x2f')][_0x37c9('0x39')]){_0x412630[_0x37c9('0x38')]=_['merge'](_0x412630[_0x37c9('0x38')],{'$or':_[_0x37c9('0x2d')](_0x150bad,function(_0x4eaaad){if(_0x4eaaad[_0x37c9('0x3a')]!=='VIRTUAL'){var _0x5b776f={};_0x5b776f[_0x4eaaad[_0x37c9('0x26')]]={'$like':'%'+_0x88c27f[_0x37c9('0x2f')][_0x37c9('0x39')]+'%'};return _0x5b776f;}})});}_0x412630=_[_0x37c9('0x3b')]({},_0x412630,_0x88c27f[_0x37c9('0x3c')]);var _0x2afc3a={'where':_0x412630[_0x37c9('0x38')]};return db['FaxApplication'][_0x37c9('0x1b')](_0x2afc3a)[_0x37c9('0x23')](function(_0x49a31b){_0x32eaed[_0x37c9('0x1b')]=_0x49a31b;if(_0x88c27f[_0x37c9('0x2f')][_0x37c9('0x3d')]){_0x412630[_0x37c9('0x3e')]=[{'all':!![]}];}return db[_0x37c9('0x29')][_0x37c9('0x3f')](_0x412630);})['then'](function(_0x2efc5b){_0x32eaed[_0x37c9('0x40')]=_0x2efc5b;return _0x32eaed;})[_0x37c9('0x23')](respondWithFilteredResult(_0x3d8398,_0x412630))['catch'](handleError(_0x3d8398,null));};exports[_0x37c9('0x41')]=function(_0x469a89,_0xf4c079){var _0x16e8ea={'raw':!![],'where':{'id':_0x469a89[_0x37c9('0x42')]['id']}},_0x138cde={};_0x138cde[_0x37c9('0x2c')]=_[_0x37c9('0x2e')](db[_0x37c9('0x29')][_0x37c9('0x43')]);_0x138cde[_0x37c9('0x2f')]=_[_0x37c9('0x2e')](_0x469a89[_0x37c9('0x2f')]);_0x138cde[_0x37c9('0x30')]=_['intersection'](_0x138cde['model'],_0x138cde[_0x37c9('0x2f')]);_0x16e8ea[_0x37c9('0x32')]=_[_0x37c9('0x31')](_0x138cde[_0x37c9('0x2c')],qs[_0x37c9('0x33')](_0x469a89[_0x37c9('0x2f')][_0x37c9('0x33')]));_0x16e8ea[_0x37c9('0x32')]=_0x16e8ea[_0x37c9('0x32')]['length']?_0x16e8ea[_0x37c9('0x32')]:_0x138cde['model'];if(_0x469a89[_0x37c9('0x2f')][_0x37c9('0x3d')]){_0x16e8ea[_0x37c9('0x3e')]=[{'all':!![]}];}_0x16e8ea=_[_0x37c9('0x3b')]({},_0x16e8ea,_0x469a89[_0x37c9('0x3c')]);return db[_0x37c9('0x29')][_0x37c9('0x44')](_0x16e8ea)[_0x37c9('0x23')](handleEntityNotFound(_0xf4c079,null))[_0x37c9('0x23')](respondWithResult(_0xf4c079,null))['catch'](handleError(_0xf4c079,null));};exports[_0x37c9('0x45')]=function(_0x49843d,_0x46d94a){return db[_0x37c9('0x29')][_0x37c9('0x45')](_0x49843d[_0x37c9('0x46')],{})[_0x37c9('0x23')](respondWithResult(_0x46d94a,0xc9))[_0x37c9('0x47')](handleError(_0x46d94a,null));};exports[_0x37c9('0x21')]=function(_0xc783c3,_0x1d6c2e){if(_0xc783c3[_0x37c9('0x46')]['id']){delete _0xc783c3['body']['id'];}return db[_0x37c9('0x29')][_0x37c9('0x44')]({'where':{'id':_0xc783c3[_0x37c9('0x42')]['id']}})[_0x37c9('0x23')](handleEntityNotFound(_0x1d6c2e,null))['then'](saveUpdates(_0xc783c3[_0x37c9('0x46')],null))['then'](respondWithResult(_0x1d6c2e,null))[_0x37c9('0x47')](handleError(_0x1d6c2e,null));};exports[_0x37c9('0x22')]=function(_0x2726fa,_0x4408e1){return db[_0x37c9('0x29')][_0x37c9('0x44')]({'where':{'id':_0x2726fa[_0x37c9('0x42')]['id']}})[_0x37c9('0x23')](handleEntityNotFound(_0x4408e1,null))[_0x37c9('0x23')](removeEntity(_0x4408e1,null))[_0x37c9('0x47')](handleError(_0x4408e1,null));}; \ No newline at end of file +var _0x1521=['map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','count','include','FaxApplication','then','rows','catch','show','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','set','apply','reject','save','update','sendStatus','stack','name','send'];(function(_0x1fefb2,_0x5d2a04){var _0xbe88e4=function(_0x37a192){while(--_0x37a192){_0x1fefb2['push'](_0x1fefb2['shift']());}};_0xbe88e4(++_0x5d2a04);}(_0x1521,0x106));var _0x1152=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x1521[_0x151418];return _0x40e29a;};'use strict';var emlformat=require(_0x1152('0x0'));var rimraf=require(_0x1152('0x1'));var zipdir=require(_0x1152('0x2'));var jsonpatch=require(_0x1152('0x3'));var rp=require(_0x1152('0x4'));var moment=require(_0x1152('0x5'));var BPromise=require(_0x1152('0x6'));var Mustache=require('mustache');var util=require(_0x1152('0x7'));var path=require('path');var sox=require(_0x1152('0x8'));var csv=require('to-csv');var ejs=require(_0x1152('0x9'));var fs=require('fs');var fs_extra=require(_0x1152('0xa'));var _=require(_0x1152('0xb'));var squel=require(_0x1152('0xc'));var crypto=require('crypto');var jsforce=require(_0x1152('0xd'));var deskjs=require(_0x1152('0xe'));var toCsv=require(_0x1152('0xf'));var querystring=require(_0x1152('0x10'));var Papa=require(_0x1152('0x11'));var Redis=require(_0x1152('0x12'));var authService=require(_0x1152('0x13'));var qs=require(_0x1152('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1152('0x15'));var logger=require(_0x1152('0x16'))(_0x1152('0x17'));var utils=require(_0x1152('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1152('0x19'));var db=require(_0x1152('0x1a'))['db'];function respondWithStatusCode(_0x47a785,_0x56c72f){_0x56c72f=_0x56c72f||0xcc;return function(_0x3ab4a3){if(_0x3ab4a3){return _0x47a785['sendStatus'](_0x56c72f);}return _0x47a785['status'](_0x56c72f)[_0x1152('0x1b')]();};}function respondWithResult(_0x5e5f43,_0xdfcc38){_0xdfcc38=_0xdfcc38||0xc8;return function(_0x613989){if(_0x613989){return _0x5e5f43[_0x1152('0x1c')](_0xdfcc38)[_0x1152('0x1d')](_0x613989);}};}function respondWithFilteredResult(_0x35c510,_0x501ef9){return function(_0x3b7da2){if(_0x3b7da2){var _0xba493c=typeof _0x501ef9['offset']===_0x1152('0x1e')&&typeof _0x501ef9[_0x1152('0x1f')]===_0x1152('0x1e');var _0x125780=_0x3b7da2['count'];var _0x3dfb08=_0xba493c?0x0:_0x501ef9[_0x1152('0x20')];var _0x14cc93=_0xba493c?_0x3b7da2['count']:_0x501ef9[_0x1152('0x20')]+_0x501ef9[_0x1152('0x1f')];var _0xb387a9;if(_0x14cc93>=_0x125780){_0x14cc93=_0x125780;_0xb387a9=0xc8;}else{_0xb387a9=0xce;}_0x35c510[_0x1152('0x1c')](_0xb387a9);return _0x35c510[_0x1152('0x21')]('Content-Range',_0x3dfb08+'-'+_0x14cc93+'/'+_0x125780)[_0x1152('0x1d')](_0x3b7da2);}return null;};}function patchUpdates(_0x599351){return function(_0xbe3f57){try{jsonpatch[_0x1152('0x22')](_0xbe3f57,_0x599351,!![]);}catch(_0x517249){return BPromise[_0x1152('0x23')](_0x517249);}return _0xbe3f57[_0x1152('0x24')]();};}function saveUpdates(_0x42371c,_0x54762d){return function(_0x2971b7){if(_0x2971b7){return _0x2971b7[_0x1152('0x25')](_0x42371c)['then'](function(_0x5e910b){return _0x5e910b;});}return null;};}function removeEntity(_0x5e0e74,_0x417948){return function(_0x1d4c4b){if(_0x1d4c4b){return _0x1d4c4b['destroy']()['then'](function(){_0x5e0e74[_0x1152('0x1c')](0xcc)[_0x1152('0x1b')]();});}};}function handleEntityNotFound(_0x30d1b1,_0x335ed3){return function(_0x2eaf93){if(!_0x2eaf93){_0x30d1b1[_0x1152('0x26')](0x194);}return _0x2eaf93;};}function handleError(_0xb597fd,_0x33a7a6){_0x33a7a6=_0x33a7a6||0x1f4;return function(_0x33677b){logger['error'](_0x33677b[_0x1152('0x27')]);if(_0x33677b[_0x1152('0x28')]){delete _0x33677b[_0x1152('0x28')];}_0xb597fd['status'](_0x33a7a6)[_0x1152('0x29')](_0x33677b);};}exports['index']=function(_0x56412d,_0x41e89e){var _0x7ae877={},_0xc8d142={},_0x2a1131={'count':0x0,'rows':[]};var _0x475f71=_[_0x1152('0x2a')](db['FaxApplication'][_0x1152('0x2b')],function(_0x33b0aa){return{'name':_0x33b0aa[_0x1152('0x2c')],'type':_0x33b0aa[_0x1152('0x2d')][_0x1152('0x2e')]};});_0xc8d142[_0x1152('0x2f')]=_[_0x1152('0x2a')](_0x475f71,_0x1152('0x28'));_0xc8d142['query']=_[_0x1152('0x30')](_0x56412d['query']);_0xc8d142[_0x1152('0x31')]=_[_0x1152('0x32')](_0xc8d142[_0x1152('0x2f')],_0xc8d142[_0x1152('0x33')]);_0x7ae877[_0x1152('0x34')]=_[_0x1152('0x32')](_0xc8d142[_0x1152('0x2f')],qs[_0x1152('0x35')](_0x56412d[_0x1152('0x33')][_0x1152('0x35')]));_0x7ae877[_0x1152('0x34')]=_0x7ae877[_0x1152('0x34')]['length']?_0x7ae877[_0x1152('0x34')]:_0xc8d142[_0x1152('0x2f')];if(!_0x56412d[_0x1152('0x33')][_0x1152('0x36')]('nolimit')){_0x7ae877[_0x1152('0x1f')]=qs[_0x1152('0x1f')](_0x56412d[_0x1152('0x33')][_0x1152('0x1f')]);_0x7ae877['offset']=qs['offset'](_0x56412d[_0x1152('0x33')]['offset']);}_0x7ae877[_0x1152('0x37')]=qs[_0x1152('0x38')](_0x56412d['query']['sort']);_0x7ae877[_0x1152('0x39')]=qs[_0x1152('0x31')](_['pick'](_0x56412d[_0x1152('0x33')],_0xc8d142[_0x1152('0x31')]),_0x475f71);if(_0x56412d[_0x1152('0x33')]['filter']){_0x7ae877[_0x1152('0x39')]=_[_0x1152('0x3a')](_0x7ae877['where'],{'$or':_[_0x1152('0x2a')](_0x475f71,function(_0xa6f4be){if(_0xa6f4be[_0x1152('0x2d')]!==_0x1152('0x3b')){var _0x5a3514={};_0x5a3514[_0xa6f4be[_0x1152('0x28')]]={'$like':'%'+_0x56412d[_0x1152('0x33')][_0x1152('0x3c')]+'%'};return _0x5a3514;}})});}_0x7ae877=_[_0x1152('0x3a')]({},_0x7ae877,_0x56412d[_0x1152('0x3d')]);var _0x2b4689={'where':_0x7ae877[_0x1152('0x39')]};return db['FaxApplication'][_0x1152('0x3e')](_0x2b4689)['then'](function(_0x2e1738){_0x2a1131[_0x1152('0x3e')]=_0x2e1738;if(_0x56412d[_0x1152('0x33')]['includeAll']){_0x7ae877[_0x1152('0x3f')]=[{'all':!![]}];}return db[_0x1152('0x40')]['findAll'](_0x7ae877);})[_0x1152('0x41')](function(_0x1af0dd){_0x2a1131[_0x1152('0x42')]=_0x1af0dd;return _0x2a1131;})[_0x1152('0x41')](respondWithFilteredResult(_0x41e89e,_0x7ae877))[_0x1152('0x43')](handleError(_0x41e89e,null));};exports[_0x1152('0x44')]=function(_0x3ab0f3,_0x2f762d){var _0x3cc4b9={'raw':!![],'where':{'id':_0x3ab0f3[_0x1152('0x45')]['id']}},_0x27eb03={};_0x27eb03['model']=_['keys'](db['FaxApplication'][_0x1152('0x2b')]);_0x27eb03['query']=_[_0x1152('0x30')](_0x3ab0f3[_0x1152('0x33')]);_0x27eb03[_0x1152('0x31')]=_[_0x1152('0x32')](_0x27eb03[_0x1152('0x2f')],_0x27eb03[_0x1152('0x33')]);_0x3cc4b9[_0x1152('0x34')]=_[_0x1152('0x32')](_0x27eb03[_0x1152('0x2f')],qs['fields'](_0x3ab0f3[_0x1152('0x33')][_0x1152('0x35')]));_0x3cc4b9[_0x1152('0x34')]=_0x3cc4b9[_0x1152('0x34')][_0x1152('0x46')]?_0x3cc4b9['attributes']:_0x27eb03[_0x1152('0x2f')];if(_0x3ab0f3[_0x1152('0x33')][_0x1152('0x47')]){_0x3cc4b9[_0x1152('0x3f')]=[{'all':!![]}];}_0x3cc4b9=_[_0x1152('0x3a')]({},_0x3cc4b9,_0x3ab0f3[_0x1152('0x3d')]);return db[_0x1152('0x40')][_0x1152('0x48')](_0x3cc4b9)[_0x1152('0x41')](handleEntityNotFound(_0x2f762d,null))[_0x1152('0x41')](respondWithResult(_0x2f762d,null))[_0x1152('0x43')](handleError(_0x2f762d,null));};exports[_0x1152('0x49')]=function(_0x3df839,_0x3eb301){return db['FaxApplication']['create'](_0x3df839[_0x1152('0x4a')],{})[_0x1152('0x41')](respondWithResult(_0x3eb301,0xc9))[_0x1152('0x43')](handleError(_0x3eb301,null));};exports[_0x1152('0x25')]=function(_0x62e4e9,_0x35f25f){if(_0x62e4e9[_0x1152('0x4a')]['id']){delete _0x62e4e9[_0x1152('0x4a')]['id'];}return db[_0x1152('0x40')][_0x1152('0x48')]({'where':{'id':_0x62e4e9[_0x1152('0x45')]['id']}})[_0x1152('0x41')](handleEntityNotFound(_0x35f25f,null))[_0x1152('0x41')](saveUpdates(_0x62e4e9[_0x1152('0x4a')],null))['then'](respondWithResult(_0x35f25f,null))[_0x1152('0x43')](handleError(_0x35f25f,null));};exports[_0x1152('0x4b')]=function(_0xa70b18,_0x1364e6){return db[_0x1152('0x40')][_0x1152('0x48')]({'where':{'id':_0xa70b18[_0x1152('0x45')]['id']}})[_0x1152('0x41')](handleEntityNotFound(_0x1364e6,null))[_0x1152('0x41')](removeEntity(_0x1364e6,null))[_0x1152('0x43')](handleError(_0x1364e6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 79f4b15..256a7a3 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 _0xa65e=['path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3cf387,_0x31ed26){var _0x24425f=function(_0x500fc6){while(--_0x500fc6){_0x3cf387['push'](_0x3cf387['shift']());}};_0x24425f(++_0x31ed26);}(_0xa65e,0x72));var _0xea65=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xa65e[_0x264545];return _0x114d10;};'use strict';var _=require(_0xea65('0x0'));var util=require(_0xea65('0x1'));var logger=require(_0xea65('0x2'))('api');var moment=require(_0xea65('0x3'));var BPromise=require(_0xea65('0x4'));var rp=require(_0xea65('0x5'));var fs=require('fs');var path=require(_0xea65('0x6'));var rimraf=require(_0xea65('0x7'));var config=require(_0xea65('0x8'));var attributes=require(_0xea65('0x9'));module['exports']=function(_0x3b8088,_0x4d55a2){return _0x3b8088[_0xea65('0xa')](_0xea65('0xb'),attributes,{'tableName':_0xea65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea65('0xd'),'collate':_0xea65('0xe')});}; \ No newline at end of file +var _0x8146=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8146,0xa2));var _0x6814=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x8146[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x6814('0x0'));var util=require(_0x6814('0x1'));var logger=require(_0x6814('0x2'))(_0x6814('0x3'));var moment=require(_0x6814('0x4'));var BPromise=require(_0x6814('0x5'));var rp=require(_0x6814('0x6'));var fs=require('fs');var path=require(_0x6814('0x7'));var rimraf=require(_0x6814('0x8'));var config=require(_0x6814('0x9'));var attributes=require('./faxApplication.attributes');module[_0x6814('0xa')]=function(_0x5c18a4,_0x588ff5){return _0x5c18a4[_0x6814('0xb')](_0x6814('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6814('0xd'),'collate':_0x6814('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 70231bc..8da4559 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 _0x08f6=['result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x244311,_0x2a92ed){var _0x3c774f=function(_0x3d103c){while(--_0x3d103c){_0x244311['push'](_0x244311['shift']());}};_0x3c774f(++_0x2a92ed);}(_0x08f6,0x110));var _0x608f=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x08f6[_0x2a8860];return _0x2f47a4;};'use strict';var _=require(_0x608f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x608f('0x1'));var fs=require('fs');var Redis=require(_0x608f('0x2'));var db=require(_0x608f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x608f('0x4'))('rpc');var config=require(_0x608f('0x5'));var jayson=require(_0x608f('0x6'));var client=jayson[_0x608f('0x7')][_0x608f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5619bc,_0xc0faf3,_0x5141ef){return new BPromise(function(_0x186ce5,_0x21dd21){return client[_0x608f('0x9')](_0x5619bc,_0x5141ef)[_0x608f('0xa')](function(_0x18dc25){logger[_0x608f('0xb')](_0x608f('0xc'),_0xc0faf3,'request\x20sent');logger[_0x608f('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xc0faf3,_0x608f('0xe'),JSON['stringify'](_0x18dc25));if(_0x18dc25['error']){if(_0x18dc25[_0x608f('0xf')][_0x608f('0x10')]===0x1f4){logger[_0x608f('0xf')](_0x608f('0xc'),_0xc0faf3,_0x18dc25['error'][_0x608f('0x11')]);return _0x21dd21(_0x18dc25[_0x608f('0xf')][_0x608f('0x11')]);}logger[_0x608f('0xf')]('FaxApplication,\x20%s,\x20%s',_0xc0faf3,_0x18dc25[_0x608f('0xf')][_0x608f('0x11')]);return _0x186ce5(_0x18dc25[_0x608f('0xf')][_0x608f('0x11')]);}else{logger['info'](_0x608f('0xc'),_0xc0faf3,'request\x20sent');_0x186ce5(_0x18dc25[_0x608f('0x12')][_0x608f('0x11')]);}})[_0x608f('0x13')](function(_0x454ee4){logger[_0x608f('0xf')]('FaxApplication,\x20%s,\x20%s',_0xc0faf3,_0x454ee4);_0x21dd21(_0x454ee4);});});}exports[_0x608f('0x14')]=function(_0x3a56b6){var _0x3432cf=this;return new Promise(function(_0x22ae9b,_0x6462e2){return db[_0x608f('0x15')][_0x608f('0x16')](_0x3a56b6[_0x608f('0x17')],{'raw':_0x3a56b6[_0x608f('0x18')]?_0x3a56b6[_0x608f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a56b6[_0x608f('0x18')]?_0x3a56b6[_0x608f('0x18')][_0x608f('0x19')]||null:null,'attributes':_0x3a56b6[_0x608f('0x18')]?_0x3a56b6[_0x608f('0x18')][_0x608f('0x1a')]||null:null,'limit':_0x3a56b6['options']?_0x3a56b6[_0x608f('0x18')][_0x608f('0x1b')]||null:null})[_0x608f('0xa')](function(_0x31d3a0){logger[_0x608f('0xb')](_0x608f('0x14'),_0x3a56b6);logger[_0x608f('0xd')]('UpdateFaxApplication',_0x3a56b6,JSON[_0x608f('0x1c')](_0x31d3a0));_0x22ae9b(_0x31d3a0);})[_0x608f('0x13')](function(_0x2d1d65){logger[_0x608f('0xf')](_0x608f('0x14'),_0x2d1d65[_0x608f('0x11')],_0x3a56b6);_0x6462e2(_0x3432cf[_0x608f('0xf')](0x1f4,_0x2d1d65[_0x608f('0x11')]));});});}; \ No newline at end of file +var _0xd772=['options','raw','where','attributes','limit','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','body'];(function(_0x52e122,_0x5e17f0){var _0x12c2ca=function(_0x6aa611){while(--_0x6aa611){_0x52e122['push'](_0x52e122['shift']());}};_0x12c2ca(++_0x5e17f0);}(_0xd772,0xd7));var _0x2d77=function(_0x59fee9,_0x4c5b04){_0x59fee9=_0x59fee9-0x0;var _0x1d8146=_0xd772[_0x59fee9];return _0x1d8146;};'use strict';var _=require('lodash');var util=require(_0x2d77('0x0'));var moment=require(_0x2d77('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d77('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d77('0x3'));var logger=require(_0x2d77('0x4'))(_0x2d77('0x5'));var config=require(_0x2d77('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2d77('0x7')][_0x2d77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39365d,_0x478e27,_0x427da2){return new BPromise(function(_0x3a7e2d,_0x5e8f59){return client[_0x2d77('0x9')](_0x39365d,_0x427da2)[_0x2d77('0xa')](function(_0x27f698){logger[_0x2d77('0xb')]('FaxApplication,\x20%s,\x20%s',_0x478e27,_0x2d77('0xc'));logger[_0x2d77('0xd')](_0x2d77('0xe'),_0x478e27,_0x2d77('0xc'),JSON[_0x2d77('0xf')](_0x27f698));if(_0x27f698[_0x2d77('0x10')]){if(_0x27f698[_0x2d77('0x10')][_0x2d77('0x11')]===0x1f4){logger['error'](_0x2d77('0x12'),_0x478e27,_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);return _0x5e8f59(_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);}logger[_0x2d77('0x10')](_0x2d77('0x12'),_0x478e27,_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);return _0x3a7e2d(_0x27f698[_0x2d77('0x10')][_0x2d77('0x13')]);}else{logger[_0x2d77('0xb')](_0x2d77('0x12'),_0x478e27,_0x2d77('0xc'));_0x3a7e2d(_0x27f698[_0x2d77('0x14')]['message']);}})[_0x2d77('0x15')](function(_0x4bd586){logger['error']('FaxApplication,\x20%s,\x20%s',_0x478e27,_0x4bd586);_0x5e8f59(_0x4bd586);});});}exports[_0x2d77('0x16')]=function(_0x4f78f8){var _0x502028=this;return new Promise(function(_0x3ea236,_0x54ea50){return db[_0x2d77('0x17')]['update'](_0x4f78f8[_0x2d77('0x18')],{'raw':_0x4f78f8['options']?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f78f8[_0x2d77('0x19')]?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1b')]||null:null,'attributes':_0x4f78f8[_0x2d77('0x19')]?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1c')]||null:null,'limit':_0x4f78f8[_0x2d77('0x19')]?_0x4f78f8[_0x2d77('0x19')][_0x2d77('0x1d')]||null:null})[_0x2d77('0xa')](function(_0xa4f4be){logger[_0x2d77('0xb')]('UpdateFaxApplication',_0x4f78f8);logger[_0x2d77('0xd')](_0x2d77('0x16'),_0x4f78f8,JSON[_0x2d77('0xf')](_0xa4f4be));_0x3ea236(_0xa4f4be);})[_0x2d77('0x15')](function(_0x2e5b72){logger[_0x2d77('0x10')](_0x2d77('0x16'),_0x2e5b72['message'],_0x4f78f8);_0x54ea50(_0x502028[_0x2d77('0x10')](0x1f4,_0x2e5b72[_0x2d77('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9284958..f03600b 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 _0x7916=['/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index'];(function(_0x46bdac,_0x31bb32){var _0x17fa35=function(_0x26b044){while(--_0x26b044){_0x46bdac['push'](_0x46bdac['shift']());}};_0x17fa35(++_0x31bb32);}(_0x7916,0x128));var _0x6791=function(_0x1fe312,_0x5c0f7e){_0x1fe312=_0x1fe312-0x0;var _0x2e8f46=_0x7916[_0x1fe312];return _0x2e8f46;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6791('0xc')]);router[_0x6791('0xd')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router[_0x6791('0xf')]('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);module[_0x6791('0x11')]=router; \ No newline at end of file +var _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x21f551,_0x1008fe){var _0x4ece9c=function(_0x1b9888){while(--_0x1b9888){_0x21f551['push'](_0x21f551['shift']());}};_0x4ece9c(++_0x1008fe);}(_0x13f6,0x124));var _0x613f=function(_0x18a256,_0x348ac9){_0x18a256=_0x18a256-0x0;var _0xaf1b53=_0x13f6[_0x18a256];return _0xaf1b53;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 6bae0c3..057eaec 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 _0x7708=['sequelize','exports','DATE','STRING','out','ENUM','INTEGER'];(function(_0x227856,_0x8fa698){var _0x489d63=function(_0x299d98){while(--_0x299d98){_0x227856['push'](_0x227856['shift']());}};_0x489d63(++_0x8fa698);}(_0x7708,0x188));var _0x8770=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x7708[_0x3c81b5];return _0x5888c4;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8770('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8770('0x2')]},'fax':{'type':Sequelize[_0x8770('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8770('0x5')]('in',_0x8770('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x8770('0x6')]}}; \ No newline at end of file +var _0x14a0=['out','INTEGER','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x40783c,_0x1053f3){var _0x133700=function(_0x49dfdb){while(--_0x49dfdb){_0x40783c['push'](_0x40783c['shift']());}};_0x133700(++_0x1053f3);}(_0x14a0,0x8e));var _0x014a=function(_0x6a8067,_0x1bffec){_0x6a8067=_0x6a8067-0x0;var _0x1cc2aa=_0x14a0[_0x6a8067];return _0x1cc2aa;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'closed':{'type':Sequelize[_0x014a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x014a('0x2')]},'disposition':{'type':Sequelize[_0x014a('0x3')]},'secondDisposition':{'type':Sequelize[_0x014a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x014a('0x3')]},'note':{'type':Sequelize[_0x014a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x014a('0x4')]('in',_0x014a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x014a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x014a('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 89cebdc..f4fb0bb 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 _0xeec1=['filters','intersection','model','fields','length','attributes','include','merge','options','find','create','body','describe','addMessage','ids','omit','findOne','FaxMessage','hasOwnProperty','nolimit','order','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','basename','resolve','log','unlinkSync','rimraf','zip-dir','moment','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','user','catch','show','params','keys','query'];(function(_0x23c875,_0x578bda){var _0x2e36a2=function(_0x45a7cf){while(--_0x45a7cf){_0x23c875['push'](_0x23c875['shift']());}};_0x2e36a2(++_0x578bda);}(_0xeec1,0x1cc));var _0x1eec=function(_0x547741,_0x41a203){_0x547741=_0x547741-0x0;var _0x50cd44=_0xeec1[_0x547741];return _0x50cd44;};'use strict';var rimraf=require(_0x1eec('0x0'));var zipdir=require(_0x1eec('0x1'));var moment=require(_0x1eec('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x1eec('0x3'));var fs=require('fs');var _=require(_0x1eec('0x4'));var Redis=require('ioredis');var interaction=require(_0x1eec('0x5'));var qs=require(_0x1eec('0x6'));var logger=require('../../config/logger')(_0x1eec('0x7'));var config=require(_0x1eec('0x8'));var db=require('../../mysqldb')['db'];config[_0x1eec('0x9')]=_[_0x1eec('0xa')](config[_0x1eec('0x9')],{'host':_0x1eec('0xb'),'port':0x18eb});var socket=require(_0x1eec('0xc'))(new Redis(config[_0x1eec('0x9')]));require(_0x1eec('0xd'))['register'](socket);function respondWithStatusCode(_0x20ddca,_0x3cc1ae){_0x3cc1ae=_0x3cc1ae||0xcc;return function(_0xc5da7d){if(_0xc5da7d){return _0x20ddca[_0x1eec('0xe')](_0x3cc1ae);}return _0x20ddca[_0x1eec('0xf')](_0x3cc1ae)[_0x1eec('0x10')]();};}function respondWithResult(_0x24c383,_0x35d2d2){_0x35d2d2=_0x35d2d2||0xc8;return function(_0x3f7eea){if(_0x3f7eea){return _0x24c383[_0x1eec('0xf')](_0x35d2d2)['json'](_0x3f7eea);}};}function respondWithFilteredResult(_0x723c6c,_0x27d9d3){return function(_0x1bc9ae){if(_0x1bc9ae){var _0x455fb1=typeof _0x27d9d3[_0x1eec('0x11')]===_0x1eec('0x12')&&typeof _0x27d9d3[_0x1eec('0x13')]===_0x1eec('0x12');var _0x1b854b=_0x1bc9ae[_0x1eec('0x14')];var _0x3610e3=_0x455fb1?0x0:_0x27d9d3[_0x1eec('0x11')];var _0x193243=_0x455fb1?_0x1bc9ae[_0x1eec('0x14')]:_0x27d9d3[_0x1eec('0x11')]+_0x27d9d3[_0x1eec('0x13')];var _0xf0b4ae;if(_0x193243>=_0x1b854b){_0x193243=_0x1b854b;_0xf0b4ae=0xc8;}else{_0xf0b4ae=0xce;}_0x723c6c[_0x1eec('0xf')](_0xf0b4ae);return _0x723c6c[_0x1eec('0x15')](_0x1eec('0x16'),_0x3610e3+'-'+_0x193243+'/'+_0x1b854b)[_0x1eec('0x17')](_0x1bc9ae);}return null;};}function saveUpdates(_0x1d2a4f){return function(_0xeb8507){if(_0xeb8507){return _0xeb8507[_0x1eec('0x18')](_0x1d2a4f)[_0x1eec('0x19')](function(_0x4560f7){return _0x4560f7;});}return null;};}function removeEntity(_0x28c17a){return function(_0x5c58d1){if(_0x5c58d1){return _0x5c58d1[_0x1eec('0x1a')]()['then'](function(){_0x28c17a['status'](0xcc)[_0x1eec('0x10')]();});}};}function handleEntityNotFound(_0x154399){return function(_0xeb68c0){if(!_0xeb68c0){_0x154399['sendStatus'](0x194);}return _0xeb68c0;};}function handleError(_0x32a636,_0x16523c){_0x16523c=_0x16523c||0x1f4;return function(_0x128b68){logger['error'](_0x128b68[_0x1eec('0x1b')]);if(_0x128b68[_0x1eec('0x1c')]){delete _0x128b68[_0x1eec('0x1c')];}_0x32a636['status'](_0x16523c)[_0x1eec('0x1d')](_0x128b68);};}exports[_0x1eec('0x1e')]=function(_0x557d43,_0x59a7e6){var _0x3e0ac3={};var _0x4f8c7f=_[_0x1eec('0x1f')](db[_0x1eec('0x20')][_0x1eec('0x21')],function(_0x289f7a){return{'name':_0x289f7a[_0x1eec('0x22')],'type':_0x289f7a['type'][_0x1eec('0x23')]};});_0x3e0ac3=qs[_0x1eec('0x24')](_0x4f8c7f,_0x557d43);return interaction[_0x1eec('0x25')](_0x1eec('0x26'),_0x557d43['query'],_0x557d43[_0x1eec('0x27')],_0x3e0ac3,_0x4f8c7f)['then'](respondWithFilteredResult(_0x59a7e6,_0x3e0ac3))[_0x1eec('0x28')](handleError(_0x59a7e6,null));};exports[_0x1eec('0x29')]=function(_0x140de4,_0x423501){var _0x16e1a0={'raw':![],'where':{'id':_0x140de4[_0x1eec('0x2a')]['id']}},_0x405903={};_0x405903['model']=_[_0x1eec('0x2b')](db[_0x1eec('0x20')][_0x1eec('0x21')]);_0x405903[_0x1eec('0x2c')]=_[_0x1eec('0x2b')](_0x140de4[_0x1eec('0x2c')]);_0x405903[_0x1eec('0x2d')]=_[_0x1eec('0x2e')](_0x405903[_0x1eec('0x2f')],_0x405903[_0x1eec('0x2c')]);_0x16e1a0['attributes']=_[_0x1eec('0x2e')](_0x405903['model'],qs[_0x1eec('0x30')](_0x140de4[_0x1eec('0x2c')]['fields']));_0x16e1a0['attributes']=_0x16e1a0['attributes'][_0x1eec('0x31')]?_0x16e1a0[_0x1eec('0x32')]:_0x405903[_0x1eec('0x2f')];if(_0x140de4[_0x1eec('0x2c')]['includeAll']){_0x16e1a0[_0x1eec('0x33')]=[{'all':!![]}];}_0x16e1a0=_[_0x1eec('0x34')]({},_0x16e1a0,_0x140de4[_0x1eec('0x35')]);return db[_0x1eec('0x20')][_0x1eec('0x36')](_0x16e1a0)[_0x1eec('0x19')](handleEntityNotFound(_0x423501,null))[_0x1eec('0x19')](respondWithResult(_0x423501,null))[_0x1eec('0x28')](handleError(_0x423501,null));};exports[_0x1eec('0x37')]=function(_0x18d12a,_0x2c14e9){return db[_0x1eec('0x20')][_0x1eec('0x37')](_0x18d12a[_0x1eec('0x38')],{})['then'](respondWithResult(_0x2c14e9,0xc9))[_0x1eec('0x28')](handleError(_0x2c14e9,null));};exports[_0x1eec('0x18')]=function(_0x4c887e,_0x38edd4){if(_0x4c887e[_0x1eec('0x38')]['id']){delete _0x4c887e[_0x1eec('0x38')]['id'];}return db[_0x1eec('0x20')][_0x1eec('0x36')]({'where':{'id':_0x4c887e[_0x1eec('0x2a')]['id']}})[_0x1eec('0x19')](handleEntityNotFound(_0x38edd4,null))[_0x1eec('0x19')](saveUpdates(_0x4c887e[_0x1eec('0x38')],null))[_0x1eec('0x19')](respondWithResult(_0x38edd4,null))[_0x1eec('0x28')](handleError(_0x38edd4,null));};exports['destroy']=function(_0x4b3bd9,_0x228d62){return db[_0x1eec('0x20')][_0x1eec('0x36')]({'where':{'id':_0x4b3bd9[_0x1eec('0x2a')]['id']}})['then'](handleEntityNotFound(_0x228d62,null))[_0x1eec('0x19')](removeEntity(_0x228d62,null))['catch'](handleError(_0x228d62,null));};exports[_0x1eec('0x39')]=function(_0x594f40,_0x4c89b1){return db[_0x1eec('0x20')]['describe']()[_0x1eec('0x19')](respondWithResult(_0x4c89b1,null))[_0x1eec('0x28')](handleError(_0x4c89b1,null));};exports[_0x1eec('0x3a')]=function(_0x565223,_0x1abc38){return db['FaxMessage'][_0x1eec('0x36')]({'where':{'id':_0x565223[_0x1eec('0x2a')]['id']}})[_0x1eec('0x19')](handleEntityNotFound(_0x1abc38,null))[_0x1eec('0x19')](function(_0x3dcaf1){if(_0x3dcaf1){return _0x3dcaf1[_0x1eec('0x3a')](_0x565223[_0x1eec('0x38')][_0x1eec('0x3b')],_[_0x1eec('0x3c')](_0x565223[_0x1eec('0x38')],[_0x1eec('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x1abc38,null))[_0x1eec('0x28')](handleError(_0x1abc38,null));};exports['getMessages']=function(_0x2a492f,_0x161867){var _0x540276={'raw':![],'where':{}};var _0x50f4ec={};var _0x137b73={'count':0x0,'rows':[]};return db[_0x1eec('0x20')][_0x1eec('0x3d')]({'where':{'id':_0x2a492f[_0x1eec('0x2a')]['id']}})['then'](handleEntityNotFound(_0x161867,null))[_0x1eec('0x19')](function(_0x1bbb2){if(_0x1bbb2){_0x50f4ec[_0x1eec('0x2f')]=_[_0x1eec('0x2b')](db[_0x1eec('0x3e')][_0x1eec('0x21')]);_0x50f4ec[_0x1eec('0x2c')]=_[_0x1eec('0x2b')](_0x2a492f[_0x1eec('0x2c')]);_0x50f4ec['filters']=_[_0x1eec('0x2e')](_0x50f4ec[_0x1eec('0x2f')],_0x50f4ec['query']);_0x540276[_0x1eec('0x32')]=_[_0x1eec('0x2e')](_0x50f4ec[_0x1eec('0x2f')],qs[_0x1eec('0x30')](_0x2a492f[_0x1eec('0x2c')]['fields']));_0x540276['attributes']=_0x540276[_0x1eec('0x32')]['length']?_0x540276[_0x1eec('0x32')]:_0x50f4ec['model'];if(!_0x2a492f[_0x1eec('0x2c')][_0x1eec('0x3f')](_0x1eec('0x40'))){_0x540276['limit']=qs[_0x1eec('0x13')](_0x2a492f['query'][_0x1eec('0x13')]);_0x540276['offset']=qs[_0x1eec('0x11')](_0x2a492f['query']['offset']);}_0x540276[_0x1eec('0x41')]=qs[_0x1eec('0x42')](_0x2a492f[_0x1eec('0x2c')][_0x1eec('0x42')]);_0x540276['where']=qs[_0x1eec('0x2d')](_[_0x1eec('0x43')](_0x2a492f[_0x1eec('0x2c')],_0x50f4ec['filters']));_0x540276[_0x1eec('0x44')][_0x1eec('0x45')]=_0x1bbb2['id'];if(_0x2a492f[_0x1eec('0x2c')][_0x1eec('0x46')]){_0x540276[_0x1eec('0x44')]=_[_0x1eec('0x34')](_0x540276[_0x1eec('0x44')],{'$or':_[_0x1eec('0x1f')](_0x540276[_0x1eec('0x32')],function(_0x39aba5){var _0x46b51e={};_0x46b51e[_0x39aba5]={'$like':'%'+_0x2a492f[_0x1eec('0x2c')]['filter']+'%'};return _0x46b51e;})});}if(_0x2a492f[_0x1eec('0x2c')][_0x1eec('0x47')]){var _0x19c404=_0x2a492f['query']['$gte'][_0x1eec('0x48')](',');var _0xb6a6ab={};_0xb6a6ab[_0x19c404[0x0]]={'$gte':moment(_0x19c404[0x1])[_0x1eec('0x49')](_0x1eec('0x4a'))};_0x540276['where']=_[_0x1eec('0x34')](_0x540276[_0x1eec('0x44')],_0xb6a6ab);}_0x540276=_[_0x1eec('0x34')]({},_0x540276,_0x2a492f['options']);return db[_0x1eec('0x3e')][_0x1eec('0x14')]({'where':_0x540276['where']})['then'](function(_0x4d52f3){_0x137b73['count']=_0x4d52f3;if(_0x2a492f[_0x1eec('0x2c')]['includeAll']){_0x540276[_0x1eec('0x33')]=[{'all':!![]}];}return db[_0x1eec('0x3e')]['findAll'](_0x540276);})['then'](function(_0xa33386){_0x137b73[_0x1eec('0x4b')]=_0xa33386;return _0x137b73;});}})[_0x1eec('0x19')](respondWithFilteredResult(_0x161867,_0x540276))[_0x1eec('0x28')](handleError(_0x161867,null));};exports[_0x1eec('0x4c')]=function(_0x9a4441,_0x241f4d){return db[_0x1eec('0x20')][_0x1eec('0x36')]({'where':{'id':_0x9a4441[_0x1eec('0x2a')]['id']}})[_0x1eec('0x19')](handleEntityNotFound(_0x241f4d,null))[_0x1eec('0x19')](function(_0x347aaf){if(_0x347aaf){return _0x347aaf[_0x1eec('0x4d')](_0x9a4441[_0x1eec('0x38')][_0x1eec('0x3b')],_['omit'](_0x9a4441[_0x1eec('0x38')],['ids','id'])||{})[_0x1eec('0x4e')](function(){return db[_0x1eec('0x4f')][_0x1eec('0x25')]({'attributes':['id',_0x1eec('0x1c'),_0x1eec('0x50')],'where':{'id':_0x9a4441[_0x1eec('0x38')]['ids']}});})[_0x1eec('0x19')](function(_0x22c20e){socket['emit'](_0x1eec('0x51'),{'id':Number(_0x9a4441['params']['id']),'tags':_0x22c20e||[]});return{'id':Number(_0x9a4441[_0x1eec('0x2a')]['id']),'tags':_0x22c20e||[]};});}})[_0x1eec('0x19')](respondWithResult(_0x241f4d,null))[_0x1eec('0x28')](handleError(_0x241f4d,null));};exports[_0x1eec('0x52')]=function(_0xbb316d,_0x9251f0){return db[_0x1eec('0x20')][_0x1eec('0x36')]({'where':{'id':_0xbb316d[_0x1eec('0x2a')]['id']}})[_0x1eec('0x19')](handleEntityNotFound(_0x9251f0,null))[_0x1eec('0x19')](function(_0x222b6e){if(_0x222b6e){return _0x222b6e[_0x1eec('0x52')](_0xbb316d[_0x1eec('0x2c')]['ids']);}})['then'](respondWithStatusCode(_0x9251f0,null))[_0x1eec('0x28')](handleError(_0x9251f0,null));};exports[_0x1eec('0x53')]=function(_0x42e67b,_0x11d14e){var _0x3c59f9=moment()[_0x1eec('0x54')]()[_0x1eec('0x55')]();var _0x1faf45=path['join'](config['root'],_0x1eec('0x56'),_0x1eec('0x57'),_0x1eec('0x58'));var _0x21b7d9=path[_0x1eec('0x59')](config[_0x1eec('0x5a')],_0x1eec('0x56'),_0x1eec('0x57'),_0x1eec('0x5b'));var _0x3e19c0=path['join'](_0x1faf45,_0x3c59f9);var _0x260e37=util[_0x1eec('0x49')](_0x1eec('0x5c'),_0x42e67b[_0x1eec('0x2a')]['id'],_0x3c59f9);var _0x3acb79=path[_0x1eec('0x59')](_0x1faf45,_0x260e37);var _0x3031d4=[];_0x3031d4['push']({'model':db[_0x1eec('0x5d')],'as':_0x1eec('0x5d'),'raw':!![]});var _0x42e0a0=[{'model':db[_0x1eec('0x3e')],'as':'Messages','attributes':['id',_0x1eec('0x38'),'createdAt'],'include':_0x3031d4}];return db[_0x1eec('0x20')]['find']({'where':{'id':_0x42e67b[_0x1eec('0x2a')]['id']},'include':_0x42e0a0})[_0x1eec('0x19')](handleEntityNotFound(_0x11d14e,null))[_0x1eec('0x19')](function(_0x15c72f){if(_0x15c72f&&_0x15c72f[_0x1eec('0x5e')]){var _0xe985b9=_0x15c72f[_0x1eec('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x3e19c0);for(var _0x4f5c8e=0x0;_0x4f5c8e<_0xe985b9['Messages'][_0x1eec('0x31')];_0x4f5c8e++){var _0x3e6acb=_0xe985b9[_0x1eec('0x5e')][_0x4f5c8e][_0x1eec('0x5d')];if(_0x3e6acb){var _0xe558bf=path[_0x1eec('0x59')](_0x21b7d9,_0x3e6acb['basename']);if(fs[_0x1eec('0x60')](_0xe558bf)){fs['createReadStream'](_0xe558bf)['pipe'](fs['createWriteStream'](path[_0x1eec('0x59')](_0x3e19c0,_0x3e6acb[_0x1eec('0x61')])));}}}return BPromise[_0x1eec('0x62')]()[_0x1eec('0x19')](function(){return new BPromise(function(_0x423e48,_0xee6298){zipdir(_0x3e19c0,{'saveTo':_0x3acb79},function(_0x101233,_0x1c8ff6){if(_0x101233)return _0xee6298(_0x101233);return _0x423e48(_0x1c8ff6);});})[_0x1eec('0x19')](function(){return new BPromise(function(_0x19ac30,_0x100799){rimraf(_0x3e19c0,function(_0x5c7228){if(_0x5c7228)_0x100799(_0x5c7228);return _0x19ac30();});});})[_0x1eec('0x19')](function(){return _0x11d14e[_0x1eec('0x53')](_0x3acb79,_0x260e37,function(_0x3ee50f){if(_0x3ee50f){console[_0x1eec('0x63')]('err',_0x3ee50f);}else{fs[_0x1eec('0x64')](_0x3acb79);}});});});}else{return _0x11d14e[_0x1eec('0xe')](0xc8);}})[_0x1eec('0x28')](handleError(_0x11d14e,null));}; \ No newline at end of file +var _0xb60c=['get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','sendStatus','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','count','set','update','then','destroy','name','send','index','map','rawAttributes','type','key','getOptions','findAll','fax','query','user','show','model','FaxInteraction','keys','filters','intersection','attributes','fields','length','include','merge','options','catch','body','find','params','describe','FaxMessage','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','limit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','includeAll','rows','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt'];(function(_0x269a6f,_0x4c43c5){var _0x29e1e6=function(_0xe6081e){while(--_0xe6081e){_0x269a6f['push'](_0x269a6f['shift']());}};_0x29e1e6(++_0x4c43c5);}(_0xb60c,0xd7));var _0xcb60=function(_0x4ec2c6,_0x4d14ec){_0x4ec2c6=_0x4ec2c6-0x0;var _0x4c75b3=_0xb60c[_0x4ec2c6];return _0x4c75b3;};'use strict';var rimraf=require(_0xcb60('0x0'));var zipdir=require(_0xcb60('0x1'));var moment=require(_0xcb60('0x2'));var BPromise=require('bluebird');var util=require(_0xcb60('0x3'));var path=require(_0xcb60('0x4'));var fs=require('fs');var _=require(_0xcb60('0x5'));var Redis=require('ioredis');var interaction=require(_0xcb60('0x6'));var qs=require(_0xcb60('0x7'));var logger=require('../../config/logger')(_0xcb60('0x8'));var config=require(_0xcb60('0x9'));var db=require(_0xcb60('0xa'))['db'];config[_0xcb60('0xb')]=_[_0xcb60('0xc')](config['redis'],{'host':_0xcb60('0xd'),'port':0x18eb});var socket=require(_0xcb60('0xe'))(new Redis(config[_0xcb60('0xb')]));require(_0xcb60('0xf'))[_0xcb60('0x10')](socket);function respondWithStatusCode(_0x34c365,_0x585d50){_0x585d50=_0x585d50||0xcc;return function(_0x36619e){if(_0x36619e){return _0x34c365['sendStatus'](_0x585d50);}return _0x34c365[_0xcb60('0x11')](_0x585d50)[_0xcb60('0x12')]();};}function respondWithResult(_0x51554a,_0xc52abb){_0xc52abb=_0xc52abb||0xc8;return function(_0x5abfd5){if(_0x5abfd5){return _0x51554a['status'](_0xc52abb)[_0xcb60('0x13')](_0x5abfd5);}};}function respondWithFilteredResult(_0x437efe,_0x9bb650){return function(_0x105743){if(_0x105743){var _0x55c612=typeof _0x9bb650[_0xcb60('0x14')]===_0xcb60('0x15')&&typeof _0x9bb650['limit']===_0xcb60('0x15');var _0x1bf972=_0x105743[_0xcb60('0x16')];var _0x28f8a3=_0x55c612?0x0:_0x9bb650[_0xcb60('0x14')];var _0x20bc7f=_0x55c612?_0x105743[_0xcb60('0x16')]:_0x9bb650[_0xcb60('0x14')]+_0x9bb650['limit'];var _0x30cfd9;if(_0x20bc7f>=_0x1bf972){_0x20bc7f=_0x1bf972;_0x30cfd9=0xc8;}else{_0x30cfd9=0xce;}_0x437efe['status'](_0x30cfd9);return _0x437efe[_0xcb60('0x17')]('Content-Range',_0x28f8a3+'-'+_0x20bc7f+'/'+_0x1bf972)[_0xcb60('0x13')](_0x105743);}return null;};}function saveUpdates(_0x1dbacd){return function(_0x2b1572){if(_0x2b1572){return _0x2b1572[_0xcb60('0x18')](_0x1dbacd)[_0xcb60('0x19')](function(_0xdf348a){return _0xdf348a;});}return null;};}function removeEntity(_0x441391){return function(_0x14c1de){if(_0x14c1de){return _0x14c1de[_0xcb60('0x1a')]()[_0xcb60('0x19')](function(){_0x441391[_0xcb60('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153ff9){return function(_0x28fbb6){if(!_0x28fbb6){_0x153ff9['sendStatus'](0x194);}return _0x28fbb6;};}function handleError(_0x325f5a,_0x477c1d){_0x477c1d=_0x477c1d||0x1f4;return function(_0x44cced){logger['error'](_0x44cced['stack']);if(_0x44cced[_0xcb60('0x1b')]){delete _0x44cced[_0xcb60('0x1b')];}_0x325f5a[_0xcb60('0x11')](_0x477c1d)[_0xcb60('0x1c')](_0x44cced);};}exports[_0xcb60('0x1d')]=function(_0x458574,_0x31561c){var _0x26e9c1={};var _0x9ff874=_[_0xcb60('0x1e')](db['FaxInteraction'][_0xcb60('0x1f')],function(_0x3ed41c){return{'name':_0x3ed41c['fieldName'],'type':_0x3ed41c[_0xcb60('0x20')][_0xcb60('0x21')]};});_0x26e9c1=qs[_0xcb60('0x22')](_0x9ff874,_0x458574);return interaction[_0xcb60('0x23')](_0xcb60('0x24'),_0x458574[_0xcb60('0x25')],_0x458574[_0xcb60('0x26')],_0x26e9c1,_0x9ff874)[_0xcb60('0x19')](respondWithFilteredResult(_0x31561c,_0x26e9c1))['catch'](handleError(_0x31561c,null));};exports[_0xcb60('0x27')]=function(_0x4dd4ab,_0x3522c4){var _0x3ec0b5={'raw':![],'where':{'id':_0x4dd4ab['params']['id']}},_0x170266={};_0x170266[_0xcb60('0x28')]=_['keys'](db[_0xcb60('0x29')][_0xcb60('0x1f')]);_0x170266[_0xcb60('0x25')]=_[_0xcb60('0x2a')](_0x4dd4ab['query']);_0x170266[_0xcb60('0x2b')]=_[_0xcb60('0x2c')](_0x170266['model'],_0x170266[_0xcb60('0x25')]);_0x3ec0b5[_0xcb60('0x2d')]=_[_0xcb60('0x2c')](_0x170266['model'],qs[_0xcb60('0x2e')](_0x4dd4ab[_0xcb60('0x25')][_0xcb60('0x2e')]));_0x3ec0b5[_0xcb60('0x2d')]=_0x3ec0b5[_0xcb60('0x2d')][_0xcb60('0x2f')]?_0x3ec0b5[_0xcb60('0x2d')]:_0x170266[_0xcb60('0x28')];if(_0x4dd4ab['query']['includeAll']){_0x3ec0b5[_0xcb60('0x30')]=[{'all':!![]}];}_0x3ec0b5=_[_0xcb60('0x31')]({},_0x3ec0b5,_0x4dd4ab[_0xcb60('0x32')]);return db[_0xcb60('0x29')]['find'](_0x3ec0b5)['then'](handleEntityNotFound(_0x3522c4,null))[_0xcb60('0x19')](respondWithResult(_0x3522c4,null))[_0xcb60('0x33')](handleError(_0x3522c4,null));};exports['create']=function(_0xd47574,_0x4dded4){return db[_0xcb60('0x29')]['create'](_0xd47574[_0xcb60('0x34')],{})[_0xcb60('0x19')](respondWithResult(_0x4dded4,0xc9))[_0xcb60('0x33')](handleError(_0x4dded4,null));};exports[_0xcb60('0x18')]=function(_0x3e68a9,_0x1251e7){if(_0x3e68a9[_0xcb60('0x34')]['id']){delete _0x3e68a9[_0xcb60('0x34')]['id'];}return db[_0xcb60('0x29')][_0xcb60('0x35')]({'where':{'id':_0x3e68a9[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x1251e7,null))[_0xcb60('0x19')](saveUpdates(_0x3e68a9[_0xcb60('0x34')],null))[_0xcb60('0x19')](respondWithResult(_0x1251e7,null))[_0xcb60('0x33')](handleError(_0x1251e7,null));};exports[_0xcb60('0x1a')]=function(_0x1bfb9b,_0x123ff1){return db['FaxInteraction'][_0xcb60('0x35')]({'where':{'id':_0x1bfb9b['params']['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x123ff1,null))['then'](removeEntity(_0x123ff1,null))[_0xcb60('0x33')](handleError(_0x123ff1,null));};exports['describe']=function(_0x14af41,_0x5d171f){return db['FaxInteraction'][_0xcb60('0x37')]()['then'](respondWithResult(_0x5d171f,null))[_0xcb60('0x33')](handleError(_0x5d171f,null));};exports['addMessage']=function(_0x8c0f02,_0x19462a){return db[_0xcb60('0x38')][_0xcb60('0x35')]({'where':{'id':_0x8c0f02[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x19462a,null))['then'](function(_0x128f8b){if(_0x128f8b){return _0x128f8b[_0xcb60('0x39')](_0x8c0f02[_0xcb60('0x34')][_0xcb60('0x3a')],_[_0xcb60('0x3b')](_0x8c0f02[_0xcb60('0x34')],[_0xcb60('0x3a'),'id'])||{});}})[_0xcb60('0x19')](respondWithResult(_0x19462a,null))[_0xcb60('0x33')](handleError(_0x19462a,null));};exports[_0xcb60('0x3c')]=function(_0x494b4a,_0xf5245a){var _0x138e10={'raw':![],'where':{}};var _0x499d1b={};var _0x3c2c45={'count':0x0,'rows':[]};return db[_0xcb60('0x29')]['findOne']({'where':{'id':_0x494b4a[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0xf5245a,null))[_0xcb60('0x19')](function(_0x3da160){if(_0x3da160){_0x499d1b[_0xcb60('0x28')]=_['keys'](db[_0xcb60('0x38')][_0xcb60('0x1f')]);_0x499d1b[_0xcb60('0x25')]=_['keys'](_0x494b4a['query']);_0x499d1b[_0xcb60('0x2b')]=_[_0xcb60('0x2c')](_0x499d1b[_0xcb60('0x28')],_0x499d1b['query']);_0x138e10[_0xcb60('0x2d')]=_[_0xcb60('0x2c')](_0x499d1b['model'],qs[_0xcb60('0x2e')](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x2e')]));_0x138e10['attributes']=_0x138e10[_0xcb60('0x2d')]['length']?_0x138e10['attributes']:_0x499d1b[_0xcb60('0x28')];if(!_0x494b4a[_0xcb60('0x25')][_0xcb60('0x3d')](_0xcb60('0x3e'))){_0x138e10[_0xcb60('0x3f')]=qs[_0xcb60('0x3f')](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x3f')]);_0x138e10['offset']=qs['offset'](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x14')]);}_0x138e10[_0xcb60('0x40')]=qs['sort'](_0x494b4a[_0xcb60('0x25')][_0xcb60('0x41')]);_0x138e10[_0xcb60('0x42')]=qs[_0xcb60('0x2b')](_[_0xcb60('0x43')](_0x494b4a[_0xcb60('0x25')],_0x499d1b[_0xcb60('0x2b')]));_0x138e10[_0xcb60('0x42')][_0xcb60('0x44')]=_0x3da160['id'];if(_0x494b4a[_0xcb60('0x25')][_0xcb60('0x45')]){_0x138e10[_0xcb60('0x42')]=_[_0xcb60('0x31')](_0x138e10[_0xcb60('0x42')],{'$or':_[_0xcb60('0x1e')](_0x138e10[_0xcb60('0x2d')],function(_0x1ca442){var _0x5d9124={};_0x5d9124[_0x1ca442]={'$like':'%'+_0x494b4a['query'][_0xcb60('0x45')]+'%'};return _0x5d9124;})});}if(_0x494b4a[_0xcb60('0x25')][_0xcb60('0x46')]){var _0x53a0b2=_0x494b4a[_0xcb60('0x25')][_0xcb60('0x46')][_0xcb60('0x47')](',');var _0x33dd6e={};_0x33dd6e[_0x53a0b2[0x0]]={'$gte':moment(_0x53a0b2[0x1])[_0xcb60('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x138e10[_0xcb60('0x42')]=_[_0xcb60('0x31')](_0x138e10[_0xcb60('0x42')],_0x33dd6e);}_0x138e10=_[_0xcb60('0x31')]({},_0x138e10,_0x494b4a[_0xcb60('0x32')]);return db[_0xcb60('0x38')][_0xcb60('0x16')]({'where':_0x138e10[_0xcb60('0x42')]})['then'](function(_0x1b35b8){_0x3c2c45[_0xcb60('0x16')]=_0x1b35b8;if(_0x494b4a['query'][_0xcb60('0x49')]){_0x138e10[_0xcb60('0x30')]=[{'all':!![]}];}return db[_0xcb60('0x38')]['findAll'](_0x138e10);})['then'](function(_0x932ada){_0x3c2c45[_0xcb60('0x4a')]=_0x932ada;return _0x3c2c45;});}})[_0xcb60('0x19')](respondWithFilteredResult(_0xf5245a,_0x138e10))[_0xcb60('0x33')](handleError(_0xf5245a,null));};exports['addTags']=function(_0x344c97,_0x51638c){return db[_0xcb60('0x29')][_0xcb60('0x35')]({'where':{'id':_0x344c97[_0xcb60('0x36')]['id']}})['then'](handleEntityNotFound(_0x51638c,null))[_0xcb60('0x19')](function(_0x2c139b){if(_0x2c139b){return _0x2c139b[_0xcb60('0x4b')](_0x344c97[_0xcb60('0x34')][_0xcb60('0x3a')],_['omit'](_0x344c97[_0xcb60('0x34')],[_0xcb60('0x3a'),'id'])||{})[_0xcb60('0x4c')](function(){return db[_0xcb60('0x4d')][_0xcb60('0x23')]({'attributes':['id',_0xcb60('0x1b'),_0xcb60('0x4e')],'where':{'id':_0x344c97[_0xcb60('0x34')][_0xcb60('0x3a')]}});})[_0xcb60('0x19')](function(_0x1c42b9){socket[_0xcb60('0x4f')](_0xcb60('0x50'),{'id':Number(_0x344c97[_0xcb60('0x36')]['id']),'tags':_0x1c42b9||[]});return{'id':Number(_0x344c97[_0xcb60('0x36')]['id']),'tags':_0x1c42b9||[]};});}})[_0xcb60('0x19')](respondWithResult(_0x51638c,null))[_0xcb60('0x33')](handleError(_0x51638c,null));};exports['removeTags']=function(_0xa3266e,_0x4fd6bb){return db['FaxInteraction']['find']({'where':{'id':_0xa3266e[_0xcb60('0x36')]['id']}})[_0xcb60('0x19')](handleEntityNotFound(_0x4fd6bb,null))[_0xcb60('0x19')](function(_0x4d3200){if(_0x4d3200){return _0x4d3200[_0xcb60('0x51')](_0xa3266e[_0xcb60('0x25')][_0xcb60('0x3a')]);}})[_0xcb60('0x19')](respondWithStatusCode(_0x4fd6bb,null))[_0xcb60('0x33')](handleError(_0x4fd6bb,null));};exports[_0xcb60('0x52')]=function(_0x4541a0,_0x417e1b){var _0x124238=moment()[_0xcb60('0x53')]()['toString']();var _0x479638=path[_0xcb60('0x54')](config[_0xcb60('0x55')],_0xcb60('0x56'),'files','tmp');var _0x1fc0f0=path[_0xcb60('0x54')](config[_0xcb60('0x55')],_0xcb60('0x56'),_0xcb60('0x57'),_0xcb60('0x58'));var _0xdfc2e6=path[_0xcb60('0x54')](_0x479638,_0x124238);var _0x481d0f=util[_0xcb60('0x48')](_0xcb60('0x59'),_0x4541a0[_0xcb60('0x36')]['id'],_0x124238);var _0x52f5dc=path[_0xcb60('0x54')](_0x479638,_0x481d0f);var _0x30a17b=[];_0x30a17b[_0xcb60('0x5a')]({'model':db[_0xcb60('0x5b')],'as':'Attachment','raw':!![]});var _0x1370ad=[{'model':db[_0xcb60('0x38')],'as':_0xcb60('0x5c'),'attributes':['id',_0xcb60('0x34'),_0xcb60('0x5d')],'include':_0x30a17b}];return db[_0xcb60('0x29')][_0xcb60('0x35')]({'where':{'id':_0x4541a0[_0xcb60('0x36')]['id']},'include':_0x1370ad})[_0xcb60('0x19')](handleEntityNotFound(_0x417e1b,null))[_0xcb60('0x19')](function(_0x25663d){if(_0x25663d&&_0x25663d[_0xcb60('0x5c')]){var _0x3f9df5=_0x25663d[_0xcb60('0x5e')]({'plain':!![]});fs[_0xcb60('0x5f')](_0xdfc2e6);for(var _0x304f82=0x0;_0x304f82<_0x3f9df5['Messages']['length'];_0x304f82++){var _0x2c3778=_0x3f9df5[_0xcb60('0x5c')][_0x304f82][_0xcb60('0x5b')];if(_0x2c3778){var _0x14220d=path['join'](_0x1fc0f0,_0x2c3778[_0xcb60('0x60')]);if(fs[_0xcb60('0x61')](_0x14220d)){fs[_0xcb60('0x62')](_0x14220d)['pipe'](fs[_0xcb60('0x63')](path['join'](_0xdfc2e6,_0x2c3778[_0xcb60('0x60')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x346208,_0x12243b){zipdir(_0xdfc2e6,{'saveTo':_0x52f5dc},function(_0x5940f6,_0x2be12f){if(_0x5940f6)return _0x12243b(_0x5940f6);return _0x346208(_0x2be12f);});})['then'](function(){return new BPromise(function(_0x14caff,_0x59c6ba){rimraf(_0xdfc2e6,function(_0x4e4934){if(_0x4e4934)_0x59c6ba(_0x4e4934);return _0x14caff();});});})[_0xcb60('0x19')](function(){return _0x417e1b[_0xcb60('0x52')](_0x52f5dc,_0x481d0f,function(_0x12c94d){if(_0x12c94d){console[_0xcb60('0x64')](_0xcb60('0x65'),_0x12c94d);}else{fs['unlinkSync'](_0x52f5dc);}});});});}else{return _0x417e1b[_0xcb60('0x66')](0xc8);}})[_0xcb60('0x33')](handleError(_0x417e1b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ac65fef..0c772a4 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 _0x71f9=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','setDataValue','findAll','emit','hasOwnProperty','hook'];(function(_0x1305ab,_0x38c3aa){var _0x387c88=function(_0x4fbcd7){while(--_0x4fbcd7){_0x1305ab['push'](_0x1305ab['shift']());}};_0x387c88(++_0x38c3aa);}(_0x71f9,0x10b));var _0x971f=function(_0x1374b7,_0x359515){_0x1374b7=_0x1374b7-0x0;var _0x21d926=_0x71f9[_0x1374b7];return _0x21d926;};'use strict';var EventEmitter=require(_0x971f('0x0'));var FaxInteraction=require(_0x971f('0x1'))['db'][_0x971f('0x2')];var FaxMessage=require(_0x971f('0x1'))['db'][_0x971f('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x971f('0x4'),'afterUpdate':_0x971f('0x5'),'afterDestroy':_0x971f('0x6')};function emitEvent(_0x1044db){return function(_0x1f553a,_0x56a485,_0x53ac24){_0x1f553a[_0x971f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4738f){_0x1f553a[_0x971f('0x8')]('Users',_0x4738f['map'](function(_0x14bb5d){return{'id':_0x14bb5d['id']};}));return FaxMessage[_0x971f('0x9')]({'where':{'FaxInteractionId':_0x1f553a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4bb158){_0x1f553a[_0x971f('0x8')]('unreadMessages',_0x4bb158['length']);FaxInteractionEvents[_0x971f('0xa')](_0x1044db+':'+_0x1f553a['id'],_0x1f553a);FaxInteractionEvents[_0x971f('0xa')](_0x1044db,_0x1f553a);_0x53ac24(null);})['catch'](_0x53ac24(null));};}for(var e in events){if(events[_0x971f('0xb')](e)){var event=events[e];FaxInteraction[_0x971f('0xc')](e,emitEvent(event));}}module[_0x971f('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x80b0=['FaxInteraction','FaxMessage','save','update','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x80b0,0x95));var _0x080b=function(_0x8bbd6d,_0x1bcd5b){_0x8bbd6d=_0x8bbd6d-0x0;var _0x3d5539=_0x80b0[_0x8bbd6d];return _0x3d5539;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x080b('0x0'))['db'][_0x080b('0x1')];var FaxMessage=require(_0x080b('0x0'))['db'][_0x080b('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x080b('0x3'),'afterUpdate':_0x080b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x595093){return function(_0x5d1d41,_0x234a85,_0x3af6b9){_0x5d1d41['getUsers']({'attributes':['id'],'raw':!![]})[_0x080b('0x5')](function(_0x4cb5e2){_0x5d1d41[_0x080b('0x6')](_0x080b('0x7'),_0x4cb5e2[_0x080b('0x8')](function(_0x525307){return{'id':_0x525307['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5d1d41['id'],'direction':'in','read':![]},'raw':!![]});})[_0x080b('0x5')](function(_0x46c4d1){_0x5d1d41[_0x080b('0x6')]('unreadMessages',_0x46c4d1[_0x080b('0x9')]);FaxInteractionEvents[_0x080b('0xa')](_0x595093+':'+_0x5d1d41['id'],_0x5d1d41);FaxInteractionEvents[_0x080b('0xa')](_0x595093,_0x5d1d41);_0x3af6b9(null);})[_0x080b('0xb')](_0x3af6b9(null));};}for(var e in events){if(events[_0x080b('0xc')](e)){var event=events[e];FaxInteraction[_0x080b('0xd')](e,emitEvent(event));}}module[_0x080b('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7aaffcf..50663b4 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 _0x881e=['format','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closed','closedAt'];(function(_0x2cf730,_0x34b921){var _0x5ed627=function(_0x539749){while(--_0x539749){_0x2cf730['push'](_0x2cf730['shift']());}};_0x5ed627(++_0x34b921);}(_0x881e,0x146));var _0xe881=function(_0x2fecad,_0x7e23a9){_0x2fecad=_0x2fecad-0x0;var _0x5d8756=_0x881e[_0x2fecad];return _0x5d8756;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe881('0x0'))(_0xe881('0x1'));var moment=require('moment');var BPromise=require(_0xe881('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe881('0x3'));var rimraf=require(_0xe881('0x4'));var config=require(_0xe881('0x5'));var attributes=require(_0xe881('0x6'));module['exports']=function(_0x1d9bc0,_0xa4fe06){return _0x1d9bc0['define'](_0xe881('0x7'),attributes,{'tableName':_0xe881('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe16d23,_0x547217,_0x4fb826){if(_0xe16d23[_0xe881('0x9')](_0xe881('0xa'))){_0xe16d23[_0xe881('0xb')]=moment()[_0xe881('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4fb826(null,_0xe16d23);}}});}; \ No newline at end of file +var _0x65a9=['path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x67e59a,_0x119ae1){var _0x44c8ef=function(_0x540563){while(--_0x540563){_0x67e59a['push'](_0x67e59a['shift']());}};_0x44c8ef(++_0x119ae1);}(_0x65a9,0x81));var _0x965a=function(_0x3897a7,_0x572a12){_0x3897a7=_0x3897a7-0x0;var _0x15a70=_0x65a9[_0x3897a7];return _0x15a70;};'use strict';var _=require(_0x965a('0x0'));var util=require(_0x965a('0x1'));var logger=require(_0x965a('0x2'))(_0x965a('0x3'));var moment=require(_0x965a('0x4'));var BPromise=require(_0x965a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x965a('0x6'));var rimraf=require(_0x965a('0x7'));var config=require(_0x965a('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x965a('0x9')]=function(_0x36524e,_0x952d9a){return _0x36524e[_0x965a('0xa')](_0x965a('0xb'),attributes,{'tableName':_0x965a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8a3728,_0x2cc5fd,_0x250bad){if(_0x8a3728['changed'](_0x965a('0xd'))){_0x8a3728[_0x965a('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x250bad(null,_0x8a3728);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d089f3a..b5f6f66 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 _0x576a=['spread','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','debug','AddTagsToFaxInteraction','find','then','addTags','ids','omit','body'];(function(_0x31bade,_0x246ff0){var _0x4b4386=function(_0x26a6b0){while(--_0x26a6b0){_0x31bade['push'](_0x31bade['shift']());}};_0x4b4386(++_0x246ff0);}(_0x576a,0x192));var _0xa576=function(_0x3a46cf,_0x40141a){_0x3a46cf=_0x3a46cf-0x0;var _0x13a9ca=_0x576a[_0x3a46cf];return _0x13a9ca;};'use strict';var _=require(_0xa576('0x0'));var util=require(_0xa576('0x1'));var moment=require('moment');var BPromise=require(_0xa576('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa576('0x3'))['db'];var utils=require(_0xa576('0x4'));var logger=require('../../config/logger')(_0xa576('0x5'));var config=require(_0xa576('0x6'));var jayson=require(_0xa576('0x7'));var client=jayson[_0xa576('0x8')]['http']({'port':0x232a});config[_0xa576('0x9')]=_['defaults'](config[_0xa576('0x9')],{'host':_0xa576('0xa'),'port':0x18eb});var socket=require(_0xa576('0xb'))(new Redis(config['redis']));require(_0xa576('0xc'))[_0xa576('0xd')](socket);function respondWithRpcPromise(_0x33c721,_0x581013,_0x2bdf0c){return new BPromise(function(_0xedc99e,_0x7df97a){return client['request'](_0x33c721,_0x2bdf0c)['then'](function(_0x485eb1){logger[_0xa576('0xe')](_0xa576('0xf'),_0x581013,_0xa576('0x10'));logger['debug'](_0xa576('0x11'),_0x581013,_0xa576('0x10'),JSON[_0xa576('0x12')](_0x485eb1));if(_0x485eb1[_0xa576('0x13')]){if(_0x485eb1['error'][_0xa576('0x14')]===0x1f4){logger[_0xa576('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x581013,_0x485eb1[_0xa576('0x13')][_0xa576('0x15')]);return _0x7df97a(_0x485eb1[_0xa576('0x13')][_0xa576('0x15')]);}logger[_0xa576('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x581013,_0x485eb1[_0xa576('0x13')][_0xa576('0x15')]);return _0xedc99e(_0x485eb1[_0xa576('0x13')]['message']);}else{logger['info'](_0xa576('0xf'),_0x581013,_0xa576('0x10'));_0xedc99e(_0x485eb1[_0xa576('0x16')]['message']);}})[_0xa576('0x17')](function(_0x4bf27a){logger[_0xa576('0x13')](_0xa576('0xf'),_0x581013,_0x4bf27a);_0x7df97a(_0x4bf27a);});});}exports[_0xa576('0x18')]=function(_0x166f93){var _0xb68a7b=this;return new Promise(function(_0x3b5223,_0x4218f7){return db[_0xa576('0x19')]['update'](_0x166f93['body'],{'raw':_0x166f93[_0xa576('0x1a')]?_0x166f93[_0xa576('0x1a')][_0xa576('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x166f93[_0xa576('0x1a')]?_0x166f93[_0xa576('0x1a')][_0xa576('0x1c')]||null:null,'attributes':_0x166f93[_0xa576('0x1a')]?_0x166f93[_0xa576('0x1a')][_0xa576('0x1d')]||null:null,'limit':_0x166f93['options']?_0x166f93['options']['limit']||null:null})['then'](function(_0x2715d6){logger[_0xa576('0xe')](_0xa576('0x18'),_0x166f93);logger[_0xa576('0x1e')](_0xa576('0x18'),_0x166f93,JSON[_0xa576('0x12')](_0x2715d6));_0x3b5223(_0x2715d6);})['catch'](function(_0x378f62){logger[_0xa576('0x13')](_0xa576('0x18'),_0x378f62[_0xa576('0x15')],_0x166f93);_0x4218f7(_0xb68a7b[_0xa576('0x13')](0x1f4,_0x378f62[_0xa576('0x15')]));});});};exports[_0xa576('0x1f')]=function(_0x48904d){return new Promise(function(_0x446b05,_0x46c5ab){return db[_0xa576('0x19')][_0xa576('0x20')]({'where':_0x48904d[_0xa576('0x1a')]?_0x48904d['options'][_0xa576('0x1c')]||null:null})[_0xa576('0x21')](function(_0x1f0885){if(_0x1f0885){return _0x1f0885[_0xa576('0x22')](_0x48904d['body'][_0xa576('0x23')],_[_0xa576('0x24')](_0x48904d[_0xa576('0x25')],[_0xa576('0x23'),'id'])||{});}})[_0xa576('0x26')](function(_0x205fa0){logger[_0xa576('0xe')](_0xa576('0x27'),_0x48904d);logger['debug'](_0xa576('0x27'),_0x48904d,JSON['stringify'](_0x205fa0));_0x446b05(_0x205fa0);})[_0xa576('0x17')](function(_0x44c8ba){logger[_0xa576('0x13')](_0xa576('0x27'),_0x44c8ba[_0xa576('0x15')],_0x48904d);_0x46c5ab(_this[_0xa576('0x13')](0x1f4,_0x44c8ba[_0xa576('0x15')]));});});}; \ No newline at end of file +var _0x8236=['defaults','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis'];(function(_0x3b9573,_0x53968a){var _0x318162=function(_0x997478){while(--_0x997478){_0x3b9573['push'](_0x3b9573['shift']());}};_0x318162(++_0x53968a);}(_0x8236,0xb0));var _0x6823=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x8236[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x6823('0x0'));var util=require(_0x6823('0x1'));var moment=require('moment');var BPromise=require(_0x6823('0x2'));var rs=require(_0x6823('0x3'));var fs=require('fs');var Redis=require(_0x6823('0x4'));var db=require(_0x6823('0x5'))['db'];var utils=require(_0x6823('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6823('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x6823('0x8')]=_[_0x6823('0x9')](config[_0x6823('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6823('0x8')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x55b663,_0xbe81b9,_0x5852a4){return new BPromise(function(_0xe17d50,_0x21e912){return client[_0x6823('0xa')](_0x55b663,_0x5852a4)[_0x6823('0xb')](function(_0x10988c){logger[_0x6823('0xc')]('FaxInteraction,\x20%s,\x20%s',_0xbe81b9,_0x6823('0xd'));logger['debug'](_0x6823('0xe'),_0xbe81b9,_0x6823('0xd'),JSON[_0x6823('0xf')](_0x10988c));if(_0x10988c['error']){if(_0x10988c[_0x6823('0x10')][_0x6823('0x11')]===0x1f4){logger['error'](_0x6823('0x12'),_0xbe81b9,_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);return _0x21e912(_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0xbe81b9,_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);return _0xe17d50(_0x10988c[_0x6823('0x10')][_0x6823('0x13')]);}else{logger[_0x6823('0xc')]('FaxInteraction,\x20%s,\x20%s',_0xbe81b9,_0x6823('0xd'));_0xe17d50(_0x10988c[_0x6823('0x14')][_0x6823('0x13')]);}})[_0x6823('0x15')](function(_0x42c48b){logger['error'](_0x6823('0x12'),_0xbe81b9,_0x42c48b);_0x21e912(_0x42c48b);});});}exports[_0x6823('0x16')]=function(_0x5a6e2c){var _0x54d869=this;return new Promise(function(_0x44ddcb,_0x5720b5){return db[_0x6823('0x17')][_0x6823('0x18')](_0x5a6e2c[_0x6823('0x19')],{'raw':_0x5a6e2c[_0x6823('0x1a')]?_0x5a6e2c['options'][_0x6823('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6e2c[_0x6823('0x1a')]?_0x5a6e2c[_0x6823('0x1a')][_0x6823('0x1c')]||null:null,'attributes':_0x5a6e2c['options']?_0x5a6e2c['options'][_0x6823('0x1d')]||null:null,'limit':_0x5a6e2c[_0x6823('0x1a')]?_0x5a6e2c['options'][_0x6823('0x1e')]||null:null})[_0x6823('0xb')](function(_0x53352a){logger[_0x6823('0xc')](_0x6823('0x16'),_0x5a6e2c);logger[_0x6823('0x1f')](_0x6823('0x16'),_0x5a6e2c,JSON[_0x6823('0xf')](_0x53352a));_0x44ddcb(_0x53352a);})[_0x6823('0x15')](function(_0x5277fe){logger[_0x6823('0x10')]('UpdateFaxInteraction',_0x5277fe[_0x6823('0x13')],_0x5a6e2c);_0x5720b5(_0x54d869[_0x6823('0x10')](0x1f4,_0x5277fe[_0x6823('0x13')]));});});};exports[_0x6823('0x20')]=function(_0x31915b){return new Promise(function(_0x496cef,_0x40b516){return db['FaxInteraction']['find']({'where':_0x31915b[_0x6823('0x1a')]?_0x31915b[_0x6823('0x1a')]['where']||null:null})[_0x6823('0xb')](function(_0x436c46){if(_0x436c46){return _0x436c46[_0x6823('0x21')](_0x31915b[_0x6823('0x19')][_0x6823('0x22')],_[_0x6823('0x23')](_0x31915b[_0x6823('0x19')],['ids','id'])||{});}})['spread'](function(_0x2211b0){logger['info'](_0x6823('0x24'),_0x31915b);logger[_0x6823('0x1f')](_0x6823('0x24'),_0x31915b,JSON[_0x6823('0xf')](_0x2211b0));_0x496cef(_0x2211b0);})[_0x6823('0x15')](function(_0x7c83d2){logger['error'](_0x6823('0x24'),_0x7c83d2[_0x6823('0x13')],_0x31915b);_0x40b516(_this[_0x6823('0x10')](0x1f4,_0x7c83d2[_0x6823('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 80bb3ef..4197f60 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 _0x4600=['length','faxInteraction:','save','remove','emit','removeListener','register'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x4600,0x167));var _0x0460=function(_0x15e800,_0x4a82f9){_0x15e800=_0x15e800-0x0;var _0x176659=_0x4600[_0x15e800];return _0x176659;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0460('0x0'),_0x0460('0x1'),'update'];function createListener(_0x40b15c,_0xc2408f){return function(_0x30af95){_0xc2408f[_0x0460('0x2')](_0x40b15c,_0x30af95);};}function removeListener(_0x5b3429,_0x3f6fd2){return function(){FaxInteractionEvents[_0x0460('0x3')](_0x5b3429,_0x3f6fd2);};}exports[_0x0460('0x4')]=function(_0x1db755){for(var _0x376294=0x0,_0x5a2033=events[_0x0460('0x5')];_0x376294<_0x5a2033;_0x376294++){var _0x5cef99=events[_0x376294];var _0x501d62=createListener(_0x0460('0x6')+_0x5cef99,_0x1db755);FaxInteractionEvents['on'](_0x5cef99,_0x501d62);}}; \ No newline at end of file +var _0x386c=['update','removeListener','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x44b646,_0x2802e3){var _0x51726b=function(_0x548e1d){while(--_0x548e1d){_0x44b646['push'](_0x44b646['shift']());}};_0x51726b(++_0x2802e3);}(_0x386c,0x142));var _0xc386=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x386c[_0x42cae2];return _0x5f256f;};'use strict';var FaxInteractionEvents=require(_0xc386('0x0'));var events=[_0xc386('0x1'),'remove',_0xc386('0x2')];function createListener(_0x3ca98c,_0x4493a3){return function(_0x4a1461){_0x4493a3['emit'](_0x3ca98c,_0x4a1461);};}function removeListener(_0x43479b,_0x5101d6){return function(){FaxInteractionEvents[_0xc386('0x3')](_0x43479b,_0x5101d6);};}exports['register']=function(_0x5175b3){for(var _0x9d273a=0x0,_0xb3fe6d=events[_0xc386('0x4')];_0x9d273a<_0xb3fe6d;_0x9d273a++){var _0x1b6e3d=events[_0x9d273a];var _0x1bf344=createListener(_0xc386('0x5')+_0x1b6e3d,_0x5175b3);FaxInteractionEvents['on'](_0x1b6e3d,_0x1bf344);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c6851c2..2313d8f 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 _0x562d=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','update','delete','faxinteraction:destroy','destroy','removeTags'];(function(_0x2c4c15,_0x49245d){var _0x4499d7=function(_0x1ed911){while(--_0x1ed911){_0x2c4c15['push'](_0x2c4c15['shift']());}};_0x4499d7(++_0x49245d);}(_0x562d,0xe1));var _0xd562=function(_0x5a7e0b,_0xe07564){_0x5a7e0b=_0x5a7e0b-0x0;var _0x2c80fc=_0x562d[_0x5a7e0b];return _0x2c80fc;};'use strict';var multer=require(_0xd562('0x0'));var util=require(_0xd562('0x1'));var path=require(_0xd562('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd562('0x3')]();var fs_extra=require(_0xd562('0x4'));var auth=require(_0xd562('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd562('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xd562('0x7')](),controller[_0xd562('0x8')]);router[_0xd562('0x9')](_0xd562('0xa'),auth[_0xd562('0x7')](),controller[_0xd562('0xb')]);router['get'](_0xd562('0xc'),auth['isAuthenticated'](),controller[_0xd562('0xd')]);router[_0xd562('0x9')](_0xd562('0xe'),auth[_0xd562('0x7')](),controller[_0xd562('0xf')]);router[_0xd562('0x9')](_0xd562('0x10'),auth[_0xd562('0x7')](),controller[_0xd562('0x11')]);router[_0xd562('0x12')]('/',auth[_0xd562('0x7')](),controller['create']);router[_0xd562('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd562('0x13')]);router['post'](_0xd562('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0xd562('0x15'),_0xd562('0x16')),controller[_0xd562('0x17')]);router[_0xd562('0x18')](_0xd562('0xc'),auth['isAuthenticated'](),interaction[_0xd562('0x19')](_0xd562('0x15'),'faxinteraction:update'),controller[_0xd562('0x1a')]);router[_0xd562('0x1b')]('/:id',auth[_0xd562('0x7')](),interaction[_0xd562('0x19')](_0xd562('0x15'),_0xd562('0x1c')),controller[_0xd562('0x1d')]);router[_0xd562('0x1b')](_0xd562('0x14'),auth[_0xd562('0x7')](),controller[_0xd562('0x1e')]);module[_0xd562('0x1f')]=router; \ No newline at end of file +var _0x169c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0x169c,0x1dc));var _0xc169=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x169c[_0x2a453b];return _0x132f79;};'use strict';var multer=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var path=require('path');var timeout=require(_0xc169('0x2'));var express=require(_0xc169('0x3'));var router=express[_0xc169('0x4')]();var fs_extra=require(_0xc169('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc169('0x6'));var config=require(_0xc169('0x7'));var controller=require(_0xc169('0x8'));router[_0xc169('0x9')]('/',auth[_0xc169('0xa')](),controller[_0xc169('0xb')]);router[_0xc169('0x9')](_0xc169('0xc'),auth[_0xc169('0xa')](),controller['describe']);router[_0xc169('0x9')](_0xc169('0xd'),auth[_0xc169('0xa')](),controller[_0xc169('0xe')]);router['get'](_0xc169('0xf'),auth[_0xc169('0xa')](),controller[_0xc169('0x10')]);router[_0xc169('0x9')](_0xc169('0x11'),auth['isAuthenticated'](),controller[_0xc169('0x12')]);router['post']('/',auth[_0xc169('0xa')](),controller[_0xc169('0x13')]);router[_0xc169('0x14')](_0xc169('0xf'),auth[_0xc169('0xa')](),controller['addMessage']);router['post'](_0xc169('0x15'),auth['isAuthenticated'](),interaction[_0xc169('0x16')](_0xc169('0x17'),_0xc169('0x18')),controller['addTags']);router[_0xc169('0x19')](_0xc169('0xd'),auth[_0xc169('0xa')](),interaction['tracked']('fax',_0xc169('0x1a')),controller[_0xc169('0x1b')]);router[_0xc169('0x1c')]('/:id',auth[_0xc169('0xa')](),interaction['tracked'](_0xc169('0x17'),_0xc169('0x1d')),controller[_0xc169('0x1e')]);router[_0xc169('0x1c')](_0xc169('0x15'),auth[_0xc169('0xa')](),controller['removeTags']);module[_0xc169('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8429625..7eb881a 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 _0x6726=['ENUM','out','DATE','exports','TEXT','BOOLEAN'];(function(_0x180a34,_0x2bd0cf){var _0x42edda=function(_0x26f670){while(--_0x26f670){_0x180a34['push'](_0x180a34['shift']());}};_0x42edda(++_0x2bd0cf);}(_0x6726,0xdb));var _0x6672=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0x6726[_0x764874];return _0x29f9d5;};'use strict';var Sequelize=require('sequelize');module[_0x6672('0x0')]={'body':{'type':Sequelize[_0x6672('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6672('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6672('0x3')]('in','out'),'defaultValue':_0x6672('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6672('0x5')]}}; \ No newline at end of file +var _0x32ef=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x260b6f,_0x1edc36){var _0x3f672e=function(_0x4b536c){while(--_0x4b536c){_0x260b6f['push'](_0x260b6f['shift']());}};_0x3f672e(++_0x1edc36);}(_0x32ef,0xf9));var _0xf32e=function(_0x327f5a,_0x275253){_0x327f5a=_0x327f5a-0x0;var _0x4a3d43=_0x32ef[_0x327f5a];return _0x4a3d43;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'body':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf32e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf32e('0x5')]('in','out'),'defaultValue':_0xf32e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf32e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 76cd389..2c48b8b 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 _0x083c=['root','server','files','attachments','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','end','name','index','map','FaxMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','body','params','destroy','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','get','FaxInteraction','UserId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','User','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x083c,0x1ae));var _0xc083=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x083c[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc083('0x0'));var zipdir=require(_0xc083('0x1'));var jsonpatch=require(_0xc083('0x2'));var rp=require(_0xc083('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc083('0x4'));var path=require(_0xc083('0x5'));var sox=require(_0xc083('0x6'));var csv=require(_0xc083('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc083('0x8'));var _=require(_0xc083('0x9'));var squel=require(_0xc083('0xa'));var crypto=require(_0xc083('0xb'));var jsforce=require(_0xc083('0xc'));var deskjs=require(_0xc083('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc083('0xe'));var Papa=require('papaparse');var Redis=require(_0xc083('0xf'));var authService=require(_0xc083('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc083('0x11'));var hardwareService=require(_0xc083('0x12'));var logger=require(_0xc083('0x13'))(_0xc083('0x14'));var utils=require('../../config/utils');var config=require(_0xc083('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc083('0x16'))['db'];config['redis']=_['defaults'](config[_0xc083('0x17')],{'host':_0xc083('0x18'),'port':0x18eb});var socket=require(_0xc083('0x19'))(new Redis(config['redis']));require(_0xc083('0x1a'))[_0xc083('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc083('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xc083('0x1c')][_0xc083('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x53d682,_0x5d4ba7,_0x22adb6,_0x4fb3da){return new BPromise(function(_0x2434ba,_0x1fc906){var _0x41fb7e=_0x4fb3da||client;return _0x41fb7e['request'](_0x53d682,_0x22adb6)[_0xc083('0x1e')](function(_0x474287){logger[_0xc083('0x1f')](_0xc083('0x20'),_0x5d4ba7,'request\x20sent');logger[_0xc083('0x21')](_0xc083('0x22'),_0x5d4ba7,_0xc083('0x23'),JSON['stringify'](_0x474287));if(_0x474287[_0xc083('0x24')]){if(_0x474287[_0xc083('0x24')]['code']===0x1f4){logger[_0xc083('0x24')](_0xc083('0x20'),_0x5d4ba7,_0x474287[_0xc083('0x24')][_0xc083('0x25')]);return _0x1fc906(_0x474287[_0xc083('0x24')][_0xc083('0x25')]);}logger[_0xc083('0x24')](_0xc083('0x20'),_0x5d4ba7,_0x474287[_0xc083('0x24')][_0xc083('0x25')]);return _0x2434ba(_0x474287['error']['message']);}else{logger[_0xc083('0x1f')](_0xc083('0x20'),_0x5d4ba7,_0xc083('0x23'));_0x2434ba(_0x474287[_0xc083('0x26')][_0xc083('0x25')]);}})[_0xc083('0x27')](function(_0x2de44f){logger[_0xc083('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5d4ba7,_0x2de44f);_0x1fc906(_0x2de44f);});});}function respondWithStatusCode(_0x192451,_0x4f154b){_0x4f154b=_0x4f154b||0xcc;return function(_0x381b45){if(_0x381b45){return _0x192451[_0xc083('0x28')](_0x4f154b);}return _0x192451[_0xc083('0x29')](_0x4f154b)['end']();};}function respondWithResult(_0x208e9e,_0x154b0a){_0x154b0a=_0x154b0a||0xc8;return function(_0x3d69f1){if(_0x3d69f1){return _0x208e9e['status'](_0x154b0a)[_0xc083('0x2a')](_0x3d69f1);}};}function respondWithFilteredResult(_0x2ca7a4,_0x437324){return function(_0x460daf){if(_0x460daf){var _0x475ac9=typeof _0x437324[_0xc083('0x2b')]===_0xc083('0x2c')&&typeof _0x437324[_0xc083('0x2d')]===_0xc083('0x2c');var _0x1f6bda=_0x460daf[_0xc083('0x2e')];var _0x1991d4=_0x475ac9?0x0:_0x437324[_0xc083('0x2b')];var _0x236e4a=_0x475ac9?_0x460daf[_0xc083('0x2e')]:_0x437324[_0xc083('0x2b')]+_0x437324[_0xc083('0x2d')];var _0x11993a;if(_0x236e4a>=_0x1f6bda){_0x236e4a=_0x1f6bda;_0x11993a=0xc8;}else{_0x11993a=0xce;}_0x2ca7a4[_0xc083('0x29')](_0x11993a);return _0x2ca7a4[_0xc083('0x2f')](_0xc083('0x30'),_0x1991d4+'-'+_0x236e4a+'/'+_0x1f6bda)[_0xc083('0x2a')](_0x460daf);}return null;};}function patchUpdates(_0x421eaa){return function(_0x57b3a9){try{jsonpatch[_0xc083('0x31')](_0x57b3a9,_0x421eaa,!![]);}catch(_0x4de86a){return BPromise[_0xc083('0x32')](_0x4de86a);}return _0x57b3a9['save']();};}function saveUpdates(_0xe0ad49,_0x56794c){return function(_0x45aa02){if(_0x45aa02){return _0x45aa02[_0xc083('0x33')](_0xe0ad49)[_0xc083('0x1e')](function(_0x42b472){return _0x42b472;});}return null;};}function removeEntity(_0x5458e6,_0x4cb234){return function(_0x4a8d3f){if(_0x4a8d3f){return _0x4a8d3f['destroy']()['then'](function(){_0x5458e6['status'](0xcc)[_0xc083('0x34')]();});}};}function handleEntityNotFound(_0x3bcfcb,_0x335d1b){return function(_0x1a585c){if(!_0x1a585c){_0x3bcfcb[_0xc083('0x28')](0x194);}return _0x1a585c;};}function handleError(_0x2a0fa4,_0x41bc6a){_0x41bc6a=_0x41bc6a||0x1f4;return function(_0x333c33){logger[_0xc083('0x24')](_0x333c33['stack']);if(_0x333c33['name']){delete _0x333c33[_0xc083('0x35')];}_0x2a0fa4[_0xc083('0x29')](_0x41bc6a)['send'](_0x333c33);};}exports[_0xc083('0x36')]=function(_0x273afd,_0x346e51){var _0x156f69={},_0x54d819={},_0x21d6da={'count':0x0,'rows':[]};var _0x12e4a8=_[_0xc083('0x37')](db[_0xc083('0x38')][_0xc083('0x39')],function(_0x23948c){return{'name':_0x23948c[_0xc083('0x3a')],'type':_0x23948c[_0xc083('0x3b')]['key']};});_0x54d819[_0xc083('0x3c')]=_[_0xc083('0x37')](_0x12e4a8,'name');_0x54d819['query']=_[_0xc083('0x3d')](_0x273afd[_0xc083('0x3e')]);_0x54d819[_0xc083('0x3f')]=_[_0xc083('0x40')](_0x54d819[_0xc083('0x3c')],_0x54d819[_0xc083('0x3e')]);_0x156f69['attributes']=_['intersection'](_0x54d819[_0xc083('0x3c')],qs[_0xc083('0x41')](_0x273afd[_0xc083('0x3e')][_0xc083('0x41')]));_0x156f69[_0xc083('0x42')]=_0x156f69['attributes'][_0xc083('0x43')]?_0x156f69[_0xc083('0x42')]:_0x54d819[_0xc083('0x3c')];if(!_0x273afd[_0xc083('0x3e')][_0xc083('0x44')](_0xc083('0x45'))){_0x156f69[_0xc083('0x2d')]=qs['limit'](_0x273afd[_0xc083('0x3e')][_0xc083('0x2d')]);_0x156f69[_0xc083('0x2b')]=qs[_0xc083('0x2b')](_0x273afd['query'][_0xc083('0x2b')]);}_0x156f69['order']=qs[_0xc083('0x46')](_0x273afd['query'][_0xc083('0x46')]);_0x156f69[_0xc083('0x47')]=qs[_0xc083('0x3f')](_['pick'](_0x273afd[_0xc083('0x3e')],_0x54d819[_0xc083('0x3f')]),_0x12e4a8);if(_0x273afd[_0xc083('0x3e')][_0xc083('0x48')]){_0x156f69[_0xc083('0x47')]=_[_0xc083('0x49')](_0x156f69[_0xc083('0x47')],{'$or':_[_0xc083('0x37')](_0x12e4a8,function(_0x15c54e){if(_0x15c54e[_0xc083('0x3b')]!==_0xc083('0x4a')){var _0x2d569d={};_0x2d569d[_0x15c54e[_0xc083('0x35')]]={'$like':'%'+_0x273afd[_0xc083('0x3e')]['filter']+'%'};return _0x2d569d;}})});}_0x156f69=_[_0xc083('0x49')]({},_0x156f69,_0x273afd[_0xc083('0x4b')]);var _0x222c1d={'where':_0x156f69[_0xc083('0x47')]};return db[_0xc083('0x38')][_0xc083('0x2e')](_0x222c1d)['then'](function(_0x5a1749){_0x21d6da[_0xc083('0x2e')]=_0x5a1749;if(_0x273afd[_0xc083('0x3e')][_0xc083('0x4c')]){_0x156f69['include']=[{'all':!![]}];}return db[_0xc083('0x38')][_0xc083('0x4d')](_0x156f69);})[_0xc083('0x1e')](function(_0x540e89){_0x21d6da[_0xc083('0x4e')]=_0x540e89;return _0x21d6da;})['then'](respondWithFilteredResult(_0x346e51,_0x156f69))[_0xc083('0x27')](handleError(_0x346e51,null));};exports[_0xc083('0x4f')]=function(_0x2809fd,_0x1dfd62){var _0x557b50={'raw':!![],'where':{'id':_0x2809fd['params']['id']}},_0x3716d0={};_0x3716d0[_0xc083('0x3c')]=_['keys'](db['FaxMessage'][_0xc083('0x39')]);_0x3716d0[_0xc083('0x3e')]=_['keys'](_0x2809fd['query']);_0x3716d0[_0xc083('0x3f')]=_[_0xc083('0x40')](_0x3716d0[_0xc083('0x3c')],_0x3716d0['query']);_0x557b50['attributes']=_[_0xc083('0x40')](_0x3716d0[_0xc083('0x3c')],qs[_0xc083('0x41')](_0x2809fd[_0xc083('0x3e')][_0xc083('0x41')]));_0x557b50[_0xc083('0x42')]=_0x557b50[_0xc083('0x42')][_0xc083('0x43')]?_0x557b50[_0xc083('0x42')]:_0x3716d0['model'];if(_0x2809fd[_0xc083('0x3e')][_0xc083('0x4c')]){_0x557b50[_0xc083('0x50')]=[{'all':!![]}];}_0x557b50=_[_0xc083('0x49')]({},_0x557b50,_0x2809fd[_0xc083('0x4b')]);return db[_0xc083('0x38')][_0xc083('0x51')](_0x557b50)[_0xc083('0x1e')](handleEntityNotFound(_0x1dfd62,null))['then'](respondWithResult(_0x1dfd62,null))[_0xc083('0x27')](handleError(_0x1dfd62,null));};exports[_0xc083('0x33')]=function(_0x314aef,_0xf1fa15){if(_0x314aef['body']['id']){delete _0x314aef[_0xc083('0x52')]['id'];}return db[_0xc083('0x38')][_0xc083('0x51')]({'where':{'id':_0x314aef[_0xc083('0x53')]['id']}})[_0xc083('0x1e')](handleEntityNotFound(_0xf1fa15,null))[_0xc083('0x1e')](saveUpdates(_0x314aef[_0xc083('0x52')],null))[_0xc083('0x1e')](respondWithResult(_0xf1fa15,null))[_0xc083('0x27')](handleError(_0xf1fa15,null));};exports[_0xc083('0x54')]=function(_0x3f5112,_0x6e613b){return db[_0xc083('0x38')][_0xc083('0x51')]({'where':{'id':_0x3f5112[_0xc083('0x53')]['id']}})[_0xc083('0x1e')](handleEntityNotFound(_0x6e613b,null))['then'](removeEntity(_0x6e613b,null))[_0xc083('0x27')](handleError(_0x6e613b,null));};exports[_0xc083('0x55')]=function(_0xf34f89,_0x5c51c1){return db[_0xc083('0x38')]['describe']()[_0xc083('0x1e')](respondWithResult(_0x5c51c1,null))['catch'](handleError(_0x5c51c1,null));};var interaction_log=require(_0xc083('0x13'))(_0xc083('0x56'));exports[_0xc083('0x57')]=function(_0x112b92,_0x136d9a,_0x2d8375){var _0x5938f6={'agent':{},'channel':'fax'};if(_0x112b92[_0xc083('0x52')]['id']){delete _0x112b92[_0xc083('0x52')]['id'];}_0x112b92[_0xc083('0x52')][_0xc083('0x58')]=!![];_0x112b92['body'][_0xc083('0x59')]=moment()[_0xc083('0x5a')](_0xc083('0x5b'));_0x112b92[_0xc083('0x52')]['UserId']=_0x112b92[_0xc083('0x52')]['UserId']||_0x112b92[_0xc083('0x5c')]['id'];_0x5938f6[_0xc083('0x5d')]['id']=_0x112b92[_0xc083('0x52')]['UserId'];return db[_0xc083('0x38')]['find']({'where':{'id':_0x112b92['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x136d9a,null))['then'](saveUpdates(_0x112b92[_0xc083('0x52')],null))['then'](function(_0xe01b2){if(_0xe01b2){_0x5938f6['message']=_0xe01b2[_0xc083('0x5e')]({'plain':!![]});return db[_0xc083('0x5f')]['find']({'where':{'id':_0xe01b2['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x136d9a,null))[_0xc083('0x1e')](function(_0x1583f3){if(_0x1583f3){return _0x1583f3[_0xc083('0x33')]({'UserId':_0x112b92[_0xc083('0x52')][_0xc083('0x60')],'read1stAt':_[_0xc083('0x61')](_0x1583f3[_0xc083('0x62')])?moment()[_0xc083('0x5a')](_0xc083('0x5b')):undefined});}return null;})['then'](function(_0x1f1f89){if(_0x1f1f89){_0x5938f6['interaction']=_0x1f1f89[_0xc083('0x5e')]({'plain':!![]});interaction_log[_0xc083('0x1f')](_0xc083('0x63'),_0x112b92[_0xc083('0x5c')]['id'],_0x112b92['user'][_0xc083('0x35')],_0x112b92['user'][_0xc083('0x64')],_0x5938f6['interaction']['id'],_0x112b92['body']?JSON[_0xc083('0x65')](_0x112b92[_0xc083('0x52')]):_0xc083('0x66'));return respondWithRpcPromise('AcceptMessage',_0xc083('0x67'),_0x5938f6);}return null;})[_0xc083('0x1e')](function(_0x3e37a5){var _0x55e2ee=_0xc083('0x68')+_0x3e37a5[_0xc083('0x25')][_0xc083('0x69')];return db[_0xc083('0x6a')][_0xc083('0x3e')](_0x55e2ee,{'type':db[_0xc083('0x6b')][_0xc083('0x6c')][_0xc083('0x6d')],'raw':!![]})[_0xc083('0x1e')](function(_0x7dc9ab){return _0x7dc9ab;});})[_0xc083('0x1e')](function(_0x36b304){if(_0x36b304){_0x5938f6['message'][_0xc083('0x6e')]=_0x36b304[0x0];if(!_0x112b92[_0xc083('0x52')]['UserId'])return;return db['User'][_0xc083('0x51')]({'where':{'id':_0x112b92[_0xc083('0x52')][_0xc083('0x60')],'role':_0xc083('0x5d')},'attributes':['id',_0xc083('0x35'),_0xc083('0x6f'),_0xc083('0x70'),_0xc083('0x71')],'raw':!![]});}return null;})[_0xc083('0x1e')](function(_0x1b608f){if(!_0x1b608f)return null;_0x5938f6['message']['agent']=_0x1b608f;return _0x5938f6;})['then'](function(_0x43d32c){if(_0x43d32c){if(_0x112b92['body']['manual']){_0x5938f6[_0xc083('0x25')][_0xc083('0x72')]=util[_0xc083('0x5a')](_0xc083('0x73'),_0x112b92[_0xc083('0x5c')][_0xc083('0x35')]);_0x5938f6[_0xc083('0x25')][_0xc083('0x74')]=_0x5938f6['channel'];_0x5938f6[_0xc083('0x25')][_0xc083('0x75')]=_0x5938f6[_0xc083('0x74')];_0x5938f6[_0xc083('0x25')]['event']=_0xc083('0x57');return respondWithRpcPromise(_0xc083('0x76'),_0xc083('0x76'),{'event':_0xc083('0x77'),'message':_0x5938f6[_0xc083('0x25')]},client9002)[_0xc083('0x1e')](function(){return _0x5938f6;});}return _0x5938f6;}return null;})[_0xc083('0x1e')](respondWithResult(_0x136d9a,null))[_0xc083('0x27')](handleError(_0x136d9a,null));};var interaction_log=require(_0xc083('0x13'))('fax-interactions');exports[_0xc083('0x32')]=function(_0x2074d6,_0x2602c6,_0x2b842b){var _0x355c37={'agent':{},'channel':_0xc083('0x78')};if(_0x2074d6['body']['id']){delete _0x2074d6['body']['id'];}_0x2074d6['body'][_0xc083('0x60')]=_0x2074d6['body'][_0xc083('0x60')]||_0x2074d6[_0xc083('0x5c')]['id'];_0x355c37[_0xc083('0x5d')]['id']=_0x2074d6['body'][_0xc083('0x60')];return db['FaxMessage'][_0xc083('0x51')]({'where':{'id':_0x2074d6[_0xc083('0x53')]['id'],'UserId':null}})[_0xc083('0x1e')](handleEntityNotFound(_0x2602c6,null))[_0xc083('0x1e')](function(_0x4258a4){if(_0x4258a4){_0x355c37[_0xc083('0x25')]=_0x4258a4[_0xc083('0x5e')]({'plain':!![]});return db[_0xc083('0x5f')]['find']({'where':{'id':_0x4258a4[_0xc083('0x79')]}});}return null;})[_0xc083('0x1e')](handleEntityNotFound(_0x2602c6,null))[_0xc083('0x1e')](function(_0x13c2c0){if(_0x13c2c0){_0x355c37[_0xc083('0x7a')]=_0x13c2c0[_0xc083('0x5e')]({'plain':!![]});interaction_log[_0xc083('0x1f')](_0xc083('0x7b'),_0x2074d6['user']['id'],_0x2074d6['user'][_0xc083('0x35')],_0x2074d6[_0xc083('0x5c')][_0xc083('0x64')],_0x355c37[_0xc083('0x7a')]['id'],_0x2074d6[_0xc083('0x52')]?JSON[_0xc083('0x65')](_0x2074d6[_0xc083('0x52')]):_0xc083('0x66'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x355c37);}return null;})['then'](function(_0x42be22){var _0x58c3a8=_0xc083('0x68')+_0x42be22['message']['ContactId'];return db[_0xc083('0x6a')][_0xc083('0x3e')](_0x58c3a8,{'type':db['Sequelize'][_0xc083('0x6c')][_0xc083('0x6d')],'raw':!![]})[_0xc083('0x1e')](function(_0x486b39){return _0x486b39;});})[_0xc083('0x1e')](function(_0x4a49ca){if(_0x4a49ca){_0x355c37[_0xc083('0x25')][_0xc083('0x6e')]=_0x4a49ca[0x0];if(!_0x2074d6[_0xc083('0x52')][_0xc083('0x60')])return;return db[_0xc083('0x7c')][_0xc083('0x51')]({'where':{'id':_0x2074d6[_0xc083('0x52')][_0xc083('0x60')],'role':'agent'},'attributes':['id','name','fullname',_0xc083('0x70'),_0xc083('0x71')],'raw':!![]});}return null;})[_0xc083('0x1e')](function(_0x129f07){if(!_0x129f07)return null;_0x355c37['message'][_0xc083('0x5d')]=_0x129f07;return _0x355c37;})['then'](function(_0x178ce2){if(_0x178ce2){_0x178ce2['message']['interface']=util['format']('SIP/%s',_0x2074d6[_0xc083('0x5c')]['name']);_0x178ce2['message'][_0xc083('0x74')]=_0x355c37['channel'];_0x178ce2[_0xc083('0x25')][_0xc083('0x75')]=_0x355c37[_0xc083('0x74')];_0x178ce2[_0xc083('0x25')][_0xc083('0x7d')]=_0xc083('0x32');respondWithRpcPromise('EventManager',_0xc083('0x76'),{'event':_0xc083('0x7e'),'message':_0x178ce2[_0xc083('0x25')]},client9002);return _0x355c37;}return null;})[_0xc083('0x1e')](respondWithResult(_0x2602c6,null))[_0xc083('0x27')](handleError(_0x2602c6,null));};exports[_0xc083('0x7f')]=function(_0x462242,_0x174a5d){var _0x2f2212;return db[_0xc083('0x38')]['create'](_0x462242[_0xc083('0x52')],{})[_0xc083('0x1e')](function(_0x192af0){_0x2f2212=_0x192af0;return db[_0xc083('0x80')][_0xc083('0x81')]({'where':{'id':_0x2f2212[_0xc083('0x69')]}});})['then'](function(_0x49bdb3){if(_[_0xc083('0x61')](_0x49bdb3)){return;}else{_0x2f2212[_0xc083('0x78')]=_0x49bdb3[_0xc083('0x78')];return db[_0xc083('0x82')][_0xc083('0x81')]({'where':{'id':_0x2f2212[_0xc083('0x83')]}});}})['then'](function(_0x496111){return respondWithRpcPromise(_0xc083('0x84'),_0xc083('0x84'),{'FaxAccountId':_[_0xc083('0x61')](_0x462242[_0xc083('0x52')])?undefined:_0x462242[_0xc083('0x52')][_0xc083('0x85')],'path':_[_0xc083('0x61')](_0x496111)?undefined:util[_0xc083('0x5a')](_0xc083('0x86'),_0x496111[_0xc083('0x87')]),'fax':_[_0xc083('0x61')](_0x2f2212[_0xc083('0x78')])?undefined:_0x2f2212[_0xc083('0x78')],'AttachmentId':_0x2f2212[_0xc083('0x83')]},client9002);})[_0xc083('0x1e')](respondWithResult(_0x174a5d,0xc9))[_0xc083('0x27')](handleError(_0x174a5d,null));};exports[_0xc083('0x88')]=function(_0x28d4d6,_0x493089){var _0x2d67d2=path[_0xc083('0x89')](config[_0xc083('0x8a')],_0xc083('0x8b'),_0xc083('0x8c'),_0xc083('0x8d'));return db['FaxMessage']['find']({'where':{'id':_0x28d4d6['params']['id']},'include':[{'model':db[_0xc083('0x82')],'as':'Attachment'}]})[_0xc083('0x1e')](handleEntityNotFound(_0x493089,null))['then'](function(_0x2d1642){if(_0x2d1642){return _0x493089['download'](path[_0xc083('0x89')](_0x2d67d2,_0x2d1642['Attachment']['basename']));}})[_0xc083('0x27')](handleError(_0x493089,null));}; \ No newline at end of file +var _0x409d=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxMessage.socket','jayson/promise','http','client','request','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','status','offset','undefined','count','set','json','apply','then','stack','send','index','map','type','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','catch','rawAttributes','find','body','params','describe','../../config/logger','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','update','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','email','internal','interface','SIP/%s','channel','accept','EventManager','acceptmessage','fax','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','motionChannel','event','reject','create','findOne','Attachment','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','server','attachments'];(function(_0x9d489d,_0x4cc713){var _0x5a7b1d=function(_0x308be4){while(--_0x308be4){_0x9d489d['push'](_0x9d489d['shift']());}};_0x5a7b1d(++_0x4cc713);}(_0x409d,0x116));var _0xd409=function(_0x1e3e7c,_0xe7a8cc){_0x1e3e7c=_0x1e3e7c-0x0;var _0x4172ab=_0x409d[_0x1e3e7c];return _0x4172ab;};'use strict';var emlformat=require(_0xd409('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd409('0x1'));var jsonpatch=require(_0xd409('0x2'));var rp=require(_0xd409('0x3'));var moment=require(_0xd409('0x4'));var BPromise=require(_0xd409('0x5'));var Mustache=require(_0xd409('0x6'));var util=require(_0xd409('0x7'));var path=require(_0xd409('0x8'));var sox=require(_0xd409('0x9'));var csv=require(_0xd409('0xa'));var ejs=require(_0xd409('0xb'));var fs=require('fs');var fs_extra=require(_0xd409('0xc'));var _=require(_0xd409('0xd'));var squel=require(_0xd409('0xe'));var crypto=require(_0xd409('0xf'));var jsforce=require(_0xd409('0x10'));var deskjs=require(_0xd409('0x11'));var toCsv=require(_0xd409('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd409('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd409('0x13'));var as=require(_0xd409('0x14'));var hardwareService=require(_0xd409('0x15'));var logger=require('../../config/logger')(_0xd409('0x16'));var utils=require('../../config/utils');var config=require(_0xd409('0x17'));var licenseUtil=require(_0xd409('0x18'));var db=require(_0xd409('0x19'))['db'];config[_0xd409('0x1a')]=_[_0xd409('0x1b')](config[_0xd409('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd409('0x1a')]));require(_0xd409('0x1c'))['register'](socket);var jayson=require(_0xd409('0x1d'));var client=jayson['client'][_0xd409('0x1e')]({'port':0x232c});var client9002=jayson[_0xd409('0x1f')][_0xd409('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x70e25b,_0x2b6c47,_0x50be15,_0x404c1c){return new BPromise(function(_0x2baf6b,_0x1fd61d){var _0x5361af=_0x404c1c||client;return _0x5361af[_0xd409('0x20')](_0x70e25b,_0x50be15)['then'](function(_0x4d7639){logger['info'](_0xd409('0x21'),_0x2b6c47,_0xd409('0x22'));logger['debug'](_0xd409('0x23'),_0x2b6c47,_0xd409('0x22'),JSON['stringify'](_0x4d7639));if(_0x4d7639['error']){if(_0x4d7639[_0xd409('0x24')][_0xd409('0x25')]===0x1f4){logger[_0xd409('0x24')](_0xd409('0x21'),_0x2b6c47,_0x4d7639['error'][_0xd409('0x26')]);return _0x1fd61d(_0x4d7639['error'][_0xd409('0x26')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2b6c47,_0x4d7639[_0xd409('0x24')][_0xd409('0x26')]);return _0x2baf6b(_0x4d7639[_0xd409('0x24')][_0xd409('0x26')]);}else{logger[_0xd409('0x27')](_0xd409('0x21'),_0x2b6c47,'request\x20sent');_0x2baf6b(_0x4d7639[_0xd409('0x28')]['message']);}})['catch'](function(_0x1d7c78){logger[_0xd409('0x24')](_0xd409('0x21'),_0x2b6c47,_0x1d7c78);_0x1fd61d(_0x1d7c78);});});}function respondWithStatusCode(_0x2f3402,_0x501821){_0x501821=_0x501821||0xcc;return function(_0x202741){if(_0x202741){return _0x2f3402[_0xd409('0x29')](_0x501821);}return _0x2f3402['status'](_0x501821)[_0xd409('0x2a')]();};}function respondWithResult(_0x34e8d3,_0x187a70){_0x187a70=_0x187a70||0xc8;return function(_0x58ee1d){if(_0x58ee1d){return _0x34e8d3[_0xd409('0x2b')](_0x187a70)['json'](_0x58ee1d);}};}function respondWithFilteredResult(_0x3d4887,_0x2dbaca){return function(_0x16510a){if(_0x16510a){var _0x238149=typeof _0x2dbaca[_0xd409('0x2c')]===_0xd409('0x2d')&&typeof _0x2dbaca['limit']===_0xd409('0x2d');var _0x2c33aa=_0x16510a[_0xd409('0x2e')];var _0x41bc63=_0x238149?0x0:_0x2dbaca[_0xd409('0x2c')];var _0x59e0eb=_0x238149?_0x16510a['count']:_0x2dbaca[_0xd409('0x2c')]+_0x2dbaca['limit'];var _0x4d06b0;if(_0x59e0eb>=_0x2c33aa){_0x59e0eb=_0x2c33aa;_0x4d06b0=0xc8;}else{_0x4d06b0=0xce;}_0x3d4887['status'](_0x4d06b0);return _0x3d4887[_0xd409('0x2f')]('Content-Range',_0x41bc63+'-'+_0x59e0eb+'/'+_0x2c33aa)[_0xd409('0x30')](_0x16510a);}return null;};}function patchUpdates(_0x5bd28f){return function(_0x4262dd){try{jsonpatch[_0xd409('0x31')](_0x4262dd,_0x5bd28f,!![]);}catch(_0x28140f){return BPromise['reject'](_0x28140f);}return _0x4262dd['save']();};}function saveUpdates(_0x586a2b,_0x35e499){return function(_0x3bdb31){if(_0x3bdb31){return _0x3bdb31['update'](_0x586a2b)[_0xd409('0x32')](function(_0x9800f7){return _0x9800f7;});}return null;};}function removeEntity(_0x2666c6,_0x3e197d){return function(_0x4dc769){if(_0x4dc769){return _0x4dc769['destroy']()[_0xd409('0x32')](function(){_0x2666c6[_0xd409('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3922,_0x449f16){return function(_0x283926){if(!_0x283926){_0x5c3922[_0xd409('0x29')](0x194);}return _0x283926;};}function handleError(_0x2a4bfd,_0x2b3706){_0x2b3706=_0x2b3706||0x1f4;return function(_0x253c97){logger[_0xd409('0x24')](_0x253c97[_0xd409('0x33')]);if(_0x253c97['name']){delete _0x253c97['name'];}_0x2a4bfd[_0xd409('0x2b')](_0x2b3706)[_0xd409('0x34')](_0x253c97);};}exports[_0xd409('0x35')]=function(_0x7b5f2d,_0x3844a4){var _0x2223b2={},_0x5644fa={},_0x413890={'count':0x0,'rows':[]};var _0x3d4e56=_[_0xd409('0x36')](db['FaxMessage']['rawAttributes'],function(_0x46f855){return{'name':_0x46f855['fieldName'],'type':_0x46f855[_0xd409('0x37')]['key']};});_0x5644fa[_0xd409('0x38')]=_[_0xd409('0x36')](_0x3d4e56,_0xd409('0x39'));_0x5644fa[_0xd409('0x3a')]=_[_0xd409('0x3b')](_0x7b5f2d[_0xd409('0x3a')]);_0x5644fa[_0xd409('0x3c')]=_[_0xd409('0x3d')](_0x5644fa[_0xd409('0x38')],_0x5644fa[_0xd409('0x3a')]);_0x2223b2[_0xd409('0x3e')]=_['intersection'](_0x5644fa['model'],qs[_0xd409('0x3f')](_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x3f')]));_0x2223b2[_0xd409('0x3e')]=_0x2223b2['attributes']['length']?_0x2223b2[_0xd409('0x3e')]:_0x5644fa[_0xd409('0x38')];if(!_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x40')](_0xd409('0x41'))){_0x2223b2['limit']=qs[_0xd409('0x42')](_0x7b5f2d[_0xd409('0x3a')]['limit']);_0x2223b2[_0xd409('0x2c')]=qs[_0xd409('0x2c')](_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x2c')]);}_0x2223b2[_0xd409('0x43')]=qs['sort'](_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x44')]);_0x2223b2[_0xd409('0x45')]=qs[_0xd409('0x3c')](_[_0xd409('0x46')](_0x7b5f2d[_0xd409('0x3a')],_0x5644fa[_0xd409('0x3c')]),_0x3d4e56);if(_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x47')]){_0x2223b2['where']=_[_0xd409('0x48')](_0x2223b2[_0xd409('0x45')],{'$or':_['map'](_0x3d4e56,function(_0x3a0dea){if(_0x3a0dea['type']!==_0xd409('0x49')){var _0x398469={};_0x398469[_0x3a0dea[_0xd409('0x39')]]={'$like':'%'+_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x47')]+'%'};return _0x398469;}})});}_0x2223b2=_[_0xd409('0x48')]({},_0x2223b2,_0x7b5f2d[_0xd409('0x4a')]);var _0x36a9b9={'where':_0x2223b2[_0xd409('0x45')]};return db[_0xd409('0x4b')][_0xd409('0x2e')](_0x36a9b9)['then'](function(_0x4cd2b5){_0x413890[_0xd409('0x2e')]=_0x4cd2b5;if(_0x7b5f2d[_0xd409('0x3a')][_0xd409('0x4c')]){_0x2223b2[_0xd409('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0xd409('0x4e')](_0x2223b2);})[_0xd409('0x32')](function(_0x5c049f){_0x413890['rows']=_0x5c049f;return _0x413890;})[_0xd409('0x32')](respondWithFilteredResult(_0x3844a4,_0x2223b2))[_0xd409('0x4f')](handleError(_0x3844a4,null));};exports['show']=function(_0x3152b8,_0x39c9f7){var _0x39f545={'raw':!![],'where':{'id':_0x3152b8['params']['id']}},_0x32048b={};_0x32048b[_0xd409('0x38')]=_[_0xd409('0x3b')](db['FaxMessage'][_0xd409('0x50')]);_0x32048b[_0xd409('0x3a')]=_[_0xd409('0x3b')](_0x3152b8[_0xd409('0x3a')]);_0x32048b['filters']=_[_0xd409('0x3d')](_0x32048b[_0xd409('0x38')],_0x32048b[_0xd409('0x3a')]);_0x39f545[_0xd409('0x3e')]=_[_0xd409('0x3d')](_0x32048b[_0xd409('0x38')],qs[_0xd409('0x3f')](_0x3152b8[_0xd409('0x3a')][_0xd409('0x3f')]));_0x39f545[_0xd409('0x3e')]=_0x39f545['attributes']['length']?_0x39f545[_0xd409('0x3e')]:_0x32048b[_0xd409('0x38')];if(_0x3152b8[_0xd409('0x3a')][_0xd409('0x4c')]){_0x39f545[_0xd409('0x4d')]=[{'all':!![]}];}_0x39f545=_[_0xd409('0x48')]({},_0x39f545,_0x3152b8[_0xd409('0x4a')]);return db[_0xd409('0x4b')][_0xd409('0x51')](_0x39f545)[_0xd409('0x32')](handleEntityNotFound(_0x39c9f7,null))[_0xd409('0x32')](respondWithResult(_0x39c9f7,null))[_0xd409('0x4f')](handleError(_0x39c9f7,null));};exports['update']=function(_0x234699,_0x373dbc){if(_0x234699[_0xd409('0x52')]['id']){delete _0x234699[_0xd409('0x52')]['id'];}return db[_0xd409('0x4b')][_0xd409('0x51')]({'where':{'id':_0x234699[_0xd409('0x53')]['id']}})[_0xd409('0x32')](handleEntityNotFound(_0x373dbc,null))[_0xd409('0x32')](saveUpdates(_0x234699[_0xd409('0x52')],null))[_0xd409('0x32')](respondWithResult(_0x373dbc,null))['catch'](handleError(_0x373dbc,null));};exports['destroy']=function(_0x354edd,_0x3970f9){return db[_0xd409('0x4b')][_0xd409('0x51')]({'where':{'id':_0x354edd[_0xd409('0x53')]['id']}})[_0xd409('0x32')](handleEntityNotFound(_0x3970f9,null))[_0xd409('0x32')](removeEntity(_0x3970f9,null))[_0xd409('0x4f')](handleError(_0x3970f9,null));};exports[_0xd409('0x54')]=function(_0x5b9c62,_0x334528){return db[_0xd409('0x4b')][_0xd409('0x54')]()[_0xd409('0x32')](respondWithResult(_0x334528,null))['catch'](handleError(_0x334528,null));};var interaction_log=require(_0xd409('0x55'))(_0xd409('0x56'));exports['accept']=function(_0x1f3539,_0x9d102f,_0x27f870){var _0x85dc0f={'agent':{},'channel':'fax'};if(_0x1f3539[_0xd409('0x52')]['id']){delete _0x1f3539[_0xd409('0x52')]['id'];}_0x1f3539['body'][_0xd409('0x57')]=!![];_0x1f3539[_0xd409('0x52')][_0xd409('0x58')]=moment()[_0xd409('0x59')](_0xd409('0x5a'));_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')]=_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')]||_0x1f3539[_0xd409('0x5c')]['id'];_0x85dc0f['agent']['id']=_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')];return db[_0xd409('0x4b')][_0xd409('0x51')]({'where':{'id':_0x1f3539[_0xd409('0x53')]['id'],'UserId':null}})[_0xd409('0x32')](handleEntityNotFound(_0x9d102f,null))[_0xd409('0x32')](saveUpdates(_0x1f3539['body'],null))[_0xd409('0x32')](function(_0x42ec4d){if(_0x42ec4d){_0x85dc0f[_0xd409('0x26')]=_0x42ec4d[_0xd409('0x5d')]({'plain':!![]});return db[_0xd409('0x5e')][_0xd409('0x51')]({'where':{'id':_0x42ec4d[_0xd409('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x9d102f,null))['then'](function(_0x5e0774){if(_0x5e0774){return _0x5e0774[_0xd409('0x60')]({'UserId':_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')],'read1stAt':_['isNil'](_0x5e0774[_0xd409('0x61')])?moment()[_0xd409('0x59')](_0xd409('0x5a')):undefined});}return null;})['then'](function(_0x1084b0){if(_0x1084b0){_0x85dc0f['interaction']=_0x1084b0[_0xd409('0x5d')]({'plain':!![]});interaction_log[_0xd409('0x27')](_0xd409('0x62'),_0x1f3539[_0xd409('0x5c')]['id'],_0x1f3539['user'][_0xd409('0x39')],_0x1f3539[_0xd409('0x5c')][_0xd409('0x63')],_0x85dc0f['interaction']['id'],_0x1f3539[_0xd409('0x52')]?JSON[_0xd409('0x64')](_0x1f3539[_0xd409('0x52')]):_0xd409('0x65'));return respondWithRpcPromise(_0xd409('0x66'),'acceptMessage',_0x85dc0f);}return null;})['then'](function(_0x2e1282){var _0x4af9e0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e1282[_0xd409('0x26')][_0xd409('0x67')];return db[_0xd409('0x68')]['query'](_0x4af9e0,{'type':db[_0xd409('0x69')]['QueryTypes'][_0xd409('0x6a')],'raw':!![]})[_0xd409('0x32')](function(_0x1321ca){return _0x1321ca;});})[_0xd409('0x32')](function(_0x15db59){if(_0x15db59){_0x85dc0f['message']['contact']=_0x15db59[0x0];if(!_0x1f3539[_0xd409('0x52')][_0xd409('0x5b')])return;return db[_0xd409('0x6b')][_0xd409('0x51')]({'where':{'id':_0x1f3539['body'][_0xd409('0x5b')],'role':_0xd409('0x6c')},'attributes':['id','name',_0xd409('0x6d'),_0xd409('0x6e'),_0xd409('0x6f')],'raw':!![]});}return null;})[_0xd409('0x32')](function(_0x3bcf1e){if(!_0x3bcf1e)return null;_0x85dc0f['message'][_0xd409('0x6c')]=_0x3bcf1e;return _0x85dc0f;})['then'](function(_0x1b67dd){if(_0x1b67dd){if(_0x1f3539['body']['manual']){_0x85dc0f['message'][_0xd409('0x70')]=util[_0xd409('0x59')](_0xd409('0x71'),_0x1f3539[_0xd409('0x5c')][_0xd409('0x39')]);_0x85dc0f[_0xd409('0x26')][_0xd409('0x72')]=_0x85dc0f[_0xd409('0x72')];_0x85dc0f[_0xd409('0x26')]['motionChannel']=_0x85dc0f[_0xd409('0x72')];_0x85dc0f[_0xd409('0x26')]['event']=_0xd409('0x73');return respondWithRpcPromise(_0xd409('0x74'),_0xd409('0x74'),{'event':_0xd409('0x75'),'message':_0x85dc0f[_0xd409('0x26')]},client9002)[_0xd409('0x32')](function(){return _0x85dc0f;});}return _0x85dc0f;}return null;})['then'](respondWithResult(_0x9d102f,null))[_0xd409('0x4f')](handleError(_0x9d102f,null));};var interaction_log=require(_0xd409('0x55'))(_0xd409('0x56'));exports['reject']=function(_0x3a74e0,_0x3eb878,_0x3dd8fd){var _0x48406d={'agent':{},'channel':_0xd409('0x76')};if(_0x3a74e0[_0xd409('0x52')]['id']){delete _0x3a74e0[_0xd409('0x52')]['id'];}_0x3a74e0['body'][_0xd409('0x5b')]=_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')]||_0x3a74e0[_0xd409('0x5c')]['id'];_0x48406d[_0xd409('0x6c')]['id']=_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')];return db['FaxMessage'][_0xd409('0x51')]({'where':{'id':_0x3a74e0[_0xd409('0x53')]['id'],'UserId':null}})[_0xd409('0x32')](handleEntityNotFound(_0x3eb878,null))[_0xd409('0x32')](function(_0x501b01){if(_0x501b01){_0x48406d['message']=_0x501b01[_0xd409('0x5d')]({'plain':!![]});return db[_0xd409('0x5e')][_0xd409('0x51')]({'where':{'id':_0x501b01[_0xd409('0x5f')]}});}return null;})[_0xd409('0x32')](handleEntityNotFound(_0x3eb878,null))['then'](function(_0x2db6d7){if(_0x2db6d7){_0x48406d[_0xd409('0x77')]=_0x2db6d7[_0xd409('0x5d')]({'plain':!![]});interaction_log[_0xd409('0x27')](_0xd409('0x78'),_0x3a74e0[_0xd409('0x5c')]['id'],_0x3a74e0[_0xd409('0x5c')]['name'],_0x3a74e0[_0xd409('0x5c')][_0xd409('0x63')],_0x48406d[_0xd409('0x77')]['id'],_0x3a74e0[_0xd409('0x52')]?JSON[_0xd409('0x64')](_0x3a74e0[_0xd409('0x52')]):_0xd409('0x65'));return respondWithRpcPromise('RejectMessage',_0xd409('0x79'),_0x48406d);}return null;})[_0xd409('0x32')](function(_0x5b1592){var _0x883c7e=_0xd409('0x7a')+_0x5b1592[_0xd409('0x26')][_0xd409('0x67')];return db['sequelize'][_0xd409('0x3a')](_0x883c7e,{'type':db[_0xd409('0x69')][_0xd409('0x7b')]['SELECT'],'raw':!![]})[_0xd409('0x32')](function(_0xa60a50){return _0xa60a50;});})[_0xd409('0x32')](function(_0x136a89){if(_0x136a89){_0x48406d[_0xd409('0x26')]['contact']=_0x136a89[0x0];if(!_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')])return;return db[_0xd409('0x6b')][_0xd409('0x51')]({'where':{'id':_0x3a74e0[_0xd409('0x52')][_0xd409('0x5b')],'role':'agent'},'attributes':['id',_0xd409('0x39'),_0xd409('0x6d'),'email',_0xd409('0x6f')],'raw':!![]});}return null;})[_0xd409('0x32')](function(_0x1efc42){if(!_0x1efc42)return null;_0x48406d[_0xd409('0x26')][_0xd409('0x6c')]=_0x1efc42;return _0x48406d;})['then'](function(_0x3515ad){if(_0x3515ad){_0x3515ad['message']['interface']=util[_0xd409('0x59')](_0xd409('0x71'),_0x3a74e0['user'][_0xd409('0x39')]);_0x3515ad[_0xd409('0x26')]['channel']=_0x48406d['channel'];_0x3515ad[_0xd409('0x26')][_0xd409('0x7c')]=_0x48406d[_0xd409('0x72')];_0x3515ad[_0xd409('0x26')][_0xd409('0x7d')]=_0xd409('0x7e');respondWithRpcPromise(_0xd409('0x74'),_0xd409('0x74'),{'event':'rejectmessage','message':_0x3515ad[_0xd409('0x26')]},client9002);return _0x48406d;}return null;})[_0xd409('0x32')](respondWithResult(_0x3eb878,null))[_0xd409('0x4f')](handleError(_0x3eb878,null));};exports[_0xd409('0x7f')]=function(_0x40102e,_0xf24102){var _0x31ea4c;return db[_0xd409('0x4b')]['create'](_0x40102e[_0xd409('0x52')],{})[_0xd409('0x32')](function(_0x38f127){_0x31ea4c=_0x38f127;return db['CmContact'][_0xd409('0x80')]({'where':{'id':_0x31ea4c[_0xd409('0x67')]}});})[_0xd409('0x32')](function(_0x3d2ab7){if(_['isNil'](_0x3d2ab7)){return;}else{_0x31ea4c[_0xd409('0x76')]=_0x3d2ab7[_0xd409('0x76')];return db[_0xd409('0x81')]['findOne']({'where':{'id':_0x31ea4c['AttachmentId']}});}})['then'](function(_0x43cea5){return respondWithRpcPromise(_0xd409('0x82'),_0xd409('0x82'),{'FaxAccountId':_['isNil'](_0x40102e[_0xd409('0x52')])?undefined:_0x40102e[_0xd409('0x52')][_0xd409('0x83')],'path':_[_0xd409('0x84')](_0x43cea5)?undefined:util[_0xd409('0x59')](_0xd409('0x85'),_0x43cea5[_0xd409('0x86')]),'fax':_[_0xd409('0x84')](_0x31ea4c[_0xd409('0x76')])?undefined:_0x31ea4c['fax'],'AttachmentId':_0x31ea4c[_0xd409('0x87')]},client9002);})[_0xd409('0x32')](respondWithResult(_0xf24102,0xc9))[_0xd409('0x4f')](handleError(_0xf24102,null));};exports[_0xd409('0x88')]=function(_0x290181,_0x14e508){var _0xa6ceeb=path['join'](config['root'],_0xd409('0x89'),'files',_0xd409('0x8a'));return db[_0xd409('0x4b')]['find']({'where':{'id':_0x290181[_0xd409('0x53')]['id']},'include':[{'model':db[_0xd409('0x81')],'as':_0xd409('0x81')}]})['then'](handleEntityNotFound(_0x14e508,null))[_0xd409('0x32')](function(_0x4dd7b1){if(_0x4dd7b1){return _0x14e508[_0xd409('0x88')](path['join'](_0xa6ceeb,_0x4dd7b1['Attachment'][_0xd409('0x86')]));}})[_0xd409('0x4f')](handleError(_0x14e508,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b0e5681..364a76b 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 _0x644f=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x5efb10,_0x29a598){var _0x24929d=function(_0x3fe720){while(--_0x3fe720){_0x5efb10['push'](_0x5efb10['shift']());}};_0x24929d(++_0x29a598);}(_0x644f,0x177));var _0xf644=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x644f[_0x457b64];return _0x437111;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xf644('0x0'))['db'][_0xf644('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf644('0x2')](0x0);var events={'afterCreate':_0xf644('0x3'),'afterUpdate':_0xf644('0x4'),'afterDestroy':_0xf644('0x5')};function emitEvent(_0x318999){return function(_0x2885d7,_0x347827,_0x57bf32){FaxMessageEvents['emit'](_0x318999+':'+_0x2885d7['id'],_0x2885d7);FaxMessageEvents[_0xf644('0x6')](_0x318999,_0x2885d7);_0x57bf32(null);};}for(var e in events){if(events[_0xf644('0x7')](e)){var event=events[e];FaxMessage[_0xf644('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x9505=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x5887fb,_0x20db23){var _0x139d5c=function(_0x42d0db){while(--_0x42d0db){_0x5887fb['push'](_0x5887fb['shift']());}};_0x139d5c(++_0x20db23);}(_0x9505,0x1e5));var _0x5950=function(_0x77c858,_0x318c80){_0x77c858=_0x77c858-0x0;var _0x54e284=_0x9505[_0x77c858];return _0x54e284;};'use strict';var EventEmitter=require(_0x5950('0x0'));var FaxMessage=require(_0x5950('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5950('0x2')](0x0);var events={'afterCreate':_0x5950('0x3'),'afterUpdate':_0x5950('0x4'),'afterDestroy':_0x5950('0x5')};function emitEvent(_0x1344e4){return function(_0x4d3220,_0x48219e,_0x2494fc){FaxMessageEvents[_0x5950('0x6')](_0x1344e4+':'+_0x4d3220['id'],_0x4d3220);FaxMessageEvents[_0x5950('0x6')](_0x1344e4,_0x4d3220);_0x2494fc(null);};}for(var e in events){if(events[_0x5950('0x7')](e)){var event=events[e];FaxMessage['hook'](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 5e747e6..993d45b 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 _0x5698=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0x27ca8d,_0x538557){var _0x12f381=function(_0x8c7bd5){while(--_0x8c7bd5){_0x27ca8d['push'](_0x27ca8d['shift']());}};_0x12f381(++_0x538557);}(_0x5698,0x1e5));var _0x8569=function(_0x3d7e29,_0x45278b){_0x3d7e29=_0x3d7e29-0x0;var _0x341000=_0x5698[_0x3d7e29];return _0x341000;};'use strict';var _=require(_0x8569('0x0'));var util=require(_0x8569('0x1'));var logger=require(_0x8569('0x2'))(_0x8569('0x3'));var moment=require('moment');var BPromise=require(_0x8569('0x4'));var rp=require(_0x8569('0x5'));var fs=require('fs');var path=require(_0x8569('0x6'));var rimraf=require('rimraf');var config=require(_0x8569('0x7'));var attributes=require(_0x8569('0x8'));module[_0x8569('0x9')]=function(_0x1c84a0,_0x3dc39f){return _0x1c84a0['define'](_0x8569('0xa'),attributes,{'tableName':_0x8569('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x8569('0xc')],'type':_0x8569('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x561e2a,_0x597b28,_0x2c3028){var _0xa012d4=_0x1c84a0['models'];var _0x23ee1f=_0x561e2a[_0x8569('0xe')]({'plain':!![]});if(_0x23ee1f[_0x8569('0xf')][_0x8569('0x10')]()==='in'||_0x23ee1f[_0x8569('0xf')][_0x8569('0x10')]()===_0x8569('0x11')&&!_0x23ee1f[_0x8569('0x12')]&&!_['isNil'](_0x23ee1f['UserId'])){_0xa012d4[_0x8569('0x13')][_0x8569('0x14')]({'where':{'id':_0x23ee1f[_0x8569('0x15')]}})['then'](function(_0x1203bf){if(_0x1203bf){_0x1203bf[_0x8569('0x16')]({'lastMsgAt':_0x23ee1f[_0x8569('0x17')],'lastMsgDirection':_0x23ee1f[_0x8569('0xf')][_0x8569('0x10')]()});}})[_0x8569('0x18')](function(_0x3a96e7){console[_0x8569('0x19')](_0x3a96e7);});}_0x2c3028();}},'charset':'utf8mb4','collate':_0x8569('0x1a')});}; \ No newline at end of file +var _0x4eb4=['../../config/logger','api','moment','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb4,0x185));var _0x44eb=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x4eb4[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x44eb('0x0'));var util=require('util');var logger=require(_0x44eb('0x1'))(_0x44eb('0x2'));var moment=require(_0x44eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44eb('0x4'));var rimraf=require('rimraf');var config=require(_0x44eb('0x5'));var attributes=require(_0x44eb('0x6'));module['exports']=function(_0x1e2eed,_0x445736){return _0x1e2eed[_0x44eb('0x7')](_0x44eb('0x8'),attributes,{'tableName':_0x44eb('0x9'),'paranoid':![],'indexes':[{'name':_0x44eb('0xa'),'fields':[_0x44eb('0xb')],'type':_0x44eb('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c77bd,_0x14d40f,_0x15acdc){var _0x3a41fd=_0x1e2eed[_0x44eb('0xd')];var _0xc8eb7=_0x5c77bd[_0x44eb('0xe')]({'plain':!![]});if(_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()==='in'||_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()==='out'&&!_0xc8eb7['secret']&&!_['isNil'](_0xc8eb7[_0x44eb('0x11')])){_0x3a41fd['FaxInteraction']['findOne']({'where':{'id':_0xc8eb7[_0x44eb('0x12')]}})[_0x44eb('0x13')](function(_0x5dcee3){if(_0x5dcee3){_0x5dcee3[_0x44eb('0x14')]({'lastMsgAt':_0xc8eb7[_0x44eb('0x15')],'lastMsgDirection':_0xc8eb7[_0x44eb('0xf')][_0x44eb('0x10')]()});}})[_0x44eb('0x16')](function(_0x202a6a){console[_0x44eb('0x17')](_0x202a6a);});}_0x15acdc();}},'charset':_0x44eb('0x18'),'collate':_0x44eb('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a03108a..c965d69 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 _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x4e2c15,_0x90c264){var _0x352c24=function(_0x4b2555){while(--_0x4b2555){_0x4e2c15['push'](_0x4e2c15['shift']());}};_0x352c24(++_0x90c264);}(_0x032e,0x124));var _0xe032=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x032e[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file +var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x20f116,_0x2395ae){var _0x44a8a5=function(_0x445337){while(--_0x445337){_0x20f116['push'](_0x20f116['shift']());}};_0x44a8a5(++_0x2395ae);}(_0x54ef,0x112));var _0xf54e=function(_0xdd52b5,_0x413c3a){_0xdd52b5=_0xdd52b5-0x0;var _0x63f245=_0x54ef[_0xdd52b5];return _0x63f245;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 829facb..df400ac 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 _0x26eb=['emit','removeListener','register','faxMessage:','save','update'];(function(_0x167117,_0x2dee70){var _0x387b70=function(_0x58f7e0){while(--_0x58f7e0){_0x167117['push'](_0x167117['shift']());}};_0x387b70(++_0x2dee70);}(_0x26eb,0x15a));var _0xb26e=function(_0x405963,_0x56ad0b){_0x405963=_0x405963-0x0;var _0xa90ffd=_0x26eb[_0x405963];return _0xa90ffd;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb26e('0x0'),'remove',_0xb26e('0x1')];function createListener(_0x410cca,_0x3796b0){return function(_0x268872){_0x3796b0[_0xb26e('0x2')](_0x410cca,_0x268872);};}function removeListener(_0x3788a7,_0x58df1e){return function(){FaxMessageEvents[_0xb26e('0x3')](_0x3788a7,_0x58df1e);};}exports[_0xb26e('0x4')]=function(_0x4baa4c){for(var _0x5abf07=0x0,_0x594897=events['length'];_0x5abf07<_0x594897;_0x5abf07++){var _0x9f2f65=events[_0x5abf07];var _0x8fece7=createListener(_0xb26e('0x5')+_0x9f2f65,_0x4baa4c);FaxMessageEvents['on'](_0x9f2f65,_0x8fece7);}}; \ No newline at end of file +var _0xd77b=['faxMessage:','./faxMessage.events','remove','update','emit','removeListener','length'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xd77b,0x86));var _0xbd77=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xd77b[_0x255d5b];return _0x3e141a;};'use strict';var FaxMessageEvents=require(_0xbd77('0x0'));var events=['save',_0xbd77('0x1'),_0xbd77('0x2')];function createListener(_0x10b937,_0x365bc1){return function(_0x7119e7){_0x365bc1[_0xbd77('0x3')](_0x10b937,_0x7119e7);};}function removeListener(_0x27c213,_0x140679){return function(){FaxMessageEvents[_0xbd77('0x4')](_0x27c213,_0x140679);};}exports['register']=function(_0x14542a){for(var _0x3de620=0x0,_0x2fd840=events[_0xbd77('0x5')];_0x3de620<_0x2fd840;_0x3de620++){var _0x5789f3=events[_0x3de620];var _0x41a0e8=createListener(_0xbd77('0x6')+_0x5789f3,_0x14542a);FaxMessageEvents['on'](_0x5789f3,_0x41a0e8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 6ac0f16..9d7553e 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 _0xa74f=['/describe','isAuthenticated','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','/:id','update','put','accept','/:id/reject','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get'];(function(_0x552a73,_0x33d304){var _0x46d8bf=function(_0x1493dc){while(--_0x1493dc){_0x552a73['push'](_0x552a73['shift']());}};_0x46d8bf(++_0x33d304);}(_0xa74f,0x9a));var _0xfa74=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xa74f[_0x5c72ee];return _0x231876;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0x7')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth['isAuthenticated'](),interaction[_0xfa74('0xf')](_0xfa74('0x10'),_0xfa74('0x11')),controller[_0xfa74('0x12')]);router['put'](_0xfa74('0x13'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x14')]);router[_0xfa74('0x15')]('/:id/accept',auth[_0xfa74('0x9')](),controller[_0xfa74('0x16')]);router[_0xfa74('0x15')](_0xfa74('0x17'),auth[_0xfa74('0x9')](),controller['reject']);router[_0xfa74('0x18')](_0xfa74('0x13'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x19')]);module[_0xfa74('0x1a')]=router; \ No newline at end of file +var _0x7072=['/:id/download','download','post','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x24e50e,_0x1513fb){var _0x1cc9e8=function(_0x952286){while(--_0x952286){_0x24e50e['push'](_0x24e50e['shift']());}};_0x1cc9e8(++_0x1513fb);}(_0x7072,0x138));var _0x2707=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x7072[_0x256b72];return _0x2183e3;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),interaction[_0x2707('0x10')](_0x2707('0x11'),_0x2707('0x12')),controller[_0x2707('0x13')]);router[_0x2707('0x14')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['update']);router[_0x2707('0x14')]('/:id/accept',auth[_0x2707('0x8')](),controller[_0x2707('0x15')]);router[_0x2707('0x14')](_0x2707('0x16'),auth[_0x2707('0x8')](),controller['reject']);router[_0x2707('0x17')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['destroy']);module[_0x2707('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5e3e278..63c1f13 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 _0xadf6=['rrmemory','beepall','roundrobin','INTEGER','exports','STRING','name','ENUM'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xadf6,0xf4));var _0x6adf=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xadf6[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require('sequelize');module[_0x6adf('0x0')]={'name':{'type':Sequelize[_0x6adf('0x1')],'unique':_0x6adf('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6adf('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6adf('0x3')](_0x6adf('0x4'),_0x6adf('0x5'),_0x6adf('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6adf('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x297f=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x5c49b1,_0x55a7c7){var _0x291923=function(_0x508acc){while(--_0x508acc){_0x5c49b1['push'](_0x5c49b1['shift']());}};_0x291923(++_0x55a7c7);}(_0x297f,0x1f0));var _0xf297=function(_0x51104b,_0x2c97f2){_0x51104b=_0x51104b-0x0;var _0x185555=_0x297f[_0x51104b];return _0x185555;};'use strict';var Sequelize=require(_0xf297('0x0'));module[_0xf297('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf297('0x2')]},'timeout':{'type':Sequelize[_0xf297('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf297('0x4')](_0xf297('0x5'),'beepall',_0xf297('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 d1e18b9..9e15a73 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 _0xf981=['count','set','json','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','describe','findOne','UserFaxQueue','hasOwnProperty','limit','sort','FaxQueueId','filter','options','User','findAndCountAll','agent','createdAt','%s/%s','SIP','faxPause','updatedAt','Team','order','pick','getTeams','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','ids','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','offset'];(function(_0x38719d,_0x154db1){var _0x459457=function(_0x1a7fe0){while(--_0x1a7fe0){_0x38719d['push'](_0x38719d['shift']());}};_0x459457(++_0x154db1);}(_0xf981,0xe6));var _0x1f98=function(_0x1a2de4,_0x28b73d){_0x1a2de4=_0x1a2de4-0x0;var _0x19f1b7=_0xf981[_0x1a2de4];return _0x19f1b7;};'use strict';var BPromise=require(_0x1f98('0x0'));var util=require(_0x1f98('0x1'));var _=require(_0x1f98('0x2'));var squel=require(_0x1f98('0x3'));var Redis=require(_0x1f98('0x4'));var qs=require(_0x1f98('0x5'));var logger=require(_0x1f98('0x6'))(_0x1f98('0x7'));var config=require('../../config/environment');var db=require(_0x1f98('0x8'))['db'];config[_0x1f98('0x9')]=_[_0x1f98('0xa')](config[_0x1f98('0x9')],{'host':_0x1f98('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1f98('0xc'))['register'](socket);function respondWithStatusCode(_0x23e6a6,_0x88053c){_0x88053c=_0x88053c||0xcc;return function(_0x2aefc6){if(_0x2aefc6){return _0x23e6a6[_0x1f98('0xd')](_0x88053c);}return _0x23e6a6[_0x1f98('0xe')](_0x88053c)['end']();};}function respondWithResult(_0x459195,_0x119656){_0x119656=_0x119656||0xc8;return function(_0x358d08){if(_0x358d08){return _0x459195[_0x1f98('0xe')](_0x119656)['json'](_0x358d08);}};}function respondWithFilteredResult(_0x38a632,_0x508e25){return function(_0x4398ea){if(_0x4398ea){var _0x4dddb4=typeof _0x508e25[_0x1f98('0xf')]==='undefined'&&typeof _0x508e25['limit']==='undefined';var _0x14a938=_0x4398ea[_0x1f98('0x10')];var _0x2e599d=_0x4dddb4?0x0:_0x508e25[_0x1f98('0xf')];var _0x87ffbd=_0x4dddb4?_0x4398ea[_0x1f98('0x10')]:_0x508e25[_0x1f98('0xf')]+_0x508e25['limit'];var _0x1a21cd;if(_0x87ffbd>=_0x14a938){_0x87ffbd=_0x14a938;_0x1a21cd=0xc8;}else{_0x1a21cd=0xce;}_0x38a632['status'](_0x1a21cd);return _0x38a632[_0x1f98('0x11')]('Content-Range',_0x2e599d+'-'+_0x87ffbd+'/'+_0x14a938)[_0x1f98('0x12')](_0x4398ea);}return null;};}function saveUpdates(_0xf711c3){return function(_0x30bb88){if(_0x30bb88){return _0x30bb88[_0x1f98('0x13')](_0xf711c3)[_0x1f98('0x14')](function(_0x414268){return _0x414268;});}return null;};}function removeEntity(_0x25dd3e){return function(_0x52966d){if(_0x52966d){return _0x52966d[_0x1f98('0x15')]()['then'](function(){var _0x319c4b=_0x52966d[_0x1f98('0x16')]({'plain':!![]});var _0xd0529a=_0x1f98('0x17');return db[_0x1f98('0x18')][_0x1f98('0x15')]({'where':{'type':_0xd0529a,'resourceId':_0x319c4b['id']}})[_0x1f98('0x14')](function(){return _0x52966d;});})[_0x1f98('0x14')](function(){_0x25dd3e[_0x1f98('0xe')](0xcc)[_0x1f98('0x19')]();});}};}function handleEntityNotFound(_0x4e5576){return function(_0x49aaa3){if(!_0x49aaa3){_0x4e5576[_0x1f98('0xd')](0x194);}return _0x49aaa3;};}function handleError(_0x431958,_0x46582d){_0x46582d=_0x46582d||0x1f4;return function(_0x56feb8){logger[_0x1f98('0x1a')](_0x56feb8[_0x1f98('0x1b')]);if(_0x56feb8['name']){delete _0x56feb8['name'];}_0x431958[_0x1f98('0xe')](_0x46582d)['send'](_0x56feb8);};}exports[_0x1f98('0x1c')]=function(_0x5a6f37,_0x488497){var _0x48a5dc={};var _0x2ceeac={'count':0x0,'rows':[]};var _0x532a15=_[_0x1f98('0x1d')](db[_0x1f98('0x1e')][_0x1f98('0x1f')],function(_0x1ce5cd){return{'name':_0x1ce5cd[_0x1f98('0x20')],'type':_0x1ce5cd[_0x1f98('0x21')][_0x1f98('0x22')]};});_0x48a5dc=qs[_0x1f98('0x23')](_0x532a15,_0x5a6f37);var _0x48819d={'where':_0x48a5dc[_0x1f98('0x24')]};return db['FaxQueue'][_0x1f98('0x10')](_0x48819d)[_0x1f98('0x14')](function(_0x202974){_0x2ceeac[_0x1f98('0x10')]=_0x202974;_0x48a5dc['include']=qs['include'](_0x5a6f37[_0x1f98('0x25')]);return db[_0x1f98('0x1e')][_0x1f98('0x26')](_0x48a5dc);})[_0x1f98('0x14')](function(_0x4b7c89){_0x2ceeac[_0x1f98('0x27')]=_0x4b7c89;return _0x2ceeac;})['then'](respondWithFilteredResult(_0x488497,_0x48a5dc))[_0x1f98('0x28')](handleError(_0x488497,null));};exports['show']=function(_0x599a42,_0x15a9c5){var _0x248c32={'raw':!![],'where':{'id':_0x599a42[_0x1f98('0x29')]['id']}},_0x474e74={};_0x474e74[_0x1f98('0x2a')]=_[_0x1f98('0x2b')](db['FaxQueue'][_0x1f98('0x1f')]);_0x474e74[_0x1f98('0x25')]=_[_0x1f98('0x2b')](_0x599a42[_0x1f98('0x25')]);_0x474e74[_0x1f98('0x2c')]=_[_0x1f98('0x2d')](_0x474e74[_0x1f98('0x2a')],_0x474e74[_0x1f98('0x25')]);_0x248c32[_0x1f98('0x2e')]=_[_0x1f98('0x2d')](_0x474e74[_0x1f98('0x2a')],qs[_0x1f98('0x2f')](_0x599a42[_0x1f98('0x25')][_0x1f98('0x2f')]));_0x248c32[_0x1f98('0x2e')]=_0x248c32[_0x1f98('0x2e')][_0x1f98('0x30')]?_0x248c32[_0x1f98('0x2e')]:_0x474e74['model'];if(_0x599a42['query'][_0x1f98('0x31')]){_0x248c32['include']=[{'all':!![]}];}_0x248c32=_[_0x1f98('0x32')]({},_0x248c32,_0x599a42['options']);return db[_0x1f98('0x1e')][_0x1f98('0x33')](_0x248c32)[_0x1f98('0x14')](handleEntityNotFound(_0x15a9c5,null))[_0x1f98('0x14')](respondWithResult(_0x15a9c5,null))[_0x1f98('0x28')](handleError(_0x15a9c5,null));};exports[_0x1f98('0x34')]=function(_0x5589cd,_0x1c142f){return db['FaxQueue']['create'](_0x5589cd[_0x1f98('0x35')],{})[_0x1f98('0x14')](function(_0x282d71){var _0x150c80=_0x5589cd[_0x1f98('0x36')]['get']({'plain':!![]});if(!_0x150c80)throw new Error(_0x1f98('0x37'));if(_0x150c80[_0x1f98('0x38')]===_0x1f98('0x36')){var _0xc3bec4=_0x282d71[_0x1f98('0x16')]({'plain':!![]});var _0x34d2e2=_0x1f98('0x17');return db[_0x1f98('0x39')]['find']({'where':{'name':_0x34d2e2,'userProfileId':_0x150c80[_0x1f98('0x3a')]},'raw':!![]})[_0x1f98('0x14')](function(_0x399aad){if(_0x399aad&&_0x399aad[_0x1f98('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0xc3bec4[_0x1f98('0x3c')],'resourceId':_0xc3bec4['id'],'type':_0x399aad['name'],'sectionId':_0x399aad['id']},{})[_0x1f98('0x14')](function(){return _0x282d71;});}else{return _0x282d71;}})[_0x1f98('0x28')](function(_0x3b0574){logger[_0x1f98('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b0574);throw _0x3b0574;});}return _0x282d71;})['then'](respondWithResult(_0x1c142f,0xc9))['catch'](handleError(_0x1c142f,null));};exports[_0x1f98('0x13')]=function(_0x21d6d8,_0x341aa1){if(_0x21d6d8[_0x1f98('0x35')]['id']){delete _0x21d6d8[_0x1f98('0x35')]['id'];}return db['FaxQueue'][_0x1f98('0x33')]({'where':{'id':_0x21d6d8[_0x1f98('0x29')]['id']}})[_0x1f98('0x14')](handleEntityNotFound(_0x341aa1,null))[_0x1f98('0x14')](saveUpdates(_0x21d6d8[_0x1f98('0x35')],null))['then'](respondWithResult(_0x341aa1,null))[_0x1f98('0x28')](handleError(_0x341aa1,null));};exports[_0x1f98('0x15')]=function(_0x2bd079,_0x46663c){return db['FaxQueue']['find']({'where':{'id':_0x2bd079[_0x1f98('0x29')]['id']}})[_0x1f98('0x14')](handleEntityNotFound(_0x46663c,null))[_0x1f98('0x14')](removeEntity(_0x46663c,null))[_0x1f98('0x28')](handleError(_0x46663c,null));};exports[_0x1f98('0x3d')]=function(_0x1a7ffe,_0x4f472f){return db[_0x1f98('0x1e')][_0x1f98('0x3d')]()[_0x1f98('0x14')](respondWithResult(_0x4f472f,null))[_0x1f98('0x28')](handleError(_0x4f472f,null));};exports['getMembers']=function(_0x7c6342,_0x42e526){var _0x37f48d={'raw':!![],'where':{}},_0x5956c5={},_0x3a92db;return db[_0x1f98('0x1e')][_0x1f98('0x3e')]({'where':{'id':_0x7c6342[_0x1f98('0x29')]['id']}})[_0x1f98('0x14')](handleEntityNotFound(_0x42e526,null))[_0x1f98('0x14')](function(_0x5a2c15){if(_0x5a2c15){_0x3a92db=_0x5a2c15[_0x1f98('0x16')]({'plain':!![]});_0x5956c5[_0x1f98('0x2a')]=_['keys'](db[_0x1f98('0x3f')][_0x1f98('0x1f')]);_0x5956c5[_0x1f98('0x25')]=_[_0x1f98('0x2b')](_0x7c6342['query']);_0x5956c5['filters']=_[_0x1f98('0x2d')](_0x5956c5[_0x1f98('0x2a')],_0x5956c5[_0x1f98('0x25')]);_0x37f48d[_0x1f98('0x2e')]=_[_0x1f98('0x2d')](_0x5956c5[_0x1f98('0x2a')],qs['fields'](_0x7c6342['query'][_0x1f98('0x2f')]));_0x37f48d['attributes']=_0x37f48d[_0x1f98('0x2e')][_0x1f98('0x30')]?_0x37f48d['attributes']:_0x5956c5[_0x1f98('0x2a')];if(!_0x7c6342[_0x1f98('0x25')][_0x1f98('0x40')]('nolimit')){_0x37f48d[_0x1f98('0x41')]=qs[_0x1f98('0x41')](_0x7c6342[_0x1f98('0x25')][_0x1f98('0x41')]);_0x37f48d['offset']=qs[_0x1f98('0xf')](_0x7c6342['query'][_0x1f98('0xf')]);}_0x37f48d['order']=qs[_0x1f98('0x42')](_0x7c6342[_0x1f98('0x25')][_0x1f98('0x42')]);_0x37f48d[_0x1f98('0x24')]=qs[_0x1f98('0x2c')](_['pick'](_0x7c6342['query'],_0x5956c5[_0x1f98('0x2c')]));_0x37f48d['where'][_0x1f98('0x43')]=_0x5a2c15['id'];if(_0x7c6342['query'][_0x1f98('0x44')]){_0x37f48d[_0x1f98('0x24')]=_[_0x1f98('0x32')](_0x37f48d[_0x1f98('0x24')],{'$or':_[_0x1f98('0x1d')](_0x37f48d[_0x1f98('0x2e')],function(_0x27aeda){var _0x1a8f36={};_0x1a8f36[_0x27aeda]={'$like':'%'+_0x7c6342[_0x1f98('0x25')][_0x1f98('0x44')]+'%'};return _0x1a8f36;})});}_0x37f48d=_[_0x1f98('0x32')]({},_0x37f48d,_0x7c6342[_0x1f98('0x45')]);return db['UserFaxQueue']['findAll'](_0x37f48d);}})[_0x1f98('0x14')](function(_0x573ef7){if(_0x573ef7){return db[_0x1f98('0x46')][_0x1f98('0x47')]({'where':{'id':_['map'](_0x573ef7,'UserId'),'role':_0x1f98('0x48')},'attributes':['id',_0x1f98('0x3c'),'faxPause','updatedAt',_0x1f98('0x49')]});}})['then'](function(_0x221040){if(_0x221040){return{'count':_0x221040[_0x1f98('0x10')],'rows':_['map'](_0x221040[_0x1f98('0x27')],function(_0x337458){return{'membername':_0x337458[_0x1f98('0x3c')],'UserId':_0x337458['id'],'queue_name':_0x3a92db[_0x1f98('0x3c')],'FaxQueueId':_0x3a92db['id'],'interface':util['format'](_0x1f98('0x4a'),_0x1f98('0x4b'),_0x337458[_0x1f98('0x3c')]),'penalty':0x0,'paused':_0x337458[_0x1f98('0x4c')],'createdAt':_0x337458[_0x1f98('0x49')],'updatedAt':_0x337458[_0x1f98('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x42e526,_0x37f48d))['catch'](handleError(_0x42e526,null));};exports['getTeams']=function(_0x48f0c1,_0x66e6ce){var _0x12a34f={};var _0x34cb0f={};var _0x4ae7ec;var _0x26d722;return db[_0x1f98('0x1e')]['findOne']({'where':{'id':_0x48f0c1['params']['id']}})['then'](handleEntityNotFound(_0x66e6ce,null))[_0x1f98('0x14')](function(_0x19a3e8){if(_0x19a3e8){_0x4ae7ec=_0x19a3e8;_0x34cb0f[_0x1f98('0x2a')]=_[_0x1f98('0x2b')](db[_0x1f98('0x4e')]['rawAttributes']);_0x34cb0f[_0x1f98('0x25')]=_['keys'](_0x48f0c1['query']);_0x34cb0f[_0x1f98('0x2c')]=_[_0x1f98('0x2d')](_0x34cb0f[_0x1f98('0x2a')],_0x34cb0f[_0x1f98('0x25')]);_0x12a34f[_0x1f98('0x2e')]=_[_0x1f98('0x2d')](_0x34cb0f['model'],qs[_0x1f98('0x2f')](_0x48f0c1[_0x1f98('0x25')][_0x1f98('0x2f')]));_0x12a34f[_0x1f98('0x2e')]=_0x12a34f[_0x1f98('0x2e')][_0x1f98('0x30')]?_0x12a34f[_0x1f98('0x2e')]:_0x34cb0f[_0x1f98('0x2a')];_0x12a34f[_0x1f98('0x4f')]=qs[_0x1f98('0x42')](_0x48f0c1[_0x1f98('0x25')][_0x1f98('0x42')]);_0x12a34f[_0x1f98('0x24')]=qs[_0x1f98('0x2c')](_[_0x1f98('0x50')](_0x48f0c1[_0x1f98('0x25')],_0x34cb0f[_0x1f98('0x2c')]));if(_0x48f0c1['query'][_0x1f98('0x44')]){_0x12a34f[_0x1f98('0x24')]=_[_0x1f98('0x32')](_0x12a34f['where'],{'$or':_[_0x1f98('0x1d')](_0x12a34f[_0x1f98('0x2e')],function(_0x1a25d9){var _0x2b28df={};_0x2b28df[_0x1a25d9]={'$like':'%'+_0x48f0c1[_0x1f98('0x25')][_0x1f98('0x44')]+'%'};return _0x2b28df;})});}_0x12a34f=_[_0x1f98('0x32')]({},_0x12a34f,_0x48f0c1[_0x1f98('0x45')]);return _0x4ae7ec[_0x1f98('0x51')](_0x12a34f);}})[_0x1f98('0x14')](function(_0x36ae8d){if(_0x36ae8d){_0x26d722=_0x36ae8d[_0x1f98('0x30')];if(!_0x48f0c1[_0x1f98('0x25')][_0x1f98('0x40')](_0x1f98('0x52'))){_0x12a34f['limit']=qs['limit'](_0x48f0c1[_0x1f98('0x25')][_0x1f98('0x41')]);_0x12a34f['offset']=qs[_0x1f98('0xf')](_0x48f0c1[_0x1f98('0x25')][_0x1f98('0xf')]);}return _0x4ae7ec[_0x1f98('0x51')](_0x12a34f);}})[_0x1f98('0x14')](function(_0x785899){if(_0x785899){return _0x785899?{'count':_0x26d722,'rows':_0x785899}:null;}})[_0x1f98('0x14')](respondWithResult(_0x66e6ce,null))[_0x1f98('0x28')](handleError(_0x66e6ce,null));};exports[_0x1f98('0x53')]=function(_0x27ff76,_0x4cdff8){var _0x136fbb=_0x27ff76[_0x1f98('0x35')]['ids'];return db[_0x1f98('0x4e')][_0x1f98('0x26')]({'where':{'id':_0x136fbb},'attributes':['id'],'include':[{'model':db[_0x1f98('0x46')],'as':_0x1f98('0x54'),'attributes':['id','name',_0x1f98('0x55'),_0x1f98('0x56'),_0x1f98('0x57')],'raw':!![]}]})['then'](function(_0x34f9b4){if(_0x34f9b4){var _0x33d41d=_[_0x1f98('0x58')](_0x34f9b4,function(_0x39e7e1){var _0x214780=_0x39e7e1[_0x1f98('0x16')]({'plain':!![]});return _0x214780[_0x1f98('0x54')];});return db[_0x1f98('0x1e')]['find']({'where':{'id':_0x27ff76[_0x1f98('0x29')]['id']}})['then'](function(_0x2bd84b){return db['sequelize'][_0x1f98('0x59')](function(_0x500dd7){return _0x2bd84b['addTeams'](_0x136fbb,{'transaction':_0x500dd7})[_0x1f98('0x14')](function(){return BPromise[_0x1f98('0x5a')](_0x33d41d,function(_0x1fad0b){return db[_0x1f98('0x3f')][_0x1f98('0x5b')]({'where':{'UserId':_0x1fad0b['id'],'FaxQueueId':_0x27ff76['params']['id']},'transaction':_0x500dd7});});})['then'](function(){_0x33d41d[_0x1f98('0x5c')](function(_0x58b2e9){socket[_0x1f98('0x5d')](_0x1f98('0x5e'),{'UserId':_0x58b2e9['id'],'FaxQueueId':_0x2bd84b['id']});});});});});}})[_0x1f98('0x14')](respondWithStatusCode(_0x4cdff8,null))[_0x1f98('0x28')](handleError(_0x4cdff8,null));};exports[_0x1f98('0x5f')]=function(_0x86ae2c,_0x1f503){return db['Team'][_0x1f98('0x26')]({'where':{'id':_0x86ae2c[_0x1f98('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1f98('0x46')],'as':_0x1f98('0x54'),'attributes':['id'],'raw':!![]}]})[_0x1f98('0x14')](handleEntityNotFound(_0x1f503,null))['then'](function(_0x79c21c){var _0x391cbb=_['map'](_0x79c21c,'id');var _0x1e1b19=[];var _0x34e247=[];var _0x20b3fb=squel['select']();_0x20b3fb[_0x1f98('0x60')](_0x1f98('0x61'))[_0x1f98('0x62')](_0x1f98('0x63'),'tq')[_0x1f98('0x64')](_0x1f98('0x65'),'ut',_0x1f98('0x66'))[_0x1f98('0x24')]('FaxQueueId\x20=\x20?',_0x86ae2c[_0x1f98('0x29')]['id']);for(var _0x33f39d=0x0;_0x33f39d<_0x79c21c[_0x1f98('0x30')];_0x33f39d+=0x1){let _0x4776cf=_0x79c21c[_0x33f39d];for(var _0x382afb=0x0;_0x382afb<_0x4776cf[_0x1f98('0x54')]['length'];_0x382afb+=0x1){let _0x590812=_0x4776cf[_0x1f98('0x54')][_0x382afb];var _0x562bcb=_0x20b3fb[_0x1f98('0x67')]();_0x562bcb[_0x1f98('0x24')]('ut.UserId\x20=\x20?',_0x590812['id']);_0x34e247[_0x1f98('0x68')](db['sequelize']['query'](_0x562bcb[_0x1f98('0x69')](),{'type':db[_0x1f98('0x6a')][_0x1f98('0x6b')][_0x1f98('0x6c')]})[_0x1f98('0x14')](function(_0x710705){if(_0x710705[_0x1f98('0x30')]===0x1){return _0x590812['id'];}else{var _0x3c22aa=_[_0x1f98('0x6d')](_['map'](_0x710705,_0x1f98('0x6e')),function(_0x2a4125){return _['includes'](_0x391cbb,_0x2a4125);});if(_0x3c22aa){return _0x590812['id'];}}}));}}return BPromise[_0x1f98('0x6f')](_0x34e247)[_0x1f98('0x14')](function(_0x31e114){_0x1e1b19=_(_0x1e1b19)[_0x1f98('0x70')](_0x31e114)[_0x1f98('0x71')]()['value']();return db[_0x1f98('0x1e')][_0x1f98('0x33')]({'where':{'id':_0x86ae2c[_0x1f98('0x29')]['id']}})[_0x1f98('0x14')](function(_0x454b50){return db['sequelize'][_0x1f98('0x59')](function(_0x2eb1b6){return _0x454b50[_0x1f98('0x5f')](_0x86ae2c[_0x1f98('0x25')]['ids'],{'transaction':_0x2eb1b6})['then'](function(){if(!_[_0x1f98('0x72')](_0x1e1b19)){return _0x454b50[_0x1f98('0x73')](_0x1e1b19,{'transaction':_0x2eb1b6});}})[_0x1f98('0x14')](function(){_0x1e1b19['forEach'](function(_0x542649){socket[_0x1f98('0x5d')]('userFaxQueue:remove',{'UserId':_0x542649,'FaxQueueId':_0x454b50['id']});});});});});});})['then'](respondWithStatusCode(_0x1f503,null))[_0x1f98('0x28')](handleError(_0x1f503,null));};exports[_0x1f98('0x74')]=function(_0x41813a,_0x4e3102){return db['FaxQueue'][_0x1f98('0x33')]({'where':{'id':_0x41813a[_0x1f98('0x29')]['id']}})[_0x1f98('0x14')](handleEntityNotFound(_0x4e3102,null))['then'](function(_0x1c5b5f){if(_0x1c5b5f){return _0x1c5b5f[_0x1f98('0x74')](_0x41813a['body'][_0x1f98('0x75')],_[_0x1f98('0x76')](_0x41813a[_0x1f98('0x35')],[_0x1f98('0x75'),'id'])||{})[_0x1f98('0x77')](function(_0x611273){for(var _0xe16cd5=0x0;_0xe16cd5<_0x41813a['body'][_0x1f98('0x75')][_0x1f98('0x30')];_0xe16cd5+=0x1){socket['emit'](_0x1f98('0x5e'),{'UserId':Number(_0x41813a[_0x1f98('0x35')][_0x1f98('0x75')][_0xe16cd5]),'FaxQueueId':Number(_0x41813a[_0x1f98('0x29')]['id'])});}return _0x611273;});}})['then'](respondWithResult(_0x4e3102,null))['catch'](handleError(_0x4e3102,null));};exports[_0x1f98('0x73')]=function(_0x24a91f,_0x2031b1){return db['FaxQueue'][_0x1f98('0x33')]({'where':{'id':_0x24a91f[_0x1f98('0x29')]['id']}})['then'](handleEntityNotFound(_0x2031b1,null))[_0x1f98('0x14')](function(_0x5e16c9){if(_0x5e16c9){return _0x5e16c9['removeAgents'](_0x24a91f[_0x1f98('0x25')][_0x1f98('0x75')])[_0x1f98('0x14')](function(){if(_[_0x1f98('0x78')](_0x24a91f['query']['ids'])){for(var _0x595493=0x0;_0x595493<_0x24a91f[_0x1f98('0x25')][_0x1f98('0x75')][_0x1f98('0x30')];_0x595493+=0x1){socket[_0x1f98('0x5d')](_0x1f98('0x79'),{'UserId':Number(_0x24a91f['query']['ids'][_0x595493]),'FaxQueueId':Number(_0x24a91f['params']['id'])});}}else{socket['emit'](_0x1f98('0x79'),{'UserId':Number(_0x24a91f[_0x1f98('0x25')][_0x1f98('0x75')]),'FaxQueueId':Number(_0x24a91f[_0x1f98('0x29')]['id'])});}});}})[_0x1f98('0x14')](respondWithStatusCode(_0x2031b1,null))[_0x1f98('0x28')](handleError(_0x2031b1,null));};exports['getAgents']=function(_0x1f634c,_0x49279b){var _0x47263f={};var _0x34327e={};var _0x5ae1b2;var _0x1c5da5;return db[_0x1f98('0x1e')]['findOne']({'where':{'id':_0x1f634c['params']['id']}})[_0x1f98('0x14')](handleEntityNotFound(_0x49279b,null))[_0x1f98('0x14')](function(_0x47a000){if(_0x47a000){_0x5ae1b2=_0x47a000;_0x34327e[_0x1f98('0x2a')]=_['keys'](db['User'][_0x1f98('0x1f')]);_0x34327e[_0x1f98('0x25')]=_[_0x1f98('0x2b')](_0x1f634c['query']);_0x34327e['filters']=_[_0x1f98('0x2d')](_0x34327e[_0x1f98('0x2a')],_0x34327e[_0x1f98('0x25')]);_0x47263f[_0x1f98('0x2e')]=_['intersection'](_0x34327e[_0x1f98('0x2a')],qs[_0x1f98('0x2f')](_0x1f634c['query'][_0x1f98('0x2f')]));_0x47263f[_0x1f98('0x2e')]=_0x47263f[_0x1f98('0x2e')][_0x1f98('0x30')]?_0x47263f[_0x1f98('0x2e')]:_0x34327e[_0x1f98('0x2a')];_0x47263f[_0x1f98('0x4f')]=qs[_0x1f98('0x42')](_0x1f634c['query'][_0x1f98('0x42')]);_0x47263f[_0x1f98('0x24')]=qs['filters'](_[_0x1f98('0x50')](_0x1f634c[_0x1f98('0x25')],_0x34327e[_0x1f98('0x2c')]));if(_0x1f634c[_0x1f98('0x25')][_0x1f98('0x44')]){_0x47263f['where']=_[_0x1f98('0x32')](_0x47263f[_0x1f98('0x24')],{'$or':_[_0x1f98('0x1d')](_0x47263f[_0x1f98('0x2e')],function(_0x3c7f1e){var _0x62c7fd={};_0x62c7fd[_0x3c7f1e]={'$like':'%'+_0x1f634c[_0x1f98('0x25')]['filter']+'%'};return _0x62c7fd;})});}_0x47263f=_[_0x1f98('0x32')]({},_0x47263f,_0x1f634c[_0x1f98('0x45')]);return _0x5ae1b2['getAgents'](_0x47263f);}})[_0x1f98('0x14')](function(_0x4fb944){if(_0x4fb944){_0x1c5da5=_0x4fb944[_0x1f98('0x30')];if(!_0x1f634c['query'][_0x1f98('0x40')]('nolimit')){_0x47263f[_0x1f98('0x41')]=qs[_0x1f98('0x41')](_0x1f634c[_0x1f98('0x25')]['limit']);_0x47263f['offset']=qs['offset'](_0x1f634c[_0x1f98('0x25')]['offset']);}return _0x5ae1b2[_0x1f98('0x7a')](_0x47263f);}})[_0x1f98('0x14')](function(_0x2b4bbe){if(_0x2b4bbe){return _0x2b4bbe?{'count':_0x1c5da5,'rows':_0x2b4bbe}:null;}})[_0x1f98('0x14')](respondWithResult(_0x49279b,null))[_0x1f98('0x28')](handleError(_0x49279b,null));}; \ No newline at end of file +var _0x6b1b=['removeAgents','forEach','emit','userFaxQueue:remove','omit','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','update','then','destroy','get','FaxQueues','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','params','model','keys','intersection','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','hasOwnProperty','nolimit','sort','filters','pick','filter','UserFaxQueue','User','UserId','agent','updatedAt','format','%s/%s','SIP','faxPause','getTeams','Team','order','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty'];(function(_0x1abdcb,_0x2d2854){var _0x1362f7=function(_0x2ce2b1){while(--_0x2ce2b1){_0x1abdcb['push'](_0x1abdcb['shift']());}};_0x1362f7(++_0x2d2854);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x6b1b[_0x4e1d03];return _0x362d4b;};'use strict';var BPromise=require('bluebird');var util=require(_0xb6b1('0x0'));var _=require(_0xb6b1('0x1'));var squel=require(_0xb6b1('0x2'));var Redis=require('ioredis');var qs=require(_0xb6b1('0x3'));var logger=require(_0xb6b1('0x4'))(_0xb6b1('0x5'));var config=require(_0xb6b1('0x6'));var db=require(_0xb6b1('0x7'))['db'];config[_0xb6b1('0x8')]=_[_0xb6b1('0x9')](config[_0xb6b1('0x8')],{'host':_0xb6b1('0xa'),'port':0x18eb});var socket=require(_0xb6b1('0xb'))(new Redis(config[_0xb6b1('0x8')]));require('./faxQueue.socket')[_0xb6b1('0xc')](socket);function respondWithStatusCode(_0x52aa76,_0x4da7d3){_0x4da7d3=_0x4da7d3||0xcc;return function(_0x463b1d){if(_0x463b1d){return _0x52aa76['sendStatus'](_0x4da7d3);}return _0x52aa76[_0xb6b1('0xd')](_0x4da7d3)['end']();};}function respondWithResult(_0x4aa838,_0x49e83a){_0x49e83a=_0x49e83a||0xc8;return function(_0x593218){if(_0x593218){return _0x4aa838[_0xb6b1('0xd')](_0x49e83a)[_0xb6b1('0xe')](_0x593218);}};}function respondWithFilteredResult(_0x5d806b,_0x203121){return function(_0x59831e){if(_0x59831e){var _0x5c5837=typeof _0x203121[_0xb6b1('0xf')]===_0xb6b1('0x10')&&typeof _0x203121[_0xb6b1('0x11')]===_0xb6b1('0x10');var _0x23881d=_0x59831e[_0xb6b1('0x12')];var _0x360fc7=_0x5c5837?0x0:_0x203121[_0xb6b1('0xf')];var _0x2a4d72=_0x5c5837?_0x59831e[_0xb6b1('0x12')]:_0x203121[_0xb6b1('0xf')]+_0x203121[_0xb6b1('0x11')];var _0x4f770a;if(_0x2a4d72>=_0x23881d){_0x2a4d72=_0x23881d;_0x4f770a=0xc8;}else{_0x4f770a=0xce;}_0x5d806b['status'](_0x4f770a);return _0x5d806b['set']('Content-Range',_0x360fc7+'-'+_0x2a4d72+'/'+_0x23881d)[_0xb6b1('0xe')](_0x59831e);}return null;};}function saveUpdates(_0x12c595){return function(_0x4981fb){if(_0x4981fb){return _0x4981fb[_0xb6b1('0x13')](_0x12c595)[_0xb6b1('0x14')](function(_0x51fb33){return _0x51fb33;});}return null;};}function removeEntity(_0x47a204){return function(_0x581e28){if(_0x581e28){return _0x581e28[_0xb6b1('0x15')]()[_0xb6b1('0x14')](function(){var _0x16d969=_0x581e28[_0xb6b1('0x16')]({'plain':!![]});var _0x45d9e6=_0xb6b1('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x45d9e6,'resourceId':_0x16d969['id']}})[_0xb6b1('0x14')](function(){return _0x581e28;});})[_0xb6b1('0x14')](function(){_0x47a204['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc247a){return function(_0x5c8529){if(!_0x5c8529){_0xfc247a['sendStatus'](0x194);}return _0x5c8529;};}function handleError(_0x232157,_0x2086ea){_0x2086ea=_0x2086ea||0x1f4;return function(_0x36ac63){logger[_0xb6b1('0x18')](_0x36ac63[_0xb6b1('0x19')]);if(_0x36ac63[_0xb6b1('0x1a')]){delete _0x36ac63[_0xb6b1('0x1a')];}_0x232157[_0xb6b1('0xd')](_0x2086ea)[_0xb6b1('0x1b')](_0x36ac63);};}exports[_0xb6b1('0x1c')]=function(_0x5069cd,_0x214cd0){var _0x4f1e2e={};var _0xd8e094={'count':0x0,'rows':[]};var _0x5864d6=_[_0xb6b1('0x1d')](db['FaxQueue'][_0xb6b1('0x1e')],function(_0x387603){return{'name':_0x387603[_0xb6b1('0x1f')],'type':_0x387603[_0xb6b1('0x20')][_0xb6b1('0x21')]};});_0x4f1e2e=qs[_0xb6b1('0x22')](_0x5864d6,_0x5069cd);var _0x3e0915={'where':_0x4f1e2e[_0xb6b1('0x23')]};return db[_0xb6b1('0x24')]['count'](_0x3e0915)[_0xb6b1('0x14')](function(_0x548f3f){_0xd8e094[_0xb6b1('0x12')]=_0x548f3f;_0x4f1e2e[_0xb6b1('0x25')]=qs[_0xb6b1('0x25')](_0x5069cd[_0xb6b1('0x26')]);return db[_0xb6b1('0x24')][_0xb6b1('0x27')](_0x4f1e2e);})[_0xb6b1('0x14')](function(_0x59094f){_0xd8e094[_0xb6b1('0x28')]=_0x59094f;return _0xd8e094;})[_0xb6b1('0x14')](respondWithFilteredResult(_0x214cd0,_0x4f1e2e))[_0xb6b1('0x29')](handleError(_0x214cd0,null));};exports['show']=function(_0x22beb9,_0x9045f7){var _0x5ed56c={'raw':!![],'where':{'id':_0x22beb9[_0xb6b1('0x2a')]['id']}},_0x3efb1d={};_0x3efb1d[_0xb6b1('0x2b')]=_[_0xb6b1('0x2c')](db[_0xb6b1('0x24')][_0xb6b1('0x1e')]);_0x3efb1d['query']=_[_0xb6b1('0x2c')](_0x22beb9[_0xb6b1('0x26')]);_0x3efb1d['filters']=_[_0xb6b1('0x2d')](_0x3efb1d['model'],_0x3efb1d[_0xb6b1('0x26')]);_0x5ed56c[_0xb6b1('0x2e')]=_[_0xb6b1('0x2d')](_0x3efb1d[_0xb6b1('0x2b')],qs[_0xb6b1('0x2f')](_0x22beb9[_0xb6b1('0x26')]['fields']));_0x5ed56c[_0xb6b1('0x2e')]=_0x5ed56c[_0xb6b1('0x2e')][_0xb6b1('0x30')]?_0x5ed56c[_0xb6b1('0x2e')]:_0x3efb1d['model'];if(_0x22beb9['query']['includeAll']){_0x5ed56c[_0xb6b1('0x25')]=[{'all':!![]}];}_0x5ed56c=_[_0xb6b1('0x31')]({},_0x5ed56c,_0x22beb9[_0xb6b1('0x32')]);return db[_0xb6b1('0x24')][_0xb6b1('0x33')](_0x5ed56c)[_0xb6b1('0x14')](handleEntityNotFound(_0x9045f7,null))[_0xb6b1('0x14')](respondWithResult(_0x9045f7,null))[_0xb6b1('0x29')](handleError(_0x9045f7,null));};exports[_0xb6b1('0x34')]=function(_0x25d6a2,_0x9abbe1){return db[_0xb6b1('0x24')]['create'](_0x25d6a2[_0xb6b1('0x35')],{})[_0xb6b1('0x14')](function(_0x2f0427){var _0x453484=_0x25d6a2[_0xb6b1('0x36')][_0xb6b1('0x16')]({'plain':!![]});if(!_0x453484)throw new Error(_0xb6b1('0x37'));if(_0x453484[_0xb6b1('0x38')]===_0xb6b1('0x36')){var _0x276801=_0x2f0427[_0xb6b1('0x16')]({'plain':!![]});var _0x56470a=_0xb6b1('0x17');return db[_0xb6b1('0x39')][_0xb6b1('0x33')]({'where':{'name':_0x56470a,'userProfileId':_0x453484[_0xb6b1('0x3a')]},'raw':!![]})[_0xb6b1('0x14')](function(_0x2c583f){if(_0x2c583f&&_0x2c583f[_0xb6b1('0x3b')]===0x0){return db[_0xb6b1('0x3c')]['create']({'name':_0x276801['name'],'resourceId':_0x276801['id'],'type':_0x2c583f[_0xb6b1('0x1a')],'sectionId':_0x2c583f['id']},{})[_0xb6b1('0x14')](function(){return _0x2f0427;});}else{return _0x2f0427;}})[_0xb6b1('0x29')](function(_0x541eb5){logger[_0xb6b1('0x18')](_0xb6b1('0x3d'),_0x541eb5);throw _0x541eb5;});}return _0x2f0427;})[_0xb6b1('0x14')](respondWithResult(_0x9abbe1,0xc9))[_0xb6b1('0x29')](handleError(_0x9abbe1,null));};exports[_0xb6b1('0x13')]=function(_0x3c2780,_0xa03b13){if(_0x3c2780[_0xb6b1('0x35')]['id']){delete _0x3c2780['body']['id'];}return db[_0xb6b1('0x24')]['find']({'where':{'id':_0x3c2780[_0xb6b1('0x2a')]['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0xa03b13,null))[_0xb6b1('0x14')](saveUpdates(_0x3c2780[_0xb6b1('0x35')],null))[_0xb6b1('0x14')](respondWithResult(_0xa03b13,null))[_0xb6b1('0x29')](handleError(_0xa03b13,null));};exports['destroy']=function(_0x1d1c92,_0x2c49bb){return db['FaxQueue'][_0xb6b1('0x33')]({'where':{'id':_0x1d1c92['params']['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0x2c49bb,null))[_0xb6b1('0x14')](removeEntity(_0x2c49bb,null))[_0xb6b1('0x29')](handleError(_0x2c49bb,null));};exports[_0xb6b1('0x3e')]=function(_0x2016a1,_0x20489a){return db[_0xb6b1('0x24')][_0xb6b1('0x3e')]()[_0xb6b1('0x14')](respondWithResult(_0x20489a,null))['catch'](handleError(_0x20489a,null));};exports['getMembers']=function(_0x3826bd,_0x2c00fb){var _0x5959ca={'raw':!![],'where':{}},_0x29cf46={},_0x185de9;return db[_0xb6b1('0x24')][_0xb6b1('0x3f')]({'where':{'id':_0x3826bd[_0xb6b1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2c00fb,null))[_0xb6b1('0x14')](function(_0x1f4881){if(_0x1f4881){_0x185de9=_0x1f4881[_0xb6b1('0x16')]({'plain':!![]});_0x29cf46[_0xb6b1('0x2b')]=_['keys'](db['UserFaxQueue'][_0xb6b1('0x1e')]);_0x29cf46['query']=_[_0xb6b1('0x2c')](_0x3826bd[_0xb6b1('0x26')]);_0x29cf46['filters']=_[_0xb6b1('0x2d')](_0x29cf46['model'],_0x29cf46[_0xb6b1('0x26')]);_0x5959ca[_0xb6b1('0x2e')]=_[_0xb6b1('0x2d')](_0x29cf46[_0xb6b1('0x2b')],qs[_0xb6b1('0x2f')](_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x2f')]));_0x5959ca[_0xb6b1('0x2e')]=_0x5959ca[_0xb6b1('0x2e')][_0xb6b1('0x30')]?_0x5959ca['attributes']:_0x29cf46[_0xb6b1('0x2b')];if(!_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x40')](_0xb6b1('0x41'))){_0x5959ca[_0xb6b1('0x11')]=qs[_0xb6b1('0x11')](_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x11')]);_0x5959ca[_0xb6b1('0xf')]=qs['offset'](_0x3826bd[_0xb6b1('0x26')]['offset']);}_0x5959ca['order']=qs[_0xb6b1('0x42')](_0x3826bd[_0xb6b1('0x26')]['sort']);_0x5959ca[_0xb6b1('0x23')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0x3826bd['query'],_0x29cf46[_0xb6b1('0x43')]));_0x5959ca['where']['FaxQueueId']=_0x1f4881['id'];if(_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x45')]){_0x5959ca['where']=_['merge'](_0x5959ca['where'],{'$or':_[_0xb6b1('0x1d')](_0x5959ca['attributes'],function(_0x54c88f){var _0x47e64e={};_0x47e64e[_0x54c88f]={'$like':'%'+_0x3826bd[_0xb6b1('0x26')][_0xb6b1('0x45')]+'%'};return _0x47e64e;})});}_0x5959ca=_[_0xb6b1('0x31')]({},_0x5959ca,_0x3826bd[_0xb6b1('0x32')]);return db[_0xb6b1('0x46')][_0xb6b1('0x27')](_0x5959ca);}})['then'](function(_0x4775e6){if(_0x4775e6){return db[_0xb6b1('0x47')]['findAndCountAll']({'where':{'id':_['map'](_0x4775e6,_0xb6b1('0x48')),'role':_0xb6b1('0x49')},'attributes':['id','name','faxPause',_0xb6b1('0x4a'),'createdAt']});}})[_0xb6b1('0x14')](function(_0x1ce8a2){if(_0x1ce8a2){return{'count':_0x1ce8a2['count'],'rows':_[_0xb6b1('0x1d')](_0x1ce8a2[_0xb6b1('0x28')],function(_0xd36a24){return{'membername':_0xd36a24[_0xb6b1('0x1a')],'UserId':_0xd36a24['id'],'queue_name':_0x185de9[_0xb6b1('0x1a')],'FaxQueueId':_0x185de9['id'],'interface':util[_0xb6b1('0x4b')](_0xb6b1('0x4c'),_0xb6b1('0x4d'),_0xd36a24[_0xb6b1('0x1a')]),'penalty':0x0,'paused':_0xd36a24[_0xb6b1('0x4e')],'createdAt':_0xd36a24['createdAt'],'updatedAt':_0xd36a24[_0xb6b1('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb6b1('0x14')](respondWithFilteredResult(_0x2c00fb,_0x5959ca))[_0xb6b1('0x29')](handleError(_0x2c00fb,null));};exports[_0xb6b1('0x4f')]=function(_0x4a7796,_0x431dd9){var _0xce50c3={};var _0x2da39e={};var _0xa150da;var _0x22c5f2;return db[_0xb6b1('0x24')][_0xb6b1('0x3f')]({'where':{'id':_0x4a7796['params']['id']}})['then'](handleEntityNotFound(_0x431dd9,null))[_0xb6b1('0x14')](function(_0x51c2ed){if(_0x51c2ed){_0xa150da=_0x51c2ed;_0x2da39e[_0xb6b1('0x2b')]=_[_0xb6b1('0x2c')](db[_0xb6b1('0x50')]['rawAttributes']);_0x2da39e[_0xb6b1('0x26')]=_[_0xb6b1('0x2c')](_0x4a7796[_0xb6b1('0x26')]);_0x2da39e[_0xb6b1('0x43')]=_[_0xb6b1('0x2d')](_0x2da39e['model'],_0x2da39e['query']);_0xce50c3[_0xb6b1('0x2e')]=_[_0xb6b1('0x2d')](_0x2da39e[_0xb6b1('0x2b')],qs[_0xb6b1('0x2f')](_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x2f')]));_0xce50c3[_0xb6b1('0x2e')]=_0xce50c3[_0xb6b1('0x2e')][_0xb6b1('0x30')]?_0xce50c3[_0xb6b1('0x2e')]:_0x2da39e[_0xb6b1('0x2b')];_0xce50c3[_0xb6b1('0x51')]=qs['sort'](_0x4a7796[_0xb6b1('0x26')]['sort']);_0xce50c3[_0xb6b1('0x23')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0x4a7796['query'],_0x2da39e[_0xb6b1('0x43')]));if(_0x4a7796['query']['filter']){_0xce50c3[_0xb6b1('0x23')]=_['merge'](_0xce50c3[_0xb6b1('0x23')],{'$or':_[_0xb6b1('0x1d')](_0xce50c3['attributes'],function(_0x2780b0){var _0x58fddf={};_0x58fddf[_0x2780b0]={'$like':'%'+_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x45')]+'%'};return _0x58fddf;})});}_0xce50c3=_[_0xb6b1('0x31')]({},_0xce50c3,_0x4a7796['options']);return _0xa150da[_0xb6b1('0x4f')](_0xce50c3);}})['then'](function(_0x20f2f2){if(_0x20f2f2){_0x22c5f2=_0x20f2f2[_0xb6b1('0x30')];if(!_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x40')]('nolimit')){_0xce50c3[_0xb6b1('0x11')]=qs[_0xb6b1('0x11')](_0x4a7796[_0xb6b1('0x26')][_0xb6b1('0x11')]);_0xce50c3[_0xb6b1('0xf')]=qs[_0xb6b1('0xf')](_0x4a7796['query'][_0xb6b1('0xf')]);}return _0xa150da[_0xb6b1('0x4f')](_0xce50c3);}})[_0xb6b1('0x14')](function(_0x42d3c7){if(_0x42d3c7){return _0x42d3c7?{'count':_0x22c5f2,'rows':_0x42d3c7}:null;}})['then'](respondWithResult(_0x431dd9,null))[_0xb6b1('0x29')](handleError(_0x431dd9,null));};exports[_0xb6b1('0x52')]=function(_0x4a032e,_0x5497d2){var _0x579dde=_0x4a032e['body'][_0xb6b1('0x53')];return db[_0xb6b1('0x50')][_0xb6b1('0x27')]({'where':{'id':_0x579dde},'attributes':['id'],'include':[{'model':db[_0xb6b1('0x47')],'as':_0xb6b1('0x54'),'attributes':['id',_0xb6b1('0x1a'),_0xb6b1('0x55'),'voicePause',_0xb6b1('0x56')],'raw':!![]}]})['then'](function(_0x49be58){if(_0x49be58){var _0x15a64f=_[_0xb6b1('0x57')](_0x49be58,function(_0x56aaef){var _0x5ca38b=_0x56aaef[_0xb6b1('0x16')]({'plain':!![]});return _0x5ca38b[_0xb6b1('0x54')];});return db[_0xb6b1('0x24')][_0xb6b1('0x33')]({'where':{'id':_0x4a032e['params']['id']}})[_0xb6b1('0x14')](function(_0x3af3e2){return db['sequelize']['transaction'](function(_0x10461d){return _0x3af3e2[_0xb6b1('0x52')](_0x579dde,{'transaction':_0x10461d})[_0xb6b1('0x14')](function(){return BPromise[_0xb6b1('0x58')](_0x15a64f,function(_0x12bcf3){return db[_0xb6b1('0x46')][_0xb6b1('0x59')]({'where':{'UserId':_0x12bcf3['id'],'FaxQueueId':_0x4a032e[_0xb6b1('0x2a')]['id']},'transaction':_0x10461d});});})[_0xb6b1('0x14')](function(){_0x15a64f['forEach'](function(_0x1138f4){socket['emit'](_0xb6b1('0x5a'),{'UserId':_0x1138f4['id'],'FaxQueueId':_0x3af3e2['id']});});});});});}})[_0xb6b1('0x14')](respondWithStatusCode(_0x5497d2,null))[_0xb6b1('0x29')](handleError(_0x5497d2,null));};exports['removeTeams']=function(_0x1bf0e3,_0x457eb7){return db['Team'][_0xb6b1('0x27')]({'where':{'id':_0x1bf0e3[_0xb6b1('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb6b1('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb6b1('0x14')](handleEntityNotFound(_0x457eb7,null))['then'](function(_0x300508){var _0x15ef5e=_[_0xb6b1('0x1d')](_0x300508,'id');var _0xc27ba8=[];var _0x3765ca=[];var _0x58d0fa=squel[_0xb6b1('0x5b')]();_0x58d0fa[_0xb6b1('0x5c')](_0xb6b1('0x5d'))[_0xb6b1('0x5e')](_0xb6b1('0x5f'),'tq')[_0xb6b1('0x60')](_0xb6b1('0x61'),'ut',_0xb6b1('0x62'))[_0xb6b1('0x23')](_0xb6b1('0x63'),_0x1bf0e3[_0xb6b1('0x2a')]['id']);for(var _0x139180=0x0;_0x139180<_0x300508['length'];_0x139180+=0x1){let _0x10481c=_0x300508[_0x139180];for(var _0x385fd7=0x0;_0x385fd7<_0x10481c['Agents'][_0xb6b1('0x30')];_0x385fd7+=0x1){let _0x23298c=_0x10481c['Agents'][_0x385fd7];var _0x3d8119=_0x58d0fa['clone']();_0x3d8119[_0xb6b1('0x23')]('ut.UserId\x20=\x20?',_0x23298c['id']);_0x3765ca[_0xb6b1('0x64')](db['sequelize']['query'](_0x3d8119[_0xb6b1('0x65')](),{'type':db[_0xb6b1('0x66')]['QueryTypes'][_0xb6b1('0x67')]})[_0xb6b1('0x14')](function(_0x12ebb3){if(_0x12ebb3[_0xb6b1('0x30')]===0x1){return _0x23298c['id'];}else{var _0x292dbe=_[_0xb6b1('0x68')](_[_0xb6b1('0x1d')](_0x12ebb3,_0xb6b1('0x69')),function(_0x2f653d){return _[_0xb6b1('0x6a')](_0x15ef5e,_0x2f653d);});if(_0x292dbe){return _0x23298c['id'];}}}));}}return BPromise[_0xb6b1('0x6b')](_0x3765ca)[_0xb6b1('0x14')](function(_0x521366){_0xc27ba8=_(_0xc27ba8)[_0xb6b1('0x6c')](_0x521366)[_0xb6b1('0x6d')]()[_0xb6b1('0x6e')]();return db[_0xb6b1('0x24')]['find']({'where':{'id':_0x1bf0e3[_0xb6b1('0x2a')]['id']}})[_0xb6b1('0x14')](function(_0x15818e){return db[_0xb6b1('0x66')][_0xb6b1('0x6f')](function(_0x315f07){return _0x15818e['removeTeams'](_0x1bf0e3[_0xb6b1('0x26')][_0xb6b1('0x53')],{'transaction':_0x315f07})[_0xb6b1('0x14')](function(){if(!_[_0xb6b1('0x70')](_0xc27ba8)){return _0x15818e[_0xb6b1('0x71')](_0xc27ba8,{'transaction':_0x315f07});}})[_0xb6b1('0x14')](function(){_0xc27ba8[_0xb6b1('0x72')](function(_0x433ce8){socket[_0xb6b1('0x73')](_0xb6b1('0x74'),{'UserId':_0x433ce8,'FaxQueueId':_0x15818e['id']});});});});});});})[_0xb6b1('0x14')](respondWithStatusCode(_0x457eb7,null))[_0xb6b1('0x29')](handleError(_0x457eb7,null));};exports['addAgents']=function(_0x2046e5,_0x57feb3){return db[_0xb6b1('0x24')][_0xb6b1('0x33')]({'where':{'id':_0x2046e5[_0xb6b1('0x2a')]['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0x57feb3,null))[_0xb6b1('0x14')](function(_0x3fbff1){if(_0x3fbff1){return _0x3fbff1['addAgents'](_0x2046e5[_0xb6b1('0x35')][_0xb6b1('0x53')],_[_0xb6b1('0x75')](_0x2046e5['body'],[_0xb6b1('0x53'),'id'])||{})['spread'](function(_0x51a796){for(var _0x13f438=0x0;_0x13f438<_0x2046e5[_0xb6b1('0x35')][_0xb6b1('0x53')][_0xb6b1('0x30')];_0x13f438+=0x1){socket[_0xb6b1('0x73')](_0xb6b1('0x5a'),{'UserId':Number(_0x2046e5['body'][_0xb6b1('0x53')][_0x13f438]),'FaxQueueId':Number(_0x2046e5[_0xb6b1('0x2a')]['id'])});}return _0x51a796;});}})[_0xb6b1('0x14')](respondWithResult(_0x57feb3,null))[_0xb6b1('0x29')](handleError(_0x57feb3,null));};exports['removeAgents']=function(_0x4ea394,_0xdeaa28){return db['FaxQueue'][_0xb6b1('0x33')]({'where':{'id':_0x4ea394['params']['id']}})[_0xb6b1('0x14')](handleEntityNotFound(_0xdeaa28,null))['then'](function(_0x58b209){if(_0x58b209){return _0x58b209[_0xb6b1('0x71')](_0x4ea394[_0xb6b1('0x26')][_0xb6b1('0x53')])[_0xb6b1('0x14')](function(){if(_[_0xb6b1('0x76')](_0x4ea394['query'][_0xb6b1('0x53')])){for(var _0x170d5c=0x0;_0x170d5c<_0x4ea394[_0xb6b1('0x26')][_0xb6b1('0x53')]['length'];_0x170d5c+=0x1){socket[_0xb6b1('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x4ea394[_0xb6b1('0x26')]['ids'][_0x170d5c]),'FaxQueueId':Number(_0x4ea394[_0xb6b1('0x2a')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x4ea394['query']['ids']),'FaxQueueId':Number(_0x4ea394[_0xb6b1('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0xdeaa28,null))[_0xb6b1('0x29')](handleError(_0xdeaa28,null));};exports[_0xb6b1('0x77')]=function(_0x15ca42,_0x371cb6){var _0x5d1c1d={};var _0x206833={};var _0x275b4b;var _0x4ce967;return db['FaxQueue']['findOne']({'where':{'id':_0x15ca42[_0xb6b1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x371cb6,null))[_0xb6b1('0x14')](function(_0x490f9f){if(_0x490f9f){_0x275b4b=_0x490f9f;_0x206833[_0xb6b1('0x2b')]=_['keys'](db[_0xb6b1('0x47')]['rawAttributes']);_0x206833['query']=_[_0xb6b1('0x2c')](_0x15ca42[_0xb6b1('0x26')]);_0x206833[_0xb6b1('0x43')]=_[_0xb6b1('0x2d')](_0x206833[_0xb6b1('0x2b')],_0x206833[_0xb6b1('0x26')]);_0x5d1c1d['attributes']=_[_0xb6b1('0x2d')](_0x206833[_0xb6b1('0x2b')],qs['fields'](_0x15ca42[_0xb6b1('0x26')][_0xb6b1('0x2f')]));_0x5d1c1d[_0xb6b1('0x2e')]=_0x5d1c1d['attributes'][_0xb6b1('0x30')]?_0x5d1c1d[_0xb6b1('0x2e')]:_0x206833[_0xb6b1('0x2b')];_0x5d1c1d[_0xb6b1('0x51')]=qs[_0xb6b1('0x42')](_0x15ca42[_0xb6b1('0x26')][_0xb6b1('0x42')]);_0x5d1c1d[_0xb6b1('0x23')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0x15ca42[_0xb6b1('0x26')],_0x206833['filters']));if(_0x15ca42['query']['filter']){_0x5d1c1d[_0xb6b1('0x23')]=_['merge'](_0x5d1c1d[_0xb6b1('0x23')],{'$or':_[_0xb6b1('0x1d')](_0x5d1c1d[_0xb6b1('0x2e')],function(_0xa392e9){var _0x5b74d7={};_0x5b74d7[_0xa392e9]={'$like':'%'+_0x15ca42[_0xb6b1('0x26')]['filter']+'%'};return _0x5b74d7;})});}_0x5d1c1d=_['merge']({},_0x5d1c1d,_0x15ca42['options']);return _0x275b4b[_0xb6b1('0x77')](_0x5d1c1d);}})[_0xb6b1('0x14')](function(_0x412619){if(_0x412619){_0x4ce967=_0x412619[_0xb6b1('0x30')];if(!_0x15ca42[_0xb6b1('0x26')][_0xb6b1('0x40')](_0xb6b1('0x41'))){_0x5d1c1d['limit']=qs['limit'](_0x15ca42[_0xb6b1('0x26')]['limit']);_0x5d1c1d[_0xb6b1('0xf')]=qs['offset'](_0x15ca42['query']['offset']);}return _0x275b4b['getAgents'](_0x5d1c1d);}})[_0xb6b1('0x14')](function(_0x269854){if(_0x269854){return _0x269854?{'count':_0x4ce967,'rows':_0x269854}:null;}})[_0xb6b1('0x14')](respondWithResult(_0x371cb6,null))[_0xb6b1('0x29')](handleError(_0x371cb6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f9781bd..2012872 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 _0x6925=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x310745,_0x4b5f3f){var _0x1909a8=function(_0x5aa3e8){while(--_0x5aa3e8){_0x310745['push'](_0x310745['shift']());}};_0x1909a8(++_0x4b5f3f);}(_0x6925,0x181));var _0x5692=function(_0x496714,_0x1beadb){_0x496714=_0x496714-0x0;var _0x7ff44a=_0x6925[_0x496714];return _0x7ff44a;};'use strict';var EventEmitter=require(_0x5692('0x0'));var FaxQueue=require(_0x5692('0x1'))['db'][_0x5692('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5692('0x3')](0x0);var events={'afterCreate':_0x5692('0x4'),'afterUpdate':_0x5692('0x5'),'afterDestroy':_0x5692('0x6')};function emitEvent(_0x292e15){return function(_0x1980d8,_0x35dc08,_0x5f0983){FaxQueueEvents['emit'](_0x292e15+':'+_0x1980d8['id'],_0x1980d8);FaxQueueEvents[_0x5692('0x7')](_0x292e15,_0x1980d8);_0x5f0983(null);};}for(var e in events){if(events[_0x5692('0x8')](e)){var event=events[e];FaxQueue[_0x5692('0x9')](e,emitEvent(event));}}module[_0x5692('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x94ff=['emit','hasOwnProperty','events','FaxQueue','setMaxListeners','remove'];(function(_0x1eb05b,_0x190b22){var _0x134f13=function(_0x103c18){while(--_0x103c18){_0x1eb05b['push'](_0x1eb05b['shift']());}};_0x134f13(++_0x190b22);}(_0x94ff,0x9e));var _0xf94f=function(_0x5c873d,_0x29a887){_0x5c873d=_0x5c873d-0x0;var _0xf38a50=_0x94ff[_0x5c873d];return _0xf38a50;};'use strict';var EventEmitter=require(_0xf94f('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf94f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf94f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf94f('0x3')};function emitEvent(_0x54d007){return function(_0x32206e,_0x1e4134,_0x1c600e){FaxQueueEvents[_0xf94f('0x4')](_0x54d007+':'+_0x32206e['id'],_0x32206e);FaxQueueEvents[_0xf94f('0x4')](_0x54d007,_0x32206e);_0x1c600e(null);};}for(var e in events){if(events[_0xf94f('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 8630f3a..4186f9f 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 _0x4447=['path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e8bcb,_0x474a81){var _0x212080=function(_0x57a1f5){while(--_0x57a1f5){_0x1e8bcb['push'](_0x1e8bcb['shift']());}};_0x212080(++_0x474a81);}(_0x4447,0x186));var _0x7444=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4447[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x7444('0x0'));var util=require('util');var logger=require(_0x7444('0x1'))(_0x7444('0x2'));var moment=require(_0x7444('0x3'));var BPromise=require(_0x7444('0x4'));var rp=require(_0x7444('0x5'));var fs=require('fs');var path=require(_0x7444('0x6'));var rimraf=require(_0x7444('0x7'));var config=require(_0x7444('0x8'));var attributes=require(_0x7444('0x9'));module['exports']=function(_0x582a64,_0x274928){return _0x582a64[_0x7444('0xa')](_0x7444('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf533=['./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','../../config/logger','moment','path','rimraf'];(function(_0x260c1b,_0x5f4b2c){var _0x213e0a=function(_0x223390){while(--_0x223390){_0x260c1b['push'](_0x260c1b['shift']());}};_0x213e0a(++_0x5f4b2c);}(_0xf533,0x163));var _0x3f53=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xf533[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0x3f53('0x0'));var util=require('util');var logger=require(_0x3f53('0x1'))('api');var moment=require(_0x3f53('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f53('0x3'));var rimraf=require(_0x3f53('0x4'));var config=require('../../config/environment');var attributes=require(_0x3f53('0x5'));module['exports']=function(_0x27f991,_0x43510f){return _0x27f991[_0x3f53('0x6')](_0x3f53('0x7'),attributes,{'tableName':_0x3f53('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 8606c99..c2feecd 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 _0x059e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFaxQueue','FaxQueue','find','util','moment','bluebird'];(function(_0x5a8275,_0x4bf3c9){var _0x43e0c2=function(_0x16d49e){while(--_0x16d49e){_0x5a8275['push'](_0x5a8275['shift']());}};_0x43e0c2(++_0x4bf3c9);}(_0x059e,0x1c0));var _0xe059=function(_0x18dad8,_0x34d23b){_0x18dad8=_0x18dad8-0x0;var _0x3ec821=_0x059e[_0x18dad8];return _0x3ec821;};'use strict';var _=require('lodash');var util=require(_0xe059('0x0'));var moment=require(_0xe059('0x1'));var BPromise=require(_0xe059('0x2'));var rs=require(_0xe059('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe059('0x4'));var logger=require(_0xe059('0x5'))(_0xe059('0x6'));var config=require(_0xe059('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe059('0x8')]['http']({'port':0x232a});config[_0xe059('0x9')]=_[_0xe059('0xa')](config[_0xe059('0x9')],{'host':_0xe059('0xb'),'port':0x18eb});var socket=require(_0xe059('0xc'))(new Redis(config[_0xe059('0x9')]));require(_0xe059('0xd'))[_0xe059('0xe')](socket);function respondWithRpcPromise(_0x449270,_0x59833d,_0x2581aa){return new BPromise(function(_0x3a9877,_0x6c8f4e){return client[_0xe059('0xf')](_0x449270,_0x2581aa)[_0xe059('0x10')](function(_0x37966d){logger[_0xe059('0x11')]('FaxQueue,\x20%s,\x20%s',_0x59833d,_0xe059('0x12'));logger[_0xe059('0x13')](_0xe059('0x14'),_0x59833d,'request\x20sent',JSON['stringify'](_0x37966d));if(_0x37966d[_0xe059('0x15')]){if(_0x37966d[_0xe059('0x15')][_0xe059('0x16')]===0x1f4){logger[_0xe059('0x15')]('FaxQueue,\x20%s,\x20%s',_0x59833d,_0x37966d[_0xe059('0x15')][_0xe059('0x17')]);return _0x6c8f4e(_0x37966d['error'][_0xe059('0x17')]);}logger[_0xe059('0x15')](_0xe059('0x18'),_0x59833d,_0x37966d[_0xe059('0x15')]['message']);return _0x3a9877(_0x37966d['error'][_0xe059('0x17')]);}else{logger['info'](_0xe059('0x18'),_0x59833d,_0xe059('0x12'));_0x3a9877(_0x37966d[_0xe059('0x19')][_0xe059('0x17')]);}})[_0xe059('0x1a')](function(_0x27e2df){logger[_0xe059('0x15')](_0xe059('0x18'),_0x59833d,_0x27e2df);_0x6c8f4e(_0x27e2df);});});}exports[_0xe059('0x1b')]=function(_0x3bddea){var _0x11d7ab=this;return new Promise(function(_0x4b4c35,_0x37e0c8){return db['FaxQueue'][_0xe059('0x1c')]({'raw':_0x3bddea[_0xe059('0x1d')]?_0x3bddea['options'][_0xe059('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bddea[_0xe059('0x1d')]?_0x3bddea[_0xe059('0x1d')][_0xe059('0x1f')]||null:null,'attributes':_0x3bddea[_0xe059('0x1d')]?_0x3bddea[_0xe059('0x1d')][_0xe059('0x20')]||null:null,'limit':_0x3bddea[_0xe059('0x1d')]?_0x3bddea[_0xe059('0x1d')][_0xe059('0x21')]||null:null,'include':_0x3bddea[_0xe059('0x1d')]?_0x3bddea[_0xe059('0x1d')][_0xe059('0x22')]?_['map'](_0x3bddea[_0xe059('0x1d')][_0xe059('0x22')],function(_0x546909){return{'model':db[_0x546909['model']],'as':_0x546909['as'],'attributes':_0x546909['attributes'],'include':_0x546909[_0xe059('0x22')]?_[_0xe059('0x23')](_0x546909['include'],function(_0x51ef02){return{'model':db[_0x51ef02['model']],'as':_0x51ef02['as'],'attributes':_0x51ef02['attributes'],'include':_0x51ef02[_0xe059('0x22')]?_[_0xe059('0x23')](_0x51ef02[_0xe059('0x22')],function(_0x31e787){return{'model':db[_0x31e787[_0xe059('0x24')]],'as':_0x31e787['as'],'attributes':_0x31e787[_0xe059('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe059('0x10')](function(_0x4d14c7){logger['info'](_0xe059('0x1b'),_0x3bddea);logger[_0xe059('0x13')](_0xe059('0x1b'),_0x3bddea,JSON[_0xe059('0x25')](_0x4d14c7));_0x4b4c35(_0x4d14c7);})[_0xe059('0x1a')](function(_0x23abb7){logger[_0xe059('0x15')](_0xe059('0x1b'),_0x23abb7[_0xe059('0x17')],_0x3bddea);_0x37e0c8(_0x11d7ab['error'](0x1f4,_0x23abb7[_0xe059('0x17')]));});});};exports[_0xe059('0x26')]=function(_0x523086){var _0x4e101f=this;return new Promise(function(_0x1a790d,_0x40c72b){return db[_0xe059('0x27')][_0xe059('0x28')]({'raw':_0x523086[_0xe059('0x1d')]?_0x523086[_0xe059('0x1d')][_0xe059('0x1e')]===undefined?!![]:![]:!![],'where':_0x523086['options']?_0x523086[_0xe059('0x1d')]['where']||null:null,'attributes':_0x523086[_0xe059('0x1d')]?_0x523086[_0xe059('0x1d')]['attributes']||null:null,'include':_0x523086[_0xe059('0x1d')]?_0x523086['options'][_0xe059('0x22')]?_['map'](_0x523086[_0xe059('0x1d')]['include'],function(_0x46fe3e){return{'model':db[_0x46fe3e[_0xe059('0x24')]],'as':_0x46fe3e['as'],'attributes':_0x46fe3e['attributes'],'include':_0x46fe3e['include']?_['map'](_0x46fe3e['include'],function(_0x598bd5){return{'model':db[_0x598bd5['model']],'as':_0x598bd5['as'],'attributes':_0x598bd5['attributes'],'include':_0x598bd5[_0xe059('0x22')]?_['map'](_0x598bd5['include'],function(_0x16320b){return{'model':db[_0x16320b[_0xe059('0x24')]],'as':_0x16320b['as'],'attributes':_0x16320b[_0xe059('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe059('0x10')](function(_0x471382){logger[_0xe059('0x11')]('ShowFaxQueue',_0x523086);logger[_0xe059('0x13')](_0xe059('0x26'),_0x523086,JSON[_0xe059('0x25')](_0x471382));_0x1a790d(_0x471382);})[_0xe059('0x1a')](function(_0x1b3bd4){logger[_0xe059('0x15')](_0xe059('0x26'),_0x1b3bd4[_0xe059('0x17')],_0x523086);_0x40c72b(_0x4e101f[_0xe059('0x15')](0x1f4,_0x1b3bd4[_0xe059('0x17')]));});});}; \ No newline at end of file +var _0x0135=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','options','raw','where','limit','include','map','attributes','model','GetFaxQueue','ShowFaxQueue','FaxQueue','find','lodash','util'];(function(_0x27f269,_0x73067b){var _0x1fb1cc=function(_0x5c15e0){while(--_0x5c15e0){_0x27f269['push'](_0x27f269['shift']());}};_0x1fb1cc(++_0x73067b);}(_0x0135,0xcb));var _0x5013=function(_0x5ce537,_0x51a17d){_0x5ce537=_0x5ce537-0x0;var _0x263a76=_0x0135[_0x5ce537];return _0x263a76;};'use strict';var _=require(_0x5013('0x0'));var util=require(_0x5013('0x1'));var moment=require(_0x5013('0x2'));var BPromise=require(_0x5013('0x3'));var rs=require(_0x5013('0x4'));var fs=require('fs');var Redis=require(_0x5013('0x5'));var db=require(_0x5013('0x6'))['db'];var utils=require(_0x5013('0x7'));var logger=require(_0x5013('0x8'))(_0x5013('0x9'));var config=require(_0x5013('0xa'));var jayson=require(_0x5013('0xb'));var client=jayson['client'][_0x5013('0xc')]({'port':0x232a});config[_0x5013('0xd')]=_[_0x5013('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5013('0xf'))(new Redis(config['redis']));require(_0x5013('0x10'))[_0x5013('0x11')](socket);function respondWithRpcPromise(_0x3bce1e,_0x1ddf90,_0x167415){return new BPromise(function(_0x513dc2,_0x18e5ed){return client[_0x5013('0x12')](_0x3bce1e,_0x167415)[_0x5013('0x13')](function(_0x4ec50b){logger[_0x5013('0x14')](_0x5013('0x15'),_0x1ddf90,_0x5013('0x16'));logger[_0x5013('0x17')](_0x5013('0x18'),_0x1ddf90,_0x5013('0x16'),JSON[_0x5013('0x19')](_0x4ec50b));if(_0x4ec50b[_0x5013('0x1a')]){if(_0x4ec50b[_0x5013('0x1a')]['code']===0x1f4){logger[_0x5013('0x1a')](_0x5013('0x15'),_0x1ddf90,_0x4ec50b['error'][_0x5013('0x1b')]);return _0x18e5ed(_0x4ec50b[_0x5013('0x1a')][_0x5013('0x1b')]);}logger[_0x5013('0x1a')](_0x5013('0x15'),_0x1ddf90,_0x4ec50b[_0x5013('0x1a')][_0x5013('0x1b')]);return _0x513dc2(_0x4ec50b[_0x5013('0x1a')]['message']);}else{logger[_0x5013('0x14')]('FaxQueue,\x20%s,\x20%s',_0x1ddf90,_0x5013('0x16'));_0x513dc2(_0x4ec50b['result'][_0x5013('0x1b')]);}})[_0x5013('0x1c')](function(_0x1d0019){logger[_0x5013('0x1a')](_0x5013('0x15'),_0x1ddf90,_0x1d0019);_0x18e5ed(_0x1d0019);});});}exports['GetFaxQueue']=function(_0x5aff29){var _0x472561=this;return new Promise(function(_0x2e02ff,_0x29d3ba){return db['FaxQueue']['findAll']({'raw':_0x5aff29[_0x5013('0x1d')]?_0x5aff29[_0x5013('0x1d')][_0x5013('0x1e')]===undefined?!![]:![]:!![],'where':_0x5aff29[_0x5013('0x1d')]?_0x5aff29[_0x5013('0x1d')][_0x5013('0x1f')]||null:null,'attributes':_0x5aff29['options']?_0x5aff29[_0x5013('0x1d')]['attributes']||null:null,'limit':_0x5aff29['options']?_0x5aff29[_0x5013('0x1d')][_0x5013('0x20')]||null:null,'include':_0x5aff29[_0x5013('0x1d')]?_0x5aff29[_0x5013('0x1d')][_0x5013('0x21')]?_[_0x5013('0x22')](_0x5aff29[_0x5013('0x1d')][_0x5013('0x21')],function(_0x203360){return{'model':db[_0x203360['model']],'as':_0x203360['as'],'attributes':_0x203360[_0x5013('0x23')],'include':_0x203360['include']?_['map'](_0x203360[_0x5013('0x21')],function(_0x3de948){return{'model':db[_0x3de948[_0x5013('0x24')]],'as':_0x3de948['as'],'attributes':_0x3de948[_0x5013('0x23')],'include':_0x3de948['include']?_[_0x5013('0x22')](_0x3de948[_0x5013('0x21')],function(_0x22559){return{'model':db[_0x22559[_0x5013('0x24')]],'as':_0x22559['as'],'attributes':_0x22559[_0x5013('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5013('0x13')](function(_0x373739){logger[_0x5013('0x14')](_0x5013('0x25'),_0x5aff29);logger[_0x5013('0x17')](_0x5013('0x25'),_0x5aff29,JSON['stringify'](_0x373739));_0x2e02ff(_0x373739);})[_0x5013('0x1c')](function(_0x5e59b6){logger[_0x5013('0x1a')](_0x5013('0x25'),_0x5e59b6['message'],_0x5aff29);_0x29d3ba(_0x472561['error'](0x1f4,_0x5e59b6[_0x5013('0x1b')]));});});};exports[_0x5013('0x26')]=function(_0x5a07b5){var _0x3a5168=this;return new Promise(function(_0x39f46c,_0x26c5a9){return db[_0x5013('0x27')][_0x5013('0x28')]({'raw':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5['options'][_0x5013('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5['options']['where']||null:null,'attributes':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5[_0x5013('0x1d')][_0x5013('0x23')]||null:null,'include':_0x5a07b5[_0x5013('0x1d')]?_0x5a07b5[_0x5013('0x1d')][_0x5013('0x21')]?_[_0x5013('0x22')](_0x5a07b5[_0x5013('0x1d')][_0x5013('0x21')],function(_0x14a8cf){return{'model':db[_0x14a8cf['model']],'as':_0x14a8cf['as'],'attributes':_0x14a8cf['attributes'],'include':_0x14a8cf['include']?_[_0x5013('0x22')](_0x14a8cf[_0x5013('0x21')],function(_0x19e0b2){return{'model':db[_0x19e0b2['model']],'as':_0x19e0b2['as'],'attributes':_0x19e0b2[_0x5013('0x23')],'include':_0x19e0b2['include']?_[_0x5013('0x22')](_0x19e0b2[_0x5013('0x21')],function(_0x1e58b2){return{'model':db[_0x1e58b2['model']],'as':_0x1e58b2['as'],'attributes':_0x1e58b2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b75){logger[_0x5013('0x14')](_0x5013('0x26'),_0x5a07b5);logger[_0x5013('0x17')]('ShowFaxQueue',_0x5a07b5,JSON['stringify'](_0x59b75));_0x39f46c(_0x59b75);})[_0x5013('0x1c')](function(_0x510dad){logger[_0x5013('0x1a')](_0x5013('0x26'),_0x510dad['message'],_0x5a07b5);_0x26c5a9(_0x3a5168[_0x5013('0x1a')](0x1f4,_0x510dad[_0x5013('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b35ea62..0e4c8a2 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 _0x4d1b=['removeListener','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x3f3f85,_0x1a8278){var _0x4a0ed4=function(_0x2edf36){while(--_0x2edf36){_0x3f3f85['push'](_0x3f3f85['shift']());}};_0x4a0ed4(++_0x1a8278);}(_0x4d1b,0x128));var _0xb4d1=function(_0x13f2ec,_0x407206){_0x13f2ec=_0x13f2ec-0x0;var _0x389ca9=_0x4d1b[_0x13f2ec];return _0x389ca9;};'use strict';var FaxQueueEvents=require(_0xb4d1('0x0'));var events=[_0xb4d1('0x1'),'remove',_0xb4d1('0x2')];function createListener(_0x5e3980,_0x3c542d){return function(_0xff7ed6){_0x3c542d[_0xb4d1('0x3')](_0x5e3980,_0xff7ed6);};}function removeListener(_0x2ce643,_0x1c279e){return function(){FaxQueueEvents[_0xb4d1('0x4')](_0x2ce643,_0x1c279e);};}exports['register']=function(_0x2f59d0){for(var _0x4d0f39=0x0,_0x5c02c7=events['length'];_0x4d0f39<_0x5c02c7;_0x4d0f39++){var _0x102ced=events[_0x4d0f39];var _0x4cab1d=createListener(_0xb4d1('0x5')+_0x102ced,_0x2f59d0);FaxQueueEvents['on'](_0x102ced,_0x4cab1d);}}; \ No newline at end of file +var _0x7d6a=['remove','update','emit','removeListener','length','faxQueue:','./faxQueue.events','save'];(function(_0x461560,_0x29ceda){var _0x3d0045=function(_0x411a1c){while(--_0x411a1c){_0x461560['push'](_0x461560['shift']());}};_0x3d0045(++_0x29ceda);}(_0x7d6a,0xf6));var _0xa7d6=function(_0x451c9f,_0x256c64){_0x451c9f=_0x451c9f-0x0;var _0x47d21f=_0x7d6a[_0x451c9f];return _0x47d21f;};'use strict';var FaxQueueEvents=require(_0xa7d6('0x0'));var events=[_0xa7d6('0x1'),_0xa7d6('0x2'),_0xa7d6('0x3')];function createListener(_0x2ca4d6,_0x2918f){return function(_0xa10d84){_0x2918f[_0xa7d6('0x4')](_0x2ca4d6,_0xa10d84);};}function removeListener(_0x222cc0,_0x321c25){return function(){FaxQueueEvents[_0xa7d6('0x5')](_0x222cc0,_0x321c25);};}exports['register']=function(_0x589a63){for(var _0x250a81=0x0,_0x1ab382=events[_0xa7d6('0x6')];_0x250a81<_0x1ab382;_0x250a81++){var _0x2bc22e=events[_0x250a81];var _0x62eb0d=createListener(_0xa7d6('0x7')+_0x2bc22e,_0x589a63);FaxQueueEvents['on'](_0x2bc22e,_0x62eb0d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b3bf4bf..858be07 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 _0x9f37=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','put','update','delete','removeTeams','removeAgents'];(function(_0xcce61d,_0x5cef21){var _0x452d8e=function(_0x555e4d){while(--_0x555e4d){_0xcce61d['push'](_0xcce61d['shift']());}};_0x452d8e(++_0x5cef21);}(_0x9f37,0xd1));var _0x79f3=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x9f37[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var path=require('path');var timeout=require(_0x79f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x79f3('0x3'));var auth=require(_0x79f3('0x4'));var interaction=require(_0x79f3('0x5'));var config=require('../../config/environment');var controller=require(_0x79f3('0x6'));router[_0x79f3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79f3('0x7')](_0x79f3('0x8'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xa')]);router['get'](_0x79f3('0xb'),auth[_0x79f3('0x9')](),controller['show']);router[_0x79f3('0x7')](_0x79f3('0xc'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xd')]);router[_0x79f3('0x7')]('/:id/teams',auth[_0x79f3('0x9')](),controller[_0x79f3('0xe')]);router['get']('/:id/users',auth[_0x79f3('0x9')](),controller[_0x79f3('0xf')]);router[_0x79f3('0x10')]('/',auth[_0x79f3('0x9')](),controller['create']);router[_0x79f3('0x10')](_0x79f3('0x11'),auth[_0x79f3('0x9')](),controller[_0x79f3('0x12')]);router[_0x79f3('0x10')](_0x79f3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0x79f3('0x14')](_0x79f3('0xb'),auth['isAuthenticated'](),controller[_0x79f3('0x15')]);router[_0x79f3('0x16')](_0x79f3('0xb'),auth[_0x79f3('0x9')](),controller['destroy']);router[_0x79f3('0x16')](_0x79f3('0x11'),auth[_0x79f3('0x9')](),controller[_0x79f3('0x17')]);router[_0x79f3('0x16')](_0x79f3('0x13'),auth[_0x79f3('0x9')](),controller[_0x79f3('0x18')]);module[_0x79f3('0x19')]=router; \ No newline at end of file +var _0x7880=['delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update'];(function(_0x40e36f,_0x27e0e1){var _0x3a6d16=function(_0x1dcc88){while(--_0x1dcc88){_0x40e36f['push'](_0x40e36f['shift']());}};_0x3a6d16(++_0x27e0e1);}(_0x7880,0x1f4));var _0x0788=function(_0x48e885,_0x1b7f8a){_0x48e885=_0x48e885-0x0;var _0x3830a4=_0x7880[_0x48e885];return _0x3830a4;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),controller[_0x0788('0x13')]);router[_0x0788('0x9')](_0x0788('0x14'),auth[_0x0788('0xa')](),controller[_0x0788('0x15')]);router[_0x0788('0x16')]('/',auth[_0x0788('0xa')](),controller['create']);router[_0x0788('0x16')](_0x0788('0x12'),auth[_0x0788('0xa')](),controller[_0x0788('0x17')]);router['post'](_0x0788('0x14'),auth['isAuthenticated'](),controller[_0x0788('0x18')]);router[_0x0788('0x19')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x1a')]);router[_0x0788('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x0788('0x1c')]);router[_0x0788('0x1b')]('/:id/teams',auth[_0x0788('0xa')](),controller[_0x0788('0x1d')]);router[_0x0788('0x1b')]('/:id/users',auth[_0x0788('0xa')](),controller[_0x0788('0x1e')]);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 0244351..c9e460f 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 _0xdb60=['exports','STRING','DATE','moment'];(function(_0x1f06c8,_0x417f00){var _0x2325ff=function(_0x214c4b){while(--_0x214c4b){_0x1f06c8['push'](_0x1f06c8['shift']());}};_0x2325ff(++_0x417f00);}(_0xdb60,0xd3));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x0db6('0x0'));var Sequelize=require('sequelize');module[_0x0db6('0x1')]={'uniqueid':{'type':Sequelize[_0x0db6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0db6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0db6('0x3')]},'exitAt':{'type':Sequelize[_0x0db6('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4c91=['sequelize','exports','STRING','DATE','moment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x4c91,0x1da));var _0x14c9=function(_0x225d1c,_0x28de7f){_0x225d1c=_0x225d1c-0x0;var _0x31ff4c=_0x4c91[_0x225d1c];return _0x31ff4c;};'use strict';var moment=require(_0x14c9('0x0'));var Sequelize=require(_0x14c9('0x1'));module[_0x14c9('0x2')]={'uniqueid':{'type':Sequelize[_0x14c9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x14c9('0x4')]},'leaveAt':{'type':Sequelize[_0x14c9('0x4')]},'acceptAt':{'type':Sequelize[_0x14c9('0x4')]},'exitAt':{'type':Sequelize[_0x14c9('0x4')]},'reason':{'type':Sequelize[_0x14c9('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b47d589..6302298 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 _0x25a3=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FaxQueueReport','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel'];(function(_0xc941ea,_0x408c2e){var _0x3b0f27=function(_0x5a4233){while(--_0x5a4233){_0xc941ea['push'](_0xc941ea['shift']());}};_0x3b0f27(++_0x408c2e);}(_0x25a3,0x121));var _0x325a=function(_0x424c25,_0x247426){_0x424c25=_0x424c25-0x0;var _0x3860db=_0x25a3[_0x424c25];return _0x3860db;};'use strict';var emlformat=require(_0x325a('0x0'));var rimraf=require(_0x325a('0x1'));var zipdir=require(_0x325a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x325a('0x3'));var moment=require('moment');var BPromise=require(_0x325a('0x4'));var Mustache=require(_0x325a('0x5'));var util=require(_0x325a('0x6'));var path=require('path');var sox=require(_0x325a('0x7'));var csv=require(_0x325a('0x8'));var ejs=require(_0x325a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x325a('0xa'));var crypto=require(_0x325a('0xb'));var jsforce=require(_0x325a('0xc'));var deskjs=require(_0x325a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x325a('0xe'));var Redis=require(_0x325a('0xf'));var authService=require(_0x325a('0x10'));var qs=require(_0x325a('0x11'));var as=require(_0x325a('0x12'));var hardwareService=require(_0x325a('0x13'));var logger=require('../../config/logger')(_0x325a('0x14'));var utils=require(_0x325a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x325a('0x16'));var db=require(_0x325a('0x17'))['db'];function respondWithStatusCode(_0x2a8750,_0x3e90fe){_0x3e90fe=_0x3e90fe||0xcc;return function(_0x4e3b88){if(_0x4e3b88){return _0x2a8750['sendStatus'](_0x3e90fe);}return _0x2a8750[_0x325a('0x18')](_0x3e90fe)['end']();};}function respondWithResult(_0x3d12d5,_0xa8dc3a){_0xa8dc3a=_0xa8dc3a||0xc8;return function(_0x3db556){if(_0x3db556){return _0x3d12d5[_0x325a('0x18')](_0xa8dc3a)[_0x325a('0x19')](_0x3db556);}};}function respondWithFilteredResult(_0x3d198c,_0x1d7efc){return function(_0x4412ba){if(_0x4412ba){var _0x1fd4ec=typeof _0x1d7efc[_0x325a('0x1a')]===_0x325a('0x1b')&&typeof _0x1d7efc[_0x325a('0x1c')]===_0x325a('0x1b');var _0x1dcafe=_0x4412ba['count'];var _0x4cba7=_0x1fd4ec?0x0:_0x1d7efc[_0x325a('0x1a')];var _0x4a1f9f=_0x1fd4ec?_0x4412ba[_0x325a('0x1d')]:_0x1d7efc[_0x325a('0x1a')]+_0x1d7efc[_0x325a('0x1c')];var _0x297599;if(_0x4a1f9f>=_0x1dcafe){_0x4a1f9f=_0x1dcafe;_0x297599=0xc8;}else{_0x297599=0xce;}_0x3d198c[_0x325a('0x18')](_0x297599);return _0x3d198c[_0x325a('0x1e')](_0x325a('0x1f'),_0x4cba7+'-'+_0x4a1f9f+'/'+_0x1dcafe)[_0x325a('0x19')](_0x4412ba);}return null;};}function patchUpdates(_0x347f2d){return function(_0x1d76b7){try{jsonpatch[_0x325a('0x20')](_0x1d76b7,_0x347f2d,!![]);}catch(_0x11f0cb){return BPromise['reject'](_0x11f0cb);}return _0x1d76b7[_0x325a('0x21')]();};}function saveUpdates(_0x32a2f5,_0x18e29f){return function(_0x192e83){if(_0x192e83){return _0x192e83[_0x325a('0x22')](_0x32a2f5)[_0x325a('0x23')](function(_0x4c21bf){return _0x4c21bf;});}return null;};}function removeEntity(_0x36b2ac,_0x4c403d){return function(_0x15b5a6){if(_0x15b5a6){return _0x15b5a6[_0x325a('0x24')]()[_0x325a('0x23')](function(){_0x36b2ac[_0x325a('0x18')](0xcc)[_0x325a('0x25')]();});}};}function handleEntityNotFound(_0x4b3d65,_0x29543e){return function(_0x4b4155){if(!_0x4b4155){_0x4b3d65[_0x325a('0x26')](0x194);}return _0x4b4155;};}function handleError(_0x26c001,_0x41d0d2){_0x41d0d2=_0x41d0d2||0x1f4;return function(_0x5ad31d){logger[_0x325a('0x27')](_0x5ad31d[_0x325a('0x28')]);if(_0x5ad31d[_0x325a('0x29')]){delete _0x5ad31d[_0x325a('0x29')];}_0x26c001[_0x325a('0x18')](_0x41d0d2)[_0x325a('0x2a')](_0x5ad31d);};}exports[_0x325a('0x2b')]=function(_0x49d93b,_0x44468d){var _0x5cdfd1={},_0x201e01={},_0x3fa4f6={'count':0x0,'rows':[]};var _0xb10b39=_[_0x325a('0x2c')](db[_0x325a('0x2d')]['rawAttributes'],function(_0x27b3f7){return{'name':_0x27b3f7['fieldName'],'type':_0x27b3f7[_0x325a('0x2e')][_0x325a('0x2f')]};});_0x201e01['model']=_[_0x325a('0x2c')](_0xb10b39,_0x325a('0x29'));_0x201e01[_0x325a('0x30')]=_[_0x325a('0x31')](_0x49d93b['query']);_0x201e01[_0x325a('0x32')]=_[_0x325a('0x33')](_0x201e01[_0x325a('0x34')],_0x201e01[_0x325a('0x30')]);_0x5cdfd1['attributes']=_[_0x325a('0x33')](_0x201e01[_0x325a('0x34')],qs[_0x325a('0x35')](_0x49d93b[_0x325a('0x30')][_0x325a('0x35')]));_0x5cdfd1[_0x325a('0x36')]=_0x5cdfd1['attributes'][_0x325a('0x37')]?_0x5cdfd1[_0x325a('0x36')]:_0x201e01['model'];if(!_0x49d93b[_0x325a('0x30')][_0x325a('0x38')]('nolimit')){_0x5cdfd1[_0x325a('0x1c')]=qs['limit'](_0x49d93b[_0x325a('0x30')][_0x325a('0x1c')]);_0x5cdfd1[_0x325a('0x1a')]=qs[_0x325a('0x1a')](_0x49d93b['query'][_0x325a('0x1a')]);}_0x5cdfd1['order']=qs[_0x325a('0x39')](_0x49d93b['query']['sort']);_0x5cdfd1[_0x325a('0x3a')]=qs[_0x325a('0x32')](_[_0x325a('0x3b')](_0x49d93b['query'],_0x201e01[_0x325a('0x32')]),_0xb10b39);if(_0x49d93b['query'][_0x325a('0x3c')]){_0x5cdfd1[_0x325a('0x3a')]=_[_0x325a('0x3d')](_0x5cdfd1[_0x325a('0x3a')],{'$or':_[_0x325a('0x2c')](_0xb10b39,function(_0x1caa7f){if(_0x1caa7f[_0x325a('0x2e')]!==_0x325a('0x3e')){var _0x4db749={};_0x4db749[_0x1caa7f[_0x325a('0x29')]]={'$like':'%'+_0x49d93b[_0x325a('0x30')][_0x325a('0x3c')]+'%'};return _0x4db749;}})});}_0x5cdfd1=_[_0x325a('0x3d')]({},_0x5cdfd1,_0x49d93b[_0x325a('0x3f')]);var _0x206fa2={'where':_0x5cdfd1[_0x325a('0x3a')]};return db[_0x325a('0x2d')][_0x325a('0x1d')](_0x206fa2)['then'](function(_0x2997a0){_0x3fa4f6[_0x325a('0x1d')]=_0x2997a0;if(_0x49d93b[_0x325a('0x30')][_0x325a('0x40')]){_0x5cdfd1[_0x325a('0x41')]=[{'all':!![]}];}return db[_0x325a('0x2d')][_0x325a('0x42')](_0x5cdfd1);})[_0x325a('0x23')](function(_0x384e62){_0x3fa4f6[_0x325a('0x43')]=_0x384e62;return _0x3fa4f6;})[_0x325a('0x23')](respondWithFilteredResult(_0x44468d,_0x5cdfd1))['catch'](handleError(_0x44468d,null));};exports[_0x325a('0x44')]=function(_0x301f6c,_0x415825){var _0x128d53={'raw':!![],'where':{'id':_0x301f6c[_0x325a('0x45')]['id']}},_0x2750dd={};_0x2750dd['model']=_[_0x325a('0x31')](db[_0x325a('0x2d')][_0x325a('0x46')]);_0x2750dd[_0x325a('0x30')]=_[_0x325a('0x31')](_0x301f6c['query']);_0x2750dd[_0x325a('0x32')]=_[_0x325a('0x33')](_0x2750dd[_0x325a('0x34')],_0x2750dd['query']);_0x128d53[_0x325a('0x36')]=_[_0x325a('0x33')](_0x2750dd[_0x325a('0x34')],qs['fields'](_0x301f6c['query'][_0x325a('0x35')]));_0x128d53[_0x325a('0x36')]=_0x128d53[_0x325a('0x36')][_0x325a('0x37')]?_0x128d53['attributes']:_0x2750dd[_0x325a('0x34')];if(_0x301f6c[_0x325a('0x30')]['includeAll']){_0x128d53[_0x325a('0x41')]=[{'all':!![]}];}_0x128d53=_[_0x325a('0x3d')]({},_0x128d53,_0x301f6c['options']);return db[_0x325a('0x2d')][_0x325a('0x47')](_0x128d53)['then'](handleEntityNotFound(_0x415825,null))[_0x325a('0x23')](respondWithResult(_0x415825,null))['catch'](handleError(_0x415825,null));};exports['create']=function(_0x2fadf4,_0x26721a){return db[_0x325a('0x2d')]['create'](_0x2fadf4[_0x325a('0x48')],{})[_0x325a('0x23')](respondWithResult(_0x26721a,0xc9))['catch'](handleError(_0x26721a,null));};exports['update']=function(_0x1009dc,_0x2002c4){if(_0x1009dc['body']['id']){delete _0x1009dc[_0x325a('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x1009dc['params']['id']}})[_0x325a('0x23')](handleEntityNotFound(_0x2002c4,null))[_0x325a('0x23')](saveUpdates(_0x1009dc['body'],null))[_0x325a('0x23')](respondWithResult(_0x2002c4,null))[_0x325a('0x49')](handleError(_0x2002c4,null));};exports['destroy']=function(_0x37b66f,_0x2d00c4){return db[_0x325a('0x2d')][_0x325a('0x47')]({'where':{'id':_0x37b66f[_0x325a('0x45')]['id']}})[_0x325a('0x23')](handleEntityNotFound(_0x2d00c4,null))['then'](removeEntity(_0x2d00c4,null))[_0x325a('0x49')](handleError(_0x2d00c4,null));};exports[_0x325a('0x4a')]=function(_0x556c57,_0x189b23){return db['FaxQueueReport'][_0x325a('0x4a')]()[_0x325a('0x23')](respondWithResult(_0x189b23,null))[_0x325a('0x49')](handleError(_0x189b23,null));}; \ No newline at end of file +var _0xb458=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','FaxQueueReport','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x5db451,_0x410a5d){var _0x4f410d=function(_0x5abc83){while(--_0x5abc83){_0x5db451['push'](_0x5db451['shift']());}};_0x4f410d(++_0x410a5d);}(_0xb458,0xca));var _0x8b45=function(_0x55c71b,_0x399f51){_0x55c71b=_0x55c71b-0x0;var _0x14910c=_0xb458[_0x55c71b];return _0x14910c;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require(_0x8b45('0x3'));var rp=require('request-promise');var moment=require(_0x8b45('0x4'));var BPromise=require(_0x8b45('0x5'));var Mustache=require(_0x8b45('0x6'));var util=require(_0x8b45('0x7'));var path=require(_0x8b45('0x8'));var sox=require(_0x8b45('0x9'));var csv=require(_0x8b45('0xa'));var ejs=require(_0x8b45('0xb'));var fs=require('fs');var fs_extra=require(_0x8b45('0xc'));var _=require(_0x8b45('0xd'));var squel=require(_0x8b45('0xe'));var crypto=require(_0x8b45('0xf'));var jsforce=require(_0x8b45('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b45('0x11'));var authService=require(_0x8b45('0x12'));var qs=require(_0x8b45('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b45('0x14'));var logger=require('../../config/logger')(_0x8b45('0x15'));var utils=require(_0x8b45('0x16'));var config=require(_0x8b45('0x17'));var licenseUtil=require(_0x8b45('0x18'));var db=require(_0x8b45('0x19'))['db'];function respondWithStatusCode(_0x54c03c,_0x5559e7){_0x5559e7=_0x5559e7||0xcc;return function(_0x46a6c4){if(_0x46a6c4){return _0x54c03c[_0x8b45('0x1a')](_0x5559e7);}return _0x54c03c[_0x8b45('0x1b')](_0x5559e7)[_0x8b45('0x1c')]();};}function respondWithResult(_0x3b7c99,_0x1fdb2d){_0x1fdb2d=_0x1fdb2d||0xc8;return function(_0x1bd228){if(_0x1bd228){return _0x3b7c99[_0x8b45('0x1b')](_0x1fdb2d)[_0x8b45('0x1d')](_0x1bd228);}};}function respondWithFilteredResult(_0x83c355,_0x300dc9){return function(_0x153495){if(_0x153495){var _0x29180d=typeof _0x300dc9[_0x8b45('0x1e')]===_0x8b45('0x1f')&&typeof _0x300dc9['limit']==='undefined';var _0x777072=_0x153495[_0x8b45('0x20')];var _0xfb84af=_0x29180d?0x0:_0x300dc9[_0x8b45('0x1e')];var _0x39bffe=_0x29180d?_0x153495['count']:_0x300dc9[_0x8b45('0x1e')]+_0x300dc9['limit'];var _0x219c94;if(_0x39bffe>=_0x777072){_0x39bffe=_0x777072;_0x219c94=0xc8;}else{_0x219c94=0xce;}_0x83c355['status'](_0x219c94);return _0x83c355[_0x8b45('0x21')](_0x8b45('0x22'),_0xfb84af+'-'+_0x39bffe+'/'+_0x777072)[_0x8b45('0x1d')](_0x153495);}return null;};}function patchUpdates(_0x51fe21){return function(_0xc924dd){try{jsonpatch[_0x8b45('0x23')](_0xc924dd,_0x51fe21,!![]);}catch(_0x48f46a){return BPromise[_0x8b45('0x24')](_0x48f46a);}return _0xc924dd[_0x8b45('0x25')]();};}function saveUpdates(_0x2319c6,_0x4e57a9){return function(_0xc125c4){if(_0xc125c4){return _0xc125c4[_0x8b45('0x26')](_0x2319c6)[_0x8b45('0x27')](function(_0x557f5b){return _0x557f5b;});}return null;};}function removeEntity(_0x1dc7c2,_0x53205d){return function(_0x5cd08a){if(_0x5cd08a){return _0x5cd08a[_0x8b45('0x28')]()[_0x8b45('0x27')](function(){_0x1dc7c2[_0x8b45('0x1b')](0xcc)[_0x8b45('0x1c')]();});}};}function handleEntityNotFound(_0x40510c,_0x5ce26a){return function(_0x3dc3b8){if(!_0x3dc3b8){_0x40510c[_0x8b45('0x1a')](0x194);}return _0x3dc3b8;};}function handleError(_0x4acd00,_0x4b6465){_0x4b6465=_0x4b6465||0x1f4;return function(_0x5919e2){logger[_0x8b45('0x29')](_0x5919e2[_0x8b45('0x2a')]);if(_0x5919e2['name']){delete _0x5919e2['name'];}_0x4acd00['status'](_0x4b6465)['send'](_0x5919e2);};}exports['index']=function(_0x2b24f3,_0x53a363){var _0x28d540={},_0x275c07={},_0xde6b96={'count':0x0,'rows':[]};var _0x33dbb4=_['map'](db[_0x8b45('0x2b')]['rawAttributes'],function(_0x5b8f40){return{'name':_0x5b8f40[_0x8b45('0x2c')],'type':_0x5b8f40[_0x8b45('0x2d')][_0x8b45('0x2e')]};});_0x275c07[_0x8b45('0x2f')]=_[_0x8b45('0x30')](_0x33dbb4,_0x8b45('0x31'));_0x275c07[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x2b24f3[_0x8b45('0x32')]);_0x275c07[_0x8b45('0x34')]=_[_0x8b45('0x35')](_0x275c07[_0x8b45('0x2f')],_0x275c07[_0x8b45('0x32')]);_0x28d540[_0x8b45('0x36')]=_[_0x8b45('0x35')](_0x275c07[_0x8b45('0x2f')],qs['fields'](_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x37')]));_0x28d540['attributes']=_0x28d540[_0x8b45('0x36')][_0x8b45('0x38')]?_0x28d540[_0x8b45('0x36')]:_0x275c07['model'];if(!_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x39')]('nolimit')){_0x28d540[_0x8b45('0x3a')]=qs['limit'](_0x2b24f3[_0x8b45('0x32')]['limit']);_0x28d540['offset']=qs['offset'](_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x1e')]);}_0x28d540[_0x8b45('0x3b')]=qs[_0x8b45('0x3c')](_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x3c')]);_0x28d540['where']=qs[_0x8b45('0x34')](_[_0x8b45('0x3d')](_0x2b24f3['query'],_0x275c07['filters']),_0x33dbb4);if(_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x3e')]){_0x28d540[_0x8b45('0x3f')]=_[_0x8b45('0x40')](_0x28d540[_0x8b45('0x3f')],{'$or':_['map'](_0x33dbb4,function(_0x4e182e){if(_0x4e182e[_0x8b45('0x2d')]!=='VIRTUAL'){var _0x3abe4f={};_0x3abe4f[_0x4e182e[_0x8b45('0x31')]]={'$like':'%'+_0x2b24f3['query'][_0x8b45('0x3e')]+'%'};return _0x3abe4f;}})});}_0x28d540=_[_0x8b45('0x40')]({},_0x28d540,_0x2b24f3['options']);var _0x1df3b4={'where':_0x28d540['where']};return db[_0x8b45('0x2b')]['count'](_0x1df3b4)[_0x8b45('0x27')](function(_0x3952f6){_0xde6b96[_0x8b45('0x20')]=_0x3952f6;if(_0x2b24f3[_0x8b45('0x32')][_0x8b45('0x41')]){_0x28d540[_0x8b45('0x42')]=[{'all':!![]}];}return db[_0x8b45('0x2b')][_0x8b45('0x43')](_0x28d540);})[_0x8b45('0x27')](function(_0xebc105){_0xde6b96[_0x8b45('0x44')]=_0xebc105;return _0xde6b96;})[_0x8b45('0x27')](respondWithFilteredResult(_0x53a363,_0x28d540))[_0x8b45('0x45')](handleError(_0x53a363,null));};exports[_0x8b45('0x46')]=function(_0x587b00,_0x2464cc){var _0x44e81c={'raw':!![],'where':{'id':_0x587b00[_0x8b45('0x47')]['id']}},_0x330118={};_0x330118[_0x8b45('0x2f')]=_[_0x8b45('0x33')](db[_0x8b45('0x2b')][_0x8b45('0x48')]);_0x330118[_0x8b45('0x32')]=_[_0x8b45('0x33')](_0x587b00['query']);_0x330118[_0x8b45('0x34')]=_[_0x8b45('0x35')](_0x330118[_0x8b45('0x2f')],_0x330118[_0x8b45('0x32')]);_0x44e81c['attributes']=_[_0x8b45('0x35')](_0x330118[_0x8b45('0x2f')],qs[_0x8b45('0x37')](_0x587b00[_0x8b45('0x32')][_0x8b45('0x37')]));_0x44e81c[_0x8b45('0x36')]=_0x44e81c[_0x8b45('0x36')][_0x8b45('0x38')]?_0x44e81c['attributes']:_0x330118[_0x8b45('0x2f')];if(_0x587b00[_0x8b45('0x32')][_0x8b45('0x41')]){_0x44e81c[_0x8b45('0x42')]=[{'all':!![]}];}_0x44e81c=_[_0x8b45('0x40')]({},_0x44e81c,_0x587b00[_0x8b45('0x49')]);return db[_0x8b45('0x2b')][_0x8b45('0x4a')](_0x44e81c)['then'](handleEntityNotFound(_0x2464cc,null))[_0x8b45('0x27')](respondWithResult(_0x2464cc,null))[_0x8b45('0x45')](handleError(_0x2464cc,null));};exports[_0x8b45('0x4b')]=function(_0x1e2d89,_0x58d58b){return db['FaxQueueReport'][_0x8b45('0x4b')](_0x1e2d89[_0x8b45('0x4c')],{})[_0x8b45('0x27')](respondWithResult(_0x58d58b,0xc9))['catch'](handleError(_0x58d58b,null));};exports[_0x8b45('0x26')]=function(_0x4020ed,_0x3833e0){if(_0x4020ed[_0x8b45('0x4c')]['id']){delete _0x4020ed[_0x8b45('0x4c')]['id'];}return db[_0x8b45('0x2b')][_0x8b45('0x4a')]({'where':{'id':_0x4020ed['params']['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x3833e0,null))[_0x8b45('0x27')](saveUpdates(_0x4020ed[_0x8b45('0x4c')],null))[_0x8b45('0x27')](respondWithResult(_0x3833e0,null))[_0x8b45('0x45')](handleError(_0x3833e0,null));};exports[_0x8b45('0x28')]=function(_0xb7d73b,_0xbbe7e2){return db[_0x8b45('0x2b')][_0x8b45('0x4a')]({'where':{'id':_0xb7d73b[_0x8b45('0x47')]['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0xbbe7e2,null))[_0x8b45('0x27')](removeEntity(_0xbbe7e2,null))[_0x8b45('0x45')](handleError(_0xbbe7e2,null));};exports[_0x8b45('0x4d')]=function(_0x48275b,_0x3d5f7b){return db[_0x8b45('0x2b')][_0x8b45('0x4d')]()['then'](respondWithResult(_0x3d5f7b,null))[_0x8b45('0x45')](handleError(_0x3d5f7b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b2654f2..dc0b9be 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(_0x4642b2,_0x250088){var _0x1b6534=function(_0x4d8d78){while(--_0x4d8d78){_0x4642b2['push'](_0x4642b2['shift']());}};_0x1b6534(++_0x250088);}(_0x53ec,0x192));var _0xc53e=function(_0x21cd08,_0x16cd11){_0x21cd08=_0x21cd08-0x0;var _0x1d77ba=_0x53ec[_0x21cd08];return _0x1d77ba;};'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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x438261,_0x5bfa45){var _0x2f77ab=function(_0x4a8d2a){while(--_0x4a8d2a){_0x438261['push'](_0x438261['shift']());}};_0x2f77ab(++_0x5bfa45);}(_0x1261,0x144));var _0x1126=function(_0x22889a,_0x4b75f7){_0x22889a=_0x22889a-0x0;var _0x763d34=_0x1261[_0x22889a];return _0x763d34;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d86dd95..e6e601c 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 _0xae43=['request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','info','debug','UpdateFaxQueueReport','update','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1e7562,_0x8231dd){var _0x3360e4=function(_0x54765d){while(--_0x54765d){_0x1e7562['push'](_0x1e7562['shift']());}};_0x3360e4(++_0x8231dd);}(_0xae43,0x187));var _0x3ae4=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0xae43[_0x1e03a6];return _0x295b64;};'use strict';var _=require(_0x3ae4('0x0'));var util=require('util');var moment=require(_0x3ae4('0x1'));var BPromise=require(_0x3ae4('0x2'));var rs=require(_0x3ae4('0x3'));var fs=require('fs');var Redis=require(_0x3ae4('0x4'));var db=require(_0x3ae4('0x5'))['db'];var utils=require(_0x3ae4('0x6'));var logger=require(_0x3ae4('0x7'))(_0x3ae4('0x8'));var config=require(_0x3ae4('0x9'));var jayson=require(_0x3ae4('0xa'));var client=jayson[_0x3ae4('0xb')][_0x3ae4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c3ed0,_0x544831,_0x244f48){return new BPromise(function(_0xebf38c,_0x3fb83e){return client[_0x3ae4('0xd')](_0x4c3ed0,_0x244f48)['then'](function(_0x215577){logger['info'](_0x3ae4('0xe'),_0x544831,'request\x20sent');logger['debug'](_0x3ae4('0xf'),_0x544831,_0x3ae4('0x10'),JSON[_0x3ae4('0x11')](_0x215577));if(_0x215577[_0x3ae4('0x12')]){if(_0x215577[_0x3ae4('0x12')][_0x3ae4('0x13')]===0x1f4){logger[_0x3ae4('0x12')](_0x3ae4('0xe'),_0x544831,_0x215577[_0x3ae4('0x12')][_0x3ae4('0x14')]);return _0x3fb83e(_0x215577[_0x3ae4('0x12')]['message']);}logger[_0x3ae4('0x12')](_0x3ae4('0xe'),_0x544831,_0x215577[_0x3ae4('0x12')][_0x3ae4('0x14')]);return _0xebf38c(_0x215577[_0x3ae4('0x12')][_0x3ae4('0x14')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x544831,_0x3ae4('0x10'));_0xebf38c(_0x215577[_0x3ae4('0x15')][_0x3ae4('0x14')]);}})[_0x3ae4('0x16')](function(_0x260019){logger[_0x3ae4('0x12')](_0x3ae4('0xe'),_0x544831,_0x260019);_0x3fb83e(_0x260019);});});}exports[_0x3ae4('0x17')]=function(_0x479e7d){var _0x3efca2=this;return new Promise(function(_0x38d540,_0x3dd500){return db[_0x3ae4('0x18')][_0x3ae4('0x19')](_0x479e7d[_0x3ae4('0x1a')],{'raw':_0x479e7d[_0x3ae4('0x1b')]?_0x479e7d[_0x3ae4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x154e69){logger[_0x3ae4('0x1c')](_0x3ae4('0x17'),_0x479e7d);logger[_0x3ae4('0x1d')](_0x3ae4('0x17'),_0x479e7d,JSON['stringify'](_0x154e69));_0x38d540(_0x154e69);})[_0x3ae4('0x16')](function(_0x3fb7b5){logger[_0x3ae4('0x12')]('CreateFaxQueueReport',_0x3fb7b5['message'],_0x479e7d);_0x3dd500(_0x3efca2[_0x3ae4('0x12')](0x1f4,_0x3fb7b5[_0x3ae4('0x14')]));});});};exports[_0x3ae4('0x1e')]=function(_0x3edae7){var _0x28d8e6=this;return new Promise(function(_0x3de62d,_0x1fc7ca){return db['FaxQueueReport'][_0x3ae4('0x1f')](_0x3edae7[_0x3ae4('0x1a')],{'raw':_0x3edae7[_0x3ae4('0x1b')]?_0x3edae7['options'][_0x3ae4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3edae7['options']?_0x3edae7[_0x3ae4('0x1b')][_0x3ae4('0x21')]||null:null,'attributes':_0x3edae7[_0x3ae4('0x1b')]?_0x3edae7[_0x3ae4('0x1b')][_0x3ae4('0x22')]||null:null,'limit':_0x3edae7['options']?_0x3edae7[_0x3ae4('0x1b')][_0x3ae4('0x23')]||null:null})[_0x3ae4('0x24')](function(_0x312842){logger[_0x3ae4('0x1c')](_0x3ae4('0x1e'),_0x3edae7);logger[_0x3ae4('0x1d')](_0x3ae4('0x1e'),_0x3edae7,JSON['stringify'](_0x312842));_0x3de62d(_0x312842);})[_0x3ae4('0x16')](function(_0x8390f){logger[_0x3ae4('0x12')]('UpdateFaxQueueReport',_0x8390f[_0x3ae4('0x14')],_0x3edae7);_0x1fc7ca(_0x28d8e6[_0x3ae4('0x12')](0x1f4,_0x8390f[_0x3ae4('0x14')]));});});}; \ No newline at end of file +var _0xc495=['error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','where','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x116cc8,_0x23b22e){var _0x603ac2=function(_0x3b4045){while(--_0x3b4045){_0x116cc8['push'](_0x116cc8['shift']());}};_0x603ac2(++_0x23b22e);}(_0xc495,0x72));var _0x5c49=function(_0x465bba,_0x1e476f){_0x465bba=_0x465bba-0x0;var _0x2acb77=_0xc495[_0x465bba];return _0x2acb77;};'use strict';var _=require(_0x5c49('0x0'));var util=require(_0x5c49('0x1'));var moment=require(_0x5c49('0x2'));var BPromise=require(_0x5c49('0x3'));var rs=require(_0x5c49('0x4'));var fs=require('fs');var Redis=require(_0x5c49('0x5'));var db=require(_0x5c49('0x6'))['db'];var utils=require(_0x5c49('0x7'));var logger=require(_0x5c49('0x8'))(_0x5c49('0x9'));var config=require(_0x5c49('0xa'));var jayson=require(_0x5c49('0xb'));var client=jayson[_0x5c49('0xc')][_0x5c49('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x472bfa,_0x414303,_0x3ecb45){return new BPromise(function(_0x394ac8,_0x26eddb){return client[_0x5c49('0xe')](_0x472bfa,_0x3ecb45)[_0x5c49('0xf')](function(_0x5a4d06){logger[_0x5c49('0x10')](_0x5c49('0x11'),_0x414303,_0x5c49('0x12'));logger[_0x5c49('0x13')](_0x5c49('0x14'),_0x414303,_0x5c49('0x12'),JSON[_0x5c49('0x15')](_0x5a4d06));if(_0x5a4d06[_0x5c49('0x16')]){if(_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x17')]===0x1f4){logger['error'](_0x5c49('0x11'),_0x414303,_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);return _0x26eddb(_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);}logger['error'](_0x5c49('0x11'),_0x414303,_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);return _0x394ac8(_0x5a4d06[_0x5c49('0x16')][_0x5c49('0x18')]);}else{logger[_0x5c49('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x414303,'request\x20sent');_0x394ac8(_0x5a4d06['result'][_0x5c49('0x18')]);}})[_0x5c49('0x19')](function(_0x32703c){logger[_0x5c49('0x16')](_0x5c49('0x11'),_0x414303,_0x32703c);_0x26eddb(_0x32703c);});});}exports[_0x5c49('0x1a')]=function(_0x187874){var _0x3c6c2d=this;return new Promise(function(_0x3176d7,_0x2dd0ab){return db[_0x5c49('0x1b')][_0x5c49('0x1c')](_0x187874['body'],{'raw':_0x187874[_0x5c49('0x1d')]?_0x187874[_0x5c49('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5c49('0xf')](function(_0x10de2c){logger[_0x5c49('0x10')](_0x5c49('0x1a'),_0x187874);logger[_0x5c49('0x13')]('CreateFaxQueueReport',_0x187874,JSON['stringify'](_0x10de2c));_0x3176d7(_0x10de2c);})[_0x5c49('0x19')](function(_0x56602b){logger['error'](_0x5c49('0x1a'),_0x56602b[_0x5c49('0x18')],_0x187874);_0x2dd0ab(_0x3c6c2d[_0x5c49('0x16')](0x1f4,_0x56602b[_0x5c49('0x18')]));});});};exports['UpdateFaxQueueReport']=function(_0xb73429){var _0x5a0a47=this;return new Promise(function(_0x1a8de5,_0xd7f634){return db[_0x5c49('0x1b')]['update'](_0xb73429['body'],{'raw':_0xb73429['options']?_0xb73429['options'][_0x5c49('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb73429['options']?_0xb73429['options'][_0x5c49('0x1f')]||null:null,'attributes':_0xb73429[_0x5c49('0x1d')]?_0xb73429[_0x5c49('0x1d')][_0x5c49('0x20')]||null:null,'limit':_0xb73429[_0x5c49('0x1d')]?_0xb73429[_0x5c49('0x1d')]['limit']||null:null})[_0x5c49('0xf')](function(_0x169a2e){logger[_0x5c49('0x10')](_0x5c49('0x21'),_0xb73429);logger['debug'](_0x5c49('0x21'),_0xb73429,JSON[_0x5c49('0x15')](_0x169a2e));_0x1a8de5(_0x169a2e);})[_0x5c49('0x19')](function(_0x305fef){logger[_0x5c49('0x16')](_0x5c49('0x21'),_0x305fef['message'],_0xb73429);_0xd7f634(_0x5a0a47[_0x5c49('0x16')](0x1f4,_0x305fef[_0x5c49('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index aaab487..8971231 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 _0x9655=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports'];(function(_0x30caa9,_0x388748){var _0x49206f=function(_0x27c2f7){while(--_0x27c2f7){_0x30caa9['push'](_0x30caa9['shift']());}};_0x49206f(++_0x388748);}(_0x9655,0x64));var _0x5965=function(_0x4ce147,_0x542f09){_0x4ce147=_0x4ce147-0x0;var _0x5918a6=_0x9655[_0x4ce147];return _0x5918a6;};'use strict';var multer=require(_0x5965('0x0'));var util=require(_0x5965('0x1'));var path=require(_0x5965('0x2'));var timeout=require(_0x5965('0x3'));var express=require(_0x5965('0x4'));var router=express[_0x5965('0x5')]();var fs_extra=require(_0x5965('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5965('0x7'));var config=require(_0x5965('0x8'));var controller=require(_0x5965('0x9'));router['get']('/',auth[_0x5965('0xa')](),controller['index']);router['get'](_0x5965('0xb'),auth['isAuthenticated'](),controller[_0x5965('0xc')]);router['get'](_0x5965('0xd'),auth['isAuthenticated'](),controller[_0x5965('0xe')]);router[_0x5965('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5965('0xd'),auth['isAuthenticated'](),controller[_0x5965('0x10')]);router[_0x5965('0x11')](_0x5965('0xd'),auth[_0x5965('0xa')](),controller[_0x5965('0x12')]);module[_0x5965('0x13')]=router; \ No newline at end of file +var _0x56bc=['fs-extra','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x54433f,_0x122689){var _0x4d024e=function(_0x5ef3bb){while(--_0x5ef3bb){_0x54433f['push'](_0x54433f['shift']());}};_0x4d024e(++_0x122689);}(_0x56bc,0x19d));var _0xc56b=function(_0xe13b37,_0x1e40a8){_0xe13b37=_0xe13b37-0x0;var _0x333e53=_0x56bc[_0xe13b37];return _0x333e53;};'use strict';var multer=require(_0xc56b('0x0'));var util=require('util');var path=require(_0xc56b('0x1'));var timeout=require(_0xc56b('0x2'));var express=require(_0xc56b('0x3'));var router=express[_0xc56b('0x4')]();var fs_extra=require(_0xc56b('0x5'));var auth=require(_0xc56b('0x6'));var interaction=require(_0xc56b('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc56b('0x8')]);router['get'](_0xc56b('0x9'),auth[_0xc56b('0xa')](),controller[_0xc56b('0xb')]);router[_0xc56b('0xc')](_0xc56b('0xd'),auth[_0xc56b('0xa')](),controller[_0xc56b('0xe')]);router[_0xc56b('0xf')]('/',auth[_0xc56b('0xa')](),controller[_0xc56b('0x10')]);router[_0xc56b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc56b('0x12')]);router[_0xc56b('0x13')](_0xc56b('0xd'),auth[_0xc56b('0xa')](),controller[_0xc56b('0x14')]);module[_0xc56b('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index facba8d..baa1bee 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x444efa,_0x4e6bca){var _0x553090=function(_0x32aeb7){while(--_0x32aeb7){_0x444efa['push'](_0x444efa['shift']());}};_0x553090(++_0x4e6bca);}(_0xedd9,0xfc));var _0x9edd=function(_0x56734f,_0x28c3cf){_0x56734f=_0x56734f-0x0;var _0x34b752=_0xedd9[_0x56734f];return _0x34b752;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4ec080,_0x3d0d1b){var _0x2eb279=function(_0x549a6b){while(--_0x549a6b){_0x4ec080['push'](_0x4ec080['shift']());}};_0x2eb279(++_0x3d0d1b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0xf3cd[_0x51ed62];return _0x34aee3;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4e6076b..66fe6c3 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 _0x6703=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','filter','where','merge','options','includeAll','include','FaxTransferReport','findAll','rows','catch','show','params','find'];(function(_0x337f40,_0xe3e209){var _0x55a3cf=function(_0xc7fe4c){while(--_0xc7fe4c){_0x337f40['push'](_0x337f40['shift']());}};_0x55a3cf(++_0xe3e209);}(_0x6703,0x17a));var _0x3670=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0x6703[_0x22ee0f];return _0x204696;};'use strict';var emlformat=require(_0x3670('0x0'));var rimraf=require(_0x3670('0x1'));var zipdir=require(_0x3670('0x2'));var jsonpatch=require(_0x3670('0x3'));var rp=require('request-promise');var moment=require(_0x3670('0x4'));var BPromise=require(_0x3670('0x5'));var Mustache=require(_0x3670('0x6'));var util=require(_0x3670('0x7'));var path=require(_0x3670('0x8'));var sox=require('sox');var csv=require(_0x3670('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3670('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3670('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3670('0xc'));var toCsv=require(_0x3670('0x9'));var querystring=require(_0x3670('0xd'));var Papa=require(_0x3670('0xe'));var Redis=require(_0x3670('0xf'));var authService=require(_0x3670('0x10'));var qs=require(_0x3670('0x11'));var as=require(_0x3670('0x12'));var hardwareService=require(_0x3670('0x13'));var logger=require(_0x3670('0x14'))('api');var utils=require(_0x3670('0x15'));var config=require(_0x3670('0x16'));var licenseUtil=require(_0x3670('0x17'));var db=require(_0x3670('0x18'))['db'];function respondWithStatusCode(_0xec1e8d,_0x210f21){_0x210f21=_0x210f21||0xcc;return function(_0x237682){if(_0x237682){return _0xec1e8d[_0x3670('0x19')](_0x210f21);}return _0xec1e8d[_0x3670('0x1a')](_0x210f21)['end']();};}function respondWithResult(_0xb7ff63,_0x10715e){_0x10715e=_0x10715e||0xc8;return function(_0x36a33a){if(_0x36a33a){return _0xb7ff63['status'](_0x10715e)[_0x3670('0x1b')](_0x36a33a);}};}function respondWithFilteredResult(_0x1f4c6e,_0x4cadfa){return function(_0x47b4a7){if(_0x47b4a7){var _0x31431c=typeof _0x4cadfa['offset']===_0x3670('0x1c')&&typeof _0x4cadfa[_0x3670('0x1d')]==='undefined';var _0x278a41=_0x47b4a7['count'];var _0x315bf3=_0x31431c?0x0:_0x4cadfa[_0x3670('0x1e')];var _0x1eff1b=_0x31431c?_0x47b4a7[_0x3670('0x1f')]:_0x4cadfa[_0x3670('0x1e')]+_0x4cadfa['limit'];var _0x172468;if(_0x1eff1b>=_0x278a41){_0x1eff1b=_0x278a41;_0x172468=0xc8;}else{_0x172468=0xce;}_0x1f4c6e[_0x3670('0x1a')](_0x172468);return _0x1f4c6e[_0x3670('0x20')](_0x3670('0x21'),_0x315bf3+'-'+_0x1eff1b+'/'+_0x278a41)[_0x3670('0x1b')](_0x47b4a7);}return null;};}function patchUpdates(_0x4b3c25){return function(_0x329ed6){try{jsonpatch[_0x3670('0x22')](_0x329ed6,_0x4b3c25,!![]);}catch(_0x6718f1){return BPromise[_0x3670('0x23')](_0x6718f1);}return _0x329ed6[_0x3670('0x24')]();};}function saveUpdates(_0x5ae2ba,_0x193b03){return function(_0x3c83b0){if(_0x3c83b0){return _0x3c83b0[_0x3670('0x25')](_0x5ae2ba)['then'](function(_0x139a11){return _0x139a11;});}return null;};}function removeEntity(_0x2c0940,_0x3ff61e){return function(_0x157c35){if(_0x157c35){return _0x157c35[_0x3670('0x26')]()[_0x3670('0x27')](function(){_0x2c0940[_0x3670('0x1a')](0xcc)[_0x3670('0x28')]();});}};}function handleEntityNotFound(_0x552b4d,_0x154e67){return function(_0x2fc175){if(!_0x2fc175){_0x552b4d[_0x3670('0x19')](0x194);}return _0x2fc175;};}function handleError(_0x4ed192,_0x3f203c){_0x3f203c=_0x3f203c||0x1f4;return function(_0xe378ec){logger[_0x3670('0x29')](_0xe378ec[_0x3670('0x2a')]);if(_0xe378ec[_0x3670('0x2b')]){delete _0xe378ec[_0x3670('0x2b')];}_0x4ed192[_0x3670('0x1a')](_0x3f203c)['send'](_0xe378ec);};}exports[_0x3670('0x2c')]=function(_0x219507,_0x2aa2c5){var _0x163677={},_0x559b8b={},_0x12e8fb={'count':0x0,'rows':[]};var _0x28515a=_[_0x3670('0x2d')](db['FaxTransferReport'][_0x3670('0x2e')],function(_0x2da2c9){return{'name':_0x2da2c9[_0x3670('0x2f')],'type':_0x2da2c9['type'][_0x3670('0x30')]};});_0x559b8b[_0x3670('0x31')]=_['map'](_0x28515a,_0x3670('0x2b'));_0x559b8b[_0x3670('0x32')]=_[_0x3670('0x33')](_0x219507['query']);_0x559b8b[_0x3670('0x34')]=_[_0x3670('0x35')](_0x559b8b[_0x3670('0x31')],_0x559b8b['query']);_0x163677[_0x3670('0x36')]=_[_0x3670('0x35')](_0x559b8b['model'],qs[_0x3670('0x37')](_0x219507[_0x3670('0x32')][_0x3670('0x37')]));_0x163677[_0x3670('0x36')]=_0x163677['attributes'][_0x3670('0x38')]?_0x163677[_0x3670('0x36')]:_0x559b8b[_0x3670('0x31')];if(!_0x219507['query'][_0x3670('0x39')](_0x3670('0x3a'))){_0x163677['limit']=qs['limit'](_0x219507[_0x3670('0x32')][_0x3670('0x1d')]);_0x163677['offset']=qs[_0x3670('0x1e')](_0x219507[_0x3670('0x32')]['offset']);}_0x163677['order']=qs['sort'](_0x219507[_0x3670('0x32')]['sort']);_0x163677['where']=qs['filters'](_['pick'](_0x219507[_0x3670('0x32')],_0x559b8b[_0x3670('0x34')]),_0x28515a);if(_0x219507[_0x3670('0x32')][_0x3670('0x3b')]){_0x163677[_0x3670('0x3c')]=_[_0x3670('0x3d')](_0x163677['where'],{'$or':_['map'](_0x28515a,function(_0xbb23b6){if(_0xbb23b6['type']!=='VIRTUAL'){var _0x22a580={};_0x22a580[_0xbb23b6[_0x3670('0x2b')]]={'$like':'%'+_0x219507[_0x3670('0x32')][_0x3670('0x3b')]+'%'};return _0x22a580;}})});}_0x163677=_[_0x3670('0x3d')]({},_0x163677,_0x219507[_0x3670('0x3e')]);var _0x4891b1={'where':_0x163677['where']};return db['FaxTransferReport']['count'](_0x4891b1)[_0x3670('0x27')](function(_0x2c201c){_0x12e8fb['count']=_0x2c201c;if(_0x219507[_0x3670('0x32')][_0x3670('0x3f')]){_0x163677[_0x3670('0x40')]=[{'all':!![]}];}return db[_0x3670('0x41')][_0x3670('0x42')](_0x163677);})[_0x3670('0x27')](function(_0x5dc5fa){_0x12e8fb[_0x3670('0x43')]=_0x5dc5fa;return _0x12e8fb;})[_0x3670('0x27')](respondWithFilteredResult(_0x2aa2c5,_0x163677))[_0x3670('0x44')](handleError(_0x2aa2c5,null));};exports[_0x3670('0x45')]=function(_0x223561,_0x37d640){var _0x173a4c={'raw':!![],'where':{'id':_0x223561[_0x3670('0x46')]['id']}},_0x3f8d71={};_0x3f8d71[_0x3670('0x31')]=_['keys'](db[_0x3670('0x41')][_0x3670('0x2e')]);_0x3f8d71[_0x3670('0x32')]=_[_0x3670('0x33')](_0x223561[_0x3670('0x32')]);_0x3f8d71[_0x3670('0x34')]=_['intersection'](_0x3f8d71[_0x3670('0x31')],_0x3f8d71[_0x3670('0x32')]);_0x173a4c[_0x3670('0x36')]=_[_0x3670('0x35')](_0x3f8d71[_0x3670('0x31')],qs[_0x3670('0x37')](_0x223561[_0x3670('0x32')]['fields']));_0x173a4c[_0x3670('0x36')]=_0x173a4c['attributes'][_0x3670('0x38')]?_0x173a4c[_0x3670('0x36')]:_0x3f8d71[_0x3670('0x31')];if(_0x223561[_0x3670('0x32')][_0x3670('0x3f')]){_0x173a4c[_0x3670('0x40')]=[{'all':!![]}];}_0x173a4c=_[_0x3670('0x3d')]({},_0x173a4c,_0x223561['options']);return db[_0x3670('0x41')][_0x3670('0x47')](_0x173a4c)[_0x3670('0x27')](handleEntityNotFound(_0x37d640,null))[_0x3670('0x27')](respondWithResult(_0x37d640,null))[_0x3670('0x44')](handleError(_0x37d640,null));};exports[_0x3670('0x48')]=function(_0x41f80a,_0x243829){return db['FaxTransferReport'][_0x3670('0x48')](_0x41f80a[_0x3670('0x49')],{})['then'](respondWithResult(_0x243829,0xc9))[_0x3670('0x44')](handleError(_0x243829,null));};exports[_0x3670('0x25')]=function(_0xd00733,_0x1691d0){if(_0xd00733['body']['id']){delete _0xd00733[_0x3670('0x49')]['id'];}return db[_0x3670('0x41')]['find']({'where':{'id':_0xd00733[_0x3670('0x46')]['id']}})[_0x3670('0x27')](handleEntityNotFound(_0x1691d0,null))[_0x3670('0x27')](saveUpdates(_0xd00733[_0x3670('0x49')],null))[_0x3670('0x27')](respondWithResult(_0x1691d0,null))['catch'](handleError(_0x1691d0,null));};exports[_0x3670('0x26')]=function(_0x14e195,_0x2c08eb){return db[_0x3670('0x41')][_0x3670('0x47')]({'where':{'id':_0x14e195[_0x3670('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c08eb,null))[_0x3670('0x27')](removeEntity(_0x2c08eb,null))[_0x3670('0x44')](handleError(_0x2c08eb,null));};exports[_0x3670('0x4a')]=function(_0x45abcf,_0x515f82){return db[_0x3670('0x41')]['describe']()['then'](respondWithResult(_0x515f82,null))['catch'](handleError(_0x515f82,null));}; \ No newline at end of file +var _0x3d89=['count','Content-Range','apply','reject','update','then','error','name','send','FaxTransferReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit'];(function(_0x1f12ad,_0x1d0e2a){var _0x533d97=function(_0x54ffaf){while(--_0x54ffaf){_0x1f12ad['push'](_0x1f12ad['shift']());}};_0x533d97(++_0x1d0e2a);}(_0x3d89,0x157));var _0x93d8=function(_0x5d0dd2,_0x3c786d){_0x5d0dd2=_0x5d0dd2-0x0;var _0x369026=_0x3d89[_0x5d0dd2];return _0x369026;};'use strict';var emlformat=require(_0x93d8('0x0'));var rimraf=require(_0x93d8('0x1'));var zipdir=require(_0x93d8('0x2'));var jsonpatch=require(_0x93d8('0x3'));var rp=require(_0x93d8('0x4'));var moment=require(_0x93d8('0x5'));var BPromise=require(_0x93d8('0x6'));var Mustache=require(_0x93d8('0x7'));var util=require(_0x93d8('0x8'));var path=require(_0x93d8('0x9'));var sox=require(_0x93d8('0xa'));var csv=require(_0x93d8('0xb'));var ejs=require(_0x93d8('0xc'));var fs=require('fs');var fs_extra=require(_0x93d8('0xd'));var _=require(_0x93d8('0xe'));var squel=require(_0x93d8('0xf'));var crypto=require('crypto');var jsforce=require(_0x93d8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x93d8('0x11'));var Redis=require(_0x93d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x93d8('0x13'));var as=require(_0x93d8('0x14'));var hardwareService=require(_0x93d8('0x15'));var logger=require(_0x93d8('0x16'))(_0x93d8('0x17'));var utils=require(_0x93d8('0x18'));var config=require(_0x93d8('0x19'));var licenseUtil=require(_0x93d8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d70df,_0x3475aa){_0x3475aa=_0x3475aa||0xcc;return function(_0x289aa0){if(_0x289aa0){return _0x7d70df['sendStatus'](_0x3475aa);}return _0x7d70df[_0x93d8('0x1b')](_0x3475aa)[_0x93d8('0x1c')]();};}function respondWithResult(_0x2cef08,_0x590e15){_0x590e15=_0x590e15||0xc8;return function(_0x1df4d7){if(_0x1df4d7){return _0x2cef08['status'](_0x590e15)[_0x93d8('0x1d')](_0x1df4d7);}};}function respondWithFilteredResult(_0x40f5b1,_0x33faf1){return function(_0x36ed94){if(_0x36ed94){var _0x17ac3a=typeof _0x33faf1['offset']===_0x93d8('0x1e')&&typeof _0x33faf1[_0x93d8('0x1f')]===_0x93d8('0x1e');var _0x58ced7=_0x36ed94[_0x93d8('0x20')];var _0x3bfc18=_0x17ac3a?0x0:_0x33faf1['offset'];var _0x655226=_0x17ac3a?_0x36ed94[_0x93d8('0x20')]:_0x33faf1['offset']+_0x33faf1[_0x93d8('0x1f')];var _0x3ce362;if(_0x655226>=_0x58ced7){_0x655226=_0x58ced7;_0x3ce362=0xc8;}else{_0x3ce362=0xce;}_0x40f5b1['status'](_0x3ce362);return _0x40f5b1['set'](_0x93d8('0x21'),_0x3bfc18+'-'+_0x655226+'/'+_0x58ced7)[_0x93d8('0x1d')](_0x36ed94);}return null;};}function patchUpdates(_0x1927ba){return function(_0x55d337){try{jsonpatch[_0x93d8('0x22')](_0x55d337,_0x1927ba,!![]);}catch(_0x201e22){return BPromise[_0x93d8('0x23')](_0x201e22);}return _0x55d337['save']();};}function saveUpdates(_0x225d15,_0x5114ba){return function(_0x526309){if(_0x526309){return _0x526309[_0x93d8('0x24')](_0x225d15)[_0x93d8('0x25')](function(_0x396ded){return _0x396ded;});}return null;};}function removeEntity(_0x4ecc68,_0x74c113){return function(_0x47b9dd){if(_0x47b9dd){return _0x47b9dd['destroy']()['then'](function(){_0x4ecc68[_0x93d8('0x1b')](0xcc)[_0x93d8('0x1c')]();});}};}function handleEntityNotFound(_0xe0d371,_0x18e57a){return function(_0x2b0b2c){if(!_0x2b0b2c){_0xe0d371['sendStatus'](0x194);}return _0x2b0b2c;};}function handleError(_0x348188,_0x10310b){_0x10310b=_0x10310b||0x1f4;return function(_0x45769c){logger[_0x93d8('0x26')](_0x45769c['stack']);if(_0x45769c['name']){delete _0x45769c[_0x93d8('0x27')];}_0x348188[_0x93d8('0x1b')](_0x10310b)[_0x93d8('0x28')](_0x45769c);};}exports['index']=function(_0x3cb095,_0xe37e8c){var _0x3e1b33={},_0x3df3aa={},_0x5286ae={'count':0x0,'rows':[]};var _0x9f2bc=_['map'](db[_0x93d8('0x29')][_0x93d8('0x2a')],function(_0x3167df){return{'name':_0x3167df['fieldName'],'type':_0x3167df[_0x93d8('0x2b')][_0x93d8('0x2c')]};});_0x3df3aa['model']=_['map'](_0x9f2bc,_0x93d8('0x27'));_0x3df3aa['query']=_[_0x93d8('0x2d')](_0x3cb095[_0x93d8('0x2e')]);_0x3df3aa[_0x93d8('0x2f')]=_[_0x93d8('0x30')](_0x3df3aa['model'],_0x3df3aa[_0x93d8('0x2e')]);_0x3e1b33[_0x93d8('0x31')]=_[_0x93d8('0x30')](_0x3df3aa[_0x93d8('0x32')],qs['fields'](_0x3cb095['query'][_0x93d8('0x33')]));_0x3e1b33[_0x93d8('0x31')]=_0x3e1b33[_0x93d8('0x31')][_0x93d8('0x34')]?_0x3e1b33['attributes']:_0x3df3aa[_0x93d8('0x32')];if(!_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x35')](_0x93d8('0x36'))){_0x3e1b33[_0x93d8('0x1f')]=qs['limit'](_0x3cb095['query']['limit']);_0x3e1b33['offset']=qs['offset'](_0x3cb095[_0x93d8('0x2e')]['offset']);}_0x3e1b33[_0x93d8('0x37')]=qs['sort'](_0x3cb095['query']['sort']);_0x3e1b33[_0x93d8('0x38')]=qs[_0x93d8('0x2f')](_[_0x93d8('0x39')](_0x3cb095[_0x93d8('0x2e')],_0x3df3aa['filters']),_0x9f2bc);if(_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x3a')]){_0x3e1b33[_0x93d8('0x38')]=_[_0x93d8('0x3b')](_0x3e1b33[_0x93d8('0x38')],{'$or':_[_0x93d8('0x3c')](_0x9f2bc,function(_0x44f2bc){if(_0x44f2bc['type']!==_0x93d8('0x3d')){var _0x11c159={};_0x11c159[_0x44f2bc[_0x93d8('0x27')]]={'$like':'%'+_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x3a')]+'%'};return _0x11c159;}})});}_0x3e1b33=_[_0x93d8('0x3b')]({},_0x3e1b33,_0x3cb095[_0x93d8('0x3e')]);var _0xccfaa8={'where':_0x3e1b33['where']};return db['FaxTransferReport'][_0x93d8('0x20')](_0xccfaa8)[_0x93d8('0x25')](function(_0x53e7b4){_0x5286ae[_0x93d8('0x20')]=_0x53e7b4;if(_0x3cb095[_0x93d8('0x2e')][_0x93d8('0x3f')]){_0x3e1b33['include']=[{'all':!![]}];}return db[_0x93d8('0x29')][_0x93d8('0x40')](_0x3e1b33);})[_0x93d8('0x25')](function(_0xec1fe5){_0x5286ae[_0x93d8('0x41')]=_0xec1fe5;return _0x5286ae;})[_0x93d8('0x25')](respondWithFilteredResult(_0xe37e8c,_0x3e1b33))[_0x93d8('0x42')](handleError(_0xe37e8c,null));};exports[_0x93d8('0x43')]=function(_0x3e4158,_0x5a8340){var _0xf732af={'raw':!![],'where':{'id':_0x3e4158[_0x93d8('0x44')]['id']}},_0xa48b6f={};_0xa48b6f[_0x93d8('0x32')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0xa48b6f[_0x93d8('0x2e')]=_[_0x93d8('0x2d')](_0x3e4158['query']);_0xa48b6f['filters']=_['intersection'](_0xa48b6f[_0x93d8('0x32')],_0xa48b6f[_0x93d8('0x2e')]);_0xf732af[_0x93d8('0x31')]=_[_0x93d8('0x30')](_0xa48b6f[_0x93d8('0x32')],qs[_0x93d8('0x33')](_0x3e4158[_0x93d8('0x2e')][_0x93d8('0x33')]));_0xf732af[_0x93d8('0x31')]=_0xf732af[_0x93d8('0x31')][_0x93d8('0x34')]?_0xf732af[_0x93d8('0x31')]:_0xa48b6f[_0x93d8('0x32')];if(_0x3e4158[_0x93d8('0x2e')][_0x93d8('0x3f')]){_0xf732af[_0x93d8('0x45')]=[{'all':!![]}];}_0xf732af=_[_0x93d8('0x3b')]({},_0xf732af,_0x3e4158[_0x93d8('0x3e')]);return db[_0x93d8('0x29')][_0x93d8('0x46')](_0xf732af)[_0x93d8('0x25')](handleEntityNotFound(_0x5a8340,null))[_0x93d8('0x25')](respondWithResult(_0x5a8340,null))[_0x93d8('0x42')](handleError(_0x5a8340,null));};exports[_0x93d8('0x47')]=function(_0xa55174,_0x4999cf){return db[_0x93d8('0x29')][_0x93d8('0x47')](_0xa55174['body'],{})[_0x93d8('0x25')](respondWithResult(_0x4999cf,0xc9))['catch'](handleError(_0x4999cf,null));};exports[_0x93d8('0x24')]=function(_0x34fcee,_0x759416){if(_0x34fcee['body']['id']){delete _0x34fcee[_0x93d8('0x48')]['id'];}return db[_0x93d8('0x29')][_0x93d8('0x46')]({'where':{'id':_0x34fcee['params']['id']}})[_0x93d8('0x25')](handleEntityNotFound(_0x759416,null))[_0x93d8('0x25')](saveUpdates(_0x34fcee[_0x93d8('0x48')],null))[_0x93d8('0x25')](respondWithResult(_0x759416,null))[_0x93d8('0x42')](handleError(_0x759416,null));};exports[_0x93d8('0x49')]=function(_0x523117,_0x20c8c2){return db[_0x93d8('0x29')]['find']({'where':{'id':_0x523117['params']['id']}})[_0x93d8('0x25')](handleEntityNotFound(_0x20c8c2,null))['then'](removeEntity(_0x20c8c2,null))['catch'](handleError(_0x20c8c2,null));};exports[_0x93d8('0x4a')]=function(_0x25f045,_0x1036cc){return db[_0x93d8('0x29')]['describe']()['then'](respondWithResult(_0x1036cc,null))['catch'](handleError(_0x1036cc,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2c97370..1b8284e 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 _0x7e12=['path','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment','request-promise'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x7e12,0x17c));var _0x27e1=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7e12[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x27e1('0x0'));var util=require(_0x27e1('0x1'));var logger=require('../../config/logger')(_0x27e1('0x2'));var moment=require(_0x27e1('0x3'));var BPromise=require('bluebird');var rp=require(_0x27e1('0x4'));var fs=require('fs');var path=require(_0x27e1('0x5'));var rimraf=require('rimraf');var config=require(_0x27e1('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x30e084,_0x41b95a){return _0x30e084[_0x27e1('0x7')](_0x27e1('0x8'),attributes,{'tableName':_0x27e1('0x9'),'paranoid':![],'indexes':[{'name':_0x27e1('0xa'),'fields':[_0x27e1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b8f=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45fc92,_0x28871a){var _0x572b13=function(_0x5e24b5){while(--_0x5e24b5){_0x45fc92['push'](_0x45fc92['shift']());}};_0x572b13(++_0x28871a);}(_0x7b8f,0x1cb));var _0xf7b8=function(_0x5e67f6,_0x44ef4b){_0x5e67f6=_0x5e67f6-0x0;var _0x48011e=_0x7b8f[_0x5e67f6];return _0x48011e;};'use strict';var _=require(_0xf7b8('0x0'));var util=require(_0xf7b8('0x1'));var logger=require(_0xf7b8('0x2'))(_0xf7b8('0x3'));var moment=require(_0xf7b8('0x4'));var BPromise=require(_0xf7b8('0x5'));var rp=require(_0xf7b8('0x6'));var fs=require('fs');var path=require(_0xf7b8('0x7'));var rimraf=require(_0xf7b8('0x8'));var config=require(_0xf7b8('0x9'));var attributes=require(_0xf7b8('0xa'));module[_0xf7b8('0xb')]=function(_0xa6e52e,_0x123ff6){return _0xa6e52e['define'](_0xf7b8('0xc'),attributes,{'tableName':_0xf7b8('0xd'),'paranoid':![],'indexes':[{'name':_0xf7b8('0xe'),'fields':[_0xf7b8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e7f7cc9..e54f8fa 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 _0x7d89=['then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','../../config/utils','jayson/promise','client','http'];(function(_0x25efb4,_0x170936){var _0x183258=function(_0x4a11c5){while(--_0x4a11c5){_0x25efb4['push'](_0x25efb4['shift']());}};_0x183258(++_0x170936);}(_0x7d89,0xf6));var _0x97d8=function(_0x2bbb8e,_0x48f3fd){_0x2bbb8e=_0x2bbb8e-0x0;var _0x360b6d=_0x7d89[_0x2bbb8e];return _0x360b6d;};'use strict';var _=require('lodash');var util=require(_0x97d8('0x0'));var moment=require('moment');var BPromise=require(_0x97d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x97d8('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x97d8('0x3'));var client=jayson[_0x97d8('0x4')][_0x97d8('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1b0b54,_0x21cc26,_0x50a84a){return new BPromise(function(_0x272a25,_0x5efeec){return client['request'](_0x1b0b54,_0x50a84a)[_0x97d8('0x6')](function(_0x562882){logger[_0x97d8('0x7')](_0x97d8('0x8'),_0x21cc26,_0x97d8('0x9'));logger[_0x97d8('0xa')](_0x97d8('0xb'),_0x21cc26,_0x97d8('0x9'),JSON[_0x97d8('0xc')](_0x562882));if(_0x562882['error']){if(_0x562882[_0x97d8('0xd')][_0x97d8('0xe')]===0x1f4){logger[_0x97d8('0xd')](_0x97d8('0x8'),_0x21cc26,_0x562882[_0x97d8('0xd')][_0x97d8('0xf')]);return _0x5efeec(_0x562882[_0x97d8('0xd')][_0x97d8('0xf')]);}logger[_0x97d8('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x21cc26,_0x562882[_0x97d8('0xd')][_0x97d8('0xf')]);return _0x272a25(_0x562882[_0x97d8('0xd')][_0x97d8('0xf')]);}else{logger[_0x97d8('0x7')](_0x97d8('0x8'),_0x21cc26,_0x97d8('0x9'));_0x272a25(_0x562882[_0x97d8('0x10')][_0x97d8('0xf')]);}})[_0x97d8('0x11')](function(_0x1d33ad){logger[_0x97d8('0xd')](_0x97d8('0x8'),_0x21cc26,_0x1d33ad);_0x5efeec(_0x1d33ad);});});} \ No newline at end of file +var _0xf8aa=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d60b3,_0x65a805){var _0x2c5d8c=function(_0x4a252f){while(--_0x4a252f){_0x1d60b3['push'](_0x1d60b3['shift']());}};_0x2c5d8c(++_0x65a805);}(_0xf8aa,0xde));var _0xaf8a=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf8aa[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xaf8a('0x0'));var util=require(_0xaf8a('0x1'));var moment=require(_0xaf8a('0x2'));var BPromise=require(_0xaf8a('0x3'));var rs=require(_0xaf8a('0x4'));var fs=require('fs');var Redis=require(_0xaf8a('0x5'));var db=require(_0xaf8a('0x6'))['db'];var utils=require(_0xaf8a('0x7'));var logger=require('../../config/logger')(_0xaf8a('0x8'));var config=require(_0xaf8a('0x9'));var jayson=require(_0xaf8a('0xa'));var client=jayson['client'][_0xaf8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cd93f,_0x39f337,_0x2811e6){return new BPromise(function(_0x201170,_0x262a06){return client[_0xaf8a('0xc')](_0x2cd93f,_0x2811e6)[_0xaf8a('0xd')](function(_0x1ec516){logger['info'](_0xaf8a('0xe'),_0x39f337,_0xaf8a('0xf'));logger[_0xaf8a('0x10')](_0xaf8a('0x11'),_0x39f337,_0xaf8a('0xf'),JSON[_0xaf8a('0x12')](_0x1ec516));if(_0x1ec516[_0xaf8a('0x13')]){if(_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x14')]===0x1f4){logger['error'](_0xaf8a('0xe'),_0x39f337,_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x15')]);return _0x262a06(_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x15')]);}logger['error'](_0xaf8a('0xe'),_0x39f337,_0x1ec516['error'][_0xaf8a('0x15')]);return _0x201170(_0x1ec516[_0xaf8a('0x13')][_0xaf8a('0x15')]);}else{logger[_0xaf8a('0x16')](_0xaf8a('0xe'),_0x39f337,_0xaf8a('0xf'));_0x201170(_0x1ec516['result'][_0xaf8a('0x15')]);}})[_0xaf8a('0x17')](function(_0x344cce){logger['error'](_0xaf8a('0xe'),_0x39f337,_0x344cce);_0x262a06(_0x344cce);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a094c2b..ff1bb4b 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 _0xaf7a=['../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x26ad20,_0x49da86){var _0x2095fd=function(_0x4c0676){while(--_0x4c0676){_0x26ad20['push'](_0x26ad20['shift']());}};_0x2095fd(++_0x49da86);}(_0xaf7a,0x116));var _0xaaf7=function(_0x4d1057,_0x179335){_0x4d1057=_0x4d1057-0x0;var _0x5cef27=_0xaf7a[_0x4d1057];return _0x5cef27;};'use strict';var multer=require(_0xaaf7('0x0'));var util=require('util');var path=require(_0xaaf7('0x1'));var timeout=require(_0xaaf7('0x2'));var express=require(_0xaaf7('0x3'));var router=express[_0xaaf7('0x4')]();var fs_extra=require(_0xaaf7('0x5'));var auth=require(_0xaaf7('0x6'));var interaction=require(_0xaaf7('0x7'));var config=require('../../config/environment');var controller=require(_0xaaf7('0x8'));router[_0xaaf7('0x9')]('/',auth[_0xaaf7('0xa')](),controller[_0xaaf7('0xb')]);router[_0xaaf7('0x9')](_0xaaf7('0xc'),auth['isAuthenticated'](),controller[_0xaaf7('0xd')]);router[_0xaaf7('0x9')](_0xaaf7('0xe'),auth[_0xaaf7('0xa')](),controller['show']);router['post']('/',auth[_0xaaf7('0xa')](),controller['create']);router['put'](_0xaaf7('0xe'),auth[_0xaaf7('0xa')](),controller[_0xaaf7('0xf')]);router[_0xaaf7('0x10')](_0xaaf7('0xe'),auth[_0xaaf7('0xa')](),controller[_0xaaf7('0x11')]);module[_0xaaf7('0x12')]=router; \ No newline at end of file +var _0xdc9a=['describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdc9a,0x185));var _0xadc9=function(_0x41f239,_0x2141fe){_0x41f239=_0x41f239-0x0;var _0x3e6ce7=_0xdc9a[_0x41f239];return _0x3e6ce7;};'use strict';var multer=require(_0xadc9('0x0'));var util=require('util');var path=require(_0xadc9('0x1'));var timeout=require(_0xadc9('0x2'));var express=require('express');var router=express[_0xadc9('0x3')]();var fs_extra=require(_0xadc9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xadc9('0x5'));var controller=require(_0xadc9('0x6'));router['get']('/',auth[_0xadc9('0x7')](),controller[_0xadc9('0x8')]);router['get'](_0xadc9('0x9'),auth[_0xadc9('0x7')](),controller[_0xadc9('0xa')]);router['get'](_0xadc9('0xb'),auth['isAuthenticated'](),controller[_0xadc9('0xc')]);router[_0xadc9('0xd')]('/',auth[_0xadc9('0x7')](),controller[_0xadc9('0xe')]);router[_0xadc9('0xf')](_0xadc9('0xb'),auth[_0xadc9('0x7')](),controller[_0xadc9('0x10')]);router[_0xadc9('0x11')](_0xadc9('0xb'),auth[_0xadc9('0x7')](),controller['destroy']);module[_0xadc9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 42603c1..998bec2 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 _0x147b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x147b,0xbd));var _0xb147=function(_0x3f8720,_0x1c812c){_0x3f8720=_0x3f8720-0x0;var _0x197a82=_0x147b[_0x3f8720];return _0x197a82;};'use strict';var multer=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var path=require(_0xb147('0x2'));var timeout=require('connect-timeout');var express=require(_0xb147('0x3'));var router=express[_0xb147('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb147('0x5'));var interaction=require(_0xb147('0x6'));var config=require(_0xb147('0x7'));var controller=require(_0xb147('0x8'));router[_0xb147('0x9')]('/',auth[_0xb147('0xa')](),controller['index']);router[_0xb147('0x9')](_0xb147('0xb'),auth[_0xb147('0xa')](),controller[_0xb147('0xc')]);router['get'](_0xb147('0xd'),auth['isAuthenticated'](),controller[_0xb147('0xe')]);router['get'](_0xb147('0xf'),auth[_0xb147('0xa')](),controller[_0xb147('0x10')]);router['post']('/',auth[_0xb147('0xa')](),controller[_0xb147('0x11')]);router[_0xb147('0x12')]('/:id/configurations',auth[_0xb147('0xa')](),controller[_0xb147('0x13')]);router[_0xb147('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb147('0x15')]);router[_0xb147('0x16')](_0xb147('0xb'),auth[_0xb147('0xa')](),controller[_0xb147('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9432=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields','post','create','addConfiguration','put','update','delete','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9432,0x117));var _0x2943=function(_0x5e667d,_0x453828){_0x5e667d=_0x5e667d-0x0;var _0x3a7dad=_0x9432[_0x5e667d];return _0x3a7dad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2943('0x0'));var timeout=require(_0x2943('0x1'));var express=require('express');var router=express[_0x2943('0x2')]();var fs_extra=require(_0x2943('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2943('0x4'));var config=require(_0x2943('0x5'));var controller=require(_0x2943('0x6'));router['get']('/',auth[_0x2943('0x7')](),controller[_0x2943('0x8')]);router[_0x2943('0x9')](_0x2943('0xa'),auth['isAuthenticated'](),controller[_0x2943('0xb')]);router[_0x2943('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2943('0x9')](_0x2943('0xc'),auth[_0x2943('0x7')](),controller['getFields']);router[_0x2943('0xd')]('/',auth[_0x2943('0x7')](),controller[_0x2943('0xe')]);router[_0x2943('0xd')]('/:id/configurations',auth[_0x2943('0x7')](),controller[_0x2943('0xf')]);router[_0x2943('0x10')](_0x2943('0xa'),auth[_0x2943('0x7')](),controller[_0x2943('0x11')]);router[_0x2943('0x12')]('/:id',auth[_0x2943('0x7')](),controller['destroy']);module[_0x2943('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8b01eb9..f7753e8 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 _0x1e03=['STRING','basic','integrationTab','newTab','sequelize','exports'];(function(_0x32cd08,_0x289c34){var _0x2f3df3=function(_0x19d805){while(--_0x19d805){_0x32cd08['push'](_0x32cd08['shift']());}};_0x2f3df3(++_0x289c34);}(_0x1e03,0x166));var _0x31e0=function(_0x1b519b,_0x11a150){_0x1b519b=_0x1b519b-0x0;var _0x29538b=_0x1e03[_0x1b519b];return _0x29538b;};'use strict';var Sequelize=require(_0x31e0('0x0'));module[_0x31e0('0x1')]={'name':{'type':Sequelize[_0x31e0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x31e0('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x31e0('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x31e0('0x2')]},'consumerSecret':{'type':Sequelize[_0x31e0('0x2')]},'token':{'type':Sequelize[_0x31e0('0x2')]},'tokenSecret':{'type':Sequelize[_0x31e0('0x2')]},'serverUrl':{'type':Sequelize[_0x31e0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x31e0('0x4'),_0x31e0('0x5')),'defaultValue':_0x31e0('0x4')}}; \ No newline at end of file +var _0xecf2=['integrationTab','newTab','sequelize','STRING','basic','ENUM'];(function(_0x3de39e,_0x3467c1){var _0x5be091=function(_0x1cdd65){while(--_0x1cdd65){_0x3de39e['push'](_0x3de39e['shift']());}};_0x5be091(++_0x3467c1);}(_0xecf2,0xc8));var _0x2ecf=function(_0x703ebb,_0x5b8345){_0x703ebb=_0x703ebb-0x0;var _0x25ab61=_0xecf2[_0x703ebb];return _0x25ab61;};'use strict';var Sequelize=require(_0x2ecf('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ecf('0x1')]},'description':{'type':Sequelize[_0x2ecf('0x1')]},'username':{'type':Sequelize[_0x2ecf('0x1')]},'remoteUri':{'type':Sequelize[_0x2ecf('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x2ecf('0x2')),'defaultValue':_0x2ecf('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2ecf('0x1')]},'token':{'type':Sequelize[_0x2ecf('0x1')]},'tokenSecret':{'type':Sequelize[_0x2ecf('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2ecf('0x3')](_0x2ecf('0x4'),_0x2ecf('0x5')),'defaultValue':_0x2ecf('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 00bd9d6..8a9c71d 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 _0xe37e=['body','params','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','username','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','format','application/json','authType','basic','Authorization','Basic\x20%s','%s:%s','password','toString','base64','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','then','end','error','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','include','find','catch','create'];(function(_0x59008b,_0x75ea97){var _0x20359c=function(_0x3e3199){while(--_0x3e3199){_0x59008b['push'](_0x59008b['shift']());}};_0x20359c(++_0x75ea97);}(_0xe37e,0x9f));var _0xee37=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe37e[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xee37('0x0'));var rimraf=require(_0xee37('0x1'));var zipdir=require(_0xee37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee37('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee37('0x4'));var util=require('util');var path=require(_0xee37('0x5'));var sox=require(_0xee37('0x6'));var csv=require(_0xee37('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee37('0x8'));var _=require(_0xee37('0x9'));var squel=require(_0xee37('0xa'));var crypto=require(_0xee37('0xb'));var jsforce=require(_0xee37('0xc'));var deskjs=require(_0xee37('0xd'));var toCsv=require('to-csv');var querystring=require(_0xee37('0xe'));var Papa=require(_0xee37('0xf'));var Redis=require(_0xee37('0x10'));var authService=require(_0xee37('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee37('0x12'));var logger=require(_0xee37('0x13'))(_0xee37('0x14'));var utils=require(_0xee37('0x15'));var config=require(_0xee37('0x16'));var licenseUtil=require(_0xee37('0x17'));var db=require(_0xee37('0x18'))['db'];var integrations=require(_0xee37('0x19'));function respondWithStatusCode(_0x489464,_0x465fd3){_0x465fd3=_0x465fd3||0xcc;return function(_0x8f24f1){if(_0x8f24f1){return _0x489464[_0xee37('0x1a')](_0x465fd3);}return _0x489464[_0xee37('0x1b')](_0x465fd3)['end']();};}function respondWithResult(_0x36113e,_0x55341){_0x55341=_0x55341||0xc8;return function(_0x473608){if(_0x473608){return _0x36113e[_0xee37('0x1b')](_0x55341)['json'](_0x473608);}};}function respondWithFilteredResult(_0x41fbb6,_0x769f91){return function(_0x34d3bc){if(_0x34d3bc){var _0x7bceb1=typeof _0x769f91['offset']===_0xee37('0x1c')&&typeof _0x769f91[_0xee37('0x1d')]==='undefined';var _0x45bad8=_0x34d3bc[_0xee37('0x1e')];var _0x52d69c=_0x7bceb1?0x0:_0x769f91[_0xee37('0x1f')];var _0x2388a8=_0x7bceb1?_0x34d3bc['count']:_0x769f91[_0xee37('0x1f')]+_0x769f91[_0xee37('0x1d')];var _0xda4fb8;if(_0x2388a8>=_0x45bad8){_0x2388a8=_0x45bad8;_0xda4fb8=0xc8;}else{_0xda4fb8=0xce;}_0x41fbb6[_0xee37('0x1b')](_0xda4fb8);return _0x41fbb6[_0xee37('0x20')](_0xee37('0x21'),_0x52d69c+'-'+_0x2388a8+'/'+_0x45bad8)[_0xee37('0x22')](_0x34d3bc);}return null;};}function patchUpdates(_0x51012c){return function(_0x14e205){try{jsonpatch['apply'](_0x14e205,_0x51012c,!![]);}catch(_0x977efc){return BPromise[_0xee37('0x23')](_0x977efc);}return _0x14e205[_0xee37('0x24')]();};}function saveUpdates(_0x1bd79b,_0x3d1ee9){return function(_0x38250e){if(_0x38250e){return _0x38250e[_0xee37('0x25')](_0x1bd79b)['then'](function(_0x285e00){return _0x285e00;});}return null;};}function removeEntity(_0x515b69,_0x30a1b7){return function(_0x530187){if(_0x530187){return _0x530187[_0xee37('0x26')]()[_0xee37('0x27')](function(){_0x515b69[_0xee37('0x1b')](0xcc)[_0xee37('0x28')]();});}};}function handleEntityNotFound(_0x128089,_0x3e2b5e){return function(_0x5d8769){if(!_0x5d8769){_0x128089[_0xee37('0x1a')](0x194);}return _0x5d8769;};}function handleError(_0x11036d,_0x4c64fc){_0x4c64fc=_0x4c64fc||0x1f4;return function(_0x35c9b7){logger[_0xee37('0x29')](_0x35c9b7['stack']);if(_0x35c9b7[_0xee37('0x2a')]){delete _0x35c9b7[_0xee37('0x2a')];}_0x11036d[_0xee37('0x1b')](_0x4c64fc)[_0xee37('0x2b')](_0x35c9b7);};}exports[_0xee37('0x2c')]=function(_0x4282c0,_0xb7053b){var _0x1bd906={},_0x3f2fca={},_0xa9cd0b={'count':0x0,'rows':[]};var _0x13149b=_[_0xee37('0x2d')](db[_0xee37('0x2e')][_0xee37('0x2f')],function(_0x5d202b){return{'name':_0x5d202b['fieldName'],'type':_0x5d202b[_0xee37('0x30')][_0xee37('0x31')]};});_0x3f2fca[_0xee37('0x32')]=_[_0xee37('0x2d')](_0x13149b,_0xee37('0x2a'));_0x3f2fca[_0xee37('0x33')]=_[_0xee37('0x34')](_0x4282c0['query']);_0x3f2fca['filters']=_['intersection'](_0x3f2fca[_0xee37('0x32')],_0x3f2fca['query']);_0x1bd906['attributes']=_[_0xee37('0x35')](_0x3f2fca['model'],qs[_0xee37('0x36')](_0x4282c0['query'][_0xee37('0x36')]));_0x1bd906[_0xee37('0x37')]=_0x1bd906['attributes'][_0xee37('0x38')]?_0x1bd906[_0xee37('0x37')]:_0x3f2fca[_0xee37('0x32')];if(!_0x4282c0['query'][_0xee37('0x39')](_0xee37('0x3a'))){_0x1bd906[_0xee37('0x1d')]=qs[_0xee37('0x1d')](_0x4282c0[_0xee37('0x33')][_0xee37('0x1d')]);_0x1bd906[_0xee37('0x1f')]=qs[_0xee37('0x1f')](_0x4282c0[_0xee37('0x33')][_0xee37('0x1f')]);}_0x1bd906[_0xee37('0x3b')]=qs[_0xee37('0x3c')](_0x4282c0[_0xee37('0x33')]['sort']);_0x1bd906[_0xee37('0x3d')]=qs[_0xee37('0x3e')](_[_0xee37('0x3f')](_0x4282c0[_0xee37('0x33')],_0x3f2fca[_0xee37('0x3e')]),_0x13149b);if(_0x4282c0[_0xee37('0x33')]['filter']){_0x1bd906[_0xee37('0x3d')]=_['merge'](_0x1bd906['where'],{'$or':_[_0xee37('0x2d')](_0x13149b,function(_0x27043a){if(_0x27043a[_0xee37('0x30')]!==_0xee37('0x40')){var _0x267a08={};_0x267a08[_0x27043a[_0xee37('0x2a')]]={'$like':'%'+_0x4282c0[_0xee37('0x33')][_0xee37('0x41')]+'%'};return _0x267a08;}})});}_0x1bd906=_[_0xee37('0x42')]({},_0x1bd906,_0x4282c0[_0xee37('0x43')]);var _0x3a810b={'where':_0x1bd906[_0xee37('0x3d')]};return db[_0xee37('0x2e')][_0xee37('0x1e')](_0x3a810b)['then'](function(_0xfe9a90){_0xa9cd0b[_0xee37('0x1e')]=_0xfe9a90;if(_0x4282c0[_0xee37('0x33')][_0xee37('0x44')]){_0x1bd906['include']=[{'all':!![]}];}return db[_0xee37('0x2e')][_0xee37('0x45')](_0x1bd906);})[_0xee37('0x27')](function(_0x227af7){_0xa9cd0b['rows']=_0x227af7;return _0xa9cd0b;})[_0xee37('0x27')](respondWithFilteredResult(_0xb7053b,_0x1bd906))['catch'](handleError(_0xb7053b,null));};exports[_0xee37('0x46')]=function(_0x1c3908,_0x26833f){var _0x4455fd={'raw':![],'where':{'id':_0x1c3908['params']['id']}},_0x6cdd24={};_0x6cdd24[_0xee37('0x32')]=_[_0xee37('0x34')](db[_0xee37('0x2e')][_0xee37('0x2f')]);_0x6cdd24['query']=_[_0xee37('0x34')](_0x1c3908[_0xee37('0x33')]);_0x6cdd24['filters']=_[_0xee37('0x35')](_0x6cdd24[_0xee37('0x32')],_0x6cdd24['query']);_0x4455fd[_0xee37('0x37')]=_[_0xee37('0x35')](_0x6cdd24['model'],qs[_0xee37('0x36')](_0x1c3908[_0xee37('0x33')][_0xee37('0x36')]));_0x4455fd[_0xee37('0x37')]=_0x4455fd['attributes'][_0xee37('0x38')]?_0x4455fd[_0xee37('0x37')]:_0x6cdd24[_0xee37('0x32')];if(_0x1c3908[_0xee37('0x33')][_0xee37('0x44')]){_0x4455fd[_0xee37('0x47')]=[{'all':!![]}];}_0x4455fd=_[_0xee37('0x42')]({},_0x4455fd,_0x1c3908[_0xee37('0x43')]);return db['DeskAccount'][_0xee37('0x48')](_0x4455fd)[_0xee37('0x27')](handleEntityNotFound(_0x26833f,null))[_0xee37('0x27')](respondWithResult(_0x26833f,null))[_0xee37('0x49')](handleError(_0x26833f,null));};exports[_0xee37('0x4a')]=function(_0x4cc687,_0x3fa182){return db[_0xee37('0x2e')][_0xee37('0x4a')](_0x4cc687['body'],{})['then'](respondWithResult(_0x3fa182,0xc9))[_0xee37('0x49')](handleError(_0x3fa182,null));};exports[_0xee37('0x25')]=function(_0x27be99,_0x4fe6fc){if(_0x27be99[_0xee37('0x4b')]['id']){delete _0x27be99[_0xee37('0x4b')]['id'];}return db[_0xee37('0x2e')][_0xee37('0x48')]({'where':{'id':_0x27be99[_0xee37('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4fe6fc,null))[_0xee37('0x27')](saveUpdates(_0x27be99[_0xee37('0x4b')],null))[_0xee37('0x27')](respondWithResult(_0x4fe6fc,null))[_0xee37('0x49')](handleError(_0x4fe6fc,null));};exports[_0xee37('0x26')]=function(_0x3de288,_0x301f5c){return db[_0xee37('0x2e')][_0xee37('0x48')]({'where':{'id':_0x3de288[_0xee37('0x4c')]['id']}})['then'](handleEntityNotFound(_0x301f5c,null))[_0xee37('0x27')](removeEntity(_0x301f5c,null))['catch'](handleError(_0x301f5c,null));};exports[_0xee37('0x4d')]=function(_0x89607b,_0x1fd09d,_0x29ff41){var _0x5b0578={};var _0x1e1127={};var _0x220470;var _0x49c066;return db[_0xee37('0x2e')][_0xee37('0x4e')]({'where':{'id':_0x89607b[_0xee37('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1fd09d,null))['then'](function(_0x49e78e){if(_0x49e78e){_0x220470=_0x49e78e;_0x1e1127[_0xee37('0x32')]=_[_0xee37('0x34')](db[_0xee37('0x4f')][_0xee37('0x2f')]);_0x1e1127[_0xee37('0x33')]=_['keys'](_0x89607b[_0xee37('0x33')]);_0x1e1127[_0xee37('0x3e')]=_['intersection'](_0x1e1127['model'],_0x1e1127['query']);_0x5b0578[_0xee37('0x37')]=_['intersection'](_0x1e1127[_0xee37('0x32')],qs[_0xee37('0x36')](_0x89607b[_0xee37('0x33')][_0xee37('0x36')]));_0x5b0578[_0xee37('0x37')]=_0x5b0578[_0xee37('0x37')][_0xee37('0x38')]?_0x5b0578['attributes']:_0x1e1127[_0xee37('0x32')];_0x5b0578[_0xee37('0x3b')]=qs[_0xee37('0x3c')](_0x89607b['query'][_0xee37('0x3c')]);_0x5b0578[_0xee37('0x3d')]=qs[_0xee37('0x3e')](_[_0xee37('0x3f')](_0x89607b[_0xee37('0x33')],_0x1e1127[_0xee37('0x3e')]));if(_0x89607b['query'][_0xee37('0x41')]){_0x5b0578['where']=_[_0xee37('0x42')](_0x5b0578['where'],{'$or':_[_0xee37('0x2d')](_0x5b0578['attributes'],function(_0x21a28d){var _0x55412f={};_0x55412f[_0x21a28d]={'$like':'%'+_0x89607b['query'][_0xee37('0x41')]+'%'};return _0x55412f;})});}_0x5b0578=_['merge']({},_0x5b0578,_0x89607b[_0xee37('0x43')]);return _0x220470[_0xee37('0x4d')](_0x5b0578);}})[_0xee37('0x27')](function(_0x1c48ae){if(_0x1c48ae){_0x49c066=_0x1c48ae[_0xee37('0x38')];if(!_0x89607b[_0xee37('0x33')][_0xee37('0x39')](_0xee37('0x3a'))){_0x5b0578[_0xee37('0x1d')]=qs['limit'](_0x89607b['query'][_0xee37('0x1d')]);_0x5b0578[_0xee37('0x1f')]=qs['offset'](_0x89607b[_0xee37('0x33')][_0xee37('0x1f')]);}return _0x220470[_0xee37('0x4d')](_0x5b0578);}})[_0xee37('0x27')](function(_0x35fbb3){if(_0x35fbb3){return _0x35fbb3?{'count':_0x49c066,'rows':_0x35fbb3}:null;}})['then'](respondWithResult(_0x1fd09d,null))[_0xee37('0x49')](handleError(_0x1fd09d,null));};exports[_0xee37('0x50')]=function(_0x409e31,_0xcd11ed,_0x5a6372){if(_0x409e31[_0xee37('0x4b')]['id']){delete _0x409e31[_0xee37('0x4b')]['id'];}return db[_0xee37('0x2e')]['findOne']({'where':{'id':_0x409e31['params']['id']}})[_0xee37('0x27')](handleEntityNotFound(_0xcd11ed,null))['then'](function(_0x46f234){if(_0x46f234){_0x409e31['body'][_0xee37('0x51')]=_0x46f234['id'];_0x409e31[_0xee37('0x4b')]['Subjects']=integrations[_0xee37('0x52')](_0x409e31[_0xee37('0x4b')][_0xee37('0x53')],_0x409e31[_0xee37('0x4b')]['type']);_0x409e31['body'][_0xee37('0x54')]=integrations[_0xee37('0x55')](_0x409e31['body'][_0xee37('0x53')],_0x409e31[_0xee37('0x4b')]['type']);return db['DeskConfiguration'][_0xee37('0x4a')](_0x409e31['body'],{'include':[{'model':db[_0xee37('0x56')],'as':_0xee37('0x57')},{'model':db[_0xee37('0x56')],'as':'Descriptions'}]});}return null;})[_0xee37('0x27')](respondWithResult(_0xcd11ed,null))[_0xee37('0x49')](handleError(_0xcd11ed,null));};exports[_0xee37('0x58')]=function(_0x32c164,_0x463fbf,_0x49ddce){var _0x3f14c8=[{'name':_0xee37('0x59'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x15e74c='';return db[_0xee37('0x2e')]['findOne']({'where':{'id':_0x32c164[_0xee37('0x4c')]['id']},'attributes':['id',_0xee37('0x5a'),'authType',_0xee37('0x5b'),'password',_0xee37('0x5c'),_0xee37('0x5d'),'token',_0xee37('0x5e')]})[_0xee37('0x27')](handleEntityNotFound(_0x463fbf,null))[_0xee37('0x27')](function(_0x2974fa){if(_0x2974fa){_0x15e74c=_0x2974fa[_0xee37('0x5a')];var _0x55cd4c=_0x15e74c[_0xee37('0x5f')](-0x1);if(_0x55cd4c==='/'){_0x15e74c=_0x15e74c['substring'](0x0,_0x15e74c[_0xee37('0x60')](_0x55cd4c));}var _0x163056={'method':_0xee37('0x61'),'uri':util[_0xee37('0x62')]('%s/custom_fields',_0x15e74c),'headers':{'Content-Type':_0xee37('0x63'),'Accept':'application/json'},'json':!![]};if(_0x2974fa[_0xee37('0x64')]===_0xee37('0x65')){_0x163056['headers'][_0xee37('0x66')]=util['format'](_0xee37('0x67'),new Buffer(util[_0xee37('0x62')](_0xee37('0x68'),_0x2974fa[_0xee37('0x5b')],_0x2974fa[_0xee37('0x69')]))[_0xee37('0x6a')](_0xee37('0x6b')));}return rp(_0x163056)[_0xee37('0x27')](function(_0x58a803){return _0x3f14c8['concat'](_[_0xee37('0x2d')](_0x58a803[_0xee37('0x6c')][_0xee37('0x6d')],function(_0x3db885){return{'id':_0x3db885['name'],'name':_0x3db885[_0xee37('0x2a')],'type':_0x3db885[_0xee37('0x30')],'active':_0x3db885[_0xee37('0x6e')],'label':_0x3db885[_0xee37('0x6f')],'custom':!![]};}));});}})[_0xee37('0x27')](function(_0x9fc1ae){return{'count':_0x9fc1ae[_0xee37('0x38')],'rows':_0x9fc1ae};})[_0xee37('0x27')](respondWithResult(_0x463fbf,null))[_0xee37('0x49')](function(_0x4f7055){var _0x156ca3=_0x32c164[_0xee37('0x33')][_0xee37('0x70')]?0x1f4:_0x4f7055['statusCode']||0x1f4;logger[_0xee37('0x29')](_0xee37('0x71'),_0xee37('0x58'),_0x156ca3,JSON[_0xee37('0x72')](_0x4f7055));delete _0x4f7055['name'];if(_0x156ca3===0x191){_0x156ca3=0x190;}_0x463fbf['status'](_0x156ca3)['send'](_0x32c164[_0xee37('0x33')]['test']?{'message':_0xee37('0x73'),'statusCode':_0x4f7055[_0xee37('0x74')]}:_0x4f7055);});}; \ No newline at end of file +var _0xad5a=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getConfigurations','findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','priority','authType','password','consumerKey','consumerSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x15f276,_0x2fd123){var _0x42172f=function(_0x3d4731){while(--_0x3d4731){_0x15f276['push'](_0x15f276['shift']());}};_0x42172f(++_0x2fd123);}(_0xad5a,0x1d0));var _0xaad5=function(_0xe3fdc3,_0x24be22){_0xe3fdc3=_0xe3fdc3-0x0;var _0x2eb091=_0xad5a[_0xe3fdc3];return _0x2eb091;};'use strict';var emlformat=require(_0xaad5('0x0'));var rimraf=require(_0xaad5('0x1'));var zipdir=require(_0xaad5('0x2'));var jsonpatch=require(_0xaad5('0x3'));var rp=require(_0xaad5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaad5('0x5'));var util=require(_0xaad5('0x6'));var path=require(_0xaad5('0x7'));var sox=require(_0xaad5('0x8'));var csv=require('to-csv');var ejs=require(_0xaad5('0x9'));var fs=require('fs');var fs_extra=require(_0xaad5('0xa'));var _=require(_0xaad5('0xb'));var squel=require(_0xaad5('0xc'));var crypto=require(_0xaad5('0xd'));var jsforce=require(_0xaad5('0xe'));var deskjs=require(_0xaad5('0xf'));var toCsv=require(_0xaad5('0x10'));var querystring=require(_0xaad5('0x11'));var Papa=require(_0xaad5('0x12'));var Redis=require('ioredis');var authService=require(_0xaad5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaad5('0x14'));var hardwareService=require(_0xaad5('0x15'));var logger=require(_0xaad5('0x16'))(_0xaad5('0x17'));var utils=require(_0xaad5('0x18'));var config=require(_0xaad5('0x19'));var licenseUtil=require(_0xaad5('0x1a'));var db=require(_0xaad5('0x1b'))['db'];var integrations=require(_0xaad5('0x1c'));function respondWithStatusCode(_0xdead0d,_0x413af0){_0x413af0=_0x413af0||0xcc;return function(_0xaac18e){if(_0xaac18e){return _0xdead0d['sendStatus'](_0x413af0);}return _0xdead0d['status'](_0x413af0)[_0xaad5('0x1d')]();};}function respondWithResult(_0x3e0d32,_0x4956fb){_0x4956fb=_0x4956fb||0xc8;return function(_0x5e9bba){if(_0x5e9bba){return _0x3e0d32[_0xaad5('0x1e')](_0x4956fb)['json'](_0x5e9bba);}};}function respondWithFilteredResult(_0x4ea656,_0xa07185){return function(_0x4c822c){if(_0x4c822c){var _0xbfa44a=typeof _0xa07185[_0xaad5('0x1f')]==='undefined'&&typeof _0xa07185['limit']===_0xaad5('0x20');var _0x1d0436=_0x4c822c[_0xaad5('0x21')];var _0x21981a=_0xbfa44a?0x0:_0xa07185[_0xaad5('0x1f')];var _0x3f6f98=_0xbfa44a?_0x4c822c[_0xaad5('0x21')]:_0xa07185[_0xaad5('0x1f')]+_0xa07185[_0xaad5('0x22')];var _0x26560a;if(_0x3f6f98>=_0x1d0436){_0x3f6f98=_0x1d0436;_0x26560a=0xc8;}else{_0x26560a=0xce;}_0x4ea656['status'](_0x26560a);return _0x4ea656[_0xaad5('0x23')](_0xaad5('0x24'),_0x21981a+'-'+_0x3f6f98+'/'+_0x1d0436)[_0xaad5('0x25')](_0x4c822c);}return null;};}function patchUpdates(_0x46c8d0){return function(_0x35ad7f){try{jsonpatch[_0xaad5('0x26')](_0x35ad7f,_0x46c8d0,!![]);}catch(_0x3d3c06){return BPromise['reject'](_0x3d3c06);}return _0x35ad7f[_0xaad5('0x27')]();};}function saveUpdates(_0x3e18a1,_0x3ade6a){return function(_0x36f25f){if(_0x36f25f){return _0x36f25f[_0xaad5('0x28')](_0x3e18a1)['then'](function(_0x38f145){return _0x38f145;});}return null;};}function removeEntity(_0x65c224,_0x4bd163){return function(_0x29006a){if(_0x29006a){return _0x29006a[_0xaad5('0x29')]()[_0xaad5('0x2a')](function(){_0x65c224[_0xaad5('0x1e')](0xcc)[_0xaad5('0x1d')]();});}};}function handleEntityNotFound(_0x2f9f5c,_0x27c91c){return function(_0x21ba54){if(!_0x21ba54){_0x2f9f5c[_0xaad5('0x2b')](0x194);}return _0x21ba54;};}function handleError(_0x326d6b,_0x4f0772){_0x4f0772=_0x4f0772||0x1f4;return function(_0x302014){logger[_0xaad5('0x2c')](_0x302014[_0xaad5('0x2d')]);if(_0x302014[_0xaad5('0x2e')]){delete _0x302014['name'];}_0x326d6b[_0xaad5('0x1e')](_0x4f0772)['send'](_0x302014);};}exports[_0xaad5('0x2f')]=function(_0x160eea,_0x285de3){var _0x51d7fd={},_0xf667e4={},_0x5ab7c5={'count':0x0,'rows':[]};var _0x34d86e=_[_0xaad5('0x30')](db[_0xaad5('0x31')][_0xaad5('0x32')],function(_0x3c71e3){return{'name':_0x3c71e3[_0xaad5('0x33')],'type':_0x3c71e3['type'][_0xaad5('0x34')]};});_0xf667e4[_0xaad5('0x35')]=_[_0xaad5('0x30')](_0x34d86e,_0xaad5('0x2e'));_0xf667e4[_0xaad5('0x36')]=_['keys'](_0x160eea['query']);_0xf667e4[_0xaad5('0x37')]=_['intersection'](_0xf667e4[_0xaad5('0x35')],_0xf667e4[_0xaad5('0x36')]);_0x51d7fd['attributes']=_[_0xaad5('0x38')](_0xf667e4['model'],qs[_0xaad5('0x39')](_0x160eea[_0xaad5('0x36')][_0xaad5('0x39')]));_0x51d7fd[_0xaad5('0x3a')]=_0x51d7fd[_0xaad5('0x3a')]['length']?_0x51d7fd[_0xaad5('0x3a')]:_0xf667e4[_0xaad5('0x35')];if(!_0x160eea['query'][_0xaad5('0x3b')](_0xaad5('0x3c'))){_0x51d7fd['limit']=qs['limit'](_0x160eea[_0xaad5('0x36')][_0xaad5('0x22')]);_0x51d7fd[_0xaad5('0x1f')]=qs[_0xaad5('0x1f')](_0x160eea[_0xaad5('0x36')][_0xaad5('0x1f')]);}_0x51d7fd[_0xaad5('0x3d')]=qs['sort'](_0x160eea['query']['sort']);_0x51d7fd[_0xaad5('0x3e')]=qs[_0xaad5('0x37')](_[_0xaad5('0x3f')](_0x160eea['query'],_0xf667e4['filters']),_0x34d86e);if(_0x160eea['query']['filter']){_0x51d7fd[_0xaad5('0x3e')]=_[_0xaad5('0x40')](_0x51d7fd[_0xaad5('0x3e')],{'$or':_[_0xaad5('0x30')](_0x34d86e,function(_0x6fe090){if(_0x6fe090['type']!==_0xaad5('0x41')){var _0x385982={};_0x385982[_0x6fe090[_0xaad5('0x2e')]]={'$like':'%'+_0x160eea[_0xaad5('0x36')]['filter']+'%'};return _0x385982;}})});}_0x51d7fd=_[_0xaad5('0x40')]({},_0x51d7fd,_0x160eea[_0xaad5('0x42')]);var _0x1dc6b4={'where':_0x51d7fd[_0xaad5('0x3e')]};return db[_0xaad5('0x31')]['count'](_0x1dc6b4)[_0xaad5('0x2a')](function(_0x424660){_0x5ab7c5[_0xaad5('0x21')]=_0x424660;if(_0x160eea['query'][_0xaad5('0x43')]){_0x51d7fd[_0xaad5('0x44')]=[{'all':!![]}];}return db['DeskAccount'][_0xaad5('0x45')](_0x51d7fd);})[_0xaad5('0x2a')](function(_0x21298f){_0x5ab7c5[_0xaad5('0x46')]=_0x21298f;return _0x5ab7c5;})[_0xaad5('0x2a')](respondWithFilteredResult(_0x285de3,_0x51d7fd))[_0xaad5('0x47')](handleError(_0x285de3,null));};exports[_0xaad5('0x48')]=function(_0x4f2641,_0x4c60e8){var _0xc0a6bb={'raw':![],'where':{'id':_0x4f2641[_0xaad5('0x49')]['id']}},_0x4ed8b9={};_0x4ed8b9[_0xaad5('0x35')]=_[_0xaad5('0x4a')](db['DeskAccount'][_0xaad5('0x32')]);_0x4ed8b9[_0xaad5('0x36')]=_[_0xaad5('0x4a')](_0x4f2641['query']);_0x4ed8b9[_0xaad5('0x37')]=_[_0xaad5('0x38')](_0x4ed8b9[_0xaad5('0x35')],_0x4ed8b9[_0xaad5('0x36')]);_0xc0a6bb['attributes']=_[_0xaad5('0x38')](_0x4ed8b9[_0xaad5('0x35')],qs[_0xaad5('0x39')](_0x4f2641[_0xaad5('0x36')]['fields']));_0xc0a6bb[_0xaad5('0x3a')]=_0xc0a6bb[_0xaad5('0x3a')][_0xaad5('0x4b')]?_0xc0a6bb[_0xaad5('0x3a')]:_0x4ed8b9['model'];if(_0x4f2641[_0xaad5('0x36')]['includeAll']){_0xc0a6bb[_0xaad5('0x44')]=[{'all':!![]}];}_0xc0a6bb=_[_0xaad5('0x40')]({},_0xc0a6bb,_0x4f2641[_0xaad5('0x42')]);return db['DeskAccount'][_0xaad5('0x4c')](_0xc0a6bb)[_0xaad5('0x2a')](handleEntityNotFound(_0x4c60e8,null))[_0xaad5('0x2a')](respondWithResult(_0x4c60e8,null))[_0xaad5('0x47')](handleError(_0x4c60e8,null));};exports[_0xaad5('0x4d')]=function(_0x464b8d,_0x176d54){return db[_0xaad5('0x31')][_0xaad5('0x4d')](_0x464b8d[_0xaad5('0x4e')],{})['then'](respondWithResult(_0x176d54,0xc9))[_0xaad5('0x47')](handleError(_0x176d54,null));};exports['update']=function(_0xa0ed61,_0x10d780){if(_0xa0ed61[_0xaad5('0x4e')]['id']){delete _0xa0ed61['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0xa0ed61[_0xaad5('0x49')]['id']}})[_0xaad5('0x2a')](handleEntityNotFound(_0x10d780,null))[_0xaad5('0x2a')](saveUpdates(_0xa0ed61['body'],null))[_0xaad5('0x2a')](respondWithResult(_0x10d780,null))['catch'](handleError(_0x10d780,null));};exports[_0xaad5('0x29')]=function(_0x1b090b,_0x2086ea){return db['DeskAccount'][_0xaad5('0x4c')]({'where':{'id':_0x1b090b['params']['id']}})[_0xaad5('0x2a')](handleEntityNotFound(_0x2086ea,null))[_0xaad5('0x2a')](removeEntity(_0x2086ea,null))[_0xaad5('0x47')](handleError(_0x2086ea,null));};exports[_0xaad5('0x4f')]=function(_0x5b6553,_0x34d4a7,_0x3ef01a){var _0x4b424d={};var _0x58f389={};var _0x4fe05d;var _0x52dcdb;return db[_0xaad5('0x31')][_0xaad5('0x50')]({'where':{'id':_0x5b6553[_0xaad5('0x49')]['id']}})[_0xaad5('0x2a')](handleEntityNotFound(_0x34d4a7,null))[_0xaad5('0x2a')](function(_0xa226fd){if(_0xa226fd){_0x4fe05d=_0xa226fd;_0x58f389[_0xaad5('0x35')]=_[_0xaad5('0x4a')](db[_0xaad5('0x51')]['rawAttributes']);_0x58f389[_0xaad5('0x36')]=_[_0xaad5('0x4a')](_0x5b6553['query']);_0x58f389[_0xaad5('0x37')]=_[_0xaad5('0x38')](_0x58f389[_0xaad5('0x35')],_0x58f389[_0xaad5('0x36')]);_0x4b424d['attributes']=_['intersection'](_0x58f389['model'],qs[_0xaad5('0x39')](_0x5b6553['query'][_0xaad5('0x39')]));_0x4b424d[_0xaad5('0x3a')]=_0x4b424d[_0xaad5('0x3a')][_0xaad5('0x4b')]?_0x4b424d[_0xaad5('0x3a')]:_0x58f389[_0xaad5('0x35')];_0x4b424d[_0xaad5('0x3d')]=qs[_0xaad5('0x52')](_0x5b6553[_0xaad5('0x36')]['sort']);_0x4b424d[_0xaad5('0x3e')]=qs[_0xaad5('0x37')](_['pick'](_0x5b6553[_0xaad5('0x36')],_0x58f389[_0xaad5('0x37')]));if(_0x5b6553[_0xaad5('0x36')]['filter']){_0x4b424d[_0xaad5('0x3e')]=_[_0xaad5('0x40')](_0x4b424d[_0xaad5('0x3e')],{'$or':_[_0xaad5('0x30')](_0x4b424d[_0xaad5('0x3a')],function(_0x172eda){var _0x48533f={};_0x48533f[_0x172eda]={'$like':'%'+_0x5b6553[_0xaad5('0x36')]['filter']+'%'};return _0x48533f;})});}_0x4b424d=_[_0xaad5('0x40')]({},_0x4b424d,_0x5b6553[_0xaad5('0x42')]);return _0x4fe05d[_0xaad5('0x4f')](_0x4b424d);}})[_0xaad5('0x2a')](function(_0x58087a){if(_0x58087a){_0x52dcdb=_0x58087a['length'];if(!_0x5b6553[_0xaad5('0x36')][_0xaad5('0x3b')](_0xaad5('0x3c'))){_0x4b424d[_0xaad5('0x22')]=qs[_0xaad5('0x22')](_0x5b6553[_0xaad5('0x36')]['limit']);_0x4b424d[_0xaad5('0x1f')]=qs[_0xaad5('0x1f')](_0x5b6553['query'][_0xaad5('0x1f')]);}return _0x4fe05d['getConfigurations'](_0x4b424d);}})[_0xaad5('0x2a')](function(_0x40a9d0){if(_0x40a9d0){return _0x40a9d0?{'count':_0x52dcdb,'rows':_0x40a9d0}:null;}})[_0xaad5('0x2a')](respondWithResult(_0x34d4a7,null))[_0xaad5('0x47')](handleError(_0x34d4a7,null));};exports[_0xaad5('0x53')]=function(_0x16d2c8,_0x1b36a4,_0x14bb6e){if(_0x16d2c8[_0xaad5('0x4e')]['id']){delete _0x16d2c8[_0xaad5('0x4e')]['id'];}return db['DeskAccount'][_0xaad5('0x50')]({'where':{'id':_0x16d2c8[_0xaad5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b36a4,null))[_0xaad5('0x2a')](function(_0x1427f3){if(_0x1427f3){_0x16d2c8['body'][_0xaad5('0x54')]=_0x1427f3['id'];_0x16d2c8[_0xaad5('0x4e')][_0xaad5('0x55')]=integrations[_0xaad5('0x56')](_0x16d2c8['body'][_0xaad5('0x57')],_0x16d2c8[_0xaad5('0x4e')][_0xaad5('0x58')]);_0x16d2c8['body'][_0xaad5('0x59')]=integrations[_0xaad5('0x5a')](_0x16d2c8[_0xaad5('0x4e')][_0xaad5('0x57')],_0x16d2c8[_0xaad5('0x4e')]['type']);return db[_0xaad5('0x51')]['create'](_0x16d2c8[_0xaad5('0x4e')],{'include':[{'model':db[_0xaad5('0x5b')],'as':_0xaad5('0x55')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xaad5('0x2a')](respondWithResult(_0x1b36a4,null))[_0xaad5('0x47')](handleError(_0x1b36a4,null));};exports['getFields']=function(_0x4c0fcc,_0x5deabf,_0x5b6588){var _0x1f5469=[{'name':_0xaad5('0x5c'),'label':_0xaad5('0x5c'),'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 _0x5a4ce5='';return db[_0xaad5('0x31')][_0xaad5('0x50')]({'where':{'id':_0x4c0fcc[_0xaad5('0x49')]['id']},'attributes':['id','remoteUri',_0xaad5('0x5d'),'username',_0xaad5('0x5e'),_0xaad5('0x5f'),_0xaad5('0x60'),'token','tokenSecret']})[_0xaad5('0x2a')](handleEntityNotFound(_0x5deabf,null))[_0xaad5('0x2a')](function(_0x29c156){if(_0x29c156){_0x5a4ce5=_0x29c156[_0xaad5('0x61')];var _0xd0774a=_0x5a4ce5[_0xaad5('0x62')](-0x1);if(_0xd0774a==='/'){_0x5a4ce5=_0x5a4ce5[_0xaad5('0x63')](0x0,_0x5a4ce5[_0xaad5('0x64')](_0xd0774a));}var _0x2ccf96={'method':_0xaad5('0x65'),'uri':util[_0xaad5('0x66')](_0xaad5('0x67'),_0x5a4ce5),'headers':{'Content-Type':_0xaad5('0x68'),'Accept':_0xaad5('0x68')},'json':!![]};if(_0x29c156['authType']===_0xaad5('0x69')){_0x2ccf96[_0xaad5('0x6a')][_0xaad5('0x6b')]=util[_0xaad5('0x66')](_0xaad5('0x6c'),new Buffer(util['format'](_0xaad5('0x6d'),_0x29c156[_0xaad5('0x6e')],_0x29c156[_0xaad5('0x5e')]))[_0xaad5('0x6f')](_0xaad5('0x70')));}return rp(_0x2ccf96)['then'](function(_0x3a51ad){return _0x1f5469['concat'](_[_0xaad5('0x30')](_0x3a51ad[_0xaad5('0x71')][_0xaad5('0x72')],function(_0x500def){return{'id':_0x500def[_0xaad5('0x2e')],'name':_0x500def[_0xaad5('0x2e')],'type':_0x500def['type'],'active':_0x500def['active'],'label':_0x500def['label'],'custom':!![]};}));});}})[_0xaad5('0x2a')](function(_0x2018a3){return{'count':_0x2018a3[_0xaad5('0x4b')],'rows':_0x2018a3};})[_0xaad5('0x2a')](respondWithResult(_0x5deabf,null))['catch'](function(_0x376c36){var _0x3db939=_0x4c0fcc[_0xaad5('0x36')][_0xaad5('0x73')]?0x1f4:_0x376c36[_0xaad5('0x74')]||0x1f4;logger['error'](_0xaad5('0x75'),'getFields',_0x3db939,JSON[_0xaad5('0x76')](_0x376c36));delete _0x376c36[_0xaad5('0x2e')];if(_0x3db939===0x191){_0x3db939=0x190;}_0x5deabf[_0xaad5('0x1e')](_0x3db939)[_0xaad5('0x77')](_0x4c0fcc[_0xaad5('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x376c36[_0xaad5('0x74')]}:_0x376c36);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7f9c3c1..e03b331 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 _0xc869=['../../config/logger','bluebird','rimraf','./intDeskAccount.attributes','exports','lodash','util'];(function(_0x29e757,_0x4dec36){var _0x30956f=function(_0x83825e){while(--_0x83825e){_0x29e757['push'](_0x29e757['shift']());}};_0x30956f(++_0x4dec36);}(_0xc869,0x16a));var _0x9c86=function(_0x311a18,_0x2d5409){_0x311a18=_0x311a18-0x0;var _0x4dd8c3=_0xc869[_0x311a18];return _0x4dd8c3;};'use strict';var _=require(_0x9c86('0x0'));var util=require(_0x9c86('0x1'));var logger=require(_0x9c86('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9c86('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c86('0x4'));var config=require('../../config/environment');var attributes=require(_0x9c86('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x9c86('0x6')]=function(_0x4fc958,_0x3f426a){return _0x4fc958['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad7d=['api','bluebird','request-promise','path','exports','define','util','../../config/logger'];(function(_0x4374c3,_0x526baa){var _0x366577=function(_0x55c303){while(--_0x55c303){_0x4374c3['push'](_0x4374c3['shift']());}};_0x366577(++_0x526baa);}(_0xad7d,0x176));var _0xdad7=function(_0x2b94e,_0x267b5e){_0x2b94e=_0x2b94e-0x0;var _0x120c29=_0xad7d[_0x2b94e];return _0x120c29;};'use strict';var _=require('lodash');var util=require(_0xdad7('0x0'));var logger=require(_0xdad7('0x1'))(_0xdad7('0x2'));var moment=require('moment');var BPromise=require(_0xdad7('0x3'));var rp=require(_0xdad7('0x4'));var fs=require('fs');var path=require(_0xdad7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xdad7('0x6')]=function(_0x5e691f,_0x4dce70){return _0x5e691f[_0xdad7('0x7')]('DeskAccount',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 ea07d5a..9288fe9 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 _0x6c74=['ShowDeskAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','limit','include','map','model','attributes','stringify'];(function(_0x37c44d,_0x5b0f13){var _0x2f7dea=function(_0x1cb858){while(--_0x1cb858){_0x37c44d['push'](_0x37c44d['shift']());}};_0x2f7dea(++_0x5b0f13);}(_0x6c74,0x89));var _0x46c7=function(_0x5c99ea,_0x44408a){_0x5c99ea=_0x5c99ea-0x0;var _0x428755=_0x6c74[_0x5c99ea];return _0x428755;};'use strict';var _=require(_0x46c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x46c7('0x1'));var rs=require(_0x46c7('0x2'));var fs=require('fs');var Redis=require(_0x46c7('0x3'));var db=require(_0x46c7('0x4'))['db'];var utils=require(_0x46c7('0x5'));var logger=require(_0x46c7('0x6'))(_0x46c7('0x7'));var config=require(_0x46c7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x221e26,_0x42e0bb,_0x36cd00){return new BPromise(function(_0x4e1d59,_0x3e800f){return client[_0x46c7('0xa')](_0x221e26,_0x36cd00)[_0x46c7('0xb')](function(_0x2ed58a){logger[_0x46c7('0xc')](_0x46c7('0xd'),_0x42e0bb,_0x46c7('0xe'));logger[_0x46c7('0xf')](_0x46c7('0x10'),_0x42e0bb,'request\x20sent',JSON['stringify'](_0x2ed58a));if(_0x2ed58a[_0x46c7('0x11')]){if(_0x2ed58a[_0x46c7('0x11')][_0x46c7('0x12')]===0x1f4){logger[_0x46c7('0x11')](_0x46c7('0xd'),_0x42e0bb,_0x2ed58a[_0x46c7('0x11')][_0x46c7('0x13')]);return _0x3e800f(_0x2ed58a[_0x46c7('0x11')][_0x46c7('0x13')]);}logger[_0x46c7('0x11')](_0x46c7('0xd'),_0x42e0bb,_0x2ed58a[_0x46c7('0x11')][_0x46c7('0x13')]);return _0x4e1d59(_0x2ed58a[_0x46c7('0x11')]['message']);}else{logger['info'](_0x46c7('0xd'),_0x42e0bb,_0x46c7('0xe'));_0x4e1d59(_0x2ed58a[_0x46c7('0x14')][_0x46c7('0x13')]);}})[_0x46c7('0x15')](function(_0x4a3faa){logger[_0x46c7('0x11')]('DeskAccount,\x20%s,\x20%s',_0x42e0bb,_0x4a3faa);_0x3e800f(_0x4a3faa);});});}exports[_0x46c7('0x16')]=function(_0x52f1b5){var _0x1cf3af=this;return new Promise(function(_0x1d2d69,_0x43116e){return db[_0x46c7('0x17')][_0x46c7('0x18')]({'raw':_0x52f1b5[_0x46c7('0x19')]?_0x52f1b5[_0x46c7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x52f1b5[_0x46c7('0x19')]?_0x52f1b5[_0x46c7('0x19')][_0x46c7('0x1a')]||null:null,'attributes':_0x52f1b5[_0x46c7('0x19')]?_0x52f1b5[_0x46c7('0x19')]['attributes']||null:null,'limit':_0x52f1b5[_0x46c7('0x19')]?_0x52f1b5['options'][_0x46c7('0x1b')]||null:null,'include':_0x52f1b5['options']?_0x52f1b5[_0x46c7('0x19')][_0x46c7('0x1c')]?_[_0x46c7('0x1d')](_0x52f1b5['options'][_0x46c7('0x1c')],function(_0x1b4d58){return{'model':db[_0x1b4d58[_0x46c7('0x1e')]],'as':_0x1b4d58['as'],'attributes':_0x1b4d58[_0x46c7('0x1f')],'include':_0x1b4d58[_0x46c7('0x1c')]?_[_0x46c7('0x1d')](_0x1b4d58[_0x46c7('0x1c')],function(_0x1022d9){return{'model':db[_0x1022d9[_0x46c7('0x1e')]],'as':_0x1022d9['as'],'attributes':_0x1022d9[_0x46c7('0x1f')],'include':_0x1022d9[_0x46c7('0x1c')]?_[_0x46c7('0x1d')](_0x1022d9['include'],function(_0x128d89){return{'model':db[_0x128d89['model']],'as':_0x128d89['as'],'attributes':_0x128d89['attributes']};}):[]};}):[]};}):[]:[]})[_0x46c7('0xb')](function(_0x2e2547){logger[_0x46c7('0xc')](_0x46c7('0x16'),_0x52f1b5);logger['debug'](_0x46c7('0x16'),_0x52f1b5,JSON[_0x46c7('0x20')](_0x2e2547));_0x1d2d69(_0x2e2547);})['catch'](function(_0x173290){logger[_0x46c7('0x11')]('GetDeskAccount',_0x173290[_0x46c7('0x13')],_0x52f1b5);_0x43116e(_0x1cf3af[_0x46c7('0x11')](0x1f4,_0x173290[_0x46c7('0x13')]));});});};exports[_0x46c7('0x21')]=function(_0x51a741){var _0x119c29=this;return new Promise(function(_0x50c32e,_0x36b366){return db['DeskAccount']['find']({'raw':_0x51a741[_0x46c7('0x19')]?_0x51a741[_0x46c7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51a741[_0x46c7('0x19')]?_0x51a741[_0x46c7('0x19')][_0x46c7('0x1a')]||null:null,'attributes':_0x51a741[_0x46c7('0x19')]?_0x51a741[_0x46c7('0x19')][_0x46c7('0x1f')]||null:null,'include':_0x51a741[_0x46c7('0x19')]?_0x51a741[_0x46c7('0x19')][_0x46c7('0x1c')]?_[_0x46c7('0x1d')](_0x51a741[_0x46c7('0x19')][_0x46c7('0x1c')],function(_0x46cee5){return{'model':db[_0x46cee5[_0x46c7('0x1e')]],'as':_0x46cee5['as'],'attributes':_0x46cee5[_0x46c7('0x1f')],'include':_0x46cee5[_0x46c7('0x1c')]?_[_0x46c7('0x1d')](_0x46cee5['include'],function(_0x3f98ec){return{'model':db[_0x3f98ec[_0x46c7('0x1e')]],'as':_0x3f98ec['as'],'attributes':_0x3f98ec[_0x46c7('0x1f')],'include':_0x3f98ec[_0x46c7('0x1c')]?_[_0x46c7('0x1d')](_0x3f98ec[_0x46c7('0x1c')],function(_0x36c9d3){return{'model':db[_0x36c9d3[_0x46c7('0x1e')]],'as':_0x36c9d3['as'],'attributes':_0x36c9d3[_0x46c7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x46c7('0xb')](function(_0xa3b870){logger[_0x46c7('0xc')]('ShowDeskAccount',_0x51a741);logger['debug']('ShowDeskAccount',_0x51a741,JSON[_0x46c7('0x20')](_0xa3b870));_0x50c32e(_0xa3b870);})[_0x46c7('0x15')](function(_0x3bbbb0){logger[_0x46c7('0x11')](_0x46c7('0x21'),_0x3bbbb0[_0x46c7('0x13')],_0x51a741);_0x36b366(_0x119c29['error'](0x1f4,_0x3bbbb0['message']));});});}; \ No newline at end of file +var _0x4b7b=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','include','map','model','attributes','debug','stringify','ShowDeskAccount','lodash','util','moment'];(function(_0x1dcd60,_0x5f4525){var _0x5a7481=function(_0x54c5e4){while(--_0x54c5e4){_0x1dcd60['push'](_0x1dcd60['shift']());}};_0x5a7481(++_0x5f4525);}(_0x4b7b,0x195));var _0xb4b7=function(_0x570c7e,_0x5472bd){_0x570c7e=_0x570c7e-0x0;var _0x213a73=_0x4b7b[_0x570c7e];return _0x213a73;};'use strict';var _=require(_0xb4b7('0x0'));var util=require(_0xb4b7('0x1'));var moment=require(_0xb4b7('0x2'));var BPromise=require(_0xb4b7('0x3'));var rs=require(_0xb4b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4b7('0x5'))['db'];var utils=require(_0xb4b7('0x6'));var logger=require(_0xb4b7('0x7'))('rpc');var config=require(_0xb4b7('0x8'));var jayson=require(_0xb4b7('0x9'));var client=jayson[_0xb4b7('0xa')][_0xb4b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f1ea4,_0x4f2b24,_0x63f7ab){return new BPromise(function(_0x2193d1,_0x2be4f4){return client[_0xb4b7('0xc')](_0x4f1ea4,_0x63f7ab)[_0xb4b7('0xd')](function(_0x3b88c8){logger[_0xb4b7('0xe')](_0xb4b7('0xf'),_0x4f2b24,_0xb4b7('0x10'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4f2b24,_0xb4b7('0x10'),JSON['stringify'](_0x3b88c8));if(_0x3b88c8['error']){if(_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x12')]===0x1f4){logger[_0xb4b7('0x11')](_0xb4b7('0xf'),_0x4f2b24,_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x13')]);return _0x2be4f4(_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x13')]);}logger[_0xb4b7('0x11')](_0xb4b7('0xf'),_0x4f2b24,_0x3b88c8[_0xb4b7('0x11')]['message']);return _0x2193d1(_0x3b88c8[_0xb4b7('0x11')][_0xb4b7('0x13')]);}else{logger['info'](_0xb4b7('0xf'),_0x4f2b24,_0xb4b7('0x10'));_0x2193d1(_0x3b88c8[_0xb4b7('0x14')][_0xb4b7('0x13')]);}})[_0xb4b7('0x15')](function(_0x23e45b){logger[_0xb4b7('0x11')](_0xb4b7('0xf'),_0x4f2b24,_0x23e45b);_0x2be4f4(_0x23e45b);});});}exports[_0xb4b7('0x16')]=function(_0x5cb10a){var _0x3fddcd=this;return new Promise(function(_0x3592c0,_0x479182){return db[_0xb4b7('0x17')]['findAll']({'raw':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a[_0xb4b7('0x18')][_0xb4b7('0x19')]===undefined?!![]:![]:!![],'where':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a['options'][_0xb4b7('0x1a')]||null:null,'attributes':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a[_0xb4b7('0x18')]['attributes']||null:null,'limit':_0x5cb10a[_0xb4b7('0x18')]?_0x5cb10a['options']['limit']||null:null,'include':_0x5cb10a['options']?_0x5cb10a[_0xb4b7('0x18')][_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x5cb10a[_0xb4b7('0x18')]['include'],function(_0x99fef5){return{'model':db[_0x99fef5[_0xb4b7('0x1d')]],'as':_0x99fef5['as'],'attributes':_0x99fef5[_0xb4b7('0x1e')],'include':_0x99fef5[_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x99fef5['include'],function(_0xa34b6b){return{'model':db[_0xa34b6b['model']],'as':_0xa34b6b['as'],'attributes':_0xa34b6b[_0xb4b7('0x1e')],'include':_0xa34b6b[_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0xa34b6b[_0xb4b7('0x1b')],function(_0x23991a){return{'model':db[_0x23991a[_0xb4b7('0x1d')]],'as':_0x23991a['as'],'attributes':_0x23991a[_0xb4b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb4b7('0xd')](function(_0x41d27d){logger[_0xb4b7('0xe')](_0xb4b7('0x16'),_0x5cb10a);logger[_0xb4b7('0x1f')](_0xb4b7('0x16'),_0x5cb10a,JSON[_0xb4b7('0x20')](_0x41d27d));_0x3592c0(_0x41d27d);})[_0xb4b7('0x15')](function(_0x2ce2dc){logger['error'](_0xb4b7('0x16'),_0x2ce2dc['message'],_0x5cb10a);_0x479182(_0x3fddcd['error'](0x1f4,_0x2ce2dc[_0xb4b7('0x13')]));});});};exports[_0xb4b7('0x21')]=function(_0x450a51){var _0x5c7617=this;return new Promise(function(_0x32c12f,_0x41dfa8){return db['DeskAccount']['find']({'raw':_0x450a51['options']?_0x450a51[_0xb4b7('0x18')][_0xb4b7('0x19')]===undefined?!![]:![]:!![],'where':_0x450a51[_0xb4b7('0x18')]?_0x450a51[_0xb4b7('0x18')][_0xb4b7('0x1a')]||null:null,'attributes':_0x450a51[_0xb4b7('0x18')]?_0x450a51[_0xb4b7('0x18')]['attributes']||null:null,'include':_0x450a51[_0xb4b7('0x18')]?_0x450a51[_0xb4b7('0x18')][_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x450a51[_0xb4b7('0x18')]['include'],function(_0x3183ba){return{'model':db[_0x3183ba[_0xb4b7('0x1d')]],'as':_0x3183ba['as'],'attributes':_0x3183ba[_0xb4b7('0x1e')],'include':_0x3183ba[_0xb4b7('0x1b')]?_['map'](_0x3183ba[_0xb4b7('0x1b')],function(_0x8352c5){return{'model':db[_0x8352c5[_0xb4b7('0x1d')]],'as':_0x8352c5['as'],'attributes':_0x8352c5[_0xb4b7('0x1e')],'include':_0x8352c5[_0xb4b7('0x1b')]?_[_0xb4b7('0x1c')](_0x8352c5[_0xb4b7('0x1b')],function(_0x5c95f7){return{'model':db[_0x5c95f7['model']],'as':_0x5c95f7['as'],'attributes':_0x5c95f7['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4b7('0xd')](function(_0x5da9cc){logger['info']('ShowDeskAccount',_0x450a51);logger[_0xb4b7('0x1f')]('ShowDeskAccount',_0x450a51,JSON[_0xb4b7('0x20')](_0x5da9cc));_0x32c12f(_0x5da9cc);})[_0xb4b7('0x15')](function(_0xe95a60){logger[_0xb4b7('0x11')](_0xb4b7('0x21'),_0xe95a60[_0xb4b7('0x13')],_0x450a51);_0x41dfa8(_0x5c7617[_0xb4b7('0x11')](0x1f4,_0xe95a60[_0xb4b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 30bc314..1cecbfd 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5d8b71,_0x3a6fe3){var _0x2e2525=function(_0x84e9fa){while(--_0x84e9fa){_0x5d8b71['push'](_0x5d8b71['shift']());}};_0x2e2525(++_0x3a6fe3);}(_0x3e74,0x175));var _0x43e7=function(_0x1b13cc,_0x5303cd){_0x1b13cc=_0x1b13cc-0x0;var _0x4ebcf0=_0x3e74[_0x1b13cc];return _0x4ebcf0;};'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/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4325a5,_0x28661b){var _0x492651=function(_0x554139){while(--_0x554139){_0x4325a5['push'](_0x4325a5['shift']());}};_0x492651(++_0x28661b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d53fae8..efd601b 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 _0x315c=['STRING','sequelize','exports'];(function(_0x43e517,_0x4f76ac){var _0x136c50=function(_0x3477b4){while(--_0x3477b4){_0x43e517['push'](_0x43e517['shift']());}};_0x136c50(++_0x4f76ac);}(_0x315c,0x115));var _0xc315=function(_0x48fe37,_0x11711b){_0x48fe37=_0x48fe37-0x0;var _0x2da5c8=_0x315c[_0x48fe37];return _0x2da5c8;};'use strict';var Sequelize=require(_0xc315('0x0'));module[_0xc315('0x1')]={'name':{'type':Sequelize[_0xc315('0x2')]},'description':{'type':Sequelize[_0xc315('0x2')]}}; \ No newline at end of file +var _0x9cd4=['sequelize','exports','STRING'];(function(_0x8a53f9,_0x3dca53){var _0x2432dc=function(_0x47d0a1){while(--_0x47d0a1){_0x8a53f9['push'](_0x8a53f9['shift']());}};_0x2432dc(++_0x3dca53);}(_0x9cd4,0x1e6));var _0x49cd=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x9cd4[_0x4d1d2c];return _0x2c4cb9;};'use strict';var Sequelize=require(_0x49cd('0x0'));module[_0x49cd('0x1')]={'name':{'type':Sequelize[_0x49cd('0x2')]},'description':{'type':Sequelize[_0x49cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index d002be9..9eeff22 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 _0xa520=['destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','update','find','getFields','DeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','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','limit','count','offset','set','Content-Range','apply','reject','then'];(function(_0x12378d,_0x185735){var _0x39dd72=function(_0x23982e){while(--_0x23982e){_0x12378d['push'](_0x12378d['shift']());}};_0x39dd72(++_0x185735);}(_0xa520,0x13a));var _0x0a52=function(_0x22c5b2,_0x3911e3){_0x22c5b2=_0x22c5b2-0x0;var _0x418bf0=_0xa520[_0x22c5b2];return _0x418bf0;};'use strict';var emlformat=require(_0x0a52('0x0'));var rimraf=require(_0x0a52('0x1'));var zipdir=require(_0x0a52('0x2'));var jsonpatch=require(_0x0a52('0x3'));var rp=require(_0x0a52('0x4'));var moment=require(_0x0a52('0x5'));var BPromise=require(_0x0a52('0x6'));var Mustache=require(_0x0a52('0x7'));var util=require(_0x0a52('0x8'));var path=require(_0x0a52('0x9'));var sox=require(_0x0a52('0xa'));var csv=require(_0x0a52('0xb'));var ejs=require(_0x0a52('0xc'));var fs=require('fs');var fs_extra=require(_0x0a52('0xd'));var _=require(_0x0a52('0xe'));var squel=require(_0x0a52('0xf'));var crypto=require(_0x0a52('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x0a52('0x11'));var toCsv=require(_0x0a52('0xb'));var querystring=require(_0x0a52('0x12'));var Papa=require(_0x0a52('0x13'));var Redis=require(_0x0a52('0x14'));var authService=require(_0x0a52('0x15'));var qs=require(_0x0a52('0x16'));var as=require(_0x0a52('0x17'));var hardwareService=require(_0x0a52('0x18'));var logger=require(_0x0a52('0x19'))(_0x0a52('0x1a'));var utils=require(_0x0a52('0x1b'));var config=require(_0x0a52('0x1c'));var licenseUtil=require(_0x0a52('0x1d'));var db=require(_0x0a52('0x1e'))['db'];function respondWithStatusCode(_0x23a8b7,_0x458416){_0x458416=_0x458416||0xcc;return function(_0x263dfe){if(_0x263dfe){return _0x23a8b7[_0x0a52('0x1f')](_0x458416);}return _0x23a8b7[_0x0a52('0x20')](_0x458416)[_0x0a52('0x21')]();};}function respondWithResult(_0x330077,_0x35147a){_0x35147a=_0x35147a||0xc8;return function(_0xd1271f){if(_0xd1271f){return _0x330077[_0x0a52('0x20')](_0x35147a)['json'](_0xd1271f);}};}function respondWithFilteredResult(_0x30e3d5,_0xb3915d){return function(_0x5514ef){if(_0x5514ef){var _0x52ed3a=typeof _0xb3915d['offset']==='undefined'&&typeof _0xb3915d[_0x0a52('0x22')]==='undefined';var _0x5eefd4=_0x5514ef[_0x0a52('0x23')];var _0x56ec7a=_0x52ed3a?0x0:_0xb3915d[_0x0a52('0x24')];var _0x46497c=_0x52ed3a?_0x5514ef[_0x0a52('0x23')]:_0xb3915d['offset']+_0xb3915d[_0x0a52('0x22')];var _0x1034ae;if(_0x46497c>=_0x5eefd4){_0x46497c=_0x5eefd4;_0x1034ae=0xc8;}else{_0x1034ae=0xce;}_0x30e3d5['status'](_0x1034ae);return _0x30e3d5[_0x0a52('0x25')](_0x0a52('0x26'),_0x56ec7a+'-'+_0x46497c+'/'+_0x5eefd4)['json'](_0x5514ef);}return null;};}function patchUpdates(_0x57292a){return function(_0x4032f5){try{jsonpatch[_0x0a52('0x27')](_0x4032f5,_0x57292a,!![]);}catch(_0x41376f){return BPromise[_0x0a52('0x28')](_0x41376f);}return _0x4032f5['save']();};}function saveUpdates(_0xf0a4c0,_0x7b678c){return function(_0x5cce7f){if(_0x5cce7f){return _0x5cce7f['update'](_0xf0a4c0)[_0x0a52('0x29')](function(_0x54fdf8){return _0x54fdf8;});}return null;};}function removeEntity(_0xa2d3d8,_0x1abfac){return function(_0x2e1185){if(_0x2e1185){return _0x2e1185[_0x0a52('0x2a')]()[_0x0a52('0x29')](function(){_0xa2d3d8[_0x0a52('0x20')](0xcc)[_0x0a52('0x21')]();});}};}function handleEntityNotFound(_0x1876db,_0x2a9719){return function(_0x271013){if(!_0x271013){_0x1876db['sendStatus'](0x194);}return _0x271013;};}function handleError(_0x2bf608,_0x2a3563){_0x2a3563=_0x2a3563||0x1f4;return function(_0x4c19d0){logger[_0x0a52('0x2b')](_0x4c19d0[_0x0a52('0x2c')]);if(_0x4c19d0[_0x0a52('0x2d')]){delete _0x4c19d0[_0x0a52('0x2d')];}_0x2bf608['status'](_0x2a3563)['send'](_0x4c19d0);};}exports[_0x0a52('0x2e')]=function(_0x2121c0,_0xa7c365){var _0x542c6b={},_0x4e3c8e={},_0x47cead={'count':0x0,'rows':[]};var _0x39d8fc=_[_0x0a52('0x2f')](db[_0x0a52('0x30')][_0x0a52('0x31')],function(_0x12261f){return{'name':_0x12261f[_0x0a52('0x32')],'type':_0x12261f[_0x0a52('0x33')][_0x0a52('0x34')]};});_0x4e3c8e['model']=_[_0x0a52('0x2f')](_0x39d8fc,_0x0a52('0x2d'));_0x4e3c8e[_0x0a52('0x35')]=_[_0x0a52('0x36')](_0x2121c0['query']);_0x4e3c8e[_0x0a52('0x37')]=_[_0x0a52('0x38')](_0x4e3c8e[_0x0a52('0x39')],_0x4e3c8e[_0x0a52('0x35')]);_0x542c6b[_0x0a52('0x3a')]=_[_0x0a52('0x38')](_0x4e3c8e['model'],qs[_0x0a52('0x3b')](_0x2121c0[_0x0a52('0x35')][_0x0a52('0x3b')]));_0x542c6b[_0x0a52('0x3a')]=_0x542c6b['attributes'][_0x0a52('0x3c')]?_0x542c6b['attributes']:_0x4e3c8e[_0x0a52('0x39')];if(!_0x2121c0[_0x0a52('0x35')]['hasOwnProperty'](_0x0a52('0x3d'))){_0x542c6b[_0x0a52('0x22')]=qs['limit'](_0x2121c0[_0x0a52('0x35')][_0x0a52('0x22')]);_0x542c6b[_0x0a52('0x24')]=qs[_0x0a52('0x24')](_0x2121c0[_0x0a52('0x35')]['offset']);}_0x542c6b[_0x0a52('0x3e')]=qs[_0x0a52('0x3f')](_0x2121c0['query'][_0x0a52('0x3f')]);_0x542c6b[_0x0a52('0x40')]=qs['filters'](_[_0x0a52('0x41')](_0x2121c0[_0x0a52('0x35')],_0x4e3c8e[_0x0a52('0x37')]),_0x39d8fc);if(_0x2121c0['query'][_0x0a52('0x42')]){_0x542c6b['where']=_[_0x0a52('0x43')](_0x542c6b[_0x0a52('0x40')],{'$or':_[_0x0a52('0x2f')](_0x39d8fc,function(_0x2d839f){if(_0x2d839f[_0x0a52('0x33')]!==_0x0a52('0x44')){var _0x4d0b64={};_0x4d0b64[_0x2d839f['name']]={'$like':'%'+_0x2121c0[_0x0a52('0x35')][_0x0a52('0x42')]+'%'};return _0x4d0b64;}})});}_0x542c6b=_[_0x0a52('0x43')]({},_0x542c6b,_0x2121c0[_0x0a52('0x45')]);var _0x55b479={'where':_0x542c6b['where']};return db['DeskConfiguration'][_0x0a52('0x23')](_0x55b479)[_0x0a52('0x29')](function(_0x1c2737){_0x47cead[_0x0a52('0x23')]=_0x1c2737;if(_0x2121c0[_0x0a52('0x35')][_0x0a52('0x46')]){_0x542c6b[_0x0a52('0x47')]=[{'all':!![]}];}return db[_0x0a52('0x30')]['findAll'](_0x542c6b);})[_0x0a52('0x29')](function(_0xf34434){_0x47cead[_0x0a52('0x48')]=_0xf34434;return _0x47cead;})['then'](respondWithFilteredResult(_0xa7c365,_0x542c6b))['catch'](handleError(_0xa7c365,null));};exports[_0x0a52('0x49')]=function(_0x3953fa,_0x1c8ee9){var _0x450ef9={'raw':![],'where':{'id':_0x3953fa[_0x0a52('0x4a')]['id']}},_0x2f0b69={};_0x2f0b69[_0x0a52('0x39')]=_[_0x0a52('0x36')](db[_0x0a52('0x30')]['rawAttributes']);_0x2f0b69[_0x0a52('0x35')]=_[_0x0a52('0x36')](_0x3953fa[_0x0a52('0x35')]);_0x2f0b69[_0x0a52('0x37')]=_[_0x0a52('0x38')](_0x2f0b69[_0x0a52('0x39')],_0x2f0b69[_0x0a52('0x35')]);_0x450ef9[_0x0a52('0x3a')]=_[_0x0a52('0x38')](_0x2f0b69[_0x0a52('0x39')],qs['fields'](_0x3953fa[_0x0a52('0x35')][_0x0a52('0x3b')]));_0x450ef9[_0x0a52('0x3a')]=_0x450ef9[_0x0a52('0x3a')][_0x0a52('0x3c')]?_0x450ef9['attributes']:_0x2f0b69[_0x0a52('0x39')];if(_0x3953fa['query'][_0x0a52('0x46')]){_0x450ef9[_0x0a52('0x47')]=[{'all':!![]}];}_0x450ef9=_['merge']({},_0x450ef9,_0x3953fa[_0x0a52('0x45')]);return db[_0x0a52('0x30')]['find'](_0x450ef9)[_0x0a52('0x29')](handleEntityNotFound(_0x1c8ee9,null))['then'](respondWithResult(_0x1c8ee9,null))[_0x0a52('0x4b')](handleError(_0x1c8ee9,null));};exports[_0x0a52('0x4c')]=function(_0x56e647,_0x3131a0){return db[_0x0a52('0x30')]['create'](_0x56e647[_0x0a52('0x4d')],{})['then'](respondWithResult(_0x3131a0,0xc9))['catch'](handleError(_0x3131a0,null));};exports[_0x0a52('0x4e')]=function(_0x448bed,_0x3abf52){if(_0x448bed[_0x0a52('0x4d')]['id']){delete _0x448bed[_0x0a52('0x4d')]['id'];}return db[_0x0a52('0x30')][_0x0a52('0x4f')]({'where':{'id':_0x448bed[_0x0a52('0x4a')]['id']}})[_0x0a52('0x29')](handleEntityNotFound(_0x3abf52,null))[_0x0a52('0x29')](saveUpdates(_0x448bed[_0x0a52('0x4d')],null))[_0x0a52('0x29')](respondWithResult(_0x3abf52,null))[_0x0a52('0x4b')](handleError(_0x3abf52,null));};exports[_0x0a52('0x2a')]=function(_0x377b84,_0x4edc){return db[_0x0a52('0x30')][_0x0a52('0x4f')]({'where':{'id':_0x377b84[_0x0a52('0x4a')]['id']}})[_0x0a52('0x29')](handleEntityNotFound(_0x4edc,null))['then'](removeEntity(_0x4edc,null))[_0x0a52('0x4b')](handleError(_0x4edc,null));};exports[_0x0a52('0x50')]=function(_0x3d5867,_0x802ba9,_0x8948b8){var _0x4d50c4={};var _0x48d578={};var _0x5dc10a;var _0x5372af;return db[_0x0a52('0x30')]['findOne']({'where':{'id':_0x3d5867[_0x0a52('0x4a')]['id']}})['then'](handleEntityNotFound(_0x802ba9,null))[_0x0a52('0x29')](function(_0x5001df){if(_0x5001df){_0x5dc10a=_0x5001df;_0x48d578[_0x0a52('0x39')]=_[_0x0a52('0x36')](db[_0x0a52('0x51')][_0x0a52('0x31')]);_0x48d578[_0x0a52('0x35')]=_[_0x0a52('0x36')](_0x3d5867[_0x0a52('0x35')]);_0x48d578[_0x0a52('0x37')]=_['intersection'](_0x48d578['model'],_0x48d578[_0x0a52('0x35')]);_0x4d50c4[_0x0a52('0x3a')]=_[_0x0a52('0x38')](_0x48d578['model'],qs[_0x0a52('0x3b')](_0x3d5867[_0x0a52('0x35')]['fields']));_0x4d50c4['attributes']=_0x4d50c4[_0x0a52('0x3a')]['length']?_0x4d50c4[_0x0a52('0x3a')]:_0x48d578['model'];_0x4d50c4[_0x0a52('0x3e')]=qs[_0x0a52('0x3f')](_0x3d5867[_0x0a52('0x35')][_0x0a52('0x3f')]);_0x4d50c4[_0x0a52('0x40')]=qs['filters'](_[_0x0a52('0x41')](_0x3d5867[_0x0a52('0x35')],_0x48d578['filters']));if(_0x3d5867[_0x0a52('0x35')][_0x0a52('0x42')]){_0x4d50c4[_0x0a52('0x40')]=_['merge'](_0x4d50c4[_0x0a52('0x40')],{'$or':_[_0x0a52('0x2f')](_0x4d50c4[_0x0a52('0x3a')],function(_0x97d9f){var _0x27a3e6={};_0x27a3e6[_0x97d9f]={'$like':'%'+_0x3d5867[_0x0a52('0x35')]['filter']+'%'};return _0x27a3e6;})});}_0x4d50c4=_[_0x0a52('0x43')]({},_0x4d50c4,_0x3d5867[_0x0a52('0x45')]);return _0x5dc10a['getFields'](_0x4d50c4);}})[_0x0a52('0x29')](function(_0x20e3b0){if(_0x20e3b0){_0x5372af=_0x20e3b0[_0x0a52('0x3c')];if(!_0x3d5867[_0x0a52('0x35')][_0x0a52('0x52')](_0x0a52('0x3d'))){_0x4d50c4['limit']=qs[_0x0a52('0x22')](_0x3d5867[_0x0a52('0x35')]['limit']);_0x4d50c4[_0x0a52('0x24')]=qs[_0x0a52('0x24')](_0x3d5867[_0x0a52('0x35')][_0x0a52('0x24')]);}return _0x5dc10a['getFields'](_0x4d50c4);}})['then'](function(_0x52a160){if(_0x52a160){return _0x52a160?{'count':_0x5372af,'rows':_0x52a160}:null;}})[_0x0a52('0x29')](respondWithResult(_0x802ba9,null))['catch'](handleError(_0x802ba9,null));};exports[_0x0a52('0x53')]=function(_0x4dc78f,_0x5b334d,_0x286b58){var _0x114ede={};var _0x4461c5={};var _0x5aa28f;var _0x2c1314;return db[_0x0a52('0x30')][_0x0a52('0x54')]({'where':{'id':_0x4dc78f['params']['id']}})[_0x0a52('0x29')](handleEntityNotFound(_0x5b334d,null))[_0x0a52('0x29')](function(_0x8d2aff){if(_0x8d2aff){_0x5aa28f=_0x8d2aff;_0x4461c5[_0x0a52('0x39')]=_[_0x0a52('0x36')](db[_0x0a52('0x51')][_0x0a52('0x31')]);_0x4461c5[_0x0a52('0x35')]=_[_0x0a52('0x36')](_0x4dc78f['query']);_0x4461c5[_0x0a52('0x37')]=_['intersection'](_0x4461c5[_0x0a52('0x39')],_0x4461c5[_0x0a52('0x35')]);_0x114ede[_0x0a52('0x3a')]=_[_0x0a52('0x38')](_0x4461c5['model'],qs[_0x0a52('0x3b')](_0x4dc78f[_0x0a52('0x35')]['fields']));_0x114ede['attributes']=_0x114ede['attributes'][_0x0a52('0x3c')]?_0x114ede[_0x0a52('0x3a')]:_0x4461c5[_0x0a52('0x39')];_0x114ede[_0x0a52('0x3e')]=qs[_0x0a52('0x3f')](_0x4dc78f[_0x0a52('0x35')][_0x0a52('0x3f')]);_0x114ede[_0x0a52('0x40')]=qs['filters'](_[_0x0a52('0x41')](_0x4dc78f[_0x0a52('0x35')],_0x4461c5[_0x0a52('0x37')]));if(_0x4dc78f[_0x0a52('0x35')]['filter']){_0x114ede[_0x0a52('0x40')]=_['merge'](_0x114ede['where'],{'$or':_[_0x0a52('0x2f')](_0x114ede[_0x0a52('0x3a')],function(_0x3138b7){var _0x4ac404={};_0x4ac404[_0x3138b7]={'$like':'%'+_0x4dc78f[_0x0a52('0x35')][_0x0a52('0x42')]+'%'};return _0x4ac404;})});}_0x114ede=_[_0x0a52('0x43')]({},_0x114ede,_0x4dc78f[_0x0a52('0x45')]);return _0x5aa28f[_0x0a52('0x53')](_0x114ede);}})['then'](function(_0x5a51a2){if(_0x5a51a2){_0x2c1314=_0x5a51a2[_0x0a52('0x3c')];if(!_0x4dc78f[_0x0a52('0x35')][_0x0a52('0x52')](_0x0a52('0x3d'))){_0x114ede[_0x0a52('0x22')]=qs[_0x0a52('0x22')](_0x4dc78f[_0x0a52('0x35')]['limit']);_0x114ede['offset']=qs[_0x0a52('0x24')](_0x4dc78f[_0x0a52('0x35')][_0x0a52('0x24')]);}return _0x5aa28f['getSubjects'](_0x114ede);}})[_0x0a52('0x29')](function(_0x8e590e){if(_0x8e590e){return _0x8e590e?{'count':_0x2c1314,'rows':_0x8e590e}:null;}})['then'](respondWithResult(_0x5b334d,null))[_0x0a52('0x4b')](handleError(_0x5b334d,null));};exports[_0x0a52('0x55')]=function(_0x56a0fb,_0xf94371,_0x32fb40){var _0x38f542={};var _0x281e03={};var _0x299013;var _0x2955a6;return db[_0x0a52('0x30')][_0x0a52('0x54')]({'where':{'id':_0x56a0fb[_0x0a52('0x4a')]['id']}})[_0x0a52('0x29')](handleEntityNotFound(_0xf94371,null))[_0x0a52('0x29')](function(_0x102d10){if(_0x102d10){_0x299013=_0x102d10;_0x281e03[_0x0a52('0x39')]=_[_0x0a52('0x36')](db[_0x0a52('0x51')][_0x0a52('0x31')]);_0x281e03[_0x0a52('0x35')]=_['keys'](_0x56a0fb['query']);_0x281e03[_0x0a52('0x37')]=_[_0x0a52('0x38')](_0x281e03[_0x0a52('0x39')],_0x281e03['query']);_0x38f542['attributes']=_[_0x0a52('0x38')](_0x281e03['model'],qs['fields'](_0x56a0fb[_0x0a52('0x35')]['fields']));_0x38f542['attributes']=_0x38f542[_0x0a52('0x3a')]['length']?_0x38f542['attributes']:_0x281e03[_0x0a52('0x39')];_0x38f542[_0x0a52('0x3e')]=qs[_0x0a52('0x3f')](_0x56a0fb[_0x0a52('0x35')]['sort']);_0x38f542[_0x0a52('0x40')]=qs['filters'](_[_0x0a52('0x41')](_0x56a0fb[_0x0a52('0x35')],_0x281e03[_0x0a52('0x37')]));if(_0x56a0fb['query']['filter']){_0x38f542[_0x0a52('0x40')]=_['merge'](_0x38f542[_0x0a52('0x40')],{'$or':_[_0x0a52('0x2f')](_0x38f542[_0x0a52('0x3a')],function(_0x11d7c7){var _0x430938={};_0x430938[_0x11d7c7]={'$like':'%'+_0x56a0fb['query'][_0x0a52('0x42')]+'%'};return _0x430938;})});}_0x38f542=_[_0x0a52('0x43')]({},_0x38f542,_0x56a0fb[_0x0a52('0x45')]);return _0x299013[_0x0a52('0x55')](_0x38f542);}})[_0x0a52('0x29')](function(_0x19dd8d){if(_0x19dd8d){_0x2955a6=_0x19dd8d[_0x0a52('0x3c')];if(!_0x56a0fb[_0x0a52('0x35')][_0x0a52('0x52')](_0x0a52('0x3d'))){_0x38f542[_0x0a52('0x22')]=qs[_0x0a52('0x22')](_0x56a0fb[_0x0a52('0x35')]['limit']);_0x38f542[_0x0a52('0x24')]=qs[_0x0a52('0x24')](_0x56a0fb[_0x0a52('0x35')][_0x0a52('0x24')]);}return _0x299013[_0x0a52('0x55')](_0x38f542);}})[_0x0a52('0x29')](function(_0x344edb){if(_0x344edb){return _0x344edb?{'count':_0x2955a6,'rows':_0x344edb}:null;}})[_0x0a52('0x29')](respondWithResult(_0xf94371,null))[_0x0a52('0x4b')](handleError(_0xf94371,null));};exports[_0x0a52('0x56')]=function(_0x38af8b,_0x17626d,_0x20d66c){var _0x4bfcaa={};var _0x3692e7={};var _0x1ba097;var _0x101bf5;return db['DeskConfiguration'][_0x0a52('0x54')]({'where':{'id':_0x38af8b[_0x0a52('0x4a')]['id']}})[_0x0a52('0x29')](handleEntityNotFound(_0x17626d,null))[_0x0a52('0x29')](function(_0x123068){if(_0x123068){_0x1ba097=_0x123068;_0x3692e7[_0x0a52('0x39')]=_['keys'](db['Tag'][_0x0a52('0x31')]);_0x3692e7[_0x0a52('0x35')]=_[_0x0a52('0x36')](_0x38af8b[_0x0a52('0x35')]);_0x3692e7[_0x0a52('0x37')]=_[_0x0a52('0x38')](_0x3692e7['model'],_0x3692e7[_0x0a52('0x35')]);_0x4bfcaa['attributes']=_[_0x0a52('0x38')](_0x3692e7[_0x0a52('0x39')],qs[_0x0a52('0x3b')](_0x38af8b[_0x0a52('0x35')][_0x0a52('0x3b')]));_0x4bfcaa[_0x0a52('0x3a')]=_0x4bfcaa[_0x0a52('0x3a')][_0x0a52('0x3c')]?_0x4bfcaa['attributes']:_0x3692e7[_0x0a52('0x39')];_0x4bfcaa[_0x0a52('0x3e')]=qs[_0x0a52('0x3f')](_0x38af8b['query'][_0x0a52('0x3f')]);_0x4bfcaa['where']=qs[_0x0a52('0x37')](_[_0x0a52('0x41')](_0x38af8b['query'],_0x3692e7[_0x0a52('0x37')]));if(_0x38af8b[_0x0a52('0x35')][_0x0a52('0x42')]){_0x4bfcaa[_0x0a52('0x40')]=_['merge'](_0x4bfcaa[_0x0a52('0x40')],{'$or':_['map'](_0x4bfcaa[_0x0a52('0x3a')],function(_0xd23988){var _0x305190={};_0x305190[_0xd23988]={'$like':'%'+_0x38af8b[_0x0a52('0x35')][_0x0a52('0x42')]+'%'};return _0x305190;})});}_0x4bfcaa=_[_0x0a52('0x43')]({},_0x4bfcaa,_0x38af8b[_0x0a52('0x45')]);return _0x1ba097[_0x0a52('0x56')](_0x4bfcaa);}})['then'](function(_0x224af7){if(_0x224af7){_0x101bf5=_0x224af7[_0x0a52('0x3c')];if(!_0x38af8b[_0x0a52('0x35')][_0x0a52('0x52')](_0x0a52('0x3d'))){_0x4bfcaa['limit']=qs['limit'](_0x38af8b[_0x0a52('0x35')][_0x0a52('0x22')]);_0x4bfcaa[_0x0a52('0x24')]=qs[_0x0a52('0x24')](_0x38af8b[_0x0a52('0x35')][_0x0a52('0x24')]);}return _0x1ba097[_0x0a52('0x56')](_0x4bfcaa);}})['then'](function(_0x5e964e){if(_0x5e964e){return _0x5e964e?{'count':_0x101bf5,'rows':_0x5e964e}:null;}})[_0x0a52('0x29')](respondWithResult(_0x17626d,null))['catch'](handleError(_0x17626d,null));};exports[_0x0a52('0x57')]=function(_0x4b262d,_0x4bc492,_0xc07bcc){if(_0x4b262d[_0x0a52('0x4d')]['id']){delete _0x4b262d['body']['id'];}return db[_0x0a52('0x30')][_0x0a52('0x54')]({'where':{'id':_0x4b262d['params']['id']}})[_0x0a52('0x29')](handleEntityNotFound(_0x4bc492,null))[_0x0a52('0x29')](function(_0x51719f){if(_0x51719f){return _0x51719f[_0x0a52('0x57')](_0x4b262d[_0x0a52('0x4d')][_0x0a52('0x58')]||[]);}return null;})[_0x0a52('0x29')](respondWithResult(_0x4bc492,null))[_0x0a52('0x4b')](handleError(_0x4bc492,null));}; \ No newline at end of file +var _0x406b=['lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','DeskConfiguration','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','rows','catch','show','params','merge','options','find','create','body','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x4706c6,_0x23d052){var _0x2d7a25=function(_0xdb502f){while(--_0xdb502f){_0x4706c6['push'](_0x4706c6['shift']());}};_0x2d7a25(++_0x23d052);}(_0x406b,0xe7));var _0xb406=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x406b[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xb406('0x0'));var rimraf=require(_0xb406('0x1'));var zipdir=require(_0xb406('0x2'));var jsonpatch=require(_0xb406('0x3'));var rp=require(_0xb406('0x4'));var moment=require(_0xb406('0x5'));var BPromise=require(_0xb406('0x6'));var Mustache=require('mustache');var util=require(_0xb406('0x7'));var path=require(_0xb406('0x8'));var sox=require('sox');var csv=require(_0xb406('0x9'));var ejs=require(_0xb406('0xa'));var fs=require('fs');var fs_extra=require(_0xb406('0xb'));var _=require(_0xb406('0xc'));var squel=require(_0xb406('0xd'));var crypto=require(_0xb406('0xe'));var jsforce=require(_0xb406('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb406('0x9'));var querystring=require(_0xb406('0x10'));var Papa=require(_0xb406('0x11'));var Redis=require('ioredis');var authService=require(_0xb406('0x12'));var qs=require(_0xb406('0x13'));var as=require(_0xb406('0x14'));var hardwareService=require(_0xb406('0x15'));var logger=require('../../config/logger')(_0xb406('0x16'));var utils=require(_0xb406('0x17'));var config=require(_0xb406('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8349,_0x1b3915){_0x1b3915=_0x1b3915||0xcc;return function(_0x11205b){if(_0x11205b){return _0x1f8349[_0xb406('0x19')](_0x1b3915);}return _0x1f8349['status'](_0x1b3915)[_0xb406('0x1a')]();};}function respondWithResult(_0x3b6c75,_0x456872){_0x456872=_0x456872||0xc8;return function(_0xf11d15){if(_0xf11d15){return _0x3b6c75[_0xb406('0x1b')](_0x456872)[_0xb406('0x1c')](_0xf11d15);}};}function respondWithFilteredResult(_0x2f00d1,_0x56f8db){return function(_0x4d44e0){if(_0x4d44e0){var _0x5f2d36=typeof _0x56f8db[_0xb406('0x1d')]==='undefined'&&typeof _0x56f8db[_0xb406('0x1e')]===_0xb406('0x1f');var _0x326033=_0x4d44e0[_0xb406('0x20')];var _0x1ab49b=_0x5f2d36?0x0:_0x56f8db['offset'];var _0x49f060=_0x5f2d36?_0x4d44e0[_0xb406('0x20')]:_0x56f8db[_0xb406('0x1d')]+_0x56f8db[_0xb406('0x1e')];var _0x22ff2e;if(_0x49f060>=_0x326033){_0x49f060=_0x326033;_0x22ff2e=0xc8;}else{_0x22ff2e=0xce;}_0x2f00d1[_0xb406('0x1b')](_0x22ff2e);return _0x2f00d1[_0xb406('0x21')](_0xb406('0x22'),_0x1ab49b+'-'+_0x49f060+'/'+_0x326033)['json'](_0x4d44e0);}return null;};}function patchUpdates(_0xc11bb6){return function(_0x145164){try{jsonpatch[_0xb406('0x23')](_0x145164,_0xc11bb6,!![]);}catch(_0x1ef420){return BPromise['reject'](_0x1ef420);}return _0x145164[_0xb406('0x24')]();};}function saveUpdates(_0x433b40,_0x4ba217){return function(_0x3d0a2f){if(_0x3d0a2f){return _0x3d0a2f[_0xb406('0x25')](_0x433b40)[_0xb406('0x26')](function(_0x3d13ec){return _0x3d13ec;});}return null;};}function removeEntity(_0x517002,_0x71baed){return function(_0x3c5963){if(_0x3c5963){return _0x3c5963[_0xb406('0x27')]()[_0xb406('0x26')](function(){_0x517002[_0xb406('0x1b')](0xcc)[_0xb406('0x1a')]();});}};}function handleEntityNotFound(_0x451005,_0x11921e){return function(_0x485216){if(!_0x485216){_0x451005[_0xb406('0x19')](0x194);}return _0x485216;};}function handleError(_0x4aa71d,_0x2ee215){_0x2ee215=_0x2ee215||0x1f4;return function(_0xe13798){logger[_0xb406('0x28')](_0xe13798['stack']);if(_0xe13798[_0xb406('0x29')]){delete _0xe13798[_0xb406('0x29')];}_0x4aa71d['status'](_0x2ee215)[_0xb406('0x2a')](_0xe13798);};}exports['index']=function(_0x514390,_0x58bc0a){var _0x52a533={},_0x3ed47f={},_0x38dc51={'count':0x0,'rows':[]};var _0x4f0ec9=_[_0xb406('0x2b')](db[_0xb406('0x2c')][_0xb406('0x2d')],function(_0x506f76){return{'name':_0x506f76['fieldName'],'type':_0x506f76[_0xb406('0x2e')]['key']};});_0x3ed47f[_0xb406('0x2f')]=_[_0xb406('0x2b')](_0x4f0ec9,_0xb406('0x29'));_0x3ed47f[_0xb406('0x30')]=_[_0xb406('0x31')](_0x514390['query']);_0x3ed47f['filters']=_[_0xb406('0x32')](_0x3ed47f[_0xb406('0x2f')],_0x3ed47f[_0xb406('0x30')]);_0x52a533['attributes']=_['intersection'](_0x3ed47f[_0xb406('0x2f')],qs[_0xb406('0x33')](_0x514390[_0xb406('0x30')]['fields']));_0x52a533[_0xb406('0x34')]=_0x52a533[_0xb406('0x34')][_0xb406('0x35')]?_0x52a533[_0xb406('0x34')]:_0x3ed47f[_0xb406('0x2f')];if(!_0x514390[_0xb406('0x30')][_0xb406('0x36')](_0xb406('0x37'))){_0x52a533[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x514390[_0xb406('0x30')][_0xb406('0x1e')]);_0x52a533[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x514390['query']['offset']);}_0x52a533[_0xb406('0x38')]=qs[_0xb406('0x39')](_0x514390['query'][_0xb406('0x39')]);_0x52a533[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_[_0xb406('0x3c')](_0x514390['query'],_0x3ed47f[_0xb406('0x3b')]),_0x4f0ec9);if(_0x514390[_0xb406('0x30')][_0xb406('0x3d')]){_0x52a533[_0xb406('0x3a')]=_['merge'](_0x52a533['where'],{'$or':_['map'](_0x4f0ec9,function(_0x1210f7){if(_0x1210f7[_0xb406('0x2e')]!==_0xb406('0x3e')){var _0x141237={};_0x141237[_0x1210f7[_0xb406('0x29')]]={'$like':'%'+_0x514390[_0xb406('0x30')][_0xb406('0x3d')]+'%'};return _0x141237;}})});}_0x52a533=_['merge']({},_0x52a533,_0x514390['options']);var _0x3cf726={'where':_0x52a533[_0xb406('0x3a')]};return db[_0xb406('0x2c')]['count'](_0x3cf726)[_0xb406('0x26')](function(_0x1f7ba5){_0x38dc51['count']=_0x1f7ba5;if(_0x514390[_0xb406('0x30')][_0xb406('0x3f')]){_0x52a533['include']=[{'all':!![]}];}return db[_0xb406('0x2c')]['findAll'](_0x52a533);})[_0xb406('0x26')](function(_0x563055){_0x38dc51[_0xb406('0x40')]=_0x563055;return _0x38dc51;})[_0xb406('0x26')](respondWithFilteredResult(_0x58bc0a,_0x52a533))[_0xb406('0x41')](handleError(_0x58bc0a,null));};exports[_0xb406('0x42')]=function(_0x4e4764,_0x1d273c){var _0x214be2={'raw':![],'where':{'id':_0x4e4764[_0xb406('0x43')]['id']}},_0x153a9b={};_0x153a9b['model']=_[_0xb406('0x31')](db[_0xb406('0x2c')][_0xb406('0x2d')]);_0x153a9b[_0xb406('0x30')]=_[_0xb406('0x31')](_0x4e4764[_0xb406('0x30')]);_0x153a9b[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x153a9b[_0xb406('0x2f')],_0x153a9b[_0xb406('0x30')]);_0x214be2['attributes']=_[_0xb406('0x32')](_0x153a9b[_0xb406('0x2f')],qs['fields'](_0x4e4764[_0xb406('0x30')]['fields']));_0x214be2[_0xb406('0x34')]=_0x214be2[_0xb406('0x34')][_0xb406('0x35')]?_0x214be2[_0xb406('0x34')]:_0x153a9b[_0xb406('0x2f')];if(_0x4e4764[_0xb406('0x30')][_0xb406('0x3f')]){_0x214be2['include']=[{'all':!![]}];}_0x214be2=_[_0xb406('0x44')]({},_0x214be2,_0x4e4764[_0xb406('0x45')]);return db[_0xb406('0x2c')][_0xb406('0x46')](_0x214be2)['then'](handleEntityNotFound(_0x1d273c,null))[_0xb406('0x26')](respondWithResult(_0x1d273c,null))['catch'](handleError(_0x1d273c,null));};exports[_0xb406('0x47')]=function(_0x22d96f,_0xd30f94){return db[_0xb406('0x2c')]['create'](_0x22d96f[_0xb406('0x48')],{})[_0xb406('0x26')](respondWithResult(_0xd30f94,0xc9))[_0xb406('0x41')](handleError(_0xd30f94,null));};exports['update']=function(_0x417bea,_0x1ff9c2){if(_0x417bea[_0xb406('0x48')]['id']){delete _0x417bea['body']['id'];}return db[_0xb406('0x2c')][_0xb406('0x46')]({'where':{'id':_0x417bea[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x1ff9c2,null))[_0xb406('0x26')](saveUpdates(_0x417bea[_0xb406('0x48')],null))[_0xb406('0x26')](respondWithResult(_0x1ff9c2,null))[_0xb406('0x41')](handleError(_0x1ff9c2,null));};exports[_0xb406('0x27')]=function(_0x9a7002,_0x57fc6a){return db['DeskConfiguration'][_0xb406('0x46')]({'where':{'id':_0x9a7002['params']['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x57fc6a,null))[_0xb406('0x26')](removeEntity(_0x57fc6a,null))[_0xb406('0x41')](handleError(_0x57fc6a,null));};exports['getFields']=function(_0x45ff5f,_0x3c61c2,_0x301e7a){var _0x164e3f={};var _0x300d95={};var _0x39dd69;var _0x4fa34d;return db['DeskConfiguration'][_0xb406('0x49')]({'where':{'id':_0x45ff5f['params']['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x3c61c2,null))[_0xb406('0x26')](function(_0x315484){if(_0x315484){_0x39dd69=_0x315484;_0x300d95[_0xb406('0x2f')]=_['keys'](db[_0xb406('0x4a')][_0xb406('0x2d')]);_0x300d95[_0xb406('0x30')]=_['keys'](_0x45ff5f[_0xb406('0x30')]);_0x300d95[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x300d95[_0xb406('0x2f')],_0x300d95[_0xb406('0x30')]);_0x164e3f['attributes']=_[_0xb406('0x32')](_0x300d95['model'],qs[_0xb406('0x33')](_0x45ff5f[_0xb406('0x30')]['fields']));_0x164e3f[_0xb406('0x34')]=_0x164e3f[_0xb406('0x34')][_0xb406('0x35')]?_0x164e3f['attributes']:_0x300d95[_0xb406('0x2f')];_0x164e3f['order']=qs[_0xb406('0x39')](_0x45ff5f['query'][_0xb406('0x39')]);_0x164e3f[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_[_0xb406('0x3c')](_0x45ff5f[_0xb406('0x30')],_0x300d95[_0xb406('0x3b')]));if(_0x45ff5f['query'][_0xb406('0x3d')]){_0x164e3f[_0xb406('0x3a')]=_[_0xb406('0x44')](_0x164e3f[_0xb406('0x3a')],{'$or':_[_0xb406('0x2b')](_0x164e3f[_0xb406('0x34')],function(_0x5ef241){var _0xcd5950={};_0xcd5950[_0x5ef241]={'$like':'%'+_0x45ff5f['query'][_0xb406('0x3d')]+'%'};return _0xcd5950;})});}_0x164e3f=_[_0xb406('0x44')]({},_0x164e3f,_0x45ff5f[_0xb406('0x45')]);return _0x39dd69['getFields'](_0x164e3f);}})[_0xb406('0x26')](function(_0x4e143e){if(_0x4e143e){_0x4fa34d=_0x4e143e[_0xb406('0x35')];if(!_0x45ff5f[_0xb406('0x30')][_0xb406('0x36')](_0xb406('0x37'))){_0x164e3f[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x45ff5f[_0xb406('0x30')][_0xb406('0x1e')]);_0x164e3f[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x45ff5f[_0xb406('0x30')][_0xb406('0x1d')]);}return _0x39dd69['getFields'](_0x164e3f);}})['then'](function(_0x349525){if(_0x349525){return _0x349525?{'count':_0x4fa34d,'rows':_0x349525}:null;}})[_0xb406('0x26')](respondWithResult(_0x3c61c2,null))[_0xb406('0x41')](handleError(_0x3c61c2,null));};exports['getSubjects']=function(_0x428b04,_0x305ec3,_0x1beb1d){var _0x4bcd62={};var _0x27801a={};var _0x14cdf9;var _0x1a0d38;return db[_0xb406('0x2c')]['findOne']({'where':{'id':_0x428b04[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x305ec3,null))[_0xb406('0x26')](function(_0x4ffca5){if(_0x4ffca5){_0x14cdf9=_0x4ffca5;_0x27801a[_0xb406('0x2f')]=_[_0xb406('0x31')](db[_0xb406('0x4a')][_0xb406('0x2d')]);_0x27801a['query']=_[_0xb406('0x31')](_0x428b04[_0xb406('0x30')]);_0x27801a[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x27801a[_0xb406('0x2f')],_0x27801a['query']);_0x4bcd62[_0xb406('0x34')]=_[_0xb406('0x32')](_0x27801a[_0xb406('0x2f')],qs['fields'](_0x428b04[_0xb406('0x30')]['fields']));_0x4bcd62['attributes']=_0x4bcd62[_0xb406('0x34')][_0xb406('0x35')]?_0x4bcd62[_0xb406('0x34')]:_0x27801a[_0xb406('0x2f')];_0x4bcd62['order']=qs[_0xb406('0x39')](_0x428b04[_0xb406('0x30')][_0xb406('0x39')]);_0x4bcd62['where']=qs[_0xb406('0x3b')](_['pick'](_0x428b04['query'],_0x27801a[_0xb406('0x3b')]));if(_0x428b04['query'][_0xb406('0x3d')]){_0x4bcd62[_0xb406('0x3a')]=_[_0xb406('0x44')](_0x4bcd62['where'],{'$or':_['map'](_0x4bcd62[_0xb406('0x34')],function(_0xedc27e){var _0x442b20={};_0x442b20[_0xedc27e]={'$like':'%'+_0x428b04['query'][_0xb406('0x3d')]+'%'};return _0x442b20;})});}_0x4bcd62=_[_0xb406('0x44')]({},_0x4bcd62,_0x428b04['options']);return _0x14cdf9[_0xb406('0x4b')](_0x4bcd62);}})[_0xb406('0x26')](function(_0x556462){if(_0x556462){_0x1a0d38=_0x556462['length'];if(!_0x428b04[_0xb406('0x30')][_0xb406('0x36')](_0xb406('0x37'))){_0x4bcd62[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x428b04['query'][_0xb406('0x1e')]);_0x4bcd62[_0xb406('0x1d')]=qs['offset'](_0x428b04[_0xb406('0x30')]['offset']);}return _0x14cdf9[_0xb406('0x4b')](_0x4bcd62);}})[_0xb406('0x26')](function(_0x1ee8b5){if(_0x1ee8b5){return _0x1ee8b5?{'count':_0x1a0d38,'rows':_0x1ee8b5}:null;}})[_0xb406('0x26')](respondWithResult(_0x305ec3,null))['catch'](handleError(_0x305ec3,null));};exports[_0xb406('0x4c')]=function(_0x104276,_0x48ad73,_0x512fa8){var _0x1c8758={};var _0x1e8cfd={};var _0xe5f95d;var _0x89ee5b;return db[_0xb406('0x2c')][_0xb406('0x49')]({'where':{'id':_0x104276[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x48ad73,null))['then'](function(_0x2a2953){if(_0x2a2953){_0xe5f95d=_0x2a2953;_0x1e8cfd[_0xb406('0x2f')]=_[_0xb406('0x31')](db['DeskField'][_0xb406('0x2d')]);_0x1e8cfd[_0xb406('0x30')]=_['keys'](_0x104276[_0xb406('0x30')]);_0x1e8cfd['filters']=_[_0xb406('0x32')](_0x1e8cfd[_0xb406('0x2f')],_0x1e8cfd[_0xb406('0x30')]);_0x1c8758[_0xb406('0x34')]=_['intersection'](_0x1e8cfd['model'],qs[_0xb406('0x33')](_0x104276['query'][_0xb406('0x33')]));_0x1c8758[_0xb406('0x34')]=_0x1c8758[_0xb406('0x34')][_0xb406('0x35')]?_0x1c8758['attributes']:_0x1e8cfd[_0xb406('0x2f')];_0x1c8758[_0xb406('0x38')]=qs[_0xb406('0x39')](_0x104276[_0xb406('0x30')][_0xb406('0x39')]);_0x1c8758[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_['pick'](_0x104276[_0xb406('0x30')],_0x1e8cfd[_0xb406('0x3b')]));if(_0x104276[_0xb406('0x30')][_0xb406('0x3d')]){_0x1c8758[_0xb406('0x3a')]=_[_0xb406('0x44')](_0x1c8758[_0xb406('0x3a')],{'$or':_[_0xb406('0x2b')](_0x1c8758[_0xb406('0x34')],function(_0x26ea11){var _0x52baa7={};_0x52baa7[_0x26ea11]={'$like':'%'+_0x104276[_0xb406('0x30')][_0xb406('0x3d')]+'%'};return _0x52baa7;})});}_0x1c8758=_[_0xb406('0x44')]({},_0x1c8758,_0x104276[_0xb406('0x45')]);return _0xe5f95d[_0xb406('0x4c')](_0x1c8758);}})['then'](function(_0x53517e){if(_0x53517e){_0x89ee5b=_0x53517e[_0xb406('0x35')];if(!_0x104276[_0xb406('0x30')]['hasOwnProperty'](_0xb406('0x37'))){_0x1c8758[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x104276['query'][_0xb406('0x1e')]);_0x1c8758[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x104276['query']['offset']);}return _0xe5f95d['getDescriptions'](_0x1c8758);}})[_0xb406('0x26')](function(_0x2f548b){if(_0x2f548b){return _0x2f548b?{'count':_0x89ee5b,'rows':_0x2f548b}:null;}})['then'](respondWithResult(_0x48ad73,null))[_0xb406('0x41')](handleError(_0x48ad73,null));};exports[_0xb406('0x4d')]=function(_0x2ffaea,_0x500509,_0x514a5c){var _0x3b47ae={};var _0x84284e={};var _0x46b1f1;var _0x454457;return db['DeskConfiguration'][_0xb406('0x49')]({'where':{'id':_0x2ffaea[_0xb406('0x43')]['id']}})[_0xb406('0x26')](handleEntityNotFound(_0x500509,null))['then'](function(_0x5c0d53){if(_0x5c0d53){_0x46b1f1=_0x5c0d53;_0x84284e['model']=_[_0xb406('0x31')](db[_0xb406('0x4e')][_0xb406('0x2d')]);_0x84284e[_0xb406('0x30')]=_[_0xb406('0x31')](_0x2ffaea[_0xb406('0x30')]);_0x84284e[_0xb406('0x3b')]=_[_0xb406('0x32')](_0x84284e[_0xb406('0x2f')],_0x84284e[_0xb406('0x30')]);_0x3b47ae[_0xb406('0x34')]=_[_0xb406('0x32')](_0x84284e[_0xb406('0x2f')],qs['fields'](_0x2ffaea[_0xb406('0x30')][_0xb406('0x33')]));_0x3b47ae[_0xb406('0x34')]=_0x3b47ae[_0xb406('0x34')][_0xb406('0x35')]?_0x3b47ae[_0xb406('0x34')]:_0x84284e['model'];_0x3b47ae[_0xb406('0x38')]=qs[_0xb406('0x39')](_0x2ffaea[_0xb406('0x30')][_0xb406('0x39')]);_0x3b47ae[_0xb406('0x3a')]=qs[_0xb406('0x3b')](_['pick'](_0x2ffaea['query'],_0x84284e[_0xb406('0x3b')]));if(_0x2ffaea['query'][_0xb406('0x3d')]){_0x3b47ae[_0xb406('0x3a')]=_['merge'](_0x3b47ae[_0xb406('0x3a')],{'$or':_[_0xb406('0x2b')](_0x3b47ae[_0xb406('0x34')],function(_0x326213){var _0x987173={};_0x987173[_0x326213]={'$like':'%'+_0x2ffaea['query'][_0xb406('0x3d')]+'%'};return _0x987173;})});}_0x3b47ae=_[_0xb406('0x44')]({},_0x3b47ae,_0x2ffaea[_0xb406('0x45')]);return _0x46b1f1[_0xb406('0x4d')](_0x3b47ae);}})[_0xb406('0x26')](function(_0x1d8b11){if(_0x1d8b11){_0x454457=_0x1d8b11[_0xb406('0x35')];if(!_0x2ffaea[_0xb406('0x30')][_0xb406('0x36')]('nolimit')){_0x3b47ae[_0xb406('0x1e')]=qs[_0xb406('0x1e')](_0x2ffaea['query'][_0xb406('0x1e')]);_0x3b47ae[_0xb406('0x1d')]=qs[_0xb406('0x1d')](_0x2ffaea[_0xb406('0x30')][_0xb406('0x1d')]);}return _0x46b1f1[_0xb406('0x4d')](_0x3b47ae);}})[_0xb406('0x26')](function(_0x4c776b){if(_0x4c776b){return _0x4c776b?{'count':_0x454457,'rows':_0x4c776b}:null;}})[_0xb406('0x26')](respondWithResult(_0x500509,null))[_0xb406('0x41')](handleError(_0x500509,null));};exports[_0xb406('0x4f')]=function(_0x556e44,_0x35c0cd,_0x16b197){if(_0x556e44['body']['id']){delete _0x556e44['body']['id'];}return db[_0xb406('0x2c')][_0xb406('0x49')]({'where':{'id':_0x556e44[_0xb406('0x43')]['id']}})['then'](handleEntityNotFound(_0x35c0cd,null))[_0xb406('0x26')](function(_0x18c8d4){if(_0x18c8d4){return _0x18c8d4[_0xb406('0x4f')](_0x556e44[_0xb406('0x48')][_0xb406('0x50')]||[]);}return null;})[_0xb406('0x26')](respondWithResult(_0x35c0cd,null))['catch'](handleError(_0x35c0cd,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8520789..a15aace 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 _0xe2b0=['util','bluebird','request-promise','path','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x50923f,_0x4695b6){var _0x132d06=function(_0x3400e5){while(--_0x3400e5){_0x50923f['push'](_0x50923f['shift']());}};_0x132d06(++_0x4695b6);}(_0xe2b0,0x117));var _0x0e2b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe2b0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0e2b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0e2b('0x1'));var rp=require(_0x0e2b('0x2'));var fs=require('fs');var path=require(_0x0e2b('0x3'));var rimraf=require('rimraf');var config=require(_0x0e2b('0x4'));var attributes=require('./intDeskConfiguration.attributes');module[_0x0e2b('0x5')]=function(_0x2ee0f2,_0xa22d0e){return _0x2ee0f2[_0x0e2b('0x6')](_0x0e2b('0x7'),attributes,{'tableName':_0x0e2b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1032=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xefe8c9,_0x8ef92b){var _0xbdc408=function(_0x22fac4){while(--_0x22fac4){_0xefe8c9['push'](_0xefe8c9['shift']());}};_0xbdc408(++_0x8ef92b);}(_0x1032,0x1cd));var _0x2103=function(_0x5eb7c3,_0x585115){_0x5eb7c3=_0x5eb7c3-0x0;var _0x395fa2=_0x1032[_0x5eb7c3];return _0x395fa2;};'use strict';var _=require(_0x2103('0x0'));var util=require(_0x2103('0x1'));var logger=require('../../config/logger')(_0x2103('0x2'));var moment=require(_0x2103('0x3'));var BPromise=require(_0x2103('0x4'));var rp=require(_0x2103('0x5'));var fs=require('fs');var path=require(_0x2103('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2103('0x7'));module[_0x2103('0x8')]=function(_0x1321fc,_0x3afb0d){return _0x1321fc[_0x2103('0x9')](_0x2103('0xa'),attributes,{'tableName':_0x2103('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 338b785..cea68ba 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 _0xc4af=['../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc4af,0x88));var _0xfc4a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc4af[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xfc4a('0x0'));var util=require('util');var moment=require(_0xfc4a('0x1'));var BPromise=require(_0xfc4a('0x2'));var rs=require(_0xfc4a('0x3'));var fs=require('fs');var Redis=require(_0xfc4a('0x4'));var db=require(_0xfc4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc4a('0x6'))(_0xfc4a('0x7'));var config=require(_0xfc4a('0x8'));var jayson=require(_0xfc4a('0x9'));var client=jayson[_0xfc4a('0xa')][_0xfc4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e92b5,_0x46d52c,_0x27ff61){return new BPromise(function(_0x1b606f,_0x1979f5){return client[_0xfc4a('0xc')](_0x3e92b5,_0x27ff61)[_0xfc4a('0xd')](function(_0x1e5bb3){logger[_0xfc4a('0xe')](_0xfc4a('0xf'),_0x46d52c,_0xfc4a('0x10'));logger[_0xfc4a('0x11')](_0xfc4a('0x12'),_0x46d52c,'request\x20sent',JSON[_0xfc4a('0x13')](_0x1e5bb3));if(_0x1e5bb3['error']){if(_0x1e5bb3['error'][_0xfc4a('0x14')]===0x1f4){logger[_0xfc4a('0x15')](_0xfc4a('0xf'),_0x46d52c,_0x1e5bb3['error'][_0xfc4a('0x16')]);return _0x1979f5(_0x1e5bb3[_0xfc4a('0x15')][_0xfc4a('0x16')]);}logger[_0xfc4a('0x15')](_0xfc4a('0xf'),_0x46d52c,_0x1e5bb3['error'][_0xfc4a('0x16')]);return _0x1b606f(_0x1e5bb3[_0xfc4a('0x15')][_0xfc4a('0x16')]);}else{logger[_0xfc4a('0xe')](_0xfc4a('0xf'),_0x46d52c,'request\x20sent');_0x1b606f(_0x1e5bb3['result']['message']);}})[_0xfc4a('0x17')](function(_0x25fcee){logger[_0xfc4a('0x15')](_0xfc4a('0xf'),_0x46d52c,_0x25fcee);_0x1979f5(_0x25fcee);});});} \ No newline at end of file +var _0x57c3=['rpc','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x11b918,_0xff7fa8){var _0x23acd5=function(_0x4b8d58){while(--_0x4b8d58){_0x11b918['push'](_0x11b918['shift']());}};_0x23acd5(++_0xff7fa8);}(_0x57c3,0xc2));var _0x357c=function(_0x4205d9,_0x16a883){_0x4205d9=_0x4205d9-0x0;var _0x5ded27=_0x57c3[_0x4205d9];return _0x5ded27;};'use strict';var _=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var moment=require(_0x357c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x357c('0x3'))['db'];var utils=require(_0x357c('0x4'));var logger=require(_0x357c('0x5'))(_0x357c('0x6'));var config=require('../../config/environment');var jayson=require(_0x357c('0x7'));var client=jayson['client'][_0x357c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x471e56,_0x2320eb,_0x44d3ee){return new BPromise(function(_0x1fc04b,_0x1e4977){return client[_0x357c('0x9')](_0x471e56,_0x44d3ee)['then'](function(_0x5dd3dd){logger[_0x357c('0xa')](_0x357c('0xb'),_0x2320eb,_0x357c('0xc'));logger[_0x357c('0xd')](_0x357c('0xe'),_0x2320eb,_0x357c('0xc'),JSON[_0x357c('0xf')](_0x5dd3dd));if(_0x5dd3dd[_0x357c('0x10')]){if(_0x5dd3dd[_0x357c('0x10')][_0x357c('0x11')]===0x1f4){logger[_0x357c('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2320eb,_0x5dd3dd[_0x357c('0x10')][_0x357c('0x12')]);return _0x1e4977(_0x5dd3dd[_0x357c('0x10')]['message']);}logger['error'](_0x357c('0xb'),_0x2320eb,_0x5dd3dd[_0x357c('0x10')][_0x357c('0x12')]);return _0x1fc04b(_0x5dd3dd[_0x357c('0x10')][_0x357c('0x12')]);}else{logger[_0x357c('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x2320eb,_0x357c('0xc'));_0x1fc04b(_0x5dd3dd[_0x357c('0x13')]['message']);}})['catch'](function(_0x105d19){logger[_0x357c('0x10')](_0x357c('0xb'),_0x2320eb,_0x105d19);_0x1e4977(_0x105d19);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 251ff2f..36d1bef 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 _0x7c53=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete'];(function(_0x48214f,_0x541407){var _0x1bd54e=function(_0xd853c1){while(--_0xd853c1){_0x48214f['push'](_0x48214f['shift']());}};_0x1bd54e(++_0x541407);}(_0x7c53,0x1dd));var _0x37c5=function(_0x30c6ba,_0x319318){_0x30c6ba=_0x30c6ba-0x0;var _0x30990d=_0x7c53[_0x30c6ba];return _0x30990d;};'use strict';var multer=require(_0x37c5('0x0'));var util=require(_0x37c5('0x1'));var path=require(_0x37c5('0x2'));var timeout=require('connect-timeout');var express=require(_0x37c5('0x3'));var router=express[_0x37c5('0x4')]();var fs_extra=require(_0x37c5('0x5'));var auth=require(_0x37c5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x37c5('0x7'));router['get']('/',auth[_0x37c5('0x8')](),controller[_0x37c5('0x9')]);router[_0x37c5('0xa')](_0x37c5('0xb'),auth['isAuthenticated'](),controller[_0x37c5('0xc')]);router[_0x37c5('0xd')]('/',auth[_0x37c5('0x8')](),controller[_0x37c5('0xe')]);router['put'](_0x37c5('0xb'),auth[_0x37c5('0x8')](),controller[_0x37c5('0xf')]);router[_0x37c5('0x10')](_0x37c5('0xb'),auth[_0x37c5('0x8')](),controller[_0x37c5('0x11')]);module[_0x37c5('0x12')]=router; \ No newline at end of file +var _0x69c4=['put','update','delete','exports','multer','util','path','express','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4909bb,_0x25fc54){var _0x3423d7=function(_0x2effaa){while(--_0x2effaa){_0x4909bb['push'](_0x4909bb['shift']());}};_0x3423d7(++_0x25fc54);}(_0x69c4,0x1d4));var _0x469c=function(_0x46fb65,_0xeda331){_0x46fb65=_0x46fb65-0x0;var _0x8e1aee=_0x69c4[_0x46fb65];return _0x8e1aee;};'use strict';var multer=require(_0x469c('0x0'));var util=require(_0x469c('0x1'));var path=require(_0x469c('0x2'));var timeout=require('connect-timeout');var express=require(_0x469c('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('../../config/environment');var controller=require(_0x469c('0x4'));router[_0x469c('0x5')]('/',auth[_0x469c('0x6')](),controller[_0x469c('0x7')]);router[_0x469c('0x5')](_0x469c('0x8'),auth['isAuthenticated'](),controller[_0x469c('0x9')]);router[_0x469c('0xa')]('/',auth[_0x469c('0x6')](),controller[_0x469c('0xb')]);router[_0x469c('0xc')](_0x469c('0x8'),auth[_0x469c('0x6')](),controller[_0x469c('0xd')]);router[_0x469c('0xe')](_0x469c('0x8'),auth[_0x469c('0x6')](),controller['destroy']);module[_0x469c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 078fae4..1320da6 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 _0x3c1d=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x3aa63d,_0x5721ac){var _0x535c15=function(_0x8a9dfc){while(--_0x8a9dfc){_0x3aa63d['push'](_0x3aa63d['shift']());}};_0x535c15(++_0x5721ac);}(_0x3c1d,0x125));var _0xd3c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3c1d[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xd3c1('0x0'));module['exports']={'type':{'type':Sequelize[_0xd3c1('0x1')]('string',_0xd3c1('0x2'),_0xd3c1('0x3'),_0xd3c1('0x4'),_0xd3c1('0x5')),'defaultValue':_0xd3c1('0x6')},'content':{'type':Sequelize[_0xd3c1('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd3c1('0x1')](_0xd3c1('0x6'),'variable',_0xd3c1('0x3'))},'keyContent':{'type':Sequelize[_0xd3c1('0x7')]},'idField':{'type':Sequelize[_0xd3c1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd3c1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd3c1('0x7')]}}; \ No newline at end of file +var _0x6124=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x52f0a6,_0xa3c19f){var _0x2dcee6=function(_0x5ad678){while(--_0x5ad678){_0x52f0a6['push'](_0x52f0a6['shift']());}};_0x2dcee6(++_0xa3c19f);}(_0x6124,0x94));var _0x4612=function(_0x269738,_0x4195d9){_0x269738=_0x269738-0x0;var _0x2b5f42=_0x6124[_0x269738];return _0x2b5f42;};'use strict';var Sequelize=require(_0x4612('0x0'));module['exports']={'type':{'type':Sequelize[_0x4612('0x1')](_0x4612('0x2'),_0x4612('0x3'),_0x4612('0x4'),_0x4612('0x5'),_0x4612('0x6')),'defaultValue':_0x4612('0x2')},'content':{'type':Sequelize[_0x4612('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4612('0x2'),_0x4612('0x3'),_0x4612('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4612('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4612('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index e85cbfc..bfc8ee7 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 _0x553f=['create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include'];(function(_0x273a4f,_0x3f21bd){var _0x33a275=function(_0x14352c){while(--_0x14352c){_0x273a4f['push'](_0x273a4f['shift']());}};_0x33a275(++_0x3f21bd);}(_0x553f,0x1c0));var _0xf553=function(_0x5d9c16,_0x51905b){_0x5d9c16=_0x5d9c16-0x0;var _0x4bfbea=_0x553f[_0x5d9c16];return _0x4bfbea;};'use strict';var emlformat=require(_0xf553('0x0'));var rimraf=require(_0xf553('0x1'));var zipdir=require(_0xf553('0x2'));var jsonpatch=require(_0xf553('0x3'));var rp=require(_0xf553('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf553('0x5'));var util=require('util');var path=require(_0xf553('0x6'));var sox=require(_0xf553('0x7'));var csv=require(_0xf553('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf553('0x9'));var _=require(_0xf553('0xa'));var squel=require(_0xf553('0xb'));var crypto=require('crypto');var jsforce=require(_0xf553('0xc'));var deskjs=require(_0xf553('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf553('0xe'));var authService=require(_0xf553('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf553('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf553('0x11'))(_0xf553('0x12'));var utils=require('../../config/utils');var config=require(_0xf553('0x13'));var licenseUtil=require(_0xf553('0x14'));var db=require(_0xf553('0x15'))['db'];function respondWithStatusCode(_0x3a296c,_0x16be09){_0x16be09=_0x16be09||0xcc;return function(_0x15231e){if(_0x15231e){return _0x3a296c[_0xf553('0x16')](_0x16be09);}return _0x3a296c[_0xf553('0x17')](_0x16be09)[_0xf553('0x18')]();};}function respondWithResult(_0x154752,_0x49dc14){_0x49dc14=_0x49dc14||0xc8;return function(_0x275d32){if(_0x275d32){return _0x154752[_0xf553('0x17')](_0x49dc14)['json'](_0x275d32);}};}function respondWithFilteredResult(_0x32a01b,_0x12968c){return function(_0x2cef54){if(_0x2cef54){var _0x3197ea=typeof _0x12968c[_0xf553('0x19')]===_0xf553('0x1a')&&typeof _0x12968c['limit']===_0xf553('0x1a');var _0x264bc1=_0x2cef54[_0xf553('0x1b')];var _0x14ae9c=_0x3197ea?0x0:_0x12968c[_0xf553('0x19')];var _0x53aae0=_0x3197ea?_0x2cef54[_0xf553('0x1b')]:_0x12968c[_0xf553('0x19')]+_0x12968c['limit'];var _0x58bd9d;if(_0x53aae0>=_0x264bc1){_0x53aae0=_0x264bc1;_0x58bd9d=0xc8;}else{_0x58bd9d=0xce;}_0x32a01b[_0xf553('0x17')](_0x58bd9d);return _0x32a01b[_0xf553('0x1c')]('Content-Range',_0x14ae9c+'-'+_0x53aae0+'/'+_0x264bc1)['json'](_0x2cef54);}return null;};}function patchUpdates(_0x21c395){return function(_0x560033){try{jsonpatch[_0xf553('0x1d')](_0x560033,_0x21c395,!![]);}catch(_0x2b6f93){return BPromise[_0xf553('0x1e')](_0x2b6f93);}return _0x560033[_0xf553('0x1f')]();};}function saveUpdates(_0x2ad893,_0x242b60){return function(_0x487cdb){if(_0x487cdb){return _0x487cdb['update'](_0x2ad893)[_0xf553('0x20')](function(_0x12e0d1){return _0x12e0d1;});}return null;};}function removeEntity(_0x5d967c,_0x1921cf){return function(_0x585dfa){if(_0x585dfa){return _0x585dfa[_0xf553('0x21')]()[_0xf553('0x20')](function(){_0x5d967c[_0xf553('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9a57,_0x501be2){return function(_0x3a58b3){if(!_0x3a58b3){_0x1b9a57[_0xf553('0x16')](0x194);}return _0x3a58b3;};}function handleError(_0x5c4dd2,_0x466be4){_0x466be4=_0x466be4||0x1f4;return function(_0x532fa5){logger[_0xf553('0x22')](_0x532fa5[_0xf553('0x23')]);if(_0x532fa5['name']){delete _0x532fa5[_0xf553('0x24')];}_0x5c4dd2[_0xf553('0x17')](_0x466be4)[_0xf553('0x25')](_0x532fa5);};}exports['index']=function(_0x4749d0,_0x3e06e0){var _0x13b084={},_0x12075e={},_0x53145b={'count':0x0,'rows':[]};var _0x268e0e=_[_0xf553('0x26')](db[_0xf553('0x27')][_0xf553('0x28')],function(_0x31cafc){return{'name':_0x31cafc[_0xf553('0x29')],'type':_0x31cafc[_0xf553('0x2a')][_0xf553('0x2b')]};});_0x12075e['model']=_[_0xf553('0x26')](_0x268e0e,_0xf553('0x24'));_0x12075e['query']=_[_0xf553('0x2c')](_0x4749d0[_0xf553('0x2d')]);_0x12075e[_0xf553('0x2e')]=_[_0xf553('0x2f')](_0x12075e[_0xf553('0x30')],_0x12075e['query']);_0x13b084[_0xf553('0x31')]=_[_0xf553('0x2f')](_0x12075e[_0xf553('0x30')],qs[_0xf553('0x32')](_0x4749d0[_0xf553('0x2d')][_0xf553('0x32')]));_0x13b084[_0xf553('0x31')]=_0x13b084[_0xf553('0x31')][_0xf553('0x33')]?_0x13b084[_0xf553('0x31')]:_0x12075e[_0xf553('0x30')];if(!_0x4749d0['query'][_0xf553('0x34')](_0xf553('0x35'))){_0x13b084[_0xf553('0x36')]=qs[_0xf553('0x36')](_0x4749d0[_0xf553('0x2d')][_0xf553('0x36')]);_0x13b084[_0xf553('0x19')]=qs[_0xf553('0x19')](_0x4749d0[_0xf553('0x2d')]['offset']);}_0x13b084[_0xf553('0x37')]=qs[_0xf553('0x38')](_0x4749d0[_0xf553('0x2d')][_0xf553('0x38')]);_0x13b084['where']=qs[_0xf553('0x2e')](_[_0xf553('0x39')](_0x4749d0[_0xf553('0x2d')],_0x12075e[_0xf553('0x2e')]),_0x268e0e);if(_0x4749d0[_0xf553('0x2d')][_0xf553('0x3a')]){_0x13b084[_0xf553('0x3b')]=_[_0xf553('0x3c')](_0x13b084[_0xf553('0x3b')],{'$or':_[_0xf553('0x26')](_0x268e0e,function(_0x5a721c){if(_0x5a721c[_0xf553('0x2a')]!==_0xf553('0x3d')){var _0x266b9d={};_0x266b9d[_0x5a721c['name']]={'$like':'%'+_0x4749d0[_0xf553('0x2d')]['filter']+'%'};return _0x266b9d;}})});}_0x13b084=_[_0xf553('0x3c')]({},_0x13b084,_0x4749d0[_0xf553('0x3e')]);var _0x582931={'where':_0x13b084[_0xf553('0x3b')]};return db['DeskField'][_0xf553('0x1b')](_0x582931)[_0xf553('0x20')](function(_0x3ecc5d){_0x53145b[_0xf553('0x1b')]=_0x3ecc5d;if(_0x4749d0[_0xf553('0x2d')][_0xf553('0x3f')]){_0x13b084['include']=[{'all':!![]}];}return db[_0xf553('0x27')][_0xf553('0x40')](_0x13b084);})[_0xf553('0x20')](function(_0x294a60){_0x53145b[_0xf553('0x41')]=_0x294a60;return _0x53145b;})[_0xf553('0x20')](respondWithFilteredResult(_0x3e06e0,_0x13b084))[_0xf553('0x42')](handleError(_0x3e06e0,null));};exports[_0xf553('0x43')]=function(_0x5ab801,_0x222666){var _0x37480d={'raw':!![],'where':{'id':_0x5ab801[_0xf553('0x44')]['id']}},_0x28aaa4={};_0x28aaa4[_0xf553('0x30')]=_[_0xf553('0x2c')](db[_0xf553('0x27')]['rawAttributes']);_0x28aaa4[_0xf553('0x2d')]=_[_0xf553('0x2c')](_0x5ab801['query']);_0x28aaa4[_0xf553('0x2e')]=_['intersection'](_0x28aaa4[_0xf553('0x30')],_0x28aaa4[_0xf553('0x2d')]);_0x37480d[_0xf553('0x31')]=_[_0xf553('0x2f')](_0x28aaa4[_0xf553('0x30')],qs[_0xf553('0x32')](_0x5ab801[_0xf553('0x2d')][_0xf553('0x32')]));_0x37480d[_0xf553('0x31')]=_0x37480d[_0xf553('0x31')][_0xf553('0x33')]?_0x37480d[_0xf553('0x31')]:_0x28aaa4['model'];if(_0x5ab801[_0xf553('0x2d')][_0xf553('0x3f')]){_0x37480d[_0xf553('0x45')]=[{'all':!![]}];}_0x37480d=_[_0xf553('0x3c')]({},_0x37480d,_0x5ab801['options']);return db[_0xf553('0x27')]['find'](_0x37480d)[_0xf553('0x20')](handleEntityNotFound(_0x222666,null))[_0xf553('0x20')](respondWithResult(_0x222666,null))['catch'](handleError(_0x222666,null));};exports[_0xf553('0x46')]=function(_0x4d2e2e,_0x556d4e){return db[_0xf553('0x27')][_0xf553('0x46')](_0x4d2e2e[_0xf553('0x47')],{})[_0xf553('0x20')](respondWithResult(_0x556d4e,0xc9))['catch'](handleError(_0x556d4e,null));};exports[_0xf553('0x48')]=function(_0x2adae9,_0x41bbc5){if(_0x2adae9[_0xf553('0x47')]['id']){delete _0x2adae9['body']['id'];}return db[_0xf553('0x27')]['find']({'where':{'id':_0x2adae9[_0xf553('0x44')]['id']}})[_0xf553('0x20')](handleEntityNotFound(_0x41bbc5,null))['then'](saveUpdates(_0x2adae9['body'],null))['then'](respondWithResult(_0x41bbc5,null))[_0xf553('0x42')](handleError(_0x41bbc5,null));};exports[_0xf553('0x21')]=function(_0x1f04a5,_0x17a7e3){return db[_0xf553('0x27')][_0xf553('0x49')]({'where':{'id':_0x1f04a5['params']['id']}})[_0xf553('0x20')](handleEntityNotFound(_0x17a7e3,null))[_0xf553('0x20')](removeEntity(_0x17a7e3,null))['catch'](handleError(_0x17a7e3,null));}; \ No newline at end of file +var _0xf9b7=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','DeskField','findAll','rows','catch','show','params','rawAttributes','create','body'];(function(_0xa78e4a,_0x74b0c1){var _0x103d8d=function(_0xddb237){while(--_0xddb237){_0xa78e4a['push'](_0xa78e4a['shift']());}};_0x103d8d(++_0x74b0c1);}(_0xf9b7,0x91));var _0x7f9b=function(_0x3cd8d2,_0xfbd1c8){_0x3cd8d2=_0x3cd8d2-0x0;var _0x2de19d=_0xf9b7[_0x3cd8d2];return _0x2de19d;};'use strict';var emlformat=require(_0x7f9b('0x0'));var rimraf=require(_0x7f9b('0x1'));var zipdir=require(_0x7f9b('0x2'));var jsonpatch=require(_0x7f9b('0x3'));var rp=require(_0x7f9b('0x4'));var moment=require(_0x7f9b('0x5'));var BPromise=require(_0x7f9b('0x6'));var Mustache=require(_0x7f9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7f9b('0x8'));var csv=require('to-csv');var ejs=require(_0x7f9b('0x9'));var fs=require('fs');var fs_extra=require(_0x7f9b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f9b('0xb'));var jsforce=require(_0x7f9b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f9b('0xd'));var Redis=require(_0x7f9b('0xe'));var authService=require(_0x7f9b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7f9b('0x10'));var hardwareService=require(_0x7f9b('0x11'));var logger=require('../../config/logger')(_0x7f9b('0x12'));var utils=require('../../config/utils');var config=require(_0x7f9b('0x13'));var licenseUtil=require(_0x7f9b('0x14'));var db=require(_0x7f9b('0x15'))['db'];function respondWithStatusCode(_0x911217,_0x2c60e6){_0x2c60e6=_0x2c60e6||0xcc;return function(_0x48ea83){if(_0x48ea83){return _0x911217[_0x7f9b('0x16')](_0x2c60e6);}return _0x911217['status'](_0x2c60e6)[_0x7f9b('0x17')]();};}function respondWithResult(_0x27f63e,_0x38a0b1){_0x38a0b1=_0x38a0b1||0xc8;return function(_0x1f756c){if(_0x1f756c){return _0x27f63e[_0x7f9b('0x18')](_0x38a0b1)[_0x7f9b('0x19')](_0x1f756c);}};}function respondWithFilteredResult(_0x261c4c,_0x2ba158){return function(_0x447255){if(_0x447255){var _0x39ecbd=typeof _0x2ba158[_0x7f9b('0x1a')]===_0x7f9b('0x1b')&&typeof _0x2ba158[_0x7f9b('0x1c')]===_0x7f9b('0x1b');var _0x51debb=_0x447255[_0x7f9b('0x1d')];var _0x575643=_0x39ecbd?0x0:_0x2ba158[_0x7f9b('0x1a')];var _0x4d934b=_0x39ecbd?_0x447255[_0x7f9b('0x1d')]:_0x2ba158['offset']+_0x2ba158['limit'];var _0x5cec50;if(_0x4d934b>=_0x51debb){_0x4d934b=_0x51debb;_0x5cec50=0xc8;}else{_0x5cec50=0xce;}_0x261c4c[_0x7f9b('0x18')](_0x5cec50);return _0x261c4c['set'](_0x7f9b('0x1e'),_0x575643+'-'+_0x4d934b+'/'+_0x51debb)['json'](_0x447255);}return null;};}function patchUpdates(_0x4a1399){return function(_0x262857){try{jsonpatch[_0x7f9b('0x1f')](_0x262857,_0x4a1399,!![]);}catch(_0x318203){return BPromise['reject'](_0x318203);}return _0x262857[_0x7f9b('0x20')]();};}function saveUpdates(_0x12285b,_0x47142f){return function(_0x4e3f37){if(_0x4e3f37){return _0x4e3f37[_0x7f9b('0x21')](_0x12285b)[_0x7f9b('0x22')](function(_0x25b6ac){return _0x25b6ac;});}return null;};}function removeEntity(_0x28d6de,_0x38e7d6){return function(_0x527f30){if(_0x527f30){return _0x527f30['destroy']()[_0x7f9b('0x22')](function(){_0x28d6de[_0x7f9b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62295d,_0x17b31d){return function(_0x22c380){if(!_0x22c380){_0x62295d[_0x7f9b('0x16')](0x194);}return _0x22c380;};}function handleError(_0x3b9da4,_0x214347){_0x214347=_0x214347||0x1f4;return function(_0x1155f6){logger['error'](_0x1155f6[_0x7f9b('0x23')]);if(_0x1155f6[_0x7f9b('0x24')]){delete _0x1155f6[_0x7f9b('0x24')];}_0x3b9da4[_0x7f9b('0x18')](_0x214347)[_0x7f9b('0x25')](_0x1155f6);};}exports[_0x7f9b('0x26')]=function(_0x5f3a5c,_0x4ab6ad){var _0x49a678={},_0xe72154={},_0x122caf={'count':0x0,'rows':[]};var _0x4e5c5d=_[_0x7f9b('0x27')](db['DeskField']['rawAttributes'],function(_0x5aba6e){return{'name':_0x5aba6e[_0x7f9b('0x28')],'type':_0x5aba6e[_0x7f9b('0x29')][_0x7f9b('0x2a')]};});_0xe72154[_0x7f9b('0x2b')]=_[_0x7f9b('0x27')](_0x4e5c5d,_0x7f9b('0x24'));_0xe72154['query']=_[_0x7f9b('0x2c')](_0x5f3a5c['query']);_0xe72154[_0x7f9b('0x2d')]=_[_0x7f9b('0x2e')](_0xe72154[_0x7f9b('0x2b')],_0xe72154[_0x7f9b('0x2f')]);_0x49a678[_0x7f9b('0x30')]=_['intersection'](_0xe72154['model'],qs['fields'](_0x5f3a5c['query'][_0x7f9b('0x31')]));_0x49a678[_0x7f9b('0x30')]=_0x49a678['attributes'][_0x7f9b('0x32')]?_0x49a678[_0x7f9b('0x30')]:_0xe72154[_0x7f9b('0x2b')];if(!_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x33')](_0x7f9b('0x34'))){_0x49a678[_0x7f9b('0x1c')]=qs['limit'](_0x5f3a5c['query']['limit']);_0x49a678[_0x7f9b('0x1a')]=qs[_0x7f9b('0x1a')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x1a')]);}_0x49a678[_0x7f9b('0x35')]=qs[_0x7f9b('0x36')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x36')]);_0x49a678['where']=qs[_0x7f9b('0x2d')](_[_0x7f9b('0x37')](_0x5f3a5c[_0x7f9b('0x2f')],_0xe72154[_0x7f9b('0x2d')]),_0x4e5c5d);if(_0x5f3a5c['query'][_0x7f9b('0x38')]){_0x49a678[_0x7f9b('0x39')]=_[_0x7f9b('0x3a')](_0x49a678[_0x7f9b('0x39')],{'$or':_[_0x7f9b('0x27')](_0x4e5c5d,function(_0x325370){if(_0x325370[_0x7f9b('0x29')]!==_0x7f9b('0x3b')){var _0x55d618={};_0x55d618[_0x325370[_0x7f9b('0x24')]]={'$like':'%'+_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x38')]+'%'};return _0x55d618;}})});}_0x49a678=_[_0x7f9b('0x3a')]({},_0x49a678,_0x5f3a5c['options']);var _0xd937c0={'where':_0x49a678[_0x7f9b('0x39')]};return db['DeskField'][_0x7f9b('0x1d')](_0xd937c0)[_0x7f9b('0x22')](function(_0x413230){_0x122caf['count']=_0x413230;if(_0x5f3a5c['query'][_0x7f9b('0x3c')]){_0x49a678[_0x7f9b('0x3d')]=[{'all':!![]}];}return db[_0x7f9b('0x3e')][_0x7f9b('0x3f')](_0x49a678);})[_0x7f9b('0x22')](function(_0x1e3df5){_0x122caf[_0x7f9b('0x40')]=_0x1e3df5;return _0x122caf;})[_0x7f9b('0x22')](respondWithFilteredResult(_0x4ab6ad,_0x49a678))[_0x7f9b('0x41')](handleError(_0x4ab6ad,null));};exports[_0x7f9b('0x42')]=function(_0x22e485,_0x8ca3a8){var _0x5e2171={'raw':!![],'where':{'id':_0x22e485[_0x7f9b('0x43')]['id']}},_0x190ebc={};_0x190ebc[_0x7f9b('0x2b')]=_[_0x7f9b('0x2c')](db['DeskField'][_0x7f9b('0x44')]);_0x190ebc[_0x7f9b('0x2f')]=_['keys'](_0x22e485[_0x7f9b('0x2f')]);_0x190ebc['filters']=_[_0x7f9b('0x2e')](_0x190ebc[_0x7f9b('0x2b')],_0x190ebc['query']);_0x5e2171[_0x7f9b('0x30')]=_['intersection'](_0x190ebc[_0x7f9b('0x2b')],qs['fields'](_0x22e485['query'][_0x7f9b('0x31')]));_0x5e2171[_0x7f9b('0x30')]=_0x5e2171[_0x7f9b('0x30')][_0x7f9b('0x32')]?_0x5e2171[_0x7f9b('0x30')]:_0x190ebc[_0x7f9b('0x2b')];if(_0x22e485[_0x7f9b('0x2f')][_0x7f9b('0x3c')]){_0x5e2171[_0x7f9b('0x3d')]=[{'all':!![]}];}_0x5e2171=_[_0x7f9b('0x3a')]({},_0x5e2171,_0x22e485['options']);return db[_0x7f9b('0x3e')]['find'](_0x5e2171)[_0x7f9b('0x22')](handleEntityNotFound(_0x8ca3a8,null))[_0x7f9b('0x22')](respondWithResult(_0x8ca3a8,null))['catch'](handleError(_0x8ca3a8,null));};exports[_0x7f9b('0x45')]=function(_0xfe294d,_0x2c9173){return db[_0x7f9b('0x3e')]['create'](_0xfe294d['body'],{})[_0x7f9b('0x22')](respondWithResult(_0x2c9173,0xc9))[_0x7f9b('0x41')](handleError(_0x2c9173,null));};exports['update']=function(_0xd30798,_0x1a211b){if(_0xd30798[_0x7f9b('0x46')]['id']){delete _0xd30798[_0x7f9b('0x46')]['id'];}return db[_0x7f9b('0x3e')][_0x7f9b('0x47')]({'where':{'id':_0xd30798[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x1a211b,null))[_0x7f9b('0x22')](saveUpdates(_0xd30798[_0x7f9b('0x46')],null))[_0x7f9b('0x22')](respondWithResult(_0x1a211b,null))[_0x7f9b('0x41')](handleError(_0x1a211b,null));};exports['destroy']=function(_0x30004f,_0x3e80d1){return db['DeskField']['find']({'where':{'id':_0x30004f[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x3e80d1,null))[_0x7f9b('0x22')](removeEntity(_0x3e80d1,null))[_0x7f9b('0x41')](handleError(_0x3e80d1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d6f08d7..98fa6f5 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 _0x99fa=['../../config/environment','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5e6fe1,_0x8f80ad){var _0x5a6018=function(_0x1f1225){while(--_0x1f1225){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x5a6018(++_0x8f80ad);}(_0x99fa,0xca));var _0xa99f=function(_0x16daee,_0xaf8850){_0x16daee=_0x16daee-0x0;var _0x436115=_0x99fa[_0x16daee];return _0x436115;};'use strict';var _=require(_0xa99f('0x0'));var util=require(_0xa99f('0x1'));var logger=require(_0xa99f('0x2'))(_0xa99f('0x3'));var moment=require('moment');var BPromise=require(_0xa99f('0x4'));var rp=require(_0xa99f('0x5'));var fs=require('fs');var path=require(_0xa99f('0x6'));var rimraf=require(_0xa99f('0x7'));var config=require(_0xa99f('0x8'));var attributes=require(_0xa99f('0x9'));module[_0xa99f('0xa')]=function(_0x22e5bd,_0x165d7e){return _0x22e5bd['define']('DeskField',attributes,{'tableName':_0xa99f('0xb'),'paranoid':![],'indexes':[{'name':_0xa99f('0xc'),'fields':[_0xa99f('0xd'),_0xa99f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5e=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x25e30f,_0x3ea59b){var _0x195a65=function(_0x26ef79){while(--_0x26ef79){_0x25e30f['push'](_0x25e30f['shift']());}};_0x195a65(++_0x3ea59b);}(_0xaf5e,0x105));var _0xeaf5=function(_0x2e4b74,_0x51ce22){_0x2e4b74=_0x2e4b74-0x0;var _0x2558ef=_0xaf5e[_0x2e4b74];return _0x2558ef;};'use strict';var _=require(_0xeaf5('0x0'));var util=require(_0xeaf5('0x1'));var logger=require(_0xeaf5('0x2'))(_0xeaf5('0x3'));var moment=require(_0xeaf5('0x4'));var BPromise=require(_0xeaf5('0x5'));var rp=require(_0xeaf5('0x6'));var fs=require('fs');var path=require(_0xeaf5('0x7'));var rimraf=require('rimraf');var config=require(_0xeaf5('0x8'));var attributes=require(_0xeaf5('0x9'));module[_0xeaf5('0xa')]=function(_0x2245cc,_0x5fd8cc){return _0x2245cc[_0xeaf5('0xb')](_0xeaf5('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xeaf5('0xd'),'fields':['idField',_0xeaf5('0xe')],'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 4c18176..adf83e6 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 _0x6cc3=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskField,\x20%s,\x20%s','result','catch','util','moment'];(function(_0x5c6d4b,_0x4a091a){var _0x38ed67=function(_0x1212a0){while(--_0x1212a0){_0x5c6d4b['push'](_0x5c6d4b['shift']());}};_0x38ed67(++_0x4a091a);}(_0x6cc3,0x139));var _0x36cc=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x6cc3[_0x55821d];return _0x58ea8a;};'use strict';var _=require('lodash');var util=require(_0x36cc('0x0'));var moment=require(_0x36cc('0x1'));var BPromise=require(_0x36cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36cc('0x3'));var db=require(_0x36cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x36cc('0x5'))(_0x36cc('0x6'));var config=require(_0x36cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x36cc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353307,_0x5652f0,_0xb21e3f){return new BPromise(function(_0x55888,_0x5bdff3){return client[_0x36cc('0x9')](_0x353307,_0xb21e3f)[_0x36cc('0xa')](function(_0xec28ce){logger[_0x36cc('0xb')]('DeskField,\x20%s,\x20%s',_0x5652f0,_0x36cc('0xc'));logger[_0x36cc('0xd')](_0x36cc('0xe'),_0x5652f0,'request\x20sent',JSON[_0x36cc('0xf')](_0xec28ce));if(_0xec28ce[_0x36cc('0x10')]){if(_0xec28ce[_0x36cc('0x10')]['code']===0x1f4){logger[_0x36cc('0x10')]('DeskField,\x20%s,\x20%s',_0x5652f0,_0xec28ce[_0x36cc('0x10')][_0x36cc('0x11')]);return _0x5bdff3(_0xec28ce[_0x36cc('0x10')][_0x36cc('0x11')]);}logger[_0x36cc('0x10')](_0x36cc('0x12'),_0x5652f0,_0xec28ce[_0x36cc('0x10')][_0x36cc('0x11')]);return _0x55888(_0xec28ce['error'][_0x36cc('0x11')]);}else{logger[_0x36cc('0xb')](_0x36cc('0x12'),_0x5652f0,_0x36cc('0xc'));_0x55888(_0xec28ce[_0x36cc('0x13')][_0x36cc('0x11')]);}})[_0x36cc('0x14')](function(_0x36e302){logger['error'](_0x36cc('0x12'),_0x5652f0,_0x36e302);_0x5bdff3(_0x36e302);});});} \ No newline at end of file +var _0x9720=['http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','info','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x9720,0xfb));var _0x0972=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x9720[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x0972('0x0'));var moment=require(_0x0972('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0972('0x2'));var db=require(_0x0972('0x3'))['db'];var utils=require(_0x0972('0x4'));var logger=require(_0x0972('0x5'))(_0x0972('0x6'));var config=require(_0x0972('0x7'));var jayson=require(_0x0972('0x8'));var client=jayson['client'][_0x0972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x132052,_0x504701,_0x426195){return new BPromise(function(_0x314cbd,_0x22d1a1){return client[_0x0972('0xa')](_0x132052,_0x426195)[_0x0972('0xb')](function(_0x2af06a){logger['info'](_0x0972('0xc'),_0x504701,_0x0972('0xd'));logger[_0x0972('0xe')](_0x0972('0xf'),_0x504701,_0x0972('0xd'),JSON['stringify'](_0x2af06a));if(_0x2af06a[_0x0972('0x10')]){if(_0x2af06a[_0x0972('0x10')]['code']===0x1f4){logger[_0x0972('0x10')](_0x0972('0xc'),_0x504701,_0x2af06a[_0x0972('0x10')][_0x0972('0x11')]);return _0x22d1a1(_0x2af06a['error']['message']);}logger[_0x0972('0x10')](_0x0972('0xc'),_0x504701,_0x2af06a[_0x0972('0x10')][_0x0972('0x11')]);return _0x314cbd(_0x2af06a[_0x0972('0x10')]['message']);}else{logger[_0x0972('0x12')](_0x0972('0xc'),_0x504701,_0x0972('0xd'));_0x314cbd(_0x2af06a['result'][_0x0972('0x11')]);}})[_0x0972('0x13')](function(_0x390f03){logger[_0x0972('0x10')](_0x0972('0xc'),_0x504701,_0x390f03);_0x22d1a1(_0x390f03);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 2eea214..1a5442d 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 _0x7e2a=['isAuthenticated','create','addConfiguration','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x7e2a,0x151));var _0xa7e2=function(_0x358000,_0x4efb0e){_0x358000=_0x358000-0x0;var _0x53d1c0=_0x7e2a[_0x358000];return _0x53d1c0;};'use strict';var multer=require(_0xa7e2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa7e2('0x1'));var express=require(_0xa7e2('0x2'));var router=express[_0xa7e2('0x3')]();var fs_extra=require(_0xa7e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa7e2('0x5'));var config=require(_0xa7e2('0x6'));var controller=require(_0xa7e2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa7e2('0x8')]);router[_0xa7e2('0x9')](_0xa7e2('0xa'),auth['isAuthenticated'](),controller[_0xa7e2('0xb')]);router[_0xa7e2('0x9')](_0xa7e2('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xa7e2('0x9')](_0xa7e2('0xd'),auth['isAuthenticated'](),controller[_0xa7e2('0xe')]);router['post']('/',auth[_0xa7e2('0xf')](),controller[_0xa7e2('0x10')]);router['post'](_0xa7e2('0xc'),auth[_0xa7e2('0xf')](),controller[_0xa7e2('0x11')]);router[_0xa7e2('0x12')](_0xa7e2('0xa'),auth[_0xa7e2('0xf')](),controller[_0xa7e2('0x13')]);router['delete'](_0xa7e2('0xa'),auth['isAuthenticated'](),controller[_0xa7e2('0x14')]);module[_0xa7e2('0x15')]=router; \ No newline at end of file +var _0xbb5f=['multer','path','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xbb5f,0x93));var _0xfbb5=function(_0x36ebf7,_0xc3dd9b){_0x36ebf7=_0x36ebf7-0x0;var _0x60b23d=_0xbb5f[_0x36ebf7];return _0x60b23d;};'use strict';var multer=require(_0xfbb5('0x0'));var util=require('util');var path=require(_0xfbb5('0x1'));var timeout=require(_0xfbb5('0x2'));var express=require(_0xfbb5('0x3'));var router=express[_0xfbb5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbb5('0x5'));var config=require('../../config/environment');var controller=require(_0xfbb5('0x6'));router['get']('/',auth[_0xfbb5('0x7')](),controller['index']);router[_0xfbb5('0x8')](_0xfbb5('0x9'),auth['isAuthenticated'](),controller[_0xfbb5('0xa')]);router[_0xfbb5('0x8')](_0xfbb5('0xb'),auth[_0xfbb5('0x7')](),controller['getConfigurations']);router[_0xfbb5('0x8')](_0xfbb5('0xc'),auth[_0xfbb5('0x7')](),controller[_0xfbb5('0xd')]);router[_0xfbb5('0xe')]('/',auth[_0xfbb5('0x7')](),controller[_0xfbb5('0xf')]);router['post'](_0xfbb5('0xb'),auth['isAuthenticated'](),controller[_0xfbb5('0x10')]);router['put'](_0xfbb5('0x9'),auth[_0xfbb5('0x7')](),controller[_0xfbb5('0x11')]);router[_0xfbb5('0x12')](_0xfbb5('0x9'),auth[_0xfbb5('0x7')](),controller[_0xfbb5('0x13')]);module[_0xfbb5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b78ed69..f8dd371 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 _0xef17=['STRING','sequelize','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xef17,0x136));var _0x7ef1=function(_0x5cce10,_0x316d8b){_0x5cce10=_0x5cce10-0x0;var _0x4cf699=_0xef17[_0x5cce10];return _0x4cf699;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')]},'username':{'type':Sequelize[_0x7ef1('0x2')]},'password':{'type':Sequelize[_0x7ef1('0x2')]},'remoteUri':{'type':Sequelize[_0x7ef1('0x2')]},'tenantId':{'type':Sequelize[_0x7ef1('0x2')]},'clientId':{'type':Sequelize[_0x7ef1('0x2')]},'clientSecret':{'type':Sequelize[_0x7ef1('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7ef1('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x09f4=['STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09f4,0xe4));var _0x409f=function(_0x472443,_0x190547){_0x472443=_0x472443-0x0;var _0x171eef=_0x09f4[_0x472443];return _0x171eef;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')]},'username':{'type':Sequelize[_0x409f('0x0')]},'password':{'type':Sequelize[_0x409f('0x0')]},'remoteUri':{'type':Sequelize[_0x409f('0x0')]},'tenantId':{'type':Sequelize[_0x409f('0x0')]},'clientId':{'type':Sequelize[_0x409f('0x0')]},'clientSecret':{'type':Sequelize[_0x409f('0x0')]},'serverUrl':{'type':Sequelize[_0x409f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x409f('0x0')]},'modernAuthentication':{'type':Sequelize[_0x409f('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 96005d2..5ee2944 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 _0x1371=['attributes','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','length','options','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','Descriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','ticketType','Incident','title','description','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','Bearer\x20','Attributes','LogicalName','forEach','@odata.type','lastIndexOf','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials','EntityDefinitions(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','Content-Range','then','destroy','end','sendStatus','error','stack','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','name','query','intersection','fields'];(function(_0x530b0f,_0x279f3e){var _0x5e8c60=function(_0x582a56){while(--_0x582a56){_0x530b0f['push'](_0x530b0f['shift']());}};_0x5e8c60(++_0x279f3e);}(_0x1371,0x91));var _0x1137=function(_0x5c6653,_0x5c6216){_0x5c6653=_0x5c6653-0x0;var _0x26d618=_0x1371[_0x5c6653];return _0x26d618;};'use strict';var rp=require(_0x1137('0x0'));var util=require(_0x1137('0x1'));var _=require(_0x1137('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x1137('0x3'))(_0x1137('0x4'));var db=require(_0x1137('0x5'))['db'];var integrations=require(_0x1137('0x6'));function respondWithResult(_0x8d13c8,_0x200e56){_0x200e56=_0x200e56||0xc8;return function(_0xd25507){if(_0xd25507){return _0x8d13c8[_0x1137('0x7')](_0x200e56)['json'](_0xd25507);}};}function respondWithFilteredResult(_0x1933a8,_0x4e2d0a){return function(_0x4596e5){if(_0x4596e5){var _0xd6ecc8=typeof _0x4e2d0a[_0x1137('0x8')]===_0x1137('0x9')&&typeof _0x4e2d0a['limit']===_0x1137('0x9');var _0x6d8a66=_0x4596e5[_0x1137('0xa')];var _0x2f04ac=_0xd6ecc8?0x0:_0x4e2d0a['offset'];var _0x34696b=_0xd6ecc8?_0x4596e5['count']:_0x4e2d0a[_0x1137('0x8')]+_0x4e2d0a[_0x1137('0xb')];var _0x1acc95;if(_0x34696b>=_0x6d8a66){_0x34696b=_0x6d8a66;_0x1acc95=0xc8;}else{_0x1acc95=0xce;}_0x1933a8['status'](_0x1acc95);return _0x1933a8['set'](_0x1137('0xc'),_0x2f04ac+'-'+_0x34696b+'/'+_0x6d8a66)['json'](_0x4596e5);}return null;};}function saveUpdates(_0xd5bfad){return function(_0x6e9f75){if(_0x6e9f75){return _0x6e9f75['update'](_0xd5bfad)[_0x1137('0xd')](function(_0x5d21d6){return _0x5d21d6;});}return null;};}function removeEntity(_0x5b33b0){return function(_0x54c32a){if(_0x54c32a){return _0x54c32a[_0x1137('0xe')]()[_0x1137('0xd')](function(){_0x5b33b0[_0x1137('0x7')](0xcc)[_0x1137('0xf')]();});}};}function handleEntityNotFound(_0x446811){return function(_0x40122f){if(!_0x40122f){_0x446811[_0x1137('0x10')](0x194);}return _0x40122f;};}function handleError(_0x33bb3e,_0x263f32){_0x263f32=_0x263f32||0x1f4;return function(_0x1cced2){logger[_0x1137('0x11')](_0x1cced2[_0x1137('0x12')]);if(_0x1cced2['name']){delete _0x1cced2['name'];}_0x33bb3e[_0x1137('0x7')](_0x263f32)[_0x1137('0x13')](_0x1cced2);};}exports[_0x1137('0x14')]=function(_0x5bcedf,_0x5ed029){var _0x14eabd={},_0x2910b8={},_0x5dfa40={'count':0x0,'rows':[]};var _0x4aef09=_[_0x1137('0x15')](db[_0x1137('0x16')][_0x1137('0x17')],function(_0x1960a4){return{'name':_0x1960a4[_0x1137('0x18')],'type':_0x1960a4['type'][_0x1137('0x19')]};});_0x2910b8[_0x1137('0x1a')]=_[_0x1137('0x15')](_0x4aef09,_0x1137('0x1b'));_0x2910b8[_0x1137('0x1c')]=_['keys'](_0x5bcedf[_0x1137('0x1c')]);_0x2910b8['filters']=_['intersection'](_0x2910b8[_0x1137('0x1a')],_0x2910b8['query']);_0x14eabd['attributes']=_[_0x1137('0x1d')](_0x2910b8['model'],qs[_0x1137('0x1e')](_0x5bcedf[_0x1137('0x1c')]['fields']));_0x14eabd[_0x1137('0x1f')]=_0x14eabd[_0x1137('0x1f')]['length']?_0x14eabd['attributes']:_0x2910b8['model'];if(!_0x5bcedf[_0x1137('0x1c')]['hasOwnProperty'](_0x1137('0x20'))){_0x14eabd[_0x1137('0xb')]=qs[_0x1137('0xb')](_0x5bcedf[_0x1137('0x1c')][_0x1137('0xb')]);_0x14eabd[_0x1137('0x8')]=qs[_0x1137('0x8')](_0x5bcedf[_0x1137('0x1c')][_0x1137('0x8')]);}_0x14eabd[_0x1137('0x21')]=qs[_0x1137('0x22')](_0x5bcedf[_0x1137('0x1c')]['sort']);_0x14eabd[_0x1137('0x23')]=qs['filters'](_[_0x1137('0x24')](_0x5bcedf[_0x1137('0x1c')],_0x2910b8[_0x1137('0x25')]),_0x4aef09);if(_0x5bcedf[_0x1137('0x1c')]['filter']){_0x14eabd[_0x1137('0x23')]=_[_0x1137('0x26')](_0x14eabd[_0x1137('0x23')],{'$or':_['map'](_0x4aef09,function(_0x32d318){if(_0x32d318[_0x1137('0x27')]!==_0x1137('0x28')){var _0x5383be={};_0x5383be[_0x32d318['name']]={'$like':'%'+_0x5bcedf[_0x1137('0x1c')][_0x1137('0x29')]+'%'};return _0x5383be;}})});}_0x14eabd=_[_0x1137('0x26')]({},_0x14eabd,_0x5bcedf['options']);var _0x55a9c2={'where':_0x14eabd[_0x1137('0x23')]};return db['Dynamics365Account'][_0x1137('0xa')](_0x55a9c2)['then'](function(_0x29cfb0){_0x5dfa40[_0x1137('0xa')]=_0x29cfb0;if(_0x5bcedf[_0x1137('0x1c')][_0x1137('0x2a')]){_0x14eabd[_0x1137('0x2b')]=[{'all':!![]}];}return db[_0x1137('0x16')]['findAll'](_0x14eabd);})[_0x1137('0xd')](function(_0x1a538c){_0x5dfa40[_0x1137('0x2c')]=_0x1a538c;return _0x5dfa40;})[_0x1137('0xd')](respondWithFilteredResult(_0x5ed029,_0x14eabd))[_0x1137('0x2d')](handleError(_0x5ed029,null));};exports[_0x1137('0x2e')]=function(_0x41f891,_0x51983f){var _0x553447={'raw':![],'where':{'id':_0x41f891[_0x1137('0x2f')]['id']}},_0x512976={};_0x512976[_0x1137('0x1a')]=_['keys'](db['Dynamics365Account'][_0x1137('0x17')]);_0x512976[_0x1137('0x1c')]=_[_0x1137('0x30')](_0x41f891['query']);_0x512976['filters']=_[_0x1137('0x1d')](_0x512976[_0x1137('0x1a')],_0x512976['query']);_0x553447[_0x1137('0x1f')]=_[_0x1137('0x1d')](_0x512976['model'],qs[_0x1137('0x1e')](_0x41f891[_0x1137('0x1c')][_0x1137('0x1e')]));_0x553447[_0x1137('0x1f')]=_0x553447[_0x1137('0x1f')][_0x1137('0x31')]?_0x553447[_0x1137('0x1f')]:_0x512976[_0x1137('0x1a')];if(_0x41f891['query'][_0x1137('0x2a')]){_0x553447[_0x1137('0x2b')]=[{'all':!![]}];}_0x553447=_['merge']({},_0x553447,_0x41f891[_0x1137('0x32')]);return db['Dynamics365Account']['find'](_0x553447)[_0x1137('0xd')](handleEntityNotFound(_0x51983f,null))[_0x1137('0xd')](respondWithResult(_0x51983f,null))[_0x1137('0x2d')](handleError(_0x51983f,null));};exports[_0x1137('0x33')]=function(_0x43f085,_0x395f08){return db[_0x1137('0x16')][_0x1137('0x33')](_0x43f085[_0x1137('0x34')],{})[_0x1137('0xd')](respondWithResult(_0x395f08,0xc9))[_0x1137('0x2d')](handleError(_0x395f08,null));};exports['update']=function(_0x12f385,_0x2d2a48){if(_0x12f385[_0x1137('0x34')]['id']){delete _0x12f385[_0x1137('0x34')]['id'];}return db[_0x1137('0x16')]['find']({'where':{'id':_0x12f385['params']['id']}})[_0x1137('0xd')](handleEntityNotFound(_0x2d2a48,null))[_0x1137('0xd')](saveUpdates(_0x12f385[_0x1137('0x34')],null))[_0x1137('0xd')](respondWithResult(_0x2d2a48,null))[_0x1137('0x2d')](handleError(_0x2d2a48,null));};exports[_0x1137('0xe')]=function(_0x1f15b3,_0x5863f4){return db[_0x1137('0x16')]['find']({'where':{'id':_0x1f15b3[_0x1137('0x2f')]['id']}})[_0x1137('0xd')](handleEntityNotFound(_0x5863f4,null))[_0x1137('0xd')](removeEntity(_0x5863f4,null))[_0x1137('0x2d')](handleError(_0x5863f4,null));};exports[_0x1137('0x35')]=function(_0x5cc719,_0xb312be){var _0x3256fc={};var _0x1a41b5={};var _0x4c2488;var _0x40db8e;return db[_0x1137('0x16')][_0x1137('0x36')]({'where':{'id':_0x5cc719['params']['id']}})[_0x1137('0xd')](handleEntityNotFound(_0xb312be,null))['then'](function(_0x53aa88){if(_0x53aa88){_0x4c2488=_0x53aa88;_0x1a41b5[_0x1137('0x1a')]=_[_0x1137('0x30')](db[_0x1137('0x37')][_0x1137('0x17')]);_0x1a41b5[_0x1137('0x1c')]=_[_0x1137('0x30')](_0x5cc719['query']);_0x1a41b5['filters']=_[_0x1137('0x1d')](_0x1a41b5[_0x1137('0x1a')],_0x1a41b5[_0x1137('0x1c')]);_0x3256fc[_0x1137('0x1f')]=_['intersection'](_0x1a41b5[_0x1137('0x1a')],qs[_0x1137('0x1e')](_0x5cc719[_0x1137('0x1c')]['fields']));_0x3256fc['attributes']=_0x3256fc[_0x1137('0x1f')][_0x1137('0x31')]?_0x3256fc[_0x1137('0x1f')]:_0x1a41b5[_0x1137('0x1a')];_0x3256fc['order']=qs['sort'](_0x5cc719['query'][_0x1137('0x22')]);_0x3256fc['where']=qs[_0x1137('0x25')](_['pick'](_0x5cc719[_0x1137('0x1c')],_0x1a41b5[_0x1137('0x25')]));if(_0x5cc719[_0x1137('0x1c')][_0x1137('0x29')]){_0x3256fc[_0x1137('0x23')]=_[_0x1137('0x26')](_0x3256fc[_0x1137('0x23')],{'$or':_['map'](_0x3256fc[_0x1137('0x1f')],function(_0x2a8630){var _0x584601={};_0x584601[_0x2a8630]={'$like':'%'+_0x5cc719[_0x1137('0x1c')][_0x1137('0x29')]+'%'};return _0x584601;})});}_0x3256fc=_[_0x1137('0x26')]({},_0x3256fc,_0x5cc719[_0x1137('0x32')]);return _0x4c2488['getConfigurations'](_0x3256fc);}})[_0x1137('0xd')](function(_0xe771b0){if(_0xe771b0){_0x40db8e=_0xe771b0[_0x1137('0x31')];if(!_0x5cc719[_0x1137('0x1c')]['hasOwnProperty'](_0x1137('0x20'))){_0x3256fc[_0x1137('0xb')]=qs[_0x1137('0xb')](_0x5cc719[_0x1137('0x1c')][_0x1137('0xb')]);_0x3256fc['offset']=qs[_0x1137('0x8')](_0x5cc719[_0x1137('0x1c')][_0x1137('0x8')]);}return _0x4c2488[_0x1137('0x35')](_0x3256fc);}})['then'](function(_0x22ab86){if(_0x22ab86){return _0x22ab86?{'count':_0x40db8e,'rows':_0x22ab86}:null;}})[_0x1137('0xd')](respondWithResult(_0xb312be,null))[_0x1137('0x2d')](handleError(_0xb312be,null));};exports[_0x1137('0x38')]=function(_0x9fc2ca,_0xff3fd8){if(_0x9fc2ca[_0x1137('0x34')]['id']){delete _0x9fc2ca[_0x1137('0x34')]['id'];}return db[_0x1137('0x16')][_0x1137('0x36')]({'where':{'id':_0x9fc2ca[_0x1137('0x2f')]['id']}})[_0x1137('0xd')](handleEntityNotFound(_0xff3fd8,null))[_0x1137('0xd')](function(_0x9003b3){if(_0x9003b3){_0x9fc2ca[_0x1137('0x34')][_0x1137('0x39')]=_0x9003b3['id'];_0x9fc2ca['body'][_0x1137('0x3a')]=integrations['getSubjects'](_0x9fc2ca['body'][_0x1137('0x3b')],_0x9fc2ca[_0x1137('0x34')][_0x1137('0x27')]);_0x9fc2ca[_0x1137('0x34')][_0x1137('0x3c')]=integrations['getDescriptions'](_0x9fc2ca[_0x1137('0x34')][_0x1137('0x3b')],_0x9fc2ca[_0x1137('0x34')][_0x1137('0x27')]);return db[_0x1137('0x37')][_0x1137('0x33')](_0x9fc2ca['body'],{'include':[{'model':db[_0x1137('0x3d')],'as':_0x1137('0x3a')},{'model':db[_0x1137('0x3d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xff3fd8,null))[_0x1137('0x2d')](handleError(_0xff3fd8,null));};function sanitizeRemoteUri(_0x17f552){var _0x2f02da=_0x17f552[_0x1137('0x3e')](-0x1);if(_0x2f02da==='/')return _0x17f552[_0x1137('0x3f')](0x0,_0x17f552['lastIndexOf'](_0x2f02da));return _0x17f552;}function getWebApiUrl(_0x573995){return util[_0x1137('0x40')](_0x1137('0x41'),_0x573995);}exports['getFields']=function(_0x780d41,_0x43d075){var _0x34edbd=_0x780d41[_0x1137('0x1c')][_0x1137('0x42')];var _0x261bf2=_0x34edbd==='incident'?_0x1137('0x43'):'PhoneCall';var _0x3892bf='';var _0xd10223='';var _0x304c35='';var _0x563937='';var _0x12a943='';var _0x104ca6='';var _0x5d2702='';var _0x3e70fd='';var _0x499d01=[_0x1137('0x44'),_0x1137('0x45'),'customerid','ownerid',_0x1137('0x46'),_0x1137('0x47'),_0x1137('0x48'),'regardingobjectid',_0x1137('0x49'),_0x1137('0x4a')];var _0x543aec=['accountidname',_0x1137('0x4b'),_0x1137('0x4c'),'billedserviceunits',_0x1137('0x4d'),_0x1137('0x4e'),'contractdetailidname','contractidname',_0x1137('0x4f'),_0x1137('0x50'),_0x1137('0x51'),_0x1137('0x52'),_0x1137('0x53'),_0x1137('0x54'),'createdonbehalfbyyominame','customeridname',_0x1137('0x55'),_0x1137('0x56'),_0x1137('0x57'),_0x1137('0x58'),_0x1137('0x59'),_0x1137('0x5a'),_0x1137('0x5b'),_0x1137('0x5c'),_0x1137('0x5d'),_0x1137('0x5e'),_0x1137('0x5f'),_0x1137('0x60'),_0x1137('0x61'),'lastonholdtime','masteridname','modifiedbyexternalpartyname',_0x1137('0x62'),_0x1137('0x63'),'modifiedbyyominame',_0x1137('0x64'),_0x1137('0x65'),_0x1137('0x66'),_0x1137('0x67'),'msdyn_iotalertname',_0x1137('0x68'),'onholdtime',_0x1137('0x69'),_0x1137('0x6a'),_0x1137('0x6b'),_0x1137('0x6c'),_0x1137('0x6d'),'primarycontactidname',_0x1137('0x6e'),_0x1137('0x6f'),_0x1137('0x70'),_0x1137('0x71'),_0x1137('0x72'),'resolvebykpiidname','responseby','responsiblecontactidname',_0x1137('0x73'),_0x1137('0x74'),_0x1137('0x75'),'slaname','socialprofileidname','statecode',_0x1137('0x76'),_0x1137('0x77'),_0x1137('0x78'),'timezoneruleversionnumber','transactioncurrencyidname',_0x1137('0x79'),_0x1137('0x7a'),_0x1137('0x7b')];var _0xc30cf6=_0x499d01[_0x1137('0x7c')](_0x543aec);return db[_0x1137('0x16')][_0x1137('0x36')]({'where':{'id':_0x780d41['params']['id']},'attributes':['id',_0x1137('0x7d'),_0x1137('0x7e'),_0x1137('0x7f'),_0x1137('0x80'),_0x1137('0x81'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x1137('0x82')],'as':_0x1137('0x82'),'attributes':['id',_0x1137('0x83'),_0x1137('0x84')]}]})['then'](handleEntityNotFound(_0x43d075,null))[_0x1137('0xd')](function(_0x3e35b2){if(_0x3e35b2){if(_0x3e35b2[_0x1137('0x85')]){_0x3e35b2[_0x1137('0x86')]=_0x3e35b2[_0x1137('0x82')][_0x1137('0x83')];_0x3e70fd=sanitizeRemoteUri(_0x3e35b2[_0x1137('0x82')][_0x1137('0x84')]);_0x5d2702=getWebApiUrl(_0x3e70fd);return _0x3e35b2;}_0x3e70fd=sanitizeRemoteUri(_0x3e35b2[_0x1137('0x7f')]);_0x5d2702=getWebApiUrl(_0x3e70fd);var _0x14a2dd={'method':_0x1137('0x87'),'uri':_0x1137('0x88')+_0x3e35b2[_0x1137('0x80')]+_0x1137('0x89'),'form':{'client_id':_0x3e35b2[_0x1137('0x81')],'resource':_0x3e70fd,'username':_0x3e35b2[_0x1137('0x7d')],'password':_0x3e35b2[_0x1137('0x7e')],'grant_type':_0x1137('0x7e'),'client_secret':_0x3e35b2[_0x1137('0x8a')]},'json':!![]};return rp(_0x14a2dd);}})['then'](function(_0x14d5eb){_0x104ca6=_0x14d5eb[_0x1137('0x86')];var _0x5a8877={'method':'GET','uri':encodeURI(_0x5d2702+_0x1137('0x8b')+_0x261bf2+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x104ca6,'If-None-Match':null,'OData-Version':_0x1137('0x8c')},'json':!![]};return rp(_0x5a8877);})[_0x1137('0xd')](function(_0x296680){var _0x4f862b=_0x296680[_0x1137('0x8d')][0x0];var _0x5c1253=_0x4f862b[_0x1137('0x8e')];var _0x425b7a={'method':_0x1137('0x8f'),'uri':_0x5d2702+'EntityDefinitions('+_0x5c1253+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1137('0x90')+_0x104ca6,'If-None-Match':null,'OData-Version':_0x1137('0x8c')},'json':!![]};return rp(_0x425b7a);})['then'](function(_0x16eba6){_0x3892bf=_0x16eba6;_0xd10223=_0x3892bf[_0x1137('0x91')];_0xd10223=_['remove'](_0xd10223,function(_0x415363){return!_0xc30cf6['includes'](_0x415363[_0x1137('0x92')]);});var _0x5aee80=[];var _0x436eea=[];_0xd10223[_0x1137('0x93')](function(_0x36cb29){if(_0x36cb29[_0x1137('0x94')]){var _0x5cde68=_0x36cb29['@odata.type'][_0x1137('0x3f')](_0x36cb29[_0x1137('0x94')][_0x1137('0x95')]('.')+0x1);if(_0x5cde68==='PicklistAttributeMetadata'){_0x5aee80[_0x1137('0x96')](getSelectList(_0x5d2702,_0x34edbd,_0x436eea,_0x3892bf['MetadataId'],_0x36cb29[_0x1137('0x8e')],_0x104ca6));}}});return Promise[_0x1137('0x97')](_0x5aee80);})['then'](function(_0x59fda9){_0x304c35=_0x59fda9[0x0];var _0x34007f=[];var _0x3a037f=[];_0xd10223[_0x1137('0x93')](function(_0x838999){if(!_[_0x1137('0x98')](_0x838999['@odata.type'])){var _0x30cfe9=_0x838999[_0x1137('0x94')]['substring'](_0x838999[_0x1137('0x94')][_0x1137('0x95')]('.')+0x1);if(_0x30cfe9===_0x1137('0x99')){_0x34007f[_0x1137('0x96')](getBooleanList(_0x5d2702,_0x34edbd,_0x3a037f,_0x3892bf[_0x1137('0x8e')],_0x838999[_0x1137('0x8e')],_0x104ca6));}}});return Promise['all'](_0x34007f);})['then'](function(_0x34a23f){_0x563937=_0x34a23f[0x0];var _0x40a836=[];var _0x371468=[];_0xd10223[_0x1137('0x93')](function(_0x374a3d){if(_0x374a3d[_0x1137('0x94')]){var _0x29dd36=_0x374a3d[_0x1137('0x94')]['substring'](_0x374a3d['@odata.type'][_0x1137('0x95')]('.')+0x1);if(_0x29dd36===_0x1137('0x9a')||_0x29dd36===_0x1137('0x9b')||_0x29dd36===_0x1137('0x9c')||_0x29dd36===_0x1137('0x9d')||_0x29dd36==='MemoAttributeMetadata'||_0x29dd36===_0x1137('0x9e')||_0x29dd36==='StatusAttributeMetadata'||_0x29dd36===_0x1137('0x9f')||_0x29dd36===_0x1137('0xa0')||_0x29dd36===_0x1137('0xa1')){_0x40a836[_0x1137('0x96')](getInputList(_0x5d2702,_0x34edbd,_0x29dd36,_0x371468,_0x3892bf[_0x1137('0x8e')],_0x374a3d[_0x1137('0x8e')],_0x104ca6));}}});return Promise[_0x1137('0x97')](_0x40a836);})[_0x1137('0xd')](function(_0x198f3e){_0x12a943=_0x198f3e[0x0];var _0x581835=_0x304c35[_0x1137('0x7c')](_0x563937)[_0x1137('0x7c')](_0x12a943);var _0x331a01={'count':_0x581835[_0x1137('0x31')],'rows':_0x581835};return _0x331a01;})[_0x1137('0xd')](respondWithResult(_0x43d075,null))[_0x1137('0x2d')](function(_0x50b3b8){var _0x1bbdfc=_0x780d41[_0x1137('0x1c')]['test']?0x1f4:_0x50b3b8[_0x1137('0xa2')]||0x1f4;logger['error'](_0x50b3b8[_0x1137('0x12')]);delete _0x50b3b8[_0x1137('0x1b')];if(_0x1bbdfc===0x191){_0x1bbdfc=0x190;}_0x43d075[_0x1137('0x7')](_0x1bbdfc)[_0x1137('0x13')](_0x780d41[_0x1137('0x1c')]['test']?{'message':_0x1137('0xa3'),'statusCode':_0x50b3b8[_0x1137('0xa2')]}:_0x50b3b8);});};function getSelectList(_0x2aa0fd,_0x1e1b63,_0x49601e,_0x1cac3b,_0x4ae2a4,_0x1abb7d){var _0x1bdb0c={'method':_0x1137('0x8f'),'uri':_0x2aa0fd+_0x1137('0xa4')+_0x1cac3b+')/Attributes('+_0x4ae2a4+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x1137('0xa5'),'headers':{'Authorization':_0x1137('0x90')+_0x1abb7d,'If-None-Match':null,'OData-Version':_0x1137('0x8c')},'json':!![]};return rp(_0x1bdb0c)[_0x1137('0xd')](function(_0x536735){var _0x2354f4=[];var _0x52763b=_0x536735['OptionSet']['Options'];_0x52763b['forEach'](function(_0x1ae3b6){_0x2354f4[_0x1137('0x96')]({'name':_0x1ae3b6[_0x1137('0xa6')][_0x1137('0xa7')][_0x1137('0xa6')],'value':String(_0x1ae3b6[_0x1137('0xa8')])});});var _0x22c525={'id':_0x1e1b63+'_'+_0x536735[_0x1137('0x92')],'name':_0x536735[_0x1137('0xa9')][_0x1137('0xa7')][_0x1137('0xa6')],'custom':![],'options':_0x2354f4};_0x49601e['push'](_0x22c525);return _0x49601e;});}function getBooleanList(_0x408d89,_0xfdbd21,_0x147ca5,_0x181c9c,_0x2734ec,_0x537144){var _0x1472f8={'method':_0x1137('0x8f'),'uri':_0x408d89+_0x1137('0xa4')+_0x181c9c+_0x1137('0xaa')+_0x2734ec+_0x1137('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x537144,'If-None-Match':null,'OData-Version':_0x1137('0x8c')},'json':!![]};return rp(_0x1472f8)[_0x1137('0xd')](function(_0x1fd137){var _0x1cf79e=[];_0x1cf79e[_0x1137('0x96')]({'name':_0x1fd137['OptionSet'][_0x1137('0xac')][_0x1137('0xa6')]['UserLocalizedLabel'][_0x1137('0xa6')],'value':_0x1137('0xad')},{'name':_0x1fd137['OptionSet']['FalseOption'][_0x1137('0xa6')]['UserLocalizedLabel'][_0x1137('0xa6')],'value':'false'});var _0x1c762d={'id':_0xfdbd21+'_'+_0x1fd137[_0x1137('0x92')],'name':_0x1fd137[_0x1137('0xa9')][_0x1137('0xa7')][_0x1137('0xa6')],'custom':![],'options':_0x1cf79e};_0x147ca5[_0x1137('0x96')](_0x1c762d);return _0x147ca5;});}function getInputList(_0x25ce77,_0xb18f96,_0x48d1d2,_0x166dc0,_0x12d61a,_0x58aa01,_0x119e63){var _0x5e5afe={'method':_0x1137('0x8f'),'uri':_0x25ce77+_0x1137('0xa4')+_0x12d61a+_0x1137('0xaa')+_0x58aa01+_0x1137('0xae')+_0x48d1d2+_0x1137('0xaf'),'headers':{'Authorization':_0x1137('0x90')+_0x119e63,'If-None-Match':null,'OData-Version':_0x1137('0x8c')},'json':!![]};return rp(_0x5e5afe)[_0x1137('0xd')](function(_0x34a80f){var _0x3ec516={'id':_0xb18f96+'_'+_0x34a80f[_0x1137('0x92')],'name':_0x34a80f['DisplayName'][_0x1137('0xa7')]?_0x34a80f[_0x1137('0xa9')][_0x1137('0xa7')][_0x1137('0xa6')]:_0x34a80f[_0x1137('0x92')],'custom':![],'options':[]};_0x166dc0['push'](_0x3ec516);return _0x166dc0;});} \ No newline at end of file +var _0x26e4=['data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','Bearer\x20','4.0','MetadataId','GET','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','send','map','Dynamics365Account','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','findOne','Dynamics365Configuration','order','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x26e4,0xec));var _0x426e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x26e4[_0x17d9e3];return _0x14192d;};'use strict';var rp=require('request-promise');var util=require(_0x426e('0x0'));var _=require(_0x426e('0x1'));var qs=require(_0x426e('0x2'));var logger=require(_0x426e('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x426e('0x4'));function respondWithResult(_0x335e12,_0x5141b0){_0x5141b0=_0x5141b0||0xc8;return function(_0x5b6f8b){if(_0x5b6f8b){return _0x335e12[_0x426e('0x5')](_0x5141b0)[_0x426e('0x6')](_0x5b6f8b);}};}function respondWithFilteredResult(_0x14300a,_0x4a8c5f){return function(_0x5c7001){if(_0x5c7001){var _0x4bb8ac=typeof _0x4a8c5f[_0x426e('0x7')]===_0x426e('0x8')&&typeof _0x4a8c5f[_0x426e('0x9')]===_0x426e('0x8');var _0x597999=_0x5c7001[_0x426e('0xa')];var _0x3023d8=_0x4bb8ac?0x0:_0x4a8c5f['offset'];var _0x2580cb=_0x4bb8ac?_0x5c7001[_0x426e('0xa')]:_0x4a8c5f[_0x426e('0x7')]+_0x4a8c5f['limit'];var _0x57a8c3;if(_0x2580cb>=_0x597999){_0x2580cb=_0x597999;_0x57a8c3=0xc8;}else{_0x57a8c3=0xce;}_0x14300a['status'](_0x57a8c3);return _0x14300a[_0x426e('0xb')](_0x426e('0xc'),_0x3023d8+'-'+_0x2580cb+'/'+_0x597999)[_0x426e('0x6')](_0x5c7001);}return null;};}function saveUpdates(_0x3ad93d){return function(_0x870370){if(_0x870370){return _0x870370[_0x426e('0xd')](_0x3ad93d)[_0x426e('0xe')](function(_0x20b871){return _0x20b871;});}return null;};}function removeEntity(_0x23a17e){return function(_0x3b639e){if(_0x3b639e){return _0x3b639e['destroy']()[_0x426e('0xe')](function(){_0x23a17e[_0x426e('0x5')](0xcc)[_0x426e('0xf')]();});}};}function handleEntityNotFound(_0x5f0c56){return function(_0x263a6e){if(!_0x263a6e){_0x5f0c56['sendStatus'](0x194);}return _0x263a6e;};}function handleError(_0x2981d6,_0x4ea621){_0x4ea621=_0x4ea621||0x1f4;return function(_0x1e9e38){logger[_0x426e('0x10')](_0x1e9e38[_0x426e('0x11')]);if(_0x1e9e38[_0x426e('0x12')]){delete _0x1e9e38['name'];}_0x2981d6['status'](_0x4ea621)[_0x426e('0x13')](_0x1e9e38);};}exports['index']=function(_0x2c2a05,_0x4cc897){var _0x288d95={},_0x48deb9={},_0x2df9da={'count':0x0,'rows':[]};var _0x25e700=_[_0x426e('0x14')](db[_0x426e('0x15')][_0x426e('0x16')],function(_0x3ad2e1){return{'name':_0x3ad2e1['fieldName'],'type':_0x3ad2e1[_0x426e('0x17')][_0x426e('0x18')]};});_0x48deb9['model']=_[_0x426e('0x14')](_0x25e700,'name');_0x48deb9[_0x426e('0x19')]=_[_0x426e('0x1a')](_0x2c2a05['query']);_0x48deb9['filters']=_['intersection'](_0x48deb9[_0x426e('0x1b')],_0x48deb9[_0x426e('0x19')]);_0x288d95['attributes']=_[_0x426e('0x1c')](_0x48deb9['model'],qs['fields'](_0x2c2a05['query'][_0x426e('0x1d')]));_0x288d95[_0x426e('0x1e')]=_0x288d95['attributes'][_0x426e('0x1f')]?_0x288d95['attributes']:_0x48deb9['model'];if(!_0x2c2a05[_0x426e('0x19')][_0x426e('0x20')]('nolimit')){_0x288d95[_0x426e('0x9')]=qs[_0x426e('0x9')](_0x2c2a05[_0x426e('0x19')][_0x426e('0x9')]);_0x288d95['offset']=qs['offset'](_0x2c2a05['query'][_0x426e('0x7')]);}_0x288d95['order']=qs[_0x426e('0x21')](_0x2c2a05[_0x426e('0x19')][_0x426e('0x21')]);_0x288d95[_0x426e('0x22')]=qs['filters'](_[_0x426e('0x23')](_0x2c2a05[_0x426e('0x19')],_0x48deb9[_0x426e('0x24')]),_0x25e700);if(_0x2c2a05[_0x426e('0x19')][_0x426e('0x25')]){_0x288d95[_0x426e('0x22')]=_[_0x426e('0x26')](_0x288d95['where'],{'$or':_[_0x426e('0x14')](_0x25e700,function(_0x31bb67){if(_0x31bb67[_0x426e('0x17')]!=='VIRTUAL'){var _0x3598e1={};_0x3598e1[_0x31bb67[_0x426e('0x12')]]={'$like':'%'+_0x2c2a05[_0x426e('0x19')][_0x426e('0x25')]+'%'};return _0x3598e1;}})});}_0x288d95=_[_0x426e('0x26')]({},_0x288d95,_0x2c2a05[_0x426e('0x27')]);var _0x3c325b={'where':_0x288d95[_0x426e('0x22')]};return db['Dynamics365Account'][_0x426e('0xa')](_0x3c325b)['then'](function(_0x475c81){_0x2df9da[_0x426e('0xa')]=_0x475c81;if(_0x2c2a05[_0x426e('0x19')][_0x426e('0x28')]){_0x288d95[_0x426e('0x29')]=[{'all':!![]}];}return db[_0x426e('0x15')][_0x426e('0x2a')](_0x288d95);})[_0x426e('0xe')](function(_0x5ba3d4){_0x2df9da[_0x426e('0x2b')]=_0x5ba3d4;return _0x2df9da;})[_0x426e('0xe')](respondWithFilteredResult(_0x4cc897,_0x288d95))[_0x426e('0x2c')](handleError(_0x4cc897,null));};exports['show']=function(_0x592027,_0x4fe3bf){var _0x5adc13={'raw':![],'where':{'id':_0x592027[_0x426e('0x2d')]['id']}},_0x47f864={};_0x47f864[_0x426e('0x1b')]=_[_0x426e('0x1a')](db['Dynamics365Account']['rawAttributes']);_0x47f864['query']=_[_0x426e('0x1a')](_0x592027['query']);_0x47f864[_0x426e('0x24')]=_[_0x426e('0x1c')](_0x47f864[_0x426e('0x1b')],_0x47f864['query']);_0x5adc13[_0x426e('0x1e')]=_[_0x426e('0x1c')](_0x47f864[_0x426e('0x1b')],qs[_0x426e('0x1d')](_0x592027['query'][_0x426e('0x1d')]));_0x5adc13['attributes']=_0x5adc13[_0x426e('0x1e')][_0x426e('0x1f')]?_0x5adc13[_0x426e('0x1e')]:_0x47f864[_0x426e('0x1b')];if(_0x592027['query'][_0x426e('0x28')]){_0x5adc13[_0x426e('0x29')]=[{'all':!![]}];}_0x5adc13=_[_0x426e('0x26')]({},_0x5adc13,_0x592027[_0x426e('0x27')]);return db[_0x426e('0x15')][_0x426e('0x2e')](_0x5adc13)[_0x426e('0xe')](handleEntityNotFound(_0x4fe3bf,null))[_0x426e('0xe')](respondWithResult(_0x4fe3bf,null))['catch'](handleError(_0x4fe3bf,null));};exports[_0x426e('0x2f')]=function(_0x4c6085,_0x3877fb){return db[_0x426e('0x15')][_0x426e('0x2f')](_0x4c6085['body'],{})[_0x426e('0xe')](respondWithResult(_0x3877fb,0xc9))['catch'](handleError(_0x3877fb,null));};exports[_0x426e('0xd')]=function(_0x2e6d02,_0xf0b9be){if(_0x2e6d02[_0x426e('0x30')]['id']){delete _0x2e6d02[_0x426e('0x30')]['id'];}return db[_0x426e('0x15')][_0x426e('0x2e')]({'where':{'id':_0x2e6d02[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0xf0b9be,null))['then'](saveUpdates(_0x2e6d02[_0x426e('0x30')],null))['then'](respondWithResult(_0xf0b9be,null))[_0x426e('0x2c')](handleError(_0xf0b9be,null));};exports[_0x426e('0x31')]=function(_0x574cdf,_0x79084a){return db[_0x426e('0x15')][_0x426e('0x2e')]({'where':{'id':_0x574cdf[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0x79084a,null))['then'](removeEntity(_0x79084a,null))['catch'](handleError(_0x79084a,null));};exports['getConfigurations']=function(_0x3fc16c,_0x22bc7c){var _0xb260a={};var _0x101b11={};var _0x2624dc;var _0x27cd48;return db[_0x426e('0x15')][_0x426e('0x32')]({'where':{'id':_0x3fc16c[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0x22bc7c,null))[_0x426e('0xe')](function(_0x3d53b1){if(_0x3d53b1){_0x2624dc=_0x3d53b1;_0x101b11[_0x426e('0x1b')]=_['keys'](db[_0x426e('0x33')][_0x426e('0x16')]);_0x101b11[_0x426e('0x19')]=_[_0x426e('0x1a')](_0x3fc16c[_0x426e('0x19')]);_0x101b11[_0x426e('0x24')]=_[_0x426e('0x1c')](_0x101b11[_0x426e('0x1b')],_0x101b11[_0x426e('0x19')]);_0xb260a['attributes']=_[_0x426e('0x1c')](_0x101b11[_0x426e('0x1b')],qs[_0x426e('0x1d')](_0x3fc16c[_0x426e('0x19')][_0x426e('0x1d')]));_0xb260a[_0x426e('0x1e')]=_0xb260a[_0x426e('0x1e')][_0x426e('0x1f')]?_0xb260a[_0x426e('0x1e')]:_0x101b11[_0x426e('0x1b')];_0xb260a[_0x426e('0x34')]=qs[_0x426e('0x21')](_0x3fc16c['query']['sort']);_0xb260a['where']=qs[_0x426e('0x24')](_['pick'](_0x3fc16c[_0x426e('0x19')],_0x101b11[_0x426e('0x24')]));if(_0x3fc16c[_0x426e('0x19')][_0x426e('0x25')]){_0xb260a['where']=_[_0x426e('0x26')](_0xb260a['where'],{'$or':_['map'](_0xb260a[_0x426e('0x1e')],function(_0x16bcaf){var _0x433083={};_0x433083[_0x16bcaf]={'$like':'%'+_0x3fc16c['query'][_0x426e('0x25')]+'%'};return _0x433083;})});}_0xb260a=_[_0x426e('0x26')]({},_0xb260a,_0x3fc16c['options']);return _0x2624dc[_0x426e('0x35')](_0xb260a);}})[_0x426e('0xe')](function(_0x5490a4){if(_0x5490a4){_0x27cd48=_0x5490a4[_0x426e('0x1f')];if(!_0x3fc16c[_0x426e('0x19')]['hasOwnProperty'](_0x426e('0x36'))){_0xb260a[_0x426e('0x9')]=qs[_0x426e('0x9')](_0x3fc16c[_0x426e('0x19')][_0x426e('0x9')]);_0xb260a[_0x426e('0x7')]=qs['offset'](_0x3fc16c[_0x426e('0x19')][_0x426e('0x7')]);}return _0x2624dc['getConfigurations'](_0xb260a);}})[_0x426e('0xe')](function(_0x97d1c){if(_0x97d1c){return _0x97d1c?{'count':_0x27cd48,'rows':_0x97d1c}:null;}})[_0x426e('0xe')](respondWithResult(_0x22bc7c,null))[_0x426e('0x2c')](handleError(_0x22bc7c,null));};exports[_0x426e('0x37')]=function(_0x2ea407,_0x5b5084){if(_0x2ea407[_0x426e('0x30')]['id']){delete _0x2ea407[_0x426e('0x30')]['id'];}return db[_0x426e('0x15')][_0x426e('0x32')]({'where':{'id':_0x2ea407[_0x426e('0x2d')]['id']}})[_0x426e('0xe')](handleEntityNotFound(_0x5b5084,null))[_0x426e('0xe')](function(_0x536167){if(_0x536167){_0x2ea407[_0x426e('0x30')]['AccountId']=_0x536167['id'];_0x2ea407[_0x426e('0x30')][_0x426e('0x38')]=integrations[_0x426e('0x39')](_0x2ea407[_0x426e('0x30')]['channel'],_0x2ea407['body'][_0x426e('0x17')]);_0x2ea407['body'][_0x426e('0x3a')]=integrations[_0x426e('0x3b')](_0x2ea407['body']['channel'],_0x2ea407[_0x426e('0x30')][_0x426e('0x17')]);return db['Dynamics365Configuration'][_0x426e('0x2f')](_0x2ea407[_0x426e('0x30')],{'include':[{'model':db[_0x426e('0x3c')],'as':_0x426e('0x38')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x426e('0xe')](respondWithResult(_0x5b5084,null))[_0x426e('0x2c')](handleError(_0x5b5084,null));};function sanitizeRemoteUri(_0x56791f){var _0x25d65c=_0x56791f[_0x426e('0x3d')](-0x1);if(_0x25d65c==='/')return _0x56791f['substring'](0x0,_0x56791f[_0x426e('0x3e')](_0x25d65c));return _0x56791f;}function getWebApiUrl(_0x5359d5){return util['format'](_0x426e('0x3f'),_0x5359d5);}exports[_0x426e('0x40')]=function(_0x514b99,_0x364119){var _0x5c68fa=_0x514b99[_0x426e('0x19')][_0x426e('0x41')];var _0x4cabd0=_0x5c68fa===_0x426e('0x42')?_0x426e('0x43'):_0x426e('0x44');var _0x2900cc='';var _0x27dd8b='';var _0x52f8a2='';var _0x361c90='';var _0x5b8388='';var _0x487950='';var _0x9136a5='';var _0x5d8311='';var _0x511d73=[_0x426e('0x45'),_0x426e('0x46'),_0x426e('0x47'),'ownerid',_0x426e('0x48'),_0x426e('0x49'),'phonenumber',_0x426e('0x4a'),_0x426e('0x4b'),'phonecall_activity_parties'];var _0x2be501=[_0x426e('0x4c'),_0x426e('0x4d'),_0x426e('0x4e'),_0x426e('0x4f'),'contactidname',_0x426e('0x50'),_0x426e('0x51'),_0x426e('0x52'),_0x426e('0x53'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0x426e('0x54'),_0x426e('0x55'),_0x426e('0x56'),_0x426e('0x57'),_0x426e('0x58'),_0x426e('0x59'),'emailaddress',_0x426e('0x5a'),_0x426e('0x5b'),_0x426e('0x5c'),_0x426e('0x5d'),'exchangerate',_0x426e('0x5e'),_0x426e('0x5f'),_0x426e('0x60'),'influencescore',_0x426e('0x61'),'lastonholdtime','masteridname',_0x426e('0x62'),_0x426e('0x63'),_0x426e('0x64'),_0x426e('0x65'),_0x426e('0x66'),_0x426e('0x67'),_0x426e('0x68'),_0x426e('0x69'),_0x426e('0x6a'),_0x426e('0x6b'),_0x426e('0x6c'),_0x426e('0x6d'),'owneridname',_0x426e('0x6e'),'owneridyominame',_0x426e('0x6f'),_0x426e('0x70'),_0x426e('0x71'),_0x426e('0x72'),_0x426e('0x73'),_0x426e('0x74'),_0x426e('0x75'),'resolvebykpiidname',_0x426e('0x76'),'responsiblecontactidname',_0x426e('0x77'),'sentimentvalue',_0x426e('0x78'),_0x426e('0x79'),'socialprofileidname',_0x426e('0x7a'),_0x426e('0x7b'),'subjectidname',_0x426e('0x7c'),_0x426e('0x7d'),_0x426e('0x7e'),_0x426e('0x7f'),_0x426e('0x80'),_0x426e('0x81')];var _0x295677=_0x511d73[_0x426e('0x82')](_0x2be501);return db[_0x426e('0x15')][_0x426e('0x32')]({'where':{'id':_0x514b99[_0x426e('0x2d')]['id']},'attributes':['id',_0x426e('0x83'),_0x426e('0x84'),_0x426e('0x85'),_0x426e('0x86'),_0x426e('0x87'),'clientSecret',_0x426e('0x88')],'include':[{'model':db[_0x426e('0x89')],'as':_0x426e('0x89'),'attributes':['id',_0x426e('0x8a'),'data7']}]})[_0x426e('0xe')](handleEntityNotFound(_0x364119,null))[_0x426e('0xe')](function(_0x5a481b){if(_0x5a481b){if(_0x5a481b[_0x426e('0x88')]){_0x5a481b[_0x426e('0x8b')]=_0x5a481b[_0x426e('0x89')][_0x426e('0x8a')];_0x5d8311=sanitizeRemoteUri(_0x5a481b[_0x426e('0x89')][_0x426e('0x8c')]);_0x9136a5=getWebApiUrl(_0x5d8311);return _0x5a481b;}_0x5d8311=sanitizeRemoteUri(_0x5a481b[_0x426e('0x85')]);_0x9136a5=getWebApiUrl(_0x5d8311);var _0x44caa5={'method':_0x426e('0x8d'),'uri':_0x426e('0x8e')+_0x5a481b[_0x426e('0x86')]+_0x426e('0x8f'),'form':{'client_id':_0x5a481b[_0x426e('0x87')],'resource':_0x5d8311,'username':_0x5a481b[_0x426e('0x83')],'password':_0x5a481b[_0x426e('0x84')],'grant_type':_0x426e('0x84'),'client_secret':_0x5a481b[_0x426e('0x90')]},'json':!![]};return rp(_0x44caa5);}})[_0x426e('0xe')](function(_0x4843a6){_0x487950=_0x4843a6['access_token'];var _0x406462={'method':'GET','uri':encodeURI(_0x9136a5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4cabd0+'\x27'),'headers':{'Authorization':_0x426e('0x91')+_0x487950,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x406462);})['then'](function(_0xc6885){var _0x22ae68=_0xc6885['value'][0x0];var _0x595de5=_0x22ae68[_0x426e('0x93')];var _0x29f1a9={'method':_0x426e('0x94'),'uri':_0x9136a5+'EntityDefinitions('+_0x595de5+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x487950,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x29f1a9);})[_0x426e('0xe')](function(_0x40c9a4){_0x2900cc=_0x40c9a4;_0x27dd8b=_0x2900cc[_0x426e('0x95')];_0x27dd8b=_[_0x426e('0x96')](_0x27dd8b,function(_0x2a3842){return!_0x295677[_0x426e('0x97')](_0x2a3842[_0x426e('0x98')]);});var _0x7b12eb=[];var _0x57c2b5=[];_0x27dd8b[_0x426e('0x99')](function(_0x2862d6){if(_0x2862d6[_0x426e('0x9a')]){var _0x3e04dd=_0x2862d6['@odata.type'][_0x426e('0x9b')](_0x2862d6[_0x426e('0x9a')][_0x426e('0x3e')]('.')+0x1);if(_0x3e04dd===_0x426e('0x9c')){_0x7b12eb['push'](getSelectList(_0x9136a5,_0x5c68fa,_0x57c2b5,_0x2900cc[_0x426e('0x93')],_0x2862d6['MetadataId'],_0x487950));}}});return Promise[_0x426e('0x9d')](_0x7b12eb);})['then'](function(_0x1a50b2){_0x52f8a2=_0x1a50b2[0x0];var _0x6064ae=[];var _0x775f87=[];_0x27dd8b['forEach'](function(_0x1d4660){if(!_[_0x426e('0x9e')](_0x1d4660[_0x426e('0x9a')])){var _0x51db08=_0x1d4660[_0x426e('0x9a')][_0x426e('0x9b')](_0x1d4660[_0x426e('0x9a')][_0x426e('0x3e')]('.')+0x1);if(_0x51db08===_0x426e('0x9f')){_0x6064ae['push'](getBooleanList(_0x9136a5,_0x5c68fa,_0x775f87,_0x2900cc['MetadataId'],_0x1d4660['MetadataId'],_0x487950));}}});return Promise[_0x426e('0x9d')](_0x6064ae);})['then'](function(_0x4fcdbe){_0x361c90=_0x4fcdbe[0x0];var _0x2d77c4=[];var _0x315c29=[];_0x27dd8b[_0x426e('0x99')](function(_0x50d130){if(_0x50d130['@odata.type']){var _0x545ee5=_0x50d130[_0x426e('0x9a')][_0x426e('0x9b')](_0x50d130[_0x426e('0x9a')][_0x426e('0x3e')]('.')+0x1);if(_0x545ee5==='StringAttributeMetadata'||_0x545ee5==='DoubleAttributeMetadata'||_0x545ee5===_0x426e('0xa0')||_0x545ee5===_0x426e('0xa1')||_0x545ee5==='MemoAttributeMetadata'||_0x545ee5===_0x426e('0xa2')||_0x545ee5===_0x426e('0xa3')||_0x545ee5===_0x426e('0xa4')||_0x545ee5===_0x426e('0xa5')||_0x545ee5===_0x426e('0xa6')){_0x2d77c4[_0x426e('0xa7')](getInputList(_0x9136a5,_0x5c68fa,_0x545ee5,_0x315c29,_0x2900cc[_0x426e('0x93')],_0x50d130[_0x426e('0x93')],_0x487950));}}});return Promise[_0x426e('0x9d')](_0x2d77c4);})[_0x426e('0xe')](function(_0x445fee){_0x5b8388=_0x445fee[0x0];var _0x28b230=_0x52f8a2[_0x426e('0x82')](_0x361c90)[_0x426e('0x82')](_0x5b8388);var _0x1b41da={'count':_0x28b230[_0x426e('0x1f')],'rows':_0x28b230};return _0x1b41da;})[_0x426e('0xe')](respondWithResult(_0x364119,null))[_0x426e('0x2c')](function(_0x18adf2){var _0x5e47de=_0x514b99[_0x426e('0x19')][_0x426e('0xa8')]?0x1f4:_0x18adf2['statusCode']||0x1f4;logger[_0x426e('0x10')](_0x18adf2[_0x426e('0x11')]);delete _0x18adf2[_0x426e('0x12')];if(_0x5e47de===0x191){_0x5e47de=0x190;}_0x364119[_0x426e('0x5')](_0x5e47de)[_0x426e('0x13')](_0x514b99['query'][_0x426e('0xa8')]?{'message':_0x426e('0xa9'),'statusCode':_0x18adf2[_0x426e('0xaa')]}:_0x18adf2);});};function getSelectList(_0x24ad23,_0x4c92e6,_0x95d306,_0x236b9b,_0x1bd9c8,_0x49d9a8){var _0x29a1b6={'method':_0x426e('0x94'),'uri':_0x24ad23+_0x426e('0xab')+_0x236b9b+_0x426e('0xac')+_0x1bd9c8+_0x426e('0xad')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x426e('0x91')+_0x49d9a8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x29a1b6)[_0x426e('0xe')](function(_0x42da22){var _0x27bd2f=[];var _0x32f2b6=_0x42da22[_0x426e('0xae')][_0x426e('0xaf')];_0x32f2b6['forEach'](function(_0x10ec3d){_0x27bd2f[_0x426e('0xa7')]({'name':_0x10ec3d[_0x426e('0xb0')][_0x426e('0xb1')][_0x426e('0xb0')],'value':String(_0x10ec3d[_0x426e('0xb2')])});});var _0x5b6c3c={'id':_0x4c92e6+'_'+_0x42da22['LogicalName'],'name':_0x42da22[_0x426e('0xb3')]['UserLocalizedLabel'][_0x426e('0xb0')],'custom':![],'options':_0x27bd2f};_0x95d306[_0x426e('0xa7')](_0x5b6c3c);return _0x95d306;});}function getBooleanList(_0x30a0d0,_0x54008b,_0x3920af,_0x2e4086,_0x3df844,_0x57cf1a){var _0x30f277={'method':_0x426e('0x94'),'uri':_0x30a0d0+_0x426e('0xab')+_0x2e4086+_0x426e('0xac')+_0x3df844+_0x426e('0xb4'),'headers':{'Authorization':_0x426e('0x91')+_0x57cf1a,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x30f277)[_0x426e('0xe')](function(_0x14f6d2){var _0x18af69=[];_0x18af69[_0x426e('0xa7')]({'name':_0x14f6d2[_0x426e('0xae')][_0x426e('0xb5')][_0x426e('0xb0')][_0x426e('0xb1')][_0x426e('0xb0')],'value':_0x426e('0xb6')},{'name':_0x14f6d2['OptionSet'][_0x426e('0xb7')][_0x426e('0xb0')][_0x426e('0xb1')]['Label'],'value':_0x426e('0xb8')});var _0x44cf7a={'id':_0x54008b+'_'+_0x14f6d2[_0x426e('0x98')],'name':_0x14f6d2[_0x426e('0xb3')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x18af69};_0x3920af['push'](_0x44cf7a);return _0x3920af;});}function getInputList(_0x3e39e1,_0x567357,_0x158813,_0x46b9c6,_0x166f00,_0x484d2e,_0x1c33aa){var _0x1c1a88={'method':_0x426e('0x94'),'uri':_0x3e39e1+_0x426e('0xab')+_0x166f00+_0x426e('0xac')+_0x484d2e+_0x426e('0xb9')+_0x158813+_0x426e('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x1c33aa,'If-None-Match':null,'OData-Version':_0x426e('0x92')},'json':!![]};return rp(_0x1c1a88)[_0x426e('0xe')](function(_0x35a435){var _0x286817={'id':_0x567357+'_'+_0x35a435[_0x426e('0x98')],'name':_0x35a435['DisplayName'][_0x426e('0xb1')]?_0x35a435[_0x426e('0xb3')][_0x426e('0xb1')][_0x426e('0xb0')]:_0x35a435['LogicalName'],'custom':![],'options':[]};_0x46b9c6[_0x426e('0xa7')](_0x286817);return _0x46b9c6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 51aefad..1fdaf1a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x14ddf9,_0x3a1e2b){var _0x44208d=function(_0xce8ff){while(--_0xce8ff){_0x14ddf9['push'](_0x14ddf9['shift']());}};_0x44208d(++_0x3a1e2b);}(_0xe706,0xa3));var _0x6e70=function(_0x24af20,_0xb1b03b){_0x24af20=_0x24af20-0x0;var _0x20bbc5=_0xe706[_0x24af20];return _0x20bbc5;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x48ed05,_0x1df487){var _0x22dd1e=function(_0x5e17d0){while(--_0x5e17d0){_0x48ed05['push'](_0x48ed05['shift']());}};_0x22dd1e(++_0x1df487);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 ddb9410..0647035 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 _0xff5f=['client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowDynamics365Account','Dynamics365Account','find','catch','lodash','util','randomstring','ioredis','rpc','jayson/promise'];(function(_0x47876f,_0x474097){var _0x9883bf=function(_0x41128d){while(--_0x41128d){_0x47876f['push'](_0x47876f['shift']());}};_0x9883bf(++_0x474097);}(_0xff5f,0xba));var _0xfff5=function(_0x1b92c2,_0x231e79){_0x1b92c2=_0x1b92c2-0x0;var _0xf805ba=_0xff5f[_0x1b92c2];return _0xf805ba;};'use strict';var _=require(_0xfff5('0x0'));var util=require(_0xfff5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfff5('0x2'));var fs=require('fs');var Redis=require(_0xfff5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfff5('0x4'));var config=require('../../config/environment');var jayson=require(_0xfff5('0x5'));var client=jayson[_0xfff5('0x6')][_0xfff5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f7467,_0x4dad3c,_0x57793f){return new BPromise(function(_0x445dc0,_0x400eab){return client[_0xfff5('0x8')](_0x3f7467,_0x57793f)[_0xfff5('0x9')](function(_0x5c7845){logger[_0xfff5('0xa')](_0xfff5('0xb'),_0x4dad3c,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4dad3c,_0xfff5('0xc'),JSON[_0xfff5('0xd')](_0x5c7845));if(_0x5c7845[_0xfff5('0xe')]){if(_0x5c7845[_0xfff5('0xe')][_0xfff5('0xf')]===0x1f4){logger[_0xfff5('0xe')](_0xfff5('0xb'),_0x4dad3c,_0x5c7845[_0xfff5('0xe')][_0xfff5('0x10')]);return _0x400eab(_0x5c7845[_0xfff5('0xe')]['message']);}logger[_0xfff5('0xe')](_0xfff5('0xb'),_0x4dad3c,_0x5c7845[_0xfff5('0xe')]['message']);return _0x445dc0(_0x5c7845[_0xfff5('0xe')][_0xfff5('0x10')]);}else{logger[_0xfff5('0xa')](_0xfff5('0xb'),_0x4dad3c,'request\x20sent');_0x445dc0(_0x5c7845['result'][_0xfff5('0x10')]);}})['catch'](function(_0x307fd5){logger[_0xfff5('0xe')](_0xfff5('0xb'),_0x4dad3c,_0x307fd5);_0x400eab(_0x307fd5);});});}exports[_0xfff5('0x11')]=function(_0x344343){var _0x54282f=this;return new Promise(function(_0x2ca2fa,_0x207161){return db['Dynamics365Account'][_0xfff5('0x12')]({'raw':_0x344343[_0xfff5('0x13')]?_0x344343[_0xfff5('0x13')][_0xfff5('0x14')]===undefined?!![]:![]:!![],'where':_0x344343['options']?_0x344343[_0xfff5('0x13')][_0xfff5('0x15')]||null:null,'attributes':_0x344343[_0xfff5('0x13')]?_0x344343[_0xfff5('0x13')][_0xfff5('0x16')]||null:null,'limit':_0x344343[_0xfff5('0x13')]?_0x344343[_0xfff5('0x13')][_0xfff5('0x17')]||null:null,'include':_0x344343['options']?_0x344343[_0xfff5('0x13')][_0xfff5('0x18')]?_['map'](_0x344343[_0xfff5('0x13')][_0xfff5('0x18')],function(_0x48d0e1){return{'model':db[_0x48d0e1['model']],'as':_0x48d0e1['as'],'attributes':_0x48d0e1[_0xfff5('0x16')],'include':_0x48d0e1[_0xfff5('0x18')]?_[_0xfff5('0x19')](_0x48d0e1[_0xfff5('0x18')],function(_0x32e9a2){return{'model':db[_0x32e9a2[_0xfff5('0x1a')]],'as':_0x32e9a2['as'],'attributes':_0x32e9a2['attributes'],'include':_0x32e9a2[_0xfff5('0x18')]?_[_0xfff5('0x19')](_0x32e9a2[_0xfff5('0x18')],function(_0x58c98b){return{'model':db[_0x58c98b[_0xfff5('0x1a')]],'as':_0x58c98b['as'],'attributes':_0x58c98b['attributes']};}):[]};}):[]};}):[]:[]})[_0xfff5('0x9')](function(_0x19780e){logger[_0xfff5('0xa')](_0xfff5('0x11'),_0x344343);logger[_0xfff5('0x1b')]('GetDynamics365Account',_0x344343,JSON['stringify'](_0x19780e));_0x2ca2fa(_0x19780e);})['catch'](function(_0x3ea2c0){logger[_0xfff5('0xe')](_0xfff5('0x11'),_0x3ea2c0[_0xfff5('0x10')],_0x344343);_0x207161(_0x54282f[_0xfff5('0xe')](0x1f4,_0x3ea2c0[_0xfff5('0x10')]));});});};exports[_0xfff5('0x1c')]=function(_0x4eca75){var _0x51a47e=this;return new Promise(function(_0xfb2502,_0x573293){return db[_0xfff5('0x1d')][_0xfff5('0x1e')]({'raw':_0x4eca75[_0xfff5('0x13')]?_0x4eca75['options'][_0xfff5('0x14')]===undefined?!![]:![]:!![],'where':_0x4eca75[_0xfff5('0x13')]?_0x4eca75[_0xfff5('0x13')][_0xfff5('0x15')]||null:null,'attributes':_0x4eca75[_0xfff5('0x13')]?_0x4eca75['options'][_0xfff5('0x16')]||null:null,'include':_0x4eca75[_0xfff5('0x13')]?_0x4eca75[_0xfff5('0x13')][_0xfff5('0x18')]?_[_0xfff5('0x19')](_0x4eca75[_0xfff5('0x13')]['include'],function(_0x2eb305){return{'model':db[_0x2eb305[_0xfff5('0x1a')]],'as':_0x2eb305['as'],'attributes':_0x2eb305[_0xfff5('0x16')],'include':_0x2eb305[_0xfff5('0x18')]?_['map'](_0x2eb305[_0xfff5('0x18')],function(_0x16acb9){return{'model':db[_0x16acb9[_0xfff5('0x1a')]],'as':_0x16acb9['as'],'attributes':_0x16acb9[_0xfff5('0x16')],'include':_0x16acb9[_0xfff5('0x18')]?_['map'](_0x16acb9[_0xfff5('0x18')],function(_0x45a6a2){return{'model':db[_0x45a6a2[_0xfff5('0x1a')]],'as':_0x45a6a2['as'],'attributes':_0x45a6a2[_0xfff5('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfff5('0x9')](function(_0x4ee20f){logger['info'](_0xfff5('0x1c'),_0x4eca75);logger[_0xfff5('0x1b')](_0xfff5('0x1c'),_0x4eca75,JSON[_0xfff5('0xd')](_0x4ee20f));_0xfb2502(_0x4ee20f);})[_0xfff5('0x1f')](function(_0xc1af27){logger[_0xfff5('0xe')](_0xfff5('0x1c'),_0xc1af27[_0xfff5('0x10')],_0x4eca75);_0x573293(_0x51a47e['error'](0x1f4,_0xc1af27[_0xfff5('0x10')]));});});}; \ No newline at end of file +var _0xbbb1=['map','model','info','debug','catch','ShowDynamics365Account','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include'];(function(_0x6950d7,_0x5c2b4e){var _0x273632=function(_0x4d1845){while(--_0x4d1845){_0x6950d7['push'](_0x6950d7['shift']());}};_0x273632(++_0x5c2b4e);}(_0xbbb1,0x11e));var _0x1bbb=function(_0x2cd98f,_0x5d1e2b){_0x2cd98f=_0x2cd98f-0x0;var _0x429040=_0xbbb1[_0x2cd98f];return _0x429040;};'use strict';var _=require('lodash');var util=require(_0x1bbb('0x0'));var moment=require(_0x1bbb('0x1'));var BPromise=require(_0x1bbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bbb('0x3'))['db'];var utils=require(_0x1bbb('0x4'));var logger=require(_0x1bbb('0x5'))(_0x1bbb('0x6'));var config=require(_0x1bbb('0x7'));var jayson=require(_0x1bbb('0x8'));var client=jayson[_0x1bbb('0x9')][_0x1bbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14a4e6,_0x5e87c1,_0x435c02){return new BPromise(function(_0x31c8af,_0x521cb2){return client[_0x1bbb('0xb')](_0x14a4e6,_0x435c02)[_0x1bbb('0xc')](function(_0x453c7d){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5e87c1,'request\x20sent');logger['debug'](_0x1bbb('0xd'),_0x5e87c1,'request\x20sent',JSON[_0x1bbb('0xe')](_0x453c7d));if(_0x453c7d['error']){if(_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x10')]===0x1f4){logger[_0x1bbb('0xf')](_0x1bbb('0x11'),_0x5e87c1,_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x12')]);return _0x521cb2(_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5e87c1,_0x453c7d[_0x1bbb('0xf')]['message']);return _0x31c8af(_0x453c7d[_0x1bbb('0xf')][_0x1bbb('0x12')]);}else{logger['info'](_0x1bbb('0x11'),_0x5e87c1,_0x1bbb('0x13'));_0x31c8af(_0x453c7d['result'][_0x1bbb('0x12')]);}})['catch'](function(_0x5bc20b){logger[_0x1bbb('0xf')](_0x1bbb('0x11'),_0x5e87c1,_0x5bc20b);_0x521cb2(_0x5bc20b);});});}exports[_0x1bbb('0x14')]=function(_0x49bff6){var _0x157c53=this;return new Promise(function(_0x34be1c,_0x419039){return db[_0x1bbb('0x15')][_0x1bbb('0x16')]({'raw':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x18')]===undefined?!![]:![]:!![],'where':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x19')]||null:null,'attributes':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1a')]||null:null,'limit':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1b')]||null:null,'include':_0x49bff6[_0x1bbb('0x17')]?_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x49bff6[_0x1bbb('0x17')][_0x1bbb('0x1c')],function(_0x513bd3){return{'model':db[_0x513bd3[_0x1bbb('0x1e')]],'as':_0x513bd3['as'],'attributes':_0x513bd3['attributes'],'include':_0x513bd3['include']?_[_0x1bbb('0x1d')](_0x513bd3[_0x1bbb('0x1c')],function(_0x30e2b9){return{'model':db[_0x30e2b9[_0x1bbb('0x1e')]],'as':_0x30e2b9['as'],'attributes':_0x30e2b9[_0x1bbb('0x1a')],'include':_0x30e2b9[_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x30e2b9[_0x1bbb('0x1c')],function(_0x112907){return{'model':db[_0x112907[_0x1bbb('0x1e')]],'as':_0x112907['as'],'attributes':_0x112907[_0x1bbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1bbb('0xc')](function(_0x17980a){logger[_0x1bbb('0x1f')](_0x1bbb('0x14'),_0x49bff6);logger[_0x1bbb('0x20')](_0x1bbb('0x14'),_0x49bff6,JSON[_0x1bbb('0xe')](_0x17980a));_0x34be1c(_0x17980a);})[_0x1bbb('0x21')](function(_0x596677){logger['error']('GetDynamics365Account',_0x596677[_0x1bbb('0x12')],_0x49bff6);_0x419039(_0x157c53[_0x1bbb('0xf')](0x1f4,_0x596677[_0x1bbb('0x12')]));});});};exports[_0x1bbb('0x22')]=function(_0x3eb6da){var _0x35586e=this;return new Promise(function(_0x3fc925,_0x50035e){return db['Dynamics365Account']['find']({'raw':_0x3eb6da[_0x1bbb('0x17')]?_0x3eb6da['options'][_0x1bbb('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb6da[_0x1bbb('0x17')]?_0x3eb6da['options'][_0x1bbb('0x19')]||null:null,'attributes':_0x3eb6da[_0x1bbb('0x17')]?_0x3eb6da[_0x1bbb('0x17')][_0x1bbb('0x1a')]||null:null,'include':_0x3eb6da['options']?_0x3eb6da['options'][_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x3eb6da[_0x1bbb('0x17')]['include'],function(_0x34978c){return{'model':db[_0x34978c[_0x1bbb('0x1e')]],'as':_0x34978c['as'],'attributes':_0x34978c[_0x1bbb('0x1a')],'include':_0x34978c['include']?_[_0x1bbb('0x1d')](_0x34978c[_0x1bbb('0x1c')],function(_0x19938c){return{'model':db[_0x19938c[_0x1bbb('0x1e')]],'as':_0x19938c['as'],'attributes':_0x19938c[_0x1bbb('0x1a')],'include':_0x19938c[_0x1bbb('0x1c')]?_[_0x1bbb('0x1d')](_0x19938c['include'],function(_0x4a5e27){return{'model':db[_0x4a5e27[_0x1bbb('0x1e')]],'as':_0x4a5e27['as'],'attributes':_0x4a5e27[_0x1bbb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102934){logger[_0x1bbb('0x1f')](_0x1bbb('0x22'),_0x3eb6da);logger[_0x1bbb('0x20')](_0x1bbb('0x22'),_0x3eb6da,JSON[_0x1bbb('0xe')](_0x102934));_0x3fc925(_0x102934);})[_0x1bbb('0x21')](function(_0x4ac66c){logger[_0x1bbb('0xf')](_0x1bbb('0x22'),_0x4ac66c[_0x1bbb('0x12')],_0x3eb6da);_0x50035e(_0x35586e[_0x1bbb('0xf')](0x1f4,_0x4ac66c[_0x1bbb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0f94794..2edabaa 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 _0x882c=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields'];(function(_0x5d0f97,_0x25009f){var _0xc7236=function(_0xa7353f){while(--_0xa7353f){_0x5d0f97['push'](_0x5d0f97['shift']());}};_0xc7236(++_0x25009f);}(_0x882c,0x6c));var _0xc882=function(_0x52ac27,_0x8776c8){_0x52ac27=_0x52ac27-0x0;var _0x40732e=_0x882c[_0x52ac27];return _0x40732e;};'use strict';var multer=require(_0xc882('0x0'));var util=require(_0xc882('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc882('0x2'));var router=express['Router']();var fs_extra=require(_0xc882('0x3'));var auth=require(_0xc882('0x4'));var interaction=require(_0xc882('0x5'));var config=require(_0xc882('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xc882('0x7')]('/',auth[_0xc882('0x8')](),controller['index']);router[_0xc882('0x7')](_0xc882('0x9'),auth[_0xc882('0x8')](),controller['show']);router['get'](_0xc882('0xa'),auth[_0xc882('0x8')](),controller[_0xc882('0xb')]);router['get']('/:id/subjects',auth[_0xc882('0x8')](),controller[_0xc882('0xc')]);router[_0xc882('0x7')](_0xc882('0xd'),auth['isAuthenticated'](),controller[_0xc882('0xe')]);router[_0xc882('0xf')]('/',auth[_0xc882('0x8')](),controller[_0xc882('0x10')]);router[_0xc882('0x11')](_0xc882('0x9'),auth[_0xc882('0x8')](),controller['update']);router[_0xc882('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc882('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd878=['fs-extra','./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57fd57,_0x197f3c){var _0x12e47f=function(_0x4f6e){while(--_0x4f6e){_0x57fd57['push'](_0x57fd57['shift']());}};_0x12e47f(++_0x197f3c);}(_0xd878,0x118));var _0x8d87=function(_0x40bcc8,_0x3b261a){_0x40bcc8=_0x40bcc8-0x0;var _0x4f8d3e=_0xd878[_0x40bcc8];return _0x4f8d3e;};'use strict';var multer=require(_0x8d87('0x0'));var util=require(_0x8d87('0x1'));var path=require(_0x8d87('0x2'));var timeout=require(_0x8d87('0x3'));var express=require(_0x8d87('0x4'));var router=express[_0x8d87('0x5')]();var fs_extra=require(_0x8d87('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d87('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8d87('0x8')]);router[_0x8d87('0x9')](_0x8d87('0xa'),auth[_0x8d87('0xb')](),controller[_0x8d87('0xc')]);router[_0x8d87('0x9')](_0x8d87('0xd'),auth[_0x8d87('0xb')](),controller[_0x8d87('0xe')]);router['get'](_0x8d87('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8d87('0x9')](_0x8d87('0x10'),auth[_0x8d87('0xb')](),controller[_0x8d87('0x11')]);router[_0x8d87('0x12')]('/',auth[_0x8d87('0xb')](),controller['create']);router[_0x8d87('0x13')]('/:id',auth[_0x8d87('0xb')](),controller['update']);router[_0x8d87('0x14')](_0x8d87('0xa'),auth[_0x8d87('0xb')](),controller['destroy']);module[_0x8d87('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e23150e..2937c67 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 _0x1760=['BOOLEAN','sequelize','exports','STRING','ENUM','phonecall','incident','contact'];(function(_0xff16ef,_0x371ac){var _0x255f85=function(_0x3bd02e){while(--_0x3bd02e){_0xff16ef['push'](_0xff16ef['shift']());}};_0x255f85(++_0x371ac);}(_0x1760,0x1a9));var _0x0176=function(_0x560058,_0x442db3){_0x560058=_0x560058-0x0;var _0x24232b=_0x1760[_0x560058];return _0x24232b;};'use strict';var Sequelize=require(_0x0176('0x0'));module[_0x0176('0x1')]={'name':{'type':Sequelize[_0x0176('0x2')]},'description':{'type':Sequelize[_0x0176('0x2')]},'ticketType':{'type':Sequelize[_0x0176('0x3')]('incident',_0x0176('0x4')),'defaultValue':_0x0176('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('contact','nothing'),'defaultValue':_0x0176('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0176('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0176('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf2dc=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x58246c,_0x58d989){var _0x2dc3ab=function(_0x3f3b6a){while(--_0x3f3b6a){_0x58246c['push'](_0x58246c['shift']());}};_0x2dc3ab(++_0x58d989);}(_0xf2dc,0x13d));var _0xcf2d=function(_0x5db763,_0x3f71f7){_0x5db763=_0x5db763-0x0;var _0x1c8b53=_0xf2dc[_0x5db763];return _0x1c8b53;};'use strict';var Sequelize=require(_0xcf2d('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf2d('0x1')]},'description':{'type':Sequelize[_0xcf2d('0x1')]},'ticketType':{'type':Sequelize[_0xcf2d('0x2')](_0xcf2d('0x3'),_0xcf2d('0x4')),'defaultValue':_0xcf2d('0x3')},'moduleCreate':{'type':Sequelize[_0xcf2d('0x2')](_0xcf2d('0x5'),_0xcf2d('0x6')),'defaultValue':_0xcf2d('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xcf2d('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9b95dab..d34f373 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 _0x74f9=['undefined','limit','count','offset','status','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','include','findAll','catch','rawAttributes','includeAll','merge','options','find','create','body','params','Dynamics365Field','sort','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json'];(function(_0x3439d1,_0x3e5acc){var _0x13e0a0=function(_0x54000f){while(--_0x54000f){_0x3439d1['push'](_0x3439d1['shift']());}};_0x13e0a0(++_0x3e5acc);}(_0x74f9,0x175));var _0x974f=function(_0x458b93,_0x3bbf46){_0x458b93=_0x458b93-0x0;var _0x5d4dff=_0x74f9[_0x458b93];return _0x5d4dff;};'use strict';var emlformat=require(_0x974f('0x0'));var rimraf=require(_0x974f('0x1'));var zipdir=require(_0x974f('0x2'));var jsonpatch=require(_0x974f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x974f('0x4'));var Mustache=require(_0x974f('0x5'));var util=require('util');var path=require(_0x974f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x974f('0x7'));var fs=require('fs');var fs_extra=require(_0x974f('0x8'));var _=require(_0x974f('0x9'));var squel=require('squel');var crypto=require(_0x974f('0xa'));var jsforce=require(_0x974f('0xb'));var deskjs=require(_0x974f('0xc'));var toCsv=require(_0x974f('0xd'));var querystring=require(_0x974f('0xe'));var Papa=require(_0x974f('0xf'));var Redis=require(_0x974f('0x10'));var authService=require(_0x974f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x974f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x974f('0x13'))('api');var utils=require(_0x974f('0x14'));var config=require(_0x974f('0x15'));var licenseUtil=require(_0x974f('0x16'));var db=require(_0x974f('0x17'))['db'];function respondWithStatusCode(_0x11cbe8,_0x50ecf5){_0x50ecf5=_0x50ecf5||0xcc;return function(_0x215eac){if(_0x215eac){return _0x11cbe8[_0x974f('0x18')](_0x50ecf5);}return _0x11cbe8['status'](_0x50ecf5)[_0x974f('0x19')]();};}function respondWithResult(_0x4d293c,_0x2e4cc8){_0x2e4cc8=_0x2e4cc8||0xc8;return function(_0xaf19d5){if(_0xaf19d5){return _0x4d293c['status'](_0x2e4cc8)[_0x974f('0x1a')](_0xaf19d5);}};}function respondWithFilteredResult(_0x11227e,_0x1e9530){return function(_0x1ecc1f){if(_0x1ecc1f){var _0x3c51ce=typeof _0x1e9530['offset']===_0x974f('0x1b')&&typeof _0x1e9530[_0x974f('0x1c')]===_0x974f('0x1b');var _0x400a94=_0x1ecc1f[_0x974f('0x1d')];var _0x1c6277=_0x3c51ce?0x0:_0x1e9530[_0x974f('0x1e')];var _0x45efe6=_0x3c51ce?_0x1ecc1f['count']:_0x1e9530[_0x974f('0x1e')]+_0x1e9530[_0x974f('0x1c')];var _0xe38847;if(_0x45efe6>=_0x400a94){_0x45efe6=_0x400a94;_0xe38847=0xc8;}else{_0xe38847=0xce;}_0x11227e[_0x974f('0x1f')](_0xe38847);return _0x11227e[_0x974f('0x20')](_0x974f('0x21'),_0x1c6277+'-'+_0x45efe6+'/'+_0x400a94)[_0x974f('0x1a')](_0x1ecc1f);}return null;};}function patchUpdates(_0x1900bd){return function(_0x4ec9b7){try{jsonpatch['apply'](_0x4ec9b7,_0x1900bd,!![]);}catch(_0x2b6c1e){return BPromise[_0x974f('0x22')](_0x2b6c1e);}return _0x4ec9b7[_0x974f('0x23')]();};}function saveUpdates(_0x5ef988,_0x383cc9){return function(_0x172638){if(_0x172638){return _0x172638['update'](_0x5ef988)['then'](function(_0x29c3c1){return _0x29c3c1;});}return null;};}function removeEntity(_0x596676,_0x30fc8a){return function(_0x50ce39){if(_0x50ce39){return _0x50ce39[_0x974f('0x24')]()[_0x974f('0x25')](function(){_0x596676[_0x974f('0x1f')](0xcc)[_0x974f('0x19')]();});}};}function handleEntityNotFound(_0x14b64a,_0x1a0818){return function(_0x1d735c){if(!_0x1d735c){_0x14b64a[_0x974f('0x18')](0x194);}return _0x1d735c;};}function handleError(_0x3476fb,_0x36e340){_0x36e340=_0x36e340||0x1f4;return function(_0x33e603){logger[_0x974f('0x26')](_0x33e603[_0x974f('0x27')]);if(_0x33e603[_0x974f('0x28')]){delete _0x33e603['name'];}_0x3476fb[_0x974f('0x1f')](_0x36e340)[_0x974f('0x29')](_0x33e603);};}exports[_0x974f('0x2a')]=function(_0x2d7ef7,_0x128f01){var _0x54dd3d={},_0x52fea9={},_0x39a442={'count':0x0,'rows':[]};var _0x45e419=_[_0x974f('0x2b')](db[_0x974f('0x2c')]['rawAttributes'],function(_0x3b8643){return{'name':_0x3b8643[_0x974f('0x2d')],'type':_0x3b8643['type'][_0x974f('0x2e')]};});_0x52fea9['model']=_[_0x974f('0x2b')](_0x45e419,_0x974f('0x28'));_0x52fea9[_0x974f('0x2f')]=_[_0x974f('0x30')](_0x2d7ef7[_0x974f('0x2f')]);_0x52fea9[_0x974f('0x31')]=_[_0x974f('0x32')](_0x52fea9['model'],_0x52fea9[_0x974f('0x2f')]);_0x54dd3d[_0x974f('0x33')]=_[_0x974f('0x32')](_0x52fea9['model'],qs[_0x974f('0x34')](_0x2d7ef7[_0x974f('0x2f')][_0x974f('0x34')]));_0x54dd3d['attributes']=_0x54dd3d[_0x974f('0x33')][_0x974f('0x35')]?_0x54dd3d['attributes']:_0x52fea9[_0x974f('0x36')];if(!_0x2d7ef7[_0x974f('0x2f')][_0x974f('0x37')](_0x974f('0x38'))){_0x54dd3d['limit']=qs[_0x974f('0x1c')](_0x2d7ef7[_0x974f('0x2f')]['limit']);_0x54dd3d[_0x974f('0x1e')]=qs['offset'](_0x2d7ef7[_0x974f('0x2f')][_0x974f('0x1e')]);}_0x54dd3d[_0x974f('0x39')]=qs['sort'](_0x2d7ef7[_0x974f('0x2f')]['sort']);_0x54dd3d[_0x974f('0x3a')]=qs[_0x974f('0x31')](_[_0x974f('0x3b')](_0x2d7ef7[_0x974f('0x2f')],_0x52fea9['filters']),_0x45e419);if(_0x2d7ef7['query'][_0x974f('0x3c')]){_0x54dd3d[_0x974f('0x3a')]=_['merge'](_0x54dd3d[_0x974f('0x3a')],{'$or':_[_0x974f('0x2b')](_0x45e419,function(_0x1b88a5){if(_0x1b88a5[_0x974f('0x3d')]!==_0x974f('0x3e')){var _0x582b78={};_0x582b78[_0x1b88a5[_0x974f('0x28')]]={'$like':'%'+_0x2d7ef7[_0x974f('0x2f')][_0x974f('0x3c')]+'%'};return _0x582b78;}})});}_0x54dd3d=_['merge']({},_0x54dd3d,_0x2d7ef7['options']);var _0x4f004a={'where':_0x54dd3d[_0x974f('0x3a')]};return db[_0x974f('0x2c')][_0x974f('0x1d')](_0x4f004a)[_0x974f('0x25')](function(_0x43f178){_0x39a442['count']=_0x43f178;if(_0x2d7ef7['query']['includeAll']){_0x54dd3d[_0x974f('0x3f')]=[{'all':!![]}];}return db[_0x974f('0x2c')][_0x974f('0x40')](_0x54dd3d);})[_0x974f('0x25')](function(_0x1eeed7){_0x39a442['rows']=_0x1eeed7;return _0x39a442;})[_0x974f('0x25')](respondWithFilteredResult(_0x128f01,_0x54dd3d))[_0x974f('0x41')](handleError(_0x128f01,null));};exports['show']=function(_0x572c5f,_0x409a62){var _0x1f7255={'raw':![],'where':{'id':_0x572c5f['params']['id']}},_0x576b08={};_0x576b08[_0x974f('0x36')]=_[_0x974f('0x30')](db[_0x974f('0x2c')][_0x974f('0x42')]);_0x576b08[_0x974f('0x2f')]=_[_0x974f('0x30')](_0x572c5f['query']);_0x576b08[_0x974f('0x31')]=_[_0x974f('0x32')](_0x576b08[_0x974f('0x36')],_0x576b08['query']);_0x1f7255[_0x974f('0x33')]=_[_0x974f('0x32')](_0x576b08['model'],qs[_0x974f('0x34')](_0x572c5f[_0x974f('0x2f')][_0x974f('0x34')]));_0x1f7255[_0x974f('0x33')]=_0x1f7255[_0x974f('0x33')][_0x974f('0x35')]?_0x1f7255[_0x974f('0x33')]:_0x576b08['model'];if(_0x572c5f[_0x974f('0x2f')][_0x974f('0x43')]){_0x1f7255[_0x974f('0x3f')]=[{'all':!![]}];}_0x1f7255=_[_0x974f('0x44')]({},_0x1f7255,_0x572c5f[_0x974f('0x45')]);return db[_0x974f('0x2c')][_0x974f('0x46')](_0x1f7255)[_0x974f('0x25')](handleEntityNotFound(_0x409a62,null))[_0x974f('0x25')](respondWithResult(_0x409a62,null))['catch'](handleError(_0x409a62,null));};exports[_0x974f('0x47')]=function(_0x4a9d67,_0x5dbb52){return db['Dynamics365Configuration'][_0x974f('0x47')](_0x4a9d67[_0x974f('0x48')],{})[_0x974f('0x25')](respondWithResult(_0x5dbb52,0xc9))[_0x974f('0x41')](handleError(_0x5dbb52,null));};exports['update']=function(_0x4b2d66,_0x4096ab){if(_0x4b2d66['body']['id']){delete _0x4b2d66['body']['id'];}return db['Dynamics365Configuration'][_0x974f('0x46')]({'where':{'id':_0x4b2d66['params']['id']}})[_0x974f('0x25')](handleEntityNotFound(_0x4096ab,null))['then'](saveUpdates(_0x4b2d66[_0x974f('0x48')],null))[_0x974f('0x25')](respondWithResult(_0x4096ab,null))[_0x974f('0x41')](handleError(_0x4096ab,null));};exports['destroy']=function(_0x5d2402,_0x34df51){return db['Dynamics365Configuration']['find']({'where':{'id':_0x5d2402[_0x974f('0x49')]['id']}})[_0x974f('0x25')](handleEntityNotFound(_0x34df51,null))[_0x974f('0x25')](removeEntity(_0x34df51,null))[_0x974f('0x41')](handleError(_0x34df51,null));};exports['getFields']=function(_0x161856,_0x193856,_0x43af85){var _0x3803e2={};var _0xae4b61={};var _0x29a42b;var _0x1c1e64;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x161856[_0x974f('0x49')]['id']}})[_0x974f('0x25')](handleEntityNotFound(_0x193856,null))[_0x974f('0x25')](function(_0xbada10){if(_0xbada10){_0x29a42b=_0xbada10;_0xae4b61[_0x974f('0x36')]=_[_0x974f('0x30')](db[_0x974f('0x4a')][_0x974f('0x42')]);_0xae4b61['query']=_['keys'](_0x161856[_0x974f('0x2f')]);_0xae4b61['filters']=_['intersection'](_0xae4b61['model'],_0xae4b61[_0x974f('0x2f')]);_0x3803e2['attributes']=_[_0x974f('0x32')](_0xae4b61[_0x974f('0x36')],qs[_0x974f('0x34')](_0x161856[_0x974f('0x2f')][_0x974f('0x34')]));_0x3803e2[_0x974f('0x33')]=_0x3803e2[_0x974f('0x33')]['length']?_0x3803e2[_0x974f('0x33')]:_0xae4b61['model'];_0x3803e2[_0x974f('0x39')]=qs[_0x974f('0x4b')](_0x161856[_0x974f('0x2f')][_0x974f('0x4b')]);_0x3803e2[_0x974f('0x3a')]=qs[_0x974f('0x31')](_[_0x974f('0x3b')](_0x161856[_0x974f('0x2f')],_0xae4b61[_0x974f('0x31')]));if(_0x161856['query'][_0x974f('0x3c')]){_0x3803e2[_0x974f('0x3a')]=_['merge'](_0x3803e2[_0x974f('0x3a')],{'$or':_['map'](_0x3803e2[_0x974f('0x33')],function(_0x4aba6f){var _0x5c8db3={};_0x5c8db3[_0x4aba6f]={'$like':'%'+_0x161856[_0x974f('0x2f')]['filter']+'%'};return _0x5c8db3;})});}_0x3803e2=_[_0x974f('0x44')]({},_0x3803e2,_0x161856['options']);return _0x29a42b[_0x974f('0x4c')](_0x3803e2);}})['then'](function(_0x2fe1a2){if(_0x2fe1a2){_0x1c1e64=_0x2fe1a2[_0x974f('0x35')];if(!_0x161856[_0x974f('0x2f')][_0x974f('0x37')](_0x974f('0x38'))){_0x3803e2[_0x974f('0x1c')]=qs['limit'](_0x161856[_0x974f('0x2f')]['limit']);_0x3803e2[_0x974f('0x1e')]=qs['offset'](_0x161856[_0x974f('0x2f')][_0x974f('0x1e')]);}return _0x29a42b['getFields'](_0x3803e2);}})[_0x974f('0x25')](function(_0x78742b){if(_0x78742b){return _0x78742b?{'count':_0x1c1e64,'rows':_0x78742b}:null;}})['then'](respondWithResult(_0x193856,null))[_0x974f('0x41')](handleError(_0x193856,null));};exports[_0x974f('0x4d')]=function(_0x35ded8,_0xc5e98c,_0x4fb473){var _0x739661={};var _0x485b2a={};var _0x5a9fe9;var _0x2d3143;return db[_0x974f('0x2c')][_0x974f('0x4e')]({'where':{'id':_0x35ded8['params']['id']}})[_0x974f('0x25')](handleEntityNotFound(_0xc5e98c,null))[_0x974f('0x25')](function(_0x5d442e){if(_0x5d442e){_0x5a9fe9=_0x5d442e;_0x485b2a['model']=_['keys'](db[_0x974f('0x4a')][_0x974f('0x42')]);_0x485b2a['query']=_[_0x974f('0x30')](_0x35ded8[_0x974f('0x2f')]);_0x485b2a[_0x974f('0x31')]=_[_0x974f('0x32')](_0x485b2a[_0x974f('0x36')],_0x485b2a[_0x974f('0x2f')]);_0x739661[_0x974f('0x33')]=_['intersection'](_0x485b2a[_0x974f('0x36')],qs[_0x974f('0x34')](_0x35ded8['query'][_0x974f('0x34')]));_0x739661['attributes']=_0x739661['attributes']['length']?_0x739661[_0x974f('0x33')]:_0x485b2a[_0x974f('0x36')];_0x739661[_0x974f('0x39')]=qs['sort'](_0x35ded8[_0x974f('0x2f')][_0x974f('0x4b')]);_0x739661['where']=qs['filters'](_[_0x974f('0x3b')](_0x35ded8[_0x974f('0x2f')],_0x485b2a[_0x974f('0x31')]));if(_0x35ded8[_0x974f('0x2f')]['filter']){_0x739661['where']=_[_0x974f('0x44')](_0x739661[_0x974f('0x3a')],{'$or':_[_0x974f('0x2b')](_0x739661[_0x974f('0x33')],function(_0x932d8f){var _0x442133={};_0x442133[_0x932d8f]={'$like':'%'+_0x35ded8[_0x974f('0x2f')]['filter']+'%'};return _0x442133;})});}_0x739661=_[_0x974f('0x44')]({},_0x739661,_0x35ded8[_0x974f('0x45')]);return _0x5a9fe9[_0x974f('0x4d')](_0x739661);}})[_0x974f('0x25')](function(_0xc194f4){if(_0xc194f4){_0x2d3143=_0xc194f4['length'];if(!_0x35ded8[_0x974f('0x2f')][_0x974f('0x37')](_0x974f('0x38'))){_0x739661[_0x974f('0x1c')]=qs[_0x974f('0x1c')](_0x35ded8[_0x974f('0x2f')][_0x974f('0x1c')]);_0x739661[_0x974f('0x1e')]=qs[_0x974f('0x1e')](_0x35ded8[_0x974f('0x2f')]['offset']);}return _0x5a9fe9[_0x974f('0x4d')](_0x739661);}})['then'](function(_0x1a33b9){if(_0x1a33b9){return _0x1a33b9?{'count':_0x2d3143,'rows':_0x1a33b9}:null;}})[_0x974f('0x25')](respondWithResult(_0xc5e98c,null))['catch'](handleError(_0xc5e98c,null));};exports[_0x974f('0x4f')]=function(_0x2790a7,_0x36ed3a,_0x42ef94){var _0x997958={};var _0x36399f={};var _0x3e4548;var _0x31f875;return db['Dynamics365Configuration'][_0x974f('0x4e')]({'where':{'id':_0x2790a7[_0x974f('0x49')]['id']}})[_0x974f('0x25')](handleEntityNotFound(_0x36ed3a,null))[_0x974f('0x25')](function(_0x158a19){if(_0x158a19){_0x3e4548=_0x158a19;_0x36399f[_0x974f('0x36')]=_[_0x974f('0x30')](db['Dynamics365Field'][_0x974f('0x42')]);_0x36399f[_0x974f('0x2f')]=_[_0x974f('0x30')](_0x2790a7[_0x974f('0x2f')]);_0x36399f['filters']=_[_0x974f('0x32')](_0x36399f[_0x974f('0x36')],_0x36399f[_0x974f('0x2f')]);_0x997958[_0x974f('0x33')]=_[_0x974f('0x32')](_0x36399f[_0x974f('0x36')],qs[_0x974f('0x34')](_0x2790a7[_0x974f('0x2f')][_0x974f('0x34')]));_0x997958[_0x974f('0x33')]=_0x997958[_0x974f('0x33')][_0x974f('0x35')]?_0x997958[_0x974f('0x33')]:_0x36399f[_0x974f('0x36')];_0x997958['order']=qs[_0x974f('0x4b')](_0x2790a7[_0x974f('0x2f')][_0x974f('0x4b')]);_0x997958[_0x974f('0x3a')]=qs[_0x974f('0x31')](_[_0x974f('0x3b')](_0x2790a7[_0x974f('0x2f')],_0x36399f[_0x974f('0x31')]));if(_0x2790a7[_0x974f('0x2f')]['filter']){_0x997958[_0x974f('0x3a')]=_['merge'](_0x997958[_0x974f('0x3a')],{'$or':_[_0x974f('0x2b')](_0x997958[_0x974f('0x33')],function(_0x39c2cb){var _0x5bd3be={};_0x5bd3be[_0x39c2cb]={'$like':'%'+_0x2790a7['query'][_0x974f('0x3c')]+'%'};return _0x5bd3be;})});}_0x997958=_[_0x974f('0x44')]({},_0x997958,_0x2790a7[_0x974f('0x45')]);return _0x3e4548['getDescriptions'](_0x997958);}})[_0x974f('0x25')](function(_0x2a874d){if(_0x2a874d){_0x31f875=_0x2a874d['length'];if(!_0x2790a7[_0x974f('0x2f')][_0x974f('0x37')](_0x974f('0x38'))){_0x997958['limit']=qs[_0x974f('0x1c')](_0x2790a7[_0x974f('0x2f')][_0x974f('0x1c')]);_0x997958[_0x974f('0x1e')]=qs[_0x974f('0x1e')](_0x2790a7[_0x974f('0x2f')]['offset']);}return _0x3e4548[_0x974f('0x4f')](_0x997958);}})[_0x974f('0x25')](function(_0x105e67){if(_0x105e67){return _0x105e67?{'count':_0x31f875,'rows':_0x105e67}:null;}})[_0x974f('0x25')](respondWithResult(_0x36ed3a,null))[_0x974f('0x41')](handleError(_0x36ed3a,null));}; \ No newline at end of file +var _0x054c=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','getFields','findOne','Dynamics365Field','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x054c,0x8d));var _0xc054=function(_0xf4cbab,_0x52cee6){_0xf4cbab=_0xf4cbab-0x0;var _0x400a7e=_0x054c[_0xf4cbab];return _0x400a7e;};'use strict';var emlformat=require(_0xc054('0x0'));var rimraf=require(_0xc054('0x1'));var zipdir=require(_0xc054('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc054('0x3'));var moment=require(_0xc054('0x4'));var BPromise=require(_0xc054('0x5'));var Mustache=require(_0xc054('0x6'));var util=require('util');var path=require(_0xc054('0x7'));var sox=require(_0xc054('0x8'));var csv=require('to-csv');var ejs=require(_0xc054('0x9'));var fs=require('fs');var fs_extra=require(_0xc054('0xa'));var _=require('lodash');var squel=require(_0xc054('0xb'));var crypto=require(_0xc054('0xc'));var jsforce=require(_0xc054('0xd'));var deskjs=require(_0xc054('0xe'));var toCsv=require(_0xc054('0xf'));var querystring=require(_0xc054('0x10'));var Papa=require('papaparse');var Redis=require(_0xc054('0x11'));var authService=require(_0xc054('0x12'));var qs=require(_0xc054('0x13'));var as=require(_0xc054('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc054('0x15'))(_0xc054('0x16'));var utils=require(_0xc054('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc054('0x18'));var db=require(_0xc054('0x19'))['db'];function respondWithStatusCode(_0x49ac3a,_0x228b2b){_0x228b2b=_0x228b2b||0xcc;return function(_0x2423a1){if(_0x2423a1){return _0x49ac3a[_0xc054('0x1a')](_0x228b2b);}return _0x49ac3a[_0xc054('0x1b')](_0x228b2b)['end']();};}function respondWithResult(_0x56c69e,_0x4f7355){_0x4f7355=_0x4f7355||0xc8;return function(_0xfb8fa2){if(_0xfb8fa2){return _0x56c69e[_0xc054('0x1b')](_0x4f7355)[_0xc054('0x1c')](_0xfb8fa2);}};}function respondWithFilteredResult(_0x3b47a5,_0x4bd398){return function(_0x264601){if(_0x264601){var _0x2f91c1=typeof _0x4bd398[_0xc054('0x1d')]==='undefined'&&typeof _0x4bd398[_0xc054('0x1e')]==='undefined';var _0x54b744=_0x264601[_0xc054('0x1f')];var _0x2324f7=_0x2f91c1?0x0:_0x4bd398[_0xc054('0x1d')];var _0x4ff429=_0x2f91c1?_0x264601['count']:_0x4bd398[_0xc054('0x1d')]+_0x4bd398[_0xc054('0x1e')];var _0x236928;if(_0x4ff429>=_0x54b744){_0x4ff429=_0x54b744;_0x236928=0xc8;}else{_0x236928=0xce;}_0x3b47a5[_0xc054('0x1b')](_0x236928);return _0x3b47a5[_0xc054('0x20')](_0xc054('0x21'),_0x2324f7+'-'+_0x4ff429+'/'+_0x54b744)['json'](_0x264601);}return null;};}function patchUpdates(_0x2b8a93){return function(_0x3c0e5e){try{jsonpatch[_0xc054('0x22')](_0x3c0e5e,_0x2b8a93,!![]);}catch(_0x5bb25d){return BPromise[_0xc054('0x23')](_0x5bb25d);}return _0x3c0e5e[_0xc054('0x24')]();};}function saveUpdates(_0x220ea5,_0x3b1f53){return function(_0x328bcb){if(_0x328bcb){return _0x328bcb[_0xc054('0x25')](_0x220ea5)[_0xc054('0x26')](function(_0x4f1630){return _0x4f1630;});}return null;};}function removeEntity(_0x4e8d7f,_0x41546e){return function(_0x5d6f8f){if(_0x5d6f8f){return _0x5d6f8f[_0xc054('0x27')]()['then'](function(){_0x4e8d7f[_0xc054('0x1b')](0xcc)[_0xc054('0x28')]();});}};}function handleEntityNotFound(_0x2146a1,_0x3ac5a1){return function(_0x1f717d){if(!_0x1f717d){_0x2146a1[_0xc054('0x1a')](0x194);}return _0x1f717d;};}function handleError(_0x279274,_0x3f3460){_0x3f3460=_0x3f3460||0x1f4;return function(_0x16eb70){logger[_0xc054('0x29')](_0x16eb70['stack']);if(_0x16eb70['name']){delete _0x16eb70[_0xc054('0x2a')];}_0x279274[_0xc054('0x1b')](_0x3f3460)[_0xc054('0x2b')](_0x16eb70);};}exports[_0xc054('0x2c')]=function(_0x3ce17c,_0x2eec9c){var _0x3756e4={},_0x4f08b2={},_0x775fd1={'count':0x0,'rows':[]};var _0x4170a1=_['map'](db[_0xc054('0x2d')][_0xc054('0x2e')],function(_0x2ef12c){return{'name':_0x2ef12c[_0xc054('0x2f')],'type':_0x2ef12c[_0xc054('0x30')][_0xc054('0x31')]};});_0x4f08b2[_0xc054('0x32')]=_[_0xc054('0x33')](_0x4170a1,_0xc054('0x2a'));_0x4f08b2[_0xc054('0x34')]=_[_0xc054('0x35')](_0x3ce17c[_0xc054('0x34')]);_0x4f08b2[_0xc054('0x36')]=_['intersection'](_0x4f08b2[_0xc054('0x32')],_0x4f08b2['query']);_0x3756e4[_0xc054('0x37')]=_[_0xc054('0x38')](_0x4f08b2[_0xc054('0x32')],qs[_0xc054('0x39')](_0x3ce17c[_0xc054('0x34')][_0xc054('0x39')]));_0x3756e4[_0xc054('0x37')]=_0x3756e4[_0xc054('0x37')]['length']?_0x3756e4[_0xc054('0x37')]:_0x4f08b2[_0xc054('0x32')];if(!_0x3ce17c[_0xc054('0x34')][_0xc054('0x3a')](_0xc054('0x3b'))){_0x3756e4[_0xc054('0x1e')]=qs[_0xc054('0x1e')](_0x3ce17c['query']['limit']);_0x3756e4['offset']=qs[_0xc054('0x1d')](_0x3ce17c[_0xc054('0x34')][_0xc054('0x1d')]);}_0x3756e4[_0xc054('0x3c')]=qs['sort'](_0x3ce17c[_0xc054('0x34')][_0xc054('0x3d')]);_0x3756e4[_0xc054('0x3e')]=qs[_0xc054('0x36')](_[_0xc054('0x3f')](_0x3ce17c[_0xc054('0x34')],_0x4f08b2[_0xc054('0x36')]),_0x4170a1);if(_0x3ce17c[_0xc054('0x34')][_0xc054('0x40')]){_0x3756e4[_0xc054('0x3e')]=_[_0xc054('0x41')](_0x3756e4[_0xc054('0x3e')],{'$or':_[_0xc054('0x33')](_0x4170a1,function(_0x36a6fa){if(_0x36a6fa[_0xc054('0x30')]!=='VIRTUAL'){var _0x1f203e={};_0x1f203e[_0x36a6fa[_0xc054('0x2a')]]={'$like':'%'+_0x3ce17c[_0xc054('0x34')][_0xc054('0x40')]+'%'};return _0x1f203e;}})});}_0x3756e4=_[_0xc054('0x41')]({},_0x3756e4,_0x3ce17c['options']);var _0x1b96fd={'where':_0x3756e4[_0xc054('0x3e')]};return db[_0xc054('0x2d')][_0xc054('0x1f')](_0x1b96fd)[_0xc054('0x26')](function(_0x12cef0){_0x775fd1[_0xc054('0x1f')]=_0x12cef0;if(_0x3ce17c[_0xc054('0x34')][_0xc054('0x42')]){_0x3756e4[_0xc054('0x43')]=[{'all':!![]}];}return db[_0xc054('0x2d')][_0xc054('0x44')](_0x3756e4);})['then'](function(_0x2c683d){_0x775fd1[_0xc054('0x45')]=_0x2c683d;return _0x775fd1;})[_0xc054('0x26')](respondWithFilteredResult(_0x2eec9c,_0x3756e4))[_0xc054('0x46')](handleError(_0x2eec9c,null));};exports['show']=function(_0x285dce,_0x171c21){var _0x59d73a={'raw':![],'where':{'id':_0x285dce[_0xc054('0x47')]['id']}},_0x1d020a={};_0x1d020a[_0xc054('0x32')]=_['keys'](db[_0xc054('0x2d')][_0xc054('0x2e')]);_0x1d020a[_0xc054('0x34')]=_['keys'](_0x285dce[_0xc054('0x34')]);_0x1d020a[_0xc054('0x36')]=_[_0xc054('0x38')](_0x1d020a[_0xc054('0x32')],_0x1d020a[_0xc054('0x34')]);_0x59d73a['attributes']=_[_0xc054('0x38')](_0x1d020a[_0xc054('0x32')],qs[_0xc054('0x39')](_0x285dce['query'][_0xc054('0x39')]));_0x59d73a[_0xc054('0x37')]=_0x59d73a[_0xc054('0x37')][_0xc054('0x48')]?_0x59d73a[_0xc054('0x37')]:_0x1d020a[_0xc054('0x32')];if(_0x285dce[_0xc054('0x34')]['includeAll']){_0x59d73a[_0xc054('0x43')]=[{'all':!![]}];}_0x59d73a=_[_0xc054('0x41')]({},_0x59d73a,_0x285dce['options']);return db[_0xc054('0x2d')][_0xc054('0x49')](_0x59d73a)[_0xc054('0x26')](handleEntityNotFound(_0x171c21,null))[_0xc054('0x26')](respondWithResult(_0x171c21,null))[_0xc054('0x46')](handleError(_0x171c21,null));};exports[_0xc054('0x4a')]=function(_0x4b38a0,_0x5c800e){return db[_0xc054('0x2d')][_0xc054('0x4a')](_0x4b38a0[_0xc054('0x4b')],{})[_0xc054('0x26')](respondWithResult(_0x5c800e,0xc9))[_0xc054('0x46')](handleError(_0x5c800e,null));};exports['update']=function(_0x5d2645,_0x22db5b){if(_0x5d2645[_0xc054('0x4b')]['id']){delete _0x5d2645[_0xc054('0x4b')]['id'];}return db[_0xc054('0x2d')][_0xc054('0x49')]({'where':{'id':_0x5d2645[_0xc054('0x47')]['id']}})['then'](handleEntityNotFound(_0x22db5b,null))['then'](saveUpdates(_0x5d2645[_0xc054('0x4b')],null))[_0xc054('0x26')](respondWithResult(_0x22db5b,null))[_0xc054('0x46')](handleError(_0x22db5b,null));};exports['destroy']=function(_0x3acc54,_0xcae0ac){return db[_0xc054('0x2d')]['find']({'where':{'id':_0x3acc54[_0xc054('0x47')]['id']}})[_0xc054('0x26')](handleEntityNotFound(_0xcae0ac,null))[_0xc054('0x26')](removeEntity(_0xcae0ac,null))[_0xc054('0x46')](handleError(_0xcae0ac,null));};exports[_0xc054('0x4c')]=function(_0x13ce15,_0x223d0e,_0x400a20){var _0x1dac58={};var _0x1c49ec={};var _0x10e5c0;var _0xae2b30;return db[_0xc054('0x2d')][_0xc054('0x4d')]({'where':{'id':_0x13ce15[_0xc054('0x47')]['id']}})[_0xc054('0x26')](handleEntityNotFound(_0x223d0e,null))['then'](function(_0x390c1b){if(_0x390c1b){_0x10e5c0=_0x390c1b;_0x1c49ec[_0xc054('0x32')]=_['keys'](db[_0xc054('0x4e')]['rawAttributes']);_0x1c49ec[_0xc054('0x34')]=_[_0xc054('0x35')](_0x13ce15['query']);_0x1c49ec[_0xc054('0x36')]=_['intersection'](_0x1c49ec[_0xc054('0x32')],_0x1c49ec[_0xc054('0x34')]);_0x1dac58[_0xc054('0x37')]=_['intersection'](_0x1c49ec[_0xc054('0x32')],qs[_0xc054('0x39')](_0x13ce15[_0xc054('0x34')][_0xc054('0x39')]));_0x1dac58[_0xc054('0x37')]=_0x1dac58[_0xc054('0x37')][_0xc054('0x48')]?_0x1dac58[_0xc054('0x37')]:_0x1c49ec[_0xc054('0x32')];_0x1dac58[_0xc054('0x3c')]=qs[_0xc054('0x3d')](_0x13ce15['query'][_0xc054('0x3d')]);_0x1dac58[_0xc054('0x3e')]=qs['filters'](_[_0xc054('0x3f')](_0x13ce15[_0xc054('0x34')],_0x1c49ec[_0xc054('0x36')]));if(_0x13ce15[_0xc054('0x34')]['filter']){_0x1dac58[_0xc054('0x3e')]=_['merge'](_0x1dac58['where'],{'$or':_['map'](_0x1dac58[_0xc054('0x37')],function(_0x4fcfe7){var _0x4895da={};_0x4895da[_0x4fcfe7]={'$like':'%'+_0x13ce15['query'][_0xc054('0x40')]+'%'};return _0x4895da;})});}_0x1dac58=_[_0xc054('0x41')]({},_0x1dac58,_0x13ce15[_0xc054('0x4f')]);return _0x10e5c0[_0xc054('0x4c')](_0x1dac58);}})[_0xc054('0x26')](function(_0x1aa30e){if(_0x1aa30e){_0xae2b30=_0x1aa30e[_0xc054('0x48')];if(!_0x13ce15[_0xc054('0x34')][_0xc054('0x3a')](_0xc054('0x3b'))){_0x1dac58['limit']=qs[_0xc054('0x1e')](_0x13ce15[_0xc054('0x34')][_0xc054('0x1e')]);_0x1dac58[_0xc054('0x1d')]=qs[_0xc054('0x1d')](_0x13ce15[_0xc054('0x34')][_0xc054('0x1d')]);}return _0x10e5c0[_0xc054('0x4c')](_0x1dac58);}})['then'](function(_0xba8f6e){if(_0xba8f6e){return _0xba8f6e?{'count':_0xae2b30,'rows':_0xba8f6e}:null;}})[_0xc054('0x26')](respondWithResult(_0x223d0e,null))[_0xc054('0x46')](handleError(_0x223d0e,null));};exports[_0xc054('0x50')]=function(_0x5b534d,_0x4e02f1,_0x5a4aa3){var _0x131e43={};var _0x3205b7={};var _0x556588;var _0x230326;return db[_0xc054('0x2d')]['findOne']({'where':{'id':_0x5b534d[_0xc054('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e02f1,null))[_0xc054('0x26')](function(_0x3a03cc){if(_0x3a03cc){_0x556588=_0x3a03cc;_0x3205b7[_0xc054('0x32')]=_['keys'](db['Dynamics365Field'][_0xc054('0x2e')]);_0x3205b7['query']=_[_0xc054('0x35')](_0x5b534d['query']);_0x3205b7[_0xc054('0x36')]=_[_0xc054('0x38')](_0x3205b7[_0xc054('0x32')],_0x3205b7[_0xc054('0x34')]);_0x131e43[_0xc054('0x37')]=_[_0xc054('0x38')](_0x3205b7[_0xc054('0x32')],qs[_0xc054('0x39')](_0x5b534d['query'][_0xc054('0x39')]));_0x131e43[_0xc054('0x37')]=_0x131e43['attributes'][_0xc054('0x48')]?_0x131e43[_0xc054('0x37')]:_0x3205b7[_0xc054('0x32')];_0x131e43[_0xc054('0x3c')]=qs['sort'](_0x5b534d[_0xc054('0x34')][_0xc054('0x3d')]);_0x131e43[_0xc054('0x3e')]=qs['filters'](_[_0xc054('0x3f')](_0x5b534d[_0xc054('0x34')],_0x3205b7[_0xc054('0x36')]));if(_0x5b534d['query'][_0xc054('0x40')]){_0x131e43[_0xc054('0x3e')]=_[_0xc054('0x41')](_0x131e43[_0xc054('0x3e')],{'$or':_[_0xc054('0x33')](_0x131e43[_0xc054('0x37')],function(_0x312b5a){var _0x4b8a8a={};_0x4b8a8a[_0x312b5a]={'$like':'%'+_0x5b534d[_0xc054('0x34')][_0xc054('0x40')]+'%'};return _0x4b8a8a;})});}_0x131e43=_[_0xc054('0x41')]({},_0x131e43,_0x5b534d['options']);return _0x556588[_0xc054('0x50')](_0x131e43);}})[_0xc054('0x26')](function(_0x24f1a2){if(_0x24f1a2){_0x230326=_0x24f1a2[_0xc054('0x48')];if(!_0x5b534d[_0xc054('0x34')][_0xc054('0x3a')](_0xc054('0x3b'))){_0x131e43[_0xc054('0x1e')]=qs['limit'](_0x5b534d[_0xc054('0x34')][_0xc054('0x1e')]);_0x131e43[_0xc054('0x1d')]=qs['offset'](_0x5b534d['query'][_0xc054('0x1d')]);}return _0x556588['getSubjects'](_0x131e43);}})[_0xc054('0x26')](function(_0x1e5b6e){if(_0x1e5b6e){return _0x1e5b6e?{'count':_0x230326,'rows':_0x1e5b6e}:null;}})['then'](respondWithResult(_0x4e02f1,null))[_0xc054('0x46')](handleError(_0x4e02f1,null));};exports[_0xc054('0x51')]=function(_0xe40e17,_0x30e087,_0x1f47f2){var _0x171a5c={};var _0x3bee87={};var _0x1767d2;var _0x37b61e;return db[_0xc054('0x2d')]['findOne']({'where':{'id':_0xe40e17[_0xc054('0x47')]['id']}})['then'](handleEntityNotFound(_0x30e087,null))[_0xc054('0x26')](function(_0x3e4bee){if(_0x3e4bee){_0x1767d2=_0x3e4bee;_0x3bee87[_0xc054('0x32')]=_[_0xc054('0x35')](db[_0xc054('0x4e')][_0xc054('0x2e')]);_0x3bee87[_0xc054('0x34')]=_[_0xc054('0x35')](_0xe40e17[_0xc054('0x34')]);_0x3bee87['filters']=_[_0xc054('0x38')](_0x3bee87[_0xc054('0x32')],_0x3bee87[_0xc054('0x34')]);_0x171a5c[_0xc054('0x37')]=_[_0xc054('0x38')](_0x3bee87[_0xc054('0x32')],qs[_0xc054('0x39')](_0xe40e17[_0xc054('0x34')][_0xc054('0x39')]));_0x171a5c['attributes']=_0x171a5c[_0xc054('0x37')]['length']?_0x171a5c[_0xc054('0x37')]:_0x3bee87[_0xc054('0x32')];_0x171a5c['order']=qs[_0xc054('0x3d')](_0xe40e17[_0xc054('0x34')][_0xc054('0x3d')]);_0x171a5c[_0xc054('0x3e')]=qs[_0xc054('0x36')](_['pick'](_0xe40e17[_0xc054('0x34')],_0x3bee87['filters']));if(_0xe40e17[_0xc054('0x34')][_0xc054('0x40')]){_0x171a5c[_0xc054('0x3e')]=_[_0xc054('0x41')](_0x171a5c['where'],{'$or':_[_0xc054('0x33')](_0x171a5c['attributes'],function(_0x5c3705){var _0x5b3de9={};_0x5b3de9[_0x5c3705]={'$like':'%'+_0xe40e17[_0xc054('0x34')][_0xc054('0x40')]+'%'};return _0x5b3de9;})});}_0x171a5c=_['merge']({},_0x171a5c,_0xe40e17[_0xc054('0x4f')]);return _0x1767d2[_0xc054('0x51')](_0x171a5c);}})['then'](function(_0x564114){if(_0x564114){_0x37b61e=_0x564114['length'];if(!_0xe40e17['query'][_0xc054('0x3a')](_0xc054('0x3b'))){_0x171a5c[_0xc054('0x1e')]=qs[_0xc054('0x1e')](_0xe40e17[_0xc054('0x34')][_0xc054('0x1e')]);_0x171a5c[_0xc054('0x1d')]=qs[_0xc054('0x1d')](_0xe40e17[_0xc054('0x34')][_0xc054('0x1d')]);}return _0x1767d2[_0xc054('0x51')](_0x171a5c);}})['then'](function(_0x23810e){if(_0x23810e){return _0x23810e?{'count':_0x37b61e,'rows':_0x23810e}:null;}})['then'](respondWithResult(_0x30e087,null))['catch'](handleError(_0x30e087,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e0d83d9..8f4a297 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9a19,0x114));var _0x99a1=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0x9a19[_0x258b93];return _0x35484b;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x5b4f10,_0x566356){var _0x2f37bb=function(_0x160d0a){while(--_0x160d0a){_0x5b4f10['push'](_0x5b4f10['shift']());}};_0x2f37bb(++_0x566356);}(_0xb821,0xa7));var _0x1b82=function(_0xfba611,_0x1b54e9){_0xfba611=_0xfba611-0x0;var _0x1e500d=_0xb821[_0xfba611];return _0x1e500d;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'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 4d549ef..db05824 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 _0x06d3=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird'];(function(_0x3a3a31,_0x3a6ac7){var _0x4e7062=function(_0x30aeb7){while(--_0x30aeb7){_0x3a3a31['push'](_0x3a3a31['shift']());}};_0x4e7062(++_0x3a6ac7);}(_0x06d3,0x1b4));var _0x306d=function(_0x4179d7,_0x4e1a92){_0x4179d7=_0x4179d7-0x0;var _0x5b34d3=_0x06d3[_0x4179d7];return _0x5b34d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x306d('0x0'));var rs=require(_0x306d('0x1'));var fs=require('fs');var Redis=require(_0x306d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x306d('0x3'));var logger=require('../../config/logger')(_0x306d('0x4'));var config=require(_0x306d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x306d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x248aed,_0x4b0e3f,_0xe76afc){return new BPromise(function(_0x43b4bb,_0xfe2d1){return client[_0x306d('0x7')](_0x248aed,_0xe76afc)[_0x306d('0x8')](function(_0x7c9376){logger[_0x306d('0x9')](_0x306d('0xa'),_0x4b0e3f,_0x306d('0xb'));logger[_0x306d('0xc')](_0x306d('0xd'),_0x4b0e3f,'request\x20sent',JSON[_0x306d('0xe')](_0x7c9376));if(_0x7c9376[_0x306d('0xf')]){if(_0x7c9376[_0x306d('0xf')][_0x306d('0x10')]===0x1f4){logger['error'](_0x306d('0xa'),_0x4b0e3f,_0x7c9376[_0x306d('0xf')][_0x306d('0x11')]);return _0xfe2d1(_0x7c9376[_0x306d('0xf')]['message']);}logger[_0x306d('0xf')](_0x306d('0xa'),_0x4b0e3f,_0x7c9376[_0x306d('0xf')][_0x306d('0x11')]);return _0x43b4bb(_0x7c9376['error'][_0x306d('0x11')]);}else{logger['info'](_0x306d('0xa'),_0x4b0e3f,_0x306d('0xb'));_0x43b4bb(_0x7c9376['result'][_0x306d('0x11')]);}})[_0x306d('0x12')](function(_0x6caa10){logger[_0x306d('0xf')](_0x306d('0xa'),_0x4b0e3f,_0x6caa10);_0xfe2d1(_0x6caa10);});});} \ No newline at end of file +var _0x08fc=['request\x20sent','debug','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x08fc,0x182));var _0xc08f=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x08fc[_0x57fa33];return _0x12e724;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc08f('0x0'));var BPromise=require(_0xc08f('0x1'));var rs=require(_0xc08f('0x2'));var fs=require('fs');var Redis=require(_0xc08f('0x3'));var db=require(_0xc08f('0x4'))['db'];var utils=require(_0xc08f('0x5'));var logger=require(_0xc08f('0x6'))(_0xc08f('0x7'));var config=require(_0xc08f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc08f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b206,_0x4fb68e,_0x47d6f7){return new BPromise(function(_0x517830,_0x34d7c0){return client[_0xc08f('0xa')](_0x33b206,_0x47d6f7)['then'](function(_0x18f11b){logger[_0xc08f('0xb')](_0xc08f('0xc'),_0x4fb68e,_0xc08f('0xd'));logger[_0xc08f('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4fb68e,'request\x20sent',JSON['stringify'](_0x18f11b));if(_0x18f11b[_0xc08f('0xf')]){if(_0x18f11b['error']['code']===0x1f4){logger[_0xc08f('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4fb68e,_0x18f11b['error'][_0xc08f('0x10')]);return _0x34d7c0(_0x18f11b[_0xc08f('0xf')]['message']);}logger[_0xc08f('0xf')](_0xc08f('0xc'),_0x4fb68e,_0x18f11b[_0xc08f('0xf')][_0xc08f('0x10')]);return _0x517830(_0x18f11b[_0xc08f('0xf')][_0xc08f('0x10')]);}else{logger['info'](_0xc08f('0xc'),_0x4fb68e,_0xc08f('0xd'));_0x517830(_0x18f11b[_0xc08f('0x11')][_0xc08f('0x10')]);}})[_0xc08f('0x12')](function(_0x51e387){logger[_0xc08f('0xf')](_0xc08f('0xc'),_0x4fb68e,_0x51e387);_0x34d7c0(_0x51e387);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a43c93e..70396ea 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 _0xdd43=['create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post'];(function(_0x1be8bb,_0x2d9da4){var _0x31fbea=function(_0x368026){while(--_0x368026){_0x1be8bb['push'](_0x1be8bb['shift']());}};_0x31fbea(++_0x2d9da4);}(_0xdd43,0x1d9));var _0x3dd4=function(_0x1f4db9,_0x2d0ff5){_0x1f4db9=_0x1f4db9-0x0;var _0x51b9a3=_0xdd43[_0x1f4db9];return _0x51b9a3;};'use strict';var multer=require(_0x3dd4('0x0'));var util=require('util');var path=require(_0x3dd4('0x1'));var timeout=require(_0x3dd4('0x2'));var express=require('express');var router=express[_0x3dd4('0x3')]();var fs_extra=require(_0x3dd4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3dd4('0x5'));var config=require(_0x3dd4('0x6'));var controller=require(_0x3dd4('0x7'));router[_0x3dd4('0x8')]('/',auth[_0x3dd4('0x9')](),controller[_0x3dd4('0xa')]);router[_0x3dd4('0x8')](_0x3dd4('0xb'),auth[_0x3dd4('0x9')](),controller['show']);router[_0x3dd4('0xc')]('/',auth['isAuthenticated'](),controller[_0x3dd4('0xd')]);router[_0x3dd4('0xe')]('/:id',auth[_0x3dd4('0x9')](),controller[_0x3dd4('0xf')]);router[_0x3dd4('0x10')](_0x3dd4('0xb'),auth[_0x3dd4('0x9')](),controller['destroy']);module[_0x3dd4('0x11')]=router; \ No newline at end of file +var _0x823e=['put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create'];(function(_0x2103aa,_0x204ccb){var _0x5c64a3=function(_0x41ae35){while(--_0x41ae35){_0x2103aa['push'](_0x2103aa['shift']());}};_0x5c64a3(++_0x204ccb);}(_0x823e,0xe8));var _0xe823=function(_0x25b49c,_0x7c83c5){_0x25b49c=_0x25b49c-0x0;var _0x1bd1c5=_0x823e[_0x25b49c];return _0x1bd1c5;};'use strict';var multer=require(_0xe823('0x0'));var util=require(_0xe823('0x1'));var path=require(_0xe823('0x2'));var timeout=require(_0xe823('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe823('0x4'));var auth=require(_0xe823('0x5'));var interaction=require(_0xe823('0x6'));var config=require(_0xe823('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe823('0x8')]);router[_0xe823('0x9')](_0xe823('0xa'),auth['isAuthenticated'](),controller[_0xe823('0xb')]);router[_0xe823('0xc')]('/',auth[_0xe823('0xd')](),controller[_0xe823('0xe')]);router[_0xe823('0xf')](_0xe823('0xa'),auth[_0xe823('0xd')](),controller[_0xe823('0x10')]);router[_0xe823('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe823('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d613562..6ad3710 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 _0x7b74=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x207b1a,_0x4257d8){var _0x3b649c=function(_0x33626b){while(--_0x33626b){_0x207b1a['push'](_0x207b1a['shift']());}};_0x3b649c(++_0x4257d8);}(_0x7b74,0x166));var _0x47b7=function(_0x237dd7,_0x3e9100){_0x237dd7=_0x237dd7-0x0;var _0x12c326=_0x7b74[_0x237dd7];return _0x12c326;};'use strict';var Sequelize=require(_0x47b7('0x0'));module[_0x47b7('0x1')]={'type':{'type':Sequelize[_0x47b7('0x2')](_0x47b7('0x3'),'variable',_0x47b7('0x4'),_0x47b7('0x5'),_0x47b7('0x6')),'defaultValue':_0x47b7('0x3')},'content':{'type':Sequelize[_0x47b7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x47b7('0x2')](_0x47b7('0x3'),_0x47b7('0x8'),_0x47b7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x47b7('0x7')]},'nameField':{'type':Sequelize[_0x47b7('0x7')]},'customField':{'type':Sequelize[_0x47b7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x47b7('0x7')]}}; \ No newline at end of file +var _0x58fd=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','string'];(function(_0x50e480,_0xb736f){var _0x672954=function(_0x5748a3){while(--_0x5748a3){_0x50e480['push'](_0x50e480['shift']());}};_0x672954(++_0xb736f);}(_0x58fd,0x178));var _0xd58f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x58fd[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xd58f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xd58f('0x1'),'variable',_0xd58f('0x2'),_0xd58f('0x3'),_0xd58f('0x4')),'defaultValue':_0xd58f('0x1')},'content':{'type':Sequelize[_0xd58f('0x5')]},'key':{'type':Sequelize[_0xd58f('0x5')]},'keyType':{'type':Sequelize[_0xd58f('0x6')]('string',_0xd58f('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd58f('0x5')]},'idField':{'type':Sequelize[_0xd58f('0x5')]},'nameField':{'type':Sequelize[_0xd58f('0x5')]},'customField':{'type':Sequelize[_0xd58f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd58f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c40a66f..08084b0 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 _0x18e1=['ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','Dynamics365Field','count','includeAll','include','findAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x1155d6,_0xf0e513){var _0x3f5248=function(_0x40fbb1){while(--_0x40fbb1){_0x1155d6['push'](_0x1155d6['shift']());}};_0x3f5248(++_0xf0e513);}(_0x18e1,0x1cb));var _0x118e=function(_0x194883,_0x304f3f){_0x194883=_0x194883-0x0;var _0x56fcf2=_0x18e1[_0x194883];return _0x56fcf2;};'use strict';var emlformat=require(_0x118e('0x0'));var rimraf=require(_0x118e('0x1'));var zipdir=require(_0x118e('0x2'));var jsonpatch=require(_0x118e('0x3'));var rp=require(_0x118e('0x4'));var moment=require(_0x118e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x118e('0x6'));var util=require('util');var path=require(_0x118e('0x7'));var sox=require(_0x118e('0x8'));var csv=require('to-csv');var ejs=require(_0x118e('0x9'));var fs=require('fs');var fs_extra=require(_0x118e('0xa'));var _=require(_0x118e('0xb'));var squel=require(_0x118e('0xc'));var crypto=require(_0x118e('0xd'));var jsforce=require(_0x118e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x118e('0xf'));var querystring=require(_0x118e('0x10'));var Papa=require(_0x118e('0x11'));var Redis=require(_0x118e('0x12'));var authService=require(_0x118e('0x13'));var qs=require(_0x118e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x118e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x118e('0x16'));var config=require(_0x118e('0x17'));var licenseUtil=require(_0x118e('0x18'));var db=require(_0x118e('0x19'))['db'];function respondWithStatusCode(_0x42a56a,_0x56d0e7){_0x56d0e7=_0x56d0e7||0xcc;return function(_0x156301){if(_0x156301){return _0x42a56a[_0x118e('0x1a')](_0x56d0e7);}return _0x42a56a[_0x118e('0x1b')](_0x56d0e7)[_0x118e('0x1c')]();};}function respondWithResult(_0x460212,_0x392e8d){_0x392e8d=_0x392e8d||0xc8;return function(_0x2b6a86){if(_0x2b6a86){return _0x460212[_0x118e('0x1b')](_0x392e8d)[_0x118e('0x1d')](_0x2b6a86);}};}function respondWithFilteredResult(_0x3c8fab,_0x36dcb2){return function(_0x6923fa){if(_0x6923fa){var _0x19b751=typeof _0x36dcb2[_0x118e('0x1e')]===_0x118e('0x1f')&&typeof _0x36dcb2[_0x118e('0x20')]===_0x118e('0x1f');var _0x173b5a=_0x6923fa['count'];var _0xab8878=_0x19b751?0x0:_0x36dcb2[_0x118e('0x1e')];var _0x501857=_0x19b751?_0x6923fa['count']:_0x36dcb2['offset']+_0x36dcb2['limit'];var _0x3e04e6;if(_0x501857>=_0x173b5a){_0x501857=_0x173b5a;_0x3e04e6=0xc8;}else{_0x3e04e6=0xce;}_0x3c8fab[_0x118e('0x1b')](_0x3e04e6);return _0x3c8fab[_0x118e('0x21')](_0x118e('0x22'),_0xab8878+'-'+_0x501857+'/'+_0x173b5a)[_0x118e('0x1d')](_0x6923fa);}return null;};}function patchUpdates(_0x3dc294){return function(_0x4dfc1f){try{jsonpatch[_0x118e('0x23')](_0x4dfc1f,_0x3dc294,!![]);}catch(_0x16bd27){return BPromise[_0x118e('0x24')](_0x16bd27);}return _0x4dfc1f[_0x118e('0x25')]();};}function saveUpdates(_0x8c67b,_0x1cc7b1){return function(_0x49583c){if(_0x49583c){return _0x49583c[_0x118e('0x26')](_0x8c67b)[_0x118e('0x27')](function(_0x19c6f4){return _0x19c6f4;});}return null;};}function removeEntity(_0x238912,_0x7f1614){return function(_0x3abfa2){if(_0x3abfa2){return _0x3abfa2[_0x118e('0x28')]()[_0x118e('0x27')](function(){_0x238912['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8845f3,_0xbc65d5){return function(_0x2f177f){if(!_0x2f177f){_0x8845f3[_0x118e('0x1a')](0x194);}return _0x2f177f;};}function handleError(_0x405484,_0x3003c1){_0x3003c1=_0x3003c1||0x1f4;return function(_0x1284fe){logger[_0x118e('0x29')](_0x1284fe[_0x118e('0x2a')]);if(_0x1284fe[_0x118e('0x2b')]){delete _0x1284fe[_0x118e('0x2b')];}_0x405484[_0x118e('0x1b')](_0x3003c1)[_0x118e('0x2c')](_0x1284fe);};}exports[_0x118e('0x2d')]=function(_0x56cbe1,_0x17086d){var _0x30956a={},_0x6182d7={},_0x57a2b6={'count':0x0,'rows':[]};var _0x58c380=_[_0x118e('0x2e')](db['Dynamics365Field'][_0x118e('0x2f')],function(_0x57121d){return{'name':_0x57121d[_0x118e('0x30')],'type':_0x57121d[_0x118e('0x31')][_0x118e('0x32')]};});_0x6182d7[_0x118e('0x33')]=_[_0x118e('0x2e')](_0x58c380,_0x118e('0x2b'));_0x6182d7['query']=_[_0x118e('0x34')](_0x56cbe1['query']);_0x6182d7['filters']=_[_0x118e('0x35')](_0x6182d7[_0x118e('0x33')],_0x6182d7[_0x118e('0x36')]);_0x30956a[_0x118e('0x37')]=_['intersection'](_0x6182d7['model'],qs[_0x118e('0x38')](_0x56cbe1[_0x118e('0x36')][_0x118e('0x38')]));_0x30956a['attributes']=_0x30956a[_0x118e('0x37')][_0x118e('0x39')]?_0x30956a['attributes']:_0x6182d7['model'];if(!_0x56cbe1[_0x118e('0x36')][_0x118e('0x3a')](_0x118e('0x3b'))){_0x30956a[_0x118e('0x20')]=qs[_0x118e('0x20')](_0x56cbe1[_0x118e('0x36')]['limit']);_0x30956a[_0x118e('0x1e')]=qs['offset'](_0x56cbe1['query'][_0x118e('0x1e')]);}_0x30956a['order']=qs['sort'](_0x56cbe1['query'][_0x118e('0x3c')]);_0x30956a[_0x118e('0x3d')]=qs[_0x118e('0x3e')](_[_0x118e('0x3f')](_0x56cbe1[_0x118e('0x36')],_0x6182d7[_0x118e('0x3e')]),_0x58c380);if(_0x56cbe1[_0x118e('0x36')][_0x118e('0x40')]){_0x30956a[_0x118e('0x3d')]=_['merge'](_0x30956a[_0x118e('0x3d')],{'$or':_['map'](_0x58c380,function(_0x3b3fc1){if(_0x3b3fc1[_0x118e('0x31')]!==_0x118e('0x41')){var _0x10cd24={};_0x10cd24[_0x3b3fc1[_0x118e('0x2b')]]={'$like':'%'+_0x56cbe1[_0x118e('0x36')][_0x118e('0x40')]+'%'};return _0x10cd24;}})});}_0x30956a=_[_0x118e('0x42')]({},_0x30956a,_0x56cbe1[_0x118e('0x43')]);var _0x3caac9={'where':_0x30956a[_0x118e('0x3d')]};return db[_0x118e('0x44')][_0x118e('0x45')](_0x3caac9)[_0x118e('0x27')](function(_0x2ecd23){_0x57a2b6[_0x118e('0x45')]=_0x2ecd23;if(_0x56cbe1[_0x118e('0x36')][_0x118e('0x46')]){_0x30956a[_0x118e('0x47')]=[{'all':!![]}];}return db[_0x118e('0x44')][_0x118e('0x48')](_0x30956a);})[_0x118e('0x27')](function(_0x302db8){_0x57a2b6['rows']=_0x302db8;return _0x57a2b6;})[_0x118e('0x27')](respondWithFilteredResult(_0x17086d,_0x30956a))['catch'](handleError(_0x17086d,null));};exports['show']=function(_0x39cc20,_0x1f875f){var _0x154cd2={'raw':!![],'where':{'id':_0x39cc20['params']['id']}},_0x2f6058={};_0x2f6058[_0x118e('0x33')]=_[_0x118e('0x34')](db['Dynamics365Field'][_0x118e('0x2f')]);_0x2f6058[_0x118e('0x36')]=_[_0x118e('0x34')](_0x39cc20['query']);_0x2f6058[_0x118e('0x3e')]=_[_0x118e('0x35')](_0x2f6058[_0x118e('0x33')],_0x2f6058[_0x118e('0x36')]);_0x154cd2['attributes']=_[_0x118e('0x35')](_0x2f6058[_0x118e('0x33')],qs[_0x118e('0x38')](_0x39cc20[_0x118e('0x36')][_0x118e('0x38')]));_0x154cd2[_0x118e('0x37')]=_0x154cd2[_0x118e('0x37')][_0x118e('0x39')]?_0x154cd2[_0x118e('0x37')]:_0x2f6058[_0x118e('0x33')];if(_0x39cc20[_0x118e('0x36')][_0x118e('0x46')]){_0x154cd2[_0x118e('0x47')]=[{'all':!![]}];}_0x154cd2=_[_0x118e('0x42')]({},_0x154cd2,_0x39cc20['options']);return db[_0x118e('0x44')]['find'](_0x154cd2)[_0x118e('0x27')](handleEntityNotFound(_0x1f875f,null))['then'](respondWithResult(_0x1f875f,null))[_0x118e('0x49')](handleError(_0x1f875f,null));};exports[_0x118e('0x4a')]=function(_0x446551,_0x50a980){return db[_0x118e('0x44')][_0x118e('0x4a')](_0x446551[_0x118e('0x4b')],{})[_0x118e('0x27')](respondWithResult(_0x50a980,0xc9))[_0x118e('0x49')](handleError(_0x50a980,null));};exports[_0x118e('0x26')]=function(_0x502e7c,_0x1d4b3c){if(_0x502e7c['body']['id']){delete _0x502e7c['body']['id'];}return db[_0x118e('0x44')][_0x118e('0x4c')]({'where':{'id':_0x502e7c[_0x118e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d4b3c,null))[_0x118e('0x27')](saveUpdates(_0x502e7c[_0x118e('0x4b')],null))['then'](respondWithResult(_0x1d4b3c,null))['catch'](handleError(_0x1d4b3c,null));};exports[_0x118e('0x28')]=function(_0x42de1d,_0xf860e4){return db['Dynamics365Field'][_0x118e('0x4c')]({'where':{'id':_0x42de1d[_0x118e('0x4d')]['id']}})[_0x118e('0x27')](handleEntityNotFound(_0xf860e4,null))[_0x118e('0x27')](removeEntity(_0xf860e4,null))[_0x118e('0x49')](handleError(_0xf860e4,null));}; \ No newline at end of file +var _0x384c=['reject','save','then','destroy','error','stack','name','Dynamics365Field','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x35cf89,_0x418485){var _0x100062=function(_0x4c36b5){while(--_0x4c36b5){_0x35cf89['push'](_0x35cf89['shift']());}};_0x100062(++_0x418485);}(_0x384c,0x1e3));var _0xc384=function(_0x402b7b,_0x1761ec){_0x402b7b=_0x402b7b-0x0;var _0xf21b7d=_0x384c[_0x402b7b];return _0xf21b7d;};'use strict';var emlformat=require(_0xc384('0x0'));var rimraf=require(_0xc384('0x1'));var zipdir=require(_0xc384('0x2'));var jsonpatch=require(_0xc384('0x3'));var rp=require(_0xc384('0x4'));var moment=require(_0xc384('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc384('0x6'));var util=require(_0xc384('0x7'));var path=require(_0xc384('0x8'));var sox=require('sox');var csv=require(_0xc384('0x9'));var ejs=require(_0xc384('0xa'));var fs=require('fs');var fs_extra=require(_0xc384('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc384('0xc'));var jsforce=require(_0xc384('0xd'));var deskjs=require(_0xc384('0xe'));var toCsv=require(_0xc384('0x9'));var querystring=require(_0xc384('0xf'));var Papa=require('papaparse');var Redis=require(_0xc384('0x10'));var authService=require(_0xc384('0x11'));var qs=require(_0xc384('0x12'));var as=require(_0xc384('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc384('0x14'))('api');var utils=require(_0xc384('0x15'));var config=require(_0xc384('0x16'));var licenseUtil=require(_0xc384('0x17'));var db=require(_0xc384('0x18'))['db'];function respondWithStatusCode(_0x591264,_0x1243c7){_0x1243c7=_0x1243c7||0xcc;return function(_0x567c30){if(_0x567c30){return _0x591264[_0xc384('0x19')](_0x1243c7);}return _0x591264[_0xc384('0x1a')](_0x1243c7)[_0xc384('0x1b')]();};}function respondWithResult(_0x1869f7,_0x3a5c1f){_0x3a5c1f=_0x3a5c1f||0xc8;return function(_0x3ef253){if(_0x3ef253){return _0x1869f7[_0xc384('0x1a')](_0x3a5c1f)['json'](_0x3ef253);}};}function respondWithFilteredResult(_0x1bc637,_0x2f91f8){return function(_0x299c82){if(_0x299c82){var _0x3f32b1=typeof _0x2f91f8[_0xc384('0x1c')]===_0xc384('0x1d')&&typeof _0x2f91f8[_0xc384('0x1e')]===_0xc384('0x1d');var _0x3552ad=_0x299c82[_0xc384('0x1f')];var _0x822c41=_0x3f32b1?0x0:_0x2f91f8[_0xc384('0x1c')];var _0x2331fa=_0x3f32b1?_0x299c82[_0xc384('0x1f')]:_0x2f91f8[_0xc384('0x1c')]+_0x2f91f8[_0xc384('0x1e')];var _0x3e61a6;if(_0x2331fa>=_0x3552ad){_0x2331fa=_0x3552ad;_0x3e61a6=0xc8;}else{_0x3e61a6=0xce;}_0x1bc637[_0xc384('0x1a')](_0x3e61a6);return _0x1bc637[_0xc384('0x20')](_0xc384('0x21'),_0x822c41+'-'+_0x2331fa+'/'+_0x3552ad)[_0xc384('0x22')](_0x299c82);}return null;};}function patchUpdates(_0x268d98){return function(_0x3428ac){try{jsonpatch['apply'](_0x3428ac,_0x268d98,!![]);}catch(_0x5477b3){return BPromise[_0xc384('0x23')](_0x5477b3);}return _0x3428ac[_0xc384('0x24')]();};}function saveUpdates(_0x371c5f,_0x37908e){return function(_0x45e6ed){if(_0x45e6ed){return _0x45e6ed['update'](_0x371c5f)[_0xc384('0x25')](function(_0x71d0fb){return _0x71d0fb;});}return null;};}function removeEntity(_0x27a01d,_0x57559f){return function(_0x50fbb4){if(_0x50fbb4){return _0x50fbb4[_0xc384('0x26')]()['then'](function(){_0x27a01d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x443460,_0x32562a){return function(_0x4f48a6){if(!_0x4f48a6){_0x443460['sendStatus'](0x194);}return _0x4f48a6;};}function handleError(_0x1a2caf,_0x18f9be){_0x18f9be=_0x18f9be||0x1f4;return function(_0x5befcf){logger[_0xc384('0x27')](_0x5befcf[_0xc384('0x28')]);if(_0x5befcf[_0xc384('0x29')]){delete _0x5befcf[_0xc384('0x29')];}_0x1a2caf['status'](_0x18f9be)['send'](_0x5befcf);};}exports['index']=function(_0x4c0614,_0x3e969b){var _0x3a9a99={},_0x6e8c49={},_0x4970d7={'count':0x0,'rows':[]};var _0x231d3c=_['map'](db[_0xc384('0x2a')]['rawAttributes'],function(_0x508b79){return{'name':_0x508b79[_0xc384('0x2b')],'type':_0x508b79['type'][_0xc384('0x2c')]};});_0x6e8c49[_0xc384('0x2d')]=_[_0xc384('0x2e')](_0x231d3c,_0xc384('0x29'));_0x6e8c49[_0xc384('0x2f')]=_[_0xc384('0x30')](_0x4c0614['query']);_0x6e8c49['filters']=_['intersection'](_0x6e8c49[_0xc384('0x2d')],_0x6e8c49[_0xc384('0x2f')]);_0x3a9a99[_0xc384('0x31')]=_[_0xc384('0x32')](_0x6e8c49[_0xc384('0x2d')],qs[_0xc384('0x33')](_0x4c0614[_0xc384('0x2f')]['fields']));_0x3a9a99['attributes']=_0x3a9a99[_0xc384('0x31')][_0xc384('0x34')]?_0x3a9a99[_0xc384('0x31')]:_0x6e8c49[_0xc384('0x2d')];if(!_0x4c0614[_0xc384('0x2f')][_0xc384('0x35')](_0xc384('0x36'))){_0x3a9a99[_0xc384('0x1e')]=qs[_0xc384('0x1e')](_0x4c0614['query'][_0xc384('0x1e')]);_0x3a9a99[_0xc384('0x1c')]=qs[_0xc384('0x1c')](_0x4c0614['query'][_0xc384('0x1c')]);}_0x3a9a99[_0xc384('0x37')]=qs[_0xc384('0x38')](_0x4c0614[_0xc384('0x2f')]['sort']);_0x3a9a99[_0xc384('0x39')]=qs[_0xc384('0x3a')](_[_0xc384('0x3b')](_0x4c0614[_0xc384('0x2f')],_0x6e8c49[_0xc384('0x3a')]),_0x231d3c);if(_0x4c0614[_0xc384('0x2f')][_0xc384('0x3c')]){_0x3a9a99[_0xc384('0x39')]=_[_0xc384('0x3d')](_0x3a9a99[_0xc384('0x39')],{'$or':_['map'](_0x231d3c,function(_0x1daa63){if(_0x1daa63['type']!==_0xc384('0x3e')){var _0x111c0c={};_0x111c0c[_0x1daa63[_0xc384('0x29')]]={'$like':'%'+_0x4c0614[_0xc384('0x2f')][_0xc384('0x3c')]+'%'};return _0x111c0c;}})});}_0x3a9a99=_['merge']({},_0x3a9a99,_0x4c0614[_0xc384('0x3f')]);var _0x3ef08d={'where':_0x3a9a99[_0xc384('0x39')]};return db[_0xc384('0x2a')][_0xc384('0x1f')](_0x3ef08d)[_0xc384('0x25')](function(_0x3a86ba){_0x4970d7[_0xc384('0x1f')]=_0x3a86ba;if(_0x4c0614['query']['includeAll']){_0x3a9a99['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xc384('0x40')](_0x3a9a99);})[_0xc384('0x25')](function(_0x3f69e1){_0x4970d7[_0xc384('0x41')]=_0x3f69e1;return _0x4970d7;})[_0xc384('0x25')](respondWithFilteredResult(_0x3e969b,_0x3a9a99))['catch'](handleError(_0x3e969b,null));};exports[_0xc384('0x42')]=function(_0x52dcd5,_0x1e4f8c){var _0xc25795={'raw':!![],'where':{'id':_0x52dcd5[_0xc384('0x43')]['id']}},_0x3d3e37={};_0x3d3e37['model']=_[_0xc384('0x30')](db[_0xc384('0x2a')][_0xc384('0x44')]);_0x3d3e37[_0xc384('0x2f')]=_[_0xc384('0x30')](_0x52dcd5[_0xc384('0x2f')]);_0x3d3e37['filters']=_[_0xc384('0x32')](_0x3d3e37['model'],_0x3d3e37[_0xc384('0x2f')]);_0xc25795[_0xc384('0x31')]=_['intersection'](_0x3d3e37[_0xc384('0x2d')],qs['fields'](_0x52dcd5['query']['fields']));_0xc25795[_0xc384('0x31')]=_0xc25795[_0xc384('0x31')][_0xc384('0x34')]?_0xc25795[_0xc384('0x31')]:_0x3d3e37[_0xc384('0x2d')];if(_0x52dcd5[_0xc384('0x2f')]['includeAll']){_0xc25795['include']=[{'all':!![]}];}_0xc25795=_[_0xc384('0x3d')]({},_0xc25795,_0x52dcd5[_0xc384('0x3f')]);return db[_0xc384('0x2a')][_0xc384('0x45')](_0xc25795)[_0xc384('0x25')](handleEntityNotFound(_0x1e4f8c,null))[_0xc384('0x25')](respondWithResult(_0x1e4f8c,null))[_0xc384('0x46')](handleError(_0x1e4f8c,null));};exports[_0xc384('0x47')]=function(_0x482ae0,_0x4f509d){return db[_0xc384('0x2a')]['create'](_0x482ae0['body'],{})[_0xc384('0x25')](respondWithResult(_0x4f509d,0xc9))[_0xc384('0x46')](handleError(_0x4f509d,null));};exports[_0xc384('0x48')]=function(_0x3963cc,_0x5497f2){if(_0x3963cc['body']['id']){delete _0x3963cc[_0xc384('0x49')]['id'];}return db[_0xc384('0x2a')]['find']({'where':{'id':_0x3963cc[_0xc384('0x43')]['id']}})[_0xc384('0x25')](handleEntityNotFound(_0x5497f2,null))[_0xc384('0x25')](saveUpdates(_0x3963cc[_0xc384('0x49')],null))['then'](respondWithResult(_0x5497f2,null))[_0xc384('0x46')](handleError(_0x5497f2,null));};exports[_0xc384('0x26')]=function(_0xedb407,_0x255c46){return db['Dynamics365Field'][_0xc384('0x45')]({'where':{'id':_0xedb407[_0xc384('0x43')]['id']}})[_0xc384('0x25')](handleEntityNotFound(_0x255c46,null))['then'](removeEntity(_0x255c46,null))[_0xc384('0x46')](handleError(_0x255c46,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 018cec8..f9d52f1 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 _0xb51b=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define'];(function(_0x366e51,_0x3a0178){var _0x4e23e3=function(_0x7ecebe){while(--_0x7ecebe){_0x366e51['push'](_0x366e51['shift']());}};_0x4e23e3(++_0x3a0178);}(_0xb51b,0x1d7));var _0xbb51=function(_0x59492c,_0x5b280e){_0x59492c=_0x59492c-0x0;var _0x419276=_0xb51b[_0x59492c];return _0x419276;};'use strict';var _=require(_0xbb51('0x0'));var util=require('util');var logger=require(_0xbb51('0x1'))(_0xbb51('0x2'));var moment=require('moment');var BPromise=require(_0xbb51('0x3'));var rp=require(_0xbb51('0x4'));var fs=require('fs');var path=require(_0xbb51('0x5'));var rimraf=require(_0xbb51('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb51('0x7'));module[_0xbb51('0x8')]=function(_0x12b330,_0x2a2882){return _0x12b330[_0xbb51('0x9')](_0xbb51('0xa'),attributes,{'tableName':_0xbb51('0xb'),'paranoid':![],'indexes':[{'name':_0xbb51('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e5e=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x31fcdc,_0x370b60){var _0x4da262=function(_0x597c25){while(--_0x597c25){_0x31fcdc['push'](_0x31fcdc['shift']());}};_0x4da262(++_0x370b60);}(_0x7e5e,0x1ce));var _0xe7e5=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x7e5e[_0x4191bc];return _0x1ffd4e;};'use strict';var _=require(_0xe7e5('0x0'));var util=require(_0xe7e5('0x1'));var logger=require(_0xe7e5('0x2'))(_0xe7e5('0x3'));var moment=require(_0xe7e5('0x4'));var BPromise=require('bluebird');var rp=require(_0xe7e5('0x5'));var fs=require('fs');var path=require(_0xe7e5('0x6'));var rimraf=require(_0xe7e5('0x7'));var config=require(_0xe7e5('0x8'));var attributes=require(_0xe7e5('0x9'));module[_0xe7e5('0xa')]=function(_0x458704,_0x1dac57){return _0x458704[_0xe7e5('0xb')](_0xe7e5('0xc'),attributes,{'tableName':_0xe7e5('0xd'),'paranoid':![],'indexes':[{'name':_0xe7e5('0xe'),'fields':[_0xe7e5('0xf'),_0xe7e5('0x10')],'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 70e9ac6..02083dd 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 _0x226a=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3b55af,_0x26b3f7){var _0x3a8e96=function(_0x31c793){while(--_0x31c793){_0x3b55af['push'](_0x3b55af['shift']());}};_0x3a8e96(++_0x26b3f7);}(_0x226a,0x1ba));var _0xa226=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x226a[_0x414f67];return _0x338537;};'use strict';var _=require(_0xa226('0x0'));var util=require(_0xa226('0x1'));var moment=require(_0xa226('0x2'));var BPromise=require('bluebird');var rs=require(_0xa226('0x3'));var fs=require('fs');var Redis=require(_0xa226('0x4'));var db=require(_0xa226('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa226('0x6'))(_0xa226('0x7'));var config=require('../../config/environment');var jayson=require(_0xa226('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48f15d,_0x31009f,_0x48af1e){return new BPromise(function(_0x383963,_0x54c24b){return client[_0xa226('0x9')](_0x48f15d,_0x48af1e)['then'](function(_0x56cb03){logger[_0xa226('0xa')](_0xa226('0xb'),_0x31009f,_0xa226('0xc'));logger[_0xa226('0xd')](_0xa226('0xe'),_0x31009f,'request\x20sent',JSON[_0xa226('0xf')](_0x56cb03));if(_0x56cb03[_0xa226('0x10')]){if(_0x56cb03[_0xa226('0x10')][_0xa226('0x11')]===0x1f4){logger[_0xa226('0x10')](_0xa226('0xb'),_0x31009f,_0x56cb03[_0xa226('0x10')][_0xa226('0x12')]);return _0x54c24b(_0x56cb03['error'][_0xa226('0x12')]);}logger[_0xa226('0x10')](_0xa226('0xb'),_0x31009f,_0x56cb03[_0xa226('0x10')][_0xa226('0x12')]);return _0x383963(_0x56cb03[_0xa226('0x10')][_0xa226('0x12')]);}else{logger[_0xa226('0xa')](_0xa226('0xb'),_0x31009f,_0xa226('0xc'));_0x383963(_0x56cb03[_0xa226('0x13')][_0xa226('0x12')]);}})[_0xa226('0x14')](function(_0x40646f){logger[_0xa226('0x10')](_0xa226('0xb'),_0x31009f,_0x40646f);_0x54c24b(_0x40646f);});});} \ No newline at end of file +var _0x95ac=['rpc','../../config/environment','client','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2cf683,_0x3213de){var _0x5cddff=function(_0x454eed){while(--_0x454eed){_0x2cf683['push'](_0x2cf683['shift']());}};_0x5cddff(++_0x3213de);}(_0x95ac,0x108));var _0xc95a=function(_0x2453c3,_0x465bfa){_0x2453c3=_0x2453c3-0x0;var _0x457b60=_0x95ac[_0x2453c3];return _0x457b60;};'use strict';var _=require(_0xc95a('0x0'));var util=require(_0xc95a('0x1'));var moment=require(_0xc95a('0x2'));var BPromise=require(_0xc95a('0x3'));var rs=require(_0xc95a('0x4'));var fs=require('fs');var Redis=require(_0xc95a('0x5'));var db=require(_0xc95a('0x6'))['db'];var utils=require(_0xc95a('0x7'));var logger=require(_0xc95a('0x8'))(_0xc95a('0x9'));var config=require(_0xc95a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc95a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c4fcb,_0x33832e,_0x3dd8bd){return new BPromise(function(_0x86f21c,_0x1bef3b){return client['request'](_0x6c4fcb,_0x3dd8bd)['then'](function(_0x5534af){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x33832e,_0xc95a('0xc'));logger[_0xc95a('0xd')](_0xc95a('0xe'),_0x33832e,_0xc95a('0xc'),JSON[_0xc95a('0xf')](_0x5534af));if(_0x5534af[_0xc95a('0x10')]){if(_0x5534af[_0xc95a('0x10')]['code']===0x1f4){logger[_0xc95a('0x10')](_0xc95a('0x11'),_0x33832e,_0x5534af['error'][_0xc95a('0x12')]);return _0x1bef3b(_0x5534af[_0xc95a('0x10')]['message']);}logger[_0xc95a('0x10')](_0xc95a('0x11'),_0x33832e,_0x5534af[_0xc95a('0x10')][_0xc95a('0x12')]);return _0x86f21c(_0x5534af[_0xc95a('0x10')][_0xc95a('0x12')]);}else{logger[_0xc95a('0x13')](_0xc95a('0x11'),_0x33832e,_0xc95a('0xc'));_0x86f21c(_0x5534af[_0xc95a('0x14')][_0xc95a('0x12')]);}})['catch'](function(_0x26225d){logger[_0xc95a('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x33832e,_0x26225d);_0x1bef3b(_0x26225d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1ee738d..be836c6 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 _0x485a=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x485a,0x1f1));var _0xa485=function(_0x2f7c40,_0xb36203){_0x2f7c40=_0x2f7c40-0x0;var _0x57a4a5=_0x485a[_0x2f7c40];return _0x57a4a5;};'use strict';var multer=require(_0xa485('0x0'));var util=require('util');var path=require(_0xa485('0x1'));var timeout=require('connect-timeout');var express=require(_0xa485('0x2'));var router=express['Router']();var fs_extra=require(_0xa485('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa485('0x4'));var config=require(_0xa485('0x5'));var controller=require(_0xa485('0x6'));router[_0xa485('0x7')]('/',auth[_0xa485('0x8')](),controller[_0xa485('0x9')]);router[_0xa485('0x7')](_0xa485('0xa'),auth['isAuthenticated'](),controller[_0xa485('0xb')]);router['get'](_0xa485('0xc'),auth[_0xa485('0x8')](),controller[_0xa485('0xd')]);router[_0xa485('0x7')](_0xa485('0xe'),auth[_0xa485('0x8')](),controller['getFields']);router[_0xa485('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa485('0xf')](_0xa485('0xc'),auth[_0xa485('0x8')](),controller[_0xa485('0x10')]);router[_0xa485('0x11')](_0xa485('0xa'),auth[_0xa485('0x8')](),controller[_0xa485('0x12')]);router[_0xa485('0x13')]('/:id',auth[_0xa485('0x8')](),controller[_0xa485('0x14')]);module[_0xa485('0x15')]=router; \ No newline at end of file +var _0x2260=['./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x496127,_0x306806){var _0x3dd286=function(_0x56c4b7){while(--_0x56c4b7){_0x496127['push'](_0x496127['shift']());}};_0x3dd286(++_0x306806);}(_0x2260,0x161));var _0x0226=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2260[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0226('0x0'));var util=require(_0x0226('0x1'));var path=require(_0x0226('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0226('0x3'));var auth=require(_0x0226('0x4'));var interaction=require(_0x0226('0x5'));var config=require(_0x0226('0x6'));var controller=require(_0x0226('0x7'));router[_0x0226('0x8')]('/',auth[_0x0226('0x9')](),controller['index']);router[_0x0226('0x8')](_0x0226('0xa'),auth[_0x0226('0x9')](),controller[_0x0226('0xb')]);router['get']('/:id/configurations',auth[_0x0226('0x9')](),controller[_0x0226('0xc')]);router[_0x0226('0x8')](_0x0226('0xd'),auth['isAuthenticated'](),controller[_0x0226('0xe')]);router[_0x0226('0xf')]('/',auth[_0x0226('0x9')](),controller[_0x0226('0x10')]);router[_0x0226('0xf')](_0x0226('0x11'),auth[_0x0226('0x9')](),controller[_0x0226('0x12')]);router[_0x0226('0x13')](_0x0226('0xa'),auth[_0x0226('0x9')](),controller[_0x0226('0x14')]);router[_0x0226('0x15')](_0x0226('0xa'),auth[_0x0226('0x9')](),controller[_0x0226('0x16')]);module[_0x0226('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0807e33..fffcf40 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 _0xe5af=['exports','STRING','username','remoteUri'];(function(_0xc296c7,_0x29413b){var _0x4734c9=function(_0x3de71e){while(--_0x3de71e){_0xc296c7['push'](_0xc296c7['shift']());}};_0x4734c9(++_0x29413b);}(_0xe5af,0x9c));var _0xfe5a=function(_0x29d335,_0x4346a8){_0x29d335=_0x29d335-0x0;var _0x3b0563=_0xe5af[_0x29d335];return _0x3b0563;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe5a('0x1')],'unique':_0xfe5a('0x2')},'apiKey':{'type':Sequelize[_0xfe5a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfe5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1967=['STRING','username','remoteUri','exports'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0x1967,0x173));var _0x7196=function(_0x2da7f8,_0x32321e){_0x2da7f8=_0x2da7f8-0x0;var _0x571d57=_0x1967[_0x2da7f8];return _0x571d57;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('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 1843635..c1e316e 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 _0x765b=['path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','name','index','FreshdeskAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','catch','show','find','create','body','update','getConfigurations','findOne','params','hasOwnProperty','addConfiguration','Subjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s:X','toString','requester','subject','agent','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','fast-json-patch','moment','mustache','util'];(function(_0x43eb68,_0x34acfe){var _0x451a50=function(_0x190198){while(--_0x190198){_0x43eb68['push'](_0x43eb68['shift']());}};_0x451a50(++_0x34acfe);}(_0x765b,0x18c));var _0xb765=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x765b[_0x1e6b59];return _0x40d7c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb765('0x0'));var rp=require('request-promise');var moment=require(_0xb765('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb765('0x2'));var util=require(_0xb765('0x3'));var path=require(_0xb765('0x4'));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(_0xb765('0x5'));var squel=require('squel');var crypto=require(_0xb765('0x6'));var jsforce=require(_0xb765('0x7'));var deskjs=require(_0xb765('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb765('0x9'));var Papa=require(_0xb765('0xa'));var Redis=require(_0xb765('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb765('0xc'));var logger=require(_0xb765('0xd'))(_0xb765('0xe'));var utils=require(_0xb765('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xb765('0x10'));var db=require(_0xb765('0x11'))['db'];var integrations=require(_0xb765('0x12'));function respondWithStatusCode(_0x3f9acb,_0x38ee06){_0x38ee06=_0x38ee06||0xcc;return function(_0xadac12){if(_0xadac12){return _0x3f9acb[_0xb765('0x13')](_0x38ee06);}return _0x3f9acb[_0xb765('0x14')](_0x38ee06)[_0xb765('0x15')]();};}function respondWithResult(_0x4d8eff,_0x2aebdb){_0x2aebdb=_0x2aebdb||0xc8;return function(_0x5d8852){if(_0x5d8852){return _0x4d8eff[_0xb765('0x14')](_0x2aebdb)[_0xb765('0x16')](_0x5d8852);}};}function respondWithFilteredResult(_0x4cecc1,_0x4b8e26){return function(_0x3f73f4){if(_0x3f73f4){var _0x2ab6b8=typeof _0x4b8e26[_0xb765('0x17')]===_0xb765('0x18')&&typeof _0x4b8e26[_0xb765('0x19')]===_0xb765('0x18');var _0x9bd542=_0x3f73f4[_0xb765('0x1a')];var _0x5c182f=_0x2ab6b8?0x0:_0x4b8e26[_0xb765('0x17')];var _0x132aab=_0x2ab6b8?_0x3f73f4[_0xb765('0x1a')]:_0x4b8e26[_0xb765('0x17')]+_0x4b8e26[_0xb765('0x19')];var _0x360b9e;if(_0x132aab>=_0x9bd542){_0x132aab=_0x9bd542;_0x360b9e=0xc8;}else{_0x360b9e=0xce;}_0x4cecc1[_0xb765('0x14')](_0x360b9e);return _0x4cecc1[_0xb765('0x1b')](_0xb765('0x1c'),_0x5c182f+'-'+_0x132aab+'/'+_0x9bd542)[_0xb765('0x16')](_0x3f73f4);}return null;};}function patchUpdates(_0x44936d){return function(_0x1b1184){try{jsonpatch['apply'](_0x1b1184,_0x44936d,!![]);}catch(_0x5d72a1){return BPromise[_0xb765('0x1d')](_0x5d72a1);}return _0x1b1184['save']();};}function saveUpdates(_0x3d69c7,_0x2e0196){return function(_0x461da8){if(_0x461da8){return _0x461da8['update'](_0x3d69c7)[_0xb765('0x1e')](function(_0x1a740c){return _0x1a740c;});}return null;};}function removeEntity(_0x5d1ea0,_0x3a05b1){return function(_0x3684e8){if(_0x3684e8){return _0x3684e8[_0xb765('0x1f')]()[_0xb765('0x1e')](function(){_0x5d1ea0['status'](0xcc)[_0xb765('0x15')]();});}};}function handleEntityNotFound(_0x6a5457,_0x4e12b8){return function(_0x4dc7d1){if(!_0x4dc7d1){_0x6a5457[_0xb765('0x13')](0x194);}return _0x4dc7d1;};}function handleError(_0x4715d7,_0x1c561a){_0x1c561a=_0x1c561a||0x1f4;return function(_0x562bd3){logger['error'](_0x562bd3['stack']);if(_0x562bd3[_0xb765('0x20')]){delete _0x562bd3[_0xb765('0x20')];}_0x4715d7[_0xb765('0x14')](_0x1c561a)['send'](_0x562bd3);};}exports[_0xb765('0x21')]=function(_0x3c7206,_0x48a84a){var _0x2842c2={},_0xe9f0b9={},_0x439162={'count':0x0,'rows':[]};var _0x5ce321=_['map'](db[_0xb765('0x22')][_0xb765('0x23')],function(_0x1d8970){return{'name':_0x1d8970['fieldName'],'type':_0x1d8970[_0xb765('0x24')][_0xb765('0x25')]};});_0xe9f0b9['model']=_['map'](_0x5ce321,_0xb765('0x20'));_0xe9f0b9[_0xb765('0x26')]=_[_0xb765('0x27')](_0x3c7206[_0xb765('0x26')]);_0xe9f0b9[_0xb765('0x28')]=_[_0xb765('0x29')](_0xe9f0b9[_0xb765('0x2a')],_0xe9f0b9['query']);_0x2842c2[_0xb765('0x2b')]=_[_0xb765('0x29')](_0xe9f0b9[_0xb765('0x2a')],qs[_0xb765('0x2c')](_0x3c7206['query']['fields']));_0x2842c2['attributes']=_0x2842c2[_0xb765('0x2b')][_0xb765('0x2d')]?_0x2842c2['attributes']:_0xe9f0b9[_0xb765('0x2a')];if(!_0x3c7206['query']['hasOwnProperty'](_0xb765('0x2e'))){_0x2842c2[_0xb765('0x19')]=qs['limit'](_0x3c7206[_0xb765('0x26')][_0xb765('0x19')]);_0x2842c2['offset']=qs[_0xb765('0x17')](_0x3c7206[_0xb765('0x26')][_0xb765('0x17')]);}_0x2842c2[_0xb765('0x2f')]=qs[_0xb765('0x30')](_0x3c7206[_0xb765('0x26')][_0xb765('0x30')]);_0x2842c2[_0xb765('0x31')]=qs['filters'](_[_0xb765('0x32')](_0x3c7206[_0xb765('0x26')],_0xe9f0b9['filters']),_0x5ce321);if(_0x3c7206[_0xb765('0x26')]['filter']){_0x2842c2[_0xb765('0x31')]=_[_0xb765('0x33')](_0x2842c2['where'],{'$or':_[_0xb765('0x34')](_0x5ce321,function(_0x19dbf4){if(_0x19dbf4['type']!=='VIRTUAL'){var _0x21c90e={};_0x21c90e[_0x19dbf4[_0xb765('0x20')]]={'$like':'%'+_0x3c7206[_0xb765('0x26')][_0xb765('0x35')]+'%'};return _0x21c90e;}})});}_0x2842c2=_['merge']({},_0x2842c2,_0x3c7206[_0xb765('0x36')]);var _0x25a243={'where':_0x2842c2[_0xb765('0x31')]};return db['FreshdeskAccount'][_0xb765('0x1a')](_0x25a243)[_0xb765('0x1e')](function(_0x3a46d9){_0x439162[_0xb765('0x1a')]=_0x3a46d9;if(_0x3c7206['query'][_0xb765('0x37')]){_0x2842c2[_0xb765('0x38')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xb765('0x39')](_0x2842c2);})[_0xb765('0x1e')](function(_0x29a469){_0x439162['rows']=_0x29a469;return _0x439162;})['then'](respondWithFilteredResult(_0x48a84a,_0x2842c2))[_0xb765('0x3a')](handleError(_0x48a84a,null));};exports[_0xb765('0x3b')]=function(_0x542372,_0x42a715){var _0x516b98={'raw':![],'where':{'id':_0x542372['params']['id']}},_0x4a0bd5={};_0x4a0bd5['model']=_[_0xb765('0x27')](db[_0xb765('0x22')][_0xb765('0x23')]);_0x4a0bd5[_0xb765('0x26')]=_[_0xb765('0x27')](_0x542372['query']);_0x4a0bd5[_0xb765('0x28')]=_[_0xb765('0x29')](_0x4a0bd5['model'],_0x4a0bd5[_0xb765('0x26')]);_0x516b98[_0xb765('0x2b')]=_['intersection'](_0x4a0bd5[_0xb765('0x2a')],qs[_0xb765('0x2c')](_0x542372[_0xb765('0x26')][_0xb765('0x2c')]));_0x516b98[_0xb765('0x2b')]=_0x516b98[_0xb765('0x2b')][_0xb765('0x2d')]?_0x516b98[_0xb765('0x2b')]:_0x4a0bd5[_0xb765('0x2a')];if(_0x542372['query'][_0xb765('0x37')]){_0x516b98[_0xb765('0x38')]=[{'all':!![]}];}_0x516b98=_[_0xb765('0x33')]({},_0x516b98,_0x542372['options']);return db['FreshdeskAccount'][_0xb765('0x3c')](_0x516b98)['then'](handleEntityNotFound(_0x42a715,null))[_0xb765('0x1e')](respondWithResult(_0x42a715,null))[_0xb765('0x3a')](handleError(_0x42a715,null));};exports['create']=function(_0x12eff7,_0x164dc9){return db[_0xb765('0x22')][_0xb765('0x3d')](_0x12eff7[_0xb765('0x3e')],{})[_0xb765('0x1e')](respondWithResult(_0x164dc9,0xc9))['catch'](handleError(_0x164dc9,null));};exports[_0xb765('0x3f')]=function(_0x2540fc,_0x7ae096){if(_0x2540fc[_0xb765('0x3e')]['id']){delete _0x2540fc[_0xb765('0x3e')]['id'];}return db[_0xb765('0x22')][_0xb765('0x3c')]({'where':{'id':_0x2540fc['params']['id']}})[_0xb765('0x1e')](handleEntityNotFound(_0x7ae096,null))['then'](saveUpdates(_0x2540fc[_0xb765('0x3e')],null))[_0xb765('0x1e')](respondWithResult(_0x7ae096,null))[_0xb765('0x3a')](handleError(_0x7ae096,null));};exports[_0xb765('0x1f')]=function(_0x5f37de,_0x41d67e){return db['FreshdeskAccount'][_0xb765('0x3c')]({'where':{'id':_0x5f37de['params']['id']}})[_0xb765('0x1e')](handleEntityNotFound(_0x41d67e,null))['then'](removeEntity(_0x41d67e,null))['catch'](handleError(_0x41d67e,null));};exports[_0xb765('0x40')]=function(_0x580a3d,_0x46a585,_0x405be7){var _0x39c4ca={};var _0x27cd8f={};var _0x14c3b0;var _0x3c9ace;return db['FreshdeskAccount'][_0xb765('0x41')]({'where':{'id':_0x580a3d[_0xb765('0x42')]['id']}})[_0xb765('0x1e')](handleEntityNotFound(_0x46a585,null))[_0xb765('0x1e')](function(_0x334e43){if(_0x334e43){_0x14c3b0=_0x334e43;_0x27cd8f[_0xb765('0x2a')]=_[_0xb765('0x27')](db['FreshdeskConfiguration'][_0xb765('0x23')]);_0x27cd8f[_0xb765('0x26')]=_['keys'](_0x580a3d['query']);_0x27cd8f[_0xb765('0x28')]=_[_0xb765('0x29')](_0x27cd8f[_0xb765('0x2a')],_0x27cd8f[_0xb765('0x26')]);_0x39c4ca[_0xb765('0x2b')]=_[_0xb765('0x29')](_0x27cd8f['model'],qs['fields'](_0x580a3d['query'][_0xb765('0x2c')]));_0x39c4ca[_0xb765('0x2b')]=_0x39c4ca['attributes'][_0xb765('0x2d')]?_0x39c4ca['attributes']:_0x27cd8f[_0xb765('0x2a')];_0x39c4ca[_0xb765('0x2f')]=qs[_0xb765('0x30')](_0x580a3d[_0xb765('0x26')][_0xb765('0x30')]);_0x39c4ca['where']=qs[_0xb765('0x28')](_[_0xb765('0x32')](_0x580a3d[_0xb765('0x26')],_0x27cd8f[_0xb765('0x28')]));if(_0x580a3d[_0xb765('0x26')][_0xb765('0x35')]){_0x39c4ca[_0xb765('0x31')]=_[_0xb765('0x33')](_0x39c4ca[_0xb765('0x31')],{'$or':_['map'](_0x39c4ca[_0xb765('0x2b')],function(_0x40a98a){var _0x3e76e2={};_0x3e76e2[_0x40a98a]={'$like':'%'+_0x580a3d[_0xb765('0x26')]['filter']+'%'};return _0x3e76e2;})});}_0x39c4ca=_[_0xb765('0x33')]({},_0x39c4ca,_0x580a3d[_0xb765('0x36')]);return _0x14c3b0['getConfigurations'](_0x39c4ca);}})[_0xb765('0x1e')](function(_0xd589c5){if(_0xd589c5){_0x3c9ace=_0xd589c5[_0xb765('0x2d')];if(!_0x580a3d[_0xb765('0x26')][_0xb765('0x43')]('nolimit')){_0x39c4ca[_0xb765('0x19')]=qs[_0xb765('0x19')](_0x580a3d[_0xb765('0x26')]['limit']);_0x39c4ca['offset']=qs[_0xb765('0x17')](_0x580a3d[_0xb765('0x26')][_0xb765('0x17')]);}return _0x14c3b0['getConfigurations'](_0x39c4ca);}})[_0xb765('0x1e')](function(_0x1e6b28){if(_0x1e6b28){return _0x1e6b28?{'count':_0x3c9ace,'rows':_0x1e6b28}:null;}})[_0xb765('0x1e')](respondWithResult(_0x46a585,null))[_0xb765('0x3a')](handleError(_0x46a585,null));};exports[_0xb765('0x44')]=function(_0x4a5a24,_0x1b3d82,_0x2a7296){if(_0x4a5a24[_0xb765('0x3e')]['id']){delete _0x4a5a24['body']['id'];}return db[_0xb765('0x22')][_0xb765('0x41')]({'where':{'id':_0x4a5a24[_0xb765('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b3d82,null))[_0xb765('0x1e')](function(_0xf8ed84){if(_0xf8ed84){_0x4a5a24[_0xb765('0x3e')]['AccountId']=_0xf8ed84['id'];_0x4a5a24['body'][_0xb765('0x45')]=integrations['getSubjects'](_0x4a5a24['body']['channel'],_0x4a5a24[_0xb765('0x3e')]['type']);_0x4a5a24[_0xb765('0x3e')][_0xb765('0x46')]=integrations['getDescriptions'](_0x4a5a24[_0xb765('0x3e')][_0xb765('0x47')],_0x4a5a24['body'][_0xb765('0x24')]);return db[_0xb765('0x48')][_0xb765('0x3d')](_0x4a5a24[_0xb765('0x3e')],{'include':[{'model':db[_0xb765('0x49')],'as':_0xb765('0x45')},{'model':db['FreshdeskField'],'as':_0xb765('0x46')}]});}return null;})['then'](respondWithResult(_0x1b3d82,null))[_0xb765('0x3a')](handleError(_0x1b3d82,null));};exports[_0xb765('0x4a')]=function(_0x457bc9,_0x58be22,_0x35dc72){var _0x497d66='';return db[_0xb765('0x22')][_0xb765('0x41')]({'where':{'id':_0x457bc9['params']['id']},'attributes':['id',_0xb765('0x4b'),_0xb765('0x4c')]})[_0xb765('0x1e')](handleEntityNotFound(_0x58be22,null))['then'](function(_0x2b15b9){if(_0x2b15b9){_0x497d66=_0x2b15b9['remoteUri'];var _0x35735d=_0x497d66[_0xb765('0x4d')](-0x1);if(_0x35735d==='/'){_0x497d66=_0x497d66[_0xb765('0x4e')](0x0,_0x497d66[_0xb765('0x4f')](_0x35735d));}return rp({'method':_0xb765('0x50'),'uri':util['format']('%s/%s',_0x497d66,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xb765('0x51')]('Basic\x20%s',new Buffer(util[_0xb765('0x51')](_0xb765('0x52'),_0x2b15b9[_0xb765('0x4c')]))[_0xb765('0x53')]('base64'))},'json':!![]});}})['then'](function(_0x16b20c){if(_0x16b20c){var _0x2654cd=[_0xb765('0x54'),_0xb765('0x55'),_0xb765('0x56'),'description',_0xb765('0x14'),_0xb765('0x57'),_0xb765('0x58'),_0xb765('0x59'),_0xb765('0x5a'),_0xb765('0x58'),'company'];_[_0xb765('0x5b')](_0x16b20c,function(_0x3a152a){return _0x2654cd[_0xb765('0x5c')](_0x3a152a[_0xb765('0x20')])||!_0x3a152a['default']&&_0x3a152a['type']!==_0xb765('0x5d')&&_0x3a152a[_0xb765('0x24')]!==_0xb765('0x5e');});return{'count':_0x16b20c[_0xb765('0x2d')],'rows':_['map'](_0x16b20c,function(_0x46a5e6){return{'id':_0x46a5e6['name'],'name':_0x46a5e6['label'],'custom':!_0x46a5e6['default'],'options':_0x46a5e6[_0xb765('0x5f')]?_[_0xb765('0x34')](_0x46a5e6['choices'],function(_0x10e9cb){return{'name':_['capitalize'](_0x10e9cb),'value':_0x10e9cb};}):[]};})};}})[_0xb765('0x1e')](respondWithResult(_0x58be22,null))['catch'](function(_0x3da051){var _0x375223=_0x457bc9[_0xb765('0x26')][_0xb765('0x60')]?0x1f4:_0x3da051[_0xb765('0x61')]||0x1f4;logger['error'](_0xb765('0x62'),_0xb765('0x4a'),_0x375223,JSON['stringify'](_0x3da051));delete _0x3da051[_0xb765('0x20')];if(_0x375223===0x191){_0x375223=0x190;}_0x58be22[_0xb765('0x14')](_0x375223)['send'](_0x457bc9['query'][_0xb765('0x60')]?{'message':_0xb765('0x63'),'statusCode':_0x3da051[_0xb765('0x61')]}:_0x3da051);});}; \ No newline at end of file +var _0x9e5e=['Basic\x20%s','%s:X','apiKey','toString','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','rows','catch','show','params','attributes','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9e5e[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require(_0xe9e5('0x0'));var rimraf=require(_0xe9e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9e5('0x2'));var rp=require(_0xe9e5('0x3'));var moment=require(_0xe9e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9e5('0x5'));var util=require('util');var path=require(_0xe9e5('0x6'));var sox=require(_0xe9e5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9e5('0x8'));var _=require(_0xe9e5('0x9'));var squel=require('squel');var crypto=require(_0xe9e5('0xa'));var jsforce=require(_0xe9e5('0xb'));var deskjs=require(_0xe9e5('0xc'));var toCsv=require(_0xe9e5('0xd'));var querystring=require(_0xe9e5('0xe'));var Papa=require(_0xe9e5('0xf'));var Redis=require(_0xe9e5('0x10'));var authService=require(_0xe9e5('0x11'));var qs=require(_0xe9e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e5('0x13'));var logger=require(_0xe9e5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9e5('0x15'))['db'];var integrations=require(_0xe9e5('0x16'));function respondWithStatusCode(_0x42dcba,_0x272b49){_0x272b49=_0x272b49||0xcc;return function(_0x269ac4){if(_0x269ac4){return _0x42dcba[_0xe9e5('0x17')](_0x272b49);}return _0x42dcba[_0xe9e5('0x18')](_0x272b49)[_0xe9e5('0x19')]();};}function respondWithResult(_0x3097da,_0xfe19e8){_0xfe19e8=_0xfe19e8||0xc8;return function(_0x5c901a){if(_0x5c901a){return _0x3097da[_0xe9e5('0x18')](_0xfe19e8)[_0xe9e5('0x1a')](_0x5c901a);}};}function respondWithFilteredResult(_0x35c830,_0x3f0990){return function(_0x17990d){if(_0x17990d){var _0x695c52=typeof _0x3f0990[_0xe9e5('0x1b')]===_0xe9e5('0x1c')&&typeof _0x3f0990[_0xe9e5('0x1d')]===_0xe9e5('0x1c');var _0x4d779e=_0x17990d[_0xe9e5('0x1e')];var _0x30550=_0x695c52?0x0:_0x3f0990[_0xe9e5('0x1b')];var _0x3ad9f9=_0x695c52?_0x17990d[_0xe9e5('0x1e')]:_0x3f0990[_0xe9e5('0x1b')]+_0x3f0990[_0xe9e5('0x1d')];var _0x44e60d;if(_0x3ad9f9>=_0x4d779e){_0x3ad9f9=_0x4d779e;_0x44e60d=0xc8;}else{_0x44e60d=0xce;}_0x35c830[_0xe9e5('0x18')](_0x44e60d);return _0x35c830[_0xe9e5('0x1f')]('Content-Range',_0x30550+'-'+_0x3ad9f9+'/'+_0x4d779e)['json'](_0x17990d);}return null;};}function patchUpdates(_0x559d10){return function(_0x106b21){try{jsonpatch[_0xe9e5('0x20')](_0x106b21,_0x559d10,!![]);}catch(_0x2935a4){return BPromise[_0xe9e5('0x21')](_0x2935a4);}return _0x106b21[_0xe9e5('0x22')]();};}function saveUpdates(_0xb2a983,_0x22d394){return function(_0x15db4b){if(_0x15db4b){return _0x15db4b[_0xe9e5('0x23')](_0xb2a983)[_0xe9e5('0x24')](function(_0x1b9d2f){return _0x1b9d2f;});}return null;};}function removeEntity(_0x4c0fb9,_0x252fdc){return function(_0x579d9a){if(_0x579d9a){return _0x579d9a[_0xe9e5('0x25')]()['then'](function(){_0x4c0fb9[_0xe9e5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac8fc,_0x5e84dc){return function(_0xf88884){if(!_0xf88884){_0x5ac8fc[_0xe9e5('0x17')](0x194);}return _0xf88884;};}function handleError(_0x338076,_0x327cb2){_0x327cb2=_0x327cb2||0x1f4;return function(_0x3fcab2){logger[_0xe9e5('0x26')](_0x3fcab2[_0xe9e5('0x27')]);if(_0x3fcab2[_0xe9e5('0x28')]){delete _0x3fcab2[_0xe9e5('0x28')];}_0x338076[_0xe9e5('0x18')](_0x327cb2)['send'](_0x3fcab2);};}exports[_0xe9e5('0x29')]=function(_0x56f728,_0xe7d11e){var _0x18969d={},_0x554bcb={},_0x4161e9={'count':0x0,'rows':[]};var _0x881d0d=_[_0xe9e5('0x2a')](db['FreshdeskAccount'][_0xe9e5('0x2b')],function(_0x5d0593){return{'name':_0x5d0593[_0xe9e5('0x2c')],'type':_0x5d0593[_0xe9e5('0x2d')]['key']};});_0x554bcb[_0xe9e5('0x2e')]=_[_0xe9e5('0x2a')](_0x881d0d,'name');_0x554bcb[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x56f728[_0xe9e5('0x2f')]);_0x554bcb[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],_0x554bcb['query']);_0x18969d['attributes']=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],qs['fields'](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x18969d['attributes']=_0x18969d['attributes'][_0xe9e5('0x34')]?_0x18969d['attributes']:_0x554bcb['model'];if(!_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x35')](_0xe9e5('0x36'))){_0x18969d[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x18969d[_0xe9e5('0x1b')]=qs[_0xe9e5('0x1b')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}_0x18969d[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x56f728['query'][_0xe9e5('0x38')]);_0x18969d[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_[_0xe9e5('0x3a')](_0x56f728[_0xe9e5('0x2f')],_0x554bcb[_0xe9e5('0x31')]),_0x881d0d);if(_0x56f728['query'][_0xe9e5('0x3b')]){_0x18969d[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x18969d['where'],{'$or':_[_0xe9e5('0x2a')](_0x881d0d,function(_0x352903){if(_0x352903[_0xe9e5('0x2d')]!==_0xe9e5('0x3d')){var _0x3353d6={};_0x3353d6[_0x352903[_0xe9e5('0x28')]]={'$like':'%'+_0x56f728[_0xe9e5('0x2f')]['filter']+'%'};return _0x3353d6;}})});}_0x18969d=_['merge']({},_0x18969d,_0x56f728[_0xe9e5('0x3e')]);var _0x304571={'where':_0x18969d[_0xe9e5('0x39')]};return db[_0xe9e5('0x3f')][_0xe9e5('0x1e')](_0x304571)['then'](function(_0x2c44eb){_0x4161e9['count']=_0x2c44eb;if(_0x56f728[_0xe9e5('0x2f')]['includeAll']){_0x18969d[_0xe9e5('0x40')]=[{'all':!![]}];}return db[_0xe9e5('0x3f')]['findAll'](_0x18969d);})[_0xe9e5('0x24')](function(_0x47c5ea){_0x4161e9[_0xe9e5('0x41')]=_0x47c5ea;return _0x4161e9;})[_0xe9e5('0x24')](respondWithFilteredResult(_0xe7d11e,_0x18969d))[_0xe9e5('0x42')](handleError(_0xe7d11e,null));};exports[_0xe9e5('0x43')]=function(_0x10572d,_0x2bc934){var _0x1601fd={'raw':![],'where':{'id':_0x10572d[_0xe9e5('0x44')]['id']}},_0x147741={};_0x147741[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db['FreshdeskAccount'][_0xe9e5('0x2b')]);_0x147741[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x10572d[_0xe9e5('0x2f')]);_0x147741['filters']=_['intersection'](_0x147741[_0xe9e5('0x2e')],_0x147741['query']);_0x1601fd[_0xe9e5('0x45')]=_[_0xe9e5('0x32')](_0x147741[_0xe9e5('0x2e')],qs[_0xe9e5('0x33')](_0x10572d[_0xe9e5('0x2f')]['fields']));_0x1601fd[_0xe9e5('0x45')]=_0x1601fd['attributes']['length']?_0x1601fd['attributes']:_0x147741[_0xe9e5('0x2e')];if(_0x10572d[_0xe9e5('0x2f')][_0xe9e5('0x46')]){_0x1601fd[_0xe9e5('0x40')]=[{'all':!![]}];}_0x1601fd=_[_0xe9e5('0x3c')]({},_0x1601fd,_0x10572d[_0xe9e5('0x3e')]);return db[_0xe9e5('0x3f')][_0xe9e5('0x47')](_0x1601fd)['then'](handleEntityNotFound(_0x2bc934,null))[_0xe9e5('0x24')](respondWithResult(_0x2bc934,null))[_0xe9e5('0x42')](handleError(_0x2bc934,null));};exports[_0xe9e5('0x48')]=function(_0x441839,_0x2b785e){return db[_0xe9e5('0x3f')][_0xe9e5('0x48')](_0x441839['body'],{})['then'](respondWithResult(_0x2b785e,0xc9))[_0xe9e5('0x42')](handleError(_0x2b785e,null));};exports['update']=function(_0x1dc5cf,_0x20be8f){if(_0x1dc5cf[_0xe9e5('0x49')]['id']){delete _0x1dc5cf['body']['id'];}return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x1dc5cf[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x20be8f,null))['then'](saveUpdates(_0x1dc5cf[_0xe9e5('0x49')],null))[_0xe9e5('0x24')](respondWithResult(_0x20be8f,null))[_0xe9e5('0x42')](handleError(_0x20be8f,null));};exports[_0xe9e5('0x25')]=function(_0x3f532d,_0x23cee5){return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x3f532d[_0xe9e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x23cee5,null))['then'](removeEntity(_0x23cee5,null))[_0xe9e5('0x42')](handleError(_0x23cee5,null));};exports[_0xe9e5('0x4a')]=function(_0x275022,_0x3b673d,_0x219f73){var _0x19ad88={};var _0x42ce27={};var _0x28439f;var _0x47d74b;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x275022[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x3b673d,null))[_0xe9e5('0x24')](function(_0x198ce0){if(_0x198ce0){_0x28439f=_0x198ce0;_0x42ce27[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db[_0xe9e5('0x4b')]['rawAttributes']);_0x42ce27[_0xe9e5('0x2f')]=_['keys'](_0x275022[_0xe9e5('0x2f')]);_0x42ce27[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x42ce27['model'],_0x42ce27[_0xe9e5('0x2f')]);_0x19ad88[_0xe9e5('0x45')]=_['intersection'](_0x42ce27['model'],qs[_0xe9e5('0x33')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x19ad88[_0xe9e5('0x45')]=_0x19ad88[_0xe9e5('0x45')][_0xe9e5('0x34')]?_0x19ad88[_0xe9e5('0x45')]:_0x42ce27['model'];_0x19ad88[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x275022[_0xe9e5('0x2f')]['sort']);_0x19ad88[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_['pick'](_0x275022[_0xe9e5('0x2f')],_0x42ce27[_0xe9e5('0x31')]));if(_0x275022[_0xe9e5('0x2f')]['filter']){_0x19ad88[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x19ad88[_0xe9e5('0x39')],{'$or':_[_0xe9e5('0x2a')](_0x19ad88[_0xe9e5('0x45')],function(_0x33ea59){var _0x10b48b={};_0x10b48b[_0x33ea59]={'$like':'%'+_0x275022[_0xe9e5('0x2f')]['filter']+'%'};return _0x10b48b;})});}_0x19ad88=_['merge']({},_0x19ad88,_0x275022[_0xe9e5('0x3e')]);return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})[_0xe9e5('0x24')](function(_0x24e116){if(_0x24e116){_0x47d74b=_0x24e116[_0xe9e5('0x34')];if(!_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x35')]('nolimit')){_0x19ad88[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x19ad88['offset']=qs['offset'](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})['then'](function(_0x49d6bb){if(_0x49d6bb){return _0x49d6bb?{'count':_0x47d74b,'rows':_0x49d6bb}:null;}})['then'](respondWithResult(_0x3b673d,null))[_0xe9e5('0x42')](handleError(_0x3b673d,null));};exports[_0xe9e5('0x4c')]=function(_0x335685,_0x19bcd6,_0x2da8ad){if(_0x335685[_0xe9e5('0x49')]['id']){delete _0x335685[_0xe9e5('0x49')]['id'];}return db['FreshdeskAccount'][_0xe9e5('0x4d')]({'where':{'id':_0x335685['params']['id']}})['then'](handleEntityNotFound(_0x19bcd6,null))[_0xe9e5('0x24')](function(_0x1e3373){if(_0x1e3373){_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4e')]=_0x1e3373['id'];_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4f')]=integrations[_0xe9e5('0x50')](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685['body'][_0xe9e5('0x2d')]);_0x335685[_0xe9e5('0x49')]['Descriptions']=integrations['getDescriptions'](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685[_0xe9e5('0x49')][_0xe9e5('0x2d')]);return db[_0xe9e5('0x4b')][_0xe9e5('0x48')](_0x335685[_0xe9e5('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe9e5('0x4f')},{'model':db[_0xe9e5('0x52')],'as':_0xe9e5('0x53')}]});}return null;})[_0xe9e5('0x24')](respondWithResult(_0x19bcd6,null))[_0xe9e5('0x42')](handleError(_0x19bcd6,null));};exports[_0xe9e5('0x54')]=function(_0x15d799,_0x17dcb9,_0x3f655c){var _0x54ba7e='';return db[_0xe9e5('0x3f')]['findOne']({'where':{'id':_0x15d799['params']['id']},'attributes':['id',_0xe9e5('0x55'),'apiKey']})[_0xe9e5('0x24')](handleEntityNotFound(_0x17dcb9,null))[_0xe9e5('0x24')](function(_0x4aa632){if(_0x4aa632){_0x54ba7e=_0x4aa632[_0xe9e5('0x55')];var _0x50ee97=_0x54ba7e[_0xe9e5('0x56')](-0x1);if(_0x50ee97==='/'){_0x54ba7e=_0x54ba7e[_0xe9e5('0x57')](0x0,_0x54ba7e[_0xe9e5('0x58')](_0x50ee97));}return rp({'method':_0xe9e5('0x59'),'uri':util['format'](_0xe9e5('0x5a'),_0x54ba7e,_0xe9e5('0x5b')),'headers':{'Authorization':util[_0xe9e5('0x5c')](_0xe9e5('0x5d'),new Buffer(util['format'](_0xe9e5('0x5e'),_0x4aa632[_0xe9e5('0x5f')]))[_0xe9e5('0x60')]('base64'))},'json':!![]});}})[_0xe9e5('0x24')](function(_0x3b89b2){if(_0x3b89b2){var _0x59c87e=['requester','subject',_0xe9e5('0x61'),_0xe9e5('0x62'),'status',_0xe9e5('0x63'),_0xe9e5('0x64'),_0xe9e5('0x65'),_0xe9e5('0x66'),_0xe9e5('0x64'),'company'];_[_0xe9e5('0x67')](_0x3b89b2,function(_0x500f14){return _0x59c87e[_0xe9e5('0x68')](_0x500f14[_0xe9e5('0x28')])||!_0x500f14[_0xe9e5('0x69')]&&_0x500f14[_0xe9e5('0x2d')]!=='custom_text'&&_0x500f14[_0xe9e5('0x2d')]!==_0xe9e5('0x6a');});return{'count':_0x3b89b2['length'],'rows':_['map'](_0x3b89b2,function(_0x272f6d){return{'id':_0x272f6d[_0xe9e5('0x28')],'name':_0x272f6d[_0xe9e5('0x6b')],'custom':!_0x272f6d[_0xe9e5('0x69')],'options':_0x272f6d['choices']?_[_0xe9e5('0x2a')](_0x272f6d[_0xe9e5('0x6c')],function(_0x2e8bdf){return{'name':_[_0xe9e5('0x6d')](_0x2e8bdf),'value':_0x2e8bdf};}):[]};})};}})[_0xe9e5('0x24')](respondWithResult(_0x17dcb9,null))[_0xe9e5('0x42')](function(_0x26b885){var _0x58302a=_0x15d799[_0xe9e5('0x2f')]['test']?0x1f4:_0x26b885[_0xe9e5('0x6e')]||0x1f4;logger['error'](_0xe9e5('0x6f'),_0xe9e5('0x54'),_0x58302a,JSON['stringify'](_0x26b885));delete _0x26b885[_0xe9e5('0x28')];if(_0x58302a===0x191){_0x58302a=0x190;}_0x17dcb9[_0xe9e5('0x18')](_0x58302a)[_0xe9e5('0x70')](_0x15d799['query'][_0xe9e5('0x71')]?{'message':_0xe9e5('0x72'),'statusCode':_0x26b885[_0xe9e5('0x6e')]}:_0x26b885);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e51da4d..5088481 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 _0x1c5f=['int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c5f,0xe1));var _0xf1c5=function(_0x331603,_0x50ea3a){_0x331603=_0x331603-0x0;var _0x1ec28c=_0x1c5f[_0x331603];return _0x1ec28c;};'use strict';var _=require(_0xf1c5('0x0'));var util=require(_0xf1c5('0x1'));var logger=require('../../config/logger')(_0xf1c5('0x2'));var moment=require(_0xf1c5('0x3'));var BPromise=require(_0xf1c5('0x4'));var rp=require(_0xf1c5('0x5'));var fs=require('fs');var path=require(_0xf1c5('0x6'));var rimraf=require(_0xf1c5('0x7'));var config=require(_0xf1c5('0x8'));var attributes=require(_0xf1c5('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf1c5('0xa')]=function(_0x2e6746,_0x23e411){return _0x2e6746[_0xf1c5('0xb')](_0xf1c5('0xc'),attributes,{'tableName':_0xf1c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b68=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x21860d,_0x3919b8){var _0x4efa9d=function(_0x2968a2){while(--_0x2968a2){_0x21860d['push'](_0x21860d['shift']());}};_0x4efa9d(++_0x3919b8);}(_0x3b68,0xa5));var _0x83b6=function(_0x32f1f2,_0x540977){_0x32f1f2=_0x32f1f2-0x0;var _0x2da63f=_0x3b68[_0x32f1f2];return _0x2da63f;};'use strict';var _=require(_0x83b6('0x0'));var util=require(_0x83b6('0x1'));var logger=require(_0x83b6('0x2'))(_0x83b6('0x3'));var moment=require(_0x83b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x83b6('0x5'));var fs=require('fs');var path=require(_0x83b6('0x6'));var rimraf=require(_0x83b6('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x83b6('0x8'));module[_0x83b6('0x9')]=function(_0x2c1626,_0x729d40){return _0x2c1626[_0x83b6('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index c066ce5..d70b247 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 _0x210d=['message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','then','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x210d,0x7c));var _0xd210=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x210d[_0x38987f];return _0x4cb697;};'use strict';var _=require(_0xd210('0x0'));var util=require(_0xd210('0x1'));var moment=require('moment');var BPromise=require(_0xd210('0x2'));var rs=require(_0xd210('0x3'));var fs=require('fs');var Redis=require(_0xd210('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd210('0x5'))(_0xd210('0x6'));var config=require(_0xd210('0x7'));var jayson=require(_0xd210('0x8'));var client=jayson[_0xd210('0x9')][_0xd210('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e63bd,_0x288c98,_0x2e8df7){return new BPromise(function(_0xc3fd08,_0x26bd4e){return client[_0xd210('0xb')](_0x3e63bd,_0x2e8df7)['then'](function(_0x14a04e){logger[_0xd210('0xc')](_0xd210('0xd'),_0x288c98,_0xd210('0xe'));logger[_0xd210('0xf')](_0xd210('0x10'),_0x288c98,'request\x20sent',JSON[_0xd210('0x11')](_0x14a04e));if(_0x14a04e[_0xd210('0x12')]){if(_0x14a04e[_0xd210('0x12')][_0xd210('0x13')]===0x1f4){logger[_0xd210('0x12')](_0xd210('0xd'),_0x288c98,_0x14a04e[_0xd210('0x12')]['message']);return _0x26bd4e(_0x14a04e[_0xd210('0x12')][_0xd210('0x14')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x288c98,_0x14a04e[_0xd210('0x12')][_0xd210('0x14')]);return _0xc3fd08(_0x14a04e[_0xd210('0x12')][_0xd210('0x14')]);}else{logger[_0xd210('0xc')](_0xd210('0xd'),_0x288c98,'request\x20sent');_0xc3fd08(_0x14a04e[_0xd210('0x15')][_0xd210('0x14')]);}})[_0xd210('0x16')](function(_0x8c0b8){logger[_0xd210('0x12')](_0xd210('0xd'),_0x288c98,_0x8c0b8);_0x26bd4e(_0x8c0b8);});});}exports[_0xd210('0x17')]=function(_0xe89e28){var _0x214c4b=this;return new Promise(function(_0x42ecc6,_0x5b6b98){return db[_0xd210('0x18')][_0xd210('0x19')]({'raw':_0xe89e28[_0xd210('0x1a')]?_0xe89e28[_0xd210('0x1a')][_0xd210('0x1b')]===undefined?!![]:![]:!![],'where':_0xe89e28[_0xd210('0x1a')]?_0xe89e28[_0xd210('0x1a')][_0xd210('0x1c')]||null:null,'attributes':_0xe89e28[_0xd210('0x1a')]?_0xe89e28[_0xd210('0x1a')][_0xd210('0x1d')]||null:null,'limit':_0xe89e28[_0xd210('0x1a')]?_0xe89e28['options'][_0xd210('0x1e')]||null:null,'include':_0xe89e28[_0xd210('0x1a')]?_0xe89e28[_0xd210('0x1a')][_0xd210('0x1f')]?_[_0xd210('0x20')](_0xe89e28['options']['include'],function(_0x4bc690){return{'model':db[_0x4bc690[_0xd210('0x21')]],'as':_0x4bc690['as'],'attributes':_0x4bc690['attributes'],'include':_0x4bc690[_0xd210('0x1f')]?_[_0xd210('0x20')](_0x4bc690['include'],function(_0x2a2d33){return{'model':db[_0x2a2d33[_0xd210('0x21')]],'as':_0x2a2d33['as'],'attributes':_0x2a2d33[_0xd210('0x1d')],'include':_0x2a2d33[_0xd210('0x1f')]?_['map'](_0x2a2d33['include'],function(_0x323c17){return{'model':db[_0x323c17['model']],'as':_0x323c17['as'],'attributes':_0x323c17[_0xd210('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cadee){logger[_0xd210('0xc')](_0xd210('0x17'),_0xe89e28);logger[_0xd210('0xf')](_0xd210('0x17'),_0xe89e28,JSON[_0xd210('0x11')](_0x1cadee));_0x42ecc6(_0x1cadee);})[_0xd210('0x16')](function(_0x3c2ed9){logger[_0xd210('0x12')]('GetFreshdeskAccount',_0x3c2ed9[_0xd210('0x14')],_0xe89e28);_0x5b6b98(_0x214c4b['error'](0x1f4,_0x3c2ed9[_0xd210('0x14')]));});});};exports[_0xd210('0x22')]=function(_0x312773){var _0x12e2f8=this;return new Promise(function(_0x3bcb27,_0x219644){return db[_0xd210('0x18')]['find']({'raw':_0x312773[_0xd210('0x1a')]?_0x312773[_0xd210('0x1a')][_0xd210('0x1b')]===undefined?!![]:![]:!![],'where':_0x312773[_0xd210('0x1a')]?_0x312773['options'][_0xd210('0x1c')]||null:null,'attributes':_0x312773[_0xd210('0x1a')]?_0x312773[_0xd210('0x1a')][_0xd210('0x1d')]||null:null,'include':_0x312773[_0xd210('0x1a')]?_0x312773[_0xd210('0x1a')][_0xd210('0x1f')]?_[_0xd210('0x20')](_0x312773[_0xd210('0x1a')][_0xd210('0x1f')],function(_0x441839){return{'model':db[_0x441839[_0xd210('0x21')]],'as':_0x441839['as'],'attributes':_0x441839[_0xd210('0x1d')],'include':_0x441839['include']?_[_0xd210('0x20')](_0x441839[_0xd210('0x1f')],function(_0xe836cd){return{'model':db[_0xe836cd[_0xd210('0x21')]],'as':_0xe836cd['as'],'attributes':_0xe836cd[_0xd210('0x1d')],'include':_0xe836cd['include']?_[_0xd210('0x20')](_0xe836cd[_0xd210('0x1f')],function(_0x288b3f){return{'model':db[_0x288b3f[_0xd210('0x21')]],'as':_0x288b3f['as'],'attributes':_0x288b3f[_0xd210('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd210('0x23')](function(_0x39c123){logger[_0xd210('0xc')](_0xd210('0x22'),_0x312773);logger[_0xd210('0xf')]('ShowFreshdeskAccount',_0x312773,JSON[_0xd210('0x11')](_0x39c123));_0x3bcb27(_0x39c123);})[_0xd210('0x16')](function(_0x1cf592){logger[_0xd210('0x12')](_0xd210('0x22'),_0x1cf592[_0xd210('0x14')],_0x312773);_0x219644(_0x12e2f8['error'](0x1f4,_0x1cf592[_0xd210('0x14')]));});});}; \ No newline at end of file +var _0x6cba=['find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount'];(function(_0x4ec42,_0x36177b){var _0x385e11=function(_0x44e535){while(--_0x44e535){_0x4ec42['push'](_0x4ec42['shift']());}};_0x385e11(++_0x36177b);}(_0x6cba,0x173));var _0xa6cb=function(_0x5ced04,_0x7989a2){_0x5ced04=_0x5ced04-0x0;var _0x573411=_0x6cba[_0x5ced04];return _0x573411;};'use strict';var _=require(_0xa6cb('0x0'));var util=require(_0xa6cb('0x1'));var moment=require(_0xa6cb('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6cb('0x3'));var fs=require('fs');var Redis=require(_0xa6cb('0x4'));var db=require(_0xa6cb('0x5'))['db'];var utils=require(_0xa6cb('0x6'));var logger=require(_0xa6cb('0x7'))(_0xa6cb('0x8'));var config=require(_0xa6cb('0x9'));var jayson=require(_0xa6cb('0xa'));var client=jayson[_0xa6cb('0xb')][_0xa6cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51c14f,_0x4fa685,_0xcb0881){return new BPromise(function(_0x3169d6,_0x30a9a5){return client[_0xa6cb('0xd')](_0x51c14f,_0xcb0881)[_0xa6cb('0xe')](function(_0x300f67){logger[_0xa6cb('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fa685,_0xa6cb('0x10'));logger[_0xa6cb('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4fa685,'request\x20sent',JSON['stringify'](_0x300f67));if(_0x300f67[_0xa6cb('0x12')]){if(_0x300f67['error'][_0xa6cb('0x13')]===0x1f4){logger[_0xa6cb('0x12')](_0xa6cb('0x14'),_0x4fa685,_0x300f67[_0xa6cb('0x12')]['message']);return _0x30a9a5(_0x300f67[_0xa6cb('0x12')]['message']);}logger[_0xa6cb('0x12')](_0xa6cb('0x14'),_0x4fa685,_0x300f67[_0xa6cb('0x12')]['message']);return _0x3169d6(_0x300f67[_0xa6cb('0x12')][_0xa6cb('0x15')]);}else{logger[_0xa6cb('0xf')](_0xa6cb('0x14'),_0x4fa685,'request\x20sent');_0x3169d6(_0x300f67[_0xa6cb('0x16')][_0xa6cb('0x15')]);}})[_0xa6cb('0x17')](function(_0x968aa1){logger[_0xa6cb('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fa685,_0x968aa1);_0x30a9a5(_0x968aa1);});});}exports['GetFreshdeskAccount']=function(_0x25bfe3){var _0x112060=this;return new Promise(function(_0x566668,_0x28d46c){return db[_0xa6cb('0x18')][_0xa6cb('0x19')]({'raw':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x1c')]||null:null,'attributes':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3['options'][_0xa6cb('0x1d')]||null:null,'limit':_0x25bfe3[_0xa6cb('0x1a')]?_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x1e')]||null:null,'include':_0x25bfe3['options']?_0x25bfe3[_0xa6cb('0x1a')]['include']?_[_0xa6cb('0x1f')](_0x25bfe3[_0xa6cb('0x1a')][_0xa6cb('0x20')],function(_0x1abf9a){return{'model':db[_0x1abf9a[_0xa6cb('0x21')]],'as':_0x1abf9a['as'],'attributes':_0x1abf9a[_0xa6cb('0x1d')],'include':_0x1abf9a['include']?_[_0xa6cb('0x1f')](_0x1abf9a[_0xa6cb('0x20')],function(_0x13f945){return{'model':db[_0x13f945[_0xa6cb('0x21')]],'as':_0x13f945['as'],'attributes':_0x13f945['attributes'],'include':_0x13f945[_0xa6cb('0x20')]?_[_0xa6cb('0x1f')](_0x13f945[_0xa6cb('0x20')],function(_0x254e9a){return{'model':db[_0x254e9a[_0xa6cb('0x21')]],'as':_0x254e9a['as'],'attributes':_0x254e9a[_0xa6cb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa6cb('0xe')](function(_0x4992ff){logger[_0xa6cb('0xf')]('GetFreshdeskAccount',_0x25bfe3);logger['debug']('GetFreshdeskAccount',_0x25bfe3,JSON['stringify'](_0x4992ff));_0x566668(_0x4992ff);})['catch'](function(_0x180d21){logger['error'](_0xa6cb('0x22'),_0x180d21[_0xa6cb('0x15')],_0x25bfe3);_0x28d46c(_0x112060[_0xa6cb('0x12')](0x1f4,_0x180d21[_0xa6cb('0x15')]));});});};exports[_0xa6cb('0x23')]=function(_0xe0d73f){var _0x2b1742=this;return new Promise(function(_0x30478c,_0x12a12a){return db[_0xa6cb('0x18')][_0xa6cb('0x24')]({'raw':_0xe0d73f[_0xa6cb('0x1a')]?_0xe0d73f['options'][_0xa6cb('0x1b')]===undefined?!![]:![]:!![],'where':_0xe0d73f[_0xa6cb('0x1a')]?_0xe0d73f[_0xa6cb('0x1a')][_0xa6cb('0x1c')]||null:null,'attributes':_0xe0d73f['options']?_0xe0d73f['options'][_0xa6cb('0x1d')]||null:null,'include':_0xe0d73f[_0xa6cb('0x1a')]?_0xe0d73f[_0xa6cb('0x1a')][_0xa6cb('0x20')]?_[_0xa6cb('0x1f')](_0xe0d73f[_0xa6cb('0x1a')][_0xa6cb('0x20')],function(_0x23162c){return{'model':db[_0x23162c[_0xa6cb('0x21')]],'as':_0x23162c['as'],'attributes':_0x23162c[_0xa6cb('0x1d')],'include':_0x23162c['include']?_['map'](_0x23162c[_0xa6cb('0x20')],function(_0x30c282){return{'model':db[_0x30c282['model']],'as':_0x30c282['as'],'attributes':_0x30c282[_0xa6cb('0x1d')],'include':_0x30c282[_0xa6cb('0x20')]?_[_0xa6cb('0x1f')](_0x30c282[_0xa6cb('0x20')],function(_0x414f37){return{'model':db[_0x414f37[_0xa6cb('0x21')]],'as':_0x414f37['as'],'attributes':_0x414f37['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb86b){logger[_0xa6cb('0xf')](_0xa6cb('0x23'),_0xe0d73f);logger[_0xa6cb('0x11')](_0xa6cb('0x23'),_0xe0d73f,JSON['stringify'](_0x4eb86b));_0x30478c(_0x4eb86b);})['catch'](function(_0x1bab56){logger[_0xa6cb('0x12')]('ShowFreshdeskAccount',_0x1bab56[_0xa6cb('0x15')],_0xe0d73f);_0x12a12a(_0x2b1742[_0xa6cb('0x12')](0x1f4,_0x1bab56[_0xa6cb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a6c502f..c3f27bb 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 _0xb75e=['getFields','/:id/subjects','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x23494c,_0x26e3d1){var _0x80f8fb=function(_0x2bf333){while(--_0x2bf333){_0x23494c['push'](_0x23494c['shift']());}};_0x80f8fb(++_0x26e3d1);}(_0xb75e,0x113));var _0xeb75=function(_0x10b62c,_0x5df425){_0x10b62c=_0x10b62c-0x0;var _0x20d9a7=_0xb75e[_0x10b62c];return _0x20d9a7;};'use strict';var multer=require(_0xeb75('0x0'));var util=require('util');var path=require(_0xeb75('0x1'));var timeout=require(_0xeb75('0x2'));var express=require(_0xeb75('0x3'));var router=express[_0xeb75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeb75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb75('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xeb75('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb75('0x8')]);router[_0xeb75('0x7')](_0xeb75('0x9'),auth[_0xeb75('0xa')](),controller['show']);router[_0xeb75('0x7')]('/:id/fields',auth[_0xeb75('0xa')](),controller[_0xeb75('0xb')]);router[_0xeb75('0x7')](_0xeb75('0xc'),auth[_0xeb75('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xeb75('0xa')](),controller[_0xeb75('0xd')]);router[_0xeb75('0x7')]('/:id/tags',auth[_0xeb75('0xa')](),controller[_0xeb75('0xe')]);router[_0xeb75('0xf')]('/',auth[_0xeb75('0xa')](),controller[_0xeb75('0x10')]);router[_0xeb75('0xf')](_0xeb75('0x11'),auth[_0xeb75('0xa')](),controller['setTags']);router[_0xeb75('0x12')](_0xeb75('0x9'),auth[_0xeb75('0xa')](),controller[_0xeb75('0x13')]);router[_0xeb75('0x14')](_0xeb75('0x9'),auth['isAuthenticated'](),controller[_0xeb75('0x15')]);module['exports']=router; \ No newline at end of file +var _0x299c=['path','connect-timeout','Router','fs-extra','isAuthenticated','index','get','show','/:id/fields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x4f6baa,_0x2c1487){var _0x403ec5=function(_0x5dd0c3){while(--_0x5dd0c3){_0x4f6baa['push'](_0x4f6baa['shift']());}};_0x403ec5(++_0x2c1487);}(_0x299c,0xf0));var _0xc299=function(_0x374e88,_0x7966c6){_0x374e88=_0x374e88-0x0;var _0xa555ad=_0x299c[_0x374e88];return _0xa555ad;};'use strict';var multer=require(_0xc299('0x0'));var util=require(_0xc299('0x1'));var path=require(_0xc299('0x2'));var timeout=require(_0xc299('0x3'));var express=require('express');var router=express[_0xc299('0x4')]();var fs_extra=require(_0xc299('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[_0xc299('0x6')](),controller[_0xc299('0x7')]);router[_0xc299('0x8')]('/:id',auth[_0xc299('0x6')](),controller[_0xc299('0x9')]);router[_0xc299('0x8')](_0xc299('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0xc299('0x8')]('/:id/subjects',auth[_0xc299('0x6')](),controller[_0xc299('0xb')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xc299('0xc')]);router[_0xc299('0x8')](_0xc299('0xd'),auth[_0xc299('0x6')](),controller[_0xc299('0xe')]);router[_0xc299('0xf')]('/',auth[_0xc299('0x6')](),controller[_0xc299('0x10')]);router[_0xc299('0xf')](_0xc299('0xd'),auth[_0xc299('0x6')](),controller['setTags']);router[_0xc299('0x11')](_0xc299('0x12'),auth[_0xc299('0x6')](),controller[_0xc299('0x13')]);router[_0xc299('0x14')](_0xc299('0x12'),auth[_0xc299('0x6')](),controller[_0xc299('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 379bed7..952c6cf 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 _0xb50c=['STRING','sequelize'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xb50c,0x1dd));var _0xcb50=function(_0x4efaf7,_0x2d330a){_0x4efaf7=_0x4efaf7-0x0;var _0x3c6f04=_0xb50c[_0x4efaf7];return _0x3c6f04;};'use strict';var Sequelize=require(_0xcb50('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb50('0x1')]},'description':{'type':Sequelize[_0xcb50('0x1')]}}; \ No newline at end of file +var _0x24ca=['STRING','sequelize'];(function(_0x284d8f,_0x1afc9e){var _0x6acf64=function(_0x1f62fa){while(--_0x1f62fa){_0x284d8f['push'](_0x284d8f['shift']());}};_0x6acf64(++_0x1afc9e);}(_0x24ca,0x14b));var _0xa24c=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x24ca[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa24c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8b8180f..5aab4ce 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 _0x10c0=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','filters','find','create','body','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x10c0,0x140));var _0x010c=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0x10c0[_0x24cc72];return _0xd49f1e;};'use strict';var emlformat=require(_0x010c('0x0'));var rimraf=require(_0x010c('0x1'));var zipdir=require(_0x010c('0x2'));var jsonpatch=require(_0x010c('0x3'));var rp=require(_0x010c('0x4'));var moment=require(_0x010c('0x5'));var BPromise=require(_0x010c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x010c('0x7'));var sox=require(_0x010c('0x8'));var csv=require(_0x010c('0x9'));var ejs=require(_0x010c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x010c('0xb'));var crypto=require(_0x010c('0xc'));var jsforce=require(_0x010c('0xd'));var deskjs=require(_0x010c('0xe'));var toCsv=require(_0x010c('0x9'));var querystring=require(_0x010c('0xf'));var Papa=require(_0x010c('0x10'));var Redis=require('ioredis');var authService=require(_0x010c('0x11'));var qs=require(_0x010c('0x12'));var as=require(_0x010c('0x13'));var hardwareService=require(_0x010c('0x14'));var logger=require('../../config/logger')(_0x010c('0x15'));var utils=require(_0x010c('0x16'));var config=require(_0x010c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x010c('0x18'))['db'];function respondWithStatusCode(_0x340d92,_0x2b032d){_0x2b032d=_0x2b032d||0xcc;return function(_0x4d67fc){if(_0x4d67fc){return _0x340d92[_0x010c('0x19')](_0x2b032d);}return _0x340d92[_0x010c('0x1a')](_0x2b032d)[_0x010c('0x1b')]();};}function respondWithResult(_0x30b516,_0x18690d){_0x18690d=_0x18690d||0xc8;return function(_0x14cc77){if(_0x14cc77){return _0x30b516[_0x010c('0x1a')](_0x18690d)['json'](_0x14cc77);}};}function respondWithFilteredResult(_0x4d9859,_0x28a1e7){return function(_0x5a04c2){if(_0x5a04c2){var _0x581817=typeof _0x28a1e7[_0x010c('0x1c')]===_0x010c('0x1d')&&typeof _0x28a1e7[_0x010c('0x1e')]===_0x010c('0x1d');var _0x5d72d1=_0x5a04c2[_0x010c('0x1f')];var _0xa5fbac=_0x581817?0x0:_0x28a1e7[_0x010c('0x1c')];var _0x2db9c4=_0x581817?_0x5a04c2[_0x010c('0x1f')]:_0x28a1e7[_0x010c('0x1c')]+_0x28a1e7['limit'];var _0x4ecba7;if(_0x2db9c4>=_0x5d72d1){_0x2db9c4=_0x5d72d1;_0x4ecba7=0xc8;}else{_0x4ecba7=0xce;}_0x4d9859[_0x010c('0x1a')](_0x4ecba7);return _0x4d9859[_0x010c('0x20')]('Content-Range',_0xa5fbac+'-'+_0x2db9c4+'/'+_0x5d72d1)['json'](_0x5a04c2);}return null;};}function patchUpdates(_0xeb192e){return function(_0x3907ce){try{jsonpatch[_0x010c('0x21')](_0x3907ce,_0xeb192e,!![]);}catch(_0x5475ae){return BPromise[_0x010c('0x22')](_0x5475ae);}return _0x3907ce[_0x010c('0x23')]();};}function saveUpdates(_0xe6179,_0x23a65c){return function(_0x5afef8){if(_0x5afef8){return _0x5afef8[_0x010c('0x24')](_0xe6179)['then'](function(_0x5c0825){return _0x5c0825;});}return null;};}function removeEntity(_0x4ea5e6,_0x13faf0){return function(_0x34173f){if(_0x34173f){return _0x34173f[_0x010c('0x25')]()[_0x010c('0x26')](function(){_0x4ea5e6['status'](0xcc)[_0x010c('0x1b')]();});}};}function handleEntityNotFound(_0x4f24df,_0x499574){return function(_0x5a9e59){if(!_0x5a9e59){_0x4f24df[_0x010c('0x19')](0x194);}return _0x5a9e59;};}function handleError(_0x28b8ec,_0x1c1108){_0x1c1108=_0x1c1108||0x1f4;return function(_0x332ca8){logger[_0x010c('0x27')](_0x332ca8[_0x010c('0x28')]);if(_0x332ca8[_0x010c('0x29')]){delete _0x332ca8['name'];}_0x28b8ec[_0x010c('0x1a')](_0x1c1108)[_0x010c('0x2a')](_0x332ca8);};}exports[_0x010c('0x2b')]=function(_0x342302,_0x2237c1){var _0x60f929={},_0x404969={},_0x31ecef={'count':0x0,'rows':[]};var _0x5af882=_[_0x010c('0x2c')](db[_0x010c('0x2d')][_0x010c('0x2e')],function(_0x5ac1d8){return{'name':_0x5ac1d8[_0x010c('0x2f')],'type':_0x5ac1d8['type'][_0x010c('0x30')]};});_0x404969['model']=_['map'](_0x5af882,_0x010c('0x29'));_0x404969[_0x010c('0x31')]=_[_0x010c('0x32')](_0x342302[_0x010c('0x31')]);_0x404969['filters']=_[_0x010c('0x33')](_0x404969[_0x010c('0x34')],_0x404969[_0x010c('0x31')]);_0x60f929[_0x010c('0x35')]=_[_0x010c('0x33')](_0x404969['model'],qs[_0x010c('0x36')](_0x342302['query'][_0x010c('0x36')]));_0x60f929[_0x010c('0x35')]=_0x60f929[_0x010c('0x35')][_0x010c('0x37')]?_0x60f929[_0x010c('0x35')]:_0x404969[_0x010c('0x34')];if(!_0x342302[_0x010c('0x31')][_0x010c('0x38')](_0x010c('0x39'))){_0x60f929[_0x010c('0x1e')]=qs['limit'](_0x342302[_0x010c('0x31')][_0x010c('0x1e')]);_0x60f929[_0x010c('0x1c')]=qs[_0x010c('0x1c')](_0x342302[_0x010c('0x31')][_0x010c('0x1c')]);}_0x60f929['order']=qs['sort'](_0x342302['query'][_0x010c('0x3a')]);_0x60f929[_0x010c('0x3b')]=qs['filters'](_[_0x010c('0x3c')](_0x342302['query'],_0x404969['filters']),_0x5af882);if(_0x342302['query'][_0x010c('0x3d')]){_0x60f929[_0x010c('0x3b')]=_[_0x010c('0x3e')](_0x60f929['where'],{'$or':_['map'](_0x5af882,function(_0x485afc){if(_0x485afc[_0x010c('0x3f')]!==_0x010c('0x40')){var _0x231d7a={};_0x231d7a[_0x485afc[_0x010c('0x29')]]={'$like':'%'+_0x342302['query'][_0x010c('0x3d')]+'%'};return _0x231d7a;}})});}_0x60f929=_[_0x010c('0x3e')]({},_0x60f929,_0x342302[_0x010c('0x41')]);var _0x3b9c97={'where':_0x60f929[_0x010c('0x3b')]};return db['FreshdeskConfiguration'][_0x010c('0x1f')](_0x3b9c97)[_0x010c('0x26')](function(_0x4e304b){_0x31ecef[_0x010c('0x1f')]=_0x4e304b;if(_0x342302[_0x010c('0x31')][_0x010c('0x42')]){_0x60f929[_0x010c('0x43')]=[{'all':!![]}];}return db[_0x010c('0x2d')]['findAll'](_0x60f929);})[_0x010c('0x26')](function(_0x3621be){_0x31ecef[_0x010c('0x44')]=_0x3621be;return _0x31ecef;})[_0x010c('0x26')](respondWithFilteredResult(_0x2237c1,_0x60f929))[_0x010c('0x45')](handleError(_0x2237c1,null));};exports['show']=function(_0x48da78,_0x41b6d5){var _0xce82c7={'raw':![],'where':{'id':_0x48da78[_0x010c('0x46')]['id']}},_0x2ee348={};_0x2ee348[_0x010c('0x34')]=_[_0x010c('0x32')](db[_0x010c('0x2d')]['rawAttributes']);_0x2ee348[_0x010c('0x31')]=_['keys'](_0x48da78[_0x010c('0x31')]);_0x2ee348[_0x010c('0x47')]=_[_0x010c('0x33')](_0x2ee348['model'],_0x2ee348[_0x010c('0x31')]);_0xce82c7[_0x010c('0x35')]=_[_0x010c('0x33')](_0x2ee348[_0x010c('0x34')],qs['fields'](_0x48da78[_0x010c('0x31')]['fields']));_0xce82c7['attributes']=_0xce82c7[_0x010c('0x35')][_0x010c('0x37')]?_0xce82c7[_0x010c('0x35')]:_0x2ee348['model'];if(_0x48da78[_0x010c('0x31')]['includeAll']){_0xce82c7['include']=[{'all':!![]}];}_0xce82c7=_['merge']({},_0xce82c7,_0x48da78[_0x010c('0x41')]);return db[_0x010c('0x2d')][_0x010c('0x48')](_0xce82c7)[_0x010c('0x26')](handleEntityNotFound(_0x41b6d5,null))['then'](respondWithResult(_0x41b6d5,null))[_0x010c('0x45')](handleError(_0x41b6d5,null));};exports[_0x010c('0x49')]=function(_0x1b2fe5,_0x363012){return db['FreshdeskConfiguration']['create'](_0x1b2fe5[_0x010c('0x4a')],{})['then'](respondWithResult(_0x363012,0xc9))[_0x010c('0x45')](handleError(_0x363012,null));};exports[_0x010c('0x24')]=function(_0x1b2ca0,_0x520fa3){if(_0x1b2ca0[_0x010c('0x4a')]['id']){delete _0x1b2ca0[_0x010c('0x4a')]['id'];}return db[_0x010c('0x2d')][_0x010c('0x48')]({'where':{'id':_0x1b2ca0[_0x010c('0x46')]['id']}})['then'](handleEntityNotFound(_0x520fa3,null))[_0x010c('0x26')](saveUpdates(_0x1b2ca0[_0x010c('0x4a')],null))[_0x010c('0x26')](respondWithResult(_0x520fa3,null))[_0x010c('0x45')](handleError(_0x520fa3,null));};exports[_0x010c('0x25')]=function(_0x5f21d4,_0xa42fa2){return db[_0x010c('0x2d')][_0x010c('0x48')]({'where':{'id':_0x5f21d4[_0x010c('0x46')]['id']}})[_0x010c('0x26')](handleEntityNotFound(_0xa42fa2,null))[_0x010c('0x26')](removeEntity(_0xa42fa2,null))[_0x010c('0x45')](handleError(_0xa42fa2,null));};exports[_0x010c('0x4b')]=function(_0x5f190b,_0x54c8ab,_0x57f831){var _0xf7fd30={};var _0x508e5c={};var _0x3dd438;var _0xd5e483;return db[_0x010c('0x2d')][_0x010c('0x4c')]({'where':{'id':_0x5f190b[_0x010c('0x46')]['id']}})[_0x010c('0x26')](handleEntityNotFound(_0x54c8ab,null))[_0x010c('0x26')](function(_0x847312){if(_0x847312){_0x3dd438=_0x847312;_0x508e5c[_0x010c('0x34')]=_[_0x010c('0x32')](db[_0x010c('0x4d')][_0x010c('0x2e')]);_0x508e5c[_0x010c('0x31')]=_[_0x010c('0x32')](_0x5f190b[_0x010c('0x31')]);_0x508e5c[_0x010c('0x47')]=_[_0x010c('0x33')](_0x508e5c[_0x010c('0x34')],_0x508e5c[_0x010c('0x31')]);_0xf7fd30[_0x010c('0x35')]=_[_0x010c('0x33')](_0x508e5c['model'],qs[_0x010c('0x36')](_0x5f190b[_0x010c('0x31')][_0x010c('0x36')]));_0xf7fd30['attributes']=_0xf7fd30[_0x010c('0x35')]['length']?_0xf7fd30[_0x010c('0x35')]:_0x508e5c[_0x010c('0x34')];_0xf7fd30[_0x010c('0x4e')]=qs[_0x010c('0x3a')](_0x5f190b['query'][_0x010c('0x3a')]);_0xf7fd30[_0x010c('0x3b')]=qs[_0x010c('0x47')](_[_0x010c('0x3c')](_0x5f190b[_0x010c('0x31')],_0x508e5c[_0x010c('0x47')]));if(_0x5f190b[_0x010c('0x31')][_0x010c('0x3d')]){_0xf7fd30[_0x010c('0x3b')]=_[_0x010c('0x3e')](_0xf7fd30[_0x010c('0x3b')],{'$or':_[_0x010c('0x2c')](_0xf7fd30['attributes'],function(_0x5d1931){var _0x36be61={};_0x36be61[_0x5d1931]={'$like':'%'+_0x5f190b['query'][_0x010c('0x3d')]+'%'};return _0x36be61;})});}_0xf7fd30=_[_0x010c('0x3e')]({},_0xf7fd30,_0x5f190b[_0x010c('0x41')]);return _0x3dd438[_0x010c('0x4b')](_0xf7fd30);}})['then'](function(_0x5d5e3a){if(_0x5d5e3a){_0xd5e483=_0x5d5e3a[_0x010c('0x37')];if(!_0x5f190b['query'][_0x010c('0x38')](_0x010c('0x39'))){_0xf7fd30[_0x010c('0x1e')]=qs[_0x010c('0x1e')](_0x5f190b[_0x010c('0x31')][_0x010c('0x1e')]);_0xf7fd30['offset']=qs[_0x010c('0x1c')](_0x5f190b[_0x010c('0x31')][_0x010c('0x1c')]);}return _0x3dd438['getFields'](_0xf7fd30);}})['then'](function(_0x2eafcb){if(_0x2eafcb){return _0x2eafcb?{'count':_0xd5e483,'rows':_0x2eafcb}:null;}})[_0x010c('0x26')](respondWithResult(_0x54c8ab,null))['catch'](handleError(_0x54c8ab,null));};exports[_0x010c('0x4f')]=function(_0x2e8d9f,_0x1055e7,_0x23c677){var _0x3e2519={};var _0x4f4d53={};var _0x5d2662;var _0x2feee0;return db['FreshdeskConfiguration'][_0x010c('0x4c')]({'where':{'id':_0x2e8d9f[_0x010c('0x46')]['id']}})[_0x010c('0x26')](handleEntityNotFound(_0x1055e7,null))[_0x010c('0x26')](function(_0x252130){if(_0x252130){_0x5d2662=_0x252130;_0x4f4d53[_0x010c('0x34')]=_[_0x010c('0x32')](db[_0x010c('0x4d')][_0x010c('0x2e')]);_0x4f4d53['query']=_[_0x010c('0x32')](_0x2e8d9f[_0x010c('0x31')]);_0x4f4d53['filters']=_[_0x010c('0x33')](_0x4f4d53['model'],_0x4f4d53['query']);_0x3e2519[_0x010c('0x35')]=_['intersection'](_0x4f4d53[_0x010c('0x34')],qs[_0x010c('0x36')](_0x2e8d9f[_0x010c('0x31')]['fields']));_0x3e2519[_0x010c('0x35')]=_0x3e2519[_0x010c('0x35')][_0x010c('0x37')]?_0x3e2519[_0x010c('0x35')]:_0x4f4d53[_0x010c('0x34')];_0x3e2519[_0x010c('0x4e')]=qs[_0x010c('0x3a')](_0x2e8d9f[_0x010c('0x31')][_0x010c('0x3a')]);_0x3e2519[_0x010c('0x3b')]=qs[_0x010c('0x47')](_['pick'](_0x2e8d9f[_0x010c('0x31')],_0x4f4d53[_0x010c('0x47')]));if(_0x2e8d9f[_0x010c('0x31')][_0x010c('0x3d')]){_0x3e2519[_0x010c('0x3b')]=_[_0x010c('0x3e')](_0x3e2519[_0x010c('0x3b')],{'$or':_[_0x010c('0x2c')](_0x3e2519[_0x010c('0x35')],function(_0x3ef441){var _0x3da4f0={};_0x3da4f0[_0x3ef441]={'$like':'%'+_0x2e8d9f[_0x010c('0x31')]['filter']+'%'};return _0x3da4f0;})});}_0x3e2519=_[_0x010c('0x3e')]({},_0x3e2519,_0x2e8d9f[_0x010c('0x41')]);return _0x5d2662[_0x010c('0x4f')](_0x3e2519);}})[_0x010c('0x26')](function(_0x2ab59e){if(_0x2ab59e){_0x2feee0=_0x2ab59e[_0x010c('0x37')];if(!_0x2e8d9f[_0x010c('0x31')]['hasOwnProperty']('nolimit')){_0x3e2519[_0x010c('0x1e')]=qs[_0x010c('0x1e')](_0x2e8d9f[_0x010c('0x31')][_0x010c('0x1e')]);_0x3e2519[_0x010c('0x1c')]=qs[_0x010c('0x1c')](_0x2e8d9f['query'][_0x010c('0x1c')]);}return _0x5d2662[_0x010c('0x4f')](_0x3e2519);}})[_0x010c('0x26')](function(_0x2747ee){if(_0x2747ee){return _0x2747ee?{'count':_0x2feee0,'rows':_0x2747ee}:null;}})[_0x010c('0x26')](respondWithResult(_0x1055e7,null))[_0x010c('0x45')](handleError(_0x1055e7,null));};exports[_0x010c('0x50')]=function(_0xbcd10,_0x7a1fd9,_0x577b06){var _0x22f646={};var _0x4d4d1a={};var _0x576cb3;var _0x5c8e64;return db[_0x010c('0x2d')][_0x010c('0x4c')]({'where':{'id':_0xbcd10[_0x010c('0x46')]['id']}})[_0x010c('0x26')](handleEntityNotFound(_0x7a1fd9,null))['then'](function(_0x239ac9){if(_0x239ac9){_0x576cb3=_0x239ac9;_0x4d4d1a[_0x010c('0x34')]=_['keys'](db['FreshdeskField'][_0x010c('0x2e')]);_0x4d4d1a[_0x010c('0x31')]=_[_0x010c('0x32')](_0xbcd10[_0x010c('0x31')]);_0x4d4d1a[_0x010c('0x47')]=_[_0x010c('0x33')](_0x4d4d1a[_0x010c('0x34')],_0x4d4d1a[_0x010c('0x31')]);_0x22f646[_0x010c('0x35')]=_[_0x010c('0x33')](_0x4d4d1a[_0x010c('0x34')],qs['fields'](_0xbcd10['query'][_0x010c('0x36')]));_0x22f646['attributes']=_0x22f646[_0x010c('0x35')]['length']?_0x22f646[_0x010c('0x35')]:_0x4d4d1a['model'];_0x22f646[_0x010c('0x4e')]=qs[_0x010c('0x3a')](_0xbcd10[_0x010c('0x31')]['sort']);_0x22f646['where']=qs[_0x010c('0x47')](_['pick'](_0xbcd10[_0x010c('0x31')],_0x4d4d1a[_0x010c('0x47')]));if(_0xbcd10[_0x010c('0x31')][_0x010c('0x3d')]){_0x22f646[_0x010c('0x3b')]=_[_0x010c('0x3e')](_0x22f646[_0x010c('0x3b')],{'$or':_[_0x010c('0x2c')](_0x22f646[_0x010c('0x35')],function(_0x58dda6){var _0x409b9b={};_0x409b9b[_0x58dda6]={'$like':'%'+_0xbcd10[_0x010c('0x31')][_0x010c('0x3d')]+'%'};return _0x409b9b;})});}_0x22f646=_[_0x010c('0x3e')]({},_0x22f646,_0xbcd10[_0x010c('0x41')]);return _0x576cb3[_0x010c('0x50')](_0x22f646);}})[_0x010c('0x26')](function(_0x17813a){if(_0x17813a){_0x5c8e64=_0x17813a['length'];if(!_0xbcd10['query']['hasOwnProperty']('nolimit')){_0x22f646[_0x010c('0x1e')]=qs['limit'](_0xbcd10[_0x010c('0x31')][_0x010c('0x1e')]);_0x22f646[_0x010c('0x1c')]=qs[_0x010c('0x1c')](_0xbcd10['query'][_0x010c('0x1c')]);}return _0x576cb3[_0x010c('0x50')](_0x22f646);}})[_0x010c('0x26')](function(_0x21738f){if(_0x21738f){return _0x21738f?{'count':_0x5c8e64,'rows':_0x21738f}:null;}})['then'](respondWithResult(_0x7a1fd9,null))[_0x010c('0x45')](handleError(_0x7a1fd9,null));};exports[_0x010c('0x51')]=function(_0x448334,_0x26349d,_0x16c6d4){var _0x2ab96c={};var _0xdea5c2={};var _0x14530e;var _0x4661d1;return db[_0x010c('0x2d')]['findOne']({'where':{'id':_0x448334[_0x010c('0x46')]['id']}})[_0x010c('0x26')](handleEntityNotFound(_0x26349d,null))[_0x010c('0x26')](function(_0x3ee3a0){if(_0x3ee3a0){_0x14530e=_0x3ee3a0;_0xdea5c2['model']=_[_0x010c('0x32')](db[_0x010c('0x52')]['rawAttributes']);_0xdea5c2['query']=_[_0x010c('0x32')](_0x448334[_0x010c('0x31')]);_0xdea5c2[_0x010c('0x47')]=_[_0x010c('0x33')](_0xdea5c2[_0x010c('0x34')],_0xdea5c2[_0x010c('0x31')]);_0x2ab96c[_0x010c('0x35')]=_[_0x010c('0x33')](_0xdea5c2[_0x010c('0x34')],qs['fields'](_0x448334[_0x010c('0x31')][_0x010c('0x36')]));_0x2ab96c['attributes']=_0x2ab96c[_0x010c('0x35')][_0x010c('0x37')]?_0x2ab96c[_0x010c('0x35')]:_0xdea5c2[_0x010c('0x34')];_0x2ab96c[_0x010c('0x4e')]=qs[_0x010c('0x3a')](_0x448334[_0x010c('0x31')][_0x010c('0x3a')]);_0x2ab96c[_0x010c('0x3b')]=qs[_0x010c('0x47')](_[_0x010c('0x3c')](_0x448334[_0x010c('0x31')],_0xdea5c2[_0x010c('0x47')]));if(_0x448334['query'][_0x010c('0x3d')]){_0x2ab96c[_0x010c('0x3b')]=_['merge'](_0x2ab96c[_0x010c('0x3b')],{'$or':_['map'](_0x2ab96c[_0x010c('0x35')],function(_0x86eae1){var _0x1b9447={};_0x1b9447[_0x86eae1]={'$like':'%'+_0x448334[_0x010c('0x31')][_0x010c('0x3d')]+'%'};return _0x1b9447;})});}_0x2ab96c=_[_0x010c('0x3e')]({},_0x2ab96c,_0x448334['options']);return _0x14530e['getTags'](_0x2ab96c);}})['then'](function(_0x7a2201){if(_0x7a2201){_0x4661d1=_0x7a2201[_0x010c('0x37')];if(!_0x448334[_0x010c('0x31')][_0x010c('0x38')](_0x010c('0x39'))){_0x2ab96c[_0x010c('0x1e')]=qs[_0x010c('0x1e')](_0x448334['query'][_0x010c('0x1e')]);_0x2ab96c[_0x010c('0x1c')]=qs[_0x010c('0x1c')](_0x448334['query'][_0x010c('0x1c')]);}return _0x14530e[_0x010c('0x51')](_0x2ab96c);}})['then'](function(_0x2681a8){if(_0x2681a8){return _0x2681a8?{'count':_0x4661d1,'rows':_0x2681a8}:null;}})[_0x010c('0x26')](respondWithResult(_0x26349d,null))['catch'](handleError(_0x26349d,null));};exports[_0x010c('0x53')]=function(_0x1d4598,_0x1486bc,_0x1b38bf){if(_0x1d4598['body']['id']){delete _0x1d4598[_0x010c('0x4a')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1d4598[_0x010c('0x46')]['id']}})[_0x010c('0x26')](handleEntityNotFound(_0x1486bc,null))[_0x010c('0x26')](function(_0x30f4b4){if(_0x30f4b4){return _0x30f4b4[_0x010c('0x53')](_0x1d4598['body'][_0x010c('0x54')]||[]);}return null;})[_0x010c('0x26')](respondWithResult(_0x1486bc,null))[_0x010c('0x45')](handleError(_0x1486bc,null));}; \ No newline at end of file +var _0x33b4=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','update','body','getFields','FreshdeskField','sort','pick','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','then','destroy','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters'];(function(_0xe38dbe,_0x2648a7){var _0x536f04=function(_0x2867be){while(--_0x2867be){_0xe38dbe['push'](_0xe38dbe['shift']());}};_0x536f04(++_0x2648a7);}(_0x33b4,0xbb));var _0x433b=function(_0x4672fe,_0xc2cd1a){_0x4672fe=_0x4672fe-0x0;var _0x3545eb=_0x33b4[_0x4672fe];return _0x3545eb;};'use strict';var emlformat=require(_0x433b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x433b('0x1'));var jsonpatch=require(_0x433b('0x2'));var rp=require('request-promise');var moment=require(_0x433b('0x3'));var BPromise=require(_0x433b('0x4'));var Mustache=require('mustache');var util=require(_0x433b('0x5'));var path=require(_0x433b('0x6'));var sox=require(_0x433b('0x7'));var csv=require(_0x433b('0x8'));var ejs=require(_0x433b('0x9'));var fs=require('fs');var fs_extra=require(_0x433b('0xa'));var _=require('lodash');var squel=require(_0x433b('0xb'));var crypto=require(_0x433b('0xc'));var jsforce=require(_0x433b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x433b('0xe'));var Papa=require(_0x433b('0xf'));var Redis=require('ioredis');var authService=require(_0x433b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x433b('0x11'));var logger=require('../../config/logger')(_0x433b('0x12'));var utils=require(_0x433b('0x13'));var config=require(_0x433b('0x14'));var licenseUtil=require(_0x433b('0x15'));var db=require(_0x433b('0x16'))['db'];function respondWithStatusCode(_0x49f338,_0x44323f){_0x44323f=_0x44323f||0xcc;return function(_0x1b5b38){if(_0x1b5b38){return _0x49f338['sendStatus'](_0x44323f);}return _0x49f338['status'](_0x44323f)[_0x433b('0x17')]();};}function respondWithResult(_0x42522d,_0x594586){_0x594586=_0x594586||0xc8;return function(_0x2f72b4){if(_0x2f72b4){return _0x42522d[_0x433b('0x18')](_0x594586)['json'](_0x2f72b4);}};}function respondWithFilteredResult(_0x333117,_0x48bcb3){return function(_0x5eeaeb){if(_0x5eeaeb){var _0x3f5b74=typeof _0x48bcb3[_0x433b('0x19')]===_0x433b('0x1a')&&typeof _0x48bcb3[_0x433b('0x1b')]===_0x433b('0x1a');var _0x1955a0=_0x5eeaeb[_0x433b('0x1c')];var _0x36d76d=_0x3f5b74?0x0:_0x48bcb3[_0x433b('0x19')];var _0x3c778f=_0x3f5b74?_0x5eeaeb['count']:_0x48bcb3['offset']+_0x48bcb3['limit'];var _0x1d8a2d;if(_0x3c778f>=_0x1955a0){_0x3c778f=_0x1955a0;_0x1d8a2d=0xc8;}else{_0x1d8a2d=0xce;}_0x333117['status'](_0x1d8a2d);return _0x333117['set'](_0x433b('0x1d'),_0x36d76d+'-'+_0x3c778f+'/'+_0x1955a0)[_0x433b('0x1e')](_0x5eeaeb);}return null;};}function patchUpdates(_0x32e26a){return function(_0x26a2c2){try{jsonpatch[_0x433b('0x1f')](_0x26a2c2,_0x32e26a,!![]);}catch(_0x981bc4){return BPromise['reject'](_0x981bc4);}return _0x26a2c2['save']();};}function saveUpdates(_0x2e4161,_0x37f2c3){return function(_0x3c3dbb){if(_0x3c3dbb){return _0x3c3dbb['update'](_0x2e4161)[_0x433b('0x20')](function(_0xcdbf4f){return _0xcdbf4f;});}return null;};}function removeEntity(_0x489845,_0x40f63d){return function(_0x586339){if(_0x586339){return _0x586339[_0x433b('0x21')]()[_0x433b('0x20')](function(){_0x489845[_0x433b('0x18')](0xcc)[_0x433b('0x17')]();});}};}function handleEntityNotFound(_0x393210,_0x58497b){return function(_0x55b441){if(!_0x55b441){_0x393210[_0x433b('0x22')](0x194);}return _0x55b441;};}function handleError(_0x4919f8,_0x84e7e9){_0x84e7e9=_0x84e7e9||0x1f4;return function(_0x5afde0){logger[_0x433b('0x23')](_0x5afde0['stack']);if(_0x5afde0['name']){delete _0x5afde0[_0x433b('0x24')];}_0x4919f8[_0x433b('0x18')](_0x84e7e9)[_0x433b('0x25')](_0x5afde0);};}exports[_0x433b('0x26')]=function(_0x11eb9b,_0x5c0ef2){var _0x336729={},_0x5998a3={},_0x5b4b8c={'count':0x0,'rows':[]};var _0x50ba54=_[_0x433b('0x27')](db[_0x433b('0x28')][_0x433b('0x29')],function(_0x312e6b){return{'name':_0x312e6b[_0x433b('0x2a')],'type':_0x312e6b[_0x433b('0x2b')]['key']};});_0x5998a3['model']=_[_0x433b('0x27')](_0x50ba54,_0x433b('0x24'));_0x5998a3[_0x433b('0x2c')]=_[_0x433b('0x2d')](_0x11eb9b[_0x433b('0x2c')]);_0x5998a3['filters']=_[_0x433b('0x2e')](_0x5998a3[_0x433b('0x2f')],_0x5998a3[_0x433b('0x2c')]);_0x336729['attributes']=_['intersection'](_0x5998a3[_0x433b('0x2f')],qs[_0x433b('0x30')](_0x11eb9b[_0x433b('0x2c')][_0x433b('0x30')]));_0x336729['attributes']=_0x336729[_0x433b('0x31')][_0x433b('0x32')]?_0x336729[_0x433b('0x31')]:_0x5998a3[_0x433b('0x2f')];if(!_0x11eb9b[_0x433b('0x2c')][_0x433b('0x33')](_0x433b('0x34'))){_0x336729['limit']=qs[_0x433b('0x1b')](_0x11eb9b['query']['limit']);_0x336729['offset']=qs[_0x433b('0x19')](_0x11eb9b[_0x433b('0x2c')][_0x433b('0x19')]);}_0x336729[_0x433b('0x35')]=qs['sort'](_0x11eb9b[_0x433b('0x2c')]['sort']);_0x336729[_0x433b('0x36')]=qs[_0x433b('0x37')](_['pick'](_0x11eb9b[_0x433b('0x2c')],_0x5998a3[_0x433b('0x37')]),_0x50ba54);if(_0x11eb9b[_0x433b('0x2c')][_0x433b('0x38')]){_0x336729['where']=_[_0x433b('0x39')](_0x336729[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x50ba54,function(_0x5420b3){if(_0x5420b3['type']!==_0x433b('0x3a')){var _0x21a5ad={};_0x21a5ad[_0x5420b3[_0x433b('0x24')]]={'$like':'%'+_0x11eb9b[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x21a5ad;}})});}_0x336729=_[_0x433b('0x39')]({},_0x336729,_0x11eb9b[_0x433b('0x3b')]);var _0x16884e={'where':_0x336729['where']};return db['FreshdeskConfiguration']['count'](_0x16884e)[_0x433b('0x20')](function(_0x3d8506){_0x5b4b8c[_0x433b('0x1c')]=_0x3d8506;if(_0x11eb9b[_0x433b('0x2c')][_0x433b('0x3c')]){_0x336729[_0x433b('0x3d')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x433b('0x3e')](_0x336729);})[_0x433b('0x20')](function(_0x55f2ac){_0x5b4b8c['rows']=_0x55f2ac;return _0x5b4b8c;})['then'](respondWithFilteredResult(_0x5c0ef2,_0x336729))[_0x433b('0x3f')](handleError(_0x5c0ef2,null));};exports[_0x433b('0x40')]=function(_0x4f8ecc,_0xb80579){var _0xafb883={'raw':![],'where':{'id':_0x4f8ecc[_0x433b('0x41')]['id']}},_0x41fb2c={};_0x41fb2c[_0x433b('0x2f')]=_[_0x433b('0x2d')](db[_0x433b('0x28')]['rawAttributes']);_0x41fb2c[_0x433b('0x2c')]=_[_0x433b('0x2d')](_0x4f8ecc[_0x433b('0x2c')]);_0x41fb2c[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x41fb2c[_0x433b('0x2f')],_0x41fb2c[_0x433b('0x2c')]);_0xafb883[_0x433b('0x31')]=_[_0x433b('0x2e')](_0x41fb2c[_0x433b('0x2f')],qs[_0x433b('0x30')](_0x4f8ecc['query']['fields']));_0xafb883[_0x433b('0x31')]=_0xafb883[_0x433b('0x31')]['length']?_0xafb883[_0x433b('0x31')]:_0x41fb2c[_0x433b('0x2f')];if(_0x4f8ecc['query'][_0x433b('0x3c')]){_0xafb883[_0x433b('0x3d')]=[{'all':!![]}];}_0xafb883=_[_0x433b('0x39')]({},_0xafb883,_0x4f8ecc[_0x433b('0x3b')]);return db['FreshdeskConfiguration'][_0x433b('0x42')](_0xafb883)[_0x433b('0x20')](handleEntityNotFound(_0xb80579,null))[_0x433b('0x20')](respondWithResult(_0xb80579,null))[_0x433b('0x3f')](handleError(_0xb80579,null));};exports['create']=function(_0x46fee5,_0x56acfd){return db[_0x433b('0x28')][_0x433b('0x43')](_0x46fee5['body'],{})[_0x433b('0x20')](respondWithResult(_0x56acfd,0xc9))[_0x433b('0x3f')](handleError(_0x56acfd,null));};exports[_0x433b('0x44')]=function(_0x29bcf5,_0xa9e6a){if(_0x29bcf5[_0x433b('0x45')]['id']){delete _0x29bcf5[_0x433b('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x29bcf5[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0xa9e6a,null))[_0x433b('0x20')](saveUpdates(_0x29bcf5[_0x433b('0x45')],null))[_0x433b('0x20')](respondWithResult(_0xa9e6a,null))[_0x433b('0x3f')](handleError(_0xa9e6a,null));};exports[_0x433b('0x21')]=function(_0x2dfd30,_0x5745ae){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2dfd30[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x5745ae,null))[_0x433b('0x20')](removeEntity(_0x5745ae,null))[_0x433b('0x3f')](handleError(_0x5745ae,null));};exports[_0x433b('0x46')]=function(_0x28a68e,_0x4aed7d,_0x14a204){var _0x868f2e={};var _0x3197a1={};var _0x37b692;var _0x4ed4ed;return db[_0x433b('0x28')]['findOne']({'where':{'id':_0x28a68e[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x4aed7d,null))[_0x433b('0x20')](function(_0x28d36e){if(_0x28d36e){_0x37b692=_0x28d36e;_0x3197a1[_0x433b('0x2f')]=_[_0x433b('0x2d')](db[_0x433b('0x47')][_0x433b('0x29')]);_0x3197a1['query']=_['keys'](_0x28a68e[_0x433b('0x2c')]);_0x3197a1[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x3197a1[_0x433b('0x2f')],_0x3197a1[_0x433b('0x2c')]);_0x868f2e[_0x433b('0x31')]=_[_0x433b('0x2e')](_0x3197a1['model'],qs['fields'](_0x28a68e['query']['fields']));_0x868f2e[_0x433b('0x31')]=_0x868f2e[_0x433b('0x31')]['length']?_0x868f2e[_0x433b('0x31')]:_0x3197a1[_0x433b('0x2f')];_0x868f2e['order']=qs[_0x433b('0x48')](_0x28a68e['query'][_0x433b('0x48')]);_0x868f2e['where']=qs['filters'](_[_0x433b('0x49')](_0x28a68e[_0x433b('0x2c')],_0x3197a1[_0x433b('0x37')]));if(_0x28a68e['query']['filter']){_0x868f2e[_0x433b('0x36')]=_['merge'](_0x868f2e[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x868f2e[_0x433b('0x31')],function(_0x34cfa7){var _0x4bcea9={};_0x4bcea9[_0x34cfa7]={'$like':'%'+_0x28a68e[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x4bcea9;})});}_0x868f2e=_[_0x433b('0x39')]({},_0x868f2e,_0x28a68e[_0x433b('0x3b')]);return _0x37b692[_0x433b('0x46')](_0x868f2e);}})[_0x433b('0x20')](function(_0x5d8e06){if(_0x5d8e06){_0x4ed4ed=_0x5d8e06['length'];if(!_0x28a68e['query'][_0x433b('0x33')](_0x433b('0x34'))){_0x868f2e[_0x433b('0x1b')]=qs['limit'](_0x28a68e[_0x433b('0x2c')][_0x433b('0x1b')]);_0x868f2e[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x28a68e['query'][_0x433b('0x19')]);}return _0x37b692[_0x433b('0x46')](_0x868f2e);}})[_0x433b('0x20')](function(_0x8fcda7){if(_0x8fcda7){return _0x8fcda7?{'count':_0x4ed4ed,'rows':_0x8fcda7}:null;}})['then'](respondWithResult(_0x4aed7d,null))[_0x433b('0x3f')](handleError(_0x4aed7d,null));};exports['getSubjects']=function(_0x1deb69,_0x5dff9f,_0x36321a){var _0x3c01a8={};var _0x2e6ce3={};var _0x58d208;var _0x3fb8af;return db[_0x433b('0x28')]['findOne']({'where':{'id':_0x1deb69[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x5dff9f,null))[_0x433b('0x20')](function(_0x283148){if(_0x283148){_0x58d208=_0x283148;_0x2e6ce3['model']=_[_0x433b('0x2d')](db[_0x433b('0x47')][_0x433b('0x29')]);_0x2e6ce3['query']=_[_0x433b('0x2d')](_0x1deb69['query']);_0x2e6ce3[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x2e6ce3['model'],_0x2e6ce3['query']);_0x3c01a8['attributes']=_[_0x433b('0x2e')](_0x2e6ce3[_0x433b('0x2f')],qs['fields'](_0x1deb69[_0x433b('0x2c')][_0x433b('0x30')]));_0x3c01a8[_0x433b('0x31')]=_0x3c01a8['attributes'][_0x433b('0x32')]?_0x3c01a8[_0x433b('0x31')]:_0x2e6ce3['model'];_0x3c01a8[_0x433b('0x35')]=qs[_0x433b('0x48')](_0x1deb69['query'][_0x433b('0x48')]);_0x3c01a8[_0x433b('0x36')]=qs['filters'](_[_0x433b('0x49')](_0x1deb69['query'],_0x2e6ce3[_0x433b('0x37')]));if(_0x1deb69[_0x433b('0x2c')][_0x433b('0x38')]){_0x3c01a8[_0x433b('0x36')]=_[_0x433b('0x39')](_0x3c01a8[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x3c01a8[_0x433b('0x31')],function(_0x209959){var _0x593369={};_0x593369[_0x209959]={'$like':'%'+_0x1deb69[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x593369;})});}_0x3c01a8=_[_0x433b('0x39')]({},_0x3c01a8,_0x1deb69[_0x433b('0x3b')]);return _0x58d208[_0x433b('0x4a')](_0x3c01a8);}})['then'](function(_0x4555df){if(_0x4555df){_0x3fb8af=_0x4555df[_0x433b('0x32')];if(!_0x1deb69[_0x433b('0x2c')][_0x433b('0x33')](_0x433b('0x34'))){_0x3c01a8[_0x433b('0x1b')]=qs[_0x433b('0x1b')](_0x1deb69[_0x433b('0x2c')][_0x433b('0x1b')]);_0x3c01a8[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x1deb69[_0x433b('0x2c')][_0x433b('0x19')]);}return _0x58d208[_0x433b('0x4a')](_0x3c01a8);}})['then'](function(_0x366f49){if(_0x366f49){return _0x366f49?{'count':_0x3fb8af,'rows':_0x366f49}:null;}})[_0x433b('0x20')](respondWithResult(_0x5dff9f,null))['catch'](handleError(_0x5dff9f,null));};exports[_0x433b('0x4b')]=function(_0x14b40d,_0x4d6024,_0x30865a){var _0x5c538e={};var _0x4baf59={};var _0xf875b0;var _0x4f2997;return db[_0x433b('0x28')][_0x433b('0x4c')]({'where':{'id':_0x14b40d['params']['id']}})['then'](handleEntityNotFound(_0x4d6024,null))['then'](function(_0x42aa25){if(_0x42aa25){_0xf875b0=_0x42aa25;_0x4baf59['model']=_[_0x433b('0x2d')](db[_0x433b('0x47')][_0x433b('0x29')]);_0x4baf59['query']=_['keys'](_0x14b40d[_0x433b('0x2c')]);_0x4baf59[_0x433b('0x37')]=_[_0x433b('0x2e')](_0x4baf59[_0x433b('0x2f')],_0x4baf59['query']);_0x5c538e['attributes']=_[_0x433b('0x2e')](_0x4baf59['model'],qs[_0x433b('0x30')](_0x14b40d[_0x433b('0x2c')][_0x433b('0x30')]));_0x5c538e[_0x433b('0x31')]=_0x5c538e[_0x433b('0x31')][_0x433b('0x32')]?_0x5c538e[_0x433b('0x31')]:_0x4baf59['model'];_0x5c538e[_0x433b('0x35')]=qs[_0x433b('0x48')](_0x14b40d['query']['sort']);_0x5c538e['where']=qs[_0x433b('0x37')](_[_0x433b('0x49')](_0x14b40d['query'],_0x4baf59[_0x433b('0x37')]));if(_0x14b40d[_0x433b('0x2c')]['filter']){_0x5c538e[_0x433b('0x36')]=_[_0x433b('0x39')](_0x5c538e[_0x433b('0x36')],{'$or':_[_0x433b('0x27')](_0x5c538e[_0x433b('0x31')],function(_0x4c1f2c){var _0x409a19={};_0x409a19[_0x4c1f2c]={'$like':'%'+_0x14b40d[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x409a19;})});}_0x5c538e=_['merge']({},_0x5c538e,_0x14b40d['options']);return _0xf875b0[_0x433b('0x4b')](_0x5c538e);}})[_0x433b('0x20')](function(_0x401161){if(_0x401161){_0x4f2997=_0x401161[_0x433b('0x32')];if(!_0x14b40d['query'][_0x433b('0x33')](_0x433b('0x34'))){_0x5c538e[_0x433b('0x1b')]=qs[_0x433b('0x1b')](_0x14b40d[_0x433b('0x2c')][_0x433b('0x1b')]);_0x5c538e[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x14b40d[_0x433b('0x2c')][_0x433b('0x19')]);}return _0xf875b0['getDescriptions'](_0x5c538e);}})[_0x433b('0x20')](function(_0x25257b){if(_0x25257b){return _0x25257b?{'count':_0x4f2997,'rows':_0x25257b}:null;}})['then'](respondWithResult(_0x4d6024,null))[_0x433b('0x3f')](handleError(_0x4d6024,null));};exports['getTags']=function(_0x4ecca0,_0x3cab60,_0x38da21){var _0x1e3468={};var _0x315c03={};var _0x15c35b;var _0x45c1f6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4ecca0['params']['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x3cab60,null))[_0x433b('0x20')](function(_0xa58eb0){if(_0xa58eb0){_0x15c35b=_0xa58eb0;_0x315c03[_0x433b('0x2f')]=_['keys'](db[_0x433b('0x4d')][_0x433b('0x29')]);_0x315c03[_0x433b('0x2c')]=_[_0x433b('0x2d')](_0x4ecca0[_0x433b('0x2c')]);_0x315c03[_0x433b('0x37')]=_['intersection'](_0x315c03[_0x433b('0x2f')],_0x315c03[_0x433b('0x2c')]);_0x1e3468['attributes']=_[_0x433b('0x2e')](_0x315c03[_0x433b('0x2f')],qs[_0x433b('0x30')](_0x4ecca0['query'][_0x433b('0x30')]));_0x1e3468[_0x433b('0x31')]=_0x1e3468[_0x433b('0x31')][_0x433b('0x32')]?_0x1e3468['attributes']:_0x315c03[_0x433b('0x2f')];_0x1e3468[_0x433b('0x35')]=qs[_0x433b('0x48')](_0x4ecca0[_0x433b('0x2c')][_0x433b('0x48')]);_0x1e3468[_0x433b('0x36')]=qs[_0x433b('0x37')](_[_0x433b('0x49')](_0x4ecca0[_0x433b('0x2c')],_0x315c03[_0x433b('0x37')]));if(_0x4ecca0[_0x433b('0x2c')][_0x433b('0x38')]){_0x1e3468[_0x433b('0x36')]=_['merge'](_0x1e3468[_0x433b('0x36')],{'$or':_['map'](_0x1e3468[_0x433b('0x31')],function(_0xe03b34){var _0x6cfb81={};_0x6cfb81[_0xe03b34]={'$like':'%'+_0x4ecca0[_0x433b('0x2c')][_0x433b('0x38')]+'%'};return _0x6cfb81;})});}_0x1e3468=_[_0x433b('0x39')]({},_0x1e3468,_0x4ecca0['options']);return _0x15c35b[_0x433b('0x4e')](_0x1e3468);}})[_0x433b('0x20')](function(_0x12b609){if(_0x12b609){_0x45c1f6=_0x12b609[_0x433b('0x32')];if(!_0x4ecca0['query'][_0x433b('0x33')](_0x433b('0x34'))){_0x1e3468['limit']=qs[_0x433b('0x1b')](_0x4ecca0['query'][_0x433b('0x1b')]);_0x1e3468[_0x433b('0x19')]=qs[_0x433b('0x19')](_0x4ecca0[_0x433b('0x2c')][_0x433b('0x19')]);}return _0x15c35b[_0x433b('0x4e')](_0x1e3468);}})[_0x433b('0x20')](function(_0x1caa99){if(_0x1caa99){return _0x1caa99?{'count':_0x45c1f6,'rows':_0x1caa99}:null;}})[_0x433b('0x20')](respondWithResult(_0x3cab60,null))[_0x433b('0x3f')](handleError(_0x3cab60,null));};exports[_0x433b('0x4f')]=function(_0x4536b1,_0x360a6d,_0x259c1e){if(_0x4536b1[_0x433b('0x45')]['id']){delete _0x4536b1[_0x433b('0x45')]['id'];}return db[_0x433b('0x28')][_0x433b('0x4c')]({'where':{'id':_0x4536b1[_0x433b('0x41')]['id']}})[_0x433b('0x20')](handleEntityNotFound(_0x360a6d,null))[_0x433b('0x20')](function(_0x555651){if(_0x555651){return _0x555651[_0x433b('0x4f')](_0x4536b1['body'][_0x433b('0x50')]||[]);}return null;})['then'](respondWithResult(_0x360a6d,null))['catch'](handleError(_0x360a6d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 81d1e43..9a7c75c 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 _0x7bed=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x2ef8f1,_0x31a713){var _0x337b71=function(_0x433863){while(--_0x433863){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x337b71(++_0x31a713);}(_0x7bed,0x117));var _0xd7be=function(_0x3059aa,_0x400a77){_0x3059aa=_0x3059aa-0x0;var _0x4cca35=_0x7bed[_0x3059aa];return _0x4cca35;};'use strict';var _=require(_0xd7be('0x0'));var util=require(_0xd7be('0x1'));var logger=require(_0xd7be('0x2'))(_0xd7be('0x3'));var moment=require(_0xd7be('0x4'));var BPromise=require(_0xd7be('0x5'));var rp=require(_0xd7be('0x6'));var fs=require('fs');var path=require(_0xd7be('0x7'));var rimraf=require(_0xd7be('0x8'));var config=require(_0xd7be('0x9'));var attributes=require(_0xd7be('0xa'));module['exports']=function(_0x2b4574,_0x57a864){return _0x2b4574[_0xd7be('0xb')](_0xd7be('0xc'),attributes,{'tableName':_0xd7be('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4e8=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xd4e8,0x1ec));var _0x8d4e=function(_0x37f6d8,_0x444925){_0x37f6d8=_0x37f6d8-0x0;var _0x49f67b=_0xd4e8[_0x37f6d8];return _0x49f67b;};'use strict';var _=require(_0x8d4e('0x0'));var util=require(_0x8d4e('0x1'));var logger=require(_0x8d4e('0x2'))(_0x8d4e('0x3'));var moment=require(_0x8d4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d4e('0x5'));var fs=require('fs');var path=require(_0x8d4e('0x6'));var rimraf=require(_0x8d4e('0x7'));var config=require(_0x8d4e('0x8'));var attributes=require(_0x8d4e('0x9'));module[_0x8d4e('0xa')]=function(_0x28956a,_0x31fc75){return _0x28956a[_0x8d4e('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x8d4e('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 c455859..ad0f064 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 _0x6f89=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x5bcf59,_0x1e6689){var _0x20d9d7=function(_0x61dc4c){while(--_0x61dc4c){_0x5bcf59['push'](_0x5bcf59['shift']());}};_0x20d9d7(++_0x1e6689);}(_0x6f89,0x158));var _0x96f8=function(_0x497f27,_0x5a5324){_0x497f27=_0x497f27-0x0;var _0xb745fe=_0x6f89[_0x497f27];return _0xb745fe;};'use strict';var _=require(_0x96f8('0x0'));var util=require(_0x96f8('0x1'));var moment=require(_0x96f8('0x2'));var BPromise=require(_0x96f8('0x3'));var rs=require(_0x96f8('0x4'));var fs=require('fs');var Redis=require(_0x96f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x96f8('0x6'));var logger=require(_0x96f8('0x7'))(_0x96f8('0x8'));var config=require(_0x96f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x96f8('0xa')][_0x96f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9d9caa,_0x2bfff5,_0x490ff5){return new BPromise(function(_0x53dcfa,_0x5cc188){return client[_0x96f8('0xc')](_0x9d9caa,_0x490ff5)[_0x96f8('0xd')](function(_0x162431){logger[_0x96f8('0xe')](_0x96f8('0xf'),_0x2bfff5,_0x96f8('0x10'));logger[_0x96f8('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2bfff5,_0x96f8('0x10'),JSON[_0x96f8('0x12')](_0x162431));if(_0x162431[_0x96f8('0x13')]){if(_0x162431[_0x96f8('0x13')][_0x96f8('0x14')]===0x1f4){logger['error'](_0x96f8('0xf'),_0x2bfff5,_0x162431['error'][_0x96f8('0x15')]);return _0x5cc188(_0x162431['error'][_0x96f8('0x15')]);}logger[_0x96f8('0x13')](_0x96f8('0xf'),_0x2bfff5,_0x162431[_0x96f8('0x13')]['message']);return _0x53dcfa(_0x162431['error']['message']);}else{logger[_0x96f8('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bfff5,_0x96f8('0x10'));_0x53dcfa(_0x162431[_0x96f8('0x16')]['message']);}})[_0x96f8('0x17')](function(_0x57d358){logger[_0x96f8('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bfff5,_0x57d358);_0x5cc188(_0x57d358);});});} \ No newline at end of file +var _0xfef7=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0xfef7,0x132));var _0x7fef=function(_0x1877ab,_0xdbf29b){_0x1877ab=_0x1877ab-0x0;var _0x1c3465=_0xfef7[_0x1877ab];return _0x1c3465;};'use strict';var _=require(_0x7fef('0x0'));var util=require(_0x7fef('0x1'));var moment=require(_0x7fef('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fef('0x3'));var db=require(_0x7fef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fef('0x5'))(_0x7fef('0x6'));var config=require(_0x7fef('0x7'));var jayson=require(_0x7fef('0x8'));var client=jayson[_0x7fef('0x9')][_0x7fef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bcf8f,_0x4aa708,_0x3f131c){return new BPromise(function(_0x31f4e7,_0x3a53b4){return client[_0x7fef('0xb')](_0x1bcf8f,_0x3f131c)[_0x7fef('0xc')](function(_0x32a42b){logger[_0x7fef('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4aa708,'request\x20sent');logger[_0x7fef('0xe')](_0x7fef('0xf'),_0x4aa708,_0x7fef('0x10'),JSON[_0x7fef('0x11')](_0x32a42b));if(_0x32a42b[_0x7fef('0x12')]){if(_0x32a42b['error'][_0x7fef('0x13')]===0x1f4){logger[_0x7fef('0x12')](_0x7fef('0x14'),_0x4aa708,_0x32a42b[_0x7fef('0x12')]['message']);return _0x3a53b4(_0x32a42b[_0x7fef('0x12')][_0x7fef('0x15')]);}logger[_0x7fef('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4aa708,_0x32a42b[_0x7fef('0x12')]['message']);return _0x31f4e7(_0x32a42b[_0x7fef('0x12')]['message']);}else{logger['info'](_0x7fef('0x14'),_0x4aa708,_0x7fef('0x10'));_0x31f4e7(_0x32a42b[_0x7fef('0x16')]['message']);}})[_0x7fef('0x17')](function(_0x3a40ba){logger[_0x7fef('0x12')](_0x7fef('0x14'),_0x4aa708,_0x3a40ba);_0x3a53b4(_0x3a40ba);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4818e66..cbf6148 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 _0x91c8=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x475d66,_0x45ae08){var _0x2c429d=function(_0x190ff5){while(--_0x190ff5){_0x475d66['push'](_0x475d66['shift']());}};_0x2c429d(++_0x45ae08);}(_0x91c8,0x84));var _0x891c=function(_0x383d8f,_0x248a12){_0x383d8f=_0x383d8f-0x0;var _0x19ed8a=_0x91c8[_0x383d8f];return _0x19ed8a;};'use strict';var multer=require(_0x891c('0x0'));var util=require(_0x891c('0x1'));var path=require('path');var timeout=require(_0x891c('0x2'));var express=require(_0x891c('0x3'));var router=express['Router']();var fs_extra=require(_0x891c('0x4'));var auth=require(_0x891c('0x5'));var interaction=require(_0x891c('0x6'));var config=require(_0x891c('0x7'));var controller=require(_0x891c('0x8'));router['get']('/',auth[_0x891c('0x9')](),controller[_0x891c('0xa')]);router[_0x891c('0xb')](_0x891c('0xc'),auth[_0x891c('0x9')](),controller[_0x891c('0xd')]);router[_0x891c('0xe')]('/',auth[_0x891c('0x9')](),controller['create']);router[_0x891c('0xf')](_0x891c('0xc'),auth[_0x891c('0x9')](),controller[_0x891c('0x10')]);router['delete'](_0x891c('0xc'),auth[_0x891c('0x9')](),controller[_0x891c('0x11')]);module[_0x891c('0x12')]=router; \ No newline at end of file +var _0xc3fd=['./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xbac1ec,_0x2f59dc){var _0x1d5ce9=function(_0x18c604){while(--_0x18c604){_0xbac1ec['push'](_0xbac1ec['shift']());}};_0x1d5ce9(++_0x2f59dc);}(_0xc3fd,0x175));var _0xdc3f=function(_0x2b9c7b,_0x54ec53){_0x2b9c7b=_0x2b9c7b-0x0;var _0x2a874a=_0xc3fd[_0x2b9c7b];return _0x2a874a;};'use strict';var multer=require(_0xdc3f('0x0'));var util=require(_0xdc3f('0x1'));var path=require(_0xdc3f('0x2'));var timeout=require(_0xdc3f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc3f('0x4'));var auth=require(_0xdc3f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc3f('0x6'));var controller=require(_0xdc3f('0x7'));router['get']('/',auth[_0xdc3f('0x8')](),controller[_0xdc3f('0x9')]);router[_0xdc3f('0xa')](_0xdc3f('0xb'),auth['isAuthenticated'](),controller[_0xdc3f('0xc')]);router[_0xdc3f('0xd')]('/',auth[_0xdc3f('0x8')](),controller[_0xdc3f('0xe')]);router['put'](_0xdc3f('0xb'),auth[_0xdc3f('0x8')](),controller[_0xdc3f('0xf')]);router[_0xdc3f('0x10')](_0xdc3f('0xb'),auth[_0xdc3f('0x8')](),controller[_0xdc3f('0x11')]);module[_0xdc3f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 46f2bf2..c076a19 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 _0xf9de=['customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x5d3ee1,_0x57244b){var _0x14fa06=function(_0xda4d4e){while(--_0xda4d4e){_0x5d3ee1['push'](_0x5d3ee1['shift']());}};_0x14fa06(++_0x57244b);}(_0xf9de,0x93));var _0xef9d=function(_0x5dae26,_0x6451ce){_0x5dae26=_0x5dae26-0x0;var _0x44acf0=_0xf9de[_0x5dae26];return _0x44acf0;};'use strict';var Sequelize=require(_0xef9d('0x0'));module[_0xef9d('0x1')]={'type':{'type':Sequelize[_0xef9d('0x2')](_0xef9d('0x3'),_0xef9d('0x4'),_0xef9d('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xef9d('0x6')]},'key':{'type':Sequelize[_0xef9d('0x6')]},'keyType':{'type':Sequelize[_0xef9d('0x2')](_0xef9d('0x3'),_0xef9d('0x4'),_0xef9d('0x5'))},'keyContent':{'type':Sequelize[_0xef9d('0x6')]},'idField':{'type':Sequelize[_0xef9d('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xef9d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0eb4=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x0eb4,0xa7));var _0x40eb=function(_0x5ecc8b,_0xfeea30){_0x5ecc8b=_0x5ecc8b-0x0;var _0x3f6600=_0x0eb4[_0x5ecc8b];return _0x3f6600;};'use strict';var Sequelize=require(_0x40eb('0x0'));module['exports']={'type':{'type':Sequelize[_0x40eb('0x1')](_0x40eb('0x2'),_0x40eb('0x3'),'customVariable',_0x40eb('0x4'),_0x40eb('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x40eb('0x6')]},'key':{'type':Sequelize[_0x40eb('0x6')]},'keyType':{'type':Sequelize[_0x40eb('0x1')](_0x40eb('0x2'),'variable',_0x40eb('0x7'))},'keyContent':{'type':Sequelize[_0x40eb('0x6')]},'idField':{'type':Sequelize[_0x40eb('0x6')]},'nameField':{'type':Sequelize[_0x40eb('0x6')]},'customField':{'type':Sequelize[_0x40eb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x40eb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ed46dca..3f79860 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 _0x1152=['stack','name','index','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','keys','include','merge','create','body','catch','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x46a280,_0xa1d7bb){var _0x1fd778=function(_0x21f33d){while(--_0x21f33d){_0x46a280['push'](_0x46a280['shift']());}};_0x1fd778(++_0xa1d7bb);}(_0x1152,0x182));var _0x2115=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0x1152[_0x5ca52d];return _0x89e54e;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require(_0x2115('0x1'));var zipdir=require(_0x2115('0x2'));var jsonpatch=require(_0x2115('0x3'));var rp=require(_0x2115('0x4'));var moment=require(_0x2115('0x5'));var BPromise=require(_0x2115('0x6'));var Mustache=require(_0x2115('0x7'));var util=require('util');var path=require(_0x2115('0x8'));var sox=require('sox');var csv=require(_0x2115('0x9'));var ejs=require(_0x2115('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('jsforce');var deskjs=require(_0x2115('0xb'));var toCsv=require(_0x2115('0x9'));var querystring=require(_0x2115('0xc'));var Papa=require('papaparse');var Redis=require(_0x2115('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2115('0xe'));var hardwareService=require(_0x2115('0xf'));var logger=require(_0x2115('0x10'))('api');var utils=require(_0x2115('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2115('0x12'));var db=require(_0x2115('0x13'))['db'];function respondWithStatusCode(_0x2bb885,_0x33d38b){_0x33d38b=_0x33d38b||0xcc;return function(_0x22475e){if(_0x22475e){return _0x2bb885['sendStatus'](_0x33d38b);}return _0x2bb885[_0x2115('0x14')](_0x33d38b)['end']();};}function respondWithResult(_0x3727a3,_0x38e406){_0x38e406=_0x38e406||0xc8;return function(_0x17028e){if(_0x17028e){return _0x3727a3[_0x2115('0x14')](_0x38e406)[_0x2115('0x15')](_0x17028e);}};}function respondWithFilteredResult(_0x113ce2,_0x350969){return function(_0x5e8f81){if(_0x5e8f81){var _0xdf3e24=typeof _0x350969[_0x2115('0x16')]===_0x2115('0x17')&&typeof _0x350969[_0x2115('0x18')]===_0x2115('0x17');var _0x1bdef9=_0x5e8f81[_0x2115('0x19')];var _0x77e2c6=_0xdf3e24?0x0:_0x350969['offset'];var _0x154f69=_0xdf3e24?_0x5e8f81[_0x2115('0x19')]:_0x350969[_0x2115('0x16')]+_0x350969['limit'];var _0x2dfb3c;if(_0x154f69>=_0x1bdef9){_0x154f69=_0x1bdef9;_0x2dfb3c=0xc8;}else{_0x2dfb3c=0xce;}_0x113ce2[_0x2115('0x14')](_0x2dfb3c);return _0x113ce2[_0x2115('0x1a')](_0x2115('0x1b'),_0x77e2c6+'-'+_0x154f69+'/'+_0x1bdef9)[_0x2115('0x15')](_0x5e8f81);}return null;};}function patchUpdates(_0xcc2d7b){return function(_0x21d079){try{jsonpatch[_0x2115('0x1c')](_0x21d079,_0xcc2d7b,!![]);}catch(_0x464af4){return BPromise[_0x2115('0x1d')](_0x464af4);}return _0x21d079[_0x2115('0x1e')]();};}function saveUpdates(_0x8b7304,_0x8e37c){return function(_0x13fde1){if(_0x13fde1){return _0x13fde1['update'](_0x8b7304)[_0x2115('0x1f')](function(_0x340c42){return _0x340c42;});}return null;};}function removeEntity(_0x40d19f,_0x4ac436){return function(_0x27c2f5){if(_0x27c2f5){return _0x27c2f5[_0x2115('0x20')]()['then'](function(){_0x40d19f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x201c94,_0x5e9d07){return function(_0x1a2ec3){if(!_0x1a2ec3){_0x201c94['sendStatus'](0x194);}return _0x1a2ec3;};}function handleError(_0x1283ec,_0x115800){_0x115800=_0x115800||0x1f4;return function(_0x1b7f47){logger[_0x2115('0x21')](_0x1b7f47[_0x2115('0x22')]);if(_0x1b7f47['name']){delete _0x1b7f47[_0x2115('0x23')];}_0x1283ec[_0x2115('0x14')](_0x115800)['send'](_0x1b7f47);};}exports[_0x2115('0x24')]=function(_0x33d81c,_0x26eff7){var _0x1262e7={},_0x59ca70={},_0x19c595={'count':0x0,'rows':[]};var _0x15229e=_[_0x2115('0x25')](db[_0x2115('0x26')][_0x2115('0x27')],function(_0x27969d){return{'name':_0x27969d['fieldName'],'type':_0x27969d['type'][_0x2115('0x28')]};});_0x59ca70[_0x2115('0x29')]=_[_0x2115('0x25')](_0x15229e,_0x2115('0x23'));_0x59ca70[_0x2115('0x2a')]=_['keys'](_0x33d81c[_0x2115('0x2a')]);_0x59ca70[_0x2115('0x2b')]=_[_0x2115('0x2c')](_0x59ca70['model'],_0x59ca70[_0x2115('0x2a')]);_0x1262e7['attributes']=_[_0x2115('0x2c')](_0x59ca70['model'],qs[_0x2115('0x2d')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x2d')]));_0x1262e7['attributes']=_0x1262e7['attributes'][_0x2115('0x2e')]?_0x1262e7[_0x2115('0x2f')]:_0x59ca70['model'];if(!_0x33d81c[_0x2115('0x2a')][_0x2115('0x30')](_0x2115('0x31'))){_0x1262e7[_0x2115('0x18')]=qs['limit'](_0x33d81c[_0x2115('0x2a')][_0x2115('0x18')]);_0x1262e7[_0x2115('0x16')]=qs[_0x2115('0x16')](_0x33d81c['query'][_0x2115('0x16')]);}_0x1262e7[_0x2115('0x32')]=qs[_0x2115('0x33')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x33')]);_0x1262e7[_0x2115('0x34')]=qs['filters'](_[_0x2115('0x35')](_0x33d81c[_0x2115('0x2a')],_0x59ca70[_0x2115('0x2b')]),_0x15229e);if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]){_0x1262e7[_0x2115('0x34')]=_['merge'](_0x1262e7[_0x2115('0x34')],{'$or':_['map'](_0x15229e,function(_0x59b531){if(_0x59b531[_0x2115('0x37')]!==_0x2115('0x38')){var _0x4572f3={};_0x4572f3[_0x59b531[_0x2115('0x23')]]={'$like':'%'+_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]+'%'};return _0x4572f3;}})});}_0x1262e7=_['merge']({},_0x1262e7,_0x33d81c[_0x2115('0x39')]);var _0x1c2508={'where':_0x1262e7[_0x2115('0x34')]};return db[_0x2115('0x26')][_0x2115('0x19')](_0x1c2508)[_0x2115('0x1f')](function(_0x1aa165){_0x19c595[_0x2115('0x19')]=_0x1aa165;if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x3a')]){_0x1262e7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2115('0x3b')](_0x1262e7);})['then'](function(_0xa652de){_0x19c595['rows']=_0xa652de;return _0x19c595;})['then'](respondWithFilteredResult(_0x26eff7,_0x1262e7))['catch'](handleError(_0x26eff7,null));};exports[_0x2115('0x3c')]=function(_0x40d5d6,_0x11b840){var _0x96847d={'raw':!![],'where':{'id':_0x40d5d6['params']['id']}},_0x16f022={};_0x16f022[_0x2115('0x29')]=_['keys'](db[_0x2115('0x26')][_0x2115('0x27')]);_0x16f022['query']=_[_0x2115('0x3d')](_0x40d5d6[_0x2115('0x2a')]);_0x16f022['filters']=_['intersection'](_0x16f022[_0x2115('0x29')],_0x16f022[_0x2115('0x2a')]);_0x96847d['attributes']=_['intersection'](_0x16f022[_0x2115('0x29')],qs[_0x2115('0x2d')](_0x40d5d6['query']['fields']));_0x96847d[_0x2115('0x2f')]=_0x96847d[_0x2115('0x2f')][_0x2115('0x2e')]?_0x96847d['attributes']:_0x16f022[_0x2115('0x29')];if(_0x40d5d6['query'][_0x2115('0x3a')]){_0x96847d[_0x2115('0x3e')]=[{'all':!![]}];}_0x96847d=_[_0x2115('0x3f')]({},_0x96847d,_0x40d5d6[_0x2115('0x39')]);return db[_0x2115('0x26')]['find'](_0x96847d)[_0x2115('0x1f')](handleEntityNotFound(_0x11b840,null))['then'](respondWithResult(_0x11b840,null))['catch'](handleError(_0x11b840,null));};exports[_0x2115('0x40')]=function(_0xa67937,_0x583575){return db[_0x2115('0x26')][_0x2115('0x40')](_0xa67937[_0x2115('0x41')],{})[_0x2115('0x1f')](respondWithResult(_0x583575,0xc9))[_0x2115('0x42')](handleError(_0x583575,null));};exports[_0x2115('0x43')]=function(_0x41d1a4,_0x347f16){if(_0x41d1a4[_0x2115('0x41')]['id']){delete _0x41d1a4['body']['id'];}return db[_0x2115('0x26')][_0x2115('0x44')]({'where':{'id':_0x41d1a4[_0x2115('0x45')]['id']}})['then'](handleEntityNotFound(_0x347f16,null))[_0x2115('0x1f')](saveUpdates(_0x41d1a4['body'],null))['then'](respondWithResult(_0x347f16,null))['catch'](handleError(_0x347f16,null));};exports[_0x2115('0x20')]=function(_0x24d601,_0x4820c7){return db['FreshdeskField'][_0x2115('0x44')]({'where':{'id':_0x24d601[_0x2115('0x45')]['id']}})[_0x2115('0x1f')](handleEntityNotFound(_0x4820c7,null))[_0x2115('0x1f')](removeEntity(_0x4820c7,null))[_0x2115('0x42')](handleError(_0x4820c7,null));}; \ No newline at end of file +var _0xd404=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x401b33,_0xf98e3e){var _0x1feb90=function(_0x4bf573){while(--_0x4bf573){_0x401b33['push'](_0x401b33['shift']());}};_0x1feb90(++_0xf98e3e);}(_0xd404,0x15b));var _0x4d40=function(_0x15522f,_0x5547aa){_0x15522f=_0x15522f-0x0;var _0x430e9b=_0xd404[_0x15522f];return _0x430e9b;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d40('0x2'));var rp=require(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require(_0x4d40('0x8'));var csv=require(_0x4d40('0x9'));var ejs=require(_0x4d40('0xa'));var fs=require('fs');var fs_extra=require(_0x4d40('0xb'));var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];function respondWithStatusCode(_0x3c3b7e,_0x28e5bf){_0x28e5bf=_0x28e5bf||0xcc;return function(_0x42a621){if(_0x42a621){return _0x3c3b7e['sendStatus'](_0x28e5bf);}return _0x3c3b7e[_0x4d40('0x1a')](_0x28e5bf)[_0x4d40('0x1b')]();};}function respondWithResult(_0x3b071b,_0x2083bd){_0x2083bd=_0x2083bd||0xc8;return function(_0x477a91){if(_0x477a91){return _0x3b071b['status'](_0x2083bd)[_0x4d40('0x1c')](_0x477a91);}};}function respondWithFilteredResult(_0x4077ce,_0x20bc1b){return function(_0xcee25a){if(_0xcee25a){var _0x453857=typeof _0x20bc1b[_0x4d40('0x1d')]===_0x4d40('0x1e')&&typeof _0x20bc1b[_0x4d40('0x1f')]===_0x4d40('0x1e');var _0x4b5d23=_0xcee25a['count'];var _0x1ae5c7=_0x453857?0x0:_0x20bc1b[_0x4d40('0x1d')];var _0x4e505f=_0x453857?_0xcee25a[_0x4d40('0x20')]:_0x20bc1b[_0x4d40('0x1d')]+_0x20bc1b['limit'];var _0x36d031;if(_0x4e505f>=_0x4b5d23){_0x4e505f=_0x4b5d23;_0x36d031=0xc8;}else{_0x36d031=0xce;}_0x4077ce['status'](_0x36d031);return _0x4077ce[_0x4d40('0x21')](_0x4d40('0x22'),_0x1ae5c7+'-'+_0x4e505f+'/'+_0x4b5d23)['json'](_0xcee25a);}return null;};}function patchUpdates(_0x57c997){return function(_0x375ce0){try{jsonpatch[_0x4d40('0x23')](_0x375ce0,_0x57c997,!![]);}catch(_0x4d52ce){return BPromise[_0x4d40('0x24')](_0x4d52ce);}return _0x375ce0[_0x4d40('0x25')]();};}function saveUpdates(_0x30f058,_0x5d4c24){return function(_0x356fd6){if(_0x356fd6){return _0x356fd6[_0x4d40('0x26')](_0x30f058)[_0x4d40('0x27')](function(_0x5ca0a0){return _0x5ca0a0;});}return null;};}function removeEntity(_0x4eebc3,_0x2df33a){return function(_0x90b652){if(_0x90b652){return _0x90b652[_0x4d40('0x28')]()[_0x4d40('0x27')](function(){_0x4eebc3[_0x4d40('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbcd540,_0x1f5e5b){return function(_0x560df8){if(!_0x560df8){_0xbcd540['sendStatus'](0x194);}return _0x560df8;};}function handleError(_0x274d44,_0x2a0c82){_0x2a0c82=_0x2a0c82||0x1f4;return function(_0x3fa83e){logger[_0x4d40('0x29')](_0x3fa83e[_0x4d40('0x2a')]);if(_0x3fa83e[_0x4d40('0x2b')]){delete _0x3fa83e[_0x4d40('0x2b')];}_0x274d44[_0x4d40('0x1a')](_0x2a0c82)[_0x4d40('0x2c')](_0x3fa83e);};}exports[_0x4d40('0x2d')]=function(_0x1c0fcf,_0x4ca431){var _0x4e4e61={},_0x52f706={},_0x158a86={'count':0x0,'rows':[]};var _0x350488=_[_0x4d40('0x2e')](db[_0x4d40('0x2f')]['rawAttributes'],function(_0x18e601){return{'name':_0x18e601[_0x4d40('0x30')],'type':_0x18e601[_0x4d40('0x31')]['key']};});_0x52f706[_0x4d40('0x32')]=_[_0x4d40('0x2e')](_0x350488,_0x4d40('0x2b'));_0x52f706[_0x4d40('0x33')]=_[_0x4d40('0x34')](_0x1c0fcf['query']);_0x52f706[_0x4d40('0x35')]=_['intersection'](_0x52f706[_0x4d40('0x32')],_0x52f706[_0x4d40('0x33')]);_0x4e4e61[_0x4d40('0x36')]=_[_0x4d40('0x37')](_0x52f706['model'],qs['fields'](_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x38')]));_0x4e4e61[_0x4d40('0x36')]=_0x4e4e61[_0x4d40('0x36')]['length']?_0x4e4e61[_0x4d40('0x36')]:_0x52f706['model'];if(!_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x39')](_0x4d40('0x3a'))){_0x4e4e61[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x1f')]);_0x4e4e61[_0x4d40('0x1d')]=qs[_0x4d40('0x1d')](_0x1c0fcf[_0x4d40('0x33')]['offset']);}_0x4e4e61[_0x4d40('0x3b')]=qs[_0x4d40('0x3c')](_0x1c0fcf['query']['sort']);_0x4e4e61['where']=qs[_0x4d40('0x35')](_[_0x4d40('0x3d')](_0x1c0fcf['query'],_0x52f706[_0x4d40('0x35')]),_0x350488);if(_0x1c0fcf[_0x4d40('0x33')][_0x4d40('0x3e')]){_0x4e4e61[_0x4d40('0x3f')]=_[_0x4d40('0x40')](_0x4e4e61['where'],{'$or':_[_0x4d40('0x2e')](_0x350488,function(_0x21a4ec){if(_0x21a4ec['type']!=='VIRTUAL'){var _0x3a4924={};_0x3a4924[_0x21a4ec[_0x4d40('0x2b')]]={'$like':'%'+_0x1c0fcf['query'][_0x4d40('0x3e')]+'%'};return _0x3a4924;}})});}_0x4e4e61=_[_0x4d40('0x40')]({},_0x4e4e61,_0x1c0fcf['options']);var _0x1e8427={'where':_0x4e4e61[_0x4d40('0x3f')]};return db['FreshdeskField'][_0x4d40('0x20')](_0x1e8427)[_0x4d40('0x27')](function(_0x4841ac){_0x158a86[_0x4d40('0x20')]=_0x4841ac;if(_0x1c0fcf['query'][_0x4d40('0x41')]){_0x4e4e61[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x2f')][_0x4d40('0x43')](_0x4e4e61);})[_0x4d40('0x27')](function(_0x2ef0ca){_0x158a86[_0x4d40('0x44')]=_0x2ef0ca;return _0x158a86;})[_0x4d40('0x27')](respondWithFilteredResult(_0x4ca431,_0x4e4e61))[_0x4d40('0x45')](handleError(_0x4ca431,null));};exports['show']=function(_0x250847,_0x3718a8){var _0x1c2fa8={'raw':!![],'where':{'id':_0x250847[_0x4d40('0x46')]['id']}},_0xcdde22={};_0xcdde22['model']=_[_0x4d40('0x34')](db['FreshdeskField'][_0x4d40('0x47')]);_0xcdde22[_0x4d40('0x33')]=_[_0x4d40('0x34')](_0x250847[_0x4d40('0x33')]);_0xcdde22['filters']=_[_0x4d40('0x37')](_0xcdde22[_0x4d40('0x32')],_0xcdde22['query']);_0x1c2fa8[_0x4d40('0x36')]=_['intersection'](_0xcdde22[_0x4d40('0x32')],qs[_0x4d40('0x38')](_0x250847[_0x4d40('0x33')][_0x4d40('0x38')]));_0x1c2fa8['attributes']=_0x1c2fa8[_0x4d40('0x36')]['length']?_0x1c2fa8[_0x4d40('0x36')]:_0xcdde22[_0x4d40('0x32')];if(_0x250847[_0x4d40('0x33')][_0x4d40('0x41')]){_0x1c2fa8['include']=[{'all':!![]}];}_0x1c2fa8=_[_0x4d40('0x40')]({},_0x1c2fa8,_0x250847[_0x4d40('0x48')]);return db[_0x4d40('0x2f')][_0x4d40('0x49')](_0x1c2fa8)['then'](handleEntityNotFound(_0x3718a8,null))[_0x4d40('0x27')](respondWithResult(_0x3718a8,null))[_0x4d40('0x45')](handleError(_0x3718a8,null));};exports['create']=function(_0x200d29,_0x493d8e){return db[_0x4d40('0x2f')][_0x4d40('0x4a')](_0x200d29[_0x4d40('0x4b')],{})[_0x4d40('0x27')](respondWithResult(_0x493d8e,0xc9))[_0x4d40('0x45')](handleError(_0x493d8e,null));};exports[_0x4d40('0x26')]=function(_0x30be7b,_0x37b6bf){if(_0x30be7b[_0x4d40('0x4b')]['id']){delete _0x30be7b['body']['id'];}return db[_0x4d40('0x2f')][_0x4d40('0x49')]({'where':{'id':_0x30be7b[_0x4d40('0x46')]['id']}})[_0x4d40('0x27')](handleEntityNotFound(_0x37b6bf,null))[_0x4d40('0x27')](saveUpdates(_0x30be7b['body'],null))[_0x4d40('0x27')](respondWithResult(_0x37b6bf,null))[_0x4d40('0x45')](handleError(_0x37b6bf,null));};exports['destroy']=function(_0xdf0235,_0x48ffd7){return db[_0x4d40('0x2f')][_0x4d40('0x49')]({'where':{'id':_0xdf0235[_0x4d40('0x46')]['id']}})['then'](handleEntityNotFound(_0x48ffd7,null))[_0x4d40('0x27')](removeEntity(_0x48ffd7,null))[_0x4d40('0x45')](handleError(_0x48ffd7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 92020b8..a49a6d6 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 _0x3584=['idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x12c3a0,_0x37b939){var _0x5203ca=function(_0x1a4ac1){while(--_0x1a4ac1){_0x12c3a0['push'](_0x12c3a0['shift']());}};_0x5203ca(++_0x37b939);}(_0x3584,0x8e));var _0x4358=function(_0x17a81b,_0x4de3e7){_0x17a81b=_0x17a81b-0x0;var _0x5ecb41=_0x3584[_0x17a81b];return _0x5ecb41;};'use strict';var _=require(_0x4358('0x0'));var util=require(_0x4358('0x1'));var logger=require(_0x4358('0x2'))(_0x4358('0x3'));var moment=require(_0x4358('0x4'));var BPromise=require('bluebird');var rp=require(_0x4358('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4358('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x4358('0x7')]=function(_0x48e1bd,_0x323abf){return _0x48e1bd[_0x4358('0x8')](_0x4358('0x9'),attributes,{'tableName':_0x4358('0xa'),'paranoid':![],'indexes':[{'name':_0x4358('0xb'),'fields':[_0x4358('0xc'),_0x4358('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb67d=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb67d,0x1ef));var _0xdb67=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb67d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdb67('0x0'));var util=require(_0xdb67('0x1'));var logger=require(_0xdb67('0x2'))(_0xdb67('0x3'));var moment=require(_0xdb67('0x4'));var BPromise=require(_0xdb67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb67('0x6'));var rimraf=require(_0xdb67('0x7'));var config=require(_0xdb67('0x8'));var attributes=require(_0xdb67('0x9'));module[_0xdb67('0xa')]=function(_0x166334,_0x5761f7){return _0x166334[_0xdb67('0xb')](_0xdb67('0xc'),attributes,{'tableName':_0xdb67('0xd'),'paranoid':![],'indexes':[{'name':_0xdb67('0xe'),'fields':[_0xdb67('0xf'),_0xdb67('0x10')],'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 6b7049b..49a874f 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 _0x47a2=['rpc','../../config/environment','http','request','then','info','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','code','error','FreshdeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x24c94c,_0x276063){var _0x1d5fb8=function(_0x53d533){while(--_0x53d533){_0x24c94c['push'](_0x24c94c['shift']());}};_0x1d5fb8(++_0x276063);}(_0x47a2,0x1e8));var _0x247a=function(_0x4764b4,_0x1424cb){_0x4764b4=_0x4764b4-0x0;var _0x518604=_0x47a2[_0x4764b4];return _0x518604;};'use strict';var _=require(_0x247a('0x0'));var util=require(_0x247a('0x1'));var moment=require(_0x247a('0x2'));var BPromise=require(_0x247a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x247a('0x4'))['db'];var utils=require(_0x247a('0x5'));var logger=require('../../config/logger')(_0x247a('0x6'));var config=require(_0x247a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x247a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b3d21,_0xdb2583,_0x22cc6b){return new BPromise(function(_0x450b73,_0x5bdfa7){return client[_0x247a('0x9')](_0x2b3d21,_0x22cc6b)[_0x247a('0xa')](function(_0x59e78a){logger[_0x247a('0xb')]('FreshdeskField,\x20%s,\x20%s',_0xdb2583,_0x247a('0xc'));logger['debug'](_0x247a('0xd'),_0xdb2583,_0x247a('0xc'),JSON['stringify'](_0x59e78a));if(_0x59e78a['error']){if(_0x59e78a['error'][_0x247a('0xe')]===0x1f4){logger[_0x247a('0xf')](_0x247a('0x10'),_0xdb2583,_0x59e78a[_0x247a('0xf')][_0x247a('0x11')]);return _0x5bdfa7(_0x59e78a['error'][_0x247a('0x11')]);}logger['error'](_0x247a('0x10'),_0xdb2583,_0x59e78a[_0x247a('0xf')][_0x247a('0x11')]);return _0x450b73(_0x59e78a['error'][_0x247a('0x11')]);}else{logger[_0x247a('0xb')](_0x247a('0x10'),_0xdb2583,_0x247a('0xc'));_0x450b73(_0x59e78a[_0x247a('0x12')][_0x247a('0x11')]);}})['catch'](function(_0x5cc0cd){logger[_0x247a('0xf')]('FreshdeskField,\x20%s,\x20%s',_0xdb2583,_0x5cc0cd);_0x5bdfa7(_0x5cc0cd);});});} \ No newline at end of file +var _0x5bd8=['FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','debug'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5bd8,0x1ce));var _0x85bd=function(_0x1ae6b3,_0x3290bb){_0x1ae6b3=_0x1ae6b3-0x0;var _0x311586=_0x5bd8[_0x1ae6b3];return _0x311586;};'use strict';var _=require(_0x85bd('0x0'));var util=require(_0x85bd('0x1'));var moment=require(_0x85bd('0x2'));var BPromise=require(_0x85bd('0x3'));var rs=require(_0x85bd('0x4'));var fs=require('fs');var Redis=require(_0x85bd('0x5'));var db=require(_0x85bd('0x6'))['db'];var utils=require(_0x85bd('0x7'));var logger=require(_0x85bd('0x8'))(_0x85bd('0x9'));var config=require(_0x85bd('0xa'));var jayson=require(_0x85bd('0xb'));var client=jayson[_0x85bd('0xc')][_0x85bd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e498a,_0x511eab,_0x2f64cc){return new BPromise(function(_0x2856e3,_0x13980e){return client[_0x85bd('0xe')](_0x1e498a,_0x2f64cc)['then'](function(_0x58d3e0){logger[_0x85bd('0xf')](_0x85bd('0x10'),_0x511eab,'request\x20sent');logger[_0x85bd('0x11')](_0x85bd('0x12'),_0x511eab,_0x85bd('0x13'),JSON[_0x85bd('0x14')](_0x58d3e0));if(_0x58d3e0[_0x85bd('0x15')]){if(_0x58d3e0[_0x85bd('0x15')][_0x85bd('0x16')]===0x1f4){logger['error'](_0x85bd('0x10'),_0x511eab,_0x58d3e0[_0x85bd('0x15')]['message']);return _0x13980e(_0x58d3e0['error'][_0x85bd('0x17')]);}logger[_0x85bd('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x511eab,_0x58d3e0['error'][_0x85bd('0x17')]);return _0x2856e3(_0x58d3e0['error'][_0x85bd('0x17')]);}else{logger[_0x85bd('0xf')](_0x85bd('0x10'),_0x511eab,_0x85bd('0x13'));_0x2856e3(_0x58d3e0['result'][_0x85bd('0x17')]);}})['catch'](function(_0x48255d){logger['error'](_0x85bd('0x10'),_0x511eab,_0x48255d);_0x13980e(_0x48255d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3c8cf81..9243f8c 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 _0xab40=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xab40,0xcd));var _0x0ab4=function(_0x26f0ee,_0x5bf32f){_0x26f0ee=_0x26f0ee-0x0;var _0x887e0c=_0xab40[_0x26f0ee];return _0x887e0c;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var fs_extra=require(_0x0ab4('0x3'));var auth=require(_0x0ab4('0x4'));var interaction=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x0ab4('0x7')](),controller['index']);router[_0x0ab4('0x8')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0ab4('0xb')]);router[_0x0ab4('0x8')](_0x0ab4('0xc'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xd')]);router[_0x0ab4('0xe')]('/',auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xf')]);router['post']('/:id/configurations',auth[_0x0ab4('0x7')](),controller['addConfiguration']);router[_0x0ab4('0x10')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0x11')]);router[_0x0ab4('0x12')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0x13')]);module[_0x0ab4('0x14')]=router; \ No newline at end of file +var _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path'];(function(_0x123cf0,_0x5ba204){var _0x321056=function(_0x3f505c){while(--_0x3f505c){_0x123cf0['push'](_0x123cf0['shift']());}};_0x321056(++_0x5ba204);}(_0x4fc2,0x111));var _0x24fc=function(_0x2a8ca3,_0x2626d7){_0x2a8ca3=_0x2a8ca3-0x0;var _0x2add49=_0x4fc2[_0x2a8ca3];return _0x2add49;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getConfigurations']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router[_0x24fc('0x11')]('/:id/configurations',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6a756cc..94436d4 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 _0xd117=['remoteUri','sequelize','exports','STRING','username'];(function(_0x16199a,_0x2341ee){var _0x1f2f64=function(_0x9903d9){while(--_0x9903d9){_0x16199a['push'](_0x16199a['shift']());}};_0x1f2f64(++_0x2341ee);}(_0xd117,0x182));var _0x7d11=function(_0x4333c0,_0x1b8b7d){_0x4333c0=_0x4333c0-0x0;var _0x1ea60b=_0xd117[_0x4333c0];return _0x1ea60b;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'name':{'type':Sequelize[_0x7d11('0x2')]},'description':{'type':Sequelize[_0x7d11('0x2')]},'username':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x3')},'apiKey':{'type':Sequelize[_0x7d11('0x2')]},'remoteUri':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x4')},'serverUrl':{'type':Sequelize[_0x7d11('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x93e9=['sequelize','exports','STRING','username'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x93e9,0xcc));var _0x993e=function(_0xac6e69,_0x40c113){_0xac6e69=_0xac6e69-0x0;var _0x3dfe58=_0x93e9[_0xac6e69];return _0x3dfe58;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e4379cc..efe8b66 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 _0x742f=['rows','catch','show','keys','rawAttributes','options','create','body','find','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','channel','getDescriptions','FreshsalesField','Subjects','username','remoteUri','slice','substring','lastIndexOf','GET','format','Token\x20token=','users','email','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesAccount','includeAll','include','findAll'];(function(_0x475d0b,_0x269fb1){var _0x540590=function(_0x223a31){while(--_0x223a31){_0x475d0b['push'](_0x475d0b['shift']());}};_0x540590(++_0x269fb1);}(_0x742f,0x155));var _0xf742=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x742f[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0xf742('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf742('0x1'));var rp=require(_0xf742('0x2'));var moment=require(_0xf742('0x3'));var BPromise=require(_0xf742('0x4'));var Mustache=require(_0xf742('0x5'));var util=require(_0xf742('0x6'));var path=require(_0xf742('0x7'));var sox=require('sox');var csv=require(_0xf742('0x8'));var ejs=require(_0xf742('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf742('0xa'));var crypto=require(_0xf742('0xb'));var jsforce=require(_0xf742('0xc'));var deskjs=require(_0xf742('0xd'));var toCsv=require(_0xf742('0x8'));var querystring=require(_0xf742('0xe'));var Papa=require(_0xf742('0xf'));var Redis=require(_0xf742('0x10'));var authService=require(_0xf742('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf742('0x12'));var hardwareService=require(_0xf742('0x13'));var logger=require('../../config/logger')(_0xf742('0x14'));var utils=require(_0xf742('0x15'));var config=require(_0xf742('0x16'));var licenseUtil=require(_0xf742('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d9589,_0x5c9fd7){_0x5c9fd7=_0x5c9fd7||0xcc;return function(_0x2654d3){if(_0x2654d3){return _0x2d9589[_0xf742('0x18')](_0x5c9fd7);}return _0x2d9589[_0xf742('0x19')](_0x5c9fd7)[_0xf742('0x1a')]();};}function respondWithResult(_0x1464ef,_0x4a5bb4){_0x4a5bb4=_0x4a5bb4||0xc8;return function(_0x408144){if(_0x408144){return _0x1464ef[_0xf742('0x19')](_0x4a5bb4)[_0xf742('0x1b')](_0x408144);}};}function respondWithFilteredResult(_0xd17325,_0x4197d3){return function(_0x2ea088){if(_0x2ea088){var _0x261779=typeof _0x4197d3[_0xf742('0x1c')]===_0xf742('0x1d')&&typeof _0x4197d3[_0xf742('0x1e')]==='undefined';var _0x532f34=_0x2ea088[_0xf742('0x1f')];var _0x504c43=_0x261779?0x0:_0x4197d3[_0xf742('0x1c')];var _0x587ddd=_0x261779?_0x2ea088['count']:_0x4197d3['offset']+_0x4197d3['limit'];var _0x44635c;if(_0x587ddd>=_0x532f34){_0x587ddd=_0x532f34;_0x44635c=0xc8;}else{_0x44635c=0xce;}_0xd17325[_0xf742('0x19')](_0x44635c);return _0xd17325['set'](_0xf742('0x20'),_0x504c43+'-'+_0x587ddd+'/'+_0x532f34)[_0xf742('0x1b')](_0x2ea088);}return null;};}function patchUpdates(_0x3f7d1d){return function(_0x46e84f){try{jsonpatch[_0xf742('0x21')](_0x46e84f,_0x3f7d1d,!![]);}catch(_0x1a010f){return BPromise[_0xf742('0x22')](_0x1a010f);}return _0x46e84f[_0xf742('0x23')]();};}function saveUpdates(_0x10fdf7,_0x183a97){return function(_0x1ac657){if(_0x1ac657){return _0x1ac657[_0xf742('0x24')](_0x10fdf7)['then'](function(_0x22707b){return _0x22707b;});}return null;};}function removeEntity(_0x2d8f98,_0x36dd4b){return function(_0x42eacb){if(_0x42eacb){return _0x42eacb[_0xf742('0x25')]()[_0xf742('0x26')](function(){_0x2d8f98[_0xf742('0x19')](0xcc)[_0xf742('0x1a')]();});}};}function handleEntityNotFound(_0x5dadd1,_0x4077c6){return function(_0x172337){if(!_0x172337){_0x5dadd1[_0xf742('0x18')](0x194);}return _0x172337;};}function handleError(_0x2cb7e2,_0x5e22a8){_0x5e22a8=_0x5e22a8||0x1f4;return function(_0x3a0150){logger['error'](_0x3a0150[_0xf742('0x27')]);if(_0x3a0150[_0xf742('0x28')]){delete _0x3a0150[_0xf742('0x28')];}_0x2cb7e2['status'](_0x5e22a8)[_0xf742('0x29')](_0x3a0150);};}exports[_0xf742('0x2a')]=function(_0x28ad1f,_0x1279cf){var _0x18ed90={},_0x39dca3={},_0x55e686={'count':0x0,'rows':[]};var _0x30441c=_[_0xf742('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x4af8b2){return{'name':_0x4af8b2[_0xf742('0x2c')],'type':_0x4af8b2[_0xf742('0x2d')][_0xf742('0x2e')]};});_0x39dca3['model']=_[_0xf742('0x2b')](_0x30441c,_0xf742('0x28'));_0x39dca3[_0xf742('0x2f')]=_['keys'](_0x28ad1f[_0xf742('0x2f')]);_0x39dca3[_0xf742('0x30')]=_['intersection'](_0x39dca3[_0xf742('0x31')],_0x39dca3[_0xf742('0x2f')]);_0x18ed90[_0xf742('0x32')]=_[_0xf742('0x33')](_0x39dca3[_0xf742('0x31')],qs[_0xf742('0x34')](_0x28ad1f['query'][_0xf742('0x34')]));_0x18ed90[_0xf742('0x32')]=_0x18ed90['attributes'][_0xf742('0x35')]?_0x18ed90[_0xf742('0x32')]:_0x39dca3[_0xf742('0x31')];if(!_0x28ad1f[_0xf742('0x2f')][_0xf742('0x36')](_0xf742('0x37'))){_0x18ed90['limit']=qs[_0xf742('0x1e')](_0x28ad1f['query']['limit']);_0x18ed90['offset']=qs['offset'](_0x28ad1f[_0xf742('0x2f')][_0xf742('0x1c')]);}_0x18ed90[_0xf742('0x38')]=qs['sort'](_0x28ad1f[_0xf742('0x2f')][_0xf742('0x39')]);_0x18ed90[_0xf742('0x3a')]=qs[_0xf742('0x30')](_[_0xf742('0x3b')](_0x28ad1f['query'],_0x39dca3[_0xf742('0x30')]),_0x30441c);if(_0x28ad1f[_0xf742('0x2f')][_0xf742('0x3c')]){_0x18ed90[_0xf742('0x3a')]=_[_0xf742('0x3d')](_0x18ed90[_0xf742('0x3a')],{'$or':_['map'](_0x30441c,function(_0x205500){if(_0x205500[_0xf742('0x2d')]!==_0xf742('0x3e')){var _0x3e79f3={};_0x3e79f3[_0x205500['name']]={'$like':'%'+_0x28ad1f[_0xf742('0x2f')][_0xf742('0x3c')]+'%'};return _0x3e79f3;}})});}_0x18ed90=_[_0xf742('0x3d')]({},_0x18ed90,_0x28ad1f['options']);var _0x332db4={'where':_0x18ed90[_0xf742('0x3a')]};return db[_0xf742('0x3f')]['count'](_0x332db4)[_0xf742('0x26')](function(_0x3e2bf5){_0x55e686['count']=_0x3e2bf5;if(_0x28ad1f[_0xf742('0x2f')][_0xf742('0x40')]){_0x18ed90[_0xf742('0x41')]=[{'all':!![]}];}return db[_0xf742('0x3f')][_0xf742('0x42')](_0x18ed90);})['then'](function(_0x78e751){_0x55e686[_0xf742('0x43')]=_0x78e751;return _0x55e686;})[_0xf742('0x26')](respondWithFilteredResult(_0x1279cf,_0x18ed90))[_0xf742('0x44')](handleError(_0x1279cf,null));};exports[_0xf742('0x45')]=function(_0x2c1234,_0x163b7a){var _0x4dd9a3={'raw':![],'where':{'id':_0x2c1234['params']['id']}},_0x1c5629={};_0x1c5629['model']=_[_0xf742('0x46')](db[_0xf742('0x3f')][_0xf742('0x47')]);_0x1c5629[_0xf742('0x2f')]=_[_0xf742('0x46')](_0x2c1234[_0xf742('0x2f')]);_0x1c5629[_0xf742('0x30')]=_['intersection'](_0x1c5629[_0xf742('0x31')],_0x1c5629[_0xf742('0x2f')]);_0x4dd9a3[_0xf742('0x32')]=_[_0xf742('0x33')](_0x1c5629[_0xf742('0x31')],qs[_0xf742('0x34')](_0x2c1234[_0xf742('0x2f')][_0xf742('0x34')]));_0x4dd9a3[_0xf742('0x32')]=_0x4dd9a3[_0xf742('0x32')][_0xf742('0x35')]?_0x4dd9a3[_0xf742('0x32')]:_0x1c5629[_0xf742('0x31')];if(_0x2c1234[_0xf742('0x2f')][_0xf742('0x40')]){_0x4dd9a3[_0xf742('0x41')]=[{'all':!![]}];}_0x4dd9a3=_[_0xf742('0x3d')]({},_0x4dd9a3,_0x2c1234[_0xf742('0x48')]);return db[_0xf742('0x3f')]['find'](_0x4dd9a3)['then'](handleEntityNotFound(_0x163b7a,null))[_0xf742('0x26')](respondWithResult(_0x163b7a,null))['catch'](handleError(_0x163b7a,null));};exports[_0xf742('0x49')]=function(_0x3d84c4,_0x5f208b){return db[_0xf742('0x3f')][_0xf742('0x49')](_0x3d84c4[_0xf742('0x4a')],{})[_0xf742('0x26')](respondWithResult(_0x5f208b,0xc9))[_0xf742('0x44')](handleError(_0x5f208b,null));};exports[_0xf742('0x24')]=function(_0x394b99,_0x57df43){if(_0x394b99[_0xf742('0x4a')]['id']){delete _0x394b99['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x394b99['params']['id']}})['then'](handleEntityNotFound(_0x57df43,null))[_0xf742('0x26')](saveUpdates(_0x394b99[_0xf742('0x4a')],null))['then'](respondWithResult(_0x57df43,null))[_0xf742('0x44')](handleError(_0x57df43,null));};exports[_0xf742('0x25')]=function(_0x44b59a,_0x45f87a){return db[_0xf742('0x3f')][_0xf742('0x4b')]({'where':{'id':_0x44b59a[_0xf742('0x4c')]['id']}})[_0xf742('0x26')](handleEntityNotFound(_0x45f87a,null))[_0xf742('0x26')](removeEntity(_0x45f87a,null))[_0xf742('0x44')](handleError(_0x45f87a,null));};exports[_0xf742('0x4d')]=function(_0x36c786,_0x5ede6b,_0x43c6c6){var _0x175c83={};var _0x31ceec={};var _0x1473de;var _0xd9dc5b;return db[_0xf742('0x3f')][_0xf742('0x4e')]({'where':{'id':_0x36c786['params']['id']}})[_0xf742('0x26')](handleEntityNotFound(_0x5ede6b,null))[_0xf742('0x26')](function(_0x4d17c7){if(_0x4d17c7){_0x1473de=_0x4d17c7;_0x31ceec[_0xf742('0x31')]=_['keys'](db[_0xf742('0x4f')][_0xf742('0x47')]);_0x31ceec[_0xf742('0x2f')]=_[_0xf742('0x46')](_0x36c786['query']);_0x31ceec['filters']=_[_0xf742('0x33')](_0x31ceec[_0xf742('0x31')],_0x31ceec[_0xf742('0x2f')]);_0x175c83['attributes']=_[_0xf742('0x33')](_0x31ceec[_0xf742('0x31')],qs[_0xf742('0x34')](_0x36c786[_0xf742('0x2f')][_0xf742('0x34')]));_0x175c83[_0xf742('0x32')]=_0x175c83[_0xf742('0x32')][_0xf742('0x35')]?_0x175c83[_0xf742('0x32')]:_0x31ceec[_0xf742('0x31')];_0x175c83[_0xf742('0x38')]=qs['sort'](_0x36c786[_0xf742('0x2f')][_0xf742('0x39')]);_0x175c83[_0xf742('0x3a')]=qs[_0xf742('0x30')](_['pick'](_0x36c786[_0xf742('0x2f')],_0x31ceec[_0xf742('0x30')]));if(_0x36c786[_0xf742('0x2f')][_0xf742('0x3c')]){_0x175c83[_0xf742('0x3a')]=_[_0xf742('0x3d')](_0x175c83[_0xf742('0x3a')],{'$or':_[_0xf742('0x2b')](_0x175c83[_0xf742('0x32')],function(_0x235905){var _0x30ff49={};_0x30ff49[_0x235905]={'$like':'%'+_0x36c786[_0xf742('0x2f')][_0xf742('0x3c')]+'%'};return _0x30ff49;})});}_0x175c83=_[_0xf742('0x3d')]({},_0x175c83,_0x36c786[_0xf742('0x48')]);return _0x1473de['getConfigurations'](_0x175c83);}})['then'](function(_0x5949af){if(_0x5949af){_0xd9dc5b=_0x5949af[_0xf742('0x35')];if(!_0x36c786[_0xf742('0x2f')]['hasOwnProperty'](_0xf742('0x37'))){_0x175c83[_0xf742('0x1e')]=qs['limit'](_0x36c786['query'][_0xf742('0x1e')]);_0x175c83['offset']=qs['offset'](_0x36c786[_0xf742('0x2f')]['offset']);}return _0x1473de[_0xf742('0x4d')](_0x175c83);}})[_0xf742('0x26')](function(_0x20e62e){if(_0x20e62e){return _0x20e62e?{'count':_0xd9dc5b,'rows':_0x20e62e}:null;}})[_0xf742('0x26')](respondWithResult(_0x5ede6b,null))[_0xf742('0x44')](handleError(_0x5ede6b,null));};exports[_0xf742('0x50')]=function(_0x35609b,_0x418920,_0x56a16c){if(_0x35609b[_0xf742('0x4a')]['id']){delete _0x35609b['body']['id'];}return db[_0xf742('0x3f')][_0xf742('0x4e')]({'where':{'id':_0x35609b[_0xf742('0x4c')]['id']}})[_0xf742('0x26')](handleEntityNotFound(_0x418920,null))[_0xf742('0x26')](function(_0x125cb4){if(_0x125cb4){_0x35609b['body']['AccountId']=_0x125cb4['id'];_0x35609b['body']['Subjects']=integrations['getSubjects'](_0x35609b[_0xf742('0x4a')][_0xf742('0x51')],_0x35609b[_0xf742('0x4a')][_0xf742('0x2d')]);_0x35609b[_0xf742('0x4a')]['Descriptions']=integrations[_0xf742('0x52')](_0x35609b[_0xf742('0x4a')][_0xf742('0x51')],_0x35609b[_0xf742('0x4a')][_0xf742('0x2d')]);return db['FreshsalesConfiguration'][_0xf742('0x49')](_0x35609b[_0xf742('0x4a')],{'include':[{'model':db[_0xf742('0x53')],'as':_0xf742('0x54')},{'model':db[_0xf742('0x53')],'as':'Descriptions'}]});}return null;})[_0xf742('0x26')](respondWithResult(_0x418920,null))[_0xf742('0x44')](handleError(_0x418920,null));};exports['getFields']=function(_0x5f211c,_0xc58877,_0x4e72f7){var _0x56db3e='';var _0x13558b='';return db[_0xf742('0x3f')][_0xf742('0x4e')]({'where':{'id':_0x5f211c[_0xf742('0x4c')]['id']},'attributes':['id',_0xf742('0x55'),_0xf742('0x56'),'apiKey']})[_0xf742('0x26')](handleEntityNotFound(_0xc58877,null))[_0xf742('0x26')](function(_0x53ca92){if(_0x53ca92){_0x13558b=_0x53ca92[_0xf742('0x55')];_0x56db3e=_0x53ca92[_0xf742('0x56')];var _0x409a2e=_0x53ca92['remoteUri'][_0xf742('0x57')](-0x1);if(_0x409a2e==='/'){_0x56db3e=_0x56db3e[_0xf742('0x58')](0x0,_0x56db3e[_0xf742('0x59')](_0x409a2e));}return rp({'method':_0xf742('0x5a'),'uri':util[_0xf742('0x5b')]('%s%s',_0x56db3e,'/api/selector/owners'),'headers':{'Authorization':_0xf742('0x5c')+_0x53ca92['apiKey']},'json':!![]});}})[_0xf742('0x26')](function(_0x13eb55){if(_0x13eb55){var _0x596a0f=_0x13eb55[_0xf742('0x5d')];var _0x53d7c2=![];var _0xbe80d5=null;for(_0xbe80d5=0x0;_0xbe80d5<_0x596a0f[_0xf742('0x35')];_0xbe80d5++){if(_0x596a0f[_0xbe80d5][_0xf742('0x5e')]===_0x13558b){_0x53d7c2=!![];}}if(_0x53d7c2){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xf742('0x26')](respondWithResult(_0xc58877,null))[_0xf742('0x44')](function(_0x1ddb2d){var _0x5e7317=_0x5f211c[_0xf742('0x2f')][_0xf742('0x5f')]?0x1f4:_0x1ddb2d[_0xf742('0x60')]||0x1f4;logger[_0xf742('0x61')](_0xf742('0x62'),_0xf742('0x63'),_0x5e7317,JSON[_0xf742('0x64')](_0x1ddb2d));delete _0x1ddb2d[_0xf742('0x28')];if(_0x5e7317===0x191){_0x5e7317=0x190;}_0xc58877[_0xf742('0x19')](_0x5e7317)[_0xf742('0x29')](_0x5f211c[_0xf742('0x2f')][_0xf742('0x5f')]?{'message':_0xf742('0x65'),'statusCode':_0x1ddb2d['statusCode']}:_0x1ddb2d);});}; \ No newline at end of file +var _0xfbaa=['includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','getConfigurations','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Subjects','Descriptions','getFields','findOne','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../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','Content-Range','apply','save','update','then','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options'];(function(_0x294726,_0x5db9e9){var _0x39e2e3=function(_0x50041d){while(--_0x50041d){_0x294726['push'](_0x294726['shift']());}};_0x39e2e3(++_0x5db9e9);}(_0xfbaa,0x100));var _0xafba=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0xfbaa[_0x186d17];return _0x5d4b89;};'use strict';var emlformat=require(_0xafba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafba('0x1'));var jsonpatch=require(_0xafba('0x2'));var rp=require(_0xafba('0x3'));var moment=require('moment');var BPromise=require(_0xafba('0x4'));var Mustache=require(_0xafba('0x5'));var util=require(_0xafba('0x6'));var path=require(_0xafba('0x7'));var sox=require(_0xafba('0x8'));var csv=require(_0xafba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xafba('0xa'));var crypto=require(_0xafba('0xb'));var jsforce=require(_0xafba('0xc'));var deskjs=require(_0xafba('0xd'));var toCsv=require(_0xafba('0x9'));var querystring=require('querystring');var Papa=require(_0xafba('0xe'));var Redis=require('ioredis');var authService=require(_0xafba('0xf'));var qs=require(_0xafba('0x10'));var as=require(_0xafba('0x11'));var hardwareService=require(_0xafba('0x12'));var logger=require('../../config/logger')(_0xafba('0x13'));var utils=require(_0xafba('0x14'));var config=require(_0xafba('0x15'));var licenseUtil=require(_0xafba('0x16'));var db=require(_0xafba('0x17'))['db'];var integrations=require(_0xafba('0x18'));function respondWithStatusCode(_0x11faff,_0x4bc68f){_0x4bc68f=_0x4bc68f||0xcc;return function(_0x497247){if(_0x497247){return _0x11faff[_0xafba('0x19')](_0x4bc68f);}return _0x11faff[_0xafba('0x1a')](_0x4bc68f)[_0xafba('0x1b')]();};}function respondWithResult(_0x3da04e,_0x5c08e0){_0x5c08e0=_0x5c08e0||0xc8;return function(_0x5685c5){if(_0x5685c5){return _0x3da04e[_0xafba('0x1a')](_0x5c08e0)[_0xafba('0x1c')](_0x5685c5);}};}function respondWithFilteredResult(_0x44cdc5,_0x18f29e){return function(_0xf68dd){if(_0xf68dd){var _0x1e5473=typeof _0x18f29e[_0xafba('0x1d')]===_0xafba('0x1e')&&typeof _0x18f29e[_0xafba('0x1f')]==='undefined';var _0x1dce91=_0xf68dd[_0xafba('0x20')];var _0xdbb7b2=_0x1e5473?0x0:_0x18f29e[_0xafba('0x1d')];var _0x386c92=_0x1e5473?_0xf68dd['count']:_0x18f29e['offset']+_0x18f29e[_0xafba('0x1f')];var _0x1c1e89;if(_0x386c92>=_0x1dce91){_0x386c92=_0x1dce91;_0x1c1e89=0xc8;}else{_0x1c1e89=0xce;}_0x44cdc5[_0xafba('0x1a')](_0x1c1e89);return _0x44cdc5[_0xafba('0x21')](_0xafba('0x22'),_0xdbb7b2+'-'+_0x386c92+'/'+_0x1dce91)[_0xafba('0x1c')](_0xf68dd);}return null;};}function patchUpdates(_0x1ab8e2){return function(_0x4df634){try{jsonpatch[_0xafba('0x23')](_0x4df634,_0x1ab8e2,!![]);}catch(_0x3542ae){return BPromise['reject'](_0x3542ae);}return _0x4df634[_0xafba('0x24')]();};}function saveUpdates(_0x3a2a93,_0x1fd960){return function(_0x26730e){if(_0x26730e){return _0x26730e[_0xafba('0x25')](_0x3a2a93)[_0xafba('0x26')](function(_0x36e087){return _0x36e087;});}return null;};}function removeEntity(_0x4c0c15,_0x1a0e8b){return function(_0x43d48a){if(_0x43d48a){return _0x43d48a['destroy']()[_0xafba('0x26')](function(){_0x4c0c15['status'](0xcc)[_0xafba('0x1b')]();});}};}function handleEntityNotFound(_0x1650ff,_0x12a8ac){return function(_0x5dd220){if(!_0x5dd220){_0x1650ff[_0xafba('0x19')](0x194);}return _0x5dd220;};}function handleError(_0x29bde5,_0x19c255){_0x19c255=_0x19c255||0x1f4;return function(_0x511e1c){logger[_0xafba('0x27')](_0x511e1c[_0xafba('0x28')]);if(_0x511e1c[_0xafba('0x29')]){delete _0x511e1c[_0xafba('0x29')];}_0x29bde5[_0xafba('0x1a')](_0x19c255)['send'](_0x511e1c);};}exports[_0xafba('0x2a')]=function(_0x5eef98,_0x13a68a){var _0xc98f85={},_0x27a139={},_0x5cd6ff={'count':0x0,'rows':[]};var _0x5bb1d9=_[_0xafba('0x2b')](db[_0xafba('0x2c')][_0xafba('0x2d')],function(_0x70da2d){return{'name':_0x70da2d[_0xafba('0x2e')],'type':_0x70da2d['type'][_0xafba('0x2f')]};});_0x27a139['model']=_[_0xafba('0x2b')](_0x5bb1d9,_0xafba('0x29'));_0x27a139[_0xafba('0x30')]=_[_0xafba('0x31')](_0x5eef98[_0xafba('0x30')]);_0x27a139['filters']=_[_0xafba('0x32')](_0x27a139[_0xafba('0x33')],_0x27a139[_0xafba('0x30')]);_0xc98f85[_0xafba('0x34')]=_[_0xafba('0x32')](_0x27a139[_0xafba('0x33')],qs[_0xafba('0x35')](_0x5eef98['query'][_0xafba('0x35')]));_0xc98f85[_0xafba('0x34')]=_0xc98f85[_0xafba('0x34')][_0xafba('0x36')]?_0xc98f85['attributes']:_0x27a139[_0xafba('0x33')];if(!_0x5eef98['query']['hasOwnProperty'](_0xafba('0x37'))){_0xc98f85['limit']=qs[_0xafba('0x1f')](_0x5eef98['query'][_0xafba('0x1f')]);_0xc98f85[_0xafba('0x1d')]=qs['offset'](_0x5eef98[_0xafba('0x30')][_0xafba('0x1d')]);}_0xc98f85[_0xafba('0x38')]=qs['sort'](_0x5eef98[_0xafba('0x30')]['sort']);_0xc98f85[_0xafba('0x39')]=qs[_0xafba('0x3a')](_[_0xafba('0x3b')](_0x5eef98[_0xafba('0x30')],_0x27a139[_0xafba('0x3a')]),_0x5bb1d9);if(_0x5eef98['query'][_0xafba('0x3c')]){_0xc98f85[_0xafba('0x39')]=_[_0xafba('0x3d')](_0xc98f85['where'],{'$or':_[_0xafba('0x2b')](_0x5bb1d9,function(_0xd8597e){if(_0xd8597e[_0xafba('0x3e')]!==_0xafba('0x3f')){var _0x2363c5={};_0x2363c5[_0xd8597e[_0xafba('0x29')]]={'$like':'%'+_0x5eef98[_0xafba('0x30')][_0xafba('0x3c')]+'%'};return _0x2363c5;}})});}_0xc98f85=_[_0xafba('0x3d')]({},_0xc98f85,_0x5eef98[_0xafba('0x40')]);var _0x3a3b6e={'where':_0xc98f85['where']};return db['FreshsalesAccount'][_0xafba('0x20')](_0x3a3b6e)[_0xafba('0x26')](function(_0x18fa92){_0x5cd6ff['count']=_0x18fa92;if(_0x5eef98[_0xafba('0x30')][_0xafba('0x41')]){_0xc98f85[_0xafba('0x42')]=[{'all':!![]}];}return db[_0xafba('0x2c')][_0xafba('0x43')](_0xc98f85);})[_0xafba('0x26')](function(_0x2c1a5f){_0x5cd6ff[_0xafba('0x44')]=_0x2c1a5f;return _0x5cd6ff;})[_0xafba('0x26')](respondWithFilteredResult(_0x13a68a,_0xc98f85))[_0xafba('0x45')](handleError(_0x13a68a,null));};exports[_0xafba('0x46')]=function(_0x2c1554,_0x5719bf){var _0x527df5={'raw':![],'where':{'id':_0x2c1554[_0xafba('0x47')]['id']}},_0x307039={};_0x307039[_0xafba('0x33')]=_[_0xafba('0x31')](db[_0xafba('0x2c')][_0xafba('0x2d')]);_0x307039[_0xafba('0x30')]=_[_0xafba('0x31')](_0x2c1554[_0xafba('0x30')]);_0x307039['filters']=_[_0xafba('0x32')](_0x307039['model'],_0x307039['query']);_0x527df5[_0xafba('0x34')]=_[_0xafba('0x32')](_0x307039[_0xafba('0x33')],qs[_0xafba('0x35')](_0x2c1554['query'][_0xafba('0x35')]));_0x527df5[_0xafba('0x34')]=_0x527df5[_0xafba('0x34')][_0xafba('0x36')]?_0x527df5[_0xafba('0x34')]:_0x307039['model'];if(_0x2c1554[_0xafba('0x30')][_0xafba('0x41')]){_0x527df5['include']=[{'all':!![]}];}_0x527df5=_[_0xafba('0x3d')]({},_0x527df5,_0x2c1554['options']);return db[_0xafba('0x2c')]['find'](_0x527df5)[_0xafba('0x26')](handleEntityNotFound(_0x5719bf,null))[_0xafba('0x26')](respondWithResult(_0x5719bf,null))['catch'](handleError(_0x5719bf,null));};exports['create']=function(_0x1ca411,_0x22728b){return db[_0xafba('0x2c')][_0xafba('0x48')](_0x1ca411[_0xafba('0x49')],{})['then'](respondWithResult(_0x22728b,0xc9))[_0xafba('0x45')](handleError(_0x22728b,null));};exports[_0xafba('0x25')]=function(_0x5c8c6c,_0x526a59){if(_0x5c8c6c[_0xafba('0x49')]['id']){delete _0x5c8c6c[_0xafba('0x49')]['id'];}return db[_0xafba('0x2c')][_0xafba('0x4a')]({'where':{'id':_0x5c8c6c[_0xafba('0x47')]['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x526a59,null))[_0xafba('0x26')](saveUpdates(_0x5c8c6c['body'],null))[_0xafba('0x26')](respondWithResult(_0x526a59,null))[_0xafba('0x45')](handleError(_0x526a59,null));};exports[_0xafba('0x4b')]=function(_0x1f8634,_0x23edd2){return db['FreshsalesAccount'][_0xafba('0x4a')]({'where':{'id':_0x1f8634['params']['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x23edd2,null))[_0xafba('0x26')](removeEntity(_0x23edd2,null))[_0xafba('0x45')](handleError(_0x23edd2,null));};exports[_0xafba('0x4c')]=function(_0x4fdee3,_0x13cb6d,_0x4eed73){var _0x215357={};var _0x27c834={};var _0x35718c;var _0x3821a2;return db[_0xafba('0x2c')]['findOne']({'where':{'id':_0x4fdee3[_0xafba('0x47')]['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x13cb6d,null))[_0xafba('0x26')](function(_0x1970f1){if(_0x1970f1){_0x35718c=_0x1970f1;_0x27c834[_0xafba('0x33')]=_[_0xafba('0x31')](db['FreshsalesConfiguration'][_0xafba('0x2d')]);_0x27c834[_0xafba('0x30')]=_[_0xafba('0x31')](_0x4fdee3[_0xafba('0x30')]);_0x27c834['filters']=_[_0xafba('0x32')](_0x27c834[_0xafba('0x33')],_0x27c834['query']);_0x215357['attributes']=_[_0xafba('0x32')](_0x27c834[_0xafba('0x33')],qs[_0xafba('0x35')](_0x4fdee3[_0xafba('0x30')][_0xafba('0x35')]));_0x215357[_0xafba('0x34')]=_0x215357[_0xafba('0x34')]['length']?_0x215357[_0xafba('0x34')]:_0x27c834[_0xafba('0x33')];_0x215357[_0xafba('0x38')]=qs[_0xafba('0x4d')](_0x4fdee3[_0xafba('0x30')][_0xafba('0x4d')]);_0x215357[_0xafba('0x39')]=qs[_0xafba('0x3a')](_[_0xafba('0x3b')](_0x4fdee3[_0xafba('0x30')],_0x27c834[_0xafba('0x3a')]));if(_0x4fdee3['query'][_0xafba('0x3c')]){_0x215357[_0xafba('0x39')]=_[_0xafba('0x3d')](_0x215357['where'],{'$or':_['map'](_0x215357[_0xafba('0x34')],function(_0x402037){var _0x366c49={};_0x366c49[_0x402037]={'$like':'%'+_0x4fdee3[_0xafba('0x30')][_0xafba('0x3c')]+'%'};return _0x366c49;})});}_0x215357=_[_0xafba('0x3d')]({},_0x215357,_0x4fdee3[_0xafba('0x40')]);return _0x35718c['getConfigurations'](_0x215357);}})[_0xafba('0x26')](function(_0x47b47e){if(_0x47b47e){_0x3821a2=_0x47b47e['length'];if(!_0x4fdee3[_0xafba('0x30')][_0xafba('0x4e')](_0xafba('0x37'))){_0x215357[_0xafba('0x1f')]=qs[_0xafba('0x1f')](_0x4fdee3['query'][_0xafba('0x1f')]);_0x215357[_0xafba('0x1d')]=qs[_0xafba('0x1d')](_0x4fdee3[_0xafba('0x30')][_0xafba('0x1d')]);}return _0x35718c['getConfigurations'](_0x215357);}})[_0xafba('0x26')](function(_0x29b9a5){if(_0x29b9a5){return _0x29b9a5?{'count':_0x3821a2,'rows':_0x29b9a5}:null;}})[_0xafba('0x26')](respondWithResult(_0x13cb6d,null))[_0xafba('0x45')](handleError(_0x13cb6d,null));};exports[_0xafba('0x4f')]=function(_0x19316a,_0x57dca7,_0x11a6c5){if(_0x19316a[_0xafba('0x49')]['id']){delete _0x19316a[_0xafba('0x49')]['id'];}return db[_0xafba('0x2c')]['findOne']({'where':{'id':_0x19316a['params']['id']}})[_0xafba('0x26')](handleEntityNotFound(_0x57dca7,null))[_0xafba('0x26')](function(_0x2fc4b6){if(_0x2fc4b6){_0x19316a[_0xafba('0x49')][_0xafba('0x50')]=_0x2fc4b6['id'];_0x19316a[_0xafba('0x49')]['Subjects']=integrations[_0xafba('0x51')](_0x19316a[_0xafba('0x49')][_0xafba('0x52')],_0x19316a[_0xafba('0x49')][_0xafba('0x3e')]);_0x19316a[_0xafba('0x49')]['Descriptions']=integrations['getDescriptions'](_0x19316a[_0xafba('0x49')]['channel'],_0x19316a[_0xafba('0x49')][_0xafba('0x3e')]);return db[_0xafba('0x53')][_0xafba('0x48')](_0x19316a[_0xafba('0x49')],{'include':[{'model':db[_0xafba('0x54')],'as':_0xafba('0x55')},{'model':db[_0xafba('0x54')],'as':_0xafba('0x56')}]});}return null;})[_0xafba('0x26')](respondWithResult(_0x57dca7,null))['catch'](handleError(_0x57dca7,null));};exports[_0xafba('0x57')]=function(_0x2b1198,_0x53edf3,_0x4845be){var _0x54d996='';var _0x5acab4='';return db[_0xafba('0x2c')][_0xafba('0x58')]({'where':{'id':_0x2b1198[_0xafba('0x47')]['id']},'attributes':['id',_0xafba('0x59'),_0xafba('0x5a'),_0xafba('0x5b')]})[_0xafba('0x26')](handleEntityNotFound(_0x53edf3,null))[_0xafba('0x26')](function(_0x22040f){if(_0x22040f){_0x5acab4=_0x22040f[_0xafba('0x59')];_0x54d996=_0x22040f[_0xafba('0x5a')];var _0x4482bc=_0x22040f[_0xafba('0x5a')]['slice'](-0x1);if(_0x4482bc==='/'){_0x54d996=_0x54d996[_0xafba('0x5c')](0x0,_0x54d996[_0xafba('0x5d')](_0x4482bc));}return rp({'method':_0xafba('0x5e'),'uri':util[_0xafba('0x5f')](_0xafba('0x60'),_0x54d996,_0xafba('0x61')),'headers':{'Authorization':_0xafba('0x62')+_0x22040f['apiKey']},'json':!![]});}})[_0xafba('0x26')](function(_0x284dfc){if(_0x284dfc){var _0x34af80=_0x284dfc['users'];var _0x27eac8=![];var _0xdf5237=null;for(_0xdf5237=0x0;_0xdf5237<_0x34af80['length'];_0xdf5237++){if(_0x34af80[_0xdf5237][_0xafba('0x63')]===_0x5acab4){_0x27eac8=!![];}}if(_0x27eac8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xafba('0x64')});}}})[_0xafba('0x26')](respondWithResult(_0x53edf3,null))[_0xafba('0x45')](function(_0x3a9968){var _0x5c2e89=_0x2b1198[_0xafba('0x30')][_0xafba('0x65')]?0x1f4:_0x3a9968['statusCode']||0x1f4;logger[_0xafba('0x27')](_0xafba('0x66'),_0xafba('0x57'),_0x5c2e89,JSON[_0xafba('0x67')](_0x3a9968));delete _0x3a9968['name'];if(_0x5c2e89===0x191){_0x5c2e89=0x190;}_0x53edf3[_0xafba('0x1a')](_0x5c2e89)[_0xafba('0x68')](_0x2b1198[_0xafba('0x30')]['test']?{'message':_0xafba('0x69'),'statusCode':_0x3a9968[_0xafba('0x6a')]}:_0x3a9968);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index eb7ad98..32a6ed7 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 _0xc2c7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_freshsales_accounts'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3e4780,_0x2d887c){_0x3e4780=_0x3e4780-0x0;var _0x2b19d2=_0xc2c7[_0x3e4780];return _0x2b19d2;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x7c2c('0x8'));module[_0x7c2c('0x9')]=function(_0x23c038,_0x54f027){return _0x23c038['define']('FreshsalesAccount',attributes,{'tableName':_0x7c2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x4e4c02,_0x42cb3d){var _0x522aed=function(_0x98c2e1){while(--_0x98c2e1){_0x4e4c02['push'](_0x4e4c02['shift']());}};_0x522aed(++_0x42cb3d);}(_0x430c,0x1a1));var _0xc430=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x430c[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('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(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'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 fff4d5b..2093c01 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 _0x583c=['raw','where','attributes','limit','map','include','model','debug','stringify','catch','ShowFreshsalesAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x583c,0x12b));var _0xc583=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x583c[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});}exports[_0xc583('0x12')]=function(_0x8a2d84){var _0x12aac2=this;return new Promise(function(_0x36e0fd,_0x5433ec){return db[_0xc583('0x13')]['findAll']({'raw':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x15')]===undefined?!![]:![]:!![],'where':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x17')]||null:null,'limit':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x18')]||null:null,'include':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84['options']['include']?_[_0xc583('0x19')](_0x8a2d84[_0xc583('0x14')][_0xc583('0x1a')],function(_0x5ceef1){return{'model':db[_0x5ceef1[_0xc583('0x1b')]],'as':_0x5ceef1['as'],'attributes':_0x5ceef1[_0xc583('0x17')],'include':_0x5ceef1[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x5ceef1[_0xc583('0x1a')],function(_0x48c95e){return{'model':db[_0x48c95e['model']],'as':_0x48c95e['as'],'attributes':_0x48c95e[_0xc583('0x17')],'include':_0x48c95e['include']?_[_0xc583('0x19')](_0x48c95e[_0xc583('0x1a')],function(_0xbabf24){return{'model':db[_0xbabf24[_0xc583('0x1b')]],'as':_0xbabf24['as'],'attributes':_0xbabf24[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dafb4){logger[_0xc583('0xb')]('GetFreshsalesAccount',_0x8a2d84);logger[_0xc583('0x1c')]('GetFreshsalesAccount',_0x8a2d84,JSON[_0xc583('0x1d')](_0x2dafb4));_0x36e0fd(_0x2dafb4);})[_0xc583('0x1e')](function(_0x1c80b1){logger[_0xc583('0xf')](_0xc583('0x12'),_0x1c80b1[_0xc583('0x10')],_0x8a2d84);_0x5433ec(_0x12aac2[_0xc583('0xf')](0x1f4,_0x1c80b1['message']));});});};exports[_0xc583('0x1f')]=function(_0x390bc3){var _0x23f3a4=this;return new Promise(function(_0xcbf1f1,_0x1dd665){return db[_0xc583('0x13')]['find']({'raw':_0x390bc3[_0xc583('0x14')]?_0x390bc3['options']['raw']===undefined?!![]:![]:!![],'where':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')]['attributes']||null:null,'include':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x1a')]?_['map'](_0x390bc3[_0xc583('0x14')]['include'],function(_0x1aa62a){return{'model':db[_0x1aa62a[_0xc583('0x1b')]],'as':_0x1aa62a['as'],'attributes':_0x1aa62a[_0xc583('0x17')],'include':_0x1aa62a[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x1aa62a['include'],function(_0x242728){return{'model':db[_0x242728['model']],'as':_0x242728['as'],'attributes':_0x242728[_0xc583('0x17')],'include':_0x242728['include']?_[_0xc583('0x19')](_0x242728[_0xc583('0x1a')],function(_0x7d89d0){return{'model':db[_0x7d89d0[_0xc583('0x1b')]],'as':_0x7d89d0['as'],'attributes':_0x7d89d0[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc583('0xa')](function(_0x54200c){logger['info'](_0xc583('0x1f'),_0x390bc3);logger[_0xc583('0x1c')]('ShowFreshsalesAccount',_0x390bc3,JSON[_0xc583('0x1d')](_0x54200c));_0xcbf1f1(_0x54200c);})[_0xc583('0x1e')](function(_0x22de5a){logger[_0xc583('0xf')](_0xc583('0x1f'),_0x22de5a[_0xc583('0x10')],_0x390bc3);_0x1dd665(_0x23f3a4['error'](0x1f4,_0x22de5a[_0xc583('0x10')]));});});}; \ No newline at end of file +var _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8c1b55,_0x2082c0){var _0x33089d=function(_0x456e42){while(--_0x456e42){_0x8c1b55['push'](_0x8c1b55['shift']());}};_0x33089d(++_0x2082c0);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xfcf0[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 94ed46b..d6b1827 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 _0x0d13=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0xee1808,_0x329495){var _0x1741aa=function(_0xc82391){while(--_0xc82391){_0xee1808['push'](_0xee1808['shift']());}};_0x1741aa(++_0x329495);}(_0x0d13,0xd4));var _0x30d1=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0d13[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0x30d1('0x0'));var util=require(_0x30d1('0x1'));var path=require('path');var timeout=require(_0x30d1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x30d1('0x3'));var auth=require(_0x30d1('0x4'));var interaction=require(_0x30d1('0x5'));var config=require(_0x30d1('0x6'));var controller=require(_0x30d1('0x7'));router[_0x30d1('0x8')]('/',auth[_0x30d1('0x9')](),controller[_0x30d1('0xa')]);router[_0x30d1('0x8')](_0x30d1('0xb'),auth['isAuthenticated'](),controller[_0x30d1('0xc')]);router['get']('/:id/subjects',auth[_0x30d1('0x9')](),controller[_0x30d1('0xd')]);router[_0x30d1('0x8')](_0x30d1('0xe'),auth[_0x30d1('0x9')](),controller[_0x30d1('0xf')]);router[_0x30d1('0x8')](_0x30d1('0x10'),auth[_0x30d1('0x9')](),controller[_0x30d1('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x30d1('0x12')]);router[_0x30d1('0x13')](_0x30d1('0xb'),auth[_0x30d1('0x9')](),controller[_0x30d1('0x14')]);router[_0x30d1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x30d1('0x16')]);module[_0x30d1('0x17')]=router; \ No newline at end of file +var _0xc4cc=['index','get','show','/:id/subjects','/:id/descriptions','isAuthenticated','getFields','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xc4cc,0x158));var _0xcc4c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc4cc[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xcc4c('0x0'));var util=require('util');var path=require(_0xcc4c('0x1'));var timeout=require(_0xcc4c('0x2'));var express=require(_0xcc4c('0x3'));var router=express['Router']();var fs_extra=require(_0xcc4c('0x4'));var auth=require(_0xcc4c('0x5'));var interaction=require(_0xcc4c('0x6'));var config=require('../../config/environment');var controller=require(_0xcc4c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc4c('0x8')]);router[_0xcc4c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xcc4c('0xa')]);router[_0xcc4c('0x9')](_0xcc4c('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xcc4c('0x9')](_0xcc4c('0xc'),auth[_0xcc4c('0xd')](),controller['getDescriptions']);router[_0xcc4c('0x9')]('/:id/fields',auth[_0xcc4c('0xd')](),controller[_0xcc4c('0xe')]);router[_0xcc4c('0xf')]('/',auth[_0xcc4c('0xd')](),controller[_0xcc4c('0x10')]);router[_0xcc4c('0x11')](_0xcc4c('0x12'),auth[_0xcc4c('0xd')](),controller[_0xcc4c('0x13')]);router[_0xcc4c('0x14')](_0xcc4c('0x12'),auth[_0xcc4c('0xd')](),controller['destroy']);module[_0xcc4c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c43b8fe..4c004ca 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 _0x999a=['exports','STRING'];(function(_0x1faec2,_0x1f863){var _0x8e342f=function(_0x8d2c4d){while(--_0x8d2c4d){_0x1faec2['push'](_0x1faec2['shift']());}};_0x8e342f(++_0x1f863);}(_0x999a,0x182));var _0xa999=function(_0x15592c,_0x3db0cb){_0x15592c=_0x15592c-0x0;var _0x25f537=_0x999a[_0x15592c];return _0x25f537;};'use strict';var Sequelize=require('sequelize');module[_0xa999('0x0')]={'name':{'type':Sequelize[_0xa999('0x1')]},'description':{'type':Sequelize[_0xa999('0x1')]}}; \ No newline at end of file +var _0xa29b=['sequelize','exports','STRING'];(function(_0x49e2ee,_0x1f0dc3){var _0x4c0f50=function(_0x1f34a2){while(--_0x1f34a2){_0x49e2ee['push'](_0x49e2ee['shift']());}};_0x4c0f50(++_0x1f0dc3);}(_0xa29b,0xae));var _0xba29=function(_0x34edc6,_0x4a0b01){_0x34edc6=_0x34edc6-0x0;var _0x5788b1=_0xa29b[_0x34edc6];return _0x5788b1;};'use strict';var Sequelize=require(_0xba29('0x0'));module[_0xba29('0x1')]={'name':{'type':Sequelize[_0xba29('0x2')]},'description':{'type':Sequelize[_0xba29('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0fc69c1..cdbf698 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 _0xb5bc=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesConfiguration','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4b6ccc,_0x146dc3){var _0x15e250=function(_0xef70d5){while(--_0xef70d5){_0x4b6ccc['push'](_0x4b6ccc['shift']());}};_0x15e250(++_0x146dc3);}(_0xb5bc,0x195));var _0xcb5b=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0xb5bc[_0x47623f];return _0x282ce8;};'use strict';var emlformat=require(_0xcb5b('0x0'));var rimraf=require(_0xcb5b('0x1'));var zipdir=require(_0xcb5b('0x2'));var jsonpatch=require(_0xcb5b('0x3'));var rp=require('request-promise');var moment=require(_0xcb5b('0x4'));var BPromise=require(_0xcb5b('0x5'));var Mustache=require(_0xcb5b('0x6'));var util=require(_0xcb5b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcb5b('0x8'));var ejs=require(_0xcb5b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb5b('0xa'));var squel=require(_0xcb5b('0xb'));var crypto=require(_0xcb5b('0xc'));var jsforce=require(_0xcb5b('0xd'));var deskjs=require(_0xcb5b('0xe'));var toCsv=require(_0xcb5b('0x8'));var querystring=require(_0xcb5b('0xf'));var Papa=require(_0xcb5b('0x10'));var Redis=require('ioredis');var authService=require(_0xcb5b('0x11'));var qs=require(_0xcb5b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb5b('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcb5b('0x14'));var licenseUtil=require(_0xcb5b('0x15'));var db=require(_0xcb5b('0x16'))['db'];function respondWithStatusCode(_0x27a520,_0x46e8d5){_0x46e8d5=_0x46e8d5||0xcc;return function(_0x418ad7){if(_0x418ad7){return _0x27a520[_0xcb5b('0x17')](_0x46e8d5);}return _0x27a520['status'](_0x46e8d5)[_0xcb5b('0x18')]();};}function respondWithResult(_0xacdfbd,_0x3f9877){_0x3f9877=_0x3f9877||0xc8;return function(_0x213475){if(_0x213475){return _0xacdfbd[_0xcb5b('0x19')](_0x3f9877)[_0xcb5b('0x1a')](_0x213475);}};}function respondWithFilteredResult(_0x2c59d9,_0x2aba1d){return function(_0x4f1ef5){if(_0x4f1ef5){var _0x278e87=typeof _0x2aba1d[_0xcb5b('0x1b')]==='undefined'&&typeof _0x2aba1d['limit']===_0xcb5b('0x1c');var _0x3e4940=_0x4f1ef5[_0xcb5b('0x1d')];var _0x11646f=_0x278e87?0x0:_0x2aba1d['offset'];var _0x5ae39c=_0x278e87?_0x4f1ef5[_0xcb5b('0x1d')]:_0x2aba1d['offset']+_0x2aba1d[_0xcb5b('0x1e')];var _0x952c22;if(_0x5ae39c>=_0x3e4940){_0x5ae39c=_0x3e4940;_0x952c22=0xc8;}else{_0x952c22=0xce;}_0x2c59d9[_0xcb5b('0x19')](_0x952c22);return _0x2c59d9['set']('Content-Range',_0x11646f+'-'+_0x5ae39c+'/'+_0x3e4940)['json'](_0x4f1ef5);}return null;};}function patchUpdates(_0x18a030){return function(_0x42abdb){try{jsonpatch[_0xcb5b('0x1f')](_0x42abdb,_0x18a030,!![]);}catch(_0x3f45f3){return BPromise[_0xcb5b('0x20')](_0x3f45f3);}return _0x42abdb[_0xcb5b('0x21')]();};}function saveUpdates(_0x4e786d,_0x40eb06){return function(_0x22c637){if(_0x22c637){return _0x22c637[_0xcb5b('0x22')](_0x4e786d)[_0xcb5b('0x23')](function(_0x216151){return _0x216151;});}return null;};}function removeEntity(_0x706bc5,_0x853ad4){return function(_0x3ddaa8){if(_0x3ddaa8){return _0x3ddaa8[_0xcb5b('0x24')]()[_0xcb5b('0x23')](function(){_0x706bc5[_0xcb5b('0x19')](0xcc)[_0xcb5b('0x18')]();});}};}function handleEntityNotFound(_0x5cc823,_0x435d9b){return function(_0x7a3903){if(!_0x7a3903){_0x5cc823['sendStatus'](0x194);}return _0x7a3903;};}function handleError(_0x46d74e,_0x169517){_0x169517=_0x169517||0x1f4;return function(_0xfaeb90){logger[_0xcb5b('0x25')](_0xfaeb90['stack']);if(_0xfaeb90[_0xcb5b('0x26')]){delete _0xfaeb90[_0xcb5b('0x26')];}_0x46d74e[_0xcb5b('0x19')](_0x169517)[_0xcb5b('0x27')](_0xfaeb90);};}exports[_0xcb5b('0x28')]=function(_0x280c89,_0x3a5587){var _0x27cf8e={},_0x3f01fa={},_0xf5fe9e={'count':0x0,'rows':[]};var _0x565d78=_[_0xcb5b('0x29')](db[_0xcb5b('0x2a')]['rawAttributes'],function(_0xe97271){return{'name':_0xe97271[_0xcb5b('0x2b')],'type':_0xe97271[_0xcb5b('0x2c')]['key']};});_0x3f01fa[_0xcb5b('0x2d')]=_[_0xcb5b('0x29')](_0x565d78,_0xcb5b('0x26'));_0x3f01fa['query']=_[_0xcb5b('0x2e')](_0x280c89[_0xcb5b('0x2f')]);_0x3f01fa[_0xcb5b('0x30')]=_[_0xcb5b('0x31')](_0x3f01fa[_0xcb5b('0x2d')],_0x3f01fa['query']);_0x27cf8e['attributes']=_[_0xcb5b('0x31')](_0x3f01fa[_0xcb5b('0x2d')],qs[_0xcb5b('0x32')](_0x280c89[_0xcb5b('0x2f')]['fields']));_0x27cf8e[_0xcb5b('0x33')]=_0x27cf8e[_0xcb5b('0x33')][_0xcb5b('0x34')]?_0x27cf8e[_0xcb5b('0x33')]:_0x3f01fa[_0xcb5b('0x2d')];if(!_0x280c89['query'][_0xcb5b('0x35')](_0xcb5b('0x36'))){_0x27cf8e[_0xcb5b('0x1e')]=qs['limit'](_0x280c89[_0xcb5b('0x2f')][_0xcb5b('0x1e')]);_0x27cf8e[_0xcb5b('0x1b')]=qs[_0xcb5b('0x1b')](_0x280c89[_0xcb5b('0x2f')][_0xcb5b('0x1b')]);}_0x27cf8e[_0xcb5b('0x37')]=qs['sort'](_0x280c89[_0xcb5b('0x2f')][_0xcb5b('0x38')]);_0x27cf8e[_0xcb5b('0x39')]=qs['filters'](_[_0xcb5b('0x3a')](_0x280c89[_0xcb5b('0x2f')],_0x3f01fa['filters']),_0x565d78);if(_0x280c89['query'][_0xcb5b('0x3b')]){_0x27cf8e[_0xcb5b('0x39')]=_['merge'](_0x27cf8e[_0xcb5b('0x39')],{'$or':_[_0xcb5b('0x29')](_0x565d78,function(_0x4d6c74){if(_0x4d6c74[_0xcb5b('0x2c')]!==_0xcb5b('0x3c')){var _0x27f495={};_0x27f495[_0x4d6c74[_0xcb5b('0x26')]]={'$like':'%'+_0x280c89['query'][_0xcb5b('0x3b')]+'%'};return _0x27f495;}})});}_0x27cf8e=_[_0xcb5b('0x3d')]({},_0x27cf8e,_0x280c89[_0xcb5b('0x3e')]);var _0x4e5e4e={'where':_0x27cf8e['where']};return db['FreshsalesConfiguration'][_0xcb5b('0x1d')](_0x4e5e4e)[_0xcb5b('0x23')](function(_0x75153){_0xf5fe9e[_0xcb5b('0x1d')]=_0x75153;if(_0x280c89[_0xcb5b('0x2f')][_0xcb5b('0x3f')]){_0x27cf8e[_0xcb5b('0x40')]=[{'all':!![]}];}return db[_0xcb5b('0x2a')]['findAll'](_0x27cf8e);})[_0xcb5b('0x23')](function(_0x407377){_0xf5fe9e[_0xcb5b('0x41')]=_0x407377;return _0xf5fe9e;})['then'](respondWithFilteredResult(_0x3a5587,_0x27cf8e))[_0xcb5b('0x42')](handleError(_0x3a5587,null));};exports['show']=function(_0x5667ac,_0x3fa482){var _0x5187ad={'raw':![],'where':{'id':_0x5667ac[_0xcb5b('0x43')]['id']}},_0x1d8bb8={};_0x1d8bb8[_0xcb5b('0x2d')]=_[_0xcb5b('0x2e')](db['FreshsalesConfiguration'][_0xcb5b('0x44')]);_0x1d8bb8['query']=_[_0xcb5b('0x2e')](_0x5667ac[_0xcb5b('0x2f')]);_0x1d8bb8[_0xcb5b('0x30')]=_[_0xcb5b('0x31')](_0x1d8bb8[_0xcb5b('0x2d')],_0x1d8bb8[_0xcb5b('0x2f')]);_0x5187ad[_0xcb5b('0x33')]=_[_0xcb5b('0x31')](_0x1d8bb8['model'],qs[_0xcb5b('0x32')](_0x5667ac[_0xcb5b('0x2f')]['fields']));_0x5187ad[_0xcb5b('0x33')]=_0x5187ad[_0xcb5b('0x33')]['length']?_0x5187ad[_0xcb5b('0x33')]:_0x1d8bb8[_0xcb5b('0x2d')];if(_0x5667ac['query']['includeAll']){_0x5187ad[_0xcb5b('0x40')]=[{'all':!![]}];}_0x5187ad=_[_0xcb5b('0x3d')]({},_0x5187ad,_0x5667ac[_0xcb5b('0x3e')]);return db[_0xcb5b('0x2a')][_0xcb5b('0x45')](_0x5187ad)['then'](handleEntityNotFound(_0x3fa482,null))['then'](respondWithResult(_0x3fa482,null))[_0xcb5b('0x42')](handleError(_0x3fa482,null));};exports[_0xcb5b('0x46')]=function(_0x318672,_0x3a078a){return db[_0xcb5b('0x2a')][_0xcb5b('0x46')](_0x318672[_0xcb5b('0x47')],{})[_0xcb5b('0x23')](respondWithResult(_0x3a078a,0xc9))[_0xcb5b('0x42')](handleError(_0x3a078a,null));};exports['update']=function(_0x5edbbb,_0x2f2a7d){if(_0x5edbbb[_0xcb5b('0x47')]['id']){delete _0x5edbbb['body']['id'];}return db[_0xcb5b('0x2a')][_0xcb5b('0x45')]({'where':{'id':_0x5edbbb[_0xcb5b('0x43')]['id']}})[_0xcb5b('0x23')](handleEntityNotFound(_0x2f2a7d,null))[_0xcb5b('0x23')](saveUpdates(_0x5edbbb[_0xcb5b('0x47')],null))[_0xcb5b('0x23')](respondWithResult(_0x2f2a7d,null))[_0xcb5b('0x42')](handleError(_0x2f2a7d,null));};exports[_0xcb5b('0x24')]=function(_0x4bb767,_0x2af7d1){return db[_0xcb5b('0x2a')]['find']({'where':{'id':_0x4bb767['params']['id']}})[_0xcb5b('0x23')](handleEntityNotFound(_0x2af7d1,null))[_0xcb5b('0x23')](removeEntity(_0x2af7d1,null))['catch'](handleError(_0x2af7d1,null));};exports[_0xcb5b('0x48')]=function(_0x69d077,_0x2e1732,_0x32d809){var _0x19d222={};var _0x41f21f={};var _0x456319;var _0x2048fc;return db[_0xcb5b('0x2a')]['findOne']({'where':{'id':_0x69d077['params']['id']}})[_0xcb5b('0x23')](handleEntityNotFound(_0x2e1732,null))[_0xcb5b('0x23')](function(_0x48bfe3){if(_0x48bfe3){_0x456319=_0x48bfe3;_0x41f21f['model']=_[_0xcb5b('0x2e')](db[_0xcb5b('0x49')][_0xcb5b('0x44')]);_0x41f21f['query']=_[_0xcb5b('0x2e')](_0x69d077['query']);_0x41f21f[_0xcb5b('0x30')]=_[_0xcb5b('0x31')](_0x41f21f['model'],_0x41f21f[_0xcb5b('0x2f')]);_0x19d222['attributes']=_[_0xcb5b('0x31')](_0x41f21f[_0xcb5b('0x2d')],qs[_0xcb5b('0x32')](_0x69d077[_0xcb5b('0x2f')]['fields']));_0x19d222[_0xcb5b('0x33')]=_0x19d222[_0xcb5b('0x33')][_0xcb5b('0x34')]?_0x19d222['attributes']:_0x41f21f[_0xcb5b('0x2d')];_0x19d222[_0xcb5b('0x37')]=qs[_0xcb5b('0x38')](_0x69d077[_0xcb5b('0x2f')]['sort']);_0x19d222[_0xcb5b('0x39')]=qs[_0xcb5b('0x30')](_[_0xcb5b('0x3a')](_0x69d077[_0xcb5b('0x2f')],_0x41f21f[_0xcb5b('0x30')]));if(_0x69d077[_0xcb5b('0x2f')][_0xcb5b('0x3b')]){_0x19d222['where']=_[_0xcb5b('0x3d')](_0x19d222[_0xcb5b('0x39')],{'$or':_[_0xcb5b('0x29')](_0x19d222[_0xcb5b('0x33')],function(_0x169ae0){var _0xac86ac={};_0xac86ac[_0x169ae0]={'$like':'%'+_0x69d077['query'][_0xcb5b('0x3b')]+'%'};return _0xac86ac;})});}_0x19d222=_['merge']({},_0x19d222,_0x69d077[_0xcb5b('0x3e')]);return _0x456319[_0xcb5b('0x48')](_0x19d222);}})[_0xcb5b('0x23')](function(_0x9e9450){if(_0x9e9450){_0x2048fc=_0x9e9450[_0xcb5b('0x34')];if(!_0x69d077['query']['hasOwnProperty']('nolimit')){_0x19d222[_0xcb5b('0x1e')]=qs[_0xcb5b('0x1e')](_0x69d077[_0xcb5b('0x2f')][_0xcb5b('0x1e')]);_0x19d222[_0xcb5b('0x1b')]=qs[_0xcb5b('0x1b')](_0x69d077[_0xcb5b('0x2f')][_0xcb5b('0x1b')]);}return _0x456319[_0xcb5b('0x48')](_0x19d222);}})[_0xcb5b('0x23')](function(_0x4a6aba){if(_0x4a6aba){return _0x4a6aba?{'count':_0x2048fc,'rows':_0x4a6aba}:null;}})[_0xcb5b('0x23')](respondWithResult(_0x2e1732,null))['catch'](handleError(_0x2e1732,null));};exports[_0xcb5b('0x4a')]=function(_0x37e7f7,_0x1351ad,_0x2d6ab3){var _0x9e7958={};var _0x4a1607={};var _0x312201;var _0x4ef358;return db[_0xcb5b('0x2a')][_0xcb5b('0x4b')]({'where':{'id':_0x37e7f7[_0xcb5b('0x43')]['id']}})[_0xcb5b('0x23')](handleEntityNotFound(_0x1351ad,null))[_0xcb5b('0x23')](function(_0x391fe2){if(_0x391fe2){_0x312201=_0x391fe2;_0x4a1607[_0xcb5b('0x2d')]=_[_0xcb5b('0x2e')](db[_0xcb5b('0x49')][_0xcb5b('0x44')]);_0x4a1607[_0xcb5b('0x2f')]=_['keys'](_0x37e7f7[_0xcb5b('0x2f')]);_0x4a1607['filters']=_['intersection'](_0x4a1607['model'],_0x4a1607['query']);_0x9e7958[_0xcb5b('0x33')]=_[_0xcb5b('0x31')](_0x4a1607[_0xcb5b('0x2d')],qs['fields'](_0x37e7f7[_0xcb5b('0x2f')][_0xcb5b('0x32')]));_0x9e7958['attributes']=_0x9e7958[_0xcb5b('0x33')][_0xcb5b('0x34')]?_0x9e7958[_0xcb5b('0x33')]:_0x4a1607['model'];_0x9e7958[_0xcb5b('0x37')]=qs['sort'](_0x37e7f7['query']['sort']);_0x9e7958[_0xcb5b('0x39')]=qs[_0xcb5b('0x30')](_[_0xcb5b('0x3a')](_0x37e7f7[_0xcb5b('0x2f')],_0x4a1607['filters']));if(_0x37e7f7['query'][_0xcb5b('0x3b')]){_0x9e7958[_0xcb5b('0x39')]=_[_0xcb5b('0x3d')](_0x9e7958[_0xcb5b('0x39')],{'$or':_[_0xcb5b('0x29')](_0x9e7958['attributes'],function(_0x5286bf){var _0x202738={};_0x202738[_0x5286bf]={'$like':'%'+_0x37e7f7[_0xcb5b('0x2f')][_0xcb5b('0x3b')]+'%'};return _0x202738;})});}_0x9e7958=_[_0xcb5b('0x3d')]({},_0x9e7958,_0x37e7f7[_0xcb5b('0x3e')]);return _0x312201[_0xcb5b('0x4a')](_0x9e7958);}})[_0xcb5b('0x23')](function(_0x57a4ed){if(_0x57a4ed){_0x4ef358=_0x57a4ed[_0xcb5b('0x34')];if(!_0x37e7f7['query'][_0xcb5b('0x35')](_0xcb5b('0x36'))){_0x9e7958['limit']=qs['limit'](_0x37e7f7[_0xcb5b('0x2f')]['limit']);_0x9e7958[_0xcb5b('0x1b')]=qs[_0xcb5b('0x1b')](_0x37e7f7[_0xcb5b('0x2f')][_0xcb5b('0x1b')]);}return _0x312201[_0xcb5b('0x4a')](_0x9e7958);}})[_0xcb5b('0x23')](function(_0x40687d){if(_0x40687d){return _0x40687d?{'count':_0x4ef358,'rows':_0x40687d}:null;}})[_0xcb5b('0x23')](respondWithResult(_0x1351ad,null))['catch'](handleError(_0x1351ad,null));};exports['getFields']=function(_0x1d0d3b,_0x2508fe,_0x4c1f3f){var _0x2cc729={};var _0x2fb582={};var _0x5dc778;var _0xc20917;return db[_0xcb5b('0x2a')]['findOne']({'where':{'id':_0x1d0d3b[_0xcb5b('0x43')]['id']}})[_0xcb5b('0x23')](handleEntityNotFound(_0x2508fe,null))['then'](function(_0x59f402){if(_0x59f402){_0x5dc778=_0x59f402;_0x2fb582['model']=_['keys'](db[_0xcb5b('0x49')][_0xcb5b('0x44')]);_0x2fb582[_0xcb5b('0x2f')]=_[_0xcb5b('0x2e')](_0x1d0d3b[_0xcb5b('0x2f')]);_0x2fb582[_0xcb5b('0x30')]=_[_0xcb5b('0x31')](_0x2fb582[_0xcb5b('0x2d')],_0x2fb582[_0xcb5b('0x2f')]);_0x2cc729[_0xcb5b('0x33')]=_['intersection'](_0x2fb582[_0xcb5b('0x2d')],qs[_0xcb5b('0x32')](_0x1d0d3b[_0xcb5b('0x2f')][_0xcb5b('0x32')]));_0x2cc729[_0xcb5b('0x33')]=_0x2cc729['attributes'][_0xcb5b('0x34')]?_0x2cc729[_0xcb5b('0x33')]:_0x2fb582[_0xcb5b('0x2d')];_0x2cc729[_0xcb5b('0x37')]=qs['sort'](_0x1d0d3b[_0xcb5b('0x2f')][_0xcb5b('0x38')]);_0x2cc729[_0xcb5b('0x39')]=qs[_0xcb5b('0x30')](_[_0xcb5b('0x3a')](_0x1d0d3b[_0xcb5b('0x2f')],_0x2fb582[_0xcb5b('0x30')]));if(_0x1d0d3b[_0xcb5b('0x2f')]['filter']){_0x2cc729[_0xcb5b('0x39')]=_[_0xcb5b('0x3d')](_0x2cc729[_0xcb5b('0x39')],{'$or':_[_0xcb5b('0x29')](_0x2cc729['attributes'],function(_0x15cbbf){var _0x1f2c5b={};_0x1f2c5b[_0x15cbbf]={'$like':'%'+_0x1d0d3b[_0xcb5b('0x2f')][_0xcb5b('0x3b')]+'%'};return _0x1f2c5b;})});}_0x2cc729=_['merge']({},_0x2cc729,_0x1d0d3b['options']);return _0x5dc778[_0xcb5b('0x4c')](_0x2cc729);}})[_0xcb5b('0x23')](function(_0x3ed5f2){if(_0x3ed5f2){_0xc20917=_0x3ed5f2[_0xcb5b('0x34')];if(!_0x1d0d3b[_0xcb5b('0x2f')][_0xcb5b('0x35')](_0xcb5b('0x36'))){_0x2cc729[_0xcb5b('0x1e')]=qs[_0xcb5b('0x1e')](_0x1d0d3b['query']['limit']);_0x2cc729['offset']=qs['offset'](_0x1d0d3b[_0xcb5b('0x2f')][_0xcb5b('0x1b')]);}return _0x5dc778[_0xcb5b('0x4c')](_0x2cc729);}})['then'](function(_0x4344bd){if(_0x4344bd){return _0x4344bd?{'count':_0xc20917,'rows':_0x4344bd}:null;}})[_0xcb5b('0x23')](respondWithResult(_0x2508fe,null))[_0xcb5b('0x42')](handleError(_0x2508fe,null));}; \ No newline at end of file +var _0x885c=['body','find','params','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','options','include','findAll','catch','show','includeAll','merge','create'];(function(_0x1bebe5,_0x32e0d3){var _0x568429=function(_0x2306f0){while(--_0x2306f0){_0x1bebe5['push'](_0x1bebe5['shift']());}};_0x568429(++_0x32e0d3);}(_0x885c,0x190));var _0xc885=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x885c[_0x4f8d61];return _0x3bc078;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc885('0x0'));var jsonpatch=require(_0xc885('0x1'));var rp=require(_0xc885('0x2'));var moment=require('moment');var BPromise=require(_0xc885('0x3'));var Mustache=require(_0xc885('0x4'));var util=require(_0xc885('0x5'));var path=require(_0xc885('0x6'));var sox=require(_0xc885('0x7'));var csv=require(_0xc885('0x8'));var ejs=require(_0xc885('0x9'));var fs=require('fs');var fs_extra=require(_0xc885('0xa'));var _=require(_0xc885('0xb'));var squel=require(_0xc885('0xc'));var crypto=require(_0xc885('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc885('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc885('0xf'));var Papa=require('papaparse');var Redis=require(_0xc885('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc885('0x11'));var hardwareService=require(_0xc885('0x12'));var logger=require('../../config/logger')(_0xc885('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc885('0x14'));var db=require(_0xc885('0x15'))['db'];function respondWithStatusCode(_0x52065b,_0x53a5b8){_0x53a5b8=_0x53a5b8||0xcc;return function(_0x2ce96b){if(_0x2ce96b){return _0x52065b['sendStatus'](_0x53a5b8);}return _0x52065b[_0xc885('0x16')](_0x53a5b8)['end']();};}function respondWithResult(_0x20b73e,_0x1102bc){_0x1102bc=_0x1102bc||0xc8;return function(_0x245f5a){if(_0x245f5a){return _0x20b73e['status'](_0x1102bc)[_0xc885('0x17')](_0x245f5a);}};}function respondWithFilteredResult(_0x41667d,_0x5e5674){return function(_0x415a06){if(_0x415a06){var _0xa743a4=typeof _0x5e5674['offset']===_0xc885('0x18')&&typeof _0x5e5674[_0xc885('0x19')]===_0xc885('0x18');var _0xa830e2=_0x415a06[_0xc885('0x1a')];var _0x3139a9=_0xa743a4?0x0:_0x5e5674[_0xc885('0x1b')];var _0x12c6fb=_0xa743a4?_0x415a06[_0xc885('0x1a')]:_0x5e5674[_0xc885('0x1b')]+_0x5e5674[_0xc885('0x19')];var _0x52cad3;if(_0x12c6fb>=_0xa830e2){_0x12c6fb=_0xa830e2;_0x52cad3=0xc8;}else{_0x52cad3=0xce;}_0x41667d['status'](_0x52cad3);return _0x41667d[_0xc885('0x1c')](_0xc885('0x1d'),_0x3139a9+'-'+_0x12c6fb+'/'+_0xa830e2)[_0xc885('0x17')](_0x415a06);}return null;};}function patchUpdates(_0x88712a){return function(_0x392384){try{jsonpatch['apply'](_0x392384,_0x88712a,!![]);}catch(_0x553cac){return BPromise[_0xc885('0x1e')](_0x553cac);}return _0x392384[_0xc885('0x1f')]();};}function saveUpdates(_0x4015f0,_0x470ae6){return function(_0xe1f77b){if(_0xe1f77b){return _0xe1f77b[_0xc885('0x20')](_0x4015f0)[_0xc885('0x21')](function(_0x124afe){return _0x124afe;});}return null;};}function removeEntity(_0x4af318,_0x5a6fa2){return function(_0x57864d){if(_0x57864d){return _0x57864d['destroy']()[_0xc885('0x21')](function(){_0x4af318[_0xc885('0x16')](0xcc)[_0xc885('0x22')]();});}};}function handleEntityNotFound(_0x5d9fb6,_0x3ccf3c){return function(_0x1a1ec7){if(!_0x1a1ec7){_0x5d9fb6[_0xc885('0x23')](0x194);}return _0x1a1ec7;};}function handleError(_0x1787d6,_0xe0fa75){_0xe0fa75=_0xe0fa75||0x1f4;return function(_0x47f20d){logger[_0xc885('0x24')](_0x47f20d[_0xc885('0x25')]);if(_0x47f20d[_0xc885('0x26')]){delete _0x47f20d[_0xc885('0x26')];}_0x1787d6[_0xc885('0x16')](_0xe0fa75)[_0xc885('0x27')](_0x47f20d);};}exports[_0xc885('0x28')]=function(_0x5b8589,_0x5cb45d){var _0x3803de={},_0x4270ae={},_0x579386={'count':0x0,'rows':[]};var _0x4b808f=_[_0xc885('0x29')](db[_0xc885('0x2a')][_0xc885('0x2b')],function(_0x1fb9bf){return{'name':_0x1fb9bf[_0xc885('0x2c')],'type':_0x1fb9bf[_0xc885('0x2d')][_0xc885('0x2e')]};});_0x4270ae[_0xc885('0x2f')]=_['map'](_0x4b808f,_0xc885('0x26'));_0x4270ae['query']=_[_0xc885('0x30')](_0x5b8589[_0xc885('0x31')]);_0x4270ae[_0xc885('0x32')]=_[_0xc885('0x33')](_0x4270ae['model'],_0x4270ae[_0xc885('0x31')]);_0x3803de[_0xc885('0x34')]=_[_0xc885('0x33')](_0x4270ae['model'],qs[_0xc885('0x35')](_0x5b8589['query'][_0xc885('0x35')]));_0x3803de[_0xc885('0x34')]=_0x3803de['attributes'][_0xc885('0x36')]?_0x3803de[_0xc885('0x34')]:_0x4270ae['model'];if(!_0x5b8589['query']['hasOwnProperty'](_0xc885('0x37'))){_0x3803de['limit']=qs[_0xc885('0x19')](_0x5b8589['query'][_0xc885('0x19')]);_0x3803de[_0xc885('0x1b')]=qs[_0xc885('0x1b')](_0x5b8589[_0xc885('0x31')]['offset']);}_0x3803de[_0xc885('0x38')]=qs['sort'](_0x5b8589[_0xc885('0x31')][_0xc885('0x39')]);_0x3803de[_0xc885('0x3a')]=qs['filters'](_['pick'](_0x5b8589[_0xc885('0x31')],_0x4270ae[_0xc885('0x32')]),_0x4b808f);if(_0x5b8589[_0xc885('0x31')][_0xc885('0x3b')]){_0x3803de[_0xc885('0x3a')]=_['merge'](_0x3803de['where'],{'$or':_[_0xc885('0x29')](_0x4b808f,function(_0x169abf){if(_0x169abf[_0xc885('0x2d')]!=='VIRTUAL'){var _0xae83b5={};_0xae83b5[_0x169abf[_0xc885('0x26')]]={'$like':'%'+_0x5b8589['query'][_0xc885('0x3b')]+'%'};return _0xae83b5;}})});}_0x3803de=_['merge']({},_0x3803de,_0x5b8589[_0xc885('0x3c')]);var _0x3fb419={'where':_0x3803de[_0xc885('0x3a')]};return db[_0xc885('0x2a')]['count'](_0x3fb419)[_0xc885('0x21')](function(_0x461718){_0x579386['count']=_0x461718;if(_0x5b8589['query']['includeAll']){_0x3803de[_0xc885('0x3d')]=[{'all':!![]}];}return db[_0xc885('0x2a')][_0xc885('0x3e')](_0x3803de);})['then'](function(_0x2ea881){_0x579386['rows']=_0x2ea881;return _0x579386;})[_0xc885('0x21')](respondWithFilteredResult(_0x5cb45d,_0x3803de))[_0xc885('0x3f')](handleError(_0x5cb45d,null));};exports[_0xc885('0x40')]=function(_0x50558a,_0x15c648){var _0xbca078={'raw':![],'where':{'id':_0x50558a['params']['id']}},_0x4dc2f9={};_0x4dc2f9['model']=_['keys'](db[_0xc885('0x2a')][_0xc885('0x2b')]);_0x4dc2f9['query']=_[_0xc885('0x30')](_0x50558a[_0xc885('0x31')]);_0x4dc2f9[_0xc885('0x32')]=_[_0xc885('0x33')](_0x4dc2f9[_0xc885('0x2f')],_0x4dc2f9[_0xc885('0x31')]);_0xbca078[_0xc885('0x34')]=_[_0xc885('0x33')](_0x4dc2f9['model'],qs[_0xc885('0x35')](_0x50558a[_0xc885('0x31')][_0xc885('0x35')]));_0xbca078['attributes']=_0xbca078[_0xc885('0x34')]['length']?_0xbca078[_0xc885('0x34')]:_0x4dc2f9['model'];if(_0x50558a[_0xc885('0x31')][_0xc885('0x41')]){_0xbca078[_0xc885('0x3d')]=[{'all':!![]}];}_0xbca078=_[_0xc885('0x42')]({},_0xbca078,_0x50558a[_0xc885('0x3c')]);return db[_0xc885('0x2a')]['find'](_0xbca078)['then'](handleEntityNotFound(_0x15c648,null))[_0xc885('0x21')](respondWithResult(_0x15c648,null))['catch'](handleError(_0x15c648,null));};exports[_0xc885('0x43')]=function(_0x2fe97c,_0x71367c){return db[_0xc885('0x2a')]['create'](_0x2fe97c[_0xc885('0x44')],{})['then'](respondWithResult(_0x71367c,0xc9))['catch'](handleError(_0x71367c,null));};exports[_0xc885('0x20')]=function(_0x219039,_0x344906){if(_0x219039[_0xc885('0x44')]['id']){delete _0x219039[_0xc885('0x44')]['id'];}return db['FreshsalesConfiguration'][_0xc885('0x45')]({'where':{'id':_0x219039[_0xc885('0x46')]['id']}})['then'](handleEntityNotFound(_0x344906,null))[_0xc885('0x21')](saveUpdates(_0x219039[_0xc885('0x44')],null))[_0xc885('0x21')](respondWithResult(_0x344906,null))[_0xc885('0x3f')](handleError(_0x344906,null));};exports['destroy']=function(_0x2b409f,_0x54c0c6){return db[_0xc885('0x2a')]['find']({'where':{'id':_0x2b409f['params']['id']}})[_0xc885('0x21')](handleEntityNotFound(_0x54c0c6,null))[_0xc885('0x21')](removeEntity(_0x54c0c6,null))[_0xc885('0x3f')](handleError(_0x54c0c6,null));};exports[_0xc885('0x47')]=function(_0x1a2c0b,_0x1f6fef,_0x1f5b3c){var _0x5b620b={};var _0x735597={};var _0x258ad2;var _0x11c7cd;return db[_0xc885('0x2a')][_0xc885('0x48')]({'where':{'id':_0x1a2c0b['params']['id']}})[_0xc885('0x21')](handleEntityNotFound(_0x1f6fef,null))[_0xc885('0x21')](function(_0x1be493){if(_0x1be493){_0x258ad2=_0x1be493;_0x735597['model']=_[_0xc885('0x30')](db[_0xc885('0x49')][_0xc885('0x2b')]);_0x735597['query']=_[_0xc885('0x30')](_0x1a2c0b['query']);_0x735597[_0xc885('0x32')]=_[_0xc885('0x33')](_0x735597[_0xc885('0x2f')],_0x735597['query']);_0x5b620b['attributes']=_[_0xc885('0x33')](_0x735597[_0xc885('0x2f')],qs[_0xc885('0x35')](_0x1a2c0b[_0xc885('0x31')][_0xc885('0x35')]));_0x5b620b[_0xc885('0x34')]=_0x5b620b[_0xc885('0x34')][_0xc885('0x36')]?_0x5b620b[_0xc885('0x34')]:_0x735597['model'];_0x5b620b['order']=qs['sort'](_0x1a2c0b[_0xc885('0x31')][_0xc885('0x39')]);_0x5b620b[_0xc885('0x3a')]=qs['filters'](_[_0xc885('0x4a')](_0x1a2c0b[_0xc885('0x31')],_0x735597['filters']));if(_0x1a2c0b[_0xc885('0x31')][_0xc885('0x3b')]){_0x5b620b[_0xc885('0x3a')]=_['merge'](_0x5b620b[_0xc885('0x3a')],{'$or':_[_0xc885('0x29')](_0x5b620b[_0xc885('0x34')],function(_0x26226c){var _0x1dc414={};_0x1dc414[_0x26226c]={'$like':'%'+_0x1a2c0b['query'][_0xc885('0x3b')]+'%'};return _0x1dc414;})});}_0x5b620b=_['merge']({},_0x5b620b,_0x1a2c0b[_0xc885('0x3c')]);return _0x258ad2[_0xc885('0x47')](_0x5b620b);}})[_0xc885('0x21')](function(_0x4b289f){if(_0x4b289f){_0x11c7cd=_0x4b289f[_0xc885('0x36')];if(!_0x1a2c0b[_0xc885('0x31')][_0xc885('0x4b')](_0xc885('0x37'))){_0x5b620b[_0xc885('0x19')]=qs[_0xc885('0x19')](_0x1a2c0b[_0xc885('0x31')]['limit']);_0x5b620b['offset']=qs[_0xc885('0x1b')](_0x1a2c0b[_0xc885('0x31')][_0xc885('0x1b')]);}return _0x258ad2[_0xc885('0x47')](_0x5b620b);}})['then'](function(_0x38b593){if(_0x38b593){return _0x38b593?{'count':_0x11c7cd,'rows':_0x38b593}:null;}})['then'](respondWithResult(_0x1f6fef,null))[_0xc885('0x3f')](handleError(_0x1f6fef,null));};exports[_0xc885('0x4c')]=function(_0x495aa8,_0x216f55,_0x3fe06c){var _0x57aa8f={};var _0x3240c0={};var _0x1c3c03;var _0x5ee3bd;return db[_0xc885('0x2a')][_0xc885('0x48')]({'where':{'id':_0x495aa8['params']['id']}})[_0xc885('0x21')](handleEntityNotFound(_0x216f55,null))[_0xc885('0x21')](function(_0x57da16){if(_0x57da16){_0x1c3c03=_0x57da16;_0x3240c0[_0xc885('0x2f')]=_['keys'](db[_0xc885('0x49')][_0xc885('0x2b')]);_0x3240c0[_0xc885('0x31')]=_[_0xc885('0x30')](_0x495aa8[_0xc885('0x31')]);_0x3240c0[_0xc885('0x32')]=_[_0xc885('0x33')](_0x3240c0['model'],_0x3240c0[_0xc885('0x31')]);_0x57aa8f['attributes']=_['intersection'](_0x3240c0[_0xc885('0x2f')],qs[_0xc885('0x35')](_0x495aa8[_0xc885('0x31')][_0xc885('0x35')]));_0x57aa8f['attributes']=_0x57aa8f[_0xc885('0x34')]['length']?_0x57aa8f[_0xc885('0x34')]:_0x3240c0['model'];_0x57aa8f[_0xc885('0x38')]=qs[_0xc885('0x39')](_0x495aa8[_0xc885('0x31')][_0xc885('0x39')]);_0x57aa8f[_0xc885('0x3a')]=qs[_0xc885('0x32')](_[_0xc885('0x4a')](_0x495aa8[_0xc885('0x31')],_0x3240c0[_0xc885('0x32')]));if(_0x495aa8['query']['filter']){_0x57aa8f[_0xc885('0x3a')]=_[_0xc885('0x42')](_0x57aa8f['where'],{'$or':_[_0xc885('0x29')](_0x57aa8f['attributes'],function(_0x1155ff){var _0x7fc798={};_0x7fc798[_0x1155ff]={'$like':'%'+_0x495aa8[_0xc885('0x31')][_0xc885('0x3b')]+'%'};return _0x7fc798;})});}_0x57aa8f=_['merge']({},_0x57aa8f,_0x495aa8['options']);return _0x1c3c03[_0xc885('0x4c')](_0x57aa8f);}})['then'](function(_0xce5e16){if(_0xce5e16){_0x5ee3bd=_0xce5e16['length'];if(!_0x495aa8[_0xc885('0x31')][_0xc885('0x4b')]('nolimit')){_0x57aa8f[_0xc885('0x19')]=qs['limit'](_0x495aa8[_0xc885('0x31')][_0xc885('0x19')]);_0x57aa8f[_0xc885('0x1b')]=qs['offset'](_0x495aa8[_0xc885('0x31')][_0xc885('0x1b')]);}return _0x1c3c03[_0xc885('0x4c')](_0x57aa8f);}})['then'](function(_0x1cfeb){if(_0x1cfeb){return _0x1cfeb?{'count':_0x5ee3bd,'rows':_0x1cfeb}:null;}})[_0xc885('0x21')](respondWithResult(_0x216f55,null))[_0xc885('0x3f')](handleError(_0x216f55,null));};exports[_0xc885('0x4d')]=function(_0x5c928e,_0x1b00e1,_0x209a1a){var _0x142e8e={};var _0x5f3fce={};var _0x270314;var _0x524552;return db['FreshsalesConfiguration'][_0xc885('0x48')]({'where':{'id':_0x5c928e['params']['id']}})['then'](handleEntityNotFound(_0x1b00e1,null))[_0xc885('0x21')](function(_0x2b0554){if(_0x2b0554){_0x270314=_0x2b0554;_0x5f3fce[_0xc885('0x2f')]=_['keys'](db['FreshsalesField'][_0xc885('0x2b')]);_0x5f3fce[_0xc885('0x31')]=_['keys'](_0x5c928e['query']);_0x5f3fce[_0xc885('0x32')]=_[_0xc885('0x33')](_0x5f3fce[_0xc885('0x2f')],_0x5f3fce[_0xc885('0x31')]);_0x142e8e[_0xc885('0x34')]=_[_0xc885('0x33')](_0x5f3fce[_0xc885('0x2f')],qs[_0xc885('0x35')](_0x5c928e[_0xc885('0x31')][_0xc885('0x35')]));_0x142e8e[_0xc885('0x34')]=_0x142e8e['attributes']['length']?_0x142e8e[_0xc885('0x34')]:_0x5f3fce[_0xc885('0x2f')];_0x142e8e[_0xc885('0x38')]=qs[_0xc885('0x39')](_0x5c928e[_0xc885('0x31')][_0xc885('0x39')]);_0x142e8e[_0xc885('0x3a')]=qs[_0xc885('0x32')](_[_0xc885('0x4a')](_0x5c928e[_0xc885('0x31')],_0x5f3fce[_0xc885('0x32')]));if(_0x5c928e['query']['filter']){_0x142e8e[_0xc885('0x3a')]=_[_0xc885('0x42')](_0x142e8e['where'],{'$or':_[_0xc885('0x29')](_0x142e8e[_0xc885('0x34')],function(_0x424da3){var _0x248563={};_0x248563[_0x424da3]={'$like':'%'+_0x5c928e[_0xc885('0x31')]['filter']+'%'};return _0x248563;})});}_0x142e8e=_['merge']({},_0x142e8e,_0x5c928e[_0xc885('0x3c')]);return _0x270314['getFields'](_0x142e8e);}})[_0xc885('0x21')](function(_0x576fcb){if(_0x576fcb){_0x524552=_0x576fcb['length'];if(!_0x5c928e[_0xc885('0x31')][_0xc885('0x4b')](_0xc885('0x37'))){_0x142e8e[_0xc885('0x19')]=qs[_0xc885('0x19')](_0x5c928e[_0xc885('0x31')][_0xc885('0x19')]);_0x142e8e[_0xc885('0x1b')]=qs[_0xc885('0x1b')](_0x5c928e[_0xc885('0x31')][_0xc885('0x1b')]);}return _0x270314[_0xc885('0x4d')](_0x142e8e);}})['then'](function(_0xd0a11d){if(_0xd0a11d){return _0xd0a11d?{'count':_0x524552,'rows':_0xd0a11d}:null;}})['then'](respondWithResult(_0x1b00e1,null))[_0xc885('0x3f')](handleError(_0x1b00e1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8edff53..6deeb30 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 _0x398b=['api','moment','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger'];(function(_0x4cf162,_0x245c3f){var _0x5b0339=function(_0x2ea955){while(--_0x2ea955){_0x4cf162['push'](_0x4cf162['shift']());}};_0x5b0339(++_0x245c3f);}(_0x398b,0x1db));var _0xb398=function(_0xee12a3,_0x4d2c79){_0xee12a3=_0xee12a3-0x0;var _0x41a6a2=_0x398b[_0xee12a3];return _0x41a6a2;};'use strict';var _=require('lodash');var util=require(_0xb398('0x0'));var logger=require(_0xb398('0x1'))(_0xb398('0x2'));var moment=require(_0xb398('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(_0xb398('0x4'));var attributes=require(_0xb398('0x5'));module[_0xb398('0x6')]=function(_0x6537c9,_0x1a4156){return _0x6537c9['define'](_0xb398('0x7'),attributes,{'tableName':_0xb398('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eb3=['bluebird','rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','api','moment'];(function(_0x2671cf,_0x5293f8){var _0x18d8d9=function(_0x3ea75e){while(--_0x3ea75e){_0x2671cf['push'](_0x2671cf['shift']());}};_0x18d8d9(++_0x5293f8);}(_0x4eb3,0x76));var _0x34eb=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x4eb3[_0x284807];return _0x50c774;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x34eb('0x0'));var moment=require(_0x34eb('0x1'));var BPromise=require(_0x34eb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x34eb('0x3'));var config=require('../../config/environment');var attributes=require(_0x34eb('0x4'));module[_0x34eb('0x5')]=function(_0x198275,_0x42d3ac){return _0x198275[_0x34eb('0x6')]('FreshsalesConfiguration',attributes,{'tableName':_0x34eb('0x7'),'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 80c4920..dd010d6 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 _0x026f=['request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x57d014,_0x30a72b){var _0x274b15=function(_0x7d66c1){while(--_0x7d66c1){_0x57d014['push'](_0x57d014['shift']());}};_0x274b15(++_0x30a72b);}(_0x026f,0x137));var _0xf026=function(_0x2a121b,_0x153a6f){_0x2a121b=_0x2a121b-0x0;var _0x11cc77=_0x026f[_0x2a121b];return _0x11cc77;};'use strict';var _=require(_0xf026('0x0'));var util=require(_0xf026('0x1'));var moment=require('moment');var BPromise=require(_0xf026('0x2'));var rs=require(_0xf026('0x3'));var fs=require('fs');var Redis=require(_0xf026('0x4'));var db=require(_0xf026('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf026('0x6'));var config=require(_0xf026('0x7'));var jayson=require(_0xf026('0x8'));var client=jayson[_0xf026('0x9')][_0xf026('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fb286,_0x5b6da3,_0x1f43cc){return new BPromise(function(_0x8b89a4,_0x487ceb){return client[_0xf026('0xb')](_0x3fb286,_0x1f43cc)[_0xf026('0xc')](function(_0x4d3f05){logger['info'](_0xf026('0xd'),_0x5b6da3,_0xf026('0xe'));logger[_0xf026('0xf')](_0xf026('0x10'),_0x5b6da3,'request\x20sent',JSON[_0xf026('0x11')](_0x4d3f05));if(_0x4d3f05['error']){if(_0x4d3f05[_0xf026('0x12')][_0xf026('0x13')]===0x1f4){logger[_0xf026('0x12')](_0xf026('0xd'),_0x5b6da3,_0x4d3f05['error']['message']);return _0x487ceb(_0x4d3f05[_0xf026('0x12')][_0xf026('0x14')]);}logger['error'](_0xf026('0xd'),_0x5b6da3,_0x4d3f05[_0xf026('0x12')]['message']);return _0x8b89a4(_0x4d3f05['error'][_0xf026('0x14')]);}else{logger[_0xf026('0x15')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b6da3,_0xf026('0xe'));_0x8b89a4(_0x4d3f05[_0xf026('0x16')][_0xf026('0x14')]);}})['catch'](function(_0x265324){logger[_0xf026('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b6da3,_0x265324);_0x487ceb(_0x265324);});});} \ No newline at end of file +var _0xf754=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x488bba,_0x22829b){var _0x54b4b0=function(_0x42af4e){while(--_0x42af4e){_0x488bba['push'](_0x488bba['shift']());}};_0x54b4b0(++_0x22829b);}(_0xf754,0xd6));var _0x4f75=function(_0x5264d0,_0xeef3b8){_0x5264d0=_0x5264d0-0x0;var _0x3219bf=_0xf754[_0x5264d0];return _0x3219bf;};'use strict';var _=require('lodash');var util=require(_0x4f75('0x0'));var moment=require(_0x4f75('0x1'));var BPromise=require(_0x4f75('0x2'));var rs=require(_0x4f75('0x3'));var fs=require('fs');var Redis=require(_0x4f75('0x4'));var db=require(_0x4f75('0x5'))['db'];var utils=require(_0x4f75('0x6'));var logger=require(_0x4f75('0x7'))(_0x4f75('0x8'));var config=require('../../config/environment');var jayson=require(_0x4f75('0x9'));var client=jayson[_0x4f75('0xa')][_0x4f75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423c3d,_0x56b472,_0x405cbe){return new BPromise(function(_0x4f4163,_0x10a01d){return client[_0x4f75('0xc')](_0x423c3d,_0x405cbe)[_0x4f75('0xd')](function(_0x256609){logger[_0x4f75('0xe')](_0x4f75('0xf'),_0x56b472,_0x4f75('0x10'));logger[_0x4f75('0x11')](_0x4f75('0x12'),_0x56b472,_0x4f75('0x10'),JSON[_0x4f75('0x13')](_0x256609));if(_0x256609[_0x4f75('0x14')]){if(_0x256609[_0x4f75('0x14')][_0x4f75('0x15')]===0x1f4){logger[_0x4f75('0x14')](_0x4f75('0xf'),_0x56b472,_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);return _0x10a01d(_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x56b472,_0x256609['error'][_0x4f75('0x16')]);return _0x4f4163(_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);}else{logger['info'](_0x4f75('0xf'),_0x56b472,_0x4f75('0x10'));_0x4f4163(_0x256609[_0x4f75('0x17')]['message']);}})[_0x4f75('0x18')](function(_0x139213){logger[_0x4f75('0x14')](_0x4f75('0xf'),_0x56b472,_0x139213);_0x10a01d(_0x139213);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f5ade05..0fea6fc 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 _0x37dc=['index','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','isAuthenticated'];(function(_0x185bba,_0x3103f3){var _0x29cf4d=function(_0x204a5a){while(--_0x204a5a){_0x185bba['push'](_0x185bba['shift']());}};_0x29cf4d(++_0x3103f3);}(_0x37dc,0x1e9));var _0xc37d=function(_0x313787,_0xd56a6d){_0x313787=_0x313787-0x0;var _0x1f823d=_0x37dc[_0x313787];return _0x1f823d;};'use strict';var multer=require(_0xc37d('0x0'));var util=require(_0xc37d('0x1'));var path=require(_0xc37d('0x2'));var timeout=require(_0xc37d('0x3'));var express=require('express');var router=express[_0xc37d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc37d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xc37d('0x6')](),controller[_0xc37d('0x7')]);router[_0xc37d('0x8')](_0xc37d('0x9'),auth[_0xc37d('0x6')](),controller[_0xc37d('0xa')]);router[_0xc37d('0xb')]('/',auth[_0xc37d('0x6')](),controller[_0xc37d('0xc')]);router['put'](_0xc37d('0x9'),auth[_0xc37d('0x6')](),controller['update']);router[_0xc37d('0xd')](_0xc37d('0x9'),auth['isAuthenticated'](),controller[_0xc37d('0xe')]);module[_0xc37d('0xf')]=router; \ No newline at end of file +var _0xfc03=['post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x1b2d69,_0x110fc5){var _0xde706a=function(_0x43b9d0){while(--_0x43b9d0){_0x1b2d69['push'](_0x1b2d69['shift']());}};_0xde706a(++_0x110fc5);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xfc03[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x3fc0('0x0'));var util=require('util');var path=require(_0x3fc0('0x1'));var timeout=require(_0x3fc0('0x2'));var express=require('express');var router=express[_0x3fc0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fc0('0x4'));var interaction=require(_0x3fc0('0x5'));var config=require(_0x3fc0('0x6'));var controller=require(_0x3fc0('0x7'));router[_0x3fc0('0x8')]('/',auth[_0x3fc0('0x9')](),controller[_0x3fc0('0xa')]);router[_0x3fc0('0x8')]('/:id',auth[_0x3fc0('0x9')](),controller['show']);router[_0x3fc0('0xb')]('/',auth[_0x3fc0('0x9')](),controller[_0x3fc0('0xc')]);router[_0x3fc0('0xd')]('/:id',auth[_0x3fc0('0x9')](),controller[_0x3fc0('0xe')]);router[_0x3fc0('0xf')](_0x3fc0('0x10'),auth[_0x3fc0('0x9')](),controller['destroy']);module[_0x3fc0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c0cbd0f..2572989 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 _0x90df=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x4bfe0b,_0x20a5e1){var _0x5b1290=function(_0xe81e2b){while(--_0xe81e2b){_0x4bfe0b['push'](_0x4bfe0b['shift']());}};_0x5b1290(++_0x20a5e1);}(_0x90df,0xb7));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf90d('0x0'));module[_0xf90d('0x1')]={'type':{'type':Sequelize[_0xf90d('0x2')](_0xf90d('0x3'),_0xf90d('0x4'),_0xf90d('0x5'),_0xf90d('0x6'),'picklist'),'defaultValue':_0xf90d('0x3')},'content':{'type':Sequelize[_0xf90d('0x7')]},'key':{'type':Sequelize[_0xf90d('0x7')]},'keyType':{'type':Sequelize[_0xf90d('0x2')](_0xf90d('0x3'),'variable',_0xf90d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf90d('0x7')]},'nameField':{'type':Sequelize[_0xf90d('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf90d('0x7')]}}; \ No newline at end of file +var _0x0234=['exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0234,0xb3));var _0x4023=function(_0x5086f7,_0x35bb69){_0x5086f7=_0x5086f7-0x0;var _0x253f9b=_0x0234[_0x5086f7];return _0x253f9b;};'use strict';var Sequelize=require(_0x4023('0x0'));module[_0x4023('0x1')]={'type':{'type':Sequelize[_0x4023('0x2')]('string','variable',_0x4023('0x3'),_0x4023('0x4'),_0x4023('0x5')),'defaultValue':_0x4023('0x6')},'content':{'type':Sequelize[_0x4023('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4023('0x2')](_0x4023('0x6'),_0x4023('0x8'),_0x4023('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4023('0x7')]},'nameField':{'type':Sequelize[_0x4023('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4023('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b5fdf88..0c15291 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 _0x5f89=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x5f89,0xd5));var _0x95f8=function(_0x13e6e1,_0x22c6f9){_0x13e6e1=_0x13e6e1-0x0;var _0xab9bd6=_0x5f89[_0x13e6e1];return _0xab9bd6;};'use strict';var emlformat=require(_0x95f8('0x0'));var rimraf=require(_0x95f8('0x1'));var zipdir=require(_0x95f8('0x2'));var jsonpatch=require(_0x95f8('0x3'));var rp=require(_0x95f8('0x4'));var moment=require(_0x95f8('0x5'));var BPromise=require(_0x95f8('0x6'));var Mustache=require(_0x95f8('0x7'));var util=require('util');var path=require(_0x95f8('0x8'));var sox=require(_0x95f8('0x9'));var csv=require(_0x95f8('0xa'));var ejs=require(_0x95f8('0xb'));var fs=require('fs');var fs_extra=require(_0x95f8('0xc'));var _=require(_0x95f8('0xd'));var squel=require(_0x95f8('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x95f8('0xa'));var querystring=require(_0x95f8('0xf'));var Papa=require(_0x95f8('0x10'));var Redis=require(_0x95f8('0x11'));var authService=require(_0x95f8('0x12'));var qs=require(_0x95f8('0x13'));var as=require(_0x95f8('0x14'));var hardwareService=require(_0x95f8('0x15'));var logger=require(_0x95f8('0x16'))(_0x95f8('0x17'));var utils=require(_0x95f8('0x18'));var config=require(_0x95f8('0x19'));var licenseUtil=require(_0x95f8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151921,_0x1caef8){_0x1caef8=_0x1caef8||0xcc;return function(_0x2501de){if(_0x2501de){return _0x151921[_0x95f8('0x1b')](_0x1caef8);}return _0x151921['status'](_0x1caef8)['end']();};}function respondWithResult(_0x45062f,_0x428e2d){_0x428e2d=_0x428e2d||0xc8;return function(_0x456d5f){if(_0x456d5f){return _0x45062f[_0x95f8('0x1c')](_0x428e2d)[_0x95f8('0x1d')](_0x456d5f);}};}function respondWithFilteredResult(_0x2ac577,_0x13c45f){return function(_0x1ef1c3){if(_0x1ef1c3){var _0x48544a=typeof _0x13c45f['offset']===_0x95f8('0x1e')&&typeof _0x13c45f[_0x95f8('0x1f')]===_0x95f8('0x1e');var _0x21942f=_0x1ef1c3[_0x95f8('0x20')];var _0x55c5b9=_0x48544a?0x0:_0x13c45f[_0x95f8('0x21')];var _0x471695=_0x48544a?_0x1ef1c3['count']:_0x13c45f[_0x95f8('0x21')]+_0x13c45f[_0x95f8('0x1f')];var _0xf23dc6;if(_0x471695>=_0x21942f){_0x471695=_0x21942f;_0xf23dc6=0xc8;}else{_0xf23dc6=0xce;}_0x2ac577[_0x95f8('0x1c')](_0xf23dc6);return _0x2ac577['set'](_0x95f8('0x22'),_0x55c5b9+'-'+_0x471695+'/'+_0x21942f)[_0x95f8('0x1d')](_0x1ef1c3);}return null;};}function patchUpdates(_0x142c9d){return function(_0x2da98f){try{jsonpatch[_0x95f8('0x23')](_0x2da98f,_0x142c9d,!![]);}catch(_0x138738){return BPromise[_0x95f8('0x24')](_0x138738);}return _0x2da98f[_0x95f8('0x25')]();};}function saveUpdates(_0x392540,_0x4d214a){return function(_0x22bbf1){if(_0x22bbf1){return _0x22bbf1[_0x95f8('0x26')](_0x392540)[_0x95f8('0x27')](function(_0x311145){return _0x311145;});}return null;};}function removeEntity(_0x527553,_0x5d6223){return function(_0x4ded83){if(_0x4ded83){return _0x4ded83[_0x95f8('0x28')]()['then'](function(){_0x527553['status'](0xcc)[_0x95f8('0x29')]();});}};}function handleEntityNotFound(_0x212fc5,_0x425b17){return function(_0x2516e5){if(!_0x2516e5){_0x212fc5[_0x95f8('0x1b')](0x194);}return _0x2516e5;};}function handleError(_0x477d44,_0x187d96){_0x187d96=_0x187d96||0x1f4;return function(_0x1252b9){logger[_0x95f8('0x2a')](_0x1252b9[_0x95f8('0x2b')]);if(_0x1252b9[_0x95f8('0x2c')]){delete _0x1252b9[_0x95f8('0x2c')];}_0x477d44[_0x95f8('0x1c')](_0x187d96)[_0x95f8('0x2d')](_0x1252b9);};}exports[_0x95f8('0x2e')]=function(_0x4bb61d,_0x64f565){var _0x1c7615={},_0x506785={},_0x94a55c={'count':0x0,'rows':[]};var _0x222241=_[_0x95f8('0x2f')](db[_0x95f8('0x30')]['rawAttributes'],function(_0x506d00){return{'name':_0x506d00[_0x95f8('0x31')],'type':_0x506d00['type'][_0x95f8('0x32')]};});_0x506785[_0x95f8('0x33')]=_[_0x95f8('0x2f')](_0x222241,_0x95f8('0x2c'));_0x506785[_0x95f8('0x34')]=_[_0x95f8('0x35')](_0x4bb61d[_0x95f8('0x34')]);_0x506785[_0x95f8('0x36')]=_['intersection'](_0x506785[_0x95f8('0x33')],_0x506785['query']);_0x1c7615[_0x95f8('0x37')]=_['intersection'](_0x506785['model'],qs[_0x95f8('0x38')](_0x4bb61d[_0x95f8('0x34')][_0x95f8('0x38')]));_0x1c7615['attributes']=_0x1c7615[_0x95f8('0x37')]['length']?_0x1c7615[_0x95f8('0x37')]:_0x506785['model'];if(!_0x4bb61d['query'][_0x95f8('0x39')](_0x95f8('0x3a'))){_0x1c7615[_0x95f8('0x1f')]=qs[_0x95f8('0x1f')](_0x4bb61d[_0x95f8('0x34')]['limit']);_0x1c7615[_0x95f8('0x21')]=qs[_0x95f8('0x21')](_0x4bb61d['query'][_0x95f8('0x21')]);}_0x1c7615['order']=qs['sort'](_0x4bb61d[_0x95f8('0x34')][_0x95f8('0x3b')]);_0x1c7615[_0x95f8('0x3c')]=qs[_0x95f8('0x36')](_[_0x95f8('0x3d')](_0x4bb61d[_0x95f8('0x34')],_0x506785[_0x95f8('0x36')]),_0x222241);if(_0x4bb61d[_0x95f8('0x34')][_0x95f8('0x3e')]){_0x1c7615['where']=_['merge'](_0x1c7615[_0x95f8('0x3c')],{'$or':_[_0x95f8('0x2f')](_0x222241,function(_0x4c65c7){if(_0x4c65c7['type']!==_0x95f8('0x3f')){var _0x57f70e={};_0x57f70e[_0x4c65c7['name']]={'$like':'%'+_0x4bb61d[_0x95f8('0x34')]['filter']+'%'};return _0x57f70e;}})});}_0x1c7615=_[_0x95f8('0x40')]({},_0x1c7615,_0x4bb61d[_0x95f8('0x41')]);var _0x52cf72={'where':_0x1c7615[_0x95f8('0x3c')]};return db['FreshsalesField'][_0x95f8('0x20')](_0x52cf72)[_0x95f8('0x27')](function(_0x5aabbe){_0x94a55c[_0x95f8('0x20')]=_0x5aabbe;if(_0x4bb61d[_0x95f8('0x34')][_0x95f8('0x42')]){_0x1c7615[_0x95f8('0x43')]=[{'all':!![]}];}return db[_0x95f8('0x30')][_0x95f8('0x44')](_0x1c7615);})[_0x95f8('0x27')](function(_0x1945df){_0x94a55c[_0x95f8('0x45')]=_0x1945df;return _0x94a55c;})['then'](respondWithFilteredResult(_0x64f565,_0x1c7615))['catch'](handleError(_0x64f565,null));};exports[_0x95f8('0x46')]=function(_0x2bc05e,_0x59002a){var _0x8ab106={'raw':!![],'where':{'id':_0x2bc05e[_0x95f8('0x47')]['id']}},_0x35f144={};_0x35f144['model']=_['keys'](db['FreshsalesField'][_0x95f8('0x48')]);_0x35f144[_0x95f8('0x34')]=_[_0x95f8('0x35')](_0x2bc05e[_0x95f8('0x34')]);_0x35f144[_0x95f8('0x36')]=_[_0x95f8('0x49')](_0x35f144[_0x95f8('0x33')],_0x35f144[_0x95f8('0x34')]);_0x8ab106[_0x95f8('0x37')]=_[_0x95f8('0x49')](_0x35f144['model'],qs[_0x95f8('0x38')](_0x2bc05e[_0x95f8('0x34')][_0x95f8('0x38')]));_0x8ab106[_0x95f8('0x37')]=_0x8ab106['attributes'][_0x95f8('0x4a')]?_0x8ab106[_0x95f8('0x37')]:_0x35f144[_0x95f8('0x33')];if(_0x2bc05e[_0x95f8('0x34')]['includeAll']){_0x8ab106[_0x95f8('0x43')]=[{'all':!![]}];}_0x8ab106=_[_0x95f8('0x40')]({},_0x8ab106,_0x2bc05e[_0x95f8('0x41')]);return db['FreshsalesField'][_0x95f8('0x4b')](_0x8ab106)[_0x95f8('0x27')](handleEntityNotFound(_0x59002a,null))[_0x95f8('0x27')](respondWithResult(_0x59002a,null))[_0x95f8('0x4c')](handleError(_0x59002a,null));};exports['create']=function(_0x51ad3a,_0x2efd7f){return db[_0x95f8('0x30')][_0x95f8('0x4d')](_0x51ad3a[_0x95f8('0x4e')],{})[_0x95f8('0x27')](respondWithResult(_0x2efd7f,0xc9))[_0x95f8('0x4c')](handleError(_0x2efd7f,null));};exports[_0x95f8('0x26')]=function(_0x315199,_0x11810d){if(_0x315199['body']['id']){delete _0x315199[_0x95f8('0x4e')]['id'];}return db[_0x95f8('0x30')][_0x95f8('0x4b')]({'where':{'id':_0x315199[_0x95f8('0x47')]['id']}})[_0x95f8('0x27')](handleEntityNotFound(_0x11810d,null))[_0x95f8('0x27')](saveUpdates(_0x315199[_0x95f8('0x4e')],null))[_0x95f8('0x27')](respondWithResult(_0x11810d,null))[_0x95f8('0x4c')](handleError(_0x11810d,null));};exports[_0x95f8('0x28')]=function(_0x22c693,_0x453003){return db['FreshsalesField'][_0x95f8('0x4b')]({'where':{'id':_0x22c693[_0x95f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x453003,null))[_0x95f8('0x27')](removeEntity(_0x453003,null))[_0x95f8('0x4c')](handleError(_0x453003,null));}; \ No newline at end of file +var _0xdab6=['map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','findAll','catch','show','params','rawAttributes','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','apply','save','update','destroy','then','error','stack','name','index','FreshsalesField','fieldName','type','model'];(function(_0x41b5c9,_0x5e0bbb){var _0x359fb3=function(_0x2baeb){while(--_0x2baeb){_0x41b5c9['push'](_0x41b5c9['shift']());}};_0x359fb3(++_0x5e0bbb);}(_0xdab6,0x1d8));var _0x6dab=function(_0x50174f,_0xc095c1){_0x50174f=_0x50174f-0x0;var _0x352da3=_0xdab6[_0x50174f];return _0x352da3;};'use strict';var emlformat=require(_0x6dab('0x0'));var rimraf=require(_0x6dab('0x1'));var zipdir=require(_0x6dab('0x2'));var jsonpatch=require(_0x6dab('0x3'));var rp=require(_0x6dab('0x4'));var moment=require('moment');var BPromise=require(_0x6dab('0x5'));var Mustache=require(_0x6dab('0x6'));var util=require(_0x6dab('0x7'));var path=require(_0x6dab('0x8'));var sox=require('sox');var csv=require(_0x6dab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6dab('0xa'));var _=require(_0x6dab('0xb'));var squel=require('squel');var crypto=require(_0x6dab('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6dab('0xd'));var toCsv=require(_0x6dab('0x9'));var querystring=require(_0x6dab('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6dab('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dab('0x10'))('api');var utils=require(_0x6dab('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6dab('0x12'));var db=require(_0x6dab('0x13'))['db'];function respondWithStatusCode(_0x343acb,_0xc5ba4f){_0xc5ba4f=_0xc5ba4f||0xcc;return function(_0x462564){if(_0x462564){return _0x343acb[_0x6dab('0x14')](_0xc5ba4f);}return _0x343acb['status'](_0xc5ba4f)[_0x6dab('0x15')]();};}function respondWithResult(_0x48cbb9,_0x1751e5){_0x1751e5=_0x1751e5||0xc8;return function(_0x1c6c32){if(_0x1c6c32){return _0x48cbb9[_0x6dab('0x16')](_0x1751e5)[_0x6dab('0x17')](_0x1c6c32);}};}function respondWithFilteredResult(_0x470c13,_0x158dad){return function(_0x3b32e5){if(_0x3b32e5){var _0x34692f=typeof _0x158dad[_0x6dab('0x18')]==='undefined'&&typeof _0x158dad[_0x6dab('0x19')]==='undefined';var _0x3da9ad=_0x3b32e5[_0x6dab('0x1a')];var _0x3d3e87=_0x34692f?0x0:_0x158dad[_0x6dab('0x18')];var _0x58dfec=_0x34692f?_0x3b32e5[_0x6dab('0x1a')]:_0x158dad[_0x6dab('0x18')]+_0x158dad['limit'];var _0x1be5a6;if(_0x58dfec>=_0x3da9ad){_0x58dfec=_0x3da9ad;_0x1be5a6=0xc8;}else{_0x1be5a6=0xce;}_0x470c13[_0x6dab('0x16')](_0x1be5a6);return _0x470c13['set']('Content-Range',_0x3d3e87+'-'+_0x58dfec+'/'+_0x3da9ad)[_0x6dab('0x17')](_0x3b32e5);}return null;};}function patchUpdates(_0x57adac){return function(_0x454046){try{jsonpatch[_0x6dab('0x1b')](_0x454046,_0x57adac,!![]);}catch(_0x1753e8){return BPromise['reject'](_0x1753e8);}return _0x454046[_0x6dab('0x1c')]();};}function saveUpdates(_0x2e470e,_0x48debe){return function(_0x3a9944){if(_0x3a9944){return _0x3a9944[_0x6dab('0x1d')](_0x2e470e)['then'](function(_0x1a6995){return _0x1a6995;});}return null;};}function removeEntity(_0x3b8d08,_0x12d105){return function(_0x2dfdd5){if(_0x2dfdd5){return _0x2dfdd5[_0x6dab('0x1e')]()[_0x6dab('0x1f')](function(){_0x3b8d08[_0x6dab('0x16')](0xcc)[_0x6dab('0x15')]();});}};}function handleEntityNotFound(_0x55232f,_0x589351){return function(_0xced469){if(!_0xced469){_0x55232f[_0x6dab('0x14')](0x194);}return _0xced469;};}function handleError(_0x4bd580,_0x4767db){_0x4767db=_0x4767db||0x1f4;return function(_0x216914){logger[_0x6dab('0x20')](_0x216914[_0x6dab('0x21')]);if(_0x216914[_0x6dab('0x22')]){delete _0x216914[_0x6dab('0x22')];}_0x4bd580[_0x6dab('0x16')](_0x4767db)['send'](_0x216914);};}exports[_0x6dab('0x23')]=function(_0x527e90,_0x2988c7){var _0x14c19e={},_0x156d83={},_0x3e5d72={'count':0x0,'rows':[]};var _0x10f842=_['map'](db[_0x6dab('0x24')]['rawAttributes'],function(_0x4f8251){return{'name':_0x4f8251[_0x6dab('0x25')],'type':_0x4f8251[_0x6dab('0x26')]['key']};});_0x156d83[_0x6dab('0x27')]=_[_0x6dab('0x28')](_0x10f842,_0x6dab('0x22'));_0x156d83['query']=_[_0x6dab('0x29')](_0x527e90[_0x6dab('0x2a')]);_0x156d83[_0x6dab('0x2b')]=_[_0x6dab('0x2c')](_0x156d83['model'],_0x156d83['query']);_0x14c19e[_0x6dab('0x2d')]=_['intersection'](_0x156d83[_0x6dab('0x27')],qs['fields'](_0x527e90['query'][_0x6dab('0x2e')]));_0x14c19e['attributes']=_0x14c19e[_0x6dab('0x2d')]['length']?_0x14c19e[_0x6dab('0x2d')]:_0x156d83[_0x6dab('0x27')];if(!_0x527e90[_0x6dab('0x2a')][_0x6dab('0x2f')]('nolimit')){_0x14c19e[_0x6dab('0x19')]=qs[_0x6dab('0x19')](_0x527e90['query'][_0x6dab('0x19')]);_0x14c19e[_0x6dab('0x18')]=qs[_0x6dab('0x18')](_0x527e90[_0x6dab('0x2a')][_0x6dab('0x18')]);}_0x14c19e[_0x6dab('0x30')]=qs[_0x6dab('0x31')](_0x527e90[_0x6dab('0x2a')]['sort']);_0x14c19e['where']=qs[_0x6dab('0x2b')](_[_0x6dab('0x32')](_0x527e90[_0x6dab('0x2a')],_0x156d83[_0x6dab('0x2b')]),_0x10f842);if(_0x527e90[_0x6dab('0x2a')][_0x6dab('0x33')]){_0x14c19e[_0x6dab('0x34')]=_[_0x6dab('0x35')](_0x14c19e[_0x6dab('0x34')],{'$or':_[_0x6dab('0x28')](_0x10f842,function(_0x2d7570){if(_0x2d7570[_0x6dab('0x26')]!=='VIRTUAL'){var _0x2ff318={};_0x2ff318[_0x2d7570['name']]={'$like':'%'+_0x527e90['query']['filter']+'%'};return _0x2ff318;}})});}_0x14c19e=_['merge']({},_0x14c19e,_0x527e90['options']);var _0x1d577e={'where':_0x14c19e['where']};return db[_0x6dab('0x24')]['count'](_0x1d577e)[_0x6dab('0x1f')](function(_0x3a4c91){_0x3e5d72[_0x6dab('0x1a')]=_0x3a4c91;if(_0x527e90[_0x6dab('0x2a')][_0x6dab('0x36')]){_0x14c19e['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x6dab('0x37')](_0x14c19e);})[_0x6dab('0x1f')](function(_0x451daa){_0x3e5d72['rows']=_0x451daa;return _0x3e5d72;})[_0x6dab('0x1f')](respondWithFilteredResult(_0x2988c7,_0x14c19e))[_0x6dab('0x38')](handleError(_0x2988c7,null));};exports[_0x6dab('0x39')]=function(_0x5e4764,_0x1d0387){var _0x18b2ed={'raw':!![],'where':{'id':_0x5e4764[_0x6dab('0x3a')]['id']}},_0x2fbd75={};_0x2fbd75[_0x6dab('0x27')]=_[_0x6dab('0x29')](db[_0x6dab('0x24')][_0x6dab('0x3b')]);_0x2fbd75[_0x6dab('0x2a')]=_['keys'](_0x5e4764[_0x6dab('0x2a')]);_0x2fbd75[_0x6dab('0x2b')]=_['intersection'](_0x2fbd75[_0x6dab('0x27')],_0x2fbd75['query']);_0x18b2ed[_0x6dab('0x2d')]=_[_0x6dab('0x2c')](_0x2fbd75[_0x6dab('0x27')],qs[_0x6dab('0x2e')](_0x5e4764[_0x6dab('0x2a')][_0x6dab('0x2e')]));_0x18b2ed[_0x6dab('0x2d')]=_0x18b2ed['attributes'][_0x6dab('0x3c')]?_0x18b2ed[_0x6dab('0x2d')]:_0x2fbd75['model'];if(_0x5e4764[_0x6dab('0x2a')][_0x6dab('0x36')]){_0x18b2ed['include']=[{'all':!![]}];}_0x18b2ed=_['merge']({},_0x18b2ed,_0x5e4764['options']);return db[_0x6dab('0x24')]['find'](_0x18b2ed)['then'](handleEntityNotFound(_0x1d0387,null))[_0x6dab('0x1f')](respondWithResult(_0x1d0387,null))[_0x6dab('0x38')](handleError(_0x1d0387,null));};exports['create']=function(_0x47556c,_0x2f3f74){return db[_0x6dab('0x24')][_0x6dab('0x3d')](_0x47556c[_0x6dab('0x3e')],{})[_0x6dab('0x1f')](respondWithResult(_0x2f3f74,0xc9))[_0x6dab('0x38')](handleError(_0x2f3f74,null));};exports[_0x6dab('0x1d')]=function(_0x322e43,_0x52ee4e){if(_0x322e43[_0x6dab('0x3e')]['id']){delete _0x322e43[_0x6dab('0x3e')]['id'];}return db['FreshsalesField'][_0x6dab('0x3f')]({'where':{'id':_0x322e43[_0x6dab('0x3a')]['id']}})[_0x6dab('0x1f')](handleEntityNotFound(_0x52ee4e,null))[_0x6dab('0x1f')](saveUpdates(_0x322e43[_0x6dab('0x3e')],null))[_0x6dab('0x1f')](respondWithResult(_0x52ee4e,null))[_0x6dab('0x38')](handleError(_0x52ee4e,null));};exports[_0x6dab('0x1e')]=function(_0x11af50,_0x1a46b7){return db[_0x6dab('0x24')][_0x6dab('0x3f')]({'where':{'id':_0x11af50[_0x6dab('0x3a')]['id']}})[_0x6dab('0x1f')](handleEntityNotFound(_0x1a46b7,null))[_0x6dab('0x1f')](removeEntity(_0x1a46b7,null))[_0x6dab('0x38')](handleError(_0x1a46b7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f32fff7..1aa78fe 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 _0xb9e7=['int_freshsales_fields','freshsales_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshsalesField'];(function(_0xf11681,_0x39a858){var _0x199843=function(_0x28df2b){while(--_0x28df2b){_0xf11681['push'](_0xf11681['shift']());}};_0x199843(++_0x39a858);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0xb9e7[_0x2389bc];return _0x170548;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var logger=require(_0x7b9e('0x1'))(_0x7b9e('0x2'));var moment=require(_0x7b9e('0x3'));var BPromise=require(_0x7b9e('0x4'));var rp=require(_0x7b9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b9e('0x6'));var config=require(_0x7b9e('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x7b9e('0x8')]=function(_0x51a0ca,_0x3a9c5e){return _0x51a0ca[_0x7b9e('0x9')](_0x7b9e('0xa'),attributes,{'tableName':_0x7b9e('0xb'),'paranoid':![],'indexes':[{'name':_0x7b9e('0xc'),'fields':['idField',_0x7b9e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5c8=['rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb5a39b,_0x24851a){var _0x28b630=function(_0x3031d3){while(--_0x3031d3){_0xb5a39b['push'](_0xb5a39b['shift']());}};_0x28b630(++_0x24851a);}(_0xd5c8,0x166));var _0x8d5c=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xd5c8[_0xbc1a4b];return _0x108b87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d5c('0x0'))(_0x8d5c('0x1'));var moment=require(_0x8d5c('0x2'));var BPromise=require(_0x8d5c('0x3'));var rp=require(_0x8d5c('0x4'));var fs=require('fs');var path=require(_0x8d5c('0x5'));var rimraf=require(_0x8d5c('0x6'));var config=require(_0x8d5c('0x7'));var attributes=require(_0x8d5c('0x8'));module['exports']=function(_0xd72ba3,_0x5d3fff){return _0xd72ba3['define'](_0x8d5c('0x9'),attributes,{'tableName':_0x8d5c('0xa'),'paranoid':![],'indexes':[{'name':_0x8d5c('0xb'),'fields':[_0x8d5c('0xc'),'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 e6d1588..885c92b 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 _0xc6ac=['http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4380ca,_0x3dd437){var _0x5b935c=function(_0x2a06fd){while(--_0x2a06fd){_0x4380ca['push'](_0x4380ca['shift']());}};_0x5b935c(++_0x3dd437);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x264926,_0x2c4c25){_0x264926=_0x264926-0x0;var _0x41ab6e=_0xc6ac[_0x264926];return _0x41ab6e;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\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(_0x475619,_0x51659c){var _0x31eba1=function(_0x486ed2){while(--_0x486ed2){_0x475619['push'](_0x475619['shift']());}};_0x31eba1(++_0x51659c);}(_0x1261,0x144));var _0x1126=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0x1261[_0x206096];return _0x3f3b50;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d170e20..c4857ff 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(_0x3d28e0,_0x285324){var _0x383b78=function(_0x4370c1){while(--_0x4370c1){_0x3d28e0['push'](_0x3d28e0['shift']());}};_0x383b78(++_0x285324);}(_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('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2ebc31,_0x336378){var _0x4a96ef=function(_0x547b83){while(--_0x547b83){_0x2ebc31['push'](_0x2ebc31['shift']());}};_0x4a96ef(++_0x336378);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7c799f6..467a0ab 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 _0xf846=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xf846,0x85));var _0x6f84=function(_0x4e5021,_0x4f07ff){_0x4e5021=_0x4e5021-0x0;var _0x4b3b34=_0xf846[_0x4e5021];return _0x4b3b34;};'use strict';var Sequelize=require(_0x6f84('0x0'));module[_0x6f84('0x1')]={'name':{'type':Sequelize[_0x6f84('0x2')]},'description':{'type':Sequelize[_0x6f84('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6f84('0x3')},'remoteUri':{'type':Sequelize[_0x6f84('0x2')]},'password':{'type':Sequelize[_0x6f84('0x2')]},'clientId':{'type':Sequelize[_0x6f84('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x6f84('0x2')]},'serverUrl':{'type':Sequelize[_0x6f84('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6f84('0x4')](_0x6f84('0x5'),_0x6f84('0x6')),'defaultValue':_0x6f84('0x5')}}; \ No newline at end of file +var _0x58cc=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x37e505,_0x3bc266){var _0xf266a7=function(_0x519ef2){while(--_0x519ef2){_0x37e505['push'](_0x37e505['shift']());}};_0xf266a7(++_0x3bc266);}(_0x58cc,0x7a));var _0xc58c=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x58cc[_0x3da832];return _0xe602f2;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'name':{'type':Sequelize[_0xc58c('0x2')]},'description':{'type':Sequelize[_0xc58c('0x2')]},'username':{'type':Sequelize[_0xc58c('0x2')],'unique':_0xc58c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc58c('0x2')]},'clientId':{'type':Sequelize[_0xc58c('0x2')]},'clientSecret':{'type':Sequelize[_0xc58c('0x2')]},'securityToken':{'type':Sequelize[_0xc58c('0x2')]},'serverUrl':{'type':Sequelize[_0xc58c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc58c('0x4')]('integrationTab','newTab'),'defaultValue':_0xc58c('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 44a7329..9916e3f 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 _0xe417=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SalesforceAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','update','body','destroy','params','findOne','SalesforceConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','password','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3539b9,_0x20937a){var _0x4e72c8=function(_0x198a8d){while(--_0x198a8d){_0x3539b9['push'](_0x3539b9['shift']());}};_0x4e72c8(++_0x20937a);}(_0xe417,0xeb));var _0x7e41=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xe417[_0x5311e8];return _0x582ad8;};'use strict';var emlformat=require(_0x7e41('0x0'));var rimraf=require(_0x7e41('0x1'));var zipdir=require(_0x7e41('0x2'));var jsonpatch=require(_0x7e41('0x3'));var rp=require(_0x7e41('0x4'));var moment=require(_0x7e41('0x5'));var BPromise=require(_0x7e41('0x6'));var Mustache=require(_0x7e41('0x7'));var util=require(_0x7e41('0x8'));var path=require(_0x7e41('0x9'));var sox=require(_0x7e41('0xa'));var csv=require(_0x7e41('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e41('0xc'));var squel=require('squel');var crypto=require(_0x7e41('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e41('0xe'));var toCsv=require(_0x7e41('0xb'));var querystring=require(_0x7e41('0xf'));var Papa=require(_0x7e41('0x10'));var Redis=require(_0x7e41('0x11'));var authService=require(_0x7e41('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7e41('0x13'));var hardwareService=require(_0x7e41('0x14'));var logger=require(_0x7e41('0x15'))('api');var utils=require(_0x7e41('0x16'));var config=require(_0x7e41('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e41('0x18'))['db'];var integrations=require(_0x7e41('0x19'));function respondWithStatusCode(_0x4c3f43,_0x226ef2){_0x226ef2=_0x226ef2||0xcc;return function(_0x4ac59b){if(_0x4ac59b){return _0x4c3f43[_0x7e41('0x1a')](_0x226ef2);}return _0x4c3f43[_0x7e41('0x1b')](_0x226ef2)[_0x7e41('0x1c')]();};}function respondWithResult(_0x5b5b83,_0x3ebbad){_0x3ebbad=_0x3ebbad||0xc8;return function(_0x337b3e){if(_0x337b3e){return _0x5b5b83['status'](_0x3ebbad)[_0x7e41('0x1d')](_0x337b3e);}};}function respondWithFilteredResult(_0x45902f,_0x4372c7){return function(_0x3b9ea8){if(_0x3b9ea8){var _0x92c5d7=typeof _0x4372c7[_0x7e41('0x1e')]===_0x7e41('0x1f')&&typeof _0x4372c7[_0x7e41('0x20')]===_0x7e41('0x1f');var _0xc9645a=_0x3b9ea8[_0x7e41('0x21')];var _0x5fd1f5=_0x92c5d7?0x0:_0x4372c7['offset'];var _0x4d1534=_0x92c5d7?_0x3b9ea8['count']:_0x4372c7[_0x7e41('0x1e')]+_0x4372c7[_0x7e41('0x20')];var _0x1c0568;if(_0x4d1534>=_0xc9645a){_0x4d1534=_0xc9645a;_0x1c0568=0xc8;}else{_0x1c0568=0xce;}_0x45902f[_0x7e41('0x1b')](_0x1c0568);return _0x45902f[_0x7e41('0x22')](_0x7e41('0x23'),_0x5fd1f5+'-'+_0x4d1534+'/'+_0xc9645a)[_0x7e41('0x1d')](_0x3b9ea8);}return null;};}function patchUpdates(_0x418e51){return function(_0x2a79b5){try{jsonpatch[_0x7e41('0x24')](_0x2a79b5,_0x418e51,!![]);}catch(_0x3550c0){return BPromise[_0x7e41('0x25')](_0x3550c0);}return _0x2a79b5[_0x7e41('0x26')]();};}function saveUpdates(_0x493aba,_0x492426){return function(_0x592eaa){if(_0x592eaa){return _0x592eaa['update'](_0x493aba)[_0x7e41('0x27')](function(_0x2a4dc8){return _0x2a4dc8;});}return null;};}function removeEntity(_0x57e260,_0x45663b){return function(_0x428360){if(_0x428360){return _0x428360['destroy']()[_0x7e41('0x27')](function(){_0x57e260['status'](0xcc)[_0x7e41('0x1c')]();});}};}function handleEntityNotFound(_0x483ab8,_0x340786){return function(_0x12f01b){if(!_0x12f01b){_0x483ab8['sendStatus'](0x194);}return _0x12f01b;};}function handleError(_0x34875f,_0x7acd6f){_0x7acd6f=_0x7acd6f||0x1f4;return function(_0x5a91e8){logger[_0x7e41('0x28')](_0x5a91e8[_0x7e41('0x29')]);if(_0x5a91e8[_0x7e41('0x2a')]){delete _0x5a91e8[_0x7e41('0x2a')];}_0x34875f[_0x7e41('0x1b')](_0x7acd6f)[_0x7e41('0x2b')](_0x5a91e8);};}exports[_0x7e41('0x2c')]=function(_0x8d305e,_0x3290b2){var _0x3b7e9b={},_0x224dbb={},_0x5afc13={'count':0x0,'rows':[]};var _0x2d70c1=_[_0x7e41('0x2d')](db[_0x7e41('0x2e')]['rawAttributes'],function(_0x2dc343){return{'name':_0x2dc343[_0x7e41('0x2f')],'type':_0x2dc343['type']['key']};});_0x224dbb[_0x7e41('0x30')]=_[_0x7e41('0x2d')](_0x2d70c1,_0x7e41('0x2a'));_0x224dbb[_0x7e41('0x31')]=_[_0x7e41('0x32')](_0x8d305e['query']);_0x224dbb[_0x7e41('0x33')]=_[_0x7e41('0x34')](_0x224dbb['model'],_0x224dbb[_0x7e41('0x31')]);_0x3b7e9b[_0x7e41('0x35')]=_[_0x7e41('0x34')](_0x224dbb['model'],qs['fields'](_0x8d305e[_0x7e41('0x31')][_0x7e41('0x36')]));_0x3b7e9b[_0x7e41('0x35')]=_0x3b7e9b[_0x7e41('0x35')][_0x7e41('0x37')]?_0x3b7e9b['attributes']:_0x224dbb[_0x7e41('0x30')];if(!_0x8d305e['query'][_0x7e41('0x38')](_0x7e41('0x39'))){_0x3b7e9b['limit']=qs[_0x7e41('0x20')](_0x8d305e[_0x7e41('0x31')][_0x7e41('0x20')]);_0x3b7e9b[_0x7e41('0x1e')]=qs[_0x7e41('0x1e')](_0x8d305e[_0x7e41('0x31')][_0x7e41('0x1e')]);}_0x3b7e9b[_0x7e41('0x3a')]=qs[_0x7e41('0x3b')](_0x8d305e['query'][_0x7e41('0x3b')]);_0x3b7e9b[_0x7e41('0x3c')]=qs[_0x7e41('0x33')](_['pick'](_0x8d305e['query'],_0x224dbb['filters']),_0x2d70c1);if(_0x8d305e[_0x7e41('0x31')][_0x7e41('0x3d')]){_0x3b7e9b[_0x7e41('0x3c')]=_[_0x7e41('0x3e')](_0x3b7e9b[_0x7e41('0x3c')],{'$or':_[_0x7e41('0x2d')](_0x2d70c1,function(_0x52b283){if(_0x52b283['type']!==_0x7e41('0x3f')){var _0x56dfb4={};_0x56dfb4[_0x52b283[_0x7e41('0x2a')]]={'$like':'%'+_0x8d305e[_0x7e41('0x31')][_0x7e41('0x3d')]+'%'};return _0x56dfb4;}})});}_0x3b7e9b=_[_0x7e41('0x3e')]({},_0x3b7e9b,_0x8d305e[_0x7e41('0x40')]);var _0x4e9b33={'where':_0x3b7e9b[_0x7e41('0x3c')]};return db['SalesforceAccount'][_0x7e41('0x21')](_0x4e9b33)['then'](function(_0x3f51c6){_0x5afc13['count']=_0x3f51c6;if(_0x8d305e[_0x7e41('0x31')][_0x7e41('0x41')]){_0x3b7e9b[_0x7e41('0x42')]=[{'all':!![]}];}return db[_0x7e41('0x2e')]['findAll'](_0x3b7e9b);})['then'](function(_0x586377){_0x5afc13[_0x7e41('0x43')]=_0x586377;return _0x5afc13;})[_0x7e41('0x27')](respondWithFilteredResult(_0x3290b2,_0x3b7e9b))[_0x7e41('0x44')](handleError(_0x3290b2,null));};exports[_0x7e41('0x45')]=function(_0x2110e9,_0x130b76){var _0x333ef0={'raw':![],'where':{'id':_0x2110e9['params']['id']}},_0x3abdc0={};_0x3abdc0[_0x7e41('0x30')]=_[_0x7e41('0x32')](db[_0x7e41('0x2e')][_0x7e41('0x46')]);_0x3abdc0[_0x7e41('0x31')]=_['keys'](_0x2110e9[_0x7e41('0x31')]);_0x3abdc0[_0x7e41('0x33')]=_[_0x7e41('0x34')](_0x3abdc0[_0x7e41('0x30')],_0x3abdc0[_0x7e41('0x31')]);_0x333ef0[_0x7e41('0x35')]=_[_0x7e41('0x34')](_0x3abdc0['model'],qs[_0x7e41('0x36')](_0x2110e9[_0x7e41('0x31')][_0x7e41('0x36')]));_0x333ef0['attributes']=_0x333ef0[_0x7e41('0x35')][_0x7e41('0x37')]?_0x333ef0[_0x7e41('0x35')]:_0x3abdc0['model'];if(_0x2110e9[_0x7e41('0x31')]['includeAll']){_0x333ef0[_0x7e41('0x42')]=[{'all':!![]}];}_0x333ef0=_['merge']({},_0x333ef0,_0x2110e9[_0x7e41('0x40')]);return db[_0x7e41('0x2e')][_0x7e41('0x47')](_0x333ef0)[_0x7e41('0x27')](handleEntityNotFound(_0x130b76,null))['then'](respondWithResult(_0x130b76,null))[_0x7e41('0x44')](handleError(_0x130b76,null));};exports[_0x7e41('0x48')]=function(_0x302b2d,_0x3208d2){return db['SalesforceAccount'][_0x7e41('0x48')](_0x302b2d['body'],{})['then'](respondWithResult(_0x3208d2,0xc9))[_0x7e41('0x44')](handleError(_0x3208d2,null));};exports[_0x7e41('0x49')]=function(_0x29bac9,_0x547aaf){if(_0x29bac9[_0x7e41('0x4a')]['id']){delete _0x29bac9[_0x7e41('0x4a')]['id'];}return db[_0x7e41('0x2e')]['find']({'where':{'id':_0x29bac9['params']['id']}})[_0x7e41('0x27')](handleEntityNotFound(_0x547aaf,null))[_0x7e41('0x27')](saveUpdates(_0x29bac9['body'],null))[_0x7e41('0x27')](respondWithResult(_0x547aaf,null))[_0x7e41('0x44')](handleError(_0x547aaf,null));};exports[_0x7e41('0x4b')]=function(_0xcc3d93,_0x11d575){return db[_0x7e41('0x2e')]['find']({'where':{'id':_0xcc3d93[_0x7e41('0x4c')]['id']}})[_0x7e41('0x27')](handleEntityNotFound(_0x11d575,null))[_0x7e41('0x27')](removeEntity(_0x11d575,null))[_0x7e41('0x44')](handleError(_0x11d575,null));};exports['getConfigurations']=function(_0x487e8c,_0x2d26e9,_0x41c54f){var _0x342de4={};var _0x18e29e={};var _0x452079;var _0x185ca1;return db[_0x7e41('0x2e')][_0x7e41('0x4d')]({'where':{'id':_0x487e8c[_0x7e41('0x4c')]['id']}})[_0x7e41('0x27')](handleEntityNotFound(_0x2d26e9,null))[_0x7e41('0x27')](function(_0x16758f){if(_0x16758f){_0x452079=_0x16758f;_0x18e29e['model']=_['keys'](db[_0x7e41('0x4e')]['rawAttributes']);_0x18e29e[_0x7e41('0x31')]=_[_0x7e41('0x32')](_0x487e8c[_0x7e41('0x31')]);_0x18e29e['filters']=_[_0x7e41('0x34')](_0x18e29e[_0x7e41('0x30')],_0x18e29e[_0x7e41('0x31')]);_0x342de4[_0x7e41('0x35')]=_['intersection'](_0x18e29e[_0x7e41('0x30')],qs[_0x7e41('0x36')](_0x487e8c[_0x7e41('0x31')]['fields']));_0x342de4[_0x7e41('0x35')]=_0x342de4[_0x7e41('0x35')]['length']?_0x342de4['attributes']:_0x18e29e[_0x7e41('0x30')];_0x342de4[_0x7e41('0x3a')]=qs[_0x7e41('0x3b')](_0x487e8c[_0x7e41('0x31')]['sort']);_0x342de4[_0x7e41('0x3c')]=qs[_0x7e41('0x33')](_[_0x7e41('0x4f')](_0x487e8c['query'],_0x18e29e[_0x7e41('0x33')]));if(_0x487e8c['query'][_0x7e41('0x3d')]){_0x342de4['where']=_[_0x7e41('0x3e')](_0x342de4[_0x7e41('0x3c')],{'$or':_[_0x7e41('0x2d')](_0x342de4[_0x7e41('0x35')],function(_0x1e8791){var _0x227f32={};_0x227f32[_0x1e8791]={'$like':'%'+_0x487e8c[_0x7e41('0x31')][_0x7e41('0x3d')]+'%'};return _0x227f32;})});}_0x342de4=_[_0x7e41('0x3e')]({},_0x342de4,_0x487e8c[_0x7e41('0x40')]);return _0x452079[_0x7e41('0x50')](_0x342de4);}})[_0x7e41('0x27')](function(_0x47ef56){if(_0x47ef56){_0x185ca1=_0x47ef56[_0x7e41('0x37')];if(!_0x487e8c[_0x7e41('0x31')][_0x7e41('0x38')]('nolimit')){_0x342de4[_0x7e41('0x20')]=qs['limit'](_0x487e8c[_0x7e41('0x31')][_0x7e41('0x20')]);_0x342de4[_0x7e41('0x1e')]=qs[_0x7e41('0x1e')](_0x487e8c[_0x7e41('0x31')][_0x7e41('0x1e')]);}return _0x452079[_0x7e41('0x50')](_0x342de4);}})[_0x7e41('0x27')](function(_0x5d4722){if(_0x5d4722){return _0x5d4722?{'count':_0x185ca1,'rows':_0x5d4722}:null;}})[_0x7e41('0x27')](respondWithResult(_0x2d26e9,null))[_0x7e41('0x44')](handleError(_0x2d26e9,null));};exports[_0x7e41('0x51')]=function(_0x4c61ec,_0x946aa9,_0x1cc197){if(_0x4c61ec[_0x7e41('0x4a')]['id']){delete _0x4c61ec['body']['id'];}return db['SalesforceAccount'][_0x7e41('0x4d')]({'where':{'id':_0x4c61ec[_0x7e41('0x4c')]['id']}})[_0x7e41('0x27')](handleEntityNotFound(_0x946aa9,null))['then'](function(_0x2188a6){if(_0x2188a6){_0x4c61ec[_0x7e41('0x4a')][_0x7e41('0x52')]=_0x2188a6['id'];_0x4c61ec[_0x7e41('0x4a')][_0x7e41('0x53')]=integrations[_0x7e41('0x54')](_0x4c61ec[_0x7e41('0x4a')][_0x7e41('0x55')],_0x4c61ec[_0x7e41('0x4a')][_0x7e41('0x56')]);_0x4c61ec['body'][_0x7e41('0x57')]=integrations[_0x7e41('0x58')](_0x4c61ec[_0x7e41('0x4a')][_0x7e41('0x55')],_0x4c61ec[_0x7e41('0x4a')][_0x7e41('0x56')]);return db[_0x7e41('0x4e')][_0x7e41('0x48')](_0x4c61ec[_0x7e41('0x4a')],{'include':[{'model':db[_0x7e41('0x59')],'as':_0x7e41('0x53')},{'model':db[_0x7e41('0x59')],'as':_0x7e41('0x57')}]});}return null;})[_0x7e41('0x27')](respondWithResult(_0x946aa9,null))[_0x7e41('0x44')](handleError(_0x946aa9,null));};exports[_0x7e41('0x5a')]=function(_0x2a6b44,_0x4bd680,_0x296807){var _0x54b4b9;var _0x3df396='';var _0x8e25a0='Task';return db[_0x7e41('0x2e')][_0x7e41('0x4d')]({'where':{'id':_0x2a6b44['params']['id']},'attributes':['id',_0x7e41('0x5b'),_0x7e41('0x5c'),_0x7e41('0x5d'),_0x7e41('0x5e'),'password',_0x7e41('0x5f')]})[_0x7e41('0x27')](handleEntityNotFound(_0x4bd680,null))['then'](function(_0x28e7fd){if(_0x28e7fd){_0x3df396=_0x28e7fd['remoteUri'];var _0x5894a9=_0x3df396[_0x7e41('0x60')](-0x1);if(_0x5894a9==='/'){_0x3df396=_0x3df396[_0x7e41('0x61')](0x0,_0x3df396[_0x7e41('0x62')](_0x5894a9));}_0x54b4b9=new jsforce[(_0x7e41('0x63'))]({'oauth2':{'loginUrl':_0x3df396,'clientId':_0x28e7fd[_0x7e41('0x5c')],'clientSecret':_0x28e7fd[_0x7e41('0x5d')]}});return _0x54b4b9[_0x7e41('0x64')](_0x28e7fd[_0x7e41('0x5e')],_0x28e7fd[_0x7e41('0x65')]['concat'](_0x28e7fd['securityToken']));}})['then'](function(_0x49bc34){if(_0x49bc34){if(!_[_0x7e41('0x66')](_0x2a6b44[_0x7e41('0x31')][_0x7e41('0x67')])){_0x8e25a0=_0x2a6b44['query']['ticketType'];}return _0x54b4b9[_0x7e41('0x68')](_0x8e25a0)[_0x7e41('0x69')]();}})[_0x7e41('0x27')](function(_0x3710ed){var _0xf6b8f3=[_0x7e41('0x6a'),_0x7e41('0x6b'),_0x7e41('0x6c'),_0x7e41('0x6d'),_0x7e41('0x6e'),_0x7e41('0x6f')];var _0xd14f9e=[_0x7e41('0x70'),'int','picklist','boolean',_0x7e41('0x71'),_0x7e41('0x72'),_0x7e41('0x73')];if(_0x3710ed){_[_0x7e41('0x74')](_0x3710ed[_0x7e41('0x36')],function(_0xd227d2){return _0xf6b8f3[_0x7e41('0x75')](_0xd227d2[_0x7e41('0x2a')])||!_0xd14f9e['includes'](_0xd227d2[_0x7e41('0x56')]);});return{'count':_0x3710ed['fields'][_0x7e41('0x37')],'rows':_[_0x7e41('0x2d')](_0x3710ed['fields'],function(_0x30ed5b){return{'id':_0x30ed5b[_0x7e41('0x2a')],'name':_0x30ed5b[_0x7e41('0x76')],'custom':_0x30ed5b['custom'],'options':_0x30ed5b[_0x7e41('0x77')][_0x7e41('0x37')]>0x0?_[_0x7e41('0x2d')](_0x30ed5b['picklistValues'],function(_0x635ba9){return{'name':_0x635ba9['label'],'value':_0x635ba9[_0x7e41('0x78')]};}):_0x30ed5b[_0x7e41('0x56')]=='boolean'?[{'name':_0x7e41('0x79'),'value':_0x7e41('0x7a')},{'name':_0x7e41('0x7b'),'value':'false'}]:[]};})};}})[_0x7e41('0x27')](respondWithResult(_0x4bd680,null))[_0x7e41('0x44')](function(_0x4e40e0){var _0x39b4ec=_0x2a6b44['query']['test']?0x1f4:_0x4e40e0[_0x7e41('0x7c')]||0x1f4;logger['error'](_0x7e41('0x7d'),'getFields',_0x39b4ec,JSON[_0x7e41('0x7e')](_0x4e40e0));delete _0x4e40e0[_0x7e41('0x2a')];if(_0x39b4ec===0x191){_0x39b4ec=0x190;}_0x4bd680[_0x7e41('0x1b')](_0x39b4ec)[_0x7e41('0x2b')](_0x2a6b44[_0x7e41('0x31')][_0x7e41('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x4e40e0['statusCode']}:_0x4e40e0);});}; \ No newline at end of file +var _0x35a0=['query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','catch','show','params','include','find','create','body','findOne','keys','SalesforceConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','remove','includes','picklistValues','label','value','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','mustache','util','path','sox','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','apply','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key'];(function(_0x4f21cd,_0x45c553){var _0x314ebb=function(_0x510601){while(--_0x510601){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x314ebb(++_0x45c553);}(_0x35a0,0xbd));var _0x035a=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x35a0[_0x14c00f];return _0x19fbda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x035a('0x0'));var zipdir=require(_0x035a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x035a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x035a('0x3'));var util=require(_0x035a('0x4'));var path=require(_0x035a('0x5'));var sox=require(_0x035a('0x6'));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(_0x035a('0x7'));var crypto=require(_0x035a('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x035a('0x9'));var querystring=require(_0x035a('0xa'));var Papa=require(_0x035a('0xb'));var Redis=require(_0x035a('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x035a('0xd'));var hardwareService=require(_0x035a('0xe'));var logger=require(_0x035a('0xf'))(_0x035a('0x10'));var utils=require(_0x035a('0x11'));var config=require(_0x035a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x035a('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ec710,_0x5b1007){_0x5b1007=_0x5b1007||0xcc;return function(_0xe38e2a){if(_0xe38e2a){return _0x4ec710[_0x035a('0x14')](_0x5b1007);}return _0x4ec710[_0x035a('0x15')](_0x5b1007)[_0x035a('0x16')]();};}function respondWithResult(_0x3cc5df,_0x34e7b5){_0x34e7b5=_0x34e7b5||0xc8;return function(_0x538291){if(_0x538291){return _0x3cc5df['status'](_0x34e7b5)['json'](_0x538291);}};}function respondWithFilteredResult(_0x12b97f,_0x36ba07){return function(_0x232f20){if(_0x232f20){var _0x27a1e1=typeof _0x36ba07[_0x035a('0x17')]===_0x035a('0x18')&&typeof _0x36ba07['limit']===_0x035a('0x18');var _0xe34c30=_0x232f20['count'];var _0x52709e=_0x27a1e1?0x0:_0x36ba07[_0x035a('0x17')];var _0x3342ec=_0x27a1e1?_0x232f20['count']:_0x36ba07['offset']+_0x36ba07['limit'];var _0x4e9965;if(_0x3342ec>=_0xe34c30){_0x3342ec=_0xe34c30;_0x4e9965=0xc8;}else{_0x4e9965=0xce;}_0x12b97f[_0x035a('0x15')](_0x4e9965);return _0x12b97f[_0x035a('0x19')](_0x035a('0x1a'),_0x52709e+'-'+_0x3342ec+'/'+_0xe34c30)['json'](_0x232f20);}return null;};}function patchUpdates(_0x3d2985){return function(_0x477174){try{jsonpatch[_0x035a('0x1b')](_0x477174,_0x3d2985,!![]);}catch(_0x5b1f86){return BPromise['reject'](_0x5b1f86);}return _0x477174['save']();};}function saveUpdates(_0x7f1577,_0x4af50c){return function(_0x4ee6e8){if(_0x4ee6e8){return _0x4ee6e8[_0x035a('0x1c')](_0x7f1577)['then'](function(_0x4b0f86){return _0x4b0f86;});}return null;};}function removeEntity(_0x18ff85,_0x430cb6){return function(_0x1c8cdb){if(_0x1c8cdb){return _0x1c8cdb['destroy']()[_0x035a('0x1d')](function(){_0x18ff85[_0x035a('0x15')](0xcc)[_0x035a('0x16')]();});}};}function handleEntityNotFound(_0x2f8389,_0x2b2795){return function(_0x555b8e){if(!_0x555b8e){_0x2f8389[_0x035a('0x14')](0x194);}return _0x555b8e;};}function handleError(_0x2f6135,_0x3b662b){_0x3b662b=_0x3b662b||0x1f4;return function(_0x49dff0){logger[_0x035a('0x1e')](_0x49dff0[_0x035a('0x1f')]);if(_0x49dff0[_0x035a('0x20')]){delete _0x49dff0[_0x035a('0x20')];}_0x2f6135[_0x035a('0x15')](_0x3b662b)[_0x035a('0x21')](_0x49dff0);};}exports[_0x035a('0x22')]=function(_0x281b23,_0x5d2817){var _0x1a6962={},_0x5111d6={},_0x35e3b0={'count':0x0,'rows':[]};var _0x30b948=_[_0x035a('0x23')](db[_0x035a('0x24')][_0x035a('0x25')],function(_0x5d840a){return{'name':_0x5d840a[_0x035a('0x26')],'type':_0x5d840a[_0x035a('0x27')][_0x035a('0x28')]};});_0x5111d6['model']=_[_0x035a('0x23')](_0x30b948,_0x035a('0x20'));_0x5111d6[_0x035a('0x29')]=_['keys'](_0x281b23[_0x035a('0x29')]);_0x5111d6[_0x035a('0x2a')]=_[_0x035a('0x2b')](_0x5111d6[_0x035a('0x2c')],_0x5111d6[_0x035a('0x29')]);_0x1a6962['attributes']=_[_0x035a('0x2b')](_0x5111d6[_0x035a('0x2c')],qs[_0x035a('0x2d')](_0x281b23[_0x035a('0x29')]['fields']));_0x1a6962[_0x035a('0x2e')]=_0x1a6962['attributes'][_0x035a('0x2f')]?_0x1a6962[_0x035a('0x2e')]:_0x5111d6[_0x035a('0x2c')];if(!_0x281b23['query'][_0x035a('0x30')](_0x035a('0x31'))){_0x1a6962[_0x035a('0x32')]=qs[_0x035a('0x32')](_0x281b23[_0x035a('0x29')]['limit']);_0x1a6962['offset']=qs['offset'](_0x281b23[_0x035a('0x29')][_0x035a('0x17')]);}_0x1a6962['order']=qs[_0x035a('0x33')](_0x281b23['query'][_0x035a('0x33')]);_0x1a6962[_0x035a('0x34')]=qs['filters'](_[_0x035a('0x35')](_0x281b23[_0x035a('0x29')],_0x5111d6[_0x035a('0x2a')]),_0x30b948);if(_0x281b23['query']['filter']){_0x1a6962[_0x035a('0x34')]=_[_0x035a('0x36')](_0x1a6962[_0x035a('0x34')],{'$or':_[_0x035a('0x23')](_0x30b948,function(_0x47cceb){if(_0x47cceb[_0x035a('0x27')]!==_0x035a('0x37')){var _0x363ed6={};_0x363ed6[_0x47cceb[_0x035a('0x20')]]={'$like':'%'+_0x281b23['query'][_0x035a('0x38')]+'%'};return _0x363ed6;}})});}_0x1a6962=_['merge']({},_0x1a6962,_0x281b23[_0x035a('0x39')]);var _0x29e295={'where':_0x1a6962['where']};return db[_0x035a('0x24')][_0x035a('0x3a')](_0x29e295)['then'](function(_0x4f9e0f){_0x35e3b0[_0x035a('0x3a')]=_0x4f9e0f;if(_0x281b23[_0x035a('0x29')]['includeAll']){_0x1a6962['include']=[{'all':!![]}];}return db[_0x035a('0x24')][_0x035a('0x3b')](_0x1a6962);})['then'](function(_0x8b0157){_0x35e3b0[_0x035a('0x3c')]=_0x8b0157;return _0x35e3b0;})[_0x035a('0x1d')](respondWithFilteredResult(_0x5d2817,_0x1a6962))[_0x035a('0x3d')](handleError(_0x5d2817,null));};exports[_0x035a('0x3e')]=function(_0x22d429,_0x36ff22){var _0x4f1836={'raw':![],'where':{'id':_0x22d429[_0x035a('0x3f')]['id']}},_0x27cbab={};_0x27cbab['model']=_['keys'](db['SalesforceAccount'][_0x035a('0x25')]);_0x27cbab[_0x035a('0x29')]=_['keys'](_0x22d429[_0x035a('0x29')]);_0x27cbab[_0x035a('0x2a')]=_['intersection'](_0x27cbab['model'],_0x27cbab[_0x035a('0x29')]);_0x4f1836[_0x035a('0x2e')]=_[_0x035a('0x2b')](_0x27cbab['model'],qs['fields'](_0x22d429['query'][_0x035a('0x2d')]));_0x4f1836[_0x035a('0x2e')]=_0x4f1836[_0x035a('0x2e')][_0x035a('0x2f')]?_0x4f1836['attributes']:_0x27cbab['model'];if(_0x22d429[_0x035a('0x29')]['includeAll']){_0x4f1836[_0x035a('0x40')]=[{'all':!![]}];}_0x4f1836=_[_0x035a('0x36')]({},_0x4f1836,_0x22d429[_0x035a('0x39')]);return db[_0x035a('0x24')][_0x035a('0x41')](_0x4f1836)['then'](handleEntityNotFound(_0x36ff22,null))[_0x035a('0x1d')](respondWithResult(_0x36ff22,null))[_0x035a('0x3d')](handleError(_0x36ff22,null));};exports[_0x035a('0x42')]=function(_0x3c2a82,_0x457bdb){return db[_0x035a('0x24')][_0x035a('0x42')](_0x3c2a82[_0x035a('0x43')],{})[_0x035a('0x1d')](respondWithResult(_0x457bdb,0xc9))['catch'](handleError(_0x457bdb,null));};exports[_0x035a('0x1c')]=function(_0x208742,_0x650e52){if(_0x208742['body']['id']){delete _0x208742[_0x035a('0x43')]['id'];}return db[_0x035a('0x24')][_0x035a('0x41')]({'where':{'id':_0x208742[_0x035a('0x3f')]['id']}})[_0x035a('0x1d')](handleEntityNotFound(_0x650e52,null))[_0x035a('0x1d')](saveUpdates(_0x208742[_0x035a('0x43')],null))[_0x035a('0x1d')](respondWithResult(_0x650e52,null))['catch'](handleError(_0x650e52,null));};exports['destroy']=function(_0x1dbe4e,_0x2bc1d3){return db['SalesforceAccount'][_0x035a('0x41')]({'where':{'id':_0x1dbe4e[_0x035a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2bc1d3,null))[_0x035a('0x1d')](removeEntity(_0x2bc1d3,null))[_0x035a('0x3d')](handleError(_0x2bc1d3,null));};exports['getConfigurations']=function(_0x445d9f,_0x2cca50,_0x2f1599){var _0x5f295c={};var _0x7bd1c3={};var _0x3cb626;var _0x2b00d5;return db[_0x035a('0x24')][_0x035a('0x44')]({'where':{'id':_0x445d9f['params']['id']}})[_0x035a('0x1d')](handleEntityNotFound(_0x2cca50,null))['then'](function(_0x52d239){if(_0x52d239){_0x3cb626=_0x52d239;_0x7bd1c3[_0x035a('0x2c')]=_[_0x035a('0x45')](db[_0x035a('0x46')]['rawAttributes']);_0x7bd1c3[_0x035a('0x29')]=_[_0x035a('0x45')](_0x445d9f['query']);_0x7bd1c3[_0x035a('0x2a')]=_[_0x035a('0x2b')](_0x7bd1c3['model'],_0x7bd1c3[_0x035a('0x29')]);_0x5f295c['attributes']=_['intersection'](_0x7bd1c3[_0x035a('0x2c')],qs[_0x035a('0x2d')](_0x445d9f[_0x035a('0x29')][_0x035a('0x2d')]));_0x5f295c['attributes']=_0x5f295c[_0x035a('0x2e')]['length']?_0x5f295c['attributes']:_0x7bd1c3[_0x035a('0x2c')];_0x5f295c[_0x035a('0x47')]=qs['sort'](_0x445d9f[_0x035a('0x29')][_0x035a('0x33')]);_0x5f295c[_0x035a('0x34')]=qs[_0x035a('0x2a')](_[_0x035a('0x35')](_0x445d9f['query'],_0x7bd1c3[_0x035a('0x2a')]));if(_0x445d9f['query'][_0x035a('0x38')]){_0x5f295c[_0x035a('0x34')]=_[_0x035a('0x36')](_0x5f295c[_0x035a('0x34')],{'$or':_['map'](_0x5f295c['attributes'],function(_0x1ef0cc){var _0x24ba45={};_0x24ba45[_0x1ef0cc]={'$like':'%'+_0x445d9f[_0x035a('0x29')][_0x035a('0x38')]+'%'};return _0x24ba45;})});}_0x5f295c=_[_0x035a('0x36')]({},_0x5f295c,_0x445d9f[_0x035a('0x39')]);return _0x3cb626['getConfigurations'](_0x5f295c);}})[_0x035a('0x1d')](function(_0x4c306c){if(_0x4c306c){_0x2b00d5=_0x4c306c[_0x035a('0x2f')];if(!_0x445d9f[_0x035a('0x29')][_0x035a('0x30')](_0x035a('0x31'))){_0x5f295c['limit']=qs[_0x035a('0x32')](_0x445d9f['query'][_0x035a('0x32')]);_0x5f295c['offset']=qs['offset'](_0x445d9f[_0x035a('0x29')][_0x035a('0x17')]);}return _0x3cb626[_0x035a('0x48')](_0x5f295c);}})['then'](function(_0x37082b){if(_0x37082b){return _0x37082b?{'count':_0x2b00d5,'rows':_0x37082b}:null;}})[_0x035a('0x1d')](respondWithResult(_0x2cca50,null))['catch'](handleError(_0x2cca50,null));};exports[_0x035a('0x49')]=function(_0x3328fc,_0x2afcd6,_0x55c2a4){if(_0x3328fc[_0x035a('0x43')]['id']){delete _0x3328fc[_0x035a('0x43')]['id'];}return db[_0x035a('0x24')]['findOne']({'where':{'id':_0x3328fc[_0x035a('0x3f')]['id']}})[_0x035a('0x1d')](handleEntityNotFound(_0x2afcd6,null))['then'](function(_0x1d79e6){if(_0x1d79e6){_0x3328fc[_0x035a('0x43')][_0x035a('0x4a')]=_0x1d79e6['id'];_0x3328fc[_0x035a('0x43')][_0x035a('0x4b')]=integrations['getSubjects'](_0x3328fc[_0x035a('0x43')][_0x035a('0x4c')],_0x3328fc[_0x035a('0x43')][_0x035a('0x27')]);_0x3328fc[_0x035a('0x43')][_0x035a('0x4d')]=integrations[_0x035a('0x4e')](_0x3328fc['body'][_0x035a('0x4c')],_0x3328fc['body'][_0x035a('0x27')]);return db[_0x035a('0x46')][_0x035a('0x42')](_0x3328fc[_0x035a('0x43')],{'include':[{'model':db[_0x035a('0x4f')],'as':_0x035a('0x4b')},{'model':db['SalesforceField'],'as':_0x035a('0x4d')}]});}return null;})[_0x035a('0x1d')](respondWithResult(_0x2afcd6,null))[_0x035a('0x3d')](handleError(_0x2afcd6,null));};exports[_0x035a('0x50')]=function(_0x9de96b,_0x5cdf08,_0x2f9e9b){var _0x14083a;var _0xcbbce='';var _0x152b59='Task';return db['SalesforceAccount']['findOne']({'where':{'id':_0x9de96b[_0x035a('0x3f')]['id']},'attributes':['id',_0x035a('0x51'),_0x035a('0x52'),_0x035a('0x53'),_0x035a('0x54'),_0x035a('0x55'),_0x035a('0x56')]})[_0x035a('0x1d')](handleEntityNotFound(_0x5cdf08,null))[_0x035a('0x1d')](function(_0x17a109){if(_0x17a109){_0xcbbce=_0x17a109['remoteUri'];var _0x366365=_0xcbbce[_0x035a('0x57')](-0x1);if(_0x366365==='/'){_0xcbbce=_0xcbbce[_0x035a('0x58')](0x0,_0xcbbce[_0x035a('0x59')](_0x366365));}_0x14083a=new jsforce[(_0x035a('0x5a'))]({'oauth2':{'loginUrl':_0xcbbce,'clientId':_0x17a109[_0x035a('0x52')],'clientSecret':_0x17a109[_0x035a('0x53')]}});return _0x14083a['login'](_0x17a109['username'],_0x17a109[_0x035a('0x55')]['concat'](_0x17a109[_0x035a('0x56')]));}})[_0x035a('0x1d')](function(_0x568fb3){if(_0x568fb3){if(!_[_0x035a('0x5b')](_0x9de96b[_0x035a('0x29')][_0x035a('0x5c')])){_0x152b59=_0x9de96b[_0x035a('0x29')][_0x035a('0x5c')];}return _0x14083a['sobject'](_0x152b59)[_0x035a('0x5d')]();}})[_0x035a('0x1d')](function(_0x4ed591){var _0x3901da=[_0x035a('0x5e'),_0x035a('0x5f'),_0x035a('0x60'),_0x035a('0x61'),_0x035a('0x62'),_0x035a('0x63')];var _0x56df66=[_0x035a('0x64'),_0x035a('0x65'),_0x035a('0x66'),'boolean','email','textarea','phone'];if(_0x4ed591){_[_0x035a('0x67')](_0x4ed591[_0x035a('0x2d')],function(_0x33b22e){return _0x3901da[_0x035a('0x68')](_0x33b22e[_0x035a('0x20')])||!_0x56df66[_0x035a('0x68')](_0x33b22e[_0x035a('0x27')]);});return{'count':_0x4ed591['fields']['length'],'rows':_[_0x035a('0x23')](_0x4ed591[_0x035a('0x2d')],function(_0x5804b7){return{'id':_0x5804b7[_0x035a('0x20')],'name':_0x5804b7['label'],'custom':_0x5804b7['custom'],'options':_0x5804b7[_0x035a('0x69')][_0x035a('0x2f')]>0x0?_[_0x035a('0x23')](_0x5804b7[_0x035a('0x69')],function(_0x245b6b){return{'name':_0x245b6b[_0x035a('0x6a')],'value':_0x245b6b[_0x035a('0x6b')]};}):_0x5804b7['type']=='boolean'?[{'name':_0x035a('0x6c'),'value':_0x035a('0x6d')},{'name':'False','value':_0x035a('0x6e')}]:[]};})};}})[_0x035a('0x1d')](respondWithResult(_0x5cdf08,null))[_0x035a('0x3d')](function(_0x422812){var _0x3b2b37=_0x9de96b[_0x035a('0x29')][_0x035a('0x6f')]?0x1f4:_0x422812['statusCode']||0x1f4;logger[_0x035a('0x1e')](_0x035a('0x70'),_0x035a('0x50'),_0x3b2b37,JSON['stringify'](_0x422812));delete _0x422812[_0x035a('0x20')];if(_0x3b2b37===0x191){_0x3b2b37=0x190;}_0x5cdf08[_0x035a('0x15')](_0x3b2b37)['send'](_0x9de96b[_0x035a('0x29')][_0x035a('0x6f')]?{'message':_0x035a('0x71'),'statusCode':_0x422812[_0x035a('0x72')]}:_0x422812);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6963d8a..b2b8630 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 _0xe85c=['SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x5cab90,_0x17db82){var _0xc82892=function(_0x34e43b){while(--_0x34e43b){_0x5cab90['push'](_0x5cab90['shift']());}};_0xc82892(++_0x17db82);}(_0xe85c,0x1a6));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var util=require('util');var logger=require(_0xce85('0x1'))(_0xce85('0x2'));var moment=require(_0xce85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce85('0x4'));var rimraf=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5ea8d4,_0x3fe62f){return _0x5ea8d4[_0xce85('0x7')](_0xce85('0x8'),attributes,{'tableName':_0xce85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2035=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','util'];(function(_0x3b5a59,_0x42bfb7){var _0x913da3=function(_0x105623){while(--_0x105623){_0x3b5a59['push'](_0x3b5a59['shift']());}};_0x913da3(++_0x42bfb7);}(_0x2035,0xb2));var _0x5203=function(_0x4d8c59,_0x365b9c){_0x4d8c59=_0x4d8c59-0x0;var _0xeac05c=_0x2035[_0x4d8c59];return _0xeac05c;};'use strict';var _=require(_0x5203('0x0'));var util=require(_0x5203('0x1'));var logger=require(_0x5203('0x2'))(_0x5203('0x3'));var moment=require(_0x5203('0x4'));var BPromise=require(_0x5203('0x5'));var rp=require(_0x5203('0x6'));var fs=require('fs');var path=require(_0x5203('0x7'));var rimraf=require(_0x5203('0x8'));var config=require(_0x5203('0x9'));var attributes=require(_0x5203('0xa'));var integrations=require(_0x5203('0xb'));module[_0x5203('0xc')]=function(_0x63aca4,_0x247d8e){return _0x63aca4[_0x5203('0xd')]('SalesforceAccount',attributes,{'tableName':_0x5203('0xe'),'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 21013e0..b6020c0 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 _0x1d9d=['map','model','catch','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x1d9d,0x152));var _0xd1d9=function(_0x205931,_0x3c9b9f){_0x205931=_0x205931-0x0;var _0x2f7df7=_0x1d9d[_0x205931];return _0x2f7df7;};'use strict';var _=require('lodash');var util=require(_0xd1d9('0x0'));var moment=require(_0xd1d9('0x1'));var BPromise=require(_0xd1d9('0x2'));var rs=require(_0xd1d9('0x3'));var fs=require('fs');var Redis=require(_0xd1d9('0x4'));var db=require(_0xd1d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1d9('0x6'))(_0xd1d9('0x7'));var config=require(_0xd1d9('0x8'));var jayson=require(_0xd1d9('0x9'));var client=jayson['client'][_0xd1d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29ddb5,_0x49e7a9,_0x5a3586){return new BPromise(function(_0x66a638,_0x1761fc){return client[_0xd1d9('0xb')](_0x29ddb5,_0x5a3586)[_0xd1d9('0xc')](function(_0x53694f){logger[_0xd1d9('0xd')](_0xd1d9('0xe'),_0x49e7a9,_0xd1d9('0xf'));logger[_0xd1d9('0x10')](_0xd1d9('0x11'),_0x49e7a9,_0xd1d9('0xf'),JSON[_0xd1d9('0x12')](_0x53694f));if(_0x53694f[_0xd1d9('0x13')]){if(_0x53694f['error'][_0xd1d9('0x14')]===0x1f4){logger[_0xd1d9('0x13')](_0xd1d9('0xe'),_0x49e7a9,_0x53694f[_0xd1d9('0x13')][_0xd1d9('0x15')]);return _0x1761fc(_0x53694f[_0xd1d9('0x13')]['message']);}logger['error'](_0xd1d9('0xe'),_0x49e7a9,_0x53694f[_0xd1d9('0x13')]['message']);return _0x66a638(_0x53694f['error'][_0xd1d9('0x15')]);}else{logger[_0xd1d9('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x49e7a9,_0xd1d9('0xf'));_0x66a638(_0x53694f[_0xd1d9('0x16')][_0xd1d9('0x15')]);}})['catch'](function(_0x38554f){logger['error'](_0xd1d9('0xe'),_0x49e7a9,_0x38554f);_0x1761fc(_0x38554f);});});}exports[_0xd1d9('0x17')]=function(_0x823a60){var _0x3e0a50=this;return new Promise(function(_0x5ab13b,_0x58e5a7){return db[_0xd1d9('0x18')][_0xd1d9('0x19')]({'raw':_0x823a60[_0xd1d9('0x1a')]?_0x823a60[_0xd1d9('0x1a')][_0xd1d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x823a60[_0xd1d9('0x1a')]?_0x823a60['options'][_0xd1d9('0x1c')]||null:null,'attributes':_0x823a60[_0xd1d9('0x1a')]?_0x823a60['options'][_0xd1d9('0x1d')]||null:null,'limit':_0x823a60[_0xd1d9('0x1a')]?_0x823a60['options'][_0xd1d9('0x1e')]||null:null,'include':_0x823a60[_0xd1d9('0x1a')]?_0x823a60[_0xd1d9('0x1a')][_0xd1d9('0x1f')]?_[_0xd1d9('0x20')](_0x823a60[_0xd1d9('0x1a')]['include'],function(_0x555f9c){return{'model':db[_0x555f9c['model']],'as':_0x555f9c['as'],'attributes':_0x555f9c[_0xd1d9('0x1d')],'include':_0x555f9c[_0xd1d9('0x1f')]?_['map'](_0x555f9c['include'],function(_0x238647){return{'model':db[_0x238647['model']],'as':_0x238647['as'],'attributes':_0x238647[_0xd1d9('0x1d')],'include':_0x238647[_0xd1d9('0x1f')]?_[_0xd1d9('0x20')](_0x238647[_0xd1d9('0x1f')],function(_0x336bbf){return{'model':db[_0x336bbf[_0xd1d9('0x21')]],'as':_0x336bbf['as'],'attributes':_0x336bbf[_0xd1d9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d9('0xc')](function(_0x20c413){logger['info']('GetSalesforceAccount',_0x823a60);logger[_0xd1d9('0x10')](_0xd1d9('0x17'),_0x823a60,JSON[_0xd1d9('0x12')](_0x20c413));_0x5ab13b(_0x20c413);})[_0xd1d9('0x22')](function(_0x253b6c){logger[_0xd1d9('0x13')](_0xd1d9('0x17'),_0x253b6c[_0xd1d9('0x15')],_0x823a60);_0x58e5a7(_0x3e0a50[_0xd1d9('0x13')](0x1f4,_0x253b6c['message']));});});};exports[_0xd1d9('0x23')]=function(_0x3843a8){var _0x4694f7=this;return new Promise(function(_0x5058b9,_0x10b253){return db[_0xd1d9('0x18')][_0xd1d9('0x24')]({'raw':_0x3843a8[_0xd1d9('0x1a')]?_0x3843a8[_0xd1d9('0x1a')][_0xd1d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x3843a8[_0xd1d9('0x1a')]?_0x3843a8[_0xd1d9('0x1a')][_0xd1d9('0x1c')]||null:null,'attributes':_0x3843a8[_0xd1d9('0x1a')]?_0x3843a8[_0xd1d9('0x1a')]['attributes']||null:null,'include':_0x3843a8[_0xd1d9('0x1a')]?_0x3843a8[_0xd1d9('0x1a')][_0xd1d9('0x1f')]?_[_0xd1d9('0x20')](_0x3843a8['options']['include'],function(_0x271d3f){return{'model':db[_0x271d3f['model']],'as':_0x271d3f['as'],'attributes':_0x271d3f[_0xd1d9('0x1d')],'include':_0x271d3f[_0xd1d9('0x1f')]?_[_0xd1d9('0x20')](_0x271d3f[_0xd1d9('0x1f')],function(_0x152004){return{'model':db[_0x152004['model']],'as':_0x152004['as'],'attributes':_0x152004[_0xd1d9('0x1d')],'include':_0x152004[_0xd1d9('0x1f')]?_['map'](_0x152004[_0xd1d9('0x1f')],function(_0x204f82){return{'model':db[_0x204f82[_0xd1d9('0x21')]],'as':_0x204f82['as'],'attributes':_0x204f82['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1d9('0xc')](function(_0x338893){logger[_0xd1d9('0xd')](_0xd1d9('0x23'),_0x3843a8);logger[_0xd1d9('0x10')](_0xd1d9('0x23'),_0x3843a8,JSON['stringify'](_0x338893));_0x5058b9(_0x338893);})[_0xd1d9('0x22')](function(_0x170a4a){logger[_0xd1d9('0x13')](_0xd1d9('0x23'),_0x170a4a['message'],_0x3843a8);_0x10b253(_0x4694f7[_0xd1d9('0x13')](0x1f4,_0x170a4a[_0xd1d9('0x15')]));});});}; \ No newline at end of file +var _0x0f8f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','model','map','then','find','ShowSalesforceAccount','util','moment'];(function(_0x53c46c,_0x441e26){var _0x28b37c=function(_0x2c7657){while(--_0x2c7657){_0x53c46c['push'](_0x53c46c['shift']());}};_0x28b37c(++_0x441e26);}(_0x0f8f,0x1cc));var _0xf0f8=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x0f8f[_0xb1174e];return _0x285bac;};'use strict';var _=require('lodash');var util=require(_0xf0f8('0x0'));var moment=require(_0xf0f8('0x1'));var BPromise=require('bluebird');var rs=require(_0xf0f8('0x2'));var fs=require('fs');var Redis=require(_0xf0f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0f8('0x4'));var logger=require(_0xf0f8('0x5'))(_0xf0f8('0x6'));var config=require(_0xf0f8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf0f8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x224a25,_0x8b125b,_0x4bb38b){return new BPromise(function(_0xaf78ff,_0x387340){return client[_0xf0f8('0x9')](_0x224a25,_0x4bb38b)['then'](function(_0x5b5193){logger[_0xf0f8('0xa')](_0xf0f8('0xb'),_0x8b125b,_0xf0f8('0xc'));logger[_0xf0f8('0xd')](_0xf0f8('0xe'),_0x8b125b,_0xf0f8('0xc'),JSON[_0xf0f8('0xf')](_0x5b5193));if(_0x5b5193[_0xf0f8('0x10')]){if(_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x11')]===0x1f4){logger[_0xf0f8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x8b125b,_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x12')]);return _0x387340(_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x12')]);}logger[_0xf0f8('0x10')](_0xf0f8('0xb'),_0x8b125b,_0x5b5193[_0xf0f8('0x10')][_0xf0f8('0x12')]);return _0xaf78ff(_0x5b5193['error']['message']);}else{logger[_0xf0f8('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x8b125b,'request\x20sent');_0xaf78ff(_0x5b5193['result'][_0xf0f8('0x12')]);}})[_0xf0f8('0x13')](function(_0x100f2b){logger[_0xf0f8('0x10')](_0xf0f8('0xb'),_0x8b125b,_0x100f2b);_0x387340(_0x100f2b);});});}exports[_0xf0f8('0x14')]=function(_0x312aa9){var _0x56ef42=this;return new Promise(function(_0x1152ed,_0x542518){return db[_0xf0f8('0x15')][_0xf0f8('0x16')]({'raw':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x18')]===undefined?!![]:![]:!![],'where':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x19')]||null:null,'attributes':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9['options'][_0xf0f8('0x1a')]||null:null,'limit':_0x312aa9['options']?_0x312aa9[_0xf0f8('0x17')]['limit']||null:null,'include':_0x312aa9[_0xf0f8('0x17')]?_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x1b')]?_['map'](_0x312aa9[_0xf0f8('0x17')][_0xf0f8('0x1b')],function(_0x5268fc){return{'model':db[_0x5268fc[_0xf0f8('0x1c')]],'as':_0x5268fc['as'],'attributes':_0x5268fc[_0xf0f8('0x1a')],'include':_0x5268fc[_0xf0f8('0x1b')]?_['map'](_0x5268fc[_0xf0f8('0x1b')],function(_0x2ae09d){return{'model':db[_0x2ae09d[_0xf0f8('0x1c')]],'as':_0x2ae09d['as'],'attributes':_0x2ae09d[_0xf0f8('0x1a')],'include':_0x2ae09d[_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x2ae09d[_0xf0f8('0x1b')],function(_0x2ceb72){return{'model':db[_0x2ceb72[_0xf0f8('0x1c')]],'as':_0x2ceb72['as'],'attributes':_0x2ceb72['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0f8('0x1e')](function(_0x11e088){logger[_0xf0f8('0xa')](_0xf0f8('0x14'),_0x312aa9);logger['debug']('GetSalesforceAccount',_0x312aa9,JSON[_0xf0f8('0xf')](_0x11e088));_0x1152ed(_0x11e088);})[_0xf0f8('0x13')](function(_0x1f8eeb){logger[_0xf0f8('0x10')](_0xf0f8('0x14'),_0x1f8eeb[_0xf0f8('0x12')],_0x312aa9);_0x542518(_0x56ef42[_0xf0f8('0x10')](0x1f4,_0x1f8eeb[_0xf0f8('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x2be8be){var _0x1a3916=this;return new Promise(function(_0x222e9d,_0x4b7f9b){return db[_0xf0f8('0x15')][_0xf0f8('0x1f')]({'raw':_0x2be8be['options']?_0x2be8be['options'][_0xf0f8('0x18')]===undefined?!![]:![]:!![],'where':_0x2be8be[_0xf0f8('0x17')]?_0x2be8be[_0xf0f8('0x17')]['where']||null:null,'attributes':_0x2be8be['options']?_0x2be8be[_0xf0f8('0x17')][_0xf0f8('0x1a')]||null:null,'include':_0x2be8be['options']?_0x2be8be[_0xf0f8('0x17')][_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x2be8be[_0xf0f8('0x17')]['include'],function(_0x25f5b9){return{'model':db[_0x25f5b9[_0xf0f8('0x1c')]],'as':_0x25f5b9['as'],'attributes':_0x25f5b9[_0xf0f8('0x1a')],'include':_0x25f5b9[_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x25f5b9[_0xf0f8('0x1b')],function(_0x1aa540){return{'model':db[_0x1aa540[_0xf0f8('0x1c')]],'as':_0x1aa540['as'],'attributes':_0x1aa540[_0xf0f8('0x1a')],'include':_0x1aa540[_0xf0f8('0x1b')]?_[_0xf0f8('0x1d')](_0x1aa540[_0xf0f8('0x1b')],function(_0x174056){return{'model':db[_0x174056[_0xf0f8('0x1c')]],'as':_0x174056['as'],'attributes':_0x174056[_0xf0f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf0f8('0x1e')](function(_0x437e46){logger[_0xf0f8('0xa')]('ShowSalesforceAccount',_0x2be8be);logger[_0xf0f8('0xd')]('ShowSalesforceAccount',_0x2be8be,JSON[_0xf0f8('0xf')](_0x437e46));_0x222e9d(_0x437e46);})[_0xf0f8('0x13')](function(_0x2f77b8){logger[_0xf0f8('0x10')](_0xf0f8('0x20'),_0x2f77b8['message'],_0x2be8be);_0x4b7f9b(_0x1a3916[_0xf0f8('0x10')](0x1f4,_0x2f77b8[_0xf0f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 20aef7a..d7d3a73 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x5f13ec,_0x133ab5){var _0x343934=function(_0xb641c7){while(--_0xb641c7){_0x5f13ec['push'](_0x5f13ec['shift']());}};_0x343934(++_0x133ab5);}(_0xadb5,0xad));var _0x5adb=function(_0x2d8bae,_0x384b58){_0x2d8bae=_0x2d8bae-0x0;var _0x5cb432=_0xadb5[_0x2d8bae];return _0x5cb432;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _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(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x0b0e[_0x35fabd];return _0x61a8ee;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 721660e..c536b87 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 _0x6e26=['ENUM','Task','Case','contact','lead','account_contact_lead','account','nothing','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6e26,0x179));var _0x66e2=function(_0x12f6a1,_0x4cd997){_0x12f6a1=_0x12f6a1-0x0;var _0x30b4f7=_0x6e26[_0x12f6a1];return _0x30b4f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x66e2('0x0')]},'description':{'type':Sequelize[_0x66e2('0x0')]},'ticketType':{'type':Sequelize[_0x66e2('0x1')](_0x66e2('0x2'),_0x66e2('0x3')),'defaultValue':_0x66e2('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x66e2('0x4'),_0x66e2('0x5'),_0x66e2('0x6'),_0x66e2('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x66e2('0x1')](_0x66e2('0x8'),'contact',_0x66e2('0x5'),_0x66e2('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x66e2('0x0')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x61a8=['nothing','account','exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x61a8,0x1ce));var _0x861a=function(_0x1c1fba,_0xd5872d){_0x1c1fba=_0x1c1fba-0x0;var _0x37e346=_0x61a8[_0x1c1fba];return _0x37e346;};'use strict';var Sequelize=require('sequelize');module[_0x861a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x861a('0x1')]},'ticketType':{'type':Sequelize[_0x861a('0x2')](_0x861a('0x3'),'Case'),'defaultValue':_0x861a('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x861a('0x4'),_0x861a('0x5'),_0x861a('0x6'),_0x861a('0x7'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x861a('0x8'),_0x861a('0x5'),_0x861a('0x6'),_0x861a('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x861a('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x861a('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x861a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e22fb02..7d42b70 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 _0x2b18=['../../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','apply','reject','update','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','then','includeAll','include','findAll','catch','show','params','merge','find','create','body','getFields','findOne','SalesforceField','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x35c8f5,_0x399f44){var _0xb5c718=function(_0x50450c){while(--_0x50450c){_0x35c8f5['push'](_0x35c8f5['shift']());}};_0xb5c718(++_0x399f44);}(_0x2b18,0x11e));var _0x82b1=function(_0xe26eeb,_0x1a9cf3){_0xe26eeb=_0xe26eeb-0x0;var _0x1d25f7=_0x2b18[_0xe26eeb];return _0x1d25f7;};'use strict';var emlformat=require(_0x82b1('0x0'));var rimraf=require(_0x82b1('0x1'));var zipdir=require(_0x82b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x82b1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x82b1('0x4'));var sox=require('sox');var csv=require(_0x82b1('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82b1('0x6'));var crypto=require(_0x82b1('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x82b1('0x8'));var toCsv=require(_0x82b1('0x5'));var querystring=require(_0x82b1('0x9'));var Papa=require(_0x82b1('0xa'));var Redis=require(_0x82b1('0xb'));var authService=require(_0x82b1('0xc'));var qs=require(_0x82b1('0xd'));var as=require(_0x82b1('0xe'));var hardwareService=require(_0x82b1('0xf'));var logger=require(_0x82b1('0x10'))(_0x82b1('0x11'));var utils=require(_0x82b1('0x12'));var config=require(_0x82b1('0x13'));var licenseUtil=require(_0x82b1('0x14'));var db=require(_0x82b1('0x15'))['db'];function respondWithStatusCode(_0x4b00c4,_0x2f2e5d){_0x2f2e5d=_0x2f2e5d||0xcc;return function(_0x40054f){if(_0x40054f){return _0x4b00c4[_0x82b1('0x16')](_0x2f2e5d);}return _0x4b00c4['status'](_0x2f2e5d)['end']();};}function respondWithResult(_0x47044d,_0xf7985c){_0xf7985c=_0xf7985c||0xc8;return function(_0x44e5db){if(_0x44e5db){return _0x47044d[_0x82b1('0x17')](_0xf7985c)[_0x82b1('0x18')](_0x44e5db);}};}function respondWithFilteredResult(_0x106379,_0x5d8ef6){return function(_0x2a94fd){if(_0x2a94fd){var _0x409b74=typeof _0x5d8ef6[_0x82b1('0x19')]===_0x82b1('0x1a')&&typeof _0x5d8ef6[_0x82b1('0x1b')]===_0x82b1('0x1a');var _0x2a0b87=_0x2a94fd[_0x82b1('0x1c')];var _0x49f748=_0x409b74?0x0:_0x5d8ef6['offset'];var _0x5182dd=_0x409b74?_0x2a94fd['count']:_0x5d8ef6[_0x82b1('0x19')]+_0x5d8ef6['limit'];var _0x3cef24;if(_0x5182dd>=_0x2a0b87){_0x5182dd=_0x2a0b87;_0x3cef24=0xc8;}else{_0x3cef24=0xce;}_0x106379[_0x82b1('0x17')](_0x3cef24);return _0x106379[_0x82b1('0x1d')]('Content-Range',_0x49f748+'-'+_0x5182dd+'/'+_0x2a0b87)[_0x82b1('0x18')](_0x2a94fd);}return null;};}function patchUpdates(_0x42559f){return function(_0xfece16){try{jsonpatch[_0x82b1('0x1e')](_0xfece16,_0x42559f,!![]);}catch(_0x22ab4c){return BPromise[_0x82b1('0x1f')](_0x22ab4c);}return _0xfece16['save']();};}function saveUpdates(_0x4ca380,_0x58db06){return function(_0x4c7415){if(_0x4c7415){return _0x4c7415[_0x82b1('0x20')](_0x4ca380)['then'](function(_0x2eaf4f){return _0x2eaf4f;});}return null;};}function removeEntity(_0x453f04,_0x1c885f){return function(_0x58e487){if(_0x58e487){return _0x58e487[_0x82b1('0x21')]()['then'](function(){_0x453f04[_0x82b1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d9d84,_0x12b9eb){return function(_0x4cea44){if(!_0x4cea44){_0x5d9d84[_0x82b1('0x16')](0x194);}return _0x4cea44;};}function handleError(_0x145e01,_0x1efbd9){_0x1efbd9=_0x1efbd9||0x1f4;return function(_0x2747f5){logger[_0x82b1('0x22')](_0x2747f5['stack']);if(_0x2747f5['name']){delete _0x2747f5[_0x82b1('0x23')];}_0x145e01['status'](_0x1efbd9)[_0x82b1('0x24')](_0x2747f5);};}exports[_0x82b1('0x25')]=function(_0x1e9049,_0xc79017){var _0x4aff7a={},_0x156a88={},_0xa1c076={'count':0x0,'rows':[]};var _0x45fb44=_[_0x82b1('0x26')](db[_0x82b1('0x27')][_0x82b1('0x28')],function(_0x29933a){return{'name':_0x29933a['fieldName'],'type':_0x29933a['type'][_0x82b1('0x29')]};});_0x156a88[_0x82b1('0x2a')]=_['map'](_0x45fb44,_0x82b1('0x23'));_0x156a88['query']=_[_0x82b1('0x2b')](_0x1e9049[_0x82b1('0x2c')]);_0x156a88[_0x82b1('0x2d')]=_[_0x82b1('0x2e')](_0x156a88[_0x82b1('0x2a')],_0x156a88[_0x82b1('0x2c')]);_0x4aff7a[_0x82b1('0x2f')]=_[_0x82b1('0x2e')](_0x156a88[_0x82b1('0x2a')],qs[_0x82b1('0x30')](_0x1e9049[_0x82b1('0x2c')]['fields']));_0x4aff7a[_0x82b1('0x2f')]=_0x4aff7a[_0x82b1('0x2f')][_0x82b1('0x31')]?_0x4aff7a[_0x82b1('0x2f')]:_0x156a88[_0x82b1('0x2a')];if(!_0x1e9049[_0x82b1('0x2c')][_0x82b1('0x32')](_0x82b1('0x33'))){_0x4aff7a[_0x82b1('0x1b')]=qs['limit'](_0x1e9049[_0x82b1('0x2c')]['limit']);_0x4aff7a[_0x82b1('0x19')]=qs[_0x82b1('0x19')](_0x1e9049[_0x82b1('0x2c')][_0x82b1('0x19')]);}_0x4aff7a[_0x82b1('0x34')]=qs[_0x82b1('0x35')](_0x1e9049[_0x82b1('0x2c')]['sort']);_0x4aff7a[_0x82b1('0x36')]=qs[_0x82b1('0x2d')](_[_0x82b1('0x37')](_0x1e9049[_0x82b1('0x2c')],_0x156a88[_0x82b1('0x2d')]),_0x45fb44);if(_0x1e9049['query']['filter']){_0x4aff7a[_0x82b1('0x36')]=_['merge'](_0x4aff7a['where'],{'$or':_[_0x82b1('0x26')](_0x45fb44,function(_0x11c6cc){if(_0x11c6cc[_0x82b1('0x38')]!=='VIRTUAL'){var _0x1bd85d={};_0x1bd85d[_0x11c6cc['name']]={'$like':'%'+_0x1e9049[_0x82b1('0x2c')][_0x82b1('0x39')]+'%'};return _0x1bd85d;}})});}_0x4aff7a=_['merge']({},_0x4aff7a,_0x1e9049['options']);var _0x48177e={'where':_0x4aff7a['where']};return db[_0x82b1('0x27')][_0x82b1('0x1c')](_0x48177e)[_0x82b1('0x3a')](function(_0x4addba){_0xa1c076[_0x82b1('0x1c')]=_0x4addba;if(_0x1e9049['query'][_0x82b1('0x3b')]){_0x4aff7a[_0x82b1('0x3c')]=[{'all':!![]}];}return db[_0x82b1('0x27')][_0x82b1('0x3d')](_0x4aff7a);})['then'](function(_0x5b7fdc){_0xa1c076['rows']=_0x5b7fdc;return _0xa1c076;})[_0x82b1('0x3a')](respondWithFilteredResult(_0xc79017,_0x4aff7a))[_0x82b1('0x3e')](handleError(_0xc79017,null));};exports[_0x82b1('0x3f')]=function(_0x447ba4,_0x12db99){var _0x464bf3={'raw':![],'where':{'id':_0x447ba4[_0x82b1('0x40')]['id']}},_0x26d82c={};_0x26d82c[_0x82b1('0x2a')]=_[_0x82b1('0x2b')](db[_0x82b1('0x27')]['rawAttributes']);_0x26d82c[_0x82b1('0x2c')]=_[_0x82b1('0x2b')](_0x447ba4[_0x82b1('0x2c')]);_0x26d82c[_0x82b1('0x2d')]=_[_0x82b1('0x2e')](_0x26d82c['model'],_0x26d82c[_0x82b1('0x2c')]);_0x464bf3[_0x82b1('0x2f')]=_[_0x82b1('0x2e')](_0x26d82c[_0x82b1('0x2a')],qs[_0x82b1('0x30')](_0x447ba4['query'][_0x82b1('0x30')]));_0x464bf3['attributes']=_0x464bf3[_0x82b1('0x2f')][_0x82b1('0x31')]?_0x464bf3[_0x82b1('0x2f')]:_0x26d82c[_0x82b1('0x2a')];if(_0x447ba4['query'][_0x82b1('0x3b')]){_0x464bf3[_0x82b1('0x3c')]=[{'all':!![]}];}_0x464bf3=_[_0x82b1('0x41')]({},_0x464bf3,_0x447ba4['options']);return db[_0x82b1('0x27')][_0x82b1('0x42')](_0x464bf3)['then'](handleEntityNotFound(_0x12db99,null))[_0x82b1('0x3a')](respondWithResult(_0x12db99,null))['catch'](handleError(_0x12db99,null));};exports[_0x82b1('0x43')]=function(_0x1b2642,_0x2949e1){return db['SalesforceConfiguration'][_0x82b1('0x43')](_0x1b2642[_0x82b1('0x44')],{})[_0x82b1('0x3a')](respondWithResult(_0x2949e1,0xc9))[_0x82b1('0x3e')](handleError(_0x2949e1,null));};exports[_0x82b1('0x20')]=function(_0x564e42,_0x59d26d){if(_0x564e42['body']['id']){delete _0x564e42['body']['id'];}return db['SalesforceConfiguration'][_0x82b1('0x42')]({'where':{'id':_0x564e42[_0x82b1('0x40')]['id']}})[_0x82b1('0x3a')](handleEntityNotFound(_0x59d26d,null))[_0x82b1('0x3a')](saveUpdates(_0x564e42[_0x82b1('0x44')],null))['then'](respondWithResult(_0x59d26d,null))[_0x82b1('0x3e')](handleError(_0x59d26d,null));};exports[_0x82b1('0x21')]=function(_0x29a9a2,_0x1c46b4){return db[_0x82b1('0x27')][_0x82b1('0x42')]({'where':{'id':_0x29a9a2[_0x82b1('0x40')]['id']}})[_0x82b1('0x3a')](handleEntityNotFound(_0x1c46b4,null))[_0x82b1('0x3a')](removeEntity(_0x1c46b4,null))[_0x82b1('0x3e')](handleError(_0x1c46b4,null));};exports[_0x82b1('0x45')]=function(_0x166461,_0x1c08c5,_0x37f3a7){var _0x579eb3={};var _0x29972e={};var _0x32916b;var _0x31a3ae;return db[_0x82b1('0x27')][_0x82b1('0x46')]({'where':{'id':_0x166461[_0x82b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x1c08c5,null))[_0x82b1('0x3a')](function(_0x245963){if(_0x245963){_0x32916b=_0x245963;_0x29972e['model']=_[_0x82b1('0x2b')](db[_0x82b1('0x47')]['rawAttributes']);_0x29972e[_0x82b1('0x2c')]=_[_0x82b1('0x2b')](_0x166461[_0x82b1('0x2c')]);_0x29972e[_0x82b1('0x2d')]=_[_0x82b1('0x2e')](_0x29972e[_0x82b1('0x2a')],_0x29972e['query']);_0x579eb3[_0x82b1('0x2f')]=_[_0x82b1('0x2e')](_0x29972e['model'],qs[_0x82b1('0x30')](_0x166461[_0x82b1('0x2c')][_0x82b1('0x30')]));_0x579eb3[_0x82b1('0x2f')]=_0x579eb3[_0x82b1('0x2f')][_0x82b1('0x31')]?_0x579eb3[_0x82b1('0x2f')]:_0x29972e[_0x82b1('0x2a')];_0x579eb3[_0x82b1('0x34')]=qs[_0x82b1('0x35')](_0x166461[_0x82b1('0x2c')][_0x82b1('0x35')]);_0x579eb3['where']=qs[_0x82b1('0x2d')](_[_0x82b1('0x37')](_0x166461[_0x82b1('0x2c')],_0x29972e[_0x82b1('0x2d')]));if(_0x166461[_0x82b1('0x2c')][_0x82b1('0x39')]){_0x579eb3[_0x82b1('0x36')]=_[_0x82b1('0x41')](_0x579eb3[_0x82b1('0x36')],{'$or':_[_0x82b1('0x26')](_0x579eb3[_0x82b1('0x2f')],function(_0x401b2b){var _0xb1b3af={};_0xb1b3af[_0x401b2b]={'$like':'%'+_0x166461['query'][_0x82b1('0x39')]+'%'};return _0xb1b3af;})});}_0x579eb3=_['merge']({},_0x579eb3,_0x166461[_0x82b1('0x48')]);return _0x32916b[_0x82b1('0x45')](_0x579eb3);}})[_0x82b1('0x3a')](function(_0x5d7041){if(_0x5d7041){_0x31a3ae=_0x5d7041[_0x82b1('0x31')];if(!_0x166461[_0x82b1('0x2c')][_0x82b1('0x32')](_0x82b1('0x33'))){_0x579eb3['limit']=qs[_0x82b1('0x1b')](_0x166461['query']['limit']);_0x579eb3[_0x82b1('0x19')]=qs[_0x82b1('0x19')](_0x166461['query'][_0x82b1('0x19')]);}return _0x32916b[_0x82b1('0x45')](_0x579eb3);}})[_0x82b1('0x3a')](function(_0x542a58){if(_0x542a58){return _0x542a58?{'count':_0x31a3ae,'rows':_0x542a58}:null;}})['then'](respondWithResult(_0x1c08c5,null))[_0x82b1('0x3e')](handleError(_0x1c08c5,null));};exports[_0x82b1('0x49')]=function(_0x5b135b,_0x59feee,_0x303c7b){var _0x3b3b1f={};var _0x24ec7a={};var _0x4174c4;var _0x1ca8e1;return db[_0x82b1('0x27')][_0x82b1('0x46')]({'where':{'id':_0x5b135b[_0x82b1('0x40')]['id']}})[_0x82b1('0x3a')](handleEntityNotFound(_0x59feee,null))[_0x82b1('0x3a')](function(_0x18f62e){if(_0x18f62e){_0x4174c4=_0x18f62e;_0x24ec7a[_0x82b1('0x2a')]=_[_0x82b1('0x2b')](db[_0x82b1('0x47')][_0x82b1('0x28')]);_0x24ec7a[_0x82b1('0x2c')]=_[_0x82b1('0x2b')](_0x5b135b[_0x82b1('0x2c')]);_0x24ec7a[_0x82b1('0x2d')]=_['intersection'](_0x24ec7a[_0x82b1('0x2a')],_0x24ec7a[_0x82b1('0x2c')]);_0x3b3b1f['attributes']=_['intersection'](_0x24ec7a[_0x82b1('0x2a')],qs[_0x82b1('0x30')](_0x5b135b[_0x82b1('0x2c')]['fields']));_0x3b3b1f[_0x82b1('0x2f')]=_0x3b3b1f[_0x82b1('0x2f')][_0x82b1('0x31')]?_0x3b3b1f[_0x82b1('0x2f')]:_0x24ec7a[_0x82b1('0x2a')];_0x3b3b1f[_0x82b1('0x34')]=qs[_0x82b1('0x35')](_0x5b135b[_0x82b1('0x2c')]['sort']);_0x3b3b1f[_0x82b1('0x36')]=qs[_0x82b1('0x2d')](_[_0x82b1('0x37')](_0x5b135b[_0x82b1('0x2c')],_0x24ec7a[_0x82b1('0x2d')]));if(_0x5b135b[_0x82b1('0x2c')][_0x82b1('0x39')]){_0x3b3b1f[_0x82b1('0x36')]=_['merge'](_0x3b3b1f[_0x82b1('0x36')],{'$or':_[_0x82b1('0x26')](_0x3b3b1f['attributes'],function(_0x2ade05){var _0x282b74={};_0x282b74[_0x2ade05]={'$like':'%'+_0x5b135b['query'][_0x82b1('0x39')]+'%'};return _0x282b74;})});}_0x3b3b1f=_[_0x82b1('0x41')]({},_0x3b3b1f,_0x5b135b[_0x82b1('0x48')]);return _0x4174c4[_0x82b1('0x49')](_0x3b3b1f);}})[_0x82b1('0x3a')](function(_0x504f83){if(_0x504f83){_0x1ca8e1=_0x504f83[_0x82b1('0x31')];if(!_0x5b135b[_0x82b1('0x2c')]['hasOwnProperty']('nolimit')){_0x3b3b1f[_0x82b1('0x1b')]=qs['limit'](_0x5b135b[_0x82b1('0x2c')][_0x82b1('0x1b')]);_0x3b3b1f[_0x82b1('0x19')]=qs['offset'](_0x5b135b[_0x82b1('0x2c')][_0x82b1('0x19')]);}return _0x4174c4[_0x82b1('0x49')](_0x3b3b1f);}})[_0x82b1('0x3a')](function(_0x3f23c7){if(_0x3f23c7){return _0x3f23c7?{'count':_0x1ca8e1,'rows':_0x3f23c7}:null;}})[_0x82b1('0x3a')](respondWithResult(_0x59feee,null))['catch'](handleError(_0x59feee,null));};exports[_0x82b1('0x4a')]=function(_0x136769,_0x2f1248,_0x137d24){var _0x1d0e9b={};var _0x2b3e5b={};var _0x2fd46f;var _0x5f1206;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x136769[_0x82b1('0x40')]['id']}})[_0x82b1('0x3a')](handleEntityNotFound(_0x2f1248,null))[_0x82b1('0x3a')](function(_0x3bf438){if(_0x3bf438){_0x2fd46f=_0x3bf438;_0x2b3e5b[_0x82b1('0x2a')]=_[_0x82b1('0x2b')](db[_0x82b1('0x47')][_0x82b1('0x28')]);_0x2b3e5b[_0x82b1('0x2c')]=_[_0x82b1('0x2b')](_0x136769['query']);_0x2b3e5b[_0x82b1('0x2d')]=_['intersection'](_0x2b3e5b[_0x82b1('0x2a')],_0x2b3e5b[_0x82b1('0x2c')]);_0x1d0e9b[_0x82b1('0x2f')]=_[_0x82b1('0x2e')](_0x2b3e5b[_0x82b1('0x2a')],qs['fields'](_0x136769[_0x82b1('0x2c')][_0x82b1('0x30')]));_0x1d0e9b[_0x82b1('0x2f')]=_0x1d0e9b[_0x82b1('0x2f')][_0x82b1('0x31')]?_0x1d0e9b[_0x82b1('0x2f')]:_0x2b3e5b[_0x82b1('0x2a')];_0x1d0e9b['order']=qs[_0x82b1('0x35')](_0x136769[_0x82b1('0x2c')][_0x82b1('0x35')]);_0x1d0e9b['where']=qs['filters'](_[_0x82b1('0x37')](_0x136769[_0x82b1('0x2c')],_0x2b3e5b[_0x82b1('0x2d')]));if(_0x136769[_0x82b1('0x2c')][_0x82b1('0x39')]){_0x1d0e9b[_0x82b1('0x36')]=_['merge'](_0x1d0e9b[_0x82b1('0x36')],{'$or':_[_0x82b1('0x26')](_0x1d0e9b[_0x82b1('0x2f')],function(_0xa3e57c){var _0x2103e6={};_0x2103e6[_0xa3e57c]={'$like':'%'+_0x136769[_0x82b1('0x2c')][_0x82b1('0x39')]+'%'};return _0x2103e6;})});}_0x1d0e9b=_['merge']({},_0x1d0e9b,_0x136769[_0x82b1('0x48')]);return _0x2fd46f[_0x82b1('0x4a')](_0x1d0e9b);}})[_0x82b1('0x3a')](function(_0x471049){if(_0x471049){_0x5f1206=_0x471049[_0x82b1('0x31')];if(!_0x136769[_0x82b1('0x2c')]['hasOwnProperty'](_0x82b1('0x33'))){_0x1d0e9b[_0x82b1('0x1b')]=qs[_0x82b1('0x1b')](_0x136769[_0x82b1('0x2c')][_0x82b1('0x1b')]);_0x1d0e9b['offset']=qs[_0x82b1('0x19')](_0x136769['query']['offset']);}return _0x2fd46f[_0x82b1('0x4a')](_0x1d0e9b);}})['then'](function(_0x541aad){if(_0x541aad){return _0x541aad?{'count':_0x5f1206,'rows':_0x541aad}:null;}})[_0x82b1('0x3a')](respondWithResult(_0x2f1248,null))[_0x82b1('0x3e')](handleError(_0x2f1248,null));}; \ No newline at end of file +var _0x4259=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','offset','json','save','update','then','destroy','end','error','stack','name','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','count','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','body','params','getFields','findOne','SalesforceField','order','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x5095ab,_0x4260aa){var _0xbe337a=function(_0x3663cc){while(--_0x3663cc){_0x5095ab['push'](_0x5095ab['shift']());}};_0xbe337a(++_0x4260aa);}(_0x4259,0x188));var _0x9425=function(_0x584fe6,_0x22e10c){_0x584fe6=_0x584fe6-0x0;var _0x381ee2=_0x4259[_0x584fe6];return _0x381ee2;};'use strict';var emlformat=require(_0x9425('0x0'));var rimraf=require(_0x9425('0x1'));var zipdir=require(_0x9425('0x2'));var jsonpatch=require(_0x9425('0x3'));var rp=require(_0x9425('0x4'));var moment=require(_0x9425('0x5'));var BPromise=require(_0x9425('0x6'));var Mustache=require(_0x9425('0x7'));var util=require('util');var path=require(_0x9425('0x8'));var sox=require('sox');var csv=require(_0x9425('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9425('0xa'));var _=require(_0x9425('0xb'));var squel=require('squel');var crypto=require(_0x9425('0xc'));var jsforce=require(_0x9425('0xd'));var deskjs=require(_0x9425('0xe'));var toCsv=require(_0x9425('0x9'));var querystring=require(_0x9425('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9425('0x10'));var qs=require(_0x9425('0x11'));var as=require(_0x9425('0x12'));var hardwareService=require(_0x9425('0x13'));var logger=require(_0x9425('0x14'))(_0x9425('0x15'));var utils=require(_0x9425('0x16'));var config=require(_0x9425('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9425('0x18'))['db'];function respondWithStatusCode(_0x5eb79a,_0x33e074){_0x33e074=_0x33e074||0xcc;return function(_0x4fdab8){if(_0x4fdab8){return _0x5eb79a[_0x9425('0x19')](_0x33e074);}return _0x5eb79a[_0x9425('0x1a')](_0x33e074)['end']();};}function respondWithResult(_0x5b5d5d,_0x5c5425){_0x5c5425=_0x5c5425||0xc8;return function(_0x295d6f){if(_0x295d6f){return _0x5b5d5d['status'](_0x5c5425)['json'](_0x295d6f);}};}function respondWithFilteredResult(_0x4c7d8f,_0x597d95){return function(_0x406db4){if(_0x406db4){var _0x2f5c23=typeof _0x597d95['offset']===_0x9425('0x1b')&&typeof _0x597d95['limit']===_0x9425('0x1b');var _0x41aa8a=_0x406db4['count'];var _0x5e29cb=_0x2f5c23?0x0:_0x597d95[_0x9425('0x1c')];var _0x13eded=_0x2f5c23?_0x406db4['count']:_0x597d95[_0x9425('0x1c')]+_0x597d95['limit'];var _0xf4e371;if(_0x13eded>=_0x41aa8a){_0x13eded=_0x41aa8a;_0xf4e371=0xc8;}else{_0xf4e371=0xce;}_0x4c7d8f['status'](_0xf4e371);return _0x4c7d8f['set']('Content-Range',_0x5e29cb+'-'+_0x13eded+'/'+_0x41aa8a)[_0x9425('0x1d')](_0x406db4);}return null;};}function patchUpdates(_0x109a3a){return function(_0x39be0e){try{jsonpatch['apply'](_0x39be0e,_0x109a3a,!![]);}catch(_0x58ff97){return BPromise['reject'](_0x58ff97);}return _0x39be0e[_0x9425('0x1e')]();};}function saveUpdates(_0x5c7ebf,_0x52d9f6){return function(_0x3e0578){if(_0x3e0578){return _0x3e0578[_0x9425('0x1f')](_0x5c7ebf)[_0x9425('0x20')](function(_0x372a81){return _0x372a81;});}return null;};}function removeEntity(_0x6ff6aa,_0x4a957b){return function(_0x3be583){if(_0x3be583){return _0x3be583[_0x9425('0x21')]()['then'](function(){_0x6ff6aa[_0x9425('0x1a')](0xcc)[_0x9425('0x22')]();});}};}function handleEntityNotFound(_0x21fb8c,_0x131613){return function(_0x2a4d2c){if(!_0x2a4d2c){_0x21fb8c[_0x9425('0x19')](0x194);}return _0x2a4d2c;};}function handleError(_0x5c9c90,_0xdf6f7c){_0xdf6f7c=_0xdf6f7c||0x1f4;return function(_0x5748c1){logger[_0x9425('0x23')](_0x5748c1[_0x9425('0x24')]);if(_0x5748c1[_0x9425('0x25')]){delete _0x5748c1['name'];}_0x5c9c90[_0x9425('0x1a')](_0xdf6f7c)['send'](_0x5748c1);};}exports[_0x9425('0x26')]=function(_0x44780c,_0x3047d7){var _0x5b82d1={},_0x2188b2={},_0x122830={'count':0x0,'rows':[]};var _0x3e48e5=_[_0x9425('0x27')](db[_0x9425('0x28')]['rawAttributes'],function(_0x402462){return{'name':_0x402462[_0x9425('0x29')],'type':_0x402462[_0x9425('0x2a')][_0x9425('0x2b')]};});_0x2188b2['model']=_['map'](_0x3e48e5,_0x9425('0x25'));_0x2188b2[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x44780c[_0x9425('0x2c')]);_0x2188b2[_0x9425('0x2e')]=_[_0x9425('0x2f')](_0x2188b2[_0x9425('0x30')],_0x2188b2[_0x9425('0x2c')]);_0x5b82d1['attributes']=_[_0x9425('0x2f')](_0x2188b2['model'],qs[_0x9425('0x31')](_0x44780c[_0x9425('0x2c')][_0x9425('0x31')]));_0x5b82d1[_0x9425('0x32')]=_0x5b82d1[_0x9425('0x32')][_0x9425('0x33')]?_0x5b82d1['attributes']:_0x2188b2[_0x9425('0x30')];if(!_0x44780c[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x5b82d1[_0x9425('0x36')]=qs[_0x9425('0x36')](_0x44780c[_0x9425('0x2c')][_0x9425('0x36')]);_0x5b82d1['offset']=qs[_0x9425('0x1c')](_0x44780c[_0x9425('0x2c')][_0x9425('0x1c')]);}_0x5b82d1['order']=qs[_0x9425('0x37')](_0x44780c[_0x9425('0x2c')][_0x9425('0x37')]);_0x5b82d1[_0x9425('0x38')]=qs[_0x9425('0x2e')](_['pick'](_0x44780c[_0x9425('0x2c')],_0x2188b2[_0x9425('0x2e')]),_0x3e48e5);if(_0x44780c['query'][_0x9425('0x39')]){_0x5b82d1[_0x9425('0x38')]=_['merge'](_0x5b82d1['where'],{'$or':_[_0x9425('0x27')](_0x3e48e5,function(_0x21eddc){if(_0x21eddc['type']!=='VIRTUAL'){var _0x575030={};_0x575030[_0x21eddc['name']]={'$like':'%'+_0x44780c[_0x9425('0x2c')][_0x9425('0x39')]+'%'};return _0x575030;}})});}_0x5b82d1=_[_0x9425('0x3a')]({},_0x5b82d1,_0x44780c['options']);var _0x5d6b2c={'where':_0x5b82d1[_0x9425('0x38')]};return db[_0x9425('0x28')][_0x9425('0x3b')](_0x5d6b2c)[_0x9425('0x20')](function(_0x45a5af){_0x122830[_0x9425('0x3b')]=_0x45a5af;if(_0x44780c[_0x9425('0x2c')]['includeAll']){_0x5b82d1[_0x9425('0x3c')]=[{'all':!![]}];}return db[_0x9425('0x28')][_0x9425('0x3d')](_0x5b82d1);})[_0x9425('0x20')](function(_0xb5e47c){_0x122830[_0x9425('0x3e')]=_0xb5e47c;return _0x122830;})[_0x9425('0x20')](respondWithFilteredResult(_0x3047d7,_0x5b82d1))[_0x9425('0x3f')](handleError(_0x3047d7,null));};exports[_0x9425('0x40')]=function(_0x4a1cbf,_0x1ef722){var _0x3733b8={'raw':![],'where':{'id':_0x4a1cbf['params']['id']}},_0x37dd3c={};_0x37dd3c['model']=_['keys'](db['SalesforceConfiguration'][_0x9425('0x41')]);_0x37dd3c[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x4a1cbf[_0x9425('0x2c')]);_0x37dd3c[_0x9425('0x2e')]=_[_0x9425('0x2f')](_0x37dd3c[_0x9425('0x30')],_0x37dd3c[_0x9425('0x2c')]);_0x3733b8['attributes']=_['intersection'](_0x37dd3c[_0x9425('0x30')],qs[_0x9425('0x31')](_0x4a1cbf[_0x9425('0x2c')]['fields']));_0x3733b8[_0x9425('0x32')]=_0x3733b8[_0x9425('0x32')][_0x9425('0x33')]?_0x3733b8[_0x9425('0x32')]:_0x37dd3c[_0x9425('0x30')];if(_0x4a1cbf[_0x9425('0x2c')][_0x9425('0x42')]){_0x3733b8[_0x9425('0x3c')]=[{'all':!![]}];}_0x3733b8=_[_0x9425('0x3a')]({},_0x3733b8,_0x4a1cbf[_0x9425('0x43')]);return db[_0x9425('0x28')][_0x9425('0x44')](_0x3733b8)[_0x9425('0x20')](handleEntityNotFound(_0x1ef722,null))[_0x9425('0x20')](respondWithResult(_0x1ef722,null))[_0x9425('0x3f')](handleError(_0x1ef722,null));};exports[_0x9425('0x45')]=function(_0x273842,_0x26bad9){return db[_0x9425('0x28')][_0x9425('0x45')](_0x273842[_0x9425('0x46')],{})[_0x9425('0x20')](respondWithResult(_0x26bad9,0xc9))[_0x9425('0x3f')](handleError(_0x26bad9,null));};exports[_0x9425('0x1f')]=function(_0x7c4245,_0x3d8ad5){if(_0x7c4245[_0x9425('0x46')]['id']){delete _0x7c4245[_0x9425('0x46')]['id'];}return db['SalesforceConfiguration'][_0x9425('0x44')]({'where':{'id':_0x7c4245[_0x9425('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d8ad5,null))[_0x9425('0x20')](saveUpdates(_0x7c4245[_0x9425('0x46')],null))[_0x9425('0x20')](respondWithResult(_0x3d8ad5,null))[_0x9425('0x3f')](handleError(_0x3d8ad5,null));};exports[_0x9425('0x21')]=function(_0x25610d,_0x527c1c){return db[_0x9425('0x28')][_0x9425('0x44')]({'where':{'id':_0x25610d['params']['id']}})[_0x9425('0x20')](handleEntityNotFound(_0x527c1c,null))[_0x9425('0x20')](removeEntity(_0x527c1c,null))[_0x9425('0x3f')](handleError(_0x527c1c,null));};exports[_0x9425('0x48')]=function(_0x482a51,_0x1a3418,_0xb42275){var _0x2c9ad8={};var _0x442005={};var _0x3832ed;var _0x589f01;return db['SalesforceConfiguration'][_0x9425('0x49')]({'where':{'id':_0x482a51[_0x9425('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a3418,null))[_0x9425('0x20')](function(_0x2076cc){if(_0x2076cc){_0x3832ed=_0x2076cc;_0x442005[_0x9425('0x30')]=_[_0x9425('0x2d')](db[_0x9425('0x4a')][_0x9425('0x41')]);_0x442005[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x482a51[_0x9425('0x2c')]);_0x442005[_0x9425('0x2e')]=_[_0x9425('0x2f')](_0x442005[_0x9425('0x30')],_0x442005['query']);_0x2c9ad8[_0x9425('0x32')]=_[_0x9425('0x2f')](_0x442005[_0x9425('0x30')],qs[_0x9425('0x31')](_0x482a51[_0x9425('0x2c')][_0x9425('0x31')]));_0x2c9ad8['attributes']=_0x2c9ad8['attributes'][_0x9425('0x33')]?_0x2c9ad8[_0x9425('0x32')]:_0x442005[_0x9425('0x30')];_0x2c9ad8[_0x9425('0x4b')]=qs[_0x9425('0x37')](_0x482a51[_0x9425('0x2c')]['sort']);_0x2c9ad8[_0x9425('0x38')]=qs[_0x9425('0x2e')](_[_0x9425('0x4c')](_0x482a51['query'],_0x442005[_0x9425('0x2e')]));if(_0x482a51['query'][_0x9425('0x39')]){_0x2c9ad8[_0x9425('0x38')]=_[_0x9425('0x3a')](_0x2c9ad8[_0x9425('0x38')],{'$or':_[_0x9425('0x27')](_0x2c9ad8[_0x9425('0x32')],function(_0x34a48d){var _0x2deda9={};_0x2deda9[_0x34a48d]={'$like':'%'+_0x482a51[_0x9425('0x2c')][_0x9425('0x39')]+'%'};return _0x2deda9;})});}_0x2c9ad8=_[_0x9425('0x3a')]({},_0x2c9ad8,_0x482a51[_0x9425('0x43')]);return _0x3832ed['getFields'](_0x2c9ad8);}})[_0x9425('0x20')](function(_0x22347b){if(_0x22347b){_0x589f01=_0x22347b[_0x9425('0x33')];if(!_0x482a51[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x2c9ad8['limit']=qs[_0x9425('0x36')](_0x482a51[_0x9425('0x2c')]['limit']);_0x2c9ad8[_0x9425('0x1c')]=qs[_0x9425('0x1c')](_0x482a51[_0x9425('0x2c')][_0x9425('0x1c')]);}return _0x3832ed['getFields'](_0x2c9ad8);}})[_0x9425('0x20')](function(_0x1ec68c){if(_0x1ec68c){return _0x1ec68c?{'count':_0x589f01,'rows':_0x1ec68c}:null;}})[_0x9425('0x20')](respondWithResult(_0x1a3418,null))[_0x9425('0x3f')](handleError(_0x1a3418,null));};exports['getSubjects']=function(_0x3acead,_0x14230d,_0xd103b2){var _0x54782c={};var _0x2f684f={};var _0xfc237f;var _0x48a151;return db[_0x9425('0x28')][_0x9425('0x49')]({'where':{'id':_0x3acead[_0x9425('0x47')]['id']}})[_0x9425('0x20')](handleEntityNotFound(_0x14230d,null))[_0x9425('0x20')](function(_0x591414){if(_0x591414){_0xfc237f=_0x591414;_0x2f684f[_0x9425('0x30')]=_[_0x9425('0x2d')](db['SalesforceField'][_0x9425('0x41')]);_0x2f684f[_0x9425('0x2c')]=_[_0x9425('0x2d')](_0x3acead[_0x9425('0x2c')]);_0x2f684f['filters']=_[_0x9425('0x2f')](_0x2f684f[_0x9425('0x30')],_0x2f684f[_0x9425('0x2c')]);_0x54782c['attributes']=_[_0x9425('0x2f')](_0x2f684f[_0x9425('0x30')],qs['fields'](_0x3acead[_0x9425('0x2c')][_0x9425('0x31')]));_0x54782c[_0x9425('0x32')]=_0x54782c['attributes'][_0x9425('0x33')]?_0x54782c[_0x9425('0x32')]:_0x2f684f[_0x9425('0x30')];_0x54782c['order']=qs[_0x9425('0x37')](_0x3acead[_0x9425('0x2c')][_0x9425('0x37')]);_0x54782c['where']=qs[_0x9425('0x2e')](_[_0x9425('0x4c')](_0x3acead[_0x9425('0x2c')],_0x2f684f[_0x9425('0x2e')]));if(_0x3acead[_0x9425('0x2c')]['filter']){_0x54782c[_0x9425('0x38')]=_[_0x9425('0x3a')](_0x54782c[_0x9425('0x38')],{'$or':_[_0x9425('0x27')](_0x54782c[_0x9425('0x32')],function(_0x250832){var _0x517753={};_0x517753[_0x250832]={'$like':'%'+_0x3acead[_0x9425('0x2c')][_0x9425('0x39')]+'%'};return _0x517753;})});}_0x54782c=_['merge']({},_0x54782c,_0x3acead[_0x9425('0x43')]);return _0xfc237f[_0x9425('0x4d')](_0x54782c);}})[_0x9425('0x20')](function(_0x36698c){if(_0x36698c){_0x48a151=_0x36698c[_0x9425('0x33')];if(!_0x3acead[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x54782c['limit']=qs['limit'](_0x3acead[_0x9425('0x2c')][_0x9425('0x36')]);_0x54782c[_0x9425('0x1c')]=qs['offset'](_0x3acead[_0x9425('0x2c')][_0x9425('0x1c')]);}return _0xfc237f[_0x9425('0x4d')](_0x54782c);}})[_0x9425('0x20')](function(_0xb35884){if(_0xb35884){return _0xb35884?{'count':_0x48a151,'rows':_0xb35884}:null;}})[_0x9425('0x20')](respondWithResult(_0x14230d,null))[_0x9425('0x3f')](handleError(_0x14230d,null));};exports[_0x9425('0x4e')]=function(_0x3e41eb,_0x40c6c8,_0x2b66c3){var _0x2b04c6={};var _0x1f5bb5={};var _0x4b810c;var _0x51e827;return db[_0x9425('0x28')]['findOne']({'where':{'id':_0x3e41eb[_0x9425('0x47')]['id']}})[_0x9425('0x20')](handleEntityNotFound(_0x40c6c8,null))[_0x9425('0x20')](function(_0x3cfe06){if(_0x3cfe06){_0x4b810c=_0x3cfe06;_0x1f5bb5[_0x9425('0x30')]=_[_0x9425('0x2d')](db[_0x9425('0x4a')][_0x9425('0x41')]);_0x1f5bb5['query']=_['keys'](_0x3e41eb['query']);_0x1f5bb5[_0x9425('0x2e')]=_['intersection'](_0x1f5bb5['model'],_0x1f5bb5[_0x9425('0x2c')]);_0x2b04c6['attributes']=_[_0x9425('0x2f')](_0x1f5bb5[_0x9425('0x30')],qs[_0x9425('0x31')](_0x3e41eb[_0x9425('0x2c')]['fields']));_0x2b04c6['attributes']=_0x2b04c6[_0x9425('0x32')][_0x9425('0x33')]?_0x2b04c6[_0x9425('0x32')]:_0x1f5bb5[_0x9425('0x30')];_0x2b04c6[_0x9425('0x4b')]=qs[_0x9425('0x37')](_0x3e41eb[_0x9425('0x2c')][_0x9425('0x37')]);_0x2b04c6[_0x9425('0x38')]=qs[_0x9425('0x2e')](_[_0x9425('0x4c')](_0x3e41eb['query'],_0x1f5bb5[_0x9425('0x2e')]));if(_0x3e41eb[_0x9425('0x2c')][_0x9425('0x39')]){_0x2b04c6[_0x9425('0x38')]=_[_0x9425('0x3a')](_0x2b04c6[_0x9425('0x38')],{'$or':_['map'](_0x2b04c6[_0x9425('0x32')],function(_0x22ace6){var _0x5b07c8={};_0x5b07c8[_0x22ace6]={'$like':'%'+_0x3e41eb['query'][_0x9425('0x39')]+'%'};return _0x5b07c8;})});}_0x2b04c6=_[_0x9425('0x3a')]({},_0x2b04c6,_0x3e41eb['options']);return _0x4b810c[_0x9425('0x4e')](_0x2b04c6);}})['then'](function(_0x450429){if(_0x450429){_0x51e827=_0x450429[_0x9425('0x33')];if(!_0x3e41eb[_0x9425('0x2c')][_0x9425('0x34')](_0x9425('0x35'))){_0x2b04c6[_0x9425('0x36')]=qs[_0x9425('0x36')](_0x3e41eb[_0x9425('0x2c')]['limit']);_0x2b04c6['offset']=qs[_0x9425('0x1c')](_0x3e41eb[_0x9425('0x2c')][_0x9425('0x1c')]);}return _0x4b810c[_0x9425('0x4e')](_0x2b04c6);}})[_0x9425('0x20')](function(_0x4c2bc6){if(_0x4c2bc6){return _0x4c2bc6?{'count':_0x51e827,'rows':_0x4c2bc6}:null;}})[_0x9425('0x20')](respondWithResult(_0x40c6c8,null))[_0x9425('0x3f')](handleError(_0x40c6c8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4a380c6..e443af7 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 _0x3a3a=['../../config/logger','api','moment','bluebird','request-promise','path','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','lodash','util'];(function(_0x4d68ec,_0x32431f){var _0x15e7a1=function(_0x6d4742){while(--_0x6d4742){_0x4d68ec['push'](_0x4d68ec['shift']());}};_0x15e7a1(++_0x32431f);}(_0x3a3a,0x1cc));var _0xa3a3=function(_0x2f3b52,_0x476cec){_0x2f3b52=_0x2f3b52-0x0;var _0x5e7fd5=_0x3a3a[_0x2f3b52];return _0x5e7fd5;};'use strict';var _=require(_0xa3a3('0x0'));var util=require(_0xa3a3('0x1'));var logger=require(_0xa3a3('0x2'))(_0xa3a3('0x3'));var moment=require(_0xa3a3('0x4'));var BPromise=require(_0xa3a3('0x5'));var rp=require(_0xa3a3('0x6'));var fs=require('fs');var path=require(_0xa3a3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3a3('0x8'));module[_0xa3a3('0x9')]=function(_0x421d22,_0x4b2e7c){return _0x421d22['define'](_0xa3a3('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd6a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SalesforceConfiguration','lodash','util'];(function(_0x4a881e,_0xa4ce97){var _0x210714=function(_0x367d78){while(--_0x367d78){_0x4a881e['push'](_0x4a881e['shift']());}};_0x210714(++_0xa4ce97);}(_0xdd6a,0x15e));var _0xadd6=function(_0x191917,_0x552ff4){_0x191917=_0x191917-0x0;var _0x52a7ec=_0xdd6a[_0x191917];return _0x52a7ec;};'use strict';var _=require(_0xadd6('0x0'));var util=require(_0xadd6('0x1'));var logger=require(_0xadd6('0x2'))('api');var moment=require(_0xadd6('0x3'));var BPromise=require(_0xadd6('0x4'));var rp=require(_0xadd6('0x5'));var fs=require('fs');var path=require(_0xadd6('0x6'));var rimraf=require(_0xadd6('0x7'));var config=require(_0xadd6('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xadd6('0x9')]=function(_0x200977,_0x1449cb){return _0x200977['define'](_0xadd6('0xa'),attributes,{'tableName':'int_salesforce_configurations','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 6cca361..0d7695f 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 _0xf3bf=['rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x47f2b3,_0x52fd29){var _0x21f363=function(_0x19caa2){while(--_0x19caa2){_0x47f2b3['push'](_0x47f2b3['shift']());}};_0x21f363(++_0x52fd29);}(_0xf3bf,0x13c));var _0xff3b=function(_0x4fc972,_0x2906ba){_0x4fc972=_0x4fc972-0x0;var _0x491600=_0xf3bf[_0x4fc972];return _0x491600;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xff3b('0x0'));var fs=require('fs');var Redis=require(_0xff3b('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xff3b('0x2'));var logger=require(_0xff3b('0x3'))(_0xff3b('0x4'));var config=require(_0xff3b('0x5'));var jayson=require(_0xff3b('0x6'));var client=jayson['client'][_0xff3b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28effc,_0x2b84d0,_0x4d89aa){return new BPromise(function(_0x276a83,_0x1b4182){return client[_0xff3b('0x8')](_0x28effc,_0x4d89aa)[_0xff3b('0x9')](function(_0x5e6328){logger[_0xff3b('0xa')](_0xff3b('0xb'),_0x2b84d0,_0xff3b('0xc'));logger[_0xff3b('0xd')](_0xff3b('0xe'),_0x2b84d0,_0xff3b('0xc'),JSON['stringify'](_0x5e6328));if(_0x5e6328[_0xff3b('0xf')]){if(_0x5e6328[_0xff3b('0xf')][_0xff3b('0x10')]===0x1f4){logger[_0xff3b('0xf')](_0xff3b('0xb'),_0x2b84d0,_0x5e6328[_0xff3b('0xf')][_0xff3b('0x11')]);return _0x1b4182(_0x5e6328[_0xff3b('0xf')][_0xff3b('0x11')]);}logger['error'](_0xff3b('0xb'),_0x2b84d0,_0x5e6328[_0xff3b('0xf')][_0xff3b('0x11')]);return _0x276a83(_0x5e6328[_0xff3b('0xf')][_0xff3b('0x11')]);}else{logger['info'](_0xff3b('0xb'),_0x2b84d0,'request\x20sent');_0x276a83(_0x5e6328[_0xff3b('0x12')][_0xff3b('0x11')]);}})[_0xff3b('0x13')](function(_0x270c6c){logger[_0xff3b('0xf')](_0xff3b('0xb'),_0x2b84d0,_0x270c6c);_0x1b4182(_0x270c6c);});});} \ No newline at end of file +var _0x6802=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x33e424,_0x45cce6){var _0x452430=function(_0xbabba){while(--_0xbabba){_0x33e424['push'](_0x33e424['shift']());}};_0x452430(++_0x45cce6);}(_0x6802,0x1a6));var _0x2680=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x6802[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x2680('0x0'));var util=require('util');var moment=require(_0x2680('0x1'));var BPromise=require(_0x2680('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2680('0x3'));var db=require(_0x2680('0x4'))['db'];var utils=require(_0x2680('0x5'));var logger=require('../../config/logger')(_0x2680('0x6'));var config=require(_0x2680('0x7'));var jayson=require(_0x2680('0x8'));var client=jayson[_0x2680('0x9')][_0x2680('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a9c9,_0x32b9c3,_0xf1b567){return new BPromise(function(_0x291994,_0x3aeeb9){return client[_0x2680('0xb')](_0x38a9c9,_0xf1b567)[_0x2680('0xc')](function(_0x5c0ba0){logger[_0x2680('0xd')](_0x2680('0xe'),_0x32b9c3,_0x2680('0xf'));logger['debug'](_0x2680('0x10'),_0x32b9c3,'request\x20sent',JSON['stringify'](_0x5c0ba0));if(_0x5c0ba0[_0x2680('0x11')]){if(_0x5c0ba0[_0x2680('0x11')][_0x2680('0x12')]===0x1f4){logger['error'](_0x2680('0xe'),_0x32b9c3,_0x5c0ba0[_0x2680('0x11')][_0x2680('0x13')]);return _0x3aeeb9(_0x5c0ba0[_0x2680('0x11')]['message']);}logger[_0x2680('0x11')](_0x2680('0xe'),_0x32b9c3,_0x5c0ba0[_0x2680('0x11')][_0x2680('0x13')]);return _0x291994(_0x5c0ba0[_0x2680('0x11')][_0x2680('0x13')]);}else{logger[_0x2680('0xd')](_0x2680('0xe'),_0x32b9c3,_0x2680('0xf'));_0x291994(_0x5c0ba0[_0x2680('0x14')][_0x2680('0x13')]);}})['catch'](function(_0x4553f6){logger[_0x2680('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x32b9c3,_0x4553f6);_0x3aeeb9(_0x4553f6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9f79fdc..f64ccab 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 _0x5768=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','isAuthenticated','show','create','update','/:id','destroy','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5768,0x19f));var _0x8576=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x5768[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0x8576('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8576('0x1'));var express=require(_0x8576('0x2'));var router=express['Router']();var fs_extra=require(_0x8576('0x3'));var auth=require(_0x8576('0x4'));var interaction=require(_0x8576('0x5'));var config=require(_0x8576('0x6'));var controller=require(_0x8576('0x7'));router[_0x8576('0x8')]('/',auth['isAuthenticated'](),controller[_0x8576('0x9')]);router['get']('/:id',auth[_0x8576('0xa')](),controller[_0x8576('0xb')]);router['post']('/',auth[_0x8576('0xa')](),controller[_0x8576('0xc')]);router['put']('/:id',auth[_0x8576('0xa')](),controller[_0x8576('0xd')]);router['delete'](_0x8576('0xe'),auth[_0x8576('0xa')](),controller[_0x8576('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfaf9=['index','/:id','show','post','create','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x276c4f,_0x1a044a){var _0x5bba7f=function(_0x45d423){while(--_0x45d423){_0x276c4f['push'](_0x276c4f['shift']());}};_0x5bba7f(++_0x1a044a);}(_0xfaf9,0x166));var _0x9faf=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xfaf9[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x9faf('0x0'));var util=require(_0x9faf('0x1'));var path=require(_0x9faf('0x2'));var timeout=require(_0x9faf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9faf('0x4'));var auth=require(_0x9faf('0x5'));var interaction=require(_0x9faf('0x6'));var config=require(_0x9faf('0x7'));var controller=require('./intSalesforceField.controller');router[_0x9faf('0x8')]('/',auth[_0x9faf('0x9')](),controller[_0x9faf('0xa')]);router[_0x9faf('0x8')](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller[_0x9faf('0xc')]);router[_0x9faf('0xd')]('/',auth[_0x9faf('0x9')](),controller[_0x9faf('0xe')]);router['put'](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller['update']);router['delete'](_0x9faf('0xb'),auth[_0x9faf('0x9')](),controller[_0x9faf('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index dfad4bb..9bb89d2 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 _0x9961=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x3ddf67,_0x53dc45){var _0x1adbaf=function(_0x18a9af){while(--_0x18a9af){_0x3ddf67['push'](_0x3ddf67['shift']());}};_0x1adbaf(++_0x53dc45);}(_0x9961,0x17d));var _0x1996=function(_0x18dd12,_0xfb7fbc){_0x18dd12=_0x18dd12-0x0;var _0x537e04=_0x9961[_0x18dd12];return _0x537e04;};'use strict';var Sequelize=require(_0x1996('0x0'));module[_0x1996('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1996('0x2'),_0x1996('0x3'),_0x1996('0x4'),_0x1996('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1996('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1996('0x7')](_0x1996('0x2'),_0x1996('0x3'),_0x1996('0x4'))},'keyContent':{'type':Sequelize[_0x1996('0x6')]},'idField':{'type':Sequelize[_0x1996('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x91db=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x1bc387,_0x3dc7d9){var _0x17a8bc=function(_0x4b6da6){while(--_0x4b6da6){_0x1bc387['push'](_0x1bc387['shift']());}};_0x17a8bc(++_0x3dc7d9);}(_0x91db,0xce));var _0xb91d=function(_0x3b79fe,_0x1a92ac){_0x3b79fe=_0x3b79fe-0x0;var _0x56f433=_0x91db[_0x3b79fe];return _0x56f433;};'use strict';var Sequelize=require(_0xb91d('0x0'));module[_0xb91d('0x1')]={'type':{'type':Sequelize[_0xb91d('0x2')]('string',_0xb91d('0x3'),_0xb91d('0x4'),_0xb91d('0x5'),_0xb91d('0x6')),'defaultValue':_0xb91d('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb91d('0x8')]},'keyType':{'type':Sequelize[_0xb91d('0x2')](_0xb91d('0x7'),'variable',_0xb91d('0x4'))},'keyContent':{'type':Sequelize[_0xb91d('0x8')]},'idField':{'type':Sequelize[_0xb91d('0x8')]},'variableName':{'type':Sequelize[_0xb91d('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b2ca577..7102338 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 _0x38fd=['attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','body','catch','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','update','then','error','name','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x13e1fc,_0x32443b){var _0x4e0314=function(_0x48b86b){while(--_0x48b86b){_0x13e1fc['push'](_0x13e1fc['shift']());}};_0x4e0314(++_0x32443b);}(_0x38fd,0x1b7));var _0xd38f=function(_0x340b21,_0x1e06b4){_0x340b21=_0x340b21-0x0;var _0x55fddb=_0x38fd[_0x340b21];return _0x55fddb;};'use strict';var emlformat=require(_0xd38f('0x0'));var rimraf=require(_0xd38f('0x1'));var zipdir=require(_0xd38f('0x2'));var jsonpatch=require(_0xd38f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd38f('0x4'));var Mustache=require('mustache');var util=require(_0xd38f('0x5'));var path=require(_0xd38f('0x6'));var sox=require('sox');var csv=require(_0xd38f('0x7'));var ejs=require(_0xd38f('0x8'));var fs=require('fs');var fs_extra=require(_0xd38f('0x9'));var _=require('lodash');var squel=require(_0xd38f('0xa'));var crypto=require(_0xd38f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd38f('0xc'));var toCsv=require(_0xd38f('0x7'));var querystring=require(_0xd38f('0xd'));var Papa=require(_0xd38f('0xe'));var Redis=require(_0xd38f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd38f('0x10'));var as=require(_0xd38f('0x11'));var hardwareService=require(_0xd38f('0x12'));var logger=require(_0xd38f('0x13'))(_0xd38f('0x14'));var utils=require(_0xd38f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd38f('0x16'));var db=require(_0xd38f('0x17'))['db'];function respondWithStatusCode(_0x217e8b,_0x22c875){_0x22c875=_0x22c875||0xcc;return function(_0x2ec84a){if(_0x2ec84a){return _0x217e8b[_0xd38f('0x18')](_0x22c875);}return _0x217e8b['status'](_0x22c875)[_0xd38f('0x19')]();};}function respondWithResult(_0x236039,_0x3714f0){_0x3714f0=_0x3714f0||0xc8;return function(_0x242044){if(_0x242044){return _0x236039['status'](_0x3714f0)[_0xd38f('0x1a')](_0x242044);}};}function respondWithFilteredResult(_0x55f716,_0x21d040){return function(_0x3d2317){if(_0x3d2317){var _0x4a590c=typeof _0x21d040['offset']==='undefined'&&typeof _0x21d040[_0xd38f('0x1b')]===_0xd38f('0x1c');var _0x2c572f=_0x3d2317[_0xd38f('0x1d')];var _0x126fcb=_0x4a590c?0x0:_0x21d040['offset'];var _0x1452f2=_0x4a590c?_0x3d2317[_0xd38f('0x1d')]:_0x21d040[_0xd38f('0x1e')]+_0x21d040[_0xd38f('0x1b')];var _0x59d8a7;if(_0x1452f2>=_0x2c572f){_0x1452f2=_0x2c572f;_0x59d8a7=0xc8;}else{_0x59d8a7=0xce;}_0x55f716[_0xd38f('0x1f')](_0x59d8a7);return _0x55f716[_0xd38f('0x20')](_0xd38f('0x21'),_0x126fcb+'-'+_0x1452f2+'/'+_0x2c572f)['json'](_0x3d2317);}return null;};}function patchUpdates(_0x636096){return function(_0x4ae6c4){try{jsonpatch[_0xd38f('0x22')](_0x4ae6c4,_0x636096,!![]);}catch(_0x229e85){return BPromise[_0xd38f('0x23')](_0x229e85);}return _0x4ae6c4['save']();};}function saveUpdates(_0x20a78b,_0x4783d8){return function(_0x581dd6){if(_0x581dd6){return _0x581dd6[_0xd38f('0x24')](_0x20a78b)[_0xd38f('0x25')](function(_0x123c6a){return _0x123c6a;});}return null;};}function removeEntity(_0x3e9c4f,_0x31fa04){return function(_0x56b736){if(_0x56b736){return _0x56b736['destroy']()['then'](function(){_0x3e9c4f[_0xd38f('0x1f')](0xcc)[_0xd38f('0x19')]();});}};}function handleEntityNotFound(_0xcb208e,_0x2479be){return function(_0x28cc1b){if(!_0x28cc1b){_0xcb208e[_0xd38f('0x18')](0x194);}return _0x28cc1b;};}function handleError(_0x480455,_0x289f8e){_0x289f8e=_0x289f8e||0x1f4;return function(_0xd78014){logger[_0xd38f('0x26')](_0xd78014['stack']);if(_0xd78014[_0xd38f('0x27')]){delete _0xd78014[_0xd38f('0x27')];}_0x480455[_0xd38f('0x1f')](_0x289f8e)['send'](_0xd78014);};}exports['index']=function(_0x5c485f,_0x5abdda){var _0x2cd98e={},_0x38e741={},_0x331654={'count':0x0,'rows':[]};var _0x4f6370=_[_0xd38f('0x28')](db[_0xd38f('0x29')][_0xd38f('0x2a')],function(_0x3c4a62){return{'name':_0x3c4a62[_0xd38f('0x2b')],'type':_0x3c4a62[_0xd38f('0x2c')][_0xd38f('0x2d')]};});_0x38e741[_0xd38f('0x2e')]=_[_0xd38f('0x28')](_0x4f6370,'name');_0x38e741[_0xd38f('0x2f')]=_[_0xd38f('0x30')](_0x5c485f['query']);_0x38e741[_0xd38f('0x31')]=_[_0xd38f('0x32')](_0x38e741[_0xd38f('0x2e')],_0x38e741[_0xd38f('0x2f')]);_0x2cd98e[_0xd38f('0x33')]=_[_0xd38f('0x32')](_0x38e741[_0xd38f('0x2e')],qs[_0xd38f('0x34')](_0x5c485f[_0xd38f('0x2f')][_0xd38f('0x34')]));_0x2cd98e[_0xd38f('0x33')]=_0x2cd98e['attributes'][_0xd38f('0x35')]?_0x2cd98e[_0xd38f('0x33')]:_0x38e741[_0xd38f('0x2e')];if(!_0x5c485f[_0xd38f('0x2f')][_0xd38f('0x36')]('nolimit')){_0x2cd98e['limit']=qs['limit'](_0x5c485f[_0xd38f('0x2f')][_0xd38f('0x1b')]);_0x2cd98e['offset']=qs[_0xd38f('0x1e')](_0x5c485f[_0xd38f('0x2f')][_0xd38f('0x1e')]);}_0x2cd98e['order']=qs[_0xd38f('0x37')](_0x5c485f[_0xd38f('0x2f')][_0xd38f('0x37')]);_0x2cd98e[_0xd38f('0x38')]=qs['filters'](_['pick'](_0x5c485f[_0xd38f('0x2f')],_0x38e741['filters']),_0x4f6370);if(_0x5c485f[_0xd38f('0x2f')]['filter']){_0x2cd98e['where']=_[_0xd38f('0x39')](_0x2cd98e[_0xd38f('0x38')],{'$or':_[_0xd38f('0x28')](_0x4f6370,function(_0x54c803){if(_0x54c803['type']!==_0xd38f('0x3a')){var _0x371ff1={};_0x371ff1[_0x54c803[_0xd38f('0x27')]]={'$like':'%'+_0x5c485f[_0xd38f('0x2f')][_0xd38f('0x3b')]+'%'};return _0x371ff1;}})});}_0x2cd98e=_[_0xd38f('0x39')]({},_0x2cd98e,_0x5c485f[_0xd38f('0x3c')]);var _0x5ceae0={'where':_0x2cd98e['where']};return db[_0xd38f('0x29')][_0xd38f('0x1d')](_0x5ceae0)[_0xd38f('0x25')](function(_0x1c95f8){_0x331654[_0xd38f('0x1d')]=_0x1c95f8;if(_0x5c485f['query'][_0xd38f('0x3d')]){_0x2cd98e[_0xd38f('0x3e')]=[{'all':!![]}];}return db[_0xd38f('0x29')][_0xd38f('0x3f')](_0x2cd98e);})[_0xd38f('0x25')](function(_0x389eea){_0x331654[_0xd38f('0x40')]=_0x389eea;return _0x331654;})[_0xd38f('0x25')](respondWithFilteredResult(_0x5abdda,_0x2cd98e))['catch'](handleError(_0x5abdda,null));};exports['show']=function(_0x18a01f,_0x210a8d){var _0x2ff725={'raw':!![],'where':{'id':_0x18a01f['params']['id']}},_0x529894={};_0x529894[_0xd38f('0x2e')]=_[_0xd38f('0x30')](db[_0xd38f('0x29')][_0xd38f('0x2a')]);_0x529894[_0xd38f('0x2f')]=_['keys'](_0x18a01f[_0xd38f('0x2f')]);_0x529894[_0xd38f('0x31')]=_[_0xd38f('0x32')](_0x529894[_0xd38f('0x2e')],_0x529894[_0xd38f('0x2f')]);_0x2ff725[_0xd38f('0x33')]=_['intersection'](_0x529894[_0xd38f('0x2e')],qs[_0xd38f('0x34')](_0x18a01f[_0xd38f('0x2f')][_0xd38f('0x34')]));_0x2ff725[_0xd38f('0x33')]=_0x2ff725[_0xd38f('0x33')][_0xd38f('0x35')]?_0x2ff725['attributes']:_0x529894[_0xd38f('0x2e')];if(_0x18a01f[_0xd38f('0x2f')][_0xd38f('0x3d')]){_0x2ff725[_0xd38f('0x3e')]=[{'all':!![]}];}_0x2ff725=_['merge']({},_0x2ff725,_0x18a01f[_0xd38f('0x3c')]);return db['SalesforceField'][_0xd38f('0x41')](_0x2ff725)[_0xd38f('0x25')](handleEntityNotFound(_0x210a8d,null))[_0xd38f('0x25')](respondWithResult(_0x210a8d,null))['catch'](handleError(_0x210a8d,null));};exports['create']=function(_0x1d711e,_0x425037){return db[_0xd38f('0x29')]['create'](_0x1d711e[_0xd38f('0x42')],{})[_0xd38f('0x25')](respondWithResult(_0x425037,0xc9))[_0xd38f('0x43')](handleError(_0x425037,null));};exports[_0xd38f('0x24')]=function(_0x240fa3,_0x2e8227){if(_0x240fa3['body']['id']){delete _0x240fa3['body']['id'];}return db[_0xd38f('0x29')]['find']({'where':{'id':_0x240fa3[_0xd38f('0x44')]['id']}})[_0xd38f('0x25')](handleEntityNotFound(_0x2e8227,null))[_0xd38f('0x25')](saveUpdates(_0x240fa3[_0xd38f('0x42')],null))[_0xd38f('0x25')](respondWithResult(_0x2e8227,null))['catch'](handleError(_0x2e8227,null));};exports[_0xd38f('0x45')]=function(_0xd17b4,_0xee86a8){return db[_0xd38f('0x29')][_0xd38f('0x41')]({'where':{'id':_0xd17b4[_0xd38f('0x44')]['id']}})['then'](handleEntityNotFound(_0xee86a8,null))[_0xd38f('0x25')](removeEntity(_0xee86a8,null))[_0xd38f('0x43')](handleError(_0xee86a8,null));}; \ No newline at end of file +var _0x7f47=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','then','include','findAll','rows','show','params','keys','intersection','length','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','filters','attributes'];(function(_0x5196f0,_0x57586f){var _0x5c462d=function(_0x330fad){while(--_0x330fad){_0x5196f0['push'](_0x5196f0['shift']());}};_0x5c462d(++_0x57586f);}(_0x7f47,0xfc));var _0x77f4=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x7f47[_0x491cbe];return _0x59449d;};'use strict';var emlformat=require(_0x77f4('0x0'));var rimraf=require(_0x77f4('0x1'));var zipdir=require(_0x77f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77f4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77f4('0x4'));var util=require(_0x77f4('0x5'));var path=require(_0x77f4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x77f4('0x7'));var fs=require('fs');var fs_extra=require(_0x77f4('0x8'));var _=require(_0x77f4('0x9'));var squel=require(_0x77f4('0xa'));var crypto=require(_0x77f4('0xb'));var jsforce=require(_0x77f4('0xc'));var deskjs=require(_0x77f4('0xd'));var toCsv=require(_0x77f4('0xe'));var querystring=require(_0x77f4('0xf'));var Papa=require('papaparse');var Redis=require(_0x77f4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x77f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77f4('0x12'))(_0x77f4('0x13'));var utils=require(_0x77f4('0x14'));var config=require(_0x77f4('0x15'));var licenseUtil=require(_0x77f4('0x16'));var db=require(_0x77f4('0x17'))['db'];function respondWithStatusCode(_0x18467b,_0x29a084){_0x29a084=_0x29a084||0xcc;return function(_0x3b4a78){if(_0x3b4a78){return _0x18467b['sendStatus'](_0x29a084);}return _0x18467b['status'](_0x29a084)[_0x77f4('0x18')]();};}function respondWithResult(_0x3dec3c,_0x42c2b3){_0x42c2b3=_0x42c2b3||0xc8;return function(_0x197dd6){if(_0x197dd6){return _0x3dec3c[_0x77f4('0x19')](_0x42c2b3)[_0x77f4('0x1a')](_0x197dd6);}};}function respondWithFilteredResult(_0x2f1833,_0x56ff86){return function(_0x50d8ae){if(_0x50d8ae){var _0x1c0a29=typeof _0x56ff86[_0x77f4('0x1b')]===_0x77f4('0x1c')&&typeof _0x56ff86['limit']===_0x77f4('0x1c');var _0x2b0e71=_0x50d8ae[_0x77f4('0x1d')];var _0x9b261c=_0x1c0a29?0x0:_0x56ff86[_0x77f4('0x1b')];var _0x439c21=_0x1c0a29?_0x50d8ae[_0x77f4('0x1d')]:_0x56ff86['offset']+_0x56ff86[_0x77f4('0x1e')];var _0x2cd760;if(_0x439c21>=_0x2b0e71){_0x439c21=_0x2b0e71;_0x2cd760=0xc8;}else{_0x2cd760=0xce;}_0x2f1833['status'](_0x2cd760);return _0x2f1833[_0x77f4('0x1f')]('Content-Range',_0x9b261c+'-'+_0x439c21+'/'+_0x2b0e71)[_0x77f4('0x1a')](_0x50d8ae);}return null;};}function patchUpdates(_0x4e1d14){return function(_0x53ee24){try{jsonpatch[_0x77f4('0x20')](_0x53ee24,_0x4e1d14,!![]);}catch(_0x114cec){return BPromise[_0x77f4('0x21')](_0x114cec);}return _0x53ee24[_0x77f4('0x22')]();};}function saveUpdates(_0x276e45,_0x3caea4){return function(_0x47fee1){if(_0x47fee1){return _0x47fee1[_0x77f4('0x23')](_0x276e45)['then'](function(_0x371648){return _0x371648;});}return null;};}function removeEntity(_0x518187,_0x3e0049){return function(_0xa7f61a){if(_0xa7f61a){return _0xa7f61a[_0x77f4('0x24')]()['then'](function(){_0x518187[_0x77f4('0x19')](0xcc)[_0x77f4('0x18')]();});}};}function handleEntityNotFound(_0x16a821,_0x4301b0){return function(_0xe72a1c){if(!_0xe72a1c){_0x16a821[_0x77f4('0x25')](0x194);}return _0xe72a1c;};}function handleError(_0x1ba54d,_0x5a3e2e){_0x5a3e2e=_0x5a3e2e||0x1f4;return function(_0x3b518f){logger[_0x77f4('0x26')](_0x3b518f[_0x77f4('0x27')]);if(_0x3b518f[_0x77f4('0x28')]){delete _0x3b518f[_0x77f4('0x28')];}_0x1ba54d[_0x77f4('0x19')](_0x5a3e2e)[_0x77f4('0x29')](_0x3b518f);};}exports[_0x77f4('0x2a')]=function(_0x2ba428,_0x38a2c3){var _0x4721c6={},_0x113f10={},_0x39bca8={'count':0x0,'rows':[]};var _0x2008f9=_[_0x77f4('0x2b')](db[_0x77f4('0x2c')][_0x77f4('0x2d')],function(_0x3bb447){return{'name':_0x3bb447['fieldName'],'type':_0x3bb447[_0x77f4('0x2e')][_0x77f4('0x2f')]};});_0x113f10[_0x77f4('0x30')]=_[_0x77f4('0x2b')](_0x2008f9,_0x77f4('0x28'));_0x113f10[_0x77f4('0x31')]=_['keys'](_0x2ba428[_0x77f4('0x31')]);_0x113f10[_0x77f4('0x32')]=_['intersection'](_0x113f10['model'],_0x113f10['query']);_0x4721c6[_0x77f4('0x33')]=_['intersection'](_0x113f10[_0x77f4('0x30')],qs[_0x77f4('0x34')](_0x2ba428[_0x77f4('0x31')]['fields']));_0x4721c6['attributes']=_0x4721c6[_0x77f4('0x33')]['length']?_0x4721c6[_0x77f4('0x33')]:_0x113f10[_0x77f4('0x30')];if(!_0x2ba428[_0x77f4('0x31')][_0x77f4('0x35')]('nolimit')){_0x4721c6[_0x77f4('0x1e')]=qs[_0x77f4('0x1e')](_0x2ba428['query']['limit']);_0x4721c6[_0x77f4('0x1b')]=qs['offset'](_0x2ba428['query'][_0x77f4('0x1b')]);}_0x4721c6[_0x77f4('0x36')]=qs[_0x77f4('0x37')](_0x2ba428['query'][_0x77f4('0x37')]);_0x4721c6['where']=qs[_0x77f4('0x32')](_[_0x77f4('0x38')](_0x2ba428[_0x77f4('0x31')],_0x113f10[_0x77f4('0x32')]),_0x2008f9);if(_0x2ba428['query'][_0x77f4('0x39')]){_0x4721c6['where']=_['merge'](_0x4721c6[_0x77f4('0x3a')],{'$or':_[_0x77f4('0x2b')](_0x2008f9,function(_0x4dd287){if(_0x4dd287[_0x77f4('0x2e')]!==_0x77f4('0x3b')){var _0x28c246={};_0x28c246[_0x4dd287[_0x77f4('0x28')]]={'$like':'%'+_0x2ba428[_0x77f4('0x31')]['filter']+'%'};return _0x28c246;}})});}_0x4721c6=_[_0x77f4('0x3c')]({},_0x4721c6,_0x2ba428[_0x77f4('0x3d')]);var _0xa24ae0={'where':_0x4721c6['where']};return db[_0x77f4('0x2c')][_0x77f4('0x1d')](_0xa24ae0)[_0x77f4('0x3e')](function(_0x1bc8a3){_0x39bca8[_0x77f4('0x1d')]=_0x1bc8a3;if(_0x2ba428[_0x77f4('0x31')]['includeAll']){_0x4721c6[_0x77f4('0x3f')]=[{'all':!![]}];}return db[_0x77f4('0x2c')][_0x77f4('0x40')](_0x4721c6);})[_0x77f4('0x3e')](function(_0x3f2551){_0x39bca8[_0x77f4('0x41')]=_0x3f2551;return _0x39bca8;})[_0x77f4('0x3e')](respondWithFilteredResult(_0x38a2c3,_0x4721c6))['catch'](handleError(_0x38a2c3,null));};exports[_0x77f4('0x42')]=function(_0x16942a,_0x4932b6){var _0x2dcf62={'raw':!![],'where':{'id':_0x16942a[_0x77f4('0x43')]['id']}},_0x7aa091={};_0x7aa091[_0x77f4('0x30')]=_[_0x77f4('0x44')](db[_0x77f4('0x2c')]['rawAttributes']);_0x7aa091[_0x77f4('0x31')]=_['keys'](_0x16942a[_0x77f4('0x31')]);_0x7aa091[_0x77f4('0x32')]=_[_0x77f4('0x45')](_0x7aa091[_0x77f4('0x30')],_0x7aa091['query']);_0x2dcf62[_0x77f4('0x33')]=_[_0x77f4('0x45')](_0x7aa091[_0x77f4('0x30')],qs[_0x77f4('0x34')](_0x16942a[_0x77f4('0x31')][_0x77f4('0x34')]));_0x2dcf62['attributes']=_0x2dcf62[_0x77f4('0x33')][_0x77f4('0x46')]?_0x2dcf62[_0x77f4('0x33')]:_0x7aa091['model'];if(_0x16942a[_0x77f4('0x31')][_0x77f4('0x47')]){_0x2dcf62[_0x77f4('0x3f')]=[{'all':!![]}];}_0x2dcf62=_['merge']({},_0x2dcf62,_0x16942a[_0x77f4('0x3d')]);return db[_0x77f4('0x2c')]['find'](_0x2dcf62)[_0x77f4('0x3e')](handleEntityNotFound(_0x4932b6,null))[_0x77f4('0x3e')](respondWithResult(_0x4932b6,null))[_0x77f4('0x48')](handleError(_0x4932b6,null));};exports[_0x77f4('0x49')]=function(_0x48f1b5,_0x2babb8){return db[_0x77f4('0x2c')][_0x77f4('0x49')](_0x48f1b5[_0x77f4('0x4a')],{})[_0x77f4('0x3e')](respondWithResult(_0x2babb8,0xc9))[_0x77f4('0x48')](handleError(_0x2babb8,null));};exports[_0x77f4('0x23')]=function(_0x4362c0,_0x548825){if(_0x4362c0[_0x77f4('0x4a')]['id']){delete _0x4362c0[_0x77f4('0x4a')]['id'];}return db[_0x77f4('0x2c')][_0x77f4('0x4b')]({'where':{'id':_0x4362c0[_0x77f4('0x43')]['id']}})[_0x77f4('0x3e')](handleEntityNotFound(_0x548825,null))['then'](saveUpdates(_0x4362c0[_0x77f4('0x4a')],null))['then'](respondWithResult(_0x548825,null))['catch'](handleError(_0x548825,null));};exports[_0x77f4('0x24')]=function(_0x312800,_0x4fdb9d){return db[_0x77f4('0x2c')][_0x77f4('0x4b')]({'where':{'id':_0x312800[_0x77f4('0x43')]['id']}})[_0x77f4('0x3e')](handleEntityNotFound(_0x4fdb9d,null))[_0x77f4('0x3e')](removeEntity(_0x4fdb9d,null))[_0x77f4('0x48')](handleError(_0x4fdb9d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 43c1ead..248a825 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 _0x7654=['bluebird','request-promise','path','../../config/environment','exports','define','int_salesforce_fields','idField','FieldId','../../config/logger','api','moment'];(function(_0x5e608c,_0x453591){var _0x44d7fc=function(_0xc9de57){while(--_0xc9de57){_0x5e608c['push'](_0x5e608c['shift']());}};_0x44d7fc(++_0x453591);}(_0x7654,0x1d1));var _0x4765=function(_0x4d0be5,_0x1d9eb1){_0x4d0be5=_0x4d0be5-0x0;var _0x4e6e60=_0x7654[_0x4d0be5];return _0x4e6e60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4765('0x0'))(_0x4765('0x1'));var moment=require(_0x4765('0x2'));var BPromise=require(_0x4765('0x3'));var rp=require(_0x4765('0x4'));var fs=require('fs');var path=require(_0x4765('0x5'));var rimraf=require('rimraf');var config=require(_0x4765('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x4765('0x7')]=function(_0x47b64c,_0x27fb42){return _0x47b64c[_0x4765('0x8')]('SalesforceField',attributes,{'tableName':_0x4765('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x4765('0xa'),_0x4765('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c85=['moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger'];(function(_0x16390c,_0x462ee9){var _0x1f01d7=function(_0x238737){while(--_0x238737){_0x16390c['push'](_0x16390c['shift']());}};_0x1f01d7(++_0x462ee9);}(_0x4c85,0x129));var _0x54c8=function(_0x5232d2,_0xd3946b){_0x5232d2=_0x5232d2-0x0;var _0x50ac4a=_0x4c85[_0x5232d2];return _0x50ac4a;};'use strict';var _=require(_0x54c8('0x0'));var util=require('util');var logger=require(_0x54c8('0x1'))('api');var moment=require(_0x54c8('0x2'));var BPromise=require(_0x54c8('0x3'));var rp=require(_0x54c8('0x4'));var fs=require('fs');var path=require(_0x54c8('0x5'));var rimraf=require('rimraf');var config=require(_0x54c8('0x6'));var attributes=require(_0x54c8('0x7'));module['exports']=function(_0x216eb6,_0x3cc8cc){return _0x216eb6[_0x54c8('0x8')](_0x54c8('0x9'),attributes,{'tableName':_0x54c8('0xa'),'paranoid':![],'indexes':[{'name':_0x54c8('0xb'),'fields':['idField',_0x54c8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index ac3912f..47e1114 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 _0x6d65=['lodash','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch'];(function(_0x2422ba,_0x3d8677){var _0x5a4dae=function(_0x3a4099){while(--_0x3a4099){_0x2422ba['push'](_0x2422ba['shift']());}};_0x5a4dae(++_0x3d8677);}(_0x6d65,0xbb));var _0x56d6=function(_0x44ec0f,_0x2f25be){_0x44ec0f=_0x44ec0f-0x0;var _0x26e110=_0x6d65[_0x44ec0f];return _0x26e110;};'use strict';var _=require(_0x56d6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x56d6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56d6('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x56d6('0x3'))('rpc');var config=require(_0x56d6('0x4'));var jayson=require(_0x56d6('0x5'));var client=jayson[_0x56d6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cc0e7,_0x181400,_0x42fa80){return new BPromise(function(_0x104729,_0x2a0319){return client[_0x56d6('0x7')](_0x1cc0e7,_0x42fa80)[_0x56d6('0x8')](function(_0x2c4dd6){logger['info'](_0x56d6('0x9'),_0x181400,'request\x20sent');logger['debug'](_0x56d6('0xa'),_0x181400,_0x56d6('0xb'),JSON['stringify'](_0x2c4dd6));if(_0x2c4dd6['error']){if(_0x2c4dd6[_0x56d6('0xc')]['code']===0x1f4){logger[_0x56d6('0xc')](_0x56d6('0x9'),_0x181400,_0x2c4dd6['error'][_0x56d6('0xd')]);return _0x2a0319(_0x2c4dd6[_0x56d6('0xc')][_0x56d6('0xd')]);}logger[_0x56d6('0xc')](_0x56d6('0x9'),_0x181400,_0x2c4dd6[_0x56d6('0xc')][_0x56d6('0xd')]);return _0x104729(_0x2c4dd6[_0x56d6('0xc')][_0x56d6('0xd')]);}else{logger[_0x56d6('0xe')]('SalesforceField,\x20%s,\x20%s',_0x181400,_0x56d6('0xb'));_0x104729(_0x2c4dd6[_0x56d6('0xf')][_0x56d6('0xd')]);}})[_0x56d6('0x10')](function(_0x381669){logger[_0x56d6('0xc')](_0x56d6('0x9'),_0x181400,_0x381669);_0x2a0319(_0x381669);});});} \ No newline at end of file +var _0x12de=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment'];(function(_0x5b1d80,_0x4230ba){var _0x4f344c=function(_0x50d40b){while(--_0x50d40b){_0x5b1d80['push'](_0x5b1d80['shift']());}};_0x4f344c(++_0x4230ba);}(_0x12de,0x66));var _0xe12d=function(_0x50f453,_0x39fabf){_0x50f453=_0x50f453-0x0;var _0xbce5bd=_0x12de[_0x50f453];return _0xbce5bd;};'use strict';var _=require(_0xe12d('0x0'));var util=require(_0xe12d('0x1'));var moment=require(_0xe12d('0x2'));var BPromise=require(_0xe12d('0x3'));var rs=require(_0xe12d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe12d('0x5'))['db'];var utils=require(_0xe12d('0x6'));var logger=require('../../config/logger')(_0xe12d('0x7'));var config=require(_0xe12d('0x8'));var jayson=require(_0xe12d('0x9'));var client=jayson[_0xe12d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e604,_0x2c9216,_0x48fc16){return new BPromise(function(_0x559cb1,_0x2e9efc){return client[_0xe12d('0xb')](_0x46e604,_0x48fc16)[_0xe12d('0xc')](function(_0x4f7776){logger[_0xe12d('0xd')](_0xe12d('0xe'),_0x2c9216,_0xe12d('0xf'));logger[_0xe12d('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2c9216,'request\x20sent',JSON[_0xe12d('0x11')](_0x4f7776));if(_0x4f7776['error']){if(_0x4f7776[_0xe12d('0x12')]['code']===0x1f4){logger[_0xe12d('0x12')](_0xe12d('0xe'),_0x2c9216,_0x4f7776[_0xe12d('0x12')][_0xe12d('0x13')]);return _0x2e9efc(_0x4f7776[_0xe12d('0x12')][_0xe12d('0x13')]);}logger[_0xe12d('0x12')](_0xe12d('0xe'),_0x2c9216,_0x4f7776['error'][_0xe12d('0x13')]);return _0x559cb1(_0x4f7776[_0xe12d('0x12')]['message']);}else{logger[_0xe12d('0xd')](_0xe12d('0xe'),_0x2c9216,_0xe12d('0xf'));_0x559cb1(_0x4f7776['result']['message']);}})[_0xe12d('0x14')](function(_0x4e6a0f){logger[_0xe12d('0x12')](_0xe12d('0xe'),_0x2c9216,_0x4e6a0f);_0x2e9efc(_0x4e6a0f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 376ce0f..eb9c593 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 _0x5cd8=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x3a6bc4,_0xd8ed1d){var _0x5a3c9a=function(_0x51085c){while(--_0x51085c){_0x3a6bc4['push'](_0x3a6bc4['shift']());}};_0x5a3c9a(++_0xd8ed1d);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x52e364,_0x2f9e5a){_0x52e364=_0x52e364-0x0;var _0x42a436=_0x5cd8[_0x52e364];return _0x42a436;};'use strict';var multer=require(_0x85cd('0x0'));var util=require('util');var path=require(_0x85cd('0x1'));var timeout=require(_0x85cd('0x2'));var express=require(_0x85cd('0x3'));var router=express[_0x85cd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85cd('0x6'));var controller=require(_0x85cd('0x7'));router[_0x85cd('0x8')]('/',auth[_0x85cd('0x9')](),controller[_0x85cd('0xa')]);router['get'](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller['show']);router[_0x85cd('0x8')](_0x85cd('0xc'),auth[_0x85cd('0x9')](),controller[_0x85cd('0xd')]);router[_0x85cd('0x8')](_0x85cd('0xe'),auth[_0x85cd('0x9')](),controller[_0x85cd('0xf')]);router[_0x85cd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x85cd('0x10')](_0x85cd('0xc'),auth[_0x85cd('0x9')](),controller[_0x85cd('0x11')]);router['put'](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller[_0x85cd('0x12')]);router[_0x85cd('0x13')](_0x85cd('0xb'),auth[_0x85cd('0x9')](),controller[_0x85cd('0x14')]);module[_0x85cd('0x15')]=router; \ No newline at end of file +var _0x0f5b=['show','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x225b2f,_0x456497){var _0x590320=function(_0x2f056d){while(--_0x2f056d){_0x225b2f['push'](_0x225b2f['shift']());}};_0x590320(++_0x456497);}(_0x0f5b,0xd1));var _0xb0f5=function(_0x32898a,_0x569193){_0x32898a=_0x32898a-0x0;var _0x575b2b=_0x0f5b[_0x32898a];return _0x575b2b;};'use strict';var multer=require('multer');var util=require(_0xb0f5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0f5('0x1'));var router=express[_0xb0f5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb0f5('0x3'));var interaction=require(_0xb0f5('0x4'));var config=require(_0xb0f5('0x5'));var controller=require(_0xb0f5('0x6'));router[_0xb0f5('0x7')]('/',auth[_0xb0f5('0x8')](),controller[_0xb0f5('0x9')]);router[_0xb0f5('0x7')](_0xb0f5('0xa'),auth[_0xb0f5('0x8')](),controller[_0xb0f5('0xb')]);router[_0xb0f5('0x7')]('/:id/configurations',auth[_0xb0f5('0x8')](),controller[_0xb0f5('0xc')]);router['get'](_0xb0f5('0xd'),auth['isAuthenticated'](),controller[_0xb0f5('0xe')]);router[_0xb0f5('0xf')]('/',auth[_0xb0f5('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xb0f5('0x10')]);router[_0xb0f5('0x11')](_0xb0f5('0xa'),auth[_0xb0f5('0x8')](),controller[_0xb0f5('0x12')]);router[_0xb0f5('0x13')](_0xb0f5('0xa'),auth[_0xb0f5('0x8')](),controller[_0xb0f5('0x14')]);module[_0xb0f5('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 a8854d2..f1bc666 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 _0x5d77=['exports','STRING','remoteUri'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x5d77,0xe7));var _0x75d7=function(_0x5d220d,_0x2875c1){_0x5d220d=_0x5d220d-0x0;var _0x16a07a=_0x5d77[_0x5d220d];return _0x16a07a;};'use strict';var Sequelize=require('sequelize');module[_0x75d7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x75d7('0x1')]},'username':{'type':Sequelize[_0x75d7('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x75d7('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x75d7('0x2')},'serverUrl':{'type':Sequelize[_0x75d7('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd8e0=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2e8c4c,_0x3738a7){var _0x567d65=function(_0x434a43){while(--_0x434a43){_0x2e8c4c['push'](_0x2e8c4c['shift']());}};_0x567d65(++_0x3738a7);}(_0xd8e0,0xdc));var _0x0d8e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd8e0[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x0d8e('0x0'));module[_0x0d8e('0x1')]={'name':{'type':Sequelize[_0x0d8e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0d8e('0x3')},'password':{'type':Sequelize[_0x0d8e('0x2')]},'email':{'type':Sequelize[_0x0d8e('0x2')]},'remoteUri':{'type':Sequelize[_0x0d8e('0x2')],'unique':_0x0d8e('0x4')},'serverUrl':{'type':Sequelize[_0x0d8e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b30d736..84f2955 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 _0x6098=['state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','caller_id','approval_set','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','contact_type','reopened_by','incident_state','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','GET','result','log','incident\x20table\x20objects','assign','remove','forEach','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','ServicenowField','hold_reason','knowledge','subcategory','close_code','notify','severity','category','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','sys_created_on'];(function(_0x2b234e,_0x226ccc){var _0x5dc086=function(_0x56f528){while(--_0x56f528){_0x2b234e['push'](_0x2b234e['shift']());}};_0x5dc086(++_0x226ccc);}(_0x6098,0x106));var _0x8609=function(_0x172dca,_0xda5041){_0x172dca=_0x172dca-0x0;var _0x2a887f=_0x6098[_0x172dca];return _0x2a887f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8609('0x0'));var zipdir=require(_0x8609('0x1'));var jsonpatch=require(_0x8609('0x2'));var rp=require(_0x8609('0x3'));var moment=require(_0x8609('0x4'));var BPromise=require(_0x8609('0x5'));var Mustache=require(_0x8609('0x6'));var util=require(_0x8609('0x7'));var path=require('path');var sox=require(_0x8609('0x8'));var csv=require(_0x8609('0x9'));var ejs=require(_0x8609('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8609('0xb'));var squel=require(_0x8609('0xc'));var crypto=require(_0x8609('0xd'));var jsforce=require(_0x8609('0xe'));var deskjs=require(_0x8609('0xf'));var toCsv=require(_0x8609('0x9'));var querystring=require('querystring');var Papa=require(_0x8609('0x10'));var Redis=require(_0x8609('0x11'));var authService=require(_0x8609('0x12'));var qs=require(_0x8609('0x13'));var as=require(_0x8609('0x14'));var hardwareService=require(_0x8609('0x15'));var logger=require('../../config/logger')(_0x8609('0x16'));var utils=require(_0x8609('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8609('0x18'));var db=require(_0x8609('0x19'))['db'];var integrations=require(_0x8609('0x1a'));function respondWithStatusCode(_0x202a64,_0x4bb034){_0x4bb034=_0x4bb034||0xcc;return function(_0x1d055f){if(_0x1d055f){return _0x202a64[_0x8609('0x1b')](_0x4bb034);}return _0x202a64[_0x8609('0x1c')](_0x4bb034)[_0x8609('0x1d')]();};}function respondWithResult(_0x3f12c8,_0x2d4881){_0x2d4881=_0x2d4881||0xc8;return function(_0x4f4089){if(_0x4f4089){return _0x3f12c8[_0x8609('0x1c')](_0x2d4881)[_0x8609('0x1e')](_0x4f4089);}};}function respondWithFilteredResult(_0x22b5bf,_0x89f654){return function(_0x328900){if(_0x328900){var _0x1fa4d5=typeof _0x89f654[_0x8609('0x1f')]===_0x8609('0x20')&&typeof _0x89f654[_0x8609('0x21')]===_0x8609('0x20');var _0x6e12d3=_0x328900[_0x8609('0x22')];var _0x34906d=_0x1fa4d5?0x0:_0x89f654[_0x8609('0x1f')];var _0x4c8c96=_0x1fa4d5?_0x328900['count']:_0x89f654['offset']+_0x89f654[_0x8609('0x21')];var _0x5b59f9;if(_0x4c8c96>=_0x6e12d3){_0x4c8c96=_0x6e12d3;_0x5b59f9=0xc8;}else{_0x5b59f9=0xce;}_0x22b5bf[_0x8609('0x1c')](_0x5b59f9);return _0x22b5bf[_0x8609('0x23')](_0x8609('0x24'),_0x34906d+'-'+_0x4c8c96+'/'+_0x6e12d3)[_0x8609('0x1e')](_0x328900);}return null;};}function patchUpdates(_0x45ce89){return function(_0x59261b){try{jsonpatch[_0x8609('0x25')](_0x59261b,_0x45ce89,!![]);}catch(_0x118fe5){return BPromise[_0x8609('0x26')](_0x118fe5);}return _0x59261b[_0x8609('0x27')]();};}function saveUpdates(_0x24b6cc,_0x4a787d){return function(_0x40be1b){if(_0x40be1b){return _0x40be1b[_0x8609('0x28')](_0x24b6cc)[_0x8609('0x29')](function(_0x4d929f){return _0x4d929f;});}return null;};}function removeEntity(_0x183dc6,_0x5ec19a){return function(_0x448fc6){if(_0x448fc6){return _0x448fc6['destroy']()[_0x8609('0x29')](function(){_0x183dc6[_0x8609('0x1c')](0xcc)[_0x8609('0x1d')]();});}};}function handleEntityNotFound(_0x1ff45d,_0x5c1b7a){return function(_0x5abc34){if(!_0x5abc34){_0x1ff45d[_0x8609('0x1b')](0x194);}return _0x5abc34;};}function handleError(_0x3d7593,_0x8c3861){_0x8c3861=_0x8c3861||0x1f4;return function(_0x43b1e4){logger[_0x8609('0x2a')](_0x43b1e4[_0x8609('0x2b')]);if(_0x43b1e4[_0x8609('0x2c')]){delete _0x43b1e4[_0x8609('0x2c')];}_0x3d7593[_0x8609('0x1c')](_0x8c3861)[_0x8609('0x2d')](_0x43b1e4);};}exports['index']=function(_0x2bd896,_0xf049d0){var _0x36dbc8={},_0x5fccd={},_0x548903={'count':0x0,'rows':[]};var _0xf88323=_[_0x8609('0x2e')](db[_0x8609('0x2f')][_0x8609('0x30')],function(_0x9d1544){return{'name':_0x9d1544[_0x8609('0x31')],'type':_0x9d1544[_0x8609('0x32')][_0x8609('0x33')]};});_0x5fccd['model']=_[_0x8609('0x2e')](_0xf88323,_0x8609('0x2c'));_0x5fccd['query']=_[_0x8609('0x34')](_0x2bd896['query']);_0x5fccd[_0x8609('0x35')]=_[_0x8609('0x36')](_0x5fccd[_0x8609('0x37')],_0x5fccd['query']);_0x36dbc8[_0x8609('0x38')]=_['intersection'](_0x5fccd['model'],qs[_0x8609('0x39')](_0x2bd896[_0x8609('0x3a')]['fields']));_0x36dbc8[_0x8609('0x38')]=_0x36dbc8[_0x8609('0x38')][_0x8609('0x3b')]?_0x36dbc8[_0x8609('0x38')]:_0x5fccd[_0x8609('0x37')];if(!_0x2bd896[_0x8609('0x3a')][_0x8609('0x3c')](_0x8609('0x3d'))){_0x36dbc8[_0x8609('0x21')]=qs[_0x8609('0x21')](_0x2bd896['query'][_0x8609('0x21')]);_0x36dbc8[_0x8609('0x1f')]=qs[_0x8609('0x1f')](_0x2bd896['query'][_0x8609('0x1f')]);}_0x36dbc8[_0x8609('0x3e')]=qs[_0x8609('0x3f')](_0x2bd896[_0x8609('0x3a')][_0x8609('0x3f')]);_0x36dbc8[_0x8609('0x40')]=qs['filters'](_['pick'](_0x2bd896[_0x8609('0x3a')],_0x5fccd[_0x8609('0x35')]),_0xf88323);if(_0x2bd896['query'][_0x8609('0x41')]){_0x36dbc8['where']=_[_0x8609('0x42')](_0x36dbc8['where'],{'$or':_[_0x8609('0x2e')](_0xf88323,function(_0x51ad7b){if(_0x51ad7b[_0x8609('0x32')]!==_0x8609('0x43')){var _0x17d31c={};_0x17d31c[_0x51ad7b[_0x8609('0x2c')]]={'$like':'%'+_0x2bd896[_0x8609('0x3a')][_0x8609('0x41')]+'%'};return _0x17d31c;}})});}_0x36dbc8=_[_0x8609('0x42')]({},_0x36dbc8,_0x2bd896[_0x8609('0x44')]);var _0x4599df={'where':_0x36dbc8[_0x8609('0x40')]};return db['ServicenowAccount'][_0x8609('0x22')](_0x4599df)[_0x8609('0x29')](function(_0x54a304){_0x548903[_0x8609('0x22')]=_0x54a304;if(_0x2bd896['query'][_0x8609('0x45')]){_0x36dbc8[_0x8609('0x46')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x8609('0x47')](_0x36dbc8);})['then'](function(_0x37b7fb){_0x548903[_0x8609('0x48')]=_0x37b7fb;return _0x548903;})[_0x8609('0x29')](respondWithFilteredResult(_0xf049d0,_0x36dbc8))[_0x8609('0x49')](handleError(_0xf049d0,null));};exports[_0x8609('0x4a')]=function(_0x36bcbe,_0x3117de){var _0x4f0cad={'raw':![],'where':{'id':_0x36bcbe[_0x8609('0x4b')]['id']}},_0x18df0f={};_0x18df0f[_0x8609('0x37')]=_[_0x8609('0x34')](db[_0x8609('0x2f')][_0x8609('0x30')]);_0x18df0f[_0x8609('0x3a')]=_['keys'](_0x36bcbe['query']);_0x18df0f['filters']=_[_0x8609('0x36')](_0x18df0f[_0x8609('0x37')],_0x18df0f[_0x8609('0x3a')]);_0x4f0cad['attributes']=_['intersection'](_0x18df0f[_0x8609('0x37')],qs[_0x8609('0x39')](_0x36bcbe[_0x8609('0x3a')][_0x8609('0x39')]));_0x4f0cad[_0x8609('0x38')]=_0x4f0cad[_0x8609('0x38')][_0x8609('0x3b')]?_0x4f0cad[_0x8609('0x38')]:_0x18df0f['model'];if(_0x36bcbe[_0x8609('0x3a')]['includeAll']){_0x4f0cad[_0x8609('0x46')]=[{'all':!![]}];}_0x4f0cad=_['merge']({},_0x4f0cad,_0x36bcbe['options']);return db[_0x8609('0x2f')][_0x8609('0x4c')](_0x4f0cad)[_0x8609('0x29')](handleEntityNotFound(_0x3117de,null))[_0x8609('0x29')](respondWithResult(_0x3117de,null))['catch'](handleError(_0x3117de,null));};exports[_0x8609('0x4d')]=function(_0x245837,_0x2be52a){return db[_0x8609('0x2f')][_0x8609('0x4d')](_0x245837[_0x8609('0x4e')],{})['then'](respondWithResult(_0x2be52a,0xc9))['catch'](handleError(_0x2be52a,null));};exports[_0x8609('0x28')]=function(_0x245a2d,_0x3a3321){if(_0x245a2d[_0x8609('0x4e')]['id']){delete _0x245a2d['body']['id'];}return db['ServicenowAccount'][_0x8609('0x4c')]({'where':{'id':_0x245a2d[_0x8609('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a3321,null))[_0x8609('0x29')](saveUpdates(_0x245a2d['body'],null))[_0x8609('0x29')](respondWithResult(_0x3a3321,null))[_0x8609('0x49')](handleError(_0x3a3321,null));};exports[_0x8609('0x4f')]=function(_0x5fe08c,_0x4da080){return db[_0x8609('0x2f')]['find']({'where':{'id':_0x5fe08c['params']['id']}})['then'](handleEntityNotFound(_0x4da080,null))[_0x8609('0x29')](removeEntity(_0x4da080,null))[_0x8609('0x49')](handleError(_0x4da080,null));};exports['getConfigurations']=function(_0x225590,_0x406394,_0x99bb07){var _0x111e67={};var _0x16a9a0={};var _0xe21372;var _0x3eb54f;return db[_0x8609('0x2f')][_0x8609('0x50')]({'where':{'id':_0x225590['params']['id']}})[_0x8609('0x29')](handleEntityNotFound(_0x406394,null))[_0x8609('0x29')](function(_0x535e8d){if(_0x535e8d){_0xe21372=_0x535e8d;_0x16a9a0[_0x8609('0x37')]=_[_0x8609('0x34')](db[_0x8609('0x51')][_0x8609('0x30')]);_0x16a9a0[_0x8609('0x3a')]=_['keys'](_0x225590[_0x8609('0x3a')]);_0x16a9a0[_0x8609('0x35')]=_[_0x8609('0x36')](_0x16a9a0[_0x8609('0x37')],_0x16a9a0[_0x8609('0x3a')]);_0x111e67['attributes']=_[_0x8609('0x36')](_0x16a9a0[_0x8609('0x37')],qs[_0x8609('0x39')](_0x225590[_0x8609('0x3a')]['fields']));_0x111e67[_0x8609('0x38')]=_0x111e67[_0x8609('0x38')][_0x8609('0x3b')]?_0x111e67['attributes']:_0x16a9a0[_0x8609('0x37')];_0x111e67[_0x8609('0x3e')]=qs[_0x8609('0x3f')](_0x225590[_0x8609('0x3a')][_0x8609('0x3f')]);_0x111e67[_0x8609('0x40')]=qs['filters'](_['pick'](_0x225590['query'],_0x16a9a0['filters']));if(_0x225590[_0x8609('0x3a')][_0x8609('0x41')]){_0x111e67['where']=_[_0x8609('0x42')](_0x111e67[_0x8609('0x40')],{'$or':_[_0x8609('0x2e')](_0x111e67[_0x8609('0x38')],function(_0x9615f2){var _0x7e073d={};_0x7e073d[_0x9615f2]={'$like':'%'+_0x225590[_0x8609('0x3a')][_0x8609('0x41')]+'%'};return _0x7e073d;})});}_0x111e67=_['merge']({},_0x111e67,_0x225590[_0x8609('0x44')]);return _0xe21372[_0x8609('0x52')](_0x111e67);}})[_0x8609('0x29')](function(_0x4cbee6){if(_0x4cbee6){_0x3eb54f=_0x4cbee6['length'];if(!_0x225590['query'][_0x8609('0x3c')](_0x8609('0x3d'))){_0x111e67[_0x8609('0x21')]=qs['limit'](_0x225590[_0x8609('0x3a')]['limit']);_0x111e67[_0x8609('0x1f')]=qs[_0x8609('0x1f')](_0x225590[_0x8609('0x3a')][_0x8609('0x1f')]);}return _0xe21372[_0x8609('0x52')](_0x111e67);}})['then'](function(_0x244a67){if(_0x244a67){return _0x244a67?{'count':_0x3eb54f,'rows':_0x244a67}:null;}})['then'](respondWithResult(_0x406394,null))['catch'](handleError(_0x406394,null));};exports[_0x8609('0x53')]=function(_0x4d2362,_0x243fcd,_0x45f518){if(_0x4d2362[_0x8609('0x4e')]['id']){delete _0x4d2362[_0x8609('0x4e')]['id'];}return db[_0x8609('0x2f')][_0x8609('0x50')]({'where':{'id':_0x4d2362[_0x8609('0x4b')]['id']}})['then'](handleEntityNotFound(_0x243fcd,null))['then'](function(_0x88e664){if(_0x88e664){_0x4d2362[_0x8609('0x4e')][_0x8609('0x54')]=_0x88e664['id'];_0x4d2362['body']['Subjects']=integrations[_0x8609('0x55')](_0x4d2362[_0x8609('0x4e')][_0x8609('0x56')],_0x4d2362[_0x8609('0x4e')]['type']);_0x4d2362[_0x8609('0x4e')][_0x8609('0x57')]=integrations['getDescriptions'](_0x4d2362[_0x8609('0x4e')]['channel'],_0x4d2362[_0x8609('0x4e')][_0x8609('0x32')]);return db[_0x8609('0x51')][_0x8609('0x4d')](_0x4d2362[_0x8609('0x4e')],{'include':[{'model':db['ServicenowField'],'as':_0x8609('0x58')},{'model':db[_0x8609('0x59')],'as':_0x8609('0x57')}]});}return null;})[_0x8609('0x29')](respondWithResult(_0x243fcd,null))[_0x8609('0x49')](handleError(_0x243fcd,null));};exports['getFields']=function(_0x490de1,_0x56fdc1,_0x1eb5c3){var _0x35f5e2=['made_sla',_0x8609('0x5a'),_0x8609('0x5b'),_0x8609('0x5c'),_0x8609('0x5d'),_0x8609('0x5e'),'incident_state',_0x8609('0x5f'),_0x8609('0x60')];var _0x282653=['parent',_0x8609('0x61'),_0x8609('0x62'),_0x8609('0x63'),_0x8609('0x64'),_0x8609('0x65'),'child_incidents',_0x8609('0x5a'),'approval_history',_0x8609('0x66'),_0x8609('0x67'),_0x8609('0x68'),'opened_by','user_input',_0x8609('0x69'),'sys_domain',_0x8609('0x6a'),_0x8609('0x6b'),_0x8609('0x5b'),'order',_0x8609('0x6c'),_0x8609('0x6d'),_0x8609('0x6e'),_0x8609('0x6f'),_0x8609('0x70'),'active',_0x8609('0x71'),_0x8609('0x72'),_0x8609('0x73'),_0x8609('0x74'),_0x8609('0x75'),_0x8609('0x76'),_0x8609('0x77'),_0x8609('0x78'),_0x8609('0x79'),_0x8609('0x7a'),'work_end','reopened_time','resolved_at',_0x8609('0x7b'),_0x8609('0x7c'),'subcategory','work_notes',_0x8609('0x7d'),_0x8609('0x5d'),'correlation_display','delivery_task',_0x8609('0x7e'),_0x8609('0x7f'),_0x8609('0x80'),_0x8609('0x81'),_0x8609('0x82'),_0x8609('0x83'),_0x8609('0x5e'),'sys_class_name',_0x8609('0x84'),_0x8609('0x85'),_0x8609('0x86'),'parent_incident','sys_id',_0x8609('0x87'),_0x8609('0x88'),_0x8609('0x89'),'urgency',_0x8609('0x8a'),_0x8609('0x8b'),'reassignment_count',_0x8609('0x8c'),_0x8609('0x8d'),_0x8609('0x5f'),_0x8609('0x8e'),_0x8609('0x8f'),_0x8609('0x90'),_0x8609('0x91'),_0x8609('0x92'),_0x8609('0x93'),'reopen_count','sys_tags',_0x8609('0x94'),_0x8609('0x95'),'correlation_id',_0x8609('0x96'),_0x8609('0x60')];var _0x3cf35f='';var _0x245863='';var _0x9dd6f5=[];var _0x28fab9='';var _0x11f344='';var _0x33e3a0=[];var _0x4e518f='';var _0x361aaa='';var _0x4d1aae={};var _0x5a7d49='';return db[_0x8609('0x2f')]['findOne']({'where':{'id':_0x490de1[_0x8609('0x4b')]['id']},'attributes':['id',_0x8609('0x97'),_0x8609('0x98'),_0x8609('0x99'),_0x8609('0x9a'),_0x8609('0x9b')]})[_0x8609('0x29')](handleEntityNotFound(_0x56fdc1,null))[_0x8609('0x29')](function(_0x1c52ea){if(_0x1c52ea){_0x5a7d49=_0x1c52ea[_0x8609('0x9a')];var _0x4a42ba=_0x5a7d49[_0x8609('0x9c')](-0x1);if(_0x4a42ba==='/'){_0x5a7d49=_0x5a7d49['substring'](0x0,_0x5a7d49[_0x8609('0x9d')](_0x4a42ba));}_0x361aaa=util[_0x8609('0x9e')]('%s/api/now/doc/table/schema/',_0x5a7d49);_0x4e518f=util['format']('%s/api/now/table/',_0x5a7d49);_0x4d1aae={'user':_0x1c52ea[_0x8609('0x97')],'pass':_0x1c52ea[_0x8609('0x98')]};var _0x435a25={'method':_0x8609('0x9f'),'uri':_0x361aaa+'incident?sysparm_display_value=all','auth':_0x4d1aae,'json':!![]};return rp(_0x435a25);}})['then'](function(_0x368afb){if(_0x368afb[_0x8609('0xa0')][_0x8609('0x3b')]>0x0){_0x3cf35f=_0x368afb[_0x8609('0xa0')];}console[_0x8609('0xa1')](_0x8609('0xa2'),_0x3cf35f);_0x33e3a0=[];_0x245863=Object[_0x8609('0xa3')]([],_0x3cf35f);_[_0x8609('0xa4')](_0x245863,function(_0x18f5b0){return!_0x35f5e2['includes'](_0x18f5b0[_0x8609('0x2c')]);});_0x245863[_0x8609('0xa5')](function(_0x1bcecb){var _0x2dd786=createFieldObject(_0x4e518f,_0x4d1aae,_0x1bcecb['internalType'],_0x1bcecb[_0x8609('0x2c')],_0x1bcecb[_0x8609('0xa6')],![]);_0x33e3a0[_0x8609('0xa7')](_0x2dd786);});return Promise[_0x8609('0xa8')](_0x33e3a0);})[_0x8609('0x29')](function(_0x3aee8b){_0x9dd6f5=_0x3aee8b;_0x28fab9=Object[_0x8609('0xa3')]([],_0x3cf35f);console[_0x8609('0xa1')](_0x8609('0xa9'),_0x3cf35f);_[_0x8609('0xa4')](_0x28fab9,function(_0x3136ab){return _0x282653[_0x8609('0xaa')](_0x3136ab[_0x8609('0x2c')]);});console['log'](_0x8609('0xab'),_0x28fab9);_0x33e3a0=[];_0x28fab9[_0x8609('0xa5')](function(_0x31fe20){var _0x51fb29=createFieldObject(_0x4e518f,_0x4d1aae,_0x31fe20[_0x8609('0xac')],_0x31fe20['name'],_0x31fe20[_0x8609('0xa6')],!![]);_0x33e3a0[_0x8609('0xa7')](_0x51fb29);});return Promise[_0x8609('0xa8')](_0x33e3a0);})[_0x8609('0x29')](function(_0x543804){_0x11f344=_0x543804;var _0x434482=_0x9dd6f5[_0x8609('0xad')](_0x11f344);return{'count':_0x434482[_0x8609('0x3b')],'rows':_0x434482};})['then'](respondWithResult(_0x56fdc1,null))[_0x8609('0x49')](function(_0x580fbf){console[_0x8609('0xa1')]('ServiceNow\x20error:\x20'+_0x580fbf);var _0xe01898=_0x490de1['query'][_0x8609('0xae')]?0x1f4:_0x580fbf[_0x8609('0xaf')]||0x1f4;logger[_0x8609('0x2a')](_0x580fbf[_0x8609('0x2b')]);delete _0x580fbf[_0x8609('0x2c')];if(_0xe01898===0x191){_0xe01898=0x190;}_0x56fdc1[_0x8609('0x1c')](_0xe01898)[_0x8609('0x2d')](_0x490de1['query'][_0x8609('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x580fbf[_0x8609('0xaf')]}:_0x580fbf);});};function createFieldObject(_0x399590,_0xb5c5de,_0xdc752,_0x58105f,_0x3c3686,_0x30f01c){return new Promise(function(_0x4f503b,_0xdd906d){var _0xb5a6b2={'id':_0x58105f,'name':_0x3c3686,'custom':_0x30f01c};if(_0xdc752===_0x8609('0xb0')){_0xb5a6b2[_0x8609('0x44')]=[{'name':_0x8609('0xb1'),'value':_0x8609('0xb2')},{'name':_0x8609('0xb3'),'value':_0x8609('0xb4')}];_0x4f503b(_0xb5a6b2);}else{var _0x25c7f6={'method':_0x8609('0x9f'),'uri':_0x399590+_0x8609('0xb5')+_0x58105f,'auth':_0xb5c5de,'json':!![]};return rp(_0x25c7f6)[_0x8609('0x29')](function(_0x2fb75b){var _0xf9f6df=[];if(_0x2fb75b['result'][_0x8609('0x3b')]>0x0){_0x2fb75b[_0x8609('0xa0')][_0x8609('0xa5')](function(_0x363be2){if(_0x363be2[_0x8609('0xb6')]===_0x8609('0xb4')){var _0x3f7bbe={'name':_0x363be2[_0x8609('0xa6')],'value':_0x363be2[_0x8609('0xb7')]};_0xf9f6df[_0x8609('0xa7')](_0x3f7bbe);}});}_0xb5a6b2[_0x8609('0x44')]=_0xf9f6df;if(_0xb5a6b2[_0x8609('0x44')]['length']>0x0){_0x4f503b(_0xb5a6b2);}else{if(_0x30f01c==![]){_0x4f503b();}else{_0x4f503b(_0xb5a6b2);}}});}});} \ No newline at end of file +var _0x2b24=['show','params','fields','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','delivery_plan','impact','work_notes_list','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','incident_state','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','correlation_id','location','username','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','False','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','false','value','push','eml-format','zip-dir','moment','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','map','ServicenowAccount','rawAttributes','type','name','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0x56a2ee,_0x445a03){var _0x267c95=function(_0x37cae9){while(--_0x37cae9){_0x56a2ee['push'](_0x56a2ee['shift']());}};_0x267c95(++_0x445a03);}(_0x2b24,0x1dc));var _0x42b2=function(_0x3f21bf,_0x132682){_0x3f21bf=_0x3f21bf-0x0;var _0x9761a1=_0x2b24[_0x3f21bf];return _0x9761a1;};'use strict';var emlformat=require(_0x42b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42b2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x42b2('0x3'));var util=require('util');var path=require(_0x42b2('0x4'));var sox=require(_0x42b2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42b2('0x6'));var squel=require(_0x42b2('0x7'));var crypto=require(_0x42b2('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42b2('0x9'));var querystring=require(_0x42b2('0xa'));var Papa=require(_0x42b2('0xb'));var Redis=require(_0x42b2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x42b2('0xd'));var as=require(_0x42b2('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x42b2('0xf'));var utils=require(_0x42b2('0x10'));var config=require(_0x42b2('0x11'));var licenseUtil=require(_0x42b2('0x12'));var db=require(_0x42b2('0x13'))['db'];var integrations=require(_0x42b2('0x14'));function respondWithStatusCode(_0x2a38aa,_0x419768){_0x419768=_0x419768||0xcc;return function(_0xcfd546){if(_0xcfd546){return _0x2a38aa[_0x42b2('0x15')](_0x419768);}return _0x2a38aa['status'](_0x419768)[_0x42b2('0x16')]();};}function respondWithResult(_0x34d762,_0x27ca63){_0x27ca63=_0x27ca63||0xc8;return function(_0x215fb2){if(_0x215fb2){return _0x34d762[_0x42b2('0x17')](_0x27ca63)[_0x42b2('0x18')](_0x215fb2);}};}function respondWithFilteredResult(_0x22961c,_0x244bf5){return function(_0x2179f1){if(_0x2179f1){var _0x381dab=typeof _0x244bf5[_0x42b2('0x19')]===_0x42b2('0x1a')&&typeof _0x244bf5['limit']===_0x42b2('0x1a');var _0x1fb8f8=_0x2179f1['count'];var _0x3867ce=_0x381dab?0x0:_0x244bf5[_0x42b2('0x19')];var _0x556e86=_0x381dab?_0x2179f1[_0x42b2('0x1b')]:_0x244bf5['offset']+_0x244bf5[_0x42b2('0x1c')];var _0x40b371;if(_0x556e86>=_0x1fb8f8){_0x556e86=_0x1fb8f8;_0x40b371=0xc8;}else{_0x40b371=0xce;}_0x22961c[_0x42b2('0x17')](_0x40b371);return _0x22961c[_0x42b2('0x1d')](_0x42b2('0x1e'),_0x3867ce+'-'+_0x556e86+'/'+_0x1fb8f8)['json'](_0x2179f1);}return null;};}function patchUpdates(_0x3f3e51){return function(_0x1d16d8){try{jsonpatch[_0x42b2('0x1f')](_0x1d16d8,_0x3f3e51,!![]);}catch(_0x357c74){return BPromise[_0x42b2('0x20')](_0x357c74);}return _0x1d16d8[_0x42b2('0x21')]();};}function saveUpdates(_0x41dafd,_0x31ebe3){return function(_0x35c62e){if(_0x35c62e){return _0x35c62e['update'](_0x41dafd)[_0x42b2('0x22')](function(_0x28c3e1){return _0x28c3e1;});}return null;};}function removeEntity(_0x16eac3,_0x2df11e){return function(_0x1c4365){if(_0x1c4365){return _0x1c4365[_0x42b2('0x23')]()[_0x42b2('0x22')](function(){_0x16eac3['status'](0xcc)[_0x42b2('0x16')]();});}};}function handleEntityNotFound(_0x1491dc,_0x26cff6){return function(_0x37f37b){if(!_0x37f37b){_0x1491dc['sendStatus'](0x194);}return _0x37f37b;};}function handleError(_0xe6db15,_0x371f15){_0x371f15=_0x371f15||0x1f4;return function(_0x2fae29){logger[_0x42b2('0x24')](_0x2fae29[_0x42b2('0x25')]);if(_0x2fae29['name']){delete _0x2fae29['name'];}_0xe6db15[_0x42b2('0x17')](_0x371f15)[_0x42b2('0x26')](_0x2fae29);};}exports[_0x42b2('0x27')]=function(_0x55216d,_0x2c61fe){var _0x2a794e={},_0x4ae6f7={},_0x3c1e65={'count':0x0,'rows':[]};var _0x5a3eae=_[_0x42b2('0x28')](db[_0x42b2('0x29')][_0x42b2('0x2a')],function(_0x461a15){return{'name':_0x461a15['fieldName'],'type':_0x461a15[_0x42b2('0x2b')]['key']};});_0x4ae6f7['model']=_['map'](_0x5a3eae,_0x42b2('0x2c'));_0x4ae6f7['query']=_[_0x42b2('0x2d')](_0x55216d[_0x42b2('0x2e')]);_0x4ae6f7[_0x42b2('0x2f')]=_[_0x42b2('0x30')](_0x4ae6f7[_0x42b2('0x31')],_0x4ae6f7[_0x42b2('0x2e')]);_0x2a794e[_0x42b2('0x32')]=_[_0x42b2('0x30')](_0x4ae6f7['model'],qs['fields'](_0x55216d[_0x42b2('0x2e')]['fields']));_0x2a794e[_0x42b2('0x32')]=_0x2a794e[_0x42b2('0x32')][_0x42b2('0x33')]?_0x2a794e[_0x42b2('0x32')]:_0x4ae6f7[_0x42b2('0x31')];if(!_0x55216d[_0x42b2('0x2e')][_0x42b2('0x34')]('nolimit')){_0x2a794e['limit']=qs[_0x42b2('0x1c')](_0x55216d[_0x42b2('0x2e')][_0x42b2('0x1c')]);_0x2a794e[_0x42b2('0x19')]=qs['offset'](_0x55216d[_0x42b2('0x2e')][_0x42b2('0x19')]);}_0x2a794e[_0x42b2('0x35')]=qs['sort'](_0x55216d[_0x42b2('0x2e')][_0x42b2('0x36')]);_0x2a794e[_0x42b2('0x37')]=qs['filters'](_[_0x42b2('0x38')](_0x55216d[_0x42b2('0x2e')],_0x4ae6f7[_0x42b2('0x2f')]),_0x5a3eae);if(_0x55216d['query'][_0x42b2('0x39')]){_0x2a794e['where']=_[_0x42b2('0x3a')](_0x2a794e[_0x42b2('0x37')],{'$or':_[_0x42b2('0x28')](_0x5a3eae,function(_0x52ce0b){if(_0x52ce0b[_0x42b2('0x2b')]!==_0x42b2('0x3b')){var _0x19cf61={};_0x19cf61[_0x52ce0b[_0x42b2('0x2c')]]={'$like':'%'+_0x55216d['query'][_0x42b2('0x39')]+'%'};return _0x19cf61;}})});}_0x2a794e=_['merge']({},_0x2a794e,_0x55216d[_0x42b2('0x3c')]);var _0x3bbe60={'where':_0x2a794e[_0x42b2('0x37')]};return db[_0x42b2('0x29')][_0x42b2('0x1b')](_0x3bbe60)[_0x42b2('0x22')](function(_0x605edb){_0x3c1e65[_0x42b2('0x1b')]=_0x605edb;if(_0x55216d[_0x42b2('0x2e')][_0x42b2('0x3d')]){_0x2a794e[_0x42b2('0x3e')]=[{'all':!![]}];}return db[_0x42b2('0x29')]['findAll'](_0x2a794e);})[_0x42b2('0x22')](function(_0x440c9a){_0x3c1e65['rows']=_0x440c9a;return _0x3c1e65;})[_0x42b2('0x22')](respondWithFilteredResult(_0x2c61fe,_0x2a794e))[_0x42b2('0x3f')](handleError(_0x2c61fe,null));};exports[_0x42b2('0x40')]=function(_0x49ae5b,_0x1ce1db){var _0x45a467={'raw':![],'where':{'id':_0x49ae5b[_0x42b2('0x41')]['id']}},_0x13cc73={};_0x13cc73[_0x42b2('0x31')]=_[_0x42b2('0x2d')](db[_0x42b2('0x29')][_0x42b2('0x2a')]);_0x13cc73[_0x42b2('0x2e')]=_['keys'](_0x49ae5b[_0x42b2('0x2e')]);_0x13cc73[_0x42b2('0x2f')]=_[_0x42b2('0x30')](_0x13cc73[_0x42b2('0x31')],_0x13cc73[_0x42b2('0x2e')]);_0x45a467[_0x42b2('0x32')]=_[_0x42b2('0x30')](_0x13cc73[_0x42b2('0x31')],qs[_0x42b2('0x42')](_0x49ae5b[_0x42b2('0x2e')]['fields']));_0x45a467[_0x42b2('0x32')]=_0x45a467[_0x42b2('0x32')]['length']?_0x45a467[_0x42b2('0x32')]:_0x13cc73[_0x42b2('0x31')];if(_0x49ae5b['query'][_0x42b2('0x3d')]){_0x45a467[_0x42b2('0x3e')]=[{'all':!![]}];}_0x45a467=_[_0x42b2('0x3a')]({},_0x45a467,_0x49ae5b[_0x42b2('0x3c')]);return db[_0x42b2('0x29')][_0x42b2('0x43')](_0x45a467)[_0x42b2('0x22')](handleEntityNotFound(_0x1ce1db,null))[_0x42b2('0x22')](respondWithResult(_0x1ce1db,null))['catch'](handleError(_0x1ce1db,null));};exports[_0x42b2('0x44')]=function(_0x1306a2,_0x4a440a){return db[_0x42b2('0x29')][_0x42b2('0x44')](_0x1306a2[_0x42b2('0x45')],{})[_0x42b2('0x22')](respondWithResult(_0x4a440a,0xc9))[_0x42b2('0x3f')](handleError(_0x4a440a,null));};exports[_0x42b2('0x46')]=function(_0x317681,_0x541f7b){if(_0x317681[_0x42b2('0x45')]['id']){delete _0x317681[_0x42b2('0x45')]['id'];}return db[_0x42b2('0x29')]['find']({'where':{'id':_0x317681[_0x42b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x541f7b,null))['then'](saveUpdates(_0x317681[_0x42b2('0x45')],null))[_0x42b2('0x22')](respondWithResult(_0x541f7b,null))['catch'](handleError(_0x541f7b,null));};exports[_0x42b2('0x23')]=function(_0x4c2303,_0x122712){return db[_0x42b2('0x29')][_0x42b2('0x43')]({'where':{'id':_0x4c2303[_0x42b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x122712,null))[_0x42b2('0x22')](removeEntity(_0x122712,null))[_0x42b2('0x3f')](handleError(_0x122712,null));};exports[_0x42b2('0x47')]=function(_0x14bce2,_0x51d6d0,_0x42976d){var _0x1577e7={};var _0x4d9e87={};var _0x40082d;var _0x2f8651;return db[_0x42b2('0x29')][_0x42b2('0x48')]({'where':{'id':_0x14bce2[_0x42b2('0x41')]['id']}})[_0x42b2('0x22')](handleEntityNotFound(_0x51d6d0,null))['then'](function(_0x378ecf){if(_0x378ecf){_0x40082d=_0x378ecf;_0x4d9e87[_0x42b2('0x31')]=_['keys'](db[_0x42b2('0x49')][_0x42b2('0x2a')]);_0x4d9e87[_0x42b2('0x2e')]=_[_0x42b2('0x2d')](_0x14bce2[_0x42b2('0x2e')]);_0x4d9e87[_0x42b2('0x2f')]=_['intersection'](_0x4d9e87[_0x42b2('0x31')],_0x4d9e87['query']);_0x1577e7[_0x42b2('0x32')]=_[_0x42b2('0x30')](_0x4d9e87['model'],qs[_0x42b2('0x42')](_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x42')]));_0x1577e7[_0x42b2('0x32')]=_0x1577e7[_0x42b2('0x32')][_0x42b2('0x33')]?_0x1577e7[_0x42b2('0x32')]:_0x4d9e87[_0x42b2('0x31')];_0x1577e7['order']=qs[_0x42b2('0x36')](_0x14bce2['query'][_0x42b2('0x36')]);_0x1577e7[_0x42b2('0x37')]=qs[_0x42b2('0x2f')](_['pick'](_0x14bce2[_0x42b2('0x2e')],_0x4d9e87[_0x42b2('0x2f')]));if(_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x39')]){_0x1577e7['where']=_[_0x42b2('0x3a')](_0x1577e7['where'],{'$or':_[_0x42b2('0x28')](_0x1577e7['attributes'],function(_0x1ba431){var _0x370621={};_0x370621[_0x1ba431]={'$like':'%'+_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x39')]+'%'};return _0x370621;})});}_0x1577e7=_[_0x42b2('0x3a')]({},_0x1577e7,_0x14bce2[_0x42b2('0x3c')]);return _0x40082d[_0x42b2('0x47')](_0x1577e7);}})[_0x42b2('0x22')](function(_0x30d788){if(_0x30d788){_0x2f8651=_0x30d788[_0x42b2('0x33')];if(!_0x14bce2[_0x42b2('0x2e')]['hasOwnProperty'](_0x42b2('0x4a'))){_0x1577e7[_0x42b2('0x1c')]=qs[_0x42b2('0x1c')](_0x14bce2[_0x42b2('0x2e')][_0x42b2('0x1c')]);_0x1577e7[_0x42b2('0x19')]=qs[_0x42b2('0x19')](_0x14bce2['query']['offset']);}return _0x40082d[_0x42b2('0x47')](_0x1577e7);}})[_0x42b2('0x22')](function(_0x1cd44b){if(_0x1cd44b){return _0x1cd44b?{'count':_0x2f8651,'rows':_0x1cd44b}:null;}})['then'](respondWithResult(_0x51d6d0,null))[_0x42b2('0x3f')](handleError(_0x51d6d0,null));};exports[_0x42b2('0x4b')]=function(_0x16b367,_0x2e549b,_0xe3b39f){if(_0x16b367[_0x42b2('0x45')]['id']){delete _0x16b367[_0x42b2('0x45')]['id'];}return db[_0x42b2('0x29')][_0x42b2('0x48')]({'where':{'id':_0x16b367['params']['id']}})[_0x42b2('0x22')](handleEntityNotFound(_0x2e549b,null))[_0x42b2('0x22')](function(_0x4b2dd8){if(_0x4b2dd8){_0x16b367[_0x42b2('0x45')][_0x42b2('0x4c')]=_0x4b2dd8['id'];_0x16b367[_0x42b2('0x45')]['Subjects']=integrations[_0x42b2('0x4d')](_0x16b367[_0x42b2('0x45')]['channel'],_0x16b367[_0x42b2('0x45')]['type']);_0x16b367[_0x42b2('0x45')]['Descriptions']=integrations['getDescriptions'](_0x16b367[_0x42b2('0x45')][_0x42b2('0x4e')],_0x16b367[_0x42b2('0x45')][_0x42b2('0x2b')]);return db[_0x42b2('0x49')]['create'](_0x16b367[_0x42b2('0x45')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x42b2('0x4f')],'as':_0x42b2('0x50')}]});}return null;})[_0x42b2('0x22')](respondWithResult(_0x2e549b,null))[_0x42b2('0x3f')](handleError(_0x2e549b,null));};exports[_0x42b2('0x51')]=function(_0x4049ee,_0x173885,_0x4319e9){var _0xfbb7b7=[_0x42b2('0x52'),_0x42b2('0x53'),_0x42b2('0x54'),_0x42b2('0x55'),_0x42b2('0x56'),'notify','incident_state',_0x42b2('0x57'),_0x42b2('0x58')];var _0x2935f4=['parent',_0x42b2('0x52'),_0x42b2('0x59'),_0x42b2('0x5a'),_0x42b2('0x5b'),_0x42b2('0x5c'),_0x42b2('0x5d'),_0x42b2('0x53'),_0x42b2('0x5e'),_0x42b2('0x5f'),_0x42b2('0x60'),'sys_updated_by',_0x42b2('0x61'),_0x42b2('0x62'),'sys_created_on',_0x42b2('0x63'),_0x42b2('0x64'),_0x42b2('0x65'),_0x42b2('0x54'),'order','calendar_stc','closed_at','cmdb_ci',_0x42b2('0x66'),_0x42b2('0x67'),'active',_0x42b2('0x68'),'business_service','priority',_0x42b2('0x69'),_0x42b2('0x6a'),_0x42b2('0x6b'),_0x42b2('0x6c'),_0x42b2('0x6d'),_0x42b2('0x6e'),'group_list',_0x42b2('0x6f'),'reopened_time',_0x42b2('0x70'),_0x42b2('0x71'),_0x42b2('0x72'),'subcategory',_0x42b2('0x73'),_0x42b2('0x74'),_0x42b2('0x56'),_0x42b2('0x75'),_0x42b2('0x76'),_0x42b2('0x77'),_0x42b2('0x78'),'business_stc',_0x42b2('0x79'),_0x42b2('0x7a'),_0x42b2('0x7b'),'notify',_0x42b2('0x7c'),_0x42b2('0x7d'),'closed_by',_0x42b2('0x7e'),_0x42b2('0x7f'),_0x42b2('0x80'),_0x42b2('0x81'),'reopened_by',_0x42b2('0x82'),'urgency',_0x42b2('0x83'),_0x42b2('0x84'),_0x42b2('0x85'),_0x42b2('0x86'),'assigned_to','severity',_0x42b2('0x87'),_0x42b2('0x88'),_0x42b2('0x89'),_0x42b2('0x8a'),_0x42b2('0x8b'),_0x42b2('0x8c'),_0x42b2('0x8d'),_0x42b2('0x8e'),'escalation','upon_approval',_0x42b2('0x8f'),_0x42b2('0x90'),'category'];var _0x70a427='';var _0xb78ff4='';var _0x550870=[];var _0x46ebc8='';var _0x45ce26='';var _0x173ea2=[];var _0x1818f8='';var _0x27dcaa='';var _0x40e0f2={};var _0x1f7172='';return db[_0x42b2('0x29')][_0x42b2('0x48')]({'where':{'id':_0x4049ee[_0x42b2('0x41')]['id']},'attributes':['id',_0x42b2('0x91'),_0x42b2('0x92'),_0x42b2('0x93'),_0x42b2('0x94'),_0x42b2('0x95')]})[_0x42b2('0x22')](handleEntityNotFound(_0x173885,null))[_0x42b2('0x22')](function(_0x1a102d){if(_0x1a102d){_0x1f7172=_0x1a102d['remoteUri'];var _0x2bb93a=_0x1f7172['slice'](-0x1);if(_0x2bb93a==='/'){_0x1f7172=_0x1f7172['substring'](0x0,_0x1f7172[_0x42b2('0x96')](_0x2bb93a));}_0x27dcaa=util[_0x42b2('0x97')](_0x42b2('0x98'),_0x1f7172);_0x1818f8=util[_0x42b2('0x97')](_0x42b2('0x99'),_0x1f7172);_0x40e0f2={'user':_0x1a102d[_0x42b2('0x91')],'pass':_0x1a102d[_0x42b2('0x92')]};var _0x3bc3f7={'method':_0x42b2('0x9a'),'uri':_0x27dcaa+_0x42b2('0x9b'),'auth':_0x40e0f2,'json':!![]};return rp(_0x3bc3f7);}})[_0x42b2('0x22')](function(_0x3a0343){if(_0x3a0343[_0x42b2('0x9c')][_0x42b2('0x33')]>0x0){_0x70a427=_0x3a0343[_0x42b2('0x9c')];}console[_0x42b2('0x9d')](_0x42b2('0x9e'),_0x70a427);_0x173ea2=[];_0xb78ff4=Object[_0x42b2('0x9f')]([],_0x70a427);_[_0x42b2('0xa0')](_0xb78ff4,function(_0x1743bd){return!_0xfbb7b7[_0x42b2('0xa1')](_0x1743bd['name']);});_0xb78ff4['forEach'](function(_0x1038de){var _0x1dc98c=createFieldObject(_0x1818f8,_0x40e0f2,_0x1038de[_0x42b2('0xa2')],_0x1038de[_0x42b2('0x2c')],_0x1038de[_0x42b2('0xa3')],![]);_0x173ea2['push'](_0x1dc98c);});return Promise['all'](_0x173ea2);})[_0x42b2('0x22')](function(_0x373bf0){_0x550870=_0x373bf0;_0x46ebc8=Object[_0x42b2('0x9f')]([],_0x70a427);console[_0x42b2('0x9d')](_0x42b2('0xa4'),_0x70a427);_[_0x42b2('0xa0')](_0x46ebc8,function(_0x220e1d){return _0x2935f4[_0x42b2('0xa1')](_0x220e1d['name']);});console['log'](_0x42b2('0xa5'),_0x46ebc8);_0x173ea2=[];_0x46ebc8['forEach'](function(_0x4395d9){var _0x9a7e3c=createFieldObject(_0x1818f8,_0x40e0f2,_0x4395d9['internalType'],_0x4395d9[_0x42b2('0x2c')],_0x4395d9[_0x42b2('0xa3')],!![]);_0x173ea2['push'](_0x9a7e3c);});return Promise[_0x42b2('0xa6')](_0x173ea2);})[_0x42b2('0x22')](function(_0x45a82){_0x45ce26=_0x45a82;var _0x5e018c=_0x550870[_0x42b2('0xa7')](_0x45ce26);return{'count':_0x5e018c[_0x42b2('0x33')],'rows':_0x5e018c};})[_0x42b2('0x22')](respondWithResult(_0x173885,null))[_0x42b2('0x3f')](function(_0x4ef211){console[_0x42b2('0x9d')](_0x42b2('0xa8')+_0x4ef211);var _0x58ccf4=_0x4049ee[_0x42b2('0x2e')][_0x42b2('0xa9')]?0x1f4:_0x4ef211['statusCode']||0x1f4;logger[_0x42b2('0x24')](_0x4ef211['stack']);delete _0x4ef211['name'];if(_0x58ccf4===0x191){_0x58ccf4=0x190;}_0x173885['status'](_0x58ccf4)[_0x42b2('0x26')](_0x4049ee[_0x42b2('0x2e')][_0x42b2('0xa9')]?{'message':_0x42b2('0xaa'),'statusCode':_0x4ef211[_0x42b2('0xab')]}:_0x4ef211);});};function createFieldObject(_0x392c78,_0x10c10a,_0x3ac84d,_0x52f60b,_0x32855e,_0x361cd1){return new Promise(function(_0x4f23f7,_0x3ed49b){var _0x399a27={'id':_0x52f60b,'name':_0x32855e,'custom':_0x361cd1};if(_0x3ac84d==='boolean'){_0x399a27[_0x42b2('0x3c')]=[{'name':_0x42b2('0xac'),'value':'true'},{'name':_0x42b2('0xad'),'value':'false'}];_0x4f23f7(_0x399a27);}else{var _0x4c8a4b={'method':_0x42b2('0x9a'),'uri':_0x392c78+_0x42b2('0xae')+_0x52f60b,'auth':_0x10c10a,'json':!![]};return rp(_0x4c8a4b)['then'](function(_0x5f26f6){var _0x4c5887=[];if(_0x5f26f6[_0x42b2('0x9c')][_0x42b2('0x33')]>0x0){_0x5f26f6['result'][_0x42b2('0xaf')](function(_0x312b3e){if(_0x312b3e[_0x42b2('0xb0')]===_0x42b2('0xb1')){var _0x42df22={'name':_0x312b3e[_0x42b2('0xa3')],'value':_0x312b3e[_0x42b2('0xb2')]};_0x4c5887[_0x42b2('0xb3')](_0x42df22);}});}_0x399a27['options']=_0x4c5887;if(_0x399a27[_0x42b2('0x3c')][_0x42b2('0x33')]>0x0){_0x4f23f7(_0x399a27);}else{if(_0x361cd1==![]){_0x4f23f7();}else{_0x4f23f7(_0x399a27);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6701696..99c1b65 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 _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x4da09f,_0x3db34c){var _0x33462f=function(_0x42e3a0){while(--_0x42e3a0){_0x4da09f['push'](_0x4da09f['shift']());}};_0x33462f(++_0x3db34c);}(_0xba34,0x119));var _0x4ba3=function(_0x86533d,_0x152f33){_0x86533d=_0x86533d-0x0;var _0x2ff036=_0xba34[_0x86533d];return _0x2ff036;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','moment','bluebird'];(function(_0x30fde3,_0x69fd6){var _0x45703f=function(_0x470c4e){while(--_0x470c4e){_0x30fde3['push'](_0x30fde3['shift']());}};_0x45703f(++_0x69fd6);}(_0x2675,0x75));var _0x5267=function(_0x96455d,_0x4a3ea1){_0x96455d=_0x96455d-0x0;var _0x55555f=_0x2675[_0x96455d];return _0x55555f;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));var integrations=require(_0x5267('0x6'));module[_0x5267('0x7')]=function(_0x10f92c,_0x20f065){return _0x10f92c[_0x5267('0x8')]('ServicenowAccount',attributes,{'tableName':_0x5267('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7819d7a..65ef9da 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 _0x2f74=['catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','ShowServicenowAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x47137d,_0x484202){var _0x38a5f9=function(_0x29e326){while(--_0x29e326){_0x47137d['push'](_0x47137d['shift']());}};_0x38a5f9(++_0x484202);}(_0x2f74,0x7b));var _0x42f7=function(_0x1db29a,_0x5263e6){_0x1db29a=_0x1db29a-0x0;var _0x53525b=_0x2f74[_0x1db29a];return _0x53525b;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var moment=require(_0x42f7('0x1'));var BPromise=require(_0x42f7('0x2'));var rs=require(_0x42f7('0x3'));var fs=require('fs');var Redis=require(_0x42f7('0x4'));var db=require(_0x42f7('0x5'))['db'];var utils=require(_0x42f7('0x6'));var logger=require(_0x42f7('0x7'))(_0x42f7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x42f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cb6e0,_0x20ff46,_0x36b55e){return new BPromise(function(_0x2c64b2,_0x28fc83){return client[_0x42f7('0xa')](_0x1cb6e0,_0x36b55e)[_0x42f7('0xb')](function(_0x5772a8){logger[_0x42f7('0xc')](_0x42f7('0xd'),_0x20ff46,_0x42f7('0xe'));logger[_0x42f7('0xf')](_0x42f7('0x10'),_0x20ff46,_0x42f7('0xe'),JSON['stringify'](_0x5772a8));if(_0x5772a8[_0x42f7('0x11')]){if(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x12')]===0x1f4){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x28fc83(_0x5772a8[_0x42f7('0x11')]['message']);}logger['error'](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x2c64b2(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);}else{logger['info'](_0x42f7('0xd'),_0x20ff46,'request\x20sent');_0x2c64b2(_0x5772a8[_0x42f7('0x14')][_0x42f7('0x13')]);}})[_0x42f7('0x15')](function(_0x19eff3){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x19eff3);_0x28fc83(_0x19eff3);});});}exports[_0x42f7('0x16')]=function(_0x47aa1d){var _0x3fc38d=this;return new Promise(function(_0x29f472,_0x43ef57){return db[_0x42f7('0x17')][_0x42f7('0x18')]({'raw':_0x47aa1d[_0x42f7('0x19')]?_0x47aa1d['options'][_0x42f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x47aa1d['options']?_0x47aa1d[_0x42f7('0x19')]['where']||null:null,'attributes':_0x47aa1d[_0x42f7('0x19')]?_0x47aa1d['options']['attributes']||null:null,'limit':_0x47aa1d['options']?_0x47aa1d[_0x42f7('0x19')][_0x42f7('0x1b')]||null:null,'include':_0x47aa1d[_0x42f7('0x19')]?_0x47aa1d[_0x42f7('0x19')][_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x47aa1d[_0x42f7('0x19')][_0x42f7('0x1c')],function(_0x1d45a0){return{'model':db[_0x1d45a0[_0x42f7('0x1e')]],'as':_0x1d45a0['as'],'attributes':_0x1d45a0[_0x42f7('0x1f')],'include':_0x1d45a0[_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x1d45a0[_0x42f7('0x1c')],function(_0x553531){return{'model':db[_0x553531['model']],'as':_0x553531['as'],'attributes':_0x553531[_0x42f7('0x1f')],'include':_0x553531[_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x553531[_0x42f7('0x1c')],function(_0x1e31de){return{'model':db[_0x1e31de[_0x42f7('0x1e')]],'as':_0x1e31de['as'],'attributes':_0x1e31de[_0x42f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x42f7('0xb')](function(_0xe53027){logger[_0x42f7('0xc')]('GetServicenowAccount',_0x47aa1d);logger['debug'](_0x42f7('0x16'),_0x47aa1d,JSON[_0x42f7('0x20')](_0xe53027));_0x29f472(_0xe53027);})[_0x42f7('0x15')](function(_0x4d7137){logger[_0x42f7('0x11')](_0x42f7('0x16'),_0x4d7137['message'],_0x47aa1d);_0x43ef57(_0x3fc38d['error'](0x1f4,_0x4d7137[_0x42f7('0x13')]));});});};exports[_0x42f7('0x21')]=function(_0x210054){var _0xf6664c=this;return new Promise(function(_0x1e245c,_0x3a07b8){return db[_0x42f7('0x17')][_0x42f7('0x22')]({'raw':_0x210054[_0x42f7('0x19')]?_0x210054['options'][_0x42f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x210054[_0x42f7('0x19')]?_0x210054[_0x42f7('0x19')][_0x42f7('0x23')]||null:null,'attributes':_0x210054[_0x42f7('0x19')]?_0x210054['options'][_0x42f7('0x1f')]||null:null,'include':_0x210054[_0x42f7('0x19')]?_0x210054[_0x42f7('0x19')][_0x42f7('0x1c')]?_['map'](_0x210054[_0x42f7('0x19')]['include'],function(_0x25007e){return{'model':db[_0x25007e[_0x42f7('0x1e')]],'as':_0x25007e['as'],'attributes':_0x25007e[_0x42f7('0x1f')],'include':_0x25007e[_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x25007e[_0x42f7('0x1c')],function(_0x372a20){return{'model':db[_0x372a20['model']],'as':_0x372a20['as'],'attributes':_0x372a20['attributes'],'include':_0x372a20[_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x372a20['include'],function(_0x33164e){return{'model':db[_0x33164e['model']],'as':_0x33164e['as'],'attributes':_0x33164e[_0x42f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x42f7('0xb')](function(_0x568d25){logger['info']('ShowServicenowAccount',_0x210054);logger[_0x42f7('0xf')]('ShowServicenowAccount',_0x210054,JSON[_0x42f7('0x20')](_0x568d25));_0x1e245c(_0x568d25);})[_0x42f7('0x15')](function(_0x44ec4b){logger[_0x42f7('0x11')](_0x42f7('0x21'),_0x44ec4b['message'],_0x210054);_0x3a07b8(_0xf6664c[_0x42f7('0x11')](0x1f4,_0x44ec4b[_0x42f7('0x13')]));});});}; \ No newline at end of file +var _0x8ca0=['model','attributes','GetServicenowAccount','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','ServicenowAccount','findAll','options','raw','limit','include','map'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8ca0,0x141));var _0x08ca=function(_0x56558c,_0x559a88){_0x56558c=_0x56558c-0x0;var _0x756da7=_0x8ca0[_0x56558c];return _0x756da7;};'use strict';var _=require(_0x08ca('0x0'));var util=require(_0x08ca('0x1'));var moment=require(_0x08ca('0x2'));var BPromise=require(_0x08ca('0x3'));var rs=require(_0x08ca('0x4'));var fs=require('fs');var Redis=require(_0x08ca('0x5'));var db=require(_0x08ca('0x6'))['db'];var utils=require(_0x08ca('0x7'));var logger=require('../../config/logger')(_0x08ca('0x8'));var config=require(_0x08ca('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08ca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f54e9,_0x2aef5d,_0x2ad0c3){return new BPromise(function(_0x5cb023,_0x58aa4d){return client[_0x08ca('0xb')](_0x1f54e9,_0x2ad0c3)[_0x08ca('0xc')](function(_0x30c945){logger['info'](_0x08ca('0xd'),_0x2aef5d,_0x08ca('0xe'));logger[_0x08ca('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2aef5d,_0x08ca('0xe'),JSON[_0x08ca('0x10')](_0x30c945));if(_0x30c945[_0x08ca('0x11')]){if(_0x30c945[_0x08ca('0x11')]['code']===0x1f4){logger[_0x08ca('0x11')](_0x08ca('0xd'),_0x2aef5d,_0x30c945[_0x08ca('0x11')]['message']);return _0x58aa4d(_0x30c945['error']['message']);}logger[_0x08ca('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2aef5d,_0x30c945[_0x08ca('0x11')][_0x08ca('0x12')]);return _0x5cb023(_0x30c945[_0x08ca('0x11')][_0x08ca('0x12')]);}else{logger[_0x08ca('0x13')](_0x08ca('0xd'),_0x2aef5d,_0x08ca('0xe'));_0x5cb023(_0x30c945[_0x08ca('0x14')][_0x08ca('0x12')]);}})[_0x08ca('0x15')](function(_0x1c8fb2){logger['error'](_0x08ca('0xd'),_0x2aef5d,_0x1c8fb2);_0x58aa4d(_0x1c8fb2);});});}exports['GetServicenowAccount']=function(_0x2bf322){var _0x1048b2=this;return new Promise(function(_0x300486,_0x1917d7){return db[_0x08ca('0x16')][_0x08ca('0x17')]({'raw':_0x2bf322[_0x08ca('0x18')]?_0x2bf322[_0x08ca('0x18')][_0x08ca('0x19')]===undefined?!![]:![]:!![],'where':_0x2bf322[_0x08ca('0x18')]?_0x2bf322[_0x08ca('0x18')]['where']||null:null,'attributes':_0x2bf322['options']?_0x2bf322[_0x08ca('0x18')]['attributes']||null:null,'limit':_0x2bf322['options']?_0x2bf322['options'][_0x08ca('0x1a')]||null:null,'include':_0x2bf322[_0x08ca('0x18')]?_0x2bf322[_0x08ca('0x18')][_0x08ca('0x1b')]?_[_0x08ca('0x1c')](_0x2bf322[_0x08ca('0x18')]['include'],function(_0x355c67){return{'model':db[_0x355c67[_0x08ca('0x1d')]],'as':_0x355c67['as'],'attributes':_0x355c67['attributes'],'include':_0x355c67[_0x08ca('0x1b')]?_['map'](_0x355c67[_0x08ca('0x1b')],function(_0x4b43f0){return{'model':db[_0x4b43f0[_0x08ca('0x1d')]],'as':_0x4b43f0['as'],'attributes':_0x4b43f0[_0x08ca('0x1e')],'include':_0x4b43f0[_0x08ca('0x1b')]?_[_0x08ca('0x1c')](_0x4b43f0[_0x08ca('0x1b')],function(_0x2423b6){return{'model':db[_0x2423b6[_0x08ca('0x1d')]],'as':_0x2423b6['as'],'attributes':_0x2423b6[_0x08ca('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae83a){logger[_0x08ca('0x13')](_0x08ca('0x1f'),_0x2bf322);logger[_0x08ca('0xf')](_0x08ca('0x1f'),_0x2bf322,JSON['stringify'](_0x3ae83a));_0x300486(_0x3ae83a);})[_0x08ca('0x15')](function(_0x1358ae){logger[_0x08ca('0x11')](_0x08ca('0x1f'),_0x1358ae['message'],_0x2bf322);_0x1917d7(_0x1048b2[_0x08ca('0x11')](0x1f4,_0x1358ae[_0x08ca('0x12')]));});});};exports[_0x08ca('0x20')]=function(_0x5579f3){var _0x33328f=this;return new Promise(function(_0xd816cb,_0x30818f){return db[_0x08ca('0x16')][_0x08ca('0x21')]({'raw':_0x5579f3[_0x08ca('0x18')]?_0x5579f3[_0x08ca('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5579f3[_0x08ca('0x18')]?_0x5579f3[_0x08ca('0x18')][_0x08ca('0x22')]||null:null,'attributes':_0x5579f3['options']?_0x5579f3[_0x08ca('0x18')][_0x08ca('0x1e')]||null:null,'include':_0x5579f3[_0x08ca('0x18')]?_0x5579f3[_0x08ca('0x18')]['include']?_['map'](_0x5579f3['options'][_0x08ca('0x1b')],function(_0x4784d9){return{'model':db[_0x4784d9[_0x08ca('0x1d')]],'as':_0x4784d9['as'],'attributes':_0x4784d9[_0x08ca('0x1e')],'include':_0x4784d9[_0x08ca('0x1b')]?_['map'](_0x4784d9['include'],function(_0x25b91e){return{'model':db[_0x25b91e[_0x08ca('0x1d')]],'as':_0x25b91e['as'],'attributes':_0x25b91e['attributes'],'include':_0x25b91e[_0x08ca('0x1b')]?_[_0x08ca('0x1c')](_0x25b91e['include'],function(_0x3b097d){return{'model':db[_0x3b097d[_0x08ca('0x1d')]],'as':_0x3b097d['as'],'attributes':_0x3b097d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ddeed){logger[_0x08ca('0x13')](_0x08ca('0x20'),_0x5579f3);logger[_0x08ca('0xf')](_0x08ca('0x20'),_0x5579f3,JSON[_0x08ca('0x10')](_0x1ddeed));_0xd816cb(_0x1ddeed);})[_0x08ca('0x15')](function(_0x585043){logger['error'](_0x08ca('0x20'),_0x585043[_0x08ca('0x12')],_0x5579f3);_0x30818f(_0x33328f[_0x08ca('0x11')](0x1f4,_0x585043[_0x08ca('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8121dfe..2566022 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 _0x3b20=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','delete','destroy','exports','multer'];(function(_0x215fea,_0x1aca47){var _0x59d6b4=function(_0x3c270b){while(--_0x3c270b){_0x215fea['push'](_0x215fea['shift']());}};_0x59d6b4(++_0x1aca47);}(_0x3b20,0x95));var _0x03b2=function(_0x5f3618,_0x8a13c6){_0x5f3618=_0x5f3618-0x0;var _0x49f309=_0x3b20[_0x5f3618];return _0x49f309;};'use strict';var multer=require(_0x03b2('0x0'));var util=require(_0x03b2('0x1'));var path=require(_0x03b2('0x2'));var timeout=require(_0x03b2('0x3'));var express=require(_0x03b2('0x4'));var router=express[_0x03b2('0x5')]();var fs_extra=require(_0x03b2('0x6'));var auth=require(_0x03b2('0x7'));var interaction=require(_0x03b2('0x8'));var config=require('../../config/environment');var controller=require(_0x03b2('0x9'));router[_0x03b2('0xa')]('/',auth['isAuthenticated'](),controller[_0x03b2('0xb')]);router[_0x03b2('0xa')](_0x03b2('0xc'),auth['isAuthenticated'](),controller[_0x03b2('0xd')]);router[_0x03b2('0xa')](_0x03b2('0xe'),auth[_0x03b2('0xf')](),controller[_0x03b2('0x10')]);router['get'](_0x03b2('0x11'),auth[_0x03b2('0xf')](),controller[_0x03b2('0x12')]);router[_0x03b2('0xa')](_0x03b2('0x13'),auth[_0x03b2('0xf')](),controller['getDescriptions']);router[_0x03b2('0x14')]('/',auth[_0x03b2('0xf')](),controller[_0x03b2('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x03b2('0x16')](_0x03b2('0xc'),auth[_0x03b2('0xf')](),controller[_0x03b2('0x17')]);module[_0x03b2('0x18')]=router; \ No newline at end of file +var _0x3d62=['../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3d62,0x94));var _0x23d6=function(_0x449bd8,_0x4a6e01){_0x449bd8=_0x449bd8-0x0;var _0x390afc=_0x3d62[_0x449bd8];return _0x390afc;};'use strict';var multer=require(_0x23d6('0x0'));var util=require(_0x23d6('0x1'));var path=require(_0x23d6('0x2'));var timeout=require('connect-timeout');var express=require(_0x23d6('0x3'));var router=express[_0x23d6('0x4')]();var fs_extra=require(_0x23d6('0x5'));var auth=require(_0x23d6('0x6'));var interaction=require(_0x23d6('0x7'));var config=require('../../config/environment');var controller=require(_0x23d6('0x8'));router[_0x23d6('0x9')]('/',auth['isAuthenticated'](),controller[_0x23d6('0xa')]);router[_0x23d6('0x9')](_0x23d6('0xb'),auth[_0x23d6('0xc')](),controller['show']);router[_0x23d6('0x9')]('/:id/fields',auth[_0x23d6('0xc')](),controller[_0x23d6('0xd')]);router[_0x23d6('0x9')]('/:id/subjects',auth[_0x23d6('0xc')](),controller[_0x23d6('0xe')]);router[_0x23d6('0x9')](_0x23d6('0xf'),auth['isAuthenticated'](),controller[_0x23d6('0x10')]);router[_0x23d6('0x11')]('/',auth[_0x23d6('0xc')](),controller[_0x23d6('0x12')]);router['put']('/:id',auth[_0x23d6('0xc')](),controller[_0x23d6('0x13')]);router[_0x23d6('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x23d6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 16c0751..0ef29a1 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 _0x718b=['sequelize','exports','STRING'];(function(_0x34a8a6,_0x483d25){var _0xc3c4a=function(_0x4f5588){while(--_0x4f5588){_0x34a8a6['push'](_0x34a8a6['shift']());}};_0xc3c4a(++_0x483d25);}(_0x718b,0x120));var _0xb718=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x718b[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xb718('0x0'));module[_0xb718('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb718('0x2')]}}; \ No newline at end of file +var _0xf09e=['exports','STRING','sequelize'];(function(_0x33a997,_0x1da2e){var _0x4c38fc=function(_0x3a6d58){while(--_0x3a6d58){_0x33a997['push'](_0x33a997['shift']());}};_0x4c38fc(++_0x1da2e);}(_0xf09e,0x1bb));var _0xef09=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf09e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xef09('0x0'));module[_0xef09('0x1')]={'name':{'type':Sequelize[_0xef09('0x2')]},'description':{'type':Sequelize[_0xef09('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d17619c..3eb3561 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 _0x6871=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x1f7f06,_0x22ae92){var _0x13f597=function(_0x3a2bf3){while(--_0x3a2bf3){_0x1f7f06['push'](_0x1f7f06['shift']());}};_0x13f597(++_0x22ae92);}(_0x6871,0x106));var _0x1687=function(_0x187dcc,_0x48295e){_0x187dcc=_0x187dcc-0x0;var _0x536d04=_0x6871[_0x187dcc];return _0x536d04;};'use strict';var emlformat=require(_0x1687('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1687('0x1'));var rp=require(_0x1687('0x2'));var moment=require(_0x1687('0x3'));var BPromise=require(_0x1687('0x4'));var Mustache=require(_0x1687('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1687('0x6'));var csv=require(_0x1687('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1687('0x8'));var _=require(_0x1687('0x9'));var squel=require(_0x1687('0xa'));var crypto=require(_0x1687('0xb'));var jsforce=require(_0x1687('0xc'));var deskjs=require(_0x1687('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1687('0xe'));var Redis=require(_0x1687('0xf'));var authService=require(_0x1687('0x10'));var qs=require(_0x1687('0x11'));var as=require(_0x1687('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1687('0x13'));var utils=require(_0x1687('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1687('0x15'));var db=require(_0x1687('0x16'))['db'];function respondWithStatusCode(_0x4a49d2,_0x50bb44){_0x50bb44=_0x50bb44||0xcc;return function(_0x454a8d){if(_0x454a8d){return _0x4a49d2['sendStatus'](_0x50bb44);}return _0x4a49d2[_0x1687('0x17')](_0x50bb44)[_0x1687('0x18')]();};}function respondWithResult(_0x26a1a7,_0x1747d1){_0x1747d1=_0x1747d1||0xc8;return function(_0x16a6fa){if(_0x16a6fa){return _0x26a1a7[_0x1687('0x17')](_0x1747d1)[_0x1687('0x19')](_0x16a6fa);}};}function respondWithFilteredResult(_0x395b62,_0x897ff8){return function(_0x4c8777){if(_0x4c8777){var _0x174656=typeof _0x897ff8[_0x1687('0x1a')]===_0x1687('0x1b')&&typeof _0x897ff8[_0x1687('0x1c')]===_0x1687('0x1b');var _0x19c092=_0x4c8777['count'];var _0x26e7f6=_0x174656?0x0:_0x897ff8[_0x1687('0x1a')];var _0x3697f2=_0x174656?_0x4c8777[_0x1687('0x1d')]:_0x897ff8[_0x1687('0x1a')]+_0x897ff8[_0x1687('0x1c')];var _0x12bef2;if(_0x3697f2>=_0x19c092){_0x3697f2=_0x19c092;_0x12bef2=0xc8;}else{_0x12bef2=0xce;}_0x395b62[_0x1687('0x17')](_0x12bef2);return _0x395b62[_0x1687('0x1e')](_0x1687('0x1f'),_0x26e7f6+'-'+_0x3697f2+'/'+_0x19c092)[_0x1687('0x19')](_0x4c8777);}return null;};}function patchUpdates(_0x8903cd){return function(_0x347214){try{jsonpatch[_0x1687('0x20')](_0x347214,_0x8903cd,!![]);}catch(_0x558439){return BPromise[_0x1687('0x21')](_0x558439);}return _0x347214[_0x1687('0x22')]();};}function saveUpdates(_0x599adc,_0x2436d4){return function(_0x19e47c){if(_0x19e47c){return _0x19e47c[_0x1687('0x23')](_0x599adc)[_0x1687('0x24')](function(_0x5afb4b){return _0x5afb4b;});}return null;};}function removeEntity(_0x16fcd0,_0x32c567){return function(_0x5dd144){if(_0x5dd144){return _0x5dd144[_0x1687('0x25')]()[_0x1687('0x24')](function(){_0x16fcd0[_0x1687('0x17')](0xcc)[_0x1687('0x18')]();});}};}function handleEntityNotFound(_0x5d0152,_0x5eaa9f){return function(_0x2e2f5e){if(!_0x2e2f5e){_0x5d0152[_0x1687('0x26')](0x194);}return _0x2e2f5e;};}function handleError(_0x32e479,_0x36e383){_0x36e383=_0x36e383||0x1f4;return function(_0x34da9c){logger[_0x1687('0x27')](_0x34da9c[_0x1687('0x28')]);if(_0x34da9c[_0x1687('0x29')]){delete _0x34da9c[_0x1687('0x29')];}_0x32e479['status'](_0x36e383)[_0x1687('0x2a')](_0x34da9c);};}exports['index']=function(_0x1f6a73,_0x3492b1){var _0x12ce2a={},_0x8af5be={},_0x460c02={'count':0x0,'rows':[]};var _0x2b3624=_['map'](db[_0x1687('0x2b')][_0x1687('0x2c')],function(_0x3f5b89){return{'name':_0x3f5b89[_0x1687('0x2d')],'type':_0x3f5b89[_0x1687('0x2e')][_0x1687('0x2f')]};});_0x8af5be['model']=_[_0x1687('0x30')](_0x2b3624,_0x1687('0x29'));_0x8af5be[_0x1687('0x31')]=_[_0x1687('0x32')](_0x1f6a73['query']);_0x8af5be[_0x1687('0x33')]=_[_0x1687('0x34')](_0x8af5be[_0x1687('0x35')],_0x8af5be[_0x1687('0x31')]);_0x12ce2a['attributes']=_[_0x1687('0x34')](_0x8af5be[_0x1687('0x35')],qs['fields'](_0x1f6a73[_0x1687('0x31')][_0x1687('0x36')]));_0x12ce2a[_0x1687('0x37')]=_0x12ce2a[_0x1687('0x37')][_0x1687('0x38')]?_0x12ce2a[_0x1687('0x37')]:_0x8af5be[_0x1687('0x35')];if(!_0x1f6a73[_0x1687('0x31')][_0x1687('0x39')](_0x1687('0x3a'))){_0x12ce2a['limit']=qs[_0x1687('0x1c')](_0x1f6a73[_0x1687('0x31')][_0x1687('0x1c')]);_0x12ce2a[_0x1687('0x1a')]=qs[_0x1687('0x1a')](_0x1f6a73[_0x1687('0x31')][_0x1687('0x1a')]);}_0x12ce2a[_0x1687('0x3b')]=qs[_0x1687('0x3c')](_0x1f6a73[_0x1687('0x31')][_0x1687('0x3c')]);_0x12ce2a[_0x1687('0x3d')]=qs[_0x1687('0x33')](_[_0x1687('0x3e')](_0x1f6a73[_0x1687('0x31')],_0x8af5be[_0x1687('0x33')]),_0x2b3624);if(_0x1f6a73[_0x1687('0x31')]['filter']){_0x12ce2a[_0x1687('0x3d')]=_['merge'](_0x12ce2a[_0x1687('0x3d')],{'$or':_[_0x1687('0x30')](_0x2b3624,function(_0x50fe0d){if(_0x50fe0d[_0x1687('0x2e')]!=='VIRTUAL'){var _0x43ebd0={};_0x43ebd0[_0x50fe0d[_0x1687('0x29')]]={'$like':'%'+_0x1f6a73['query'][_0x1687('0x3f')]+'%'};return _0x43ebd0;}})});}_0x12ce2a=_[_0x1687('0x40')]({},_0x12ce2a,_0x1f6a73[_0x1687('0x41')]);var _0x5aa3c3={'where':_0x12ce2a[_0x1687('0x3d')]};return db[_0x1687('0x2b')][_0x1687('0x1d')](_0x5aa3c3)[_0x1687('0x24')](function(_0x4f53fd){_0x460c02[_0x1687('0x1d')]=_0x4f53fd;if(_0x1f6a73[_0x1687('0x31')][_0x1687('0x42')]){_0x12ce2a[_0x1687('0x43')]=[{'all':!![]}];}return db[_0x1687('0x2b')][_0x1687('0x44')](_0x12ce2a);})[_0x1687('0x24')](function(_0x2469b3){_0x460c02['rows']=_0x2469b3;return _0x460c02;})['then'](respondWithFilteredResult(_0x3492b1,_0x12ce2a))[_0x1687('0x45')](handleError(_0x3492b1,null));};exports[_0x1687('0x46')]=function(_0x2e6051,_0x18b508){var _0x5f31ec={'raw':![],'where':{'id':_0x2e6051[_0x1687('0x47')]['id']}},_0x40d205={};_0x40d205[_0x1687('0x35')]=_[_0x1687('0x32')](db[_0x1687('0x2b')][_0x1687('0x2c')]);_0x40d205[_0x1687('0x31')]=_[_0x1687('0x32')](_0x2e6051['query']);_0x40d205['filters']=_[_0x1687('0x34')](_0x40d205[_0x1687('0x35')],_0x40d205[_0x1687('0x31')]);_0x5f31ec[_0x1687('0x37')]=_[_0x1687('0x34')](_0x40d205[_0x1687('0x35')],qs['fields'](_0x2e6051[_0x1687('0x31')][_0x1687('0x36')]));_0x5f31ec[_0x1687('0x37')]=_0x5f31ec[_0x1687('0x37')][_0x1687('0x38')]?_0x5f31ec['attributes']:_0x40d205[_0x1687('0x35')];if(_0x2e6051[_0x1687('0x31')][_0x1687('0x42')]){_0x5f31ec[_0x1687('0x43')]=[{'all':!![]}];}_0x5f31ec=_[_0x1687('0x40')]({},_0x5f31ec,_0x2e6051[_0x1687('0x41')]);return db['ServicenowConfiguration'][_0x1687('0x48')](_0x5f31ec)[_0x1687('0x24')](handleEntityNotFound(_0x18b508,null))['then'](respondWithResult(_0x18b508,null))['catch'](handleError(_0x18b508,null));};exports[_0x1687('0x49')]=function(_0x1c0400,_0x1fc650){return db[_0x1687('0x2b')][_0x1687('0x49')](_0x1c0400['body'],{})[_0x1687('0x24')](respondWithResult(_0x1fc650,0xc9))['catch'](handleError(_0x1fc650,null));};exports[_0x1687('0x23')]=function(_0x18d6f7,_0x5a35d5){if(_0x18d6f7[_0x1687('0x4a')]['id']){delete _0x18d6f7[_0x1687('0x4a')]['id'];}return db[_0x1687('0x2b')][_0x1687('0x48')]({'where':{'id':_0x18d6f7['params']['id']}})['then'](handleEntityNotFound(_0x5a35d5,null))[_0x1687('0x24')](saveUpdates(_0x18d6f7[_0x1687('0x4a')],null))[_0x1687('0x24')](respondWithResult(_0x5a35d5,null))[_0x1687('0x45')](handleError(_0x5a35d5,null));};exports['destroy']=function(_0xe5cbde,_0x1ede70){return db[_0x1687('0x2b')][_0x1687('0x48')]({'where':{'id':_0xe5cbde[_0x1687('0x47')]['id']}})[_0x1687('0x24')](handleEntityNotFound(_0x1ede70,null))[_0x1687('0x24')](removeEntity(_0x1ede70,null))[_0x1687('0x45')](handleError(_0x1ede70,null));};exports[_0x1687('0x4b')]=function(_0x4a80a8,_0x18d6da,_0x54e461){var _0x23861e={};var _0xc98fc6={};var _0x143acd;var _0x479722;return db['ServicenowConfiguration'][_0x1687('0x4c')]({'where':{'id':_0x4a80a8[_0x1687('0x47')]['id']}})[_0x1687('0x24')](handleEntityNotFound(_0x18d6da,null))['then'](function(_0x316804){if(_0x316804){_0x143acd=_0x316804;_0xc98fc6['model']=_[_0x1687('0x32')](db[_0x1687('0x4d')][_0x1687('0x2c')]);_0xc98fc6[_0x1687('0x31')]=_[_0x1687('0x32')](_0x4a80a8[_0x1687('0x31')]);_0xc98fc6[_0x1687('0x33')]=_[_0x1687('0x34')](_0xc98fc6['model'],_0xc98fc6[_0x1687('0x31')]);_0x23861e['attributes']=_[_0x1687('0x34')](_0xc98fc6[_0x1687('0x35')],qs[_0x1687('0x36')](_0x4a80a8[_0x1687('0x31')][_0x1687('0x36')]));_0x23861e['attributes']=_0x23861e[_0x1687('0x37')][_0x1687('0x38')]?_0x23861e[_0x1687('0x37')]:_0xc98fc6['model'];_0x23861e[_0x1687('0x3b')]=qs['sort'](_0x4a80a8['query']['sort']);_0x23861e[_0x1687('0x3d')]=qs[_0x1687('0x33')](_[_0x1687('0x3e')](_0x4a80a8[_0x1687('0x31')],_0xc98fc6[_0x1687('0x33')]));if(_0x4a80a8['query'][_0x1687('0x3f')]){_0x23861e[_0x1687('0x3d')]=_['merge'](_0x23861e[_0x1687('0x3d')],{'$or':_[_0x1687('0x30')](_0x23861e['attributes'],function(_0x4fa9ad){var _0x5d9fa3={};_0x5d9fa3[_0x4fa9ad]={'$like':'%'+_0x4a80a8['query'][_0x1687('0x3f')]+'%'};return _0x5d9fa3;})});}_0x23861e=_[_0x1687('0x40')]({},_0x23861e,_0x4a80a8['options']);return _0x143acd[_0x1687('0x4b')](_0x23861e);}})[_0x1687('0x24')](function(_0x5ec0fa){if(_0x5ec0fa){_0x479722=_0x5ec0fa[_0x1687('0x38')];if(!_0x4a80a8[_0x1687('0x31')][_0x1687('0x39')]('nolimit')){_0x23861e[_0x1687('0x1c')]=qs[_0x1687('0x1c')](_0x4a80a8[_0x1687('0x31')][_0x1687('0x1c')]);_0x23861e[_0x1687('0x1a')]=qs['offset'](_0x4a80a8[_0x1687('0x31')]['offset']);}return _0x143acd[_0x1687('0x4b')](_0x23861e);}})[_0x1687('0x24')](function(_0x5840ce){if(_0x5840ce){return _0x5840ce?{'count':_0x479722,'rows':_0x5840ce}:null;}})['then'](respondWithResult(_0x18d6da,null))[_0x1687('0x45')](handleError(_0x18d6da,null));};exports[_0x1687('0x4e')]=function(_0x1f105f,_0x169786,_0x209ee3){var _0x4049e7={};var _0xe0c4ae={};var _0x2babe5;var _0x559a86;return db['ServicenowConfiguration'][_0x1687('0x4c')]({'where':{'id':_0x1f105f['params']['id']}})[_0x1687('0x24')](handleEntityNotFound(_0x169786,null))[_0x1687('0x24')](function(_0x28234c){if(_0x28234c){_0x2babe5=_0x28234c;_0xe0c4ae[_0x1687('0x35')]=_[_0x1687('0x32')](db[_0x1687('0x4d')]['rawAttributes']);_0xe0c4ae[_0x1687('0x31')]=_[_0x1687('0x32')](_0x1f105f['query']);_0xe0c4ae[_0x1687('0x33')]=_[_0x1687('0x34')](_0xe0c4ae[_0x1687('0x35')],_0xe0c4ae[_0x1687('0x31')]);_0x4049e7[_0x1687('0x37')]=_['intersection'](_0xe0c4ae[_0x1687('0x35')],qs['fields'](_0x1f105f[_0x1687('0x31')][_0x1687('0x36')]));_0x4049e7[_0x1687('0x37')]=_0x4049e7[_0x1687('0x37')]['length']?_0x4049e7[_0x1687('0x37')]:_0xe0c4ae['model'];_0x4049e7[_0x1687('0x3b')]=qs[_0x1687('0x3c')](_0x1f105f[_0x1687('0x31')][_0x1687('0x3c')]);_0x4049e7['where']=qs[_0x1687('0x33')](_['pick'](_0x1f105f[_0x1687('0x31')],_0xe0c4ae[_0x1687('0x33')]));if(_0x1f105f['query'][_0x1687('0x3f')]){_0x4049e7[_0x1687('0x3d')]=_['merge'](_0x4049e7[_0x1687('0x3d')],{'$or':_[_0x1687('0x30')](_0x4049e7[_0x1687('0x37')],function(_0x3f6e9c){var _0xc1943={};_0xc1943[_0x3f6e9c]={'$like':'%'+_0x1f105f['query']['filter']+'%'};return _0xc1943;})});}_0x4049e7=_[_0x1687('0x40')]({},_0x4049e7,_0x1f105f[_0x1687('0x41')]);return _0x2babe5[_0x1687('0x4e')](_0x4049e7);}})['then'](function(_0x42a1e2){if(_0x42a1e2){_0x559a86=_0x42a1e2[_0x1687('0x38')];if(!_0x1f105f[_0x1687('0x31')][_0x1687('0x39')](_0x1687('0x3a'))){_0x4049e7[_0x1687('0x1c')]=qs[_0x1687('0x1c')](_0x1f105f[_0x1687('0x31')][_0x1687('0x1c')]);_0x4049e7[_0x1687('0x1a')]=qs[_0x1687('0x1a')](_0x1f105f[_0x1687('0x31')]['offset']);}return _0x2babe5[_0x1687('0x4e')](_0x4049e7);}})[_0x1687('0x24')](function(_0x59a3a6){if(_0x59a3a6){return _0x59a3a6?{'count':_0x559a86,'rows':_0x59a3a6}:null;}})[_0x1687('0x24')](respondWithResult(_0x169786,null))['catch'](handleError(_0x169786,null));};exports[_0x1687('0x4f')]=function(_0x456ce9,_0x235af7,_0x188d8f){var _0x9defc8={};var _0x22a3f6={};var _0x40c178;var _0x5f5731;return db[_0x1687('0x2b')][_0x1687('0x4c')]({'where':{'id':_0x456ce9[_0x1687('0x47')]['id']}})[_0x1687('0x24')](handleEntityNotFound(_0x235af7,null))['then'](function(_0x1f2ce3){if(_0x1f2ce3){_0x40c178=_0x1f2ce3;_0x22a3f6[_0x1687('0x35')]=_[_0x1687('0x32')](db[_0x1687('0x4d')][_0x1687('0x2c')]);_0x22a3f6[_0x1687('0x31')]=_[_0x1687('0x32')](_0x456ce9[_0x1687('0x31')]);_0x22a3f6[_0x1687('0x33')]=_[_0x1687('0x34')](_0x22a3f6[_0x1687('0x35')],_0x22a3f6[_0x1687('0x31')]);_0x9defc8[_0x1687('0x37')]=_[_0x1687('0x34')](_0x22a3f6[_0x1687('0x35')],qs[_0x1687('0x36')](_0x456ce9[_0x1687('0x31')][_0x1687('0x36')]));_0x9defc8['attributes']=_0x9defc8[_0x1687('0x37')][_0x1687('0x38')]?_0x9defc8[_0x1687('0x37')]:_0x22a3f6['model'];_0x9defc8['order']=qs[_0x1687('0x3c')](_0x456ce9[_0x1687('0x31')][_0x1687('0x3c')]);_0x9defc8[_0x1687('0x3d')]=qs['filters'](_[_0x1687('0x3e')](_0x456ce9[_0x1687('0x31')],_0x22a3f6[_0x1687('0x33')]));if(_0x456ce9[_0x1687('0x31')][_0x1687('0x3f')]){_0x9defc8[_0x1687('0x3d')]=_[_0x1687('0x40')](_0x9defc8['where'],{'$or':_['map'](_0x9defc8[_0x1687('0x37')],function(_0xf80e7a){var _0x42513e={};_0x42513e[_0xf80e7a]={'$like':'%'+_0x456ce9['query'][_0x1687('0x3f')]+'%'};return _0x42513e;})});}_0x9defc8=_[_0x1687('0x40')]({},_0x9defc8,_0x456ce9['options']);return _0x40c178['getDescriptions'](_0x9defc8);}})[_0x1687('0x24')](function(_0x32b800){if(_0x32b800){_0x5f5731=_0x32b800[_0x1687('0x38')];if(!_0x456ce9[_0x1687('0x31')][_0x1687('0x39')](_0x1687('0x3a'))){_0x9defc8[_0x1687('0x1c')]=qs['limit'](_0x456ce9[_0x1687('0x31')]['limit']);_0x9defc8[_0x1687('0x1a')]=qs[_0x1687('0x1a')](_0x456ce9[_0x1687('0x31')][_0x1687('0x1a')]);}return _0x40c178['getDescriptions'](_0x9defc8);}})[_0x1687('0x24')](function(_0x5dbf75){if(_0x5dbf75){return _0x5dbf75?{'count':_0x5f5731,'rows':_0x5dbf75}:null;}})[_0x1687('0x24')](respondWithResult(_0x235af7,null))[_0x1687('0x45')](handleError(_0x235af7,null));}; \ No newline at end of file +var _0xed86=['keys','intersection','attributes','fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','ServicenowConfiguration','count','includeAll','include','catch','show','params','find','create','body','getFields','findOne','ServicenowField','order','getSubjects','hasOwnProperty','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed86,0x1aa));var _0x6ed8=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xed86[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ed8('0x0'));var rp=require(_0x6ed8('0x1'));var moment=require(_0x6ed8('0x2'));var BPromise=require(_0x6ed8('0x3'));var Mustache=require(_0x6ed8('0x4'));var util=require(_0x6ed8('0x5'));var path=require(_0x6ed8('0x6'));var sox=require(_0x6ed8('0x7'));var csv=require(_0x6ed8('0x8'));var ejs=require(_0x6ed8('0x9'));var fs=require('fs');var fs_extra=require(_0x6ed8('0xa'));var _=require('lodash');var squel=require(_0x6ed8('0xb'));var crypto=require(_0x6ed8('0xc'));var jsforce=require(_0x6ed8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6ed8('0x8'));var querystring=require('querystring');var Papa=require(_0x6ed8('0xe'));var Redis=require('ioredis');var authService=require(_0x6ed8('0xf'));var qs=require(_0x6ed8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ed8('0x11'));var logger=require(_0x6ed8('0x12'))(_0x6ed8('0x13'));var utils=require(_0x6ed8('0x14'));var config=require(_0x6ed8('0x15'));var licenseUtil=require(_0x6ed8('0x16'));var db=require(_0x6ed8('0x17'))['db'];function respondWithStatusCode(_0x55cc71,_0x2991d4){_0x2991d4=_0x2991d4||0xcc;return function(_0x459078){if(_0x459078){return _0x55cc71[_0x6ed8('0x18')](_0x2991d4);}return _0x55cc71[_0x6ed8('0x19')](_0x2991d4)[_0x6ed8('0x1a')]();};}function respondWithResult(_0x56d849,_0x32069d){_0x32069d=_0x32069d||0xc8;return function(_0x3b9314){if(_0x3b9314){return _0x56d849['status'](_0x32069d)[_0x6ed8('0x1b')](_0x3b9314);}};}function respondWithFilteredResult(_0x5510dc,_0x41e101){return function(_0x20eaed){if(_0x20eaed){var _0x467ffa=typeof _0x41e101[_0x6ed8('0x1c')]===_0x6ed8('0x1d')&&typeof _0x41e101['limit']===_0x6ed8('0x1d');var _0x95d11=_0x20eaed['count'];var _0xdfce89=_0x467ffa?0x0:_0x41e101[_0x6ed8('0x1c')];var _0xac0446=_0x467ffa?_0x20eaed['count']:_0x41e101[_0x6ed8('0x1c')]+_0x41e101[_0x6ed8('0x1e')];var _0xfffc8a;if(_0xac0446>=_0x95d11){_0xac0446=_0x95d11;_0xfffc8a=0xc8;}else{_0xfffc8a=0xce;}_0x5510dc[_0x6ed8('0x19')](_0xfffc8a);return _0x5510dc['set'](_0x6ed8('0x1f'),_0xdfce89+'-'+_0xac0446+'/'+_0x95d11)[_0x6ed8('0x1b')](_0x20eaed);}return null;};}function patchUpdates(_0xcb1478){return function(_0x4b4ca9){try{jsonpatch[_0x6ed8('0x20')](_0x4b4ca9,_0xcb1478,!![]);}catch(_0x219817){return BPromise[_0x6ed8('0x21')](_0x219817);}return _0x4b4ca9['save']();};}function saveUpdates(_0x42f8e4,_0x5281d2){return function(_0x10c7d5){if(_0x10c7d5){return _0x10c7d5[_0x6ed8('0x22')](_0x42f8e4)[_0x6ed8('0x23')](function(_0x9d9e56){return _0x9d9e56;});}return null;};}function removeEntity(_0x30f6e7,_0x2a35ba){return function(_0x514f6f){if(_0x514f6f){return _0x514f6f[_0x6ed8('0x24')]()['then'](function(){_0x30f6e7['status'](0xcc)[_0x6ed8('0x1a')]();});}};}function handleEntityNotFound(_0x2dd2de,_0x42b757){return function(_0x192ca8){if(!_0x192ca8){_0x2dd2de[_0x6ed8('0x18')](0x194);}return _0x192ca8;};}function handleError(_0x7aac61,_0x5b3527){_0x5b3527=_0x5b3527||0x1f4;return function(_0x3f2ff6){logger[_0x6ed8('0x25')](_0x3f2ff6['stack']);if(_0x3f2ff6[_0x6ed8('0x26')]){delete _0x3f2ff6[_0x6ed8('0x26')];}_0x7aac61[_0x6ed8('0x19')](_0x5b3527)[_0x6ed8('0x27')](_0x3f2ff6);};}exports[_0x6ed8('0x28')]=function(_0x34e908,_0xc54de1){var _0x432d55={},_0x41872f={},_0x5a6d2e={'count':0x0,'rows':[]};var _0x426ac3=_[_0x6ed8('0x29')](db['ServicenowConfiguration'][_0x6ed8('0x2a')],function(_0x45237c){return{'name':_0x45237c[_0x6ed8('0x2b')],'type':_0x45237c[_0x6ed8('0x2c')][_0x6ed8('0x2d')]};});_0x41872f[_0x6ed8('0x2e')]=_[_0x6ed8('0x29')](_0x426ac3,_0x6ed8('0x26'));_0x41872f[_0x6ed8('0x2f')]=_[_0x6ed8('0x30')](_0x34e908['query']);_0x41872f['filters']=_[_0x6ed8('0x31')](_0x41872f[_0x6ed8('0x2e')],_0x41872f[_0x6ed8('0x2f')]);_0x432d55[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x41872f['model'],qs['fields'](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x33')]));_0x432d55['attributes']=_0x432d55[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x432d55['attributes']:_0x41872f['model'];if(!_0x34e908[_0x6ed8('0x2f')]['hasOwnProperty'](_0x6ed8('0x35'))){_0x432d55[_0x6ed8('0x1e')]=qs[_0x6ed8('0x1e')](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x1e')]);_0x432d55[_0x6ed8('0x1c')]=qs['offset'](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x1c')]);}_0x432d55['order']=qs[_0x6ed8('0x36')](_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x36')]);_0x432d55['where']=qs['filters'](_[_0x6ed8('0x37')](_0x34e908[_0x6ed8('0x2f')],_0x41872f[_0x6ed8('0x38')]),_0x426ac3);if(_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x39')]){_0x432d55[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x432d55['where'],{'$or':_[_0x6ed8('0x29')](_0x426ac3,function(_0x3b2f01){if(_0x3b2f01[_0x6ed8('0x2c')]!==_0x6ed8('0x3c')){var _0x18f397={};_0x18f397[_0x3b2f01['name']]={'$like':'%'+_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x39')]+'%'};return _0x18f397;}})});}_0x432d55=_[_0x6ed8('0x3b')]({},_0x432d55,_0x34e908[_0x6ed8('0x3d')]);var _0x54803b={'where':_0x432d55[_0x6ed8('0x3a')]};return db[_0x6ed8('0x3e')][_0x6ed8('0x3f')](_0x54803b)[_0x6ed8('0x23')](function(_0x4ad74d){_0x5a6d2e[_0x6ed8('0x3f')]=_0x4ad74d;if(_0x34e908[_0x6ed8('0x2f')][_0x6ed8('0x40')]){_0x432d55[_0x6ed8('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x432d55);})[_0x6ed8('0x23')](function(_0x44d1b8){_0x5a6d2e['rows']=_0x44d1b8;return _0x5a6d2e;})['then'](respondWithFilteredResult(_0xc54de1,_0x432d55))[_0x6ed8('0x42')](handleError(_0xc54de1,null));};exports[_0x6ed8('0x43')]=function(_0x3c844d,_0x751f97){var _0x5a4922={'raw':![],'where':{'id':_0x3c844d[_0x6ed8('0x44')]['id']}},_0x1a11e6={};_0x1a11e6[_0x6ed8('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x6ed8('0x2a')]);_0x1a11e6[_0x6ed8('0x2f')]=_['keys'](_0x3c844d[_0x6ed8('0x2f')]);_0x1a11e6[_0x6ed8('0x38')]=_[_0x6ed8('0x31')](_0x1a11e6[_0x6ed8('0x2e')],_0x1a11e6[_0x6ed8('0x2f')]);_0x5a4922[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x1a11e6[_0x6ed8('0x2e')],qs[_0x6ed8('0x33')](_0x3c844d[_0x6ed8('0x2f')]['fields']));_0x5a4922[_0x6ed8('0x32')]=_0x5a4922[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x5a4922['attributes']:_0x1a11e6[_0x6ed8('0x2e')];if(_0x3c844d['query'][_0x6ed8('0x40')]){_0x5a4922[_0x6ed8('0x41')]=[{'all':!![]}];}_0x5a4922=_[_0x6ed8('0x3b')]({},_0x5a4922,_0x3c844d[_0x6ed8('0x3d')]);return db[_0x6ed8('0x3e')][_0x6ed8('0x45')](_0x5a4922)[_0x6ed8('0x23')](handleEntityNotFound(_0x751f97,null))[_0x6ed8('0x23')](respondWithResult(_0x751f97,null))['catch'](handleError(_0x751f97,null));};exports[_0x6ed8('0x46')]=function(_0x55d2eb,_0x2ded90){return db[_0x6ed8('0x3e')][_0x6ed8('0x46')](_0x55d2eb[_0x6ed8('0x47')],{})[_0x6ed8('0x23')](respondWithResult(_0x2ded90,0xc9))[_0x6ed8('0x42')](handleError(_0x2ded90,null));};exports[_0x6ed8('0x22')]=function(_0x1a9b30,_0x38ce8d){if(_0x1a9b30[_0x6ed8('0x47')]['id']){delete _0x1a9b30[_0x6ed8('0x47')]['id'];}return db[_0x6ed8('0x3e')][_0x6ed8('0x45')]({'where':{'id':_0x1a9b30[_0x6ed8('0x44')]['id']}})[_0x6ed8('0x23')](handleEntityNotFound(_0x38ce8d,null))[_0x6ed8('0x23')](saveUpdates(_0x1a9b30[_0x6ed8('0x47')],null))[_0x6ed8('0x23')](respondWithResult(_0x38ce8d,null))[_0x6ed8('0x42')](handleError(_0x38ce8d,null));};exports[_0x6ed8('0x24')]=function(_0x1defe6,_0x30d5ef){return db[_0x6ed8('0x3e')][_0x6ed8('0x45')]({'where':{'id':_0x1defe6[_0x6ed8('0x44')]['id']}})[_0x6ed8('0x23')](handleEntityNotFound(_0x30d5ef,null))['then'](removeEntity(_0x30d5ef,null))[_0x6ed8('0x42')](handleError(_0x30d5ef,null));};exports[_0x6ed8('0x48')]=function(_0x3edd47,_0x4a46d1,_0xfee193){var _0x53d585={};var _0x3c0113={};var _0x16e23f;var _0x326d35;return db[_0x6ed8('0x3e')][_0x6ed8('0x49')]({'where':{'id':_0x3edd47['params']['id']}})['then'](handleEntityNotFound(_0x4a46d1,null))[_0x6ed8('0x23')](function(_0x1d6387){if(_0x1d6387){_0x16e23f=_0x1d6387;_0x3c0113[_0x6ed8('0x2e')]=_[_0x6ed8('0x30')](db[_0x6ed8('0x4a')][_0x6ed8('0x2a')]);_0x3c0113['query']=_[_0x6ed8('0x30')](_0x3edd47[_0x6ed8('0x2f')]);_0x3c0113['filters']=_[_0x6ed8('0x31')](_0x3c0113[_0x6ed8('0x2e')],_0x3c0113[_0x6ed8('0x2f')]);_0x53d585[_0x6ed8('0x32')]=_['intersection'](_0x3c0113[_0x6ed8('0x2e')],qs[_0x6ed8('0x33')](_0x3edd47[_0x6ed8('0x2f')][_0x6ed8('0x33')]));_0x53d585['attributes']=_0x53d585[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x53d585[_0x6ed8('0x32')]:_0x3c0113[_0x6ed8('0x2e')];_0x53d585[_0x6ed8('0x4b')]=qs[_0x6ed8('0x36')](_0x3edd47[_0x6ed8('0x2f')][_0x6ed8('0x36')]);_0x53d585[_0x6ed8('0x3a')]=qs[_0x6ed8('0x38')](_[_0x6ed8('0x37')](_0x3edd47[_0x6ed8('0x2f')],_0x3c0113['filters']));if(_0x3edd47['query']['filter']){_0x53d585[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x53d585[_0x6ed8('0x3a')],{'$or':_['map'](_0x53d585[_0x6ed8('0x32')],function(_0x284efb){var _0x1d74bf={};_0x1d74bf[_0x284efb]={'$like':'%'+_0x3edd47[_0x6ed8('0x2f')][_0x6ed8('0x39')]+'%'};return _0x1d74bf;})});}_0x53d585=_[_0x6ed8('0x3b')]({},_0x53d585,_0x3edd47[_0x6ed8('0x3d')]);return _0x16e23f[_0x6ed8('0x48')](_0x53d585);}})['then'](function(_0x278820){if(_0x278820){_0x326d35=_0x278820[_0x6ed8('0x34')];if(!_0x3edd47['query']['hasOwnProperty'](_0x6ed8('0x35'))){_0x53d585['limit']=qs[_0x6ed8('0x1e')](_0x3edd47['query'][_0x6ed8('0x1e')]);_0x53d585[_0x6ed8('0x1c')]=qs[_0x6ed8('0x1c')](_0x3edd47[_0x6ed8('0x2f')]['offset']);}return _0x16e23f[_0x6ed8('0x48')](_0x53d585);}})[_0x6ed8('0x23')](function(_0x499d74){if(_0x499d74){return _0x499d74?{'count':_0x326d35,'rows':_0x499d74}:null;}})[_0x6ed8('0x23')](respondWithResult(_0x4a46d1,null))['catch'](handleError(_0x4a46d1,null));};exports[_0x6ed8('0x4c')]=function(_0x1c7c4b,_0x3e31bd,_0x4ce419){var _0x44a608={};var _0x22c555={};var _0x402255;var _0x5786a4;return db['ServicenowConfiguration'][_0x6ed8('0x49')]({'where':{'id':_0x1c7c4b[_0x6ed8('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e31bd,null))[_0x6ed8('0x23')](function(_0x295e46){if(_0x295e46){_0x402255=_0x295e46;_0x22c555[_0x6ed8('0x2e')]=_[_0x6ed8('0x30')](db[_0x6ed8('0x4a')][_0x6ed8('0x2a')]);_0x22c555[_0x6ed8('0x2f')]=_[_0x6ed8('0x30')](_0x1c7c4b[_0x6ed8('0x2f')]);_0x22c555['filters']=_[_0x6ed8('0x31')](_0x22c555[_0x6ed8('0x2e')],_0x22c555[_0x6ed8('0x2f')]);_0x44a608[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x22c555[_0x6ed8('0x2e')],qs['fields'](_0x1c7c4b['query'][_0x6ed8('0x33')]));_0x44a608['attributes']=_0x44a608[_0x6ed8('0x32')][_0x6ed8('0x34')]?_0x44a608[_0x6ed8('0x32')]:_0x22c555[_0x6ed8('0x2e')];_0x44a608[_0x6ed8('0x4b')]=qs[_0x6ed8('0x36')](_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x36')]);_0x44a608[_0x6ed8('0x3a')]=qs[_0x6ed8('0x38')](_[_0x6ed8('0x37')](_0x1c7c4b[_0x6ed8('0x2f')],_0x22c555[_0x6ed8('0x38')]));if(_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x39')]){_0x44a608[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x44a608[_0x6ed8('0x3a')],{'$or':_['map'](_0x44a608[_0x6ed8('0x32')],function(_0x5aafb8){var _0xc5cfc9={};_0xc5cfc9[_0x5aafb8]={'$like':'%'+_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x39')]+'%'};return _0xc5cfc9;})});}_0x44a608=_['merge']({},_0x44a608,_0x1c7c4b[_0x6ed8('0x3d')]);return _0x402255['getSubjects'](_0x44a608);}})[_0x6ed8('0x23')](function(_0x40482c){if(_0x40482c){_0x5786a4=_0x40482c[_0x6ed8('0x34')];if(!_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x4d')]('nolimit')){_0x44a608['limit']=qs[_0x6ed8('0x1e')](_0x1c7c4b['query']['limit']);_0x44a608['offset']=qs[_0x6ed8('0x1c')](_0x1c7c4b[_0x6ed8('0x2f')][_0x6ed8('0x1c')]);}return _0x402255['getSubjects'](_0x44a608);}})[_0x6ed8('0x23')](function(_0x19ea05){if(_0x19ea05){return _0x19ea05?{'count':_0x5786a4,'rows':_0x19ea05}:null;}})[_0x6ed8('0x23')](respondWithResult(_0x3e31bd,null))['catch'](handleError(_0x3e31bd,null));};exports[_0x6ed8('0x4e')]=function(_0x45a465,_0x325ca4,_0x468ef0){var _0x3f85db={};var _0x176651={};var _0x1a4bd2;var _0x4bce58;return db[_0x6ed8('0x3e')]['findOne']({'where':{'id':_0x45a465[_0x6ed8('0x44')]['id']}})[_0x6ed8('0x23')](handleEntityNotFound(_0x325ca4,null))[_0x6ed8('0x23')](function(_0x5598d5){if(_0x5598d5){_0x1a4bd2=_0x5598d5;_0x176651['model']=_[_0x6ed8('0x30')](db[_0x6ed8('0x4a')][_0x6ed8('0x2a')]);_0x176651[_0x6ed8('0x2f')]=_[_0x6ed8('0x30')](_0x45a465['query']);_0x176651[_0x6ed8('0x38')]=_['intersection'](_0x176651[_0x6ed8('0x2e')],_0x176651[_0x6ed8('0x2f')]);_0x3f85db[_0x6ed8('0x32')]=_[_0x6ed8('0x31')](_0x176651['model'],qs[_0x6ed8('0x33')](_0x45a465['query']['fields']));_0x3f85db['attributes']=_0x3f85db['attributes'][_0x6ed8('0x34')]?_0x3f85db[_0x6ed8('0x32')]:_0x176651[_0x6ed8('0x2e')];_0x3f85db[_0x6ed8('0x4b')]=qs[_0x6ed8('0x36')](_0x45a465[_0x6ed8('0x2f')]['sort']);_0x3f85db[_0x6ed8('0x3a')]=qs[_0x6ed8('0x38')](_[_0x6ed8('0x37')](_0x45a465[_0x6ed8('0x2f')],_0x176651['filters']));if(_0x45a465['query']['filter']){_0x3f85db[_0x6ed8('0x3a')]=_[_0x6ed8('0x3b')](_0x3f85db['where'],{'$or':_[_0x6ed8('0x29')](_0x3f85db[_0x6ed8('0x32')],function(_0x2a1bb6){var _0x262388={};_0x262388[_0x2a1bb6]={'$like':'%'+_0x45a465[_0x6ed8('0x2f')]['filter']+'%'};return _0x262388;})});}_0x3f85db=_[_0x6ed8('0x3b')]({},_0x3f85db,_0x45a465['options']);return _0x1a4bd2[_0x6ed8('0x4e')](_0x3f85db);}})[_0x6ed8('0x23')](function(_0x47707e){if(_0x47707e){_0x4bce58=_0x47707e[_0x6ed8('0x34')];if(!_0x45a465[_0x6ed8('0x2f')][_0x6ed8('0x4d')](_0x6ed8('0x35'))){_0x3f85db[_0x6ed8('0x1e')]=qs[_0x6ed8('0x1e')](_0x45a465[_0x6ed8('0x2f')][_0x6ed8('0x1e')]);_0x3f85db[_0x6ed8('0x1c')]=qs[_0x6ed8('0x1c')](_0x45a465[_0x6ed8('0x2f')][_0x6ed8('0x1c')]);}return _0x1a4bd2[_0x6ed8('0x4e')](_0x3f85db);}})['then'](function(_0x19cbd0){if(_0x19cbd0){return _0x19cbd0?{'count':_0x4bce58,'rows':_0x19cbd0}:null;}})['then'](respondWithResult(_0x325ca4,null))[_0x6ed8('0x42')](handleError(_0x325ca4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3146646..88e5399 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 _0x0b63=['ServicenowConfiguration','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x17a524,_0x523821){var _0x2869c9=function(_0x4977f8){while(--_0x4977f8){_0x17a524['push'](_0x17a524['shift']());}};_0x2869c9(++_0x523821);}(_0x0b63,0xe7));var _0x30b6=function(_0x5c4a1c,_0x34edf5){_0x5c4a1c=_0x5c4a1c-0x0;var _0xc1ae8f=_0x0b63[_0x5c4a1c];return _0xc1ae8f;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30b6('0x1'));var moment=require(_0x30b6('0x2'));var BPromise=require(_0x30b6('0x3'));var rp=require(_0x30b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));var attributes=require(_0x30b6('0x7'));module[_0x30b6('0x8')]=function(_0x2670c6,_0x2fddeb){return _0x2670c6['define'](_0x30b6('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x5cd5a6,_0x884cf1){_0x5cd5a6=_0x5cd5a6-0x0;var _0x1e5ab8=_0xd4f4[_0x5cd5a6];return _0x1e5ab8;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'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 a37efb4..836ae3a 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 _0x8adb=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x58c0f6,_0x32717a){var _0x4f11bf=function(_0x18dce5){while(--_0x18dce5){_0x58c0f6['push'](_0x58c0f6['shift']());}};_0x4f11bf(++_0x32717a);}(_0x8adb,0x105));var _0xb8ad=function(_0x10fa32,_0x3a59c4){_0x10fa32=_0x10fa32-0x0;var _0x423e7f=_0x8adb[_0x10fa32];return _0x423e7f;};'use strict';var _=require(_0xb8ad('0x0'));var util=require(_0xb8ad('0x1'));var moment=require('moment');var BPromise=require(_0xb8ad('0x2'));var rs=require(_0xb8ad('0x3'));var fs=require('fs');var Redis=require(_0xb8ad('0x4'));var db=require(_0xb8ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8ad('0x6'))(_0xb8ad('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8ad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e4541,_0x5e3934,_0x53a961){return new BPromise(function(_0x14dd77,_0x48f0a2){return client[_0xb8ad('0x9')](_0x3e4541,_0x53a961)['then'](function(_0x1a95aa){logger[_0xb8ad('0xa')](_0xb8ad('0xb'),_0x5e3934,_0xb8ad('0xc'));logger[_0xb8ad('0xd')](_0xb8ad('0xe'),_0x5e3934,_0xb8ad('0xc'),JSON['stringify'](_0x1a95aa));if(_0x1a95aa[_0xb8ad('0xf')]){if(_0x1a95aa['error'][_0xb8ad('0x10')]===0x1f4){logger[_0xb8ad('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e3934,_0x1a95aa[_0xb8ad('0xf')][_0xb8ad('0x11')]);return _0x48f0a2(_0x1a95aa[_0xb8ad('0xf')]['message']);}logger[_0xb8ad('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e3934,_0x1a95aa[_0xb8ad('0xf')]['message']);return _0x14dd77(_0x1a95aa[_0xb8ad('0xf')][_0xb8ad('0x11')]);}else{logger[_0xb8ad('0xa')](_0xb8ad('0xb'),_0x5e3934,_0xb8ad('0xc'));_0x14dd77(_0x1a95aa[_0xb8ad('0x12')][_0xb8ad('0x11')]);}})[_0xb8ad('0x13')](function(_0x229237){logger['error'](_0xb8ad('0xb'),_0x5e3934,_0x229237);_0x48f0a2(_0x229237);});});} \ No newline at end of file +var _0x1c59=['util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x288060,_0x14c878){var _0x9caf4f=function(_0x56b3a5){while(--_0x56b3a5){_0x288060['push'](_0x288060['shift']());}};_0x9caf4f(++_0x14c878);}(_0x1c59,0x18e));var _0x91c5=function(_0x521fc2,_0x185e7f){_0x521fc2=_0x521fc2-0x0;var _0x520006=_0x1c59[_0x521fc2];return _0x520006;};'use strict';var _=require(_0x91c5('0x0'));var util=require(_0x91c5('0x1'));var moment=require(_0x91c5('0x2'));var BPromise=require(_0x91c5('0x3'));var rs=require(_0x91c5('0x4'));var fs=require('fs');var Redis=require(_0x91c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x91c5('0x7'));var client=jayson['client'][_0x91c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a9b48,_0x49f7f8,_0x580c32){return new BPromise(function(_0x1754b5,_0x1660a4){return client[_0x91c5('0x9')](_0x3a9b48,_0x580c32)['then'](function(_0x3ee905){logger[_0x91c5('0xa')](_0x91c5('0xb'),_0x49f7f8,_0x91c5('0xc'));logger[_0x91c5('0xd')](_0x91c5('0xe'),_0x49f7f8,'request\x20sent',JSON[_0x91c5('0xf')](_0x3ee905));if(_0x3ee905['error']){if(_0x3ee905['error'][_0x91c5('0x10')]===0x1f4){logger[_0x91c5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49f7f8,_0x3ee905[_0x91c5('0x11')]['message']);return _0x1660a4(_0x3ee905[_0x91c5('0x11')][_0x91c5('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x49f7f8,_0x3ee905[_0x91c5('0x11')][_0x91c5('0x12')]);return _0x1754b5(_0x3ee905[_0x91c5('0x11')][_0x91c5('0x12')]);}else{logger['info'](_0x91c5('0xb'),_0x49f7f8,_0x91c5('0xc'));_0x1754b5(_0x3ee905[_0x91c5('0x13')][_0x91c5('0x12')]);}})[_0x91c5('0x14')](function(_0x5d7a45){logger[_0x91c5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49f7f8,_0x5d7a45);_0x1660a4(_0x5d7a45);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 06b5738..cc48ac7 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 _0x72a3=['/:id','isAuthenticated','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','get'];(function(_0x429ab6,_0x3fc335){var _0x24d580=function(_0x3200fa){while(--_0x3200fa){_0x429ab6['push'](_0x429ab6['shift']());}};_0x24d580(++_0x3fc335);}(_0x72a3,0x1a5));var _0x372a=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x72a3[_0x37756b];return _0x46efec;};'use strict';var multer=require(_0x372a('0x0'));var util=require('util');var path=require(_0x372a('0x1'));var timeout=require(_0x372a('0x2'));var express=require(_0x372a('0x3'));var router=express[_0x372a('0x4')]();var fs_extra=require(_0x372a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x372a('0x6'));var config=require(_0x372a('0x7'));var controller=require(_0x372a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x372a('0x9')]);router[_0x372a('0xa')](_0x372a('0xb'),auth[_0x372a('0xc')](),controller['show']);router[_0x372a('0xd')]('/',auth[_0x372a('0xc')](),controller[_0x372a('0xe')]);router[_0x372a('0xf')](_0x372a('0xb'),auth[_0x372a('0xc')](),controller['update']);router[_0x372a('0x10')](_0x372a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x372a('0x11')]=router; \ No newline at end of file +var _0x57fd=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x57fd,0x132));var _0xd57f=function(_0x1c674c,_0xc28da0){_0x1c674c=_0x1c674c-0x0;var _0x49605e=_0x57fd[_0x1c674c];return _0x49605e;};'use strict';var multer=require(_0xd57f('0x0'));var util=require(_0xd57f('0x1'));var path=require(_0xd57f('0x2'));var timeout=require(_0xd57f('0x3'));var express=require(_0xd57f('0x4'));var router=express['Router']();var fs_extra=require(_0xd57f('0x5'));var auth=require(_0xd57f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd57f('0x7'));var controller=require(_0xd57f('0x8'));router[_0xd57f('0x9')]('/',auth[_0xd57f('0xa')](),controller[_0xd57f('0xb')]);router[_0xd57f('0x9')]('/:id',auth[_0xd57f('0xa')](),controller[_0xd57f('0xc')]);router[_0xd57f('0xd')]('/',auth[_0xd57f('0xa')](),controller['create']);router[_0xd57f('0xe')](_0xd57f('0xf'),auth[_0xd57f('0xa')](),controller[_0xd57f('0x10')]);router[_0xd57f('0x11')]('/:id',auth[_0xd57f('0xa')](),controller[_0xd57f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index dd60041..2a2c865 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 _0x96dc=['variable','picklist','STRING','ENUM','customVariable','BOOLEAN','exports','string'];(function(_0x10c59,_0x3df34f){var _0x101ae3=function(_0xa71238){while(--_0xa71238){_0x10c59['push'](_0x10c59['shift']());}};_0x101ae3(++_0x3df34f);}(_0x96dc,0x14e));var _0xc96d=function(_0xcaacb9,_0x1c9429){_0xcaacb9=_0xcaacb9-0x0;var _0x20c474=_0x96dc[_0xcaacb9];return _0x20c474;};'use strict';var Sequelize=require('sequelize');module[_0xc96d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc96d('0x1'),_0xc96d('0x2'),'customVariable','keyValue',_0xc96d('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc96d('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc96d('0x5')](_0xc96d('0x1'),_0xc96d('0x2'),_0xc96d('0x6'))},'keyContent':{'type':Sequelize[_0xc96d('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc96d('0x4')]},'customField':{'type':Sequelize[_0xc96d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b46=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x1b46,0x18f));var _0x61b4=function(_0x4cb21c,_0x1e0d7a){_0x4cb21c=_0x4cb21c-0x0;var _0x5c1d5c=_0x1b46[_0x4cb21c];return _0x5c1d5c;};'use strict';var Sequelize=require(_0x61b4('0x0'));module[_0x61b4('0x1')]={'type':{'type':Sequelize[_0x61b4('0x2')](_0x61b4('0x3'),_0x61b4('0x4'),_0x61b4('0x5'),_0x61b4('0x6'),_0x61b4('0x7')),'defaultValue':_0x61b4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61b4('0x8')]},'keyType':{'type':Sequelize[_0x61b4('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x61b4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x61b4('0x8')]},'customField':{'type':Sequelize[_0x61b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x61b4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9a0484f..ca8b34f 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 _0x796d=['mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','apply','reject','save','update','then','error','send','map','ServicenowField','rawAttributes','fieldName','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','where','type','VIRTUAL','options','count','include','show','includeAll','merge','find','catch','create','body','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x276716,_0x191942){var _0x433e7f=function(_0x4f209d){while(--_0x4f209d){_0x276716['push'](_0x276716['shift']());}};_0x433e7f(++_0x191942);}(_0x796d,0x1d8));var _0xd796=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x796d[_0x11e30d];return _0x2d4e29;};'use strict';var emlformat=require(_0xd796('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd796('0x1'));var jsonpatch=require(_0xd796('0x2'));var rp=require(_0xd796('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd796('0x4'));var util=require(_0xd796('0x5'));var path=require(_0xd796('0x6'));var sox=require(_0xd796('0x7'));var csv=require('to-csv');var ejs=require(_0xd796('0x8'));var fs=require('fs');var fs_extra=require(_0xd796('0x9'));var _=require('lodash');var squel=require(_0xd796('0xa'));var crypto=require('crypto');var jsforce=require(_0xd796('0xb'));var deskjs=require(_0xd796('0xc'));var toCsv=require(_0xd796('0xd'));var querystring=require('querystring');var Papa=require(_0xd796('0xe'));var Redis=require(_0xd796('0xf'));var authService=require(_0xd796('0x10'));var qs=require(_0xd796('0x11'));var as=require(_0xd796('0x12'));var hardwareService=require(_0xd796('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd796('0x14'));var db=require(_0xd796('0x15'))['db'];function respondWithStatusCode(_0xfe6c20,_0x40aeb0){_0x40aeb0=_0x40aeb0||0xcc;return function(_0x7a42bf){if(_0x7a42bf){return _0xfe6c20[_0xd796('0x16')](_0x40aeb0);}return _0xfe6c20['status'](_0x40aeb0)[_0xd796('0x17')]();};}function respondWithResult(_0xf58377,_0x2bd400){_0x2bd400=_0x2bd400||0xc8;return function(_0x240b63){if(_0x240b63){return _0xf58377['status'](_0x2bd400)[_0xd796('0x18')](_0x240b63);}};}function respondWithFilteredResult(_0x22a69a,_0x190c7b){return function(_0x254295){if(_0x254295){var _0x43201a=typeof _0x190c7b[_0xd796('0x19')]===_0xd796('0x1a')&&typeof _0x190c7b[_0xd796('0x1b')]===_0xd796('0x1a');var _0x18e1b6=_0x254295['count'];var _0x2e9bfa=_0x43201a?0x0:_0x190c7b[_0xd796('0x19')];var _0x441485=_0x43201a?_0x254295['count']:_0x190c7b['offset']+_0x190c7b[_0xd796('0x1b')];var _0x5d6916;if(_0x441485>=_0x18e1b6){_0x441485=_0x18e1b6;_0x5d6916=0xc8;}else{_0x5d6916=0xce;}_0x22a69a[_0xd796('0x1c')](_0x5d6916);return _0x22a69a[_0xd796('0x1d')]('Content-Range',_0x2e9bfa+'-'+_0x441485+'/'+_0x18e1b6)['json'](_0x254295);}return null;};}function patchUpdates(_0x5d8c36){return function(_0x2dfa0c){try{jsonpatch[_0xd796('0x1e')](_0x2dfa0c,_0x5d8c36,!![]);}catch(_0x2d66ed){return BPromise[_0xd796('0x1f')](_0x2d66ed);}return _0x2dfa0c[_0xd796('0x20')]();};}function saveUpdates(_0x55245e,_0x3112af){return function(_0xf7b47c){if(_0xf7b47c){return _0xf7b47c[_0xd796('0x21')](_0x55245e)[_0xd796('0x22')](function(_0x2fe4ed){return _0x2fe4ed;});}return null;};}function removeEntity(_0x101e98,_0x1ed304){return function(_0x470967){if(_0x470967){return _0x470967['destroy']()[_0xd796('0x22')](function(){_0x101e98[_0xd796('0x1c')](0xcc)[_0xd796('0x17')]();});}};}function handleEntityNotFound(_0x23c996,_0x53416f){return function(_0x126ed9){if(!_0x126ed9){_0x23c996[_0xd796('0x16')](0x194);}return _0x126ed9;};}function handleError(_0x5afb79,_0x26d5f1){_0x26d5f1=_0x26d5f1||0x1f4;return function(_0xc1b0b9){logger[_0xd796('0x23')](_0xc1b0b9['stack']);if(_0xc1b0b9['name']){delete _0xc1b0b9['name'];}_0x5afb79[_0xd796('0x1c')](_0x26d5f1)[_0xd796('0x24')](_0xc1b0b9);};}exports['index']=function(_0x216610,_0x47a546){var _0x73f30a={},_0x508e03={},_0x2cc5b4={'count':0x0,'rows':[]};var _0x2c11a3=_[_0xd796('0x25')](db[_0xd796('0x26')][_0xd796('0x27')],function(_0x1d7500){return{'name':_0x1d7500[_0xd796('0x28')],'type':_0x1d7500['type']['key']};});_0x508e03['model']=_[_0xd796('0x25')](_0x2c11a3,_0xd796('0x29'));_0x508e03[_0xd796('0x2a')]=_[_0xd796('0x2b')](_0x216610[_0xd796('0x2a')]);_0x508e03[_0xd796('0x2c')]=_[_0xd796('0x2d')](_0x508e03[_0xd796('0x2e')],_0x508e03[_0xd796('0x2a')]);_0x73f30a[_0xd796('0x2f')]=_['intersection'](_0x508e03['model'],qs['fields'](_0x216610['query'][_0xd796('0x30')]));_0x73f30a[_0xd796('0x2f')]=_0x73f30a['attributes']['length']?_0x73f30a[_0xd796('0x2f')]:_0x508e03['model'];if(!_0x216610[_0xd796('0x2a')][_0xd796('0x31')]('nolimit')){_0x73f30a[_0xd796('0x1b')]=qs['limit'](_0x216610['query'][_0xd796('0x1b')]);_0x73f30a[_0xd796('0x19')]=qs[_0xd796('0x19')](_0x216610[_0xd796('0x2a')][_0xd796('0x19')]);}_0x73f30a[_0xd796('0x32')]=qs['sort'](_0x216610[_0xd796('0x2a')][_0xd796('0x33')]);_0x73f30a['where']=qs[_0xd796('0x2c')](_[_0xd796('0x34')](_0x216610['query'],_0x508e03[_0xd796('0x2c')]),_0x2c11a3);if(_0x216610[_0xd796('0x2a')]['filter']){_0x73f30a[_0xd796('0x35')]=_['merge'](_0x73f30a[_0xd796('0x35')],{'$or':_[_0xd796('0x25')](_0x2c11a3,function(_0x3dfd58){if(_0x3dfd58[_0xd796('0x36')]!==_0xd796('0x37')){var _0x263dd3={};_0x263dd3[_0x3dfd58[_0xd796('0x29')]]={'$like':'%'+_0x216610[_0xd796('0x2a')]['filter']+'%'};return _0x263dd3;}})});}_0x73f30a=_['merge']({},_0x73f30a,_0x216610[_0xd796('0x38')]);var _0x13351e={'where':_0x73f30a[_0xd796('0x35')]};return db[_0xd796('0x26')][_0xd796('0x39')](_0x13351e)[_0xd796('0x22')](function(_0x28255d){_0x2cc5b4[_0xd796('0x39')]=_0x28255d;if(_0x216610[_0xd796('0x2a')]['includeAll']){_0x73f30a[_0xd796('0x3a')]=[{'all':!![]}];}return db[_0xd796('0x26')]['findAll'](_0x73f30a);})[_0xd796('0x22')](function(_0x4a1f2e){_0x2cc5b4['rows']=_0x4a1f2e;return _0x2cc5b4;})[_0xd796('0x22')](respondWithFilteredResult(_0x47a546,_0x73f30a))['catch'](handleError(_0x47a546,null));};exports[_0xd796('0x3b')]=function(_0x3a04da,_0x4f8cc6){var _0x52b32c={'raw':!![],'where':{'id':_0x3a04da['params']['id']}},_0x525956={};_0x525956[_0xd796('0x2e')]=_[_0xd796('0x2b')](db['ServicenowField'][_0xd796('0x27')]);_0x525956[_0xd796('0x2a')]=_[_0xd796('0x2b')](_0x3a04da[_0xd796('0x2a')]);_0x525956[_0xd796('0x2c')]=_['intersection'](_0x525956[_0xd796('0x2e')],_0x525956[_0xd796('0x2a')]);_0x52b32c[_0xd796('0x2f')]=_[_0xd796('0x2d')](_0x525956[_0xd796('0x2e')],qs[_0xd796('0x30')](_0x3a04da[_0xd796('0x2a')][_0xd796('0x30')]));_0x52b32c['attributes']=_0x52b32c[_0xd796('0x2f')]['length']?_0x52b32c[_0xd796('0x2f')]:_0x525956[_0xd796('0x2e')];if(_0x3a04da['query'][_0xd796('0x3c')]){_0x52b32c[_0xd796('0x3a')]=[{'all':!![]}];}_0x52b32c=_[_0xd796('0x3d')]({},_0x52b32c,_0x3a04da[_0xd796('0x38')]);return db[_0xd796('0x26')][_0xd796('0x3e')](_0x52b32c)[_0xd796('0x22')](handleEntityNotFound(_0x4f8cc6,null))[_0xd796('0x22')](respondWithResult(_0x4f8cc6,null))[_0xd796('0x3f')](handleError(_0x4f8cc6,null));};exports[_0xd796('0x40')]=function(_0x1814ff,_0x509184){return db[_0xd796('0x26')][_0xd796('0x40')](_0x1814ff[_0xd796('0x41')],{})['then'](respondWithResult(_0x509184,0xc9))[_0xd796('0x3f')](handleError(_0x509184,null));};exports['update']=function(_0x4f9d9d,_0x3a79c4){if(_0x4f9d9d[_0xd796('0x41')]['id']){delete _0x4f9d9d[_0xd796('0x41')]['id'];}return db['ServicenowField'][_0xd796('0x3e')]({'where':{'id':_0x4f9d9d['params']['id']}})[_0xd796('0x22')](handleEntityNotFound(_0x3a79c4,null))[_0xd796('0x22')](saveUpdates(_0x4f9d9d['body'],null))[_0xd796('0x22')](respondWithResult(_0x3a79c4,null))[_0xd796('0x3f')](handleError(_0x3a79c4,null));};exports[_0xd796('0x42')]=function(_0x442abc,_0x3963e8){return db[_0xd796('0x26')][_0xd796('0x3e')]({'where':{'id':_0x442abc[_0xd796('0x43')]['id']}})['then'](handleEntityNotFound(_0x3963e8,null))[_0xd796('0x22')](removeEntity(_0x3963e8,null))[_0xd796('0x3f')](handleError(_0x3963e8,null));}; \ No newline at end of file +var _0x200c=['end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','error','name','send','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','ServicenowField','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x358004,_0x26f5eb){var _0xea3c83=function(_0x3f2a3f){while(--_0x3f2a3f){_0x358004['push'](_0x358004['shift']());}};_0xea3c83(++_0x26f5eb);}(_0x200c,0xc3));var _0xc200=function(_0x5e455d,_0xadce9){_0x5e455d=_0x5e455d-0x0;var _0xe01a15=_0x200c[_0x5e455d];return _0xe01a15;};'use strict';var emlformat=require(_0xc200('0x0'));var rimraf=require(_0xc200('0x1'));var zipdir=require(_0xc200('0x2'));var jsonpatch=require(_0xc200('0x3'));var rp=require(_0xc200('0x4'));var moment=require(_0xc200('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc200('0x6'));var util=require(_0xc200('0x7'));var path=require('path');var sox=require(_0xc200('0x8'));var csv=require('to-csv');var ejs=require(_0xc200('0x9'));var fs=require('fs');var fs_extra=require(_0xc200('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc200('0xb'));var jsforce=require(_0xc200('0xc'));var deskjs=require(_0xc200('0xd'));var toCsv=require(_0xc200('0xe'));var querystring=require(_0xc200('0xf'));var Papa=require(_0xc200('0x10'));var Redis=require(_0xc200('0x11'));var authService=require(_0xc200('0x12'));var qs=require(_0xc200('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc200('0x14'));var logger=require(_0xc200('0x15'))(_0xc200('0x16'));var utils=require('../../config/utils');var config=require(_0xc200('0x17'));var licenseUtil=require(_0xc200('0x18'));var db=require(_0xc200('0x19'))['db'];function respondWithStatusCode(_0x9a7384,_0x47a2ff){_0x47a2ff=_0x47a2ff||0xcc;return function(_0x10d636){if(_0x10d636){return _0x9a7384[_0xc200('0x1a')](_0x47a2ff);}return _0x9a7384['status'](_0x47a2ff)[_0xc200('0x1b')]();};}function respondWithResult(_0x3eb722,_0x150f32){_0x150f32=_0x150f32||0xc8;return function(_0xba4f72){if(_0xba4f72){return _0x3eb722[_0xc200('0x1c')](_0x150f32)[_0xc200('0x1d')](_0xba4f72);}};}function respondWithFilteredResult(_0x54b864,_0xf7f8a6){return function(_0x3e9765){if(_0x3e9765){var _0x50e567=typeof _0xf7f8a6['offset']===_0xc200('0x1e')&&typeof _0xf7f8a6[_0xc200('0x1f')]===_0xc200('0x1e');var _0x5d1aa7=_0x3e9765['count'];var _0x568342=_0x50e567?0x0:_0xf7f8a6[_0xc200('0x20')];var _0x17f060=_0x50e567?_0x3e9765[_0xc200('0x21')]:_0xf7f8a6[_0xc200('0x20')]+_0xf7f8a6[_0xc200('0x1f')];var _0x9622c7;if(_0x17f060>=_0x5d1aa7){_0x17f060=_0x5d1aa7;_0x9622c7=0xc8;}else{_0x9622c7=0xce;}_0x54b864[_0xc200('0x1c')](_0x9622c7);return _0x54b864[_0xc200('0x22')](_0xc200('0x23'),_0x568342+'-'+_0x17f060+'/'+_0x5d1aa7)[_0xc200('0x1d')](_0x3e9765);}return null;};}function patchUpdates(_0x78c4e1){return function(_0x32c286){try{jsonpatch[_0xc200('0x24')](_0x32c286,_0x78c4e1,!![]);}catch(_0x5b309a){return BPromise['reject'](_0x5b309a);}return _0x32c286[_0xc200('0x25')]();};}function saveUpdates(_0x323078,_0x6f6dea){return function(_0x358a68){if(_0x358a68){return _0x358a68['update'](_0x323078)[_0xc200('0x26')](function(_0x35a37c){return _0x35a37c;});}return null;};}function removeEntity(_0x3aca38,_0x2047c5){return function(_0x12c4e8){if(_0x12c4e8){return _0x12c4e8[_0xc200('0x27')]()['then'](function(){_0x3aca38[_0xc200('0x1c')](0xcc)[_0xc200('0x1b')]();});}};}function handleEntityNotFound(_0x2084e2,_0x482a12){return function(_0x102f28){if(!_0x102f28){_0x2084e2[_0xc200('0x1a')](0x194);}return _0x102f28;};}function handleError(_0x5ad2d2,_0x1807be){_0x1807be=_0x1807be||0x1f4;return function(_0x4ec80d){logger[_0xc200('0x28')](_0x4ec80d['stack']);if(_0x4ec80d[_0xc200('0x29')]){delete _0x4ec80d[_0xc200('0x29')];}_0x5ad2d2[_0xc200('0x1c')](_0x1807be)[_0xc200('0x2a')](_0x4ec80d);};}exports['index']=function(_0x4e7268,_0x2d15e0){var _0x456a50={},_0xf8e46f={},_0x245906={'count':0x0,'rows':[]};var _0x5931ac=_['map'](db['ServicenowField'][_0xc200('0x2b')],function(_0x234ba1){return{'name':_0x234ba1['fieldName'],'type':_0x234ba1[_0xc200('0x2c')][_0xc200('0x2d')]};});_0xf8e46f[_0xc200('0x2e')]=_['map'](_0x5931ac,_0xc200('0x29'));_0xf8e46f[_0xc200('0x2f')]=_['keys'](_0x4e7268[_0xc200('0x2f')]);_0xf8e46f['filters']=_[_0xc200('0x30')](_0xf8e46f[_0xc200('0x2e')],_0xf8e46f[_0xc200('0x2f')]);_0x456a50[_0xc200('0x31')]=_[_0xc200('0x30')](_0xf8e46f['model'],qs[_0xc200('0x32')](_0x4e7268[_0xc200('0x2f')][_0xc200('0x32')]));_0x456a50['attributes']=_0x456a50[_0xc200('0x31')][_0xc200('0x33')]?_0x456a50['attributes']:_0xf8e46f[_0xc200('0x2e')];if(!_0x4e7268[_0xc200('0x2f')]['hasOwnProperty'](_0xc200('0x34'))){_0x456a50['limit']=qs['limit'](_0x4e7268[_0xc200('0x2f')][_0xc200('0x1f')]);_0x456a50[_0xc200('0x20')]=qs['offset'](_0x4e7268[_0xc200('0x2f')][_0xc200('0x20')]);}_0x456a50['order']=qs[_0xc200('0x35')](_0x4e7268[_0xc200('0x2f')]['sort']);_0x456a50[_0xc200('0x36')]=qs[_0xc200('0x37')](_[_0xc200('0x38')](_0x4e7268[_0xc200('0x2f')],_0xf8e46f[_0xc200('0x37')]),_0x5931ac);if(_0x4e7268['query'][_0xc200('0x39')]){_0x456a50[_0xc200('0x36')]=_[_0xc200('0x3a')](_0x456a50[_0xc200('0x36')],{'$or':_[_0xc200('0x3b')](_0x5931ac,function(_0x26e3ad){if(_0x26e3ad[_0xc200('0x2c')]!==_0xc200('0x3c')){var _0x2f6f6c={};_0x2f6f6c[_0x26e3ad[_0xc200('0x29')]]={'$like':'%'+_0x4e7268[_0xc200('0x2f')][_0xc200('0x39')]+'%'};return _0x2f6f6c;}})});}_0x456a50=_[_0xc200('0x3a')]({},_0x456a50,_0x4e7268[_0xc200('0x3d')]);var _0x100c24={'where':_0x456a50[_0xc200('0x36')]};return db['ServicenowField'][_0xc200('0x21')](_0x100c24)['then'](function(_0x4cba43){_0x245906[_0xc200('0x21')]=_0x4cba43;if(_0x4e7268[_0xc200('0x2f')][_0xc200('0x3e')]){_0x456a50[_0xc200('0x3f')]=[{'all':!![]}];}return db[_0xc200('0x40')][_0xc200('0x41')](_0x456a50);})[_0xc200('0x26')](function(_0x213451){_0x245906[_0xc200('0x42')]=_0x213451;return _0x245906;})[_0xc200('0x26')](respondWithFilteredResult(_0x2d15e0,_0x456a50))[_0xc200('0x43')](handleError(_0x2d15e0,null));};exports[_0xc200('0x44')]=function(_0x41c005,_0x3ab4e4){var _0x5b1248={'raw':!![],'where':{'id':_0x41c005['params']['id']}},_0x13fed0={};_0x13fed0[_0xc200('0x2e')]=_[_0xc200('0x45')](db['ServicenowField'][_0xc200('0x2b')]);_0x13fed0[_0xc200('0x2f')]=_[_0xc200('0x45')](_0x41c005['query']);_0x13fed0[_0xc200('0x37')]=_[_0xc200('0x30')](_0x13fed0['model'],_0x13fed0[_0xc200('0x2f')]);_0x5b1248[_0xc200('0x31')]=_['intersection'](_0x13fed0[_0xc200('0x2e')],qs[_0xc200('0x32')](_0x41c005[_0xc200('0x2f')]['fields']));_0x5b1248[_0xc200('0x31')]=_0x5b1248[_0xc200('0x31')][_0xc200('0x33')]?_0x5b1248['attributes']:_0x13fed0['model'];if(_0x41c005[_0xc200('0x2f')]['includeAll']){_0x5b1248[_0xc200('0x3f')]=[{'all':!![]}];}_0x5b1248=_[_0xc200('0x3a')]({},_0x5b1248,_0x41c005[_0xc200('0x3d')]);return db[_0xc200('0x40')][_0xc200('0x46')](_0x5b1248)[_0xc200('0x26')](handleEntityNotFound(_0x3ab4e4,null))[_0xc200('0x26')](respondWithResult(_0x3ab4e4,null))[_0xc200('0x43')](handleError(_0x3ab4e4,null));};exports[_0xc200('0x47')]=function(_0x7927f8,_0x425b10){return db['ServicenowField']['create'](_0x7927f8['body'],{})[_0xc200('0x26')](respondWithResult(_0x425b10,0xc9))[_0xc200('0x43')](handleError(_0x425b10,null));};exports['update']=function(_0x5db783,_0x1bba7e){if(_0x5db783[_0xc200('0x48')]['id']){delete _0x5db783['body']['id'];}return db[_0xc200('0x40')][_0xc200('0x46')]({'where':{'id':_0x5db783[_0xc200('0x49')]['id']}})[_0xc200('0x26')](handleEntityNotFound(_0x1bba7e,null))[_0xc200('0x26')](saveUpdates(_0x5db783[_0xc200('0x48')],null))[_0xc200('0x26')](respondWithResult(_0x1bba7e,null))[_0xc200('0x43')](handleError(_0x1bba7e,null));};exports['destroy']=function(_0x17d863,_0x5c13e7){return db[_0xc200('0x40')][_0xc200('0x46')]({'where':{'id':_0x17d863['params']['id']}})[_0xc200('0x26')](handleEntityNotFound(_0x5c13e7,null))[_0xc200('0x26')](removeEntity(_0x5c13e7,null))['catch'](handleError(_0x5c13e7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4f30ff7..2b017f0 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 _0x6fce=['./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x6fce,0x1e7));var _0xe6fc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6fce[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xe6fc('0x0'));var util=require(_0xe6fc('0x1'));var logger=require(_0xe6fc('0x2'))(_0xe6fc('0x3'));var moment=require(_0xe6fc('0x4'));var BPromise=require(_0xe6fc('0x5'));var rp=require(_0xe6fc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6fc('0x7'));var config=require(_0xe6fc('0x8'));var attributes=require(_0xe6fc('0x9'));module['exports']=function(_0x5be23e,_0x25f912){return _0x5be23e[_0xe6fc('0xa')](_0xe6fc('0xb'),attributes,{'tableName':_0xe6fc('0xc'),'paranoid':![],'indexes':[{'name':_0xe6fc('0xd'),'fields':[_0xe6fc('0xe'),_0xe6fc('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa169=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowField','servicenow_unique_index'];(function(_0x2222bf,_0x52b448){var _0x334ad0=function(_0x23b0a4){while(--_0x23b0a4){_0x2222bf['push'](_0x2222bf['shift']());}};_0x334ad0(++_0x52b448);}(_0xa169,0x1c0));var _0x9a16=function(_0x2e56ef,_0x582b72){_0x2e56ef=_0x2e56ef-0x0;var _0x3cb149=_0xa169[_0x2e56ef];return _0x3cb149;};'use strict';var _=require(_0x9a16('0x0'));var util=require(_0x9a16('0x1'));var logger=require(_0x9a16('0x2'))(_0x9a16('0x3'));var moment=require(_0x9a16('0x4'));var BPromise=require(_0x9a16('0x5'));var rp=require(_0x9a16('0x6'));var fs=require('fs');var path=require(_0x9a16('0x7'));var rimraf=require(_0x9a16('0x8'));var config=require(_0x9a16('0x9'));var attributes=require('./intServicenowField.attributes');module[_0x9a16('0xa')]=function(_0x29f605,_0x59f9cf){return _0x29f605[_0x9a16('0xb')](_0x9a16('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9a16('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 3643e5f..90f4c62 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x4313ba,_0x525b19){var _0x5f4d3a=function(_0x2feb46){while(--_0x2feb46){_0x4313ba['push'](_0x4313ba['shift']());}};_0x5f4d3a(++_0x525b19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4de260,_0x152cf1){var _0x548d7d=function(_0x4467d8){while(--_0x4467d8){_0x4de260['push'](_0x4de260['shift']());}};_0x548d7d(++_0x152cf1);}(_0x70e0,0x17b));var _0x070e=function(_0x37d5e6,_0x480536){_0x37d5e6=_0x37d5e6-0x0;var _0x4448ac=_0x70e0[_0x37d5e6];return _0x4448ac;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5ef765f..e825e8e 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(_0xa7ded9,_0x45015d){var _0x18fc6e=function(_0x3aadff){while(--_0x3aadff){_0xa7ded9['push'](_0xa7ded9['shift']());}};_0x18fc6e(++_0x45015d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x35823c,_0x4eeabe){var _0x2f19a4=function(_0x773c32){while(--_0x773c32){_0x35823c['push'](_0x35823c['shift']());}};_0x2f19a4(++_0x4eeabe);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f76d803..15aca25 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(_0xc4e4c,_0x21cfbf){var _0x1744dc=function(_0x3e6a09){while(--_0x3e6a09){_0xc4e4c['push'](_0xc4e4c['shift']());}};_0x1744dc(++_0x21cfbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x6d1b71,_0x41ddc2){var _0x222e85=function(_0x587725){while(--_0x587725){_0x6d1b71['push'](_0x6d1b71['shift']());}};_0x222e85(++_0x41ddc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 ba182c3..a482d3e 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 _0xb38a=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','pick','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x34ae48,_0x662ff5){var _0x19b539=function(_0x24a8fe){while(--_0x24a8fe){_0x34ae48['push'](_0x34ae48['shift']());}};_0x19b539(++_0x662ff5);}(_0xb38a,0x77));var _0xab38=function(_0x2ac3b2,_0x2cf74e){_0x2ac3b2=_0x2ac3b2-0x0;var _0x575191=_0xb38a[_0x2ac3b2];return _0x575191;};'use strict';var emlformat=require(_0xab38('0x0'));var rimraf=require(_0xab38('0x1'));var zipdir=require(_0xab38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab38('0x3'));var BPromise=require(_0xab38('0x4'));var Mustache=require(_0xab38('0x5'));var util=require(_0xab38('0x6'));var path=require(_0xab38('0x7'));var sox=require('sox');var csv=require(_0xab38('0x8'));var ejs=require(_0xab38('0x9'));var fs=require('fs');var fs_extra=require(_0xab38('0xa'));var _=require('lodash');var squel=require(_0xab38('0xb'));var crypto=require(_0xab38('0xc'));var jsforce=require(_0xab38('0xd'));var deskjs=require(_0xab38('0xe'));var toCsv=require('to-csv');var querystring=require(_0xab38('0xf'));var Papa=require(_0xab38('0x10'));var Redis=require(_0xab38('0x11'));var authService=require(_0xab38('0x12'));var qs=require(_0xab38('0x13'));var as=require(_0xab38('0x14'));var hardwareService=require(_0xab38('0x15'));var logger=require(_0xab38('0x16'))(_0xab38('0x17'));var utils=require(_0xab38('0x18'));var config=require(_0xab38('0x19'));var licenseUtil=require(_0xab38('0x1a'));var db=require(_0xab38('0x1b'))['db'];var integrations=require(_0xab38('0x1c'));function respondWithStatusCode(_0x2d4600,_0x486235){_0x486235=_0x486235||0xcc;return function(_0x1a7cc8){if(_0x1a7cc8){return _0x2d4600[_0xab38('0x1d')](_0x486235);}return _0x2d4600[_0xab38('0x1e')](_0x486235)[_0xab38('0x1f')]();};}function respondWithResult(_0x536964,_0x6cccb7){_0x6cccb7=_0x6cccb7||0xc8;return function(_0x37033b){if(_0x37033b){return _0x536964[_0xab38('0x1e')](_0x6cccb7)[_0xab38('0x20')](_0x37033b);}};}function respondWithFilteredResult(_0x194ea8,_0x4f4be2){return function(_0x2a6c5d){if(_0x2a6c5d){var _0x2206c0=typeof _0x4f4be2[_0xab38('0x21')]==='undefined'&&typeof _0x4f4be2[_0xab38('0x22')]===_0xab38('0x23');var _0x512de5=_0x2a6c5d[_0xab38('0x24')];var _0x495980=_0x2206c0?0x0:_0x4f4be2[_0xab38('0x21')];var _0x4e6a92=_0x2206c0?_0x2a6c5d['count']:_0x4f4be2[_0xab38('0x21')]+_0x4f4be2[_0xab38('0x22')];var _0x106dbf;if(_0x4e6a92>=_0x512de5){_0x4e6a92=_0x512de5;_0x106dbf=0xc8;}else{_0x106dbf=0xce;}_0x194ea8[_0xab38('0x1e')](_0x106dbf);return _0x194ea8[_0xab38('0x25')]('Content-Range',_0x495980+'-'+_0x4e6a92+'/'+_0x512de5)[_0xab38('0x20')](_0x2a6c5d);}return null;};}function patchUpdates(_0x4f721c){return function(_0x756873){try{jsonpatch[_0xab38('0x26')](_0x756873,_0x4f721c,!![]);}catch(_0x4c4b05){return BPromise[_0xab38('0x27')](_0x4c4b05);}return _0x756873[_0xab38('0x28')]();};}function saveUpdates(_0x379d8b,_0x289743){return function(_0x45fd18){if(_0x45fd18){return _0x45fd18[_0xab38('0x29')](_0x379d8b)[_0xab38('0x2a')](function(_0x4ac34c){return _0x4ac34c;});}return null;};}function removeEntity(_0x54e28f,_0x449192){return function(_0x455474){if(_0x455474){return _0x455474[_0xab38('0x2b')]()['then'](function(){_0x54e28f[_0xab38('0x1e')](0xcc)[_0xab38('0x1f')]();});}};}function handleEntityNotFound(_0xe84a9a,_0x45f787){return function(_0x15de43){if(!_0x15de43){_0xe84a9a['sendStatus'](0x194);}return _0x15de43;};}function handleError(_0xabea06,_0x21ebe5){_0x21ebe5=_0x21ebe5||0x1f4;return function(_0x136d2a){logger[_0xab38('0x2c')](_0x136d2a[_0xab38('0x2d')]);if(_0x136d2a[_0xab38('0x2e')]){delete _0x136d2a[_0xab38('0x2e')];}_0xabea06['status'](_0x21ebe5)[_0xab38('0x2f')](_0x136d2a);};}exports[_0xab38('0x30')]=function(_0x5b5a4a,_0x9f37b8){var _0x363ea0={},_0x126fac={},_0x104a21={'count':0x0,'rows':[]};var _0x1c33a1=_[_0xab38('0x31')](db['SugarcrmAccount']['rawAttributes'],function(_0x156395){return{'name':_0x156395['fieldName'],'type':_0x156395[_0xab38('0x32')][_0xab38('0x33')]};});_0x126fac['model']=_[_0xab38('0x31')](_0x1c33a1,_0xab38('0x2e'));_0x126fac[_0xab38('0x34')]=_[_0xab38('0x35')](_0x5b5a4a['query']);_0x126fac['filters']=_[_0xab38('0x36')](_0x126fac[_0xab38('0x37')],_0x126fac[_0xab38('0x34')]);_0x363ea0['attributes']=_['intersection'](_0x126fac[_0xab38('0x37')],qs[_0xab38('0x38')](_0x5b5a4a[_0xab38('0x34')][_0xab38('0x38')]));_0x363ea0['attributes']=_0x363ea0[_0xab38('0x39')][_0xab38('0x3a')]?_0x363ea0['attributes']:_0x126fac[_0xab38('0x37')];if(!_0x5b5a4a['query'][_0xab38('0x3b')](_0xab38('0x3c'))){_0x363ea0[_0xab38('0x22')]=qs[_0xab38('0x22')](_0x5b5a4a[_0xab38('0x34')]['limit']);_0x363ea0[_0xab38('0x21')]=qs[_0xab38('0x21')](_0x5b5a4a[_0xab38('0x34')][_0xab38('0x21')]);}_0x363ea0[_0xab38('0x3d')]=qs[_0xab38('0x3e')](_0x5b5a4a[_0xab38('0x34')]['sort']);_0x363ea0[_0xab38('0x3f')]=qs['filters'](_['pick'](_0x5b5a4a[_0xab38('0x34')],_0x126fac[_0xab38('0x40')]),_0x1c33a1);if(_0x5b5a4a['query'][_0xab38('0x41')]){_0x363ea0[_0xab38('0x3f')]=_[_0xab38('0x42')](_0x363ea0[_0xab38('0x3f')],{'$or':_[_0xab38('0x31')](_0x1c33a1,function(_0x58636f){if(_0x58636f[_0xab38('0x32')]!==_0xab38('0x43')){var _0x3a42a5={};_0x3a42a5[_0x58636f[_0xab38('0x2e')]]={'$like':'%'+_0x5b5a4a[_0xab38('0x34')]['filter']+'%'};return _0x3a42a5;}})});}_0x363ea0=_[_0xab38('0x42')]({},_0x363ea0,_0x5b5a4a[_0xab38('0x44')]);var _0x2b626d={'where':_0x363ea0[_0xab38('0x3f')]};return db[_0xab38('0x45')]['count'](_0x2b626d)[_0xab38('0x2a')](function(_0x2c70c3){_0x104a21[_0xab38('0x24')]=_0x2c70c3;if(_0x5b5a4a[_0xab38('0x34')][_0xab38('0x46')]){_0x363ea0['include']=[{'all':!![]}];}return db[_0xab38('0x45')][_0xab38('0x47')](_0x363ea0);})[_0xab38('0x2a')](function(_0x7103f8){_0x104a21[_0xab38('0x48')]=_0x7103f8;return _0x104a21;})[_0xab38('0x2a')](respondWithFilteredResult(_0x9f37b8,_0x363ea0))[_0xab38('0x49')](handleError(_0x9f37b8,null));};exports[_0xab38('0x4a')]=function(_0x12084d,_0x49bcd9){var _0x46d7fb={'raw':![],'where':{'id':_0x12084d[_0xab38('0x4b')]['id']}},_0x6a13aa={};_0x6a13aa[_0xab38('0x37')]=_[_0xab38('0x35')](db[_0xab38('0x45')]['rawAttributes']);_0x6a13aa[_0xab38('0x34')]=_[_0xab38('0x35')](_0x12084d[_0xab38('0x34')]);_0x6a13aa['filters']=_[_0xab38('0x36')](_0x6a13aa[_0xab38('0x37')],_0x6a13aa[_0xab38('0x34')]);_0x46d7fb[_0xab38('0x39')]=_[_0xab38('0x36')](_0x6a13aa[_0xab38('0x37')],qs[_0xab38('0x38')](_0x12084d[_0xab38('0x34')][_0xab38('0x38')]));_0x46d7fb[_0xab38('0x39')]=_0x46d7fb[_0xab38('0x39')][_0xab38('0x3a')]?_0x46d7fb['attributes']:_0x6a13aa[_0xab38('0x37')];if(_0x12084d[_0xab38('0x34')]['includeAll']){_0x46d7fb['include']=[{'all':!![]}];}_0x46d7fb=_['merge']({},_0x46d7fb,_0x12084d['options']);return db[_0xab38('0x45')][_0xab38('0x4c')](_0x46d7fb)[_0xab38('0x2a')](handleEntityNotFound(_0x49bcd9,null))[_0xab38('0x2a')](respondWithResult(_0x49bcd9,null))[_0xab38('0x49')](handleError(_0x49bcd9,null));};exports[_0xab38('0x4d')]=function(_0x4b0866,_0x5e3465){return db[_0xab38('0x45')][_0xab38('0x4d')](_0x4b0866[_0xab38('0x4e')],{})[_0xab38('0x2a')](respondWithResult(_0x5e3465,0xc9))['catch'](handleError(_0x5e3465,null));};exports[_0xab38('0x29')]=function(_0x5198f3,_0x15d188){if(_0x5198f3[_0xab38('0x4e')]['id']){delete _0x5198f3[_0xab38('0x4e')]['id'];}return db[_0xab38('0x45')][_0xab38('0x4c')]({'where':{'id':_0x5198f3['params']['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x15d188,null))[_0xab38('0x2a')](saveUpdates(_0x5198f3[_0xab38('0x4e')],null))[_0xab38('0x2a')](respondWithResult(_0x15d188,null))[_0xab38('0x49')](handleError(_0x15d188,null));};exports['destroy']=function(_0x491b8e,_0x924f97){return db[_0xab38('0x45')][_0xab38('0x4c')]({'where':{'id':_0x491b8e['params']['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x924f97,null))[_0xab38('0x2a')](removeEntity(_0x924f97,null))[_0xab38('0x49')](handleError(_0x924f97,null));};exports[_0xab38('0x4f')]=function(_0x686cbd,_0x1fd3d2,_0x4eeb72){var _0x15323c={};var _0x1e8c05={};var _0x1dd3ff;var _0x47c7a2;return db[_0xab38('0x45')][_0xab38('0x50')]({'where':{'id':_0x686cbd['params']['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x1fd3d2,null))[_0xab38('0x2a')](function(_0x45b845){if(_0x45b845){_0x1dd3ff=_0x45b845;_0x1e8c05['model']=_[_0xab38('0x35')](db[_0xab38('0x51')]['rawAttributes']);_0x1e8c05[_0xab38('0x34')]=_[_0xab38('0x35')](_0x686cbd[_0xab38('0x34')]);_0x1e8c05['filters']=_[_0xab38('0x36')](_0x1e8c05[_0xab38('0x37')],_0x1e8c05[_0xab38('0x34')]);_0x15323c[_0xab38('0x39')]=_[_0xab38('0x36')](_0x1e8c05[_0xab38('0x37')],qs[_0xab38('0x38')](_0x686cbd['query'][_0xab38('0x38')]));_0x15323c[_0xab38('0x39')]=_0x15323c[_0xab38('0x39')][_0xab38('0x3a')]?_0x15323c[_0xab38('0x39')]:_0x1e8c05[_0xab38('0x37')];_0x15323c[_0xab38('0x3d')]=qs[_0xab38('0x3e')](_0x686cbd[_0xab38('0x34')][_0xab38('0x3e')]);_0x15323c[_0xab38('0x3f')]=qs[_0xab38('0x40')](_[_0xab38('0x52')](_0x686cbd[_0xab38('0x34')],_0x1e8c05[_0xab38('0x40')]));if(_0x686cbd['query']['filter']){_0x15323c['where']=_[_0xab38('0x42')](_0x15323c[_0xab38('0x3f')],{'$or':_[_0xab38('0x31')](_0x15323c[_0xab38('0x39')],function(_0x5a3e9f){var _0x5cb570={};_0x5cb570[_0x5a3e9f]={'$like':'%'+_0x686cbd[_0xab38('0x34')][_0xab38('0x41')]+'%'};return _0x5cb570;})});}_0x15323c=_[_0xab38('0x42')]({},_0x15323c,_0x686cbd[_0xab38('0x44')]);return _0x1dd3ff['getConfigurations'](_0x15323c);}})[_0xab38('0x2a')](function(_0x2b4ccf){if(_0x2b4ccf){_0x47c7a2=_0x2b4ccf[_0xab38('0x3a')];if(!_0x686cbd[_0xab38('0x34')]['hasOwnProperty'](_0xab38('0x3c'))){_0x15323c[_0xab38('0x22')]=qs['limit'](_0x686cbd['query']['limit']);_0x15323c[_0xab38('0x21')]=qs[_0xab38('0x21')](_0x686cbd[_0xab38('0x34')][_0xab38('0x21')]);}return _0x1dd3ff[_0xab38('0x4f')](_0x15323c);}})['then'](function(_0x5094c2){if(_0x5094c2){return _0x5094c2?{'count':_0x47c7a2,'rows':_0x5094c2}:null;}})['then'](respondWithResult(_0x1fd3d2,null))[_0xab38('0x49')](handleError(_0x1fd3d2,null));};exports['addConfiguration']=function(_0x1d4586,_0x5e5625,_0x1e30f4){if(_0x1d4586['body']['id']){delete _0x1d4586[_0xab38('0x4e')]['id'];}return db[_0xab38('0x45')][_0xab38('0x50')]({'where':{'id':_0x1d4586[_0xab38('0x4b')]['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x5e5625,null))[_0xab38('0x2a')](function(_0x56ea67){if(_0x56ea67){_0x1d4586[_0xab38('0x4e')][_0xab38('0x53')]=_0x56ea67['id'];_0x1d4586[_0xab38('0x4e')][_0xab38('0x54')]=integrations[_0xab38('0x55')](_0x1d4586['body'][_0xab38('0x56')],_0x1d4586[_0xab38('0x4e')][_0xab38('0x32')]);_0x1d4586[_0xab38('0x4e')]['Descriptions']=integrations[_0xab38('0x57')](_0x1d4586[_0xab38('0x4e')][_0xab38('0x56')],_0x1d4586['body']['type']);return db[_0xab38('0x51')][_0xab38('0x4d')](_0x1d4586[_0xab38('0x4e')],{'include':[{'model':db[_0xab38('0x58')],'as':'Subjects'},{'model':db[_0xab38('0x58')],'as':_0xab38('0x59')}]});}return null;})[_0xab38('0x2a')](respondWithResult(_0x5e5625,null))[_0xab38('0x49')](handleError(_0x5e5625,null));};exports[_0xab38('0x5a')]=function(_0xaf746b,_0x1e9b18,_0xd8325){var _0x429199='';var _0x184135=['id','name','assigned_user_id',_0xab38('0x5b'),_0xab38('0x5c'),_0xab38('0x5d'),_0xab38('0x5e'),_0xab38('0x5f'),'parent_id',_0xab38('0x60'),_0xab38('0x61'),_0xab38('0x62')];return db[_0xab38('0x45')][_0xab38('0x50')]({'where':{'id':_0xaf746b[_0xab38('0x4b')]['id']},'attributes':['id',_0xab38('0x63'),_0xab38('0x64'),_0xab38('0x65')]})['then'](handleEntityNotFound(_0x1e9b18,null))[_0xab38('0x2a')](function(_0x293bac){if(_0x293bac){_0x429199=_0x293bac[_0xab38('0x65')];var _0x4add4a=_0x429199[_0xab38('0x66')](-0x1);if(_0x4add4a==='/'){_0x429199=_0x429199[_0xab38('0x67')](0x0,_0x429199[_0xab38('0x68')](_0x4add4a));}return rp({'method':_0xab38('0x69'),'uri':util[_0xab38('0x6a')](_0xab38('0x6b'),_0x429199,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xab38('0x6c'),'input_type':_0xab38('0x6d'),'response_type':_0xab38('0x6d'),'rest_data':JSON[_0xab38('0x6e')]({'user_auth':{'user_name':_0x293bac[_0xab38('0x63')],'password':_0x293bac[_0xab38('0x64')],'encryption':_0xab38('0x6f')},'application':_0xab38('0x70')})}});}})[_0xab38('0x2a')](function(_0x4f30e9){if(_0x4f30e9&&_0x4f30e9['name']!==_0xab38('0x71')&&_0x4f30e9[_0xab38('0x2e')]!==_0xab38('0x72')){return rp({'method':_0xab38('0x69'),'uri':util['format']('%s%s',_0x429199,_0xab38('0x73')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xab38('0x6d'),'response_type':_0xab38('0x6d'),'rest_data':JSON[_0xab38('0x6e')]({'session':_0x4f30e9['id'],'module_name':_0xab38('0x74')})}})[_0xab38('0x2a')](function(_0xd6a482){if(_0xd6a482){var _0x204845=_[_0xab38('0x75')](_0xd6a482[_0xab38('0x76')]);_[_0xab38('0x77')](_0x204845,function(_0x1852f0){return _0x184135['includes'](_0x1852f0[_0xab38('0x2e')]);});return{'count':_0x204845[_0xab38('0x3a')],'rows':_[_0xab38('0x31')](_0x204845,function(_0x337c72){return{'id':_0x337c72[_0xab38('0x2e')],'name':_0x337c72[_0xab38('0x78')],'custom':_[_0xab38('0x79')](_0x337c72['name'],'_c')?!![]:![],'options':_0x337c72[_0xab38('0x44')]?_[_0xab38('0x31')](_[_0xab38('0x75')](_0x337c72['options']),function(_0x274ed0){return{'name':_0x274ed0[_0xab38('0x7a')],'value':_0x274ed0['name']};}):[]};})};}})[_0xab38('0x2a')](respondWithResult(_0x1e9b18,null))[_0xab38('0x49')](function(_0x5135f0){var _0x11b7c1=_0xaf746b[_0xab38('0x34')][_0xab38('0x7b')]?0x1f4:_0x5135f0[_0xab38('0x7c')]||0x1f4;logger[_0xab38('0x2c')](_0xab38('0x7d'),_0xab38('0x5a'),_0x11b7c1,JSON['stringify'](_0x5135f0));delete _0x5135f0['name'];if(_0x11b7c1===0x191){_0x11b7c1=0x190;}_0x1e9b18[_0xab38('0x1e')](_0x11b7c1)['send'](_0xaf746b[_0xab38('0x34')][_0xab38('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x5135f0[_0xab38('0x7c')]}:_0x5135f0);});}else{var _0x5029b4=0x1f4;_0x1e9b18[_0xab38('0x1e')](_0x5029b4)[_0xab38('0x2f')]({'message':_0xab38('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5cc0=['params','length','find','create','body','destroy','getConfigurations','findOne','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','Calls','values','module_fields','remove','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','count','offset','limit','set','reject','save','update','then','error','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x3c312e,_0x4e247f){var _0x40ce61=function(_0x1911f7){while(--_0x1911f7){_0x3c312e['push'](_0x3c312e['shift']());}};_0x40ce61(++_0x4e247f);}(_0x5cc0,0x11c));var _0x05cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cc0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x05cc('0x0'));var rimraf=require(_0x05cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x05cc('0x2'));var moment=require(_0x05cc('0x3'));var BPromise=require(_0x05cc('0x4'));var Mustache=require(_0x05cc('0x5'));var util=require('util');var path=require(_0x05cc('0x6'));var sox=require(_0x05cc('0x7'));var csv=require(_0x05cc('0x8'));var ejs=require(_0x05cc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05cc('0xa'));var crypto=require(_0x05cc('0xb'));var jsforce=require(_0x05cc('0xc'));var deskjs=require(_0x05cc('0xd'));var toCsv=require(_0x05cc('0x8'));var querystring=require(_0x05cc('0xe'));var Papa=require(_0x05cc('0xf'));var Redis=require(_0x05cc('0x10'));var authService=require(_0x05cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x05cc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05cc('0x13'))(_0x05cc('0x14'));var utils=require(_0x05cc('0x15'));var config=require(_0x05cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x05cc('0x17'))['db'];var integrations=require(_0x05cc('0x18'));function respondWithStatusCode(_0x48e9b6,_0x2f0306){_0x2f0306=_0x2f0306||0xcc;return function(_0x193a6e){if(_0x193a6e){return _0x48e9b6['sendStatus'](_0x2f0306);}return _0x48e9b6['status'](_0x2f0306)[_0x05cc('0x19')]();};}function respondWithResult(_0x5425a3,_0x161e46){_0x161e46=_0x161e46||0xc8;return function(_0x43c375){if(_0x43c375){return _0x5425a3[_0x05cc('0x1a')](_0x161e46)[_0x05cc('0x1b')](_0x43c375);}};}function respondWithFilteredResult(_0x2db400,_0x34cceb){return function(_0x4da5bb){if(_0x4da5bb){var _0x2578d3=typeof _0x34cceb['offset']==='undefined'&&typeof _0x34cceb['limit']===_0x05cc('0x1c');var _0x36b076=_0x4da5bb[_0x05cc('0x1d')];var _0x1c9c55=_0x2578d3?0x0:_0x34cceb[_0x05cc('0x1e')];var _0x55e086=_0x2578d3?_0x4da5bb[_0x05cc('0x1d')]:_0x34cceb['offset']+_0x34cceb[_0x05cc('0x1f')];var _0x32cc71;if(_0x55e086>=_0x36b076){_0x55e086=_0x36b076;_0x32cc71=0xc8;}else{_0x32cc71=0xce;}_0x2db400['status'](_0x32cc71);return _0x2db400[_0x05cc('0x20')]('Content-Range',_0x1c9c55+'-'+_0x55e086+'/'+_0x36b076)[_0x05cc('0x1b')](_0x4da5bb);}return null;};}function patchUpdates(_0x2b8690){return function(_0x473388){try{jsonpatch['apply'](_0x473388,_0x2b8690,!![]);}catch(_0x12c085){return BPromise[_0x05cc('0x21')](_0x12c085);}return _0x473388[_0x05cc('0x22')]();};}function saveUpdates(_0x11c39,_0x452464){return function(_0xbec3ec){if(_0xbec3ec){return _0xbec3ec[_0x05cc('0x23')](_0x11c39)[_0x05cc('0x24')](function(_0x4e3573){return _0x4e3573;});}return null;};}function removeEntity(_0x44d44e,_0x3bbb00){return function(_0xc3803a){if(_0xc3803a){return _0xc3803a['destroy']()[_0x05cc('0x24')](function(){_0x44d44e['status'](0xcc)[_0x05cc('0x19')]();});}};}function handleEntityNotFound(_0x2663ff,_0xb85d1a){return function(_0x3cc5cf){if(!_0x3cc5cf){_0x2663ff['sendStatus'](0x194);}return _0x3cc5cf;};}function handleError(_0x1d63f5,_0x5dc568){_0x5dc568=_0x5dc568||0x1f4;return function(_0x582a8f){logger[_0x05cc('0x25')](_0x582a8f['stack']);if(_0x582a8f[_0x05cc('0x26')]){delete _0x582a8f[_0x05cc('0x26')];}_0x1d63f5[_0x05cc('0x1a')](_0x5dc568)['send'](_0x582a8f);};}exports[_0x05cc('0x27')]=function(_0x5cb663,_0xb6412d){var _0x59768f={},_0x205624={},_0x585c51={'count':0x0,'rows':[]};var _0x4f0bbb=_[_0x05cc('0x28')](db[_0x05cc('0x29')][_0x05cc('0x2a')],function(_0x372806){return{'name':_0x372806[_0x05cc('0x2b')],'type':_0x372806[_0x05cc('0x2c')][_0x05cc('0x2d')]};});_0x205624[_0x05cc('0x2e')]=_[_0x05cc('0x28')](_0x4f0bbb,_0x05cc('0x26'));_0x205624[_0x05cc('0x2f')]=_[_0x05cc('0x30')](_0x5cb663[_0x05cc('0x2f')]);_0x205624[_0x05cc('0x31')]=_[_0x05cc('0x32')](_0x205624[_0x05cc('0x2e')],_0x205624[_0x05cc('0x2f')]);_0x59768f[_0x05cc('0x33')]=_['intersection'](_0x205624[_0x05cc('0x2e')],qs[_0x05cc('0x34')](_0x5cb663[_0x05cc('0x2f')]['fields']));_0x59768f['attributes']=_0x59768f[_0x05cc('0x33')]['length']?_0x59768f[_0x05cc('0x33')]:_0x205624[_0x05cc('0x2e')];if(!_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x35')]('nolimit')){_0x59768f[_0x05cc('0x1f')]=qs[_0x05cc('0x1f')](_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x1f')]);_0x59768f[_0x05cc('0x1e')]=qs[_0x05cc('0x1e')](_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x1e')]);}_0x59768f[_0x05cc('0x36')]=qs[_0x05cc('0x37')](_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x37')]);_0x59768f[_0x05cc('0x38')]=qs[_0x05cc('0x31')](_['pick'](_0x5cb663[_0x05cc('0x2f')],_0x205624[_0x05cc('0x31')]),_0x4f0bbb);if(_0x5cb663['query'][_0x05cc('0x39')]){_0x59768f['where']=_[_0x05cc('0x3a')](_0x59768f[_0x05cc('0x38')],{'$or':_[_0x05cc('0x28')](_0x4f0bbb,function(_0x5a645b){if(_0x5a645b[_0x05cc('0x2c')]!==_0x05cc('0x3b')){var _0x32895b={};_0x32895b[_0x5a645b[_0x05cc('0x26')]]={'$like':'%'+_0x5cb663[_0x05cc('0x2f')]['filter']+'%'};return _0x32895b;}})});}_0x59768f=_[_0x05cc('0x3a')]({},_0x59768f,_0x5cb663[_0x05cc('0x3c')]);var _0x4cae89={'where':_0x59768f[_0x05cc('0x38')]};return db[_0x05cc('0x29')][_0x05cc('0x1d')](_0x4cae89)[_0x05cc('0x24')](function(_0x5e8420){_0x585c51[_0x05cc('0x1d')]=_0x5e8420;if(_0x5cb663[_0x05cc('0x2f')][_0x05cc('0x3d')]){_0x59768f[_0x05cc('0x3e')]=[{'all':!![]}];}return db[_0x05cc('0x29')][_0x05cc('0x3f')](_0x59768f);})['then'](function(_0x2c63a3){_0x585c51[_0x05cc('0x40')]=_0x2c63a3;return _0x585c51;})[_0x05cc('0x24')](respondWithFilteredResult(_0xb6412d,_0x59768f))[_0x05cc('0x41')](handleError(_0xb6412d,null));};exports[_0x05cc('0x42')]=function(_0x3eedc5,_0x3a32ce){var _0x481b5c={'raw':![],'where':{'id':_0x3eedc5[_0x05cc('0x43')]['id']}},_0x15d842={};_0x15d842[_0x05cc('0x2e')]=_[_0x05cc('0x30')](db['SugarcrmAccount'][_0x05cc('0x2a')]);_0x15d842[_0x05cc('0x2f')]=_[_0x05cc('0x30')](_0x3eedc5[_0x05cc('0x2f')]);_0x15d842[_0x05cc('0x31')]=_[_0x05cc('0x32')](_0x15d842['model'],_0x15d842[_0x05cc('0x2f')]);_0x481b5c[_0x05cc('0x33')]=_[_0x05cc('0x32')](_0x15d842[_0x05cc('0x2e')],qs['fields'](_0x3eedc5[_0x05cc('0x2f')][_0x05cc('0x34')]));_0x481b5c[_0x05cc('0x33')]=_0x481b5c[_0x05cc('0x33')][_0x05cc('0x44')]?_0x481b5c[_0x05cc('0x33')]:_0x15d842['model'];if(_0x3eedc5[_0x05cc('0x2f')][_0x05cc('0x3d')]){_0x481b5c[_0x05cc('0x3e')]=[{'all':!![]}];}_0x481b5c=_[_0x05cc('0x3a')]({},_0x481b5c,_0x3eedc5[_0x05cc('0x3c')]);return db[_0x05cc('0x29')][_0x05cc('0x45')](_0x481b5c)[_0x05cc('0x24')](handleEntityNotFound(_0x3a32ce,null))[_0x05cc('0x24')](respondWithResult(_0x3a32ce,null))[_0x05cc('0x41')](handleError(_0x3a32ce,null));};exports[_0x05cc('0x46')]=function(_0x231ea1,_0x1d73b5){return db['SugarcrmAccount'][_0x05cc('0x46')](_0x231ea1[_0x05cc('0x47')],{})[_0x05cc('0x24')](respondWithResult(_0x1d73b5,0xc9))[_0x05cc('0x41')](handleError(_0x1d73b5,null));};exports[_0x05cc('0x23')]=function(_0x320cec,_0x33ac6a){if(_0x320cec[_0x05cc('0x47')]['id']){delete _0x320cec[_0x05cc('0x47')]['id'];}return db[_0x05cc('0x29')][_0x05cc('0x45')]({'where':{'id':_0x320cec['params']['id']}})[_0x05cc('0x24')](handleEntityNotFound(_0x33ac6a,null))[_0x05cc('0x24')](saveUpdates(_0x320cec[_0x05cc('0x47')],null))['then'](respondWithResult(_0x33ac6a,null))[_0x05cc('0x41')](handleError(_0x33ac6a,null));};exports[_0x05cc('0x48')]=function(_0x696600,_0x5b8afe){return db[_0x05cc('0x29')][_0x05cc('0x45')]({'where':{'id':_0x696600[_0x05cc('0x43')]['id']}})[_0x05cc('0x24')](handleEntityNotFound(_0x5b8afe,null))['then'](removeEntity(_0x5b8afe,null))[_0x05cc('0x41')](handleError(_0x5b8afe,null));};exports[_0x05cc('0x49')]=function(_0x294beb,_0x233cc8,_0x1c6e64){var _0x53fd2e={};var _0x26359f={};var _0x536212;var _0x1d6df3;return db[_0x05cc('0x29')][_0x05cc('0x4a')]({'where':{'id':_0x294beb[_0x05cc('0x43')]['id']}})[_0x05cc('0x24')](handleEntityNotFound(_0x233cc8,null))[_0x05cc('0x24')](function(_0x178bc7){if(_0x178bc7){_0x536212=_0x178bc7;_0x26359f[_0x05cc('0x2e')]=_[_0x05cc('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x26359f[_0x05cc('0x2f')]=_['keys'](_0x294beb[_0x05cc('0x2f')]);_0x26359f[_0x05cc('0x31')]=_[_0x05cc('0x32')](_0x26359f[_0x05cc('0x2e')],_0x26359f['query']);_0x53fd2e[_0x05cc('0x33')]=_[_0x05cc('0x32')](_0x26359f['model'],qs[_0x05cc('0x34')](_0x294beb[_0x05cc('0x2f')]['fields']));_0x53fd2e[_0x05cc('0x33')]=_0x53fd2e[_0x05cc('0x33')][_0x05cc('0x44')]?_0x53fd2e[_0x05cc('0x33')]:_0x26359f['model'];_0x53fd2e['order']=qs[_0x05cc('0x37')](_0x294beb[_0x05cc('0x2f')][_0x05cc('0x37')]);_0x53fd2e[_0x05cc('0x38')]=qs['filters'](_['pick'](_0x294beb['query'],_0x26359f[_0x05cc('0x31')]));if(_0x294beb[_0x05cc('0x2f')][_0x05cc('0x39')]){_0x53fd2e[_0x05cc('0x38')]=_[_0x05cc('0x3a')](_0x53fd2e[_0x05cc('0x38')],{'$or':_['map'](_0x53fd2e[_0x05cc('0x33')],function(_0x1fc4dc){var _0x176514={};_0x176514[_0x1fc4dc]={'$like':'%'+_0x294beb[_0x05cc('0x2f')][_0x05cc('0x39')]+'%'};return _0x176514;})});}_0x53fd2e=_[_0x05cc('0x3a')]({},_0x53fd2e,_0x294beb[_0x05cc('0x3c')]);return _0x536212[_0x05cc('0x49')](_0x53fd2e);}})[_0x05cc('0x24')](function(_0x110186){if(_0x110186){_0x1d6df3=_0x110186['length'];if(!_0x294beb[_0x05cc('0x2f')]['hasOwnProperty'](_0x05cc('0x4b'))){_0x53fd2e[_0x05cc('0x1f')]=qs[_0x05cc('0x1f')](_0x294beb[_0x05cc('0x2f')][_0x05cc('0x1f')]);_0x53fd2e[_0x05cc('0x1e')]=qs['offset'](_0x294beb[_0x05cc('0x2f')][_0x05cc('0x1e')]);}return _0x536212[_0x05cc('0x49')](_0x53fd2e);}})['then'](function(_0x2c4593){if(_0x2c4593){return _0x2c4593?{'count':_0x1d6df3,'rows':_0x2c4593}:null;}})['then'](respondWithResult(_0x233cc8,null))[_0x05cc('0x41')](handleError(_0x233cc8,null));};exports[_0x05cc('0x4c')]=function(_0x5a9823,_0x5e2b00,_0x30f9f1){if(_0x5a9823[_0x05cc('0x47')]['id']){delete _0x5a9823[_0x05cc('0x47')]['id'];}return db[_0x05cc('0x29')][_0x05cc('0x4a')]({'where':{'id':_0x5a9823['params']['id']}})['then'](handleEntityNotFound(_0x5e2b00,null))[_0x05cc('0x24')](function(_0x1a532b){if(_0x1a532b){_0x5a9823[_0x05cc('0x47')][_0x05cc('0x4d')]=_0x1a532b['id'];_0x5a9823['body']['Subjects']=integrations[_0x05cc('0x4e')](_0x5a9823[_0x05cc('0x47')][_0x05cc('0x4f')],_0x5a9823['body']['type']);_0x5a9823[_0x05cc('0x47')][_0x05cc('0x50')]=integrations['getDescriptions'](_0x5a9823['body'][_0x05cc('0x4f')],_0x5a9823['body'][_0x05cc('0x2c')]);return db[_0x05cc('0x51')][_0x05cc('0x46')](_0x5a9823[_0x05cc('0x47')],{'include':[{'model':db[_0x05cc('0x52')],'as':_0x05cc('0x53')},{'model':db[_0x05cc('0x52')],'as':'Descriptions'}]});}return null;})[_0x05cc('0x24')](respondWithResult(_0x5e2b00,null))[_0x05cc('0x41')](handleError(_0x5e2b00,null));};exports[_0x05cc('0x54')]=function(_0x19a1c9,_0x1b6dbc,_0xea07b9){var _0x307f89='';var _0x49d437=['id',_0x05cc('0x26'),_0x05cc('0x55'),_0x05cc('0x56'),_0x05cc('0x57'),_0x05cc('0x58'),'duration_hours','duration_minutes',_0x05cc('0x59'),_0x05cc('0x5a'),_0x05cc('0x5b'),_0x05cc('0x5c')];return db[_0x05cc('0x29')]['findOne']({'where':{'id':_0x19a1c9[_0x05cc('0x43')]['id']},'attributes':['id',_0x05cc('0x5d'),_0x05cc('0x5e'),'remoteUri']})[_0x05cc('0x24')](handleEntityNotFound(_0x1b6dbc,null))[_0x05cc('0x24')](function(_0x5473b9){if(_0x5473b9){_0x307f89=_0x5473b9[_0x05cc('0x5f')];var _0x5ad24d=_0x307f89[_0x05cc('0x60')](-0x1);if(_0x5ad24d==='/'){_0x307f89=_0x307f89[_0x05cc('0x61')](0x0,_0x307f89[_0x05cc('0x62')](_0x5ad24d));}return rp({'method':'POST','uri':util[_0x05cc('0x63')]('%s%s',_0x307f89,_0x05cc('0x64')),'json':!![],'form':{'method':'login','input_type':_0x05cc('0x65'),'response_type':_0x05cc('0x65'),'rest_data':JSON[_0x05cc('0x66')]({'user_auth':{'user_name':_0x5473b9[_0x05cc('0x5d')],'password':_0x5473b9[_0x05cc('0x5e')],'encryption':_0x05cc('0x67')},'application':_0x05cc('0x68')})}});}})['then'](function(_0x42d1d5){if(_0x42d1d5&&_0x42d1d5['name']!=='Invalid\x20Login'&&_0x42d1d5[_0x05cc('0x26')]!==_0x05cc('0x69')){return rp({'method':'POST','uri':util[_0x05cc('0x63')](_0x05cc('0x6a'),_0x307f89,_0x05cc('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x05cc('0x65'),'rest_data':JSON[_0x05cc('0x66')]({'session':_0x42d1d5['id'],'module_name':_0x05cc('0x6b')})}})[_0x05cc('0x24')](function(_0x1eaf50){if(_0x1eaf50){var _0x46c025=_[_0x05cc('0x6c')](_0x1eaf50[_0x05cc('0x6d')]);_[_0x05cc('0x6e')](_0x46c025,function(_0x1ed4a8){return _0x49d437['includes'](_0x1ed4a8[_0x05cc('0x26')]);});return{'count':_0x46c025[_0x05cc('0x44')],'rows':_[_0x05cc('0x28')](_0x46c025,function(_0x337b4b){return{'id':_0x337b4b['name'],'name':_0x337b4b['label'],'custom':_['endsWith'](_0x337b4b['name'],'_c')?!![]:![],'options':_0x337b4b[_0x05cc('0x3c')]?_[_0x05cc('0x28')](_[_0x05cc('0x6c')](_0x337b4b['options']),function(_0x375eb5){return{'name':_0x375eb5[_0x05cc('0x6f')],'value':_0x375eb5[_0x05cc('0x26')]};}):[]};})};}})[_0x05cc('0x24')](respondWithResult(_0x1b6dbc,null))[_0x05cc('0x41')](function(_0x211435){var _0x356b7c=_0x19a1c9['query'][_0x05cc('0x70')]?0x1f4:_0x211435[_0x05cc('0x71')]||0x1f4;logger[_0x05cc('0x25')](_0x05cc('0x72'),_0x05cc('0x54'),_0x356b7c,JSON[_0x05cc('0x66')](_0x211435));delete _0x211435['name'];if(_0x356b7c===0x191){_0x356b7c=0x190;}_0x1b6dbc[_0x05cc('0x1a')](_0x356b7c)[_0x05cc('0x73')](_0x19a1c9['query'][_0x05cc('0x70')]?{'message':_0x05cc('0x74'),'statusCode':_0x211435['statusCode']}:_0x211435);});}else{var _0x179a0c=0x1f4;_0x1b6dbc[_0x05cc('0x1a')](_0x179a0c)[_0x05cc('0x73')]({'message':_0x05cc('0x74'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 7b3c734..aeac589 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 _0x6a31=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','api','bluebird','request-promise','path'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6a31,0x73));var _0x16a3=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x6a31[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0x16a3('0x0'));var util=require(_0x16a3('0x1'));var logger=require('../../config/logger')(_0x16a3('0x2'));var moment=require('moment');var BPromise=require(_0x16a3('0x3'));var rp=require(_0x16a3('0x4'));var fs=require('fs');var path=require(_0x16a3('0x5'));var rimraf=require(_0x16a3('0x6'));var config=require('../../config/environment');var attributes=require(_0x16a3('0x7'));var integrations=require(_0x16a3('0x8'));module['exports']=function(_0x3efb6,_0x1e9576){return _0x3efb6[_0x16a3('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x16a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44a8=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x17a7fa,_0x5599b8){var _0x4669c1=function(_0x48685d){while(--_0x48685d){_0x17a7fa['push'](_0x17a7fa['shift']());}};_0x4669c1(++_0x5599b8);}(_0x44a8,0x8f));var _0x844a=function(_0x3109d6,_0x461617){_0x3109d6=_0x3109d6-0x0;var _0x3776b3=_0x44a8[_0x3109d6];return _0x3776b3;};'use strict';var _=require(_0x844a('0x0'));var util=require(_0x844a('0x1'));var logger=require(_0x844a('0x2'))(_0x844a('0x3'));var moment=require('moment');var BPromise=require(_0x844a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x844a('0x5'));var rimraf=require(_0x844a('0x6'));var config=require(_0x844a('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x844a('0x8'));module[_0x844a('0x9')]=function(_0x374a84,_0x19f881){return _0x374a84[_0x844a('0xa')](_0x844a('0xb'),attributes,{'tableName':_0x844a('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 66440ff..1616a06 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 _0x3d51=['SugarcrmAccount','findAll','options','raw','limit','include','map','model','attributes','find','where','then','ShowSugarcrmAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSugarcrmAccount'];(function(_0x368925,_0x5eb79f){var _0x525faf=function(_0x547543){while(--_0x547543){_0x368925['push'](_0x368925['shift']());}};_0x525faf(++_0x5eb79f);}(_0x3d51,0x89));var _0x13d5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3d51[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x13d5('0x0'));var util=require(_0x13d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x13d5('0x2'));var fs=require('fs');var Redis=require(_0x13d5('0x3'));var db=require(_0x13d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x13d5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x13d5('0x6')][_0x13d5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5519f5,_0x394f56,_0x1f734d){return new BPromise(function(_0x172676,_0x39eb7b){return client['request'](_0x5519f5,_0x1f734d)['then'](function(_0x1ac179){logger[_0x13d5('0x8')](_0x13d5('0x9'),_0x394f56,_0x13d5('0xa'));logger[_0x13d5('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x394f56,_0x13d5('0xa'),JSON['stringify'](_0x1ac179));if(_0x1ac179[_0x13d5('0xc')]){if(_0x1ac179[_0x13d5('0xc')][_0x13d5('0xd')]===0x1f4){logger[_0x13d5('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x394f56,_0x1ac179['error'][_0x13d5('0xe')]);return _0x39eb7b(_0x1ac179['error']['message']);}logger[_0x13d5('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x394f56,_0x1ac179[_0x13d5('0xc')][_0x13d5('0xe')]);return _0x172676(_0x1ac179['error'][_0x13d5('0xe')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x394f56,_0x13d5('0xa'));_0x172676(_0x1ac179[_0x13d5('0xf')][_0x13d5('0xe')]);}})[_0x13d5('0x10')](function(_0x399648){logger['error'](_0x13d5('0x9'),_0x394f56,_0x399648);_0x39eb7b(_0x399648);});});}exports[_0x13d5('0x11')]=function(_0x433d1f){var _0x558528=this;return new Promise(function(_0x150baf,_0x2bc276){return db[_0x13d5('0x12')][_0x13d5('0x13')]({'raw':_0x433d1f[_0x13d5('0x14')]?_0x433d1f[_0x13d5('0x14')][_0x13d5('0x15')]===undefined?!![]:![]:!![],'where':_0x433d1f[_0x13d5('0x14')]?_0x433d1f[_0x13d5('0x14')]['where']||null:null,'attributes':_0x433d1f['options']?_0x433d1f[_0x13d5('0x14')]['attributes']||null:null,'limit':_0x433d1f[_0x13d5('0x14')]?_0x433d1f[_0x13d5('0x14')][_0x13d5('0x16')]||null:null,'include':_0x433d1f[_0x13d5('0x14')]?_0x433d1f['options'][_0x13d5('0x17')]?_[_0x13d5('0x18')](_0x433d1f[_0x13d5('0x14')][_0x13d5('0x17')],function(_0x2e03be){return{'model':db[_0x2e03be[_0x13d5('0x19')]],'as':_0x2e03be['as'],'attributes':_0x2e03be['attributes'],'include':_0x2e03be['include']?_['map'](_0x2e03be[_0x13d5('0x17')],function(_0x6db63c){return{'model':db[_0x6db63c[_0x13d5('0x19')]],'as':_0x6db63c['as'],'attributes':_0x6db63c[_0x13d5('0x1a')],'include':_0x6db63c[_0x13d5('0x17')]?_[_0x13d5('0x18')](_0x6db63c[_0x13d5('0x17')],function(_0x58f3af){return{'model':db[_0x58f3af['model']],'as':_0x58f3af['as'],'attributes':_0x58f3af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3edb8e){logger[_0x13d5('0x8')]('GetSugarcrmAccount',_0x433d1f);logger[_0x13d5('0xb')]('GetSugarcrmAccount',_0x433d1f,JSON['stringify'](_0x3edb8e));_0x150baf(_0x3edb8e);})[_0x13d5('0x10')](function(_0x2c84c9){logger['error'](_0x13d5('0x11'),_0x2c84c9[_0x13d5('0xe')],_0x433d1f);_0x2bc276(_0x558528[_0x13d5('0xc')](0x1f4,_0x2c84c9[_0x13d5('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0x150008){var _0x10523c=this;return new Promise(function(_0x2d862a,_0x476f0f){return db['SugarcrmAccount'][_0x13d5('0x1b')]({'raw':_0x150008[_0x13d5('0x14')]?_0x150008[_0x13d5('0x14')][_0x13d5('0x15')]===undefined?!![]:![]:!![],'where':_0x150008['options']?_0x150008[_0x13d5('0x14')][_0x13d5('0x1c')]||null:null,'attributes':_0x150008[_0x13d5('0x14')]?_0x150008['options']['attributes']||null:null,'include':_0x150008[_0x13d5('0x14')]?_0x150008[_0x13d5('0x14')][_0x13d5('0x17')]?_['map'](_0x150008[_0x13d5('0x14')][_0x13d5('0x17')],function(_0x1bb3f9){return{'model':db[_0x1bb3f9[_0x13d5('0x19')]],'as':_0x1bb3f9['as'],'attributes':_0x1bb3f9[_0x13d5('0x1a')],'include':_0x1bb3f9[_0x13d5('0x17')]?_[_0x13d5('0x18')](_0x1bb3f9['include'],function(_0x21f4ed){return{'model':db[_0x21f4ed['model']],'as':_0x21f4ed['as'],'attributes':_0x21f4ed['attributes'],'include':_0x21f4ed[_0x13d5('0x17')]?_[_0x13d5('0x18')](_0x21f4ed[_0x13d5('0x17')],function(_0x5d91b5){return{'model':db[_0x5d91b5[_0x13d5('0x19')]],'as':_0x5d91b5['as'],'attributes':_0x5d91b5[_0x13d5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x13d5('0x1d')](function(_0x5ee036){logger[_0x13d5('0x8')](_0x13d5('0x1e'),_0x150008);logger[_0x13d5('0xb')](_0x13d5('0x1e'),_0x150008,JSON['stringify'](_0x5ee036));_0x2d862a(_0x5ee036);})[_0x13d5('0x10')](function(_0x2d77ac){logger['error'](_0x13d5('0x1e'),_0x2d77ac[_0x13d5('0xe')],_0x150008);_0x476f0f(_0x10523c[_0x13d5('0xc')](0x1f4,_0x2d77ac[_0x13d5('0xe')]));});});}; \ No newline at end of file +var _0x7ef9=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1bf7d3,_0xaceb98){var _0x39facd=function(_0x319806){while(--_0x319806){_0x1bf7d3['push'](_0x1bf7d3['shift']());}};_0x39facd(++_0xaceb98);}(_0x7ef9,0x65));var _0x97ef=function(_0x56acd3,_0x1b1121){_0x56acd3=_0x56acd3-0x0;var _0x1bfeb9=_0x7ef9[_0x56acd3];return _0x1bfeb9;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var moment=require(_0x97ef('0x2'));var BPromise=require(_0x97ef('0x3'));var rs=require(_0x97ef('0x4'));var fs=require('fs');var Redis=require(_0x97ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x97ef('0x6'));var logger=require('../../config/logger')(_0x97ef('0x7'));var config=require(_0x97ef('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x97ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c618d,_0x19697e,_0x5d5aca){return new BPromise(function(_0x199578,_0x6e5593){return client[_0x97ef('0xa')](_0x3c618d,_0x5d5aca)[_0x97ef('0xb')](function(_0x9ed803){logger[_0x97ef('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x19697e,_0x97ef('0xd'));logger[_0x97ef('0xe')](_0x97ef('0xf'),_0x19697e,_0x97ef('0xd'),JSON[_0x97ef('0x10')](_0x9ed803));if(_0x9ed803['error']){if(_0x9ed803[_0x97ef('0x11')][_0x97ef('0x12')]===0x1f4){logger[_0x97ef('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x19697e,_0x9ed803[_0x97ef('0x11')][_0x97ef('0x13')]);return _0x6e5593(_0x9ed803['error']['message']);}logger[_0x97ef('0x11')](_0x97ef('0x14'),_0x19697e,_0x9ed803[_0x97ef('0x11')][_0x97ef('0x13')]);return _0x199578(_0x9ed803[_0x97ef('0x11')][_0x97ef('0x13')]);}else{logger[_0x97ef('0xc')](_0x97ef('0x14'),_0x19697e,_0x97ef('0xd'));_0x199578(_0x9ed803[_0x97ef('0x15')][_0x97ef('0x13')]);}})[_0x97ef('0x16')](function(_0x5ad014){logger['error'](_0x97ef('0x14'),_0x19697e,_0x5ad014);_0x6e5593(_0x5ad014);});});}exports[_0x97ef('0x17')]=function(_0x2a6bcf){var _0x312b7a=this;return new Promise(function(_0x17cdb2,_0x162ad5){return db[_0x97ef('0x18')][_0x97ef('0x19')]({'raw':_0x2a6bcf['options']?_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a6bcf[_0x97ef('0x1a')]?_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1c')]||null:null,'attributes':_0x2a6bcf[_0x97ef('0x1a')]?_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1d')]||null:null,'limit':_0x2a6bcf['options']?_0x2a6bcf['options'][_0x97ef('0x1e')]||null:null,'include':_0x2a6bcf[_0x97ef('0x1a')]?_0x2a6bcf['options'][_0x97ef('0x1f')]?_[_0x97ef('0x20')](_0x2a6bcf[_0x97ef('0x1a')][_0x97ef('0x1f')],function(_0x1ace6a){return{'model':db[_0x1ace6a['model']],'as':_0x1ace6a['as'],'attributes':_0x1ace6a[_0x97ef('0x1d')],'include':_0x1ace6a[_0x97ef('0x1f')]?_[_0x97ef('0x20')](_0x1ace6a['include'],function(_0x332916){return{'model':db[_0x332916[_0x97ef('0x21')]],'as':_0x332916['as'],'attributes':_0x332916['attributes'],'include':_0x332916[_0x97ef('0x1f')]?_[_0x97ef('0x20')](_0x332916[_0x97ef('0x1f')],function(_0x6297d5){return{'model':db[_0x6297d5[_0x97ef('0x21')]],'as':_0x6297d5['as'],'attributes':_0x6297d5[_0x97ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0xb')](function(_0x442256){logger[_0x97ef('0xc')](_0x97ef('0x17'),_0x2a6bcf);logger[_0x97ef('0xe')](_0x97ef('0x17'),_0x2a6bcf,JSON['stringify'](_0x442256));_0x17cdb2(_0x442256);})['catch'](function(_0x4101a0){logger[_0x97ef('0x11')](_0x97ef('0x17'),_0x4101a0[_0x97ef('0x13')],_0x2a6bcf);_0x162ad5(_0x312b7a[_0x97ef('0x11')](0x1f4,_0x4101a0[_0x97ef('0x13')]));});});};exports[_0x97ef('0x22')]=function(_0x1607ce){var _0x160e25=this;return new Promise(function(_0x21626b,_0xccb660){return db['SugarcrmAccount'][_0x97ef('0x23')]({'raw':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')][_0x97ef('0x1c')]||null:null,'attributes':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')][_0x97ef('0x1d')]||null:null,'include':_0x1607ce[_0x97ef('0x1a')]?_0x1607ce[_0x97ef('0x1a')][_0x97ef('0x1f')]?_['map'](_0x1607ce[_0x97ef('0x1a')]['include'],function(_0x4a4485){return{'model':db[_0x4a4485['model']],'as':_0x4a4485['as'],'attributes':_0x4a4485['attributes'],'include':_0x4a4485['include']?_[_0x97ef('0x20')](_0x4a4485[_0x97ef('0x1f')],function(_0x5291a4){return{'model':db[_0x5291a4[_0x97ef('0x21')]],'as':_0x5291a4['as'],'attributes':_0x5291a4['attributes'],'include':_0x5291a4['include']?_[_0x97ef('0x20')](_0x5291a4[_0x97ef('0x1f')],function(_0x1c1479){return{'model':db[_0x1c1479[_0x97ef('0x21')]],'as':_0x1c1479['as'],'attributes':_0x1c1479[_0x97ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0xb')](function(_0x3375f9){logger[_0x97ef('0xc')](_0x97ef('0x22'),_0x1607ce);logger[_0x97ef('0xe')]('ShowSugarcrmAccount',_0x1607ce,JSON[_0x97ef('0x10')](_0x3375f9));_0x21626b(_0x3375f9);})[_0x97ef('0x16')](function(_0x54e6bd){logger[_0x97ef('0x11')](_0x97ef('0x22'),_0x54e6bd[_0x97ef('0x13')],_0x1607ce);_0xccb660(_0x160e25['error'](0x1f4,_0x54e6bd[_0x97ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index cb89df9..392497a 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 _0xf69b=['getDescriptions','post','create','put','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4a4563,_0x2771c3){var _0x201be1=function(_0x32505c){while(--_0x32505c){_0x4a4563['push'](_0x4a4563['shift']());}};_0x201be1(++_0x2771c3);}(_0xf69b,0xcc));var _0xbf69=function(_0x48db1a,_0x4f89fd){_0x48db1a=_0x48db1a-0x0;var _0x5e46d9=_0xf69b[_0x48db1a];return _0x5e46d9;};'use strict';var multer=require('multer');var util=require(_0xbf69('0x0'));var path=require(_0xbf69('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf69('0x2')]();var fs_extra=require(_0xbf69('0x3'));var auth=require(_0xbf69('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf69('0x5'));var controller=require(_0xbf69('0x6'));router['get']('/',auth[_0xbf69('0x7')](),controller[_0xbf69('0x8')]);router['get'](_0xbf69('0x9'),auth[_0xbf69('0x7')](),controller[_0xbf69('0xa')]);router[_0xbf69('0xb')](_0xbf69('0xc'),auth['isAuthenticated'](),controller[_0xbf69('0xd')]);router[_0xbf69('0xb')](_0xbf69('0xe'),auth[_0xbf69('0x7')](),controller[_0xbf69('0xf')]);router[_0xbf69('0xb')]('/:id/descriptions',auth[_0xbf69('0x7')](),controller[_0xbf69('0x10')]);router[_0xbf69('0x11')]('/',auth[_0xbf69('0x7')](),controller[_0xbf69('0x12')]);router[_0xbf69('0x13')](_0xbf69('0x9'),auth[_0xbf69('0x7')](),controller['update']);router[_0xbf69('0x14')](_0xbf69('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf69('0x15')]=router; \ No newline at end of file +var _0xb3eb=['../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2695ae,_0x42b3e8){var _0x498db5=function(_0x282b9a){while(--_0x282b9a){_0x2695ae['push'](_0x2695ae['shift']());}};_0x498db5(++_0x42b3e8);}(_0xb3eb,0xea));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbb3e('0x0'));var util=require('util');var path=require(_0xbb3e('0x1'));var timeout=require(_0xbb3e('0x2'));var express=require(_0xbb3e('0x3'));var router=express[_0xbb3e('0x4')]();var fs_extra=require(_0xbb3e('0x5'));var auth=require(_0xbb3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb3e('0x7'));var controller=require(_0xbb3e('0x8'));router[_0xbb3e('0x9')]('/',auth[_0xbb3e('0xa')](),controller[_0xbb3e('0xb')]);router[_0xbb3e('0x9')](_0xbb3e('0xc'),auth[_0xbb3e('0xa')](),controller[_0xbb3e('0xd')]);router['get'](_0xbb3e('0xe'),auth[_0xbb3e('0xa')](),controller['getFields']);router[_0xbb3e('0x9')](_0xbb3e('0xf'),auth[_0xbb3e('0xa')](),controller['getSubjects']);router[_0xbb3e('0x9')](_0xbb3e('0x10'),auth[_0xbb3e('0xa')](),controller[_0xbb3e('0x11')]);router[_0xbb3e('0x12')]('/',auth['isAuthenticated'](),controller[_0xbb3e('0x13')]);router[_0xbb3e('0x14')](_0xbb3e('0xc'),auth['isAuthenticated'](),controller[_0xbb3e('0x15')]);router[_0xbb3e('0x16')](_0xbb3e('0xc'),auth[_0xbb3e('0xa')](),controller['destroy']);module[_0xbb3e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7ee4145..0216a09 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 _0x9037=['exports','sequelize'];(function(_0x395319,_0x47e29f){var _0xb9a1d6=function(_0x3bdb99){while(--_0x3bdb99){_0x395319['push'](_0x395319['shift']());}};_0xb9a1d6(++_0x47e29f);}(_0x9037,0xbb));var _0x7903=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9037[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7903('0x0'));module[_0x7903('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9984=['exports','STRING','sequelize'];(function(_0x2a7cd1,_0x2119fe){var _0x16681c=function(_0x108dea){while(--_0x108dea){_0x2a7cd1['push'](_0x2a7cd1['shift']());}};_0x16681c(++_0x2119fe);}(_0x9984,0xd4));var _0x4998=function(_0x10a627,_0x35a21c){_0x10a627=_0x10a627-0x0;var _0x2149a4=_0x9984[_0x10a627];return _0x2149a4;};'use strict';var Sequelize=require(_0x4998('0x0'));module[_0x4998('0x1')]={'name':{'type':Sequelize[_0x4998('0x2')]},'description':{'type':Sequelize[_0x4998('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f3a722e..300b820 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 _0x4329=['reject','save','update','then','destroy','sendStatus','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','apply'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x4329,0x169));var _0x9432=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4329[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x9432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9432('0x1'));var jsonpatch=require(_0x9432('0x2'));var rp=require(_0x9432('0x3'));var moment=require(_0x9432('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9432('0x5'));var util=require(_0x9432('0x6'));var path=require(_0x9432('0x7'));var sox=require(_0x9432('0x8'));var csv=require('to-csv');var ejs=require(_0x9432('0x9'));var fs=require('fs');var fs_extra=require(_0x9432('0xa'));var _=require(_0x9432('0xb'));var squel=require('squel');var crypto=require(_0x9432('0xc'));var jsforce=require(_0x9432('0xd'));var deskjs=require(_0x9432('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9432('0xf'));var Papa=require(_0x9432('0x10'));var Redis=require(_0x9432('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9432('0x12'));var as=require(_0x9432('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9432('0x14'))(_0x9432('0x15'));var utils=require(_0x9432('0x16'));var config=require(_0x9432('0x17'));var licenseUtil=require(_0x9432('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8486,_0xf1547){_0xf1547=_0xf1547||0xcc;return function(_0x175f70){if(_0x175f70){return _0x2c8486['sendStatus'](_0xf1547);}return _0x2c8486['status'](_0xf1547)[_0x9432('0x19')]();};}function respondWithResult(_0x2e189c,_0x12a8db){_0x12a8db=_0x12a8db||0xc8;return function(_0x33e5e5){if(_0x33e5e5){return _0x2e189c['status'](_0x12a8db)[_0x9432('0x1a')](_0x33e5e5);}};}function respondWithFilteredResult(_0x55a561,_0x2d6aeb){return function(_0x4f6774){if(_0x4f6774){var _0x78c6e8=typeof _0x2d6aeb[_0x9432('0x1b')]===_0x9432('0x1c')&&typeof _0x2d6aeb[_0x9432('0x1d')]===_0x9432('0x1c');var _0xbc1761=_0x4f6774['count'];var _0x509cad=_0x78c6e8?0x0:_0x2d6aeb[_0x9432('0x1b')];var _0x1755ac=_0x78c6e8?_0x4f6774[_0x9432('0x1e')]:_0x2d6aeb[_0x9432('0x1b')]+_0x2d6aeb[_0x9432('0x1d')];var _0x538e08;if(_0x1755ac>=_0xbc1761){_0x1755ac=_0xbc1761;_0x538e08=0xc8;}else{_0x538e08=0xce;}_0x55a561[_0x9432('0x1f')](_0x538e08);return _0x55a561[_0x9432('0x20')]('Content-Range',_0x509cad+'-'+_0x1755ac+'/'+_0xbc1761)[_0x9432('0x1a')](_0x4f6774);}return null;};}function patchUpdates(_0x457a53){return function(_0x4ca6d3){try{jsonpatch[_0x9432('0x21')](_0x4ca6d3,_0x457a53,!![]);}catch(_0x4487a3){return BPromise[_0x9432('0x22')](_0x4487a3);}return _0x4ca6d3[_0x9432('0x23')]();};}function saveUpdates(_0x417b4c,_0x1c1545){return function(_0x1ac44d){if(_0x1ac44d){return _0x1ac44d[_0x9432('0x24')](_0x417b4c)[_0x9432('0x25')](function(_0x3fa877){return _0x3fa877;});}return null;};}function removeEntity(_0x2d024e,_0x3981e3){return function(_0x4d8c07){if(_0x4d8c07){return _0x4d8c07[_0x9432('0x26')]()[_0x9432('0x25')](function(){_0x2d024e[_0x9432('0x1f')](0xcc)[_0x9432('0x19')]();});}};}function handleEntityNotFound(_0x598173,_0x446136){return function(_0x4f931e){if(!_0x4f931e){_0x598173[_0x9432('0x27')](0x194);}return _0x4f931e;};}function handleError(_0x1ac5bc,_0xfc6ec6){_0xfc6ec6=_0xfc6ec6||0x1f4;return function(_0x10a9dc){logger['error'](_0x10a9dc[_0x9432('0x28')]);if(_0x10a9dc[_0x9432('0x29')]){delete _0x10a9dc[_0x9432('0x29')];}_0x1ac5bc[_0x9432('0x1f')](_0xfc6ec6)['send'](_0x10a9dc);};}exports[_0x9432('0x2a')]=function(_0x33c195,_0x2038bf){var _0x42a7fd={},_0x5e8431={},_0x3e642c={'count':0x0,'rows':[]};var _0x66564b=_[_0x9432('0x2b')](db[_0x9432('0x2c')][_0x9432('0x2d')],function(_0x3da176){return{'name':_0x3da176[_0x9432('0x2e')],'type':_0x3da176[_0x9432('0x2f')]['key']};});_0x5e8431[_0x9432('0x30')]=_[_0x9432('0x2b')](_0x66564b,_0x9432('0x29'));_0x5e8431[_0x9432('0x31')]=_['keys'](_0x33c195[_0x9432('0x31')]);_0x5e8431[_0x9432('0x32')]=_[_0x9432('0x33')](_0x5e8431[_0x9432('0x30')],_0x5e8431[_0x9432('0x31')]);_0x42a7fd[_0x9432('0x34')]=_['intersection'](_0x5e8431['model'],qs[_0x9432('0x35')](_0x33c195[_0x9432('0x31')][_0x9432('0x35')]));_0x42a7fd[_0x9432('0x34')]=_0x42a7fd[_0x9432('0x34')][_0x9432('0x36')]?_0x42a7fd[_0x9432('0x34')]:_0x5e8431[_0x9432('0x30')];if(!_0x33c195['query'][_0x9432('0x37')](_0x9432('0x38'))){_0x42a7fd[_0x9432('0x1d')]=qs[_0x9432('0x1d')](_0x33c195[_0x9432('0x31')][_0x9432('0x1d')]);_0x42a7fd[_0x9432('0x1b')]=qs[_0x9432('0x1b')](_0x33c195[_0x9432('0x31')][_0x9432('0x1b')]);}_0x42a7fd['order']=qs['sort'](_0x33c195[_0x9432('0x31')][_0x9432('0x39')]);_0x42a7fd[_0x9432('0x3a')]=qs[_0x9432('0x32')](_[_0x9432('0x3b')](_0x33c195[_0x9432('0x31')],_0x5e8431[_0x9432('0x32')]),_0x66564b);if(_0x33c195[_0x9432('0x31')][_0x9432('0x3c')]){_0x42a7fd['where']=_[_0x9432('0x3d')](_0x42a7fd[_0x9432('0x3a')],{'$or':_['map'](_0x66564b,function(_0x3203ab){if(_0x3203ab[_0x9432('0x2f')]!=='VIRTUAL'){var _0x2c362c={};_0x2c362c[_0x3203ab[_0x9432('0x29')]]={'$like':'%'+_0x33c195['query'][_0x9432('0x3c')]+'%'};return _0x2c362c;}})});}_0x42a7fd=_[_0x9432('0x3d')]({},_0x42a7fd,_0x33c195[_0x9432('0x3e')]);var _0x5d18cc={'where':_0x42a7fd[_0x9432('0x3a')]};return db[_0x9432('0x2c')][_0x9432('0x1e')](_0x5d18cc)[_0x9432('0x25')](function(_0x116a5e){_0x3e642c[_0x9432('0x1e')]=_0x116a5e;if(_0x33c195[_0x9432('0x31')]['includeAll']){_0x42a7fd[_0x9432('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x9432('0x40')](_0x42a7fd);})[_0x9432('0x25')](function(_0x2c693c){_0x3e642c[_0x9432('0x41')]=_0x2c693c;return _0x3e642c;})['then'](respondWithFilteredResult(_0x2038bf,_0x42a7fd))['catch'](handleError(_0x2038bf,null));};exports['show']=function(_0x41cdf3,_0x58aa7a){var _0x3f7020={'raw':![],'where':{'id':_0x41cdf3[_0x9432('0x42')]['id']}},_0x404a78={};_0x404a78['model']=_[_0x9432('0x43')](db[_0x9432('0x2c')][_0x9432('0x2d')]);_0x404a78[_0x9432('0x31')]=_[_0x9432('0x43')](_0x41cdf3['query']);_0x404a78['filters']=_[_0x9432('0x33')](_0x404a78['model'],_0x404a78['query']);_0x3f7020[_0x9432('0x34')]=_[_0x9432('0x33')](_0x404a78[_0x9432('0x30')],qs[_0x9432('0x35')](_0x41cdf3['query'][_0x9432('0x35')]));_0x3f7020[_0x9432('0x34')]=_0x3f7020[_0x9432('0x34')][_0x9432('0x36')]?_0x3f7020[_0x9432('0x34')]:_0x404a78[_0x9432('0x30')];if(_0x41cdf3[_0x9432('0x31')][_0x9432('0x44')]){_0x3f7020[_0x9432('0x3f')]=[{'all':!![]}];}_0x3f7020=_['merge']({},_0x3f7020,_0x41cdf3[_0x9432('0x3e')]);return db['SugarcrmConfiguration'][_0x9432('0x45')](_0x3f7020)['then'](handleEntityNotFound(_0x58aa7a,null))[_0x9432('0x25')](respondWithResult(_0x58aa7a,null))[_0x9432('0x46')](handleError(_0x58aa7a,null));};exports[_0x9432('0x47')]=function(_0x4f251d,_0x232d74){return db[_0x9432('0x2c')][_0x9432('0x47')](_0x4f251d[_0x9432('0x48')],{})[_0x9432('0x25')](respondWithResult(_0x232d74,0xc9))[_0x9432('0x46')](handleError(_0x232d74,null));};exports[_0x9432('0x24')]=function(_0x4a729b,_0x248a63){if(_0x4a729b[_0x9432('0x48')]['id']){delete _0x4a729b[_0x9432('0x48')]['id'];}return db[_0x9432('0x2c')][_0x9432('0x45')]({'where':{'id':_0x4a729b[_0x9432('0x42')]['id']}})[_0x9432('0x25')](handleEntityNotFound(_0x248a63,null))[_0x9432('0x25')](saveUpdates(_0x4a729b[_0x9432('0x48')],null))[_0x9432('0x25')](respondWithResult(_0x248a63,null))[_0x9432('0x46')](handleError(_0x248a63,null));};exports[_0x9432('0x26')]=function(_0x51d9ed,_0x3239b2){return db[_0x9432('0x2c')]['find']({'where':{'id':_0x51d9ed[_0x9432('0x42')]['id']}})[_0x9432('0x25')](handleEntityNotFound(_0x3239b2,null))['then'](removeEntity(_0x3239b2,null))['catch'](handleError(_0x3239b2,null));};exports[_0x9432('0x49')]=function(_0x4ea5e3,_0x5c8ba6,_0x1938ea){var _0x1e6b79={};var _0x20333e={};var _0x3ee2b9;var _0x5e946b;return db[_0x9432('0x2c')][_0x9432('0x4a')]({'where':{'id':_0x4ea5e3['params']['id']}})['then'](handleEntityNotFound(_0x5c8ba6,null))['then'](function(_0x402064){if(_0x402064){_0x3ee2b9=_0x402064;_0x20333e[_0x9432('0x30')]=_[_0x9432('0x43')](db[_0x9432('0x4b')][_0x9432('0x2d')]);_0x20333e[_0x9432('0x31')]=_[_0x9432('0x43')](_0x4ea5e3[_0x9432('0x31')]);_0x20333e[_0x9432('0x32')]=_[_0x9432('0x33')](_0x20333e['model'],_0x20333e[_0x9432('0x31')]);_0x1e6b79[_0x9432('0x34')]=_[_0x9432('0x33')](_0x20333e['model'],qs[_0x9432('0x35')](_0x4ea5e3['query'][_0x9432('0x35')]));_0x1e6b79[_0x9432('0x34')]=_0x1e6b79[_0x9432('0x34')][_0x9432('0x36')]?_0x1e6b79[_0x9432('0x34')]:_0x20333e[_0x9432('0x30')];_0x1e6b79[_0x9432('0x4c')]=qs[_0x9432('0x39')](_0x4ea5e3['query']['sort']);_0x1e6b79[_0x9432('0x3a')]=qs[_0x9432('0x32')](_[_0x9432('0x3b')](_0x4ea5e3[_0x9432('0x31')],_0x20333e[_0x9432('0x32')]));if(_0x4ea5e3['query']['filter']){_0x1e6b79[_0x9432('0x3a')]=_[_0x9432('0x3d')](_0x1e6b79[_0x9432('0x3a')],{'$or':_['map'](_0x1e6b79[_0x9432('0x34')],function(_0x2b19c7){var _0x35c500={};_0x35c500[_0x2b19c7]={'$like':'%'+_0x4ea5e3[_0x9432('0x31')][_0x9432('0x3c')]+'%'};return _0x35c500;})});}_0x1e6b79=_[_0x9432('0x3d')]({},_0x1e6b79,_0x4ea5e3[_0x9432('0x3e')]);return _0x3ee2b9[_0x9432('0x49')](_0x1e6b79);}})[_0x9432('0x25')](function(_0x60b84e){if(_0x60b84e){_0x5e946b=_0x60b84e['length'];if(!_0x4ea5e3['query'][_0x9432('0x37')](_0x9432('0x38'))){_0x1e6b79['limit']=qs['limit'](_0x4ea5e3['query']['limit']);_0x1e6b79[_0x9432('0x1b')]=qs[_0x9432('0x1b')](_0x4ea5e3[_0x9432('0x31')][_0x9432('0x1b')]);}return _0x3ee2b9[_0x9432('0x49')](_0x1e6b79);}})['then'](function(_0x5a3423){if(_0x5a3423){return _0x5a3423?{'count':_0x5e946b,'rows':_0x5a3423}:null;}})[_0x9432('0x25')](respondWithResult(_0x5c8ba6,null))[_0x9432('0x46')](handleError(_0x5c8ba6,null));};exports[_0x9432('0x4d')]=function(_0x46d957,_0x70a25b,_0x40458a){var _0x4f8de4={};var _0x4a9c54={};var _0x208d86;var _0x1dc24d;return db[_0x9432('0x2c')][_0x9432('0x4a')]({'where':{'id':_0x46d957[_0x9432('0x42')]['id']}})[_0x9432('0x25')](handleEntityNotFound(_0x70a25b,null))['then'](function(_0x3590d1){if(_0x3590d1){_0x208d86=_0x3590d1;_0x4a9c54[_0x9432('0x30')]=_['keys'](db[_0x9432('0x4b')][_0x9432('0x2d')]);_0x4a9c54[_0x9432('0x31')]=_[_0x9432('0x43')](_0x46d957['query']);_0x4a9c54[_0x9432('0x32')]=_[_0x9432('0x33')](_0x4a9c54[_0x9432('0x30')],_0x4a9c54[_0x9432('0x31')]);_0x4f8de4[_0x9432('0x34')]=_[_0x9432('0x33')](_0x4a9c54[_0x9432('0x30')],qs[_0x9432('0x35')](_0x46d957[_0x9432('0x31')]['fields']));_0x4f8de4['attributes']=_0x4f8de4[_0x9432('0x34')][_0x9432('0x36')]?_0x4f8de4[_0x9432('0x34')]:_0x4a9c54[_0x9432('0x30')];_0x4f8de4[_0x9432('0x4c')]=qs[_0x9432('0x39')](_0x46d957[_0x9432('0x31')]['sort']);_0x4f8de4[_0x9432('0x3a')]=qs[_0x9432('0x32')](_[_0x9432('0x3b')](_0x46d957[_0x9432('0x31')],_0x4a9c54['filters']));if(_0x46d957[_0x9432('0x31')]['filter']){_0x4f8de4[_0x9432('0x3a')]=_[_0x9432('0x3d')](_0x4f8de4[_0x9432('0x3a')],{'$or':_[_0x9432('0x2b')](_0x4f8de4[_0x9432('0x34')],function(_0x32e9f4){var _0x2b601a={};_0x2b601a[_0x32e9f4]={'$like':'%'+_0x46d957[_0x9432('0x31')][_0x9432('0x3c')]+'%'};return _0x2b601a;})});}_0x4f8de4=_[_0x9432('0x3d')]({},_0x4f8de4,_0x46d957['options']);return _0x208d86[_0x9432('0x4d')](_0x4f8de4);}})[_0x9432('0x25')](function(_0x1f964c){if(_0x1f964c){_0x1dc24d=_0x1f964c[_0x9432('0x36')];if(!_0x46d957[_0x9432('0x31')]['hasOwnProperty'](_0x9432('0x38'))){_0x4f8de4[_0x9432('0x1d')]=qs['limit'](_0x46d957[_0x9432('0x31')][_0x9432('0x1d')]);_0x4f8de4[_0x9432('0x1b')]=qs['offset'](_0x46d957[_0x9432('0x31')][_0x9432('0x1b')]);}return _0x208d86[_0x9432('0x4d')](_0x4f8de4);}})[_0x9432('0x25')](function(_0x30ea9a){if(_0x30ea9a){return _0x30ea9a?{'count':_0x1dc24d,'rows':_0x30ea9a}:null;}})[_0x9432('0x25')](respondWithResult(_0x70a25b,null))[_0x9432('0x46')](handleError(_0x70a25b,null));};exports[_0x9432('0x4e')]=function(_0x420d78,_0x35b9e6,_0x14523b){var _0x29da8d={};var _0x5efbb2={};var _0x5b2642;var _0x1b6086;return db[_0x9432('0x2c')][_0x9432('0x4a')]({'where':{'id':_0x420d78[_0x9432('0x42')]['id']}})[_0x9432('0x25')](handleEntityNotFound(_0x35b9e6,null))[_0x9432('0x25')](function(_0x4db3fd){if(_0x4db3fd){_0x5b2642=_0x4db3fd;_0x5efbb2[_0x9432('0x30')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x5efbb2[_0x9432('0x31')]=_[_0x9432('0x43')](_0x420d78[_0x9432('0x31')]);_0x5efbb2[_0x9432('0x32')]=_[_0x9432('0x33')](_0x5efbb2[_0x9432('0x30')],_0x5efbb2['query']);_0x29da8d['attributes']=_[_0x9432('0x33')](_0x5efbb2[_0x9432('0x30')],qs[_0x9432('0x35')](_0x420d78[_0x9432('0x31')][_0x9432('0x35')]));_0x29da8d[_0x9432('0x34')]=_0x29da8d[_0x9432('0x34')]['length']?_0x29da8d[_0x9432('0x34')]:_0x5efbb2['model'];_0x29da8d['order']=qs[_0x9432('0x39')](_0x420d78['query']['sort']);_0x29da8d[_0x9432('0x3a')]=qs[_0x9432('0x32')](_[_0x9432('0x3b')](_0x420d78['query'],_0x5efbb2[_0x9432('0x32')]));if(_0x420d78[_0x9432('0x31')][_0x9432('0x3c')]){_0x29da8d[_0x9432('0x3a')]=_[_0x9432('0x3d')](_0x29da8d[_0x9432('0x3a')],{'$or':_[_0x9432('0x2b')](_0x29da8d[_0x9432('0x34')],function(_0x10332c){var _0x13f992={};_0x13f992[_0x10332c]={'$like':'%'+_0x420d78[_0x9432('0x31')][_0x9432('0x3c')]+'%'};return _0x13f992;})});}_0x29da8d=_[_0x9432('0x3d')]({},_0x29da8d,_0x420d78[_0x9432('0x3e')]);return _0x5b2642[_0x9432('0x4e')](_0x29da8d);}})['then'](function(_0x227e75){if(_0x227e75){_0x1b6086=_0x227e75[_0x9432('0x36')];if(!_0x420d78[_0x9432('0x31')][_0x9432('0x37')](_0x9432('0x38'))){_0x29da8d[_0x9432('0x1d')]=qs['limit'](_0x420d78[_0x9432('0x31')][_0x9432('0x1d')]);_0x29da8d[_0x9432('0x1b')]=qs['offset'](_0x420d78[_0x9432('0x31')][_0x9432('0x1b')]);}return _0x5b2642[_0x9432('0x4e')](_0x29da8d);}})['then'](function(_0x414ae7){if(_0x414ae7){return _0x414ae7?{'count':_0x1b6086,'rows':_0x414ae7}:null;}})[_0x9432('0x25')](respondWithResult(_0x35b9e6,null))[_0x9432('0x46')](handleError(_0x35b9e6,null));}; \ No newline at end of file +var _0x5ef2=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','SugarcrmConfiguration','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy','getFields','findOne','SugarcrmField','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus'];(function(_0x579dad,_0x200a74){var _0x3a53fa=function(_0x373cc0){while(--_0x373cc0){_0x579dad['push'](_0x579dad['shift']());}};_0x3a53fa(++_0x200a74);}(_0x5ef2,0x81));var _0x25ef=function(_0x475080,_0x4560c5){_0x475080=_0x475080-0x0;var _0x2c756b=_0x5ef2[_0x475080];return _0x2c756b;};'use strict';var emlformat=require(_0x25ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25ef('0x1'));var jsonpatch=require(_0x25ef('0x2'));var rp=require(_0x25ef('0x3'));var moment=require('moment');var BPromise=require(_0x25ef('0x4'));var Mustache=require(_0x25ef('0x5'));var util=require(_0x25ef('0x6'));var path=require(_0x25ef('0x7'));var sox=require(_0x25ef('0x8'));var csv=require('to-csv');var ejs=require(_0x25ef('0x9'));var fs=require('fs');var fs_extra=require(_0x25ef('0xa'));var _=require(_0x25ef('0xb'));var squel=require(_0x25ef('0xc'));var crypto=require(_0x25ef('0xd'));var jsforce=require(_0x25ef('0xe'));var deskjs=require(_0x25ef('0xf'));var toCsv=require(_0x25ef('0x10'));var querystring=require(_0x25ef('0x11'));var Papa=require('papaparse');var Redis=require(_0x25ef('0x12'));var authService=require(_0x25ef('0x13'));var qs=require(_0x25ef('0x14'));var as=require(_0x25ef('0x15'));var hardwareService=require(_0x25ef('0x16'));var logger=require('../../config/logger')(_0x25ef('0x17'));var utils=require(_0x25ef('0x18'));var config=require(_0x25ef('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302bb6,_0x569b03){_0x569b03=_0x569b03||0xcc;return function(_0x3dd5f3){if(_0x3dd5f3){return _0x302bb6['sendStatus'](_0x569b03);}return _0x302bb6[_0x25ef('0x1a')](_0x569b03)[_0x25ef('0x1b')]();};}function respondWithResult(_0x1714ef,_0x4b92c8){_0x4b92c8=_0x4b92c8||0xc8;return function(_0x2ff450){if(_0x2ff450){return _0x1714ef[_0x25ef('0x1a')](_0x4b92c8)[_0x25ef('0x1c')](_0x2ff450);}};}function respondWithFilteredResult(_0x2618cc,_0x400de3){return function(_0x1ac6a6){if(_0x1ac6a6){var _0x311789=typeof _0x400de3[_0x25ef('0x1d')]===_0x25ef('0x1e')&&typeof _0x400de3[_0x25ef('0x1f')]===_0x25ef('0x1e');var _0x3aa1ce=_0x1ac6a6[_0x25ef('0x20')];var _0xd351a9=_0x311789?0x0:_0x400de3[_0x25ef('0x1d')];var _0x5c99b9=_0x311789?_0x1ac6a6['count']:_0x400de3[_0x25ef('0x1d')]+_0x400de3[_0x25ef('0x1f')];var _0x297845;if(_0x5c99b9>=_0x3aa1ce){_0x5c99b9=_0x3aa1ce;_0x297845=0xc8;}else{_0x297845=0xce;}_0x2618cc[_0x25ef('0x1a')](_0x297845);return _0x2618cc[_0x25ef('0x21')](_0x25ef('0x22'),_0xd351a9+'-'+_0x5c99b9+'/'+_0x3aa1ce)[_0x25ef('0x1c')](_0x1ac6a6);}return null;};}function patchUpdates(_0x52616c){return function(_0x3b3832){try{jsonpatch['apply'](_0x3b3832,_0x52616c,!![]);}catch(_0xc27d4f){return BPromise[_0x25ef('0x23')](_0xc27d4f);}return _0x3b3832[_0x25ef('0x24')]();};}function saveUpdates(_0x2c2ad3,_0x3de520){return function(_0x9d2882){if(_0x9d2882){return _0x9d2882['update'](_0x2c2ad3)[_0x25ef('0x25')](function(_0x10bd82){return _0x10bd82;});}return null;};}function removeEntity(_0x25bbc4,_0x56b7d4){return function(_0x57b40d){if(_0x57b40d){return _0x57b40d['destroy']()[_0x25ef('0x25')](function(){_0x25bbc4['status'](0xcc)[_0x25ef('0x1b')]();});}};}function handleEntityNotFound(_0x5e7077,_0xfa824e){return function(_0x3b6907){if(!_0x3b6907){_0x5e7077[_0x25ef('0x26')](0x194);}return _0x3b6907;};}function handleError(_0x98af3,_0x5cea07){_0x5cea07=_0x5cea07||0x1f4;return function(_0x279100){logger[_0x25ef('0x27')](_0x279100[_0x25ef('0x28')]);if(_0x279100[_0x25ef('0x29')]){delete _0x279100[_0x25ef('0x29')];}_0x98af3[_0x25ef('0x1a')](_0x5cea07)[_0x25ef('0x2a')](_0x279100);};}exports[_0x25ef('0x2b')]=function(_0xa14798,_0x3c4f57){var _0x1017d1={},_0x4010ed={},_0x32514b={'count':0x0,'rows':[]};var _0x447ff5=_[_0x25ef('0x2c')](db['SugarcrmConfiguration'][_0x25ef('0x2d')],function(_0xe54ba0){return{'name':_0xe54ba0[_0x25ef('0x2e')],'type':_0xe54ba0[_0x25ef('0x2f')][_0x25ef('0x30')]};});_0x4010ed[_0x25ef('0x31')]=_[_0x25ef('0x2c')](_0x447ff5,'name');_0x4010ed['query']=_[_0x25ef('0x32')](_0xa14798[_0x25ef('0x33')]);_0x4010ed['filters']=_[_0x25ef('0x34')](_0x4010ed['model'],_0x4010ed['query']);_0x1017d1[_0x25ef('0x35')]=_[_0x25ef('0x34')](_0x4010ed[_0x25ef('0x31')],qs['fields'](_0xa14798[_0x25ef('0x33')]['fields']));_0x1017d1[_0x25ef('0x35')]=_0x1017d1[_0x25ef('0x35')][_0x25ef('0x36')]?_0x1017d1[_0x25ef('0x35')]:_0x4010ed[_0x25ef('0x31')];if(!_0xa14798[_0x25ef('0x33')]['hasOwnProperty'](_0x25ef('0x37'))){_0x1017d1[_0x25ef('0x1f')]=qs['limit'](_0xa14798['query'][_0x25ef('0x1f')]);_0x1017d1[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0xa14798[_0x25ef('0x33')][_0x25ef('0x1d')]);}_0x1017d1[_0x25ef('0x38')]=qs[_0x25ef('0x39')](_0xa14798[_0x25ef('0x33')]['sort']);_0x1017d1[_0x25ef('0x3a')]=qs['filters'](_[_0x25ef('0x3b')](_0xa14798[_0x25ef('0x33')],_0x4010ed[_0x25ef('0x3c')]),_0x447ff5);if(_0xa14798['query'][_0x25ef('0x3d')]){_0x1017d1[_0x25ef('0x3a')]=_['merge'](_0x1017d1[_0x25ef('0x3a')],{'$or':_['map'](_0x447ff5,function(_0x3f4c4c){if(_0x3f4c4c[_0x25ef('0x2f')]!==_0x25ef('0x3e')){var _0x28a78c={};_0x28a78c[_0x3f4c4c['name']]={'$like':'%'+_0xa14798['query']['filter']+'%'};return _0x28a78c;}})});}_0x1017d1=_[_0x25ef('0x3f')]({},_0x1017d1,_0xa14798[_0x25ef('0x40')]);var _0x54bd1a={'where':_0x1017d1[_0x25ef('0x3a')]};return db[_0x25ef('0x41')][_0x25ef('0x20')](_0x54bd1a)['then'](function(_0x9f5439){_0x32514b[_0x25ef('0x20')]=_0x9f5439;if(_0xa14798[_0x25ef('0x33')]['includeAll']){_0x1017d1[_0x25ef('0x42')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x25ef('0x43')](_0x1017d1);})[_0x25ef('0x25')](function(_0x4c45ad){_0x32514b[_0x25ef('0x44')]=_0x4c45ad;return _0x32514b;})[_0x25ef('0x25')](respondWithFilteredResult(_0x3c4f57,_0x1017d1))[_0x25ef('0x45')](handleError(_0x3c4f57,null));};exports[_0x25ef('0x46')]=function(_0xaf4e6e,_0x4dc850){var _0x9cd0b3={'raw':![],'where':{'id':_0xaf4e6e['params']['id']}},_0x4343a7={};_0x4343a7[_0x25ef('0x31')]=_[_0x25ef('0x32')](db[_0x25ef('0x41')][_0x25ef('0x2d')]);_0x4343a7[_0x25ef('0x33')]=_['keys'](_0xaf4e6e[_0x25ef('0x33')]);_0x4343a7[_0x25ef('0x3c')]=_[_0x25ef('0x34')](_0x4343a7['model'],_0x4343a7[_0x25ef('0x33')]);_0x9cd0b3[_0x25ef('0x35')]=_['intersection'](_0x4343a7[_0x25ef('0x31')],qs[_0x25ef('0x47')](_0xaf4e6e['query']['fields']));_0x9cd0b3[_0x25ef('0x35')]=_0x9cd0b3['attributes']['length']?_0x9cd0b3[_0x25ef('0x35')]:_0x4343a7[_0x25ef('0x31')];if(_0xaf4e6e[_0x25ef('0x33')][_0x25ef('0x48')]){_0x9cd0b3[_0x25ef('0x42')]=[{'all':!![]}];}_0x9cd0b3=_[_0x25ef('0x3f')]({},_0x9cd0b3,_0xaf4e6e['options']);return db[_0x25ef('0x41')][_0x25ef('0x49')](_0x9cd0b3)['then'](handleEntityNotFound(_0x4dc850,null))['then'](respondWithResult(_0x4dc850,null))[_0x25ef('0x45')](handleError(_0x4dc850,null));};exports[_0x25ef('0x4a')]=function(_0x45bedf,_0x326741){return db[_0x25ef('0x41')][_0x25ef('0x4a')](_0x45bedf['body'],{})['then'](respondWithResult(_0x326741,0xc9))[_0x25ef('0x45')](handleError(_0x326741,null));};exports['update']=function(_0x2ddee7,_0x11ccbc){if(_0x2ddee7['body']['id']){delete _0x2ddee7[_0x25ef('0x4b')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2ddee7[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x11ccbc,null))[_0x25ef('0x25')](saveUpdates(_0x2ddee7['body'],null))['then'](respondWithResult(_0x11ccbc,null))[_0x25ef('0x45')](handleError(_0x11ccbc,null));};exports[_0x25ef('0x4d')]=function(_0x5b9a89,_0x3bf2e6){return db[_0x25ef('0x41')]['find']({'where':{'id':_0x5b9a89[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x3bf2e6,null))[_0x25ef('0x25')](removeEntity(_0x3bf2e6,null))[_0x25ef('0x45')](handleError(_0x3bf2e6,null));};exports[_0x25ef('0x4e')]=function(_0x189c04,_0x4173fe,_0x759f41){var _0x4469f1={};var _0x1e3e1c={};var _0x1f924c;var _0x588ad9;return db[_0x25ef('0x41')][_0x25ef('0x4f')]({'where':{'id':_0x189c04[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x4173fe,null))[_0x25ef('0x25')](function(_0x494e4d){if(_0x494e4d){_0x1f924c=_0x494e4d;_0x1e3e1c[_0x25ef('0x31')]=_['keys'](db[_0x25ef('0x50')][_0x25ef('0x2d')]);_0x1e3e1c['query']=_['keys'](_0x189c04['query']);_0x1e3e1c[_0x25ef('0x3c')]=_[_0x25ef('0x34')](_0x1e3e1c[_0x25ef('0x31')],_0x1e3e1c[_0x25ef('0x33')]);_0x4469f1[_0x25ef('0x35')]=_['intersection'](_0x1e3e1c[_0x25ef('0x31')],qs[_0x25ef('0x47')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x47')]));_0x4469f1['attributes']=_0x4469f1['attributes'][_0x25ef('0x36')]?_0x4469f1[_0x25ef('0x35')]:_0x1e3e1c[_0x25ef('0x31')];_0x4469f1[_0x25ef('0x38')]=qs[_0x25ef('0x39')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x39')]);_0x4469f1[_0x25ef('0x3a')]=qs['filters'](_[_0x25ef('0x3b')](_0x189c04['query'],_0x1e3e1c[_0x25ef('0x3c')]));if(_0x189c04['query'][_0x25ef('0x3d')]){_0x4469f1[_0x25ef('0x3a')]=_[_0x25ef('0x3f')](_0x4469f1[_0x25ef('0x3a')],{'$or':_[_0x25ef('0x2c')](_0x4469f1[_0x25ef('0x35')],function(_0x12b5c2){var _0x1ae841={};_0x1ae841[_0x12b5c2]={'$like':'%'+_0x189c04[_0x25ef('0x33')][_0x25ef('0x3d')]+'%'};return _0x1ae841;})});}_0x4469f1=_[_0x25ef('0x3f')]({},_0x4469f1,_0x189c04[_0x25ef('0x40')]);return _0x1f924c[_0x25ef('0x4e')](_0x4469f1);}})[_0x25ef('0x25')](function(_0x41d850){if(_0x41d850){_0x588ad9=_0x41d850[_0x25ef('0x36')];if(!_0x189c04[_0x25ef('0x33')]['hasOwnProperty']('nolimit')){_0x4469f1[_0x25ef('0x1f')]=qs[_0x25ef('0x1f')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x1f')]);_0x4469f1[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0x189c04[_0x25ef('0x33')][_0x25ef('0x1d')]);}return _0x1f924c[_0x25ef('0x4e')](_0x4469f1);}})[_0x25ef('0x25')](function(_0x1b120f){if(_0x1b120f){return _0x1b120f?{'count':_0x588ad9,'rows':_0x1b120f}:null;}})['then'](respondWithResult(_0x4173fe,null))['catch'](handleError(_0x4173fe,null));};exports[_0x25ef('0x51')]=function(_0x4aa20d,_0x37233c,_0x385baf){var _0xa6bcf7={};var _0x2431d0={};var _0x513aa4;var _0x212863;return db[_0x25ef('0x41')][_0x25ef('0x4f')]({'where':{'id':_0x4aa20d[_0x25ef('0x4c')]['id']}})[_0x25ef('0x25')](handleEntityNotFound(_0x37233c,null))[_0x25ef('0x25')](function(_0x36ae12){if(_0x36ae12){_0x513aa4=_0x36ae12;_0x2431d0[_0x25ef('0x31')]=_['keys'](db[_0x25ef('0x50')]['rawAttributes']);_0x2431d0[_0x25ef('0x33')]=_[_0x25ef('0x32')](_0x4aa20d[_0x25ef('0x33')]);_0x2431d0[_0x25ef('0x3c')]=_[_0x25ef('0x34')](_0x2431d0['model'],_0x2431d0[_0x25ef('0x33')]);_0xa6bcf7['attributes']=_[_0x25ef('0x34')](_0x2431d0[_0x25ef('0x31')],qs[_0x25ef('0x47')](_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x47')]));_0xa6bcf7[_0x25ef('0x35')]=_0xa6bcf7[_0x25ef('0x35')][_0x25ef('0x36')]?_0xa6bcf7[_0x25ef('0x35')]:_0x2431d0[_0x25ef('0x31')];_0xa6bcf7[_0x25ef('0x38')]=qs['sort'](_0x4aa20d['query']['sort']);_0xa6bcf7[_0x25ef('0x3a')]=qs['filters'](_['pick'](_0x4aa20d[_0x25ef('0x33')],_0x2431d0[_0x25ef('0x3c')]));if(_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x3d')]){_0xa6bcf7[_0x25ef('0x3a')]=_[_0x25ef('0x3f')](_0xa6bcf7[_0x25ef('0x3a')],{'$or':_[_0x25ef('0x2c')](_0xa6bcf7['attributes'],function(_0x1f07a6){var _0x20d485={};_0x20d485[_0x1f07a6]={'$like':'%'+_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x3d')]+'%'};return _0x20d485;})});}_0xa6bcf7=_[_0x25ef('0x3f')]({},_0xa6bcf7,_0x4aa20d[_0x25ef('0x40')]);return _0x513aa4[_0x25ef('0x51')](_0xa6bcf7);}})[_0x25ef('0x25')](function(_0x5f136b){if(_0x5f136b){_0x212863=_0x5f136b['length'];if(!_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x52')](_0x25ef('0x37'))){_0xa6bcf7[_0x25ef('0x1f')]=qs[_0x25ef('0x1f')](_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x1f')]);_0xa6bcf7[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0x4aa20d[_0x25ef('0x33')][_0x25ef('0x1d')]);}return _0x513aa4[_0x25ef('0x51')](_0xa6bcf7);}})['then'](function(_0x56bd56){if(_0x56bd56){return _0x56bd56?{'count':_0x212863,'rows':_0x56bd56}:null;}})['then'](respondWithResult(_0x37233c,null))[_0x25ef('0x45')](handleError(_0x37233c,null));};exports[_0x25ef('0x53')]=function(_0xd7d7cf,_0x1079f7,_0x206ad6){var _0x487f79={};var _0x2b305a={};var _0x40a8cd;var _0x13076e;return db[_0x25ef('0x41')][_0x25ef('0x4f')]({'where':{'id':_0xd7d7cf['params']['id']}})['then'](handleEntityNotFound(_0x1079f7,null))[_0x25ef('0x25')](function(_0x1c4eda){if(_0x1c4eda){_0x40a8cd=_0x1c4eda;_0x2b305a[_0x25ef('0x31')]=_['keys'](db[_0x25ef('0x50')]['rawAttributes']);_0x2b305a['query']=_['keys'](_0xd7d7cf[_0x25ef('0x33')]);_0x2b305a[_0x25ef('0x3c')]=_['intersection'](_0x2b305a['model'],_0x2b305a[_0x25ef('0x33')]);_0x487f79['attributes']=_[_0x25ef('0x34')](_0x2b305a['model'],qs[_0x25ef('0x47')](_0xd7d7cf[_0x25ef('0x33')]['fields']));_0x487f79['attributes']=_0x487f79['attributes'][_0x25ef('0x36')]?_0x487f79['attributes']:_0x2b305a[_0x25ef('0x31')];_0x487f79[_0x25ef('0x38')]=qs[_0x25ef('0x39')](_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x39')]);_0x487f79[_0x25ef('0x3a')]=qs[_0x25ef('0x3c')](_[_0x25ef('0x3b')](_0xd7d7cf['query'],_0x2b305a['filters']));if(_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x3d')]){_0x487f79[_0x25ef('0x3a')]=_['merge'](_0x487f79[_0x25ef('0x3a')],{'$or':_[_0x25ef('0x2c')](_0x487f79[_0x25ef('0x35')],function(_0x28ce8e){var _0x3b137d={};_0x3b137d[_0x28ce8e]={'$like':'%'+_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x3d')]+'%'};return _0x3b137d;})});}_0x487f79=_[_0x25ef('0x3f')]({},_0x487f79,_0xd7d7cf[_0x25ef('0x40')]);return _0x40a8cd[_0x25ef('0x53')](_0x487f79);}})[_0x25ef('0x25')](function(_0x1ceed9){if(_0x1ceed9){_0x13076e=_0x1ceed9[_0x25ef('0x36')];if(!_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x52')](_0x25ef('0x37'))){_0x487f79[_0x25ef('0x1f')]=qs['limit'](_0xd7d7cf[_0x25ef('0x33')][_0x25ef('0x1f')]);_0x487f79[_0x25ef('0x1d')]=qs[_0x25ef('0x1d')](_0xd7d7cf[_0x25ef('0x33')]['offset']);}return _0x40a8cd[_0x25ef('0x53')](_0x487f79);}})['then'](function(_0x4ae13c){if(_0x4ae13c){return _0x4ae13c?{'count':_0x13076e,'rows':_0x4ae13c}:null;}})['then'](respondWithResult(_0x1079f7,null))['catch'](handleError(_0x1079f7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3383b9d..88910c7 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 _0x8fdc=['../../config/environment','./intSugarcrmConfiguration.attributes','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8fdc,0xbe));var _0xc8fd=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x8fdc[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0xc8fd('0x0'));var util=require(_0xc8fd('0x1'));var logger=require(_0xc8fd('0x2'))(_0xc8fd('0x3'));var moment=require('moment');var BPromise=require(_0xc8fd('0x4'));var rp=require(_0xc8fd('0x5'));var fs=require('fs');var path=require(_0xc8fd('0x6'));var rimraf=require(_0xc8fd('0x7'));var config=require(_0xc8fd('0x8'));var attributes=require(_0xc8fd('0x9'));module['exports']=function(_0x56d605,_0x457015){return _0x56d605['define']('SugarcrmConfiguration',attributes,{'tableName':_0xc8fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4004=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4004,0x9a));var _0x4400=function(_0x29b046,_0x3d830f){_0x29b046=_0x29b046-0x0;var _0x204735=_0x4004[_0x29b046];return _0x204735;};'use strict';var _=require('lodash');var util=require(_0x4400('0x0'));var logger=require(_0x4400('0x1'))('api');var moment=require(_0x4400('0x2'));var BPromise=require(_0x4400('0x3'));var rp=require(_0x4400('0x4'));var fs=require('fs');var path=require(_0x4400('0x5'));var rimraf=require(_0x4400('0x6'));var config=require(_0x4400('0x7'));var attributes=require(_0x4400('0x8'));module[_0x4400('0x9')]=function(_0x4fe343,_0x1c5a6a){return _0x4fe343[_0x4400('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x4400('0xb'),'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 c71136d..02a7e5f 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 _0xd7a6=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xd7a6,0x1e0));var _0x6d7a=function(_0x4daa36,_0x1352bf){_0x4daa36=_0x4daa36-0x0;var _0x4acde7=_0xd7a6[_0x4daa36];return _0x4acde7;};'use strict';var _=require(_0x6d7a('0x0'));var util=require('util');var moment=require(_0x6d7a('0x1'));var BPromise=require(_0x6d7a('0x2'));var rs=require(_0x6d7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d7a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6d7a('0x5'));var client=jayson[_0x6d7a('0x6')][_0x6d7a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x356de6,_0x253b2c,_0x490690){return new BPromise(function(_0x4fb4fe,_0x96e3a8){return client['request'](_0x356de6,_0x490690)[_0x6d7a('0x8')](function(_0x52b092){logger[_0x6d7a('0x9')](_0x6d7a('0xa'),_0x253b2c,_0x6d7a('0xb'));logger[_0x6d7a('0xc')](_0x6d7a('0xd'),_0x253b2c,'request\x20sent',JSON['stringify'](_0x52b092));if(_0x52b092[_0x6d7a('0xe')]){if(_0x52b092['error'][_0x6d7a('0xf')]===0x1f4){logger['error'](_0x6d7a('0xa'),_0x253b2c,_0x52b092[_0x6d7a('0xe')][_0x6d7a('0x10')]);return _0x96e3a8(_0x52b092[_0x6d7a('0xe')][_0x6d7a('0x10')]);}logger[_0x6d7a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253b2c,_0x52b092[_0x6d7a('0xe')][_0x6d7a('0x10')]);return _0x4fb4fe(_0x52b092[_0x6d7a('0xe')]['message']);}else{logger[_0x6d7a('0x9')](_0x6d7a('0xa'),_0x253b2c,_0x6d7a('0xb'));_0x4fb4fe(_0x52b092[_0x6d7a('0x11')][_0x6d7a('0x10')]);}})[_0x6d7a('0x12')](function(_0x45c1c8){logger[_0x6d7a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253b2c,_0x45c1c8);_0x96e3a8(_0x45c1c8);});});} \ No newline at end of file +var _0x094f=['client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x094f,0xa3));var _0xf094=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x094f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require(_0xf094('0x0'));var moment=require(_0xf094('0x1'));var BPromise=require('bluebird');var rs=require(_0xf094('0x2'));var fs=require('fs');var Redis=require(_0xf094('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf094('0x4'));var logger=require('../../config/logger')(_0xf094('0x5'));var config=require(_0xf094('0x6'));var jayson=require(_0xf094('0x7'));var client=jayson[_0xf094('0x8')][_0xf094('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34f4f9,_0x45b02d,_0xd91a07){return new BPromise(function(_0x5d44f3,_0x5a4b6a){return client[_0xf094('0xa')](_0x34f4f9,_0xd91a07)[_0xf094('0xb')](function(_0x58d9f3){logger['info'](_0xf094('0xc'),_0x45b02d,_0xf094('0xd'));logger[_0xf094('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x45b02d,_0xf094('0xd'),JSON['stringify'](_0x58d9f3));if(_0x58d9f3[_0xf094('0xf')]){if(_0x58d9f3['error'][_0xf094('0x10')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x45b02d,_0x58d9f3[_0xf094('0xf')][_0xf094('0x11')]);return _0x5a4b6a(_0x58d9f3['error'][_0xf094('0x11')]);}logger[_0xf094('0xf')](_0xf094('0xc'),_0x45b02d,_0x58d9f3[_0xf094('0xf')][_0xf094('0x11')]);return _0x5d44f3(_0x58d9f3[_0xf094('0xf')][_0xf094('0x11')]);}else{logger[_0xf094('0x12')](_0xf094('0xc'),_0x45b02d,_0xf094('0xd'));_0x5d44f3(_0x58d9f3['result']['message']);}})['catch'](function(_0x574e39){logger[_0xf094('0xf')](_0xf094('0xc'),_0x45b02d,_0x574e39);_0x5a4b6a(_0x574e39);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c1f679d..5d49406 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 _0x5f34=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2a2bc0,_0x49ede8){var _0x2ab829=function(_0x5c90d0){while(--_0x5c90d0){_0x2a2bc0['push'](_0x2a2bc0['shift']());}};_0x2ab829(++_0x49ede8);}(_0x5f34,0x12d));var _0x45f3=function(_0xa99de2,_0x274fa4){_0xa99de2=_0xa99de2-0x0;var _0x1094ac=_0x5f34[_0xa99de2];return _0x1094ac;};'use strict';var multer=require(_0x45f3('0x0'));var util=require('util');var path=require(_0x45f3('0x1'));var timeout=require(_0x45f3('0x2'));var express=require('express');var router=express[_0x45f3('0x3')]();var fs_extra=require(_0x45f3('0x4'));var auth=require(_0x45f3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x45f3('0x6')]('/',auth[_0x45f3('0x7')](),controller[_0x45f3('0x8')]);router[_0x45f3('0x6')](_0x45f3('0x9'),auth['isAuthenticated'](),controller[_0x45f3('0xa')]);router[_0x45f3('0xb')]('/',auth[_0x45f3('0x7')](),controller['create']);router['put'](_0x45f3('0x9'),auth[_0x45f3('0x7')](),controller[_0x45f3('0xc')]);router[_0x45f3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x45f3('0xe')]);module[_0x45f3('0xf')]=router; \ No newline at end of file +var _0x46d4=['update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','create','put','/:id'];(function(_0x21deff,_0x203677){var _0x146c95=function(_0x11aced){while(--_0x11aced){_0x21deff['push'](_0x21deff['shift']());}};_0x146c95(++_0x203677);}(_0x46d4,0x145));var _0x446d=function(_0x47872a,_0x2919a9){_0x47872a=_0x47872a-0x0;var _0x1cc71b=_0x46d4[_0x47872a];return _0x1cc71b;};'use strict';var multer=require(_0x446d('0x0'));var util=require(_0x446d('0x1'));var path=require(_0x446d('0x2'));var timeout=require(_0x446d('0x3'));var express=require(_0x446d('0x4'));var router=express[_0x446d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x446d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x446d('0x7'));var controller=require(_0x446d('0x8'));router[_0x446d('0x9')]('/',auth[_0x446d('0xa')](),controller['index']);router['get']('/:id',auth[_0x446d('0xa')](),controller[_0x446d('0xb')]);router['post']('/',auth[_0x446d('0xa')](),controller[_0x446d('0xc')]);router[_0x446d('0xd')](_0x446d('0xe'),auth[_0x446d('0xa')](),controller[_0x446d('0xf')]);router[_0x446d('0x10')](_0x446d('0xe'),auth[_0x446d('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 c0651d4..5319ee6 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 _0x95a6=['string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x4c618e,_0x4b4c4f){var _0x2026cd=function(_0x905922){while(--_0x905922){_0x4c618e['push'](_0x4c618e['shift']());}};_0x2026cd(++_0x4b4c4f);}(_0x95a6,0x15e));var _0x695a=function(_0x56b6e3,_0x2fda38){_0x56b6e3=_0x56b6e3-0x0;var _0xcef6d2=_0x95a6[_0x56b6e3];return _0xcef6d2;};'use strict';var Sequelize=require(_0x695a('0x0'));module['exports']={'type':{'type':Sequelize[_0x695a('0x1')](_0x695a('0x2'),'variable',_0x695a('0x3'),_0x695a('0x4'),_0x695a('0x5')),'defaultValue':_0x695a('0x2')},'content':{'type':Sequelize[_0x695a('0x6')]},'key':{'type':Sequelize[_0x695a('0x6')]},'keyType':{'type':Sequelize[_0x695a('0x1')]('string','variable',_0x695a('0x3'))},'keyContent':{'type':Sequelize[_0x695a('0x6')]},'idField':{'type':Sequelize[_0x695a('0x6')]},'nameField':{'type':Sequelize[_0x695a('0x6')]},'customField':{'type':Sequelize[_0x695a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x695a('0x6')]}}; \ No newline at end of file +var _0xe01d=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN'];(function(_0x35f5bb,_0x354149){var _0xf8d19e=function(_0x391754){while(--_0x391754){_0x35f5bb['push'](_0x35f5bb['shift']());}};_0xf8d19e(++_0x354149);}(_0xe01d,0x195));var _0xde01=function(_0x260f23,_0x2d90ee){_0x260f23=_0x260f23-0x0;var _0x222dc1=_0xe01d[_0x260f23];return _0x222dc1;};'use strict';var Sequelize=require(_0xde01('0x0'));module[_0xde01('0x1')]={'type':{'type':Sequelize[_0xde01('0x2')](_0xde01('0x3'),_0xde01('0x4'),'customVariable','keyValue',_0xde01('0x5')),'defaultValue':_0xde01('0x3')},'content':{'type':Sequelize[_0xde01('0x6')]},'key':{'type':Sequelize[_0xde01('0x6')]},'keyType':{'type':Sequelize[_0xde01('0x2')](_0xde01('0x3'),_0xde01('0x4'),_0xde01('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde01('0x6')]},'nameField':{'type':Sequelize[_0xde01('0x6')]},'customField':{'type':Sequelize[_0xde01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde01('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 9472a79..61b9f4f 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 _0x20b4=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SugarcrmField','type','model','filters','attributes','intersection','fields','query','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status'];(function(_0x1262c3,_0x12405a){var _0x4245b1=function(_0x21355e){while(--_0x21355e){_0x1262c3['push'](_0x1262c3['shift']());}};_0x4245b1(++_0x12405a);}(_0x20b4,0x145));var _0x420b=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x20b4[_0x4d1d2c];return _0x2c4cb9;};'use strict';var emlformat=require(_0x420b('0x0'));var rimraf=require(_0x420b('0x1'));var zipdir=require(_0x420b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x420b('0x3'));var moment=require('moment');var BPromise=require(_0x420b('0x4'));var Mustache=require(_0x420b('0x5'));var util=require('util');var path=require(_0x420b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x420b('0x7'));var fs=require('fs');var fs_extra=require(_0x420b('0x8'));var _=require(_0x420b('0x9'));var squel=require('squel');var crypto=require(_0x420b('0xa'));var jsforce=require(_0x420b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x420b('0xc'));var Redis=require(_0x420b('0xd'));var authService=require(_0x420b('0xe'));var qs=require(_0x420b('0xf'));var as=require(_0x420b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x420b('0x11'));var config=require(_0x420b('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x170642,_0x22c2e8){_0x22c2e8=_0x22c2e8||0xcc;return function(_0x1195b4){if(_0x1195b4){return _0x170642['sendStatus'](_0x22c2e8);}return _0x170642[_0x420b('0x13')](_0x22c2e8)[_0x420b('0x14')]();};}function respondWithResult(_0x11cda7,_0x3c4230){_0x3c4230=_0x3c4230||0xc8;return function(_0x508b09){if(_0x508b09){return _0x11cda7[_0x420b('0x13')](_0x3c4230)[_0x420b('0x15')](_0x508b09);}};}function respondWithFilteredResult(_0x2d3703,_0x225a31){return function(_0x510c9c){if(_0x510c9c){var _0x23cc11=typeof _0x225a31[_0x420b('0x16')]===_0x420b('0x17')&&typeof _0x225a31[_0x420b('0x18')]===_0x420b('0x17');var _0x38bb3d=_0x510c9c[_0x420b('0x19')];var _0x48c76d=_0x23cc11?0x0:_0x225a31['offset'];var _0x21449d=_0x23cc11?_0x510c9c[_0x420b('0x19')]:_0x225a31['offset']+_0x225a31[_0x420b('0x18')];var _0x3e36b4;if(_0x21449d>=_0x38bb3d){_0x21449d=_0x38bb3d;_0x3e36b4=0xc8;}else{_0x3e36b4=0xce;}_0x2d3703[_0x420b('0x13')](_0x3e36b4);return _0x2d3703['set'](_0x420b('0x1a'),_0x48c76d+'-'+_0x21449d+'/'+_0x38bb3d)['json'](_0x510c9c);}return null;};}function patchUpdates(_0x2f468e){return function(_0x4546c9){try{jsonpatch[_0x420b('0x1b')](_0x4546c9,_0x2f468e,!![]);}catch(_0xf4ff5f){return BPromise[_0x420b('0x1c')](_0xf4ff5f);}return _0x4546c9[_0x420b('0x1d')]();};}function saveUpdates(_0x176af4,_0x17ad00){return function(_0x24475b){if(_0x24475b){return _0x24475b[_0x420b('0x1e')](_0x176af4)['then'](function(_0x1794b4){return _0x1794b4;});}return null;};}function removeEntity(_0x15b0f8,_0x387380){return function(_0x356b8e){if(_0x356b8e){return _0x356b8e[_0x420b('0x1f')]()[_0x420b('0x20')](function(){_0x15b0f8['status'](0xcc)[_0x420b('0x14')]();});}};}function handleEntityNotFound(_0x4cc51b,_0x34de8e){return function(_0x52c85d){if(!_0x52c85d){_0x4cc51b['sendStatus'](0x194);}return _0x52c85d;};}function handleError(_0x234bb9,_0x464cf4){_0x464cf4=_0x464cf4||0x1f4;return function(_0x2c1d02){logger[_0x420b('0x21')](_0x2c1d02[_0x420b('0x22')]);if(_0x2c1d02[_0x420b('0x23')]){delete _0x2c1d02[_0x420b('0x23')];}_0x234bb9[_0x420b('0x13')](_0x464cf4)[_0x420b('0x24')](_0x2c1d02);};}exports[_0x420b('0x25')]=function(_0x5269d3,_0x211ce2){var _0x443f94={},_0x7c1fe1={},_0x4bed84={'count':0x0,'rows':[]};var _0x49bc79=_[_0x420b('0x26')](db[_0x420b('0x27')]['rawAttributes'],function(_0x89b1af){return{'name':_0x89b1af['fieldName'],'type':_0x89b1af[_0x420b('0x28')]['key']};});_0x7c1fe1[_0x420b('0x29')]=_[_0x420b('0x26')](_0x49bc79,'name');_0x7c1fe1['query']=_['keys'](_0x5269d3['query']);_0x7c1fe1[_0x420b('0x2a')]=_['intersection'](_0x7c1fe1[_0x420b('0x29')],_0x7c1fe1['query']);_0x443f94[_0x420b('0x2b')]=_[_0x420b('0x2c')](_0x7c1fe1[_0x420b('0x29')],qs[_0x420b('0x2d')](_0x5269d3[_0x420b('0x2e')][_0x420b('0x2d')]));_0x443f94[_0x420b('0x2b')]=_0x443f94[_0x420b('0x2b')][_0x420b('0x2f')]?_0x443f94[_0x420b('0x2b')]:_0x7c1fe1[_0x420b('0x29')];if(!_0x5269d3[_0x420b('0x2e')]['hasOwnProperty'](_0x420b('0x30'))){_0x443f94[_0x420b('0x18')]=qs['limit'](_0x5269d3[_0x420b('0x2e')][_0x420b('0x18')]);_0x443f94[_0x420b('0x16')]=qs['offset'](_0x5269d3[_0x420b('0x2e')][_0x420b('0x16')]);}_0x443f94[_0x420b('0x31')]=qs['sort'](_0x5269d3['query'][_0x420b('0x32')]);_0x443f94[_0x420b('0x33')]=qs[_0x420b('0x2a')](_[_0x420b('0x34')](_0x5269d3[_0x420b('0x2e')],_0x7c1fe1[_0x420b('0x2a')]),_0x49bc79);if(_0x5269d3[_0x420b('0x2e')][_0x420b('0x35')]){_0x443f94['where']=_[_0x420b('0x36')](_0x443f94['where'],{'$or':_[_0x420b('0x26')](_0x49bc79,function(_0x41cd5e){if(_0x41cd5e[_0x420b('0x28')]!==_0x420b('0x37')){var _0xb0b644={};_0xb0b644[_0x41cd5e[_0x420b('0x23')]]={'$like':'%'+_0x5269d3['query'][_0x420b('0x35')]+'%'};return _0xb0b644;}})});}_0x443f94=_[_0x420b('0x36')]({},_0x443f94,_0x5269d3['options']);var _0x43f17f={'where':_0x443f94[_0x420b('0x33')]};return db['SugarcrmField']['count'](_0x43f17f)[_0x420b('0x20')](function(_0x267ace){_0x4bed84[_0x420b('0x19')]=_0x267ace;if(_0x5269d3[_0x420b('0x2e')][_0x420b('0x38')]){_0x443f94[_0x420b('0x39')]=[{'all':!![]}];}return db['SugarcrmField'][_0x420b('0x3a')](_0x443f94);})[_0x420b('0x20')](function(_0x253c99){_0x4bed84[_0x420b('0x3b')]=_0x253c99;return _0x4bed84;})[_0x420b('0x20')](respondWithFilteredResult(_0x211ce2,_0x443f94))[_0x420b('0x3c')](handleError(_0x211ce2,null));};exports[_0x420b('0x3d')]=function(_0x267fb2,_0x17aeae){var _0x1f6b96={'raw':!![],'where':{'id':_0x267fb2[_0x420b('0x3e')]['id']}},_0x32c43d={};_0x32c43d[_0x420b('0x29')]=_[_0x420b('0x3f')](db[_0x420b('0x27')][_0x420b('0x40')]);_0x32c43d[_0x420b('0x2e')]=_[_0x420b('0x3f')](_0x267fb2[_0x420b('0x2e')]);_0x32c43d[_0x420b('0x2a')]=_['intersection'](_0x32c43d['model'],_0x32c43d['query']);_0x1f6b96[_0x420b('0x2b')]=_[_0x420b('0x2c')](_0x32c43d[_0x420b('0x29')],qs[_0x420b('0x2d')](_0x267fb2[_0x420b('0x2e')][_0x420b('0x2d')]));_0x1f6b96[_0x420b('0x2b')]=_0x1f6b96[_0x420b('0x2b')][_0x420b('0x2f')]?_0x1f6b96['attributes']:_0x32c43d[_0x420b('0x29')];if(_0x267fb2[_0x420b('0x2e')][_0x420b('0x38')]){_0x1f6b96[_0x420b('0x39')]=[{'all':!![]}];}_0x1f6b96=_[_0x420b('0x36')]({},_0x1f6b96,_0x267fb2[_0x420b('0x41')]);return db['SugarcrmField'][_0x420b('0x42')](_0x1f6b96)[_0x420b('0x20')](handleEntityNotFound(_0x17aeae,null))['then'](respondWithResult(_0x17aeae,null))[_0x420b('0x3c')](handleError(_0x17aeae,null));};exports[_0x420b('0x43')]=function(_0x4bc376,_0x22bd7e){return db['SugarcrmField']['create'](_0x4bc376[_0x420b('0x44')],{})[_0x420b('0x20')](respondWithResult(_0x22bd7e,0xc9))[_0x420b('0x3c')](handleError(_0x22bd7e,null));};exports[_0x420b('0x1e')]=function(_0x57c955,_0x39df06){if(_0x57c955[_0x420b('0x44')]['id']){delete _0x57c955[_0x420b('0x44')]['id'];}return db[_0x420b('0x27')]['find']({'where':{'id':_0x57c955[_0x420b('0x3e')]['id']}})[_0x420b('0x20')](handleEntityNotFound(_0x39df06,null))['then'](saveUpdates(_0x57c955[_0x420b('0x44')],null))['then'](respondWithResult(_0x39df06,null))[_0x420b('0x3c')](handleError(_0x39df06,null));};exports[_0x420b('0x1f')]=function(_0x3d3461,_0x421c63){return db[_0x420b('0x27')][_0x420b('0x42')]({'where':{'id':_0x3d3461[_0x420b('0x3e')]['id']}})[_0x420b('0x20')](handleEntityNotFound(_0x421c63,null))[_0x420b('0x20')](removeEntity(_0x421c63,null))['catch'](handleError(_0x421c63,null));}; \ No newline at end of file +var _0xa637=['offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','catch','show','params','keys','include','options','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x52c971,_0x4ddd1d){var _0x599827=function(_0xcb5a37){while(--_0xcb5a37){_0x52c971['push'](_0x52c971['shift']());}};_0x599827(++_0x4ddd1d);}(_0xa637,0x194));var _0x7a63=function(_0x293838,_0x541252){_0x293838=_0x293838-0x0;var _0x5b50c3=_0xa637[_0x293838];return _0x5b50c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a63('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a63('0x1'));var rp=require(_0x7a63('0x2'));var moment=require(_0x7a63('0x3'));var BPromise=require(_0x7a63('0x4'));var Mustache=require(_0x7a63('0x5'));var util=require(_0x7a63('0x6'));var path=require(_0x7a63('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a63('0x8'));var fs=require('fs');var fs_extra=require(_0x7a63('0x9'));var _=require(_0x7a63('0xa'));var squel=require(_0x7a63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7a63('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a63('0xd'));var Papa=require('papaparse');var Redis=require(_0x7a63('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7a63('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a63('0x10'));var logger=require(_0x7a63('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a63('0x12'));var db=require(_0x7a63('0x13'))['db'];function respondWithStatusCode(_0x188169,_0x57c05a){_0x57c05a=_0x57c05a||0xcc;return function(_0x35a14b){if(_0x35a14b){return _0x188169[_0x7a63('0x14')](_0x57c05a);}return _0x188169[_0x7a63('0x15')](_0x57c05a)['end']();};}function respondWithResult(_0x4cb0ed,_0x1b21ed){_0x1b21ed=_0x1b21ed||0xc8;return function(_0x134e60){if(_0x134e60){return _0x4cb0ed[_0x7a63('0x15')](_0x1b21ed)['json'](_0x134e60);}};}function respondWithFilteredResult(_0x4e1a1c,_0x5a1810){return function(_0xe8f5fb){if(_0xe8f5fb){var _0xcb9c28=typeof _0x5a1810[_0x7a63('0x16')]==='undefined'&&typeof _0x5a1810['limit']===_0x7a63('0x17');var _0x4b5c70=_0xe8f5fb['count'];var _0x38341=_0xcb9c28?0x0:_0x5a1810[_0x7a63('0x16')];var _0x172789=_0xcb9c28?_0xe8f5fb[_0x7a63('0x18')]:_0x5a1810[_0x7a63('0x16')]+_0x5a1810[_0x7a63('0x19')];var _0x3a9af0;if(_0x172789>=_0x4b5c70){_0x172789=_0x4b5c70;_0x3a9af0=0xc8;}else{_0x3a9af0=0xce;}_0x4e1a1c[_0x7a63('0x15')](_0x3a9af0);return _0x4e1a1c[_0x7a63('0x1a')](_0x7a63('0x1b'),_0x38341+'-'+_0x172789+'/'+_0x4b5c70)[_0x7a63('0x1c')](_0xe8f5fb);}return null;};}function patchUpdates(_0x2ff08f){return function(_0x351129){try{jsonpatch[_0x7a63('0x1d')](_0x351129,_0x2ff08f,!![]);}catch(_0x11aeea){return BPromise[_0x7a63('0x1e')](_0x11aeea);}return _0x351129[_0x7a63('0x1f')]();};}function saveUpdates(_0x14e06e,_0x1b77ef){return function(_0x11983b){if(_0x11983b){return _0x11983b[_0x7a63('0x20')](_0x14e06e)[_0x7a63('0x21')](function(_0x582e10){return _0x582e10;});}return null;};}function removeEntity(_0x58005a,_0x10da9d){return function(_0x2e1632){if(_0x2e1632){return _0x2e1632[_0x7a63('0x22')]()[_0x7a63('0x21')](function(){_0x58005a[_0x7a63('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1412e2,_0x118ede){return function(_0x54add3){if(!_0x54add3){_0x1412e2[_0x7a63('0x14')](0x194);}return _0x54add3;};}function handleError(_0x3f101c,_0x2cad52){_0x2cad52=_0x2cad52||0x1f4;return function(_0x4c47b5){logger[_0x7a63('0x23')](_0x4c47b5[_0x7a63('0x24')]);if(_0x4c47b5[_0x7a63('0x25')]){delete _0x4c47b5[_0x7a63('0x25')];}_0x3f101c[_0x7a63('0x15')](_0x2cad52)[_0x7a63('0x26')](_0x4c47b5);};}exports[_0x7a63('0x27')]=function(_0x18300c,_0xe3feb9){var _0x2cf21f={},_0x52c2a6={},_0x55cae1={'count':0x0,'rows':[]};var _0x537510=_[_0x7a63('0x28')](db[_0x7a63('0x29')][_0x7a63('0x2a')],function(_0x284508){return{'name':_0x284508[_0x7a63('0x2b')],'type':_0x284508[_0x7a63('0x2c')][_0x7a63('0x2d')]};});_0x52c2a6[_0x7a63('0x2e')]=_[_0x7a63('0x28')](_0x537510,_0x7a63('0x25'));_0x52c2a6['query']=_['keys'](_0x18300c[_0x7a63('0x2f')]);_0x52c2a6[_0x7a63('0x30')]=_['intersection'](_0x52c2a6[_0x7a63('0x2e')],_0x52c2a6[_0x7a63('0x2f')]);_0x2cf21f[_0x7a63('0x31')]=_[_0x7a63('0x32')](_0x52c2a6[_0x7a63('0x2e')],qs[_0x7a63('0x33')](_0x18300c['query'][_0x7a63('0x33')]));_0x2cf21f['attributes']=_0x2cf21f[_0x7a63('0x31')][_0x7a63('0x34')]?_0x2cf21f[_0x7a63('0x31')]:_0x52c2a6[_0x7a63('0x2e')];if(!_0x18300c[_0x7a63('0x2f')][_0x7a63('0x35')]('nolimit')){_0x2cf21f[_0x7a63('0x19')]=qs[_0x7a63('0x19')](_0x18300c['query'][_0x7a63('0x19')]);_0x2cf21f['offset']=qs[_0x7a63('0x16')](_0x18300c[_0x7a63('0x2f')][_0x7a63('0x16')]);}_0x2cf21f[_0x7a63('0x36')]=qs[_0x7a63('0x37')](_0x18300c[_0x7a63('0x2f')][_0x7a63('0x37')]);_0x2cf21f[_0x7a63('0x38')]=qs['filters'](_[_0x7a63('0x39')](_0x18300c[_0x7a63('0x2f')],_0x52c2a6['filters']),_0x537510);if(_0x18300c[_0x7a63('0x2f')][_0x7a63('0x3a')]){_0x2cf21f[_0x7a63('0x38')]=_[_0x7a63('0x3b')](_0x2cf21f['where'],{'$or':_[_0x7a63('0x28')](_0x537510,function(_0xced85d){if(_0xced85d[_0x7a63('0x2c')]!=='VIRTUAL'){var _0xd556d1={};_0xd556d1[_0xced85d[_0x7a63('0x25')]]={'$like':'%'+_0x18300c['query']['filter']+'%'};return _0xd556d1;}})});}_0x2cf21f=_[_0x7a63('0x3b')]({},_0x2cf21f,_0x18300c['options']);var _0x1a1ae7={'where':_0x2cf21f[_0x7a63('0x38')]};return db[_0x7a63('0x29')][_0x7a63('0x18')](_0x1a1ae7)[_0x7a63('0x21')](function(_0x1c0f55){_0x55cae1[_0x7a63('0x18')]=_0x1c0f55;if(_0x18300c[_0x7a63('0x2f')][_0x7a63('0x3c')]){_0x2cf21f['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x7a63('0x3d')](_0x2cf21f);})[_0x7a63('0x21')](function(_0x26901a){_0x55cae1['rows']=_0x26901a;return _0x55cae1;})[_0x7a63('0x21')](respondWithFilteredResult(_0xe3feb9,_0x2cf21f))[_0x7a63('0x3e')](handleError(_0xe3feb9,null));};exports[_0x7a63('0x3f')]=function(_0x3f9bbe,_0x5291f8){var _0x2d8324={'raw':!![],'where':{'id':_0x3f9bbe[_0x7a63('0x40')]['id']}},_0x6d2e36={};_0x6d2e36[_0x7a63('0x2e')]=_[_0x7a63('0x41')](db[_0x7a63('0x29')][_0x7a63('0x2a')]);_0x6d2e36[_0x7a63('0x2f')]=_[_0x7a63('0x41')](_0x3f9bbe[_0x7a63('0x2f')]);_0x6d2e36['filters']=_[_0x7a63('0x32')](_0x6d2e36[_0x7a63('0x2e')],_0x6d2e36[_0x7a63('0x2f')]);_0x2d8324[_0x7a63('0x31')]=_[_0x7a63('0x32')](_0x6d2e36['model'],qs['fields'](_0x3f9bbe[_0x7a63('0x2f')]['fields']));_0x2d8324['attributes']=_0x2d8324[_0x7a63('0x31')]['length']?_0x2d8324[_0x7a63('0x31')]:_0x6d2e36[_0x7a63('0x2e')];if(_0x3f9bbe['query'][_0x7a63('0x3c')]){_0x2d8324[_0x7a63('0x42')]=[{'all':!![]}];}_0x2d8324=_[_0x7a63('0x3b')]({},_0x2d8324,_0x3f9bbe[_0x7a63('0x43')]);return db[_0x7a63('0x29')]['find'](_0x2d8324)[_0x7a63('0x21')](handleEntityNotFound(_0x5291f8,null))[_0x7a63('0x21')](respondWithResult(_0x5291f8,null))[_0x7a63('0x3e')](handleError(_0x5291f8,null));};exports[_0x7a63('0x44')]=function(_0x4fff42,_0x4c988a){return db[_0x7a63('0x29')][_0x7a63('0x44')](_0x4fff42[_0x7a63('0x45')],{})[_0x7a63('0x21')](respondWithResult(_0x4c988a,0xc9))[_0x7a63('0x3e')](handleError(_0x4c988a,null));};exports[_0x7a63('0x20')]=function(_0x2dc479,_0x5bb999){if(_0x2dc479[_0x7a63('0x45')]['id']){delete _0x2dc479[_0x7a63('0x45')]['id'];}return db[_0x7a63('0x29')][_0x7a63('0x46')]({'where':{'id':_0x2dc479[_0x7a63('0x40')]['id']}})['then'](handleEntityNotFound(_0x5bb999,null))['then'](saveUpdates(_0x2dc479[_0x7a63('0x45')],null))[_0x7a63('0x21')](respondWithResult(_0x5bb999,null))[_0x7a63('0x3e')](handleError(_0x5bb999,null));};exports[_0x7a63('0x22')]=function(_0x44b951,_0x4d3640){return db[_0x7a63('0x29')][_0x7a63('0x46')]({'where':{'id':_0x44b951[_0x7a63('0x40')]['id']}})[_0x7a63('0x21')](handleEntityNotFound(_0x4d3640,null))[_0x7a63('0x21')](removeEntity(_0x4d3640,null))['catch'](handleError(_0x4d3640,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0fed1f8..6d54606 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 _0x93ef=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','rimraf','./intSugarcrmField.attributes'];(function(_0x425f68,_0x1674ae){var _0x38ac21=function(_0x577672){while(--_0x577672){_0x425f68['push'](_0x425f68['shift']());}};_0x38ac21(++_0x1674ae);}(_0x93ef,0x173));var _0xf93e=function(_0x5d2a53,_0x52de00){_0x5d2a53=_0x5d2a53-0x0;var _0x54cdae=_0x93ef[_0x5d2a53];return _0x54cdae;};'use strict';var _=require(_0xf93e('0x0'));var util=require(_0xf93e('0x1'));var logger=require('../../config/logger')(_0xf93e('0x2'));var moment=require(_0xf93e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf93e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf93e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf93e('0x6'));module[_0xf93e('0x7')]=function(_0x3834b5,_0x4a5fde){return _0x3834b5[_0xf93e('0x8')](_0xf93e('0x9'),attributes,{'tableName':_0xf93e('0xa'),'paranoid':![],'indexes':[{'name':_0xf93e('0xb'),'fields':[_0xf93e('0xc'),_0xf93e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1b7=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','FieldId'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xa1b7,0x188));var _0x7a1b=function(_0x519553,_0x5a66e8){_0x519553=_0x519553-0x0;var _0x5cf03a=_0xa1b7[_0x519553];return _0x5cf03a;};'use strict';var _=require(_0x7a1b('0x0'));var util=require(_0x7a1b('0x1'));var logger=require(_0x7a1b('0x2'))(_0x7a1b('0x3'));var moment=require(_0x7a1b('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a1b('0x5'));var fs=require('fs');var path=require(_0x7a1b('0x6'));var rimraf=require(_0x7a1b('0x7'));var config=require(_0x7a1b('0x8'));var attributes=require(_0x7a1b('0x9'));module['exports']=function(_0x3ddcd6,_0x261eee){return _0x3ddcd6[_0x7a1b('0xa')](_0x7a1b('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x7a1b('0xc'),'fields':['idField',_0x7a1b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 8ef528d..0e9ac8d 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 _0xf602=['debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x464a8c,_0x41effd){var _0x2f3066=function(_0x2b661e){while(--_0x2b661e){_0x464a8c['push'](_0x464a8c['shift']());}};_0x2f3066(++_0x41effd);}(_0xf602,0x1d4));var _0x2f60=function(_0x20d09e,_0x271d26){_0x20d09e=_0x20d09e-0x0;var _0x5017f6=_0xf602[_0x20d09e];return _0x5017f6;};'use strict';var _=require('lodash');var util=require(_0x2f60('0x0'));var moment=require(_0x2f60('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f60('0x2'));var fs=require('fs');var Redis=require(_0x2f60('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f60('0x4'));var logger=require(_0x2f60('0x5'))(_0x2f60('0x6'));var config=require(_0x2f60('0x7'));var jayson=require(_0x2f60('0x8'));var client=jayson[_0x2f60('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2537f1,_0xeecb1c,_0xedc9a8){return new BPromise(function(_0x2700df,_0x48f8bb){return client[_0x2f60('0xa')](_0x2537f1,_0xedc9a8)[_0x2f60('0xb')](function(_0x3a7d7a){logger[_0x2f60('0xc')](_0x2f60('0xd'),_0xeecb1c,_0x2f60('0xe'));logger[_0x2f60('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xeecb1c,'request\x20sent',JSON[_0x2f60('0x10')](_0x3a7d7a));if(_0x3a7d7a[_0x2f60('0x11')]){if(_0x3a7d7a[_0x2f60('0x11')][_0x2f60('0x12')]===0x1f4){logger['error'](_0x2f60('0xd'),_0xeecb1c,_0x3a7d7a[_0x2f60('0x11')][_0x2f60('0x13')]);return _0x48f8bb(_0x3a7d7a['error'][_0x2f60('0x13')]);}logger[_0x2f60('0x11')](_0x2f60('0xd'),_0xeecb1c,_0x3a7d7a[_0x2f60('0x11')][_0x2f60('0x13')]);return _0x2700df(_0x3a7d7a[_0x2f60('0x11')][_0x2f60('0x13')]);}else{logger[_0x2f60('0xc')](_0x2f60('0xd'),_0xeecb1c,_0x2f60('0xe'));_0x2700df(_0x3a7d7a['result'][_0x2f60('0x13')]);}})[_0x2f60('0x14')](function(_0x49d77f){logger[_0x2f60('0x11')](_0x2f60('0xd'),_0xeecb1c,_0x49d77f);_0x48f8bb(_0x49d77f);});});} \ No newline at end of file +var _0xa041=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment'];(function(_0x24ad36,_0x34fe8a){var _0x472d92=function(_0x4c639c){while(--_0x4c639c){_0x24ad36['push'](_0x24ad36['shift']());}};_0x472d92(++_0x34fe8a);}(_0xa041,0x163));var _0x1a04=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa041[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1a04('0x0'));var moment=require(_0x1a04('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a04('0x2'));var fs=require('fs');var Redis=require(_0x1a04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a04('0x4'));var logger=require(_0x1a04('0x5'))(_0x1a04('0x6'));var config=require(_0x1a04('0x7'));var jayson=require(_0x1a04('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeeae6d,_0x38cbbb,_0x5cc209){return new BPromise(function(_0x21d5f9,_0x24b816){return client[_0x1a04('0x9')](_0xeeae6d,_0x5cc209)[_0x1a04('0xa')](function(_0xaaf4d7){logger[_0x1a04('0xb')](_0x1a04('0xc'),_0x38cbbb,_0x1a04('0xd'));logger[_0x1a04('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x38cbbb,'request\x20sent',JSON[_0x1a04('0xf')](_0xaaf4d7));if(_0xaaf4d7['error']){if(_0xaaf4d7['error'][_0x1a04('0x10')]===0x1f4){logger[_0x1a04('0x11')](_0x1a04('0xc'),_0x38cbbb,_0xaaf4d7[_0x1a04('0x11')][_0x1a04('0x12')]);return _0x24b816(_0xaaf4d7[_0x1a04('0x11')][_0x1a04('0x12')]);}logger[_0x1a04('0x11')](_0x1a04('0xc'),_0x38cbbb,_0xaaf4d7[_0x1a04('0x11')][_0x1a04('0x12')]);return _0x21d5f9(_0xaaf4d7[_0x1a04('0x11')]['message']);}else{logger[_0x1a04('0xb')](_0x1a04('0xc'),_0x38cbbb,'request\x20sent');_0x21d5f9(_0xaaf4d7[_0x1a04('0x13')][_0x1a04('0x12')]);}})[_0x1a04('0x14')](function(_0x1bbac4){logger[_0x1a04('0x11')](_0x1a04('0xc'),_0x38cbbb,_0x1bbac4);_0x24b816(_0x1bbac4);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 68ec8d8..0fc4580 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 _0xcd56=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','exports','multer','util','path','express','Router'];(function(_0x23a3fa,_0x5b39e6){var _0x3c54b9=function(_0x15abe9){while(--_0x15abe9){_0x23a3fa['push'](_0x23a3fa['shift']());}};_0x3c54b9(++_0x5b39e6);}(_0xcd56,0x1c9));var _0x6cd5=function(_0x23b928,_0xf52c93){_0x23b928=_0x23b928-0x0;var _0x4c3ff2=_0xcd56[_0x23b928];return _0x4c3ff2;};'use strict';var multer=require(_0x6cd5('0x0'));var util=require(_0x6cd5('0x1'));var path=require(_0x6cd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cd5('0x3'));var router=express[_0x6cd5('0x4')]();var fs_extra=require(_0x6cd5('0x5'));var auth=require(_0x6cd5('0x6'));var interaction=require(_0x6cd5('0x7'));var config=require(_0x6cd5('0x8'));var controller=require(_0x6cd5('0x9'));router[_0x6cd5('0xa')]('/',auth['isAuthenticated'](),controller[_0x6cd5('0xb')]);router[_0x6cd5('0xa')](_0x6cd5('0xc'),auth[_0x6cd5('0xd')](),controller['show']);router['get'](_0x6cd5('0xe'),auth[_0x6cd5('0xd')](),controller[_0x6cd5('0xf')]);router[_0x6cd5('0xa')](_0x6cd5('0x10'),auth[_0x6cd5('0xd')](),controller[_0x6cd5('0x11')]);router[_0x6cd5('0x12')]('/',auth[_0x6cd5('0xd')](),controller['create']);router[_0x6cd5('0x12')]('/:id/configurations',auth[_0x6cd5('0xd')](),controller[_0x6cd5('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6cd5('0x14')]);router['delete'](_0x6cd5('0xc'),auth[_0x6cd5('0xd')](),controller['destroy']);module[_0x6cd5('0x15')]=router; \ No newline at end of file +var _0xbd3b=['isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x5b45da,_0x52bb87){var _0x2327f7=function(_0x35c430){while(--_0x35c430){_0x5b45da['push'](_0x5b45da['shift']());}};_0x2327f7(++_0x52bb87);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0xcad9e7,_0x255d6f){_0xcad9e7=_0xcad9e7-0x0;var _0x170a86=_0xbd3b[_0xcad9e7];return _0x170a86;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xa')](_0xbbd3('0xc'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router['get'](_0xbbd3('0xe'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')]('/',auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);router['post']('/:id/configurations',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x12')]);router[_0xbbd3('0x13')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x14')]);router[_0xbbd3('0x15')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0ca1d8e..3269c44 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 _0xbf37=['exports','STRING','sequelize'];(function(_0x4c0e31,_0xa79bf2){var _0x41707d=function(_0x5020d1){while(--_0x5020d1){_0x4c0e31['push'](_0x4c0e31['shift']());}};_0x41707d(++_0xa79bf2);}(_0xbf37,0xd1));var _0x7bf3=function(_0x14887a,_0x5c7f62){_0x14887a=_0x14887a-0x0;var _0x4e4c27=_0xbf37[_0x14887a];return _0x4e4c27;};'use strict';var Sequelize=require(_0x7bf3('0x0'));module[_0x7bf3('0x1')]={'name':{'type':Sequelize[_0x7bf3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7bf3('0x2')]},'username':{'type':Sequelize[_0x7bf3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7bf3('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7bf3('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7bf3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5aae=['HelpDesk','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5aae,0x7f));var _0xe5aa=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0x5aae[_0x23ca4d];return _0x435432;};'use strict';var Sequelize=require('sequelize');module[_0xe5aa('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe5aa('0x1')]},'username':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![],'defaultValue':_0xe5aa('0x2')},'remoteUri':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe5aa('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 3c19ec6..925ad03 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 _0xe151=['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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','VtigerAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','format','GET','success','POST','login','token','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe151,0xe5));var _0x1e15=function(_0x500211,_0x1a0367){_0x500211=_0x500211-0x0;var _0x48f4e0=_0xe151[_0x500211];return _0x48f4e0;};'use strict';var emlformat=require(_0x1e15('0x0'));var rimraf=require(_0x1e15('0x1'));var zipdir=require(_0x1e15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e15('0x3'));var moment=require('moment');var BPromise=require(_0x1e15('0x4'));var Mustache=require(_0x1e15('0x5'));var util=require('util');var path=require(_0x1e15('0x6'));var sox=require(_0x1e15('0x7'));var csv=require(_0x1e15('0x8'));var ejs=require(_0x1e15('0x9'));var fs=require('fs');var fs_extra=require(_0x1e15('0xa'));var _=require('lodash');var squel=require(_0x1e15('0xb'));var crypto=require(_0x1e15('0xc'));var jsforce=require(_0x1e15('0xd'));var deskjs=require(_0x1e15('0xe'));var toCsv=require(_0x1e15('0x8'));var querystring=require(_0x1e15('0xf'));var Papa=require(_0x1e15('0x10'));var Redis=require(_0x1e15('0x11'));var authService=require(_0x1e15('0x12'));var qs=require(_0x1e15('0x13'));var as=require(_0x1e15('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e15('0x15'))(_0x1e15('0x16'));var utils=require(_0x1e15('0x17'));var config=require(_0x1e15('0x18'));var licenseUtil=require(_0x1e15('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1e15('0x1a'));function respondWithStatusCode(_0x47a22c,_0x4e6e1e){_0x4e6e1e=_0x4e6e1e||0xcc;return function(_0x30f905){if(_0x30f905){return _0x47a22c[_0x1e15('0x1b')](_0x4e6e1e);}return _0x47a22c[_0x1e15('0x1c')](_0x4e6e1e)['end']();};}function respondWithResult(_0x2553dc,_0x6a2d92){_0x6a2d92=_0x6a2d92||0xc8;return function(_0x38c2ef){if(_0x38c2ef){return _0x2553dc['status'](_0x6a2d92)[_0x1e15('0x1d')](_0x38c2ef);}};}function respondWithFilteredResult(_0x53409a,_0x53104d){return function(_0x51173b){if(_0x51173b){var _0x4d846e=typeof _0x53104d[_0x1e15('0x1e')]==='undefined'&&typeof _0x53104d['limit']===_0x1e15('0x1f');var _0x5b3eea=_0x51173b[_0x1e15('0x20')];var _0x4e1b40=_0x4d846e?0x0:_0x53104d[_0x1e15('0x1e')];var _0x1a0d1f=_0x4d846e?_0x51173b[_0x1e15('0x20')]:_0x53104d[_0x1e15('0x1e')]+_0x53104d[_0x1e15('0x21')];var _0x44fd7b;if(_0x1a0d1f>=_0x5b3eea){_0x1a0d1f=_0x5b3eea;_0x44fd7b=0xc8;}else{_0x44fd7b=0xce;}_0x53409a['status'](_0x44fd7b);return _0x53409a[_0x1e15('0x22')](_0x1e15('0x23'),_0x4e1b40+'-'+_0x1a0d1f+'/'+_0x5b3eea)[_0x1e15('0x1d')](_0x51173b);}return null;};}function patchUpdates(_0x36c843){return function(_0x50c863){try{jsonpatch[_0x1e15('0x24')](_0x50c863,_0x36c843,!![]);}catch(_0x4294de){return BPromise[_0x1e15('0x25')](_0x4294de);}return _0x50c863['save']();};}function saveUpdates(_0x95188b,_0x3a9e32){return function(_0x235a14){if(_0x235a14){return _0x235a14[_0x1e15('0x26')](_0x95188b)['then'](function(_0x4d1862){return _0x4d1862;});}return null;};}function removeEntity(_0x5803aa,_0x510e55){return function(_0x1a9e2b){if(_0x1a9e2b){return _0x1a9e2b[_0x1e15('0x27')]()[_0x1e15('0x28')](function(){_0x5803aa[_0x1e15('0x1c')](0xcc)[_0x1e15('0x29')]();});}};}function handleEntityNotFound(_0x176e12,_0x420568){return function(_0x1fbb83){if(!_0x1fbb83){_0x176e12[_0x1e15('0x1b')](0x194);}return _0x1fbb83;};}function handleError(_0x544efa,_0x209b56){_0x209b56=_0x209b56||0x1f4;return function(_0x5ca48d){logger[_0x1e15('0x2a')](_0x5ca48d['stack']);if(_0x5ca48d[_0x1e15('0x2b')]){delete _0x5ca48d['name'];}_0x544efa[_0x1e15('0x1c')](_0x209b56)[_0x1e15('0x2c')](_0x5ca48d);};}exports[_0x1e15('0x2d')]=function(_0x28bdfe,_0x112d26){var _0x3334a5={},_0x517d8e={},_0x20714d={'count':0x0,'rows':[]};var _0x4b446b=_['map'](db[_0x1e15('0x2e')][_0x1e15('0x2f')],function(_0x3db576){return{'name':_0x3db576[_0x1e15('0x30')],'type':_0x3db576[_0x1e15('0x31')]['key']};});_0x517d8e[_0x1e15('0x32')]=_[_0x1e15('0x33')](_0x4b446b,_0x1e15('0x2b'));_0x517d8e[_0x1e15('0x34')]=_[_0x1e15('0x35')](_0x28bdfe[_0x1e15('0x34')]);_0x517d8e[_0x1e15('0x36')]=_[_0x1e15('0x37')](_0x517d8e[_0x1e15('0x32')],_0x517d8e[_0x1e15('0x34')]);_0x3334a5[_0x1e15('0x38')]=_[_0x1e15('0x37')](_0x517d8e['model'],qs[_0x1e15('0x39')](_0x28bdfe['query'][_0x1e15('0x39')]));_0x3334a5['attributes']=_0x3334a5['attributes'][_0x1e15('0x3a')]?_0x3334a5['attributes']:_0x517d8e[_0x1e15('0x32')];if(!_0x28bdfe[_0x1e15('0x34')]['hasOwnProperty']('nolimit')){_0x3334a5[_0x1e15('0x21')]=qs[_0x1e15('0x21')](_0x28bdfe['query'][_0x1e15('0x21')]);_0x3334a5[_0x1e15('0x1e')]=qs[_0x1e15('0x1e')](_0x28bdfe[_0x1e15('0x34')][_0x1e15('0x1e')]);}_0x3334a5[_0x1e15('0x3b')]=qs[_0x1e15('0x3c')](_0x28bdfe[_0x1e15('0x34')][_0x1e15('0x3c')]);_0x3334a5[_0x1e15('0x3d')]=qs[_0x1e15('0x36')](_[_0x1e15('0x3e')](_0x28bdfe['query'],_0x517d8e[_0x1e15('0x36')]),_0x4b446b);if(_0x28bdfe['query'][_0x1e15('0x3f')]){_0x3334a5[_0x1e15('0x3d')]=_[_0x1e15('0x40')](_0x3334a5[_0x1e15('0x3d')],{'$or':_[_0x1e15('0x33')](_0x4b446b,function(_0x20ee76){if(_0x20ee76[_0x1e15('0x31')]!==_0x1e15('0x41')){var _0xf517ff={};_0xf517ff[_0x20ee76[_0x1e15('0x2b')]]={'$like':'%'+_0x28bdfe[_0x1e15('0x34')]['filter']+'%'};return _0xf517ff;}})});}_0x3334a5=_[_0x1e15('0x40')]({},_0x3334a5,_0x28bdfe[_0x1e15('0x42')]);var _0x35e993={'where':_0x3334a5[_0x1e15('0x3d')]};return db[_0x1e15('0x2e')][_0x1e15('0x20')](_0x35e993)[_0x1e15('0x28')](function(_0x13fcc7){_0x20714d['count']=_0x13fcc7;if(_0x28bdfe[_0x1e15('0x34')][_0x1e15('0x43')]){_0x3334a5[_0x1e15('0x44')]=[{'all':!![]}];}return db['VtigerAccount'][_0x1e15('0x45')](_0x3334a5);})[_0x1e15('0x28')](function(_0x4643c3){_0x20714d[_0x1e15('0x46')]=_0x4643c3;return _0x20714d;})[_0x1e15('0x28')](respondWithFilteredResult(_0x112d26,_0x3334a5))[_0x1e15('0x47')](handleError(_0x112d26,null));};exports[_0x1e15('0x48')]=function(_0x3fa1e2,_0x3dc989){var _0x392d81={'raw':![],'where':{'id':_0x3fa1e2['params']['id']}},_0x4c662a={};_0x4c662a[_0x1e15('0x32')]=_[_0x1e15('0x35')](db['VtigerAccount'][_0x1e15('0x2f')]);_0x4c662a[_0x1e15('0x34')]=_[_0x1e15('0x35')](_0x3fa1e2[_0x1e15('0x34')]);_0x4c662a['filters']=_[_0x1e15('0x37')](_0x4c662a['model'],_0x4c662a['query']);_0x392d81['attributes']=_[_0x1e15('0x37')](_0x4c662a['model'],qs['fields'](_0x3fa1e2[_0x1e15('0x34')]['fields']));_0x392d81[_0x1e15('0x38')]=_0x392d81[_0x1e15('0x38')][_0x1e15('0x3a')]?_0x392d81[_0x1e15('0x38')]:_0x4c662a[_0x1e15('0x32')];if(_0x3fa1e2[_0x1e15('0x34')]['includeAll']){_0x392d81[_0x1e15('0x44')]=[{'all':!![]}];}_0x392d81=_[_0x1e15('0x40')]({},_0x392d81,_0x3fa1e2[_0x1e15('0x42')]);return db['VtigerAccount'][_0x1e15('0x49')](_0x392d81)['then'](handleEntityNotFound(_0x3dc989,null))['then'](respondWithResult(_0x3dc989,null))[_0x1e15('0x47')](handleError(_0x3dc989,null));};exports[_0x1e15('0x4a')]=function(_0x2dd0c6,_0x1e293f){return db[_0x1e15('0x2e')][_0x1e15('0x4a')](_0x2dd0c6[_0x1e15('0x4b')],{})[_0x1e15('0x28')](respondWithResult(_0x1e293f,0xc9))[_0x1e15('0x47')](handleError(_0x1e293f,null));};exports[_0x1e15('0x26')]=function(_0x4dacd6,_0x504f45){if(_0x4dacd6[_0x1e15('0x4b')]['id']){delete _0x4dacd6[_0x1e15('0x4b')]['id'];}return db['VtigerAccount'][_0x1e15('0x49')]({'where':{'id':_0x4dacd6[_0x1e15('0x4c')]['id']}})[_0x1e15('0x28')](handleEntityNotFound(_0x504f45,null))['then'](saveUpdates(_0x4dacd6[_0x1e15('0x4b')],null))[_0x1e15('0x28')](respondWithResult(_0x504f45,null))[_0x1e15('0x47')](handleError(_0x504f45,null));};exports[_0x1e15('0x27')]=function(_0x1b93cf,_0x22406e){return db[_0x1e15('0x2e')][_0x1e15('0x49')]({'where':{'id':_0x1b93cf['params']['id']}})[_0x1e15('0x28')](handleEntityNotFound(_0x22406e,null))[_0x1e15('0x28')](removeEntity(_0x22406e,null))['catch'](handleError(_0x22406e,null));};exports[_0x1e15('0x4d')]=function(_0x2fef50,_0xb16252,_0x32787f){var _0x127057={};var _0x376a6c={};var _0x2bc053;var _0x36bbfa;return db['VtigerAccount'][_0x1e15('0x4e')]({'where':{'id':_0x2fef50[_0x1e15('0x4c')]['id']}})[_0x1e15('0x28')](handleEntityNotFound(_0xb16252,null))[_0x1e15('0x28')](function(_0x3e5553){if(_0x3e5553){_0x2bc053=_0x3e5553;_0x376a6c[_0x1e15('0x32')]=_[_0x1e15('0x35')](db[_0x1e15('0x4f')][_0x1e15('0x2f')]);_0x376a6c['query']=_[_0x1e15('0x35')](_0x2fef50['query']);_0x376a6c[_0x1e15('0x36')]=_['intersection'](_0x376a6c[_0x1e15('0x32')],_0x376a6c['query']);_0x127057[_0x1e15('0x38')]=_[_0x1e15('0x37')](_0x376a6c[_0x1e15('0x32')],qs[_0x1e15('0x39')](_0x2fef50[_0x1e15('0x34')][_0x1e15('0x39')]));_0x127057['attributes']=_0x127057[_0x1e15('0x38')]['length']?_0x127057[_0x1e15('0x38')]:_0x376a6c[_0x1e15('0x32')];_0x127057[_0x1e15('0x3b')]=qs[_0x1e15('0x3c')](_0x2fef50[_0x1e15('0x34')][_0x1e15('0x3c')]);_0x127057['where']=qs[_0x1e15('0x36')](_[_0x1e15('0x3e')](_0x2fef50[_0x1e15('0x34')],_0x376a6c[_0x1e15('0x36')]));if(_0x2fef50[_0x1e15('0x34')]['filter']){_0x127057[_0x1e15('0x3d')]=_[_0x1e15('0x40')](_0x127057[_0x1e15('0x3d')],{'$or':_[_0x1e15('0x33')](_0x127057[_0x1e15('0x38')],function(_0x583e3b){var _0x334b53={};_0x334b53[_0x583e3b]={'$like':'%'+_0x2fef50[_0x1e15('0x34')][_0x1e15('0x3f')]+'%'};return _0x334b53;})});}_0x127057=_['merge']({},_0x127057,_0x2fef50[_0x1e15('0x42')]);return _0x2bc053[_0x1e15('0x4d')](_0x127057);}})[_0x1e15('0x28')](function(_0x2802d2){if(_0x2802d2){_0x36bbfa=_0x2802d2[_0x1e15('0x3a')];if(!_0x2fef50[_0x1e15('0x34')]['hasOwnProperty']('nolimit')){_0x127057[_0x1e15('0x21')]=qs[_0x1e15('0x21')](_0x2fef50[_0x1e15('0x34')][_0x1e15('0x21')]);_0x127057['offset']=qs[_0x1e15('0x1e')](_0x2fef50[_0x1e15('0x34')][_0x1e15('0x1e')]);}return _0x2bc053['getConfigurations'](_0x127057);}})[_0x1e15('0x28')](function(_0x35a4d6){if(_0x35a4d6){return _0x35a4d6?{'count':_0x36bbfa,'rows':_0x35a4d6}:null;}})['then'](respondWithResult(_0xb16252,null))[_0x1e15('0x47')](handleError(_0xb16252,null));};exports['addConfiguration']=function(_0x1c6d90,_0x43eda3,_0x3afd88){if(_0x1c6d90[_0x1e15('0x4b')]['id']){delete _0x1c6d90[_0x1e15('0x4b')]['id'];}return db[_0x1e15('0x2e')][_0x1e15('0x4e')]({'where':{'id':_0x1c6d90[_0x1e15('0x4c')]['id']}})[_0x1e15('0x28')](handleEntityNotFound(_0x43eda3,null))[_0x1e15('0x28')](function(_0x5a3349){if(_0x5a3349){_0x1c6d90[_0x1e15('0x4b')]['AccountId']=_0x5a3349['id'];_0x1c6d90[_0x1e15('0x4b')][_0x1e15('0x50')]=integrations['getSubjects'](_0x1c6d90['body']['channel'],_0x1c6d90[_0x1e15('0x4b')][_0x1e15('0x31')]);_0x1c6d90[_0x1e15('0x4b')][_0x1e15('0x51')]=integrations[_0x1e15('0x52')](_0x1c6d90[_0x1e15('0x4b')][_0x1e15('0x53')],_0x1c6d90['body'][_0x1e15('0x31')]);return db[_0x1e15('0x4f')][_0x1e15('0x4a')](_0x1c6d90['body'],{'include':[{'model':db[_0x1e15('0x54')],'as':_0x1e15('0x50')},{'model':db[_0x1e15('0x54')],'as':_0x1e15('0x51')}]});}return null;})[_0x1e15('0x28')](respondWithResult(_0x43eda3,null))[_0x1e15('0x47')](handleError(_0x43eda3,null));};var md5=require(_0x1e15('0x55'));exports[_0x1e15('0x56')]=function(_0x5f0281,_0x1b5b41,_0x46e093){var _0x227bdd=null;var _0xd14a6a=null;var _0x24a3c9=null;var _0xccac68=null;var _0x68f587='';return db['VtigerAccount'][_0x1e15('0x4e')]({'where':{'id':_0x5f0281['params']['id']},'attributes':['id',_0x1e15('0x2b'),'username',_0x1e15('0x57'),_0x1e15('0x58'),_0x1e15('0x59'),_0x1e15('0x5a'),_0x1e15('0x5b')]})[_0x1e15('0x28')](handleEntityNotFound(_0x1b5b41,null))[_0x1e15('0x28')](function(_0x438607){if(_0x438607){_0x227bdd=_0x438607[_0x1e15('0x5c')];_0xd14a6a=_0x438607[_0x1e15('0x5b')];_0x24a3c9=_0x438607[_0x1e15('0x58')];_0x68f587=_0x438607[_0x1e15('0x59')];var _0x264fe5=_0x68f587[_0x1e15('0x5d')](-0x1);if(_0x264fe5==='/'){_0x68f587=_0x68f587[_0x1e15('0x5e')](0x0,_0x68f587['lastIndexOf'](_0x264fe5));}_0xccac68=util[_0x1e15('0x5f')]('%s/webservice.php',_0x68f587);var _0x428001={'method':_0x1e15('0x60'),'uri':_0xccac68,'qs':{'operation':'getchallenge','username':_0x438607[_0x1e15('0x5c')]},'json':!![]};return rp(_0x428001);}})[_0x1e15('0x28')](function(_0x98765f){if(_0x98765f[_0x1e15('0x61')]){var _0x433e3d={'method':_0x1e15('0x62'),'uri':_0xccac68,'form':{'operation':_0x1e15('0x63'),'username':_0x227bdd,'accessKey':md5(_0x98765f['result'][_0x1e15('0x64')]+_0xd14a6a)},'json':!![]};return rp(_0x433e3d);}})['then'](function(_0x58a598){if(_0x58a598[_0x1e15('0x61')]){var _0x1d1793={'method':'GET','uri':_0xccac68,'qs':{'operation':'describe','username':_0x227bdd,'sessionName':_0x58a598[_0x1e15('0x65')][_0x1e15('0x66')],'elementType':_0x24a3c9},'json':!![]};return rp(_0x1d1793);}})['then'](function(_0x3d09df){if(_0x3d09df[_0x1e15('0x61')]){var _0x3e0106=[_0x1e15('0x67'),_0x1e15('0x68'),_0x1e15('0x69')];_[_0x1e15('0x6a')](_0x3d09df[_0x1e15('0x65')]['fields'],function(_0x165ad5){return _0x3e0106[_0x1e15('0x6b')](_0x165ad5[_0x1e15('0x31')][_0x1e15('0x2b')]);});_[_0x1e15('0x6a')](_0x3d09df['result']['fields'],function(_0x38fa58){return _0x38fa58[_0x1e15('0x6c')]===_0x1e15('0x6d');});return{'count':_0x3d09df[_0x1e15('0x65')][_0x1e15('0x39')][_0x1e15('0x3a')],'rows':_[_0x1e15('0x33')](_0x3d09df[_0x1e15('0x65')][_0x1e15('0x39')],function(_0x56f6c4){return{'id':_0x56f6c4[_0x1e15('0x2b')],'name':_0x56f6c4[_0x1e15('0x6e')],'custom':_['startsWith'](_0x56f6c4[_0x1e15('0x2b')],_0x1e15('0x6f'))?!![]:![],'options':_0x56f6c4[_0x1e15('0x31')][_0x1e15('0x2b')]===_0x1e15('0x70')&&_0x56f6c4[_0x1e15('0x31')][_0x1e15('0x71')][_0x1e15('0x3a')]>0x0?_['map'](_0x56f6c4['type'][_0x1e15('0x71')],function(_0x361c14){return{'name':_0x361c14[_0x1e15('0x6e')],'value':_0x361c14[_0x1e15('0x72')]};}):[]};})};}})[_0x1e15('0x28')](respondWithResult(_0x1b5b41,null))[_0x1e15('0x47')](function(_0x823247){console[_0x1e15('0x73')](_0x1e15('0x74')+_0x823247);var _0x4087f7=_0x5f0281[_0x1e15('0x34')][_0x1e15('0x75')]?0x1f4:_0x823247['statusCode']||0x1f4;logger[_0x1e15('0x2a')](_0x1e15('0x76'),_0x1e15('0x56'),_0x4087f7,JSON['stringify'](_0x823247));delete _0x823247[_0x1e15('0x2b')];if(_0x4087f7===0x191){_0x4087f7=0x190;}_0x1b5b41[_0x1e15('0x1c')](_0x4087f7)['send'](_0x5f0281[_0x1e15('0x34')][_0x1e15('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x823247[_0x1e15('0x77')]}:_0x823247);});}; \ No newline at end of file +var _0xca1b=['Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','catch','show','params','find','create','body','getConfigurations','VtigerConfiguration','order','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','VtigerField','Subjects','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','format','%s/webservice.php','GET','success','POST','result','describe','sessionName','reference','owner','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x90c365,_0x5aadef){var _0x3c5b37=function(_0xe2a7fe){while(--_0xe2a7fe){_0x90c365['push'](_0x90c365['shift']());}};_0x3c5b37(++_0x5aadef);}(_0xca1b,0x1da));var _0xbca1=function(_0x5b149a,_0x1d4b98){_0x5b149a=_0x5b149a-0x0;var _0x58875e=_0xca1b[_0x5b149a];return _0x58875e;};'use strict';var emlformat=require(_0xbca1('0x0'));var rimraf=require(_0xbca1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbca1('0x2'));var rp=require(_0xbca1('0x3'));var moment=require('moment');var BPromise=require(_0xbca1('0x4'));var Mustache=require(_0xbca1('0x5'));var util=require('util');var path=require(_0xbca1('0x6'));var sox=require(_0xbca1('0x7'));var csv=require(_0xbca1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbca1('0x9'));var squel=require(_0xbca1('0xa'));var crypto=require(_0xbca1('0xb'));var jsforce=require(_0xbca1('0xc'));var deskjs=require(_0xbca1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbca1('0xe'));var Papa=require(_0xbca1('0xf'));var Redis=require(_0xbca1('0x10'));var authService=require(_0xbca1('0x11'));var qs=require(_0xbca1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbca1('0x13'));var utils=require(_0xbca1('0x14'));var config=require(_0xbca1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xbca1('0x16'));function respondWithStatusCode(_0x47efca,_0xd29dcd){_0xd29dcd=_0xd29dcd||0xcc;return function(_0x5c72a0){if(_0x5c72a0){return _0x47efca['sendStatus'](_0xd29dcd);}return _0x47efca[_0xbca1('0x17')](_0xd29dcd)[_0xbca1('0x18')]();};}function respondWithResult(_0x15f892,_0x2300a3){_0x2300a3=_0x2300a3||0xc8;return function(_0x46eea4){if(_0x46eea4){return _0x15f892[_0xbca1('0x17')](_0x2300a3)[_0xbca1('0x19')](_0x46eea4);}};}function respondWithFilteredResult(_0x350101,_0x30c597){return function(_0x548883){if(_0x548883){var _0x3b0e76=typeof _0x30c597[_0xbca1('0x1a')]===_0xbca1('0x1b')&&typeof _0x30c597[_0xbca1('0x1c')]===_0xbca1('0x1b');var _0x5b8a74=_0x548883['count'];var _0x559363=_0x3b0e76?0x0:_0x30c597['offset'];var _0x5f124e=_0x3b0e76?_0x548883[_0xbca1('0x1d')]:_0x30c597[_0xbca1('0x1a')]+_0x30c597[_0xbca1('0x1c')];var _0x371187;if(_0x5f124e>=_0x5b8a74){_0x5f124e=_0x5b8a74;_0x371187=0xc8;}else{_0x371187=0xce;}_0x350101[_0xbca1('0x17')](_0x371187);return _0x350101[_0xbca1('0x1e')](_0xbca1('0x1f'),_0x559363+'-'+_0x5f124e+'/'+_0x5b8a74)[_0xbca1('0x19')](_0x548883);}return null;};}function patchUpdates(_0x2f7001){return function(_0xf1cac1){try{jsonpatch[_0xbca1('0x20')](_0xf1cac1,_0x2f7001,!![]);}catch(_0x1245a0){return BPromise[_0xbca1('0x21')](_0x1245a0);}return _0xf1cac1[_0xbca1('0x22')]();};}function saveUpdates(_0x210f66,_0x4cdedb){return function(_0x30761d){if(_0x30761d){return _0x30761d[_0xbca1('0x23')](_0x210f66)[_0xbca1('0x24')](function(_0x3e5fa8){return _0x3e5fa8;});}return null;};}function removeEntity(_0xee009,_0x4910f6){return function(_0x22cdef){if(_0x22cdef){return _0x22cdef[_0xbca1('0x25')]()[_0xbca1('0x24')](function(){_0xee009['status'](0xcc)[_0xbca1('0x18')]();});}};}function handleEntityNotFound(_0x29ce0a,_0xddbf17){return function(_0x5e6292){if(!_0x5e6292){_0x29ce0a['sendStatus'](0x194);}return _0x5e6292;};}function handleError(_0x29b7df,_0x13d20e){_0x13d20e=_0x13d20e||0x1f4;return function(_0x501867){logger[_0xbca1('0x26')](_0x501867[_0xbca1('0x27')]);if(_0x501867[_0xbca1('0x28')]){delete _0x501867['name'];}_0x29b7df['status'](_0x13d20e)[_0xbca1('0x29')](_0x501867);};}exports[_0xbca1('0x2a')]=function(_0x360511,_0x107368){var _0x4069c6={},_0x303cb0={},_0x130b2b={'count':0x0,'rows':[]};var _0x510dee=_[_0xbca1('0x2b')](db[_0xbca1('0x2c')][_0xbca1('0x2d')],function(_0x448998){return{'name':_0x448998[_0xbca1('0x2e')],'type':_0x448998[_0xbca1('0x2f')][_0xbca1('0x30')]};});_0x303cb0[_0xbca1('0x31')]=_['map'](_0x510dee,_0xbca1('0x28'));_0x303cb0['query']=_[_0xbca1('0x32')](_0x360511['query']);_0x303cb0['filters']=_[_0xbca1('0x33')](_0x303cb0['model'],_0x303cb0[_0xbca1('0x34')]);_0x4069c6[_0xbca1('0x35')]=_['intersection'](_0x303cb0[_0xbca1('0x31')],qs[_0xbca1('0x36')](_0x360511[_0xbca1('0x34')][_0xbca1('0x36')]));_0x4069c6[_0xbca1('0x35')]=_0x4069c6[_0xbca1('0x35')][_0xbca1('0x37')]?_0x4069c6[_0xbca1('0x35')]:_0x303cb0['model'];if(!_0x360511[_0xbca1('0x34')][_0xbca1('0x38')](_0xbca1('0x39'))){_0x4069c6[_0xbca1('0x1c')]=qs['limit'](_0x360511[_0xbca1('0x34')][_0xbca1('0x1c')]);_0x4069c6[_0xbca1('0x1a')]=qs['offset'](_0x360511[_0xbca1('0x34')][_0xbca1('0x1a')]);}_0x4069c6['order']=qs[_0xbca1('0x3a')](_0x360511[_0xbca1('0x34')]['sort']);_0x4069c6[_0xbca1('0x3b')]=qs[_0xbca1('0x3c')](_[_0xbca1('0x3d')](_0x360511[_0xbca1('0x34')],_0x303cb0[_0xbca1('0x3c')]),_0x510dee);if(_0x360511[_0xbca1('0x34')][_0xbca1('0x3e')]){_0x4069c6[_0xbca1('0x3b')]=_['merge'](_0x4069c6['where'],{'$or':_[_0xbca1('0x2b')](_0x510dee,function(_0x30737f){if(_0x30737f[_0xbca1('0x2f')]!=='VIRTUAL'){var _0x412a8e={};_0x412a8e[_0x30737f[_0xbca1('0x28')]]={'$like':'%'+_0x360511['query'][_0xbca1('0x3e')]+'%'};return _0x412a8e;}})});}_0x4069c6=_[_0xbca1('0x3f')]({},_0x4069c6,_0x360511[_0xbca1('0x40')]);var _0x19ea1a={'where':_0x4069c6[_0xbca1('0x3b')]};return db['VtigerAccount'][_0xbca1('0x1d')](_0x19ea1a)['then'](function(_0x586998){_0x130b2b[_0xbca1('0x1d')]=_0x586998;if(_0x360511['query']['includeAll']){_0x4069c6[_0xbca1('0x41')]=[{'all':!![]}];}return db[_0xbca1('0x2c')][_0xbca1('0x42')](_0x4069c6);})['then'](function(_0x4822e3){_0x130b2b['rows']=_0x4822e3;return _0x130b2b;})[_0xbca1('0x24')](respondWithFilteredResult(_0x107368,_0x4069c6))[_0xbca1('0x43')](handleError(_0x107368,null));};exports[_0xbca1('0x44')]=function(_0x5eab5e,_0x3c5dfa){var _0x26063f={'raw':![],'where':{'id':_0x5eab5e[_0xbca1('0x45')]['id']}},_0xda0479={};_0xda0479[_0xbca1('0x31')]=_[_0xbca1('0x32')](db[_0xbca1('0x2c')][_0xbca1('0x2d')]);_0xda0479[_0xbca1('0x34')]=_[_0xbca1('0x32')](_0x5eab5e[_0xbca1('0x34')]);_0xda0479['filters']=_[_0xbca1('0x33')](_0xda0479[_0xbca1('0x31')],_0xda0479[_0xbca1('0x34')]);_0x26063f['attributes']=_[_0xbca1('0x33')](_0xda0479[_0xbca1('0x31')],qs[_0xbca1('0x36')](_0x5eab5e[_0xbca1('0x34')][_0xbca1('0x36')]));_0x26063f[_0xbca1('0x35')]=_0x26063f[_0xbca1('0x35')][_0xbca1('0x37')]?_0x26063f[_0xbca1('0x35')]:_0xda0479[_0xbca1('0x31')];if(_0x5eab5e['query']['includeAll']){_0x26063f[_0xbca1('0x41')]=[{'all':!![]}];}_0x26063f=_['merge']({},_0x26063f,_0x5eab5e[_0xbca1('0x40')]);return db[_0xbca1('0x2c')][_0xbca1('0x46')](_0x26063f)[_0xbca1('0x24')](handleEntityNotFound(_0x3c5dfa,null))[_0xbca1('0x24')](respondWithResult(_0x3c5dfa,null))[_0xbca1('0x43')](handleError(_0x3c5dfa,null));};exports[_0xbca1('0x47')]=function(_0x547903,_0x122453){return db[_0xbca1('0x2c')]['create'](_0x547903[_0xbca1('0x48')],{})['then'](respondWithResult(_0x122453,0xc9))[_0xbca1('0x43')](handleError(_0x122453,null));};exports[_0xbca1('0x23')]=function(_0x13b619,_0x2e77e5){if(_0x13b619['body']['id']){delete _0x13b619[_0xbca1('0x48')]['id'];}return db[_0xbca1('0x2c')]['find']({'where':{'id':_0x13b619[_0xbca1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e77e5,null))[_0xbca1('0x24')](saveUpdates(_0x13b619['body'],null))[_0xbca1('0x24')](respondWithResult(_0x2e77e5,null))[_0xbca1('0x43')](handleError(_0x2e77e5,null));};exports[_0xbca1('0x25')]=function(_0x1cdffb,_0x17369b){return db[_0xbca1('0x2c')][_0xbca1('0x46')]({'where':{'id':_0x1cdffb[_0xbca1('0x45')]['id']}})[_0xbca1('0x24')](handleEntityNotFound(_0x17369b,null))[_0xbca1('0x24')](removeEntity(_0x17369b,null))[_0xbca1('0x43')](handleError(_0x17369b,null));};exports[_0xbca1('0x49')]=function(_0x5718da,_0x407f0c,_0x47493d){var _0xadda6a={};var _0x549f4e={};var _0x584f37;var _0x26ee66;return db[_0xbca1('0x2c')]['findOne']({'where':{'id':_0x5718da[_0xbca1('0x45')]['id']}})[_0xbca1('0x24')](handleEntityNotFound(_0x407f0c,null))[_0xbca1('0x24')](function(_0x2ddea5){if(_0x2ddea5){_0x584f37=_0x2ddea5;_0x549f4e[_0xbca1('0x31')]=_[_0xbca1('0x32')](db[_0xbca1('0x4a')][_0xbca1('0x2d')]);_0x549f4e['query']=_[_0xbca1('0x32')](_0x5718da[_0xbca1('0x34')]);_0x549f4e[_0xbca1('0x3c')]=_['intersection'](_0x549f4e[_0xbca1('0x31')],_0x549f4e[_0xbca1('0x34')]);_0xadda6a['attributes']=_[_0xbca1('0x33')](_0x549f4e['model'],qs[_0xbca1('0x36')](_0x5718da[_0xbca1('0x34')]['fields']));_0xadda6a[_0xbca1('0x35')]=_0xadda6a[_0xbca1('0x35')][_0xbca1('0x37')]?_0xadda6a[_0xbca1('0x35')]:_0x549f4e[_0xbca1('0x31')];_0xadda6a[_0xbca1('0x4b')]=qs['sort'](_0x5718da[_0xbca1('0x34')][_0xbca1('0x3a')]);_0xadda6a[_0xbca1('0x3b')]=qs[_0xbca1('0x3c')](_[_0xbca1('0x3d')](_0x5718da[_0xbca1('0x34')],_0x549f4e[_0xbca1('0x3c')]));if(_0x5718da[_0xbca1('0x34')][_0xbca1('0x3e')]){_0xadda6a[_0xbca1('0x3b')]=_[_0xbca1('0x3f')](_0xadda6a['where'],{'$or':_[_0xbca1('0x2b')](_0xadda6a['attributes'],function(_0x36b316){var _0x4e1c36={};_0x4e1c36[_0x36b316]={'$like':'%'+_0x5718da[_0xbca1('0x34')][_0xbca1('0x3e')]+'%'};return _0x4e1c36;})});}_0xadda6a=_[_0xbca1('0x3f')]({},_0xadda6a,_0x5718da[_0xbca1('0x40')]);return _0x584f37[_0xbca1('0x49')](_0xadda6a);}})[_0xbca1('0x24')](function(_0x3b3479){if(_0x3b3479){_0x26ee66=_0x3b3479['length'];if(!_0x5718da[_0xbca1('0x34')][_0xbca1('0x38')]('nolimit')){_0xadda6a[_0xbca1('0x1c')]=qs[_0xbca1('0x1c')](_0x5718da[_0xbca1('0x34')]['limit']);_0xadda6a[_0xbca1('0x1a')]=qs[_0xbca1('0x1a')](_0x5718da[_0xbca1('0x34')][_0xbca1('0x1a')]);}return _0x584f37[_0xbca1('0x49')](_0xadda6a);}})[_0xbca1('0x24')](function(_0x438b7c){if(_0x438b7c){return _0x438b7c?{'count':_0x26ee66,'rows':_0x438b7c}:null;}})[_0xbca1('0x24')](respondWithResult(_0x407f0c,null))[_0xbca1('0x43')](handleError(_0x407f0c,null));};exports[_0xbca1('0x4c')]=function(_0x4bb75c,_0x1a2331,_0x57fbac){if(_0x4bb75c[_0xbca1('0x48')]['id']){delete _0x4bb75c[_0xbca1('0x48')]['id'];}return db[_0xbca1('0x2c')][_0xbca1('0x4d')]({'where':{'id':_0x4bb75c[_0xbca1('0x45')]['id']}})[_0xbca1('0x24')](handleEntityNotFound(_0x1a2331,null))[_0xbca1('0x24')](function(_0x9c6f01){if(_0x9c6f01){_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x4e')]=_0x9c6f01['id'];_0x4bb75c['body']['Subjects']=integrations[_0xbca1('0x4f')](_0x4bb75c['body'][_0xbca1('0x50')],_0x4bb75c[_0xbca1('0x48')]['type']);_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x51')]=integrations['getDescriptions'](_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x50')],_0x4bb75c[_0xbca1('0x48')][_0xbca1('0x2f')]);return db['VtigerConfiguration'][_0xbca1('0x47')](_0x4bb75c[_0xbca1('0x48')],{'include':[{'model':db[_0xbca1('0x52')],'as':_0xbca1('0x53')},{'model':db[_0xbca1('0x52')],'as':'Descriptions'}]});}return null;})[_0xbca1('0x24')](respondWithResult(_0x1a2331,null))[_0xbca1('0x43')](handleError(_0x1a2331,null));};var md5=require(_0xbca1('0x54'));exports[_0xbca1('0x55')]=function(_0x35740f,_0x4ed0f1,_0x3b27cc){var _0x46ac25=null;var _0x5ad33d=null;var _0x4705fc=null;var _0x283623=null;var _0xe58362='';return db[_0xbca1('0x2c')][_0xbca1('0x4d')]({'where':{'id':_0x35740f[_0xbca1('0x45')]['id']},'attributes':['id',_0xbca1('0x28'),'username','description',_0xbca1('0x56'),_0xbca1('0x57'),_0xbca1('0x58'),_0xbca1('0x59')]})[_0xbca1('0x24')](handleEntityNotFound(_0x4ed0f1,null))[_0xbca1('0x24')](function(_0x559848){if(_0x559848){_0x46ac25=_0x559848[_0xbca1('0x5a')];_0x5ad33d=_0x559848[_0xbca1('0x59')];_0x4705fc=_0x559848['moduleName'];_0xe58362=_0x559848[_0xbca1('0x57')];var _0x45b456=_0xe58362[_0xbca1('0x5b')](-0x1);if(_0x45b456==='/'){_0xe58362=_0xe58362[_0xbca1('0x5c')](0x0,_0xe58362['lastIndexOf'](_0x45b456));}_0x283623=util[_0xbca1('0x5d')](_0xbca1('0x5e'),_0xe58362);var _0x1021dc={'method':_0xbca1('0x5f'),'uri':_0x283623,'qs':{'operation':'getchallenge','username':_0x559848[_0xbca1('0x5a')]},'json':!![]};return rp(_0x1021dc);}})[_0xbca1('0x24')](function(_0x1b4534){if(_0x1b4534[_0xbca1('0x60')]){var _0x43e0fa={'method':_0xbca1('0x61'),'uri':_0x283623,'form':{'operation':'login','username':_0x46ac25,'accessKey':md5(_0x1b4534[_0xbca1('0x62')]['token']+_0x5ad33d)},'json':!![]};return rp(_0x43e0fa);}})[_0xbca1('0x24')](function(_0x29e184){if(_0x29e184['success']){var _0x735ef1={'method':_0xbca1('0x5f'),'uri':_0x283623,'qs':{'operation':_0xbca1('0x63'),'username':_0x46ac25,'sessionName':_0x29e184[_0xbca1('0x62')][_0xbca1('0x64')],'elementType':_0x4705fc},'json':!![]};return rp(_0x735ef1);}})[_0xbca1('0x24')](function(_0x48c211){if(_0x48c211[_0xbca1('0x60')]){var _0x4fd5ec=['autogenerated',_0xbca1('0x65'),_0xbca1('0x66')];_[_0xbca1('0x67')](_0x48c211[_0xbca1('0x62')][_0xbca1('0x36')],function(_0x4a37bb){return _0x4fd5ec[_0xbca1('0x68')](_0x4a37bb[_0xbca1('0x2f')][_0xbca1('0x28')]);});_[_0xbca1('0x67')](_0x48c211['result'][_0xbca1('0x36')],function(_0x44dca5){return _0x44dca5['editable']===_0xbca1('0x69');});return{'count':_0x48c211[_0xbca1('0x62')][_0xbca1('0x36')][_0xbca1('0x37')],'rows':_[_0xbca1('0x2b')](_0x48c211['result']['fields'],function(_0x306b88){return{'id':_0x306b88[_0xbca1('0x28')],'name':_0x306b88[_0xbca1('0x6a')],'custom':_[_0xbca1('0x6b')](_0x306b88[_0xbca1('0x28')],_0xbca1('0x6c'))?!![]:![],'options':_0x306b88[_0xbca1('0x2f')][_0xbca1('0x28')]===_0xbca1('0x6d')&&_0x306b88[_0xbca1('0x2f')][_0xbca1('0x6e')]['length']>0x0?_[_0xbca1('0x2b')](_0x306b88[_0xbca1('0x2f')][_0xbca1('0x6e')],function(_0x36f485){return{'name':_0x36f485['label'],'value':_0x36f485['value']};}):[]};})};}})[_0xbca1('0x24')](respondWithResult(_0x4ed0f1,null))['catch'](function(_0x26868e){console[_0xbca1('0x6f')](_0xbca1('0x70')+_0x26868e);var _0x19834d=_0x35740f[_0xbca1('0x34')][_0xbca1('0x71')]?0x1f4:_0x26868e['statusCode']||0x1f4;logger[_0xbca1('0x26')](_0xbca1('0x72'),_0xbca1('0x55'),_0x19834d,JSON[_0xbca1('0x73')](_0x26868e));delete _0x26868e[_0xbca1('0x28')];if(_0x19834d===0x191){_0x19834d=0x190;}_0x4ed0f1['status'](_0x19834d)[_0xbca1('0x29')](_0x35740f[_0xbca1('0x34')][_0xbca1('0x71')]?{'message':_0xbca1('0x74'),'statusCode':_0x26868e[_0xbca1('0x75')]}:_0x26868e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index dbf2b9b..a818c0e 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 _0xef28=['request-promise','path','../../config/environment','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x19decc,_0x380a7d){var _0x1bfe15=function(_0x28ac64){while(--_0x28ac64){_0x19decc['push'](_0x19decc['shift']());}};_0x1bfe15(++_0x380a7d);}(_0xef28,0x1db));var _0x8ef2=function(_0x23c5ac,_0x2c10c7){_0x23c5ac=_0x23c5ac-0x0;var _0x3614b3=_0xef28[_0x23c5ac];return _0x3614b3;};'use strict';var _=require(_0x8ef2('0x0'));var util=require(_0x8ef2('0x1'));var logger=require(_0x8ef2('0x2'))(_0x8ef2('0x3'));var moment=require(_0x8ef2('0x4'));var BPromise=require('bluebird');var rp=require(_0x8ef2('0x5'));var fs=require('fs');var path=require(_0x8ef2('0x6'));var rimraf=require('rimraf');var config=require(_0x8ef2('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x8ef2('0x8'));module[_0x8ef2('0x9')]=function(_0xeb9859,_0x372a12){return _0xeb9859['define'](_0x8ef2('0xa'),attributes,{'tableName':_0x8ef2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe922=['util','api','bluebird','request-promise','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x8e8337,_0x33639e){var _0x35950c=function(_0x441dfd){while(--_0x441dfd){_0x8e8337['push'](_0x8e8337['shift']());}};_0x35950c(++_0x33639e);}(_0xe922,0x121));var _0x2e92=function(_0x11167c,_0xb0ff07){_0x11167c=_0x11167c-0x0;var _0x34bdb0=_0xe922[_0x11167c];return _0x34bdb0;};'use strict';var _=require(_0x2e92('0x0'));var util=require(_0x2e92('0x1'));var logger=require('../../config/logger')(_0x2e92('0x2'));var moment=require('moment');var BPromise=require(_0x2e92('0x3'));var rp=require(_0x2e92('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e92('0x5'));var attributes=require(_0x2e92('0x6'));var integrations=require(_0x2e92('0x7'));module[_0x2e92('0x8')]=function(_0x4822af,_0x25f70b){return _0x4822af[_0x2e92('0x9')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index f5f9c67..bd00ba2 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 _0x373d=['VtigerAccount','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount'];(function(_0x2d3c60,_0x4df458){var _0x560041=function(_0x5568af){while(--_0x5568af){_0x2d3c60['push'](_0x2d3c60['shift']());}};_0x560041(++_0x4df458);}(_0x373d,0x1e2));var _0xd373=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x373d[_0x3ba924];return _0x4cc1df;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['GetVtigerAccount']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['VtigerAccount']['findAll']({'raw':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x15')]===undefined?!![]:![]:!![],'where':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x16')]||null:null,'attributes':_0x460259['options']?_0x460259[_0xd373('0x14')][_0xd373('0x17')]||null:null,'limit':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x18')]||null:null,'include':_0x460259[_0xd373('0x14')]?_0x460259['options'][_0xd373('0x19')]?_[_0xd373('0x1a')](_0x460259[_0xd373('0x14')][_0xd373('0x19')],function(_0x217ee7){return{'model':db[_0x217ee7[_0xd373('0x1b')]],'as':_0x217ee7['as'],'attributes':_0x217ee7[_0xd373('0x17')],'include':_0x217ee7[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x217ee7[_0xd373('0x19')],function(_0x437110){return{'model':db[_0x437110[_0xd373('0x1b')]],'as':_0x437110['as'],'attributes':_0x437110[_0xd373('0x17')],'include':_0x437110[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x437110[_0xd373('0x19')],function(_0x50b987){return{'model':db[_0x50b987[_0xd373('0x1b')]],'as':_0x50b987['as'],'attributes':_0x50b987[_0xd373('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd373('0x1c')](function(_0x45ee58){logger[_0xd373('0xa')](_0xd373('0x1d'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x1d'),_0x460259,JSON[_0xd373('0xd')](_0x45ee58));_0x55c5c7(_0x45ee58);})[_0xd373('0x13')](function(_0xbc420b){logger[_0xd373('0xe')](_0xd373('0x1d'),_0xbc420b['message'],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0xbc420b['message']));});});};exports['ShowVtigerAccount']=function(_0xedc8f3){var _0x15da6c=this;return new Promise(function(_0x25e016,_0x23024c){return db[_0xd373('0x1e')]['find']({'raw':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x16')]||null:null,'attributes':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x17')]||null:null,'include':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x19')]?_['map'](_0xedc8f3[_0xd373('0x14')][_0xd373('0x19')],function(_0x420c73){return{'model':db[_0x420c73[_0xd373('0x1b')]],'as':_0x420c73['as'],'attributes':_0x420c73[_0xd373('0x17')],'include':_0x420c73[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x420c73[_0xd373('0x19')],function(_0xaa62aa){return{'model':db[_0xaa62aa[_0xd373('0x1b')]],'as':_0xaa62aa['as'],'attributes':_0xaa62aa[_0xd373('0x17')],'include':_0xaa62aa[_0xd373('0x19')]?_[_0xd373('0x1a')](_0xaa62aa[_0xd373('0x19')],function(_0x22429c){return{'model':db[_0x22429c['model']],'as':_0x22429c['as'],'attributes':_0x22429c[_0xd373('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd373('0x1c')](function(_0x186e39){logger[_0xd373('0xa')]('ShowVtigerAccount',_0xedc8f3);logger[_0xd373('0xc')](_0xd373('0x1f'),_0xedc8f3,JSON[_0xd373('0xd')](_0x186e39));_0x25e016(_0x186e39);})[_0xd373('0x13')](function(_0x38d8ec){logger[_0xd373('0xe')]('ShowVtigerAccount',_0x38d8ec['message'],_0xedc8f3);_0x23024c(_0x15da6c[_0xd373('0xe')](0x1f4,_0x38d8ec['message']));});});}; \ No newline at end of file +var _0xf7b4=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1b7086,_0x58f082){var _0x15a774=function(_0x1260dc){while(--_0x1260dc){_0x1b7086['push'](_0x1b7086['shift']());}};_0x15a774(++_0x58f082);}(_0xf7b4,0x152));var _0x4f7b=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xf7b4[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetVtigerAccount']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6c01317..d295cc4 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 _0x8654=['getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8654,0x1e7));var _0x4865=function(_0x2c65c3,_0x458f4f){_0x2c65c3=_0x2c65c3-0x0;var _0x5df61c=_0x8654[_0x2c65c3];return _0x5df61c;};'use strict';var multer=require(_0x4865('0x0'));var util=require('util');var path=require(_0x4865('0x1'));var timeout=require(_0x4865('0x2'));var express=require(_0x4865('0x3'));var router=express[_0x4865('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4865('0x5'));var interaction=require(_0x4865('0x6'));var config=require('../../config/environment');var controller=require(_0x4865('0x7'));router[_0x4865('0x8')]('/',auth[_0x4865('0x9')](),controller[_0x4865('0xa')]);router[_0x4865('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4865('0xb')]);router[_0x4865('0x8')](_0x4865('0xc'),auth[_0x4865('0x9')](),controller[_0x4865('0xd')]);router[_0x4865('0x8')](_0x4865('0xe'),auth[_0x4865('0x9')](),controller[_0x4865('0xf')]);router['get']('/:id/descriptions',auth[_0x4865('0x9')](),controller[_0x4865('0x10')]);router[_0x4865('0x11')]('/',auth['isAuthenticated'](),controller[_0x4865('0x12')]);router[_0x4865('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4865('0x14')]);router[_0x4865('0x15')](_0x4865('0x16'),auth[_0x4865('0x9')](),controller[_0x4865('0x17')]);module[_0x4865('0x18')]=router; \ No newline at end of file +var _0x3587=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','post','create','put','/:id','update','delete','destroy'];(function(_0x18f5bd,_0xc02ad7){var _0x2426d6=function(_0x412975){while(--_0x412975){_0x18f5bd['push'](_0x18f5bd['shift']());}};_0x2426d6(++_0xc02ad7);}(_0x3587,0xa2));var _0x7358=function(_0x253497,_0x38f442){_0x253497=_0x253497-0x0;var _0x128a84=_0x3587[_0x253497];return _0x128a84;};'use strict';var multer=require('multer');var util=require(_0x7358('0x0'));var path=require(_0x7358('0x1'));var timeout=require('connect-timeout');var express=require(_0x7358('0x2'));var router=express[_0x7358('0x3')]();var fs_extra=require(_0x7358('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7358('0x5'));var config=require(_0x7358('0x6'));var controller=require(_0x7358('0x7'));router[_0x7358('0x8')]('/',auth[_0x7358('0x9')](),controller[_0x7358('0xa')]);router[_0x7358('0x8')]('/:id',auth[_0x7358('0x9')](),controller[_0x7358('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x7358('0xc')]);router[_0x7358('0x8')](_0x7358('0xd'),auth['isAuthenticated'](),controller[_0x7358('0xe')]);router[_0x7358('0x8')]('/:id/descriptions',auth[_0x7358('0x9')](),controller['getDescriptions']);router[_0x7358('0xf')]('/',auth[_0x7358('0x9')](),controller[_0x7358('0x10')]);router[_0x7358('0x11')](_0x7358('0x12'),auth[_0x7358('0x9')](),controller[_0x7358('0x13')]);router[_0x7358('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7358('0x15')]);module[_0x7358('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5b99115..f21cc46 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 _0xaf57=['STRING','exports'];(function(_0x160881,_0x2fdff2){var _0x1e707b=function(_0x5d5066){while(--_0x5d5066){_0x160881['push'](_0x160881['shift']());}};_0x1e707b(++_0x2fdff2);}(_0xaf57,0x1a9));var _0x7af5=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xaf57[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require('sequelize');module[_0x7af5('0x0')]={'name':{'type':Sequelize[_0x7af5('0x1')]},'description':{'type':Sequelize[_0x7af5('0x1')]}}; \ No newline at end of file +var _0x1b8a=['STRING','sequelize'];(function(_0x5354ef,_0x50ba64){var _0x404374=function(_0x11da4b){while(--_0x11da4b){_0x5354ef['push'](_0x5354ef['shift']());}};_0x404374(++_0x50ba64);}(_0x1b8a,0x79));var _0xa1b8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1b8a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xa1b8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa1b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 35d9094..eb95a7a 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 _0xb6ec=['fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','VtigerField','order','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes'];(function(_0x58bc88,_0x5c8581){var _0x1b9b28=function(_0x534567){while(--_0x534567){_0x58bc88['push'](_0x58bc88['shift']());}};_0x1b9b28(++_0x5c8581);}(_0xb6ec,0x74));var _0xcb6e=function(_0x300941,_0x12a47b){_0x300941=_0x300941-0x0;var _0x8fd6d9=_0xb6ec[_0x300941];return _0x8fd6d9;};'use strict';var emlformat=require(_0xcb6e('0x0'));var rimraf=require(_0xcb6e('0x1'));var zipdir=require(_0xcb6e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb6e('0x3'));var moment=require(_0xcb6e('0x4'));var BPromise=require(_0xcb6e('0x5'));var Mustache=require('mustache');var util=require(_0xcb6e('0x6'));var path=require('path');var sox=require(_0xcb6e('0x7'));var csv=require(_0xcb6e('0x8'));var ejs=require(_0xcb6e('0x9'));var fs=require('fs');var fs_extra=require(_0xcb6e('0xa'));var _=require(_0xcb6e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcb6e('0xc'));var toCsv=require(_0xcb6e('0x8'));var querystring=require(_0xcb6e('0xd'));var Papa=require(_0xcb6e('0xe'));var Redis=require('ioredis');var authService=require(_0xcb6e('0xf'));var qs=require(_0xcb6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb6e('0x11'));var logger=require('../../config/logger')(_0xcb6e('0x12'));var utils=require('../../config/utils');var config=require(_0xcb6e('0x13'));var licenseUtil=require(_0xcb6e('0x14'));var db=require(_0xcb6e('0x15'))['db'];function respondWithStatusCode(_0x24e235,_0x311988){_0x311988=_0x311988||0xcc;return function(_0x4391f9){if(_0x4391f9){return _0x24e235[_0xcb6e('0x16')](_0x311988);}return _0x24e235['status'](_0x311988)['end']();};}function respondWithResult(_0x4f65e7,_0x5f1fd3){_0x5f1fd3=_0x5f1fd3||0xc8;return function(_0x4e8cfd){if(_0x4e8cfd){return _0x4f65e7['status'](_0x5f1fd3)[_0xcb6e('0x17')](_0x4e8cfd);}};}function respondWithFilteredResult(_0x2e0b9a,_0x6d72c2){return function(_0x539582){if(_0x539582){var _0x160a40=typeof _0x6d72c2['offset']===_0xcb6e('0x18')&&typeof _0x6d72c2[_0xcb6e('0x19')]===_0xcb6e('0x18');var _0x2f477b=_0x539582[_0xcb6e('0x1a')];var _0x29718e=_0x160a40?0x0:_0x6d72c2['offset'];var _0xdcae5f=_0x160a40?_0x539582[_0xcb6e('0x1a')]:_0x6d72c2[_0xcb6e('0x1b')]+_0x6d72c2['limit'];var _0x2c923d;if(_0xdcae5f>=_0x2f477b){_0xdcae5f=_0x2f477b;_0x2c923d=0xc8;}else{_0x2c923d=0xce;}_0x2e0b9a[_0xcb6e('0x1c')](_0x2c923d);return _0x2e0b9a['set'](_0xcb6e('0x1d'),_0x29718e+'-'+_0xdcae5f+'/'+_0x2f477b)[_0xcb6e('0x17')](_0x539582);}return null;};}function patchUpdates(_0x17d806){return function(_0x3fa7da){try{jsonpatch[_0xcb6e('0x1e')](_0x3fa7da,_0x17d806,!![]);}catch(_0x5ec970){return BPromise[_0xcb6e('0x1f')](_0x5ec970);}return _0x3fa7da[_0xcb6e('0x20')]();};}function saveUpdates(_0x25b020,_0x2d9cd0){return function(_0x3a4de2){if(_0x3a4de2){return _0x3a4de2[_0xcb6e('0x21')](_0x25b020)[_0xcb6e('0x22')](function(_0xa91355){return _0xa91355;});}return null;};}function removeEntity(_0x1ceaaf,_0x3566b3){return function(_0x5db5ba){if(_0x5db5ba){return _0x5db5ba['destroy']()[_0xcb6e('0x22')](function(){_0x1ceaaf[_0xcb6e('0x1c')](0xcc)[_0xcb6e('0x23')]();});}};}function handleEntityNotFound(_0x22421e,_0x3601b4){return function(_0x402e47){if(!_0x402e47){_0x22421e['sendStatus'](0x194);}return _0x402e47;};}function handleError(_0x125b56,_0x417dd5){_0x417dd5=_0x417dd5||0x1f4;return function(_0x557548){logger[_0xcb6e('0x24')](_0x557548[_0xcb6e('0x25')]);if(_0x557548[_0xcb6e('0x26')]){delete _0x557548['name'];}_0x125b56[_0xcb6e('0x1c')](_0x417dd5)[_0xcb6e('0x27')](_0x557548);};}exports[_0xcb6e('0x28')]=function(_0x1a15ec,_0x1ce205){var _0x513766={},_0x3dd9a5={},_0x40e773={'count':0x0,'rows':[]};var _0x3f3957=_[_0xcb6e('0x29')](db[_0xcb6e('0x2a')][_0xcb6e('0x2b')],function(_0xdfcec5){return{'name':_0xdfcec5[_0xcb6e('0x2c')],'type':_0xdfcec5['type'][_0xcb6e('0x2d')]};});_0x3dd9a5[_0xcb6e('0x2e')]=_[_0xcb6e('0x29')](_0x3f3957,_0xcb6e('0x26'));_0x3dd9a5[_0xcb6e('0x2f')]=_[_0xcb6e('0x30')](_0x1a15ec['query']);_0x3dd9a5[_0xcb6e('0x31')]=_['intersection'](_0x3dd9a5[_0xcb6e('0x2e')],_0x3dd9a5[_0xcb6e('0x2f')]);_0x513766[_0xcb6e('0x32')]=_[_0xcb6e('0x33')](_0x3dd9a5[_0xcb6e('0x2e')],qs['fields'](_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x34')]));_0x513766[_0xcb6e('0x32')]=_0x513766[_0xcb6e('0x32')][_0xcb6e('0x35')]?_0x513766['attributes']:_0x3dd9a5['model'];if(!_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x36')](_0xcb6e('0x37'))){_0x513766[_0xcb6e('0x19')]=qs[_0xcb6e('0x19')](_0x1a15ec[_0xcb6e('0x2f')]['limit']);_0x513766['offset']=qs[_0xcb6e('0x1b')](_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x1b')]);}_0x513766['order']=qs['sort'](_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x38')]);_0x513766[_0xcb6e('0x39')]=qs[_0xcb6e('0x31')](_['pick'](_0x1a15ec[_0xcb6e('0x2f')],_0x3dd9a5[_0xcb6e('0x31')]),_0x3f3957);if(_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x3a')]){_0x513766[_0xcb6e('0x39')]=_[_0xcb6e('0x3b')](_0x513766[_0xcb6e('0x39')],{'$or':_[_0xcb6e('0x29')](_0x3f3957,function(_0x6a09e8){if(_0x6a09e8[_0xcb6e('0x3c')]!=='VIRTUAL'){var _0x4aade3={};_0x4aade3[_0x6a09e8[_0xcb6e('0x26')]]={'$like':'%'+_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x3a')]+'%'};return _0x4aade3;}})});}_0x513766=_[_0xcb6e('0x3b')]({},_0x513766,_0x1a15ec[_0xcb6e('0x3d')]);var _0x308c51={'where':_0x513766[_0xcb6e('0x39')]};return db['VtigerConfiguration'][_0xcb6e('0x1a')](_0x308c51)[_0xcb6e('0x22')](function(_0x35af3d){_0x40e773[_0xcb6e('0x1a')]=_0x35af3d;if(_0x1a15ec[_0xcb6e('0x2f')][_0xcb6e('0x3e')]){_0x513766['include']=[{'all':!![]}];}return db[_0xcb6e('0x2a')][_0xcb6e('0x3f')](_0x513766);})[_0xcb6e('0x22')](function(_0x27dc48){_0x40e773[_0xcb6e('0x40')]=_0x27dc48;return _0x40e773;})['then'](respondWithFilteredResult(_0x1ce205,_0x513766))[_0xcb6e('0x41')](handleError(_0x1ce205,null));};exports[_0xcb6e('0x42')]=function(_0x306e71,_0x53fde7){var _0x20ee90={'raw':![],'where':{'id':_0x306e71[_0xcb6e('0x43')]['id']}},_0x2e35ab={};_0x2e35ab[_0xcb6e('0x2e')]=_[_0xcb6e('0x30')](db[_0xcb6e('0x2a')][_0xcb6e('0x2b')]);_0x2e35ab[_0xcb6e('0x2f')]=_[_0xcb6e('0x30')](_0x306e71[_0xcb6e('0x2f')]);_0x2e35ab[_0xcb6e('0x31')]=_['intersection'](_0x2e35ab['model'],_0x2e35ab[_0xcb6e('0x2f')]);_0x20ee90[_0xcb6e('0x32')]=_[_0xcb6e('0x33')](_0x2e35ab[_0xcb6e('0x2e')],qs['fields'](_0x306e71['query'][_0xcb6e('0x34')]));_0x20ee90[_0xcb6e('0x32')]=_0x20ee90[_0xcb6e('0x32')][_0xcb6e('0x35')]?_0x20ee90[_0xcb6e('0x32')]:_0x2e35ab[_0xcb6e('0x2e')];if(_0x306e71[_0xcb6e('0x2f')]['includeAll']){_0x20ee90[_0xcb6e('0x44')]=[{'all':!![]}];}_0x20ee90=_[_0xcb6e('0x3b')]({},_0x20ee90,_0x306e71['options']);return db[_0xcb6e('0x2a')][_0xcb6e('0x45')](_0x20ee90)[_0xcb6e('0x22')](handleEntityNotFound(_0x53fde7,null))[_0xcb6e('0x22')](respondWithResult(_0x53fde7,null))[_0xcb6e('0x41')](handleError(_0x53fde7,null));};exports[_0xcb6e('0x46')]=function(_0x4748e6,_0x241cd5){return db['VtigerConfiguration'][_0xcb6e('0x46')](_0x4748e6[_0xcb6e('0x47')],{})[_0xcb6e('0x22')](respondWithResult(_0x241cd5,0xc9))[_0xcb6e('0x41')](handleError(_0x241cd5,null));};exports['update']=function(_0x57b005,_0x1fcbf5){if(_0x57b005[_0xcb6e('0x47')]['id']){delete _0x57b005[_0xcb6e('0x47')]['id'];}return db['VtigerConfiguration'][_0xcb6e('0x45')]({'where':{'id':_0x57b005[_0xcb6e('0x43')]['id']}})[_0xcb6e('0x22')](handleEntityNotFound(_0x1fcbf5,null))['then'](saveUpdates(_0x57b005['body'],null))[_0xcb6e('0x22')](respondWithResult(_0x1fcbf5,null))[_0xcb6e('0x41')](handleError(_0x1fcbf5,null));};exports[_0xcb6e('0x48')]=function(_0x58f9b9,_0x5e9076){return db[_0xcb6e('0x2a')][_0xcb6e('0x45')]({'where':{'id':_0x58f9b9['params']['id']}})['then'](handleEntityNotFound(_0x5e9076,null))['then'](removeEntity(_0x5e9076,null))[_0xcb6e('0x41')](handleError(_0x5e9076,null));};exports['getFields']=function(_0x2aaa34,_0x212ce8,_0x2b8695){var _0x30fe5b={};var _0x274009={};var _0x36aa3a;var _0x45a53c;return db[_0xcb6e('0x2a')]['findOne']({'where':{'id':_0x2aaa34[_0xcb6e('0x43')]['id']}})[_0xcb6e('0x22')](handleEntityNotFound(_0x212ce8,null))[_0xcb6e('0x22')](function(_0x433048){if(_0x433048){_0x36aa3a=_0x433048;_0x274009[_0xcb6e('0x2e')]=_[_0xcb6e('0x30')](db[_0xcb6e('0x49')][_0xcb6e('0x2b')]);_0x274009['query']=_[_0xcb6e('0x30')](_0x2aaa34[_0xcb6e('0x2f')]);_0x274009[_0xcb6e('0x31')]=_[_0xcb6e('0x33')](_0x274009[_0xcb6e('0x2e')],_0x274009[_0xcb6e('0x2f')]);_0x30fe5b['attributes']=_[_0xcb6e('0x33')](_0x274009['model'],qs['fields'](_0x2aaa34[_0xcb6e('0x2f')][_0xcb6e('0x34')]));_0x30fe5b['attributes']=_0x30fe5b[_0xcb6e('0x32')][_0xcb6e('0x35')]?_0x30fe5b[_0xcb6e('0x32')]:_0x274009[_0xcb6e('0x2e')];_0x30fe5b[_0xcb6e('0x4a')]=qs[_0xcb6e('0x38')](_0x2aaa34['query'][_0xcb6e('0x38')]);_0x30fe5b[_0xcb6e('0x39')]=qs[_0xcb6e('0x31')](_[_0xcb6e('0x4b')](_0x2aaa34['query'],_0x274009[_0xcb6e('0x31')]));if(_0x2aaa34[_0xcb6e('0x2f')]['filter']){_0x30fe5b['where']=_[_0xcb6e('0x3b')](_0x30fe5b[_0xcb6e('0x39')],{'$or':_[_0xcb6e('0x29')](_0x30fe5b[_0xcb6e('0x32')],function(_0x3f9580){var _0x47ff75={};_0x47ff75[_0x3f9580]={'$like':'%'+_0x2aaa34[_0xcb6e('0x2f')][_0xcb6e('0x3a')]+'%'};return _0x47ff75;})});}_0x30fe5b=_[_0xcb6e('0x3b')]({},_0x30fe5b,_0x2aaa34[_0xcb6e('0x3d')]);return _0x36aa3a['getFields'](_0x30fe5b);}})[_0xcb6e('0x22')](function(_0x812ff8){if(_0x812ff8){_0x45a53c=_0x812ff8[_0xcb6e('0x35')];if(!_0x2aaa34[_0xcb6e('0x2f')]['hasOwnProperty'](_0xcb6e('0x37'))){_0x30fe5b[_0xcb6e('0x19')]=qs[_0xcb6e('0x19')](_0x2aaa34[_0xcb6e('0x2f')][_0xcb6e('0x19')]);_0x30fe5b[_0xcb6e('0x1b')]=qs[_0xcb6e('0x1b')](_0x2aaa34[_0xcb6e('0x2f')][_0xcb6e('0x1b')]);}return _0x36aa3a[_0xcb6e('0x4c')](_0x30fe5b);}})[_0xcb6e('0x22')](function(_0x51cc77){if(_0x51cc77){return _0x51cc77?{'count':_0x45a53c,'rows':_0x51cc77}:null;}})[_0xcb6e('0x22')](respondWithResult(_0x212ce8,null))[_0xcb6e('0x41')](handleError(_0x212ce8,null));};exports[_0xcb6e('0x4d')]=function(_0x301f5e,_0xdd742e,_0x163714){var _0x4a0a92={};var _0x42738c={};var _0x93034;var _0x1e6791;return db[_0xcb6e('0x2a')][_0xcb6e('0x4e')]({'where':{'id':_0x301f5e[_0xcb6e('0x43')]['id']}})[_0xcb6e('0x22')](handleEntityNotFound(_0xdd742e,null))[_0xcb6e('0x22')](function(_0x372180){if(_0x372180){_0x93034=_0x372180;_0x42738c['model']=_[_0xcb6e('0x30')](db[_0xcb6e('0x49')][_0xcb6e('0x2b')]);_0x42738c[_0xcb6e('0x2f')]=_['keys'](_0x301f5e[_0xcb6e('0x2f')]);_0x42738c['filters']=_[_0xcb6e('0x33')](_0x42738c[_0xcb6e('0x2e')],_0x42738c[_0xcb6e('0x2f')]);_0x4a0a92[_0xcb6e('0x32')]=_['intersection'](_0x42738c['model'],qs[_0xcb6e('0x34')](_0x301f5e[_0xcb6e('0x2f')][_0xcb6e('0x34')]));_0x4a0a92[_0xcb6e('0x32')]=_0x4a0a92['attributes']['length']?_0x4a0a92[_0xcb6e('0x32')]:_0x42738c[_0xcb6e('0x2e')];_0x4a0a92[_0xcb6e('0x4a')]=qs[_0xcb6e('0x38')](_0x301f5e['query']['sort']);_0x4a0a92['where']=qs[_0xcb6e('0x31')](_[_0xcb6e('0x4b')](_0x301f5e[_0xcb6e('0x2f')],_0x42738c[_0xcb6e('0x31')]));if(_0x301f5e[_0xcb6e('0x2f')][_0xcb6e('0x3a')]){_0x4a0a92[_0xcb6e('0x39')]=_[_0xcb6e('0x3b')](_0x4a0a92[_0xcb6e('0x39')],{'$or':_['map'](_0x4a0a92[_0xcb6e('0x32')],function(_0x2a25e3){var _0x43aad4={};_0x43aad4[_0x2a25e3]={'$like':'%'+_0x301f5e[_0xcb6e('0x2f')][_0xcb6e('0x3a')]+'%'};return _0x43aad4;})});}_0x4a0a92=_[_0xcb6e('0x3b')]({},_0x4a0a92,_0x301f5e[_0xcb6e('0x3d')]);return _0x93034[_0xcb6e('0x4d')](_0x4a0a92);}})[_0xcb6e('0x22')](function(_0x156880){if(_0x156880){_0x1e6791=_0x156880[_0xcb6e('0x35')];if(!_0x301f5e[_0xcb6e('0x2f')][_0xcb6e('0x36')]('nolimit')){_0x4a0a92[_0xcb6e('0x19')]=qs[_0xcb6e('0x19')](_0x301f5e['query'][_0xcb6e('0x19')]);_0x4a0a92[_0xcb6e('0x1b')]=qs['offset'](_0x301f5e[_0xcb6e('0x2f')][_0xcb6e('0x1b')]);}return _0x93034[_0xcb6e('0x4d')](_0x4a0a92);}})[_0xcb6e('0x22')](function(_0x4532aa){if(_0x4532aa){return _0x4532aa?{'count':_0x1e6791,'rows':_0x4532aa}:null;}})[_0xcb6e('0x22')](respondWithResult(_0xdd742e,null))[_0xcb6e('0x41')](handleError(_0xdd742e,null));};exports['getDescriptions']=function(_0x80fa64,_0x4c70c3,_0x1dea36){var _0xc4fd14={};var _0x2737cf={};var _0x3a05c2;var _0x25cd5d;return db[_0xcb6e('0x2a')][_0xcb6e('0x4e')]({'where':{'id':_0x80fa64[_0xcb6e('0x43')]['id']}})[_0xcb6e('0x22')](handleEntityNotFound(_0x4c70c3,null))[_0xcb6e('0x22')](function(_0x1442ae){if(_0x1442ae){_0x3a05c2=_0x1442ae;_0x2737cf['model']=_[_0xcb6e('0x30')](db[_0xcb6e('0x49')][_0xcb6e('0x2b')]);_0x2737cf[_0xcb6e('0x2f')]=_[_0xcb6e('0x30')](_0x80fa64[_0xcb6e('0x2f')]);_0x2737cf[_0xcb6e('0x31')]=_['intersection'](_0x2737cf[_0xcb6e('0x2e')],_0x2737cf['query']);_0xc4fd14[_0xcb6e('0x32')]=_[_0xcb6e('0x33')](_0x2737cf[_0xcb6e('0x2e')],qs['fields'](_0x80fa64['query'][_0xcb6e('0x34')]));_0xc4fd14[_0xcb6e('0x32')]=_0xc4fd14[_0xcb6e('0x32')][_0xcb6e('0x35')]?_0xc4fd14[_0xcb6e('0x32')]:_0x2737cf[_0xcb6e('0x2e')];_0xc4fd14[_0xcb6e('0x4a')]=qs[_0xcb6e('0x38')](_0x80fa64[_0xcb6e('0x2f')]['sort']);_0xc4fd14[_0xcb6e('0x39')]=qs[_0xcb6e('0x31')](_[_0xcb6e('0x4b')](_0x80fa64[_0xcb6e('0x2f')],_0x2737cf[_0xcb6e('0x31')]));if(_0x80fa64[_0xcb6e('0x2f')][_0xcb6e('0x3a')]){_0xc4fd14['where']=_[_0xcb6e('0x3b')](_0xc4fd14[_0xcb6e('0x39')],{'$or':_[_0xcb6e('0x29')](_0xc4fd14[_0xcb6e('0x32')],function(_0x41ebee){var _0x28f4cc={};_0x28f4cc[_0x41ebee]={'$like':'%'+_0x80fa64[_0xcb6e('0x2f')]['filter']+'%'};return _0x28f4cc;})});}_0xc4fd14=_['merge']({},_0xc4fd14,_0x80fa64['options']);return _0x3a05c2['getDescriptions'](_0xc4fd14);}})['then'](function(_0x8844c6){if(_0x8844c6){_0x25cd5d=_0x8844c6[_0xcb6e('0x35')];if(!_0x80fa64[_0xcb6e('0x2f')][_0xcb6e('0x36')](_0xcb6e('0x37'))){_0xc4fd14['limit']=qs[_0xcb6e('0x19')](_0x80fa64[_0xcb6e('0x2f')][_0xcb6e('0x19')]);_0xc4fd14['offset']=qs['offset'](_0x80fa64[_0xcb6e('0x2f')]['offset']);}return _0x3a05c2[_0xcb6e('0x4f')](_0xc4fd14);}})[_0xcb6e('0x22')](function(_0x524e45){if(_0x524e45){return _0x524e45?{'count':_0x25cd5d,'rows':_0x524e45}:null;}})[_0xcb6e('0x22')](respondWithResult(_0x4c70c3,null))[_0xcb6e('0x41')](handleError(_0x4c70c3,null));}; \ No newline at end of file +var _0x78c0=['intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x78c0,0x70));var _0x078c=function(_0x1045f8,_0x3c5a5c){_0x1045f8=_0x1045f8-0x0;var _0x535a59=_0x78c0[_0x1045f8];return _0x535a59;};'use strict';var emlformat=require(_0x078c('0x0'));var rimraf=require(_0x078c('0x1'));var zipdir=require(_0x078c('0x2'));var jsonpatch=require(_0x078c('0x3'));var rp=require(_0x078c('0x4'));var moment=require('moment');var BPromise=require(_0x078c('0x5'));var Mustache=require(_0x078c('0x6'));var util=require(_0x078c('0x7'));var path=require(_0x078c('0x8'));var sox=require(_0x078c('0x9'));var csv=require(_0x078c('0xa'));var ejs=require(_0x078c('0xb'));var fs=require('fs');var fs_extra=require(_0x078c('0xc'));var _=require(_0x078c('0xd'));var squel=require(_0x078c('0xe'));var crypto=require('crypto');var jsforce=require(_0x078c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x078c('0x10'));var Papa=require('papaparse');var Redis=require(_0x078c('0x11'));var authService=require(_0x078c('0x12'));var qs=require(_0x078c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x078c('0x14'))(_0x078c('0x15'));var utils=require(_0x078c('0x16'));var config=require(_0x078c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa251,_0x253182){_0x253182=_0x253182||0xcc;return function(_0x5b0d54){if(_0x5b0d54){return _0x1fa251[_0x078c('0x18')](_0x253182);}return _0x1fa251[_0x078c('0x19')](_0x253182)[_0x078c('0x1a')]();};}function respondWithResult(_0xc683f0,_0x5bbdf6){_0x5bbdf6=_0x5bbdf6||0xc8;return function(_0x39efe0){if(_0x39efe0){return _0xc683f0[_0x078c('0x19')](_0x5bbdf6)[_0x078c('0x1b')](_0x39efe0);}};}function respondWithFilteredResult(_0x10f561,_0x31d02b){return function(_0x599e7f){if(_0x599e7f){var _0x3e2c57=typeof _0x31d02b[_0x078c('0x1c')]===_0x078c('0x1d')&&typeof _0x31d02b[_0x078c('0x1e')]==='undefined';var _0x2c036a=_0x599e7f[_0x078c('0x1f')];var _0xfdeb92=_0x3e2c57?0x0:_0x31d02b[_0x078c('0x1c')];var _0x7982c8=_0x3e2c57?_0x599e7f[_0x078c('0x1f')]:_0x31d02b[_0x078c('0x1c')]+_0x31d02b[_0x078c('0x1e')];var _0x3b4a30;if(_0x7982c8>=_0x2c036a){_0x7982c8=_0x2c036a;_0x3b4a30=0xc8;}else{_0x3b4a30=0xce;}_0x10f561[_0x078c('0x19')](_0x3b4a30);return _0x10f561[_0x078c('0x20')](_0x078c('0x21'),_0xfdeb92+'-'+_0x7982c8+'/'+_0x2c036a)['json'](_0x599e7f);}return null;};}function patchUpdates(_0x21e7ac){return function(_0x27aa12){try{jsonpatch[_0x078c('0x22')](_0x27aa12,_0x21e7ac,!![]);}catch(_0x4a7865){return BPromise[_0x078c('0x23')](_0x4a7865);}return _0x27aa12[_0x078c('0x24')]();};}function saveUpdates(_0x4e1738,_0x5c3380){return function(_0x462248){if(_0x462248){return _0x462248['update'](_0x4e1738)[_0x078c('0x25')](function(_0x5cd02f){return _0x5cd02f;});}return null;};}function removeEntity(_0x10b996,_0xca38bd){return function(_0x144a39){if(_0x144a39){return _0x144a39[_0x078c('0x26')]()[_0x078c('0x25')](function(){_0x10b996['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53b1ca,_0x2c4f35){return function(_0x3fcdce){if(!_0x3fcdce){_0x53b1ca[_0x078c('0x18')](0x194);}return _0x3fcdce;};}function handleError(_0x23746d,_0x4aa1a5){_0x4aa1a5=_0x4aa1a5||0x1f4;return function(_0x944ad2){logger[_0x078c('0x27')](_0x944ad2[_0x078c('0x28')]);if(_0x944ad2[_0x078c('0x29')]){delete _0x944ad2[_0x078c('0x29')];}_0x23746d[_0x078c('0x19')](_0x4aa1a5)['send'](_0x944ad2);};}exports[_0x078c('0x2a')]=function(_0x18fff4,_0xaf1c74){var _0x1efe9e={},_0x2841c9={},_0x2ae3a6={'count':0x0,'rows':[]};var _0x249efb=_[_0x078c('0x2b')](db[_0x078c('0x2c')][_0x078c('0x2d')],function(_0x3748bd){return{'name':_0x3748bd[_0x078c('0x2e')],'type':_0x3748bd['type'][_0x078c('0x2f')]};});_0x2841c9[_0x078c('0x30')]=_[_0x078c('0x2b')](_0x249efb,'name');_0x2841c9[_0x078c('0x31')]=_[_0x078c('0x32')](_0x18fff4[_0x078c('0x31')]);_0x2841c9[_0x078c('0x33')]=_['intersection'](_0x2841c9[_0x078c('0x30')],_0x2841c9[_0x078c('0x31')]);_0x1efe9e['attributes']=_[_0x078c('0x34')](_0x2841c9[_0x078c('0x30')],qs['fields'](_0x18fff4[_0x078c('0x31')][_0x078c('0x35')]));_0x1efe9e[_0x078c('0x36')]=_0x1efe9e[_0x078c('0x36')][_0x078c('0x37')]?_0x1efe9e[_0x078c('0x36')]:_0x2841c9['model'];if(!_0x18fff4[_0x078c('0x31')]['hasOwnProperty'](_0x078c('0x38'))){_0x1efe9e[_0x078c('0x1e')]=qs['limit'](_0x18fff4[_0x078c('0x31')][_0x078c('0x1e')]);_0x1efe9e[_0x078c('0x1c')]=qs['offset'](_0x18fff4[_0x078c('0x31')][_0x078c('0x1c')]);}_0x1efe9e['order']=qs[_0x078c('0x39')](_0x18fff4[_0x078c('0x31')]['sort']);_0x1efe9e[_0x078c('0x3a')]=qs[_0x078c('0x33')](_[_0x078c('0x3b')](_0x18fff4[_0x078c('0x31')],_0x2841c9[_0x078c('0x33')]),_0x249efb);if(_0x18fff4[_0x078c('0x31')][_0x078c('0x3c')]){_0x1efe9e[_0x078c('0x3a')]=_[_0x078c('0x3d')](_0x1efe9e[_0x078c('0x3a')],{'$or':_[_0x078c('0x2b')](_0x249efb,function(_0x4fc710){if(_0x4fc710['type']!==_0x078c('0x3e')){var _0x96f054={};_0x96f054[_0x4fc710[_0x078c('0x29')]]={'$like':'%'+_0x18fff4[_0x078c('0x31')][_0x078c('0x3c')]+'%'};return _0x96f054;}})});}_0x1efe9e=_[_0x078c('0x3d')]({},_0x1efe9e,_0x18fff4[_0x078c('0x3f')]);var _0x452ad1={'where':_0x1efe9e[_0x078c('0x3a')]};return db[_0x078c('0x2c')][_0x078c('0x1f')](_0x452ad1)[_0x078c('0x25')](function(_0x192656){_0x2ae3a6['count']=_0x192656;if(_0x18fff4[_0x078c('0x31')]['includeAll']){_0x1efe9e[_0x078c('0x40')]=[{'all':!![]}];}return db[_0x078c('0x2c')][_0x078c('0x41')](_0x1efe9e);})[_0x078c('0x25')](function(_0x2a18a2){_0x2ae3a6[_0x078c('0x42')]=_0x2a18a2;return _0x2ae3a6;})[_0x078c('0x25')](respondWithFilteredResult(_0xaf1c74,_0x1efe9e))[_0x078c('0x43')](handleError(_0xaf1c74,null));};exports[_0x078c('0x44')]=function(_0x2df93f,_0x39ac7c){var _0x1b4e86={'raw':![],'where':{'id':_0x2df93f[_0x078c('0x45')]['id']}},_0x1bc5e0={};_0x1bc5e0[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x2c')][_0x078c('0x2d')]);_0x1bc5e0['query']=_[_0x078c('0x32')](_0x2df93f[_0x078c('0x31')]);_0x1bc5e0[_0x078c('0x33')]=_[_0x078c('0x34')](_0x1bc5e0[_0x078c('0x30')],_0x1bc5e0[_0x078c('0x31')]);_0x1b4e86[_0x078c('0x36')]=_[_0x078c('0x34')](_0x1bc5e0[_0x078c('0x30')],qs[_0x078c('0x35')](_0x2df93f[_0x078c('0x31')][_0x078c('0x35')]));_0x1b4e86['attributes']=_0x1b4e86[_0x078c('0x36')][_0x078c('0x37')]?_0x1b4e86['attributes']:_0x1bc5e0[_0x078c('0x30')];if(_0x2df93f[_0x078c('0x31')][_0x078c('0x46')]){_0x1b4e86[_0x078c('0x40')]=[{'all':!![]}];}_0x1b4e86=_['merge']({},_0x1b4e86,_0x2df93f[_0x078c('0x3f')]);return db['VtigerConfiguration'][_0x078c('0x47')](_0x1b4e86)[_0x078c('0x25')](handleEntityNotFound(_0x39ac7c,null))['then'](respondWithResult(_0x39ac7c,null))[_0x078c('0x43')](handleError(_0x39ac7c,null));};exports[_0x078c('0x48')]=function(_0x56d152,_0x29f087){return db[_0x078c('0x2c')]['create'](_0x56d152['body'],{})['then'](respondWithResult(_0x29f087,0xc9))[_0x078c('0x43')](handleError(_0x29f087,null));};exports[_0x078c('0x49')]=function(_0x1ceae3,_0x1197d9){if(_0x1ceae3[_0x078c('0x4a')]['id']){delete _0x1ceae3[_0x078c('0x4a')]['id'];}return db[_0x078c('0x2c')][_0x078c('0x47')]({'where':{'id':_0x1ceae3['params']['id']}})[_0x078c('0x25')](handleEntityNotFound(_0x1197d9,null))[_0x078c('0x25')](saveUpdates(_0x1ceae3[_0x078c('0x4a')],null))[_0x078c('0x25')](respondWithResult(_0x1197d9,null))[_0x078c('0x43')](handleError(_0x1197d9,null));};exports['destroy']=function(_0x364b93,_0x2064f1){return db[_0x078c('0x2c')]['find']({'where':{'id':_0x364b93[_0x078c('0x45')]['id']}})[_0x078c('0x25')](handleEntityNotFound(_0x2064f1,null))[_0x078c('0x25')](removeEntity(_0x2064f1,null))['catch'](handleError(_0x2064f1,null));};exports[_0x078c('0x4b')]=function(_0x462454,_0x36f2e2,_0x3ac78f){var _0xfa7622={};var _0x125eb4={};var _0x1922b4;var _0x449581;return db[_0x078c('0x2c')][_0x078c('0x4c')]({'where':{'id':_0x462454[_0x078c('0x45')]['id']}})['then'](handleEntityNotFound(_0x36f2e2,null))[_0x078c('0x25')](function(_0x2da5b3){if(_0x2da5b3){_0x1922b4=_0x2da5b3;_0x125eb4[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x4d')][_0x078c('0x2d')]);_0x125eb4['query']=_[_0x078c('0x32')](_0x462454[_0x078c('0x31')]);_0x125eb4['filters']=_[_0x078c('0x34')](_0x125eb4[_0x078c('0x30')],_0x125eb4['query']);_0xfa7622[_0x078c('0x36')]=_[_0x078c('0x34')](_0x125eb4['model'],qs[_0x078c('0x35')](_0x462454[_0x078c('0x31')][_0x078c('0x35')]));_0xfa7622[_0x078c('0x36')]=_0xfa7622['attributes'][_0x078c('0x37')]?_0xfa7622[_0x078c('0x36')]:_0x125eb4[_0x078c('0x30')];_0xfa7622[_0x078c('0x4e')]=qs['sort'](_0x462454[_0x078c('0x31')][_0x078c('0x39')]);_0xfa7622[_0x078c('0x3a')]=qs['filters'](_[_0x078c('0x3b')](_0x462454[_0x078c('0x31')],_0x125eb4[_0x078c('0x33')]));if(_0x462454['query'][_0x078c('0x3c')]){_0xfa7622[_0x078c('0x3a')]=_[_0x078c('0x3d')](_0xfa7622[_0x078c('0x3a')],{'$or':_[_0x078c('0x2b')](_0xfa7622[_0x078c('0x36')],function(_0x280ea2){var _0x1aec49={};_0x1aec49[_0x280ea2]={'$like':'%'+_0x462454['query']['filter']+'%'};return _0x1aec49;})});}_0xfa7622=_[_0x078c('0x3d')]({},_0xfa7622,_0x462454[_0x078c('0x3f')]);return _0x1922b4['getFields'](_0xfa7622);}})[_0x078c('0x25')](function(_0x5e2c8e){if(_0x5e2c8e){_0x449581=_0x5e2c8e['length'];if(!_0x462454[_0x078c('0x31')]['hasOwnProperty'](_0x078c('0x38'))){_0xfa7622[_0x078c('0x1e')]=qs['limit'](_0x462454['query'][_0x078c('0x1e')]);_0xfa7622['offset']=qs[_0x078c('0x1c')](_0x462454[_0x078c('0x31')]['offset']);}return _0x1922b4[_0x078c('0x4b')](_0xfa7622);}})[_0x078c('0x25')](function(_0x2bf047){if(_0x2bf047){return _0x2bf047?{'count':_0x449581,'rows':_0x2bf047}:null;}})[_0x078c('0x25')](respondWithResult(_0x36f2e2,null))['catch'](handleError(_0x36f2e2,null));};exports[_0x078c('0x4f')]=function(_0x37b6d4,_0x112485,_0x1f63a0){var _0x5247de={};var _0x58c1cd={};var _0x4d3d9b;var _0x19ffe2;return db[_0x078c('0x2c')][_0x078c('0x4c')]({'where':{'id':_0x37b6d4[_0x078c('0x45')]['id']}})[_0x078c('0x25')](handleEntityNotFound(_0x112485,null))[_0x078c('0x25')](function(_0x4f708b){if(_0x4f708b){_0x4d3d9b=_0x4f708b;_0x58c1cd[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x4d')][_0x078c('0x2d')]);_0x58c1cd[_0x078c('0x31')]=_['keys'](_0x37b6d4[_0x078c('0x31')]);_0x58c1cd[_0x078c('0x33')]=_[_0x078c('0x34')](_0x58c1cd[_0x078c('0x30')],_0x58c1cd[_0x078c('0x31')]);_0x5247de[_0x078c('0x36')]=_[_0x078c('0x34')](_0x58c1cd[_0x078c('0x30')],qs['fields'](_0x37b6d4['query']['fields']));_0x5247de[_0x078c('0x36')]=_0x5247de[_0x078c('0x36')][_0x078c('0x37')]?_0x5247de[_0x078c('0x36')]:_0x58c1cd[_0x078c('0x30')];_0x5247de[_0x078c('0x4e')]=qs[_0x078c('0x39')](_0x37b6d4[_0x078c('0x31')][_0x078c('0x39')]);_0x5247de[_0x078c('0x3a')]=qs[_0x078c('0x33')](_[_0x078c('0x3b')](_0x37b6d4[_0x078c('0x31')],_0x58c1cd['filters']));if(_0x37b6d4[_0x078c('0x31')]['filter']){_0x5247de[_0x078c('0x3a')]=_[_0x078c('0x3d')](_0x5247de[_0x078c('0x3a')],{'$or':_[_0x078c('0x2b')](_0x5247de[_0x078c('0x36')],function(_0x4cbf34){var _0x7c3712={};_0x7c3712[_0x4cbf34]={'$like':'%'+_0x37b6d4[_0x078c('0x31')][_0x078c('0x3c')]+'%'};return _0x7c3712;})});}_0x5247de=_[_0x078c('0x3d')]({},_0x5247de,_0x37b6d4[_0x078c('0x3f')]);return _0x4d3d9b[_0x078c('0x4f')](_0x5247de);}})['then'](function(_0x7397d1){if(_0x7397d1){_0x19ffe2=_0x7397d1[_0x078c('0x37')];if(!_0x37b6d4[_0x078c('0x31')]['hasOwnProperty'](_0x078c('0x38'))){_0x5247de[_0x078c('0x1e')]=qs[_0x078c('0x1e')](_0x37b6d4[_0x078c('0x31')][_0x078c('0x1e')]);_0x5247de[_0x078c('0x1c')]=qs['offset'](_0x37b6d4[_0x078c('0x31')][_0x078c('0x1c')]);}return _0x4d3d9b[_0x078c('0x4f')](_0x5247de);}})[_0x078c('0x25')](function(_0x4c5aa2){if(_0x4c5aa2){return _0x4c5aa2?{'count':_0x19ffe2,'rows':_0x4c5aa2}:null;}})[_0x078c('0x25')](respondWithResult(_0x112485,null))[_0x078c('0x43')](handleError(_0x112485,null));};exports['getDescriptions']=function(_0xfe632a,_0x37f16a,_0xc33382){var _0x59aef0={};var _0xfc9a60={};var _0x13fd3a;var _0x51e499;return db['VtigerConfiguration'][_0x078c('0x4c')]({'where':{'id':_0xfe632a['params']['id']}})['then'](handleEntityNotFound(_0x37f16a,null))[_0x078c('0x25')](function(_0x22aeb8){if(_0x22aeb8){_0x13fd3a=_0x22aeb8;_0xfc9a60[_0x078c('0x30')]=_[_0x078c('0x32')](db[_0x078c('0x4d')][_0x078c('0x2d')]);_0xfc9a60['query']=_[_0x078c('0x32')](_0xfe632a['query']);_0xfc9a60['filters']=_['intersection'](_0xfc9a60['model'],_0xfc9a60[_0x078c('0x31')]);_0x59aef0[_0x078c('0x36')]=_[_0x078c('0x34')](_0xfc9a60[_0x078c('0x30')],qs[_0x078c('0x35')](_0xfe632a['query'][_0x078c('0x35')]));_0x59aef0[_0x078c('0x36')]=_0x59aef0[_0x078c('0x36')]['length']?_0x59aef0['attributes']:_0xfc9a60[_0x078c('0x30')];_0x59aef0[_0x078c('0x4e')]=qs[_0x078c('0x39')](_0xfe632a[_0x078c('0x31')]['sort']);_0x59aef0[_0x078c('0x3a')]=qs[_0x078c('0x33')](_[_0x078c('0x3b')](_0xfe632a[_0x078c('0x31')],_0xfc9a60[_0x078c('0x33')]));if(_0xfe632a[_0x078c('0x31')]['filter']){_0x59aef0[_0x078c('0x3a')]=_['merge'](_0x59aef0['where'],{'$or':_[_0x078c('0x2b')](_0x59aef0['attributes'],function(_0x24ad8d){var _0xbd3226={};_0xbd3226[_0x24ad8d]={'$like':'%'+_0xfe632a[_0x078c('0x31')][_0x078c('0x3c')]+'%'};return _0xbd3226;})});}_0x59aef0=_[_0x078c('0x3d')]({},_0x59aef0,_0xfe632a[_0x078c('0x3f')]);return _0x13fd3a[_0x078c('0x50')](_0x59aef0);}})[_0x078c('0x25')](function(_0x300f80){if(_0x300f80){_0x51e499=_0x300f80[_0x078c('0x37')];if(!_0xfe632a[_0x078c('0x31')][_0x078c('0x51')](_0x078c('0x38'))){_0x59aef0[_0x078c('0x1e')]=qs[_0x078c('0x1e')](_0xfe632a['query'][_0x078c('0x1e')]);_0x59aef0[_0x078c('0x1c')]=qs[_0x078c('0x1c')](_0xfe632a[_0x078c('0x31')]['offset']);}return _0x13fd3a[_0x078c('0x50')](_0x59aef0);}})[_0x078c('0x25')](function(_0x56cd14){if(_0x56cd14){return _0x56cd14?{'count':_0x51e499,'rows':_0x56cd14}:null;}})[_0x078c('0x25')](respondWithResult(_0x37f16a,null))['catch'](handleError(_0x37f16a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 31ec4f9..b61910e 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 _0x686e=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util'];(function(_0x2f72f9,_0x3f3c0e){var _0x190442=function(_0x5ef9d1){while(--_0x5ef9d1){_0x2f72f9['push'](_0x2f72f9['shift']());}};_0x190442(++_0x3f3c0e);}(_0x686e,0x1cc));var _0xe686=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x686e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe686('0x0'));var util=require(_0xe686('0x1'));var logger=require(_0xe686('0x2'))('api');var moment=require(_0xe686('0x3'));var BPromise=require(_0xe686('0x4'));var rp=require(_0xe686('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe686('0x6'));var config=require(_0xe686('0x7'));var attributes=require(_0xe686('0x8'));module[_0xe686('0x9')]=function(_0x4e2829,_0x3efe85){return _0x4e2829['define'](_0xe686('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb63=['./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','util','moment','bluebird','request-promise','rimraf'];(function(_0x2e2175,_0x25a8d9){var _0x3ed4c4=function(_0x3839d4){while(--_0x3839d4){_0x2e2175['push'](_0x2e2175['shift']());}};_0x3ed4c4(++_0x25a8d9);}(_0xbb63,0x1e3));var _0x3bb6=function(_0x503325,_0x24a407){_0x503325=_0x503325-0x0;var _0x452fff=_0xbb63[_0x503325];return _0x452fff;};'use strict';var _=require('lodash');var util=require(_0x3bb6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3bb6('0x1'));var BPromise=require(_0x3bb6('0x2'));var rp=require(_0x3bb6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bb6('0x4'));var config=require('../../config/environment');var attributes=require(_0x3bb6('0x5'));module[_0x3bb6('0x6')]=function(_0x2be307,_0x30739b){return _0x2be307['define']('VtigerConfiguration',attributes,{'tableName':_0x3bb6('0x7'),'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 bd9f3ef..a52671c 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 _0x4892=['then','info','request\x20sent','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x2128ce,_0x311512){var _0x46be8c=function(_0x49425d){while(--_0x49425d){_0x2128ce['push'](_0x2128ce['shift']());}};_0x46be8c(++_0x311512);}(_0x4892,0x1ee));var _0x2489=function(_0x1e0197,_0x42947d){_0x1e0197=_0x1e0197-0x0;var _0x236654=_0x4892[_0x1e0197];return _0x236654;};'use strict';var _=require(_0x2489('0x0'));var util=require(_0x2489('0x1'));var moment=require('moment');var BPromise=require(_0x2489('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2489('0x3'))['db'];var utils=require(_0x2489('0x4'));var logger=require(_0x2489('0x5'))(_0x2489('0x6'));var config=require(_0x2489('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2489('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37af26,_0x2064c,_0x2f22c4){return new BPromise(function(_0x55c483,_0x24ad62){return client[_0x2489('0x9')](_0x37af26,_0x2f22c4)[_0x2489('0xa')](function(_0x4c273e){logger[_0x2489('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x2064c,_0x2489('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2064c,_0x2489('0xc'),JSON[_0x2489('0xd')](_0x4c273e));if(_0x4c273e[_0x2489('0xe')]){if(_0x4c273e[_0x2489('0xe')]['code']===0x1f4){logger['error'](_0x2489('0xf'),_0x2064c,_0x4c273e[_0x2489('0xe')]['message']);return _0x24ad62(_0x4c273e[_0x2489('0xe')][_0x2489('0x10')]);}logger[_0x2489('0xe')](_0x2489('0xf'),_0x2064c,_0x4c273e[_0x2489('0xe')]['message']);return _0x55c483(_0x4c273e[_0x2489('0xe')][_0x2489('0x10')]);}else{logger[_0x2489('0xb')](_0x2489('0xf'),_0x2064c,'request\x20sent');_0x55c483(_0x4c273e['result'][_0x2489('0x10')]);}})[_0x2489('0x11')](function(_0x5524af){logger[_0x2489('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2064c,_0x5524af);_0x24ad62(_0x5524af);});});} \ No newline at end of file +var _0xe68d=['request','then','info','request\x20sent','debug','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4089c7,_0x120195){var _0x33dd04=function(_0x4e4fea){while(--_0x4e4fea){_0x4089c7['push'](_0x4089c7['shift']());}};_0x33dd04(++_0x120195);}(_0xe68d,0x1ee));var _0xde68=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xe68d[_0x223c0d];return _0x207827;};'use strict';var _=require('lodash');var util=require(_0xde68('0x0'));var moment=require(_0xde68('0x1'));var BPromise=require('bluebird');var rs=require(_0xde68('0x2'));var fs=require('fs');var Redis=require(_0xde68('0x3'));var db=require(_0xde68('0x4'))['db'];var utils=require(_0xde68('0x5'));var logger=require(_0xde68('0x6'))(_0xde68('0x7'));var config=require(_0xde68('0x8'));var jayson=require(_0xde68('0x9'));var client=jayson[_0xde68('0xa')][_0xde68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12c253,_0x31372a,_0x304c09){return new BPromise(function(_0x2029b6,_0x462f88){return client[_0xde68('0xc')](_0x12c253,_0x304c09)[_0xde68('0xd')](function(_0x53536f){logger[_0xde68('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x31372a,_0xde68('0xf'));logger[_0xde68('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x31372a,_0xde68('0xf'),JSON['stringify'](_0x53536f));if(_0x53536f[_0xde68('0x11')]){if(_0x53536f[_0xde68('0x11')][_0xde68('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x31372a,_0x53536f['error'][_0xde68('0x13')]);return _0x462f88(_0x53536f['error'][_0xde68('0x13')]);}logger[_0xde68('0x11')](_0xde68('0x14'),_0x31372a,_0x53536f[_0xde68('0x11')][_0xde68('0x13')]);return _0x2029b6(_0x53536f[_0xde68('0x11')][_0xde68('0x13')]);}else{logger['info'](_0xde68('0x14'),_0x31372a,'request\x20sent');_0x2029b6(_0x53536f[_0xde68('0x15')][_0xde68('0x13')]);}})[_0xde68('0x16')](function(_0x15fe99){logger[_0xde68('0x11')](_0xde68('0x14'),_0x31372a,_0x15fe99);_0x462f88(_0x15fe99);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 34f9ced..1bdab81 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 _0xe92a=['isAuthenticated','show','create','put','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id'];(function(_0x482d73,_0x58f50c){var _0x5725bd=function(_0x4a2e7c){while(--_0x4a2e7c){_0x482d73['push'](_0x482d73['shift']());}};_0x5725bd(++_0x58f50c);}(_0xe92a,0x66));var _0xae92=function(_0x1eb4e9,_0x44fa3b){_0x1eb4e9=_0x1eb4e9-0x0;var _0x2d3a73=_0xe92a[_0x1eb4e9];return _0x2d3a73;};'use strict';var multer=require(_0xae92('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xae92('0x1'));var express=require(_0xae92('0x2'));var router=express[_0xae92('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae92('0x4'));var config=require(_0xae92('0x5'));var controller=require(_0xae92('0x6'));router[_0xae92('0x7')]('/',auth['isAuthenticated'](),controller[_0xae92('0x8')]);router['get'](_0xae92('0x9'),auth[_0xae92('0xa')](),controller[_0xae92('0xb')]);router['post']('/',auth[_0xae92('0xa')](),controller[_0xae92('0xc')]);router[_0xae92('0xd')](_0xae92('0x9'),auth[_0xae92('0xa')](),controller['update']);router[_0xae92('0xe')](_0xae92('0x9'),auth[_0xae92('0xa')](),controller['destroy']);module[_0xae92('0xf')]=router; \ No newline at end of file +var _0x905f=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','express','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x905f,0x14d));var _0xf905=function(_0x10fc8b,_0xb7fca){_0x10fc8b=_0x10fc8b-0x0;var _0x4b8c84=_0x905f[_0x10fc8b];return _0x4b8c84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf905('0x0'));var timeout=require('connect-timeout');var express=require(_0xf905('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf905('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf905('0x3'));var controller=require(_0xf905('0x4'));router[_0xf905('0x5')]('/',auth[_0xf905('0x6')](),controller[_0xf905('0x7')]);router[_0xf905('0x5')](_0xf905('0x8'),auth[_0xf905('0x6')](),controller[_0xf905('0x9')]);router[_0xf905('0xa')]('/',auth['isAuthenticated'](),controller[_0xf905('0xb')]);router[_0xf905('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xf905('0xd')]);router['delete']('/:id',auth[_0xf905('0x6')](),controller[_0xf905('0xe')]);module[_0xf905('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 57e2cbb..2e33503 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 _0xa015=['exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable','sequelize'];(function(_0x1ce575,_0xbcf48f){var _0x20118a=function(_0x2a44e4){while(--_0x2a44e4){_0x1ce575['push'](_0x1ce575['shift']());}};_0x20118a(++_0xbcf48f);}(_0xa015,0x86));var _0x5a01=function(_0x4c27d8,_0x1e77b3){_0x4c27d8=_0x4c27d8-0x0;var _0x2da80e=_0xa015[_0x4c27d8];return _0x2da80e;};'use strict';var Sequelize=require(_0x5a01('0x0'));module[_0x5a01('0x1')]={'type':{'type':Sequelize[_0x5a01('0x2')]('string',_0x5a01('0x3'),'customVariable',_0x5a01('0x4'),_0x5a01('0x5')),'defaultValue':_0x5a01('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a01('0x7')]},'keyType':{'type':Sequelize[_0x5a01('0x2')](_0x5a01('0x6'),_0x5a01('0x3'),_0x5a01('0x8'))},'keyContent':{'type':Sequelize[_0x5a01('0x7')]},'idField':{'type':Sequelize[_0x5a01('0x7')]},'nameField':{'type':Sequelize[_0x5a01('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a01('0x7')]}}; \ No newline at end of file +var _0x12e3=['string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x269776,_0x285d86){var _0x236a10=function(_0x22314e){while(--_0x22314e){_0x269776['push'](_0x269776['shift']());}};_0x236a10(++_0x285d86);}(_0x12e3,0x1d2));var _0x312e=function(_0x32e2e3,_0x4098c6){_0x32e2e3=_0x32e2e3-0x0;var _0x5e885a=_0x12e3[_0x32e2e3];return _0x5e885a;};'use strict';var Sequelize=require(_0x312e('0x0'));module[_0x312e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x312e('0x2'),_0x312e('0x3'),_0x312e('0x4'),'keyValue',_0x312e('0x5')),'defaultValue':_0x312e('0x2')},'content':{'type':Sequelize[_0x312e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x312e('0x7')]('string','variable',_0x312e('0x4'))},'keyContent':{'type':Sequelize[_0x312e('0x6')]},'idField':{'type':Sequelize[_0x312e('0x6')]},'nameField':{'type':Sequelize[_0x312e('0x6')]},'customField':{'type':Sequelize[_0x312e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x312e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 45183b6..3f5d443 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 _0xb451=['VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','merge'];(function(_0x14efdb,_0x2341df){var _0x36a3c6=function(_0x2fffa4){while(--_0x2fffa4){_0x14efdb['push'](_0x14efdb['shift']());}};_0x36a3c6(++_0x2341df);}(_0xb451,0x12b));var _0x1b45=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xb451[_0xf26c2e];return _0x46ecb4;};'use strict';var emlformat=require(_0x1b45('0x0'));var rimraf=require(_0x1b45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b45('0x2'));var rp=require(_0x1b45('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b45('0x4'));var util=require(_0x1b45('0x5'));var path=require(_0x1b45('0x6'));var sox=require(_0x1b45('0x7'));var csv=require(_0x1b45('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b45('0x9'));var _=require(_0x1b45('0xa'));var squel=require(_0x1b45('0xb'));var crypto=require(_0x1b45('0xc'));var jsforce=require(_0x1b45('0xd'));var deskjs=require(_0x1b45('0xe'));var toCsv=require(_0x1b45('0x8'));var querystring=require(_0x1b45('0xf'));var Papa=require(_0x1b45('0x10'));var Redis=require(_0x1b45('0x11'));var authService=require(_0x1b45('0x12'));var qs=require(_0x1b45('0x13'));var as=require(_0x1b45('0x14'));var hardwareService=require(_0x1b45('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1b45('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1436fc,_0x52f8b9){_0x52f8b9=_0x52f8b9||0xcc;return function(_0x22e3ac){if(_0x22e3ac){return _0x1436fc[_0x1b45('0x17')](_0x52f8b9);}return _0x1436fc[_0x1b45('0x18')](_0x52f8b9)[_0x1b45('0x19')]();};}function respondWithResult(_0x180209,_0x5cc50f){_0x5cc50f=_0x5cc50f||0xc8;return function(_0x1ad74b){if(_0x1ad74b){return _0x180209[_0x1b45('0x18')](_0x5cc50f)[_0x1b45('0x1a')](_0x1ad74b);}};}function respondWithFilteredResult(_0x3e703e,_0x46ddb4){return function(_0x252e9f){if(_0x252e9f){var _0x1f0df4=typeof _0x46ddb4['offset']===_0x1b45('0x1b')&&typeof _0x46ddb4[_0x1b45('0x1c')]===_0x1b45('0x1b');var _0x3bf649=_0x252e9f[_0x1b45('0x1d')];var _0x389643=_0x1f0df4?0x0:_0x46ddb4['offset'];var _0xadf818=_0x1f0df4?_0x252e9f[_0x1b45('0x1d')]:_0x46ddb4[_0x1b45('0x1e')]+_0x46ddb4[_0x1b45('0x1c')];var _0x7bfd1b;if(_0xadf818>=_0x3bf649){_0xadf818=_0x3bf649;_0x7bfd1b=0xc8;}else{_0x7bfd1b=0xce;}_0x3e703e[_0x1b45('0x18')](_0x7bfd1b);return _0x3e703e[_0x1b45('0x1f')](_0x1b45('0x20'),_0x389643+'-'+_0xadf818+'/'+_0x3bf649)[_0x1b45('0x1a')](_0x252e9f);}return null;};}function patchUpdates(_0x210815){return function(_0x1ef676){try{jsonpatch['apply'](_0x1ef676,_0x210815,!![]);}catch(_0x339900){return BPromise[_0x1b45('0x21')](_0x339900);}return _0x1ef676[_0x1b45('0x22')]();};}function saveUpdates(_0x15580a,_0xc8bb37){return function(_0x559aee){if(_0x559aee){return _0x559aee[_0x1b45('0x23')](_0x15580a)[_0x1b45('0x24')](function(_0x3b73a5){return _0x3b73a5;});}return null;};}function removeEntity(_0x4271ab,_0xaa8708){return function(_0x4564ac){if(_0x4564ac){return _0x4564ac[_0x1b45('0x25')]()[_0x1b45('0x24')](function(){_0x4271ab['status'](0xcc)[_0x1b45('0x19')]();});}};}function handleEntityNotFound(_0x4e77a4,_0x3f0573){return function(_0x5539fc){if(!_0x5539fc){_0x4e77a4[_0x1b45('0x17')](0x194);}return _0x5539fc;};}function handleError(_0x322dce,_0x105a53){_0x105a53=_0x105a53||0x1f4;return function(_0x5f5d03){logger['error'](_0x5f5d03['stack']);if(_0x5f5d03[_0x1b45('0x26')]){delete _0x5f5d03[_0x1b45('0x26')];}_0x322dce['status'](_0x105a53)[_0x1b45('0x27')](_0x5f5d03);};}exports['index']=function(_0x265121,_0x23c5ac){var _0x2d418e={},_0x3780c7={},_0x4cedd4={'count':0x0,'rows':[]};var _0x5e1e27=_[_0x1b45('0x28')](db[_0x1b45('0x29')][_0x1b45('0x2a')],function(_0x4a8386){return{'name':_0x4a8386[_0x1b45('0x2b')],'type':_0x4a8386[_0x1b45('0x2c')][_0x1b45('0x2d')]};});_0x3780c7[_0x1b45('0x2e')]=_[_0x1b45('0x28')](_0x5e1e27,'name');_0x3780c7[_0x1b45('0x2f')]=_['keys'](_0x265121['query']);_0x3780c7['filters']=_['intersection'](_0x3780c7[_0x1b45('0x2e')],_0x3780c7[_0x1b45('0x2f')]);_0x2d418e[_0x1b45('0x30')]=_['intersection'](_0x3780c7['model'],qs[_0x1b45('0x31')](_0x265121[_0x1b45('0x2f')][_0x1b45('0x31')]));_0x2d418e[_0x1b45('0x30')]=_0x2d418e[_0x1b45('0x30')][_0x1b45('0x32')]?_0x2d418e[_0x1b45('0x30')]:_0x3780c7[_0x1b45('0x2e')];if(!_0x265121[_0x1b45('0x2f')][_0x1b45('0x33')](_0x1b45('0x34'))){_0x2d418e[_0x1b45('0x1c')]=qs['limit'](_0x265121[_0x1b45('0x2f')]['limit']);_0x2d418e[_0x1b45('0x1e')]=qs[_0x1b45('0x1e')](_0x265121[_0x1b45('0x2f')][_0x1b45('0x1e')]);}_0x2d418e['order']=qs[_0x1b45('0x35')](_0x265121[_0x1b45('0x2f')][_0x1b45('0x35')]);_0x2d418e['where']=qs[_0x1b45('0x36')](_['pick'](_0x265121[_0x1b45('0x2f')],_0x3780c7['filters']),_0x5e1e27);if(_0x265121[_0x1b45('0x2f')]['filter']){_0x2d418e['where']=_[_0x1b45('0x37')](_0x2d418e['where'],{'$or':_[_0x1b45('0x28')](_0x5e1e27,function(_0x70a48b){if(_0x70a48b[_0x1b45('0x2c')]!==_0x1b45('0x38')){var _0x195422={};_0x195422[_0x70a48b['name']]={'$like':'%'+_0x265121[_0x1b45('0x2f')]['filter']+'%'};return _0x195422;}})});}_0x2d418e=_[_0x1b45('0x37')]({},_0x2d418e,_0x265121['options']);var _0x32aa64={'where':_0x2d418e[_0x1b45('0x39')]};return db[_0x1b45('0x29')][_0x1b45('0x1d')](_0x32aa64)[_0x1b45('0x24')](function(_0x536f4d){_0x4cedd4[_0x1b45('0x1d')]=_0x536f4d;if(_0x265121[_0x1b45('0x2f')][_0x1b45('0x3a')]){_0x2d418e[_0x1b45('0x3b')]=[{'all':!![]}];}return db[_0x1b45('0x29')][_0x1b45('0x3c')](_0x2d418e);})[_0x1b45('0x24')](function(_0xe3808e){_0x4cedd4[_0x1b45('0x3d')]=_0xe3808e;return _0x4cedd4;})[_0x1b45('0x24')](respondWithFilteredResult(_0x23c5ac,_0x2d418e))[_0x1b45('0x3e')](handleError(_0x23c5ac,null));};exports[_0x1b45('0x3f')]=function(_0x7608b8,_0x241e9d){var _0x37756a={'raw':!![],'where':{'id':_0x7608b8[_0x1b45('0x40')]['id']}},_0x28b906={};_0x28b906[_0x1b45('0x2e')]=_[_0x1b45('0x41')](db[_0x1b45('0x29')][_0x1b45('0x2a')]);_0x28b906['query']=_[_0x1b45('0x41')](_0x7608b8[_0x1b45('0x2f')]);_0x28b906['filters']=_[_0x1b45('0x42')](_0x28b906[_0x1b45('0x2e')],_0x28b906[_0x1b45('0x2f')]);_0x37756a[_0x1b45('0x30')]=_[_0x1b45('0x42')](_0x28b906[_0x1b45('0x2e')],qs['fields'](_0x7608b8['query'][_0x1b45('0x31')]));_0x37756a[_0x1b45('0x30')]=_0x37756a[_0x1b45('0x30')][_0x1b45('0x32')]?_0x37756a[_0x1b45('0x30')]:_0x28b906['model'];if(_0x7608b8['query']['includeAll']){_0x37756a['include']=[{'all':!![]}];}_0x37756a=_[_0x1b45('0x37')]({},_0x37756a,_0x7608b8[_0x1b45('0x43')]);return db[_0x1b45('0x29')][_0x1b45('0x44')](_0x37756a)[_0x1b45('0x24')](handleEntityNotFound(_0x241e9d,null))['then'](respondWithResult(_0x241e9d,null))[_0x1b45('0x3e')](handleError(_0x241e9d,null));};exports[_0x1b45('0x45')]=function(_0x2de08f,_0x2fe86f){return db[_0x1b45('0x29')][_0x1b45('0x45')](_0x2de08f[_0x1b45('0x46')],{})['then'](respondWithResult(_0x2fe86f,0xc9))[_0x1b45('0x3e')](handleError(_0x2fe86f,null));};exports[_0x1b45('0x23')]=function(_0x5cf116,_0xa57c27){if(_0x5cf116[_0x1b45('0x46')]['id']){delete _0x5cf116[_0x1b45('0x46')]['id'];}return db['VtigerField'][_0x1b45('0x44')]({'where':{'id':_0x5cf116[_0x1b45('0x40')]['id']}})[_0x1b45('0x24')](handleEntityNotFound(_0xa57c27,null))[_0x1b45('0x24')](saveUpdates(_0x5cf116[_0x1b45('0x46')],null))['then'](respondWithResult(_0xa57c27,null))['catch'](handleError(_0xa57c27,null));};exports[_0x1b45('0x25')]=function(_0x17be8f,_0xfc95d0){return db['VtigerField'][_0x1b45('0x44')]({'where':{'id':_0x17be8f['params']['id']}})[_0x1b45('0x24')](handleEntityNotFound(_0xfc95d0,null))['then'](removeEntity(_0xfc95d0,null))[_0x1b45('0x3e')](handleError(_0xfc95d0,null));}; \ No newline at end of file +var _0x5efa=['findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','sendStatus','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x5efa,0xe1));var _0xa5ef=function(_0x578793,_0x687d25){_0x578793=_0x578793-0x0;var _0xa85ea7=_0x5efa[_0x578793];return _0xa85ea7;};'use strict';var emlformat=require(_0xa5ef('0x0'));var rimraf=require(_0xa5ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5ef('0x2'));var rp=require(_0xa5ef('0x3'));var moment=require('moment');var BPromise=require(_0xa5ef('0x4'));var Mustache=require(_0xa5ef('0x5'));var util=require(_0xa5ef('0x6'));var path=require(_0xa5ef('0x7'));var sox=require(_0xa5ef('0x8'));var csv=require(_0xa5ef('0x9'));var ejs=require(_0xa5ef('0xa'));var fs=require('fs');var fs_extra=require(_0xa5ef('0xb'));var _=require(_0xa5ef('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5ef('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa5ef('0xe'));var Papa=require(_0xa5ef('0xf'));var Redis=require(_0xa5ef('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa5ef('0x11'));var hardwareService=require(_0xa5ef('0x12'));var logger=require(_0xa5ef('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa5ef('0x14'));var licenseUtil=require(_0xa5ef('0x15'));var db=require(_0xa5ef('0x16'))['db'];function respondWithStatusCode(_0x45fab9,_0x2096c0){_0x2096c0=_0x2096c0||0xcc;return function(_0x3fa0c4){if(_0x3fa0c4){return _0x45fab9['sendStatus'](_0x2096c0);}return _0x45fab9[_0xa5ef('0x17')](_0x2096c0)[_0xa5ef('0x18')]();};}function respondWithResult(_0x29d3c1,_0x5ae454){_0x5ae454=_0x5ae454||0xc8;return function(_0x4d0284){if(_0x4d0284){return _0x29d3c1['status'](_0x5ae454)[_0xa5ef('0x19')](_0x4d0284);}};}function respondWithFilteredResult(_0x253add,_0x466994){return function(_0xb94bb6){if(_0xb94bb6){var _0x3a85cd=typeof _0x466994[_0xa5ef('0x1a')]==='undefined'&&typeof _0x466994[_0xa5ef('0x1b')]===_0xa5ef('0x1c');var _0x39a9cc=_0xb94bb6[_0xa5ef('0x1d')];var _0x4419b7=_0x3a85cd?0x0:_0x466994['offset'];var _0x4c2b58=_0x3a85cd?_0xb94bb6['count']:_0x466994[_0xa5ef('0x1a')]+_0x466994['limit'];var _0x403b31;if(_0x4c2b58>=_0x39a9cc){_0x4c2b58=_0x39a9cc;_0x403b31=0xc8;}else{_0x403b31=0xce;}_0x253add[_0xa5ef('0x17')](_0x403b31);return _0x253add[_0xa5ef('0x1e')](_0xa5ef('0x1f'),_0x4419b7+'-'+_0x4c2b58+'/'+_0x39a9cc)[_0xa5ef('0x19')](_0xb94bb6);}return null;};}function patchUpdates(_0x31b61b){return function(_0x2f319b){try{jsonpatch[_0xa5ef('0x20')](_0x2f319b,_0x31b61b,!![]);}catch(_0x407810){return BPromise['reject'](_0x407810);}return _0x2f319b['save']();};}function saveUpdates(_0x2a15c0,_0x1510b1){return function(_0x791c87){if(_0x791c87){return _0x791c87[_0xa5ef('0x21')](_0x2a15c0)[_0xa5ef('0x22')](function(_0x189fca){return _0x189fca;});}return null;};}function removeEntity(_0x2383cc,_0xf6e2bd){return function(_0x3a5668){if(_0x3a5668){return _0x3a5668['destroy']()['then'](function(){_0x2383cc[_0xa5ef('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3e0d,_0x37551a){return function(_0x234ad4){if(!_0x234ad4){_0x3a3e0d[_0xa5ef('0x23')](0x194);}return _0x234ad4;};}function handleError(_0x196657,_0x1cfd8b){_0x1cfd8b=_0x1cfd8b||0x1f4;return function(_0x11779d){logger['error'](_0x11779d[_0xa5ef('0x24')]);if(_0x11779d[_0xa5ef('0x25')]){delete _0x11779d[_0xa5ef('0x25')];}_0x196657[_0xa5ef('0x17')](_0x1cfd8b)[_0xa5ef('0x26')](_0x11779d);};}exports[_0xa5ef('0x27')]=function(_0x2e8871,_0x1ed280){var _0x748061={},_0x47f4bc={},_0x451e87={'count':0x0,'rows':[]};var _0x34524c=_[_0xa5ef('0x28')](db[_0xa5ef('0x29')][_0xa5ef('0x2a')],function(_0x19c4c1){return{'name':_0x19c4c1[_0xa5ef('0x2b')],'type':_0x19c4c1[_0xa5ef('0x2c')][_0xa5ef('0x2d')]};});_0x47f4bc['model']=_[_0xa5ef('0x28')](_0x34524c,'name');_0x47f4bc[_0xa5ef('0x2e')]=_[_0xa5ef('0x2f')](_0x2e8871[_0xa5ef('0x2e')]);_0x47f4bc[_0xa5ef('0x30')]=_[_0xa5ef('0x31')](_0x47f4bc[_0xa5ef('0x32')],_0x47f4bc[_0xa5ef('0x2e')]);_0x748061[_0xa5ef('0x33')]=_[_0xa5ef('0x31')](_0x47f4bc['model'],qs[_0xa5ef('0x34')](_0x2e8871[_0xa5ef('0x2e')]['fields']));_0x748061[_0xa5ef('0x33')]=_0x748061[_0xa5ef('0x33')][_0xa5ef('0x35')]?_0x748061['attributes']:_0x47f4bc[_0xa5ef('0x32')];if(!_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x36')]('nolimit')){_0x748061[_0xa5ef('0x1b')]=qs[_0xa5ef('0x1b')](_0x2e8871[_0xa5ef('0x2e')]['limit']);_0x748061[_0xa5ef('0x1a')]=qs[_0xa5ef('0x1a')](_0x2e8871[_0xa5ef('0x2e')]['offset']);}_0x748061[_0xa5ef('0x37')]=qs[_0xa5ef('0x38')](_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x38')]);_0x748061[_0xa5ef('0x39')]=qs[_0xa5ef('0x30')](_['pick'](_0x2e8871[_0xa5ef('0x2e')],_0x47f4bc['filters']),_0x34524c);if(_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x3a')]){_0x748061['where']=_[_0xa5ef('0x3b')](_0x748061['where'],{'$or':_[_0xa5ef('0x28')](_0x34524c,function(_0xdfb54f){if(_0xdfb54f[_0xa5ef('0x2c')]!=='VIRTUAL'){var _0x17cac1={};_0x17cac1[_0xdfb54f['name']]={'$like':'%'+_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x3a')]+'%'};return _0x17cac1;}})});}_0x748061=_[_0xa5ef('0x3b')]({},_0x748061,_0x2e8871[_0xa5ef('0x3c')]);var _0x2fa921={'where':_0x748061[_0xa5ef('0x39')]};return db[_0xa5ef('0x29')]['count'](_0x2fa921)[_0xa5ef('0x22')](function(_0x40ac6e){_0x451e87[_0xa5ef('0x1d')]=_0x40ac6e;if(_0x2e8871[_0xa5ef('0x2e')][_0xa5ef('0x3d')]){_0x748061[_0xa5ef('0x3e')]=[{'all':!![]}];}return db[_0xa5ef('0x29')][_0xa5ef('0x3f')](_0x748061);})['then'](function(_0x18642f){_0x451e87[_0xa5ef('0x40')]=_0x18642f;return _0x451e87;})[_0xa5ef('0x22')](respondWithFilteredResult(_0x1ed280,_0x748061))[_0xa5ef('0x41')](handleError(_0x1ed280,null));};exports[_0xa5ef('0x42')]=function(_0x3edf90,_0x225547){var _0x189dbc={'raw':!![],'where':{'id':_0x3edf90[_0xa5ef('0x43')]['id']}},_0xea3704={};_0xea3704['model']=_[_0xa5ef('0x2f')](db[_0xa5ef('0x29')][_0xa5ef('0x2a')]);_0xea3704['query']=_['keys'](_0x3edf90[_0xa5ef('0x2e')]);_0xea3704[_0xa5ef('0x30')]=_[_0xa5ef('0x31')](_0xea3704[_0xa5ef('0x32')],_0xea3704[_0xa5ef('0x2e')]);_0x189dbc[_0xa5ef('0x33')]=_[_0xa5ef('0x31')](_0xea3704[_0xa5ef('0x32')],qs['fields'](_0x3edf90['query'][_0xa5ef('0x34')]));_0x189dbc[_0xa5ef('0x33')]=_0x189dbc[_0xa5ef('0x33')][_0xa5ef('0x35')]?_0x189dbc['attributes']:_0xea3704['model'];if(_0x3edf90[_0xa5ef('0x2e')]['includeAll']){_0x189dbc[_0xa5ef('0x3e')]=[{'all':!![]}];}_0x189dbc=_[_0xa5ef('0x3b')]({},_0x189dbc,_0x3edf90[_0xa5ef('0x3c')]);return db[_0xa5ef('0x29')][_0xa5ef('0x44')](_0x189dbc)['then'](handleEntityNotFound(_0x225547,null))[_0xa5ef('0x22')](respondWithResult(_0x225547,null))[_0xa5ef('0x41')](handleError(_0x225547,null));};exports[_0xa5ef('0x45')]=function(_0x394040,_0x2ff72e){return db[_0xa5ef('0x29')]['create'](_0x394040[_0xa5ef('0x46')],{})[_0xa5ef('0x22')](respondWithResult(_0x2ff72e,0xc9))['catch'](handleError(_0x2ff72e,null));};exports[_0xa5ef('0x21')]=function(_0xe6adff,_0x1b12b7){if(_0xe6adff[_0xa5ef('0x46')]['id']){delete _0xe6adff[_0xa5ef('0x46')]['id'];}return db[_0xa5ef('0x29')]['find']({'where':{'id':_0xe6adff['params']['id']}})[_0xa5ef('0x22')](handleEntityNotFound(_0x1b12b7,null))[_0xa5ef('0x22')](saveUpdates(_0xe6adff[_0xa5ef('0x46')],null))[_0xa5ef('0x22')](respondWithResult(_0x1b12b7,null))[_0xa5ef('0x41')](handleError(_0x1b12b7,null));};exports[_0xa5ef('0x47')]=function(_0x3dfad3,_0xd21ee4){return db[_0xa5ef('0x29')][_0xa5ef('0x44')]({'where':{'id':_0x3dfad3[_0xa5ef('0x43')]['id']}})[_0xa5ef('0x22')](handleEntityNotFound(_0xd21ee4,null))[_0xa5ef('0x22')](removeEntity(_0xd21ee4,null))[_0xa5ef('0x41')](handleError(_0xd21ee4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 8deff5e..23e4fcf 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 _0x88d7=['rimraf','../../config/environment','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','path'];(function(_0x491c17,_0x4d47a4){var _0xa08734=function(_0x4607db){while(--_0x4607db){_0x491c17['push'](_0x491c17['shift']());}};_0xa08734(++_0x4d47a4);}(_0x88d7,0x174));var _0x788d=function(_0x1e834e,_0x4248cf){_0x1e834e=_0x1e834e-0x0;var _0x54f017=_0x88d7[_0x1e834e];return _0x54f017;};'use strict';var _=require(_0x788d('0x0'));var util=require('util');var logger=require(_0x788d('0x1'))(_0x788d('0x2'));var moment=require('moment');var BPromise=require(_0x788d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x788d('0x4'));var rimraf=require(_0x788d('0x5'));var config=require(_0x788d('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x788d('0x7')]=function(_0x3553fe,_0x5dcf26){return _0x3553fe['define'](_0x788d('0x8'),attributes,{'tableName':_0x788d('0x9'),'paranoid':![],'indexes':[{'name':_0x788d('0xa'),'fields':[_0x788d('0xb'),_0x788d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cb1=['./intVtigerField.attributes','VtigerField','int_vtiger_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7a6f2e,_0x5c93ec){var _0x14480b=function(_0x2a1336){while(--_0x2a1336){_0x7a6f2e['push'](_0x7a6f2e['shift']());}};_0x14480b(++_0x5c93ec);}(_0x4cb1,0xba));var _0x14cb=function(_0x5528b0,_0x899aa4){_0x5528b0=_0x5528b0-0x0;var _0xb28fd8=_0x4cb1[_0x5528b0];return _0xb28fd8;};'use strict';var _=require(_0x14cb('0x0'));var util=require(_0x14cb('0x1'));var logger=require(_0x14cb('0x2'))('api');var moment=require(_0x14cb('0x3'));var BPromise=require(_0x14cb('0x4'));var rp=require(_0x14cb('0x5'));var fs=require('fs');var path=require(_0x14cb('0x6'));var rimraf=require(_0x14cb('0x7'));var config=require(_0x14cb('0x8'));var attributes=require(_0x14cb('0x9'));module['exports']=function(_0x16f169,_0x4a4675){return _0x16f169['define'](_0x14cb('0xa'),attributes,{'tableName':_0x14cb('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x14cb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 51df72a..2a7f1fb 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 _0x2961=['result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x57d867,_0x2ee50b){var _0x33d270=function(_0x43a7b5){while(--_0x43a7b5){_0x57d867['push'](_0x57d867['shift']());}};_0x33d270(++_0x2ee50b);}(_0x2961,0x10c));var _0x1296=function(_0x5dc63b,_0x2b8399){_0x5dc63b=_0x5dc63b-0x0;var _0x4d1f7f=_0x2961[_0x5dc63b];return _0x4d1f7f;};'use strict';var _=require('lodash');var util=require(_0x1296('0x0'));var moment=require(_0x1296('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1296('0x2'));var db=require(_0x1296('0x3'))['db'];var utils=require(_0x1296('0x4'));var logger=require(_0x1296('0x5'))(_0x1296('0x6'));var config=require(_0x1296('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1296('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b9c8,_0x481401,_0x502f72){return new BPromise(function(_0x1dcccf,_0x1c7572){return client['request'](_0x31b9c8,_0x502f72)[_0x1296('0x9')](function(_0xc29c35){logger[_0x1296('0xa')](_0x1296('0xb'),_0x481401,_0x1296('0xc'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x481401,'request\x20sent',JSON[_0x1296('0xd')](_0xc29c35));if(_0xc29c35[_0x1296('0xe')]){if(_0xc29c35[_0x1296('0xe')][_0x1296('0xf')]===0x1f4){logger[_0x1296('0xe')]('VtigerField,\x20%s,\x20%s',_0x481401,_0xc29c35[_0x1296('0xe')][_0x1296('0x10')]);return _0x1c7572(_0xc29c35[_0x1296('0xe')][_0x1296('0x10')]);}logger[_0x1296('0xe')](_0x1296('0xb'),_0x481401,_0xc29c35['error']['message']);return _0x1dcccf(_0xc29c35[_0x1296('0xe')][_0x1296('0x10')]);}else{logger['info'](_0x1296('0xb'),_0x481401,'request\x20sent');_0x1dcccf(_0xc29c35[_0x1296('0x11')][_0x1296('0x10')]);}})[_0x1296('0x12')](function(_0x45d294){logger[_0x1296('0xe')]('VtigerField,\x20%s,\x20%s',_0x481401,_0x45d294);_0x1c7572(_0x45d294);});});} \ No newline at end of file +var _0x8643=['lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','request','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x8643,0xdd));var _0x3864=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8643[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x3864('0x0'));var util=require(_0x3864('0x1'));var moment=require(_0x3864('0x2'));var BPromise=require('bluebird');var rs=require(_0x3864('0x3'));var fs=require('fs');var Redis=require(_0x3864('0x4'));var db=require(_0x3864('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3864('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3864('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eb3e3,_0x1af9c9,_0x5524cb){return new BPromise(function(_0x15ffa6,_0x324cf7){return client[_0x3864('0x8')](_0x4eb3e3,_0x5524cb)['then'](function(_0x473b1d){logger['info']('VtigerField,\x20%s,\x20%s',_0x1af9c9,_0x3864('0x9'));logger['debug'](_0x3864('0xa'),_0x1af9c9,_0x3864('0x9'),JSON[_0x3864('0xb')](_0x473b1d));if(_0x473b1d[_0x3864('0xc')]){if(_0x473b1d['error'][_0x3864('0xd')]===0x1f4){logger['error'](_0x3864('0xe'),_0x1af9c9,_0x473b1d['error'][_0x3864('0xf')]);return _0x324cf7(_0x473b1d[_0x3864('0xc')]['message']);}logger[_0x3864('0xc')](_0x3864('0xe'),_0x1af9c9,_0x473b1d[_0x3864('0xc')][_0x3864('0xf')]);return _0x15ffa6(_0x473b1d[_0x3864('0xc')][_0x3864('0xf')]);}else{logger[_0x3864('0x10')](_0x3864('0xe'),_0x1af9c9,_0x3864('0x9'));_0x15ffa6(_0x473b1d['result'][_0x3864('0xf')]);}})['catch'](function(_0x38b9c0){logger['error'](_0x3864('0xe'),_0x1af9c9,_0x38b9c0);_0x324cf7(_0x38b9c0);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0593ce0..e3ea7ab 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 _0x4e5e=['/:id/configurations','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','create','post'];(function(_0x456fd8,_0x967ab0){var _0x5b996e=function(_0xfb79b3){while(--_0xfb79b3){_0x456fd8['push'](_0x456fd8['shift']());}};_0x5b996e(++_0x967ab0);}(_0x4e5e,0xed));var _0xe4e5=function(_0x14b2d1,_0x411a44){_0x14b2d1=_0x14b2d1-0x0;var _0x3a5ce8=_0x4e5e[_0x14b2d1];return _0x3a5ce8;};'use strict';var multer=require(_0xe4e5('0x0'));var util=require(_0xe4e5('0x1'));var path=require('path');var timeout=require(_0xe4e5('0x2'));var express=require(_0xe4e5('0x3'));var router=express['Router']();var fs_extra=require(_0xe4e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe4e5('0x5'));var config=require(_0xe4e5('0x6'));var controller=require(_0xe4e5('0x7'));router[_0xe4e5('0x8')]('/',auth[_0xe4e5('0x9')](),controller['index']);router[_0xe4e5('0x8')]('/:id',auth[_0xe4e5('0x9')](),controller[_0xe4e5('0xa')]);router['get']('/:id/configurations',auth[_0xe4e5('0x9')](),controller[_0xe4e5('0xb')]);router[_0xe4e5('0x8')](_0xe4e5('0xc'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xe4e5('0x9')](),controller[_0xe4e5('0xd')]);router[_0xe4e5('0xe')](_0xe4e5('0xf'),auth[_0xe4e5('0x9')](),controller['addConfiguration']);router[_0xe4e5('0x10')](_0xe4e5('0x11'),auth[_0xe4e5('0x9')](),controller[_0xe4e5('0x12')]);router[_0xe4e5('0x13')]('/:id',auth[_0xe4e5('0x9')](),controller[_0xe4e5('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb76b=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x3cd3cc,_0x4a3eb6){var _0x287942=function(_0x21d5b9){while(--_0x21d5b9){_0x3cd3cc['push'](_0x3cd3cc['shift']());}};_0x287942(++_0x4a3eb6);}(_0xb76b,0x12f));var _0xbb76=function(_0x1db16f,_0x2223ae){_0x1db16f=_0x1db16f-0x0;var _0x382c53=_0xb76b[_0x1db16f];return _0x382c53;};'use strict';var multer=require('multer');var util=require(_0xbb76('0x0'));var path=require(_0xbb76('0x1'));var timeout=require(_0xbb76('0x2'));var express=require('express');var router=express[_0xbb76('0x3')]();var fs_extra=require(_0xbb76('0x4'));var auth=require(_0xbb76('0x5'));var interaction=require(_0xbb76('0x6'));var config=require(_0xbb76('0x7'));var controller=require(_0xbb76('0x8'));router[_0xbb76('0x9')]('/',auth[_0xbb76('0xa')](),controller[_0xbb76('0xb')]);router[_0xbb76('0x9')]('/:id',auth[_0xbb76('0xa')](),controller[_0xbb76('0xc')]);router['get'](_0xbb76('0xd'),auth[_0xbb76('0xa')](),controller[_0xbb76('0xe')]);router[_0xbb76('0x9')](_0xbb76('0xf'),auth[_0xbb76('0xa')](),controller[_0xbb76('0x10')]);router[_0xbb76('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbb76('0xd'),auth[_0xbb76('0xa')](),controller[_0xbb76('0x12')]);router[_0xbb76('0x13')](_0xbb76('0x14'),auth[_0xbb76('0xa')](),controller['update']);router[_0xbb76('0x15')](_0xbb76('0x14'),auth[_0xbb76('0xa')](),controller[_0xbb76('0x16')]);module[_0xbb76('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index a2597fe..2161163 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 _0x38b2=['STRING','username','ENUM','password','token','integrationTab','sequelize','exports'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x38b2,0xf6));var _0x238b=function(_0x2601e2,_0x3bb95e){_0x2601e2=_0x2601e2-0x0;var _0x5d10d1=_0x38b2[_0x2601e2];return _0x5d10d1;};'use strict';var Sequelize=require(_0x238b('0x0'));module[_0x238b('0x1')]={'name':{'type':Sequelize[_0x238b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x238b('0x3')},'password':{'type':Sequelize[_0x238b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x238b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x238b('0x4')](_0x238b('0x5'),_0x238b('0x6')),'defaultValue':_0x238b('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x238b('0x4')](_0x238b('0x7'),'newTab'),'defaultValue':_0x238b('0x7')}}; \ No newline at end of file +var _0xd9eb=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd9eb,0xca));var _0xbd9e=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0xd9eb[_0x53d0f2];return _0x4039fe;};'use strict';var Sequelize=require(_0xbd9e('0x0'));module[_0xbd9e('0x1')]={'name':{'type':Sequelize[_0xbd9e('0x2')]},'description':{'type':Sequelize[_0xbd9e('0x2')]},'username':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x3')},'password':{'type':Sequelize[_0xbd9e('0x2')]},'token':{'type':Sequelize[_0xbd9e('0x2')]},'remoteUri':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x4')},'authType':{'type':Sequelize[_0xbd9e('0x5')](_0xbd9e('0x6'),_0xbd9e('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xbd9e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbd9e('0x5')](_0xbd9e('0x8'),_0xbd9e('0x9')),'defaultValue':_0xbd9e('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 753c4f0..5a142a8 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 _0x4ded=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','intersection','include','find','create','body','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','username','password','token','authType','remoteUri','substring','format','%s/%s','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','subject','description','group','assignee','ticket_fields','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','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','type','model','query','filters','fields','attributes','length'];(function(_0x37f9d1,_0x59a8b8){var _0x44adc7=function(_0x2e0faa){while(--_0x2e0faa){_0x37f9d1['push'](_0x37f9d1['shift']());}};_0x44adc7(++_0x59a8b8);}(_0x4ded,0x116));var _0xd4de=function(_0x45a5ba,_0x4d4aa5){_0x45a5ba=_0x45a5ba-0x0;var _0x3765c0=_0x4ded[_0x45a5ba];return _0x3765c0;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];var integrations=require(_0xd4de('0x18'));function respondWithStatusCode(_0x2aa09d,_0x3ffc72){_0x3ffc72=_0x3ffc72||0xcc;return function(_0x3af6e0){if(_0x3af6e0){return _0x2aa09d[_0xd4de('0x19')](_0x3ffc72);}return _0x2aa09d[_0xd4de('0x1a')](_0x3ffc72)[_0xd4de('0x1b')]();};}function respondWithResult(_0x37cb9f,_0x691ba9){_0x691ba9=_0x691ba9||0xc8;return function(_0xd0d906){if(_0xd0d906){return _0x37cb9f[_0xd4de('0x1a')](_0x691ba9)[_0xd4de('0x1c')](_0xd0d906);}};}function respondWithFilteredResult(_0x102e5b,_0xa7c18b){return function(_0x325fba){if(_0x325fba){var _0x4b0a95=typeof _0xa7c18b['offset']===_0xd4de('0x1d')&&typeof _0xa7c18b[_0xd4de('0x1e')]===_0xd4de('0x1d');var _0x428aa2=_0x325fba['count'];var _0x4d0df6=_0x4b0a95?0x0:_0xa7c18b[_0xd4de('0x1f')];var _0x54b757=_0x4b0a95?_0x325fba[_0xd4de('0x20')]:_0xa7c18b[_0xd4de('0x1f')]+_0xa7c18b['limit'];var _0xc15081;if(_0x54b757>=_0x428aa2){_0x54b757=_0x428aa2;_0xc15081=0xc8;}else{_0xc15081=0xce;}_0x102e5b['status'](_0xc15081);return _0x102e5b[_0xd4de('0x21')](_0xd4de('0x22'),_0x4d0df6+'-'+_0x54b757+'/'+_0x428aa2)[_0xd4de('0x1c')](_0x325fba);}return null;};}function patchUpdates(_0x8e8712){return function(_0x5368f5){try{jsonpatch[_0xd4de('0x23')](_0x5368f5,_0x8e8712,!![]);}catch(_0x47311c){return BPromise[_0xd4de('0x24')](_0x47311c);}return _0x5368f5[_0xd4de('0x25')]();};}function saveUpdates(_0x1c631a,_0x2d092a){return function(_0x1561fd){if(_0x1561fd){return _0x1561fd[_0xd4de('0x26')](_0x1c631a)[_0xd4de('0x27')](function(_0x413f68){return _0x413f68;});}return null;};}function removeEntity(_0x534b37,_0xad333f){return function(_0x88a0b9){if(_0x88a0b9){return _0x88a0b9[_0xd4de('0x28')]()[_0xd4de('0x27')](function(){_0x534b37[_0xd4de('0x1a')](0xcc)[_0xd4de('0x1b')]();});}};}function handleEntityNotFound(_0xffe1cc,_0x36308c){return function(_0x2aa82a){if(!_0x2aa82a){_0xffe1cc[_0xd4de('0x19')](0x194);}return _0x2aa82a;};}function handleError(_0x2ea712,_0xb2d8a1){_0xb2d8a1=_0xb2d8a1||0x1f4;return function(_0x586126){logger[_0xd4de('0x29')](_0x586126[_0xd4de('0x2a')]);if(_0x586126['name']){delete _0x586126[_0xd4de('0x2b')];}_0x2ea712['status'](_0xb2d8a1)[_0xd4de('0x2c')](_0x586126);};}exports[_0xd4de('0x2d')]=function(_0x15d2b7,_0x4fa53a){var _0xd4de93={},_0x36f2f1={},_0x17f0a={'count':0x0,'rows':[]};var _0x50cb73=_[_0xd4de('0x2e')](db[_0xd4de('0x2f')]['rawAttributes'],function(_0x5103b5){return{'name':_0x5103b5['fieldName'],'type':_0x5103b5[_0xd4de('0x30')]['key']};});_0x36f2f1[_0xd4de('0x31')]=_[_0xd4de('0x2e')](_0x50cb73,_0xd4de('0x2b'));_0x36f2f1[_0xd4de('0x32')]=_['keys'](_0x15d2b7[_0xd4de('0x32')]);_0x36f2f1[_0xd4de('0x33')]=_['intersection'](_0x36f2f1[_0xd4de('0x31')],_0x36f2f1[_0xd4de('0x32')]);_0xd4de93['attributes']=_['intersection'](_0x36f2f1[_0xd4de('0x31')],qs[_0xd4de('0x34')](_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x34')]));_0xd4de93['attributes']=_0xd4de93[_0xd4de('0x35')][_0xd4de('0x36')]?_0xd4de93['attributes']:_0x36f2f1[_0xd4de('0x31')];if(!_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x37')](_0xd4de('0x38'))){_0xd4de93[_0xd4de('0x1e')]=qs[_0xd4de('0x1e')](_0x15d2b7['query']['limit']);_0xd4de93[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x15d2b7[_0xd4de('0x32')]['offset']);}_0xd4de93[_0xd4de('0x39')]=qs[_0xd4de('0x3a')](_0x15d2b7['query'][_0xd4de('0x3a')]);_0xd4de93[_0xd4de('0x3b')]=qs[_0xd4de('0x33')](_[_0xd4de('0x3c')](_0x15d2b7['query'],_0x36f2f1['filters']),_0x50cb73);if(_0x15d2b7[_0xd4de('0x32')]['filter']){_0xd4de93[_0xd4de('0x3b')]=_['merge'](_0xd4de93[_0xd4de('0x3b')],{'$or':_[_0xd4de('0x2e')](_0x50cb73,function(_0x21cd77){if(_0x21cd77[_0xd4de('0x30')]!=='VIRTUAL'){var _0x21209d={};_0x21209d[_0x21cd77['name']]={'$like':'%'+_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x3d')]+'%'};return _0x21209d;}})});}_0xd4de93=_[_0xd4de('0x3e')]({},_0xd4de93,_0x15d2b7[_0xd4de('0x3f')]);var _0x349c5f={'where':_0xd4de93[_0xd4de('0x3b')]};return db[_0xd4de('0x2f')]['count'](_0x349c5f)[_0xd4de('0x27')](function(_0x1eb001){_0x17f0a[_0xd4de('0x20')]=_0x1eb001;if(_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x40')]){_0xd4de93['include']=[{'all':!![]}];}return db[_0xd4de('0x2f')][_0xd4de('0x41')](_0xd4de93);})[_0xd4de('0x27')](function(_0x593ee9){_0x17f0a[_0xd4de('0x42')]=_0x593ee9;return _0x17f0a;})[_0xd4de('0x27')](respondWithFilteredResult(_0x4fa53a,_0xd4de93))[_0xd4de('0x43')](handleError(_0x4fa53a,null));};exports['show']=function(_0x3b9026,_0x10a42c){var _0x419c49={'raw':![],'where':{'id':_0x3b9026[_0xd4de('0x44')]['id']}},_0x3f1e22={};_0x3f1e22[_0xd4de('0x31')]=_[_0xd4de('0x45')](db['ZendeskAccount'][_0xd4de('0x46')]);_0x3f1e22[_0xd4de('0x32')]=_[_0xd4de('0x45')](_0x3b9026['query']);_0x3f1e22[_0xd4de('0x33')]=_[_0xd4de('0x47')](_0x3f1e22[_0xd4de('0x31')],_0x3f1e22['query']);_0x419c49['attributes']=_[_0xd4de('0x47')](_0x3f1e22[_0xd4de('0x31')],qs['fields'](_0x3b9026[_0xd4de('0x32')][_0xd4de('0x34')]));_0x419c49[_0xd4de('0x35')]=_0x419c49[_0xd4de('0x35')]['length']?_0x419c49[_0xd4de('0x35')]:_0x3f1e22[_0xd4de('0x31')];if(_0x3b9026[_0xd4de('0x32')][_0xd4de('0x40')]){_0x419c49[_0xd4de('0x48')]=[{'all':!![]}];}_0x419c49=_[_0xd4de('0x3e')]({},_0x419c49,_0x3b9026['options']);return db[_0xd4de('0x2f')][_0xd4de('0x49')](_0x419c49)[_0xd4de('0x27')](handleEntityNotFound(_0x10a42c,null))[_0xd4de('0x27')](respondWithResult(_0x10a42c,null))[_0xd4de('0x43')](handleError(_0x10a42c,null));};exports[_0xd4de('0x4a')]=function(_0x40bf55,_0x425a7e){return db[_0xd4de('0x2f')][_0xd4de('0x4a')](_0x40bf55['body'],{})[_0xd4de('0x27')](respondWithResult(_0x425a7e,0xc9))[_0xd4de('0x43')](handleError(_0x425a7e,null));};exports[_0xd4de('0x26')]=function(_0x518bfe,_0x13a900){if(_0x518bfe[_0xd4de('0x4b')]['id']){delete _0x518bfe[_0xd4de('0x4b')]['id'];}return db[_0xd4de('0x2f')][_0xd4de('0x49')]({'where':{'id':_0x518bfe[_0xd4de('0x44')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x13a900,null))[_0xd4de('0x27')](saveUpdates(_0x518bfe[_0xd4de('0x4b')],null))[_0xd4de('0x27')](respondWithResult(_0x13a900,null))['catch'](handleError(_0x13a900,null));};exports[_0xd4de('0x28')]=function(_0x26d032,_0x215f85){return db[_0xd4de('0x2f')][_0xd4de('0x49')]({'where':{'id':_0x26d032['params']['id']}})['then'](handleEntityNotFound(_0x215f85,null))[_0xd4de('0x27')](removeEntity(_0x215f85,null))[_0xd4de('0x43')](handleError(_0x215f85,null));};exports['getConfigurations']=function(_0x48cb7d,_0x2d8589,_0x368081){var _0x377376={};var _0x199440={};var _0x34d772;var _0x15c8cd;return db[_0xd4de('0x2f')][_0xd4de('0x4c')]({'where':{'id':_0x48cb7d[_0xd4de('0x44')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x2d8589,null))[_0xd4de('0x27')](function(_0x2e1780){if(_0x2e1780){_0x34d772=_0x2e1780;_0x199440['model']=_[_0xd4de('0x45')](db[_0xd4de('0x4d')][_0xd4de('0x46')]);_0x199440[_0xd4de('0x32')]=_[_0xd4de('0x45')](_0x48cb7d[_0xd4de('0x32')]);_0x199440['filters']=_[_0xd4de('0x47')](_0x199440['model'],_0x199440['query']);_0x377376[_0xd4de('0x35')]=_[_0xd4de('0x47')](_0x199440[_0xd4de('0x31')],qs[_0xd4de('0x34')](_0x48cb7d['query'][_0xd4de('0x34')]));_0x377376[_0xd4de('0x35')]=_0x377376[_0xd4de('0x35')][_0xd4de('0x36')]?_0x377376[_0xd4de('0x35')]:_0x199440['model'];_0x377376['order']=qs['sort'](_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x3a')]);_0x377376[_0xd4de('0x3b')]=qs[_0xd4de('0x33')](_['pick'](_0x48cb7d[_0xd4de('0x32')],_0x199440[_0xd4de('0x33')]));if(_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x3d')]){_0x377376['where']=_[_0xd4de('0x3e')](_0x377376[_0xd4de('0x3b')],{'$or':_[_0xd4de('0x2e')](_0x377376[_0xd4de('0x35')],function(_0x598b60){var _0x4fd7c2={};_0x4fd7c2[_0x598b60]={'$like':'%'+_0x48cb7d['query'][_0xd4de('0x3d')]+'%'};return _0x4fd7c2;})});}_0x377376=_[_0xd4de('0x3e')]({},_0x377376,_0x48cb7d[_0xd4de('0x3f')]);return _0x34d772['getConfigurations'](_0x377376);}})[_0xd4de('0x27')](function(_0x3005c2){if(_0x3005c2){_0x15c8cd=_0x3005c2[_0xd4de('0x36')];if(!_0x48cb7d['query'][_0xd4de('0x37')]('nolimit')){_0x377376[_0xd4de('0x1e')]=qs[_0xd4de('0x1e')](_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x1e')]);_0x377376[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x1f')]);}return _0x34d772['getConfigurations'](_0x377376);}})[_0xd4de('0x27')](function(_0x59f9d9){if(_0x59f9d9){return _0x59f9d9?{'count':_0x15c8cd,'rows':_0x59f9d9}:null;}})[_0xd4de('0x27')](respondWithResult(_0x2d8589,null))[_0xd4de('0x43')](handleError(_0x2d8589,null));};exports['addConfiguration']=function(_0x29c840,_0xb366b0,_0x21f7f7){if(_0x29c840[_0xd4de('0x4b')]['id']){delete _0x29c840[_0xd4de('0x4b')]['id'];}return db[_0xd4de('0x2f')][_0xd4de('0x4c')]({'where':{'id':_0x29c840[_0xd4de('0x44')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0xb366b0,null))[_0xd4de('0x27')](function(_0x1e7e93){if(_0x1e7e93){_0x29c840[_0xd4de('0x4b')][_0xd4de('0x4e')]=_0x1e7e93['id'];_0x29c840['body'][_0xd4de('0x4f')]=integrations[_0xd4de('0x50')](_0x29c840[_0xd4de('0x4b')][_0xd4de('0x51')],_0x29c840[_0xd4de('0x4b')][_0xd4de('0x30')]);_0x29c840[_0xd4de('0x4b')][_0xd4de('0x52')]=integrations['getDescriptions'](_0x29c840[_0xd4de('0x4b')]['channel'],_0x29c840['body']['type']);return db[_0xd4de('0x4d')][_0xd4de('0x4a')](_0x29c840['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0xd4de('0x52')}]});}return null;})['then'](respondWithResult(_0xb366b0,null))[_0xd4de('0x43')](handleError(_0xb366b0,null));};exports['getFields']=function(_0x1a0e6c,_0x223b1a,_0x4ee475){var _0x5df891='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x1a0e6c[_0xd4de('0x44')]['id']},'attributes':['id',_0xd4de('0x53'),_0xd4de('0x54'),_0xd4de('0x55'),_0xd4de('0x56'),_0xd4de('0x57')]})['then'](handleEntityNotFound(_0x223b1a,null))['then'](function(_0x53cbd9){if(_0x53cbd9){_0x5df891=_0x53cbd9[_0xd4de('0x57')];var _0x2bb19d=_0x5df891['slice'](-0x1);if(_0x2bb19d==='/'){_0x5df891=_0x5df891[_0xd4de('0x58')](0x0,_0x5df891['lastIndexOf'](_0x2bb19d));}var _0x1bc101={'method':'GET','uri':util[_0xd4de('0x59')](_0xd4de('0x5a'),_0x5df891,'ticket_fields'),'json':!![]};switch(_0x53cbd9[_0xd4de('0x56')]){case'password':_0x1bc101[_0xd4de('0x5b')]={'Authorization':util[_0xd4de('0x59')](_0xd4de('0x5c'),new Buffer(util[_0xd4de('0x59')]('%s:%s',_0x53cbd9[_0xd4de('0x53')],_0x53cbd9[_0xd4de('0x54')]))[_0xd4de('0x5d')](_0xd4de('0x5e')))};break;case _0xd4de('0x55'):_0x1bc101[_0xd4de('0x5b')]={'Authorization':util[_0xd4de('0x59')](_0xd4de('0x5c'),new Buffer(util[_0xd4de('0x59')](_0xd4de('0x5f'),_0x53cbd9[_0xd4de('0x53')],_0x53cbd9[_0xd4de('0x55')]))[_0xd4de('0x5d')]('base64'))};break;default:throw new db[(_0xd4de('0x60'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x1bc101);}})[_0xd4de('0x27')](function(_0x595ee){if(_0x595ee){var _0x5f197d=[_0xd4de('0x61'),_0xd4de('0x62'),_0xd4de('0x63'),_0xd4de('0x64')];_['remove'](_0x595ee[_0xd4de('0x65')],function(_0xee18fc){return _0x5f197d[_0xd4de('0x66')](_0xee18fc[_0xd4de('0x30')]);});return{'count':_0x595ee[_0xd4de('0x65')]['length'],'rows':_['map'](_0x595ee['ticket_fields'],function(_0x4a2467){return{'id':_0x4a2467['id'],'name':_0x4a2467[_0xd4de('0x67')]>0x7?_0x4a2467['title']:_0x4a2467[_0xd4de('0x30')],'custom':_0x4a2467['position']>0x7?!![]:![],'options':_0x4a2467[_0xd4de('0x68')]?_0x4a2467[_0xd4de('0x68')]:_0x4a2467[_0xd4de('0x69')]?_0x4a2467[_0xd4de('0x69')]:[]};})};}})[_0xd4de('0x27')](respondWithResult(_0x223b1a,null))[_0xd4de('0x43')](function(_0x15f056){var _0x31b518=_0x1a0e6c['query'][_0xd4de('0x6a')]?0x1f4:_0x15f056[_0xd4de('0x6b')]||0x1f4;logger[_0xd4de('0x29')](_0xd4de('0x6c'),'getFields',_0x31b518,JSON[_0xd4de('0x6d')](_0x15f056));delete _0x15f056[_0xd4de('0x2b')];if(_0x31b518===0x191){_0x31b518=0x190;}_0x223b1a['status'](_0x31b518)[_0xd4de('0x2c')](_0x1a0e6c[_0xd4de('0x32')][_0xd4de('0x6a')]?{'message':_0xd4de('0x6e'),'statusCode':_0x15f056[_0xd4de('0x6b')]}:_0x15f056);});}; \ No newline at end of file +var _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x1f75bb,_0x4cc9ed){var _0x14b2b2=function(_0x1e3e93){while(--_0x1e3e93){_0x1f75bb['push'](_0x1f75bb['shift']());}};_0x14b2b2(++_0x4cc9ed);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7487b70..171e118 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 _0x4bdb=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x2bf33d,_0x495e20){var _0x16c45a=function(_0x47039f){while(--_0x47039f){_0x2bf33d['push'](_0x2bf33d['shift']());}};_0x16c45a(++_0x495e20);}(_0x4bdb,0xcd));var _0xb4bd=function(_0x185d3c,_0xed2dbf){_0x185d3c=_0x185d3c-0x0;var _0x4ce7b1=_0x4bdb[_0x185d3c];return _0x4ce7b1;};'use strict';var _=require(_0xb4bd('0x0'));var util=require(_0xb4bd('0x1'));var logger=require(_0xb4bd('0x2'))(_0xb4bd('0x3'));var moment=require('moment');var BPromise=require(_0xb4bd('0x4'));var rp=require(_0xb4bd('0x5'));var fs=require('fs');var path=require(_0xb4bd('0x6'));var rimraf=require(_0xb4bd('0x7'));var config=require(_0xb4bd('0x8'));var attributes=require(_0xb4bd('0x9'));var integrations=require(_0xb4bd('0xa'));module[_0xb4bd('0xb')]=function(_0x4fc433,_0x8f60d9){return _0x4fc433[_0xb4bd('0xc')](_0xb4bd('0xd'),attributes,{'tableName':_0xb4bd('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0162=['ZendeskAccount','int_zendesk_accounts','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2a5c46,_0x3dd3cd){var _0x25dc89=function(_0xd73b2b){while(--_0xd73b2b){_0x2a5c46['push'](_0x2a5c46['shift']());}};_0x25dc89(++_0x3dd3cd);}(_0x0162,0x13a));var _0x2016=function(_0x5b7c62,_0x25327d){_0x5b7c62=_0x5b7c62-0x0;var _0x5292fc=_0x0162[_0x5b7c62];return _0x5292fc;};'use strict';var _=require(_0x2016('0x0'));var util=require(_0x2016('0x1'));var logger=require('../../config/logger')(_0x2016('0x2'));var moment=require('moment');var BPromise=require(_0x2016('0x3'));var rp=require(_0x2016('0x4'));var fs=require('fs');var path=require(_0x2016('0x5'));var rimraf=require('rimraf');var config=require(_0x2016('0x6'));var attributes=require(_0x2016('0x7'));var integrations=require(_0x2016('0x8'));module[_0x2016('0x9')]=function(_0x179d81,_0x127f4d){return _0x179d81['define'](_0x2016('0xa'),attributes,{'tableName':_0x2016('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index d33455f..242f4d2 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 _0x272f=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','lodash','util','bluebird','randomstring'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x272f,0x1bc));var _0xf272=function(_0x4332cf,_0x370320){_0x4332cf=_0x4332cf-0x0;var _0x171371=_0x272f[_0x4332cf];return _0x171371;};'use strict';var _=require(_0xf272('0x0'));var util=require(_0xf272('0x1'));var moment=require('moment');var BPromise=require(_0xf272('0x2'));var rs=require(_0xf272('0x3'));var fs=require('fs');var Redis=require(_0xf272('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf272('0x5'));var logger=require(_0xf272('0x6'))(_0xf272('0x7'));var config=require('../../config/environment');var jayson=require(_0xf272('0x8'));var client=jayson[_0xf272('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b4630,_0x20ebf8,_0x1bd78c){return new BPromise(function(_0x209bd5,_0x102def){return client[_0xf272('0xa')](_0x4b4630,_0x1bd78c)[_0xf272('0xb')](function(_0x212a96){logger[_0xf272('0xc')](_0xf272('0xd'),_0x20ebf8,'request\x20sent');logger[_0xf272('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x20ebf8,_0xf272('0xf'),JSON[_0xf272('0x10')](_0x212a96));if(_0x212a96['error']){if(_0x212a96['error'][_0xf272('0x11')]===0x1f4){logger['error'](_0xf272('0xd'),_0x20ebf8,_0x212a96[_0xf272('0x12')][_0xf272('0x13')]);return _0x102def(_0x212a96['error']['message']);}logger[_0xf272('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x20ebf8,_0x212a96[_0xf272('0x12')][_0xf272('0x13')]);return _0x209bd5(_0x212a96[_0xf272('0x12')][_0xf272('0x13')]);}else{logger[_0xf272('0xc')](_0xf272('0xd'),_0x20ebf8,'request\x20sent');_0x209bd5(_0x212a96[_0xf272('0x14')][_0xf272('0x13')]);}})[_0xf272('0x15')](function(_0x4e7d7d){logger[_0xf272('0x12')](_0xf272('0xd'),_0x20ebf8,_0x4e7d7d);_0x102def(_0x4e7d7d);});});}exports[_0xf272('0x16')]=function(_0x252fb6){var _0x10f016=this;return new Promise(function(_0x77bb0a,_0x216b3d){return db[_0xf272('0x17')]['findAll']({'raw':_0x252fb6['options']?_0x252fb6[_0xf272('0x18')][_0xf272('0x19')]===undefined?!![]:![]:!![],'where':_0x252fb6['options']?_0x252fb6[_0xf272('0x18')]['where']||null:null,'attributes':_0x252fb6['options']?_0x252fb6[_0xf272('0x18')][_0xf272('0x1a')]||null:null,'limit':_0x252fb6[_0xf272('0x18')]?_0x252fb6['options'][_0xf272('0x1b')]||null:null,'include':_0x252fb6[_0xf272('0x18')]?_0x252fb6[_0xf272('0x18')][_0xf272('0x1c')]?_[_0xf272('0x1d')](_0x252fb6['options']['include'],function(_0xf89ad3){return{'model':db[_0xf89ad3[_0xf272('0x1e')]],'as':_0xf89ad3['as'],'attributes':_0xf89ad3[_0xf272('0x1a')],'include':_0xf89ad3['include']?_[_0xf272('0x1d')](_0xf89ad3[_0xf272('0x1c')],function(_0x5db18e){return{'model':db[_0x5db18e[_0xf272('0x1e')]],'as':_0x5db18e['as'],'attributes':_0x5db18e[_0xf272('0x1a')],'include':_0x5db18e[_0xf272('0x1c')]?_[_0xf272('0x1d')](_0x5db18e['include'],function(_0x4b5e4e){return{'model':db[_0x4b5e4e[_0xf272('0x1e')]],'as':_0x4b5e4e['as'],'attributes':_0x4b5e4e[_0xf272('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf272('0xb')](function(_0x53e571){logger[_0xf272('0xc')](_0xf272('0x16'),_0x252fb6);logger[_0xf272('0xe')](_0xf272('0x16'),_0x252fb6,JSON[_0xf272('0x10')](_0x53e571));_0x77bb0a(_0x53e571);})[_0xf272('0x15')](function(_0x187df2){logger['error'](_0xf272('0x16'),_0x187df2[_0xf272('0x13')],_0x252fb6);_0x216b3d(_0x10f016[_0xf272('0x12')](0x1f4,_0x187df2[_0xf272('0x13')]));});});};exports[_0xf272('0x1f')]=function(_0x48205c){var _0x59c71e=this;return new Promise(function(_0x37dbca,_0x27bf20){return db['ZendeskAccount']['find']({'raw':_0x48205c[_0xf272('0x18')]?_0x48205c['options']['raw']===undefined?!![]:![]:!![],'where':_0x48205c[_0xf272('0x18')]?_0x48205c[_0xf272('0x18')]['where']||null:null,'attributes':_0x48205c[_0xf272('0x18')]?_0x48205c[_0xf272('0x18')][_0xf272('0x1a')]||null:null,'include':_0x48205c[_0xf272('0x18')]?_0x48205c[_0xf272('0x18')]['include']?_[_0xf272('0x1d')](_0x48205c[_0xf272('0x18')]['include'],function(_0x8a629f){return{'model':db[_0x8a629f[_0xf272('0x1e')]],'as':_0x8a629f['as'],'attributes':_0x8a629f[_0xf272('0x1a')],'include':_0x8a629f[_0xf272('0x1c')]?_['map'](_0x8a629f[_0xf272('0x1c')],function(_0x22d128){return{'model':db[_0x22d128[_0xf272('0x1e')]],'as':_0x22d128['as'],'attributes':_0x22d128[_0xf272('0x1a')],'include':_0x22d128[_0xf272('0x1c')]?_[_0xf272('0x1d')](_0x22d128['include'],function(_0x4b6a44){return{'model':db[_0x4b6a44[_0xf272('0x1e')]],'as':_0x4b6a44['as'],'attributes':_0x4b6a44['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd0de85){logger[_0xf272('0xc')]('ShowZendeskAccount',_0x48205c);logger[_0xf272('0xe')](_0xf272('0x1f'),_0x48205c,JSON[_0xf272('0x10')](_0xd0de85));_0x37dbca(_0xd0de85);})['catch'](function(_0x171f6e){logger[_0xf272('0x12')](_0xf272('0x1f'),_0x171f6e['message'],_0x48205c);_0x27bf20(_0x59c71e[_0xf272('0x12')](0x1f4,_0x171f6e[_0xf272('0x13')]));});});}; \ No newline at end of file +var _0xfb64=['attributes','map','model','include','ZendeskAccount','find','raw','ShowZendeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','findAll','options','where'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xfb64,0x17b));var _0x4fb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb64[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4fb6('0x0'));var util=require(_0x4fb6('0x1'));var moment=require(_0x4fb6('0x2'));var BPromise=require(_0x4fb6('0x3'));var rs=require(_0x4fb6('0x4'));var fs=require('fs');var Redis=require(_0x4fb6('0x5'));var db=require(_0x4fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fb6('0x7'))(_0x4fb6('0x8'));var config=require(_0x4fb6('0x9'));var jayson=require(_0x4fb6('0xa'));var client=jayson[_0x4fb6('0xb')][_0x4fb6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b7453,_0x12b028,_0x21eff1){return new BPromise(function(_0x41b765,_0x72d841){return client[_0x4fb6('0xd')](_0x3b7453,_0x21eff1)[_0x4fb6('0xe')](function(_0x3ca701){logger[_0x4fb6('0xf')](_0x4fb6('0x10'),_0x12b028,_0x4fb6('0x11'));logger[_0x4fb6('0x12')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x12b028,_0x4fb6('0x11'),JSON[_0x4fb6('0x13')](_0x3ca701));if(_0x3ca701[_0x4fb6('0x14')]){if(_0x3ca701[_0x4fb6('0x14')][_0x4fb6('0x15')]===0x1f4){logger['error'](_0x4fb6('0x10'),_0x12b028,_0x3ca701[_0x4fb6('0x14')][_0x4fb6('0x16')]);return _0x72d841(_0x3ca701['error']['message']);}logger['error'](_0x4fb6('0x10'),_0x12b028,_0x3ca701[_0x4fb6('0x14')][_0x4fb6('0x16')]);return _0x41b765(_0x3ca701['error'][_0x4fb6('0x16')]);}else{logger[_0x4fb6('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x12b028,_0x4fb6('0x11'));_0x41b765(_0x3ca701[_0x4fb6('0x17')][_0x4fb6('0x16')]);}})['catch'](function(_0x3db82c){logger[_0x4fb6('0x14')](_0x4fb6('0x10'),_0x12b028,_0x3db82c);_0x72d841(_0x3db82c);});});}exports[_0x4fb6('0x18')]=function(_0x220738){var _0x29b3bd=this;return new Promise(function(_0x17a602,_0x4d85e3){return db['ZendeskAccount'][_0x4fb6('0x19')]({'raw':_0x220738['options']?_0x220738[_0x4fb6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x220738[_0x4fb6('0x1a')]?_0x220738[_0x4fb6('0x1a')][_0x4fb6('0x1b')]||null:null,'attributes':_0x220738[_0x4fb6('0x1a')]?_0x220738[_0x4fb6('0x1a')][_0x4fb6('0x1c')]||null:null,'limit':_0x220738['options']?_0x220738[_0x4fb6('0x1a')]['limit']||null:null,'include':_0x220738['options']?_0x220738[_0x4fb6('0x1a')]['include']?_[_0x4fb6('0x1d')](_0x220738[_0x4fb6('0x1a')]['include'],function(_0x39f0ff){return{'model':db[_0x39f0ff['model']],'as':_0x39f0ff['as'],'attributes':_0x39f0ff[_0x4fb6('0x1c')],'include':_0x39f0ff['include']?_[_0x4fb6('0x1d')](_0x39f0ff['include'],function(_0x35c2ae){return{'model':db[_0x35c2ae[_0x4fb6('0x1e')]],'as':_0x35c2ae['as'],'attributes':_0x35c2ae[_0x4fb6('0x1c')],'include':_0x35c2ae[_0x4fb6('0x1f')]?_[_0x4fb6('0x1d')](_0x35c2ae[_0x4fb6('0x1f')],function(_0x28273b){return{'model':db[_0x28273b[_0x4fb6('0x1e')]],'as':_0x28273b['as'],'attributes':_0x28273b[_0x4fb6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4fb6('0xe')](function(_0x3934af){logger[_0x4fb6('0xf')]('GetZendeskAccount',_0x220738);logger[_0x4fb6('0x12')](_0x4fb6('0x18'),_0x220738,JSON['stringify'](_0x3934af));_0x17a602(_0x3934af);})['catch'](function(_0x4821ca){logger[_0x4fb6('0x14')]('GetZendeskAccount',_0x4821ca[_0x4fb6('0x16')],_0x220738);_0x4d85e3(_0x29b3bd[_0x4fb6('0x14')](0x1f4,_0x4821ca[_0x4fb6('0x16')]));});});};exports['ShowZendeskAccount']=function(_0x53d36e){var _0x4819ec=this;return new Promise(function(_0x3ce857,_0x1e9566){return db[_0x4fb6('0x20')][_0x4fb6('0x21')]({'raw':_0x53d36e[_0x4fb6('0x1a')]?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x22')]===undefined?!![]:![]:!![],'where':_0x53d36e['options']?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x1b')]||null:null,'attributes':_0x53d36e['options']?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x1c')]||null:null,'include':_0x53d36e[_0x4fb6('0x1a')]?_0x53d36e[_0x4fb6('0x1a')][_0x4fb6('0x1f')]?_[_0x4fb6('0x1d')](_0x53d36e[_0x4fb6('0x1a')]['include'],function(_0x18fcd5){return{'model':db[_0x18fcd5[_0x4fb6('0x1e')]],'as':_0x18fcd5['as'],'attributes':_0x18fcd5[_0x4fb6('0x1c')],'include':_0x18fcd5[_0x4fb6('0x1f')]?_[_0x4fb6('0x1d')](_0x18fcd5[_0x4fb6('0x1f')],function(_0x335286){return{'model':db[_0x335286[_0x4fb6('0x1e')]],'as':_0x335286['as'],'attributes':_0x335286[_0x4fb6('0x1c')],'include':_0x335286[_0x4fb6('0x1f')]?_['map'](_0x335286['include'],function(_0x3e7d86){return{'model':db[_0x3e7d86[_0x4fb6('0x1e')]],'as':_0x3e7d86['as'],'attributes':_0x3e7d86['attributes']};}):[]};}):[]};}):[]:[]})[_0x4fb6('0xe')](function(_0x1d0e3d){logger['info'](_0x4fb6('0x23'),_0x53d36e);logger[_0x4fb6('0x12')](_0x4fb6('0x23'),_0x53d36e,JSON[_0x4fb6('0x13')](_0x1d0e3d));_0x3ce857(_0x1d0e3d);})[_0x4fb6('0x24')](function(_0x5c3caf){logger[_0x4fb6('0x14')](_0x4fb6('0x23'),_0x5c3caf[_0x4fb6('0x16')],_0x53d36e);_0x1e9566(_0x4819ec['error'](0x1f4,_0x5c3caf[_0x4fb6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index af8eef5..1bbaba9 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 _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(_0x2a6ad0,_0x23ad94){var _0x230d3a=function(_0x108bf0){while(--_0x108bf0){_0x2a6ad0['push'](_0x2a6ad0['shift']());}};_0x230d3a(++_0x23ad94);}(_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['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 +var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4f8942,_0x586651){var _0x6310b9=function(_0x2d429d){while(--_0x2d429d){_0x4f8942['push'](_0x4f8942['shift']());}};_0x6310b9(++_0x586651);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xe5b5[_0x1646fa];return _0x5a47a5;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('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 d412ef2..6628bfc 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 _0x2e06=['sequelize','exports','STRING'];(function(_0x1e943d,_0x2362fd){var _0x537f29=function(_0x297b56){while(--_0x297b56){_0x1e943d['push'](_0x1e943d['shift']());}};_0x537f29(++_0x2362fd);}(_0x2e06,0x8d));var _0x62e0=function(_0x5ded2a,_0x2b3e6a){_0x5ded2a=_0x5ded2a-0x0;var _0x403110=_0x2e06[_0x5ded2a];return _0x403110;};'use strict';var Sequelize=require(_0x62e0('0x0'));module[_0x62e0('0x1')]={'name':{'type':Sequelize[_0x62e0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0aa=['sequelize','exports'];(function(_0x2b8d9e,_0x38f52a){var _0x380e14=function(_0xfc9680){while(--_0xfc9680){_0x2b8d9e['push'](_0x2b8d9e['shift']());}};_0x380e14(++_0x38f52a);}(_0xe0aa,0xa2));var _0xae0a=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xe0aa[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xae0a('0x0'));module[_0xae0a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 47d8595..de2db89 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 _0xfd84=['catch','show','params','rawAttributes','include','find','create','body','ZendeskField','findOne','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','ZendeskConfiguration','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows'];(function(_0x5263b8,_0x5f4243){var _0x45ef8a=function(_0x175f26){while(--_0x175f26){_0x5263b8['push'](_0x5263b8['shift']());}};_0x45ef8a(++_0x5f4243);}(_0xfd84,0xb7));var _0x4fd8=function(_0x25a44a,_0x1564ac){_0x25a44a=_0x25a44a-0x0;var _0x265bcd=_0xfd84[_0x25a44a];return _0x265bcd;};'use strict';var emlformat=require(_0x4fd8('0x0'));var rimraf=require(_0x4fd8('0x1'));var zipdir=require(_0x4fd8('0x2'));var jsonpatch=require(_0x4fd8('0x3'));var rp=require(_0x4fd8('0x4'));var moment=require('moment');var BPromise=require(_0x4fd8('0x5'));var Mustache=require(_0x4fd8('0x6'));var util=require(_0x4fd8('0x7'));var path=require(_0x4fd8('0x8'));var sox=require(_0x4fd8('0x9'));var csv=require(_0x4fd8('0xa'));var ejs=require(_0x4fd8('0xb'));var fs=require('fs');var fs_extra=require(_0x4fd8('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4fd8('0xd'));var jsforce=require(_0x4fd8('0xe'));var deskjs=require(_0x4fd8('0xf'));var toCsv=require(_0x4fd8('0xa'));var querystring=require(_0x4fd8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4fd8('0x11'));var qs=require(_0x4fd8('0x12'));var as=require(_0x4fd8('0x13'));var hardwareService=require(_0x4fd8('0x14'));var logger=require(_0x4fd8('0x15'))(_0x4fd8('0x16'));var utils=require(_0x4fd8('0x17'));var config=require(_0x4fd8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fd8('0x19'))['db'];function respondWithStatusCode(_0x452435,_0x377121){_0x377121=_0x377121||0xcc;return function(_0x521925){if(_0x521925){return _0x452435['sendStatus'](_0x377121);}return _0x452435[_0x4fd8('0x1a')](_0x377121)[_0x4fd8('0x1b')]();};}function respondWithResult(_0x7c1337,_0x144bb7){_0x144bb7=_0x144bb7||0xc8;return function(_0x30bb77){if(_0x30bb77){return _0x7c1337[_0x4fd8('0x1a')](_0x144bb7)[_0x4fd8('0x1c')](_0x30bb77);}};}function respondWithFilteredResult(_0x49b06b,_0x484a19){return function(_0x22dc63){if(_0x22dc63){var _0x1f6d99=typeof _0x484a19[_0x4fd8('0x1d')]==='undefined'&&typeof _0x484a19[_0x4fd8('0x1e')]===_0x4fd8('0x1f');var _0x2cae26=_0x22dc63[_0x4fd8('0x20')];var _0x2825bf=_0x1f6d99?0x0:_0x484a19['offset'];var _0x398966=_0x1f6d99?_0x22dc63[_0x4fd8('0x20')]:_0x484a19['offset']+_0x484a19[_0x4fd8('0x1e')];var _0x17b191;if(_0x398966>=_0x2cae26){_0x398966=_0x2cae26;_0x17b191=0xc8;}else{_0x17b191=0xce;}_0x49b06b[_0x4fd8('0x1a')](_0x17b191);return _0x49b06b[_0x4fd8('0x21')](_0x4fd8('0x22'),_0x2825bf+'-'+_0x398966+'/'+_0x2cae26)[_0x4fd8('0x1c')](_0x22dc63);}return null;};}function patchUpdates(_0x41ccd1){return function(_0x1423ec){try{jsonpatch[_0x4fd8('0x23')](_0x1423ec,_0x41ccd1,!![]);}catch(_0x149e33){return BPromise[_0x4fd8('0x24')](_0x149e33);}return _0x1423ec[_0x4fd8('0x25')]();};}function saveUpdates(_0x33d03b,_0x13a405){return function(_0x4ea46c){if(_0x4ea46c){return _0x4ea46c[_0x4fd8('0x26')](_0x33d03b)['then'](function(_0x3b2e95){return _0x3b2e95;});}return null;};}function removeEntity(_0x24e130,_0x5a39dc){return function(_0x10b5e1){if(_0x10b5e1){return _0x10b5e1[_0x4fd8('0x27')]()[_0x4fd8('0x28')](function(){_0x24e130[_0x4fd8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f23d,_0x42e5c4){return function(_0x43ae5b){if(!_0x43ae5b){_0x15f23d['sendStatus'](0x194);}return _0x43ae5b;};}function handleError(_0x5a2db6,_0x223110){_0x223110=_0x223110||0x1f4;return function(_0x5e5d9b){logger[_0x4fd8('0x29')](_0x5e5d9b[_0x4fd8('0x2a')]);if(_0x5e5d9b[_0x4fd8('0x2b')]){delete _0x5e5d9b[_0x4fd8('0x2b')];}_0x5a2db6[_0x4fd8('0x1a')](_0x223110)[_0x4fd8('0x2c')](_0x5e5d9b);};}exports['index']=function(_0xeaebf,_0x44ee05){var _0x2eec91={},_0x51f8b9={},_0x3a1858={'count':0x0,'rows':[]};var _0x5d4776=_['map'](db[_0x4fd8('0x2d')]['rawAttributes'],function(_0x171cf1){return{'name':_0x171cf1[_0x4fd8('0x2e')],'type':_0x171cf1[_0x4fd8('0x2f')][_0x4fd8('0x30')]};});_0x51f8b9['model']=_[_0x4fd8('0x31')](_0x5d4776,_0x4fd8('0x2b'));_0x51f8b9['query']=_[_0x4fd8('0x32')](_0xeaebf[_0x4fd8('0x33')]);_0x51f8b9[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0x51f8b9[_0x4fd8('0x36')],_0x51f8b9['query']);_0x2eec91[_0x4fd8('0x37')]=_[_0x4fd8('0x35')](_0x51f8b9['model'],qs['fields'](_0xeaebf[_0x4fd8('0x33')][_0x4fd8('0x38')]));_0x2eec91['attributes']=_0x2eec91[_0x4fd8('0x37')][_0x4fd8('0x39')]?_0x2eec91['attributes']:_0x51f8b9['model'];if(!_0xeaebf[_0x4fd8('0x33')]['hasOwnProperty'](_0x4fd8('0x3a'))){_0x2eec91[_0x4fd8('0x1e')]=qs[_0x4fd8('0x1e')](_0xeaebf[_0x4fd8('0x33')]['limit']);_0x2eec91['offset']=qs[_0x4fd8('0x1d')](_0xeaebf['query'][_0x4fd8('0x1d')]);}_0x2eec91[_0x4fd8('0x3b')]=qs[_0x4fd8('0x3c')](_0xeaebf[_0x4fd8('0x33')][_0x4fd8('0x3c')]);_0x2eec91[_0x4fd8('0x3d')]=qs[_0x4fd8('0x34')](_[_0x4fd8('0x3e')](_0xeaebf[_0x4fd8('0x33')],_0x51f8b9['filters']),_0x5d4776);if(_0xeaebf['query'][_0x4fd8('0x3f')]){_0x2eec91[_0x4fd8('0x3d')]=_['merge'](_0x2eec91['where'],{'$or':_[_0x4fd8('0x31')](_0x5d4776,function(_0x4111b6){if(_0x4111b6[_0x4fd8('0x2f')]!==_0x4fd8('0x40')){var _0x5a2d98={};_0x5a2d98[_0x4111b6[_0x4fd8('0x2b')]]={'$like':'%'+_0xeaebf['query'][_0x4fd8('0x3f')]+'%'};return _0x5a2d98;}})});}_0x2eec91=_[_0x4fd8('0x41')]({},_0x2eec91,_0xeaebf[_0x4fd8('0x42')]);var _0x22698f={'where':_0x2eec91[_0x4fd8('0x3d')]};return db[_0x4fd8('0x2d')][_0x4fd8('0x20')](_0x22698f)[_0x4fd8('0x28')](function(_0xee6b4){_0x3a1858['count']=_0xee6b4;if(_0xeaebf[_0x4fd8('0x33')][_0x4fd8('0x43')]){_0x2eec91['include']=[{'all':!![]}];}return db[_0x4fd8('0x2d')]['findAll'](_0x2eec91);})[_0x4fd8('0x28')](function(_0x12b3b8){_0x3a1858[_0x4fd8('0x44')]=_0x12b3b8;return _0x3a1858;})['then'](respondWithFilteredResult(_0x44ee05,_0x2eec91))[_0x4fd8('0x45')](handleError(_0x44ee05,null));};exports[_0x4fd8('0x46')]=function(_0x4912a1,_0x4677c1){var _0x196bd2={'raw':![],'where':{'id':_0x4912a1[_0x4fd8('0x47')]['id']}},_0x11313b={};_0x11313b['model']=_['keys'](db['ZendeskConfiguration'][_0x4fd8('0x48')]);_0x11313b['query']=_[_0x4fd8('0x32')](_0x4912a1['query']);_0x11313b[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0x11313b['model'],_0x11313b['query']);_0x196bd2['attributes']=_[_0x4fd8('0x35')](_0x11313b[_0x4fd8('0x36')],qs['fields'](_0x4912a1[_0x4fd8('0x33')][_0x4fd8('0x38')]));_0x196bd2[_0x4fd8('0x37')]=_0x196bd2[_0x4fd8('0x37')][_0x4fd8('0x39')]?_0x196bd2[_0x4fd8('0x37')]:_0x11313b[_0x4fd8('0x36')];if(_0x4912a1[_0x4fd8('0x33')][_0x4fd8('0x43')]){_0x196bd2[_0x4fd8('0x49')]=[{'all':!![]}];}_0x196bd2=_[_0x4fd8('0x41')]({},_0x196bd2,_0x4912a1[_0x4fd8('0x42')]);return db['ZendeskConfiguration'][_0x4fd8('0x4a')](_0x196bd2)['then'](handleEntityNotFound(_0x4677c1,null))[_0x4fd8('0x28')](respondWithResult(_0x4677c1,null))[_0x4fd8('0x45')](handleError(_0x4677c1,null));};exports[_0x4fd8('0x4b')]=function(_0x54c5fa,_0x168ce8){return db[_0x4fd8('0x2d')][_0x4fd8('0x4b')](_0x54c5fa[_0x4fd8('0x4c')],{})[_0x4fd8('0x28')](respondWithResult(_0x168ce8,0xc9))[_0x4fd8('0x45')](handleError(_0x168ce8,null));};exports[_0x4fd8('0x26')]=function(_0x93b935,_0x4046d6){if(_0x93b935['body']['id']){delete _0x93b935['body']['id'];}return db['ZendeskConfiguration'][_0x4fd8('0x4a')]({'where':{'id':_0x93b935['params']['id']}})[_0x4fd8('0x28')](handleEntityNotFound(_0x4046d6,null))[_0x4fd8('0x28')](saveUpdates(_0x93b935['body'],null))['then'](respondWithResult(_0x4046d6,null))[_0x4fd8('0x45')](handleError(_0x4046d6,null));};exports[_0x4fd8('0x27')]=function(_0x4eab0a,_0x59c7eb){return db[_0x4fd8('0x2d')][_0x4fd8('0x4a')]({'where':{'id':_0x4eab0a[_0x4fd8('0x47')]['id']}})[_0x4fd8('0x28')](handleEntityNotFound(_0x59c7eb,null))[_0x4fd8('0x28')](removeEntity(_0x59c7eb,null))['catch'](handleError(_0x59c7eb,null));};exports['getFields']=function(_0x41810a,_0x317c82,_0x56e5d8){var _0x1f5a62={};var _0x2944ac={};var _0x39863f;var _0x36ea1c;return db[_0x4fd8('0x2d')]['findOne']({'where':{'id':_0x41810a[_0x4fd8('0x47')]['id']}})[_0x4fd8('0x28')](handleEntityNotFound(_0x317c82,null))[_0x4fd8('0x28')](function(_0x115bd8){if(_0x115bd8){_0x39863f=_0x115bd8;_0x2944ac['model']=_[_0x4fd8('0x32')](db[_0x4fd8('0x4d')][_0x4fd8('0x48')]);_0x2944ac[_0x4fd8('0x33')]=_['keys'](_0x41810a[_0x4fd8('0x33')]);_0x2944ac[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0x2944ac['model'],_0x2944ac[_0x4fd8('0x33')]);_0x1f5a62[_0x4fd8('0x37')]=_[_0x4fd8('0x35')](_0x2944ac[_0x4fd8('0x36')],qs[_0x4fd8('0x38')](_0x41810a[_0x4fd8('0x33')][_0x4fd8('0x38')]));_0x1f5a62[_0x4fd8('0x37')]=_0x1f5a62[_0x4fd8('0x37')][_0x4fd8('0x39')]?_0x1f5a62['attributes']:_0x2944ac['model'];_0x1f5a62[_0x4fd8('0x3b')]=qs['sort'](_0x41810a['query']['sort']);_0x1f5a62[_0x4fd8('0x3d')]=qs['filters'](_['pick'](_0x41810a[_0x4fd8('0x33')],_0x2944ac[_0x4fd8('0x34')]));if(_0x41810a[_0x4fd8('0x33')][_0x4fd8('0x3f')]){_0x1f5a62['where']=_[_0x4fd8('0x41')](_0x1f5a62[_0x4fd8('0x3d')],{'$or':_[_0x4fd8('0x31')](_0x1f5a62[_0x4fd8('0x37')],function(_0x62884b){var _0x1f1b06={};_0x1f1b06[_0x62884b]={'$like':'%'+_0x41810a['query'][_0x4fd8('0x3f')]+'%'};return _0x1f1b06;})});}_0x1f5a62=_['merge']({},_0x1f5a62,_0x41810a['options']);return _0x39863f['getFields'](_0x1f5a62);}})['then'](function(_0xbec539){if(_0xbec539){_0x36ea1c=_0xbec539['length'];if(!_0x41810a[_0x4fd8('0x33')]['hasOwnProperty'](_0x4fd8('0x3a'))){_0x1f5a62[_0x4fd8('0x1e')]=qs['limit'](_0x41810a['query'][_0x4fd8('0x1e')]);_0x1f5a62[_0x4fd8('0x1d')]=qs['offset'](_0x41810a[_0x4fd8('0x33')][_0x4fd8('0x1d')]);}return _0x39863f['getFields'](_0x1f5a62);}})[_0x4fd8('0x28')](function(_0x390fe4){if(_0x390fe4){return _0x390fe4?{'count':_0x36ea1c,'rows':_0x390fe4}:null;}})[_0x4fd8('0x28')](respondWithResult(_0x317c82,null))[_0x4fd8('0x45')](handleError(_0x317c82,null));};exports['getSubjects']=function(_0x52ad8c,_0x18917c,_0x4d110b){var _0x38574d={};var _0x266154={};var _0x114299;var _0x49364a;return db[_0x4fd8('0x2d')][_0x4fd8('0x4e')]({'where':{'id':_0x52ad8c[_0x4fd8('0x47')]['id']}})[_0x4fd8('0x28')](handleEntityNotFound(_0x18917c,null))[_0x4fd8('0x28')](function(_0x518b13){if(_0x518b13){_0x114299=_0x518b13;_0x266154[_0x4fd8('0x36')]=_[_0x4fd8('0x32')](db['ZendeskField'][_0x4fd8('0x48')]);_0x266154[_0x4fd8('0x33')]=_[_0x4fd8('0x32')](_0x52ad8c[_0x4fd8('0x33')]);_0x266154[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0x266154[_0x4fd8('0x36')],_0x266154[_0x4fd8('0x33')]);_0x38574d[_0x4fd8('0x37')]=_[_0x4fd8('0x35')](_0x266154[_0x4fd8('0x36')],qs['fields'](_0x52ad8c[_0x4fd8('0x33')][_0x4fd8('0x38')]));_0x38574d[_0x4fd8('0x37')]=_0x38574d[_0x4fd8('0x37')]['length']?_0x38574d['attributes']:_0x266154[_0x4fd8('0x36')];_0x38574d[_0x4fd8('0x3b')]=qs[_0x4fd8('0x3c')](_0x52ad8c[_0x4fd8('0x33')][_0x4fd8('0x3c')]);_0x38574d[_0x4fd8('0x3d')]=qs[_0x4fd8('0x34')](_[_0x4fd8('0x3e')](_0x52ad8c['query'],_0x266154[_0x4fd8('0x34')]));if(_0x52ad8c[_0x4fd8('0x33')][_0x4fd8('0x3f')]){_0x38574d[_0x4fd8('0x3d')]=_[_0x4fd8('0x41')](_0x38574d[_0x4fd8('0x3d')],{'$or':_[_0x4fd8('0x31')](_0x38574d['attributes'],function(_0x3d908a){var _0x5ba159={};_0x5ba159[_0x3d908a]={'$like':'%'+_0x52ad8c[_0x4fd8('0x33')]['filter']+'%'};return _0x5ba159;})});}_0x38574d=_[_0x4fd8('0x41')]({},_0x38574d,_0x52ad8c[_0x4fd8('0x42')]);return _0x114299[_0x4fd8('0x4f')](_0x38574d);}})[_0x4fd8('0x28')](function(_0x341532){if(_0x341532){_0x49364a=_0x341532[_0x4fd8('0x39')];if(!_0x52ad8c['query'][_0x4fd8('0x50')](_0x4fd8('0x3a'))){_0x38574d[_0x4fd8('0x1e')]=qs['limit'](_0x52ad8c[_0x4fd8('0x33')][_0x4fd8('0x1e')]);_0x38574d[_0x4fd8('0x1d')]=qs[_0x4fd8('0x1d')](_0x52ad8c[_0x4fd8('0x33')][_0x4fd8('0x1d')]);}return _0x114299['getSubjects'](_0x38574d);}})[_0x4fd8('0x28')](function(_0x26563e){if(_0x26563e){return _0x26563e?{'count':_0x49364a,'rows':_0x26563e}:null;}})[_0x4fd8('0x28')](respondWithResult(_0x18917c,null))['catch'](handleError(_0x18917c,null));};exports[_0x4fd8('0x51')]=function(_0x228f22,_0x41d7db,_0x4d5840){var _0x3435e3={};var _0x181a01={};var _0x231e7f;var _0x20b3c2;return db[_0x4fd8('0x2d')][_0x4fd8('0x4e')]({'where':{'id':_0x228f22[_0x4fd8('0x47')]['id']}})[_0x4fd8('0x28')](handleEntityNotFound(_0x41d7db,null))[_0x4fd8('0x28')](function(_0x4f5ddb){if(_0x4f5ddb){_0x231e7f=_0x4f5ddb;_0x181a01[_0x4fd8('0x36')]=_[_0x4fd8('0x32')](db['ZendeskField'][_0x4fd8('0x48')]);_0x181a01[_0x4fd8('0x33')]=_['keys'](_0x228f22[_0x4fd8('0x33')]);_0x181a01[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0x181a01[_0x4fd8('0x36')],_0x181a01[_0x4fd8('0x33')]);_0x3435e3[_0x4fd8('0x37')]=_['intersection'](_0x181a01[_0x4fd8('0x36')],qs[_0x4fd8('0x38')](_0x228f22[_0x4fd8('0x33')][_0x4fd8('0x38')]));_0x3435e3[_0x4fd8('0x37')]=_0x3435e3[_0x4fd8('0x37')][_0x4fd8('0x39')]?_0x3435e3[_0x4fd8('0x37')]:_0x181a01[_0x4fd8('0x36')];_0x3435e3[_0x4fd8('0x3b')]=qs[_0x4fd8('0x3c')](_0x228f22['query'][_0x4fd8('0x3c')]);_0x3435e3[_0x4fd8('0x3d')]=qs[_0x4fd8('0x34')](_[_0x4fd8('0x3e')](_0x228f22[_0x4fd8('0x33')],_0x181a01['filters']));if(_0x228f22[_0x4fd8('0x33')][_0x4fd8('0x3f')]){_0x3435e3[_0x4fd8('0x3d')]=_[_0x4fd8('0x41')](_0x3435e3[_0x4fd8('0x3d')],{'$or':_[_0x4fd8('0x31')](_0x3435e3[_0x4fd8('0x37')],function(_0x20d3a1){var _0x36f464={};_0x36f464[_0x20d3a1]={'$like':'%'+_0x228f22[_0x4fd8('0x33')][_0x4fd8('0x3f')]+'%'};return _0x36f464;})});}_0x3435e3=_[_0x4fd8('0x41')]({},_0x3435e3,_0x228f22['options']);return _0x231e7f['getDescriptions'](_0x3435e3);}})['then'](function(_0x521479){if(_0x521479){_0x20b3c2=_0x521479[_0x4fd8('0x39')];if(!_0x228f22[_0x4fd8('0x33')][_0x4fd8('0x50')](_0x4fd8('0x3a'))){_0x3435e3['limit']=qs[_0x4fd8('0x1e')](_0x228f22[_0x4fd8('0x33')][_0x4fd8('0x1e')]);_0x3435e3[_0x4fd8('0x1d')]=qs['offset'](_0x228f22['query'][_0x4fd8('0x1d')]);}return _0x231e7f['getDescriptions'](_0x3435e3);}})[_0x4fd8('0x28')](function(_0x505885){if(_0x505885){return _0x505885?{'count':_0x20b3c2,'rows':_0x505885}:null;}})[_0x4fd8('0x28')](respondWithResult(_0x41d7db,null))['catch'](handleError(_0x41d7db,null));};exports['getTags']=function(_0x5c98a2,_0x32e8b4,_0x853a4d){var _0x2da705={};var _0x5367af={};var _0x1feb27;var _0x6d0ecc;return db[_0x4fd8('0x2d')]['findOne']({'where':{'id':_0x5c98a2[_0x4fd8('0x47')]['id']}})[_0x4fd8('0x28')](handleEntityNotFound(_0x32e8b4,null))[_0x4fd8('0x28')](function(_0x17efad){if(_0x17efad){_0x1feb27=_0x17efad;_0x5367af[_0x4fd8('0x36')]=_[_0x4fd8('0x32')](db['Tag']['rawAttributes']);_0x5367af[_0x4fd8('0x33')]=_['keys'](_0x5c98a2[_0x4fd8('0x33')]);_0x5367af[_0x4fd8('0x34')]=_[_0x4fd8('0x35')](_0x5367af['model'],_0x5367af[_0x4fd8('0x33')]);_0x2da705['attributes']=_[_0x4fd8('0x35')](_0x5367af[_0x4fd8('0x36')],qs['fields'](_0x5c98a2[_0x4fd8('0x33')][_0x4fd8('0x38')]));_0x2da705[_0x4fd8('0x37')]=_0x2da705[_0x4fd8('0x37')][_0x4fd8('0x39')]?_0x2da705['attributes']:_0x5367af['model'];_0x2da705['order']=qs['sort'](_0x5c98a2[_0x4fd8('0x33')]['sort']);_0x2da705[_0x4fd8('0x3d')]=qs[_0x4fd8('0x34')](_[_0x4fd8('0x3e')](_0x5c98a2['query'],_0x5367af[_0x4fd8('0x34')]));if(_0x5c98a2['query'][_0x4fd8('0x3f')]){_0x2da705[_0x4fd8('0x3d')]=_[_0x4fd8('0x41')](_0x2da705['where'],{'$or':_[_0x4fd8('0x31')](_0x2da705[_0x4fd8('0x37')],function(_0x38392c){var _0x396c2b={};_0x396c2b[_0x38392c]={'$like':'%'+_0x5c98a2[_0x4fd8('0x33')][_0x4fd8('0x3f')]+'%'};return _0x396c2b;})});}_0x2da705=_[_0x4fd8('0x41')]({},_0x2da705,_0x5c98a2[_0x4fd8('0x42')]);return _0x1feb27[_0x4fd8('0x52')](_0x2da705);}})[_0x4fd8('0x28')](function(_0x2dd9fd){if(_0x2dd9fd){_0x6d0ecc=_0x2dd9fd['length'];if(!_0x5c98a2[_0x4fd8('0x33')][_0x4fd8('0x50')](_0x4fd8('0x3a'))){_0x2da705[_0x4fd8('0x1e')]=qs[_0x4fd8('0x1e')](_0x5c98a2['query'][_0x4fd8('0x1e')]);_0x2da705['offset']=qs[_0x4fd8('0x1d')](_0x5c98a2['query'][_0x4fd8('0x1d')]);}return _0x1feb27['getTags'](_0x2da705);}})[_0x4fd8('0x28')](function(_0x40d5f5){if(_0x40d5f5){return _0x40d5f5?{'count':_0x6d0ecc,'rows':_0x40d5f5}:null;}})[_0x4fd8('0x28')](respondWithResult(_0x32e8b4,null))[_0x4fd8('0x45')](handleError(_0x32e8b4,null));};exports[_0x4fd8('0x53')]=function(_0x1c2823,_0x34d1c6,_0x30c8d6){if(_0x1c2823[_0x4fd8('0x4c')]['id']){delete _0x1c2823[_0x4fd8('0x4c')]['id'];}return db[_0x4fd8('0x2d')][_0x4fd8('0x4e')]({'where':{'id':_0x1c2823[_0x4fd8('0x47')]['id']}})['then'](handleEntityNotFound(_0x34d1c6,null))['then'](function(_0x513817){if(_0x513817){return _0x513817[_0x4fd8('0x53')](_0x1c2823[_0x4fd8('0x4c')]['ids']||[]);}return null;})[_0x4fd8('0x28')](respondWithResult(_0x34d1c6,null))[_0x4fd8('0x45')](handleError(_0x34d1c6,null));}; \ No newline at end of file +var _0x41b7=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41b7,0x143));var _0x741b=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0x41b7[_0x209511];return _0x39b937;};'use strict';var emlformat=require(_0x741b('0x0'));var rimraf=require(_0x741b('0x1'));var zipdir=require(_0x741b('0x2'));var jsonpatch=require(_0x741b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x741b('0x4'));var Mustache=require(_0x741b('0x5'));var util=require('util');var path=require(_0x741b('0x6'));var sox=require(_0x741b('0x7'));var csv=require(_0x741b('0x8'));var ejs=require(_0x741b('0x9'));var fs=require('fs');var fs_extra=require(_0x741b('0xa'));var _=require(_0x741b('0xb'));var squel=require(_0x741b('0xc'));var crypto=require('crypto');var jsforce=require(_0x741b('0xd'));var deskjs=require(_0x741b('0xe'));var toCsv=require(_0x741b('0x8'));var querystring=require('querystring');var Papa=require(_0x741b('0xf'));var Redis=require(_0x741b('0x10'));var authService=require(_0x741b('0x11'));var qs=require(_0x741b('0x12'));var as=require(_0x741b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x741b('0x14'))(_0x741b('0x15'));var utils=require(_0x741b('0x16'));var config=require(_0x741b('0x17'));var licenseUtil=require(_0x741b('0x18'));var db=require(_0x741b('0x19'))['db'];function respondWithStatusCode(_0x380074,_0x1d2af2){_0x1d2af2=_0x1d2af2||0xcc;return function(_0x1d7392){if(_0x1d7392){return _0x380074[_0x741b('0x1a')](_0x1d2af2);}return _0x380074[_0x741b('0x1b')](_0x1d2af2)[_0x741b('0x1c')]();};}function respondWithResult(_0x430005,_0x3f8f26){_0x3f8f26=_0x3f8f26||0xc8;return function(_0x497ce1){if(_0x497ce1){return _0x430005[_0x741b('0x1b')](_0x3f8f26)['json'](_0x497ce1);}};}function respondWithFilteredResult(_0x40eb42,_0x22beec){return function(_0x12f2dd){if(_0x12f2dd){var _0xb938d=typeof _0x22beec[_0x741b('0x1d')]===_0x741b('0x1e')&&typeof _0x22beec['limit']===_0x741b('0x1e');var _0x324ee3=_0x12f2dd[_0x741b('0x1f')];var _0x9bb25f=_0xb938d?0x0:_0x22beec[_0x741b('0x1d')];var _0x48dc8c=_0xb938d?_0x12f2dd[_0x741b('0x1f')]:_0x22beec['offset']+_0x22beec[_0x741b('0x20')];var _0x4ce707;if(_0x48dc8c>=_0x324ee3){_0x48dc8c=_0x324ee3;_0x4ce707=0xc8;}else{_0x4ce707=0xce;}_0x40eb42['status'](_0x4ce707);return _0x40eb42['set'](_0x741b('0x21'),_0x9bb25f+'-'+_0x48dc8c+'/'+_0x324ee3)[_0x741b('0x22')](_0x12f2dd);}return null;};}function patchUpdates(_0x4dc352){return function(_0x4c7102){try{jsonpatch[_0x741b('0x23')](_0x4c7102,_0x4dc352,!![]);}catch(_0x34752b){return BPromise[_0x741b('0x24')](_0x34752b);}return _0x4c7102[_0x741b('0x25')]();};}function saveUpdates(_0x327682,_0x2f1c50){return function(_0x28a246){if(_0x28a246){return _0x28a246[_0x741b('0x26')](_0x327682)[_0x741b('0x27')](function(_0x613f4b){return _0x613f4b;});}return null;};}function removeEntity(_0x5a2802,_0x114d0f){return function(_0x433c9e){if(_0x433c9e){return _0x433c9e[_0x741b('0x28')]()[_0x741b('0x27')](function(){_0x5a2802[_0x741b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c605,_0x5f1da7){return function(_0x368cac){if(!_0x368cac){_0x58c605[_0x741b('0x1a')](0x194);}return _0x368cac;};}function handleError(_0x37ae1a,_0x2c4916){_0x2c4916=_0x2c4916||0x1f4;return function(_0x4ecd3a){logger['error'](_0x4ecd3a['stack']);if(_0x4ecd3a[_0x741b('0x29')]){delete _0x4ecd3a['name'];}_0x37ae1a[_0x741b('0x1b')](_0x2c4916)[_0x741b('0x2a')](_0x4ecd3a);};}exports[_0x741b('0x2b')]=function(_0x4e3c01,_0x1dbde9){var _0x2eb6e8={},_0x3895fe={},_0x3e3eb5={'count':0x0,'rows':[]};var _0x3fb82d=_[_0x741b('0x2c')](db[_0x741b('0x2d')][_0x741b('0x2e')],function(_0x37844a){return{'name':_0x37844a[_0x741b('0x2f')],'type':_0x37844a[_0x741b('0x30')]['key']};});_0x3895fe[_0x741b('0x31')]=_[_0x741b('0x2c')](_0x3fb82d,_0x741b('0x29'));_0x3895fe[_0x741b('0x32')]=_[_0x741b('0x33')](_0x4e3c01['query']);_0x3895fe[_0x741b('0x34')]=_[_0x741b('0x35')](_0x3895fe['model'],_0x3895fe[_0x741b('0x32')]);_0x2eb6e8[_0x741b('0x36')]=_[_0x741b('0x35')](_0x3895fe[_0x741b('0x31')],qs['fields'](_0x4e3c01[_0x741b('0x32')][_0x741b('0x37')]));_0x2eb6e8[_0x741b('0x36')]=_0x2eb6e8['attributes'][_0x741b('0x38')]?_0x2eb6e8[_0x741b('0x36')]:_0x3895fe['model'];if(!_0x4e3c01[_0x741b('0x32')][_0x741b('0x39')](_0x741b('0x3a'))){_0x2eb6e8['limit']=qs[_0x741b('0x20')](_0x4e3c01[_0x741b('0x32')][_0x741b('0x20')]);_0x2eb6e8[_0x741b('0x1d')]=qs[_0x741b('0x1d')](_0x4e3c01[_0x741b('0x32')]['offset']);}_0x2eb6e8[_0x741b('0x3b')]=qs[_0x741b('0x3c')](_0x4e3c01['query'][_0x741b('0x3c')]);_0x2eb6e8[_0x741b('0x3d')]=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x4e3c01[_0x741b('0x32')],_0x3895fe[_0x741b('0x34')]),_0x3fb82d);if(_0x4e3c01['query']['filter']){_0x2eb6e8[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x2eb6e8[_0x741b('0x3d')],{'$or':_['map'](_0x3fb82d,function(_0x48cc9f){if(_0x48cc9f[_0x741b('0x30')]!==_0x741b('0x40')){var _0x154576={};_0x154576[_0x48cc9f['name']]={'$like':'%'+_0x4e3c01[_0x741b('0x32')][_0x741b('0x41')]+'%'};return _0x154576;}})});}_0x2eb6e8=_[_0x741b('0x3f')]({},_0x2eb6e8,_0x4e3c01[_0x741b('0x42')]);var _0x4aee3f={'where':_0x2eb6e8[_0x741b('0x3d')]};return db['ZendeskConfiguration']['count'](_0x4aee3f)['then'](function(_0x1b7b09){_0x3e3eb5['count']=_0x1b7b09;if(_0x4e3c01[_0x741b('0x32')][_0x741b('0x43')]){_0x2eb6e8[_0x741b('0x44')]=[{'all':!![]}];}return db[_0x741b('0x2d')][_0x741b('0x45')](_0x2eb6e8);})['then'](function(_0x7ffa19){_0x3e3eb5['rows']=_0x7ffa19;return _0x3e3eb5;})[_0x741b('0x27')](respondWithFilteredResult(_0x1dbde9,_0x2eb6e8))[_0x741b('0x46')](handleError(_0x1dbde9,null));};exports['show']=function(_0x3f5cfb,_0x2ed801){var _0x452393={'raw':![],'where':{'id':_0x3f5cfb[_0x741b('0x47')]['id']}},_0x36a238={};_0x36a238['model']=_[_0x741b('0x33')](db[_0x741b('0x2d')]['rawAttributes']);_0x36a238[_0x741b('0x32')]=_['keys'](_0x3f5cfb[_0x741b('0x32')]);_0x36a238[_0x741b('0x34')]=_['intersection'](_0x36a238[_0x741b('0x31')],_0x36a238[_0x741b('0x32')]);_0x452393[_0x741b('0x36')]=_[_0x741b('0x35')](_0x36a238[_0x741b('0x31')],qs[_0x741b('0x37')](_0x3f5cfb['query'][_0x741b('0x37')]));_0x452393[_0x741b('0x36')]=_0x452393[_0x741b('0x36')][_0x741b('0x38')]?_0x452393[_0x741b('0x36')]:_0x36a238['model'];if(_0x3f5cfb[_0x741b('0x32')][_0x741b('0x43')]){_0x452393[_0x741b('0x44')]=[{'all':!![]}];}_0x452393=_[_0x741b('0x3f')]({},_0x452393,_0x3f5cfb['options']);return db[_0x741b('0x2d')][_0x741b('0x48')](_0x452393)[_0x741b('0x27')](handleEntityNotFound(_0x2ed801,null))[_0x741b('0x27')](respondWithResult(_0x2ed801,null))[_0x741b('0x46')](handleError(_0x2ed801,null));};exports['create']=function(_0x4fec61,_0x118c04){return db['ZendeskConfiguration'][_0x741b('0x49')](_0x4fec61[_0x741b('0x4a')],{})[_0x741b('0x27')](respondWithResult(_0x118c04,0xc9))[_0x741b('0x46')](handleError(_0x118c04,null));};exports['update']=function(_0x372217,_0x49831a){if(_0x372217[_0x741b('0x4a')]['id']){delete _0x372217[_0x741b('0x4a')]['id'];}return db[_0x741b('0x2d')][_0x741b('0x48')]({'where':{'id':_0x372217[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x49831a,null))[_0x741b('0x27')](saveUpdates(_0x372217['body'],null))[_0x741b('0x27')](respondWithResult(_0x49831a,null))['catch'](handleError(_0x49831a,null));};exports[_0x741b('0x28')]=function(_0x34fe5c,_0x15f024){return db['ZendeskConfiguration'][_0x741b('0x48')]({'where':{'id':_0x34fe5c[_0x741b('0x47')]['id']}})['then'](handleEntityNotFound(_0x15f024,null))[_0x741b('0x27')](removeEntity(_0x15f024,null))[_0x741b('0x46')](handleError(_0x15f024,null));};exports[_0x741b('0x4b')]=function(_0x5c6c2e,_0x5589cb,_0x33fc3c){var _0x34bddd={};var _0xc66015={};var _0x5496d7;var _0x4ccf83;return db[_0x741b('0x2d')][_0x741b('0x4c')]({'where':{'id':_0x5c6c2e[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x5589cb,null))[_0x741b('0x27')](function(_0x419c20){if(_0x419c20){_0x5496d7=_0x419c20;_0xc66015[_0x741b('0x31')]=_[_0x741b('0x33')](db['ZendeskField']['rawAttributes']);_0xc66015[_0x741b('0x32')]=_[_0x741b('0x33')](_0x5c6c2e[_0x741b('0x32')]);_0xc66015['filters']=_[_0x741b('0x35')](_0xc66015[_0x741b('0x31')],_0xc66015[_0x741b('0x32')]);_0x34bddd[_0x741b('0x36')]=_[_0x741b('0x35')](_0xc66015['model'],qs[_0x741b('0x37')](_0x5c6c2e['query']['fields']));_0x34bddd['attributes']=_0x34bddd['attributes']['length']?_0x34bddd[_0x741b('0x36')]:_0xc66015[_0x741b('0x31')];_0x34bddd['order']=qs[_0x741b('0x3c')](_0x5c6c2e[_0x741b('0x32')][_0x741b('0x3c')]);_0x34bddd[_0x741b('0x3d')]=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x5c6c2e[_0x741b('0x32')],_0xc66015[_0x741b('0x34')]));if(_0x5c6c2e['query']['filter']){_0x34bddd[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x34bddd[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x34bddd[_0x741b('0x36')],function(_0x36f1ec){var _0x302c2e={};_0x302c2e[_0x36f1ec]={'$like':'%'+_0x5c6c2e[_0x741b('0x32')][_0x741b('0x41')]+'%'};return _0x302c2e;})});}_0x34bddd=_[_0x741b('0x3f')]({},_0x34bddd,_0x5c6c2e[_0x741b('0x42')]);return _0x5496d7['getFields'](_0x34bddd);}})[_0x741b('0x27')](function(_0x1260d9){if(_0x1260d9){_0x4ccf83=_0x1260d9[_0x741b('0x38')];if(!_0x5c6c2e[_0x741b('0x32')][_0x741b('0x39')](_0x741b('0x3a'))){_0x34bddd['limit']=qs['limit'](_0x5c6c2e[_0x741b('0x32')][_0x741b('0x20')]);_0x34bddd[_0x741b('0x1d')]=qs['offset'](_0x5c6c2e['query'][_0x741b('0x1d')]);}return _0x5496d7[_0x741b('0x4b')](_0x34bddd);}})[_0x741b('0x27')](function(_0x1c841c){if(_0x1c841c){return _0x1c841c?{'count':_0x4ccf83,'rows':_0x1c841c}:null;}})[_0x741b('0x27')](respondWithResult(_0x5589cb,null))[_0x741b('0x46')](handleError(_0x5589cb,null));};exports['getSubjects']=function(_0x1df768,_0x36eb17,_0x37b895){var _0x499fe4={};var _0x393b3a={};var _0x13404a;var _0x291389;return db[_0x741b('0x2d')][_0x741b('0x4c')]({'where':{'id':_0x1df768['params']['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x36eb17,null))[_0x741b('0x27')](function(_0x580ce8){if(_0x580ce8){_0x13404a=_0x580ce8;_0x393b3a[_0x741b('0x31')]=_[_0x741b('0x33')](db[_0x741b('0x4d')][_0x741b('0x2e')]);_0x393b3a[_0x741b('0x32')]=_[_0x741b('0x33')](_0x1df768[_0x741b('0x32')]);_0x393b3a['filters']=_[_0x741b('0x35')](_0x393b3a[_0x741b('0x31')],_0x393b3a[_0x741b('0x32')]);_0x499fe4[_0x741b('0x36')]=_[_0x741b('0x35')](_0x393b3a[_0x741b('0x31')],qs[_0x741b('0x37')](_0x1df768[_0x741b('0x32')][_0x741b('0x37')]));_0x499fe4['attributes']=_0x499fe4['attributes'][_0x741b('0x38')]?_0x499fe4[_0x741b('0x36')]:_0x393b3a[_0x741b('0x31')];_0x499fe4['order']=qs[_0x741b('0x3c')](_0x1df768[_0x741b('0x32')]['sort']);_0x499fe4['where']=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x1df768['query'],_0x393b3a[_0x741b('0x34')]));if(_0x1df768[_0x741b('0x32')][_0x741b('0x41')]){_0x499fe4[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x499fe4[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x499fe4[_0x741b('0x36')],function(_0x1da164){var _0x1f132f={};_0x1f132f[_0x1da164]={'$like':'%'+_0x1df768['query'][_0x741b('0x41')]+'%'};return _0x1f132f;})});}_0x499fe4=_[_0x741b('0x3f')]({},_0x499fe4,_0x1df768['options']);return _0x13404a['getSubjects'](_0x499fe4);}})[_0x741b('0x27')](function(_0x308c77){if(_0x308c77){_0x291389=_0x308c77[_0x741b('0x38')];if(!_0x1df768['query'][_0x741b('0x39')](_0x741b('0x3a'))){_0x499fe4['limit']=qs[_0x741b('0x20')](_0x1df768[_0x741b('0x32')][_0x741b('0x20')]);_0x499fe4['offset']=qs[_0x741b('0x1d')](_0x1df768[_0x741b('0x32')]['offset']);}return _0x13404a[_0x741b('0x4e')](_0x499fe4);}})[_0x741b('0x27')](function(_0x531434){if(_0x531434){return _0x531434?{'count':_0x291389,'rows':_0x531434}:null;}})['then'](respondWithResult(_0x36eb17,null))[_0x741b('0x46')](handleError(_0x36eb17,null));};exports['getDescriptions']=function(_0x23dcbc,_0x24f299,_0x17c3ce){var _0x50e86f={};var _0x47787c={};var _0x2d1e04;var _0x3d6db6;return db['ZendeskConfiguration'][_0x741b('0x4c')]({'where':{'id':_0x23dcbc[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x24f299,null))['then'](function(_0x2008cf){if(_0x2008cf){_0x2d1e04=_0x2008cf;_0x47787c[_0x741b('0x31')]=_[_0x741b('0x33')](db[_0x741b('0x4d')][_0x741b('0x2e')]);_0x47787c[_0x741b('0x32')]=_['keys'](_0x23dcbc['query']);_0x47787c[_0x741b('0x34')]=_[_0x741b('0x35')](_0x47787c[_0x741b('0x31')],_0x47787c[_0x741b('0x32')]);_0x50e86f[_0x741b('0x36')]=_[_0x741b('0x35')](_0x47787c[_0x741b('0x31')],qs[_0x741b('0x37')](_0x23dcbc['query'][_0x741b('0x37')]));_0x50e86f['attributes']=_0x50e86f[_0x741b('0x36')]['length']?_0x50e86f[_0x741b('0x36')]:_0x47787c[_0x741b('0x31')];_0x50e86f[_0x741b('0x3b')]=qs['sort'](_0x23dcbc['query'][_0x741b('0x3c')]);_0x50e86f['where']=qs[_0x741b('0x34')](_[_0x741b('0x3e')](_0x23dcbc[_0x741b('0x32')],_0x47787c[_0x741b('0x34')]));if(_0x23dcbc[_0x741b('0x32')][_0x741b('0x41')]){_0x50e86f[_0x741b('0x3d')]=_[_0x741b('0x3f')](_0x50e86f[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x50e86f[_0x741b('0x36')],function(_0x467e26){var _0x4f5426={};_0x4f5426[_0x467e26]={'$like':'%'+_0x23dcbc['query'][_0x741b('0x41')]+'%'};return _0x4f5426;})});}_0x50e86f=_[_0x741b('0x3f')]({},_0x50e86f,_0x23dcbc[_0x741b('0x42')]);return _0x2d1e04[_0x741b('0x4f')](_0x50e86f);}})['then'](function(_0x46de3c){if(_0x46de3c){_0x3d6db6=_0x46de3c['length'];if(!_0x23dcbc[_0x741b('0x32')][_0x741b('0x39')](_0x741b('0x3a'))){_0x50e86f['limit']=qs['limit'](_0x23dcbc['query'][_0x741b('0x20')]);_0x50e86f[_0x741b('0x1d')]=qs[_0x741b('0x1d')](_0x23dcbc[_0x741b('0x32')][_0x741b('0x1d')]);}return _0x2d1e04[_0x741b('0x4f')](_0x50e86f);}})[_0x741b('0x27')](function(_0x22dfce){if(_0x22dfce){return _0x22dfce?{'count':_0x3d6db6,'rows':_0x22dfce}:null;}})[_0x741b('0x27')](respondWithResult(_0x24f299,null))[_0x741b('0x46')](handleError(_0x24f299,null));};exports[_0x741b('0x50')]=function(_0x41653c,_0xb8b27,_0x3ca5c2){var _0x2e5bb5={};var _0x531feb={};var _0x4c9b01;var _0x2796b6;return db[_0x741b('0x2d')]['findOne']({'where':{'id':_0x41653c[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0xb8b27,null))[_0x741b('0x27')](function(_0x16cc95){if(_0x16cc95){_0x4c9b01=_0x16cc95;_0x531feb[_0x741b('0x31')]=_[_0x741b('0x33')](db[_0x741b('0x51')][_0x741b('0x2e')]);_0x531feb[_0x741b('0x32')]=_[_0x741b('0x33')](_0x41653c[_0x741b('0x32')]);_0x531feb[_0x741b('0x34')]=_[_0x741b('0x35')](_0x531feb[_0x741b('0x31')],_0x531feb['query']);_0x2e5bb5[_0x741b('0x36')]=_[_0x741b('0x35')](_0x531feb[_0x741b('0x31')],qs['fields'](_0x41653c[_0x741b('0x32')]['fields']));_0x2e5bb5['attributes']=_0x2e5bb5[_0x741b('0x36')][_0x741b('0x38')]?_0x2e5bb5[_0x741b('0x36')]:_0x531feb[_0x741b('0x31')];_0x2e5bb5['order']=qs['sort'](_0x41653c[_0x741b('0x32')][_0x741b('0x3c')]);_0x2e5bb5[_0x741b('0x3d')]=qs['filters'](_['pick'](_0x41653c[_0x741b('0x32')],_0x531feb[_0x741b('0x34')]));if(_0x41653c['query']['filter']){_0x2e5bb5['where']=_[_0x741b('0x3f')](_0x2e5bb5[_0x741b('0x3d')],{'$or':_[_0x741b('0x2c')](_0x2e5bb5['attributes'],function(_0x5ddaa7){var _0x110d84={};_0x110d84[_0x5ddaa7]={'$like':'%'+_0x41653c[_0x741b('0x32')][_0x741b('0x41')]+'%'};return _0x110d84;})});}_0x2e5bb5=_[_0x741b('0x3f')]({},_0x2e5bb5,_0x41653c[_0x741b('0x42')]);return _0x4c9b01[_0x741b('0x50')](_0x2e5bb5);}})[_0x741b('0x27')](function(_0x4ed258){if(_0x4ed258){_0x2796b6=_0x4ed258[_0x741b('0x38')];if(!_0x41653c['query'][_0x741b('0x39')](_0x741b('0x3a'))){_0x2e5bb5[_0x741b('0x20')]=qs[_0x741b('0x20')](_0x41653c[_0x741b('0x32')][_0x741b('0x20')]);_0x2e5bb5['offset']=qs[_0x741b('0x1d')](_0x41653c[_0x741b('0x32')]['offset']);}return _0x4c9b01[_0x741b('0x50')](_0x2e5bb5);}})['then'](function(_0x4df1da){if(_0x4df1da){return _0x4df1da?{'count':_0x2796b6,'rows':_0x4df1da}:null;}})['then'](respondWithResult(_0xb8b27,null))[_0x741b('0x46')](handleError(_0xb8b27,null));};exports[_0x741b('0x52')]=function(_0x357575,_0x42d856,_0x46b75c){if(_0x357575['body']['id']){delete _0x357575[_0x741b('0x4a')]['id'];}return db[_0x741b('0x2d')][_0x741b('0x4c')]({'where':{'id':_0x357575[_0x741b('0x47')]['id']}})[_0x741b('0x27')](handleEntityNotFound(_0x42d856,null))['then'](function(_0x52470d){if(_0x52470d){return _0x52470d[_0x741b('0x52')](_0x357575[_0x741b('0x4a')][_0x741b('0x53')]||[]);}return null;})['then'](respondWithResult(_0x42d856,null))[_0x741b('0x46')](handleError(_0x42d856,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7d23393..6314c69 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 _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x5a95a8,_0x482a9f){var _0x3e2e34=function(_0x450535){while(--_0x450535){_0x5a95a8['push'](_0x5a95a8['shift']());}};_0x3e2e34(++_0x482a9f);}(_0xdb94,0xab));var _0x4db9=function(_0x5a7a5c,_0x2742c9){_0x5a7a5c=_0x5a7a5c-0x0;var _0x164010=_0xdb94[_0x5a7a5c];return _0x164010;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x282b=['moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x1b4e30,_0x3693db){var _0x440cf2=function(_0x4f8078){while(--_0x4f8078){_0x1b4e30['push'](_0x1b4e30['shift']());}};_0x440cf2(++_0x3693db);}(_0x282b,0xec));var _0xb282=function(_0x730f26,_0x5e3902){_0x730f26=_0x730f26-0x0;var _0x407ce0=_0x282b[_0x730f26];return _0x407ce0;};'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')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 54db49b..ae1aa20 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 _0x3c87=['http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x3c87,0x1d9));var _0x73c8=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x3c87[_0x4bb66f];return _0xf2772f;};'use strict';var _=require('lodash');var util=require(_0x73c8('0x0'));var moment=require(_0x73c8('0x1'));var BPromise=require(_0x73c8('0x2'));var rs=require(_0x73c8('0x3'));var fs=require('fs');var Redis=require(_0x73c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x73c8('0x5'));var logger=require('../../config/logger')(_0x73c8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x73c8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d85e1,_0x299a8b,_0x448d4a){return new BPromise(function(_0x315312,_0x569268){return client[_0x73c8('0x8')](_0x2d85e1,_0x448d4a)[_0x73c8('0x9')](function(_0x1eb456){logger[_0x73c8('0xa')](_0x73c8('0xb'),_0x299a8b,_0x73c8('0xc'));logger[_0x73c8('0xd')](_0x73c8('0xe'),_0x299a8b,_0x73c8('0xc'),JSON['stringify'](_0x1eb456));if(_0x1eb456[_0x73c8('0xf')]){if(_0x1eb456['error'][_0x73c8('0x10')]===0x1f4){logger[_0x73c8('0xf')](_0x73c8('0xb'),_0x299a8b,_0x1eb456[_0x73c8('0xf')][_0x73c8('0x11')]);return _0x569268(_0x1eb456[_0x73c8('0xf')][_0x73c8('0x11')]);}logger[_0x73c8('0xf')](_0x73c8('0xb'),_0x299a8b,_0x1eb456[_0x73c8('0xf')]['message']);return _0x315312(_0x1eb456[_0x73c8('0xf')][_0x73c8('0x11')]);}else{logger[_0x73c8('0xa')](_0x73c8('0xb'),_0x299a8b,'request\x20sent');_0x315312(_0x1eb456[_0x73c8('0x12')][_0x73c8('0x11')]);}})[_0x73c8('0x13')](function(_0x44f91c){logger[_0x73c8('0xf')](_0x73c8('0xb'),_0x299a8b,_0x44f91c);_0x569268(_0x44f91c);});});} \ No newline at end of file +var _0x4950=['stringify','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x372c04,_0x5cc2cd){var _0x49b325=function(_0x7970ea){while(--_0x7970ea){_0x372c04['push'](_0x372c04['shift']());}};_0x49b325(++_0x5cc2cd);}(_0x4950,0x124));var _0x0495=function(_0x15819b,_0x469bfd){_0x15819b=_0x15819b-0x0;var _0x3a4fe1=_0x4950[_0x15819b];return _0x3a4fe1;};'use strict';var _=require(_0x0495('0x0'));var util=require(_0x0495('0x1'));var moment=require(_0x0495('0x2'));var BPromise=require(_0x0495('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0495('0x4'))['db'];var utils=require(_0x0495('0x5'));var logger=require(_0x0495('0x6'))('rpc');var config=require(_0x0495('0x7'));var jayson=require(_0x0495('0x8'));var client=jayson[_0x0495('0x9')][_0x0495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x282ca8,_0x4efdb7,_0xa3be6){return new BPromise(function(_0x1f9a8d,_0x507e6f){return client[_0x0495('0xb')](_0x282ca8,_0xa3be6)[_0x0495('0xc')](function(_0x490369){logger['info'](_0x0495('0xd'),_0x4efdb7,_0x0495('0xe'));logger['debug'](_0x0495('0xf'),_0x4efdb7,'request\x20sent',JSON[_0x0495('0x10')](_0x490369));if(_0x490369['error']){if(_0x490369[_0x0495('0x11')][_0x0495('0x12')]===0x1f4){logger['error'](_0x0495('0xd'),_0x4efdb7,_0x490369[_0x0495('0x11')][_0x0495('0x13')]);return _0x507e6f(_0x490369[_0x0495('0x11')][_0x0495('0x13')]);}logger[_0x0495('0x11')](_0x0495('0xd'),_0x4efdb7,_0x490369[_0x0495('0x11')][_0x0495('0x13')]);return _0x1f9a8d(_0x490369[_0x0495('0x11')][_0x0495('0x13')]);}else{logger[_0x0495('0x14')](_0x0495('0xd'),_0x4efdb7,_0x0495('0xe'));_0x1f9a8d(_0x490369[_0x0495('0x15')][_0x0495('0x13')]);}})['catch'](function(_0x41c99d){logger[_0x0495('0x11')](_0x0495('0xd'),_0x4efdb7,_0x41c99d);_0x507e6f(_0x41c99d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c325aaf..2a6d8ec 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 _0x1241=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1241,0x177));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1124('0x0'));var path=require(_0x1124('0x1'));var timeout=require('connect-timeout');var express=require(_0x1124('0x2'));var router=express[_0x1124('0x3')]();var fs_extra=require(_0x1124('0x4'));var auth=require(_0x1124('0x5'));var interaction=require(_0x1124('0x6'));var config=require(_0x1124('0x7'));var controller=require(_0x1124('0x8'));router['get']('/',auth[_0x1124('0x9')](),controller[_0x1124('0xa')]);router[_0x1124('0xb')](_0x1124('0xc'),auth[_0x1124('0x9')](),controller[_0x1124('0xd')]);router['post']('/',auth[_0x1124('0x9')](),controller[_0x1124('0xe')]);router[_0x1124('0xf')](_0x1124('0xc'),auth[_0x1124('0x9')](),controller[_0x1124('0x10')]);router[_0x1124('0x11')](_0x1124('0xc'),auth[_0x1124('0x9')](),controller[_0x1124('0x12')]);module[_0x1124('0x13')]=router; \ No newline at end of file +var _0x38f6=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3311ae,_0x362cee){var _0x107949=function(_0x2082a3){while(--_0x2082a3){_0x3311ae['push'](_0x3311ae['shift']());}};_0x107949(++_0x362cee);}(_0x38f6,0x175));var _0x638f=function(_0x4844c5,_0x43b64d){_0x4844c5=_0x4844c5-0x0;var _0x426280=_0x38f6[_0x4844c5];return _0x426280;};'use strict';var multer=require('multer');var util=require(_0x638f('0x0'));var path=require('path');var timeout=require(_0x638f('0x1'));var express=require(_0x638f('0x2'));var router=express['Router']();var fs_extra=require(_0x638f('0x3'));var auth=require(_0x638f('0x4'));var interaction=require(_0x638f('0x5'));var config=require(_0x638f('0x6'));var controller=require(_0x638f('0x7'));router[_0x638f('0x8')]('/',auth[_0x638f('0x9')](),controller['index']);router['get'](_0x638f('0xa'),auth[_0x638f('0x9')](),controller[_0x638f('0xb')]);router[_0x638f('0xc')]('/',auth[_0x638f('0x9')](),controller[_0x638f('0xd')]);router[_0x638f('0xe')](_0x638f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x638f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x638f('0x10')]);module[_0x638f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6364f88..7c3287a 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 _0xa41f=['ENUM','variable','keyValue','picklist','string','STRING','customVariable','sequelize','exports'];(function(_0x56c016,_0x22c1e6){var _0x19db47=function(_0x16387d){while(--_0x16387d){_0x56c016['push'](_0x56c016['shift']());}};_0x19db47(++_0x22c1e6);}(_0xa41f,0xa0));var _0xfa41=function(_0x16b41e,_0x42a384){_0x16b41e=_0x16b41e-0x0;var _0x14959a=_0xa41f[_0x16b41e];return _0x14959a;};'use strict';var Sequelize=require(_0xfa41('0x0'));module[_0xfa41('0x1')]={'type':{'type':Sequelize[_0xfa41('0x2')]('string',_0xfa41('0x3'),'customVariable',_0xfa41('0x4'),_0xfa41('0x5')),'defaultValue':_0xfa41('0x6')},'content':{'type':Sequelize[_0xfa41('0x7')]},'key':{'type':Sequelize[_0xfa41('0x7')]},'keyType':{'type':Sequelize[_0xfa41('0x2')](_0xfa41('0x6'),_0xfa41('0x3'),_0xfa41('0x8'))},'keyContent':{'type':Sequelize[_0xfa41('0x7')]},'idField':{'type':Sequelize[_0xfa41('0x7')]},'nameField':{'type':Sequelize[_0xfa41('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa41('0x7')]}}; \ No newline at end of file +var _0x15d3=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0x15d3,0x1d0));var _0x315d=function(_0x4ee0a0,_0x27bdee){_0x4ee0a0=_0x4ee0a0-0x0;var _0xfc5b2f=_0x15d3[_0x4ee0a0];return _0xfc5b2f;};'use strict';var Sequelize=require(_0x315d('0x0'));module[_0x315d('0x1')]={'type':{'type':Sequelize[_0x315d('0x2')]('string','variable',_0x315d('0x3'),_0x315d('0x4'),_0x315d('0x5')),'defaultValue':_0x315d('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x315d('0x7')]},'keyType':{'type':Sequelize[_0x315d('0x2')](_0x315d('0x6'),_0x315d('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x315d('0x7')]},'idField':{'type':Sequelize[_0x315d('0x7')]},'nameField':{'type':Sequelize[_0x315d('0x7')]},'customField':{'type':Sequelize[_0x315d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index de68832..182f513 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 _0x7b6f=['name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','ZendeskField','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3b40e5,_0x2466a2){var _0x2c3814=function(_0x493fa8){while(--_0x493fa8){_0x3b40e5['push'](_0x3b40e5['shift']());}};_0x2c3814(++_0x2466a2);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x1bad62,_0x9fea54){_0x1bad62=_0x1bad62-0x0;var _0x4520a5=_0x7b6f[_0x1bad62];return _0x4520a5;};'use strict';var emlformat=require(_0xf7b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7b6('0x1'));var jsonpatch=require(_0xf7b6('0x2'));var rp=require(_0xf7b6('0x3'));var moment=require(_0xf7b6('0x4'));var BPromise=require(_0xf7b6('0x5'));var Mustache=require(_0xf7b6('0x6'));var util=require('util');var path=require(_0xf7b6('0x7'));var sox=require(_0xf7b6('0x8'));var csv=require(_0xf7b6('0x9'));var ejs=require(_0xf7b6('0xa'));var fs=require('fs');var fs_extra=require(_0xf7b6('0xb'));var _=require(_0xf7b6('0xc'));var squel=require(_0xf7b6('0xd'));var crypto=require(_0xf7b6('0xe'));var jsforce=require(_0xf7b6('0xf'));var deskjs=require(_0xf7b6('0x10'));var toCsv=require(_0xf7b6('0x9'));var querystring=require('querystring');var Papa=require(_0xf7b6('0x11'));var Redis=require(_0xf7b6('0x12'));var authService=require(_0xf7b6('0x13'));var qs=require(_0xf7b6('0x14'));var as=require(_0xf7b6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf7b6('0x16'));var config=require(_0xf7b6('0x17'));var licenseUtil=require(_0xf7b6('0x18'));var db=require(_0xf7b6('0x19'))['db'];function respondWithStatusCode(_0x1b006d,_0x1e9659){_0x1e9659=_0x1e9659||0xcc;return function(_0x389d1f){if(_0x389d1f){return _0x1b006d[_0xf7b6('0x1a')](_0x1e9659);}return _0x1b006d['status'](_0x1e9659)[_0xf7b6('0x1b')]();};}function respondWithResult(_0x13731d,_0x207478){_0x207478=_0x207478||0xc8;return function(_0x115e88){if(_0x115e88){return _0x13731d[_0xf7b6('0x1c')](_0x207478)[_0xf7b6('0x1d')](_0x115e88);}};}function respondWithFilteredResult(_0x4fecfd,_0x4c28e7){return function(_0x59c95b){if(_0x59c95b){var _0x149b5c=typeof _0x4c28e7[_0xf7b6('0x1e')]==='undefined'&&typeof _0x4c28e7[_0xf7b6('0x1f')]==='undefined';var _0x27bd4a=_0x59c95b[_0xf7b6('0x20')];var _0x46b06d=_0x149b5c?0x0:_0x4c28e7[_0xf7b6('0x1e')];var _0x180f2b=_0x149b5c?_0x59c95b['count']:_0x4c28e7[_0xf7b6('0x1e')]+_0x4c28e7['limit'];var _0x20f441;if(_0x180f2b>=_0x27bd4a){_0x180f2b=_0x27bd4a;_0x20f441=0xc8;}else{_0x20f441=0xce;}_0x4fecfd[_0xf7b6('0x1c')](_0x20f441);return _0x4fecfd['set'](_0xf7b6('0x21'),_0x46b06d+'-'+_0x180f2b+'/'+_0x27bd4a)[_0xf7b6('0x1d')](_0x59c95b);}return null;};}function patchUpdates(_0x5d2e5a){return function(_0x6c148){try{jsonpatch[_0xf7b6('0x22')](_0x6c148,_0x5d2e5a,!![]);}catch(_0x327b2d){return BPromise[_0xf7b6('0x23')](_0x327b2d);}return _0x6c148[_0xf7b6('0x24')]();};}function saveUpdates(_0x18d8bd,_0x2ef7d2){return function(_0x1aeeb0){if(_0x1aeeb0){return _0x1aeeb0[_0xf7b6('0x25')](_0x18d8bd)[_0xf7b6('0x26')](function(_0x581d60){return _0x581d60;});}return null;};}function removeEntity(_0x3af939,_0x28d5f6){return function(_0x2e2d7b){if(_0x2e2d7b){return _0x2e2d7b[_0xf7b6('0x27')]()[_0xf7b6('0x26')](function(){_0x3af939[_0xf7b6('0x1c')](0xcc)[_0xf7b6('0x1b')]();});}};}function handleEntityNotFound(_0x174acb,_0x1d25b0){return function(_0x5a8b0c){if(!_0x5a8b0c){_0x174acb[_0xf7b6('0x1a')](0x194);}return _0x5a8b0c;};}function handleError(_0xfa7fa,_0x8fee6a){_0x8fee6a=_0x8fee6a||0x1f4;return function(_0x4861c1){logger[_0xf7b6('0x28')](_0x4861c1[_0xf7b6('0x29')]);if(_0x4861c1[_0xf7b6('0x2a')]){delete _0x4861c1['name'];}_0xfa7fa[_0xf7b6('0x1c')](_0x8fee6a)['send'](_0x4861c1);};}exports['index']=function(_0x3c188b,_0x4688b5){var _0xef184a={},_0x2bf531={},_0x3c9f33={'count':0x0,'rows':[]};var _0xdd47f=_[_0xf7b6('0x2b')](db['ZendeskField'][_0xf7b6('0x2c')],function(_0x15328a){return{'name':_0x15328a[_0xf7b6('0x2d')],'type':_0x15328a['type'][_0xf7b6('0x2e')]};});_0x2bf531[_0xf7b6('0x2f')]=_[_0xf7b6('0x2b')](_0xdd47f,_0xf7b6('0x2a'));_0x2bf531[_0xf7b6('0x30')]=_[_0xf7b6('0x31')](_0x3c188b[_0xf7b6('0x30')]);_0x2bf531[_0xf7b6('0x32')]=_['intersection'](_0x2bf531['model'],_0x2bf531[_0xf7b6('0x30')]);_0xef184a['attributes']=_[_0xf7b6('0x33')](_0x2bf531['model'],qs[_0xf7b6('0x34')](_0x3c188b[_0xf7b6('0x30')][_0xf7b6('0x34')]));_0xef184a[_0xf7b6('0x35')]=_0xef184a['attributes'][_0xf7b6('0x36')]?_0xef184a[_0xf7b6('0x35')]:_0x2bf531['model'];if(!_0x3c188b['query']['hasOwnProperty'](_0xf7b6('0x37'))){_0xef184a['limit']=qs[_0xf7b6('0x1f')](_0x3c188b[_0xf7b6('0x30')][_0xf7b6('0x1f')]);_0xef184a[_0xf7b6('0x1e')]=qs[_0xf7b6('0x1e')](_0x3c188b['query'][_0xf7b6('0x1e')]);}_0xef184a[_0xf7b6('0x38')]=qs[_0xf7b6('0x39')](_0x3c188b[_0xf7b6('0x30')]['sort']);_0xef184a[_0xf7b6('0x3a')]=qs[_0xf7b6('0x32')](_[_0xf7b6('0x3b')](_0x3c188b[_0xf7b6('0x30')],_0x2bf531[_0xf7b6('0x32')]),_0xdd47f);if(_0x3c188b[_0xf7b6('0x30')]['filter']){_0xef184a[_0xf7b6('0x3a')]=_[_0xf7b6('0x3c')](_0xef184a[_0xf7b6('0x3a')],{'$or':_[_0xf7b6('0x2b')](_0xdd47f,function(_0x16c012){if(_0x16c012[_0xf7b6('0x3d')]!==_0xf7b6('0x3e')){var _0x1079be={};_0x1079be[_0x16c012['name']]={'$like':'%'+_0x3c188b[_0xf7b6('0x30')]['filter']+'%'};return _0x1079be;}})});}_0xef184a=_['merge']({},_0xef184a,_0x3c188b['options']);var _0x2bc2c0={'where':_0xef184a['where']};return db[_0xf7b6('0x3f')]['count'](_0x2bc2c0)['then'](function(_0x5595fa){_0x3c9f33['count']=_0x5595fa;if(_0x3c188b[_0xf7b6('0x30')][_0xf7b6('0x40')]){_0xef184a[_0xf7b6('0x41')]=[{'all':!![]}];}return db[_0xf7b6('0x3f')][_0xf7b6('0x42')](_0xef184a);})['then'](function(_0x518d9b){_0x3c9f33[_0xf7b6('0x43')]=_0x518d9b;return _0x3c9f33;})[_0xf7b6('0x26')](respondWithFilteredResult(_0x4688b5,_0xef184a))[_0xf7b6('0x44')](handleError(_0x4688b5,null));};exports[_0xf7b6('0x45')]=function(_0x1c76bc,_0x1e68da){var _0x3e5e13={'raw':!![],'where':{'id':_0x1c76bc[_0xf7b6('0x46')]['id']}},_0x14843a={};_0x14843a['model']=_['keys'](db[_0xf7b6('0x3f')][_0xf7b6('0x2c')]);_0x14843a[_0xf7b6('0x30')]=_[_0xf7b6('0x31')](_0x1c76bc[_0xf7b6('0x30')]);_0x14843a[_0xf7b6('0x32')]=_[_0xf7b6('0x33')](_0x14843a[_0xf7b6('0x2f')],_0x14843a['query']);_0x3e5e13[_0xf7b6('0x35')]=_[_0xf7b6('0x33')](_0x14843a[_0xf7b6('0x2f')],qs[_0xf7b6('0x34')](_0x1c76bc['query'][_0xf7b6('0x34')]));_0x3e5e13[_0xf7b6('0x35')]=_0x3e5e13[_0xf7b6('0x35')]['length']?_0x3e5e13[_0xf7b6('0x35')]:_0x14843a[_0xf7b6('0x2f')];if(_0x1c76bc[_0xf7b6('0x30')][_0xf7b6('0x40')]){_0x3e5e13[_0xf7b6('0x41')]=[{'all':!![]}];}_0x3e5e13=_[_0xf7b6('0x3c')]({},_0x3e5e13,_0x1c76bc[_0xf7b6('0x47')]);return db['ZendeskField'][_0xf7b6('0x48')](_0x3e5e13)[_0xf7b6('0x26')](handleEntityNotFound(_0x1e68da,null))[_0xf7b6('0x26')](respondWithResult(_0x1e68da,null))['catch'](handleError(_0x1e68da,null));};exports[_0xf7b6('0x49')]=function(_0x59f814,_0xb61fb7){return db[_0xf7b6('0x3f')][_0xf7b6('0x49')](_0x59f814[_0xf7b6('0x4a')],{})[_0xf7b6('0x26')](respondWithResult(_0xb61fb7,0xc9))[_0xf7b6('0x44')](handleError(_0xb61fb7,null));};exports['update']=function(_0x20f2f3,_0x2a9b5c){if(_0x20f2f3[_0xf7b6('0x4a')]['id']){delete _0x20f2f3[_0xf7b6('0x4a')]['id'];}return db['ZendeskField'][_0xf7b6('0x48')]({'where':{'id':_0x20f2f3[_0xf7b6('0x46')]['id']}})[_0xf7b6('0x26')](handleEntityNotFound(_0x2a9b5c,null))[_0xf7b6('0x26')](saveUpdates(_0x20f2f3[_0xf7b6('0x4a')],null))['then'](respondWithResult(_0x2a9b5c,null))['catch'](handleError(_0x2a9b5c,null));};exports[_0xf7b6('0x27')]=function(_0x17dc6f,_0xa58ef6){return db[_0xf7b6('0x3f')][_0xf7b6('0x48')]({'where':{'id':_0x17dc6f[_0xf7b6('0x46')]['id']}})[_0xf7b6('0x26')](handleEntityNotFound(_0xa58ef6,null))[_0xf7b6('0x26')](removeEntity(_0xa58ef6,null))['catch'](handleError(_0xa58ef6,null));}; \ No newline at end of file +var _0xe0e7=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x371d28,_0x5ae85c){var _0x4073ec=function(_0x580cbe){while(--_0x580cbe){_0x371d28['push'](_0x371d28['shift']());}};_0x4073ec(++_0x5ae85c);}(_0xe0e7,0x1a2));var _0x7e0e=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0xe0e7[_0x1627ae];return _0x34b38f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e0e('0x0'));var zipdir=require(_0x7e0e('0x1'));var jsonpatch=require(_0x7e0e('0x2'));var rp=require(_0x7e0e('0x3'));var moment=require(_0x7e0e('0x4'));var BPromise=require(_0x7e0e('0x5'));var Mustache=require('mustache');var util=require(_0x7e0e('0x6'));var path=require(_0x7e0e('0x7'));var sox=require(_0x7e0e('0x8'));var csv=require(_0x7e0e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e0e('0xa'));var _=require(_0x7e0e('0xb'));var squel=require(_0x7e0e('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e0e('0x9'));var querystring=require('querystring');var Papa=require(_0x7e0e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e0e('0xf'));var as=require(_0x7e0e('0x10'));var hardwareService=require(_0x7e0e('0x11'));var logger=require(_0x7e0e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7e0e('0x13'));var licenseUtil=require(_0x7e0e('0x14'));var db=require(_0x7e0e('0x15'))['db'];function respondWithStatusCode(_0x49ef0a,_0x3b3f80){_0x3b3f80=_0x3b3f80||0xcc;return function(_0x2bfaed){if(_0x2bfaed){return _0x49ef0a['sendStatus'](_0x3b3f80);}return _0x49ef0a[_0x7e0e('0x16')](_0x3b3f80)[_0x7e0e('0x17')]();};}function respondWithResult(_0x353702,_0x1b67df){_0x1b67df=_0x1b67df||0xc8;return function(_0x4ddcfe){if(_0x4ddcfe){return _0x353702[_0x7e0e('0x16')](_0x1b67df)[_0x7e0e('0x18')](_0x4ddcfe);}};}function respondWithFilteredResult(_0x473b64,_0x2e2717){return function(_0x47900e){if(_0x47900e){var _0x59c988=typeof _0x2e2717[_0x7e0e('0x19')]===_0x7e0e('0x1a')&&typeof _0x2e2717[_0x7e0e('0x1b')]==='undefined';var _0x5ecb73=_0x47900e[_0x7e0e('0x1c')];var _0x379d48=_0x59c988?0x0:_0x2e2717[_0x7e0e('0x19')];var _0x1fac1c=_0x59c988?_0x47900e[_0x7e0e('0x1c')]:_0x2e2717['offset']+_0x2e2717[_0x7e0e('0x1b')];var _0x39959f;if(_0x1fac1c>=_0x5ecb73){_0x1fac1c=_0x5ecb73;_0x39959f=0xc8;}else{_0x39959f=0xce;}_0x473b64[_0x7e0e('0x16')](_0x39959f);return _0x473b64[_0x7e0e('0x1d')](_0x7e0e('0x1e'),_0x379d48+'-'+_0x1fac1c+'/'+_0x5ecb73)[_0x7e0e('0x18')](_0x47900e);}return null;};}function patchUpdates(_0x8ae7ae){return function(_0x29f4c2){try{jsonpatch[_0x7e0e('0x1f')](_0x29f4c2,_0x8ae7ae,!![]);}catch(_0x30321d){return BPromise[_0x7e0e('0x20')](_0x30321d);}return _0x29f4c2[_0x7e0e('0x21')]();};}function saveUpdates(_0x2867b5,_0x145002){return function(_0x23007c){if(_0x23007c){return _0x23007c['update'](_0x2867b5)['then'](function(_0x4631f2){return _0x4631f2;});}return null;};}function removeEntity(_0x375061,_0x5e1cf9){return function(_0x102cfa){if(_0x102cfa){return _0x102cfa[_0x7e0e('0x22')]()[_0x7e0e('0x23')](function(){_0x375061['status'](0xcc)[_0x7e0e('0x17')]();});}};}function handleEntityNotFound(_0x34e2c5,_0x5beb92){return function(_0xa56cd3){if(!_0xa56cd3){_0x34e2c5[_0x7e0e('0x24')](0x194);}return _0xa56cd3;};}function handleError(_0xe1cf7b,_0x4382b3){_0x4382b3=_0x4382b3||0x1f4;return function(_0x26c71c){logger[_0x7e0e('0x25')](_0x26c71c[_0x7e0e('0x26')]);if(_0x26c71c[_0x7e0e('0x27')]){delete _0x26c71c[_0x7e0e('0x27')];}_0xe1cf7b[_0x7e0e('0x16')](_0x4382b3)[_0x7e0e('0x28')](_0x26c71c);};}exports[_0x7e0e('0x29')]=function(_0x371b5f,_0x76ad63){var _0x8c4b36={},_0x3c7505={},_0x2f2c9f={'count':0x0,'rows':[]};var _0x8d5338=_[_0x7e0e('0x2a')](db[_0x7e0e('0x2b')][_0x7e0e('0x2c')],function(_0x3304c2){return{'name':_0x3304c2['fieldName'],'type':_0x3304c2['type'][_0x7e0e('0x2d')]};});_0x3c7505[_0x7e0e('0x2e')]=_[_0x7e0e('0x2a')](_0x8d5338,_0x7e0e('0x27'));_0x3c7505[_0x7e0e('0x2f')]=_[_0x7e0e('0x30')](_0x371b5f['query']);_0x3c7505[_0x7e0e('0x31')]=_['intersection'](_0x3c7505[_0x7e0e('0x2e')],_0x3c7505[_0x7e0e('0x2f')]);_0x8c4b36[_0x7e0e('0x32')]=_[_0x7e0e('0x33')](_0x3c7505[_0x7e0e('0x2e')],qs[_0x7e0e('0x34')](_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x34')]));_0x8c4b36['attributes']=_0x8c4b36[_0x7e0e('0x32')]['length']?_0x8c4b36[_0x7e0e('0x32')]:_0x3c7505[_0x7e0e('0x2e')];if(!_0x371b5f['query'][_0x7e0e('0x35')](_0x7e0e('0x36'))){_0x8c4b36['limit']=qs[_0x7e0e('0x1b')](_0x371b5f['query'][_0x7e0e('0x1b')]);_0x8c4b36[_0x7e0e('0x19')]=qs[_0x7e0e('0x19')](_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x19')]);}_0x8c4b36['order']=qs[_0x7e0e('0x37')](_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x37')]);_0x8c4b36[_0x7e0e('0x38')]=qs['filters'](_[_0x7e0e('0x39')](_0x371b5f['query'],_0x3c7505['filters']),_0x8d5338);if(_0x371b5f['query'][_0x7e0e('0x3a')]){_0x8c4b36[_0x7e0e('0x38')]=_[_0x7e0e('0x3b')](_0x8c4b36[_0x7e0e('0x38')],{'$or':_[_0x7e0e('0x2a')](_0x8d5338,function(_0xa2ca3f){if(_0xa2ca3f[_0x7e0e('0x3c')]!=='VIRTUAL'){var _0x29b30c={};_0x29b30c[_0xa2ca3f[_0x7e0e('0x27')]]={'$like':'%'+_0x371b5f[_0x7e0e('0x2f')]['filter']+'%'};return _0x29b30c;}})});}_0x8c4b36=_[_0x7e0e('0x3b')]({},_0x8c4b36,_0x371b5f[_0x7e0e('0x3d')]);var _0x453b66={'where':_0x8c4b36[_0x7e0e('0x38')]};return db[_0x7e0e('0x2b')]['count'](_0x453b66)[_0x7e0e('0x23')](function(_0x1ac456){_0x2f2c9f['count']=_0x1ac456;if(_0x371b5f[_0x7e0e('0x2f')][_0x7e0e('0x3e')]){_0x8c4b36[_0x7e0e('0x3f')]=[{'all':!![]}];}return db[_0x7e0e('0x2b')][_0x7e0e('0x40')](_0x8c4b36);})[_0x7e0e('0x23')](function(_0x51e871){_0x2f2c9f[_0x7e0e('0x41')]=_0x51e871;return _0x2f2c9f;})['then'](respondWithFilteredResult(_0x76ad63,_0x8c4b36))[_0x7e0e('0x42')](handleError(_0x76ad63,null));};exports[_0x7e0e('0x43')]=function(_0x5d3008,_0x356d12){var _0x5f25bb={'raw':!![],'where':{'id':_0x5d3008['params']['id']}},_0xe25171={};_0xe25171['model']=_['keys'](db[_0x7e0e('0x2b')][_0x7e0e('0x2c')]);_0xe25171['query']=_['keys'](_0x5d3008[_0x7e0e('0x2f')]);_0xe25171['filters']=_['intersection'](_0xe25171[_0x7e0e('0x2e')],_0xe25171[_0x7e0e('0x2f')]);_0x5f25bb[_0x7e0e('0x32')]=_[_0x7e0e('0x33')](_0xe25171[_0x7e0e('0x2e')],qs[_0x7e0e('0x34')](_0x5d3008['query'][_0x7e0e('0x34')]));_0x5f25bb[_0x7e0e('0x32')]=_0x5f25bb[_0x7e0e('0x32')]['length']?_0x5f25bb['attributes']:_0xe25171['model'];if(_0x5d3008[_0x7e0e('0x2f')]['includeAll']){_0x5f25bb[_0x7e0e('0x3f')]=[{'all':!![]}];}_0x5f25bb=_[_0x7e0e('0x3b')]({},_0x5f25bb,_0x5d3008[_0x7e0e('0x3d')]);return db[_0x7e0e('0x2b')][_0x7e0e('0x44')](_0x5f25bb)[_0x7e0e('0x23')](handleEntityNotFound(_0x356d12,null))[_0x7e0e('0x23')](respondWithResult(_0x356d12,null))[_0x7e0e('0x42')](handleError(_0x356d12,null));};exports[_0x7e0e('0x45')]=function(_0x56eb19,_0x2163c8){return db[_0x7e0e('0x2b')]['create'](_0x56eb19['body'],{})['then'](respondWithResult(_0x2163c8,0xc9))[_0x7e0e('0x42')](handleError(_0x2163c8,null));};exports[_0x7e0e('0x46')]=function(_0x14cbce,_0xc69fc4){if(_0x14cbce[_0x7e0e('0x47')]['id']){delete _0x14cbce[_0x7e0e('0x47')]['id'];}return db['ZendeskField'][_0x7e0e('0x44')]({'where':{'id':_0x14cbce[_0x7e0e('0x48')]['id']}})[_0x7e0e('0x23')](handleEntityNotFound(_0xc69fc4,null))['then'](saveUpdates(_0x14cbce['body'],null))[_0x7e0e('0x23')](respondWithResult(_0xc69fc4,null))[_0x7e0e('0x42')](handleError(_0xc69fc4,null));};exports[_0x7e0e('0x22')]=function(_0x1342a6,_0x2f1c7d){return db['ZendeskField'][_0x7e0e('0x44')]({'where':{'id':_0x1342a6[_0x7e0e('0x48')]['id']}})[_0x7e0e('0x23')](handleEntityNotFound(_0x2f1c7d,null))[_0x7e0e('0x23')](removeEntity(_0x2f1c7d,null))[_0x7e0e('0x42')](handleError(_0x2f1c7d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1e874a4..641451d 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 _0xa413=['ZendeskField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskField.attributes','define'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xa413,0xd3));var _0x3a41=function(_0x299c16,_0x5d6080){_0x299c16=_0x299c16-0x0;var _0x10d8f6=_0xa413[_0x299c16];return _0x10d8f6;};'use strict';var _=require(_0x3a41('0x0'));var util=require(_0x3a41('0x1'));var logger=require(_0x3a41('0x2'))(_0x3a41('0x3'));var moment=require(_0x3a41('0x4'));var BPromise=require(_0x3a41('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a41('0x6'));var rimraf=require('rimraf');var config=require(_0x3a41('0x7'));var attributes=require(_0x3a41('0x8'));module['exports']=function(_0x470a15,_0x564497){return _0x470a15[_0x3a41('0x9')](_0x3a41('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x3a41('0xb'),_0x3a41('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x040a=['../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49eb06,_0x47d2b6){var _0x4b8d67=function(_0xe1161e){while(--_0xe1161e){_0x49eb06['push'](_0x49eb06['shift']());}};_0x4b8d67(++_0x47d2b6);}(_0x040a,0x13e));var _0xa040=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x040a[_0xb7cb72];return _0x4b7570;};'use strict';var _=require('lodash');var util=require(_0xa040('0x0'));var logger=require(_0xa040('0x1'))(_0xa040('0x2'));var moment=require('moment');var BPromise=require(_0xa040('0x3'));var rp=require(_0xa040('0x4'));var fs=require('fs');var path=require(_0xa040('0x5'));var rimraf=require('rimraf');var config=require(_0xa040('0x6'));var attributes=require(_0xa040('0x7'));module[_0xa040('0x8')]=function(_0x224f88,_0x508b95){return _0x224f88['define']('ZendeskField',attributes,{'tableName':_0xa040('0x9'),'paranoid':![],'indexes':[{'name':_0xa040('0xa'),'fields':['idField',_0xa040('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 f9d65df..6b00282 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 _0x1eb1=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1eb1,0x183));var _0x11eb=function(_0x54ea62,_0x6656c0){_0x54ea62=_0x54ea62-0x0;var _0x38e93e=_0x1eb1[_0x54ea62];return _0x38e93e;};'use strict';var _=require(_0x11eb('0x0'));var util=require(_0x11eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x11eb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11eb('0x3'))['db'];var utils=require(_0x11eb('0x4'));var logger=require(_0x11eb('0x5'))(_0x11eb('0x6'));var config=require('../../config/environment');var jayson=require(_0x11eb('0x7'));var client=jayson[_0x11eb('0x8')][_0x11eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x186a91,_0x3e7b66,_0x30d0df){return new BPromise(function(_0x28834d,_0x44b3fe){return client[_0x11eb('0xa')](_0x186a91,_0x30d0df)[_0x11eb('0xb')](function(_0x53a928){logger[_0x11eb('0xc')](_0x11eb('0xd'),_0x3e7b66,_0x11eb('0xe'));logger[_0x11eb('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3e7b66,_0x11eb('0xe'),JSON[_0x11eb('0x10')](_0x53a928));if(_0x53a928['error']){if(_0x53a928[_0x11eb('0x11')][_0x11eb('0x12')]===0x1f4){logger[_0x11eb('0x11')](_0x11eb('0xd'),_0x3e7b66,_0x53a928[_0x11eb('0x11')]['message']);return _0x44b3fe(_0x53a928[_0x11eb('0x11')][_0x11eb('0x13')]);}logger['error'](_0x11eb('0xd'),_0x3e7b66,_0x53a928[_0x11eb('0x11')][_0x11eb('0x13')]);return _0x28834d(_0x53a928['error'][_0x11eb('0x13')]);}else{logger[_0x11eb('0xc')](_0x11eb('0xd'),_0x3e7b66,_0x11eb('0xe'));_0x28834d(_0x53a928[_0x11eb('0x14')][_0x11eb('0x13')]);}})[_0x11eb('0x15')](function(_0x43d681){logger[_0x11eb('0x11')](_0x11eb('0xd'),_0x3e7b66,_0x43d681);_0x44b3fe(_0x43d681);});});} \ No newline at end of file +var _0x700e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x29b07d,_0x5567c2){var _0x1a6eaf=function(_0x266a8a){while(--_0x266a8a){_0x29b07d['push'](_0x29b07d['shift']());}};_0x1a6eaf(++_0x5567c2);}(_0x700e,0x1dd));var _0xe700=function(_0x5d30f8,_0x5e9426){_0x5d30f8=_0x5d30f8-0x0;var _0x2d82f7=_0x700e[_0x5d30f8];return _0x2d82f7;};'use strict';var _=require(_0xe700('0x0'));var util=require(_0xe700('0x1'));var moment=require(_0xe700('0x2'));var BPromise=require(_0xe700('0x3'));var rs=require(_0xe700('0x4'));var fs=require('fs');var Redis=require(_0xe700('0x5'));var db=require(_0xe700('0x6'))['db'];var utils=require(_0xe700('0x7'));var logger=require(_0xe700('0x8'))(_0xe700('0x9'));var config=require(_0xe700('0xa'));var jayson=require(_0xe700('0xb'));var client=jayson[_0xe700('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6a2e,_0x2f46ae,_0xdb11fd){return new BPromise(function(_0x1b672d,_0x2fcd9c){return client[_0xe700('0xd')](_0x4e6a2e,_0xdb11fd)['then'](function(_0xc7ee48){logger[_0xe700('0xe')]('ZendeskField,\x20%s,\x20%s',_0x2f46ae,_0xe700('0xf'));logger['debug'](_0xe700('0x10'),_0x2f46ae,_0xe700('0xf'),JSON[_0xe700('0x11')](_0xc7ee48));if(_0xc7ee48[_0xe700('0x12')]){if(_0xc7ee48[_0xe700('0x12')][_0xe700('0x13')]===0x1f4){logger['error'](_0xe700('0x14'),_0x2f46ae,_0xc7ee48[_0xe700('0x12')][_0xe700('0x15')]);return _0x2fcd9c(_0xc7ee48[_0xe700('0x12')]['message']);}logger[_0xe700('0x12')](_0xe700('0x14'),_0x2f46ae,_0xc7ee48[_0xe700('0x12')][_0xe700('0x15')]);return _0x1b672d(_0xc7ee48[_0xe700('0x12')][_0xe700('0x15')]);}else{logger['info'](_0xe700('0x14'),_0x2f46ae,_0xe700('0xf'));_0x1b672d(_0xc7ee48[_0xe700('0x16')][_0xe700('0x15')]);}})[_0xe700('0x17')](function(_0x3e0ea1){logger[_0xe700('0x12')](_0xe700('0x14'),_0x2f46ae,_0x3e0ea1);_0x2fcd9c(_0x3e0ea1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b15822b..e5b8fce 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 _0x927a=['getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x207157,_0x1fc7e3){var _0x32a711=function(_0x15db42){while(--_0x15db42){_0x207157['push'](_0x207157['shift']());}};_0x32a711(++_0x1fc7e3);}(_0x927a,0x1e7));var _0xa927=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x927a[_0x374ada];return _0x449ed8;};'use strict';var multer=require(_0xa927('0x0'));var util=require(_0xa927('0x1'));var path=require(_0xa927('0x2'));var timeout=require(_0xa927('0x3'));var express=require(_0xa927('0x4'));var router=express[_0xa927('0x5')]();var fs_extra=require(_0xa927('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa927('0x7'));var config=require(_0xa927('0x8'));var controller=require(_0xa927('0x9'));router[_0xa927('0xa')]('/',auth[_0xa927('0xb')](),controller[_0xa927('0xc')]);router[_0xa927('0xa')](_0xa927('0xd'),auth[_0xa927('0xb')](),controller['show']);router[_0xa927('0xa')](_0xa927('0xe'),auth['isAuthenticated'](),controller[_0xa927('0xf')]);router[_0xa927('0xa')](_0xa927('0x10'),auth['isAuthenticated'](),controller[_0xa927('0x11')]);router[_0xa927('0x12')]('/',auth[_0xa927('0xb')](),controller['create']);router[_0xa927('0x12')](_0xa927('0xe'),auth[_0xa927('0xb')](),controller[_0xa927('0x13')]);router[_0xa927('0x14')](_0xa927('0xd'),auth[_0xa927('0xb')](),controller['update']);router[_0xa927('0x15')](_0xa927('0xd'),auth[_0xa927('0xb')](),controller[_0xa927('0x16')]);module[_0xa927('0x17')]=router; \ No newline at end of file +var _0x7b70=['../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','show','get','/:id/configurations','post','create','addConfiguration','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x933443,_0x247567){var _0x457612=function(_0x5a89d3){while(--_0x5a89d3){_0x933443['push'](_0x933443['shift']());}};_0x457612(++_0x247567);}(_0x7b70,0x1de));var _0x07b7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x7b70[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var path=require(_0x07b7('0x2'));var timeout=require(_0x07b7('0x3'));var express=require(_0x07b7('0x4'));var router=express['Router']();var fs_extra=require(_0x07b7('0x5'));var auth=require(_0x07b7('0x6'));var interaction=require(_0x07b7('0x7'));var config=require('../../config/environment');var controller=require(_0x07b7('0x8'));router['get']('/',auth[_0x07b7('0x9')](),controller[_0x07b7('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x07b7('0xb')]);router[_0x07b7('0xc')](_0x07b7('0xd'),auth[_0x07b7('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x07b7('0x9')](),controller['getFields']);router[_0x07b7('0xe')]('/',auth[_0x07b7('0x9')](),controller[_0x07b7('0xf')]);router[_0x07b7('0xe')]('/:id/configurations',auth[_0x07b7('0x9')](),controller[_0x07b7('0x10')]);router['put']('/:id',auth[_0x07b7('0x9')](),controller[_0x07b7('0x11')]);router[_0x07b7('0x12')](_0x07b7('0x13'),auth[_0x07b7('0x9')](),controller[_0x07b7('0x14')]);module[_0x07b7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 27b5a59..fe8713f 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 _0x54ef=['STRING','sequelize','exports'];(function(_0x31db02,_0x330986){var _0x1b2e55=function(_0x121a87){while(--_0x121a87){_0x31db02['push'](_0x31db02['shift']());}};_0x1b2e55(++_0x330986);}(_0x54ef,0x112));var _0xf54e=function(_0x21b03c,_0x14a572){_0x21b03c=_0x21b03c-0x0;var _0x17a160=_0x54ef[_0x21b03c];return _0x17a160;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x9a19,0x114));var _0x99a1=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x9a19[_0x2ae2ad];return _0x26dbd7;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x99a1('0x2')]},'zone':{'type':Sequelize[_0x99a1('0x2')]},'clientId':{'type':Sequelize[_0x99a1('0x2')]},'clientSecret':{'type':Sequelize[_0x99a1('0x2')]},'serverUrl':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x99a1('0x2')]},'refreshToken':{'type':Sequelize[_0x99a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a91dca1..ac12c1b 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 _0x34d5=['statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','undefined','limit','offset','count','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','ZohoAccount','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','update','destroy','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','test'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x34d5,0xf9));var _0x534d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x34d5[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x534d('0x0'));var rimraf=require(_0x534d('0x1'));var zipdir=require(_0x534d('0x2'));var jsonpatch=require(_0x534d('0x3'));var rp=require(_0x534d('0x4'));var moment=require(_0x534d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x534d('0x6'));var sox=require(_0x534d('0x7'));var csv=require(_0x534d('0x8'));var ejs=require(_0x534d('0x9'));var fs=require('fs');var fs_extra=require(_0x534d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x534d('0xb'));var jsforce=require(_0x534d('0xc'));var deskjs=require(_0x534d('0xd'));var toCsv=require(_0x534d('0x8'));var querystring=require(_0x534d('0xe'));var Papa=require(_0x534d('0xf'));var Redis=require(_0x534d('0x10'));var authService=require(_0x534d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x534d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x534d('0x13'));var config=require(_0x534d('0x14'));var licenseUtil=require(_0x534d('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x534d('0x16'));function respondWithStatusCode(_0x419285,_0x2e2a70){_0x2e2a70=_0x2e2a70||0xcc;return function(_0x562072){if(_0x562072){return _0x419285['sendStatus'](_0x2e2a70);}return _0x419285[_0x534d('0x17')](_0x2e2a70)[_0x534d('0x18')]();};}function respondWithResult(_0x4be48f,_0x3b1cd9){_0x3b1cd9=_0x3b1cd9||0xc8;return function(_0x2b26fb){if(_0x2b26fb){return _0x4be48f[_0x534d('0x17')](_0x3b1cd9)['json'](_0x2b26fb);}};}function respondWithFilteredResult(_0x3df95b,_0x176c66){return function(_0x5c64cf){if(_0x5c64cf){var _0x3f97c2=typeof _0x176c66['offset']===_0x534d('0x19')&&typeof _0x176c66[_0x534d('0x1a')]==='undefined';var _0x33522e=_0x5c64cf['count'];var _0x3eb658=_0x3f97c2?0x0:_0x176c66[_0x534d('0x1b')];var _0x3211e6=_0x3f97c2?_0x5c64cf[_0x534d('0x1c')]:_0x176c66[_0x534d('0x1b')]+_0x176c66[_0x534d('0x1a')];var _0x1e22f3;if(_0x3211e6>=_0x33522e){_0x3211e6=_0x33522e;_0x1e22f3=0xc8;}else{_0x1e22f3=0xce;}_0x3df95b[_0x534d('0x17')](_0x1e22f3);return _0x3df95b[_0x534d('0x1d')](_0x534d('0x1e'),_0x3eb658+'-'+_0x3211e6+'/'+_0x33522e)['json'](_0x5c64cf);}return null;};}function patchUpdates(_0x572df6){return function(_0x1bed4f){try{jsonpatch[_0x534d('0x1f')](_0x1bed4f,_0x572df6,!![]);}catch(_0x155d18){return BPromise['reject'](_0x155d18);}return _0x1bed4f[_0x534d('0x20')]();};}function saveUpdates(_0x551d9c,_0x417864){return function(_0x5261ba){if(_0x5261ba){return _0x5261ba['update'](_0x551d9c)[_0x534d('0x21')](function(_0x2e971e){return _0x2e971e;});}return null;};}function removeEntity(_0x4ca5d0,_0x145874){return function(_0x1902d8){if(_0x1902d8){return _0x1902d8['destroy']()['then'](function(){_0x4ca5d0['status'](0xcc)[_0x534d('0x18')]();});}};}function handleEntityNotFound(_0x5579d0,_0x735688){return function(_0x34a644){if(!_0x34a644){_0x5579d0[_0x534d('0x22')](0x194);}return _0x34a644;};}function handleError(_0x4ba38a,_0x3fb995){_0x3fb995=_0x3fb995||0x1f4;return function(_0x5b1069){logger[_0x534d('0x23')](_0x5b1069[_0x534d('0x24')]);if(_0x5b1069[_0x534d('0x25')]){delete _0x5b1069['name'];}_0x4ba38a[_0x534d('0x17')](_0x3fb995)[_0x534d('0x26')](_0x5b1069);};}exports[_0x534d('0x27')]=function(_0xda51ea,_0x210aad){var _0x1bebc5={},_0x4d1b89={},_0x919b06={'count':0x0,'rows':[]};var _0x53c159=_['map'](db[_0x534d('0x28')]['rawAttributes'],function(_0x30ae9d){return{'name':_0x30ae9d[_0x534d('0x29')],'type':_0x30ae9d[_0x534d('0x2a')]['key']};});_0x4d1b89[_0x534d('0x2b')]=_[_0x534d('0x2c')](_0x53c159,_0x534d('0x25'));_0x4d1b89[_0x534d('0x2d')]=_[_0x534d('0x2e')](_0xda51ea[_0x534d('0x2d')]);_0x4d1b89['filters']=_[_0x534d('0x2f')](_0x4d1b89[_0x534d('0x2b')],_0x4d1b89[_0x534d('0x2d')]);_0x1bebc5[_0x534d('0x30')]=_[_0x534d('0x2f')](_0x4d1b89[_0x534d('0x2b')],qs[_0x534d('0x31')](_0xda51ea[_0x534d('0x2d')][_0x534d('0x31')]));_0x1bebc5['attributes']=_0x1bebc5[_0x534d('0x30')][_0x534d('0x32')]?_0x1bebc5[_0x534d('0x30')]:_0x4d1b89[_0x534d('0x2b')];if(!_0xda51ea[_0x534d('0x2d')][_0x534d('0x33')]('nolimit')){_0x1bebc5[_0x534d('0x1a')]=qs[_0x534d('0x1a')](_0xda51ea[_0x534d('0x2d')]['limit']);_0x1bebc5['offset']=qs[_0x534d('0x1b')](_0xda51ea['query'][_0x534d('0x1b')]);}_0x1bebc5[_0x534d('0x34')]=qs['sort'](_0xda51ea[_0x534d('0x2d')][_0x534d('0x35')]);_0x1bebc5['where']=qs['filters'](_[_0x534d('0x36')](_0xda51ea[_0x534d('0x2d')],_0x4d1b89[_0x534d('0x37')]),_0x53c159);if(_0xda51ea[_0x534d('0x2d')][_0x534d('0x38')]){_0x1bebc5['where']=_[_0x534d('0x39')](_0x1bebc5[_0x534d('0x3a')],{'$or':_[_0x534d('0x2c')](_0x53c159,function(_0x590373){if(_0x590373[_0x534d('0x2a')]!==_0x534d('0x3b')){var _0x32422a={};_0x32422a[_0x590373['name']]={'$like':'%'+_0xda51ea[_0x534d('0x2d')][_0x534d('0x38')]+'%'};return _0x32422a;}})});}_0x1bebc5=_[_0x534d('0x39')]({},_0x1bebc5,_0xda51ea[_0x534d('0x3c')]);var _0x448ba5={'where':_0x1bebc5[_0x534d('0x3a')]};return db[_0x534d('0x28')]['count'](_0x448ba5)[_0x534d('0x21')](function(_0x29a7e0){_0x919b06[_0x534d('0x1c')]=_0x29a7e0;if(_0xda51ea[_0x534d('0x2d')]['includeAll']){_0x1bebc5[_0x534d('0x3d')]=[{'all':!![]}];}return db[_0x534d('0x28')][_0x534d('0x3e')](_0x1bebc5);})[_0x534d('0x21')](function(_0x6dd115){_0x919b06[_0x534d('0x3f')]=_0x6dd115;return _0x919b06;})['then'](respondWithFilteredResult(_0x210aad,_0x1bebc5))[_0x534d('0x40')](handleError(_0x210aad,null));};exports[_0x534d('0x41')]=function(_0x458b85,_0x273090){var _0x517fbd={'raw':![],'where':{'id':_0x458b85[_0x534d('0x42')]['id']}},_0x445ca3={};_0x445ca3[_0x534d('0x2b')]=_[_0x534d('0x2e')](db[_0x534d('0x28')]['rawAttributes']);_0x445ca3[_0x534d('0x2d')]=_[_0x534d('0x2e')](_0x458b85[_0x534d('0x2d')]);_0x445ca3[_0x534d('0x37')]=_['intersection'](_0x445ca3[_0x534d('0x2b')],_0x445ca3[_0x534d('0x2d')]);_0x517fbd[_0x534d('0x30')]=_[_0x534d('0x2f')](_0x445ca3['model'],qs[_0x534d('0x31')](_0x458b85[_0x534d('0x2d')][_0x534d('0x31')]));_0x517fbd[_0x534d('0x30')]=_0x517fbd['attributes'][_0x534d('0x32')]?_0x517fbd['attributes']:_0x445ca3['model'];if(_0x458b85[_0x534d('0x2d')]['includeAll']){_0x517fbd[_0x534d('0x3d')]=[{'all':!![]}];}_0x517fbd=_[_0x534d('0x39')]({},_0x517fbd,_0x458b85[_0x534d('0x3c')]);return db['ZohoAccount'][_0x534d('0x43')](_0x517fbd)[_0x534d('0x21')](handleEntityNotFound(_0x273090,null))[_0x534d('0x21')](respondWithResult(_0x273090,null))['catch'](handleError(_0x273090,null));};exports[_0x534d('0x44')]=function(_0x43acbb,_0x9646ef){return db['ZohoAccount'][_0x534d('0x44')](_0x43acbb[_0x534d('0x45')],{})[_0x534d('0x21')](respondWithResult(_0x9646ef,0xc9))[_0x534d('0x40')](handleError(_0x9646ef,null));};exports[_0x534d('0x46')]=function(_0x38da88,_0x4b9fb8){if(_0x38da88[_0x534d('0x45')]['id']){delete _0x38da88['body']['id'];}return db['ZohoAccount'][_0x534d('0x43')]({'where':{'id':_0x38da88[_0x534d('0x42')]['id']}})[_0x534d('0x21')](handleEntityNotFound(_0x4b9fb8,null))[_0x534d('0x21')](saveUpdates(_0x38da88['body'],null))[_0x534d('0x21')](respondWithResult(_0x4b9fb8,null))['catch'](handleError(_0x4b9fb8,null));};exports[_0x534d('0x47')]=function(_0x44353d,_0xa8957d){return db[_0x534d('0x28')][_0x534d('0x43')]({'where':{'id':_0x44353d['params']['id']}})[_0x534d('0x21')](handleEntityNotFound(_0xa8957d,null))['then'](removeEntity(_0xa8957d,null))[_0x534d('0x40')](handleError(_0xa8957d,null));};exports[_0x534d('0x48')]=function(_0xcc3136,_0x2c8025,_0x24702f){var _0x3dae6a={};var _0x1208bd={};var _0x1d530d;var _0x354dd2;return db[_0x534d('0x28')][_0x534d('0x49')]({'where':{'id':_0xcc3136[_0x534d('0x42')]['id']}})[_0x534d('0x21')](handleEntityNotFound(_0x2c8025,null))[_0x534d('0x21')](function(_0x24e2d3){if(_0x24e2d3){_0x1d530d=_0x24e2d3;_0x1208bd[_0x534d('0x2b')]=_[_0x534d('0x2e')](db[_0x534d('0x4a')]['rawAttributes']);_0x1208bd[_0x534d('0x2d')]=_[_0x534d('0x2e')](_0xcc3136['query']);_0x1208bd[_0x534d('0x37')]=_['intersection'](_0x1208bd[_0x534d('0x2b')],_0x1208bd['query']);_0x3dae6a['attributes']=_[_0x534d('0x2f')](_0x1208bd[_0x534d('0x2b')],qs['fields'](_0xcc3136[_0x534d('0x2d')][_0x534d('0x31')]));_0x3dae6a[_0x534d('0x30')]=_0x3dae6a[_0x534d('0x30')][_0x534d('0x32')]?_0x3dae6a[_0x534d('0x30')]:_0x1208bd[_0x534d('0x2b')];_0x3dae6a['order']=qs['sort'](_0xcc3136[_0x534d('0x2d')]['sort']);_0x3dae6a[_0x534d('0x3a')]=qs['filters'](_['pick'](_0xcc3136[_0x534d('0x2d')],_0x1208bd[_0x534d('0x37')]));if(_0xcc3136['query'][_0x534d('0x38')]){_0x3dae6a[_0x534d('0x3a')]=_['merge'](_0x3dae6a[_0x534d('0x3a')],{'$or':_['map'](_0x3dae6a['attributes'],function(_0x5ce8cc){var _0xda1293={};_0xda1293[_0x5ce8cc]={'$like':'%'+_0xcc3136[_0x534d('0x2d')][_0x534d('0x38')]+'%'};return _0xda1293;})});}_0x3dae6a=_[_0x534d('0x39')]({},_0x3dae6a,_0xcc3136[_0x534d('0x3c')]);return _0x1d530d['getConfigurations'](_0x3dae6a);}})[_0x534d('0x21')](function(_0x44ea0a){if(_0x44ea0a){_0x354dd2=_0x44ea0a[_0x534d('0x32')];if(!_0xcc3136['query'][_0x534d('0x33')](_0x534d('0x4b'))){_0x3dae6a[_0x534d('0x1a')]=qs[_0x534d('0x1a')](_0xcc3136[_0x534d('0x2d')][_0x534d('0x1a')]);_0x3dae6a[_0x534d('0x1b')]=qs[_0x534d('0x1b')](_0xcc3136[_0x534d('0x2d')][_0x534d('0x1b')]);}return _0x1d530d[_0x534d('0x48')](_0x3dae6a);}})[_0x534d('0x21')](function(_0x318517){if(_0x318517){return _0x318517?{'count':_0x354dd2,'rows':_0x318517}:null;}})[_0x534d('0x21')](respondWithResult(_0x2c8025,null))['catch'](handleError(_0x2c8025,null));};exports[_0x534d('0x4c')]=function(_0x37bcf0,_0x3e5bf4,_0x587fe9){if(_0x37bcf0['body']['id']){delete _0x37bcf0[_0x534d('0x45')]['id'];}return db[_0x534d('0x28')][_0x534d('0x49')]({'where':{'id':_0x37bcf0[_0x534d('0x42')]['id']}})[_0x534d('0x21')](handleEntityNotFound(_0x3e5bf4,null))[_0x534d('0x21')](function(_0x2228b0){if(_0x2228b0){_0x37bcf0[_0x534d('0x45')][_0x534d('0x4d')]=_0x2228b0['id'];_0x37bcf0[_0x534d('0x45')][_0x534d('0x4e')]=integrations[_0x534d('0x4f')](_0x37bcf0[_0x534d('0x45')]['channel'],_0x37bcf0['body'][_0x534d('0x2a')]);_0x37bcf0[_0x534d('0x45')][_0x534d('0x50')]=integrations[_0x534d('0x51')](_0x37bcf0[_0x534d('0x45')][_0x534d('0x52')],_0x37bcf0[_0x534d('0x45')][_0x534d('0x2a')]);return db[_0x534d('0x4a')][_0x534d('0x44')](_0x37bcf0[_0x534d('0x45')],{'include':[{'model':db[_0x534d('0x53')],'as':_0x534d('0x4e')},{'model':db[_0x534d('0x53')],'as':_0x534d('0x50')}]});}return null;})[_0x534d('0x21')](respondWithResult(_0x3e5bf4,null))[_0x534d('0x40')](handleError(_0x3e5bf4,null));};function getAccessToken(_0x35ac63){return new Promise(function(_0x53b4a9,_0x292786){var _0x592a6b;switch(_0x35ac63[_0x534d('0x54')]){case'US':_0x592a6b=_0x534d('0x55');break;case'AU':_0x592a6b=_0x534d('0x56');break;case'EU':_0x592a6b=_0x534d('0x57');break;case'IN':_0x592a6b='https://accounts.zoho.in';break;case'CN':_0x592a6b=_0x534d('0x58');break;default:_0x592a6b='https://accounts.zoho.eu';break;}var _0x35e576={'method':_0x534d('0x59'),'uri':_0x592a6b+'/oauth/v2/token','qs':{'refresh_token':_0x35ac63[_0x534d('0x5a')],'client_id':_0x35ac63[_0x534d('0x5b')],'client_secret':_0x35ac63[_0x534d('0x5c')],'grant_type':_0x534d('0x5d')},'json':!![]};return rp(_0x35e576)[_0x534d('0x21')](function(_0x54e44c){if(_0x54e44c[_0x534d('0x5e')]){_0x53b4a9(_0x54e44c[_0x534d('0x5e')]);}else{_0x292786('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x20233f){_0x292786(_0x20233f);});});}exports[_0x534d('0x5f')]=function(_0x224eea,_0x734f31,_0x12fbab){var _0x425db2,_0x1714f0,_0x55d044,_0x3d3336,_0x2cecb5;return db[_0x534d('0x28')][_0x534d('0x49')]({'where':{'id':_0x224eea['params']['id']},'attributes':['id',_0x534d('0x60'),_0x534d('0x54'),_0x534d('0x5b'),_0x534d('0x5c'),_0x534d('0x61'),'code',_0x534d('0x5a')]})[_0x534d('0x21')](handleEntityNotFound(_0x734f31,null))[_0x534d('0x21')](function(_0x33dc1b){_0x2cecb5=_0x33dc1b;_0x425db2=_0x2cecb5['host'];_0x1714f0=_0x425db2===_0x534d('0x62')?'eu':'com';_0x55d044=_0x2cecb5[_0x534d('0x61')];var _0x2dae45=_0x55d044[_0x534d('0x63')](-0x1);if(_0x2dae45==='/'||_0x2dae45==='\x5c'||_0x2dae45===':'){_0x55d044=_0x55d044[_0x534d('0x64')](0x0,_0x55d044['lastIndexOf'](_0x2dae45));}if(!_0x2cecb5[_0x534d('0x5a')]){throw new Error(_0x534d('0x65'));}return getAccessToken(_0x2cecb5);})[_0x534d('0x21')](function(_0x44b771){if(_0x44b771){return rp({'method':_0x534d('0x66'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1714f0),'qs':{'module':_0x534d('0x67')},'headers':{'Authorization':_0x534d('0x68')+_0x44b771},'json':!![]});}})[_0x534d('0x21')](function(_0x2eabc8){if(_0x2eabc8){if(_0x2eabc8[_0x534d('0x69')]&&_0x2eabc8[_0x534d('0x69')]['error']){throw new Error(_0x2eabc8[_0x534d('0x69')][_0x534d('0x23')]['message']);}var _0x4b22ec=[];var _0x33d0b4=[];var _0x1c82fb=['Owner',_0x534d('0x6a'),_0x534d('0x6b'),'WhoId',_0x534d('0x6c'),_0x534d('0x6d'),_0x534d('0x6e'),_0x534d('0x6f')];_0x33d0b4=_['remove'](_0x2eabc8[_0x534d('0x31')],function(_0x63fff3){return _0x1c82fb[_0x534d('0x70')](_0x63fff3[_0x534d('0x71')]);});for(var _0x450a97=0x0;_0x450a97<_0x33d0b4[_0x534d('0x32')];_0x450a97++){if(_0x33d0b4[_0x450a97][_0x534d('0x72')]===![]){_0x4b22ec[_0x534d('0x73')]({'id':_0x33d0b4[_0x450a97]['id'],'name':_0x33d0b4[_0x450a97]['display_label'],'custom':_0x33d0b4[_0x450a97][_0x534d('0x74')],'options':_0x33d0b4[_0x450a97][_0x534d('0x75')]===_0x534d('0x76')&&_0x33d0b4[_0x450a97]['pick_list_values']['length']>-0x1?_['map'](_0x33d0b4[_0x450a97]['pick_list_values'],function(_0x3084c2){return{'name':_0x3084c2,'value':_0x3084c2};}):[]});}}return{'count':_0x4b22ec['length'],'rows':_0x4b22ec};}else{return{'count':0x0,'rows':[]};}})[_0x534d('0x21')](respondWithResult(_0x734f31,null))[_0x534d('0x40')](function(_0x1c242d){var _0x3f1b55=_0x224eea[_0x534d('0x2d')][_0x534d('0x77')]?0x1f4:_0x1c242d[_0x534d('0x78')]||0x1f4;logger[_0x534d('0x23')](_0x534d('0x79'),_0x534d('0x5f'),_0x3f1b55,JSON['stringify'](_0x1c242d));delete _0x1c242d[_0x534d('0x25')];if(_0x3f1b55===0x191){_0x3f1b55=0x190;}_0x734f31['status'](_0x3f1b55)[_0x534d('0x26')](_0x224eea[_0x534d('0x2d')][_0x534d('0x77')]?{'message':_0x534d('0x7a'),'statusCode':_0x1c242d[_0x534d('0x78')]}:_0x1c242d);});}; \ No newline at end of file +var _0xe591=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZohoAccount','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x2f384e,_0x237f8b){var _0x56f0dd=function(_0x5087ff){while(--_0x5087ff){_0x2f384e['push'](_0x2f384e['shift']());}};_0x56f0dd(++_0x237f8b);}(_0xe591,0x103));var _0x1e59=function(_0x579f8e,_0x468418){_0x579f8e=_0x579f8e-0x0;var _0x227fa4=_0xe591[_0x579f8e];return _0x227fa4;};'use strict';var emlformat=require(_0x1e59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e59('0x1'));var jsonpatch=require(_0x1e59('0x2'));var rp=require(_0x1e59('0x3'));var moment=require(_0x1e59('0x4'));var BPromise=require(_0x1e59('0x5'));var Mustache=require('mustache');var util=require(_0x1e59('0x6'));var path=require(_0x1e59('0x7'));var sox=require(_0x1e59('0x8'));var csv=require(_0x1e59('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1e59('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e59('0xb'));var deskjs=require(_0x1e59('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1e59('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1e59('0xe'));var as=require(_0x1e59('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e59('0x10'));var utils=require(_0x1e59('0x11'));var config=require(_0x1e59('0x12'));var licenseUtil=require(_0x1e59('0x13'));var db=require(_0x1e59('0x14'))['db'];var integrations=require(_0x1e59('0x15'));function respondWithStatusCode(_0x31a900,_0x698198){_0x698198=_0x698198||0xcc;return function(_0x2664db){if(_0x2664db){return _0x31a900[_0x1e59('0x16')](_0x698198);}return _0x31a900['status'](_0x698198)[_0x1e59('0x17')]();};}function respondWithResult(_0x36d369,_0x2efc79){_0x2efc79=_0x2efc79||0xc8;return function(_0x523fbd){if(_0x523fbd){return _0x36d369[_0x1e59('0x18')](_0x2efc79)['json'](_0x523fbd);}};}function respondWithFilteredResult(_0x43a9dd,_0x1c1459){return function(_0x270465){if(_0x270465){var _0x5112cd=typeof _0x1c1459[_0x1e59('0x19')]===_0x1e59('0x1a')&&typeof _0x1c1459['limit']===_0x1e59('0x1a');var _0x2d03aa=_0x270465['count'];var _0x11639f=_0x5112cd?0x0:_0x1c1459[_0x1e59('0x19')];var _0xb4f3c3=_0x5112cd?_0x270465[_0x1e59('0x1b')]:_0x1c1459[_0x1e59('0x19')]+_0x1c1459[_0x1e59('0x1c')];var _0x4b2938;if(_0xb4f3c3>=_0x2d03aa){_0xb4f3c3=_0x2d03aa;_0x4b2938=0xc8;}else{_0x4b2938=0xce;}_0x43a9dd[_0x1e59('0x18')](_0x4b2938);return _0x43a9dd['set'](_0x1e59('0x1d'),_0x11639f+'-'+_0xb4f3c3+'/'+_0x2d03aa)['json'](_0x270465);}return null;};}function patchUpdates(_0x3bed4f){return function(_0xa85198){try{jsonpatch[_0x1e59('0x1e')](_0xa85198,_0x3bed4f,!![]);}catch(_0x5eabce){return BPromise[_0x1e59('0x1f')](_0x5eabce);}return _0xa85198[_0x1e59('0x20')]();};}function saveUpdates(_0x192a0b,_0x181fe9){return function(_0x2bb8f9){if(_0x2bb8f9){return _0x2bb8f9[_0x1e59('0x21')](_0x192a0b)[_0x1e59('0x22')](function(_0x588f8b){return _0x588f8b;});}return null;};}function removeEntity(_0x103263,_0x55b42a){return function(_0x1bec71){if(_0x1bec71){return _0x1bec71[_0x1e59('0x23')]()[_0x1e59('0x22')](function(){_0x103263[_0x1e59('0x18')](0xcc)[_0x1e59('0x17')]();});}};}function handleEntityNotFound(_0x53dc24,_0xd528b6){return function(_0x3e2f16){if(!_0x3e2f16){_0x53dc24[_0x1e59('0x16')](0x194);}return _0x3e2f16;};}function handleError(_0xa46895,_0x11c469){_0x11c469=_0x11c469||0x1f4;return function(_0x2baa76){logger[_0x1e59('0x24')](_0x2baa76['stack']);if(_0x2baa76[_0x1e59('0x25')]){delete _0x2baa76[_0x1e59('0x25')];}_0xa46895[_0x1e59('0x18')](_0x11c469)[_0x1e59('0x26')](_0x2baa76);};}exports[_0x1e59('0x27')]=function(_0xc40d32,_0x3fd6c8){var _0x366765={},_0x211523={},_0x306b88={'count':0x0,'rows':[]};var _0x383085=_[_0x1e59('0x28')](db['ZohoAccount'][_0x1e59('0x29')],function(_0x1aa7ff){return{'name':_0x1aa7ff[_0x1e59('0x2a')],'type':_0x1aa7ff[_0x1e59('0x2b')][_0x1e59('0x2c')]};});_0x211523[_0x1e59('0x2d')]=_[_0x1e59('0x28')](_0x383085,_0x1e59('0x25'));_0x211523[_0x1e59('0x2e')]=_[_0x1e59('0x2f')](_0xc40d32['query']);_0x211523[_0x1e59('0x30')]=_[_0x1e59('0x31')](_0x211523[_0x1e59('0x2d')],_0x211523[_0x1e59('0x2e')]);_0x366765[_0x1e59('0x32')]=_[_0x1e59('0x31')](_0x211523['model'],qs[_0x1e59('0x33')](_0xc40d32[_0x1e59('0x2e')]['fields']));_0x366765[_0x1e59('0x32')]=_0x366765[_0x1e59('0x32')][_0x1e59('0x34')]?_0x366765[_0x1e59('0x32')]:_0x211523[_0x1e59('0x2d')];if(!_0xc40d32['query'][_0x1e59('0x35')](_0x1e59('0x36'))){_0x366765['limit']=qs[_0x1e59('0x1c')](_0xc40d32['query'][_0x1e59('0x1c')]);_0x366765['offset']=qs[_0x1e59('0x19')](_0xc40d32['query'][_0x1e59('0x19')]);}_0x366765[_0x1e59('0x37')]=qs[_0x1e59('0x38')](_0xc40d32['query'][_0x1e59('0x38')]);_0x366765[_0x1e59('0x39')]=qs[_0x1e59('0x30')](_[_0x1e59('0x3a')](_0xc40d32[_0x1e59('0x2e')],_0x211523[_0x1e59('0x30')]),_0x383085);if(_0xc40d32[_0x1e59('0x2e')][_0x1e59('0x3b')]){_0x366765['where']=_[_0x1e59('0x3c')](_0x366765[_0x1e59('0x39')],{'$or':_['map'](_0x383085,function(_0x10c1f6){if(_0x10c1f6[_0x1e59('0x2b')]!==_0x1e59('0x3d')){var _0x21fbd0={};_0x21fbd0[_0x10c1f6[_0x1e59('0x25')]]={'$like':'%'+_0xc40d32[_0x1e59('0x2e')][_0x1e59('0x3b')]+'%'};return _0x21fbd0;}})});}_0x366765=_[_0x1e59('0x3c')]({},_0x366765,_0xc40d32['options']);var _0xddc982={'where':_0x366765[_0x1e59('0x39')]};return db[_0x1e59('0x3e')]['count'](_0xddc982)[_0x1e59('0x22')](function(_0xc2ad59){_0x306b88[_0x1e59('0x1b')]=_0xc2ad59;if(_0xc40d32[_0x1e59('0x2e')][_0x1e59('0x3f')]){_0x366765['include']=[{'all':!![]}];}return db[_0x1e59('0x3e')][_0x1e59('0x40')](_0x366765);})[_0x1e59('0x22')](function(_0x4462a4){_0x306b88[_0x1e59('0x41')]=_0x4462a4;return _0x306b88;})['then'](respondWithFilteredResult(_0x3fd6c8,_0x366765))['catch'](handleError(_0x3fd6c8,null));};exports[_0x1e59('0x42')]=function(_0x58a611,_0xc8aa93){var _0x527380={'raw':![],'where':{'id':_0x58a611[_0x1e59('0x43')]['id']}},_0x55f561={};_0x55f561[_0x1e59('0x2d')]=_['keys'](db[_0x1e59('0x3e')][_0x1e59('0x29')]);_0x55f561[_0x1e59('0x2e')]=_[_0x1e59('0x2f')](_0x58a611['query']);_0x55f561[_0x1e59('0x30')]=_['intersection'](_0x55f561[_0x1e59('0x2d')],_0x55f561[_0x1e59('0x2e')]);_0x527380[_0x1e59('0x32')]=_['intersection'](_0x55f561[_0x1e59('0x2d')],qs[_0x1e59('0x33')](_0x58a611[_0x1e59('0x2e')][_0x1e59('0x33')]));_0x527380[_0x1e59('0x32')]=_0x527380['attributes']['length']?_0x527380[_0x1e59('0x32')]:_0x55f561['model'];if(_0x58a611[_0x1e59('0x2e')][_0x1e59('0x3f')]){_0x527380[_0x1e59('0x44')]=[{'all':!![]}];}_0x527380=_[_0x1e59('0x3c')]({},_0x527380,_0x58a611[_0x1e59('0x45')]);return db['ZohoAccount'][_0x1e59('0x46')](_0x527380)[_0x1e59('0x22')](handleEntityNotFound(_0xc8aa93,null))[_0x1e59('0x22')](respondWithResult(_0xc8aa93,null))[_0x1e59('0x47')](handleError(_0xc8aa93,null));};exports[_0x1e59('0x48')]=function(_0xa9198a,_0xbce277){return db['ZohoAccount'][_0x1e59('0x48')](_0xa9198a[_0x1e59('0x49')],{})[_0x1e59('0x22')](respondWithResult(_0xbce277,0xc9))[_0x1e59('0x47')](handleError(_0xbce277,null));};exports[_0x1e59('0x21')]=function(_0xf5be46,_0x532871){if(_0xf5be46[_0x1e59('0x49')]['id']){delete _0xf5be46[_0x1e59('0x49')]['id'];}return db[_0x1e59('0x3e')]['find']({'where':{'id':_0xf5be46[_0x1e59('0x43')]['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0x532871,null))[_0x1e59('0x22')](saveUpdates(_0xf5be46['body'],null))[_0x1e59('0x22')](respondWithResult(_0x532871,null))[_0x1e59('0x47')](handleError(_0x532871,null));};exports[_0x1e59('0x23')]=function(_0x5d218d,_0x5b7bd7){return db[_0x1e59('0x3e')][_0x1e59('0x46')]({'where':{'id':_0x5d218d['params']['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0x5b7bd7,null))['then'](removeEntity(_0x5b7bd7,null))[_0x1e59('0x47')](handleError(_0x5b7bd7,null));};exports[_0x1e59('0x4a')]=function(_0x50c9d7,_0xaf8e65,_0x46a4c9){var _0x192611={};var _0x4c5e80={};var _0x58bf26;var _0x23c662;return db[_0x1e59('0x3e')][_0x1e59('0x4b')]({'where':{'id':_0x50c9d7['params']['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0xaf8e65,null))['then'](function(_0x3eb2d1){if(_0x3eb2d1){_0x58bf26=_0x3eb2d1;_0x4c5e80['model']=_[_0x1e59('0x2f')](db['ZohoConfiguration'][_0x1e59('0x29')]);_0x4c5e80[_0x1e59('0x2e')]=_[_0x1e59('0x2f')](_0x50c9d7[_0x1e59('0x2e')]);_0x4c5e80['filters']=_[_0x1e59('0x31')](_0x4c5e80[_0x1e59('0x2d')],_0x4c5e80[_0x1e59('0x2e')]);_0x192611[_0x1e59('0x32')]=_[_0x1e59('0x31')](_0x4c5e80[_0x1e59('0x2d')],qs['fields'](_0x50c9d7['query'][_0x1e59('0x33')]));_0x192611[_0x1e59('0x32')]=_0x192611[_0x1e59('0x32')][_0x1e59('0x34')]?_0x192611[_0x1e59('0x32')]:_0x4c5e80[_0x1e59('0x2d')];_0x192611[_0x1e59('0x37')]=qs[_0x1e59('0x38')](_0x50c9d7[_0x1e59('0x2e')][_0x1e59('0x38')]);_0x192611[_0x1e59('0x39')]=qs[_0x1e59('0x30')](_['pick'](_0x50c9d7[_0x1e59('0x2e')],_0x4c5e80[_0x1e59('0x30')]));if(_0x50c9d7[_0x1e59('0x2e')][_0x1e59('0x3b')]){_0x192611[_0x1e59('0x39')]=_[_0x1e59('0x3c')](_0x192611[_0x1e59('0x39')],{'$or':_[_0x1e59('0x28')](_0x192611[_0x1e59('0x32')],function(_0x299880){var _0x1c9967={};_0x1c9967[_0x299880]={'$like':'%'+_0x50c9d7[_0x1e59('0x2e')][_0x1e59('0x3b')]+'%'};return _0x1c9967;})});}_0x192611=_[_0x1e59('0x3c')]({},_0x192611,_0x50c9d7['options']);return _0x58bf26[_0x1e59('0x4a')](_0x192611);}})[_0x1e59('0x22')](function(_0xce6528){if(_0xce6528){_0x23c662=_0xce6528[_0x1e59('0x34')];if(!_0x50c9d7['query'][_0x1e59('0x35')](_0x1e59('0x36'))){_0x192611[_0x1e59('0x1c')]=qs[_0x1e59('0x1c')](_0x50c9d7[_0x1e59('0x2e')]['limit']);_0x192611['offset']=qs[_0x1e59('0x19')](_0x50c9d7[_0x1e59('0x2e')]['offset']);}return _0x58bf26[_0x1e59('0x4a')](_0x192611);}})[_0x1e59('0x22')](function(_0x3265d5){if(_0x3265d5){return _0x3265d5?{'count':_0x23c662,'rows':_0x3265d5}:null;}})[_0x1e59('0x22')](respondWithResult(_0xaf8e65,null))[_0x1e59('0x47')](handleError(_0xaf8e65,null));};exports[_0x1e59('0x4c')]=function(_0x16cb24,_0x2bc2b6,_0x382dc1){if(_0x16cb24[_0x1e59('0x49')]['id']){delete _0x16cb24[_0x1e59('0x49')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x16cb24['params']['id']}})[_0x1e59('0x22')](handleEntityNotFound(_0x2bc2b6,null))[_0x1e59('0x22')](function(_0x67cdca){if(_0x67cdca){_0x16cb24[_0x1e59('0x49')][_0x1e59('0x4d')]=_0x67cdca['id'];_0x16cb24[_0x1e59('0x49')][_0x1e59('0x4e')]=integrations[_0x1e59('0x4f')](_0x16cb24[_0x1e59('0x49')][_0x1e59('0x50')],_0x16cb24[_0x1e59('0x49')][_0x1e59('0x2b')]);_0x16cb24[_0x1e59('0x49')]['Descriptions']=integrations[_0x1e59('0x51')](_0x16cb24['body'][_0x1e59('0x50')],_0x16cb24['body']['type']);return db['ZohoConfiguration'][_0x1e59('0x48')](_0x16cb24['body'],{'include':[{'model':db['ZohoField'],'as':_0x1e59('0x4e')},{'model':db[_0x1e59('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2bc2b6,null))[_0x1e59('0x47')](handleError(_0x2bc2b6,null));};function getAccessToken(_0x3b646a){return new Promise(function(_0x6a5b7e,_0x4cf643){var _0x39fe89;switch(_0x3b646a[_0x1e59('0x53')]){case'US':_0x39fe89=_0x1e59('0x54');break;case'AU':_0x39fe89=_0x1e59('0x55');break;case'EU':_0x39fe89=_0x1e59('0x56');break;case'IN':_0x39fe89=_0x1e59('0x57');break;case'CN':_0x39fe89='https://accounts.zoho.com.cn';break;default:_0x39fe89=_0x1e59('0x56');break;}var _0x35d906={'method':_0x1e59('0x58'),'uri':_0x39fe89+_0x1e59('0x59'),'qs':{'refresh_token':_0x3b646a[_0x1e59('0x5a')],'client_id':_0x3b646a[_0x1e59('0x5b')],'client_secret':_0x3b646a[_0x1e59('0x5c')],'grant_type':_0x1e59('0x5d')},'json':!![]};return rp(_0x35d906)[_0x1e59('0x22')](function(_0x37033c){if(_0x37033c[_0x1e59('0x5e')]){_0x6a5b7e(_0x37033c[_0x1e59('0x5e')]);}else{_0x4cf643(_0x1e59('0x5f'));}})['catch'](function(_0x45b066){_0x4cf643(_0x45b066);});});}exports[_0x1e59('0x60')]=function(_0x4ca69a,_0x411413,_0x2949f7){var _0xc8a1ac,_0x286a27,_0x58852d,_0x4960e1,_0x4dc35e;return db[_0x1e59('0x3e')]['findOne']({'where':{'id':_0x4ca69a['params']['id']},'attributes':['id','host',_0x1e59('0x53'),_0x1e59('0x5b'),_0x1e59('0x5c'),_0x1e59('0x61'),_0x1e59('0x62'),_0x1e59('0x5a')]})[_0x1e59('0x22')](handleEntityNotFound(_0x411413,null))['then'](function(_0x1243f8){_0x4dc35e=_0x1243f8;_0xc8a1ac=_0x4dc35e[_0x1e59('0x63')];_0x286a27=_0xc8a1ac==='zoho.eu'?'eu':'com';_0x58852d=_0x4dc35e[_0x1e59('0x61')];var _0xe588bd=_0x58852d[_0x1e59('0x64')](-0x1);if(_0xe588bd==='/'||_0xe588bd==='\x5c'||_0xe588bd===':'){_0x58852d=_0x58852d[_0x1e59('0x65')](0x0,_0x58852d['lastIndexOf'](_0xe588bd));}if(!_0x4dc35e['refreshToken']){throw new Error(_0x1e59('0x66'));}return getAccessToken(_0x4dc35e);})[_0x1e59('0x22')](function(_0x2be8fd){if(_0x2be8fd){return rp({'method':_0x1e59('0x67'),'uri':util[_0x1e59('0x68')](_0x1e59('0x69'),_0x286a27),'qs':{'module':_0x1e59('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2be8fd},'json':!![]});}})[_0x1e59('0x22')](function(_0x1ce9ea){if(_0x1ce9ea){if(_0x1ce9ea['response']&&_0x1ce9ea['response']['error']){throw new Error(_0x1ce9ea[_0x1e59('0x6b')][_0x1e59('0x24')][_0x1e59('0x6c')]);}var _0x3937dc=[];var _0x3cf4b4=[];var _0x19c257=['Owner','Subject',_0x1e59('0x6d'),_0x1e59('0x6e'),_0x1e59('0x6f'),_0x1e59('0x70'),'Call_Start_Time',_0x1e59('0x71')];_0x3cf4b4=_[_0x1e59('0x72')](_0x1ce9ea[_0x1e59('0x33')],function(_0x27590d){return _0x19c257[_0x1e59('0x73')](_0x27590d[_0x1e59('0x74')]);});for(var _0x119b57=0x0;_0x119b57<_0x3cf4b4[_0x1e59('0x34')];_0x119b57++){if(_0x3cf4b4[_0x119b57][_0x1e59('0x75')]===![]){_0x3937dc[_0x1e59('0x76')]({'id':_0x3cf4b4[_0x119b57]['id'],'name':_0x3cf4b4[_0x119b57][_0x1e59('0x77')],'custom':_0x3cf4b4[_0x119b57][_0x1e59('0x78')],'options':_0x3cf4b4[_0x119b57][_0x1e59('0x79')]===_0x1e59('0x7a')&&_0x3cf4b4[_0x119b57][_0x1e59('0x7b')]['length']>-0x1?_[_0x1e59('0x28')](_0x3cf4b4[_0x119b57][_0x1e59('0x7b')],function(_0x3f25d0){return{'name':_0x3f25d0,'value':_0x3f25d0};}):[]});}}return{'count':_0x3937dc[_0x1e59('0x34')],'rows':_0x3937dc};}else{return{'count':0x0,'rows':[]};}})[_0x1e59('0x22')](respondWithResult(_0x411413,null))['catch'](function(_0x3ea4a0){var _0x583623=_0x4ca69a[_0x1e59('0x2e')]['test']?0x1f4:_0x3ea4a0[_0x1e59('0x7c')]||0x1f4;logger[_0x1e59('0x24')](_0x1e59('0x7d'),'getFields',_0x583623,JSON[_0x1e59('0x7e')](_0x3ea4a0));delete _0x3ea4a0[_0x1e59('0x25')];if(_0x583623===0x191){_0x583623=0x190;}_0x411413[_0x1e59('0x18')](_0x583623)[_0x1e59('0x26')](_0x4ca69a[_0x1e59('0x2e')][_0x1e59('0x7f')]?{'message':_0x1e59('0x80'),'statusCode':_0x3ea4a0[_0x1e59('0x7c')]}:_0x3ea4a0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 54b8195..6e3101e 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 _0x75eb=['serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refreshToken','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','zone','changed'];(function(_0x46dbaf,_0x44a1f2){var _0x3a7022=function(_0x4a4ebf){while(--_0x4a4ebf){_0x46dbaf['push'](_0x46dbaf['shift']());}};_0x3a7022(++_0x44a1f2);}(_0x75eb,0x151));var _0xb75e=function(_0x196e86,_0x150961){_0x196e86=_0x196e86-0x0;var _0x54a40c=_0x75eb[_0x196e86];return _0x54a40c;};'use strict';var _=require(_0xb75e('0x0'));var util=require(_0xb75e('0x1'));var logger=require(_0xb75e('0x2'))(_0xb75e('0x3'));var moment=require(_0xb75e('0x4'));var BPromise=require(_0xb75e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb75e('0x6'));var rimraf=require(_0xb75e('0x7'));var config=require(_0xb75e('0x8'));var attributes=require(_0xb75e('0x9'));var integrations=require(_0xb75e('0xa'));module[_0xb75e('0xb')]=function(_0x2097cd,_0x1a8baf){return _0x2097cd[_0xb75e('0xc')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x441361,_0x491a0d,_0x5dd85b){if(_0x441361['changed'](_0xb75e('0xd'))||_0x441361[_0xb75e('0xe')](_0xb75e('0xf'))||_0x441361['changed']('clientId')||_0x441361[_0xb75e('0xe')](_0xb75e('0x10'))||_0x441361[_0xb75e('0xe')](_0xb75e('0x11'))||_0x441361[_0xb75e('0xe')](_0xb75e('0x12'))){var _0x2afb26,_0x4c4b44;_0x2afb26=_0x441361[_0xb75e('0xf')];var _0x3d5a58=_0x2afb26[_0xb75e('0x13')](-0x1);if(_0x3d5a58==='/'||_0x3d5a58==='\x5c'||_0x3d5a58===':'){_0x2afb26=_0x2afb26[_0xb75e('0x14')](0x0,_0x2afb26[_0xb75e('0x15')](_0x3d5a58));}switch(_0x441361[_0xb75e('0xd')]){case'US':_0x4c4b44='https://accounts.zoho.com';break;case'AU':_0x4c4b44=_0xb75e('0x16');break;case'IN':_0x4c4b44=_0xb75e('0x17');break;case'CN':_0x4c4b44='https://accounts.zoho.com.cn';break;default:_0x4c4b44='https://accounts.zoho.eu';break;}var _0x2cc697={'method':_0xb75e('0x18'),'uri':_0x4c4b44+_0xb75e('0x19'),'form':{'grant_type':_0xb75e('0x1a'),'client_id':_0x441361[_0xb75e('0x1b')],'client_secret':_0x441361[_0xb75e('0x10')],'redirect_uri':_0x441361[_0xb75e('0xf')],'code':_0x441361[_0xb75e('0x11')]},'headers':{'Content-Type':_0xb75e('0x1c')}};return rp(_0x2cc697)[_0xb75e('0x1d')](function(_0x106f9f){var _0x5207f5=JSON[_0xb75e('0x1e')](_0x106f9f);if(_0x5207f5['refresh_token']){_0x441361['refreshToken']=_0x5207f5[_0xb75e('0x1f')];logger[_0xb75e('0x20')](util[_0xb75e('0x21')](_0xb75e('0x22'),_0x441361[_0xb75e('0x23')],_0x441361['id']));}else{logger[_0xb75e('0x24')](util['format'](_0xb75e('0x25'),_0x441361[_0xb75e('0x23')],_0x441361['id']),util[_0xb75e('0x26')](_0x5207f5,{'showHidden':![],'depth':null}));}return _0x5dd85b(null,_0x491a0d);})[_0xb75e('0x27')](function(_0x3379d7){logger[_0xb75e('0x24')](util[_0xb75e('0x21')](_0xb75e('0x25'),_0x441361['name'],_0x441361['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5dd85b(_0x3379d7);});}else{return _0x5dd85b(null,_0x491a0d);}},'beforeUpdate':function(_0x50463a,_0x333334,_0x33a8ee){if(_0x50463a[_0xb75e('0xe')](_0xb75e('0xd'))||_0x50463a[_0xb75e('0xe')]('serverUrl')||_0x50463a[_0xb75e('0xe')](_0xb75e('0x1b'))||_0x50463a['changed']('clientSecret')||_0x50463a['changed'](_0xb75e('0x11'))||_0x50463a[_0xb75e('0xe')](_0xb75e('0x12'))){var _0xd27e22,_0x4b316e;_0xd27e22=_0x50463a[_0xb75e('0xf')];var _0x3daf2c=_0xd27e22[_0xb75e('0x13')](-0x1);if(_0x3daf2c==='/'||_0x3daf2c==='\x5c'||_0x3daf2c===':'){_0xd27e22=_0xd27e22[_0xb75e('0x14')](0x0,_0xd27e22[_0xb75e('0x15')](_0x3daf2c));}switch(_0x50463a[_0xb75e('0xd')]){case'US':_0x4b316e=_0xb75e('0x28');break;case'AU':_0x4b316e='https://accounts.zoho.com.au';break;case'IN':_0x4b316e=_0xb75e('0x17');break;case'CN':_0x4b316e=_0xb75e('0x29');break;default:_0x4b316e=_0xb75e('0x2a');break;}var _0x44f4c9={'method':_0xb75e('0x18'),'uri':_0x4b316e+_0xb75e('0x19'),'form':{'grant_type':_0xb75e('0x1a'),'client_id':_0x50463a[_0xb75e('0x1b')],'client_secret':_0x50463a[_0xb75e('0x10')],'redirect_uri':_0x50463a[_0xb75e('0xf')],'code':_0x50463a[_0xb75e('0x11')]},'headers':{'Content-Type':_0xb75e('0x1c')}};return rp(_0x44f4c9)[_0xb75e('0x1d')](function(_0x28469d){var _0x46d429=JSON[_0xb75e('0x1e')](_0x28469d);if(_0x46d429[_0xb75e('0x1f')]){_0x50463a[_0xb75e('0x2b')]=_0x46d429['refresh_token'];logger[_0xb75e('0x20')](util[_0xb75e('0x21')](_0xb75e('0x22'),_0x50463a[_0xb75e('0x23')],_0x50463a['id']));}else{logger[_0xb75e('0x24')](util['format'](_0xb75e('0x25'),_0x50463a[_0xb75e('0x23')],_0x50463a['id']),util['inspect'](_0x46d429,{'showHidden':![],'depth':null}));}return _0x33a8ee(null,_0x333334);})[_0xb75e('0x27')](function(_0x18fd81){logger[_0xb75e('0x24')](util['format'](_0xb75e('0x25'),_0x50463a[_0xb75e('0x23')],_0x50463a['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x33a8ee(_0x18fd81);});}else{return _0x33a8ee(null,_0x333334);}}}});}; \ No newline at end of file +var _0x2664=['substring','lastIndexOf','https://accounts.zoho.com','POST','authorization_code','application/x-www-form-urlencoded','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','host','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','code','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0xec338d,_0x26aa7c){var _0x510522=function(_0x2c3505){while(--_0x2c3505){_0xec338d['push'](_0xec338d['shift']());}};_0x510522(++_0x26aa7c);}(_0x2664,0x146));var _0x4266=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2664[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4266('0x0'));var util=require('util');var logger=require(_0x4266('0x1'))(_0x4266('0x2'));var moment=require(_0x4266('0x3'));var BPromise=require(_0x4266('0x4'));var rp=require(_0x4266('0x5'));var fs=require('fs');var path=require(_0x4266('0x6'));var rimraf=require(_0x4266('0x7'));var config=require(_0x4266('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4266('0x9')]=function(_0x144291,_0x60f20c){return _0x144291['define'](_0x4266('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x139d4c,_0x40d44f,_0x505ccd){if(_0x139d4c['changed'](_0x4266('0xb'))||_0x139d4c[_0x4266('0xc')](_0x4266('0xd'))||_0x139d4c[_0x4266('0xc')](_0x4266('0xe'))||_0x139d4c[_0x4266('0xc')](_0x4266('0xf'))||_0x139d4c[_0x4266('0xc')]('code')||_0x139d4c[_0x4266('0xc')](_0x4266('0x10'))){var _0x341395,_0x1c37a4;_0x341395=_0x139d4c[_0x4266('0xd')];var _0x21366e=_0x341395['slice'](-0x1);if(_0x21366e==='/'||_0x21366e==='\x5c'||_0x21366e===':'){_0x341395=_0x341395['substring'](0x0,_0x341395['lastIndexOf'](_0x21366e));}switch(_0x139d4c[_0x4266('0xb')]){case'US':_0x1c37a4='https://accounts.zoho.com';break;case'AU':_0x1c37a4=_0x4266('0x11');break;case'IN':_0x1c37a4=_0x4266('0x12');break;case'CN':_0x1c37a4=_0x4266('0x13');break;default:_0x1c37a4='https://accounts.zoho.eu';break;}var _0x506945={'method':'POST','uri':_0x1c37a4+_0x4266('0x14'),'form':{'grant_type':'authorization_code','client_id':_0x139d4c['clientId'],'client_secret':_0x139d4c[_0x4266('0xf')],'redirect_uri':_0x139d4c[_0x4266('0xd')],'code':_0x139d4c[_0x4266('0x15')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x506945)[_0x4266('0x16')](function(_0x2e59ab){var _0x51e765=JSON[_0x4266('0x17')](_0x2e59ab);if(_0x51e765[_0x4266('0x18')]){_0x139d4c[_0x4266('0x19')]=_0x51e765[_0x4266('0x18')];logger[_0x4266('0x1a')](util['format'](_0x4266('0x1b'),_0x139d4c[_0x4266('0x1c')],_0x139d4c['id']));}else{logger[_0x4266('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x139d4c[_0x4266('0x1c')],_0x139d4c['id']),util[_0x4266('0x1e')](_0x51e765,{'showHidden':![],'depth':null}));}return _0x505ccd(null,_0x40d44f);})[_0x4266('0x1f')](function(_0x22b44c){logger[_0x4266('0x1d')](util[_0x4266('0x20')](_0x4266('0x21'),_0x139d4c[_0x4266('0x1c')],_0x139d4c['id']),util[_0x4266('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x505ccd(_0x22b44c);});}else{return _0x505ccd(null,_0x40d44f);}},'beforeUpdate':function(_0x269c65,_0x55e4bf,_0x3054da){if(_0x269c65[_0x4266('0xc')](_0x4266('0xb'))||_0x269c65[_0x4266('0xc')]('serverUrl')||_0x269c65[_0x4266('0xc')](_0x4266('0xe'))||_0x269c65[_0x4266('0xc')](_0x4266('0xf'))||_0x269c65[_0x4266('0xc')]('code')||_0x269c65['changed']('host')){var _0x35ce5b,_0x5deb66;_0x35ce5b=_0x269c65[_0x4266('0xd')];var _0x5ef6bc=_0x35ce5b['slice'](-0x1);if(_0x5ef6bc==='/'||_0x5ef6bc==='\x5c'||_0x5ef6bc===':'){_0x35ce5b=_0x35ce5b[_0x4266('0x22')](0x0,_0x35ce5b[_0x4266('0x23')](_0x5ef6bc));}switch(_0x269c65[_0x4266('0xb')]){case'US':_0x5deb66=_0x4266('0x24');break;case'AU':_0x5deb66='https://accounts.zoho.com.au';break;case'IN':_0x5deb66=_0x4266('0x12');break;case'CN':_0x5deb66=_0x4266('0x13');break;default:_0x5deb66='https://accounts.zoho.eu';break;}var _0x540fc5={'method':_0x4266('0x25'),'uri':_0x5deb66+_0x4266('0x14'),'form':{'grant_type':_0x4266('0x26'),'client_id':_0x269c65[_0x4266('0xe')],'client_secret':_0x269c65[_0x4266('0xf')],'redirect_uri':_0x269c65['serverUrl'],'code':_0x269c65[_0x4266('0x15')]},'headers':{'Content-Type':_0x4266('0x27')}};return rp(_0x540fc5)['then'](function(_0x3537db){var _0x4bd4c1=JSON['parse'](_0x3537db);if(_0x4bd4c1[_0x4266('0x18')]){_0x269c65[_0x4266('0x19')]=_0x4bd4c1['refresh_token'];logger[_0x4266('0x1a')](util['format'](_0x4266('0x1b'),_0x269c65['name'],_0x269c65['id']));}else{logger['error'](util[_0x4266('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x269c65[_0x4266('0x1c')],_0x269c65['id']),util[_0x4266('0x1e')](_0x4bd4c1,{'showHidden':![],'depth':null}));}return _0x3054da(null,_0x55e4bf);})['catch'](function(_0x2c7141){logger[_0x4266('0x1d')](util[_0x4266('0x20')](_0x4266('0x21'),_0x269c65[_0x4266('0x1c')],_0x269c65['id']),util[_0x4266('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x3054da(_0x2c7141);});}else{return _0x3054da(null,_0x55e4bf);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 313b4d7..938bb4d 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 _0xe34f=['ShowZohoAccount','stringify','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','error','message','result','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','GetZohoAccount','debug','catch'];(function(_0x7bff78,_0x58c7a6){var _0x50a16d=function(_0x3fd3bf){while(--_0x3fd3bf){_0x7bff78['push'](_0x7bff78['shift']());}};_0x50a16d(++_0x58c7a6);}(_0xe34f,0xbc));var _0xfe34=function(_0xb040c,_0x4e0bd6){_0xb040c=_0xb040c-0x0;var _0x1aa9ff=_0xe34f[_0xb040c];return _0x1aa9ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe34('0x0'));var fs=require('fs');var Redis=require(_0xfe34('0x1'));var db=require(_0xfe34('0x2'))['db'];var utils=require(_0xfe34('0x3'));var logger=require(_0xfe34('0x4'))(_0xfe34('0x5'));var config=require(_0xfe34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe34('0x7')][_0xfe34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195bcd,_0x3fe816,_0x25f17a){return new BPromise(function(_0x4fa1cd,_0x5cdc7e){return client[_0xfe34('0x9')](_0x195bcd,_0x25f17a)[_0xfe34('0xa')](function(_0x252ec7){logger[_0xfe34('0xb')](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3fe816,'request\x20sent',JSON['stringify'](_0x252ec7));if(_0x252ec7[_0xfe34('0xe')]){if(_0x252ec7[_0xfe34('0xe')]['code']===0x1f4){logger[_0xfe34('0xe')](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x5cdc7e(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}logger['error'](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x4fa1cd(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}else{logger['info'](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));_0x4fa1cd(_0x252ec7[_0xfe34('0x10')][_0xfe34('0xf')]);}})['catch'](function(_0x53b469){logger['error'](_0xfe34('0xc'),_0x3fe816,_0x53b469);_0x5cdc7e(_0x53b469);});});}exports['GetZohoAccount']=function(_0x5c95f5){var _0x495b48=this;return new Promise(function(_0x3f7f60,_0x19f7e3){return db[_0xfe34('0x11')][_0xfe34('0x12')]({'raw':_0x5c95f5['options']?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x14')]===undefined?!![]:![]:!![],'where':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x15')]||null:null,'attributes':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5['options'][_0xfe34('0x16')]||null:null,'limit':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')]['limit']||null:null,'include':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x17')],function(_0x249ffc){return{'model':db[_0x249ffc[_0xfe34('0x19')]],'as':_0x249ffc['as'],'attributes':_0x249ffc[_0xfe34('0x16')],'include':_0x249ffc[_0xfe34('0x17')]?_['map'](_0x249ffc[_0xfe34('0x17')],function(_0x257c3c){return{'model':db[_0x257c3c['model']],'as':_0x257c3c['as'],'attributes':_0x257c3c[_0xfe34('0x16')],'include':_0x257c3c['include']?_['map'](_0x257c3c[_0xfe34('0x17')],function(_0x5221dc){return{'model':db[_0x5221dc['model']],'as':_0x5221dc['as'],'attributes':_0x5221dc[_0xfe34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe34('0xa')](function(_0x48a886){logger[_0xfe34('0xb')](_0xfe34('0x1a'),_0x5c95f5);logger[_0xfe34('0x1b')](_0xfe34('0x1a'),_0x5c95f5,JSON['stringify'](_0x48a886));_0x3f7f60(_0x48a886);})[_0xfe34('0x1c')](function(_0x59e06b){logger[_0xfe34('0xe')](_0xfe34('0x1a'),_0x59e06b[_0xfe34('0xf')],_0x5c95f5);_0x19f7e3(_0x495b48[_0xfe34('0xe')](0x1f4,_0x59e06b[_0xfe34('0xf')]));});});};exports[_0xfe34('0x1d')]=function(_0x44adf0){var _0x4b9b50=this;return new Promise(function(_0x345c00,_0x1a3cec){return db[_0xfe34('0x11')]['find']({'raw':_0x44adf0[_0xfe34('0x13')]?_0x44adf0[_0xfe34('0x13')][_0xfe34('0x14')]===undefined?!![]:![]:!![],'where':_0x44adf0[_0xfe34('0x13')]?_0x44adf0['options'][_0xfe34('0x15')]||null:null,'attributes':_0x44adf0[_0xfe34('0x13')]?_0x44adf0['options'][_0xfe34('0x16')]||null:null,'include':_0x44adf0[_0xfe34('0x13')]?_0x44adf0[_0xfe34('0x13')][_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x44adf0['options']['include'],function(_0xa0a65a){return{'model':db[_0xa0a65a['model']],'as':_0xa0a65a['as'],'attributes':_0xa0a65a[_0xfe34('0x16')],'include':_0xa0a65a[_0xfe34('0x17')]?_[_0xfe34('0x18')](_0xa0a65a[_0xfe34('0x17')],function(_0x1c40c9){return{'model':db[_0x1c40c9[_0xfe34('0x19')]],'as':_0x1c40c9['as'],'attributes':_0x1c40c9['attributes'],'include':_0x1c40c9[_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x1c40c9[_0xfe34('0x17')],function(_0x460911){return{'model':db[_0x460911[_0xfe34('0x19')]],'as':_0x460911['as'],'attributes':_0x460911[_0xfe34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe34('0xa')](function(_0x3510a0){logger[_0xfe34('0xb')](_0xfe34('0x1d'),_0x44adf0);logger[_0xfe34('0x1b')](_0xfe34('0x1d'),_0x44adf0,JSON[_0xfe34('0x1e')](_0x3510a0));_0x345c00(_0x3510a0);})[_0xfe34('0x1c')](function(_0x1589f9){logger[_0xfe34('0xe')](_0xfe34('0x1d'),_0x1589f9[_0xfe34('0xf')],_0x44adf0);_0x1a3cec(_0x4b9b50[_0xfe34('0xe')](0x1f4,_0x1589f9['message']));});});}; \ No newline at end of file +var _0x2aa3=['jayson/promise','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x139e39,_0x1b3f77){var _0x8e1bd7=function(_0x26a921){while(--_0x26a921){_0x139e39['push'](_0x139e39['shift']());}};_0x8e1bd7(++_0x1b3f77);}(_0x2aa3,0x83));var _0x32aa=function(_0x3ad8d7,_0x225758){_0x3ad8d7=_0x3ad8d7-0x0;var _0xa4047c=_0x2aa3[_0x3ad8d7];return _0xa4047c;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112396,_0x3ee18a,_0x20efbe){return new BPromise(function(_0x18ded0,_0x40c96a){return client[_0x32aa('0xb')](_0x112396,_0x20efbe)[_0x32aa('0xc')](function(_0x5d280e){logger[_0x32aa('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x3ee18a,_0x32aa('0xe'));logger[_0x32aa('0xf')](_0x32aa('0x10'),_0x3ee18a,_0x32aa('0xe'),JSON['stringify'](_0x5d280e));if(_0x5d280e[_0x32aa('0x11')]){if(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x12')]===0x1f4){logger['error'](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);return _0x40c96a(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')]['message']);return _0x18ded0(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}else{logger[_0x32aa('0xd')](_0x32aa('0x13'),_0x3ee18a,_0x32aa('0xe'));_0x18ded0(_0x5d280e['result'][_0x32aa('0x14')]);}})[_0x32aa('0x15')](function(_0x463b91){logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x463b91);_0x40c96a(_0x463b91);});});}exports['GetZohoAccount']=function(_0x5196c0){var _0x3e0a23=this;return new Promise(function(_0x34dcaf,_0x257be0){return db['ZohoAccount']['findAll']({'raw':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x17')]===undefined?!![]:![]:!![],'where':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x18')]||null:null,'attributes':_0x5196c0['options']?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x19')]||null:null,'limit':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1a')]||null:null,'include':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x5196c0['options'][_0x32aa('0x1b')],function(_0x5c82d2){return{'model':db[_0x5c82d2[_0x32aa('0x1d')]],'as':_0x5c82d2['as'],'attributes':_0x5c82d2[_0x32aa('0x19')],'include':_0x5c82d2['include']?_['map'](_0x5c82d2[_0x32aa('0x1b')],function(_0x313930){return{'model':db[_0x313930[_0x32aa('0x1d')]],'as':_0x313930['as'],'attributes':_0x313930[_0x32aa('0x19')],'include':_0x313930[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x313930[_0x32aa('0x1b')],function(_0x405b03){return{'model':db[_0x405b03[_0x32aa('0x1d')]],'as':_0x405b03['as'],'attributes':_0x405b03['attributes']};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x2e3a5d){logger['info'](_0x32aa('0x1e'),_0x5196c0);logger['debug']('GetZohoAccount',_0x5196c0,JSON[_0x32aa('0x1f')](_0x2e3a5d));_0x34dcaf(_0x2e3a5d);})[_0x32aa('0x15')](function(_0x1d1c80){logger[_0x32aa('0x11')]('GetZohoAccount',_0x1d1c80[_0x32aa('0x14')],_0x5196c0);_0x257be0(_0x3e0a23[_0x32aa('0x11')](0x1f4,_0x1d1c80[_0x32aa('0x14')]));});});};exports[_0x32aa('0x20')]=function(_0x19efc6){var _0x44887c=this;return new Promise(function(_0x4b0d5a,_0x5b410f){return db[_0x32aa('0x21')][_0x32aa('0x22')]({'raw':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19efc6['options']?_0x19efc6[_0x32aa('0x16')]['where']||null:null,'attributes':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['attributes']||null:null,'include':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['include']?_[_0x32aa('0x1c')](_0x19efc6[_0x32aa('0x16')][_0x32aa('0x1b')],function(_0xd23473){return{'model':db[_0xd23473[_0x32aa('0x1d')]],'as':_0xd23473['as'],'attributes':_0xd23473[_0x32aa('0x19')],'include':_0xd23473[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0xd23473[_0x32aa('0x1b')],function(_0x2a2f9d){return{'model':db[_0x2a2f9d[_0x32aa('0x1d')]],'as':_0x2a2f9d['as'],'attributes':_0x2a2f9d[_0x32aa('0x19')],'include':_0x2a2f9d[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x2a2f9d['include'],function(_0x5b0fe2){return{'model':db[_0x5b0fe2[_0x32aa('0x1d')]],'as':_0x5b0fe2['as'],'attributes':_0x5b0fe2[_0x32aa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x193d10){logger['info'](_0x32aa('0x20'),_0x19efc6);logger[_0x32aa('0xf')](_0x32aa('0x20'),_0x19efc6,JSON[_0x32aa('0x1f')](_0x193d10));_0x4b0d5a(_0x193d10);})[_0x32aa('0x15')](function(_0xa48198){logger[_0x32aa('0x11')](_0x32aa('0x20'),_0xa48198[_0x32aa('0x14')],_0x19efc6);_0x5b410f(_0x44887c[_0x32aa('0x11')](0x1f4,_0xa48198[_0x32aa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4ef4bcf..9c26d64 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 _0xa75f=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete'];(function(_0x1ac321,_0xae351){var _0x163394=function(_0x22e78d){while(--_0x22e78d){_0x1ac321['push'](_0x1ac321['shift']());}};_0x163394(++_0xae351);}(_0xa75f,0xda));var _0xfa75=function(_0x1fae43,_0x245a84){_0x1fae43=_0x1fae43-0x0;var _0x203459=_0xa75f[_0x1fae43];return _0x203459;};'use strict';var multer=require('multer');var util=require(_0xfa75('0x0'));var path=require(_0xfa75('0x1'));var timeout=require(_0xfa75('0x2'));var express=require(_0xfa75('0x3'));var router=express[_0xfa75('0x4')]();var fs_extra=require(_0xfa75('0x5'));var auth=require(_0xfa75('0x6'));var interaction=require(_0xfa75('0x7'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xfa75('0x8')]('/',auth[_0xfa75('0x9')](),controller[_0xfa75('0xa')]);router['get'](_0xfa75('0xb'),auth[_0xfa75('0x9')](),controller[_0xfa75('0xc')]);router[_0xfa75('0x8')](_0xfa75('0xd'),auth['isAuthenticated'](),controller[_0xfa75('0xe')]);router['get']('/:id/subjects',auth[_0xfa75('0x9')](),controller[_0xfa75('0xf')]);router['get'](_0xfa75('0x10'),auth['isAuthenticated'](),controller[_0xfa75('0x11')]);router['post']('/',auth[_0xfa75('0x9')](),controller[_0xfa75('0x12')]);router[_0xfa75('0x13')](_0xfa75('0xb'),auth[_0xfa75('0x9')](),controller[_0xfa75('0x14')]);router[_0xfa75('0x15')](_0xfa75('0xb'),auth[_0xfa75('0x9')](),controller[_0xfa75('0x16')]);module[_0xfa75('0x17')]=router; \ No newline at end of file +var _0x75fb=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x75fb,0x137));var _0xb75f=function(_0x7f6de0,_0x362c05){_0x7f6de0=_0x7f6de0-0x0;var _0x358901=_0x75fb[_0x7f6de0];return _0x358901;};'use strict';var multer=require(_0xb75f('0x0'));var util=require(_0xb75f('0x1'));var path=require(_0xb75f('0x2'));var timeout=require(_0xb75f('0x3'));var express=require(_0xb75f('0x4'));var router=express[_0xb75f('0x5')]();var fs_extra=require(_0xb75f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb75f('0x7'));var config=require(_0xb75f('0x8'));var controller=require(_0xb75f('0x9'));router[_0xb75f('0xa')]('/',auth[_0xb75f('0xb')](),controller[_0xb75f('0xc')]);router[_0xb75f('0xa')](_0xb75f('0xd'),auth[_0xb75f('0xb')](),controller['show']);router['get'](_0xb75f('0xe'),auth[_0xb75f('0xb')](),controller[_0xb75f('0xf')]);router['get'](_0xb75f('0x10'),auth[_0xb75f('0xb')](),controller[_0xb75f('0x11')]);router[_0xb75f('0xa')]('/:id/descriptions',auth[_0xb75f('0xb')](),controller[_0xb75f('0x12')]);router[_0xb75f('0x13')]('/',auth[_0xb75f('0xb')](),controller[_0xb75f('0x14')]);router[_0xb75f('0x15')]('/:id',auth[_0xb75f('0xb')](),controller['update']);router['delete'](_0xb75f('0xd'),auth['isAuthenticated'](),controller[_0xb75f('0x16')]);module[_0xb75f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 07f335a..343e77b 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 _0x5d3f=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x1eb30d,_0x50e6fc){var _0x4e4159=function(_0x4feb35){while(--_0x4feb35){_0x1eb30d['push'](_0x1eb30d['shift']());}};_0x4e4159(++_0x50e6fc);}(_0x5d3f,0x18d));var _0xf5d3=function(_0xb4614e,_0x280d01){_0xb4614e=_0xb4614e-0x0;var _0x345b0c=_0x5d3f[_0xb4614e];return _0x345b0c;};'use strict';var Sequelize=require(_0xf5d3('0x0'));module[_0xf5d3('0x1')]={'name':{'type':Sequelize[_0xf5d3('0x2')]},'moduleCreate':{'type':Sequelize[_0xf5d3('0x3')](_0xf5d3('0x4'),_0xf5d3('0x5'),_0xf5d3('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xf5d3('0x7'),_0xf5d3('0x5'),'lead'),'defaultValue':_0xf5d3('0x7')},'description':{'type':Sequelize[_0xf5d3('0x2')]}}; \ No newline at end of file +var _0xc090=['nothing','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc090,0x112));var _0x0c09=function(_0x3b170f,_0x111b6b){_0x3b170f=_0x3b170f-0x0;var _0x40f073=_0xc090[_0x3b170f];return _0x40f073;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'name':{'type':Sequelize[_0x0c09('0x2')]},'moduleCreate':{'type':Sequelize[_0x0c09('0x3')](_0x0c09('0x4'),_0x0c09('0x5'),_0x0c09('0x6')),'defaultValue':_0x0c09('0x4')},'moduleSearch':{'type':Sequelize[_0x0c09('0x3')]('contact_lead',_0x0c09('0x5'),_0x0c09('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index cb20b9d..b206eb5 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 _0xe87e=['index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','create','body','find','params','getFields','findOne','ZohoField','order','filter','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xe87e,0xc7));var _0xee87=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe87e[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0xee87('0x0'));var rimraf=require(_0xee87('0x1'));var zipdir=require(_0xee87('0x2'));var jsonpatch=require(_0xee87('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xee87('0x4'));var Mustache=require(_0xee87('0x5'));var util=require(_0xee87('0x6'));var path=require('path');var sox=require(_0xee87('0x7'));var csv=require('to-csv');var ejs=require(_0xee87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee87('0x9'));var squel=require(_0xee87('0xa'));var crypto=require(_0xee87('0xb'));var jsforce=require(_0xee87('0xc'));var deskjs=require(_0xee87('0xd'));var toCsv=require(_0xee87('0xe'));var querystring=require('querystring');var Papa=require(_0xee87('0xf'));var Redis=require(_0xee87('0x10'));var authService=require(_0xee87('0x11'));var qs=require(_0xee87('0x12'));var as=require(_0xee87('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xee87('0x14'));var licenseUtil=require(_0xee87('0x15'));var db=require(_0xee87('0x16'))['db'];function respondWithStatusCode(_0x286bee,_0x1be24a){_0x1be24a=_0x1be24a||0xcc;return function(_0x586641){if(_0x586641){return _0x286bee[_0xee87('0x17')](_0x1be24a);}return _0x286bee[_0xee87('0x18')](_0x1be24a)[_0xee87('0x19')]();};}function respondWithResult(_0x355435,_0x4d21a6){_0x4d21a6=_0x4d21a6||0xc8;return function(_0x163b03){if(_0x163b03){return _0x355435[_0xee87('0x18')](_0x4d21a6)[_0xee87('0x1a')](_0x163b03);}};}function respondWithFilteredResult(_0x4143aa,_0x57f422){return function(_0x5c1f64){if(_0x5c1f64){var _0x230f56=typeof _0x57f422[_0xee87('0x1b')]===_0xee87('0x1c')&&typeof _0x57f422[_0xee87('0x1d')]===_0xee87('0x1c');var _0x442196=_0x5c1f64['count'];var _0x207b24=_0x230f56?0x0:_0x57f422[_0xee87('0x1b')];var _0x1e7a95=_0x230f56?_0x5c1f64[_0xee87('0x1e')]:_0x57f422[_0xee87('0x1b')]+_0x57f422[_0xee87('0x1d')];var _0x34ad2e;if(_0x1e7a95>=_0x442196){_0x1e7a95=_0x442196;_0x34ad2e=0xc8;}else{_0x34ad2e=0xce;}_0x4143aa[_0xee87('0x18')](_0x34ad2e);return _0x4143aa[_0xee87('0x1f')](_0xee87('0x20'),_0x207b24+'-'+_0x1e7a95+'/'+_0x442196)[_0xee87('0x1a')](_0x5c1f64);}return null;};}function patchUpdates(_0x3c3581){return function(_0xb77ac9){try{jsonpatch[_0xee87('0x21')](_0xb77ac9,_0x3c3581,!![]);}catch(_0x55f503){return BPromise[_0xee87('0x22')](_0x55f503);}return _0xb77ac9[_0xee87('0x23')]();};}function saveUpdates(_0x373784,_0x30f6d7){return function(_0x591370){if(_0x591370){return _0x591370[_0xee87('0x24')](_0x373784)['then'](function(_0x10be86){return _0x10be86;});}return null;};}function removeEntity(_0x48a885,_0x1843b5){return function(_0x2ae14e){if(_0x2ae14e){return _0x2ae14e[_0xee87('0x25')]()[_0xee87('0x26')](function(){_0x48a885['status'](0xcc)[_0xee87('0x19')]();});}};}function handleEntityNotFound(_0x5c279f,_0x17bb3b){return function(_0x19e967){if(!_0x19e967){_0x5c279f['sendStatus'](0x194);}return _0x19e967;};}function handleError(_0x2ca5ef,_0x27fdc8){_0x27fdc8=_0x27fdc8||0x1f4;return function(_0x4568da){logger['error'](_0x4568da['stack']);if(_0x4568da[_0xee87('0x27')]){delete _0x4568da[_0xee87('0x27')];}_0x2ca5ef[_0xee87('0x18')](_0x27fdc8)[_0xee87('0x28')](_0x4568da);};}exports[_0xee87('0x29')]=function(_0x41544d,_0x24502d){var _0x25d7a5={},_0x2c6595={},_0x12b13d={'count':0x0,'rows':[]};var _0x4bf068=_[_0xee87('0x2a')](db[_0xee87('0x2b')][_0xee87('0x2c')],function(_0x5245e1){return{'name':_0x5245e1[_0xee87('0x2d')],'type':_0x5245e1[_0xee87('0x2e')][_0xee87('0x2f')]};});_0x2c6595[_0xee87('0x30')]=_['map'](_0x4bf068,_0xee87('0x27'));_0x2c6595[_0xee87('0x31')]=_[_0xee87('0x32')](_0x41544d[_0xee87('0x31')]);_0x2c6595[_0xee87('0x33')]=_[_0xee87('0x34')](_0x2c6595[_0xee87('0x30')],_0x2c6595[_0xee87('0x31')]);_0x25d7a5['attributes']=_[_0xee87('0x34')](_0x2c6595[_0xee87('0x30')],qs[_0xee87('0x35')](_0x41544d[_0xee87('0x31')][_0xee87('0x35')]));_0x25d7a5[_0xee87('0x36')]=_0x25d7a5[_0xee87('0x36')][_0xee87('0x37')]?_0x25d7a5[_0xee87('0x36')]:_0x2c6595[_0xee87('0x30')];if(!_0x41544d['query'][_0xee87('0x38')](_0xee87('0x39'))){_0x25d7a5[_0xee87('0x1d')]=qs[_0xee87('0x1d')](_0x41544d['query'][_0xee87('0x1d')]);_0x25d7a5[_0xee87('0x1b')]=qs[_0xee87('0x1b')](_0x41544d[_0xee87('0x31')][_0xee87('0x1b')]);}_0x25d7a5['order']=qs[_0xee87('0x3a')](_0x41544d[_0xee87('0x31')]['sort']);_0x25d7a5[_0xee87('0x3b')]=qs['filters'](_[_0xee87('0x3c')](_0x41544d[_0xee87('0x31')],_0x2c6595[_0xee87('0x33')]),_0x4bf068);if(_0x41544d[_0xee87('0x31')]['filter']){_0x25d7a5['where']=_[_0xee87('0x3d')](_0x25d7a5[_0xee87('0x3b')],{'$or':_['map'](_0x4bf068,function(_0x1bb721){if(_0x1bb721[_0xee87('0x2e')]!==_0xee87('0x3e')){var _0x4ff77d={};_0x4ff77d[_0x1bb721[_0xee87('0x27')]]={'$like':'%'+_0x41544d[_0xee87('0x31')]['filter']+'%'};return _0x4ff77d;}})});}_0x25d7a5=_['merge']({},_0x25d7a5,_0x41544d['options']);var _0xec9fb3={'where':_0x25d7a5[_0xee87('0x3b')]};return db[_0xee87('0x2b')][_0xee87('0x1e')](_0xec9fb3)[_0xee87('0x26')](function(_0x340e2d){_0x12b13d[_0xee87('0x1e')]=_0x340e2d;if(_0x41544d['query'][_0xee87('0x3f')]){_0x25d7a5[_0xee87('0x40')]=[{'all':!![]}];}return db[_0xee87('0x2b')]['findAll'](_0x25d7a5);})[_0xee87('0x26')](function(_0x4fd74c){_0x12b13d[_0xee87('0x41')]=_0x4fd74c;return _0x12b13d;})[_0xee87('0x26')](respondWithFilteredResult(_0x24502d,_0x25d7a5))[_0xee87('0x42')](handleError(_0x24502d,null));};exports[_0xee87('0x43')]=function(_0x2110c3,_0x424386){var _0x554dde={'raw':![],'where':{'id':_0x2110c3['params']['id']}},_0x3b1ef6={};_0x3b1ef6['model']=_[_0xee87('0x32')](db[_0xee87('0x2b')][_0xee87('0x2c')]);_0x3b1ef6[_0xee87('0x31')]=_[_0xee87('0x32')](_0x2110c3[_0xee87('0x31')]);_0x3b1ef6[_0xee87('0x33')]=_['intersection'](_0x3b1ef6[_0xee87('0x30')],_0x3b1ef6['query']);_0x554dde[_0xee87('0x36')]=_[_0xee87('0x34')](_0x3b1ef6[_0xee87('0x30')],qs[_0xee87('0x35')](_0x2110c3[_0xee87('0x31')][_0xee87('0x35')]));_0x554dde[_0xee87('0x36')]=_0x554dde[_0xee87('0x36')][_0xee87('0x37')]?_0x554dde['attributes']:_0x3b1ef6[_0xee87('0x30')];if(_0x2110c3[_0xee87('0x31')]['includeAll']){_0x554dde[_0xee87('0x40')]=[{'all':!![]}];}_0x554dde=_[_0xee87('0x3d')]({},_0x554dde,_0x2110c3['options']);return db[_0xee87('0x2b')]['find'](_0x554dde)[_0xee87('0x26')](handleEntityNotFound(_0x424386,null))[_0xee87('0x26')](respondWithResult(_0x424386,null))['catch'](handleError(_0x424386,null));};exports['create']=function(_0x58726a,_0x22e9a2){return db[_0xee87('0x2b')][_0xee87('0x44')](_0x58726a[_0xee87('0x45')],{})[_0xee87('0x26')](respondWithResult(_0x22e9a2,0xc9))['catch'](handleError(_0x22e9a2,null));};exports['update']=function(_0x2e5966,_0x4cfef5){if(_0x2e5966[_0xee87('0x45')]['id']){delete _0x2e5966[_0xee87('0x45')]['id'];}return db[_0xee87('0x2b')][_0xee87('0x46')]({'where':{'id':_0x2e5966[_0xee87('0x47')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x4cfef5,null))[_0xee87('0x26')](saveUpdates(_0x2e5966[_0xee87('0x45')],null))[_0xee87('0x26')](respondWithResult(_0x4cfef5,null))[_0xee87('0x42')](handleError(_0x4cfef5,null));};exports[_0xee87('0x25')]=function(_0x4edb4d,_0x4c245f){return db[_0xee87('0x2b')][_0xee87('0x46')]({'where':{'id':_0x4edb4d[_0xee87('0x47')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x4c245f,null))[_0xee87('0x26')](removeEntity(_0x4c245f,null))['catch'](handleError(_0x4c245f,null));};exports[_0xee87('0x48')]=function(_0x4da6a4,_0x352b92,_0x410fdd){var _0x557ebf={};var _0x14e785={};var _0x4c0ed9;var _0x4d8d3a;return db[_0xee87('0x2b')][_0xee87('0x49')]({'where':{'id':_0x4da6a4[_0xee87('0x47')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x352b92,null))[_0xee87('0x26')](function(_0x3dfcae){if(_0x3dfcae){_0x4c0ed9=_0x3dfcae;_0x14e785[_0xee87('0x30')]=_[_0xee87('0x32')](db[_0xee87('0x4a')]['rawAttributes']);_0x14e785[_0xee87('0x31')]=_[_0xee87('0x32')](_0x4da6a4['query']);_0x14e785['filters']=_[_0xee87('0x34')](_0x14e785[_0xee87('0x30')],_0x14e785[_0xee87('0x31')]);_0x557ebf[_0xee87('0x36')]=_['intersection'](_0x14e785['model'],qs[_0xee87('0x35')](_0x4da6a4[_0xee87('0x31')][_0xee87('0x35')]));_0x557ebf[_0xee87('0x36')]=_0x557ebf[_0xee87('0x36')][_0xee87('0x37')]?_0x557ebf[_0xee87('0x36')]:_0x14e785[_0xee87('0x30')];_0x557ebf[_0xee87('0x4b')]=qs[_0xee87('0x3a')](_0x4da6a4['query'][_0xee87('0x3a')]);_0x557ebf[_0xee87('0x3b')]=qs['filters'](_[_0xee87('0x3c')](_0x4da6a4[_0xee87('0x31')],_0x14e785[_0xee87('0x33')]));if(_0x4da6a4['query'][_0xee87('0x4c')]){_0x557ebf[_0xee87('0x3b')]=_['merge'](_0x557ebf[_0xee87('0x3b')],{'$or':_[_0xee87('0x2a')](_0x557ebf['attributes'],function(_0x4b2dfc){var _0x2e0b02={};_0x2e0b02[_0x4b2dfc]={'$like':'%'+_0x4da6a4[_0xee87('0x31')][_0xee87('0x4c')]+'%'};return _0x2e0b02;})});}_0x557ebf=_[_0xee87('0x3d')]({},_0x557ebf,_0x4da6a4['options']);return _0x4c0ed9['getFields'](_0x557ebf);}})['then'](function(_0x11715f){if(_0x11715f){_0x4d8d3a=_0x11715f[_0xee87('0x37')];if(!_0x4da6a4['query'][_0xee87('0x38')]('nolimit')){_0x557ebf[_0xee87('0x1d')]=qs[_0xee87('0x1d')](_0x4da6a4[_0xee87('0x31')][_0xee87('0x1d')]);_0x557ebf[_0xee87('0x1b')]=qs[_0xee87('0x1b')](_0x4da6a4['query'][_0xee87('0x1b')]);}return _0x4c0ed9[_0xee87('0x48')](_0x557ebf);}})['then'](function(_0x2b7e3b){if(_0x2b7e3b){return _0x2b7e3b?{'count':_0x4d8d3a,'rows':_0x2b7e3b}:null;}})[_0xee87('0x26')](respondWithResult(_0x352b92,null))[_0xee87('0x42')](handleError(_0x352b92,null));};exports['getSubjects']=function(_0x1e4f2e,_0x5f6248,_0x52f2f2){var _0x2bdd75={};var _0x830d73={};var _0x57f4bc;var _0x18f92c;return db[_0xee87('0x2b')][_0xee87('0x49')]({'where':{'id':_0x1e4f2e[_0xee87('0x47')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x5f6248,null))[_0xee87('0x26')](function(_0x5cc4ff){if(_0x5cc4ff){_0x57f4bc=_0x5cc4ff;_0x830d73[_0xee87('0x30')]=_[_0xee87('0x32')](db[_0xee87('0x4a')][_0xee87('0x2c')]);_0x830d73[_0xee87('0x31')]=_[_0xee87('0x32')](_0x1e4f2e[_0xee87('0x31')]);_0x830d73['filters']=_['intersection'](_0x830d73[_0xee87('0x30')],_0x830d73[_0xee87('0x31')]);_0x2bdd75[_0xee87('0x36')]=_[_0xee87('0x34')](_0x830d73[_0xee87('0x30')],qs[_0xee87('0x35')](_0x1e4f2e[_0xee87('0x31')][_0xee87('0x35')]));_0x2bdd75['attributes']=_0x2bdd75[_0xee87('0x36')][_0xee87('0x37')]?_0x2bdd75['attributes']:_0x830d73[_0xee87('0x30')];_0x2bdd75['order']=qs[_0xee87('0x3a')](_0x1e4f2e[_0xee87('0x31')]['sort']);_0x2bdd75[_0xee87('0x3b')]=qs[_0xee87('0x33')](_[_0xee87('0x3c')](_0x1e4f2e[_0xee87('0x31')],_0x830d73[_0xee87('0x33')]));if(_0x1e4f2e[_0xee87('0x31')][_0xee87('0x4c')]){_0x2bdd75[_0xee87('0x3b')]=_[_0xee87('0x3d')](_0x2bdd75[_0xee87('0x3b')],{'$or':_[_0xee87('0x2a')](_0x2bdd75['attributes'],function(_0x45b7da){var _0x33efdb={};_0x33efdb[_0x45b7da]={'$like':'%'+_0x1e4f2e[_0xee87('0x31')][_0xee87('0x4c')]+'%'};return _0x33efdb;})});}_0x2bdd75=_[_0xee87('0x3d')]({},_0x2bdd75,_0x1e4f2e[_0xee87('0x4d')]);return _0x57f4bc[_0xee87('0x4e')](_0x2bdd75);}})[_0xee87('0x26')](function(_0x1ff244){if(_0x1ff244){_0x18f92c=_0x1ff244[_0xee87('0x37')];if(!_0x1e4f2e[_0xee87('0x31')]['hasOwnProperty'](_0xee87('0x39'))){_0x2bdd75[_0xee87('0x1d')]=qs['limit'](_0x1e4f2e[_0xee87('0x31')][_0xee87('0x1d')]);_0x2bdd75[_0xee87('0x1b')]=qs[_0xee87('0x1b')](_0x1e4f2e[_0xee87('0x31')][_0xee87('0x1b')]);}return _0x57f4bc[_0xee87('0x4e')](_0x2bdd75);}})['then'](function(_0x2effbe){if(_0x2effbe){return _0x2effbe?{'count':_0x18f92c,'rows':_0x2effbe}:null;}})[_0xee87('0x26')](respondWithResult(_0x5f6248,null))[_0xee87('0x42')](handleError(_0x5f6248,null));};exports[_0xee87('0x4f')]=function(_0x25efb9,_0x3324c9,_0x1d44ac){var _0x267e16={};var _0x51eb76={};var _0xc36463;var _0x95a8f7;return db[_0xee87('0x2b')][_0xee87('0x49')]({'where':{'id':_0x25efb9[_0xee87('0x47')]['id']}})[_0xee87('0x26')](handleEntityNotFound(_0x3324c9,null))[_0xee87('0x26')](function(_0x13e1f3){if(_0x13e1f3){_0xc36463=_0x13e1f3;_0x51eb76[_0xee87('0x30')]=_[_0xee87('0x32')](db['ZohoField']['rawAttributes']);_0x51eb76[_0xee87('0x31')]=_[_0xee87('0x32')](_0x25efb9[_0xee87('0x31')]);_0x51eb76[_0xee87('0x33')]=_[_0xee87('0x34')](_0x51eb76[_0xee87('0x30')],_0x51eb76[_0xee87('0x31')]);_0x267e16[_0xee87('0x36')]=_[_0xee87('0x34')](_0x51eb76[_0xee87('0x30')],qs[_0xee87('0x35')](_0x25efb9['query'][_0xee87('0x35')]));_0x267e16[_0xee87('0x36')]=_0x267e16[_0xee87('0x36')][_0xee87('0x37')]?_0x267e16[_0xee87('0x36')]:_0x51eb76[_0xee87('0x30')];_0x267e16['order']=qs[_0xee87('0x3a')](_0x25efb9[_0xee87('0x31')][_0xee87('0x3a')]);_0x267e16['where']=qs[_0xee87('0x33')](_['pick'](_0x25efb9[_0xee87('0x31')],_0x51eb76[_0xee87('0x33')]));if(_0x25efb9[_0xee87('0x31')][_0xee87('0x4c')]){_0x267e16[_0xee87('0x3b')]=_[_0xee87('0x3d')](_0x267e16[_0xee87('0x3b')],{'$or':_[_0xee87('0x2a')](_0x267e16[_0xee87('0x36')],function(_0x5644b8){var _0x56ba1b={};_0x56ba1b[_0x5644b8]={'$like':'%'+_0x25efb9[_0xee87('0x31')][_0xee87('0x4c')]+'%'};return _0x56ba1b;})});}_0x267e16=_[_0xee87('0x3d')]({},_0x267e16,_0x25efb9['options']);return _0xc36463[_0xee87('0x4f')](_0x267e16);}})[_0xee87('0x26')](function(_0x39f80f){if(_0x39f80f){_0x95a8f7=_0x39f80f[_0xee87('0x37')];if(!_0x25efb9['query'][_0xee87('0x38')](_0xee87('0x39'))){_0x267e16[_0xee87('0x1d')]=qs[_0xee87('0x1d')](_0x25efb9[_0xee87('0x31')][_0xee87('0x1d')]);_0x267e16[_0xee87('0x1b')]=qs[_0xee87('0x1b')](_0x25efb9[_0xee87('0x31')][_0xee87('0x1b')]);}return _0xc36463[_0xee87('0x4f')](_0x267e16);}})[_0xee87('0x26')](function(_0x2ee256){if(_0x2ee256){return _0x2ee256?{'count':_0x95a8f7,'rows':_0x2ee256}:null;}})['then'](respondWithResult(_0x3324c9,null))[_0xee87('0x42')](handleError(_0x3324c9,null));}; \ No newline at end of file +var _0x1de8=['type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes'];(function(_0x5131e3,_0x42afa0){var _0x4cb7ce=function(_0x4a377c){while(--_0x4a377c){_0x5131e3['push'](_0x5131e3['shift']());}};_0x4cb7ce(++_0x42afa0);}(_0x1de8,0xc5));var _0x81de=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x1de8[_0x4ca6a4];return _0x120555;};'use strict';var emlformat=require(_0x81de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81de('0x1'));var jsonpatch=require(_0x81de('0x2'));var rp=require(_0x81de('0x3'));var moment=require(_0x81de('0x4'));var BPromise=require(_0x81de('0x5'));var Mustache=require(_0x81de('0x6'));var util=require(_0x81de('0x7'));var path=require(_0x81de('0x8'));var sox=require('sox');var csv=require(_0x81de('0x9'));var ejs=require(_0x81de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81de('0xb'));var squel=require(_0x81de('0xc'));var crypto=require('crypto');var jsforce=require(_0x81de('0xd'));var deskjs=require(_0x81de('0xe'));var toCsv=require(_0x81de('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81de('0xf'));var authService=require(_0x81de('0x10'));var qs=require(_0x81de('0x11'));var as=require(_0x81de('0x12'));var hardwareService=require(_0x81de('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x81de('0x14'));var licenseUtil=require(_0x81de('0x15'));var db=require(_0x81de('0x16'))['db'];function respondWithStatusCode(_0x47cbf2,_0x295ebe){_0x295ebe=_0x295ebe||0xcc;return function(_0x4a4d46){if(_0x4a4d46){return _0x47cbf2[_0x81de('0x17')](_0x295ebe);}return _0x47cbf2[_0x81de('0x18')](_0x295ebe)[_0x81de('0x19')]();};}function respondWithResult(_0x5481c6,_0x28de61){_0x28de61=_0x28de61||0xc8;return function(_0x25d4a){if(_0x25d4a){return _0x5481c6[_0x81de('0x18')](_0x28de61)[_0x81de('0x1a')](_0x25d4a);}};}function respondWithFilteredResult(_0x493f4d,_0x3ea621){return function(_0x4e7c83){if(_0x4e7c83){var _0x4f4c69=typeof _0x3ea621[_0x81de('0x1b')]===_0x81de('0x1c')&&typeof _0x3ea621[_0x81de('0x1d')]===_0x81de('0x1c');var _0x227658=_0x4e7c83[_0x81de('0x1e')];var _0x13a7d3=_0x4f4c69?0x0:_0x3ea621[_0x81de('0x1b')];var _0xcfee96=_0x4f4c69?_0x4e7c83[_0x81de('0x1e')]:_0x3ea621['offset']+_0x3ea621[_0x81de('0x1d')];var _0x571afb;if(_0xcfee96>=_0x227658){_0xcfee96=_0x227658;_0x571afb=0xc8;}else{_0x571afb=0xce;}_0x493f4d[_0x81de('0x18')](_0x571afb);return _0x493f4d[_0x81de('0x1f')](_0x81de('0x20'),_0x13a7d3+'-'+_0xcfee96+'/'+_0x227658)[_0x81de('0x1a')](_0x4e7c83);}return null;};}function patchUpdates(_0xbc52f7){return function(_0x56c2f4){try{jsonpatch[_0x81de('0x21')](_0x56c2f4,_0xbc52f7,!![]);}catch(_0x4d64a4){return BPromise[_0x81de('0x22')](_0x4d64a4);}return _0x56c2f4[_0x81de('0x23')]();};}function saveUpdates(_0x44db90,_0x44906d){return function(_0x1150a4){if(_0x1150a4){return _0x1150a4['update'](_0x44db90)[_0x81de('0x24')](function(_0x3dea59){return _0x3dea59;});}return null;};}function removeEntity(_0x324cea,_0x17b176){return function(_0x24c31f){if(_0x24c31f){return _0x24c31f[_0x81de('0x25')]()['then'](function(){_0x324cea[_0x81de('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5577,_0x492ffb){return function(_0x18e991){if(!_0x18e991){_0x5b5577['sendStatus'](0x194);}return _0x18e991;};}function handleError(_0x3e013a,_0x58e570){_0x58e570=_0x58e570||0x1f4;return function(_0x169f57){logger[_0x81de('0x26')](_0x169f57[_0x81de('0x27')]);if(_0x169f57['name']){delete _0x169f57[_0x81de('0x28')];}_0x3e013a[_0x81de('0x18')](_0x58e570)[_0x81de('0x29')](_0x169f57);};}exports[_0x81de('0x2a')]=function(_0xa6d357,_0x533687){var _0x2f5c8f={},_0x39ac6f={},_0x2e8c88={'count':0x0,'rows':[]};var _0x4a86a8=_[_0x81de('0x2b')](db[_0x81de('0x2c')][_0x81de('0x2d')],function(_0x2f7799){return{'name':_0x2f7799['fieldName'],'type':_0x2f7799[_0x81de('0x2e')][_0x81de('0x2f')]};});_0x39ac6f[_0x81de('0x30')]=_[_0x81de('0x2b')](_0x4a86a8,'name');_0x39ac6f[_0x81de('0x31')]=_['keys'](_0xa6d357['query']);_0x39ac6f[_0x81de('0x32')]=_['intersection'](_0x39ac6f[_0x81de('0x30')],_0x39ac6f[_0x81de('0x31')]);_0x2f5c8f[_0x81de('0x33')]=_[_0x81de('0x34')](_0x39ac6f[_0x81de('0x30')],qs[_0x81de('0x35')](_0xa6d357[_0x81de('0x31')][_0x81de('0x35')]));_0x2f5c8f[_0x81de('0x33')]=_0x2f5c8f[_0x81de('0x33')][_0x81de('0x36')]?_0x2f5c8f[_0x81de('0x33')]:_0x39ac6f[_0x81de('0x30')];if(!_0xa6d357[_0x81de('0x31')][_0x81de('0x37')](_0x81de('0x38'))){_0x2f5c8f['limit']=qs[_0x81de('0x1d')](_0xa6d357[_0x81de('0x31')][_0x81de('0x1d')]);_0x2f5c8f[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0xa6d357[_0x81de('0x31')]['offset']);}_0x2f5c8f[_0x81de('0x39')]=qs[_0x81de('0x3a')](_0xa6d357[_0x81de('0x31')][_0x81de('0x3a')]);_0x2f5c8f[_0x81de('0x3b')]=qs[_0x81de('0x32')](_[_0x81de('0x3c')](_0xa6d357['query'],_0x39ac6f[_0x81de('0x32')]),_0x4a86a8);if(_0xa6d357[_0x81de('0x31')]['filter']){_0x2f5c8f[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x2f5c8f[_0x81de('0x3b')],{'$or':_['map'](_0x4a86a8,function(_0x1cfca7){if(_0x1cfca7[_0x81de('0x2e')]!=='VIRTUAL'){var _0x31b51c={};_0x31b51c[_0x1cfca7[_0x81de('0x28')]]={'$like':'%'+_0xa6d357[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x31b51c;}})});}_0x2f5c8f=_[_0x81de('0x3d')]({},_0x2f5c8f,_0xa6d357[_0x81de('0x3f')]);var _0x4ef086={'where':_0x2f5c8f[_0x81de('0x3b')]};return db[_0x81de('0x2c')]['count'](_0x4ef086)[_0x81de('0x24')](function(_0x8a9d49){_0x2e8c88['count']=_0x8a9d49;if(_0xa6d357[_0x81de('0x31')][_0x81de('0x40')]){_0x2f5c8f[_0x81de('0x41')]=[{'all':!![]}];}return db[_0x81de('0x2c')][_0x81de('0x42')](_0x2f5c8f);})['then'](function(_0x1783d7){_0x2e8c88[_0x81de('0x43')]=_0x1783d7;return _0x2e8c88;})[_0x81de('0x24')](respondWithFilteredResult(_0x533687,_0x2f5c8f))[_0x81de('0x44')](handleError(_0x533687,null));};exports[_0x81de('0x45')]=function(_0x3984e3,_0x495340){var _0x2c5421={'raw':![],'where':{'id':_0x3984e3[_0x81de('0x46')]['id']}},_0x355d42={};_0x355d42[_0x81de('0x30')]=_[_0x81de('0x47')](db[_0x81de('0x2c')][_0x81de('0x2d')]);_0x355d42[_0x81de('0x31')]=_[_0x81de('0x47')](_0x3984e3[_0x81de('0x31')]);_0x355d42[_0x81de('0x32')]=_[_0x81de('0x34')](_0x355d42[_0x81de('0x30')],_0x355d42[_0x81de('0x31')]);_0x2c5421[_0x81de('0x33')]=_[_0x81de('0x34')](_0x355d42[_0x81de('0x30')],qs['fields'](_0x3984e3[_0x81de('0x31')][_0x81de('0x35')]));_0x2c5421['attributes']=_0x2c5421['attributes'][_0x81de('0x36')]?_0x2c5421['attributes']:_0x355d42[_0x81de('0x30')];if(_0x3984e3[_0x81de('0x31')][_0x81de('0x40')]){_0x2c5421[_0x81de('0x41')]=[{'all':!![]}];}_0x2c5421=_[_0x81de('0x3d')]({},_0x2c5421,_0x3984e3[_0x81de('0x3f')]);return db[_0x81de('0x2c')][_0x81de('0x48')](_0x2c5421)[_0x81de('0x24')](handleEntityNotFound(_0x495340,null))[_0x81de('0x24')](respondWithResult(_0x495340,null))['catch'](handleError(_0x495340,null));};exports[_0x81de('0x49')]=function(_0x333359,_0x18a046){return db[_0x81de('0x2c')][_0x81de('0x49')](_0x333359['body'],{})[_0x81de('0x24')](respondWithResult(_0x18a046,0xc9))[_0x81de('0x44')](handleError(_0x18a046,null));};exports[_0x81de('0x4a')]=function(_0x524329,_0xb1de71){if(_0x524329[_0x81de('0x4b')]['id']){delete _0x524329[_0x81de('0x4b')]['id'];}return db[_0x81de('0x2c')]['find']({'where':{'id':_0x524329[_0x81de('0x46')]['id']}})['then'](handleEntityNotFound(_0xb1de71,null))['then'](saveUpdates(_0x524329['body'],null))[_0x81de('0x24')](respondWithResult(_0xb1de71,null))[_0x81de('0x44')](handleError(_0xb1de71,null));};exports['destroy']=function(_0x9db674,_0x52f75b){return db[_0x81de('0x2c')][_0x81de('0x48')]({'where':{'id':_0x9db674['params']['id']}})[_0x81de('0x24')](handleEntityNotFound(_0x52f75b,null))[_0x81de('0x24')](removeEntity(_0x52f75b,null))['catch'](handleError(_0x52f75b,null));};exports[_0x81de('0x4c')]=function(_0x5d8d3c,_0x1cd801,_0x322ef6){var _0x331b59={};var _0x487f23={};var _0x21c014;var _0x39c9a0;return db[_0x81de('0x2c')][_0x81de('0x4d')]({'where':{'id':_0x5d8d3c['params']['id']}})[_0x81de('0x24')](handleEntityNotFound(_0x1cd801,null))[_0x81de('0x24')](function(_0x50f7fb){if(_0x50f7fb){_0x21c014=_0x50f7fb;_0x487f23[_0x81de('0x30')]=_[_0x81de('0x47')](db[_0x81de('0x4e')]['rawAttributes']);_0x487f23['query']=_[_0x81de('0x47')](_0x5d8d3c[_0x81de('0x31')]);_0x487f23['filters']=_[_0x81de('0x34')](_0x487f23[_0x81de('0x30')],_0x487f23['query']);_0x331b59[_0x81de('0x33')]=_['intersection'](_0x487f23['model'],qs[_0x81de('0x35')](_0x5d8d3c[_0x81de('0x31')][_0x81de('0x35')]));_0x331b59['attributes']=_0x331b59[_0x81de('0x33')][_0x81de('0x36')]?_0x331b59[_0x81de('0x33')]:_0x487f23[_0x81de('0x30')];_0x331b59['order']=qs[_0x81de('0x3a')](_0x5d8d3c[_0x81de('0x31')][_0x81de('0x3a')]);_0x331b59[_0x81de('0x3b')]=qs[_0x81de('0x32')](_['pick'](_0x5d8d3c[_0x81de('0x31')],_0x487f23[_0x81de('0x32')]));if(_0x5d8d3c[_0x81de('0x31')][_0x81de('0x3e')]){_0x331b59[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x331b59[_0x81de('0x3b')],{'$or':_[_0x81de('0x2b')](_0x331b59['attributes'],function(_0x1397e1){var _0x58d602={};_0x58d602[_0x1397e1]={'$like':'%'+_0x5d8d3c[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x58d602;})});}_0x331b59=_[_0x81de('0x3d')]({},_0x331b59,_0x5d8d3c[_0x81de('0x3f')]);return _0x21c014[_0x81de('0x4c')](_0x331b59);}})[_0x81de('0x24')](function(_0x5e1e36){if(_0x5e1e36){_0x39c9a0=_0x5e1e36[_0x81de('0x36')];if(!_0x5d8d3c[_0x81de('0x31')][_0x81de('0x37')]('nolimit')){_0x331b59[_0x81de('0x1d')]=qs['limit'](_0x5d8d3c[_0x81de('0x31')][_0x81de('0x1d')]);_0x331b59[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0x5d8d3c[_0x81de('0x31')]['offset']);}return _0x21c014['getFields'](_0x331b59);}})[_0x81de('0x24')](function(_0xb7d39b){if(_0xb7d39b){return _0xb7d39b?{'count':_0x39c9a0,'rows':_0xb7d39b}:null;}})[_0x81de('0x24')](respondWithResult(_0x1cd801,null))['catch'](handleError(_0x1cd801,null));};exports[_0x81de('0x4f')]=function(_0x3750bf,_0x3361ff,_0x540fe2){var _0x47e94b={};var _0x2bc2bb={};var _0x315250;var _0x59582b;return db['ZohoConfiguration'][_0x81de('0x4d')]({'where':{'id':_0x3750bf[_0x81de('0x46')]['id']}})['then'](handleEntityNotFound(_0x3361ff,null))[_0x81de('0x24')](function(_0x1cd0e5){if(_0x1cd0e5){_0x315250=_0x1cd0e5;_0x2bc2bb[_0x81de('0x30')]=_['keys'](db[_0x81de('0x4e')]['rawAttributes']);_0x2bc2bb[_0x81de('0x31')]=_[_0x81de('0x47')](_0x3750bf['query']);_0x2bc2bb['filters']=_['intersection'](_0x2bc2bb[_0x81de('0x30')],_0x2bc2bb['query']);_0x47e94b[_0x81de('0x33')]=_[_0x81de('0x34')](_0x2bc2bb['model'],qs[_0x81de('0x35')](_0x3750bf['query'][_0x81de('0x35')]));_0x47e94b[_0x81de('0x33')]=_0x47e94b['attributes']['length']?_0x47e94b[_0x81de('0x33')]:_0x2bc2bb[_0x81de('0x30')];_0x47e94b[_0x81de('0x39')]=qs[_0x81de('0x3a')](_0x3750bf[_0x81de('0x31')][_0x81de('0x3a')]);_0x47e94b[_0x81de('0x3b')]=qs[_0x81de('0x32')](_[_0x81de('0x3c')](_0x3750bf[_0x81de('0x31')],_0x2bc2bb[_0x81de('0x32')]));if(_0x3750bf[_0x81de('0x31')][_0x81de('0x3e')]){_0x47e94b[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x47e94b[_0x81de('0x3b')],{'$or':_['map'](_0x47e94b['attributes'],function(_0x58fbf6){var _0x32615f={};_0x32615f[_0x58fbf6]={'$like':'%'+_0x3750bf[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x32615f;})});}_0x47e94b=_[_0x81de('0x3d')]({},_0x47e94b,_0x3750bf[_0x81de('0x3f')]);return _0x315250[_0x81de('0x4f')](_0x47e94b);}})[_0x81de('0x24')](function(_0x3ad9ff){if(_0x3ad9ff){_0x59582b=_0x3ad9ff[_0x81de('0x36')];if(!_0x3750bf[_0x81de('0x31')][_0x81de('0x37')]('nolimit')){_0x47e94b['limit']=qs[_0x81de('0x1d')](_0x3750bf[_0x81de('0x31')][_0x81de('0x1d')]);_0x47e94b[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0x3750bf[_0x81de('0x31')][_0x81de('0x1b')]);}return _0x315250[_0x81de('0x4f')](_0x47e94b);}})['then'](function(_0x10e413){if(_0x10e413){return _0x10e413?{'count':_0x59582b,'rows':_0x10e413}:null;}})[_0x81de('0x24')](respondWithResult(_0x3361ff,null))[_0x81de('0x44')](handleError(_0x3361ff,null));};exports[_0x81de('0x50')]=function(_0x44d481,_0x2ab8ce,_0x118a9a){var _0x5b054f={};var _0x4dce30={};var _0x5266bf;var _0x2d39f5;return db['ZohoConfiguration'][_0x81de('0x4d')]({'where':{'id':_0x44d481[_0x81de('0x46')]['id']}})[_0x81de('0x24')](handleEntityNotFound(_0x2ab8ce,null))['then'](function(_0x57730c){if(_0x57730c){_0x5266bf=_0x57730c;_0x4dce30[_0x81de('0x30')]=_['keys'](db[_0x81de('0x4e')]['rawAttributes']);_0x4dce30['query']=_['keys'](_0x44d481[_0x81de('0x31')]);_0x4dce30[_0x81de('0x32')]=_[_0x81de('0x34')](_0x4dce30[_0x81de('0x30')],_0x4dce30[_0x81de('0x31')]);_0x5b054f[_0x81de('0x33')]=_[_0x81de('0x34')](_0x4dce30[_0x81de('0x30')],qs[_0x81de('0x35')](_0x44d481[_0x81de('0x31')]['fields']));_0x5b054f['attributes']=_0x5b054f[_0x81de('0x33')][_0x81de('0x36')]?_0x5b054f[_0x81de('0x33')]:_0x4dce30['model'];_0x5b054f[_0x81de('0x39')]=qs[_0x81de('0x3a')](_0x44d481['query'][_0x81de('0x3a')]);_0x5b054f['where']=qs['filters'](_[_0x81de('0x3c')](_0x44d481['query'],_0x4dce30[_0x81de('0x32')]));if(_0x44d481['query'][_0x81de('0x3e')]){_0x5b054f[_0x81de('0x3b')]=_[_0x81de('0x3d')](_0x5b054f[_0x81de('0x3b')],{'$or':_[_0x81de('0x2b')](_0x5b054f['attributes'],function(_0x3a359c){var _0x7f0786={};_0x7f0786[_0x3a359c]={'$like':'%'+_0x44d481[_0x81de('0x31')][_0x81de('0x3e')]+'%'};return _0x7f0786;})});}_0x5b054f=_[_0x81de('0x3d')]({},_0x5b054f,_0x44d481['options']);return _0x5266bf[_0x81de('0x50')](_0x5b054f);}})[_0x81de('0x24')](function(_0x4d4c6f){if(_0x4d4c6f){_0x2d39f5=_0x4d4c6f[_0x81de('0x36')];if(!_0x44d481[_0x81de('0x31')][_0x81de('0x37')](_0x81de('0x38'))){_0x5b054f[_0x81de('0x1d')]=qs[_0x81de('0x1d')](_0x44d481[_0x81de('0x31')][_0x81de('0x1d')]);_0x5b054f[_0x81de('0x1b')]=qs[_0x81de('0x1b')](_0x44d481[_0x81de('0x31')][_0x81de('0x1b')]);}return _0x5266bf[_0x81de('0x50')](_0x5b054f);}})['then'](function(_0x1cc624){if(_0x1cc624){return _0x1cc624?{'count':_0x2d39f5,'rows':_0x1cc624}:null;}})[_0x81de('0x24')](respondWithResult(_0x2ab8ce,null))[_0x81de('0x44')](handleError(_0x2ab8ce,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4e33dc9..fa62fa9 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 _0x4000=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x3ebb1b,_0xb58978){var _0xbf91be=function(_0x386bda){while(--_0x386bda){_0x3ebb1b['push'](_0x3ebb1b['shift']());}};_0xbf91be(++_0xb58978);}(_0x4000,0x11a));var _0x0400=function(_0x1f5941,_0x4509b6){_0x1f5941=_0x1f5941-0x0;var _0x20848e=_0x4000[_0x1f5941];return _0x20848e;};'use strict';var _=require(_0x0400('0x0'));var util=require(_0x0400('0x1'));var logger=require(_0x0400('0x2'))(_0x0400('0x3'));var moment=require(_0x0400('0x4'));var BPromise=require('bluebird');var rp=require(_0x0400('0x5'));var fs=require('fs');var path=require(_0x0400('0x6'));var rimraf=require(_0x0400('0x7'));var config=require(_0x0400('0x8'));var attributes=require(_0x0400('0x9'));module[_0x0400('0xa')]=function(_0x350bf6,_0x4a90e0){return _0x350bf6[_0x0400('0xb')](_0x0400('0xc'),attributes,{'tableName':_0x0400('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc3b=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','bluebird'];(function(_0x3bdc1b,_0x38ff12){var _0x2209bb=function(_0x5458fe){while(--_0x5458fe){_0x3bdc1b['push'](_0x3bdc1b['shift']());}};_0x2209bb(++_0x38ff12);}(_0xcc3b,0x189));var _0xbcc3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcc3b[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbcc3('0x0'))(_0xbcc3('0x1'));var moment=require('moment');var BPromise=require(_0xbcc3('0x2'));var rp=require(_0xbcc3('0x3'));var fs=require('fs');var path=require(_0xbcc3('0x4'));var rimraf=require(_0xbcc3('0x5'));var config=require(_0xbcc3('0x6'));var attributes=require(_0xbcc3('0x7'));module['exports']=function(_0x549671,_0x3eb89f){return _0x549671[_0xbcc3('0x8')](_0xbcc3('0x9'),attributes,{'tableName':_0xbcc3('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 10566c4..0740f34 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 _0x9843=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ZohoConfiguration,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x9843,0xce));var _0x3984=function(_0x345e4c,_0x3e73ba){_0x345e4c=_0x345e4c-0x0;var _0x40c41c=_0x9843[_0x345e4c];return _0x40c41c;};'use strict';var _=require('lodash');var util=require(_0x3984('0x0'));var moment=require(_0x3984('0x1'));var BPromise=require(_0x3984('0x2'));var rs=require(_0x3984('0x3'));var fs=require('fs');var Redis=require(_0x3984('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3984('0x5'));var logger=require('../../config/logger')(_0x3984('0x6'));var config=require(_0x3984('0x7'));var jayson=require(_0x3984('0x8'));var client=jayson[_0x3984('0x9')][_0x3984('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6d13,_0x281591,_0x132ebb){return new BPromise(function(_0x1b4aba,_0x17e50d){return client[_0x3984('0xb')](_0x1a6d13,_0x132ebb)[_0x3984('0xc')](function(_0xdb5612){logger[_0x3984('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x281591,_0x3984('0xe'));logger[_0x3984('0xf')](_0x3984('0x10'),_0x281591,_0x3984('0xe'),JSON['stringify'](_0xdb5612));if(_0xdb5612[_0x3984('0x11')]){if(_0xdb5612[_0x3984('0x11')][_0x3984('0x12')]===0x1f4){logger[_0x3984('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x281591,_0xdb5612[_0x3984('0x11')][_0x3984('0x13')]);return _0x17e50d(_0xdb5612[_0x3984('0x11')][_0x3984('0x13')]);}logger[_0x3984('0x11')](_0x3984('0x14'),_0x281591,_0xdb5612[_0x3984('0x11')][_0x3984('0x13')]);return _0x1b4aba(_0xdb5612[_0x3984('0x11')][_0x3984('0x13')]);}else{logger[_0x3984('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x281591,_0x3984('0xe'));_0x1b4aba(_0xdb5612['result'][_0x3984('0x13')]);}})[_0x3984('0x15')](function(_0x451b59){logger[_0x3984('0x11')](_0x3984('0x14'),_0x281591,_0x451b59);_0x17e50d(_0x451b59);});});} \ No newline at end of file +var _0xfa18=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xfa18,0x14b));var _0x8fa1=function(_0x15ccc0,_0x2ceee3){_0x15ccc0=_0x15ccc0-0x0;var _0x251353=_0xfa18[_0x15ccc0];return _0x251353;};'use strict';var _=require(_0x8fa1('0x0'));var util=require(_0x8fa1('0x1'));var moment=require(_0x8fa1('0x2'));var BPromise=require(_0x8fa1('0x3'));var rs=require(_0x8fa1('0x4'));var fs=require('fs');var Redis=require(_0x8fa1('0x5'));var db=require(_0x8fa1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa1('0x7'))(_0x8fa1('0x8'));var config=require(_0x8fa1('0x9'));var jayson=require(_0x8fa1('0xa'));var client=jayson[_0x8fa1('0xb')][_0x8fa1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x139723,_0x20f3c2,_0x2edb91){return new BPromise(function(_0x11fa5f,_0x265af3){return client[_0x8fa1('0xd')](_0x139723,_0x2edb91)[_0x8fa1('0xe')](function(_0x3cca2e){logger[_0x8fa1('0xf')](_0x8fa1('0x10'),_0x20f3c2,_0x8fa1('0x11'));logger[_0x8fa1('0x12')](_0x8fa1('0x13'),_0x20f3c2,_0x8fa1('0x11'),JSON[_0x8fa1('0x14')](_0x3cca2e));if(_0x3cca2e['error']){if(_0x3cca2e[_0x8fa1('0x15')][_0x8fa1('0x16')]===0x1f4){logger['error'](_0x8fa1('0x10'),_0x20f3c2,_0x3cca2e[_0x8fa1('0x15')][_0x8fa1('0x17')]);return _0x265af3(_0x3cca2e['error']['message']);}logger[_0x8fa1('0x15')](_0x8fa1('0x10'),_0x20f3c2,_0x3cca2e[_0x8fa1('0x15')][_0x8fa1('0x17')]);return _0x11fa5f(_0x3cca2e[_0x8fa1('0x15')]['message']);}else{logger['info'](_0x8fa1('0x10'),_0x20f3c2,_0x8fa1('0x11'));_0x11fa5f(_0x3cca2e[_0x8fa1('0x18')][_0x8fa1('0x17')]);}})[_0x8fa1('0x19')](function(_0x23a97b){logger[_0x8fa1('0x15')](_0x8fa1('0x10'),_0x20f3c2,_0x23a97b);_0x265af3(_0x23a97b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4f00273..e6cce44 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 _0xd5d2=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x231962,_0x5d8490){var _0x3ccee8=function(_0x1f1c9e){while(--_0x1f1c9e){_0x231962['push'](_0x231962['shift']());}};_0x3ccee8(++_0x5d8490);}(_0xd5d2,0x154));var _0x2d5d=function(_0x358723,_0xfbf140){_0x358723=_0x358723-0x0;var _0x49fa56=_0xd5d2[_0x358723];return _0x49fa56;};'use strict';var multer=require('multer');var util=require(_0x2d5d('0x0'));var path=require(_0x2d5d('0x1'));var timeout=require(_0x2d5d('0x2'));var express=require(_0x2d5d('0x3'));var router=express[_0x2d5d('0x4')]();var fs_extra=require(_0x2d5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2d5d('0x6'));var config=require(_0x2d5d('0x7'));var controller=require(_0x2d5d('0x8'));router[_0x2d5d('0x9')]('/',auth[_0x2d5d('0xa')](),controller[_0x2d5d('0xb')]);router[_0x2d5d('0x9')](_0x2d5d('0xc'),auth['isAuthenticated'](),controller[_0x2d5d('0xd')]);router[_0x2d5d('0xe')]('/',auth[_0x2d5d('0xa')](),controller[_0x2d5d('0xf')]);router[_0x2d5d('0x10')](_0x2d5d('0xc'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0x11')]);router['delete'](_0x2d5d('0xc'),auth[_0x2d5d('0xa')](),controller[_0x2d5d('0x12')]);module[_0x2d5d('0x13')]=router; \ No newline at end of file +var _0xcf60=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcf60,0x122));var _0x0cf6=function(_0x510118,_0x381c75){_0x510118=_0x510118-0x0;var _0x153431=_0xcf60[_0x510118];return _0x153431;};'use strict';var multer=require(_0x0cf6('0x0'));var util=require(_0x0cf6('0x1'));var path=require(_0x0cf6('0x2'));var timeout=require(_0x0cf6('0x3'));var express=require(_0x0cf6('0x4'));var router=express[_0x0cf6('0x5')]();var fs_extra=require(_0x0cf6('0x6'));var auth=require(_0x0cf6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0cf6('0x8'));var controller=require(_0x0cf6('0x9'));router[_0x0cf6('0xa')]('/',auth[_0x0cf6('0xb')](),controller[_0x0cf6('0xc')]);router[_0x0cf6('0xa')](_0x0cf6('0xd'),auth[_0x0cf6('0xb')](),controller[_0x0cf6('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0cf6('0xf')]);router[_0x0cf6('0x10')](_0x0cf6('0xd'),auth[_0x0cf6('0xb')](),controller[_0x0cf6('0x11')]);router['delete']('/:id',auth[_0x0cf6('0xb')](),controller[_0x0cf6('0x12')]);module[_0x0cf6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 4bb52d7..5f3fe2f 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 _0x8a5b=['picklist','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x8a5b,0x1d8));var _0xb8a5=function(_0x1900a3,_0x5c9e62){_0x1900a3=_0x1900a3-0x0;var _0x434e6e=_0x8a5b[_0x1900a3];return _0x434e6e;};'use strict';var Sequelize=require('sequelize');module[_0xb8a5('0x0')]={'type':{'type':Sequelize[_0xb8a5('0x1')](_0xb8a5('0x2'),_0xb8a5('0x3'),'customVariable',_0xb8a5('0x4'),_0xb8a5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb8a5('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb8a5('0x1')](_0xb8a5('0x2'),_0xb8a5('0x3'),_0xb8a5('0x7'))},'keyContent':{'type':Sequelize[_0xb8a5('0x6')]},'idField':{'type':Sequelize[_0xb8a5('0x6')]},'nameField':{'type':Sequelize[_0xb8a5('0x6')]},'customField':{'type':Sequelize[_0xb8a5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb8a5('0x6')]}}; \ No newline at end of file +var _0x2203=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x1b8f52,_0x111226){var _0x17c536=function(_0x3cbea5){while(--_0x3cbea5){_0x1b8f52['push'](_0x1b8f52['shift']());}};_0x17c536(++_0x111226);}(_0x2203,0x127));var _0x3220=function(_0x2276f4,_0x4b0ee5){_0x2276f4=_0x2276f4-0x0;var _0x17186c=_0x2203[_0x2276f4];return _0x17186c;};'use strict';var Sequelize=require(_0x3220('0x0'));module[_0x3220('0x1')]={'type':{'type':Sequelize[_0x3220('0x2')](_0x3220('0x3'),'variable',_0x3220('0x4'),_0x3220('0x5'),'picklist'),'defaultValue':_0x3220('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3220('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3220('0x7'),_0x3220('0x4'))},'keyContent':{'type':Sequelize[_0x3220('0x6')]},'idField':{'type':Sequelize[_0x3220('0x6')]},'nameField':{'type':Sequelize[_0x3220('0x6')]},'customField':{'type':Sequelize[_0x3220('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3220('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f3790e5..1c140e5 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 _0xd95e=['find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options'];(function(_0x5dd5eb,_0x34a70a){var _0x135831=function(_0x93722a){while(--_0x93722a){_0x5dd5eb['push'](_0x5dd5eb['shift']());}};_0x135831(++_0x34a70a);}(_0xd95e,0x171));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xed95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed95('0x1'));var jsonpatch=require(_0xed95('0x2'));var rp=require('request-promise');var moment=require(_0xed95('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed95('0x4'));var util=require(_0xed95('0x5'));var path=require(_0xed95('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed95('0x7'));var fs=require('fs');var fs_extra=require(_0xed95('0x8'));var _=require('lodash');var squel=require(_0xed95('0x9'));var crypto=require(_0xed95('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xed95('0xb'));var toCsv=require(_0xed95('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xed95('0xd'));var authService=require(_0xed95('0xe'));var qs=require(_0xed95('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed95('0x10'));var logger=require(_0xed95('0x11'))(_0xed95('0x12'));var utils=require(_0xed95('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xed95('0x14'));var db=require(_0xed95('0x15'))['db'];function respondWithStatusCode(_0x22b0b5,_0x137897){_0x137897=_0x137897||0xcc;return function(_0x17a5ae){if(_0x17a5ae){return _0x22b0b5[_0xed95('0x16')](_0x137897);}return _0x22b0b5['status'](_0x137897)['end']();};}function respondWithResult(_0x893cd8,_0x450d2e){_0x450d2e=_0x450d2e||0xc8;return function(_0x507c91){if(_0x507c91){return _0x893cd8[_0xed95('0x17')](_0x450d2e)[_0xed95('0x18')](_0x507c91);}};}function respondWithFilteredResult(_0x9f5373,_0x451064){return function(_0x2bf559){if(_0x2bf559){var _0xcdba45=typeof _0x451064[_0xed95('0x19')]==='undefined'&&typeof _0x451064[_0xed95('0x1a')]==='undefined';var _0x795f21=_0x2bf559[_0xed95('0x1b')];var _0x5cc98d=_0xcdba45?0x0:_0x451064[_0xed95('0x19')];var _0x5d4ef4=_0xcdba45?_0x2bf559['count']:_0x451064[_0xed95('0x19')]+_0x451064[_0xed95('0x1a')];var _0xc05f3f;if(_0x5d4ef4>=_0x795f21){_0x5d4ef4=_0x795f21;_0xc05f3f=0xc8;}else{_0xc05f3f=0xce;}_0x9f5373[_0xed95('0x17')](_0xc05f3f);return _0x9f5373[_0xed95('0x1c')](_0xed95('0x1d'),_0x5cc98d+'-'+_0x5d4ef4+'/'+_0x795f21)[_0xed95('0x18')](_0x2bf559);}return null;};}function patchUpdates(_0x59763e){return function(_0x53943b){try{jsonpatch[_0xed95('0x1e')](_0x53943b,_0x59763e,!![]);}catch(_0x2f9321){return BPromise[_0xed95('0x1f')](_0x2f9321);}return _0x53943b[_0xed95('0x20')]();};}function saveUpdates(_0xe53ad6,_0x47e242){return function(_0x5b60bb){if(_0x5b60bb){return _0x5b60bb[_0xed95('0x21')](_0xe53ad6)[_0xed95('0x22')](function(_0x1f95e8){return _0x1f95e8;});}return null;};}function removeEntity(_0x38a85a,_0xad8543){return function(_0x3cddde){if(_0x3cddde){return _0x3cddde[_0xed95('0x23')]()[_0xed95('0x22')](function(){_0x38a85a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5091,_0x3bf521){return function(_0x5d10b6){if(!_0x5d10b6){_0x1b5091[_0xed95('0x16')](0x194);}return _0x5d10b6;};}function handleError(_0x96b7e6,_0x4d9183){_0x4d9183=_0x4d9183||0x1f4;return function(_0x29a117){logger[_0xed95('0x24')](_0x29a117[_0xed95('0x25')]);if(_0x29a117[_0xed95('0x26')]){delete _0x29a117[_0xed95('0x26')];}_0x96b7e6[_0xed95('0x17')](_0x4d9183)[_0xed95('0x27')](_0x29a117);};}exports[_0xed95('0x28')]=function(_0x35d6e1,_0x3c64fd){var _0x5cad29={},_0x2e3376={},_0x531b43={'count':0x0,'rows':[]};var _0x47c3ec=_['map'](db[_0xed95('0x29')][_0xed95('0x2a')],function(_0x19db6d){return{'name':_0x19db6d[_0xed95('0x2b')],'type':_0x19db6d[_0xed95('0x2c')][_0xed95('0x2d')]};});_0x2e3376['model']=_['map'](_0x47c3ec,_0xed95('0x26'));_0x2e3376['query']=_['keys'](_0x35d6e1[_0xed95('0x2e')]);_0x2e3376['filters']=_[_0xed95('0x2f')](_0x2e3376[_0xed95('0x30')],_0x2e3376[_0xed95('0x2e')]);_0x5cad29[_0xed95('0x31')]=_['intersection'](_0x2e3376[_0xed95('0x30')],qs[_0xed95('0x32')](_0x35d6e1[_0xed95('0x2e')][_0xed95('0x32')]));_0x5cad29[_0xed95('0x31')]=_0x5cad29[_0xed95('0x31')][_0xed95('0x33')]?_0x5cad29[_0xed95('0x31')]:_0x2e3376[_0xed95('0x30')];if(!_0x35d6e1['query'][_0xed95('0x34')](_0xed95('0x35'))){_0x5cad29['limit']=qs[_0xed95('0x1a')](_0x35d6e1[_0xed95('0x2e')][_0xed95('0x1a')]);_0x5cad29[_0xed95('0x19')]=qs['offset'](_0x35d6e1[_0xed95('0x2e')][_0xed95('0x19')]);}_0x5cad29[_0xed95('0x36')]=qs['sort'](_0x35d6e1[_0xed95('0x2e')]['sort']);_0x5cad29['where']=qs[_0xed95('0x37')](_[_0xed95('0x38')](_0x35d6e1[_0xed95('0x2e')],_0x2e3376[_0xed95('0x37')]),_0x47c3ec);if(_0x35d6e1['query']['filter']){_0x5cad29[_0xed95('0x39')]=_[_0xed95('0x3a')](_0x5cad29['where'],{'$or':_[_0xed95('0x3b')](_0x47c3ec,function(_0x2cb8ed){if(_0x2cb8ed['type']!==_0xed95('0x3c')){var _0x1ee195={};_0x1ee195[_0x2cb8ed[_0xed95('0x26')]]={'$like':'%'+_0x35d6e1[_0xed95('0x2e')]['filter']+'%'};return _0x1ee195;}})});}_0x5cad29=_[_0xed95('0x3a')]({},_0x5cad29,_0x35d6e1['options']);var _0x11dcd8={'where':_0x5cad29[_0xed95('0x39')]};return db[_0xed95('0x29')][_0xed95('0x1b')](_0x11dcd8)[_0xed95('0x22')](function(_0x807cc){_0x531b43['count']=_0x807cc;if(_0x35d6e1[_0xed95('0x2e')][_0xed95('0x3d')]){_0x5cad29[_0xed95('0x3e')]=[{'all':!![]}];}return db['ZohoField'][_0xed95('0x3f')](_0x5cad29);})[_0xed95('0x22')](function(_0xe3c92){_0x531b43[_0xed95('0x40')]=_0xe3c92;return _0x531b43;})[_0xed95('0x22')](respondWithFilteredResult(_0x3c64fd,_0x5cad29))['catch'](handleError(_0x3c64fd,null));};exports[_0xed95('0x41')]=function(_0x3d1e39,_0x335a67){var _0x3aecdd={'raw':!![],'where':{'id':_0x3d1e39[_0xed95('0x42')]['id']}},_0x4a0bc1={};_0x4a0bc1[_0xed95('0x30')]=_['keys'](db[_0xed95('0x29')]['rawAttributes']);_0x4a0bc1[_0xed95('0x2e')]=_[_0xed95('0x43')](_0x3d1e39[_0xed95('0x2e')]);_0x4a0bc1[_0xed95('0x37')]=_[_0xed95('0x2f')](_0x4a0bc1['model'],_0x4a0bc1[_0xed95('0x2e')]);_0x3aecdd['attributes']=_[_0xed95('0x2f')](_0x4a0bc1[_0xed95('0x30')],qs[_0xed95('0x32')](_0x3d1e39[_0xed95('0x2e')]['fields']));_0x3aecdd[_0xed95('0x31')]=_0x3aecdd[_0xed95('0x31')][_0xed95('0x33')]?_0x3aecdd[_0xed95('0x31')]:_0x4a0bc1[_0xed95('0x30')];if(_0x3d1e39[_0xed95('0x2e')]['includeAll']){_0x3aecdd['include']=[{'all':!![]}];}_0x3aecdd=_[_0xed95('0x3a')]({},_0x3aecdd,_0x3d1e39[_0xed95('0x44')]);return db[_0xed95('0x29')][_0xed95('0x45')](_0x3aecdd)[_0xed95('0x22')](handleEntityNotFound(_0x335a67,null))[_0xed95('0x22')](respondWithResult(_0x335a67,null))[_0xed95('0x46')](handleError(_0x335a67,null));};exports[_0xed95('0x47')]=function(_0x26413b,_0x3a115a){return db[_0xed95('0x29')][_0xed95('0x47')](_0x26413b[_0xed95('0x48')],{})[_0xed95('0x22')](respondWithResult(_0x3a115a,0xc9))[_0xed95('0x46')](handleError(_0x3a115a,null));};exports[_0xed95('0x21')]=function(_0x3ecaa3,_0x2020a0){if(_0x3ecaa3[_0xed95('0x48')]['id']){delete _0x3ecaa3[_0xed95('0x48')]['id'];}return db[_0xed95('0x29')]['find']({'where':{'id':_0x3ecaa3['params']['id']}})[_0xed95('0x22')](handleEntityNotFound(_0x2020a0,null))[_0xed95('0x22')](saveUpdates(_0x3ecaa3[_0xed95('0x48')],null))[_0xed95('0x22')](respondWithResult(_0x2020a0,null))[_0xed95('0x46')](handleError(_0x2020a0,null));};exports[_0xed95('0x23')]=function(_0x442aad,_0x3d164e){return db['ZohoField'][_0xed95('0x45')]({'where':{'id':_0x442aad['params']['id']}})['then'](handleEntityNotFound(_0x3d164e,null))['then'](removeEntity(_0x3d164e,null))['catch'](handleError(_0x3d164e,null));}; \ No newline at end of file +var _0xada7=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','error','send','index','map','fieldName','key','model','name','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoField','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body'];(function(_0x24b47d,_0x8780cf){var _0x4ab1a7=function(_0x3d754a){while(--_0x3d754a){_0x24b47d['push'](_0x24b47d['shift']());}};_0x4ab1a7(++_0x8780cf);}(_0xada7,0x186));var _0x7ada=function(_0x4433aa,_0xe66175){_0x4433aa=_0x4433aa-0x0;var _0x111c1b=_0xada7[_0x4433aa];return _0x111c1b;};'use strict';var emlformat=require(_0x7ada('0x0'));var rimraf=require(_0x7ada('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ada('0x2'));var rp=require(_0x7ada('0x3'));var moment=require(_0x7ada('0x4'));var BPromise=require(_0x7ada('0x5'));var Mustache=require(_0x7ada('0x6'));var util=require('util');var path=require(_0x7ada('0x7'));var sox=require(_0x7ada('0x8'));var csv=require(_0x7ada('0x9'));var ejs=require(_0x7ada('0xa'));var fs=require('fs');var fs_extra=require(_0x7ada('0xb'));var _=require(_0x7ada('0xc'));var squel=require('squel');var crypto=require(_0x7ada('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7ada('0x9'));var querystring=require(_0x7ada('0xe'));var Papa=require('papaparse');var Redis=require(_0x7ada('0xf'));var authService=require(_0x7ada('0x10'));var qs=require(_0x7ada('0x11'));var as=require(_0x7ada('0x12'));var hardwareService=require(_0x7ada('0x13'));var logger=require('../../config/logger')(_0x7ada('0x14'));var utils=require(_0x7ada('0x15'));var config=require(_0x7ada('0x16'));var licenseUtil=require(_0x7ada('0x17'));var db=require(_0x7ada('0x18'))['db'];function respondWithStatusCode(_0x1dbcda,_0x3c243f){_0x3c243f=_0x3c243f||0xcc;return function(_0x1af15c){if(_0x1af15c){return _0x1dbcda[_0x7ada('0x19')](_0x3c243f);}return _0x1dbcda[_0x7ada('0x1a')](_0x3c243f)[_0x7ada('0x1b')]();};}function respondWithResult(_0x38672a,_0x19c2ec){_0x19c2ec=_0x19c2ec||0xc8;return function(_0x4cabda){if(_0x4cabda){return _0x38672a['status'](_0x19c2ec)[_0x7ada('0x1c')](_0x4cabda);}};}function respondWithFilteredResult(_0x2d07ef,_0x4f2346){return function(_0x225a29){if(_0x225a29){var _0xd6efd=typeof _0x4f2346['offset']===_0x7ada('0x1d')&&typeof _0x4f2346[_0x7ada('0x1e')]===_0x7ada('0x1d');var _0x349a30=_0x225a29[_0x7ada('0x1f')];var _0x434e65=_0xd6efd?0x0:_0x4f2346[_0x7ada('0x20')];var _0x1e9376=_0xd6efd?_0x225a29[_0x7ada('0x1f')]:_0x4f2346[_0x7ada('0x20')]+_0x4f2346[_0x7ada('0x1e')];var _0x4fef9b;if(_0x1e9376>=_0x349a30){_0x1e9376=_0x349a30;_0x4fef9b=0xc8;}else{_0x4fef9b=0xce;}_0x2d07ef[_0x7ada('0x1a')](_0x4fef9b);return _0x2d07ef[_0x7ada('0x21')](_0x7ada('0x22'),_0x434e65+'-'+_0x1e9376+'/'+_0x349a30)['json'](_0x225a29);}return null;};}function patchUpdates(_0x2b6146){return function(_0x2c7119){try{jsonpatch[_0x7ada('0x23')](_0x2c7119,_0x2b6146,!![]);}catch(_0x48e273){return BPromise[_0x7ada('0x24')](_0x48e273);}return _0x2c7119[_0x7ada('0x25')]();};}function saveUpdates(_0x21a7ac,_0x25daef){return function(_0x44c842){if(_0x44c842){return _0x44c842[_0x7ada('0x26')](_0x21a7ac)['then'](function(_0x24bc11){return _0x24bc11;});}return null;};}function removeEntity(_0xf5f7ff,_0x16cdd2){return function(_0x241095){if(_0x241095){return _0x241095['destroy']()['then'](function(){_0xf5f7ff[_0x7ada('0x1a')](0xcc)[_0x7ada('0x1b')]();});}};}function handleEntityNotFound(_0x24be33,_0x4a3211){return function(_0x3f9ab1){if(!_0x3f9ab1){_0x24be33[_0x7ada('0x19')](0x194);}return _0x3f9ab1;};}function handleError(_0x275cbf,_0x58054a){_0x58054a=_0x58054a||0x1f4;return function(_0x1f29bd){logger[_0x7ada('0x27')](_0x1f29bd['stack']);if(_0x1f29bd['name']){delete _0x1f29bd['name'];}_0x275cbf[_0x7ada('0x1a')](_0x58054a)[_0x7ada('0x28')](_0x1f29bd);};}exports[_0x7ada('0x29')]=function(_0x552132,_0xdae7bb){var _0x187302={},_0x1510f3={},_0xa4b9be={'count':0x0,'rows':[]};var _0x16b9db=_[_0x7ada('0x2a')](db['ZohoField']['rawAttributes'],function(_0x1de558){return{'name':_0x1de558[_0x7ada('0x2b')],'type':_0x1de558['type'][_0x7ada('0x2c')]};});_0x1510f3[_0x7ada('0x2d')]=_['map'](_0x16b9db,_0x7ada('0x2e'));_0x1510f3[_0x7ada('0x2f')]=_['keys'](_0x552132[_0x7ada('0x2f')]);_0x1510f3[_0x7ada('0x30')]=_['intersection'](_0x1510f3[_0x7ada('0x2d')],_0x1510f3['query']);_0x187302[_0x7ada('0x31')]=_[_0x7ada('0x32')](_0x1510f3['model'],qs['fields'](_0x552132[_0x7ada('0x2f')]['fields']));_0x187302[_0x7ada('0x31')]=_0x187302[_0x7ada('0x31')][_0x7ada('0x33')]?_0x187302['attributes']:_0x1510f3[_0x7ada('0x2d')];if(!_0x552132['query'][_0x7ada('0x34')](_0x7ada('0x35'))){_0x187302[_0x7ada('0x1e')]=qs[_0x7ada('0x1e')](_0x552132[_0x7ada('0x2f')]['limit']);_0x187302['offset']=qs[_0x7ada('0x20')](_0x552132[_0x7ada('0x2f')][_0x7ada('0x20')]);}_0x187302[_0x7ada('0x36')]=qs['sort'](_0x552132['query'][_0x7ada('0x37')]);_0x187302[_0x7ada('0x38')]=qs[_0x7ada('0x30')](_[_0x7ada('0x39')](_0x552132[_0x7ada('0x2f')],_0x1510f3[_0x7ada('0x30')]),_0x16b9db);if(_0x552132[_0x7ada('0x2f')][_0x7ada('0x3a')]){_0x187302['where']=_[_0x7ada('0x3b')](_0x187302[_0x7ada('0x38')],{'$or':_[_0x7ada('0x2a')](_0x16b9db,function(_0x1f42b3){if(_0x1f42b3[_0x7ada('0x3c')]!==_0x7ada('0x3d')){var _0x3a43dc={};_0x3a43dc[_0x1f42b3['name']]={'$like':'%'+_0x552132[_0x7ada('0x2f')][_0x7ada('0x3a')]+'%'};return _0x3a43dc;}})});}_0x187302=_[_0x7ada('0x3b')]({},_0x187302,_0x552132[_0x7ada('0x3e')]);var _0x34a571={'where':_0x187302['where']};return db[_0x7ada('0x3f')][_0x7ada('0x1f')](_0x34a571)[_0x7ada('0x40')](function(_0x2a617e){_0xa4b9be['count']=_0x2a617e;if(_0x552132[_0x7ada('0x2f')][_0x7ada('0x41')]){_0x187302[_0x7ada('0x42')]=[{'all':!![]}];}return db[_0x7ada('0x3f')][_0x7ada('0x43')](_0x187302);})[_0x7ada('0x40')](function(_0x54969f){_0xa4b9be[_0x7ada('0x44')]=_0x54969f;return _0xa4b9be;})[_0x7ada('0x40')](respondWithFilteredResult(_0xdae7bb,_0x187302))[_0x7ada('0x45')](handleError(_0xdae7bb,null));};exports[_0x7ada('0x46')]=function(_0x237f73,_0x15184e){var _0x3a1926={'raw':!![],'where':{'id':_0x237f73[_0x7ada('0x47')]['id']}},_0x5c9a33={};_0x5c9a33[_0x7ada('0x2d')]=_[_0x7ada('0x48')](db[_0x7ada('0x3f')][_0x7ada('0x49')]);_0x5c9a33[_0x7ada('0x2f')]=_[_0x7ada('0x48')](_0x237f73['query']);_0x5c9a33['filters']=_[_0x7ada('0x32')](_0x5c9a33['model'],_0x5c9a33[_0x7ada('0x2f')]);_0x3a1926['attributes']=_[_0x7ada('0x32')](_0x5c9a33[_0x7ada('0x2d')],qs[_0x7ada('0x4a')](_0x237f73[_0x7ada('0x2f')][_0x7ada('0x4a')]));_0x3a1926[_0x7ada('0x31')]=_0x3a1926['attributes'][_0x7ada('0x33')]?_0x3a1926['attributes']:_0x5c9a33[_0x7ada('0x2d')];if(_0x237f73[_0x7ada('0x2f')][_0x7ada('0x41')]){_0x3a1926[_0x7ada('0x42')]=[{'all':!![]}];}_0x3a1926=_['merge']({},_0x3a1926,_0x237f73[_0x7ada('0x3e')]);return db[_0x7ada('0x3f')][_0x7ada('0x4b')](_0x3a1926)[_0x7ada('0x40')](handleEntityNotFound(_0x15184e,null))[_0x7ada('0x40')](respondWithResult(_0x15184e,null))['catch'](handleError(_0x15184e,null));};exports[_0x7ada('0x4c')]=function(_0x2d958d,_0x31cb19){return db[_0x7ada('0x3f')]['create'](_0x2d958d[_0x7ada('0x4d')],{})[_0x7ada('0x40')](respondWithResult(_0x31cb19,0xc9))[_0x7ada('0x45')](handleError(_0x31cb19,null));};exports[_0x7ada('0x26')]=function(_0x44d17c,_0x13310b){if(_0x44d17c['body']['id']){delete _0x44d17c['body']['id'];}return db[_0x7ada('0x3f')][_0x7ada('0x4b')]({'where':{'id':_0x44d17c[_0x7ada('0x47')]['id']}})[_0x7ada('0x40')](handleEntityNotFound(_0x13310b,null))[_0x7ada('0x40')](saveUpdates(_0x44d17c['body'],null))[_0x7ada('0x40')](respondWithResult(_0x13310b,null))['catch'](handleError(_0x13310b,null));};exports['destroy']=function(_0x25ead2,_0x2f7891){return db[_0x7ada('0x3f')][_0x7ada('0x4b')]({'where':{'id':_0x25ead2[_0x7ada('0x47')]['id']}})[_0x7ada('0x40')](handleEntityNotFound(_0x2f7891,null))['then'](removeEntity(_0x2f7891,null))[_0x7ada('0x45')](handleError(_0x2f7891,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7b29aac..75e7722 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 _0x68b3=['../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2d86d1,_0x449550){var _0x1a6828=function(_0x2a66be){while(--_0x2a66be){_0x2d86d1['push'](_0x2d86d1['shift']());}};_0x1a6828(++_0x449550);}(_0x68b3,0x1d8));var _0x368b=function(_0x33e6c7,_0x3a0dd9){_0x33e6c7=_0x33e6c7-0x0;var _0x1ef816=_0x68b3[_0x33e6c7];return _0x1ef816;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./intZohoField.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xe'),_0x368b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['zoho_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intZohoField.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['idField',_0xee2f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index cedab9e..ead30af 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 _0x86d1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x588901,_0x17249f){var _0x39c89c=function(_0x566dce){while(--_0x566dce){_0x588901['push'](_0x588901['shift']());}};_0x39c89c(++_0x17249f);}(_0x86d1,0x15d));var _0x186d=function(_0xe773ba,_0xac712c){_0xe773ba=_0xe773ba-0x0;var _0x5eb465=_0x86d1[_0xe773ba];return _0x5eb465;};'use strict';var _=require(_0x186d('0x0'));var util=require(_0x186d('0x1'));var moment=require(_0x186d('0x2'));var BPromise=require(_0x186d('0x3'));var rs=require(_0x186d('0x4'));var fs=require('fs');var Redis=require(_0x186d('0x5'));var db=require(_0x186d('0x6'))['db'];var utils=require(_0x186d('0x7'));var logger=require(_0x186d('0x8'))(_0x186d('0x9'));var config=require(_0x186d('0xa'));var jayson=require(_0x186d('0xb'));var client=jayson[_0x186d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101bf6,_0x20e459,_0x5ed94a){return new BPromise(function(_0x153351,_0x13650c){return client['request'](_0x101bf6,_0x5ed94a)[_0x186d('0xd')](function(_0x141387){logger[_0x186d('0xe')](_0x186d('0xf'),_0x20e459,_0x186d('0x10'));logger[_0x186d('0x11')](_0x186d('0x12'),_0x20e459,'request\x20sent',JSON[_0x186d('0x13')](_0x141387));if(_0x141387[_0x186d('0x14')]){if(_0x141387[_0x186d('0x14')][_0x186d('0x15')]===0x1f4){logger[_0x186d('0x14')](_0x186d('0xf'),_0x20e459,_0x141387['error'][_0x186d('0x16')]);return _0x13650c(_0x141387[_0x186d('0x14')][_0x186d('0x16')]);}logger['error'](_0x186d('0xf'),_0x20e459,_0x141387[_0x186d('0x14')][_0x186d('0x16')]);return _0x153351(_0x141387[_0x186d('0x14')][_0x186d('0x16')]);}else{logger[_0x186d('0xe')](_0x186d('0xf'),_0x20e459,_0x186d('0x10'));_0x153351(_0x141387[_0x186d('0x17')][_0x186d('0x16')]);}})[_0x186d('0x18')](function(_0x3f674e){logger[_0x186d('0x14')]('ZohoField,\x20%s,\x20%s',_0x20e459,_0x3f674e);_0x13650c(_0x3f674e);});});} \ No newline at end of file +var _0x8033=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2ae2c3,_0x3a79b8){var _0x2b30d1=function(_0xad4f88){while(--_0xad4f88){_0x2ae2c3['push'](_0x2ae2c3['shift']());}};_0x2b30d1(++_0x3a79b8);}(_0x8033,0x78));var _0x3803=function(_0x19d3f2,_0x20bd43){_0x19d3f2=_0x19d3f2-0x0;var _0x17bfca=_0x8033[_0x19d3f2];return _0x17bfca;};'use strict';var _=require('lodash');var util=require(_0x3803('0x0'));var moment=require(_0x3803('0x1'));var BPromise=require(_0x3803('0x2'));var rs=require(_0x3803('0x3'));var fs=require('fs');var Redis=require(_0x3803('0x4'));var db=require(_0x3803('0x5'))['db'];var utils=require(_0x3803('0x6'));var logger=require(_0x3803('0x7'))(_0x3803('0x8'));var config=require(_0x3803('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3803('0xa')][_0x3803('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ee3d3,_0x379cdf,_0x429d65){return new BPromise(function(_0x3504f6,_0x5b3128){return client[_0x3803('0xc')](_0x5ee3d3,_0x429d65)[_0x3803('0xd')](function(_0xf84703){logger[_0x3803('0xe')](_0x3803('0xf'),_0x379cdf,_0x3803('0x10'));logger[_0x3803('0x11')](_0x3803('0x12'),_0x379cdf,'request\x20sent',JSON['stringify'](_0xf84703));if(_0xf84703[_0x3803('0x13')]){if(_0xf84703[_0x3803('0x13')][_0x3803('0x14')]===0x1f4){logger['error'](_0x3803('0xf'),_0x379cdf,_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);return _0x5b3128(_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);}logger['error'](_0x3803('0xf'),_0x379cdf,_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);return _0x3504f6(_0xf84703[_0x3803('0x13')][_0x3803('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x379cdf,_0x3803('0x10'));_0x3504f6(_0xf84703[_0x3803('0x16')][_0x3803('0x15')]);}})[_0x3803('0x17')](function(_0x2666d2){logger[_0x3803('0x13')]('ZohoField,\x20%s,\x20%s',_0x379cdf,_0x2666d2);_0x5b3128(_0x2666d2);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f4a04c8..6ca949b 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x485d1a,_0x28b192){var _0x5e32d7=function(_0x351d9b){while(--_0x351d9b){_0x485d1a['push'](_0x485d1a['shift']());}};_0x5e32d7(++_0x28b192);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xcb91[_0x239dba];return _0x1ceb11;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x27d135,_0x16015e){var _0x1463d1=function(_0x3da67d){while(--_0x3da67d){_0x27d135['push'](_0x27d135['shift']());}};_0x1463d1(++_0x16015e);}(_0xe706,0xa3));var _0x6e70=function(_0x22a3f0,_0x513d0e){_0x22a3f0=_0x22a3f0-0x0;var _0x2d8a9c=_0xe706[_0x22a3f0];return _0x2d8a9c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1e6aa5c..9dac0cb 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 _0xc94f=['app.js','sequelize','STRING','unique_name_and_version'];(function(_0x42c23b,_0xee0db7){var _0x818c7d=function(_0xe41347){while(--_0xe41347){_0x42c23b['push'](_0x42c23b['shift']());}};_0x818c7d(++_0xee0db7);}(_0xc94f,0xcd));var _0xfc94=function(_0x48b14d,_0x5c51ae){_0x48b14d=_0x48b14d-0x0;var _0x2473cd=_0xc94f[_0x48b14d];return _0x2473cd;};'use strict';var Sequelize=require(_0xfc94('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc94('0x1')],'allowNull':![],'unique':_0xfc94('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfc94('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xfc94('0x3')},'filename':{'type':Sequelize[_0xfc94('0x1')]},'path':{'type':Sequelize[_0xfc94('0x1')]},'type':{'type':Sequelize[_0xfc94('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfc94('0x1')]},'state':{'type':Sequelize[_0xfc94('0x1')],'unique':'state'},'description':{'type':Sequelize[_0xfc94('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfc94('0x1')]},'link':{'type':Sequelize[_0xfc94('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb1a4=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb1a4,0x80));var _0x4b1a=function(_0x4ebe2e,_0x2edd20){_0x4ebe2e=_0x4ebe2e-0x0;var _0x1a2515=_0xb1a4[_0x4ebe2e];return _0x1a2515;};'use strict';var Sequelize=require(_0x4b1a('0x0'));module[_0x4b1a('0x1')]={'name':{'type':Sequelize[_0x4b1a('0x2')],'allowNull':![],'unique':_0x4b1a('0x3')},'version':{'type':Sequelize[_0x4b1a('0x2')],'allowNull':![],'unique':_0x4b1a('0x3')},'main':{'type':Sequelize[_0x4b1a('0x2')],'defaultValue':_0x4b1a('0x4')},'filename':{'type':Sequelize[_0x4b1a('0x2')]},'path':{'type':Sequelize[_0x4b1a('0x2')]},'type':{'type':Sequelize[_0x4b1a('0x2')]},'size':{'type':Sequelize[_0x4b1a('0x5')]},'active':{'type':Sequelize[_0x4b1a('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x4b1a('0x2')]},'logo':{'type':Sequelize[_0x4b1a('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x4b1a('0x7')},'description':{'type':Sequelize[_0x4b1a('0x2')]},'title':{'type':Sequelize[_0x4b1a('0x2')]},'remoteUri':{'type':Sequelize[_0x4b1a('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a4efd9f..8029b36 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 _0x4819=['bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','Integration','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4819,0xcd));var _0x9481=function(_0x34053b,_0x9098d6){_0x34053b=_0x34053b-0x0;var _0x18970d=_0x4819[_0x34053b];return _0x18970d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['Integration']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['Integration'][_0x9481('0x43')](_0xd36133['body'],{})[_0x9481('0x25')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x44')]['id']){delete _0x277e2a[_0x9481('0x44')]['id'];}return db[_0x9481('0x2b')][_0x9481('0x42')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x25')](saveUpdates(_0x277e2a[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x1044a2,null))[_0x9481('0x3f')](handleError(_0x1044a2,null));};exports[_0x9481('0x26')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x2b')]['find']({'where':{'id':_0x353aab[_0x9481('0x45')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x25')](removeEntity(_0x1c070c,null))[_0x9481('0x3f')](handleError(_0x1c070c,null));}; \ No newline at end of file +var _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2d4ab9,_0x24d1eb){var _0x336c9b=function(_0x24e611){while(--_0x24e611){_0x2d4ab9['push'](_0x2d4ab9['shift']());}};_0x336c9b(++_0x24d1eb);}(_0xafc4,0x69));var _0x4afc=function(_0x13b62c,_0x32d8cd){_0x13b62c=_0x13b62c-0x0;var _0x4fe781=_0xafc4[_0x13b62c];return _0x4fe781;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 6f2d449..f7d9c38 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 _0x73a0=['exports','Integration','util','api','moment','bluebird','./integration.attributes'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x73a0,0x64));var _0x073a=function(_0x216629,_0x5c7f5d){_0x216629=_0x216629-0x0;var _0x35afd4=_0x73a0[_0x216629];return _0x35afd4;};'use strict';var _=require('lodash');var util=require(_0x073a('0x0'));var logger=require('../../config/logger')(_0x073a('0x1'));var moment=require(_0x073a('0x2'));var BPromise=require(_0x073a('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(_0x073a('0x4'));module[_0x073a('0x5')]=function(_0x27ba53,_0x10b130){return _0x27ba53['define'](_0x073a('0x6'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0780=['define','Integration','integrations','lodash','api','moment','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0780,0x1e3));var _0x0078=function(_0x395619,_0x1e0cef){_0x395619=_0x395619-0x0;var _0x561a46=_0x0780[_0x395619];return _0x561a46;};'use strict';var _=require(_0x0078('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0078('0x1'));var moment=require(_0x0078('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0078('0x3'));var rimraf=require(_0x0078('0x4'));var config=require(_0x0078('0x5'));var attributes=require(_0x0078('0x6'));module['exports']=function(_0x50503c,_0x291052){return _0x50503c[_0x0078('0x7')](_0x0078('0x8'),attributes,{'tableName':_0x0078('0x9'),'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 2977345..06199b9 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x524e,0x15e));var _0xe524=function(_0x5d570e,_0x5b97ef){_0x5d570e=_0x5d570e-0x0;var _0x4cd376=_0x524e[_0x5d570e];return _0x4cd376;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x524e,0x15e));var _0xe524=function(_0x139456,_0x2ea98d){_0x139456=_0x139456-0x0;var _0x5e08a6=_0x524e[_0x139456];return _0x5e08a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a8336dc..c311f89 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x3c6e7e,_0x1af8c1){var _0x5214f6=function(_0xfbae77){while(--_0xfbae77){_0x3c6e7e['push'](_0x3c6e7e['shift']());}};_0x5214f6(++_0x1af8c1);}(_0x7a54,0x106));var _0x47a5=function(_0x21a1c4,_0x8e8172){_0x21a1c4=_0x21a1c4-0x0;var _0x3c4d2c=_0x7a54[_0x21a1c4];return _0x3c4d2c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3a40cd,_0x4f8883){var _0x2ff433=function(_0x516b2b){while(--_0x516b2b){_0x3a40cd['push'](_0x3a40cd['shift']());}};_0x2ff433(++_0x4f8883);}(_0x57ca,0x108));var _0xa57c=function(_0x1eb6b4,_0x1a394c){_0x1eb6b4=_0x1eb6b4-0x0;var _0x46ec3e=_0x57ca[_0x1eb6b4];return _0x46ec3e;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1b47c8b..f79244d 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 _0x48c3=['TEXT','SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x2cf4d5,_0x73fd04){var _0x19d318=function(_0x3e2c01){while(--_0x3e2c01){_0x2cf4d5['push'](_0x2cf4d5['shift']());}};_0x19d318(++_0x73fd04);}(_0x48c3,0xc9));var _0x348c=function(_0x141844,_0x2f43e3){_0x141844=_0x141844-0x0;var _0x6e214a=_0x48c3[_0x141844];return _0x6e214a;};'use strict';var Sequelize=require(_0x348c('0x0'));module[_0x348c('0x1')]={'integration':{'type':Sequelize[_0x348c('0x2')]},'eventChannel':{'type':Sequelize[_0x348c('0x2')]},'exitStatus':{'type':Sequelize[_0x348c('0x2')]},'ticketId':{'type':Sequelize[_0x348c('0x2')]},'integrationId':{'type':Sequelize[_0x348c('0x3')]},'contacts':{'type':Sequelize[_0x348c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x348c('0x2')]},'queue':{'type':Sequelize[_0x348c('0x2')]},'interface':{'type':Sequelize[_0x348c('0x2')]},'membername':{'type':Sequelize[_0x348c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x348c('0x4')]},'agentconnectAt':{'type':Sequelize[_0x348c('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x348c('0x4')]},'talktime':{'type':Sequelize[_0x348c('0x3')]},'agentacw':{'type':Sequelize[_0x348c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x348c('0x3')]},'reason':{'type':Sequelize[_0x348c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x348c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x348c('0x4')]},'agentdump':{'type':Sequelize[_0x348c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x348c('0x4')]},'lastevent':{'type':Sequelize[_0x348c('0x2')]},'channel':{'type':Sequelize[_0x348c('0x2')]},'channelstate':{'type':Sequelize[_0x348c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x348c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x348c('0x2')]},'connectedlinename':{'type':Sequelize[_0x348c('0x2')]},'language':{'type':Sequelize[_0x348c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x348c('0x2')]},'priority':{'type':Sequelize[_0x348c('0x2')]},'destchannel':{'type':Sequelize[_0x348c('0x2')]},'destchannelstate':{'type':Sequelize[_0x348c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x348c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x348c('0x2')]},'destcalleridname':{'type':Sequelize[_0x348c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x348c('0x2')]},'destlanguage':{'type':Sequelize[_0x348c('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x348c('0x2')]},'destexten':{'type':Sequelize[_0x348c('0x2')]},'destpriority':{'type':Sequelize[_0x348c('0x2')]},'destuniqueid':{'type':Sequelize[_0x348c('0x2')]},'messageId':{'type':Sequelize[_0x348c('0x2')]},'inReplyTo':{'type':Sequelize[_0x348c('0x2')]},'subject':{'type':Sequelize[_0x348c('0x2')]},'from':{'type':Sequelize[_0x348c('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x348c('0x2')]},'attachment':{'type':Sequelize[_0x348c('0x6')]},'html':{'type':Sequelize[_0x348c('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x348c('0x7'),_0x348c('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x348c('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x348c('0x2')]},'projectId':{'type':Sequelize[_0x348c('0x3')]}}; \ No newline at end of file +var _0xfd0e=['BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x273422,_0x11abe1){var _0x144440=function(_0x257f41){while(--_0x257f41){_0x273422['push'](_0x273422['shift']());}};_0x144440(++_0x11abe1);}(_0xfd0e,0xcc));var _0xefd0=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xfd0e[_0x457b64];return _0x437111;};'use strict';var Sequelize=require(_0xefd0('0x0'));module[_0xefd0('0x1')]={'integration':{'type':Sequelize[_0xefd0('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xefd0('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xefd0('0x3')]},'contacts':{'type':Sequelize[_0xefd0('0x2')]},'uniqueid':{'type':Sequelize[_0xefd0('0x2')]},'calleridnum':{'type':Sequelize[_0xefd0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xefd0('0x2')]},'membername':{'type':Sequelize[_0xefd0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xefd0('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xefd0('0x3')]},'agentcomplete':{'type':Sequelize[_0xefd0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xefd0('0x4')]},'talktime':{'type':Sequelize[_0xefd0('0x3')]},'agentacw':{'type':Sequelize[_0xefd0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xefd0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xefd0('0x4')]},'agentdump':{'type':Sequelize[_0xefd0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xefd0('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xefd0('0x2')]},'connectedlinename':{'type':Sequelize[_0xefd0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xefd0('0x2')]},'context':{'type':Sequelize[_0xefd0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xefd0('0x2')]},'destchannel':{'type':Sequelize[_0xefd0('0x2')]},'destchannelstate':{'type':Sequelize[_0xefd0('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xefd0('0x2')]},'destcalleridname':{'type':Sequelize[_0xefd0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xefd0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xefd0('0x2')]},'destlanguage':{'type':Sequelize[_0xefd0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xefd0('0x2')]},'destexten':{'type':Sequelize[_0xefd0('0x2')]},'destpriority':{'type':Sequelize[_0xefd0('0x2')]},'destuniqueid':{'type':Sequelize[_0xefd0('0x2')]},'messageId':{'type':Sequelize[_0xefd0('0x2')]},'inReplyTo':{'type':Sequelize[_0xefd0('0x2')]},'subject':{'type':Sequelize[_0xefd0('0x2')]},'from':{'type':Sequelize[_0xefd0('0x2')]},'to':{'type':Sequelize[_0xefd0('0x2')]},'cc':{'type':Sequelize[_0xefd0('0x2')]},'attachment':{'type':Sequelize[_0xefd0('0x6')]},'html':{'type':Sequelize[_0xefd0('0x6')]},'text':{'type':Sequelize[_0xefd0('0x6')]},'status':{'type':Sequelize[_0xefd0('0x7')](_0xefd0('0x8'),'SENDING',_0xefd0('0x9'),_0xefd0('0xa'))},'url':{'type':Sequelize[_0xefd0('0x2')]},'app':{'type':Sequelize[_0xefd0('0x2')]},'appdata':{'type':Sequelize[_0xefd0('0x2')]},'projectId':{'type':Sequelize[_0xefd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 151cee7..c84f78b 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 _0x4dfb=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','then','error','stack','name','send','index','map','IntegrationReport'];(function(_0x4cfc5c,_0x458258){var _0x12b01b=function(_0x4f8dac){while(--_0x4f8dac){_0x4cfc5c['push'](_0x4cfc5c['shift']());}};_0x12b01b(++_0x458258);}(_0x4dfb,0xbc));var _0xb4df=function(_0x124058,_0x40d3da){_0x124058=_0x124058-0x0;var _0x974855=_0x4dfb[_0x124058];return _0x974855;};'use strict';var emlformat=require(_0xb4df('0x0'));var rimraf=require(_0xb4df('0x1'));var zipdir=require(_0xb4df('0x2'));var jsonpatch=require(_0xb4df('0x3'));var rp=require(_0xb4df('0x4'));var moment=require(_0xb4df('0x5'));var BPromise=require(_0xb4df('0x6'));var Mustache=require(_0xb4df('0x7'));var util=require('util');var path=require(_0xb4df('0x8'));var sox=require('sox');var csv=require(_0xb4df('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4df('0xa'));var _=require(_0xb4df('0xb'));var squel=require(_0xb4df('0xc'));var crypto=require(_0xb4df('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb4df('0xe'));var toCsv=require(_0xb4df('0x9'));var querystring=require(_0xb4df('0xf'));var Papa=require(_0xb4df('0x10'));var Redis=require(_0xb4df('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb4df('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4df('0x13'))(_0xb4df('0x14'));var utils=require(_0xb4df('0x15'));var config=require(_0xb4df('0x16'));var licenseUtil=require(_0xb4df('0x17'));var db=require(_0xb4df('0x18'))['db'];function respondWithStatusCode(_0x4a9a68,_0x9e9179){_0x9e9179=_0x9e9179||0xcc;return function(_0x2f4b44){if(_0x2f4b44){return _0x4a9a68[_0xb4df('0x19')](_0x9e9179);}return _0x4a9a68[_0xb4df('0x1a')](_0x9e9179)[_0xb4df('0x1b')]();};}function respondWithResult(_0x323b9f,_0x2e6b46){_0x2e6b46=_0x2e6b46||0xc8;return function(_0x47eaa9){if(_0x47eaa9){return _0x323b9f[_0xb4df('0x1a')](_0x2e6b46)[_0xb4df('0x1c')](_0x47eaa9);}};}function respondWithFilteredResult(_0x40b6b2,_0x398778){return function(_0x1d7339){if(_0x1d7339){var _0x480580=typeof _0x398778[_0xb4df('0x1d')]===_0xb4df('0x1e')&&typeof _0x398778['limit']===_0xb4df('0x1e');var _0x8da9bb=_0x1d7339['count'];var _0x32787f=_0x480580?0x0:_0x398778[_0xb4df('0x1d')];var _0xf08ae9=_0x480580?_0x1d7339['count']:_0x398778[_0xb4df('0x1d')]+_0x398778[_0xb4df('0x1f')];var _0x5aaf7c;if(_0xf08ae9>=_0x8da9bb){_0xf08ae9=_0x8da9bb;_0x5aaf7c=0xc8;}else{_0x5aaf7c=0xce;}_0x40b6b2[_0xb4df('0x1a')](_0x5aaf7c);return _0x40b6b2[_0xb4df('0x20')](_0xb4df('0x21'),_0x32787f+'-'+_0xf08ae9+'/'+_0x8da9bb)['json'](_0x1d7339);}return null;};}function patchUpdates(_0x4d46f6){return function(_0x5bcf4f){try{jsonpatch[_0xb4df('0x22')](_0x5bcf4f,_0x4d46f6,!![]);}catch(_0x1be130){return BPromise['reject'](_0x1be130);}return _0x5bcf4f['save']();};}function saveUpdates(_0x13faff,_0x1a4469){return function(_0x110e5e){if(_0x110e5e){return _0x110e5e['update'](_0x13faff)[_0xb4df('0x23')](function(_0x48892c){return _0x48892c;});}return null;};}function removeEntity(_0x1ac612,_0xb6d98){return function(_0x531b79){if(_0x531b79){return _0x531b79['destroy']()[_0xb4df('0x23')](function(){_0x1ac612[_0xb4df('0x1a')](0xcc)[_0xb4df('0x1b')]();});}};}function handleEntityNotFound(_0x51a0f8,_0x51892f){return function(_0x46c909){if(!_0x46c909){_0x51a0f8[_0xb4df('0x19')](0x194);}return _0x46c909;};}function handleError(_0x2cfcdb,_0x580470){_0x580470=_0x580470||0x1f4;return function(_0x12e079){logger[_0xb4df('0x24')](_0x12e079[_0xb4df('0x25')]);if(_0x12e079['name']){delete _0x12e079[_0xb4df('0x26')];}_0x2cfcdb[_0xb4df('0x1a')](_0x580470)[_0xb4df('0x27')](_0x12e079);};}exports[_0xb4df('0x28')]=function(_0x52f881,_0x1c1b60){var _0x1c10e9={},_0x1b7b2d={},_0x45dda1={'count':0x0,'rows':[]};var _0x253c79=_[_0xb4df('0x29')](db[_0xb4df('0x2a')][_0xb4df('0x2b')],function(_0x38f1d2){return{'name':_0x38f1d2[_0xb4df('0x2c')],'type':_0x38f1d2[_0xb4df('0x2d')][_0xb4df('0x2e')]};});_0x1b7b2d[_0xb4df('0x2f')]=_[_0xb4df('0x29')](_0x253c79,_0xb4df('0x26'));_0x1b7b2d[_0xb4df('0x30')]=_['keys'](_0x52f881[_0xb4df('0x30')]);_0x1b7b2d[_0xb4df('0x31')]=_[_0xb4df('0x32')](_0x1b7b2d[_0xb4df('0x2f')],_0x1b7b2d[_0xb4df('0x30')]);_0x1c10e9['attributes']=_[_0xb4df('0x32')](_0x1b7b2d[_0xb4df('0x2f')],qs[_0xb4df('0x33')](_0x52f881[_0xb4df('0x30')][_0xb4df('0x33')]));_0x1c10e9[_0xb4df('0x34')]=_0x1c10e9[_0xb4df('0x34')][_0xb4df('0x35')]?_0x1c10e9[_0xb4df('0x34')]:_0x1b7b2d[_0xb4df('0x2f')];if(!_0x52f881[_0xb4df('0x30')][_0xb4df('0x36')](_0xb4df('0x37'))){_0x1c10e9[_0xb4df('0x1f')]=qs['limit'](_0x52f881[_0xb4df('0x30')][_0xb4df('0x1f')]);_0x1c10e9['offset']=qs['offset'](_0x52f881[_0xb4df('0x30')][_0xb4df('0x1d')]);}_0x1c10e9[_0xb4df('0x38')]=qs['sort'](_0x52f881[_0xb4df('0x30')]['sort']);_0x1c10e9[_0xb4df('0x39')]=qs['filters'](_[_0xb4df('0x3a')](_0x52f881['query'],_0x1b7b2d[_0xb4df('0x31')]),_0x253c79);if(_0x52f881[_0xb4df('0x30')][_0xb4df('0x3b')]){_0x1c10e9['where']=_[_0xb4df('0x3c')](_0x1c10e9[_0xb4df('0x39')],{'$or':_[_0xb4df('0x29')](_0x253c79,function(_0x383540){if(_0x383540['type']!=='VIRTUAL'){var _0x2f05fa={};_0x2f05fa[_0x383540['name']]={'$like':'%'+_0x52f881[_0xb4df('0x30')][_0xb4df('0x3b')]+'%'};return _0x2f05fa;}})});}_0x1c10e9=_['merge']({},_0x1c10e9,_0x52f881[_0xb4df('0x3d')]);var _0x545d02={'where':_0x1c10e9['where']};return db[_0xb4df('0x2a')][_0xb4df('0x3e')](_0x545d02)[_0xb4df('0x23')](function(_0x3cae4d){_0x45dda1['count']=_0x3cae4d;if(_0x52f881[_0xb4df('0x30')][_0xb4df('0x3f')]){_0x1c10e9[_0xb4df('0x40')]=[{'all':!![]}];}return db[_0xb4df('0x2a')][_0xb4df('0x41')](_0x1c10e9);})[_0xb4df('0x23')](function(_0x512881){_0x45dda1[_0xb4df('0x42')]=_0x512881;return _0x45dda1;})[_0xb4df('0x23')](respondWithFilteredResult(_0x1c1b60,_0x1c10e9))[_0xb4df('0x43')](handleError(_0x1c1b60,null));};exports[_0xb4df('0x44')]=function(_0x4d2e6d,_0x4d2912){var _0x110e45={'raw':![],'where':{'id':_0x4d2e6d[_0xb4df('0x45')]['id']}},_0x23f6a9={};_0x23f6a9['model']=_[_0xb4df('0x46')](db['IntegrationReport'][_0xb4df('0x2b')]);_0x23f6a9[_0xb4df('0x30')]=_[_0xb4df('0x46')](_0x4d2e6d[_0xb4df('0x30')]);_0x23f6a9[_0xb4df('0x31')]=_[_0xb4df('0x32')](_0x23f6a9[_0xb4df('0x2f')],_0x23f6a9[_0xb4df('0x30')]);_0x110e45[_0xb4df('0x34')]=_[_0xb4df('0x32')](_0x23f6a9[_0xb4df('0x2f')],qs[_0xb4df('0x33')](_0x4d2e6d['query'][_0xb4df('0x33')]));_0x110e45[_0xb4df('0x34')]=_0x110e45[_0xb4df('0x34')][_0xb4df('0x35')]?_0x110e45['attributes']:_0x23f6a9[_0xb4df('0x2f')];if(_0x4d2e6d['query'][_0xb4df('0x3f')]){_0x110e45[_0xb4df('0x40')]=[{'all':!![]}];}_0x110e45=_[_0xb4df('0x3c')]({},_0x110e45,_0x4d2e6d[_0xb4df('0x3d')]);return db['IntegrationReport'][_0xb4df('0x47')](_0x110e45)[_0xb4df('0x23')](handleEntityNotFound(_0x4d2912,null))[_0xb4df('0x23')](respondWithResult(_0x4d2912,null))['catch'](handleError(_0x4d2912,null));};exports['create']=function(_0xec5d0c,_0x448a27){return db['IntegrationReport'][_0xb4df('0x48')](_0xec5d0c[_0xb4df('0x49')],{})[_0xb4df('0x23')](respondWithResult(_0x448a27,0xc9))[_0xb4df('0x43')](handleError(_0x448a27,null));};exports[_0xb4df('0x4a')]=function(_0x3333d6,_0x3c05f4){if(_0x3333d6[_0xb4df('0x49')]['id']){delete _0x3333d6[_0xb4df('0x49')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x3333d6[_0xb4df('0x45')]['id']}})[_0xb4df('0x23')](handleEntityNotFound(_0x3c05f4,null))[_0xb4df('0x23')](saveUpdates(_0x3333d6[_0xb4df('0x49')],null))[_0xb4df('0x23')](respondWithResult(_0x3c05f4,null))[_0xb4df('0x43')](handleError(_0x3c05f4,null));};exports[_0xb4df('0x4b')]=function(_0x470cb8,_0x420bcb){return db[_0xb4df('0x2a')]['find']({'where':{'id':_0x470cb8[_0xb4df('0x45')]['id']}})['then'](handleEntityNotFound(_0x420bcb,null))[_0xb4df('0x23')](removeEntity(_0x420bcb,null))[_0xb4df('0x43')](handleError(_0x420bcb,null));};exports[_0xb4df('0x4c')]=function(_0x19e447,_0x486bce){return db[_0xb4df('0x2a')][_0xb4df('0x4c')]()['then'](respondWithResult(_0x486bce,null))[_0xb4df('0x43')](handleError(_0x486bce,null));}; \ No newline at end of file +var _0xee7a=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','IntegrationReport','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x2eb6a9,_0x32574c){var _0x4c3f11=function(_0x366570){while(--_0x366570){_0x2eb6a9['push'](_0x2eb6a9['shift']());}};_0x4c3f11(++_0x32574c);}(_0xee7a,0x1d3));var _0xaee7=function(_0x2822c5,_0x1162bb){_0x2822c5=_0x2822c5-0x0;var _0x3face5=_0xee7a[_0x2822c5];return _0x3face5;};'use strict';var emlformat=require(_0xaee7('0x0'));var rimraf=require(_0xaee7('0x1'));var zipdir=require(_0xaee7('0x2'));var jsonpatch=require(_0xaee7('0x3'));var rp=require(_0xaee7('0x4'));var moment=require(_0xaee7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaee7('0x6'));var path=require(_0xaee7('0x7'));var sox=require(_0xaee7('0x8'));var csv=require(_0xaee7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaee7('0xa'));var _=require(_0xaee7('0xb'));var squel=require(_0xaee7('0xc'));var crypto=require(_0xaee7('0xd'));var jsforce=require(_0xaee7('0xe'));var deskjs=require(_0xaee7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaee7('0x10'));var Redis=require(_0xaee7('0x11'));var authService=require(_0xaee7('0x12'));var qs=require(_0xaee7('0x13'));var as=require(_0xaee7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaee7('0x15'))('api');var utils=require(_0xaee7('0x16'));var config=require(_0xaee7('0x17'));var licenseUtil=require(_0xaee7('0x18'));var db=require(_0xaee7('0x19'))['db'];function respondWithStatusCode(_0xeb0dd8,_0x36977){_0x36977=_0x36977||0xcc;return function(_0xe105b7){if(_0xe105b7){return _0xeb0dd8[_0xaee7('0x1a')](_0x36977);}return _0xeb0dd8[_0xaee7('0x1b')](_0x36977)['end']();};}function respondWithResult(_0xa93e5c,_0x351596){_0x351596=_0x351596||0xc8;return function(_0x42ed02){if(_0x42ed02){return _0xa93e5c[_0xaee7('0x1b')](_0x351596)['json'](_0x42ed02);}};}function respondWithFilteredResult(_0x108229,_0x590b94){return function(_0x3c041b){if(_0x3c041b){var _0x574831=typeof _0x590b94[_0xaee7('0x1c')]===_0xaee7('0x1d')&&typeof _0x590b94[_0xaee7('0x1e')]===_0xaee7('0x1d');var _0x5e4514=_0x3c041b[_0xaee7('0x1f')];var _0x59444d=_0x574831?0x0:_0x590b94[_0xaee7('0x1c')];var _0x3a690e=_0x574831?_0x3c041b[_0xaee7('0x1f')]:_0x590b94[_0xaee7('0x1c')]+_0x590b94[_0xaee7('0x1e')];var _0x4faf37;if(_0x3a690e>=_0x5e4514){_0x3a690e=_0x5e4514;_0x4faf37=0xc8;}else{_0x4faf37=0xce;}_0x108229[_0xaee7('0x1b')](_0x4faf37);return _0x108229[_0xaee7('0x20')]('Content-Range',_0x59444d+'-'+_0x3a690e+'/'+_0x5e4514)[_0xaee7('0x21')](_0x3c041b);}return null;};}function patchUpdates(_0x185f97){return function(_0x457841){try{jsonpatch[_0xaee7('0x22')](_0x457841,_0x185f97,!![]);}catch(_0x59f9ba){return BPromise[_0xaee7('0x23')](_0x59f9ba);}return _0x457841[_0xaee7('0x24')]();};}function saveUpdates(_0x3d09e3,_0x5a735d){return function(_0x234923){if(_0x234923){return _0x234923[_0xaee7('0x25')](_0x3d09e3)[_0xaee7('0x26')](function(_0x2d1363){return _0x2d1363;});}return null;};}function removeEntity(_0xcb2aeb,_0x3ff1af){return function(_0xadc417){if(_0xadc417){return _0xadc417['destroy']()[_0xaee7('0x26')](function(){_0xcb2aeb[_0xaee7('0x1b')](0xcc)[_0xaee7('0x27')]();});}};}function handleEntityNotFound(_0x3b51f1,_0x4ad266){return function(_0x3ff743){if(!_0x3ff743){_0x3b51f1['sendStatus'](0x194);}return _0x3ff743;};}function handleError(_0x3d71a7,_0x2817b2){_0x2817b2=_0x2817b2||0x1f4;return function(_0x39455a){logger['error'](_0x39455a[_0xaee7('0x28')]);if(_0x39455a[_0xaee7('0x29')]){delete _0x39455a[_0xaee7('0x29')];}_0x3d71a7[_0xaee7('0x1b')](_0x2817b2)[_0xaee7('0x2a')](_0x39455a);};}exports[_0xaee7('0x2b')]=function(_0x5986b9,_0x86a4b2){var _0x4e2224={},_0x213ef9={},_0x2a75ea={'count':0x0,'rows':[]};var _0x37d83d=_[_0xaee7('0x2c')](db['IntegrationReport'][_0xaee7('0x2d')],function(_0x342515){return{'name':_0x342515[_0xaee7('0x2e')],'type':_0x342515['type']['key']};});_0x213ef9[_0xaee7('0x2f')]=_[_0xaee7('0x2c')](_0x37d83d,_0xaee7('0x29'));_0x213ef9[_0xaee7('0x30')]=_[_0xaee7('0x31')](_0x5986b9[_0xaee7('0x30')]);_0x213ef9[_0xaee7('0x32')]=_[_0xaee7('0x33')](_0x213ef9[_0xaee7('0x2f')],_0x213ef9[_0xaee7('0x30')]);_0x4e2224[_0xaee7('0x34')]=_['intersection'](_0x213ef9[_0xaee7('0x2f')],qs[_0xaee7('0x35')](_0x5986b9[_0xaee7('0x30')][_0xaee7('0x35')]));_0x4e2224['attributes']=_0x4e2224['attributes'][_0xaee7('0x36')]?_0x4e2224['attributes']:_0x213ef9[_0xaee7('0x2f')];if(!_0x5986b9[_0xaee7('0x30')][_0xaee7('0x37')](_0xaee7('0x38'))){_0x4e2224['limit']=qs[_0xaee7('0x1e')](_0x5986b9[_0xaee7('0x30')]['limit']);_0x4e2224[_0xaee7('0x1c')]=qs[_0xaee7('0x1c')](_0x5986b9['query'][_0xaee7('0x1c')]);}_0x4e2224[_0xaee7('0x39')]=qs[_0xaee7('0x3a')](_0x5986b9[_0xaee7('0x30')]['sort']);_0x4e2224[_0xaee7('0x3b')]=qs[_0xaee7('0x32')](_[_0xaee7('0x3c')](_0x5986b9['query'],_0x213ef9[_0xaee7('0x32')]),_0x37d83d);if(_0x5986b9[_0xaee7('0x30')][_0xaee7('0x3d')]){_0x4e2224['where']=_[_0xaee7('0x3e')](_0x4e2224['where'],{'$or':_[_0xaee7('0x2c')](_0x37d83d,function(_0x22b29b){if(_0x22b29b[_0xaee7('0x3f')]!==_0xaee7('0x40')){var _0x592c30={};_0x592c30[_0x22b29b['name']]={'$like':'%'+_0x5986b9[_0xaee7('0x30')][_0xaee7('0x3d')]+'%'};return _0x592c30;}})});}_0x4e2224=_['merge']({},_0x4e2224,_0x5986b9[_0xaee7('0x41')]);var _0x4631a8={'where':_0x4e2224['where']};return db['IntegrationReport'][_0xaee7('0x1f')](_0x4631a8)[_0xaee7('0x26')](function(_0x3d012a){_0x2a75ea[_0xaee7('0x1f')]=_0x3d012a;if(_0x5986b9[_0xaee7('0x30')]['includeAll']){_0x4e2224[_0xaee7('0x42')]=[{'all':!![]}];}return db[_0xaee7('0x43')][_0xaee7('0x44')](_0x4e2224);})[_0xaee7('0x26')](function(_0x3a83f5){_0x2a75ea[_0xaee7('0x45')]=_0x3a83f5;return _0x2a75ea;})[_0xaee7('0x26')](respondWithFilteredResult(_0x86a4b2,_0x4e2224))[_0xaee7('0x46')](handleError(_0x86a4b2,null));};exports[_0xaee7('0x47')]=function(_0x283d49,_0x4c10cf){var _0x242d23={'raw':![],'where':{'id':_0x283d49['params']['id']}},_0x110be1={};_0x110be1[_0xaee7('0x2f')]=_[_0xaee7('0x31')](db['IntegrationReport'][_0xaee7('0x2d')]);_0x110be1[_0xaee7('0x30')]=_[_0xaee7('0x31')](_0x283d49[_0xaee7('0x30')]);_0x110be1[_0xaee7('0x32')]=_[_0xaee7('0x33')](_0x110be1[_0xaee7('0x2f')],_0x110be1['query']);_0x242d23[_0xaee7('0x34')]=_[_0xaee7('0x33')](_0x110be1[_0xaee7('0x2f')],qs[_0xaee7('0x35')](_0x283d49[_0xaee7('0x30')][_0xaee7('0x35')]));_0x242d23[_0xaee7('0x34')]=_0x242d23[_0xaee7('0x34')][_0xaee7('0x36')]?_0x242d23[_0xaee7('0x34')]:_0x110be1[_0xaee7('0x2f')];if(_0x283d49['query'][_0xaee7('0x48')]){_0x242d23[_0xaee7('0x42')]=[{'all':!![]}];}_0x242d23=_[_0xaee7('0x3e')]({},_0x242d23,_0x283d49['options']);return db[_0xaee7('0x43')][_0xaee7('0x49')](_0x242d23)['then'](handleEntityNotFound(_0x4c10cf,null))[_0xaee7('0x26')](respondWithResult(_0x4c10cf,null))[_0xaee7('0x46')](handleError(_0x4c10cf,null));};exports[_0xaee7('0x4a')]=function(_0x38a4ac,_0x116012){return db[_0xaee7('0x43')][_0xaee7('0x4a')](_0x38a4ac[_0xaee7('0x4b')],{})[_0xaee7('0x26')](respondWithResult(_0x116012,0xc9))[_0xaee7('0x46')](handleError(_0x116012,null));};exports['update']=function(_0x59e232,_0x1b54a0){if(_0x59e232[_0xaee7('0x4b')]['id']){delete _0x59e232[_0xaee7('0x4b')]['id'];}return db[_0xaee7('0x43')][_0xaee7('0x49')]({'where':{'id':_0x59e232[_0xaee7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b54a0,null))[_0xaee7('0x26')](saveUpdates(_0x59e232[_0xaee7('0x4b')],null))[_0xaee7('0x26')](respondWithResult(_0x1b54a0,null))['catch'](handleError(_0x1b54a0,null));};exports[_0xaee7('0x4d')]=function(_0x34731c,_0x381489){return db['IntegrationReport'][_0xaee7('0x49')]({'where':{'id':_0x34731c[_0xaee7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x381489,null))[_0xaee7('0x26')](removeEntity(_0x381489,null))[_0xaee7('0x46')](handleError(_0x381489,null));};exports[_0xaee7('0x4e')]=function(_0xda5c8b,_0x36f3b4){return db[_0xaee7('0x43')]['describe']()['then'](respondWithResult(_0x36f3b4,null))[_0xaee7('0x46')](handleError(_0x36f3b4,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 924689a..ff5e740 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 _0x6bbe=['bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x36bb81,_0x562693){var _0x1f1eec=function(_0x320a5b){while(--_0x320a5b){_0x36bb81['push'](_0x36bb81['shift']());}};_0x1f1eec(++_0x562693);}(_0x6bbe,0xa3));var _0xe6bb=function(_0x2f2a31,_0x51d752){_0x2f2a31=_0x2f2a31-0x0;var _0x43525c=_0x6bbe[_0x2f2a31];return _0x43525c;};'use strict';var _=require(_0xe6bb('0x0'));var util=require(_0xe6bb('0x1'));var logger=require(_0xe6bb('0x2'))(_0xe6bb('0x3'));var moment=require(_0xe6bb('0x4'));var BPromise=require(_0xe6bb('0x5'));var rp=require(_0xe6bb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6bb('0x7'));var config=require(_0xe6bb('0x8'));var attributes=require(_0xe6bb('0x9'));module[_0xe6bb('0xa')]=function(_0x29c61b,_0x53a64b){return _0x29c61b[_0xe6bb('0xb')](_0xe6bb('0xc'),attributes,{'tableName':_0xe6bb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae34=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','report_integration','util','../../config/logger'];(function(_0x5aecb1,_0x384094){var _0x2098f2=function(_0x4a9c0b){while(--_0x4a9c0b){_0x5aecb1['push'](_0x5aecb1['shift']());}};_0x2098f2(++_0x384094);}(_0xae34,0x1ab));var _0x4ae3=function(_0x4ff481,_0x34e7ce){_0x4ff481=_0x4ff481-0x0;var _0x4f6cfa=_0xae34[_0x4ff481];return _0x4f6cfa;};'use strict';var _=require('lodash');var util=require(_0x4ae3('0x0'));var logger=require(_0x4ae3('0x1'))(_0x4ae3('0x2'));var moment=require(_0x4ae3('0x3'));var BPromise=require(_0x4ae3('0x4'));var rp=require(_0x4ae3('0x5'));var fs=require('fs');var path=require(_0x4ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x4ae3('0x7'));var attributes=require('./integrationReport.attributes');module[_0x4ae3('0x8')]=function(_0x13525f,_0x11d23d){return _0x13525f[_0x4ae3('0x9')]('IntegrationReport',attributes,{'tableName':_0x4ae3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8c58b60..c395857 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _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(_0x43ae27,_0x4196a1){var _0x183305=function(_0x1e4f3b){while(--_0x1e4f3b){_0x43ae27['push'](_0x43ae27['shift']());}};_0x183305(++_0x4196a1);}(_0x187d,0x93));var _0xd187=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x187d[_0x3b380d];return _0x54502b;};'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 9f35bd9..88e4bdc 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 _0xe548=['path','connect-timeout','express','./interval.controller','isAuthenticated','get','/:id','show','/:id/sub_intervals','post','create','addInterval','update','multer','util'];(function(_0x570802,_0x3341f6){var _0x3ab616=function(_0x45f7d8){while(--_0x45f7d8){_0x570802['push'](_0x570802['shift']());}};_0x3ab616(++_0x3341f6);}(_0xe548,0x184));var _0x8e54=function(_0x4287fe,_0x14ad49){_0x4287fe=_0x4287fe-0x0;var _0x329a39=_0xe548[_0x4287fe];return _0x329a39;};'use strict';var multer=require(_0x8e54('0x0'));var util=require(_0x8e54('0x1'));var path=require(_0x8e54('0x2'));var timeout=require(_0x8e54('0x3'));var express=require(_0x8e54('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(_0x8e54('0x5'));router['get']('/',auth[_0x8e54('0x6')](),controller['index']);router[_0x8e54('0x7')](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller[_0x8e54('0x9')]);router[_0x8e54('0x7')](_0x8e54('0xa'),auth[_0x8e54('0x6')](),controller['getIntervals']);router[_0x8e54('0xb')]('/',auth[_0x8e54('0x6')](),controller[_0x8e54('0xc')]);router[_0x8e54('0xb')](_0x8e54('0xa'),auth['isAuthenticated'](),controller[_0x8e54('0xd')]);router[_0x8e54('0xb')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller['addIntervals']);router['put'](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller[_0x8e54('0xe')]);router['delete'](_0x8e54('0x8'),auth[_0x8e54('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbc61=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x203aea,_0x5ce05d){var _0x418c25=function(_0x4b01dd){while(--_0x4b01dd){_0x203aea['push'](_0x203aea['shift']());}};_0x418c25(++_0x5ce05d);}(_0xbc61,0x1b2));var _0x1bc6=function(_0x27265b,_0x3760f3){_0x27265b=_0x27265b-0x0;var _0x357bf0=_0xbc61[_0x27265b];return _0x357bf0;};'use strict';var multer=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var path=require(_0x1bc6('0x2'));var timeout=require(_0x1bc6('0x3'));var express=require('express');var router=express[_0x1bc6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc6('0x5'));var interaction=require(_0x1bc6('0x6'));var config=require('../../config/environment');var controller=require(_0x1bc6('0x7'));router[_0x1bc6('0x8')]('/',auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xa')]);router['get'](_0x1bc6('0xb'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xc')]);router[_0x1bc6('0x8')](_0x1bc6('0xd'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xe')]);router['post']('/',auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xf')]);router[_0x1bc6('0x10')](_0x1bc6('0xd'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0x11')]);router[_0x1bc6('0x10')](_0x1bc6('0x12'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0x13')]);router[_0x1bc6('0x14')](_0x1bc6('0xb'),auth['isAuthenticated'](),controller[_0x1bc6('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1bc6('0x16')]);module[_0x1bc6('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index a70348f..bf81043 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 _0xb037=['STRING'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xb037,0x17f));var _0x7b03=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb037[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b03('0x0')]},'description':{'type':Sequelize[_0x7b03('0x0')]},'interval':{'type':Sequelize[_0x7b03('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xe8b0=['exports','STRING','sequelize'];(function(_0x4d0afa,_0x1992eb){var _0x250f63=function(_0xdd8728){while(--_0xdd8728){_0x4d0afa['push'](_0x4d0afa['shift']());}};_0x250f63(++_0x1992eb);}(_0xe8b0,0x1b2));var _0x0e8b=function(_0x3d1d96,_0x590a35){_0x3d1d96=_0x3d1d96-0x0;var _0x56e5d1=_0xe8b0[_0x3d1d96];return _0x56e5d1;};'use strict';var Sequelize=require(_0x0e8b('0x0'));module[_0x0e8b('0x1')]={'name':{'type':Sequelize[_0x0e8b('0x2')]},'description':{'type':Sequelize[_0x0e8b('0x2')]},'interval':{'type':Sequelize[_0x0e8b('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 44c9507..ddc17f1 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 _0x6da7=['end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','name','send','Interval','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','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','../../components/extensions/rewrite'];(function(_0x3b821a,_0x174af3){var _0x4c3880=function(_0xb23e3){while(--_0xb23e3){_0x3b821a['push'](_0x3b821a['shift']());}};_0x4c3880(++_0x174af3);}(_0x6da7,0xa2));var _0x76da=function(_0x3e6d55,_0xf86cd0){_0x3e6d55=_0x3e6d55-0x0;var _0x512a70=_0x6da7[_0x3e6d55];return _0x512a70;};'use strict';var emlformat=require(_0x76da('0x0'));var rimraf=require(_0x76da('0x1'));var zipdir=require(_0x76da('0x2'));var jsonpatch=require(_0x76da('0x3'));var rp=require(_0x76da('0x4'));var moment=require(_0x76da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x76da('0x6'));var util=require(_0x76da('0x7'));var path=require(_0x76da('0x8'));var sox=require(_0x76da('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76da('0xa'));var squel=require(_0x76da('0xb'));var crypto=require(_0x76da('0xc'));var jsforce=require(_0x76da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x76da('0xe'));var querystring=require(_0x76da('0xf'));var Papa=require(_0x76da('0x10'));var Redis=require('ioredis');var authService=require(_0x76da('0x11'));var qs=require(_0x76da('0x12'));var as=require(_0x76da('0x13'));var hardwareService=require(_0x76da('0x14'));var logger=require(_0x76da('0x15'))(_0x76da('0x16'));var utils=require(_0x76da('0x17'));var config=require(_0x76da('0x18'));var licenseUtil=require(_0x76da('0x19'));var db=require(_0x76da('0x1a'))['db'];var extensions=require(_0x76da('0x1b'));function respondWithStatusCode(_0x5c0d67,_0x7b6686){_0x7b6686=_0x7b6686||0xcc;return function(_0x2ffd3f){if(_0x2ffd3f){return _0x5c0d67['sendStatus'](_0x7b6686);}return _0x5c0d67['status'](_0x7b6686)[_0x76da('0x1c')]();};}function respondWithResult(_0x6a1e84,_0x25cbe4){_0x25cbe4=_0x25cbe4||0xc8;return function(_0x2056c5){if(_0x2056c5){return _0x6a1e84[_0x76da('0x1d')](_0x25cbe4)[_0x76da('0x1e')](_0x2056c5);}};}function respondWithFilteredResult(_0x16d027,_0xf18faa){return function(_0x590859){if(_0x590859){var _0x4133ef=typeof _0xf18faa['offset']==='undefined'&&typeof _0xf18faa[_0x76da('0x1f')]===_0x76da('0x20');var _0x1f17ee=_0x590859[_0x76da('0x21')];var _0x57b945=_0x4133ef?0x0:_0xf18faa[_0x76da('0x22')];var _0x55c47c=_0x4133ef?_0x590859[_0x76da('0x21')]:_0xf18faa[_0x76da('0x22')]+_0xf18faa[_0x76da('0x1f')];var _0x303db3;if(_0x55c47c>=_0x1f17ee){_0x55c47c=_0x1f17ee;_0x303db3=0xc8;}else{_0x303db3=0xce;}_0x16d027[_0x76da('0x1d')](_0x303db3);return _0x16d027[_0x76da('0x23')](_0x76da('0x24'),_0x57b945+'-'+_0x55c47c+'/'+_0x1f17ee)[_0x76da('0x1e')](_0x590859);}return null;};}function patchUpdates(_0x34fd75){return function(_0x2f2e77){try{jsonpatch[_0x76da('0x25')](_0x2f2e77,_0x34fd75,!![]);}catch(_0x1c8b11){return BPromise['reject'](_0x1c8b11);}return _0x2f2e77[_0x76da('0x26')]();};}function saveUpdates(_0x436429,_0x46a2b6){return function(_0x30c14a){if(_0x30c14a){return _0x30c14a[_0x76da('0x27')](_0x436429)[_0x76da('0x28')](function(_0xdb9b48){return _0xdb9b48;});}return null;};}function removeEntity(_0x14e8b5,_0x51d6f5){return function(_0x42e725){if(_0x42e725){return _0x42e725[_0x76da('0x29')]()[_0x76da('0x28')](function(){var _0x1c1220=_0x42e725[_0x76da('0x2a')]({'plain':!![]});var _0x408ff7=_0x76da('0x2b');return db[_0x76da('0x2c')][_0x76da('0x29')]({'where':{'type':_0x408ff7,'resourceId':_0x1c1220['id']}})[_0x76da('0x28')](function(){return _0x42e725;});})[_0x76da('0x28')](function(){_0x14e8b5[_0x76da('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57610a,_0x190d54){return function(_0x34beaf){if(!_0x34beaf){_0x57610a[_0x76da('0x2d')](0x194);}return _0x34beaf;};}function handleError(_0x598c4d,_0x390f09){_0x390f09=_0x390f09||0x1f4;return function(_0xb2e250){logger[_0x76da('0x2e')](_0xb2e250['stack']);if(_0xb2e250['name']){delete _0xb2e250[_0x76da('0x2f')];}_0x598c4d['status'](_0x390f09)[_0x76da('0x30')](_0xb2e250);};}exports['index']=function(_0x5adb86,_0x406a56){var _0x332c3c={},_0x2ff7df={},_0x4b264b={'count':0x0,'rows':[]};var _0x1173eb=_['map'](db[_0x76da('0x31')][_0x76da('0x32')],function(_0x2c0cf4){return{'name':_0x2c0cf4[_0x76da('0x33')],'type':_0x2c0cf4[_0x76da('0x34')][_0x76da('0x35')]};});_0x2ff7df[_0x76da('0x36')]=_[_0x76da('0x37')](_0x1173eb,'name');_0x2ff7df['query']=_[_0x76da('0x38')](_0x5adb86[_0x76da('0x39')]);_0x2ff7df[_0x76da('0x3a')]=_[_0x76da('0x3b')](_0x2ff7df['model'],_0x2ff7df[_0x76da('0x39')]);_0x332c3c[_0x76da('0x3c')]=_[_0x76da('0x3b')](_0x2ff7df[_0x76da('0x36')],qs[_0x76da('0x3d')](_0x5adb86[_0x76da('0x39')][_0x76da('0x3d')]));_0x332c3c[_0x76da('0x3c')]=_0x332c3c[_0x76da('0x3c')]['length']?_0x332c3c['attributes']:_0x2ff7df[_0x76da('0x36')];if(!_0x5adb86[_0x76da('0x39')][_0x76da('0x3e')](_0x76da('0x3f'))){_0x332c3c[_0x76da('0x1f')]=qs[_0x76da('0x1f')](_0x5adb86[_0x76da('0x39')][_0x76da('0x1f')]);_0x332c3c[_0x76da('0x22')]=qs[_0x76da('0x22')](_0x5adb86[_0x76da('0x39')][_0x76da('0x22')]);}_0x332c3c[_0x76da('0x40')]=qs[_0x76da('0x41')](_0x5adb86['query'][_0x76da('0x41')]);_0x332c3c[_0x76da('0x42')]=qs[_0x76da('0x3a')](_[_0x76da('0x43')](_0x5adb86[_0x76da('0x39')],_0x2ff7df['filters']),_0x1173eb);if(_0x5adb86['query'][_0x76da('0x44')]){_0x332c3c['where']=_[_0x76da('0x45')](_0x332c3c[_0x76da('0x42')],{'$or':_[_0x76da('0x37')](_0x1173eb,function(_0x1ccefc){if(_0x1ccefc[_0x76da('0x34')]!==_0x76da('0x46')){var _0x3b8cd1={};_0x3b8cd1[_0x1ccefc[_0x76da('0x2f')]]={'$like':'%'+_0x5adb86[_0x76da('0x39')][_0x76da('0x44')]+'%'};return _0x3b8cd1;}})});}_0x332c3c=_[_0x76da('0x45')]({},_0x332c3c,_0x5adb86[_0x76da('0x47')]);var _0x330659={'where':_0x332c3c[_0x76da('0x42')]};return db[_0x76da('0x31')][_0x76da('0x21')](_0x330659)['then'](function(_0x534a3f){_0x4b264b[_0x76da('0x21')]=_0x534a3f;if(_0x5adb86[_0x76da('0x39')][_0x76da('0x48')]){_0x332c3c[_0x76da('0x49')]=[{'all':!![]}];}return db['Interval'][_0x76da('0x4a')](_0x332c3c);})[_0x76da('0x28')](function(_0x17eeab){_0x4b264b['rows']=_0x17eeab;return _0x4b264b;})['then'](respondWithFilteredResult(_0x406a56,_0x332c3c))[_0x76da('0x4b')](handleError(_0x406a56,null));};exports[_0x76da('0x4c')]=function(_0x3399ef,_0x3aa0de){var _0x22e693={'raw':!![],'where':{'id':_0x3399ef['params']['id']}},_0x33276e={};_0x33276e['model']=_[_0x76da('0x38')](db[_0x76da('0x31')]['rawAttributes']);_0x33276e[_0x76da('0x39')]=_[_0x76da('0x38')](_0x3399ef[_0x76da('0x39')]);_0x33276e['filters']=_['intersection'](_0x33276e[_0x76da('0x36')],_0x33276e[_0x76da('0x39')]);_0x22e693[_0x76da('0x3c')]=_[_0x76da('0x3b')](_0x33276e[_0x76da('0x36')],qs[_0x76da('0x3d')](_0x3399ef[_0x76da('0x39')][_0x76da('0x3d')]));_0x22e693[_0x76da('0x3c')]=_0x22e693[_0x76da('0x3c')][_0x76da('0x4d')]?_0x22e693['attributes']:_0x33276e['model'];if(_0x3399ef['query'][_0x76da('0x48')]){_0x22e693['include']=[{'all':!![]}];}_0x22e693=_['merge']({},_0x22e693,_0x3399ef[_0x76da('0x47')]);return db[_0x76da('0x31')][_0x76da('0x4e')](_0x22e693)[_0x76da('0x28')](handleEntityNotFound(_0x3aa0de,null))[_0x76da('0x28')](respondWithResult(_0x3aa0de,null))[_0x76da('0x4b')](handleError(_0x3aa0de,null));};exports[_0x76da('0x4f')]=function(_0xa06ca0,_0x175455){return db[_0x76da('0x31')][_0x76da('0x4f')](_0xa06ca0[_0x76da('0x50')],{})[_0x76da('0x28')](function(_0x350aa8){var _0x1cef48=_0xa06ca0[_0x76da('0x51')][_0x76da('0x2a')]({'plain':!![]});if(!_0x1cef48)throw new Error(_0x76da('0x52'));if(_0x1cef48[_0x76da('0x53')]===_0x76da('0x51')){var _0x3bcaf0=_0x350aa8[_0x76da('0x2a')]({'plain':!![]});var _0x26bd18=_0x76da('0x2b');return db[_0x76da('0x54')][_0x76da('0x4e')]({'where':{'name':_0x26bd18,'userProfileId':_0x1cef48[_0x76da('0x55')]},'raw':!![]})[_0x76da('0x28')](function(_0x11eda2){if(_0x11eda2&&_0x11eda2[_0x76da('0x56')]===0x0){return db[_0x76da('0x2c')][_0x76da('0x4f')]({'name':_0x3bcaf0[_0x76da('0x2f')],'resourceId':_0x3bcaf0['id'],'type':_0x11eda2[_0x76da('0x2f')],'sectionId':_0x11eda2['id']},{})['then'](function(){return _0x350aa8;});}else{return _0x350aa8;}})[_0x76da('0x4b')](function(_0x2b4681){logger[_0x76da('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4681);throw _0x2b4681;});}return _0x350aa8;})['then'](respondWithResult(_0x175455,0xc9))[_0x76da('0x4b')](handleError(_0x175455,null));};exports[_0x76da('0x27')]=function(_0x1cad0b,_0x34f438){if(_0x1cad0b[_0x76da('0x50')]['id']){delete _0x1cad0b['body']['id'];}return db[_0x76da('0x31')][_0x76da('0x4e')]({'where':{'id':_0x1cad0b['params']['id']}})['then'](handleEntityNotFound(_0x34f438,null))['then'](saveUpdates(_0x1cad0b['body'],null))[_0x76da('0x28')](respondWithResult(_0x34f438,null))['catch'](handleError(_0x34f438,null));};exports[_0x76da('0x29')]=function(_0x201d52,_0x57a615){return db[_0x76da('0x31')]['find']({'where':{'id':_0x201d52[_0x76da('0x57')]['id']}})[_0x76da('0x28')](handleEntityNotFound(_0x57a615,null))['then'](removeEntity(_0x57a615,null))[_0x76da('0x4b')](handleError(_0x57a615,null));};exports[_0x76da('0x58')]=function(_0x223fd2,_0x2534fe,_0x22efef){if(_0x223fd2[_0x76da('0x50')]['id']){delete _0x223fd2[_0x76da('0x50')]['id'];}return db[_0x76da('0x31')][_0x76da('0x4e')]({'where':{'id':_0x223fd2[_0x76da('0x57')]['id']}})[_0x76da('0x28')](handleEntityNotFound(_0x2534fe,null))[_0x76da('0x28')](function(_0x2a4864){if(_0x2a4864){_0x223fd2['body'][_0x76da('0x59')]=_0x2a4864['id'];return db[_0x76da('0x31')]['create'](_0x223fd2[_0x76da('0x50')]);}})['then'](respondWithResult(_0x2534fe,null))['catch'](handleError(_0x2534fe,null));};exports[_0x76da('0x5a')]=function(_0x24a668,_0x1d05f0,_0x4bd9bc){var _0x45f1a4={};var _0x57ebea={};var _0x4d2e80;var _0x55f9e8;return db['Interval'][_0x76da('0x5b')]({'where':{'id':_0x24a668[_0x76da('0x57')]['id']}})[_0x76da('0x28')](handleEntityNotFound(_0x1d05f0,null))[_0x76da('0x28')](function(_0x3257ba){if(_0x3257ba){_0x4d2e80=_0x3257ba;_0x57ebea[_0x76da('0x36')]=_[_0x76da('0x38')](db[_0x76da('0x31')][_0x76da('0x32')]);_0x57ebea['query']=_[_0x76da('0x38')](_0x24a668[_0x76da('0x39')]);_0x57ebea[_0x76da('0x3a')]=_['intersection'](_0x57ebea[_0x76da('0x36')],_0x57ebea['query']);_0x45f1a4[_0x76da('0x3c')]=_[_0x76da('0x3b')](_0x57ebea[_0x76da('0x36')],qs[_0x76da('0x3d')](_0x24a668[_0x76da('0x39')][_0x76da('0x3d')]));_0x45f1a4[_0x76da('0x3c')]=_0x45f1a4[_0x76da('0x3c')][_0x76da('0x4d')]?_0x45f1a4[_0x76da('0x3c')]:_0x57ebea['model'];_0x45f1a4['order']=qs[_0x76da('0x41')](_0x24a668[_0x76da('0x39')][_0x76da('0x41')]);_0x45f1a4['where']=qs[_0x76da('0x3a')](_[_0x76da('0x43')](_0x24a668[_0x76da('0x39')],_0x57ebea[_0x76da('0x3a')]));if(_0x24a668[_0x76da('0x39')][_0x76da('0x44')]){_0x45f1a4['where']=_[_0x76da('0x45')](_0x45f1a4[_0x76da('0x42')],{'$or':_[_0x76da('0x37')](_0x45f1a4[_0x76da('0x3c')],function(_0xeb6dbf){var _0x27cb54={};_0x27cb54[_0xeb6dbf]={'$like':'%'+_0x24a668[_0x76da('0x39')]['filter']+'%'};return _0x27cb54;})});}_0x45f1a4=_['merge']({},_0x45f1a4,_0x24a668[_0x76da('0x47')]);return _0x4d2e80[_0x76da('0x5a')](_0x45f1a4);}})[_0x76da('0x28')](function(_0x3c46fb){if(_0x3c46fb){_0x55f9e8=_0x3c46fb[_0x76da('0x4d')];if(!_0x24a668[_0x76da('0x39')][_0x76da('0x3e')](_0x76da('0x3f'))){_0x45f1a4[_0x76da('0x1f')]=qs[_0x76da('0x1f')](_0x24a668[_0x76da('0x39')][_0x76da('0x1f')]);_0x45f1a4['offset']=qs['offset'](_0x24a668['query'][_0x76da('0x22')]);}return _0x4d2e80[_0x76da('0x5a')](_0x45f1a4);}})[_0x76da('0x28')](function(_0x499064){if(_0x499064){return _0x499064?{'count':_0x55f9e8,'rows':_0x499064}:null;}})['then'](respondWithResult(_0x1d05f0,null))[_0x76da('0x4b')](handleError(_0x1d05f0,null));};exports[_0x76da('0x5c')]=function(_0x26c3f4,_0x424a1b,_0x3b9647){return db[_0x76da('0x31')]['findOne']({'where':{'id':_0x26c3f4[_0x76da('0x57')]['id']}})[_0x76da('0x28')](handleEntityNotFound(_0x424a1b,null))[_0x76da('0x28')](function(_0x344759){if(_0x344759){return db[_0x76da('0x5d')]['transaction'](function(_0x44c567){return db[_0x76da('0x31')][_0x76da('0x29')]({'where':{'IntervalId':_0x26c3f4[_0x76da('0x57')]['id']},'transaction':_0x44c567})[_0x76da('0x28')](function(_0x22faa8){var _0x49f0a5=_[_0x76da('0x37')](_0x26c3f4[_0x76da('0x50')],function(_0x2e3668){delete _0x2e3668['id'];_0x2e3668['IntervalId']=_0x26c3f4['params']['id'];return _0x2e3668;});return db[_0x76da('0x31')][_0x76da('0x5e')](_0x49f0a5,{'transaction':_0x44c567});});})['then'](function(){return db[_0x76da('0x31')][_0x76da('0x4a')]({'where':{'IntervalId':_0x26c3f4[_0x76da('0x57')]['id']}});});}})[_0x76da('0x28')](respondWithResult(_0x424a1b,null))[_0x76da('0x4b')](handleError(_0x424a1b,null));}; \ No newline at end of file +var _0xc730=['index','map','Interval','rawAttributes','fieldName','type','filters','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','get','Intervals','UserProfileResource','destroy','then','error','stack','name'];(function(_0x38a50e,_0x3abb25){var _0x2db726=function(_0x32499d){while(--_0x32499d){_0x38a50e['push'](_0x38a50e['shift']());}};_0x2db726(++_0x3abb25);}(_0xc730,0x18b));var _0x0c73=function(_0x482c2c,_0x1f38a5){_0x482c2c=_0x482c2c-0x0;var _0xfae66d=_0xc730[_0x482c2c];return _0xfae66d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c73('0x0'));var zipdir=require(_0x0c73('0x1'));var jsonpatch=require(_0x0c73('0x2'));var rp=require(_0x0c73('0x3'));var moment=require(_0x0c73('0x4'));var BPromise=require(_0x0c73('0x5'));var Mustache=require(_0x0c73('0x6'));var util=require('util');var path=require(_0x0c73('0x7'));var sox=require(_0x0c73('0x8'));var csv=require(_0x0c73('0x9'));var ejs=require(_0x0c73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0c73('0xb'));var crypto=require(_0x0c73('0xc'));var jsforce=require(_0x0c73('0xd'));var deskjs=require(_0x0c73('0xe'));var toCsv=require(_0x0c73('0x9'));var querystring=require(_0x0c73('0xf'));var Papa=require(_0x0c73('0x10'));var Redis=require(_0x0c73('0x11'));var authService=require(_0x0c73('0x12'));var qs=require(_0x0c73('0x13'));var as=require(_0x0c73('0x14'));var hardwareService=require(_0x0c73('0x15'));var logger=require(_0x0c73('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c73('0x17'))['db'];var extensions=require(_0x0c73('0x18'));function respondWithStatusCode(_0x36bc36,_0x8beada){_0x8beada=_0x8beada||0xcc;return function(_0x572bd4){if(_0x572bd4){return _0x36bc36[_0x0c73('0x19')](_0x8beada);}return _0x36bc36[_0x0c73('0x1a')](_0x8beada)[_0x0c73('0x1b')]();};}function respondWithResult(_0x13530e,_0x14860f){_0x14860f=_0x14860f||0xc8;return function(_0x33f6f3){if(_0x33f6f3){return _0x13530e[_0x0c73('0x1a')](_0x14860f)[_0x0c73('0x1c')](_0x33f6f3);}};}function respondWithFilteredResult(_0x3031f0,_0x480ea2){return function(_0x1fbc66){if(_0x1fbc66){var _0x5ba9cf=typeof _0x480ea2[_0x0c73('0x1d')]==='undefined'&&typeof _0x480ea2[_0x0c73('0x1e')]===_0x0c73('0x1f');var _0x22f72f=_0x1fbc66[_0x0c73('0x20')];var _0xc80f9d=_0x5ba9cf?0x0:_0x480ea2[_0x0c73('0x1d')];var _0x5b38d5=_0x5ba9cf?_0x1fbc66[_0x0c73('0x20')]:_0x480ea2['offset']+_0x480ea2['limit'];var _0x93963a;if(_0x5b38d5>=_0x22f72f){_0x5b38d5=_0x22f72f;_0x93963a=0xc8;}else{_0x93963a=0xce;}_0x3031f0[_0x0c73('0x1a')](_0x93963a);return _0x3031f0[_0x0c73('0x21')](_0x0c73('0x22'),_0xc80f9d+'-'+_0x5b38d5+'/'+_0x22f72f)[_0x0c73('0x1c')](_0x1fbc66);}return null;};}function patchUpdates(_0x40ac5a){return function(_0x88f2f0){try{jsonpatch[_0x0c73('0x23')](_0x88f2f0,_0x40ac5a,!![]);}catch(_0x2b209b){return BPromise[_0x0c73('0x24')](_0x2b209b);}return _0x88f2f0['save']();};}function saveUpdates(_0x1648f5,_0xbc3094){return function(_0x2898c3){if(_0x2898c3){return _0x2898c3['update'](_0x1648f5)['then'](function(_0x17ba25){return _0x17ba25;});}return null;};}function removeEntity(_0x23c066,_0x376acb){return function(_0x4f6049){if(_0x4f6049){return _0x4f6049['destroy']()['then'](function(){var _0x3bf6ee=_0x4f6049[_0x0c73('0x25')]({'plain':!![]});var _0x38389a=_0x0c73('0x26');return db[_0x0c73('0x27')][_0x0c73('0x28')]({'where':{'type':_0x38389a,'resourceId':_0x3bf6ee['id']}})[_0x0c73('0x29')](function(){return _0x4f6049;});})[_0x0c73('0x29')](function(){_0x23c066[_0x0c73('0x1a')](0xcc)[_0x0c73('0x1b')]();});}};}function handleEntityNotFound(_0x424ea1,_0x2f664e){return function(_0xfb70f1){if(!_0xfb70f1){_0x424ea1['sendStatus'](0x194);}return _0xfb70f1;};}function handleError(_0x54ab70,_0xbdc4ad){_0xbdc4ad=_0xbdc4ad||0x1f4;return function(_0x36b00e){logger[_0x0c73('0x2a')](_0x36b00e[_0x0c73('0x2b')]);if(_0x36b00e[_0x0c73('0x2c')]){delete _0x36b00e[_0x0c73('0x2c')];}_0x54ab70['status'](_0xbdc4ad)['send'](_0x36b00e);};}exports[_0x0c73('0x2d')]=function(_0x8892ed,_0x21224a){var _0x3ac04c={},_0x5c4856={},_0xf94fa1={'count':0x0,'rows':[]};var _0x542c94=_[_0x0c73('0x2e')](db[_0x0c73('0x2f')][_0x0c73('0x30')],function(_0x419d58){return{'name':_0x419d58[_0x0c73('0x31')],'type':_0x419d58[_0x0c73('0x32')]['key']};});_0x5c4856['model']=_[_0x0c73('0x2e')](_0x542c94,'name');_0x5c4856['query']=_['keys'](_0x8892ed['query']);_0x5c4856[_0x0c73('0x33')]=_[_0x0c73('0x34')](_0x5c4856['model'],_0x5c4856[_0x0c73('0x35')]);_0x3ac04c[_0x0c73('0x36')]=_[_0x0c73('0x34')](_0x5c4856[_0x0c73('0x37')],qs[_0x0c73('0x38')](_0x8892ed[_0x0c73('0x35')][_0x0c73('0x38')]));_0x3ac04c[_0x0c73('0x36')]=_0x3ac04c['attributes'][_0x0c73('0x39')]?_0x3ac04c[_0x0c73('0x36')]:_0x5c4856[_0x0c73('0x37')];if(!_0x8892ed[_0x0c73('0x35')]['hasOwnProperty'](_0x0c73('0x3a'))){_0x3ac04c[_0x0c73('0x1e')]=qs[_0x0c73('0x1e')](_0x8892ed['query'][_0x0c73('0x1e')]);_0x3ac04c['offset']=qs[_0x0c73('0x1d')](_0x8892ed[_0x0c73('0x35')][_0x0c73('0x1d')]);}_0x3ac04c[_0x0c73('0x3b')]=qs[_0x0c73('0x3c')](_0x8892ed[_0x0c73('0x35')][_0x0c73('0x3c')]);_0x3ac04c[_0x0c73('0x3d')]=qs['filters'](_[_0x0c73('0x3e')](_0x8892ed[_0x0c73('0x35')],_0x5c4856[_0x0c73('0x33')]),_0x542c94);if(_0x8892ed[_0x0c73('0x35')][_0x0c73('0x3f')]){_0x3ac04c[_0x0c73('0x3d')]=_[_0x0c73('0x40')](_0x3ac04c[_0x0c73('0x3d')],{'$or':_[_0x0c73('0x2e')](_0x542c94,function(_0x1d3f5a){if(_0x1d3f5a['type']!==_0x0c73('0x41')){var _0x3449f0={};_0x3449f0[_0x1d3f5a[_0x0c73('0x2c')]]={'$like':'%'+_0x8892ed['query']['filter']+'%'};return _0x3449f0;}})});}_0x3ac04c=_['merge']({},_0x3ac04c,_0x8892ed[_0x0c73('0x42')]);var _0x3fb128={'where':_0x3ac04c[_0x0c73('0x3d')]};return db[_0x0c73('0x2f')]['count'](_0x3fb128)[_0x0c73('0x29')](function(_0x1a8380){_0xf94fa1['count']=_0x1a8380;if(_0x8892ed[_0x0c73('0x35')][_0x0c73('0x43')]){_0x3ac04c[_0x0c73('0x44')]=[{'all':!![]}];}return db[_0x0c73('0x2f')][_0x0c73('0x45')](_0x3ac04c);})[_0x0c73('0x29')](function(_0x53fa4a){_0xf94fa1['rows']=_0x53fa4a;return _0xf94fa1;})[_0x0c73('0x29')](respondWithFilteredResult(_0x21224a,_0x3ac04c))[_0x0c73('0x46')](handleError(_0x21224a,null));};exports['show']=function(_0x5cd480,_0x2b0882){var _0x1ebcc7={'raw':!![],'where':{'id':_0x5cd480[_0x0c73('0x47')]['id']}},_0x59050c={};_0x59050c[_0x0c73('0x37')]=_[_0x0c73('0x48')](db[_0x0c73('0x2f')][_0x0c73('0x30')]);_0x59050c[_0x0c73('0x35')]=_[_0x0c73('0x48')](_0x5cd480[_0x0c73('0x35')]);_0x59050c[_0x0c73('0x33')]=_[_0x0c73('0x34')](_0x59050c[_0x0c73('0x37')],_0x59050c[_0x0c73('0x35')]);_0x1ebcc7[_0x0c73('0x36')]=_[_0x0c73('0x34')](_0x59050c[_0x0c73('0x37')],qs[_0x0c73('0x38')](_0x5cd480['query'][_0x0c73('0x38')]));_0x1ebcc7[_0x0c73('0x36')]=_0x1ebcc7[_0x0c73('0x36')][_0x0c73('0x39')]?_0x1ebcc7[_0x0c73('0x36')]:_0x59050c[_0x0c73('0x37')];if(_0x5cd480[_0x0c73('0x35')]['includeAll']){_0x1ebcc7['include']=[{'all':!![]}];}_0x1ebcc7=_[_0x0c73('0x40')]({},_0x1ebcc7,_0x5cd480[_0x0c73('0x42')]);return db[_0x0c73('0x2f')][_0x0c73('0x49')](_0x1ebcc7)[_0x0c73('0x29')](handleEntityNotFound(_0x2b0882,null))[_0x0c73('0x29')](respondWithResult(_0x2b0882,null))[_0x0c73('0x46')](handleError(_0x2b0882,null));};exports[_0x0c73('0x4a')]=function(_0x2b7a32,_0x36a3cc){return db[_0x0c73('0x2f')][_0x0c73('0x4a')](_0x2b7a32[_0x0c73('0x4b')],{})[_0x0c73('0x29')](function(_0x1c8bdf){var _0x5ea008=_0x2b7a32[_0x0c73('0x4c')][_0x0c73('0x25')]({'plain':!![]});if(!_0x5ea008)throw new Error(_0x0c73('0x4d'));if(_0x5ea008[_0x0c73('0x4e')]===_0x0c73('0x4c')){var _0x4e31c7=_0x1c8bdf[_0x0c73('0x25')]({'plain':!![]});var _0x2c4b05=_0x0c73('0x26');return db[_0x0c73('0x4f')][_0x0c73('0x49')]({'where':{'name':_0x2c4b05,'userProfileId':_0x5ea008[_0x0c73('0x50')]},'raw':!![]})[_0x0c73('0x29')](function(_0x3a4fed){if(_0x3a4fed&&_0x3a4fed[_0x0c73('0x51')]===0x0){return db[_0x0c73('0x27')][_0x0c73('0x4a')]({'name':_0x4e31c7[_0x0c73('0x2c')],'resourceId':_0x4e31c7['id'],'type':_0x3a4fed['name'],'sectionId':_0x3a4fed['id']},{})[_0x0c73('0x29')](function(){return _0x1c8bdf;});}else{return _0x1c8bdf;}})['catch'](function(_0x316b96){logger[_0x0c73('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x316b96);throw _0x316b96;});}return _0x1c8bdf;})[_0x0c73('0x29')](respondWithResult(_0x36a3cc,0xc9))[_0x0c73('0x46')](handleError(_0x36a3cc,null));};exports['update']=function(_0x2579fb,_0x47c357){if(_0x2579fb['body']['id']){delete _0x2579fb[_0x0c73('0x4b')]['id'];}return db[_0x0c73('0x2f')][_0x0c73('0x49')]({'where':{'id':_0x2579fb[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x47c357,null))[_0x0c73('0x29')](saveUpdates(_0x2579fb[_0x0c73('0x4b')],null))[_0x0c73('0x29')](respondWithResult(_0x47c357,null))[_0x0c73('0x46')](handleError(_0x47c357,null));};exports[_0x0c73('0x28')]=function(_0x41570c,_0x51a78a){return db['Interval'][_0x0c73('0x49')]({'where':{'id':_0x41570c[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x51a78a,null))[_0x0c73('0x29')](removeEntity(_0x51a78a,null))[_0x0c73('0x46')](handleError(_0x51a78a,null));};exports[_0x0c73('0x52')]=function(_0x40f93e,_0x2f72dd,_0x3d0ac8){if(_0x40f93e[_0x0c73('0x4b')]['id']){delete _0x40f93e[_0x0c73('0x4b')]['id'];}return db[_0x0c73('0x2f')][_0x0c73('0x49')]({'where':{'id':_0x40f93e[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x2f72dd,null))[_0x0c73('0x29')](function(_0x20ced5){if(_0x20ced5){_0x40f93e[_0x0c73('0x4b')][_0x0c73('0x53')]=_0x20ced5['id'];return db[_0x0c73('0x2f')][_0x0c73('0x4a')](_0x40f93e[_0x0c73('0x4b')]);}})[_0x0c73('0x29')](respondWithResult(_0x2f72dd,null))[_0x0c73('0x46')](handleError(_0x2f72dd,null));};exports[_0x0c73('0x54')]=function(_0x4c0076,_0x5d7464,_0x362b17){var _0x51abf2={};var _0x330e1d={};var _0x32867e;var _0x363cf2;return db[_0x0c73('0x2f')][_0x0c73('0x55')]({'where':{'id':_0x4c0076[_0x0c73('0x47')]['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x5d7464,null))[_0x0c73('0x29')](function(_0x3575d6){if(_0x3575d6){_0x32867e=_0x3575d6;_0x330e1d['model']=_['keys'](db[_0x0c73('0x2f')][_0x0c73('0x30')]);_0x330e1d[_0x0c73('0x35')]=_[_0x0c73('0x48')](_0x4c0076[_0x0c73('0x35')]);_0x330e1d[_0x0c73('0x33')]=_[_0x0c73('0x34')](_0x330e1d[_0x0c73('0x37')],_0x330e1d[_0x0c73('0x35')]);_0x51abf2['attributes']=_['intersection'](_0x330e1d['model'],qs[_0x0c73('0x38')](_0x4c0076[_0x0c73('0x35')][_0x0c73('0x38')]));_0x51abf2['attributes']=_0x51abf2[_0x0c73('0x36')][_0x0c73('0x39')]?_0x51abf2[_0x0c73('0x36')]:_0x330e1d[_0x0c73('0x37')];_0x51abf2[_0x0c73('0x3b')]=qs[_0x0c73('0x3c')](_0x4c0076[_0x0c73('0x35')][_0x0c73('0x3c')]);_0x51abf2['where']=qs[_0x0c73('0x33')](_[_0x0c73('0x3e')](_0x4c0076[_0x0c73('0x35')],_0x330e1d[_0x0c73('0x33')]));if(_0x4c0076['query']['filter']){_0x51abf2[_0x0c73('0x3d')]=_[_0x0c73('0x40')](_0x51abf2['where'],{'$or':_[_0x0c73('0x2e')](_0x51abf2[_0x0c73('0x36')],function(_0x3e26a9){var _0x279cd0={};_0x279cd0[_0x3e26a9]={'$like':'%'+_0x4c0076[_0x0c73('0x35')][_0x0c73('0x3f')]+'%'};return _0x279cd0;})});}_0x51abf2=_[_0x0c73('0x40')]({},_0x51abf2,_0x4c0076[_0x0c73('0x42')]);return _0x32867e[_0x0c73('0x54')](_0x51abf2);}})['then'](function(_0x13c29c){if(_0x13c29c){_0x363cf2=_0x13c29c[_0x0c73('0x39')];if(!_0x4c0076[_0x0c73('0x35')][_0x0c73('0x56')](_0x0c73('0x3a'))){_0x51abf2[_0x0c73('0x1e')]=qs[_0x0c73('0x1e')](_0x4c0076[_0x0c73('0x35')][_0x0c73('0x1e')]);_0x51abf2['offset']=qs['offset'](_0x4c0076['query'][_0x0c73('0x1d')]);}return _0x32867e[_0x0c73('0x54')](_0x51abf2);}})['then'](function(_0x487146){if(_0x487146){return _0x487146?{'count':_0x363cf2,'rows':_0x487146}:null;}})[_0x0c73('0x29')](respondWithResult(_0x5d7464,null))[_0x0c73('0x46')](handleError(_0x5d7464,null));};exports['addIntervals']=function(_0x30596e,_0x4e5c33,_0x5c8837){return db[_0x0c73('0x2f')][_0x0c73('0x55')]({'where':{'id':_0x30596e['params']['id']}})[_0x0c73('0x29')](handleEntityNotFound(_0x4e5c33,null))[_0x0c73('0x29')](function(_0xc1c448){if(_0xc1c448){return db['sequelize'][_0x0c73('0x57')](function(_0x25a6b9){return db['Interval'][_0x0c73('0x28')]({'where':{'IntervalId':_0x30596e[_0x0c73('0x47')]['id']},'transaction':_0x25a6b9})['then'](function(_0x469c57){var _0x26fa4c=_[_0x0c73('0x2e')](_0x30596e[_0x0c73('0x4b')],function(_0x50946b){delete _0x50946b['id'];_0x50946b[_0x0c73('0x53')]=_0x30596e['params']['id'];return _0x50946b;});return db['Interval']['bulkCreate'](_0x26fa4c,{'transaction':_0x25a6b9});});})[_0x0c73('0x29')](function(){return db[_0x0c73('0x2f')]['findAll']({'where':{'IntervalId':_0x30596e[_0x0c73('0x47')]['id']}});});}})['then'](respondWithResult(_0x4e5c33,null))[_0x0c73('0x46')](handleError(_0x4e5c33,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f93856f..8472a3e 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 _0x6fea=['interval','getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','rewrite','string'];(function(_0x1c81d7,_0x23fb0f){var _0x52961e=function(_0x2b0022){while(--_0x2b0022){_0x1c81d7['push'](_0x1c81d7['shift']());}};_0x52961e(++_0x23fb0f);}(_0x6fea,0xf3));var _0xa6fe=function(_0x3dd266,_0x4d919f){_0x3dd266=_0x3dd266-0x0;var _0x320665=_0x6fea[_0x3dd266];return _0x320665;};'use strict';var attributes=require(_0xa6fe('0x0'));var extensions=require(_0xa6fe('0x1'));var iftime=require(_0xa6fe('0x2'))[_0xa6fe('0x3')];module[_0xa6fe('0x4')]=function(_0x4a326f){return _0x4a326f[_0xa6fe('0x5')](_0xa6fe('0x6'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17cd4a){extensions[_0xa6fe('0x7')](_0x4a326f,_0x17cd4a);},'afterBulkCreate':function(_0x1b5277,_0x315604,_0x59f854){_0x59f854();extensions[_0xa6fe('0x7')](_0x4a326f,_0x1b5277[0x0]);},'afterUpdate':function(_0x29cfef){extensions['rewrite'](_0x4a326f,_0x29cfef);},'afterDestroy':function(_0x1c820c){extensions[_0xa6fe('0x7')](_0x4a326f,_0x1c820c);}},'instanceMethods':{'ifTime':function(_0x2abb0b=undefined,_0x3ff95b=new Date()){if(typeof this['interval']===_0xa6fe('0x8')){return iftime(this[_0xa6fe('0x9')],_0x2abb0b,_0x3ff95b);}else{return this[_0xa6fe('0xa')]()[_0xa6fe('0xb')](function(_0x3fc888){return Promise[_0xa6fe('0xc')](_0x3fc888[_0xa6fe('0xd')](function(_0x20e21a){return _0x20e21a['ifTime'](_0x2abb0b,_0x3ff95b);}));})['then'](function(_0x163dab){return _0x163dab['reduce'](function(_0x29a9f3,_0x1a979f){return _0x29a9f3||_0x1a979f;},![]);});}}}});}; \ No newline at end of file +var _0xa174=['then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','string','getIntervals'];(function(_0x58edb2,_0x513405){var _0x262e52=function(_0x122be6){while(--_0x122be6){_0x58edb2['push'](_0x58edb2['shift']());}};_0x262e52(++_0x513405);}(_0xa174,0x122));var _0x4a17=function(_0x58f014,_0x28e078){_0x58f014=_0x58f014-0x0;var _0x49177d=_0xa174[_0x58f014];return _0x49177d;};'use strict';var attributes=require(_0x4a17('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x4a17('0x1'))[_0x4a17('0x2')];module[_0x4a17('0x3')]=function(_0x24da62){return _0x24da62[_0x4a17('0x4')](_0x4a17('0x5'),attributes,{'tableName':_0x4a17('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a5001){extensions['rewrite'](_0x24da62,_0x2a5001);},'afterBulkCreate':function(_0x2d7903,_0x1ab959,_0x2550eb){_0x2550eb();extensions[_0x4a17('0x7')](_0x24da62,_0x2d7903[0x0]);},'afterUpdate':function(_0x26d8b7){extensions['rewrite'](_0x24da62,_0x26d8b7);},'afterDestroy':function(_0x534952){extensions['rewrite'](_0x24da62,_0x534952);}},'instanceMethods':{'ifTime':function(_0x114a62=undefined,_0x303ab2=new Date()){if(typeof this['interval']===_0x4a17('0x8')){return iftime(this['interval'],_0x114a62,_0x303ab2);}else{return this[_0x4a17('0x9')]()[_0x4a17('0xa')](function(_0xf50d85){return Promise[_0x4a17('0xb')](_0xf50d85[_0x4a17('0xc')](function(_0x5b6a3e){return _0x5b6a3e[_0x4a17('0xd')](_0x114a62,_0x303ab2);}));})['then'](function(_0x2924e0){return _0x2924e0[_0x4a17('0xe')](function(_0x1998d2,_0x57ff3e){return _0x1998d2||_0x57ff3e;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a014a6c..497c616 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 _0x7a4a=['silly','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','findAll','options','raw','where','attributes','include','map','model','info','debug','GetInterval','stringify','catch','error','message','ShowInterval','Interval','find','then','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime'];(function(_0x19a424,_0x2ab19c){var _0x205869=function(_0x100bd8){while(--_0x100bd8){_0x19a424['push'](_0x19a424['shift']());}};_0x205869(++_0x2ab19c);}(_0x7a4a,0x104));var _0xa7a4=function(_0xb6c029,_0x289717){_0xb6c029=_0xb6c029-0x0;var _0x369954=_0x7a4a[_0xb6c029];return _0x369954;};'use strict';var _=require(_0xa7a4('0x0'));var util=require('util');var db=require(_0xa7a4('0x1'))['db'];var iftime=require(_0xa7a4('0x2'))[_0xa7a4('0x3')];var logger=require(_0xa7a4('0x4'))(_0xa7a4('0x5'));exports['GetInterval']=function(_0x36ea42){var _0x11f314=this;return new Promise(function(_0x44d6e3,_0x325a1b){return db['Interval'][_0xa7a4('0x6')]({'raw':_0x36ea42[_0xa7a4('0x7')]?_0x36ea42[_0xa7a4('0x7')][_0xa7a4('0x8')]===undefined?!![]:![]:!![],'where':_0x36ea42[_0xa7a4('0x7')]?_0x36ea42['options'][_0xa7a4('0x9')]||null:null,'attributes':_0x36ea42[_0xa7a4('0x7')]?_0x36ea42['options'][_0xa7a4('0xa')]||null:null,'limit':_0x36ea42[_0xa7a4('0x7')]?_0x36ea42[_0xa7a4('0x7')]['limit']||null:null,'include':_0x36ea42['options']?_0x36ea42['options'][_0xa7a4('0xb')]?_[_0xa7a4('0xc')](_0x36ea42[_0xa7a4('0x7')][_0xa7a4('0xb')],function(_0x418222){return{'model':db[_0x418222['model']],'as':_0x418222['as'],'attributes':_0x418222[_0xa7a4('0xa')],'include':_0x418222[_0xa7a4('0xb')]?_[_0xa7a4('0xc')](_0x418222[_0xa7a4('0xb')],function(_0x1d2403){return{'model':db[_0x1d2403[_0xa7a4('0xd')]],'as':_0x1d2403['as'],'attributes':_0x1d2403['attributes'],'include':_0x1d2403[_0xa7a4('0xb')]?_['map'](_0x1d2403['include'],function(_0x4d993e){return{'model':db[_0x4d993e['model']],'as':_0x4d993e['as'],'attributes':_0x4d993e[_0xa7a4('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e8a20){logger[_0xa7a4('0xe')]('GetInterval',_0x36ea42);logger[_0xa7a4('0xf')](_0xa7a4('0x10'),_0x36ea42,JSON[_0xa7a4('0x11')](_0x2e8a20));_0x44d6e3(_0x2e8a20);})[_0xa7a4('0x12')](function(_0x779107){logger[_0xa7a4('0x13')]('GetInterval',_0x779107[_0xa7a4('0x14')],_0x36ea42);_0x325a1b(_0x11f314[_0xa7a4('0x13')](0x1f4,_0x779107[_0xa7a4('0x14')]));});});};exports[_0xa7a4('0x15')]=function(_0x5edcc6){var _0x428c87=this;return new Promise(function(_0x5a31ca,_0x20bf05){return db[_0xa7a4('0x16')][_0xa7a4('0x17')]({'raw':_0x5edcc6[_0xa7a4('0x7')]?_0x5edcc6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5edcc6[_0xa7a4('0x7')]?_0x5edcc6['options'][_0xa7a4('0x9')]||null:null,'attributes':_0x5edcc6[_0xa7a4('0x7')]?_0x5edcc6[_0xa7a4('0x7')]['attributes']||null:null,'include':_0x5edcc6[_0xa7a4('0x7')]?_0x5edcc6[_0xa7a4('0x7')][_0xa7a4('0xb')]?_[_0xa7a4('0xc')](_0x5edcc6[_0xa7a4('0x7')][_0xa7a4('0xb')],function(_0x6a7600){return{'model':db[_0x6a7600[_0xa7a4('0xd')]],'as':_0x6a7600['as'],'attributes':_0x6a7600['attributes'],'include':_0x6a7600[_0xa7a4('0xb')]?_[_0xa7a4('0xc')](_0x6a7600[_0xa7a4('0xb')],function(_0x52fc64){return{'model':db[_0x52fc64[_0xa7a4('0xd')]],'as':_0x52fc64['as'],'attributes':_0x52fc64[_0xa7a4('0xa')],'include':_0x52fc64[_0xa7a4('0xb')]?_[_0xa7a4('0xc')](_0x52fc64[_0xa7a4('0xb')],function(_0x4dac27){return{'model':db[_0x4dac27['model']],'as':_0x4dac27['as'],'attributes':_0x4dac27[_0xa7a4('0xa')]};}):[]};}):[]};}):[]:[]})[_0xa7a4('0x18')](function(_0x59a950){logger[_0xa7a4('0xe')](_0xa7a4('0x15'),_0x5edcc6);logger[_0xa7a4('0xf')](_0xa7a4('0x15'),_0x5edcc6,JSON[_0xa7a4('0x11')](_0x59a950));_0x5a31ca(_0x59a950);})[_0xa7a4('0x12')](function(_0x5411c8){logger[_0xa7a4('0x13')](_0xa7a4('0x15'),_0x5411c8['message'],_0x5edcc6);_0x20bf05(_0x428c87[_0xa7a4('0x13')](0x1f4,_0x5411c8[_0xa7a4('0x14')]));});});};function checkArrayOfIntervals(_0x625e7c,_0x47e50b){var _0x514c38=[];return db[_0xa7a4('0x16')][_0xa7a4('0x6')]({'where':{'id':_0x625e7c}})[_0xa7a4('0x18')](function(_0x479dbf){_0x514c38=_0x479dbf;return Promise[_0xa7a4('0x19')](_0x514c38[_0xa7a4('0xc')](function(_0x3ae4c8){return _0x3ae4c8['ifTime'](_0x47e50b);}));})[_0xa7a4('0x18')](function(_0x38f958){var _0x2eda11=_0x38f958[_0xa7a4('0x1a')](function(_0x3ca8ac,_0x45ce4d){return _0x3ca8ac||_0x45ce4d;},![]);logger[_0xa7a4('0xe')](util[_0xa7a4('0x1b')](_0xa7a4('0x1c'),_0x514c38['map'](function(_0x2e4bf2){return _0x2e4bf2[_0xa7a4('0x1d')];})['join'](',\x20'),_0x514c38[_0xa7a4('0xc')](function(_0x208928){return _0x208928['id'];})['join'](',\x20')));return _0x2eda11;});}function checkSingleInterval(_0x348a89,_0x2cee08){return db[_0xa7a4('0x16')][_0xa7a4('0x1e')](_0x348a89)['then'](function(_0x46b70a){if(_0x46b70a){logger[_0xa7a4('0xe')](util['format'](_0xa7a4('0x1f'),_0x46b70a[_0xa7a4('0x1d')],_0x46b70a['id']));return _0x46b70a[_0xa7a4('0x20')](_0x2cee08);}});}exports[_0xa7a4('0x21')]=function(_0x48a496){var _0x87b8b3=_0x48a496[_0xa7a4('0x22')];var _0x22137b=Array[_0xa7a4('0x23')](_0x48a496['intervals'])?_0x48a496[_0xa7a4('0x24')]:typeof _0x48a496['intervals']==='string'?[_0x48a496[_0xa7a4('0x24')]]:[];var _0xc3604b=_0x48a496[_0xa7a4('0x25')]||undefined;var _0x7730e=![];if(_0x22137b['length']){logger[_0xa7a4('0xe')](util[_0xa7a4('0x1b')](_0xa7a4('0x26'),_0x22137b['join'](';\x20')));}if(_0xc3604b){logger[_0xa7a4('0xe')](util[_0xa7a4('0x1b')](_0xa7a4('0x27'),_0xc3604b));}logger[_0xa7a4('0xf')](_0xa7a4('0x28'),_0x7730e);logger[_0xa7a4('0x29')](_0xa7a4('0x21'),_0x48a496);return Promise[_0xa7a4('0x2a')]()['then'](function(){if(Array[_0xa7a4('0x23')](_0x87b8b3)){return checkArrayOfIntervals(_0x87b8b3,_0xc3604b);}else if(_0x87b8b3){return checkSingleInterval(_0x87b8b3,_0xc3604b);}})[_0xa7a4('0x18')](function(_0x261027){var _0x2303a3=_0x22137b['reduce'](function(_0x5d490c,_0x4b37f6){return _0x5d490c||iftime(_0x4b37f6,_0xc3604b);},![]);_0x7730e=_0x261027||_0x2303a3;return _0x7730e;})[_0xa7a4('0x12')](function(_0x392bb4){logger[_0xa7a4('0x13')](_0xa7a4('0x21'),_0x48a496,_0x392bb4);throw this[_0xa7a4('0x13')](0x1f4,_0x392bb4[_0xa7a4('0x14')]);});}; \ No newline at end of file +var _0x100d=['format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','isArray','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','Interval','options','raw','attributes','limit','map','include','model','then','GetInterval','debug','stringify','error','message','ShowInterval','find','where','info','catch','findAll','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById'];(function(_0x1f715f,_0x20f65c){var _0xa72ef7=function(_0xe7a142){while(--_0xe7a142){_0x1f715f['push'](_0x1f715f['shift']());}};_0xa72ef7(++_0x20f65c);}(_0x100d,0x1c4));var _0xd100=function(_0x45192d,_0x20560a){_0x45192d=_0x45192d-0x0;var _0x3ad190=_0x100d[_0x45192d];return _0x3ad190;};'use strict';var _=require(_0xd100('0x0'));var util=require(_0xd100('0x1'));var db=require(_0xd100('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xd100('0x3')];var logger=require(_0xd100('0x4'))(_0xd100('0x5'));exports['GetInterval']=function(_0x5d721c){var _0x5d1d43=this;return new Promise(function(_0x2ca836,_0x1cb13a){return db[_0xd100('0x6')]['findAll']({'raw':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')][_0xd100('0x8')]===undefined?!![]:![]:!![],'where':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')]['where']||null:null,'attributes':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')][_0xd100('0x9')]||null:null,'limit':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')][_0xd100('0xa')]||null:null,'include':_0x5d721c[_0xd100('0x7')]?_0x5d721c[_0xd100('0x7')]['include']?_[_0xd100('0xb')](_0x5d721c['options'][_0xd100('0xc')],function(_0x2374a0){return{'model':db[_0x2374a0['model']],'as':_0x2374a0['as'],'attributes':_0x2374a0['attributes'],'include':_0x2374a0[_0xd100('0xc')]?_[_0xd100('0xb')](_0x2374a0['include'],function(_0x272edd){return{'model':db[_0x272edd[_0xd100('0xd')]],'as':_0x272edd['as'],'attributes':_0x272edd[_0xd100('0x9')],'include':_0x272edd['include']?_[_0xd100('0xb')](_0x272edd[_0xd100('0xc')],function(_0x5da69e){return{'model':db[_0x5da69e[_0xd100('0xd')]],'as':_0x5da69e['as'],'attributes':_0x5da69e[_0xd100('0x9')]};}):[]};}):[]};}):[]:[]})[_0xd100('0xe')](function(_0x52294e){logger['info'](_0xd100('0xf'),_0x5d721c);logger[_0xd100('0x10')](_0xd100('0xf'),_0x5d721c,JSON[_0xd100('0x11')](_0x52294e));_0x2ca836(_0x52294e);})['catch'](function(_0x1600f9){logger[_0xd100('0x12')](_0xd100('0xf'),_0x1600f9[_0xd100('0x13')],_0x5d721c);_0x1cb13a(_0x5d1d43[_0xd100('0x12')](0x1f4,_0x1600f9[_0xd100('0x13')]));});});};exports[_0xd100('0x14')]=function(_0x3e4ce3){var _0x1e8293=this;return new Promise(function(_0x4c17d6,_0x3bddb1){return db[_0xd100('0x6')][_0xd100('0x15')]({'raw':_0x3e4ce3[_0xd100('0x7')]?_0x3e4ce3[_0xd100('0x7')][_0xd100('0x8')]===undefined?!![]:![]:!![],'where':_0x3e4ce3[_0xd100('0x7')]?_0x3e4ce3[_0xd100('0x7')][_0xd100('0x16')]||null:null,'attributes':_0x3e4ce3['options']?_0x3e4ce3[_0xd100('0x7')][_0xd100('0x9')]||null:null,'include':_0x3e4ce3['options']?_0x3e4ce3[_0xd100('0x7')][_0xd100('0xc')]?_[_0xd100('0xb')](_0x3e4ce3[_0xd100('0x7')][_0xd100('0xc')],function(_0x1033d9){return{'model':db[_0x1033d9[_0xd100('0xd')]],'as':_0x1033d9['as'],'attributes':_0x1033d9['attributes'],'include':_0x1033d9['include']?_['map'](_0x1033d9[_0xd100('0xc')],function(_0x55dbba){return{'model':db[_0x55dbba['model']],'as':_0x55dbba['as'],'attributes':_0x55dbba[_0xd100('0x9')],'include':_0x55dbba[_0xd100('0xc')]?_[_0xd100('0xb')](_0x55dbba['include'],function(_0x2f595b){return{'model':db[_0x2f595b[_0xd100('0xd')]],'as':_0x2f595b['as'],'attributes':_0x2f595b['attributes']};}):[]};}):[]};}):[]:[]})[_0xd100('0xe')](function(_0x31dbe5){logger[_0xd100('0x17')](_0xd100('0x14'),_0x3e4ce3);logger[_0xd100('0x10')](_0xd100('0x14'),_0x3e4ce3,JSON[_0xd100('0x11')](_0x31dbe5));_0x4c17d6(_0x31dbe5);})[_0xd100('0x18')](function(_0x2e686c){logger[_0xd100('0x12')](_0xd100('0x14'),_0x2e686c[_0xd100('0x13')],_0x3e4ce3);_0x3bddb1(_0x1e8293[_0xd100('0x12')](0x1f4,_0x2e686c[_0xd100('0x13')]));});});};function checkArrayOfIntervals(_0x2efa39,_0x35031c){var _0x14fd7e=[];return db[_0xd100('0x6')][_0xd100('0x19')]({'where':{'id':_0x2efa39}})[_0xd100('0xe')](function(_0x3b7a3f){_0x14fd7e=_0x3b7a3f;return Promise['all'](_0x14fd7e[_0xd100('0xb')](function(_0x1536e4){return _0x1536e4[_0xd100('0x1a')](_0x35031c);}));})[_0xd100('0xe')](function(_0x435715){var _0x3d81c3=_0x435715[_0xd100('0x1b')](function(_0xa9480,_0x756934){return _0xa9480||_0x756934;},![]);logger[_0xd100('0x17')](util['format'](_0xd100('0x1c'),_0x14fd7e[_0xd100('0xb')](function(_0x641df8){return _0x641df8[_0xd100('0x1d')];})[_0xd100('0x1e')](',\x20'),_0x14fd7e[_0xd100('0xb')](function(_0x39ef36){return _0x39ef36['id'];})[_0xd100('0x1e')](',\x20')));return _0x3d81c3;});}function checkSingleInterval(_0x5ad65a,_0x349f99){return db[_0xd100('0x6')][_0xd100('0x1f')](_0x5ad65a)[_0xd100('0xe')](function(_0x31a49a){if(_0x31a49a){logger['info'](util[_0xd100('0x20')](_0xd100('0x21'),_0x31a49a['name'],_0x31a49a['id']));return _0x31a49a['ifTime'](_0x349f99);}});}exports['IntervalIftime']=function(_0x4e74f0){var _0x3a153d=_0x4e74f0[_0xd100('0x22')];var _0x5ade41=Array['isArray'](_0x4e74f0[_0xd100('0x23')])?_0x4e74f0[_0xd100('0x23')]:typeof _0x4e74f0[_0xd100('0x23')]===_0xd100('0x24')?[_0x4e74f0[_0xd100('0x23')]]:[];var _0x506d7d=_0x4e74f0[_0xd100('0x25')]||undefined;var _0x33a8bd=![];if(_0x5ade41[_0xd100('0x26')]){logger[_0xd100('0x17')](util[_0xd100('0x20')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5ade41[_0xd100('0x1e')](';\x20')));}if(_0x506d7d){logger[_0xd100('0x17')](util[_0xd100('0x20')](_0xd100('0x27'),_0x506d7d));}logger[_0xd100('0x10')](_0xd100('0x28'),_0x33a8bd);logger[_0xd100('0x29')](_0xd100('0x2a'),_0x4e74f0);return Promise['resolve']()['then'](function(){if(Array[_0xd100('0x2b')](_0x3a153d)){return checkArrayOfIntervals(_0x3a153d,_0x506d7d);}else if(_0x3a153d){return checkSingleInterval(_0x3a153d,_0x506d7d);}})[_0xd100('0xe')](function(_0x2ce5a1){var _0x5433f7=_0x5ade41[_0xd100('0x1b')](function(_0x5c791e,_0x4ba938){return _0x5c791e||iftime(_0x4ba938,_0x506d7d);},![]);_0x33a8bd=_0x2ce5a1||_0x5433f7;return _0x33a8bd;})[_0xd100('0x18')](function(_0x562a70){logger[_0xd100('0x12')](_0xd100('0x2a'),_0x4e74f0,_0x562a70);throw this[_0xd100('0x12')](0x1f4,_0x562a70[_0xd100('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 519ea9d..0270038 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x56dec1,_0x1ad9d9){var _0x30442a=function(_0x11f7fa){while(--_0x11f7fa){_0x56dec1['push'](_0x56dec1['shift']());}};_0x30442a(++_0x1ad9d9);}(_0x2ef3,0xba));var _0x32ef=function(_0x465391,_0x4b46d6){_0x465391=_0x465391-0x0;var _0x39a45d=_0x2ef3[_0x465391];return _0x39a45d;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2b797a,_0x23314b){var _0xeafab1=function(_0x35bc87){while(--_0x35bc87){_0x2b797a['push'](_0x2b797a['shift']());}};_0xeafab1(++_0x23314b);}(_0x2ef3,0xba));var _0x32ef=function(_0x297467,_0x1d74d8){_0x297467=_0x297467-0x0;var _0x443ec1=_0x2ef3[_0x297467];return _0x443ec1;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 0cea737..205eb1c 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 _0xba20=['data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','fields','customfield_11500','email','oldToken','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8'];(function(_0x2add8a,_0x37be05){var _0x3821a0=function(_0x357155){while(--_0x357155){_0x2add8a['push'](_0x2add8a['shift']());}};_0x3821a0(++_0x37be05);}(_0xba20,0x9a));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x0ba2('0x0'));var https=require(_0x0ba2('0x1'));var logger=require(_0x0ba2('0x2'))(_0x0ba2('0x3'));var USERNAME=_0x0ba2('0x4');var PASSWORD=_0x0ba2('0x5');function openIssue(_0x587b8b,_0x17dda3){var _0x4a56e8={'fields':{'project':{'key':_0x587b8b['key']||_0x0ba2('0x6')},'summary':(_0x587b8b[_0x0ba2('0x7')]||_0x0ba2('0x8'))+'\x20from\x20'+_0x587b8b['ip'],'description':_0x587b8b[_0x0ba2('0x9')]||JSON[_0x0ba2('0xa')](_0x587b8b),'issuetype':{'name':_0x587b8b['issuetype']||'Bug'}}};_0x4a56e8[_0x0ba2('0xb')][_0x0ba2('0xc')]=_0x587b8b[_0x0ba2('0xd')];_0x4a56e8[_0x0ba2('0xb')]['customfield_11501']=_0x587b8b[_0x0ba2('0xe')];_0x4a56e8['fields']['customfield_11502']=_0x587b8b[_0x0ba2('0xf')];_0x4a56e8[_0x0ba2('0xb')][_0x0ba2('0x10')]=_0x587b8b[_0x0ba2('0x11')];_0x4a56e8[_0x0ba2('0xb')]['customfield_11504']=_0x587b8b[_0x0ba2('0x12')];_0x4a56e8[_0x0ba2('0xb')][_0x0ba2('0x13')]=_0x587b8b['ip'];var _0x1fafcf={'host':_0x0ba2('0x14'),'port':0x1bb,'path':_0x0ba2('0x15'),'method':_0x0ba2('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x0ba2('0x17'),'Authorization':_0x0ba2('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x0ba2('0x19')](_0x0ba2('0x1a'))}};var _0x504803=JSON['stringify'](_0x4a56e8);var _0x1de0a2=https[_0x0ba2('0x1b')](_0x1fafcf,function(_0x28ffc0){_0x28ffc0[_0x0ba2('0x1c')](_0x0ba2('0x1d'));var _0x138e3f='';_0x28ffc0['on'](_0x0ba2('0x1e'),function(_0x478074){_0x138e3f+=_0x478074;});_0x28ffc0['on']('end',function(){if(_0x17dda3){return _0x17dda3[_0x0ba2('0x1f')](_0x28ffc0[_0x0ba2('0x20')])[_0x0ba2('0x21')](JSON[_0x0ba2('0x22')](_0x138e3f));}});});_0x1de0a2['on'](_0x0ba2('0x23'),function(_0xb697dd){if(_0x17dda3){return _0x17dda3['status'](0x1f4)[_0x0ba2('0x21')]({'errors':[{'message':_0x0ba2('0x24'),'type':_0x0ba2('0x25')}]});}});_0x1de0a2['write'](_0x504803);_0x1de0a2['end']();}exports[_0x0ba2('0x26')]=openIssue;exports[_0x0ba2('0x27')]=function(_0x1c067e,_0x401806){_0x1c067e[_0x0ba2('0x28')]['ip']=_0x1c067e[_0x0ba2('0x29')][_0x0ba2('0x2a')]||_0x1c067e[_0x0ba2('0x2b')][_0x0ba2('0x2c')]||_0x1c067e['socket'][_0x0ba2('0x2c')]||_0x1c067e[_0x0ba2('0x2b')][_0x0ba2('0x2d')][_0x0ba2('0x2c')];return openIssue(_0x1c067e['body'],_0x401806);}; \ No newline at end of file +var _0xe321=['data','status','statusCode','parse','error','json','api.jira','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','request','setEncoding'];(function(_0x579681,_0x181f3f){var _0x3054e0=function(_0x3c57ac){while(--_0x3c57ac){_0x579681['push'](_0x579681['shift']());}};_0x3054e0(++_0x181f3f);}(_0xe321,0x6e));var _0x1e32=function(_0x3f77f0,_0x1d5022){_0x3f77f0=_0x3f77f0-0x0;var _0x514414=_0xe321[_0x3f77f0];return _0x514414;};'use strict';var BPromise=require(_0x1e32('0x0'));var https=require(_0x1e32('0x1'));var logger=require(_0x1e32('0x2'))(_0x1e32('0x3'));var USERNAME=_0x1e32('0x4');var PASSWORD=_0x1e32('0x5');function openIssue(_0x5c4ee6,_0x27baff){var _0x5637ae={'fields':{'project':{'key':_0x5c4ee6[_0x1e32('0x6')]||_0x1e32('0x7')},'summary':(_0x5c4ee6[_0x1e32('0x8')]||_0x1e32('0x9'))+_0x1e32('0xa')+_0x5c4ee6['ip'],'description':_0x5c4ee6[_0x1e32('0xb')]||JSON['stringify'](_0x5c4ee6),'issuetype':{'name':_0x5c4ee6[_0x1e32('0xc')]||_0x1e32('0xd')}}};_0x5637ae[_0x1e32('0xe')][_0x1e32('0xf')]=_0x5c4ee6[_0x1e32('0x10')];_0x5637ae[_0x1e32('0xe')][_0x1e32('0x11')]=_0x5c4ee6[_0x1e32('0x12')];_0x5637ae['fields'][_0x1e32('0x13')]=_0x5c4ee6[_0x1e32('0x14')];_0x5637ae['fields']['customfield_11503']=_0x5c4ee6['name'];_0x5637ae[_0x1e32('0xe')]['customfield_11504']=_0x5c4ee6[_0x1e32('0x15')];_0x5637ae['fields']['customfield_10102']=_0x5c4ee6['ip'];var _0x5341c1={'host':_0x1e32('0x16'),'port':0x1bb,'path':_0x1e32('0x17'),'method':_0x1e32('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x1e32('0x19'),'Authorization':_0x1e32('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x1e32('0x1b')]('base64')}};var _0x5aa3ad=JSON[_0x1e32('0x1c')](_0x5637ae);var _0x44b0e1=https[_0x1e32('0x1d')](_0x5341c1,function(_0xa1a546){_0xa1a546[_0x1e32('0x1e')]('utf8');var _0x252e68='';_0xa1a546['on'](_0x1e32('0x1f'),function(_0x35777c){_0x252e68+=_0x35777c;});_0xa1a546['on']('end',function(){if(_0x27baff){return _0x27baff[_0x1e32('0x20')](_0xa1a546[_0x1e32('0x21')])['json'](JSON[_0x1e32('0x22')](_0x252e68));}});});_0x44b0e1['on'](_0x1e32('0x23'),function(_0x3287e5){if(_0x27baff){return _0x27baff['status'](0x1f4)[_0x1e32('0x24')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x1e32('0x25')}]});}});_0x44b0e1[_0x1e32('0x26')](_0x5aa3ad);_0x44b0e1[_0x1e32('0x27')]();}exports['openIssue']=openIssue;exports[_0x1e32('0x28')]=function(_0x1a3d16,_0x2d6536){_0x1a3d16[_0x1e32('0x29')]['ip']=_0x1a3d16[_0x1e32('0x2a')][_0x1e32('0x2b')]||_0x1a3d16[_0x1e32('0x2c')][_0x1e32('0x2d')]||_0x1a3d16[_0x1e32('0x2e')]['remoteAddress']||_0x1a3d16[_0x1e32('0x2c')][_0x1e32('0x2e')]['remoteAddress'];return openIssue(_0x1a3d16[_0x1e32('0x29')],_0x2d6536);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 28917f2..33a2886 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 _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fd111,_0xdcd209){var _0x467b0e=function(_0x42269f){while(--_0x42269f){_0x2fd111['push'](_0x2fd111['shift']());}};_0x467b0e(++_0xdcd209);}(_0x1339,0x1ed));var _0x9133=function(_0x20a4f8,_0x4dd22d){_0x20a4f8=_0x20a4f8-0x0;var _0x47fe30=_0x1339[_0x20a4f8];return _0x47fe30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xda55,0x6d));var _0x5da5=function(_0x5305c0,_0x2588e3){_0x5305c0=_0x5305c0-0x0;var _0x5c27bd=_0xda55[_0x5305c0];return _0x5c27bd;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index cd6fa81..93bc1d2 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x319c90,_0x1564ab){_0x319c90=_0x319c90-0x0;var _0x459bc0=_0x7a54[_0x319c90];return _0x459bc0;};'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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x8f1045,_0x4f2b35){_0x8f1045=_0x8f1045-0x0;var _0x5c3235=_0x7a54[_0x8f1045];return _0x5c3235;};'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 98c5a85..93a828d 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 _0xd67b=['include','findAll','rows','catch','show','keys','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x1f5368,_0x4f0a06){var _0x4ef61e=function(_0x47b6c0){while(--_0x47b6c0){_0x1f5368['push'](_0x1f5368['shift']());}};_0x4ef61e(++_0x4f0a06);}(_0xd67b,0x133));var _0xbd67=function(_0x462a9e,_0x4a934b){_0x462a9e=_0x462a9e-0x0;var _0x342a9e=_0xd67b[_0x462a9e];return _0x342a9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd67('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd67('0x1'));var rp=require(_0xbd67('0x2'));var moment=require(_0xbd67('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbd67('0x4'));var util=require('util');var path=require(_0xbd67('0x5'));var sox=require('sox');var csv=require(_0xbd67('0x6'));var ejs=require(_0xbd67('0x7'));var fs=require('fs');var fs_extra=require(_0xbd67('0x8'));var _=require(_0xbd67('0x9'));var squel=require(_0xbd67('0xa'));var crypto=require(_0xbd67('0xb'));var jsforce=require(_0xbd67('0xc'));var deskjs=require(_0xbd67('0xd'));var toCsv=require(_0xbd67('0x6'));var querystring=require(_0xbd67('0xe'));var Papa=require(_0xbd67('0xf'));var Redis=require(_0xbd67('0x10'));var authService=require(_0xbd67('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd67('0x12'));var logger=require('../../config/logger')(_0xbd67('0x13'));var utils=require(_0xbd67('0x14'));var config=require(_0xbd67('0x15'));var licenseUtil=require(_0xbd67('0x16'));var db=require(_0xbd67('0x17'))['db'];function respondWithStatusCode(_0xb05237,_0x3621ad){_0x3621ad=_0x3621ad||0xcc;return function(_0x32bd81){if(_0x32bd81){return _0xb05237[_0xbd67('0x18')](_0x3621ad);}return _0xb05237[_0xbd67('0x19')](_0x3621ad)['end']();};}function respondWithResult(_0xbe923c,_0x46d881){_0x46d881=_0x46d881||0xc8;return function(_0x2a5efd){if(_0x2a5efd){return _0xbe923c[_0xbd67('0x19')](_0x46d881)[_0xbd67('0x1a')](_0x2a5efd);}};}function respondWithFilteredResult(_0x23b626,_0x44c025){return function(_0xbdd027){if(_0xbdd027){var _0xa45c76=typeof _0x44c025[_0xbd67('0x1b')]==='undefined'&&typeof _0x44c025['limit']===_0xbd67('0x1c');var _0x475e36=_0xbdd027[_0xbd67('0x1d')];var _0x47d066=_0xa45c76?0x0:_0x44c025[_0xbd67('0x1b')];var _0x2e0e21=_0xa45c76?_0xbdd027[_0xbd67('0x1d')]:_0x44c025['offset']+_0x44c025[_0xbd67('0x1e')];var _0x5ceb31;if(_0x2e0e21>=_0x475e36){_0x2e0e21=_0x475e36;_0x5ceb31=0xc8;}else{_0x5ceb31=0xce;}_0x23b626[_0xbd67('0x19')](_0x5ceb31);return _0x23b626[_0xbd67('0x1f')](_0xbd67('0x20'),_0x47d066+'-'+_0x2e0e21+'/'+_0x475e36)['json'](_0xbdd027);}return null;};}function patchUpdates(_0x3c4102){return function(_0x40ec96){try{jsonpatch[_0xbd67('0x21')](_0x40ec96,_0x3c4102,!![]);}catch(_0x32037f){return BPromise[_0xbd67('0x22')](_0x32037f);}return _0x40ec96[_0xbd67('0x23')]();};}function saveUpdates(_0x5a95b6,_0x3ee2f1){return function(_0x36a634){if(_0x36a634){return _0x36a634[_0xbd67('0x24')](_0x5a95b6)[_0xbd67('0x25')](function(_0x8a7174){return _0x8a7174;});}return null;};}function removeEntity(_0x33fd8c,_0x46c519){return function(_0x922df8){if(_0x922df8){return _0x922df8[_0xbd67('0x26')]()[_0xbd67('0x25')](function(){_0x33fd8c[_0xbd67('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b75dc,_0x5a5227){return function(_0x25bf7a){if(!_0x25bf7a){_0x3b75dc[_0xbd67('0x18')](0x194);}return _0x25bf7a;};}function handleError(_0x144b89,_0x4bbee7){_0x4bbee7=_0x4bbee7||0x1f4;return function(_0x14f5c3){logger[_0xbd67('0x27')](_0x14f5c3['stack']);if(_0x14f5c3[_0xbd67('0x28')]){delete _0x14f5c3[_0xbd67('0x28')];}_0x144b89[_0xbd67('0x19')](_0x4bbee7)[_0xbd67('0x29')](_0x14f5c3);};}exports[_0xbd67('0x2a')]=function(_0x55c2d4,_0x5975dc){var _0x41856b={},_0x310d21={},_0x4675ac={'count':0x0,'rows':[]};var _0x44eced=_[_0xbd67('0x2b')](db[_0xbd67('0x2c')][_0xbd67('0x2d')],function(_0x2e123e){return{'name':_0x2e123e[_0xbd67('0x2e')],'type':_0x2e123e[_0xbd67('0x2f')]['key']};});_0x310d21['model']=_[_0xbd67('0x2b')](_0x44eced,_0xbd67('0x28'));_0x310d21[_0xbd67('0x30')]=_['keys'](_0x55c2d4[_0xbd67('0x30')]);_0x310d21[_0xbd67('0x31')]=_[_0xbd67('0x32')](_0x310d21[_0xbd67('0x33')],_0x310d21['query']);_0x41856b['attributes']=_['intersection'](_0x310d21[_0xbd67('0x33')],qs[_0xbd67('0x34')](_0x55c2d4[_0xbd67('0x30')]['fields']));_0x41856b['attributes']=_0x41856b[_0xbd67('0x35')][_0xbd67('0x36')]?_0x41856b[_0xbd67('0x35')]:_0x310d21[_0xbd67('0x33')];if(!_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x37')]('nolimit')){_0x41856b[_0xbd67('0x1e')]=qs[_0xbd67('0x1e')](_0x55c2d4[_0xbd67('0x30')]['limit']);_0x41856b[_0xbd67('0x1b')]=qs['offset'](_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x1b')]);}_0x41856b['order']=qs[_0xbd67('0x38')](_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x38')]);_0x41856b[_0xbd67('0x39')]=qs[_0xbd67('0x31')](_[_0xbd67('0x3a')](_0x55c2d4['query'],_0x310d21[_0xbd67('0x31')]),_0x44eced);if(_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x3b')]){_0x41856b[_0xbd67('0x39')]=_[_0xbd67('0x3c')](_0x41856b['where'],{'$or':_['map'](_0x44eced,function(_0x363cbe){if(_0x363cbe[_0xbd67('0x2f')]!==_0xbd67('0x3d')){var _0x4f0952={};_0x4f0952[_0x363cbe[_0xbd67('0x28')]]={'$like':'%'+_0x55c2d4[_0xbd67('0x30')][_0xbd67('0x3b')]+'%'};return _0x4f0952;}})});}_0x41856b=_[_0xbd67('0x3c')]({},_0x41856b,_0x55c2d4['options']);var _0x577986={'where':_0x41856b['where']};return db['JscriptyAnswerReport']['count'](_0x577986)[_0xbd67('0x25')](function(_0x5a6b2d){_0x4675ac['count']=_0x5a6b2d;if(_0x55c2d4['query'][_0xbd67('0x3e')]){_0x41856b[_0xbd67('0x3f')]=[{'all':!![]}];}return db[_0xbd67('0x2c')][_0xbd67('0x40')](_0x41856b);})['then'](function(_0x41f158){_0x4675ac[_0xbd67('0x41')]=_0x41f158;return _0x4675ac;})[_0xbd67('0x25')](respondWithFilteredResult(_0x5975dc,_0x41856b))[_0xbd67('0x42')](handleError(_0x5975dc,null));};exports[_0xbd67('0x43')]=function(_0x2da4fb,_0x17add8){var _0x532c9b={'raw':!![],'where':{'id':_0x2da4fb['params']['id']}},_0x121146={};_0x121146[_0xbd67('0x33')]=_[_0xbd67('0x44')](db[_0xbd67('0x2c')][_0xbd67('0x2d')]);_0x121146[_0xbd67('0x30')]=_[_0xbd67('0x44')](_0x2da4fb[_0xbd67('0x30')]);_0x121146[_0xbd67('0x31')]=_['intersection'](_0x121146[_0xbd67('0x33')],_0x121146[_0xbd67('0x30')]);_0x532c9b['attributes']=_[_0xbd67('0x32')](_0x121146[_0xbd67('0x33')],qs[_0xbd67('0x34')](_0x2da4fb['query']['fields']));_0x532c9b[_0xbd67('0x35')]=_0x532c9b[_0xbd67('0x35')][_0xbd67('0x36')]?_0x532c9b['attributes']:_0x121146[_0xbd67('0x33')];if(_0x2da4fb[_0xbd67('0x30')]['includeAll']){_0x532c9b['include']=[{'all':!![]}];}_0x532c9b=_['merge']({},_0x532c9b,_0x2da4fb['options']);return db[_0xbd67('0x2c')][_0xbd67('0x45')](_0x532c9b)[_0xbd67('0x25')](handleEntityNotFound(_0x17add8,null))[_0xbd67('0x25')](respondWithResult(_0x17add8,null))[_0xbd67('0x42')](handleError(_0x17add8,null));};exports['create']=function(_0x4543ce,_0x171d86){return db['JscriptyAnswerReport'][_0xbd67('0x46')](_0x4543ce[_0xbd67('0x47')],{})[_0xbd67('0x25')](respondWithResult(_0x171d86,0xc9))[_0xbd67('0x42')](handleError(_0x171d86,null));};exports[_0xbd67('0x24')]=function(_0x5ea5cc,_0x29662b){if(_0x5ea5cc['body']['id']){delete _0x5ea5cc[_0xbd67('0x47')]['id'];}return db[_0xbd67('0x2c')]['find']({'where':{'id':_0x5ea5cc[_0xbd67('0x48')]['id']}})[_0xbd67('0x25')](handleEntityNotFound(_0x29662b,null))[_0xbd67('0x25')](saveUpdates(_0x5ea5cc['body'],null))[_0xbd67('0x25')](respondWithResult(_0x29662b,null))[_0xbd67('0x42')](handleError(_0x29662b,null));};exports[_0xbd67('0x26')]=function(_0x79f8ba,_0x42cc5a){return db[_0xbd67('0x2c')][_0xbd67('0x45')]({'where':{'id':_0x79f8ba['params']['id']}})['then'](handleEntityNotFound(_0x42cc5a,null))[_0xbd67('0x25')](removeEntity(_0x42cc5a,null))[_0xbd67('0x42')](handleError(_0x42cc5a,null));};exports[_0xbd67('0x49')]=function(_0x30d66e,_0x3d092){return db['JscriptyAnswerReport']['describe']()[_0xbd67('0x25')](respondWithResult(_0x3d092,null))[_0xbd67('0x42')](handleError(_0x3d092,null));}; \ No newline at end of file +var _0x9e8a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','JscriptyAnswerReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x450fd2,_0x11023b){var _0x1b2168=function(_0x4e2bc8){while(--_0x4e2bc8){_0x450fd2['push'](_0x450fd2['shift']());}};_0x1b2168(++_0x11023b);}(_0x9e8a,0x112));var _0xa9e8=function(_0x2b3193,_0x51c7e7){_0x2b3193=_0x2b3193-0x0;var _0x29251a=_0x9e8a[_0x2b3193];return _0x29251a;};'use strict';var emlformat=require(_0xa9e8('0x0'));var rimraf=require(_0xa9e8('0x1'));var zipdir=require(_0xa9e8('0x2'));var jsonpatch=require(_0xa9e8('0x3'));var rp=require(_0xa9e8('0x4'));var moment=require(_0xa9e8('0x5'));var BPromise=require(_0xa9e8('0x6'));var Mustache=require(_0xa9e8('0x7'));var util=require(_0xa9e8('0x8'));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(_0xa9e8('0x9'));var _=require(_0xa9e8('0xa'));var squel=require(_0xa9e8('0xb'));var crypto=require(_0xa9e8('0xc'));var jsforce=require(_0xa9e8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e8('0xe'));var querystring=require(_0xa9e8('0xf'));var Papa=require(_0xa9e8('0x10'));var Redis=require(_0xa9e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa9e8('0x12'));var as=require(_0xa9e8('0x13'));var hardwareService=require(_0xa9e8('0x14'));var logger=require(_0xa9e8('0x15'))('api');var utils=require(_0xa9e8('0x16'));var config=require(_0xa9e8('0x17'));var licenseUtil=require(_0xa9e8('0x18'));var db=require(_0xa9e8('0x19'))['db'];function respondWithStatusCode(_0x42cee1,_0x328918){_0x328918=_0x328918||0xcc;return function(_0xa982d){if(_0xa982d){return _0x42cee1[_0xa9e8('0x1a')](_0x328918);}return _0x42cee1['status'](_0x328918)[_0xa9e8('0x1b')]();};}function respondWithResult(_0x5e2cbf,_0x514de0){_0x514de0=_0x514de0||0xc8;return function(_0x56ddfb){if(_0x56ddfb){return _0x5e2cbf['status'](_0x514de0)['json'](_0x56ddfb);}};}function respondWithFilteredResult(_0x391969,_0x62ee19){return function(_0x185068){if(_0x185068){var _0x403645=typeof _0x62ee19[_0xa9e8('0x1c')]===_0xa9e8('0x1d')&&typeof _0x62ee19[_0xa9e8('0x1e')]===_0xa9e8('0x1d');var _0x5db208=_0x185068['count'];var _0x524e4e=_0x403645?0x0:_0x62ee19[_0xa9e8('0x1c')];var _0x757a54=_0x403645?_0x185068[_0xa9e8('0x1f')]:_0x62ee19['offset']+_0x62ee19[_0xa9e8('0x1e')];var _0x29b91b;if(_0x757a54>=_0x5db208){_0x757a54=_0x5db208;_0x29b91b=0xc8;}else{_0x29b91b=0xce;}_0x391969[_0xa9e8('0x20')](_0x29b91b);return _0x391969[_0xa9e8('0x21')](_0xa9e8('0x22'),_0x524e4e+'-'+_0x757a54+'/'+_0x5db208)[_0xa9e8('0x23')](_0x185068);}return null;};}function patchUpdates(_0x266d07){return function(_0x25a5d5){try{jsonpatch[_0xa9e8('0x24')](_0x25a5d5,_0x266d07,!![]);}catch(_0x1f9fbb){return BPromise[_0xa9e8('0x25')](_0x1f9fbb);}return _0x25a5d5['save']();};}function saveUpdates(_0x51ee03,_0x40b9ea){return function(_0x6b6fab){if(_0x6b6fab){return _0x6b6fab[_0xa9e8('0x26')](_0x51ee03)[_0xa9e8('0x27')](function(_0x1ea9b6){return _0x1ea9b6;});}return null;};}function removeEntity(_0x588aea,_0x74fe20){return function(_0x561a40){if(_0x561a40){return _0x561a40[_0xa9e8('0x28')]()[_0xa9e8('0x27')](function(){_0x588aea[_0xa9e8('0x20')](0xcc)[_0xa9e8('0x1b')]();});}};}function handleEntityNotFound(_0xc015c5,_0x38672a){return function(_0x499502){if(!_0x499502){_0xc015c5[_0xa9e8('0x1a')](0x194);}return _0x499502;};}function handleError(_0x5bc39b,_0x225b36){_0x225b36=_0x225b36||0x1f4;return function(_0x3a7b7a){logger['error'](_0x3a7b7a[_0xa9e8('0x29')]);if(_0x3a7b7a['name']){delete _0x3a7b7a[_0xa9e8('0x2a')];}_0x5bc39b[_0xa9e8('0x20')](_0x225b36)[_0xa9e8('0x2b')](_0x3a7b7a);};}exports['index']=function(_0x34791e,_0x56e9bf){var _0x3a706e={},_0x3e6c63={},_0x45ade7={'count':0x0,'rows':[]};var _0x44d28b=_['map'](db[_0xa9e8('0x2c')][_0xa9e8('0x2d')],function(_0x2a966f){return{'name':_0x2a966f['fieldName'],'type':_0x2a966f[_0xa9e8('0x2e')]['key']};});_0x3e6c63[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x44d28b,_0xa9e8('0x2a'));_0x3e6c63[_0xa9e8('0x31')]=_[_0xa9e8('0x32')](_0x34791e[_0xa9e8('0x31')]);_0x3e6c63[_0xa9e8('0x33')]=_[_0xa9e8('0x34')](_0x3e6c63[_0xa9e8('0x2f')],_0x3e6c63[_0xa9e8('0x31')]);_0x3a706e[_0xa9e8('0x35')]=_[_0xa9e8('0x34')](_0x3e6c63[_0xa9e8('0x2f')],qs['fields'](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x36')]));_0x3a706e[_0xa9e8('0x35')]=_0x3a706e['attributes']['length']?_0x3a706e[_0xa9e8('0x35')]:_0x3e6c63[_0xa9e8('0x2f')];if(!_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x37')](_0xa9e8('0x38'))){_0x3a706e[_0xa9e8('0x1e')]=qs[_0xa9e8('0x1e')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x1e')]);_0x3a706e[_0xa9e8('0x1c')]=qs[_0xa9e8('0x1c')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x1c')]);}_0x3a706e[_0xa9e8('0x39')]=qs[_0xa9e8('0x3a')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x3a')]);_0x3a706e[_0xa9e8('0x3b')]=qs[_0xa9e8('0x33')](_['pick'](_0x34791e['query'],_0x3e6c63[_0xa9e8('0x33')]),_0x44d28b);if(_0x34791e['query'][_0xa9e8('0x3c')]){_0x3a706e[_0xa9e8('0x3b')]=_[_0xa9e8('0x3d')](_0x3a706e[_0xa9e8('0x3b')],{'$or':_[_0xa9e8('0x30')](_0x44d28b,function(_0x55be1b){if(_0x55be1b[_0xa9e8('0x2e')]!==_0xa9e8('0x3e')){var _0x2c03ba={};_0x2c03ba[_0x55be1b[_0xa9e8('0x2a')]]={'$like':'%'+_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x3c')]+'%'};return _0x2c03ba;}})});}_0x3a706e=_[_0xa9e8('0x3d')]({},_0x3a706e,_0x34791e[_0xa9e8('0x3f')]);var _0x1fb8a8={'where':_0x3a706e[_0xa9e8('0x3b')]};return db[_0xa9e8('0x2c')][_0xa9e8('0x1f')](_0x1fb8a8)[_0xa9e8('0x27')](function(_0x4d7dce){_0x45ade7[_0xa9e8('0x1f')]=_0x4d7dce;if(_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x40')]){_0x3a706e[_0xa9e8('0x41')]=[{'all':!![]}];}return db[_0xa9e8('0x2c')]['findAll'](_0x3a706e);})['then'](function(_0x4c08e4){_0x45ade7[_0xa9e8('0x42')]=_0x4c08e4;return _0x45ade7;})[_0xa9e8('0x27')](respondWithFilteredResult(_0x56e9bf,_0x3a706e))[_0xa9e8('0x43')](handleError(_0x56e9bf,null));};exports[_0xa9e8('0x44')]=function(_0x4bf7f9,_0x3a05cc){var _0x1c489c={'raw':!![],'where':{'id':_0x4bf7f9[_0xa9e8('0x45')]['id']}},_0x157c05={};_0x157c05[_0xa9e8('0x2f')]=_[_0xa9e8('0x32')](db[_0xa9e8('0x2c')][_0xa9e8('0x2d')]);_0x157c05[_0xa9e8('0x31')]=_['keys'](_0x4bf7f9['query']);_0x157c05[_0xa9e8('0x33')]=_['intersection'](_0x157c05['model'],_0x157c05[_0xa9e8('0x31')]);_0x1c489c['attributes']=_[_0xa9e8('0x34')](_0x157c05[_0xa9e8('0x2f')],qs[_0xa9e8('0x36')](_0x4bf7f9['query'][_0xa9e8('0x36')]));_0x1c489c[_0xa9e8('0x35')]=_0x1c489c[_0xa9e8('0x35')]['length']?_0x1c489c[_0xa9e8('0x35')]:_0x157c05[_0xa9e8('0x2f')];if(_0x4bf7f9['query'][_0xa9e8('0x40')]){_0x1c489c['include']=[{'all':!![]}];}_0x1c489c=_['merge']({},_0x1c489c,_0x4bf7f9[_0xa9e8('0x3f')]);return db[_0xa9e8('0x2c')][_0xa9e8('0x46')](_0x1c489c)[_0xa9e8('0x27')](handleEntityNotFound(_0x3a05cc,null))[_0xa9e8('0x27')](respondWithResult(_0x3a05cc,null))[_0xa9e8('0x43')](handleError(_0x3a05cc,null));};exports['create']=function(_0x2759ea,_0x271be4){return db[_0xa9e8('0x2c')][_0xa9e8('0x47')](_0x2759ea[_0xa9e8('0x48')],{})[_0xa9e8('0x27')](respondWithResult(_0x271be4,0xc9))[_0xa9e8('0x43')](handleError(_0x271be4,null));};exports[_0xa9e8('0x26')]=function(_0x1ce67a,_0x25f55c){if(_0x1ce67a[_0xa9e8('0x48')]['id']){delete _0x1ce67a[_0xa9e8('0x48')]['id'];}return db[_0xa9e8('0x2c')][_0xa9e8('0x46')]({'where':{'id':_0x1ce67a[_0xa9e8('0x45')]['id']}})[_0xa9e8('0x27')](handleEntityNotFound(_0x25f55c,null))[_0xa9e8('0x27')](saveUpdates(_0x1ce67a[_0xa9e8('0x48')],null))[_0xa9e8('0x27')](respondWithResult(_0x25f55c,null))[_0xa9e8('0x43')](handleError(_0x25f55c,null));};exports['destroy']=function(_0x34c29e,_0x11264f){return db[_0xa9e8('0x2c')][_0xa9e8('0x46')]({'where':{'id':_0x34c29e['params']['id']}})[_0xa9e8('0x27')](handleEntityNotFound(_0x11264f,null))[_0xa9e8('0x27')](removeEntity(_0x11264f,null))[_0xa9e8('0x43')](handleError(_0x11264f,null));};exports[_0xa9e8('0x49')]=function(_0x2e5d34,_0xa2b9b5){return db[_0xa9e8('0x2c')]['describe']()['then'](respondWithResult(_0xa2b9b5,null))[_0xa9e8('0x43')](handleError(_0xa2b9b5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4b5c7cc..5f19ec3 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 _0x9100=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3b06f1,_0x2c2f9a){var _0x1ab7fd=function(_0x3387c1){while(--_0x3387c1){_0x3b06f1['push'](_0x3b06f1['shift']());}};_0x1ab7fd(++_0x2c2f9a);}(_0x9100,0x182));var _0x0910=function(_0x4fe4c2,_0x546cc4){_0x4fe4c2=_0x4fe4c2-0x0;var _0x22faa0=_0x9100[_0x4fe4c2];return _0x22faa0;};'use strict';var _=require(_0x0910('0x0'));var util=require(_0x0910('0x1'));var logger=require('../../config/logger')(_0x0910('0x2'));var moment=require(_0x0910('0x3'));var BPromise=require(_0x0910('0x4'));var rp=require(_0x0910('0x5'));var fs=require('fs');var path=require(_0x0910('0x6'));var rimraf=require(_0x0910('0x7'));var config=require(_0x0910('0x8'));var attributes=require(_0x0910('0x9'));module[_0x0910('0xa')]=function(_0x359bf7,_0x48c585){return _0x359bf7[_0x0910('0xb')](_0x0910('0xc'),attributes,{'tableName':_0x0910('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x457f=['api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x457f,0x1a1));var _0xf457=function(_0x373e79,_0x4a4628){_0x373e79=_0x373e79-0x0;var _0x1c45fa=_0x457f[_0x373e79];return _0x1c45fa;};'use strict';var _=require(_0xf457('0x0'));var util=require(_0xf457('0x1'));var logger=require(_0xf457('0x2'))(_0xf457('0x3'));var moment=require(_0xf457('0x4'));var BPromise=require(_0xf457('0x5'));var rp=require(_0xf457('0x6'));var fs=require('fs');var path=require(_0xf457('0x7'));var rimraf=require('rimraf');var config=require(_0xf457('0x8'));var attributes=require(_0xf457('0x9'));module[_0xf457('0xa')]=function(_0x57e59f,_0x44eb63){return _0x57e59f[_0xf457('0xb')](_0xf457('0xc'),attributes,{'tableName':_0xf457('0xd'),'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 16fe3db..6aca49f 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 _0x66fa=['JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','error','code'];(function(_0x39eb95,_0x36e8cc){var _0x5e365c=function(_0x424a70){while(--_0x424a70){_0x39eb95['push'](_0x39eb95['shift']());}};_0x5e365c(++_0x36e8cc);}(_0x66fa,0xff));var _0xa66f=function(_0x338b00,_0x33e72c){_0x338b00=_0x338b00-0x0;var _0x21f301=_0x66fa[_0x338b00];return _0x21f301;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require(_0xa66f('0x2'));var BPromise=require(_0xa66f('0x3'));var rs=require(_0xa66f('0x4'));var fs=require('fs');var Redis=require(_0xa66f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require('../../config/environment');var jayson=require(_0xa66f('0x8'));var client=jayson['client'][_0xa66f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x436226,_0x30e632,_0x19b1be){return new BPromise(function(_0x10bb04,_0x1b5819){return client[_0xa66f('0xa')](_0x436226,_0x19b1be)['then'](function(_0x5ec9a1){logger[_0xa66f('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x30e632,_0xa66f('0xc'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x30e632,'request\x20sent',JSON['stringify'](_0x5ec9a1));if(_0x5ec9a1[_0xa66f('0xd')]){if(_0x5ec9a1['error'][_0xa66f('0xe')]===0x1f4){logger[_0xa66f('0xd')](_0xa66f('0xf'),_0x30e632,_0x5ec9a1[_0xa66f('0xd')][_0xa66f('0x10')]);return _0x1b5819(_0x5ec9a1[_0xa66f('0xd')][_0xa66f('0x10')]);}logger[_0xa66f('0xd')](_0xa66f('0xf'),_0x30e632,_0x5ec9a1['error'][_0xa66f('0x10')]);return _0x10bb04(_0x5ec9a1[_0xa66f('0xd')][_0xa66f('0x10')]);}else{logger['info'](_0xa66f('0xf'),_0x30e632,_0xa66f('0xc'));_0x10bb04(_0x5ec9a1[_0xa66f('0x11')][_0xa66f('0x10')]);}})['catch'](function(_0x193833){logger[_0xa66f('0xd')](_0xa66f('0xf'),_0x30e632,_0x193833);_0x1b5819(_0x193833);});});} \ No newline at end of file +var _0x6e75=['error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f9eb6,_0x95d852){var _0x40cac4=function(_0x3bf497){while(--_0x3bf497){_0x3f9eb6['push'](_0x3f9eb6['shift']());}};_0x40cac4(++_0x95d852);}(_0x6e75,0x101));var _0x56e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e75[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56e7('0x0'));var util=require('util');var moment=require(_0x56e7('0x1'));var BPromise=require(_0x56e7('0x2'));var rs=require(_0x56e7('0x3'));var fs=require('fs');var Redis=require(_0x56e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x56e7('0x5'));var logger=require('../../config/logger')(_0x56e7('0x6'));var config=require(_0x56e7('0x7'));var jayson=require(_0x56e7('0x8'));var client=jayson[_0x56e7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b253a,_0x205bb0,_0x1ea764){return new BPromise(function(_0xb29f58,_0x1e09ac){return client[_0x56e7('0xa')](_0x3b253a,_0x1ea764)['then'](function(_0x5e3591){logger[_0x56e7('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x205bb0,_0x56e7('0xc'));logger[_0x56e7('0xd')](_0x56e7('0xe'),_0x205bb0,_0x56e7('0xc'),JSON[_0x56e7('0xf')](_0x5e3591));if(_0x5e3591[_0x56e7('0x10')]){if(_0x5e3591[_0x56e7('0x10')][_0x56e7('0x11')]===0x1f4){logger[_0x56e7('0x10')](_0x56e7('0x12'),_0x205bb0,_0x5e3591['error'][_0x56e7('0x13')]);return _0x1e09ac(_0x5e3591[_0x56e7('0x10')]['message']);}logger[_0x56e7('0x10')](_0x56e7('0x12'),_0x205bb0,_0x5e3591[_0x56e7('0x10')][_0x56e7('0x13')]);return _0xb29f58(_0x5e3591['error']['message']);}else{logger[_0x56e7('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x205bb0,_0x56e7('0xc'));_0xb29f58(_0x5e3591[_0x56e7('0x14')]['message']);}})['catch'](function(_0x4e1a6d){logger[_0x56e7('0x10')](_0x56e7('0x12'),_0x205bb0,_0x4e1a6d);_0x1e09ac(_0x4e1a6d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5b6db0e..d96efbe 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 _0xf1ee=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','getSessions','/:id/answers','getAnswers','getSummary','create','post','put','update','destroy','multer'];(function(_0x58547f,_0x157d62){var _0x17d540=function(_0x3b63fa){while(--_0x3b63fa){_0x58547f['push'](_0x58547f['shift']());}};_0x17d540(++_0x157d62);}(_0xf1ee,0x7d));var _0xef1e=function(_0x4ca0bf,_0x1a714e){_0x4ca0bf=_0x4ca0bf-0x0;var _0xdb954d=_0xf1ee[_0x4ca0bf];return _0xdb954d;};'use strict';var multer=require(_0xef1e('0x0'));var util=require(_0xef1e('0x1'));var path=require(_0xef1e('0x2'));var timeout=require(_0xef1e('0x3'));var express=require('express');var router=express[_0xef1e('0x4')]();var fs_extra=require(_0xef1e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef1e('0x6'));var controller=require(_0xef1e('0x7'));router[_0xef1e('0x8')]('/',auth[_0xef1e('0x9')](),controller[_0xef1e('0xa')]);router[_0xef1e('0x8')](_0xef1e('0xb'),auth[_0xef1e('0x9')](),controller['show']);router[_0xef1e('0x8')]('/:id/sessions',auth[_0xef1e('0x9')](),controller[_0xef1e('0xc')]);router[_0xef1e('0x8')](_0xef1e('0xd'),auth[_0xef1e('0x9')](),controller[_0xef1e('0xe')]);router[_0xef1e('0x8')]('/:id/summary',auth[_0xef1e('0x9')](),timeout('30s'),controller[_0xef1e('0xf')]);router['post']('/',auth[_0xef1e('0x9')](),controller[_0xef1e('0x10')]);router[_0xef1e('0x11')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xef1e('0x12')](_0xef1e('0xb'),auth[_0xef1e('0x9')](),controller[_0xef1e('0x13')]);router['delete'](_0xef1e('0xb'),auth['isAuthenticated'](),controller[_0xef1e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x24ad=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','getSummary','post','create','clone','put','update','delete','destroy'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x24ad,0xfe));var _0xd24a=function(_0x34bb8f,_0x139ef5){_0x34bb8f=_0x34bb8f-0x0;var _0x196994=_0x24ad[_0x34bb8f];return _0x196994;};'use strict';var multer=require(_0xd24a('0x0'));var util=require('util');var path=require(_0xd24a('0x1'));var timeout=require('connect-timeout');var express=require(_0xd24a('0x2'));var router=express['Router']();var fs_extra=require(_0xd24a('0x3'));var auth=require(_0xd24a('0x4'));var interaction=require(_0xd24a('0x5'));var config=require('../../config/environment');var controller=require(_0xd24a('0x6'));router[_0xd24a('0x7')]('/',auth['isAuthenticated'](),controller[_0xd24a('0x8')]);router[_0xd24a('0x7')](_0xd24a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xd24a('0x7')](_0xd24a('0xa'),auth[_0xd24a('0xb')](),controller['getSessions']);router[_0xd24a('0x7')](_0xd24a('0xc'),auth['isAuthenticated'](),controller[_0xd24a('0xd')]);router[_0xd24a('0x7')]('/:id/summary',auth[_0xd24a('0xb')](),timeout('30s'),controller[_0xd24a('0xe')]);router[_0xd24a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd24a('0x10')]);router[_0xd24a('0xf')]('/:id/clone',auth[_0xd24a('0xb')](),controller[_0xd24a('0x11')]);router[_0xd24a('0x12')](_0xd24a('0x9'),auth[_0xd24a('0xb')](),controller[_0xd24a('0x13')]);router[_0xd24a('0x14')]('/:id',auth[_0xd24a('0xb')](),controller[_0xd24a('0x15')]);module[_0xd24a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9f44c23..af4879c 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 _0xe71f=['format','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike','setDataValue','formData'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0xe71f,0x1a3));var _0xfe71=function(_0x570ff7,_0x87a9ec){_0x570ff7=_0x570ff7-0x0;var _0x3d7ccc=_0xe71f[_0x570ff7];return _0x3d7ccc;};'use strict';var Sequelize=require(_0xfe71('0x0'));var _=require(_0xfe71('0x1'));var util=require(_0xfe71('0x2'));module[_0xfe71('0x3')]={'name':{'type':Sequelize[_0xfe71('0x4')],'unique':_0xfe71('0x5')},'description':{'type':Sequelize[_0xfe71('0x4')]},'formData':{'type':Sequelize[_0xfe71('0x6')]('long'),'set':function(_0x1360b3){if(_[_0xfe71('0x7')](_0x1360b3)){this[_0xfe71('0x8')]('formData',JSON['stringify'](_0x1360b3));}else if(_['isString'](_0x1360b3)){this[_0xfe71('0x8')]('formData',_0x1360b3);}else{this[_0xfe71('0x8')](_0xfe71('0x9'),util[_0xfe71('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this[_0xfe71('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfe71('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd714=['STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd714,0x8c));var _0x4d71=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xd714[_0x37ffea];return _0x2e2615;};'use strict';var Sequelize=require(_0x4d71('0x0'));var _=require(_0x4d71('0x1'));var util=require(_0x4d71('0x2'));module[_0x4d71('0x3')]={'name':{'type':Sequelize[_0x4d71('0x4')],'unique':_0x4d71('0x5')},'description':{'type':Sequelize[_0x4d71('0x4')]},'formData':{'type':Sequelize[_0x4d71('0x6')](_0x4d71('0x7')),'set':function(_0x475664){if(_[_0x4d71('0x8')](_0x475664)){this[_0x4d71('0x9')](_0x4d71('0xa'),JSON[_0x4d71('0xb')](_0x475664));}else if(_['isString'](_0x475664)){this['setDataValue'](_0x4d71('0xa'),_0x475664);}else{this[_0x4d71('0x9')](_0x4d71('0xa'),util['format'](_0x4d71('0xc'),this[_0x4d71('0xd')]('name')||'',this['getDataValue'](_0x4d71('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4d71('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e9302d5..d415f19 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 _0xa962=['Content-disposition','attachment;\x20filename=','Content-type','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','map','JscriptyProject','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','catch','params','create','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','nolimit','rows','JscriptyAnswerReport','order','ProjectId','findAll','number','fromCharCode','apply','indexOf','toString','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader'];(function(_0xda86e8,_0x4483f3){var _0x55769c=function(_0x73847c){while(--_0x73847c){_0xda86e8['push'](_0xda86e8['shift']());}};_0x55769c(++_0x4483f3);}(_0xa962,0xea));var _0x2a96=function(_0x4aa1b1,_0x56b523){_0x4aa1b1=_0x4aa1b1-0x0;var _0x1961c4=_0xa962[_0x4aa1b1];return _0x1961c4;};'use strict';var emlformat=require(_0x2a96('0x0'));var rimraf=require(_0x2a96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a96('0x2'));var rp=require(_0x2a96('0x3'));var moment=require(_0x2a96('0x4'));var BPromise=require(_0x2a96('0x5'));var Mustache=require('mustache');var util=require(_0x2a96('0x6'));var path=require(_0x2a96('0x7'));var sox=require(_0x2a96('0x8'));var csv=require('to-csv');var ejs=require(_0x2a96('0x9'));var fs=require('fs');var fs_extra=require(_0x2a96('0xa'));var _=require(_0x2a96('0xb'));var squel=require(_0x2a96('0xc'));var crypto=require(_0x2a96('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2a96('0xe'));var toCsv=require(_0x2a96('0xf'));var querystring=require(_0x2a96('0x10'));var Papa=require('papaparse');var Redis=require(_0x2a96('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2a96('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a96('0x13'))(_0x2a96('0x14'));var utils=require('../../config/utils');var config=require(_0x2a96('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a96('0x16'))['db'];function respondWithStatusCode(_0x5d5085,_0x10840e){_0x10840e=_0x10840e||0xcc;return function(_0x282f8b){if(_0x282f8b){return _0x5d5085[_0x2a96('0x17')](_0x10840e);}return _0x5d5085['status'](_0x10840e)['end']();};}function respondWithResult(_0x39a9a1,_0x5bca41){_0x5bca41=_0x5bca41||0xc8;return function(_0x40773c){if(_0x40773c){return _0x39a9a1[_0x2a96('0x18')](_0x5bca41)['json'](_0x40773c);}};}function respondWithFilteredResult(_0x53d180,_0x23997b){return function(_0x5da80e){if(_0x5da80e){var _0x224b1b=typeof _0x23997b[_0x2a96('0x19')]==='undefined'&&typeof _0x23997b[_0x2a96('0x1a')]===_0x2a96('0x1b');var _0x37113b=_0x5da80e[_0x2a96('0x1c')];var _0x452fee=_0x224b1b?0x0:_0x23997b['offset'];var _0x4e07c1=_0x224b1b?_0x5da80e[_0x2a96('0x1c')]:_0x23997b[_0x2a96('0x19')]+_0x23997b[_0x2a96('0x1a')];var _0x54d5d3;if(_0x4e07c1>=_0x37113b){_0x4e07c1=_0x37113b;_0x54d5d3=0xc8;}else{_0x54d5d3=0xce;}_0x53d180[_0x2a96('0x18')](_0x54d5d3);return _0x53d180[_0x2a96('0x1d')](_0x2a96('0x1e'),_0x452fee+'-'+_0x4e07c1+'/'+_0x37113b)[_0x2a96('0x1f')](_0x5da80e);}return null;};}function patchUpdates(_0x230d6b){return function(_0x1e40c7){try{jsonpatch['apply'](_0x1e40c7,_0x230d6b,!![]);}catch(_0x546fe0){return BPromise['reject'](_0x546fe0);}return _0x1e40c7[_0x2a96('0x20')]();};}function saveUpdates(_0x55661c,_0x1484e9){return function(_0x1d1c0c){if(_0x1d1c0c){return _0x1d1c0c[_0x2a96('0x21')](_0x55661c)[_0x2a96('0x22')](function(_0x50dc5b){return _0x50dc5b;});}return null;};}function removeEntity(_0x4b7cae,_0x2fd3db){return function(_0xa90d66){if(_0xa90d66){return _0xa90d66[_0x2a96('0x23')]()[_0x2a96('0x22')](function(){var _0x19e202=_0xa90d66[_0x2a96('0x24')]({'plain':!![]});var _0x559bda=_0x2a96('0x25');return db[_0x2a96('0x26')][_0x2a96('0x23')]({'where':{'type':_0x559bda,'resourceId':_0x19e202['id']}})[_0x2a96('0x22')](function(){return _0xa90d66;});})[_0x2a96('0x22')](function(){_0x4b7cae['status'](0xcc)[_0x2a96('0x27')]();});}};}function handleEntityNotFound(_0x12c322,_0x590407){return function(_0x54e8d4){if(!_0x54e8d4){_0x12c322[_0x2a96('0x17')](0x194);}return _0x54e8d4;};}function handleError(_0x4ebf17,_0x549674){_0x549674=_0x549674||0x1f4;return function(_0x4b4d00){logger[_0x2a96('0x28')](_0x4b4d00[_0x2a96('0x29')]);if(_0x4b4d00['name']){delete _0x4b4d00[_0x2a96('0x2a')];}_0x4ebf17[_0x2a96('0x18')](_0x549674)['send'](_0x4b4d00);};}exports['index']=function(_0x3a687a,_0x134f0c){var _0x23dbe0={},_0xb9c981={},_0x6248ba={'count':0x0,'rows':[]};var _0x4142c0=_[_0x2a96('0x2b')](db[_0x2a96('0x2c')]['rawAttributes'],function(_0x382f51){return{'name':_0x382f51['fieldName'],'type':_0x382f51[_0x2a96('0x2d')][_0x2a96('0x2e')]};});_0xb9c981[_0x2a96('0x2f')]=_[_0x2a96('0x2b')](_0x4142c0,_0x2a96('0x2a'));_0xb9c981[_0x2a96('0x30')]=_[_0x2a96('0x31')](_0x3a687a[_0x2a96('0x30')]);_0xb9c981[_0x2a96('0x32')]=_[_0x2a96('0x33')](_0xb9c981['model'],_0xb9c981['query']);_0x23dbe0[_0x2a96('0x34')]=_[_0x2a96('0x33')](_0xb9c981[_0x2a96('0x2f')],qs[_0x2a96('0x35')](_0x3a687a[_0x2a96('0x30')][_0x2a96('0x35')]));_0x23dbe0[_0x2a96('0x34')]=_0x23dbe0[_0x2a96('0x34')][_0x2a96('0x36')]?_0x23dbe0[_0x2a96('0x34')]:_0xb9c981[_0x2a96('0x2f')];if(!_0x3a687a[_0x2a96('0x30')][_0x2a96('0x37')]('nolimit')){_0x23dbe0['limit']=qs['limit'](_0x3a687a['query'][_0x2a96('0x1a')]);_0x23dbe0[_0x2a96('0x19')]=qs[_0x2a96('0x19')](_0x3a687a[_0x2a96('0x30')][_0x2a96('0x19')]);}_0x23dbe0['order']=qs[_0x2a96('0x38')](_0x3a687a['query'][_0x2a96('0x38')]);_0x23dbe0[_0x2a96('0x39')]=qs[_0x2a96('0x32')](_[_0x2a96('0x3a')](_0x3a687a[_0x2a96('0x30')],_0xb9c981[_0x2a96('0x32')]),_0x4142c0);if(_0x3a687a[_0x2a96('0x30')][_0x2a96('0x3b')]){_0x23dbe0[_0x2a96('0x39')]=_[_0x2a96('0x3c')](_0x23dbe0[_0x2a96('0x39')],{'$or':_[_0x2a96('0x2b')](_0x4142c0,function(_0x3c9d2a){if(_0x3c9d2a[_0x2a96('0x2d')]!=='VIRTUAL'){var _0x599d35={};_0x599d35[_0x3c9d2a[_0x2a96('0x2a')]]={'$like':'%'+_0x3a687a[_0x2a96('0x30')]['filter']+'%'};return _0x599d35;}})});}_0x23dbe0=_[_0x2a96('0x3c')]({},_0x23dbe0,_0x3a687a[_0x2a96('0x3d')]);var _0x4fcacc={'where':_0x23dbe0['where']};return db['JscriptyProject'][_0x2a96('0x1c')](_0x4fcacc)[_0x2a96('0x22')](function(_0x1121e5){_0x6248ba['count']=_0x1121e5;if(_0x3a687a['query'][_0x2a96('0x3e')]){_0x23dbe0[_0x2a96('0x3f')]=[{'all':!![]}];}return db[_0x2a96('0x2c')]['findAll'](_0x23dbe0);})['then'](function(_0x697cba){_0x6248ba['rows']=_0x697cba;return _0x6248ba;})[_0x2a96('0x22')](respondWithFilteredResult(_0x134f0c,_0x23dbe0))[_0x2a96('0x40')](handleError(_0x134f0c,null));};exports['show']=function(_0x444512,_0x1491ff){var _0xe207bb={'raw':![],'where':{'id':_0x444512[_0x2a96('0x41')]['id']}},_0xf3f6d2={};_0xf3f6d2[_0x2a96('0x2f')]=_[_0x2a96('0x31')](db[_0x2a96('0x2c')]['rawAttributes']);_0xf3f6d2[_0x2a96('0x30')]=_[_0x2a96('0x31')](_0x444512[_0x2a96('0x30')]);_0xf3f6d2[_0x2a96('0x32')]=_['intersection'](_0xf3f6d2['model'],_0xf3f6d2[_0x2a96('0x30')]);_0xe207bb[_0x2a96('0x34')]=_[_0x2a96('0x33')](_0xf3f6d2[_0x2a96('0x2f')],qs[_0x2a96('0x35')](_0x444512['query']['fields']));_0xe207bb[_0x2a96('0x34')]=_0xe207bb[_0x2a96('0x34')][_0x2a96('0x36')]?_0xe207bb['attributes']:_0xf3f6d2[_0x2a96('0x2f')];if(_0x444512[_0x2a96('0x30')]['includeAll']){_0xe207bb[_0x2a96('0x3f')]=[{'all':!![]}];}_0xe207bb=_[_0x2a96('0x3c')]({},_0xe207bb,_0x444512[_0x2a96('0x3d')]);return db[_0x2a96('0x2c')]['find'](_0xe207bb)['then'](handleEntityNotFound(_0x1491ff,null))[_0x2a96('0x22')](respondWithResult(_0x1491ff,null))[_0x2a96('0x40')](handleError(_0x1491ff,null));};exports[_0x2a96('0x42')]=function(_0x4da31a,_0x19bce9){return db['JscriptyProject'][_0x2a96('0x42')](_0x4da31a['body'],{})['then'](function(_0x1ef2cf){var _0x514586=_0x4da31a['user'][_0x2a96('0x24')]({'plain':!![]});if(!_0x514586)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x514586[_0x2a96('0x43')]===_0x2a96('0x44')){var _0x5a69fa=_0x1ef2cf['get']({'plain':!![]});var _0xed085='Projects';return db[_0x2a96('0x45')][_0x2a96('0x46')]({'where':{'name':_0xed085,'userProfileId':_0x514586['userProfileId']},'raw':!![]})['then'](function(_0x45861b){if(_0x45861b&&_0x45861b['autoAssociation']===0x0){return db['UserProfileResource'][_0x2a96('0x42')]({'name':_0x5a69fa[_0x2a96('0x2a')],'resourceId':_0x5a69fa['id'],'type':_0x45861b[_0x2a96('0x2a')],'sectionId':_0x45861b['id']},{})[_0x2a96('0x22')](function(){return _0x1ef2cf;});}else{return _0x1ef2cf;}})[_0x2a96('0x40')](function(_0x102d7){logger[_0x2a96('0x28')](_0x2a96('0x47'),_0x102d7);throw _0x102d7;});}return _0x1ef2cf;})[_0x2a96('0x22')](respondWithResult(_0x19bce9,0xc9))[_0x2a96('0x40')](handleError(_0x19bce9,null));};exports[_0x2a96('0x48')]=function(_0x22f024,_0x659d74){var _0x356e0d={'where':{'id':_0x22f024['params']['id']}},_0x5e93cc={};_0x5e93cc[_0x2a96('0x2f')]=_[_0x2a96('0x31')](db[_0x2a96('0x2c')][_0x2a96('0x49')]);_0x356e0d[_0x2a96('0x34')]=_[_0x2a96('0x33')](_0x5e93cc[_0x2a96('0x2f')],qs[_0x2a96('0x35')](_0x22f024['query'][_0x2a96('0x35')]));_0x356e0d[_0x2a96('0x34')]=_0x356e0d[_0x2a96('0x34')]['length']?_0x356e0d['attributes']:_0x5e93cc[_0x2a96('0x2f')];if(_0x22f024[_0x2a96('0x30')][_0x2a96('0x3e')]){_0x356e0d[_0x2a96('0x3f')]=[{'all':!![]}];}_0x356e0d=_[_0x2a96('0x3c')]({},_0x356e0d,_0x22f024['options']);return db['JscriptyProject'][_0x2a96('0x46')](_0x356e0d)[_0x2a96('0x22')](handleEntityNotFound(_0x659d74,null))[_0x2a96('0x22')](function(_0x3c6635){if(_0x3c6635){var _0x46c011=_0x3c6635['get']({'plain':!![]});_0x46c011=qs[_0x2a96('0x4a')](_0x46c011,['id',_0x2a96('0x4b'),_0x2a96('0x4c')]);_0x22f024[_0x2a96('0x4d')]=_[_0x2a96('0x4a')](_0x22f024[_0x2a96('0x4d')],['id','createdAt',_0x2a96('0x4c')]);return db[_0x2a96('0x2c')][_0x2a96('0x42')](_['merge'](_0x46c011,_0x22f024['body']),{'include':_0x22f024[_0x2a96('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x2a96('0x22')](function(_0x163da7){var _0x453f88=_0x22f024[_0x2a96('0x44')][_0x2a96('0x24')]({'plain':!![]});if(!_0x453f88)throw new Error(_0x2a96('0x4e'));if(_0x453f88['role']===_0x2a96('0x44')){var _0x2d67fe=_0x163da7[_0x2a96('0x24')]({'plain':!![]});var _0x131a5f=_0x2a96('0x25');return db[_0x2a96('0x45')][_0x2a96('0x46')]({'where':{'name':_0x131a5f,'userProfileId':_0x453f88['userProfileId']},'raw':!![]})['then'](function(_0x4184cc){if(_0x4184cc&&_0x4184cc['autoAssociation']===0x0){return db[_0x2a96('0x26')]['create']({'name':_0x2d67fe[_0x2a96('0x2a')],'resourceId':_0x2d67fe['id'],'type':_0x4184cc[_0x2a96('0x2a')],'sectionId':_0x4184cc['id']},{})['then'](function(){return _0x163da7;});}else{return _0x163da7;}})[_0x2a96('0x40')](function(_0x13178c){logger[_0x2a96('0x28')](_0x2a96('0x47'),_0x13178c);throw _0x13178c;});}return _0x163da7;});}})[_0x2a96('0x22')](respondWithResult(_0x659d74,0xc9))['catch'](handleError(_0x659d74,null));};exports[_0x2a96('0x21')]=function(_0x4ebcc6,_0x2f589b){if(_0x4ebcc6[_0x2a96('0x4d')]['id']){delete _0x4ebcc6['body']['id'];}return db['JscriptyProject'][_0x2a96('0x46')]({'where':{'id':_0x4ebcc6['params']['id']}})['then'](handleEntityNotFound(_0x2f589b,null))[_0x2a96('0x22')](saveUpdates(_0x4ebcc6[_0x2a96('0x4d')],null))['then'](respondWithResult(_0x2f589b,null))[_0x2a96('0x40')](handleError(_0x2f589b,null));};exports[_0x2a96('0x23')]=function(_0x1cd04d,_0x2a5d04){return db[_0x2a96('0x2c')]['find']({'where':{'id':_0x1cd04d['params']['id']}})[_0x2a96('0x22')](handleEntityNotFound(_0x2a5d04,null))['then'](removeEntity(_0x2a5d04,null))['catch'](handleError(_0x2a5d04,null));};exports[_0x2a96('0x4f')]=function(_0x1bbef5,_0x32d6d8,_0x44f27d){var _0x3fbb2b={'raw':!![],'where':{}};var _0x3eb74e={};var _0x306254={'count':0x0,'rows':[]};return db[_0x2a96('0x2c')][_0x2a96('0x50')]({'where':{'id':_0x1bbef5[_0x2a96('0x41')]['id']}})[_0x2a96('0x22')](handleEntityNotFound(_0x32d6d8,null))[_0x2a96('0x22')](function(_0x48bb5c){if(_0x48bb5c){_0x3eb74e[_0x2a96('0x2f')]=_[_0x2a96('0x31')](db[_0x2a96('0x51')]['rawAttributes']);_0x3eb74e[_0x2a96('0x30')]=_[_0x2a96('0x31')](_0x1bbef5['query']);_0x3eb74e[_0x2a96('0x32')]=_[_0x2a96('0x33')](_0x3eb74e[_0x2a96('0x2f')],_0x3eb74e[_0x2a96('0x30')]);_0x3fbb2b[_0x2a96('0x34')]=_['intersection'](_0x3eb74e[_0x2a96('0x2f')],qs[_0x2a96('0x35')](_0x1bbef5[_0x2a96('0x30')]['fields']));_0x3fbb2b[_0x2a96('0x34')]=_0x3fbb2b['attributes'][_0x2a96('0x36')]?_0x3fbb2b[_0x2a96('0x34')]:_0x3eb74e[_0x2a96('0x2f')];if(!_0x1bbef5[_0x2a96('0x30')]['hasOwnProperty'](_0x2a96('0x52'))){_0x3fbb2b[_0x2a96('0x1a')]=qs[_0x2a96('0x1a')](_0x1bbef5[_0x2a96('0x30')][_0x2a96('0x1a')]);_0x3fbb2b[_0x2a96('0x19')]=qs[_0x2a96('0x19')](_0x1bbef5[_0x2a96('0x30')]['offset']);}_0x3fbb2b['order']=qs[_0x2a96('0x38')](_0x1bbef5[_0x2a96('0x30')]['sort']);_0x3fbb2b[_0x2a96('0x39')]=qs['filters'](_['pick'](_0x1bbef5[_0x2a96('0x30')],_0x3eb74e[_0x2a96('0x32')]));_0x3fbb2b['where']['ProjectId']=_0x48bb5c['id'];if(_0x1bbef5[_0x2a96('0x30')]['filter']){_0x3fbb2b['where']=_['merge'](_0x3fbb2b[_0x2a96('0x39')],{'$or':_[_0x2a96('0x2b')](_0x3fbb2b[_0x2a96('0x34')],function(_0x51dd7c){var _0x93a1ce={};_0x93a1ce[_0x51dd7c]={'$like':'%'+_0x1bbef5['query']['filter']+'%'};return _0x93a1ce;})});}_0x3fbb2b=_[_0x2a96('0x3c')]({},_0x3fbb2b,_0x1bbef5[_0x2a96('0x3d')]);return db['JscriptySessionReport'][_0x2a96('0x1c')]({'where':_0x3fbb2b['where']})[_0x2a96('0x22')](function(_0x5334c6){_0x306254[_0x2a96('0x1c')]=_0x5334c6;if(_0x1bbef5[_0x2a96('0x30')][_0x2a96('0x3e')]){_0x3fbb2b[_0x2a96('0x3f')]=[{'all':!![]}];}return db[_0x2a96('0x51')]['findAll'](_0x3fbb2b);})[_0x2a96('0x22')](function(_0x2195b7){_0x306254[_0x2a96('0x53')]=_0x2195b7;return _0x306254;});}})[_0x2a96('0x22')](respondWithFilteredResult(_0x32d6d8,_0x3fbb2b))[_0x2a96('0x40')](handleError(_0x32d6d8,null));};exports['getAnswers']=function(_0x19b823,_0xbaad7,_0xf75bc2){var _0x15c6a6={'raw':!![],'where':{}};var _0xdd69b6={};var _0x139c54={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2a96('0x50')]({'where':{'id':_0x19b823[_0x2a96('0x41')]['id']}})['then'](handleEntityNotFound(_0xbaad7,null))[_0x2a96('0x22')](function(_0x513e05){if(_0x513e05){_0xdd69b6[_0x2a96('0x2f')]=_[_0x2a96('0x31')](db[_0x2a96('0x54')][_0x2a96('0x49')]);_0xdd69b6[_0x2a96('0x30')]=_[_0x2a96('0x31')](_0x19b823[_0x2a96('0x30')]);_0xdd69b6['filters']=_[_0x2a96('0x33')](_0xdd69b6[_0x2a96('0x2f')],_0xdd69b6[_0x2a96('0x30')]);_0x15c6a6[_0x2a96('0x34')]=_[_0x2a96('0x33')](_0xdd69b6['model'],qs[_0x2a96('0x35')](_0x19b823['query'][_0x2a96('0x35')]));_0x15c6a6[_0x2a96('0x34')]=_0x15c6a6[_0x2a96('0x34')][_0x2a96('0x36')]?_0x15c6a6[_0x2a96('0x34')]:_0xdd69b6['model'];if(!_0x19b823[_0x2a96('0x30')][_0x2a96('0x37')](_0x2a96('0x52'))){_0x15c6a6[_0x2a96('0x1a')]=qs['limit'](_0x19b823[_0x2a96('0x30')][_0x2a96('0x1a')]);_0x15c6a6[_0x2a96('0x19')]=qs[_0x2a96('0x19')](_0x19b823[_0x2a96('0x30')]['offset']);}_0x15c6a6[_0x2a96('0x55')]=qs['sort'](_0x19b823['query'][_0x2a96('0x38')]);_0x15c6a6[_0x2a96('0x39')]=qs[_0x2a96('0x32')](_[_0x2a96('0x3a')](_0x19b823[_0x2a96('0x30')],_0xdd69b6[_0x2a96('0x32')]));_0x15c6a6['where'][_0x2a96('0x56')]=_0x513e05['id'];if(_0x19b823[_0x2a96('0x30')][_0x2a96('0x3b')]){_0x15c6a6[_0x2a96('0x39')]=_['merge'](_0x15c6a6['where'],{'$or':_[_0x2a96('0x2b')](_0x15c6a6[_0x2a96('0x34')],function(_0x18320e){var _0x1b7c7d={};_0x1b7c7d[_0x18320e]={'$like':'%'+_0x19b823[_0x2a96('0x30')][_0x2a96('0x3b')]+'%'};return _0x1b7c7d;})});}_0x15c6a6=_['merge']({},_0x15c6a6,_0x19b823[_0x2a96('0x3d')]);return db[_0x2a96('0x54')][_0x2a96('0x1c')]({'where':_0x15c6a6[_0x2a96('0x39')]})[_0x2a96('0x22')](function(_0x1ff815){_0x139c54['count']=_0x1ff815;if(_0x19b823[_0x2a96('0x30')][_0x2a96('0x3e')]){_0x15c6a6[_0x2a96('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2a96('0x57')](_0x15c6a6);})['then'](function(_0xccdddd){_0x139c54[_0x2a96('0x53')]=_0xccdddd;return _0x139c54;});}})[_0x2a96('0x22')](respondWithFilteredResult(_0xbaad7,_0x15c6a6))[_0x2a96('0x40')](handleError(_0xbaad7,null));};function char(_0x40e459){return _0x2a96('0x58')===typeof _0x40e459?String[_0x2a96('0x59')][_0x2a96('0x5a')](null,arguments):_0x40e459;}function needsEncapsulation(_0x47e905){return!!_0x47e905&&(_0x47e905['toString']()[_0x2a96('0x5b')](char(0xd))>=0x0||_0x47e905[_0x2a96('0x5c')]()[_0x2a96('0x5b')](char(0xa))>=0x0||_0x47e905[_0x2a96('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x47e905[_0x2a96('0x5c')]()[_0x2a96('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x5146c3){var _0x48f9bb=char(0x22),_0x4e9223='\x5c'+char(0x22),_0x144f39=_0x5146c3[_0x2a96('0x5c')]()['replace'](new RegExp(_0x48f9bb,'g'),_0x4e9223);return _0x48f9bb+_0x144f39+_0x48f9bb;}exports[_0x2a96('0x5d')]=function(_0x328ebe,_0x399c9e,_0x44df49){var _0x42313d,_0x2ca36f;var _0x2a2f6c={'where':{'ProjectId':_0x328ebe[_0x2a96('0x41')]['id']}};if(_0x328ebe[_0x2a96('0x30')][_0x2a96('0x5e')]){_0x2a2f6c[_0x2a96('0x39')][_0x2a96('0x5f')]=JSON[_0x2a96('0x60')](_0x328ebe[_0x2a96('0x30')][_0x2a96('0x5e')]);}return db[_0x2a96('0x51')][_0x2a96('0x57')](_0x2a2f6c)['then'](handleEntityNotFound(_0x399c9e,null))[_0x2a96('0x22')](function(_0x36fb23){if(_0x36fb23){_0x42313d=_0x36fb23;return db[_0x2a96('0x61')]['findAll']({'where':{'SessionId':{'$in':_[_0x2a96('0x2b')](_0x42313d,'id')},'ProjectId':_0x328ebe[_0x2a96('0x41')]['id']},'order':_0x2a96('0x62')});}})[_0x2a96('0x22')](handleEntityNotFound(_0x399c9e,null))[_0x2a96('0x22')](function(_0xc09b92){if(_0xc09b92){_0x2ca36f=_0xc09b92;var _0x2d04fc={};for(var _0x4dd9d2=0x0,_0xd22dee=_0x2ca36f[_0x2a96('0x36')];_0x4dd9d2<_0xd22dee;_0x4dd9d2++){if(!_0x2d04fc['hasOwnProperty'](_0x2ca36f[_0x4dd9d2][_0x2a96('0x63')])){_0x2d04fc[_0x2ca36f[_0x4dd9d2][_0x2a96('0x63')]]=needsEncapsulation(_0x2ca36f[_0x4dd9d2][_0x2a96('0x64')])?encapsulate(_0x2ca36f[_0x4dd9d2][_0x2a96('0x64')]):_0x2ca36f[_0x4dd9d2][_0x2a96('0x64')];}}var _0x5a4b96=[],_0x25d93e={};for(var _0x1692a6=0x0,_0x105444=_0x42313d['length'];_0x1692a6<_0x105444;_0x1692a6++){_0x25d93e={'ProjectId':_0x328ebe[_0x2a96('0x41')]['id'],'SessionId':_0x42313d[_0x1692a6]['id'],'StartTime':moment(_0x42313d[_0x1692a6][_0x2a96('0x5f')])[_0x2a96('0x65')](_0x2a96('0x66'))};for(var _0x35baa1=0x0,_0x15ef50=_0x2ca36f['length'];_0x35baa1<_0x15ef50;_0x35baa1++){if(_0x2ca36f[_0x35baa1][_0x2a96('0x67')]==_0x42313d[_0x1692a6]['id']&&_0x2d04fc[_0x2a96('0x37')](_0x2ca36f[_0x35baa1][_0x2a96('0x63')])){_0x25d93e[_0x2d04fc[_0x2ca36f[_0x35baa1][_0x2a96('0x63')]]]=_0x2ca36f[_0x35baa1][_0x2a96('0x68')];}}for(var _0x1c63a3 in _0x2d04fc){if(!_0x25d93e[_0x2a96('0x37')](_0x2d04fc[_0x1c63a3])){_0x25d93e[_0x2d04fc[_0x1c63a3]]=null;}}_0x5a4b96[_0x2a96('0x69')](_0x25d93e);}return _0x5a4b96;}})[_0x2a96('0x22')](function(_0x562711){if(!_[_0x2a96('0x6a')](_0x562711)){var _0x3ae82d=toCsv(_0x562711);var _0x1ddc66=Date[_0x2a96('0x6b')]();fs[_0x2a96('0x6c')](util['format'](_0x2a96('0x6d'),_0x328ebe[_0x2a96('0x41')]['id'],_0x1ddc66),_0x3ae82d);_0x399c9e[_0x2a96('0x6e')](_0x2a96('0x6f'),_0x2a96('0x70')+util[_0x2a96('0x65')]('Jscripty_Project_%d_Summary_%s.csv',_0x328ebe[_0x2a96('0x41')]['id'],_0x1ddc66));_0x399c9e[_0x2a96('0x6e')](_0x2a96('0x71'),'text/csv');return _0x399c9e[_0x2a96('0x72')](util[_0x2a96('0x65')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x328ebe['params']['id'],_0x1ddc66));}else{return _0x399c9e[_0x2a96('0x17')](0xcc);}})[_0x2a96('0x40')](handleError(_0x399c9e,null));}; \ No newline at end of file +var _0xaebd=['indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','setHeader','Content-disposition','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Projects','destroy','stack','name','send','map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','userProfileId','UserProfileResource','params','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','findAll','number','toString'];(function(_0x4e6227,_0x5508e1){var _0x23b9bc=function(_0xe93b0d){while(--_0xe93b0d){_0x4e6227['push'](_0x4e6227['shift']());}};_0x23b9bc(++_0x5508e1);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1daa3f,_0x5c2d6a){_0x1daa3f=_0x1daa3f-0x0;var _0x389b67=_0xaebd[_0x1daa3f];return _0x389b67;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['JscriptyProject'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['clone']=function(_0x2260c5,_0x10287e){var _0x4dbcb5={'where':{'id':_0x2260c5['params']['id']}},_0x4faf72={};_0x4faf72[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x4dbcb5[_0xdaeb('0x33')]=_['intersection'](_0x4faf72[_0xdaeb('0x2f')],qs['fields'](_0x2260c5[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0x4dbcb5[_0xdaeb('0x33')]=_0x4dbcb5[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0x4dbcb5[_0xdaeb('0x33')]:_0x4faf72['model'];if(_0x2260c5['query'][_0xdaeb('0x3f')]){_0x4dbcb5['include']=[{'all':!![]}];}_0x4dbcb5=_[_0xdaeb('0x3d')]({},_0x4dbcb5,_0x2260c5[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')]['find'](_0x4dbcb5)[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](function(_0x2432ef){if(_0x2432ef){var _0x1b8729=_0x2432ef[_0xdaeb('0x24')]({'plain':!![]});_0x1b8729=qs[_0xdaeb('0x50')](_0x1b8729,['id',_0xdaeb('0x51'),_0xdaeb('0x52')]);_0x2260c5[_0xdaeb('0x49')]=_['omit'](_0x2260c5[_0xdaeb('0x49')],['id',_0xdaeb('0x51'),_0xdaeb('0x52')]);return db[_0xdaeb('0x2b')]['create'](_['merge'](_0x1b8729,_0x2260c5[_0xdaeb('0x49')]),{'include':_0x2260c5[_0xdaeb('0x30')][_0xdaeb('0x3f')]?[{'all':!![]}]:undefined})[_0xdaeb('0x23')](function(_0x4c734e){var _0x3147ec=_0x2260c5['user'][_0xdaeb('0x24')]({'plain':!![]});if(!_0x3147ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3147ec[_0xdaeb('0x53')]==='user'){var _0x240701=_0x4c734e[_0xdaeb('0x24')]({'plain':!![]});var _0x11d066=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x11d066,'userProfileId':_0x3147ec[_0xdaeb('0x54')]},'raw':!![]})[_0xdaeb('0x23')](function(_0x40aec7){if(_0x40aec7&&_0x40aec7[_0xdaeb('0x4d')]===0x0){return db[_0xdaeb('0x55')][_0xdaeb('0x48')]({'name':_0x240701['name'],'resourceId':_0x240701['id'],'type':_0x40aec7[_0xdaeb('0x28')],'sectionId':_0x40aec7['id']},{})[_0xdaeb('0x23')](function(){return _0x4c734e;});}else{return _0x4c734e;}})['catch'](function(_0x469781){logger['error'](_0xdaeb('0x4f'),_0x469781);throw _0x469781;});}return _0x4c734e;});}})[_0xdaeb('0x23')](respondWithResult(_0x10287e,0xc9))['catch'](handleError(_0x10287e,null));};exports[_0xdaeb('0x22')]=function(_0x3f86f4,_0x22981f){if(_0x3f86f4[_0xdaeb('0x49')]['id']){delete _0x3f86f4[_0xdaeb('0x49')]['id'];}return db[_0xdaeb('0x2b')]['find']({'where':{'id':_0x3f86f4[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x22981f,null))[_0xdaeb('0x23')](saveUpdates(_0x3f86f4[_0xdaeb('0x49')],null))[_0xdaeb('0x23')](respondWithResult(_0x22981f,null))[_0xdaeb('0x47')](handleError(_0x22981f,null));};exports[_0xdaeb('0x26')]=function(_0x4dc2d0,_0x333954){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x4dc2d0[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x333954,null))['then'](removeEntity(_0x333954,null))[_0xdaeb('0x47')](handleError(_0x333954,null));};exports[_0xdaeb('0x57')]=function(_0x29a06f,_0x2d4d57,_0x4e8b64){var _0xc0c7ad={'raw':!![],'where':{}};var _0x1e2e56={};var _0x3a7af9={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdaeb('0x58')]({'where':{'id':_0x29a06f[_0xdaeb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d4d57,null))[_0xdaeb('0x23')](function(_0x36a54e){if(_0x36a54e){_0x1e2e56[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db['JscriptySessionReport'][_0xdaeb('0x43')]);_0x1e2e56['query']=_[_0xdaeb('0x42')](_0x29a06f[_0xdaeb('0x30')]);_0x1e2e56[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x1e2e56[_0xdaeb('0x2f')],_0x1e2e56[_0xdaeb('0x30')]);_0xc0c7ad[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x1e2e56['model'],qs[_0xdaeb('0x34')](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0xc0c7ad[_0xdaeb('0x33')]=_0xc0c7ad[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xc0c7ad[_0xdaeb('0x33')]:_0x1e2e56[_0xdaeb('0x2f')];if(!_0x29a06f['query']['hasOwnProperty'](_0xdaeb('0x36'))){_0xc0c7ad[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0xc0c7ad[_0xdaeb('0x1b')]=qs['offset'](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0xc0c7ad[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x29a06f[_0xdaeb('0x30')]['sort']);_0xc0c7ad['where']=qs[_0xdaeb('0x31')](_[_0xdaeb('0x3a')](_0x29a06f[_0xdaeb('0x30')],_0x1e2e56['filters']));_0xc0c7ad[_0xdaeb('0x39')][_0xdaeb('0x59')]=_0x36a54e['id'];if(_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3b')]){_0xc0c7ad[_0xdaeb('0x39')]=_[_0xdaeb('0x3d')](_0xc0c7ad['where'],{'$or':_[_0xdaeb('0x2a')](_0xc0c7ad['attributes'],function(_0x3b41bb){var _0x34bbc2={};_0x34bbc2[_0x3b41bb]={'$like':'%'+_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x34bbc2;})});}_0xc0c7ad=_['merge']({},_0xc0c7ad,_0x29a06f[_0xdaeb('0x3e')]);return db[_0xdaeb('0x5a')][_0xdaeb('0x1a')]({'where':_0xc0c7ad['where']})[_0xdaeb('0x23')](function(_0x2ec82c){_0x3a7af9[_0xdaeb('0x1a')]=_0x2ec82c;if(_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xc0c7ad['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xc0c7ad);})[_0xdaeb('0x23')](function(_0x590319){_0x3a7af9[_0xdaeb('0x40')]=_0x590319;return _0x3a7af9;});}})[_0xdaeb('0x23')](respondWithFilteredResult(_0x2d4d57,_0xc0c7ad))['catch'](handleError(_0x2d4d57,null));};exports[_0xdaeb('0x5b')]=function(_0x5ebfb8,_0x2a2b73,_0x40e630){var _0x7420cc={'raw':!![],'where':{}};var _0x33c455={};var _0x3f0162={'count':0x0,'rows':[]};return db[_0xdaeb('0x2b')]['findOne']({'where':{'id':_0x5ebfb8[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x2a2b73,null))[_0xdaeb('0x23')](function(_0x52c908){if(_0x52c908){_0x33c455[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x5c')]['rawAttributes']);_0x33c455[_0xdaeb('0x30')]=_['keys'](_0x5ebfb8[_0xdaeb('0x30')]);_0x33c455[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x33c455[_0xdaeb('0x2f')],_0x33c455['query']);_0x7420cc['attributes']=_[_0xdaeb('0x32')](_0x33c455[_0xdaeb('0x2f')],qs['fields'](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0x7420cc[_0xdaeb('0x33')]=_0x7420cc[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0x7420cc[_0xdaeb('0x33')]:_0x33c455[_0xdaeb('0x2f')];if(!_0x5ebfb8[_0xdaeb('0x30')]['hasOwnProperty'](_0xdaeb('0x36'))){_0x7420cc[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x7420cc[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5ebfb8['query'][_0xdaeb('0x1b')]);}_0x7420cc[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x7420cc[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x5ebfb8[_0xdaeb('0x30')],_0x33c455['filters']));_0x7420cc['where'][_0xdaeb('0x59')]=_0x52c908['id'];if(_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3b')]){_0x7420cc['where']=_[_0xdaeb('0x3d')](_0x7420cc[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x7420cc[_0xdaeb('0x33')],function(_0x38171d){var _0x5774c1={};_0x5774c1[_0x38171d]={'$like':'%'+_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x5774c1;})});}_0x7420cc=_['merge']({},_0x7420cc,_0x5ebfb8[_0xdaeb('0x3e')]);return db[_0xdaeb('0x5c')]['count']({'where':_0x7420cc['where']})[_0xdaeb('0x23')](function(_0x1850a3){_0x3f0162[_0xdaeb('0x1a')]=_0x1850a3;if(_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0x7420cc[_0xdaeb('0x45')]=[{'all':!![]}];}return db[_0xdaeb('0x5c')][_0xdaeb('0x5d')](_0x7420cc);})[_0xdaeb('0x23')](function(_0x1c9ff7){_0x3f0162[_0xdaeb('0x40')]=_0x1c9ff7;return _0x3f0162;});}})[_0xdaeb('0x23')](respondWithFilteredResult(_0x2a2b73,_0x7420cc))['catch'](handleError(_0x2a2b73,null));};function char(_0x2d5152){return _0xdaeb('0x5e')===typeof _0x2d5152?String['fromCharCode']['apply'](null,arguments):_0x2d5152;}function needsEncapsulation(_0x332b3a){return!!_0x332b3a&&(_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0xd))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0x2c))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3c1237){var _0x5676d3=char(0x22),_0x52d225='\x5c'+char(0x22),_0x20cc70=_0x3c1237[_0xdaeb('0x5f')]()[_0xdaeb('0x61')](new RegExp(_0x5676d3,'g'),_0x52d225);return _0x5676d3+_0x20cc70+_0x5676d3;}exports[_0xdaeb('0x62')]=function(_0x2c56e2,_0x407c42,_0x440798){var _0x4a2a7d,_0x4ca39d;var _0x5f471c={'where':{'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id']}};if(_0x2c56e2['query'][_0xdaeb('0x63')]){_0x5f471c['where']['starttime']=JSON[_0xdaeb('0x64')](_0x2c56e2['query'][_0xdaeb('0x63')]);}return db[_0xdaeb('0x5a')][_0xdaeb('0x5d')](_0x5f471c)[_0xdaeb('0x23')](handleEntityNotFound(_0x407c42,null))[_0xdaeb('0x23')](function(_0x154187){if(_0x154187){_0x4a2a7d=_0x154187;return db[_0xdaeb('0x65')][_0xdaeb('0x5d')]({'where':{'SessionId':{'$in':_[_0xdaeb('0x2a')](_0x4a2a7d,'id')},'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id']},'order':_0xdaeb('0x66')});}})['then'](handleEntityNotFound(_0x407c42,null))[_0xdaeb('0x23')](function(_0x5cedea){if(_0x5cedea){_0x4ca39d=_0x5cedea;var _0x34ca2d={};for(var _0x5660c6=0x0,_0x5af1ef=_0x4ca39d[_0xdaeb('0x44')];_0x5660c6<_0x5af1ef;_0x5660c6++){if(!_0x34ca2d[_0xdaeb('0x35')](_0x4ca39d[_0x5660c6][_0xdaeb('0x67')])){_0x34ca2d[_0x4ca39d[_0x5660c6][_0xdaeb('0x67')]]=needsEncapsulation(_0x4ca39d[_0x5660c6][_0xdaeb('0x68')])?encapsulate(_0x4ca39d[_0x5660c6][_0xdaeb('0x68')]):_0x4ca39d[_0x5660c6][_0xdaeb('0x68')];}}var _0x393d47=[],_0x40c3c4={};for(var _0x264bc6=0x0,_0x2f8e60=_0x4a2a7d[_0xdaeb('0x44')];_0x264bc6<_0x2f8e60;_0x264bc6++){_0x40c3c4={'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id'],'SessionId':_0x4a2a7d[_0x264bc6]['id'],'StartTime':moment(_0x4a2a7d[_0x264bc6][_0xdaeb('0x69')])[_0xdaeb('0x6a')](_0xdaeb('0x6b'))};for(var _0x13b074=0x0,_0x1f8666=_0x4ca39d['length'];_0x13b074<_0x1f8666;_0x13b074++){if(_0x4ca39d[_0x13b074][_0xdaeb('0x6c')]==_0x4a2a7d[_0x264bc6]['id']&&_0x34ca2d[_0xdaeb('0x35')](_0x4ca39d[_0x13b074][_0xdaeb('0x67')])){_0x40c3c4[_0x34ca2d[_0x4ca39d[_0x13b074]['questionId']]]=_0x4ca39d[_0x13b074][_0xdaeb('0x6d')];}}for(var _0x504dc3 in _0x34ca2d){if(!_0x40c3c4[_0xdaeb('0x35')](_0x34ca2d[_0x504dc3])){_0x40c3c4[_0x34ca2d[_0x504dc3]]=null;}}_0x393d47['push'](_0x40c3c4);}return _0x393d47;}})[_0xdaeb('0x23')](function(_0x397580){if(!_['isEmpty'](_0x397580)){var _0x450e95=toCsv(_0x397580);var _0x4ce598=Date[_0xdaeb('0x6e')]();fs['writeFileSync'](util[_0xdaeb('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598),_0x450e95);_0x407c42[_0xdaeb('0x6f')](_0xdaeb('0x70'),'attachment;\x20filename='+util[_0xdaeb('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598));_0x407c42[_0xdaeb('0x6f')](_0xdaeb('0x71'),_0xdaeb('0x72'));return _0x407c42[_0xdaeb('0x73')](util['format'](_0xdaeb('0x74'),_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598));}else{return _0x407c42[_0xdaeb('0x15')](0xcc);}})['catch'](handleError(_0x407c42,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 6b7db8b..11cd1cf 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 _0x1f63=['JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x479624,_0x4a3ddf){var _0x326543=function(_0x1201c8){while(--_0x1201c8){_0x479624['push'](_0x479624['shift']());}};_0x326543(++_0x4a3ddf);}(_0x1f63,0x7a));var _0x31f6=function(_0x4d7ae3,_0x439226){_0x4d7ae3=_0x4d7ae3-0x0;var _0x21301f=_0x1f63[_0x4d7ae3];return _0x21301f;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var logger=require('../../config/logger')(_0x31f6('0x2'));var moment=require(_0x31f6('0x3'));var BPromise=require(_0x31f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31f6('0x5'));var rimraf=require(_0x31f6('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x31f6('0x7')]=function(_0x11250b,_0xe8437e){return _0x11250b['define'](_0x31f6('0x8'),attributes,{'tableName':_0x31f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf23b=['util','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','lodash'];(function(_0x4b1c78,_0x3ddc23){var _0x4c2d9b=function(_0xcdf308){while(--_0xcdf308){_0x4b1c78['push'](_0x4b1c78['shift']());}};_0x4c2d9b(++_0x3ddc23);}(_0xf23b,0x133));var _0xbf23=function(_0xedfb41,_0x4dc5a9){_0xedfb41=_0xedfb41-0x0;var _0x492adc=_0xf23b[_0xedfb41];return _0x492adc;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require(_0xbf23('0x2'))(_0xbf23('0x3'));var moment=require(_0xbf23('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf23('0x5'));var fs=require('fs');var path=require(_0xbf23('0x6'));var rimraf=require(_0xbf23('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf23('0x8'));module[_0xbf23('0x9')]=function(_0xc5e7dd,_0x393a52){return _0xc5e7dd[_0xbf23('0xa')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index c586187..5c11dba 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x14004a,_0x1fdf7d){var _0x248b37=function(_0x563d08){while(--_0x563d08){_0x14004a['push'](_0x14004a['shift']());}};_0x248b37(++_0x1fdf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x54d4b6,_0x347b17){_0x54d4b6=_0x54d4b6-0x0;var _0x10912f=_0x70e0[_0x54d4b6];return _0x10912f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x14f4f2,_0x1d36d7){var _0x6bc92b=function(_0x1bce2b){while(--_0x1bce2b){_0x14f4f2['push'](_0x14f4f2['shift']());}};_0x6bc92b(++_0x1d36d7);}(_0xe706,0xa3));var _0x6e70=function(_0x55555f,_0x505b88){_0x55555f=_0x55555f-0x0;var _0x208602=_0xe706[_0x55555f];return _0x208602;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 702bbcf..e10de96 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 _0xe706=['create','put','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x400b84,_0x26a7a4){var _0x3c82f5=function(_0x162936){while(--_0x162936){_0x400b84['push'](_0x400b84['shift']());}};_0x3c82f5(++_0x26a7a4);}(_0xe706,0x1d8));var _0x6e70=function(_0x311c92,_0x9166a3){_0x311c92=_0x311c92-0x0;var _0x2914d0=_0xe706[_0x311c92];return _0x2914d0;};'use strict';var multer=require('multer');var util=require(_0x6e70('0x0'));var path=require(_0x6e70('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x2'));var router=express[_0x6e70('0x3')]();var fs_extra=require(_0x6e70('0x4'));var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require('../../config/environment');var controller=require(_0x6e70('0x7'));router['get']('/',auth[_0x6e70('0x8')](),controller[_0x6e70('0x9')]);router[_0x6e70('0xa')]('/describe',auth[_0x6e70('0x8')](),controller[_0x6e70('0xb')]);router['get'](_0x6e70('0xc'),auth['isAuthenticated'](),controller[_0x6e70('0xd')]);router['post']('/',auth[_0x6e70('0x8')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xf')](_0x6e70('0xc'),auth[_0x6e70('0x8')](),controller[_0x6e70('0x10')]);router['delete'](_0x6e70('0xc'),auth[_0x6e70('0x8')](),controller['destroy']);module[_0x6e70('0x11')]=router; \ No newline at end of file +var _0xcafe=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcafe,0x18f));var _0xecaf=function(_0x1e139e,_0x33c78f){_0x1e139e=_0x1e139e-0x0;var _0x26e52e=_0xcafe[_0x1e139e];return _0x26e52e;};'use strict';var multer=require(_0xecaf('0x0'));var util=require('util');var path=require(_0xecaf('0x1'));var timeout=require(_0xecaf('0x2'));var express=require(_0xecaf('0x3'));var router=express['Router']();var fs_extra=require(_0xecaf('0x4'));var auth=require(_0xecaf('0x5'));var interaction=require(_0xecaf('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xecaf('0x7')]('/',auth[_0xecaf('0x8')](),controller[_0xecaf('0x9')]);router[_0xecaf('0x7')](_0xecaf('0xa'),auth['isAuthenticated'](),controller[_0xecaf('0xb')]);router['get'](_0xecaf('0xc'),auth['isAuthenticated'](),controller[_0xecaf('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xecaf('0xe')]);router[_0xecaf('0xf')](_0xecaf('0xc'),auth['isAuthenticated'](),controller[_0xecaf('0x10')]);router[_0xecaf('0x11')](_0xecaf('0xc'),auth[_0xecaf('0x8')](),controller[_0xecaf('0x12')]);module[_0xecaf('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 90c5a2e..092a4be 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x2d07bd,_0x1264e1){_0x2d07bd=_0x2d07bd-0x0;var _0x2a054b=_0x7a54[_0x2d07bd];return _0x2a054b;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9420,_0x3992df){_0x3a9420=_0x3a9420-0x0;var _0xaec894=_0x7a54[_0x3a9420];return _0xaec894;};'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 1479b62..1f01fc3 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 _0xcee8=['params','rawAttributes','fields','includeAll','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','sendStatus','name','index','JscriptyQuestionReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x5184fc,_0x114b95){var _0x1b52af=function(_0x21b1f2){while(--_0x21b1f2){_0x5184fc['push'](_0x5184fc['shift']());}};_0x1b52af(++_0x114b95);}(_0xcee8,0x9d));var _0x8cee=function(_0x316f8b,_0x3aa4d8){_0x316f8b=_0x316f8b-0x0;var _0x550407=_0xcee8[_0x316f8b];return _0x550407;};'use strict';var emlformat=require(_0x8cee('0x0'));var rimraf=require(_0x8cee('0x1'));var zipdir=require(_0x8cee('0x2'));var jsonpatch=require(_0x8cee('0x3'));var rp=require(_0x8cee('0x4'));var moment=require(_0x8cee('0x5'));var BPromise=require(_0x8cee('0x6'));var Mustache=require(_0x8cee('0x7'));var util=require('util');var path=require(_0x8cee('0x8'));var sox=require('sox');var csv=require(_0x8cee('0x9'));var ejs=require(_0x8cee('0xa'));var fs=require('fs');var fs_extra=require(_0x8cee('0xb'));var _=require('lodash');var squel=require(_0x8cee('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cee('0xd'));var deskjs=require(_0x8cee('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8cee('0xf'));var Papa=require(_0x8cee('0x10'));var Redis=require('ioredis');var authService=require(_0x8cee('0x11'));var qs=require(_0x8cee('0x12'));var as=require(_0x8cee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cee('0x14'))(_0x8cee('0x15'));var utils=require(_0x8cee('0x16'));var config=require(_0x8cee('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cee('0x18'))['db'];function respondWithStatusCode(_0x217204,_0xecc391){_0xecc391=_0xecc391||0xcc;return function(_0x9dfbf0){if(_0x9dfbf0){return _0x217204['sendStatus'](_0xecc391);}return _0x217204[_0x8cee('0x19')](_0xecc391)[_0x8cee('0x1a')]();};}function respondWithResult(_0x43bb07,_0x515cc4){_0x515cc4=_0x515cc4||0xc8;return function(_0xf1eb04){if(_0xf1eb04){return _0x43bb07[_0x8cee('0x19')](_0x515cc4)['json'](_0xf1eb04);}};}function respondWithFilteredResult(_0x574437,_0x35ad47){return function(_0x27d8d6){if(_0x27d8d6){var _0x58bb62=typeof _0x35ad47[_0x8cee('0x1b')]===_0x8cee('0x1c')&&typeof _0x35ad47[_0x8cee('0x1d')]===_0x8cee('0x1c');var _0x58f6f5=_0x27d8d6[_0x8cee('0x1e')];var _0x50d39e=_0x58bb62?0x0:_0x35ad47[_0x8cee('0x1b')];var _0x7e5fd0=_0x58bb62?_0x27d8d6[_0x8cee('0x1e')]:_0x35ad47[_0x8cee('0x1b')]+_0x35ad47[_0x8cee('0x1d')];var _0x37ed6a;if(_0x7e5fd0>=_0x58f6f5){_0x7e5fd0=_0x58f6f5;_0x37ed6a=0xc8;}else{_0x37ed6a=0xce;}_0x574437['status'](_0x37ed6a);return _0x574437['set']('Content-Range',_0x50d39e+'-'+_0x7e5fd0+'/'+_0x58f6f5)[_0x8cee('0x1f')](_0x27d8d6);}return null;};}function patchUpdates(_0x2fd233){return function(_0x2c6b02){try{jsonpatch[_0x8cee('0x20')](_0x2c6b02,_0x2fd233,!![]);}catch(_0x13cc8d){return BPromise[_0x8cee('0x21')](_0x13cc8d);}return _0x2c6b02[_0x8cee('0x22')]();};}function saveUpdates(_0x2daa37,_0x1fb72c){return function(_0x822c59){if(_0x822c59){return _0x822c59[_0x8cee('0x23')](_0x2daa37)[_0x8cee('0x24')](function(_0x101d1d){return _0x101d1d;});}return null;};}function removeEntity(_0x3b5c6f,_0x23ea32){return function(_0x32e925){if(_0x32e925){return _0x32e925['destroy']()[_0x8cee('0x24')](function(){_0x3b5c6f[_0x8cee('0x19')](0xcc)[_0x8cee('0x1a')]();});}};}function handleEntityNotFound(_0x3c210c,_0x240133){return function(_0x46a4fb){if(!_0x46a4fb){_0x3c210c[_0x8cee('0x25')](0x194);}return _0x46a4fb;};}function handleError(_0x56932b,_0xd9ec0e){_0xd9ec0e=_0xd9ec0e||0x1f4;return function(_0x536989){logger['error'](_0x536989['stack']);if(_0x536989[_0x8cee('0x26')]){delete _0x536989[_0x8cee('0x26')];}_0x56932b['status'](_0xd9ec0e)['send'](_0x536989);};}exports[_0x8cee('0x27')]=function(_0x291cd8,_0x2e9c06){var _0xe545b0={},_0x5e5c9c={},_0x2b6500={'count':0x0,'rows':[]};var _0xb78fe1=_['map'](db[_0x8cee('0x28')]['rawAttributes'],function(_0x248325){return{'name':_0x248325[_0x8cee('0x29')],'type':_0x248325[_0x8cee('0x2a')][_0x8cee('0x2b')]};});_0x5e5c9c['model']=_['map'](_0xb78fe1,_0x8cee('0x26'));_0x5e5c9c['query']=_[_0x8cee('0x2c')](_0x291cd8[_0x8cee('0x2d')]);_0x5e5c9c[_0x8cee('0x2e')]=_[_0x8cee('0x2f')](_0x5e5c9c[_0x8cee('0x30')],_0x5e5c9c[_0x8cee('0x2d')]);_0xe545b0[_0x8cee('0x31')]=_['intersection'](_0x5e5c9c[_0x8cee('0x30')],qs['fields'](_0x291cd8[_0x8cee('0x2d')]['fields']));_0xe545b0['attributes']=_0xe545b0[_0x8cee('0x31')][_0x8cee('0x32')]?_0xe545b0[_0x8cee('0x31')]:_0x5e5c9c['model'];if(!_0x291cd8[_0x8cee('0x2d')]['hasOwnProperty'](_0x8cee('0x33'))){_0xe545b0[_0x8cee('0x1d')]=qs[_0x8cee('0x1d')](_0x291cd8['query'][_0x8cee('0x1d')]);_0xe545b0[_0x8cee('0x1b')]=qs['offset'](_0x291cd8['query'][_0x8cee('0x1b')]);}_0xe545b0[_0x8cee('0x34')]=qs['sort'](_0x291cd8[_0x8cee('0x2d')][_0x8cee('0x35')]);_0xe545b0['where']=qs['filters'](_['pick'](_0x291cd8[_0x8cee('0x2d')],_0x5e5c9c[_0x8cee('0x2e')]),_0xb78fe1);if(_0x291cd8[_0x8cee('0x2d')][_0x8cee('0x36')]){_0xe545b0[_0x8cee('0x37')]=_[_0x8cee('0x38')](_0xe545b0[_0x8cee('0x37')],{'$or':_[_0x8cee('0x39')](_0xb78fe1,function(_0x3ec80b){if(_0x3ec80b['type']!==_0x8cee('0x3a')){var _0x1f33c8={};_0x1f33c8[_0x3ec80b[_0x8cee('0x26')]]={'$like':'%'+_0x291cd8['query']['filter']+'%'};return _0x1f33c8;}})});}_0xe545b0=_[_0x8cee('0x38')]({},_0xe545b0,_0x291cd8[_0x8cee('0x3b')]);var _0x58a36a={'where':_0xe545b0['where']};return db['JscriptyQuestionReport'][_0x8cee('0x1e')](_0x58a36a)[_0x8cee('0x24')](function(_0x5ca789){_0x2b6500[_0x8cee('0x1e')]=_0x5ca789;if(_0x291cd8[_0x8cee('0x2d')]['includeAll']){_0xe545b0[_0x8cee('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8cee('0x3d')](_0xe545b0);})['then'](function(_0x5d8ebb){_0x2b6500[_0x8cee('0x3e')]=_0x5d8ebb;return _0x2b6500;})[_0x8cee('0x24')](respondWithFilteredResult(_0x2e9c06,_0xe545b0))[_0x8cee('0x3f')](handleError(_0x2e9c06,null));};exports[_0x8cee('0x40')]=function(_0x242355,_0x57c194){var _0x1e813b={'raw':!![],'where':{'id':_0x242355[_0x8cee('0x41')]['id']}},_0x510cfa={};_0x510cfa['model']=_[_0x8cee('0x2c')](db['JscriptyQuestionReport'][_0x8cee('0x42')]);_0x510cfa[_0x8cee('0x2d')]=_['keys'](_0x242355[_0x8cee('0x2d')]);_0x510cfa[_0x8cee('0x2e')]=_[_0x8cee('0x2f')](_0x510cfa[_0x8cee('0x30')],_0x510cfa[_0x8cee('0x2d')]);_0x1e813b[_0x8cee('0x31')]=_[_0x8cee('0x2f')](_0x510cfa[_0x8cee('0x30')],qs[_0x8cee('0x43')](_0x242355[_0x8cee('0x2d')][_0x8cee('0x43')]));_0x1e813b[_0x8cee('0x31')]=_0x1e813b[_0x8cee('0x31')]['length']?_0x1e813b['attributes']:_0x510cfa[_0x8cee('0x30')];if(_0x242355[_0x8cee('0x2d')][_0x8cee('0x44')]){_0x1e813b['include']=[{'all':!![]}];}_0x1e813b=_[_0x8cee('0x38')]({},_0x1e813b,_0x242355[_0x8cee('0x3b')]);return db['JscriptyQuestionReport']['find'](_0x1e813b)[_0x8cee('0x24')](handleEntityNotFound(_0x57c194,null))[_0x8cee('0x24')](respondWithResult(_0x57c194,null))[_0x8cee('0x3f')](handleError(_0x57c194,null));};exports[_0x8cee('0x45')]=function(_0x56498f,_0x514e02){return db['JscriptyQuestionReport']['create'](_0x56498f[_0x8cee('0x46')],{})[_0x8cee('0x24')](respondWithResult(_0x514e02,0xc9))[_0x8cee('0x3f')](handleError(_0x514e02,null));};exports[_0x8cee('0x23')]=function(_0x4c658d,_0x2a24a1){if(_0x4c658d[_0x8cee('0x46')]['id']){delete _0x4c658d[_0x8cee('0x46')]['id'];}return db[_0x8cee('0x28')]['find']({'where':{'id':_0x4c658d[_0x8cee('0x41')]['id']}})[_0x8cee('0x24')](handleEntityNotFound(_0x2a24a1,null))[_0x8cee('0x24')](saveUpdates(_0x4c658d['body'],null))['then'](respondWithResult(_0x2a24a1,null))[_0x8cee('0x3f')](handleError(_0x2a24a1,null));};exports[_0x8cee('0x47')]=function(_0x26362a,_0x3c7e87){return db[_0x8cee('0x28')][_0x8cee('0x48')]({'where':{'id':_0x26362a[_0x8cee('0x41')]['id']}})[_0x8cee('0x24')](handleEntityNotFound(_0x3c7e87,null))['then'](removeEntity(_0x3c7e87,null))[_0x8cee('0x3f')](handleError(_0x3c7e87,null));};exports[_0x8cee('0x49')]=function(_0x411361,_0x20e0f7){return db[_0x8cee('0x28')]['describe']()['then'](respondWithResult(_0x20e0f7,null))[_0x8cee('0x3f')](handleError(_0x20e0f7,null));}; \ No newline at end of file +var _0xd58e=['limit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','end','sendStatus','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','length','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd58e,0xa6));var _0xed58=function(_0x354493,_0x56433a){_0x354493=_0x354493-0x0;var _0x1cddca=_0xd58e[_0x354493];return _0x1cddca;};'use strict';var emlformat=require(_0xed58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed58('0x1'));var jsonpatch=require(_0xed58('0x2'));var rp=require(_0xed58('0x3'));var moment=require(_0xed58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed58('0x5'));var util=require(_0xed58('0x6'));var path=require(_0xed58('0x7'));var sox=require('sox');var csv=require(_0xed58('0x8'));var ejs=require(_0xed58('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed58('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed58('0xb'));var deskjs=require(_0xed58('0xc'));var toCsv=require(_0xed58('0x8'));var querystring=require(_0xed58('0xd'));var Papa=require(_0xed58('0xe'));var Redis=require(_0xed58('0xf'));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(_0xed58('0x10'))(_0xed58('0x11'));var utils=require('../../config/utils');var config=require(_0xed58('0x12'));var licenseUtil=require(_0xed58('0x13'));var db=require(_0xed58('0x14'))['db'];function respondWithStatusCode(_0x505240,_0x406036){_0x406036=_0x406036||0xcc;return function(_0x43e397){if(_0x43e397){return _0x505240['sendStatus'](_0x406036);}return _0x505240['status'](_0x406036)['end']();};}function respondWithResult(_0x3d19ac,_0x3f44b2){_0x3f44b2=_0x3f44b2||0xc8;return function(_0x4f0165){if(_0x4f0165){return _0x3d19ac[_0xed58('0x15')](_0x3f44b2)[_0xed58('0x16')](_0x4f0165);}};}function respondWithFilteredResult(_0x4544ed,_0x1c8431){return function(_0x22ab46){if(_0x22ab46){var _0x2e63a8=typeof _0x1c8431[_0xed58('0x17')]===_0xed58('0x18')&&typeof _0x1c8431['limit']===_0xed58('0x18');var _0x71cefc=_0x22ab46[_0xed58('0x19')];var _0x4e2d6b=_0x2e63a8?0x0:_0x1c8431[_0xed58('0x17')];var _0x5ccd86=_0x2e63a8?_0x22ab46[_0xed58('0x19')]:_0x1c8431[_0xed58('0x17')]+_0x1c8431['limit'];var _0x5309a2;if(_0x5ccd86>=_0x71cefc){_0x5ccd86=_0x71cefc;_0x5309a2=0xc8;}else{_0x5309a2=0xce;}_0x4544ed[_0xed58('0x15')](_0x5309a2);return _0x4544ed[_0xed58('0x1a')](_0xed58('0x1b'),_0x4e2d6b+'-'+_0x5ccd86+'/'+_0x71cefc)[_0xed58('0x16')](_0x22ab46);}return null;};}function patchUpdates(_0x43d1b5){return function(_0x25e4d7){try{jsonpatch['apply'](_0x25e4d7,_0x43d1b5,!![]);}catch(_0x5304fd){return BPromise[_0xed58('0x1c')](_0x5304fd);}return _0x25e4d7[_0xed58('0x1d')]();};}function saveUpdates(_0x2119e6,_0x222721){return function(_0x2f56e9){if(_0x2f56e9){return _0x2f56e9[_0xed58('0x1e')](_0x2119e6)[_0xed58('0x1f')](function(_0x492cec){return _0x492cec;});}return null;};}function removeEntity(_0x295d07,_0x3815c5){return function(_0x589530){if(_0x589530){return _0x589530['destroy']()[_0xed58('0x1f')](function(){_0x295d07[_0xed58('0x15')](0xcc)[_0xed58('0x20')]();});}};}function handleEntityNotFound(_0x12a916,_0x3b96d3){return function(_0x5a4447){if(!_0x5a4447){_0x12a916[_0xed58('0x21')](0x194);}return _0x5a4447;};}function handleError(_0x463cdf,_0xebcdbd){_0xebcdbd=_0xebcdbd||0x1f4;return function(_0x6abd8){logger[_0xed58('0x22')](_0x6abd8['stack']);if(_0x6abd8['name']){delete _0x6abd8[_0xed58('0x23')];}_0x463cdf[_0xed58('0x15')](_0xebcdbd)['send'](_0x6abd8);};}exports[_0xed58('0x24')]=function(_0x5eabe8,_0xbce9bd){var _0xe04075={},_0x2310b6={},_0x2809b3={'count':0x0,'rows':[]};var _0x240f7b=_[_0xed58('0x25')](db[_0xed58('0x26')][_0xed58('0x27')],function(_0x501c77){return{'name':_0x501c77[_0xed58('0x28')],'type':_0x501c77[_0xed58('0x29')][_0xed58('0x2a')]};});_0x2310b6['model']=_[_0xed58('0x25')](_0x240f7b,_0xed58('0x23'));_0x2310b6[_0xed58('0x2b')]=_[_0xed58('0x2c')](_0x5eabe8[_0xed58('0x2b')]);_0x2310b6['filters']=_['intersection'](_0x2310b6['model'],_0x2310b6[_0xed58('0x2b')]);_0xe04075[_0xed58('0x2d')]=_[_0xed58('0x2e')](_0x2310b6[_0xed58('0x2f')],qs['fields'](_0x5eabe8[_0xed58('0x2b')]['fields']));_0xe04075[_0xed58('0x2d')]=_0xe04075[_0xed58('0x2d')][_0xed58('0x30')]?_0xe04075[_0xed58('0x2d')]:_0x2310b6[_0xed58('0x2f')];if(!_0x5eabe8['query'][_0xed58('0x31')]('nolimit')){_0xe04075[_0xed58('0x32')]=qs[_0xed58('0x32')](_0x5eabe8['query']['limit']);_0xe04075[_0xed58('0x17')]=qs[_0xed58('0x17')](_0x5eabe8[_0xed58('0x2b')][_0xed58('0x17')]);}_0xe04075[_0xed58('0x33')]=qs['sort'](_0x5eabe8['query']['sort']);_0xe04075[_0xed58('0x34')]=qs[_0xed58('0x35')](_[_0xed58('0x36')](_0x5eabe8[_0xed58('0x2b')],_0x2310b6['filters']),_0x240f7b);if(_0x5eabe8[_0xed58('0x2b')][_0xed58('0x37')]){_0xe04075[_0xed58('0x34')]=_[_0xed58('0x38')](_0xe04075['where'],{'$or':_[_0xed58('0x25')](_0x240f7b,function(_0x1bd63c){if(_0x1bd63c[_0xed58('0x29')]!==_0xed58('0x39')){var _0x16f377={};_0x16f377[_0x1bd63c['name']]={'$like':'%'+_0x5eabe8['query'][_0xed58('0x37')]+'%'};return _0x16f377;}})});}_0xe04075=_['merge']({},_0xe04075,_0x5eabe8['options']);var _0x5bdbb6={'where':_0xe04075[_0xed58('0x34')]};return db[_0xed58('0x26')][_0xed58('0x19')](_0x5bdbb6)['then'](function(_0x1d04ba){_0x2809b3[_0xed58('0x19')]=_0x1d04ba;if(_0x5eabe8[_0xed58('0x2b')][_0xed58('0x3a')]){_0xe04075[_0xed58('0x3b')]=[{'all':!![]}];}return db[_0xed58('0x26')][_0xed58('0x3c')](_0xe04075);})[_0xed58('0x1f')](function(_0x50f65c){_0x2809b3[_0xed58('0x3d')]=_0x50f65c;return _0x2809b3;})[_0xed58('0x1f')](respondWithFilteredResult(_0xbce9bd,_0xe04075))[_0xed58('0x3e')](handleError(_0xbce9bd,null));};exports[_0xed58('0x3f')]=function(_0x3c8945,_0x356f3f){var _0x5df95f={'raw':!![],'where':{'id':_0x3c8945[_0xed58('0x40')]['id']}},_0x3abcbe={};_0x3abcbe[_0xed58('0x2f')]=_[_0xed58('0x2c')](db[_0xed58('0x26')]['rawAttributes']);_0x3abcbe[_0xed58('0x2b')]=_[_0xed58('0x2c')](_0x3c8945[_0xed58('0x2b')]);_0x3abcbe[_0xed58('0x35')]=_[_0xed58('0x2e')](_0x3abcbe['model'],_0x3abcbe[_0xed58('0x2b')]);_0x5df95f[_0xed58('0x2d')]=_[_0xed58('0x2e')](_0x3abcbe[_0xed58('0x2f')],qs[_0xed58('0x41')](_0x3c8945[_0xed58('0x2b')][_0xed58('0x41')]));_0x5df95f[_0xed58('0x2d')]=_0x5df95f[_0xed58('0x2d')][_0xed58('0x30')]?_0x5df95f[_0xed58('0x2d')]:_0x3abcbe[_0xed58('0x2f')];if(_0x3c8945[_0xed58('0x2b')][_0xed58('0x3a')]){_0x5df95f[_0xed58('0x3b')]=[{'all':!![]}];}_0x5df95f=_['merge']({},_0x5df95f,_0x3c8945[_0xed58('0x42')]);return db[_0xed58('0x26')]['find'](_0x5df95f)[_0xed58('0x1f')](handleEntityNotFound(_0x356f3f,null))[_0xed58('0x1f')](respondWithResult(_0x356f3f,null))['catch'](handleError(_0x356f3f,null));};exports[_0xed58('0x43')]=function(_0x46f4d8,_0x1e09c3){return db[_0xed58('0x26')][_0xed58('0x43')](_0x46f4d8[_0xed58('0x44')],{})[_0xed58('0x1f')](respondWithResult(_0x1e09c3,0xc9))[_0xed58('0x3e')](handleError(_0x1e09c3,null));};exports['update']=function(_0x5251c8,_0x5dd4aa){if(_0x5251c8[_0xed58('0x44')]['id']){delete _0x5251c8['body']['id'];}return db[_0xed58('0x26')]['find']({'where':{'id':_0x5251c8[_0xed58('0x40')]['id']}})[_0xed58('0x1f')](handleEntityNotFound(_0x5dd4aa,null))[_0xed58('0x1f')](saveUpdates(_0x5251c8[_0xed58('0x44')],null))[_0xed58('0x1f')](respondWithResult(_0x5dd4aa,null))['catch'](handleError(_0x5dd4aa,null));};exports[_0xed58('0x45')]=function(_0x2b396a,_0x46d79b){return db[_0xed58('0x26')][_0xed58('0x46')]({'where':{'id':_0x2b396a[_0xed58('0x40')]['id']}})[_0xed58('0x1f')](handleEntityNotFound(_0x46d79b,null))['then'](removeEntity(_0x46d79b,null))[_0xed58('0x3e')](handleError(_0x46d79b,null));};exports[_0xed58('0x47')]=function(_0x49339a,_0xa0fb21){return db[_0xed58('0x26')][_0xed58('0x47')]()[_0xed58('0x1f')](respondWithResult(_0xa0fb21,null))[_0xed58('0x3e')](handleError(_0xa0fb21,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 84b2822..4e65a53 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 _0x2f22=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions'];(function(_0xa48e2c,_0x43321d){var _0x176077=function(_0x44332a){while(--_0x44332a){_0xa48e2c['push'](_0xa48e2c['shift']());}};_0x176077(++_0x43321d);}(_0x2f22,0x181));var _0x22f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f22[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x22f2('0x0'));var util=require(_0x22f2('0x1'));var logger=require(_0x22f2('0x2'))(_0x22f2('0x3'));var moment=require(_0x22f2('0x4'));var BPromise=require(_0x22f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x22f2('0x6'));var config=require('../../config/environment');var attributes=require(_0x22f2('0x7'));module[_0x22f2('0x8')]=function(_0x2464a6,_0x33ad46){return _0x2464a6[_0x22f2('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x22f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5d3=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','bluebird','path'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xe5d3,0x16d));var _0x3e5d=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xe5d3[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require(_0x3e5d('0x0'));var util=require('util');var logger=require(_0x3e5d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e5d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e5d('0x3'));var rimraf=require('rimraf');var config=require(_0x3e5d('0x4'));var attributes=require(_0x3e5d('0x5'));module[_0x3e5d('0x6')]=function(_0x3dffe5,_0x9bddbb){return _0x3dffe5['define'](_0x3e5d('0x7'),attributes,{'tableName':_0x3e5d('0x8'),'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 ce5544a..a750e61 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 _0xace8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xace8,0x1e9));var _0x8ace=function(_0x45a7d2,_0x50a34){_0x45a7d2=_0x45a7d2-0x0;var _0x3311d7=_0xace8[_0x45a7d2];return _0x3311d7;};'use strict';var _=require('lodash');var util=require(_0x8ace('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ace('0x1'));var fs=require('fs');var Redis=require(_0x8ace('0x2'));var db=require(_0x8ace('0x3'))['db'];var utils=require(_0x8ace('0x4'));var logger=require(_0x8ace('0x5'))(_0x8ace('0x6'));var config=require(_0x8ace('0x7'));var jayson=require(_0x8ace('0x8'));var client=jayson[_0x8ace('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a7a4,_0xcca34,_0x443bb7){return new BPromise(function(_0x2f8e25,_0x49127f){return client['request'](_0x17a7a4,_0x443bb7)['then'](function(_0x470cf6){logger[_0x8ace('0xa')](_0x8ace('0xb'),_0xcca34,_0x8ace('0xc'));logger['debug'](_0x8ace('0xd'),_0xcca34,'request\x20sent',JSON[_0x8ace('0xe')](_0x470cf6));if(_0x470cf6[_0x8ace('0xf')]){if(_0x470cf6[_0x8ace('0xf')][_0x8ace('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0xcca34,_0x470cf6['error'][_0x8ace('0x11')]);return _0x49127f(_0x470cf6['error'][_0x8ace('0x11')]);}logger[_0x8ace('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xcca34,_0x470cf6[_0x8ace('0xf')][_0x8ace('0x11')]);return _0x2f8e25(_0x470cf6['error'][_0x8ace('0x11')]);}else{logger[_0x8ace('0xa')](_0x8ace('0xb'),_0xcca34,_0x8ace('0xc'));_0x2f8e25(_0x470cf6['result']['message']);}})[_0x8ace('0x12')](function(_0x3fe5a9){logger[_0x8ace('0xf')](_0x8ace('0xb'),_0xcca34,_0x3fe5a9);_0x49127f(_0x3fe5a9);});});} \ No newline at end of file +var _0x47cd=['message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x47cd,0xfb));var _0xd47c=function(_0x3a5c14,_0x1faee8){_0x3a5c14=_0x3a5c14-0x0;var _0x261413=_0x47cd[_0x3a5c14];return _0x261413;};'use strict';var _=require(_0xd47c('0x0'));var util=require('util');var moment=require(_0xd47c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd47c('0x2'));var db=require(_0xd47c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd47c('0x4'))('rpc');var config=require(_0xd47c('0x5'));var jayson=require(_0xd47c('0x6'));var client=jayson[_0xd47c('0x7')][_0xd47c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fd6b4,_0x40cb3c,_0x31a500){return new BPromise(function(_0x401e76,_0x85101){return client[_0xd47c('0x9')](_0x3fd6b4,_0x31a500)['then'](function(_0x5cf84f){logger['info'](_0xd47c('0xa'),_0x40cb3c,_0xd47c('0xb'));logger[_0xd47c('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x40cb3c,_0xd47c('0xb'),JSON[_0xd47c('0xd')](_0x5cf84f));if(_0x5cf84f['error']){if(_0x5cf84f[_0xd47c('0xe')]['code']===0x1f4){logger[_0xd47c('0xe')](_0xd47c('0xa'),_0x40cb3c,_0x5cf84f[_0xd47c('0xe')][_0xd47c('0xf')]);return _0x85101(_0x5cf84f['error'][_0xd47c('0xf')]);}logger[_0xd47c('0xe')](_0xd47c('0xa'),_0x40cb3c,_0x5cf84f['error'][_0xd47c('0xf')]);return _0x401e76(_0x5cf84f[_0xd47c('0xe')][_0xd47c('0xf')]);}else{logger[_0xd47c('0x10')](_0xd47c('0xa'),_0x40cb3c,_0xd47c('0xb'));_0x401e76(_0x5cf84f[_0xd47c('0x11')][_0xd47c('0xf')]);}})[_0xd47c('0x12')](function(_0x3ef6a8){logger['error'](_0xd47c('0xa'),_0x40cb3c,_0x3ef6a8);_0x85101(_0x3ef6a8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 502551f..acdba25 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 _0xd5ba=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xd5ba,0x156));var _0xad5b=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xd5ba[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require(_0xad5b('0x0'));var path=require(_0xad5b('0x1'));var timeout=require(_0xad5b('0x2'));var express=require(_0xad5b('0x3'));var router=express['Router']();var fs_extra=require(_0xad5b('0x4'));var auth=require(_0xad5b('0x5'));var interaction=require(_0xad5b('0x6'));var config=require(_0xad5b('0x7'));var controller=require(_0xad5b('0x8'));router[_0xad5b('0x9')]('/',auth[_0xad5b('0xa')](),controller[_0xad5b('0xb')]);router[_0xad5b('0x9')](_0xad5b('0xc'),auth[_0xad5b('0xa')](),controller[_0xad5b('0xd')]);router[_0xad5b('0x9')](_0xad5b('0xe'),auth[_0xad5b('0xa')](),controller[_0xad5b('0xf')]);router[_0xad5b('0x9')](_0xad5b('0x10'),auth[_0xad5b('0xa')](),controller[_0xad5b('0x11')]);router['post']('/',auth[_0xad5b('0xa')](),controller[_0xad5b('0x12')]);router[_0xad5b('0x13')](_0xad5b('0xe'),auth[_0xad5b('0xa')](),controller[_0xad5b('0x14')]);router['delete'](_0xad5b('0xe'),auth[_0xad5b('0xa')](),controller[_0xad5b('0x15')]);module[_0xad5b('0x16')]=router; \ No newline at end of file +var _0x3ff6=['destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x3ff6,0x141));var _0x63ff=function(_0x321aa9,_0x581408){_0x321aa9=_0x321aa9-0x0;var _0x4c80cc=_0x3ff6[_0x321aa9];return _0x4c80cc;};'use strict';var multer=require(_0x63ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x63ff('0x1'));var express=require(_0x63ff('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x63ff('0x3'));var interaction=require(_0x63ff('0x4'));var config=require(_0x63ff('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0x63ff('0x6')]('/',auth[_0x63ff('0x7')](),controller[_0x63ff('0x8')]);router[_0x63ff('0x6')](_0x63ff('0x9'),auth[_0x63ff('0x7')](),controller[_0x63ff('0xa')]);router[_0x63ff('0x6')](_0x63ff('0xb'),auth['isAuthenticated'](),controller[_0x63ff('0xc')]);router[_0x63ff('0x6')](_0x63ff('0xd'),auth[_0x63ff('0x7')](),controller[_0x63ff('0xe')]);router[_0x63ff('0xf')]('/',auth['isAuthenticated'](),controller[_0x63ff('0x10')]);router['put']('/:id',auth[_0x63ff('0x7')](),controller[_0x63ff('0x11')]);router[_0x63ff('0x12')](_0x63ff('0xb'),auth[_0x63ff('0x7')](),controller[_0x63ff('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 435aa2d..dd3a1a5 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 _0x0bbb=['BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','DATE','STRING'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0bbb,0xd3));var _0xb0bb=function(_0x31c020,_0x55d9fd){_0x31c020=_0x31c020-0x0;var _0x4f2aba=_0x0bbb[_0x31c020];return _0x4f2aba;};'use strict';var moment=require(_0xb0bb('0x0'));var Sequelize=require(_0xb0bb('0x1'));module[_0xb0bb('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x18bfc5){this[_0xb0bb('0x3')](_0xb0bb('0x4'),_0x18bfc5);this['setDataValue'](_0xb0bb('0x5'),moment()[_0xb0bb('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xb0bb('0x7')]},'membername':{'type':Sequelize[_0xb0bb('0x8')]},'projectname':{'type':Sequelize[_0xb0bb('0x8')]},'queue':{'type':Sequelize[_0xb0bb('0x8')]},'uniqueid':{'type':Sequelize[_0xb0bb('0x8')]},'calleridname':{'type':Sequelize[_0xb0bb('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xb0bb('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x657b=['setDataValue','STRING','moment','sequelize','exports','DATE'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x657b,0x98));var _0xb657=function(_0x3286e9,_0x48f107){_0x3286e9=_0x3286e9-0x0;var _0x5bb3b0=_0x657b[_0x3286e9];return _0x5bb3b0;};'use strict';var moment=require(_0xb657('0x0'));var Sequelize=require(_0xb657('0x1'));module[_0xb657('0x2')]={'starttime':{'type':Sequelize[_0xb657('0x3')],'set':function(_0x2483bf){this[_0xb657('0x4')]('starttime',_0x2483bf);this['setDataValue']('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb657('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb657('0x5')]},'uniqueid':{'type':Sequelize[_0xb657('0x5')]},'calleridname':{'type':Sequelize[_0xb657('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 59bf5c3..ce7a5ea 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 _0x4d3d=['save','update','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','then','include','findAll','show','params','includeAll','options','find','catch','create','body','destroy','describe','getQuestions','JscriptyQuestionReport','rows','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x7f3dc6,_0x58a027){var _0x2e6e5b=function(_0x5459f6){while(--_0x5459f6){_0x7f3dc6['push'](_0x7f3dc6['shift']());}};_0x2e6e5b(++_0x58a027);}(_0x4d3d,0xca));var _0xd4d3=function(_0x2fbb0d,_0xc91b8a){_0x2fbb0d=_0x2fbb0d-0x0;var _0x131c96=_0x4d3d[_0x2fbb0d];return _0x131c96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4d3('0x0'));var zipdir=require(_0xd4d3('0x1'));var jsonpatch=require(_0xd4d3('0x2'));var rp=require(_0xd4d3('0x3'));var moment=require(_0xd4d3('0x4'));var BPromise=require(_0xd4d3('0x5'));var Mustache=require(_0xd4d3('0x6'));var util=require(_0xd4d3('0x7'));var path=require(_0xd4d3('0x8'));var sox=require(_0xd4d3('0x9'));var csv=require(_0xd4d3('0xa'));var ejs=require(_0xd4d3('0xb'));var fs=require('fs');var fs_extra=require(_0xd4d3('0xc'));var _=require(_0xd4d3('0xd'));var squel=require(_0xd4d3('0xe'));var crypto=require(_0xd4d3('0xf'));var jsforce=require(_0xd4d3('0x10'));var deskjs=require(_0xd4d3('0x11'));var toCsv=require(_0xd4d3('0xa'));var querystring=require('querystring');var Papa=require(_0xd4d3('0x12'));var Redis=require(_0xd4d3('0x13'));var authService=require(_0xd4d3('0x14'));var qs=require(_0xd4d3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4d3('0x16'));var logger=require(_0xd4d3('0x17'))('api');var utils=require(_0xd4d3('0x18'));var config=require(_0xd4d3('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8715dd,_0x5271f6){_0x5271f6=_0x5271f6||0xcc;return function(_0x54ea9f){if(_0x54ea9f){return _0x8715dd['sendStatus'](_0x5271f6);}return _0x8715dd[_0xd4d3('0x1a')](_0x5271f6)[_0xd4d3('0x1b')]();};}function respondWithResult(_0x277d06,_0x4f67e5){_0x4f67e5=_0x4f67e5||0xc8;return function(_0x329a61){if(_0x329a61){return _0x277d06['status'](_0x4f67e5)[_0xd4d3('0x1c')](_0x329a61);}};}function respondWithFilteredResult(_0x157db8,_0x4b0059){return function(_0x2b3e9f){if(_0x2b3e9f){var _0x3f7673=typeof _0x4b0059[_0xd4d3('0x1d')]===_0xd4d3('0x1e')&&typeof _0x4b0059[_0xd4d3('0x1f')]===_0xd4d3('0x1e');var _0x1d79c1=_0x2b3e9f[_0xd4d3('0x20')];var _0x1dd39d=_0x3f7673?0x0:_0x4b0059[_0xd4d3('0x1d')];var _0xec84be=_0x3f7673?_0x2b3e9f[_0xd4d3('0x20')]:_0x4b0059[_0xd4d3('0x1d')]+_0x4b0059['limit'];var _0x20cb61;if(_0xec84be>=_0x1d79c1){_0xec84be=_0x1d79c1;_0x20cb61=0xc8;}else{_0x20cb61=0xce;}_0x157db8[_0xd4d3('0x1a')](_0x20cb61);return _0x157db8['set'](_0xd4d3('0x21'),_0x1dd39d+'-'+_0xec84be+'/'+_0x1d79c1)[_0xd4d3('0x1c')](_0x2b3e9f);}return null;};}function patchUpdates(_0x33d4b8){return function(_0x2f5ca1){try{jsonpatch[_0xd4d3('0x22')](_0x2f5ca1,_0x33d4b8,!![]);}catch(_0x51fba1){return BPromise['reject'](_0x51fba1);}return _0x2f5ca1[_0xd4d3('0x23')]();};}function saveUpdates(_0x485e72,_0x16fbc6){return function(_0x2b7399){if(_0x2b7399){return _0x2b7399[_0xd4d3('0x24')](_0x485e72)['then'](function(_0x21dc41){return _0x21dc41;});}return null;};}function removeEntity(_0x37e3ea,_0x510030){return function(_0x47c38e){if(_0x47c38e){return _0x47c38e['destroy']()['then'](function(){_0x37e3ea[_0xd4d3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddcfb,_0xef4771){return function(_0x1098ce){if(!_0x1098ce){_0x1ddcfb[_0xd4d3('0x25')](0x194);}return _0x1098ce;};}function handleError(_0x3724cd,_0x4b6602){_0x4b6602=_0x4b6602||0x1f4;return function(_0x10acc4){logger[_0xd4d3('0x26')](_0x10acc4[_0xd4d3('0x27')]);if(_0x10acc4[_0xd4d3('0x28')]){delete _0x10acc4[_0xd4d3('0x28')];}_0x3724cd['status'](_0x4b6602)[_0xd4d3('0x29')](_0x10acc4);};}exports[_0xd4d3('0x2a')]=function(_0x2e02ea,_0xb71c78){var _0x38147f={},_0x45a889={},_0x13e927={'count':0x0,'rows':[]};var _0x221955=_[_0xd4d3('0x2b')](db[_0xd4d3('0x2c')][_0xd4d3('0x2d')],function(_0x3a068c){return{'name':_0x3a068c[_0xd4d3('0x2e')],'type':_0x3a068c['type']['key']};});_0x45a889[_0xd4d3('0x2f')]=_[_0xd4d3('0x2b')](_0x221955,'name');_0x45a889[_0xd4d3('0x30')]=_[_0xd4d3('0x31')](_0x2e02ea[_0xd4d3('0x30')]);_0x45a889[_0xd4d3('0x32')]=_['intersection'](_0x45a889[_0xd4d3('0x2f')],_0x45a889['query']);_0x38147f[_0xd4d3('0x33')]=_[_0xd4d3('0x34')](_0x45a889[_0xd4d3('0x2f')],qs[_0xd4d3('0x35')](_0x2e02ea[_0xd4d3('0x30')]['fields']));_0x38147f[_0xd4d3('0x33')]=_0x38147f[_0xd4d3('0x33')][_0xd4d3('0x36')]?_0x38147f['attributes']:_0x45a889[_0xd4d3('0x2f')];if(!_0x2e02ea[_0xd4d3('0x30')][_0xd4d3('0x37')]('nolimit')){_0x38147f[_0xd4d3('0x1f')]=qs[_0xd4d3('0x1f')](_0x2e02ea[_0xd4d3('0x30')][_0xd4d3('0x1f')]);_0x38147f[_0xd4d3('0x1d')]=qs[_0xd4d3('0x1d')](_0x2e02ea[_0xd4d3('0x30')][_0xd4d3('0x1d')]);}_0x38147f[_0xd4d3('0x38')]=qs[_0xd4d3('0x39')](_0x2e02ea[_0xd4d3('0x30')][_0xd4d3('0x39')]);_0x38147f['where']=qs['filters'](_[_0xd4d3('0x3a')](_0x2e02ea[_0xd4d3('0x30')],_0x45a889['filters']),_0x221955);if(_0x2e02ea['query'][_0xd4d3('0x3b')]){_0x38147f['where']=_[_0xd4d3('0x3c')](_0x38147f[_0xd4d3('0x3d')],{'$or':_[_0xd4d3('0x2b')](_0x221955,function(_0xf12135){if(_0xf12135[_0xd4d3('0x3e')]!=='VIRTUAL'){var _0x473e1d={};_0x473e1d[_0xf12135[_0xd4d3('0x28')]]={'$like':'%'+_0x2e02ea[_0xd4d3('0x30')][_0xd4d3('0x3b')]+'%'};return _0x473e1d;}})});}_0x38147f=_[_0xd4d3('0x3c')]({},_0x38147f,_0x2e02ea['options']);var _0x110406={'where':_0x38147f[_0xd4d3('0x3d')]};return db[_0xd4d3('0x2c')][_0xd4d3('0x20')](_0x110406)[_0xd4d3('0x3f')](function(_0x4b86ec){_0x13e927[_0xd4d3('0x20')]=_0x4b86ec;if(_0x2e02ea[_0xd4d3('0x30')]['includeAll']){_0x38147f[_0xd4d3('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd4d3('0x41')](_0x38147f);})[_0xd4d3('0x3f')](function(_0x34e59b){_0x13e927['rows']=_0x34e59b;return _0x13e927;})[_0xd4d3('0x3f')](respondWithFilteredResult(_0xb71c78,_0x38147f))['catch'](handleError(_0xb71c78,null));};exports[_0xd4d3('0x42')]=function(_0x56c635,_0xb0f77d){var _0x5e504c={'raw':!![],'where':{'id':_0x56c635[_0xd4d3('0x43')]['id']}},_0x366de4={};_0x366de4[_0xd4d3('0x2f')]=_[_0xd4d3('0x31')](db[_0xd4d3('0x2c')][_0xd4d3('0x2d')]);_0x366de4['query']=_[_0xd4d3('0x31')](_0x56c635[_0xd4d3('0x30')]);_0x366de4[_0xd4d3('0x32')]=_['intersection'](_0x366de4[_0xd4d3('0x2f')],_0x366de4[_0xd4d3('0x30')]);_0x5e504c[_0xd4d3('0x33')]=_[_0xd4d3('0x34')](_0x366de4[_0xd4d3('0x2f')],qs['fields'](_0x56c635['query'][_0xd4d3('0x35')]));_0x5e504c[_0xd4d3('0x33')]=_0x5e504c[_0xd4d3('0x33')][_0xd4d3('0x36')]?_0x5e504c[_0xd4d3('0x33')]:_0x366de4[_0xd4d3('0x2f')];if(_0x56c635['query'][_0xd4d3('0x44')]){_0x5e504c[_0xd4d3('0x40')]=[{'all':!![]}];}_0x5e504c=_[_0xd4d3('0x3c')]({},_0x5e504c,_0x56c635[_0xd4d3('0x45')]);return db['JscriptySessionReport'][_0xd4d3('0x46')](_0x5e504c)['then'](handleEntityNotFound(_0xb0f77d,null))[_0xd4d3('0x3f')](respondWithResult(_0xb0f77d,null))[_0xd4d3('0x47')](handleError(_0xb0f77d,null));};exports['create']=function(_0x35ace5,_0x25a7ce){return db[_0xd4d3('0x2c')][_0xd4d3('0x48')](_0x35ace5[_0xd4d3('0x49')],{})['then'](respondWithResult(_0x25a7ce,0xc9))[_0xd4d3('0x47')](handleError(_0x25a7ce,null));};exports['update']=function(_0x5ea1ce,_0x4df5aa){if(_0x5ea1ce['body']['id']){delete _0x5ea1ce['body']['id'];}return db[_0xd4d3('0x2c')][_0xd4d3('0x46')]({'where':{'id':_0x5ea1ce[_0xd4d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x4df5aa,null))['then'](saveUpdates(_0x5ea1ce['body'],null))[_0xd4d3('0x3f')](respondWithResult(_0x4df5aa,null))[_0xd4d3('0x47')](handleError(_0x4df5aa,null));};exports[_0xd4d3('0x4a')]=function(_0x50118b,_0x3f914c){return db[_0xd4d3('0x2c')][_0xd4d3('0x46')]({'where':{'id':_0x50118b['params']['id']}})[_0xd4d3('0x3f')](handleEntityNotFound(_0x3f914c,null))[_0xd4d3('0x3f')](removeEntity(_0x3f914c,null))[_0xd4d3('0x47')](handleError(_0x3f914c,null));};exports[_0xd4d3('0x4b')]=function(_0x7aabec,_0x1a8cbb){return db['JscriptySessionReport'][_0xd4d3('0x4b')]()[_0xd4d3('0x3f')](respondWithResult(_0x1a8cbb,null))[_0xd4d3('0x47')](handleError(_0x1a8cbb,null));};exports[_0xd4d3('0x4c')]=function(_0x3b552a,_0x9fc13c,_0x29d1b9){var _0x53aa52={'raw':!![],'where':{}};var _0x5d13d9={};var _0x397737={'count':0x0,'rows':[]};return db[_0xd4d3('0x2c')]['findOne']({'where':{'id':_0x3b552a[_0xd4d3('0x43')]['id']}})['then'](handleEntityNotFound(_0x9fc13c,null))['then'](function(_0x4314e6){if(_0x4314e6){_0x5d13d9[_0xd4d3('0x2f')]=_[_0xd4d3('0x31')](db[_0xd4d3('0x4d')][_0xd4d3('0x2d')]);_0x5d13d9[_0xd4d3('0x30')]=_[_0xd4d3('0x31')](_0x3b552a[_0xd4d3('0x30')]);_0x5d13d9[_0xd4d3('0x32')]=_[_0xd4d3('0x34')](_0x5d13d9[_0xd4d3('0x2f')],_0x5d13d9['query']);_0x53aa52[_0xd4d3('0x33')]=_[_0xd4d3('0x34')](_0x5d13d9[_0xd4d3('0x2f')],qs[_0xd4d3('0x35')](_0x3b552a[_0xd4d3('0x30')][_0xd4d3('0x35')]));_0x53aa52['attributes']=_0x53aa52[_0xd4d3('0x33')][_0xd4d3('0x36')]?_0x53aa52[_0xd4d3('0x33')]:_0x5d13d9[_0xd4d3('0x2f')];if(!_0x3b552a[_0xd4d3('0x30')]['hasOwnProperty']('nolimit')){_0x53aa52[_0xd4d3('0x1f')]=qs[_0xd4d3('0x1f')](_0x3b552a['query'][_0xd4d3('0x1f')]);_0x53aa52[_0xd4d3('0x1d')]=qs[_0xd4d3('0x1d')](_0x3b552a[_0xd4d3('0x30')]['offset']);}_0x53aa52['order']=qs[_0xd4d3('0x39')](_0x3b552a[_0xd4d3('0x30')][_0xd4d3('0x39')]);_0x53aa52[_0xd4d3('0x3d')]=qs[_0xd4d3('0x32')](_[_0xd4d3('0x3a')](_0x3b552a[_0xd4d3('0x30')],_0x5d13d9['filters']));_0x53aa52[_0xd4d3('0x3d')]['SessionId']=_0x4314e6['id'];if(_0x3b552a[_0xd4d3('0x30')][_0xd4d3('0x3b')]){_0x53aa52[_0xd4d3('0x3d')]=_['merge'](_0x53aa52['where'],{'$or':_[_0xd4d3('0x2b')](_0x53aa52[_0xd4d3('0x33')],function(_0x4bcaee){var _0xe0d11={};_0xe0d11[_0x4bcaee]={'$like':'%'+_0x3b552a[_0xd4d3('0x30')][_0xd4d3('0x3b')]+'%'};return _0xe0d11;})});}_0x53aa52=_[_0xd4d3('0x3c')]({},_0x53aa52,_0x3b552a[_0xd4d3('0x45')]);return db[_0xd4d3('0x4d')][_0xd4d3('0x20')]({'where':_0x53aa52[_0xd4d3('0x3d')]})['then'](function(_0x541bb2){_0x397737[_0xd4d3('0x20')]=_0x541bb2;if(_0x3b552a[_0xd4d3('0x30')]['includeAll']){_0x53aa52['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd4d3('0x41')](_0x53aa52);})['then'](function(_0x13f419){_0x397737[_0xd4d3('0x4e')]=_0x13f419;return _0x397737;});}})['then'](respondWithFilteredResult(_0x9fc13c,_0x53aa52))[_0xd4d3('0x47')](handleError(_0x9fc13c,null));}; \ No newline at end of file +var _0x92a5=['pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','length','include','options','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','fieldName','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x92a5,0xbe));var _0x592a=function(_0x22da61,_0x237ba9){_0x22da61=_0x22da61-0x0;var _0x40b728=_0x92a5[_0x22da61];return _0x40b728;};'use strict';var emlformat=require(_0x592a('0x0'));var rimraf=require(_0x592a('0x1'));var zipdir=require(_0x592a('0x2'));var jsonpatch=require(_0x592a('0x3'));var rp=require(_0x592a('0x4'));var moment=require(_0x592a('0x5'));var BPromise=require(_0x592a('0x6'));var Mustache=require(_0x592a('0x7'));var util=require(_0x592a('0x8'));var path=require(_0x592a('0x9'));var sox=require('sox');var csv=require(_0x592a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x592a('0xb'));var jsforce=require(_0x592a('0xc'));var deskjs=require(_0x592a('0xd'));var toCsv=require(_0x592a('0xa'));var querystring=require(_0x592a('0xe'));var Papa=require(_0x592a('0xf'));var Redis=require(_0x592a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x592a('0x11'));var as=require(_0x592a('0x12'));var hardwareService=require(_0x592a('0x13'));var logger=require(_0x592a('0x14'))('api');var utils=require(_0x592a('0x15'));var config=require(_0x592a('0x16'));var licenseUtil=require(_0x592a('0x17'));var db=require(_0x592a('0x18'))['db'];function respondWithStatusCode(_0x433f49,_0x17a737){_0x17a737=_0x17a737||0xcc;return function(_0x329f78){if(_0x329f78){return _0x433f49[_0x592a('0x19')](_0x17a737);}return _0x433f49[_0x592a('0x1a')](_0x17a737)[_0x592a('0x1b')]();};}function respondWithResult(_0x2b1a92,_0xe92af6){_0xe92af6=_0xe92af6||0xc8;return function(_0x47a3f0){if(_0x47a3f0){return _0x2b1a92[_0x592a('0x1a')](_0xe92af6)[_0x592a('0x1c')](_0x47a3f0);}};}function respondWithFilteredResult(_0x1fc168,_0x30cc21){return function(_0x3554e8){if(_0x3554e8){var _0x56de7b=typeof _0x30cc21['offset']==='undefined'&&typeof _0x30cc21[_0x592a('0x1d')]==='undefined';var _0x1a4e39=_0x3554e8[_0x592a('0x1e')];var _0x17e648=_0x56de7b?0x0:_0x30cc21[_0x592a('0x1f')];var _0x8db931=_0x56de7b?_0x3554e8[_0x592a('0x1e')]:_0x30cc21['offset']+_0x30cc21[_0x592a('0x1d')];var _0x2350ce;if(_0x8db931>=_0x1a4e39){_0x8db931=_0x1a4e39;_0x2350ce=0xc8;}else{_0x2350ce=0xce;}_0x1fc168[_0x592a('0x1a')](_0x2350ce);return _0x1fc168[_0x592a('0x20')](_0x592a('0x21'),_0x17e648+'-'+_0x8db931+'/'+_0x1a4e39)['json'](_0x3554e8);}return null;};}function patchUpdates(_0x182778){return function(_0x26b067){try{jsonpatch[_0x592a('0x22')](_0x26b067,_0x182778,!![]);}catch(_0x15d99a){return BPromise[_0x592a('0x23')](_0x15d99a);}return _0x26b067[_0x592a('0x24')]();};}function saveUpdates(_0x414c03,_0x331b2c){return function(_0x330620){if(_0x330620){return _0x330620['update'](_0x414c03)[_0x592a('0x25')](function(_0x1bfb14){return _0x1bfb14;});}return null;};}function removeEntity(_0x2d3ae1,_0x45b6d3){return function(_0x529706){if(_0x529706){return _0x529706[_0x592a('0x26')]()[_0x592a('0x25')](function(){_0x2d3ae1['status'](0xcc)[_0x592a('0x1b')]();});}};}function handleEntityNotFound(_0x2c3622,_0x58b990){return function(_0x4d9621){if(!_0x4d9621){_0x2c3622[_0x592a('0x19')](0x194);}return _0x4d9621;};}function handleError(_0x1c164d,_0x5e4da3){_0x5e4da3=_0x5e4da3||0x1f4;return function(_0x5995da){logger[_0x592a('0x27')](_0x5995da[_0x592a('0x28')]);if(_0x5995da['name']){delete _0x5995da[_0x592a('0x29')];}_0x1c164d['status'](_0x5e4da3)[_0x592a('0x2a')](_0x5995da);};}exports[_0x592a('0x2b')]=function(_0x3a8dc2,_0x5eb5d5){var _0x2af815={},_0x563670={},_0x4621d9={'count':0x0,'rows':[]};var _0x5835f8=_[_0x592a('0x2c')](db[_0x592a('0x2d')]['rawAttributes'],function(_0x3b0374){return{'name':_0x3b0374[_0x592a('0x2e')],'type':_0x3b0374['type']['key']};});_0x563670[_0x592a('0x2f')]=_['map'](_0x5835f8,'name');_0x563670['query']=_[_0x592a('0x30')](_0x3a8dc2['query']);_0x563670[_0x592a('0x31')]=_[_0x592a('0x32')](_0x563670[_0x592a('0x2f')],_0x563670[_0x592a('0x33')]);_0x2af815['attributes']=_[_0x592a('0x32')](_0x563670[_0x592a('0x2f')],qs[_0x592a('0x34')](_0x3a8dc2[_0x592a('0x33')]['fields']));_0x2af815[_0x592a('0x35')]=_0x2af815['attributes']['length']?_0x2af815[_0x592a('0x35')]:_0x563670[_0x592a('0x2f')];if(!_0x3a8dc2[_0x592a('0x33')][_0x592a('0x36')](_0x592a('0x37'))){_0x2af815[_0x592a('0x1d')]=qs['limit'](_0x3a8dc2[_0x592a('0x33')][_0x592a('0x1d')]);_0x2af815['offset']=qs[_0x592a('0x1f')](_0x3a8dc2[_0x592a('0x33')][_0x592a('0x1f')]);}_0x2af815[_0x592a('0x38')]=qs['sort'](_0x3a8dc2[_0x592a('0x33')][_0x592a('0x39')]);_0x2af815[_0x592a('0x3a')]=qs[_0x592a('0x31')](_[_0x592a('0x3b')](_0x3a8dc2[_0x592a('0x33')],_0x563670[_0x592a('0x31')]),_0x5835f8);if(_0x3a8dc2[_0x592a('0x33')][_0x592a('0x3c')]){_0x2af815[_0x592a('0x3a')]=_[_0x592a('0x3d')](_0x2af815[_0x592a('0x3a')],{'$or':_[_0x592a('0x2c')](_0x5835f8,function(_0x55d20f){if(_0x55d20f[_0x592a('0x3e')]!==_0x592a('0x3f')){var _0x5aee59={};_0x5aee59[_0x55d20f[_0x592a('0x29')]]={'$like':'%'+_0x3a8dc2[_0x592a('0x33')]['filter']+'%'};return _0x5aee59;}})});}_0x2af815=_['merge']({},_0x2af815,_0x3a8dc2['options']);var _0x44622a={'where':_0x2af815[_0x592a('0x3a')]};return db[_0x592a('0x2d')][_0x592a('0x1e')](_0x44622a)['then'](function(_0x55734d){_0x4621d9[_0x592a('0x1e')]=_0x55734d;if(_0x3a8dc2[_0x592a('0x33')][_0x592a('0x40')]){_0x2af815['include']=[{'all':!![]}];}return db[_0x592a('0x2d')][_0x592a('0x41')](_0x2af815);})[_0x592a('0x25')](function(_0x5ed82e){_0x4621d9['rows']=_0x5ed82e;return _0x4621d9;})[_0x592a('0x25')](respondWithFilteredResult(_0x5eb5d5,_0x2af815))[_0x592a('0x42')](handleError(_0x5eb5d5,null));};exports[_0x592a('0x43')]=function(_0x32e589,_0x4735cb){var _0x14f087={'raw':!![],'where':{'id':_0x32e589[_0x592a('0x44')]['id']}},_0x958732={};_0x958732['model']=_['keys'](db[_0x592a('0x2d')][_0x592a('0x45')]);_0x958732[_0x592a('0x33')]=_[_0x592a('0x30')](_0x32e589['query']);_0x958732[_0x592a('0x31')]=_[_0x592a('0x32')](_0x958732[_0x592a('0x2f')],_0x958732['query']);_0x14f087[_0x592a('0x35')]=_[_0x592a('0x32')](_0x958732['model'],qs[_0x592a('0x34')](_0x32e589['query'][_0x592a('0x34')]));_0x14f087[_0x592a('0x35')]=_0x14f087[_0x592a('0x35')][_0x592a('0x46')]?_0x14f087[_0x592a('0x35')]:_0x958732[_0x592a('0x2f')];if(_0x32e589[_0x592a('0x33')][_0x592a('0x40')]){_0x14f087[_0x592a('0x47')]=[{'all':!![]}];}_0x14f087=_[_0x592a('0x3d')]({},_0x14f087,_0x32e589[_0x592a('0x48')]);return db[_0x592a('0x2d')][_0x592a('0x49')](_0x14f087)[_0x592a('0x25')](handleEntityNotFound(_0x4735cb,null))['then'](respondWithResult(_0x4735cb,null))['catch'](handleError(_0x4735cb,null));};exports[_0x592a('0x4a')]=function(_0x59f3ed,_0x2ef5b0){return db[_0x592a('0x2d')]['create'](_0x59f3ed[_0x592a('0x4b')],{})['then'](respondWithResult(_0x2ef5b0,0xc9))[_0x592a('0x42')](handleError(_0x2ef5b0,null));};exports[_0x592a('0x4c')]=function(_0x52b802,_0xcc763a){if(_0x52b802[_0x592a('0x4b')]['id']){delete _0x52b802[_0x592a('0x4b')]['id'];}return db[_0x592a('0x2d')][_0x592a('0x49')]({'where':{'id':_0x52b802[_0x592a('0x44')]['id']}})[_0x592a('0x25')](handleEntityNotFound(_0xcc763a,null))[_0x592a('0x25')](saveUpdates(_0x52b802[_0x592a('0x4b')],null))[_0x592a('0x25')](respondWithResult(_0xcc763a,null))[_0x592a('0x42')](handleError(_0xcc763a,null));};exports[_0x592a('0x26')]=function(_0x27b707,_0x53fe67){return db[_0x592a('0x2d')][_0x592a('0x49')]({'where':{'id':_0x27b707['params']['id']}})[_0x592a('0x25')](handleEntityNotFound(_0x53fe67,null))['then'](removeEntity(_0x53fe67,null))[_0x592a('0x42')](handleError(_0x53fe67,null));};exports[_0x592a('0x4d')]=function(_0x1bb62d,_0x5b803d){return db[_0x592a('0x2d')][_0x592a('0x4d')]()[_0x592a('0x25')](respondWithResult(_0x5b803d,null))[_0x592a('0x42')](handleError(_0x5b803d,null));};exports[_0x592a('0x4e')]=function(_0x18257b,_0x47738b,_0x27d8b0){var _0x5c5931={'raw':!![],'where':{}};var _0x44ebf2={};var _0x18e105={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x592a('0x4f')]({'where':{'id':_0x18257b[_0x592a('0x44')]['id']}})[_0x592a('0x25')](handleEntityNotFound(_0x47738b,null))[_0x592a('0x25')](function(_0x27640d){if(_0x27640d){_0x44ebf2[_0x592a('0x2f')]=_[_0x592a('0x30')](db[_0x592a('0x50')][_0x592a('0x45')]);_0x44ebf2[_0x592a('0x33')]=_[_0x592a('0x30')](_0x18257b['query']);_0x44ebf2['filters']=_[_0x592a('0x32')](_0x44ebf2[_0x592a('0x2f')],_0x44ebf2[_0x592a('0x33')]);_0x5c5931[_0x592a('0x35')]=_[_0x592a('0x32')](_0x44ebf2[_0x592a('0x2f')],qs[_0x592a('0x34')](_0x18257b[_0x592a('0x33')]['fields']));_0x5c5931[_0x592a('0x35')]=_0x5c5931['attributes']['length']?_0x5c5931[_0x592a('0x35')]:_0x44ebf2['model'];if(!_0x18257b['query']['hasOwnProperty'](_0x592a('0x37'))){_0x5c5931[_0x592a('0x1d')]=qs['limit'](_0x18257b[_0x592a('0x33')][_0x592a('0x1d')]);_0x5c5931['offset']=qs[_0x592a('0x1f')](_0x18257b[_0x592a('0x33')][_0x592a('0x1f')]);}_0x5c5931[_0x592a('0x38')]=qs[_0x592a('0x39')](_0x18257b[_0x592a('0x33')][_0x592a('0x39')]);_0x5c5931[_0x592a('0x3a')]=qs[_0x592a('0x31')](_['pick'](_0x18257b[_0x592a('0x33')],_0x44ebf2[_0x592a('0x31')]));_0x5c5931['where'][_0x592a('0x51')]=_0x27640d['id'];if(_0x18257b[_0x592a('0x33')][_0x592a('0x3c')]){_0x5c5931['where']=_['merge'](_0x5c5931[_0x592a('0x3a')],{'$or':_['map'](_0x5c5931[_0x592a('0x35')],function(_0x14a294){var _0x342314={};_0x342314[_0x14a294]={'$like':'%'+_0x18257b[_0x592a('0x33')][_0x592a('0x3c')]+'%'};return _0x342314;})});}_0x5c5931=_[_0x592a('0x3d')]({},_0x5c5931,_0x18257b[_0x592a('0x48')]);return db['JscriptyQuestionReport'][_0x592a('0x1e')]({'where':_0x5c5931['where']})[_0x592a('0x25')](function(_0x295661){_0x18e105[_0x592a('0x1e')]=_0x295661;if(_0x18257b[_0x592a('0x33')][_0x592a('0x40')]){_0x5c5931[_0x592a('0x47')]=[{'all':!![]}];}return db[_0x592a('0x50')][_0x592a('0x41')](_0x5c5931);})['then'](function(_0x29342c){_0x18e105[_0x592a('0x52')]=_0x29342c;return _0x18e105;});}})['then'](respondWithFilteredResult(_0x47738b,_0x5c5931))[_0x592a('0x42')](handleError(_0x47738b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ae1ee24..0d9cb59 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(_0x255f72,_0x5087f0){var _0xf170a=function(_0x208c32){while(--_0x208c32){_0x255f72['push'](_0x255f72['shift']());}};_0xf170a(++_0x5087f0);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2018e0,_0x56cbc6){_0x2018e0=_0x2018e0-0x0;var _0x2c6715=_0xc1c6[_0x2018e0];return _0x2c6715;};'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 _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xafc4,0x69));var _0x4afc=function(_0x84a52d,_0x1003fb){_0x84a52d=_0x84a52d-0x0;var _0x58f63f=_0xafc4[_0x84a52d];return _0x58f63f;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'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 0c5a0e8..38eeef2 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 _0xa46e=['request','then','request\x20sent','debug','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http'];(function(_0x32d330,_0xe907c8){var _0xe81a43=function(_0x322e56){while(--_0x322e56){_0x32d330['push'](_0x32d330['shift']());}};_0xe81a43(++_0xe907c8);}(_0xa46e,0x8a));var _0xea46=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xa46e[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});} \ No newline at end of file +var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x35c4e8,_0x18ff04){var _0x4a958a=function(_0x43b341){while(--_0x43b341){_0x35c4e8['push'](_0x35c4e8['shift']());}};_0x4a958a(++_0x18ff04);}(_0xdf55,0x83));var _0x5df5=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0xdf55[_0x581960];return _0x4ee892;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d4bae62..db25d21 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 _0x5e6f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util'];(function(_0x4f4462,_0x25300f){var _0x347ac2=function(_0x48aee8){while(--_0x48aee8){_0x4f4462['push'](_0x4f4462['shift']());}};_0x347ac2(++_0x25300f);}(_0x5e6f,0xb2));var _0xf5e6=function(_0x196c94,_0x58fa96){_0x196c94=_0x196c94-0x0;var _0x4f7e3f=_0x5e6f[_0x196c94];return _0x4f7e3f;};'use strict';var multer=require(_0xf5e6('0x0'));var util=require(_0xf5e6('0x1'));var path=require('path');var timeout=require(_0xf5e6('0x2'));var express=require(_0xf5e6('0x3'));var router=express[_0xf5e6('0x4')]();var fs_extra=require(_0xf5e6('0x5'));var auth=require(_0xf5e6('0x6'));var interaction=require(_0xf5e6('0x7'));var config=require(_0xf5e6('0x8'));var controller=require(_0xf5e6('0x9'));router[_0xf5e6('0xa')]('/',controller[_0xf5e6('0xb')]);router[_0xf5e6('0xc')](_0xf5e6('0xd'),auth[_0xf5e6('0xe')](),controller[_0xf5e6('0xf')]);router[_0xf5e6('0xa')](_0xf5e6('0x10'),auth[_0xf5e6('0xe')](),controller[_0xf5e6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3079=['isAuthenticated','downloadLogFile','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','update','/download_log_file'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x3079,0x1ac));var _0x9307=function(_0x5a0c42,_0x5211ad){_0x5a0c42=_0x5a0c42-0x0;var _0xa993a8=_0x3079[_0x5a0c42];return _0xa993a8;};'use strict';var multer=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var path=require('path');var timeout=require(_0x9307('0x2'));var express=require(_0x9307('0x3'));var router=express['Router']();var fs_extra=require(_0x9307('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9307('0x5'));var config=require(_0x9307('0x6'));var controller=require(_0x9307('0x7'));router[_0x9307('0x8')]('/',controller[_0x9307('0x9')]);router[_0x9307('0xa')](_0x9307('0xb'),auth['isAuthenticated'](),controller[_0x9307('0xc')]);router[_0x9307('0x8')](_0x9307('0xd'),auth[_0x9307('0xe')](),controller[_0x9307('0xf')]);module[_0x9307('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 22dacc9..4cdcbf3 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 _0xcc47=['TEXT','STRING','INTEGER','sequelize'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xcc47,0x1b3));var _0x7cc4=function(_0x27af88,_0x57b25a){_0x27af88=_0x27af88-0x0;var _0x497334=_0xcc47[_0x27af88];return _0x497334;};'use strict';var Sequelize=require(_0x7cc4('0x0'));module['exports']={'license':{'type':Sequelize[_0x7cc4('0x1')]},'data1':{'type':Sequelize[_0x7cc4('0x2')]},'data2':{'type':Sequelize[_0x7cc4('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7cc4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0adc=['sequelize','exports','TEXT','STRING'];(function(_0x2f562e,_0x291639){var _0x49e218=function(_0x2ba7cc){while(--_0x2ba7cc){_0x2f562e['push'](_0x2f562e['shift']());}};_0x49e218(++_0x291639);}(_0x0adc,0x18c));var _0xc0ad=function(_0x2d6d5e,_0x214948){_0x2d6d5e=_0x2d6d5e-0x0;var _0x5ea03d=_0x0adc[_0x2d6d5e];return _0x5ea03d;};'use strict';var Sequelize=require(_0xc0ad('0x0'));module[_0xc0ad('0x1')]={'license':{'type':Sequelize[_0xc0ad('0x2')]},'data1':{'type':Sequelize[_0xc0ad('0x3')]},'data2':{'type':Sequelize[_0xc0ad('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 7592a5a..b71e6b8 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 _0x795e=['length','merge','options','getLicense','catch','body','License','find','get','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','send','index','model','keys','rawAttributes','query','filters','attributes','intersection','fields'];(function(_0x4809bd,_0xf41546){var _0x23da31=function(_0x10a275){while(--_0x10a275){_0x4809bd['push'](_0x4809bd['shift']());}};_0x23da31(++_0xf41546);}(_0x795e,0x177));var _0xe795=function(_0x430fb0,_0x2bcd75){_0x430fb0=_0x430fb0-0x0;var _0x25a526=_0x795e[_0x430fb0];return _0x25a526;};'use strict';var emlformat=require(_0xe795('0x0'));var rimraf=require(_0xe795('0x1'));var zipdir=require(_0xe795('0x2'));var jsonpatch=require(_0xe795('0x3'));var rp=require(_0xe795('0x4'));var moment=require(_0xe795('0x5'));var BPromise=require(_0xe795('0x6'));var Mustache=require(_0xe795('0x7'));var util=require('util');var path=require(_0xe795('0x8'));var sox=require(_0xe795('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe795('0xa'));var _=require('lodash');var squel=require(_0xe795('0xb'));var crypto=require(_0xe795('0xc'));var jsforce=require(_0xe795('0xd'));var deskjs=require(_0xe795('0xe'));var toCsv=require(_0xe795('0xf'));var querystring=require(_0xe795('0x10'));var Papa=require(_0xe795('0x11'));var Redis=require('ioredis');var authService=require(_0xe795('0x12'));var qs=require(_0xe795('0x13'));var as=require(_0xe795('0x14'));var hardwareService=require(_0xe795('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe795('0x16'));var config=require(_0xe795('0x17'));var licenseUtil=require(_0xe795('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce5b2,_0xd624ef){_0xd624ef=_0xd624ef||0xcc;return function(_0x44bd5f){if(_0x44bd5f){return _0x5ce5b2['sendStatus'](_0xd624ef);}return _0x5ce5b2[_0xe795('0x19')](_0xd624ef)['end']();};}function respondWithResult(_0x26139c,_0x4a2190){_0x4a2190=_0x4a2190||0xc8;return function(_0x35abb8){if(_0x35abb8){return _0x26139c['status'](_0x4a2190)[_0xe795('0x1a')](_0x35abb8);}};}function respondWithFilteredResult(_0x24e218,_0x3a7a5f){return function(_0x38ca32){if(_0x38ca32){var _0x441ce2=typeof _0x3a7a5f['offset']===_0xe795('0x1b')&&typeof _0x3a7a5f[_0xe795('0x1c')]==='undefined';var _0x551a10=_0x38ca32[_0xe795('0x1d')];var _0x4b05d5=_0x441ce2?0x0:_0x3a7a5f[_0xe795('0x1e')];var _0x228166=_0x441ce2?_0x38ca32[_0xe795('0x1d')]:_0x3a7a5f[_0xe795('0x1e')]+_0x3a7a5f[_0xe795('0x1c')];var _0x197d7b;if(_0x228166>=_0x551a10){_0x228166=_0x551a10;_0x197d7b=0xc8;}else{_0x197d7b=0xce;}_0x24e218[_0xe795('0x19')](_0x197d7b);return _0x24e218[_0xe795('0x1f')](_0xe795('0x20'),_0x4b05d5+'-'+_0x228166+'/'+_0x551a10)[_0xe795('0x1a')](_0x38ca32);}return null;};}function patchUpdates(_0x5b96c2){return function(_0x48de81){try{jsonpatch[_0xe795('0x21')](_0x48de81,_0x5b96c2,!![]);}catch(_0x5c6070){return BPromise[_0xe795('0x22')](_0x5c6070);}return _0x48de81[_0xe795('0x23')]();};}function saveUpdates(_0xa5212,_0x1930d7){return function(_0x37dc91){if(_0x37dc91){return _0x37dc91[_0xe795('0x24')](_0xa5212)['then'](function(_0x34061e){return _0x34061e;});}return null;};}function removeEntity(_0x76a7ba,_0x14563e){return function(_0x1a9a9b){if(_0x1a9a9b){return _0x1a9a9b['destroy']()[_0xe795('0x25')](function(){_0x76a7ba[_0xe795('0x19')](0xcc)[_0xe795('0x26')]();});}};}function handleEntityNotFound(_0x3dcc57,_0xf9800b){return function(_0x52e502){if(!_0x52e502){_0x3dcc57[_0xe795('0x27')](0x194);}return _0x52e502;};}function handleError(_0x3a0ed8,_0x2bed5e){_0x2bed5e=_0x2bed5e||0x1f4;return function(_0x553df5){logger[_0xe795('0x28')](_0x553df5['stack']);if(_0x553df5['name']){delete _0x553df5['name'];}_0x3a0ed8[_0xe795('0x19')](_0x2bed5e)[_0xe795('0x29')](_0x553df5);};}var utilLicense=require(_0xe795('0x18'));exports[_0xe795('0x2a')]=function(_0x4f2433,_0x549055){var _0x43eb0e={'raw':!![],'where':{'id':0x1}},_0x4ce1a5={};_0x4ce1a5[_0xe795('0x2b')]=_[_0xe795('0x2c')](db['License'][_0xe795('0x2d')]);_0x4ce1a5[_0xe795('0x2e')]=_[_0xe795('0x2c')](_0x4f2433[_0xe795('0x2e')]);_0x4ce1a5[_0xe795('0x2f')]=_['intersection'](_0x4ce1a5[_0xe795('0x2b')],_0x4ce1a5[_0xe795('0x2e')]);_0x43eb0e[_0xe795('0x30')]=_[_0xe795('0x31')](_0x4ce1a5[_0xe795('0x2b')],qs[_0xe795('0x32')](_0x4f2433[_0xe795('0x2e')][_0xe795('0x32')]));_0x43eb0e[_0xe795('0x30')]=_0x43eb0e[_0xe795('0x30')][_0xe795('0x33')]?_0x43eb0e['attributes']:_0x4ce1a5[_0xe795('0x2b')];_0x43eb0e=_[_0xe795('0x34')]({},_0x43eb0e,_0x4f2433[_0xe795('0x35')]);return utilLicense[_0xe795('0x36')](_0x43eb0e)[_0xe795('0x25')](respondWithResult(_0x549055,null))[_0xe795('0x37')](handleError(_0x549055,null));};exports['update']=function(_0x52f053,_0x2a37b7){if(_0x52f053['body']['id']){delete _0x52f053[_0xe795('0x38')]['id'];}return db[_0xe795('0x39')][_0xe795('0x3a')]({'where':{'id':_0x52f053['params']['id']}})[_0xe795('0x25')](handleEntityNotFound(_0x2a37b7,null))[_0xe795('0x25')](function(_0x47142c){var _0x2e2b47=_0x47142c[_0xe795('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x2e2b47,_0x52f053[_0xe795('0x38')]['key']);})[_0xe795('0x25')](function(_0xf5e6fd){if(!_0xf5e6fd['demo']){return saveUpdates(_0x52f053['body'],null);}return _0xf5e6fd;})[_0xe795('0x25')](respondWithResult(_0x2a37b7,null))[_0xe795('0x37')](handleError(_0x2a37b7,null));};exports[_0xe795('0x3c')]=function(_0x32e3aa,_0x3eafd8){var _0x556b46=_0xe795('0x3d');var _0x6fad61=path[_0xe795('0x3e')](_0xe795('0x3f'),_0xe795('0x40'),_0xe795('0x41'),_0x556b46);_0x3eafd8[_0xe795('0x42')](_0xe795('0x43'),_0xe795('0x44')+_0x556b46);_0x3eafd8[_0xe795('0x1f')]('Content-Type',_0xe795('0x45'));_0x3eafd8[_0xe795('0x46')](_0x6fad61);}; \ No newline at end of file +var _0xdbfa=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','sendStatus','error','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','merge','options','getLicense','catch','body','find','get','demo','license-info.log','join','log','xcally','setHeader','Content-disposition','text/plain','download','eml-format','rimraf','zip-dir','moment','mustache','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbfa,0x7f));var _0xadbf=function(_0x1ab885,_0x5da58f){_0x1ab885=_0x1ab885-0x0;var _0x438e2a=_0xdbfa[_0x1ab885];return _0x438e2a;};'use strict';var emlformat=require(_0xadbf('0x0'));var rimraf=require(_0xadbf('0x1'));var zipdir=require(_0xadbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xadbf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xadbf('0x4'));var util=require(_0xadbf('0x5'));var path=require(_0xadbf('0x6'));var sox=require(_0xadbf('0x7'));var csv=require(_0xadbf('0x8'));var ejs=require(_0xadbf('0x9'));var fs=require('fs');var fs_extra=require(_0xadbf('0xa'));var _=require('lodash');var squel=require(_0xadbf('0xb'));var crypto=require(_0xadbf('0xc'));var jsforce=require(_0xadbf('0xd'));var deskjs=require(_0xadbf('0xe'));var toCsv=require(_0xadbf('0x8'));var querystring=require(_0xadbf('0xf'));var Papa=require('papaparse');var Redis=require(_0xadbf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xadbf('0x11'));var as=require(_0xadbf('0x12'));var hardwareService=require(_0xadbf('0x13'));var logger=require('../../config/logger')(_0xadbf('0x14'));var utils=require(_0xadbf('0x15'));var config=require(_0xadbf('0x16'));var licenseUtil=require(_0xadbf('0x17'));var db=require(_0xadbf('0x18'))['db'];function respondWithStatusCode(_0x3b21df,_0x415aca){_0x415aca=_0x415aca||0xcc;return function(_0x5c39f7){if(_0x5c39f7){return _0x3b21df['sendStatus'](_0x415aca);}return _0x3b21df[_0xadbf('0x19')](_0x415aca)[_0xadbf('0x1a')]();};}function respondWithResult(_0x32a339,_0x424c5a){_0x424c5a=_0x424c5a||0xc8;return function(_0x1b0de7){if(_0x1b0de7){return _0x32a339[_0xadbf('0x19')](_0x424c5a)['json'](_0x1b0de7);}};}function respondWithFilteredResult(_0x58ae04,_0x2c3bb7){return function(_0x1df804){if(_0x1df804){var _0x4308cb=typeof _0x2c3bb7[_0xadbf('0x1b')]===_0xadbf('0x1c')&&typeof _0x2c3bb7[_0xadbf('0x1d')]===_0xadbf('0x1c');var _0x4baa59=_0x1df804['count'];var _0x288d7c=_0x4308cb?0x0:_0x2c3bb7[_0xadbf('0x1b')];var _0x5e4d46=_0x4308cb?_0x1df804[_0xadbf('0x1e')]:_0x2c3bb7[_0xadbf('0x1b')]+_0x2c3bb7[_0xadbf('0x1d')];var _0x54b83e;if(_0x5e4d46>=_0x4baa59){_0x5e4d46=_0x4baa59;_0x54b83e=0xc8;}else{_0x54b83e=0xce;}_0x58ae04[_0xadbf('0x19')](_0x54b83e);return _0x58ae04['set'](_0xadbf('0x1f'),_0x288d7c+'-'+_0x5e4d46+'/'+_0x4baa59)[_0xadbf('0x20')](_0x1df804);}return null;};}function patchUpdates(_0x569c95){return function(_0x254e74){try{jsonpatch['apply'](_0x254e74,_0x569c95,!![]);}catch(_0x28a745){return BPromise['reject'](_0x28a745);}return _0x254e74[_0xadbf('0x21')]();};}function saveUpdates(_0x270f8f,_0x193ea5){return function(_0x34a489){if(_0x34a489){return _0x34a489[_0xadbf('0x22')](_0x270f8f)[_0xadbf('0x23')](function(_0x312c6e){return _0x312c6e;});}return null;};}function removeEntity(_0x927cff,_0x44e76b){return function(_0x70a877){if(_0x70a877){return _0x70a877[_0xadbf('0x24')]()[_0xadbf('0x23')](function(){_0x927cff[_0xadbf('0x19')](0xcc)[_0xadbf('0x1a')]();});}};}function handleEntityNotFound(_0x36e3bf,_0x3e1d17){return function(_0x2e1ed9){if(!_0x2e1ed9){_0x36e3bf[_0xadbf('0x25')](0x194);}return _0x2e1ed9;};}function handleError(_0xa34aa4,_0x94809e){_0x94809e=_0x94809e||0x1f4;return function(_0x22f237){logger[_0xadbf('0x26')](_0x22f237['stack']);if(_0x22f237[_0xadbf('0x27')]){delete _0x22f237[_0xadbf('0x27')];}_0xa34aa4['status'](_0x94809e)[_0xadbf('0x28')](_0x22f237);};}var utilLicense=require(_0xadbf('0x17'));exports[_0xadbf('0x29')]=function(_0x359ba5,_0x4e61bc){var _0x46468e={'raw':!![],'where':{'id':0x1}},_0x4a90f8={};_0x4a90f8['model']=_[_0xadbf('0x2a')](db[_0xadbf('0x2b')][_0xadbf('0x2c')]);_0x4a90f8['query']=_['keys'](_0x359ba5[_0xadbf('0x2d')]);_0x4a90f8[_0xadbf('0x2e')]=_[_0xadbf('0x2f')](_0x4a90f8[_0xadbf('0x30')],_0x4a90f8['query']);_0x46468e[_0xadbf('0x31')]=_[_0xadbf('0x2f')](_0x4a90f8[_0xadbf('0x30')],qs[_0xadbf('0x32')](_0x359ba5[_0xadbf('0x2d')][_0xadbf('0x32')]));_0x46468e[_0xadbf('0x31')]=_0x46468e[_0xadbf('0x31')]['length']?_0x46468e[_0xadbf('0x31')]:_0x4a90f8['model'];_0x46468e=_[_0xadbf('0x33')]({},_0x46468e,_0x359ba5[_0xadbf('0x34')]);return utilLicense[_0xadbf('0x35')](_0x46468e)[_0xadbf('0x23')](respondWithResult(_0x4e61bc,null))[_0xadbf('0x36')](handleError(_0x4e61bc,null));};exports['update']=function(_0x33e037,_0x4de8d9){if(_0x33e037[_0xadbf('0x37')]['id']){delete _0x33e037[_0xadbf('0x37')]['id'];}return db[_0xadbf('0x2b')][_0xadbf('0x38')]({'where':{'id':_0x33e037['params']['id']}})['then'](handleEntityNotFound(_0x4de8d9,null))['then'](function(_0x314c34){var _0x3a7aa7=_0x314c34[_0xadbf('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x3a7aa7,_0x33e037[_0xadbf('0x37')]['key']);})[_0xadbf('0x23')](function(_0x1eb67c){if(!_0x1eb67c[_0xadbf('0x3a')]){return saveUpdates(_0x33e037[_0xadbf('0x37')],null);}return _0x1eb67c;})[_0xadbf('0x23')](respondWithResult(_0x4de8d9,null))[_0xadbf('0x36')](handleError(_0x4de8d9,null));};exports['downloadLogFile']=function(_0x3f07ab,_0x473526){var _0x471f8d=_0xadbf('0x3b');var _0x4b8206=path[_0xadbf('0x3c')]('/var',_0xadbf('0x3d'),_0xadbf('0x3e'),_0x471f8d);_0x473526[_0xadbf('0x3f')](_0xadbf('0x40'),'attachment;\x20filename='+_0x471f8d);_0x473526['set']('Content-Type',_0xadbf('0x41'));_0x473526[_0xadbf('0x42')](_0x4b8206);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 9ffd52f..3f5244b 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 _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x2978aa,_0x15e9f5){var _0x513bf6=function(_0x5a8bc0){while(--_0x5a8bc0){_0x2978aa['push'](_0x2978aa['shift']());}};_0x513bf6(++_0x15e9f5);}(_0x0295,0x1f0));var _0x5029=function(_0x3c4856,_0x98f049){_0x3c4856=_0x3c4856-0x0;var _0xba2cac=_0x0295[_0x3c4856];return _0xba2cac;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaba6=['rimraf','../../config/environment','License','license','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4e6d12,_0x51e28c){var _0x45dd07=function(_0x44362b){while(--_0x44362b){_0x4e6d12['push'](_0x4e6d12['shift']());}};_0x45dd07(++_0x51e28c);}(_0xaba6,0x86));var _0x6aba=function(_0xb984a7,_0x564ef9){_0xb984a7=_0xb984a7-0x0;var _0x247044=_0xaba6[_0xb984a7];return _0x247044;};'use strict';var _=require(_0x6aba('0x0'));var util=require('util');var logger=require(_0x6aba('0x1'))(_0x6aba('0x2'));var moment=require('moment');var BPromise=require(_0x6aba('0x3'));var rp=require(_0x6aba('0x4'));var fs=require('fs');var path=require(_0x6aba('0x5'));var rimraf=require(_0x6aba('0x6'));var config=require(_0x6aba('0x7'));var attributes=require('./license.attributes');module['exports']=function(_0x224835,_0x40941){return _0x224835['define'](_0x6aba('0x8'),attributes,{'tableName':_0x6aba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 3a50705..d2f5223 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 _0xcfd0=['lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','catch'];(function(_0x5e5351,_0x5a4b3b){var _0x392f5c=function(_0x330a1a){while(--_0x330a1a){_0x5e5351['push'](_0x5e5351['shift']());}};_0x392f5c(++_0x5a4b3b);}(_0xcfd0,0x1e3));var _0x0cfd=function(_0x4ba046,_0x1cf56b){_0x4ba046=_0x4ba046-0x0;var _0x171f06=_0xcfd0[_0x4ba046];return _0x171f06;};'use strict';var _=require(_0x0cfd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cfd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cfd('0x2'))['db'];var utils=require(_0x0cfd('0x3'));var logger=require(_0x0cfd('0x4'))('rpc');var config=require(_0x0cfd('0x5'));var jayson=require(_0x0cfd('0x6'));var client=jayson[_0x0cfd('0x7')][_0x0cfd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c8762,_0x381acc,_0x135fea){return new BPromise(function(_0xb7140d,_0x6a3834){return client[_0x0cfd('0x9')](_0x4c8762,_0x135fea)[_0x0cfd('0xa')](function(_0xf58749){logger[_0x0cfd('0xb')]('License,\x20%s,\x20%s',_0x381acc,_0x0cfd('0xc'));logger[_0x0cfd('0xd')](_0x0cfd('0xe'),_0x381acc,_0x0cfd('0xc'),JSON[_0x0cfd('0xf')](_0xf58749));if(_0xf58749[_0x0cfd('0x10')]){if(_0xf58749[_0x0cfd('0x10')][_0x0cfd('0x11')]===0x1f4){logger[_0x0cfd('0x10')](_0x0cfd('0x12'),_0x381acc,_0xf58749[_0x0cfd('0x10')][_0x0cfd('0x13')]);return _0x6a3834(_0xf58749[_0x0cfd('0x10')]['message']);}logger[_0x0cfd('0x10')](_0x0cfd('0x12'),_0x381acc,_0xf58749[_0x0cfd('0x10')][_0x0cfd('0x13')]);return _0xb7140d(_0xf58749[_0x0cfd('0x10')]['message']);}else{logger[_0x0cfd('0xb')](_0x0cfd('0x12'),_0x381acc,_0x0cfd('0xc'));_0xb7140d(_0xf58749['result'][_0x0cfd('0x13')]);}})[_0x0cfd('0x14')](function(_0x2f4f57){logger[_0x0cfd('0x10')](_0x0cfd('0x12'),_0x381acc,_0x2f4f57);_0x6a3834(_0x2f4f57);});});} \ No newline at end of file +var _0xef60=['License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x45b473,_0x196ffa){var _0x186ea3=function(_0x321d09){while(--_0x321d09){_0x45b473['push'](_0x45b473['shift']());}};_0x186ea3(++_0x196ffa);}(_0xef60,0x190));var _0x0ef6=function(_0x5d35e6,_0x144b0e){_0x5d35e6=_0x5d35e6-0x0;var _0x57a5a4=_0xef60[_0x5d35e6];return _0x57a5a4;};'use strict';var _=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var moment=require(_0x0ef6('0x2'));var BPromise=require(_0x0ef6('0x3'));var rs=require(_0x0ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ef6('0x5'));var logger=require(_0x0ef6('0x6'))('rpc');var config=require(_0x0ef6('0x7'));var jayson=require(_0x0ef6('0x8'));var client=jayson[_0x0ef6('0x9')][_0x0ef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x154799,_0xc5aae8,_0x118956){return new BPromise(function(_0x34c57f,_0xc522cb){return client[_0x0ef6('0xb')](_0x154799,_0x118956)[_0x0ef6('0xc')](function(_0x4f5341){logger[_0x0ef6('0xd')](_0x0ef6('0xe'),_0xc5aae8,'request\x20sent');logger['debug'](_0x0ef6('0xf'),_0xc5aae8,_0x0ef6('0x10'),JSON[_0x0ef6('0x11')](_0x4f5341));if(_0x4f5341[_0x0ef6('0x12')]){if(_0x4f5341[_0x0ef6('0x12')][_0x0ef6('0x13')]===0x1f4){logger['error'](_0x0ef6('0xe'),_0xc5aae8,_0x4f5341[_0x0ef6('0x12')]['message']);return _0xc522cb(_0x4f5341[_0x0ef6('0x12')][_0x0ef6('0x14')]);}logger[_0x0ef6('0x12')]('License,\x20%s,\x20%s',_0xc5aae8,_0x4f5341[_0x0ef6('0x12')]['message']);return _0x34c57f(_0x4f5341[_0x0ef6('0x12')]['message']);}else{logger[_0x0ef6('0xd')](_0x0ef6('0xe'),_0xc5aae8,_0x0ef6('0x10'));_0x34c57f(_0x4f5341[_0x0ef6('0x15')]['message']);}})[_0x0ef6('0x16')](function(_0x49ef8a){logger['error'](_0x0ef6('0xe'),_0xc5aae8,_0x49ef8a);_0xc522cb(_0x49ef8a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1bdc4c1..55136e1 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 _0x1cc3=['addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer'];(function(_0x303d4b,_0x356d9c){var _0x176444=function(_0xf385b3){while(--_0xf385b3){_0x303d4b['push'](_0x303d4b['shift']());}};_0x176444(++_0x356d9c);}(_0x1cc3,0x65));var _0x31cc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1cc3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x31cc('0x0'));var util=require('util');var path=require(_0x31cc('0x1'));var timeout=require(_0x31cc('0x2'));var express=require(_0x31cc('0x3'));var router=express[_0x31cc('0x4')]();var fs_extra=require(_0x31cc('0x5'));var auth=require(_0x31cc('0x6'));var interaction=require(_0x31cc('0x7'));var config=require(_0x31cc('0x8'));var controller=require('./mailAccount.controller');router[_0x31cc('0x9')]('/',auth['isAuthenticated'](),controller[_0x31cc('0xa')]);router[_0x31cc('0x9')](_0x31cc('0xb'),auth[_0x31cc('0xc')](),controller[_0x31cc('0xd')]);router['get'](_0x31cc('0xe'),auth[_0x31cc('0xc')](),controller['show']);router[_0x31cc('0x9')](_0x31cc('0xf'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x10')]);router[_0x31cc('0x9')](_0x31cc('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x31cc('0x9')](_0x31cc('0x12'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x13')]);router[_0x31cc('0x9')](_0x31cc('0x14'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x15')]);router[_0x31cc('0x9')](_0x31cc('0x16'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x17')]);router['get'](_0x31cc('0x18'),auth[_0x31cc('0xc')](),controller['getApplications']);router['get'](_0x31cc('0x19'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x1a')]);router[_0x31cc('0x9')](_0x31cc('0x1b'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x1c')]);router[_0x31cc('0x9')](_0x31cc('0x1d'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x1e')]);router[_0x31cc('0x1f')](_0x31cc('0xf'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x20')]);router[_0x31cc('0x1f')](_0x31cc('0x11'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x21')]);router[_0x31cc('0x1f')]('/',auth[_0x31cc('0xc')](),controller['create']);router[_0x31cc('0x1f')]('/:id/in_servers',auth[_0x31cc('0xc')](),controller['addImap']);router[_0x31cc('0x1f')](_0x31cc('0x14'),auth[_0x31cc('0xc')](),controller['addSmtp']);router[_0x31cc('0x1f')](_0x31cc('0x16'),auth[_0x31cc('0xc')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x31cc('0xc')](),controller[_0x31cc('0x22')]);router['post'](_0x31cc('0x23'),auth['isAuthenticated'](),controller[_0x31cc('0x24')]);router['post'](_0x31cc('0x1d'),auth['isAuthenticated'](),controller[_0x31cc('0x25')]);router[_0x31cc('0x26')]('/:id',auth[_0x31cc('0xc')](),controller['update']);router[_0x31cc('0x27')]('/:id/dispositions',auth[_0x31cc('0xc')](),controller[_0x31cc('0x28')]);router['delete'](_0x31cc('0x11'),auth[_0x31cc('0xc')](),controller['removeAnswers']);router[_0x31cc('0x27')](_0x31cc('0x12'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x29')]);router[_0x31cc('0x27')](_0x31cc('0x14'),auth['isAuthenticated'](),controller[_0x31cc('0x2a')]);router[_0x31cc('0x27')](_0x31cc('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x31cc('0x27')](_0x31cc('0x1d'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x2b')]);module[_0x31cc('0x2c')]=router; \ No newline at end of file +var _0xbf48=['/:id/verify','/:id/users','getAgents','/:id/dispositions','post','addAnswer','create','addImap','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getInteractions','getApplications'];(function(_0x53ab1b,_0x52355b){var _0x5d2916=function(_0x30613a){while(--_0x30613a){_0x53ab1b['push'](_0x53ab1b['shift']());}};_0x5d2916(++_0x52355b);}(_0xbf48,0x9b));var _0x8bf4=function(_0x33f8d7,_0x3a1165){_0x33f8d7=_0x33f8d7-0x0;var _0x1364ce=_0xbf48[_0x33f8d7];return _0x1364ce;};'use strict';var multer=require(_0x8bf4('0x0'));var util=require(_0x8bf4('0x1'));var path=require(_0x8bf4('0x2'));var timeout=require(_0x8bf4('0x3'));var express=require('express');var router=express[_0x8bf4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bf4('0x5'));var config=require(_0x8bf4('0x6'));var controller=require(_0x8bf4('0x7'));router[_0x8bf4('0x8')]('/',auth[_0x8bf4('0x9')](),controller['index']);router['get'](_0x8bf4('0xa'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xb')]);router[_0x8bf4('0x8')](_0x8bf4('0xc'),auth['isAuthenticated'](),controller[_0x8bf4('0xd')]);router[_0x8bf4('0x8')]('/:id/dispositions',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xe')]);router[_0x8bf4('0x8')]('/:id/canned_answers',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0xf')]);router[_0x8bf4('0x8')](_0x8bf4('0x10'),auth['isAuthenticated'](),controller['getImap']);router[_0x8bf4('0x8')](_0x8bf4('0x11'),auth[_0x8bf4('0x9')](),controller['getSmtp']);router[_0x8bf4('0x8')](_0x8bf4('0x12'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x13')]);router[_0x8bf4('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8bf4('0x14')]);router[_0x8bf4('0x8')]('/:id/messages',auth[_0x8bf4('0x9')](),controller['getMessages']);router[_0x8bf4('0x8')](_0x8bf4('0x15'),auth[_0x8bf4('0x9')](),controller['verifySmtp']);router[_0x8bf4('0x8')](_0x8bf4('0x16'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x17')]);router['post'](_0x8bf4('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x8bf4('0x19')]('/:id/canned_answers',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1a')]);router[_0x8bf4('0x19')]('/',auth['isAuthenticated'](),controller[_0x8bf4('0x1b')]);router[_0x8bf4('0x19')](_0x8bf4('0x10'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1c')]);router[_0x8bf4('0x19')](_0x8bf4('0x11'),auth[_0x8bf4('0x9')](),controller['addSmtp']);router[_0x8bf4('0x19')](_0x8bf4('0x12'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1d')]);router[_0x8bf4('0x19')]('/:id/applications',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x1e')]);router[_0x8bf4('0x19')](_0x8bf4('0x1f'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x20')]);router[_0x8bf4('0x19')]('/:id/users',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x21')]);router[_0x8bf4('0x22')]('/:id',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x23')]);router[_0x8bf4('0x24')](_0x8bf4('0x18'),auth[_0x8bf4('0x9')](),controller['removeDispositions']);router[_0x8bf4('0x24')](_0x8bf4('0x25'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x26')]);router['delete'](_0x8bf4('0x10'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x27')]);router[_0x8bf4('0x24')](_0x8bf4('0x11'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x28')]);router['delete']('/:id',auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x29')]);router[_0x8bf4('0x24')](_0x8bf4('0x16'),auth[_0x8bf4('0x9')](),controller[_0x8bf4('0x2a')]);module[_0x8bf4('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b4ac243..a2f3990 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 _0x6105=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','gmail','hotmail','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x49996d,_0x13c00a){var _0x2e48f5=function(_0x7ebd94){while(--_0x7ebd94){_0x49996d['push'](_0x49996d['shift']());}};_0x2e48f5(++_0x13c00a);}(_0x6105,0x1c2));var _0x5610=function(_0x1f7e64,_0x4b50a3){_0x1f7e64=_0x1f7e64-0x0;var _0x55e9dd=_0x6105[_0x1f7e64];return _0x55e9dd;};'use strict';var Sequelize=require(_0x5610('0x0'));module[_0x5610('0x1')]={'description':{'type':Sequelize[_0x5610('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x5610('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5610('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5610('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5610('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5610('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5610('0x2')],'allowNull':![],'defaultValue':_0x5610('0x5')},'fontSize':{'type':Sequelize[_0x5610('0x6')](0x2)[_0x5610('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5610('0x4')],'defaultValue':function(){return _0x5610('0x8');}},'notificationSound':{'type':Sequelize[_0x5610('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5610('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5610('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5610('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5610('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5610('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5610('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5610('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x5610('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5610('0xa'),'set':function(_0x24c462){if(!_0x24c462)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5610('0xb')]('mandatoryDisposition',_0x24c462);}},'provider':{'type':Sequelize[_0x5610('0xc')](_0x5610('0xd'),_0x5610('0xe'),'yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x4033d3=this[_0x5610('0xf')]('provider');return _0x4033d3||_0x5610('0x10');},'set':function(_0x8992){if(_0x8992===_0x5610('0x10')){_0x8992=null;}return this['setDataValue']('provider',_0x8992);}}}; \ No newline at end of file +var _0x90c8=['Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','provider','custom','exports','STRING','BOOLEAN','TEXT'];(function(_0x4be677,_0x376b45){var _0xb4bb3c=function(_0x4ff1d0){while(--_0x4ff1d0){_0x4be677['push'](_0x4be677['shift']());}};_0xb4bb3c(++_0x376b45);}(_0x90c8,0x1eb));var _0x890c=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x90c8[_0x2892da];return _0x28cff2;};'use strict';var Sequelize=require('sequelize');module[_0x890c('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x890c('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x890c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x890c('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x890c('0x1')],'allowNull':![],'defaultValue':_0x890c('0x4')},'fontSize':{'type':Sequelize[_0x890c('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x890c('0x3')],'defaultValue':function(){return _0x890c('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x890c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x890c('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x890c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x484769){if(!_0x484769)this[_0x890c('0x7')]('mandatoryDispositionPauseId',null);this[_0x890c('0x7')](_0x890c('0x8'),_0x484769);}},'provider':{'type':Sequelize[_0x890c('0x9')](_0x890c('0xa'),'hotmail',_0x890c('0xb'),_0x890c('0xc')),'defaultValue':null,'get':function(){var _0x4d92ba=this['getDataValue'](_0x890c('0xd'));return _0x4d92ba||_0x890c('0xe');},'set':function(_0x5f0746){if(_0x5f0746===_0x890c('0xe')){_0x5f0746=null;}return this['setDataValue']('provider',_0x5f0746);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 284953d..18009d7 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 _0x0fca=['from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','List','List\x20not\x20found','subject','messageId','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','end','status','json','offset','limit','undefined','count','Content-Range','destroy','get','MailAccounts','sendStatus','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','MailServerOut','find','update','body','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','pick','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','findAll','rows','removeAnswers','provider','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','internal','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found'];(function(_0x43c40c,_0x151368){var _0x170be7=function(_0x182c41){while(--_0x182c41){_0x43c40c['push'](_0x43c40c['shift']());}};_0x170be7(++_0x151368);}(_0x0fca,0xde));var _0xa0fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fca[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xa0fc('0x0'));var BPromise=require(_0xa0fc('0x1'));var util=require(_0xa0fc('0x2'));var path=require(_0xa0fc('0x3'));var _=require(_0xa0fc('0x4'));var juice=require(_0xa0fc('0x5'));var Redis=require(_0xa0fc('0x6'));var qs=require(_0xa0fc('0x7'));var logger=require(_0xa0fc('0x8'))(_0xa0fc('0x9'));var config=require('../../config/environment');var db=require(_0xa0fc('0xa'))['db'];config['redis']=_[_0xa0fc('0xb')](config[_0xa0fc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0fc('0xd'))(new Redis(config[_0xa0fc('0xc')]));require(_0xa0fc('0xe'))[_0xa0fc('0xf')](socket);var jayson=require(_0xa0fc('0x10'));var client=jayson[_0xa0fc('0x11')][_0xa0fc('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x152e25,_0x522b23,_0x119ec3,_0xbdc388){return new BPromise(function(_0x3c19e3,_0x3119db){var _0x487c8d=_0xbdc388||client;return _0x487c8d['request'](_0x152e25,_0x119ec3)[_0xa0fc('0x13')](function(_0x3a3ab6){logger[_0xa0fc('0x14')]('MailAccount,\x20%s,\x20%s',_0x522b23,_0xa0fc('0x15'));logger[_0xa0fc('0x16')](_0xa0fc('0x17'),_0x522b23,_0xa0fc('0x15'),JSON[_0xa0fc('0x18')](_0x3a3ab6));if(_0x3a3ab6[_0xa0fc('0x19')]){if(_0x3a3ab6[_0xa0fc('0x19')][_0xa0fc('0x1a')]===0x1f4){logger[_0xa0fc('0x19')](_0xa0fc('0x1b'),_0x522b23,_0x3a3ab6[_0xa0fc('0x19')][_0xa0fc('0x1c')]);return _0x3119db(_0x3a3ab6[_0xa0fc('0x19')][_0xa0fc('0x1c')]);}logger[_0xa0fc('0x19')](_0xa0fc('0x1b'),_0x522b23,_0x3a3ab6['error'][_0xa0fc('0x1c')]);return _0x3c19e3(_0x3a3ab6['error']['message']);}else{logger[_0xa0fc('0x14')](_0xa0fc('0x1b'),_0x522b23,_0xa0fc('0x15'));_0x3c19e3(_0x3a3ab6['result'][_0xa0fc('0x1c')]);}})[_0xa0fc('0x1d')](function(_0x392cea){logger['error'](_0xa0fc('0x1b'),_0x522b23,_0x392cea);_0x3119db(_0x392cea);});});}function respondWithStatusCode(_0xc7d7c4,_0x371c7c){_0x371c7c=_0x371c7c||0xcc;return function(_0x26ae2d){if(_0x26ae2d){return _0xc7d7c4['sendStatus'](_0x371c7c);}return _0xc7d7c4['status'](_0x371c7c)[_0xa0fc('0x1e')]();};}function respondWithResult(_0x3fe2cd,_0x1692f8){_0x1692f8=_0x1692f8||0xc8;return function(_0x436bb8){if(_0x436bb8){return _0x3fe2cd[_0xa0fc('0x1f')](_0x1692f8)[_0xa0fc('0x20')](_0x436bb8);}};}function respondWithFilteredResult(_0x514741,_0x318683){return function(_0x272b32){if(_0x272b32){var _0x62d730=typeof _0x318683[_0xa0fc('0x21')]==='undefined'&&typeof _0x318683[_0xa0fc('0x22')]===_0xa0fc('0x23');var _0x2b837a=_0x272b32[_0xa0fc('0x24')];var _0x1ab1de=_0x62d730?0x0:_0x318683[_0xa0fc('0x21')];var _0x307330=_0x62d730?_0x272b32[_0xa0fc('0x24')]:_0x318683[_0xa0fc('0x21')]+_0x318683['limit'];var _0xbf6b40;if(_0x307330>=_0x2b837a){_0x307330=_0x2b837a;_0xbf6b40=0xc8;}else{_0xbf6b40=0xce;}_0x514741[_0xa0fc('0x1f')](_0xbf6b40);return _0x514741['set'](_0xa0fc('0x25'),_0x1ab1de+'-'+_0x307330+'/'+_0x2b837a)['json'](_0x272b32);}return null;};}function saveUpdates(_0x29b59d){return function(_0x15641d){if(_0x15641d){return _0x15641d['update'](_0x29b59d)[_0xa0fc('0x13')](function(_0xee505f){return _0xee505f;});}return null;};}function removeEntity(_0x2f4181){return function(_0x58f0a7){if(_0x58f0a7){return _0x58f0a7[_0xa0fc('0x26')]()['then'](function(){var _0x14151d=_0x58f0a7[_0xa0fc('0x27')]({'plain':!![]});var _0x175462=_0xa0fc('0x28');return db['UserProfileResource'][_0xa0fc('0x26')]({'where':{'type':_0x175462,'resourceId':_0x14151d['id']}})[_0xa0fc('0x13')](function(){return _0x58f0a7;});})[_0xa0fc('0x13')](function(){_0x2f4181[_0xa0fc('0x1f')](0xcc)[_0xa0fc('0x1e')]();});}};}function handleEntityNotFound(_0x192372){return function(_0x165b43){if(!_0x165b43){_0x192372[_0xa0fc('0x29')](0x194);}return _0x165b43;};}function handleError(_0x388f99,_0x46d598){_0x46d598=_0x46d598||0x1f4;return function(_0x2fdd45){logger['error'](_0x2fdd45[_0xa0fc('0x2a')]);if(_0x2fdd45[_0xa0fc('0x2b')]){delete _0x2fdd45[_0xa0fc('0x2b')];}_0x388f99[_0xa0fc('0x1f')](_0x46d598)[_0xa0fc('0x2c')](_0x2fdd45);};}function getImapHost(_0x284fc8){switch(_0x284fc8){case _0xa0fc('0x2d'):return _0xa0fc('0x2e');case'yahoo':return _0xa0fc('0x2f');case _0xa0fc('0x30'):return _0xa0fc('0x31');case _0xa0fc('0x32'):return _0xa0fc('0x33');}throw new Error(_0xa0fc('0x34'),_0x284fc8);}function getSmtpHost(_0x7e321f){switch(_0x7e321f){case _0xa0fc('0x2d'):return _0xa0fc('0x35');case _0xa0fc('0x36'):return _0xa0fc('0x37');case _0xa0fc('0x30'):return _0xa0fc('0x38');case'outlook365':return _0xa0fc('0x39');}throw new Error(_0xa0fc('0x34'),_0x7e321f);}function getAuthenticationOptions(_0x12cb6e,_0x26a012){var _0x3dbb33={};var _0x5f2f2a={};if(_0x12cb6e){_0x3dbb33[_0xa0fc('0x3a')]=_0x5f2f2a[_0xa0fc('0x3a')]=_0x26a012['username'];_0x3dbb33[_0xa0fc('0x3b')]=_0x5f2f2a[_0xa0fc('0x3c')]=_0x26a012['password'];if(_0x26a012['modernAuthentication']){_0x3dbb33[_0xa0fc('0x3d')]=_0x5f2f2a[_0xa0fc('0x3d')]=!![];_0x3dbb33['CloudProviderId']=_0x5f2f2a[_0xa0fc('0x3e')]=_0x26a012[_0xa0fc('0x3e')];_0x3dbb33[_0xa0fc('0x3b')]=_0x5f2f2a[_0xa0fc('0x3c')]=null;}else{_0x3dbb33['CloudProviderId']=_0x5f2f2a[_0xa0fc('0x3e')]=null;}_0x3dbb33[_0xa0fc('0x3f')]=getImapHost(_0x12cb6e);_0x3dbb33[_0xa0fc('0x40')]=0x3e1;_0x5f2f2a[_0xa0fc('0x3f')]=getSmtpHost(_0x12cb6e);_0x5f2f2a[_0xa0fc('0x40')]=0x24b;_0x5f2f2a[_0xa0fc('0x41')]=![];_0x3dbb33[_0xa0fc('0x42')]=_0x5f2f2a[_0xa0fc('0x42')]=null;}else{if(_0x26a012[_0xa0fc('0x43')]){_0x3dbb33[_0xa0fc('0x3a')]=_0x5f2f2a['user']=_0x26a012[_0xa0fc('0x44')];_0x3dbb33[_0xa0fc('0x3b')]=_0x5f2f2a[_0xa0fc('0x3c')]=_0x26a012[_0xa0fc('0x3b')];}else{_0x3dbb33[_0xa0fc('0x43')]=_0x5f2f2a['authentication']=![];_0x3dbb33['user']=_0x5f2f2a[_0xa0fc('0x3a')]=null;_0x3dbb33[_0xa0fc('0x3b')]=_0x5f2f2a['pass']=null;}_0x3dbb33[_0xa0fc('0x3f')]=_0x26a012['Imap'][_0xa0fc('0x3f')];_0x3dbb33[_0xa0fc('0x40')]=_0x26a012[_0xa0fc('0x45')][_0xa0fc('0x40')];_0x5f2f2a[_0xa0fc('0x3f')]=_0x26a012[_0xa0fc('0x46')]['host'];_0x5f2f2a['port']=_0x26a012[_0xa0fc('0x46')][_0xa0fc('0x40')];}return{'Imap':_0x3dbb33,'Smtp':_0x5f2f2a};}exports[_0xa0fc('0x47')]=function(_0x4d97c9,_0x51b0de){var _0x5b53f7={'include':[{'model':db[_0xa0fc('0x48')],'as':_0xa0fc('0x45')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa0fc('0x49')],'as':_0xa0fc('0x4a')}]},_0x5d0bc0={},_0x47cd49={'count':0x0,'rows':[]};var _0x345471=_[_0xa0fc('0x4b')](db[_0xa0fc('0x4c')][_0xa0fc('0x4d')],function(_0x416945){return{'name':_0x416945[_0xa0fc('0x4e')],'type':_0x416945['type'][_0xa0fc('0x4f')]};});_0x5d0bc0[_0xa0fc('0x50')]=_[_0xa0fc('0x4b')](_0x345471,_0xa0fc('0x2b'));_0x5d0bc0[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x4d97c9[_0xa0fc('0x51')]);_0x5d0bc0['filters']=_[_0xa0fc('0x53')](_0x5d0bc0[_0xa0fc('0x50')],_0x5d0bc0[_0xa0fc('0x51')]);_0x5b53f7[_0xa0fc('0x54')]=_[_0xa0fc('0x53')](_0x5d0bc0[_0xa0fc('0x50')],qs['fields'](_0x4d97c9[_0xa0fc('0x51')][_0xa0fc('0x55')]));_0x5b53f7[_0xa0fc('0x54')]=_0x5b53f7[_0xa0fc('0x54')][_0xa0fc('0x56')]?_0x5b53f7[_0xa0fc('0x54')]:_0x5d0bc0[_0xa0fc('0x50')];if(!_0x4d97c9[_0xa0fc('0x51')]['hasOwnProperty'](_0xa0fc('0x57'))){_0x5b53f7[_0xa0fc('0x22')]=qs[_0xa0fc('0x22')](_0x4d97c9[_0xa0fc('0x51')]['limit']);_0x5b53f7[_0xa0fc('0x21')]=qs[_0xa0fc('0x21')](_0x4d97c9[_0xa0fc('0x51')][_0xa0fc('0x21')]);}_0x5b53f7[_0xa0fc('0x58')]=qs[_0xa0fc('0x59')](_0x4d97c9[_0xa0fc('0x51')][_0xa0fc('0x59')]);_0x5b53f7[_0xa0fc('0x5a')]=qs[_0xa0fc('0x5b')](_['pick'](_0x4d97c9[_0xa0fc('0x51')],_0x5d0bc0[_0xa0fc('0x5b')]),_0x345471);if(_0x4d97c9[_0xa0fc('0x51')][_0xa0fc('0x5c')]){_0x5b53f7[_0xa0fc('0x5a')]=_[_0xa0fc('0x5d')](_0x5b53f7['where'],{'$or':_[_0xa0fc('0x4b')](_0x345471,function(_0x288c78){if(_0x288c78[_0xa0fc('0x5e')]!=='VIRTUAL'){var _0x11d33c={};_0x11d33c[_0x288c78[_0xa0fc('0x2b')]]={'$like':'%'+_0x4d97c9[_0xa0fc('0x51')]['filter']+'%'};return _0x11d33c;}})});}_0x5b53f7=_[_0xa0fc('0x5d')]({},_0x5b53f7,_0x4d97c9[_0xa0fc('0x5f')]);var _0x52b452={'where':_0x5b53f7[_0xa0fc('0x5a')]};return db[_0xa0fc('0x4c')]['count'](_0x52b452)[_0xa0fc('0x13')](function(_0x758c84){_0x47cd49[_0xa0fc('0x24')]=_0x758c84;if(_0x4d97c9[_0xa0fc('0x51')][_0xa0fc('0x60')]){_0x5b53f7['include']=[{'all':!![]}];}return db[_0xa0fc('0x4c')]['findAll'](_0x5b53f7);})[_0xa0fc('0x13')](function(_0x1fec05){_0x47cd49['rows']=_0x1fec05;return _0x47cd49;})[_0xa0fc('0x13')](respondWithFilteredResult(_0x51b0de,_0x5b53f7))['catch'](handleError(_0x51b0de,null));};exports['show']=function(_0x3b3615,_0x17386d){var _0x12bdb6={'raw':![],'where':{'id':_0x3b3615['params']['id']},'include':[{'model':db[_0xa0fc('0x48')],'as':'Imap'},{'model':db[_0xa0fc('0x61')],'as':_0xa0fc('0x46')},{'model':db[_0xa0fc('0x49')],'as':'mandatoryDispositionPause'}]},_0x1ba527={};_0x1ba527['model']=_[_0xa0fc('0x52')](db[_0xa0fc('0x4c')][_0xa0fc('0x4d')]);_0x1ba527[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x3b3615[_0xa0fc('0x51')]);_0x1ba527[_0xa0fc('0x5b')]=_['intersection'](_0x1ba527['model'],_0x1ba527['query']);_0x12bdb6[_0xa0fc('0x54')]=_[_0xa0fc('0x53')](_0x1ba527['model'],qs[_0xa0fc('0x55')](_0x3b3615['query'][_0xa0fc('0x55')]));_0x12bdb6[_0xa0fc('0x54')]=_0x12bdb6[_0xa0fc('0x54')]['length']?_0x12bdb6[_0xa0fc('0x54')]:_0x1ba527[_0xa0fc('0x50')];if(_0x3b3615[_0xa0fc('0x51')][_0xa0fc('0x60')]){_0x12bdb6['include']=[{'all':!![]}];}_0x12bdb6=_[_0xa0fc('0x5d')]({},_0x12bdb6,_0x3b3615[_0xa0fc('0x5f')]);return db['MailAccount'][_0xa0fc('0x62')](_0x12bdb6)[_0xa0fc('0x13')](handleEntityNotFound(_0x17386d,null))[_0xa0fc('0x13')](respondWithResult(_0x17386d,null))[_0xa0fc('0x1d')](handleError(_0x17386d,null));};exports[_0xa0fc('0x63')]=function(_0x136a88,_0x3c98ba){if(_0x136a88[_0xa0fc('0x64')]['id']){delete _0x136a88[_0xa0fc('0x64')]['id'];}var _0x41b09f=_0x136a88[_0xa0fc('0x64')]['provider']===_0xa0fc('0x65')?null:_0x136a88[_0xa0fc('0x64')]['provider'];var _0xf198a3=_0x136a88[_0xa0fc('0x64')][_0xa0fc('0x45')]||{};var _0x5e678d=_0x136a88[_0xa0fc('0x64')]['Smtp']||{};if(_0x41b09f){_0xf198a3[_0xa0fc('0x3f')]=getImapHost(_0x41b09f);_0xf198a3[_0xa0fc('0x40')]=0x3e1;_0x5e678d['host']=getSmtpHost(_0x41b09f);_0x5e678d[_0xa0fc('0x40')]=0x24b;_0x5e678d['secure']=![];}if(_0x5e678d[_0xa0fc('0x3d')]){_0x5e678d[_0xa0fc('0x41')]=![];}else{_0x5e678d[_0xa0fc('0x3e')]=null;}if(!_0xf198a3['modernAuthentication'])_0xf198a3[_0xa0fc('0x3e')]=null;_0x136a88[_0xa0fc('0x64')][_0xa0fc('0x45')]=_0xf198a3;_0x136a88[_0xa0fc('0x64')]['Smtp']=_0x5e678d;return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x136a88[_0xa0fc('0x66')]['id']},'include':[{'model':db[_0xa0fc('0x48')],'as':_0xa0fc('0x45')},{'model':db['MailServerOut'],'as':_0xa0fc('0x46')},{'model':db['Pause'],'as':_0xa0fc('0x4a')}]})[_0xa0fc('0x13')](handleEntityNotFound(_0x3c98ba,null))[_0xa0fc('0x13')](function(_0x32d119){if(!_0x32d119)throw new Error(_0xa0fc('0x67'));if(_0x32d119[_0xa0fc('0x42')])delete _0x136a88[_0xa0fc('0x64')][_0xa0fc('0x45')];return _0x32d119;})[_0xa0fc('0x13')](saveUpdates(_0x136a88[_0xa0fc('0x64')],null))['then'](function(_0xccf7dd){if(!_0x136a88[_0xa0fc('0x64')][_0xa0fc('0x45')])return _0xccf7dd;return db[_0xa0fc('0x48')][_0xa0fc('0x63')](_0x136a88[_0xa0fc('0x64')]['Imap'],{'where':{'MailAccountId':_0xccf7dd['id']}})['then'](function(){return _0xccf7dd;});})[_0xa0fc('0x13')](function(_0x38dc12){if(!_0x136a88[_0xa0fc('0x64')]['Smtp'])return _0x38dc12;return db[_0xa0fc('0x61')][_0xa0fc('0x63')](_0x136a88[_0xa0fc('0x64')]['Smtp'],{'where':{'MailAccountId':_0x38dc12['id']}})[_0xa0fc('0x13')](function(){return _0x38dc12;});})[_0xa0fc('0x13')](respondWithResult(_0x3c98ba,null))['catch'](handleError(_0x3c98ba,null));};exports[_0xa0fc('0x68')]=function(_0x1a15bb,_0x36f8f4){return db['MailAccount'][_0xa0fc('0x68')]()[_0xa0fc('0x13')](respondWithResult(_0x36f8f4,null))[_0xa0fc('0x1d')](handleError(_0x36f8f4,null));};exports[_0xa0fc('0x69')]=function(_0x15b6ac,_0x12cc13){if(_0x15b6ac[_0xa0fc('0x64')]['id']){delete _0x15b6ac[_0xa0fc('0x64')]['id'];}return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x15b6ac[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x12cc13,null))[_0xa0fc('0x13')](function(_0x1315b3){if(_0x1315b3){_0x15b6ac['body']['MailAccountId']=_0x1315b3['id'];return db[_0xa0fc('0x6a')][_0xa0fc('0x6b')](_0x15b6ac['body']);}})[_0xa0fc('0x13')](respondWithResult(_0x12cc13,null))[_0xa0fc('0x1d')](handleError(_0x12cc13,null));};exports[_0xa0fc('0x6c')]=function(_0x260d8d,_0xa68454){var _0x3fc6d2={'raw':![],'where':{}};var _0x4b876c={};var _0x49a60b={'count':0x0,'rows':[]};return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x260d8d[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0xa68454,null))['then'](function(_0x46e826){if(_0x46e826){_0x4b876c[_0xa0fc('0x50')]=_[_0xa0fc('0x52')](db[_0xa0fc('0x6a')][_0xa0fc('0x4d')]);_0x4b876c[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x260d8d[_0xa0fc('0x51')]);_0x4b876c[_0xa0fc('0x5b')]=_[_0xa0fc('0x53')](_0x4b876c['model'],_0x4b876c['query']);_0x3fc6d2['attributes']=_['intersection'](_0x4b876c[_0xa0fc('0x50')],qs[_0xa0fc('0x55')](_0x260d8d[_0xa0fc('0x51')][_0xa0fc('0x55')]));_0x3fc6d2['attributes']=_0x3fc6d2[_0xa0fc('0x54')]['length']?_0x3fc6d2[_0xa0fc('0x54')]:_0x4b876c['model'];if(!_0x260d8d[_0xa0fc('0x51')][_0xa0fc('0x6e')](_0xa0fc('0x57'))){_0x3fc6d2[_0xa0fc('0x22')]=qs[_0xa0fc('0x22')](_0x260d8d[_0xa0fc('0x51')]['limit']);_0x3fc6d2['offset']=qs['offset'](_0x260d8d[_0xa0fc('0x51')]['offset']);}_0x3fc6d2[_0xa0fc('0x58')]=qs['sort'](_0x260d8d['query']['sort']);_0x3fc6d2[_0xa0fc('0x5a')]=qs[_0xa0fc('0x5b')](_[_0xa0fc('0x6f')](_0x260d8d['query'],_0x4b876c[_0xa0fc('0x5b')]));_0x3fc6d2[_0xa0fc('0x5a')][_0xa0fc('0x70')]=_0x46e826['id'];if(_0x260d8d[_0xa0fc('0x51')]['filter']){_0x3fc6d2[_0xa0fc('0x5a')]=_[_0xa0fc('0x5d')](_0x3fc6d2['where'],{'$or':_['map'](_0x3fc6d2['attributes'],function(_0x1214dd){var _0x5e4e4d={};_0x5e4e4d[_0x1214dd]={'$like':'%'+_0x260d8d['query'][_0xa0fc('0x5c')]+'%'};return _0x5e4e4d;})});}_0x3fc6d2=_['merge']({},_0x3fc6d2,_0x260d8d[_0xa0fc('0x5f')]);return db[_0xa0fc('0x6a')]['count']({'where':_0x3fc6d2[_0xa0fc('0x5a')]})[_0xa0fc('0x13')](function(_0x493284){_0x49a60b[_0xa0fc('0x24')]=_0x493284;if(_0x260d8d[_0xa0fc('0x51')]['includeAll']){_0x3fc6d2['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3fc6d2);})[_0xa0fc('0x13')](function(_0x3f47cf){_0x49a60b['rows']=_0x3f47cf;return _0x49a60b;});}})[_0xa0fc('0x13')](respondWithFilteredResult(_0xa68454,_0x3fc6d2))[_0xa0fc('0x1d')](handleError(_0xa68454,null));};exports['removeDispositions']=function(_0x2e9336,_0x4ec272){return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x2e9336[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x4ec272,null))[_0xa0fc('0x13')](function(_0x4eef77){if(_0x4eef77){return _0x4eef77[_0xa0fc('0x71')](_0x2e9336[_0xa0fc('0x51')][_0xa0fc('0x72')]);}})[_0xa0fc('0x13')](respondWithStatusCode(_0x4ec272,null))[_0xa0fc('0x1d')](handleError(_0x4ec272,null));};exports[_0xa0fc('0x73')]=function(_0x243ff1,_0x13aad0){if(_0x243ff1[_0xa0fc('0x64')]['id']){delete _0x243ff1['body']['id'];}return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x243ff1[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x13aad0,null))[_0xa0fc('0x13')](function(_0x47b408){if(_0x47b408){_0x243ff1[_0xa0fc('0x64')][_0xa0fc('0x70')]=_0x47b408['id'];return db[_0xa0fc('0x74')][_0xa0fc('0x6b')](_0x243ff1[_0xa0fc('0x64')]);}})[_0xa0fc('0x13')](respondWithResult(_0x13aad0,null))['catch'](handleError(_0x13aad0,null));};exports[_0xa0fc('0x75')]=function(_0x16105d,_0x34bc4c){var _0x21f998={'raw':![],'where':{}};var _0x3045b7={};var _0x289c93={'count':0x0,'rows':[]};return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x16105d[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x34bc4c,null))[_0xa0fc('0x13')](function(_0x2c6249){if(_0x2c6249){_0x3045b7[_0xa0fc('0x50')]=_[_0xa0fc('0x52')](db[_0xa0fc('0x74')][_0xa0fc('0x4d')]);_0x3045b7[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x16105d['query']);_0x3045b7['filters']=_['intersection'](_0x3045b7[_0xa0fc('0x50')],_0x3045b7[_0xa0fc('0x51')]);_0x21f998[_0xa0fc('0x54')]=_[_0xa0fc('0x53')](_0x3045b7['model'],qs['fields'](_0x16105d[_0xa0fc('0x51')]['fields']));_0x21f998[_0xa0fc('0x54')]=_0x21f998['attributes']['length']?_0x21f998['attributes']:_0x3045b7[_0xa0fc('0x50')];if(!_0x16105d[_0xa0fc('0x51')]['hasOwnProperty'](_0xa0fc('0x57'))){_0x21f998[_0xa0fc('0x22')]=qs['limit'](_0x16105d[_0xa0fc('0x51')][_0xa0fc('0x22')]);_0x21f998[_0xa0fc('0x21')]=qs[_0xa0fc('0x21')](_0x16105d[_0xa0fc('0x51')][_0xa0fc('0x21')]);}_0x21f998[_0xa0fc('0x58')]=qs[_0xa0fc('0x59')](_0x16105d[_0xa0fc('0x51')][_0xa0fc('0x59')]);_0x21f998['where']=qs[_0xa0fc('0x5b')](_[_0xa0fc('0x6f')](_0x16105d['query'],_0x3045b7['filters']));_0x21f998[_0xa0fc('0x5a')][_0xa0fc('0x70')]=_0x2c6249['id'];if(_0x16105d['query'][_0xa0fc('0x5c')]){_0x21f998[_0xa0fc('0x5a')]=_[_0xa0fc('0x5d')](_0x21f998[_0xa0fc('0x5a')],{'$or':_['map'](_0x21f998[_0xa0fc('0x54')],function(_0x4acb30){var _0x2bf02f={};_0x2bf02f[_0x4acb30]={'$like':'%'+_0x16105d['query'][_0xa0fc('0x5c')]+'%'};return _0x2bf02f;})});}_0x21f998=_[_0xa0fc('0x5d')]({},_0x21f998,_0x16105d[_0xa0fc('0x5f')]);return db[_0xa0fc('0x74')]['count']({'where':_0x21f998[_0xa0fc('0x5a')]})['then'](function(_0x39840c){_0x289c93[_0xa0fc('0x24')]=_0x39840c;if(_0x16105d[_0xa0fc('0x51')]['includeAll']){_0x21f998[_0xa0fc('0x76')]=[{'all':!![]}];}return db[_0xa0fc('0x74')][_0xa0fc('0x77')](_0x21f998);})['then'](function(_0x4e5de0){_0x289c93[_0xa0fc('0x78')]=_0x4e5de0;return _0x289c93;});}})[_0xa0fc('0x13')](respondWithFilteredResult(_0x34bc4c,_0x21f998))[_0xa0fc('0x1d')](handleError(_0x34bc4c,null));};exports[_0xa0fc('0x79')]=function(_0x1bff6f,_0x2fb8ae){return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x1bff6f[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x2fb8ae,null))[_0xa0fc('0x13')](function(_0x265b07){if(_0x265b07){return _0x265b07[_0xa0fc('0x79')](_0x1bff6f['query'][_0xa0fc('0x72')]);}})['then'](respondWithStatusCode(_0x2fb8ae,null))['catch'](handleError(_0x2fb8ae,null));};exports['create']=function(_0x42b0f8,_0x186951){var _0x3edc8a={'name':_0x42b0f8['body']['name'],'key':_0x42b0f8[_0xa0fc('0x64')][_0xa0fc('0x4f')],'provider':_0x42b0f8[_0xa0fc('0x64')][_0xa0fc('0x7a')]===_0xa0fc('0x65')?null:_0x42b0f8[_0xa0fc('0x64')]['provider'],'email':_0x42b0f8['body'][_0xa0fc('0x7b')],'ListId':_0x42b0f8['body']['ListId'],'active':!_[_0xa0fc('0x7c')](_0x42b0f8[_0xa0fc('0x64')]['active'])?_0x42b0f8[_0xa0fc('0x64')][_0xa0fc('0x7d')]:!![],'description':_0x42b0f8[_0xa0fc('0x64')][_0xa0fc('0x7e')]||null};var _0x103a4f=getAuthenticationOptions(_0x3edc8a[_0xa0fc('0x7a')],_0x42b0f8[_0xa0fc('0x64')]);_0x3edc8a[_0xa0fc('0x45')]=_0x103a4f[_0xa0fc('0x45')];_0x3edc8a[_0xa0fc('0x46')]=_0x103a4f['Smtp'];return db[_0xa0fc('0x4c')]['create'](_0x3edc8a,{'include':[{'model':db[_0xa0fc('0x61')],'as':'Smtp'},{'model':db[_0xa0fc('0x48')],'as':_0xa0fc('0x45')}]})[_0xa0fc('0x13')](function(_0x3adf89){var _0x4c2c15=_0x42b0f8[_0xa0fc('0x3a')][_0xa0fc('0x27')]({'plain':!![]});if(!_0x4c2c15)throw new Error(_0xa0fc('0x7f'));if(_0x4c2c15[_0xa0fc('0x80')]===_0xa0fc('0x3a')){var _0x18cc8b=_0x3adf89[_0xa0fc('0x27')]({'plain':!![]});return db[_0xa0fc('0x81')][_0xa0fc('0x62')]({'where':{'name':_0xa0fc('0x28'),'userProfileId':_0x4c2c15['userProfileId']},'raw':!![]})[_0xa0fc('0x13')](function(_0x4ab240){if(_0x4ab240&&_0x4ab240[_0xa0fc('0x82')]===0x0){return db[_0xa0fc('0x83')][_0xa0fc('0x6b')]({'name':_0x18cc8b[_0xa0fc('0x2b')],'resourceId':_0x18cc8b['id'],'type':_0x4ab240['name'],'sectionId':_0x4ab240['id']},{})[_0xa0fc('0x13')](function(){return _0x3adf89;});}else{return _0x3adf89;}})[_0xa0fc('0x1d')](function(_0x30cb31){logger[_0xa0fc('0x19')](_0xa0fc('0x84'),_0x30cb31);throw _0x30cb31;});}return _0x3adf89;})[_0xa0fc('0x13')](respondWithResult(_0x186951,0xc9))[_0xa0fc('0x1d')](handleError(_0x186951,null));};exports[_0xa0fc('0x85')]=function(_0x48a359,_0x50c036){return db['MailAccount'][_0xa0fc('0x6d')]({'where':{'id':_0x48a359[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x50c036,null))[_0xa0fc('0x13')](function(_0x140b0b){if(_0x140b0b){return _0x140b0b['getImap']();}return null;})[_0xa0fc('0x13')](respondWithResult(_0x50c036,null))['catch'](handleError(_0x50c036,null));};exports[_0xa0fc('0x86')]=function(_0x5a5f43,_0xbf3c27){if(_0x5a5f43['body']['id']){delete _0x5a5f43[_0xa0fc('0x64')]['id'];}return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x5a5f43[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0xbf3c27,null))[_0xa0fc('0x13')](function(_0x570729){if(_0x570729){_0x5a5f43[_0xa0fc('0x64')][_0xa0fc('0x70')]=_0x570729['id'];return db[_0xa0fc('0x48')][_0xa0fc('0x6b')](_0x5a5f43['body']);}})[_0xa0fc('0x13')](respondWithResult(_0xbf3c27,null))['catch'](handleError(_0xbf3c27,null));};exports['removeImap']=function(_0x691e91,_0x16553c){return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x691e91[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x16553c,null))[_0xa0fc('0x13')](function(_0x5eaaf6){if(_0x5eaaf6){return _0x5eaaf6[_0xa0fc('0x87')](null);}return null;})[_0xa0fc('0x13')](respondWithStatusCode(_0x16553c,null))[_0xa0fc('0x1d')](handleError(_0x16553c,null));};exports[_0xa0fc('0x88')]=function(_0x363d52,_0x23360e){return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x363d52[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x23360e,null))[_0xa0fc('0x13')](function(_0x516970){if(_0x516970){return _0x516970[_0xa0fc('0x88')]();}return null;})[_0xa0fc('0x13')](respondWithResult(_0x23360e,null))[_0xa0fc('0x1d')](handleError(_0x23360e,null));};exports['addSmtp']=function(_0x45cf6f,_0x345909){if(_0x45cf6f[_0xa0fc('0x64')]['id']){delete _0x45cf6f[_0xa0fc('0x64')]['id'];}return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x45cf6f[_0xa0fc('0x66')]['id']}})['then'](handleEntityNotFound(_0x345909,null))[_0xa0fc('0x13')](function(_0xdd79eb){if(_0xdd79eb){_0x45cf6f[_0xa0fc('0x64')][_0xa0fc('0x70')]=_0xdd79eb['id'];return db['MailServerOut'][_0xa0fc('0x6b')](_0x45cf6f[_0xa0fc('0x64')]);}})[_0xa0fc('0x13')](respondWithResult(_0x345909,null))[_0xa0fc('0x1d')](handleError(_0x345909,null));};exports[_0xa0fc('0x89')]=function(_0x589293,_0x1f79de){return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x589293[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x1f79de,null))['then'](function(_0x319863){if(_0x319863){return _0x319863[_0xa0fc('0x8a')](null);}return null;})[_0xa0fc('0x13')](respondWithStatusCode(_0x1f79de,null))['catch'](handleError(_0x1f79de,null));};exports['addInteraction']=function(_0x26f778,_0x4e7fc1){return db[_0xa0fc('0x8b')][_0xa0fc('0x62')]({'where':{'id':_0x26f778[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x4e7fc1,null))[_0xa0fc('0x13')](function(_0x110e81){if(_0x110e81){return _0x110e81[_0xa0fc('0x8c')](_0x26f778['body']['ids'],_[_0xa0fc('0x8d')](_0x26f778['body'],[_0xa0fc('0x72'),'id'])||{});}})[_0xa0fc('0x13')](respondWithResult(_0x4e7fc1,null))[_0xa0fc('0x1d')](handleError(_0x4e7fc1,null));};exports[_0xa0fc('0x8e')]=function(_0x5cde79,_0x5747c1){var _0x3f0fc1={'raw':![],'where':{}};var _0x4d216e={};var _0x9b8f56={'count':0x0,'rows':[]};return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x5cde79['params']['id']}})['then'](handleEntityNotFound(_0x5747c1,null))[_0xa0fc('0x13')](function(_0x56df73){if(_0x56df73){_0x4d216e[_0xa0fc('0x50')]=_[_0xa0fc('0x52')](db[_0xa0fc('0x8b')][_0xa0fc('0x4d')]);_0x4d216e[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x5cde79['query']);_0x4d216e[_0xa0fc('0x5b')]=_['intersection'](_0x4d216e[_0xa0fc('0x50')],_0x4d216e['query']);_0x3f0fc1['attributes']=_[_0xa0fc('0x53')](_0x4d216e['model'],qs[_0xa0fc('0x55')](_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x55')]));_0x3f0fc1[_0xa0fc('0x54')]=_0x3f0fc1[_0xa0fc('0x54')]['length']?_0x3f0fc1[_0xa0fc('0x54')]:_0x4d216e[_0xa0fc('0x50')];if(!_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x6e')](_0xa0fc('0x57'))){_0x3f0fc1[_0xa0fc('0x22')]=qs['limit'](_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x22')]);_0x3f0fc1[_0xa0fc('0x21')]=qs[_0xa0fc('0x21')](_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x21')]);}_0x3f0fc1[_0xa0fc('0x58')]=qs['sort'](_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x59')]);_0x3f0fc1['where']=qs['filters'](_['pick'](_0x5cde79[_0xa0fc('0x51')],_0x4d216e['filters']));_0x3f0fc1[_0xa0fc('0x5a')][_0xa0fc('0x70')]=_0x56df73['id'];if(_0x5cde79['query'][_0xa0fc('0x5c')]){_0x3f0fc1[_0xa0fc('0x5a')]=_[_0xa0fc('0x5d')](_0x3f0fc1[_0xa0fc('0x5a')],{'$or':_['map'](_0x3f0fc1[_0xa0fc('0x54')],function(_0x2bb3b0){var _0xd54c25={};_0xd54c25[_0x2bb3b0]={'$like':'%'+_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x5c')]+'%'};return _0xd54c25;})});}_0x3f0fc1=_['merge']({},_0x3f0fc1,_0x5cde79[_0xa0fc('0x5f')]);return db[_0xa0fc('0x8b')][_0xa0fc('0x24')]({'where':_0x3f0fc1[_0xa0fc('0x5a')]})['then'](function(_0x56c0af){_0x9b8f56[_0xa0fc('0x24')]=_0x56c0af;if(_0x5cde79['query'][_0xa0fc('0x60')]){_0x3f0fc1[_0xa0fc('0x76')]=[{'model':db[_0xa0fc('0x8f')],'as':'Contact','required':![]},{'model':db[_0xa0fc('0x90')],'as':_0xa0fc('0x91'),'attributes':[_0xa0fc('0x2b'),'fullname',_0xa0fc('0x92')],'required':![]},{'model':db[_0xa0fc('0x93')],'as':_0xa0fc('0x94'),'attributes':['id',_0xa0fc('0x2b'),'color'],'where':_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x95')]?{'id':_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x95')]}:undefined,'required':_0x5cde79[_0xa0fc('0x51')][_0xa0fc('0x95')]?!![]:![]}];}return db[_0xa0fc('0x8b')][_0xa0fc('0x77')](_0x3f0fc1);})[_0xa0fc('0x13')](function(_0x24b32f){_0x9b8f56[_0xa0fc('0x78')]=_0x24b32f;return _0x9b8f56;});}})[_0xa0fc('0x13')](respondWithFilteredResult(_0x5747c1,_0x3f0fc1))[_0xa0fc('0x1d')](handleError(_0x5747c1,null));};exports['addApplications']=function addApplications(_0x22b3bc,_0x7d9aea){var _0x1dc892=_0x22b3bc['params']['id'];var _0x1ea9c2=_0x22b3bc['body'];var _0x105912=0xc8;var _0x544320=null;return db[_0xa0fc('0x96')][_0xa0fc('0x97')]({'isolationLevel':db['sequelize'][_0xa0fc('0x98')][_0xa0fc('0x99')][_0xa0fc('0x9a')]},function(_0x49119d){return db['MailAccount']['findOne']({'where':{'id':_0x1dc892},'transaction':_0x49119d})[_0xa0fc('0x13')](function(_0x4c8531){if(_0x4c8531){return db[_0xa0fc('0x9b')][_0xa0fc('0x26')]({'where':{'MailAccountId':_0x1dc892},'transaction':_0x49119d})[_0xa0fc('0x13')](function(){var _0x519d7c=_[_0xa0fc('0x4b')](_0x1ea9c2,function(_0x19278c){_0x19278c[_0xa0fc('0x70')]=_0x1dc892;return _0x19278c;});return db[_0xa0fc('0x9b')]['bulkCreate'](_0x519d7c,{'transaction':_0x49119d});});}else{_0x105912=0x194;_0x544320=[];}});})[_0xa0fc('0x13')](function(){if(_0x105912!==0x194){return db[_0xa0fc('0x9b')][_0xa0fc('0x9c')]({'where':{'MailAccountId':_0x1dc892},'order':'priority'})[_0xa0fc('0x13')](function(_0x5c0d03){_0x544320=_0x5c0d03;});}})[_0xa0fc('0x1d')](function(_0x496728){_0x105912=0x1f4;logger[_0xa0fc('0x19')](_0x496728[_0xa0fc('0x2a')]);if(_0x496728['name']){delete _0x496728[_0xa0fc('0x2b')];}_0x544320=_0x496728;})['finally'](function(){if(_0x544320===null){_0x7d9aea[_0xa0fc('0x29')](_0x105912);}else{if(_0x105912===0x1f4){_0x7d9aea[_0xa0fc('0x1f')](_0x105912)[_0xa0fc('0x2c')](_0x544320);}else{_0x7d9aea[_0xa0fc('0x1f')](_0x105912)[_0xa0fc('0x20')](_0x544320);}}});};exports[_0xa0fc('0x9d')]=function(_0x27e06e,_0x4ec4ca){var _0x497ee4={};var _0x30fdff={};var _0x12c65c;var _0x4537a2;return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x27e06e['params']['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x4ec4ca,null))[_0xa0fc('0x13')](function(_0x20a1cb){if(_0x20a1cb){_0x12c65c=_0x20a1cb;_0x30fdff[_0xa0fc('0x50')]=_[_0xa0fc('0x52')](db[_0xa0fc('0x9b')][_0xa0fc('0x4d')]);_0x30fdff['query']=_[_0xa0fc('0x52')](_0x27e06e[_0xa0fc('0x51')]);_0x30fdff['filters']=_[_0xa0fc('0x53')](_0x30fdff[_0xa0fc('0x50')],_0x30fdff[_0xa0fc('0x51')]);_0x497ee4[_0xa0fc('0x54')]=_['intersection'](_0x30fdff[_0xa0fc('0x50')],qs['fields'](_0x27e06e[_0xa0fc('0x51')][_0xa0fc('0x55')]));_0x497ee4[_0xa0fc('0x54')]=_0x497ee4[_0xa0fc('0x54')]['length']?_0x497ee4['attributes']:_0x30fdff[_0xa0fc('0x50')];_0x497ee4[_0xa0fc('0x58')]=qs[_0xa0fc('0x59')](_0x27e06e[_0xa0fc('0x51')]['sort']);_0x497ee4['where']=qs[_0xa0fc('0x5b')](_[_0xa0fc('0x6f')](_0x27e06e[_0xa0fc('0x51')],_0x30fdff[_0xa0fc('0x5b')]));if(_0x27e06e[_0xa0fc('0x51')][_0xa0fc('0x5c')]){_0x497ee4['where']=_[_0xa0fc('0x5d')](_0x497ee4[_0xa0fc('0x5a')],{'$or':_[_0xa0fc('0x4b')](_0x497ee4[_0xa0fc('0x54')],function(_0x35a4e2){var _0x1f24b9={};_0x1f24b9[_0x35a4e2]={'$like':'%'+_0x27e06e['query']['filter']+'%'};return _0x1f24b9;})});}_0x497ee4=_['merge']({},_0x497ee4,_0x27e06e[_0xa0fc('0x5f')]);return _0x12c65c[_0xa0fc('0x9d')](_0x497ee4);}})['then'](function(_0x269c4a){if(_0x269c4a){_0x4537a2=_0x269c4a[_0xa0fc('0x56')];if(!_0x27e06e[_0xa0fc('0x51')][_0xa0fc('0x6e')]('nolimit')){_0x497ee4[_0xa0fc('0x22')]=qs['limit'](_0x27e06e[_0xa0fc('0x51')][_0xa0fc('0x22')]);_0x497ee4[_0xa0fc('0x21')]=qs[_0xa0fc('0x21')](_0x27e06e[_0xa0fc('0x51')][_0xa0fc('0x21')]);}return _0x12c65c[_0xa0fc('0x9d')](_0x497ee4);}})[_0xa0fc('0x13')](function(_0x57c636){if(_0x57c636){return _0x57c636?{'count':_0x4537a2,'rows':_0x57c636}:null;}})[_0xa0fc('0x13')](respondWithResult(_0x4ec4ca,null))[_0xa0fc('0x1d')](handleError(_0x4ec4ca,null));};exports[_0xa0fc('0x9e')]=function(_0x3f381f,_0x51ac65){var _0x8594f0={'raw':!![],'where':{}};var _0x76127b={};var _0x472440={'count':0x0,'rows':[]};return db[_0xa0fc('0x4c')]['findOne']({'where':{'id':_0x3f381f[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x51ac65,null))['then'](function(_0x445271){if(_0x445271){_0x76127b[_0xa0fc('0x50')]=_[_0xa0fc('0x52')](db[_0xa0fc('0x9f')][_0xa0fc('0x4d')]);_0x76127b[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x3f381f[_0xa0fc('0x51')]);_0x76127b[_0xa0fc('0x5b')]=_['intersection'](_0x76127b[_0xa0fc('0x50')],_0x76127b[_0xa0fc('0x51')]);_0x8594f0[_0xa0fc('0x54')]=_[_0xa0fc('0x53')](_0x76127b['model'],qs[_0xa0fc('0x55')](_0x3f381f[_0xa0fc('0x51')]['fields']));_0x8594f0[_0xa0fc('0x54')]=_0x8594f0[_0xa0fc('0x54')]['length']?_0x8594f0['attributes']:_0x76127b[_0xa0fc('0x50')];if(!_0x3f381f['query'][_0xa0fc('0x6e')](_0xa0fc('0x57'))){_0x8594f0[_0xa0fc('0x22')]=qs[_0xa0fc('0x22')](_0x3f381f[_0xa0fc('0x51')][_0xa0fc('0x22')]);_0x8594f0[_0xa0fc('0x21')]=qs[_0xa0fc('0x21')](_0x3f381f[_0xa0fc('0x51')]['offset']);}_0x8594f0[_0xa0fc('0x58')]=qs['sort'](_0x3f381f['query'][_0xa0fc('0x59')]);_0x8594f0[_0xa0fc('0x5a')]=qs[_0xa0fc('0x5b')](_[_0xa0fc('0x6f')](_0x3f381f[_0xa0fc('0x51')],_0x76127b[_0xa0fc('0x5b')]));_0x8594f0[_0xa0fc('0x5a')]['MailAccountId']=_0x445271['id'];if(_0x3f381f[_0xa0fc('0x51')][_0xa0fc('0x5c')]){_0x8594f0[_0xa0fc('0x5a')]=_[_0xa0fc('0x5d')](_0x8594f0[_0xa0fc('0x5a')],{'$or':_[_0xa0fc('0x4b')](_0x8594f0[_0xa0fc('0x54')],function(_0x43abf6){var _0x708fa9={};_0x708fa9[_0x43abf6]={'$like':'%'+_0x3f381f[_0xa0fc('0x51')]['filter']+'%'};return _0x708fa9;})});}if(_0x3f381f[_0xa0fc('0x51')]['$gte']){var _0x5a895f=_0x3f381f[_0xa0fc('0x51')][_0xa0fc('0xa0')][_0xa0fc('0xa1')](',');var _0x5e6533={};_0x5e6533[_0x5a895f[0x0]]={'$gte':moment(_0x5a895f[0x1])[_0xa0fc('0xa2')](_0xa0fc('0xa3'))};_0x8594f0['where']=_[_0xa0fc('0x5d')](_0x8594f0[_0xa0fc('0x5a')],_0x5e6533);}_0x8594f0=_['merge']({},_0x8594f0,_0x3f381f['options']);return db[_0xa0fc('0x9f')][_0xa0fc('0x24')]({'where':_0x8594f0[_0xa0fc('0x5a')]})['then'](function(_0x3a6b4d){_0x472440['count']=_0x3a6b4d;if(_0x3f381f['query'][_0xa0fc('0x60')]){_0x8594f0[_0xa0fc('0x76')]=[{'all':!![]}];}return db[_0xa0fc('0x9f')][_0xa0fc('0x77')](_0x8594f0);})[_0xa0fc('0x13')](function(_0x295242){if(_0x3f381f[_0xa0fc('0x51')][_0xa0fc('0xa4')]===_0xa0fc('0xa5')){for(var _0x59be9d=0x0;_0x59be9d<_0x295242[_0xa0fc('0x56')];_0x59be9d++){_0x295242[_0x59be9d][_0xa0fc('0x64')]=juice(_0x295242[_0x59be9d][_0xa0fc('0x64')]);}}_0x472440[_0xa0fc('0x78')]=_0x295242;return _0x472440;});}})[_0xa0fc('0x13')](respondWithFilteredResult(_0x51ac65,_0x8594f0))['catch'](handleError(_0x51ac65,null));};exports[_0xa0fc('0x2c')]=function(_0x4f6807,_0x3d14fa){var _0x4c4e08,_0x3e0578={},_0x5a3a63;if(_0x4f6807[_0xa0fc('0x64')]['to']){_0x5a3a63=_0x4f6807['body']['to'][_0xa0fc('0xa1')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x4f6807['params']['id']},'include':[{'model':db[_0xa0fc('0xa6')],'as':'List','include':[{'model':db['CmContact'],'as':_0xa0fc('0xa7'),'where':{'email':_0x5a3a63},'limit':0x1,'order':[[_0xa0fc('0xa8'),_0xa0fc('0xa9')]]}]},{'model':db[_0xa0fc('0x61')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa0fc('0xaa'),'raw':!![]}]}]})[_0xa0fc('0x13')](handleEntityNotFound(_0x3d14fa,null))['then'](function(_0x4b5840){if(!_0x4b5840)return;_0x4c4e08=_0x4b5840;if(!_0x4b5840[_0xa0fc('0x46')])throw new Error(_0xa0fc('0xab'));if(_[_0xa0fc('0x7c')](_0x4f6807['body'][_0xa0fc('0xac')])){_0x4f6807['body'][_0xa0fc('0xac')]=util[_0xa0fc('0xa2')](_0xa0fc('0xad'),_0x4b5840[_0xa0fc('0x2b')],_0x4b5840['email']||_0x4b5840[_0xa0fc('0x46')][_0xa0fc('0x3a')]);}if(_0x4f6807[_0xa0fc('0x64')][_0xa0fc('0xae')]&&_0x4f6807['body'][_0xa0fc('0xae')]['length']){for(var _0x211922=0x0;_0x211922<_0x4f6807[_0xa0fc('0x64')][_0xa0fc('0xae')]['length'];_0x211922+=0x1){_0x4f6807[_0xa0fc('0x64')][_0xa0fc('0xae')][_0x211922]={'filename':_0x4f6807[_0xa0fc('0x64')][_0xa0fc('0xae')][_0x211922][_0xa0fc('0x2b')],'path':path['join'](config[_0xa0fc('0xaf')],_0xa0fc('0xb0'),_0x4f6807[_0xa0fc('0x64')][_0xa0fc('0xae')][_0x211922][_0xa0fc('0xb1')])};}}var _0x29bbc7=_0x4b5840[_0xa0fc('0xb2')]();return respondWithRpcPromise(_0xa0fc('0xb3'),'sendMail',{'account':_0x29bbc7,'message':_0x4f6807[_0xa0fc('0x64')]});})['then'](function(_0xb24253){if(!_0xb24253)return;_0x3e0578=_0xb24253;if(!_0x4c4e08[_0xa0fc('0xb4')])throw new Error(_0xa0fc('0xb5'));if(_0x4c4e08[_0xa0fc('0xb4')][_0xa0fc('0xa7')][_0xa0fc('0x56')])return _0x4c4e08['List'][_0xa0fc('0xa7')][0x0];return db[_0xa0fc('0x8f')][_0xa0fc('0x6b')](_[_0xa0fc('0xb')](_0x4f6807[_0xa0fc('0x64')],{'firstName':_0x4f6807['body']['to'],'email':_0x4f6807[_0xa0fc('0x64')]['to'],'phone':_0x4f6807[_0xa0fc('0x64')]['to'],'ListId':_0x4c4e08['ListId']}));})['then'](function(_0x4f74b6){if(!_0x4f74b6)return;var _0xd1d9ad={'UserId':_0x4f6807[_0xa0fc('0x3a')]['id'],'ContactId':_0x4f74b6['id'],'MailAccountId':_0x4c4e08['id'],'inReplyTo':_0x3e0578['messageId'],'to':_0x4f6807['body'][_0xa0fc('0xac')],'cc':_0x4f6807[_0xa0fc('0x64')]['cc'],'subject':_0x4f6807[_0xa0fc('0x64')][_0xa0fc('0xb6')],'attach':_0x4f6807[_0xa0fc('0x64')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xa0fc('0xa2')](_0xa0fc('0xa3')),'lastMsgDirection':'out','Messages':[_[_0xa0fc('0x5d')](_0x4f6807[_0xa0fc('0x64')],{'messageId':_0x3e0578[_0xa0fc('0xb7')],'sentAt':moment()[_0xa0fc('0xa2')](_0xa0fc('0xa3')),'read':!![],'MailAccountId':_0x4c4e08['id'],'UserId':_0x4f6807[_0xa0fc('0x3a')]['id'],'ContactId':_0x4f74b6['id']})]};if(_0x4f6807['body'][_0xa0fc('0xb8')]){_0xd1d9ad=_['merge'](_0xd1d9ad,_0x4f6807['body'][_0xa0fc('0xb8')]);}return db['MailInteraction']['create'](_0xd1d9ad,{'include':[{'model':db[_0xa0fc('0x9f')],'as':'Messages'}]});})['then'](respondWithResult(_0x3d14fa,null))[_0xa0fc('0x1d')](handleError(_0x3d14fa,null));};exports['verifySmtp']=function(_0x1c58b5,_0x384470){return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x1c58b5[_0xa0fc('0x66')]['id']},'include':[{'model':db[_0xa0fc('0x61')],'as':_0xa0fc('0x46'),'raw':!![],'include':[{'model':db[_0xa0fc('0xaa')],'as':_0xa0fc('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x384470,null))[_0xa0fc('0x13')](function(_0x38dbd4){if(!_0x38dbd4[_0xa0fc('0x46')])return;var _0x199489=_0x38dbd4[_0xa0fc('0xb2')]();return respondWithRpcPromise(_0xa0fc('0xb9'),_0xa0fc('0xba'),{'account':_0x199489});})[_0xa0fc('0x13')](respondWithResult(_0x384470,null))[_0xa0fc('0x1d')](handleError(_0x384470,null));};exports[_0xa0fc('0x26')]=function(_0x44bd07,_0x2f9f92){return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x44bd07['params']['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x2f9f92,null))[_0xa0fc('0x13')](function(_0x223d46){if(_0x223d46&&_0x223d46[_0xa0fc('0x42')]){throw new db[(_0xa0fc('0xbb'))][(_0xa0fc('0xbc'))](_0xa0fc('0xbd'));}return _0x223d46;})[_0xa0fc('0x13')](removeEntity(_0x2f9f92,null))[_0xa0fc('0x1d')](handleError(_0x2f9f92,null));};exports[_0xa0fc('0xbe')]=function(_0x5a84db,_0x2cb53d){return db[_0xa0fc('0x4c')][_0xa0fc('0x62')]({'where':{'id':_0x5a84db['params']['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x2cb53d,null))[_0xa0fc('0x13')](function(_0x4ed204){if(_0x4ed204){return _0x4ed204[_0xa0fc('0xbe')](_0x5a84db[_0xa0fc('0x64')][_0xa0fc('0x72')],_[_0xa0fc('0x8d')](_0x5a84db[_0xa0fc('0x64')],['ids','id'])||{})[_0xa0fc('0xbf')](function(_0x5c0abb){for(var _0x58f39d=0x0;_0x58f39d<_0x5a84db['body'][_0xa0fc('0x72')][_0xa0fc('0x56')];_0x58f39d+=0x1){socket[_0xa0fc('0xc0')](_0xa0fc('0xc1'),{'UserId':Number(_0x5a84db['body'][_0xa0fc('0x72')][_0x58f39d]),'MailAccountId':Number(_0x5a84db[_0xa0fc('0x66')]['id'])});}return _0x5c0abb;});}})[_0xa0fc('0x13')](respondWithResult(_0x2cb53d,null))[_0xa0fc('0x1d')](handleError(_0x2cb53d,null));};exports[_0xa0fc('0xc2')]=function(_0x265b8e,_0xe3ac0d){return db['MailAccount'][_0xa0fc('0x62')]({'where':{'id':_0x265b8e[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0xe3ac0d,null))[_0xa0fc('0x13')](function(_0xc41ae5){if(_0xc41ae5){return _0xc41ae5['removeAgents'](_0x265b8e[_0xa0fc('0x51')][_0xa0fc('0x72')])['then'](function(){if(_['isArray'](_0x265b8e[_0xa0fc('0x51')][_0xa0fc('0x72')])){for(var _0x5c5ba4=0x0;_0x5c5ba4<_0x265b8e[_0xa0fc('0x51')][_0xa0fc('0x72')][_0xa0fc('0x56')];_0x5c5ba4+=0x1){socket[_0xa0fc('0xc0')](_0xa0fc('0xc3'),{'UserId':Number(_0x265b8e['query'][_0xa0fc('0x72')][_0x5c5ba4]),'MailAccountId':Number(_0x265b8e[_0xa0fc('0x66')]['id'])});}}else{socket['emit'](_0xa0fc('0xc3'),{'UserId':Number(_0x265b8e[_0xa0fc('0x51')][_0xa0fc('0x72')]),'MailAccountId':Number(_0x265b8e[_0xa0fc('0x66')]['id'])});}});}})[_0xa0fc('0x13')](respondWithStatusCode(_0xe3ac0d,null))['catch'](handleError(_0xe3ac0d,null));};exports[_0xa0fc('0xc4')]=function(_0x44dde4,_0x9c5db9){var _0x8c1daa={};var _0x34f46e={};var _0x163b4a;var _0x534dde;return db[_0xa0fc('0x4c')][_0xa0fc('0x6d')]({'where':{'id':_0x44dde4[_0xa0fc('0x66')]['id']}})[_0xa0fc('0x13')](handleEntityNotFound(_0x9c5db9,null))[_0xa0fc('0x13')](function(_0x81f96a){if(_0x81f96a){_0x163b4a=_0x81f96a;_0x34f46e[_0xa0fc('0x50')]=_[_0xa0fc('0x52')](db[_0xa0fc('0x90')][_0xa0fc('0x4d')]);_0x34f46e[_0xa0fc('0x51')]=_[_0xa0fc('0x52')](_0x44dde4[_0xa0fc('0x51')]);_0x34f46e[_0xa0fc('0x5b')]=_[_0xa0fc('0x53')](_0x34f46e['model'],_0x34f46e[_0xa0fc('0x51')]);_0x8c1daa[_0xa0fc('0x54')]=_[_0xa0fc('0x53')](_0x34f46e[_0xa0fc('0x50')],qs[_0xa0fc('0x55')](_0x44dde4[_0xa0fc('0x51')]['fields']));_0x8c1daa[_0xa0fc('0x54')]=_0x8c1daa[_0xa0fc('0x54')]['length']?_0x8c1daa['attributes']:_0x34f46e['model'];_0x8c1daa[_0xa0fc('0x58')]=qs[_0xa0fc('0x59')](_0x44dde4[_0xa0fc('0x51')][_0xa0fc('0x59')]);_0x8c1daa['where']=qs[_0xa0fc('0x5b')](_[_0xa0fc('0x6f')](_0x44dde4[_0xa0fc('0x51')],_0x34f46e[_0xa0fc('0x5b')]));if(_0x44dde4[_0xa0fc('0x51')]['filter']){_0x8c1daa[_0xa0fc('0x5a')]=_['merge'](_0x8c1daa['where'],{'$or':_[_0xa0fc('0x4b')](_0x8c1daa['attributes'],function(_0x4da8e1){var _0x1e6ad1={};_0x1e6ad1[_0x4da8e1]={'$like':'%'+_0x44dde4[_0xa0fc('0x51')]['filter']+'%'};return _0x1e6ad1;})});}_0x8c1daa=_['merge']({},_0x8c1daa,_0x44dde4[_0xa0fc('0x5f')]);return _0x163b4a[_0xa0fc('0xc4')](_0x8c1daa);}})['then'](function(_0x355e23){if(_0x355e23){_0x534dde=_0x355e23[_0xa0fc('0x56')];if(!_0x44dde4[_0xa0fc('0x51')]['hasOwnProperty'](_0xa0fc('0x57'))){_0x8c1daa[_0xa0fc('0x22')]=qs['limit'](_0x44dde4[_0xa0fc('0x51')][_0xa0fc('0x22')]);_0x8c1daa[_0xa0fc('0x21')]=qs[_0xa0fc('0x21')](_0x44dde4[_0xa0fc('0x51')][_0xa0fc('0x21')]);}return _0x163b4a['getAgents'](_0x8c1daa);}})[_0xa0fc('0x13')](function(_0x431039){if(_0x431039){return _0x431039?{'count':_0x534dde,'rows':_0x431039}:null;}})[_0xa0fc('0x13')](respondWithResult(_0x9c5db9,null))[_0xa0fc('0x1d')](handleError(_0x9c5db9,null));}; \ No newline at end of file +var _0xedd5=['attach','out','Interaction','verifySmtp','CloudProvider','VerifySmtp','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','moment','util','path','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','get','MailAccounts','end','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','include','rows','show','Pause','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','hasOwnProperty','MailAccountId','findAll','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','key','email','ListId','active','description','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','CmContact','Contacts','updatedAt','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','messageId','subject'];(function(_0x2e2393,_0x1d2474){var _0x548b33=function(_0x105522){while(--_0x105522){_0x2e2393['push'](_0x2e2393['shift']());}};_0x548b33(++_0x1d2474);}(_0xedd5,0x18f));var _0x5edd=function(_0x460358,_0x45d45e){_0x460358=_0x460358-0x0;var _0x2e6a60=_0xedd5[_0x460358];return _0x2e6a60;};'use strict';var moment=require(_0x5edd('0x0'));var BPromise=require('bluebird');var util=require(_0x5edd('0x1'));var path=require(_0x5edd('0x2'));var _=require('lodash');var juice=require(_0x5edd('0x3'));var Redis=require('ioredis');var qs=require(_0x5edd('0x4'));var logger=require('../../config/logger')(_0x5edd('0x5'));var config=require(_0x5edd('0x6'));var db=require(_0x5edd('0x7'))['db'];config[_0x5edd('0x8')]=_[_0x5edd('0x9')](config['redis'],{'host':_0x5edd('0xa'),'port':0x18eb});var socket=require(_0x5edd('0xb'))(new Redis(config[_0x5edd('0x8')]));require(_0x5edd('0xc'))['register'](socket);var jayson=require(_0x5edd('0xd'));var client=jayson['client'][_0x5edd('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x531a3b,_0x5f241d,_0x4a4b97,_0x158406){return new BPromise(function(_0x21bedf,_0xb4513d){var _0x3dd543=_0x158406||client;return _0x3dd543[_0x5edd('0xf')](_0x531a3b,_0x4a4b97)[_0x5edd('0x10')](function(_0x3f0245){logger[_0x5edd('0x11')](_0x5edd('0x12'),_0x5f241d,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x5f241d,'request\x20sent',JSON[_0x5edd('0x13')](_0x3f0245));if(_0x3f0245[_0x5edd('0x14')]){if(_0x3f0245[_0x5edd('0x14')][_0x5edd('0x15')]===0x1f4){logger[_0x5edd('0x14')](_0x5edd('0x12'),_0x5f241d,_0x3f0245[_0x5edd('0x14')][_0x5edd('0x16')]);return _0xb4513d(_0x3f0245['error'][_0x5edd('0x16')]);}logger[_0x5edd('0x14')](_0x5edd('0x12'),_0x5f241d,_0x3f0245[_0x5edd('0x14')][_0x5edd('0x16')]);return _0x21bedf(_0x3f0245[_0x5edd('0x14')][_0x5edd('0x16')]);}else{logger[_0x5edd('0x11')](_0x5edd('0x12'),_0x5f241d,_0x5edd('0x17'));_0x21bedf(_0x3f0245[_0x5edd('0x18')][_0x5edd('0x16')]);}})[_0x5edd('0x19')](function(_0x32659b){logger[_0x5edd('0x14')](_0x5edd('0x12'),_0x5f241d,_0x32659b);_0xb4513d(_0x32659b);});});}function respondWithStatusCode(_0x5a9898,_0x3780ee){_0x3780ee=_0x3780ee||0xcc;return function(_0x49afa9){if(_0x49afa9){return _0x5a9898[_0x5edd('0x1a')](_0x3780ee);}return _0x5a9898[_0x5edd('0x1b')](_0x3780ee)['end']();};}function respondWithResult(_0xc437f7,_0x4e19fc){_0x4e19fc=_0x4e19fc||0xc8;return function(_0x3b65d5){if(_0x3b65d5){return _0xc437f7[_0x5edd('0x1b')](_0x4e19fc)[_0x5edd('0x1c')](_0x3b65d5);}};}function respondWithFilteredResult(_0x4b26d4,_0x5efe3b){return function(_0x63b17a){if(_0x63b17a){var _0x328f2b=typeof _0x5efe3b[_0x5edd('0x1d')]===_0x5edd('0x1e')&&typeof _0x5efe3b[_0x5edd('0x1f')]===_0x5edd('0x1e');var _0x4e760b=_0x63b17a[_0x5edd('0x20')];var _0x5c997=_0x328f2b?0x0:_0x5efe3b[_0x5edd('0x1d')];var _0xb46efb=_0x328f2b?_0x63b17a[_0x5edd('0x20')]:_0x5efe3b[_0x5edd('0x1d')]+_0x5efe3b[_0x5edd('0x1f')];var _0x447f86;if(_0xb46efb>=_0x4e760b){_0xb46efb=_0x4e760b;_0x447f86=0xc8;}else{_0x447f86=0xce;}_0x4b26d4['status'](_0x447f86);return _0x4b26d4[_0x5edd('0x21')]('Content-Range',_0x5c997+'-'+_0xb46efb+'/'+_0x4e760b)[_0x5edd('0x1c')](_0x63b17a);}return null;};}function saveUpdates(_0x595a96){return function(_0x57f9f5){if(_0x57f9f5){return _0x57f9f5[_0x5edd('0x22')](_0x595a96)['then'](function(_0x4e700f){return _0x4e700f;});}return null;};}function removeEntity(_0xd70ecc){return function(_0x4a4cfc){if(_0x4a4cfc){return _0x4a4cfc[_0x5edd('0x23')]()['then'](function(){var _0x6299d6=_0x4a4cfc[_0x5edd('0x24')]({'plain':!![]});var _0x239c11=_0x5edd('0x25');return db['UserProfileResource'][_0x5edd('0x23')]({'where':{'type':_0x239c11,'resourceId':_0x6299d6['id']}})[_0x5edd('0x10')](function(){return _0x4a4cfc;});})[_0x5edd('0x10')](function(){_0xd70ecc[_0x5edd('0x1b')](0xcc)[_0x5edd('0x26')]();});}};}function handleEntityNotFound(_0x324f6a){return function(_0x1de687){if(!_0x1de687){_0x324f6a[_0x5edd('0x1a')](0x194);}return _0x1de687;};}function handleError(_0x333b22,_0x560da2){_0x560da2=_0x560da2||0x1f4;return function(_0x2314bb){logger['error'](_0x2314bb[_0x5edd('0x27')]);if(_0x2314bb[_0x5edd('0x28')]){delete _0x2314bb[_0x5edd('0x28')];}_0x333b22[_0x5edd('0x1b')](_0x560da2)[_0x5edd('0x29')](_0x2314bb);};}function getImapHost(_0x3801ab){switch(_0x3801ab){case _0x5edd('0x2a'):return _0x5edd('0x2b');case _0x5edd('0x2c'):return _0x5edd('0x2d');case _0x5edd('0x2e'):return _0x5edd('0x2f');case _0x5edd('0x30'):return _0x5edd('0x31');}throw new Error(_0x5edd('0x32'),_0x3801ab);}function getSmtpHost(_0x138e5a){switch(_0x138e5a){case _0x5edd('0x2a'):return'smtp.gmail.com';case _0x5edd('0x2c'):return _0x5edd('0x33');case _0x5edd('0x2e'):return _0x5edd('0x34');case'outlook365':return _0x5edd('0x35');}throw new Error(_0x5edd('0x32'),_0x138e5a);}function getAuthenticationOptions(_0xb6b8bb,_0x1a2d2e){var _0x598aea={};var _0x2d27ab={};if(_0xb6b8bb){_0x598aea[_0x5edd('0x36')]=_0x2d27ab[_0x5edd('0x36')]=_0x1a2d2e['username'];_0x598aea['password']=_0x2d27ab[_0x5edd('0x37')]=_0x1a2d2e[_0x5edd('0x38')];if(_0x1a2d2e['modernAuthentication']){_0x598aea[_0x5edd('0x39')]=_0x2d27ab[_0x5edd('0x39')]=!![];_0x598aea['CloudProviderId']=_0x2d27ab[_0x5edd('0x3a')]=_0x1a2d2e[_0x5edd('0x3a')];_0x598aea[_0x5edd('0x38')]=_0x2d27ab[_0x5edd('0x37')]=null;}else{_0x598aea[_0x5edd('0x3a')]=_0x2d27ab[_0x5edd('0x3a')]=null;}_0x598aea[_0x5edd('0x3b')]=getImapHost(_0xb6b8bb);_0x598aea['port']=0x3e1;_0x2d27ab[_0x5edd('0x3b')]=getSmtpHost(_0xb6b8bb);_0x2d27ab[_0x5edd('0x3c')]=0x24b;_0x2d27ab[_0x5edd('0x3d')]=![];_0x598aea[_0x5edd('0x3e')]=_0x2d27ab['service']=null;}else{if(_0x1a2d2e[_0x5edd('0x3f')]){_0x598aea[_0x5edd('0x36')]=_0x2d27ab[_0x5edd('0x36')]=_0x1a2d2e['username'];_0x598aea[_0x5edd('0x38')]=_0x2d27ab[_0x5edd('0x37')]=_0x1a2d2e['password'];}else{_0x598aea[_0x5edd('0x3f')]=_0x2d27ab[_0x5edd('0x3f')]=![];_0x598aea[_0x5edd('0x36')]=_0x2d27ab['user']=null;_0x598aea[_0x5edd('0x38')]=_0x2d27ab['pass']=null;}_0x598aea[_0x5edd('0x3b')]=_0x1a2d2e[_0x5edd('0x40')]['host'];_0x598aea['port']=_0x1a2d2e[_0x5edd('0x40')]['port'];_0x2d27ab[_0x5edd('0x3b')]=_0x1a2d2e['Smtp']['host'];_0x2d27ab[_0x5edd('0x3c')]=_0x1a2d2e[_0x5edd('0x41')][_0x5edd('0x3c')];}return{'Imap':_0x598aea,'Smtp':_0x2d27ab};}exports[_0x5edd('0x42')]=function(_0x4ce080,_0xf53308){var _0x391d66={'include':[{'model':db[_0x5edd('0x43')],'as':'Imap'},{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db['Pause'],'as':_0x5edd('0x45')}]},_0xe26365={},_0x339b58={'count':0x0,'rows':[]};var _0x5555e5=_[_0x5edd('0x46')](db[_0x5edd('0x47')][_0x5edd('0x48')],function(_0x63d7c1){return{'name':_0x63d7c1['fieldName'],'type':_0x63d7c1[_0x5edd('0x49')]['key']};});_0xe26365['model']=_[_0x5edd('0x46')](_0x5555e5,'name');_0xe26365['query']=_[_0x5edd('0x4a')](_0x4ce080[_0x5edd('0x4b')]);_0xe26365['filters']=_[_0x5edd('0x4c')](_0xe26365[_0x5edd('0x4d')],_0xe26365['query']);_0x391d66[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0xe26365[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x4ce080[_0x5edd('0x4b')]['fields']));_0x391d66['attributes']=_0x391d66[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x391d66[_0x5edd('0x4e')]:_0xe26365[_0x5edd('0x4d')];if(!_0x4ce080[_0x5edd('0x4b')]['hasOwnProperty'](_0x5edd('0x51'))){_0x391d66['limit']=qs['limit'](_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x391d66[_0x5edd('0x1d')]=qs[_0x5edd('0x1d')](_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x1d')]);}_0x391d66[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x391d66['where']=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x4ce080[_0x5edd('0x4b')],_0xe26365[_0x5edd('0x54')]),_0x5555e5);if(_0x4ce080[_0x5edd('0x4b')]['filter']){_0x391d66[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x391d66[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x5555e5,function(_0x2d7abb){if(_0x2d7abb[_0x5edd('0x49')]!=='VIRTUAL'){var _0x3e0be6={};_0x3e0be6[_0x2d7abb[_0x5edd('0x28')]]={'$like':'%'+_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x3e0be6;}})});}_0x391d66=_[_0x5edd('0x57')]({},_0x391d66,_0x4ce080[_0x5edd('0x59')]);var _0x5d55ce={'where':_0x391d66['where']};return db[_0x5edd('0x47')]['count'](_0x5d55ce)[_0x5edd('0x10')](function(_0x1c6cc7){_0x339b58[_0x5edd('0x20')]=_0x1c6cc7;if(_0x4ce080[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x391d66[_0x5edd('0x5b')]=[{'all':!![]}];}return db[_0x5edd('0x47')]['findAll'](_0x391d66);})[_0x5edd('0x10')](function(_0xac44e3){_0x339b58[_0x5edd('0x5c')]=_0xac44e3;return _0x339b58;})[_0x5edd('0x10')](respondWithFilteredResult(_0xf53308,_0x391d66))['catch'](handleError(_0xf53308,null));};exports[_0x5edd('0x5d')]=function(_0x3f6499,_0x537a9f){var _0x43eb91={'raw':![],'where':{'id':_0x3f6499['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x5edd('0x40')},{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db[_0x5edd('0x5e')],'as':'mandatoryDispositionPause'}]},_0x135ee6={};_0x135ee6['model']=_['keys'](db[_0x5edd('0x47')][_0x5edd('0x48')]);_0x135ee6[_0x5edd('0x4b')]=_['keys'](_0x3f6499['query']);_0x135ee6[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x135ee6[_0x5edd('0x4d')],_0x135ee6[_0x5edd('0x4b')]);_0x43eb91[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x135ee6[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x3f6499['query'][_0x5edd('0x4f')]));_0x43eb91[_0x5edd('0x4e')]=_0x43eb91[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x43eb91[_0x5edd('0x4e')]:_0x135ee6[_0x5edd('0x4d')];if(_0x3f6499[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x43eb91[_0x5edd('0x5b')]=[{'all':!![]}];}_0x43eb91=_[_0x5edd('0x57')]({},_0x43eb91,_0x3f6499[_0x5edd('0x59')]);return db['MailAccount'][_0x5edd('0x5f')](_0x43eb91)[_0x5edd('0x10')](handleEntityNotFound(_0x537a9f,null))[_0x5edd('0x10')](respondWithResult(_0x537a9f,null))[_0x5edd('0x19')](handleError(_0x537a9f,null));};exports[_0x5edd('0x22')]=function(_0x37d31b,_0xbfeaf9){if(_0x37d31b['body']['id']){delete _0x37d31b[_0x5edd('0x60')]['id'];}var _0x77b6a0=_0x37d31b[_0x5edd('0x60')][_0x5edd('0x61')]===_0x5edd('0x62')?null:_0x37d31b[_0x5edd('0x60')][_0x5edd('0x61')];var _0x1c1537=_0x37d31b['body'][_0x5edd('0x40')]||{};var _0xc3eab0=_0x37d31b[_0x5edd('0x60')]['Smtp']||{};if(_0x77b6a0){_0x1c1537[_0x5edd('0x3b')]=getImapHost(_0x77b6a0);_0x1c1537[_0x5edd('0x3c')]=0x3e1;_0xc3eab0[_0x5edd('0x3b')]=getSmtpHost(_0x77b6a0);_0xc3eab0[_0x5edd('0x3c')]=0x24b;_0xc3eab0[_0x5edd('0x3d')]=![];}if(_0xc3eab0[_0x5edd('0x39')]){_0xc3eab0['secure']=![];}else{_0xc3eab0[_0x5edd('0x3a')]=null;}if(!_0x1c1537['modernAuthentication'])_0x1c1537[_0x5edd('0x3a')]=null;_0x37d31b[_0x5edd('0x60')][_0x5edd('0x40')]=_0x1c1537;_0x37d31b['body']['Smtp']=_0xc3eab0;return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x37d31b[_0x5edd('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x5edd('0x40')},{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db[_0x5edd('0x5e')],'as':_0x5edd('0x45')}]})[_0x5edd('0x10')](handleEntityNotFound(_0xbfeaf9,null))[_0x5edd('0x10')](function(_0x2e5c5d){if(!_0x2e5c5d)throw new Error(_0x5edd('0x64'));if(_0x2e5c5d[_0x5edd('0x3e')])delete _0x37d31b[_0x5edd('0x60')][_0x5edd('0x40')];return _0x2e5c5d;})[_0x5edd('0x10')](saveUpdates(_0x37d31b[_0x5edd('0x60')],null))[_0x5edd('0x10')](function(_0x26f2af){if(!_0x37d31b[_0x5edd('0x60')]['Imap'])return _0x26f2af;return db[_0x5edd('0x43')][_0x5edd('0x22')](_0x37d31b[_0x5edd('0x60')][_0x5edd('0x40')],{'where':{'MailAccountId':_0x26f2af['id']}})['then'](function(){return _0x26f2af;});})[_0x5edd('0x10')](function(_0x91ffb6){if(!_0x37d31b[_0x5edd('0x60')][_0x5edd('0x41')])return _0x91ffb6;return db['MailServerOut'][_0x5edd('0x22')](_0x37d31b[_0x5edd('0x60')][_0x5edd('0x41')],{'where':{'MailAccountId':_0x91ffb6['id']}})[_0x5edd('0x10')](function(){return _0x91ffb6;});})[_0x5edd('0x10')](respondWithResult(_0xbfeaf9,null))[_0x5edd('0x19')](handleError(_0xbfeaf9,null));};exports[_0x5edd('0x65')]=function(_0x4a94e7,_0xbdf63a){return db[_0x5edd('0x47')][_0x5edd('0x65')]()[_0x5edd('0x10')](respondWithResult(_0xbdf63a,null))['catch'](handleError(_0xbdf63a,null));};exports[_0x5edd('0x66')]=function(_0xd0e669,_0x1a6791){if(_0xd0e669['body']['id']){delete _0xd0e669[_0x5edd('0x60')]['id'];}return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0xd0e669[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x1a6791,null))[_0x5edd('0x10')](function(_0x569ca9){if(_0x569ca9){_0xd0e669[_0x5edd('0x60')]['MailAccountId']=_0x569ca9['id'];return db[_0x5edd('0x67')][_0x5edd('0x68')](_0xd0e669['body']);}})['then'](respondWithResult(_0x1a6791,null))[_0x5edd('0x19')](handleError(_0x1a6791,null));};exports['getDispositions']=function(_0x3e83c0,_0x20cb46){var _0x3417d7={'raw':![],'where':{}};var _0x1b48a5={};var _0x36f87b={'count':0x0,'rows':[]};return db[_0x5edd('0x47')]['findOne']({'where':{'id':_0x3e83c0[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x20cb46,null))[_0x5edd('0x10')](function(_0x650257){if(_0x650257){_0x1b48a5[_0x5edd('0x4d')]=_['keys'](db['Disposition'][_0x5edd('0x48')]);_0x1b48a5[_0x5edd('0x4b')]=_[_0x5edd('0x4a')](_0x3e83c0['query']);_0x1b48a5[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x1b48a5['model'],_0x1b48a5[_0x5edd('0x4b')]);_0x3417d7['attributes']=_[_0x5edd('0x4c')](_0x1b48a5[_0x5edd('0x4d')],qs['fields'](_0x3e83c0['query']['fields']));_0x3417d7[_0x5edd('0x4e')]=_0x3417d7[_0x5edd('0x4e')]['length']?_0x3417d7['attributes']:_0x1b48a5[_0x5edd('0x4d')];if(!_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x3417d7[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x3417d7[_0x5edd('0x1d')]=qs[_0x5edd('0x1d')](_0x3e83c0['query'][_0x5edd('0x1d')]);}_0x3417d7[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x3417d7[_0x5edd('0x56')]=qs['filters'](_[_0x5edd('0x55')](_0x3e83c0[_0x5edd('0x4b')],_0x1b48a5[_0x5edd('0x54')]));_0x3417d7[_0x5edd('0x56')][_0x5edd('0x6a')]=_0x650257['id'];if(_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x3417d7[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x3417d7[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x3417d7['attributes'],function(_0x2804c4){var _0x4c3e7a={};_0x4c3e7a[_0x2804c4]={'$like':'%'+_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x4c3e7a;})});}_0x3417d7=_[_0x5edd('0x57')]({},_0x3417d7,_0x3e83c0[_0x5edd('0x59')]);return db['Disposition'][_0x5edd('0x20')]({'where':_0x3417d7[_0x5edd('0x56')]})['then'](function(_0x3071c8){_0x36f87b[_0x5edd('0x20')]=_0x3071c8;if(_0x3e83c0[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x3417d7[_0x5edd('0x5b')]=[{'all':!![]}];}return db[_0x5edd('0x67')][_0x5edd('0x6b')](_0x3417d7);})['then'](function(_0x1c6a6d){_0x36f87b[_0x5edd('0x5c')]=_0x1c6a6d;return _0x36f87b;});}})[_0x5edd('0x10')](respondWithFilteredResult(_0x20cb46,_0x3417d7))[_0x5edd('0x19')](handleError(_0x20cb46,null));};exports['removeDispositions']=function(_0x5df6a0,_0x213ffb){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x5df6a0[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x213ffb,null))[_0x5edd('0x10')](function(_0x2596d0){if(_0x2596d0){return _0x2596d0['removeDispositions'](_0x5df6a0['query'][_0x5edd('0x6c')]);}})[_0x5edd('0x10')](respondWithStatusCode(_0x213ffb,null))[_0x5edd('0x19')](handleError(_0x213ffb,null));};exports[_0x5edd('0x6d')]=function(_0x1e14ef,_0x108ace){if(_0x1e14ef[_0x5edd('0x60')]['id']){delete _0x1e14ef[_0x5edd('0x60')]['id'];}return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x1e14ef[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x108ace,null))[_0x5edd('0x10')](function(_0x2c1753){if(_0x2c1753){_0x1e14ef[_0x5edd('0x60')][_0x5edd('0x6a')]=_0x2c1753['id'];return db['CannedAnswer'][_0x5edd('0x68')](_0x1e14ef[_0x5edd('0x60')]);}})[_0x5edd('0x10')](respondWithResult(_0x108ace,null))[_0x5edd('0x19')](handleError(_0x108ace,null));};exports[_0x5edd('0x6e')]=function(_0x4b51d7,_0x4931c6){var _0x581dfd={'raw':![],'where':{}};var _0xc16ada={};var _0x37bb96={'count':0x0,'rows':[]};return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x4b51d7[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4931c6,null))[_0x5edd('0x10')](function(_0x4c6a14){if(_0x4c6a14){_0xc16ada[_0x5edd('0x4d')]=_[_0x5edd('0x4a')](db[_0x5edd('0x70')][_0x5edd('0x48')]);_0xc16ada[_0x5edd('0x4b')]=_[_0x5edd('0x4a')](_0x4b51d7[_0x5edd('0x4b')]);_0xc16ada[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0xc16ada['model'],_0xc16ada['query']);_0x581dfd[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0xc16ada[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x4b51d7['query'][_0x5edd('0x4f')]));_0x581dfd[_0x5edd('0x4e')]=_0x581dfd[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x581dfd[_0x5edd('0x4e')]:_0xc16ada['model'];if(!_0x4b51d7['query'][_0x5edd('0x69')]('nolimit')){_0x581dfd[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x581dfd['offset']=qs[_0x5edd('0x1d')](_0x4b51d7['query'][_0x5edd('0x1d')]);}_0x581dfd[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x4b51d7['query'][_0x5edd('0x53')]);_0x581dfd['where']=qs[_0x5edd('0x54')](_['pick'](_0x4b51d7[_0x5edd('0x4b')],_0xc16ada[_0x5edd('0x54')]));_0x581dfd['where'][_0x5edd('0x6a')]=_0x4c6a14['id'];if(_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x581dfd[_0x5edd('0x56')]=_['merge'](_0x581dfd[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x581dfd[_0x5edd('0x4e')],function(_0x44bd18){var _0x380a41={};_0x380a41[_0x44bd18]={'$like':'%'+_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x380a41;})});}_0x581dfd=_[_0x5edd('0x57')]({},_0x581dfd,_0x4b51d7[_0x5edd('0x59')]);return db[_0x5edd('0x70')][_0x5edd('0x20')]({'where':_0x581dfd['where']})[_0x5edd('0x10')](function(_0x447a56){_0x37bb96[_0x5edd('0x20')]=_0x447a56;if(_0x4b51d7[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x581dfd[_0x5edd('0x5b')]=[{'all':!![]}];}return db[_0x5edd('0x70')][_0x5edd('0x6b')](_0x581dfd);})[_0x5edd('0x10')](function(_0x49ac34){_0x37bb96['rows']=_0x49ac34;return _0x37bb96;});}})['then'](respondWithFilteredResult(_0x4931c6,_0x581dfd))[_0x5edd('0x19')](handleError(_0x4931c6,null));};exports[_0x5edd('0x71')]=function(_0xddff23,_0x51371d){return db[_0x5edd('0x47')]['find']({'where':{'id':_0xddff23['params']['id']}})['then'](handleEntityNotFound(_0x51371d,null))[_0x5edd('0x10')](function(_0x4ddf90){if(_0x4ddf90){return _0x4ddf90[_0x5edd('0x71')](_0xddff23[_0x5edd('0x4b')][_0x5edd('0x6c')]);}})[_0x5edd('0x10')](respondWithStatusCode(_0x51371d,null))[_0x5edd('0x19')](handleError(_0x51371d,null));};exports['create']=function(_0x350c50,_0x585945){var _0x4a67dc={'name':_0x350c50[_0x5edd('0x60')]['name'],'key':_0x350c50['body'][_0x5edd('0x72')],'provider':_0x350c50[_0x5edd('0x60')][_0x5edd('0x61')]==='custom'?null:_0x350c50[_0x5edd('0x60')][_0x5edd('0x61')],'email':_0x350c50[_0x5edd('0x60')][_0x5edd('0x73')],'ListId':_0x350c50[_0x5edd('0x60')][_0x5edd('0x74')],'active':!_['isNil'](_0x350c50[_0x5edd('0x60')][_0x5edd('0x75')])?_0x350c50[_0x5edd('0x60')]['active']:!![],'description':_0x350c50[_0x5edd('0x60')][_0x5edd('0x76')]||null};var _0x873a2b=getAuthenticationOptions(_0x4a67dc[_0x5edd('0x61')],_0x350c50[_0x5edd('0x60')]);_0x4a67dc[_0x5edd('0x40')]=_0x873a2b[_0x5edd('0x40')];_0x4a67dc[_0x5edd('0x41')]=_0x873a2b[_0x5edd('0x41')];return db[_0x5edd('0x47')][_0x5edd('0x68')](_0x4a67dc,{'include':[{'model':db[_0x5edd('0x44')],'as':_0x5edd('0x41')},{'model':db['MailServerIn'],'as':_0x5edd('0x40')}]})[_0x5edd('0x10')](function(_0x49e068){var _0xf4fcad=_0x350c50[_0x5edd('0x36')][_0x5edd('0x24')]({'plain':!![]});if(!_0xf4fcad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4fcad[_0x5edd('0x77')]===_0x5edd('0x36')){var _0x263c41=_0x49e068[_0x5edd('0x24')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x5edd('0x25'),'userProfileId':_0xf4fcad[_0x5edd('0x78')]},'raw':!![]})[_0x5edd('0x10')](function(_0x11e5a5){if(_0x11e5a5&&_0x11e5a5[_0x5edd('0x79')]===0x0){return db[_0x5edd('0x7a')][_0x5edd('0x68')]({'name':_0x263c41[_0x5edd('0x28')],'resourceId':_0x263c41['id'],'type':_0x11e5a5['name'],'sectionId':_0x11e5a5['id']},{})[_0x5edd('0x10')](function(){return _0x49e068;});}else{return _0x49e068;}})[_0x5edd('0x19')](function(_0x27aab){logger[_0x5edd('0x14')](_0x5edd('0x7b'),_0x27aab);throw _0x27aab;});}return _0x49e068;})[_0x5edd('0x10')](respondWithResult(_0x585945,0xc9))[_0x5edd('0x19')](handleError(_0x585945,null));};exports['getImap']=function(_0x48849f,_0x4b6dd7){return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x48849f['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4b6dd7,null))[_0x5edd('0x10')](function(_0x4484bf){if(_0x4484bf){return _0x4484bf[_0x5edd('0x7c')]();}return null;})[_0x5edd('0x10')](respondWithResult(_0x4b6dd7,null))[_0x5edd('0x19')](handleError(_0x4b6dd7,null));};exports[_0x5edd('0x7d')]=function(_0x1ee459,_0x33204b){if(_0x1ee459[_0x5edd('0x60')]['id']){delete _0x1ee459[_0x5edd('0x60')]['id'];}return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x1ee459[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x33204b,null))[_0x5edd('0x10')](function(_0x296acb){if(_0x296acb){_0x1ee459[_0x5edd('0x60')]['MailAccountId']=_0x296acb['id'];return db[_0x5edd('0x43')][_0x5edd('0x68')](_0x1ee459[_0x5edd('0x60')]);}})[_0x5edd('0x10')](respondWithResult(_0x33204b,null))[_0x5edd('0x19')](handleError(_0x33204b,null));};exports[_0x5edd('0x7e')]=function(_0x4df390,_0x572b11){return db['MailAccount'][_0x5edd('0x6f')]({'where':{'id':_0x4df390[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x572b11,null))['then'](function(_0x5b0e2e){if(_0x5b0e2e){return _0x5b0e2e[_0x5edd('0x7f')](null);}return null;})[_0x5edd('0x10')](respondWithStatusCode(_0x572b11,null))[_0x5edd('0x19')](handleError(_0x572b11,null));};exports[_0x5edd('0x80')]=function(_0xfb88d0,_0x57d83d){return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0xfb88d0[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x57d83d,null))[_0x5edd('0x10')](function(_0xb495c2){if(_0xb495c2){return _0xb495c2[_0x5edd('0x80')]();}return null;})[_0x5edd('0x10')](respondWithResult(_0x57d83d,null))[_0x5edd('0x19')](handleError(_0x57d83d,null));};exports[_0x5edd('0x81')]=function(_0x5eeb3a,_0x2d36e5){if(_0x5eeb3a[_0x5edd('0x60')]['id']){delete _0x5eeb3a['body']['id'];}return db[_0x5edd('0x47')]['find']({'where':{'id':_0x5eeb3a[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x2d36e5,null))[_0x5edd('0x10')](function(_0x52953e){if(_0x52953e){_0x5eeb3a[_0x5edd('0x60')][_0x5edd('0x6a')]=_0x52953e['id'];return db[_0x5edd('0x44')][_0x5edd('0x68')](_0x5eeb3a[_0x5edd('0x60')]);}})[_0x5edd('0x10')](respondWithResult(_0x2d36e5,null))[_0x5edd('0x19')](handleError(_0x2d36e5,null));};exports[_0x5edd('0x82')]=function(_0x5e5566,_0x288528){return db['MailAccount'][_0x5edd('0x6f')]({'where':{'id':_0x5e5566['params']['id']}})['then'](handleEntityNotFound(_0x288528,null))['then'](function(_0x392e39){if(_0x392e39){return _0x392e39[_0x5edd('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x288528,null))[_0x5edd('0x19')](handleError(_0x288528,null));};exports[_0x5edd('0x84')]=function(_0x48ed82,_0x1d5c4e){return db[_0x5edd('0x85')][_0x5edd('0x5f')]({'where':{'id':_0x48ed82[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x1d5c4e,null))['then'](function(_0x1ab4bb){if(_0x1ab4bb){return _0x1ab4bb['addInteraction'](_0x48ed82[_0x5edd('0x60')][_0x5edd('0x6c')],_['omit'](_0x48ed82[_0x5edd('0x60')],['ids','id'])||{});}})[_0x5edd('0x10')](respondWithResult(_0x1d5c4e,null))['catch'](handleError(_0x1d5c4e,null));};exports[_0x5edd('0x86')]=function(_0x42a242,_0x353c3a){var _0x3ba5db={'raw':![],'where':{}};var _0x51156d={};var _0x141917={'count':0x0,'rows':[]};return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x42a242['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x353c3a,null))[_0x5edd('0x10')](function(_0x5d7cf7){if(_0x5d7cf7){_0x51156d[_0x5edd('0x4d')]=_[_0x5edd('0x4a')](db['MailInteraction'][_0x5edd('0x48')]);_0x51156d['query']=_[_0x5edd('0x4a')](_0x42a242[_0x5edd('0x4b')]);_0x51156d[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x51156d[_0x5edd('0x4d')],_0x51156d[_0x5edd('0x4b')]);_0x3ba5db[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x51156d[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x42a242[_0x5edd('0x4b')][_0x5edd('0x4f')]));_0x3ba5db[_0x5edd('0x4e')]=_0x3ba5db[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x3ba5db[_0x5edd('0x4e')]:_0x51156d[_0x5edd('0x4d')];if(!_0x42a242[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x3ba5db[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x42a242[_0x5edd('0x4b')]['limit']);_0x3ba5db['offset']=qs['offset'](_0x42a242[_0x5edd('0x4b')][_0x5edd('0x1d')]);}_0x3ba5db[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x42a242['query'][_0x5edd('0x53')]);_0x3ba5db[_0x5edd('0x56')]=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x42a242[_0x5edd('0x4b')],_0x51156d['filters']));_0x3ba5db[_0x5edd('0x56')][_0x5edd('0x6a')]=_0x5d7cf7['id'];if(_0x42a242['query'][_0x5edd('0x58')]){_0x3ba5db['where']=_[_0x5edd('0x57')](_0x3ba5db['where'],{'$or':_['map'](_0x3ba5db[_0x5edd('0x4e')],function(_0x4e3bcd){var _0x167284={};_0x167284[_0x4e3bcd]={'$like':'%'+_0x42a242[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x167284;})});}_0x3ba5db=_[_0x5edd('0x57')]({},_0x3ba5db,_0x42a242[_0x5edd('0x59')]);return db[_0x5edd('0x85')][_0x5edd('0x20')]({'where':_0x3ba5db[_0x5edd('0x56')]})['then'](function(_0x2504f2){_0x141917[_0x5edd('0x20')]=_0x2504f2;if(_0x42a242[_0x5edd('0x4b')][_0x5edd('0x5a')]){_0x3ba5db['include']=[{'model':db['CmContact'],'as':_0x5edd('0x87'),'required':![]},{'model':db[_0x5edd('0x88')],'as':_0x5edd('0x89'),'attributes':['name',_0x5edd('0x8a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x5edd('0x8b'),'attributes':['id',_0x5edd('0x28'),_0x5edd('0x8c')],'where':_0x42a242[_0x5edd('0x4b')][_0x5edd('0x8d')]?{'id':_0x42a242[_0x5edd('0x4b')][_0x5edd('0x8d')]}:undefined,'required':_0x42a242['query'][_0x5edd('0x8d')]?!![]:![]}];}return db[_0x5edd('0x85')][_0x5edd('0x6b')](_0x3ba5db);})['then'](function(_0x38ba6b){_0x141917['rows']=_0x38ba6b;return _0x141917;});}})[_0x5edd('0x10')](respondWithFilteredResult(_0x353c3a,_0x3ba5db))['catch'](handleError(_0x353c3a,null));};exports[_0x5edd('0x8e')]=function addApplications(_0x57c54b,_0x3b9a1f){var _0x4507fb=_0x57c54b[_0x5edd('0x63')]['id'];var _0x1d5baa=_0x57c54b[_0x5edd('0x60')];var _0x418c7b=0xc8;var _0x15bad5=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x5edd('0x8f')][_0x5edd('0x90')][_0x5edd('0x91')][_0x5edd('0x92')]},function(_0x540aa3){return db['MailAccount'][_0x5edd('0x6f')]({'where':{'id':_0x4507fb},'transaction':_0x540aa3})['then'](function(_0x2010da){if(_0x2010da){return db[_0x5edd('0x93')][_0x5edd('0x23')]({'where':{'MailAccountId':_0x4507fb},'transaction':_0x540aa3})[_0x5edd('0x10')](function(){var _0xcc51c3=_[_0x5edd('0x46')](_0x1d5baa,function(_0x5ce24c){_0x5ce24c[_0x5edd('0x6a')]=_0x4507fb;return _0x5ce24c;});return db['MailApplication'][_0x5edd('0x94')](_0xcc51c3,{'transaction':_0x540aa3});});}else{_0x418c7b=0x194;_0x15bad5=[];}});})[_0x5edd('0x10')](function(){if(_0x418c7b!==0x194){return db[_0x5edd('0x93')][_0x5edd('0x95')]({'where':{'MailAccountId':_0x4507fb},'order':'priority'})['then'](function(_0x354887){_0x15bad5=_0x354887;});}})[_0x5edd('0x19')](function(_0x572244){_0x418c7b=0x1f4;logger[_0x5edd('0x14')](_0x572244['stack']);if(_0x572244[_0x5edd('0x28')]){delete _0x572244[_0x5edd('0x28')];}_0x15bad5=_0x572244;})[_0x5edd('0x96')](function(){if(_0x15bad5===null){_0x3b9a1f[_0x5edd('0x1a')](_0x418c7b);}else{if(_0x418c7b===0x1f4){_0x3b9a1f[_0x5edd('0x1b')](_0x418c7b)[_0x5edd('0x29')](_0x15bad5);}else{_0x3b9a1f[_0x5edd('0x1b')](_0x418c7b)[_0x5edd('0x1c')](_0x15bad5);}}});};exports[_0x5edd('0x97')]=function(_0x59d91d,_0x293406){var _0x15a72c={};var _0x4d57bc={};var _0x57a6ea;var _0x2ab52a;return db[_0x5edd('0x47')]['findOne']({'where':{'id':_0x59d91d['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x293406,null))[_0x5edd('0x10')](function(_0x41b34a){if(_0x41b34a){_0x57a6ea=_0x41b34a;_0x4d57bc[_0x5edd('0x4d')]=_['keys'](db['MailApplication'][_0x5edd('0x48')]);_0x4d57bc['query']=_[_0x5edd('0x4a')](_0x59d91d['query']);_0x4d57bc[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x4d57bc[_0x5edd('0x4d')],_0x4d57bc[_0x5edd('0x4b')]);_0x15a72c[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x4d57bc['model'],qs['fields'](_0x59d91d[_0x5edd('0x4b')]['fields']));_0x15a72c[_0x5edd('0x4e')]=_0x15a72c[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x15a72c[_0x5edd('0x4e')]:_0x4d57bc[_0x5edd('0x4d')];_0x15a72c[_0x5edd('0x52')]=qs['sort'](_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x15a72c[_0x5edd('0x56')]=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x59d91d[_0x5edd('0x4b')],_0x4d57bc[_0x5edd('0x54')]));if(_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x15a72c['where']=_[_0x5edd('0x57')](_0x15a72c[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x15a72c[_0x5edd('0x4e')],function(_0x245250){var _0x271195={};_0x271195[_0x245250]={'$like':'%'+_0x59d91d[_0x5edd('0x4b')]['filter']+'%'};return _0x271195;})});}_0x15a72c=_['merge']({},_0x15a72c,_0x59d91d[_0x5edd('0x59')]);return _0x57a6ea[_0x5edd('0x97')](_0x15a72c);}})['then'](function(_0x4b39ed){if(_0x4b39ed){_0x2ab52a=_0x4b39ed['length'];if(!_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x15a72c['limit']=qs[_0x5edd('0x1f')](_0x59d91d[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x15a72c[_0x5edd('0x1d')]=qs['offset'](_0x59d91d['query'][_0x5edd('0x1d')]);}return _0x57a6ea[_0x5edd('0x97')](_0x15a72c);}})[_0x5edd('0x10')](function(_0x170355){if(_0x170355){return _0x170355?{'count':_0x2ab52a,'rows':_0x170355}:null;}})[_0x5edd('0x10')](respondWithResult(_0x293406,null))[_0x5edd('0x19')](handleError(_0x293406,null));};exports[_0x5edd('0x98')]=function(_0x5a7676,_0x4e3af5){var _0x973cbf={'raw':!![],'where':{}};var _0x388aed={};var _0x49cf6b={'count':0x0,'rows':[]};return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x5a7676[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4e3af5,null))[_0x5edd('0x10')](function(_0x570660){if(_0x570660){_0x388aed[_0x5edd('0x4d')]=_[_0x5edd('0x4a')](db['MailMessage'][_0x5edd('0x48')]);_0x388aed[_0x5edd('0x4b')]=_[_0x5edd('0x4a')](_0x5a7676[_0x5edd('0x4b')]);_0x388aed['filters']=_['intersection'](_0x388aed[_0x5edd('0x4d')],_0x388aed[_0x5edd('0x4b')]);_0x973cbf[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x388aed[_0x5edd('0x4d')],qs['fields'](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x4f')]));_0x973cbf[_0x5edd('0x4e')]=_0x973cbf[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x973cbf[_0x5edd('0x4e')]:_0x388aed[_0x5edd('0x4d')];if(!_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x973cbf[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x973cbf[_0x5edd('0x1d')]=qs[_0x5edd('0x1d')](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x1d')]);}_0x973cbf[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x53')]);_0x973cbf[_0x5edd('0x56')]=qs[_0x5edd('0x54')](_[_0x5edd('0x55')](_0x5a7676[_0x5edd('0x4b')],_0x388aed[_0x5edd('0x54')]));_0x973cbf[_0x5edd('0x56')][_0x5edd('0x6a')]=_0x570660['id'];if(_0x5a7676['query'][_0x5edd('0x58')]){_0x973cbf[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x973cbf[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x973cbf['attributes'],function(_0x4d8b01){var _0x697562={};_0x697562[_0x4d8b01]={'$like':'%'+_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x697562;})});}if(_0x5a7676[_0x5edd('0x4b')][_0x5edd('0x99')]){var _0x206cb2=_0x5a7676[_0x5edd('0x4b')]['$gte'][_0x5edd('0x9a')](',');var _0x2a28f6={};_0x2a28f6[_0x206cb2[0x0]]={'$gte':moment(_0x206cb2[0x1])[_0x5edd('0x9b')](_0x5edd('0x9c'))};_0x973cbf[_0x5edd('0x56')]=_[_0x5edd('0x57')](_0x973cbf[_0x5edd('0x56')],_0x2a28f6);}_0x973cbf=_[_0x5edd('0x57')]({},_0x973cbf,_0x5a7676[_0x5edd('0x59')]);return db[_0x5edd('0x9d')][_0x5edd('0x20')]({'where':_0x973cbf['where']})[_0x5edd('0x10')](function(_0x2a91ea){_0x49cf6b['count']=_0x2a91ea;if(_0x5a7676['query'][_0x5edd('0x5a')]){_0x973cbf['include']=[{'all':!![]}];}return db[_0x5edd('0x9d')]['findAll'](_0x973cbf);})[_0x5edd('0x10')](function(_0x1dce95){if(_0x5a7676[_0x5edd('0x4b')]['inlineCss']===_0x5edd('0x9e')){for(var _0x5d0944=0x0;_0x5d0944<_0x1dce95[_0x5edd('0x50')];_0x5d0944++){_0x1dce95[_0x5d0944][_0x5edd('0x60')]=juice(_0x1dce95[_0x5d0944][_0x5edd('0x60')]);}}_0x49cf6b['rows']=_0x1dce95;return _0x49cf6b;});}})[_0x5edd('0x10')](respondWithFilteredResult(_0x4e3af5,_0x973cbf))['catch'](handleError(_0x4e3af5,null));};exports[_0x5edd('0x29')]=function(_0x65acfc,_0x1b6b2d){var _0x22db91,_0x1fcb81={},_0x3b63b6;if(_0x65acfc[_0x5edd('0x60')]['to']){_0x3b63b6=_0x65acfc['body']['to']['split'](',')[0x0];}return db[_0x5edd('0x47')]['find']({'where':{'id':_0x65acfc[_0x5edd('0x63')]['id']},'include':[{'model':db[_0x5edd('0x9f')],'as':_0x5edd('0xa0'),'include':[{'model':db[_0x5edd('0xa1')],'as':_0x5edd('0xa2'),'where':{'email':_0x3b63b6},'limit':0x1,'order':[[_0x5edd('0xa3'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x5edd('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x5edd('0x10')](handleEntityNotFound(_0x1b6b2d,null))['then'](function(_0x25f3a8){if(!_0x25f3a8)return;_0x22db91=_0x25f3a8;if(!_0x25f3a8['Smtp'])throw new Error(_0x5edd('0xa4'));if(_[_0x5edd('0xa5')](_0x65acfc['body'][_0x5edd('0xa6')])){_0x65acfc[_0x5edd('0x60')]['from']=util['format'](_0x5edd('0xa7'),_0x25f3a8[_0x5edd('0x28')],_0x25f3a8[_0x5edd('0x73')]||_0x25f3a8[_0x5edd('0x41')][_0x5edd('0x36')]);}if(_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')]&&_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x5edd('0x50')]){for(var _0x3a7d4b=0x0;_0x3a7d4b<_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x5edd('0x50')];_0x3a7d4b+=0x1){_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x3a7d4b]={'filename':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x3a7d4b][_0x5edd('0x28')],'path':path[_0x5edd('0xa9')](config[_0x5edd('0xaa')],_0x5edd('0xab'),_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa8')][_0x3a7d4b][_0x5edd('0xac')])};}}var _0x5d004c=_0x25f3a8[_0x5edd('0xad')]();return respondWithRpcPromise(_0x5edd('0xae'),'sendMail',{'account':_0x5d004c,'message':_0x65acfc['body']});})[_0x5edd('0x10')](function(_0xf1ed22){if(!_0xf1ed22)return;_0x1fcb81=_0xf1ed22;if(!_0x22db91['List'])throw new Error('List\x20not\x20found');if(_0x22db91[_0x5edd('0xa0')]['Contacts'][_0x5edd('0x50')])return _0x22db91['List']['Contacts'][0x0];return db['CmContact'][_0x5edd('0x68')](_['defaults'](_0x65acfc[_0x5edd('0x60')],{'firstName':_0x65acfc[_0x5edd('0x60')]['to'],'email':_0x65acfc['body']['to'],'phone':_0x65acfc[_0x5edd('0x60')]['to'],'ListId':_0x22db91[_0x5edd('0x74')]}));})[_0x5edd('0x10')](function(_0x1d7ce2){if(!_0x1d7ce2)return;var _0x47ceb2={'UserId':_0x65acfc[_0x5edd('0x36')]['id'],'ContactId':_0x1d7ce2['id'],'MailAccountId':_0x22db91['id'],'inReplyTo':_0x1fcb81[_0x5edd('0xaf')],'to':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xa6')],'cc':_0x65acfc['body']['cc'],'subject':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xb0')],'attach':_0x65acfc[_0x5edd('0x60')][_0x5edd('0xb1')],'firstMsgDirection':_0x5edd('0xb2'),'lastMsgAt':moment()['format'](_0x5edd('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x5edd('0x57')](_0x65acfc[_0x5edd('0x60')],{'messageId':_0x1fcb81[_0x5edd('0xaf')],'sentAt':moment()['format'](_0x5edd('0x9c')),'read':!![],'MailAccountId':_0x22db91['id'],'UserId':_0x65acfc['user']['id'],'ContactId':_0x1d7ce2['id']})]};if(_0x65acfc['body'][_0x5edd('0xb3')]){_0x47ceb2=_[_0x5edd('0x57')](_0x47ceb2,_0x65acfc[_0x5edd('0x60')][_0x5edd('0xb3')]);}return db[_0x5edd('0x85')]['create'](_0x47ceb2,{'include':[{'model':db[_0x5edd('0x9d')],'as':'Messages'}]});})['then'](respondWithResult(_0x1b6b2d,null))[_0x5edd('0x19')](handleError(_0x1b6b2d,null));};exports[_0x5edd('0xb4')]=function(_0x1ec4af,_0x366fa7){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x1ec4af[_0x5edd('0x63')]['id']},'include':[{'model':db[_0x5edd('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5edd('0xb5')],'as':_0x5edd('0xb5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x366fa7,null))['then'](function(_0x277bc8){if(!_0x277bc8[_0x5edd('0x41')])return;var _0x54ef89=_0x277bc8[_0x5edd('0xad')]();return respondWithRpcPromise(_0x5edd('0xb6'),'verifySmtp',{'account':_0x54ef89});})[_0x5edd('0x10')](respondWithResult(_0x366fa7,null))[_0x5edd('0x19')](handleError(_0x366fa7,null));};exports[_0x5edd('0x23')]=function(_0x373272,_0x288b1e){return db['MailAccount'][_0x5edd('0x5f')]({'where':{'id':_0x373272[_0x5edd('0x63')]['id']}})['then'](handleEntityNotFound(_0x288b1e,null))['then'](function(_0x53f591){if(_0x53f591&&_0x53f591[_0x5edd('0x3e')]){throw new db['Sequelize'][(_0x5edd('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x53f591;})[_0x5edd('0x10')](removeEntity(_0x288b1e,null))[_0x5edd('0x19')](handleError(_0x288b1e,null));};exports[_0x5edd('0xb8')]=function(_0x4c5d69,_0x1c03af){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x4c5d69[_0x5edd('0x63')]['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x1c03af,null))['then'](function(_0x3d23ab){if(_0x3d23ab){return _0x3d23ab['addAgents'](_0x4c5d69['body']['ids'],_[_0x5edd('0xb9')](_0x4c5d69[_0x5edd('0x60')],[_0x5edd('0x6c'),'id'])||{})[_0x5edd('0xba')](function(_0x67055c){for(var _0x3f8744=0x0;_0x3f8744<_0x4c5d69[_0x5edd('0x60')][_0x5edd('0x6c')][_0x5edd('0x50')];_0x3f8744+=0x1){socket[_0x5edd('0xbb')](_0x5edd('0xbc'),{'UserId':Number(_0x4c5d69[_0x5edd('0x60')]['ids'][_0x3f8744]),'MailAccountId':Number(_0x4c5d69[_0x5edd('0x63')]['id'])});}return _0x67055c;});}})[_0x5edd('0x10')](respondWithResult(_0x1c03af,null))['catch'](handleError(_0x1c03af,null));};exports['removeAgents']=function(_0x22bc7d,_0x4c8ade){return db[_0x5edd('0x47')][_0x5edd('0x5f')]({'where':{'id':_0x22bc7d['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x4c8ade,null))['then'](function(_0x2aebf9){if(_0x2aebf9){return _0x2aebf9[_0x5edd('0xbd')](_0x22bc7d[_0x5edd('0x4b')][_0x5edd('0x6c')])[_0x5edd('0x10')](function(){if(_[_0x5edd('0xbe')](_0x22bc7d[_0x5edd('0x4b')][_0x5edd('0x6c')])){for(var _0x2e1270=0x0;_0x2e1270<_0x22bc7d['query'][_0x5edd('0x6c')][_0x5edd('0x50')];_0x2e1270+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x22bc7d[_0x5edd('0x4b')][_0x5edd('0x6c')][_0x2e1270]),'MailAccountId':Number(_0x22bc7d[_0x5edd('0x63')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x22bc7d[_0x5edd('0x4b')]['ids']),'MailAccountId':Number(_0x22bc7d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4c8ade,null))['catch'](handleError(_0x4c8ade,null));};exports[_0x5edd('0xbf')]=function(_0x1730f4,_0x71524f){var _0x5ce76f={};var _0x1ec850={};var _0xa3eee8;var _0x3e841e;return db[_0x5edd('0x47')][_0x5edd('0x6f')]({'where':{'id':_0x1730f4['params']['id']}})[_0x5edd('0x10')](handleEntityNotFound(_0x71524f,null))[_0x5edd('0x10')](function(_0x1c7406){if(_0x1c7406){_0xa3eee8=_0x1c7406;_0x1ec850['model']=_[_0x5edd('0x4a')](db['User']['rawAttributes']);_0x1ec850[_0x5edd('0x4b')]=_['keys'](_0x1730f4[_0x5edd('0x4b')]);_0x1ec850[_0x5edd('0x54')]=_[_0x5edd('0x4c')](_0x1ec850['model'],_0x1ec850[_0x5edd('0x4b')]);_0x5ce76f[_0x5edd('0x4e')]=_[_0x5edd('0x4c')](_0x1ec850[_0x5edd('0x4d')],qs[_0x5edd('0x4f')](_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x4f')]));_0x5ce76f[_0x5edd('0x4e')]=_0x5ce76f[_0x5edd('0x4e')][_0x5edd('0x50')]?_0x5ce76f[_0x5edd('0x4e')]:_0x1ec850[_0x5edd('0x4d')];_0x5ce76f[_0x5edd('0x52')]=qs[_0x5edd('0x53')](_0x1730f4[_0x5edd('0x4b')]['sort']);_0x5ce76f[_0x5edd('0x56')]=qs['filters'](_['pick'](_0x1730f4[_0x5edd('0x4b')],_0x1ec850['filters']));if(_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x58')]){_0x5ce76f[_0x5edd('0x56')]=_['merge'](_0x5ce76f[_0x5edd('0x56')],{'$or':_[_0x5edd('0x46')](_0x5ce76f['attributes'],function(_0x5f02c1){var _0x4dddc9={};_0x4dddc9[_0x5f02c1]={'$like':'%'+_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x58')]+'%'};return _0x4dddc9;})});}_0x5ce76f=_[_0x5edd('0x57')]({},_0x5ce76f,_0x1730f4[_0x5edd('0x59')]);return _0xa3eee8[_0x5edd('0xbf')](_0x5ce76f);}})[_0x5edd('0x10')](function(_0x4188d1){if(_0x4188d1){_0x3e841e=_0x4188d1[_0x5edd('0x50')];if(!_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x69')](_0x5edd('0x51'))){_0x5ce76f[_0x5edd('0x1f')]=qs[_0x5edd('0x1f')](_0x1730f4[_0x5edd('0x4b')][_0x5edd('0x1f')]);_0x5ce76f['offset']=qs[_0x5edd('0x1d')](_0x1730f4['query'][_0x5edd('0x1d')]);}return _0xa3eee8['getAgents'](_0x5ce76f);}})[_0x5edd('0x10')](function(_0x3bb373){if(_0x3bb373){return _0x3bb373?{'count':_0x3e841e,'rows':_0x3bb373}:null;}})['then'](respondWithResult(_0x71524f,null))[_0x5edd('0x19')](handleError(_0x71524f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c82dbf5..4f5c653 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 _0x4753=['update','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount','save'];(function(_0x3841a5,_0x14ff78){var _0x23f318=function(_0x213e76){while(--_0x213e76){_0x3841a5['push'](_0x3841a5['shift']());}};_0x23f318(++_0x14ff78);}(_0x4753,0x1f4));var _0x3475=function(_0x30767a,_0x398bad){_0x30767a=_0x30767a-0x0;var _0x331a64=_0x4753[_0x30767a];return _0x331a64;};'use strict';var EventEmitter=require(_0x3475('0x0'));var MailAccount=require(_0x3475('0x1'))['db'][_0x3475('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3475('0x3'),'afterUpdate':_0x3475('0x4'),'afterDestroy':'remove'};function emitEvent(_0x212d98){return function(_0x4c6fd2,_0x5a801b,_0x5de37e){MailAccountEvents['emit'](_0x212d98+':'+_0x4c6fd2['id'],_0x4c6fd2);MailAccountEvents[_0x3475('0x5')](_0x212d98,_0x4c6fd2);_0x5de37e(null);};}for(var e in events){if(events[_0x3475('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x3475('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xd868=['emit','hasOwnProperty','hook','exports','events','MailAccount','update','remove'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xd868,0x1ec));var _0x8d86=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xd868[_0x18cd5b];return _0x5eaa52;};'use strict';var EventEmitter=require(_0x8d86('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8d86('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d86('0x2'),'afterDestroy':_0x8d86('0x3')};function emitEvent(_0xf04d37){return function(_0x5be215,_0x346c2d,_0x3ed3d1){MailAccountEvents['emit'](_0xf04d37+':'+_0x5be215['id'],_0x5be215);MailAccountEvents[_0x8d86('0x4')](_0xf04d37,_0x5be215);_0x3ed3d1(null);};}for(var e in events){if(events[_0x8d86('0x5')](e)){var event=events[e];MailAccount[_0x8d86('0x6')](e,emitEvent(event));}}module[_0x8d86('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6441bce..316f3bb 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 _0x89d1=['Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','pass','./mailAccount.attributes','MailAccount','provider','custom','host'];(function(_0x557168,_0x28438e){var _0x3ee9e0=function(_0x34aae5){while(--_0x34aae5){_0x557168['push'](_0x557168['shift']());}};_0x3ee9e0(++_0x28438e);}(_0x89d1,0x64));var _0x189d=function(_0x411757,_0x3680ee){_0x411757=_0x411757-0x0;var _0xf1b578=_0x89d1[_0x411757];return _0xf1b578;};'use strict';var attributes=require(_0x189d('0x0'));module['exports']=function(_0x3dc984){return _0x3dc984['define'](_0x189d('0x1'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2cf5f9=this;var _0x2051fc={'id':_0x2cf5f9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2cf5f9[_0x189d('0x2')]!==_0x189d('0x3')){_0x2051fc['service']=_0x2cf5f9[_0x189d('0x2')];}else{_0x2051fc[_0x189d('0x4')]=_0x2cf5f9[_0x189d('0x5')][_0x189d('0x4')];_0x2051fc[_0x189d('0x6')]=_0x2cf5f9[_0x189d('0x5')][_0x189d('0x6')];_0x2051fc[_0x189d('0x7')]=_0x2cf5f9[_0x189d('0x5')][_0x189d('0x7')];}if(_0x2cf5f9[_0x189d('0x5')][_0x189d('0x8')]){if(_0x2cf5f9[_0x189d('0x5')][_0x189d('0x9')]){if(!_0x2cf5f9[_0x189d('0x5')]['CloudProvider'])throw new Error(_0x189d('0xa'));_0x2051fc[_0x189d('0xb')]={'type':'OAuth2','user':_0x2cf5f9[_0x189d('0x5')][_0x189d('0xc')],'accessToken':_0x2cf5f9[_0x189d('0x5')][_0x189d('0xd')]['data5']};}else{_0x2051fc['auth']={'user':_0x2cf5f9['Smtp'][_0x189d('0xc')],'pass':_0x2cf5f9[_0x189d('0x5')][_0x189d('0xe')]};}}return _0x2051fc;}}});}; \ No newline at end of file +var _0x1f70=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host'];(function(_0x1c6e58,_0x471ada){var _0x38f14b=function(_0x46dc14){while(--_0x46dc14){_0x1c6e58['push'](_0x1c6e58['shift']());}};_0x38f14b(++_0x471ada);}(_0x1f70,0x123));var _0x01f7=function(_0x577f71,_0x43458f){_0x577f71=_0x577f71-0x0;var _0x3180be=_0x1f70[_0x577f71];return _0x3180be;};'use strict';var attributes=require(_0x01f7('0x0'));module[_0x01f7('0x1')]=function(_0x44dadc){return _0x44dadc[_0x01f7('0x2')](_0x01f7('0x3'),attributes,{'tableName':_0x01f7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x13d8b4=this;var _0x12a6fb={'id':_0x13d8b4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x13d8b4[_0x01f7('0x5')]!==_0x01f7('0x6')){_0x12a6fb[_0x01f7('0x7')]=_0x13d8b4[_0x01f7('0x5')];}else{_0x12a6fb[_0x01f7('0x8')]=_0x13d8b4[_0x01f7('0x9')][_0x01f7('0x8')];_0x12a6fb[_0x01f7('0xa')]=_0x13d8b4['Smtp'][_0x01f7('0xa')];_0x12a6fb[_0x01f7('0xb')]=_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xb')];}if(_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xc')]){if(_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xd')]){if(!_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xe')])throw new Error(_0x01f7('0xf'));_0x12a6fb['auth']={'type':_0x01f7('0x10'),'user':_0x13d8b4[_0x01f7('0x9')][_0x01f7('0x11')],'accessToken':_0x13d8b4[_0x01f7('0x9')][_0x01f7('0xe')]['data5']};}else{_0x12a6fb[_0x01f7('0x12')]={'user':_0x13d8b4[_0x01f7('0x9')][_0x01f7('0x11')],'pass':_0x13d8b4['Smtp'][_0x01f7('0x13')]};}}return _0x12a6fb;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0d6bbcf..3e45b46 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 _0x3c6c=['MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','register','request','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowMailAccount','find','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','asc','autoclose','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','created','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x299059,_0x13b88c){_0x299059=_0x299059-0x0;var _0x1bb9cb=_0x3c6c[_0x299059];return _0x1bb9cb;};'use strict';var _=require(_0xc3c6('0x0'));var moment=require('moment');var BPromise=require(_0xc3c6('0x1'));var rs=require(_0xc3c6('0x2'));var Redis=require(_0xc3c6('0x3'));var db=require(_0xc3c6('0x4'))['db'];var logger=require(_0xc3c6('0x5'))(_0xc3c6('0x6'));var config=require(_0xc3c6('0x7'));var jayson=require(_0xc3c6('0x8'));var client=jayson['client'][_0xc3c6('0x9')]({'port':0x232c});config['redis']=_[_0xc3c6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0xc3c6('0xb')](socket);function respondWithRpcPromise(_0x1c04d4,_0x5bc1c1,_0x168fdc){return new BPromise(function(_0x1ba453,_0x44b9c9){return client[_0xc3c6('0xc')](_0x1c04d4,_0x168fdc)['then'](function(_0x115b59){logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x5bc1c1,'request\x20sent');logger['debug'](_0xc3c6('0xf'),_0x5bc1c1,_0xc3c6('0x10'),JSON[_0xc3c6('0x11')](_0x115b59));if(_0x115b59[_0xc3c6('0x12')]){if(_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x13')]===0x1f4){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x5bc1c1,_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);return _0x44b9c9(_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);}logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x5bc1c1,_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);return _0x1ba453(_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);}else{logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x5bc1c1,_0xc3c6('0x10'));_0x1ba453(_0x115b59[_0xc3c6('0x15')][_0xc3c6('0x14')]);}})[_0xc3c6('0x16')](function(_0x3003e1){logger[_0xc3c6('0x12')]('MailAccount,\x20%s,\x20%s',_0x5bc1c1,_0x3003e1);_0x44b9c9(_0x3003e1);});});}exports[_0xc3c6('0x17')]=function(_0x5a2456){var _0x2150e0=this;return new Promise(function(_0x248bfe,_0x3893c4){return db[_0xc3c6('0x18')][_0xc3c6('0x19')]({'raw':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1c')]||null:null,'attributes':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1d')]||null:null,'limit':_0x5a2456['options']?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1e')]||null:null,'include':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456['options'][_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1f')],function(_0x2bc9bf){return{'model':db[_0x2bc9bf[_0xc3c6('0x21')]],'as':_0x2bc9bf['as'],'attributes':_0x2bc9bf[_0xc3c6('0x1d')],'include':_0x2bc9bf['include']?_[_0xc3c6('0x20')](_0x2bc9bf[_0xc3c6('0x1f')],function(_0x4ca76f){return{'model':db[_0x4ca76f[_0xc3c6('0x21')]],'as':_0x4ca76f['as'],'attributes':_0x4ca76f[_0xc3c6('0x1d')],'include':_0x4ca76f[_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x4ca76f[_0xc3c6('0x1f')],function(_0x420723){return{'model':db[_0x420723[_0xc3c6('0x21')]],'as':_0x420723['as'],'attributes':_0x420723[_0xc3c6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc3c6('0x22')](function(_0x478a4b){logger[_0xc3c6('0xd')](_0xc3c6('0x17'),_0x5a2456);logger[_0xc3c6('0x23')](_0xc3c6('0x17'),_0x5a2456,JSON['stringify'](_0x478a4b));_0x248bfe(_0x478a4b);})[_0xc3c6('0x16')](function(_0x1bcc34){logger[_0xc3c6('0x12')](_0xc3c6('0x17'),_0x1bcc34[_0xc3c6('0x14')],_0x5a2456);_0x3893c4(_0x2150e0[_0xc3c6('0x12')](0x1f4,_0x1bcc34['message']));});});};exports[_0xc3c6('0x24')]=function(_0x249bad){var _0x2220ca=this;return new Promise(function(_0x2b715c,_0x380345){return db['MailAccount'][_0xc3c6('0x25')]({'raw':_0x249bad[_0xc3c6('0x1a')]?_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x249bad[_0xc3c6('0x1a')]?_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1c')]||null:null,'attributes':_0x249bad['options']?_0x249bad[_0xc3c6('0x1a')]['attributes']||null:null,'include':_0x249bad[_0xc3c6('0x1a')]?_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1f')],function(_0x4ba1ae){return{'model':db[_0x4ba1ae[_0xc3c6('0x21')]],'as':_0x4ba1ae['as'],'attributes':_0x4ba1ae[_0xc3c6('0x1d')],'include':_0x4ba1ae['include']?_[_0xc3c6('0x20')](_0x4ba1ae[_0xc3c6('0x1f')],function(_0x139944){return{'model':db[_0x139944[_0xc3c6('0x21')]],'as':_0x139944['as'],'attributes':_0x139944[_0xc3c6('0x1d')],'include':_0x139944[_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x139944['include'],function(_0x5daaf2){return{'model':db[_0x5daaf2[_0xc3c6('0x21')]],'as':_0x5daaf2['as'],'attributes':_0x5daaf2[_0xc3c6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc3c6('0x22')](function(_0xfe1489){if(_0x249bad[_0xc3c6('0x1a')]['smtp']===!![])_0xfe1489[_0xc3c6('0x26')](_0xc3c6('0x27'),_0xfe1489[_0xc3c6('0x28')]());logger[_0xc3c6('0xd')](_0xc3c6('0x24'),_0x249bad);logger[_0xc3c6('0x23')](_0xc3c6('0x24'),_0x249bad,JSON[_0xc3c6('0x11')](_0xfe1489));_0x2b715c(_0xfe1489);})[_0xc3c6('0x16')](function(_0x52ef62){logger[_0xc3c6('0x12')](_0xc3c6('0x24'),_0x52ef62[_0xc3c6('0x14')],_0x249bad);_0x380345(_0x2220ca[_0xc3c6('0x12')](0x1f4,_0x52ef62[_0xc3c6('0x14')]));});});};exports[_0xc3c6('0x29')]=function(_0x3e839e){var _0x376e90=this;return new Promise(function(_0x59b2d9,_0x30692f){var _0x242e2b={'body':_0x3e839e['body'],'channel':_0xc3c6('0x2a')};var _0x5ea389=_[_0xc3c6('0x2b')](_[_0xc3c6('0x2c')](db[_0xc3c6('0x2d')][_0xc3c6('0x2e')]),[_0xc3c6('0x2f'),_0xc3c6('0x30'),_0xc3c6('0x31'),_0xc3c6('0x32')]);var _0x572339=![];if(_0x3e839e[_0xc3c6('0x33')]['id']){delete _0x3e839e['body']['id'];}if(_[_0xc3c6('0x34')](_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x35')])){return _0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x33')])||_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x33')]===''){return _0x30692f(_0x376e90['error'](0x1f4,_0xc3c6('0x36')));}if(_[_0xc3c6('0x34')](_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x37')])){return _0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,_0xc3c6('0x38')+_0x5ea389));}if(!_[_0xc3c6('0x39')](_0x5ea389,_0x3e839e['body']['mapKey'])){return _0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,_0xc3c6('0x3a')+_0x5ea389));}var _0x490bbf={};_0x490bbf[_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x37')]]=_0x3e839e['body'][_0xc3c6('0x35')];return db[_0xc3c6('0x18')]['find']({'where':{'id':_0x3e839e[_0xc3c6('0x3b')]['id']},'include':[{'model':db[_0xc3c6('0x3c')],'as':_0xc3c6('0x3d'),'include':[{'model':db[_0xc3c6('0x2d')],'as':_0xc3c6('0x3e'),'where':_0x490bbf,'limit':0x1,'order':[[_0xc3c6('0x30'),_0xc3c6('0x3f')]]}]},{'model':db[_0xc3c6('0x40')],'as':_0xc3c6('0x41')},{'model':db[_0xc3c6('0x42')],'as':_0xc3c6('0x43'),'include':[{'model':db[_0xc3c6('0x44')],'as':_0xc3c6('0x44')}]}]})[_0xc3c6('0x22')](function(_0x55b8bc){if(_0x55b8bc&&_0x55b8bc['List']){var _0x387a41=_0x55b8bc[_0xc3c6('0x45')]({'plain':!![]});_0x242e2b[_0xc3c6('0x3b')]=_[_0xc3c6('0x46')](_0x387a41,['Applications','List']);_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x27')]=_0x55b8bc[_0xc3c6('0x28')]();_0x242e2b[_0xc3c6('0x47')]=_0x387a41[_0xc3c6('0x41')];_0x242e2b[_0xc3c6('0x48')]=_0x387a41[_0xc3c6('0x3d')];_0x242e2b[_0xc3c6('0x47')]=_[_0xc3c6('0x49')](_0x242e2b[_0xc3c6('0x47')],[_0xc3c6('0x4a')],[_0xc3c6('0x4b')]);if(_0x242e2b[_0xc3c6('0x3b')]&&_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x4c')]){_0x242e2b[_0xc3c6('0x47')]['push']({'id':0x0,'priority':_0x242e2b[_0xc3c6('0x47')][_0xc3c6('0x4d')]+0x1,'app':'close','appdata':'autoclose','interval':_0xc3c6('0x4e')});}if(_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x41')]){delete _0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x41')];}if(_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x3d')]){delete _0x242e2b['account']['List'];}if(_0x387a41[_0xc3c6('0x3d')][_0xc3c6('0x3e')][_0xc3c6('0x4d')]){return _0x387a41[_0xc3c6('0x3d')][_0xc3c6('0x3e')][0x0];}var _0x2e9314=_[_0xc3c6('0xa')](_0x3e839e[_0xc3c6('0x33')],{'firstName':_0x3e839e[_0xc3c6('0x33')]['from'],'ListId':_0x387a41[_0xc3c6('0x32')]});_0x2e9314[_0x3e839e['body']['mapKey']]=_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x35')];return db[_0xc3c6('0x2d')][_0xc3c6('0x4f')](_0x2e9314);}else{throw new Error(_0xc3c6('0x50'));}})[_0xc3c6('0x22')](function(_0x330cfc){_0x242e2b[_0xc3c6('0x51')]=_0x330cfc;if(_0x330cfc){if(!_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['messageId']){_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x52')]=rs[_0xc3c6('0x53')]()+'\x20'+_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x35')];}var _0x528383={'ContactId':_0x330cfc['id'],'MailAccountId':_0x3e839e['account']['id'],'inReplyTo':_0x3e839e['body'][_0xc3c6('0x14')][_0xc3c6('0x52')],'to':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x35')],'cc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['cc'],'subject':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x54')],'attach':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x55')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xc3c6('0x56')][_0xc3c6('0x25')]({'where':{'closed':![],'MailAccountId':_0x3e839e[_0xc3c6('0x3b')]['id']},'include':[{'model':db[_0xc3c6('0x57')],'as':_0xc3c6('0x58'),'attributes':[_0xc3c6('0x52')],'where':{'messageId':_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x59')]}}]})['then'](function(_0x1709a8){if(_0x1709a8){return[_0x1709a8,![]];}return db['MailInteraction'][_0xc3c6('0x4f')](_0x528383)[_0xc3c6('0x22')](function(_0x5cc468){return[_0x5cc468,!![]];});});}else{throw new Error(_0xc3c6('0x5a'));}})[_0xc3c6('0x5b')](function(_0x333d8f,_0x501847){if(_0x333d8f){_0x572339=_0x501847;if(!_0x501847){return _0x333d8f[_0xc3c6('0x5c')]({'inReplyTo':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x52')],'to':_0x3e839e[_0xc3c6('0x33')]['message']['from'],'cc':_0x3e839e[_0xc3c6('0x33')]['message']['cc'],'subject':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['subject'],'attach':_0x333d8f[_0xc3c6('0x55')]?_0x333d8f[_0xc3c6('0x55')]:_0x3e839e['body']['message'][_0xc3c6('0x55')],'substatus':null,'substatusAt':moment()[_0xc3c6('0x5d')](_0xc3c6('0x5e')),'lastMsgAt':moment()['format'](_0xc3c6('0x5e')),'lastMsgDirection':'in'});}else{return _0x333d8f;}}})['then'](function(_0x3dd6d2){_0x242e2b['interaction']=_0x3dd6d2['get']({'plain':!![]});_0x242e2b['interaction'][_0xc3c6('0x5f')]=_0x572339;return db['MailMessage'][_0xc3c6('0x4f')]({'body':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x33')],'MailAccountId':_0x3e839e[_0xc3c6('0x3b')]['id'],'MailInteractionId':_0x3dd6d2['id'],'direction':'in','ContactId':_0x242e2b['contact']['id'],'messageId':_0x3e839e['body']['message']['messageId'],'from':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x35')],'to':_0x3e839e['body'][_0xc3c6('0x14')]['to'],'cc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['cc'],'subject':_0x3e839e[_0xc3c6('0x33')]['message']['subject'],'attach':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x55')],'Attachments':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x60')],'originTo':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x61')],'originCc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x62')],'bcc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x63')],'ChatWebsiteId':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['ChatWebsiteId']||null,'originChannel':_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x64')]||_0xc3c6('0x65'),'ChatOfflineMessageId':_0x3e839e['body'][_0xc3c6('0x14')][_0xc3c6('0x66')]||null},{'include':[{'model':db[_0xc3c6('0x67')],'as':_0xc3c6('0x68')}]});})[_0xc3c6('0x22')](function(_0x408544){_0x242e2b[_0xc3c6('0x14')]=_0x408544;if(!_0x242e2b[_0xc3c6('0x69')][_0xc3c6('0x6a')]){return;}return db[_0xc3c6('0x6b')][_0xc3c6('0x25')]({'attributes':['id',_0xc3c6('0x6c')],'where':{'id':_0x242e2b['interaction'][_0xc3c6('0x6a')]}});})[_0xc3c6('0x22')](function(_0x25c747){if(_0x25c747){_0x242e2b[_0xc3c6('0x47')][_0xc3c6('0x6d')]({'id':0x0,'priority':0x0,'app':_0xc3c6('0x6e'),'appdata':_0x25c747[_0xc3c6('0x6c')]+','+(_0x242e2b['account'][_0xc3c6('0x6f')]||0xa),'interval':_0xc3c6('0x4e')});}if(!_0x242e2b[_0xc3c6('0x69')][_0xc3c6('0x70')]){return;}return db[_0xc3c6('0x71')]['find']({'attributes':['id',_0xc3c6('0x6c')],'where':{'id':_0x242e2b[_0xc3c6('0x69')]['queueId']}});})[_0xc3c6('0x22')](function(_0x104038){if(_0x104038){_0x242e2b[_0xc3c6('0x47')][_0xc3c6('0x6d')]({'id':0x0,'priority':0x1,'app':_0xc3c6('0x72'),'appdata':_0x104038[_0xc3c6('0x6c')]+','+(_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x73')]||0x12c),'interval':_0xc3c6('0x4e')});}return respondWithRpcPromise(_0xc3c6('0x74'),_0xc3c6('0x75'),_0x242e2b);})[_0xc3c6('0x22')](function(_0x2ec1b5){_0x59b2d9(_0x2ec1b5);})['catch'](function(_0x2e7a09){_0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,_0x2e7a09[_0xc3c6('0x14')]));});});}; \ No newline at end of file +var _0xa990=['info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','map','include','model','debug','stringify','find','setDataValue','smtpOptions','body','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey','includes','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','format','interaction','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','agent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then'];(function(_0x360b62,_0x586c78){var _0x42eae5=function(_0x200665){while(--_0x200665){_0x360b62['push'](_0x360b62['shift']());}};_0x42eae5(++_0x586c78);}(_0xa990,0xc9));var _0x0a99=function(_0x1cf2ec,_0x25c2bf){_0x1cf2ec=_0x1cf2ec-0x0;var _0x4320b2=_0xa990[_0x1cf2ec];return _0x4320b2;};'use strict';var _=require(_0x0a99('0x0'));var moment=require(_0x0a99('0x1'));var BPromise=require(_0x0a99('0x2'));var rs=require(_0x0a99('0x3'));var Redis=require(_0x0a99('0x4'));var db=require(_0x0a99('0x5'))['db'];var logger=require(_0x0a99('0x6'))(_0x0a99('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a99('0x8')][_0x0a99('0x9')]({'port':0x232c});config[_0x0a99('0xa')]=_[_0x0a99('0xb')](config[_0x0a99('0xa')],{'host':_0x0a99('0xc'),'port':0x18eb});var socket=require(_0x0a99('0xd'))(new Redis(config[_0x0a99('0xa')]));require(_0x0a99('0xe'))[_0x0a99('0xf')](socket);function respondWithRpcPromise(_0x1eaa2a,_0x56810b,_0x813e91){return new BPromise(function(_0x38e89b,_0x5b5ec3){return client['request'](_0x1eaa2a,_0x813e91)[_0x0a99('0x10')](function(_0x35f37f){logger[_0x0a99('0x11')](_0x0a99('0x12'),_0x56810b,_0x0a99('0x13'));logger['debug'](_0x0a99('0x14'),_0x56810b,_0x0a99('0x13'),JSON['stringify'](_0x35f37f));if(_0x35f37f[_0x0a99('0x15')]){if(_0x35f37f[_0x0a99('0x15')][_0x0a99('0x16')]===0x1f4){logger[_0x0a99('0x15')](_0x0a99('0x12'),_0x56810b,_0x35f37f[_0x0a99('0x15')][_0x0a99('0x17')]);return _0x5b5ec3(_0x35f37f[_0x0a99('0x15')]['message']);}logger['error'](_0x0a99('0x12'),_0x56810b,_0x35f37f[_0x0a99('0x15')][_0x0a99('0x17')]);return _0x38e89b(_0x35f37f['error'][_0x0a99('0x17')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x56810b,_0x0a99('0x13'));_0x38e89b(_0x35f37f[_0x0a99('0x18')][_0x0a99('0x17')]);}})[_0x0a99('0x19')](function(_0x572ce5){logger['error'](_0x0a99('0x12'),_0x56810b,_0x572ce5);_0x5b5ec3(_0x572ce5);});});}exports[_0x0a99('0x1a')]=function(_0xbe23f3){var _0x416d32=this;return new Promise(function(_0x5e6c7e,_0x58c86d){return db[_0x0a99('0x1b')]['findAll']({'raw':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3['options'][_0x0a99('0x1d')]===undefined?!![]:![]:!![],'where':_0xbe23f3['options']?_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x1e')]||null:null,'attributes':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x1f')]||null:null,'limit':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x20')]||null:null,'include':_0xbe23f3[_0x0a99('0x1c')]?_0xbe23f3['options']['include']?_[_0x0a99('0x21')](_0xbe23f3[_0x0a99('0x1c')][_0x0a99('0x22')],function(_0x518617){return{'model':db[_0x518617['model']],'as':_0x518617['as'],'attributes':_0x518617[_0x0a99('0x1f')],'include':_0x518617[_0x0a99('0x22')]?_[_0x0a99('0x21')](_0x518617[_0x0a99('0x22')],function(_0x10e70f){return{'model':db[_0x10e70f[_0x0a99('0x23')]],'as':_0x10e70f['as'],'attributes':_0x10e70f[_0x0a99('0x1f')],'include':_0x10e70f[_0x0a99('0x22')]?_[_0x0a99('0x21')](_0x10e70f['include'],function(_0x411233){return{'model':db[_0x411233['model']],'as':_0x411233['as'],'attributes':_0x411233['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x223bdb){logger[_0x0a99('0x11')](_0x0a99('0x1a'),_0xbe23f3);logger[_0x0a99('0x24')](_0x0a99('0x1a'),_0xbe23f3,JSON[_0x0a99('0x25')](_0x223bdb));_0x5e6c7e(_0x223bdb);})[_0x0a99('0x19')](function(_0x47da33){logger[_0x0a99('0x15')](_0x0a99('0x1a'),_0x47da33[_0x0a99('0x17')],_0xbe23f3);_0x58c86d(_0x416d32[_0x0a99('0x15')](0x1f4,_0x47da33['message']));});});};exports['ShowMailAccount']=function(_0x563ee9){var _0x225e0f=this;return new Promise(function(_0x302da8,_0x1047a2){return db['MailAccount'][_0x0a99('0x26')]({'raw':_0x563ee9[_0x0a99('0x1c')]?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x1d')]===undefined?!![]:![]:!![],'where':_0x563ee9[_0x0a99('0x1c')]?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x1e')]||null:null,'attributes':_0x563ee9['options']?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x1f')]||null:null,'include':_0x563ee9[_0x0a99('0x1c')]?_0x563ee9[_0x0a99('0x1c')][_0x0a99('0x22')]?_['map'](_0x563ee9[_0x0a99('0x1c')]['include'],function(_0x555de8){return{'model':db[_0x555de8['model']],'as':_0x555de8['as'],'attributes':_0x555de8['attributes'],'include':_0x555de8[_0x0a99('0x22')]?_['map'](_0x555de8[_0x0a99('0x22')],function(_0x3d5e0f){return{'model':db[_0x3d5e0f[_0x0a99('0x23')]],'as':_0x3d5e0f['as'],'attributes':_0x3d5e0f[_0x0a99('0x1f')],'include':_0x3d5e0f[_0x0a99('0x22')]?_[_0x0a99('0x21')](_0x3d5e0f[_0x0a99('0x22')],function(_0x3bc3fc){return{'model':db[_0x3bc3fc[_0x0a99('0x23')]],'as':_0x3bc3fc['as'],'attributes':_0x3bc3fc[_0x0a99('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a99('0x10')](function(_0x3a2a78){if(_0x563ee9[_0x0a99('0x1c')]['smtp']===!![])_0x3a2a78[_0x0a99('0x27')](_0x0a99('0x28'),_0x3a2a78['getSmtpOptions']());logger[_0x0a99('0x11')]('ShowMailAccount',_0x563ee9);logger[_0x0a99('0x24')]('ShowMailAccount',_0x563ee9,JSON[_0x0a99('0x25')](_0x3a2a78));_0x302da8(_0x3a2a78);})[_0x0a99('0x19')](function(_0x27af76){logger[_0x0a99('0x15')]('ShowMailAccount',_0x27af76[_0x0a99('0x17')],_0x563ee9);_0x1047a2(_0x225e0f[_0x0a99('0x15')](0x1f4,_0x27af76[_0x0a99('0x17')]));});});};exports['NotifyMailAccount']=function(_0x426638){var _0x1f5c01=this;return new Promise(function(_0x23e4b9,_0x1abeb0){var _0x5acfbc={'body':_0x426638[_0x0a99('0x29')],'channel':'mail'};var _0x4e552c=_[_0x0a99('0x2a')](_['keys'](db[_0x0a99('0x2b')]['rawAttributes']),[_0x0a99('0x2c'),_0x0a99('0x2d'),_0x0a99('0x2e'),_0x0a99('0x2f')]);var _0x57b999=![];if(_0x426638[_0x0a99('0x29')]['id']){delete _0x426638[_0x0a99('0x29')]['id'];}if(_[_0x0a99('0x30')](_0x426638[_0x0a99('0x29')]['from'])){return _0x1abeb0(_0x1f5c01['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0a99('0x30')](_0x426638['body'][_0x0a99('0x29')])||_0x426638['body']['body']===''){return _0x1abeb0(_0x1f5c01['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0a99('0x30')](_0x426638['body'][_0x0a99('0x31')])){return _0x1abeb0(_0x1f5c01[_0x0a99('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e552c));}if(!_[_0x0a99('0x32')](_0x4e552c,_0x426638[_0x0a99('0x29')]['mapKey'])){return _0x1abeb0(_0x1f5c01[_0x0a99('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e552c));}var _0x3107bc={};_0x3107bc[_0x426638[_0x0a99('0x29')]['mapKey']]=_0x426638[_0x0a99('0x29')]['from'];return db['MailAccount'][_0x0a99('0x26')]({'where':{'id':_0x426638[_0x0a99('0x33')]['id']},'include':[{'model':db[_0x0a99('0x34')],'as':_0x0a99('0x35'),'include':[{'model':db[_0x0a99('0x2b')],'as':'Contacts','where':_0x3107bc,'limit':0x1,'order':[[_0x0a99('0x2d'),_0x0a99('0x36')]]}]},{'model':db[_0x0a99('0x37')],'as':_0x0a99('0x38')},{'model':db[_0x0a99('0x39')],'as':_0x0a99('0x3a'),'include':[{'model':db[_0x0a99('0x3b')],'as':_0x0a99('0x3b')}]}]})[_0x0a99('0x10')](function(_0x1621d9){if(_0x1621d9&&_0x1621d9['List']){var _0x50e04f=_0x1621d9[_0x0a99('0x3c')]({'plain':!![]});_0x5acfbc[_0x0a99('0x33')]=_[_0x0a99('0x3d')](_0x50e04f,[_0x0a99('0x38'),_0x0a99('0x35')]);_0x5acfbc[_0x0a99('0x33')]['smtpOptions']=_0x1621d9[_0x0a99('0x3e')]();_0x5acfbc[_0x0a99('0x3f')]=_0x50e04f['Applications'];_0x5acfbc[_0x0a99('0x40')]=_0x50e04f[_0x0a99('0x35')];_0x5acfbc['applications']=_[_0x0a99('0x41')](_0x5acfbc[_0x0a99('0x3f')],[_0x0a99('0x42')],[_0x0a99('0x43')]);if(_0x5acfbc[_0x0a99('0x33')]&&_0x5acfbc[_0x0a99('0x33')][_0x0a99('0x44')]){_0x5acfbc['applications'][_0x0a99('0x45')]({'id':0x0,'priority':_0x5acfbc[_0x0a99('0x3f')][_0x0a99('0x46')]+0x1,'app':'close','appdata':_0x0a99('0x44'),'interval':_0x0a99('0x47')});}if(_0x5acfbc[_0x0a99('0x33')]['Applications']){delete _0x5acfbc[_0x0a99('0x33')][_0x0a99('0x38')];}if(_0x5acfbc[_0x0a99('0x33')][_0x0a99('0x35')]){delete _0x5acfbc[_0x0a99('0x33')][_0x0a99('0x35')];}if(_0x50e04f['List'][_0x0a99('0x48')]['length']){return _0x50e04f[_0x0a99('0x35')][_0x0a99('0x48')][0x0];}var _0x330ff8=_[_0x0a99('0xb')](_0x426638['body'],{'firstName':_0x426638[_0x0a99('0x29')]['from'],'ListId':_0x50e04f[_0x0a99('0x2f')]});_0x330ff8[_0x426638[_0x0a99('0x29')][_0x0a99('0x31')]]=_0x426638[_0x0a99('0x29')][_0x0a99('0x49')];return db[_0x0a99('0x2b')][_0x0a99('0x4a')](_0x330ff8);}else{throw new Error(_0x0a99('0x4b'));}})[_0x0a99('0x10')](function(_0xb3a5b2){_0x5acfbc[_0x0a99('0x4c')]=_0xb3a5b2;if(_0xb3a5b2){if(!_0x426638[_0x0a99('0x29')][_0x0a99('0x17')]['messageId']){_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4d')]=rs['generate']()+'\x20'+_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x49')];}var _0x50aaa0={'ContactId':_0xb3a5b2['id'],'MailAccountId':_0x426638[_0x0a99('0x33')]['id'],'inReplyTo':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4d')],'to':_0x426638['body'][_0x0a99('0x17')][_0x0a99('0x49')],'cc':_0x426638[_0x0a99('0x29')]['message']['cc'],'subject':_0x426638['body'][_0x0a99('0x17')]['subject'],'attach':_0x426638['body']['message'][_0x0a99('0x4e')],'lastMsgAt':moment()['format'](_0x0a99('0x4f')),'lastMsgDirection':'in'};return db[_0x0a99('0x50')][_0x0a99('0x26')]({'where':{'closed':![],'MailAccountId':_0x426638[_0x0a99('0x33')]['id']},'include':[{'model':db[_0x0a99('0x51')],'as':_0x0a99('0x52'),'attributes':[_0x0a99('0x4d')],'where':{'messageId':_0x426638['body'][_0x0a99('0x17')][_0x0a99('0x53')]}}]})[_0x0a99('0x10')](function(_0x520889){if(_0x520889){return[_0x520889,![]];}return db[_0x0a99('0x50')]['create'](_0x50aaa0)[_0x0a99('0x10')](function(_0x51d18a){return[_0x51d18a,!![]];});});}else{throw new Error(_0x0a99('0x54'));}})[_0x0a99('0x55')](function(_0x544a23,_0x420c2d){if(_0x544a23){_0x57b999=_0x420c2d;if(!_0x420c2d){return _0x544a23['update']({'inReplyTo':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4d')],'to':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x49')],'cc':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')]['cc'],'subject':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x56')],'attach':_0x544a23[_0x0a99('0x4e')]?_0x544a23[_0x0a99('0x4e')]:_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4e')],'substatus':null,'substatusAt':moment()[_0x0a99('0x57')](_0x0a99('0x4f')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x544a23;}}})['then'](function(_0x40b1bb){_0x5acfbc[_0x0a99('0x58')]=_0x40b1bb[_0x0a99('0x3c')]({'plain':!![]});_0x5acfbc['interaction'][_0x0a99('0x59')]=_0x57b999;return db[_0x0a99('0x51')][_0x0a99('0x4a')]({'body':_0x426638[_0x0a99('0x29')]['body'],'MailAccountId':_0x426638[_0x0a99('0x33')]['id'],'MailInteractionId':_0x40b1bb['id'],'direction':'in','ContactId':_0x5acfbc[_0x0a99('0x4c')]['id'],'messageId':_0x426638['body']['message'][_0x0a99('0x4d')],'from':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x49')],'to':_0x426638[_0x0a99('0x29')]['message']['to'],'cc':_0x426638['body'][_0x0a99('0x17')]['cc'],'subject':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x56')],'attach':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x4e')],'Attachments':_0x426638[_0x0a99('0x29')]['message'][_0x0a99('0x5a')],'originTo':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')]['originTo'],'originCc':_0x426638[_0x0a99('0x29')]['message'][_0x0a99('0x5b')],'bcc':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x5c')],'ChatWebsiteId':_0x426638['body'][_0x0a99('0x17')][_0x0a99('0x5d')]||null,'originChannel':_0x426638[_0x0a99('0x29')][_0x0a99('0x17')][_0x0a99('0x5e')]||_0x0a99('0x5f'),'ChatOfflineMessageId':_0x426638[_0x0a99('0x29')]['message'][_0x0a99('0x60')]||null},{'include':[{'model':db[_0x0a99('0x61')],'as':_0x0a99('0x62')}]});})[_0x0a99('0x10')](function(_0x4fc4a4){_0x5acfbc[_0x0a99('0x17')]=_0x4fc4a4;if(!_0x5acfbc['interaction']['UserId']){return;}return db[_0x0a99('0x63')][_0x0a99('0x26')]({'attributes':['id',_0x0a99('0x64')],'where':{'id':_0x5acfbc[_0x0a99('0x58')][_0x0a99('0x65')]}});})[_0x0a99('0x10')](function(_0x24a389){if(_0x24a389){_0x5acfbc[_0x0a99('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0a99('0x66'),'appdata':_0x24a389['name']+','+(_0x5acfbc['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0a99('0x47')});}if(!_0x5acfbc[_0x0a99('0x58')]['queueId']){return;}return db['MailQueue'][_0x0a99('0x26')]({'attributes':['id',_0x0a99('0x64')],'where':{'id':_0x5acfbc[_0x0a99('0x58')][_0x0a99('0x67')]}});})[_0x0a99('0x10')](function(_0x3ed54e){if(_0x3ed54e){_0x5acfbc[_0x0a99('0x3f')][_0x0a99('0x68')]({'id':0x0,'priority':0x1,'app':_0x0a99('0x69'),'appdata':_0x3ed54e['name']+','+(_0x5acfbc['account'][_0x0a99('0x6a')]||0x12c),'interval':_0x0a99('0x47')});}return respondWithRpcPromise(_0x0a99('0x6b'),_0x0a99('0x6c'),_0x5acfbc);})[_0x0a99('0x10')](function(_0x22b737){_0x23e4b9(_0x22b737);})[_0x0a99('0x19')](function(_0x5588dc){_0x1abeb0(_0x1f5c01['error'](0x1f4,_0x5588dc[_0x0a99('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 7548cdf..6607942 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 _0xad1b=['./mailAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xad1b,0x1b0));var _0xbad1=function(_0x4159ec,_0x157718){_0x4159ec=_0x4159ec-0x0;var _0x4d61e6=_0xad1b[_0x4159ec];return _0x4d61e6;};'use strict';var MailAccountEvents=require(_0xbad1('0x0'));var events=[_0xbad1('0x1'),_0xbad1('0x2'),_0xbad1('0x3')];function createListener(_0x331b2a,_0x2e297a){return function(_0x26c7c6){_0x2e297a[_0xbad1('0x4')](_0x331b2a,_0x26c7c6);};}function removeListener(_0x20ae63,_0x46a68b){return function(){MailAccountEvents[_0xbad1('0x5')](_0x20ae63,_0x46a68b);};}exports[_0xbad1('0x6')]=function(_0x3f6117){for(var _0x278e16=0x0,_0x105a91=events[_0xbad1('0x7')];_0x278e16<_0x105a91;_0x278e16++){var _0x32790e=events[_0x278e16];var _0x9fc7b4=createListener('mailAccount:'+_0x32790e,_0x3f6117);MailAccountEvents['on'](_0x32790e,_0x9fc7b4);}}; \ No newline at end of file +var _0x9699=['length','mailAccount:','./mailAccount.events','save','emit','removeListener','register'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x9699,0xd4));var _0x9969=function(_0x4d741e,_0x39f4d3){_0x4d741e=_0x4d741e-0x0;var _0x368894=_0x9699[_0x4d741e];return _0x368894;};'use strict';var MailAccountEvents=require(_0x9969('0x0'));var events=[_0x9969('0x1'),'remove','update'];function createListener(_0x11697f,_0x2e9660){return function(_0x54d7f2){_0x2e9660[_0x9969('0x2')](_0x11697f,_0x54d7f2);};}function removeListener(_0x4e633d,_0x5efafc){return function(){MailAccountEvents[_0x9969('0x3')](_0x4e633d,_0x5efafc);};}exports[_0x9969('0x4')]=function(_0x3e2b68){for(var _0x41c8b3=0x0,_0x1efa92=events[_0x9969('0x5')];_0x41c8b3<_0x1efa92;_0x41c8b3++){var _0x70260f=events[_0x41c8b3];var _0x5a052d=createListener(_0x9969('0x6')+_0x70260f,_0x3e2b68);MailAccountEvents['on'](_0x70260f,_0x5a052d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 18e2d83..828db63 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 _0xa2d0=['put','isAuthenticated','update','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','show'];(function(_0x28ee69,_0xac3a4f){var _0x175b38=function(_0x16ec94){while(--_0x16ec94){_0x28ee69['push'](_0x28ee69['shift']());}};_0x175b38(++_0xac3a4f);}(_0xa2d0,0xe6));var _0x0a2d=function(_0x568547,_0x210a8b){_0x568547=_0x568547-0x0;var _0x3385b0=_0xa2d0[_0x568547];return _0x3385b0;};'use strict';var multer=require(_0x0a2d('0x0'));var util=require(_0x0a2d('0x1'));var path=require(_0x0a2d('0x2'));var timeout=require(_0x0a2d('0x3'));var express=require(_0x0a2d('0x4'));var router=express[_0x0a2d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a2d('0x6'));var interaction=require(_0x0a2d('0x7'));var config=require(_0x0a2d('0x8'));var controller=require('./mailApplication.controller');router['get']('/:id',auth['isAuthenticated'](),controller[_0x0a2d('0x9')]);router[_0x0a2d('0xa')]('/:id',auth[_0x0a2d('0xb')](),controller[_0x0a2d('0xc')]);router[_0x0a2d('0xd')](_0x0a2d('0xe'),auth[_0x0a2d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbabb=['update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x148303,_0x1e221e){var _0x17e53f=function(_0x35e26f){while(--_0x35e26f){_0x148303['push'](_0x148303['shift']());}};_0x17e53f(++_0x1e221e);}(_0xbabb,0x73));var _0xbbab=function(_0x2bbdde,_0x340b60){_0x2bbdde=_0x2bbdde-0x0;var _0x326378=_0xbabb[_0x2bbdde];return _0x326378;};'use strict';var multer=require(_0xbbab('0x0'));var util=require(_0xbbab('0x1'));var path=require('path');var timeout=require(_0xbbab('0x2'));var express=require(_0xbbab('0x3'));var router=express['Router']();var fs_extra=require(_0xbbab('0x4'));var auth=require(_0xbbab('0x5'));var interaction=require(_0xbbab('0x6'));var config=require('../../config/environment');var controller=require(_0xbbab('0x7'));router['get'](_0xbbab('0x8'),auth[_0xbbab('0x9')](),controller[_0xbbab('0xa')]);router['put'](_0xbbab('0x8'),auth[_0xbbab('0x9')](),controller[_0xbbab('0xb')]);router['delete'](_0xbbab('0x8'),auth['isAuthenticated'](),controller[_0xbbab('0xc')]);module[_0xbbab('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 25370e3..cbfdb3f 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 _0xb224=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x4e71d7,_0x38d58d){var _0x49284b=function(_0x1f2b59){while(--_0x1f2b59){_0x4e71d7['push'](_0x4e71d7['shift']());}};_0x49284b(++_0x38d58d);}(_0xb224,0x7a));var _0x4b22=function(_0x5989f5,_0x198fe7){_0x5989f5=_0x5989f5-0x0;var _0x36f4fc=_0xb224[_0x5989f5];return _0x36f4fc;};'use strict';var Sequelize=require(_0x4b22('0x0'));module[_0x4b22('0x1')]={'priority':{'type':Sequelize[_0x4b22('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b22('0x3')},'appdata':{'type':Sequelize[_0x4b22('0x4')]()},'description':{'type':Sequelize[_0x4b22('0x5')]},'interval':{'type':Sequelize[_0x4b22('0x5')],'defaultValue':_0x4b22('0x6')}}; \ No newline at end of file +var _0xdee6=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x4e5c3e,_0x32abf1){var _0x58e1a0=function(_0x4ca18b){while(--_0x4ca18b){_0x4e5c3e['push'](_0x4e5c3e['shift']());}};_0x58e1a0(++_0x32abf1);}(_0xdee6,0x9f));var _0x6dee=function(_0x4b47e9,_0x41dc3a){_0x4b47e9=_0x4b47e9-0x0;var _0x1e8ac2=_0xdee6[_0x4b47e9];return _0x1e8ac2;};'use strict';var Sequelize=require(_0x6dee('0x0'));module[_0x6dee('0x1')]={'priority':{'type':Sequelize[_0x6dee('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6dee('0x3')},'appdata':{'type':Sequelize[_0x6dee('0x4')]()},'description':{'type':Sequelize[_0x6dee('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6dee('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b1ba103..ca77cea 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x131627,_0x642b7a){var _0x10a0b1=function(_0x410d58){while(--_0x410d58){_0x131627['push'](_0x131627['shift']());}};_0x10a0b1(++_0x642b7a);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x47aded,_0xb76625){var _0x505e9a=function(_0x68696d){while(--_0x68696d){_0x47aded['push'](_0x47aded['shift']());}};_0x505e9a(++_0xb76625);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9603bff..fde2ebf 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 _0xbaee=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x407876,_0x3cb7e0){var _0x32045b=function(_0x175078){while(--_0x175078){_0x407876['push'](_0x407876['shift']());}};_0x32045b(++_0x3cb7e0);}(_0xbaee,0xa0));var _0xebae=function(_0x33d4e7,_0x35a104){_0x33d4e7=_0x33d4e7-0x0;var _0xf26e84=_0xbaee[_0x33d4e7];return _0xf26e84;};'use strict';var _=require(_0xebae('0x0'));var util=require(_0xebae('0x1'));var logger=require('../../config/logger')(_0xebae('0x2'));var moment=require(_0xebae('0x3'));var BPromise=require(_0xebae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebae('0x5'));var rimraf=require(_0xebae('0x6'));var config=require(_0xebae('0x7'));var attributes=require(_0xebae('0x8'));module[_0xebae('0x9')]=function(_0x5738ec,_0x310cc2){return _0x5738ec[_0xebae('0xa')](_0xebae('0xb'),attributes,{'tableName':_0xebae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebae('0xd'),'collate':_0xebae('0xe')});}; \ No newline at end of file +var _0xa208=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise'];(function(_0x10265e,_0xf3d38c){var _0x491c0e=function(_0x35b007){while(--_0x35b007){_0x10265e['push'](_0x10265e['shift']());}};_0x491c0e(++_0xf3d38c);}(_0xa208,0x159));var _0x8a20=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa208[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x8a20('0x0'));var util=require('util');var logger=require(_0x8a20('0x1'))(_0x8a20('0x2'));var moment=require(_0x8a20('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a20('0x4'));var fs=require('fs');var path=require(_0x8a20('0x5'));var rimraf=require(_0x8a20('0x6'));var config=require(_0x8a20('0x7'));var attributes=require(_0x8a20('0x8'));module[_0x8a20('0x9')]=function(_0x39f41b,_0x552c7e){return _0x39f41b['define'](_0x8a20('0xa'),attributes,{'tableName':_0x8a20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a20('0xc'),'collate':_0x8a20('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3cefdcb..9bd3dfa 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 _0x403b=['../../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','result','catch','UpdateMailApplication','update','options','raw','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x1e106b,_0x52feb8){var _0x3f9533=function(_0x31e814){while(--_0x31e814){_0x1e106b['push'](_0x1e106b['shift']());}};_0x3f9533(++_0x52feb8);}(_0x403b,0x11c));var _0xb403=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x403b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xb403('0x0'));var util=require('util');var moment=require(_0xb403('0x1'));var BPromise=require(_0xb403('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb403('0x3'));var db=require(_0xb403('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb403('0x5'));var config=require(_0xb403('0x6'));var jayson=require(_0xb403('0x7'));var client=jayson[_0xb403('0x8')][_0xb403('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x573fa6,_0x4c19ea,_0x1f5891){return new BPromise(function(_0x3c1b90,_0x156e28){return client[_0xb403('0xa')](_0x573fa6,_0x1f5891)[_0xb403('0xb')](function(_0x39baca){logger[_0xb403('0xc')]('MailApplication,\x20%s,\x20%s',_0x4c19ea,_0xb403('0xd'));logger[_0xb403('0xe')](_0xb403('0xf'),_0x4c19ea,_0xb403('0xd'),JSON[_0xb403('0x10')](_0x39baca));if(_0x39baca[_0xb403('0x11')]){if(_0x39baca[_0xb403('0x11')][_0xb403('0x12')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x4c19ea,_0x39baca[_0xb403('0x11')][_0xb403('0x13')]);return _0x156e28(_0x39baca[_0xb403('0x11')][_0xb403('0x13')]);}logger[_0xb403('0x11')](_0xb403('0x14'),_0x4c19ea,_0x39baca[_0xb403('0x11')][_0xb403('0x13')]);return _0x3c1b90(_0x39baca[_0xb403('0x11')]['message']);}else{logger['info'](_0xb403('0x14'),_0x4c19ea,'request\x20sent');_0x3c1b90(_0x39baca[_0xb403('0x15')][_0xb403('0x13')]);}})[_0xb403('0x16')](function(_0x5c2d46){logger[_0xb403('0x11')](_0xb403('0x14'),_0x4c19ea,_0x5c2d46);_0x156e28(_0x5c2d46);});});}exports[_0xb403('0x17')]=function(_0x12ff65){var _0x38e779=this;return new Promise(function(_0x4f768c,_0x4e2320){return db['MailApplication'][_0xb403('0x18')](_0x12ff65['body'],{'raw':_0x12ff65[_0xb403('0x19')]?_0x12ff65['options'][_0xb403('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ff65[_0xb403('0x19')]?_0x12ff65[_0xb403('0x19')][_0xb403('0x1b')]||null:null,'attributes':_0x12ff65[_0xb403('0x19')]?_0x12ff65[_0xb403('0x19')]['attributes']||null:null,'limit':_0x12ff65[_0xb403('0x19')]?_0x12ff65[_0xb403('0x19')][_0xb403('0x1c')]||null:null})[_0xb403('0xb')](function(_0x36c9b0){logger['info'](_0xb403('0x17'),_0x12ff65);logger[_0xb403('0xe')](_0xb403('0x17'),_0x12ff65,JSON[_0xb403('0x10')](_0x36c9b0));_0x4f768c(_0x36c9b0);})[_0xb403('0x16')](function(_0x30a5cc){logger[_0xb403('0x11')](_0xb403('0x17'),_0x30a5cc['message'],_0x12ff65);_0x4e2320(_0x38e779[_0xb403('0x11')](0x1f4,_0x30a5cc[_0xb403('0x13')]));});});}; \ No newline at end of file +var _0x99b2=['options','raw','attributes','limit','UpdateMailApplication','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','MailApplication,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','update','body'];(function(_0x4eeebc,_0x1579e7){var _0x1316e1=function(_0x46cfc3){while(--_0x46cfc3){_0x4eeebc['push'](_0x4eeebc['shift']());}};_0x1316e1(++_0x1579e7);}(_0x99b2,0x12f));var _0x299b=function(_0x2cd31c,_0x10721e){_0x2cd31c=_0x2cd31c-0x0;var _0x150d3e=_0x99b2[_0x2cd31c];return _0x150d3e;};'use strict';var _=require(_0x299b('0x0'));var util=require(_0x299b('0x1'));var moment=require('moment');var BPromise=require(_0x299b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x299b('0x3'))['db'];var utils=require(_0x299b('0x4'));var logger=require(_0x299b('0x5'))(_0x299b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x299b('0x7')][_0x299b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb7a492,_0xa00406,_0x209448){return new BPromise(function(_0x23a9ee,_0x4854dc){return client['request'](_0xb7a492,_0x209448)[_0x299b('0x9')](function(_0x2cbf4c){logger[_0x299b('0xa')](_0x299b('0xb'),_0xa00406,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0xa00406,'request\x20sent',JSON[_0x299b('0xc')](_0x2cbf4c));if(_0x2cbf4c[_0x299b('0xd')]){if(_0x2cbf4c[_0x299b('0xd')][_0x299b('0xe')]===0x1f4){logger[_0x299b('0xd')](_0x299b('0xb'),_0xa00406,_0x2cbf4c['error'][_0x299b('0xf')]);return _0x4854dc(_0x2cbf4c[_0x299b('0xd')][_0x299b('0xf')]);}logger[_0x299b('0xd')]('MailApplication,\x20%s,\x20%s',_0xa00406,_0x2cbf4c[_0x299b('0xd')][_0x299b('0xf')]);return _0x23a9ee(_0x2cbf4c[_0x299b('0xd')][_0x299b('0xf')]);}else{logger[_0x299b('0xa')](_0x299b('0xb'),_0xa00406,_0x299b('0x10'));_0x23a9ee(_0x2cbf4c[_0x299b('0x11')]['message']);}})[_0x299b('0x12')](function(_0x262423){logger[_0x299b('0xd')](_0x299b('0xb'),_0xa00406,_0x262423);_0x4854dc(_0x262423);});});}exports['UpdateMailApplication']=function(_0x49d414){var _0x265532=this;return new Promise(function(_0x243494,_0x35d627){return db['MailApplication'][_0x299b('0x13')](_0x49d414[_0x299b('0x14')],{'raw':_0x49d414[_0x299b('0x15')]?_0x49d414[_0x299b('0x15')][_0x299b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d414[_0x299b('0x15')]?_0x49d414[_0x299b('0x15')]['where']||null:null,'attributes':_0x49d414[_0x299b('0x15')]?_0x49d414['options'][_0x299b('0x17')]||null:null,'limit':_0x49d414[_0x299b('0x15')]?_0x49d414[_0x299b('0x15')][_0x299b('0x18')]||null:null})[_0x299b('0x9')](function(_0x187be6){logger[_0x299b('0xa')](_0x299b('0x19'),_0x49d414);logger[_0x299b('0x1a')]('UpdateMailApplication',_0x49d414,JSON[_0x299b('0xc')](_0x187be6));_0x243494(_0x187be6);})[_0x299b('0x12')](function(_0x332090){logger[_0x299b('0xd')](_0x299b('0x19'),_0x332090[_0x299b('0xf')],_0x49d414);_0x35d627(_0x265532[_0x299b('0xd')](0x1f4,_0x332090[_0x299b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 647eeec..0c5cf8c 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 _0x4baf=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','../../components/interaction/service'];(function(_0x5d4a45,_0x47a41){var _0x5b7854=function(_0x47dc92){while(--_0x47dc92){_0x5d4a45['push'](_0x5d4a45['shift']());}};_0x5b7854(++_0x47a41);}(_0x4baf,0x1d9));var _0xf4ba=function(_0x5bca8a,_0x6a3df){_0x5bca8a=_0x5bca8a-0x0;var _0x3c2430=_0x4baf[_0x5bca8a];return _0x3c2430;};'use strict';var express=require(_0xf4ba('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf4ba('0x1'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf4ba('0x2')]);router[_0xf4ba('0x3')](_0xf4ba('0x4'),auth[_0xf4ba('0x5')](),controller[_0xf4ba('0x6')]);router['get'](_0xf4ba('0x7'),auth[_0xf4ba('0x5')](),controller[_0xf4ba('0x8')]);router[_0xf4ba('0x3')](_0xf4ba('0x9'),auth[_0xf4ba('0x5')](),controller[_0xf4ba('0xa')]);router[_0xf4ba('0x3')](_0xf4ba('0xb'),auth[_0xf4ba('0x5')](),controller[_0xf4ba('0xc')]);router[_0xf4ba('0xd')]('/',auth[_0xf4ba('0x5')](),controller[_0xf4ba('0xe')]);router[_0xf4ba('0xd')](_0xf4ba('0x9'),auth[_0xf4ba('0x5')](),controller[_0xf4ba('0xf')]);router['post'](_0xf4ba('0x10'),auth['isAuthenticated'](),interaction['tracked'](_0xf4ba('0x11'),_0xf4ba('0x12')),controller['addTags']);router['put'](_0xf4ba('0x7'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xf4ba('0x13')),controller[_0xf4ba('0x14')]);router[_0xf4ba('0x15')](_0xf4ba('0x7'),auth[_0xf4ba('0x5')](),interaction['tracked']('mail',_0xf4ba('0x16')),controller[_0xf4ba('0x17')]);router[_0xf4ba('0x15')](_0xf4ba('0x10'),auth[_0xf4ba('0x5')](),controller['removeTags']);module[_0xf4ba('0x18')]=router; \ No newline at end of file +var _0x1101=['delete','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy'];(function(_0xfb8e9c,_0x4bfaec){var _0x432968=function(_0x574cce){while(--_0x574cce){_0xfb8e9c['push'](_0xfb8e9c['shift']());}};_0x432968(++_0x4bfaec);}(_0x1101,0x99));var _0x1110=function(_0x745a7,_0xac4926){_0x745a7=_0x745a7-0x0;var _0x46e175=_0x1101[_0x745a7];return _0x46e175;};'use strict';var express=require(_0x1110('0x0'));var router=express['Router']();var auth=require(_0x1110('0x1'));var interaction=require(_0x1110('0x2'));var controller=require(_0x1110('0x3'));router[_0x1110('0x4')]('/',auth['isAuthenticated'](),controller[_0x1110('0x5')]);router[_0x1110('0x4')]('/describe',auth[_0x1110('0x6')](),controller[_0x1110('0x7')]);router['get'](_0x1110('0x8'),auth['isAuthenticated'](),controller[_0x1110('0x9')]);router[_0x1110('0x4')]('/:id/messages',auth[_0x1110('0x6')](),controller[_0x1110('0xa')]);router[_0x1110('0x4')](_0x1110('0xb'),auth[_0x1110('0x6')](),controller[_0x1110('0xc')]);router[_0x1110('0xd')]('/',auth[_0x1110('0x6')](),controller[_0x1110('0xe')]);router[_0x1110('0xd')](_0x1110('0xf'),auth[_0x1110('0x6')](),controller[_0x1110('0x10')]);router[_0x1110('0xd')](_0x1110('0x11'),auth['isAuthenticated'](),interaction[_0x1110('0x12')](_0x1110('0x13'),_0x1110('0x14')),controller[_0x1110('0x15')]);router[_0x1110('0x16')](_0x1110('0x8'),auth['isAuthenticated'](),interaction[_0x1110('0x12')](_0x1110('0x13'),_0x1110('0x17')),controller[_0x1110('0x18')]);router['delete'](_0x1110('0x8'),auth[_0x1110('0x6')](),interaction[_0x1110('0x12')]('mail',_0x1110('0x19')),controller[_0x1110('0x1a')]);router[_0x1110('0x1b')](_0x1110('0x11'),auth[_0x1110('0x6')](),controller[_0x1110('0x1c')]);module[_0x1110('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 917625e..3ca2718 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 _0x15b4=['exports','STRING','TEXT','long','BOOLEAN','DATE','ENUM','out','INTEGER'];(function(_0x6bc85d,_0x4cab15){var _0x207923=function(_0x3a0a1e){while(--_0x3a0a1e){_0x6bc85d['push'](_0x6bc85d['shift']());}};_0x207923(++_0x4cab15);}(_0x15b4,0x75));var _0x415b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x15b4[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x415b('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x415b('0x1')]},'thirdDisposition':{'type':Sequelize[_0x415b('0x1')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x415b('0x1')](0x1fe)},'to':{'type':Sequelize[_0x415b('0x1')]},'cc':{'type':Sequelize[_0x415b('0x2')](_0x415b('0x3'))},'subject':{'type':Sequelize[_0x415b('0x2')]()},'attach':{'type':Sequelize[_0x415b('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x415b('0x5')]},'substatus':{'type':Sequelize[_0x415b('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0x415b('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x415b('0x6')]('in',_0x415b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x415b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x415b('0x6')]('in',_0x415b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x415b('0x8')]}}; \ No newline at end of file +var _0xd876=['exports','BOOLEAN','DATE','STRING','TEXT','long','out','INTEGER'];(function(_0x5b8597,_0x55067d){var _0x2c6474=function(_0x1f1099){while(--_0x1f1099){_0x5b8597['push'](_0x5b8597['shift']());}};_0x2c6474(++_0x55067d);}(_0xd876,0xb8));var _0x6d87=function(_0x3a8d96,_0x10b6a8){_0x3a8d96=_0x3a8d96-0x0;var _0x8332c1=_0xd876[_0x3a8d96];return _0x8332c1;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x6d87('0x0')]={'closed':{'type':Sequelize[_0x6d87('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d87('0x2')]},'disposition':{'type':Sequelize[_0x6d87('0x3')]},'secondDisposition':{'type':Sequelize[_0x6d87('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6d87('0x3')](0x1fe)},'to':{'type':Sequelize[_0x6d87('0x3')]},'cc':{'type':Sequelize[_0x6d87('0x4')](_0x6d87('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x6d87('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6d87('0x2')]},'substatus':{'type':Sequelize[_0x6d87('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d87('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d87('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d87('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 8d1a102..56fe88a 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 _0x8c70=['hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','length','rows','setTags','spread','Tag','color','removeTags','join','root','files','tmp','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','build','writeFileSync','download','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','moment','bluebird','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','show','keys','filters','intersection','model','fields','attributes','includeAll','include','merge','options','find','create','body','catch','params','describe','addMessage','MailMessage','ids','findOne'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x8c70,0x99));var _0x08c7=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x8c70[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x08c7('0x0'));var rimraf=require(_0x08c7('0x1'));var zipdir=require(_0x08c7('0x2'));var moment=require(_0x08c7('0x3'));var BPromise=require(_0x08c7('0x4'));var util=require('util');var path=require(_0x08c7('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0x08c7('0x6'));var Redis=require(_0x08c7('0x7'));var interaction=require(_0x08c7('0x8'));var qs=require(_0x08c7('0x9'));var logger=require(_0x08c7('0xa'))(_0x08c7('0xb'));var config=require(_0x08c7('0xc'));var db=require(_0x08c7('0xd'))['db'];var htmlEntities=require('html-entities');config[_0x08c7('0xe')]=_[_0x08c7('0xf')](config[_0x08c7('0xe')],{'host':_0x08c7('0x10'),'port':0x18eb});var socket=require(_0x08c7('0x11'))(new Redis(config[_0x08c7('0xe')]));require(_0x08c7('0x12'))[_0x08c7('0x13')](socket);function respondWithStatusCode(_0x5d5aa7,_0x29bcb1){_0x29bcb1=_0x29bcb1||0xcc;return function(_0x763368){if(_0x763368){return _0x5d5aa7['sendStatus'](_0x29bcb1);}return _0x5d5aa7[_0x08c7('0x14')](_0x29bcb1)[_0x08c7('0x15')]();};}function respondWithResult(_0x5d79a2,_0x19e40d){_0x19e40d=_0x19e40d||0xc8;return function(_0xbee954){if(_0xbee954){return _0x5d79a2[_0x08c7('0x14')](_0x19e40d)[_0x08c7('0x16')](_0xbee954);}};}function respondWithFilteredResult(_0x2c1f6e,_0x34c633){return function(_0x3abcb6){if(_0x3abcb6){var _0x32fa90=typeof _0x34c633[_0x08c7('0x17')]===_0x08c7('0x18')&&typeof _0x34c633[_0x08c7('0x19')]===_0x08c7('0x18');var _0x316579=_0x3abcb6[_0x08c7('0x1a')];var _0x43243c=_0x32fa90?0x0:_0x34c633[_0x08c7('0x17')];var _0x33da38=_0x32fa90?_0x3abcb6[_0x08c7('0x1a')]:_0x34c633['offset']+_0x34c633['limit'];var _0x5a551e;if(_0x33da38>=_0x316579){_0x33da38=_0x316579;_0x5a551e=0xc8;}else{_0x5a551e=0xce;}_0x2c1f6e[_0x08c7('0x14')](_0x5a551e);return _0x2c1f6e['set'](_0x08c7('0x1b'),_0x43243c+'-'+_0x33da38+'/'+_0x316579)[_0x08c7('0x16')](_0x3abcb6);}return null;};}function saveUpdates(_0x55ece2){return function(_0x37dbf6){if(_0x37dbf6){return _0x37dbf6[_0x08c7('0x1c')](_0x55ece2)['then'](function(_0x248c9c){return _0x248c9c;});}return null;};}function removeEntity(_0x326e21){return function(_0xf81b1c){if(_0xf81b1c){return _0xf81b1c[_0x08c7('0x1d')]()[_0x08c7('0x1e')](function(){_0x326e21['status'](0xcc)[_0x08c7('0x15')]();});}};}function handleEntityNotFound(_0xe7a0b4){return function(_0x2a8a96){if(!_0x2a8a96){_0xe7a0b4['sendStatus'](0x194);}return _0x2a8a96;};}function handleError(_0x339f02,_0x98cbb9){_0x98cbb9=_0x98cbb9||0x1f4;return function(_0x651860){logger[_0x08c7('0x1f')](_0x651860[_0x08c7('0x20')]);if(_0x651860[_0x08c7('0x21')]){delete _0x651860[_0x08c7('0x21')];}_0x339f02[_0x08c7('0x14')](_0x98cbb9)[_0x08c7('0x22')](_0x651860);};}exports[_0x08c7('0x23')]=function(_0x396221,_0x3f6e35){var _0x4947e4={};var _0x21414c=_[_0x08c7('0x24')](db[_0x08c7('0x25')][_0x08c7('0x26')],function(_0x47f7a1){return{'name':_0x47f7a1[_0x08c7('0x27')],'type':_0x47f7a1['type'][_0x08c7('0x28')]};});_0x4947e4=qs[_0x08c7('0x29')](_0x21414c,_0x396221);return interaction[_0x08c7('0x2a')]('mail',_0x396221[_0x08c7('0x2b')],_0x396221['user'],_0x4947e4,_0x21414c)['then'](respondWithFilteredResult(_0x3f6e35,_0x4947e4))['catch'](handleError(_0x3f6e35,null));};exports[_0x08c7('0x2c')]=function(_0x428d99,_0x518b8c){var _0x435594={'raw':![],'where':{'id':_0x428d99['params']['id']}},_0x290c6c={};_0x290c6c['model']=_['keys'](db[_0x08c7('0x25')][_0x08c7('0x26')]);_0x290c6c['query']=_[_0x08c7('0x2d')](_0x428d99[_0x08c7('0x2b')]);_0x290c6c[_0x08c7('0x2e')]=_[_0x08c7('0x2f')](_0x290c6c[_0x08c7('0x30')],_0x290c6c[_0x08c7('0x2b')]);_0x435594['attributes']=_['intersection'](_0x290c6c[_0x08c7('0x30')],qs['fields'](_0x428d99[_0x08c7('0x2b')][_0x08c7('0x31')]));_0x435594[_0x08c7('0x32')]=_0x435594[_0x08c7('0x32')]['length']?_0x435594[_0x08c7('0x32')]:_0x290c6c[_0x08c7('0x30')];if(_0x428d99['query'][_0x08c7('0x33')]){_0x435594[_0x08c7('0x34')]=[{'all':!![]}];}_0x435594=_[_0x08c7('0x35')]({},_0x435594,_0x428d99[_0x08c7('0x36')]);return db['MailInteraction'][_0x08c7('0x37')](_0x435594)[_0x08c7('0x1e')](handleEntityNotFound(_0x518b8c,null))[_0x08c7('0x1e')](respondWithResult(_0x518b8c,null))['catch'](handleError(_0x518b8c,null));};exports[_0x08c7('0x38')]=function(_0x5ad374,_0x2e4cd1){return db[_0x08c7('0x25')]['create'](_0x5ad374[_0x08c7('0x39')],{})[_0x08c7('0x1e')](respondWithResult(_0x2e4cd1,0xc9))[_0x08c7('0x3a')](handleError(_0x2e4cd1,null));};exports[_0x08c7('0x1c')]=function(_0x438d12,_0x155141){if(_0x438d12[_0x08c7('0x39')]['id']){delete _0x438d12[_0x08c7('0x39')]['id'];}return db['MailInteraction'][_0x08c7('0x37')]({'where':{'id':_0x438d12[_0x08c7('0x3b')]['id']}})[_0x08c7('0x1e')](handleEntityNotFound(_0x155141,null))[_0x08c7('0x1e')](saveUpdates(_0x438d12[_0x08c7('0x39')],null))['then'](respondWithResult(_0x155141,null))['catch'](handleError(_0x155141,null));};exports[_0x08c7('0x1d')]=function(_0x258b2d,_0x3ee067){return db[_0x08c7('0x25')][_0x08c7('0x37')]({'where':{'id':_0x258b2d[_0x08c7('0x3b')]['id']}})[_0x08c7('0x1e')](handleEntityNotFound(_0x3ee067,null))[_0x08c7('0x1e')](removeEntity(_0x3ee067,null))['catch'](handleError(_0x3ee067,null));};exports[_0x08c7('0x3c')]=function(_0x17a1e4,_0x571bf7){return db['MailInteraction'][_0x08c7('0x3c')]()[_0x08c7('0x1e')](respondWithResult(_0x571bf7,null))[_0x08c7('0x3a')](handleError(_0x571bf7,null));};exports[_0x08c7('0x3d')]=function(_0x4b9704,_0x4cad50){return db[_0x08c7('0x3e')]['find']({'where':{'id':_0x4b9704['params']['id']}})[_0x08c7('0x1e')](handleEntityNotFound(_0x4cad50,null))['then'](function(_0x42a848){if(_0x42a848){return _0x42a848['addMessage'](_0x4b9704['body'][_0x08c7('0x3f')],_['omit'](_0x4b9704[_0x08c7('0x39')],[_0x08c7('0x3f'),'id'])||{});}})[_0x08c7('0x1e')](respondWithResult(_0x4cad50,null))[_0x08c7('0x3a')](handleError(_0x4cad50,null));};exports['getMessages']=function(_0x4682b2,_0x2ddc9e){var _0x4e7d75={'raw':![],'where':{}};var _0x59deb8={};var _0x1b1ca2={'count':0x0,'rows':[]};return db[_0x08c7('0x25')][_0x08c7('0x40')]({'where':{'id':_0x4682b2[_0x08c7('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2ddc9e,null))[_0x08c7('0x1e')](function(_0x3a2321){if(_0x3a2321){_0x59deb8[_0x08c7('0x30')]=_[_0x08c7('0x2d')](db[_0x08c7('0x3e')][_0x08c7('0x26')]);_0x59deb8['query']=_[_0x08c7('0x2d')](_0x4682b2[_0x08c7('0x2b')]);_0x59deb8[_0x08c7('0x2e')]=_[_0x08c7('0x2f')](_0x59deb8[_0x08c7('0x30')],_0x59deb8[_0x08c7('0x2b')]);_0x4e7d75[_0x08c7('0x32')]=_[_0x08c7('0x2f')](_0x59deb8[_0x08c7('0x30')],qs[_0x08c7('0x31')](_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x31')]));_0x4e7d75[_0x08c7('0x32')]=_0x4e7d75[_0x08c7('0x32')]['length']?_0x4e7d75[_0x08c7('0x32')]:_0x59deb8['model'];if(!_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x41')](_0x08c7('0x42'))){_0x4e7d75[_0x08c7('0x19')]=qs[_0x08c7('0x19')](_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x19')]);_0x4e7d75[_0x08c7('0x17')]=qs[_0x08c7('0x17')](_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x17')]);}_0x4e7d75[_0x08c7('0x43')]=qs[_0x08c7('0x44')](_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x44')]);_0x4e7d75['where']=qs[_0x08c7('0x2e')](_['pick'](_0x4682b2[_0x08c7('0x2b')],_0x59deb8['filters']));_0x4e7d75[_0x08c7('0x45')]['MailInteractionId']=_0x3a2321['id'];if(_0x4682b2[_0x08c7('0x2b')]['filter']){_0x4e7d75['where']=_[_0x08c7('0x35')](_0x4e7d75[_0x08c7('0x45')],{'$or':_[_0x08c7('0x24')](_0x4e7d75[_0x08c7('0x32')],function(_0x211c42){var _0x240b4d={};_0x240b4d[_0x211c42]={'$like':'%'+_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x46')]+'%'};return _0x240b4d;})});}if(_0x4682b2[_0x08c7('0x2b')]['$gte']){var _0x20eedc=_0x4682b2['query'][_0x08c7('0x47')][_0x08c7('0x48')](',');var _0x131f85={};_0x131f85[_0x20eedc[0x0]]={'$gte':moment(_0x20eedc[0x1])[_0x08c7('0x49')](_0x08c7('0x4a'))};_0x4e7d75['where']=_[_0x08c7('0x35')](_0x4e7d75[_0x08c7('0x45')],_0x131f85);}_0x4e7d75=_[_0x08c7('0x35')]({},_0x4e7d75,_0x4682b2[_0x08c7('0x36')]);return db['MailMessage'][_0x08c7('0x1a')]({'where':_0x4e7d75[_0x08c7('0x45')]})[_0x08c7('0x1e')](function(_0x513aea){_0x1b1ca2['count']=_0x513aea;if(_0x4682b2[_0x08c7('0x2b')]['includeAll']){_0x4e7d75[_0x08c7('0x34')]=[{'all':!![]}];}return db[_0x08c7('0x3e')][_0x08c7('0x2a')](_0x4e7d75);})[_0x08c7('0x1e')](function(_0x514f09){if(_0x4682b2[_0x08c7('0x2b')][_0x08c7('0x4b')]===_0x08c7('0x4c')){for(var _0x2a4e9a=0x0;_0x2a4e9a<_0x514f09[_0x08c7('0x4d')];_0x2a4e9a++){_0x514f09[_0x2a4e9a][_0x08c7('0x39')]=juice(_0x514f09[_0x2a4e9a][_0x08c7('0x39')]);}}_0x1b1ca2[_0x08c7('0x4e')]=_0x514f09;return _0x1b1ca2;});}})[_0x08c7('0x1e')](respondWithFilteredResult(_0x2ddc9e,_0x4e7d75))[_0x08c7('0x3a')](handleError(_0x2ddc9e,null));};exports['addTags']=function(_0x771baf,_0x222853){return db[_0x08c7('0x25')][_0x08c7('0x37')]({'where':{'id':_0x771baf[_0x08c7('0x3b')]['id']}})[_0x08c7('0x1e')](handleEntityNotFound(_0x222853,null))[_0x08c7('0x1e')](function(_0x26c151){if(_0x26c151){return _0x26c151[_0x08c7('0x4f')](_0x771baf[_0x08c7('0x39')][_0x08c7('0x3f')],_['omit'](_0x771baf[_0x08c7('0x39')],[_0x08c7('0x3f'),'id'])||{})[_0x08c7('0x50')](function(){return db[_0x08c7('0x51')][_0x08c7('0x2a')]({'attributes':['id',_0x08c7('0x21'),_0x08c7('0x52')],'where':{'id':_0x771baf[_0x08c7('0x39')][_0x08c7('0x3f')]}});})[_0x08c7('0x1e')](function(_0x5d0abb){socket['emit']('mailInteractionTags:save',{'id':Number(_0x771baf[_0x08c7('0x3b')]['id']),'tags':_0x5d0abb||[]});return{'id':Number(_0x771baf[_0x08c7('0x3b')]['id']),'tags':_0x5d0abb||[]};});}})[_0x08c7('0x1e')](respondWithResult(_0x222853,null))[_0x08c7('0x3a')](handleError(_0x222853,null));};exports[_0x08c7('0x53')]=function(_0x3bd49d,_0x2af727){return db[_0x08c7('0x25')]['find']({'where':{'id':_0x3bd49d['params']['id']}})[_0x08c7('0x1e')](handleEntityNotFound(_0x2af727,null))[_0x08c7('0x1e')](function(_0x1f5671){if(_0x1f5671){return _0x1f5671[_0x08c7('0x53')](_0x3bd49d['query'][_0x08c7('0x3f')]);}})[_0x08c7('0x1e')](respondWithStatusCode(_0x2af727,null))[_0x08c7('0x3a')](handleError(_0x2af727,null));};exports['download']=function(_0x123c39,_0x47d083){var _0x1e5342=moment()['unix']()['toString']();var _0x11a029=path[_0x08c7('0x54')](config[_0x08c7('0x55')],'server',_0x08c7('0x56'),_0x08c7('0x57'));var _0x5628a2=path[_0x08c7('0x54')](config[_0x08c7('0x55')],'server',_0x08c7('0x56'),_0x08c7('0x58'));var _0x455e4e=path[_0x08c7('0x54')](_0x11a029,_0x1e5342);var _0x7fe8e3=util[_0x08c7('0x49')]('transcript-%d-%s.zip',_0x123c39[_0x08c7('0x3b')]['id'],_0x1e5342);var _0x2d17e3=path[_0x08c7('0x54')](_0x11a029,_0x7fe8e3);var _0x496826=[];if(_0x123c39[_0x08c7('0x2b')]['attachments']){_0x496826[_0x08c7('0x59')]({'model':db[_0x08c7('0x5a')],'as':_0x08c7('0x5b'),'raw':!![]});}var _0x4be5b6=[{'model':db[_0x08c7('0x3e')],'as':_0x08c7('0x5c'),'attributes':['id',_0x08c7('0x39'),_0x08c7('0x5d'),'to','cc',_0x08c7('0x5e'),_0x08c7('0x5f'),_0x08c7('0x60')],'where':{'secret':![]},'order':qs[_0x08c7('0x44')]('id'),'include':_0x496826}];return db['MailInteraction'][_0x08c7('0x37')]({'where':{'id':_0x123c39[_0x08c7('0x3b')]['id']},'include':_0x4be5b6})[_0x08c7('0x1e')](handleEntityNotFound(_0x47d083,null))[_0x08c7('0x1e')](function(_0x40f57e){if(_0x40f57e&&_0x40f57e[_0x08c7('0x5c')]){var _0x1723d0=_0x40f57e[_0x08c7('0x61')]({'plain':!![]});fs[_0x08c7('0x62')](_0x455e4e);return BPromise[_0x08c7('0x63')](_0x1723d0['Messages'],function(_0x24069a,_0x49ce14){var _0x32421a={'from':_0x24069a[_0x08c7('0x5d')],'to':_0x24069a['to']||'missing.recipient@your.company.com','subject':_0x24069a[_0x08c7('0x5f')],'html':htmlEntities[_0x08c7('0x64')](_0x24069a['body']),'headers':{'Date':moment(_0x24069a['createdAt'])[_0x08c7('0x49')](_0x08c7('0x65'))},'attachments':[]};if(_0x24069a['cc']){_0x32421a[_0x08c7('0x66')]['Cc']=_0x24069a['cc'];}if(_0x24069a['bcc']){_0x32421a[_0x08c7('0x66')][_0x08c7('0x67')]=_0x24069a[_0x08c7('0x5e')];}return new BPromise(function(_0x15d9de,_0x195681){if(_0x24069a[_0x08c7('0x5b')]){for(var _0xa920fa=0x0;_0xa920fa<_0x24069a['Attachments']['length'];_0xa920fa++){var _0x1f51e5=_0x24069a['Attachments'][_0xa920fa];var _0x276527=path[_0x08c7('0x54')](_0x5628a2,_0x1f51e5['basename']);if(fs['existsSync'](_0x276527)){_0x32421a[_0x08c7('0x58')]['push']({'name':_0x1f51e5['name'],'contentType':_0x1f51e5['type'],'data':fs['readFileSync'](_0x276527)});}}}emlformat[_0x08c7('0x68')](_0x32421a,function(_0x225c15,_0x54cb13){if(_0x225c15)return _0x195681(_0x225c15);fs[_0x08c7('0x69')](path['join'](_0x455e4e,util[_0x08c7('0x49')]('message%d.eml',_0x49ce14)),_0x54cb13);return _0x15d9de(_0x54cb13);});});})[_0x08c7('0x1e')](function(){return new BPromise(function(_0x4884b7,_0xe1500e){zipdir(_0x455e4e,{'saveTo':_0x2d17e3},function(_0x2fb751,_0x665d67){if(_0x2fb751)return _0xe1500e(_0x2fb751);return _0x4884b7(_0x665d67);});})['then'](function(){return new BPromise(function(_0x4011cc,_0x386a9b){rimraf(_0x455e4e,function(_0x340d75){if(_0x340d75)_0x386a9b(_0x340d75);return _0x4011cc();});});})['then'](function(){return _0x47d083[_0x08c7('0x6a')](_0x2d17e3,_0x7fe8e3,function(_0x1d0e25){if(!_0x1d0e25)fs[_0x08c7('0x6b')](_0x2d17e3);});});});}else{return _0x47d083[_0x08c7('0x6c')](0xc8);}})[_0x08c7('0x3a')](handleError(_0x47d083,null));}; \ No newline at end of file +var _0xe1aa=['api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','key','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','destroy','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','nolimit','sort','pick','where','MailInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','Bcc','basename','existsSync','readFileSync','build','message%d.eml','eml-format','rimraf','zip-dir','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger'];(function(_0x39efa9,_0x28ae45){var _0x3d0802=function(_0x49481d){while(--_0x49481d){_0x39efa9['push'](_0x39efa9['shift']());}};_0x3d0802(++_0x28ae45);}(_0xe1aa,0xdb));var _0xae1a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe1aa[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xae1a('0x0'));var rimraf=require(_0xae1a('0x1'));var zipdir=require(_0xae1a('0x2'));var moment=require('moment');var BPromise=require(_0xae1a('0x3'));var util=require('util');var path=require(_0xae1a('0x4'));var fs=require('fs');var _=require(_0xae1a('0x5'));var juice=require(_0xae1a('0x6'));var Redis=require(_0xae1a('0x7'));var interaction=require(_0xae1a('0x8'));var qs=require(_0xae1a('0x9'));var logger=require(_0xae1a('0xa'))(_0xae1a('0xb'));var config=require(_0xae1a('0xc'));var db=require(_0xae1a('0xd'))['db'];var htmlEntities=require(_0xae1a('0xe'));config[_0xae1a('0xf')]=_[_0xae1a('0x10')](config[_0xae1a('0xf')],{'host':_0xae1a('0x11'),'port':0x18eb});var socket=require(_0xae1a('0x12'))(new Redis(config[_0xae1a('0xf')]));require(_0xae1a('0x13'))[_0xae1a('0x14')](socket);function respondWithStatusCode(_0x534d41,_0xa3c414){_0xa3c414=_0xa3c414||0xcc;return function(_0x53f1ed){if(_0x53f1ed){return _0x534d41[_0xae1a('0x15')](_0xa3c414);}return _0x534d41[_0xae1a('0x16')](_0xa3c414)[_0xae1a('0x17')]();};}function respondWithResult(_0x4401f4,_0x43165c){_0x43165c=_0x43165c||0xc8;return function(_0x10c953){if(_0x10c953){return _0x4401f4[_0xae1a('0x16')](_0x43165c)['json'](_0x10c953);}};}function respondWithFilteredResult(_0x241cb7,_0x31477f){return function(_0x5bf06b){if(_0x5bf06b){var _0x1051fc=typeof _0x31477f[_0xae1a('0x18')]===_0xae1a('0x19')&&typeof _0x31477f[_0xae1a('0x1a')]===_0xae1a('0x19');var _0x4572f4=_0x5bf06b[_0xae1a('0x1b')];var _0x1e042d=_0x1051fc?0x0:_0x31477f['offset'];var _0xa3e2e5=_0x1051fc?_0x5bf06b[_0xae1a('0x1b')]:_0x31477f[_0xae1a('0x18')]+_0x31477f['limit'];var _0x174c44;if(_0xa3e2e5>=_0x4572f4){_0xa3e2e5=_0x4572f4;_0x174c44=0xc8;}else{_0x174c44=0xce;}_0x241cb7[_0xae1a('0x16')](_0x174c44);return _0x241cb7[_0xae1a('0x1c')]('Content-Range',_0x1e042d+'-'+_0xa3e2e5+'/'+_0x4572f4)[_0xae1a('0x1d')](_0x5bf06b);}return null;};}function saveUpdates(_0x222c16){return function(_0x2d7f78){if(_0x2d7f78){return _0x2d7f78[_0xae1a('0x1e')](_0x222c16)['then'](function(_0x21e9c2){return _0x21e9c2;});}return null;};}function removeEntity(_0x12a70){return function(_0x4d0ad8){if(_0x4d0ad8){return _0x4d0ad8['destroy']()[_0xae1a('0x1f')](function(){_0x12a70[_0xae1a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x314129){return function(_0x51d1eb){if(!_0x51d1eb){_0x314129[_0xae1a('0x15')](0x194);}return _0x51d1eb;};}function handleError(_0xbdc2,_0x4c2dee){_0x4c2dee=_0x4c2dee||0x1f4;return function(_0x4e7429){logger[_0xae1a('0x20')](_0x4e7429[_0xae1a('0x21')]);if(_0x4e7429[_0xae1a('0x22')]){delete _0x4e7429['name'];}_0xbdc2[_0xae1a('0x16')](_0x4c2dee)[_0xae1a('0x23')](_0x4e7429);};}exports[_0xae1a('0x24')]=function(_0x3bdc8e,_0x2c6a0a){var _0x25cd8b={};var _0x28123d=_[_0xae1a('0x25')](db[_0xae1a('0x26')][_0xae1a('0x27')],function(_0x400bca){return{'name':_0x400bca['fieldName'],'type':_0x400bca[_0xae1a('0x28')][_0xae1a('0x29')]};});_0x25cd8b=qs['getOptions'](_0x28123d,_0x3bdc8e);return interaction[_0xae1a('0x2a')](_0xae1a('0x2b'),_0x3bdc8e[_0xae1a('0x2c')],_0x3bdc8e[_0xae1a('0x2d')],_0x25cd8b,_0x28123d)[_0xae1a('0x1f')](respondWithFilteredResult(_0x2c6a0a,_0x25cd8b))[_0xae1a('0x2e')](handleError(_0x2c6a0a,null));};exports[_0xae1a('0x2f')]=function(_0x3d8fad,_0xd58f32){var _0x515bf8={'raw':![],'where':{'id':_0x3d8fad[_0xae1a('0x30')]['id']}},_0x14b230={};_0x14b230[_0xae1a('0x31')]=_['keys'](db[_0xae1a('0x26')][_0xae1a('0x27')]);_0x14b230[_0xae1a('0x2c')]=_[_0xae1a('0x32')](_0x3d8fad[_0xae1a('0x2c')]);_0x14b230[_0xae1a('0x33')]=_[_0xae1a('0x34')](_0x14b230[_0xae1a('0x31')],_0x14b230[_0xae1a('0x2c')]);_0x515bf8[_0xae1a('0x35')]=_[_0xae1a('0x34')](_0x14b230['model'],qs[_0xae1a('0x36')](_0x3d8fad['query'][_0xae1a('0x36')]));_0x515bf8[_0xae1a('0x35')]=_0x515bf8[_0xae1a('0x35')][_0xae1a('0x37')]?_0x515bf8['attributes']:_0x14b230[_0xae1a('0x31')];if(_0x3d8fad[_0xae1a('0x2c')][_0xae1a('0x38')]){_0x515bf8[_0xae1a('0x39')]=[{'all':!![]}];}_0x515bf8=_['merge']({},_0x515bf8,_0x3d8fad[_0xae1a('0x3a')]);return db[_0xae1a('0x26')][_0xae1a('0x3b')](_0x515bf8)['then'](handleEntityNotFound(_0xd58f32,null))[_0xae1a('0x1f')](respondWithResult(_0xd58f32,null))[_0xae1a('0x2e')](handleError(_0xd58f32,null));};exports[_0xae1a('0x3c')]=function(_0x301a34,_0x29db22){return db[_0xae1a('0x26')][_0xae1a('0x3c')](_0x301a34[_0xae1a('0x3d')],{})['then'](respondWithResult(_0x29db22,0xc9))[_0xae1a('0x2e')](handleError(_0x29db22,null));};exports[_0xae1a('0x1e')]=function(_0x1cb602,_0x3c634f){if(_0x1cb602[_0xae1a('0x3d')]['id']){delete _0x1cb602[_0xae1a('0x3d')]['id'];}return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x1cb602[_0xae1a('0x30')]['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x3c634f,null))['then'](saveUpdates(_0x1cb602['body'],null))[_0xae1a('0x1f')](respondWithResult(_0x3c634f,null))[_0xae1a('0x2e')](handleError(_0x3c634f,null));};exports[_0xae1a('0x3e')]=function(_0x54adbd,_0xa4ad38){return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x54adbd[_0xae1a('0x30')]['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0xa4ad38,null))[_0xae1a('0x1f')](removeEntity(_0xa4ad38,null))[_0xae1a('0x2e')](handleError(_0xa4ad38,null));};exports[_0xae1a('0x3f')]=function(_0x4f2ab8,_0x250139){return db[_0xae1a('0x26')][_0xae1a('0x3f')]()[_0xae1a('0x1f')](respondWithResult(_0x250139,null))[_0xae1a('0x2e')](handleError(_0x250139,null));};exports['addMessage']=function(_0x5aeb4a,_0x46ed24){return db[_0xae1a('0x40')]['find']({'where':{'id':_0x5aeb4a['params']['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x46ed24,null))['then'](function(_0x5acc44){if(_0x5acc44){return _0x5acc44[_0xae1a('0x41')](_0x5aeb4a[_0xae1a('0x3d')][_0xae1a('0x42')],_[_0xae1a('0x43')](_0x5aeb4a['body'],[_0xae1a('0x42'),'id'])||{});}})[_0xae1a('0x1f')](respondWithResult(_0x46ed24,null))[_0xae1a('0x2e')](handleError(_0x46ed24,null));};exports[_0xae1a('0x44')]=function(_0x1f3595,_0x160884){var _0x2d262f={'raw':![],'where':{}};var _0xabfd3e={};var _0xee8b18={'count':0x0,'rows':[]};return db[_0xae1a('0x26')][_0xae1a('0x45')]({'where':{'id':_0x1f3595['params']['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x160884,null))[_0xae1a('0x1f')](function(_0x4c7e87){if(_0x4c7e87){_0xabfd3e[_0xae1a('0x31')]=_[_0xae1a('0x32')](db[_0xae1a('0x40')]['rawAttributes']);_0xabfd3e[_0xae1a('0x2c')]=_[_0xae1a('0x32')](_0x1f3595[_0xae1a('0x2c')]);_0xabfd3e[_0xae1a('0x33')]=_[_0xae1a('0x34')](_0xabfd3e[_0xae1a('0x31')],_0xabfd3e['query']);_0x2d262f[_0xae1a('0x35')]=_[_0xae1a('0x34')](_0xabfd3e[_0xae1a('0x31')],qs[_0xae1a('0x36')](_0x1f3595[_0xae1a('0x2c')][_0xae1a('0x36')]));_0x2d262f['attributes']=_0x2d262f[_0xae1a('0x35')][_0xae1a('0x37')]?_0x2d262f[_0xae1a('0x35')]:_0xabfd3e[_0xae1a('0x31')];if(!_0x1f3595['query']['hasOwnProperty'](_0xae1a('0x46'))){_0x2d262f[_0xae1a('0x1a')]=qs[_0xae1a('0x1a')](_0x1f3595['query'][_0xae1a('0x1a')]);_0x2d262f[_0xae1a('0x18')]=qs[_0xae1a('0x18')](_0x1f3595['query']['offset']);}_0x2d262f['order']=qs[_0xae1a('0x47')](_0x1f3595['query']['sort']);_0x2d262f['where']=qs[_0xae1a('0x33')](_[_0xae1a('0x48')](_0x1f3595[_0xae1a('0x2c')],_0xabfd3e[_0xae1a('0x33')]));_0x2d262f[_0xae1a('0x49')][_0xae1a('0x4a')]=_0x4c7e87['id'];if(_0x1f3595[_0xae1a('0x2c')][_0xae1a('0x4b')]){_0x2d262f[_0xae1a('0x49')]=_[_0xae1a('0x4c')](_0x2d262f['where'],{'$or':_[_0xae1a('0x25')](_0x2d262f[_0xae1a('0x35')],function(_0x11ea83){var _0x2a8a49={};_0x2a8a49[_0x11ea83]={'$like':'%'+_0x1f3595[_0xae1a('0x2c')]['filter']+'%'};return _0x2a8a49;})});}if(_0x1f3595[_0xae1a('0x2c')][_0xae1a('0x4d')]){var _0x26624b=_0x1f3595['query'][_0xae1a('0x4d')]['split'](',');var _0x5599b5={};_0x5599b5[_0x26624b[0x0]]={'$gte':moment(_0x26624b[0x1])[_0xae1a('0x4e')](_0xae1a('0x4f'))};_0x2d262f[_0xae1a('0x49')]=_['merge'](_0x2d262f[_0xae1a('0x49')],_0x5599b5);}_0x2d262f=_['merge']({},_0x2d262f,_0x1f3595[_0xae1a('0x3a')]);return db['MailMessage'][_0xae1a('0x1b')]({'where':_0x2d262f[_0xae1a('0x49')]})[_0xae1a('0x1f')](function(_0x4b6dd9){_0xee8b18[_0xae1a('0x1b')]=_0x4b6dd9;if(_0x1f3595['query']['includeAll']){_0x2d262f[_0xae1a('0x39')]=[{'all':!![]}];}return db[_0xae1a('0x40')][_0xae1a('0x2a')](_0x2d262f);})[_0xae1a('0x1f')](function(_0x41841d){if(_0x1f3595['query'][_0xae1a('0x50')]==='true'){for(var _0x4c1a79=0x0;_0x4c1a79<_0x41841d[_0xae1a('0x37')];_0x4c1a79++){_0x41841d[_0x4c1a79][_0xae1a('0x3d')]=juice(_0x41841d[_0x4c1a79][_0xae1a('0x3d')]);}}_0xee8b18['rows']=_0x41841d;return _0xee8b18;});}})[_0xae1a('0x1f')](respondWithFilteredResult(_0x160884,_0x2d262f))['catch'](handleError(_0x160884,null));};exports[_0xae1a('0x51')]=function(_0xf64ca7,_0x4deaac){return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0xf64ca7[_0xae1a('0x30')]['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x4deaac,null))[_0xae1a('0x1f')](function(_0x535bd4){if(_0x535bd4){return _0x535bd4['setTags'](_0xf64ca7[_0xae1a('0x3d')]['ids'],_[_0xae1a('0x43')](_0xf64ca7[_0xae1a('0x3d')],['ids','id'])||{})[_0xae1a('0x52')](function(){return db[_0xae1a('0x53')][_0xae1a('0x2a')]({'attributes':['id',_0xae1a('0x22'),_0xae1a('0x54')],'where':{'id':_0xf64ca7[_0xae1a('0x3d')][_0xae1a('0x42')]}});})[_0xae1a('0x1f')](function(_0x54c219){socket[_0xae1a('0x55')](_0xae1a('0x56'),{'id':Number(_0xf64ca7[_0xae1a('0x30')]['id']),'tags':_0x54c219||[]});return{'id':Number(_0xf64ca7[_0xae1a('0x30')]['id']),'tags':_0x54c219||[]};});}})[_0xae1a('0x1f')](respondWithResult(_0x4deaac,null))[_0xae1a('0x2e')](handleError(_0x4deaac,null));};exports[_0xae1a('0x57')]=function(_0x31bb38,_0x9dddd){return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x31bb38['params']['id']}})[_0xae1a('0x1f')](handleEntityNotFound(_0x9dddd,null))[_0xae1a('0x1f')](function(_0x407e92){if(_0x407e92){return _0x407e92[_0xae1a('0x57')](_0x31bb38[_0xae1a('0x2c')][_0xae1a('0x42')]);}})[_0xae1a('0x1f')](respondWithStatusCode(_0x9dddd,null))[_0xae1a('0x2e')](handleError(_0x9dddd,null));};exports[_0xae1a('0x58')]=function(_0x1c0c18,_0x52b8fe){var _0x16d777=moment()['unix']()['toString']();var _0x41c75d=path['join'](config['root'],_0xae1a('0x59'),_0xae1a('0x5a'),_0xae1a('0x5b'));var _0x45e633=path[_0xae1a('0x5c')](config[_0xae1a('0x5d')],_0xae1a('0x59'),_0xae1a('0x5a'),_0xae1a('0x5e'));var _0x5312f5=path[_0xae1a('0x5c')](_0x41c75d,_0x16d777);var _0x4a337f=util[_0xae1a('0x4e')](_0xae1a('0x5f'),_0x1c0c18[_0xae1a('0x30')]['id'],_0x16d777);var _0x4c375f=path[_0xae1a('0x5c')](_0x41c75d,_0x4a337f);var _0x3b6c50=[];if(_0x1c0c18[_0xae1a('0x2c')]['attachments']){_0x3b6c50[_0xae1a('0x60')]({'model':db[_0xae1a('0x61')],'as':_0xae1a('0x62'),'raw':!![]});}var _0xd79c6f=[{'model':db[_0xae1a('0x40')],'as':_0xae1a('0x63'),'attributes':['id',_0xae1a('0x3d'),_0xae1a('0x64'),'to','cc',_0xae1a('0x65'),'subject',_0xae1a('0x66')],'where':{'secret':![]},'order':qs[_0xae1a('0x47')]('id'),'include':_0x3b6c50}];return db[_0xae1a('0x26')][_0xae1a('0x3b')]({'where':{'id':_0x1c0c18[_0xae1a('0x30')]['id']},'include':_0xd79c6f})[_0xae1a('0x1f')](handleEntityNotFound(_0x52b8fe,null))[_0xae1a('0x1f')](function(_0x4b266b){if(_0x4b266b&&_0x4b266b[_0xae1a('0x63')]){var _0x2e1b0d=_0x4b266b[_0xae1a('0x67')]({'plain':!![]});fs[_0xae1a('0x68')](_0x5312f5);return BPromise[_0xae1a('0x69')](_0x2e1b0d[_0xae1a('0x63')],function(_0x115d52,_0x3b70fd){var _0x5e12f0={'from':_0x115d52['from'],'to':_0x115d52['to']||_0xae1a('0x6a'),'subject':_0x115d52[_0xae1a('0x6b')],'html':htmlEntities[_0xae1a('0x6c')](_0x115d52[_0xae1a('0x3d')]),'headers':{'Date':moment(_0x115d52['createdAt'])[_0xae1a('0x4e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x115d52['cc']){_0x5e12f0['headers']['Cc']=_0x115d52['cc'];}if(_0x115d52['bcc']){_0x5e12f0['headers'][_0xae1a('0x6d')]=_0x115d52[_0xae1a('0x65')];}return new BPromise(function(_0x58853f,_0x361d62){if(_0x115d52[_0xae1a('0x62')]){for(var _0x51b24d=0x0;_0x51b24d<_0x115d52[_0xae1a('0x62')][_0xae1a('0x37')];_0x51b24d++){var _0x5ad585=_0x115d52[_0xae1a('0x62')][_0x51b24d];var _0x5c14e9=path[_0xae1a('0x5c')](_0x45e633,_0x5ad585[_0xae1a('0x6e')]);if(fs[_0xae1a('0x6f')](_0x5c14e9)){_0x5e12f0['attachments'][_0xae1a('0x60')]({'name':_0x5ad585[_0xae1a('0x22')],'contentType':_0x5ad585['type'],'data':fs[_0xae1a('0x70')](_0x5c14e9)});}}}emlformat[_0xae1a('0x71')](_0x5e12f0,function(_0x2fe050,_0x4ccc5e){if(_0x2fe050)return _0x361d62(_0x2fe050);fs['writeFileSync'](path[_0xae1a('0x5c')](_0x5312f5,util[_0xae1a('0x4e')](_0xae1a('0x72'),_0x3b70fd)),_0x4ccc5e);return _0x58853f(_0x4ccc5e);});});})['then'](function(){return new BPromise(function(_0x364301,_0x2de564){zipdir(_0x5312f5,{'saveTo':_0x4c375f},function(_0x3596d9,_0x4ea13f){if(_0x3596d9)return _0x2de564(_0x3596d9);return _0x364301(_0x4ea13f);});})[_0xae1a('0x1f')](function(){return new BPromise(function(_0xe237ea,_0x35ea8e){rimraf(_0x5312f5,function(_0x59d308){if(_0x59d308)_0x35ea8e(_0x59d308);return _0xe237ea();});});})[_0xae1a('0x1f')](function(){return _0x52b8fe[_0xae1a('0x58')](_0x4c375f,_0x4a337f,function(_0x29b49c){if(!_0x29b49c)fs['unlinkSync'](_0x4c375f);});});});}else{return _0x52b8fe[_0xae1a('0x15')](0xc8);}})[_0xae1a('0x2e')](handleError(_0x52b8fe,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a97de27..b917186 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 _0x3fe9=['Users','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','then','setDataValue'];(function(_0x292a80,_0x58c1f9){var _0xf59548=function(_0x7b4019){while(--_0x7b4019){_0x292a80['push'](_0x292a80['shift']());}};_0xf59548(++_0x58c1f9);}(_0x3fe9,0x106));var _0x93fe=function(_0x16e95d,_0x299026){_0x16e95d=_0x16e95d-0x0;var _0x575c16=_0x3fe9[_0x16e95d];return _0x575c16;};'use strict';var EventEmitter=require(_0x93fe('0x0'));var MailInteraction=require(_0x93fe('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x93fe('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x93fe('0x3')](0x0);var events={'afterCreate':_0x93fe('0x4'),'afterUpdate':_0x93fe('0x5'),'afterDestroy':'remove'};function emitEvent(_0x409fee){return function(_0x38730f,_0x2e3bd1,_0x3a1584){_0x38730f['getUsers']({'attributes':['id'],'raw':!![]})[_0x93fe('0x6')](function(_0x40b7d3){_0x38730f[_0x93fe('0x7')](_0x93fe('0x8'),_0x40b7d3['map'](function(_0x42502d){return{'id':_0x42502d['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x38730f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4951fa){_0x38730f[_0x93fe('0x7')](_0x93fe('0x9'),_0x4951fa[_0x93fe('0xa')]);MailInteractionEvents[_0x93fe('0xb')](_0x409fee+':'+_0x38730f['id'],_0x38730f);MailInteractionEvents[_0x93fe('0xb')](_0x409fee,_0x38730f);_0x3a1584(null);})['catch'](_0x3a1584(null));};}for(var e in events){if(events[_0x93fe('0xc')](e)){var event=events[e];MailInteraction[_0x93fe('0xd')](e,emitEvent(event));}}module[_0x93fe('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x67c2=['MailInteraction','MailMessage','save','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','hook','exports','events'];(function(_0x514989,_0x40e433){var _0x4aed35=function(_0x1ce39b){while(--_0x1ce39b){_0x514989['push'](_0x514989['shift']());}};_0x4aed35(++_0x40e433);}(_0x67c2,0xc3));var _0x267c=function(_0x565973,_0x45e3ca){_0x565973=_0x565973-0x0;var _0x577dd2=_0x67c2[_0x565973];return _0x577dd2;};'use strict';var EventEmitter=require(_0x267c('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x267c('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x267c('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x267c('0x3'),'afterUpdate':'update','afterDestroy':_0x267c('0x4')};function emitEvent(_0x66fea3){return function(_0x385da6,_0x9f7f3f,_0xb0bbf1){_0x385da6['getUsers']({'attributes':['id'],'raw':!![]})[_0x267c('0x5')](function(_0x4a4d23){_0x385da6[_0x267c('0x6')]('Users',_0x4a4d23[_0x267c('0x7')](function(_0x180ff8){return{'id':_0x180ff8['id']};}));return MailMessage[_0x267c('0x8')]({'where':{'MailInteractionId':_0x385da6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x267c('0x5')](function(_0x32bf72){_0x385da6['setDataValue'](_0x267c('0x9'),_0x32bf72[_0x267c('0xa')]);MailInteractionEvents[_0x267c('0xb')](_0x66fea3+':'+_0x385da6['id'],_0x385da6);MailInteractionEvents['emit'](_0x66fea3,_0x385da6);_0xb0bbf1(null);})['catch'](_0xb0bbf1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x267c('0xc')](e,emitEvent(event));}}module[_0x267c('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 299a94a..2ee7cde 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 _0xd212=['get','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','models'];(function(_0x553766,_0x303b41){var _0x3176d6=function(_0x478fe9){while(--_0x478fe9){_0x553766['push'](_0x553766['shift']());}};_0x3176d6(++_0x303b41);}(_0xd212,0x123));var _0x2d21=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xd212[_0x479160];return _0x47ac6d;};'use strict';var _=require(_0x2d21('0x0'));var util=require('util');var logger=require(_0x2d21('0x1'))(_0x2d21('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d21('0x3'));var fs=require('fs');var path=require(_0x2d21('0x4'));var rimraf=require(_0x2d21('0x5'));var config=require(_0x2d21('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x2d21('0x7')]=function(_0x25845f,_0xd9b5dc){return _0x25845f['define'](_0x2d21('0x8'),attributes,{'tableName':_0x2d21('0x9'),'paranoid':![],'indexes':[{'name':_0x2d21('0xa'),'fields':[_0x2d21('0xb'),'to'],'type':_0x2d21('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x13daa4,_0x152904,_0x33abee){if(_0x13daa4[_0x2d21('0xd')]){_0x13daa4[_0x2d21('0xe')]=moment()[_0x2d21('0xf')](_0x2d21('0x10'));}if(_0x13daa4['closed']){_0x13daa4['closedAt']=moment()['format'](_0x2d21('0x10'));}_0x33abee(null,_0x152904);},'beforeUpdate':function(_0x4a3be5,_0x394993,_0xca013e){if(_0x4a3be5[_0x2d21('0x11')](_0x2d21('0xd'))){_0x4a3be5[_0x2d21('0xe')]=_0x4a3be5[_0x2d21('0xd')]?moment()[_0x2d21('0xf')](_0x2d21('0x10')):null;}if(_0x4a3be5[_0x2d21('0x11')](_0x2d21('0x12'))){_0x4a3be5[_0x2d21('0x13')]=moment()[_0x2d21('0xf')](_0x2d21('0x10'));_0x4a3be5[_0x2d21('0xd')]=null;_0x4a3be5[_0x2d21('0xe')]=null;}_0xca013e(null,_0x4a3be5);},'afterUpdate':function(_0x216a3d,_0x2571a8,_0x540fa8){var _0xa3d9e4=_0x25845f[_0x2d21('0x14')];var _0x2c0270=_0x216a3d[_0x2d21('0x15')]({'plain':!![]});if(_0x2c0270[_0x2d21('0x12')]){return _0xa3d9e4[_0x2d21('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x2c0270['id']}})[_0x2d21('0x17')](function(){_0x540fa8();})[_0x2d21('0x18')](function(_0x2f76c){_0x540fa8(_0x2f76c);});}else{_0x540fa8();}}},'charset':'utf8mb4','collate':_0x2d21('0x19')});}; \ No newline at end of file +var _0x3637=['moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','FULLTEXT','substatus','substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3637,0x1d9));var _0x7363=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x3637[_0xea343d];return _0x2c6e9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7363('0x0'))(_0x7363('0x1'));var moment=require(_0x7363('0x2'));var BPromise=require(_0x7363('0x3'));var rp=require(_0x7363('0x4'));var fs=require('fs');var path=require(_0x7363('0x5'));var rimraf=require(_0x7363('0x6'));var config=require('../../config/environment');var attributes=require(_0x7363('0x7'));module[_0x7363('0x8')]=function(_0x11324f,_0xd73c63){return _0x11324f[_0x7363('0x9')](_0x7363('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x7363('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39c711,_0x5db3af,_0x3f432a){if(_0x39c711[_0x7363('0xc')]){_0x39c711[_0x7363('0xd')]=moment()[_0x7363('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x39c711['closed']){_0x39c711[_0x7363('0xf')]=moment()[_0x7363('0xe')](_0x7363('0x10'));}_0x3f432a(null,_0x5db3af);},'beforeUpdate':function(_0x185bb1,_0x386adc,_0xdd1475){if(_0x185bb1['changed'](_0x7363('0xc'))){_0x185bb1['substatusAt']=_0x185bb1[_0x7363('0xc')]?moment()[_0x7363('0xe')](_0x7363('0x10')):null;}if(_0x185bb1[_0x7363('0x11')](_0x7363('0x12'))){_0x185bb1[_0x7363('0xf')]=moment()[_0x7363('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x185bb1[_0x7363('0xc')]=null;_0x185bb1['substatusAt']=null;}_0xdd1475(null,_0x185bb1);},'afterUpdate':function(_0x453d3d,_0x2f86e4,_0x268f65){var _0xf4bac4=_0x11324f[_0x7363('0x13')];var _0x5bd852=_0x453d3d[_0x7363('0x14')]({'plain':!![]});if(_0x5bd852[_0x7363('0x12')]){return _0xf4bac4['MailMessage'][_0x7363('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5bd852['id']}})[_0x7363('0x16')](function(){_0x268f65();})['catch'](function(_0x2486f2){_0x268f65(_0x2486f2);});}else{_0x268f65();}}},'charset':_0x7363('0x17'),'collate':_0x7363('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 872d9b4..e3ffd6d 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 _0x46bc=['stringify','error','message','info','result','UpdateMailInteraction','MailInteraction','body','options','raw','then','catch','AddTagsToMailInteraction','find','where','ids','omit','spread','AddTags','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','./mailInteraction.socket','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x46bc,0x1b3));var _0xc46b=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x46bc[_0x1f239e];return _0x826971;};'use strict';var _=require('lodash');var util=require(_0xc46b('0x0'));var moment=require('moment');var BPromise=require(_0xc46b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc46b('0x2'))['db'];var utils=require(_0xc46b('0x3'));var logger=require(_0xc46b('0x4'))(_0xc46b('0x5'));var config=require('../../config/environment');var jayson=require(_0xc46b('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc46b('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc46b('0x7')]));require(_0xc46b('0x8'))['register'](socket);function respondWithRpcPromise(_0x3853f6,_0x395351,_0x771fe0){return new BPromise(function(_0x6b5a48,_0x22a738){return client[_0xc46b('0x9')](_0x3853f6,_0x771fe0)['then'](function(_0x4a76a8){logger['info'](_0xc46b('0xa'),_0x395351,_0xc46b('0xb'));logger[_0xc46b('0xc')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x395351,'request\x20sent',JSON[_0xc46b('0xd')](_0x4a76a8));if(_0x4a76a8[_0xc46b('0xe')]){if(_0x4a76a8[_0xc46b('0xe')]['code']===0x1f4){logger[_0xc46b('0xe')](_0xc46b('0xa'),_0x395351,_0x4a76a8[_0xc46b('0xe')][_0xc46b('0xf')]);return _0x22a738(_0x4a76a8[_0xc46b('0xe')][_0xc46b('0xf')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x395351,_0x4a76a8[_0xc46b('0xe')][_0xc46b('0xf')]);return _0x6b5a48(_0x4a76a8[_0xc46b('0xe')]['message']);}else{logger[_0xc46b('0x10')](_0xc46b('0xa'),_0x395351,_0xc46b('0xb'));_0x6b5a48(_0x4a76a8[_0xc46b('0x11')][_0xc46b('0xf')]);}})['catch'](function(_0x18c981){logger[_0xc46b('0xe')](_0xc46b('0xa'),_0x395351,_0x18c981);_0x22a738(_0x18c981);});});}exports[_0xc46b('0x12')]=function(_0x3804f5){var _0x187701=this;return new Promise(function(_0x2505c0,_0x53682e){return db[_0xc46b('0x13')]['update'](_0x3804f5[_0xc46b('0x14')],{'raw':_0x3804f5[_0xc46b('0x15')]?_0x3804f5['options'][_0xc46b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3804f5[_0xc46b('0x15')]?_0x3804f5[_0xc46b('0x15')]['where']||null:null,'attributes':_0x3804f5['options']?_0x3804f5[_0xc46b('0x15')]['attributes']||null:null,'limit':_0x3804f5[_0xc46b('0x15')]?_0x3804f5[_0xc46b('0x15')]['limit']||null:null})[_0xc46b('0x17')](function(_0x4547f0){logger[_0xc46b('0x10')](_0xc46b('0x12'),_0x3804f5);logger[_0xc46b('0xc')]('UpdateMailInteraction',_0x3804f5,JSON[_0xc46b('0xd')](_0x4547f0));_0x2505c0(_0x4547f0);})[_0xc46b('0x18')](function(_0x5450cf){logger[_0xc46b('0xe')](_0xc46b('0x12'),_0x5450cf['message'],_0x3804f5);_0x53682e(_0x187701['error'](0x1f4,_0x5450cf['message']));});});};exports[_0xc46b('0x19')]=function(_0x52509f){return new Promise(function(_0x3b79e9,_0x9b947c){return db[_0xc46b('0x13')][_0xc46b('0x1a')]({'where':_0x52509f[_0xc46b('0x15')]?_0x52509f['options'][_0xc46b('0x1b')]||null:null})['then'](function(_0x5e66b6){if(_0x5e66b6){return _0x5e66b6['addTags'](_0x52509f['body'][_0xc46b('0x1c')],_[_0xc46b('0x1d')](_0x52509f[_0xc46b('0x14')],[_0xc46b('0x1c'),'id'])||{});}})[_0xc46b('0x1e')](function(_0x29f6bb){logger[_0xc46b('0x10')]('AddTags',_0x52509f);logger[_0xc46b('0xc')](_0xc46b('0x1f'),_0x52509f,JSON['stringify'](_0x29f6bb));_0x3b79e9(_0x29f6bb);})[_0xc46b('0x18')](function(_0x2033f6){logger[_0xc46b('0xe')]('AddTags',_0x2033f6['message'],_0x52509f);_0x9b947c(_this[_0xc46b('0xe')](0x1f4,_0x2033f6['message']));});});}; \ No newline at end of file +var _0x7455=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','find','addTags','ids','omit','spread','AddTags'];(function(_0x79c292,_0x4d0c1a){var _0x3bca86=function(_0x17901a){while(--_0x17901a){_0x79c292['push'](_0x79c292['shift']());}};_0x3bca86(++_0x4d0c1a);}(_0x7455,0x197));var _0x5745=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7455[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5745('0x0'));var moment=require(_0x5745('0x1'));var BPromise=require(_0x5745('0x2'));var rs=require(_0x5745('0x3'));var fs=require('fs');var Redis=require(_0x5745('0x4'));var db=require(_0x5745('0x5'))['db'];var utils=require(_0x5745('0x6'));var logger=require(_0x5745('0x7'))('rpc');var config=require(_0x5745('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5745('0x9')][_0x5745('0xa')]({'port':0x232a});config[_0x5745('0xb')]=_['defaults'](config[_0x5745('0xb')],{'host':_0x5745('0xc'),'port':0x18eb});var socket=require(_0x5745('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x5745('0xe')](socket);function respondWithRpcPromise(_0x2ce3dc,_0x2283e3,_0x4bb433){return new BPromise(function(_0x16dd13,_0x45d5be){return client[_0x5745('0xf')](_0x2ce3dc,_0x4bb433)[_0x5745('0x10')](function(_0x54376e){logger['info'](_0x5745('0x11'),_0x2283e3,_0x5745('0x12'));logger[_0x5745('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2283e3,_0x5745('0x12'),JSON[_0x5745('0x14')](_0x54376e));if(_0x54376e[_0x5745('0x15')]){if(_0x54376e[_0x5745('0x15')][_0x5745('0x16')]===0x1f4){logger[_0x5745('0x15')](_0x5745('0x11'),_0x2283e3,_0x54376e['error']['message']);return _0x45d5be(_0x54376e[_0x5745('0x15')][_0x5745('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2283e3,_0x54376e['error'][_0x5745('0x17')]);return _0x16dd13(_0x54376e[_0x5745('0x15')][_0x5745('0x17')]);}else{logger['info'](_0x5745('0x11'),_0x2283e3,_0x5745('0x12'));_0x16dd13(_0x54376e['result']['message']);}})[_0x5745('0x18')](function(_0x498f39){logger[_0x5745('0x15')](_0x5745('0x11'),_0x2283e3,_0x498f39);_0x45d5be(_0x498f39);});});}exports[_0x5745('0x19')]=function(_0x161d9d){var _0x7277d5=this;return new Promise(function(_0x5e58ec,_0x3ed94c){return db[_0x5745('0x1a')]['update'](_0x161d9d[_0x5745('0x1b')],{'raw':_0x161d9d['options']?_0x161d9d[_0x5745('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x161d9d['options']?_0x161d9d[_0x5745('0x1c')][_0x5745('0x1d')]||null:null,'attributes':_0x161d9d['options']?_0x161d9d['options'][_0x5745('0x1e')]||null:null,'limit':_0x161d9d[_0x5745('0x1c')]?_0x161d9d[_0x5745('0x1c')]['limit']||null:null})[_0x5745('0x10')](function(_0x3becbe){logger['info'](_0x5745('0x19'),_0x161d9d);logger['debug'](_0x5745('0x19'),_0x161d9d,JSON[_0x5745('0x14')](_0x3becbe));_0x5e58ec(_0x3becbe);})[_0x5745('0x18')](function(_0x5c5ea6){logger[_0x5745('0x15')](_0x5745('0x19'),_0x5c5ea6['message'],_0x161d9d);_0x3ed94c(_0x7277d5['error'](0x1f4,_0x5c5ea6['message']));});});};exports['AddTagsToMailInteraction']=function(_0x2ec9d1){return new Promise(function(_0x1e86fa,_0xa01c5f){return db[_0x5745('0x1a')][_0x5745('0x1f')]({'where':_0x2ec9d1['options']?_0x2ec9d1[_0x5745('0x1c')][_0x5745('0x1d')]||null:null})['then'](function(_0x4437c4){if(_0x4437c4){return _0x4437c4[_0x5745('0x20')](_0x2ec9d1[_0x5745('0x1b')][_0x5745('0x21')],_[_0x5745('0x22')](_0x2ec9d1[_0x5745('0x1b')],[_0x5745('0x21'),'id'])||{});}})[_0x5745('0x23')](function(_0x585209){logger['info'](_0x5745('0x24'),_0x2ec9d1);logger[_0x5745('0x13')](_0x5745('0x24'),_0x2ec9d1,JSON[_0x5745('0x14')](_0x585209));_0x1e86fa(_0x585209);})[_0x5745('0x18')](function(_0x34b632){logger[_0x5745('0x15')](_0x5745('0x24'),_0x34b632[_0x5745('0x17')],_0x2ec9d1);_0xa01c5f(_this[_0x5745('0x15')](0x1f4,_0x34b632[_0x5745('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 364457b..c5724fc 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 _0xfeef=['remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x3f6ebe,_0x4dd820){var _0x425347=function(_0x28195c){while(--_0x28195c){_0x3f6ebe['push'](_0x3f6ebe['shift']());}};_0x425347(++_0x4dd820);}(_0xfeef,0x96));var _0xffee=function(_0x3d2a6d,_0x4ccde0){_0x3d2a6d=_0x3d2a6d-0x0;var _0x27234b=_0xfeef[_0x3d2a6d];return _0x27234b;};'use strict';var MailInteractionEvents=require(_0xffee('0x0'));var events=[_0xffee('0x1'),_0xffee('0x2'),'update'];function createListener(_0x5a3513,_0x3c5e42){return function(_0xe01cc6){_0x3c5e42[_0xffee('0x3')](_0x5a3513,_0xe01cc6);};}function removeListener(_0x1eb185,_0x392fa6){return function(){MailInteractionEvents[_0xffee('0x4')](_0x1eb185,_0x392fa6);};}exports[_0xffee('0x5')]=function(_0x5d1f87){for(var _0x3b7ebf=0x0,_0x488007=events[_0xffee('0x6')];_0x3b7ebf<_0x488007;_0x3b7ebf++){var _0x48dafa=events[_0x3b7ebf];var _0x453859=createListener(_0xffee('0x7')+_0x48dafa,_0x5d1f87);MailInteractionEvents['on'](_0x48dafa,_0x453859);}}; \ No newline at end of file +var _0x06fc=['mailInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x58841a,_0x1edb87){var _0x46c020=function(_0x497c4c){while(--_0x497c4c){_0x58841a['push'](_0x58841a['shift']());}};_0x46c020(++_0x1edb87);}(_0x06fc,0x86));var _0xc06f=function(_0x1626aa,_0xe38ee2){_0x1626aa=_0x1626aa-0x0;var _0x8b4fe7=_0x06fc[_0x1626aa];return _0x8b4fe7;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc06f('0x0'),_0xc06f('0x1'),_0xc06f('0x2')];function createListener(_0x106a13,_0x5cf9c0){return function(_0x11ce8a){_0x5cf9c0[_0xc06f('0x3')](_0x106a13,_0x11ce8a);};}function removeListener(_0x3cd53a,_0x1c12b7){return function(){MailInteractionEvents[_0xc06f('0x4')](_0x3cd53a,_0x1c12b7);};}exports[_0xc06f('0x5')]=function(_0xb3e8d3){for(var _0x3b170f=0x0,_0x15fe71=events['length'];_0x3b170f<_0x15fe71;_0x3b170f++){var _0x441935=events[_0x3b170f];var _0x157e26=createListener(_0xc06f('0x6')+_0x441935,_0xb3e8d3);MailInteractionEvents['on'](_0x441935,_0x157e26);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bde4952..eaa086d 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 _0x13cf=['util','path','express','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','tracked','mail','mailmessage:create','create','update','/:id/accept','put','/:id/reject','delete','destroy','exports','multer'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0x13cf,0x11d));var _0xf13c=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x13cf[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0xf13c('0x0'));var util=require(_0xf13c('0x1'));var path=require(_0xf13c('0x2'));var timeout=require('connect-timeout');var express=require(_0xf13c('0x3'));var router=express[_0xf13c('0x4')]();var fs_extra=require(_0xf13c('0x5'));var auth=require(_0xf13c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf13c('0x7'));router[_0xf13c('0x8')]('/',auth[_0xf13c('0x9')](),controller['index']);router[_0xf13c('0x8')](_0xf13c('0xa'),auth[_0xf13c('0x9')](),controller[_0xf13c('0xb')]);router[_0xf13c('0x8')](_0xf13c('0xc'),auth[_0xf13c('0x9')](),controller['show']);router['get'](_0xf13c('0xd'),auth['isAuthenticated'](),controller[_0xf13c('0xe')]);router['post']('/',auth[_0xf13c('0x9')](),interaction[_0xf13c('0xf')](_0xf13c('0x10'),_0xf13c('0x11')),controller[_0xf13c('0x12')]);router['put'](_0xf13c('0xc'),auth[_0xf13c('0x9')](),controller[_0xf13c('0x13')]);router['put'](_0xf13c('0x14'),auth[_0xf13c('0x9')](),controller['accept']);router[_0xf13c('0x15')](_0xf13c('0x16'),auth[_0xf13c('0x9')](),controller['reject']);router[_0xf13c('0x17')](_0xf13c('0xc'),auth[_0xf13c('0x9')](),controller[_0xf13c('0x18')]);module[_0xf13c('0x19')]=router; \ No newline at end of file +var _0x8dd6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','mail','update','put','/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout'];(function(_0x553c28,_0x3c868d){var _0x571e4e=function(_0x2cd0a6){while(--_0x2cd0a6){_0x553c28['push'](_0x553c28['shift']());}};_0x571e4e(++_0x3c868d);}(_0x8dd6,0xcd));var _0x68dd=function(_0x6b823f,_0x414adb){_0x6b823f=_0x6b823f-0x0;var _0x24eff1=_0x8dd6[_0x6b823f];return _0x24eff1;};'use strict';var multer=require(_0x68dd('0x0'));var util=require('util');var path=require(_0x68dd('0x1'));var timeout=require(_0x68dd('0x2'));var express=require(_0x68dd('0x3'));var router=express[_0x68dd('0x4')]();var fs_extra=require(_0x68dd('0x5'));var auth=require(_0x68dd('0x6'));var interaction=require(_0x68dd('0x7'));var config=require(_0x68dd('0x8'));var controller=require('./mailMessage.controller');router[_0x68dd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68dd('0x9')](_0x68dd('0xa'),auth[_0x68dd('0xb')](),controller[_0x68dd('0xc')]);router[_0x68dd('0x9')](_0x68dd('0xd'),auth[_0x68dd('0xb')](),controller[_0x68dd('0xe')]);router[_0x68dd('0x9')](_0x68dd('0xf'),auth['isAuthenticated'](),controller[_0x68dd('0x10')]);router[_0x68dd('0x11')]('/',auth[_0x68dd('0xb')](),interaction['tracked'](_0x68dd('0x12'),'mailmessage:create'),controller['create']);router['put'](_0x68dd('0xd'),auth[_0x68dd('0xb')](),controller[_0x68dd('0x13')]);router[_0x68dd('0x14')](_0x68dd('0x15'),auth['isAuthenticated'](),controller[_0x68dd('0x16')]);router[_0x68dd('0x14')](_0x68dd('0x17'),auth[_0x68dd('0xb')](),controller[_0x68dd('0x18')]);router[_0x68dd('0x19')](_0x68dd('0xd'),auth[_0x68dd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 552307f..b3139a9 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 _0x4baa=['ENUM','out','STRING','DATE','Email','Chat','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN'];(function(_0xec253f,_0x1c1d12){var _0x573fe7=function(_0x2f5e66){while(--_0x2f5e66){_0xec253f['push'](_0xec253f['shift']());}};_0x573fe7(++_0x1c1d12);}(_0x4baa,0xfd));var _0xa4ba=function(_0x2f47cc,_0x2cb108){_0x2f47cc=_0x2f47cc-0x0;var _0x8b4394=_0x4baa[_0x2f47cc];return _0x8b4394;};'use strict';var Sequelize=require(_0xa4ba('0x0'));var _=require(_0xa4ba('0x1'));module[_0xa4ba('0x2')]={'body':{'type':Sequelize['TEXT'](_0xa4ba('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa4ba('0x4')](_0xa4ba('0x5'))},'read':{'type':Sequelize[_0xa4ba('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa4ba('0x7')]('in',_0xa4ba('0x8')),'defaultValue':_0xa4ba('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa4ba('0x9')](0x1fe)},'from':{'type':Sequelize[_0xa4ba('0x9')]},'to':{'type':Sequelize[_0xa4ba('0x4')]('long')},'cc':{'type':Sequelize[_0xa4ba('0x4')](_0xa4ba('0x3'))},'bcc':{'type':Sequelize[_0xa4ba('0x4')](_0xa4ba('0x3'))},'subject':{'type':Sequelize[_0xa4ba('0x4')]},'sentAt':{'type':Sequelize[_0xa4ba('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa4ba('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa4ba('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xa4ba('0x3'))},'originCc':{'type':Sequelize[_0xa4ba('0x4')]('long')},'originChannel':{'type':Sequelize[_0xa4ba('0x7')](_0xa4ba('0xb'),_0xa4ba('0xc')),'defaultValue':_0xa4ba('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xff9d=['INTEGER','Email','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4138f5,_0x51b97b){var _0x57125b=function(_0x34ce8c){while(--_0x34ce8c){_0x4138f5['push'](_0x4138f5['shift']());}};_0x57125b(++_0x51b97b);}(_0xff9d,0x16a));var _0xdff9=function(_0x2142ea,_0x5a8f39){_0x2142ea=_0x2142ea-0x0;var _0x53e2a9=_0xff9d[_0x2142ea];return _0x53e2a9;};'use strict';var Sequelize=require('sequelize');var _=require(_0xdff9('0x0'));module[_0xdff9('0x1')]={'body':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x4'))},'read':{'type':Sequelize[_0xdff9('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdff9('0x6')]('in',_0xdff9('0x7')),'defaultValue':_0xdff9('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdff9('0x8')](0x1fe)},'from':{'type':Sequelize[_0xdff9('0x8')]},'to':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x3'))},'cc':{'type':Sequelize[_0xdff9('0x2')](_0xdff9('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xdff9('0x2')]},'sentAt':{'type':Sequelize[_0xdff9('0x9')]},'attach':{'type':Sequelize[_0xdff9('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdff9('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xdff9('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xdff9('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0xdff9('0xb'),'Chat'),'defaultValue':_0xdff9('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 426f536..543a3d0 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 _0x535f=['RejectMessage','ContactId','Sequelize','SELECT','email','internal','interface','reject','rejectmessage','download','unix','join','server','message-%s.eml','bcc','createdAt','Attachment','Attachments','from','subject','headers','existsSync','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','stack','name','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','body','params','describe','direction','out','split','MailAccount','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','attachments','root','server/files/attachments','basename','create','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x1c8bb1,_0x5621e8){var _0x1f5c9f=function(_0x2293ad){while(--_0x2293ad){_0x1c8bb1['push'](_0x1c8bb1['shift']());}};_0x1f5c9f(++_0x5621e8);}(_0x535f,0x1db));var _0xf535=function(_0xf8e486,_0x5d2f29){_0xf8e486=_0xf8e486-0x0;var _0x5dcc9a=_0x535f[_0xf8e486];return _0x5dcc9a;};'use strict';var emlformat=require(_0xf535('0x0'));var moment=require(_0xf535('0x1'));var BPromise=require(_0xf535('0x2'));var util=require(_0xf535('0x3'));var path=require(_0xf535('0x4'));var fs=require('fs');var _=require(_0xf535('0x5'));var Redis=require(_0xf535('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xf535('0x7'));var logger=require('../../config/logger')(_0xf535('0x8'));var interaction_log=require(_0xf535('0x9'))(_0xf535('0xa'));var config=require(_0xf535('0xb'));var db=require(_0xf535('0xc'))['db'];config[_0xf535('0xd')]=_[_0xf535('0xe')](config[_0xf535('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf535('0xf'))(new Redis(config[_0xf535('0xd')]));var htmlEntities=require(_0xf535('0x10'));require(_0xf535('0x11'))[_0xf535('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf535('0x13')][_0xf535('0x14')]({'port':0x232c});var client9003=jayson['client'][_0xf535('0x14')]({'port':0x232b});var client9002=jayson[_0xf535('0x13')][_0xf535('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1ba887,_0x251d7e,_0x2b8b8d,_0x539729){return new BPromise(function(_0x14c67e,_0x284405){var _0x360c40=_0x539729||client;return _0x360c40[_0xf535('0x15')](_0x1ba887,_0x2b8b8d)[_0xf535('0x16')](function(_0x15cf35){logger[_0xf535('0x17')](_0xf535('0x18'),_0x251d7e,_0xf535('0x19'));logger[_0xf535('0x1a')](_0xf535('0x1b'),_0x251d7e,'request\x20sent',JSON[_0xf535('0x1c')](_0x15cf35));if(_0x15cf35['error']){if(_0x15cf35[_0xf535('0x1d')]['code']===0x1f4){logger[_0xf535('0x1d')](_0xf535('0x18'),_0x251d7e,_0x15cf35[_0xf535('0x1d')]['message']);return _0x284405(_0x15cf35[_0xf535('0x1d')][_0xf535('0x1e')]);}logger[_0xf535('0x1d')]('MailMessage,\x20%s,\x20%s',_0x251d7e,_0x15cf35['error'][_0xf535('0x1e')]);return _0x14c67e(_0x15cf35['error']['message']);}else{logger[_0xf535('0x17')](_0xf535('0x18'),_0x251d7e,_0xf535('0x19'));_0x14c67e(_0x15cf35[_0xf535('0x1f')][_0xf535('0x1e')]);}})['catch'](function(_0x49c195){logger[_0xf535('0x1d')](_0xf535('0x18'),_0x251d7e,_0x49c195);_0x284405(_0x49c195);});});}function respondWithResult(_0x5c0f39,_0x3b34cb){_0x3b34cb=_0x3b34cb||0xc8;return function(_0x141045){if(_0x141045){return _0x5c0f39[_0xf535('0x20')](_0x3b34cb)[_0xf535('0x21')](_0x141045);}};}function respondWithFilteredResult(_0x3c561c,_0x1c3f57){return function(_0x5b277a){if(_0x5b277a){var _0x4d6876=typeof _0x1c3f57[_0xf535('0x22')]===_0xf535('0x23')&&typeof _0x1c3f57[_0xf535('0x24')]===_0xf535('0x23');var _0x38e44=_0x5b277a[_0xf535('0x25')];var _0x5a34cc=_0x4d6876?0x0:_0x1c3f57[_0xf535('0x22')];var _0x299563=_0x4d6876?_0x5b277a['count']:_0x1c3f57[_0xf535('0x22')]+_0x1c3f57[_0xf535('0x24')];var _0x4714d5;if(_0x299563>=_0x38e44){_0x299563=_0x38e44;_0x4714d5=0xc8;}else{_0x4714d5=0xce;}_0x3c561c['status'](_0x4714d5);return _0x3c561c['set'](_0xf535('0x26'),_0x5a34cc+'-'+_0x299563+'/'+_0x38e44)[_0xf535('0x21')](_0x5b277a);}return null;};}function saveUpdates(_0x1b391d){return function(_0xd77f2b){if(_0xd77f2b){return _0xd77f2b[_0xf535('0x27')](_0x1b391d)[_0xf535('0x16')](function(_0x5094e0){return _0x5094e0;});}return null;};}function removeEntity(_0x3dde2d){return function(_0x16b2a0){if(_0x16b2a0){return _0x16b2a0[_0xf535('0x28')]()[_0xf535('0x16')](function(){_0x3dde2d[_0xf535('0x20')](0xcc)[_0xf535('0x29')]();});}};}function handleEntityNotFound(_0x6a453f){return function(_0x16d727){if(!_0x16d727){_0x6a453f[_0xf535('0x2a')](0x194);}return _0x16d727;};}function handleError(_0xda1598,_0xea9d13){_0xea9d13=_0xea9d13||0x1f4;return function(_0x37c58a){logger[_0xf535('0x1d')](_0x37c58a[_0xf535('0x2b')]);if(_0x37c58a[_0xf535('0x2c')]){delete _0x37c58a[_0xf535('0x2c')];}_0xda1598[_0xf535('0x20')](_0xea9d13)['send'](_0x37c58a);};}exports['index']=function(_0x5bece3,_0x154edd){var _0xb2de37={},_0x1953d8={},_0x294de8={'count':0x0,'rows':[]};var _0x1941e8=_[_0xf535('0x2d')](db[_0xf535('0x2e')][_0xf535('0x2f')],function(_0x171fc9){return{'name':_0x171fc9[_0xf535('0x30')],'type':_0x171fc9[_0xf535('0x31')]['key']};});_0x1953d8[_0xf535('0x32')]=_[_0xf535('0x2d')](_0x1941e8,'name');_0x1953d8[_0xf535('0x33')]=_[_0xf535('0x34')](_0x5bece3[_0xf535('0x33')]);_0x1953d8['filters']=_[_0xf535('0x35')](_0x1953d8['model'],_0x1953d8['query']);_0xb2de37[_0xf535('0x36')]=_[_0xf535('0x35')](_0x1953d8['model'],qs[_0xf535('0x37')](_0x5bece3[_0xf535('0x33')][_0xf535('0x37')]));_0xb2de37[_0xf535('0x36')]=_0xb2de37['attributes'][_0xf535('0x38')]?_0xb2de37[_0xf535('0x36')]:_0x1953d8[_0xf535('0x32')];if(!_0x5bece3[_0xf535('0x33')][_0xf535('0x39')](_0xf535('0x3a'))){_0xb2de37[_0xf535('0x24')]=qs[_0xf535('0x24')](_0x5bece3[_0xf535('0x33')][_0xf535('0x24')]);_0xb2de37['offset']=qs[_0xf535('0x22')](_0x5bece3[_0xf535('0x33')][_0xf535('0x22')]);}_0xb2de37['order']=qs[_0xf535('0x3b')](_0x5bece3[_0xf535('0x33')]['sort']);_0xb2de37['where']=qs[_0xf535('0x3c')](_['pick'](_0x5bece3[_0xf535('0x33')],_0x1953d8[_0xf535('0x3c')]),_0x1941e8);if(_0x5bece3['query'][_0xf535('0x3d')]){_0xb2de37[_0xf535('0x3e')]=_[_0xf535('0x3f')](_0xb2de37[_0xf535('0x3e')],{'$or':_[_0xf535('0x2d')](_0x1941e8,function(_0x524875){if(_0x524875[_0xf535('0x31')]!==_0xf535('0x40')){var _0x3485f1={};_0x3485f1[_0x524875[_0xf535('0x2c')]]={'$like':'%'+_0x5bece3[_0xf535('0x33')]['filter']+'%'};return _0x3485f1;}})});}_0xb2de37=_[_0xf535('0x3f')]({},_0xb2de37,_0x5bece3[_0xf535('0x41')]);var _0x6b86c2={'where':_0xb2de37[_0xf535('0x3e')]};return db['MailMessage'][_0xf535('0x25')](_0x6b86c2)[_0xf535('0x16')](function(_0xfa5dcc){_0x294de8[_0xf535('0x25')]=_0xfa5dcc;if(_0x5bece3[_0xf535('0x33')][_0xf535('0x42')]){_0xb2de37[_0xf535('0x43')]=[{'all':!![]}];}return db[_0xf535('0x2e')][_0xf535('0x44')](_0xb2de37);})[_0xf535('0x16')](function(_0x5c55c9){_0x294de8['rows']=_0x5c55c9;return _0x294de8;})[_0xf535('0x16')](respondWithFilteredResult(_0x154edd,_0xb2de37))[_0xf535('0x45')](handleError(_0x154edd,null));};exports[_0xf535('0x46')]=function(_0x5c9a8e,_0x10ab8a){var _0x53d612={'raw':!![],'where':{'id':_0x5c9a8e['params']['id']}},_0x26f668={};_0x26f668['model']=_['keys'](db[_0xf535('0x2e')]['rawAttributes']);_0x26f668[_0xf535('0x33')]=_[_0xf535('0x34')](_0x5c9a8e[_0xf535('0x33')]);_0x26f668[_0xf535('0x3c')]=_['intersection'](_0x26f668['model'],_0x26f668['query']);_0x53d612['attributes']=_[_0xf535('0x35')](_0x26f668['model'],qs[_0xf535('0x37')](_0x5c9a8e['query'][_0xf535('0x37')]));_0x53d612['attributes']=_0x53d612['attributes']['length']?_0x53d612[_0xf535('0x36')]:_0x26f668[_0xf535('0x32')];if(_0x5c9a8e[_0xf535('0x33')]['includeAll']){_0x53d612['include']=[{'all':!![]}];}_0x53d612=_[_0xf535('0x3f')]({},_0x53d612,_0x5c9a8e[_0xf535('0x41')]);return db[_0xf535('0x2e')][_0xf535('0x47')](_0x53d612)[_0xf535('0x16')](handleEntityNotFound(_0x10ab8a,null))['then'](respondWithResult(_0x10ab8a,null))[_0xf535('0x45')](handleError(_0x10ab8a,null));};exports[_0xf535('0x27')]=function(_0x3f785e,_0x3d6b4e){if(_0x3f785e[_0xf535('0x48')]['id']){delete _0x3f785e[_0xf535('0x48')]['id'];}return db[_0xf535('0x2e')][_0xf535('0x47')]({'where':{'id':_0x3f785e[_0xf535('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d6b4e,null))[_0xf535('0x16')](saveUpdates(_0x3f785e[_0xf535('0x48')],null))[_0xf535('0x16')](respondWithResult(_0x3d6b4e,null))[_0xf535('0x45')](handleError(_0x3d6b4e,null));};exports[_0xf535('0x28')]=function(_0x268715,_0x215285){return db[_0xf535('0x2e')][_0xf535('0x47')]({'where':{'id':_0x268715[_0xf535('0x49')]['id']}})[_0xf535('0x16')](handleEntityNotFound(_0x215285,null))[_0xf535('0x16')](removeEntity(_0x215285,null))[_0xf535('0x45')](handleError(_0x215285,null));};exports[_0xf535('0x4a')]=function(_0x3ada54,_0x457d75){return db[_0xf535('0x2e')][_0xf535('0x4a')]()['then'](respondWithResult(_0x457d75,null))[_0xf535('0x45')](handleError(_0x457d75,null));};exports['create']=function(_0x4238c0,_0x15c49a){return db['MailMessage']['create'](_0x4238c0[_0xf535('0x48')])[_0xf535('0x16')](function(_0x4c8a97){if(_0x4c8a97){if(_0x4c8a97[_0xf535('0x4b')]===_0xf535('0x4c')&&!_0x4c8a97['secret']){var _0x8aa9a4,_0x2ceb5d,_0x40c180;if(_0x4238c0[_0xf535('0x48')]['to']){_0x2ceb5d=_0x4238c0[_0xf535('0x48')]['to'][_0xf535('0x4d')](',')[0x0];}return db[_0xf535('0x4e')]['findOne']({'where':{'id':_0x4c8a97['MailAccountId']},'include':[{'model':db[_0xf535('0x4f')],'as':_0xf535('0x50'),'include':[{'model':db[_0xf535('0x51')],'as':_0xf535('0x52'),'where':{'email':_0x2ceb5d},'limit':0x1,'order':[[_0xf535('0x53'),_0xf535('0x54')]]}]},{'model':db['MailServerOut'],'as':_0xf535('0x55'),'raw':!![],'include':[{'model':db[_0xf535('0x56')],'as':_0xf535('0x56'),'raw':!![]}]}]})[_0xf535('0x16')](function(_0x52567a){_0x8aa9a4=_0x52567a;if(!_0x8aa9a4||!_0x8aa9a4['Smtp'])return;var _0x5324bd=_0x8aa9a4['getSmtpOptions']();if(_0x4238c0[_0xf535('0x48')]['attachments']&&_0x4238c0['body']['attachments'][_0xf535('0x38')]){for(var _0x4c1c3f=0x0;_0x4c1c3f<_0x4238c0[_0xf535('0x48')][_0xf535('0x57')]['length'];_0x4c1c3f+=0x1){_0x4238c0[_0xf535('0x48')][_0xf535('0x57')][_0x4c1c3f]={'filename':_0x4238c0[_0xf535('0x48')]['attachments'][_0x4c1c3f]['name'],'path':path['join'](config[_0xf535('0x58')],_0xf535('0x59'),_0x4238c0['body'][_0xf535('0x57')][_0x4c1c3f][_0xf535('0x5a')])};}}_0x40c180={'account':_0x5324bd,'message':_0x4238c0[_0xf535('0x48')]};return;})[_0xf535('0x16')](function(){if(_0x8aa9a4[_0xf535('0x50')]){if(_0x8aa9a4[_0xf535('0x50')]['Contacts'][_0xf535('0x38')]){return _0x8aa9a4[_0xf535('0x50')][_0xf535('0x52')][0x0];}else{return db[_0xf535('0x51')][_0xf535('0x5b')](_[_0xf535('0xe')](_0x4238c0[_0xf535('0x48')],{'firstName':_0x4238c0['body']['to'],'email':_0x4238c0[_0xf535('0x48')]['to'],'phone':_0x4238c0['body']['to'],'ListId':_0x8aa9a4['ListId']}));}}else{throw new Error(_0xf535('0x5c'));}})[_0xf535('0x16')](function(){if(_0x40c180){return respondWithRpcPromise('SendMail','sendMail',_0x40c180,client9003)['then'](function(_0x5c7ac0){return _0x4c8a97[_0xf535('0x27')]({'read':!![],'messageId':_0x5c7ac0[_0xf535('0x5d')],'sentAt':moment()[_0xf535('0x5e')](_0xf535('0x5f'))});})[_0xf535('0x45')](function(_0x4c1206){logger[_0xf535('0x1d')]('%s',JSON[_0xf535('0x1c')](_0x4c1206));return _0x4c8a97;});}return _0x4c8a97;});}return _0x4c8a97;}})[_0xf535('0x16')](respondWithResult(_0x15c49a,0xc9))[_0xf535('0x45')](handleError(_0x15c49a,null));};exports[_0xf535('0x60')]=function(_0x6254cf,_0xf64dd8){var _0x1aa6a3={'agent':{},'channel':'mail'};if(_0x6254cf['body']['id']){delete _0x6254cf[_0xf535('0x48')]['id'];}_0x6254cf[_0xf535('0x48')]['read']=!![];_0x6254cf['body'][_0xf535('0x61')]=moment()[_0xf535('0x5e')](_0xf535('0x5f'));_0x6254cf[_0xf535('0x48')][_0xf535('0x62')]=_0x6254cf[_0xf535('0x48')]['UserId']||_0x6254cf[_0xf535('0x63')]['id'];_0x1aa6a3[_0xf535('0x64')]['id']=_0x6254cf['body'][_0xf535('0x62')];return db['MailMessage'][_0xf535('0x47')]({'where':{'id':_0x6254cf[_0xf535('0x49')]['id'],'UserId':null}})[_0xf535('0x16')](handleEntityNotFound(_0xf64dd8,null))[_0xf535('0x16')](saveUpdates(_0x6254cf['body'],null))[_0xf535('0x16')](function(_0x49fc71){if(_0x49fc71){_0x1aa6a3[_0xf535('0x1e')]=_0x49fc71[_0xf535('0x65')]({'plain':!![]});return db[_0xf535('0x66')][_0xf535('0x47')]({'where':{'id':_0x49fc71[_0xf535('0x67')]}});}return null;})['then'](handleEntityNotFound(_0xf64dd8,null))[_0xf535('0x16')](function(_0x150b8d){if(_0x150b8d){return _0x150b8d[_0xf535('0x27')]({'UserId':_0x6254cf[_0xf535('0x48')]['UserId'],'read1stAt':_[_0xf535('0x68')](_0x150b8d[_0xf535('0x69')])?moment()[_0xf535('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf535('0x16')](function(_0x8759b9){if(_0x8759b9){_0x1aa6a3[_0xf535('0x6a')]=_0x8759b9[_0xf535('0x65')]({'plain':!![]});interaction_log[_0xf535('0x17')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6254cf[_0xf535('0x63')]['id'],_0x6254cf[_0xf535('0x63')][_0xf535('0x2c')],_0x6254cf['user']['role'],_0x1aa6a3[_0xf535('0x6a')]['id'],_0x6254cf[_0xf535('0x48')]?JSON[_0xf535('0x1c')](_0x6254cf['body']):_0xf535('0x6b'));return respondWithRpcPromise(_0xf535('0x6c'),_0xf535('0x6d'),_0x1aa6a3);}return null;})[_0xf535('0x16')](function(_0x417180){var _0x344dae=_0xf535('0x6e')+_0x417180[_0xf535('0x1e')]['ContactId'];return db[_0xf535('0x6f')][_0xf535('0x33')](_0x344dae,{'type':db['Sequelize'][_0xf535('0x70')]['SELECT'],'raw':!![]})[_0xf535('0x16')](function(_0x524f0a){return _0x524f0a;});})['then'](function(_0x34719a){if(_0x34719a){_0x1aa6a3[_0xf535('0x1e')][_0xf535('0x71')]=_0x34719a[0x0];if(!_0x6254cf['body'][_0xf535('0x62')])return;return db[_0xf535('0x72')]['find']({'where':{'id':_0x6254cf[_0xf535('0x48')][_0xf535('0x62')],'role':'agent'},'attributes':['id',_0xf535('0x2c'),_0xf535('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xf535('0x16')](function(_0x37bb7f){if(!_0x37bb7f)return null;_0x1aa6a3[_0xf535('0x1e')][_0xf535('0x64')]=_0x37bb7f;return _0x1aa6a3;})[_0xf535('0x16')](function(_0x574c84){if(_0x574c84){if(_0x6254cf[_0xf535('0x48')][_0xf535('0x74')]){_0x1aa6a3['message']['interface']=util['format'](_0xf535('0x75'),_0x6254cf[_0xf535('0x63')][_0xf535('0x2c')]);_0x1aa6a3[_0xf535('0x1e')][_0xf535('0x76')]=_0x1aa6a3[_0xf535('0x76')];_0x1aa6a3[_0xf535('0x1e')][_0xf535('0x77')]=_0x1aa6a3['channel'];_0x1aa6a3[_0xf535('0x1e')][_0xf535('0x78')]='accept';_0x1aa6a3[_0xf535('0x1e')][_0xf535('0x48')]=htmlToText[_0xf535('0x79')](_0x1aa6a3[_0xf535('0x1e')]['body']);return respondWithRpcPromise('EventManager',_0xf535('0x7a'),{'event':_0xf535('0x7b'),'message':_0x1aa6a3[_0xf535('0x1e')]},client9002)[_0xf535('0x16')](function(){return _0x1aa6a3;});}return _0x1aa6a3;}return null;})['then'](respondWithResult(_0xf64dd8,null))[_0xf535('0x45')](handleError(_0xf64dd8,null));};exports['reject']=function(_0x32f5ea,_0x183018){var _0xee1e9a={'agent':{},'channel':'mail'};if(_0x32f5ea[_0xf535('0x48')]['id']){delete _0x32f5ea[_0xf535('0x48')]['id'];}_0x32f5ea[_0xf535('0x48')][_0xf535('0x62')]=_0x32f5ea[_0xf535('0x48')]['UserId']||_0x32f5ea[_0xf535('0x63')]['id'];_0xee1e9a[_0xf535('0x64')]['id']=_0x32f5ea['body']['UserId'];return db[_0xf535('0x2e')][_0xf535('0x47')]({'where':{'id':_0x32f5ea[_0xf535('0x49')]['id'],'UserId':null}})[_0xf535('0x16')](handleEntityNotFound(_0x183018,null))[_0xf535('0x16')](function(_0x42da1b){if(_0x42da1b){_0xee1e9a[_0xf535('0x1e')]=_0x42da1b[_0xf535('0x65')]({'plain':!![]});return db['MailInteraction'][_0xf535('0x47')]({'where':{'id':_0x42da1b[_0xf535('0x67')]}});}return null;})[_0xf535('0x16')](handleEntityNotFound(_0x183018,null))['then'](function(_0xb8eff9){if(_0xb8eff9){_0xee1e9a[_0xf535('0x6a')]=_0xb8eff9[_0xf535('0x65')]({'plain':!![]});interaction_log['info'](_0xf535('0x7c'),_0x32f5ea[_0xf535('0x63')]['id'],_0x32f5ea[_0xf535('0x63')][_0xf535('0x2c')],_0x32f5ea[_0xf535('0x63')]['role'],_0xee1e9a['interaction']['id'],_0x32f5ea['body']?JSON[_0xf535('0x1c')](_0x32f5ea[_0xf535('0x48')]):_0xf535('0x6b'));return respondWithRpcPromise(_0xf535('0x7d'),'rejectMessage',_0xee1e9a);}return null;})[_0xf535('0x16')](function(_0x2d03b1){var _0x33230f=_0xf535('0x6e')+_0x2d03b1[_0xf535('0x1e')][_0xf535('0x7e')];return db[_0xf535('0x6f')]['query'](_0x33230f,{'type':db[_0xf535('0x7f')][_0xf535('0x70')][_0xf535('0x80')],'raw':!![]})[_0xf535('0x16')](function(_0x3711cd){return _0x3711cd;});})[_0xf535('0x16')](function(_0x1700c9){if(_0x1700c9){_0xee1e9a[_0xf535('0x1e')]['contact']=_0x1700c9[0x0];if(!_0x32f5ea[_0xf535('0x48')]['UserId'])return;return db[_0xf535('0x72')][_0xf535('0x47')]({'where':{'id':_0x32f5ea['body']['UserId'],'role':_0xf535('0x64')},'attributes':['id','name','fullname',_0xf535('0x81'),_0xf535('0x82')],'raw':!![]});}return null;})[_0xf535('0x16')](function(_0x3d9ede){if(!_0x3d9ede)return null;_0xee1e9a[_0xf535('0x1e')]['agent']=_0x3d9ede;return _0xee1e9a;})[_0xf535('0x16')](function(_0x5c4fe1){if(_0x5c4fe1){_0x5c4fe1[_0xf535('0x1e')][_0xf535('0x83')]=util[_0xf535('0x5e')](_0xf535('0x75'),_0x32f5ea[_0xf535('0x63')]['name']);_0x5c4fe1[_0xf535('0x1e')][_0xf535('0x76')]=_0xee1e9a['channel'];_0x5c4fe1['message']['motionChannel']=_0xee1e9a[_0xf535('0x76')];_0x5c4fe1[_0xf535('0x1e')][_0xf535('0x78')]=_0xf535('0x84');_0x5c4fe1[_0xf535('0x1e')][_0xf535('0x48')]=htmlToText[_0xf535('0x79')](_0xee1e9a[_0xf535('0x1e')][_0xf535('0x48')]);respondWithRpcPromise(_0xf535('0x7a'),_0xf535('0x7a'),{'event':_0xf535('0x85'),'message':_0x5c4fe1[_0xf535('0x1e')]},client9002);return _0xee1e9a;}return null;})[_0xf535('0x16')](respondWithResult(_0x183018,null))[_0xf535('0x45')](handleError(_0x183018,null));};exports[_0xf535('0x86')]=function(_0x405011,_0x131415){var _0x25721c=moment()[_0xf535('0x87')]()['toString']();var _0x3e07e3=path[_0xf535('0x88')](config['root'],_0xf535('0x89'),'files','tmp');var _0x29f9b2=path[_0xf535('0x88')](config[_0xf535('0x58')],_0xf535('0x89'),'files',_0xf535('0x57'));var _0x922dab=util[_0xf535('0x5e')](_0xf535('0x8a'),_0x25721c);return db[_0xf535('0x2e')][_0xf535('0x47')]({'where':{'id':_0x405011[_0xf535('0x49')]['id']},'attributes':['id','body','from','to','cc',_0xf535('0x8b'),'subject',_0xf535('0x8c')],'include':_0x405011[_0xf535('0x33')][_0xf535('0x57')]?[{'model':db[_0xf535('0x8d')],'as':_0xf535('0x8e')}]:undefined})[_0xf535('0x16')](handleEntityNotFound(_0x131415,null))['then'](function(_0x1e6ff6){if(_0x1e6ff6){var _0xe1c7a3=_0x1e6ff6;var _0x212dd2={'from':_0xe1c7a3[_0xf535('0x8f')],'to':_0xe1c7a3['to'],'subject':_0xe1c7a3[_0xf535('0x90')],'html':htmlEntities['decode'](_0xe1c7a3[_0xf535('0x48')]),'headers':{'Date':moment(_0xe1c7a3[_0xf535('0x8c')])[_0xf535('0x5e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1e6ff6['cc']){_0x212dd2['headers']['Cc']=_0x1e6ff6['cc'];}if(_0x1e6ff6[_0xf535('0x8b')]){_0x212dd2[_0xf535('0x91')]['Bcc']=_0x1e6ff6[_0xf535('0x8b')];}return new BPromise(function(_0x50dc52,_0x562e8b){if(_0x1e6ff6['Attachments']){for(var _0x19aeb4=0x0;_0x19aeb4<_0x1e6ff6[_0xf535('0x8e')]['length'];_0x19aeb4++){var _0x113fd8=_0x1e6ff6['Attachments'][_0x19aeb4];var _0x4088dd=path[_0xf535('0x88')](_0x29f9b2,_0x113fd8[_0xf535('0x5a')]);if(fs[_0xf535('0x92')](_0x4088dd)){_0x212dd2['attachments'][_0xf535('0x93')]({'name':_0x113fd8[_0xf535('0x2c')],'contentType':_0x113fd8['type'],'data':fs['readFileSync'](_0x4088dd)});}}}emlformat[_0xf535('0x94')](_0x212dd2,function(_0x1ab746,_0x49d378){if(_0x1ab746)return _0x562e8b(_0x1ab746);fs['writeFileSync'](path['join'](_0x3e07e3,_0x922dab),_0x49d378);return _0x50dc52(_0x49d378);});});}})[_0xf535('0x16')](function(_0x383bb5){if(_0x383bb5){return _0x131415[_0xf535('0x86')](path[_0xf535('0x88')](_0x3e07e3,_0x922dab),_0x922dab,function(_0x303183){if(!_0x303183)fs[_0xf535('0x95')](path[_0xf535('0x88')](_0x3e07e3,_0x922dab));});}})[_0xf535('0x45')](handleError(_0x131415,null));}; \ No newline at end of file +var _0x48ff=['count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','body','find','describe','direction','secret','split','MailAccount','MailAccountId','List','CmContact','updatedAt','DESC','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','create','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','reject','role','null','RejectMessage','rejectMessage','ContactId','contact','rejectmessage','unix','toString','files','tmp','server','message-%s.eml','from','bcc','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','download','eml-format','moment','bluebird','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit'];(function(_0x40b378,_0x5b048c){var _0x636965=function(_0x2232cc){while(--_0x2232cc){_0x40b378['push'](_0x40b378['shift']());}};_0x636965(++_0x5b048c);}(_0x48ff,0x1bb));var _0xf48f=function(_0x23ef2a,_0x19bcd2){_0x23ef2a=_0x23ef2a-0x0;var _0x3eda6f=_0x48ff[_0x23ef2a];return _0x3eda6f;};'use strict';var emlformat=require(_0xf48f('0x0'));var moment=require(_0xf48f('0x1'));var BPromise=require(_0xf48f('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xf48f('0x3'));var Redis=require('ioredis');var htmlToText=require(_0xf48f('0x4'));var qs=require(_0xf48f('0x5'));var logger=require('../../config/logger')(_0xf48f('0x6'));var interaction_log=require(_0xf48f('0x7'))('mail-interactions');var config=require(_0xf48f('0x8'));var db=require(_0xf48f('0x9'))['db'];config[_0xf48f('0xa')]=_[_0xf48f('0xb')](config[_0xf48f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf48f('0xc'))(new Redis(config[_0xf48f('0xa')]));var htmlEntities=require(_0xf48f('0xd'));require(_0xf48f('0xe'))[_0xf48f('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf48f('0x10')][_0xf48f('0x11')]({'port':0x232c});var client9003=jayson[_0xf48f('0x10')][_0xf48f('0x11')]({'port':0x232b});var client9002=jayson['client'][_0xf48f('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x190f5a,_0x163613,_0x292b7e,_0x371b7f){return new BPromise(function(_0x4f5dfd,_0x286997){var _0x155a2d=_0x371b7f||client;return _0x155a2d[_0xf48f('0x12')](_0x190f5a,_0x292b7e)[_0xf48f('0x13')](function(_0x161232){logger[_0xf48f('0x14')]('MailMessage,\x20%s,\x20%s',_0x163613,_0xf48f('0x15'));logger[_0xf48f('0x16')](_0xf48f('0x17'),_0x163613,_0xf48f('0x15'),JSON[_0xf48f('0x18')](_0x161232));if(_0x161232[_0xf48f('0x19')]){if(_0x161232['error']['code']===0x1f4){logger[_0xf48f('0x19')](_0xf48f('0x1a'),_0x163613,_0x161232['error'][_0xf48f('0x1b')]);return _0x286997(_0x161232[_0xf48f('0x19')]['message']);}logger[_0xf48f('0x19')](_0xf48f('0x1a'),_0x163613,_0x161232[_0xf48f('0x19')][_0xf48f('0x1b')]);return _0x4f5dfd(_0x161232['error'][_0xf48f('0x1b')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x163613,'request\x20sent');_0x4f5dfd(_0x161232['result'][_0xf48f('0x1b')]);}})[_0xf48f('0x1c')](function(_0x2e17ea){logger[_0xf48f('0x19')](_0xf48f('0x1a'),_0x163613,_0x2e17ea);_0x286997(_0x2e17ea);});});}function respondWithResult(_0x3932cb,_0x38f7e2){_0x38f7e2=_0x38f7e2||0xc8;return function(_0x4b4e24){if(_0x4b4e24){return _0x3932cb[_0xf48f('0x1d')](_0x38f7e2)[_0xf48f('0x1e')](_0x4b4e24);}};}function respondWithFilteredResult(_0x3f95bb,_0xd58437){return function(_0x357329){if(_0x357329){var _0x1084e8=typeof _0xd58437[_0xf48f('0x1f')]===_0xf48f('0x20')&&typeof _0xd58437[_0xf48f('0x21')]===_0xf48f('0x20');var _0x28ab7f=_0x357329['count'];var _0x12d870=_0x1084e8?0x0:_0xd58437['offset'];var _0xd6dcd2=_0x1084e8?_0x357329[_0xf48f('0x22')]:_0xd58437[_0xf48f('0x1f')]+_0xd58437[_0xf48f('0x21')];var _0xbfc413;if(_0xd6dcd2>=_0x28ab7f){_0xd6dcd2=_0x28ab7f;_0xbfc413=0xc8;}else{_0xbfc413=0xce;}_0x3f95bb[_0xf48f('0x1d')](_0xbfc413);return _0x3f95bb[_0xf48f('0x23')](_0xf48f('0x24'),_0x12d870+'-'+_0xd6dcd2+'/'+_0x28ab7f)[_0xf48f('0x1e')](_0x357329);}return null;};}function saveUpdates(_0x40828c){return function(_0x381df4){if(_0x381df4){return _0x381df4['update'](_0x40828c)[_0xf48f('0x13')](function(_0x5049f1){return _0x5049f1;});}return null;};}function removeEntity(_0x41a35e){return function(_0x52ff8c){if(_0x52ff8c){return _0x52ff8c[_0xf48f('0x25')]()[_0xf48f('0x13')](function(){_0x41a35e[_0xf48f('0x1d')](0xcc)[_0xf48f('0x26')]();});}};}function handleEntityNotFound(_0x507ab7){return function(_0x412f66){if(!_0x412f66){_0x507ab7[_0xf48f('0x27')](0x194);}return _0x412f66;};}function handleError(_0x14cca7,_0x41988e){_0x41988e=_0x41988e||0x1f4;return function(_0x51a521){logger[_0xf48f('0x19')](_0x51a521[_0xf48f('0x28')]);if(_0x51a521[_0xf48f('0x29')]){delete _0x51a521[_0xf48f('0x29')];}_0x14cca7[_0xf48f('0x1d')](_0x41988e)[_0xf48f('0x2a')](_0x51a521);};}exports[_0xf48f('0x2b')]=function(_0x1c8f5e,_0x305d6f){var _0x3ab5da={},_0x40bbb2={},_0x5c490a={'count':0x0,'rows':[]};var _0x31cab5=_[_0xf48f('0x2c')](db[_0xf48f('0x2d')]['rawAttributes'],function(_0x3fd7c9){return{'name':_0x3fd7c9[_0xf48f('0x2e')],'type':_0x3fd7c9[_0xf48f('0x2f')][_0xf48f('0x30')]};});_0x40bbb2[_0xf48f('0x31')]=_[_0xf48f('0x2c')](_0x31cab5,_0xf48f('0x29'));_0x40bbb2[_0xf48f('0x32')]=_[_0xf48f('0x33')](_0x1c8f5e['query']);_0x40bbb2[_0xf48f('0x34')]=_['intersection'](_0x40bbb2[_0xf48f('0x31')],_0x40bbb2[_0xf48f('0x32')]);_0x3ab5da['attributes']=_[_0xf48f('0x35')](_0x40bbb2[_0xf48f('0x31')],qs[_0xf48f('0x36')](_0x1c8f5e[_0xf48f('0x32')]['fields']));_0x3ab5da[_0xf48f('0x37')]=_0x3ab5da['attributes'][_0xf48f('0x38')]?_0x3ab5da['attributes']:_0x40bbb2['model'];if(!_0x1c8f5e[_0xf48f('0x32')]['hasOwnProperty'](_0xf48f('0x39'))){_0x3ab5da['limit']=qs['limit'](_0x1c8f5e[_0xf48f('0x32')][_0xf48f('0x21')]);_0x3ab5da[_0xf48f('0x1f')]=qs[_0xf48f('0x1f')](_0x1c8f5e['query'][_0xf48f('0x1f')]);}_0x3ab5da['order']=qs[_0xf48f('0x3a')](_0x1c8f5e['query']['sort']);_0x3ab5da[_0xf48f('0x3b')]=qs[_0xf48f('0x34')](_['pick'](_0x1c8f5e['query'],_0x40bbb2[_0xf48f('0x34')]),_0x31cab5);if(_0x1c8f5e['query'][_0xf48f('0x3c')]){_0x3ab5da[_0xf48f('0x3b')]=_[_0xf48f('0x3d')](_0x3ab5da[_0xf48f('0x3b')],{'$or':_[_0xf48f('0x2c')](_0x31cab5,function(_0x59c850){if(_0x59c850[_0xf48f('0x2f')]!==_0xf48f('0x3e')){var _0x40325d={};_0x40325d[_0x59c850['name']]={'$like':'%'+_0x1c8f5e[_0xf48f('0x32')][_0xf48f('0x3c')]+'%'};return _0x40325d;}})});}_0x3ab5da=_[_0xf48f('0x3d')]({},_0x3ab5da,_0x1c8f5e[_0xf48f('0x3f')]);var _0x687d88={'where':_0x3ab5da['where']};return db[_0xf48f('0x2d')][_0xf48f('0x22')](_0x687d88)[_0xf48f('0x13')](function(_0x4e91a0){_0x5c490a[_0xf48f('0x22')]=_0x4e91a0;if(_0x1c8f5e[_0xf48f('0x32')][_0xf48f('0x40')]){_0x3ab5da['include']=[{'all':!![]}];}return db[_0xf48f('0x2d')][_0xf48f('0x41')](_0x3ab5da);})[_0xf48f('0x13')](function(_0x5e6003){_0x5c490a[_0xf48f('0x42')]=_0x5e6003;return _0x5c490a;})[_0xf48f('0x13')](respondWithFilteredResult(_0x305d6f,_0x3ab5da))[_0xf48f('0x1c')](handleError(_0x305d6f,null));};exports[_0xf48f('0x43')]=function(_0x840fd1,_0x9b4db9){var _0x2b2016={'raw':!![],'where':{'id':_0x840fd1[_0xf48f('0x44')]['id']}},_0x4cbad1={};_0x4cbad1[_0xf48f('0x31')]=_[_0xf48f('0x33')](db[_0xf48f('0x2d')][_0xf48f('0x45')]);_0x4cbad1[_0xf48f('0x32')]=_[_0xf48f('0x33')](_0x840fd1[_0xf48f('0x32')]);_0x4cbad1[_0xf48f('0x34')]=_[_0xf48f('0x35')](_0x4cbad1[_0xf48f('0x31')],_0x4cbad1[_0xf48f('0x32')]);_0x2b2016[_0xf48f('0x37')]=_['intersection'](_0x4cbad1[_0xf48f('0x31')],qs[_0xf48f('0x36')](_0x840fd1['query']['fields']));_0x2b2016['attributes']=_0x2b2016['attributes']['length']?_0x2b2016[_0xf48f('0x37')]:_0x4cbad1[_0xf48f('0x31')];if(_0x840fd1['query'][_0xf48f('0x40')]){_0x2b2016['include']=[{'all':!![]}];}_0x2b2016=_['merge']({},_0x2b2016,_0x840fd1[_0xf48f('0x3f')]);return db[_0xf48f('0x2d')]['find'](_0x2b2016)[_0xf48f('0x13')](handleEntityNotFound(_0x9b4db9,null))[_0xf48f('0x13')](respondWithResult(_0x9b4db9,null))[_0xf48f('0x1c')](handleError(_0x9b4db9,null));};exports['update']=function(_0x2531e3,_0x37acef){if(_0x2531e3[_0xf48f('0x46')]['id']){delete _0x2531e3['body']['id'];}return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x2531e3[_0xf48f('0x44')]['id']}})[_0xf48f('0x13')](handleEntityNotFound(_0x37acef,null))[_0xf48f('0x13')](saveUpdates(_0x2531e3[_0xf48f('0x46')],null))[_0xf48f('0x13')](respondWithResult(_0x37acef,null))[_0xf48f('0x1c')](handleError(_0x37acef,null));};exports[_0xf48f('0x25')]=function(_0x27591f,_0x22ceef){return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x27591f[_0xf48f('0x44')]['id']}})[_0xf48f('0x13')](handleEntityNotFound(_0x22ceef,null))[_0xf48f('0x13')](removeEntity(_0x22ceef,null))[_0xf48f('0x1c')](handleError(_0x22ceef,null));};exports['describe']=function(_0x119474,_0x24c8c4){return db[_0xf48f('0x2d')][_0xf48f('0x48')]()[_0xf48f('0x13')](respondWithResult(_0x24c8c4,null))[_0xf48f('0x1c')](handleError(_0x24c8c4,null));};exports['create']=function(_0x2a1ed3,_0x2b34f5){return db[_0xf48f('0x2d')]['create'](_0x2a1ed3[_0xf48f('0x46')])['then'](function(_0xde6431){if(_0xde6431){if(_0xde6431[_0xf48f('0x49')]==='out'&&!_0xde6431[_0xf48f('0x4a')]){var _0x5851fa,_0x1e727f,_0x1b4c46;if(_0x2a1ed3[_0xf48f('0x46')]['to']){_0x1e727f=_0x2a1ed3['body']['to'][_0xf48f('0x4b')](',')[0x0];}return db[_0xf48f('0x4c')]['findOne']({'where':{'id':_0xde6431[_0xf48f('0x4d')]},'include':[{'model':db['CmList'],'as':_0xf48f('0x4e'),'include':[{'model':db[_0xf48f('0x4f')],'as':'Contacts','where':{'email':_0x1e727f},'limit':0x1,'order':[[_0xf48f('0x50'),_0xf48f('0x51')]]}]},{'model':db['MailServerOut'],'as':_0xf48f('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x26cea1){_0x5851fa=_0x26cea1;if(!_0x5851fa||!_0x5851fa[_0xf48f('0x52')])return;var _0x176985=_0x5851fa[_0xf48f('0x53')]();if(_0x2a1ed3[_0xf48f('0x46')][_0xf48f('0x54')]&&_0x2a1ed3['body']['attachments'][_0xf48f('0x38')]){for(var _0x1ef5a9=0x0;_0x1ef5a9<_0x2a1ed3['body'][_0xf48f('0x54')][_0xf48f('0x38')];_0x1ef5a9+=0x1){_0x2a1ed3['body']['attachments'][_0x1ef5a9]={'filename':_0x2a1ed3[_0xf48f('0x46')][_0xf48f('0x54')][_0x1ef5a9][_0xf48f('0x29')],'path':path[_0xf48f('0x55')](config[_0xf48f('0x56')],_0xf48f('0x57'),_0x2a1ed3[_0xf48f('0x46')][_0xf48f('0x54')][_0x1ef5a9][_0xf48f('0x58')])};}}_0x1b4c46={'account':_0x176985,'message':_0x2a1ed3[_0xf48f('0x46')]};return;})[_0xf48f('0x13')](function(){if(_0x5851fa[_0xf48f('0x4e')]){if(_0x5851fa[_0xf48f('0x4e')][_0xf48f('0x59')][_0xf48f('0x38')]){return _0x5851fa[_0xf48f('0x4e')][_0xf48f('0x59')][0x0];}else{return db['CmContact'][_0xf48f('0x5a')](_['defaults'](_0x2a1ed3['body'],{'firstName':_0x2a1ed3[_0xf48f('0x46')]['to'],'email':_0x2a1ed3[_0xf48f('0x46')]['to'],'phone':_0x2a1ed3[_0xf48f('0x46')]['to'],'ListId':_0x5851fa[_0xf48f('0x5b')]}));}}else{throw new Error(_0xf48f('0x5c'));}})[_0xf48f('0x13')](function(){if(_0x1b4c46){return respondWithRpcPromise(_0xf48f('0x5d'),_0xf48f('0x5e'),_0x1b4c46,client9003)[_0xf48f('0x13')](function(_0x26b560){return _0xde6431[_0xf48f('0x5f')]({'read':!![],'messageId':_0x26b560[_0xf48f('0x60')],'sentAt':moment()[_0xf48f('0x61')](_0xf48f('0x62'))});})[_0xf48f('0x1c')](function(_0xf429eb){logger[_0xf48f('0x19')]('%s',JSON[_0xf48f('0x18')](_0xf429eb));return _0xde6431;});}return _0xde6431;});}return _0xde6431;}})[_0xf48f('0x13')](respondWithResult(_0x2b34f5,0xc9))[_0xf48f('0x1c')](handleError(_0x2b34f5,null));};exports[_0xf48f('0x63')]=function(_0x11306b,_0x5a79bc){var _0x2b5577={'agent':{},'channel':_0xf48f('0x64')};if(_0x11306b['body']['id']){delete _0x11306b[_0xf48f('0x46')]['id'];}_0x11306b[_0xf48f('0x46')][_0xf48f('0x65')]=!![];_0x11306b[_0xf48f('0x46')][_0xf48f('0x66')]=moment()[_0xf48f('0x61')](_0xf48f('0x62'));_0x11306b['body']['UserId']=_0x11306b['body'][_0xf48f('0x67')]||_0x11306b[_0xf48f('0x68')]['id'];_0x2b5577[_0xf48f('0x69')]['id']=_0x11306b[_0xf48f('0x46')][_0xf48f('0x67')];return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x11306b[_0xf48f('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a79bc,null))['then'](saveUpdates(_0x11306b[_0xf48f('0x46')],null))[_0xf48f('0x13')](function(_0x2f6cf9){if(_0x2f6cf9){_0x2b5577['message']=_0x2f6cf9[_0xf48f('0x6a')]({'plain':!![]});return db[_0xf48f('0x6b')]['find']({'where':{'id':_0x2f6cf9[_0xf48f('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x5a79bc,null))[_0xf48f('0x13')](function(_0x2f5cb5){if(_0x2f5cb5){return _0x2f5cb5[_0xf48f('0x5f')]({'UserId':_0x11306b['body']['UserId'],'read1stAt':_[_0xf48f('0x6d')](_0x2f5cb5[_0xf48f('0x6e')])?moment()[_0xf48f('0x61')](_0xf48f('0x62')):undefined});}return null;})['then'](function(_0x596f9b){if(_0x596f9b){_0x2b5577[_0xf48f('0x6f')]=_0x596f9b[_0xf48f('0x6a')]({'plain':!![]});interaction_log['info'](_0xf48f('0x70'),_0x11306b[_0xf48f('0x68')]['id'],_0x11306b[_0xf48f('0x68')]['name'],_0x11306b[_0xf48f('0x68')]['role'],_0x2b5577[_0xf48f('0x6f')]['id'],_0x11306b['body']?JSON[_0xf48f('0x18')](_0x11306b['body']):'null');return respondWithRpcPromise(_0xf48f('0x71'),_0xf48f('0x72'),_0x2b5577);}return null;})['then'](function(_0x385537){var _0xca65dd=_0xf48f('0x73')+_0x385537[_0xf48f('0x1b')]['ContactId'];return db[_0xf48f('0x74')][_0xf48f('0x32')](_0xca65dd,{'type':db[_0xf48f('0x75')][_0xf48f('0x76')][_0xf48f('0x77')],'raw':!![]})['then'](function(_0x377d41){return _0x377d41;});})[_0xf48f('0x13')](function(_0x359928){if(_0x359928){_0x2b5577['message']['contact']=_0x359928[0x0];if(!_0x11306b['body']['UserId'])return;return db[_0xf48f('0x78')][_0xf48f('0x47')]({'where':{'id':_0x11306b['body'][_0xf48f('0x67')],'role':'agent'},'attributes':['id','name',_0xf48f('0x79'),_0xf48f('0x7a'),_0xf48f('0x7b')],'raw':!![]});}return null;})[_0xf48f('0x13')](function(_0x4161d9){if(!_0x4161d9)return null;_0x2b5577['message']['agent']=_0x4161d9;return _0x2b5577;})[_0xf48f('0x13')](function(_0x58f0fe){if(_0x58f0fe){if(_0x11306b[_0xf48f('0x46')][_0xf48f('0x7c')]){_0x2b5577['message'][_0xf48f('0x7d')]=util['format'](_0xf48f('0x7e'),_0x11306b['user'][_0xf48f('0x29')]);_0x2b5577['message'][_0xf48f('0x7f')]=_0x2b5577['channel'];_0x2b5577[_0xf48f('0x1b')][_0xf48f('0x80')]=_0x2b5577[_0xf48f('0x7f')];_0x2b5577['message']['event']=_0xf48f('0x63');_0x2b5577[_0xf48f('0x1b')][_0xf48f('0x46')]=htmlToText[_0xf48f('0x81')](_0x2b5577[_0xf48f('0x1b')][_0xf48f('0x46')]);return respondWithRpcPromise(_0xf48f('0x82'),_0xf48f('0x82'),{'event':'acceptmessage','message':_0x2b5577[_0xf48f('0x1b')]},client9002)['then'](function(){return _0x2b5577;});}return _0x2b5577;}return null;})[_0xf48f('0x13')](respondWithResult(_0x5a79bc,null))['catch'](handleError(_0x5a79bc,null));};exports[_0xf48f('0x83')]=function(_0x2656da,_0x3f04ee){var _0x1b3392={'agent':{},'channel':_0xf48f('0x64')};if(_0x2656da[_0xf48f('0x46')]['id']){delete _0x2656da[_0xf48f('0x46')]['id'];}_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')]=_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')]||_0x2656da[_0xf48f('0x68')]['id'];_0x1b3392[_0xf48f('0x69')]['id']=_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')];return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x2656da['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f04ee,null))[_0xf48f('0x13')](function(_0xc076cd){if(_0xc076cd){_0x1b3392[_0xf48f('0x1b')]=_0xc076cd[_0xf48f('0x6a')]({'plain':!![]});return db['MailInteraction'][_0xf48f('0x47')]({'where':{'id':_0xc076cd[_0xf48f('0x6c')]}});}return null;})[_0xf48f('0x13')](handleEntityNotFound(_0x3f04ee,null))[_0xf48f('0x13')](function(_0x2a48d2){if(_0x2a48d2){_0x1b3392[_0xf48f('0x6f')]=_0x2a48d2['get']({'plain':!![]});interaction_log[_0xf48f('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2656da[_0xf48f('0x68')]['id'],_0x2656da[_0xf48f('0x68')][_0xf48f('0x29')],_0x2656da['user'][_0xf48f('0x84')],_0x1b3392[_0xf48f('0x6f')]['id'],_0x2656da[_0xf48f('0x46')]?JSON[_0xf48f('0x18')](_0x2656da[_0xf48f('0x46')]):_0xf48f('0x85'));return respondWithRpcPromise(_0xf48f('0x86'),_0xf48f('0x87'),_0x1b3392);}return null;})[_0xf48f('0x13')](function(_0x385a24){var _0x4d6288=_0xf48f('0x73')+_0x385a24['message'][_0xf48f('0x88')];return db[_0xf48f('0x74')][_0xf48f('0x32')](_0x4d6288,{'type':db[_0xf48f('0x75')][_0xf48f('0x76')][_0xf48f('0x77')],'raw':!![]})['then'](function(_0x195dc2){return _0x195dc2;});})[_0xf48f('0x13')](function(_0x5a2920){if(_0x5a2920){_0x1b3392[_0xf48f('0x1b')][_0xf48f('0x89')]=_0x5a2920[0x0];if(!_0x2656da[_0xf48f('0x46')][_0xf48f('0x67')])return;return db['User']['find']({'where':{'id':_0x2656da['body'][_0xf48f('0x67')],'role':_0xf48f('0x69')},'attributes':['id',_0xf48f('0x29'),_0xf48f('0x79'),_0xf48f('0x7a'),_0xf48f('0x7b')],'raw':!![]});}return null;})[_0xf48f('0x13')](function(_0x1d2156){if(!_0x1d2156)return null;_0x1b3392[_0xf48f('0x1b')][_0xf48f('0x69')]=_0x1d2156;return _0x1b3392;})['then'](function(_0xa47d91){if(_0xa47d91){_0xa47d91[_0xf48f('0x1b')]['interface']=util[_0xf48f('0x61')](_0xf48f('0x7e'),_0x2656da['user'][_0xf48f('0x29')]);_0xa47d91[_0xf48f('0x1b')]['channel']=_0x1b3392['channel'];_0xa47d91['message'][_0xf48f('0x80')]=_0x1b3392[_0xf48f('0x7f')];_0xa47d91['message']['event']='reject';_0xa47d91['message']['body']=htmlToText['fromString'](_0x1b3392[_0xf48f('0x1b')]['body']);respondWithRpcPromise(_0xf48f('0x82'),_0xf48f('0x82'),{'event':_0xf48f('0x8a'),'message':_0xa47d91['message']},client9002);return _0x1b3392;}return null;})[_0xf48f('0x13')](respondWithResult(_0x3f04ee,null))['catch'](handleError(_0x3f04ee,null));};exports['download']=function(_0x13925e,_0x15ffde){var _0x4a280d=moment()[_0xf48f('0x8b')]()[_0xf48f('0x8c')]();var _0x1899cd=path[_0xf48f('0x55')](config['root'],'server',_0xf48f('0x8d'),_0xf48f('0x8e'));var _0x3fe04a=path[_0xf48f('0x55')](config['root'],_0xf48f('0x8f'),_0xf48f('0x8d'),_0xf48f('0x54'));var _0x2c86e7=util[_0xf48f('0x61')](_0xf48f('0x90'),_0x4a280d);return db[_0xf48f('0x2d')][_0xf48f('0x47')]({'where':{'id':_0x13925e['params']['id']},'attributes':['id','body',_0xf48f('0x91'),'to','cc',_0xf48f('0x92'),'subject','createdAt'],'include':_0x13925e['query'][_0xf48f('0x54')]?[{'model':db[_0xf48f('0x93')],'as':'Attachments'}]:undefined})[_0xf48f('0x13')](handleEntityNotFound(_0x15ffde,null))[_0xf48f('0x13')](function(_0x454301){if(_0x454301){var _0x8fecd1=_0x454301;var _0x3711bb={'from':_0x8fecd1[_0xf48f('0x91')],'to':_0x8fecd1['to'],'subject':_0x8fecd1['subject'],'html':htmlEntities[_0xf48f('0x94')](_0x8fecd1[_0xf48f('0x46')]),'headers':{'Date':moment(_0x8fecd1['createdAt'])['format'](_0xf48f('0x95'))},'attachments':[]};if(_0x454301['cc']){_0x3711bb[_0xf48f('0x96')]['Cc']=_0x454301['cc'];}if(_0x454301['bcc']){_0x3711bb[_0xf48f('0x96')][_0xf48f('0x97')]=_0x454301['bcc'];}return new BPromise(function(_0x1ba0bf,_0x59f198){if(_0x454301['Attachments']){for(var _0x34bcad=0x0;_0x34bcad<_0x454301[_0xf48f('0x98')][_0xf48f('0x38')];_0x34bcad++){var _0x1a51d4=_0x454301[_0xf48f('0x98')][_0x34bcad];var _0x58bbf5=path[_0xf48f('0x55')](_0x3fe04a,_0x1a51d4[_0xf48f('0x58')]);if(fs[_0xf48f('0x99')](_0x58bbf5)){_0x3711bb[_0xf48f('0x54')][_0xf48f('0x9a')]({'name':_0x1a51d4['name'],'contentType':_0x1a51d4['type'],'data':fs[_0xf48f('0x9b')](_0x58bbf5)});}}}emlformat[_0xf48f('0x9c')](_0x3711bb,function(_0x50f2cb,_0xb0cc1f){if(_0x50f2cb)return _0x59f198(_0x50f2cb);fs[_0xf48f('0x9d')](path[_0xf48f('0x55')](_0x1899cd,_0x2c86e7),_0xb0cc1f);return _0x1ba0bf(_0xb0cc1f);});});}})[_0xf48f('0x13')](function(_0x534afc){if(_0x534afc){return _0x15ffde[_0xf48f('0x9e')](path[_0xf48f('0x55')](_0x1899cd,_0x2c86e7),_0x2c86e7,function(_0x427124){if(!_0x427124)fs['unlinkSync'](path[_0xf48f('0x55')](_0x1899cd,_0x2c86e7));});}})[_0xf48f('0x1c')](handleError(_0x15ffde,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8536ab2..13b7ff5 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 _0x216c=['../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x1bc17c,_0x1328af){var _0xe44ae5=function(_0x3d24cb){while(--_0x3d24cb){_0x1bc17c['push'](_0x1bc17c['shift']());}};_0xe44ae5(++_0x1328af);}(_0x216c,0x14a));var _0xc216=function(_0xa619e0,_0xfe225d){_0xa619e0=_0xa619e0-0x0;var _0x2338d3=_0x216c[_0xa619e0];return _0x2338d3;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xc216('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc216('0x1')](0x0);var events={'afterCreate':_0xc216('0x2'),'afterUpdate':_0xc216('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4caaff){return function(_0x2a15b3,_0x42cbba,_0xf0bb2c){MailMessageEvents[_0xc216('0x4')](_0x4caaff+':'+_0x2a15b3['id'],_0x2a15b3);MailMessageEvents['emit'](_0x4caaff,_0x2a15b3);_0xf0bb2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xc216('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x8571=['events','../../mysqldb','MailMessage','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xd1af8a,_0x2cb96f){var _0x3080fc=function(_0x83f0d8){while(--_0x83f0d8){_0xd1af8a['push'](_0xd1af8a['shift']());}};_0x3080fc(++_0x2cb96f);}(_0x8571,0x1dd));var _0x1857=function(_0x38bbfa,_0x5b0957){_0x38bbfa=_0x38bbfa-0x0;var _0x179f34=_0x8571[_0x38bbfa];return _0x179f34;};'use strict';var EventEmitter=require(_0x1857('0x0'));var MailMessage=require(_0x1857('0x1'))['db'][_0x1857('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1857('0x3'),'afterUpdate':_0x1857('0x4'),'afterDestroy':'remove'};function emitEvent(_0x163d97){return function(_0x466c4c,_0x214727,_0x331da2){MailMessageEvents[_0x1857('0x5')](_0x163d97+':'+_0x466c4c['id'],_0x466c4c);MailMessageEvents['emit'](_0x163d97,_0x466c4c);_0x331da2(null);};}for(var e in events){if(events[_0x1857('0x6')](e)){var event=events[e];MailMessage[_0x1857('0x7')](e,emitEvent(event));}}module[_0x1857('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 7244599..4fbdfc7 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 _0x7a92=['MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a92,0x157));var _0x27a9=function(_0x1b8fda,_0x18b995){_0x1b8fda=_0x1b8fda-0x0;var _0x2701e0=_0x7a92[_0x1b8fda];return _0x2701e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27a9('0x0'))(_0x27a9('0x1'));var moment=require(_0x27a9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x27a9('0x3'));var rimraf=require(_0x27a9('0x4'));var config=require(_0x27a9('0x5'));var attributes=require(_0x27a9('0x6'));module[_0x27a9('0x7')]=function(_0x532291,_0x4a5f8e){return _0x532291[_0x27a9('0x8')](_0x27a9('0x9'),attributes,{'tableName':_0x27a9('0xa'),'paranoid':![],'indexes':[{'name':_0x27a9('0xb'),'fields':[_0x27a9('0xb')]},{'name':'fti_mail_messages','fields':[_0x27a9('0xc'),_0x27a9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45cc84,_0x53e328,_0xe37f44){if(_0x45cc84[_0x27a9('0xe')]){_0x45cc84[_0x27a9('0xc')]=htmlToText[_0x27a9('0xf')](_0x45cc84[_0x27a9('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xe37f44(null,_0x53e328);},'afterCreate':function(_0x372d2e,_0x1ee072,_0x5ce6fa){var _0x3038ec=_0x532291[_0x27a9('0x10')];var _0x55f90a=_0x372d2e['get']({'plain':!![]});if(_0x55f90a['direction'][_0x27a9('0x11')]()==='in'||_0x55f90a[_0x27a9('0x12')][_0x27a9('0x11')]()===_0x27a9('0x13')&&!_0x55f90a[_0x27a9('0x14')]&&!_[_0x27a9('0x15')](_0x55f90a[_0x27a9('0x16')])){_0x3038ec[_0x27a9('0x17')][_0x27a9('0x18')]({'where':{'id':_0x55f90a[_0x27a9('0x19')]}})[_0x27a9('0x1a')](function(_0x1092ba){if(_0x1092ba){_0x1092ba[_0x27a9('0x1b')]({'lastMsgAt':_0x55f90a['createdAt'],'lastMsgDirection':_0x55f90a[_0x27a9('0x12')][_0x27a9('0x11')]()});}})[_0x27a9('0x1c')](function(_0x72ae37){console[_0x27a9('0x1d')](_0x72ae37);});}_0x5ce6fa();}},'charset':_0x27a9('0x1e'),'collate':_0x27a9('0x1f')});}; \ No newline at end of file +var _0x2c76=['MailInteraction','findOne','MailInteractionId','then','createdAt','direction','toLowerCase','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','body','models','get','out','isNil','UserId'];(function(_0x357e43,_0x3769a2){var _0xf0aa1c=function(_0xce71ae){while(--_0xce71ae){_0x357e43['push'](_0x357e43['shift']());}};_0xf0aa1c(++_0x3769a2);}(_0x2c76,0xe3));var _0x62c7=function(_0x3ac65e,_0x42bc09){_0x3ac65e=_0x3ac65e-0x0;var _0x139827=_0x2c76[_0x3ac65e];return _0x139827;};'use strict';var _=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var logger=require('../../config/logger')(_0x62c7('0x2'));var moment=require(_0x62c7('0x3'));var BPromise=require(_0x62c7('0x4'));var rp=require(_0x62c7('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62c7('0x6'));module[_0x62c7('0x7')]=function(_0x2dd55a,_0x11b06e){return _0x2dd55a['define']('MailMessage',attributes,{'tableName':_0x62c7('0x8'),'paranoid':![],'indexes':[{'name':_0x62c7('0x9'),'fields':[_0x62c7('0x9')]},{'name':_0x62c7('0xa'),'fields':['plainBody',_0x62c7('0xb')],'type':_0x62c7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48127c,_0x100fb2,_0x220454){if(_0x48127c['body']){_0x48127c[_0x62c7('0xd')]=htmlToText[_0x62c7('0xe')](_0x48127c[_0x62c7('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x220454(null,_0x100fb2);},'afterCreate':function(_0x132f89,_0x1e64e2,_0x309d31){var _0x5760f8=_0x2dd55a[_0x62c7('0x10')];var _0x51461c=_0x132f89[_0x62c7('0x11')]({'plain':!![]});if(_0x51461c['direction']['toLowerCase']()==='in'||_0x51461c['direction']['toLowerCase']()===_0x62c7('0x12')&&!_0x51461c['secret']&&!_[_0x62c7('0x13')](_0x51461c[_0x62c7('0x14')])){_0x5760f8[_0x62c7('0x15')][_0x62c7('0x16')]({'where':{'id':_0x51461c[_0x62c7('0x17')]}})[_0x62c7('0x18')](function(_0x2cb6d3){if(_0x2cb6d3){_0x2cb6d3['update']({'lastMsgAt':_0x51461c[_0x62c7('0x19')],'lastMsgDirection':_0x51461c[_0x62c7('0x1a')][_0x62c7('0x1b')]()});}})[_0x62c7('0x1c')](function(_0x5369d5){console[_0x62c7('0x1d')](_0x5369d5);});}_0x309d31();}},'charset':_0x62c7('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f18978a..0582498 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 _0x8952=['error','message','MailMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','stringify','code'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8952,0x17e));var _0x2895=function(_0x155205,_0x6a65da){_0x155205=_0x155205-0x0;var _0x351d52=_0x8952[_0x155205];return _0x351d52;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2895('0xb')],{'host':_0x2895('0xc'),'port':0x18eb});var socket=require(_0x2895('0xd'))(new Redis(config[_0x2895('0xb')]));require(_0x2895('0xe'))['register'](socket);function respondWithRpcPromise(_0x14fb67,_0x5f2632,_0x428772){return new BPromise(function(_0x5af454,_0x5e66fc){return client['request'](_0x14fb67,_0x428772)[_0x2895('0xf')](function(_0x1829a2){logger[_0x2895('0x10')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'));logger[_0x2895('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'),JSON[_0x2895('0x13')](_0x1829a2));if(_0x1829a2['error']){if(_0x1829a2['error'][_0x2895('0x14')]===0x1f4){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5e66fc(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5af454(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}else{logger[_0x2895('0x10')](_0x2895('0x17'),_0x5f2632,_0x2895('0x11'));_0x5af454(_0x1829a2[_0x2895('0x18')][_0x2895('0x16')]);}})[_0x2895('0x19')](function(_0x2fe8fe){logger[_0x2895('0x15')]('MailMessage,\x20%s,\x20%s',_0x5f2632,_0x2fe8fe);_0x5e66fc(_0x2fe8fe);});});}exports['CreateMailMessage']=function(_0x493851){var _0x442cfa=this;return new Promise(function(_0x12c2fb,_0x3ec4da){return db['MailMessage'][_0x2895('0x1a')](_0x493851[_0x2895('0x1b')],{'raw':_0x493851[_0x2895('0x1c')]?_0x493851[_0x2895('0x1c')][_0x2895('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x30c6c3){logger[_0x2895('0x10')]('CreateMailMessage',_0x493851);logger[_0x2895('0x12')](_0x2895('0x1e'),_0x493851,JSON[_0x2895('0x13')](_0x30c6c3));_0x12c2fb(_0x30c6c3);})['catch'](function(_0x4e884f){logger[_0x2895('0x15')](_0x2895('0x1e'),_0x4e884f[_0x2895('0x16')],_0x493851);_0x3ec4da(_0x442cfa['error'](0x1f4,_0x4e884f[_0x2895('0x16')]));});});}; \ No newline at end of file +var _0xb78e=['http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x123874,_0x3b9ed3){var _0x3f552e=function(_0x3cd52f){while(--_0x3cd52f){_0x123874['push'](_0x123874['shift']());}};_0x3f552e(++_0x3b9ed3);}(_0xb78e,0x1c9));var _0xeb78=function(_0x164512,_0x4dd65f){_0x164512=_0x164512-0x0;var _0x19255e=_0xb78e[_0x164512];return _0x19255e;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});config[_0xeb78('0xc')]=_[_0xeb78('0xd')](config[_0xeb78('0xc')],{'host':_0xeb78('0xe'),'port':0x18eb});var socket=require(_0xeb78('0xf'))(new Redis(config['redis']));require(_0xeb78('0x10'))[_0xeb78('0x11')](socket);function respondWithRpcPromise(_0xa1ca82,_0x46fbad,_0x125e97){return new BPromise(function(_0x402680,_0x15137b){return client[_0xeb78('0x12')](_0xa1ca82,_0x125e97)[_0xeb78('0x13')](function(_0x59d8d8){logger[_0xeb78('0x14')](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));logger[_0xeb78('0x17')](_0xeb78('0x18'),_0x46fbad,_0xeb78('0x16'),JSON[_0xeb78('0x19')](_0x59d8d8));if(_0x59d8d8[_0xeb78('0x1a')]){if(_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1b')]===0x1f4){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x59d8d8[_0xeb78('0x1a')]['message']);return _0x15137b(_0x59d8d8['error']['message']);}logger[_0xeb78('0x1a')]('MailMessage,\x20%s,\x20%s',_0x46fbad,_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1c')]);return _0x402680(_0x59d8d8['error'][_0xeb78('0x1c')]);}else{logger['info'](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));_0x402680(_0x59d8d8['result'][_0xeb78('0x1c')]);}})[_0xeb78('0x1d')](function(_0x1cb338){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x1cb338);_0x15137b(_0x1cb338);});});}exports[_0xeb78('0x1e')]=function(_0x4ab933){var _0x48b106=this;return new Promise(function(_0x455e30,_0x106c5d){return db[_0xeb78('0x1f')][_0xeb78('0x20')](_0x4ab933[_0xeb78('0x21')],{'raw':_0x4ab933[_0xeb78('0x22')]?_0x4ab933[_0xeb78('0x22')][_0xeb78('0x23')]===undefined?!![]:![]:!![]})[_0xeb78('0x13')](function(_0x52b8c1){logger['info']('CreateMailMessage',_0x4ab933);logger['debug'](_0xeb78('0x1e'),_0x4ab933,JSON['stringify'](_0x52b8c1));_0x455e30(_0x52b8c1);})[_0xeb78('0x1d')](function(_0x1fbf2f){logger['error'](_0xeb78('0x1e'),_0x1fbf2f['message'],_0x4ab933);_0x106c5d(_0x48b106[_0xeb78('0x1a')](0x1f4,_0x1fbf2f[_0xeb78('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7fc9ec9..2cf9c94 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 _0xe08a=['length','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x41e585,_0x47c6b0){var _0x503c68=function(_0x3ef36e){while(--_0x3ef36e){_0x41e585['push'](_0x41e585['shift']());}};_0x503c68(++_0x47c6b0);}(_0xe08a,0x1d9));var _0xae08=function(_0x52a7e2,_0x50acd8){_0x52a7e2=_0x52a7e2-0x0;var _0x1be89f=_0xe08a[_0x52a7e2];return _0x1be89f;};'use strict';var MailMessageEvents=require(_0xae08('0x0'));var events=[_0xae08('0x1'),_0xae08('0x2'),_0xae08('0x3')];function createListener(_0x42a091,_0x22cea1){return function(_0x4e68ae){_0x22cea1[_0xae08('0x4')](_0x42a091,_0x4e68ae);};}function removeListener(_0x15d7ce,_0x1ad1d2){return function(){MailMessageEvents[_0xae08('0x5')](_0x15d7ce,_0x1ad1d2);};}exports[_0xae08('0x6')]=function(_0x32868e){for(var _0x320a41=0x0,_0x5218a3=events[_0xae08('0x7')];_0x320a41<_0x5218a3;_0x320a41++){var _0x4ac819=events[_0x320a41];var _0x2214f7=createListener('mailMessage:'+_0x4ac819,_0x32868e);MailMessageEvents['on'](_0x4ac819,_0x2214f7);}}; \ No newline at end of file +var _0x2c92=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x378909,_0x54613d){var _0x6395c5=function(_0x2c8c93){while(--_0x2c8c93){_0x378909['push'](_0x378909['shift']());}};_0x6395c5(++_0x54613d);}(_0x2c92,0x16e));var _0x22c9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x2c92[_0x5774be];return _0x4914b4;};'use strict';var MailMessageEvents=require(_0x22c9('0x0'));var events=[_0x22c9('0x1'),_0x22c9('0x2'),_0x22c9('0x3')];function createListener(_0xd4c1b6,_0x5ad125){return function(_0x45e248){_0x5ad125[_0x22c9('0x4')](_0xd4c1b6,_0x45e248);};}function removeListener(_0x2bb36d,_0x1e0bcd){return function(){MailMessageEvents[_0x22c9('0x5')](_0x2bb36d,_0x1e0bcd);};}exports[_0x22c9('0x6')]=function(_0x447b85){for(var _0x431473=0x0,_0x5ddd34=events[_0x22c9('0x7')];_0x431473<_0x5ddd34;_0x431473++){var _0x5e9d74=events[_0x431473];var _0x51389b=createListener(_0x22c9('0x8')+_0x5e9d74,_0x447b85);MailMessageEvents['on'](_0x5e9d74,_0x51389b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index eea1f32..1e4c5fb 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 _0x1682=['create','addAgents','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x1e1026,_0x549bfd){var _0x3dfd47=function(_0x26c52f){while(--_0x26c52f){_0x1e1026['push'](_0x1e1026['shift']());}};_0x3dfd47(++_0x549bfd);}(_0x1682,0x15d));var _0x2168=function(_0x3826a4,_0x245bfd){_0x3826a4=_0x3826a4-0x0;var _0x479acc=_0x1682[_0x3826a4];return _0x479acc;};'use strict';var multer=require(_0x2168('0x0'));var util=require(_0x2168('0x1'));var path=require(_0x2168('0x2'));var timeout=require('connect-timeout');var express=require(_0x2168('0x3'));var router=express[_0x2168('0x4')]();var fs_extra=require(_0x2168('0x5'));var auth=require(_0x2168('0x6'));var interaction=require(_0x2168('0x7'));var config=require(_0x2168('0x8'));var controller=require(_0x2168('0x9'));router[_0x2168('0xa')]('/',auth[_0x2168('0xb')](),controller[_0x2168('0xc')]);router[_0x2168('0xa')](_0x2168('0xd'),auth['isAuthenticated'](),controller[_0x2168('0xe')]);router[_0x2168('0xa')](_0x2168('0xf'),auth[_0x2168('0xb')](),controller[_0x2168('0x10')]);router[_0x2168('0xa')](_0x2168('0x11'),auth[_0x2168('0xb')](),controller[_0x2168('0x12')]);router['get'](_0x2168('0x13'),auth[_0x2168('0xb')](),controller[_0x2168('0x14')]);router[_0x2168('0xa')](_0x2168('0x15'),auth[_0x2168('0xb')](),controller['getAgents']);router[_0x2168('0x16')]('/',auth['isAuthenticated'](),controller[_0x2168('0x17')]);router[_0x2168('0x16')](_0x2168('0x13'),auth[_0x2168('0xb')](),controller['addTeams']);router[_0x2168('0x16')](_0x2168('0x15'),auth[_0x2168('0xb')](),controller[_0x2168('0x18')]);router['put'](_0x2168('0xf'),auth['isAuthenticated'](),controller[_0x2168('0x19')]);router['delete']('/:id',auth[_0x2168('0xb')](),controller[_0x2168('0x1a')]);router['delete']('/:id/teams',auth[_0x2168('0xb')](),controller[_0x2168('0x1b')]);router[_0x2168('0x1c')](_0x2168('0x15'),auth[_0x2168('0xb')](),controller[_0x2168('0x1d')]);module[_0x2168('0x1e')]=router; \ No newline at end of file +var _0x3dbf=['getAgents','create','addTeams','post','addAgents','put','delete','destroy','/:id/teams','removeTeams','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/users'];(function(_0x36072d,_0x24f414){var _0x32a52c=function(_0x19834c){while(--_0x19834c){_0x36072d['push'](_0x36072d['shift']());}};_0x32a52c(++_0x24f414);}(_0x3dbf,0x1e6));var _0xf3db=function(_0x3027c2,_0x2ee658){_0x3027c2=_0x3027c2-0x0;var _0x5af63c=_0x3dbf[_0x3027c2];return _0x5af63c;};'use strict';var multer=require('multer');var util=require(_0xf3db('0x0'));var path=require(_0xf3db('0x1'));var timeout=require(_0xf3db('0x2'));var express=require(_0xf3db('0x3'));var router=express['Router']();var fs_extra=require(_0xf3db('0x4'));var auth=require(_0xf3db('0x5'));var interaction=require(_0xf3db('0x6'));var config=require(_0xf3db('0x7'));var controller=require(_0xf3db('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf3db('0x9')]);router[_0xf3db('0xa')](_0xf3db('0xb'),auth['isAuthenticated'](),controller[_0xf3db('0xc')]);router[_0xf3db('0xa')](_0xf3db('0xd'),auth[_0xf3db('0xe')](),controller[_0xf3db('0xf')]);router[_0xf3db('0xa')](_0xf3db('0x10'),auth[_0xf3db('0xe')](),controller['getMembers']);router[_0xf3db('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xf3db('0x11'),auth[_0xf3db('0xe')](),controller[_0xf3db('0x12')]);router['post']('/',auth[_0xf3db('0xe')](),controller[_0xf3db('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xf3db('0x14')]);router[_0xf3db('0x15')](_0xf3db('0x11'),auth[_0xf3db('0xe')](),controller[_0xf3db('0x16')]);router[_0xf3db('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf3db('0x18')](_0xf3db('0xd'),auth['isAuthenticated'](),controller[_0xf3db('0x19')]);router[_0xf3db('0x18')](_0xf3db('0x1a'),auth[_0xf3db('0xe')](),controller[_0xf3db('0x1b')]);router[_0xf3db('0x18')](_0xf3db('0x11'),auth[_0xf3db('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2006551..b0cc367 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 _0x6868=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x6868,0x19f));var _0x8686=function(_0x3e0a69,_0x6f6fe1){_0x3e0a69=_0x3e0a69-0x0;var _0x21383c=_0x6868[_0x3e0a69];return _0x21383c;};'use strict';var Sequelize=require(_0x8686('0x0'));module[_0x8686('0x1')]={'name':{'type':Sequelize[_0x8686('0x2')],'unique':_0x8686('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8686('0x2')]},'timeout':{'type':Sequelize[_0x8686('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8686('0x5')](_0x8686('0x6'),_0x8686('0x7'),_0x8686('0x8'))}}; \ No newline at end of file +var _0x9e47=['sequelize','exports','STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x42e587,_0x5cffa7){var _0x3a7996=function(_0xf02b56){while(--_0xf02b56){_0x42e587['push'](_0x42e587['shift']());}};_0x3a7996(++_0x5cffa7);}(_0x9e47,0x118));var _0x79e4=function(_0x4bc3cd,_0x1aaf64){_0x4bc3cd=_0x4bc3cd-0x0;var _0x1ddb7e=_0x9e47[_0x4bc3cd];return _0x1ddb7e;};'use strict';var Sequelize=require(_0x79e4('0x0'));module[_0x79e4('0x1')]={'name':{'type':Sequelize[_0x79e4('0x2')],'unique':_0x79e4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79e4('0x2')]},'timeout':{'type':Sequelize[_0x79e4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x79e4('0x5'),'beepall',_0x79e4('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5326c89..248afca 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 _0xc0bf=['type','getOptions','where','findAll','catch','model','keys','query','filters','attributes','intersection','fields','length','include','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','filter','User','UserId','agent','mailPause','updatedAt','rows','format','createdAt','getTeams','pick','merge','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','removeTeams','ids','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','sequelize','every','TeamId','includes','all','compact','value','isEmpty','userMailQueue:remove','addAgents','spread','emit','userMailQueue:save','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName'];(function(_0x4e7795,_0x58d5c5){var _0x474dcb=function(_0x18f166){while(--_0x18f166){_0x4e7795['push'](_0x4e7795['shift']());}};_0x474dcb(++_0x58d5c5);}(_0xc0bf,0x1b3));var _0xfc0b=function(_0x117050,_0x8457d9){_0x117050=_0x117050-0x0;var _0x19f6fa=_0xc0bf[_0x117050];return _0x19f6fa;};'use strict';var BPromise=require(_0xfc0b('0x0'));var util=require(_0xfc0b('0x1'));var _=require(_0xfc0b('0x2'));var squel=require(_0xfc0b('0x3'));var Redis=require('ioredis');var qs=require(_0xfc0b('0x4'));var logger=require(_0xfc0b('0x5'))(_0xfc0b('0x6'));var config=require('../../config/environment');var db=require(_0xfc0b('0x7'))['db'];config[_0xfc0b('0x8')]=_[_0xfc0b('0x9')](config[_0xfc0b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc0b('0xa'))(new Redis(config['redis']));require(_0xfc0b('0xb'))[_0xfc0b('0xc')](socket);function respondWithStatusCode(_0x532b9f,_0x38eb37){_0x38eb37=_0x38eb37||0xcc;return function(_0x399812){if(_0x399812){return _0x532b9f[_0xfc0b('0xd')](_0x38eb37);}return _0x532b9f[_0xfc0b('0xe')](_0x38eb37)[_0xfc0b('0xf')]();};}function respondWithResult(_0xa4b86d,_0x55267e){_0x55267e=_0x55267e||0xc8;return function(_0x5df43f){if(_0x5df43f){return _0xa4b86d['status'](_0x55267e)[_0xfc0b('0x10')](_0x5df43f);}};}function respondWithFilteredResult(_0x4ef3bd,_0x1d6916){return function(_0x24b88f){if(_0x24b88f){var _0x53dcb4=typeof _0x1d6916[_0xfc0b('0x11')]===_0xfc0b('0x12')&&typeof _0x1d6916[_0xfc0b('0x13')]===_0xfc0b('0x12');var _0x50a0e9=_0x24b88f[_0xfc0b('0x14')];var _0x43ba8b=_0x53dcb4?0x0:_0x1d6916[_0xfc0b('0x11')];var _0x3af229=_0x53dcb4?_0x24b88f['count']:_0x1d6916[_0xfc0b('0x11')]+_0x1d6916['limit'];var _0x47c687;if(_0x3af229>=_0x50a0e9){_0x3af229=_0x50a0e9;_0x47c687=0xc8;}else{_0x47c687=0xce;}_0x4ef3bd[_0xfc0b('0xe')](_0x47c687);return _0x4ef3bd['set'](_0xfc0b('0x15'),_0x43ba8b+'-'+_0x3af229+'/'+_0x50a0e9)[_0xfc0b('0x10')](_0x24b88f);}return null;};}function saveUpdates(_0x1fa751){return function(_0x43d799){if(_0x43d799){return _0x43d799[_0xfc0b('0x16')](_0x1fa751)[_0xfc0b('0x17')](function(_0x2fd4e8){return _0x2fd4e8;});}return null;};}function removeEntity(_0x107167){return function(_0x162916){if(_0x162916){return _0x162916['destroy']()[_0xfc0b('0x17')](function(){var _0x2fb637=_0x162916[_0xfc0b('0x18')]({'plain':!![]});var _0x499932=_0xfc0b('0x19');return db[_0xfc0b('0x1a')][_0xfc0b('0x1b')]({'where':{'type':_0x499932,'resourceId':_0x2fb637['id']}})[_0xfc0b('0x17')](function(){return _0x162916;});})[_0xfc0b('0x17')](function(){_0x107167['status'](0xcc)[_0xfc0b('0xf')]();});}};}function handleEntityNotFound(_0x2ff3dd){return function(_0x8e52a2){if(!_0x8e52a2){_0x2ff3dd[_0xfc0b('0xd')](0x194);}return _0x8e52a2;};}function handleError(_0x5b952e,_0x4f3f8a){_0x4f3f8a=_0x4f3f8a||0x1f4;return function(_0x4efdae){logger[_0xfc0b('0x1c')](_0x4efdae[_0xfc0b('0x1d')]);if(_0x4efdae['name']){delete _0x4efdae[_0xfc0b('0x1e')];}_0x5b952e[_0xfc0b('0xe')](_0x4f3f8a)[_0xfc0b('0x1f')](_0x4efdae);};}exports[_0xfc0b('0x20')]=function(_0x273b0e,_0xc8b936){var _0x357c2b={};var _0x5964cd={'count':0x0,'rows':[]};var _0x1d9ac8=_[_0xfc0b('0x21')](db[_0xfc0b('0x22')][_0xfc0b('0x23')],function(_0x4458b9){return{'name':_0x4458b9[_0xfc0b('0x24')],'type':_0x4458b9[_0xfc0b('0x25')]['key']};});_0x357c2b=qs[_0xfc0b('0x26')](_0x1d9ac8,_0x273b0e);var _0x58cb93={'where':_0x357c2b[_0xfc0b('0x27')]};return db[_0xfc0b('0x22')][_0xfc0b('0x14')](_0x58cb93)[_0xfc0b('0x17')](function(_0x4de4df){_0x5964cd[_0xfc0b('0x14')]=_0x4de4df;_0x357c2b['include']=qs['include'](_0x273b0e['query']);return db[_0xfc0b('0x22')][_0xfc0b('0x28')](_0x357c2b);})[_0xfc0b('0x17')](function(_0x5a75fa){_0x5964cd['rows']=_0x5a75fa;return _0x5964cd;})[_0xfc0b('0x17')](respondWithFilteredResult(_0xc8b936,_0x357c2b))[_0xfc0b('0x29')](handleError(_0xc8b936,null));};exports['show']=function(_0x306ce1,_0x2c56e5){var _0x3252fc={'raw':!![],'where':{'id':_0x306ce1['params']['id']}},_0x37043b={};_0x37043b[_0xfc0b('0x2a')]=_[_0xfc0b('0x2b')](db[_0xfc0b('0x22')][_0xfc0b('0x23')]);_0x37043b['query']=_['keys'](_0x306ce1[_0xfc0b('0x2c')]);_0x37043b[_0xfc0b('0x2d')]=_['intersection'](_0x37043b['model'],_0x37043b[_0xfc0b('0x2c')]);_0x3252fc[_0xfc0b('0x2e')]=_[_0xfc0b('0x2f')](_0x37043b[_0xfc0b('0x2a')],qs['fields'](_0x306ce1['query'][_0xfc0b('0x30')]));_0x3252fc[_0xfc0b('0x2e')]=_0x3252fc['attributes'][_0xfc0b('0x31')]?_0x3252fc[_0xfc0b('0x2e')]:_0x37043b[_0xfc0b('0x2a')];if(_0x306ce1[_0xfc0b('0x2c')]['includeAll']){_0x3252fc[_0xfc0b('0x32')]=[{'all':!![]}];}_0x3252fc=_['merge']({},_0x3252fc,_0x306ce1[_0xfc0b('0x33')]);return db[_0xfc0b('0x22')]['find'](_0x3252fc)[_0xfc0b('0x17')](handleEntityNotFound(_0x2c56e5,null))[_0xfc0b('0x17')](respondWithResult(_0x2c56e5,null))[_0xfc0b('0x29')](handleError(_0x2c56e5,null));};exports[_0xfc0b('0x34')]=function(_0x4994c0,_0x13f770){return db[_0xfc0b('0x22')][_0xfc0b('0x34')](_0x4994c0[_0xfc0b('0x35')],{})[_0xfc0b('0x17')](function(_0xe785d5){var _0x1d7481=_0x4994c0[_0xfc0b('0x36')][_0xfc0b('0x18')]({'plain':!![]});if(!_0x1d7481)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d7481[_0xfc0b('0x37')]===_0xfc0b('0x36')){var _0xec1ef5=_0xe785d5['get']({'plain':!![]});var _0x3d5675=_0xfc0b('0x19');return db[_0xfc0b('0x38')][_0xfc0b('0x39')]({'where':{'name':_0x3d5675,'userProfileId':_0x1d7481[_0xfc0b('0x3a')]},'raw':!![]})[_0xfc0b('0x17')](function(_0x575cb2){if(_0x575cb2&&_0x575cb2[_0xfc0b('0x3b')]===0x0){return db[_0xfc0b('0x1a')][_0xfc0b('0x34')]({'name':_0xec1ef5[_0xfc0b('0x1e')],'resourceId':_0xec1ef5['id'],'type':_0x575cb2[_0xfc0b('0x1e')],'sectionId':_0x575cb2['id']},{})[_0xfc0b('0x17')](function(){return _0xe785d5;});}else{return _0xe785d5;}})[_0xfc0b('0x29')](function(_0x1e46c7){logger[_0xfc0b('0x1c')](_0xfc0b('0x3c'),_0x1e46c7);throw _0x1e46c7;});}return _0xe785d5;})['then'](respondWithResult(_0x13f770,0xc9))[_0xfc0b('0x29')](handleError(_0x13f770,null));};exports['update']=function(_0x48f4a1,_0x2d5906){if(_0x48f4a1[_0xfc0b('0x35')]['id']){delete _0x48f4a1[_0xfc0b('0x35')]['id'];}return db[_0xfc0b('0x22')][_0xfc0b('0x39')]({'where':{'id':_0x48f4a1[_0xfc0b('0x3d')]['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x2d5906,null))['then'](saveUpdates(_0x48f4a1['body'],null))['then'](respondWithResult(_0x2d5906,null))[_0xfc0b('0x29')](handleError(_0x2d5906,null));};exports[_0xfc0b('0x1b')]=function(_0x26573f,_0x3adfd6){return db['MailQueue']['find']({'where':{'id':_0x26573f[_0xfc0b('0x3d')]['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x3adfd6,null))[_0xfc0b('0x17')](removeEntity(_0x3adfd6,null))[_0xfc0b('0x29')](handleError(_0x3adfd6,null));};exports[_0xfc0b('0x3e')]=function(_0x18b051,_0x2876ae){return db['MailQueue'][_0xfc0b('0x3e')]()[_0xfc0b('0x17')](respondWithResult(_0x2876ae,null))[_0xfc0b('0x29')](handleError(_0x2876ae,null));};exports['getMembers']=function(_0x3b9c2a,_0x4faf7e){var _0xf1a1e3={'raw':!![],'where':{}},_0x245062={},_0x4cecf8;return db['MailQueue'][_0xfc0b('0x3f')]({'where':{'id':_0x3b9c2a['params']['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x4faf7e,null))[_0xfc0b('0x17')](function(_0x2efbe2){if(_0x2efbe2){_0x4cecf8=_0x2efbe2[_0xfc0b('0x18')]({'plain':!![]});_0x245062[_0xfc0b('0x2a')]=_[_0xfc0b('0x2b')](db[_0xfc0b('0x40')][_0xfc0b('0x23')]);_0x245062[_0xfc0b('0x2c')]=_[_0xfc0b('0x2b')](_0x3b9c2a['query']);_0x245062[_0xfc0b('0x2d')]=_['intersection'](_0x245062[_0xfc0b('0x2a')],_0x245062[_0xfc0b('0x2c')]);_0xf1a1e3[_0xfc0b('0x2e')]=_[_0xfc0b('0x2f')](_0x245062[_0xfc0b('0x2a')],qs[_0xfc0b('0x30')](_0x3b9c2a[_0xfc0b('0x2c')][_0xfc0b('0x30')]));_0xf1a1e3[_0xfc0b('0x2e')]=_0xf1a1e3['attributes'][_0xfc0b('0x31')]?_0xf1a1e3['attributes']:_0x245062[_0xfc0b('0x2a')];if(!_0x3b9c2a['query'][_0xfc0b('0x41')](_0xfc0b('0x42'))){_0xf1a1e3[_0xfc0b('0x13')]=qs[_0xfc0b('0x13')](_0x3b9c2a[_0xfc0b('0x2c')][_0xfc0b('0x13')]);_0xf1a1e3['offset']=qs[_0xfc0b('0x11')](_0x3b9c2a[_0xfc0b('0x2c')]['offset']);}_0xf1a1e3[_0xfc0b('0x43')]=qs[_0xfc0b('0x44')](_0x3b9c2a[_0xfc0b('0x2c')][_0xfc0b('0x44')]);_0xf1a1e3[_0xfc0b('0x27')]=qs[_0xfc0b('0x2d')](_['pick'](_0x3b9c2a[_0xfc0b('0x2c')],_0x245062['filters']));_0xf1a1e3[_0xfc0b('0x27')]['MailQueueId']=_0x2efbe2['id'];if(_0x3b9c2a[_0xfc0b('0x2c')][_0xfc0b('0x45')]){_0xf1a1e3[_0xfc0b('0x27')]=_['merge'](_0xf1a1e3[_0xfc0b('0x27')],{'$or':_[_0xfc0b('0x21')](_0xf1a1e3[_0xfc0b('0x2e')],function(_0xdb261b){var _0x24534b={};_0x24534b[_0xdb261b]={'$like':'%'+_0x3b9c2a[_0xfc0b('0x2c')]['filter']+'%'};return _0x24534b;})});}_0xf1a1e3=_['merge']({},_0xf1a1e3,_0x3b9c2a[_0xfc0b('0x33')]);return db[_0xfc0b('0x40')][_0xfc0b('0x28')](_0xf1a1e3);}})[_0xfc0b('0x17')](function(_0x404445){if(_0x404445){return db[_0xfc0b('0x46')]['findAndCountAll']({'where':{'id':_[_0xfc0b('0x21')](_0x404445,_0xfc0b('0x47')),'role':_0xfc0b('0x48')},'attributes':['id',_0xfc0b('0x1e'),_0xfc0b('0x49'),_0xfc0b('0x4a'),'createdAt']});}})['then'](function(_0x18c31f){if(_0x18c31f){return{'count':_0x18c31f[_0xfc0b('0x14')],'rows':_[_0xfc0b('0x21')](_0x18c31f[_0xfc0b('0x4b')],function(_0x2d28a3){return{'membername':_0x2d28a3[_0xfc0b('0x1e')],'UserId':_0x2d28a3['id'],'queue_name':_0x4cecf8[_0xfc0b('0x1e')],'MailQueueId':_0x4cecf8['id'],'interface':util[_0xfc0b('0x4c')]('%s/%s','SIP',_0x2d28a3[_0xfc0b('0x1e')]),'penalty':0x0,'paused':_0x2d28a3[_0xfc0b('0x49')],'createdAt':_0x2d28a3[_0xfc0b('0x4d')],'updatedAt':_0x2d28a3[_0xfc0b('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4faf7e,_0xf1a1e3))[_0xfc0b('0x29')](handleError(_0x4faf7e,null));};exports[_0xfc0b('0x4e')]=function(_0x34ebca,_0x4573e5){var _0x16e480={};var _0x5ca7a2={};var _0x5cb48f;var _0x4f2924;return db['MailQueue'][_0xfc0b('0x3f')]({'where':{'id':_0x34ebca['params']['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x4573e5,null))[_0xfc0b('0x17')](function(_0x42c9f1){if(_0x42c9f1){_0x5cb48f=_0x42c9f1;_0x5ca7a2[_0xfc0b('0x2a')]=_[_0xfc0b('0x2b')](db['Team']['rawAttributes']);_0x5ca7a2[_0xfc0b('0x2c')]=_['keys'](_0x34ebca[_0xfc0b('0x2c')]);_0x5ca7a2[_0xfc0b('0x2d')]=_[_0xfc0b('0x2f')](_0x5ca7a2[_0xfc0b('0x2a')],_0x5ca7a2[_0xfc0b('0x2c')]);_0x16e480[_0xfc0b('0x2e')]=_[_0xfc0b('0x2f')](_0x5ca7a2['model'],qs[_0xfc0b('0x30')](_0x34ebca[_0xfc0b('0x2c')][_0xfc0b('0x30')]));_0x16e480[_0xfc0b('0x2e')]=_0x16e480[_0xfc0b('0x2e')][_0xfc0b('0x31')]?_0x16e480[_0xfc0b('0x2e')]:_0x5ca7a2['model'];_0x16e480[_0xfc0b('0x43')]=qs[_0xfc0b('0x44')](_0x34ebca[_0xfc0b('0x2c')][_0xfc0b('0x44')]);_0x16e480[_0xfc0b('0x27')]=qs[_0xfc0b('0x2d')](_[_0xfc0b('0x4f')](_0x34ebca[_0xfc0b('0x2c')],_0x5ca7a2['filters']));if(_0x34ebca[_0xfc0b('0x2c')]['filter']){_0x16e480[_0xfc0b('0x27')]=_[_0xfc0b('0x50')](_0x16e480[_0xfc0b('0x27')],{'$or':_['map'](_0x16e480['attributes'],function(_0x2a2508){var _0x42b734={};_0x42b734[_0x2a2508]={'$like':'%'+_0x34ebca[_0xfc0b('0x2c')][_0xfc0b('0x45')]+'%'};return _0x42b734;})});}_0x16e480=_[_0xfc0b('0x50')]({},_0x16e480,_0x34ebca[_0xfc0b('0x33')]);return _0x5cb48f[_0xfc0b('0x4e')](_0x16e480);}})[_0xfc0b('0x17')](function(_0x8c48fb){if(_0x8c48fb){_0x4f2924=_0x8c48fb[_0xfc0b('0x31')];if(!_0x34ebca['query'][_0xfc0b('0x41')](_0xfc0b('0x42'))){_0x16e480[_0xfc0b('0x13')]=qs[_0xfc0b('0x13')](_0x34ebca[_0xfc0b('0x2c')][_0xfc0b('0x13')]);_0x16e480[_0xfc0b('0x11')]=qs['offset'](_0x34ebca[_0xfc0b('0x2c')]['offset']);}return _0x5cb48f['getTeams'](_0x16e480);}})[_0xfc0b('0x17')](function(_0x516fab){if(_0x516fab){return _0x516fab?{'count':_0x4f2924,'rows':_0x516fab}:null;}})[_0xfc0b('0x17')](respondWithResult(_0x4573e5,null))[_0xfc0b('0x29')](handleError(_0x4573e5,null));};exports[_0xfc0b('0x51')]=function(_0x19136d,_0x44cb98){var _0x1ff17a=_0x19136d[_0xfc0b('0x35')]['ids'];return db[_0xfc0b('0x52')][_0xfc0b('0x28')]({'where':{'id':_0x1ff17a},'attributes':['id'],'include':[{'model':db[_0xfc0b('0x46')],'as':_0xfc0b('0x53'),'attributes':['id',_0xfc0b('0x1e'),_0xfc0b('0x54'),_0xfc0b('0x55'),_0xfc0b('0x56')],'raw':!![]}]})['then'](function(_0x596f77){if(_0x596f77){var _0x5566fc=_[_0xfc0b('0x57')](_0x596f77,function(_0x434c7e){var _0x354e95=_0x434c7e[_0xfc0b('0x18')]({'plain':!![]});return _0x354e95[_0xfc0b('0x53')];});return db[_0xfc0b('0x22')][_0xfc0b('0x39')]({'where':{'id':_0x19136d[_0xfc0b('0x3d')]['id']}})[_0xfc0b('0x17')](function(_0x53f850){return db['sequelize'][_0xfc0b('0x58')](function(_0xc37d69){return _0x53f850['addTeams'](_0x1ff17a,{'transaction':_0xc37d69})['then'](function(){return BPromise[_0xfc0b('0x59')](_0x5566fc,function(_0x3d674d){return db[_0xfc0b('0x40')][_0xfc0b('0x5a')]({'where':{'UserId':_0x3d674d['id'],'MailQueueId':_0x19136d[_0xfc0b('0x3d')]['id']},'transaction':_0xc37d69});});})['then'](function(){_0x5566fc[_0xfc0b('0x5b')](function(_0x5609e5){socket['emit']('userMailQueue:save',{'UserId':_0x5609e5['id'],'MailQueueId':_0x53f850['id']});});});});});}})['then'](respondWithStatusCode(_0x44cb98,null))[_0xfc0b('0x29')](handleError(_0x44cb98,null));};exports[_0xfc0b('0x5c')]=function(_0x327ebb,_0x1827ef){return db[_0xfc0b('0x52')][_0xfc0b('0x28')]({'where':{'id':_0x327ebb[_0xfc0b('0x2c')][_0xfc0b('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xfc0b('0x46')],'as':_0xfc0b('0x53'),'attributes':['id'],'raw':!![]}]})[_0xfc0b('0x17')](handleEntityNotFound(_0x1827ef,null))['then'](function(_0xee37ae){var _0x357765=_['map'](_0xee37ae,'id');var _0x4a0666=[];var _0x3ddd03=[];var _0x21cac2=squel[_0xfc0b('0x5e')]();_0x21cac2[_0xfc0b('0x5f')]('tq.TeamId')['from'](_0xfc0b('0x60'),'tq')[_0xfc0b('0x61')](_0xfc0b('0x62'),'ut',_0xfc0b('0x63'))['where']('MailQueueId\x20=\x20?',_0x327ebb[_0xfc0b('0x3d')]['id']);for(var _0x39dfc5=0x0;_0x39dfc5<_0xee37ae[_0xfc0b('0x31')];_0x39dfc5+=0x1){let _0x578a2b=_0xee37ae[_0x39dfc5];for(var _0x14d108=0x0;_0x14d108<_0x578a2b['Agents'][_0xfc0b('0x31')];_0x14d108+=0x1){let _0x366195=_0x578a2b[_0xfc0b('0x53')][_0x14d108];var _0x2f3fa2=_0x21cac2['clone']();_0x2f3fa2['where'](_0xfc0b('0x64'),_0x366195['id']);_0x3ddd03['push'](db['sequelize'][_0xfc0b('0x2c')](_0x2f3fa2[_0xfc0b('0x65')](),{'type':db[_0xfc0b('0x66')]['QueryTypes']['SELECT']})[_0xfc0b('0x17')](function(_0x42eb78){if(_0x42eb78[_0xfc0b('0x31')]===0x1){return _0x366195['id'];}else{var _0xc2c9f2=_[_0xfc0b('0x67')](_[_0xfc0b('0x21')](_0x42eb78,_0xfc0b('0x68')),function(_0x4e04ad){return _[_0xfc0b('0x69')](_0x357765,_0x4e04ad);});if(_0xc2c9f2){return _0x366195['id'];}}}));}}return BPromise[_0xfc0b('0x6a')](_0x3ddd03)[_0xfc0b('0x17')](function(_0x38b831){_0x4a0666=_(_0x4a0666)['union'](_0x38b831)[_0xfc0b('0x6b')]()[_0xfc0b('0x6c')]();return db[_0xfc0b('0x22')]['find']({'where':{'id':_0x327ebb[_0xfc0b('0x3d')]['id']}})['then'](function(_0x2da719){return db['sequelize'][_0xfc0b('0x58')](function(_0x4edcb1){return _0x2da719['removeTeams'](_0x327ebb[_0xfc0b('0x2c')]['ids'],{'transaction':_0x4edcb1})[_0xfc0b('0x17')](function(){if(!_[_0xfc0b('0x6d')](_0x4a0666)){return _0x2da719['removeAgents'](_0x4a0666,{'transaction':_0x4edcb1});}})[_0xfc0b('0x17')](function(){_0x4a0666[_0xfc0b('0x5b')](function(_0x143068){socket['emit'](_0xfc0b('0x6e'),{'UserId':_0x143068,'MailQueueId':_0x2da719['id']});});});});});});})[_0xfc0b('0x17')](respondWithStatusCode(_0x1827ef,null))[_0xfc0b('0x29')](handleError(_0x1827ef,null));};exports['addAgents']=function(_0x2e2916,_0x4fdb8a){return db[_0xfc0b('0x22')]['find']({'where':{'id':_0x2e2916['params']['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x4fdb8a,null))[_0xfc0b('0x17')](function(_0x351430){if(_0x351430){return _0x351430[_0xfc0b('0x6f')](_0x2e2916[_0xfc0b('0x35')]['ids'],_['omit'](_0x2e2916[_0xfc0b('0x35')],[_0xfc0b('0x5d'),'id'])||{})[_0xfc0b('0x70')](function(_0x4a3a4){for(var _0x36ba51=0x0;_0x36ba51<_0x2e2916[_0xfc0b('0x35')]['ids'][_0xfc0b('0x31')];_0x36ba51+=0x1){socket[_0xfc0b('0x71')](_0xfc0b('0x72'),{'UserId':Number(_0x2e2916[_0xfc0b('0x35')][_0xfc0b('0x5d')][_0x36ba51]),'MailQueueId':Number(_0x2e2916['params']['id'])});}return _0x4a3a4;});}})[_0xfc0b('0x17')](respondWithResult(_0x4fdb8a,null))['catch'](handleError(_0x4fdb8a,null));};exports[_0xfc0b('0x73')]=function(_0x2a65e4,_0x85fe5e){return db[_0xfc0b('0x22')][_0xfc0b('0x39')]({'where':{'id':_0x2a65e4[_0xfc0b('0x3d')]['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x85fe5e,null))[_0xfc0b('0x17')](function(_0x12189f){if(_0x12189f){return _0x12189f['removeAgents'](_0x2a65e4['query'][_0xfc0b('0x5d')])['then'](function(){if(_[_0xfc0b('0x74')](_0x2a65e4[_0xfc0b('0x2c')][_0xfc0b('0x5d')])){for(var _0x3f9559=0x0;_0x3f9559<_0x2a65e4['query'][_0xfc0b('0x5d')][_0xfc0b('0x31')];_0x3f9559+=0x1){socket['emit'](_0xfc0b('0x6e'),{'UserId':Number(_0x2a65e4[_0xfc0b('0x2c')][_0xfc0b('0x5d')][_0x3f9559]),'MailQueueId':Number(_0x2a65e4['params']['id'])});}}else{socket[_0xfc0b('0x71')](_0xfc0b('0x6e'),{'UserId':Number(_0x2a65e4['query']['ids']),'MailQueueId':Number(_0x2a65e4[_0xfc0b('0x3d')]['id'])});}});}})[_0xfc0b('0x17')](respondWithStatusCode(_0x85fe5e,null))[_0xfc0b('0x29')](handleError(_0x85fe5e,null));};exports[_0xfc0b('0x75')]=function(_0x338df2,_0x3e5d4a){var _0x39d182={};var _0x3ef906={};var _0x4c7694;var _0x3befd5;return db['MailQueue'][_0xfc0b('0x3f')]({'where':{'id':_0x338df2[_0xfc0b('0x3d')]['id']}})[_0xfc0b('0x17')](handleEntityNotFound(_0x3e5d4a,null))[_0xfc0b('0x17')](function(_0x180822){if(_0x180822){_0x4c7694=_0x180822;_0x3ef906[_0xfc0b('0x2a')]=_['keys'](db[_0xfc0b('0x46')][_0xfc0b('0x23')]);_0x3ef906[_0xfc0b('0x2c')]=_[_0xfc0b('0x2b')](_0x338df2[_0xfc0b('0x2c')]);_0x3ef906[_0xfc0b('0x2d')]=_['intersection'](_0x3ef906[_0xfc0b('0x2a')],_0x3ef906[_0xfc0b('0x2c')]);_0x39d182[_0xfc0b('0x2e')]=_['intersection'](_0x3ef906['model'],qs[_0xfc0b('0x30')](_0x338df2['query'][_0xfc0b('0x30')]));_0x39d182[_0xfc0b('0x2e')]=_0x39d182['attributes'][_0xfc0b('0x31')]?_0x39d182[_0xfc0b('0x2e')]:_0x3ef906[_0xfc0b('0x2a')];_0x39d182[_0xfc0b('0x43')]=qs[_0xfc0b('0x44')](_0x338df2[_0xfc0b('0x2c')][_0xfc0b('0x44')]);_0x39d182['where']=qs[_0xfc0b('0x2d')](_[_0xfc0b('0x4f')](_0x338df2[_0xfc0b('0x2c')],_0x3ef906['filters']));if(_0x338df2[_0xfc0b('0x2c')][_0xfc0b('0x45')]){_0x39d182[_0xfc0b('0x27')]=_[_0xfc0b('0x50')](_0x39d182[_0xfc0b('0x27')],{'$or':_['map'](_0x39d182[_0xfc0b('0x2e')],function(_0x53422e){var _0x36a014={};_0x36a014[_0x53422e]={'$like':'%'+_0x338df2[_0xfc0b('0x2c')][_0xfc0b('0x45')]+'%'};return _0x36a014;})});}_0x39d182=_[_0xfc0b('0x50')]({},_0x39d182,_0x338df2[_0xfc0b('0x33')]);return _0x4c7694[_0xfc0b('0x75')](_0x39d182);}})[_0xfc0b('0x17')](function(_0xdb9825){if(_0xdb9825){_0x3befd5=_0xdb9825[_0xfc0b('0x31')];if(!_0x338df2[_0xfc0b('0x2c')]['hasOwnProperty'](_0xfc0b('0x42'))){_0x39d182[_0xfc0b('0x13')]=qs[_0xfc0b('0x13')](_0x338df2[_0xfc0b('0x2c')][_0xfc0b('0x13')]);_0x39d182[_0xfc0b('0x11')]=qs['offset'](_0x338df2[_0xfc0b('0x2c')][_0xfc0b('0x11')]);}return _0x4c7694[_0xfc0b('0x75')](_0x39d182);}})['then'](function(_0x52921d){if(_0x52921d){return _0x52921d?{'count':_0x3befd5,'rows':_0x52921d}:null;}})[_0xfc0b('0x17')](respondWithResult(_0x3e5d4a,null))['catch'](handleError(_0x3e5d4a,null));}; \ No newline at end of file +var _0x9b0f=['Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','from','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','findOne','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','getOptions','where','count','include','query','findAll','rows','catch','params','keys','model','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','filters','intersection','nolimit','order','sort','pick','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9b0f,0x187));var _0xf9b0=function(_0x4d7c86,_0x9b62a6){_0x4d7c86=_0x4d7c86-0x0;var _0x59443d=_0x9b0f[_0x4d7c86];return _0x59443d;};'use strict';var BPromise=require(_0xf9b0('0x0'));var util=require(_0xf9b0('0x1'));var _=require(_0xf9b0('0x2'));var squel=require(_0xf9b0('0x3'));var Redis=require(_0xf9b0('0x4'));var qs=require(_0xf9b0('0x5'));var logger=require('../../config/logger')(_0xf9b0('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf9b0('0x7')](config['redis'],{'host':_0xf9b0('0x8'),'port':0x18eb});var socket=require(_0xf9b0('0x9'))(new Redis(config[_0xf9b0('0xa')]));require('./mailQueue.socket')[_0xf9b0('0xb')](socket);function respondWithStatusCode(_0x3eb07e,_0x353667){_0x353667=_0x353667||0xcc;return function(_0x554a90){if(_0x554a90){return _0x3eb07e[_0xf9b0('0xc')](_0x353667);}return _0x3eb07e[_0xf9b0('0xd')](_0x353667)[_0xf9b0('0xe')]();};}function respondWithResult(_0x27e545,_0x450bc9){_0x450bc9=_0x450bc9||0xc8;return function(_0x4597b2){if(_0x4597b2){return _0x27e545[_0xf9b0('0xd')](_0x450bc9)[_0xf9b0('0xf')](_0x4597b2);}};}function respondWithFilteredResult(_0x11c2aa,_0x195602){return function(_0x58aacd){if(_0x58aacd){var _0x21e6b5=typeof _0x195602[_0xf9b0('0x10')]===_0xf9b0('0x11')&&typeof _0x195602[_0xf9b0('0x12')]===_0xf9b0('0x11');var _0x2f6179=_0x58aacd['count'];var _0x55fdb0=_0x21e6b5?0x0:_0x195602['offset'];var _0x16268a=_0x21e6b5?_0x58aacd['count']:_0x195602[_0xf9b0('0x10')]+_0x195602[_0xf9b0('0x12')];var _0x3996f5;if(_0x16268a>=_0x2f6179){_0x16268a=_0x2f6179;_0x3996f5=0xc8;}else{_0x3996f5=0xce;}_0x11c2aa['status'](_0x3996f5);return _0x11c2aa[_0xf9b0('0x13')](_0xf9b0('0x14'),_0x55fdb0+'-'+_0x16268a+'/'+_0x2f6179)[_0xf9b0('0xf')](_0x58aacd);}return null;};}function saveUpdates(_0x332b2b){return function(_0x427504){if(_0x427504){return _0x427504[_0xf9b0('0x15')](_0x332b2b)['then'](function(_0x1cfad3){return _0x1cfad3;});}return null;};}function removeEntity(_0x5d7b66){return function(_0x3f57d8){if(_0x3f57d8){return _0x3f57d8[_0xf9b0('0x16')]()[_0xf9b0('0x17')](function(){var _0x3d84a5=_0x3f57d8[_0xf9b0('0x18')]({'plain':!![]});var _0x2bb8a0=_0xf9b0('0x19');return db[_0xf9b0('0x1a')][_0xf9b0('0x16')]({'where':{'type':_0x2bb8a0,'resourceId':_0x3d84a5['id']}})[_0xf9b0('0x17')](function(){return _0x3f57d8;});})[_0xf9b0('0x17')](function(){_0x5d7b66['status'](0xcc)[_0xf9b0('0xe')]();});}};}function handleEntityNotFound(_0x5bedcd){return function(_0x3ad0fe){if(!_0x3ad0fe){_0x5bedcd[_0xf9b0('0xc')](0x194);}return _0x3ad0fe;};}function handleError(_0x250317,_0x1b40f7){_0x1b40f7=_0x1b40f7||0x1f4;return function(_0x22be80){logger[_0xf9b0('0x1b')](_0x22be80['stack']);if(_0x22be80[_0xf9b0('0x1c')]){delete _0x22be80[_0xf9b0('0x1c')];}_0x250317['status'](_0x1b40f7)[_0xf9b0('0x1d')](_0x22be80);};}exports[_0xf9b0('0x1e')]=function(_0x2299fe,_0x48a624){var _0x5dc718={};var _0x2b1ea4={'count':0x0,'rows':[]};var _0x2cc721=_[_0xf9b0('0x1f')](db[_0xf9b0('0x20')][_0xf9b0('0x21')],function(_0x4b0b52){return{'name':_0x4b0b52['fieldName'],'type':_0x4b0b52['type']['key']};});_0x5dc718=qs[_0xf9b0('0x22')](_0x2cc721,_0x2299fe);var _0x145ced={'where':_0x5dc718[_0xf9b0('0x23')]};return db['MailQueue'][_0xf9b0('0x24')](_0x145ced)[_0xf9b0('0x17')](function(_0x435d22){_0x2b1ea4[_0xf9b0('0x24')]=_0x435d22;_0x5dc718[_0xf9b0('0x25')]=qs[_0xf9b0('0x25')](_0x2299fe[_0xf9b0('0x26')]);return db[_0xf9b0('0x20')][_0xf9b0('0x27')](_0x5dc718);})[_0xf9b0('0x17')](function(_0x3b0e9a){_0x2b1ea4[_0xf9b0('0x28')]=_0x3b0e9a;return _0x2b1ea4;})[_0xf9b0('0x17')](respondWithFilteredResult(_0x48a624,_0x5dc718))[_0xf9b0('0x29')](handleError(_0x48a624,null));};exports['show']=function(_0x14c835,_0x3333c2){var _0x1ac154={'raw':!![],'where':{'id':_0x14c835[_0xf9b0('0x2a')]['id']}},_0x3cb944={};_0x3cb944['model']=_[_0xf9b0('0x2b')](db[_0xf9b0('0x20')][_0xf9b0('0x21')]);_0x3cb944['query']=_[_0xf9b0('0x2b')](_0x14c835[_0xf9b0('0x26')]);_0x3cb944['filters']=_['intersection'](_0x3cb944[_0xf9b0('0x2c')],_0x3cb944[_0xf9b0('0x26')]);_0x1ac154[_0xf9b0('0x2d')]=_['intersection'](_0x3cb944[_0xf9b0('0x2c')],qs['fields'](_0x14c835[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x1ac154[_0xf9b0('0x2d')]=_0x1ac154[_0xf9b0('0x2d')][_0xf9b0('0x2f')]?_0x1ac154[_0xf9b0('0x2d')]:_0x3cb944['model'];if(_0x14c835['query'][_0xf9b0('0x30')]){_0x1ac154[_0xf9b0('0x25')]=[{'all':!![]}];}_0x1ac154=_[_0xf9b0('0x31')]({},_0x1ac154,_0x14c835[_0xf9b0('0x32')]);return db['MailQueue'][_0xf9b0('0x33')](_0x1ac154)[_0xf9b0('0x17')](handleEntityNotFound(_0x3333c2,null))[_0xf9b0('0x17')](respondWithResult(_0x3333c2,null))[_0xf9b0('0x29')](handleError(_0x3333c2,null));};exports[_0xf9b0('0x34')]=function(_0x3e4e5e,_0x9bee64){return db[_0xf9b0('0x20')][_0xf9b0('0x34')](_0x3e4e5e[_0xf9b0('0x35')],{})[_0xf9b0('0x17')](function(_0x51a408){var _0x24863a=_0x3e4e5e[_0xf9b0('0x36')][_0xf9b0('0x18')]({'plain':!![]});if(!_0x24863a)throw new Error(_0xf9b0('0x37'));if(_0x24863a[_0xf9b0('0x38')]==='user'){var _0x432d59=_0x51a408[_0xf9b0('0x18')]({'plain':!![]});var _0x237d71='MailQueues';return db[_0xf9b0('0x39')][_0xf9b0('0x33')]({'where':{'name':_0x237d71,'userProfileId':_0x24863a[_0xf9b0('0x3a')]},'raw':!![]})['then'](function(_0x43ea75){if(_0x43ea75&&_0x43ea75[_0xf9b0('0x3b')]===0x0){return db[_0xf9b0('0x1a')]['create']({'name':_0x432d59['name'],'resourceId':_0x432d59['id'],'type':_0x43ea75['name'],'sectionId':_0x43ea75['id']},{})[_0xf9b0('0x17')](function(){return _0x51a408;});}else{return _0x51a408;}})['catch'](function(_0xe144a8){logger['error'](_0xf9b0('0x3c'),_0xe144a8);throw _0xe144a8;});}return _0x51a408;})[_0xf9b0('0x17')](respondWithResult(_0x9bee64,0xc9))['catch'](handleError(_0x9bee64,null));};exports['update']=function(_0x1c1719,_0x3d94bb){if(_0x1c1719['body']['id']){delete _0x1c1719['body']['id'];}return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x1c1719[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x3d94bb,null))[_0xf9b0('0x17')](saveUpdates(_0x1c1719[_0xf9b0('0x35')],null))['then'](respondWithResult(_0x3d94bb,null))['catch'](handleError(_0x3d94bb,null));};exports[_0xf9b0('0x16')]=function(_0x1d972c,_0x483bc5){return db['MailQueue'][_0xf9b0('0x33')]({'where':{'id':_0x1d972c['params']['id']}})['then'](handleEntityNotFound(_0x483bc5,null))[_0xf9b0('0x17')](removeEntity(_0x483bc5,null))[_0xf9b0('0x29')](handleError(_0x483bc5,null));};exports[_0xf9b0('0x3d')]=function(_0xe33aaf,_0x21f267){return db['MailQueue']['describe']()[_0xf9b0('0x17')](respondWithResult(_0x21f267,null))[_0xf9b0('0x29')](handleError(_0x21f267,null));};exports[_0xf9b0('0x3e')]=function(_0x590c15,_0x395fb4){var _0x1ffa8a={'raw':!![],'where':{}},_0x1494e5={},_0x462081;return db[_0xf9b0('0x20')]['findOne']({'where':{'id':_0x590c15[_0xf9b0('0x2a')]['id']}})['then'](handleEntityNotFound(_0x395fb4,null))['then'](function(_0x173392){if(_0x173392){_0x462081=_0x173392[_0xf9b0('0x18')]({'plain':!![]});_0x1494e5['model']=_[_0xf9b0('0x2b')](db[_0xf9b0('0x3f')]['rawAttributes']);_0x1494e5[_0xf9b0('0x26')]=_['keys'](_0x590c15[_0xf9b0('0x26')]);_0x1494e5[_0xf9b0('0x40')]=_['intersection'](_0x1494e5[_0xf9b0('0x2c')],_0x1494e5['query']);_0x1ffa8a[_0xf9b0('0x2d')]=_[_0xf9b0('0x41')](_0x1494e5[_0xf9b0('0x2c')],qs['fields'](_0x590c15[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x1ffa8a[_0xf9b0('0x2d')]=_0x1ffa8a[_0xf9b0('0x2d')][_0xf9b0('0x2f')]?_0x1ffa8a[_0xf9b0('0x2d')]:_0x1494e5[_0xf9b0('0x2c')];if(!_0x590c15['query']['hasOwnProperty'](_0xf9b0('0x42'))){_0x1ffa8a[_0xf9b0('0x12')]=qs[_0xf9b0('0x12')](_0x590c15[_0xf9b0('0x26')][_0xf9b0('0x12')]);_0x1ffa8a['offset']=qs['offset'](_0x590c15[_0xf9b0('0x26')][_0xf9b0('0x10')]);}_0x1ffa8a[_0xf9b0('0x43')]=qs[_0xf9b0('0x44')](_0x590c15['query'][_0xf9b0('0x44')]);_0x1ffa8a[_0xf9b0('0x23')]=qs[_0xf9b0('0x40')](_[_0xf9b0('0x45')](_0x590c15[_0xf9b0('0x26')],_0x1494e5[_0xf9b0('0x40')]));_0x1ffa8a[_0xf9b0('0x23')][_0xf9b0('0x46')]=_0x173392['id'];if(_0x590c15[_0xf9b0('0x26')]['filter']){_0x1ffa8a[_0xf9b0('0x23')]=_['merge'](_0x1ffa8a[_0xf9b0('0x23')],{'$or':_[_0xf9b0('0x1f')](_0x1ffa8a['attributes'],function(_0x264382){var _0x3b81df={};_0x3b81df[_0x264382]={'$like':'%'+_0x590c15['query'][_0xf9b0('0x47')]+'%'};return _0x3b81df;})});}_0x1ffa8a=_[_0xf9b0('0x31')]({},_0x1ffa8a,_0x590c15[_0xf9b0('0x32')]);return db[_0xf9b0('0x3f')][_0xf9b0('0x27')](_0x1ffa8a);}})[_0xf9b0('0x17')](function(_0xa7e0d5){if(_0xa7e0d5){return db[_0xf9b0('0x48')][_0xf9b0('0x49')]({'where':{'id':_['map'](_0xa7e0d5,_0xf9b0('0x4a')),'role':_0xf9b0('0x4b')},'attributes':['id',_0xf9b0('0x1c'),_0xf9b0('0x4c'),'updatedAt',_0xf9b0('0x4d')]});}})['then'](function(_0x3aced4){if(_0x3aced4){return{'count':_0x3aced4[_0xf9b0('0x24')],'rows':_[_0xf9b0('0x1f')](_0x3aced4[_0xf9b0('0x28')],function(_0x79905d){return{'membername':_0x79905d[_0xf9b0('0x1c')],'UserId':_0x79905d['id'],'queue_name':_0x462081['name'],'MailQueueId':_0x462081['id'],'interface':util[_0xf9b0('0x4e')](_0xf9b0('0x4f'),'SIP',_0x79905d['name']),'penalty':0x0,'paused':_0x79905d[_0xf9b0('0x4c')],'createdAt':_0x79905d[_0xf9b0('0x4d')],'updatedAt':_0x79905d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf9b0('0x17')](respondWithFilteredResult(_0x395fb4,_0x1ffa8a))['catch'](handleError(_0x395fb4,null));};exports[_0xf9b0('0x50')]=function(_0x592ed4,_0x1af11b){var _0x62ffc3={};var _0x766c3={};var _0x50a87c;var _0x303636;return db[_0xf9b0('0x20')]['findOne']({'where':{'id':_0x592ed4['params']['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x1af11b,null))[_0xf9b0('0x17')](function(_0x2437ae){if(_0x2437ae){_0x50a87c=_0x2437ae;_0x766c3[_0xf9b0('0x2c')]=_[_0xf9b0('0x2b')](db[_0xf9b0('0x51')][_0xf9b0('0x21')]);_0x766c3[_0xf9b0('0x26')]=_[_0xf9b0('0x2b')](_0x592ed4['query']);_0x766c3[_0xf9b0('0x40')]=_['intersection'](_0x766c3[_0xf9b0('0x2c')],_0x766c3[_0xf9b0('0x26')]);_0x62ffc3[_0xf9b0('0x2d')]=_[_0xf9b0('0x41')](_0x766c3[_0xf9b0('0x2c')],qs[_0xf9b0('0x2e')](_0x592ed4[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x62ffc3[_0xf9b0('0x2d')]=_0x62ffc3['attributes'][_0xf9b0('0x2f')]?_0x62ffc3[_0xf9b0('0x2d')]:_0x766c3[_0xf9b0('0x2c')];_0x62ffc3[_0xf9b0('0x43')]=qs[_0xf9b0('0x44')](_0x592ed4[_0xf9b0('0x26')]['sort']);_0x62ffc3[_0xf9b0('0x23')]=qs[_0xf9b0('0x40')](_[_0xf9b0('0x45')](_0x592ed4[_0xf9b0('0x26')],_0x766c3['filters']));if(_0x592ed4['query'][_0xf9b0('0x47')]){_0x62ffc3[_0xf9b0('0x23')]=_['merge'](_0x62ffc3['where'],{'$or':_[_0xf9b0('0x1f')](_0x62ffc3[_0xf9b0('0x2d')],function(_0x3a55bb){var _0x4e524f={};_0x4e524f[_0x3a55bb]={'$like':'%'+_0x592ed4[_0xf9b0('0x26')][_0xf9b0('0x47')]+'%'};return _0x4e524f;})});}_0x62ffc3=_[_0xf9b0('0x31')]({},_0x62ffc3,_0x592ed4[_0xf9b0('0x32')]);return _0x50a87c[_0xf9b0('0x50')](_0x62ffc3);}})['then'](function(_0x5df4f4){if(_0x5df4f4){_0x303636=_0x5df4f4[_0xf9b0('0x2f')];if(!_0x592ed4['query'][_0xf9b0('0x52')](_0xf9b0('0x42'))){_0x62ffc3[_0xf9b0('0x12')]=qs['limit'](_0x592ed4['query'][_0xf9b0('0x12')]);_0x62ffc3['offset']=qs[_0xf9b0('0x10')](_0x592ed4[_0xf9b0('0x26')]['offset']);}return _0x50a87c['getTeams'](_0x62ffc3);}})[_0xf9b0('0x17')](function(_0x102c7a){if(_0x102c7a){return _0x102c7a?{'count':_0x303636,'rows':_0x102c7a}:null;}})[_0xf9b0('0x17')](respondWithResult(_0x1af11b,null))['catch'](handleError(_0x1af11b,null));};exports[_0xf9b0('0x53')]=function(_0x34c27e,_0x33ccf7){var _0x34fc49=_0x34c27e['body'][_0xf9b0('0x54')];return db['Team']['findAll']({'where':{'id':_0x34fc49},'attributes':['id'],'include':[{'model':db[_0xf9b0('0x48')],'as':_0xf9b0('0x55'),'attributes':['id',_0xf9b0('0x1c'),_0xf9b0('0x56'),'voicePause',_0xf9b0('0x57')],'raw':!![]}]})[_0xf9b0('0x17')](function(_0x38ad05){if(_0x38ad05){var _0x121523=_[_0xf9b0('0x58')](_0x38ad05,function(_0x2d9873){var _0x2c35b1=_0x2d9873[_0xf9b0('0x18')]({'plain':!![]});return _0x2c35b1['Agents'];});return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x34c27e[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](function(_0x3aa3aa){return db[_0xf9b0('0x59')][_0xf9b0('0x5a')](function(_0xec8c71){return _0x3aa3aa[_0xf9b0('0x53')](_0x34fc49,{'transaction':_0xec8c71})[_0xf9b0('0x17')](function(){return BPromise[_0xf9b0('0x5b')](_0x121523,function(_0x3356b7){return db[_0xf9b0('0x3f')]['findOrCreate']({'where':{'UserId':_0x3356b7['id'],'MailQueueId':_0x34c27e[_0xf9b0('0x2a')]['id']},'transaction':_0xec8c71});});})[_0xf9b0('0x17')](function(){_0x121523[_0xf9b0('0x5c')](function(_0x3abbb1){socket[_0xf9b0('0x5d')](_0xf9b0('0x5e'),{'UserId':_0x3abbb1['id'],'MailQueueId':_0x3aa3aa['id']});});});});});}})[_0xf9b0('0x17')](respondWithStatusCode(_0x33ccf7,null))[_0xf9b0('0x29')](handleError(_0x33ccf7,null));};exports[_0xf9b0('0x5f')]=function(_0x981d27,_0x4d8feb){return db[_0xf9b0('0x51')]['findAll']({'where':{'id':_0x981d27[_0xf9b0('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf9b0('0x48')],'as':_0xf9b0('0x55'),'attributes':['id'],'raw':!![]}]})[_0xf9b0('0x17')](handleEntityNotFound(_0x4d8feb,null))[_0xf9b0('0x17')](function(_0x2d1b39){var _0x3d4e7b=_[_0xf9b0('0x1f')](_0x2d1b39,'id');var _0x5e6d41=[];var _0x547deb=[];var _0x24d2f1=squel['select']();_0x24d2f1[_0xf9b0('0x60')](_0xf9b0('0x61'))[_0xf9b0('0x62')]('team_has_mail_queues','tq')['join'](_0xf9b0('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf9b0('0x23')]('MailQueueId\x20=\x20?',_0x981d27[_0xf9b0('0x2a')]['id']);for(var _0x493fae=0x0;_0x493fae<_0x2d1b39[_0xf9b0('0x2f')];_0x493fae+=0x1){let _0x16a42d=_0x2d1b39[_0x493fae];for(var _0x239916=0x0;_0x239916<_0x16a42d[_0xf9b0('0x55')][_0xf9b0('0x2f')];_0x239916+=0x1){let _0x242d20=_0x16a42d['Agents'][_0x239916];var _0x5e9a73=_0x24d2f1[_0xf9b0('0x64')]();_0x5e9a73[_0xf9b0('0x23')](_0xf9b0('0x65'),_0x242d20['id']);_0x547deb[_0xf9b0('0x66')](db['sequelize'][_0xf9b0('0x26')](_0x5e9a73[_0xf9b0('0x67')](),{'type':db[_0xf9b0('0x59')][_0xf9b0('0x68')][_0xf9b0('0x69')]})['then'](function(_0x2b89e9){if(_0x2b89e9[_0xf9b0('0x2f')]===0x1){return _0x242d20['id'];}else{var _0x3ab149=_[_0xf9b0('0x6a')](_[_0xf9b0('0x1f')](_0x2b89e9,'TeamId'),function(_0x44de90){return _[_0xf9b0('0x6b')](_0x3d4e7b,_0x44de90);});if(_0x3ab149){return _0x242d20['id'];}}}));}}return BPromise['all'](_0x547deb)[_0xf9b0('0x17')](function(_0x1ed1b0){_0x5e6d41=_(_0x5e6d41)[_0xf9b0('0x6c')](_0x1ed1b0)['compact']()[_0xf9b0('0x6d')]();return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x981d27[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](function(_0x458c62){return db[_0xf9b0('0x59')][_0xf9b0('0x5a')](function(_0x3821d2){return _0x458c62['removeTeams'](_0x981d27[_0xf9b0('0x26')][_0xf9b0('0x54')],{'transaction':_0x3821d2})[_0xf9b0('0x17')](function(){if(!_[_0xf9b0('0x6e')](_0x5e6d41)){return _0x458c62[_0xf9b0('0x6f')](_0x5e6d41,{'transaction':_0x3821d2});}})[_0xf9b0('0x17')](function(){_0x5e6d41[_0xf9b0('0x5c')](function(_0x4069e3){socket[_0xf9b0('0x5d')]('userMailQueue:remove',{'UserId':_0x4069e3,'MailQueueId':_0x458c62['id']});});});});});});})[_0xf9b0('0x17')](respondWithStatusCode(_0x4d8feb,null))[_0xf9b0('0x29')](handleError(_0x4d8feb,null));};exports[_0xf9b0('0x70')]=function(_0x4f2434,_0x4fdcd9){return db['MailQueue'][_0xf9b0('0x33')]({'where':{'id':_0x4f2434[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x4fdcd9,null))[_0xf9b0('0x17')](function(_0x9656e2){if(_0x9656e2){return _0x9656e2[_0xf9b0('0x70')](_0x4f2434[_0xf9b0('0x35')][_0xf9b0('0x54')],_[_0xf9b0('0x71')](_0x4f2434[_0xf9b0('0x35')],['ids','id'])||{})[_0xf9b0('0x72')](function(_0x2f2947){for(var _0x3411a7=0x0;_0x3411a7<_0x4f2434[_0xf9b0('0x35')]['ids']['length'];_0x3411a7+=0x1){socket[_0xf9b0('0x5d')](_0xf9b0('0x5e'),{'UserId':Number(_0x4f2434[_0xf9b0('0x35')][_0xf9b0('0x54')][_0x3411a7]),'MailQueueId':Number(_0x4f2434[_0xf9b0('0x2a')]['id'])});}return _0x2f2947;});}})[_0xf9b0('0x17')](respondWithResult(_0x4fdcd9,null))[_0xf9b0('0x29')](handleError(_0x4fdcd9,null));};exports[_0xf9b0('0x6f')]=function(_0x242fec,_0x2b2619){return db[_0xf9b0('0x20')][_0xf9b0('0x33')]({'where':{'id':_0x242fec['params']['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x2b2619,null))['then'](function(_0x190431){if(_0x190431){return _0x190431['removeAgents'](_0x242fec[_0xf9b0('0x26')]['ids'])[_0xf9b0('0x17')](function(){if(_[_0xf9b0('0x73')](_0x242fec['query']['ids'])){for(var _0x163f7e=0x0;_0x163f7e<_0x242fec[_0xf9b0('0x26')][_0xf9b0('0x54')][_0xf9b0('0x2f')];_0x163f7e+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x242fec[_0xf9b0('0x26')]['ids'][_0x163f7e]),'MailQueueId':Number(_0x242fec[_0xf9b0('0x2a')]['id'])});}}else{socket['emit'](_0xf9b0('0x74'),{'UserId':Number(_0x242fec[_0xf9b0('0x26')][_0xf9b0('0x54')]),'MailQueueId':Number(_0x242fec[_0xf9b0('0x2a')]['id'])});}});}})[_0xf9b0('0x17')](respondWithStatusCode(_0x2b2619,null))[_0xf9b0('0x29')](handleError(_0x2b2619,null));};exports[_0xf9b0('0x75')]=function(_0x3fe53a,_0x2e58ce){var _0x3c34f0={};var _0x423de3={};var _0x4d915f;var _0x3a7dbb;return db[_0xf9b0('0x20')][_0xf9b0('0x76')]({'where':{'id':_0x3fe53a[_0xf9b0('0x2a')]['id']}})[_0xf9b0('0x17')](handleEntityNotFound(_0x2e58ce,null))[_0xf9b0('0x17')](function(_0x3fc20b){if(_0x3fc20b){_0x4d915f=_0x3fc20b;_0x423de3['model']=_[_0xf9b0('0x2b')](db['User'][_0xf9b0('0x21')]);_0x423de3[_0xf9b0('0x26')]=_[_0xf9b0('0x2b')](_0x3fe53a[_0xf9b0('0x26')]);_0x423de3[_0xf9b0('0x40')]=_[_0xf9b0('0x41')](_0x423de3['model'],_0x423de3[_0xf9b0('0x26')]);_0x3c34f0[_0xf9b0('0x2d')]=_['intersection'](_0x423de3[_0xf9b0('0x2c')],qs[_0xf9b0('0x2e')](_0x3fe53a[_0xf9b0('0x26')][_0xf9b0('0x2e')]));_0x3c34f0[_0xf9b0('0x2d')]=_0x3c34f0['attributes'][_0xf9b0('0x2f')]?_0x3c34f0[_0xf9b0('0x2d')]:_0x423de3[_0xf9b0('0x2c')];_0x3c34f0[_0xf9b0('0x43')]=qs[_0xf9b0('0x44')](_0x3fe53a[_0xf9b0('0x26')]['sort']);_0x3c34f0[_0xf9b0('0x23')]=qs[_0xf9b0('0x40')](_[_0xf9b0('0x45')](_0x3fe53a['query'],_0x423de3[_0xf9b0('0x40')]));if(_0x3fe53a[_0xf9b0('0x26')][_0xf9b0('0x47')]){_0x3c34f0[_0xf9b0('0x23')]=_[_0xf9b0('0x31')](_0x3c34f0['where'],{'$or':_[_0xf9b0('0x1f')](_0x3c34f0[_0xf9b0('0x2d')],function(_0x3d58dc){var _0x4910c0={};_0x4910c0[_0x3d58dc]={'$like':'%'+_0x3fe53a[_0xf9b0('0x26')]['filter']+'%'};return _0x4910c0;})});}_0x3c34f0=_[_0xf9b0('0x31')]({},_0x3c34f0,_0x3fe53a[_0xf9b0('0x32')]);return _0x4d915f[_0xf9b0('0x75')](_0x3c34f0);}})[_0xf9b0('0x17')](function(_0xb82b73){if(_0xb82b73){_0x3a7dbb=_0xb82b73[_0xf9b0('0x2f')];if(!_0x3fe53a['query']['hasOwnProperty']('nolimit')){_0x3c34f0[_0xf9b0('0x12')]=qs[_0xf9b0('0x12')](_0x3fe53a['query'][_0xf9b0('0x12')]);_0x3c34f0[_0xf9b0('0x10')]=qs[_0xf9b0('0x10')](_0x3fe53a[_0xf9b0('0x26')][_0xf9b0('0x10')]);}return _0x4d915f[_0xf9b0('0x75')](_0x3c34f0);}})['then'](function(_0x2c8192){if(_0x2c8192){return _0x2c8192?{'count':_0x3a7dbb,'rows':_0x2c8192}:null;}})[_0xf9b0('0x17')](respondWithResult(_0x2e58ce,null))['catch'](handleError(_0x2e58ce,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 4f27558..a98345a 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 _0x9453=['hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x1f2708,_0x25fbb0){var _0xfda7d0=function(_0x2634b0){while(--_0x2634b0){_0x1f2708['push'](_0x1f2708['shift']());}};_0xfda7d0(++_0x25fbb0);}(_0x9453,0x7f));var _0x3945=function(_0x5311b4,_0x3a39b5){_0x5311b4=_0x5311b4-0x0;var _0x3ee0b3=_0x9453[_0x5311b4];return _0x3ee0b3;};'use strict';var EventEmitter=require(_0x3945('0x0'));var MailQueue=require(_0x3945('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3945('0x2'),'afterUpdate':_0x3945('0x3'),'afterDestroy':_0x3945('0x4')};function emitEvent(_0x2b2943){return function(_0x3554de,_0xf15e45,_0x4abe58){MailQueueEvents[_0x3945('0x5')](_0x2b2943+':'+_0x3554de['id'],_0x3554de);MailQueueEvents[_0x3945('0x5')](_0x2b2943,_0x3554de);_0x4abe58(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3945('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x80cb=['hook','events','../../mysqldb','MailQueue','setMaxListeners','remove','emit'];(function(_0x1b7807,_0x205ccd){var _0x4d2bec=function(_0x43e586){while(--_0x43e586){_0x1b7807['push'](_0x1b7807['shift']());}};_0x4d2bec(++_0x205ccd);}(_0x80cb,0x94));var _0xb80c=function(_0x1144b9,_0x58585e){_0x1144b9=_0x1144b9-0x0;var _0x58552c=_0x80cb[_0x1144b9];return _0x58552c;};'use strict';var EventEmitter=require(_0xb80c('0x0'));var MailQueue=require(_0xb80c('0x1'))['db'][_0xb80c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb80c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb80c('0x4')};function emitEvent(_0x1dabf1){return function(_0x5180f9,_0x1545b2,_0x33e927){MailQueueEvents['emit'](_0x1dabf1+':'+_0x5180f9['id'],_0x5180f9);MailQueueEvents[_0xb80c('0x5')](_0x1dabf1,_0x5180f9);_0x33e927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xb80c('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b805aa9..bb96791 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 _0x96d6=['moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x548546,_0x44ccc4){var _0x11e915=function(_0x15213a){while(--_0x15213a){_0x548546['push'](_0x548546['shift']());}};_0x11e915(++_0x44ccc4);}(_0x96d6,0x184));var _0x696d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x96d6[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x696d('0x0'));var util=require(_0x696d('0x1'));var logger=require(_0x696d('0x2'))(_0x696d('0x3'));var moment=require(_0x696d('0x4'));var BPromise=require(_0x696d('0x5'));var rp=require(_0x696d('0x6'));var fs=require('fs');var path=require(_0x696d('0x7'));var rimraf=require(_0x696d('0x8'));var config=require('../../config/environment');var attributes=require(_0x696d('0x9'));module[_0x696d('0xa')]=function(_0x5ac9b6,_0x3108ea){return _0x5ac9b6[_0x696d('0xb')](_0x696d('0xc'),attributes,{'tableName':_0x696d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8066=['exports','define','MailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8066,0x155));var _0x6806=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x8066[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require('lodash');var util=require(_0x6806('0x0'));var logger=require(_0x6806('0x1'))(_0x6806('0x2'));var moment=require(_0x6806('0x3'));var BPromise=require(_0x6806('0x4'));var rp=require(_0x6806('0x5'));var fs=require('fs');var path=require(_0x6806('0x6'));var rimraf=require(_0x6806('0x7'));var config=require(_0x6806('0x8'));var attributes=require(_0x6806('0x9'));module[_0x6806('0xa')]=function(_0xa1c882,_0x25ea81){return _0xa1c882[_0x6806('0xb')](_0x6806('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index c499a19..4067838 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 _0x0487=['then','info','request\x20sent','debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','findAll','options','where','attributes','include','map','GetMailQueue','ShowMailQueue','find','raw','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register'];(function(_0x18042e,_0xa7e0f1){var _0x2ee3a5=function(_0x2e2ba1){while(--_0x2e2ba1){_0x18042e['push'](_0x18042e['shift']());}};_0x2ee3a5(++_0xa7e0f1);}(_0x0487,0x14f));var _0x7048=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x0487[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0x7048('0x0'));var util=require(_0x7048('0x1'));var moment=require(_0x7048('0x2'));var BPromise=require(_0x7048('0x3'));var rs=require(_0x7048('0x4'));var fs=require('fs');var Redis=require(_0x7048('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7048('0x6'));var logger=require('../../config/logger')(_0x7048('0x7'));var config=require(_0x7048('0x8'));var jayson=require(_0x7048('0x9'));var client=jayson[_0x7048('0xa')]['http']({'port':0x232a});config[_0x7048('0xb')]=_[_0x7048('0xc')](config[_0x7048('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7048('0xd'))(new Redis(config['redis']));require(_0x7048('0xe'))[_0x7048('0xf')](socket);function respondWithRpcPromise(_0x375f3a,_0x162940,_0x118062){return new BPromise(function(_0x477512,_0x186cb3){return client['request'](_0x375f3a,_0x118062)[_0x7048('0x10')](function(_0x164ed9){logger[_0x7048('0x11')]('MailQueue,\x20%s,\x20%s',_0x162940,_0x7048('0x12'));logger[_0x7048('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x162940,_0x7048('0x12'),JSON[_0x7048('0x14')](_0x164ed9));if(_0x164ed9[_0x7048('0x15')]){if(_0x164ed9[_0x7048('0x15')][_0x7048('0x16')]===0x1f4){logger['error'](_0x7048('0x17'),_0x162940,_0x164ed9['error'][_0x7048('0x18')]);return _0x186cb3(_0x164ed9[_0x7048('0x15')][_0x7048('0x18')]);}logger[_0x7048('0x15')]('MailQueue,\x20%s,\x20%s',_0x162940,_0x164ed9[_0x7048('0x15')]['message']);return _0x477512(_0x164ed9[_0x7048('0x15')][_0x7048('0x18')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x162940,_0x7048('0x12'));_0x477512(_0x164ed9[_0x7048('0x19')][_0x7048('0x18')]);}})[_0x7048('0x1a')](function(_0x4865cd){logger[_0x7048('0x15')]('MailQueue,\x20%s,\x20%s',_0x162940,_0x4865cd);_0x186cb3(_0x4865cd);});});}exports['GetMailQueue']=function(_0x576bca){var _0x8f3e75=this;return new Promise(function(_0x416d25,_0xa83230){return db[_0x7048('0x1b')][_0x7048('0x1c')]({'raw':_0x576bca['options']?_0x576bca[_0x7048('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x576bca[_0x7048('0x1d')]?_0x576bca[_0x7048('0x1d')][_0x7048('0x1e')]||null:null,'attributes':_0x576bca[_0x7048('0x1d')]?_0x576bca[_0x7048('0x1d')][_0x7048('0x1f')]||null:null,'limit':_0x576bca['options']?_0x576bca['options']['limit']||null:null,'include':_0x576bca[_0x7048('0x1d')]?_0x576bca['options'][_0x7048('0x20')]?_[_0x7048('0x21')](_0x576bca[_0x7048('0x1d')]['include'],function(_0x1e0c61){return{'model':db[_0x1e0c61['model']],'as':_0x1e0c61['as'],'attributes':_0x1e0c61[_0x7048('0x1f')],'include':_0x1e0c61['include']?_[_0x7048('0x21')](_0x1e0c61[_0x7048('0x20')],function(_0x3fcd4c){return{'model':db[_0x3fcd4c['model']],'as':_0x3fcd4c['as'],'attributes':_0x3fcd4c[_0x7048('0x1f')],'include':_0x3fcd4c['include']?_[_0x7048('0x21')](_0x3fcd4c['include'],function(_0x228981){return{'model':db[_0x228981['model']],'as':_0x228981['as'],'attributes':_0x228981[_0x7048('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7048('0x10')](function(_0x52e437){logger['info']('GetMailQueue',_0x576bca);logger[_0x7048('0x13')](_0x7048('0x22'),_0x576bca,JSON['stringify'](_0x52e437));_0x416d25(_0x52e437);})[_0x7048('0x1a')](function(_0x550519){logger['error'](_0x7048('0x22'),_0x550519['message'],_0x576bca);_0xa83230(_0x8f3e75[_0x7048('0x15')](0x1f4,_0x550519[_0x7048('0x18')]));});});};exports[_0x7048('0x23')]=function(_0x3b6ad0){var _0xa3f2cb=this;return new Promise(function(_0x312358,_0x31b8db){return db[_0x7048('0x1b')][_0x7048('0x24')]({'raw':_0x3b6ad0['options']?_0x3b6ad0['options'][_0x7048('0x25')]===undefined?!![]:![]:!![],'where':_0x3b6ad0[_0x7048('0x1d')]?_0x3b6ad0[_0x7048('0x1d')]['where']||null:null,'attributes':_0x3b6ad0[_0x7048('0x1d')]?_0x3b6ad0[_0x7048('0x1d')][_0x7048('0x1f')]||null:null,'include':_0x3b6ad0[_0x7048('0x1d')]?_0x3b6ad0[_0x7048('0x1d')][_0x7048('0x20')]?_[_0x7048('0x21')](_0x3b6ad0[_0x7048('0x1d')][_0x7048('0x20')],function(_0x1251ae){return{'model':db[_0x1251ae[_0x7048('0x26')]],'as':_0x1251ae['as'],'attributes':_0x1251ae['attributes'],'include':_0x1251ae['include']?_[_0x7048('0x21')](_0x1251ae['include'],function(_0x28fbe9){return{'model':db[_0x28fbe9['model']],'as':_0x28fbe9['as'],'attributes':_0x28fbe9[_0x7048('0x1f')],'include':_0x28fbe9[_0x7048('0x20')]?_[_0x7048('0x21')](_0x28fbe9[_0x7048('0x20')],function(_0x5ac439){return{'model':db[_0x5ac439[_0x7048('0x26')]],'as':_0x5ac439['as'],'attributes':_0x5ac439[_0x7048('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7048('0x10')](function(_0x25deca){logger['info']('ShowMailQueue',_0x3b6ad0);logger[_0x7048('0x13')](_0x7048('0x23'),_0x3b6ad0,JSON[_0x7048('0x14')](_0x25deca));_0x312358(_0x25deca);})[_0x7048('0x1a')](function(_0x14df5b){logger[_0x7048('0x15')](_0x7048('0x23'),_0x14df5b[_0x7048('0x18')],_0x3b6ad0);_0x31b8db(_0xa3f2cb['error'](0x1f4,_0x14df5b[_0x7048('0x18')]));});});}; \ No newline at end of file +var _0xd68a=['stringify','error','MailQueue,\x20%s,\x20%s','message','result','MailQueue','options','raw','where','attributes','limit','include','model','then','GetMailQueue','catch','ShowMailQueue','map','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','info','request\x20sent','debug'];(function(_0x5bf221,_0x139837){var _0x7b00a8=function(_0x536a79){while(--_0x536a79){_0x5bf221['push'](_0x5bf221['shift']());}};_0x7b00a8(++_0x139837);}(_0xd68a,0xc6));var _0xad68=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xd68a[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xad68('0x0'));var util=require(_0xad68('0x1'));var moment=require(_0xad68('0x2'));var BPromise=require(_0xad68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad68('0x4'))['db'];var utils=require(_0xad68('0x5'));var logger=require(_0xad68('0x6'))(_0xad68('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad68('0x8')]['http']({'port':0x232a});config['redis']=_[_0xad68('0x9')](config[_0xad68('0xa')],{'host':_0xad68('0xb'),'port':0x18eb});var socket=require(_0xad68('0xc'))(new Redis(config[_0xad68('0xa')]));require(_0xad68('0xd'))[_0xad68('0xe')](socket);function respondWithRpcPromise(_0x25fc03,_0x50ddf1,_0x3c7c04){return new BPromise(function(_0x1a55b7,_0x55bdd0){return client['request'](_0x25fc03,_0x3c7c04)['then'](function(_0x5177c9){logger[_0xad68('0xf')]('MailQueue,\x20%s,\x20%s',_0x50ddf1,_0xad68('0x10'));logger[_0xad68('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x50ddf1,_0xad68('0x10'),JSON[_0xad68('0x12')](_0x5177c9));if(_0x5177c9[_0xad68('0x13')]){if(_0x5177c9[_0xad68('0x13')]['code']===0x1f4){logger['error'](_0xad68('0x14'),_0x50ddf1,_0x5177c9[_0xad68('0x13')]['message']);return _0x55bdd0(_0x5177c9['error']['message']);}logger[_0xad68('0x13')]('MailQueue,\x20%s,\x20%s',_0x50ddf1,_0x5177c9[_0xad68('0x13')][_0xad68('0x15')]);return _0x1a55b7(_0x5177c9[_0xad68('0x13')][_0xad68('0x15')]);}else{logger[_0xad68('0xf')]('MailQueue,\x20%s,\x20%s',_0x50ddf1,'request\x20sent');_0x1a55b7(_0x5177c9[_0xad68('0x16')][_0xad68('0x15')]);}})['catch'](function(_0x40d7d0){logger['error'](_0xad68('0x14'),_0x50ddf1,_0x40d7d0);_0x55bdd0(_0x40d7d0);});});}exports['GetMailQueue']=function(_0x578e77){var _0x3b4bff=this;return new Promise(function(_0x5c2a58,_0x463d40){return db[_0xad68('0x17')]['findAll']({'raw':_0x578e77[_0xad68('0x18')]?_0x578e77['options'][_0xad68('0x19')]===undefined?!![]:![]:!![],'where':_0x578e77[_0xad68('0x18')]?_0x578e77[_0xad68('0x18')][_0xad68('0x1a')]||null:null,'attributes':_0x578e77[_0xad68('0x18')]?_0x578e77[_0xad68('0x18')][_0xad68('0x1b')]||null:null,'limit':_0x578e77['options']?_0x578e77[_0xad68('0x18')][_0xad68('0x1c')]||null:null,'include':_0x578e77[_0xad68('0x18')]?_0x578e77['options'][_0xad68('0x1d')]?_['map'](_0x578e77[_0xad68('0x18')][_0xad68('0x1d')],function(_0x415eed){return{'model':db[_0x415eed['model']],'as':_0x415eed['as'],'attributes':_0x415eed[_0xad68('0x1b')],'include':_0x415eed['include']?_['map'](_0x415eed['include'],function(_0x171675){return{'model':db[_0x171675[_0xad68('0x1e')]],'as':_0x171675['as'],'attributes':_0x171675[_0xad68('0x1b')],'include':_0x171675[_0xad68('0x1d')]?_['map'](_0x171675[_0xad68('0x1d')],function(_0x267f34){return{'model':db[_0x267f34[_0xad68('0x1e')]],'as':_0x267f34['as'],'attributes':_0x267f34['attributes']};}):[]};}):[]};}):[]:[]})[_0xad68('0x1f')](function(_0x4c0d2f){logger['info'](_0xad68('0x20'),_0x578e77);logger[_0xad68('0x11')]('GetMailQueue',_0x578e77,JSON[_0xad68('0x12')](_0x4c0d2f));_0x5c2a58(_0x4c0d2f);})[_0xad68('0x21')](function(_0x30e23e){logger['error']('GetMailQueue',_0x30e23e[_0xad68('0x15')],_0x578e77);_0x463d40(_0x3b4bff[_0xad68('0x13')](0x1f4,_0x30e23e[_0xad68('0x15')]));});});};exports[_0xad68('0x22')]=function(_0x5cedd5){var _0x46b531=this;return new Promise(function(_0x293eb0,_0x533678){return db[_0xad68('0x17')]['find']({'raw':_0x5cedd5[_0xad68('0x18')]?_0x5cedd5[_0xad68('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5cedd5['options']?_0x5cedd5['options'][_0xad68('0x1a')]||null:null,'attributes':_0x5cedd5[_0xad68('0x18')]?_0x5cedd5[_0xad68('0x18')][_0xad68('0x1b')]||null:null,'include':_0x5cedd5[_0xad68('0x18')]?_0x5cedd5[_0xad68('0x18')][_0xad68('0x1d')]?_[_0xad68('0x23')](_0x5cedd5['options'][_0xad68('0x1d')],function(_0xc476bc){return{'model':db[_0xc476bc[_0xad68('0x1e')]],'as':_0xc476bc['as'],'attributes':_0xc476bc[_0xad68('0x1b')],'include':_0xc476bc['include']?_[_0xad68('0x23')](_0xc476bc[_0xad68('0x1d')],function(_0x47b819){return{'model':db[_0x47b819['model']],'as':_0x47b819['as'],'attributes':_0x47b819[_0xad68('0x1b')],'include':_0x47b819[_0xad68('0x1d')]?_['map'](_0x47b819[_0xad68('0x1d')],function(_0x647476){return{'model':db[_0x647476[_0xad68('0x1e')]],'as':_0x647476['as'],'attributes':_0x647476[_0xad68('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425114){logger['info'](_0xad68('0x22'),_0x5cedd5);logger[_0xad68('0x11')](_0xad68('0x22'),_0x5cedd5,JSON[_0xad68('0x12')](_0x425114));_0x293eb0(_0x425114);})[_0xad68('0x21')](function(_0x286844){logger[_0xad68('0x13')]('ShowMailQueue',_0x286844['message'],_0x5cedd5);_0x533678(_0x46b531['error'](0x1f4,_0x286844[_0xad68('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d442d2d..d925c14 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 _0xa810=['remove','update','emit','removeListener','length','./mailQueue.events'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xa810,0x101));var _0x0a81=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xa810[_0x5ce8b9];return _0xe34be0;};'use strict';var MailQueueEvents=require(_0x0a81('0x0'));var events=['save',_0x0a81('0x1'),_0x0a81('0x2')];function createListener(_0x33b312,_0xbef888){return function(_0x4465c6){_0xbef888[_0x0a81('0x3')](_0x33b312,_0x4465c6);};}function removeListener(_0x16f901,_0xbd6ce){return function(){MailQueueEvents[_0x0a81('0x4')](_0x16f901,_0xbd6ce);};}exports['register']=function(_0x10bce9){for(var _0x1cf7d1=0x0,_0x3d51d9=events[_0x0a81('0x5')];_0x1cf7d1<_0x3d51d9;_0x1cf7d1++){var _0x19f96a=events[_0x1cf7d1];var _0x5f040f=createListener('mailQueue:'+_0x19f96a,_0x10bce9);MailQueueEvents['on'](_0x19f96a,_0x5f040f);}}; \ No newline at end of file +var _0x221f=['./mailQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x1a62ec,_0x5357a1){var _0x1f114e=function(_0x1f99da){while(--_0x1f99da){_0x1a62ec['push'](_0x1a62ec['shift']());}};_0x1f114e(++_0x5357a1);}(_0x221f,0x19d));var _0xf221=function(_0x3a544a,_0x73a217){_0x3a544a=_0x3a544a-0x0;var _0x342f1e=_0x221f[_0x3a544a];return _0x342f1e;};'use strict';var MailQueueEvents=require(_0xf221('0x0'));var events=['save',_0xf221('0x1'),_0xf221('0x2')];function createListener(_0x4205c2,_0x57fd5b){return function(_0x2f0745){_0x57fd5b[_0xf221('0x3')](_0x4205c2,_0x2f0745);};}function removeListener(_0xe279d1,_0x363a9c){return function(){MailQueueEvents[_0xf221('0x4')](_0xe279d1,_0x363a9c);};}exports[_0xf221('0x5')]=function(_0x122935){for(var _0x4baae7=0x0,_0xe00b7=events[_0xf221('0x6')];_0x4baae7<_0xe00b7;_0x4baae7++){var _0x2c5c94=events[_0x4baae7];var _0x5a6e17=createListener('mailQueue:'+_0x2c5c94,_0x122935);MailQueueEvents['on'](_0x2c5c94,_0x5a6e17);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 220777e..da010b1 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 _0xa677=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xa677,0xff));var _0x7a67=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa677[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x7a67('0x0'));var util=require(_0x7a67('0x1'));var path=require(_0x7a67('0x2'));var timeout=require(_0x7a67('0x3'));var express=require(_0x7a67('0x4'));var router=express['Router']();var fs_extra=require(_0x7a67('0x5'));var auth=require(_0x7a67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a67('0x7'));var controller=require(_0x7a67('0x8'));router[_0x7a67('0x9')]('/',auth[_0x7a67('0xa')](),controller[_0x7a67('0xb')]);router[_0x7a67('0x9')](_0x7a67('0xc'),auth[_0x7a67('0xa')](),controller[_0x7a67('0xd')]);router[_0x7a67('0x9')](_0x7a67('0xe'),auth['isAuthenticated'](),controller[_0x7a67('0xf')]);router[_0x7a67('0x10')]('/',auth[_0x7a67('0xa')](),controller[_0x7a67('0x11')]);router[_0x7a67('0x12')](_0x7a67('0xe'),auth[_0x7a67('0xa')](),controller[_0x7a67('0x13')]);router[_0x7a67('0x14')]('/:id',auth[_0x7a67('0xa')](),controller[_0x7a67('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4d43=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','show','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x137cea,_0x20e60d){var _0x480882=function(_0x280975){while(--_0x280975){_0x137cea['push'](_0x137cea['shift']());}};_0x480882(++_0x20e60d);}(_0x4d43,0x100));var _0x34d4=function(_0x3c31d8,_0x5ae5d9){_0x3c31d8=_0x3c31d8-0x0;var _0xec33e0=_0x4d43[_0x3c31d8];return _0xec33e0;};'use strict';var multer=require(_0x34d4('0x0'));var util=require(_0x34d4('0x1'));var path=require('path');var timeout=require(_0x34d4('0x2'));var express=require(_0x34d4('0x3'));var router=express[_0x34d4('0x4')]();var fs_extra=require(_0x34d4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x34d4('0x6'));var config=require(_0x34d4('0x7'));var controller=require(_0x34d4('0x8'));router[_0x34d4('0x9')]('/',auth[_0x34d4('0xa')](),controller[_0x34d4('0xb')]);router[_0x34d4('0x9')]('/describe',auth[_0x34d4('0xa')](),controller[_0x34d4('0xc')]);router[_0x34d4('0x9')]('/:id',auth[_0x34d4('0xa')](),controller[_0x34d4('0xd')]);router['post']('/',auth[_0x34d4('0xa')](),controller[_0x34d4('0xe')]);router['put'](_0x34d4('0xf'),auth[_0x34d4('0xa')](),controller[_0x34d4('0x10')]);router[_0x34d4('0x11')](_0x34d4('0xf'),auth[_0x34d4('0xa')](),controller[_0x34d4('0x12')]);module[_0x34d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b0d4f40..c089af8 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 _0x5908=['moment','sequelize','STRING','DATE'];(function(_0x2cf885,_0x5af49a){var _0x16fa5e=function(_0x3c9314){while(--_0x3c9314){_0x2cf885['push'](_0x2cf885['shift']());}};_0x16fa5e(++_0x5af49a);}(_0x5908,0x84));var _0x8590=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5908[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0x8590('0x0'));var Sequelize=require(_0x8590('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8590('0x2')]},'joinAt':{'type':Sequelize[_0x8590('0x3')]},'leaveAt':{'type':Sequelize[_0x8590('0x3')]},'acceptAt':{'type':Sequelize[_0x8590('0x3')]},'exitAt':{'type':Sequelize[_0x8590('0x3')]},'reason':{'type':Sequelize[_0x8590('0x2')]}}; \ No newline at end of file +var _0x43c0=['moment','sequelize','exports','STRING','DATE'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x43c0,0x13b));var _0x043c=function(_0x390b80,_0x4d434b){_0x390b80=_0x390b80-0x0;var _0x4d857b=_0x43c0[_0x390b80];return _0x4d857b;};'use strict';var moment=require(_0x043c('0x0'));var Sequelize=require(_0x043c('0x1'));module[_0x043c('0x2')]={'uniqueid':{'type':Sequelize[_0x043c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x043c('0x3')]},'joinAt':{'type':Sequelize[_0x043c('0x4')]},'leaveAt':{'type':Sequelize[_0x043c('0x4')]},'acceptAt':{'type':Sequelize[_0x043c('0x4')]},'exitAt':{'type':Sequelize[_0x043c('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ee082c9..a5139ff 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 _0xfcbb=['destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','rows','catch','show','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x33268f,_0xc0b5f5){var _0x824e43=function(_0x6e1c83){while(--_0x6e1c83){_0x33268f['push'](_0x33268f['shift']());}};_0x824e43(++_0xc0b5f5);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x9acdcd,_0x396331){_0x9acdcd=_0x9acdcd-0x0;var _0x4b3e16=_0xfcbb[_0x9acdcd];return _0x4b3e16;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){_0xd4d29[_0xbfcb('0x1c')](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x1ca8c3,_0xf6dbb7){return function(_0x3ef71c){if(!_0x3ef71c){_0x1ca8c3[_0xbfcb('0x1a')](0x194);}return _0x3ef71c;};}function handleError(_0x3e954d,_0x2a1272){_0x2a1272=_0x2a1272||0x1f4;return function(_0x5cd703){logger[_0xbfcb('0x28')](_0x5cd703[_0xbfcb('0x29')]);if(_0x5cd703['name']){delete _0x5cd703[_0xbfcb('0x2a')];}_0x3e954d[_0xbfcb('0x1c')](_0x2a1272)[_0xbfcb('0x2b')](_0x5cd703);};}exports[_0xbfcb('0x2c')]=function(_0xf4b944,_0x3542e9){var _0x4069a7={},_0x1a5db2={},_0x434764={'count':0x0,'rows':[]};var _0x27606f=_['map'](db[_0xbfcb('0x2d')][_0xbfcb('0x2e')],function(_0x43c3c3){return{'name':_0x43c3c3[_0xbfcb('0x2f')],'type':_0x43c3c3[_0xbfcb('0x30')][_0xbfcb('0x31')]};});_0x1a5db2[_0xbfcb('0x32')]=_[_0xbfcb('0x33')](_0x27606f,_0xbfcb('0x2a'));_0x1a5db2['query']=_[_0xbfcb('0x34')](_0xf4b944[_0xbfcb('0x35')]);_0x1a5db2[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1a5db2['model'],_0x1a5db2['query']);_0x4069a7[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x1a5db2[_0xbfcb('0x32')],qs[_0xbfcb('0x39')](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x4069a7[_0xbfcb('0x38')]=_0x4069a7['attributes']['length']?_0x4069a7['attributes']:_0x1a5db2[_0xbfcb('0x32')];if(!_0xf4b944['query'][_0xbfcb('0x3a')](_0xbfcb('0x3b'))){_0x4069a7['limit']=qs['limit'](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x20')]);_0x4069a7[_0xbfcb('0x1e')]=qs[_0xbfcb('0x1e')](_0xf4b944['query'][_0xbfcb('0x1e')]);}_0x4069a7[_0xbfcb('0x3c')]=qs['sort'](_0xf4b944['query'][_0xbfcb('0x3d')]);_0x4069a7['where']=qs['filters'](_[_0xbfcb('0x3e')](_0xf4b944[_0xbfcb('0x35')],_0x1a5db2[_0xbfcb('0x36')]),_0x27606f);if(_0xf4b944[_0xbfcb('0x35')]['filter']){_0x4069a7[_0xbfcb('0x3f')]=_[_0xbfcb('0x40')](_0x4069a7[_0xbfcb('0x3f')],{'$or':_[_0xbfcb('0x33')](_0x27606f,function(_0x2289fd){if(_0x2289fd[_0xbfcb('0x30')]!=='VIRTUAL'){var _0x2fc01f={};_0x2fc01f[_0x2289fd['name']]={'$like':'%'+_0xf4b944[_0xbfcb('0x35')]['filter']+'%'};return _0x2fc01f;}})});}_0x4069a7=_[_0xbfcb('0x40')]({},_0x4069a7,_0xf4b944[_0xbfcb('0x41')]);var _0xe719cd={'where':_0x4069a7[_0xbfcb('0x3f')]};return db[_0xbfcb('0x2d')][_0xbfcb('0x21')](_0xe719cd)[_0xbfcb('0x26')](function(_0x149bd5){_0x434764[_0xbfcb('0x21')]=_0x149bd5;if(_0xf4b944[_0xbfcb('0x35')]['includeAll']){_0x4069a7[_0xbfcb('0x42')]=[{'all':!![]}];}return db[_0xbfcb('0x2d')]['findAll'](_0x4069a7);})[_0xbfcb('0x26')](function(_0x306ea4){_0x434764[_0xbfcb('0x43')]=_0x306ea4;return _0x434764;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x3542e9,_0x4069a7))[_0xbfcb('0x44')](handleError(_0x3542e9,null));};exports[_0xbfcb('0x45')]=function(_0x500e7c,_0x96691c){var _0x10ffa0={'raw':!![],'where':{'id':_0x500e7c['params']['id']}},_0x10ea4f={};_0x10ea4f[_0xbfcb('0x32')]=_[_0xbfcb('0x34')](db[_0xbfcb('0x2d')]['rawAttributes']);_0x10ea4f[_0xbfcb('0x35')]=_[_0xbfcb('0x34')](_0x500e7c['query']);_0x10ea4f['filters']=_[_0xbfcb('0x37')](_0x10ea4f[_0xbfcb('0x32')],_0x10ea4f['query']);_0x10ffa0[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x10ea4f['model'],qs[_0xbfcb('0x39')](_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x10ffa0[_0xbfcb('0x38')]=_0x10ffa0[_0xbfcb('0x38')][_0xbfcb('0x46')]?_0x10ffa0[_0xbfcb('0x38')]:_0x10ea4f[_0xbfcb('0x32')];if(_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x47')]){_0x10ffa0[_0xbfcb('0x42')]=[{'all':!![]}];}_0x10ffa0=_[_0xbfcb('0x40')]({},_0x10ffa0,_0x500e7c['options']);return db[_0xbfcb('0x2d')][_0xbfcb('0x48')](_0x10ffa0)[_0xbfcb('0x26')](handleEntityNotFound(_0x96691c,null))['then'](respondWithResult(_0x96691c,null))[_0xbfcb('0x44')](handleError(_0x96691c,null));};exports['create']=function(_0x4a3b40,_0x2dcfb3){return db[_0xbfcb('0x2d')][_0xbfcb('0x49')](_0x4a3b40['body'],{})[_0xbfcb('0x26')](respondWithResult(_0x2dcfb3,0xc9))['catch'](handleError(_0x2dcfb3,null));};exports['update']=function(_0x33725a,_0x588d32){if(_0x33725a[_0xbfcb('0x4a')]['id']){delete _0x33725a[_0xbfcb('0x4a')]['id'];}return db['MailQueueReport'][_0xbfcb('0x48')]({'where':{'id':_0x33725a['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x588d32,null))['then'](saveUpdates(_0x33725a[_0xbfcb('0x4a')],null))['then'](respondWithResult(_0x588d32,null))[_0xbfcb('0x44')](handleError(_0x588d32,null));};exports[_0xbfcb('0x27')]=function(_0x5efbe1,_0x131af7){return db['MailQueueReport']['find']({'where':{'id':_0x5efbe1[_0xbfcb('0x4b')]['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x131af7,null))[_0xbfcb('0x26')](removeEntity(_0x131af7,null))['catch'](handleError(_0x131af7,null));};exports['describe']=function(_0x19dca9,_0x931bf){return db[_0xbfcb('0x2d')][_0xbfcb('0x4c')]()[_0xbfcb('0x26')](respondWithResult(_0x931bf,null))['catch'](handleError(_0x931bf,null));}; \ No newline at end of file +var _0xb145=['includeAll','findAll','rows','catch','show','params','include','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x448ae1,_0x144bec){var _0xa75890=function(_0xf7d076){while(--_0xf7d076){_0x448ae1['push'](_0x448ae1['shift']());}};_0xa75890(++_0x144bec);}(_0xb145,0xa3));var _0x5b14=function(_0x4ccccd,_0x4dfbfc){_0x4ccccd=_0x4ccccd-0x0;var _0xb16b31=_0xb145[_0x4ccccd];return _0xb16b31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];function respondWithStatusCode(_0x1903a5,_0xc33723){_0xc33723=_0xc33723||0xcc;return function(_0x1cb56b){if(_0x1cb56b){return _0x1903a5[_0x5b14('0x19')](_0xc33723);}return _0x1903a5[_0x5b14('0x1a')](_0xc33723)['end']();};}function respondWithResult(_0x27b34b,_0x16f2a1){_0x16f2a1=_0x16f2a1||0xc8;return function(_0x35fb8b){if(_0x35fb8b){return _0x27b34b[_0x5b14('0x1a')](_0x16f2a1)[_0x5b14('0x1b')](_0x35fb8b);}};}function respondWithFilteredResult(_0x2a8fe5,_0x68f695){return function(_0xe5af75){if(_0xe5af75){var _0x183b0a=typeof _0x68f695[_0x5b14('0x1c')]===_0x5b14('0x1d')&&typeof _0x68f695[_0x5b14('0x1e')]==='undefined';var _0x24cfd0=_0xe5af75['count'];var _0x48d395=_0x183b0a?0x0:_0x68f695['offset'];var _0x3f397d=_0x183b0a?_0xe5af75[_0x5b14('0x1f')]:_0x68f695[_0x5b14('0x1c')]+_0x68f695[_0x5b14('0x1e')];var _0x3786f7;if(_0x3f397d>=_0x24cfd0){_0x3f397d=_0x24cfd0;_0x3786f7=0xc8;}else{_0x3786f7=0xce;}_0x2a8fe5[_0x5b14('0x1a')](_0x3786f7);return _0x2a8fe5[_0x5b14('0x20')]('Content-Range',_0x48d395+'-'+_0x3f397d+'/'+_0x24cfd0)['json'](_0xe5af75);}return null;};}function patchUpdates(_0x4fa079){return function(_0x4f4717){try{jsonpatch[_0x5b14('0x21')](_0x4f4717,_0x4fa079,!![]);}catch(_0x9a9495){return BPromise[_0x5b14('0x22')](_0x9a9495);}return _0x4f4717['save']();};}function saveUpdates(_0x1018d9,_0x1577f7){return function(_0x4857c7){if(_0x4857c7){return _0x4857c7[_0x5b14('0x23')](_0x1018d9)[_0x5b14('0x24')](function(_0x50951f){return _0x50951f;});}return null;};}function removeEntity(_0x33a293,_0x54073f){return function(_0x59282c){if(_0x59282c){return _0x59282c['destroy']()['then'](function(){_0x33a293[_0x5b14('0x1a')](0xcc)[_0x5b14('0x25')]();});}};}function handleEntityNotFound(_0x153a25,_0x5da505){return function(_0x46f86a){if(!_0x46f86a){_0x153a25[_0x5b14('0x19')](0x194);}return _0x46f86a;};}function handleError(_0x2ac7b0,_0x143648){_0x143648=_0x143648||0x1f4;return function(_0xe6851b){logger[_0x5b14('0x26')](_0xe6851b[_0x5b14('0x27')]);if(_0xe6851b[_0x5b14('0x28')]){delete _0xe6851b[_0x5b14('0x28')];}_0x2ac7b0[_0x5b14('0x1a')](_0x143648)[_0x5b14('0x29')](_0xe6851b);};}exports[_0x5b14('0x2a')]=function(_0x1c3c52,_0x266bbe){var _0x4cfd66={},_0x370fcd={},_0x18a76d={'count':0x0,'rows':[]};var _0x53b13d=_['map'](db[_0x5b14('0x2b')][_0x5b14('0x2c')],function(_0x5dca4f){return{'name':_0x5dca4f['fieldName'],'type':_0x5dca4f[_0x5b14('0x2d')]['key']};});_0x370fcd[_0x5b14('0x2e')]=_[_0x5b14('0x2f')](_0x53b13d,'name');_0x370fcd['query']=_[_0x5b14('0x30')](_0x1c3c52[_0x5b14('0x31')]);_0x370fcd[_0x5b14('0x32')]=_['intersection'](_0x370fcd[_0x5b14('0x2e')],_0x370fcd['query']);_0x4cfd66[_0x5b14('0x33')]=_[_0x5b14('0x34')](_0x370fcd[_0x5b14('0x2e')],qs[_0x5b14('0x35')](_0x1c3c52['query'][_0x5b14('0x35')]));_0x4cfd66[_0x5b14('0x33')]=_0x4cfd66[_0x5b14('0x33')][_0x5b14('0x36')]?_0x4cfd66['attributes']:_0x370fcd[_0x5b14('0x2e')];if(!_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x37')]('nolimit')){_0x4cfd66[_0x5b14('0x1e')]=qs['limit'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x1e')]);_0x4cfd66['offset']=qs[_0x5b14('0x1c')](_0x1c3c52[_0x5b14('0x31')]['offset']);}_0x4cfd66[_0x5b14('0x38')]=qs['sort'](_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x39')]);_0x4cfd66[_0x5b14('0x3a')]=qs[_0x5b14('0x32')](_['pick'](_0x1c3c52[_0x5b14('0x31')],_0x370fcd[_0x5b14('0x32')]),_0x53b13d);if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]){_0x4cfd66[_0x5b14('0x3a')]=_[_0x5b14('0x3c')](_0x4cfd66[_0x5b14('0x3a')],{'$or':_[_0x5b14('0x2f')](_0x53b13d,function(_0x4f647c){if(_0x4f647c[_0x5b14('0x2d')]!==_0x5b14('0x3d')){var _0x3f9d1d={};_0x3f9d1d[_0x4f647c[_0x5b14('0x28')]]={'$like':'%'+_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3b')]+'%'};return _0x3f9d1d;}})});}_0x4cfd66=_[_0x5b14('0x3c')]({},_0x4cfd66,_0x1c3c52['options']);var _0x2ebaa8={'where':_0x4cfd66['where']};return db[_0x5b14('0x2b')][_0x5b14('0x1f')](_0x2ebaa8)['then'](function(_0x4c05ac){_0x18a76d['count']=_0x4c05ac;if(_0x1c3c52[_0x5b14('0x31')][_0x5b14('0x3e')]){_0x4cfd66['include']=[{'all':!![]}];}return db[_0x5b14('0x2b')][_0x5b14('0x3f')](_0x4cfd66);})[_0x5b14('0x24')](function(_0x3d0369){_0x18a76d[_0x5b14('0x40')]=_0x3d0369;return _0x18a76d;})['then'](respondWithFilteredResult(_0x266bbe,_0x4cfd66))[_0x5b14('0x41')](handleError(_0x266bbe,null));};exports[_0x5b14('0x42')]=function(_0x4fb46e,_0x996aee){var _0x985e69={'raw':!![],'where':{'id':_0x4fb46e[_0x5b14('0x43')]['id']}},_0x5cc257={};_0x5cc257['model']=_[_0x5b14('0x30')](db[_0x5b14('0x2b')][_0x5b14('0x2c')]);_0x5cc257[_0x5b14('0x31')]=_['keys'](_0x4fb46e[_0x5b14('0x31')]);_0x5cc257[_0x5b14('0x32')]=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],_0x5cc257['query']);_0x985e69['attributes']=_[_0x5b14('0x34')](_0x5cc257[_0x5b14('0x2e')],qs['fields'](_0x4fb46e[_0x5b14('0x31')]['fields']));_0x985e69[_0x5b14('0x33')]=_0x985e69[_0x5b14('0x33')][_0x5b14('0x36')]?_0x985e69[_0x5b14('0x33')]:_0x5cc257[_0x5b14('0x2e')];if(_0x4fb46e['query'][_0x5b14('0x3e')]){_0x985e69[_0x5b14('0x44')]=[{'all':!![]}];}_0x985e69=_[_0x5b14('0x3c')]({},_0x985e69,_0x4fb46e[_0x5b14('0x45')]);return db[_0x5b14('0x2b')]['find'](_0x985e69)['then'](handleEntityNotFound(_0x996aee,null))[_0x5b14('0x24')](respondWithResult(_0x996aee,null))['catch'](handleError(_0x996aee,null));};exports['create']=function(_0x4825b4,_0x35d00d){return db[_0x5b14('0x2b')][_0x5b14('0x46')](_0x4825b4[_0x5b14('0x47')],{})[_0x5b14('0x24')](respondWithResult(_0x35d00d,0xc9))[_0x5b14('0x41')](handleError(_0x35d00d,null));};exports[_0x5b14('0x23')]=function(_0x4d2bee,_0x548e1c){if(_0x4d2bee['body']['id']){delete _0x4d2bee['body']['id'];}return db['MailQueueReport'][_0x5b14('0x48')]({'where':{'id':_0x4d2bee[_0x5b14('0x43')]['id']}})[_0x5b14('0x24')](handleEntityNotFound(_0x548e1c,null))[_0x5b14('0x24')](saveUpdates(_0x4d2bee[_0x5b14('0x47')],null))['then'](respondWithResult(_0x548e1c,null))['catch'](handleError(_0x548e1c,null));};exports[_0x5b14('0x49')]=function(_0xd6ea50,_0x58b18e){return db[_0x5b14('0x2b')][_0x5b14('0x48')]({'where':{'id':_0xd6ea50['params']['id']}})['then'](handleEntityNotFound(_0x58b18e,null))[_0x5b14('0x24')](removeEntity(_0x58b18e,null))[_0x5b14('0x41')](handleError(_0x58b18e,null));};exports[_0x5b14('0x4a')]=function(_0x5d3782,_0x1a51d5){return db[_0x5b14('0x2b')][_0x5b14('0x4a')]()[_0x5b14('0x24')](respondWithResult(_0x1a51d5,null))[_0x5b14('0x41')](handleError(_0x1a51d5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c8ce16e..dcb19db 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 _0x2f88=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0x591053,_0x523072){var _0x31ab80=function(_0x4a543f){while(--_0x4a543f){_0x591053['push'](_0x591053['shift']());}};_0x31ab80(++_0x523072);}(_0x2f88,0x14f));var _0x82f8=function(_0x1c21e5,_0xd7aae2){_0x1c21e5=_0x1c21e5-0x0;var _0x127441=_0x2f88[_0x1c21e5];return _0x127441;};'use strict';var _=require(_0x82f8('0x0'));var util=require(_0x82f8('0x1'));var logger=require(_0x82f8('0x2'))(_0x82f8('0x3'));var moment=require(_0x82f8('0x4'));var BPromise=require(_0x82f8('0x5'));var rp=require(_0x82f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f8('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x82f8('0x8')]=function(_0x40039f,_0x1e7f74){return _0x40039f[_0x82f8('0x9')](_0x82f8('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x82f8('0xb'),'fields':[_0x82f8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d9f=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash'];(function(_0x265029,_0xd1823b){var _0x41852e=function(_0x345f01){while(--_0x345f01){_0x265029['push'](_0x265029['shift']());}};_0x41852e(++_0xd1823b);}(_0x1d9f,0x167));var _0xf1d9=function(_0x360902,_0x14b396){_0x360902=_0x360902-0x0;var _0x4c199f=_0x1d9f[_0x360902];return _0x4c199f;};'use strict';var _=require(_0xf1d9('0x0'));var util=require(_0xf1d9('0x1'));var logger=require(_0xf1d9('0x2'))(_0xf1d9('0x3'));var moment=require('moment');var BPromise=require(_0xf1d9('0x4'));var rp=require(_0xf1d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf1d9('0x6'));var attributes=require(_0xf1d9('0x7'));module[_0xf1d9('0x8')]=function(_0x2f10de,_0x3e4408){return _0x2f10de[_0xf1d9('0x9')]('MailQueueReport',attributes,{'tableName':_0xf1d9('0xa'),'paranoid':![],'indexes':[{'name':_0xf1d9('0xb'),'fields':[_0xf1d9('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 6cd1f11..8fdbae0 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0x2ef3,0xba));var _0x32ef=function(_0x247045,_0x34c0dd){_0x247045=_0x247045-0x0;var _0x4b976b=_0x2ef3[_0x247045];return _0x4b976b;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x522f90,_0x5b9824){var _0x747188=function(_0x37353e){while(--_0x37353e){_0x522f90['push'](_0x522f90['shift']());}};_0x747188(++_0x5b9824);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 58dd76d..a975978 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4c589d,_0x4e1325){var _0x388965=function(_0x583b2c){while(--_0x583b2c){_0x4c589d['push'](_0x4c589d['shift']());}};_0x388965(++_0x4e1325);}(_0xedd9,0xfc));var _0x9edd=function(_0x16076a,_0x3cc440){_0x16076a=_0x16076a-0x0;var _0x45f4e6=_0xedd9[_0x16076a];return _0x45f4e6;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5ce143,_0x426112){var _0x3490ad=function(_0x38cbd8){while(--_0x38cbd8){_0x5ce143['push'](_0x5ce143['shift']());}};_0x3490ad(++_0x426112);}(_0xedd9,0xfc));var _0x9edd=function(_0x21b144,_0x48d472){_0x21b144=_0x21b144-0x0;var _0x2dbfb4=_0xedd9[_0x21b144];return _0x2dbfb4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a73329e..72f9fc2 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 _0x20c1=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x20c1,0x103));var _0x120c=function(_0x297d8f,_0x38cce6){_0x297d8f=_0x297d8f-0x0;var _0x532c78=_0x20c1[_0x297d8f];return _0x532c78;};'use strict';var Sequelize=require(_0x120c('0x0'));module[_0x120c('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x120c('0x2')]},'authentication':{'type':Sequelize[_0x120c('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x120c('0x2')]},'password':{'type':Sequelize[_0x120c('0x2')]},'port':{'type':Sequelize[_0x120c('0x4')]},'tls':{'type':Sequelize[_0x120c('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x120c('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x120c('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x120c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a6b=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2df2e7,_0xb0d148){var _0x40d0dd=function(_0x4d1e9b){while(--_0x4d1e9b){_0x2df2e7['push'](_0x2df2e7['shift']());}};_0x40d0dd(++_0xb0d148);}(_0x5a6b,0x8b));var _0xb5a6=function(_0x1d34e5,_0x37f9c8){_0x1d34e5=_0x1d34e5-0x0;var _0x1b073f=_0x5a6b[_0x1d34e5];return _0x1b073f;};'use strict';var Sequelize=require(_0xb5a6('0x0'));module[_0xb5a6('0x1')]={'description':{'type':Sequelize[_0xb5a6('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb5a6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb5a6('0x2')]},'password':{'type':Sequelize[_0xb5a6('0x2')]},'port':{'type':Sequelize[_0xb5a6('0x4')]},'tls':{'type':Sequelize[_0xb5a6('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xb5a6('0x5')},'connTimeout':{'type':Sequelize[_0xb5a6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb5a6('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xb5a6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 25dbc3b..1982136 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 _0x80dc=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x33feca,_0x2bd9ae){var _0x3c558f=function(_0x11bede){while(--_0x11bede){_0x33feca['push'](_0x33feca['shift']());}};_0x3c558f(++_0x2bd9ae);}(_0x80dc,0xaf));var _0xc80d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x80dc[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0xc80d('0x0'));var logger=require(_0xc80d('0x1'))('api');var moment=require(_0xc80d('0x2'));var BPromise=require(_0xc80d('0x3'));var rp=require(_0xc80d('0x4'));var fs=require('fs');var path=require(_0xc80d('0x5'));var rimraf=require(_0xc80d('0x6'));var config=require(_0xc80d('0x7'));var attributes=require(_0xc80d('0x8'));module[_0xc80d('0x9')]=function(_0x216eaf,_0x33d81f){return _0x216eaf[_0xc80d('0xa')](_0xc80d('0xb'),attributes,{'tableName':_0xc80d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99d2=['exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x23bba9,_0x2dbee5){var _0x14e2b6=function(_0x133b26){while(--_0x133b26){_0x23bba9['push'](_0x23bba9['shift']());}};_0x14e2b6(++_0x2dbee5);}(_0x99d2,0x1c7));var _0x299d=function(_0x5b3ce4,_0x5130c6){_0x5b3ce4=_0x5b3ce4-0x0;var _0x4c13cf=_0x99d2[_0x5b3ce4];return _0x4c13cf;};'use strict';var _=require(_0x299d('0x0'));var util=require(_0x299d('0x1'));var logger=require(_0x299d('0x2'))(_0x299d('0x3'));var moment=require('moment');var BPromise=require(_0x299d('0x4'));var rp=require(_0x299d('0x5'));var fs=require('fs');var path=require(_0x299d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x299d('0x7')]=function(_0x28e5d2,_0x1c62e6){return _0x28e5d2[_0x299d('0x8')](_0x299d('0x9'),attributes,{'tableName':_0x299d('0xa'),'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 c7dc174..4cca4b4 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 _0x2259=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3d0586,_0x23d340){var _0x3e82b0=function(_0x21a07a){while(--_0x21a07a){_0x3d0586['push'](_0x3d0586['shift']());}};_0x3e82b0(++_0x23d340);}(_0x2259,0x17c));var _0x9225=function(_0x4eae99,_0xd92836){_0x4eae99=_0x4eae99-0x0;var _0xe98d97=_0x2259[_0x4eae99];return _0xe98d97;};'use strict';var _=require(_0x9225('0x0'));var util=require(_0x9225('0x1'));var moment=require(_0x9225('0x2'));var BPromise=require(_0x9225('0x3'));var rs=require(_0x9225('0x4'));var fs=require('fs');var Redis=require(_0x9225('0x5'));var db=require(_0x9225('0x6'))['db'];var utils=require(_0x9225('0x7'));var logger=require('../../config/logger')(_0x9225('0x8'));var config=require(_0x9225('0x9'));var jayson=require(_0x9225('0xa'));var client=jayson[_0x9225('0xb')][_0x9225('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36bd31,_0x14d943,_0x46b110){return new BPromise(function(_0x238484,_0x17f6ea){return client[_0x9225('0xd')](_0x36bd31,_0x46b110)[_0x9225('0xe')](function(_0x49bdef){logger[_0x9225('0xf')](_0x9225('0x10'),_0x14d943,_0x9225('0x11'));logger[_0x9225('0x12')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x14d943,'request\x20sent',JSON['stringify'](_0x49bdef));if(_0x49bdef[_0x9225('0x13')]){if(_0x49bdef['error'][_0x9225('0x14')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x14d943,_0x49bdef[_0x9225('0x13')]['message']);return _0x17f6ea(_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);}logger['error'](_0x9225('0x10'),_0x14d943,_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);return _0x238484(_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);}else{logger['info'](_0x9225('0x10'),_0x14d943,_0x9225('0x11'));_0x238484(_0x49bdef[_0x9225('0x16')][_0x9225('0x15')]);}})[_0x9225('0x17')](function(_0x4c385d){logger[_0x9225('0x13')](_0x9225('0x10'),_0x14d943,_0x4c385d);_0x17f6ea(_0x4c385d);});});}exports[_0x9225('0x18')]=function(_0x4a0463){var _0x400e97=this;return new Promise(function(_0xf97e8,_0x5329bb){return db[_0x9225('0x19')][_0x9225('0x1a')]({'raw':_0x4a0463['options']?_0x4a0463[_0x9225('0x1b')][_0x9225('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a0463[_0x9225('0x1b')]?_0x4a0463['options'][_0x9225('0x1d')]||null:null,'attributes':_0x4a0463[_0x9225('0x1b')]?_0x4a0463[_0x9225('0x1b')]['attributes']||null:null,'limit':_0x4a0463[_0x9225('0x1b')]?_0x4a0463['options'][_0x9225('0x1e')]||null:null,'include':_0x4a0463['options']?_0x4a0463[_0x9225('0x1b')][_0x9225('0x1f')]?_[_0x9225('0x20')](_0x4a0463[_0x9225('0x1b')][_0x9225('0x1f')],function(_0x4c57dc){return{'model':db[_0x4c57dc[_0x9225('0x21')]],'as':_0x4c57dc['as'],'attributes':_0x4c57dc[_0x9225('0x22')],'include':_0x4c57dc[_0x9225('0x1f')]?_[_0x9225('0x20')](_0x4c57dc[_0x9225('0x1f')],function(_0xde65d4){return{'model':db[_0xde65d4['model']],'as':_0xde65d4['as'],'attributes':_0xde65d4[_0x9225('0x22')],'include':_0xde65d4[_0x9225('0x1f')]?_[_0x9225('0x20')](_0xde65d4['include'],function(_0xe52116){return{'model':db[_0xe52116[_0x9225('0x21')]],'as':_0xe52116['as'],'attributes':_0xe52116[_0x9225('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9225('0xe')](function(_0x1b4959){logger[_0x9225('0xf')](_0x9225('0x18'),_0x4a0463);logger[_0x9225('0x12')](_0x9225('0x18'),_0x4a0463,JSON[_0x9225('0x23')](_0x1b4959));_0xf97e8(_0x1b4959);})[_0x9225('0x17')](function(_0x27c8eb){logger[_0x9225('0x13')](_0x9225('0x18'),_0x27c8eb[_0x9225('0x15')],_0x4a0463);_0x5329bb(_0x400e97[_0x9225('0x13')](0x1f4,_0x27c8eb[_0x9225('0x15')]));});});}; \ No newline at end of file +var _0xea70=['info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5541b3,_0x2c8973){var _0x5884aa=function(_0x47fb48){while(--_0x47fb48){_0x5541b3['push'](_0x5541b3['shift']());}};_0x5884aa(++_0x2c8973);}(_0xea70,0x175));var _0x0ea7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea70[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var moment=require(_0x0ea7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ea7('0x5'))(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));var jayson=require(_0x0ea7('0x8'));var client=jayson[_0x0ea7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144497,_0x1ebefe,_0x51b516){return new BPromise(function(_0x48dedd,_0xc97410){return client['request'](_0x144497,_0x51b516)[_0x0ea7('0xa')](function(_0x107f04){logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,'request\x20sent');logger[_0x0ea7('0xd')](_0x0ea7('0xe'),_0x1ebefe,_0x0ea7('0xf'),JSON[_0x0ea7('0x10')](_0x107f04));if(_0x107f04[_0x0ea7('0x11')]){if(_0x107f04['error'][_0x0ea7('0x12')]===0x1f4){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04['error']['message']);return _0xc97410(_0x107f04['error'][_0x0ea7('0x13')]);}logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04[_0x0ea7('0x11')]['message']);return _0x48dedd(_0x107f04['error']['message']);}else{logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,_0x0ea7('0xf'));_0x48dedd(_0x107f04['result']['message']);}})[_0x0ea7('0x14')](function(_0x2aa4e9){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x2aa4e9);_0xc97410(_0x2aa4e9);});});}exports[_0x0ea7('0x15')]=function(_0x987032){var _0x1b1cb5=this;return new Promise(function(_0x48f10a,_0x4deb29){return db[_0x0ea7('0x16')][_0x0ea7('0x17')]({'raw':_0x987032['options']?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x19')]===undefined?!![]:![]:!![],'where':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1a')]||null:null,'attributes':_0x987032[_0x0ea7('0x18')]?_0x987032['options'][_0x0ea7('0x1b')]||null:null,'limit':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'include':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x1d')]?_[_0x0ea7('0x1e')](_0x987032['options'][_0x0ea7('0x1d')],function(_0x2a0f71){return{'model':db[_0x2a0f71[_0x0ea7('0x1f')]],'as':_0x2a0f71['as'],'attributes':_0x2a0f71['attributes'],'include':_0x2a0f71[_0x0ea7('0x1d')]?_[_0x0ea7('0x1e')](_0x2a0f71['include'],function(_0x3ba808){return{'model':db[_0x3ba808['model']],'as':_0x3ba808['as'],'attributes':_0x3ba808['attributes'],'include':_0x3ba808['include']?_[_0x0ea7('0x1e')](_0x3ba808[_0x0ea7('0x1d')],function(_0x462715){return{'model':db[_0x462715['model']],'as':_0x462715['as'],'attributes':_0x462715[_0x0ea7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ea7('0xa')](function(_0x608119){logger[_0x0ea7('0xb')](_0x0ea7('0x15'),_0x987032);logger[_0x0ea7('0xd')](_0x0ea7('0x15'),_0x987032,JSON[_0x0ea7('0x10')](_0x608119));_0x48f10a(_0x608119);})['catch'](function(_0x27e9fd){logger[_0x0ea7('0x11')]('GetMailServerIn',_0x27e9fd[_0x0ea7('0x13')],_0x987032);_0x4deb29(_0x1b1cb5[_0x0ea7('0x11')](0x1f4,_0x27e9fd[_0x0ea7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8cc2482..07e8fd4 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(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x262f76,_0x29e9af){_0x262f76=_0x262f76-0x0;var _0x2375a8=_0x7a54[_0x262f76];return _0x2375a8;};'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 1f0d6c9..f2ee842 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 _0x2f68=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x2e7106,_0x4bd339){var _0x37da9e=function(_0x515086){while(--_0x515086){_0x2e7106['push'](_0x2e7106['shift']());}};_0x37da9e(++_0x4bd339);}(_0x2f68,0x9a));var _0x82f6=function(_0x451104,_0x43f736){_0x451104=_0x451104-0x0;var _0x470781=_0x2f68[_0x451104];return _0x470781;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'description':{'type':Sequelize[_0x82f6('0x1')]},'host':{'type':Sequelize[_0x82f6('0x1')]},'user':{'type':Sequelize[_0x82f6('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x82f6('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x82f6('0x1')]},'authentication':{'type':Sequelize[_0x82f6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3de3=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x2ae240,_0x4a158b){var _0x3789f0=function(_0x2165a2){while(--_0x2165a2){_0x2ae240['push'](_0x2ae240['shift']());}};_0x3789f0(++_0x4a158b);}(_0x3de3,0x1ce));var _0x33de=function(_0x43a2ca,_0x4014b4){_0x43a2ca=_0x43a2ca-0x0;var _0x40ef89=_0x3de3[_0x43a2ca];return _0x40ef89;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'description':{'type':Sequelize[_0x33de('0x1')]},'host':{'type':Sequelize[_0x33de('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x33de('0x1')]},'port':{'type':Sequelize[_0x33de('0x2')]},'secure':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x33de('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 62d2b99..f0a2b72 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 _0xc750=['merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','map','MailServerOut','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc750,0xe9));var _0x0c75=function(_0x3a9f13,_0x3bbd11){_0x3a9f13=_0x3a9f13-0x0;var _0x5539bc=_0xc750[_0x3a9f13];return _0x5539bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0c75('0x0'));var rp=require(_0x0c75('0x1'));var moment=require(_0x0c75('0x2'));var BPromise=require(_0x0c75('0x3'));var Mustache=require(_0x0c75('0x4'));var util=require(_0x0c75('0x5'));var path=require(_0x0c75('0x6'));var sox=require(_0x0c75('0x7'));var csv=require(_0x0c75('0x8'));var ejs=require(_0x0c75('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0c75('0xa'));var crypto=require('crypto');var jsforce=require(_0x0c75('0xb'));var deskjs=require(_0x0c75('0xc'));var toCsv=require(_0x0c75('0x8'));var querystring=require(_0x0c75('0xd'));var Papa=require(_0x0c75('0xe'));var Redis=require(_0x0c75('0xf'));var authService=require(_0x0c75('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c75('0x11'));var hardwareService=require(_0x0c75('0x12'));var logger=require(_0x0c75('0x13'))('api');var utils=require(_0x0c75('0x14'));var config=require(_0x0c75('0x15'));var licenseUtil=require(_0x0c75('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303e1d,_0x533a4c){_0x533a4c=_0x533a4c||0xcc;return function(_0xd22e45){if(_0xd22e45){return _0x303e1d['sendStatus'](_0x533a4c);}return _0x303e1d[_0x0c75('0x17')](_0x533a4c)[_0x0c75('0x18')]();};}function respondWithResult(_0x1ddb60,_0x356d5e){_0x356d5e=_0x356d5e||0xc8;return function(_0x47619a){if(_0x47619a){return _0x1ddb60[_0x0c75('0x17')](_0x356d5e)[_0x0c75('0x19')](_0x47619a);}};}function respondWithFilteredResult(_0x248867,_0x1c8e1f){return function(_0x4d9c66){if(_0x4d9c66){var _0x4d4680=typeof _0x1c8e1f[_0x0c75('0x1a')]===_0x0c75('0x1b')&&typeof _0x1c8e1f[_0x0c75('0x1c')]===_0x0c75('0x1b');var _0x257345=_0x4d9c66[_0x0c75('0x1d')];var _0xaccfc3=_0x4d4680?0x0:_0x1c8e1f['offset'];var _0x4e52e3=_0x4d4680?_0x4d9c66[_0x0c75('0x1d')]:_0x1c8e1f['offset']+_0x1c8e1f['limit'];var _0x2fb050;if(_0x4e52e3>=_0x257345){_0x4e52e3=_0x257345;_0x2fb050=0xc8;}else{_0x2fb050=0xce;}_0x248867[_0x0c75('0x17')](_0x2fb050);return _0x248867[_0x0c75('0x1e')](_0x0c75('0x1f'),_0xaccfc3+'-'+_0x4e52e3+'/'+_0x257345)['json'](_0x4d9c66);}return null;};}function patchUpdates(_0x299121){return function(_0x90249c){try{jsonpatch[_0x0c75('0x20')](_0x90249c,_0x299121,!![]);}catch(_0x3e9ccb){return BPromise['reject'](_0x3e9ccb);}return _0x90249c[_0x0c75('0x21')]();};}function saveUpdates(_0x1f95ac,_0x358cd0){return function(_0x14ac8c){if(_0x14ac8c){return _0x14ac8c['update'](_0x1f95ac)[_0x0c75('0x22')](function(_0x21ffcc){return _0x21ffcc;});}return null;};}function removeEntity(_0x5ed071,_0x11c5a9){return function(_0x225d62){if(_0x225d62){return _0x225d62[_0x0c75('0x23')]()[_0x0c75('0x22')](function(){_0x5ed071[_0x0c75('0x17')](0xcc)[_0x0c75('0x18')]();});}};}function handleEntityNotFound(_0x75379c,_0x511e2c){return function(_0x1e526f){if(!_0x1e526f){_0x75379c[_0x0c75('0x24')](0x194);}return _0x1e526f;};}function handleError(_0x133950,_0x480832){_0x480832=_0x480832||0x1f4;return function(_0x1ab9fd){logger[_0x0c75('0x25')](_0x1ab9fd[_0x0c75('0x26')]);if(_0x1ab9fd['name']){delete _0x1ab9fd[_0x0c75('0x27')];}_0x133950[_0x0c75('0x17')](_0x480832)[_0x0c75('0x28')](_0x1ab9fd);};}exports['index']=function(_0x2af039,_0x54261c){var _0x1e0086={},_0x56881f={},_0x2439b6={'count':0x0,'rows':[]};var _0x16e1ef=_[_0x0c75('0x29')](db[_0x0c75('0x2a')]['rawAttributes'],function(_0x1f14e9){return{'name':_0x1f14e9['fieldName'],'type':_0x1f14e9['type'][_0x0c75('0x2b')]};});_0x56881f[_0x0c75('0x2c')]=_[_0x0c75('0x29')](_0x16e1ef,_0x0c75('0x27'));_0x56881f[_0x0c75('0x2d')]=_['keys'](_0x2af039['query']);_0x56881f[_0x0c75('0x2e')]=_['intersection'](_0x56881f[_0x0c75('0x2c')],_0x56881f[_0x0c75('0x2d')]);_0x1e0086[_0x0c75('0x2f')]=_[_0x0c75('0x30')](_0x56881f[_0x0c75('0x2c')],qs[_0x0c75('0x31')](_0x2af039[_0x0c75('0x2d')][_0x0c75('0x31')]));_0x1e0086['attributes']=_0x1e0086['attributes'][_0x0c75('0x32')]?_0x1e0086[_0x0c75('0x2f')]:_0x56881f[_0x0c75('0x2c')];if(!_0x2af039[_0x0c75('0x2d')][_0x0c75('0x33')](_0x0c75('0x34'))){_0x1e0086[_0x0c75('0x1c')]=qs[_0x0c75('0x1c')](_0x2af039[_0x0c75('0x2d')]['limit']);_0x1e0086[_0x0c75('0x1a')]=qs[_0x0c75('0x1a')](_0x2af039[_0x0c75('0x2d')][_0x0c75('0x1a')]);}_0x1e0086[_0x0c75('0x35')]=qs[_0x0c75('0x36')](_0x2af039[_0x0c75('0x2d')]['sort']);_0x1e0086['where']=qs[_0x0c75('0x2e')](_['pick'](_0x2af039[_0x0c75('0x2d')],_0x56881f[_0x0c75('0x2e')]),_0x16e1ef);if(_0x2af039['query']['filter']){_0x1e0086['where']=_[_0x0c75('0x37')](_0x1e0086[_0x0c75('0x38')],{'$or':_[_0x0c75('0x29')](_0x16e1ef,function(_0x33cdb5){if(_0x33cdb5[_0x0c75('0x39')]!==_0x0c75('0x3a')){var _0x2a1bc1={};_0x2a1bc1[_0x33cdb5[_0x0c75('0x27')]]={'$like':'%'+_0x2af039[_0x0c75('0x2d')][_0x0c75('0x3b')]+'%'};return _0x2a1bc1;}})});}_0x1e0086=_['merge']({},_0x1e0086,_0x2af039[_0x0c75('0x3c')]);var _0x5e0fb6={'where':_0x1e0086[_0x0c75('0x38')]};return db[_0x0c75('0x2a')]['count'](_0x5e0fb6)['then'](function(_0x3ace04){_0x2439b6['count']=_0x3ace04;if(_0x2af039[_0x0c75('0x2d')][_0x0c75('0x3d')]){_0x1e0086[_0x0c75('0x3e')]=[{'all':!![]}];}return db[_0x0c75('0x2a')][_0x0c75('0x3f')](_0x1e0086);})[_0x0c75('0x22')](function(_0x2bb150){_0x2439b6['rows']=_0x2bb150;return _0x2439b6;})['then'](respondWithFilteredResult(_0x54261c,_0x1e0086))[_0x0c75('0x40')](handleError(_0x54261c,null));};exports[_0x0c75('0x41')]=function(_0x1ca82b,_0x498531){var _0x1b24e3={'raw':!![],'where':{'id':_0x1ca82b['params']['id']}},_0x5afbd4={};_0x5afbd4['model']=_[_0x0c75('0x42')](db[_0x0c75('0x2a')][_0x0c75('0x43')]);_0x5afbd4[_0x0c75('0x2d')]=_['keys'](_0x1ca82b['query']);_0x5afbd4['filters']=_[_0x0c75('0x30')](_0x5afbd4[_0x0c75('0x2c')],_0x5afbd4[_0x0c75('0x2d')]);_0x1b24e3[_0x0c75('0x2f')]=_[_0x0c75('0x30')](_0x5afbd4[_0x0c75('0x2c')],qs[_0x0c75('0x31')](_0x1ca82b['query'][_0x0c75('0x31')]));_0x1b24e3[_0x0c75('0x2f')]=_0x1b24e3[_0x0c75('0x2f')]['length']?_0x1b24e3['attributes']:_0x5afbd4[_0x0c75('0x2c')];if(_0x1ca82b['query'][_0x0c75('0x3d')]){_0x1b24e3[_0x0c75('0x3e')]=[{'all':!![]}];}_0x1b24e3=_[_0x0c75('0x37')]({},_0x1b24e3,_0x1ca82b['options']);return db['MailServerOut'][_0x0c75('0x44')](_0x1b24e3)[_0x0c75('0x22')](handleEntityNotFound(_0x498531,null))['then'](respondWithResult(_0x498531,null))[_0x0c75('0x40')](handleError(_0x498531,null));};exports[_0x0c75('0x45')]=function(_0x134a09,_0x2ad2bf){return db[_0x0c75('0x2a')]['create'](_0x134a09[_0x0c75('0x46')],{})[_0x0c75('0x22')](respondWithResult(_0x2ad2bf,0xc9))[_0x0c75('0x40')](handleError(_0x2ad2bf,null));};exports['update']=function(_0x24780f,_0x400497){if(_0x24780f[_0x0c75('0x46')]['id']){delete _0x24780f['body']['id'];}return db[_0x0c75('0x2a')][_0x0c75('0x44')]({'where':{'id':_0x24780f[_0x0c75('0x47')]['id']}})[_0x0c75('0x22')](handleEntityNotFound(_0x400497,null))[_0x0c75('0x22')](saveUpdates(_0x24780f[_0x0c75('0x46')],null))['then'](respondWithResult(_0x400497,null))['catch'](handleError(_0x400497,null));};exports[_0x0c75('0x23')]=function(_0x3a7a4c,_0x5f0997){return db[_0x0c75('0x2a')][_0x0c75('0x44')]({'where':{'id':_0x3a7a4c[_0x0c75('0x47')]['id']}})[_0x0c75('0x22')](handleEntityNotFound(_0x5f0997,null))[_0x0c75('0x22')](removeEntity(_0x5f0997,null))[_0x0c75('0x40')](handleError(_0x5f0997,null));}; \ No newline at end of file +var _0xbc27=['update','then','destroy','error','stack','name','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x2cd2db,_0x590227){var _0xde6140=function(_0x19c020){while(--_0x19c020){_0x2cd2db['push'](_0x2cd2db['shift']());}};_0xde6140(++_0x590227);}(_0xbc27,0x1dd));var _0x7bc2=function(_0x2a27be,_0x5db239){_0x2a27be=_0x2a27be-0x0;var _0x4f9558=_0xbc27[_0x2a27be];return _0x4f9558;};'use strict';var emlformat=require(_0x7bc2('0x0'));var rimraf=require(_0x7bc2('0x1'));var zipdir=require(_0x7bc2('0x2'));var jsonpatch=require(_0x7bc2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bc2('0x4'));var Mustache=require(_0x7bc2('0x5'));var util=require('util');var path=require(_0x7bc2('0x6'));var sox=require(_0x7bc2('0x7'));var csv=require(_0x7bc2('0x8'));var ejs=require(_0x7bc2('0x9'));var fs=require('fs');var fs_extra=require(_0x7bc2('0xa'));var _=require('lodash');var squel=require(_0x7bc2('0xb'));var crypto=require(_0x7bc2('0xc'));var jsforce=require(_0x7bc2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bc2('0xe'));var Redis=require(_0x7bc2('0xf'));var authService=require(_0x7bc2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7bc2('0x11'));var hardwareService=require(_0x7bc2('0x12'));var logger=require('../../config/logger')(_0x7bc2('0x13'));var utils=require(_0x7bc2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7bc2('0x15'));var db=require(_0x7bc2('0x16'))['db'];function respondWithStatusCode(_0x16afd9,_0x37301e){_0x37301e=_0x37301e||0xcc;return function(_0x2bea96){if(_0x2bea96){return _0x16afd9[_0x7bc2('0x17')](_0x37301e);}return _0x16afd9[_0x7bc2('0x18')](_0x37301e)['end']();};}function respondWithResult(_0x3d6e49,_0x2a891f){_0x2a891f=_0x2a891f||0xc8;return function(_0x59dce5){if(_0x59dce5){return _0x3d6e49['status'](_0x2a891f)[_0x7bc2('0x19')](_0x59dce5);}};}function respondWithFilteredResult(_0x22f339,_0x389c23){return function(_0xb10bd6){if(_0xb10bd6){var _0x48b749=typeof _0x389c23[_0x7bc2('0x1a')]===_0x7bc2('0x1b')&&typeof _0x389c23[_0x7bc2('0x1c')]===_0x7bc2('0x1b');var _0x35b491=_0xb10bd6[_0x7bc2('0x1d')];var _0xbe8872=_0x48b749?0x0:_0x389c23[_0x7bc2('0x1a')];var _0x3c68c4=_0x48b749?_0xb10bd6[_0x7bc2('0x1d')]:_0x389c23[_0x7bc2('0x1a')]+_0x389c23[_0x7bc2('0x1c')];var _0x3c48dd;if(_0x3c68c4>=_0x35b491){_0x3c68c4=_0x35b491;_0x3c48dd=0xc8;}else{_0x3c48dd=0xce;}_0x22f339[_0x7bc2('0x18')](_0x3c48dd);return _0x22f339['set'](_0x7bc2('0x1e'),_0xbe8872+'-'+_0x3c68c4+'/'+_0x35b491)[_0x7bc2('0x19')](_0xb10bd6);}return null;};}function patchUpdates(_0x1b6b04){return function(_0x15ae8f){try{jsonpatch[_0x7bc2('0x1f')](_0x15ae8f,_0x1b6b04,!![]);}catch(_0x331a4f){return BPromise[_0x7bc2('0x20')](_0x331a4f);}return _0x15ae8f[_0x7bc2('0x21')]();};}function saveUpdates(_0x51471c,_0x597edc){return function(_0x4ca6a1){if(_0x4ca6a1){return _0x4ca6a1[_0x7bc2('0x22')](_0x51471c)[_0x7bc2('0x23')](function(_0x32b527){return _0x32b527;});}return null;};}function removeEntity(_0x1e4df3,_0xfc9b){return function(_0x2ca92c){if(_0x2ca92c){return _0x2ca92c[_0x7bc2('0x24')]()[_0x7bc2('0x23')](function(){_0x1e4df3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bda08,_0x5cc818){return function(_0x3eb452){if(!_0x3eb452){_0x2bda08[_0x7bc2('0x17')](0x194);}return _0x3eb452;};}function handleError(_0x2ab3fe,_0x1e7fd9){_0x1e7fd9=_0x1e7fd9||0x1f4;return function(_0x2c6879){logger[_0x7bc2('0x25')](_0x2c6879[_0x7bc2('0x26')]);if(_0x2c6879[_0x7bc2('0x27')]){delete _0x2c6879['name'];}_0x2ab3fe[_0x7bc2('0x18')](_0x1e7fd9)['send'](_0x2c6879);};}exports[_0x7bc2('0x28')]=function(_0x50b340,_0x5ec284){var _0x4ae8ad={},_0x8c8d0a={},_0x45af09={'count':0x0,'rows':[]};var _0x4b371c=_[_0x7bc2('0x29')](db[_0x7bc2('0x2a')]['rawAttributes'],function(_0x1dd4aa){return{'name':_0x1dd4aa[_0x7bc2('0x2b')],'type':_0x1dd4aa[_0x7bc2('0x2c')][_0x7bc2('0x2d')]};});_0x8c8d0a[_0x7bc2('0x2e')]=_['map'](_0x4b371c,_0x7bc2('0x27'));_0x8c8d0a[_0x7bc2('0x2f')]=_[_0x7bc2('0x30')](_0x50b340[_0x7bc2('0x2f')]);_0x8c8d0a[_0x7bc2('0x31')]=_[_0x7bc2('0x32')](_0x8c8d0a[_0x7bc2('0x2e')],_0x8c8d0a[_0x7bc2('0x2f')]);_0x4ae8ad[_0x7bc2('0x33')]=_[_0x7bc2('0x32')](_0x8c8d0a[_0x7bc2('0x2e')],qs[_0x7bc2('0x34')](_0x50b340[_0x7bc2('0x2f')][_0x7bc2('0x34')]));_0x4ae8ad['attributes']=_0x4ae8ad[_0x7bc2('0x33')][_0x7bc2('0x35')]?_0x4ae8ad['attributes']:_0x8c8d0a[_0x7bc2('0x2e')];if(!_0x50b340['query'][_0x7bc2('0x36')](_0x7bc2('0x37'))){_0x4ae8ad['limit']=qs[_0x7bc2('0x1c')](_0x50b340['query'][_0x7bc2('0x1c')]);_0x4ae8ad[_0x7bc2('0x1a')]=qs[_0x7bc2('0x1a')](_0x50b340[_0x7bc2('0x2f')]['offset']);}_0x4ae8ad[_0x7bc2('0x38')]=qs[_0x7bc2('0x39')](_0x50b340['query'][_0x7bc2('0x39')]);_0x4ae8ad[_0x7bc2('0x3a')]=qs[_0x7bc2('0x31')](_[_0x7bc2('0x3b')](_0x50b340[_0x7bc2('0x2f')],_0x8c8d0a[_0x7bc2('0x31')]),_0x4b371c);if(_0x50b340['query']['filter']){_0x4ae8ad[_0x7bc2('0x3a')]=_[_0x7bc2('0x3c')](_0x4ae8ad[_0x7bc2('0x3a')],{'$or':_[_0x7bc2('0x29')](_0x4b371c,function(_0x2262e9){if(_0x2262e9[_0x7bc2('0x2c')]!==_0x7bc2('0x3d')){var _0x36d127={};_0x36d127[_0x2262e9[_0x7bc2('0x27')]]={'$like':'%'+_0x50b340[_0x7bc2('0x2f')][_0x7bc2('0x3e')]+'%'};return _0x36d127;}})});}_0x4ae8ad=_['merge']({},_0x4ae8ad,_0x50b340[_0x7bc2('0x3f')]);var _0x255ecf={'where':_0x4ae8ad[_0x7bc2('0x3a')]};return db[_0x7bc2('0x2a')][_0x7bc2('0x1d')](_0x255ecf)['then'](function(_0x994026){_0x45af09['count']=_0x994026;if(_0x50b340[_0x7bc2('0x2f')][_0x7bc2('0x40')]){_0x4ae8ad['include']=[{'all':!![]}];}return db[_0x7bc2('0x2a')][_0x7bc2('0x41')](_0x4ae8ad);})[_0x7bc2('0x23')](function(_0x27b7aa){_0x45af09['rows']=_0x27b7aa;return _0x45af09;})[_0x7bc2('0x23')](respondWithFilteredResult(_0x5ec284,_0x4ae8ad))[_0x7bc2('0x42')](handleError(_0x5ec284,null));};exports[_0x7bc2('0x43')]=function(_0x197db7,_0x3e48eb){var _0x1def0e={'raw':!![],'where':{'id':_0x197db7[_0x7bc2('0x44')]['id']}},_0x472367={};_0x472367[_0x7bc2('0x2e')]=_[_0x7bc2('0x30')](db['MailServerOut'][_0x7bc2('0x45')]);_0x472367[_0x7bc2('0x2f')]=_[_0x7bc2('0x30')](_0x197db7[_0x7bc2('0x2f')]);_0x472367[_0x7bc2('0x31')]=_['intersection'](_0x472367[_0x7bc2('0x2e')],_0x472367[_0x7bc2('0x2f')]);_0x1def0e[_0x7bc2('0x33')]=_[_0x7bc2('0x32')](_0x472367[_0x7bc2('0x2e')],qs[_0x7bc2('0x34')](_0x197db7[_0x7bc2('0x2f')][_0x7bc2('0x34')]));_0x1def0e['attributes']=_0x1def0e['attributes'][_0x7bc2('0x35')]?_0x1def0e[_0x7bc2('0x33')]:_0x472367['model'];if(_0x197db7[_0x7bc2('0x2f')]['includeAll']){_0x1def0e[_0x7bc2('0x46')]=[{'all':!![]}];}_0x1def0e=_[_0x7bc2('0x3c')]({},_0x1def0e,_0x197db7[_0x7bc2('0x3f')]);return db[_0x7bc2('0x2a')]['find'](_0x1def0e)[_0x7bc2('0x23')](handleEntityNotFound(_0x3e48eb,null))['then'](respondWithResult(_0x3e48eb,null))[_0x7bc2('0x42')](handleError(_0x3e48eb,null));};exports['create']=function(_0x69e285,_0x36e9ee){return db[_0x7bc2('0x2a')]['create'](_0x69e285[_0x7bc2('0x47')],{})['then'](respondWithResult(_0x36e9ee,0xc9))['catch'](handleError(_0x36e9ee,null));};exports[_0x7bc2('0x22')]=function(_0x21ec36,_0x5dde55){if(_0x21ec36[_0x7bc2('0x47')]['id']){delete _0x21ec36['body']['id'];}return db[_0x7bc2('0x2a')][_0x7bc2('0x48')]({'where':{'id':_0x21ec36['params']['id']}})['then'](handleEntityNotFound(_0x5dde55,null))['then'](saveUpdates(_0x21ec36[_0x7bc2('0x47')],null))[_0x7bc2('0x23')](respondWithResult(_0x5dde55,null))['catch'](handleError(_0x5dde55,null));};exports[_0x7bc2('0x24')]=function(_0x52897a,_0x46fe26){return db[_0x7bc2('0x2a')][_0x7bc2('0x48')]({'where':{'id':_0x52897a[_0x7bc2('0x44')]['id']}})['then'](handleEntityNotFound(_0x46fe26,null))[_0x7bc2('0x23')](removeEntity(_0x46fe26,null))[_0x7bc2('0x42')](handleError(_0x46fe26,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index dbf98e4..4cacd88 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 _0x84a6=['path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5c3cfa,_0x382057){var _0x330a8b=function(_0x297543){while(--_0x297543){_0x5c3cfa['push'](_0x5c3cfa['shift']());}};_0x330a8b(++_0x382057);}(_0x84a6,0x18d));var _0x684a=function(_0x4b1012,_0x1415eb){_0x4b1012=_0x4b1012-0x0;var _0x23d715=_0x84a6[_0x4b1012];return _0x23d715;};'use strict';var _=require(_0x684a('0x0'));var util=require(_0x684a('0x1'));var logger=require('../../config/logger')(_0x684a('0x2'));var moment=require(_0x684a('0x3'));var BPromise=require(_0x684a('0x4'));var rp=require(_0x684a('0x5'));var fs=require('fs');var path=require(_0x684a('0x6'));var rimraf=require(_0x684a('0x7'));var config=require(_0x684a('0x8'));var attributes=require('./mailServerOut.attributes');module[_0x684a('0x9')]=function(_0x43e295,_0x25a4a9){return _0x43e295[_0x684a('0xa')](_0x684a('0xb'),attributes,{'tableName':_0x684a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0323=['bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x42907e,_0x5de9c5){var _0x176db7=function(_0x5930e0){while(--_0x5930e0){_0x42907e['push'](_0x42907e['shift']());}};_0x176db7(++_0x5de9c5);}(_0x0323,0x134));var _0x3032=function(_0x31d9c6,_0x1c9109){_0x31d9c6=_0x31d9c6-0x0;var _0x1371c0=_0x0323[_0x31d9c6];return _0x1371c0;};'use strict';var _=require(_0x3032('0x0'));var util=require(_0x3032('0x1'));var logger=require(_0x3032('0x2'))(_0x3032('0x3'));var moment=require('moment');var BPromise=require(_0x3032('0x4'));var rp=require(_0x3032('0x5'));var fs=require('fs');var path=require(_0x3032('0x6'));var rimraf=require('rimraf');var config=require(_0x3032('0x7'));var attributes=require(_0x3032('0x8'));module[_0x3032('0x9')]=function(_0x592c52,_0x1adefb){return _0x592c52[_0x3032('0xa')](_0x3032('0xb'),attributes,{'tableName':_0x3032('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 87cea46..7723a94 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x36f0aa,_0x142a17){var _0x1b0f8a=function(_0x255e48){while(--_0x255e48){_0x36f0aa['push'](_0x36f0aa['shift']());}};_0x1b0f8a(++_0x142a17);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'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')]('MailServerOut,\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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3ed95e,_0x2d2d13){var _0x4ab531=function(_0x4823b4){while(--_0x4823b4){_0x3ed95e['push'](_0x3ed95e['shift']());}};_0x4ab531(++_0x2d2d13);}(_0xadb5,0xad));var _0x5adb=function(_0x23d4f5,_0x1af9c4){_0x23d4f5=_0x23d4f5-0x0;var _0x1563f3=_0xadb5[_0x23d4f5];return _0x1563f3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b8298bf..04be328 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 _0x1250=['Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0x1250,0x10f));var _0x0125=function(_0x38d796,_0x28b58e){_0x38d796=_0x38d796-0x0;var _0x452ce3=_0x1250[_0x38d796];return _0x452ce3;};'use strict';var multer=require(_0x0125('0x0'));var util=require(_0x0125('0x1'));var path=require(_0x0125('0x2'));var timeout=require(_0x0125('0x3'));var express=require(_0x0125('0x4'));var router=express[_0x0125('0x5')]();var fs_extra=require(_0x0125('0x6'));var auth=require(_0x0125('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0125('0x8'));var controller=require(_0x0125('0x9'));router[_0x0125('0xa')]('/',auth[_0x0125('0xb')](),controller[_0x0125('0xc')]);router[_0x0125('0xa')](_0x0125('0xd'),auth[_0x0125('0xb')](),controller[_0x0125('0xe')]);router[_0x0125('0xa')](_0x0125('0xf'),auth[_0x0125('0xb')](),controller[_0x0125('0x10')]);router['post']('/',auth[_0x0125('0xb')](),controller[_0x0125('0x11')]);router[_0x0125('0x12')](_0x0125('0xf'),auth[_0x0125('0xb')](),controller[_0x0125('0x13')]);router[_0x0125('0x14')](_0x0125('0xf'),auth[_0x0125('0xb')](),controller[_0x0125('0x15')]);module[_0x0125('0x16')]=router; \ No newline at end of file +var _0xe331=['path','connect-timeout','express','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x58cedc,_0x4d7b72){var _0x183884=function(_0x5b5473){while(--_0x5b5473){_0x58cedc['push'](_0x58cedc['shift']());}};_0x183884(++_0x4d7b72);}(_0xe331,0x18d));var _0x1e33=function(_0x2e8c9a,_0x1658f4){_0x2e8c9a=_0x2e8c9a-0x0;var _0xe24e6d=_0xe331[_0x2e8c9a];return _0xe24e6d;};'use strict';var multer=require(_0x1e33('0x0'));var util=require(_0x1e33('0x1'));var path=require(_0x1e33('0x2'));var timeout=require(_0x1e33('0x3'));var express=require(_0x1e33('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1e33('0x5'));var config=require('../../config/environment');var controller=require(_0x1e33('0x6'));router['get']('/',auth[_0x1e33('0x7')](),controller[_0x1e33('0x8')]);router[_0x1e33('0x9')](_0x1e33('0xa'),auth['isAuthenticated'](),controller[_0x1e33('0xb')]);router[_0x1e33('0x9')](_0x1e33('0xc'),auth[_0x1e33('0x7')](),controller[_0x1e33('0xd')]);router[_0x1e33('0xe')]('/',auth[_0x1e33('0x7')](),controller['create']);router[_0x1e33('0xf')](_0x1e33('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1e33('0x10')](_0x1e33('0xc'),auth[_0x1e33('0x7')](),controller[_0x1e33('0x11')]);module[_0x1e33('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8691842..fa00425 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 _0xb138=['name','sequelize','exports','STRING'];(function(_0x33d7d1,_0x573b4d){var _0x40755f=function(_0x8ac8c){while(--_0x8ac8c){_0x33d7d1['push'](_0x33d7d1['shift']());}};_0x40755f(++_0x573b4d);}(_0xb138,0x1dd));var _0x8b13=function(_0x4f021c,_0x4a276b){_0x4f021c=_0x4f021c-0x0;var _0x40a606=_0xb138[_0x4f021c];return _0x40a606;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'unique':_0x8b13('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8b13('0x2')]}}; \ No newline at end of file +var _0x5fab=['exports','name','STRING','sequelize'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x5fab,0x177));var _0xb5fa=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x5fab[_0x320b8e];return _0x55a10a;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb5fa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 94ef4e1..adcb32e 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 _0x4cc7=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x389b98,_0xf715db){var _0x377c89=function(_0x3649a7){while(--_0x3649a7){_0x389b98['push'](_0x389b98['shift']());}};_0x377c89(++_0xf715db);}(_0x4cc7,0x150));var _0x74cc=function(_0x2ac98d,_0x51042a){_0x2ac98d=_0x2ac98d-0x0;var _0x42921b=_0x4cc7[_0x2ac98d];return _0x42921b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x74cc('0x0'));var jsonpatch=require(_0x74cc('0x1'));var rp=require(_0x74cc('0x2'));var moment=require(_0x74cc('0x3'));var BPromise=require(_0x74cc('0x4'));var Mustache=require(_0x74cc('0x5'));var util=require(_0x74cc('0x6'));var path=require('path');var sox=require(_0x74cc('0x7'));var csv=require(_0x74cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74cc('0x9'));var _=require(_0x74cc('0xa'));var squel=require(_0x74cc('0xb'));var crypto=require(_0x74cc('0xc'));var jsforce=require(_0x74cc('0xd'));var deskjs=require(_0x74cc('0xe'));var toCsv=require(_0x74cc('0x8'));var querystring=require(_0x74cc('0xf'));var Papa=require(_0x74cc('0x10'));var Redis=require(_0x74cc('0x11'));var authService=require(_0x74cc('0x12'));var qs=require(_0x74cc('0x13'));var as=require(_0x74cc('0x14'));var hardwareService=require(_0x74cc('0x15'));var logger=require(_0x74cc('0x16'))(_0x74cc('0x17'));var utils=require(_0x74cc('0x18'));var config=require(_0x74cc('0x19'));var licenseUtil=require(_0x74cc('0x1a'));var db=require(_0x74cc('0x1b'))['db'];function respondWithStatusCode(_0x531a8a,_0x598868){_0x598868=_0x598868||0xcc;return function(_0x1c0a4f){if(_0x1c0a4f){return _0x531a8a[_0x74cc('0x1c')](_0x598868);}return _0x531a8a[_0x74cc('0x1d')](_0x598868)[_0x74cc('0x1e')]();};}function respondWithResult(_0x5d9c57,_0x1fa289){_0x1fa289=_0x1fa289||0xc8;return function(_0x13c9c8){if(_0x13c9c8){return _0x5d9c57['status'](_0x1fa289)['json'](_0x13c9c8);}};}function respondWithFilteredResult(_0xef368c,_0x498a51){return function(_0x1166a8){if(_0x1166a8){var _0x480186=typeof _0x498a51[_0x74cc('0x1f')]==='undefined'&&typeof _0x498a51[_0x74cc('0x20')]===_0x74cc('0x21');var _0x306969=_0x1166a8[_0x74cc('0x22')];var _0x411b60=_0x480186?0x0:_0x498a51[_0x74cc('0x1f')];var _0x5978fc=_0x480186?_0x1166a8[_0x74cc('0x22')]:_0x498a51[_0x74cc('0x1f')]+_0x498a51[_0x74cc('0x20')];var _0xe93f01;if(_0x5978fc>=_0x306969){_0x5978fc=_0x306969;_0xe93f01=0xc8;}else{_0xe93f01=0xce;}_0xef368c[_0x74cc('0x1d')](_0xe93f01);return _0xef368c['set'](_0x74cc('0x23'),_0x411b60+'-'+_0x5978fc+'/'+_0x306969)['json'](_0x1166a8);}return null;};}function patchUpdates(_0x224755){return function(_0x33702b){try{jsonpatch[_0x74cc('0x24')](_0x33702b,_0x224755,!![]);}catch(_0x37da14){return BPromise[_0x74cc('0x25')](_0x37da14);}return _0x33702b[_0x74cc('0x26')]();};}function saveUpdates(_0x48ad67,_0x4872a5){return function(_0x4d8a5d){if(_0x4d8a5d){return _0x4d8a5d[_0x74cc('0x27')](_0x48ad67)[_0x74cc('0x28')](function(_0x5e88d9){return _0x5e88d9;});}return null;};}function removeEntity(_0x32e70d,_0x585264){return function(_0x388e77){if(_0x388e77){return _0x388e77[_0x74cc('0x29')]()['then'](function(){_0x32e70d[_0x74cc('0x1d')](0xcc)[_0x74cc('0x1e')]();});}};}function handleEntityNotFound(_0xe0bffd,_0x397ad9){return function(_0x5ec145){if(!_0x5ec145){_0xe0bffd[_0x74cc('0x1c')](0x194);}return _0x5ec145;};}function handleError(_0x2dedc7,_0x7d29b3){_0x7d29b3=_0x7d29b3||0x1f4;return function(_0x564535){logger[_0x74cc('0x2a')](_0x564535[_0x74cc('0x2b')]);if(_0x564535[_0x74cc('0x2c')]){delete _0x564535[_0x74cc('0x2c')];}_0x2dedc7['status'](_0x7d29b3)[_0x74cc('0x2d')](_0x564535);};}exports[_0x74cc('0x2e')]=function(_0x3fe7ee,_0x1a7c0d){var _0x155ad2={},_0x10a1c3={},_0x506a80={'count':0x0,'rows':[]};var _0x31b122=_[_0x74cc('0x2f')](db[_0x74cc('0x30')]['rawAttributes'],function(_0xa16f9b){return{'name':_0xa16f9b[_0x74cc('0x31')],'type':_0xa16f9b[_0x74cc('0x32')]['key']};});_0x10a1c3[_0x74cc('0x33')]=_[_0x74cc('0x2f')](_0x31b122,_0x74cc('0x2c'));_0x10a1c3[_0x74cc('0x34')]=_[_0x74cc('0x35')](_0x3fe7ee[_0x74cc('0x34')]);_0x10a1c3[_0x74cc('0x36')]=_[_0x74cc('0x37')](_0x10a1c3['model'],_0x10a1c3['query']);_0x155ad2[_0x74cc('0x38')]=_[_0x74cc('0x37')](_0x10a1c3[_0x74cc('0x33')],qs['fields'](_0x3fe7ee['query'][_0x74cc('0x39')]));_0x155ad2[_0x74cc('0x38')]=_0x155ad2[_0x74cc('0x38')][_0x74cc('0x3a')]?_0x155ad2[_0x74cc('0x38')]:_0x10a1c3['model'];if(!_0x3fe7ee['query'][_0x74cc('0x3b')](_0x74cc('0x3c'))){_0x155ad2[_0x74cc('0x20')]=qs[_0x74cc('0x20')](_0x3fe7ee[_0x74cc('0x34')][_0x74cc('0x20')]);_0x155ad2[_0x74cc('0x1f')]=qs[_0x74cc('0x1f')](_0x3fe7ee['query'][_0x74cc('0x1f')]);}_0x155ad2[_0x74cc('0x3d')]=qs[_0x74cc('0x3e')](_0x3fe7ee[_0x74cc('0x34')]['sort']);_0x155ad2['where']=qs[_0x74cc('0x36')](_[_0x74cc('0x3f')](_0x3fe7ee[_0x74cc('0x34')],_0x10a1c3['filters']),_0x31b122);if(_0x3fe7ee[_0x74cc('0x34')][_0x74cc('0x40')]){_0x155ad2[_0x74cc('0x41')]=_[_0x74cc('0x42')](_0x155ad2[_0x74cc('0x41')],{'$or':_[_0x74cc('0x2f')](_0x31b122,function(_0x29ab40){if(_0x29ab40['type']!==_0x74cc('0x43')){var _0xa9b84e={};_0xa9b84e[_0x29ab40[_0x74cc('0x2c')]]={'$like':'%'+_0x3fe7ee[_0x74cc('0x34')][_0x74cc('0x40')]+'%'};return _0xa9b84e;}})});}_0x155ad2=_[_0x74cc('0x42')]({},_0x155ad2,_0x3fe7ee[_0x74cc('0x44')]);var _0x51ff20={'where':_0x155ad2[_0x74cc('0x41')]};return db['MailSubstatus']['count'](_0x51ff20)[_0x74cc('0x28')](function(_0x25fc43){_0x506a80[_0x74cc('0x22')]=_0x25fc43;if(_0x3fe7ee['query'][_0x74cc('0x45')]){_0x155ad2[_0x74cc('0x46')]=[{'all':!![]}];}return db[_0x74cc('0x30')]['findAll'](_0x155ad2);})['then'](function(_0x152066){_0x506a80[_0x74cc('0x47')]=_0x152066;return _0x506a80;})['then'](respondWithFilteredResult(_0x1a7c0d,_0x155ad2))[_0x74cc('0x48')](handleError(_0x1a7c0d,null));};exports[_0x74cc('0x49')]=function(_0x18bf5c,_0x4ee8ae){var _0x3f829d={'raw':!![],'where':{'id':_0x18bf5c[_0x74cc('0x4a')]['id']}},_0x509432={};_0x509432[_0x74cc('0x33')]=_[_0x74cc('0x35')](db['MailSubstatus'][_0x74cc('0x4b')]);_0x509432[_0x74cc('0x34')]=_[_0x74cc('0x35')](_0x18bf5c[_0x74cc('0x34')]);_0x509432[_0x74cc('0x36')]=_[_0x74cc('0x37')](_0x509432[_0x74cc('0x33')],_0x509432[_0x74cc('0x34')]);_0x3f829d['attributes']=_[_0x74cc('0x37')](_0x509432['model'],qs[_0x74cc('0x39')](_0x18bf5c[_0x74cc('0x34')][_0x74cc('0x39')]));_0x3f829d[_0x74cc('0x38')]=_0x3f829d['attributes'][_0x74cc('0x3a')]?_0x3f829d['attributes']:_0x509432[_0x74cc('0x33')];if(_0x18bf5c['query']['includeAll']){_0x3f829d[_0x74cc('0x46')]=[{'all':!![]}];}_0x3f829d=_[_0x74cc('0x42')]({},_0x3f829d,_0x18bf5c[_0x74cc('0x44')]);return db[_0x74cc('0x30')][_0x74cc('0x4c')](_0x3f829d)[_0x74cc('0x28')](handleEntityNotFound(_0x4ee8ae,null))[_0x74cc('0x28')](respondWithResult(_0x4ee8ae,null))[_0x74cc('0x48')](handleError(_0x4ee8ae,null));};exports['create']=function(_0x26b428,_0x1ccf82){return db['MailSubstatus']['create'](_0x26b428[_0x74cc('0x4d')],{})[_0x74cc('0x28')](respondWithResult(_0x1ccf82,0xc9))[_0x74cc('0x48')](handleError(_0x1ccf82,null));};exports[_0x74cc('0x27')]=function(_0x7ce672,_0x898225){if(_0x7ce672[_0x74cc('0x4d')]['id']){delete _0x7ce672[_0x74cc('0x4d')]['id'];}return db['MailSubstatus'][_0x74cc('0x4c')]({'where':{'id':_0x7ce672['params']['id']}})['then'](handleEntityNotFound(_0x898225,null))[_0x74cc('0x28')](saveUpdates(_0x7ce672[_0x74cc('0x4d')],null))[_0x74cc('0x28')](respondWithResult(_0x898225,null))[_0x74cc('0x48')](handleError(_0x898225,null));};exports['destroy']=function(_0x96f20b,_0x544503){return db[_0x74cc('0x30')]['find']({'where':{'id':_0x96f20b['params']['id']}})['then'](handleEntityNotFound(_0x544503,null))[_0x74cc('0x28')](removeEntity(_0x544503,null))[_0x74cc('0x48')](handleError(_0x544503,null));};exports['describe']=function(_0x2c92f7,_0x143a25){return db[_0x74cc('0x30')][_0x74cc('0x4e')]()['then'](respondWithResult(_0x143a25,null))[_0x74cc('0x48')](handleError(_0x143a25,null));}; \ No newline at end of file +var _0x8840=['attributes','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8840,0x13c));var _0x0884=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0x8840[_0x36103d];return _0x4edadd;};'use strict';var emlformat=require(_0x0884('0x0'));var rimraf=require(_0x0884('0x1'));var zipdir=require(_0x0884('0x2'));var jsonpatch=require(_0x0884('0x3'));var rp=require(_0x0884('0x4'));var moment=require('moment');var BPromise=require(_0x0884('0x5'));var Mustache=require('mustache');var util=require(_0x0884('0x6'));var path=require(_0x0884('0x7'));var sox=require(_0x0884('0x8'));var csv=require('to-csv');var ejs=require(_0x0884('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0884('0xa'));var squel=require(_0x0884('0xb'));var crypto=require(_0x0884('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0884('0xd'));var toCsv=require(_0x0884('0xe'));var querystring=require('querystring');var Papa=require(_0x0884('0xf'));var Redis=require('ioredis');var authService=require(_0x0884('0x10'));var qs=require(_0x0884('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0884('0x12'));var logger=require(_0x0884('0x13'))('api');var utils=require(_0x0884('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0884('0x15'));var db=require(_0x0884('0x16'))['db'];function respondWithStatusCode(_0x47f5c3,_0x40d3dc){_0x40d3dc=_0x40d3dc||0xcc;return function(_0xc6fcfc){if(_0xc6fcfc){return _0x47f5c3[_0x0884('0x17')](_0x40d3dc);}return _0x47f5c3[_0x0884('0x18')](_0x40d3dc)[_0x0884('0x19')]();};}function respondWithResult(_0x5a3735,_0x1e4162){_0x1e4162=_0x1e4162||0xc8;return function(_0x33c02a){if(_0x33c02a){return _0x5a3735['status'](_0x1e4162)[_0x0884('0x1a')](_0x33c02a);}};}function respondWithFilteredResult(_0x47ac37,_0x334ae8){return function(_0x21ba86){if(_0x21ba86){var _0x5add2b=typeof _0x334ae8[_0x0884('0x1b')]===_0x0884('0x1c')&&typeof _0x334ae8['limit']===_0x0884('0x1c');var _0x5ea3ef=_0x21ba86[_0x0884('0x1d')];var _0x429550=_0x5add2b?0x0:_0x334ae8[_0x0884('0x1b')];var _0x47e894=_0x5add2b?_0x21ba86[_0x0884('0x1d')]:_0x334ae8[_0x0884('0x1b')]+_0x334ae8[_0x0884('0x1e')];var _0x4ba0b5;if(_0x47e894>=_0x5ea3ef){_0x47e894=_0x5ea3ef;_0x4ba0b5=0xc8;}else{_0x4ba0b5=0xce;}_0x47ac37[_0x0884('0x18')](_0x4ba0b5);return _0x47ac37[_0x0884('0x1f')](_0x0884('0x20'),_0x429550+'-'+_0x47e894+'/'+_0x5ea3ef)[_0x0884('0x1a')](_0x21ba86);}return null;};}function patchUpdates(_0x34b5e9){return function(_0xaa777b){try{jsonpatch[_0x0884('0x21')](_0xaa777b,_0x34b5e9,!![]);}catch(_0x2c3e0c){return BPromise[_0x0884('0x22')](_0x2c3e0c);}return _0xaa777b[_0x0884('0x23')]();};}function saveUpdates(_0x5cc42b,_0x41617d){return function(_0x1766d3){if(_0x1766d3){return _0x1766d3[_0x0884('0x24')](_0x5cc42b)[_0x0884('0x25')](function(_0xbedf78){return _0xbedf78;});}return null;};}function removeEntity(_0x4c156e,_0x20dfc){return function(_0x244df7){if(_0x244df7){return _0x244df7[_0x0884('0x26')]()[_0x0884('0x25')](function(){_0x4c156e[_0x0884('0x18')](0xcc)[_0x0884('0x19')]();});}};}function handleEntityNotFound(_0x2f103b,_0x6e00f0){return function(_0x14bb3f){if(!_0x14bb3f){_0x2f103b[_0x0884('0x17')](0x194);}return _0x14bb3f;};}function handleError(_0x308c06,_0x434b2e){_0x434b2e=_0x434b2e||0x1f4;return function(_0x5071a8){logger[_0x0884('0x27')](_0x5071a8[_0x0884('0x28')]);if(_0x5071a8[_0x0884('0x29')]){delete _0x5071a8[_0x0884('0x29')];}_0x308c06[_0x0884('0x18')](_0x434b2e)['send'](_0x5071a8);};}exports[_0x0884('0x2a')]=function(_0x1cab8b,_0x5b7aee){var _0x2c4a43={},_0xcb389a={},_0x1d52af={'count':0x0,'rows':[]};var _0x1bc8b1=_[_0x0884('0x2b')](db[_0x0884('0x2c')]['rawAttributes'],function(_0x4c5d5a){return{'name':_0x4c5d5a[_0x0884('0x2d')],'type':_0x4c5d5a[_0x0884('0x2e')][_0x0884('0x2f')]};});_0xcb389a[_0x0884('0x30')]=_['map'](_0x1bc8b1,_0x0884('0x29'));_0xcb389a[_0x0884('0x31')]=_[_0x0884('0x32')](_0x1cab8b[_0x0884('0x31')]);_0xcb389a[_0x0884('0x33')]=_['intersection'](_0xcb389a[_0x0884('0x30')],_0xcb389a[_0x0884('0x31')]);_0x2c4a43['attributes']=_[_0x0884('0x34')](_0xcb389a[_0x0884('0x30')],qs[_0x0884('0x35')](_0x1cab8b[_0x0884('0x31')]['fields']));_0x2c4a43[_0x0884('0x36')]=_0x2c4a43['attributes']['length']?_0x2c4a43[_0x0884('0x36')]:_0xcb389a[_0x0884('0x30')];if(!_0x1cab8b[_0x0884('0x31')][_0x0884('0x37')](_0x0884('0x38'))){_0x2c4a43[_0x0884('0x1e')]=qs[_0x0884('0x1e')](_0x1cab8b[_0x0884('0x31')][_0x0884('0x1e')]);_0x2c4a43[_0x0884('0x1b')]=qs[_0x0884('0x1b')](_0x1cab8b['query'][_0x0884('0x1b')]);}_0x2c4a43[_0x0884('0x39')]=qs[_0x0884('0x3a')](_0x1cab8b[_0x0884('0x31')][_0x0884('0x3a')]);_0x2c4a43['where']=qs[_0x0884('0x33')](_['pick'](_0x1cab8b['query'],_0xcb389a[_0x0884('0x33')]),_0x1bc8b1);if(_0x1cab8b[_0x0884('0x31')][_0x0884('0x3b')]){_0x2c4a43['where']=_[_0x0884('0x3c')](_0x2c4a43[_0x0884('0x3d')],{'$or':_[_0x0884('0x2b')](_0x1bc8b1,function(_0x521d34){if(_0x521d34[_0x0884('0x2e')]!==_0x0884('0x3e')){var _0x5ecb55={};_0x5ecb55[_0x521d34[_0x0884('0x29')]]={'$like':'%'+_0x1cab8b['query'][_0x0884('0x3b')]+'%'};return _0x5ecb55;}})});}_0x2c4a43=_[_0x0884('0x3c')]({},_0x2c4a43,_0x1cab8b[_0x0884('0x3f')]);var _0x2cc2ea={'where':_0x2c4a43[_0x0884('0x3d')]};return db[_0x0884('0x2c')][_0x0884('0x1d')](_0x2cc2ea)['then'](function(_0x27f2a6){_0x1d52af[_0x0884('0x1d')]=_0x27f2a6;if(_0x1cab8b[_0x0884('0x31')][_0x0884('0x40')]){_0x2c4a43[_0x0884('0x41')]=[{'all':!![]}];}return db[_0x0884('0x2c')]['findAll'](_0x2c4a43);})[_0x0884('0x25')](function(_0x271d17){_0x1d52af[_0x0884('0x42')]=_0x271d17;return _0x1d52af;})[_0x0884('0x25')](respondWithFilteredResult(_0x5b7aee,_0x2c4a43))[_0x0884('0x43')](handleError(_0x5b7aee,null));};exports[_0x0884('0x44')]=function(_0x15e92f,_0x1a6c00){var _0x4ea8b4={'raw':!![],'where':{'id':_0x15e92f['params']['id']}},_0x4b5cee={};_0x4b5cee[_0x0884('0x30')]=_[_0x0884('0x32')](db[_0x0884('0x2c')]['rawAttributes']);_0x4b5cee['query']=_['keys'](_0x15e92f[_0x0884('0x31')]);_0x4b5cee['filters']=_[_0x0884('0x34')](_0x4b5cee[_0x0884('0x30')],_0x4b5cee['query']);_0x4ea8b4[_0x0884('0x36')]=_[_0x0884('0x34')](_0x4b5cee[_0x0884('0x30')],qs[_0x0884('0x35')](_0x15e92f['query'][_0x0884('0x35')]));_0x4ea8b4['attributes']=_0x4ea8b4[_0x0884('0x36')]['length']?_0x4ea8b4[_0x0884('0x36')]:_0x4b5cee[_0x0884('0x30')];if(_0x15e92f['query']['includeAll']){_0x4ea8b4[_0x0884('0x41')]=[{'all':!![]}];}_0x4ea8b4=_[_0x0884('0x3c')]({},_0x4ea8b4,_0x15e92f[_0x0884('0x3f')]);return db[_0x0884('0x2c')][_0x0884('0x45')](_0x4ea8b4)[_0x0884('0x25')](handleEntityNotFound(_0x1a6c00,null))['then'](respondWithResult(_0x1a6c00,null))[_0x0884('0x43')](handleError(_0x1a6c00,null));};exports[_0x0884('0x46')]=function(_0x404fd8,_0x1f6de5){return db[_0x0884('0x2c')]['create'](_0x404fd8[_0x0884('0x47')],{})[_0x0884('0x25')](respondWithResult(_0x1f6de5,0xc9))['catch'](handleError(_0x1f6de5,null));};exports['update']=function(_0x212376,_0x4069d8){if(_0x212376[_0x0884('0x47')]['id']){delete _0x212376[_0x0884('0x47')]['id'];}return db[_0x0884('0x2c')][_0x0884('0x45')]({'where':{'id':_0x212376[_0x0884('0x48')]['id']}})[_0x0884('0x25')](handleEntityNotFound(_0x4069d8,null))[_0x0884('0x25')](saveUpdates(_0x212376['body'],null))[_0x0884('0x25')](respondWithResult(_0x4069d8,null))[_0x0884('0x43')](handleError(_0x4069d8,null));};exports[_0x0884('0x26')]=function(_0x54f683,_0x47684a){return db[_0x0884('0x2c')]['find']({'where':{'id':_0x54f683[_0x0884('0x48')]['id']}})[_0x0884('0x25')](handleEntityNotFound(_0x47684a,null))[_0x0884('0x25')](removeEntity(_0x47684a,null))['catch'](handleError(_0x47684a,null));};exports[_0x0884('0x49')]=function(_0x3fb59f,_0x36943a){return db[_0x0884('0x2c')][_0x0884('0x49')]()[_0x0884('0x25')](respondWithResult(_0x36943a,null))['catch'](handleError(_0x36943a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index edb5ef2..67c1f14 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64cf=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x27576f,_0x12b93f){var _0x1bcd1a=function(_0x2896a9){while(--_0x2896a9){_0x27576f['push'](_0x27576f['shift']());}};_0x1bcd1a(++_0x12b93f);}(_0x64cf,0x189));var _0xf64c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x64cf[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xf64c('0x0'));var MailSubstatus=require(_0xf64c('0x1'))['db'][_0xf64c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf64c('0x3')](0x0);var events={'afterUpdate':_0xf64c('0x4')};function emitEvent(_0x51a4b0){return function(_0x3158e2,_0xcde47b,_0x19b18e){MailSubstatusEvents[_0xf64c('0x5')](_0x51a4b0+':'+_0x3158e2['id'],_0x3158e2);MailSubstatusEvents[_0xf64c('0x5')](_0x51a4b0,_0x3158e2);_0x19b18e(null);};}for(var e in events){if(events[_0xf64c('0x6')](e)){var event=events[e];MailSubstatus[_0xf64c('0x7')](e,emitEvent(event));}}module[_0xf64c('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xc8aa=['exports','events','../../mysqldb','MailSubstatus','update','emit','hook'];(function(_0x3c29a7,_0x1bec88){var _0x1482db=function(_0x4093f7){while(--_0x4093f7){_0x3c29a7['push'](_0x3c29a7['shift']());}};_0x1482db(++_0x1bec88);}(_0xc8aa,0x9b));var _0xac8a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc8aa[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xac8a('0x0'));var MailSubstatus=require(_0xac8a('0x1'))['db'][_0xac8a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xac8a('0x3')};function emitEvent(_0x5609d3){return function(_0x2a125c,_0x5bc570,_0x3f2994){MailSubstatusEvents[_0xac8a('0x4')](_0x5609d3+':'+_0x2a125c['id'],_0x2a125c);MailSubstatusEvents[_0xac8a('0x4')](_0x5609d3,_0x2a125c);_0x3f2994(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xac8a('0x5')](e,emitEvent(event));}}module[_0xac8a('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2616d16..64ae119 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 _0x84d0=['define','MailSubstatus','mail_substatuses','Condition','update','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x20a8c5,_0x46267d){var _0x16b66e=function(_0x138569){while(--_0x138569){_0x20a8c5['push'](_0x20a8c5['shift']());}};_0x16b66e(++_0x46267d);}(_0x84d0,0x75));var _0x084d=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x84d0[_0x18ab2a];return _0x16dcee;};'use strict';var attributes=require(_0x084d('0x0'));module[_0x084d('0x1')]=function(_0x4ab483){var _0x2c6cf8=_0x4ab483[_0x084d('0x2')];return _0x4ab483[_0x084d('0x3')](_0x084d('0x4'),attributes,{'tableName':_0x084d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5e4b07,_0xca4af0,_0x53affb){return _0x2c6cf8[_0x084d('0x6')][_0x084d('0x7')]({'value':_0x5e4b07['name']},{'where':{'field':'mailSubstatus','value':_0x5e4b07[_0x084d('0x8')][_0x084d('0x9')]}})[_0x084d('0xa')](function(){_0x53affb();})[_0x084d('0xb')](function(_0x9c7d2c){_0x53affb(_0x9c7d2c);});}}});}; \ No newline at end of file +var _0x0053=['MailSubstatus','update','name','mailSubstatus','_previousDataValues','then','catch','exports','models'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x0053,0x14b));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3005('0x0')]=function(_0x25a2d8){var _0xd0a3ea=_0x25a2d8[_0x3005('0x1')];return _0x25a2d8['define'](_0x3005('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x7ae3f2,_0x4bd8e8,_0x96a6cb){return _0xd0a3ea['Condition'][_0x3005('0x3')]({'value':_0x7ae3f2[_0x3005('0x4')]},{'where':{'field':_0x3005('0x5'),'value':_0x7ae3f2[_0x3005('0x6')][_0x3005('0x4')]}})[_0x3005('0x7')](function(){_0x96a6cb();})[_0x3005('0x8')](function(_0x1081eb){_0x96a6cb(_0x1081eb);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 06ac0c2..ff1e318 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 _0xce3d=['code','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x159f9b,_0x5b015c){var _0x5af408=function(_0x3d8a15){while(--_0x3d8a15){_0x159f9b['push'](_0x159f9b['shift']());}};_0x5af408(++_0x5b015c);}(_0xce3d,0xff));var _0xdce3=function(_0x41f7b2,_0x58547b){_0x41f7b2=_0x41f7b2-0x0;var _0x19ec6d=_0xce3d[_0x41f7b2];return _0x19ec6d;};'use strict';var _=require(_0xdce3('0x0'));var util=require(_0xdce3('0x1'));var moment=require('moment');var BPromise=require(_0xdce3('0x2'));var rs=require(_0xdce3('0x3'));var fs=require('fs');var Redis=require(_0xdce3('0x4'));var db=require(_0xdce3('0x5'))['db'];var utils=require(_0xdce3('0x6'));var logger=require(_0xdce3('0x7'))(_0xdce3('0x8'));var config=require(_0xdce3('0x9'));var jayson=require(_0xdce3('0xa'));var client=jayson[_0xdce3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be27f,_0x442def,_0x4eb2bb){return new BPromise(function(_0x28c7f9,_0x514b43){return client[_0xdce3('0xc')](_0x1be27f,_0x4eb2bb)[_0xdce3('0xd')](function(_0x3509b2){logger[_0xdce3('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x442def,_0xdce3('0xf'));logger[_0xdce3('0x10')](_0xdce3('0x11'),_0x442def,_0xdce3('0xf'),JSON[_0xdce3('0x12')](_0x3509b2));if(_0x3509b2[_0xdce3('0x13')]){if(_0x3509b2[_0xdce3('0x13')][_0xdce3('0x14')]===0x1f4){logger[_0xdce3('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x442def,_0x3509b2[_0xdce3('0x13')]['message']);return _0x514b43(_0x3509b2[_0xdce3('0x13')][_0xdce3('0x15')]);}logger[_0xdce3('0x13')](_0xdce3('0x16'),_0x442def,_0x3509b2[_0xdce3('0x13')][_0xdce3('0x15')]);return _0x28c7f9(_0x3509b2[_0xdce3('0x13')]['message']);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x442def,_0xdce3('0xf'));_0x28c7f9(_0x3509b2[_0xdce3('0x17')][_0xdce3('0x15')]);}})[_0xdce3('0x18')](function(_0x1bb242){logger['error'](_0xdce3('0x16'),_0x442def,_0x1bb242);_0x514b43(_0x1bb242);});});} \ No newline at end of file +var _0x3769=['then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x19abc7,_0x5aadb6){var _0xc24f10=function(_0x16dd95){while(--_0x16dd95){_0x19abc7['push'](_0x19abc7['shift']());}};_0xc24f10(++_0x5aadb6);}(_0x3769,0x15c));var _0x9376=function(_0x108885,_0x4ce059){_0x108885=_0x108885-0x0;var _0x416c9b=_0x3769[_0x108885];return _0x416c9b;};'use strict';var _=require(_0x9376('0x0'));var util=require('util');var moment=require(_0x9376('0x1'));var BPromise=require(_0x9376('0x2'));var rs=require(_0x9376('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9376('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9376('0x5'))(_0x9376('0x6'));var config=require(_0x9376('0x7'));var jayson=require(_0x9376('0x8'));var client=jayson[_0x9376('0x9')][_0x9376('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fb666,_0x489455,_0x46c3bd){return new BPromise(function(_0x236aeb,_0x170d15){return client[_0x9376('0xb')](_0x2fb666,_0x46c3bd)[_0x9376('0xc')](function(_0x3a60b8){logger['info'](_0x9376('0xd'),_0x489455,_0x9376('0xe'));logger['debug'](_0x9376('0xf'),_0x489455,_0x9376('0xe'),JSON['stringify'](_0x3a60b8));if(_0x3a60b8['error']){if(_0x3a60b8[_0x9376('0x10')]['code']===0x1f4){logger[_0x9376('0x10')](_0x9376('0xd'),_0x489455,_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);return _0x170d15(_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);}logger[_0x9376('0x10')](_0x9376('0xd'),_0x489455,_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);return _0x236aeb(_0x3a60b8[_0x9376('0x10')]['message']);}else{logger[_0x9376('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x489455,_0x9376('0xe'));_0x236aeb(_0x3a60b8[_0x9376('0x13')][_0x9376('0x11')]);}})['catch'](function(_0x34fced){logger[_0x9376('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x489455,_0x34fced);_0x170d15(_0x34fced);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cd11be0..66aaabd 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 _0xde0a=['fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xde0a,0x1ef));var _0xade0=function(_0x1f2df5,_0x199c0b){_0x1f2df5=_0x1f2df5-0x0;var _0x59ecf5=_0xde0a[_0x1f2df5];return _0x59ecf5;};'use strict';var multer=require(_0xade0('0x0'));var util=require(_0xade0('0x1'));var path=require('path');var timeout=require(_0xade0('0x2'));var express=require(_0xade0('0x3'));var router=express[_0xade0('0x4')]();var fs_extra=require(_0xade0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xade0('0x6'));var config=require(_0xade0('0x7'));var controller=require(_0xade0('0x8'));router[_0xade0('0x9')]('/',auth[_0xade0('0xa')](),controller[_0xade0('0xb')]);router['get'](_0xade0('0xc'),auth[_0xade0('0xa')](),controller['describe']);router[_0xade0('0x9')](_0xade0('0xd'),auth[_0xade0('0xa')](),controller[_0xade0('0xe')]);router[_0xade0('0xf')]('/',auth[_0xade0('0xa')](),controller['create']);router[_0xade0('0x10')](_0xade0('0xd'),auth[_0xade0('0xa')](),controller['update']);router[_0xade0('0x11')](_0xade0('0xd'),auth[_0xade0('0xa')](),controller[_0xade0('0x12')]);module[_0xade0('0x13')]=router; \ No newline at end of file +var _0x4888=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x31d012,_0x46b6f7){var _0x340687=function(_0x218f0c){while(--_0x218f0c){_0x31d012['push'](_0x31d012['shift']());}};_0x340687(++_0x46b6f7);}(_0x4888,0xd7));var _0x8488=function(_0x4e15f4,_0x5a72f2){_0x4e15f4=_0x4e15f4-0x0;var _0x5a9643=_0x4888[_0x4e15f4];return _0x5a9643;};'use strict';var multer=require(_0x8488('0x0'));var util=require(_0x8488('0x1'));var path=require(_0x8488('0x2'));var timeout=require(_0x8488('0x3'));var express=require('express');var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require(_0x8488('0x7'));var config=require(_0x8488('0x8'));var controller=require(_0x8488('0x9'));router[_0x8488('0xa')]('/',auth[_0x8488('0xb')](),controller[_0x8488('0xc')]);router[_0x8488('0xa')](_0x8488('0xd'),auth[_0x8488('0xb')](),controller[_0x8488('0xe')]);router[_0x8488('0xa')](_0x8488('0xf'),auth['isAuthenticated'](),controller[_0x8488('0x10')]);router[_0x8488('0x11')]('/',auth[_0x8488('0xb')](),controller[_0x8488('0x12')]);router['put']('/:id',auth[_0x8488('0xb')](),controller[_0x8488('0x13')]);router[_0x8488('0x14')](_0x8488('0xf'),auth['isAuthenticated'](),controller[_0x8488('0x15')]);module[_0x8488('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 dce4b41..1fb10aa 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3ddde9,_0x1a6a2b){var _0xdfb693=function(_0x1c1c20){while(--_0x1c1c20){_0x3ddde9['push'](_0x3ddde9['shift']());}};_0xdfb693(++_0x1a6a2b);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x15cd14,_0x5624ec){var _0x54f603=function(_0x314bd3){while(--_0x314bd3){_0x15cd14['push'](_0x15cd14['shift']());}};_0x54f603(++_0x5624ec);}(_0x70e0,0x17b));var _0x070e=function(_0xc253c9,_0x2d2889){_0xc253c9=_0xc253c9-0x0;var _0x3a805c=_0x70e0[_0xc253c9];return _0x3a805c;};'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 b0418c2..6fa4fc6 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 _0x407c=['MailTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','type','VIRTUAL','merge','count','includeAll','include','findAll','show','params','keys','find','create','body','catch','update','describe','rimraf','zip-dir','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','destroy','then','error','stack','name','send','index','map'];(function(_0x8d6c7a,_0x2d4c3c){var _0x2c305a=function(_0x388014){while(--_0x388014){_0x8d6c7a['push'](_0x8d6c7a['shift']());}};_0x2c305a(++_0x2d4c3c);}(_0x407c,0x66));var _0xc407=function(_0x1b3fb0,_0x49325a){_0x1b3fb0=_0x1b3fb0-0x0;var _0x5eb66e=_0x407c[_0x1b3fb0];return _0x5eb66e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc407('0x0'));var zipdir=require(_0xc407('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc407('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc407('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc407('0x4'));var csv=require(_0xc407('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc407('0x6'));var _=require(_0xc407('0x7'));var squel=require(_0xc407('0x8'));var crypto=require(_0xc407('0x9'));var jsforce=require(_0xc407('0xa'));var deskjs=require(_0xc407('0xb'));var toCsv=require(_0xc407('0x5'));var querystring=require(_0xc407('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc407('0xd'));var qs=require(_0xc407('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc407('0xf'))(_0xc407('0x10'));var utils=require(_0xc407('0x11'));var config=require(_0xc407('0x12'));var licenseUtil=require(_0xc407('0x13'));var db=require(_0xc407('0x14'))['db'];function respondWithStatusCode(_0x29702e,_0x4a7fca){_0x4a7fca=_0x4a7fca||0xcc;return function(_0x1fd77b){if(_0x1fd77b){return _0x29702e[_0xc407('0x15')](_0x4a7fca);}return _0x29702e[_0xc407('0x16')](_0x4a7fca)['end']();};}function respondWithResult(_0x1b39f8,_0x38f012){_0x38f012=_0x38f012||0xc8;return function(_0x4f1fb7){if(_0x4f1fb7){return _0x1b39f8[_0xc407('0x16')](_0x38f012)[_0xc407('0x17')](_0x4f1fb7);}};}function respondWithFilteredResult(_0x27103b,_0x2363db){return function(_0x35d52d){if(_0x35d52d){var _0xfc4884=typeof _0x2363db[_0xc407('0x18')]==='undefined'&&typeof _0x2363db['limit']===_0xc407('0x19');var _0x44dfa5=_0x35d52d['count'];var _0x46017e=_0xfc4884?0x0:_0x2363db['offset'];var _0x52922b=_0xfc4884?_0x35d52d['count']:_0x2363db[_0xc407('0x18')]+_0x2363db[_0xc407('0x1a')];var _0x317848;if(_0x52922b>=_0x44dfa5){_0x52922b=_0x44dfa5;_0x317848=0xc8;}else{_0x317848=0xce;}_0x27103b[_0xc407('0x16')](_0x317848);return _0x27103b[_0xc407('0x1b')](_0xc407('0x1c'),_0x46017e+'-'+_0x52922b+'/'+_0x44dfa5)[_0xc407('0x17')](_0x35d52d);}return null;};}function patchUpdates(_0x4b79e1){return function(_0x3c7659){try{jsonpatch[_0xc407('0x1d')](_0x3c7659,_0x4b79e1,!![]);}catch(_0x497887){return BPromise['reject'](_0x497887);}return _0x3c7659['save']();};}function saveUpdates(_0x590a21,_0x5e29c3){return function(_0x362edd){if(_0x362edd){return _0x362edd['update'](_0x590a21)['then'](function(_0x553bef){return _0x553bef;});}return null;};}function removeEntity(_0x3eb153,_0x25c0ed){return function(_0x334b20){if(_0x334b20){return _0x334b20[_0xc407('0x1e')]()[_0xc407('0x1f')](function(){_0x3eb153[_0xc407('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4565e6,_0x58009c){return function(_0x26794c){if(!_0x26794c){_0x4565e6[_0xc407('0x15')](0x194);}return _0x26794c;};}function handleError(_0x51926f,_0x264be0){_0x264be0=_0x264be0||0x1f4;return function(_0x152ad3){logger[_0xc407('0x20')](_0x152ad3[_0xc407('0x21')]);if(_0x152ad3[_0xc407('0x22')]){delete _0x152ad3[_0xc407('0x22')];}_0x51926f[_0xc407('0x16')](_0x264be0)[_0xc407('0x23')](_0x152ad3);};}exports[_0xc407('0x24')]=function(_0x64dc1d,_0x4551bc){var _0x5adfa5={},_0x22378b={},_0x280556={'count':0x0,'rows':[]};var _0x4b4c27=_[_0xc407('0x25')](db[_0xc407('0x26')][_0xc407('0x27')],function(_0x7d5fc3){return{'name':_0x7d5fc3[_0xc407('0x28')],'type':_0x7d5fc3['type'][_0xc407('0x29')]};});_0x22378b[_0xc407('0x2a')]=_[_0xc407('0x25')](_0x4b4c27,_0xc407('0x22'));_0x22378b[_0xc407('0x2b')]=_['keys'](_0x64dc1d[_0xc407('0x2b')]);_0x22378b[_0xc407('0x2c')]=_[_0xc407('0x2d')](_0x22378b[_0xc407('0x2a')],_0x22378b['query']);_0x5adfa5[_0xc407('0x2e')]=_[_0xc407('0x2d')](_0x22378b[_0xc407('0x2a')],qs[_0xc407('0x2f')](_0x64dc1d[_0xc407('0x2b')]['fields']));_0x5adfa5['attributes']=_0x5adfa5[_0xc407('0x2e')][_0xc407('0x30')]?_0x5adfa5[_0xc407('0x2e')]:_0x22378b[_0xc407('0x2a')];if(!_0x64dc1d[_0xc407('0x2b')][_0xc407('0x31')]('nolimit')){_0x5adfa5[_0xc407('0x1a')]=qs[_0xc407('0x1a')](_0x64dc1d[_0xc407('0x2b')][_0xc407('0x1a')]);_0x5adfa5[_0xc407('0x18')]=qs[_0xc407('0x18')](_0x64dc1d[_0xc407('0x2b')][_0xc407('0x18')]);}_0x5adfa5[_0xc407('0x32')]=qs['sort'](_0x64dc1d[_0xc407('0x2b')]['sort']);_0x5adfa5[_0xc407('0x33')]=qs[_0xc407('0x2c')](_[_0xc407('0x34')](_0x64dc1d[_0xc407('0x2b')],_0x22378b[_0xc407('0x2c')]),_0x4b4c27);if(_0x64dc1d[_0xc407('0x2b')][_0xc407('0x35')]){_0x5adfa5[_0xc407('0x33')]=_['merge'](_0x5adfa5[_0xc407('0x33')],{'$or':_[_0xc407('0x25')](_0x4b4c27,function(_0xafbbfb){if(_0xafbbfb[_0xc407('0x36')]!==_0xc407('0x37')){var _0x4be95e={};_0x4be95e[_0xafbbfb[_0xc407('0x22')]]={'$like':'%'+_0x64dc1d[_0xc407('0x2b')][_0xc407('0x35')]+'%'};return _0x4be95e;}})});}_0x5adfa5=_[_0xc407('0x38')]({},_0x5adfa5,_0x64dc1d['options']);var _0x46a679={'where':_0x5adfa5['where']};return db[_0xc407('0x26')][_0xc407('0x39')](_0x46a679)[_0xc407('0x1f')](function(_0x1e140e){_0x280556[_0xc407('0x39')]=_0x1e140e;if(_0x64dc1d[_0xc407('0x2b')][_0xc407('0x3a')]){_0x5adfa5[_0xc407('0x3b')]=[{'all':!![]}];}return db[_0xc407('0x26')][_0xc407('0x3c')](_0x5adfa5);})['then'](function(_0x5b6588){_0x280556['rows']=_0x5b6588;return _0x280556;})[_0xc407('0x1f')](respondWithFilteredResult(_0x4551bc,_0x5adfa5))['catch'](handleError(_0x4551bc,null));};exports[_0xc407('0x3d')]=function(_0x621fd4,_0x234dd4){var _0x77c4ed={'raw':!![],'where':{'id':_0x621fd4[_0xc407('0x3e')]['id']}},_0x25fc31={};_0x25fc31['model']=_[_0xc407('0x3f')](db[_0xc407('0x26')][_0xc407('0x27')]);_0x25fc31['query']=_[_0xc407('0x3f')](_0x621fd4[_0xc407('0x2b')]);_0x25fc31['filters']=_[_0xc407('0x2d')](_0x25fc31[_0xc407('0x2a')],_0x25fc31[_0xc407('0x2b')]);_0x77c4ed[_0xc407('0x2e')]=_[_0xc407('0x2d')](_0x25fc31[_0xc407('0x2a')],qs[_0xc407('0x2f')](_0x621fd4[_0xc407('0x2b')][_0xc407('0x2f')]));_0x77c4ed['attributes']=_0x77c4ed[_0xc407('0x2e')]['length']?_0x77c4ed[_0xc407('0x2e')]:_0x25fc31['model'];if(_0x621fd4[_0xc407('0x2b')][_0xc407('0x3a')]){_0x77c4ed[_0xc407('0x3b')]=[{'all':!![]}];}_0x77c4ed=_['merge']({},_0x77c4ed,_0x621fd4['options']);return db[_0xc407('0x26')][_0xc407('0x40')](_0x77c4ed)[_0xc407('0x1f')](handleEntityNotFound(_0x234dd4,null))[_0xc407('0x1f')](respondWithResult(_0x234dd4,null))['catch'](handleError(_0x234dd4,null));};exports[_0xc407('0x41')]=function(_0x398bea,_0xf992b5){return db['MailTransferReport'][_0xc407('0x41')](_0x398bea[_0xc407('0x42')],{})[_0xc407('0x1f')](respondWithResult(_0xf992b5,0xc9))[_0xc407('0x43')](handleError(_0xf992b5,null));};exports[_0xc407('0x44')]=function(_0x225910,_0x6b3a7c){if(_0x225910[_0xc407('0x42')]['id']){delete _0x225910['body']['id'];}return db[_0xc407('0x26')][_0xc407('0x40')]({'where':{'id':_0x225910[_0xc407('0x3e')]['id']}})['then'](handleEntityNotFound(_0x6b3a7c,null))[_0xc407('0x1f')](saveUpdates(_0x225910[_0xc407('0x42')],null))[_0xc407('0x1f')](respondWithResult(_0x6b3a7c,null))[_0xc407('0x43')](handleError(_0x6b3a7c,null));};exports[_0xc407('0x1e')]=function(_0x31b116,_0x2fca8b){return db[_0xc407('0x26')][_0xc407('0x40')]({'where':{'id':_0x31b116[_0xc407('0x3e')]['id']}})[_0xc407('0x1f')](handleEntityNotFound(_0x2fca8b,null))[_0xc407('0x1f')](removeEntity(_0x2fca8b,null))[_0xc407('0x43')](handleError(_0x2fca8b,null));};exports[_0xc407('0x45')]=function(_0x2c5f9d,_0x32441f){return db['MailTransferReport']['describe']()[_0xc407('0x1f')](respondWithResult(_0x32441f,null))[_0xc407('0x43')](handleError(_0x32441f,null));}; \ No newline at end of file +var _0x9507=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','MailTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','includeAll','show','params','rawAttributes','options','catch'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x9507,0x166));var _0x7950=function(_0x5f5657,_0x4cf3c2){_0x5f5657=_0x5f5657-0x0;var _0x29a276=_0x9507[_0x5f5657];return _0x29a276;};'use strict';var emlformat=require(_0x7950('0x0'));var rimraf=require(_0x7950('0x1'));var zipdir=require(_0x7950('0x2'));var jsonpatch=require(_0x7950('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7950('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7950('0x5'));var csv=require(_0x7950('0x6'));var ejs=require(_0x7950('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7950('0x8'));var squel=require(_0x7950('0x9'));var crypto=require(_0x7950('0xa'));var jsforce=require(_0x7950('0xb'));var deskjs=require(_0x7950('0xc'));var toCsv=require(_0x7950('0x6'));var querystring=require('querystring');var Papa=require(_0x7950('0xd'));var Redis=require(_0x7950('0xe'));var authService=require(_0x7950('0xf'));var qs=require(_0x7950('0x10'));var as=require(_0x7950('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7950('0x12'));var config=require(_0x7950('0x13'));var licenseUtil=require(_0x7950('0x14'));var db=require(_0x7950('0x15'))['db'];function respondWithStatusCode(_0x1b87d0,_0x5e8249){_0x5e8249=_0x5e8249||0xcc;return function(_0x220b97){if(_0x220b97){return _0x1b87d0[_0x7950('0x16')](_0x5e8249);}return _0x1b87d0[_0x7950('0x17')](_0x5e8249)['end']();};}function respondWithResult(_0x13db6e,_0x8c470e){_0x8c470e=_0x8c470e||0xc8;return function(_0x841fa7){if(_0x841fa7){return _0x13db6e[_0x7950('0x17')](_0x8c470e)[_0x7950('0x18')](_0x841fa7);}};}function respondWithFilteredResult(_0x51ff5e,_0x2333ba){return function(_0x472416){if(_0x472416){var _0x2dfb0c=typeof _0x2333ba[_0x7950('0x19')]===_0x7950('0x1a')&&typeof _0x2333ba[_0x7950('0x1b')]==='undefined';var _0x502e72=_0x472416[_0x7950('0x1c')];var _0x3b1e74=_0x2dfb0c?0x0:_0x2333ba[_0x7950('0x19')];var _0x406030=_0x2dfb0c?_0x472416[_0x7950('0x1c')]:_0x2333ba['offset']+_0x2333ba[_0x7950('0x1b')];var _0x24e37c;if(_0x406030>=_0x502e72){_0x406030=_0x502e72;_0x24e37c=0xc8;}else{_0x24e37c=0xce;}_0x51ff5e[_0x7950('0x17')](_0x24e37c);return _0x51ff5e[_0x7950('0x1d')](_0x7950('0x1e'),_0x3b1e74+'-'+_0x406030+'/'+_0x502e72)['json'](_0x472416);}return null;};}function patchUpdates(_0x4b0d5a){return function(_0x32554c){try{jsonpatch[_0x7950('0x1f')](_0x32554c,_0x4b0d5a,!![]);}catch(_0x267c38){return BPromise[_0x7950('0x20')](_0x267c38);}return _0x32554c[_0x7950('0x21')]();};}function saveUpdates(_0x48ca7a,_0x46ec0c){return function(_0xb16266){if(_0xb16266){return _0xb16266[_0x7950('0x22')](_0x48ca7a)['then'](function(_0x2ef4dd){return _0x2ef4dd;});}return null;};}function removeEntity(_0x15e52c,_0x44039d){return function(_0x42228f){if(_0x42228f){return _0x42228f[_0x7950('0x23')]()[_0x7950('0x24')](function(){_0x15e52c[_0x7950('0x17')](0xcc)[_0x7950('0x25')]();});}};}function handleEntityNotFound(_0x1c9151,_0x1cbd7a){return function(_0x1fd7df){if(!_0x1fd7df){_0x1c9151[_0x7950('0x16')](0x194);}return _0x1fd7df;};}function handleError(_0x519aa6,_0x32c6e8){_0x32c6e8=_0x32c6e8||0x1f4;return function(_0x6ed69f){logger[_0x7950('0x26')](_0x6ed69f[_0x7950('0x27')]);if(_0x6ed69f[_0x7950('0x28')]){delete _0x6ed69f[_0x7950('0x28')];}_0x519aa6[_0x7950('0x17')](_0x32c6e8)[_0x7950('0x29')](_0x6ed69f);};}exports[_0x7950('0x2a')]=function(_0x262aa0,_0x22080f){var _0x499376={},_0x23925d={},_0xa41e87={'count':0x0,'rows':[]};var _0x51a526=_[_0x7950('0x2b')](db[_0x7950('0x2c')]['rawAttributes'],function(_0x14cea9){return{'name':_0x14cea9[_0x7950('0x2d')],'type':_0x14cea9['type'][_0x7950('0x2e')]};});_0x23925d[_0x7950('0x2f')]=_['map'](_0x51a526,_0x7950('0x28'));_0x23925d[_0x7950('0x30')]=_[_0x7950('0x31')](_0x262aa0[_0x7950('0x30')]);_0x23925d[_0x7950('0x32')]=_[_0x7950('0x33')](_0x23925d['model'],_0x23925d[_0x7950('0x30')]);_0x499376[_0x7950('0x34')]=_['intersection'](_0x23925d[_0x7950('0x2f')],qs[_0x7950('0x35')](_0x262aa0[_0x7950('0x30')][_0x7950('0x35')]));_0x499376[_0x7950('0x34')]=_0x499376[_0x7950('0x34')][_0x7950('0x36')]?_0x499376[_0x7950('0x34')]:_0x23925d[_0x7950('0x2f')];if(!_0x262aa0[_0x7950('0x30')][_0x7950('0x37')]('nolimit')){_0x499376[_0x7950('0x1b')]=qs[_0x7950('0x1b')](_0x262aa0[_0x7950('0x30')][_0x7950('0x1b')]);_0x499376[_0x7950('0x19')]=qs[_0x7950('0x19')](_0x262aa0['query']['offset']);}_0x499376['order']=qs['sort'](_0x262aa0['query']['sort']);_0x499376[_0x7950('0x38')]=qs[_0x7950('0x32')](_[_0x7950('0x39')](_0x262aa0['query'],_0x23925d[_0x7950('0x32')]),_0x51a526);if(_0x262aa0[_0x7950('0x30')][_0x7950('0x3a')]){_0x499376[_0x7950('0x38')]=_[_0x7950('0x3b')](_0x499376['where'],{'$or':_[_0x7950('0x2b')](_0x51a526,function(_0xd112ff){if(_0xd112ff[_0x7950('0x3c')]!==_0x7950('0x3d')){var _0x37a8d7={};_0x37a8d7[_0xd112ff[_0x7950('0x28')]]={'$like':'%'+_0x262aa0[_0x7950('0x30')]['filter']+'%'};return _0x37a8d7;}})});}_0x499376=_[_0x7950('0x3b')]({},_0x499376,_0x262aa0['options']);var _0xef69bb={'where':_0x499376[_0x7950('0x38')]};return db[_0x7950('0x2c')][_0x7950('0x1c')](_0xef69bb)['then'](function(_0x24a2b7){_0xa41e87[_0x7950('0x1c')]=_0x24a2b7;if(_0x262aa0[_0x7950('0x30')][_0x7950('0x3e')]){_0x499376['include']=[{'all':!![]}];}return db[_0x7950('0x2c')]['findAll'](_0x499376);})[_0x7950('0x24')](function(_0x5d3c65){_0xa41e87['rows']=_0x5d3c65;return _0xa41e87;})[_0x7950('0x24')](respondWithFilteredResult(_0x22080f,_0x499376))['catch'](handleError(_0x22080f,null));};exports[_0x7950('0x3f')]=function(_0x2f4082,_0x17fb3f){var _0x1ac537={'raw':!![],'where':{'id':_0x2f4082[_0x7950('0x40')]['id']}},_0x43942a={};_0x43942a[_0x7950('0x2f')]=_[_0x7950('0x31')](db[_0x7950('0x2c')][_0x7950('0x41')]);_0x43942a[_0x7950('0x30')]=_['keys'](_0x2f4082[_0x7950('0x30')]);_0x43942a[_0x7950('0x32')]=_[_0x7950('0x33')](_0x43942a['model'],_0x43942a['query']);_0x1ac537[_0x7950('0x34')]=_[_0x7950('0x33')](_0x43942a[_0x7950('0x2f')],qs[_0x7950('0x35')](_0x2f4082[_0x7950('0x30')][_0x7950('0x35')]));_0x1ac537['attributes']=_0x1ac537[_0x7950('0x34')][_0x7950('0x36')]?_0x1ac537[_0x7950('0x34')]:_0x43942a[_0x7950('0x2f')];if(_0x2f4082[_0x7950('0x30')]['includeAll']){_0x1ac537['include']=[{'all':!![]}];}_0x1ac537=_[_0x7950('0x3b')]({},_0x1ac537,_0x2f4082[_0x7950('0x42')]);return db[_0x7950('0x2c')]['find'](_0x1ac537)['then'](handleEntityNotFound(_0x17fb3f,null))['then'](respondWithResult(_0x17fb3f,null))[_0x7950('0x43')](handleError(_0x17fb3f,null));};exports[_0x7950('0x44')]=function(_0x445541,_0x4a3a1b){return db[_0x7950('0x2c')]['create'](_0x445541[_0x7950('0x45')],{})[_0x7950('0x24')](respondWithResult(_0x4a3a1b,0xc9))[_0x7950('0x43')](handleError(_0x4a3a1b,null));};exports['update']=function(_0x4f426d,_0x27ee7f){if(_0x4f426d[_0x7950('0x45')]['id']){delete _0x4f426d[_0x7950('0x45')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x4f426d[_0x7950('0x40')]['id']}})[_0x7950('0x24')](handleEntityNotFound(_0x27ee7f,null))['then'](saveUpdates(_0x4f426d['body'],null))['then'](respondWithResult(_0x27ee7f,null))['catch'](handleError(_0x27ee7f,null));};exports[_0x7950('0x23')]=function(_0x402140,_0x39c45e){return db[_0x7950('0x2c')]['find']({'where':{'id':_0x402140[_0x7950('0x40')]['id']}})[_0x7950('0x24')](handleEntityNotFound(_0x39c45e,null))['then'](removeEntity(_0x39c45e,null))[_0x7950('0x43')](handleError(_0x39c45e,null));};exports[_0x7950('0x46')]=function(_0x5c4638,_0x462508){return db[_0x7950('0x2c')]['describe']()[_0x7950('0x24')](respondWithResult(_0x462508,null))[_0x7950('0x43')](handleError(_0x462508,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f86cf19..e15e32c 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 _0xa37e=['uniqueid','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x306b08,_0x287682){var _0x125ff7=function(_0x2a71ef){while(--_0x2a71ef){_0x306b08['push'](_0x306b08['shift']());}};_0x125ff7(++_0x287682);}(_0xa37e,0x97));var _0xea37=function(_0x9fa607,_0x492e93){_0x9fa607=_0x9fa607-0x0;var _0x29e3e6=_0xa37e[_0x9fa607];return _0x29e3e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xea37('0x9'),'fields':[_0xea37('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c2a=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0xfc961a,_0x5bd592){_0xfc961a=_0xfc961a-0x0;var _0x8c9021=_0x3c2a[_0xfc961a];return _0x8c9021;};'use strict';var _=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var logger=require('../../config/logger')(_0xa3c2('0x2'));var moment=require('moment');var BPromise=require(_0xa3c2('0x3'));var rp=require(_0xa3c2('0x4'));var fs=require('fs');var path=require(_0xa3c2('0x5'));var rimraf=require(_0xa3c2('0x6'));var config=require(_0xa3c2('0x7'));var attributes=require(_0xa3c2('0x8'));module[_0xa3c2('0x9')]=function(_0x230a89,_0x45a0b6){return _0x230a89[_0xa3c2('0xa')](_0xa3c2('0xb'),attributes,{'tableName':_0xa3c2('0xc'),'paranoid':![],'indexes':[{'name':_0xa3c2('0xd'),'fields':[_0xa3c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9bb073c..5b5467b 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 _0x5bae=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x320bdd,_0x1100e6){var _0x4b400d=function(_0x4c6b61){while(--_0x4c6b61){_0x320bdd['push'](_0x320bdd['shift']());}};_0x4b400d(++_0x1100e6);}(_0x5bae,0x19d));var _0xe5ba=function(_0x95096d,_0x48597a){_0x95096d=_0x95096d-0x0;var _0x258788=_0x5bae[_0x95096d];return _0x258788;};'use strict';var _=require(_0xe5ba('0x0'));var util=require(_0xe5ba('0x1'));var moment=require(_0xe5ba('0x2'));var BPromise=require(_0xe5ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5ba('0x4'));var db=require(_0xe5ba('0x5'))['db'];var utils=require(_0xe5ba('0x6'));var logger=require(_0xe5ba('0x7'))(_0xe5ba('0x8'));var config=require('../../config/environment');var jayson=require(_0xe5ba('0x9'));var client=jayson[_0xe5ba('0xa')][_0xe5ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c25a8,_0x86c0e8,_0x2793a2){return new BPromise(function(_0x3ec0ab,_0x1d59bd){return client[_0xe5ba('0xc')](_0x5c25a8,_0x2793a2)['then'](function(_0x49a3dd){logger['info'](_0xe5ba('0xd'),_0x86c0e8,_0xe5ba('0xe'));logger[_0xe5ba('0xf')](_0xe5ba('0x10'),_0x86c0e8,_0xe5ba('0xe'),JSON[_0xe5ba('0x11')](_0x49a3dd));if(_0x49a3dd[_0xe5ba('0x12')]){if(_0x49a3dd[_0xe5ba('0x12')][_0xe5ba('0x13')]===0x1f4){logger[_0xe5ba('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x86c0e8,_0x49a3dd['error'][_0xe5ba('0x14')]);return _0x1d59bd(_0x49a3dd[_0xe5ba('0x12')][_0xe5ba('0x14')]);}logger[_0xe5ba('0x12')](_0xe5ba('0xd'),_0x86c0e8,_0x49a3dd[_0xe5ba('0x12')]['message']);return _0x3ec0ab(_0x49a3dd[_0xe5ba('0x12')][_0xe5ba('0x14')]);}else{logger[_0xe5ba('0x15')](_0xe5ba('0xd'),_0x86c0e8,'request\x20sent');_0x3ec0ab(_0x49a3dd[_0xe5ba('0x16')][_0xe5ba('0x14')]);}})[_0xe5ba('0x17')](function(_0x31fd46){logger[_0xe5ba('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x86c0e8,_0x31fd46);_0x1d59bd(_0x31fd46);});});} \ No newline at end of file +var _0xf79c=['http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x26ed6e,_0x5ac011){var _0x4df57=function(_0x3643f2){while(--_0x3643f2){_0x26ed6e['push'](_0x26ed6e['shift']());}};_0x4df57(++_0x5ac011);}(_0xf79c,0x114));var _0xcf79=function(_0x38ffd4,_0x38c469){_0x38ffd4=_0x38ffd4-0x0;var _0x5d46b7=_0xf79c[_0x38ffd4];return _0x5d46b7;};'use strict';var _=require(_0xcf79('0x0'));var util=require(_0xcf79('0x1'));var moment=require(_0xcf79('0x2'));var BPromise=require(_0xcf79('0x3'));var rs=require(_0xcf79('0x4'));var fs=require('fs');var Redis=require(_0xcf79('0x5'));var db=require(_0xcf79('0x6'))['db'];var utils=require(_0xcf79('0x7'));var logger=require(_0xcf79('0x8'))(_0xcf79('0x9'));var config=require(_0xcf79('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcf79('0xb')][_0xcf79('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c4ce3,_0x3c44ec,_0x32e123){return new BPromise(function(_0x4e3dd7,_0x1b87fd){return client[_0xcf79('0xd')](_0x2c4ce3,_0x32e123)[_0xcf79('0xe')](function(_0x577932){logger['info'](_0xcf79('0xf'),_0x3c44ec,_0xcf79('0x10'));logger['debug'](_0xcf79('0x11'),_0x3c44ec,_0xcf79('0x10'),JSON[_0xcf79('0x12')](_0x577932));if(_0x577932['error']){if(_0x577932['error']['code']===0x1f4){logger[_0xcf79('0x13')](_0xcf79('0xf'),_0x3c44ec,_0x577932['error'][_0xcf79('0x14')]);return _0x1b87fd(_0x577932[_0xcf79('0x13')][_0xcf79('0x14')]);}logger[_0xcf79('0x13')](_0xcf79('0xf'),_0x3c44ec,_0x577932[_0xcf79('0x13')]['message']);return _0x4e3dd7(_0x577932['error'][_0xcf79('0x14')]);}else{logger[_0xcf79('0x15')](_0xcf79('0xf'),_0x3c44ec,_0xcf79('0x10'));_0x4e3dd7(_0x577932[_0xcf79('0x16')]['message']);}})[_0xcf79('0x17')](function(_0x46c269){logger[_0xcf79('0x13')](_0xcf79('0xf'),_0x3c44ec,_0x46c269);_0x1b87fd(_0x46c269);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 42d54f4..b518a24 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 _0x4281=['show','post','create','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./memberReport.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x59f7b8,_0xb2ac21){var _0x7b28c5=function(_0x427d2d){while(--_0x427d2d){_0x59f7b8['push'](_0x59f7b8['shift']());}};_0x7b28c5(++_0xb2ac21);}(_0x4281,0x111));var _0x1428=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4281[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x1428('0x0'));var util=require(_0x1428('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1428('0x2'));var router=express[_0x1428('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1428('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1428('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x1428('0x6')]);router[_0x1428('0x7')](_0x1428('0x8'),auth[_0x1428('0x9')](),controller[_0x1428('0xa')]);router[_0x1428('0x7')](_0x1428('0xb'),auth[_0x1428('0x9')](),controller[_0x1428('0xc')]);router[_0x1428('0xd')]('/',auth[_0x1428('0x9')](),controller[_0x1428('0xe')]);router[_0x1428('0xf')](_0x1428('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1428('0x10')](_0x1428('0xb'),auth[_0x1428('0x9')](),controller[_0x1428('0x11')]);module[_0x1428('0x12')]=router; \ No newline at end of file +var _0xd1f1=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','post','create','put','/:id'];(function(_0x345692,_0x48757e){var _0x508cf3=function(_0x236b69){while(--_0x236b69){_0x345692['push'](_0x345692['shift']());}};_0x508cf3(++_0x48757e);}(_0xd1f1,0xfb));var _0x1d1f=function(_0x6ab30c,_0x2c713b){_0x6ab30c=_0x6ab30c-0x0;var _0x36e953=_0xd1f1[_0x6ab30c];return _0x36e953;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d1f('0x0'));var timeout=require(_0x1d1f('0x1'));var express=require(_0x1d1f('0x2'));var router=express[_0x1d1f('0x3')]();var fs_extra=require(_0x1d1f('0x4'));var auth=require(_0x1d1f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d1f('0x6'));var controller=require(_0x1d1f('0x7'));router[_0x1d1f('0x8')]('/',auth[_0x1d1f('0x9')](),controller['index']);router[_0x1d1f('0x8')](_0x1d1f('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1d1f('0xb')]('/',auth[_0x1d1f('0x9')](),controller[_0x1d1f('0xc')]);router[_0x1d1f('0xd')](_0x1d1f('0xe'),auth[_0x1d1f('0x9')](),controller[_0x1d1f('0xf')]);router[_0x1d1f('0x10')](_0x1d1f('0xe'),auth[_0x1d1f('0x9')](),controller[_0x1d1f('0x11')]);module[_0x1d1f('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8d49449..bec7f57 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 _0xc8cc=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc8cc,0x178));var _0xcc8c=function(_0x5a04fe,_0xade30a){_0x5a04fe=_0x5a04fe-0x0;var _0x1c9a00=_0xc8cc[_0x5a04fe];return _0x1c9a00;};'use strict';var Sequelize=require(_0xcc8c('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xcc8c('0x1')]},'membername':{'type':Sequelize[_0xcc8c('0x1')]},'interface':{'type':Sequelize[_0xcc8c('0x1')]},'type':{'type':Sequelize[_0xcc8c('0x1')],'defaultValue':_0xcc8c('0x2'),'comment':_0xcc8c('0x3')},'duration':{'type':Sequelize[_0xcc8c('0x4')]},'enterAt':{'type':Sequelize[_0xcc8c('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3069f5){var _0xa9dba9=moment(_0x3069f5);var _0x2cdb0c=moment(this['getDataValue'](_0xcc8c('0x6')));var _0x28a725=_0xa9dba9['diff'](_0x2cdb0c,_0xcc8c('0x7'));this[_0xcc8c('0x8')]('exitAt',_0x3069f5);this['setDataValue'](_0xcc8c('0x9'),_0x28a725>=0x0?_0x28a725:null);}},'data1':{'type':Sequelize[_0xcc8c('0x1')],'comment':_0xcc8c('0xa')},'data2':{'type':Sequelize[_0xcc8c('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xcc8c('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xcc8c('0x1')],'comment':_0xcc8c('0xb')},'data5':{'type':Sequelize[_0xcc8c('0x1')],'comment':_0xcc8c('0xc')},'role':{'type':Sequelize[_0xcc8c('0x1')]},'internal':{'type':Sequelize[_0xcc8c('0x4')]},'uniqueid':{'type':Sequelize[_0xcc8c('0x1')]}}; \ No newline at end of file +var _0x3101=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x3101,0x136));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1310('0x0'));var moment=require(_0x1310('0x1'));module[_0x1310('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1310('0x3')]},'interface':{'type':Sequelize[_0x1310('0x3')]},'type':{'type':Sequelize[_0x1310('0x3')],'defaultValue':_0x1310('0x4'),'comment':_0x1310('0x5')},'duration':{'type':Sequelize[_0x1310('0x6')]},'enterAt':{'type':Sequelize[_0x1310('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x517947){var _0x334005=moment(_0x517947);var _0x500e7e=moment(this[_0x1310('0x8')]('enterAt'));var _0x2a7da7=_0x334005[_0x1310('0x9')](_0x500e7e,_0x1310('0xa'));this['setDataValue'](_0x1310('0xb'),_0x517947);this[_0x1310('0xc')]('duration',_0x2a7da7>=0x0?_0x2a7da7:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x1310('0xd')},'data2':{'type':Sequelize[_0x1310('0x3')],'comment':_0x1310('0xe')},'data3':{'type':Sequelize[_0x1310('0x3')],'comment':_0x1310('0xf')},'data4':{'type':Sequelize[_0x1310('0x3')],'comment':_0x1310('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x1310('0x6')]},'uniqueid':{'type':Sequelize[_0x1310('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 23c5497..e925f3f 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 _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(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['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 +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(_0x10fd98,_0x5209db){var _0x5347d5=function(_0x570103){while(--_0x570103){_0x10fd98['push'](_0x10fd98['shift']());}};_0x5347d5(++_0x5209db);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d923c7b..7d89ac7 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 _0x2cd9=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername','interface','lodash','util'];(function(_0x1e1d96,_0x5b2d42){var _0x1c4584=function(_0x1c22e1){while(--_0x1c22e1){_0x1e1d96['push'](_0x1e1d96['shift']());}};_0x1c4584(++_0x5b2d42);}(_0x2cd9,0x108));var _0x92cd=function(_0x3fb337,_0xa27b5a){_0x3fb337=_0x3fb337-0x0;var _0x3b4aa3=_0x2cd9[_0x3fb337];return _0x3b4aa3;};'use strict';var _=require(_0x92cd('0x0'));var util=require(_0x92cd('0x1'));var logger=require(_0x92cd('0x2'))('api');var moment=require(_0x92cd('0x3'));var BPromise=require(_0x92cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92cd('0x5'));var rimraf=require(_0x92cd('0x6'));var config=require(_0x92cd('0x7'));var attributes=require(_0x92cd('0x8'));module[_0x92cd('0x9')]=function(_0x2f31d8,_0xd1fced){return _0x2f31d8['define'](_0x92cd('0xa'),attributes,{'tableName':_0x92cd('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x92cd('0xc'),_0x92cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c9f=['api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','util','../../config/logger'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x3c9f,0x148));var _0xf3c9=function(_0x56da1a,_0xbcdb3c){_0x56da1a=_0x56da1a-0x0;var _0x572f58=_0x3c9f[_0x56da1a];return _0x572f58;};'use strict';var _=require('lodash');var util=require(_0xf3c9('0x0'));var logger=require(_0xf3c9('0x1'))(_0xf3c9('0x2'));var moment=require(_0xf3c9('0x3'));var BPromise=require(_0xf3c9('0x4'));var rp=require(_0xf3c9('0x5'));var fs=require('fs');var path=require(_0xf3c9('0x6'));var rimraf=require('rimraf');var config=require(_0xf3c9('0x7'));var attributes=require(_0xf3c9('0x8'));module[_0xf3c9('0x9')]=function(_0x3e5410,_0x574941){return _0x3e5410[_0xf3c9('0xa')]('MemberReport',attributes,{'tableName':_0xf3c9('0xb'),'paranoid':![],'indexes':[{'name':_0xf3c9('0xc'),'fields':[_0xf3c9('0xd'),_0xf3c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0cce06e..2d74e04 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 _0xbb67=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','raw','options','where','include','map','model','attributes','debug','GetMemberReport','CreateMemberReport','create','UpdateMemberReport','update','body','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbb67,0x161));var _0x7bb6=function(_0x3a8f8f,_0x45a66d){_0x3a8f8f=_0x3a8f8f-0x0;var _0x44cad1=_0xbb67[_0x3a8f8f];return _0x44cad1;};'use strict';var _=require('lodash');var util=require(_0x7bb6('0x0'));var moment=require(_0x7bb6('0x1'));var BPromise=require(_0x7bb6('0x2'));var rs=require(_0x7bb6('0x3'));var fs=require('fs');var Redis=require(_0x7bb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bb6('0x5'));var logger=require(_0x7bb6('0x6'))(_0x7bb6('0x7'));var config=require(_0x7bb6('0x8'));var jayson=require(_0x7bb6('0x9'));var client=jayson[_0x7bb6('0xa')][_0x7bb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a059b,_0x5f1898,_0x45441a){return new BPromise(function(_0x15fb32,_0x214244){return client[_0x7bb6('0xc')](_0x2a059b,_0x45441a)[_0x7bb6('0xd')](function(_0x168bb6){logger[_0x7bb6('0xe')](_0x7bb6('0xf'),_0x5f1898,_0x7bb6('0x10'));logger['debug'](_0x7bb6('0x11'),_0x5f1898,_0x7bb6('0x10'),JSON[_0x7bb6('0x12')](_0x168bb6));if(_0x168bb6[_0x7bb6('0x13')]){if(_0x168bb6[_0x7bb6('0x13')][_0x7bb6('0x14')]===0x1f4){logger[_0x7bb6('0x13')](_0x7bb6('0xf'),_0x5f1898,_0x168bb6[_0x7bb6('0x13')]['message']);return _0x214244(_0x168bb6['error'][_0x7bb6('0x15')]);}logger[_0x7bb6('0x13')]('MemberReport,\x20%s,\x20%s',_0x5f1898,_0x168bb6[_0x7bb6('0x13')][_0x7bb6('0x15')]);return _0x15fb32(_0x168bb6[_0x7bb6('0x13')][_0x7bb6('0x15')]);}else{logger[_0x7bb6('0xe')](_0x7bb6('0xf'),_0x5f1898,'request\x20sent');_0x15fb32(_0x168bb6[_0x7bb6('0x16')][_0x7bb6('0x15')]);}})[_0x7bb6('0x17')](function(_0x4095a1){logger[_0x7bb6('0x13')](_0x7bb6('0xf'),_0x5f1898,_0x4095a1);_0x214244(_0x4095a1);});});}exports['GetMemberReport']=function(_0xd1b489){var _0x5de5d4=this;return new Promise(function(_0xde089f,_0x86d630){return db[_0x7bb6('0x18')]['findAll']({'raw':_0xd1b489['options']?_0xd1b489['options'][_0x7bb6('0x19')]===undefined?!![]:![]:!![],'where':_0xd1b489[_0x7bb6('0x1a')]?_0xd1b489[_0x7bb6('0x1a')][_0x7bb6('0x1b')]||null:null,'attributes':_0xd1b489[_0x7bb6('0x1a')]?_0xd1b489[_0x7bb6('0x1a')]['attributes']||null:null,'limit':_0xd1b489[_0x7bb6('0x1a')]?_0xd1b489[_0x7bb6('0x1a')]['limit']||null:null,'include':_0xd1b489['options']?_0xd1b489['options'][_0x7bb6('0x1c')]?_[_0x7bb6('0x1d')](_0xd1b489[_0x7bb6('0x1a')]['include'],function(_0x38a569){return{'model':db[_0x38a569[_0x7bb6('0x1e')]],'as':_0x38a569['as'],'attributes':_0x38a569[_0x7bb6('0x1f')],'include':_0x38a569[_0x7bb6('0x1c')]?_[_0x7bb6('0x1d')](_0x38a569[_0x7bb6('0x1c')],function(_0x5a6a8c){return{'model':db[_0x5a6a8c[_0x7bb6('0x1e')]],'as':_0x5a6a8c['as'],'attributes':_0x5a6a8c['attributes'],'include':_0x5a6a8c[_0x7bb6('0x1c')]?_[_0x7bb6('0x1d')](_0x5a6a8c['include'],function(_0x7a96b8){return{'model':db[_0x7a96b8[_0x7bb6('0x1e')]],'as':_0x7a96b8['as'],'attributes':_0x7a96b8[_0x7bb6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa7426f){logger['info']('GetMemberReport',_0xd1b489);logger[_0x7bb6('0x20')](_0x7bb6('0x21'),_0xd1b489,JSON[_0x7bb6('0x12')](_0xa7426f));_0xde089f(_0xa7426f);})[_0x7bb6('0x17')](function(_0x2b19f8){logger[_0x7bb6('0x13')]('GetMemberReport',_0x2b19f8[_0x7bb6('0x15')],_0xd1b489);_0x86d630(_0x5de5d4['error'](0x1f4,_0x2b19f8[_0x7bb6('0x15')]));});});};exports[_0x7bb6('0x22')]=function(_0x1c4f4c){var _0x4f3763=this;return new Promise(function(_0x435ceb,_0x22d37d){return db[_0x7bb6('0x18')][_0x7bb6('0x23')](_0x1c4f4c['body'],{'raw':_0x1c4f4c[_0x7bb6('0x1a')]?_0x1c4f4c[_0x7bb6('0x1a')][_0x7bb6('0x19')]===undefined?!![]:![]:!![]})[_0x7bb6('0xd')](function(_0x18b620){logger['info'](_0x7bb6('0x22'),_0x1c4f4c);logger[_0x7bb6('0x20')](_0x7bb6('0x22'),_0x1c4f4c,JSON['stringify'](_0x18b620));_0x435ceb(_0x18b620);})[_0x7bb6('0x17')](function(_0x5a6fe2){logger[_0x7bb6('0x13')]('CreateMemberReport',_0x5a6fe2[_0x7bb6('0x15')],_0x1c4f4c);_0x22d37d(_0x4f3763[_0x7bb6('0x13')](0x1f4,_0x5a6fe2[_0x7bb6('0x15')]));});});};exports[_0x7bb6('0x24')]=function(_0x5ee4b4){var _0x4ffebf=this;return new Promise(function(_0x34627c,_0x488bea){return db[_0x7bb6('0x18')][_0x7bb6('0x25')](_0x5ee4b4[_0x7bb6('0x26')],{'raw':_0x5ee4b4[_0x7bb6('0x1a')]?_0x5ee4b4[_0x7bb6('0x1a')][_0x7bb6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ee4b4[_0x7bb6('0x1a')]?_0x5ee4b4[_0x7bb6('0x1a')][_0x7bb6('0x1b')]||null:null,'attributes':_0x5ee4b4[_0x7bb6('0x1a')]?_0x5ee4b4['options'][_0x7bb6('0x1f')]||null:null,'limit':_0x5ee4b4[_0x7bb6('0x1a')]?_0x5ee4b4[_0x7bb6('0x1a')][_0x7bb6('0x27')]||null:null})[_0x7bb6('0xd')](function(_0x439b94){logger[_0x7bb6('0xe')](_0x7bb6('0x24'),_0x5ee4b4);logger[_0x7bb6('0x20')](_0x7bb6('0x24'),_0x5ee4b4,JSON[_0x7bb6('0x12')](_0x439b94));_0x34627c(_0x439b94);})['catch'](function(_0x36b3a7){logger[_0x7bb6('0x13')]('UpdateMemberReport',_0x36b3a7['message'],_0x5ee4b4);_0x488bea(_0x4ffebf[_0x7bb6('0x13')](0x1f4,_0x36b3a7[_0x7bb6('0x15')]));});});}; \ No newline at end of file +var _0x6bac=['message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','catch','MemberReport','create','body','CreateMemberReport','debug','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','then','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MemberReport,\x20%s,\x20%s'];(function(_0xffac86,_0xe0dd87){var _0x3c32e7=function(_0x4265a3){while(--_0x4265a3){_0xffac86['push'](_0xffac86['shift']());}};_0x3c32e7(++_0xe0dd87);}(_0x6bac,0xa5));var _0xc6ba=function(_0x45fcda,_0x468fa4){_0x45fcda=_0x45fcda-0x0;var _0x4675a0=_0x6bac[_0x45fcda];return _0x4675a0;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var moment=require(_0xc6ba('0x1'));var BPromise=require(_0xc6ba('0x2'));var rs=require(_0xc6ba('0x3'));var fs=require('fs');var Redis=require(_0xc6ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6ba('0x5'));var config=require(_0xc6ba('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc6ba('0x7')][_0xc6ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33167e,_0x42858b,_0x12d6e9){return new BPromise(function(_0x1fa2a8,_0x5b98f9){return client['request'](_0x33167e,_0x12d6e9)[_0xc6ba('0x9')](function(_0x481755){logger['info']('MemberReport,\x20%s,\x20%s',_0x42858b,'request\x20sent');logger['debug'](_0xc6ba('0xa'),_0x42858b,_0xc6ba('0xb'),JSON[_0xc6ba('0xc')](_0x481755));if(_0x481755[_0xc6ba('0xd')]){if(_0x481755[_0xc6ba('0xd')]['code']===0x1f4){logger['error'](_0xc6ba('0xe'),_0x42858b,_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);return _0x5b98f9(_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x42858b,_0x481755['error'][_0xc6ba('0xf')]);return _0x1fa2a8(_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);}else{logger[_0xc6ba('0x10')](_0xc6ba('0xe'),_0x42858b,_0xc6ba('0xb'));_0x1fa2a8(_0x481755[_0xc6ba('0x11')][_0xc6ba('0xf')]);}})['catch'](function(_0x52c811){logger['error']('MemberReport,\x20%s,\x20%s',_0x42858b,_0x52c811);_0x5b98f9(_0x52c811);});});}exports['GetMemberReport']=function(_0x494d17){var _0x171eca=this;return new Promise(function(_0x15a135,_0x58f4c3){return db['MemberReport'][_0xc6ba('0x12')]({'raw':_0x494d17['options']?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x14')]===undefined?!![]:![]:!![],'where':_0x494d17['options']?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x15')]||null:null,'attributes':_0x494d17['options']?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x16')]||null:null,'limit':_0x494d17[_0xc6ba('0x13')]?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x17')]||null:null,'include':_0x494d17[_0xc6ba('0x13')]?_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x18')]?_[_0xc6ba('0x19')](_0x494d17[_0xc6ba('0x13')][_0xc6ba('0x18')],function(_0xf326f9){return{'model':db[_0xf326f9[_0xc6ba('0x1a')]],'as':_0xf326f9['as'],'attributes':_0xf326f9[_0xc6ba('0x16')],'include':_0xf326f9[_0xc6ba('0x18')]?_['map'](_0xf326f9[_0xc6ba('0x18')],function(_0x29a175){return{'model':db[_0x29a175[_0xc6ba('0x1a')]],'as':_0x29a175['as'],'attributes':_0x29a175[_0xc6ba('0x16')],'include':_0x29a175[_0xc6ba('0x18')]?_[_0xc6ba('0x19')](_0x29a175['include'],function(_0x447407){return{'model':db[_0x447407[_0xc6ba('0x1a')]],'as':_0x447407['as'],'attributes':_0x447407['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6ba('0x9')](function(_0x384240){logger['info'](_0xc6ba('0x1b'),_0x494d17);logger['debug'](_0xc6ba('0x1b'),_0x494d17,JSON[_0xc6ba('0xc')](_0x384240));_0x15a135(_0x384240);})[_0xc6ba('0x1c')](function(_0x393d4d){logger['error']('GetMemberReport',_0x393d4d[_0xc6ba('0xf')],_0x494d17);_0x58f4c3(_0x171eca['error'](0x1f4,_0x393d4d[_0xc6ba('0xf')]));});});};exports['CreateMemberReport']=function(_0x3ffa66){var _0x1181ca=this;return new Promise(function(_0x4cf6fb,_0xa079a){return db[_0xc6ba('0x1d')][_0xc6ba('0x1e')](_0x3ffa66[_0xc6ba('0x1f')],{'raw':_0x3ffa66[_0xc6ba('0x13')]?_0x3ffa66[_0xc6ba('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xc6ba('0x9')](function(_0x8949fe){logger['info'](_0xc6ba('0x20'),_0x3ffa66);logger[_0xc6ba('0x21')]('CreateMemberReport',_0x3ffa66,JSON[_0xc6ba('0xc')](_0x8949fe));_0x4cf6fb(_0x8949fe);})[_0xc6ba('0x1c')](function(_0x5e78d3){logger[_0xc6ba('0xd')](_0xc6ba('0x20'),_0x5e78d3[_0xc6ba('0xf')],_0x3ffa66);_0xa079a(_0x1181ca[_0xc6ba('0xd')](0x1f4,_0x5e78d3[_0xc6ba('0xf')]));});});};exports[_0xc6ba('0x22')]=function(_0x582a4e){var _0x3b6c15=this;return new Promise(function(_0x1518cc,_0x355eca){return db[_0xc6ba('0x1d')][_0xc6ba('0x23')](_0x582a4e[_0xc6ba('0x1f')],{'raw':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')][_0xc6ba('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')][_0xc6ba('0x15')]||null:null,'attributes':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')]['attributes']||null:null,'limit':_0x582a4e[_0xc6ba('0x13')]?_0x582a4e[_0xc6ba('0x13')][_0xc6ba('0x17')]||null:null})['then'](function(_0x2b2964){logger['info'](_0xc6ba('0x22'),_0x582a4e);logger['debug'](_0xc6ba('0x22'),_0x582a4e,JSON['stringify'](_0x2b2964));_0x1518cc(_0x2b2964);})[_0xc6ba('0x1c')](function(_0x4b1d2f){logger['error'](_0xc6ba('0x22'),_0x4b1d2f[_0xc6ba('0xf')],_0x582a4e);_0x355eca(_0x3b6c15[_0xc6ba('0xd')](0x1f4,_0x4b1d2f[_0xc6ba('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b382ce0..03071dd 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 _0x5291=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5291,0xda));var _0x1529=function(_0xded114,_0x5d4380){_0xded114=_0xded114-0x0;var _0x4e6ec3=_0x5291[_0xded114];return _0x4e6ec3;};'use strict';var multer=require(_0x1529('0x0'));var util=require(_0x1529('0x1'));var path=require(_0x1529('0x2'));var timeout=require('connect-timeout');var express=require(_0x1529('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1529('0x4'));var interaction=require(_0x1529('0x5'));var config=require(_0x1529('0x6'));var controller=require(_0x1529('0x7'));router['get']('/',controller[_0x1529('0x8')]);module[_0x1529('0x9')]=router; \ No newline at end of file +var _0x8a28=['../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a28,0xfd));var _0x88a2=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8a28[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var path=require(_0x88a2('0x2'));var timeout=require(_0x88a2('0x3'));var express=require(_0x88a2('0x4'));var router=express[_0x88a2('0x5')]();var fs_extra=require(_0x88a2('0x6'));var auth=require(_0x88a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x88a2('0x8'));var controller=require(_0x88a2('0x9'));router[_0x88a2('0xa')]('/',controller[_0x88a2('0xb')]);module[_0x88a2('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e671695..80906ad 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 _0x2b7d=['STRING','version','sequelize'];(function(_0x599318,_0x319486){var _0x7b06fa=function(_0x213872){while(--_0x213872){_0x599318['push'](_0x599318['shift']());}};_0x7b06fa(++_0x319486);}(_0x2b7d,0xbc));var _0xd2b7=function(_0x40177c,_0x444c71){_0x40177c=_0x40177c-0x0;var _0x5569d5=_0x2b7d[_0x40177c];return _0x5569d5;};'use strict';var Sequelize=require(_0xd2b7('0x0'));module['exports']={'version':{'type':Sequelize[_0xd2b7('0x1')],'unique':_0xd2b7('0x2')}}; \ No newline at end of file +var _0x3d88=['STRING','sequelize'];(function(_0x3e1996,_0xe61a43){var _0x536b3b=function(_0x5c7c51){while(--_0x5c7c51){_0x3e1996['push'](_0x3e1996['shift']());}};_0x536b3b(++_0xe61a43);}(_0x3d88,0x11b));var _0x83d8=function(_0x5ef87e,_0x105083){_0x5ef87e=_0x5ef87e-0x0;var _0x131150=_0x3d88[_0x5ef87e];return _0x131150;};'use strict';var Sequelize=require(_0x83d8('0x0'));module['exports']={'version':{'type':Sequelize[_0x83d8('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d7c0936..a6acd53 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 _0x02a6=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','Migration','findAll','rows','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x47b0e6,_0x45e036){var _0x138292=function(_0x2751e5){while(--_0x2751e5){_0x47b0e6['push'](_0x47b0e6['shift']());}};_0x138292(++_0x45e036);}(_0x02a6,0x72));var _0x602a=function(_0x253e49,_0x31ef1a){_0x253e49=_0x253e49-0x0;var _0x32029d=_0x02a6[_0x253e49];return _0x32029d;};'use strict';var emlformat=require(_0x602a('0x0'));var rimraf=require(_0x602a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x602a('0x2'));var moment=require(_0x602a('0x3'));var BPromise=require(_0x602a('0x4'));var Mustache=require('mustache');var util=require(_0x602a('0x5'));var path=require(_0x602a('0x6'));var sox=require(_0x602a('0x7'));var csv=require('to-csv');var ejs=require(_0x602a('0x8'));var fs=require('fs');var fs_extra=require(_0x602a('0x9'));var _=require(_0x602a('0xa'));var squel=require(_0x602a('0xb'));var crypto=require(_0x602a('0xc'));var jsforce=require(_0x602a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x602a('0xe'));var querystring=require('querystring');var Papa=require(_0x602a('0xf'));var Redis=require(_0x602a('0x10'));var authService=require(_0x602a('0x11'));var qs=require(_0x602a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x602a('0x13'));var logger=require('../../config/logger')(_0x602a('0x14'));var utils=require(_0x602a('0x15'));var config=require(_0x602a('0x16'));var licenseUtil=require(_0x602a('0x17'));var db=require(_0x602a('0x18'))['db'];function respondWithStatusCode(_0x4ee0c7,_0xf77431){_0xf77431=_0xf77431||0xcc;return function(_0x491be9){if(_0x491be9){return _0x4ee0c7[_0x602a('0x19')](_0xf77431);}return _0x4ee0c7[_0x602a('0x1a')](_0xf77431)['end']();};}function respondWithResult(_0x296969,_0x258289){_0x258289=_0x258289||0xc8;return function(_0x2b8fb6){if(_0x2b8fb6){return _0x296969[_0x602a('0x1a')](_0x258289)['json'](_0x2b8fb6);}};}function respondWithFilteredResult(_0x5dc1fd,_0x361fc4){return function(_0x5a8690){if(_0x5a8690){var _0x228b37=typeof _0x361fc4['offset']==='undefined'&&typeof _0x361fc4[_0x602a('0x1b')]===_0x602a('0x1c');var _0x4ecadc=_0x5a8690[_0x602a('0x1d')];var _0x5aaa78=_0x228b37?0x0:_0x361fc4[_0x602a('0x1e')];var _0x4aa327=_0x228b37?_0x5a8690[_0x602a('0x1d')]:_0x361fc4['offset']+_0x361fc4[_0x602a('0x1b')];var _0x59f31a;if(_0x4aa327>=_0x4ecadc){_0x4aa327=_0x4ecadc;_0x59f31a=0xc8;}else{_0x59f31a=0xce;}_0x5dc1fd[_0x602a('0x1a')](_0x59f31a);return _0x5dc1fd[_0x602a('0x1f')](_0x602a('0x20'),_0x5aaa78+'-'+_0x4aa327+'/'+_0x4ecadc)[_0x602a('0x21')](_0x5a8690);}return null;};}function patchUpdates(_0x32e74a){return function(_0x4f9c5b){try{jsonpatch[_0x602a('0x22')](_0x4f9c5b,_0x32e74a,!![]);}catch(_0x3316af){return BPromise[_0x602a('0x23')](_0x3316af);}return _0x4f9c5b['save']();};}function saveUpdates(_0x1733c2,_0x55a8a3){return function(_0x441ad2){if(_0x441ad2){return _0x441ad2[_0x602a('0x24')](_0x1733c2)['then'](function(_0x2b37cc){return _0x2b37cc;});}return null;};}function removeEntity(_0x1d72f5,_0x3147ec){return function(_0x1de456){if(_0x1de456){return _0x1de456[_0x602a('0x25')]()[_0x602a('0x26')](function(){_0x1d72f5['status'](0xcc)[_0x602a('0x27')]();});}};}function handleEntityNotFound(_0x27eb8a,_0x36a1ef){return function(_0x1bac3){if(!_0x1bac3){_0x27eb8a[_0x602a('0x19')](0x194);}return _0x1bac3;};}function handleError(_0x5615d3,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x440c96){logger[_0x602a('0x28')](_0x440c96[_0x602a('0x29')]);if(_0x440c96['name']){delete _0x440c96[_0x602a('0x2a')];}_0x5615d3[_0x602a('0x1a')](_0x40c424)[_0x602a('0x2b')](_0x440c96);};}exports['index']=function(_0x23d5de,_0x14c4cd){var _0x15cc22={},_0x32bae0={},_0x453e61={'count':0x0,'rows':[]};var _0x4b5ba5=_[_0x602a('0x2c')](db['Migration'][_0x602a('0x2d')],function(_0x4c621e){return{'name':_0x4c621e[_0x602a('0x2e')],'type':_0x4c621e[_0x602a('0x2f')][_0x602a('0x30')]};});_0x32bae0[_0x602a('0x31')]=_['map'](_0x4b5ba5,'name');_0x32bae0[_0x602a('0x32')]=_[_0x602a('0x33')](_0x23d5de[_0x602a('0x32')]);_0x32bae0[_0x602a('0x34')]=_[_0x602a('0x35')](_0x32bae0[_0x602a('0x31')],_0x32bae0[_0x602a('0x32')]);_0x15cc22[_0x602a('0x36')]=_[_0x602a('0x35')](_0x32bae0[_0x602a('0x31')],qs[_0x602a('0x37')](_0x23d5de['query']['fields']));_0x15cc22[_0x602a('0x36')]=_0x15cc22['attributes'][_0x602a('0x38')]?_0x15cc22[_0x602a('0x36')]:_0x32bae0['model'];if(!_0x23d5de['query'][_0x602a('0x39')](_0x602a('0x3a'))){_0x15cc22[_0x602a('0x1b')]=qs[_0x602a('0x1b')](_0x23d5de[_0x602a('0x32')][_0x602a('0x1b')]);_0x15cc22[_0x602a('0x1e')]=qs[_0x602a('0x1e')](_0x23d5de[_0x602a('0x32')][_0x602a('0x1e')]);}_0x15cc22['order']=qs[_0x602a('0x3b')](_0x23d5de[_0x602a('0x32')]['sort']);_0x15cc22['where']=qs[_0x602a('0x34')](_['pick'](_0x23d5de['query'],_0x32bae0['filters']),_0x4b5ba5);if(_0x23d5de[_0x602a('0x32')][_0x602a('0x3c')]){_0x15cc22[_0x602a('0x3d')]=_['merge'](_0x15cc22['where'],{'$or':_[_0x602a('0x2c')](_0x4b5ba5,function(_0xb6ebe4){if(_0xb6ebe4[_0x602a('0x2f')]!==_0x602a('0x3e')){var _0x47ca9c={};_0x47ca9c[_0xb6ebe4['name']]={'$like':'%'+_0x23d5de[_0x602a('0x32')][_0x602a('0x3c')]+'%'};return _0x47ca9c;}})});}_0x15cc22=_[_0x602a('0x3f')]({},_0x15cc22,_0x23d5de[_0x602a('0x40')]);var _0x1433e8={'where':_0x15cc22[_0x602a('0x3d')]};return db[_0x602a('0x41')][_0x602a('0x1d')](_0x1433e8)['then'](function(_0x9924f){_0x453e61['count']=_0x9924f;if(_0x23d5de[_0x602a('0x32')]['includeAll']){_0x15cc22['include']=[{'all':!![]}];}return db['Migration'][_0x602a('0x42')](_0x15cc22);})[_0x602a('0x26')](function(_0x11202f){_0x453e61[_0x602a('0x43')]=_0x11202f;return _0x453e61;})[_0x602a('0x26')](respondWithFilteredResult(_0x14c4cd,_0x15cc22))['catch'](handleError(_0x14c4cd,null));}; \ No newline at end of file +var _0x0deb=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','Migration','include','rows','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x51a164,_0x4e6fb0){var _0x4ac595=function(_0x87c1d1){while(--_0x87c1d1){_0x51a164['push'](_0x51a164['shift']());}};_0x4ac595(++_0x4e6fb0);}(_0x0deb,0x1e5));var _0xb0de=function(_0x53f394,_0x59c122){_0x53f394=_0x53f394-0x0;var _0x1920e0=_0x0deb[_0x53f394];return _0x1920e0;};'use strict';var emlformat=require(_0xb0de('0x0'));var rimraf=require(_0xb0de('0x1'));var zipdir=require(_0xb0de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb0de('0x3'));var BPromise=require(_0xb0de('0x4'));var Mustache=require(_0xb0de('0x5'));var util=require(_0xb0de('0x6'));var path=require(_0xb0de('0x7'));var sox=require(_0xb0de('0x8'));var csv=require(_0xb0de('0x9'));var ejs=require(_0xb0de('0xa'));var fs=require('fs');var fs_extra=require(_0xb0de('0xb'));var _=require(_0xb0de('0xc'));var squel=require(_0xb0de('0xd'));var crypto=require(_0xb0de('0xe'));var jsforce=require(_0xb0de('0xf'));var deskjs=require(_0xb0de('0x10'));var toCsv=require(_0xb0de('0x9'));var querystring=require(_0xb0de('0x11'));var Papa=require(_0xb0de('0x12'));var Redis=require(_0xb0de('0x13'));var authService=require(_0xb0de('0x14'));var qs=require(_0xb0de('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0de('0x16'));var logger=require(_0xb0de('0x17'))('api');var utils=require(_0xb0de('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb0de('0x19'));var db=require(_0xb0de('0x1a'))['db'];function respondWithStatusCode(_0x5a306b,_0x3bc2dc){_0x3bc2dc=_0x3bc2dc||0xcc;return function(_0xb279ec){if(_0xb279ec){return _0x5a306b[_0xb0de('0x1b')](_0x3bc2dc);}return _0x5a306b[_0xb0de('0x1c')](_0x3bc2dc)[_0xb0de('0x1d')]();};}function respondWithResult(_0x493a8c,_0x3b02fa){_0x3b02fa=_0x3b02fa||0xc8;return function(_0x4f21e1){if(_0x4f21e1){return _0x493a8c['status'](_0x3b02fa)[_0xb0de('0x1e')](_0x4f21e1);}};}function respondWithFilteredResult(_0x2ac317,_0x3cb30e){return function(_0x4a0d10){if(_0x4a0d10){var _0x180d1f=typeof _0x3cb30e['offset']==='undefined'&&typeof _0x3cb30e[_0xb0de('0x1f')]===_0xb0de('0x20');var _0x4dee08=_0x4a0d10[_0xb0de('0x21')];var _0x408fd9=_0x180d1f?0x0:_0x3cb30e[_0xb0de('0x22')];var _0x281004=_0x180d1f?_0x4a0d10['count']:_0x3cb30e[_0xb0de('0x22')]+_0x3cb30e['limit'];var _0x53ce92;if(_0x281004>=_0x4dee08){_0x281004=_0x4dee08;_0x53ce92=0xc8;}else{_0x53ce92=0xce;}_0x2ac317[_0xb0de('0x1c')](_0x53ce92);return _0x2ac317[_0xb0de('0x23')](_0xb0de('0x24'),_0x408fd9+'-'+_0x281004+'/'+_0x4dee08)['json'](_0x4a0d10);}return null;};}function patchUpdates(_0x2ae297){return function(_0x1a244d){try{jsonpatch[_0xb0de('0x25')](_0x1a244d,_0x2ae297,!![]);}catch(_0x484402){return BPromise['reject'](_0x484402);}return _0x1a244d[_0xb0de('0x26')]();};}function saveUpdates(_0xb5096b,_0x40c42a){return function(_0xb8cf42){if(_0xb8cf42){return _0xb8cf42[_0xb0de('0x27')](_0xb5096b)[_0xb0de('0x28')](function(_0x4cbb57){return _0x4cbb57;});}return null;};}function removeEntity(_0xfcb13c,_0x539331){return function(_0x5aa4a7){if(_0x5aa4a7){return _0x5aa4a7[_0xb0de('0x29')]()[_0xb0de('0x28')](function(){_0xfcb13c[_0xb0de('0x1c')](0xcc)[_0xb0de('0x1d')]();});}};}function handleEntityNotFound(_0x5a2228,_0x16da64){return function(_0x2b4196){if(!_0x2b4196){_0x5a2228[_0xb0de('0x1b')](0x194);}return _0x2b4196;};}function handleError(_0x3a514b,_0x21d955){_0x21d955=_0x21d955||0x1f4;return function(_0x444f2b){logger[_0xb0de('0x2a')](_0x444f2b[_0xb0de('0x2b')]);if(_0x444f2b[_0xb0de('0x2c')]){delete _0x444f2b[_0xb0de('0x2c')];}_0x3a514b[_0xb0de('0x1c')](_0x21d955)['send'](_0x444f2b);};}exports[_0xb0de('0x2d')]=function(_0x5ec0ce,_0x4ef6c9){var _0x5cc03f={},_0x266487={},_0x1be47a={'count':0x0,'rows':[]};var _0x317445=_[_0xb0de('0x2e')](db['Migration'][_0xb0de('0x2f')],function(_0x57178f){return{'name':_0x57178f[_0xb0de('0x30')],'type':_0x57178f['type'][_0xb0de('0x31')]};});_0x266487['model']=_['map'](_0x317445,_0xb0de('0x2c'));_0x266487[_0xb0de('0x32')]=_[_0xb0de('0x33')](_0x5ec0ce['query']);_0x266487[_0xb0de('0x34')]=_[_0xb0de('0x35')](_0x266487[_0xb0de('0x36')],_0x266487[_0xb0de('0x32')]);_0x5cc03f[_0xb0de('0x37')]=_['intersection'](_0x266487[_0xb0de('0x36')],qs['fields'](_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x38')]));_0x5cc03f[_0xb0de('0x37')]=_0x5cc03f['attributes'][_0xb0de('0x39')]?_0x5cc03f[_0xb0de('0x37')]:_0x266487['model'];if(!_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x3a')](_0xb0de('0x3b'))){_0x5cc03f[_0xb0de('0x1f')]=qs[_0xb0de('0x1f')](_0x5ec0ce['query'][_0xb0de('0x1f')]);_0x5cc03f['offset']=qs[_0xb0de('0x22')](_0x5ec0ce['query'][_0xb0de('0x22')]);}_0x5cc03f[_0xb0de('0x3c')]=qs['sort'](_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x3d')]);_0x5cc03f['where']=qs['filters'](_[_0xb0de('0x3e')](_0x5ec0ce[_0xb0de('0x32')],_0x266487['filters']),_0x317445);if(_0x5ec0ce['query'][_0xb0de('0x3f')]){_0x5cc03f[_0xb0de('0x40')]=_[_0xb0de('0x41')](_0x5cc03f[_0xb0de('0x40')],{'$or':_[_0xb0de('0x2e')](_0x317445,function(_0x36f2f5){if(_0x36f2f5[_0xb0de('0x42')]!==_0xb0de('0x43')){var _0x5a37dc={};_0x5a37dc[_0x36f2f5[_0xb0de('0x2c')]]={'$like':'%'+_0x5ec0ce[_0xb0de('0x32')][_0xb0de('0x3f')]+'%'};return _0x5a37dc;}})});}_0x5cc03f=_[_0xb0de('0x41')]({},_0x5cc03f,_0x5ec0ce['options']);var _0x5076c1={'where':_0x5cc03f['where']};return db[_0xb0de('0x44')][_0xb0de('0x21')](_0x5076c1)[_0xb0de('0x28')](function(_0x34fdb8){_0x1be47a[_0xb0de('0x21')]=_0x34fdb8;if(_0x5ec0ce[_0xb0de('0x32')]['includeAll']){_0x5cc03f[_0xb0de('0x45')]=[{'all':!![]}];}return db[_0xb0de('0x44')]['findAll'](_0x5cc03f);})[_0xb0de('0x28')](function(_0x3dd98f){_0x1be47a[_0xb0de('0x46')]=_0x3dd98f;return _0x1be47a;})['then'](respondWithFilteredResult(_0x4ef6c9,_0x5cc03f))[_0xb0de('0x47')](handleError(_0x4ef6c9,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 958e980..dde8019 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 _0xe0fe=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','api','bluebird','path'];(function(_0x5d7696,_0x185685){var _0x39297c=function(_0x3bfb53){while(--_0x3bfb53){_0x5d7696['push'](_0x5d7696['shift']());}};_0x39297c(++_0x185685);}(_0xe0fe,0x188));var _0xee0f=function(_0x5c858f,_0x4ff8ab){_0x5c858f=_0x5c858f-0x0;var _0x31cc29=_0xe0fe[_0x5c858f];return _0x31cc29;};'use strict';var _=require('lodash');var util=require(_0xee0f('0x0'));var logger=require('../../config/logger')(_0xee0f('0x1'));var moment=require('moment');var BPromise=require(_0xee0f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0f('0x3'));var rimraf=require(_0xee0f('0x4'));var config=require(_0xee0f('0x5'));var attributes=require(_0xee0f('0x6'));module[_0xee0f('0x7')]=function(_0xda8b2a,_0x3e883d){return _0xda8b2a[_0xee0f('0x8')](_0xee0f('0x9'),attributes,{'tableName':_0xee0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dbe=['path','../../config/environment','exports','Migration','migrations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5dbe,0x170));var _0xe5db=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x5dbe[_0x2a1465];return _0x128933;};'use strict';var _=require('lodash');var util=require(_0xe5db('0x0'));var logger=require(_0xe5db('0x1'))(_0xe5db('0x2'));var moment=require(_0xe5db('0x3'));var BPromise=require(_0xe5db('0x4'));var rp=require(_0xe5db('0x5'));var fs=require('fs');var path=require(_0xe5db('0x6'));var rimraf=require('rimraf');var config=require(_0xe5db('0x7'));var attributes=require('./migration.attributes');module[_0xe5db('0x8')]=function(_0x3d5d94,_0x7f115){return _0x3d5d94['define'](_0xe5db('0x9'),attributes,{'tableName':_0xe5db('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 ddb751d..e2cd15b 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 _0x7914=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7914,0x107));var _0x4791=function(_0x4d330c,_0x1f2f1f){_0x4d330c=_0x4d330c-0x0;var _0x3e6551=_0x7914[_0x4d330c];return _0x3e6551;};'use strict';var _=require(_0x4791('0x0'));var util=require(_0x4791('0x1'));var moment=require('moment');var BPromise=require(_0x4791('0x2'));var rs=require(_0x4791('0x3'));var fs=require('fs');var Redis=require(_0x4791('0x4'));var db=require(_0x4791('0x5'))['db'];var utils=require(_0x4791('0x6'));var logger=require(_0x4791('0x7'))(_0x4791('0x8'));var config=require(_0x4791('0x9'));var jayson=require(_0x4791('0xa'));var client=jayson[_0x4791('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x306863,_0x559fc1,_0x1dc98f){return new BPromise(function(_0x22163f,_0xa154fc){return client[_0x4791('0xc')](_0x306863,_0x1dc98f)[_0x4791('0xd')](function(_0x153de4){logger[_0x4791('0xe')](_0x4791('0xf'),_0x559fc1,'request\x20sent');logger[_0x4791('0x10')](_0x4791('0x11'),_0x559fc1,_0x4791('0x12'),JSON[_0x4791('0x13')](_0x153de4));if(_0x153de4[_0x4791('0x14')]){if(_0x153de4[_0x4791('0x14')]['code']===0x1f4){logger[_0x4791('0x14')](_0x4791('0xf'),_0x559fc1,_0x153de4['error'][_0x4791('0x15')]);return _0xa154fc(_0x153de4[_0x4791('0x14')][_0x4791('0x15')]);}logger[_0x4791('0x14')](_0x4791('0xf'),_0x559fc1,_0x153de4[_0x4791('0x14')][_0x4791('0x15')]);return _0x22163f(_0x153de4['error'][_0x4791('0x15')]);}else{logger[_0x4791('0xe')]('Migration,\x20%s,\x20%s',_0x559fc1,_0x4791('0x12'));_0x22163f(_0x153de4[_0x4791('0x16')][_0x4791('0x15')]);}})[_0x4791('0x17')](function(_0xab1f15){logger['error']('Migration,\x20%s,\x20%s',_0x559fc1,_0xab1f15);_0xa154fc(_0xab1f15);});});} \ No newline at end of file +var _0x6be1=['code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x135921,_0x186ef7){var _0xbdc52b=function(_0x4f17ff){while(--_0x4f17ff){_0x135921['push'](_0x135921['shift']());}};_0xbdc52b(++_0x186ef7);}(_0x6be1,0x12f));var _0x16be=function(_0x5b1b17,_0x146be4){_0x5b1b17=_0x5b1b17-0x0;var _0x241ce8=_0x6be1[_0x5b1b17];return _0x241ce8;};'use strict';var _=require(_0x16be('0x0'));var util=require(_0x16be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16be('0x2'))['db'];var utils=require(_0x16be('0x3'));var logger=require(_0x16be('0x4'))(_0x16be('0x5'));var config=require(_0x16be('0x6'));var jayson=require(_0x16be('0x7'));var client=jayson[_0x16be('0x8')][_0x16be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f6c26,_0x1c5e94,_0x4eaedb){return new BPromise(function(_0x36438c,_0x32ff9a){return client[_0x16be('0xa')](_0x2f6c26,_0x4eaedb)[_0x16be('0xb')](function(_0x1a820e){logger[_0x16be('0xc')](_0x16be('0xd'),_0x1c5e94,_0x16be('0xe'));logger[_0x16be('0xf')](_0x16be('0x10'),_0x1c5e94,_0x16be('0xe'),JSON[_0x16be('0x11')](_0x1a820e));if(_0x1a820e[_0x16be('0x12')]){if(_0x1a820e[_0x16be('0x12')][_0x16be('0x13')]===0x1f4){logger[_0x16be('0x12')]('Migration,\x20%s,\x20%s',_0x1c5e94,_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);return _0x32ff9a(_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);}logger[_0x16be('0x12')]('Migration,\x20%s,\x20%s',_0x1c5e94,_0x1a820e[_0x16be('0x12')][_0x16be('0x14')]);return _0x36438c(_0x1a820e['error'][_0x16be('0x14')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x1c5e94,'request\x20sent');_0x36438c(_0x1a820e[_0x16be('0x15')][_0x16be('0x14')]);}})[_0x16be('0x16')](function(_0x5e8eeb){logger[_0x16be('0x12')]('Migration,\x20%s,\x20%s',_0x1c5e94,_0x5e8eeb);_0x32ff9a(_0x5e8eeb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f83c40e..b265a4f 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 _0xa76e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util','path'];(function(_0x8d0479,_0x4dd2c5){var _0x156aa7=function(_0x3d2221){while(--_0x3d2221){_0x8d0479['push'](_0x8d0479['shift']());}};_0x156aa7(++_0x4dd2c5);}(_0xa76e,0xfe));var _0xea76=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xa76e[_0x420b24];return _0x4da552;};'use strict';var multer=require('multer');var util=require(_0xea76('0x0'));var path=require(_0xea76('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea76('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xea76('0x3'));var interaction=require(_0xea76('0x4'));var config=require(_0xea76('0x5'));var controller=require('./network.controller');router[_0xea76('0x6')]('/',auth['isAuthenticated'](),controller[_0xea76('0x7')]);router['get'](_0xea76('0x8'),auth[_0xea76('0x9')](),controller['show']);router['post']('/',auth[_0xea76('0x9')](),controller[_0xea76('0xa')]);router[_0xea76('0xb')](_0xea76('0x8'),auth['isAuthenticated'](),controller[_0xea76('0xc')]);router[_0xea76('0xd')](_0xea76('0x8'),auth['isAuthenticated'](),controller[_0xea76('0xe')]);module[_0xea76('0xf')]=router; \ No newline at end of file +var _0xcbb1=['destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','index','get','/:id','show','post','isAuthenticated','create'];(function(_0x27330f,_0x31bc6e){var _0x2db58b=function(_0x27386b){while(--_0x27386b){_0x27330f['push'](_0x27330f['shift']());}};_0x2db58b(++_0x31bc6e);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x42888c,_0x23bd98){_0x42888c=_0x42888c-0x0;var _0x2439ca=_0xcbb1[_0x42888c];return _0x2439ca;};'use strict';var multer=require('multer');var util=require(_0x1cbb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1cbb('0x1'));var router=express[_0x1cbb('0x2')]();var fs_extra=require(_0x1cbb('0x3'));var auth=require(_0x1cbb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1cbb('0x5'));var controller=require(_0x1cbb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1cbb('0x7')]);router[_0x1cbb('0x8')](_0x1cbb('0x9'),auth['isAuthenticated'](),controller[_0x1cbb('0xa')]);router[_0x1cbb('0xb')]('/',auth[_0x1cbb('0xc')](),controller[_0x1cbb('0xd')]);router['put'](_0x1cbb('0x9'),auth[_0x1cbb('0xc')](),controller['update']);router['delete']('/:id',auth[_0x1cbb('0xc')](),controller[_0x1cbb('0xe')]);module[_0x1cbb('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index cf17ec6..1df9858 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 _0x8db7=['localnet','turn','STRING','sequelize','exports'];(function(_0x5c3b6e,_0x572915){var _0x178743=function(_0x53891f){while(--_0x53891f){_0x5c3b6e['push'](_0x5c3b6e['shift']());}};_0x178743(++_0x572915);}(_0x8db7,0x7b));var _0x78db=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x8db7[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x78db('0x0'));module[_0x78db('0x1')]={'type':{'type':Sequelize['ENUM'](_0x78db('0x2'),'externip','stun',_0x78db('0x3'))},'value':{'type':Sequelize[_0x78db('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x78db('0x4')]}}; \ No newline at end of file +var _0x4dcc=['localnet','externip','stun','STRING','sequelize','ENUM'];(function(_0x3b342c,_0xf029e5){var _0x3246af=function(_0x2895b3){while(--_0x2895b3){_0x3b342c['push'](_0x3b342c['shift']());}};_0x3246af(++_0xf029e5);}(_0x4dcc,0xf4));var _0xc4dc=function(_0xfa874a,_0x990e70){_0xfa874a=_0xfa874a-0x0;var _0x3ffce4=_0x4dcc[_0xfa874a];return _0x3ffce4;};'use strict';var Sequelize=require(_0xc4dc('0x0'));module['exports']={'type':{'type':Sequelize[_0xc4dc('0x1')](_0xc4dc('0x2'),_0xc4dc('0x3'),_0xc4dc('0x4'),'turn')},'value':{'type':Sequelize[_0xc4dc('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc4dc('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fcce374..e3dd187 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 _0x0ecc=['debug','Network,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','create','body','findAll','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','root','server/files/templates/network.ejs','chan_sip.so','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0ecc,0x9f));var _0xc0ec=function(_0xb7efda,_0x31ff7b){_0xb7efda=_0xb7efda-0x0;var _0x2312d1=_0x0ecc[_0xb7efda];return _0x2312d1;};'use strict';var util=require('util');var path=require(_0xc0ec('0x0'));var ejs=require(_0xc0ec('0x1'));var fs=require('fs');var _=require(_0xc0ec('0x2'));var qs=require(_0xc0ec('0x3'));var logger=require(_0xc0ec('0x4'))(_0xc0ec('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xc0ec('0x6'));var client=jayson[_0xc0ec('0x7')][_0xc0ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59448c,_0x37a312,_0x34139c,_0x5b58dd){return new Promise(function(_0x123d76,_0x4bbf0e){var _0xc3d33=_0x5b58dd||client;return _0xc3d33[_0xc0ec('0x9')](_0x59448c,_0x34139c)[_0xc0ec('0xa')](function(_0x406a5a){logger['info'](_0xc0ec('0xb'),_0x37a312,_0xc0ec('0xc'));logger[_0xc0ec('0xd')](_0xc0ec('0xe'),_0x37a312,_0xc0ec('0xc'),JSON['stringify'](_0x406a5a));if(_0x406a5a['error']){if(_0x406a5a['error'][_0xc0ec('0xf')]===0x1f4){logger[_0xc0ec('0x10')](_0xc0ec('0xb'),_0x37a312,_0x406a5a[_0xc0ec('0x10')][_0xc0ec('0x11')]);return _0x4bbf0e(_0x406a5a[_0xc0ec('0x10')]['message']);}logger[_0xc0ec('0x10')]('Network,\x20%s,\x20%s',_0x37a312,_0x406a5a[_0xc0ec('0x10')][_0xc0ec('0x11')]);return _0x123d76(_0x406a5a['error'][_0xc0ec('0x11')]);}else{logger['info'](_0xc0ec('0xb'),_0x37a312,_0xc0ec('0xc'));_0x123d76(_0x406a5a[_0xc0ec('0x12')]['message']);}})[_0xc0ec('0x13')](function(_0x4e5fe6){logger[_0xc0ec('0x10')](_0xc0ec('0xb'),_0x37a312,_0x4e5fe6);_0x4bbf0e(_0x4e5fe6);});});}function respondWithResult(_0x2319fd,_0x9412ce){_0x9412ce=_0x9412ce||0xc8;return function(_0x2ae99b){if(_0x2ae99b){return _0x2319fd['status'](_0x9412ce)[_0xc0ec('0x14')](_0x2ae99b);}};}function respondWithFilteredResult(_0x1ed86b,_0x1b8d96){return function(_0x48e5c8){if(_0x48e5c8){var _0x38bba5=typeof _0x1b8d96[_0xc0ec('0x15')]===_0xc0ec('0x16')&&typeof _0x1b8d96[_0xc0ec('0x17')]===_0xc0ec('0x16');var _0x585a98=_0x48e5c8[_0xc0ec('0x18')];var _0x3e6f4d=_0x38bba5?0x0:_0x1b8d96['offset'];var _0x40f719=_0x38bba5?_0x48e5c8[_0xc0ec('0x18')]:_0x1b8d96['offset']+_0x1b8d96['limit'];var _0x24fd8c;if(_0x40f719>=_0x585a98){_0x40f719=_0x585a98;_0x24fd8c=0xc8;}else{_0x24fd8c=0xce;}_0x1ed86b[_0xc0ec('0x19')](_0x24fd8c);return _0x1ed86b[_0xc0ec('0x1a')](_0xc0ec('0x1b'),_0x3e6f4d+'-'+_0x40f719+'/'+_0x585a98)[_0xc0ec('0x14')](_0x48e5c8);}return null;};}function saveUpdates(_0x819eb7){return function(_0x1d2bbf){if(_0x1d2bbf){return _0x1d2bbf[_0xc0ec('0x1c')](_0x819eb7)[_0xc0ec('0xa')](function(_0xc78e0f){return _0xc78e0f;});}return null;};}function removeEntity(_0x9cc4e3){return function(_0x525005){if(_0x525005){return _0x525005[_0xc0ec('0x1d')]()[_0xc0ec('0xa')](function(){_0x9cc4e3[_0xc0ec('0x19')](0xcc)[_0xc0ec('0x1e')]();});}};}function handleEntityNotFound(_0x4621d3){return function(_0x19340f){if(!_0x19340f){_0x4621d3['sendStatus'](0x194);}return _0x19340f;};}function handleError(_0x4267c8,_0xbb279f){_0xbb279f=_0xbb279f||0x1f4;return function(_0x59a16c){logger[_0xc0ec('0x10')](_0x59a16c[_0xc0ec('0x1f')]);if(_0x59a16c[_0xc0ec('0x20')]){delete _0x59a16c[_0xc0ec('0x20')];}_0x4267c8[_0xc0ec('0x19')](_0xbb279f)[_0xc0ec('0x21')](_0x59a16c);};}exports[_0xc0ec('0x22')]=function(_0x3dfb91,_0x5c6282){var _0x5c5103={},_0x2e8f82={},_0x933470={'count':0x0,'rows':[]};var _0x206f11=_[_0xc0ec('0x23')](db[_0xc0ec('0x24')][_0xc0ec('0x25')],function(_0x3ed18b){return{'name':_0x3ed18b[_0xc0ec('0x26')],'type':_0x3ed18b[_0xc0ec('0x27')][_0xc0ec('0x28')]};});_0x2e8f82[_0xc0ec('0x29')]=_['map'](_0x206f11,'name');_0x2e8f82[_0xc0ec('0x2a')]=_[_0xc0ec('0x2b')](_0x3dfb91[_0xc0ec('0x2a')]);_0x2e8f82[_0xc0ec('0x2c')]=_[_0xc0ec('0x2d')](_0x2e8f82[_0xc0ec('0x29')],_0x2e8f82[_0xc0ec('0x2a')]);_0x5c5103['attributes']=_[_0xc0ec('0x2d')](_0x2e8f82[_0xc0ec('0x29')],qs[_0xc0ec('0x2e')](_0x3dfb91[_0xc0ec('0x2a')][_0xc0ec('0x2e')]));_0x5c5103[_0xc0ec('0x2f')]=_0x5c5103[_0xc0ec('0x2f')][_0xc0ec('0x30')]?_0x5c5103[_0xc0ec('0x2f')]:_0x2e8f82['model'];if(!_0x3dfb91['query'][_0xc0ec('0x31')](_0xc0ec('0x32'))){_0x5c5103[_0xc0ec('0x17')]=qs[_0xc0ec('0x17')](_0x3dfb91[_0xc0ec('0x2a')]['limit']);_0x5c5103[_0xc0ec('0x15')]=qs['offset'](_0x3dfb91[_0xc0ec('0x2a')][_0xc0ec('0x15')]);}_0x5c5103[_0xc0ec('0x33')]=qs[_0xc0ec('0x34')](_0x3dfb91[_0xc0ec('0x2a')][_0xc0ec('0x34')]);_0x5c5103[_0xc0ec('0x35')]=qs[_0xc0ec('0x2c')](_[_0xc0ec('0x36')](_0x3dfb91[_0xc0ec('0x2a')],_0x2e8f82['filters']),_0x206f11);if(_0x3dfb91['query'][_0xc0ec('0x37')]){_0x5c5103['where']=_[_0xc0ec('0x38')](_0x5c5103[_0xc0ec('0x35')],{'$or':_[_0xc0ec('0x23')](_0x206f11,function(_0x28562d){if(_0x28562d[_0xc0ec('0x27')]!==_0xc0ec('0x39')){var _0x573864={};_0x573864[_0x28562d[_0xc0ec('0x20')]]={'$like':'%'+_0x3dfb91[_0xc0ec('0x2a')]['filter']+'%'};return _0x573864;}})});}_0x5c5103=_['merge']({},_0x5c5103,_0x3dfb91[_0xc0ec('0x3a')]);var _0x52c169={'where':_0x5c5103[_0xc0ec('0x35')]};return db[_0xc0ec('0x24')][_0xc0ec('0x18')](_0x52c169)[_0xc0ec('0xa')](function(_0x4f97fb){_0x933470[_0xc0ec('0x18')]=_0x4f97fb;if(_0x3dfb91[_0xc0ec('0x2a')][_0xc0ec('0x3b')]){_0x5c5103[_0xc0ec('0x3c')]=[{'all':!![]}];}return db[_0xc0ec('0x24')]['findAll'](_0x5c5103);})['then'](function(_0x1338f6){_0x933470[_0xc0ec('0x3d')]=_0x1338f6;return _0x933470;})[_0xc0ec('0xa')](respondWithFilteredResult(_0x5c6282,_0x5c5103))['catch'](handleError(_0x5c6282,null));};exports['show']=function(_0x300d73,_0x2087c4){var _0x4765c2={'raw':!![],'where':{'id':_0x300d73['params']['id']}},_0x528781={};_0x528781[_0xc0ec('0x29')]=_['keys'](db[_0xc0ec('0x24')][_0xc0ec('0x25')]);_0x528781[_0xc0ec('0x2a')]=_['keys'](_0x300d73[_0xc0ec('0x2a')]);_0x528781[_0xc0ec('0x2c')]=_['intersection'](_0x528781[_0xc0ec('0x29')],_0x528781['query']);_0x4765c2[_0xc0ec('0x2f')]=_[_0xc0ec('0x2d')](_0x528781[_0xc0ec('0x29')],qs['fields'](_0x300d73[_0xc0ec('0x2a')][_0xc0ec('0x2e')]));_0x4765c2[_0xc0ec('0x2f')]=_0x4765c2['attributes'][_0xc0ec('0x30')]?_0x4765c2[_0xc0ec('0x2f')]:_0x528781[_0xc0ec('0x29')];if(_0x300d73[_0xc0ec('0x2a')]['includeAll']){_0x4765c2[_0xc0ec('0x3c')]=[{'all':!![]}];}_0x4765c2=_[_0xc0ec('0x38')]({},_0x4765c2,_0x300d73['options']);return db['Network'][_0xc0ec('0x3e')](_0x4765c2)[_0xc0ec('0xa')](handleEntityNotFound(_0x2087c4,null))[_0xc0ec('0xa')](respondWithResult(_0x2087c4,null))[_0xc0ec('0x13')](handleError(_0x2087c4,null));};exports['create']=function(_0xe23634,_0x2eca0c){var _0xf0e2cd;return db['Network'][_0xc0ec('0x3f')](_0xe23634[_0xc0ec('0x40')],{'raw':!![]})[_0xc0ec('0xa')](function(_0x29f780){_0xf0e2cd=_0x29f780;return db['Network'][_0xc0ec('0x41')]({'where':{'type':_0xe23634[_0xc0ec('0x40')]['type']},'raw':!![]});})[_0xc0ec('0xa')](function(_0x1aae28){if(_0xf0e2cd['type']['toUpperCase']()==_0xc0ec('0x42')){var _0x64c503=fs['readFileSync'](path[_0xc0ec('0x43')](config['root'],_0xc0ec('0x44')),_0xc0ec('0x45'));var _0x4354e2=ejs[_0xc0ec('0x46')](_0x64c503,{'networks':_0x1aae28||[]});fs[_0xc0ec('0x47')](_0xc0ec('0x48'),_0x4354e2);return respondWithRpcPromise('Reload',_0xc0ec('0x3f'),{'module':_0xc0ec('0x49')});}else if(_0xf0e2cd[_0xc0ec('0x27')][_0xc0ec('0x4a')]()==_0xc0ec('0x4b')){var _0x323c99=fs[_0xc0ec('0x4c')](path['join'](config['root'],_0xc0ec('0x4d')),_0xc0ec('0x45'));var _0x33f710=ejs[_0xc0ec('0x46')](_0x323c99,{'networks':_0x1aae28||[]});fs[_0xc0ec('0x47')](_0xc0ec('0x4e'),_0x33f710);return respondWithRpcPromise(_0xc0ec('0x4f'),_0xc0ec('0x3f'),{'module':'res_stun_monitor.so'});}else{var _0x178bce=fs[_0xc0ec('0x4c')](path['join'](config[_0xc0ec('0x50')],_0xc0ec('0x51')),_0xc0ec('0x45'));var _0x838e68=ejs['render'](_0x178bce,{'networks':_0x1aae28||[]});fs[_0xc0ec('0x47')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xe23634['body'][_0xc0ec('0x27')]['toLowerCase']()),_0x838e68);return respondWithRpcPromise(_0xc0ec('0x4f'),'create',{'module':_0xc0ec('0x52')});}})[_0xc0ec('0xa')](function(){return _0xf0e2cd;})[_0xc0ec('0xa')](respondWithResult(_0x2eca0c,0xc9))[_0xc0ec('0x13')](handleError(_0x2eca0c,null));};exports[_0xc0ec('0x1c')]=function(_0x1e52f7,_0x471711){var _0x57d6c0;return db['Network'][_0xc0ec('0x3e')]({'where':{'id':_0x1e52f7['params']['id']}})[_0xc0ec('0xa')](handleEntityNotFound(_0x471711,null))[_0xc0ec('0xa')](saveUpdates(_0x1e52f7[_0xc0ec('0x40')],null))['then'](function(_0x563f1a){if(_0x563f1a){_0x57d6c0=_0x563f1a;return db[_0xc0ec('0x24')]['findAll']({'where':{'type':_0x57d6c0[_0xc0ec('0x27')]},'raw':!![]});}return null;})[_0xc0ec('0xa')](function(_0x5b8e1f){if(_0x57d6c0[_0xc0ec('0x27')][_0xc0ec('0x4a')]()=='STUN'){var _0x1f69b0=fs['readFileSync'](path['join'](config[_0xc0ec('0x50')],'server/files/templates/stun_multiple.ejs'),_0xc0ec('0x45'));var _0x42397b=ejs[_0xc0ec('0x46')](_0x1f69b0,{'networks':_0x5b8e1f||[]});fs[_0xc0ec('0x47')]('/etc/asterisk/stun_xcally.conf',_0x42397b);return respondWithRpcPromise(_0xc0ec('0x4f'),'update',{'module':_0xc0ec('0x49')});}else if(_0x57d6c0['type']['toUpperCase']()==_0xc0ec('0x4b')){var _0x3d7eaa=fs[_0xc0ec('0x4c')](path[_0xc0ec('0x43')](config[_0xc0ec('0x50')],_0xc0ec('0x4d')),_0xc0ec('0x45'));var _0x24337a=ejs['render'](_0x3d7eaa,{'networks':_0x5b8e1f||[]});fs[_0xc0ec('0x47')](_0xc0ec('0x4e'),_0x24337a);return respondWithRpcPromise(_0xc0ec('0x4f'),_0xc0ec('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x40f3b4=fs['readFileSync'](path[_0xc0ec('0x43')](config[_0xc0ec('0x50')],_0xc0ec('0x51')),_0xc0ec('0x45'));var _0x58061c=ejs[_0xc0ec('0x46')](_0x40f3b4,{'networks':_0x5b8e1f||[]});fs[_0xc0ec('0x47')](util[_0xc0ec('0x53')](_0xc0ec('0x54'),_0x1e52f7['body'][_0xc0ec('0x27')][_0xc0ec('0x55')]()),_0x58061c);return respondWithRpcPromise('Reload',_0xc0ec('0x1c'),{'module':_0xc0ec('0x52')});}})[_0xc0ec('0xa')](function(_0x14f295){if(_0x14f295){return _0x57d6c0;}return null;})[_0xc0ec('0xa')](respondWithResult(_0x471711,null))[_0xc0ec('0x13')](handleError(_0x471711,null));};exports[_0xc0ec('0x1d')]=function(_0x1f8cd9,_0x2ead6c){var _0x9911f0;return db[_0xc0ec('0x24')][_0xc0ec('0x3e')]({'where':{'id':_0x1f8cd9['params']['id']}})[_0xc0ec('0xa')](function(_0x665eae){_0x9911f0=_0x665eae;return _0x665eae;})[_0xc0ec('0xa')](handleEntityNotFound(_0x2ead6c,null))[_0xc0ec('0xa')](removeEntity(_0x2ead6c,null))[_0xc0ec('0xa')](function(){if(_0x9911f0){return db[_0xc0ec('0x24')][_0xc0ec('0x41')]({'where':{'type':_0x9911f0[_0xc0ec('0x27')]},'raw':!![]});}})['then'](function(_0x3e6dce){if(_0x9911f0[_0xc0ec('0x27')]['toUpperCase']()==_0xc0ec('0x42')){var _0x3fa0de=fs[_0xc0ec('0x4c')](path[_0xc0ec('0x43')](config[_0xc0ec('0x50')],_0xc0ec('0x44')),_0xc0ec('0x45'));var _0x23e599=ejs[_0xc0ec('0x46')](_0x3fa0de,{'networks':_0x3e6dce||[]});fs[_0xc0ec('0x47')](_0xc0ec('0x48'),_0x23e599);return respondWithRpcPromise(_0xc0ec('0x4f'),_0xc0ec('0x1d'),{'module':_0xc0ec('0x49')});}else if(_0x9911f0[_0xc0ec('0x27')][_0xc0ec('0x4a')]()==_0xc0ec('0x4b')){var _0x43c681=fs[_0xc0ec('0x4c')](path['join'](config[_0xc0ec('0x50')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1a3190=ejs[_0xc0ec('0x46')](_0x43c681,{'networks':_0x3e6dce||[]});fs['writeFileSync'](_0xc0ec('0x4e'),_0x1a3190);return respondWithRpcPromise(_0xc0ec('0x4f'),_0xc0ec('0x1d'),{'module':_0xc0ec('0x49')});}else{var _0x1308d4=fs['readFileSync'](path[_0xc0ec('0x43')](config[_0xc0ec('0x50')],_0xc0ec('0x51')),_0xc0ec('0x45'));var _0x17a3aa=ejs[_0xc0ec('0x46')](_0x1308d4,{'networks':_0x3e6dce||[]});fs[_0xc0ec('0x47')](util[_0xc0ec('0x53')](_0xc0ec('0x54'),_0x9911f0['type'][_0xc0ec('0x55')]()),_0x17a3aa);return respondWithRpcPromise(_0xc0ec('0x4f'),_0xc0ec('0x1d'),{'module':_0xc0ec('0x52')});}})[_0xc0ec('0x13')](handleError(_0x2ead6c,null));}; \ No newline at end of file +var _0x00eb=['res_stun_monitor.so','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','format','toLowerCase','chan_sip.so','update','TURN','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','destroy','end','stack','name','send','index','Network','fieldName','type','map','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload'];(function(_0x41c93a,_0x4b79c5){var _0xac3834=function(_0x1a2c36){while(--_0x1a2c36){_0x41c93a['push'](_0x41c93a['shift']());}};_0xac3834(++_0x4b79c5);}(_0x00eb,0x1ab));var _0xb00e=function(_0x283b18,_0x44295f){_0x283b18=_0x283b18-0x0;var _0x327826=_0x00eb[_0x283b18];return _0x327826;};'use strict';var util=require(_0xb00e('0x0'));var path=require(_0xb00e('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00e('0x2'));var qs=require(_0xb00e('0x3'));var logger=require(_0xb00e('0x4'))(_0xb00e('0x5'));var config=require(_0xb00e('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb00e('0x7'));var client=jayson['client'][_0xb00e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2040f2,_0x13bcc8,_0x192ade,_0x1f2342){return new Promise(function(_0xb2a13b,_0x452d19){var _0x542673=_0x1f2342||client;return _0x542673[_0xb00e('0x9')](_0x2040f2,_0x192ade)[_0xb00e('0xa')](function(_0x3a34ee){logger['info'](_0xb00e('0xb'),_0x13bcc8,_0xb00e('0xc'));logger[_0xb00e('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x13bcc8,_0xb00e('0xc'),JSON[_0xb00e('0xe')](_0x3a34ee));if(_0x3a34ee[_0xb00e('0xf')]){if(_0x3a34ee['error'][_0xb00e('0x10')]===0x1f4){logger[_0xb00e('0xf')](_0xb00e('0xb'),_0x13bcc8,_0x3a34ee[_0xb00e('0xf')][_0xb00e('0x11')]);return _0x452d19(_0x3a34ee[_0xb00e('0xf')][_0xb00e('0x11')]);}logger[_0xb00e('0xf')](_0xb00e('0xb'),_0x13bcc8,_0x3a34ee['error'][_0xb00e('0x11')]);return _0xb2a13b(_0x3a34ee[_0xb00e('0xf')][_0xb00e('0x11')]);}else{logger['info'](_0xb00e('0xb'),_0x13bcc8,'request\x20sent');_0xb2a13b(_0x3a34ee[_0xb00e('0x12')][_0xb00e('0x11')]);}})[_0xb00e('0x13')](function(_0x4af4ab){logger[_0xb00e('0xf')]('Network,\x20%s,\x20%s',_0x13bcc8,_0x4af4ab);_0x452d19(_0x4af4ab);});});}function respondWithResult(_0x591c25,_0x4ca4f2){_0x4ca4f2=_0x4ca4f2||0xc8;return function(_0x55b1b7){if(_0x55b1b7){return _0x591c25[_0xb00e('0x14')](_0x4ca4f2)['json'](_0x55b1b7);}};}function respondWithFilteredResult(_0x3fe83f,_0x1104b6){return function(_0x4a9443){if(_0x4a9443){var _0x17c4cf=typeof _0x1104b6[_0xb00e('0x15')]==='undefined'&&typeof _0x1104b6['limit']===_0xb00e('0x16');var _0x275f29=_0x4a9443[_0xb00e('0x17')];var _0x3926b4=_0x17c4cf?0x0:_0x1104b6['offset'];var _0x300d43=_0x17c4cf?_0x4a9443[_0xb00e('0x17')]:_0x1104b6[_0xb00e('0x15')]+_0x1104b6[_0xb00e('0x18')];var _0x2c4ccb;if(_0x300d43>=_0x275f29){_0x300d43=_0x275f29;_0x2c4ccb=0xc8;}else{_0x2c4ccb=0xce;}_0x3fe83f['status'](_0x2c4ccb);return _0x3fe83f['set'](_0xb00e('0x19'),_0x3926b4+'-'+_0x300d43+'/'+_0x275f29)[_0xb00e('0x1a')](_0x4a9443);}return null;};}function saveUpdates(_0x5631bc){return function(_0x348c41){if(_0x348c41){return _0x348c41['update'](_0x5631bc)['then'](function(_0x55217f){return _0x55217f;});}return null;};}function removeEntity(_0x432d3e){return function(_0x3e5dff){if(_0x3e5dff){return _0x3e5dff[_0xb00e('0x1b')]()[_0xb00e('0xa')](function(){_0x432d3e[_0xb00e('0x14')](0xcc)[_0xb00e('0x1c')]();});}};}function handleEntityNotFound(_0x8a2b){return function(_0x474704){if(!_0x474704){_0x8a2b['sendStatus'](0x194);}return _0x474704;};}function handleError(_0xadc47f,_0x200542){_0x200542=_0x200542||0x1f4;return function(_0x2d680a){logger['error'](_0x2d680a[_0xb00e('0x1d')]);if(_0x2d680a['name']){delete _0x2d680a[_0xb00e('0x1e')];}_0xadc47f[_0xb00e('0x14')](_0x200542)[_0xb00e('0x1f')](_0x2d680a);};}exports[_0xb00e('0x20')]=function(_0x3d174c,_0x52eba9){var _0x30c43e={},_0xa656e={},_0x342d5a={'count':0x0,'rows':[]};var _0x19d921=_['map'](db[_0xb00e('0x21')]['rawAttributes'],function(_0x1fb767){return{'name':_0x1fb767[_0xb00e('0x22')],'type':_0x1fb767[_0xb00e('0x23')]['key']};});_0xa656e['model']=_[_0xb00e('0x24')](_0x19d921,'name');_0xa656e[_0xb00e('0x25')]=_['keys'](_0x3d174c[_0xb00e('0x25')]);_0xa656e[_0xb00e('0x26')]=_[_0xb00e('0x27')](_0xa656e[_0xb00e('0x28')],_0xa656e[_0xb00e('0x25')]);_0x30c43e['attributes']=_[_0xb00e('0x27')](_0xa656e['model'],qs['fields'](_0x3d174c[_0xb00e('0x25')][_0xb00e('0x29')]));_0x30c43e['attributes']=_0x30c43e['attributes'][_0xb00e('0x2a')]?_0x30c43e[_0xb00e('0x2b')]:_0xa656e[_0xb00e('0x28')];if(!_0x3d174c[_0xb00e('0x25')][_0xb00e('0x2c')](_0xb00e('0x2d'))){_0x30c43e[_0xb00e('0x18')]=qs[_0xb00e('0x18')](_0x3d174c['query'][_0xb00e('0x18')]);_0x30c43e[_0xb00e('0x15')]=qs[_0xb00e('0x15')](_0x3d174c[_0xb00e('0x25')][_0xb00e('0x15')]);}_0x30c43e[_0xb00e('0x2e')]=qs['sort'](_0x3d174c[_0xb00e('0x25')]['sort']);_0x30c43e[_0xb00e('0x2f')]=qs[_0xb00e('0x26')](_[_0xb00e('0x30')](_0x3d174c[_0xb00e('0x25')],_0xa656e['filters']),_0x19d921);if(_0x3d174c['query'][_0xb00e('0x31')]){_0x30c43e[_0xb00e('0x2f')]=_[_0xb00e('0x32')](_0x30c43e[_0xb00e('0x2f')],{'$or':_[_0xb00e('0x24')](_0x19d921,function(_0x2f2104){if(_0x2f2104[_0xb00e('0x23')]!==_0xb00e('0x33')){var _0x45d642={};_0x45d642[_0x2f2104['name']]={'$like':'%'+_0x3d174c[_0xb00e('0x25')][_0xb00e('0x31')]+'%'};return _0x45d642;}})});}_0x30c43e=_[_0xb00e('0x32')]({},_0x30c43e,_0x3d174c['options']);var _0x415efb={'where':_0x30c43e[_0xb00e('0x2f')]};return db['Network'][_0xb00e('0x17')](_0x415efb)[_0xb00e('0xa')](function(_0xae452a){_0x342d5a['count']=_0xae452a;if(_0x3d174c['query'][_0xb00e('0x34')]){_0x30c43e[_0xb00e('0x35')]=[{'all':!![]}];}return db[_0xb00e('0x21')][_0xb00e('0x36')](_0x30c43e);})['then'](function(_0x25f826){_0x342d5a[_0xb00e('0x37')]=_0x25f826;return _0x342d5a;})[_0xb00e('0xa')](respondWithFilteredResult(_0x52eba9,_0x30c43e))[_0xb00e('0x13')](handleError(_0x52eba9,null));};exports['show']=function(_0x17df83,_0x74616a){var _0x28d4c6={'raw':!![],'where':{'id':_0x17df83[_0xb00e('0x38')]['id']}},_0xa226a7={};_0xa226a7[_0xb00e('0x28')]=_[_0xb00e('0x39')](db[_0xb00e('0x21')]['rawAttributes']);_0xa226a7[_0xb00e('0x25')]=_[_0xb00e('0x39')](_0x17df83['query']);_0xa226a7[_0xb00e('0x26')]=_['intersection'](_0xa226a7['model'],_0xa226a7['query']);_0x28d4c6[_0xb00e('0x2b')]=_['intersection'](_0xa226a7[_0xb00e('0x28')],qs[_0xb00e('0x29')](_0x17df83[_0xb00e('0x25')][_0xb00e('0x29')]));_0x28d4c6[_0xb00e('0x2b')]=_0x28d4c6[_0xb00e('0x2b')][_0xb00e('0x2a')]?_0x28d4c6[_0xb00e('0x2b')]:_0xa226a7[_0xb00e('0x28')];if(_0x17df83[_0xb00e('0x25')][_0xb00e('0x34')]){_0x28d4c6[_0xb00e('0x35')]=[{'all':!![]}];}_0x28d4c6=_[_0xb00e('0x32')]({},_0x28d4c6,_0x17df83[_0xb00e('0x3a')]);return db[_0xb00e('0x21')][_0xb00e('0x3b')](_0x28d4c6)[_0xb00e('0xa')](handleEntityNotFound(_0x74616a,null))['then'](respondWithResult(_0x74616a,null))[_0xb00e('0x13')](handleError(_0x74616a,null));};exports[_0xb00e('0x3c')]=function(_0xfb50da,_0x60a3cc){var _0x5e863d;return db[_0xb00e('0x21')]['create'](_0xfb50da[_0xb00e('0x3d')],{'raw':!![]})[_0xb00e('0xa')](function(_0x63f1c8){_0x5e863d=_0x63f1c8;return db['Network']['findAll']({'where':{'type':_0xfb50da[_0xb00e('0x3d')][_0xb00e('0x23')]},'raw':!![]});})[_0xb00e('0xa')](function(_0x32a2f1){if(_0x5e863d[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x3f')){var _0x3aabcb=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x43')),'utf8');var _0x2b8e43=ejs[_0xb00e('0x44')](_0x3aabcb,{'networks':_0x32a2f1||[]});fs['writeFileSync'](_0xb00e('0x45'),_0x2b8e43);return respondWithRpcPromise(_0xb00e('0x46'),'create',{'module':_0xb00e('0x47')});}else if(_0x5e863d['type'][_0xb00e('0x3e')]()=='TURN'){var _0x449174=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x48')),_0xb00e('0x49'));var _0x99b5f6=ejs['render'](_0x449174,{'networks':_0x32a2f1||[]});fs['writeFileSync'](_0xb00e('0x4a'),_0x99b5f6);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x27fb1d=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],'server/files/templates/network.ejs'),_0xb00e('0x49'));var _0x2b1b77=ejs[_0xb00e('0x44')](_0x27fb1d,{'networks':_0x32a2f1||[]});fs['writeFileSync'](util[_0xb00e('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0xfb50da[_0xb00e('0x3d')][_0xb00e('0x23')][_0xb00e('0x4c')]()),_0x2b1b77);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x3c'),{'module':_0xb00e('0x4d')});}})[_0xb00e('0xa')](function(){return _0x5e863d;})[_0xb00e('0xa')](respondWithResult(_0x60a3cc,0xc9))[_0xb00e('0x13')](handleError(_0x60a3cc,null));};exports[_0xb00e('0x4e')]=function(_0x347bbd,_0x5cdd86){var _0x3bcf7e;return db[_0xb00e('0x21')]['find']({'where':{'id':_0x347bbd[_0xb00e('0x38')]['id']}})[_0xb00e('0xa')](handleEntityNotFound(_0x5cdd86,null))[_0xb00e('0xa')](saveUpdates(_0x347bbd[_0xb00e('0x3d')],null))[_0xb00e('0xa')](function(_0x4e6a37){if(_0x4e6a37){_0x3bcf7e=_0x4e6a37;return db[_0xb00e('0x21')][_0xb00e('0x36')]({'where':{'type':_0x3bcf7e[_0xb00e('0x23')]},'raw':!![]});}return null;})[_0xb00e('0xa')](function(_0x1c6366){if(_0x3bcf7e[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x3f')){var _0x186318=fs['readFileSync'](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x43')),'utf8');var _0x369182=ejs[_0xb00e('0x44')](_0x186318,{'networks':_0x1c6366||[]});fs['writeFileSync'](_0xb00e('0x45'),_0x369182);return respondWithRpcPromise('Reload',_0xb00e('0x4e'),{'module':_0xb00e('0x47')});}else if(_0x3bcf7e['type'][_0xb00e('0x3e')]()==_0xb00e('0x4f')){var _0x11db93=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x48')),_0xb00e('0x49'));var _0x327941=ejs[_0xb00e('0x44')](_0x11db93,{'networks':_0x1c6366||[]});fs[_0xb00e('0x50')](_0xb00e('0x4a'),_0x327941);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x4e'),{'module':'res_stun_monitor.so'});}else{var _0x3ede58=fs['readFileSync'](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x51')),'utf8');var _0x4ce55b=ejs[_0xb00e('0x44')](_0x3ede58,{'networks':_0x1c6366||[]});fs[_0xb00e('0x50')](util['format'](_0xb00e('0x52'),_0x347bbd[_0xb00e('0x3d')]['type']['toLowerCase']()),_0x4ce55b);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x4e'),{'module':_0xb00e('0x4d')});}})[_0xb00e('0xa')](function(_0x1a1d30){if(_0x1a1d30){return _0x3bcf7e;}return null;})[_0xb00e('0xa')](respondWithResult(_0x5cdd86,null))[_0xb00e('0x13')](handleError(_0x5cdd86,null));};exports[_0xb00e('0x1b')]=function(_0x143881,_0x142770){var _0x1ddd96;return db[_0xb00e('0x21')]['find']({'where':{'id':_0x143881[_0xb00e('0x38')]['id']}})[_0xb00e('0xa')](function(_0x1ad692){_0x1ddd96=_0x1ad692;return _0x1ad692;})[_0xb00e('0xa')](handleEntityNotFound(_0x142770,null))[_0xb00e('0xa')](removeEntity(_0x142770,null))[_0xb00e('0xa')](function(){if(_0x1ddd96){return db[_0xb00e('0x21')]['findAll']({'where':{'type':_0x1ddd96[_0xb00e('0x23')]},'raw':!![]});}})[_0xb00e('0xa')](function(_0x34e326){if(_0x1ddd96[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x3f')){var _0x264a05=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],_0xb00e('0x43')),_0xb00e('0x49'));var _0x18203e=ejs['render'](_0x264a05,{'networks':_0x34e326||[]});fs[_0xb00e('0x50')](_0xb00e('0x45'),_0x18203e);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x1b'),{'module':_0xb00e('0x47')});}else if(_0x1ddd96[_0xb00e('0x23')][_0xb00e('0x3e')]()==_0xb00e('0x4f')){var _0x2b9664=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config[_0xb00e('0x42')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0xf903fe=ejs['render'](_0x2b9664,{'networks':_0x34e326||[]});fs[_0xb00e('0x50')](_0xb00e('0x4a'),_0xf903fe);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x1b'),{'module':_0xb00e('0x47')});}else{var _0x26d858=fs[_0xb00e('0x40')](path[_0xb00e('0x41')](config['root'],_0xb00e('0x51')),'utf8');var _0x128f3b=ejs[_0xb00e('0x44')](_0x26d858,{'networks':_0x34e326||[]});fs['writeFileSync'](util[_0xb00e('0x4b')](_0xb00e('0x52'),_0x1ddd96['type']['toLowerCase']()),_0x128f3b);return respondWithRpcPromise(_0xb00e('0x46'),_0xb00e('0x1b'),{'module':'chan_sip.so'});}})[_0xb00e('0x13')](handleError(_0x142770,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6894c7e..a40104a 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 _0x34e5=['request-promise','path','../../config/environment','./network.attributes','exports','define','Network','util','api','moment','bluebird'];(function(_0x2da06d,_0x1dda86){var _0x5a3247=function(_0x21c47f){while(--_0x21c47f){_0x2da06d['push'](_0x2da06d['shift']());}};_0x5a3247(++_0x1dda86);}(_0x34e5,0x172));var _0x534e=function(_0xca7f44,_0x5d2d09){_0xca7f44=_0xca7f44-0x0;var _0x1c256d=_0x34e5[_0xca7f44];return _0x1c256d;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2c=['path','rimraf','../../config/environment','exports','network','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8bb488,_0x4198ca){var _0x13c9e4=function(_0x4c6327){while(--_0x4c6327){_0x8bb488['push'](_0x8bb488['shift']());}};_0x13c9e4(++_0x4198ca);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x4853fd,_0x18238d){_0x4853fd=_0x4853fd-0x0;var _0x4711ac=_0x7a2c[_0x4853fd];return _0x4711ac;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./network.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Network',attributes,{'tableName':_0xc7a2('0xa'),'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 49853d7..17cc041 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x86be5f,_0x3a5cb5){_0x86be5f=_0x86be5f-0x0;var _0x278f49=_0x7a54[_0x86be5f];return _0x278f49;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x47fa92,_0x18327f){_0x47fa92=_0x47fa92-0x0;var _0x3e7fae=_0x7a54[_0x47fa92];return _0x3e7fae;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index bb331ab..387ddd5 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getAgents','post','create','addDisposition','addAnswer','notify','/:id/users','addAgents','/:id/send','send','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x455d81,_0x50a0d8){var _0x238104=function(_0x11b704){while(--_0x11b704){_0x455d81['push'](_0x455d81['shift']());}};_0x238104(++_0x50a0d8);}(_0x2032,0xd9));var _0x2203=function(_0x13b82d,_0x3c9292){_0x13b82d=_0x13b82d-0x0;var _0x1f44cd=_0x2032[_0x13b82d];return _0x1f44cd;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['get'](_0x2203('0x12'),auth[_0x2203('0x9')](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x2203('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x2203('0x13')]);router[_0x2203('0x14')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0x15')]);router[_0x2203('0x14')](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0x16')]);router[_0x2203('0x14')](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x17')]);router[_0x2203('0x14')]('/:id/notify',controller[_0x2203('0x18')]);router[_0x2203('0x14')]('/:id/applications',auth[_0x2203('0x9')](),controller['addApplications']);router[_0x2203('0x14')](_0x2203('0x19'),auth[_0x2203('0x9')](),controller[_0x2203('0x1a')]);router[_0x2203('0x14')](_0x2203('0x1b'),auth['isAuthenticated'](),controller[_0x2203('0x1c')]);router['put']('/:id',auth[_0x2203('0x9')](),controller['update']);router[_0x2203('0x1d')](_0x2203('0x1e'),auth['isAuthenticated'](),controller[_0x2203('0x1f')]);router['delete']('/:id/dispositions',auth[_0x2203('0x9')](),controller[_0x2203('0x20')]);router[_0x2203('0x1d')](_0x2203('0x10'),auth[_0x2203('0x9')](),controller[_0x2203('0x21')]);router[_0x2203('0x1d')](_0x2203('0x19'),auth['isAuthenticated'](),controller[_0x2203('0x22')]);module[_0x2203('0x23')]=router; \ No newline at end of file +var _0x6343=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x41b214,_0x1edcaa){var _0x56b447=function(_0x1616e1){while(--_0x1616e1){_0x41b214['push'](_0x41b214['shift']());}};_0x56b447(++_0x1edcaa);}(_0x6343,0x168));var _0x3634=function(_0x2900cb,_0x3c99d4){_0x2900cb=_0x2900cb-0x0;var _0x3f3a87=_0x6343[_0x2900cb];return _0x3f3a87;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var controller=require('./openchannelAccount.controller');router[_0x3634('0x4')]('/',auth[_0x3634('0x5')](),controller['index']);router[_0x3634('0x4')](_0x3634('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3634('0x4')](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x8')]);router[_0x3634('0x4')](_0x3634('0x9'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3634('0x4')](_0x3634('0xa'),auth['isAuthenticated'](),controller[_0x3634('0xb')]);router[_0x3634('0x4')](_0x3634('0xc'),auth[_0x3634('0x5')](),controller[_0x3634('0xd')]);router[_0x3634('0x4')](_0x3634('0xe'),auth[_0x3634('0x5')](),controller[_0x3634('0xf')]);router[_0x3634('0x4')](_0x3634('0x10'),auth[_0x3634('0x5')](),controller[_0x3634('0x11')]);router[_0x3634('0x12')]('/',auth['isAuthenticated'](),controller[_0x3634('0x13')]);router['post'](_0x3634('0x9'),auth[_0x3634('0x5')](),controller[_0x3634('0x14')]);router[_0x3634('0x12')](_0x3634('0xa'),auth['isAuthenticated'](),controller[_0x3634('0x15')]);router['post']('/:id/notify',controller[_0x3634('0x16')]);router['post'](_0x3634('0xc'),auth[_0x3634('0x5')](),controller[_0x3634('0x17')]);router['post'](_0x3634('0x10'),auth[_0x3634('0x5')](),controller['addAgents']);router[_0x3634('0x12')]('/:id/send',auth[_0x3634('0x5')](),controller[_0x3634('0x18')]);router['put'](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x19')]);router['delete'](_0x3634('0x7'),auth[_0x3634('0x5')](),controller['destroy']);router[_0x3634('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3634('0x1b')]);router[_0x3634('0x1a')]('/:id/canned_answers',auth[_0x3634('0x5')](),controller[_0x3634('0x1c')]);router[_0x3634('0x1a')](_0x3634('0x10'),auth[_0x3634('0x5')](),controller[_0x3634('0x1d')]);module[_0x3634('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 53380ce..1a2c2d5 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 _0x430b=['exports','name','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x430b,0x1d2));var _0xb430=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x430b[_0x4404ff];return _0x5e7b19;};'use strict';var Sequelize=require(_0xb430('0x0'));var rs=require(_0xb430('0x1'));module[_0xb430('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xb430('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb430('0x4')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb430('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb430('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb430('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb430('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb430('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb430('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb430('0x4')]},'queueTransfer':{'type':Sequelize[_0xb430('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb430('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb430('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb430('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb430('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb430('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb430('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x28be0d){if(!_0x28be0d)this[_0xb430('0x9')](_0xb430('0xa'),null);this['setDataValue'](_0xb430('0xb'),_0x28be0d);}}}; \ No newline at end of file +var _0x8e9a=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e9a,0x7b));var _0xa8e9=function(_0x171846,_0x134d2c){_0x171846=_0x171846-0x0;var _0x1a0010=_0x8e9a[_0x171846];return _0x1a0010;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xa8e9('0x0')]={'name':{'type':Sequelize[_0xa8e9('0x1')],'unique':_0xa8e9('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa8e9('0x1')]},'token':{'type':Sequelize[_0xa8e9('0x1')],'defaultValue':function(){return rs[_0xa8e9('0x3')]();}},'replyUri':{'type':Sequelize[_0xa8e9('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa8e9('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa8e9('0x4')],'defaultValue':function(){return _0xa8e9('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa8e9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa8e9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa8e9('0x1')]},'queueTransfer':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa8e9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa8e9('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa8e9('0x6')],'defaultValue':![],'comment':_0xa8e9('0x9'),'set':function(_0x55bb18){if(!_0x55bb18)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xa8e9('0xa'),_0x55bb18);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6b8cafd..52d1baf 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 _0x3e1d=['options','count','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','rawAttributes','body','user','role','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','create','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','OpenchannelApplication','Applications','list','applications','orderBy','priority','asc','account','Contacts','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','findAndCountAll','finally','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','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','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','reject','update','get','OpenchannelAccounts','destroy','stack','name','send','index','Pause','map','OpenchannelAccount','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x224153,_0x1a1ebf){var _0x30514d=function(_0x3e2cdf){while(--_0x3e2cdf){_0x224153['push'](_0x224153['shift']());}};_0x30514d(++_0x1a1ebf);}(_0x3e1d,0x70));var _0xd3e1=function(_0x3d14d1,_0x23aa69){_0x3d14d1=_0x3d14d1-0x0;var _0xc78d1f=_0x3e1d[_0x3d14d1];return _0xc78d1f;};'use strict';var emlformat=require(_0xd3e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3e1('0x1'));var jsonpatch=require(_0xd3e1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3e1('0x3'));var util=require(_0xd3e1('0x4'));var path=require(_0xd3e1('0x5'));var sox=require(_0xd3e1('0x6'));var csv=require(_0xd3e1('0x7'));var ejs=require(_0xd3e1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3e1('0x9'));var squel=require(_0xd3e1('0xa'));var crypto=require(_0xd3e1('0xb'));var jsforce=require(_0xd3e1('0xc'));var deskjs=require(_0xd3e1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd3e1('0xe'));var authService=require(_0xd3e1('0xf'));var qs=require(_0xd3e1('0x10'));var as=require(_0xd3e1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3e1('0x12'))(_0xd3e1('0x13'));var utils=require('../../config/utils');var config=require(_0xd3e1('0x14'));var licenseUtil=require(_0xd3e1('0x15'));var db=require(_0xd3e1('0x16'))['db'];config[_0xd3e1('0x17')]=_[_0xd3e1('0x18')](config[_0xd3e1('0x17')],{'host':_0xd3e1('0x19'),'port':0x18eb});var socket=require(_0xd3e1('0x1a'))(new Redis(config[_0xd3e1('0x17')]));require(_0xd3e1('0x1b'))[_0xd3e1('0x1c')](socket);var jayson=require(_0xd3e1('0x1d'));var client=jayson['client'][_0xd3e1('0x1e')]({'port':0x232c});var client9002=jayson[_0xd3e1('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373656,_0x47fded,_0x40749c,_0x4094fa){return new BPromise(function(_0x1c2c53,_0x10d64e){var _0x570527=_0x4094fa||client;return _0x570527[_0xd3e1('0x20')](_0x373656,_0x40749c)[_0xd3e1('0x21')](function(_0x2a58bd){logger[_0xd3e1('0x22')](_0xd3e1('0x23'),_0x47fded,_0xd3e1('0x24'));logger[_0xd3e1('0x25')](_0xd3e1('0x26'),_0x47fded,'request\x20sent',JSON['stringify'](_0x2a58bd));if(_0x2a58bd[_0xd3e1('0x27')]){if(_0x2a58bd[_0xd3e1('0x27')][_0xd3e1('0x28')]===0x1f4){logger[_0xd3e1('0x27')](_0xd3e1('0x23'),_0x47fded,_0x2a58bd[_0xd3e1('0x27')][_0xd3e1('0x29')]);return _0x10d64e(_0x2a58bd[_0xd3e1('0x27')][_0xd3e1('0x29')]);}logger[_0xd3e1('0x27')](_0xd3e1('0x23'),_0x47fded,_0x2a58bd[_0xd3e1('0x27')][_0xd3e1('0x29')]);return _0x1c2c53(_0x2a58bd['error'][_0xd3e1('0x29')]);}else{logger[_0xd3e1('0x22')](_0xd3e1('0x23'),_0x47fded,_0xd3e1('0x24'));_0x1c2c53(_0x2a58bd[_0xd3e1('0x2a')][_0xd3e1('0x29')]);}})[_0xd3e1('0x2b')](function(_0x514aea){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x47fded,_0x514aea);_0x10d64e(_0x514aea);});});}function respondWithStatusCode(_0x449cb5,_0x2ce1be){_0x2ce1be=_0x2ce1be||0xcc;return function(_0x50747a){if(_0x50747a){return _0x449cb5[_0xd3e1('0x2c')](_0x2ce1be);}return _0x449cb5[_0xd3e1('0x2d')](_0x2ce1be)[_0xd3e1('0x2e')]();};}function respondWithResult(_0xe06e4e,_0x2e2830){_0x2e2830=_0x2e2830||0xc8;return function(_0x3a00f2){if(_0x3a00f2){return _0xe06e4e[_0xd3e1('0x2d')](_0x2e2830)[_0xd3e1('0x2f')](_0x3a00f2);}};}function respondWithFilteredResult(_0x2285f2,_0x9f510a){return function(_0x56371f){if(_0x56371f){var _0x467968=typeof _0x9f510a[_0xd3e1('0x30')]==='undefined'&&typeof _0x9f510a[_0xd3e1('0x31')]===_0xd3e1('0x32');var _0x3439fa=_0x56371f['count'];var _0x36b266=_0x467968?0x0:_0x9f510a[_0xd3e1('0x30')];var _0x4e6d63=_0x467968?_0x56371f['count']:_0x9f510a[_0xd3e1('0x30')]+_0x9f510a[_0xd3e1('0x31')];var _0x45fdd0;if(_0x4e6d63>=_0x3439fa){_0x4e6d63=_0x3439fa;_0x45fdd0=0xc8;}else{_0x45fdd0=0xce;}_0x2285f2[_0xd3e1('0x2d')](_0x45fdd0);return _0x2285f2[_0xd3e1('0x33')](_0xd3e1('0x34'),_0x36b266+'-'+_0x4e6d63+'/'+_0x3439fa)[_0xd3e1('0x2f')](_0x56371f);}return null;};}function patchUpdates(_0x1ad737){return function(_0x3051b9){try{jsonpatch['apply'](_0x3051b9,_0x1ad737,!![]);}catch(_0x1c3df8){return BPromise[_0xd3e1('0x35')](_0x1c3df8);}return _0x3051b9['save']();};}function saveUpdates(_0x547931,_0x4c6411){return function(_0xe01c24){if(_0xe01c24){return _0xe01c24[_0xd3e1('0x36')](_0x547931)['then'](function(_0x4e68c4){return _0x4e68c4;});}return null;};}function removeEntity(_0x3930e0,_0x3ac011){return function(_0x3fa1ec){if(_0x3fa1ec){return _0x3fa1ec['destroy']()[_0xd3e1('0x21')](function(){var _0x2aab18=_0x3fa1ec[_0xd3e1('0x37')]({'plain':!![]});var _0x1f937a=_0xd3e1('0x38');return db['UserProfileResource'][_0xd3e1('0x39')]({'where':{'type':_0x1f937a,'resourceId':_0x2aab18['id']}})[_0xd3e1('0x21')](function(){return _0x3fa1ec;});})['then'](function(){_0x3930e0[_0xd3e1('0x2d')](0xcc)[_0xd3e1('0x2e')]();});}};}function handleEntityNotFound(_0x51ae9b,_0x5408fe){return function(_0x564390){if(!_0x564390){_0x51ae9b[_0xd3e1('0x2c')](0x194);}return _0x564390;};}function handleError(_0x19347f,_0x28cecf){_0x28cecf=_0x28cecf||0x1f4;return function(_0x589af3){logger[_0xd3e1('0x27')](_0x589af3[_0xd3e1('0x3a')]);if(_0x589af3[_0xd3e1('0x3b')]){delete _0x589af3['name'];}_0x19347f['status'](_0x28cecf)[_0xd3e1('0x3c')](_0x589af3);};}exports[_0xd3e1('0x3d')]=function(_0x174980,_0x1ba9d7){var _0x29d351={'include':[{'model':db[_0xd3e1('0x3e')],'as':'mandatoryDispositionPause'}]},_0x283632={},_0x3dbd38={'count':0x0,'rows':[]};var _0x4852ef=_[_0xd3e1('0x3f')](db[_0xd3e1('0x40')]['rawAttributes'],function(_0x2fd9a9){return{'name':_0x2fd9a9[_0xd3e1('0x41')],'type':_0x2fd9a9[_0xd3e1('0x42')]['key']};});_0x283632[_0xd3e1('0x43')]=_[_0xd3e1('0x3f')](_0x4852ef,'name');_0x283632[_0xd3e1('0x44')]=_['keys'](_0x174980['query']);_0x283632[_0xd3e1('0x45')]=_['intersection'](_0x283632[_0xd3e1('0x43')],_0x283632[_0xd3e1('0x44')]);_0x29d351[_0xd3e1('0x46')]=_[_0xd3e1('0x47')](_0x283632[_0xd3e1('0x43')],qs['fields'](_0x174980[_0xd3e1('0x44')][_0xd3e1('0x48')]));_0x29d351['attributes']=_0x29d351[_0xd3e1('0x46')][_0xd3e1('0x49')]?_0x29d351['attributes']:_0x283632[_0xd3e1('0x43')];if(!_0x174980[_0xd3e1('0x44')]['hasOwnProperty'](_0xd3e1('0x4a'))){_0x29d351[_0xd3e1('0x31')]=qs['limit'](_0x174980[_0xd3e1('0x44')][_0xd3e1('0x31')]);_0x29d351[_0xd3e1('0x30')]=qs[_0xd3e1('0x30')](_0x174980[_0xd3e1('0x44')]['offset']);}_0x29d351[_0xd3e1('0x4b')]=qs[_0xd3e1('0x4c')](_0x174980[_0xd3e1('0x44')][_0xd3e1('0x4c')]);_0x29d351[_0xd3e1('0x4d')]=qs[_0xd3e1('0x45')](_[_0xd3e1('0x4e')](_0x174980[_0xd3e1('0x44')],_0x283632[_0xd3e1('0x45')]),_0x4852ef);if(_0x174980[_0xd3e1('0x44')]['filter']){_0x29d351['where']=_[_0xd3e1('0x4f')](_0x29d351[_0xd3e1('0x4d')],{'$or':_[_0xd3e1('0x3f')](_0x4852ef,function(_0x112958){if(_0x112958[_0xd3e1('0x42')]!==_0xd3e1('0x50')){var _0x4dccae={};_0x4dccae[_0x112958['name']]={'$like':'%'+_0x174980[_0xd3e1('0x44')][_0xd3e1('0x51')]+'%'};return _0x4dccae;}})});}_0x29d351=_[_0xd3e1('0x4f')]({},_0x29d351,_0x174980[_0xd3e1('0x52')]);var _0x3ae04f={'where':_0x29d351[_0xd3e1('0x4d')]};return db['OpenchannelAccount'][_0xd3e1('0x53')](_0x3ae04f)[_0xd3e1('0x21')](function(_0x347593){_0x3dbd38[_0xd3e1('0x53')]=_0x347593;if(_0x174980[_0xd3e1('0x44')][_0xd3e1('0x54')]){_0x29d351[_0xd3e1('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xd3e1('0x56')](_0x29d351);})[_0xd3e1('0x21')](function(_0xcfa747){_0x3dbd38[_0xd3e1('0x57')]=_0xcfa747;return _0x3dbd38;})[_0xd3e1('0x21')](respondWithFilteredResult(_0x1ba9d7,_0x29d351))[_0xd3e1('0x2b')](handleError(_0x1ba9d7,null));};exports[_0xd3e1('0x58')]=function(_0x329820,_0x16ccd3){var _0x2462d0={'raw':![],'where':{'id':_0x329820[_0xd3e1('0x59')]['id']},'include':[{'model':db[_0xd3e1('0x3e')],'as':_0xd3e1('0x5a')}]},_0x90c837={};_0x90c837[_0xd3e1('0x43')]=_[_0xd3e1('0x5b')](db[_0xd3e1('0x40')][_0xd3e1('0x5c')]);_0x90c837[_0xd3e1('0x44')]=_[_0xd3e1('0x5b')](_0x329820[_0xd3e1('0x44')]);_0x90c837[_0xd3e1('0x45')]=_[_0xd3e1('0x47')](_0x90c837['model'],_0x90c837['query']);_0x2462d0[_0xd3e1('0x46')]=_[_0xd3e1('0x47')](_0x90c837[_0xd3e1('0x43')],qs['fields'](_0x329820[_0xd3e1('0x44')][_0xd3e1('0x48')]));_0x2462d0[_0xd3e1('0x46')]=_0x2462d0[_0xd3e1('0x46')][_0xd3e1('0x49')]?_0x2462d0[_0xd3e1('0x46')]:_0x90c837['model'];if(_0x329820[_0xd3e1('0x44')]['includeAll']){_0x2462d0[_0xd3e1('0x55')]=[{'all':!![]}];}_0x2462d0=_[_0xd3e1('0x4f')]({},_0x2462d0,_0x329820['options']);return db[_0xd3e1('0x40')]['find'](_0x2462d0)['then'](handleEntityNotFound(_0x16ccd3,null))[_0xd3e1('0x21')](respondWithResult(_0x16ccd3,null))['catch'](handleError(_0x16ccd3,null));};exports['create']=function(_0x1266e0,_0x22d183){return db[_0xd3e1('0x40')]['create'](_0x1266e0[_0xd3e1('0x5d')],{})['then'](function(_0x5755f9){var _0x3bee2a=_0x1266e0[_0xd3e1('0x5e')][_0xd3e1('0x37')]({'plain':!![]});if(!_0x3bee2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bee2a[_0xd3e1('0x5f')]===_0xd3e1('0x5e')){var _0x3e0d56=_0x5755f9['get']({'plain':!![]});var _0x513d4d=_0xd3e1('0x38');return db[_0xd3e1('0x60')][_0xd3e1('0x61')]({'where':{'name':_0x513d4d,'userProfileId':_0x3bee2a['userProfileId']},'raw':!![]})[_0xd3e1('0x21')](function(_0x467bec){if(_0x467bec&&_0x467bec['autoAssociation']===0x0){return db[_0xd3e1('0x62')]['create']({'name':_0x3e0d56['name'],'resourceId':_0x3e0d56['id'],'type':_0x467bec[_0xd3e1('0x3b')],'sectionId':_0x467bec['id']},{})['then'](function(){return _0x5755f9;});}else{return _0x5755f9;}})[_0xd3e1('0x2b')](function(_0x3271fa){logger['error'](_0xd3e1('0x63'),_0x3271fa);throw _0x3271fa;});}return _0x5755f9;})[_0xd3e1('0x21')](respondWithResult(_0x22d183,0xc9))[_0xd3e1('0x2b')](handleError(_0x22d183,null));};exports[_0xd3e1('0x36')]=function(_0x2497cc,_0x19e8f9){if(_0x2497cc[_0xd3e1('0x5d')]['id']){delete _0x2497cc[_0xd3e1('0x5d')]['id'];}return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0x2497cc['params']['id']},'include':[{'model':db[_0xd3e1('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xd3e1('0x21')](handleEntityNotFound(_0x19e8f9,null))[_0xd3e1('0x21')](saveUpdates(_0x2497cc['body'],null))[_0xd3e1('0x21')](respondWithResult(_0x19e8f9,null))['catch'](handleError(_0x19e8f9,null));};exports['destroy']=function(_0x266bdb,_0xe57349){return db['OpenchannelAccount'][_0xd3e1('0x61')]({'where':{'id':_0x266bdb[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0xe57349,null))[_0xd3e1('0x21')](removeEntity(_0xe57349,null))[_0xd3e1('0x2b')](handleError(_0xe57349,null));};exports[_0xd3e1('0x64')]=function(_0x47917b,_0x8e3528){return db['OpenchannelAccount']['describe']()[_0xd3e1('0x21')](respondWithResult(_0x8e3528,null))['catch'](handleError(_0x8e3528,null));};exports['addDisposition']=function(_0x5ecd1a,_0xa650c3,_0x51cbd3){if(_0x5ecd1a[_0xd3e1('0x5d')]['id']){delete _0x5ecd1a[_0xd3e1('0x5d')]['id'];}return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0x5ecd1a[_0xd3e1('0x59')]['id']}})['then'](handleEntityNotFound(_0xa650c3,null))[_0xd3e1('0x21')](function(_0x50254){if(_0x50254){_0x5ecd1a[_0xd3e1('0x5d')][_0xd3e1('0x65')]=_0x50254['id'];return db['Disposition'][_0xd3e1('0x66')](_0x5ecd1a[_0xd3e1('0x5d')]);}})[_0xd3e1('0x21')](respondWithResult(_0xa650c3,null))[_0xd3e1('0x2b')](handleError(_0xa650c3,null));};exports[_0xd3e1('0x67')]=function(_0x8bf5e9,_0x4bc227,_0x4395c2){var _0x13e5fe={'raw':![],'where':{}};var _0x199205={};var _0xe5b95a={'count':0x0,'rows':[]};return db[_0xd3e1('0x40')]['findOne']({'where':{'id':_0x8bf5e9['params']['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x4bc227,null))[_0xd3e1('0x21')](function(_0x66d9a0){if(_0x66d9a0){_0x199205[_0xd3e1('0x43')]=_[_0xd3e1('0x5b')](db[_0xd3e1('0x68')][_0xd3e1('0x5c')]);_0x199205[_0xd3e1('0x44')]=_['keys'](_0x8bf5e9['query']);_0x199205[_0xd3e1('0x45')]=_[_0xd3e1('0x47')](_0x199205[_0xd3e1('0x43')],_0x199205[_0xd3e1('0x44')]);_0x13e5fe[_0xd3e1('0x46')]=_[_0xd3e1('0x47')](_0x199205['model'],qs[_0xd3e1('0x48')](_0x8bf5e9[_0xd3e1('0x44')]['fields']));_0x13e5fe[_0xd3e1('0x46')]=_0x13e5fe[_0xd3e1('0x46')][_0xd3e1('0x49')]?_0x13e5fe[_0xd3e1('0x46')]:_0x199205['model'];if(!_0x8bf5e9[_0xd3e1('0x44')]['hasOwnProperty'](_0xd3e1('0x4a'))){_0x13e5fe[_0xd3e1('0x31')]=qs['limit'](_0x8bf5e9['query'][_0xd3e1('0x31')]);_0x13e5fe[_0xd3e1('0x30')]=qs['offset'](_0x8bf5e9[_0xd3e1('0x44')]['offset']);}_0x13e5fe[_0xd3e1('0x4b')]=qs['sort'](_0x8bf5e9['query'][_0xd3e1('0x4c')]);_0x13e5fe[_0xd3e1('0x4d')]=qs[_0xd3e1('0x45')](_[_0xd3e1('0x4e')](_0x8bf5e9['query'],_0x199205[_0xd3e1('0x45')]));_0x13e5fe[_0xd3e1('0x4d')][_0xd3e1('0x65')]=_0x66d9a0['id'];if(_0x8bf5e9['query'][_0xd3e1('0x51')]){_0x13e5fe[_0xd3e1('0x4d')]=_[_0xd3e1('0x4f')](_0x13e5fe[_0xd3e1('0x4d')],{'$or':_['map'](_0x13e5fe[_0xd3e1('0x46')],function(_0x57fe73){var _0x3a9410={};_0x3a9410[_0x57fe73]={'$like':'%'+_0x8bf5e9[_0xd3e1('0x44')][_0xd3e1('0x51')]+'%'};return _0x3a9410;})});}_0x13e5fe=_[_0xd3e1('0x4f')]({},_0x13e5fe,_0x8bf5e9[_0xd3e1('0x52')]);return db[_0xd3e1('0x68')]['count']({'where':_0x13e5fe[_0xd3e1('0x4d')]})[_0xd3e1('0x21')](function(_0x441036){_0xe5b95a[_0xd3e1('0x53')]=_0x441036;if(_0x8bf5e9[_0xd3e1('0x44')]['includeAll']){_0x13e5fe['include']=[{'all':!![]}];}return db[_0xd3e1('0x68')][_0xd3e1('0x56')](_0x13e5fe);})[_0xd3e1('0x21')](function(_0x1fb120){_0xe5b95a[_0xd3e1('0x57')]=_0x1fb120;return _0xe5b95a;});}})[_0xd3e1('0x21')](respondWithFilteredResult(_0x4bc227,_0x13e5fe))[_0xd3e1('0x2b')](handleError(_0x4bc227,null));};exports[_0xd3e1('0x69')]=function(_0x3f9447,_0x5a26a9,_0x368e7c){return db['OpenchannelAccount'][_0xd3e1('0x61')]({'where':{'id':_0x3f9447[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x5a26a9,null))[_0xd3e1('0x21')](function(_0x2b86c9){if(_0x2b86c9){return _0x2b86c9[_0xd3e1('0x69')](_0x3f9447[_0xd3e1('0x44')][_0xd3e1('0x6a')]);}})[_0xd3e1('0x21')](respondWithStatusCode(_0x5a26a9,null))[_0xd3e1('0x2b')](handleError(_0x5a26a9,null));};exports[_0xd3e1('0x6b')]=function(_0x488944,_0x4c08ef,_0x3b0430){if(_0x488944[_0xd3e1('0x5d')]['id']){delete _0x488944['body']['id'];}return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0x488944[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x4c08ef,null))[_0xd3e1('0x21')](function(_0x1abde0){if(_0x1abde0){_0x488944[_0xd3e1('0x5d')][_0xd3e1('0x65')]=_0x1abde0['id'];return db[_0xd3e1('0x6c')]['create'](_0x488944['body']);}})[_0xd3e1('0x21')](respondWithResult(_0x4c08ef,null))[_0xd3e1('0x2b')](handleError(_0x4c08ef,null));};exports[_0xd3e1('0x6d')]=function(_0xc3b48a,_0x1e4c81,_0xc5a15e){var _0x2fee31={'raw':![],'where':{}};var _0x5bf394={};var _0x377663={'count':0x0,'rows':[]};return db[_0xd3e1('0x40')]['findOne']({'where':{'id':_0xc3b48a[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x1e4c81,null))[_0xd3e1('0x21')](function(_0x1b9059){if(_0x1b9059){_0x5bf394[_0xd3e1('0x43')]=_[_0xd3e1('0x5b')](db[_0xd3e1('0x6c')][_0xd3e1('0x5c')]);_0x5bf394['query']=_[_0xd3e1('0x5b')](_0xc3b48a[_0xd3e1('0x44')]);_0x5bf394[_0xd3e1('0x45')]=_['intersection'](_0x5bf394['model'],_0x5bf394[_0xd3e1('0x44')]);_0x2fee31[_0xd3e1('0x46')]=_[_0xd3e1('0x47')](_0x5bf394['model'],qs[_0xd3e1('0x48')](_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x48')]));_0x2fee31[_0xd3e1('0x46')]=_0x2fee31[_0xd3e1('0x46')][_0xd3e1('0x49')]?_0x2fee31[_0xd3e1('0x46')]:_0x5bf394['model'];if(!_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x6e')](_0xd3e1('0x4a'))){_0x2fee31[_0xd3e1('0x31')]=qs[_0xd3e1('0x31')](_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x31')]);_0x2fee31[_0xd3e1('0x30')]=qs[_0xd3e1('0x30')](_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x30')]);}_0x2fee31[_0xd3e1('0x4b')]=qs[_0xd3e1('0x4c')](_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x4c')]);_0x2fee31[_0xd3e1('0x4d')]=qs['filters'](_[_0xd3e1('0x4e')](_0xc3b48a['query'],_0x5bf394[_0xd3e1('0x45')]));_0x2fee31['where'][_0xd3e1('0x65')]=_0x1b9059['id'];if(_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x51')]){_0x2fee31[_0xd3e1('0x4d')]=_[_0xd3e1('0x4f')](_0x2fee31['where'],{'$or':_[_0xd3e1('0x3f')](_0x2fee31[_0xd3e1('0x46')],function(_0x4bafaf){var _0x149801={};_0x149801[_0x4bafaf]={'$like':'%'+_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x51')]+'%'};return _0x149801;})});}_0x2fee31=_[_0xd3e1('0x4f')]({},_0x2fee31,_0xc3b48a[_0xd3e1('0x52')]);return db[_0xd3e1('0x6c')][_0xd3e1('0x53')]({'where':_0x2fee31[_0xd3e1('0x4d')]})[_0xd3e1('0x21')](function(_0x3d3e89){_0x377663[_0xd3e1('0x53')]=_0x3d3e89;if(_0xc3b48a[_0xd3e1('0x44')][_0xd3e1('0x54')]){_0x2fee31[_0xd3e1('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd3e1('0x56')](_0x2fee31);})[_0xd3e1('0x21')](function(_0x51c9af){_0x377663[_0xd3e1('0x57')]=_0x51c9af;return _0x377663;});}})[_0xd3e1('0x21')](respondWithFilteredResult(_0x1e4c81,_0x2fee31))[_0xd3e1('0x2b')](handleError(_0x1e4c81,null));};exports[_0xd3e1('0x6f')]=function(_0xad98da,_0x340e62,_0x5bf370){return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0xad98da[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x340e62,null))[_0xd3e1('0x21')](function(_0xec423e){if(_0xec423e){return _0xec423e['removeAnswers'](_0xad98da[_0xd3e1('0x44')][_0xd3e1('0x6a')]);}})[_0xd3e1('0x21')](respondWithStatusCode(_0x340e62,null))[_0xd3e1('0x2b')](handleError(_0x340e62,null));};exports[_0xd3e1('0x70')]=function(_0x599fde,_0x411a96,_0xc7beb){var _0x3b9c96={'body':_0x599fde[_0xd3e1('0x5d')],'channel':_0xd3e1('0x71')};var _0x2129ef=[];var _0x13a431=[];var _0x27591e={};var _0x4aee10=![];return db['CmContact'][_0xd3e1('0x64')]()[_0xd3e1('0x21')](function(_0x2b020f){if(!_0x2b020f){throw new db['Sequelize'][(_0xd3e1('0x72'))](_0xd3e1('0x73'));}_0x2129ef=_[_0xd3e1('0x74')](_['keys'](_0x2b020f),[_0xd3e1('0x75'),_0xd3e1('0x76')]);_0x13a431=_[_0xd3e1('0x74')](_[_0xd3e1('0x5b')](_0x2b020f),[_0xd3e1('0x75'),_0xd3e1('0x76'),_0xd3e1('0x77'),_0xd3e1('0x78')]);if(_0x599fde[_0xd3e1('0x5d')]['id']){delete _0x599fde[_0xd3e1('0x5d')]['id'];}if(_[_0xd3e1('0x79')](_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x7a')])){throw new db['Sequelize'][(_0xd3e1('0x72'))](_0xd3e1('0x7b'));}if(_[_0xd3e1('0x79')](_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x5d')])||_0x599fde[_0xd3e1('0x5d')]['body']===''){throw new db[(_0xd3e1('0x7c'))][(_0xd3e1('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x599fde['body'][_0xd3e1('0x7d')])){throw new db['Sequelize'][(_0xd3e1('0x72'))](_0xd3e1('0x7e')+_0x13a431);}if(!_[_0xd3e1('0x7f')](_0x13a431,_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x7d')])){throw new db[(_0xd3e1('0x7c'))][(_0xd3e1('0x72'))](_0xd3e1('0x80')+_0x13a431);}_0x27591e[_0x599fde['body']['mapKey']]=_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x7a')];})['then'](function(){return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0x599fde[_0xd3e1('0x59')]['id']},'include':[{'model':db[_0xd3e1('0x81')],'as':_0xd3e1('0x82'),'include':[{'model':db[_0xd3e1('0x83')],'as':'Contacts','where':_0x27591e,'limit':0x1,'order':[[_0xd3e1('0x76'),'DESC']]}]},{'model':db[_0xd3e1('0x84')],'as':_0xd3e1('0x85')}]});})[_0xd3e1('0x21')](handleEntityNotFound(_0x411a96,null))[_0xd3e1('0x21')](function(_0x9e63c0){if(_0x9e63c0&&_0x9e63c0['List']){_0x3b9c96['account']=_0x9e63c0;_0x3b9c96['applications']=_0x9e63c0[_0xd3e1('0x85')];_0x3b9c96[_0xd3e1('0x86')]=_0x9e63c0[_0xd3e1('0x82')];_0x3b9c96[_0xd3e1('0x87')]=_[_0xd3e1('0x88')](_0x3b9c96[_0xd3e1('0x87')],[_0xd3e1('0x89')],[_0xd3e1('0x8a')]);if(_0x3b9c96[_0xd3e1('0x8b')][_0xd3e1('0x85')]){delete _0x3b9c96[_0xd3e1('0x8b')][_0xd3e1('0x85')];}if(_0x3b9c96['account'][_0xd3e1('0x82')]&&_0x3b9c96[_0xd3e1('0x8b')][_0xd3e1('0x82')][_0xd3e1('0x8c')][_0xd3e1('0x49')]){return _0x3b9c96['account'][_0xd3e1('0x82')][_0xd3e1('0x8c')][0x0];}var _0x515c53=_[_0xd3e1('0x18')](_0x599fde['body'],{'firstName':_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x7a')],'ListId':_0x9e63c0[_0xd3e1('0x78')]});_0x515c53[_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x7d')]]=_0x599fde['body'][_0xd3e1('0x7a')];return db['CmContact']['create'](_0x515c53,{'fields':_0x2129ef,'raw':!![]});}})[_0xd3e1('0x21')](handleEntityNotFound(_0x411a96,null))['then'](function(_0x276a08){_0x3b9c96[_0xd3e1('0x8d')]=_0x276a08;if(_0x276a08){var _0x5217ba={'ContactId':_0x276a08['id'],'OpenchannelAccountId':_0x599fde['params']['id'],'from':(_0x276a08['firstName']||'')+'\x20'+(_0x276a08['lastName']||'')};var _0x37f8b1={'OpenchannelAccountId':_0x599fde[_0xd3e1('0x59')]['id'],'closed':![]};if(_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x8e')]){_0x37f8b1['threadId']=_0x599fde['body'][_0xd3e1('0x8e')];return db[_0xd3e1('0x8f')]['find']({'where':_0x37f8b1})[_0xd3e1('0x21')](function(_0x48e782){if(_0x48e782){return[_0x48e782,![]];}_0x5217ba[_0xd3e1('0x8e')]=_0x599fde['body'][_0xd3e1('0x8e')];_0x5217ba[_0xd3e1('0x90')]=_0x599fde[_0xd3e1('0x5d')]['externalUrl'];return db[_0xd3e1('0x8f')][_0xd3e1('0x66')](_0x5217ba)[_0xd3e1('0x21')](function(_0x52c975){return[_0x52c975,!![]];});});}else{_0x37f8b1['threadId']=null;}_0x37f8b1[_0xd3e1('0x91')]=_0x276a08['id'];return db[_0xd3e1('0x8f')][_0xd3e1('0x61')]({'where':_0x37f8b1})[_0xd3e1('0x21')](function(_0x14d39a){if(_0x14d39a){return[_0x14d39a,![]];}return db[_0xd3e1('0x8f')][_0xd3e1('0x66')](_0x5217ba)[_0xd3e1('0x21')](function(_0x1e42d5){return[_0x1e42d5,!![]];});});}})[_0xd3e1('0x92')](function(_0x42ae76,_0x3a7e02){if(_0x42ae76){_0x4aee10=_0x3a7e02;if(!_0x3a7e02){var _0x213001={'from':(_0x3b9c96['contact']['firstName']||'')+'\x20'+(_0x3b9c96[_0xd3e1('0x8d')][_0xd3e1('0x93')]||'')};if(_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x8e')]&&_0x599fde['body'][_0xd3e1('0x94')]&&_0x599fde['body'][_0xd3e1('0x8e')]!=_0x599fde[_0xd3e1('0x5d')]['messageId']){_0x213001[_0xd3e1('0x8e')]=_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x94')];}return _0x42ae76[_0xd3e1('0x36')](_0x213001);}else{return _0x42ae76;}}})[_0xd3e1('0x21')](function(_0xdef085){_0x3b9c96[_0xd3e1('0x95')]=_0xdef085['get']({'plain':!![]});_0x3b9c96[_0xd3e1('0x95')][_0xd3e1('0x96')]=_0x4aee10;if(_0x3b9c96[_0xd3e1('0x95')][_0xd3e1('0x96')]){if(_0x3b9c96['account']['autoclose']){_0x3b9c96[_0xd3e1('0x87')][_0xd3e1('0x97')]({'id':0x0,'priority':_0x3b9c96[_0xd3e1('0x87')]['length']+0x1,'app':_0xd3e1('0x98'),'appdata':'unmanaged','interval':_0xd3e1('0x99')});}}return db[_0xd3e1('0x9a')][_0xd3e1('0x66')]({'body':_0x599fde['body']['body'],'OpenchannelAccountId':_0x599fde[_0xd3e1('0x59')]['id'],'OpenchannelInteractionId':_0xdef085['id'],'direction':'in','ContactId':_0x3b9c96[_0xd3e1('0x8d')]['id'],'AttachmentId':_0x599fde[_0xd3e1('0x5d')][_0xd3e1('0x9b')]});})[_0xd3e1('0x21')](function(_0x35070d){_0x3b9c96[_0xd3e1('0x29')]=_0x35070d;if(!_0x3b9c96[_0xd3e1('0x95')]['UserId'])return;return db[_0xd3e1('0x9c')][_0xd3e1('0x61')]({'attributes':['id',_0xd3e1('0x3b')],'where':{'id':_0x3b9c96['interaction'][_0xd3e1('0x9d')]}});})[_0xd3e1('0x21')](function(_0x48dc6a){if(_0x48dc6a){_0x3b9c96[_0xd3e1('0x87')][_0xd3e1('0x9e')]({'id':0x0,'priority':0x0,'app':_0xd3e1('0x9f'),'appdata':_0x48dc6a[_0xd3e1('0x3b')]+','+(_0x3b9c96[_0xd3e1('0x8b')][_0xd3e1('0xa0')]||0xa),'interval':_0xd3e1('0x99')});}if(!_0x3b9c96[_0xd3e1('0x95')][_0xd3e1('0xa1')])return;return db[_0xd3e1('0xa2')]['find']({'attributes':['id',_0xd3e1('0x3b')],'where':{'id':_0x3b9c96[_0xd3e1('0x95')][_0xd3e1('0xa1')]}});})['then'](function(_0x79f919){if(_0x79f919){_0x3b9c96[_0xd3e1('0x87')][_0xd3e1('0x9e')]({'id':0x0,'priority':0x1,'app':_0xd3e1('0xa3'),'appdata':_0x79f919[_0xd3e1('0x3b')]+','+(_0x3b9c96[_0xd3e1('0x8b')][_0xd3e1('0xa4')]||0x12c),'interval':_0xd3e1('0x99')});}return respondWithRpcPromise('Start',_0xd3e1('0xa5'),_0x3b9c96);})['then'](function(_0x26323e){respondWithRpcPromise(_0xd3e1('0xa6'),_0xd3e1('0xa6'),{'event':_0xd3e1('0x70'),'message':_0x26323e},client9002);return _0x26323e;})[_0xd3e1('0x21')](respondWithResult(_0x411a96,null))['catch'](handleError(_0x411a96,null));};exports[_0xd3e1('0xa7')]=function(_0x6db57b,_0x3d9711){var _0xc2a24c=_0x6db57b['params']['id'];var _0x333799=_0x6db57b[_0xd3e1('0x5d')];var _0xe54e7c=0xc8;var _0x5e2b2f=null;return db[_0xd3e1('0xa8')]['transaction']({'isolationLevel':db[_0xd3e1('0xa8')][_0xd3e1('0xa9')]['ISOLATION_LEVELS'][_0xd3e1('0xaa')]},function(_0x52b3c2){return db[_0xd3e1('0x40')][_0xd3e1('0xab')]({'where':{'id':_0xc2a24c},'transaction':_0x52b3c2})[_0xd3e1('0x21')](function(_0xdddbb1){if(_0xdddbb1){return db['OpenchannelApplication'][_0xd3e1('0x39')]({'where':{'OpenchannelAccountId':_0xc2a24c},'transaction':_0x52b3c2})[_0xd3e1('0x21')](function(){var _0x35531f=_[_0xd3e1('0x3f')](_0x333799,function(_0x4c5828){_0x4c5828['OpenchannelAccountId']=_0xc2a24c;return _0x4c5828;});return db['OpenchannelApplication']['bulkCreate'](_0x35531f,{'transaction':_0x52b3c2});});}else{_0xe54e7c=0x194;_0x5e2b2f=[];}});})['then'](function(){if(_0xe54e7c!==0x194){return db[_0xd3e1('0x84')][_0xd3e1('0xac')]({'where':{'OpenchannelAccountId':_0xc2a24c},'order':'priority'})[_0xd3e1('0x21')](function(_0x5b5434){_0x5e2b2f=_0x5b5434;});}})['catch'](function(_0x13acda){_0xe54e7c=0x1f4;logger['error'](_0x13acda[_0xd3e1('0x3a')]);if(_0x13acda['name']){delete _0x13acda['name'];}_0x5e2b2f=_0x13acda;})[_0xd3e1('0xad')](function(){if(_0x5e2b2f===null){_0x3d9711[_0xd3e1('0x2c')](_0xe54e7c);}else{if(_0xe54e7c===0x1f4){_0x3d9711[_0xd3e1('0x2d')](_0xe54e7c)[_0xd3e1('0x3c')](_0x5e2b2f);}else{_0x3d9711['status'](_0xe54e7c)['json'](_0x5e2b2f);}}});};exports['getApplications']=function(_0x4c00e9,_0x495f87,_0x57adac){var _0x443533={};var _0x394d48={};var _0x247e9c;var _0x3431a6;return db[_0xd3e1('0x40')][_0xd3e1('0xab')]({'where':{'id':_0x4c00e9['params']['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x495f87,null))[_0xd3e1('0x21')](function(_0x482742){if(_0x482742){_0x247e9c=_0x482742;_0x394d48['model']=_[_0xd3e1('0x5b')](db[_0xd3e1('0x84')][_0xd3e1('0x5c')]);_0x394d48[_0xd3e1('0x44')]=_[_0xd3e1('0x5b')](_0x4c00e9['query']);_0x394d48[_0xd3e1('0x45')]=_[_0xd3e1('0x47')](_0x394d48[_0xd3e1('0x43')],_0x394d48['query']);_0x443533[_0xd3e1('0x46')]=_[_0xd3e1('0x47')](_0x394d48[_0xd3e1('0x43')],qs[_0xd3e1('0x48')](_0x4c00e9['query'][_0xd3e1('0x48')]));_0x443533['attributes']=_0x443533[_0xd3e1('0x46')]['length']?_0x443533[_0xd3e1('0x46')]:_0x394d48[_0xd3e1('0x43')];_0x443533[_0xd3e1('0x4b')]=qs['sort'](_0x4c00e9[_0xd3e1('0x44')]['sort']);_0x443533[_0xd3e1('0x4d')]=qs[_0xd3e1('0x45')](_[_0xd3e1('0x4e')](_0x4c00e9['query'],_0x394d48[_0xd3e1('0x45')]));if(_0x4c00e9[_0xd3e1('0x44')]['filter']){_0x443533[_0xd3e1('0x4d')]=_[_0xd3e1('0x4f')](_0x443533['where'],{'$or':_['map'](_0x443533['attributes'],function(_0x4f7129){var _0x15692e={};_0x15692e[_0x4f7129]={'$like':'%'+_0x4c00e9['query'][_0xd3e1('0x51')]+'%'};return _0x15692e;})});}_0x443533=_['merge']({},_0x443533,_0x4c00e9['options']);return _0x247e9c[_0xd3e1('0xae')](_0x443533);}})['then'](function(_0x109597){if(_0x109597){_0x3431a6=_0x109597[_0xd3e1('0x49')];if(!_0x4c00e9[_0xd3e1('0x44')][_0xd3e1('0x6e')](_0xd3e1('0x4a'))){_0x443533[_0xd3e1('0x31')]=qs[_0xd3e1('0x31')](_0x4c00e9[_0xd3e1('0x44')][_0xd3e1('0x31')]);_0x443533[_0xd3e1('0x30')]=qs[_0xd3e1('0x30')](_0x4c00e9[_0xd3e1('0x44')][_0xd3e1('0x30')]);}return _0x247e9c[_0xd3e1('0xae')](_0x443533);}})[_0xd3e1('0x21')](function(_0x43b983){if(_0x43b983){return _0x43b983?{'count':_0x3431a6,'rows':_0x43b983}:null;}})[_0xd3e1('0x21')](respondWithResult(_0x495f87,null))[_0xd3e1('0x2b')](handleError(_0x495f87,null));};exports['getInteractions']=function(_0x43155b,_0x36c75e,_0x5a50e5){var _0x986a52={'raw':![],'where':{}};var _0xd94d80={};var _0x4751f4={'count':0x0,'rows':[]};return db[_0xd3e1('0x40')]['findOne']({'where':{'id':_0x43155b[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x36c75e,null))[_0xd3e1('0x21')](function(_0x123372){if(_0x123372){_0xd94d80['model']=_[_0xd3e1('0x5b')](db[_0xd3e1('0x8f')][_0xd3e1('0x5c')]);_0xd94d80['query']=_[_0xd3e1('0x5b')](_0x43155b[_0xd3e1('0x44')]);_0xd94d80[_0xd3e1('0x45')]=_[_0xd3e1('0x47')](_0xd94d80[_0xd3e1('0x43')],_0xd94d80['query']);_0x986a52[_0xd3e1('0x46')]=_['intersection'](_0xd94d80[_0xd3e1('0x43')],qs[_0xd3e1('0x48')](_0x43155b[_0xd3e1('0x44')]['fields']));_0x986a52[_0xd3e1('0x46')]=_0x986a52[_0xd3e1('0x46')][_0xd3e1('0x49')]?_0x986a52[_0xd3e1('0x46')]:_0xd94d80[_0xd3e1('0x43')];if(!_0x43155b[_0xd3e1('0x44')]['hasOwnProperty']('nolimit')){_0x986a52['limit']=qs[_0xd3e1('0x31')](_0x43155b['query'][_0xd3e1('0x31')]);_0x986a52['offset']=qs[_0xd3e1('0x30')](_0x43155b[_0xd3e1('0x44')][_0xd3e1('0x30')]);}_0x986a52[_0xd3e1('0x4b')]=qs['sort'](_0x43155b[_0xd3e1('0x44')][_0xd3e1('0x4c')]);_0x986a52['where']=qs['filters'](_[_0xd3e1('0x4e')](_0x43155b['query'],_0xd94d80['filters']));_0x986a52[_0xd3e1('0x4d')][_0xd3e1('0x65')]=_0x123372['id'];if(_0x43155b['query']['filter']){_0x986a52[_0xd3e1('0x4d')]=_['merge'](_0x986a52['where'],{'$or':_[_0xd3e1('0x3f')](_0x986a52['attributes'],function(_0x245fc0){var _0x576127={};_0x576127[_0x245fc0]={'$like':'%'+_0x43155b[_0xd3e1('0x44')][_0xd3e1('0x51')]+'%'};return _0x576127;})});}_0x986a52=_['merge']({},_0x986a52,_0x43155b[_0xd3e1('0x52')]);return db['OpenchannelInteraction'][_0xd3e1('0x53')]({'where':_0x986a52[_0xd3e1('0x4d')]})['then'](function(_0x5aa459){_0x4751f4['count']=_0x5aa459;if(_0x43155b[_0xd3e1('0x44')][_0xd3e1('0x54')]){_0x986a52[_0xd3e1('0x55')]=[{'model':db['CmContact'],'as':_0xd3e1('0xaf'),'required':![]},{'model':db[_0xd3e1('0x9c')],'as':_0xd3e1('0xb0'),'attributes':['name',_0xd3e1('0xb1'),'internal'],'required':![]},{'model':db[_0xd3e1('0xb2')],'as':_0xd3e1('0xb3'),'attributes':['id',_0xd3e1('0x3b'),_0xd3e1('0xb4')],'where':_0x43155b[_0xd3e1('0x44')][_0xd3e1('0xb5')]?{'id':_0x43155b['query'][_0xd3e1('0xb5')]}:undefined,'required':_0x43155b[_0xd3e1('0x44')][_0xd3e1('0xb5')]?!![]:![]}];}return db[_0xd3e1('0x8f')][_0xd3e1('0x56')](_0x986a52);})[_0xd3e1('0x21')](function(_0x14de50){_0x4751f4[_0xd3e1('0x57')]=_0x14de50;return _0x4751f4;});}})[_0xd3e1('0x21')](respondWithFilteredResult(_0x36c75e,_0x986a52))[_0xd3e1('0x2b')](handleError(_0x36c75e,null));};exports['addAgents']=function(_0x4bc890,_0xf46008,_0x95b6ec){return db['OpenchannelAccount'][_0xd3e1('0x61')]({'where':{'id':_0x4bc890[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0xf46008,null))[_0xd3e1('0x21')](function(_0x27d911){if(_0x27d911){return _0x27d911[_0xd3e1('0xb6')](_0x4bc890[_0xd3e1('0x5d')][_0xd3e1('0x6a')],_[_0xd3e1('0xb7')](_0x4bc890['body'],['ids','id'])||{})['spread'](function(_0x5551b5){for(var _0x3cd901=0x0;_0x3cd901<_0x4bc890[_0xd3e1('0x5d')][_0xd3e1('0x6a')][_0xd3e1('0x49')];_0x3cd901+=0x1){socket[_0xd3e1('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x4bc890[_0xd3e1('0x5d')][_0xd3e1('0x6a')][_0x3cd901]),'OpenchannelAccountId':Number(_0x4bc890[_0xd3e1('0x59')]['id'])});}return _0x5551b5;});}})[_0xd3e1('0x21')](respondWithResult(_0xf46008,null))[_0xd3e1('0x2b')](handleError(_0xf46008,null));};exports[_0xd3e1('0xb9')]=function(_0x22efa7,_0x427334,_0x5e259c){return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0x22efa7[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x427334,null))['then'](function(_0x2d2b86){if(_0x2d2b86){return _0x2d2b86[_0xd3e1('0xb9')](_0x22efa7[_0xd3e1('0x44')][_0xd3e1('0x6a')])[_0xd3e1('0x21')](function(){if(_[_0xd3e1('0xba')](_0x22efa7['query'][_0xd3e1('0x6a')])){for(var _0x128c5c=0x0;_0x128c5c<_0x22efa7[_0xd3e1('0x44')][_0xd3e1('0x6a')]['length'];_0x128c5c+=0x1){socket[_0xd3e1('0xb8')](_0xd3e1('0xbb'),{'UserId':Number(_0x22efa7[_0xd3e1('0x44')][_0xd3e1('0x6a')][_0x128c5c]),'OpenchannelAccountId':Number(_0x22efa7[_0xd3e1('0x59')]['id'])});}}else{socket['emit'](_0xd3e1('0xbb'),{'UserId':Number(_0x22efa7[_0xd3e1('0x44')][_0xd3e1('0x6a')]),'OpenchannelAccountId':Number(_0x22efa7['params']['id'])});}});}})[_0xd3e1('0x21')](respondWithStatusCode(_0x427334,null))['catch'](handleError(_0x427334,null));};exports[_0xd3e1('0xbc')]=function(_0x121bf2,_0x5cc259,_0x262371){var _0x518da6={};var _0x5eb19e={};var _0x361bad;var _0x191de2;return db['OpenchannelAccount'][_0xd3e1('0xab')]({'where':{'id':_0x121bf2[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x5cc259,null))['then'](function(_0x13745a){if(_0x13745a){_0x361bad=_0x13745a;_0x5eb19e[_0xd3e1('0x43')]=_[_0xd3e1('0x5b')](db[_0xd3e1('0x9c')][_0xd3e1('0x5c')]);_0x5eb19e['query']=_['keys'](_0x121bf2[_0xd3e1('0x44')]);_0x5eb19e[_0xd3e1('0x45')]=_[_0xd3e1('0x47')](_0x5eb19e[_0xd3e1('0x43')],_0x5eb19e['query']);_0x518da6['attributes']=_[_0xd3e1('0x47')](_0x5eb19e['model'],qs[_0xd3e1('0x48')](_0x121bf2[_0xd3e1('0x44')][_0xd3e1('0x48')]));_0x518da6[_0xd3e1('0x46')]=_0x518da6['attributes'][_0xd3e1('0x49')]?_0x518da6[_0xd3e1('0x46')]:_0x5eb19e['model'];_0x518da6['order']=qs[_0xd3e1('0x4c')](_0x121bf2[_0xd3e1('0x44')][_0xd3e1('0x4c')]);_0x518da6[_0xd3e1('0x4d')]=qs[_0xd3e1('0x45')](_[_0xd3e1('0x4e')](_0x121bf2[_0xd3e1('0x44')],_0x5eb19e[_0xd3e1('0x45')]));if(_0x121bf2[_0xd3e1('0x44')]['filter']){_0x518da6[_0xd3e1('0x4d')]=_[_0xd3e1('0x4f')](_0x518da6['where'],{'$or':_[_0xd3e1('0x3f')](_0x518da6[_0xd3e1('0x46')],function(_0x17ec0c){var _0x39d2d3={};_0x39d2d3[_0x17ec0c]={'$like':'%'+_0x121bf2[_0xd3e1('0x44')][_0xd3e1('0x51')]+'%'};return _0x39d2d3;})});}_0x518da6=_['merge']({},_0x518da6,_0x121bf2['options']);return _0x361bad[_0xd3e1('0xbc')](_0x518da6);}})[_0xd3e1('0x21')](function(_0x454526){if(_0x454526){_0x191de2=_0x454526['length'];if(!_0x121bf2[_0xd3e1('0x44')][_0xd3e1('0x6e')]('nolimit')){_0x518da6['limit']=qs['limit'](_0x121bf2['query'][_0xd3e1('0x31')]);_0x518da6[_0xd3e1('0x30')]=qs[_0xd3e1('0x30')](_0x121bf2['query'][_0xd3e1('0x30')]);}return _0x361bad['getAgents'](_0x518da6);}})[_0xd3e1('0x21')](function(_0x4d2679){if(_0x4d2679){return _0x4d2679?{'count':_0x191de2,'rows':_0x4d2679}:null;}})[_0xd3e1('0x21')](respondWithResult(_0x5cc259,null))[_0xd3e1('0x2b')](handleError(_0x5cc259,null));};exports[_0xd3e1('0x3c')]=function(_0x53292d,_0x5b0e10,_0x2c1fb9){var _0x411876,_0x99f9ea,_0xafa36b;if(_[_0xd3e1('0x79')](_0x53292d['body'][_0xd3e1('0x5d')])||_0x53292d[_0xd3e1('0x5d')]['body']===''){throw new db[(_0xd3e1('0x7c'))]['ValidationError'](_0xd3e1('0xbd'));}if(_[_0xd3e1('0x79')](_0x53292d[_0xd3e1('0x5d')]['to'])){}_0x411876=_0x53292d[_0xd3e1('0x5d')]['to'];return db[_0xd3e1('0x40')][_0xd3e1('0xab')]({'where':{'id':_0x53292d[_0xd3e1('0x59')]['id']}})[_0xd3e1('0x21')](handleEntityNotFound(_0x5b0e10,null))['then'](function(_0x2a37e7){if(_0x2a37e7){return db[_0xd3e1('0x40')][_0xd3e1('0x61')]({'where':{'id':_0x2a37e7['id']},'include':[{'model':db[_0xd3e1('0x81')],'as':_0xd3e1('0x82'),'include':[{'model':db[_0xd3e1('0x83')],'as':_0xd3e1('0x8c'),'where':{[_0x2a37e7['mapKey']]:_0x411876},'limit':0x1,'order':[[_0xd3e1('0x76'),_0xd3e1('0xbe')]]}]}]})[_0xd3e1('0x21')](handleEntityNotFound(_0x5b0e10,null))[_0xd3e1('0x21')](function(_0x131fab){if(_0x131fab&&_0x131fab[_0xd3e1('0x82')]){_0x99f9ea=_0x131fab[_0xd3e1('0x37')]({'plain':!![]});if(_0x99f9ea[_0xd3e1('0x82')]&&_0x99f9ea['List'][_0xd3e1('0x8c')][_0xd3e1('0x49')]){return _0x99f9ea[_0xd3e1('0x82')][_0xd3e1('0x8c')][0x0];}return db[_0xd3e1('0x83')]['create'](_['defaults'](_0x53292d[_0xd3e1('0x5d')],{'firstName':_0x411876,[_0x131fab[_0xd3e1('0x7d')]]:_0x411876,'phone':_0x411876,'ListId':_0x99f9ea[_0xd3e1('0x78')]}));}})['then'](handleEntityNotFound(_0x5b0e10,null))[_0xd3e1('0x21')](function(_0x319832){if(_0x319832){_0xafa36b=_0x319832;return db[_0xd3e1('0x8f')][_0xd3e1('0x61')]({'where':{'ContactId':_0xafa36b['id'],'closed':![],'OpenchannelAccountId':_0x99f9ea['id']}})['then'](function(_0x56c35d){if(_0x56c35d){return[_0x56c35d,![]];}return db[_0xd3e1('0x8f')][_0xd3e1('0x66')]({'UserId':_0x53292d[_0xd3e1('0x5e')]['id'],'ContactId':_0xafa36b['id'],'OpenchannelAccountId':_0x99f9ea['id'],'lastMsgDirection':_0xd3e1('0xbf'),'firstMsgDirection':_0xd3e1('0xbf'),'Messages':[_[_0xd3e1('0x4f')](_0x53292d['body'],{'read':![],'body':_0x53292d[_0xd3e1('0x5d')][_0xd3e1('0x5d')],'OpenchannelAccountId':_0x99f9ea['id'],'UserId':_0x53292d[_0xd3e1('0x5e')]['id'],'ContactId':_0xafa36b['id']})]},{'include':[{'model':db[_0xd3e1('0x9a')],'as':_0xd3e1('0xc0')}]})[_0xd3e1('0x21')](function(_0x21c558){return[_0x21c558,!![]];});});}})['spread'](function(_0x179f19,_0x479045){if(_0x479045){return _0x179f19;}return db[_0xd3e1('0x9a')][_0xd3e1('0x66')](_[_0xd3e1('0x4f')](_0x53292d[_0xd3e1('0x5d')],{'read':![],'body':_0x53292d['body'][_0xd3e1('0x5d')],'OpenchannelAccountId':_0x99f9ea['id'],'OpenchannelInteractionId':_0x179f19['id'],'UserId':_0x53292d[_0xd3e1('0x5e')]['id'],'ContactId':_0xafa36b['id']}))[_0xd3e1('0x21')](function(_0x424dc5){_0x179f19[_0xd3e1('0xc1')][_0xd3e1('0xc0')]=[];_0x179f19[_0xd3e1('0xc1')][_0xd3e1('0xc0')]['push'](_0x424dc5[_0xd3e1('0xc1')]);return _0x179f19;});});}})[_0xd3e1('0x21')](respondWithResult(_0x5b0e10,null))['catch'](handleError(_0x5b0e10,null));}; \ No newline at end of file +var _0x5692=['destroy','get','OpenchannelAccounts','UserProfileResource','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','params','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','Contacts','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','json','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','apply','update'];(function(_0x3dceeb,_0x5ee3e5){var _0x24900f=function(_0x6de0ec){while(--_0x6de0ec){_0x3dceeb['push'](_0x3dceeb['shift']());}};_0x24900f(++_0x5ee3e5);}(_0x5692,0x8b));var _0x2569=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5692[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2569('0x0'));var zipdir=require(_0x2569('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2569('0x2'));var moment=require(_0x2569('0x3'));var BPromise=require(_0x2569('0x4'));var Mustache=require('mustache');var util=require(_0x2569('0x5'));var path=require(_0x2569('0x6'));var sox=require(_0x2569('0x7'));var csv=require(_0x2569('0x8'));var ejs=require(_0x2569('0x9'));var fs=require('fs');var fs_extra=require(_0x2569('0xa'));var _=require(_0x2569('0xb'));var squel=require('squel');var crypto=require(_0x2569('0xc'));var jsforce=require(_0x2569('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2569('0x8'));var querystring=require(_0x2569('0xe'));var Papa=require(_0x2569('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(_0x2569('0x10'));var logger=require('../../config/logger')(_0x2569('0x11'));var utils=require(_0x2569('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2569('0x13'))['db'];config[_0x2569('0x14')]=_['defaults'](config[_0x2569('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2569('0x15'))(new Redis(config[_0x2569('0x14')]));require(_0x2569('0x16'))[_0x2569('0x17')](socket);var jayson=require(_0x2569('0x18'));var client=jayson[_0x2569('0x19')][_0x2569('0x1a')]({'port':0x232c});var client9002=jayson[_0x2569('0x19')][_0x2569('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x20e118,_0x57d5eb,_0x96a784,_0x9ea2b5){return new BPromise(function(_0x4ef9ca,_0x2df903){var _0x126375=_0x9ea2b5||client;return _0x126375[_0x2569('0x1b')](_0x20e118,_0x96a784)[_0x2569('0x1c')](function(_0x200cf6){logger[_0x2569('0x1d')](_0x2569('0x1e'),_0x57d5eb,_0x2569('0x1f'));logger[_0x2569('0x20')](_0x2569('0x21'),_0x57d5eb,_0x2569('0x1f'),JSON[_0x2569('0x22')](_0x200cf6));if(_0x200cf6['error']){if(_0x200cf6[_0x2569('0x23')][_0x2569('0x24')]===0x1f4){logger[_0x2569('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x57d5eb,_0x200cf6['error'][_0x2569('0x25')]);return _0x2df903(_0x200cf6['error'][_0x2569('0x25')]);}logger[_0x2569('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x57d5eb,_0x200cf6[_0x2569('0x23')][_0x2569('0x25')]);return _0x4ef9ca(_0x200cf6[_0x2569('0x23')][_0x2569('0x25')]);}else{logger['info'](_0x2569('0x1e'),_0x57d5eb,_0x2569('0x1f'));_0x4ef9ca(_0x200cf6[_0x2569('0x26')][_0x2569('0x25')]);}})[_0x2569('0x27')](function(_0x1072b1){logger['error'](_0x2569('0x1e'),_0x57d5eb,_0x1072b1);_0x2df903(_0x1072b1);});});}function respondWithStatusCode(_0x2d02f3,_0x329e13){_0x329e13=_0x329e13||0xcc;return function(_0x416b84){if(_0x416b84){return _0x2d02f3[_0x2569('0x28')](_0x329e13);}return _0x2d02f3['status'](_0x329e13)[_0x2569('0x29')]();};}function respondWithResult(_0x3c126b,_0x126718){_0x126718=_0x126718||0xc8;return function(_0x4322cf){if(_0x4322cf){return _0x3c126b['status'](_0x126718)['json'](_0x4322cf);}};}function respondWithFilteredResult(_0x4b9a7e,_0x37bc10){return function(_0x16b93d){if(_0x16b93d){var _0x3cb7e5=typeof _0x37bc10['offset']===_0x2569('0x2a')&&typeof _0x37bc10[_0x2569('0x2b')]==='undefined';var _0x1e7457=_0x16b93d[_0x2569('0x2c')];var _0x34e7e2=_0x3cb7e5?0x0:_0x37bc10[_0x2569('0x2d')];var _0x1e4ce6=_0x3cb7e5?_0x16b93d[_0x2569('0x2c')]:_0x37bc10[_0x2569('0x2d')]+_0x37bc10[_0x2569('0x2b')];var _0xd67d84;if(_0x1e4ce6>=_0x1e7457){_0x1e4ce6=_0x1e7457;_0xd67d84=0xc8;}else{_0xd67d84=0xce;}_0x4b9a7e[_0x2569('0x2e')](_0xd67d84);return _0x4b9a7e[_0x2569('0x2f')](_0x2569('0x30'),_0x34e7e2+'-'+_0x1e4ce6+'/'+_0x1e7457)['json'](_0x16b93d);}return null;};}function patchUpdates(_0x2d913c){return function(_0xac989c){try{jsonpatch[_0x2569('0x31')](_0xac989c,_0x2d913c,!![]);}catch(_0x1a0b24){return BPromise['reject'](_0x1a0b24);}return _0xac989c['save']();};}function saveUpdates(_0x4e1164,_0x3a43bb){return function(_0x29125d){if(_0x29125d){return _0x29125d[_0x2569('0x32')](_0x4e1164)[_0x2569('0x1c')](function(_0x30c234){return _0x30c234;});}return null;};}function removeEntity(_0x4085ae,_0x2e0e6c){return function(_0x31f509){if(_0x31f509){return _0x31f509[_0x2569('0x33')]()[_0x2569('0x1c')](function(){var _0x22e0df=_0x31f509[_0x2569('0x34')]({'plain':!![]});var _0x457603=_0x2569('0x35');return db[_0x2569('0x36')][_0x2569('0x33')]({'where':{'type':_0x457603,'resourceId':_0x22e0df['id']}})[_0x2569('0x1c')](function(){return _0x31f509;});})[_0x2569('0x1c')](function(){_0x4085ae[_0x2569('0x2e')](0xcc)[_0x2569('0x29')]();});}};}function handleEntityNotFound(_0x503ed5,_0x2115a9){return function(_0x5ec734){if(!_0x5ec734){_0x503ed5[_0x2569('0x28')](0x194);}return _0x5ec734;};}function handleError(_0x4b9b16,_0x6c8cdf){_0x6c8cdf=_0x6c8cdf||0x1f4;return function(_0x2e149a){logger[_0x2569('0x23')](_0x2e149a['stack']);if(_0x2e149a[_0x2569('0x37')]){delete _0x2e149a[_0x2569('0x37')];}_0x4b9b16[_0x2569('0x2e')](_0x6c8cdf)['send'](_0x2e149a);};}exports['index']=function(_0x3dc89d,_0x4f91a2){var _0x209836={'include':[{'model':db[_0x2569('0x38')],'as':_0x2569('0x39')}]},_0x299748={},_0x195f4c={'count':0x0,'rows':[]};var _0x4e63b6=_[_0x2569('0x3a')](db[_0x2569('0x3b')]['rawAttributes'],function(_0x47777f){return{'name':_0x47777f['fieldName'],'type':_0x47777f['type']['key']};});_0x299748[_0x2569('0x3c')]=_[_0x2569('0x3a')](_0x4e63b6,_0x2569('0x37'));_0x299748[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x3dc89d[_0x2569('0x3d')]);_0x299748[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x299748[_0x2569('0x3c')],_0x299748['query']);_0x209836['attributes']=_[_0x2569('0x40')](_0x299748[_0x2569('0x3c')],qs[_0x2569('0x41')](_0x3dc89d[_0x2569('0x3d')][_0x2569('0x41')]));_0x209836[_0x2569('0x42')]=_0x209836[_0x2569('0x42')][_0x2569('0x43')]?_0x209836[_0x2569('0x42')]:_0x299748[_0x2569('0x3c')];if(!_0x3dc89d[_0x2569('0x3d')][_0x2569('0x44')](_0x2569('0x45'))){_0x209836[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x3dc89d[_0x2569('0x3d')]['limit']);_0x209836[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x3dc89d[_0x2569('0x3d')][_0x2569('0x2d')]);}_0x209836[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x3dc89d[_0x2569('0x3d')][_0x2569('0x47')]);_0x209836[_0x2569('0x48')]=qs['filters'](_[_0x2569('0x49')](_0x3dc89d[_0x2569('0x3d')],_0x299748['filters']),_0x4e63b6);if(_0x3dc89d[_0x2569('0x3d')][_0x2569('0x4a')]){_0x209836['where']=_[_0x2569('0x4b')](_0x209836['where'],{'$or':_[_0x2569('0x3a')](_0x4e63b6,function(_0x20601b){if(_0x20601b[_0x2569('0x4c')]!==_0x2569('0x4d')){var _0x518e8c={};_0x518e8c[_0x20601b[_0x2569('0x37')]]={'$like':'%'+_0x3dc89d[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x518e8c;}})});}_0x209836=_[_0x2569('0x4b')]({},_0x209836,_0x3dc89d['options']);var _0x42f736={'where':_0x209836[_0x2569('0x48')]};return db[_0x2569('0x3b')][_0x2569('0x2c')](_0x42f736)[_0x2569('0x1c')](function(_0x5a4bd6){_0x195f4c[_0x2569('0x2c')]=_0x5a4bd6;if(_0x3dc89d[_0x2569('0x3d')]['includeAll']){_0x209836[_0x2569('0x4e')]=[{'all':!![]}];}return db[_0x2569('0x3b')][_0x2569('0x4f')](_0x209836);})['then'](function(_0x5904fe){_0x195f4c[_0x2569('0x50')]=_0x5904fe;return _0x195f4c;})['then'](respondWithFilteredResult(_0x4f91a2,_0x209836))[_0x2569('0x27')](handleError(_0x4f91a2,null));};exports['show']=function(_0x541262,_0x1e530b){var _0x557439={'raw':![],'where':{'id':_0x541262[_0x2569('0x51')]['id']},'include':[{'model':db[_0x2569('0x38')],'as':_0x2569('0x39')}]},_0x527a0f={};_0x527a0f[_0x2569('0x3c')]=_[_0x2569('0x3e')](db['OpenchannelAccount'][_0x2569('0x52')]);_0x527a0f[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x541262['query']);_0x527a0f[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x527a0f[_0x2569('0x3c')],_0x527a0f[_0x2569('0x3d')]);_0x557439['attributes']=_['intersection'](_0x527a0f[_0x2569('0x3c')],qs['fields'](_0x541262[_0x2569('0x3d')][_0x2569('0x41')]));_0x557439[_0x2569('0x42')]=_0x557439[_0x2569('0x42')][_0x2569('0x43')]?_0x557439[_0x2569('0x42')]:_0x527a0f[_0x2569('0x3c')];if(_0x541262[_0x2569('0x3d')][_0x2569('0x53')]){_0x557439['include']=[{'all':!![]}];}_0x557439=_['merge']({},_0x557439,_0x541262[_0x2569('0x54')]);return db[_0x2569('0x3b')][_0x2569('0x55')](_0x557439)['then'](handleEntityNotFound(_0x1e530b,null))[_0x2569('0x1c')](respondWithResult(_0x1e530b,null))[_0x2569('0x27')](handleError(_0x1e530b,null));};exports['create']=function(_0x5d4f54,_0x5d48b2){return db[_0x2569('0x3b')][_0x2569('0x56')](_0x5d4f54['body'],{})[_0x2569('0x1c')](function(_0x2071b6){var _0x2c2d05=_0x5d4f54[_0x2569('0x57')][_0x2569('0x34')]({'plain':!![]});if(!_0x2c2d05)throw new Error(_0x2569('0x58'));if(_0x2c2d05[_0x2569('0x59')]===_0x2569('0x57')){var _0x3337d6=_0x2071b6['get']({'plain':!![]});var _0x15b4a1='OpenchannelAccounts';return db[_0x2569('0x5a')][_0x2569('0x55')]({'where':{'name':_0x15b4a1,'userProfileId':_0x2c2d05[_0x2569('0x5b')]},'raw':!![]})[_0x2569('0x1c')](function(_0x1080e3){if(_0x1080e3&&_0x1080e3[_0x2569('0x5c')]===0x0){return db[_0x2569('0x36')][_0x2569('0x56')]({'name':_0x3337d6[_0x2569('0x37')],'resourceId':_0x3337d6['id'],'type':_0x1080e3['name'],'sectionId':_0x1080e3['id']},{})[_0x2569('0x1c')](function(){return _0x2071b6;});}else{return _0x2071b6;}})[_0x2569('0x27')](function(_0x2006d3){logger[_0x2569('0x23')](_0x2569('0x5d'),_0x2006d3);throw _0x2006d3;});}return _0x2071b6;})[_0x2569('0x1c')](respondWithResult(_0x5d48b2,0xc9))['catch'](handleError(_0x5d48b2,null));};exports[_0x2569('0x32')]=function(_0x2dca1a,_0x4a5d05){if(_0x2dca1a['body']['id']){delete _0x2dca1a[_0x2569('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2dca1a[_0x2569('0x51')]['id']},'include':[{'model':db[_0x2569('0x38')],'as':_0x2569('0x39')}]})[_0x2569('0x1c')](handleEntityNotFound(_0x4a5d05,null))[_0x2569('0x1c')](saveUpdates(_0x2dca1a[_0x2569('0x5e')],null))[_0x2569('0x1c')](respondWithResult(_0x4a5d05,null))['catch'](handleError(_0x4a5d05,null));};exports[_0x2569('0x33')]=function(_0x232ecd,_0x1df6ee){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x232ecd['params']['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x1df6ee,null))[_0x2569('0x1c')](removeEntity(_0x1df6ee,null))[_0x2569('0x27')](handleError(_0x1df6ee,null));};exports['describe']=function(_0x585080,_0x38010b){return db[_0x2569('0x3b')][_0x2569('0x5f')]()['then'](respondWithResult(_0x38010b,null))['catch'](handleError(_0x38010b,null));};exports[_0x2569('0x60')]=function(_0x2a56aa,_0x43cf8e,_0x5024af){if(_0x2a56aa[_0x2569('0x5e')]['id']){delete _0x2a56aa[_0x2569('0x5e')]['id'];}return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x2a56aa['params']['id']}})['then'](handleEntityNotFound(_0x43cf8e,null))[_0x2569('0x1c')](function(_0x352b86){if(_0x352b86){_0x2a56aa[_0x2569('0x5e')][_0x2569('0x61')]=_0x352b86['id'];return db[_0x2569('0x62')][_0x2569('0x56')](_0x2a56aa[_0x2569('0x5e')]);}})[_0x2569('0x1c')](respondWithResult(_0x43cf8e,null))[_0x2569('0x27')](handleError(_0x43cf8e,null));};exports[_0x2569('0x63')]=function(_0x46fbe4,_0xac2ab2,_0x10248f){var _0x526d50={'raw':![],'where':{}};var _0x207d3b={};var _0x5244c5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2569('0x64')]({'where':{'id':_0x46fbe4[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0xac2ab2,null))[_0x2569('0x1c')](function(_0x55a5e0){if(_0x55a5e0){_0x207d3b[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x62')][_0x2569('0x52')]);_0x207d3b[_0x2569('0x3d')]=_['keys'](_0x46fbe4[_0x2569('0x3d')]);_0x207d3b[_0x2569('0x3f')]=_['intersection'](_0x207d3b[_0x2569('0x3c')],_0x207d3b[_0x2569('0x3d')]);_0x526d50[_0x2569('0x42')]=_[_0x2569('0x40')](_0x207d3b['model'],qs['fields'](_0x46fbe4[_0x2569('0x3d')][_0x2569('0x41')]));_0x526d50['attributes']=_0x526d50[_0x2569('0x42')]['length']?_0x526d50[_0x2569('0x42')]:_0x207d3b['model'];if(!_0x46fbe4[_0x2569('0x3d')][_0x2569('0x44')](_0x2569('0x45'))){_0x526d50[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x46fbe4['query']['limit']);_0x526d50[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x46fbe4[_0x2569('0x3d')][_0x2569('0x2d')]);}_0x526d50[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x46fbe4['query']['sort']);_0x526d50[_0x2569('0x48')]=qs[_0x2569('0x3f')](_['pick'](_0x46fbe4[_0x2569('0x3d')],_0x207d3b[_0x2569('0x3f')]));_0x526d50['where']['OpenchannelAccountId']=_0x55a5e0['id'];if(_0x46fbe4[_0x2569('0x3d')][_0x2569('0x4a')]){_0x526d50[_0x2569('0x48')]=_[_0x2569('0x4b')](_0x526d50[_0x2569('0x48')],{'$or':_[_0x2569('0x3a')](_0x526d50[_0x2569('0x42')],function(_0x4fa9ff){var _0xe7eabc={};_0xe7eabc[_0x4fa9ff]={'$like':'%'+_0x46fbe4['query']['filter']+'%'};return _0xe7eabc;})});}_0x526d50=_[_0x2569('0x4b')]({},_0x526d50,_0x46fbe4[_0x2569('0x54')]);return db[_0x2569('0x62')][_0x2569('0x2c')]({'where':_0x526d50['where']})[_0x2569('0x1c')](function(_0x3da119){_0x5244c5['count']=_0x3da119;if(_0x46fbe4['query'][_0x2569('0x53')]){_0x526d50[_0x2569('0x4e')]=[{'all':!![]}];}return db[_0x2569('0x62')][_0x2569('0x4f')](_0x526d50);})[_0x2569('0x1c')](function(_0x597bfd){_0x5244c5[_0x2569('0x50')]=_0x597bfd;return _0x5244c5;});}})[_0x2569('0x1c')](respondWithFilteredResult(_0xac2ab2,_0x526d50))[_0x2569('0x27')](handleError(_0xac2ab2,null));};exports[_0x2569('0x65')]=function(_0x4f94b4,_0x3cd889,_0x2f3f09){return db[_0x2569('0x3b')]['find']({'where':{'id':_0x4f94b4['params']['id']}})['then'](handleEntityNotFound(_0x3cd889,null))[_0x2569('0x1c')](function(_0x29541c){if(_0x29541c){return _0x29541c[_0x2569('0x65')](_0x4f94b4[_0x2569('0x3d')][_0x2569('0x66')]);}})[_0x2569('0x1c')](respondWithStatusCode(_0x3cd889,null))[_0x2569('0x27')](handleError(_0x3cd889,null));};exports['addAnswer']=function(_0x2612dc,_0x405f5e,_0x1dd031){if(_0x2612dc[_0x2569('0x5e')]['id']){delete _0x2612dc[_0x2569('0x5e')]['id'];}return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x2612dc[_0x2569('0x51')]['id']}})['then'](handleEntityNotFound(_0x405f5e,null))[_0x2569('0x1c')](function(_0x55504b){if(_0x55504b){_0x2612dc[_0x2569('0x5e')][_0x2569('0x61')]=_0x55504b['id'];return db[_0x2569('0x67')][_0x2569('0x56')](_0x2612dc['body']);}})[_0x2569('0x1c')](respondWithResult(_0x405f5e,null))[_0x2569('0x27')](handleError(_0x405f5e,null));};exports['getAnswers']=function(_0x557526,_0x1184cc,_0x3b28fc){var _0x2fa88f={'raw':![],'where':{}};var _0x20891a={};var _0x4c2157={'count':0x0,'rows':[]};return db[_0x2569('0x3b')][_0x2569('0x64')]({'where':{'id':_0x557526[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x1184cc,null))[_0x2569('0x1c')](function(_0x39a3d7){if(_0x39a3d7){_0x20891a[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x67')][_0x2569('0x52')]);_0x20891a[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x557526['query']);_0x20891a[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x20891a[_0x2569('0x3c')],_0x20891a[_0x2569('0x3d')]);_0x2fa88f[_0x2569('0x42')]=_['intersection'](_0x20891a['model'],qs[_0x2569('0x41')](_0x557526[_0x2569('0x3d')][_0x2569('0x41')]));_0x2fa88f[_0x2569('0x42')]=_0x2fa88f['attributes'][_0x2569('0x43')]?_0x2fa88f[_0x2569('0x42')]:_0x20891a[_0x2569('0x3c')];if(!_0x557526['query'][_0x2569('0x44')](_0x2569('0x45'))){_0x2fa88f['limit']=qs[_0x2569('0x2b')](_0x557526[_0x2569('0x3d')][_0x2569('0x2b')]);_0x2fa88f['offset']=qs[_0x2569('0x2d')](_0x557526['query'][_0x2569('0x2d')]);}_0x2fa88f['order']=qs['sort'](_0x557526[_0x2569('0x3d')][_0x2569('0x47')]);_0x2fa88f[_0x2569('0x48')]=qs[_0x2569('0x3f')](_[_0x2569('0x49')](_0x557526['query'],_0x20891a['filters']));_0x2fa88f[_0x2569('0x48')][_0x2569('0x61')]=_0x39a3d7['id'];if(_0x557526[_0x2569('0x3d')][_0x2569('0x4a')]){_0x2fa88f[_0x2569('0x48')]=_[_0x2569('0x4b')](_0x2fa88f[_0x2569('0x48')],{'$or':_['map'](_0x2fa88f[_0x2569('0x42')],function(_0x300f17){var _0x4b42e9={};_0x4b42e9[_0x300f17]={'$like':'%'+_0x557526[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x4b42e9;})});}_0x2fa88f=_['merge']({},_0x2fa88f,_0x557526[_0x2569('0x54')]);return db[_0x2569('0x67')][_0x2569('0x2c')]({'where':_0x2fa88f[_0x2569('0x48')]})[_0x2569('0x1c')](function(_0x1ccabd){_0x4c2157[_0x2569('0x2c')]=_0x1ccabd;if(_0x557526[_0x2569('0x3d')][_0x2569('0x53')]){_0x2fa88f[_0x2569('0x4e')]=[{'all':!![]}];}return db[_0x2569('0x67')]['findAll'](_0x2fa88f);})[_0x2569('0x1c')](function(_0x57b8d8){_0x4c2157[_0x2569('0x50')]=_0x57b8d8;return _0x4c2157;});}})['then'](respondWithFilteredResult(_0x1184cc,_0x2fa88f))[_0x2569('0x27')](handleError(_0x1184cc,null));};exports['removeAnswers']=function(_0x16c6af,_0x21949b,_0x2c1631){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x16c6af[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x21949b,null))[_0x2569('0x1c')](function(_0x71291b){if(_0x71291b){return _0x71291b[_0x2569('0x68')](_0x16c6af['query']['ids']);}})[_0x2569('0x1c')](respondWithStatusCode(_0x21949b,null))[_0x2569('0x27')](handleError(_0x21949b,null));};exports['notify']=function(_0x2027b6,_0x1cb979,_0x3f56db){var _0x101418={'body':_0x2027b6[_0x2569('0x5e')],'channel':_0x2569('0x69')};var _0x1cd3c2=[];var _0x3a01a0=[];var _0x2ce7d5={};var _0x47455e=![];return db['CmContact'][_0x2569('0x5f')]()[_0x2569('0x1c')](function(_0xc3bee6){if(!_0xc3bee6){throw new db['Sequelize'][(_0x2569('0x6a'))](_0x2569('0x6b'));}_0x1cd3c2=_[_0x2569('0x6c')](_[_0x2569('0x3e')](_0xc3bee6),[_0x2569('0x6d'),'updatedAt']);_0x3a01a0=_[_0x2569('0x6c')](_['keys'](_0xc3bee6),[_0x2569('0x6d'),_0x2569('0x6e'),_0x2569('0x6f'),_0x2569('0x70')]);if(_0x2027b6[_0x2569('0x5e')]['id']){delete _0x2027b6[_0x2569('0x5e')]['id'];}if(_[_0x2569('0x71')](_0x2027b6[_0x2569('0x5e')][_0x2569('0x72')])){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x74'));}if(_[_0x2569('0x71')](_0x2027b6[_0x2569('0x5e')][_0x2569('0x5e')])||_0x2027b6['body'][_0x2569('0x5e')]===''){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x75'));}if(_[_0x2569('0x71')](_0x2027b6['body'][_0x2569('0x76')])){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a01a0);}if(!_[_0x2569('0x77')](_0x3a01a0,_0x2027b6[_0x2569('0x5e')]['mapKey'])){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x78')+_0x3a01a0);}_0x2ce7d5[_0x2027b6[_0x2569('0x5e')][_0x2569('0x76')]]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x72')];})[_0x2569('0x1c')](function(){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x2027b6[_0x2569('0x51')]['id']},'include':[{'model':db[_0x2569('0x79')],'as':_0x2569('0x7a'),'include':[{'model':db[_0x2569('0x7b')],'as':'Contacts','where':_0x2ce7d5,'limit':0x1,'order':[[_0x2569('0x6e'),'DESC']]}]},{'model':db[_0x2569('0x7c')],'as':_0x2569('0x7d')}]});})['then'](handleEntityNotFound(_0x1cb979,null))[_0x2569('0x1c')](function(_0x440e27){if(_0x440e27&&_0x440e27[_0x2569('0x7a')]){_0x101418['account']=_0x440e27;_0x101418[_0x2569('0x7e')]=_0x440e27[_0x2569('0x7d')];_0x101418[_0x2569('0x7f')]=_0x440e27['List'];_0x101418[_0x2569('0x7e')]=_[_0x2569('0x80')](_0x101418['applications'],[_0x2569('0x81')],[_0x2569('0x82')]);if(_0x101418[_0x2569('0x83')][_0x2569('0x7d')]){delete _0x101418[_0x2569('0x83')][_0x2569('0x7d')];}if(_0x101418[_0x2569('0x83')]['List']&&_0x101418[_0x2569('0x83')][_0x2569('0x7a')][_0x2569('0x84')]['length']){return _0x101418['account'][_0x2569('0x7a')][_0x2569('0x84')][0x0];}var _0x163017=_[_0x2569('0x85')](_0x2027b6['body'],{'firstName':_0x2027b6['body'][_0x2569('0x72')],'ListId':_0x440e27[_0x2569('0x70')]});_0x163017[_0x2027b6[_0x2569('0x5e')][_0x2569('0x76')]]=_0x2027b6['body'][_0x2569('0x72')];return db['CmContact'][_0x2569('0x56')](_0x163017,{'fields':_0x1cd3c2,'raw':!![]});}})['then'](handleEntityNotFound(_0x1cb979,null))[_0x2569('0x1c')](function(_0x846b3a){_0x101418['contact']=_0x846b3a;if(_0x846b3a){var _0x1578c5={'ContactId':_0x846b3a['id'],'OpenchannelAccountId':_0x2027b6[_0x2569('0x51')]['id'],'from':(_0x846b3a[_0x2569('0x86')]||'')+'\x20'+(_0x846b3a[_0x2569('0x87')]||'')};var _0x3686dc={'OpenchannelAccountId':_0x2027b6[_0x2569('0x51')]['id'],'closed':![]};if(_0x2027b6[_0x2569('0x5e')][_0x2569('0x88')]){_0x3686dc[_0x2569('0x88')]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x88')];return db[_0x2569('0x89')]['find']({'where':_0x3686dc})[_0x2569('0x1c')](function(_0x345151){if(_0x345151){return[_0x345151,![]];}_0x1578c5[_0x2569('0x88')]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x88')];_0x1578c5[_0x2569('0x8a')]=_0x2027b6['body'][_0x2569('0x8a')];return db[_0x2569('0x89')][_0x2569('0x56')](_0x1578c5)[_0x2569('0x1c')](function(_0x419e1b){return[_0x419e1b,!![]];});});}else{_0x3686dc[_0x2569('0x88')]=null;}_0x3686dc[_0x2569('0x8b')]=_0x846b3a['id'];return db[_0x2569('0x89')][_0x2569('0x55')]({'where':_0x3686dc})[_0x2569('0x1c')](function(_0x27e1ca){if(_0x27e1ca){return[_0x27e1ca,![]];}return db[_0x2569('0x89')][_0x2569('0x56')](_0x1578c5)['then'](function(_0xca5441){return[_0xca5441,!![]];});});}})['spread'](function(_0x7e445,_0x2a67bb){if(_0x7e445){_0x47455e=_0x2a67bb;if(!_0x2a67bb){var _0x565b43={'from':(_0x101418[_0x2569('0x8c')][_0x2569('0x86')]||'')+'\x20'+(_0x101418[_0x2569('0x8c')][_0x2569('0x87')]||'')};if(_0x2027b6['body']['threadId']&&_0x2027b6['body'][_0x2569('0x8d')]&&_0x2027b6['body'][_0x2569('0x88')]!=_0x2027b6['body'][_0x2569('0x8d')]){_0x565b43[_0x2569('0x88')]=_0x2027b6[_0x2569('0x5e')][_0x2569('0x8d')];}return _0x7e445[_0x2569('0x32')](_0x565b43);}else{return _0x7e445;}}})[_0x2569('0x1c')](function(_0xcbd235){_0x101418[_0x2569('0x8e')]=_0xcbd235['get']({'plain':!![]});_0x101418[_0x2569('0x8e')][_0x2569('0x8f')]=_0x47455e;if(_0x101418[_0x2569('0x8e')][_0x2569('0x8f')]){if(_0x101418[_0x2569('0x83')][_0x2569('0x90')]){_0x101418[_0x2569('0x7e')]['push']({'id':0x0,'priority':_0x101418[_0x2569('0x7e')][_0x2569('0x43')]+0x1,'app':'close','appdata':_0x2569('0x91'),'interval':_0x2569('0x92')});}}return db[_0x2569('0x93')][_0x2569('0x56')]({'body':_0x2027b6[_0x2569('0x5e')][_0x2569('0x5e')],'OpenchannelAccountId':_0x2027b6[_0x2569('0x51')]['id'],'OpenchannelInteractionId':_0xcbd235['id'],'direction':'in','ContactId':_0x101418[_0x2569('0x8c')]['id'],'AttachmentId':_0x2027b6[_0x2569('0x5e')][_0x2569('0x94')]});})[_0x2569('0x1c')](function(_0x5ac3f8){_0x101418[_0x2569('0x25')]=_0x5ac3f8;if(!_0x101418[_0x2569('0x8e')][_0x2569('0x95')])return;return db[_0x2569('0x96')]['find']({'attributes':['id',_0x2569('0x37')],'where':{'id':_0x101418['interaction'][_0x2569('0x95')]}});})[_0x2569('0x1c')](function(_0x587764){if(_0x587764){_0x101418['applications'][_0x2569('0x97')]({'id':0x0,'priority':0x0,'app':_0x2569('0x98'),'appdata':_0x587764[_0x2569('0x37')]+','+(_0x101418[_0x2569('0x83')][_0x2569('0x99')]||0xa),'interval':_0x2569('0x92')});}if(!_0x101418['interaction'][_0x2569('0x9a')])return;return db['OpenchannelQueue'][_0x2569('0x55')]({'attributes':['id',_0x2569('0x37')],'where':{'id':_0x101418['interaction'][_0x2569('0x9a')]}});})[_0x2569('0x1c')](function(_0x1142c6){if(_0x1142c6){_0x101418[_0x2569('0x7e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2569('0x9b'),'appdata':_0x1142c6[_0x2569('0x37')]+','+(_0x101418[_0x2569('0x83')][_0x2569('0x9c')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2569('0x9d'),_0x2569('0x9e'),_0x101418);})[_0x2569('0x1c')](function(_0x9514e2){respondWithRpcPromise(_0x2569('0x9f'),_0x2569('0x9f'),{'event':_0x2569('0xa0'),'message':_0x9514e2},client9002);return _0x9514e2;})[_0x2569('0x1c')](respondWithResult(_0x1cb979,null))[_0x2569('0x27')](handleError(_0x1cb979,null));};exports['addApplications']=function(_0x356fe3,_0x29f363){var _0x2e6bab=_0x356fe3[_0x2569('0x51')]['id'];var _0x2ab53e=_0x356fe3[_0x2569('0x5e')];var _0x470d1d=0xc8;var _0x5727fd=null;return db[_0x2569('0xa1')][_0x2569('0xa2')]({'isolationLevel':db['sequelize'][_0x2569('0xa3')][_0x2569('0xa4')]['READ_COMMITTED']},function(_0x11c6ad){return db['OpenchannelAccount'][_0x2569('0x64')]({'where':{'id':_0x2e6bab},'transaction':_0x11c6ad})[_0x2569('0x1c')](function(_0x28bea0){if(_0x28bea0){return db[_0x2569('0x7c')][_0x2569('0x33')]({'where':{'OpenchannelAccountId':_0x2e6bab},'transaction':_0x11c6ad})[_0x2569('0x1c')](function(){var _0x56b8f6=_['map'](_0x2ab53e,function(_0x20f1d4){_0x20f1d4[_0x2569('0x61')]=_0x2e6bab;return _0x20f1d4;});return db[_0x2569('0x7c')][_0x2569('0xa5')](_0x56b8f6,{'transaction':_0x11c6ad});});}else{_0x470d1d=0x194;_0x5727fd=[];}});})[_0x2569('0x1c')](function(){if(_0x470d1d!==0x194){return db['OpenchannelApplication'][_0x2569('0xa6')]({'where':{'OpenchannelAccountId':_0x2e6bab},'order':_0x2569('0x81')})[_0x2569('0x1c')](function(_0x3b794b){_0x5727fd=_0x3b794b;});}})[_0x2569('0x27')](function(_0x22210b){_0x470d1d=0x1f4;logger[_0x2569('0x23')](_0x22210b['stack']);if(_0x22210b[_0x2569('0x37')]){delete _0x22210b['name'];}_0x5727fd=_0x22210b;})['finally'](function(){if(_0x5727fd===null){_0x29f363['sendStatus'](_0x470d1d);}else{if(_0x470d1d===0x1f4){_0x29f363[_0x2569('0x2e')](_0x470d1d)['send'](_0x5727fd);}else{_0x29f363['status'](_0x470d1d)[_0x2569('0xa7')](_0x5727fd);}}});};exports[_0x2569('0xa8')]=function(_0x4a6ae8,_0x3a6ee4,_0x564bf0){var _0x273337={};var _0x42252d={};var _0x372a6e;var _0x405689;return db[_0x2569('0x3b')]['findOne']({'where':{'id':_0x4a6ae8[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x3a6ee4,null))[_0x2569('0x1c')](function(_0x2166c2){if(_0x2166c2){_0x372a6e=_0x2166c2;_0x42252d[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x7c')][_0x2569('0x52')]);_0x42252d[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x4a6ae8['query']);_0x42252d[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x42252d[_0x2569('0x3c')],_0x42252d['query']);_0x273337['attributes']=_[_0x2569('0x40')](_0x42252d[_0x2569('0x3c')],qs[_0x2569('0x41')](_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x41')]));_0x273337[_0x2569('0x42')]=_0x273337[_0x2569('0x42')]['length']?_0x273337[_0x2569('0x42')]:_0x42252d[_0x2569('0x3c')];_0x273337[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x47')]);_0x273337['where']=qs[_0x2569('0x3f')](_[_0x2569('0x49')](_0x4a6ae8[_0x2569('0x3d')],_0x42252d[_0x2569('0x3f')]));if(_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x4a')]){_0x273337[_0x2569('0x48')]=_['merge'](_0x273337['where'],{'$or':_[_0x2569('0x3a')](_0x273337[_0x2569('0x42')],function(_0x2fb6b8){var _0x56d1ac={};_0x56d1ac[_0x2fb6b8]={'$like':'%'+_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x56d1ac;})});}_0x273337=_[_0x2569('0x4b')]({},_0x273337,_0x4a6ae8[_0x2569('0x54')]);return _0x372a6e[_0x2569('0xa8')](_0x273337);}})['then'](function(_0x31d1d6){if(_0x31d1d6){_0x405689=_0x31d1d6[_0x2569('0x43')];if(!_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x44')](_0x2569('0x45'))){_0x273337['limit']=qs[_0x2569('0x2b')](_0x4a6ae8['query']['limit']);_0x273337[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x4a6ae8[_0x2569('0x3d')][_0x2569('0x2d')]);}return _0x372a6e[_0x2569('0xa8')](_0x273337);}})[_0x2569('0x1c')](function(_0x3c54ec){if(_0x3c54ec){return _0x3c54ec?{'count':_0x405689,'rows':_0x3c54ec}:null;}})[_0x2569('0x1c')](respondWithResult(_0x3a6ee4,null))[_0x2569('0x27')](handleError(_0x3a6ee4,null));};exports[_0x2569('0xa9')]=function(_0x5dab93,_0x5133b1,_0x5366ab){var _0x2c12e4={'raw':![],'where':{}};var _0x56c8ea={};var _0x402143={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5dab93[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x5133b1,null))[_0x2569('0x1c')](function(_0x26f226){if(_0x26f226){_0x56c8ea[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x89')][_0x2569('0x52')]);_0x56c8ea[_0x2569('0x3d')]=_[_0x2569('0x3e')](_0x5dab93[_0x2569('0x3d')]);_0x56c8ea['filters']=_[_0x2569('0x40')](_0x56c8ea[_0x2569('0x3c')],_0x56c8ea[_0x2569('0x3d')]);_0x2c12e4[_0x2569('0x42')]=_[_0x2569('0x40')](_0x56c8ea[_0x2569('0x3c')],qs['fields'](_0x5dab93['query'][_0x2569('0x41')]));_0x2c12e4['attributes']=_0x2c12e4['attributes'][_0x2569('0x43')]?_0x2c12e4[_0x2569('0x42')]:_0x56c8ea[_0x2569('0x3c')];if(!_0x5dab93[_0x2569('0x3d')][_0x2569('0x44')]('nolimit')){_0x2c12e4[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x5dab93[_0x2569('0x3d')][_0x2569('0x2b')]);_0x2c12e4[_0x2569('0x2d')]=qs['offset'](_0x5dab93[_0x2569('0x3d')]['offset']);}_0x2c12e4['order']=qs[_0x2569('0x47')](_0x5dab93[_0x2569('0x3d')][_0x2569('0x47')]);_0x2c12e4[_0x2569('0x48')]=qs[_0x2569('0x3f')](_['pick'](_0x5dab93[_0x2569('0x3d')],_0x56c8ea['filters']));_0x2c12e4[_0x2569('0x48')][_0x2569('0x61')]=_0x26f226['id'];if(_0x5dab93[_0x2569('0x3d')][_0x2569('0x4a')]){_0x2c12e4[_0x2569('0x48')]=_[_0x2569('0x4b')](_0x2c12e4[_0x2569('0x48')],{'$or':_['map'](_0x2c12e4[_0x2569('0x42')],function(_0x349839){var _0x28d3ab={};_0x28d3ab[_0x349839]={'$like':'%'+_0x5dab93[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x28d3ab;})});}_0x2c12e4=_[_0x2569('0x4b')]({},_0x2c12e4,_0x5dab93[_0x2569('0x54')]);return db[_0x2569('0x89')][_0x2569('0x2c')]({'where':_0x2c12e4[_0x2569('0x48')]})[_0x2569('0x1c')](function(_0x45e703){_0x402143['count']=_0x45e703;if(_0x5dab93[_0x2569('0x3d')][_0x2569('0x53')]){_0x2c12e4['include']=[{'model':db[_0x2569('0x7b')],'as':_0x2569('0xaa'),'required':![]},{'model':db[_0x2569('0x96')],'as':'Owner','attributes':[_0x2569('0x37'),_0x2569('0xab'),'internal'],'required':![]},{'model':db[_0x2569('0xac')],'as':_0x2569('0xad'),'attributes':['id',_0x2569('0x37'),_0x2569('0xae')],'where':_0x5dab93[_0x2569('0x3d')][_0x2569('0xaf')]?{'id':_0x5dab93['query'][_0x2569('0xaf')]}:undefined,'required':_0x5dab93[_0x2569('0x3d')][_0x2569('0xaf')]?!![]:![]}];}return db[_0x2569('0x89')][_0x2569('0x4f')](_0x2c12e4);})[_0x2569('0x1c')](function(_0x1c95b6){_0x402143[_0x2569('0x50')]=_0x1c95b6;return _0x402143;});}})[_0x2569('0x1c')](respondWithFilteredResult(_0x5133b1,_0x2c12e4))[_0x2569('0x27')](handleError(_0x5133b1,null));};exports[_0x2569('0xb0')]=function(_0x59ae7d,_0x2a2e5d,_0x3e7556){return db['OpenchannelAccount'][_0x2569('0x55')]({'where':{'id':_0x59ae7d[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x2a2e5d,null))[_0x2569('0x1c')](function(_0x1795da){if(_0x1795da){return _0x1795da[_0x2569('0xb0')](_0x59ae7d[_0x2569('0x5e')][_0x2569('0x66')],_[_0x2569('0xb1')](_0x59ae7d[_0x2569('0x5e')],['ids','id'])||{})[_0x2569('0xb2')](function(_0x31c463){for(var _0x5c4029=0x0;_0x5c4029<_0x59ae7d['body'][_0x2569('0x66')][_0x2569('0x43')];_0x5c4029+=0x1){socket[_0x2569('0xb3')](_0x2569('0xb4'),{'UserId':Number(_0x59ae7d[_0x2569('0x5e')][_0x2569('0x66')][_0x5c4029]),'OpenchannelAccountId':Number(_0x59ae7d[_0x2569('0x51')]['id'])});}return _0x31c463;});}})[_0x2569('0x1c')](respondWithResult(_0x2a2e5d,null))['catch'](handleError(_0x2a2e5d,null));};exports[_0x2569('0xb5')]=function(_0x45b34d,_0x5cbc46,_0x4b4068){return db[_0x2569('0x3b')][_0x2569('0x55')]({'where':{'id':_0x45b34d[_0x2569('0x51')]['id']}})['then'](handleEntityNotFound(_0x5cbc46,null))[_0x2569('0x1c')](function(_0x4baa28){if(_0x4baa28){return _0x4baa28[_0x2569('0xb5')](_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')])['then'](function(){if(_[_0x2569('0xb6')](_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')])){for(var _0x13351a=0x0;_0x13351a<_0x45b34d['query'][_0x2569('0x66')][_0x2569('0x43')];_0x13351a+=0x1){socket[_0x2569('0xb3')](_0x2569('0xb7'),{'UserId':Number(_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')][_0x13351a]),'OpenchannelAccountId':Number(_0x45b34d[_0x2569('0x51')]['id'])});}}else{socket[_0x2569('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x45b34d[_0x2569('0x3d')][_0x2569('0x66')]),'OpenchannelAccountId':Number(_0x45b34d[_0x2569('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x5cbc46,null))[_0x2569('0x27')](handleError(_0x5cbc46,null));};exports['getAgents']=function(_0x484428,_0x125726,_0x48530c){var _0x1a6615={};var _0x1d8ead={};var _0x279953;var _0x83a47c;return db[_0x2569('0x3b')][_0x2569('0x64')]({'where':{'id':_0x484428['params']['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x125726,null))[_0x2569('0x1c')](function(_0x2531a9){if(_0x2531a9){_0x279953=_0x2531a9;_0x1d8ead[_0x2569('0x3c')]=_[_0x2569('0x3e')](db[_0x2569('0x96')][_0x2569('0x52')]);_0x1d8ead[_0x2569('0x3d')]=_['keys'](_0x484428[_0x2569('0x3d')]);_0x1d8ead[_0x2569('0x3f')]=_[_0x2569('0x40')](_0x1d8ead[_0x2569('0x3c')],_0x1d8ead['query']);_0x1a6615[_0x2569('0x42')]=_['intersection'](_0x1d8ead[_0x2569('0x3c')],qs[_0x2569('0x41')](_0x484428[_0x2569('0x3d')][_0x2569('0x41')]));_0x1a6615['attributes']=_0x1a6615['attributes'][_0x2569('0x43')]?_0x1a6615[_0x2569('0x42')]:_0x1d8ead[_0x2569('0x3c')];_0x1a6615[_0x2569('0x46')]=qs[_0x2569('0x47')](_0x484428[_0x2569('0x3d')]['sort']);_0x1a6615[_0x2569('0x48')]=qs[_0x2569('0x3f')](_[_0x2569('0x49')](_0x484428[_0x2569('0x3d')],_0x1d8ead[_0x2569('0x3f')]));if(_0x484428['query']['filter']){_0x1a6615[_0x2569('0x48')]=_['merge'](_0x1a6615['where'],{'$or':_[_0x2569('0x3a')](_0x1a6615[_0x2569('0x42')],function(_0x11b718){var _0x305662={};_0x305662[_0x11b718]={'$like':'%'+_0x484428[_0x2569('0x3d')][_0x2569('0x4a')]+'%'};return _0x305662;})});}_0x1a6615=_['merge']({},_0x1a6615,_0x484428[_0x2569('0x54')]);return _0x279953[_0x2569('0xb8')](_0x1a6615);}})['then'](function(_0x1f27a3){if(_0x1f27a3){_0x83a47c=_0x1f27a3[_0x2569('0x43')];if(!_0x484428['query']['hasOwnProperty']('nolimit')){_0x1a6615[_0x2569('0x2b')]=qs[_0x2569('0x2b')](_0x484428['query'][_0x2569('0x2b')]);_0x1a6615[_0x2569('0x2d')]=qs[_0x2569('0x2d')](_0x484428[_0x2569('0x3d')]['offset']);}return _0x279953[_0x2569('0xb8')](_0x1a6615);}})['then'](function(_0x50fba3){if(_0x50fba3){return _0x50fba3?{'count':_0x83a47c,'rows':_0x50fba3}:null;}})['then'](respondWithResult(_0x125726,null))[_0x2569('0x27')](handleError(_0x125726,null));};exports['send']=function(_0x378558,_0x37ad24,_0x2bc328){var _0x9eee57,_0x2064b7,_0x9eae1c;if(_[_0x2569('0x71')](_0x378558[_0x2569('0x5e')][_0x2569('0x5e')])||_0x378558[_0x2569('0x5e')][_0x2569('0x5e')]===''){throw new db[(_0x2569('0x73'))][(_0x2569('0x6a'))](_0x2569('0x75'));}if(_['isNil'](_0x378558[_0x2569('0x5e')]['to'])){}_0x9eee57=_0x378558['body']['to'];return db[_0x2569('0x3b')][_0x2569('0x64')]({'where':{'id':_0x378558[_0x2569('0x51')]['id']}})[_0x2569('0x1c')](handleEntityNotFound(_0x37ad24,null))['then'](function(_0x3c2a0a){if(_0x3c2a0a){return db['OpenchannelAccount'][_0x2569('0x55')]({'where':{'id':_0x3c2a0a['id']},'include':[{'model':db[_0x2569('0x79')],'as':_0x2569('0x7a'),'include':[{'model':db['CmContact'],'as':_0x2569('0x84'),'where':{[_0x3c2a0a[_0x2569('0x76')]]:_0x9eee57},'limit':0x1,'order':[[_0x2569('0x6e'),_0x2569('0xb9')]]}]}]})[_0x2569('0x1c')](handleEntityNotFound(_0x37ad24,null))[_0x2569('0x1c')](function(_0x57d844){if(_0x57d844&&_0x57d844[_0x2569('0x7a')]){_0x2064b7=_0x57d844[_0x2569('0x34')]({'plain':!![]});if(_0x2064b7[_0x2569('0x7a')]&&_0x2064b7[_0x2569('0x7a')][_0x2569('0x84')]['length']){return _0x2064b7[_0x2569('0x7a')][_0x2569('0x84')][0x0];}return db[_0x2569('0x7b')][_0x2569('0x56')](_['defaults'](_0x378558[_0x2569('0x5e')],{'firstName':_0x9eee57,[_0x57d844[_0x2569('0x76')]]:_0x9eee57,'phone':_0x9eee57,'ListId':_0x2064b7[_0x2569('0x70')]}));}})['then'](handleEntityNotFound(_0x37ad24,null))[_0x2569('0x1c')](function(_0x62ab72){if(_0x62ab72){_0x9eae1c=_0x62ab72;return db[_0x2569('0x89')][_0x2569('0x55')]({'where':{'ContactId':_0x9eae1c['id'],'closed':![],'OpenchannelAccountId':_0x2064b7['id']}})[_0x2569('0x1c')](function(_0x101705){if(_0x101705){return[_0x101705,![]];}return db[_0x2569('0x89')][_0x2569('0x56')]({'UserId':_0x378558[_0x2569('0x57')]['id'],'ContactId':_0x9eae1c['id'],'OpenchannelAccountId':_0x2064b7['id'],'lastMsgDirection':_0x2569('0xba'),'firstMsgDirection':_0x2569('0xba'),'Messages':[_[_0x2569('0x4b')](_0x378558[_0x2569('0x5e')],{'read':![],'body':_0x378558[_0x2569('0x5e')]['body'],'OpenchannelAccountId':_0x2064b7['id'],'UserId':_0x378558[_0x2569('0x57')]['id'],'ContactId':_0x9eae1c['id']})]},{'include':[{'model':db[_0x2569('0x93')],'as':_0x2569('0xbb')}]})[_0x2569('0x1c')](function(_0x7c8344){return[_0x7c8344,!![]];});});}})[_0x2569('0xb2')](function(_0x231aa5,_0x59bb5e){if(_0x59bb5e){return _0x231aa5;}return db[_0x2569('0x93')][_0x2569('0x56')](_['merge'](_0x378558['body'],{'read':![],'body':_0x378558['body'][_0x2569('0x5e')],'OpenchannelAccountId':_0x2064b7['id'],'OpenchannelInteractionId':_0x231aa5['id'],'UserId':_0x378558[_0x2569('0x57')]['id'],'ContactId':_0x9eae1c['id']}))['then'](function(_0x3a012e){_0x231aa5[_0x2569('0xbc')][_0x2569('0xbb')]=[];_0x231aa5[_0x2569('0xbc')][_0x2569('0xbb')][_0x2569('0xbd')](_0x3a012e[_0x2569('0xbc')]);return _0x231aa5;});});}})[_0x2569('0x1c')](respondWithResult(_0x37ad24,null))[_0x2569('0x27')](handleError(_0x37ad24,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 26b581d..a4d5234 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 _0xe5b5=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2172b7,_0xb70143){var _0x9fb700=function(_0x56299b){while(--_0x56299b){_0x2172b7['push'](_0x2172b7['shift']());}};_0x9fb700(++_0xb70143);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0xe5b5[_0x3a0863];return _0x85c557;};'use strict';var EventEmitter=require(_0x5e5b('0x0'));var OpenchannelAccount=require(_0x5e5b('0x1'))['db'][_0x5e5b('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5e5b('0x3')](0x0);var events={'afterCreate':_0x5e5b('0x4'),'afterUpdate':_0x5e5b('0x5'),'afterDestroy':_0x5e5b('0x6')};function emitEvent(_0x3dc763){return function(_0xf20c6a,_0x20a50c,_0xdc6616){OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763+':'+_0xf20c6a['id'],_0xf20c6a);OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763,_0xf20c6a);_0xdc6616(null);};}for(var e in events){if(events[_0x5e5b('0x8')](e)){var event=events[e];OpenchannelAccount[_0x5e5b('0x9')](e,emitEvent(event));}}module[_0x5e5b('0xa')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2858bd,_0x169bc2){var _0x4d3493=function(_0x6232f5){while(--_0x6232f5){_0x2858bd['push'](_0x2858bd['shift']());}};_0x4d3493(++_0x169bc2);}(_0x878f,0x173));var _0xf878=function(_0x55a030,_0x460cbd){_0x55a030=_0x55a030-0x0;var _0x1c5fc7=_0x878f[_0x55a030];return _0x1c5fc7;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d2ab3a2..5ff1412 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(_0x5e36a0,_0x52ce68){var _0x1e37df=function(_0x15d71d){while(--_0x15d71d){_0x5e36a0['push'](_0x5e36a0['shift']());}};_0x1e37df(++_0x52ce68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x3ec0c2,_0x5c7846){var _0x3d12a3=function(_0xbca893){while(--_0xbca893){_0x3ec0c2['push'](_0x3ec0c2['shift']());}};_0x3d12a3(++_0x5c7846);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 5ab4035..b71d140 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 _0x8130=['redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x51cc4c,_0x43b7ca){var _0xf0ea21=function(_0x11fe98){while(--_0x11fe98){_0x51cc4c['push'](_0x51cc4c['shift']());}};_0xf0ea21(++_0x43b7ca);}(_0x8130,0x146));var _0x0813=function(_0x4b969f,_0x2a23f3){_0x4b969f=_0x4b969f-0x0;var _0x429611=_0x8130[_0x4b969f];return _0x429611;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});config[_0x0813('0xa')]=_[_0x0813('0xb')](config[_0x0813('0xa')],{'host':_0x0813('0xc'),'port':0x18eb});var socket=require(_0x0813('0xd'))(new Redis(config[_0x0813('0xa')]));require('./openchannelAccount.socket')[_0x0813('0xe')](socket);function respondWithRpcPromise(_0x1815be,_0x251ca8,_0x5a9c5e){return new BPromise(function(_0x5550c8,_0x15f8d6){return client['request'](_0x1815be,_0x5a9c5e)[_0x0813('0xf')](function(_0x5b54ec){logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));logger[_0x0813('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x251ca8,'request\x20sent',JSON[_0x0813('0x14')](_0x5b54ec));if(_0x5b54ec[_0x0813('0x15')]){if(_0x5b54ec['error'][_0x0813('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x15f8d6(_0x5b54ec['error'][_0x0813('0x17')]);}logger['error'](_0x0813('0x11'),_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x5550c8(_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);}else{logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));_0x5550c8(_0x5b54ec['result'][_0x0813('0x17')]);}})['catch'](function(_0x112720){logger[_0x0813('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x251ca8,_0x112720);_0x15f8d6(_0x112720);});});} \ No newline at end of file +var _0x0bb5=['redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1afb1b,_0x178e18){var _0x55004d=function(_0x4b56c6){while(--_0x4b56c6){_0x1afb1b['push'](_0x1afb1b['shift']());}};_0x55004d(++_0x178e18);}(_0x0bb5,0x148));var _0x50bb=function(_0x30cfaf,_0x1dedc8){_0x30cfaf=_0x30cfaf-0x0;var _0x28d832=_0x0bb5[_0x30cfaf];return _0x28d832;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x50bb('0xa')]=_[_0x50bb('0xb')](config[_0x50bb('0xa')],{'host':_0x50bb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x50bb('0xd'))[_0x50bb('0xe')](socket);function respondWithRpcPromise(_0x3ae598,_0x239a89,_0x5512e1){return new BPromise(function(_0x36f7a1,_0x2edeeb){return client[_0x50bb('0xf')](_0x3ae598,_0x5512e1)[_0x50bb('0x10')](function(_0x346422){logger[_0x50bb('0x11')](_0x50bb('0x12'),_0x239a89,'request\x20sent');logger[_0x50bb('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x239a89,_0x50bb('0x14'),JSON[_0x50bb('0x15')](_0x346422));if(_0x346422[_0x50bb('0x16')]){if(_0x346422['error'][_0x50bb('0x17')]===0x1f4){logger[_0x50bb('0x16')](_0x50bb('0x12'),_0x239a89,_0x346422['error'][_0x50bb('0x18')]);return _0x2edeeb(_0x346422['error'][_0x50bb('0x18')]);}logger[_0x50bb('0x16')](_0x50bb('0x12'),_0x239a89,_0x346422[_0x50bb('0x16')][_0x50bb('0x18')]);return _0x36f7a1(_0x346422['error'][_0x50bb('0x18')]);}else{logger[_0x50bb('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x239a89,_0x50bb('0x14'));_0x36f7a1(_0x346422['result'][_0x50bb('0x18')]);}})[_0x50bb('0x19')](function(_0x4b06f5){logger['error'](_0x50bb('0x12'),_0x239a89,_0x4b06f5);_0x2edeeb(_0x4b06f5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9cf7c79..4bfd7b7 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 _0xb49a=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x4823bf,_0x4be2f8){var _0x577620=function(_0x28ae4e){while(--_0x28ae4e){_0x4823bf['push'](_0x4823bf['shift']());}};_0x577620(++_0x4be2f8);}(_0xb49a,0xfb));var _0xab49=function(_0x5ab653,_0x2b8dba){_0x5ab653=_0x5ab653-0x0;var _0x37b593=_0xb49a[_0x5ab653];return _0x37b593;};'use strict';var OpenchannelAccountEvents=require(_0xab49('0x0'));var events=[_0xab49('0x1'),_0xab49('0x2'),_0xab49('0x3')];function createListener(_0x8db649,_0x55d01b){return function(_0x4387a5){_0x55d01b[_0xab49('0x4')](_0x8db649,_0x4387a5);};}function removeListener(_0x5554fe,_0x543eb0){return function(){OpenchannelAccountEvents[_0xab49('0x5')](_0x5554fe,_0x543eb0);};}exports[_0xab49('0x6')]=function(_0x1cae1d){for(var _0x3703cb=0x0,_0x57ea72=events[_0xab49('0x7')];_0x3703cb<_0x57ea72;_0x3703cb++){var _0xd86a5=events[_0x3703cb];var _0x4d4d00=createListener(_0xab49('0x8')+_0xd86a5,_0x1cae1d);OpenchannelAccountEvents['on'](_0xd86a5,_0x4d4d00);}}; \ No newline at end of file +var _0xfa12=['register','openchannelAccount:','./openchannelAccount.events','save','update','removeListener'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x429735,_0x4db24b){_0x429735=_0x429735-0x0;var _0x470d06=_0xfa12[_0x429735];return _0x470d06;};'use strict';var OpenchannelAccountEvents=require(_0x2fa1('0x0'));var events=[_0x2fa1('0x1'),'remove',_0x2fa1('0x2')];function createListener(_0x1d3d90,_0x1abe62){return function(_0x877ea9){_0x1abe62['emit'](_0x1d3d90,_0x877ea9);};}function removeListener(_0x2022bf,_0x358fe1){return function(){OpenchannelAccountEvents[_0x2fa1('0x3')](_0x2022bf,_0x358fe1);};}exports[_0x2fa1('0x4')]=function(_0x4d61b0){for(var _0x166949=0x0,_0x25b233=events['length'];_0x166949<_0x25b233;_0x166949++){var _0x3449c3=events[_0x166949];var _0x30a897=createListener(_0x2fa1('0x5')+_0x3449c3,_0x4d61b0);OpenchannelAccountEvents['on'](_0x3449c3,_0x30a897);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index dd0b3a1..ee8e520 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 _0x7ddb=['destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x4bc846,_0x10ab59){var _0x1265a8=function(_0x471df0){while(--_0x471df0){_0x4bc846['push'](_0x4bc846['shift']());}};_0x1265a8(++_0x10ab59);}(_0x7ddb,0xd9));var _0xb7dd=function(_0x3aabf5,_0x822075){_0x3aabf5=_0x3aabf5-0x0;var _0x4b5fa6=_0x7ddb[_0x3aabf5];return _0x4b5fa6;};'use strict';var multer=require(_0xb7dd('0x0'));var util=require(_0xb7dd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb7dd('0x2'));var router=express[_0xb7dd('0x3')]();var fs_extra=require(_0xb7dd('0x4'));var auth=require(_0xb7dd('0x5'));var interaction=require(_0xb7dd('0x6'));var config=require(_0xb7dd('0x7'));var controller=require(_0xb7dd('0x8'));router[_0xb7dd('0x9')]('/',auth[_0xb7dd('0xa')](),controller['index']);router['get'](_0xb7dd('0xb'),auth[_0xb7dd('0xa')](),controller[_0xb7dd('0xc')]);router[_0xb7dd('0xd')]('/',auth[_0xb7dd('0xa')](),controller[_0xb7dd('0xe')]);router[_0xb7dd('0xf')](_0xb7dd('0xb'),auth[_0xb7dd('0xa')](),controller[_0xb7dd('0x10')]);router['delete'](_0xb7dd('0xb'),auth[_0xb7dd('0xa')](),controller[_0xb7dd('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe70b=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','/:id','isAuthenticated','post','create','put','delete'];(function(_0x3cddd8,_0x4706a8){var _0x592f06=function(_0x115345){while(--_0x115345){_0x3cddd8['push'](_0x3cddd8['shift']());}};_0x592f06(++_0x4706a8);}(_0xe70b,0x178));var _0xbe70=function(_0x15503f,_0x5af8c0){_0x15503f=_0x15503f-0x0;var _0x391ee0=_0xe70b[_0x15503f];return _0x391ee0;};'use strict';var multer=require(_0xbe70('0x0'));var util=require(_0xbe70('0x1'));var path=require(_0xbe70('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe70('0x3'));var router=express[_0xbe70('0x4')]();var fs_extra=require(_0xbe70('0x5'));var auth=require(_0xbe70('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe70('0x7'));var controller=require(_0xbe70('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbe70('0x9'),auth[_0xbe70('0xa')](),controller['show']);router[_0xbe70('0xb')]('/',auth['isAuthenticated'](),controller[_0xbe70('0xc')]);router[_0xbe70('0xd')](_0xbe70('0x9'),auth[_0xbe70('0xa')](),controller['update']);router[_0xbe70('0xe')](_0xbe70('0x9'),auth[_0xbe70('0xa')](),controller[_0xbe70('0xf')]);module[_0xbe70('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ffb20d0..33a8170 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 _0x71ca=['*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x71ca,0xa1));var _0xa71c=function(_0x37b638,_0x2511bb){_0x37b638=_0x37b638-0x0;var _0x114f11=_0x71ca[_0x37b638];return _0x114f11;};'use strict';var Sequelize=require(_0xa71c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa71c('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa71c('0x2')]},'interval':{'type':Sequelize[_0xa71c('0x2')],'defaultValue':_0xa71c('0x3')}}; \ No newline at end of file +var _0xe1c4=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x41174e,_0x57bce3){var _0x1233b7=function(_0x248456){while(--_0x248456){_0x41174e['push'](_0x41174e['shift']());}};_0x1233b7(++_0x57bce3);}(_0xe1c4,0x12f));var _0x4e1c=function(_0x2744b3,_0x4ca3e8){_0x2744b3=_0x2744b3-0x0;var _0x3f4087=_0xe1c4[_0x2744b3];return _0x3f4087;};'use strict';var Sequelize=require(_0x4e1c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4e1c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4e1c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4e1c('0x3')]()},'description':{'type':Sequelize[_0x4e1c('0x2')]},'interval':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':_0x4e1c('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e6be642..fd49c99 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 _0x95ef=['zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','OpenchannelApplication','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','params','rawAttributes','find','create','body','destroy','eml-format','rimraf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x95ef,0x1e8));var _0xf95e=function(_0x11739b,_0x23171f){_0x11739b=_0x11739b-0x0;var _0x154492=_0x95ef[_0x11739b];return _0x154492;};'use strict';var emlformat=require(_0xf95e('0x0'));var rimraf=require(_0xf95e('0x1'));var zipdir=require(_0xf95e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf95e('0x3'));var moment=require(_0xf95e('0x4'));var BPromise=require(_0xf95e('0x5'));var Mustache=require(_0xf95e('0x6'));var util=require('util');var path=require(_0xf95e('0x7'));var sox=require('sox');var csv=require(_0xf95e('0x8'));var ejs=require(_0xf95e('0x9'));var fs=require('fs');var fs_extra=require(_0xf95e('0xa'));var _=require(_0xf95e('0xb'));var squel=require('squel');var crypto=require(_0xf95e('0xc'));var jsforce=require(_0xf95e('0xd'));var deskjs=require(_0xf95e('0xe'));var toCsv=require(_0xf95e('0x8'));var querystring=require(_0xf95e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf95e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf95e('0x11'));var as=require(_0xf95e('0x12'));var hardwareService=require(_0xf95e('0x13'));var logger=require(_0xf95e('0x14'))(_0xf95e('0x15'));var utils=require(_0xf95e('0x16'));var config=require(_0xf95e('0x17'));var licenseUtil=require(_0xf95e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0d44,_0x5325aa){_0x5325aa=_0x5325aa||0xcc;return function(_0x35946f){if(_0x35946f){return _0x3a0d44['sendStatus'](_0x5325aa);}return _0x3a0d44[_0xf95e('0x19')](_0x5325aa)[_0xf95e('0x1a')]();};}function respondWithResult(_0x38b611,_0x5cd74a){_0x5cd74a=_0x5cd74a||0xc8;return function(_0x199a95){if(_0x199a95){return _0x38b611['status'](_0x5cd74a)[_0xf95e('0x1b')](_0x199a95);}};}function respondWithFilteredResult(_0x4f5304,_0x11afea){return function(_0x4cc47f){if(_0x4cc47f){var _0x9fe415=typeof _0x11afea[_0xf95e('0x1c')]===_0xf95e('0x1d')&&typeof _0x11afea[_0xf95e('0x1e')]===_0xf95e('0x1d');var _0x1e9395=_0x4cc47f[_0xf95e('0x1f')];var _0x13fd7a=_0x9fe415?0x0:_0x11afea[_0xf95e('0x1c')];var _0xf67489=_0x9fe415?_0x4cc47f[_0xf95e('0x1f')]:_0x11afea[_0xf95e('0x1c')]+_0x11afea['limit'];var _0x3921ad;if(_0xf67489>=_0x1e9395){_0xf67489=_0x1e9395;_0x3921ad=0xc8;}else{_0x3921ad=0xce;}_0x4f5304['status'](_0x3921ad);return _0x4f5304[_0xf95e('0x20')](_0xf95e('0x21'),_0x13fd7a+'-'+_0xf67489+'/'+_0x1e9395)[_0xf95e('0x1b')](_0x4cc47f);}return null;};}function patchUpdates(_0x129d19){return function(_0x299583){try{jsonpatch['apply'](_0x299583,_0x129d19,!![]);}catch(_0x155bd6){return BPromise[_0xf95e('0x22')](_0x155bd6);}return _0x299583['save']();};}function saveUpdates(_0x3ba0a6,_0x44a303){return function(_0x4788e4){if(_0x4788e4){return _0x4788e4[_0xf95e('0x23')](_0x3ba0a6)[_0xf95e('0x24')](function(_0x4ffcb5){return _0x4ffcb5;});}return null;};}function removeEntity(_0x45d171,_0x411007){return function(_0x4a5a27){if(_0x4a5a27){return _0x4a5a27['destroy']()[_0xf95e('0x24')](function(){_0x45d171[_0xf95e('0x19')](0xcc)[_0xf95e('0x1a')]();});}};}function handleEntityNotFound(_0x297916,_0x252afe){return function(_0x1ffe7e){if(!_0x1ffe7e){_0x297916['sendStatus'](0x194);}return _0x1ffe7e;};}function handleError(_0x1ab56b,_0x23a985){_0x23a985=_0x23a985||0x1f4;return function(_0x110088){logger[_0xf95e('0x25')](_0x110088[_0xf95e('0x26')]);if(_0x110088[_0xf95e('0x27')]){delete _0x110088[_0xf95e('0x27')];}_0x1ab56b['status'](_0x23a985)[_0xf95e('0x28')](_0x110088);};}exports[_0xf95e('0x29')]=function(_0x444d9a,_0x1a9a56){var _0x161715={},_0x33caef={},_0x6d93d6={'count':0x0,'rows':[]};var _0x75fa5a=_['map'](db[_0xf95e('0x2a')]['rawAttributes'],function(_0x55951d){return{'name':_0x55951d['fieldName'],'type':_0x55951d[_0xf95e('0x2b')]['key']};});_0x33caef[_0xf95e('0x2c')]=_[_0xf95e('0x2d')](_0x75fa5a,_0xf95e('0x27'));_0x33caef[_0xf95e('0x2e')]=_[_0xf95e('0x2f')](_0x444d9a['query']);_0x33caef[_0xf95e('0x30')]=_[_0xf95e('0x31')](_0x33caef[_0xf95e('0x2c')],_0x33caef[_0xf95e('0x2e')]);_0x161715[_0xf95e('0x32')]=_[_0xf95e('0x31')](_0x33caef[_0xf95e('0x2c')],qs[_0xf95e('0x33')](_0x444d9a[_0xf95e('0x2e')][_0xf95e('0x33')]));_0x161715[_0xf95e('0x32')]=_0x161715[_0xf95e('0x32')][_0xf95e('0x34')]?_0x161715[_0xf95e('0x32')]:_0x33caef[_0xf95e('0x2c')];if(!_0x444d9a[_0xf95e('0x2e')][_0xf95e('0x35')]('nolimit')){_0x161715[_0xf95e('0x1e')]=qs[_0xf95e('0x1e')](_0x444d9a[_0xf95e('0x2e')]['limit']);_0x161715[_0xf95e('0x1c')]=qs['offset'](_0x444d9a[_0xf95e('0x2e')][_0xf95e('0x1c')]);}_0x161715[_0xf95e('0x36')]=qs[_0xf95e('0x37')](_0x444d9a[_0xf95e('0x2e')][_0xf95e('0x37')]);_0x161715[_0xf95e('0x38')]=qs[_0xf95e('0x30')](_[_0xf95e('0x39')](_0x444d9a[_0xf95e('0x2e')],_0x33caef[_0xf95e('0x30')]),_0x75fa5a);if(_0x444d9a[_0xf95e('0x2e')][_0xf95e('0x3a')]){_0x161715['where']=_[_0xf95e('0x3b')](_0x161715[_0xf95e('0x38')],{'$or':_['map'](_0x75fa5a,function(_0x16c917){if(_0x16c917[_0xf95e('0x2b')]!==_0xf95e('0x3c')){var _0x14174f={};_0x14174f[_0x16c917[_0xf95e('0x27')]]={'$like':'%'+_0x444d9a[_0xf95e('0x2e')][_0xf95e('0x3a')]+'%'};return _0x14174f;}})});}_0x161715=_['merge']({},_0x161715,_0x444d9a[_0xf95e('0x3d')]);var _0x31718e={'where':_0x161715['where']};return db['OpenchannelApplication'][_0xf95e('0x1f')](_0x31718e)['then'](function(_0xe77f33){_0x6d93d6[_0xf95e('0x1f')]=_0xe77f33;if(_0x444d9a['query']['includeAll']){_0x161715[_0xf95e('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x161715);})[_0xf95e('0x24')](function(_0x5696ed){_0x6d93d6['rows']=_0x5696ed;return _0x6d93d6;})[_0xf95e('0x24')](respondWithFilteredResult(_0x1a9a56,_0x161715))[_0xf95e('0x3f')](handleError(_0x1a9a56,null));};exports['show']=function(_0x5b2f4e,_0x18237c){var _0x5b6cf9={'raw':!![],'where':{'id':_0x5b2f4e[_0xf95e('0x40')]['id']}},_0x78f781={};_0x78f781[_0xf95e('0x2c')]=_[_0xf95e('0x2f')](db[_0xf95e('0x2a')][_0xf95e('0x41')]);_0x78f781[_0xf95e('0x2e')]=_['keys'](_0x5b2f4e[_0xf95e('0x2e')]);_0x78f781[_0xf95e('0x30')]=_[_0xf95e('0x31')](_0x78f781['model'],_0x78f781['query']);_0x5b6cf9[_0xf95e('0x32')]=_[_0xf95e('0x31')](_0x78f781[_0xf95e('0x2c')],qs['fields'](_0x5b2f4e['query'][_0xf95e('0x33')]));_0x5b6cf9[_0xf95e('0x32')]=_0x5b6cf9['attributes'][_0xf95e('0x34')]?_0x5b6cf9[_0xf95e('0x32')]:_0x78f781[_0xf95e('0x2c')];if(_0x5b2f4e[_0xf95e('0x2e')]['includeAll']){_0x5b6cf9['include']=[{'all':!![]}];}_0x5b6cf9=_[_0xf95e('0x3b')]({},_0x5b6cf9,_0x5b2f4e[_0xf95e('0x3d')]);return db[_0xf95e('0x2a')][_0xf95e('0x42')](_0x5b6cf9)['then'](handleEntityNotFound(_0x18237c,null))[_0xf95e('0x24')](respondWithResult(_0x18237c,null))['catch'](handleError(_0x18237c,null));};exports[_0xf95e('0x43')]=function(_0x34928d,_0x2223cb){return db['OpenchannelApplication'][_0xf95e('0x43')](_0x34928d[_0xf95e('0x44')],{})['then'](respondWithResult(_0x2223cb,0xc9))[_0xf95e('0x3f')](handleError(_0x2223cb,null));};exports[_0xf95e('0x23')]=function(_0x482845,_0x28fee9){if(_0x482845[_0xf95e('0x44')]['id']){delete _0x482845[_0xf95e('0x44')]['id'];}return db[_0xf95e('0x2a')]['find']({'where':{'id':_0x482845['params']['id']}})[_0xf95e('0x24')](handleEntityNotFound(_0x28fee9,null))[_0xf95e('0x24')](saveUpdates(_0x482845[_0xf95e('0x44')],null))['then'](respondWithResult(_0x28fee9,null))[_0xf95e('0x3f')](handleError(_0x28fee9,null));};exports[_0xf95e('0x45')]=function(_0x32eb0c,_0x7acf9d){return db[_0xf95e('0x2a')][_0xf95e('0x42')]({'where':{'id':_0x32eb0c[_0xf95e('0x40')]['id']}})[_0xf95e('0x24')](handleEntityNotFound(_0x7acf9d,null))[_0xf95e('0x24')](removeEntity(_0x7acf9d,null))[_0xf95e('0x3f')](handleError(_0x7acf9d,null));}; \ No newline at end of file +var _0xc9af=['sendStatus','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','end','name','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','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/license/util','../../mysqldb'];(function(_0x561661,_0x2354e7){var _0x30262b=function(_0x28d5b9){while(--_0x28d5b9){_0x561661['push'](_0x561661['shift']());}};_0x30262b(++_0x2354e7);}(_0xc9af,0x78));var _0xfc9a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc9af[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xfc9a('0x0'));var rimraf=require(_0xfc9a('0x1'));var zipdir=require(_0xfc9a('0x2'));var jsonpatch=require(_0xfc9a('0x3'));var rp=require(_0xfc9a('0x4'));var moment=require(_0xfc9a('0x5'));var BPromise=require(_0xfc9a('0x6'));var Mustache=require(_0xfc9a('0x7'));var util=require(_0xfc9a('0x8'));var path=require(_0xfc9a('0x9'));var sox=require(_0xfc9a('0xa'));var csv=require(_0xfc9a('0xb'));var ejs=require(_0xfc9a('0xc'));var fs=require('fs');var fs_extra=require(_0xfc9a('0xd'));var _=require(_0xfc9a('0xe'));var squel=require(_0xfc9a('0xf'));var crypto=require(_0xfc9a('0x10'));var jsforce=require(_0xfc9a('0x11'));var deskjs=require(_0xfc9a('0x12'));var toCsv=require(_0xfc9a('0xb'));var querystring=require(_0xfc9a('0x13'));var Papa=require(_0xfc9a('0x14'));var Redis=require(_0xfc9a('0x15'));var authService=require(_0xfc9a('0x16'));var qs=require(_0xfc9a('0x17'));var as=require(_0xfc9a('0x18'));var hardwareService=require(_0xfc9a('0x19'));var logger=require(_0xfc9a('0x1a'))(_0xfc9a('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc9a('0x1c'));var db=require(_0xfc9a('0x1d'))['db'];function respondWithStatusCode(_0x48a20e,_0x2c4fa5){_0x2c4fa5=_0x2c4fa5||0xcc;return function(_0x172028){if(_0x172028){return _0x48a20e[_0xfc9a('0x1e')](_0x2c4fa5);}return _0x48a20e[_0xfc9a('0x1f')](_0x2c4fa5)['end']();};}function respondWithResult(_0x5247da,_0x47d40a){_0x47d40a=_0x47d40a||0xc8;return function(_0x25b99f){if(_0x25b99f){return _0x5247da[_0xfc9a('0x1f')](_0x47d40a)[_0xfc9a('0x20')](_0x25b99f);}};}function respondWithFilteredResult(_0x207098,_0x56d462){return function(_0x2adc78){if(_0x2adc78){var _0x1183ed=typeof _0x56d462[_0xfc9a('0x21')]===_0xfc9a('0x22')&&typeof _0x56d462['limit']===_0xfc9a('0x22');var _0x2644aa=_0x2adc78[_0xfc9a('0x23')];var _0x5c7494=_0x1183ed?0x0:_0x56d462[_0xfc9a('0x21')];var _0x10fac7=_0x1183ed?_0x2adc78['count']:_0x56d462[_0xfc9a('0x21')]+_0x56d462['limit'];var _0x21cd65;if(_0x10fac7>=_0x2644aa){_0x10fac7=_0x2644aa;_0x21cd65=0xc8;}else{_0x21cd65=0xce;}_0x207098[_0xfc9a('0x1f')](_0x21cd65);return _0x207098['set'](_0xfc9a('0x24'),_0x5c7494+'-'+_0x10fac7+'/'+_0x2644aa)[_0xfc9a('0x20')](_0x2adc78);}return null;};}function patchUpdates(_0xfb2fd0){return function(_0x4e29ad){try{jsonpatch[_0xfc9a('0x25')](_0x4e29ad,_0xfb2fd0,!![]);}catch(_0x747ebf){return BPromise['reject'](_0x747ebf);}return _0x4e29ad[_0xfc9a('0x26')]();};}function saveUpdates(_0x132a6b,_0x220cb1){return function(_0x3d205e){if(_0x3d205e){return _0x3d205e[_0xfc9a('0x27')](_0x132a6b)[_0xfc9a('0x28')](function(_0x51e87b){return _0x51e87b;});}return null;};}function removeEntity(_0x345de0,_0x317de2){return function(_0x66288b){if(_0x66288b){return _0x66288b[_0xfc9a('0x29')]()[_0xfc9a('0x28')](function(){_0x345de0['status'](0xcc)[_0xfc9a('0x2a')]();});}};}function handleEntityNotFound(_0x131277,_0x59d9ec){return function(_0x572079){if(!_0x572079){_0x131277['sendStatus'](0x194);}return _0x572079;};}function handleError(_0x51cc4c,_0x341bf6){_0x341bf6=_0x341bf6||0x1f4;return function(_0x234a76){logger['error'](_0x234a76['stack']);if(_0x234a76[_0xfc9a('0x2b')]){delete _0x234a76[_0xfc9a('0x2b')];}_0x51cc4c['status'](_0x341bf6)['send'](_0x234a76);};}exports[_0xfc9a('0x2c')]=function(_0xb02631,_0x5de256){var _0x519b98={},_0x4a323d={},_0x15f876={'count':0x0,'rows':[]};var _0x80a9f5=_['map'](db[_0xfc9a('0x2d')][_0xfc9a('0x2e')],function(_0x44336e){return{'name':_0x44336e[_0xfc9a('0x2f')],'type':_0x44336e[_0xfc9a('0x30')]['key']};});_0x4a323d[_0xfc9a('0x31')]=_[_0xfc9a('0x32')](_0x80a9f5,_0xfc9a('0x2b'));_0x4a323d['query']=_['keys'](_0xb02631['query']);_0x4a323d[_0xfc9a('0x33')]=_[_0xfc9a('0x34')](_0x4a323d[_0xfc9a('0x31')],_0x4a323d[_0xfc9a('0x35')]);_0x519b98[_0xfc9a('0x36')]=_[_0xfc9a('0x34')](_0x4a323d[_0xfc9a('0x31')],qs[_0xfc9a('0x37')](_0xb02631[_0xfc9a('0x35')][_0xfc9a('0x37')]));_0x519b98[_0xfc9a('0x36')]=_0x519b98[_0xfc9a('0x36')][_0xfc9a('0x38')]?_0x519b98[_0xfc9a('0x36')]:_0x4a323d[_0xfc9a('0x31')];if(!_0xb02631[_0xfc9a('0x35')]['hasOwnProperty'](_0xfc9a('0x39'))){_0x519b98['limit']=qs[_0xfc9a('0x3a')](_0xb02631[_0xfc9a('0x35')][_0xfc9a('0x3a')]);_0x519b98[_0xfc9a('0x21')]=qs[_0xfc9a('0x21')](_0xb02631['query'][_0xfc9a('0x21')]);}_0x519b98[_0xfc9a('0x3b')]=qs[_0xfc9a('0x3c')](_0xb02631['query'][_0xfc9a('0x3c')]);_0x519b98[_0xfc9a('0x3d')]=qs['filters'](_['pick'](_0xb02631['query'],_0x4a323d[_0xfc9a('0x33')]),_0x80a9f5);if(_0xb02631[_0xfc9a('0x35')][_0xfc9a('0x3e')]){_0x519b98[_0xfc9a('0x3d')]=_[_0xfc9a('0x3f')](_0x519b98[_0xfc9a('0x3d')],{'$or':_['map'](_0x80a9f5,function(_0x59f1d5){if(_0x59f1d5[_0xfc9a('0x30')]!==_0xfc9a('0x40')){var _0x43758a={};_0x43758a[_0x59f1d5[_0xfc9a('0x2b')]]={'$like':'%'+_0xb02631['query'][_0xfc9a('0x3e')]+'%'};return _0x43758a;}})});}_0x519b98=_[_0xfc9a('0x3f')]({},_0x519b98,_0xb02631[_0xfc9a('0x41')]);var _0x35632f={'where':_0x519b98['where']};return db[_0xfc9a('0x2d')]['count'](_0x35632f)[_0xfc9a('0x28')](function(_0x51d072){_0x15f876[_0xfc9a('0x23')]=_0x51d072;if(_0xb02631['query'][_0xfc9a('0x42')]){_0x519b98[_0xfc9a('0x43')]=[{'all':!![]}];}return db[_0xfc9a('0x2d')][_0xfc9a('0x44')](_0x519b98);})[_0xfc9a('0x28')](function(_0x104f33){_0x15f876[_0xfc9a('0x45')]=_0x104f33;return _0x15f876;})['then'](respondWithFilteredResult(_0x5de256,_0x519b98))[_0xfc9a('0x46')](handleError(_0x5de256,null));};exports['show']=function(_0xd067c,_0x1c7187){var _0x89015f={'raw':!![],'where':{'id':_0xd067c[_0xfc9a('0x47')]['id']}},_0x933131={};_0x933131[_0xfc9a('0x31')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x933131[_0xfc9a('0x35')]=_[_0xfc9a('0x48')](_0xd067c['query']);_0x933131['filters']=_[_0xfc9a('0x34')](_0x933131['model'],_0x933131['query']);_0x89015f['attributes']=_[_0xfc9a('0x34')](_0x933131[_0xfc9a('0x31')],qs[_0xfc9a('0x37')](_0xd067c[_0xfc9a('0x35')]['fields']));_0x89015f[_0xfc9a('0x36')]=_0x89015f[_0xfc9a('0x36')]['length']?_0x89015f[_0xfc9a('0x36')]:_0x933131['model'];if(_0xd067c['query'][_0xfc9a('0x42')]){_0x89015f[_0xfc9a('0x43')]=[{'all':!![]}];}_0x89015f=_['merge']({},_0x89015f,_0xd067c[_0xfc9a('0x41')]);return db[_0xfc9a('0x2d')][_0xfc9a('0x49')](_0x89015f)[_0xfc9a('0x28')](handleEntityNotFound(_0x1c7187,null))[_0xfc9a('0x28')](respondWithResult(_0x1c7187,null))[_0xfc9a('0x46')](handleError(_0x1c7187,null));};exports['create']=function(_0x5c2fa2,_0x3d2d8b){return db[_0xfc9a('0x2d')]['create'](_0x5c2fa2[_0xfc9a('0x4a')],{})[_0xfc9a('0x28')](respondWithResult(_0x3d2d8b,0xc9))[_0xfc9a('0x46')](handleError(_0x3d2d8b,null));};exports['update']=function(_0x5f1f4a,_0x11ea63){if(_0x5f1f4a['body']['id']){delete _0x5f1f4a[_0xfc9a('0x4a')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x5f1f4a['params']['id']}})['then'](handleEntityNotFound(_0x11ea63,null))[_0xfc9a('0x28')](saveUpdates(_0x5f1f4a[_0xfc9a('0x4a')],null))[_0xfc9a('0x28')](respondWithResult(_0x11ea63,null))[_0xfc9a('0x46')](handleError(_0x11ea63,null));};exports[_0xfc9a('0x29')]=function(_0x364975,_0x522b96){return db[_0xfc9a('0x2d')][_0xfc9a('0x49')]({'where':{'id':_0x364975[_0xfc9a('0x47')]['id']}})['then'](handleEntityNotFound(_0x522b96,null))[_0xfc9a('0x28')](removeEntity(_0x522b96,null))[_0xfc9a('0x46')](handleError(_0x522b96,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9134ee4..f84747a 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 _0x260f=['./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x260f,0xd8));var _0xf260=function(_0xe0e53b,_0x243a2f){_0xe0e53b=_0xe0e53b-0x0;var _0x4781bc=_0x260f[_0xe0e53b];return _0x4781bc;};'use strict';var _=require('lodash');var util=require(_0xf260('0x0'));var logger=require(_0xf260('0x1'))(_0xf260('0x2'));var moment=require(_0xf260('0x3'));var BPromise=require(_0xf260('0x4'));var rp=require(_0xf260('0x5'));var fs=require('fs');var path=require(_0xf260('0x6'));var rimraf=require(_0xf260('0x7'));var config=require(_0xf260('0x8'));var attributes=require(_0xf260('0x9'));module[_0xf260('0xa')]=function(_0x22707c,_0x4b5ed3){return _0x22707c[_0xf260('0xb')]('OpenchannelApplication',attributes,{'tableName':_0xf260('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf260('0xd'),'collate':_0xf260('0xe')});}; \ No newline at end of file +var _0xf45c=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4'];(function(_0x23ddec,_0x5af62c){var _0x1123f6=function(_0x161e85){while(--_0x161e85){_0x23ddec['push'](_0x23ddec['shift']());}};_0x1123f6(++_0x5af62c);}(_0xf45c,0x1b1));var _0xcf45=function(_0x4edad6,_0x151ce1){_0x4edad6=_0x4edad6-0x0;var _0x2c8c36=_0xf45c[_0x4edad6];return _0x2c8c36;};'use strict';var _=require('lodash');var util=require(_0xcf45('0x0'));var logger=require(_0xcf45('0x1'))(_0xcf45('0x2'));var moment=require(_0xcf45('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf45('0x4'));var fs=require('fs');var path=require(_0xcf45('0x5'));var rimraf=require('rimraf');var config=require(_0xcf45('0x6'));var attributes=require(_0xcf45('0x7'));module['exports']=function(_0x8c4f22,_0x33616c){return _0x8c4f22[_0xcf45('0x8')]('OpenchannelApplication',attributes,{'tableName':_0xcf45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf45('0xa'),'collate':_0xcf45('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a170e51..69dc399 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 _0xb018=['../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','info','result','UpdateOpenchannelApplication','update','body','options','where','attributes','limit','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb018,0x162));var _0x8b01=function(_0x4de34f,_0x1fd529){_0x4de34f=_0x4de34f-0x0;var _0x32da0f=_0xb018[_0x4de34f];return _0x32da0f;};'use strict';var _=require(_0x8b01('0x0'));var util=require('util');var moment=require(_0x8b01('0x1'));var BPromise=require(_0x8b01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b01('0x3'));var db=require(_0x8b01('0x4'))['db'];var utils=require(_0x8b01('0x5'));var logger=require(_0x8b01('0x6'))(_0x8b01('0x7'));var config=require(_0x8b01('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xea3dca,_0x258156,_0x4859c8){return new BPromise(function(_0x263875,_0x18670b){return client[_0x8b01('0xa')](_0xea3dca,_0x4859c8)[_0x8b01('0xb')](function(_0x7c1891){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x258156,_0x8b01('0xc'));logger[_0x8b01('0xd')](_0x8b01('0xe'),_0x258156,_0x8b01('0xc'),JSON[_0x8b01('0xf')](_0x7c1891));if(_0x7c1891[_0x8b01('0x10')]){if(_0x7c1891[_0x8b01('0x10')][_0x8b01('0x11')]===0x1f4){logger['error'](_0x8b01('0x12'),_0x258156,_0x7c1891[_0x8b01('0x10')][_0x8b01('0x13')]);return _0x18670b(_0x7c1891[_0x8b01('0x10')][_0x8b01('0x13')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x258156,_0x7c1891[_0x8b01('0x10')][_0x8b01('0x13')]);return _0x263875(_0x7c1891[_0x8b01('0x10')]['message']);}else{logger[_0x8b01('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x258156,_0x8b01('0xc'));_0x263875(_0x7c1891[_0x8b01('0x15')]['message']);}})['catch'](function(_0x9a257d){logger[_0x8b01('0x10')](_0x8b01('0x12'),_0x258156,_0x9a257d);_0x18670b(_0x9a257d);});});}exports[_0x8b01('0x16')]=function(_0x25169a){var _0x27fbe5=this;return new Promise(function(_0x11c9bd,_0x289bff){return db['OpenchannelApplication'][_0x8b01('0x17')](_0x25169a[_0x8b01('0x18')],{'raw':_0x25169a[_0x8b01('0x19')]?_0x25169a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25169a['options']?_0x25169a[_0x8b01('0x19')][_0x8b01('0x1a')]||null:null,'attributes':_0x25169a[_0x8b01('0x19')]?_0x25169a[_0x8b01('0x19')][_0x8b01('0x1b')]||null:null,'limit':_0x25169a[_0x8b01('0x19')]?_0x25169a['options'][_0x8b01('0x1c')]||null:null})[_0x8b01('0xb')](function(_0x37ceca){logger['info']('UpdateOpenchannelApplication',_0x25169a);logger[_0x8b01('0xd')](_0x8b01('0x16'),_0x25169a,JSON[_0x8b01('0xf')](_0x37ceca));_0x11c9bd(_0x37ceca);})[_0x8b01('0x1d')](function(_0xe15ec4){logger['error'](_0x8b01('0x16'),_0xe15ec4[_0x8b01('0x13')],_0x25169a);_0x289bff(_0x27fbe5[_0x8b01('0x10')](0x1f4,_0xe15ec4[_0x8b01('0x13')]));});});}; \ No newline at end of file +var _0x14d8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x26593d,_0x2e3bbd){var _0x1f127f=function(_0x4ef022){while(--_0x4ef022){_0x26593d['push'](_0x26593d['shift']());}};_0x1f127f(++_0x2e3bbd);}(_0x14d8,0xcb));var _0x814d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x14d8[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var moment=require(_0x814d('0x2'));var BPromise=require(_0x814d('0x3'));var rs=require(_0x814d('0x4'));var fs=require('fs');var Redis=require(_0x814d('0x5'));var db=require(_0x814d('0x6'))['db'];var utils=require(_0x814d('0x7'));var logger=require('../../config/logger')(_0x814d('0x8'));var config=require(_0x814d('0x9'));var jayson=require(_0x814d('0xa'));var client=jayson[_0x814d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21369f,_0x3c5a3b,_0x214eda){return new BPromise(function(_0x38da7f,_0x539afe){return client[_0x814d('0xc')](_0x21369f,_0x214eda)[_0x814d('0xd')](function(_0x16f936){logger[_0x814d('0xe')](_0x814d('0xf'),_0x3c5a3b,'request\x20sent');logger[_0x814d('0x10')](_0x814d('0x11'),_0x3c5a3b,_0x814d('0x12'),JSON['stringify'](_0x16f936));if(_0x16f936['error']){if(_0x16f936[_0x814d('0x13')][_0x814d('0x14')]===0x1f4){logger['error'](_0x814d('0xf'),_0x3c5a3b,_0x16f936['error']['message']);return _0x539afe(_0x16f936[_0x814d('0x13')][_0x814d('0x15')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3c5a3b,_0x16f936[_0x814d('0x13')][_0x814d('0x15')]);return _0x38da7f(_0x16f936[_0x814d('0x13')][_0x814d('0x15')]);}else{logger[_0x814d('0xe')](_0x814d('0xf'),_0x3c5a3b,_0x814d('0x12'));_0x38da7f(_0x16f936[_0x814d('0x16')][_0x814d('0x15')]);}})[_0x814d('0x17')](function(_0x4ab309){logger[_0x814d('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x3c5a3b,_0x4ab309);_0x539afe(_0x4ab309);});});}exports[_0x814d('0x18')]=function(_0x41f2c5){var _0x241c91=this;return new Promise(function(_0x4dfb66,_0x1fee50){return db[_0x814d('0x19')]['update'](_0x41f2c5[_0x814d('0x1a')],{'raw':_0x41f2c5['options']?_0x41f2c5[_0x814d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f2c5[_0x814d('0x1b')]?_0x41f2c5[_0x814d('0x1b')]['where']||null:null,'attributes':_0x41f2c5[_0x814d('0x1b')]?_0x41f2c5['options'][_0x814d('0x1c')]||null:null,'limit':_0x41f2c5['options']?_0x41f2c5[_0x814d('0x1b')][_0x814d('0x1d')]||null:null})[_0x814d('0xd')](function(_0x1c4f59){logger[_0x814d('0xe')]('UpdateOpenchannelApplication',_0x41f2c5);logger[_0x814d('0x10')](_0x814d('0x18'),_0x41f2c5,JSON['stringify'](_0x1c4f59));_0x4dfb66(_0x1c4f59);})[_0x814d('0x17')](function(_0xc094f3){logger['error'](_0x814d('0x18'),_0xc094f3[_0x814d('0x15')],_0x41f2c5);_0x1fee50(_0x241c91[_0x814d('0x13')](0x1f4,_0xc094f3[_0x814d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c4a9f91..72af55c 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 _0xd302=['openchannelinteraction:addtags','addTags','tracked','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0xd302,0xf1));var _0x2d30=function(_0x2eeb05,_0x5792b8){_0x2eeb05=_0x2eeb05-0x0;var _0x5eb93c=_0xd302[_0x2eeb05];return _0x5eb93c;};'use strict';var multer=require(_0x2d30('0x0'));var util=require(_0x2d30('0x1'));var path=require(_0x2d30('0x2'));var timeout=require(_0x2d30('0x3'));var express=require(_0x2d30('0x4'));var router=express['Router']();var fs_extra=require(_0x2d30('0x5'));var auth=require(_0x2d30('0x6'));var interaction=require(_0x2d30('0x7'));var config=require(_0x2d30('0x8'));var controller=require(_0x2d30('0x9'));router['get']('/',auth[_0x2d30('0xa')](),controller[_0x2d30('0xb')]);router[_0x2d30('0xc')]('/describe',auth[_0x2d30('0xa')](),controller[_0x2d30('0xd')]);router[_0x2d30('0xc')](_0x2d30('0xe'),auth[_0x2d30('0xa')](),controller[_0x2d30('0xf')]);router[_0x2d30('0xc')](_0x2d30('0x10'),auth['isAuthenticated'](),controller[_0x2d30('0x11')]);router['get'](_0x2d30('0x12'),auth[_0x2d30('0xa')](),controller[_0x2d30('0x13')]);router[_0x2d30('0x14')]('/',auth[_0x2d30('0xa')](),controller[_0x2d30('0x15')]);router[_0x2d30('0x14')]('/:id/messages',auth[_0x2d30('0xa')](),controller[_0x2d30('0x16')]);router[_0x2d30('0x14')]('/:id/tags',auth[_0x2d30('0xa')](),interaction['tracked']('openchannel',_0x2d30('0x17')),controller[_0x2d30('0x18')]);router['put'](_0x2d30('0xe'),auth[_0x2d30('0xa')](),interaction[_0x2d30('0x19')](_0x2d30('0x1a'),_0x2d30('0x1b')),controller[_0x2d30('0x1c')]);router[_0x2d30('0x1d')](_0x2d30('0xe'),auth[_0x2d30('0xa')](),interaction[_0x2d30('0x19')](_0x2d30('0x1a'),_0x2d30('0x1e')),controller['destroy']);router[_0x2d30('0x1d')]('/:id/tags',auth[_0x2d30('0xa')](),controller[_0x2d30('0x1f')]);module[_0x2d30('0x20')]=router; \ No newline at end of file +var _0xaa0d=['multer','util','path','connect-timeout','express','Router','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','/:id','openchannelinteraction:destroy','destroy','/:id/tags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa0d,0x168));var _0xdaa0=function(_0x41aebc,_0x17c485){_0x41aebc=_0x41aebc-0x0;var _0x32711c=_0xaa0d[_0x41aebc];return _0x32711c;};'use strict';var multer=require(_0xdaa0('0x0'));var util=require(_0xdaa0('0x1'));var path=require(_0xdaa0('0x2'));var timeout=require(_0xdaa0('0x3'));var express=require(_0xdaa0('0x4'));var router=express[_0xdaa0('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdaa0('0x6'));var controller=require(_0xdaa0('0x7'));router[_0xdaa0('0x8')]('/',auth[_0xdaa0('0x9')](),controller[_0xdaa0('0xa')]);router[_0xdaa0('0x8')](_0xdaa0('0xb'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0xc')]);router[_0xdaa0('0x8')]('/:id',auth[_0xdaa0('0x9')](),controller['show']);router[_0xdaa0('0x8')](_0xdaa0('0xd'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0xe')]);router['get'](_0xdaa0('0xf'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0x10')]);router[_0xdaa0('0x11')]('/',auth[_0xdaa0('0x9')](),controller['create']);router[_0xdaa0('0x11')](_0xdaa0('0xd'),auth[_0xdaa0('0x9')](),controller[_0xdaa0('0x12')]);router[_0xdaa0('0x11')]('/:id/tags',auth[_0xdaa0('0x9')](),interaction[_0xdaa0('0x13')](_0xdaa0('0x14'),_0xdaa0('0x15')),controller[_0xdaa0('0x16')]);router[_0xdaa0('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xdaa0('0x13')](_0xdaa0('0x14'),_0xdaa0('0x18')),controller['update']);router[_0xdaa0('0x19')](_0xdaa0('0x1a'),auth['isAuthenticated'](),interaction[_0xdaa0('0x13')](_0xdaa0('0x14'),_0xdaa0('0x1b')),controller[_0xdaa0('0x1c')]);router[_0xdaa0('0x19')](_0xdaa0('0x1d'),auth[_0xdaa0('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9d03b41..36cac53 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 _0xcbde=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x3c0e81,_0x140b26){var _0x2619d7=function(_0x191776){while(--_0x191776){_0x3c0e81['push'](_0x3c0e81['shift']());}};_0x2619d7(++_0x140b26);}(_0xcbde,0x141));var _0xecbd=function(_0x429bbf,_0x35653a){_0x429bbf=_0x429bbf-0x0;var _0x21dbc9=_0xcbde[_0x429bbf];return _0x21dbc9;};'use strict';var Sequelize=require(_0xecbd('0x0'));module['exports']={'closed':{'type':Sequelize[_0xecbd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xecbd('0x2')]},'disposition':{'type':Sequelize[_0xecbd('0x3')]},'secondDisposition':{'type':Sequelize[_0xecbd('0x3')]},'thirdDisposition':{'type':Sequelize[_0xecbd('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xecbd('0x3')]},'externalUrl':{'type':Sequelize[_0xecbd('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xecbd('0x4')]('in',_0xecbd('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xecbd('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xecbd('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xecbd('0x6')]}}; \ No newline at end of file +var _0x9c00=['sequelize','exports','STRING','DATE','ENUM','out','BOOLEAN','INTEGER'];(function(_0x2fda9e,_0x388ebf){var _0x214384=function(_0x36ea5a){while(--_0x36ea5a){_0x2fda9e['push'](_0x2fda9e['shift']());}};_0x214384(++_0x388ebf);}(_0x9c00,0x1a0));var _0x09c0=function(_0x55c06b,_0x1ab2da){_0x55c06b=_0x55c06b-0x0;var _0x12eb36=_0x9c00[_0x55c06b];return _0x12eb36;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x09c0('0x2')]},'secondDisposition':{'type':Sequelize[_0x09c0('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x09c0('0x2')]},'read1stAt':{'type':Sequelize[_0x09c0('0x3')]},'threadId':{'type':Sequelize[_0x09c0('0x2')]},'externalUrl':{'type':Sequelize[_0x09c0('0x2')]},'lastMsgAt':{'type':Sequelize[_0x09c0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x09c0('0x4')]('in',_0x09c0('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x09c0('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x09c0('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7184dc0..f0649ee 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 _0xb7d1=['sendStatus','rimraf','zip-dir','moment','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','json','offset','undefined','limit','count','status','set','update','then','destroy','stack','name','send','index','map','fieldName','key','openchannel','query','user','show','from','params','model','keys','OpenchannelInteraction','rawAttributes','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','findAll','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','push','User','fullname','CmContact','Contact','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','YYYY-MM-DD\x20HH:mm:ss','out','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync'];(function(_0x47d4cc,_0x17178b){var _0x28b893=function(_0x436d4b){while(--_0x436d4b){_0x47d4cc['push'](_0x47d4cc['shift']());}};_0x28b893(++_0x17178b);}(_0xb7d1,0x172));var _0x1b7d=function(_0x36109f,_0x32ff52){_0x36109f=_0x36109f-0x0;var _0x14535c=_0xb7d1[_0x36109f];return _0x14535c;};'use strict';var rimraf=require(_0x1b7d('0x0'));var zipdir=require(_0x1b7d('0x1'));var moment=require(_0x1b7d('0x2'));var util=require('util');var path=require(_0x1b7d('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b7d('0x4'));var Redis=require('ioredis');var interaction=require(_0x1b7d('0x5'));var qs=require(_0x1b7d('0x6'));var pdf=require(_0x1b7d('0x7'));var logger=require('../../config/logger')(_0x1b7d('0x8'));var config=require(_0x1b7d('0x9'));var db=require(_0x1b7d('0xa'))['db'];config[_0x1b7d('0xb')]=_[_0x1b7d('0xc')](config[_0x1b7d('0xb')],{'host':_0x1b7d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b7d('0xb')]));require('./openchannelInteraction.socket')[_0x1b7d('0xe')](socket);function respondWithStatusCode(_0x1da5ff,_0x5d9ed5){_0x5d9ed5=_0x5d9ed5||0xcc;return function(_0x1d0583){if(_0x1d0583){return _0x1da5ff['sendStatus'](_0x5d9ed5);}return _0x1da5ff['status'](_0x5d9ed5)['end']();};}function respondWithResult(_0x24cc0b,_0xe76a25){_0xe76a25=_0xe76a25||0xc8;return function(_0x5242e8){if(_0x5242e8){return _0x24cc0b['status'](_0xe76a25)[_0x1b7d('0xf')](_0x5242e8);}};}function respondWithFilteredResult(_0x16cab6,_0x2c8b9d){return function(_0x571b3f){if(_0x571b3f){var _0x286288=typeof _0x2c8b9d[_0x1b7d('0x10')]===_0x1b7d('0x11')&&typeof _0x2c8b9d[_0x1b7d('0x12')]===_0x1b7d('0x11');var _0x5605c4=_0x571b3f['count'];var _0x589019=_0x286288?0x0:_0x2c8b9d[_0x1b7d('0x10')];var _0xdd8455=_0x286288?_0x571b3f[_0x1b7d('0x13')]:_0x2c8b9d[_0x1b7d('0x10')]+_0x2c8b9d[_0x1b7d('0x12')];var _0x528231;if(_0xdd8455>=_0x5605c4){_0xdd8455=_0x5605c4;_0x528231=0xc8;}else{_0x528231=0xce;}_0x16cab6[_0x1b7d('0x14')](_0x528231);return _0x16cab6[_0x1b7d('0x15')]('Content-Range',_0x589019+'-'+_0xdd8455+'/'+_0x5605c4)[_0x1b7d('0xf')](_0x571b3f);}return null;};}function saveUpdates(_0x38e1c2){return function(_0x3581a6){if(_0x3581a6){return _0x3581a6[_0x1b7d('0x16')](_0x38e1c2)[_0x1b7d('0x17')](function(_0x20f799){return _0x20f799;});}return null;};}function removeEntity(_0x2d7ad1){return function(_0x2d794d){if(_0x2d794d){return _0x2d794d[_0x1b7d('0x18')]()[_0x1b7d('0x17')](function(){_0x2d7ad1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f231f){return function(_0x374e63){if(!_0x374e63){_0x5f231f['sendStatus'](0x194);}return _0x374e63;};}function handleError(_0x14793d,_0x4c933a){_0x4c933a=_0x4c933a||0x1f4;return function(_0x47d53a){logger['error'](_0x47d53a[_0x1b7d('0x19')]);if(_0x47d53a[_0x1b7d('0x1a')]){delete _0x47d53a[_0x1b7d('0x1a')];}_0x14793d[_0x1b7d('0x14')](_0x4c933a)[_0x1b7d('0x1b')](_0x47d53a);};}exports[_0x1b7d('0x1c')]=function(_0x4351c0,_0x23ec30){var _0x5de4bf={};var _0x20e8fa=_[_0x1b7d('0x1d')](db['OpenchannelInteraction']['rawAttributes'],function(_0x2fa803){return{'name':_0x2fa803[_0x1b7d('0x1e')],'type':_0x2fa803['type'][_0x1b7d('0x1f')]};});_0x5de4bf=qs['getOptions'](_0x20e8fa,_0x4351c0);return interaction['findAll'](_0x1b7d('0x20'),_0x4351c0[_0x1b7d('0x21')],_0x4351c0[_0x1b7d('0x22')],_0x5de4bf,_0x20e8fa)[_0x1b7d('0x17')](respondWithFilteredResult(_0x23ec30,_0x5de4bf))['catch'](handleError(_0x23ec30,null));};exports[_0x1b7d('0x23')]=function(_0x3be3e7,_0x35f218){var _0x1d44de={};if(_0x3be3e7[_0x1b7d('0x21')]['type']&&_0x3be3e7['query']['type']==='from'){_0x1d44de[_0x1b7d('0x24')]=_0x3be3e7[_0x1b7d('0x25')]['id'];}else{_0x1d44de['id']=_0x3be3e7[_0x1b7d('0x25')]['id'];}var _0x4d0c28={'raw':![],'where':_0x1d44de},_0x5c6b1b={};_0x5c6b1b[_0x1b7d('0x26')]=_[_0x1b7d('0x27')](db[_0x1b7d('0x28')][_0x1b7d('0x29')]);_0x5c6b1b[_0x1b7d('0x21')]=_[_0x1b7d('0x27')](_0x3be3e7[_0x1b7d('0x21')]);_0x5c6b1b[_0x1b7d('0x2a')]=_[_0x1b7d('0x2b')](_0x5c6b1b[_0x1b7d('0x26')],_0x5c6b1b[_0x1b7d('0x21')]);_0x4d0c28[_0x1b7d('0x2c')]=_[_0x1b7d('0x2b')](_0x5c6b1b[_0x1b7d('0x26')],qs[_0x1b7d('0x2d')](_0x3be3e7[_0x1b7d('0x21')]['fields']));_0x4d0c28['attributes']=_0x4d0c28[_0x1b7d('0x2c')]['length']?_0x4d0c28[_0x1b7d('0x2c')]:_0x5c6b1b[_0x1b7d('0x26')];if(_0x3be3e7['query'][_0x1b7d('0x2e')]){_0x4d0c28[_0x1b7d('0x2f')]=[{'all':!![]}];}_0x4d0c28=_[_0x1b7d('0x30')]({},_0x4d0c28,_0x3be3e7[_0x1b7d('0x31')]);return db[_0x1b7d('0x28')][_0x1b7d('0x32')](_0x4d0c28)[_0x1b7d('0x17')](handleEntityNotFound(_0x35f218,null))[_0x1b7d('0x17')](respondWithResult(_0x35f218,null))[_0x1b7d('0x33')](handleError(_0x35f218,null));};exports['create']=function(_0x1ebe15,_0x1e56d3){return db[_0x1b7d('0x28')][_0x1b7d('0x34')](_0x1ebe15['body'],{})['then'](respondWithResult(_0x1e56d3,0xc9))[_0x1b7d('0x33')](handleError(_0x1e56d3,null));};exports['update']=function(_0xf3c0db,_0x56b95b){if(_0xf3c0db[_0x1b7d('0x35')]['id']){delete _0xf3c0db['body']['id'];}return db[_0x1b7d('0x28')][_0x1b7d('0x32')]({'where':{'id':_0xf3c0db[_0x1b7d('0x25')]['id']}})['then'](handleEntityNotFound(_0x56b95b,null))['then'](saveUpdates(_0xf3c0db[_0x1b7d('0x35')],null))[_0x1b7d('0x17')](respondWithResult(_0x56b95b,null))['catch'](handleError(_0x56b95b,null));};exports[_0x1b7d('0x18')]=function(_0x386d41,_0x2f9ed0){return db['OpenchannelInteraction'][_0x1b7d('0x32')]({'where':{'id':_0x386d41[_0x1b7d('0x25')]['id']}})['then'](handleEntityNotFound(_0x2f9ed0,null))['then'](removeEntity(_0x2f9ed0,null))[_0x1b7d('0x33')](handleError(_0x2f9ed0,null));};exports[_0x1b7d('0x36')]=function(_0x485249,_0x1f580d){return db[_0x1b7d('0x28')]['describe']()[_0x1b7d('0x17')](respondWithResult(_0x1f580d,null))['catch'](handleError(_0x1f580d,null));};exports[_0x1b7d('0x37')]=function(_0x4d29d9,_0x2c6c5a){return db[_0x1b7d('0x38')][_0x1b7d('0x32')]({'where':{'id':_0x4d29d9[_0x1b7d('0x25')]['id']}})[_0x1b7d('0x17')](handleEntityNotFound(_0x2c6c5a,null))[_0x1b7d('0x17')](function(_0x34cac5){if(_0x34cac5){return _0x34cac5['addMessage'](_0x4d29d9[_0x1b7d('0x35')][_0x1b7d('0x39')],_[_0x1b7d('0x3a')](_0x4d29d9[_0x1b7d('0x35')],[_0x1b7d('0x39'),'id'])||{});}})['then'](respondWithResult(_0x2c6c5a,null))[_0x1b7d('0x33')](handleError(_0x2c6c5a,null));};exports[_0x1b7d('0x3b')]=function(_0x3529e4,_0x47493f){var _0xe6ee91={'raw':![],'where':{}};var _0x446080={};var _0x30e4bd={'count':0x0,'rows':[]};return db[_0x1b7d('0x28')][_0x1b7d('0x3c')]({'where':{'id':_0x3529e4['params']['id']}})[_0x1b7d('0x17')](handleEntityNotFound(_0x47493f,null))[_0x1b7d('0x17')](function(_0xdfd201){if(_0xdfd201){_0x446080[_0x1b7d('0x26')]=_[_0x1b7d('0x27')](db[_0x1b7d('0x38')][_0x1b7d('0x29')]);_0x446080[_0x1b7d('0x21')]=_['keys'](_0x3529e4[_0x1b7d('0x21')]);_0x446080['filters']=_[_0x1b7d('0x2b')](_0x446080[_0x1b7d('0x26')],_0x446080[_0x1b7d('0x21')]);_0xe6ee91[_0x1b7d('0x2c')]=_[_0x1b7d('0x2b')](_0x446080['model'],qs[_0x1b7d('0x2d')](_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x2d')]));_0xe6ee91[_0x1b7d('0x2c')]=_0xe6ee91[_0x1b7d('0x2c')][_0x1b7d('0x3d')]?_0xe6ee91[_0x1b7d('0x2c')]:_0x446080[_0x1b7d('0x26')];if(!_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x3e')](_0x1b7d('0x3f'))){_0xe6ee91[_0x1b7d('0x12')]=qs[_0x1b7d('0x12')](_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x12')]);_0xe6ee91['offset']=qs[_0x1b7d('0x10')](_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x10')]);}_0xe6ee91[_0x1b7d('0x40')]=qs[_0x1b7d('0x41')](_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x41')]);_0xe6ee91['where']=qs[_0x1b7d('0x2a')](_['pick'](_0x3529e4[_0x1b7d('0x21')],_0x446080[_0x1b7d('0x2a')]));_0xe6ee91[_0x1b7d('0x42')][_0x1b7d('0x43')]=_0xdfd201['id'];if(_0x3529e4[_0x1b7d('0x21')]['filter']){_0xe6ee91[_0x1b7d('0x42')]=_['merge'](_0xe6ee91[_0x1b7d('0x42')],{'$or':_[_0x1b7d('0x1d')](_0xe6ee91[_0x1b7d('0x2c')],function(_0x25e856){var _0x1e0e98={};_0x1e0e98[_0x25e856]={'$like':'%'+_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x44')]+'%'};return _0x1e0e98;})});}if(_0x3529e4['query'][_0x1b7d('0x45')]){var _0x46645b=_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x45')][_0x1b7d('0x46')](',');var _0x38b68b={};_0x38b68b[_0x46645b[0x0]]={'$gte':moment(_0x46645b[0x1])[_0x1b7d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe6ee91['where']=_[_0x1b7d('0x30')](_0xe6ee91[_0x1b7d('0x42')],_0x38b68b);}_0xe6ee91=_[_0x1b7d('0x30')]({},_0xe6ee91,_0x3529e4['options']);return db['OpenchannelMessage'][_0x1b7d('0x13')]({'where':_0xe6ee91[_0x1b7d('0x42')]})['then'](function(_0xf2fe40){_0x30e4bd[_0x1b7d('0x13')]=_0xf2fe40;if(_0x3529e4[_0x1b7d('0x21')][_0x1b7d('0x2e')]){_0xe6ee91[_0x1b7d('0x2f')]=[{'all':!![]}];}return db[_0x1b7d('0x38')][_0x1b7d('0x48')](_0xe6ee91);})['then'](function(_0x466d89){_0x30e4bd['rows']=_0x466d89;return _0x30e4bd;});}})[_0x1b7d('0x17')](respondWithFilteredResult(_0x47493f,_0xe6ee91))['catch'](handleError(_0x47493f,null));};exports[_0x1b7d('0x49')]=function(_0x54aed3,_0x3d1b4d){return db[_0x1b7d('0x28')]['find']({'where':{'id':_0x54aed3[_0x1b7d('0x25')]['id']}})[_0x1b7d('0x17')](handleEntityNotFound(_0x3d1b4d,null))[_0x1b7d('0x17')](function(_0x260e2d){if(_0x260e2d){return _0x260e2d[_0x1b7d('0x4a')](_0x54aed3[_0x1b7d('0x35')][_0x1b7d('0x39')],_['omit'](_0x54aed3[_0x1b7d('0x35')],['ids','id'])||{})[_0x1b7d('0x4b')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x1b7d('0x4c')],'where':{'id':_0x54aed3['body'][_0x1b7d('0x39')]}});})[_0x1b7d('0x17')](function(_0x19962c){socket[_0x1b7d('0x4d')](_0x1b7d('0x4e'),{'id':Number(_0x54aed3[_0x1b7d('0x25')]['id']),'tags':_0x19962c||[]});return{'id':Number(_0x54aed3[_0x1b7d('0x25')]['id']),'tags':_0x19962c||[]};});}})[_0x1b7d('0x17')](respondWithResult(_0x3d1b4d,null))[_0x1b7d('0x33')](handleError(_0x3d1b4d,null));};exports[_0x1b7d('0x4f')]=function(_0x55e4d2,_0x1b58df){return db['OpenchannelInteraction'][_0x1b7d('0x32')]({'where':{'id':_0x55e4d2[_0x1b7d('0x25')]['id']}})[_0x1b7d('0x17')](handleEntityNotFound(_0x1b58df,null))[_0x1b7d('0x17')](function(_0x332333){if(_0x332333){return _0x332333[_0x1b7d('0x4f')](_0x55e4d2[_0x1b7d('0x21')][_0x1b7d('0x39')]);}})[_0x1b7d('0x17')](respondWithStatusCode(_0x1b58df,null))[_0x1b7d('0x33')](handleError(_0x1b58df,null));};exports[_0x1b7d('0x50')]=function(_0x36099c,_0x2666c5){var _0x2d8990=moment()['unix']()['toString']();var _0xc10f39=path[_0x1b7d('0x51')](config[_0x1b7d('0x52')],'server','files','tmp');var _0x5850a6=path[_0x1b7d('0x51')](config[_0x1b7d('0x52')],_0x1b7d('0x53'),_0x1b7d('0x54'),'attachments');var _0x3a3143=path[_0x1b7d('0x51')](_0xc10f39,_0x2d8990);var _0x415953=util[_0x1b7d('0x47')]('transcript-%d-%s.zip',_0x36099c[_0x1b7d('0x25')]['id'],_0x2d8990);var _0x49cb11=path[_0x1b7d('0x51')](_0xc10f39,_0x415953);var _0x3fd08c=[];_0x3fd08c[_0x1b7d('0x55')]({'model':db[_0x1b7d('0x56')],'as':'User','attributes':['id',_0x1b7d('0x57')],'raw':!![]});_0x3fd08c[_0x1b7d('0x55')]({'model':db[_0x1b7d('0x58')],'as':_0x1b7d('0x59'),'attributes':['id','firstName',_0x1b7d('0x5a')],'raw':!![]});if(_0x36099c[_0x1b7d('0x21')][_0x1b7d('0x5b')]){_0x3fd08c['push']({'model':db[_0x1b7d('0x5c')],'as':_0x1b7d('0x5c'),'raw':!![]});}var _0x5f2ea0=[{'model':db[_0x1b7d('0x38')],'as':_0x1b7d('0x5d'),'attributes':['id',_0x1b7d('0x35'),_0x1b7d('0x5e'),_0x1b7d('0x5f'),_0x1b7d('0x60'),_0x1b7d('0x61')],'include':_0x3fd08c}];_0x5f2ea0[_0x1b7d('0x55')]({'model':db['OpenchannelAccount'],'as':_0x1b7d('0x62'),'attributes':['id','name']});_0x5f2ea0['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x1b7d('0x57')]});return db[_0x1b7d('0x28')][_0x1b7d('0x32')]({'where':{'id':_0x36099c[_0x1b7d('0x25')]['id']},'include':_0x5f2ea0})['then'](handleEntityNotFound(_0x2666c5,null))[_0x1b7d('0x17')](function(_0x50a679){if(_0x50a679){var _0x46fe5a=_0x50a679[_0x1b7d('0x63')]({'plain':!![]});fs[_0x1b7d('0x64')](_0x3a3143);var _0x4dbd99={'channel':_0x1b7d('0x65'),'account':_0x46fe5a[_0x1b7d('0x62')][_0x1b7d('0x1a')],'agent':_0x46fe5a[_0x1b7d('0x66')]?_0x46fe5a[_0x1b7d('0x66')][_0x1b7d('0x57')]:_0x1b7d('0x67'),'createdAt':moment(_0x46fe5a[_0x1b7d('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x46fe5a[_0x1b7d('0x68')]?moment(_0x46fe5a[_0x1b7d('0x69')])[_0x1b7d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x46fe5a[_0x1b7d('0x6a')],'visibility':_0x46fe5a['threadId']?_0x1b7d('0x6b'):_0x1b7d('0x6c'),'messages':_(_0x46fe5a[_0x1b7d('0x5d')])['filter']({'secret':![]})[_0x1b7d('0x1d')](function(_0x2463b0){if(_0x2463b0[_0x1b7d('0x5c')]){var _0x3cf625=path[_0x1b7d('0x51')](_0x5850a6,_0x2463b0[_0x1b7d('0x5c')][_0x1b7d('0x6d')]);if(fs[_0x1b7d('0x6e')](_0x3cf625)){fs[_0x1b7d('0x6f')](_0x3cf625)['pipe'](fs['createWriteStream'](path[_0x1b7d('0x51')](_0x3a3143,_0x2463b0[_0x1b7d('0x5c')][_0x1b7d('0x6d')])));}}return{'date':moment(_0x2463b0[_0x1b7d('0x5e')])[_0x1b7d('0x47')](_0x1b7d('0x70'))['toString'](),'sender':_0x2463b0[_0x1b7d('0x5f')]===_0x1b7d('0x71')?_0x2463b0[_0x1b7d('0x56')]?_0x2463b0[_0x1b7d('0x56')][_0x1b7d('0x57')]:'System':_0x2463b0[_0x1b7d('0x59')][_0x1b7d('0x72')]+(_0x2463b0[_0x1b7d('0x59')][_0x1b7d('0x5a')]?'\x20'+_0x2463b0[_0x1b7d('0x59')]['lastName']:''),'body':_0x2463b0[_0x1b7d('0x5c')]?_0x2463b0[_0x1b7d('0x5c')][_0x1b7d('0x6d')]:_0x2463b0[_0x1b7d('0x35')],'direction':_0x2463b0[_0x1b7d('0x5f')]==='out'?'A':'C','secret':_0x2463b0['secret'],'read':_0x2463b0['read'],'attachment':_0x2463b0[_0x1b7d('0x5c')]};})[_0x1b7d('0x73')]()};return ejs[_0x1b7d('0x74')](path['join'](config[_0x1b7d('0x52')],_0x1b7d('0x53'),_0x1b7d('0x75'),_0x1b7d('0x76')),{'interaction':_0x4dbd99})[_0x1b7d('0x17')](function(_0x158b55){var _0x5e1fc6=path[_0x1b7d('0x51')](_0x3a3143,'transcript-'+_0x46fe5a['id']+'-'+_0x2d8990+_0x1b7d('0x77'));var _0x149169={'path':_0x5e1fc6,'channel':'Openchannel','interactionId':_0x46fe5a['id']};return pdf[_0x1b7d('0x78')](_0x158b55,_0x149169);})['then'](function(){return new Promise(function(_0x57ae59,_0x4a815e){zipdir(_0x3a3143,{'saveTo':_0x49cb11},function(_0x20ec34,_0x3ca5d3){if(_0x20ec34)return _0x4a815e(_0x20ec34);return _0x57ae59(_0x3ca5d3);});})['then'](function(){return new Promise(function(_0x13bacc,_0x5ef208){rimraf(_0x3a3143,function(_0x3c71e2){if(_0x3c71e2)_0x5ef208(_0x3c71e2);return _0x13bacc();});});})['then'](function(){return _0x2666c5[_0x1b7d('0x50')](_0x49cb11,_0x415953,function(_0x246617){if(_0x246617){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x246617);}else{fs[_0x1b7d('0x79')](_0x49cb11);}});});});}else{return _0x2666c5[_0x1b7d('0x7a')](0xc8);}})[_0x1b7d('0x33')](handleError(_0x2666c5,null));}; \ No newline at end of file +var _0xd92c=['where','filter','map','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','server','files','attachments','push','User','fullname','CmContact','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','toString','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','Contact','secret','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','count','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','type','getOptions','openchannel','query','user','then','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','catch','describe','addMessage','OpenchannelMessage','ids','getMessages','nolimit','order','sort'];(function(_0x4a6a4c,_0x5149d1){var _0xdb0e5b=function(_0x319640){while(--_0x319640){_0x4a6a4c['push'](_0x4a6a4c['shift']());}};_0xdb0e5b(++_0x5149d1);}(_0xd92c,0x1c2));var _0xcd92=function(_0x1bcf69,_0x20f815){_0x1bcf69=_0x1bcf69-0x0;var _0x2f056c=_0xd92c[_0x1bcf69];return _0x2f056c;};'use strict';var rimraf=require(_0xcd92('0x0'));var zipdir=require(_0xcd92('0x1'));var moment=require('moment');var util=require('util');var path=require(_0xcd92('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd92('0x3'));var Redis=require(_0xcd92('0x4'));var interaction=require(_0xcd92('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xcd92('0x6'));var logger=require(_0xcd92('0x7'))(_0xcd92('0x8'));var config=require(_0xcd92('0x9'));var db=require(_0xcd92('0xa'))['db'];config[_0xcd92('0xb')]=_['defaults'](config[_0xcd92('0xb')],{'host':_0xcd92('0xc'),'port':0x18eb});var socket=require(_0xcd92('0xd'))(new Redis(config['redis']));require(_0xcd92('0xe'))[_0xcd92('0xf')](socket);function respondWithStatusCode(_0x559d05,_0x1670dc){_0x1670dc=_0x1670dc||0xcc;return function(_0x3ce019){if(_0x3ce019){return _0x559d05['sendStatus'](_0x1670dc);}return _0x559d05[_0xcd92('0x10')](_0x1670dc)['end']();};}function respondWithResult(_0x3f9f20,_0x59f237){_0x59f237=_0x59f237||0xc8;return function(_0x3d3b5d){if(_0x3d3b5d){return _0x3f9f20[_0xcd92('0x10')](_0x59f237)[_0xcd92('0x11')](_0x3d3b5d);}};}function respondWithFilteredResult(_0x19025f,_0x1c7dc5){return function(_0x5206bc){if(_0x5206bc){var _0x496b0c=typeof _0x1c7dc5[_0xcd92('0x12')]==='undefined'&&typeof _0x1c7dc5[_0xcd92('0x13')]==='undefined';var _0x4b42b0=_0x5206bc[_0xcd92('0x14')];var _0x303c03=_0x496b0c?0x0:_0x1c7dc5[_0xcd92('0x12')];var _0x1d4cef=_0x496b0c?_0x5206bc['count']:_0x1c7dc5[_0xcd92('0x12')]+_0x1c7dc5['limit'];var _0x322166;if(_0x1d4cef>=_0x4b42b0){_0x1d4cef=_0x4b42b0;_0x322166=0xc8;}else{_0x322166=0xce;}_0x19025f['status'](_0x322166);return _0x19025f[_0xcd92('0x15')](_0xcd92('0x16'),_0x303c03+'-'+_0x1d4cef+'/'+_0x4b42b0)[_0xcd92('0x11')](_0x5206bc);}return null;};}function saveUpdates(_0x2c7cf6){return function(_0x20e228){if(_0x20e228){return _0x20e228[_0xcd92('0x17')](_0x2c7cf6)['then'](function(_0x340530){return _0x340530;});}return null;};}function removeEntity(_0x21ac53){return function(_0x3073ea){if(_0x3073ea){return _0x3073ea[_0xcd92('0x18')]()['then'](function(){_0x21ac53[_0xcd92('0x10')](0xcc)[_0xcd92('0x19')]();});}};}function handleEntityNotFound(_0x5b2d40){return function(_0x137dd7){if(!_0x137dd7){_0x5b2d40[_0xcd92('0x1a')](0x194);}return _0x137dd7;};}function handleError(_0x51014f,_0xcf7179){_0xcf7179=_0xcf7179||0x1f4;return function(_0x300adc){logger[_0xcd92('0x1b')](_0x300adc[_0xcd92('0x1c')]);if(_0x300adc[_0xcd92('0x1d')]){delete _0x300adc[_0xcd92('0x1d')];}_0x51014f[_0xcd92('0x10')](_0xcf7179)[_0xcd92('0x1e')](_0x300adc);};}exports[_0xcd92('0x1f')]=function(_0xbf77be,_0x5e78c8){var _0xfa7769={};var _0x32c17b=_['map'](db[_0xcd92('0x20')][_0xcd92('0x21')],function(_0x136989){return{'name':_0x136989['fieldName'],'type':_0x136989[_0xcd92('0x22')]['key']};});_0xfa7769=qs[_0xcd92('0x23')](_0x32c17b,_0xbf77be);return interaction['findAll'](_0xcd92('0x24'),_0xbf77be[_0xcd92('0x25')],_0xbf77be[_0xcd92('0x26')],_0xfa7769,_0x32c17b)[_0xcd92('0x27')](respondWithFilteredResult(_0x5e78c8,_0xfa7769))['catch'](handleError(_0x5e78c8,null));};exports[_0xcd92('0x28')]=function(_0x110dd6,_0x460025){var _0x148e3e={};if(_0x110dd6['query']['type']&&_0x110dd6[_0xcd92('0x25')][_0xcd92('0x22')]===_0xcd92('0x29')){_0x148e3e[_0xcd92('0x29')]=_0x110dd6[_0xcd92('0x2a')]['id'];}else{_0x148e3e['id']=_0x110dd6[_0xcd92('0x2a')]['id'];}var _0x4acb5b={'raw':![],'where':_0x148e3e},_0x43f0d8={};_0x43f0d8[_0xcd92('0x2b')]=_[_0xcd92('0x2c')](db[_0xcd92('0x20')][_0xcd92('0x21')]);_0x43f0d8['query']=_['keys'](_0x110dd6[_0xcd92('0x25')]);_0x43f0d8[_0xcd92('0x2d')]=_[_0xcd92('0x2e')](_0x43f0d8[_0xcd92('0x2b')],_0x43f0d8['query']);_0x4acb5b[_0xcd92('0x2f')]=_[_0xcd92('0x2e')](_0x43f0d8['model'],qs[_0xcd92('0x30')](_0x110dd6['query'][_0xcd92('0x30')]));_0x4acb5b[_0xcd92('0x2f')]=_0x4acb5b[_0xcd92('0x2f')][_0xcd92('0x31')]?_0x4acb5b[_0xcd92('0x2f')]:_0x43f0d8[_0xcd92('0x2b')];if(_0x110dd6[_0xcd92('0x25')][_0xcd92('0x32')]){_0x4acb5b[_0xcd92('0x33')]=[{'all':!![]}];}_0x4acb5b=_[_0xcd92('0x34')]({},_0x4acb5b,_0x110dd6[_0xcd92('0x35')]);return db['OpenchannelInteraction']['find'](_0x4acb5b)[_0xcd92('0x27')](handleEntityNotFound(_0x460025,null))[_0xcd92('0x27')](respondWithResult(_0x460025,null))['catch'](handleError(_0x460025,null));};exports[_0xcd92('0x36')]=function(_0x5892b0,_0x285198){return db[_0xcd92('0x20')][_0xcd92('0x36')](_0x5892b0[_0xcd92('0x37')],{})['then'](respondWithResult(_0x285198,0xc9))['catch'](handleError(_0x285198,null));};exports['update']=function(_0x1e187c,_0xf5d657){if(_0x1e187c['body']['id']){delete _0x1e187c[_0xcd92('0x37')]['id'];}return db['OpenchannelInteraction'][_0xcd92('0x38')]({'where':{'id':_0x1e187c[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0xf5d657,null))[_0xcd92('0x27')](saveUpdates(_0x1e187c[_0xcd92('0x37')],null))[_0xcd92('0x27')](respondWithResult(_0xf5d657,null))[_0xcd92('0x39')](handleError(_0xf5d657,null));};exports[_0xcd92('0x18')]=function(_0x4517e2,_0x5154b0){return db[_0xcd92('0x20')][_0xcd92('0x38')]({'where':{'id':_0x4517e2[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x5154b0,null))[_0xcd92('0x27')](removeEntity(_0x5154b0,null))[_0xcd92('0x39')](handleError(_0x5154b0,null));};exports[_0xcd92('0x3a')]=function(_0x55b988,_0x1093f7){return db[_0xcd92('0x20')]['describe']()[_0xcd92('0x27')](respondWithResult(_0x1093f7,null))['catch'](handleError(_0x1093f7,null));};exports[_0xcd92('0x3b')]=function(_0x19bc9f,_0x578943){return db[_0xcd92('0x3c')][_0xcd92('0x38')]({'where':{'id':_0x19bc9f['params']['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x578943,null))[_0xcd92('0x27')](function(_0x38d0e9){if(_0x38d0e9){return _0x38d0e9['addMessage'](_0x19bc9f[_0xcd92('0x37')][_0xcd92('0x3d')],_['omit'](_0x19bc9f['body'],[_0xcd92('0x3d'),'id'])||{});}})[_0xcd92('0x27')](respondWithResult(_0x578943,null))['catch'](handleError(_0x578943,null));};exports[_0xcd92('0x3e')]=function(_0x3b98c4,_0x8a9da7){var _0x25e252={'raw':![],'where':{}};var _0x3586d7={};var _0x2042a5={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x3b98c4['params']['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x8a9da7,null))[_0xcd92('0x27')](function(_0x5d44ed){if(_0x5d44ed){_0x3586d7[_0xcd92('0x2b')]=_['keys'](db['OpenchannelMessage'][_0xcd92('0x21')]);_0x3586d7[_0xcd92('0x25')]=_[_0xcd92('0x2c')](_0x3b98c4[_0xcd92('0x25')]);_0x3586d7['filters']=_['intersection'](_0x3586d7[_0xcd92('0x2b')],_0x3586d7[_0xcd92('0x25')]);_0x25e252[_0xcd92('0x2f')]=_['intersection'](_0x3586d7[_0xcd92('0x2b')],qs[_0xcd92('0x30')](_0x3b98c4[_0xcd92('0x25')]['fields']));_0x25e252[_0xcd92('0x2f')]=_0x25e252['attributes'][_0xcd92('0x31')]?_0x25e252['attributes']:_0x3586d7['model'];if(!_0x3b98c4[_0xcd92('0x25')]['hasOwnProperty'](_0xcd92('0x3f'))){_0x25e252['limit']=qs[_0xcd92('0x13')](_0x3b98c4[_0xcd92('0x25')]['limit']);_0x25e252[_0xcd92('0x12')]=qs['offset'](_0x3b98c4[_0xcd92('0x25')][_0xcd92('0x12')]);}_0x25e252[_0xcd92('0x40')]=qs[_0xcd92('0x41')](_0x3b98c4['query']['sort']);_0x25e252[_0xcd92('0x42')]=qs['filters'](_['pick'](_0x3b98c4[_0xcd92('0x25')],_0x3586d7[_0xcd92('0x2d')]));_0x25e252[_0xcd92('0x42')]['OpenchannelInteractionId']=_0x5d44ed['id'];if(_0x3b98c4[_0xcd92('0x25')][_0xcd92('0x43')]){_0x25e252['where']=_[_0xcd92('0x34')](_0x25e252[_0xcd92('0x42')],{'$or':_[_0xcd92('0x44')](_0x25e252[_0xcd92('0x2f')],function(_0x3e5abe){var _0x5c399f={};_0x5c399f[_0x3e5abe]={'$like':'%'+_0x3b98c4[_0xcd92('0x25')][_0xcd92('0x43')]+'%'};return _0x5c399f;})});}if(_0x3b98c4[_0xcd92('0x25')]['$gte']){var _0x2c1fbf=_0x3b98c4[_0xcd92('0x25')]['$gte'][_0xcd92('0x45')](',');var _0x3df040={};_0x3df040[_0x2c1fbf[0x0]]={'$gte':moment(_0x2c1fbf[0x1])[_0xcd92('0x46')](_0xcd92('0x47'))};_0x25e252['where']=_[_0xcd92('0x34')](_0x25e252['where'],_0x3df040);}_0x25e252=_[_0xcd92('0x34')]({},_0x25e252,_0x3b98c4[_0xcd92('0x35')]);return db[_0xcd92('0x3c')]['count']({'where':_0x25e252[_0xcd92('0x42')]})[_0xcd92('0x27')](function(_0x39aa5f){_0x2042a5[_0xcd92('0x14')]=_0x39aa5f;if(_0x3b98c4['query'][_0xcd92('0x32')]){_0x25e252[_0xcd92('0x33')]=[{'all':!![]}];}return db[_0xcd92('0x3c')]['findAll'](_0x25e252);})[_0xcd92('0x27')](function(_0x183e70){_0x2042a5[_0xcd92('0x48')]=_0x183e70;return _0x2042a5;});}})[_0xcd92('0x27')](respondWithFilteredResult(_0x8a9da7,_0x25e252))[_0xcd92('0x39')](handleError(_0x8a9da7,null));};exports[_0xcd92('0x49')]=function(_0x4179ce,_0x51ac21){return db[_0xcd92('0x20')][_0xcd92('0x38')]({'where':{'id':_0x4179ce[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x51ac21,null))['then'](function(_0xa6df5a){if(_0xa6df5a){return _0xa6df5a['setTags'](_0x4179ce[_0xcd92('0x37')][_0xcd92('0x3d')],_['omit'](_0x4179ce[_0xcd92('0x37')],[_0xcd92('0x3d'),'id'])||{})[_0xcd92('0x4a')](function(){return db[_0xcd92('0x4b')]['findAll']({'attributes':['id','name',_0xcd92('0x4c')],'where':{'id':_0x4179ce[_0xcd92('0x37')][_0xcd92('0x3d')]}});})[_0xcd92('0x27')](function(_0x25806d){socket[_0xcd92('0x4d')](_0xcd92('0x4e'),{'id':Number(_0x4179ce[_0xcd92('0x2a')]['id']),'tags':_0x25806d||[]});return{'id':Number(_0x4179ce[_0xcd92('0x2a')]['id']),'tags':_0x25806d||[]};});}})[_0xcd92('0x27')](respondWithResult(_0x51ac21,null))[_0xcd92('0x39')](handleError(_0x51ac21,null));};exports[_0xcd92('0x4f')]=function(_0x5a9165,_0x37fec1){return db[_0xcd92('0x20')]['find']({'where':{'id':_0x5a9165[_0xcd92('0x2a')]['id']}})[_0xcd92('0x27')](handleEntityNotFound(_0x37fec1,null))[_0xcd92('0x27')](function(_0x4d7a3f){if(_0x4d7a3f){return _0x4d7a3f[_0xcd92('0x4f')](_0x5a9165['query'][_0xcd92('0x3d')]);}})[_0xcd92('0x27')](respondWithStatusCode(_0x37fec1,null))[_0xcd92('0x39')](handleError(_0x37fec1,null));};exports[_0xcd92('0x50')]=function(_0x54b12c,_0x13aa8c){var _0x523394=moment()[_0xcd92('0x51')]()['toString']();var _0x11fadf=path[_0xcd92('0x52')](config[_0xcd92('0x53')],'server','files',_0xcd92('0x54'));var _0x1a6ad5=path[_0xcd92('0x52')](config['root'],_0xcd92('0x55'),_0xcd92('0x56'),_0xcd92('0x57'));var _0x100b9b=path[_0xcd92('0x52')](_0x11fadf,_0x523394);var _0x59811a=util[_0xcd92('0x46')]('transcript-%d-%s.zip',_0x54b12c[_0xcd92('0x2a')]['id'],_0x523394);var _0xb76d38=path[_0xcd92('0x52')](_0x11fadf,_0x59811a);var _0x584838=[];_0x584838[_0xcd92('0x58')]({'model':db[_0xcd92('0x59')],'as':_0xcd92('0x59'),'attributes':['id',_0xcd92('0x5a')],'raw':!![]});_0x584838[_0xcd92('0x58')]({'model':db[_0xcd92('0x5b')],'as':'Contact','attributes':['id','firstName',_0xcd92('0x5c')],'raw':!![]});if(_0x54b12c['query'][_0xcd92('0x57')]){_0x584838['push']({'model':db[_0xcd92('0x5d')],'as':_0xcd92('0x5d'),'raw':!![]});}var _0x37d8d2=[{'model':db[_0xcd92('0x3c')],'as':_0xcd92('0x5e'),'attributes':['id',_0xcd92('0x37'),_0xcd92('0x5f'),_0xcd92('0x60'),'secret',_0xcd92('0x61')],'include':_0x584838}];_0x37d8d2[_0xcd92('0x58')]({'model':db[_0xcd92('0x62')],'as':_0xcd92('0x63'),'attributes':['id',_0xcd92('0x1d')]});_0x37d8d2[_0xcd92('0x58')]({'model':db[_0xcd92('0x59')],'as':'Owner','attributes':['id',_0xcd92('0x5a')]});return db['OpenchannelInteraction'][_0xcd92('0x38')]({'where':{'id':_0x54b12c['params']['id']},'include':_0x37d8d2})[_0xcd92('0x27')](handleEntityNotFound(_0x13aa8c,null))[_0xcd92('0x27')](function(_0x33b2b4){if(_0x33b2b4){var _0x1c018f=_0x33b2b4[_0xcd92('0x64')]({'plain':!![]});fs[_0xcd92('0x65')](_0x100b9b);var _0x225db1={'channel':_0xcd92('0x66'),'account':_0x1c018f[_0xcd92('0x63')][_0xcd92('0x1d')],'agent':_0x1c018f[_0xcd92('0x67')]?_0x1c018f[_0xcd92('0x67')][_0xcd92('0x5a')]:'N.A.','createdAt':moment(_0x1c018f[_0xcd92('0x5f')])['format'](_0xcd92('0x47'))[_0xcd92('0x68')](),'closedAt':_0x1c018f[_0xcd92('0x69')]?moment(_0x1c018f[_0xcd92('0x6a')])[_0xcd92('0x46')](_0xcd92('0x47'))[_0xcd92('0x68')]():'','disposition':_0x1c018f[_0xcd92('0x6b')],'visibility':_0x1c018f[_0xcd92('0x6c')]?_0xcd92('0x6d'):_0xcd92('0x6e'),'messages':_(_0x1c018f[_0xcd92('0x5e')])[_0xcd92('0x43')]({'secret':![]})[_0xcd92('0x44')](function(_0x4f6523){if(_0x4f6523[_0xcd92('0x5d')]){var _0x331865=path[_0xcd92('0x52')](_0x1a6ad5,_0x4f6523[_0xcd92('0x5d')][_0xcd92('0x6f')]);if(fs[_0xcd92('0x70')](_0x331865)){fs[_0xcd92('0x71')](_0x331865)[_0xcd92('0x72')](fs[_0xcd92('0x73')](path[_0xcd92('0x52')](_0x100b9b,_0x4f6523['Attachment'][_0xcd92('0x6f')])));}}return{'date':moment(_0x4f6523[_0xcd92('0x5f')])['format'](_0xcd92('0x47'))[_0xcd92('0x68')](),'sender':_0x4f6523['direction']===_0xcd92('0x74')?_0x4f6523[_0xcd92('0x59')]?_0x4f6523[_0xcd92('0x59')][_0xcd92('0x5a')]:_0xcd92('0x75'):_0x4f6523['Contact'][_0xcd92('0x76')]+(_0x4f6523[_0xcd92('0x77')]['lastName']?'\x20'+_0x4f6523['Contact'][_0xcd92('0x5c')]:''),'body':_0x4f6523[_0xcd92('0x5d')]?_0x4f6523[_0xcd92('0x5d')]['basename']:_0x4f6523['body'],'direction':_0x4f6523[_0xcd92('0x60')]==='out'?'A':'C','secret':_0x4f6523[_0xcd92('0x78')],'read':_0x4f6523[_0xcd92('0x61')],'attachment':_0x4f6523[_0xcd92('0x5d')]};})[_0xcd92('0x79')]()};return ejs[_0xcd92('0x7a')](path[_0xcd92('0x52')](config[_0xcd92('0x53')],_0xcd92('0x55'),_0xcd92('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x225db1})[_0xcd92('0x27')](function(_0xedb60d){var _0xe8ef85=path[_0xcd92('0x52')](_0x100b9b,_0xcd92('0x7c')+_0x1c018f['id']+'-'+_0x523394+_0xcd92('0x7d'));var _0x11de33={'path':_0xe8ef85,'channel':_0xcd92('0x66'),'interactionId':_0x1c018f['id']};return pdf[_0xcd92('0x7e')](_0xedb60d,_0x11de33);})['then'](function(){return new Promise(function(_0xf6d5bb,_0x315dca){zipdir(_0x100b9b,{'saveTo':_0xb76d38},function(_0x564774,_0x3a69eb){if(_0x564774)return _0x315dca(_0x564774);return _0xf6d5bb(_0x3a69eb);});})['then'](function(){return new Promise(function(_0x159673,_0x2138f){rimraf(_0x100b9b,function(_0x4069e4){if(_0x4069e4)_0x2138f(_0x4069e4);return _0x159673();});});})[_0xcd92('0x27')](function(){return _0x13aa8c[_0xcd92('0x50')](_0xb76d38,_0x59811a,function(_0x186415){if(_0x186415){logger[_0xcd92('0x1b')](_0xcd92('0x7f'),_0x186415);}else{fs[_0xcd92('0x80')](_0xb76d38);}});});});}else{return _0x13aa8c['sendStatus'](0xc8);}})[_0xcd92('0x39')](handleError(_0x13aa8c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cd062a6..f95987f 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 _0x3728=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0x183e32,_0x386d03){var _0x2a0f6c=function(_0x359a15){while(--_0x359a15){_0x183e32['push'](_0x183e32['shift']());}};_0x2a0f6c(++_0x386d03);}(_0x3728,0x185));var _0x8372=function(_0x261549,_0x371206){_0x261549=_0x261549-0x0;var _0x56560f=_0x3728[_0x261549];return _0x56560f;};'use strict';var EventEmitter=require(_0x8372('0x0'));var OpenchannelInteraction=require(_0x8372('0x1'))['db'][_0x8372('0x2')];var OpenchannelMessage=require(_0x8372('0x1'))['db'][_0x8372('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8372('0x4')](0x0);var events={'afterCreate':_0x8372('0x5'),'afterUpdate':_0x8372('0x6'),'afterDestroy':_0x8372('0x7')};function emitEvent(_0x39a9c8){return function(_0xd8d91d,_0x391a24,_0x4fb2d5){_0xd8d91d['getUsers']({'attributes':['id'],'raw':!![]})[_0x8372('0x8')](function(_0x5df13f){_0xd8d91d[_0x8372('0x9')](_0x8372('0xa'),_0x5df13f[_0x8372('0xb')](function(_0x3fb0a0){return{'id':_0x3fb0a0['id']};}));return OpenchannelMessage[_0x8372('0xc')]({'where':{'OpenchannelInteractionId':_0xd8d91d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1f03bb){_0xd8d91d[_0x8372('0x9')](_0x8372('0xd'),_0x1f03bb[_0x8372('0xe')]);OpenchannelInteractionEvents[_0x8372('0xf')](_0x39a9c8+':'+_0xd8d91d['id'],_0xd8d91d);OpenchannelInteractionEvents[_0x8372('0xf')](_0x39a9c8,_0xd8d91d);_0x4fb2d5(null);})[_0x8372('0x10')](_0x4fb2d5(null));};}for(var e in events){if(events[_0x8372('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x8372('0x12')](e,emitEvent(event));}}module[_0x8372('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2f27=['catch','hasOwnProperty','exports','events','OpenchannelInteraction','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x2f27,0x1d4));var _0x72f2=function(_0x32a039,_0x3323de){_0x32a039=_0x32a039-0x0;var _0x2b3986=_0x2f27[_0x32a039];return _0x2b3986;};'use strict';var EventEmitter=require(_0x72f2('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x72f2('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x72f2('0x2')](0x0);var events={'afterCreate':_0x72f2('0x3'),'afterUpdate':'update','afterDestroy':_0x72f2('0x4')};function emitEvent(_0x4bbd99){return function(_0x5c25c3,_0x5a25b5,_0x14ce20){_0x5c25c3['getUsers']({'attributes':['id'],'raw':!![]})[_0x72f2('0x5')](function(_0x3c599e){_0x5c25c3[_0x72f2('0x6')](_0x72f2('0x7'),_0x3c599e[_0x72f2('0x8')](function(_0x4df763){return{'id':_0x4df763['id']};}));return OpenchannelMessage[_0x72f2('0x9')]({'where':{'OpenchannelInteractionId':_0x5c25c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72f2('0x5')](function(_0x1d782e){_0x5c25c3[_0x72f2('0x6')](_0x72f2('0xa'),_0x1d782e['length']);OpenchannelInteractionEvents['emit'](_0x4bbd99+':'+_0x5c25c3['id'],_0x5c25c3);OpenchannelInteractionEvents[_0x72f2('0xb')](_0x4bbd99,_0x5c25c3);_0x14ce20(null);})[_0x72f2('0xc')](_0x14ce20(null));};}for(var e in events){if(events[_0x72f2('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x72f2('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index af85324..0b00c33 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 _0x6b6b=['path','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','lodash','api','moment','request-promise'];(function(_0x184266,_0x1b43dd){var _0x878ca3=function(_0x1f99b9){while(--_0x1f99b9){_0x184266['push'](_0x184266['shift']());}};_0x878ca3(++_0x1b43dd);}(_0x6b6b,0x1a0));var _0xb6b6=function(_0x55cceb,_0x486946){_0x55cceb=_0x55cceb-0x0;var _0x496515=_0x6b6b[_0x55cceb];return _0x496515;};'use strict';var _=require(_0xb6b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb6b6('0x1'));var moment=require(_0xb6b6('0x2'));var BPromise=require('bluebird');var rp=require(_0xb6b6('0x3'));var fs=require('fs');var path=require(_0xb6b6('0x4'));var rimraf=require('rimraf');var config=require(_0xb6b6('0x5'));var attributes=require('./openchannelInteraction.attributes');module[_0xb6b6('0x6')]=function(_0x237a1d,_0x384861){return _0x237a1d[_0xb6b6('0x7')](_0xb6b6('0x8'),attributes,{'tableName':_0xb6b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6b6('0xa'),'collate':_0xb6b6('0xb'),'hooks':{'beforeUpdate':function(_0x2bd1f4,_0x29ee42,_0x2ac73b){if(_0x2bd1f4['changed'](_0xb6b6('0xc'))){_0x2bd1f4[_0xb6b6('0xd')]=moment()[_0xb6b6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ac73b(null,_0x2bd1f4);}}});}; \ No newline at end of file +var _0x3b74=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ccb01,_0x56aedc){var _0x408035=function(_0x6f2b48){while(--_0x6f2b48){_0x2ccb01['push'](_0x2ccb01['shift']());}};_0x408035(++_0x56aedc);}(_0x3b74,0x80));var _0x43b7=function(_0x1a20fe,_0x5ac383){_0x1a20fe=_0x1a20fe-0x0;var _0x20c7c7=_0x3b74[_0x1a20fe];return _0x20c7c7;};'use strict';var _=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var logger=require(_0x43b7('0x2'))(_0x43b7('0x3'));var moment=require('moment');var BPromise=require(_0x43b7('0x4'));var rp=require(_0x43b7('0x5'));var fs=require('fs');var path=require(_0x43b7('0x6'));var rimraf=require(_0x43b7('0x7'));var config=require('../../config/environment');var attributes=require(_0x43b7('0x8'));module[_0x43b7('0x9')]=function(_0x3e62b0,_0x444109){return _0x3e62b0[_0x43b7('0xa')](_0x43b7('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x43b7('0xc'),'hooks':{'beforeUpdate':function(_0xb07b65,_0x593add,_0x11662a){if(_0xb07b65[_0x43b7('0xd')]('closed')){_0xb07b65[_0x43b7('0xe')]=moment()['format'](_0x43b7('0xf'));}_0x11662a(null,_0xb07b65);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ede85b2..b893b86 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 _0x6a1b=['OpenchannelInteraction','body','options','raw','where','attributes','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x1ce037,_0x18c6aa){var _0x4266b7=function(_0x4f552d){while(--_0x4f552d){_0x1ce037['push'](_0x1ce037['shift']());}};_0x4266b7(++_0x18c6aa);}(_0x6a1b,0xf5));var _0xb6a1=function(_0x299053,_0x27df9a){_0x299053=_0x299053-0x0;var _0x31fddb=_0x6a1b[_0x299053];return _0x31fddb;};'use strict';var _=require(_0xb6a1('0x0'));var util=require(_0xb6a1('0x1'));var moment=require(_0xb6a1('0x2'));var BPromise=require(_0xb6a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6a1('0x4'));var db=require(_0xb6a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6a1('0x6'))(_0xb6a1('0x7'));var config=require('../../config/environment');var jayson=require(_0xb6a1('0x8'));var client=jayson['client'][_0xb6a1('0x9')]({'port':0x232a});config[_0xb6a1('0xa')]=_['defaults'](config[_0xb6a1('0xa')],{'host':_0xb6a1('0xb'),'port':0x18eb});var socket=require(_0xb6a1('0xc'))(new Redis(config[_0xb6a1('0xa')]));require(_0xb6a1('0xd'))[_0xb6a1('0xe')](socket);function respondWithRpcPromise(_0x4bcf3f,_0x1b69cd,_0x114211){return new BPromise(function(_0x5d0009,_0x26a87e){return client[_0xb6a1('0xf')](_0x4bcf3f,_0x114211)[_0xb6a1('0x10')](function(_0x55ab91){logger[_0xb6a1('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1b69cd,'request\x20sent');logger[_0xb6a1('0x12')](_0xb6a1('0x13'),_0x1b69cd,_0xb6a1('0x14'),JSON[_0xb6a1('0x15')](_0x55ab91));if(_0x55ab91[_0xb6a1('0x16')]){if(_0x55ab91['error'][_0xb6a1('0x17')]===0x1f4){logger['error'](_0xb6a1('0x18'),_0x1b69cd,_0x55ab91[_0xb6a1('0x16')][_0xb6a1('0x19')]);return _0x26a87e(_0x55ab91[_0xb6a1('0x16')][_0xb6a1('0x19')]);}logger[_0xb6a1('0x16')](_0xb6a1('0x18'),_0x1b69cd,_0x55ab91[_0xb6a1('0x16')][_0xb6a1('0x19')]);return _0x5d0009(_0x55ab91['error']['message']);}else{logger['info'](_0xb6a1('0x18'),_0x1b69cd,_0xb6a1('0x14'));_0x5d0009(_0x55ab91[_0xb6a1('0x1a')][_0xb6a1('0x19')]);}})[_0xb6a1('0x1b')](function(_0x4bdbd1){logger[_0xb6a1('0x16')](_0xb6a1('0x18'),_0x1b69cd,_0x4bdbd1);_0x26a87e(_0x4bdbd1);});});}exports['UpdateOpenchannelInteraction']=function(_0x2a864e){var _0x40de5d=this;return new Promise(function(_0x1c2c70,_0x7d21d6){return db[_0xb6a1('0x1c')]['update'](_0x2a864e[_0xb6a1('0x1d')],{'raw':_0x2a864e['options']?_0x2a864e[_0xb6a1('0x1e')][_0xb6a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a864e[_0xb6a1('0x1e')]?_0x2a864e['options'][_0xb6a1('0x20')]||null:null,'attributes':_0x2a864e[_0xb6a1('0x1e')]?_0x2a864e[_0xb6a1('0x1e')][_0xb6a1('0x21')]||null:null,'limit':_0x2a864e[_0xb6a1('0x1e')]?_0x2a864e[_0xb6a1('0x1e')]['limit']||null:null})['then'](function(_0x185ea5){logger[_0xb6a1('0x11')](_0xb6a1('0x22'),_0x2a864e);logger[_0xb6a1('0x12')](_0xb6a1('0x22'),_0x2a864e,JSON[_0xb6a1('0x15')](_0x185ea5));_0x1c2c70(_0x185ea5);})[_0xb6a1('0x1b')](function(_0x11967c){logger['error'](_0xb6a1('0x22'),_0x11967c[_0xb6a1('0x19')],_0x2a864e);_0x7d21d6(_0x40de5d[_0xb6a1('0x16')](0x1f4,_0x11967c[_0xb6a1('0x19')]));});});};exports[_0xb6a1('0x23')]=function(_0x1c5288){return new Promise(function(_0x201c10,_0x5cbd15){return db['OpenchannelInteraction']['find']({'where':_0x1c5288['options']?_0x1c5288['options'][_0xb6a1('0x20')]||null:null})[_0xb6a1('0x10')](function(_0x2583fb){if(_0x2583fb){return _0x2583fb[_0xb6a1('0x24')](_0x1c5288[_0xb6a1('0x1d')][_0xb6a1('0x25')],_['omit'](_0x1c5288['body'],[_0xb6a1('0x25'),'id'])||{});}})['spread'](function(_0x474b0f){logger[_0xb6a1('0x11')](_0xb6a1('0x26'),_0x1c5288);logger['debug'](_0xb6a1('0x26'),_0x1c5288,JSON[_0xb6a1('0x15')](_0x474b0f));_0x201c10(_0x474b0f);})[_0xb6a1('0x1b')](function(_0x42eae6){logger[_0xb6a1('0x16')](_0xb6a1('0x26'),_0x42eae6[_0xb6a1('0x19')],_0x1c5288);_0x5cbd15(_this[_0xb6a1('0x16')](0x1f4,_0x42eae6['message']));});});}; \ No newline at end of file +var _0x31e4=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','limit','find','addTags','body','omit','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1d4b38,_0x31cc9f){var _0x341c2d=function(_0x1952f7){while(--_0x1952f7){_0x1d4b38['push'](_0x1d4b38['shift']());}};_0x341c2d(++_0x31cc9f);}(_0x31e4,0x133));var _0x431e=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x31e4[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require(_0x431e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x431e('0x1'));var rs=require(_0x431e('0x2'));var fs=require('fs');var Redis=require(_0x431e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x431e('0x4'));var logger=require(_0x431e('0x5'))(_0x431e('0x6'));var config=require(_0x431e('0x7'));var jayson=require(_0x431e('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x431e('0x9')]=_[_0x431e('0xa')](config[_0x431e('0x9')],{'host':_0x431e('0xb'),'port':0x18eb});var socket=require(_0x431e('0xc'))(new Redis(config[_0x431e('0x9')]));require(_0x431e('0xd'))['register'](socket);function respondWithRpcPromise(_0x153cf2,_0x5f110b,_0x13c100){return new BPromise(function(_0x3c1b93,_0x32b78a){return client[_0x431e('0xe')](_0x153cf2,_0x13c100)[_0x431e('0xf')](function(_0x3ab77f){logger[_0x431e('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5f110b,_0x431e('0x11'));logger[_0x431e('0x12')](_0x431e('0x13'),_0x5f110b,_0x431e('0x11'),JSON[_0x431e('0x14')](_0x3ab77f));if(_0x3ab77f[_0x431e('0x15')]){if(_0x3ab77f['error'][_0x431e('0x16')]===0x1f4){logger[_0x431e('0x15')](_0x431e('0x17'),_0x5f110b,_0x3ab77f[_0x431e('0x15')][_0x431e('0x18')]);return _0x32b78a(_0x3ab77f['error']['message']);}logger[_0x431e('0x15')](_0x431e('0x17'),_0x5f110b,_0x3ab77f[_0x431e('0x15')][_0x431e('0x18')]);return _0x3c1b93(_0x3ab77f[_0x431e('0x15')][_0x431e('0x18')]);}else{logger[_0x431e('0x10')](_0x431e('0x17'),_0x5f110b,'request\x20sent');_0x3c1b93(_0x3ab77f['result'][_0x431e('0x18')]);}})[_0x431e('0x19')](function(_0x5da8c9){logger[_0x431e('0x15')](_0x431e('0x17'),_0x5f110b,_0x5da8c9);_0x32b78a(_0x5da8c9);});});}exports[_0x431e('0x1a')]=function(_0x131d4b){var _0x29a992=this;return new Promise(function(_0x1664a2,_0x30e2ea){return db[_0x431e('0x1b')]['update'](_0x131d4b['body'],{'raw':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')][_0x431e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')][_0x431e('0x1e')]||null:null,'attributes':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')]['attributes']||null:null,'limit':_0x131d4b[_0x431e('0x1c')]?_0x131d4b[_0x431e('0x1c')][_0x431e('0x1f')]||null:null})[_0x431e('0xf')](function(_0x4be05d){logger['info']('UpdateOpenchannelInteraction',_0x131d4b);logger[_0x431e('0x12')](_0x431e('0x1a'),_0x131d4b,JSON['stringify'](_0x4be05d));_0x1664a2(_0x4be05d);})[_0x431e('0x19')](function(_0x313066){logger[_0x431e('0x15')](_0x431e('0x1a'),_0x313066[_0x431e('0x18')],_0x131d4b);_0x30e2ea(_0x29a992[_0x431e('0x15')](0x1f4,_0x313066[_0x431e('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x15513d){return new Promise(function(_0x155cb1,_0x3989ab){return db[_0x431e('0x1b')][_0x431e('0x20')]({'where':_0x15513d[_0x431e('0x1c')]?_0x15513d[_0x431e('0x1c')][_0x431e('0x1e')]||null:null})[_0x431e('0xf')](function(_0x41c948){if(_0x41c948){return _0x41c948[_0x431e('0x21')](_0x15513d[_0x431e('0x22')]['ids'],_[_0x431e('0x23')](_0x15513d[_0x431e('0x22')],[_0x431e('0x24'),'id'])||{});}})[_0x431e('0x25')](function(_0x1a5709){logger[_0x431e('0x10')](_0x431e('0x26'),_0x15513d);logger[_0x431e('0x12')](_0x431e('0x26'),_0x15513d,JSON['stringify'](_0x1a5709));_0x155cb1(_0x1a5709);})[_0x431e('0x19')](function(_0x17be37){logger[_0x431e('0x15')](_0x431e('0x26'),_0x17be37[_0x431e('0x18')],_0x15513d);_0x3989ab(_this['error'](0x1f4,_0x17be37['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7a34eea..7ea4a36 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 _0x2c47=['remove','update','removeListener','register','length','save'];(function(_0x12018c,_0x3ccd2c){var _0x3b03d1=function(_0x29b30f){while(--_0x29b30f){_0x12018c['push'](_0x12018c['shift']());}};_0x3b03d1(++_0x3ccd2c);}(_0x2c47,0x131));var _0x72c4=function(_0x5c57bf,_0x43d162){_0x5c57bf=_0x5c57bf-0x0;var _0x3bde0a=_0x2c47[_0x5c57bf];return _0x3bde0a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x72c4('0x0'),_0x72c4('0x1'),_0x72c4('0x2')];function createListener(_0x464b73,_0x20022e){return function(_0xcddc0e){_0x20022e['emit'](_0x464b73,_0xcddc0e);};}function removeListener(_0x3fb777,_0x51dec0){return function(){OpenchannelInteractionEvents[_0x72c4('0x3')](_0x3fb777,_0x51dec0);};}exports[_0x72c4('0x4')]=function(_0x290be7){for(var _0xfafd49=0x0,_0x3173be=events[_0x72c4('0x5')];_0xfafd49<_0x3173be;_0xfafd49++){var _0x482e8f=events[_0xfafd49];var _0x32fa7c=createListener('openchannelInteraction:'+_0x482e8f,_0x290be7);OpenchannelInteractionEvents['on'](_0x482e8f,_0x32fa7c);}}; \ No newline at end of file +var _0x853e=['./openchannelInteraction.events','save','remove','update','emit','register','openchannelInteraction:'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0x853e,0x15e));var _0xe853=function(_0x352299,_0x5298a1){_0x352299=_0x352299-0x0;var _0x309e1e=_0x853e[_0x352299];return _0x309e1e;};'use strict';var OpenchannelInteractionEvents=require(_0xe853('0x0'));var events=[_0xe853('0x1'),_0xe853('0x2'),_0xe853('0x3')];function createListener(_0x29eb62,_0x451595){return function(_0x4c718f){_0x451595[_0xe853('0x4')](_0x29eb62,_0x4c718f);};}function removeListener(_0x208349,_0x3646de){return function(){OpenchannelInteractionEvents['removeListener'](_0x208349,_0x3646de);};}exports[_0xe853('0x5')]=function(_0x554c05){for(var _0x484058=0x0,_0x4ee8aa=events['length'];_0x484058<_0x4ee8aa;_0x484058++){var _0x379966=events[_0x484058];var _0x4302c0=createListener(_0xe853('0x6')+_0x379966,_0x554c05);OpenchannelInteractionEvents['on'](_0x379966,_0x4302c0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ef32f3b..fcac3ac 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x411296,_0x3431d4){var _0x3347f8=function(_0x12bde0){while(--_0x12bde0){_0x411296['push'](_0x411296['shift']());}};_0x3347f8(++_0x3431d4);}(_0xe706,0xa3));var _0x6e70=function(_0x5384ae,_0x32e603){_0x5384ae=_0x5384ae-0x0;var _0x4bcf2d=_0xe706[_0x5384ae];return _0x4bcf2d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 83d8a2f..90b9df1 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 _0xfd7b=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x1c1541,_0x4efce4){var _0x477e87=function(_0x3cdd99){while(--_0x3cdd99){_0x1c1541['push'](_0x1c1541['shift']());}};_0x477e87(++_0x4efce4);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0xfd7b[_0x2a55f8];return _0x245efd;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'body':{'type':Sequelize[_0xbfd7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfd7('0x4')]('in','out'),'defaultValue':_0xbfd7('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfd7('0x6')]},'providerName':{'type':Sequelize[_0xbfd7('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe5fb=['medium','BOOLEAN','out','DATE','STRING','TEXT','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe5fb,0xce));var _0xbe5f=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xe5fb[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbe5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbe5f('0x4')),'defaultValue':_0xbe5f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbe5f('0x5')]},'providerName':{'type':Sequelize[_0xbe5f('0x6')]},'providerResponse':{'type':Sequelize[_0xbe5f('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index bd3e5a0..103e71a 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 _0xa7aa=['QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','openchannel-interactions','reject','get','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','motionChannel','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','sendStatus','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','describe','../../config/logger','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize'];(function(_0x24ec0b,_0xbf2257){var _0x584288=function(_0x170efa){while(--_0x170efa){_0x24ec0b['push'](_0x24ec0b['shift']());}};_0x584288(++_0xbf2257);}(_0xa7aa,0x133));var _0xaa7a=function(_0x4c656c,_0x2ceabe){_0x4c656c=_0x4c656c-0x0;var _0x334818=_0xa7aa[_0x4c656c];return _0x334818;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa7a('0x0'));var zipdir=require(_0xaa7a('0x1'));var jsonpatch=require(_0xaa7a('0x2'));var rp=require(_0xaa7a('0x3'));var moment=require(_0xaa7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa7a('0x5'));var util=require(_0xaa7a('0x6'));var path=require(_0xaa7a('0x7'));var sox=require(_0xaa7a('0x8'));var csv=require(_0xaa7a('0x9'));var ejs=require(_0xaa7a('0xa'));var fs=require('fs');var fs_extra=require(_0xaa7a('0xb'));var _=require(_0xaa7a('0xc'));var squel=require('squel');var crypto=require(_0xaa7a('0xd'));var jsforce=require(_0xaa7a('0xe'));var deskjs=require(_0xaa7a('0xf'));var toCsv=require(_0xaa7a('0x9'));var querystring=require(_0xaa7a('0x10'));var Papa=require(_0xaa7a('0x11'));var Redis=require(_0xaa7a('0x12'));var authService=require(_0xaa7a('0x13'));var qs=require(_0xaa7a('0x14'));var as=require(_0xaa7a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa7a('0x16'));var utils=require(_0xaa7a('0x17'));var config=require(_0xaa7a('0x18'));var licenseUtil=require(_0xaa7a('0x19'));var db=require(_0xaa7a('0x1a'))['db'];config[_0xaa7a('0x1b')]=_[_0xaa7a('0x1c')](config[_0xaa7a('0x1b')],{'host':_0xaa7a('0x1d'),'port':0x18eb});var socket=require(_0xaa7a('0x1e'))(new Redis(config[_0xaa7a('0x1b')]));require(_0xaa7a('0x1f'))[_0xaa7a('0x20')](socket);var jayson=require(_0xaa7a('0x21'));var client=jayson[_0xaa7a('0x22')][_0xaa7a('0x23')]({'port':0x232c});var client9002=jayson[_0xaa7a('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x487671,_0x483a16,_0x4ff8cf,_0x57ca6a){return new BPromise(function(_0x4e8b1a,_0x12264a){var _0x4f2039=_0x57ca6a||client;return _0x4f2039[_0xaa7a('0x24')](_0x487671,_0x4ff8cf)[_0xaa7a('0x25')](function(_0x4e74b6){logger['info'](_0xaa7a('0x26'),_0x483a16,'request\x20sent');logger[_0xaa7a('0x27')](_0xaa7a('0x28'),_0x483a16,_0xaa7a('0x29'),JSON[_0xaa7a('0x2a')](_0x4e74b6));if(_0x4e74b6[_0xaa7a('0x2b')]){if(_0x4e74b6['error'][_0xaa7a('0x2c')]===0x1f4){logger[_0xaa7a('0x2b')](_0xaa7a('0x26'),_0x483a16,_0x4e74b6[_0xaa7a('0x2b')][_0xaa7a('0x2d')]);return _0x12264a(_0x4e74b6[_0xaa7a('0x2b')]['message']);}logger[_0xaa7a('0x2b')](_0xaa7a('0x26'),_0x483a16,_0x4e74b6['error'][_0xaa7a('0x2d')]);return _0x4e8b1a(_0x4e74b6[_0xaa7a('0x2b')]['message']);}else{logger[_0xaa7a('0x2e')](_0xaa7a('0x26'),_0x483a16,_0xaa7a('0x29'));_0x4e8b1a(_0x4e74b6['result'][_0xaa7a('0x2d')]);}})[_0xaa7a('0x2f')](function(_0x3ead61){logger[_0xaa7a('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x483a16,_0x3ead61);_0x12264a(_0x3ead61);});});}function respondWithStatusCode(_0x3efd64,_0x213f6b){_0x213f6b=_0x213f6b||0xcc;return function(_0x3fb170){if(_0x3fb170){return _0x3efd64['sendStatus'](_0x213f6b);}return _0x3efd64[_0xaa7a('0x30')](_0x213f6b)[_0xaa7a('0x31')]();};}function respondWithResult(_0x234b20,_0x4368e3){_0x4368e3=_0x4368e3||0xc8;return function(_0xd5e216){if(_0xd5e216){return _0x234b20[_0xaa7a('0x30')](_0x4368e3)[_0xaa7a('0x32')](_0xd5e216);}};}function respondWithFilteredResult(_0x492aef,_0x1e38bf){return function(_0x96f15c){if(_0x96f15c){var _0x5bf1ab=typeof _0x1e38bf[_0xaa7a('0x33')]===_0xaa7a('0x34')&&typeof _0x1e38bf[_0xaa7a('0x35')]===_0xaa7a('0x34');var _0xa0a513=_0x96f15c[_0xaa7a('0x36')];var _0x38ae32=_0x5bf1ab?0x0:_0x1e38bf[_0xaa7a('0x33')];var _0x4ffca2=_0x5bf1ab?_0x96f15c['count']:_0x1e38bf[_0xaa7a('0x33')]+_0x1e38bf[_0xaa7a('0x35')];var _0x3a274d;if(_0x4ffca2>=_0xa0a513){_0x4ffca2=_0xa0a513;_0x3a274d=0xc8;}else{_0x3a274d=0xce;}_0x492aef[_0xaa7a('0x30')](_0x3a274d);return _0x492aef['set'](_0xaa7a('0x37'),_0x38ae32+'-'+_0x4ffca2+'/'+_0xa0a513)['json'](_0x96f15c);}return null;};}function patchUpdates(_0x3d5d56){return function(_0xcaa9ee){try{jsonpatch[_0xaa7a('0x38')](_0xcaa9ee,_0x3d5d56,!![]);}catch(_0x5154a6){return BPromise['reject'](_0x5154a6);}return _0xcaa9ee[_0xaa7a('0x39')]();};}function saveUpdates(_0x43e9b0,_0x5148af){return function(_0x2c74ad){if(_0x2c74ad){return _0x2c74ad[_0xaa7a('0x3a')](_0x43e9b0)[_0xaa7a('0x25')](function(_0x4975f3){return _0x4975f3;});}return null;};}function removeEntity(_0x30bc0d,_0x122aef){return function(_0x21bb80){if(_0x21bb80){return _0x21bb80[_0xaa7a('0x3b')]()[_0xaa7a('0x25')](function(){_0x30bc0d[_0xaa7a('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2354e8,_0x5e363e){return function(_0x2dd124){if(!_0x2dd124){_0x2354e8[_0xaa7a('0x3c')](0x194);}return _0x2dd124;};}function handleError(_0x2022d1,_0x3ddda6){_0x3ddda6=_0x3ddda6||0x1f4;return function(_0x4a37a1){logger['error'](_0x4a37a1['stack']);if(_0x4a37a1[_0xaa7a('0x3d')]){delete _0x4a37a1[_0xaa7a('0x3d')];}_0x2022d1[_0xaa7a('0x30')](_0x3ddda6)[_0xaa7a('0x3e')](_0x4a37a1);};}exports[_0xaa7a('0x3f')]=function(_0x374b44,_0x3225b8){var _0x4bfea3={},_0x2459f8={},_0x497364={'count':0x0,'rows':[]};var _0x188f40=_[_0xaa7a('0x40')](db[_0xaa7a('0x41')][_0xaa7a('0x42')],function(_0x323b90){return{'name':_0x323b90[_0xaa7a('0x43')],'type':_0x323b90['type'][_0xaa7a('0x44')]};});_0x2459f8[_0xaa7a('0x45')]=_['map'](_0x188f40,_0xaa7a('0x3d'));_0x2459f8[_0xaa7a('0x46')]=_['keys'](_0x374b44[_0xaa7a('0x46')]);_0x2459f8['filters']=_[_0xaa7a('0x47')](_0x2459f8[_0xaa7a('0x45')],_0x2459f8[_0xaa7a('0x46')]);_0x4bfea3['attributes']=_['intersection'](_0x2459f8[_0xaa7a('0x45')],qs['fields'](_0x374b44[_0xaa7a('0x46')][_0xaa7a('0x48')]));_0x4bfea3[_0xaa7a('0x49')]=_0x4bfea3[_0xaa7a('0x49')][_0xaa7a('0x4a')]?_0x4bfea3['attributes']:_0x2459f8[_0xaa7a('0x45')];if(!_0x374b44[_0xaa7a('0x46')]['hasOwnProperty'](_0xaa7a('0x4b'))){_0x4bfea3['limit']=qs[_0xaa7a('0x35')](_0x374b44[_0xaa7a('0x46')][_0xaa7a('0x35')]);_0x4bfea3[_0xaa7a('0x33')]=qs[_0xaa7a('0x33')](_0x374b44[_0xaa7a('0x46')]['offset']);}_0x4bfea3[_0xaa7a('0x4c')]=qs[_0xaa7a('0x4d')](_0x374b44['query'][_0xaa7a('0x4d')]);_0x4bfea3[_0xaa7a('0x4e')]=qs[_0xaa7a('0x4f')](_[_0xaa7a('0x50')](_0x374b44['query'],_0x2459f8[_0xaa7a('0x4f')]),_0x188f40);if(_0x374b44[_0xaa7a('0x46')][_0xaa7a('0x51')]){_0x4bfea3['where']=_[_0xaa7a('0x52')](_0x4bfea3[_0xaa7a('0x4e')],{'$or':_[_0xaa7a('0x40')](_0x188f40,function(_0x1b769a){if(_0x1b769a['type']!==_0xaa7a('0x53')){var _0x15b58a={};_0x15b58a[_0x1b769a[_0xaa7a('0x3d')]]={'$like':'%'+_0x374b44['query'][_0xaa7a('0x51')]+'%'};return _0x15b58a;}})});}_0x4bfea3=_[_0xaa7a('0x52')]({},_0x4bfea3,_0x374b44[_0xaa7a('0x54')]);var _0x1b924b={'where':_0x4bfea3[_0xaa7a('0x4e')]};return db[_0xaa7a('0x41')][_0xaa7a('0x36')](_0x1b924b)['then'](function(_0x3a4367){_0x497364['count']=_0x3a4367;if(_0x374b44[_0xaa7a('0x46')][_0xaa7a('0x55')]){_0x4bfea3[_0xaa7a('0x56')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xaa7a('0x57')](_0x4bfea3);})['then'](function(_0x41819d){_0x497364[_0xaa7a('0x58')]=_0x41819d;return _0x497364;})[_0xaa7a('0x25')](respondWithFilteredResult(_0x3225b8,_0x4bfea3))[_0xaa7a('0x2f')](handleError(_0x3225b8,null));};exports[_0xaa7a('0x59')]=function(_0x49f5c9,_0x14b9c1){var _0x260e9d={'raw':!![],'where':{'id':_0x49f5c9['params']['id']}},_0x39a1ab={};_0x39a1ab['model']=_[_0xaa7a('0x5a')](db[_0xaa7a('0x41')]['rawAttributes']);_0x39a1ab['query']=_[_0xaa7a('0x5a')](_0x49f5c9[_0xaa7a('0x46')]);_0x39a1ab[_0xaa7a('0x4f')]=_[_0xaa7a('0x47')](_0x39a1ab['model'],_0x39a1ab[_0xaa7a('0x46')]);_0x260e9d[_0xaa7a('0x49')]=_['intersection'](_0x39a1ab[_0xaa7a('0x45')],qs[_0xaa7a('0x48')](_0x49f5c9['query'][_0xaa7a('0x48')]));_0x260e9d['attributes']=_0x260e9d[_0xaa7a('0x49')][_0xaa7a('0x4a')]?_0x260e9d[_0xaa7a('0x49')]:_0x39a1ab[_0xaa7a('0x45')];if(_0x49f5c9[_0xaa7a('0x46')][_0xaa7a('0x55')]){_0x260e9d[_0xaa7a('0x56')]=[{'all':!![]}];}_0x260e9d=_[_0xaa7a('0x52')]({},_0x260e9d,_0x49f5c9[_0xaa7a('0x54')]);return db[_0xaa7a('0x41')][_0xaa7a('0x5b')](_0x260e9d)[_0xaa7a('0x25')](handleEntityNotFound(_0x14b9c1,null))[_0xaa7a('0x25')](respondWithResult(_0x14b9c1,null))[_0xaa7a('0x2f')](handleError(_0x14b9c1,null));};exports['create']=function(_0x47be3c,_0x6e1a26){return db[_0xaa7a('0x41')][_0xaa7a('0x5c')](_0x47be3c[_0xaa7a('0x5d')],{})[_0xaa7a('0x25')](respondWithResult(_0x6e1a26,0xc9))[_0xaa7a('0x2f')](handleError(_0x6e1a26,null));};exports[_0xaa7a('0x3a')]=function(_0x401392,_0x27b9dd){if(_0x401392[_0xaa7a('0x5d')]['id']){delete _0x401392[_0xaa7a('0x5d')]['id'];}return db[_0xaa7a('0x41')][_0xaa7a('0x5b')]({'where':{'id':_0x401392[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x25')](handleEntityNotFound(_0x27b9dd,null))['then'](saveUpdates(_0x401392[_0xaa7a('0x5d')],null))[_0xaa7a('0x25')](respondWithResult(_0x27b9dd,null))[_0xaa7a('0x2f')](handleError(_0x27b9dd,null));};exports[_0xaa7a('0x3b')]=function(_0x452a28,_0xb04de4){return db['OpenchannelMessage'][_0xaa7a('0x5b')]({'where':{'id':_0x452a28[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x25')](handleEntityNotFound(_0xb04de4,null))[_0xaa7a('0x25')](removeEntity(_0xb04de4,null))[_0xaa7a('0x2f')](handleError(_0xb04de4,null));};exports[_0xaa7a('0x5f')]=function(_0x217e4e,_0x46323f){return db[_0xaa7a('0x41')]['describe']()[_0xaa7a('0x25')](respondWithResult(_0x46323f,null))[_0xaa7a('0x2f')](handleError(_0x46323f,null));};var interaction_log=require(_0xaa7a('0x60'))('openchannel-interactions');exports['accept']=function(_0x279dd6,_0x85a532,_0x16cd26){var _0x5633d0={'agent':{},'channel':_0xaa7a('0x61')};if(_0x279dd6[_0xaa7a('0x5d')]['id']){delete _0x279dd6[_0xaa7a('0x5d')]['id'];}_0x279dd6['body'][_0xaa7a('0x62')]=!![];_0x279dd6['body'][_0xaa7a('0x63')]=moment()[_0xaa7a('0x64')](_0xaa7a('0x65'));_0x279dd6['body']['UserId']=_0x279dd6['body']['UserId']||_0x279dd6['user']['id'];_0x5633d0[_0xaa7a('0x66')]['id']=_0x279dd6[_0xaa7a('0x5d')][_0xaa7a('0x67')];return db[_0xaa7a('0x41')][_0xaa7a('0x5b')]({'where':{'id':_0x279dd6[_0xaa7a('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x85a532,null))[_0xaa7a('0x25')](saveUpdates(_0x279dd6['body'],null))['then'](function(_0x1040f3){if(_0x1040f3){_0x5633d0['message']=_0x1040f3['get']({'plain':!![]});return db[_0xaa7a('0x68')]['find']({'where':{'id':_0x1040f3['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x85a532,null))[_0xaa7a('0x25')](function(_0x529c0a){if(_0x529c0a){return _0x529c0a[_0xaa7a('0x3a')]({'UserId':_0x279dd6['body'][_0xaa7a('0x67')],'read1stAt':_[_0xaa7a('0x69')](_0x529c0a[_0xaa7a('0x6a')])?moment()[_0xaa7a('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xaa7a('0x25')](function(_0x22ec28){if(_0x22ec28){_0x5633d0[_0xaa7a('0x6b')]=_0x22ec28['get']({'plain':!![]});interaction_log[_0xaa7a('0x2e')](_0xaa7a('0x6c'),_0x279dd6[_0xaa7a('0x6d')]['id'],_0x279dd6[_0xaa7a('0x6d')]['name'],_0x279dd6[_0xaa7a('0x6d')][_0xaa7a('0x6e')],_0x5633d0[_0xaa7a('0x6b')]['id'],_0x279dd6[_0xaa7a('0x5d')]?JSON['stringify'](_0x279dd6[_0xaa7a('0x5d')]):'null');return respondWithRpcPromise(_0xaa7a('0x6f'),'acceptMessage',_0x5633d0);}return null;})[_0xaa7a('0x25')](function(_0x5839dc){var _0x142b1c=_0xaa7a('0x70')+_0x5839dc[_0xaa7a('0x2d')][_0xaa7a('0x71')];return db[_0xaa7a('0x72')][_0xaa7a('0x46')](_0x142b1c,{'type':db[_0xaa7a('0x73')][_0xaa7a('0x74')][_0xaa7a('0x75')],'raw':!![]})[_0xaa7a('0x25')](function(_0x3932c8){return _0x3932c8;});})['then'](function(_0xfe38ee){if(_0xfe38ee){_0x5633d0[_0xaa7a('0x2d')][_0xaa7a('0x76')]=_0xfe38ee[0x0];if(!_0x279dd6[_0xaa7a('0x5d')][_0xaa7a('0x67')])return;return db[_0xaa7a('0x77')][_0xaa7a('0x5b')]({'where':{'id':_0x279dd6[_0xaa7a('0x5d')][_0xaa7a('0x67')],'role':_0xaa7a('0x66')},'attributes':['id',_0xaa7a('0x3d'),_0xaa7a('0x78'),_0xaa7a('0x79'),_0xaa7a('0x7a')],'raw':!![]});}return null;})[_0xaa7a('0x25')](function(_0x39fd2f){if(!_0x39fd2f)return null;_0x5633d0['message']['agent']=_0x39fd2f;return _0x5633d0;})[_0xaa7a('0x25')](function(_0x2771e2){if(_0x2771e2){if(_0x279dd6[_0xaa7a('0x5d')][_0xaa7a('0x7b')]){_0x5633d0[_0xaa7a('0x2d')][_0xaa7a('0x7c')]=util['format'](_0xaa7a('0x7d'),_0x279dd6[_0xaa7a('0x6d')][_0xaa7a('0x3d')]);_0x5633d0[_0xaa7a('0x2d')][_0xaa7a('0x7e')]=_0x5633d0[_0xaa7a('0x7e')];_0x5633d0[_0xaa7a('0x2d')]['motionChannel']=_0x5633d0[_0xaa7a('0x7e')];_0x5633d0[_0xaa7a('0x2d')][_0xaa7a('0x7f')]=_0xaa7a('0x80');return respondWithRpcPromise('EventManager',_0xaa7a('0x81'),{'event':_0xaa7a('0x82'),'message':_0x5633d0['message']},client9002)[_0xaa7a('0x25')](function(){return _0x5633d0;});}return _0x5633d0;}return null;})[_0xaa7a('0x25')](respondWithResult(_0x85a532,null))[_0xaa7a('0x2f')](handleError(_0x85a532,null));};var interaction_log=require(_0xaa7a('0x60'))(_0xaa7a('0x83'));exports[_0xaa7a('0x84')]=function(_0x4e13ce,_0x1e0b55,_0x15445c){var _0x3dd67a={'agent':{},'channel':_0xaa7a('0x61')};if(_0x4e13ce[_0xaa7a('0x5d')]['id']){delete _0x4e13ce[_0xaa7a('0x5d')]['id'];}_0x4e13ce[_0xaa7a('0x5d')][_0xaa7a('0x67')]=_0x4e13ce[_0xaa7a('0x5d')][_0xaa7a('0x67')]||_0x4e13ce[_0xaa7a('0x6d')]['id'];_0x3dd67a[_0xaa7a('0x66')]['id']=_0x4e13ce[_0xaa7a('0x5d')][_0xaa7a('0x67')];return db['OpenchannelMessage'][_0xaa7a('0x5b')]({'where':{'id':_0x4e13ce[_0xaa7a('0x5e')]['id'],'UserId':null}})[_0xaa7a('0x25')](handleEntityNotFound(_0x1e0b55,null))['then'](function(_0x4c88da){if(_0x4c88da){_0x3dd67a[_0xaa7a('0x2d')]=_0x4c88da[_0xaa7a('0x85')]({'plain':!![]});return db[_0xaa7a('0x68')]['find']({'where':{'id':_0x4c88da[_0xaa7a('0x86')]}});}return null;})[_0xaa7a('0x25')](handleEntityNotFound(_0x1e0b55,null))[_0xaa7a('0x25')](function(_0x41f11c){if(_0x41f11c){_0x3dd67a[_0xaa7a('0x6b')]=_0x41f11c[_0xaa7a('0x85')]({'plain':!![]});interaction_log['info'](_0xaa7a('0x87'),_0x4e13ce[_0xaa7a('0x6d')]['id'],_0x4e13ce['user'][_0xaa7a('0x3d')],_0x4e13ce[_0xaa7a('0x6d')]['role'],_0x3dd67a['interaction']['id'],_0x4e13ce[_0xaa7a('0x5d')]?JSON[_0xaa7a('0x2a')](_0x4e13ce[_0xaa7a('0x5d')]):_0xaa7a('0x88'));return respondWithRpcPromise(_0xaa7a('0x89'),_0xaa7a('0x8a'),_0x3dd67a);}return null;})['then'](function(_0x53efab){var _0x1d6a44=_0xaa7a('0x70')+_0x53efab[_0xaa7a('0x2d')][_0xaa7a('0x71')];return db[_0xaa7a('0x72')][_0xaa7a('0x46')](_0x1d6a44,{'type':db[_0xaa7a('0x73')][_0xaa7a('0x74')][_0xaa7a('0x75')],'raw':!![]})[_0xaa7a('0x25')](function(_0x411c81){return _0x411c81;});})['then'](function(_0x3c5fae){if(_0x3c5fae){_0x3dd67a['message'][_0xaa7a('0x76')]=_0x3c5fae[0x0];if(!_0x4e13ce['body'][_0xaa7a('0x67')])return;return db[_0xaa7a('0x77')][_0xaa7a('0x5b')]({'where':{'id':_0x4e13ce[_0xaa7a('0x5d')]['UserId'],'role':_0xaa7a('0x66')},'attributes':['id',_0xaa7a('0x3d'),_0xaa7a('0x78'),_0xaa7a('0x79'),'internal'],'raw':!![]});}return null;})[_0xaa7a('0x25')](function(_0x1d36a2){if(!_0x1d36a2)return null;_0x3dd67a[_0xaa7a('0x2d')][_0xaa7a('0x66')]=_0x1d36a2;return _0x3dd67a;})[_0xaa7a('0x25')](function(_0x179f59){if(_0x179f59){_0x179f59[_0xaa7a('0x2d')][_0xaa7a('0x7c')]=util['format'](_0xaa7a('0x7d'),_0x4e13ce[_0xaa7a('0x6d')][_0xaa7a('0x3d')]);_0x179f59[_0xaa7a('0x2d')]['channel']=_0x3dd67a[_0xaa7a('0x7e')];_0x179f59[_0xaa7a('0x2d')][_0xaa7a('0x8b')]=_0x3dd67a[_0xaa7a('0x7e')];_0x179f59['message'][_0xaa7a('0x7f')]=_0xaa7a('0x84');respondWithRpcPromise(_0xaa7a('0x81'),_0xaa7a('0x81'),{'event':_0xaa7a('0x8c'),'message':_0x179f59[_0xaa7a('0x2d')]},client9002);return _0x3dd67a;}return null;})[_0xaa7a('0x25')](respondWithResult(_0x1e0b55,null))[_0xaa7a('0x2f')](handleError(_0x1e0b55,null));}; \ No newline at end of file +var _0xf9d9=['reject','rejectmessage','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf9d9,0x182));var _0x9f9d=function(_0x401ec9,_0x77c73f){_0x401ec9=_0x401ec9-0x0;var _0x8ef3a1=_0xf9d9[_0x401ec9];return _0x8ef3a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f9d('0x0'));var jsonpatch=require(_0x9f9d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f9d('0x2'));var Mustache=require(_0x9f9d('0x3'));var util=require(_0x9f9d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x9f9d('0x5'));var ejs=require(_0x9f9d('0x6'));var fs=require('fs');var fs_extra=require(_0x9f9d('0x7'));var _=require('lodash');var squel=require(_0x9f9d('0x8'));var crypto=require(_0x9f9d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9f9d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f9d('0xb'));var Redis=require(_0x9f9d('0xc'));var authService=require(_0x9f9d('0xd'));var qs=require(_0x9f9d('0xe'));var as=require(_0x9f9d('0xf'));var hardwareService=require(_0x9f9d('0x10'));var logger=require(_0x9f9d('0x11'))('api');var utils=require(_0x9f9d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9f9d('0x13'));var db=require(_0x9f9d('0x14'))['db'];config[_0x9f9d('0x15')]=_[_0x9f9d('0x16')](config[_0x9f9d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f9d('0x17'))(new Redis(config[_0x9f9d('0x15')]));require(_0x9f9d('0x18'))[_0x9f9d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9f9d('0x1a')][_0x9f9d('0x1b')]({'port':0x232c});var client9002=jayson[_0x9f9d('0x1a')][_0x9f9d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x54b6bd,_0x107fe8,_0x746654,_0x3d7902){return new BPromise(function(_0x21d6f3,_0x3203bb){var _0x5613f5=_0x3d7902||client;return _0x5613f5['request'](_0x54b6bd,_0x746654)['then'](function(_0x52d144){logger[_0x9f9d('0x1c')](_0x9f9d('0x1d'),_0x107fe8,_0x9f9d('0x1e'));logger[_0x9f9d('0x1f')](_0x9f9d('0x20'),_0x107fe8,'request\x20sent',JSON[_0x9f9d('0x21')](_0x52d144));if(_0x52d144[_0x9f9d('0x22')]){if(_0x52d144[_0x9f9d('0x22')][_0x9f9d('0x23')]===0x1f4){logger['error'](_0x9f9d('0x1d'),_0x107fe8,_0x52d144[_0x9f9d('0x22')][_0x9f9d('0x24')]);return _0x3203bb(_0x52d144['error']['message']);}logger['error'](_0x9f9d('0x1d'),_0x107fe8,_0x52d144['error'][_0x9f9d('0x24')]);return _0x21d6f3(_0x52d144[_0x9f9d('0x22')][_0x9f9d('0x24')]);}else{logger[_0x9f9d('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x107fe8,_0x9f9d('0x1e'));_0x21d6f3(_0x52d144['result'][_0x9f9d('0x24')]);}})[_0x9f9d('0x25')](function(_0x5119d4){logger[_0x9f9d('0x22')](_0x9f9d('0x1d'),_0x107fe8,_0x5119d4);_0x3203bb(_0x5119d4);});});}function respondWithStatusCode(_0x5cc76c,_0x3fc841){_0x3fc841=_0x3fc841||0xcc;return function(_0x590905){if(_0x590905){return _0x5cc76c[_0x9f9d('0x26')](_0x3fc841);}return _0x5cc76c['status'](_0x3fc841)[_0x9f9d('0x27')]();};}function respondWithResult(_0x15d1ba,_0x2c0d6d){_0x2c0d6d=_0x2c0d6d||0xc8;return function(_0x3e063d){if(_0x3e063d){return _0x15d1ba[_0x9f9d('0x28')](_0x2c0d6d)['json'](_0x3e063d);}};}function respondWithFilteredResult(_0x11b0b0,_0x10d8cd){return function(_0xf3ac74){if(_0xf3ac74){var _0x508089=typeof _0x10d8cd[_0x9f9d('0x29')]===_0x9f9d('0x2a')&&typeof _0x10d8cd[_0x9f9d('0x2b')]==='undefined';var _0x3e55f7=_0xf3ac74['count'];var _0x1514d5=_0x508089?0x0:_0x10d8cd['offset'];var _0x338fab=_0x508089?_0xf3ac74[_0x9f9d('0x2c')]:_0x10d8cd[_0x9f9d('0x29')]+_0x10d8cd[_0x9f9d('0x2b')];var _0x396b39;if(_0x338fab>=_0x3e55f7){_0x338fab=_0x3e55f7;_0x396b39=0xc8;}else{_0x396b39=0xce;}_0x11b0b0[_0x9f9d('0x28')](_0x396b39);return _0x11b0b0[_0x9f9d('0x2d')](_0x9f9d('0x2e'),_0x1514d5+'-'+_0x338fab+'/'+_0x3e55f7)[_0x9f9d('0x2f')](_0xf3ac74);}return null;};}function patchUpdates(_0x3e4119){return function(_0x3e77a1){try{jsonpatch['apply'](_0x3e77a1,_0x3e4119,!![]);}catch(_0x54f791){return BPromise['reject'](_0x54f791);}return _0x3e77a1['save']();};}function saveUpdates(_0x2cd199,_0xa6cffa){return function(_0x3a1fa0){if(_0x3a1fa0){return _0x3a1fa0[_0x9f9d('0x30')](_0x2cd199)[_0x9f9d('0x31')](function(_0x5635d3){return _0x5635d3;});}return null;};}function removeEntity(_0x241de7,_0x207ca4){return function(_0x2580ec){if(_0x2580ec){return _0x2580ec['destroy']()[_0x9f9d('0x31')](function(){_0x241de7[_0x9f9d('0x28')](0xcc)[_0x9f9d('0x27')]();});}};}function handleEntityNotFound(_0x2345d5,_0x2bce19){return function(_0xb4a2fa){if(!_0xb4a2fa){_0x2345d5['sendStatus'](0x194);}return _0xb4a2fa;};}function handleError(_0x3f35db,_0x3d57ed){_0x3d57ed=_0x3d57ed||0x1f4;return function(_0x38fc1a){logger['error'](_0x38fc1a['stack']);if(_0x38fc1a[_0x9f9d('0x32')]){delete _0x38fc1a[_0x9f9d('0x32')];}_0x3f35db[_0x9f9d('0x28')](_0x3d57ed)[_0x9f9d('0x33')](_0x38fc1a);};}exports[_0x9f9d('0x34')]=function(_0xd381e4,_0x3b6b87){var _0x35a485={},_0x271c05={},_0xda30cf={'count':0x0,'rows':[]};var _0x442343=_[_0x9f9d('0x35')](db['OpenchannelMessage']['rawAttributes'],function(_0x1c6f17){return{'name':_0x1c6f17[_0x9f9d('0x36')],'type':_0x1c6f17[_0x9f9d('0x37')][_0x9f9d('0x38')]};});_0x271c05[_0x9f9d('0x39')]=_[_0x9f9d('0x35')](_0x442343,_0x9f9d('0x32'));_0x271c05[_0x9f9d('0x3a')]=_[_0x9f9d('0x3b')](_0xd381e4[_0x9f9d('0x3a')]);_0x271c05[_0x9f9d('0x3c')]=_[_0x9f9d('0x3d')](_0x271c05[_0x9f9d('0x39')],_0x271c05[_0x9f9d('0x3a')]);_0x35a485[_0x9f9d('0x3e')]=_[_0x9f9d('0x3d')](_0x271c05[_0x9f9d('0x39')],qs[_0x9f9d('0x3f')](_0xd381e4[_0x9f9d('0x3a')]['fields']));_0x35a485['attributes']=_0x35a485[_0x9f9d('0x3e')][_0x9f9d('0x40')]?_0x35a485[_0x9f9d('0x3e')]:_0x271c05[_0x9f9d('0x39')];if(!_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x41')](_0x9f9d('0x42'))){_0x35a485[_0x9f9d('0x2b')]=qs[_0x9f9d('0x2b')](_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x2b')]);_0x35a485[_0x9f9d('0x29')]=qs['offset'](_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x29')]);}_0x35a485[_0x9f9d('0x43')]=qs[_0x9f9d('0x44')](_0xd381e4[_0x9f9d('0x3a')]['sort']);_0x35a485['where']=qs[_0x9f9d('0x3c')](_[_0x9f9d('0x45')](_0xd381e4[_0x9f9d('0x3a')],_0x271c05['filters']),_0x442343);if(_0xd381e4[_0x9f9d('0x3a')]['filter']){_0x35a485[_0x9f9d('0x46')]=_[_0x9f9d('0x47')](_0x35a485['where'],{'$or':_[_0x9f9d('0x35')](_0x442343,function(_0x2963a0){if(_0x2963a0[_0x9f9d('0x37')]!==_0x9f9d('0x48')){var _0x1bdf0a={};_0x1bdf0a[_0x2963a0[_0x9f9d('0x32')]]={'$like':'%'+_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x49')]+'%'};return _0x1bdf0a;}})});}_0x35a485=_['merge']({},_0x35a485,_0xd381e4[_0x9f9d('0x4a')]);var _0x409acd={'where':_0x35a485['where']};return db[_0x9f9d('0x4b')][_0x9f9d('0x2c')](_0x409acd)[_0x9f9d('0x31')](function(_0xe770d5){_0xda30cf[_0x9f9d('0x2c')]=_0xe770d5;if(_0xd381e4[_0x9f9d('0x3a')][_0x9f9d('0x4c')]){_0x35a485[_0x9f9d('0x4d')]=[{'all':!![]}];}return db[_0x9f9d('0x4b')][_0x9f9d('0x4e')](_0x35a485);})['then'](function(_0x47d60b){_0xda30cf[_0x9f9d('0x4f')]=_0x47d60b;return _0xda30cf;})[_0x9f9d('0x31')](respondWithFilteredResult(_0x3b6b87,_0x35a485))[_0x9f9d('0x25')](handleError(_0x3b6b87,null));};exports[_0x9f9d('0x50')]=function(_0x4a8299,_0x17762e){var _0x303e47={'raw':!![],'where':{'id':_0x4a8299[_0x9f9d('0x51')]['id']}},_0x5ed5fb={};_0x5ed5fb[_0x9f9d('0x39')]=_[_0x9f9d('0x3b')](db[_0x9f9d('0x4b')][_0x9f9d('0x52')]);_0x5ed5fb[_0x9f9d('0x3a')]=_['keys'](_0x4a8299[_0x9f9d('0x3a')]);_0x5ed5fb[_0x9f9d('0x3c')]=_[_0x9f9d('0x3d')](_0x5ed5fb['model'],_0x5ed5fb['query']);_0x303e47[_0x9f9d('0x3e')]=_[_0x9f9d('0x3d')](_0x5ed5fb['model'],qs[_0x9f9d('0x3f')](_0x4a8299['query'][_0x9f9d('0x3f')]));_0x303e47[_0x9f9d('0x3e')]=_0x303e47['attributes'][_0x9f9d('0x40')]?_0x303e47[_0x9f9d('0x3e')]:_0x5ed5fb[_0x9f9d('0x39')];if(_0x4a8299[_0x9f9d('0x3a')][_0x9f9d('0x4c')]){_0x303e47[_0x9f9d('0x4d')]=[{'all':!![]}];}_0x303e47=_[_0x9f9d('0x47')]({},_0x303e47,_0x4a8299[_0x9f9d('0x4a')]);return db['OpenchannelMessage'][_0x9f9d('0x53')](_0x303e47)[_0x9f9d('0x31')](handleEntityNotFound(_0x17762e,null))['then'](respondWithResult(_0x17762e,null))[_0x9f9d('0x25')](handleError(_0x17762e,null));};exports[_0x9f9d('0x54')]=function(_0x50b186,_0x3bf7de){return db[_0x9f9d('0x4b')][_0x9f9d('0x54')](_0x50b186[_0x9f9d('0x55')],{})[_0x9f9d('0x31')](respondWithResult(_0x3bf7de,0xc9))[_0x9f9d('0x25')](handleError(_0x3bf7de,null));};exports[_0x9f9d('0x30')]=function(_0x876440,_0x3be5a3){if(_0x876440['body']['id']){delete _0x876440[_0x9f9d('0x55')]['id'];}return db[_0x9f9d('0x4b')][_0x9f9d('0x53')]({'where':{'id':_0x876440['params']['id']}})[_0x9f9d('0x31')](handleEntityNotFound(_0x3be5a3,null))[_0x9f9d('0x31')](saveUpdates(_0x876440[_0x9f9d('0x55')],null))[_0x9f9d('0x31')](respondWithResult(_0x3be5a3,null))[_0x9f9d('0x25')](handleError(_0x3be5a3,null));};exports['destroy']=function(_0x520769,_0x197385){return db[_0x9f9d('0x4b')]['find']({'where':{'id':_0x520769[_0x9f9d('0x51')]['id']}})[_0x9f9d('0x31')](handleEntityNotFound(_0x197385,null))['then'](removeEntity(_0x197385,null))[_0x9f9d('0x25')](handleError(_0x197385,null));};exports[_0x9f9d('0x56')]=function(_0x515649,_0x442ca3){return db['OpenchannelMessage'][_0x9f9d('0x56')]()[_0x9f9d('0x31')](respondWithResult(_0x442ca3,null))[_0x9f9d('0x25')](handleError(_0x442ca3,null));};var interaction_log=require(_0x9f9d('0x11'))(_0x9f9d('0x57'));exports['accept']=function(_0x5a2c1c,_0x267d9a,_0x41a329){var _0x55f6b9={'agent':{},'channel':_0x9f9d('0x58')};if(_0x5a2c1c[_0x9f9d('0x55')]['id']){delete _0x5a2c1c[_0x9f9d('0x55')]['id'];}_0x5a2c1c['body'][_0x9f9d('0x59')]=!![];_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5a')]=moment()[_0x9f9d('0x5b')](_0x9f9d('0x5c'));_0x5a2c1c['body'][_0x9f9d('0x5d')]=_0x5a2c1c['body'][_0x9f9d('0x5d')]||_0x5a2c1c[_0x9f9d('0x5e')]['id'];_0x55f6b9[_0x9f9d('0x5f')]['id']=_0x5a2c1c[_0x9f9d('0x55')]['UserId'];return db['OpenchannelMessage'][_0x9f9d('0x53')]({'where':{'id':_0x5a2c1c[_0x9f9d('0x51')]['id'],'UserId':null}})[_0x9f9d('0x31')](handleEntityNotFound(_0x267d9a,null))[_0x9f9d('0x31')](saveUpdates(_0x5a2c1c[_0x9f9d('0x55')],null))[_0x9f9d('0x31')](function(_0x502ea7){if(_0x502ea7){_0x55f6b9[_0x9f9d('0x24')]=_0x502ea7['get']({'plain':!![]});return db[_0x9f9d('0x60')][_0x9f9d('0x53')]({'where':{'id':_0x502ea7[_0x9f9d('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x267d9a,null))[_0x9f9d('0x31')](function(_0x352990){if(_0x352990){return _0x352990['update']({'UserId':_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5d')],'read1stAt':_[_0x9f9d('0x62')](_0x352990[_0x9f9d('0x63')])?moment()[_0x9f9d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x19ebc5){if(_0x19ebc5){_0x55f6b9[_0x9f9d('0x64')]=_0x19ebc5[_0x9f9d('0x65')]({'plain':!![]});interaction_log[_0x9f9d('0x1c')](_0x9f9d('0x66'),_0x5a2c1c[_0x9f9d('0x5e')]['id'],_0x5a2c1c[_0x9f9d('0x5e')]['name'],_0x5a2c1c[_0x9f9d('0x5e')][_0x9f9d('0x67')],_0x55f6b9['interaction']['id'],_0x5a2c1c['body']?JSON[_0x9f9d('0x21')](_0x5a2c1c[_0x9f9d('0x55')]):'null');return respondWithRpcPromise(_0x9f9d('0x68'),_0x9f9d('0x69'),_0x55f6b9);}return null;})[_0x9f9d('0x31')](function(_0x3984cc){var _0x2e6dba=_0x9f9d('0x6a')+_0x3984cc[_0x9f9d('0x24')][_0x9f9d('0x6b')];return db[_0x9f9d('0x6c')][_0x9f9d('0x3a')](_0x2e6dba,{'type':db[_0x9f9d('0x6d')]['QueryTypes'][_0x9f9d('0x6e')],'raw':!![]})['then'](function(_0xa160e2){return _0xa160e2;});})[_0x9f9d('0x31')](function(_0x23bd08){if(_0x23bd08){_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x6f')]=_0x23bd08[0x0];if(!_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5d')])return;return db[_0x9f9d('0x70')][_0x9f9d('0x53')]({'where':{'id':_0x5a2c1c[_0x9f9d('0x55')][_0x9f9d('0x5d')],'role':'agent'},'attributes':['id',_0x9f9d('0x32'),_0x9f9d('0x71'),_0x9f9d('0x72'),_0x9f9d('0x73')],'raw':!![]});}return null;})[_0x9f9d('0x31')](function(_0x4a7f66){if(!_0x4a7f66)return null;_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x5f')]=_0x4a7f66;return _0x55f6b9;})[_0x9f9d('0x31')](function(_0x3eff04){if(_0x3eff04){if(_0x5a2c1c['body'][_0x9f9d('0x74')]){_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x75')]=util[_0x9f9d('0x5b')](_0x9f9d('0x76'),_0x5a2c1c[_0x9f9d('0x5e')]['name']);_0x55f6b9['message'][_0x9f9d('0x77')]=_0x55f6b9[_0x9f9d('0x77')];_0x55f6b9[_0x9f9d('0x24')][_0x9f9d('0x78')]=_0x55f6b9[_0x9f9d('0x77')];_0x55f6b9[_0x9f9d('0x24')]['event']=_0x9f9d('0x79');return respondWithRpcPromise(_0x9f9d('0x7a'),_0x9f9d('0x7a'),{'event':'acceptmessage','message':_0x55f6b9[_0x9f9d('0x24')]},client9002)[_0x9f9d('0x31')](function(){return _0x55f6b9;});}return _0x55f6b9;}return null;})['then'](respondWithResult(_0x267d9a,null))[_0x9f9d('0x25')](handleError(_0x267d9a,null));};var interaction_log=require(_0x9f9d('0x11'))('openchannel-interactions');exports['reject']=function(_0x4d4a6e,_0x48de36,_0x1d66a8){var _0x41c229={'agent':{},'channel':_0x9f9d('0x58')};if(_0x4d4a6e[_0x9f9d('0x55')]['id']){delete _0x4d4a6e['body']['id'];}_0x4d4a6e[_0x9f9d('0x55')][_0x9f9d('0x5d')]=_0x4d4a6e[_0x9f9d('0x55')][_0x9f9d('0x5d')]||_0x4d4a6e[_0x9f9d('0x5e')]['id'];_0x41c229['agent']['id']=_0x4d4a6e[_0x9f9d('0x55')]['UserId'];return db[_0x9f9d('0x4b')][_0x9f9d('0x53')]({'where':{'id':_0x4d4a6e[_0x9f9d('0x51')]['id'],'UserId':null}})[_0x9f9d('0x31')](handleEntityNotFound(_0x48de36,null))['then'](function(_0x51ebc1){if(_0x51ebc1){_0x41c229[_0x9f9d('0x24')]=_0x51ebc1['get']({'plain':!![]});return db[_0x9f9d('0x60')][_0x9f9d('0x53')]({'where':{'id':_0x51ebc1[_0x9f9d('0x61')]}});}return null;})[_0x9f9d('0x31')](handleEntityNotFound(_0x48de36,null))['then'](function(_0x20d54a){if(_0x20d54a){_0x41c229['interaction']=_0x20d54a[_0x9f9d('0x65')]({'plain':!![]});interaction_log['info'](_0x9f9d('0x7b'),_0x4d4a6e[_0x9f9d('0x5e')]['id'],_0x4d4a6e[_0x9f9d('0x5e')][_0x9f9d('0x32')],_0x4d4a6e[_0x9f9d('0x5e')][_0x9f9d('0x67')],_0x41c229[_0x9f9d('0x64')]['id'],_0x4d4a6e[_0x9f9d('0x55')]?JSON[_0x9f9d('0x21')](_0x4d4a6e[_0x9f9d('0x55')]):'null');return respondWithRpcPromise(_0x9f9d('0x7c'),_0x9f9d('0x7d'),_0x41c229);}return null;})[_0x9f9d('0x31')](function(_0x2a3569){var _0x12a095=_0x9f9d('0x6a')+_0x2a3569[_0x9f9d('0x24')][_0x9f9d('0x6b')];return db[_0x9f9d('0x6c')][_0x9f9d('0x3a')](_0x12a095,{'type':db[_0x9f9d('0x6d')]['QueryTypes'][_0x9f9d('0x6e')],'raw':!![]})['then'](function(_0x4806a3){return _0x4806a3;});})[_0x9f9d('0x31')](function(_0x53e9f6){if(_0x53e9f6){_0x41c229['message'][_0x9f9d('0x6f')]=_0x53e9f6[0x0];if(!_0x4d4a6e[_0x9f9d('0x55')]['UserId'])return;return db[_0x9f9d('0x70')]['find']({'where':{'id':_0x4d4a6e[_0x9f9d('0x55')]['UserId'],'role':_0x9f9d('0x5f')},'attributes':['id',_0x9f9d('0x32'),_0x9f9d('0x71'),_0x9f9d('0x72'),_0x9f9d('0x73')],'raw':!![]});}return null;})[_0x9f9d('0x31')](function(_0x424a6a){if(!_0x424a6a)return null;_0x41c229[_0x9f9d('0x24')][_0x9f9d('0x5f')]=_0x424a6a;return _0x41c229;})[_0x9f9d('0x31')](function(_0x10ceb0){if(_0x10ceb0){_0x10ceb0[_0x9f9d('0x24')][_0x9f9d('0x75')]=util[_0x9f9d('0x5b')](_0x9f9d('0x76'),_0x4d4a6e[_0x9f9d('0x5e')][_0x9f9d('0x32')]);_0x10ceb0['message'][_0x9f9d('0x77')]=_0x41c229[_0x9f9d('0x77')];_0x10ceb0[_0x9f9d('0x24')]['motionChannel']=_0x41c229[_0x9f9d('0x77')];_0x10ceb0[_0x9f9d('0x24')]['event']=_0x9f9d('0x7e');respondWithRpcPromise(_0x9f9d('0x7a'),_0x9f9d('0x7a'),{'event':_0x9f9d('0x7f'),'message':_0x10ceb0[_0x9f9d('0x24')]},client9002);return _0x41c229;}return null;})[_0x9f9d('0x31')](respondWithResult(_0x48de36,null))['catch'](handleError(_0x48de36,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6a88490..748b27f 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 _0x1aee=['events','../../mysqldb','OpenchannelMessage','save','update','remove','emit','exports'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x1aee,0x1d0));var _0xe1ae=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x1aee[_0x305486];return _0xa04940;};'use strict';var EventEmitter=require(_0xe1ae('0x0'));var OpenchannelMessage=require(_0xe1ae('0x1'))['db'][_0xe1ae('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1ae('0x3'),'afterUpdate':_0xe1ae('0x4'),'afterDestroy':_0xe1ae('0x5')};function emitEvent(_0x4f450f){return function(_0x3c0db6,_0x5d2e12,_0x449ce4){OpenchannelMessageEvents['emit'](_0x4f450f+':'+_0x3c0db6['id'],_0x3c0db6);OpenchannelMessageEvents[_0xe1ae('0x6')](_0x4f450f,_0x3c0db6);_0x449ce4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xe1ae('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x460a=['emit','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x5d113d,_0x56e44c){var _0xb85406=function(_0x50440e){while(--_0x50440e){_0x5d113d['push'](_0x5d113d['shift']());}};_0xb85406(++_0x56e44c);}(_0x460a,0x10f));var _0xa460=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x460a[_0x56608c];return _0x3c7fb0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xa460('0x0'))['db'][_0xa460('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa460('0x2')](0x0);var events={'afterCreate':_0xa460('0x3'),'afterUpdate':_0xa460('0x4'),'afterDestroy':'remove'};function emitEvent(_0x206b8b){return function(_0xf343b9,_0x44ecfb,_0x22d09c){OpenchannelMessageEvents[_0xa460('0x5')](_0x206b8b+':'+_0xf343b9['id'],_0xf343b9);OpenchannelMessageEvents[_0xa460('0x5')](_0x206b8b,_0xf343b9);_0x22d09c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cf3899d..ae0becb 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 _0x8129=['body','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','replyUri','length','omit','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8129,0x130));var _0x9812=function(_0x4c90e2,_0x112264){_0x4c90e2=_0x4c90e2-0x0;var _0x2cef7c=_0x8129[_0x4c90e2];return _0x2cef7c;};'use strict';var _=require('lodash');var util=require(_0x9812('0x0'));var logger=require(_0x9812('0x1'))('api');var moment=require(_0x9812('0x2'));var BPromise=require(_0x9812('0x3'));var rp=require(_0x9812('0x4'));var fs=require('fs');var path=require(_0x9812('0x5'));var rimraf=require(_0x9812('0x6'));var config=require(_0x9812('0x7'));var attributes=require(_0x9812('0x8'));module[_0x9812('0x9')]=function(_0x3fd90b,_0x23f379){return _0x3fd90b[_0x9812('0xa')](_0x9812('0xb'),attributes,{'tableName':_0x9812('0xc'),'paranoid':![],'indexes':[{'name':_0x9812('0xd'),'fields':[_0x9812('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16e3c3,_0x578ef3,_0x4ef1e5){var _0x548d1a=_0x3fd90b['models'];var _0xa8dcbd=_0x16e3c3[_0x9812('0xf')]({'plain':!![]});if(_0xa8dcbd[_0x9812('0x10')][_0x9812('0x11')]()==='in'||_0xa8dcbd[_0x9812('0x10')]['toLowerCase']()===_0x9812('0x12')&&!_0xa8dcbd[_0x9812('0x13')]&&!_[_0x9812('0x14')](_0xa8dcbd[_0x9812('0x15')])){_0x548d1a['OpenchannelInteraction'][_0x9812('0x16')]({'where':{'id':_0xa8dcbd[_0x9812('0x17')]}})['then'](function(_0x314047){if(_0x314047){_0x314047[_0x9812('0x18')]({'lastMsgAt':_0xa8dcbd[_0x9812('0x19')],'lastMsgDirection':_0xa8dcbd[_0x9812('0x10')][_0x9812('0x11')]()});}})[_0x9812('0x1a')](function(_0x1705c5){console[_0x9812('0x1b')](_0x1705c5);});}if(_0xa8dcbd[_0x9812('0x10')]===_0x9812('0x12')&&!_0xa8dcbd[_0x9812('0x13')]){var _0x53c2c4;_0x548d1a[_0x9812('0x1c')]['describe']()[_0x9812('0x1d')](function(_0x2720d9){return _0x548d1a[_0x9812('0x1e')]['find']({'where':{'id':_0xa8dcbd[_0x9812('0x1f')]},'include':[{'model':_0x548d1a[_0x9812('0x20')],'as':_0x9812('0x21'),'where':{'id':_0xa8dcbd[_0x9812('0x17')]},'limit':0x1,'include':[{'model':_0x548d1a[_0x9812('0x1c')],'as':'Contact','attributes':_[_0x9812('0x22')](_0x2720d9)}]}]});})[_0x9812('0x1d')](function(_0x425c4d){_0x53c2c4=_0x425c4d['get']({'plain':!![]});if(_0x53c2c4&&_0x53c2c4['replyUri']){logger[_0x9812('0x23')](_0x9812('0x24'),_0x9812('0x25'),util[_0x9812('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0xa8dcbd['id'],_0x53c2c4[_0x9812('0x27')]));if(_0x53c2c4[_0x9812('0x21')]&&_0x53c2c4[_0x9812('0x21')][_0x9812('0x28')]){_0xa8dcbd['Interaction']=_[_0x9812('0x29')](_0x53c2c4[_0x9812('0x21')][0x0],_0x9812('0x2a'));_0xa8dcbd[_0x9812('0x2a')]=_0x53c2c4[_0x9812('0x21')][0x0]['Contact'];}var _0x578ef3={'method':_0x9812('0x2b'),'uri':encodeURI(_0x53c2c4[_0x9812('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x578ef3[_0x9812('0x2c')]){case _0x9812('0x2d'):_0x578ef3['qs']=_0xa8dcbd;break;case'POST':_0x578ef3[_0x9812('0xe')]=_0xa8dcbd;break;}return rp(_0x578ef3)[_0x9812('0x1d')](function(_0x773638){logger[_0x9812('0x23')](_0x9812('0x24'),_0x9812('0x25'),util[_0x9812('0x26')](_0x9812('0x2e'),_0xa8dcbd['id'],_0x53c2c4[_0x9812('0x27')]));if(_0x773638[_0x9812('0xe')]['threadId']&&_0x773638[_0x9812('0xe')][_0x9812('0x2f')]!=_0xa8dcbd[_0x9812('0x30')]['threadId']){return _0x548d1a[_0x9812('0x20')][_0x9812('0x18')]({'threadId':_0x773638['body'][_0x9812('0x2f')]},{'where':{'id':_0xa8dcbd[_0x9812('0x30')]['id']}});}else{return;}})[_0x9812('0x1d')](function(){return _0x16e3c3['update']({'read':!![]});})['catch'](function(_0x145e0a){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x9812('0x25'),util[_0x9812('0x31')](_0x145e0a,{'showHidden':![],'depth':null}));_0x4ef1e5();});}else{_0x4ef1e5();}})[_0x9812('0x32')](function(){_0x4ef1e5();});}else{_0x4ef1e5();}}},'charset':_0x9812('0x33'),'collate':_0x9812('0x34')});}; \ No newline at end of file +var _0x19f7=['length','Interaction','omit','Contact','POST','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','secret','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions'];(function(_0x21b1c1,_0x4ba63f){var _0x3a181a=function(_0x14a7f1){while(--_0x14a7f1){_0x21b1c1['push'](_0x21b1c1['shift']());}};_0x3a181a(++_0x4ba63f);}(_0x19f7,0x1ea));var _0x719f=function(_0x419f64,_0x82fc7a){_0x419f64=_0x419f64-0x0;var _0x399e39=_0x19f7[_0x419f64];return _0x399e39;};'use strict';var _=require('lodash');var util=require(_0x719f('0x0'));var logger=require(_0x719f('0x1'))('api');var moment=require(_0x719f('0x2'));var BPromise=require(_0x719f('0x3'));var rp=require(_0x719f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x719f('0x5'));var config=require(_0x719f('0x6'));var attributes=require(_0x719f('0x7'));module[_0x719f('0x8')]=function(_0x5a8a5,_0x4f3f08){return _0x5a8a5[_0x719f('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x719f('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x719f('0xb')],'type':_0x719f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x443815,_0x36bda8,_0x5907b1){var _0xd7ad20=_0x5a8a5[_0x719f('0xd')];var _0x35d479=_0x443815[_0x719f('0xe')]({'plain':!![]});if(_0x35d479[_0x719f('0xf')][_0x719f('0x10')]()==='in'||_0x35d479[_0x719f('0xf')][_0x719f('0x10')]()==='out'&&!_0x35d479['secret']&&!_[_0x719f('0x11')](_0x35d479[_0x719f('0x12')])){_0xd7ad20[_0x719f('0x13')][_0x719f('0x14')]({'where':{'id':_0x35d479[_0x719f('0x15')]}})[_0x719f('0x16')](function(_0xea3a1e){if(_0xea3a1e){_0xea3a1e[_0x719f('0x17')]({'lastMsgAt':_0x35d479[_0x719f('0x18')],'lastMsgDirection':_0x35d479['direction'][_0x719f('0x10')]()});}})[_0x719f('0x19')](function(_0x527311){console[_0x719f('0x1a')](_0x527311);});}if(_0x35d479[_0x719f('0xf')]===_0x719f('0x1b')&&!_0x35d479[_0x719f('0x1c')]){var _0x53301e;_0xd7ad20[_0x719f('0x1d')][_0x719f('0x1e')]()[_0x719f('0x16')](function(_0x1e5006){return _0xd7ad20[_0x719f('0x1f')]['find']({'where':{'id':_0x35d479[_0x719f('0x20')]},'include':[{'model':_0xd7ad20[_0x719f('0x13')],'as':'Interactions','where':{'id':_0x35d479[_0x719f('0x15')]},'limit':0x1,'include':[{'model':_0xd7ad20[_0x719f('0x1d')],'as':'Contact','attributes':_[_0x719f('0x21')](_0x1e5006)}]}]});})['then'](function(_0x51e7cf){_0x53301e=_0x51e7cf['get']({'plain':!![]});if(_0x53301e&&_0x53301e[_0x719f('0x22')]){logger[_0x719f('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x719f('0x24'),util[_0x719f('0x25')](_0x719f('0x26'),_0x35d479['id'],_0x53301e['replyUri']));if(_0x53301e[_0x719f('0x27')]&&_0x53301e['Interactions'][_0x719f('0x28')]){_0x35d479[_0x719f('0x29')]=_[_0x719f('0x2a')](_0x53301e[_0x719f('0x27')][0x0],'Contact');_0x35d479[_0x719f('0x2b')]=_0x53301e[_0x719f('0x27')][0x0]['Contact'];}var _0x36bda8={'method':_0x719f('0x2c'),'uri':encodeURI(_0x53301e[_0x719f('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x36bda8['method']){case _0x719f('0x2d'):_0x36bda8['qs']=_0x35d479;break;case _0x719f('0x2c'):_0x36bda8[_0x719f('0xb')]=_0x35d479;break;}return rp(_0x36bda8)[_0x719f('0x16')](function(_0x25e3b2){logger[_0x719f('0x23')](_0x719f('0x2e'),'afterCreate',util['format'](_0x719f('0x2f'),_0x35d479['id'],_0x53301e[_0x719f('0x22')]));if(_0x25e3b2[_0x719f('0xb')][_0x719f('0x30')]&&_0x25e3b2[_0x719f('0xb')][_0x719f('0x30')]!=_0x35d479[_0x719f('0x29')][_0x719f('0x30')]){return _0xd7ad20[_0x719f('0x13')][_0x719f('0x17')]({'threadId':_0x25e3b2[_0x719f('0xb')][_0x719f('0x30')]},{'where':{'id':_0x35d479[_0x719f('0x29')]['id']}});}else{return;}})[_0x719f('0x16')](function(){return _0x443815[_0x719f('0x17')]({'read':!![]});})[_0x719f('0x19')](function(_0x649ac3){logger['error'](_0x719f('0x2e'),_0x719f('0x24'),util[_0x719f('0x31')](_0x649ac3,{'showHidden':![],'depth':null}));_0x5907b1();});}else{_0x5907b1();}})[_0x719f('0x32')](function(){_0x5907b1();});}else{_0x5907b1();}}},'charset':_0x719f('0x33'),'collate':_0x719f('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e306aa1..afbce01 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x38e261,_0x4db54a){var _0x5921f8=function(_0x32d5b4){while(--_0x32d5b4){_0x38e261['push'](_0x38e261['shift']());}};_0x5921f8(++_0x4db54a);}(_0x1261,0x144));var _0x1126=function(_0x3490c2,_0x548c5e){_0x3490c2=_0x3490c2-0x0;var _0x891d41=_0x1261[_0x3490c2];return _0x891d41;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x585cc8,_0x57eb85){var _0x426191=function(_0x40d087){while(--_0x40d087){_0x585cc8['push'](_0x585cc8['shift']());}};_0x426191(++_0x57eb85);}(_0xadb5,0xad));var _0x5adb=function(_0x490fcd,_0xe400ce){_0x490fcd=_0x490fcd-0x0;var _0x46adcb=_0xadb5[_0x490fcd];return _0x46adcb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8d713f1..13b8762 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 _0xd484=['save','remove','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xd484,0xff));var _0x4d48=function(_0x109358,_0x1fb5f6){_0x109358=_0x109358-0x0;var _0xaaf807=_0xd484[_0x109358];return _0xaaf807;};'use strict';var OpenchannelMessageEvents=require(_0x4d48('0x0'));var events=[_0x4d48('0x1'),_0x4d48('0x2'),'update'];function createListener(_0x4549dd,_0x55a43f){return function(_0x245c36){_0x55a43f[_0x4d48('0x3')](_0x4549dd,_0x245c36);};}function removeListener(_0x58e3eb,_0x59e8ad){return function(){OpenchannelMessageEvents[_0x4d48('0x4')](_0x58e3eb,_0x59e8ad);};}exports[_0x4d48('0x5')]=function(_0x2be4c4){for(var _0x5ca83c=0x0,_0x287d75=events[_0x4d48('0x6')];_0x5ca83c<_0x287d75;_0x5ca83c++){var _0x532a8d=events[_0x5ca83c];var _0x142d4c=createListener(_0x4d48('0x7')+_0x532a8d,_0x2be4c4);OpenchannelMessageEvents['on'](_0x532a8d,_0x142d4c);}}; \ No newline at end of file +var _0x61bb=['openchannelMessage:','./openchannelMessage.events','save','update','emit','removeListener'];(function(_0x5cee86,_0x137379){var _0x3c1c28=function(_0x2a82a1){while(--_0x2a82a1){_0x5cee86['push'](_0x5cee86['shift']());}};_0x3c1c28(++_0x137379);}(_0x61bb,0x1b1));var _0xb61b=function(_0x1e01b1,_0x5b68f6){_0x1e01b1=_0x1e01b1-0x0;var _0xe6054f=_0x61bb[_0x1e01b1];return _0xe6054f;};'use strict';var OpenchannelMessageEvents=require(_0xb61b('0x0'));var events=[_0xb61b('0x1'),'remove',_0xb61b('0x2')];function createListener(_0x5916d0,_0x574bb9){return function(_0x480795){_0x574bb9[_0xb61b('0x3')](_0x5916d0,_0x480795);};}function removeListener(_0x4b8d24,_0x7754ef){return function(){OpenchannelMessageEvents[_0xb61b('0x4')](_0x4b8d24,_0x7754ef);};}exports['register']=function(_0x17cbc5){for(var _0x11fcb4=0x0,_0x6d2684=events['length'];_0x11fcb4<_0x6d2684;_0x11fcb4++){var _0x57ccae=events[_0x11fcb4];var _0x9d6919=createListener(_0xb61b('0x5')+_0x57ccae,_0x17cbc5);OpenchannelMessageEvents['on'](_0x57ccae,_0x9d6919);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5302736..4462793 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 _0x54c9=['getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x54c9,0x10b));var _0x954c=function(_0x3cb088,_0x481dae){_0x3cb088=_0x3cb088-0x0;var _0x39402e=_0x54c9[_0x3cb088];return _0x39402e;};'use strict';var multer=require(_0x954c('0x0'));var util=require(_0x954c('0x1'));var path=require(_0x954c('0x2'));var timeout=require(_0x954c('0x3'));var express=require(_0x954c('0x4'));var router=express[_0x954c('0x5')]();var fs_extra=require(_0x954c('0x6'));var auth=require(_0x954c('0x7'));var interaction=require(_0x954c('0x8'));var config=require(_0x954c('0x9'));var controller=require(_0x954c('0xa'));router[_0x954c('0xb')]('/',auth['isAuthenticated'](),controller[_0x954c('0xc')]);router[_0x954c('0xb')](_0x954c('0xd'),auth[_0x954c('0xe')](),controller[_0x954c('0xf')]);router[_0x954c('0xb')](_0x954c('0x10'),auth['isAuthenticated'](),controller[_0x954c('0x11')]);router['get'](_0x954c('0x12'),auth['isAuthenticated'](),controller[_0x954c('0x13')]);router[_0x954c('0xb')](_0x954c('0x14'),auth[_0x954c('0xe')](),controller[_0x954c('0x15')]);router[_0x954c('0xb')]('/:id/users',auth[_0x954c('0xe')](),controller[_0x954c('0x16')]);router[_0x954c('0x17')]('/',auth[_0x954c('0xe')](),controller[_0x954c('0x18')]);router[_0x954c('0x17')]('/:id/teams',auth[_0x954c('0xe')](),controller[_0x954c('0x19')]);router[_0x954c('0x17')](_0x954c('0x1a'),auth[_0x954c('0xe')](),controller[_0x954c('0x1b')]);router[_0x954c('0x1c')](_0x954c('0x10'),auth[_0x954c('0xe')](),controller['update']);router[_0x954c('0x1d')]('/:id',auth[_0x954c('0xe')](),controller['destroy']);router['delete'](_0x954c('0x14'),auth['isAuthenticated'](),controller[_0x954c('0x1e')]);router[_0x954c('0x1d')](_0x954c('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x954c('0x1f')]=router; \ No newline at end of file +var _0x035d=['./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x1d331c,_0x4f48b9){var _0x1dcc1e=function(_0x4dae33){while(--_0x4dae33){_0x1d331c['push'](_0x1d331c['shift']());}};_0x1dcc1e(++_0x4f48b9);}(_0x035d,0x6b));var _0xd035=function(_0x4b192a,_0x48d869){_0x4b192a=_0x4b192a-0x0;var _0x1613db=_0x035d[_0x4b192a];return _0x1613db;};'use strict';var multer=require(_0xd035('0x0'));var util=require('util');var path=require(_0xd035('0x1'));var timeout=require(_0xd035('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd035('0x3'));var config=require(_0xd035('0x4'));var controller=require(_0xd035('0x5'));router[_0xd035('0x6')]('/',auth[_0xd035('0x7')](),controller[_0xd035('0x8')]);router[_0xd035('0x6')](_0xd035('0x9'),auth['isAuthenticated'](),controller[_0xd035('0xa')]);router['get'](_0xd035('0xb'),auth[_0xd035('0x7')](),controller[_0xd035('0xc')]);router[_0xd035('0x6')]('/:id/members',auth[_0xd035('0x7')](),controller[_0xd035('0xd')]);router['get'](_0xd035('0xe'),auth[_0xd035('0x7')](),controller[_0xd035('0xf')]);router[_0xd035('0x6')]('/:id/users',auth[_0xd035('0x7')](),controller[_0xd035('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd035('0x11')]);router['post'](_0xd035('0xe'),auth[_0xd035('0x7')](),controller[_0xd035('0x12')]);router[_0xd035('0x13')]('/:id/users',auth[_0xd035('0x7')](),controller[_0xd035('0x14')]);router['put']('/:id',auth[_0xd035('0x7')](),controller[_0xd035('0x15')]);router[_0xd035('0x16')](_0xd035('0xb'),auth[_0xd035('0x7')](),controller[_0xd035('0x17')]);router[_0xd035('0x16')]('/:id/teams',auth[_0xd035('0x7')](),controller[_0xd035('0x18')]);router[_0xd035('0x16')](_0xd035('0x19'),auth[_0xd035('0x7')](),controller[_0xd035('0x1a')]);module[_0xd035('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5e04117..16bd2b8 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 _0x3685=['name','rrmemory','beepall','roundrobin','STRING'];(function(_0x4646f1,_0x32aa90){var _0x5a6d29=function(_0x38a426){while(--_0x38a426){_0x4646f1['push'](_0x4646f1['shift']());}};_0x5a6d29(++_0x32aa90);}(_0x3685,0x180));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5368('0x0')],'unique':_0x5368('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5368('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5368('0x2'),_0x5368('0x3'),_0x5368('0x4'))}}; \ No newline at end of file +var _0xb2eb=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x4a0198,_0x587b06){var _0x4332fc=function(_0x381660){while(--_0x381660){_0x4a0198['push'](_0x4a0198['shift']());}};_0x4332fc(++_0x587b06);}(_0xb2eb,0x193));var _0xbb2e=function(_0x3e3936,_0x24c3a6){_0x3e3936=_0x3e3936-0x0;var _0x10be4e=_0xb2eb[_0x3e3936];return _0x10be4e;};'use strict';var Sequelize=require(_0xbb2e('0x0'));module[_0xbb2e('0x1')]={'name':{'type':Sequelize[_0xbb2e('0x2')],'unique':_0xbb2e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb2e('0x2')]},'timeout':{'type':Sequelize[_0xbb2e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb2e('0x5')]('rrmemory',_0xbb2e('0x6'),_0xbb2e('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0e4cb5c..ca59c76 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 _0xa068=['compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','get','OpenchannelQueues','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','SIP','openchannelPause','Team','pick','options','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa068,0x17e));var _0x8a06=function(_0x342be1,_0x4d5edf){_0x342be1=_0x342be1-0x0;var _0x1f128a=_0xa068[_0x342be1];return _0x1f128a;};'use strict';var BPromise=require(_0x8a06('0x0'));var util=require(_0x8a06('0x1'));var _=require(_0x8a06('0x2'));var squel=require(_0x8a06('0x3'));var Redis=require(_0x8a06('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x8a06('0x5'))(_0x8a06('0x6'));var config=require('../../config/environment');var db=require(_0x8a06('0x7'))['db'];config[_0x8a06('0x8')]=_[_0x8a06('0x9')](config['redis'],{'host':_0x8a06('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a06('0x8')]));require(_0x8a06('0xb'))[_0x8a06('0xc')](socket);function respondWithStatusCode(_0x4a7a7f,_0x43cb59){_0x43cb59=_0x43cb59||0xcc;return function(_0x2c6878){if(_0x2c6878){return _0x4a7a7f[_0x8a06('0xd')](_0x43cb59);}return _0x4a7a7f[_0x8a06('0xe')](_0x43cb59)[_0x8a06('0xf')]();};}function respondWithResult(_0x492fe0,_0x4252bd){_0x4252bd=_0x4252bd||0xc8;return function(_0x5e77ec){if(_0x5e77ec){return _0x492fe0['status'](_0x4252bd)[_0x8a06('0x10')](_0x5e77ec);}};}function respondWithFilteredResult(_0x3796ca,_0x226abb){return function(_0x33cccd){if(_0x33cccd){var _0x186e6c=typeof _0x226abb[_0x8a06('0x11')]===_0x8a06('0x12')&&typeof _0x226abb['limit']===_0x8a06('0x12');var _0x516574=_0x33cccd[_0x8a06('0x13')];var _0x5a1bcc=_0x186e6c?0x0:_0x226abb['offset'];var _0x100281=_0x186e6c?_0x33cccd[_0x8a06('0x13')]:_0x226abb[_0x8a06('0x11')]+_0x226abb[_0x8a06('0x14')];var _0x33186b;if(_0x100281>=_0x516574){_0x100281=_0x516574;_0x33186b=0xc8;}else{_0x33186b=0xce;}_0x3796ca[_0x8a06('0xe')](_0x33186b);return _0x3796ca[_0x8a06('0x15')](_0x8a06('0x16'),_0x5a1bcc+'-'+_0x100281+'/'+_0x516574)['json'](_0x33cccd);}return null;};}function saveUpdates(_0x7a0675){return function(_0x31def6){if(_0x31def6){return _0x31def6['update'](_0x7a0675)[_0x8a06('0x17')](function(_0x49d659){return _0x49d659;});}return null;};}function removeEntity(_0x3003a7){return function(_0x3c72d7){if(_0x3c72d7){return _0x3c72d7[_0x8a06('0x18')]()[_0x8a06('0x17')](function(){var _0x423b15=_0x3c72d7[_0x8a06('0x19')]({'plain':!![]});var _0x54e7a5=_0x8a06('0x1a');return db['UserProfileResource'][_0x8a06('0x18')]({'where':{'type':_0x54e7a5,'resourceId':_0x423b15['id']}})[_0x8a06('0x17')](function(){return _0x3c72d7;});})[_0x8a06('0x17')](function(){_0x3003a7[_0x8a06('0xe')](0xcc)[_0x8a06('0xf')]();});}};}function handleEntityNotFound(_0x5b867a){return function(_0x48b093){if(!_0x48b093){_0x5b867a[_0x8a06('0xd')](0x194);}return _0x48b093;};}function handleError(_0x2a4261,_0x4fb984){_0x4fb984=_0x4fb984||0x1f4;return function(_0x55fdd3){logger['error'](_0x55fdd3[_0x8a06('0x1b')]);if(_0x55fdd3[_0x8a06('0x1c')]){delete _0x55fdd3['name'];}_0x2a4261[_0x8a06('0xe')](_0x4fb984)['send'](_0x55fdd3);};}exports[_0x8a06('0x1d')]=function(_0x484e72,_0x41af73){var _0x262ec4={};var _0x2491b6={'count':0x0,'rows':[]};var _0x1db6e3=_[_0x8a06('0x1e')](db[_0x8a06('0x1f')][_0x8a06('0x20')],function(_0x3614e8){return{'name':_0x3614e8[_0x8a06('0x21')],'type':_0x3614e8['type'][_0x8a06('0x22')]};});_0x262ec4=qs['getOptions'](_0x1db6e3,_0x484e72);var _0x232125={'where':_0x262ec4[_0x8a06('0x23')]};return db[_0x8a06('0x1f')][_0x8a06('0x13')](_0x232125)[_0x8a06('0x17')](function(_0x55ca3f){_0x2491b6[_0x8a06('0x13')]=_0x55ca3f;_0x262ec4[_0x8a06('0x24')]=qs[_0x8a06('0x24')](_0x484e72[_0x8a06('0x25')]);return db['OpenchannelQueue'][_0x8a06('0x26')](_0x262ec4);})[_0x8a06('0x17')](function(_0x4e4cc5){_0x2491b6[_0x8a06('0x27')]=_0x4e4cc5;return _0x2491b6;})[_0x8a06('0x17')](respondWithFilteredResult(_0x41af73,_0x262ec4))[_0x8a06('0x28')](handleError(_0x41af73,null));};exports['show']=function(_0x1349f1,_0x449531){var _0x2d0fea={'raw':!![],'where':{'id':_0x1349f1[_0x8a06('0x29')]['id']}},_0x3c6a2f={};_0x3c6a2f[_0x8a06('0x2a')]=_['keys'](db[_0x8a06('0x1f')][_0x8a06('0x20')]);_0x3c6a2f['query']=_[_0x8a06('0x2b')](_0x1349f1[_0x8a06('0x25')]);_0x3c6a2f[_0x8a06('0x2c')]=_[_0x8a06('0x2d')](_0x3c6a2f['model'],_0x3c6a2f[_0x8a06('0x25')]);_0x2d0fea[_0x8a06('0x2e')]=_[_0x8a06('0x2d')](_0x3c6a2f[_0x8a06('0x2a')],qs[_0x8a06('0x2f')](_0x1349f1['query']['fields']));_0x2d0fea[_0x8a06('0x2e')]=_0x2d0fea[_0x8a06('0x2e')][_0x8a06('0x30')]?_0x2d0fea[_0x8a06('0x2e')]:_0x3c6a2f[_0x8a06('0x2a')];if(_0x1349f1['query'][_0x8a06('0x31')]){_0x2d0fea['include']=[{'all':!![]}];}_0x2d0fea=_[_0x8a06('0x32')]({},_0x2d0fea,_0x1349f1['options']);return db[_0x8a06('0x1f')]['find'](_0x2d0fea)[_0x8a06('0x17')](handleEntityNotFound(_0x449531,null))['then'](respondWithResult(_0x449531,null))[_0x8a06('0x28')](handleError(_0x449531,null));};exports[_0x8a06('0x33')]=function(_0x38bfae,_0xd90e91){return db[_0x8a06('0x1f')][_0x8a06('0x33')](_0x38bfae['body'],{})['then'](function(_0x496258){var _0x531235=_0x38bfae[_0x8a06('0x34')][_0x8a06('0x19')]({'plain':!![]});if(!_0x531235)throw new Error(_0x8a06('0x35'));if(_0x531235[_0x8a06('0x36')]===_0x8a06('0x34')){var _0x36fce3=_0x496258[_0x8a06('0x19')]({'plain':!![]});var _0x5ea0db='OpenchannelQueues';return db[_0x8a06('0x37')]['find']({'where':{'name':_0x5ea0db,'userProfileId':_0x531235[_0x8a06('0x38')]},'raw':!![]})[_0x8a06('0x17')](function(_0xa2e35c){if(_0xa2e35c&&_0xa2e35c[_0x8a06('0x39')]===0x0){return db[_0x8a06('0x3a')][_0x8a06('0x33')]({'name':_0x36fce3[_0x8a06('0x1c')],'resourceId':_0x36fce3['id'],'type':_0xa2e35c[_0x8a06('0x1c')],'sectionId':_0xa2e35c['id']},{})[_0x8a06('0x17')](function(){return _0x496258;});}else{return _0x496258;}})['catch'](function(_0x46b602){logger[_0x8a06('0x3b')](_0x8a06('0x3c'),_0x46b602);throw _0x46b602;});}return _0x496258;})['then'](respondWithResult(_0xd90e91,0xc9))[_0x8a06('0x28')](handleError(_0xd90e91,null));};exports[_0x8a06('0x3d')]=function(_0x15b8d5,_0x2442e1){if(_0x15b8d5['body']['id']){delete _0x15b8d5[_0x8a06('0x3e')]['id'];}return db[_0x8a06('0x1f')][_0x8a06('0x3f')]({'where':{'id':_0x15b8d5[_0x8a06('0x29')]['id']}})[_0x8a06('0x17')](handleEntityNotFound(_0x2442e1,null))[_0x8a06('0x17')](saveUpdates(_0x15b8d5[_0x8a06('0x3e')],null))['then'](respondWithResult(_0x2442e1,null))[_0x8a06('0x28')](handleError(_0x2442e1,null));};exports['destroy']=function(_0x26a908,_0x35fe4f){return db[_0x8a06('0x1f')][_0x8a06('0x3f')]({'where':{'id':_0x26a908[_0x8a06('0x29')]['id']}})['then'](handleEntityNotFound(_0x35fe4f,null))[_0x8a06('0x17')](removeEntity(_0x35fe4f,null))[_0x8a06('0x28')](handleError(_0x35fe4f,null));};exports[_0x8a06('0x40')]=function(_0x3f1668,_0x26f778){return db['OpenchannelQueue']['describe']()[_0x8a06('0x17')](respondWithResult(_0x26f778,null))[_0x8a06('0x28')](handleError(_0x26f778,null));};exports[_0x8a06('0x41')]=function(_0x2e4a23,_0x564d97){var _0xf826a={'raw':!![],'where':{}},_0x5b311e={},_0x3ee677;return db[_0x8a06('0x1f')][_0x8a06('0x42')]({'where':{'id':_0x2e4a23[_0x8a06('0x29')]['id']}})['then'](handleEntityNotFound(_0x564d97,null))['then'](function(_0x2ee7cf){if(_0x2ee7cf){_0x3ee677=_0x2ee7cf[_0x8a06('0x19')]({'plain':!![]});_0x5b311e[_0x8a06('0x2a')]=_[_0x8a06('0x2b')](db['UserOpenchannelQueue'][_0x8a06('0x20')]);_0x5b311e['query']=_[_0x8a06('0x2b')](_0x2e4a23[_0x8a06('0x25')]);_0x5b311e[_0x8a06('0x2c')]=_['intersection'](_0x5b311e[_0x8a06('0x2a')],_0x5b311e[_0x8a06('0x25')]);_0xf826a['attributes']=_['intersection'](_0x5b311e[_0x8a06('0x2a')],qs['fields'](_0x2e4a23[_0x8a06('0x25')][_0x8a06('0x2f')]));_0xf826a['attributes']=_0xf826a[_0x8a06('0x2e')][_0x8a06('0x30')]?_0xf826a[_0x8a06('0x2e')]:_0x5b311e[_0x8a06('0x2a')];if(!_0x2e4a23[_0x8a06('0x25')][_0x8a06('0x43')](_0x8a06('0x44'))){_0xf826a['limit']=qs[_0x8a06('0x14')](_0x2e4a23['query'][_0x8a06('0x14')]);_0xf826a[_0x8a06('0x11')]=qs['offset'](_0x2e4a23[_0x8a06('0x25')][_0x8a06('0x11')]);}_0xf826a[_0x8a06('0x45')]=qs[_0x8a06('0x46')](_0x2e4a23[_0x8a06('0x25')][_0x8a06('0x46')]);_0xf826a[_0x8a06('0x23')]=qs['filters'](_['pick'](_0x2e4a23[_0x8a06('0x25')],_0x5b311e[_0x8a06('0x2c')]));_0xf826a[_0x8a06('0x23')][_0x8a06('0x47')]=_0x2ee7cf['id'];if(_0x2e4a23[_0x8a06('0x25')][_0x8a06('0x48')]){_0xf826a['where']=_['merge'](_0xf826a['where'],{'$or':_[_0x8a06('0x1e')](_0xf826a['attributes'],function(_0x214936){var _0x3992a1={};_0x3992a1[_0x214936]={'$like':'%'+_0x2e4a23['query'][_0x8a06('0x48')]+'%'};return _0x3992a1;})});}_0xf826a=_[_0x8a06('0x32')]({},_0xf826a,_0x2e4a23['options']);return db[_0x8a06('0x49')]['findAll'](_0xf826a);}})['then'](function(_0x578ccc){if(_0x578ccc){return db[_0x8a06('0x4a')][_0x8a06('0x4b')]({'where':{'id':_[_0x8a06('0x1e')](_0x578ccc,_0x8a06('0x4c')),'role':_0x8a06('0x4d')},'attributes':['id',_0x8a06('0x1c'),'openchannelPause',_0x8a06('0x4e'),_0x8a06('0x4f')]});}})[_0x8a06('0x17')](function(_0x5f2452){if(_0x5f2452){return{'count':_0x5f2452[_0x8a06('0x13')],'rows':_['map'](_0x5f2452['rows'],function(_0x5c70af){return{'membername':_0x5c70af[_0x8a06('0x1c')],'UserId':_0x5c70af['id'],'queue_name':_0x3ee677[_0x8a06('0x1c')],'OpenchannelQueueId':_0x3ee677['id'],'interface':util['format']('%s/%s',_0x8a06('0x50'),_0x5c70af['name']),'penalty':0x0,'paused':_0x5c70af[_0x8a06('0x51')],'createdAt':_0x5c70af[_0x8a06('0x4f')],'updatedAt':_0x5c70af['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x564d97,_0xf826a))[_0x8a06('0x28')](handleError(_0x564d97,null));};exports['getTeams']=function(_0x5ec163,_0x1f78b2){var _0x2afe24={};var _0x16db8d={};var _0x2fc55e;var _0x373932;return db[_0x8a06('0x1f')][_0x8a06('0x42')]({'where':{'id':_0x5ec163[_0x8a06('0x29')]['id']}})[_0x8a06('0x17')](handleEntityNotFound(_0x1f78b2,null))[_0x8a06('0x17')](function(_0x1cb8aa){if(_0x1cb8aa){_0x2fc55e=_0x1cb8aa;_0x16db8d[_0x8a06('0x2a')]=_['keys'](db[_0x8a06('0x52')]['rawAttributes']);_0x16db8d['query']=_[_0x8a06('0x2b')](_0x5ec163[_0x8a06('0x25')]);_0x16db8d[_0x8a06('0x2c')]=_[_0x8a06('0x2d')](_0x16db8d['model'],_0x16db8d[_0x8a06('0x25')]);_0x2afe24[_0x8a06('0x2e')]=_['intersection'](_0x16db8d[_0x8a06('0x2a')],qs[_0x8a06('0x2f')](_0x5ec163[_0x8a06('0x25')][_0x8a06('0x2f')]));_0x2afe24[_0x8a06('0x2e')]=_0x2afe24[_0x8a06('0x2e')][_0x8a06('0x30')]?_0x2afe24[_0x8a06('0x2e')]:_0x16db8d[_0x8a06('0x2a')];_0x2afe24[_0x8a06('0x45')]=qs[_0x8a06('0x46')](_0x5ec163[_0x8a06('0x25')][_0x8a06('0x46')]);_0x2afe24[_0x8a06('0x23')]=qs[_0x8a06('0x2c')](_[_0x8a06('0x53')](_0x5ec163['query'],_0x16db8d[_0x8a06('0x2c')]));if(_0x5ec163['query'][_0x8a06('0x48')]){_0x2afe24['where']=_['merge'](_0x2afe24[_0x8a06('0x23')],{'$or':_[_0x8a06('0x1e')](_0x2afe24['attributes'],function(_0xe015a){var _0x5929b1={};_0x5929b1[_0xe015a]={'$like':'%'+_0x5ec163['query']['filter']+'%'};return _0x5929b1;})});}_0x2afe24=_[_0x8a06('0x32')]({},_0x2afe24,_0x5ec163[_0x8a06('0x54')]);return _0x2fc55e[_0x8a06('0x55')](_0x2afe24);}})[_0x8a06('0x17')](function(_0x2536be){if(_0x2536be){_0x373932=_0x2536be[_0x8a06('0x30')];if(!_0x5ec163[_0x8a06('0x25')]['hasOwnProperty'](_0x8a06('0x44'))){_0x2afe24[_0x8a06('0x14')]=qs[_0x8a06('0x14')](_0x5ec163[_0x8a06('0x25')][_0x8a06('0x14')]);_0x2afe24[_0x8a06('0x11')]=qs[_0x8a06('0x11')](_0x5ec163['query']['offset']);}return _0x2fc55e[_0x8a06('0x55')](_0x2afe24);}})[_0x8a06('0x17')](function(_0x5945a1){if(_0x5945a1){return _0x5945a1?{'count':_0x373932,'rows':_0x5945a1}:null;}})['then'](respondWithResult(_0x1f78b2,null))[_0x8a06('0x28')](handleError(_0x1f78b2,null));};exports[_0x8a06('0x56')]=function(_0x5a7e2f,_0x4ce6b8){var _0x15d82a=_0x5a7e2f[_0x8a06('0x3e')][_0x8a06('0x57')];return db[_0x8a06('0x52')][_0x8a06('0x26')]({'where':{'id':_0x15d82a},'attributes':['id'],'include':[{'model':db[_0x8a06('0x4a')],'as':_0x8a06('0x58'),'attributes':['id',_0x8a06('0x1c'),_0x8a06('0x59'),_0x8a06('0x5a'),_0x8a06('0x5b')],'raw':!![]}]})[_0x8a06('0x17')](function(_0x183b5e){if(_0x183b5e){var _0x424039=_[_0x8a06('0x5c')](_0x183b5e,function(_0x3b192e){var _0x4f928f=_0x3b192e['get']({'plain':!![]});return _0x4f928f[_0x8a06('0x58')];});return db[_0x8a06('0x1f')][_0x8a06('0x3f')]({'where':{'id':_0x5a7e2f['params']['id']}})['then'](function(_0x2b1462){return db[_0x8a06('0x5d')][_0x8a06('0x5e')](function(_0x2487c6){return _0x2b1462['addTeams'](_0x15d82a,{'transaction':_0x2487c6})[_0x8a06('0x17')](function(){return BPromise[_0x8a06('0x5f')](_0x424039,function(_0x4d079d){return db['UserOpenchannelQueue'][_0x8a06('0x60')]({'where':{'UserId':_0x4d079d['id'],'OpenchannelQueueId':_0x5a7e2f[_0x8a06('0x29')]['id']},'transaction':_0x2487c6});});})[_0x8a06('0x17')](function(){_0x424039[_0x8a06('0x61')](function(_0x2d6e53){socket[_0x8a06('0x62')]('userOpenchannelQueue:save',{'UserId':_0x2d6e53['id'],'OpenchannelQueueId':_0x2b1462['id']});});});});});}})[_0x8a06('0x17')](respondWithStatusCode(_0x4ce6b8,null))['catch'](handleError(_0x4ce6b8,null));};exports['removeTeams']=function(_0x36780d,_0x23333b){return db[_0x8a06('0x52')][_0x8a06('0x26')]({'where':{'id':_0x36780d[_0x8a06('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8a06('0x4a')],'as':_0x8a06('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x23333b,null))[_0x8a06('0x17')](function(_0x294862){var _0x436934=_['map'](_0x294862,'id');var _0x3574dd=[];var _0x270fcd=[];var _0x466a93=squel[_0x8a06('0x63')]();_0x466a93[_0x8a06('0x64')](_0x8a06('0x65'))[_0x8a06('0x66')](_0x8a06('0x67'),'tq')['join'](_0x8a06('0x68'),'ut',_0x8a06('0x69'))['where'](_0x8a06('0x6a'),_0x36780d[_0x8a06('0x29')]['id']);for(var _0x4c54af=0x0;_0x4c54af<_0x294862[_0x8a06('0x30')];_0x4c54af+=0x1){let _0x56b2cc=_0x294862[_0x4c54af];for(var _0x43388d=0x0;_0x43388d<_0x56b2cc[_0x8a06('0x58')]['length'];_0x43388d+=0x1){let _0x4b7aa4=_0x56b2cc[_0x8a06('0x58')][_0x43388d];var _0x593002=_0x466a93['clone']();_0x593002[_0x8a06('0x23')](_0x8a06('0x6b'),_0x4b7aa4['id']);_0x270fcd[_0x8a06('0x6c')](db[_0x8a06('0x5d')][_0x8a06('0x25')](_0x593002[_0x8a06('0x6d')](),{'type':db[_0x8a06('0x5d')][_0x8a06('0x6e')][_0x8a06('0x6f')]})[_0x8a06('0x17')](function(_0x5234c2){if(_0x5234c2[_0x8a06('0x30')]===0x1){return _0x4b7aa4['id'];}else{var _0x4c422b=_[_0x8a06('0x70')](_[_0x8a06('0x1e')](_0x5234c2,_0x8a06('0x71')),function(_0x5ad860){return _['includes'](_0x436934,_0x5ad860);});if(_0x4c422b){return _0x4b7aa4['id'];}}}));}}return BPromise['all'](_0x270fcd)[_0x8a06('0x17')](function(_0x22aca5){_0x3574dd=_(_0x3574dd)['union'](_0x22aca5)[_0x8a06('0x72')]()[_0x8a06('0x73')]();return db['OpenchannelQueue'][_0x8a06('0x3f')]({'where':{'id':_0x36780d[_0x8a06('0x29')]['id']}})[_0x8a06('0x17')](function(_0x45a9b9){return db[_0x8a06('0x5d')][_0x8a06('0x5e')](function(_0x5945ff){return _0x45a9b9['removeTeams'](_0x36780d['query'][_0x8a06('0x57')],{'transaction':_0x5945ff})[_0x8a06('0x17')](function(){if(!_['isEmpty'](_0x3574dd)){return _0x45a9b9[_0x8a06('0x74')](_0x3574dd,{'transaction':_0x5945ff});}})[_0x8a06('0x17')](function(){_0x3574dd[_0x8a06('0x61')](function(_0x307356){socket[_0x8a06('0x62')](_0x8a06('0x75'),{'UserId':_0x307356,'OpenchannelQueueId':_0x45a9b9['id']});});});});});});})['then'](respondWithStatusCode(_0x23333b,null))['catch'](handleError(_0x23333b,null));};exports[_0x8a06('0x76')]=function(_0x3e0003,_0x39f823){return db[_0x8a06('0x1f')][_0x8a06('0x3f')]({'where':{'id':_0x3e0003['params']['id']}})[_0x8a06('0x17')](handleEntityNotFound(_0x39f823,null))[_0x8a06('0x17')](function(_0x360ad7){if(_0x360ad7){return _0x360ad7[_0x8a06('0x76')](_0x3e0003[_0x8a06('0x3e')][_0x8a06('0x57')],_[_0x8a06('0x77')](_0x3e0003[_0x8a06('0x3e')],['ids','id'])||{})[_0x8a06('0x78')](function(_0x3bd37d){for(var _0xaaf786=0x0;_0xaaf786<_0x3e0003['body'][_0x8a06('0x57')][_0x8a06('0x30')];_0xaaf786+=0x1){socket[_0x8a06('0x62')](_0x8a06('0x79'),{'UserId':Number(_0x3e0003['body']['ids'][_0xaaf786]),'OpenchannelQueueId':Number(_0x3e0003[_0x8a06('0x29')]['id'])});}return _0x3bd37d;});}})[_0x8a06('0x17')](respondWithResult(_0x39f823,null))[_0x8a06('0x28')](handleError(_0x39f823,null));};exports[_0x8a06('0x74')]=function(_0x231b5c,_0x27b258){return db[_0x8a06('0x1f')][_0x8a06('0x3f')]({'where':{'id':_0x231b5c[_0x8a06('0x29')]['id']}})['then'](handleEntityNotFound(_0x27b258,null))['then'](function(_0x3e0fad){if(_0x3e0fad){return _0x3e0fad[_0x8a06('0x74')](_0x231b5c[_0x8a06('0x25')][_0x8a06('0x57')])['then'](function(){if(_[_0x8a06('0x7a')](_0x231b5c[_0x8a06('0x25')][_0x8a06('0x57')])){for(var _0x3aa658=0x0;_0x3aa658<_0x231b5c[_0x8a06('0x25')]['ids'][_0x8a06('0x30')];_0x3aa658+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x231b5c[_0x8a06('0x25')][_0x8a06('0x57')][_0x3aa658]),'OpenchannelQueueId':Number(_0x231b5c['params']['id'])});}}else{socket[_0x8a06('0x62')](_0x8a06('0x75'),{'UserId':Number(_0x231b5c[_0x8a06('0x25')][_0x8a06('0x57')]),'OpenchannelQueueId':Number(_0x231b5c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27b258,null))['catch'](handleError(_0x27b258,null));};exports['getAgents']=function(_0x20565a,_0x261228){var _0xc6a688={};var _0x3b340f={};var _0x3f38b9;var _0xf245d6;return db[_0x8a06('0x1f')]['findOne']({'where':{'id':_0x20565a['params']['id']}})[_0x8a06('0x17')](handleEntityNotFound(_0x261228,null))[_0x8a06('0x17')](function(_0x15d69d){if(_0x15d69d){_0x3f38b9=_0x15d69d;_0x3b340f[_0x8a06('0x2a')]=_[_0x8a06('0x2b')](db[_0x8a06('0x4a')][_0x8a06('0x20')]);_0x3b340f[_0x8a06('0x25')]=_['keys'](_0x20565a[_0x8a06('0x25')]);_0x3b340f[_0x8a06('0x2c')]=_[_0x8a06('0x2d')](_0x3b340f['model'],_0x3b340f[_0x8a06('0x25')]);_0xc6a688[_0x8a06('0x2e')]=_['intersection'](_0x3b340f[_0x8a06('0x2a')],qs[_0x8a06('0x2f')](_0x20565a[_0x8a06('0x25')][_0x8a06('0x2f')]));_0xc6a688[_0x8a06('0x2e')]=_0xc6a688[_0x8a06('0x2e')][_0x8a06('0x30')]?_0xc6a688['attributes']:_0x3b340f[_0x8a06('0x2a')];_0xc6a688[_0x8a06('0x45')]=qs[_0x8a06('0x46')](_0x20565a[_0x8a06('0x25')][_0x8a06('0x46')]);_0xc6a688['where']=qs[_0x8a06('0x2c')](_[_0x8a06('0x53')](_0x20565a[_0x8a06('0x25')],_0x3b340f[_0x8a06('0x2c')]));if(_0x20565a['query'][_0x8a06('0x48')]){_0xc6a688[_0x8a06('0x23')]=_[_0x8a06('0x32')](_0xc6a688['where'],{'$or':_['map'](_0xc6a688[_0x8a06('0x2e')],function(_0x3fd140){var _0x5aad13={};_0x5aad13[_0x3fd140]={'$like':'%'+_0x20565a[_0x8a06('0x25')][_0x8a06('0x48')]+'%'};return _0x5aad13;})});}_0xc6a688=_[_0x8a06('0x32')]({},_0xc6a688,_0x20565a[_0x8a06('0x54')]);return _0x3f38b9[_0x8a06('0x7b')](_0xc6a688);}})[_0x8a06('0x17')](function(_0x21360d){if(_0x21360d){_0xf245d6=_0x21360d[_0x8a06('0x30')];if(!_0x20565a[_0x8a06('0x25')][_0x8a06('0x43')](_0x8a06('0x44'))){_0xc6a688[_0x8a06('0x14')]=qs[_0x8a06('0x14')](_0x20565a[_0x8a06('0x25')][_0x8a06('0x14')]);_0xc6a688['offset']=qs[_0x8a06('0x11')](_0x20565a[_0x8a06('0x25')][_0x8a06('0x11')]);}return _0x3f38b9[_0x8a06('0x7b')](_0xc6a688);}})['then'](function(_0x41c0c8){if(_0x41c0c8){return _0x41c0c8?{'count':_0xf245d6,'rows':_0x41c0c8}:null;}})[_0x8a06('0x17')](respondWithResult(_0x261228,null))[_0x8a06('0x28')](handleError(_0x261228,null));}; \ No newline at end of file +var _0x1667=['attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','keys','intersection','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','order','addTeams','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','json','undefined','limit','count','offset','set','Content-Range','update','then','UserProfileResource','status','end','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','params','model','filters'];(function(_0x49e5d8,_0x177875){var _0x4533d8=function(_0x1680a5){while(--_0x1680a5){_0x49e5d8['push'](_0x49e5d8['shift']());}};_0x4533d8(++_0x177875);}(_0x1667,0x1d3));var _0x7166=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x1667[_0x4defd6];return _0x4c9276;};'use strict';var BPromise=require('bluebird');var util=require(_0x7166('0x0'));var _=require('lodash');var squel=require(_0x7166('0x1'));var Redis=require(_0x7166('0x2'));var qs=require(_0x7166('0x3'));var logger=require(_0x7166('0x4'))(_0x7166('0x5'));var config=require(_0x7166('0x6'));var db=require(_0x7166('0x7'))['db'];config[_0x7166('0x8')]=_[_0x7166('0x9')](config['redis'],{'host':_0x7166('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7166('0x8')]));require(_0x7166('0xb'))[_0x7166('0xc')](socket);function respondWithStatusCode(_0x4389aa,_0xa7d3de){_0xa7d3de=_0xa7d3de||0xcc;return function(_0x2974b6){if(_0x2974b6){return _0x4389aa['sendStatus'](_0xa7d3de);}return _0x4389aa['status'](_0xa7d3de)['end']();};}function respondWithResult(_0x4fb8db,_0x2a88e3){_0x2a88e3=_0x2a88e3||0xc8;return function(_0x3f9aa5){if(_0x3f9aa5){return _0x4fb8db['status'](_0x2a88e3)[_0x7166('0xd')](_0x3f9aa5);}};}function respondWithFilteredResult(_0x4f128c,_0x431dd5){return function(_0x5cbb69){if(_0x5cbb69){var _0x423e2d=typeof _0x431dd5['offset']===_0x7166('0xe')&&typeof _0x431dd5[_0x7166('0xf')]===_0x7166('0xe');var _0xd90335=_0x5cbb69[_0x7166('0x10')];var _0x1cc7e6=_0x423e2d?0x0:_0x431dd5[_0x7166('0x11')];var _0x4d930a=_0x423e2d?_0x5cbb69[_0x7166('0x10')]:_0x431dd5[_0x7166('0x11')]+_0x431dd5[_0x7166('0xf')];var _0x535d4d;if(_0x4d930a>=_0xd90335){_0x4d930a=_0xd90335;_0x535d4d=0xc8;}else{_0x535d4d=0xce;}_0x4f128c['status'](_0x535d4d);return _0x4f128c[_0x7166('0x12')](_0x7166('0x13'),_0x1cc7e6+'-'+_0x4d930a+'/'+_0xd90335)[_0x7166('0xd')](_0x5cbb69);}return null;};}function saveUpdates(_0x1386db){return function(_0x3333bf){if(_0x3333bf){return _0x3333bf[_0x7166('0x14')](_0x1386db)[_0x7166('0x15')](function(_0x4b3c99){return _0x4b3c99;});}return null;};}function removeEntity(_0x2a5779){return function(_0x3b15d1){if(_0x3b15d1){return _0x3b15d1['destroy']()['then'](function(){var _0x31769f=_0x3b15d1['get']({'plain':!![]});var _0x5997e8='OpenchannelQueues';return db[_0x7166('0x16')]['destroy']({'where':{'type':_0x5997e8,'resourceId':_0x31769f['id']}})[_0x7166('0x15')](function(){return _0x3b15d1;});})[_0x7166('0x15')](function(){_0x2a5779[_0x7166('0x17')](0xcc)[_0x7166('0x18')]();});}};}function handleEntityNotFound(_0x210b15){return function(_0x37cf45){if(!_0x37cf45){_0x210b15[_0x7166('0x19')](0x194);}return _0x37cf45;};}function handleError(_0x58c0da,_0x179dac){_0x179dac=_0x179dac||0x1f4;return function(_0x127032){logger[_0x7166('0x1a')](_0x127032[_0x7166('0x1b')]);if(_0x127032[_0x7166('0x1c')]){delete _0x127032['name'];}_0x58c0da[_0x7166('0x17')](_0x179dac)['send'](_0x127032);};}exports[_0x7166('0x1d')]=function(_0x370177,_0x415ee1){var _0x2328fa={};var _0x3407b9={'count':0x0,'rows':[]};var _0x4f8982=_[_0x7166('0x1e')](db[_0x7166('0x1f')][_0x7166('0x20')],function(_0x265892){return{'name':_0x265892[_0x7166('0x21')],'type':_0x265892['type'][_0x7166('0x22')]};});_0x2328fa=qs[_0x7166('0x23')](_0x4f8982,_0x370177);var _0x3604c5={'where':_0x2328fa[_0x7166('0x24')]};return db[_0x7166('0x1f')][_0x7166('0x10')](_0x3604c5)[_0x7166('0x15')](function(_0x327b15){_0x3407b9[_0x7166('0x10')]=_0x327b15;_0x2328fa[_0x7166('0x25')]=qs[_0x7166('0x25')](_0x370177[_0x7166('0x26')]);return db[_0x7166('0x1f')][_0x7166('0x27')](_0x2328fa);})['then'](function(_0x3b6d5b){_0x3407b9['rows']=_0x3b6d5b;return _0x3407b9;})[_0x7166('0x15')](respondWithFilteredResult(_0x415ee1,_0x2328fa))[_0x7166('0x28')](handleError(_0x415ee1,null));};exports[_0x7166('0x29')]=function(_0x51ba62,_0x482f52){var _0x4cdc5b={'raw':!![],'where':{'id':_0x51ba62[_0x7166('0x2a')]['id']}},_0x38f987={};_0x38f987[_0x7166('0x2b')]=_['keys'](db[_0x7166('0x1f')][_0x7166('0x20')]);_0x38f987[_0x7166('0x26')]=_['keys'](_0x51ba62[_0x7166('0x26')]);_0x38f987[_0x7166('0x2c')]=_['intersection'](_0x38f987[_0x7166('0x2b')],_0x38f987[_0x7166('0x26')]);_0x4cdc5b[_0x7166('0x2d')]=_['intersection'](_0x38f987[_0x7166('0x2b')],qs[_0x7166('0x2e')](_0x51ba62[_0x7166('0x26')]['fields']));_0x4cdc5b[_0x7166('0x2d')]=_0x4cdc5b['attributes'][_0x7166('0x2f')]?_0x4cdc5b[_0x7166('0x2d')]:_0x38f987[_0x7166('0x2b')];if(_0x51ba62[_0x7166('0x26')][_0x7166('0x30')]){_0x4cdc5b[_0x7166('0x25')]=[{'all':!![]}];}_0x4cdc5b=_[_0x7166('0x31')]({},_0x4cdc5b,_0x51ba62[_0x7166('0x32')]);return db[_0x7166('0x1f')][_0x7166('0x33')](_0x4cdc5b)[_0x7166('0x15')](handleEntityNotFound(_0x482f52,null))[_0x7166('0x15')](respondWithResult(_0x482f52,null))['catch'](handleError(_0x482f52,null));};exports['create']=function(_0x45f9a4,_0x3df891){return db['OpenchannelQueue'][_0x7166('0x34')](_0x45f9a4[_0x7166('0x35')],{})[_0x7166('0x15')](function(_0x3f2d48){var _0x4331ca=_0x45f9a4[_0x7166('0x36')][_0x7166('0x37')]({'plain':!![]});if(!_0x4331ca)throw new Error(_0x7166('0x38'));if(_0x4331ca[_0x7166('0x39')]===_0x7166('0x36')){var _0x5c18c1=_0x3f2d48[_0x7166('0x37')]({'plain':!![]});var _0x41f0b9=_0x7166('0x3a');return db[_0x7166('0x3b')]['find']({'where':{'name':_0x41f0b9,'userProfileId':_0x4331ca[_0x7166('0x3c')]},'raw':!![]})[_0x7166('0x15')](function(_0x4a2bd0){if(_0x4a2bd0&&_0x4a2bd0[_0x7166('0x3d')]===0x0){return db[_0x7166('0x16')]['create']({'name':_0x5c18c1['name'],'resourceId':_0x5c18c1['id'],'type':_0x4a2bd0['name'],'sectionId':_0x4a2bd0['id']},{})[_0x7166('0x15')](function(){return _0x3f2d48;});}else{return _0x3f2d48;}})[_0x7166('0x28')](function(_0x473a18){logger[_0x7166('0x1a')](_0x7166('0x3e'),_0x473a18);throw _0x473a18;});}return _0x3f2d48;})[_0x7166('0x15')](respondWithResult(_0x3df891,0xc9))[_0x7166('0x28')](handleError(_0x3df891,null));};exports['update']=function(_0x586083,_0xc733ce){if(_0x586083['body']['id']){delete _0x586083['body']['id'];}return db[_0x7166('0x1f')][_0x7166('0x33')]({'where':{'id':_0x586083['params']['id']}})[_0x7166('0x15')](handleEntityNotFound(_0xc733ce,null))[_0x7166('0x15')](saveUpdates(_0x586083['body'],null))['then'](respondWithResult(_0xc733ce,null))['catch'](handleError(_0xc733ce,null));};exports[_0x7166('0x3f')]=function(_0x32a53e,_0x23691e){return db[_0x7166('0x1f')][_0x7166('0x33')]({'where':{'id':_0x32a53e[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x23691e,null))[_0x7166('0x15')](removeEntity(_0x23691e,null))[_0x7166('0x28')](handleError(_0x23691e,null));};exports[_0x7166('0x40')]=function(_0x31a114,_0x69cf10){return db[_0x7166('0x1f')][_0x7166('0x40')]()['then'](respondWithResult(_0x69cf10,null))['catch'](handleError(_0x69cf10,null));};exports[_0x7166('0x41')]=function(_0xacb728,_0x1db47b){var _0xbb1053={'raw':!![],'where':{}},_0x157114={},_0x53ad4e;return db[_0x7166('0x1f')][_0x7166('0x42')]({'where':{'id':_0xacb728[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x1db47b,null))[_0x7166('0x15')](function(_0x5c0f44){if(_0x5c0f44){_0x53ad4e=_0x5c0f44[_0x7166('0x37')]({'plain':!![]});_0x157114[_0x7166('0x2b')]=_[_0x7166('0x43')](db['UserOpenchannelQueue']['rawAttributes']);_0x157114[_0x7166('0x26')]=_['keys'](_0xacb728['query']);_0x157114[_0x7166('0x2c')]=_[_0x7166('0x44')](_0x157114[_0x7166('0x2b')],_0x157114[_0x7166('0x26')]);_0xbb1053[_0x7166('0x2d')]=_[_0x7166('0x44')](_0x157114['model'],qs[_0x7166('0x2e')](_0xacb728[_0x7166('0x26')][_0x7166('0x2e')]));_0xbb1053[_0x7166('0x2d')]=_0xbb1053[_0x7166('0x2d')][_0x7166('0x2f')]?_0xbb1053[_0x7166('0x2d')]:_0x157114['model'];if(!_0xacb728[_0x7166('0x26')][_0x7166('0x45')](_0x7166('0x46'))){_0xbb1053[_0x7166('0xf')]=qs['limit'](_0xacb728[_0x7166('0x26')][_0x7166('0xf')]);_0xbb1053[_0x7166('0x11')]=qs[_0x7166('0x11')](_0xacb728[_0x7166('0x26')]['offset']);}_0xbb1053['order']=qs['sort'](_0xacb728[_0x7166('0x26')][_0x7166('0x47')]);_0xbb1053[_0x7166('0x24')]=qs[_0x7166('0x2c')](_[_0x7166('0x48')](_0xacb728[_0x7166('0x26')],_0x157114[_0x7166('0x2c')]));_0xbb1053['where'][_0x7166('0x49')]=_0x5c0f44['id'];if(_0xacb728[_0x7166('0x26')][_0x7166('0x4a')]){_0xbb1053[_0x7166('0x24')]=_[_0x7166('0x31')](_0xbb1053['where'],{'$or':_[_0x7166('0x1e')](_0xbb1053[_0x7166('0x2d')],function(_0x3cc683){var _0x51e6c3={};_0x51e6c3[_0x3cc683]={'$like':'%'+_0xacb728[_0x7166('0x26')][_0x7166('0x4a')]+'%'};return _0x51e6c3;})});}_0xbb1053=_['merge']({},_0xbb1053,_0xacb728['options']);return db[_0x7166('0x4b')]['findAll'](_0xbb1053);}})[_0x7166('0x15')](function(_0x22561a){if(_0x22561a){return db[_0x7166('0x4c')][_0x7166('0x4d')]({'where':{'id':_['map'](_0x22561a,_0x7166('0x4e')),'role':_0x7166('0x4f')},'attributes':['id',_0x7166('0x1c'),'openchannelPause',_0x7166('0x50'),_0x7166('0x51')]});}})[_0x7166('0x15')](function(_0x2e0ff9){if(_0x2e0ff9){return{'count':_0x2e0ff9['count'],'rows':_['map'](_0x2e0ff9[_0x7166('0x52')],function(_0x36f6a5){return{'membername':_0x36f6a5['name'],'UserId':_0x36f6a5['id'],'queue_name':_0x53ad4e[_0x7166('0x1c')],'OpenchannelQueueId':_0x53ad4e['id'],'interface':util['format'](_0x7166('0x53'),_0x7166('0x54'),_0x36f6a5[_0x7166('0x1c')]),'penalty':0x0,'paused':_0x36f6a5['openchannelPause'],'createdAt':_0x36f6a5[_0x7166('0x51')],'updatedAt':_0x36f6a5[_0x7166('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7166('0x15')](respondWithFilteredResult(_0x1db47b,_0xbb1053))[_0x7166('0x28')](handleError(_0x1db47b,null));};exports[_0x7166('0x55')]=function(_0x564ce2,_0x22c841){var _0x6bc628={};var _0x388c51={};var _0x5f1469;var _0x42d118;return db[_0x7166('0x1f')][_0x7166('0x42')]({'where':{'id':_0x564ce2['params']['id']}})['then'](handleEntityNotFound(_0x22c841,null))[_0x7166('0x15')](function(_0x51aae2){if(_0x51aae2){_0x5f1469=_0x51aae2;_0x388c51[_0x7166('0x2b')]=_[_0x7166('0x43')](db[_0x7166('0x56')][_0x7166('0x20')]);_0x388c51[_0x7166('0x26')]=_['keys'](_0x564ce2[_0x7166('0x26')]);_0x388c51['filters']=_['intersection'](_0x388c51[_0x7166('0x2b')],_0x388c51['query']);_0x6bc628[_0x7166('0x2d')]=_[_0x7166('0x44')](_0x388c51[_0x7166('0x2b')],qs[_0x7166('0x2e')](_0x564ce2[_0x7166('0x26')]['fields']));_0x6bc628['attributes']=_0x6bc628[_0x7166('0x2d')][_0x7166('0x2f')]?_0x6bc628[_0x7166('0x2d')]:_0x388c51['model'];_0x6bc628[_0x7166('0x57')]=qs['sort'](_0x564ce2[_0x7166('0x26')]['sort']);_0x6bc628[_0x7166('0x24')]=qs[_0x7166('0x2c')](_[_0x7166('0x48')](_0x564ce2[_0x7166('0x26')],_0x388c51[_0x7166('0x2c')]));if(_0x564ce2[_0x7166('0x26')][_0x7166('0x4a')]){_0x6bc628[_0x7166('0x24')]=_[_0x7166('0x31')](_0x6bc628[_0x7166('0x24')],{'$or':_[_0x7166('0x1e')](_0x6bc628[_0x7166('0x2d')],function(_0x113728){var _0x1ca7af={};_0x1ca7af[_0x113728]={'$like':'%'+_0x564ce2[_0x7166('0x26')][_0x7166('0x4a')]+'%'};return _0x1ca7af;})});}_0x6bc628=_[_0x7166('0x31')]({},_0x6bc628,_0x564ce2[_0x7166('0x32')]);return _0x5f1469[_0x7166('0x55')](_0x6bc628);}})[_0x7166('0x15')](function(_0x54d07e){if(_0x54d07e){_0x42d118=_0x54d07e['length'];if(!_0x564ce2['query'][_0x7166('0x45')](_0x7166('0x46'))){_0x6bc628[_0x7166('0xf')]=qs[_0x7166('0xf')](_0x564ce2[_0x7166('0x26')]['limit']);_0x6bc628['offset']=qs[_0x7166('0x11')](_0x564ce2[_0x7166('0x26')]['offset']);}return _0x5f1469[_0x7166('0x55')](_0x6bc628);}})[_0x7166('0x15')](function(_0x42bd3c){if(_0x42bd3c){return _0x42bd3c?{'count':_0x42d118,'rows':_0x42bd3c}:null;}})[_0x7166('0x15')](respondWithResult(_0x22c841,null))[_0x7166('0x28')](handleError(_0x22c841,null));};exports[_0x7166('0x58')]=function(_0x488e43,_0x92695c){var _0x1c15de=_0x488e43[_0x7166('0x35')]['ids'];return db[_0x7166('0x56')]['findAll']({'where':{'id':_0x1c15de},'attributes':['id'],'include':[{'model':db[_0x7166('0x4c')],'as':'Agents','attributes':['id','name',_0x7166('0x59'),_0x7166('0x5a'),_0x7166('0x5b')],'raw':!![]}]})['then'](function(_0x2af550){if(_0x2af550){var _0x125ef4=_[_0x7166('0x5c')](_0x2af550,function(_0x2fbf26){var _0x9afad9=_0x2fbf26[_0x7166('0x37')]({'plain':!![]});return _0x9afad9['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0x488e43['params']['id']}})[_0x7166('0x15')](function(_0x1bff7c){return db[_0x7166('0x5d')]['transaction'](function(_0x558e0a){return _0x1bff7c[_0x7166('0x58')](_0x1c15de,{'transaction':_0x558e0a})[_0x7166('0x15')](function(){return BPromise[_0x7166('0x5e')](_0x125ef4,function(_0x391d68){return db[_0x7166('0x4b')][_0x7166('0x5f')]({'where':{'UserId':_0x391d68['id'],'OpenchannelQueueId':_0x488e43[_0x7166('0x2a')]['id']},'transaction':_0x558e0a});});})[_0x7166('0x15')](function(){_0x125ef4[_0x7166('0x60')](function(_0x1c98fa){socket[_0x7166('0x61')](_0x7166('0x62'),{'UserId':_0x1c98fa['id'],'OpenchannelQueueId':_0x1bff7c['id']});});});});});}})[_0x7166('0x15')](respondWithStatusCode(_0x92695c,null))[_0x7166('0x28')](handleError(_0x92695c,null));};exports[_0x7166('0x63')]=function(_0x7e33a2,_0x1f083e){return db['Team'][_0x7166('0x27')]({'where':{'id':_0x7e33a2[_0x7166('0x26')][_0x7166('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7166('0x15')](handleEntityNotFound(_0x1f083e,null))[_0x7166('0x15')](function(_0xd2d613){var _0x360908=_[_0x7166('0x1e')](_0xd2d613,'id');var _0x1817d6=[];var _0xc5d3e=[];var _0x5e4cb5=squel[_0x7166('0x65')]();_0x5e4cb5[_0x7166('0x66')](_0x7166('0x67'))[_0x7166('0x68')]('team_has_openchannel_queues','tq')[_0x7166('0x69')](_0x7166('0x6a'),'ut',_0x7166('0x6b'))['where'](_0x7166('0x6c'),_0x7e33a2[_0x7166('0x2a')]['id']);for(var _0x230052=0x0;_0x230052<_0xd2d613['length'];_0x230052+=0x1){let _0x60be12=_0xd2d613[_0x230052];for(var _0x31443d=0x0;_0x31443d<_0x60be12[_0x7166('0x6d')]['length'];_0x31443d+=0x1){let _0x2e9c9c=_0x60be12[_0x7166('0x6d')][_0x31443d];var _0x2d769d=_0x5e4cb5['clone']();_0x2d769d[_0x7166('0x24')]('ut.UserId\x20=\x20?',_0x2e9c9c['id']);_0xc5d3e[_0x7166('0x6e')](db['sequelize'][_0x7166('0x26')](_0x2d769d[_0x7166('0x6f')](),{'type':db[_0x7166('0x5d')][_0x7166('0x70')][_0x7166('0x71')]})[_0x7166('0x15')](function(_0x4e05a6){if(_0x4e05a6[_0x7166('0x2f')]===0x1){return _0x2e9c9c['id'];}else{var _0x16e81=_[_0x7166('0x72')](_[_0x7166('0x1e')](_0x4e05a6,_0x7166('0x73')),function(_0x464e3d){return _[_0x7166('0x74')](_0x360908,_0x464e3d);});if(_0x16e81){return _0x2e9c9c['id'];}}}));}}return BPromise[_0x7166('0x75')](_0xc5d3e)['then'](function(_0x6d4729){_0x1817d6=_(_0x1817d6)['union'](_0x6d4729)[_0x7166('0x76')]()[_0x7166('0x77')]();return db[_0x7166('0x1f')][_0x7166('0x33')]({'where':{'id':_0x7e33a2[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](function(_0x178487){return db[_0x7166('0x5d')][_0x7166('0x78')](function(_0x2cf1c2){return _0x178487['removeTeams'](_0x7e33a2[_0x7166('0x26')][_0x7166('0x64')],{'transaction':_0x2cf1c2})['then'](function(){if(!_[_0x7166('0x79')](_0x1817d6)){return _0x178487['removeAgents'](_0x1817d6,{'transaction':_0x2cf1c2});}})[_0x7166('0x15')](function(){_0x1817d6[_0x7166('0x60')](function(_0xb45e70){socket[_0x7166('0x61')](_0x7166('0x7a'),{'UserId':_0xb45e70,'OpenchannelQueueId':_0x178487['id']});});});});});});})['then'](respondWithStatusCode(_0x1f083e,null))[_0x7166('0x28')](handleError(_0x1f083e,null));};exports[_0x7166('0x7b')]=function(_0x142926,_0x444585){return db['OpenchannelQueue']['find']({'where':{'id':_0x142926[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x444585,null))[_0x7166('0x15')](function(_0x432bfb){if(_0x432bfb){return _0x432bfb[_0x7166('0x7b')](_0x142926[_0x7166('0x35')]['ids'],_[_0x7166('0x7c')](_0x142926[_0x7166('0x35')],[_0x7166('0x64'),'id'])||{})['spread'](function(_0x43ebe1){for(var _0x56b5cc=0x0;_0x56b5cc<_0x142926[_0x7166('0x35')]['ids'][_0x7166('0x2f')];_0x56b5cc+=0x1){socket[_0x7166('0x61')]('userOpenchannelQueue:save',{'UserId':Number(_0x142926[_0x7166('0x35')][_0x7166('0x64')][_0x56b5cc]),'OpenchannelQueueId':Number(_0x142926[_0x7166('0x2a')]['id'])});}return _0x43ebe1;});}})['then'](respondWithResult(_0x444585,null))[_0x7166('0x28')](handleError(_0x444585,null));};exports['removeAgents']=function(_0x64e32f,_0x2200c7){return db['OpenchannelQueue'][_0x7166('0x33')]({'where':{'id':_0x64e32f[_0x7166('0x2a')]['id']}})[_0x7166('0x15')](handleEntityNotFound(_0x2200c7,null))['then'](function(_0x32c13e){if(_0x32c13e){return _0x32c13e[_0x7166('0x7d')](_0x64e32f[_0x7166('0x26')][_0x7166('0x64')])[_0x7166('0x15')](function(){if(_[_0x7166('0x7e')](_0x64e32f[_0x7166('0x26')][_0x7166('0x64')])){for(var _0x20b63b=0x0;_0x20b63b<_0x64e32f[_0x7166('0x26')]['ids'][_0x7166('0x2f')];_0x20b63b+=0x1){socket['emit'](_0x7166('0x7a'),{'UserId':Number(_0x64e32f['query'][_0x7166('0x64')][_0x20b63b]),'OpenchannelQueueId':Number(_0x64e32f[_0x7166('0x2a')]['id'])});}}else{socket[_0x7166('0x61')](_0x7166('0x7a'),{'UserId':Number(_0x64e32f[_0x7166('0x26')][_0x7166('0x64')]),'OpenchannelQueueId':Number(_0x64e32f[_0x7166('0x2a')]['id'])});}});}})[_0x7166('0x15')](respondWithStatusCode(_0x2200c7,null))[_0x7166('0x28')](handleError(_0x2200c7,null));};exports[_0x7166('0x7f')]=function(_0x21cd02,_0x410746){var _0x358462={};var _0x178db9={};var _0x9ef605;var _0x462377;return db[_0x7166('0x1f')][_0x7166('0x42')]({'where':{'id':_0x21cd02[_0x7166('0x2a')]['id']}})['then'](handleEntityNotFound(_0x410746,null))[_0x7166('0x15')](function(_0x4a8470){if(_0x4a8470){_0x9ef605=_0x4a8470;_0x178db9[_0x7166('0x2b')]=_[_0x7166('0x43')](db[_0x7166('0x4c')][_0x7166('0x20')]);_0x178db9[_0x7166('0x26')]=_[_0x7166('0x43')](_0x21cd02['query']);_0x178db9[_0x7166('0x2c')]=_[_0x7166('0x44')](_0x178db9['model'],_0x178db9[_0x7166('0x26')]);_0x358462['attributes']=_[_0x7166('0x44')](_0x178db9[_0x7166('0x2b')],qs['fields'](_0x21cd02['query'][_0x7166('0x2e')]));_0x358462[_0x7166('0x2d')]=_0x358462[_0x7166('0x2d')]['length']?_0x358462[_0x7166('0x2d')]:_0x178db9[_0x7166('0x2b')];_0x358462[_0x7166('0x57')]=qs['sort'](_0x21cd02[_0x7166('0x26')][_0x7166('0x47')]);_0x358462[_0x7166('0x24')]=qs[_0x7166('0x2c')](_[_0x7166('0x48')](_0x21cd02[_0x7166('0x26')],_0x178db9[_0x7166('0x2c')]));if(_0x21cd02['query']['filter']){_0x358462[_0x7166('0x24')]=_[_0x7166('0x31')](_0x358462[_0x7166('0x24')],{'$or':_[_0x7166('0x1e')](_0x358462['attributes'],function(_0xcfaf79){var _0x4d74cc={};_0x4d74cc[_0xcfaf79]={'$like':'%'+_0x21cd02[_0x7166('0x26')][_0x7166('0x4a')]+'%'};return _0x4d74cc;})});}_0x358462=_[_0x7166('0x31')]({},_0x358462,_0x21cd02[_0x7166('0x32')]);return _0x9ef605[_0x7166('0x7f')](_0x358462);}})[_0x7166('0x15')](function(_0x203a61){if(_0x203a61){_0x462377=_0x203a61[_0x7166('0x2f')];if(!_0x21cd02[_0x7166('0x26')][_0x7166('0x45')](_0x7166('0x46'))){_0x358462[_0x7166('0xf')]=qs['limit'](_0x21cd02[_0x7166('0x26')]['limit']);_0x358462[_0x7166('0x11')]=qs[_0x7166('0x11')](_0x21cd02['query'][_0x7166('0x11')]);}return _0x9ef605[_0x7166('0x7f')](_0x358462);}})[_0x7166('0x15')](function(_0x1a021f){if(_0x1a021f){return _0x1a021f?{'count':_0x462377,'rows':_0x1a021f}:null;}})[_0x7166('0x15')](respondWithResult(_0x410746,null))[_0x7166('0x28')](handleError(_0x410746,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 67a429e..d62a92f 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 _0x6185=['hook','exports','../../mysqldb','OpenchannelQueue','update','remove','emit','hasOwnProperty'];(function(_0x5369a8,_0xf9bc60){var _0x3daf85=function(_0x3883e3){while(--_0x3883e3){_0x5369a8['push'](_0x5369a8['shift']());}};_0x3daf85(++_0xf9bc60);}(_0x6185,0x1b2));var _0x5618=function(_0xec2d8,_0x5bc72f){_0xec2d8=_0xec2d8-0x0;var _0x321e8a=_0x6185[_0xec2d8];return _0x321e8a;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x5618('0x0'))['db'][_0x5618('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5618('0x2'),'afterDestroy':_0x5618('0x3')};function emitEvent(_0x41c18a){return function(_0x5e22dd,_0x18e347,_0x31f371){OpenchannelQueueEvents[_0x5618('0x4')](_0x41c18a+':'+_0x5e22dd['id'],_0x5e22dd);OpenchannelQueueEvents[_0x5618('0x4')](_0x41c18a,_0x5e22dd);_0x31f371(null);};}for(var e in events){if(events[_0x5618('0x5')](e)){var event=events[e];OpenchannelQueue[_0x5618('0x6')](e,emitEvent(event));}}module[_0x5618('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xf76a=['OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xd4f447,_0x4e1d02){var _0x3f5115=function(_0x26e62f){while(--_0x26e62f){_0xd4f447['push'](_0xd4f447['shift']());}};_0x3f5115(++_0x4e1d02);}(_0xf76a,0xfa));var _0xaf76=function(_0x529773,_0x292c4d){_0x529773=_0x529773-0x0;var _0x17b930=_0xf76a[_0x529773];return _0x17b930;};'use strict';var EventEmitter=require(_0xaf76('0x0'));var OpenchannelQueue=require(_0xaf76('0x1'))['db'][_0xaf76('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xaf76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf76('0x4'),'afterDestroy':_0xaf76('0x5')};function emitEvent(_0x29f6dd){return function(_0x1f04a4,_0x508512,_0x3d9c58){OpenchannelQueueEvents['emit'](_0x29f6dd+':'+_0x1f04a4['id'],_0x1f04a4);OpenchannelQueueEvents[_0xaf76('0x6')](_0x29f6dd,_0x1f04a4);_0x3d9c58(null);};}for(var e in events){if(events[_0xaf76('0x7')](e)){var event=events[e];OpenchannelQueue[_0xaf76('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 37a2f28..80f8365 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 _0x3a0c=['define','openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x3e56aa,_0x16ea57){var _0x225560=function(_0x29c789){while(--_0x29c789){_0x3e56aa['push'](_0x3e56aa['shift']());}};_0x225560(++_0x16ea57);}(_0x3a0c,0x183));var _0xc3a0=function(_0x112761,_0x5447fa){_0x112761=_0x112761-0x0;var _0x4e84a1=_0x3a0c[_0x112761];return _0x4e84a1;};'use strict';var _=require(_0xc3a0('0x0'));var util=require(_0xc3a0('0x1'));var logger=require(_0xc3a0('0x2'))(_0xc3a0('0x3'));var moment=require('moment');var BPromise=require(_0xc3a0('0x4'));var rp=require(_0xc3a0('0x5'));var fs=require('fs');var path=require(_0xc3a0('0x6'));var rimraf=require(_0xc3a0('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0xc3a0('0x8')]=function(_0x2d1912,_0x3fcd19){return _0x2d1912[_0xc3a0('0x9')]('OpenchannelQueue',attributes,{'tableName':_0xc3a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5236=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x339a78,_0x19418a){var _0x2b9252=function(_0x2a53db){while(--_0x2a53db){_0x339a78['push'](_0x339a78['shift']());}};_0x2b9252(++_0x19418a);}(_0x5236,0x1d4));var _0x6523=function(_0x21e976,_0x335ac5){_0x21e976=_0x21e976-0x0;var _0x532bea=_0x5236[_0x21e976];return _0x532bea;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var logger=require(_0x6523('0x2'))(_0x6523('0x3'));var moment=require(_0x6523('0x4'));var BPromise=require('bluebird');var rp=require(_0x6523('0x5'));var fs=require('fs');var path=require(_0x6523('0x6'));var rimraf=require('rimraf');var config=require(_0x6523('0x7'));var attributes=require(_0x6523('0x8'));module[_0x6523('0x9')]=function(_0x35fa7b,_0xb06b8b){return _0x35fa7b[_0x6523('0xa')](_0x6523('0xb'),attributes,{'tableName':_0x6523('0xc'),'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 0a57ed4..ccd84d7 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 _0x3f10=['map','model','GetOpenchannelQueue','OpenchannelQueue','find','ShowOpenchannelQueue','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0x17c487,_0x2b72f1){var _0x3feeb8=function(_0x49aaa1){while(--_0x49aaa1){_0x17c487['push'](_0x17c487['shift']());}};_0x3feeb8(++_0x2b72f1);}(_0x3f10,0x78));var _0x03f1=function(_0x53264f,_0x42d40f){_0x53264f=_0x53264f-0x0;var _0x2792db=_0x3f10[_0x53264f];return _0x2792db;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x03f1('0x0'));var rs=require(_0x03f1('0x1'));var fs=require('fs');var Redis=require(_0x03f1('0x2'));var db=require(_0x03f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x03f1('0x4'))(_0x03f1('0x5'));var config=require('../../config/environment');var jayson=require(_0x03f1('0x6'));var client=jayson['client'][_0x03f1('0x7')]({'port':0x232a});config[_0x03f1('0x8')]=_[_0x03f1('0x9')](config[_0x03f1('0x8')],{'host':_0x03f1('0xa'),'port':0x18eb});var socket=require(_0x03f1('0xb'))(new Redis(config[_0x03f1('0x8')]));require(_0x03f1('0xc'))[_0x03f1('0xd')](socket);function respondWithRpcPromise(_0x1eb31f,_0x4698ff,_0x186e21){return new BPromise(function(_0x1add7f,_0x3b3b36){return client[_0x03f1('0xe')](_0x1eb31f,_0x186e21)[_0x03f1('0xf')](function(_0x13c57e){logger[_0x03f1('0x10')](_0x03f1('0x11'),_0x4698ff,'request\x20sent');logger['debug'](_0x03f1('0x12'),_0x4698ff,_0x03f1('0x13'),JSON[_0x03f1('0x14')](_0x13c57e));if(_0x13c57e[_0x03f1('0x15')]){if(_0x13c57e['error']['code']===0x1f4){logger[_0x03f1('0x15')](_0x03f1('0x11'),_0x4698ff,_0x13c57e[_0x03f1('0x15')][_0x03f1('0x16')]);return _0x3b3b36(_0x13c57e[_0x03f1('0x15')][_0x03f1('0x16')]);}logger['error'](_0x03f1('0x11'),_0x4698ff,_0x13c57e['error'][_0x03f1('0x16')]);return _0x1add7f(_0x13c57e['error'][_0x03f1('0x16')]);}else{logger[_0x03f1('0x10')](_0x03f1('0x11'),_0x4698ff,_0x03f1('0x13'));_0x1add7f(_0x13c57e[_0x03f1('0x17')][_0x03f1('0x16')]);}})[_0x03f1('0x18')](function(_0x159d9e){logger[_0x03f1('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4698ff,_0x159d9e);_0x3b3b36(_0x159d9e);});});}exports['GetOpenchannelQueue']=function(_0x553740){var _0x32d4c5=this;return new Promise(function(_0x34a684,_0x3c9bfe){return db['OpenchannelQueue'][_0x03f1('0x19')]({'raw':_0x553740[_0x03f1('0x1a')]?_0x553740[_0x03f1('0x1a')][_0x03f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x553740[_0x03f1('0x1a')]?_0x553740[_0x03f1('0x1a')][_0x03f1('0x1c')]||null:null,'attributes':_0x553740[_0x03f1('0x1a')]?_0x553740[_0x03f1('0x1a')][_0x03f1('0x1d')]||null:null,'limit':_0x553740['options']?_0x553740['options'][_0x03f1('0x1e')]||null:null,'include':_0x553740[_0x03f1('0x1a')]?_0x553740[_0x03f1('0x1a')][_0x03f1('0x1f')]?_[_0x03f1('0x20')](_0x553740[_0x03f1('0x1a')][_0x03f1('0x1f')],function(_0x5489c9){return{'model':db[_0x5489c9[_0x03f1('0x21')]],'as':_0x5489c9['as'],'attributes':_0x5489c9[_0x03f1('0x1d')],'include':_0x5489c9[_0x03f1('0x1f')]?_[_0x03f1('0x20')](_0x5489c9[_0x03f1('0x1f')],function(_0x3f6b57){return{'model':db[_0x3f6b57[_0x03f1('0x21')]],'as':_0x3f6b57['as'],'attributes':_0x3f6b57['attributes'],'include':_0x3f6b57['include']?_['map'](_0x3f6b57[_0x03f1('0x1f')],function(_0x253106){return{'model':db[_0x253106[_0x03f1('0x21')]],'as':_0x253106['as'],'attributes':_0x253106['attributes']};}):[]};}):[]};}):[]:[]})[_0x03f1('0xf')](function(_0x39bd1e){logger[_0x03f1('0x10')](_0x03f1('0x22'),_0x553740);logger['debug'](_0x03f1('0x22'),_0x553740,JSON[_0x03f1('0x14')](_0x39bd1e));_0x34a684(_0x39bd1e);})[_0x03f1('0x18')](function(_0x59833a){logger[_0x03f1('0x15')](_0x03f1('0x22'),_0x59833a[_0x03f1('0x16')],_0x553740);_0x3c9bfe(_0x32d4c5['error'](0x1f4,_0x59833a[_0x03f1('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x449417){var _0x1f2809=this;return new Promise(function(_0x3cdf29,_0x47b193){return db[_0x03f1('0x23')][_0x03f1('0x24')]({'raw':_0x449417['options']?_0x449417[_0x03f1('0x1a')][_0x03f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x449417[_0x03f1('0x1a')]?_0x449417[_0x03f1('0x1a')]['where']||null:null,'attributes':_0x449417[_0x03f1('0x1a')]?_0x449417[_0x03f1('0x1a')]['attributes']||null:null,'include':_0x449417[_0x03f1('0x1a')]?_0x449417[_0x03f1('0x1a')]['include']?_[_0x03f1('0x20')](_0x449417['options']['include'],function(_0x3e5c1f){return{'model':db[_0x3e5c1f['model']],'as':_0x3e5c1f['as'],'attributes':_0x3e5c1f[_0x03f1('0x1d')],'include':_0x3e5c1f[_0x03f1('0x1f')]?_[_0x03f1('0x20')](_0x3e5c1f[_0x03f1('0x1f')],function(_0x3a7ed3){return{'model':db[_0x3a7ed3[_0x03f1('0x21')]],'as':_0x3a7ed3['as'],'attributes':_0x3a7ed3[_0x03f1('0x1d')],'include':_0x3a7ed3[_0x03f1('0x1f')]?_[_0x03f1('0x20')](_0x3a7ed3[_0x03f1('0x1f')],function(_0x263f8e){return{'model':db[_0x263f8e['model']],'as':_0x263f8e['as'],'attributes':_0x263f8e[_0x03f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x03f1('0xf')](function(_0x310450){logger[_0x03f1('0x10')](_0x03f1('0x25'),_0x449417);logger['debug'](_0x03f1('0x25'),_0x449417,JSON[_0x03f1('0x14')](_0x310450));_0x3cdf29(_0x310450);})['catch'](function(_0x29eded){logger[_0x03f1('0x15')]('ShowOpenchannelQueue',_0x29eded['message'],_0x449417);_0x47b193(_0x1f2809['error'](0x1f4,_0x29eded[_0x03f1('0x16')]));});});}; \ No newline at end of file +var _0x9c59=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetOpenchannelQueue','findAll','options','raw','limit','include','model','map','attributes','debug','ShowOpenchannelQueue','find','where','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0xbddfbf,_0x27b320){var _0x276844=function(_0x196646){while(--_0x196646){_0xbddfbf['push'](_0xbddfbf['shift']());}};_0x276844(++_0x27b320);}(_0x9c59,0x68));var _0x99c5=function(_0x5c398e,_0x42d518){_0x5c398e=_0x5c398e-0x0;var _0x17fac1=_0x9c59[_0x5c398e];return _0x17fac1;};'use strict';var _=require(_0x99c5('0x0'));var util=require('util');var moment=require(_0x99c5('0x1'));var BPromise=require('bluebird');var rs=require(_0x99c5('0x2'));var fs=require('fs');var Redis=require(_0x99c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x99c5('0x4'));var logger=require('../../config/logger')(_0x99c5('0x5'));var config=require(_0x99c5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x99c5('0x7')][_0x99c5('0x8')]({'port':0x232a});config[_0x99c5('0x9')]=_[_0x99c5('0xa')](config[_0x99c5('0x9')],{'host':_0x99c5('0xb'),'port':0x18eb});var socket=require(_0x99c5('0xc'))(new Redis(config[_0x99c5('0x9')]));require(_0x99c5('0xd'))[_0x99c5('0xe')](socket);function respondWithRpcPromise(_0x2620d1,_0x122bad,_0x13b699){return new BPromise(function(_0x4c3719,_0x3811d3){return client[_0x99c5('0xf')](_0x2620d1,_0x13b699)['then'](function(_0x13b642){logger[_0x99c5('0x10')](_0x99c5('0x11'),_0x122bad,'request\x20sent');logger['debug'](_0x99c5('0x12'),_0x122bad,_0x99c5('0x13'),JSON[_0x99c5('0x14')](_0x13b642));if(_0x13b642[_0x99c5('0x15')]){if(_0x13b642[_0x99c5('0x15')]['code']===0x1f4){logger[_0x99c5('0x15')](_0x99c5('0x11'),_0x122bad,_0x13b642['error'][_0x99c5('0x16')]);return _0x3811d3(_0x13b642['error']['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x122bad,_0x13b642[_0x99c5('0x15')][_0x99c5('0x16')]);return _0x4c3719(_0x13b642[_0x99c5('0x15')][_0x99c5('0x16')]);}else{logger[_0x99c5('0x10')](_0x99c5('0x11'),_0x122bad,'request\x20sent');_0x4c3719(_0x13b642['result'][_0x99c5('0x16')]);}})[_0x99c5('0x17')](function(_0x1fb4eb){logger[_0x99c5('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x122bad,_0x1fb4eb);_0x3811d3(_0x1fb4eb);});});}exports[_0x99c5('0x18')]=function(_0x2891ab){var _0x4a3816=this;return new Promise(function(_0x53caa8,_0x4f1368){return db['OpenchannelQueue'][_0x99c5('0x19')]({'raw':_0x2891ab[_0x99c5('0x1a')]?_0x2891ab[_0x99c5('0x1a')][_0x99c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x2891ab['options']?_0x2891ab[_0x99c5('0x1a')]['where']||null:null,'attributes':_0x2891ab[_0x99c5('0x1a')]?_0x2891ab[_0x99c5('0x1a')]['attributes']||null:null,'limit':_0x2891ab[_0x99c5('0x1a')]?_0x2891ab[_0x99c5('0x1a')][_0x99c5('0x1c')]||null:null,'include':_0x2891ab['options']?_0x2891ab[_0x99c5('0x1a')][_0x99c5('0x1d')]?_['map'](_0x2891ab[_0x99c5('0x1a')]['include'],function(_0x3c5b74){return{'model':db[_0x3c5b74[_0x99c5('0x1e')]],'as':_0x3c5b74['as'],'attributes':_0x3c5b74['attributes'],'include':_0x3c5b74[_0x99c5('0x1d')]?_[_0x99c5('0x1f')](_0x3c5b74[_0x99c5('0x1d')],function(_0x365ec1){return{'model':db[_0x365ec1[_0x99c5('0x1e')]],'as':_0x365ec1['as'],'attributes':_0x365ec1[_0x99c5('0x20')],'include':_0x365ec1[_0x99c5('0x1d')]?_[_0x99c5('0x1f')](_0x365ec1[_0x99c5('0x1d')],function(_0x2ef14f){return{'model':db[_0x2ef14f['model']],'as':_0x2ef14f['as'],'attributes':_0x2ef14f[_0x99c5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x262300){logger[_0x99c5('0x10')]('GetOpenchannelQueue',_0x2891ab);logger[_0x99c5('0x21')](_0x99c5('0x18'),_0x2891ab,JSON['stringify'](_0x262300));_0x53caa8(_0x262300);})['catch'](function(_0x388ed4){logger[_0x99c5('0x15')](_0x99c5('0x18'),_0x388ed4['message'],_0x2891ab);_0x4f1368(_0x4a3816['error'](0x1f4,_0x388ed4['message']));});});};exports[_0x99c5('0x22')]=function(_0x46e12d){var _0x21cdbb=this;return new Promise(function(_0x443d90,_0x572072){return db['OpenchannelQueue'][_0x99c5('0x23')]({'raw':_0x46e12d[_0x99c5('0x1a')]?_0x46e12d[_0x99c5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46e12d[_0x99c5('0x1a')]?_0x46e12d['options'][_0x99c5('0x24')]||null:null,'attributes':_0x46e12d[_0x99c5('0x1a')]?_0x46e12d[_0x99c5('0x1a')][_0x99c5('0x20')]||null:null,'include':_0x46e12d['options']?_0x46e12d[_0x99c5('0x1a')][_0x99c5('0x1d')]?_[_0x99c5('0x1f')](_0x46e12d[_0x99c5('0x1a')]['include'],function(_0x2ea8f7){return{'model':db[_0x2ea8f7[_0x99c5('0x1e')]],'as':_0x2ea8f7['as'],'attributes':_0x2ea8f7[_0x99c5('0x20')],'include':_0x2ea8f7['include']?_[_0x99c5('0x1f')](_0x2ea8f7['include'],function(_0x241285){return{'model':db[_0x241285[_0x99c5('0x1e')]],'as':_0x241285['as'],'attributes':_0x241285[_0x99c5('0x20')],'include':_0x241285['include']?_[_0x99c5('0x1f')](_0x241285[_0x99c5('0x1d')],function(_0x58ac19){return{'model':db[_0x58ac19[_0x99c5('0x1e')]],'as':_0x58ac19['as'],'attributes':_0x58ac19[_0x99c5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5106fa){logger[_0x99c5('0x10')](_0x99c5('0x22'),_0x46e12d);logger[_0x99c5('0x21')](_0x99c5('0x22'),_0x46e12d,JSON[_0x99c5('0x14')](_0x5106fa));_0x443d90(_0x5106fa);})[_0x99c5('0x17')](function(_0x73a728){logger[_0x99c5('0x15')](_0x99c5('0x22'),_0x73a728[_0x99c5('0x16')],_0x46e12d);_0x572072(_0x21cdbb[_0x99c5('0x15')](0x1f4,_0x73a728[_0x99c5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3dcc4f9..c2ed0b0 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 _0x1407=['save','remove','update','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x530a8e,_0xfcd26c){var _0xa9582d=function(_0x407ffe){while(--_0x407ffe){_0x530a8e['push'](_0x530a8e['shift']());}};_0xa9582d(++_0xfcd26c);}(_0x1407,0xdf));var _0x7140=function(_0x3ab03d,_0x3825eb){_0x3ab03d=_0x3ab03d-0x0;var _0x527fd6=_0x1407[_0x3ab03d];return _0x527fd6;};'use strict';var OpenchannelQueueEvents=require(_0x7140('0x0'));var events=[_0x7140('0x1'),_0x7140('0x2'),_0x7140('0x3')];function createListener(_0x593615,_0x3843b2){return function(_0x161964){_0x3843b2['emit'](_0x593615,_0x161964);};}function removeListener(_0x106ef1,_0x209fe9){return function(){OpenchannelQueueEvents['removeListener'](_0x106ef1,_0x209fe9);};}exports[_0x7140('0x4')]=function(_0x27d93e){for(var _0x2db21e=0x0,_0x18faf5=events[_0x7140('0x5')];_0x2db21e<_0x18faf5;_0x2db21e++){var _0x3400a2=events[_0x2db21e];var _0x4326f7=createListener(_0x7140('0x6')+_0x3400a2,_0x27d93e);OpenchannelQueueEvents['on'](_0x3400a2,_0x4326f7);}}; \ No newline at end of file +var _0x9568=['emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x1daf2e,_0x1c2415){var _0x3b1148=function(_0x510527){while(--_0x510527){_0x1daf2e['push'](_0x1daf2e['shift']());}};_0x3b1148(++_0x1c2415);}(_0x9568,0xc7));var _0x8956=function(_0x482393,_0x355061){_0x482393=_0x482393-0x0;var _0x4c07ae=_0x9568[_0x482393];return _0x4c07ae;};'use strict';var OpenchannelQueueEvents=require(_0x8956('0x0'));var events=[_0x8956('0x1'),_0x8956('0x2'),_0x8956('0x3')];function createListener(_0x31185d,_0x5c43e7){return function(_0x5d8f5b){_0x5c43e7[_0x8956('0x4')](_0x31185d,_0x5d8f5b);};}function removeListener(_0x2d9297,_0x567bea){return function(){OpenchannelQueueEvents[_0x8956('0x5')](_0x2d9297,_0x567bea);};}exports['register']=function(_0x3bc61b){for(var _0x20393b=0x0,_0x220b36=events['length'];_0x20393b<_0x220b36;_0x20393b++){var _0x100d13=events[_0x20393b];var _0x4b907d=createListener(_0x8956('0x6')+_0x100d13,_0x3bc61b);OpenchannelQueueEvents['on'](_0x100d13,_0x4b907d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 705fe30..c6d7995 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 _0xc9b8=['index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','fs-extra','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0x4b97c6,_0x21017c){var _0x342ead=function(_0x3675e0){while(--_0x3675e0){_0x4b97c6['push'](_0x4b97c6['shift']());}};_0x342ead(++_0x21017c);}(_0xc9b8,0x161));var _0x8c9b=function(_0x44a8a2,_0x3fe728){_0x44a8a2=_0x44a8a2-0x0;var _0x91b58f=_0xc9b8[_0x44a8a2];return _0x91b58f;};'use strict';var multer=require(_0x8c9b('0x0'));var util=require(_0x8c9b('0x1'));var path=require(_0x8c9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c9b('0x3'));var router=express['Router']();var fs_extra=require(_0x8c9b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c9b('0x5'));router[_0x8c9b('0x6')]('/',auth[_0x8c9b('0x7')](),controller[_0x8c9b('0x8')]);router[_0x8c9b('0x6')](_0x8c9b('0x9'),auth['isAuthenticated'](),controller[_0x8c9b('0xa')]);router[_0x8c9b('0x6')](_0x8c9b('0xb'),auth['isAuthenticated'](),controller[_0x8c9b('0xc')]);router[_0x8c9b('0xd')]('/',auth['isAuthenticated'](),controller[_0x8c9b('0xe')]);router['put'](_0x8c9b('0xb'),auth[_0x8c9b('0x7')](),controller[_0x8c9b('0xf')]);router[_0x8c9b('0x10')](_0x8c9b('0xb'),auth[_0x8c9b('0x7')](),controller[_0x8c9b('0x11')]);module[_0x8c9b('0x12')]=router; \ No newline at end of file +var _0x7d6f=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5488cc,_0x57b187){var _0xa8962e=function(_0x4be4d5){while(--_0x4be4d5){_0x5488cc['push'](_0x5488cc['shift']());}};_0xa8962e(++_0x57b187);}(_0x7d6f,0x126));var _0xf7d6=function(_0x188d50,_0x4e8f69){_0x188d50=_0x188d50-0x0;var _0x18a3d3=_0x7d6f[_0x188d50];return _0x18a3d3;};'use strict';var multer=require('multer');var util=require(_0xf7d6('0x0'));var path=require(_0xf7d6('0x1'));var timeout=require(_0xf7d6('0x2'));var express=require(_0xf7d6('0x3'));var router=express[_0xf7d6('0x4')]();var fs_extra=require(_0xf7d6('0x5'));var auth=require(_0xf7d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7d6('0x7'));var controller=require(_0xf7d6('0x8'));router[_0xf7d6('0x9')]('/',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0xb')]);router[_0xf7d6('0x9')](_0xf7d6('0xc'),auth[_0xf7d6('0xa')](),controller[_0xf7d6('0xd')]);router[_0xf7d6('0x9')](_0xf7d6('0xe'),auth['isAuthenticated'](),controller[_0xf7d6('0xf')]);router[_0xf7d6('0x10')]('/',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0x11')]);router[_0xf7d6('0x12')](_0xf7d6('0xe'),auth[_0xf7d6('0xa')](),controller['update']);router[_0xf7d6('0x13')]('/:id',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0x14')]);module[_0xf7d6('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 15c1e55..4f972f0 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 _0xfc2d=['sequelize','exports','STRING','DATE','moment'];(function(_0x4ee881,_0x10ddc8){var _0x305f48=function(_0x5303d5){while(--_0x5303d5){_0x4ee881['push'](_0x4ee881['shift']());}};_0x305f48(++_0x10ddc8);}(_0xfc2d,0x149));var _0xdfc2=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xfc2d[_0x5eef05];return _0x56d4b8;};'use strict';var moment=require(_0xdfc2('0x0'));var Sequelize=require(_0xdfc2('0x1'));module[_0xdfc2('0x2')]={'uniqueid':{'type':Sequelize[_0xdfc2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdfc2('0x3')]},'joinAt':{'type':Sequelize[_0xdfc2('0x4')]},'leaveAt':{'type':Sequelize[_0xdfc2('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdfc2('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4840=['sequelize','exports','STRING','DATE','moment'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4840,0x6d));var _0x0484=function(_0x200960,_0x36ea91){_0x200960=_0x200960-0x0;var _0x188d9f=_0x4840[_0x200960];return _0x188d9f;};'use strict';var moment=require(_0x0484('0x0'));var Sequelize=require(_0x0484('0x1'));module[_0x0484('0x2')]={'uniqueid':{'type':Sequelize[_0x0484('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0484('0x3')]},'joinAt':{'type':Sequelize[_0x0484('0x4')]},'leaveAt':{'type':Sequelize[_0x0484('0x4')]},'acceptAt':{'type':Sequelize[_0x0484('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0484('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8ebf6d1..09aa6e2 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 _0xba45=['catch','show','params','OpenchannelQueueReport','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','include','findAll','rows'];(function(_0x4d063f,_0x32f1fd){var _0x597d8a=function(_0x584b92){while(--_0x584b92){_0x4d063f['push'](_0x4d063f['shift']());}};_0x597d8a(++_0x32f1fd);}(_0xba45,0xdf));var _0x5ba4=function(_0x16a679,_0x290e45){_0x16a679=_0x16a679-0x0;var _0x11daf=_0xba45[_0x16a679];return _0x11daf;};'use strict';var emlformat=require(_0x5ba4('0x0'));var rimraf=require(_0x5ba4('0x1'));var zipdir=require(_0x5ba4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ba4('0x3'));var moment=require(_0x5ba4('0x4'));var BPromise=require(_0x5ba4('0x5'));var Mustache=require('mustache');var util=require(_0x5ba4('0x6'));var path=require(_0x5ba4('0x7'));var sox=require(_0x5ba4('0x8'));var csv=require(_0x5ba4('0x9'));var ejs=require(_0x5ba4('0xa'));var fs=require('fs');var fs_extra=require(_0x5ba4('0xb'));var _=require('lodash');var squel=require(_0x5ba4('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ba4('0xd'));var deskjs=require(_0x5ba4('0xe'));var toCsv=require(_0x5ba4('0x9'));var querystring=require(_0x5ba4('0xf'));var Papa=require(_0x5ba4('0x10'));var Redis=require(_0x5ba4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5ba4('0x12'));var utils=require(_0x5ba4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5ba4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14fe8b,_0x55c314){_0x55c314=_0x55c314||0xcc;return function(_0x13f1d2){if(_0x13f1d2){return _0x14fe8b[_0x5ba4('0x15')](_0x55c314);}return _0x14fe8b[_0x5ba4('0x16')](_0x55c314)[_0x5ba4('0x17')]();};}function respondWithResult(_0xa5e44f,_0x4356d1){_0x4356d1=_0x4356d1||0xc8;return function(_0x16c5eb){if(_0x16c5eb){return _0xa5e44f[_0x5ba4('0x16')](_0x4356d1)[_0x5ba4('0x18')](_0x16c5eb);}};}function respondWithFilteredResult(_0x4d72dd,_0x3780ce){return function(_0x4db481){if(_0x4db481){var _0x435cd2=typeof _0x3780ce[_0x5ba4('0x19')]===_0x5ba4('0x1a')&&typeof _0x3780ce[_0x5ba4('0x1b')]===_0x5ba4('0x1a');var _0x49a74a=_0x4db481[_0x5ba4('0x1c')];var _0x2f19e0=_0x435cd2?0x0:_0x3780ce[_0x5ba4('0x19')];var _0x71900b=_0x435cd2?_0x4db481[_0x5ba4('0x1c')]:_0x3780ce[_0x5ba4('0x19')]+_0x3780ce[_0x5ba4('0x1b')];var _0x17ca28;if(_0x71900b>=_0x49a74a){_0x71900b=_0x49a74a;_0x17ca28=0xc8;}else{_0x17ca28=0xce;}_0x4d72dd['status'](_0x17ca28);return _0x4d72dd[_0x5ba4('0x1d')](_0x5ba4('0x1e'),_0x2f19e0+'-'+_0x71900b+'/'+_0x49a74a)[_0x5ba4('0x18')](_0x4db481);}return null;};}function patchUpdates(_0x3e5e80){return function(_0x4d5d38){try{jsonpatch[_0x5ba4('0x1f')](_0x4d5d38,_0x3e5e80,!![]);}catch(_0x3d1f6d){return BPromise[_0x5ba4('0x20')](_0x3d1f6d);}return _0x4d5d38['save']();};}function saveUpdates(_0x20d057,_0x5b843b){return function(_0x20bc2a){if(_0x20bc2a){return _0x20bc2a[_0x5ba4('0x21')](_0x20d057)[_0x5ba4('0x22')](function(_0x41ee4b){return _0x41ee4b;});}return null;};}function removeEntity(_0xdfdd54,_0x312279){return function(_0x4d68d6){if(_0x4d68d6){return _0x4d68d6[_0x5ba4('0x23')]()[_0x5ba4('0x22')](function(){_0xdfdd54[_0x5ba4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb5db,_0x4b2c47){return function(_0x33e18e){if(!_0x33e18e){_0x3fb5db['sendStatus'](0x194);}return _0x33e18e;};}function handleError(_0x4fabff,_0x25ae73){_0x25ae73=_0x25ae73||0x1f4;return function(_0x5867b9){logger[_0x5ba4('0x24')](_0x5867b9['stack']);if(_0x5867b9[_0x5ba4('0x25')]){delete _0x5867b9[_0x5ba4('0x25')];}_0x4fabff['status'](_0x25ae73)[_0x5ba4('0x26')](_0x5867b9);};}exports[_0x5ba4('0x27')]=function(_0x3deb7a,_0x1249fe){var _0x4e76d7={},_0x29977c={},_0x2688e6={'count':0x0,'rows':[]};var _0x5198c9=_[_0x5ba4('0x28')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x2dcb95){return{'name':_0x2dcb95[_0x5ba4('0x29')],'type':_0x2dcb95['type']['key']};});_0x29977c[_0x5ba4('0x2a')]=_[_0x5ba4('0x28')](_0x5198c9,_0x5ba4('0x25'));_0x29977c[_0x5ba4('0x2b')]=_[_0x5ba4('0x2c')](_0x3deb7a['query']);_0x29977c['filters']=_['intersection'](_0x29977c['model'],_0x29977c[_0x5ba4('0x2b')]);_0x4e76d7[_0x5ba4('0x2d')]=_[_0x5ba4('0x2e')](_0x29977c[_0x5ba4('0x2a')],qs[_0x5ba4('0x2f')](_0x3deb7a['query'][_0x5ba4('0x2f')]));_0x4e76d7[_0x5ba4('0x2d')]=_0x4e76d7['attributes'][_0x5ba4('0x30')]?_0x4e76d7['attributes']:_0x29977c[_0x5ba4('0x2a')];if(!_0x3deb7a['query']['hasOwnProperty'](_0x5ba4('0x31'))){_0x4e76d7['limit']=qs[_0x5ba4('0x1b')](_0x3deb7a[_0x5ba4('0x2b')]['limit']);_0x4e76d7[_0x5ba4('0x19')]=qs[_0x5ba4('0x19')](_0x3deb7a['query'][_0x5ba4('0x19')]);}_0x4e76d7[_0x5ba4('0x32')]=qs['sort'](_0x3deb7a[_0x5ba4('0x2b')][_0x5ba4('0x33')]);_0x4e76d7['where']=qs[_0x5ba4('0x34')](_[_0x5ba4('0x35')](_0x3deb7a[_0x5ba4('0x2b')],_0x29977c[_0x5ba4('0x34')]),_0x5198c9);if(_0x3deb7a[_0x5ba4('0x2b')][_0x5ba4('0x36')]){_0x4e76d7['where']=_['merge'](_0x4e76d7[_0x5ba4('0x37')],{'$or':_[_0x5ba4('0x28')](_0x5198c9,function(_0x21ca93){if(_0x21ca93['type']!==_0x5ba4('0x38')){var _0x449035={};_0x449035[_0x21ca93[_0x5ba4('0x25')]]={'$like':'%'+_0x3deb7a['query'][_0x5ba4('0x36')]+'%'};return _0x449035;}})});}_0x4e76d7=_[_0x5ba4('0x39')]({},_0x4e76d7,_0x3deb7a['options']);var _0x400ff2={'where':_0x4e76d7['where']};return db['OpenchannelQueueReport'][_0x5ba4('0x1c')](_0x400ff2)[_0x5ba4('0x22')](function(_0x1e2d32){_0x2688e6[_0x5ba4('0x1c')]=_0x1e2d32;if(_0x3deb7a['query']['includeAll']){_0x4e76d7[_0x5ba4('0x3a')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5ba4('0x3b')](_0x4e76d7);})[_0x5ba4('0x22')](function(_0x480dba){_0x2688e6[_0x5ba4('0x3c')]=_0x480dba;return _0x2688e6;})[_0x5ba4('0x22')](respondWithFilteredResult(_0x1249fe,_0x4e76d7))[_0x5ba4('0x3d')](handleError(_0x1249fe,null));};exports[_0x5ba4('0x3e')]=function(_0xed3a47,_0xd379ae){var _0x87ab14={'raw':!![],'where':{'id':_0xed3a47[_0x5ba4('0x3f')]['id']}},_0x57b971={};_0x57b971[_0x5ba4('0x2a')]=_[_0x5ba4('0x2c')](db[_0x5ba4('0x40')][_0x5ba4('0x41')]);_0x57b971[_0x5ba4('0x2b')]=_[_0x5ba4('0x2c')](_0xed3a47[_0x5ba4('0x2b')]);_0x57b971[_0x5ba4('0x34')]=_[_0x5ba4('0x2e')](_0x57b971['model'],_0x57b971[_0x5ba4('0x2b')]);_0x87ab14['attributes']=_[_0x5ba4('0x2e')](_0x57b971[_0x5ba4('0x2a')],qs[_0x5ba4('0x2f')](_0xed3a47[_0x5ba4('0x2b')][_0x5ba4('0x2f')]));_0x87ab14['attributes']=_0x87ab14[_0x5ba4('0x2d')][_0x5ba4('0x30')]?_0x87ab14[_0x5ba4('0x2d')]:_0x57b971[_0x5ba4('0x2a')];if(_0xed3a47['query'][_0x5ba4('0x42')]){_0x87ab14[_0x5ba4('0x3a')]=[{'all':!![]}];}_0x87ab14=_[_0x5ba4('0x39')]({},_0x87ab14,_0xed3a47['options']);return db[_0x5ba4('0x40')]['find'](_0x87ab14)['then'](handleEntityNotFound(_0xd379ae,null))['then'](respondWithResult(_0xd379ae,null))[_0x5ba4('0x3d')](handleError(_0xd379ae,null));};exports['create']=function(_0x1075a2,_0x151876){return db['OpenchannelQueueReport'][_0x5ba4('0x43')](_0x1075a2[_0x5ba4('0x44')],{})['then'](respondWithResult(_0x151876,0xc9))[_0x5ba4('0x3d')](handleError(_0x151876,null));};exports[_0x5ba4('0x21')]=function(_0x38b984,_0x2f8103){if(_0x38b984[_0x5ba4('0x44')]['id']){delete _0x38b984[_0x5ba4('0x44')]['id'];}return db['OpenchannelQueueReport'][_0x5ba4('0x45')]({'where':{'id':_0x38b984[_0x5ba4('0x3f')]['id']}})[_0x5ba4('0x22')](handleEntityNotFound(_0x2f8103,null))[_0x5ba4('0x22')](saveUpdates(_0x38b984[_0x5ba4('0x44')],null))['then'](respondWithResult(_0x2f8103,null))[_0x5ba4('0x3d')](handleError(_0x2f8103,null));};exports[_0x5ba4('0x23')]=function(_0x345ee6,_0x4d3ef8){return db[_0x5ba4('0x40')][_0x5ba4('0x45')]({'where':{'id':_0x345ee6[_0x5ba4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d3ef8,null))['then'](removeEntity(_0x4d3ef8,null))['catch'](handleError(_0x4d3ef8,null));};exports[_0x5ba4('0x46')]=function(_0x12d127,_0xdc3e0){return db[_0x5ba4('0x40')][_0x5ba4('0x46')]()['then'](respondWithResult(_0xdc3e0,null))[_0x5ba4('0x3d')](handleError(_0xdc3e0,null));}; \ No newline at end of file +var _0xc25c=['Content-Range','reject','save','update','then','destroy','error','stack','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','findAll','catch','params','includeAll','include','merge','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xc25c,0x105));var _0xcc25=function(_0x37c44e,_0x5eb96f){_0x37c44e=_0x37c44e-0x0;var _0x10a9db=_0xc25c[_0x37c44e];return _0x10a9db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc25('0x0'));var zipdir=require(_0xcc25('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc25('0x2'));var moment=require(_0xcc25('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc25('0x4'));var util=require(_0xcc25('0x5'));var path=require(_0xcc25('0x6'));var sox=require(_0xcc25('0x7'));var csv=require(_0xcc25('0x8'));var ejs=require(_0xcc25('0x9'));var fs=require('fs');var fs_extra=require(_0xcc25('0xa'));var _=require(_0xcc25('0xb'));var squel=require(_0xcc25('0xc'));var crypto=require(_0xcc25('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcc25('0xe'));var toCsv=require(_0xcc25('0x8'));var querystring=require(_0xcc25('0xf'));var Papa=require(_0xcc25('0x10'));var Redis=require(_0xcc25('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc25('0x12'));var as=require(_0xcc25('0x13'));var hardwareService=require(_0xcc25('0x14'));var logger=require(_0xcc25('0x15'))(_0xcc25('0x16'));var utils=require('../../config/utils');var config=require(_0xcc25('0x17'));var licenseUtil=require(_0xcc25('0x18'));var db=require(_0xcc25('0x19'))['db'];function respondWithStatusCode(_0x455061,_0x19f8c0){_0x19f8c0=_0x19f8c0||0xcc;return function(_0x1f3136){if(_0x1f3136){return _0x455061[_0xcc25('0x1a')](_0x19f8c0);}return _0x455061['status'](_0x19f8c0)[_0xcc25('0x1b')]();};}function respondWithResult(_0x49ce31,_0x498247){_0x498247=_0x498247||0xc8;return function(_0x8e81a1){if(_0x8e81a1){return _0x49ce31[_0xcc25('0x1c')](_0x498247)[_0xcc25('0x1d')](_0x8e81a1);}};}function respondWithFilteredResult(_0x5875d9,_0xf4eef){return function(_0x3d1100){if(_0x3d1100){var _0x3d79f5=typeof _0xf4eef[_0xcc25('0x1e')]===_0xcc25('0x1f')&&typeof _0xf4eef[_0xcc25('0x20')]===_0xcc25('0x1f');var _0x132372=_0x3d1100[_0xcc25('0x21')];var _0x487826=_0x3d79f5?0x0:_0xf4eef[_0xcc25('0x1e')];var _0x5a1351=_0x3d79f5?_0x3d1100[_0xcc25('0x21')]:_0xf4eef[_0xcc25('0x1e')]+_0xf4eef['limit'];var _0x5b2978;if(_0x5a1351>=_0x132372){_0x5a1351=_0x132372;_0x5b2978=0xc8;}else{_0x5b2978=0xce;}_0x5875d9[_0xcc25('0x1c')](_0x5b2978);return _0x5875d9[_0xcc25('0x22')](_0xcc25('0x23'),_0x487826+'-'+_0x5a1351+'/'+_0x132372)[_0xcc25('0x1d')](_0x3d1100);}return null;};}function patchUpdates(_0x143181){return function(_0x3fd1df){try{jsonpatch['apply'](_0x3fd1df,_0x143181,!![]);}catch(_0x5bc50c){return BPromise[_0xcc25('0x24')](_0x5bc50c);}return _0x3fd1df[_0xcc25('0x25')]();};}function saveUpdates(_0x343cc9,_0x4457f4){return function(_0x1103b7){if(_0x1103b7){return _0x1103b7[_0xcc25('0x26')](_0x343cc9)[_0xcc25('0x27')](function(_0x453201){return _0x453201;});}return null;};}function removeEntity(_0xaa3ea6,_0x4a3795){return function(_0x42da9f){if(_0x42da9f){return _0x42da9f[_0xcc25('0x28')]()[_0xcc25('0x27')](function(){_0xaa3ea6['status'](0xcc)[_0xcc25('0x1b')]();});}};}function handleEntityNotFound(_0xaa329e,_0x11cfdc){return function(_0x5c18e6){if(!_0x5c18e6){_0xaa329e[_0xcc25('0x1a')](0x194);}return _0x5c18e6;};}function handleError(_0x8f6592,_0x4ff544){_0x4ff544=_0x4ff544||0x1f4;return function(_0x80b86e){logger[_0xcc25('0x29')](_0x80b86e[_0xcc25('0x2a')]);if(_0x80b86e['name']){delete _0x80b86e['name'];}_0x8f6592[_0xcc25('0x1c')](_0x4ff544)[_0xcc25('0x2b')](_0x80b86e);};}exports['index']=function(_0x4bd144,_0x6207f2){var _0x2dc79f={},_0x115e06={},_0x26a5ed={'count':0x0,'rows':[]};var _0x291891=_[_0xcc25('0x2c')](db[_0xcc25('0x2d')][_0xcc25('0x2e')],function(_0x49a7f4){return{'name':_0x49a7f4[_0xcc25('0x2f')],'type':_0x49a7f4[_0xcc25('0x30')][_0xcc25('0x31')]};});_0x115e06[_0xcc25('0x32')]=_['map'](_0x291891,_0xcc25('0x33'));_0x115e06[_0xcc25('0x34')]=_[_0xcc25('0x35')](_0x4bd144[_0xcc25('0x34')]);_0x115e06[_0xcc25('0x36')]=_[_0xcc25('0x37')](_0x115e06[_0xcc25('0x32')],_0x115e06[_0xcc25('0x34')]);_0x2dc79f[_0xcc25('0x38')]=_[_0xcc25('0x37')](_0x115e06['model'],qs[_0xcc25('0x39')](_0x4bd144[_0xcc25('0x34')]['fields']));_0x2dc79f[_0xcc25('0x38')]=_0x2dc79f[_0xcc25('0x38')][_0xcc25('0x3a')]?_0x2dc79f[_0xcc25('0x38')]:_0x115e06[_0xcc25('0x32')];if(!_0x4bd144[_0xcc25('0x34')][_0xcc25('0x3b')]('nolimit')){_0x2dc79f[_0xcc25('0x20')]=qs['limit'](_0x4bd144['query'][_0xcc25('0x20')]);_0x2dc79f['offset']=qs['offset'](_0x4bd144['query']['offset']);}_0x2dc79f[_0xcc25('0x3c')]=qs['sort'](_0x4bd144[_0xcc25('0x34')][_0xcc25('0x3d')]);_0x2dc79f['where']=qs[_0xcc25('0x36')](_['pick'](_0x4bd144[_0xcc25('0x34')],_0x115e06[_0xcc25('0x36')]),_0x291891);if(_0x4bd144[_0xcc25('0x34')]['filter']){_0x2dc79f[_0xcc25('0x3e')]=_['merge'](_0x2dc79f[_0xcc25('0x3e')],{'$or':_[_0xcc25('0x2c')](_0x291891,function(_0x1b19a5){if(_0x1b19a5['type']!=='VIRTUAL'){var _0xfd75b={};_0xfd75b[_0x1b19a5[_0xcc25('0x33')]]={'$like':'%'+_0x4bd144[_0xcc25('0x34')][_0xcc25('0x3f')]+'%'};return _0xfd75b;}})});}_0x2dc79f=_['merge']({},_0x2dc79f,_0x4bd144['options']);var _0x1319b5={'where':_0x2dc79f['where']};return db[_0xcc25('0x2d')][_0xcc25('0x21')](_0x1319b5)[_0xcc25('0x27')](function(_0x4e6d7d){_0x26a5ed[_0xcc25('0x21')]=_0x4e6d7d;if(_0x4bd144[_0xcc25('0x34')]['includeAll']){_0x2dc79f['include']=[{'all':!![]}];}return db[_0xcc25('0x2d')][_0xcc25('0x40')](_0x2dc79f);})[_0xcc25('0x27')](function(_0x38f3eb){_0x26a5ed['rows']=_0x38f3eb;return _0x26a5ed;})['then'](respondWithFilteredResult(_0x6207f2,_0x2dc79f))[_0xcc25('0x41')](handleError(_0x6207f2,null));};exports['show']=function(_0x358c80,_0x4ac2cd){var _0x4af40c={'raw':!![],'where':{'id':_0x358c80[_0xcc25('0x42')]['id']}},_0x58eea9={};_0x58eea9['model']=_[_0xcc25('0x35')](db[_0xcc25('0x2d')][_0xcc25('0x2e')]);_0x58eea9[_0xcc25('0x34')]=_[_0xcc25('0x35')](_0x358c80[_0xcc25('0x34')]);_0x58eea9[_0xcc25('0x36')]=_['intersection'](_0x58eea9[_0xcc25('0x32')],_0x58eea9[_0xcc25('0x34')]);_0x4af40c[_0xcc25('0x38')]=_['intersection'](_0x58eea9['model'],qs[_0xcc25('0x39')](_0x358c80['query'][_0xcc25('0x39')]));_0x4af40c['attributes']=_0x4af40c[_0xcc25('0x38')][_0xcc25('0x3a')]?_0x4af40c[_0xcc25('0x38')]:_0x58eea9[_0xcc25('0x32')];if(_0x358c80['query'][_0xcc25('0x43')]){_0x4af40c[_0xcc25('0x44')]=[{'all':!![]}];}_0x4af40c=_[_0xcc25('0x45')]({},_0x4af40c,_0x358c80['options']);return db[_0xcc25('0x2d')][_0xcc25('0x46')](_0x4af40c)[_0xcc25('0x27')](handleEntityNotFound(_0x4ac2cd,null))[_0xcc25('0x27')](respondWithResult(_0x4ac2cd,null))[_0xcc25('0x41')](handleError(_0x4ac2cd,null));};exports[_0xcc25('0x47')]=function(_0x33024f,_0x349f76){return db[_0xcc25('0x2d')][_0xcc25('0x47')](_0x33024f[_0xcc25('0x48')],{})['then'](respondWithResult(_0x349f76,0xc9))[_0xcc25('0x41')](handleError(_0x349f76,null));};exports[_0xcc25('0x26')]=function(_0x278be6,_0x2b3ac1){if(_0x278be6[_0xcc25('0x48')]['id']){delete _0x278be6['body']['id'];}return db[_0xcc25('0x2d')][_0xcc25('0x46')]({'where':{'id':_0x278be6[_0xcc25('0x42')]['id']}})[_0xcc25('0x27')](handleEntityNotFound(_0x2b3ac1,null))[_0xcc25('0x27')](saveUpdates(_0x278be6[_0xcc25('0x48')],null))['then'](respondWithResult(_0x2b3ac1,null))[_0xcc25('0x41')](handleError(_0x2b3ac1,null));};exports[_0xcc25('0x28')]=function(_0x9c5aaf,_0x4d57a1){return db[_0xcc25('0x2d')]['find']({'where':{'id':_0x9c5aaf[_0xcc25('0x42')]['id']}})[_0xcc25('0x27')](handleEntityNotFound(_0x4d57a1,null))[_0xcc25('0x27')](removeEntity(_0x4d57a1,null))[_0xcc25('0x41')](handleError(_0x4d57a1,null));};exports[_0xcc25('0x49')]=function(_0xc5eed1,_0x39835e){return db[_0xcc25('0x2d')][_0xcc25('0x49')]()[_0xcc25('0x27')](respondWithResult(_0x39835e,null))[_0xcc25('0x41')](handleError(_0x39835e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f793c7c..4d95633 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x11445a,_0x560a1b){var _0x2eb82f=function(_0x95d4ad){while(--_0x95d4ad){_0x11445a['push'](_0x11445a['shift']());}};_0x2eb82f(++_0x560a1b);}(_0x326f,0xd1));var _0xf326=function(_0x3db29d,_0x1859b1){_0x3db29d=_0x3db29d-0x0;var _0x580fe5=_0x326f[_0x3db29d];return _0x580fe5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2fbaf4,_0xfb01a1){var _0x30caf7=function(_0x60a725){while(--_0x60a725){_0x2fbaf4['push'](_0x2fbaf4['shift']());}};_0x30caf7(++_0xfb01a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1d145e,_0x440646){_0x1d145e=_0x1d145e-0x0;var _0xa6af41=_0x7a54[_0x1d145e];return _0xa6af41;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 71d09fb..39320f4 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 _0xf65d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','stringify','UpdateOpenchannelQueueReport','update','raw','attributes','limit','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf65d,0x9f));var _0xdf65=function(_0x40686f,_0x3f24bf){_0x40686f=_0x40686f-0x0;var _0x53b21c=_0xf65d[_0x40686f];return _0x53b21c;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var moment=require(_0xdf65('0x1'));var BPromise=require(_0xdf65('0x2'));var rs=require(_0xdf65('0x3'));var fs=require('fs');var Redis=require(_0xdf65('0x4'));var db=require(_0xdf65('0x5'))['db'];var utils=require(_0xdf65('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdf65('0x7'));var client=jayson['client'][_0xdf65('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33efa2,_0x4c4054,_0x40cc08){return new BPromise(function(_0x3f5cae,_0x97292b){return client[_0xdf65('0x9')](_0x33efa2,_0x40cc08)[_0xdf65('0xa')](function(_0x46a70d){logger['info'](_0xdf65('0xb'),_0x4c4054,'request\x20sent');logger[_0xdf65('0xc')](_0xdf65('0xd'),_0x4c4054,_0xdf65('0xe'),JSON['stringify'](_0x46a70d));if(_0x46a70d['error']){if(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x10')]===0x1f4){logger[_0xdf65('0xf')](_0xdf65('0xb'),_0x4c4054,_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);return _0x97292b(_0x46a70d['error'][_0xdf65('0x11')]);}logger[_0xdf65('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c4054,_0x46a70d['error']['message']);return _0x3f5cae(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);}else{logger[_0xdf65('0x12')](_0xdf65('0xb'),_0x4c4054,_0xdf65('0xe'));_0x3f5cae(_0x46a70d[_0xdf65('0x13')][_0xdf65('0x11')]);}})[_0xdf65('0x14')](function(_0x208b93){logger[_0xdf65('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4c4054,_0x208b93);_0x97292b(_0x208b93);});});}exports[_0xdf65('0x15')]=function(_0x532215){var _0x28fcd1=this;return new Promise(function(_0x3a175b,_0x2337da){return db[_0xdf65('0x16')][_0xdf65('0x17')](_0x532215[_0xdf65('0x18')],{'raw':_0x532215['options']?_0x532215[_0xdf65('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdf65('0xa')](function(_0x299ed3){logger[_0xdf65('0x12')](_0xdf65('0x15'),_0x532215);logger[_0xdf65('0xc')]('CreateOpenchannelQueueReport',_0x532215,JSON[_0xdf65('0x1a')](_0x299ed3));_0x3a175b(_0x299ed3);})[_0xdf65('0x14')](function(_0x5ee78d){logger[_0xdf65('0xf')](_0xdf65('0x15'),_0x5ee78d[_0xdf65('0x11')],_0x532215);_0x2337da(_0x28fcd1[_0xdf65('0xf')](0x1f4,_0x5ee78d['message']));});});};exports[_0xdf65('0x1b')]=function(_0x2eff40){var _0x5cfe90=this;return new Promise(function(_0x5ae6a3,_0x14a54c){return db[_0xdf65('0x16')][_0xdf65('0x1c')](_0x2eff40['body'],{'raw':_0x2eff40['options']?_0x2eff40[_0xdf65('0x19')][_0xdf65('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eff40['options']?_0x2eff40['options']['where']||null:null,'attributes':_0x2eff40[_0xdf65('0x19')]?_0x2eff40['options'][_0xdf65('0x1e')]||null:null,'limit':_0x2eff40['options']?_0x2eff40[_0xdf65('0x19')][_0xdf65('0x1f')]||null:null})[_0xdf65('0xa')](function(_0x2cca76){logger[_0xdf65('0x12')](_0xdf65('0x1b'),_0x2eff40);logger[_0xdf65('0xc')](_0xdf65('0x1b'),_0x2eff40,JSON[_0xdf65('0x1a')](_0x2cca76));_0x5ae6a3(_0x2cca76);})[_0xdf65('0x14')](function(_0x4507f1){logger['error']('UpdateOpenchannelQueueReport',_0x4507f1[_0xdf65('0x11')],_0x2eff40);_0x14a54c(_0x5cfe90[_0xdf65('0xf')](0x1f4,_0x4507f1[_0xdf65('0x11')]));});});}; \ No newline at end of file +var _0x9ccd=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','limit','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x5f1614,_0x1b6166){var _0x2a3106=function(_0x19a5e6){while(--_0x19a5e6){_0x5f1614['push'](_0x5f1614['shift']());}};_0x2a3106(++_0x1b6166);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});}exports[_0xd9cc('0x16')]=function(_0x2e2baa){var _0x5a4b50=this;return new Promise(function(_0x37b745,_0x32df89){return db['OpenchannelQueueReport'][_0xd9cc('0x17')](_0x2e2baa[_0xd9cc('0x18')],{'raw':_0x2e2baa[_0xd9cc('0x19')]?_0x2e2baa[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![]})[_0xd9cc('0xb')](function(_0x59f00d){logger['info'](_0xd9cc('0x16'),_0x2e2baa);logger[_0xd9cc('0xe')](_0xd9cc('0x16'),_0x2e2baa,JSON[_0xd9cc('0x11')](_0x59f00d));_0x37b745(_0x59f00d);})[_0xd9cc('0x15')](function(_0x426a5c){logger[_0xd9cc('0x12')](_0xd9cc('0x16'),_0x426a5c[_0xd9cc('0x14')],_0x2e2baa);_0x32df89(_0x5a4b50[_0xd9cc('0x12')](0x1f4,_0x426a5c[_0xd9cc('0x14')]));});});};exports[_0xd9cc('0x1b')]=function(_0x45b05a){var _0x35fb49=this;return new Promise(function(_0x503451,_0xc74622){return db[_0xd9cc('0x1c')]['update'](_0x45b05a[_0xd9cc('0x18')],{'raw':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1d')]||null:null,'attributes':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')]['attributes']||null:null,'limit':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1e')]||null:null})[_0xd9cc('0xb')](function(_0xfcd78c){logger[_0xd9cc('0xc')](_0xd9cc('0x1b'),_0x45b05a);logger[_0xd9cc('0xe')]('UpdateOpenchannelQueueReport',_0x45b05a,JSON[_0xd9cc('0x11')](_0xfcd78c));_0x503451(_0xfcd78c);})[_0xd9cc('0x15')](function(_0x42d185){logger[_0xd9cc('0x12')](_0xd9cc('0x1b'),_0x42d185[_0xd9cc('0x14')],_0x45b05a);_0xc74622(_0x35fb49['error'](0x1f4,_0x42d185[_0xd9cc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e780072..a975e21 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 _0x9b63=['./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9b63,0x1c8));var _0x39b6=function(_0x47d67e,_0x371211){_0x47d67e=_0x47d67e-0x0;var _0x36893c=_0x9b63[_0x47d67e];return _0x36893c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x39b6('0x0'));var timeout=require('connect-timeout');var express=require(_0x39b6('0x1'));var router=express[_0x39b6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x39b6('0x3'));var interaction=require(_0x39b6('0x4'));var config=require(_0x39b6('0x5'));var controller=require(_0x39b6('0x6'));router['get']('/',auth[_0x39b6('0x7')](),controller[_0x39b6('0x8')]);router[_0x39b6('0x9')](_0x39b6('0xa'),auth[_0x39b6('0x7')](),controller[_0x39b6('0xb')]);router['get']('/:id',auth[_0x39b6('0x7')](),controller[_0x39b6('0xc')]);router[_0x39b6('0xd')]('/',auth[_0x39b6('0x7')](),controller[_0x39b6('0xe')]);router[_0x39b6('0xf')](_0x39b6('0x10'),auth[_0x39b6('0x7')](),controller[_0x39b6('0x11')]);router[_0x39b6('0x12')](_0x39b6('0x10'),auth[_0x39b6('0x7')](),controller[_0x39b6('0x13')]);module[_0x39b6('0x14')]=router; \ No newline at end of file +var _0x9c9b=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2b6b89,_0x172ec0){var _0x5aa6af=function(_0x19cd5e){while(--_0x19cd5e){_0x2b6b89['push'](_0x2b6b89['shift']());}};_0x5aa6af(++_0x172ec0);}(_0x9c9b,0x89));var _0xb9c9=function(_0x2efd57,_0xce2e98){_0x2efd57=_0x2efd57-0x0;var _0x3a4871=_0x9c9b[_0x2efd57];return _0x3a4871;};'use strict';var multer=require(_0xb9c9('0x0'));var util=require('util');var path=require(_0xb9c9('0x1'));var timeout=require(_0xb9c9('0x2'));var express=require(_0xb9c9('0x3'));var router=express[_0xb9c9('0x4')]();var fs_extra=require(_0xb9c9('0x5'));var auth=require(_0xb9c9('0x6'));var interaction=require(_0xb9c9('0x7'));var config=require(_0xb9c9('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0xb9c9('0x9')]('/',auth[_0xb9c9('0xa')](),controller[_0xb9c9('0xb')]);router[_0xb9c9('0x9')](_0xb9c9('0xc'),auth[_0xb9c9('0xa')](),controller[_0xb9c9('0xd')]);router[_0xb9c9('0x9')](_0xb9c9('0xe'),auth[_0xb9c9('0xa')](),controller['show']);router[_0xb9c9('0xf')]('/',auth[_0xb9c9('0xa')](),controller[_0xb9c9('0x10')]);router[_0xb9c9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb9c9('0x12')]);router[_0xb9c9('0x13')](_0xb9c9('0xe'),auth['isAuthenticated'](),controller[_0xb9c9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index bebec86..aca308c 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x49a42e,_0x407001){_0x49a42e=_0x49a42e-0x0;var _0x5ce355=_0x9bde[_0x49a42e];return _0x5ce355;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x31fc80,_0x2dd4df){_0x31fc80=_0x31fc80-0x0;var _0x3e8496=_0x9bde[_0x31fc80];return _0x3e8496;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a8920e6..88a6972 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 _0x6fdd=['merge','type','options','includeAll','include','rows','show','params','keys','rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x3fb971,_0x1f5464){var _0x3f9d68=function(_0x60d52d){while(--_0x60d52d){_0x3fb971['push'](_0x3fb971['shift']());}};_0x3f9d68(++_0x1f5464);}(_0x6fdd,0x13c));var _0xd6fd=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x6fdd[_0x1a3e23];return _0x5ee0d8;};'use strict';var emlformat=require(_0xd6fd('0x0'));var rimraf=require(_0xd6fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6fd('0x2'));var rp=require(_0xd6fd('0x3'));var moment=require(_0xd6fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6fd('0x5'));var util=require(_0xd6fd('0x6'));var path=require(_0xd6fd('0x7'));var sox=require(_0xd6fd('0x8'));var csv=require(_0xd6fd('0x9'));var ejs=require(_0xd6fd('0xa'));var fs=require('fs');var fs_extra=require(_0xd6fd('0xb'));var _=require(_0xd6fd('0xc'));var squel=require('squel');var crypto=require(_0xd6fd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd6fd('0x9'));var querystring=require(_0xd6fd('0xe'));var Papa=require(_0xd6fd('0xf'));var Redis=require('ioredis');var authService=require(_0xd6fd('0x10'));var qs=require(_0xd6fd('0x11'));var as=require(_0xd6fd('0x12'));var hardwareService=require(_0xd6fd('0x13'));var logger=require(_0xd6fd('0x14'))(_0xd6fd('0x15'));var utils=require('../../config/utils');var config=require(_0xd6fd('0x16'));var licenseUtil=require(_0xd6fd('0x17'));var db=require(_0xd6fd('0x18'))['db'];function respondWithStatusCode(_0x15ddfc,_0x14acc6){_0x14acc6=_0x14acc6||0xcc;return function(_0x291eff){if(_0x291eff){return _0x15ddfc[_0xd6fd('0x19')](_0x14acc6);}return _0x15ddfc['status'](_0x14acc6)[_0xd6fd('0x1a')]();};}function respondWithResult(_0x5809d4,_0x5a4c7c){_0x5a4c7c=_0x5a4c7c||0xc8;return function(_0x35eefc){if(_0x35eefc){return _0x5809d4['status'](_0x5a4c7c)[_0xd6fd('0x1b')](_0x35eefc);}};}function respondWithFilteredResult(_0x3062c5,_0x593428){return function(_0x47d45c){if(_0x47d45c){var _0x110019=typeof _0x593428[_0xd6fd('0x1c')]===_0xd6fd('0x1d')&&typeof _0x593428[_0xd6fd('0x1e')]==='undefined';var _0x5cda3c=_0x47d45c[_0xd6fd('0x1f')];var _0x871de8=_0x110019?0x0:_0x593428[_0xd6fd('0x1c')];var _0x5126e1=_0x110019?_0x47d45c['count']:_0x593428[_0xd6fd('0x1c')]+_0x593428[_0xd6fd('0x1e')];var _0x4e24e0;if(_0x5126e1>=_0x5cda3c){_0x5126e1=_0x5cda3c;_0x4e24e0=0xc8;}else{_0x4e24e0=0xce;}_0x3062c5[_0xd6fd('0x20')](_0x4e24e0);return _0x3062c5['set'](_0xd6fd('0x21'),_0x871de8+'-'+_0x5126e1+'/'+_0x5cda3c)[_0xd6fd('0x1b')](_0x47d45c);}return null;};}function patchUpdates(_0x4e8b2f){return function(_0x26d0bb){try{jsonpatch[_0xd6fd('0x22')](_0x26d0bb,_0x4e8b2f,!![]);}catch(_0x29da7b){return BPromise[_0xd6fd('0x23')](_0x29da7b);}return _0x26d0bb['save']();};}function saveUpdates(_0x34cdf9,_0x2329a1){return function(_0x4a5daa){if(_0x4a5daa){return _0x4a5daa['update'](_0x34cdf9)[_0xd6fd('0x24')](function(_0x45809b){return _0x45809b;});}return null;};}function removeEntity(_0x2ce88e,_0x9694a6){return function(_0x4fdbed){if(_0x4fdbed){return _0x4fdbed[_0xd6fd('0x25')]()['then'](function(){_0x2ce88e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8f33,_0x5471b9){return function(_0x31cffe){if(!_0x31cffe){_0x3f8f33[_0xd6fd('0x19')](0x194);}return _0x31cffe;};}function handleError(_0x44bc9f,_0x57420f){_0x57420f=_0x57420f||0x1f4;return function(_0x197db9){logger['error'](_0x197db9[_0xd6fd('0x26')]);if(_0x197db9[_0xd6fd('0x27')]){delete _0x197db9[_0xd6fd('0x27')];}_0x44bc9f[_0xd6fd('0x20')](_0x57420f)[_0xd6fd('0x28')](_0x197db9);};}exports[_0xd6fd('0x29')]=function(_0x141d55,_0x7e8ced){var _0x576ff3={},_0x32adce={},_0x101772={'count':0x0,'rows':[]};var _0x1036a8=_[_0xd6fd('0x2a')](db[_0xd6fd('0x2b')]['rawAttributes'],function(_0x58d246){return{'name':_0x58d246[_0xd6fd('0x2c')],'type':_0x58d246['type']['key']};});_0x32adce['model']=_[_0xd6fd('0x2a')](_0x1036a8,_0xd6fd('0x27'));_0x32adce[_0xd6fd('0x2d')]=_['keys'](_0x141d55[_0xd6fd('0x2d')]);_0x32adce[_0xd6fd('0x2e')]=_[_0xd6fd('0x2f')](_0x32adce[_0xd6fd('0x30')],_0x32adce['query']);_0x576ff3[_0xd6fd('0x31')]=_[_0xd6fd('0x2f')](_0x32adce[_0xd6fd('0x30')],qs[_0xd6fd('0x32')](_0x141d55['query'][_0xd6fd('0x32')]));_0x576ff3[_0xd6fd('0x31')]=_0x576ff3[_0xd6fd('0x31')][_0xd6fd('0x33')]?_0x576ff3[_0xd6fd('0x31')]:_0x32adce[_0xd6fd('0x30')];if(!_0x141d55['query'][_0xd6fd('0x34')](_0xd6fd('0x35'))){_0x576ff3[_0xd6fd('0x1e')]=qs[_0xd6fd('0x1e')](_0x141d55[_0xd6fd('0x2d')][_0xd6fd('0x1e')]);_0x576ff3[_0xd6fd('0x1c')]=qs[_0xd6fd('0x1c')](_0x141d55['query']['offset']);}_0x576ff3[_0xd6fd('0x36')]=qs[_0xd6fd('0x37')](_0x141d55[_0xd6fd('0x2d')][_0xd6fd('0x37')]);_0x576ff3['where']=qs[_0xd6fd('0x2e')](_[_0xd6fd('0x38')](_0x141d55[_0xd6fd('0x2d')],_0x32adce[_0xd6fd('0x2e')]),_0x1036a8);if(_0x141d55[_0xd6fd('0x2d')][_0xd6fd('0x39')]){_0x576ff3[_0xd6fd('0x3a')]=_[_0xd6fd('0x3b')](_0x576ff3[_0xd6fd('0x3a')],{'$or':_[_0xd6fd('0x2a')](_0x1036a8,function(_0x56d876){if(_0x56d876[_0xd6fd('0x3c')]!=='VIRTUAL'){var _0x161358={};_0x161358[_0x56d876[_0xd6fd('0x27')]]={'$like':'%'+_0x141d55[_0xd6fd('0x2d')]['filter']+'%'};return _0x161358;}})});}_0x576ff3=_[_0xd6fd('0x3b')]({},_0x576ff3,_0x141d55[_0xd6fd('0x3d')]);var _0xfd15af={'where':_0x576ff3['where']};return db['OpenchannelTransferReport'][_0xd6fd('0x1f')](_0xfd15af)[_0xd6fd('0x24')](function(_0x24f436){_0x101772['count']=_0x24f436;if(_0x141d55[_0xd6fd('0x2d')][_0xd6fd('0x3e')]){_0x576ff3[_0xd6fd('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x576ff3);})['then'](function(_0x1b4f66){_0x101772[_0xd6fd('0x40')]=_0x1b4f66;return _0x101772;})['then'](respondWithFilteredResult(_0x7e8ced,_0x576ff3))['catch'](handleError(_0x7e8ced,null));};exports[_0xd6fd('0x41')]=function(_0x3c6787,_0x172ebc){var _0x80e869={'raw':!![],'where':{'id':_0x3c6787[_0xd6fd('0x42')]['id']}},_0x1e81f1={};_0x1e81f1[_0xd6fd('0x30')]=_[_0xd6fd('0x43')](db[_0xd6fd('0x2b')][_0xd6fd('0x44')]);_0x1e81f1['query']=_['keys'](_0x3c6787[_0xd6fd('0x2d')]);_0x1e81f1[_0xd6fd('0x2e')]=_['intersection'](_0x1e81f1[_0xd6fd('0x30')],_0x1e81f1['query']);_0x80e869[_0xd6fd('0x31')]=_[_0xd6fd('0x2f')](_0x1e81f1[_0xd6fd('0x30')],qs[_0xd6fd('0x32')](_0x3c6787[_0xd6fd('0x2d')][_0xd6fd('0x32')]));_0x80e869[_0xd6fd('0x31')]=_0x80e869[_0xd6fd('0x31')][_0xd6fd('0x33')]?_0x80e869['attributes']:_0x1e81f1[_0xd6fd('0x30')];if(_0x3c6787[_0xd6fd('0x2d')][_0xd6fd('0x3e')]){_0x80e869['include']=[{'all':!![]}];}_0x80e869=_[_0xd6fd('0x3b')]({},_0x80e869,_0x3c6787['options']);return db['OpenchannelTransferReport'][_0xd6fd('0x45')](_0x80e869)['then'](handleEntityNotFound(_0x172ebc,null))[_0xd6fd('0x24')](respondWithResult(_0x172ebc,null))[_0xd6fd('0x46')](handleError(_0x172ebc,null));};exports[_0xd6fd('0x47')]=function(_0x2c1f75,_0x831ba9){return db[_0xd6fd('0x2b')]['create'](_0x2c1f75[_0xd6fd('0x48')],{})[_0xd6fd('0x24')](respondWithResult(_0x831ba9,0xc9))[_0xd6fd('0x46')](handleError(_0x831ba9,null));};exports[_0xd6fd('0x49')]=function(_0x5cae8c,_0x5a6ff3){if(_0x5cae8c['body']['id']){delete _0x5cae8c[_0xd6fd('0x48')]['id'];}return db[_0xd6fd('0x2b')][_0xd6fd('0x45')]({'where':{'id':_0x5cae8c['params']['id']}})[_0xd6fd('0x24')](handleEntityNotFound(_0x5a6ff3,null))[_0xd6fd('0x24')](saveUpdates(_0x5cae8c[_0xd6fd('0x48')],null))['then'](respondWithResult(_0x5a6ff3,null))[_0xd6fd('0x46')](handleError(_0x5a6ff3,null));};exports['destroy']=function(_0x5ae633,_0x5d1011){return db[_0xd6fd('0x2b')][_0xd6fd('0x45')]({'where':{'id':_0x5ae633['params']['id']}})[_0xd6fd('0x24')](handleEntityNotFound(_0x5d1011,null))[_0xd6fd('0x24')](removeEntity(_0x5d1011,null))[_0xd6fd('0x46')](handleError(_0x5d1011,null));};exports[_0xd6fd('0x4a')]=function(_0x2e3e84,_0x42a138){return db[_0xd6fd('0x2b')][_0xd6fd('0x4a')]()[_0xd6fd('0x24')](respondWithResult(_0x42a138,null))[_0xd6fd('0x46')](handleError(_0x42a138,null));}; \ No newline at end of file +var _0xa566=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','update','then','destroy','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0xd46615,_0x568626){var _0xad0d2d=function(_0x29430e){while(--_0x29430e){_0xd46615['push'](_0xd46615['shift']());}};_0xad0d2d(++_0x568626);}(_0xa566,0x1c1));var _0x6a56=function(_0x1807c3,_0x2debea){_0x1807c3=_0x1807c3-0x0;var _0x9cec6b=_0xa566[_0x1807c3];return _0x9cec6b;};'use strict';var emlformat=require(_0x6a56('0x0'));var rimraf=require(_0x6a56('0x1'));var zipdir=require(_0x6a56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a56('0x3'));var moment=require(_0x6a56('0x4'));var BPromise=require(_0x6a56('0x5'));var Mustache=require(_0x6a56('0x6'));var util=require('util');var path=require(_0x6a56('0x7'));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(_0x6a56('0x8'));var squel=require('squel');var crypto=require(_0x6a56('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a56('0xa'));var toCsv=require(_0x6a56('0xb'));var querystring=require('querystring');var Papa=require(_0x6a56('0xc'));var Redis=require(_0x6a56('0xd'));var authService=require(_0x6a56('0xe'));var qs=require(_0x6a56('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a56('0x10'));var logger=require(_0x6a56('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6a56('0x12'));var licenseUtil=require(_0x6a56('0x13'));var db=require(_0x6a56('0x14'))['db'];function respondWithStatusCode(_0x26f443,_0x3e9389){_0x3e9389=_0x3e9389||0xcc;return function(_0x10f894){if(_0x10f894){return _0x26f443[_0x6a56('0x15')](_0x3e9389);}return _0x26f443['status'](_0x3e9389)[_0x6a56('0x16')]();};}function respondWithResult(_0x14237e,_0x46fbaa){_0x46fbaa=_0x46fbaa||0xc8;return function(_0x10fd64){if(_0x10fd64){return _0x14237e[_0x6a56('0x17')](_0x46fbaa)['json'](_0x10fd64);}};}function respondWithFilteredResult(_0x232176,_0xc0e603){return function(_0x28bb4e){if(_0x28bb4e){var _0xc5f78d=typeof _0xc0e603[_0x6a56('0x18')]==='undefined'&&typeof _0xc0e603['limit']===_0x6a56('0x19');var _0x2288b1=_0x28bb4e['count'];var _0x162c52=_0xc5f78d?0x0:_0xc0e603[_0x6a56('0x18')];var _0x4c2f9c=_0xc5f78d?_0x28bb4e[_0x6a56('0x1a')]:_0xc0e603[_0x6a56('0x18')]+_0xc0e603['limit'];var _0x26b33e;if(_0x4c2f9c>=_0x2288b1){_0x4c2f9c=_0x2288b1;_0x26b33e=0xc8;}else{_0x26b33e=0xce;}_0x232176['status'](_0x26b33e);return _0x232176[_0x6a56('0x1b')]('Content-Range',_0x162c52+'-'+_0x4c2f9c+'/'+_0x2288b1)[_0x6a56('0x1c')](_0x28bb4e);}return null;};}function patchUpdates(_0x2239ff){return function(_0x11e479){try{jsonpatch[_0x6a56('0x1d')](_0x11e479,_0x2239ff,!![]);}catch(_0x32118b){return BPromise[_0x6a56('0x1e')](_0x32118b);}return _0x11e479['save']();};}function saveUpdates(_0x2e217a,_0x148548){return function(_0x4845aa){if(_0x4845aa){return _0x4845aa[_0x6a56('0x1f')](_0x2e217a)[_0x6a56('0x20')](function(_0x3cf1b3){return _0x3cf1b3;});}return null;};}function removeEntity(_0x5a0986,_0x2a6ece){return function(_0x3e0aab){if(_0x3e0aab){return _0x3e0aab[_0x6a56('0x21')]()[_0x6a56('0x20')](function(){_0x5a0986[_0x6a56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d23a,_0x5ce125){return function(_0x302316){if(!_0x302316){_0x51d23a[_0x6a56('0x15')](0x194);}return _0x302316;};}function handleError(_0x2bd80f,_0x55e714){_0x55e714=_0x55e714||0x1f4;return function(_0x1df843){logger[_0x6a56('0x22')](_0x1df843['stack']);if(_0x1df843[_0x6a56('0x23')]){delete _0x1df843[_0x6a56('0x23')];}_0x2bd80f[_0x6a56('0x17')](_0x55e714)['send'](_0x1df843);};}exports[_0x6a56('0x24')]=function(_0x27bcd0,_0x151537){var _0xe26d09={},_0x10b1cb={},_0x51534d={'count':0x0,'rows':[]};var _0x3f0fe7=_[_0x6a56('0x25')](db[_0x6a56('0x26')][_0x6a56('0x27')],function(_0x576778){return{'name':_0x576778[_0x6a56('0x28')],'type':_0x576778[_0x6a56('0x29')][_0x6a56('0x2a')]};});_0x10b1cb['model']=_[_0x6a56('0x25')](_0x3f0fe7,'name');_0x10b1cb[_0x6a56('0x2b')]=_[_0x6a56('0x2c')](_0x27bcd0[_0x6a56('0x2b')]);_0x10b1cb[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],_0x10b1cb[_0x6a56('0x2b')]);_0xe26d09[_0x6a56('0x30')]=_[_0x6a56('0x2e')](_0x10b1cb[_0x6a56('0x2f')],qs[_0x6a56('0x31')](_0x27bcd0['query'][_0x6a56('0x31')]));_0xe26d09[_0x6a56('0x30')]=_0xe26d09[_0x6a56('0x30')][_0x6a56('0x32')]?_0xe26d09['attributes']:_0x10b1cb[_0x6a56('0x2f')];if(!_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x33')](_0x6a56('0x34'))){_0xe26d09['limit']=qs[_0x6a56('0x35')](_0x27bcd0[_0x6a56('0x2b')]['limit']);_0xe26d09[_0x6a56('0x18')]=qs['offset'](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x18')]);}_0xe26d09[_0x6a56('0x36')]=qs[_0x6a56('0x37')](_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x37')]);_0xe26d09[_0x6a56('0x38')]=qs['filters'](_[_0x6a56('0x39')](_0x27bcd0[_0x6a56('0x2b')],_0x10b1cb[_0x6a56('0x2d')]),_0x3f0fe7);if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]){_0xe26d09[_0x6a56('0x38')]=_[_0x6a56('0x3b')](_0xe26d09[_0x6a56('0x38')],{'$or':_[_0x6a56('0x25')](_0x3f0fe7,function(_0x4b1f65){if(_0x4b1f65[_0x6a56('0x29')]!==_0x6a56('0x3c')){var _0x10aca9={};_0x10aca9[_0x4b1f65[_0x6a56('0x23')]]={'$like':'%'+_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3a')]+'%'};return _0x10aca9;}})});}_0xe26d09=_[_0x6a56('0x3b')]({},_0xe26d09,_0x27bcd0[_0x6a56('0x3d')]);var _0x4a75c2={'where':_0xe26d09[_0x6a56('0x38')]};return db[_0x6a56('0x26')][_0x6a56('0x1a')](_0x4a75c2)[_0x6a56('0x20')](function(_0x2af96d){_0x51534d['count']=_0x2af96d;if(_0x27bcd0[_0x6a56('0x2b')][_0x6a56('0x3e')]){_0xe26d09[_0x6a56('0x3f')]=[{'all':!![]}];}return db[_0x6a56('0x26')][_0x6a56('0x40')](_0xe26d09);})['then'](function(_0x2e13b1){_0x51534d['rows']=_0x2e13b1;return _0x51534d;})[_0x6a56('0x20')](respondWithFilteredResult(_0x151537,_0xe26d09))[_0x6a56('0x41')](handleError(_0x151537,null));};exports[_0x6a56('0x42')]=function(_0x4e69fd,_0x10ced2){var _0x4ae655={'raw':!![],'where':{'id':_0x4e69fd[_0x6a56('0x43')]['id']}},_0x5a6999={};_0x5a6999[_0x6a56('0x2f')]=_[_0x6a56('0x2c')](db[_0x6a56('0x26')]['rawAttributes']);_0x5a6999['query']=_[_0x6a56('0x2c')](_0x4e69fd[_0x6a56('0x2b')]);_0x5a6999[_0x6a56('0x2d')]=_[_0x6a56('0x2e')](_0x5a6999[_0x6a56('0x2f')],_0x5a6999[_0x6a56('0x2b')]);_0x4ae655['attributes']=_[_0x6a56('0x2e')](_0x5a6999['model'],qs[_0x6a56('0x31')](_0x4e69fd[_0x6a56('0x2b')][_0x6a56('0x31')]));_0x4ae655[_0x6a56('0x30')]=_0x4ae655[_0x6a56('0x30')][_0x6a56('0x32')]?_0x4ae655[_0x6a56('0x30')]:_0x5a6999[_0x6a56('0x2f')];if(_0x4e69fd[_0x6a56('0x2b')]['includeAll']){_0x4ae655[_0x6a56('0x3f')]=[{'all':!![]}];}_0x4ae655=_['merge']({},_0x4ae655,_0x4e69fd['options']);return db['OpenchannelTransferReport'][_0x6a56('0x44')](_0x4ae655)[_0x6a56('0x20')](handleEntityNotFound(_0x10ced2,null))[_0x6a56('0x20')](respondWithResult(_0x10ced2,null))[_0x6a56('0x41')](handleError(_0x10ced2,null));};exports[_0x6a56('0x45')]=function(_0x5cef6c,_0x794424){return db[_0x6a56('0x26')][_0x6a56('0x45')](_0x5cef6c[_0x6a56('0x46')],{})['then'](respondWithResult(_0x794424,0xc9))[_0x6a56('0x41')](handleError(_0x794424,null));};exports[_0x6a56('0x1f')]=function(_0x659936,_0x371b8e){if(_0x659936['body']['id']){delete _0x659936[_0x6a56('0x46')]['id'];}return db[_0x6a56('0x26')][_0x6a56('0x44')]({'where':{'id':_0x659936['params']['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x371b8e,null))[_0x6a56('0x20')](saveUpdates(_0x659936[_0x6a56('0x46')],null))[_0x6a56('0x20')](respondWithResult(_0x371b8e,null))['catch'](handleError(_0x371b8e,null));};exports[_0x6a56('0x21')]=function(_0x56406b,_0x2487cb){return db[_0x6a56('0x26')]['find']({'where':{'id':_0x56406b[_0x6a56('0x43')]['id']}})[_0x6a56('0x20')](handleEntityNotFound(_0x2487cb,null))[_0x6a56('0x20')](removeEntity(_0x2487cb,null))[_0x6a56('0x41')](handleError(_0x2487cb,null));};exports[_0x6a56('0x47')]=function(_0x14be34,_0x175383){return db[_0x6a56('0x26')][_0x6a56('0x47')]()['then'](respondWithResult(_0x175383,null))['catch'](handleError(_0x175383,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d257e37..56ccb31 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 _0xb6d3=['request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21e86b,_0x4d6b36){var _0x3de6fd=function(_0xcd4350){while(--_0xcd4350){_0x21e86b['push'](_0x21e86b['shift']());}};_0x3de6fd(++_0x4d6b36);}(_0xb6d3,0x1f2));var _0x3b6d=function(_0x4d37cd,_0x319860){_0x4d37cd=_0x4d37cd-0x0;var _0x40f388=_0xb6d3[_0x4d37cd];return _0x40f388;};'use strict';var _=require(_0x3b6d('0x0'));var util=require(_0x3b6d('0x1'));var logger=require(_0x3b6d('0x2'))(_0x3b6d('0x3'));var moment=require(_0x3b6d('0x4'));var BPromise=require(_0x3b6d('0x5'));var rp=require(_0x3b6d('0x6'));var fs=require('fs');var path=require(_0x3b6d('0x7'));var rimraf=require('rimraf');var config=require(_0x3b6d('0x8'));var attributes=require(_0x3b6d('0x9'));module[_0x3b6d('0xa')]=function(_0x4d7a79,_0xf8d006){return _0x4d7a79[_0x3b6d('0xb')](_0x3b6d('0xc'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x3b6d('0xd'),'fields':[_0x3b6d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3212=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger'];(function(_0x1e8ccf,_0x2214bd){var _0x2f9c09=function(_0x24936b){while(--_0x24936b){_0x1e8ccf['push'](_0x1e8ccf['shift']());}};_0x2f9c09(++_0x2214bd);}(_0x3212,0x150));var _0x2321=function(_0x4b2764,_0x14e36a){_0x4b2764=_0x4b2764-0x0;var _0x30bc3d=_0x3212[_0x4b2764];return _0x30bc3d;};'use strict';var _=require('lodash');var util=require(_0x2321('0x0'));var logger=require(_0x2321('0x1'))(_0x2321('0x2'));var moment=require(_0x2321('0x3'));var BPromise=require(_0x2321('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2321('0x5'));var rimraf=require(_0x2321('0x6'));var config=require(_0x2321('0x7'));var attributes=require(_0x2321('0x8'));module[_0x2321('0x9')]=function(_0x494e24,_0x42af17){return _0x494e24[_0x2321('0xa')](_0x2321('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x2321('0xc'),'fields':[_0x2321('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0983e2e..983c677 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 _0x6379=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4806fc,_0x4ef99b){var _0x3dc742=function(_0x538654){while(--_0x538654){_0x4806fc['push'](_0x4806fc['shift']());}};_0x3dc742(++_0x4ef99b);}(_0x6379,0x84));var _0x9637=function(_0x1236f7,_0x50c076){_0x1236f7=_0x1236f7-0x0;var _0x10bc30=_0x6379[_0x1236f7];return _0x10bc30;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var moment=require(_0x9637('0x2'));var BPromise=require(_0x9637('0x3'));var rs=require(_0x9637('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9637('0x5'))['db'];var utils=require(_0x9637('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9637('0x7'));var jayson=require(_0x9637('0x8'));var client=jayson[_0x9637('0x9')][_0x9637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf0db9f,_0x5ce1a4,_0x515a84){return new BPromise(function(_0x21d91b,_0x42eda1){return client[_0x9637('0xb')](_0xf0db9f,_0x515a84)[_0x9637('0xc')](function(_0x5e66ee){logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));logger[_0x9637('0x10')](_0x9637('0x11'),_0x5ce1a4,_0x9637('0xf'),JSON[_0x9637('0x12')](_0x5e66ee));if(_0x5e66ee[_0x9637('0x13')]){if(_0x5e66ee[_0x9637('0x13')]['code']===0x1f4){logger[_0x9637('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5ce1a4,_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);return _0x42eda1(_0x5e66ee['error'][_0x9637('0x14')]);}logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x5e66ee[_0x9637('0x13')]['message']);return _0x21d91b(_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));_0x21d91b(_0x5e66ee['result'][_0x9637('0x14')]);}})[_0x9637('0x15')](function(_0x1eb774){logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x1eb774);_0x42eda1(_0x1eb774);});});} \ No newline at end of file +var _0xfd7b=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xfd7b[_0x35b18a];return _0x4db1bd;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 88dd801..acdbb41 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 _0x5fe0=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','put','delete'];(function(_0xc0ba02,_0x36fb10){var _0x36f913=function(_0x159eab){while(--_0x159eab){_0xc0ba02['push'](_0xc0ba02['shift']());}};_0x36f913(++_0x36fb10);}(_0x5fe0,0x110));var _0x05fe=function(_0x47bac4,_0x394fdc){_0x47bac4=_0x47bac4-0x0;var _0x26bab9=_0x5fe0[_0x47bac4];return _0x26bab9;};'use strict';var multer=require(_0x05fe('0x0'));var util=require('util');var path=require(_0x05fe('0x1'));var timeout=require(_0x05fe('0x2'));var express=require(_0x05fe('0x3'));var router=express[_0x05fe('0x4')]();var fs_extra=require(_0x05fe('0x5'));var auth=require(_0x05fe('0x6'));var interaction=require(_0x05fe('0x7'));var config=require(_0x05fe('0x8'));var controller=require(_0x05fe('0x9'));router[_0x05fe('0xa')]('/',auth['isAuthenticated'](),controller[_0x05fe('0xb')]);router[_0x05fe('0xa')](_0x05fe('0xc'),auth[_0x05fe('0xd')](),controller[_0x05fe('0xe')]);router['post']('/',auth[_0x05fe('0xd')](),controller['create']);router[_0x05fe('0xf')](_0x05fe('0xc'),auth[_0x05fe('0xd')](),controller['update']);router[_0x05fe('0x10')](_0x05fe('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8c7=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','./pause.controller'];(function(_0x1d397d,_0x35df36){var _0x4dcae8=function(_0x116960){while(--_0x116960){_0x1d397d['push'](_0x1d397d['shift']());}};_0x4dcae8(++_0x35df36);}(_0xa8c7,0x1a3));var _0x7a8c=function(_0x2f6a82,_0x52def9){_0x2f6a82=_0x2f6a82-0x0;var _0x222196=_0xa8c7[_0x2f6a82];return _0x222196;};'use strict';var multer=require('multer');var util=require(_0x7a8c('0x0'));var path=require('path');var timeout=require(_0x7a8c('0x1'));var express=require(_0x7a8c('0x2'));var router=express['Router']();var fs_extra=require(_0x7a8c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7a8c('0x4'));var config=require('../../config/environment');var controller=require(_0x7a8c('0x5'));router[_0x7a8c('0x6')]('/',auth[_0x7a8c('0x7')](),controller[_0x7a8c('0x8')]);router[_0x7a8c('0x6')](_0x7a8c('0x9'),auth[_0x7a8c('0x7')](),controller[_0x7a8c('0xa')]);router['post']('/',auth[_0x7a8c('0x7')](),controller[_0x7a8c('0xb')]);router[_0x7a8c('0xc')](_0x7a8c('0x9'),auth[_0x7a8c('0x7')](),controller[_0x7a8c('0xd')]);router[_0x7a8c('0xe')](_0x7a8c('0x9'),auth['isAuthenticated'](),controller[_0x7a8c('0xf')]);module[_0x7a8c('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 84b0569..6755edb 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 _0xac38=['exports','STRING','name','sequelize'];(function(_0xe7d561,_0x146cef){var _0x4c27f0=function(_0x287ac7){while(--_0x287ac7){_0xe7d561['push'](_0xe7d561['shift']());}};_0x4c27f0(++_0x146cef);}(_0xac38,0x147));var _0x8ac3=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xac38[_0x1e4150];return _0x1ce3ee;};'use strict';var Sequelize=require(_0x8ac3('0x0'));module[_0x8ac3('0x1')]={'name':{'type':Sequelize[_0x8ac3('0x2')],'unique':_0x8ac3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8ac3('0x2')]}}; \ No newline at end of file +var _0x1dc8=['name','sequelize','exports','STRING'];(function(_0x53f184,_0x2576d2){var _0x48ffa2=function(_0x230b84){while(--_0x230b84){_0x53f184['push'](_0x53f184['shift']());}};_0x48ffa2(++_0x2576d2);}(_0x1dc8,0x85));var _0x81dc=function(_0x253793,_0x2da65e){_0x253793=_0x253793-0x0;var _0x3d6b42=_0x1dc8[_0x253793];return _0x3d6b42;};'use strict';var Sequelize=require(_0x81dc('0x0'));module[_0x81dc('0x1')]={'name':{'type':Sequelize[_0x81dc('0x2')],'unique':_0x81dc('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x81dc('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a4b178e..84d4e07 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 _0x531f=['ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Pauses','destroy','end','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv'];(function(_0x370406,_0x14ebad){var _0x60f488=function(_0x59d84a){while(--_0x59d84a){_0x370406['push'](_0x370406['shift']());}};_0x60f488(++_0x14ebad);}(_0x531f,0xf2));var _0xf531=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x531f[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf531('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf531('0x1'));var rp=require(_0xf531('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf531('0x3'));var util=require(_0xf531('0x4'));var path=require('path');var sox=require(_0xf531('0x5'));var csv=require(_0xf531('0x6'));var ejs=require(_0xf531('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf531('0x8'));var squel=require('squel');var crypto=require(_0xf531('0x9'));var jsforce=require(_0xf531('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf531('0x6'));var querystring=require(_0xf531('0xb'));var Papa=require('papaparse');var Redis=require(_0xf531('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xf531('0xd'));var as=require(_0xf531('0xe'));var hardwareService=require(_0xf531('0xf'));var logger=require(_0xf531('0x10'))('api');var utils=require(_0xf531('0x11'));var config=require(_0xf531('0x12'));var licenseUtil=require(_0xf531('0x13'));var db=require(_0xf531('0x14'))['db'];function respondWithStatusCode(_0xd03be8,_0x5adc63){_0x5adc63=_0x5adc63||0xcc;return function(_0x1e263d){if(_0x1e263d){return _0xd03be8[_0xf531('0x15')](_0x5adc63);}return _0xd03be8['status'](_0x5adc63)['end']();};}function respondWithResult(_0x199967,_0x4396c8){_0x4396c8=_0x4396c8||0xc8;return function(_0x55dbd3){if(_0x55dbd3){return _0x199967[_0xf531('0x16')](_0x4396c8)[_0xf531('0x17')](_0x55dbd3);}};}function respondWithFilteredResult(_0x924b71,_0x442156){return function(_0x5c1c26){if(_0x5c1c26){var _0x5ec782=typeof _0x442156[_0xf531('0x18')]===_0xf531('0x19')&&typeof _0x442156[_0xf531('0x1a')]===_0xf531('0x19');var _0x223ac5=_0x5c1c26[_0xf531('0x1b')];var _0x470df1=_0x5ec782?0x0:_0x442156[_0xf531('0x18')];var _0xdb2589=_0x5ec782?_0x5c1c26[_0xf531('0x1b')]:_0x442156[_0xf531('0x18')]+_0x442156[_0xf531('0x1a')];var _0x56d442;if(_0xdb2589>=_0x223ac5){_0xdb2589=_0x223ac5;_0x56d442=0xc8;}else{_0x56d442=0xce;}_0x924b71['status'](_0x56d442);return _0x924b71[_0xf531('0x1c')](_0xf531('0x1d'),_0x470df1+'-'+_0xdb2589+'/'+_0x223ac5)[_0xf531('0x17')](_0x5c1c26);}return null;};}function patchUpdates(_0x4ccb7e){return function(_0x3bbab0){try{jsonpatch[_0xf531('0x1e')](_0x3bbab0,_0x4ccb7e,!![]);}catch(_0x26e3e4){return BPromise[_0xf531('0x1f')](_0x26e3e4);}return _0x3bbab0['save']();};}function saveUpdates(_0x464840,_0x2d1bb4){return function(_0x4d472b){if(_0x4d472b){return _0x4d472b[_0xf531('0x20')](_0x464840)[_0xf531('0x21')](function(_0x2e3051){return _0x2e3051;});}return null;};}function removeEntity(_0x26e917,_0x175c16){return function(_0x412699){if(_0x412699){return _0x412699['destroy']()['then'](function(){var _0x2cf1f9=_0x412699[_0xf531('0x22')]({'plain':!![]});var _0x342ecc=_0xf531('0x23');return db['UserProfileResource'][_0xf531('0x24')]({'where':{'type':_0x342ecc,'resourceId':_0x2cf1f9['id']}})[_0xf531('0x21')](function(){return _0x412699;});})['then'](function(){_0x26e917['status'](0xcc)[_0xf531('0x25')]();});}};}function handleEntityNotFound(_0xeab4b6,_0x3ab3c2){return function(_0x1053ef){if(!_0x1053ef){_0xeab4b6['sendStatus'](0x194);}return _0x1053ef;};}function handleError(_0x3b1391,_0x148166){_0x148166=_0x148166||0x1f4;return function(_0x17ca71){logger[_0xf531('0x26')](_0x17ca71[_0xf531('0x27')]);if(_0x17ca71[_0xf531('0x28')]){delete _0x17ca71[_0xf531('0x28')];}_0x3b1391[_0xf531('0x16')](_0x148166)[_0xf531('0x29')](_0x17ca71);};}exports['index']=function(_0x440c7a,_0x1dd727){var _0x4ed871={},_0x4e077e={},_0x1240cf={'count':0x0,'rows':[]};var _0x34be3c=_[_0xf531('0x2a')](db[_0xf531('0x2b')][_0xf531('0x2c')],function(_0x593161){return{'name':_0x593161[_0xf531('0x2d')],'type':_0x593161[_0xf531('0x2e')][_0xf531('0x2f')]};});_0x4e077e[_0xf531('0x30')]=_[_0xf531('0x2a')](_0x34be3c,_0xf531('0x28'));_0x4e077e[_0xf531('0x31')]=_[_0xf531('0x32')](_0x440c7a[_0xf531('0x31')]);_0x4e077e[_0xf531('0x33')]=_[_0xf531('0x34')](_0x4e077e[_0xf531('0x30')],_0x4e077e[_0xf531('0x31')]);_0x4ed871[_0xf531('0x35')]=_[_0xf531('0x34')](_0x4e077e['model'],qs[_0xf531('0x36')](_0x440c7a['query'][_0xf531('0x36')]));_0x4ed871[_0xf531('0x35')]=_0x4ed871[_0xf531('0x35')][_0xf531('0x37')]?_0x4ed871[_0xf531('0x35')]:_0x4e077e[_0xf531('0x30')];if(!_0x440c7a[_0xf531('0x31')][_0xf531('0x38')]('nolimit')){_0x4ed871[_0xf531('0x1a')]=qs[_0xf531('0x1a')](_0x440c7a['query'][_0xf531('0x1a')]);_0x4ed871[_0xf531('0x18')]=qs[_0xf531('0x18')](_0x440c7a[_0xf531('0x31')]['offset']);}_0x4ed871[_0xf531('0x39')]=qs[_0xf531('0x3a')](_0x440c7a[_0xf531('0x31')][_0xf531('0x3a')]);_0x4ed871[_0xf531('0x3b')]=qs[_0xf531('0x33')](_[_0xf531('0x3c')](_0x440c7a[_0xf531('0x31')],_0x4e077e[_0xf531('0x33')]),_0x34be3c);if(_0x440c7a[_0xf531('0x31')][_0xf531('0x3d')]){_0x4ed871[_0xf531('0x3b')]=_['merge'](_0x4ed871['where'],{'$or':_['map'](_0x34be3c,function(_0xf60650){if(_0xf60650['type']!==_0xf531('0x3e')){var _0x19f636={};_0x19f636[_0xf60650[_0xf531('0x28')]]={'$like':'%'+_0x440c7a[_0xf531('0x31')]['filter']+'%'};return _0x19f636;}})});}_0x4ed871=_['merge']({},_0x4ed871,_0x440c7a[_0xf531('0x3f')]);var _0x4293f6={'where':_0x4ed871[_0xf531('0x3b')]};return db[_0xf531('0x2b')][_0xf531('0x1b')](_0x4293f6)[_0xf531('0x21')](function(_0x5e9812){_0x1240cf['count']=_0x5e9812;if(_0x440c7a['query'][_0xf531('0x40')]){_0x4ed871[_0xf531('0x41')]=[{'all':!![]}];}return db[_0xf531('0x2b')][_0xf531('0x42')](_0x4ed871);})[_0xf531('0x21')](function(_0x42db63){_0x1240cf[_0xf531('0x43')]=_0x42db63;return _0x1240cf;})['then'](respondWithFilteredResult(_0x1dd727,_0x4ed871))['catch'](handleError(_0x1dd727,null));};exports[_0xf531('0x44')]=function(_0x29d8a5,_0x4b720b){var _0x343c0c={'raw':!![],'where':{'id':_0x29d8a5[_0xf531('0x45')]['id']}},_0x488098={};_0x488098[_0xf531('0x30')]=_[_0xf531('0x32')](db[_0xf531('0x2b')][_0xf531('0x2c')]);_0x488098[_0xf531('0x31')]=_[_0xf531('0x32')](_0x29d8a5[_0xf531('0x31')]);_0x488098['filters']=_['intersection'](_0x488098['model'],_0x488098[_0xf531('0x31')]);_0x343c0c['attributes']=_['intersection'](_0x488098[_0xf531('0x30')],qs[_0xf531('0x36')](_0x29d8a5[_0xf531('0x31')]['fields']));_0x343c0c[_0xf531('0x35')]=_0x343c0c[_0xf531('0x35')][_0xf531('0x37')]?_0x343c0c[_0xf531('0x35')]:_0x488098[_0xf531('0x30')];if(_0x29d8a5[_0xf531('0x31')][_0xf531('0x40')]){_0x343c0c[_0xf531('0x41')]=[{'all':!![]}];}_0x343c0c=_[_0xf531('0x46')]({},_0x343c0c,_0x29d8a5[_0xf531('0x3f')]);return db[_0xf531('0x2b')][_0xf531('0x47')](_0x343c0c)['then'](handleEntityNotFound(_0x4b720b,null))[_0xf531('0x21')](respondWithResult(_0x4b720b,null))[_0xf531('0x48')](handleError(_0x4b720b,null));};exports['create']=function(_0x15360a,_0x432ff7){return db[_0xf531('0x2b')][_0xf531('0x49')](_0x15360a[_0xf531('0x4a')],{})[_0xf531('0x21')](function(_0x3592c0){var _0x160b28=_0x15360a[_0xf531('0x4b')]['get']({'plain':!![]});if(!_0x160b28)throw new Error(_0xf531('0x4c'));if(_0x160b28[_0xf531('0x4d')]===_0xf531('0x4b')){var _0x1ff01e=_0x3592c0['get']({'plain':!![]});var _0x5997e1=_0xf531('0x23');return db[_0xf531('0x4e')][_0xf531('0x47')]({'where':{'name':_0x5997e1,'userProfileId':_0x160b28[_0xf531('0x4f')]},'raw':!![]})[_0xf531('0x21')](function(_0x156c6a){if(_0x156c6a&&_0x156c6a[_0xf531('0x50')]===0x0){return db[_0xf531('0x51')]['create']({'name':_0x1ff01e[_0xf531('0x28')],'resourceId':_0x1ff01e['id'],'type':_0x156c6a[_0xf531('0x28')],'sectionId':_0x156c6a['id']},{})[_0xf531('0x21')](function(){return _0x3592c0;});}else{return _0x3592c0;}})[_0xf531('0x48')](function(_0x172094){logger[_0xf531('0x26')](_0xf531('0x52'),_0x172094);throw _0x172094;});}return _0x3592c0;})[_0xf531('0x21')](respondWithResult(_0x432ff7,0xc9))[_0xf531('0x48')](handleError(_0x432ff7,null));};exports['update']=function(_0x1b17e6,_0x4ec797){if(_0x1b17e6['body']['id']){delete _0x1b17e6[_0xf531('0x4a')]['id'];}return db[_0xf531('0x2b')]['find']({'where':{'id':_0x1b17e6[_0xf531('0x45')]['id']}})[_0xf531('0x21')](handleEntityNotFound(_0x4ec797,null))[_0xf531('0x21')](saveUpdates(_0x1b17e6[_0xf531('0x4a')],null))[_0xf531('0x21')](respondWithResult(_0x4ec797,null))[_0xf531('0x48')](handleError(_0x4ec797,null));};exports[_0xf531('0x24')]=function(_0x817268,_0x129b13){return db[_0xf531('0x2b')][_0xf531('0x47')]({'where':{'id':_0x817268['params']['id']}})[_0xf531('0x21')](handleEntityNotFound(_0x129b13,null))[_0xf531('0x21')](removeEntity(_0x129b13,null))[_0xf531('0x48')](handleError(_0x129b13,null));}; \ No newline at end of file +var _0x58e7=['findAll','rows','catch','show','params','length','find','create','body','user','userProfileId','update','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','then','destroy','get','Pauses','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','Pause'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x58e7,0x138));var _0x758e=function(_0x55f6df,_0x1f4b1e){_0x55f6df=_0x55f6df-0x0;var _0x34b94e=_0x58e7[_0x55f6df];return _0x34b94e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x758e('0x0'));var jsonpatch=require(_0x758e('0x1'));var rp=require(_0x758e('0x2'));var moment=require(_0x758e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x758e('0x4'));var path=require('path');var sox=require(_0x758e('0x5'));var csv=require(_0x758e('0x6'));var ejs=require(_0x758e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x758e('0x8'));var squel=require('squel');var crypto=require(_0x758e('0x9'));var jsforce=require(_0x758e('0xa'));var deskjs=require(_0x758e('0xb'));var toCsv=require(_0x758e('0x6'));var querystring=require(_0x758e('0xc'));var Papa=require(_0x758e('0xd'));var Redis=require(_0x758e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x758e('0xf'));var as=require(_0x758e('0x10'));var hardwareService=require(_0x758e('0x11'));var logger=require(_0x758e('0x12'))(_0x758e('0x13'));var utils=require('../../config/utils');var config=require(_0x758e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x758e('0x15'))['db'];function respondWithStatusCode(_0x42c7ec,_0x36a448){_0x36a448=_0x36a448||0xcc;return function(_0x1b2839){if(_0x1b2839){return _0x42c7ec[_0x758e('0x16')](_0x36a448);}return _0x42c7ec['status'](_0x36a448)[_0x758e('0x17')]();};}function respondWithResult(_0x41e2c0,_0x4c4c84){_0x4c4c84=_0x4c4c84||0xc8;return function(_0x2da18d){if(_0x2da18d){return _0x41e2c0[_0x758e('0x18')](_0x4c4c84)[_0x758e('0x19')](_0x2da18d);}};}function respondWithFilteredResult(_0x53eb48,_0x58a2e2){return function(_0x439be8){if(_0x439be8){var _0x35899a=typeof _0x58a2e2[_0x758e('0x1a')]==='undefined'&&typeof _0x58a2e2[_0x758e('0x1b')]==='undefined';var _0x1f2ece=_0x439be8[_0x758e('0x1c')];var _0x1bc11a=_0x35899a?0x0:_0x58a2e2[_0x758e('0x1a')];var _0x2a9f38=_0x35899a?_0x439be8['count']:_0x58a2e2[_0x758e('0x1a')]+_0x58a2e2[_0x758e('0x1b')];var _0x154123;if(_0x2a9f38>=_0x1f2ece){_0x2a9f38=_0x1f2ece;_0x154123=0xc8;}else{_0x154123=0xce;}_0x53eb48[_0x758e('0x18')](_0x154123);return _0x53eb48['set'](_0x758e('0x1d'),_0x1bc11a+'-'+_0x2a9f38+'/'+_0x1f2ece)[_0x758e('0x19')](_0x439be8);}return null;};}function patchUpdates(_0x564233){return function(_0x5f0d74){try{jsonpatch[_0x758e('0x1e')](_0x5f0d74,_0x564233,!![]);}catch(_0x5a0337){return BPromise[_0x758e('0x1f')](_0x5a0337);}return _0x5f0d74['save']();};}function saveUpdates(_0xfa8682,_0x52be64){return function(_0x40c3e9){if(_0x40c3e9){return _0x40c3e9['update'](_0xfa8682)[_0x758e('0x20')](function(_0x4a0a17){return _0x4a0a17;});}return null;};}function removeEntity(_0x49d375,_0x5e6200){return function(_0x4ee311){if(_0x4ee311){return _0x4ee311[_0x758e('0x21')]()['then'](function(){var _0x4c6995=_0x4ee311[_0x758e('0x22')]({'plain':!![]});var _0x2c37b=_0x758e('0x23');return db[_0x758e('0x24')][_0x758e('0x21')]({'where':{'type':_0x2c37b,'resourceId':_0x4c6995['id']}})[_0x758e('0x20')](function(){return _0x4ee311;});})[_0x758e('0x20')](function(){_0x49d375[_0x758e('0x18')](0xcc)[_0x758e('0x17')]();});}};}function handleEntityNotFound(_0x544b0f,_0x4114e8){return function(_0x52d6d2){if(!_0x52d6d2){_0x544b0f[_0x758e('0x16')](0x194);}return _0x52d6d2;};}function handleError(_0x109767,_0x3bd409){_0x3bd409=_0x3bd409||0x1f4;return function(_0x29ade8){logger[_0x758e('0x25')](_0x29ade8[_0x758e('0x26')]);if(_0x29ade8['name']){delete _0x29ade8[_0x758e('0x27')];}_0x109767['status'](_0x3bd409)['send'](_0x29ade8);};}exports['index']=function(_0x1f5608,_0x46f63f){var _0x2ce8ea={},_0x38f06c={},_0x175266={'count':0x0,'rows':[]};var _0x5cde3e=_[_0x758e('0x28')](db['Pause'][_0x758e('0x29')],function(_0x5b5db6){return{'name':_0x5b5db6[_0x758e('0x2a')],'type':_0x5b5db6[_0x758e('0x2b')]['key']};});_0x38f06c['model']=_[_0x758e('0x28')](_0x5cde3e,'name');_0x38f06c[_0x758e('0x2c')]=_[_0x758e('0x2d')](_0x1f5608['query']);_0x38f06c['filters']=_[_0x758e('0x2e')](_0x38f06c[_0x758e('0x2f')],_0x38f06c[_0x758e('0x2c')]);_0x2ce8ea[_0x758e('0x30')]=_['intersection'](_0x38f06c[_0x758e('0x2f')],qs['fields'](_0x1f5608[_0x758e('0x2c')][_0x758e('0x31')]));_0x2ce8ea[_0x758e('0x30')]=_0x2ce8ea['attributes']['length']?_0x2ce8ea[_0x758e('0x30')]:_0x38f06c[_0x758e('0x2f')];if(!_0x1f5608[_0x758e('0x2c')][_0x758e('0x32')](_0x758e('0x33'))){_0x2ce8ea[_0x758e('0x1b')]=qs[_0x758e('0x1b')](_0x1f5608[_0x758e('0x2c')][_0x758e('0x1b')]);_0x2ce8ea['offset']=qs[_0x758e('0x1a')](_0x1f5608[_0x758e('0x2c')][_0x758e('0x1a')]);}_0x2ce8ea[_0x758e('0x34')]=qs[_0x758e('0x35')](_0x1f5608[_0x758e('0x2c')][_0x758e('0x35')]);_0x2ce8ea['where']=qs[_0x758e('0x36')](_[_0x758e('0x37')](_0x1f5608[_0x758e('0x2c')],_0x38f06c['filters']),_0x5cde3e);if(_0x1f5608['query']['filter']){_0x2ce8ea[_0x758e('0x38')]=_[_0x758e('0x39')](_0x2ce8ea['where'],{'$or':_['map'](_0x5cde3e,function(_0x4d45aa){if(_0x4d45aa['type']!==_0x758e('0x3a')){var _0x4eaa32={};_0x4eaa32[_0x4d45aa[_0x758e('0x27')]]={'$like':'%'+_0x1f5608['query'][_0x758e('0x3b')]+'%'};return _0x4eaa32;}})});}_0x2ce8ea=_[_0x758e('0x39')]({},_0x2ce8ea,_0x1f5608[_0x758e('0x3c')]);var _0x5eb766={'where':_0x2ce8ea[_0x758e('0x38')]};return db['Pause'][_0x758e('0x1c')](_0x5eb766)[_0x758e('0x20')](function(_0x13f754){_0x175266[_0x758e('0x1c')]=_0x13f754;if(_0x1f5608[_0x758e('0x2c')][_0x758e('0x3d')]){_0x2ce8ea['include']=[{'all':!![]}];}return db[_0x758e('0x3e')][_0x758e('0x3f')](_0x2ce8ea);})[_0x758e('0x20')](function(_0x8d73ae){_0x175266[_0x758e('0x40')]=_0x8d73ae;return _0x175266;})[_0x758e('0x20')](respondWithFilteredResult(_0x46f63f,_0x2ce8ea))[_0x758e('0x41')](handleError(_0x46f63f,null));};exports[_0x758e('0x42')]=function(_0x41b1ae,_0x54b3db){var _0x3e6749={'raw':!![],'where':{'id':_0x41b1ae[_0x758e('0x43')]['id']}},_0x57e97b={};_0x57e97b[_0x758e('0x2f')]=_['keys'](db[_0x758e('0x3e')][_0x758e('0x29')]);_0x57e97b[_0x758e('0x2c')]=_[_0x758e('0x2d')](_0x41b1ae[_0x758e('0x2c')]);_0x57e97b[_0x758e('0x36')]=_[_0x758e('0x2e')](_0x57e97b[_0x758e('0x2f')],_0x57e97b['query']);_0x3e6749[_0x758e('0x30')]=_[_0x758e('0x2e')](_0x57e97b[_0x758e('0x2f')],qs[_0x758e('0x31')](_0x41b1ae[_0x758e('0x2c')][_0x758e('0x31')]));_0x3e6749['attributes']=_0x3e6749[_0x758e('0x30')][_0x758e('0x44')]?_0x3e6749['attributes']:_0x57e97b[_0x758e('0x2f')];if(_0x41b1ae[_0x758e('0x2c')][_0x758e('0x3d')]){_0x3e6749['include']=[{'all':!![]}];}_0x3e6749=_[_0x758e('0x39')]({},_0x3e6749,_0x41b1ae[_0x758e('0x3c')]);return db['Pause'][_0x758e('0x45')](_0x3e6749)[_0x758e('0x20')](handleEntityNotFound(_0x54b3db,null))['then'](respondWithResult(_0x54b3db,null))[_0x758e('0x41')](handleError(_0x54b3db,null));};exports[_0x758e('0x46')]=function(_0x55a4ed,_0x2c7a87){return db[_0x758e('0x3e')][_0x758e('0x46')](_0x55a4ed[_0x758e('0x47')],{})[_0x758e('0x20')](function(_0x6fd2b5){var _0x5a1779=_0x55a4ed[_0x758e('0x48')][_0x758e('0x22')]({'plain':!![]});if(!_0x5a1779)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a1779['role']===_0x758e('0x48')){var _0x50c3a7=_0x6fd2b5['get']({'plain':!![]});var _0x3e6349=_0x758e('0x23');return db['UserProfileSection'][_0x758e('0x45')]({'where':{'name':_0x3e6349,'userProfileId':_0x5a1779[_0x758e('0x49')]},'raw':!![]})[_0x758e('0x20')](function(_0x331122){if(_0x331122&&_0x331122['autoAssociation']===0x0){return db[_0x758e('0x24')][_0x758e('0x46')]({'name':_0x50c3a7['name'],'resourceId':_0x50c3a7['id'],'type':_0x331122[_0x758e('0x27')],'sectionId':_0x331122['id']},{})[_0x758e('0x20')](function(){return _0x6fd2b5;});}else{return _0x6fd2b5;}})[_0x758e('0x41')](function(_0x139d4d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139d4d);throw _0x139d4d;});}return _0x6fd2b5;})[_0x758e('0x20')](respondWithResult(_0x2c7a87,0xc9))[_0x758e('0x41')](handleError(_0x2c7a87,null));};exports[_0x758e('0x4a')]=function(_0x6e28c9,_0x4bf9d0){if(_0x6e28c9[_0x758e('0x47')]['id']){delete _0x6e28c9['body']['id'];}return db['Pause'][_0x758e('0x45')]({'where':{'id':_0x6e28c9[_0x758e('0x43')]['id']}})[_0x758e('0x20')](handleEntityNotFound(_0x4bf9d0,null))[_0x758e('0x20')](saveUpdates(_0x6e28c9[_0x758e('0x47')],null))[_0x758e('0x20')](respondWithResult(_0x4bf9d0,null))[_0x758e('0x41')](handleError(_0x4bf9d0,null));};exports[_0x758e('0x21')]=function(_0x57953f,_0x1dec00){return db['Pause'][_0x758e('0x45')]({'where':{'id':_0x57953f[_0x758e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dec00,null))[_0x758e('0x20')](removeEntity(_0x1dec00,null))[_0x758e('0x41')](handleError(_0x1dec00,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4ae6768..267e56a 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x4cd539,_0x94c80f){var _0x1bb09f=function(_0x37a1fe){while(--_0x37a1fe){_0x4cd539['push'](_0x4cd539['shift']());}};_0x1bb09f(++_0x94c80f);}(_0x5fab,0x177));var _0xb5fa=function(_0x103ff9,_0x576a4d){_0x103ff9=_0x103ff9-0x0;var _0x40693e=_0x5fab[_0x103ff9];return _0x40693e;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x2b9e7d,_0x3db522){var _0x2605fe=function(_0x33f246){while(--_0x33f246){_0x2b9e7d['push'](_0x2b9e7d['shift']());}};_0x2605fe(++_0x3db522);}(_0x814b,0x1a2));var _0xb814=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x814b[_0x462999];return _0x4b1366;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'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 f4de36a..97d9a49 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(_0x255b6d,_0x1f2c7a){var _0x3313f0=function(_0x1e389a){while(--_0x1e389a){_0x255b6d['push'](_0x255b6d['shift']());}};_0x3313f0(++_0x1f2c7a);}(_0x7a54,0x106));var _0x47a5=function(_0x50cb11,_0x57f886){_0x50cb11=_0x50cb11-0x0;var _0xde143b=_0x7a54[_0x50cb11];return _0xde143b;};'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(_0x4634c9,_0x13c633){var _0x2dd6ff=function(_0x5d790b){while(--_0x5d790b){_0x4634c9['push'](_0x4634c9['shift']());}};_0x2dd6ff(++_0x13c633);}(_0xb10b,0x12a));var _0xbb10=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0xb10b[_0x420a7c];return _0x311c52;};'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 3b6c060..068b855 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 _0xdace=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x114651,_0x2d3a3d){var _0x2bdb6f=function(_0x2fc273){while(--_0x2fc273){_0x114651['push'](_0x114651['shift']());}};_0x2bdb6f(++_0x2d3a3d);}(_0xdace,0xc5));var _0xedac=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0xdace[_0x30abff];return _0x4c571e;};'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('./plugin.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),controller[_0xedac('0xc')]);router[_0xedac('0x8')]('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0xd')]);router[_0xedac('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xedac('0xe')]);var upload=multer({'storage':multer[_0xedac('0xf')]({'destination':function(_0x57e1bf,_0x4d6a29,_0x4db2ad){_0x4db2ad(null,path[_0xedac('0x10')](config['root'],_0xedac('0x11')));},'filename':function(_0x4fa1ac,_0x21c6ae,_0x1b0503){_0x21c6ae[_0xedac('0x12')]=_0x21c6ae[_0xedac('0x12')][_0xedac('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b0503(null,util[_0xedac('0x14')](_0xedac('0x15'),path[_0xedac('0x16')](_0x21c6ae['originalname'],path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])),Date[_0xedac('0x18')](),path[_0xedac('0x17')](_0x21c6ae[_0xedac('0x12')])));}})});router['post']('/',upload[_0xedac('0x19')]('file'),controller[_0xedac('0x1a')]);router[_0xedac('0x1b')](_0xedac('0xb'),controller[_0xedac('0x1c')]);router['put']('/:id',auth[_0xedac('0x9')](),controller[_0xedac('0x1d')]);router[_0xedac('0x1e')](_0xedac('0x1f'),auth['isAuthenticated'](),controller['delete']);module[_0xedac('0x20')]=router; \ No newline at end of file +var _0xb332=['server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root'];(function(_0x352588,_0x19b360){var _0x2c8775=function(_0xd44f4e){while(--_0xd44f4e){_0x352588['push'](_0x352588['shift']());}};_0x2c8775(++_0x19b360);}(_0xb332,0xd9));var _0x2b33=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0xb332[_0x2b0a86];return _0x955940;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./plugin.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/webhook',controller['webhookGet']);router[_0x2b33('0x6')]('/:id',auth[_0x2b33('0x7')](),controller[_0x2b33('0x9')]);router[_0x2b33('0x6')](_0x2b33('0xa'),auth['isAuthenticated'](),controller[_0x2b33('0xb')]);var upload=multer({'storage':multer[_0x2b33('0xc')]({'destination':function(_0x1be19d,_0x1d83a6,_0x1989f3){_0x1989f3(null,path[_0x2b33('0xd')](config[_0x2b33('0xe')],_0x2b33('0xf')));},'filename':function(_0x1e0d36,_0x3969cb,_0xca2248){_0x3969cb['originalname']=_0x3969cb[_0x2b33('0x10')][_0x2b33('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xca2248(null,util[_0x2b33('0x12')]('%s-%s%s',path[_0x2b33('0x13')](_0x3969cb['originalname'],path[_0x2b33('0x14')](_0x3969cb[_0x2b33('0x10')])),Date[_0x2b33('0x15')](),path['extname'](_0x3969cb['originalname'])));}})});router[_0x2b33('0x16')]('/',upload[_0x2b33('0x17')](_0x2b33('0x18')),controller[_0x2b33('0x19')]);router[_0x2b33('0x16')]('/webhook',controller['webhookPost']);router['put'](_0x2b33('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x2b33('0x1b')](_0x2b33('0x1a'),auth[_0x2b33('0x7')](),controller['delete']);module[_0x2b33('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 97feb4a..a47e548 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 _0x14f8=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','exports','html','script','TEXT','BOOLEAN','adminOnly'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x14f8,0x11c));var _0x814f=function(_0x51a212,_0x23f827){_0x51a212=_0x51a212-0x0;var _0x2fe85c=_0x14f8[_0x51a212];return _0x2fe85c;};'use strict';var Sequelize=require('sequelize');module[_0x814f('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x814f('0x1'),_0x814f('0x2'))},'description':{'type':Sequelize[_0x814f('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x814f('0x4')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x814f('0x5'),_0x814f('0x6'),_0x814f('0x7'),'never'),'defaultValue':_0x814f('0x7'),'comment':_0x814f('0x8')},'icon':{'type':Sequelize[_0x814f('0x9')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x814f('0x9')]},'scriptPath':{'type':Sequelize[_0x814f('0x9')]}}; \ No newline at end of file +var _0x2d79=['never','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always'];(function(_0xb6475c,_0x176401){var _0x583182=function(_0x348b86){while(--_0x348b86){_0xb6475c['push'](_0xb6475c['shift']());}};_0x583182(++_0x176401);}(_0x2d79,0x1a3));var _0x92d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2d79[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x92d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x92d7('0x1')]},'type':{'type':Sequelize[_0x92d7('0x2')](_0x92d7('0x3'),_0x92d7('0x4'))},'description':{'type':Sequelize[_0x92d7('0x5')]},'version':{'type':Sequelize[_0x92d7('0x5')]},'path':{'type':Sequelize[_0x92d7('0x1')],'comment':_0x92d7('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x92d7('0x7'),_0x92d7('0x8'),_0x92d7('0x9'),_0x92d7('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x92d7('0x1')]},'adminUrl':{'type':Sequelize[_0x92d7('0x1')]},'agentUrl':{'type':Sequelize[_0x92d7('0x1')]},'scriptName':{'type':Sequelize[_0x92d7('0x1')]},'scriptPath':{'type':Sequelize[_0x92d7('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4ad60a2..9e91bda 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 _0x5de7=['update','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','show','params','rawAttributes','length','include','options','find','catch','download','join','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','role','body','userProfileId','user','UserProfileSection','create','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed'];(function(_0xd502a2,_0x49b4a2){var _0x12bd3e=function(_0x51dc82){while(--_0x51dc82){_0xd502a2['push'](_0xd502a2['shift']());}};_0x12bd3e(++_0x49b4a2);}(_0x5de7,0x168));var _0x75de=function(_0x2a06e4,_0x5b71eb){_0x2a06e4=_0x2a06e4-0x0;var _0x598747=_0x5de7[_0x2a06e4];return _0x598747;};'use strict';var emlformat=require(_0x75de('0x0'));var rimraf=require(_0x75de('0x1'));var zipdir=require(_0x75de('0x2'));var jsonpatch=require(_0x75de('0x3'));var rp=require(_0x75de('0x4'));var moment=require(_0x75de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75de('0x6'));var util=require(_0x75de('0x7'));var path=require(_0x75de('0x8'));var sox=require(_0x75de('0x9'));var csv=require(_0x75de('0xa'));var ejs=require(_0x75de('0xb'));var fs=require('fs');var fs_extra=require(_0x75de('0xc'));var _=require(_0x75de('0xd'));var squel=require(_0x75de('0xe'));var crypto=require(_0x75de('0xf'));var jsforce=require(_0x75de('0x10'));var deskjs=require(_0x75de('0x11'));var toCsv=require(_0x75de('0xa'));var querystring=require('querystring');var Papa=require(_0x75de('0x12'));var extract=require(_0x75de('0x13'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x75de('0x14'));var authService=require(_0x75de('0x15'));var qs=require(_0x75de('0x16'));var as=require(_0x75de('0x17'));var hardwareService=require(_0x75de('0x18'));var logger=require(_0x75de('0x19'))(_0x75de('0x1a'));var utils=require(_0x75de('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x75de('0x1c'));var db=require(_0x75de('0x1d'))['db'];config[_0x75de('0x1e')]=_['defaults'](config[_0x75de('0x1e')],{'host':_0x75de('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x75de('0x20'))['register'](socket);function respondWithStatusCode(_0x46c982,_0x5f12a6){_0x5f12a6=_0x5f12a6||0xcc;return function(_0x344f03){if(_0x344f03){return _0x46c982[_0x75de('0x21')](_0x5f12a6);}return _0x46c982[_0x75de('0x22')](_0x5f12a6)['end']();};}function respondWithResult(_0x546b5b,_0x333b5d){_0x333b5d=_0x333b5d||0xc8;return function(_0x4fb862){if(_0x4fb862){return _0x546b5b[_0x75de('0x22')](_0x333b5d)[_0x75de('0x23')](_0x4fb862);}};}function respondWithFilteredResult(_0x1e97ef,_0x37259d){return function(_0x19c7ec){if(_0x19c7ec){var _0x51ec81=typeof _0x37259d[_0x75de('0x24')]===_0x75de('0x25')&&typeof _0x37259d[_0x75de('0x26')]===_0x75de('0x25');var _0x24af51=_0x19c7ec['count'];var _0x463160=_0x51ec81?0x0:_0x37259d['offset'];var _0xedaab0=_0x51ec81?_0x19c7ec['count']:_0x37259d[_0x75de('0x24')]+_0x37259d['limit'];var _0x4709fd;if(_0xedaab0>=_0x24af51){_0xedaab0=_0x24af51;_0x4709fd=0xc8;}else{_0x4709fd=0xce;}_0x1e97ef[_0x75de('0x22')](_0x4709fd);return _0x1e97ef[_0x75de('0x27')](_0x75de('0x28'),_0x463160+'-'+_0xedaab0+'/'+_0x24af51)['json'](_0x19c7ec);}return null;};}function patchUpdates(_0x170b7c){return function(_0x23d5cb){try{jsonpatch[_0x75de('0x29')](_0x23d5cb,_0x170b7c,!![]);}catch(_0x2617ad){return BPromise['reject'](_0x2617ad);}return _0x23d5cb[_0x75de('0x2a')]();};}function saveUpdates(_0x5d2b5f,_0xc53d46){return function(_0x72d7c4){if(_0x72d7c4){return _0x72d7c4['update'](_0x5d2b5f)[_0x75de('0x2b')](function(_0x3bc985){return _0x3bc985;});}return null;};}function removeEntity(_0x356214,_0x3598fd){return function(_0x314114){if(_0x314114){return _0x314114[_0x75de('0x2c')]()[_0x75de('0x2b')](function(){var _0x4553ba=_0x314114[_0x75de('0x2d')]({'plain':!![]});var _0x3e0c7b=_0x75de('0x2e');return db[_0x75de('0x2f')][_0x75de('0x2c')]({'where':{'type':_0x3e0c7b,'resourceId':_0x4553ba['id']}})[_0x75de('0x2b')](function(){return _0x314114;});})['then'](function(){_0x356214['status'](0xcc)[_0x75de('0x30')]();});}};}function handleEntityNotFound(_0x4594fc,_0x4e6b73){return function(_0x36846d){if(!_0x36846d){_0x4594fc['sendStatus'](0x194);}return _0x36846d;};}function handleError(_0x543563,_0x4e4e75){_0x4e4e75=_0x4e4e75||0x1f4;return function(_0x1c7966){logger[_0x75de('0x31')](_0x1c7966[_0x75de('0x32')]);if(_0x1c7966[_0x75de('0x33')]){delete _0x1c7966[_0x75de('0x33')];}_0x543563[_0x75de('0x22')](_0x4e4e75)[_0x75de('0x34')](_0x1c7966);};}exports[_0x75de('0x35')]=function(_0x511b52,_0x3a1ab2){var _0x3fd033={},_0x858b11={},_0x3600fc={'count':0x0,'rows':[]};var _0x11819b=_[_0x75de('0x36')](db[_0x75de('0x37')]['rawAttributes'],function(_0x3893ac){return{'name':_0x3893ac[_0x75de('0x38')],'type':_0x3893ac[_0x75de('0x39')]['key']};});_0x858b11[_0x75de('0x3a')]=_[_0x75de('0x36')](_0x11819b,_0x75de('0x33'));_0x858b11[_0x75de('0x3b')]=_[_0x75de('0x3c')](_0x511b52[_0x75de('0x3b')]);_0x858b11[_0x75de('0x3d')]=_[_0x75de('0x3e')](_0x858b11[_0x75de('0x3a')],_0x858b11[_0x75de('0x3b')]);_0x3fd033[_0x75de('0x3f')]=_[_0x75de('0x3e')](_0x858b11[_0x75de('0x3a')],qs[_0x75de('0x40')](_0x511b52[_0x75de('0x3b')][_0x75de('0x40')]));_0x3fd033[_0x75de('0x3f')]=_0x3fd033[_0x75de('0x3f')]['length']?_0x3fd033['attributes']:_0x858b11[_0x75de('0x3a')];if(!_0x511b52['query'][_0x75de('0x41')]('nolimit')){_0x3fd033['limit']=qs[_0x75de('0x26')](_0x511b52[_0x75de('0x3b')][_0x75de('0x26')]);_0x3fd033[_0x75de('0x24')]=qs['offset'](_0x511b52[_0x75de('0x3b')]['offset']);}_0x3fd033[_0x75de('0x42')]=qs[_0x75de('0x43')](_0x511b52[_0x75de('0x3b')][_0x75de('0x43')]);_0x3fd033[_0x75de('0x44')]=qs[_0x75de('0x3d')](_[_0x75de('0x45')](_0x511b52[_0x75de('0x3b')],_0x858b11['filters']),_0x11819b);if(_0x511b52[_0x75de('0x3b')]['filter']){_0x3fd033[_0x75de('0x44')]=_['merge'](_0x3fd033[_0x75de('0x44')],{'$or':_[_0x75de('0x36')](_0x11819b,function(_0x3e68ae){if(_0x3e68ae[_0x75de('0x39')]!=='VIRTUAL'){var _0x492e48={};_0x492e48[_0x3e68ae['name']]={'$like':'%'+_0x511b52[_0x75de('0x3b')][_0x75de('0x46')]+'%'};return _0x492e48;}})});}_0x3fd033=_[_0x75de('0x47')]({},_0x3fd033,_0x511b52['options']);var _0xccd006={'where':_0x3fd033[_0x75de('0x44')]};return db['Plugin']['count'](_0xccd006)[_0x75de('0x2b')](function(_0xe112b0){_0x3600fc[_0x75de('0x48')]=_0xe112b0;if(_0x511b52[_0x75de('0x3b')][_0x75de('0x49')]){_0x3fd033['include']=[{'all':!![]}];}return db[_0x75de('0x37')]['findAll'](_0x3fd033);})['then'](function(_0x4046b4){_0x3600fc['rows']=_0x4046b4;return _0x3600fc;})[_0x75de('0x2b')](respondWithFilteredResult(_0x3a1ab2,_0x3fd033))['catch'](handleError(_0x3a1ab2,null));};exports[_0x75de('0x4a')]=function(_0x4c3543,_0x483a66){var _0x3f82ce={'raw':!![],'where':{'id':_0x4c3543[_0x75de('0x4b')]['id']}},_0x24932f={};_0x24932f[_0x75de('0x3a')]=_[_0x75de('0x3c')](db[_0x75de('0x37')][_0x75de('0x4c')]);_0x24932f['query']=_[_0x75de('0x3c')](_0x4c3543['query']);_0x24932f[_0x75de('0x3d')]=_[_0x75de('0x3e')](_0x24932f[_0x75de('0x3a')],_0x24932f[_0x75de('0x3b')]);_0x3f82ce[_0x75de('0x3f')]=_[_0x75de('0x3e')](_0x24932f['model'],qs[_0x75de('0x40')](_0x4c3543[_0x75de('0x3b')][_0x75de('0x40')]));_0x3f82ce[_0x75de('0x3f')]=_0x3f82ce[_0x75de('0x3f')][_0x75de('0x4d')]?_0x3f82ce['attributes']:_0x24932f[_0x75de('0x3a')];if(_0x4c3543[_0x75de('0x3b')][_0x75de('0x49')]){_0x3f82ce[_0x75de('0x4e')]=[{'all':!![]}];}_0x3f82ce=_[_0x75de('0x47')]({},_0x3f82ce,_0x4c3543[_0x75de('0x4f')]);return db['Plugin'][_0x75de('0x50')](_0x3f82ce)[_0x75de('0x2b')](handleEntityNotFound(_0x483a66,null))['then'](respondWithResult(_0x483a66,null))[_0x75de('0x51')](handleError(_0x483a66,null));};exports[_0x75de('0x52')]=function(_0x3ab63f,_0x2f4099,_0x314b35){return db[_0x75de('0x37')][_0x75de('0x50')]({'where':{'id':_0x3ab63f[_0x75de('0x4b')]['id']},'attributes':[_0x75de('0x33'),_0x75de('0x8')],'raw':!![]})[_0x75de('0x2b')](handleEntityNotFound(_0x2f4099,null))[_0x75de('0x2b')](function(_0x5f0894){if(_0x5f0894){var _0x2b381f=path[_0x75de('0x53')](config['root'],'server/files/plugins',util[_0x75de('0x54')](_0x75de('0x55'),path[_0x75de('0x56')](_0x5f0894[_0x75de('0x8')])));var _0x202595=fs['createWriteStream'](_0x2b381f);var _0x480dba=archiver(_0x75de('0x57'),{'zlib':{'level':0x9}});_0x480dba['on'](_0x75de('0x58'),function(_0x4ead3b){if(_0x4ead3b[_0x75de('0x59')]===_0x75de('0x5a')){logger[_0x75de('0x31')](_0x4ead3b);}else{throw new db[(_0x75de('0x5b'))][(_0x75de('0x5c'))](_0x75de('0x5d'));}});_0x480dba['on'](_0x75de('0x31'),function(_0x28e752){throw new db[(_0x75de('0x5b'))]['Error'](_0x75de('0x5d'));});_0x480dba[_0x75de('0x5e')](_0x202595);_0x480dba[_0x75de('0x5f')](_0x75de('0x60'),{'cwd':path[_0x75de('0x53')](config[_0x75de('0x61')],_0x75de('0x62'),path[_0x75de('0x63')](_0x5f0894['path'])),'ignore':[path[_0x75de('0x53')](path[_0x75de('0x56')](_0x5f0894[_0x75de('0x8')]),_0x75de('0x64')),path[_0x75de('0x53')](path[_0x75de('0x56')](_0x5f0894[_0x75de('0x8')]),_0x75de('0x65'))],'nodir':!![]})[_0x75de('0x66')]();_0x202595['on'](_0x75de('0x67'),function(){if(!fs['existsSync'](_0x2b381f)){throw new db[(_0x75de('0x5b'))]['Error'](_0x75de('0x68'));}return _0x2f4099[_0x75de('0x52')](_0x2b381f,util[_0x75de('0x54')](_0x75de('0x55'),path[_0x75de('0x56')](_0x5f0894[_0x75de('0x8')])),function(_0x59f70b){if(_0x59f70b){throw new db[(_0x75de('0x5b'))][(_0x75de('0x5c'))](_0x75de('0x69'));}fs['unlinkSync'](_0x2b381f);logger['info'](_0x75de('0x6a'));logger[_0x75de('0x6b')](_0x75de('0x6c'));});});}return null;})[_0x75de('0x51')](handleError(_0x2f4099,null));};exports[_0x75de('0x6d')]=function(_0x58f69a,_0x19bf3e,_0x19a73f){var _0x30bda6=path[_0x75de('0x56')](_0x58f69a[_0x75de('0x6e')][_0x75de('0x6f')],path[_0x75de('0x70')](_0x58f69a[_0x75de('0x6e')][_0x75de('0x6f')]));var _0x1e7f2a=path[_0x75de('0x53')](config[_0x75de('0x61')],_0x75de('0x62'),_0x58f69a[_0x75de('0x6e')]['filename']);var _0x130355=path['join'](config[_0x75de('0x61')],_0x75de('0x62'),_0x30bda6);logger['info'](_0x75de('0x71'),_0x1e7f2a);logger[_0x75de('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0x130355);try{fs['chmodSync'](_0x1e7f2a,parseInt(_0x75de('0x72'),0x8));extract(_0x1e7f2a,{'dir':_0x130355},function(_0x22abae){if(_0x22abae){logger[_0x75de('0x31')](_0x22abae);handleError(_0x22abae,!![]);};var _0x10b676=fs[_0x75de('0x73')](_0x130355);if(_0x10b676[_0x75de('0x4d')]>0x1){removeReferences(_0x1e7f2a,_0x130355);logger[_0x75de('0x31')](_0x75de('0x74'));return _0x19a73f(new Error(_0x75de('0x74')));}var _0x4f009d=fs['lstatSync'](path[_0x75de('0x53')](_0x130355,_0x10b676[0x0]));if(_0x4f009d[_0x75de('0x75')]()){removeReferences(_0x1e7f2a,_0x130355);logger[_0x75de('0x31')](_0x75de('0x74'));return _0x19a73f(new Error(_0x75de('0x74')));}if(_0x4f009d[_0x75de('0x76')]()){var _0x36f10c=fs[_0x75de('0x73')](path[_0x75de('0x53')](_0x130355,_0x10b676[0x0]));if(_0x36f10c[_0x75de('0x4d')]===0x0){removeReferences(_0x1e7f2a,_0x130355);logger['error'](_0x75de('0x74'));return _0x19a73f(new Error(_0x75de('0x74')));}var _0x2a1291=_0x36f10c[_0x75de('0x77')](function(_0x709e16){return _0x709e16===_0x75de('0x78');});if(!_0x2a1291){return _0x19a73f(new Error(_0x75de('0x79')));}var _0x2f0ef7=fs['readFileSync'](path[_0x75de('0x53')](_0x130355,_0x10b676[0x0],_0x75de('0x78')));var _0x122c8f=JSON[_0x75de('0x7a')](_0x2f0ef7);if(_0x75de('0x25')==typeof _0x122c8f['name']){return _0x19a73f(new Error(_0x75de('0x7b')));}if('undefined'==typeof _0x122c8f[_0x75de('0x39')]){return _0x19a73f(new Error(_0x75de('0x7c')));}if(_0x75de('0x25')==typeof _0x122c8f[_0x75de('0x7d')]){return _0x19a73f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x75de('0x25')==typeof _0x122c8f['parameters']){return _0x19a73f(new Error(_0x75de('0x7e')));}if(_0x122c8f[_0x75de('0x39')]===_0x75de('0x7f')){if(_0x75de('0x25')==typeof _0x122c8f[_0x75de('0x80')]['views']){return _0x19a73f(new Error(_0x75de('0x81')));}if('undefined'==typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x82')][_0x75de('0x83')]&&'undefined'==typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x82')][_0x75de('0x84')]){return _0x19a73f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x122c8f[_0x75de('0x39')]===_0x75de('0x85')){if('undefined'==typeof _0x122c8f['parameters'][_0x75de('0x86')]){return _0x19a73f(new Error(_0x75de('0x87')));}if(_0x75de('0x25')==typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x88')]){return _0x19a73f(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x19a73f(new Error(_0x75de('0x89')));}var _0x576ee7=_0x122c8f[_0x75de('0x33')];var _0x306f0=_0x122c8f[_0x75de('0x8a')];var _0x10244b=_0x122c8f[_0x75de('0x39')];var _0x201b3f=_0x122c8f[_0x75de('0x8b')]?_0x122c8f['sidebar']:_0x75de('0x8c');var _0x4d260a=_0x122c8f[_0x75de('0x8d')]?_0x122c8f[_0x75de('0x8d')]:_0x75de('0x8e');var _0x30757e='';var _0x4a2275='';var _0x9e83a7='';var _0x56f83f='';var _0x13e3ec=_0x122c8f['version'];if(_0x10244b===_0x75de('0x7f')){if(_0x75de('0x25')!=typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x82')]['admin']){var _0x5e926e=_0x122c8f[_0x75de('0x80')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x75de('0x8f')](_0x5e926e)){_0x30757e=path[_0x75de('0x53')](_0x75de('0x90'),_0x30bda6,_0x10b676[0x0],_0x5e926e);}else{_0x30757e=_0x5e926e;}}else{logger[_0x75de('0x6b')](_0x75de('0x91'));}if(_0x75de('0x25')!=typeof _0x122c8f['parameters'][_0x75de('0x82')][_0x75de('0x84')]){var _0x510828=_0x122c8f[_0x75de('0x80')][_0x75de('0x82')][_0x75de('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x75de('0x8f')](_0x510828)){_0x4a2275=path[_0x75de('0x53')](_0x75de('0x90'),_0x30bda6,_0x10b676[0x0],_0x510828);}else{_0x4a2275=_0x510828;}}else{logger['info'](_0x75de('0x92'));}}else if(_0x10244b===_0x75de('0x85')){_0x9e83a7=_0x122c8f['parameters'][_0x75de('0x86')];_0x56f83f=_0x122c8f[_0x75de('0x80')][_0x75de('0x88')];if(_0x75de('0x25')!=typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x82')]){if(_0x75de('0x25')!=typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x82')][_0x75de('0x83')]){var _0x5e926e=_0x122c8f[_0x75de('0x80')][_0x75de('0x82')][_0x75de('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5e926e)){_0x30757e=path['join'](_0x75de('0x90'),_0x30bda6,_0x10b676[0x0],_0x5e926e);}else{_0x30757e=_0x5e926e;}}if(_0x75de('0x25')!=typeof _0x122c8f[_0x75de('0x80')][_0x75de('0x82')][_0x75de('0x84')]){var _0x510828=_0x122c8f[_0x75de('0x80')]['views'][_0x75de('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x75de('0x8f')](_0x510828)){_0x4a2275=path[_0x75de('0x53')](_0x75de('0x90'),_0x30bda6,_0x10b676[0x0],_0x510828);}else{_0x4a2275=_0x510828;}}}}var _0xbe71={'name':_0x576ee7,'description':_0x306f0,'path':path[_0x75de('0x53')](_0x30bda6,_0x10b676[0x0]),'type':_0x10244b,'sidebar':_0x201b3f,'icon':_0x4d260a,'adminUrl':_0x30757e,'agentUrl':_0x4a2275,'scriptName':_0x9e83a7,'scriptPath':_0x56f83f,'version':_0x13e3ec};removeReferences(_0x1e7f2a,null);return db['Plugin']['create'](_0xbe71)['then'](function(_0x1a2104){var _0x525d5c={'role':_0x58f69a['body'][_0x75de('0x93')],'userProfileId':_0x58f69a[_0x75de('0x94')][_0x75de('0x95')]};if(!_0x525d5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x525d5c[_0x75de('0x93')]===_0x75de('0x96')){var _0x541d81=_0x1a2104[_0x75de('0x2d')]({'plain':!![]});return db[_0x75de('0x97')]['find']({'where':{'name':_0x75de('0x2e'),'userProfileId':_0x525d5c[_0x75de('0x95')]},'raw':!![]})[_0x75de('0x2b')](function(_0x1e39fc){if(_0x1e39fc&&_0x1e39fc['autoAssociation']===0x0){return db[_0x75de('0x2f')][_0x75de('0x98')]({'name':_0x541d81[_0x75de('0x33')],'resourceId':_0x541d81['id'],'type':_0x1e39fc['name'],'sectionId':_0x1e39fc['id']},{})[_0x75de('0x2b')](function(){return _0x1a2104;});}else{return _0x1a2104;}})['catch'](function(_0x51da00){logger[_0x75de('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51da00);throw _0x51da00;});}return _0x1a2104;})['then'](respondWithResult(_0x19bf3e,null))[_0x75de('0x51')](handleError(_0x19bf3e,null));}});}catch(_0x4d0063){_0x19bf3e['status'](0x1f4)[_0x75de('0x34')](_0x4d0063);}};function removeReferences(_0x2f5093,_0x42f075){try{if(_0x2f5093){fs[_0x75de('0x99')](_0x2f5093);logger[_0x75de('0x6b')](_0x75de('0x9a'));}if(_0x42f075){rimraf(_0x42f075,function(){});logger[_0x75de('0x6b')](_0x75de('0x9b'));}}catch(_0x10a42c){logger['error'](_0x10a42c);}}exports[_0x75de('0x9c')]=function(_0x2cb305,_0x39425d,_0x2dfc7d){return db[_0x75de('0x37')][_0x75de('0x50')]({'where':{'id':_0x2cb305[_0x75de('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39425d,null))[_0x75de('0x2b')](saveUpdates(_0x2cb305[_0x75de('0x94')],null))[_0x75de('0x2b')](respondWithResult(_0x39425d,null))['catch'](handleError(_0x39425d,null));};exports[_0x75de('0x9d')]=function(_0x458379,_0x5e675a,_0x2c8f70){return db[_0x75de('0x37')][_0x75de('0x50')]({'where':{'id':_0x458379[_0x75de('0x4b')]['id']}})['then'](function(_0x4fa85e){if(_0x4fa85e){return _0x4fa85e[_0x75de('0x2c')]();}})[_0x75de('0x2b')](function(_0x2abed4){rimraf(path[_0x75de('0x53')](config[_0x75de('0x61')],'server/files/plugins',path[_0x75de('0x63')](_0x2abed4[_0x75de('0x8')])),function(){});return _0x2abed4;})['then'](handleEntityNotFound(_0x5e675a,null))[_0x75de('0x2b')](respondWithStatusCode(_0x5e675a,null))['catch'](handleError(_0x5e675a,null));};exports['webhookGet']=function(_0x5c47f6,_0x347cdc,_0x561c6f){return BPromise['resolve']()[_0x75de('0x2b')](function(){if(!_0x5c47f6[_0x75de('0x3b')][_0x75de('0x8')]){throw new Error(_0x75de('0x9e'));}if(!_0x5c47f6[_0x75de('0x3b')][_0x75de('0x9f')]){throw new Error(_0x75de('0xa0'));}var _0x4a492d=_0x5c47f6[_0x75de('0x3b')]['hostname']?_0x5c47f6[_0x75de('0x3b')][_0x75de('0xa1')]+':'+_0x5c47f6[_0x75de('0x3b')][_0x75de('0x9f')]:_0x75de('0xa2')+_0x5c47f6[_0x75de('0x3b')][_0x75de('0x9f')];var _0x1cb2f0=_0x5c47f6['query']['json']?_0x5c47f6[_0x75de('0x3b')][_0x75de('0x23')]:!![];var _0x2644f7=_0x5c47f6[_0x75de('0x3b')][_0x75de('0xa3')]?_0x5c47f6[_0x75de('0x3b')][_0x75de('0xa3')]:null;var _0x4a41d2={'method':_0x5c47f6[_0x75de('0xa4')],'uri':util[_0x75de('0x54')](_0x75de('0xa5'),_0x4a492d,_0x5c47f6[_0x75de('0x3b')][_0x75de('0x8')]),'json':_0x1cb2f0,'resolveWithFullResponse':!![],'encoding':_0x2644f7,'qs':_0x5c47f6[_0x75de('0x3b')]};if(_0x5c47f6['headers']){_0x4a41d2['headers']=_0x5c47f6[_0x75de('0xa6')];if(_0x4a41d2[_0x75de('0xa6')][_0x75de('0xa7')]){delete _0x4a41d2[_0x75de('0xa6')]['content-length'];}}if(_0x4a41d2[_0x75de('0xa6')][_0x75de('0xa8')]){delete _0x4a41d2[_0x75de('0xa6')][_0x75de('0xa8')];}return rp(_0x4a41d2);})[_0x75de('0x2b')](function(_0x16cb28){if(_0x16cb28){_0x347cdc[_0x75de('0x27')](_0x16cb28[_0x75de('0xa6')]);logger[_0x75de('0x6b')](_0x16cb28[_0x75de('0x94')]);if(_[_0x75de('0xa9')](_0x5c47f6[_0x75de('0x3b')][_0x75de('0x8')],_0x75de('0x52'))&&_0x16cb28[_0x75de('0xaa')]==0x1f4){return _0x347cdc[_0x75de('0x21')](_0x16cb28[_0x75de('0xaa')]);}else{return _0x347cdc[_0x75de('0x22')](_0x16cb28[_0x75de('0xaa')])[_0x75de('0x34')](_0x16cb28[_0x75de('0x94')]);}}else{return _0x347cdc['sendStatus'](0xc8);}})[_0x75de('0x51')](handleError(_0x347cdc,null));};exports[_0x75de('0xab')]=function(_0x35ba0c,_0x3d3b92,_0x49faaf){return BPromise['resolve']()[_0x75de('0x2b')](function(){if(!_0x35ba0c[_0x75de('0x3b')][_0x75de('0x8')]){throw new Error(_0x75de('0x9e'));}if(!_0x35ba0c[_0x75de('0x3b')][_0x75de('0x9f')]){throw new Error(_0x75de('0xa0'));}var _0x58e07d=_0x35ba0c['query']['hostname']?_0x35ba0c[_0x75de('0x3b')]['hostname']+':'+_0x35ba0c[_0x75de('0x3b')]['port']:_0x75de('0xa2')+_0x35ba0c[_0x75de('0x3b')]['port'];var _0x3f9986=_0x35ba0c[_0x75de('0x3b')]['json']?_0x35ba0c[_0x75de('0x3b')][_0x75de('0x23')]:!![];var _0xf61bc2=_0x35ba0c[_0x75de('0x3b')][_0x75de('0xa3')]?_0x35ba0c[_0x75de('0x3b')][_0x75de('0xa3')]:null;var _0x4384f4={'method':_0x35ba0c[_0x75de('0xa4')],'uri':util['format'](_0x75de('0xa5'),_0x58e07d,_0x35ba0c[_0x75de('0x3b')][_0x75de('0x8')]),'json':_0x3f9986,'resolveWithFullResponse':!![],'encoding':_0xf61bc2,'body':_0x35ba0c[_0x75de('0x94')]};if(_0x35ba0c[_0x75de('0xa6')]){_0x4384f4[_0x75de('0xa6')]=_0x35ba0c[_0x75de('0xa6')];if(_0x4384f4[_0x75de('0xa6')][_0x75de('0xa7')]){delete _0x4384f4[_0x75de('0xa6')]['content-length'];}}if(_0x4384f4['headers'][_0x75de('0xa8')]){delete _0x4384f4[_0x75de('0xa6')][_0x75de('0xa8')];}return rp(_0x4384f4);})['then'](function(_0x4ac20e){if(_0x4ac20e){_0x3d3b92[_0x75de('0x27')](_0x4ac20e['headers']);logger[_0x75de('0x6b')](_0x4ac20e[_0x75de('0x94')]);return _0x3d3b92[_0x75de('0x22')](_0x4ac20e[_0x75de('0xaa')])[_0x75de('0x34')](_0x4ac20e[_0x75de('0x94')]);}else{return _0x3d3b92[_0x75de('0x21')](0xc8);}})[_0x75de('0x51')](handleError(_0x3d3b92,null));}; \ No newline at end of file +var _0xa183=['\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','http://localhost:','format','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','keys','filters','find','download','params','join','root','server/files/plugins','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Temporary\x20file\x20removed','upload','extname','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','scriptName','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port'];(function(_0x2507dd,_0x4f5114){var _0x5991cf=function(_0x4ac9aa){while(--_0x4ac9aa){_0x2507dd['push'](_0x2507dd['shift']());}};_0x5991cf(++_0x4f5114);}(_0xa183,0x162));var _0x3a18=function(_0x4c0625,_0xb2eacf){_0x4c0625=_0x4c0625-0x0;var _0x37e095=_0xa183[_0x4c0625];return _0x37e095;};'use strict';var emlformat=require(_0x3a18('0x0'));var rimraf=require(_0x3a18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a18('0x2'));var rp=require('request-promise');var moment=require(_0x3a18('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3a18('0x4'));var path=require(_0x3a18('0x5'));var sox=require(_0x3a18('0x6'));var csv=require('to-csv');var ejs=require(_0x3a18('0x7'));var fs=require('fs');var fs_extra=require(_0x3a18('0x8'));var _=require(_0x3a18('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3a18('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3a18('0xb'));var querystring=require(_0x3a18('0xc'));var Papa=require(_0x3a18('0xd'));var extract=require(_0x3a18('0xe'));var rimraf=require(_0x3a18('0x1'));var archiver=require(_0x3a18('0xf'));var Redis=require(_0x3a18('0x10'));var authService=require(_0x3a18('0x11'));var qs=require(_0x3a18('0x12'));var as=require(_0x3a18('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a18('0x14'))(_0x3a18('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3a18('0x16'));var db=require(_0x3a18('0x17'))['db'];config[_0x3a18('0x18')]=_[_0x3a18('0x19')](config[_0x3a18('0x18')],{'host':_0x3a18('0x1a'),'port':0x18eb});var socket=require(_0x3a18('0x1b'))(new Redis(config[_0x3a18('0x18')]));require('./plugin.socket')[_0x3a18('0x1c')](socket);function respondWithStatusCode(_0xe3876a,_0x1e7489){_0x1e7489=_0x1e7489||0xcc;return function(_0x4872ab){if(_0x4872ab){return _0xe3876a[_0x3a18('0x1d')](_0x1e7489);}return _0xe3876a[_0x3a18('0x1e')](_0x1e7489)['end']();};}function respondWithResult(_0x11bb98,_0x253c74){_0x253c74=_0x253c74||0xc8;return function(_0x505676){if(_0x505676){return _0x11bb98['status'](_0x253c74)['json'](_0x505676);}};}function respondWithFilteredResult(_0xe81a72,_0xaf595c){return function(_0x863756){if(_0x863756){var _0x5ab35d=typeof _0xaf595c[_0x3a18('0x1f')]==='undefined'&&typeof _0xaf595c['limit']===_0x3a18('0x20');var _0x4aa194=_0x863756[_0x3a18('0x21')];var _0x427dae=_0x5ab35d?0x0:_0xaf595c[_0x3a18('0x1f')];var _0x9cc50d=_0x5ab35d?_0x863756[_0x3a18('0x21')]:_0xaf595c[_0x3a18('0x1f')]+_0xaf595c['limit'];var _0x29b025;if(_0x9cc50d>=_0x4aa194){_0x9cc50d=_0x4aa194;_0x29b025=0xc8;}else{_0x29b025=0xce;}_0xe81a72['status'](_0x29b025);return _0xe81a72[_0x3a18('0x22')](_0x3a18('0x23'),_0x427dae+'-'+_0x9cc50d+'/'+_0x4aa194)[_0x3a18('0x24')](_0x863756);}return null;};}function patchUpdates(_0x202026){return function(_0x2943a4){try{jsonpatch[_0x3a18('0x25')](_0x2943a4,_0x202026,!![]);}catch(_0x23c8fb){return BPromise[_0x3a18('0x26')](_0x23c8fb);}return _0x2943a4[_0x3a18('0x27')]();};}function saveUpdates(_0x533fcf,_0x556b15){return function(_0x22715a){if(_0x22715a){return _0x22715a['update'](_0x533fcf)[_0x3a18('0x28')](function(_0x5df1ac){return _0x5df1ac;});}return null;};}function removeEntity(_0x40f678,_0x35737c){return function(_0x5133a5){if(_0x5133a5){return _0x5133a5[_0x3a18('0x29')]()[_0x3a18('0x28')](function(){var _0x34cd50=_0x5133a5[_0x3a18('0x2a')]({'plain':!![]});var _0xbb6caa=_0x3a18('0x2b');return db[_0x3a18('0x2c')][_0x3a18('0x29')]({'where':{'type':_0xbb6caa,'resourceId':_0x34cd50['id']}})[_0x3a18('0x28')](function(){return _0x5133a5;});})[_0x3a18('0x28')](function(){_0x40f678['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f54d9,_0x1ef002){return function(_0x5de1f9){if(!_0x5de1f9){_0x4f54d9[_0x3a18('0x1d')](0x194);}return _0x5de1f9;};}function handleError(_0x1ebfa1,_0x50f0fc){_0x50f0fc=_0x50f0fc||0x1f4;return function(_0x2d9cca){logger[_0x3a18('0x2d')](_0x2d9cca[_0x3a18('0x2e')]);if(_0x2d9cca[_0x3a18('0x2f')]){delete _0x2d9cca[_0x3a18('0x2f')];}_0x1ebfa1[_0x3a18('0x1e')](_0x50f0fc)[_0x3a18('0x30')](_0x2d9cca);};}exports['index']=function(_0x131ce8,_0x22464d){var _0x13075c={},_0x31e5a8={},_0x125507={'count':0x0,'rows':[]};var _0x7e9797=_[_0x3a18('0x31')](db['Plugin'][_0x3a18('0x32')],function(_0x512cb7){return{'name':_0x512cb7[_0x3a18('0x33')],'type':_0x512cb7[_0x3a18('0x34')][_0x3a18('0x35')]};});_0x31e5a8[_0x3a18('0x36')]=_['map'](_0x7e9797,'name');_0x31e5a8[_0x3a18('0x37')]=_['keys'](_0x131ce8[_0x3a18('0x37')]);_0x31e5a8['filters']=_[_0x3a18('0x38')](_0x31e5a8['model'],_0x31e5a8[_0x3a18('0x37')]);_0x13075c[_0x3a18('0x39')]=_[_0x3a18('0x38')](_0x31e5a8[_0x3a18('0x36')],qs[_0x3a18('0x3a')](_0x131ce8[_0x3a18('0x37')][_0x3a18('0x3a')]));_0x13075c[_0x3a18('0x39')]=_0x13075c[_0x3a18('0x39')][_0x3a18('0x3b')]?_0x13075c[_0x3a18('0x39')]:_0x31e5a8[_0x3a18('0x36')];if(!_0x131ce8['query'][_0x3a18('0x3c')]('nolimit')){_0x13075c[_0x3a18('0x3d')]=qs[_0x3a18('0x3d')](_0x131ce8[_0x3a18('0x37')]['limit']);_0x13075c['offset']=qs[_0x3a18('0x1f')](_0x131ce8[_0x3a18('0x37')][_0x3a18('0x1f')]);}_0x13075c['order']=qs[_0x3a18('0x3e')](_0x131ce8[_0x3a18('0x37')][_0x3a18('0x3e')]);_0x13075c['where']=qs['filters'](_[_0x3a18('0x3f')](_0x131ce8[_0x3a18('0x37')],_0x31e5a8['filters']),_0x7e9797);if(_0x131ce8['query'][_0x3a18('0x40')]){_0x13075c[_0x3a18('0x41')]=_[_0x3a18('0x42')](_0x13075c[_0x3a18('0x41')],{'$or':_[_0x3a18('0x31')](_0x7e9797,function(_0x562212){if(_0x562212['type']!==_0x3a18('0x43')){var _0x413876={};_0x413876[_0x562212['name']]={'$like':'%'+_0x131ce8[_0x3a18('0x37')][_0x3a18('0x40')]+'%'};return _0x413876;}})});}_0x13075c=_['merge']({},_0x13075c,_0x131ce8[_0x3a18('0x44')]);var _0x3898ae={'where':_0x13075c[_0x3a18('0x41')]};return db[_0x3a18('0x45')]['count'](_0x3898ae)[_0x3a18('0x28')](function(_0xc54653){_0x125507['count']=_0xc54653;if(_0x131ce8[_0x3a18('0x37')][_0x3a18('0x46')]){_0x13075c[_0x3a18('0x47')]=[{'all':!![]}];}return db[_0x3a18('0x45')][_0x3a18('0x48')](_0x13075c);})[_0x3a18('0x28')](function(_0x1d3dc7){_0x125507[_0x3a18('0x49')]=_0x1d3dc7;return _0x125507;})[_0x3a18('0x28')](respondWithFilteredResult(_0x22464d,_0x13075c))[_0x3a18('0x4a')](handleError(_0x22464d,null));};exports[_0x3a18('0x4b')]=function(_0x4f9655,_0x346cd9){var _0x2ec911={'raw':!![],'where':{'id':_0x4f9655['params']['id']}},_0xf5f798={};_0xf5f798['model']=_[_0x3a18('0x4c')](db[_0x3a18('0x45')]['rawAttributes']);_0xf5f798['query']=_['keys'](_0x4f9655[_0x3a18('0x37')]);_0xf5f798[_0x3a18('0x4d')]=_[_0x3a18('0x38')](_0xf5f798[_0x3a18('0x36')],_0xf5f798[_0x3a18('0x37')]);_0x2ec911['attributes']=_[_0x3a18('0x38')](_0xf5f798[_0x3a18('0x36')],qs[_0x3a18('0x3a')](_0x4f9655[_0x3a18('0x37')][_0x3a18('0x3a')]));_0x2ec911[_0x3a18('0x39')]=_0x2ec911[_0x3a18('0x39')]['length']?_0x2ec911['attributes']:_0xf5f798[_0x3a18('0x36')];if(_0x4f9655[_0x3a18('0x37')][_0x3a18('0x46')]){_0x2ec911[_0x3a18('0x47')]=[{'all':!![]}];}_0x2ec911=_[_0x3a18('0x42')]({},_0x2ec911,_0x4f9655[_0x3a18('0x44')]);return db[_0x3a18('0x45')][_0x3a18('0x4e')](_0x2ec911)['then'](handleEntityNotFound(_0x346cd9,null))[_0x3a18('0x28')](respondWithResult(_0x346cd9,null))[_0x3a18('0x4a')](handleError(_0x346cd9,null));};exports[_0x3a18('0x4f')]=function(_0x448e67,_0x5195aa,_0x4cc867){return db[_0x3a18('0x45')][_0x3a18('0x4e')]({'where':{'id':_0x448e67[_0x3a18('0x50')]['id']},'attributes':['name',_0x3a18('0x5')],'raw':!![]})[_0x3a18('0x28')](handleEntityNotFound(_0x5195aa,null))[_0x3a18('0x28')](function(_0x2714fb){if(_0x2714fb){var _0x260394=path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),util['format']('%s.zip',path[_0x3a18('0x54')](_0x2714fb[_0x3a18('0x5')])));var _0x1e2d1f=fs[_0x3a18('0x55')](_0x260394);var _0x277f9d=archiver('zip',{'zlib':{'level':0x9}});_0x277f9d['on'](_0x3a18('0x56'),function(_0x50600a){if(_0x50600a[_0x3a18('0x57')]===_0x3a18('0x58')){logger['error'](_0x50600a);}else{throw new db[(_0x3a18('0x59'))][(_0x3a18('0x5a'))](_0x3a18('0x5b'));}});_0x277f9d['on'](_0x3a18('0x2d'),function(_0x4ece2a){throw new db[(_0x3a18('0x59'))][(_0x3a18('0x5a'))](_0x3a18('0x5b'));});_0x277f9d[_0x3a18('0x5c')](_0x1e2d1f);_0x277f9d[_0x3a18('0x5d')]('**/*',{'cwd':path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),path['dirname'](_0x2714fb['path'])),'ignore':[path['join'](path['basename'](_0x2714fb[_0x3a18('0x5')]),_0x3a18('0x5e')),path[_0x3a18('0x51')](path[_0x3a18('0x54')](_0x2714fb[_0x3a18('0x5')]),_0x3a18('0x5f'))],'nodir':!![]})[_0x3a18('0x60')]();_0x1e2d1f['on'](_0x3a18('0x61'),function(){if(!fs['existsSync'](_0x260394)){throw new db['Sequelize'][(_0x3a18('0x5a'))](_0x3a18('0x62'));}return _0x5195aa[_0x3a18('0x4f')](_0x260394,util['format'](_0x3a18('0x63'),path[_0x3a18('0x54')](_0x2714fb[_0x3a18('0x5')])),function(_0x46f2fa){if(_0x46f2fa){throw new db[(_0x3a18('0x59'))]['Error'](_0x3a18('0x64'));}fs[_0x3a18('0x65')](_0x260394);logger['info']('Download\x20completed');logger['info'](_0x3a18('0x66'));});});}return null;})['catch'](handleError(_0x5195aa,null));};exports[_0x3a18('0x67')]=function(_0x3dd8b4,_0x27399c,_0x24c636){var _0x3d9ae=path[_0x3a18('0x54')](_0x3dd8b4['file']['filename'],path[_0x3a18('0x68')](_0x3dd8b4[_0x3a18('0x69')][_0x3a18('0x6a')]));var _0x285a12=path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),_0x3dd8b4[_0x3a18('0x69')]['filename']);var _0x1564b7=path[_0x3a18('0x51')](config['root'],_0x3a18('0x53'),_0x3d9ae);logger[_0x3a18('0x6b')](_0x3a18('0x6c'),_0x285a12);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x1564b7);try{fs[_0x3a18('0x6d')](_0x285a12,parseInt(_0x3a18('0x6e'),0x8));extract(_0x285a12,{'dir':_0x1564b7},function(_0x42817c){if(_0x42817c){logger[_0x3a18('0x2d')](_0x42817c);handleError(_0x42817c,!![]);};var _0x20c4f2=fs[_0x3a18('0x6f')](_0x1564b7);if(_0x20c4f2[_0x3a18('0x3b')]>0x1){removeReferences(_0x285a12,_0x1564b7);logger[_0x3a18('0x2d')]('Invalid\x20plugin\x20structure');return _0x24c636(new Error(_0x3a18('0x70')));}var _0x331e31=fs['lstatSync'](path[_0x3a18('0x51')](_0x1564b7,_0x20c4f2[0x0]));if(_0x331e31[_0x3a18('0x71')]()){removeReferences(_0x285a12,_0x1564b7);logger['error'](_0x3a18('0x70'));return _0x24c636(new Error('Invalid\x20plugin\x20structure'));}if(_0x331e31[_0x3a18('0x72')]()){var _0x47bf4a=fs[_0x3a18('0x6f')](path[_0x3a18('0x51')](_0x1564b7,_0x20c4f2[0x0]));if(_0x47bf4a[_0x3a18('0x3b')]===0x0){removeReferences(_0x285a12,_0x1564b7);logger[_0x3a18('0x2d')](_0x3a18('0x70'));return _0x24c636(new Error(_0x3a18('0x70')));}var _0x35ffec=_0x47bf4a['some'](function(_0x147d4b){return _0x147d4b===_0x3a18('0x73');});if(!_0x35ffec){return _0x24c636(new Error('Plugin\x20manifest\x20missing'));}var _0x2e225f=fs[_0x3a18('0x74')](path[_0x3a18('0x51')](_0x1564b7,_0x20c4f2[0x0],_0x3a18('0x73')));var _0x2f1231=JSON[_0x3a18('0x75')](_0x2e225f);if('undefined'==typeof _0x2f1231[_0x3a18('0x2f')]){return _0x24c636(new Error(_0x3a18('0x76')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x34')]){return _0x24c636(new Error(_0x3a18('0x77')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x78')]){return _0x24c636(new Error(_0x3a18('0x79')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')]){return _0x24c636(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2f1231[_0x3a18('0x34')]===_0x3a18('0x7b')){if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')]){return _0x24c636(new Error(_0x3a18('0x7d')));}if('undefined'==typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7e')]&&_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')]['views'][_0x3a18('0x7f')]){return _0x24c636(new Error(_0x3a18('0x80')));}}else if(_0x2f1231[_0x3a18('0x34')]===_0x3a18('0x81')){if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')]['scriptName']){return _0x24c636(new Error(_0x3a18('0x82')));}if(_0x3a18('0x20')==typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x83')]){return _0x24c636(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x24c636(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5480d7=_0x2f1231['name'];var _0xa7dcf4=_0x2f1231['description'];var _0x17fbb7=_0x2f1231[_0x3a18('0x34')];var _0x3578ed=_0x2f1231['sidebar']?_0x2f1231[_0x3a18('0x84')]:_0x3a18('0x85');var _0x5e3253=_0x2f1231[_0x3a18('0x86')]?_0x2f1231[_0x3a18('0x86')]:_0x3a18('0x87');var _0x3b691a='';var _0x3406dd='';var _0x1a43da='';var _0x5c689c='';var _0x194baa=_0x2f1231[_0x3a18('0x78')];if(_0x17fbb7==='html'){if(_0x3a18('0x20')!=typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7e')]){var _0x6f01f3=_0x2f1231['parameters'][_0x3a18('0x7c')][_0x3a18('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x6f01f3)){_0x3b691a=path[_0x3a18('0x51')]('plugins',_0x3d9ae,_0x20c4f2[0x0],_0x6f01f3);}else{_0x3b691a=_0x6f01f3;}}else{logger[_0x3a18('0x6b')](_0x3a18('0x89'));}if(_0x3a18('0x20')!=typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7f')]){var _0x20a35c=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x20a35c)){_0x3406dd=path['join']('plugins',_0x3d9ae,_0x20c4f2[0x0],_0x20a35c);}else{_0x3406dd=_0x20a35c;}}else{logger[_0x3a18('0x6b')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x17fbb7===_0x3a18('0x81')){_0x1a43da=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x8a')];_0x5c689c=_0x2f1231[_0x3a18('0x7a')]['scriptPath'];if(_0x3a18('0x20')!=typeof _0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')]){if('undefined'!=typeof _0x2f1231['parameters'][_0x3a18('0x7c')]['admin']){var _0x6f01f3=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x6f01f3)){_0x3b691a=path[_0x3a18('0x51')](_0x3a18('0x8b'),_0x3d9ae,_0x20c4f2[0x0],_0x6f01f3);}else{_0x3b691a=_0x6f01f3;}}if(_0x3a18('0x20')!=typeof _0x2f1231['parameters'][_0x3a18('0x7c')][_0x3a18('0x7f')]){var _0x20a35c=_0x2f1231[_0x3a18('0x7a')][_0x3a18('0x7c')][_0x3a18('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3a18('0x88')](_0x20a35c)){_0x3406dd=path[_0x3a18('0x51')](_0x3a18('0x8b'),_0x3d9ae,_0x20c4f2[0x0],_0x20a35c);}else{_0x3406dd=_0x20a35c;}}}}var _0x48d72e={'name':_0x5480d7,'description':_0xa7dcf4,'path':path[_0x3a18('0x51')](_0x3d9ae,_0x20c4f2[0x0]),'type':_0x17fbb7,'sidebar':_0x3578ed,'icon':_0x5e3253,'adminUrl':_0x3b691a,'agentUrl':_0x3406dd,'scriptName':_0x1a43da,'scriptPath':_0x5c689c,'version':_0x194baa};removeReferences(_0x285a12,null);return db[_0x3a18('0x45')][_0x3a18('0x8c')](_0x48d72e)[_0x3a18('0x28')](function(_0x3cba5f){var _0xc33d3e={'role':_0x3dd8b4[_0x3a18('0x8d')][_0x3a18('0x8e')],'userProfileId':_0x3dd8b4[_0x3a18('0x8d')][_0x3a18('0x8f')]};if(!_0xc33d3e)throw new Error(_0x3a18('0x90'));if(_0xc33d3e[_0x3a18('0x8e')]===_0x3a18('0x91')){var _0x4fc6c4=_0x3cba5f['get']({'plain':!![]});return db[_0x3a18('0x92')]['find']({'where':{'name':'Plugins','userProfileId':_0xc33d3e[_0x3a18('0x8f')]},'raw':!![]})[_0x3a18('0x28')](function(_0x174869){if(_0x174869&&_0x174869[_0x3a18('0x93')]===0x0){return db[_0x3a18('0x2c')][_0x3a18('0x8c')]({'name':_0x4fc6c4[_0x3a18('0x2f')],'resourceId':_0x4fc6c4['id'],'type':_0x174869['name'],'sectionId':_0x174869['id']},{})[_0x3a18('0x28')](function(){return _0x3cba5f;});}else{return _0x3cba5f;}})[_0x3a18('0x4a')](function(_0x58af61){logger['error'](_0x3a18('0x94'),_0x58af61);throw _0x58af61;});}return _0x3cba5f;})[_0x3a18('0x28')](respondWithResult(_0x27399c,null))[_0x3a18('0x4a')](handleError(_0x27399c,null));}});}catch(_0x31acb6){_0x27399c['status'](0x1f4)['send'](_0x31acb6);}};function removeReferences(_0x54412d,_0x101403){try{if(_0x54412d){fs[_0x3a18('0x65')](_0x54412d);logger['info'](_0x3a18('0x95'));}if(_0x101403){rimraf(_0x101403,function(){});logger[_0x3a18('0x6b')](_0x3a18('0x96'));}}catch(_0x5740c4){logger[_0x3a18('0x2d')](_0x5740c4);}}exports[_0x3a18('0x97')]=function(_0x3e4de9,_0x42efd3,_0x2dd236){return db[_0x3a18('0x45')][_0x3a18('0x4e')]({'where':{'id':_0x3e4de9[_0x3a18('0x50')]['id']}})['then'](handleEntityNotFound(_0x42efd3,null))[_0x3a18('0x28')](saveUpdates(_0x3e4de9[_0x3a18('0x8d')],null))[_0x3a18('0x28')](respondWithResult(_0x42efd3,null))[_0x3a18('0x4a')](handleError(_0x42efd3,null));};exports['delete']=function(_0x23572f,_0x2c0ca7,_0x2d9f62){return db[_0x3a18('0x45')]['find']({'where':{'id':_0x23572f[_0x3a18('0x50')]['id']}})[_0x3a18('0x28')](function(_0x28eacf){if(_0x28eacf){return _0x28eacf[_0x3a18('0x29')]();}})[_0x3a18('0x28')](function(_0x55c32b){rimraf(path[_0x3a18('0x51')](config[_0x3a18('0x52')],_0x3a18('0x53'),path[_0x3a18('0x98')](_0x55c32b['path'])),function(){});return _0x55c32b;})[_0x3a18('0x28')](handleEntityNotFound(_0x2c0ca7,null))[_0x3a18('0x28')](respondWithStatusCode(_0x2c0ca7,null))['catch'](handleError(_0x2c0ca7,null));};exports[_0x3a18('0x99')]=function(_0x4f397f,_0x235893,_0x4a4246){return BPromise['resolve']()[_0x3a18('0x28')](function(){if(!_0x4f397f[_0x3a18('0x37')][_0x3a18('0x5')]){throw new Error(_0x3a18('0x9a'));}if(!_0x4f397f['query'][_0x3a18('0x9b')]){throw new Error(_0x3a18('0x9c'));}var _0x4d51f7=_0x4f397f[_0x3a18('0x37')]['hostname']?_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9d')]+':'+_0x4f397f['query']['port']:'http://localhost:'+_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9b')];var _0xfb8af4=_0x4f397f[_0x3a18('0x37')][_0x3a18('0x24')]?_0x4f397f[_0x3a18('0x37')][_0x3a18('0x24')]:!![];var _0x4331d7=_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9e')]?_0x4f397f[_0x3a18('0x37')][_0x3a18('0x9e')]:null;var _0x183a8b={'method':_0x4f397f[_0x3a18('0x9f')],'uri':util['format'](_0x3a18('0xa0'),_0x4d51f7,_0x4f397f['query']['path']),'json':_0xfb8af4,'resolveWithFullResponse':!![],'encoding':_0x4331d7,'qs':_0x4f397f['query']};if(_0x4f397f[_0x3a18('0xa1')]){_0x183a8b['headers']=_0x4f397f[_0x3a18('0xa1')];if(_0x183a8b['headers'][_0x3a18('0xa2')]){delete _0x183a8b[_0x3a18('0xa1')][_0x3a18('0xa2')];}}if(_0x183a8b[_0x3a18('0xa1')]['content-type']){delete _0x183a8b[_0x3a18('0xa1')][_0x3a18('0xa3')];}return rp(_0x183a8b);})[_0x3a18('0x28')](function(_0x12db57){if(_0x12db57){_0x235893[_0x3a18('0x22')](_0x12db57[_0x3a18('0xa1')]);logger[_0x3a18('0x6b')](_0x12db57['body']);if(_[_0x3a18('0xa4')](_0x4f397f[_0x3a18('0x37')][_0x3a18('0x5')],_0x3a18('0x4f'))&&_0x12db57[_0x3a18('0xa5')]==0x1f4){return _0x235893[_0x3a18('0x1d')](_0x12db57[_0x3a18('0xa5')]);}else{return _0x235893[_0x3a18('0x1e')](_0x12db57[_0x3a18('0xa5')])[_0x3a18('0x30')](_0x12db57[_0x3a18('0x8d')]);}}else{return _0x235893[_0x3a18('0x1d')](0xc8);}})['catch'](handleError(_0x235893,null));};exports[_0x3a18('0xa6')]=function(_0xc67ba8,_0x392327,_0x13a84b){return BPromise[_0x3a18('0xa7')]()[_0x3a18('0x28')](function(){if(!_0xc67ba8['query'][_0x3a18('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xc67ba8[_0x3a18('0x37')]['port']){throw new Error(_0x3a18('0x9c'));}var _0x144adb=_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9d')]?_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9d')]+':'+_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9b')]:_0x3a18('0xa8')+_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9b')];var _0x5484b0=_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x24')]?_0xc67ba8[_0x3a18('0x37')]['json']:!![];var _0x3c5794=_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x9e')]?_0xc67ba8[_0x3a18('0x37')]['encoding']:null;var _0x460ae6={'method':_0xc67ba8[_0x3a18('0x9f')],'uri':util[_0x3a18('0xa9')](_0x3a18('0xa0'),_0x144adb,_0xc67ba8[_0x3a18('0x37')][_0x3a18('0x5')]),'json':_0x5484b0,'resolveWithFullResponse':!![],'encoding':_0x3c5794,'body':_0xc67ba8['body']};if(_0xc67ba8['headers']){_0x460ae6['headers']=_0xc67ba8[_0x3a18('0xa1')];if(_0x460ae6[_0x3a18('0xa1')]['content-length']){delete _0x460ae6[_0x3a18('0xa1')][_0x3a18('0xa2')];}}if(_0x460ae6[_0x3a18('0xa1')][_0x3a18('0xa3')]){delete _0x460ae6[_0x3a18('0xa1')][_0x3a18('0xa3')];}return rp(_0x460ae6);})['then'](function(_0x2c9ef6){if(_0x2c9ef6){_0x392327[_0x3a18('0x22')](_0x2c9ef6[_0x3a18('0xa1')]);logger[_0x3a18('0x6b')](_0x2c9ef6[_0x3a18('0x8d')]);return _0x392327[_0x3a18('0x1e')](_0x2c9ef6[_0x3a18('0xa5')])[_0x3a18('0x30')](_0x2c9ef6[_0x3a18('0x8d')]);}else{return _0x392327['sendStatus'](0xc8);}})[_0x3a18('0x4a')](handleError(_0x392327,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 9105543..074d009 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 _0x00f0=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x16c1ad,_0x2bc8d1){var _0x227b06=function(_0x86bc0c){while(--_0x86bc0c){_0x16c1ad['push'](_0x16c1ad['shift']());}};_0x227b06(++_0x2bc8d1);}(_0x00f0,0xec));var _0x000f=function(_0x48674d,_0x219e4c){_0x48674d=_0x48674d-0x0;var _0x79792d=_0x00f0[_0x48674d];return _0x79792d;};'use strict';var EventEmitter=require(_0x000f('0x0'));var Plugin=require(_0x000f('0x1'))['db'][_0x000f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x000f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x000f('0x4')};function emitEvent(_0x4c8ce1){return function(_0x3cd8ed,_0x53989d,_0x3a0613){PluginEvents[_0x000f('0x5')](_0x4c8ce1+':'+_0x3cd8ed['id'],_0x3cd8ed);PluginEvents['emit'](_0x4c8ce1,_0x3cd8ed);_0x3a0613(null);};}for(var e in events){if(events[_0x000f('0x6')](e)){var event=events[e];Plugin[_0x000f('0x7')](e,emitEvent(event));}}module[_0x000f('0x8')]=PluginEvents; \ No newline at end of file +var _0x1419=['Plugin','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f0274,_0x2dd966){var _0x188cca=function(_0x28e7b1){while(--_0x28e7b1){_0x2f0274['push'](_0x2f0274['shift']());}};_0x188cca(++_0x2dd966);}(_0x1419,0x127));var _0x9141=function(_0x482690,_0x245d70){_0x482690=_0x482690-0x0;var _0x2f371e=_0x1419[_0x482690];return _0x2f371e;};'use strict';var EventEmitter=require(_0x9141('0x0'));var Plugin=require(_0x9141('0x1'))['db'][_0x9141('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9141('0x3')](0x0);var events={'afterCreate':_0x9141('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x749bf2){return function(_0x16694b,_0x4c1d20,_0x544162){PluginEvents[_0x9141('0x5')](_0x749bf2+':'+_0x16694b['id'],_0x16694b);PluginEvents[_0x9141('0x5')](_0x749bf2,_0x16694b);_0x544162(null);};}for(var e in events){if(events[_0x9141('0x6')](e)){var event=events[e];Plugin[_0x9141('0x7')](e,emitEvent(event));}}module[_0x9141('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5a567e3..e65c1f0 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 _0xd5a3=['define','Plugin','lodash','api','moment','request-promise','path','rimraf'];(function(_0x49b082,_0x24007c){var _0x5806ce=function(_0x1c5acf){while(--_0x1c5acf){_0x49b082['push'](_0x49b082['shift']());}};_0x5806ce(++_0x24007c);}(_0xd5a3,0x6a));var _0x3d5a=function(_0x203cf5,_0x8421e0){_0x203cf5=_0x203cf5-0x0;var _0x17a51d=_0xd5a3[_0x203cf5];return _0x17a51d;};'use strict';var _=require(_0x3d5a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3d5a('0x1'));var moment=require(_0x3d5a('0x2'));var BPromise=require('bluebird');var rp=require(_0x3d5a('0x3'));var fs=require('fs');var path=require(_0x3d5a('0x4'));var rimraf=require(_0x3d5a('0x5'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x5acfaf,_0x798216){return _0x5acfaf[_0x3d5a('0x6')](_0x3d5a('0x7'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66da=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util'];(function(_0x5490ed,_0x31f9ab){var _0x455c7c=function(_0x5819b2){while(--_0x5819b2){_0x5490ed['push'](_0x5490ed['shift']());}};_0x455c7c(++_0x31f9ab);}(_0x66da,0x12a));var _0xa66d=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x66da[_0x9cfe28];return _0x54a1d0;};'use strict';var _=require(_0xa66d('0x0'));var util=require(_0xa66d('0x1'));var logger=require(_0xa66d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa66d('0x3'));var rp=require(_0xa66d('0x4'));var fs=require('fs');var path=require(_0xa66d('0x5'));var rimraf=require(_0xa66d('0x6'));var config=require(_0xa66d('0x7'));var attributes=require(_0xa66d('0x8'));module['exports']=function(_0x20ccde,_0x33ded1){return _0x20ccde[_0xa66d('0x9')](_0xa66d('0xa'),attributes,{'tableName':_0xa66d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index fbf67d8..edc6add 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 _0x323b=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x323b,0x134));var _0xb323=function(_0xe62c69,_0x4c4aad){_0xe62c69=_0xe62c69-0x0;var _0x2b7dac=_0x323b[_0xe62c69];return _0x2b7dac;};'use strict';var _=require(_0xb323('0x0'));var util=require(_0xb323('0x1'));var moment=require(_0xb323('0x2'));var BPromise=require(_0xb323('0x3'));var rs=require(_0xb323('0x4'));var fs=require('fs');var Redis=require(_0xb323('0x5'));var db=require(_0xb323('0x6'))['db'];var utils=require(_0xb323('0x7'));var logger=require('../../config/logger')(_0xb323('0x8'));var config=require(_0xb323('0x9'));var jayson=require(_0xb323('0xa'));var client=jayson['client'][_0xb323('0xb')]({'port':0x232a});config[_0xb323('0xc')]=_[_0xb323('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb323('0xe'))(new Redis(config[_0xb323('0xc')]));require(_0xb323('0xf'))[_0xb323('0x10')](socket);function respondWithRpcPromise(_0x21199b,_0xa417a,_0x46b363){return new BPromise(function(_0x18f53e,_0x166cb0){return client[_0xb323('0x11')](_0x21199b,_0x46b363)[_0xb323('0x12')](function(_0x568e14){logger[_0xb323('0x13')](_0xb323('0x14'),_0xa417a,'request\x20sent');logger[_0xb323('0x15')](_0xb323('0x16'),_0xa417a,'request\x20sent',JSON[_0xb323('0x17')](_0x568e14));if(_0x568e14[_0xb323('0x18')]){if(_0x568e14[_0xb323('0x18')][_0xb323('0x19')]===0x1f4){logger['error'](_0xb323('0x14'),_0xa417a,_0x568e14['error'][_0xb323('0x1a')]);return _0x166cb0(_0x568e14[_0xb323('0x18')][_0xb323('0x1a')]);}logger[_0xb323('0x18')](_0xb323('0x14'),_0xa417a,_0x568e14[_0xb323('0x18')][_0xb323('0x1a')]);return _0x18f53e(_0x568e14[_0xb323('0x18')][_0xb323('0x1a')]);}else{logger[_0xb323('0x13')](_0xb323('0x14'),_0xa417a,_0xb323('0x1b'));_0x18f53e(_0x568e14[_0xb323('0x1c')][_0xb323('0x1a')]);}})[_0xb323('0x1d')](function(_0x1065b9){logger[_0xb323('0x18')](_0xb323('0x14'),_0xa417a,_0x1065b9);_0x166cb0(_0x1065b9);});});}exports[_0xb323('0x1e')]=function(_0x21c40b){var _0x1d6d48=this;return new Promise(function(_0x29d192,_0x216d22){return db[_0xb323('0x1f')][_0xb323('0x20')](_0x21c40b['body'],{'raw':_0x21c40b[_0xb323('0x21')]?_0x21c40b[_0xb323('0x21')][_0xb323('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0xe0f753){logger[_0xb323('0x13')](_0xb323('0x1e'),_0x21c40b);logger[_0xb323('0x15')](_0xb323('0x1e'),_0x21c40b,JSON[_0xb323('0x17')](_0xe0f753));_0x29d192(_0xe0f753);})['catch'](function(_0xa0b341){logger['error'](_0xb323('0x1e'),_0xa0b341[_0xb323('0x1a')],_0x21c40b);_0x216d22(_0x1d6d48[_0xb323('0x18')](0x1f4,_0xa0b341[_0xb323('0x1a')]));});});}; \ No newline at end of file +var _0x6722=['error','code','Plugin,\x20%s,\x20%s','message','result','catch','Plugin','create','body','raw','CreatePlugin','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./plugin.socket','register','request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xda26e1,_0xf2f83a){var _0x442eae=function(_0x1cc252){while(--_0x1cc252){_0xda26e1['push'](_0xda26e1['shift']());}};_0x442eae(++_0xf2f83a);}(_0x6722,0x134));var _0x2672=function(_0xcd9a05,_0x3d7f5e){_0xcd9a05=_0xcd9a05-0x0;var _0x216942=_0x6722[_0xcd9a05];return _0x216942;};'use strict';var _=require(_0x2672('0x0'));var util=require(_0x2672('0x1'));var moment=require(_0x2672('0x2'));var BPromise=require(_0x2672('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2672('0x4'));var db=require(_0x2672('0x5'))['db'];var utils=require(_0x2672('0x6'));var logger=require(_0x2672('0x7'))(_0x2672('0x8'));var config=require('../../config/environment');var jayson=require(_0x2672('0x9'));var client=jayson[_0x2672('0xa')]['http']({'port':0x232a});config[_0x2672('0xb')]=_[_0x2672('0xc')](config[_0x2672('0xb')],{'host':_0x2672('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2672('0xe'))[_0x2672('0xf')](socket);function respondWithRpcPromise(_0x47e26b,_0x966d74,_0x197914){return new BPromise(function(_0x149a66,_0x429764){return client[_0x2672('0x10')](_0x47e26b,_0x197914)[_0x2672('0x11')](function(_0x23d822){logger[_0x2672('0x12')]('Plugin,\x20%s,\x20%s',_0x966d74,'request\x20sent');logger[_0x2672('0x13')](_0x2672('0x14'),_0x966d74,'request\x20sent',JSON[_0x2672('0x15')](_0x23d822));if(_0x23d822[_0x2672('0x16')]){if(_0x23d822[_0x2672('0x16')][_0x2672('0x17')]===0x1f4){logger[_0x2672('0x16')](_0x2672('0x18'),_0x966d74,_0x23d822[_0x2672('0x16')][_0x2672('0x19')]);return _0x429764(_0x23d822['error'][_0x2672('0x19')]);}logger[_0x2672('0x16')](_0x2672('0x18'),_0x966d74,_0x23d822[_0x2672('0x16')]['message']);return _0x149a66(_0x23d822[_0x2672('0x16')][_0x2672('0x19')]);}else{logger[_0x2672('0x12')]('Plugin,\x20%s,\x20%s',_0x966d74,'request\x20sent');_0x149a66(_0x23d822[_0x2672('0x1a')][_0x2672('0x19')]);}})[_0x2672('0x1b')](function(_0x201415){logger[_0x2672('0x16')](_0x2672('0x18'),_0x966d74,_0x201415);_0x429764(_0x201415);});});}exports['CreatePlugin']=function(_0x26ac57){var _0x5a973d=this;return new Promise(function(_0x3ece36,_0x498df6){return db[_0x2672('0x1c')][_0x2672('0x1d')](_0x26ac57[_0x2672('0x1e')],{'raw':_0x26ac57['options']?_0x26ac57['options'][_0x2672('0x1f')]===undefined?!![]:![]:!![]})[_0x2672('0x11')](function(_0x344569){logger[_0x2672('0x12')](_0x2672('0x20'),_0x26ac57);logger[_0x2672('0x13')](_0x2672('0x20'),_0x26ac57,JSON[_0x2672('0x15')](_0x344569));_0x3ece36(_0x344569);})[_0x2672('0x1b')](function(_0x371d6e){logger[_0x2672('0x16')](_0x2672('0x20'),_0x371d6e[_0x2672('0x19')],_0x26ac57);_0x498df6(_0x5a973d[_0x2672('0x16')](0x1f4,_0x371d6e[_0x2672('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b5f9ed6..93fffd1 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 _0xfee0=['remove','update','emit','removeListener','plugin:','./plugin.events','save'];(function(_0x419ffd,_0x10bdfe){var _0xb0b19d=function(_0x335815){while(--_0x335815){_0x419ffd['push'](_0x419ffd['shift']());}};_0xb0b19d(++_0x10bdfe);}(_0xfee0,0x1da));var _0x0fee=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xfee0[_0x1e3c02];return _0x4d26d7;};'use strict';var PluginEvents=require(_0x0fee('0x0'));var events=[_0x0fee('0x1'),_0x0fee('0x2'),_0x0fee('0x3')];function createListener(_0x28b37a,_0x104b1e){return function(_0x124afe){_0x104b1e[_0x0fee('0x4')](_0x28b37a,_0x124afe);};}function removeListener(_0x57094f,_0x50a7df){return function(){PluginEvents[_0x0fee('0x5')](_0x57094f,_0x50a7df);};}exports['register']=function(_0x5299a5){for(var _0x4d1189=0x0,_0x261f37=events['length'];_0x4d1189<_0x261f37;_0x4d1189++){var _0x190073=events[_0x4d1189];var _0x4b74dc=createListener(_0x0fee('0x6')+_0x190073,_0x5299a5);PluginEvents['on'](_0x190073,_0x4b74dc);}}; \ No newline at end of file +var _0xb1ff=['register','length','plugin:','./plugin.events','save','update','emit','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1ff,0xab));var _0xfb1f=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0xb1ff[_0x4f3e5a];return _0x452880;};'use strict';var PluginEvents=require(_0xfb1f('0x0'));var events=[_0xfb1f('0x1'),'remove',_0xfb1f('0x2')];function createListener(_0x27eb7e,_0x11bbfc){return function(_0x3e08ed){_0x11bbfc[_0xfb1f('0x3')](_0x27eb7e,_0x3e08ed);};}function removeListener(_0x560bb4,_0x3c76f0){return function(){PluginEvents[_0xfb1f('0x4')](_0x560bb4,_0x3c76f0);};}exports[_0xfb1f('0x5')]=function(_0x269de7){for(var _0x329435=0x0,_0x39d9ea=events[_0xfb1f('0x6')];_0x329435<_0x39d9ea;_0x329435++){var _0x1df850=events[_0x329435];var _0x51a60d=createListener(_0xfb1f('0x7')+_0x1df850,_0x269de7);PluginEvents['on'](_0x1df850,_0x51a60d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 7fde73f..a5001fa 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(_0x3eca8a,_0x310809){var _0x4f730f=function(_0x3c809b){while(--_0x3c809b){_0x3eca8a['push'](_0x3eca8a['shift']());}};_0x4f730f(++_0x310809);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x343b88,_0x47f481){var _0x466e14=function(_0x9cb9d3){while(--_0x9cb9d3){_0x343b88['push'](_0x343b88['shift']());}};_0x466e14(++_0x47f481);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 65dff29..32e87ec 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 _0x2dae=['stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error'];(function(_0x3acb0f,_0x422e6f){var _0x5bdb4f=function(_0x424444){while(--_0x424444){_0x3acb0f['push'](_0x3acb0f['shift']());}};_0x5bdb4f(++_0x422e6f);}(_0x2dae,0xc3));var _0xe2da=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x2dae[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0xe2da('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var path=require(_0xe2da('0x3'));var exec=require(_0xe2da('0x4'))[_0xe2da('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25b9f2,_0x439b5d){return function(_0x77e45e){if(!_0x77e45e){_0x25b9f2[_0xe2da('0x6')](0x194);;}return _0x77e45e;};}function respondWithResult(_0x523c60,_0x3e3e25){_0x3e3e25=_0x3e3e25||0xc8;return function(_0x89c70b){if(_0x89c70b){return _0x523c60[_0xe2da('0x7')](_0x3e3e25)[_0xe2da('0x8')](_0x89c70b);}return null;};}function handleError(_0x238da3,_0x1c71ea){_0x1c71ea=_0x1c71ea||0x1f4;return function(_0x29960a){logger[_0xe2da('0x9')](_0x29960a[_0xe2da('0xa')]);if(_0x29960a['name']){delete _0x29960a[_0xe2da('0xb')];}_0x238da3[_0xe2da('0x7')](_0x1c71ea)[_0xe2da('0xc')](_0x29960a);};}function execChildProcess(){return new BPromise(function(_0x17086c,_0x3c1309){exec(_0xe2da('0xd'),function(_0x1a29b9,_0x173244,_0x5aab71){logger[_0xe2da('0xe')](_0x173244);logger['info'](_0x5aab71);if(_0x1a29b9){logger[_0xe2da('0x9')](_0x1a29b9);return _0x3c1309(_0x1a29b9);}return _0x17086c(_0x173244);});});}exports[_0xe2da('0xf')]=function(_0x37064e,_0x411b9f){return pm2[_0xe2da('0x10')]()[_0xe2da('0x11')](function(_0x295a86){if(_0x295a86){var _0x48584b=_[_0xe2da('0x12')](_0x295a86,function(_0x5e1702){return _0x5e1702['name']===_0xe2da('0x13')||_0x5e1702[_0xe2da('0xb')]===_0xe2da('0x14');});return{'rows':_0x48584b,'count':_0x48584b['length']};}return null;})[_0xe2da('0x11')](respondWithResult(_0x411b9f,null))[_0xe2da('0x15')](handleError(_0x411b9f,null));};exports[_0xe2da('0x16')]=function(_0x33568f,_0x4e1623){return pm2[_0xe2da('0x17')](_0x33568f[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x4e1623,null))[_0xe2da('0x11')](handleEntityNotFound(_0x4e1623,null))[_0xe2da('0x15')](handleError(_0x4e1623,null));};exports['create']=function(_0x56eeb1,_0x2e16b2){if(_0x56eeb1['body'][_0xe2da('0xb')]&&_0x56eeb1[_0xe2da('0x19')][_0xe2da('0x1a')]){var _0x203d36=path[_0xe2da('0x1b')](__dirname,_0xe2da('0x1c'),_0x56eeb1['body'][_0xe2da('0x1a')]);var _0x53cc4e=process[_0xe2da('0x1d')]();process[_0xe2da('0x1e')](path[_0xe2da('0x1f')](_0x203d36));return execChildProcess()[_0xe2da('0x11')](function(_0x30dea4){process[_0xe2da('0x1e')](_0x53cc4e);return pm2[_0xe2da('0x20')]({'name':_0x56eeb1[_0xe2da('0x19')]['name'],'script':_0x203d36});})[_0xe2da('0x11')](function(_0x357bff){pm2[_0xe2da('0x21')]();return _0x357bff[0x0];})[_0xe2da('0x11')](respondWithResult(_0x2e16b2,0xc9))[_0xe2da('0x15')](handleError(_0x2e16b2,null));}else{return _0x2e16b2[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe2da('0x22')]=function(_0x3e23d7,_0x1dc228){if(_0x3e23d7[_0xe2da('0x19')]['id']){delete _0x3e23d7[_0xe2da('0x19')]['id'];}var _0x2b6c9e={'online':_0xe2da('0x23'),'stopped':_0xe2da('0x24')};if(_0x2b6c9e['hasOwnProperty'](_0x3e23d7['body']['status'])){return pm2[_0x2b6c9e[_0x3e23d7[_0xe2da('0x19')][_0xe2da('0x7')]]](_0x3e23d7[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x1dc228,0xc8))['catch'](handleError(_0x1dc228,null));}else{return _0x1dc228['status'](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x25')});}};exports[_0xe2da('0x26')]=function(_0x39f983,_0x7ab5ee){if(_0x39f983[_0xe2da('0x19')]['id']){delete _0x39f983[_0xe2da('0x19')]['id'];}if(_0x39f983[_0xe2da('0x18')]['id']){return pm2[_0xe2da('0x27')](_0x39f983['params']['id'])['then'](function(_0x672767){pm2[_0xe2da('0x21')]();return _0x672767[0x0];})[_0xe2da('0x11')](respondWithResult(_0x7ab5ee,null))[_0xe2da('0x15')](handleError(_0x7ab5ee,null));}else{return _0x7ab5ee[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x28')});}}; \ No newline at end of file +var _0x878f=['dirname','start','dump','restart','stop','hasOwnProperty','params','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','name','info','index','then','express','motion2','length','catch','show','describe','create','body','script','../../files/plugins','cwd','chdir'];(function(_0x47aba8,_0x3c58f7){var _0xfae151=function(_0x3485e3){while(--_0x3485e3){_0x47aba8['push'](_0x47aba8['shift']());}};_0xfae151(++_0x3c58f7);}(_0x878f,0x173));var _0xf878=function(_0x3f118e,_0x2bc76a){_0x3f118e=_0x3f118e-0x0;var _0x490cc3=_0x878f[_0x3f118e];return _0x490cc3;};'use strict';var _=require('lodash');var pm2=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var path=require(_0xf878('0x3'));var exec=require(_0xf878('0x4'))[_0xf878('0x5')];var BPromise=require(_0xf878('0x6'));function handleEntityNotFound(_0x45a37b,_0x240b48){return function(_0xcf1927){if(!_0xcf1927){_0x45a37b[_0xf878('0x7')](0x194);;}return _0xcf1927;};}function respondWithResult(_0x4bc9aa,_0x4ac8d8){_0x4ac8d8=_0x4ac8d8||0xc8;return function(_0x3c5f5c){if(_0x3c5f5c){return _0x4bc9aa[_0xf878('0x8')](_0x4ac8d8)['json'](_0x3c5f5c);}return null;};}function handleError(_0x52851e,_0x530767){_0x530767=_0x530767||0x1f4;return function(_0x3329df){logger['error'](_0x3329df['stack']);if(_0x3329df[_0xf878('0x9')]){delete _0x3329df[_0xf878('0x9')];}_0x52851e[_0xf878('0x8')](_0x530767)['send'](_0x3329df);};}function execChildProcess(){return new BPromise(function(_0xb2863e,_0x1399a3){exec('npm\x20install',function(_0xdf76,_0x4f7e7f,_0x31d3d2){logger[_0xf878('0xa')](_0x4f7e7f);logger[_0xf878('0xa')](_0x31d3d2);if(_0xdf76){logger['error'](_0xdf76);return _0x1399a3(_0xdf76);}return _0xb2863e(_0x4f7e7f);});});}exports[_0xf878('0xb')]=function(_0x38eddf,_0x39b1bb){return pm2['list']()[_0xf878('0xc')](function(_0x3902f7){if(_0x3902f7){var _0x119e9e=_['reject'](_0x3902f7,function(_0x568a3a){return _0x568a3a[_0xf878('0x9')]===_0xf878('0xd')||_0x568a3a[_0xf878('0x9')]===_0xf878('0xe');});return{'rows':_0x119e9e,'count':_0x119e9e[_0xf878('0xf')]};}return null;})[_0xf878('0xc')](respondWithResult(_0x39b1bb,null))[_0xf878('0x10')](handleError(_0x39b1bb,null));};exports[_0xf878('0x11')]=function(_0x3c5dee,_0x3a55f3){return pm2[_0xf878('0x12')](_0x3c5dee['params']['id'])[_0xf878('0xc')](respondWithResult(_0x3a55f3,null))[_0xf878('0xc')](handleEntityNotFound(_0x3a55f3,null))[_0xf878('0x10')](handleError(_0x3a55f3,null));};exports[_0xf878('0x13')]=function(_0x3714f6,_0x237d15){if(_0x3714f6[_0xf878('0x14')]['name']&&_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]){var _0x250f85=path['join'](__dirname,_0xf878('0x16'),_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]);var _0x392822=process[_0xf878('0x17')]();process[_0xf878('0x18')](path[_0xf878('0x19')](_0x250f85));return execChildProcess()[_0xf878('0xc')](function(_0x212436){process[_0xf878('0x18')](_0x392822);return pm2[_0xf878('0x1a')]({'name':_0x3714f6['body'][_0xf878('0x9')],'script':_0x250f85});})['then'](function(_0xa3d3d3){pm2[_0xf878('0x1b')]();return _0xa3d3d3[0x0];})[_0xf878('0xc')](respondWithResult(_0x237d15,0xc9))[_0xf878('0x10')](handleError(_0x237d15,null));}else{return _0x237d15[_0xf878('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x242926,_0x3baba4){if(_0x242926[_0xf878('0x14')]['id']){delete _0x242926['body']['id'];}var _0xfa3e11={'online':_0xf878('0x1c'),'stopped':_0xf878('0x1d')};if(_0xfa3e11[_0xf878('0x1e')](_0x242926[_0xf878('0x14')]['status'])){return pm2[_0xfa3e11[_0x242926['body'][_0xf878('0x8')]]](_0x242926[_0xf878('0x1f')]['id'])['then'](respondWithResult(_0x3baba4,0xc8))[_0xf878('0x10')](handleError(_0x3baba4,null));}else{return _0x3baba4['status'](0x1f4)[_0xf878('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf878('0x21')]=function(_0x49e66a,_0x2630fb){if(_0x49e66a['body']['id']){delete _0x49e66a[_0xf878('0x14')]['id'];}if(_0x49e66a[_0xf878('0x1f')]['id']){return pm2[_0xf878('0x22')](_0x49e66a[_0xf878('0x1f')]['id'])[_0xf878('0xc')](function(_0x716782){pm2['dump']();return _0x716782[0x0];})[_0xf878('0xc')](respondWithResult(_0x2630fb,null))[_0xf878('0x10')](handleError(_0x2630fb,null));}else{return _0x2630fb[_0xf878('0x8')](0x1f4)[_0xf878('0x20')]({'message':_0xf878('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3070d2a..081c017 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 _0x0bfa=['isAuthenticated','exports','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues'];(function(_0x59f16b,_0xb4de5c){var _0x4f13e4=function(_0x2c11e5){while(--_0x2c11e5){_0x59f16b['push'](_0x59f16b['shift']());}};_0x4f13e4(++_0xb4de5c);}(_0x0bfa,0xe3));var _0xa0bf=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x0bfa[_0x599f41];return _0x2e4d58;};'use strict';var express=require('express');var router=express[_0xa0bf('0x0')]();var auth=require(_0xa0bf('0x1'));var controller=require(_0xa0bf('0x2'));router[_0xa0bf('0x3')](_0xa0bf('0x4'),auth['isAuthenticated'](),controller[_0xa0bf('0x5')]);router[_0xa0bf('0x3')](_0xa0bf('0x6'),auth[_0xa0bf('0x7')](),controller['getQueues']);module[_0xa0bf('0x8')]=router; \ No newline at end of file +var _0x0194=['get','isAuthenticated','getAgents','getQueues','Router','../../components/auth/service','./realtime.controller'];(function(_0x5781b9,_0x33c197){var _0x81dfb5=function(_0x22664f){while(--_0x22664f){_0x5781b9['push'](_0x5781b9['shift']());}};_0x81dfb5(++_0x33c197);}(_0x0194,0x185));var _0x4019=function(_0x39de23,_0x67e006){_0x39de23=_0x39de23-0x0;var _0x2698a7=_0x0194[_0x39de23];return _0x2698a7;};'use strict';var express=require('express');var router=express[_0x4019('0x0')]();var auth=require(_0x4019('0x1'));var controller=require(_0x4019('0x2'));router[_0x4019('0x3')]('/agents',auth[_0x4019('0x4')](),controller[_0x4019('0x5')]);router[_0x4019('0x3')]('/queues',auth[_0x4019('0x4')](),controller[_0x4019('0x6')]);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 bb51cd6..6818354 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 _0x2329=['../../config/utils','../../errors/api','handleError','offset','undefined','limit','count','status','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','type','key','role','getOptions','raw','sequelize','FIELD(id,','push','Pause','where','merge','user','userProfileId','Agents','agent','online','extraQueryConditions','assign','getResources','findAndCountAll','rows','find','includes','forEach','voice','voiceStatus','Status','sortAgentsByStatus','map','pick','startCase','rawAttributes','fieldName','name','outbound','dialActive','UserProfile','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs'];(function(_0x4b795a,_0x399b29){var _0x41c840=function(_0x2c1171){while(--_0x2c1171){_0x4b795a['push'](_0x4b795a['shift']());}};_0x41c840(++_0x399b29);}(_0x2329,0x99));var _0x9232=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2329[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9232('0x0'));var util=require(_0x9232('0x1'));var rta=require(_0x9232('0x2'));var rtq=require(_0x9232('0x3'));var qs=require(_0x9232('0x4'));var utils=require(_0x9232('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x9232('0x6'))['APIBadRequestError'];var APIHandleError=require(_0x9232('0x6'))[_0x9232('0x7')];function respondWithFilteredResult(_0xc4d0fe,_0x200666){return function(_0x488884){if(_0x488884){var _0x40be87=typeof _0x200666[_0x9232('0x8')]===_0x9232('0x9')&&typeof _0x200666[_0x9232('0xa')]==='undefined';var _0x1f3a09=_0x488884[_0x9232('0xb')];var _0x33136f=_0x40be87?0x0:_0x200666[_0x9232('0x8')];var _0x5b5d91=_0x40be87?_0x488884[_0x9232('0xb')]:_0x200666[_0x9232('0x8')]+_0x200666[_0x9232('0xa')];var _0x3905b1;if(_0x5b5d91>=_0x1f3a09){_0x5b5d91=_0x1f3a09;_0x3905b1=0xc8;}else{_0x3905b1=0xce;}_0xc4d0fe[_0x9232('0xc')](_0x3905b1);return _0xc4d0fe['set']('Content-Range',_0x33136f+'-'+_0x5b5d91+'/'+_0x1f3a09)['json'](_0x488884);}return null;};}exports[_0x9232('0xd')]=function(_0x3891f6,_0x1cae81){var _0x346d63={'count':0x0,'rows':[]};var _0xbb0f12={};var _0x41d363;var _0x5a4fe8=utils[_0x9232('0xe')]();var _0x3efef8;var _0x214ca4;var _0x14b37c=_0x3891f6[_0x9232('0xf')][_0x9232('0x10')];var _0x5e5b3c=_0x3891f6[_0x9232('0xf')][_0x9232('0x11')];var _0x1c26ef=_0x3891f6[_0x9232('0xf')][_0x9232('0x12')];var _0x3084b8=_0x5e5b3c===_0x9232('0x13')||_0x5e5b3c===_0x9232('0x14')?!![]:![];var _0x2e6fb7=[];var _0x1af131;var _0x3a5a37;Promise[_0x9232('0x15')]()[_0x9232('0x16')](function(){if(_0x3891f6[_0x9232('0xf')][_0x9232('0x17')]){if(!utils[_0x9232('0x18')](_0x3891f6['query'][_0x9232('0x17')])){throw new APIBadRequestError(util[_0x9232('0x19')](_0x9232('0x1a'),_0x3891f6[_0x9232('0xf')]['channel']));}_0x41d363=_0x3891f6[_0x9232('0xf')][_0x9232('0x17')][_0x9232('0x1b')]();}if(!_0x3891f6[_0x9232('0xf')][_0x9232('0x1c')]||!_0x3891f6['query'][_0x9232('0x1c')]['includes'](_0x9232('0x1d'))){_0x3891f6[_0x9232('0xf')][_0x9232('0x1c')]=rta[_0x9232('0x1e')](_0x3891f6['query'][_0x9232('0x1c')]);return;}var _0x1c2023=rta[_0x9232('0x1f')](_0x3891f6['query'][_0x9232('0x1c')]);_0x3891f6[_0x9232('0xf')][_0x9232('0x1c')]=_0x1c2023[_0x9232('0x20')][_0x9232('0x21')](',');_0x1af131=_0x1c2023[_0x9232('0x22')];})[_0x9232('0x16')](function(){if(!_0x14b37c){return[];}return rta[_0x9232('0x23')](_0x14b37c,_0x41d363);})[_0x9232('0x16')](function(_0x3f3519){_0x2e6fb7=_0x3f3519;return rta[_0x9232('0x24')]();})[_0x9232('0x16')](function(_0x2b1400){_0x214ca4=_0x2b1400['rows'];if((!_0x5e5b3c||_0x3084b8)&&!_0x1af131){return _0x2e6fb7;}if(_0x1af131&&!_0x5e5b3c){return rta[_0x9232('0x25')](_0x214ca4,_0x2e6fb7,_0x1af131);}else{return rta[_0x9232('0x26')](_0x214ca4,_0x2e6fb7,_0x5e5b3c);}})['then'](function(_0x3ac1ff){_0x2e6fb7=_0x3ac1ff;var _0xff74d5=![];if(_0x2e6fb7[_0x9232('0x27')]===0x0){if(_0x14b37c||_0x5e5b3c){_0xff74d5=!![];}if(_0x3084b8){_0xff74d5=![];}}if(_0xff74d5){return _0x346d63;}var _0x2f52e6=_['map'](db['User']['rawAttributes'],function(_0x4ef997){return{'name':_0x4ef997['fieldName'],'type':_0x4ef997[_0x9232('0x28')][_0x9232('0x29')]};});_0x3891f6[_0x9232('0xf')][_0x9232('0x2a')]='agent';_0xbb0f12=qs[_0x9232('0x2b')](_0x2f52e6,_0x3891f6);_0xbb0f12[_0x9232('0x2c')]=!![];var _0xcc2661=[];if(_0x2e6fb7['length']>0x0){_0xcc2661['push']({'id':{'$in':_0x2e6fb7}});if(_0x1af131&&!_0x5e5b3c){_0x3a5a37=[db[_0x9232('0x2d')]['literal'](_0x9232('0x2e')+_0x2e6fb7+')')];_0xbb0f12[_0x9232('0x22')]=_0x3a5a37;}}if(_0x3084b8){_0x5a4fe8['forEach'](function(_0x5212da){var _0x1dd7d3=!![];if(_0x5e5b3c===_0x9232('0x14')&&_0x41d363!==_0x5212da){_0x1dd7d3=![];}_0xcc2661[_0x9232('0x2f')]({[_0x5212da+_0x9232('0x30')]:_0x1dd7d3});});if(_0x1c26ef){_0xcc2661[_0x9232('0x2f')]({'pauseType':_0x1c26ef});}}else if(_0x5e5b3c){_0x5a4fe8['forEach'](function(_0x10b698){_0xcc2661['push']({[_0x10b698+_0x9232('0x30')]:![]});});}_0xbb0f12[_0x9232('0x31')]=_[_0x9232('0x32')](_0xbb0f12[_0x9232('0x31')],{'$and':_0xcc2661});if(_0x3891f6[_0x9232('0x33')][_0x9232('0x2a')]===_0x9232('0x33')){var _0x4beb38={'params':{'id':_0x3891f6[_0x9232('0x33')][_0x9232('0x34')]},'query':{'section':_0x9232('0x35'),'role':_0x9232('0x36'),'raw':!![],'ids':_0x2e6fb7,'customSorting':_0x3a5a37}};if(_0x3891f6[_0x9232('0xf')][_0x9232('0x37')]){_0x4beb38['query']['online']=!![];}if(_0x3084b8){_0x4beb38[_0x9232('0xf')][_0x9232('0x38')]=_0xcc2661;}_0x4beb38[_0x9232('0xf')]=Object[_0x9232('0x39')](_0x4beb38[_0x9232('0xf')],_0x3891f6[_0x9232('0xf')]);return db['UserProfile'][_0x9232('0x3a')](_0x4beb38);}return db['User'][_0x9232('0x3b')](_0xbb0f12);})[_0x9232('0x16')](function(_0x389b92){_0x346d63[_0x9232('0xb')]=_0x389b92[_0x9232('0xb')];_0x3efef8=_0x389b92[_0x9232('0x3c')];return _0x3efef8['map'](function(_0x1e2b4a){var _0x408e74=_[_0x9232('0x3d')](_0x214ca4,['id',_0x1e2b4a['id']]);if(_0x408e74){var _0x31c806=rta['filterAgentAttributes'](_0x408e74);_[_0x9232('0x32')](_0x1e2b4a,_0x31c806);}_0x1e2b4a[_0x9232('0x1d')]=rta['getAgentStatus'](_0x1e2b4a);if(_0x1e2b4a['globalStatus'][_0x9232('0x3e')](_0x9232('0x13'))){_0x5a4fe8[_0x9232('0x3f')](function(_0x2a0cb7){if(_0x1e2b4a[_0x2a0cb7+_0x9232('0x30')]){if(_0x2a0cb7===_0x9232('0x40')){if(_0x1e2b4a[_0x9232('0x41')]!=='talking'){_0x1e2b4a[_0x9232('0x41')]=_0x9232('0x13');}}else{_0x1e2b4a[_0x2a0cb7+_0x9232('0x42')]=_0x9232('0x13');}}});}return _0x1e2b4a;});})[_0x9232('0x16')](function(_0x34c9c3){if(!_0x1af131||_0x3a5a37){return _0x34c9c3;}return rta[_0x9232('0x43')](_0x34c9c3,_0x1af131);})[_0x9232('0x16')](function(_0x5307d0){var _0x10dac9=rta['getRealtimeAgentsQueryFields']();_0x346d63[_0x9232('0x3c')]=_0x5307d0[_0x9232('0x44')](function(_0x30fbff){return _[_0x9232('0x45')](_0x30fbff,_0x10dac9);});return _0x346d63;})[_0x9232('0x16')](respondWithFilteredResult(_0x1cae81,_0xbb0f12))['catch'](APIHandleError(_0x1cae81));};exports['getQueues']=function(_0x21992e,_0x8d478e){var _0x521165={'count':0x0,'rows':[]};var _0x3b9a70={};var _0xbd725b;var _0x3c56ba;var _0x533ece;Promise[_0x9232('0x15')]()[_0x9232('0x16')](function(){if(_0x21992e[_0x9232('0xf')][_0x9232('0x17')]){if(!utils[_0x9232('0x18')](_0x21992e[_0x9232('0xf')][_0x9232('0x17')])){throw new APIBadRequestError(util[_0x9232('0x19')](_0x9232('0x1a'),_0x21992e[_0x9232('0xf')][_0x9232('0x17')]));}_0xbd725b=_0x21992e['query'][_0x9232('0x17')][_0x9232('0x1b')]();}var _0x562197=_[_0x9232('0x46')](_0xbd725b)+'Queue';var _0x3ac6ba=_[_0x9232('0x44')](db[_0x562197][_0x9232('0x47')],function(_0xc09410){return{'name':_0xc09410[_0x9232('0x48')],'type':_0xc09410[_0x9232('0x28')][_0x9232('0x29')]};});if(!_0x21992e['query']['fields']){var _0x45ea06=['id',_0x9232('0x49')];if(_0xbd725b===_0x9232('0x40')){_0x45ea06[_0x9232('0x2f')](_0x9232('0x28'));if(_0x21992e['query'][_0x9232('0x28')]===_0x9232('0x4a')){_0x45ea06['push']([_0x9232('0x4b'),'dialMethod']);}}_0x21992e[_0x9232('0xf')][_0x9232('0x20')]=_0x45ea06[_0x9232('0x21')](',');}_0x3b9a70=qs['getOptions'](_0x3ac6ba,_0x21992e);if(_0x21992e['user']['role']===_0x9232('0x33')){var _0x25d871={'params':{'id':_0x21992e[_0x9232('0x33')][_0x9232('0x34')]},'query':{'section':_0xbd725b===_0x9232('0x40')&&_0x21992e['query']['type']===_0x9232('0x4a')?'QueueCampaigns':_[_0x9232('0x46')](_0xbd725b)+'Queues','type':_0x21992e[_0x9232('0xf')][_0x9232('0x28')],'nolimit':!![],'sort':'name','filter':_0x21992e['query']['filter']}};_0x25d871[_0x9232('0xf')]=Object[_0x9232('0x39')](_0x25d871[_0x9232('0xf')],_0x21992e[_0x9232('0xf')]);delete _0x25d871[_0x9232('0xf')]['id'];return db[_0x9232('0x4c')]['getResources'](_0x25d871);}return db[_0x562197][_0x9232('0x3b')](_0x3b9a70);})[_0x9232('0x16')](function(_0x67a358){_0x521165[_0x9232('0xb')]=_0x67a358[_0x9232('0xb')];_0x3c56ba=_0x67a358['rows'];return rtq[_0x9232('0x4d')](_0x21992e,_0xbd725b);})[_0x9232('0x16')](function(_0x83181a){_0x533ece=_0x83181a[_0x9232('0x3c')];return rtq[_0x9232('0x4e')](_0x3c56ba,_0x533ece,_0xbd725b,_0x21992e[_0x9232('0xf')][_0x9232('0x28')]);})[_0x9232('0x16')](function(_0x44005f){_0x521165[_0x9232('0x3c')]=_0x44005f;return _0x521165;})['then'](respondWithFilteredResult(_0x8d478e,_0x3b9a70))['catch'](APIHandleError(_0x8d478e));}; \ No newline at end of file +var _0x0e8f=['../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','undefined','limit','offset','count','Content-Range','json','query','globalStatusFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','rawAttributes','fieldName','type','key','role','length','push','sequelize','forEach','Pause','where','user','userProfileId','agent','online','extraQueryConditions','assign','getResources','User','globalStatus','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel','startCase','Queue','name','outbound','dialActive','dialMethod','getOptions','Queues','filter','UserProfile','getRealtimeQueues','lodash','util'];(function(_0x4368a8,_0x46772e){var _0x1578fd=function(_0x23a15f){while(--_0x23a15f){_0x4368a8['push'](_0x4368a8['shift']());}};_0x1578fd(++_0x46772e);}(_0x0e8f,0x189));var _0xf0e8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0e8f[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xf0e8('0x0'));var util=require(_0xf0e8('0x1'));var rta=require(_0xf0e8('0x2'));var rtq=require(_0xf0e8('0x3'));var qs=require(_0xf0e8('0x4'));var utils=require(_0xf0e8('0x5'));var db=require(_0xf0e8('0x6'))['db'];var APIBadRequestError=require(_0xf0e8('0x7'))['APIBadRequestError'];var APIHandleError=require(_0xf0e8('0x7'))[_0xf0e8('0x8')];function respondWithFilteredResult(_0x1f4735,_0x58a159){return function(_0x469722){if(_0x469722){var _0x209d2d=typeof _0x58a159['offset']===_0xf0e8('0x9')&&typeof _0x58a159[_0xf0e8('0xa')]===_0xf0e8('0x9');var _0x4720ac=_0x469722['count'];var _0x357071=_0x209d2d?0x0:_0x58a159[_0xf0e8('0xb')];var _0x9a340f=_0x209d2d?_0x469722[_0xf0e8('0xc')]:_0x58a159['offset']+_0x58a159[_0xf0e8('0xa')];var _0x549b85;if(_0x9a340f>=_0x4720ac){_0x9a340f=_0x4720ac;_0x549b85=0xc8;}else{_0x549b85=0xce;}_0x1f4735['status'](_0x549b85);return _0x1f4735['set'](_0xf0e8('0xd'),_0x357071+'-'+_0x9a340f+'/'+_0x4720ac)[_0xf0e8('0xe')](_0x469722);}return null;};}exports['getAgents']=function(_0x789722,_0x17fd43){var _0x152374={'count':0x0,'rows':[]};var _0x5b7b60={};var _0x5d1865;var _0x5b1c7c=utils['getChannels']();var _0x1de1bc;var _0x2242d7;var _0x173531=_0x789722[_0xf0e8('0xf')]['globalQueueFilter'];var _0x5311ed=_0x789722['query'][_0xf0e8('0x10')];var _0x5e3bac=_0x789722[_0xf0e8('0xf')]['pauseTypeFilter'];var _0x3600f1=_0x5311ed===_0xf0e8('0x11')||_0x5311ed===_0xf0e8('0x12')?!![]:![];var _0xac1987=[];var _0x42a0e9;var _0x2f3090;Promise[_0xf0e8('0x13')]()[_0xf0e8('0x14')](function(){if(_0x789722[_0xf0e8('0xf')]['channel']){if(!utils['isValidChannel'](_0x789722[_0xf0e8('0xf')][_0xf0e8('0x15')])){throw new APIBadRequestError(util['format'](_0xf0e8('0x16'),_0x789722[_0xf0e8('0xf')]['channel']));}_0x5d1865=_0x789722[_0xf0e8('0xf')][_0xf0e8('0x15')][_0xf0e8('0x17')]();}if(!_0x789722[_0xf0e8('0xf')]['sort']||!_0x789722[_0xf0e8('0xf')][_0xf0e8('0x18')][_0xf0e8('0x19')]('globalStatus')){_0x789722['query']['sort']=rta[_0xf0e8('0x1a')](_0x789722[_0xf0e8('0xf')]['sort']);return;}var _0x409c86=rta[_0xf0e8('0x1b')](_0x789722['query'][_0xf0e8('0x18')]);_0x789722['query'][_0xf0e8('0x18')]=_0x409c86[_0xf0e8('0x1c')][_0xf0e8('0x1d')](',');_0x42a0e9=_0x409c86[_0xf0e8('0x1e')];})[_0xf0e8('0x14')](function(){if(!_0x173531){return[];}return rta[_0xf0e8('0x1f')](_0x173531,_0x5d1865);})[_0xf0e8('0x14')](function(_0xcc6015){_0xac1987=_0xcc6015;return rta[_0xf0e8('0x20')]();})['then'](function(_0x13f72e){_0x2242d7=_0x13f72e[_0xf0e8('0x21')];if((!_0x5311ed||_0x3600f1)&&!_0x42a0e9){return _0xac1987;}if(_0x42a0e9&&!_0x5311ed){return rta[_0xf0e8('0x22')](_0x2242d7,_0xac1987,_0x42a0e9);}else{return rta[_0xf0e8('0x23')](_0x2242d7,_0xac1987,_0x5311ed);}})[_0xf0e8('0x14')](function(_0x3f156b){_0xac1987=_0x3f156b;var _0x34efdd=![];if(_0xac1987['length']===0x0){if(_0x173531||_0x5311ed){_0x34efdd=!![];}if(_0x3600f1){_0x34efdd=![];}}if(_0x34efdd){return _0x152374;}var _0x48bbd2=_[_0xf0e8('0x24')](db['User'][_0xf0e8('0x25')],function(_0x2673f9){return{'name':_0x2673f9[_0xf0e8('0x26')],'type':_0x2673f9[_0xf0e8('0x27')][_0xf0e8('0x28')]};});_0x789722[_0xf0e8('0xf')][_0xf0e8('0x29')]='agent';_0x5b7b60=qs['getOptions'](_0x48bbd2,_0x789722);_0x5b7b60['raw']=!![];var _0x31fe3d=[];if(_0xac1987[_0xf0e8('0x2a')]>0x0){_0x31fe3d[_0xf0e8('0x2b')]({'id':{'$in':_0xac1987}});if(_0x42a0e9&&!_0x5311ed){_0x2f3090=[db[_0xf0e8('0x2c')]['literal']('FIELD(id,'+_0xac1987+')')];_0x5b7b60[_0xf0e8('0x1e')]=_0x2f3090;}}if(_0x3600f1){_0x5b1c7c[_0xf0e8('0x2d')](function(_0x243043){var _0x4529ef=!![];if(_0x5311ed==='*pause'&&_0x5d1865!==_0x243043){_0x4529ef=![];}_0x31fe3d[_0xf0e8('0x2b')]({[_0x243043+_0xf0e8('0x2e')]:_0x4529ef});});if(_0x5e3bac){_0x31fe3d[_0xf0e8('0x2b')]({'pauseType':_0x5e3bac});}}else if(_0x5311ed){_0x5b1c7c[_0xf0e8('0x2d')](function(_0x16f2f5){_0x31fe3d[_0xf0e8('0x2b')]({[_0x16f2f5+_0xf0e8('0x2e')]:![]});});}_0x5b7b60['where']=_['merge'](_0x5b7b60[_0xf0e8('0x2f')],{'$and':_0x31fe3d});if(_0x789722[_0xf0e8('0x30')][_0xf0e8('0x29')]===_0xf0e8('0x30')){var _0x4624fe={'params':{'id':_0x789722[_0xf0e8('0x30')][_0xf0e8('0x31')]},'query':{'section':'Agents','role':_0xf0e8('0x32'),'raw':!![],'ids':_0xac1987,'customSorting':_0x2f3090}};if(_0x789722['query'][_0xf0e8('0x33')]){_0x4624fe[_0xf0e8('0xf')]['online']=!![];}if(_0x3600f1){_0x4624fe[_0xf0e8('0xf')][_0xf0e8('0x34')]=_0x31fe3d;}_0x4624fe[_0xf0e8('0xf')]=Object[_0xf0e8('0x35')](_0x4624fe[_0xf0e8('0xf')],_0x789722[_0xf0e8('0xf')]);return db['UserProfile'][_0xf0e8('0x36')](_0x4624fe);}return db[_0xf0e8('0x37')]['findAndCountAll'](_0x5b7b60);})[_0xf0e8('0x14')](function(_0x2542fd){_0x152374[_0xf0e8('0xc')]=_0x2542fd['count'];_0x1de1bc=_0x2542fd['rows'];return _0x1de1bc['map'](function(_0x36c41d){var _0x54fca7=_['find'](_0x2242d7,['id',_0x36c41d['id']]);if(_0x54fca7){var _0xb02f94=rta['filterAgentAttributes'](_0x54fca7);_['merge'](_0x36c41d,_0xb02f94);}_0x36c41d[_0xf0e8('0x38')]=rta[_0xf0e8('0x39')](_0x36c41d);if(_0x36c41d[_0xf0e8('0x38')][_0xf0e8('0x19')](_0xf0e8('0x11'))){_0x5b1c7c['forEach'](function(_0x4fbf0a){if(_0x36c41d[_0x4fbf0a+'Pause']){if(_0x4fbf0a===_0xf0e8('0x3a')){if(_0x36c41d[_0xf0e8('0x3b')]!==_0xf0e8('0x3c')){_0x36c41d[_0xf0e8('0x3b')]='pause';}}else{_0x36c41d[_0x4fbf0a+_0xf0e8('0x3d')]=_0xf0e8('0x11');}}});}return _0x36c41d;});})[_0xf0e8('0x14')](function(_0x4a674b){if(!_0x42a0e9||_0x2f3090){return _0x4a674b;}return rta[_0xf0e8('0x3e')](_0x4a674b,_0x42a0e9);})['then'](function(_0x332707){var _0xd62914=rta[_0xf0e8('0x3f')]();_0x152374[_0xf0e8('0x21')]=_0x332707['map'](function(_0x4a6f31){return _[_0xf0e8('0x40')](_0x4a6f31,_0xd62914);});return _0x152374;})[_0xf0e8('0x14')](respondWithFilteredResult(_0x17fd43,_0x5b7b60))[_0xf0e8('0x41')](APIHandleError(_0x17fd43));};exports[_0xf0e8('0x42')]=function(_0x435c8f,_0x18212b){var _0x454801={'count':0x0,'rows':[]};var _0x15fc8b={};var _0x11c65a;var _0x770624;var _0x3e4404;Promise[_0xf0e8('0x13')]()[_0xf0e8('0x14')](function(){if(_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x15')]){if(!utils[_0xf0e8('0x43')](_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x15')])){throw new APIBadRequestError(util['format'](_0xf0e8('0x16'),_0x435c8f[_0xf0e8('0xf')]['channel']));}_0x11c65a=_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x15')]['toLowerCase']();}var _0x3f1a97=_[_0xf0e8('0x44')](_0x11c65a)+_0xf0e8('0x45');var _0x5342b5=_[_0xf0e8('0x24')](db[_0x3f1a97][_0xf0e8('0x25')],function(_0x146ae0){return{'name':_0x146ae0[_0xf0e8('0x26')],'type':_0x146ae0['type'][_0xf0e8('0x28')]};});if(!_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x1c')]){var _0x4ab813=['id',_0xf0e8('0x46')];if(_0x11c65a===_0xf0e8('0x3a')){_0x4ab813['push'](_0xf0e8('0x27'));if(_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x27')]===_0xf0e8('0x47')){_0x4ab813[_0xf0e8('0x2b')]([_0xf0e8('0x48'),_0xf0e8('0x49')]);}}_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x1c')]=_0x4ab813[_0xf0e8('0x1d')](',');}_0x15fc8b=qs[_0xf0e8('0x4a')](_0x5342b5,_0x435c8f);if(_0x435c8f[_0xf0e8('0x30')][_0xf0e8('0x29')]===_0xf0e8('0x30')){var _0x49d136={'params':{'id':_0x435c8f[_0xf0e8('0x30')][_0xf0e8('0x31')]},'query':{'section':_0x11c65a===_0xf0e8('0x3a')&&_0x435c8f['query']['type']===_0xf0e8('0x47')?'QueueCampaigns':_['startCase'](_0x11c65a)+_0xf0e8('0x4b'),'type':_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x27')],'nolimit':!![],'sort':'name','filter':_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x4c')]}};_0x49d136['query']=Object[_0xf0e8('0x35')](_0x49d136['query'],_0x435c8f[_0xf0e8('0xf')]);delete _0x49d136[_0xf0e8('0xf')]['id'];return db[_0xf0e8('0x4d')][_0xf0e8('0x36')](_0x49d136);}return db[_0x3f1a97]['findAndCountAll'](_0x15fc8b);})[_0xf0e8('0x14')](function(_0x4dd8fb){_0x454801[_0xf0e8('0xc')]=_0x4dd8fb['count'];_0x770624=_0x4dd8fb[_0xf0e8('0x21')];return rtq[_0xf0e8('0x4e')](_0x435c8f,_0x11c65a);})[_0xf0e8('0x14')](function(_0xc9021d){_0x3e4404=_0xc9021d[_0xf0e8('0x21')];return rtq['initializeQueues'](_0x770624,_0x3e4404,_0x11c65a,_0x435c8f[_0xf0e8('0xf')][_0xf0e8('0x27')]);})[_0xf0e8('0x14')](function(_0x2b7903){_0x454801[_0xf0e8('0x21')]=_0x2b7903;return _0x454801;})['then'](respondWithFilteredResult(_0x18212b,_0x15fc8b))[_0xf0e8('0x41')](APIHandleError(_0x18212b));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 727c411..fb22e64 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xc5475f,_0x4e9bf6){var _0x534890=function(_0x1e3add){while(--_0x1e3add){_0xc5475f['push'](_0xc5475f['shift']());}};_0x534890(++_0x4e9bf6);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a4eea,_0x4ba93f){_0x5a4eea=_0x5a4eea-0x0;var _0x1330e4=_0xedd9[_0x5a4eea];return _0x1330e4;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x11e972,_0x2ff647){var _0x595263=function(_0x593919){while(--_0x593919){_0x11e972['push'](_0x11e972['shift']());}};_0x595263(++_0x2ff647);}(_0x70e0,0x17b));var _0x070e=function(_0x3aecbb,_0x134d1d){_0x3aecbb=_0x3aecbb-0x0;var _0x3c5fe1=_0x70e0[_0x3aecbb];return _0x3c5fe1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 230a0eb..efbe964 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 _0xd663=['DATE','sequelize','exports','STRING'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0xd663,0x1ed));var _0x3d66=function(_0x18e272,_0x5e64e9){_0x18e272=_0x18e272-0x0;var _0x216fa3=_0xd663[_0x18e272];return _0x216fa3;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3d66('0x2')]},'scheduledat':{'type':Sequelize[_0x3d66('0x3')]},'uniqueid':{'type':Sequelize[_0x3d66('0x2')]},'starttime':{'type':Sequelize[_0x3d66('0x3')]},'responsetime':{'type':Sequelize[_0x3d66('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3d66('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xacd6=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacd6,0xef));var _0x6acd=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0xacd6[_0x42ebba];return _0x3fd2af;};'use strict';var Sequelize=require(_0x6acd('0x0'));module[_0x6acd('0x1')]={'state':{'type':Sequelize[_0x6acd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6acd('0x3')]},'scheduledat':{'type':Sequelize[_0x6acd('0x4')]},'uniqueid':{'type':Sequelize[_0x6acd('0x3')]},'starttime':{'type':Sequelize[_0x6acd('0x4')]},'responsetime':{'type':Sequelize[_0x6acd('0x4')]},'ringtime':{'type':Sequelize[_0x6acd('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6acd('0x3')]},'campaigntype':{'type':Sequelize[_0x6acd('0x3')]},'membername':{'type':Sequelize[_0x6acd('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6932473..75ae99b 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 _0x6105=['bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','moment'];(function(_0x20add2,_0x4f0d00){var _0x2f1363=function(_0x14e352){while(--_0x14e352){_0x20add2['push'](_0x20add2['shift']());}};_0x2f1363(++_0x4f0d00);}(_0x6105,0x188));var _0x5610=function(_0x64e597,_0x1f5e9d){_0x64e597=_0x64e597-0x0;var _0x14a6c3=_0x6105[_0x64e597];return _0x14a6c3;};'use strict';var _=require(_0x5610('0x0'));var util=require(_0x5610('0x1'));var logger=require(_0x5610('0x2'))('api');var moment=require(_0x5610('0x3'));var BPromise=require(_0x5610('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5610('0x5'));var config=require(_0x5610('0x6'));var attributes=require(_0x5610('0x7'));module[_0x5610('0x8')]=function(_0x42a394,_0x33bd31){return _0x42a394[_0x5610('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x5610('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbea0=['path','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3303c8,_0x168a17){var _0x41f949=function(_0xb618ec){while(--_0xb618ec){_0x3303c8['push'](_0x3303c8['shift']());}};_0x41f949(++_0x168a17);}(_0xbea0,0x1b5));var _0x0bea=function(_0x488fe8,_0x31b059){_0x488fe8=_0x488fe8-0x0;var _0x3122fe=_0xbea0[_0x488fe8];return _0x3122fe;};'use strict';var _=require(_0x0bea('0x0'));var util=require(_0x0bea('0x1'));var logger=require(_0x0bea('0x2'))(_0x0bea('0x3'));var moment=require(_0x0bea('0x4'));var BPromise=require(_0x0bea('0x5'));var rp=require(_0x0bea('0x6'));var fs=require('fs');var path=require(_0x0bea('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0bea('0x8'));module[_0x0bea('0x9')]=function(_0xbe3eec,_0x235a6b){return _0xbe3eec[_0x0bea('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x0bea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 9c0d91b..a5ffa81 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 _0x1b40=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x8e9899,_0x2fb041){var _0x4ac91b=function(_0x5d8991){while(--_0x5d8991){_0x8e9899['push'](_0x8e9899['shift']());}};_0x4ac91b(++_0x2fb041);}(_0x1b40,0x7e));var _0x01b4=function(_0x1ff804,_0x263135){_0x1ff804=_0x1ff804-0x0;var _0x3454b8=_0x1b40[_0x1ff804];return _0x3454b8;};'use strict';var _=require(_0x01b4('0x0'));var util=require('util');var moment=require(_0x01b4('0x1'));var BPromise=require(_0x01b4('0x2'));var rs=require(_0x01b4('0x3'));var fs=require('fs');var Redis=require(_0x01b4('0x4'));var db=require(_0x01b4('0x5'))['db'];var utils=require(_0x01b4('0x6'));var logger=require(_0x01b4('0x7'))(_0x01b4('0x8'));var config=require(_0x01b4('0x9'));var jayson=require(_0x01b4('0xa'));var client=jayson[_0x01b4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a25c,_0x25a4e2,_0x596a1a){return new BPromise(function(_0x5adb26,_0x3ac17d){return client[_0x01b4('0xc')](_0x12a25c,_0x596a1a)[_0x01b4('0xd')](function(_0x2ac142){logger[_0x01b4('0xe')](_0x01b4('0xf'),_0x25a4e2,_0x01b4('0x10'));logger[_0x01b4('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x25a4e2,_0x01b4('0x10'),JSON[_0x01b4('0x12')](_0x2ac142));if(_0x2ac142[_0x01b4('0x13')]){if(_0x2ac142[_0x01b4('0x13')][_0x01b4('0x14')]===0x1f4){logger['error'](_0x01b4('0xf'),_0x25a4e2,_0x2ac142[_0x01b4('0x13')][_0x01b4('0x15')]);return _0x3ac17d(_0x2ac142[_0x01b4('0x13')]['message']);}logger[_0x01b4('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x25a4e2,_0x2ac142[_0x01b4('0x13')]['message']);return _0x5adb26(_0x2ac142[_0x01b4('0x13')][_0x01b4('0x15')]);}else{logger['info'](_0x01b4('0xf'),_0x25a4e2,_0x01b4('0x10'));_0x5adb26(_0x2ac142[_0x01b4('0x16')]['message']);}})[_0x01b4('0x17')](function(_0xb44225){logger[_0x01b4('0x13')](_0x01b4('0xf'),_0x25a4e2,_0xb44225);_0x3ac17d(_0xb44225);});});}exports[_0x01b4('0x18')]=function(_0x4eb485){var _0xd39ace=this;return new Promise(function(_0x4fc1a8,_0x34f7f6){return db[_0x01b4('0x19')][_0x01b4('0x1a')](_0x4eb485['body'],{'raw':_0x4eb485[_0x01b4('0x1b')]?_0x4eb485['options'][_0x01b4('0x1c')]===undefined?!![]:![]:!![]})[_0x01b4('0xd')](function(_0x372fb3){logger['info'](_0x01b4('0x18'),_0x4eb485);logger[_0x01b4('0x11')](_0x01b4('0x18'),_0x4eb485,JSON[_0x01b4('0x12')](_0x372fb3));_0x4fc1a8(_0x372fb3);})[_0x01b4('0x17')](function(_0x290e04){logger[_0x01b4('0x13')]('CreateReportAgentPreview',_0x290e04[_0x01b4('0x15')],_0x4eb485);_0x34f7f6(_0xd39ace[_0x01b4('0x13')](0x1f4,_0x290e04['message']));});});}; \ No newline at end of file +var _0x08f5=['error','code','message','result','catch','ReportAgentPreview','create','options','raw','then','CreateReportAgentPreview','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x08f5,0x119));var _0x508f=function(_0x574162,_0x2425ea){_0x574162=_0x574162-0x0;var _0x39c245=_0x08f5[_0x574162];return _0x39c245;};'use strict';var _=require(_0x508f('0x0'));var util=require(_0x508f('0x1'));var moment=require('moment');var BPromise=require(_0x508f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x508f('0x3'));var db=require(_0x508f('0x4'))['db'];var utils=require(_0x508f('0x5'));var logger=require(_0x508f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x508f('0x7'));var client=jayson[_0x508f('0x8')][_0x508f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6b8efe,_0x33f775,_0x86fb83){return new BPromise(function(_0x3300eb,_0x4aa4ac){return client[_0x508f('0xa')](_0x6b8efe,_0x86fb83)['then'](function(_0x3c9a2f){logger[_0x508f('0xb')](_0x508f('0xc'),_0x33f775,'request\x20sent');logger[_0x508f('0xd')](_0x508f('0xe'),_0x33f775,_0x508f('0xf'),JSON['stringify'](_0x3c9a2f));if(_0x3c9a2f[_0x508f('0x10')]){if(_0x3c9a2f[_0x508f('0x10')][_0x508f('0x11')]===0x1f4){logger[_0x508f('0x10')](_0x508f('0xc'),_0x33f775,_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);return _0x4aa4ac(_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);}logger['error'](_0x508f('0xc'),_0x33f775,_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);return _0x3300eb(_0x3c9a2f[_0x508f('0x10')][_0x508f('0x12')]);}else{logger[_0x508f('0xb')](_0x508f('0xc'),_0x33f775,'request\x20sent');_0x3300eb(_0x3c9a2f[_0x508f('0x13')][_0x508f('0x12')]);}})[_0x508f('0x14')](function(_0x415d4c){logger[_0x508f('0x10')](_0x508f('0xc'),_0x33f775,_0x415d4c);_0x4aa4ac(_0x415d4c);});});}exports['CreateReportAgentPreview']=function(_0x44fbf7){var _0x4b5ea0=this;return new Promise(function(_0x1f676e,_0x4fded2){return db[_0x508f('0x15')][_0x508f('0x16')](_0x44fbf7['body'],{'raw':_0x44fbf7['options']?_0x44fbf7[_0x508f('0x17')][_0x508f('0x18')]===undefined?!![]:![]:!![]})[_0x508f('0x19')](function(_0x25632d){logger[_0x508f('0xb')]('CreateReportAgentPreview',_0x44fbf7);logger[_0x508f('0xd')](_0x508f('0x1a'),_0x44fbf7,JSON['stringify'](_0x25632d));_0x1f676e(_0x25632d);})[_0x508f('0x14')](function(_0x54c4d6){logger[_0x508f('0x10')](_0x508f('0x1a'),_0x54c4d6[_0x508f('0x12')],_0x44fbf7);_0x4fded2(_0x4b5ea0['error'](0x1f4,_0x54c4d6[_0x508f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ee1a4c4..2646a2f 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 _0x9762=['voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels'];(function(_0x183b18,_0x5ec15c){var _0x4c5710=function(_0x505fd0){while(--_0x505fd0){_0x183b18['push'](_0x183b18['shift']());}};_0x4c5710(++_0x5ec15c);}(_0x9762,0x13f));var _0x2976=function(_0x7a68b,_0x964789){_0x7a68b=_0x7a68b-0x0;var _0x110d37=_0x9762[_0x7a68b];return _0x110d37;};'use strict';var multer=require(_0x2976('0x0'));var util=require(_0x2976('0x1'));var path=require(_0x2976('0x2'));var express=require(_0x2976('0x3'));var router=express['Router']();var auth=require(_0x2976('0x4'));var controller=require(_0x2976('0x5'));router[_0x2976('0x6')](_0x2976('0x7'),auth[_0x2976('0x8')](),controller[_0x2976('0x9')]);router[_0x2976('0x6')](_0x2976('0xa'),auth[_0x2976('0x8')](),controller[_0x2976('0xb')]);router[_0x2976('0x6')](_0x2976('0xc'),auth[_0x2976('0x8')](),controller[_0x2976('0xd')]);router[_0x2976('0x6')](_0x2976('0xe'),auth[_0x2976('0x8')](),controller['voiceQueues']);router[_0x2976('0x6')](_0x2976('0xf'),auth[_0x2976('0x8')](),controller[_0x2976('0x10')]);router[_0x2976('0x6')](_0x2976('0x11'),auth[_0x2976('0x8')](),controller[_0x2976('0x12')]);router['get']('/mail/accounts',auth[_0x2976('0x8')](),controller[_0x2976('0x13')]);router[_0x2976('0x6')](_0x2976('0x14'),auth[_0x2976('0x8')](),controller[_0x2976('0x15')]);router[_0x2976('0x6')]('/sms/queues',auth[_0x2976('0x8')](),controller[_0x2976('0x16')]);router['get']('/whatsapp/queues',auth[_0x2976('0x8')](),controller[_0x2976('0x17')]);router[_0x2976('0x6')](_0x2976('0x18'),auth[_0x2976('0x8')](),controller[_0x2976('0x19')]);router[_0x2976('0x6')](_0x2976('0x1a'),auth[_0x2976('0x8')](),controller[_0x2976('0x1b')]);router[_0x2976('0x6')](_0x2976('0x1c'),auth['isAuthenticated'](),controller[_0x2976('0x1d')]);router['get'](_0x2976('0x1e'),auth[_0x2976('0x8')](),controller[_0x2976('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x2976('0x8')](),controller[_0x2976('0x20')]);router[_0x2976('0x6')](_0x2976('0x21'),auth[_0x2976('0x8')](),controller[_0x2976('0x22')]);router[_0x2976('0x6')]('/voice/queues/:id',auth[_0x2976('0x8')](),controller[_0x2976('0x23')]);router[_0x2976('0x24')](_0x2976('0x25'),auth['isAuthenticated'](),controller[_0x2976('0x26')]);router['get'](_0x2976('0x27'),auth['isAuthenticated'](),controller[_0x2976('0x28')]);router['get']('/outbound/channels',auth['isAuthenticated'](),controller[_0x2976('0x29')]);router['get'](_0x2976('0x2a'),auth['isAuthenticated'](),controller[_0x2976('0x2b')]);router[_0x2976('0x24')](_0x2976('0x2c'),auth[_0x2976('0x8')](),controller[_0x2976('0x2d')]);router[_0x2976('0x6')](_0x2976('0x2e'),auth[_0x2976('0x8')](),controller[_0x2976('0x2f')]);router[_0x2976('0x6')](_0x2976('0x30'),auth[_0x2976('0x8')](),controller[_0x2976('0x31')]);router['get'](_0x2976('0x32'),auth[_0x2976('0x8')](),controller[_0x2976('0x33')]);router[_0x2976('0x6')](_0x2976('0x34'),auth[_0x2976('0x8')](),controller['faxAccounts']);router[_0x2976('0x6')](_0x2976('0x35'),auth['isAuthenticated'](),controller[_0x2976('0x36')]);router[_0x2976('0x6')]('/mail/queues/waitinginteractions',auth[_0x2976('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x2976('0x6')](_0x2976('0x37'),auth[_0x2976('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x2976('0x6')](_0x2976('0x38'),auth[_0x2976('0x8')](),controller[_0x2976('0x39')]);router[_0x2976('0x6')]('/sms/queues/waitinginteractions',auth[_0x2976('0x8')](),controller[_0x2976('0x3a')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x2976('0x8')](),controller[_0x2976('0x3b')]);router['get'](_0x2976('0x3c'),auth['isAuthenticated'](),controller[_0x2976('0x3d')]);router[_0x2976('0x3e')](_0x2976('0x3f'),auth[_0x2976('0x8')](),controller[_0x2976('0x40')](_0x2976('0x41')));router['get'](_0x2976('0x42'),auth[_0x2976('0x8')](),controller[_0x2976('0x43')]);router['post'](_0x2976('0x44'),auth[_0x2976('0x8')](),controller[_0x2976('0x40')](_0x2976('0x45')));router[_0x2976('0x6')](_0x2976('0x46'),auth['isAuthenticated'](),controller['showChatQueues']);router['post'](_0x2976('0x47'),auth[_0x2976('0x8')](),controller[_0x2976('0x40')](_0x2976('0x48')));router['get'](_0x2976('0x49'),auth['isAuthenticated'](),controller[_0x2976('0x4a')]);router[_0x2976('0x3e')](_0x2976('0x4b'),auth[_0x2976('0x8')](),controller[_0x2976('0x40')]('openchannel'));router['get'](_0x2976('0x4c'),auth[_0x2976('0x8')](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth[_0x2976('0x8')](),controller['queueNotify'](_0x2976('0x4d')));router[_0x2976('0x3e')](_0x2976('0x4e'),auth['isAuthenticated'](),controller[_0x2976('0x40')](_0x2976('0x4f')));router[_0x2976('0x6')](_0x2976('0x50'),auth[_0x2976('0x8')](),controller[_0x2976('0x51')]);router[_0x2976('0x6')](_0x2976('0x52'),auth[_0x2976('0x8')](),controller[_0x2976('0x53')]);router[_0x2976('0x3e')](_0x2976('0x54'),auth[_0x2976('0x8')](),controller[_0x2976('0x55')]);module[_0x2976('0x56')]=router; \ No newline at end of file +var _0xb857=['voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated'];(function(_0x144d3c,_0x1c8394){var _0x25af78=function(_0x477fd1){while(--_0x477fd1){_0x144d3c['push'](_0x144d3c['shift']());}};_0x25af78(++_0x1c8394);}(_0xb857,0x19b));var _0x7b85=function(_0x397756,_0x185bbd){_0x397756=_0x397756-0x0;var _0x1537c1=_0xb857[_0x397756];return _0x1537c1;};'use strict';var multer=require(_0x7b85('0x0'));var util=require(_0x7b85('0x1'));var path=require(_0x7b85('0x2'));var express=require('express');var router=express[_0x7b85('0x3')]();var auth=require(_0x7b85('0x4'));var controller=require(_0x7b85('0x5'));router[_0x7b85('0x6')](_0x7b85('0x7'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x9')]);router['get'](_0x7b85('0xa'),auth[_0x7b85('0x8')](),controller['voiceChannelMixMonitor']);router[_0x7b85('0x6')](_0x7b85('0xb'),auth['isAuthenticated'](),controller[_0x7b85('0xc')]);router[_0x7b85('0x6')]('/voice/queues',auth['isAuthenticated'](),controller[_0x7b85('0xd')]);router['get'](_0x7b85('0xe'),auth['isAuthenticated'](),controller[_0x7b85('0xf')]);router[_0x7b85('0x6')](_0x7b85('0x10'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x7b85('0x6')](_0x7b85('0x11'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x12')]);router[_0x7b85('0x6')](_0x7b85('0x13'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x14')]);router[_0x7b85('0x6')](_0x7b85('0x15'),auth['isAuthenticated'](),controller[_0x7b85('0x16')]);router['get'](_0x7b85('0x17'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x18')]);router[_0x7b85('0x6')](_0x7b85('0x19'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x1a')]);router[_0x7b85('0x6')]('/voice/queues/preview/:id',auth[_0x7b85('0x8')](),controller[_0x7b85('0x1b')]);router[_0x7b85('0x6')](_0x7b85('0x1c'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x1d')]);router[_0x7b85('0x6')](_0x7b85('0x1e'),auth['isAuthenticated'](),controller[_0x7b85('0x1f')]);router[_0x7b85('0x6')](_0x7b85('0x20'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x21')]);router[_0x7b85('0x6')](_0x7b85('0x22'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x23')]);router['get'](_0x7b85('0x24'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x25')]);router[_0x7b85('0x26')]('/voice/queues/:id',auth[_0x7b85('0x8')](),controller[_0x7b85('0x27')]);router[_0x7b85('0x6')](_0x7b85('0x28'),auth[_0x7b85('0x8')](),controller['outbound']);router['get']('/outbound/channels',auth[_0x7b85('0x8')](),controller[_0x7b85('0x29')]);router[_0x7b85('0x6')](_0x7b85('0x2a'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x2b')]);router[_0x7b85('0x26')](_0x7b85('0x2c'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x2d')]);router['get'](_0x7b85('0x2e'),auth[_0x7b85('0x8')](),controller['telephones']);router[_0x7b85('0x6')](_0x7b85('0x2f'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x30')]);router[_0x7b85('0x6')]('/campaigns',auth['isAuthenticated'](),controller[_0x7b85('0x31')]);router[_0x7b85('0x6')](_0x7b85('0x32'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x33')]);router[_0x7b85('0x6')](_0x7b85('0x34'),auth[_0x7b85('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x7b85('0x6')](_0x7b85('0x35'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x36')]);router[_0x7b85('0x6')](_0x7b85('0x37'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x38')]);router[_0x7b85('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x7b85('0x8')](),controller[_0x7b85('0x39')]);router[_0x7b85('0x6')]('/sms/queues/waitinginteractions',auth[_0x7b85('0x8')](),controller[_0x7b85('0x3a')]);router[_0x7b85('0x6')](_0x7b85('0x3b'),auth[_0x7b85('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x7b85('0x6')](_0x7b85('0x3c'),auth['isAuthenticated'](),controller[_0x7b85('0x3d')]);router['post']('/mail/queues/:id/notify',auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')]('mail'));router[_0x7b85('0x6')](_0x7b85('0x3f'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x40')]);router[_0x7b85('0x41')](_0x7b85('0x42'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')](_0x7b85('0x43')));router[_0x7b85('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x7b85('0x44')]);router[_0x7b85('0x41')](_0x7b85('0x45'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')](_0x7b85('0x46')));router[_0x7b85('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x7b85('0x47')]);router[_0x7b85('0x41')](_0x7b85('0x48'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x3e')](_0x7b85('0x49')));router[_0x7b85('0x6')](_0x7b85('0x4a'),auth[_0x7b85('0x8')](),controller['showOpenchannelQueues']);router[_0x7b85('0x41')](_0x7b85('0x4b'),auth['isAuthenticated'](),controller['queueNotify'](_0x7b85('0x4c')));router[_0x7b85('0x41')](_0x7b85('0x4d'),auth[_0x7b85('0x8')](),controller['queueNotify']('whatsapp'));router[_0x7b85('0x6')](_0x7b85('0x4e'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x4f')]);router['get'](_0x7b85('0x50'),auth[_0x7b85('0x8')](),controller[_0x7b85('0x51')]);router[_0x7b85('0x41')](_0x7b85('0x52'),auth['isAuthenticated'](),controller[_0x7b85('0x53')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7a26f89..1b23a08 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x49c33c,_0x5b5c07){var _0x4e1cd6=function(_0x95803c){while(--_0x95803c){_0x49c33c['push'](_0x49c33c['shift']());}};_0x4e1cd6(++_0x5b5c07);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 707133b..3a69d5c 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 _0x77e2=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','put','update','delete','destroy'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x77e2,0xdd));var _0x277e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x77e2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x277e('0x0'));var util=require(_0x277e('0x1'));var path=require(_0x277e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x277e('0x3')]();var fs_extra=require(_0x277e('0x4'));var auth=require(_0x277e('0x5'));var interaction=require(_0x277e('0x6'));var config=require(_0x277e('0x7'));var controller=require(_0x277e('0x8'));router[_0x277e('0x9')]('/',auth[_0x277e('0xa')](),controller[_0x277e('0xb')]);router[_0x277e('0x9')](_0x277e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x277e('0x9')](_0x277e('0xd'),auth[_0x277e('0xa')](),controller[_0x277e('0xe')]);router[_0x277e('0xf')]('/',auth[_0x277e('0xa')](),controller[_0x277e('0x10')]);router[_0x277e('0x11')](_0x277e('0xc'),auth[_0x277e('0xa')](),controller[_0x277e('0x12')]);router[_0x277e('0x13')](_0x277e('0xc'),auth[_0x277e('0xa')](),controller[_0x277e('0x14')]);module[_0x277e('0x15')]=router; \ No newline at end of file +var _0x8b0a=['/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show'];(function(_0x2a2f0d,_0x56b22a){var _0x36809c=function(_0x21b0b1){while(--_0x21b0b1){_0x2a2f0d['push'](_0x2a2f0d['shift']());}};_0x36809c(++_0x56b22a);}(_0x8b0a,0x14b));var _0xa8b0=function(_0x39183d,_0x51345b){_0x39183d=_0x39183d-0x0;var _0x1d83ab=_0x8b0a[_0x39183d];return _0x1d83ab;};'use strict';var multer=require(_0xa8b0('0x0'));var util=require(_0xa8b0('0x1'));var path=require(_0xa8b0('0x2'));var timeout=require(_0xa8b0('0x3'));var express=require('express');var router=express[_0xa8b0('0x4')]();var fs_extra=require(_0xa8b0('0x5'));var auth=require(_0xa8b0('0x6'));var interaction=require(_0xa8b0('0x7'));var config=require(_0xa8b0('0x8'));var controller=require(_0xa8b0('0x9'));router[_0xa8b0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8b0('0xa')](_0xa8b0('0xb'),auth[_0xa8b0('0xc')](),controller[_0xa8b0('0xd')]);router['get'](_0xa8b0('0xe'),auth[_0xa8b0('0xc')](),controller[_0xa8b0('0xf')]);router[_0xa8b0('0x10')]('/',auth['isAuthenticated'](),controller[_0xa8b0('0x11')]);router[_0xa8b0('0x12')]('/:id',auth[_0xa8b0('0xc')](),controller[_0xa8b0('0x13')]);router[_0xa8b0('0x14')]('/:id',auth[_0xa8b0('0xc')](),controller[_0xa8b0('0x15')]);module[_0xa8b0('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ea185e0..2ec6f46 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 _0x578c=['exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x578c,0x6b));var _0xc578=function(_0x4b80fb,_0x4eb5e5){_0x4b80fb=_0x4b80fb-0x0;var _0x30bb79=_0x578c[_0x4b80fb];return _0x30bb79;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'name':{'type':Sequelize[_0xc578('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc578('0x2')]},'active':{'type':Sequelize[_0xc578('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc578('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xc578('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc578('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc578('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc578('0x6')](_0xc578('0x7'),_0xc578('0x8'),_0xc578('0x9'),'weeks',_0xc578('0xa'),_0xc578('0xb'),_0xc578('0xc')),'allowNull':![],'defaultValue':_0xc578('0xa')},'output':{'type':Sequelize['ENUM'](_0xc578('0xd'),_0xc578('0xe'),_0xc578('0xf')),'allowNull':![],'defaultValue':_0xc578('0xd')},'type':{'type':Sequelize[_0xc578('0x6')](_0xc578('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xc578('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc578('0x2')]},'cc':{'type':Sequelize[_0xc578('0x11')]},'bcc':{'type':Sequelize[_0xc578('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xc578('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7e4d=['default','TEXT','sequelize','exports','STRING','DATE','quarters','months','weeks','days','hours','ENUM','pdf','xlsx','custom'];(function(_0x4446b3,_0x170b3a){var _0x429de5=function(_0x1a8a83){while(--_0x1a8a83){_0x4446b3['push'](_0x4446b3['shift']());}};_0x429de5(++_0x170b3a);}(_0x7e4d,0xb6));var _0xd7e4=function(_0x1e8066,_0x2916f5){_0x1e8066=_0x1e8066-0x0;var _0x45760f=_0x7e4d[_0x1e8066];return _0x45760f;};'use strict';var Sequelize=require(_0xd7e4('0x0'));module[_0xd7e4('0x1')]={'name':{'type':Sequelize[_0xd7e4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd7e4('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xd7e4('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd7e4('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xd7e4('0x4'),_0xd7e4('0x5'),_0xd7e4('0x6'),_0xd7e4('0x7'),_0xd7e4('0x8'),'minutes'),'allowNull':![],'defaultValue':_0xd7e4('0x7')},'output':{'type':Sequelize[_0xd7e4('0x9')]('csv',_0xd7e4('0xa'),_0xd7e4('0xb')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xd7e4('0xc'),_0xd7e4('0xd')),'allowNull':![],'defaultValue':_0xd7e4('0xc')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xd7e4('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 1caaaf4..ce0c289 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 _0x6b1c=['rows','show','params','rawAttributes','attributes','include','find','create','body','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','run','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','Scheduler','UserProfileResource','then','end','error','stack','name','send','index','Schedule','model','map','query','keys','intersection','fields','length','limit','order','sort','filters','filter','where','type','merge','options','includeAll','findAll'];(function(_0x5ace5c,_0x9b9707){var _0x3c3ebd=function(_0x4ab412){while(--_0x4ab412){_0x5ace5c['push'](_0x5ace5c['shift']());}};_0x3c3ebd(++_0x9b9707);}(_0x6b1c,0xfd));var _0xc6b1=function(_0x1bc1eb,_0xf193f5){_0x1bc1eb=_0x1bc1eb-0x0;var _0x1cf397=_0x6b1c[_0x1bc1eb];return _0x1cf397;};'use strict';var emlformat=require(_0xc6b1('0x0'));var rimraf=require(_0xc6b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc6b1('0x2'));var moment=require('moment');var BPromise=require(_0xc6b1('0x3'));var Mustache=require(_0xc6b1('0x4'));var util=require('util');var path=require(_0xc6b1('0x5'));var sox=require('sox');var csv=require(_0xc6b1('0x6'));var ejs=require(_0xc6b1('0x7'));var fs=require('fs');var fs_extra=require(_0xc6b1('0x8'));var _=require(_0xc6b1('0x9'));var squel=require(_0xc6b1('0xa'));var crypto=require('crypto');var jsforce=require(_0xc6b1('0xb'));var deskjs=require(_0xc6b1('0xc'));var toCsv=require(_0xc6b1('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6b1('0xd'));var authService=require(_0xc6b1('0xe'));var qs=require(_0xc6b1('0xf'));var as=require(_0xc6b1('0x10'));var hardwareService=require(_0xc6b1('0x11'));var logger=require(_0xc6b1('0x12'))(_0xc6b1('0x13'));var utils=require(_0xc6b1('0x14'));var config=require(_0xc6b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6b1('0x16'))['db'];function respondWithStatusCode(_0x3d0d49,_0x3b21af){_0x3b21af=_0x3b21af||0xcc;return function(_0x363b36){if(_0x363b36){return _0x3d0d49[_0xc6b1('0x17')](_0x3b21af);}return _0x3d0d49['status'](_0x3b21af)['end']();};}function respondWithResult(_0x3cbdc0,_0x24ed9b){_0x24ed9b=_0x24ed9b||0xc8;return function(_0x12470a){if(_0x12470a){return _0x3cbdc0[_0xc6b1('0x18')](_0x24ed9b)[_0xc6b1('0x19')](_0x12470a);}};}function respondWithFilteredResult(_0x12aceb,_0x49afb6){return function(_0x25d1ad){if(_0x25d1ad){var _0x41e5ca=typeof _0x49afb6[_0xc6b1('0x1a')]===_0xc6b1('0x1b')&&typeof _0x49afb6['limit']===_0xc6b1('0x1b');var _0x44d2c6=_0x25d1ad[_0xc6b1('0x1c')];var _0x4a8fde=_0x41e5ca?0x0:_0x49afb6['offset'];var _0x421693=_0x41e5ca?_0x25d1ad[_0xc6b1('0x1c')]:_0x49afb6[_0xc6b1('0x1a')]+_0x49afb6['limit'];var _0x3be03c;if(_0x421693>=_0x44d2c6){_0x421693=_0x44d2c6;_0x3be03c=0xc8;}else{_0x3be03c=0xce;}_0x12aceb[_0xc6b1('0x18')](_0x3be03c);return _0x12aceb[_0xc6b1('0x1d')](_0xc6b1('0x1e'),_0x4a8fde+'-'+_0x421693+'/'+_0x44d2c6)[_0xc6b1('0x19')](_0x25d1ad);}return null;};}function patchUpdates(_0x344a6d){return function(_0xebdaea){try{jsonpatch[_0xc6b1('0x1f')](_0xebdaea,_0x344a6d,!![]);}catch(_0x3137fa){return BPromise['reject'](_0x3137fa);}return _0xebdaea[_0xc6b1('0x20')]();};}function saveUpdates(_0x2d9b20,_0x224759){return function(_0x24700e){if(_0x24700e){return _0x24700e[_0xc6b1('0x21')](_0x2d9b20)['then'](function(_0x55003e){return _0x55003e;});}return null;};}function removeEntity(_0x1ef83e,_0x1ca2be){return function(_0x8fe5f3){if(_0x8fe5f3){return _0x8fe5f3[_0xc6b1('0x22')]()['then'](function(){var _0x30dfdd=_0x8fe5f3['get']({'plain':!![]});var _0x14c71d=_0xc6b1('0x23');return db[_0xc6b1('0x24')][_0xc6b1('0x22')]({'where':{'type':_0x14c71d,'resourceId':_0x30dfdd['id']}})[_0xc6b1('0x25')](function(){return _0x8fe5f3;});})['then'](function(){_0x1ef83e[_0xc6b1('0x18')](0xcc)[_0xc6b1('0x26')]();});}};}function handleEntityNotFound(_0x2ba3cc,_0x2493c7){return function(_0x4773c6){if(!_0x4773c6){_0x2ba3cc[_0xc6b1('0x17')](0x194);}return _0x4773c6;};}function handleError(_0x4e1cec,_0xc5d89a){_0xc5d89a=_0xc5d89a||0x1f4;return function(_0x4f5d74){logger[_0xc6b1('0x27')](_0x4f5d74[_0xc6b1('0x28')]);if(_0x4f5d74[_0xc6b1('0x29')]){delete _0x4f5d74[_0xc6b1('0x29')];}_0x4e1cec[_0xc6b1('0x18')](_0xc5d89a)[_0xc6b1('0x2a')](_0x4f5d74);};}exports[_0xc6b1('0x2b')]=function(_0x22531d,_0x576ada){var _0x2a5322={},_0x4df73c={},_0x53441c={'count':0x0,'rows':[]};var _0x9446e8=_['map'](db[_0xc6b1('0x2c')]['rawAttributes'],function(_0x2fc53a){return{'name':_0x2fc53a['fieldName'],'type':_0x2fc53a['type']['key']};});_0x4df73c[_0xc6b1('0x2d')]=_[_0xc6b1('0x2e')](_0x9446e8,_0xc6b1('0x29'));_0x4df73c[_0xc6b1('0x2f')]=_[_0xc6b1('0x30')](_0x22531d[_0xc6b1('0x2f')]);_0x4df73c['filters']=_[_0xc6b1('0x31')](_0x4df73c['model'],_0x4df73c[_0xc6b1('0x2f')]);_0x2a5322['attributes']=_[_0xc6b1('0x31')](_0x4df73c[_0xc6b1('0x2d')],qs[_0xc6b1('0x32')](_0x22531d['query'][_0xc6b1('0x32')]));_0x2a5322['attributes']=_0x2a5322['attributes'][_0xc6b1('0x33')]?_0x2a5322['attributes']:_0x4df73c[_0xc6b1('0x2d')];if(!_0x22531d['query']['hasOwnProperty']('nolimit')){_0x2a5322[_0xc6b1('0x34')]=qs[_0xc6b1('0x34')](_0x22531d[_0xc6b1('0x2f')][_0xc6b1('0x34')]);_0x2a5322[_0xc6b1('0x1a')]=qs[_0xc6b1('0x1a')](_0x22531d[_0xc6b1('0x2f')][_0xc6b1('0x1a')]);}_0x2a5322[_0xc6b1('0x35')]=qs[_0xc6b1('0x36')](_0x22531d[_0xc6b1('0x2f')][_0xc6b1('0x36')]);_0x2a5322['where']=qs['filters'](_['pick'](_0x22531d[_0xc6b1('0x2f')],_0x4df73c[_0xc6b1('0x37')]),_0x9446e8);if(_0x22531d[_0xc6b1('0x2f')][_0xc6b1('0x38')]){_0x2a5322[_0xc6b1('0x39')]=_['merge'](_0x2a5322[_0xc6b1('0x39')],{'$or':_[_0xc6b1('0x2e')](_0x9446e8,function(_0x33e87a){if(_0x33e87a[_0xc6b1('0x3a')]!=='VIRTUAL'){var _0x54c09e={};_0x54c09e[_0x33e87a[_0xc6b1('0x29')]]={'$like':'%'+_0x22531d[_0xc6b1('0x2f')][_0xc6b1('0x38')]+'%'};return _0x54c09e;}})});}_0x2a5322=_[_0xc6b1('0x3b')]({},_0x2a5322,_0x22531d[_0xc6b1('0x3c')]);var _0x43faff={'where':_0x2a5322[_0xc6b1('0x39')]};return db[_0xc6b1('0x2c')][_0xc6b1('0x1c')](_0x43faff)[_0xc6b1('0x25')](function(_0x574b74){_0x53441c[_0xc6b1('0x1c')]=_0x574b74;if(_0x22531d[_0xc6b1('0x2f')][_0xc6b1('0x3d')]){_0x2a5322['include']=[{'all':!![]}];}return db['Schedule'][_0xc6b1('0x3e')](_0x2a5322);})[_0xc6b1('0x25')](function(_0x59ca5c){_0x53441c[_0xc6b1('0x3f')]=_0x59ca5c;return _0x53441c;})[_0xc6b1('0x25')](respondWithFilteredResult(_0x576ada,_0x2a5322))['catch'](handleError(_0x576ada,null));};exports[_0xc6b1('0x40')]=function(_0x1fc136,_0x29e6af){var _0x26a89d={'raw':![],'where':{'id':_0x1fc136[_0xc6b1('0x41')]['id']}},_0x5578a9={};_0x5578a9[_0xc6b1('0x2d')]=_[_0xc6b1('0x30')](db[_0xc6b1('0x2c')][_0xc6b1('0x42')]);_0x5578a9['query']=_[_0xc6b1('0x30')](_0x1fc136[_0xc6b1('0x2f')]);_0x5578a9[_0xc6b1('0x37')]=_[_0xc6b1('0x31')](_0x5578a9[_0xc6b1('0x2d')],_0x5578a9[_0xc6b1('0x2f')]);_0x26a89d[_0xc6b1('0x43')]=_['intersection'](_0x5578a9[_0xc6b1('0x2d')],qs[_0xc6b1('0x32')](_0x1fc136[_0xc6b1('0x2f')][_0xc6b1('0x32')]));_0x26a89d['attributes']=_0x26a89d[_0xc6b1('0x43')][_0xc6b1('0x33')]?_0x26a89d[_0xc6b1('0x43')]:_0x5578a9['model'];if(_0x1fc136[_0xc6b1('0x2f')]['includeAll']){_0x26a89d[_0xc6b1('0x44')]=[{'all':!![]}];}_0x26a89d=_[_0xc6b1('0x3b')]({},_0x26a89d,_0x1fc136['options']);return db[_0xc6b1('0x2c')][_0xc6b1('0x45')](_0x26a89d)[_0xc6b1('0x25')](handleEntityNotFound(_0x29e6af,null))[_0xc6b1('0x25')](respondWithResult(_0x29e6af,null))['catch'](handleError(_0x29e6af,null));};exports[_0xc6b1('0x46')]=function(_0x45580e,_0x457666){return db[_0xc6b1('0x2c')][_0xc6b1('0x46')](_0x45580e[_0xc6b1('0x47')],{})[_0xc6b1('0x25')](function(_0x23d73a){var _0x44d469=_0x45580e[_0xc6b1('0x48')][_0xc6b1('0x49')]({'plain':!![]});if(!_0x44d469)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44d469[_0xc6b1('0x4a')]===_0xc6b1('0x48')){var _0x511355=_0x23d73a[_0xc6b1('0x49')]({'plain':!![]});var _0x34c7f3='Scheduler';return db[_0xc6b1('0x4b')][_0xc6b1('0x45')]({'where':{'name':_0x34c7f3,'userProfileId':_0x44d469['userProfileId']},'raw':!![]})[_0xc6b1('0x25')](function(_0x2ccb05){if(_0x2ccb05&&_0x2ccb05['autoAssociation']===0x0){return db['UserProfileResource'][_0xc6b1('0x46')]({'name':_0x511355['name'],'resourceId':_0x511355['id'],'type':_0x2ccb05[_0xc6b1('0x29')],'sectionId':_0x2ccb05['id']},{})['then'](function(){return _0x23d73a;});}else{return _0x23d73a;}})['catch'](function(_0xfb3e52){logger[_0xc6b1('0x27')](_0xc6b1('0x4c'),_0xfb3e52);throw _0xfb3e52;});}return _0x23d73a;})[_0xc6b1('0x25')](respondWithResult(_0x457666,0xc9))['catch'](handleError(_0x457666,null));};exports[_0xc6b1('0x21')]=function(_0x1f4c4e,_0x5d878d){if(_0x1f4c4e[_0xc6b1('0x47')]['id']){delete _0x1f4c4e[_0xc6b1('0x47')]['id'];}return db[_0xc6b1('0x2c')]['find']({'where':{'id':_0x1f4c4e['params']['id']}})[_0xc6b1('0x25')](handleEntityNotFound(_0x5d878d,null))['then'](saveUpdates(_0x1f4c4e[_0xc6b1('0x47')],null))[_0xc6b1('0x25')](respondWithResult(_0x5d878d,null))['catch'](handleError(_0x5d878d,null));};exports['destroy']=function(_0x5e540f,_0x49555e){return db['Schedule'][_0xc6b1('0x45')]({'where':{'id':_0x5e540f['params']['id']}})[_0xc6b1('0x25')](handleEntityNotFound(_0x49555e,null))[_0xc6b1('0x25')](removeEntity(_0x49555e,null))[_0xc6b1('0x4d')](handleError(_0x49555e,null));};exports[_0xc6b1('0x4e')]=function(_0x4c59b5,_0x3d569a,_0x3a41d7){var _0x11fde4=require('../../config/schedule');return db[_0xc6b1('0x2c')][_0xc6b1('0x45')]({'where':{'id':_0x4c59b5[_0xc6b1('0x41')]['id']},'raw':!![]})[_0xc6b1('0x25')](handleEntityNotFound(_0x3d569a,null))[_0xc6b1('0x25')](function(){_0x11fde4[_0xc6b1('0x4e')](_0x4c59b5['params']['id']);})[_0xc6b1('0x25')](respondWithStatusCode(_0x3d569a,null))[_0xc6b1('0x4d')](handleError(_0x3d569a,null));}; \ No newline at end of file +var _0x0be4=['destroy','Scheduler','UserProfileResource','end','name','send','index','map','fieldName','type','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Schedule','rows','catch','show','params','rawAttributes','filters','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then'];(function(_0xdd3240,_0x24b3ae){var _0x3af090=function(_0x36f941){while(--_0x36f941){_0xdd3240['push'](_0xdd3240['shift']());}};_0x3af090(++_0x24b3ae);}(_0x0be4,0x137));var _0x40be=function(_0x31f1b9,_0x583476){_0x31f1b9=_0x31f1b9-0x0;var _0x14559a=_0x0be4[_0x31f1b9];return _0x14559a;};'use strict';var emlformat=require(_0x40be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40be('0x1'));var jsonpatch=require(_0x40be('0x2'));var rp=require(_0x40be('0x3'));var moment=require('moment');var BPromise=require(_0x40be('0x4'));var Mustache=require(_0x40be('0x5'));var util=require(_0x40be('0x6'));var path=require(_0x40be('0x7'));var sox=require(_0x40be('0x8'));var csv=require(_0x40be('0x9'));var ejs=require(_0x40be('0xa'));var fs=require('fs');var fs_extra=require(_0x40be('0xb'));var _=require(_0x40be('0xc'));var squel=require(_0x40be('0xd'));var crypto=require(_0x40be('0xe'));var jsforce=require(_0x40be('0xf'));var deskjs=require(_0x40be('0x10'));var toCsv=require(_0x40be('0x9'));var querystring=require(_0x40be('0x11'));var Papa=require(_0x40be('0x12'));var Redis=require(_0x40be('0x13'));var authService=require(_0x40be('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x40be('0x15'));var hardwareService=require(_0x40be('0x16'));var logger=require(_0x40be('0x17'))(_0x40be('0x18'));var utils=require(_0x40be('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x40be('0x1a'));var db=require(_0x40be('0x1b'))['db'];function respondWithStatusCode(_0x1ab50e,_0x521f9e){_0x521f9e=_0x521f9e||0xcc;return function(_0x2a94ca){if(_0x2a94ca){return _0x1ab50e[_0x40be('0x1c')](_0x521f9e);}return _0x1ab50e[_0x40be('0x1d')](_0x521f9e)['end']();};}function respondWithResult(_0x2ec118,_0x161f9d){_0x161f9d=_0x161f9d||0xc8;return function(_0x1132ab){if(_0x1132ab){return _0x2ec118[_0x40be('0x1d')](_0x161f9d)['json'](_0x1132ab);}};}function respondWithFilteredResult(_0x3dc330,_0x2a5531){return function(_0x184a3c){if(_0x184a3c){var _0x1c7d80=typeof _0x2a5531[_0x40be('0x1e')]===_0x40be('0x1f')&&typeof _0x2a5531[_0x40be('0x20')]===_0x40be('0x1f');var _0x3b0f9b=_0x184a3c[_0x40be('0x21')];var _0x4f63a3=_0x1c7d80?0x0:_0x2a5531['offset'];var _0x1a74d8=_0x1c7d80?_0x184a3c[_0x40be('0x21')]:_0x2a5531[_0x40be('0x1e')]+_0x2a5531[_0x40be('0x20')];var _0x39a74c;if(_0x1a74d8>=_0x3b0f9b){_0x1a74d8=_0x3b0f9b;_0x39a74c=0xc8;}else{_0x39a74c=0xce;}_0x3dc330[_0x40be('0x1d')](_0x39a74c);return _0x3dc330[_0x40be('0x22')](_0x40be('0x23'),_0x4f63a3+'-'+_0x1a74d8+'/'+_0x3b0f9b)[_0x40be('0x24')](_0x184a3c);}return null;};}function patchUpdates(_0x4234a7){return function(_0x176e12){try{jsonpatch[_0x40be('0x25')](_0x176e12,_0x4234a7,!![]);}catch(_0x3bbfe1){return BPromise[_0x40be('0x26')](_0x3bbfe1);}return _0x176e12[_0x40be('0x27')]();};}function saveUpdates(_0x39bd80,_0x16dee8){return function(_0x477ff8){if(_0x477ff8){return _0x477ff8['update'](_0x39bd80)[_0x40be('0x28')](function(_0x2bef6d){return _0x2bef6d;});}return null;};}function removeEntity(_0x5682b9,_0x5a1f49){return function(_0x7cea35){if(_0x7cea35){return _0x7cea35[_0x40be('0x29')]()[_0x40be('0x28')](function(){var _0x2da4d1=_0x7cea35['get']({'plain':!![]});var _0x21e250=_0x40be('0x2a');return db[_0x40be('0x2b')][_0x40be('0x29')]({'where':{'type':_0x21e250,'resourceId':_0x2da4d1['id']}})[_0x40be('0x28')](function(){return _0x7cea35;});})[_0x40be('0x28')](function(){_0x5682b9[_0x40be('0x1d')](0xcc)[_0x40be('0x2c')]();});}};}function handleEntityNotFound(_0x3ac3bc,_0x460fbe){return function(_0x4989e9){if(!_0x4989e9){_0x3ac3bc[_0x40be('0x1c')](0x194);}return _0x4989e9;};}function handleError(_0x33567f,_0x52be4e){_0x52be4e=_0x52be4e||0x1f4;return function(_0x234c8a){logger['error'](_0x234c8a['stack']);if(_0x234c8a[_0x40be('0x2d')]){delete _0x234c8a[_0x40be('0x2d')];}_0x33567f[_0x40be('0x1d')](_0x52be4e)[_0x40be('0x2e')](_0x234c8a);};}exports[_0x40be('0x2f')]=function(_0x2e183d,_0x36793d){var _0x15c96c={},_0x35269f={},_0x197f89={'count':0x0,'rows':[]};var _0x469906=_[_0x40be('0x30')](db['Schedule']['rawAttributes'],function(_0x4e75ad){return{'name':_0x4e75ad[_0x40be('0x31')],'type':_0x4e75ad[_0x40be('0x32')]['key']};});_0x35269f[_0x40be('0x33')]=_['map'](_0x469906,_0x40be('0x2d'));_0x35269f['query']=_[_0x40be('0x34')](_0x2e183d[_0x40be('0x35')]);_0x35269f['filters']=_['intersection'](_0x35269f['model'],_0x35269f[_0x40be('0x35')]);_0x15c96c['attributes']=_[_0x40be('0x36')](_0x35269f[_0x40be('0x33')],qs[_0x40be('0x37')](_0x2e183d[_0x40be('0x35')][_0x40be('0x37')]));_0x15c96c[_0x40be('0x38')]=_0x15c96c[_0x40be('0x38')]['length']?_0x15c96c[_0x40be('0x38')]:_0x35269f['model'];if(!_0x2e183d[_0x40be('0x35')]['hasOwnProperty'](_0x40be('0x39'))){_0x15c96c[_0x40be('0x20')]=qs[_0x40be('0x20')](_0x2e183d[_0x40be('0x35')][_0x40be('0x20')]);_0x15c96c['offset']=qs['offset'](_0x2e183d[_0x40be('0x35')][_0x40be('0x1e')]);}_0x15c96c[_0x40be('0x3a')]=qs[_0x40be('0x3b')](_0x2e183d[_0x40be('0x35')][_0x40be('0x3b')]);_0x15c96c[_0x40be('0x3c')]=qs['filters'](_[_0x40be('0x3d')](_0x2e183d['query'],_0x35269f['filters']),_0x469906);if(_0x2e183d[_0x40be('0x35')][_0x40be('0x3e')]){_0x15c96c['where']=_[_0x40be('0x3f')](_0x15c96c[_0x40be('0x3c')],{'$or':_[_0x40be('0x30')](_0x469906,function(_0x30b0e5){if(_0x30b0e5[_0x40be('0x32')]!==_0x40be('0x40')){var _0x2cb39a={};_0x2cb39a[_0x30b0e5[_0x40be('0x2d')]]={'$like':'%'+_0x2e183d['query'][_0x40be('0x3e')]+'%'};return _0x2cb39a;}})});}_0x15c96c=_['merge']({},_0x15c96c,_0x2e183d[_0x40be('0x41')]);var _0x73a16e={'where':_0x15c96c[_0x40be('0x3c')]};return db['Schedule'][_0x40be('0x21')](_0x73a16e)[_0x40be('0x28')](function(_0x1c5afe){_0x197f89[_0x40be('0x21')]=_0x1c5afe;if(_0x2e183d[_0x40be('0x35')][_0x40be('0x42')]){_0x15c96c[_0x40be('0x43')]=[{'all':!![]}];}return db[_0x40be('0x44')]['findAll'](_0x15c96c);})[_0x40be('0x28')](function(_0x344be6){_0x197f89[_0x40be('0x45')]=_0x344be6;return _0x197f89;})['then'](respondWithFilteredResult(_0x36793d,_0x15c96c))[_0x40be('0x46')](handleError(_0x36793d,null));};exports[_0x40be('0x47')]=function(_0x398cd2,_0x56162b){var _0x1a5958={'raw':![],'where':{'id':_0x398cd2[_0x40be('0x48')]['id']}},_0x39bc67={};_0x39bc67[_0x40be('0x33')]=_[_0x40be('0x34')](db['Schedule'][_0x40be('0x49')]);_0x39bc67[_0x40be('0x35')]=_['keys'](_0x398cd2[_0x40be('0x35')]);_0x39bc67[_0x40be('0x4a')]=_[_0x40be('0x36')](_0x39bc67['model'],_0x39bc67[_0x40be('0x35')]);_0x1a5958['attributes']=_[_0x40be('0x36')](_0x39bc67['model'],qs['fields'](_0x398cd2[_0x40be('0x35')][_0x40be('0x37')]));_0x1a5958[_0x40be('0x38')]=_0x1a5958[_0x40be('0x38')][_0x40be('0x4b')]?_0x1a5958[_0x40be('0x38')]:_0x39bc67[_0x40be('0x33')];if(_0x398cd2[_0x40be('0x35')]['includeAll']){_0x1a5958[_0x40be('0x43')]=[{'all':!![]}];}_0x1a5958=_[_0x40be('0x3f')]({},_0x1a5958,_0x398cd2[_0x40be('0x41')]);return db['Schedule']['find'](_0x1a5958)[_0x40be('0x28')](handleEntityNotFound(_0x56162b,null))[_0x40be('0x28')](respondWithResult(_0x56162b,null))[_0x40be('0x46')](handleError(_0x56162b,null));};exports[_0x40be('0x4c')]=function(_0x1d7140,_0x5e14b9){return db['Schedule'][_0x40be('0x4c')](_0x1d7140['body'],{})[_0x40be('0x28')](function(_0x573f5f){var _0x33a2dd=_0x1d7140[_0x40be('0x4d')][_0x40be('0x4e')]({'plain':!![]});if(!_0x33a2dd)throw new Error(_0x40be('0x4f'));if(_0x33a2dd['role']===_0x40be('0x4d')){var _0xd5fca1=_0x573f5f[_0x40be('0x4e')]({'plain':!![]});var _0x4916f3='Scheduler';return db[_0x40be('0x50')][_0x40be('0x51')]({'where':{'name':_0x4916f3,'userProfileId':_0x33a2dd['userProfileId']},'raw':!![]})['then'](function(_0x8fa7fc){if(_0x8fa7fc&&_0x8fa7fc[_0x40be('0x52')]===0x0){return db[_0x40be('0x2b')][_0x40be('0x4c')]({'name':_0xd5fca1['name'],'resourceId':_0xd5fca1['id'],'type':_0x8fa7fc[_0x40be('0x2d')],'sectionId':_0x8fa7fc['id']},{})[_0x40be('0x28')](function(){return _0x573f5f;});}else{return _0x573f5f;}})[_0x40be('0x46')](function(_0x19f6d0){logger[_0x40be('0x53')](_0x40be('0x54'),_0x19f6d0);throw _0x19f6d0;});}return _0x573f5f;})['then'](respondWithResult(_0x5e14b9,0xc9))[_0x40be('0x46')](handleError(_0x5e14b9,null));};exports[_0x40be('0x55')]=function(_0x22d3cd,_0x41fd1f){if(_0x22d3cd[_0x40be('0x56')]['id']){delete _0x22d3cd[_0x40be('0x56')]['id'];}return db['Schedule']['find']({'where':{'id':_0x22d3cd[_0x40be('0x48')]['id']}})['then'](handleEntityNotFound(_0x41fd1f,null))[_0x40be('0x28')](saveUpdates(_0x22d3cd['body'],null))[_0x40be('0x28')](respondWithResult(_0x41fd1f,null))['catch'](handleError(_0x41fd1f,null));};exports['destroy']=function(_0x411a53,_0x5c3719){return db[_0x40be('0x44')][_0x40be('0x51')]({'where':{'id':_0x411a53[_0x40be('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c3719,null))['then'](removeEntity(_0x5c3719,null))[_0x40be('0x46')](handleError(_0x5c3719,null));};exports[_0x40be('0x57')]=function(_0x3dccb6,_0x330f72,_0x32d236){var _0x499319=require('../../config/schedule');return db[_0x40be('0x44')][_0x40be('0x51')]({'where':{'id':_0x3dccb6[_0x40be('0x48')]['id']},'raw':!![]})[_0x40be('0x28')](handleEntityNotFound(_0x330f72,null))['then'](function(){_0x499319[_0x40be('0x57')](_0x3dccb6['params']['id']);})[_0x40be('0x28')](respondWithStatusCode(_0x330f72,null))[_0x40be('0x46')](handleError(_0x330f72,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0449379..ced8f5b 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 _0xe1ab=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','util','../../config/logger','api','moment'];(function(_0x15f7c6,_0x305ae6){var _0x3cf46f=function(_0x176111){while(--_0x176111){_0x15f7c6['push'](_0x15f7c6['shift']());}};_0x3cf46f(++_0x305ae6);}(_0xe1ab,0xe6));var _0xbe1a=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0xe1ab[_0x5517c0];return _0x33803b;};'use strict';var _=require('lodash');var util=require(_0xbe1a('0x0'));var logger=require(_0xbe1a('0x1'))(_0xbe1a('0x2'));var moment=require(_0xbe1a('0x3'));var BPromise=require(_0xbe1a('0x4'));var rp=require(_0xbe1a('0x5'));var fs=require('fs');var path=require(_0xbe1a('0x6'));var rimraf=require(_0xbe1a('0x7'));var config=require(_0xbe1a('0x8'));var attributes=require(_0xbe1a('0x9'));module[_0xbe1a('0xa')]=function(_0x79f515,_0x39c237){return _0x79f515['define'](_0xbe1a('0xb'),attributes,{'tableName':_0xbe1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x881b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash','util','../../config/logger'];(function(_0x1d5643,_0x7a02a1){var _0x2cdc60=function(_0x1bcd0b){while(--_0x1bcd0b){_0x1d5643['push'](_0x1d5643['shift']());}};_0x2cdc60(++_0x7a02a1);}(_0x881b,0x1c5));var _0xb881=function(_0x4adacf,_0x5d461c){_0x4adacf=_0x4adacf-0x0;var _0x56d0c0=_0x881b[_0x4adacf];return _0x56d0c0;};'use strict';var _=require(_0xb881('0x0'));var util=require(_0xb881('0x1'));var logger=require(_0xb881('0x2'))('api');var moment=require(_0xb881('0x3'));var BPromise=require(_0xb881('0x4'));var rp=require(_0xb881('0x5'));var fs=require('fs');var path=require(_0xb881('0x6'));var rimraf=require(_0xb881('0x7'));var config=require(_0xb881('0x8'));var attributes=require(_0xb881('0x9'));module['exports']=function(_0x36c839,_0x1416a6){return _0x36c839[_0xb881('0xa')](_0xb881('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 3f90960..bed23de 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 _0x0e3f=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b4392,_0x527639){var _0x110155=function(_0x59154e){while(--_0x59154e){_0x5b4392['push'](_0x5b4392['shift']());}};_0x110155(++_0x527639);}(_0x0e3f,0x124));var _0xf0e3=function(_0x11dbb3,_0x3dd1b7){_0x11dbb3=_0x11dbb3-0x0;var _0x198394=_0x0e3f[_0x11dbb3];return _0x198394;};'use strict';var _=require(_0xf0e3('0x0'));var util=require('util');var moment=require(_0xf0e3('0x1'));var BPromise=require(_0xf0e3('0x2'));var rs=require(_0xf0e3('0x3'));var fs=require('fs');var Redis=require(_0xf0e3('0x4'));var db=require(_0xf0e3('0x5'))['db'];var utils=require(_0xf0e3('0x6'));var logger=require(_0xf0e3('0x7'))(_0xf0e3('0x8'));var config=require(_0xf0e3('0x9'));var jayson=require(_0xf0e3('0xa'));var client=jayson[_0xf0e3('0xb')][_0xf0e3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf98c07,_0x4a04fd,_0x248bf8){return new BPromise(function(_0x2149fa,_0x107433){return client[_0xf0e3('0xd')](_0xf98c07,_0x248bf8)[_0xf0e3('0xe')](function(_0x4ddd75){logger['info'](_0xf0e3('0xf'),_0x4a04fd,_0xf0e3('0x10'));logger[_0xf0e3('0x11')](_0xf0e3('0x12'),_0x4a04fd,_0xf0e3('0x10'),JSON[_0xf0e3('0x13')](_0x4ddd75));if(_0x4ddd75[_0xf0e3('0x14')]){if(_0x4ddd75[_0xf0e3('0x14')][_0xf0e3('0x15')]===0x1f4){logger[_0xf0e3('0x14')](_0xf0e3('0xf'),_0x4a04fd,_0x4ddd75[_0xf0e3('0x14')][_0xf0e3('0x16')]);return _0x107433(_0x4ddd75[_0xf0e3('0x14')]['message']);}logger[_0xf0e3('0x14')](_0xf0e3('0xf'),_0x4a04fd,_0x4ddd75[_0xf0e3('0x14')][_0xf0e3('0x16')]);return _0x2149fa(_0x4ddd75[_0xf0e3('0x14')]['message']);}else{logger[_0xf0e3('0x17')]('Schedule,\x20%s,\x20%s',_0x4a04fd,'request\x20sent');_0x2149fa(_0x4ddd75[_0xf0e3('0x18')][_0xf0e3('0x16')]);}})[_0xf0e3('0x19')](function(_0x2b5610){logger['error'](_0xf0e3('0xf'),_0x4a04fd,_0x2b5610);_0x107433(_0x2b5610);});});} \ No newline at end of file +var _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x4a8a0f,_0x2a7b15){var _0x6ca8fe=function(_0x40c8c8){while(--_0x40c8c8){_0x4a8a0f['push'](_0x4a8a0f['shift']());}};_0x6ca8fe(++_0x2a7b15);}(_0x0624,0x14e));var _0x4062=function(_0x51d9c7,_0x47e579){_0x51d9c7=_0x51d9c7-0x0;var _0x43a887=_0x0624[_0x51d9c7];return _0x43a887;};'use strict';var _=require('lodash');var util=require(_0x4062('0x0'));var moment=require(_0x4062('0x1'));var BPromise=require('bluebird');var rs=require(_0x4062('0x2'));var fs=require('fs');var Redis=require(_0x4062('0x3'));var db=require(_0x4062('0x4'))['db'];var utils=require(_0x4062('0x5'));var logger=require(_0x4062('0x6'))(_0x4062('0x7'));var config=require(_0x4062('0x8'));var jayson=require(_0x4062('0x9'));var client=jayson[_0x4062('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x88d124,_0x4723f9,_0x6185be){return new BPromise(function(_0x3edbe1,_0x303116){return client['request'](_0x88d124,_0x6185be)['then'](function(_0x1f9687){logger[_0x4062('0xb')](_0x4062('0xc'),_0x4723f9,_0x4062('0xd'));logger[_0x4062('0xe')](_0x4062('0xf'),_0x4723f9,_0x4062('0xd'),JSON['stringify'](_0x1f9687));if(_0x1f9687[_0x4062('0x10')]){if(_0x1f9687['error'][_0x4062('0x11')]===0x1f4){logger[_0x4062('0x10')](_0x4062('0xc'),_0x4723f9,_0x1f9687[_0x4062('0x10')][_0x4062('0x12')]);return _0x303116(_0x1f9687[_0x4062('0x10')]['message']);}logger[_0x4062('0x10')](_0x4062('0xc'),_0x4723f9,_0x1f9687['error'][_0x4062('0x12')]);return _0x3edbe1(_0x1f9687[_0x4062('0x10')][_0x4062('0x12')]);}else{logger[_0x4062('0xb')](_0x4062('0xc'),_0x4723f9,'request\x20sent');_0x3edbe1(_0x1f9687[_0x4062('0x13')][_0x4062('0x12')]);}})[_0x4062('0x14')](function(_0x1df338){logger['error'](_0x4062('0xc'),_0x4723f9,_0x1df338);_0x303116(_0x1df338);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index df0f065..f34490b 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 _0x30d6=['isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','create','update','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get'];(function(_0x55a136,_0x411f26){var _0x825b0=function(_0x22960a){while(--_0x22960a){_0x55a136['push'](_0x55a136['shift']());}};_0x825b0(++_0x411f26);}(_0x30d6,0x70));var _0x630d=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x30d6[_0x16ea87];return _0x6e7b1c;};'use strict';var multer=require('multer');var util=require(_0x630d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x630d('0x1'));var router=express[_0x630d('0x2')]();var fs_extra=require(_0x630d('0x3'));var auth=require(_0x630d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x630d('0x5'));var controller=require(_0x630d('0x6'));router[_0x630d('0x7')]('/',auth[_0x630d('0x8')](),controller[_0x630d('0x9')]);router[_0x630d('0x7')](_0x630d('0xa'),auth['isAuthenticated'](),controller[_0x630d('0xb')]);router['get'](_0x630d('0xc'),auth[_0x630d('0x8')](),controller[_0x630d('0xd')]);router[_0x630d('0x7')](_0x630d('0xe'),auth[_0x630d('0x8')](),controller[_0x630d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x630d('0x10')]);router['put'](_0x630d('0xc'),auth[_0x630d('0x8')](),controller[_0x630d('0x11')]);router['delete'](_0x630d('0xc'),auth[_0x630d('0x8')](),controller[_0x630d('0x12')]);module[_0x630d('0x13')]=router; \ No newline at end of file +var _0x206a=['index','/describe','isAuthenticated','/:id','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x206a,0x96));var _0xa206=function(_0x49905e,_0x1c9791){_0x49905e=_0x49905e-0x0;var _0x57d5dd=_0x206a[_0x49905e];return _0x57d5dd;};'use strict';var multer=require(_0xa206('0x0'));var util=require(_0xa206('0x1'));var path=require(_0xa206('0x2'));var timeout=require(_0xa206('0x3'));var express=require(_0xa206('0x4'));var router=express[_0xa206('0x5')]();var fs_extra=require(_0xa206('0x6'));var auth=require(_0xa206('0x7'));var interaction=require(_0xa206('0x8'));var config=require(_0xa206('0x9'));var controller=require('./screenRecording.controller');router[_0xa206('0xa')]('/',auth['isAuthenticated'](),controller[_0xa206('0xb')]);router['get'](_0xa206('0xc'),auth[_0xa206('0xd')](),controller['describe']);router['get'](_0xa206('0xe'),auth[_0xa206('0xd')](),controller['show']);router[_0xa206('0xa')](_0xa206('0xf'),auth[_0xa206('0xd')](),controller[_0xa206('0x10')]);router[_0xa206('0x11')]('/',auth[_0xa206('0xd')](),controller[_0xa206('0x12')]);router['put']('/:id',auth[_0xa206('0xd')](),controller[_0xa206('0x13')]);router[_0xa206('0x14')](_0xa206('0xe'),auth['isAuthenticated'](),controller[_0xa206('0x15')]);module[_0xa206('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 35279a7..43d8a11 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 _0xc373=['path','../../config/environment','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','closedAt','duration','DATE','startedAt','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','moment'];(function(_0x1df96b,_0x43adb2){var _0x365e04=function(_0x36cdcd){while(--_0x36cdcd){_0x1df96b['push'](_0x1df96b['shift']());}};_0x365e04(++_0x43adb2);}(_0xc373,0x1c7));var _0x3c37=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0xc373[_0xa4f636];return _0x37e02a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c37('0x0'));var path=require(_0x3c37('0x1'));var config=require(_0x3c37('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3c37('0x3')](_0x3c37('0x4'))?path[_0x3c37('0x5')](this[_0x3c37('0x3')](_0x3c37('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x3c37('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x2e1941){var _0x1244e6=_0x2e1941[_0x3c37('0x7')](/\\/g,'/');this[_0x3c37('0x8')](_0x3c37('0x4'),_0x1244e6);}},'rating':{'type':Sequelize[_0x3c37('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3c37('0x9')],'set':function(_0x59d4f9){this[_0x3c37('0x8')]('startedAt',moment()['subtract'](_0x59d4f9,'ms'));this[_0x3c37('0x8')](_0x3c37('0xa'),moment());this[_0x3c37('0x8')](_0x3c37('0xb'),_0x59d4f9);}},'startedAt':{'type':Sequelize[_0x3c37('0xc')],'get':function(){return moment(this[_0x3c37('0x3')](_0x3c37('0xd')))['format'](_0x3c37('0xe'))[_0x3c37('0xf')]();}},'closedAt':{'type':Sequelize[_0x3c37('0xc')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x3c37('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x3c37('0xc')],'get':function(){return moment(this[_0x3c37('0x3')](_0x3c37('0x11')))[_0x3c37('0x10')](_0x3c37('0xe'))[_0x3c37('0xf')]();}},'updatedAt':{'type':Sequelize[_0x3c37('0xc')],'get':function(){return moment(this[_0x3c37('0x3')](_0x3c37('0x12')))['format'](_0x3c37('0xe'))[_0x3c37('0xf')]();}}}; \ No newline at end of file +var _0x964b=['updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','getDataValue','format','toString','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x217c43,_0x4c6e6d){var _0x4ff329=function(_0x4131e3){while(--_0x4131e3){_0x217c43['push'](_0x217c43['shift']());}};_0x4ff329(++_0x4c6e6d);}(_0x964b,0x112));var _0xb964=function(_0x124106,_0x13a817){_0x124106=_0x124106-0x0;var _0x483eaf=_0x964b[_0x124106];return _0x483eaf;};'use strict';var Sequelize=require(_0xb964('0x0'));var moment=require(_0xb964('0x1'));var path=require('path');var config=require(_0xb964('0x2'));module[_0xb964('0x3')]={'format':{'type':Sequelize[_0xb964('0x4')],'get':function(){return this['getDataValue']('value')?path[_0xb964('0x5')](this['getDataValue'](_0xb964('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb964('0x7')]},'channel':{'type':Sequelize[_0xb964('0x7')]},'value':{'type':Sequelize[_0xb964('0x7')],'set':function(_0x204c7d){var _0xde47d5=_0x204c7d[_0xb964('0x8')](/\\/g,'/');this['setDataValue']('value',_0xde47d5);}},'rating':{'type':Sequelize[_0xb964('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x55e697){this[_0xb964('0xa')](_0xb964('0xb'),moment()[_0xb964('0xc')](_0x55e697,'ms'));this[_0xb964('0xa')](_0xb964('0xd'),moment());this[_0xb964('0xa')]('duration',_0x55e697);}},'startedAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0xb')))[_0xb964('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb964('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb964('0xd')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}},'createdAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x13')))['format'](_0xb964('0x12'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x14')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6c5dd8f..f045895 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 _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','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','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x0e85,0x7c));var _0x50e8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x0e85[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file +var _0x2eb2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf'];(function(_0x2ac0b0,_0x115490){var _0x352688=function(_0xbd450e){while(--_0xbd450e){_0x2ac0b0['push'](_0x2ac0b0['shift']());}};_0x352688(++_0x115490);}(_0x2eb2,0x19f));var _0x22eb=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2eb2[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x2c')](_['map'](_0x1599c7,_0x22eb('0x24')),[_0x22eb('0x2d')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x49dd59[_0x22eb('0x2e')]);_0x44cf91[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x44cf91[_0x22eb('0x32')],_0x44cf91[_0x22eb('0x2e')]);_0x25e5bc[_0x22eb('0x33')]=_['intersection'](_0x44cf91['model'],qs[_0x22eb('0x34')](_0x49dd59['query']['fields']));_0x25e5bc[_0x22eb('0x33')]=_0x25e5bc[_0x22eb('0x33')][_0x22eb('0x35')]?_0x25e5bc[_0x22eb('0x33')]:_0x44cf91[_0x22eb('0x32')];if(!_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x36')](_0x22eb('0x37'))){_0x25e5bc[_0x22eb('0x38')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc['offset']=qs['offset'](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x19')]);}_0x25e5bc['order']=qs[_0x22eb('0x39')](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x39')]);_0x25e5bc[_0x22eb('0x3a')]=qs[_0x22eb('0x30')](_['pick'](_0x49dd59[_0x22eb('0x2e')],_0x44cf91[_0x22eb('0x30')]),_0x1599c7);if(_0x49dd59['query'][_0x22eb('0x3b')]){_0x25e5bc[_0x22eb('0x3a')]=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x3a')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x5382eb){if(_0x5382eb['type']!==_0x22eb('0x3d')){var _0x6cd651={};_0x6cd651[_0x5382eb['name']]={'$like':'%'+_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3b')]+'%'};return _0x6cd651;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59['options']);var _0x1d977c={'where':_0x25e5bc[_0x22eb('0x3a')]};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x1d977c)[_0x22eb('0x20')](function(_0x39778e){_0x7c0119['count']=_0x39778e;if(_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x25e5bc['include']=[{'all':!![]}];}return db[_0x22eb('0x27')][_0x22eb('0x3f')](_0x25e5bc);})[_0x22eb('0x20')](function(_0x30cb10){_0x7c0119[_0x22eb('0x40')]=_0x30cb10;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x41')](handleError(_0x2a950e,null));};exports[_0x22eb('0x42')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={'raw':![],'where':{'id':_0x1bafa3[_0x22eb('0x43')]['id']}},_0x1cf1e0={};_0x1cf1e0[_0x22eb('0x32')]=_[_0x22eb('0x2f')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x1cf1e0[_0x22eb('0x2e')]=_['keys'](_0x1bafa3[_0x22eb('0x2e')]);_0x1cf1e0[_0x22eb('0x30')]=_['intersection'](_0x1cf1e0[_0x22eb('0x32')],_0x1cf1e0[_0x22eb('0x2e')]);_0x3e1826['attributes']=_['intersection'](_0x1cf1e0['model'],qs[_0x22eb('0x34')](_0x1bafa3[_0x22eb('0x2e')]['fields']));_0x3e1826['attributes']=_0x3e1826[_0x22eb('0x33')][_0x22eb('0x35')]?_0x3e1826[_0x22eb('0x33')]:_0x1cf1e0[_0x22eb('0x32')];if(_0x1bafa3[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x3e1826[_0x22eb('0x44')]=[{'all':!![]}];}_0x3e1826=_[_0x22eb('0x3c')]({},_0x3e1826,_0x1bafa3['options']);return db['ScreenRecording'][_0x22eb('0x45')](_0x3e1826)['then'](handleEntityNotFound(_0x82ace8,null))[_0x22eb('0x20')](respondWithResult(_0x82ace8,null))['catch'](handleError(_0x82ace8,null));};exports[_0x22eb('0x46')]=function(_0x5c41c0,_0x4b2f86){return db['ScreenRecording']['create'](_0x5c41c0[_0x22eb('0x47')],{})['then'](respondWithResult(_0x4b2f86,0xc9))[_0x22eb('0x41')](handleError(_0x4b2f86,null));};exports[_0x22eb('0x1f')]=function(_0x490bef,_0x24e6ba){if(_0x490bef['body']['id']){delete _0x490bef[_0x22eb('0x47')]['id'];}delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x48')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x49')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4a')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4b')];return db['ScreenRecording'][_0x22eb('0x45')]({'where':{'id':_0x490bef[_0x22eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e6ba,null))[_0x22eb('0x20')](saveUpdates(_0x490bef[_0x22eb('0x47')],null))[_0x22eb('0x20')](respondWithResult(_0x24e6ba,null))[_0x22eb('0x41')](handleError(_0x24e6ba,null));};exports['describe']=function(_0x6c0600,_0x169ae1){return db[_0x22eb('0x27')][_0x22eb('0x4c')]()[_0x22eb('0x20')](respondWithResult(_0x169ae1,null))[_0x22eb('0x41')](handleError(_0x169ae1,null));};exports['download']=function(_0x29d7ca,_0x4e5b9f,_0x3ff406){var _0x5eecef=require(_0x22eb('0x4d'));var _0x254b53=![];var _0x4028ef={};if(_0x29d7ca[_0x22eb('0x2e')][_0x22eb('0x2a')]&&_0x29d7ca['query']['type']===_0x22eb('0x4e')){_0x4028ef[_0x22eb('0x4e')]=_0x29d7ca['params']['id'];}else{_0x4028ef['id']=_0x29d7ca[_0x22eb('0x43')]['id'];}return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':_0x4028ef,'attributes':['id',_0x22eb('0x4b')],'raw':!![]})[_0x22eb('0x20')](handleEntityNotFound(_0x4e5b9f,null))[_0x22eb('0x20')](function(_0x3a8588){if(_0x3a8588){var _0x35c997=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x3a8588['value']);var _0x19cadf=util[_0x22eb('0x2d')](_0x22eb('0x52'),_0x35c997);if(fs[_0x22eb('0x53')](_0x19cadf)){_0x254b53=!![];return _0x5eecef[_0x22eb('0x54')](_0x19cadf,_0x35c997,config[_0x22eb('0x55')][_0x22eb('0x56')])[_0x22eb('0x20')](function(){return _0x3a8588;});}return _0x3a8588;}})[_0x22eb('0x20')](function(_0x9f8465){if(_0x9f8465){var _0x3e9ab5=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x9f8465['value']);if(!fs['existsSync'](_0x3e9ab5)){throw new db[(_0x22eb('0x57'))][(_0x22eb('0x58'))](_0x22eb('0x59'));}if(_0x9f8465[_0x22eb('0x5a')]){return _0x4e5b9f[_0x22eb('0x5b')](_0x3e9ab5,_0x9f8465['filename']+path[_0x22eb('0x5c')](_0x3e9ab5),function(){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}else{return _0x4e5b9f['download'](_0x3e9ab5,function(_0x485408){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}}})[_0x22eb('0x41')](function(_0xb5c8ae){if(_0xb5c8ae[_0x22eb('0x5e')]===_0x22eb('0x59')){_0x4e5b9f[_0x22eb('0x17')](0x194)[_0x22eb('0x25')](_0x22eb('0x5f'));}else{return handleError(_0x4e5b9f,null);}});};exports[_0x22eb('0x21')]=function(_0x19b579,_0x164645){return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':{'id':_0x19b579[_0x22eb('0x43')]['id']}})['then'](function(_0x29dd8b){if(_[_0x22eb('0x60')](_0x29dd8b)){throw new ReferenceError(_0x22eb('0x61'));}return _0x29dd8b;})['then'](function(_0x1787ec){var _0x5ac4c5=path[_0x22eb('0x4f')](config['root'],_0x22eb('0x51'),_0x1787ec[_0x22eb('0x4b')]);logger['info'](_0x22eb('0x62'),_0x5ac4c5);if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs['existsSync'](_0x5ac4c5)){logger[_0x22eb('0x63')](_0x22eb('0x64')+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}_0x5ac4c5=_0x5ac4c5+_0x22eb('0x67');if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs[_0x22eb('0x53')](_0x5ac4c5)){logger['info']('File:\x20\x22'+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}return _0x1787ec;})[_0x22eb('0x20')](function(_0x22b5c6){if(!_0x22b5c6)throw new InternalError();return _0x22b5c6[_0x22eb('0x21')]();})[_0x22eb('0x20')](function(){_0x164645[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();})['catch'](handleError(_0x164645,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 16514e8..041794e 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 _0xa221=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x2a0724,_0x376cb2){var _0x2b5a46=function(_0x211534){while(--_0x211534){_0x2a0724['push'](_0x2a0724['shift']());}};_0x2b5a46(++_0x376cb2);}(_0xa221,0x1ba));var _0x1a22=function(_0x58bf15,_0x4dddac){_0x58bf15=_0x58bf15-0x0;var _0x4d0e62=_0xa221[_0x58bf15];return _0x4d0e62;};'use strict';var _=require(_0x1a22('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1a22('0x1'));var moment=require(_0x1a22('0x2'));var BPromise=require(_0x1a22('0x3'));var rp=require(_0x1a22('0x4'));var fs=require('fs');var path=require(_0x1a22('0x5'));var rimraf=require(_0x1a22('0x6'));var config=require(_0x1a22('0x7'));var attributes=require(_0x1a22('0x8'));module['exports']=function(_0x130e24,_0x59f80a){return _0x130e24[_0x1a22('0x9')](_0x1a22('0xa'),attributes,{'tableName':_0x1a22('0xb'),'paranoid':![],'indexes':[{'name':_0x1a22('0xc'),'fields':[_0x1a22('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2145=['api','moment','bluebird','request-promise','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x2145,0x1d2));var _0x5214=function(_0x30c56e,_0x4a0230){_0x30c56e=_0x30c56e-0x0;var _0x413241=_0x2145[_0x30c56e];return _0x413241;};'use strict';var _=require('lodash');var util=require(_0x5214('0x0'));var logger=require(_0x5214('0x1'))(_0x5214('0x2'));var moment=require(_0x5214('0x3'));var BPromise=require(_0x5214('0x4'));var rp=require(_0x5214('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5214('0x6'));var config=require('../../config/environment');var attributes=require(_0x5214('0x7'));module[_0x5214('0x8')]=function(_0x53bf92,_0x5732f6){return _0x53bf92[_0x5214('0x9')]('ScreenRecording',attributes,{'tableName':_0x5214('0xa'),'paranoid':![],'indexes':[{'name':_0x5214('0xb'),'fields':[_0x5214('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8b5b1f6..e4d8af6 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 _0x1689=['code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x208116,_0x24b0e8){var _0x1f546d=function(_0x3d8cb7){while(--_0x3d8cb7){_0x208116['push'](_0x208116['shift']());}};_0x1f546d(++_0x24b0e8);}(_0x1689,0x97));var _0x9168=function(_0x366047,_0x23b97a){_0x366047=_0x366047-0x0;var _0x243213=_0x1689[_0x366047];return _0x243213;};'use strict';var _=require(_0x9168('0x0'));var util=require(_0x9168('0x1'));var moment=require('moment');var BPromise=require(_0x9168('0x2'));var rs=require(_0x9168('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9168('0x4'))['db'];var utils=require(_0x9168('0x5'));var logger=require('../../config/logger')(_0x9168('0x6'));var config=require('../../config/environment');var jayson=require(_0x9168('0x7'));var client=jayson[_0x9168('0x8')][_0x9168('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19d6ab,_0x3ab503,_0x6169cc){return new BPromise(function(_0x1e08bd,_0x251f57){return client[_0x9168('0xa')](_0x19d6ab,_0x6169cc)['then'](function(_0x21742e){logger[_0x9168('0xb')](_0x9168('0xc'),_0x3ab503,_0x9168('0xd'));logger['debug'](_0x9168('0xe'),_0x3ab503,'request\x20sent',JSON[_0x9168('0xf')](_0x21742e));if(_0x21742e[_0x9168('0x10')]){if(_0x21742e[_0x9168('0x10')][_0x9168('0x11')]===0x1f4){logger[_0x9168('0x10')](_0x9168('0xc'),_0x3ab503,_0x21742e[_0x9168('0x10')][_0x9168('0x12')]);return _0x251f57(_0x21742e[_0x9168('0x10')]['message']);}logger[_0x9168('0x10')](_0x9168('0xc'),_0x3ab503,_0x21742e['error'][_0x9168('0x12')]);return _0x1e08bd(_0x21742e[_0x9168('0x10')][_0x9168('0x12')]);}else{logger[_0x9168('0xb')](_0x9168('0xc'),_0x3ab503,_0x9168('0xd'));_0x1e08bd(_0x21742e[_0x9168('0x13')][_0x9168('0x12')]);}})[_0x9168('0x14')](function(_0x475593){logger['error'](_0x9168('0xc'),_0x3ab503,_0x475593);_0x251f57(_0x475593);});});} \ No newline at end of file +var _0x6aec=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3eb85a,_0xc9d2f){var _0x31a5ad=function(_0x316e1c){while(--_0x316e1c){_0x3eb85a['push'](_0x3eb85a['shift']());}};_0x31a5ad(++_0xc9d2f);}(_0x6aec,0x118));var _0xc6ae=function(_0x5a4113,_0x176853){_0x5a4113=_0x5a4113-0x0;var _0x2aaaf1=_0x6aec[_0x5a4113];return _0x2aaaf1;};'use strict';var _=require(_0xc6ae('0x0'));var util=require(_0xc6ae('0x1'));var moment=require(_0xc6ae('0x2'));var BPromise=require(_0xc6ae('0x3'));var rs=require(_0xc6ae('0x4'));var fs=require('fs');var Redis=require(_0xc6ae('0x5'));var db=require(_0xc6ae('0x6'))['db'];var utils=require(_0xc6ae('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc6ae('0x8'));var jayson=require(_0xc6ae('0x9'));var client=jayson[_0xc6ae('0xa')][_0xc6ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1244ee,_0x2bcaae,_0x3dcac4){return new BPromise(function(_0x12ea26,_0x38d1d2){return client[_0xc6ae('0xc')](_0x1244ee,_0x3dcac4)[_0xc6ae('0xd')](function(_0x4ead3c){logger[_0xc6ae('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x2bcaae,_0xc6ae('0xf'));logger['debug'](_0xc6ae('0x10'),_0x2bcaae,_0xc6ae('0xf'),JSON[_0xc6ae('0x11')](_0x4ead3c));if(_0x4ead3c[_0xc6ae('0x12')]){if(_0x4ead3c[_0xc6ae('0x12')]['code']===0x1f4){logger[_0xc6ae('0x12')](_0xc6ae('0x13'),_0x2bcaae,_0x4ead3c['error']['message']);return _0x38d1d2(_0x4ead3c[_0xc6ae('0x12')][_0xc6ae('0x14')]);}logger[_0xc6ae('0x12')](_0xc6ae('0x13'),_0x2bcaae,_0x4ead3c[_0xc6ae('0x12')][_0xc6ae('0x14')]);return _0x12ea26(_0x4ead3c[_0xc6ae('0x12')]['message']);}else{logger['info'](_0xc6ae('0x13'),_0x2bcaae,_0xc6ae('0xf'));_0x12ea26(_0x4ead3c[_0xc6ae('0x15')][_0xc6ae('0x14')]);}})['catch'](function(_0x5a4f76){logger[_0xc6ae('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x2bcaae,_0x5a4f76);_0x38d1d2(_0x5a4f76);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 0129074..bc53cd2 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 _0x79dc=['/:id/logo','get','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','logologin','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','/:id','isAuthenticated','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','index','/now','getDate','show'];(function(_0x208af9,_0x428504){var _0x34e94b=function(_0x48aa03){while(--_0x48aa03){_0x208af9['push'](_0x208af9['shift']());}};_0x34e94b(++_0x428504);}(_0x79dc,0xd5));var _0xc79d=function(_0x1630aa,_0x352049){_0x1630aa=_0x1630aa-0x0;var _0x1dbf43=_0x79dc[_0x1630aa];return _0x1dbf43;};'use strict';var multer=require(_0xc79d('0x0'));var util=require(_0xc79d('0x1'));var path=require(_0xc79d('0x2'));var timeout=require('connect-timeout');var express=require(_0xc79d('0x3'));var router=express['Router']();var fs_extra=require(_0xc79d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc79d('0x5'));var config=require(_0xc79d('0x6'));var controller=require(_0xc79d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc79d('0x8')]);router['get'](_0xc79d('0x9'),controller[_0xc79d('0xa')]);router['get']('/:id',controller[_0xc79d('0xb')]);router['get'](_0xc79d('0xc'),controller['getLogo']);router[_0xc79d('0xd')](_0xc79d('0xe'),controller[_0xc79d('0xf')]);router[_0xc79d('0xd')](_0xc79d('0x10'),controller[_0xc79d('0x11')]);router['get']('/:id/preferred',controller[_0xc79d('0x12')]);router[_0xc79d('0xd')](_0xc79d('0x13'),controller[_0xc79d('0x14')]);var upload=multer({'storage':multer[_0xc79d('0x15')]({'destination':function(_0x46d9b1,_0x278729,_0x32bdf4){_0x32bdf4(null,path[_0xc79d('0x16')](config[_0xc79d('0x17')],_0xc79d('0x18')));},'filename':function(_0x31087c,_0xbfe37b,_0x4ec2bb){_0x4ec2bb(null,util[_0xc79d('0x19')](_0xc79d('0x1a'),_0xc79d('0x1b'),path[_0xc79d('0x1c')](_0xbfe37b[_0xc79d('0x1d')])));}})});router[_0xc79d('0x1e')](_0xc79d('0xc'),upload[_0xc79d('0x1f')](_0xc79d('0x20')),controller['addLogo']);var upload=multer({'storage':multer[_0xc79d('0x15')]({'destination':function(_0x2a131f,_0x3c687e,_0x26653a){_0x26653a(null,path[_0xc79d('0x16')](config[_0xc79d('0x17')],_0xc79d('0x18')));},'filename':function(_0x480a91,_0x4e28ea,_0x123933){_0x123933(null,util[_0xc79d('0x19')](_0xc79d('0x1a'),_0xc79d('0x21'),path[_0xc79d('0x1c')](_0x4e28ea[_0xc79d('0x1d')])));}})});router[_0xc79d('0x1e')](_0xc79d('0xe'),upload[_0xc79d('0x1f')]('file'),controller[_0xc79d('0x22')]);var upload=multer({'storage':multer[_0xc79d('0x15')]({'destination':function(_0x193d05,_0x26f4f2,_0x4bc421){_0x4bc421(null,path[_0xc79d('0x16')](config[_0xc79d('0x17')],_0xc79d('0x18')));},'filename':function(_0x5642f8,_0x58e320,_0x396a2b){_0x396a2b(null,util['format'](_0xc79d('0x1a'),_0xc79d('0x23'),path[_0xc79d('0x1c')](_0x58e320[_0xc79d('0x1d')])));}})});router['post'](_0xc79d('0x24'),upload[_0xc79d('0x1f')]('file'),controller[_0xc79d('0x25')]);var upload=multer({'storage':multer[_0xc79d('0x15')]({'destination':function(_0x11a8a0,_0x57b629,_0x1665b6){_0x1665b6(null,path[_0xc79d('0x16')](config[_0xc79d('0x17')],_0xc79d('0x18')));},'filename':function(_0x1cf65a,_0xd28b59,_0x151f2d){_0x151f2d(null,util[_0xc79d('0x19')](_0xc79d('0x1a'),_0xc79d('0x26'),path['extname'](_0xd28b59[_0xc79d('0x1d')])));}})});router[_0xc79d('0x1e')](_0xc79d('0x13'),upload['single'](_0xc79d('0x20')),controller[_0xc79d('0x27')]);router[_0xc79d('0x28')](_0xc79d('0x29'),auth[_0xc79d('0x2a')](),controller[_0xc79d('0x2b')]);module[_0xc79d('0x2c')]=router; \ No newline at end of file +var _0xcbfa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','addLogo','join','root','single','file','preferred','addPreferred','addFavicon','isAuthenticated','exports','multer','util','path'];(function(_0x2d7b9f,_0x96bcf3){var _0x54983f=function(_0x305011){while(--_0x305011){_0x2d7b9f['push'](_0x2d7b9f['shift']());}};_0x54983f(++_0x96bcf3);}(_0xcbfa,0x75));var _0xacbf=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0xcbfa[_0x285c85];return _0x2f81cd;};'use strict';var multer=require(_0xacbf('0x0'));var util=require(_0xacbf('0x1'));var path=require(_0xacbf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xacbf('0x3')]();var fs_extra=require(_0xacbf('0x4'));var auth=require(_0xacbf('0x5'));var interaction=require(_0xacbf('0x6'));var config=require(_0xacbf('0x7'));var controller=require('./setting.controller');router[_0xacbf('0x8')]('/',auth['isAuthenticated'](),controller[_0xacbf('0x9')]);router[_0xacbf('0x8')](_0xacbf('0xa'),controller['getDate']);router['get'](_0xacbf('0xb'),controller[_0xacbf('0xc')]);router[_0xacbf('0x8')](_0xacbf('0xd'),controller['getLogo']);router[_0xacbf('0x8')](_0xacbf('0xe'),controller[_0xacbf('0xf')]);router[_0xacbf('0x8')](_0xacbf('0x10'),controller[_0xacbf('0x11')]);router[_0xacbf('0x8')](_0xacbf('0x12'),controller[_0xacbf('0x13')]);router[_0xacbf('0x8')](_0xacbf('0x14'),controller[_0xacbf('0x15')]);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x23005e,_0x5e1baa,_0x35e8bb){_0x35e8bb(null,path['join'](config['root'],_0xacbf('0x17')));},'filename':function(_0x467b9f,_0x53a051,_0x551ee0){_0x551ee0(null,util[_0xacbf('0x18')](_0xacbf('0x19'),_0xacbf('0x1a'),path[_0xacbf('0x1b')](_0x53a051[_0xacbf('0x1c')])));}})});router[_0xacbf('0x1d')](_0xacbf('0xd'),upload['single']('file'),controller[_0xacbf('0x1e')]);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x3ce2d2,_0x402d05,_0x5c4197){_0x5c4197(null,path[_0xacbf('0x1f')](config[_0xacbf('0x20')],_0xacbf('0x17')));},'filename':function(_0x5e7fc2,_0x549d36,_0x4597f){_0x4597f(null,util['format']('%s%s','logologin',path['extname'](_0x549d36[_0xacbf('0x1c')])));}})});router[_0xacbf('0x1d')]('/:id/logo_login',upload[_0xacbf('0x21')](_0xacbf('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x382915,_0x5ddfc7,_0x138ed9){_0x138ed9(null,path[_0xacbf('0x1f')](config[_0xacbf('0x20')],_0xacbf('0x17')));},'filename':function(_0x620f18,_0x13d3a6,_0x565b81){_0x565b81(null,util['format'](_0xacbf('0x19'),_0xacbf('0x23'),path['extname'](_0x13d3a6['originalname'])));}})});router[_0xacbf('0x1d')](_0xacbf('0x12'),upload[_0xacbf('0x21')](_0xacbf('0x22')),controller[_0xacbf('0x24')]);var upload=multer({'storage':multer[_0xacbf('0x16')]({'destination':function(_0x32717b,_0xc81789,_0x16b8c4){_0x16b8c4(null,path['join'](config[_0xacbf('0x20')],'server/files/images/logos/'));},'filename':function(_0x2d073d,_0xbd9879,_0x3b3167){_0x3b3167(null,util['format'](_0xacbf('0x19'),'favicon',path[_0xacbf('0x1b')](_0xbd9879[_0xacbf('0x1c')])));}})});router[_0xacbf('0x1d')](_0xacbf('0x14'),upload[_0xacbf('0x21')]('file'),controller[_0xacbf('0x25')]);router['put'](_0xacbf('0xb'),auth[_0xacbf('0x26')](),controller['update']);module[_0xacbf('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 b6e7d5a..cbaa463 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 _0xe682=['exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize'];(function(_0xd9c529,_0x19f8cc){var _0x146760=function(_0x1aa5e8){while(--_0x1aa5e8){_0xd9c529['push'](_0xd9c529['shift']());}};_0x146760(++_0x19f8cc);}(_0xe682,0x167));var _0x2e68=function(_0x181f81,_0x594c9c){_0x181f81=_0x181f81-0x0;var _0x25b0c6=_0xe682[_0x181f81];return _0x25b0c6;};'use strict';var Sequelize=require(_0x2e68('0x0'));module[_0x2e68('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2e68('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2e68('0x3')](0xb),'unique':_0x2e68('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2e68('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2e68('0x5')],'defaultValue':_0x2e68('0x6')},'logo':{'type':Sequelize[_0x2e68('0x5')]},'defaultLogo':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2e68('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2e68('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2e68('0x5')]},'turnaddr':{'type':Sequelize[_0x2e68('0x5')]},'turnusername':{'type':Sequelize[_0x2e68('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x2e68('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2e68('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2e68('0x5')],'defaultValue':_0x2e68('0x8')},'enableEmailPreview':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2e68('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2e68('0x5')]},'defaultFavicon':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2e68('0x3')]},'transcribeRegion':{'type':Sequelize[_0x2e68('0x5')]},'sentiment':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2e68('0x3')]},'sentimentRegion':{'type':Sequelize[_0x2e68('0x5')]},'language':{'type':Sequelize[_0x2e68('0x5')]},'bucket':{'type':Sequelize[_0x2e68('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2e68('0x3')](0x2)[_0x2e68('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x2e68('0x3')](0x2)[_0x2e68('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x2e68('0x3')](0x2)[_0x2e68('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x2e68('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x2e68('0x3')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x2e68('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xd716=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xd716,0x112));var _0x6d71=function(_0x16e3dc,_0x35770a){_0x16e3dc=_0x16e3dc-0x0;var _0x2f1001=_0xd716[_0x16e3dc];return _0x2f1001;};'use strict';var Sequelize=require('sequelize');module[_0x6d71('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x6d71('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6d71('0x2')](0xb),'unique':_0x6d71('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x6d71('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6d71('0x4')],'defaultValue':_0x6d71('0x5')},'logo':{'type':Sequelize[_0x6d71('0x4')]},'defaultLogo':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6d71('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6d71('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6d71('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x6d71('0x4')]},'turnpassword':{'type':Sequelize[_0x6d71('0x4')]},'pageTitle':{'type':Sequelize[_0x6d71('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6d71('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6d71('0x4')],'defaultValue':_0x6d71('0x7')},'enableEmailPreview':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6d71('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6d71('0x4')]},'defaultFavicon':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x6d71('0x4')]},'sentiment':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6d71('0x4')]},'bucket':{'type':Sequelize[_0x6d71('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6d71('0x2')](0x2)[_0x6d71('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6d71('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x6d71('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index e754742..d48638f 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 _0x4aa3=['default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','Sequelize','\x20not\x20found','download','../../config/license/util','default_loginLogo.svg','default','ValidationError','gdpr','addPreferred'];(function(_0x2cbc66,_0x55f960){var _0x1dbfbb=function(_0x5e76bf){while(--_0x5e76bf){_0x2cbc66['push'](_0x2cbc66['shift']());}};_0x1dbfbb(++_0x55f960);}(_0x4aa3,0x174));var _0x34aa=function(_0x4187c7,_0x1a9076){_0x4187c7=_0x4187c7-0x0;var _0x192d6c=_0x4aa3[_0x4187c7];return _0x192d6c;};'use strict';var emlformat=require(_0x34aa('0x0'));var rimraf=require(_0x34aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34aa('0x2'));var rp=require(_0x34aa('0x3'));var moment=require('moment');var BPromise=require(_0x34aa('0x4'));var Mustache=require(_0x34aa('0x5'));var util=require('util');var path=require(_0x34aa('0x6'));var sox=require(_0x34aa('0x7'));var csv=require(_0x34aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34aa('0x9'));var _=require(_0x34aa('0xa'));var squel=require('squel');var crypto=require(_0x34aa('0xb'));var jsforce=require(_0x34aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x34aa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x34aa('0xd'));var authService=require(_0x34aa('0xe'));var qs=require(_0x34aa('0xf'));var as=require(_0x34aa('0x10'));var hardwareService=require(_0x34aa('0x11'));var logger=require(_0x34aa('0x12'))('api');var utils=require(_0x34aa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34aa('0x14'))['db'];var jayson=require(_0x34aa('0x15'));var client=jayson[_0x34aa('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x452208,_0x5a5a5b,_0x424c4d,_0x109378){return new BPromise(function(_0x228433,_0x3a6819){var _0x29713a=_0x109378||client;return _0x29713a['request'](_0x452208,_0x424c4d)[_0x34aa('0x17')](function(_0xa25b37){logger[_0x34aa('0x18')](_0x34aa('0x19'),_0x5a5a5b,_0x34aa('0x1a'));logger[_0x34aa('0x1b')](_0x34aa('0x1c'),_0x5a5a5b,_0x34aa('0x1a'),JSON[_0x34aa('0x1d')](_0xa25b37));if(_0xa25b37[_0x34aa('0x1e')]){if(_0xa25b37[_0x34aa('0x1e')][_0x34aa('0x1f')]===0x1f4){logger[_0x34aa('0x1e')](_0x34aa('0x19'),_0x5a5a5b,_0xa25b37[_0x34aa('0x1e')][_0x34aa('0x20')]);return _0x3a6819(_0xa25b37[_0x34aa('0x1e')][_0x34aa('0x20')]);}logger[_0x34aa('0x1e')](_0x34aa('0x19'),_0x5a5a5b,_0xa25b37[_0x34aa('0x1e')][_0x34aa('0x20')]);return _0x228433(_0xa25b37[_0x34aa('0x1e')][_0x34aa('0x20')]);}else{logger[_0x34aa('0x18')](_0x34aa('0x19'),_0x5a5a5b,_0x34aa('0x1a'));_0x228433(_0xa25b37['result'][_0x34aa('0x20')]);}})[_0x34aa('0x21')](function(_0x577f0b){logger[_0x34aa('0x1e')](_0x34aa('0x19'),_0x5a5a5b,_0x577f0b);_0x3a6819(_0x577f0b);});});}function respondWithStatusCode(_0x1e2b40,_0x32643b){_0x32643b=_0x32643b||0xcc;return function(_0x1ff3c3){if(_0x1ff3c3){return _0x1e2b40[_0x34aa('0x22')](_0x32643b);}return _0x1e2b40['status'](_0x32643b)[_0x34aa('0x23')]();};}function respondWithResult(_0x2f1831,_0x48bb85){_0x48bb85=_0x48bb85||0xc8;return function(_0x1aadee){if(_0x1aadee){return _0x2f1831[_0x34aa('0x24')](_0x48bb85)[_0x34aa('0x25')](_0x1aadee);}};}function respondWithFilteredResult(_0x44b0a8,_0x13ef1c){return function(_0x152d31){if(_0x152d31){var _0x284737=typeof _0x13ef1c[_0x34aa('0x26')]==='undefined'&&typeof _0x13ef1c[_0x34aa('0x27')]===_0x34aa('0x28');var _0xc920c7=_0x152d31['count'];var _0x2c4b82=_0x284737?0x0:_0x13ef1c[_0x34aa('0x26')];var _0x1de0a4=_0x284737?_0x152d31[_0x34aa('0x29')]:_0x13ef1c[_0x34aa('0x26')]+_0x13ef1c[_0x34aa('0x27')];var _0x367d20;if(_0x1de0a4>=_0xc920c7){_0x1de0a4=_0xc920c7;_0x367d20=0xc8;}else{_0x367d20=0xce;}_0x44b0a8[_0x34aa('0x24')](_0x367d20);return _0x44b0a8[_0x34aa('0x2a')](_0x34aa('0x2b'),_0x2c4b82+'-'+_0x1de0a4+'/'+_0xc920c7)[_0x34aa('0x25')](_0x152d31);}return null;};}function patchUpdates(_0x253088){return function(_0xffcbf2){try{jsonpatch[_0x34aa('0x2c')](_0xffcbf2,_0x253088,!![]);}catch(_0x4383ec){return BPromise['reject'](_0x4383ec);}return _0xffcbf2[_0x34aa('0x2d')]();};}function saveUpdates(_0x887536,_0x3ce8ae){return function(_0x3f96a2){if(_0x3f96a2){return _0x3f96a2[_0x34aa('0x2e')](_0x887536)[_0x34aa('0x17')](function(_0x2b116e){return _0x2b116e;});}return null;};}function removeEntity(_0x4f1354,_0x4e0966){return function(_0x38b6a9){if(_0x38b6a9){return _0x38b6a9[_0x34aa('0x2f')]()[_0x34aa('0x17')](function(){_0x4f1354[_0x34aa('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218a31,_0x42a871){return function(_0x274754){if(!_0x274754){_0x218a31[_0x34aa('0x22')](0x194);}return _0x274754;};}function handleError(_0x422f9e,_0x5b9f23){_0x5b9f23=_0x5b9f23||0x1f4;return function(_0x9fb019){logger[_0x34aa('0x1e')](_0x9fb019[_0x34aa('0x30')]);if(_0x9fb019[_0x34aa('0x31')]){delete _0x9fb019[_0x34aa('0x31')];}_0x422f9e[_0x34aa('0x24')](_0x5b9f23)[_0x34aa('0x32')](_0x9fb019);};}exports[_0x34aa('0x33')]=function(_0x5cb54a,_0x42347d){var _0x35a5a7={},_0x93f25c={},_0x52a7d5={'count':0x0,'rows':[]};var _0x4c2ef7=_['map'](db[_0x34aa('0x34')][_0x34aa('0x35')],function(_0x593d07){return{'name':_0x593d07[_0x34aa('0x36')],'type':_0x593d07[_0x34aa('0x37')]['key']};});_0x93f25c[_0x34aa('0x38')]=_['map'](_0x4c2ef7,_0x34aa('0x31'));_0x93f25c[_0x34aa('0x39')]=_[_0x34aa('0x3a')](_0x5cb54a[_0x34aa('0x39')]);_0x93f25c[_0x34aa('0x3b')]=_[_0x34aa('0x3c')](_0x93f25c[_0x34aa('0x38')],_0x93f25c[_0x34aa('0x39')]);_0x35a5a7[_0x34aa('0x3d')]=_[_0x34aa('0x3c')](_0x93f25c['model'],qs[_0x34aa('0x3e')](_0x5cb54a[_0x34aa('0x39')]['fields']));_0x35a5a7[_0x34aa('0x3d')]=_0x35a5a7['attributes'][_0x34aa('0x3f')]?_0x35a5a7['attributes']:_0x93f25c[_0x34aa('0x38')];if(!_0x5cb54a[_0x34aa('0x39')][_0x34aa('0x40')](_0x34aa('0x41'))){_0x35a5a7[_0x34aa('0x27')]=qs[_0x34aa('0x27')](_0x5cb54a[_0x34aa('0x39')][_0x34aa('0x27')]);_0x35a5a7[_0x34aa('0x26')]=qs[_0x34aa('0x26')](_0x5cb54a[_0x34aa('0x39')]['offset']);}_0x35a5a7[_0x34aa('0x42')]=qs[_0x34aa('0x43')](_0x5cb54a['query'][_0x34aa('0x43')]);_0x35a5a7[_0x34aa('0x44')]=qs[_0x34aa('0x3b')](_[_0x34aa('0x45')](_0x5cb54a[_0x34aa('0x39')],_0x93f25c[_0x34aa('0x3b')]),_0x4c2ef7);if(_0x5cb54a['query'][_0x34aa('0x46')]){_0x35a5a7[_0x34aa('0x44')]=_['merge'](_0x35a5a7['where'],{'$or':_['map'](_0x4c2ef7,function(_0x3aa65a){if(_0x3aa65a[_0x34aa('0x37')]!==_0x34aa('0x47')){var _0x450381={};_0x450381[_0x3aa65a[_0x34aa('0x31')]]={'$like':'%'+_0x5cb54a[_0x34aa('0x39')]['filter']+'%'};return _0x450381;}})});}_0x35a5a7=_[_0x34aa('0x48')]({},_0x35a5a7,_0x5cb54a[_0x34aa('0x49')]);var _0x152206={'where':_0x35a5a7['where']};return db[_0x34aa('0x34')]['count'](_0x152206)['then'](function(_0x3fa773){_0x52a7d5[_0x34aa('0x29')]=_0x3fa773;if(_0x5cb54a[_0x34aa('0x39')][_0x34aa('0x4a')]){_0x35a5a7[_0x34aa('0x4b')]=[{'all':!![]}];}return db[_0x34aa('0x34')][_0x34aa('0x4c')](_0x35a5a7);})['then'](function(_0x66f76e){_0x52a7d5[_0x34aa('0x4d')]=_0x66f76e;return _0x52a7d5;})[_0x34aa('0x17')](respondWithFilteredResult(_0x42347d,_0x35a5a7))[_0x34aa('0x21')](handleError(_0x42347d,null));};exports[_0x34aa('0x4e')]=function(_0x1ae882,_0x3af7b1){var _0xf629aa={'raw':![],'where':{'id':_0x1ae882[_0x34aa('0x4f')]['id']}},_0xb8cfa4={};_0xb8cfa4[_0x34aa('0x38')]=_['keys'](db[_0x34aa('0x34')]['rawAttributes']);_0xb8cfa4['query']=_[_0x34aa('0x3a')](_0x1ae882['query']);_0xb8cfa4[_0x34aa('0x3b')]=_[_0x34aa('0x3c')](_0xb8cfa4[_0x34aa('0x38')],_0xb8cfa4[_0x34aa('0x39')]);_0xf629aa['attributes']=_['intersection'](_0xb8cfa4[_0x34aa('0x38')],qs[_0x34aa('0x3e')](_0x1ae882[_0x34aa('0x39')][_0x34aa('0x3e')]));_0xf629aa['attributes']=_0xf629aa[_0x34aa('0x3d')][_0x34aa('0x3f')]?_0xf629aa['attributes']:_0xb8cfa4[_0x34aa('0x38')];if(_0x1ae882['query'][_0x34aa('0x4a')]){_0xf629aa[_0x34aa('0x4b')]=[{'all':!![]}];}_0xf629aa=_[_0x34aa('0x48')]({},_0xf629aa,_0x1ae882[_0x34aa('0x49')]);return db['Setting'][_0x34aa('0x50')](_0xf629aa)['then'](handleEntityNotFound(_0x3af7b1,null))[_0x34aa('0x17')](respondWithResult(_0x3af7b1,null))[_0x34aa('0x21')](handleError(_0x3af7b1,null));};exports[_0x34aa('0x2e')]=function(_0x47a003,_0x237741){if(_0x47a003['body']['id']){delete _0x47a003['body']['id'];}return db[_0x34aa('0x34')]['find']({'where':{'id':_0x47a003[_0x34aa('0x4f')]['id']}})[_0x34aa('0x17')](handleEntityNotFound(_0x237741,null))[_0x34aa('0x17')](saveUpdates(_0x47a003[_0x34aa('0x51')],null))[_0x34aa('0x17')](respondWithResult(_0x237741,null))[_0x34aa('0x21')](handleError(_0x237741,null));};exports['addLogo']=function(_0x20969a,_0x28c821,_0x57d8ec){if(_0x20969a[_0x34aa('0x52')]&&_0x20969a[_0x34aa('0x52')][_0x34aa('0x53')]){_0x20969a[_0x34aa('0x51')][_0x34aa('0x54')]=_0x20969a[_0x34aa('0x52')]['filename'];}return db[_0x34aa('0x34')][_0x34aa('0x50')]({'where':{'id':_0x20969a[_0x34aa('0x4f')]['id']}})[_0x34aa('0x17')](handleEntityNotFound(_0x28c821,null))['then'](saveUpdates(_0x20969a[_0x34aa('0x51')],null))[_0x34aa('0x17')](respondWithResult(_0x28c821,null))['catch'](handleError(_0x28c821,null));};exports[_0x34aa('0x55')]=function(_0x7a9a27,_0x2c180b,_0x134bef){if(_0x7a9a27[_0x34aa('0x52')]&&_0x7a9a27[_0x34aa('0x52')][_0x34aa('0x53')]){_0x7a9a27['body'][_0x34aa('0x56')]=_0x7a9a27[_0x34aa('0x52')][_0x34aa('0x53')];}return db[_0x34aa('0x34')]['find']({'where':{'id':_0x7a9a27[_0x34aa('0x4f')]['id']}})[_0x34aa('0x17')](handleEntityNotFound(_0x2c180b,null))[_0x34aa('0x17')](saveUpdates(_0x7a9a27['body'],null))[_0x34aa('0x17')](respondWithResult(_0x2c180b,null))[_0x34aa('0x21')](handleError(_0x2c180b,null));};var utilLicense=require('../../config/license/util');exports[_0x34aa('0x57')]=function(_0x431309,_0x313ad7,_0x328a0e){var _0x583640=_0x34aa('0x58');var _0x2c8b59={'custom':![]};return utilLicense[_0x34aa('0x59')]()[_0x34aa('0x17')](function(_0x13efec){if(_0x13efec){_0x2c8b59=_0x13efec;}return db['Setting'][_0x34aa('0x50')]({'where':{'id':_0x431309['params']['id']},'attributes':['logo','loginLogo',_0x34aa('0x5a'),_0x34aa('0x5b'),_0x34aa('0x5c'),_0x34aa('0x5d'),_0x34aa('0x5e'),_0x34aa('0x5f')],'raw':!![]});})[_0x34aa('0x17')](handleEntityNotFound(_0x313ad7,null))[_0x34aa('0x17')](function(_0x589988){if(_0x589988){var _0xdc0a87=_0x589988[_0x34aa('0x54')]&&fs[_0x34aa('0x60')](path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x583640,_['toLower'](_0x589988[_0x34aa('0x54')])))?path['join'](config['root'],_0x583640,_[_0x34aa('0x63')](_0x589988[_0x34aa('0x54')])):path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x583640,_[_0x34aa('0x63')]('default_logo.svg'));var _0x59c6ad='default'+_[_0x34aa('0x64')](_0x34aa('0x54'));if(_0x589988[_0x59c6ad]||!_0x2c8b59[_0x34aa('0x65')]){_0xdc0a87=path['join'](config[_0x34aa('0x62')],_0x583640,_[_0x34aa('0x63')](_0x34aa('0x66')));}if(!fs[_0x34aa('0x60')](_0xdc0a87)){throw new db[(_0x34aa('0x67'))]['ValidationError'](_['upperFirst']('logo')+_0x34aa('0x68'));}return _0x313ad7[_0x34aa('0x69')](_0xdc0a87);}})['catch'](handleError(_0x313ad7,null));};var utilLicense=require(_0x34aa('0x6a'));exports['getLogoLogin']=function(_0x3b3989,_0x2fa3c4,_0x2c68bf){var _0x35ac82=_0x34aa('0x58');var _0x4b5a56={'custom':![]};return utilLicense[_0x34aa('0x59')]()[_0x34aa('0x17')](function(_0x2c8dc0){if(_0x2c8dc0){_0x4b5a56=_0x2c8dc0;}return db[_0x34aa('0x34')][_0x34aa('0x50')]({'where':{'id':_0x3b3989[_0x34aa('0x4f')]['id']},'attributes':[_0x34aa('0x54'),_0x34aa('0x56'),_0x34aa('0x5a'),_0x34aa('0x5b'),_0x34aa('0x5c'),_0x34aa('0x5d'),_0x34aa('0x5e'),_0x34aa('0x5f')],'raw':!![]});})[_0x34aa('0x17')](handleEntityNotFound(_0x2fa3c4,null))['then'](function(_0x4029e5){if(_0x4029e5){var _0x2bf475=_0x4029e5[_0x34aa('0x56')]&&fs[_0x34aa('0x60')](path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x35ac82,_[_0x34aa('0x63')](_0x4029e5[_0x34aa('0x56')])))?path['join'](config[_0x34aa('0x62')],_0x35ac82,_[_0x34aa('0x63')](_0x4029e5[_0x34aa('0x56')])):path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x35ac82,_[_0x34aa('0x63')](_0x34aa('0x6b')));var _0x2acee2=_0x34aa('0x6c')+_['upperFirst'](_0x34aa('0x56'));if(_0x4029e5[_0x2acee2]||!_0x4b5a56[_0x34aa('0x65')]){_0x2bf475=path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x35ac82,_[_0x34aa('0x63')](_0x34aa('0x6b')));}if(!fs[_0x34aa('0x60')](_0x2bf475)){throw new db[(_0x34aa('0x67'))][(_0x34aa('0x6d'))](_[_0x34aa('0x64')]('loginLogo')+_0x34aa('0x68'));}return _0x2fa3c4[_0x34aa('0x69')](_0x2bf475);}})[_0x34aa('0x21')](handleError(_0x2fa3c4,null));};exports[_0x34aa('0x6e')]=function(_0x4acd0f,_0x489e24){return db['Setting'][_0x34aa('0x50')]({'where':{'id':_0x4acd0f[_0x34aa('0x4f')]['id']},'attributes':['securePassword']})[_0x34aa('0x17')](respondWithResult(_0x489e24,null))[_0x34aa('0x21')](handleError(_0x489e24,null));};exports[_0x34aa('0x6f')]=function(_0x48b78d,_0x2a3a26,_0xa968f7){if(_0x48b78d[_0x34aa('0x52')]&&_0x48b78d[_0x34aa('0x52')][_0x34aa('0x53')]){_0x48b78d[_0x34aa('0x51')]['preferred']=_0x48b78d[_0x34aa('0x52')][_0x34aa('0x53')];}return db['Setting']['find']({'where':{'id':_0x48b78d['params']['id']}})[_0x34aa('0x17')](handleEntityNotFound(_0x2a3a26,null))['then'](saveUpdates(_0x48b78d['body'],null))[_0x34aa('0x17')](respondWithResult(_0x2a3a26,null))['catch'](handleError(_0x2a3a26,null));};var utilLicense=require(_0x34aa('0x6a'));exports['getPreferred']=function(_0x17df29,_0x36045a,_0x150e5f){var _0x30b1c4=_0x34aa('0x58');var _0x130f47={'custom':![]};return utilLicense[_0x34aa('0x59')]()[_0x34aa('0x17')](function(_0x42f250){if(_0x42f250){_0x130f47=_0x42f250;}return db[_0x34aa('0x34')][_0x34aa('0x50')]({'where':{'id':_0x17df29['params']['id']},'attributes':[_0x34aa('0x54'),_0x34aa('0x56'),_0x34aa('0x5a'),'favicon',_0x34aa('0x5c'),_0x34aa('0x5d'),_0x34aa('0x5e'),_0x34aa('0x5f')],'raw':!![]});})[_0x34aa('0x17')](handleEntityNotFound(_0x36045a,null))['then'](function(_0x1938fc){if(_0x1938fc){var _0x5d9df8=_0x1938fc['preferred']&&fs[_0x34aa('0x60')](path[_0x34aa('0x61')](config['root'],_0x30b1c4,_[_0x34aa('0x63')](_0x1938fc[_0x34aa('0x5a')])))?path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x30b1c4,_[_0x34aa('0x63')](_0x1938fc[_0x34aa('0x5a')])):path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x30b1c4,_[_0x34aa('0x63')](_0x34aa('0x70')));var _0x484187=_0x34aa('0x6c')+_[_0x34aa('0x64')](_0x34aa('0x5a'));if(_0x1938fc[_0x484187]||!_0x130f47[_0x34aa('0x65')]||!_0x130f47[_0x34aa('0x5a')]){_0x5d9df8=path[_0x34aa('0x61')](config['root'],_0x30b1c4,_[_0x34aa('0x63')]('default_preferred.png'));}if(!fs[_0x34aa('0x60')](_0x5d9df8)){throw new db[(_0x34aa('0x67'))][(_0x34aa('0x6d'))](_[_0x34aa('0x64')]('preferred')+_0x34aa('0x68'));}return _0x36045a[_0x34aa('0x69')](_0x5d9df8);}})[_0x34aa('0x21')](handleError(_0x36045a,null));};exports[_0x34aa('0x71')]=function(_0x357bf8,_0x34872e,_0x7b44d4){if(_0x357bf8['file']&&_0x357bf8['file'][_0x34aa('0x53')]){_0x357bf8[_0x34aa('0x51')][_0x34aa('0x5b')]=_0x357bf8[_0x34aa('0x52')][_0x34aa('0x53')];}return db['Setting']['find']({'where':{'id':_0x357bf8['params']['id']}})[_0x34aa('0x17')](handleEntityNotFound(_0x34872e,null))['then'](saveUpdates(_0x357bf8[_0x34aa('0x51')],null))[_0x34aa('0x17')](respondWithResult(_0x34872e,null))[_0x34aa('0x21')](handleError(_0x34872e,null));};var utilLicense=require(_0x34aa('0x6a'));exports[_0x34aa('0x72')]=function(_0x139402,_0x54ae8d,_0x45ea79){var _0x17a8ef=_0x34aa('0x58');var _0x11f91f={'custom':![]};return utilLicense[_0x34aa('0x59')]()[_0x34aa('0x17')](function(_0xa42614){if(_0xa42614){_0x11f91f=_0xa42614;}return db[_0x34aa('0x34')][_0x34aa('0x50')]({'where':{'id':_0x139402['params']['id']},'attributes':[_0x34aa('0x54'),_0x34aa('0x56'),_0x34aa('0x5a'),'favicon',_0x34aa('0x5c'),_0x34aa('0x5d'),'defaultPreferred',_0x34aa('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x54ae8d,null))[_0x34aa('0x17')](function(_0x2b9947){if(_0x2b9947){var _0x4275a0=_0x2b9947['favicon']&&fs[_0x34aa('0x60')](path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x17a8ef,_['toLower'](_0x2b9947['favicon'])))?path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x17a8ef,_['toLower'](_0x2b9947[_0x34aa('0x5b')])):path['join'](config[_0x34aa('0x62')],_0x17a8ef,_[_0x34aa('0x63')](_0x34aa('0x73')));var _0x4a8cbc=_0x34aa('0x6c')+_['upperFirst'](_0x34aa('0x5b'));if(_0x2b9947[_0x4a8cbc]||!_0x11f91f[_0x34aa('0x65')]){_0x4275a0=path[_0x34aa('0x61')](config[_0x34aa('0x62')],_0x17a8ef,_[_0x34aa('0x63')](_0x34aa('0x73')));}if(!fs[_0x34aa('0x60')](_0x4275a0)){throw new db[(_0x34aa('0x67'))][(_0x34aa('0x6d'))](_[_0x34aa('0x64')](_0x34aa('0x5b'))+_0x34aa('0x68'));}return _0x54ae8d[_0x34aa('0x69')](_0x4275a0);}})['catch'](handleError(_0x54ae8d,null));};exports[_0x34aa('0x74')]=function(_0x43dc10,_0x101234){var _0x210e28={'offset':moment()[_0x34aa('0x75')]()};_0x210e28[_0x34aa('0x76')]=moment()['utcOffset'](_0x210e28[_0x34aa('0x26')])[_0x34aa('0x77')](_0x34aa('0x78'));return _0x101234[_0x34aa('0x24')](0xc8)[_0x34aa('0x32')](_0x210e28);}; \ No newline at end of file +var _0x48c6=['getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','favicon','defaultLoginLogo','Sequelize','ValidationError','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x48c6,0x17d));var _0x648c=function(_0x158b28,_0x292083){_0x158b28=_0x158b28-0x0;var _0x4fa88e=_0x48c6[_0x158b28];return _0x4fa88e;};'use strict';var emlformat=require(_0x648c('0x0'));var rimraf=require(_0x648c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x648c('0x2'));var rp=require(_0x648c('0x3'));var moment=require('moment');var BPromise=require(_0x648c('0x4'));var Mustache=require('mustache');var util=require(_0x648c('0x5'));var path=require(_0x648c('0x6'));var sox=require(_0x648c('0x7'));var csv=require(_0x648c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x648c('0x9'));var crypto=require(_0x648c('0xa'));var jsforce=require(_0x648c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x648c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x648c('0xc'));var authService=require(_0x648c('0xd'));var qs=require(_0x648c('0xe'));var as=require(_0x648c('0xf'));var hardwareService=require(_0x648c('0x10'));var logger=require(_0x648c('0x11'))(_0x648c('0x12'));var utils=require('../../config/utils');var config=require(_0x648c('0x13'));var licenseUtil=require(_0x648c('0x14'));var db=require(_0x648c('0x15'))['db'];var jayson=require(_0x648c('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5cc1,_0x3de2b4,_0x485d5d,_0x2d0862){return new BPromise(function(_0x5105e7,_0x35f10e){var _0xf706ad=_0x2d0862||client;return _0xf706ad[_0x648c('0x17')](_0x2f5cc1,_0x485d5d)['then'](function(_0x1dd08d){logger[_0x648c('0x18')]('Setting,\x20%s,\x20%s',_0x3de2b4,_0x648c('0x19'));logger[_0x648c('0x1a')](_0x648c('0x1b'),_0x3de2b4,'request\x20sent',JSON[_0x648c('0x1c')](_0x1dd08d));if(_0x1dd08d[_0x648c('0x1d')]){if(_0x1dd08d[_0x648c('0x1d')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3de2b4,_0x1dd08d[_0x648c('0x1d')][_0x648c('0x1e')]);return _0x35f10e(_0x1dd08d[_0x648c('0x1d')]['message']);}logger[_0x648c('0x1d')](_0x648c('0x1f'),_0x3de2b4,_0x1dd08d['error']['message']);return _0x5105e7(_0x1dd08d[_0x648c('0x1d')]['message']);}else{logger[_0x648c('0x18')]('Setting,\x20%s,\x20%s',_0x3de2b4,_0x648c('0x19'));_0x5105e7(_0x1dd08d[_0x648c('0x20')][_0x648c('0x1e')]);}})[_0x648c('0x21')](function(_0x261785){logger['error'](_0x648c('0x1f'),_0x3de2b4,_0x261785);_0x35f10e(_0x261785);});});}function respondWithStatusCode(_0x5415f7,_0x5bdfa1){_0x5bdfa1=_0x5bdfa1||0xcc;return function(_0x422b7b){if(_0x422b7b){return _0x5415f7['sendStatus'](_0x5bdfa1);}return _0x5415f7[_0x648c('0x22')](_0x5bdfa1)[_0x648c('0x23')]();};}function respondWithResult(_0x3d9d9f,_0x1a4124){_0x1a4124=_0x1a4124||0xc8;return function(_0x4bfba7){if(_0x4bfba7){return _0x3d9d9f[_0x648c('0x22')](_0x1a4124)[_0x648c('0x24')](_0x4bfba7);}};}function respondWithFilteredResult(_0xd36efd,_0x3ff637){return function(_0x2d9b30){if(_0x2d9b30){var _0x4e5223=typeof _0x3ff637['offset']===_0x648c('0x25')&&typeof _0x3ff637[_0x648c('0x26')]===_0x648c('0x25');var _0x47c2cf=_0x2d9b30[_0x648c('0x27')];var _0x5f7323=_0x4e5223?0x0:_0x3ff637[_0x648c('0x28')];var _0x6f6768=_0x4e5223?_0x2d9b30[_0x648c('0x27')]:_0x3ff637[_0x648c('0x28')]+_0x3ff637['limit'];var _0x15ea60;if(_0x6f6768>=_0x47c2cf){_0x6f6768=_0x47c2cf;_0x15ea60=0xc8;}else{_0x15ea60=0xce;}_0xd36efd[_0x648c('0x22')](_0x15ea60);return _0xd36efd[_0x648c('0x29')]('Content-Range',_0x5f7323+'-'+_0x6f6768+'/'+_0x47c2cf)['json'](_0x2d9b30);}return null;};}function patchUpdates(_0x3d6e7e){return function(_0x52db81){try{jsonpatch[_0x648c('0x2a')](_0x52db81,_0x3d6e7e,!![]);}catch(_0x4eb89c){return BPromise[_0x648c('0x2b')](_0x4eb89c);}return _0x52db81[_0x648c('0x2c')]();};}function saveUpdates(_0x410271,_0x17fda8){return function(_0x2c191b){if(_0x2c191b){return _0x2c191b[_0x648c('0x2d')](_0x410271)[_0x648c('0x2e')](function(_0x193b3b){return _0x193b3b;});}return null;};}function removeEntity(_0x4564f8,_0x567faf){return function(_0x4b0c85){if(_0x4b0c85){return _0x4b0c85['destroy']()[_0x648c('0x2e')](function(){_0x4564f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c2a2,_0x2c9950){return function(_0x4b0a27){if(!_0x4b0a27){_0x50c2a2['sendStatus'](0x194);}return _0x4b0a27;};}function handleError(_0x4505af,_0x15fefb){_0x15fefb=_0x15fefb||0x1f4;return function(_0x138c1f){logger[_0x648c('0x1d')](_0x138c1f['stack']);if(_0x138c1f[_0x648c('0x2f')]){delete _0x138c1f[_0x648c('0x2f')];}_0x4505af[_0x648c('0x22')](_0x15fefb)[_0x648c('0x30')](_0x138c1f);};}exports[_0x648c('0x31')]=function(_0x36b36f,_0xc1c72){var _0x1dbeb1={},_0x379aba={},_0x275503={'count':0x0,'rows':[]};var _0x21ec61=_[_0x648c('0x32')](db[_0x648c('0x33')][_0x648c('0x34')],function(_0x1e277d){return{'name':_0x1e277d[_0x648c('0x35')],'type':_0x1e277d['type'][_0x648c('0x36')]};});_0x379aba[_0x648c('0x37')]=_[_0x648c('0x32')](_0x21ec61,'name');_0x379aba[_0x648c('0x38')]=_[_0x648c('0x39')](_0x36b36f[_0x648c('0x38')]);_0x379aba['filters']=_[_0x648c('0x3a')](_0x379aba[_0x648c('0x37')],_0x379aba[_0x648c('0x38')]);_0x1dbeb1[_0x648c('0x3b')]=_[_0x648c('0x3a')](_0x379aba[_0x648c('0x37')],qs[_0x648c('0x3c')](_0x36b36f[_0x648c('0x38')]['fields']));_0x1dbeb1['attributes']=_0x1dbeb1[_0x648c('0x3b')][_0x648c('0x3d')]?_0x1dbeb1[_0x648c('0x3b')]:_0x379aba[_0x648c('0x37')];if(!_0x36b36f[_0x648c('0x38')][_0x648c('0x3e')](_0x648c('0x3f'))){_0x1dbeb1[_0x648c('0x26')]=qs[_0x648c('0x26')](_0x36b36f[_0x648c('0x38')][_0x648c('0x26')]);_0x1dbeb1[_0x648c('0x28')]=qs[_0x648c('0x28')](_0x36b36f[_0x648c('0x38')][_0x648c('0x28')]);}_0x1dbeb1[_0x648c('0x40')]=qs[_0x648c('0x41')](_0x36b36f['query'][_0x648c('0x41')]);_0x1dbeb1['where']=qs['filters'](_['pick'](_0x36b36f[_0x648c('0x38')],_0x379aba[_0x648c('0x42')]),_0x21ec61);if(_0x36b36f[_0x648c('0x38')][_0x648c('0x43')]){_0x1dbeb1[_0x648c('0x44')]=_[_0x648c('0x45')](_0x1dbeb1[_0x648c('0x44')],{'$or':_[_0x648c('0x32')](_0x21ec61,function(_0x486727){if(_0x486727[_0x648c('0x46')]!==_0x648c('0x47')){var _0x76b669={};_0x76b669[_0x486727[_0x648c('0x2f')]]={'$like':'%'+_0x36b36f[_0x648c('0x38')]['filter']+'%'};return _0x76b669;}})});}_0x1dbeb1=_['merge']({},_0x1dbeb1,_0x36b36f[_0x648c('0x48')]);var _0x4d2e2a={'where':_0x1dbeb1[_0x648c('0x44')]};return db['Setting']['count'](_0x4d2e2a)[_0x648c('0x2e')](function(_0x211d31){_0x275503[_0x648c('0x27')]=_0x211d31;if(_0x36b36f[_0x648c('0x38')][_0x648c('0x49')]){_0x1dbeb1[_0x648c('0x4a')]=[{'all':!![]}];}return db[_0x648c('0x33')][_0x648c('0x4b')](_0x1dbeb1);})[_0x648c('0x2e')](function(_0xa3ef71){_0x275503['rows']=_0xa3ef71;return _0x275503;})[_0x648c('0x2e')](respondWithFilteredResult(_0xc1c72,_0x1dbeb1))['catch'](handleError(_0xc1c72,null));};exports[_0x648c('0x4c')]=function(_0x35436a,_0x14e3bc){var _0x10b0c5={'raw':![],'where':{'id':_0x35436a[_0x648c('0x4d')]['id']}},_0x533b1f={};_0x533b1f['model']=_[_0x648c('0x39')](db[_0x648c('0x33')]['rawAttributes']);_0x533b1f[_0x648c('0x38')]=_[_0x648c('0x39')](_0x35436a[_0x648c('0x38')]);_0x533b1f['filters']=_[_0x648c('0x3a')](_0x533b1f[_0x648c('0x37')],_0x533b1f[_0x648c('0x38')]);_0x10b0c5[_0x648c('0x3b')]=_[_0x648c('0x3a')](_0x533b1f['model'],qs['fields'](_0x35436a[_0x648c('0x38')][_0x648c('0x3c')]));_0x10b0c5[_0x648c('0x3b')]=_0x10b0c5['attributes']['length']?_0x10b0c5[_0x648c('0x3b')]:_0x533b1f[_0x648c('0x37')];if(_0x35436a[_0x648c('0x38')][_0x648c('0x49')]){_0x10b0c5[_0x648c('0x4a')]=[{'all':!![]}];}_0x10b0c5=_[_0x648c('0x45')]({},_0x10b0c5,_0x35436a[_0x648c('0x48')]);return db[_0x648c('0x33')][_0x648c('0x4e')](_0x10b0c5)[_0x648c('0x2e')](handleEntityNotFound(_0x14e3bc,null))['then'](respondWithResult(_0x14e3bc,null))[_0x648c('0x21')](handleError(_0x14e3bc,null));};exports[_0x648c('0x2d')]=function(_0x4d7cdc,_0x5d87ad){if(_0x4d7cdc[_0x648c('0x4f')]['id']){delete _0x4d7cdc[_0x648c('0x4f')]['id'];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x4d7cdc[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x5d87ad,null))[_0x648c('0x2e')](saveUpdates(_0x4d7cdc[_0x648c('0x4f')],null))[_0x648c('0x2e')](respondWithResult(_0x5d87ad,null))[_0x648c('0x21')](handleError(_0x5d87ad,null));};exports[_0x648c('0x50')]=function(_0x237279,_0x193df4,_0x590a8d){if(_0x237279[_0x648c('0x51')]&&_0x237279[_0x648c('0x51')][_0x648c('0x52')]){_0x237279[_0x648c('0x4f')][_0x648c('0x53')]=_0x237279[_0x648c('0x51')][_0x648c('0x52')];}return db[_0x648c('0x33')]['find']({'where':{'id':_0x237279[_0x648c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x193df4,null))['then'](saveUpdates(_0x237279['body'],null))[_0x648c('0x2e')](respondWithResult(_0x193df4,null))['catch'](handleError(_0x193df4,null));};exports['addLogoLogin']=function(_0x2e7b12,_0x46896f,_0x4adacc){if(_0x2e7b12['file']&&_0x2e7b12[_0x648c('0x51')][_0x648c('0x52')]){_0x2e7b12['body'][_0x648c('0x54')]=_0x2e7b12[_0x648c('0x51')][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x2e7b12[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x46896f,null))[_0x648c('0x2e')](saveUpdates(_0x2e7b12['body'],null))[_0x648c('0x2e')](respondWithResult(_0x46896f,null))[_0x648c('0x21')](handleError(_0x46896f,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x55')]=function(_0x1f34a6,_0x5e1690,_0x315513){var _0x4544f0=_0x648c('0x56');var _0x5ecd3f={'custom':![]};return utilLicense[_0x648c('0x57')]()['then'](function(_0x48ce18){if(_0x48ce18){_0x5ecd3f=_0x48ce18;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x1f34a6['params']['id']},'attributes':[_0x648c('0x53'),_0x648c('0x54'),_0x648c('0x58'),'favicon',_0x648c('0x59'),'defaultLoginLogo',_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})[_0x648c('0x2e')](handleEntityNotFound(_0x5e1690,null))[_0x648c('0x2e')](function(_0x55e55f){if(_0x55e55f){var _0x130b4b=_0x55e55f[_0x648c('0x53')]&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x55e55f[_0x648c('0x53')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x55e55f[_0x648c('0x53')])):path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_[_0x648c('0x5f')](_0x648c('0x60')));var _0x35516e=_0x648c('0x61')+_[_0x648c('0x62')](_0x648c('0x53'));if(_0x55e55f[_0x35516e]||!_0x5ecd3f[_0x648c('0x63')]){_0x130b4b=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4544f0,_['toLower'](_0x648c('0x60')));}if(!fs['existsSync'](_0x130b4b)){throw new db['Sequelize']['ValidationError'](_[_0x648c('0x62')](_0x648c('0x53'))+_0x648c('0x64'));}return _0x5e1690[_0x648c('0x65')](_0x130b4b);}})[_0x648c('0x21')](handleError(_0x5e1690,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x66')]=function(_0x46b4ac,_0x2ffa36,_0x41a167){var _0x4e9e42='server/files/images/logos';var _0x3f0ab2={'custom':![]};return utilLicense[_0x648c('0x57')]()[_0x648c('0x2e')](function(_0x4b7f22){if(_0x4b7f22){_0x3f0ab2=_0x4b7f22;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x46b4ac[_0x648c('0x4d')]['id']},'attributes':['logo',_0x648c('0x54'),_0x648c('0x58'),_0x648c('0x67'),_0x648c('0x59'),_0x648c('0x68'),_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})[_0x648c('0x2e')](handleEntityNotFound(_0x2ffa36,null))['then'](function(_0x3deb7a){if(_0x3deb7a){var _0x12e9d9=_0x3deb7a[_0x648c('0x54')]&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')](_0x3deb7a[_0x648c('0x54')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')](_0x3deb7a[_0x648c('0x54')])):path['join'](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')]('default_loginLogo.svg'));var _0x21f88f=_0x648c('0x61')+_['upperFirst'](_0x648c('0x54'));if(_0x3deb7a[_0x21f88f]||!_0x3f0ab2[_0x648c('0x63')]){_0x12e9d9=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x4e9e42,_[_0x648c('0x5f')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x12e9d9)){throw new db[(_0x648c('0x69'))][(_0x648c('0x6a'))](_[_0x648c('0x62')](_0x648c('0x54'))+_0x648c('0x64'));}return _0x2ffa36[_0x648c('0x65')](_0x12e9d9);}})[_0x648c('0x21')](handleError(_0x2ffa36,null));};exports['gdpr']=function(_0x202101,_0x37f250){return db[_0x648c('0x33')]['find']({'where':{'id':_0x202101[_0x648c('0x4d')]['id']},'attributes':[_0x648c('0x6b')]})[_0x648c('0x2e')](respondWithResult(_0x37f250,null))['catch'](handleError(_0x37f250,null));};exports[_0x648c('0x6c')]=function(_0x1ff72e,_0x28976c,_0x48063c){if(_0x1ff72e[_0x648c('0x51')]&&_0x1ff72e['file'][_0x648c('0x52')]){_0x1ff72e[_0x648c('0x4f')][_0x648c('0x58')]=_0x1ff72e['file'][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x1ff72e[_0x648c('0x4d')]['id']}})[_0x648c('0x2e')](handleEntityNotFound(_0x28976c,null))[_0x648c('0x2e')](saveUpdates(_0x1ff72e[_0x648c('0x4f')],null))['then'](respondWithResult(_0x28976c,null))[_0x648c('0x21')](handleError(_0x28976c,null));};var utilLicense=require(_0x648c('0x14'));exports[_0x648c('0x6d')]=function(_0x5582ff,_0xbbd7a5,_0x2af2ed){var _0x552390=_0x648c('0x56');var _0x4e19eb={'custom':![]};return utilLicense['getLicense']()[_0x648c('0x2e')](function(_0x46743a){if(_0x46743a){_0x4e19eb=_0x46743a;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x5582ff['params']['id']},'attributes':['logo',_0x648c('0x54'),_0x648c('0x58'),_0x648c('0x67'),_0x648c('0x59'),'defaultLoginLogo',_0x648c('0x5a'),_0x648c('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0xbbd7a5,null))[_0x648c('0x2e')](function(_0x45451e){if(_0x45451e){var _0x323729=_0x45451e['preferred']&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x45451e[_0x648c('0x58')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x45451e[_0x648c('0x58')])):path['join'](config[_0x648c('0x5e')],_0x552390,_[_0x648c('0x5f')](_0x648c('0x6e')));var _0x4fa36d=_0x648c('0x61')+_['upperFirst']('preferred');if(_0x45451e[_0x4fa36d]||!_0x4e19eb[_0x648c('0x63')]||!_0x4e19eb['preferred']){_0x323729=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x552390,_['toLower'](_0x648c('0x6e')));}if(!fs[_0x648c('0x5c')](_0x323729)){throw new db[(_0x648c('0x69'))]['ValidationError'](_[_0x648c('0x62')]('preferred')+_0x648c('0x64'));}return _0xbbd7a5[_0x648c('0x65')](_0x323729);}})[_0x648c('0x21')](handleError(_0xbbd7a5,null));};exports[_0x648c('0x6f')]=function(_0x4a734b,_0x43271d,_0x100fe7){if(_0x4a734b[_0x648c('0x51')]&&_0x4a734b[_0x648c('0x51')]['filename']){_0x4a734b[_0x648c('0x4f')]['favicon']=_0x4a734b['file'][_0x648c('0x52')];}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x4a734b[_0x648c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43271d,null))['then'](saveUpdates(_0x4a734b[_0x648c('0x4f')],null))['then'](respondWithResult(_0x43271d,null))[_0x648c('0x21')](handleError(_0x43271d,null));};var utilLicense=require(_0x648c('0x14'));exports['getFavicon']=function(_0x507797,_0x265576,_0x12783d){var _0x5c012a=_0x648c('0x56');var _0x255756={'custom':![]};return utilLicense[_0x648c('0x57')]()[_0x648c('0x2e')](function(_0xf16e17){if(_0xf16e17){_0x255756=_0xf16e17;}return db[_0x648c('0x33')][_0x648c('0x4e')]({'where':{'id':_0x507797['params']['id']},'attributes':['logo','loginLogo',_0x648c('0x58'),_0x648c('0x67'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x648c('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x265576,null))[_0x648c('0x2e')](function(_0x45832f){if(_0x45832f){var _0x41f5ff=_0x45832f['favicon']&&fs[_0x648c('0x5c')](path[_0x648c('0x5d')](config['root'],_0x5c012a,_[_0x648c('0x5f')](_0x45832f[_0x648c('0x67')])))?path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x45832f[_0x648c('0x67')])):path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x648c('0x70')));var _0x499a06=_0x648c('0x61')+_['upperFirst'](_0x648c('0x67'));if(_0x45832f[_0x499a06]||!_0x255756[_0x648c('0x63')]){_0x41f5ff=path[_0x648c('0x5d')](config[_0x648c('0x5e')],_0x5c012a,_[_0x648c('0x5f')](_0x648c('0x70')));}if(!fs['existsSync'](_0x41f5ff)){throw new db[(_0x648c('0x69'))][(_0x648c('0x6a'))](_['upperFirst'](_0x648c('0x67'))+_0x648c('0x64'));}return _0x265576[_0x648c('0x65')](_0x41f5ff);}})[_0x648c('0x21')](handleError(_0x265576,null));};exports[_0x648c('0x71')]=function(_0x1201a5,_0x5151a1){var _0x202acd={'offset':moment()[_0x648c('0x72')]()};_0x202acd['now']=moment()[_0x648c('0x72')](_0x202acd[_0x648c('0x28')])[_0x648c('0x73')](_0x648c('0x74'));return _0x5151a1[_0x648c('0x22')](0xc8)['send'](_0x202acd);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0accf4f..17a5c34 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_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 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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1979f4,_0x3f339f){var _0xb67f6e=function(_0x4dc64c){while(--_0x4dc64c){_0x1979f4['push'](_0x1979f4['shift']());}};_0xb67f6e(++_0x3f339f);}(_0xe14b,0x93));var _0xbe14=function(_0x572525,_0x3f9f0b){_0x572525=_0x572525-0x0;var _0x2dd09d=_0xe14b[_0x572525];return _0x2dd09d;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index dfcb2ce..7763149 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 _0x2661=['map','model','ShowSetting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','Setting','find','options','where','attributes','include'];(function(_0x2fa49f,_0x5dae62){var _0x5b9084=function(_0x2f229a){while(--_0x2f229a){_0x2fa49f['push'](_0x2fa49f['shift']());}};_0x5b9084(++_0x5dae62);}(_0x2661,0x1c3));var _0x1266=function(_0x56d869,_0x2f6a1d){_0x56d869=_0x56d869-0x0;var _0x2a13db=_0x2661[_0x56d869];return _0x2a13db;};'use strict';var _=require(_0x1266('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1266('0x1'));var rs=require(_0x1266('0x2'));var fs=require('fs');var Redis=require(_0x1266('0x3'));var db=require(_0x1266('0x4'))['db'];var utils=require(_0x1266('0x5'));var logger=require(_0x1266('0x6'))(_0x1266('0x7'));var config=require(_0x1266('0x8'));var jayson=require(_0x1266('0x9'));var client=jayson[_0x1266('0xa')][_0x1266('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcf092f,_0x16e172,_0x4d9a99){return new BPromise(function(_0x81b93a,_0x2df65a){return client[_0x1266('0xc')](_0xcf092f,_0x4d9a99)[_0x1266('0xd')](function(_0x1ed718){logger[_0x1266('0xe')](_0x1266('0xf'),_0x16e172,_0x1266('0x10'));logger[_0x1266('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x16e172,_0x1266('0x10'),JSON[_0x1266('0x12')](_0x1ed718));if(_0x1ed718[_0x1266('0x13')]){if(_0x1ed718[_0x1266('0x13')]['code']===0x1f4){logger[_0x1266('0x13')](_0x1266('0xf'),_0x16e172,_0x1ed718['error'][_0x1266('0x14')]);return _0x2df65a(_0x1ed718[_0x1266('0x13')]['message']);}logger['error'](_0x1266('0xf'),_0x16e172,_0x1ed718[_0x1266('0x13')][_0x1266('0x14')]);return _0x81b93a(_0x1ed718[_0x1266('0x13')][_0x1266('0x14')]);}else{logger[_0x1266('0xe')](_0x1266('0xf'),_0x16e172,_0x1266('0x10'));_0x81b93a(_0x1ed718[_0x1266('0x15')][_0x1266('0x14')]);}})[_0x1266('0x16')](function(_0x2675b3){logger[_0x1266('0x13')](_0x1266('0xf'),_0x16e172,_0x2675b3);_0x2df65a(_0x2675b3);});});}exports['ShowSetting']=function(_0x51ff20){var _0x39f215=this;return new Promise(function(_0x241ee1,_0x2a5b4a){return db[_0x1266('0x17')][_0x1266('0x18')]({'raw':_0x51ff20[_0x1266('0x19')]?_0x51ff20[_0x1266('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51ff20[_0x1266('0x19')]?_0x51ff20[_0x1266('0x19')][_0x1266('0x1a')]||null:null,'attributes':_0x51ff20[_0x1266('0x19')]?_0x51ff20['options'][_0x1266('0x1b')]||null:null,'include':_0x51ff20[_0x1266('0x19')]?_0x51ff20['options'][_0x1266('0x1c')]?_[_0x1266('0x1d')](_0x51ff20['options'][_0x1266('0x1c')],function(_0x3bfac6){return{'model':db[_0x3bfac6[_0x1266('0x1e')]],'as':_0x3bfac6['as'],'attributes':_0x3bfac6[_0x1266('0x1b')],'include':_0x3bfac6[_0x1266('0x1c')]?_[_0x1266('0x1d')](_0x3bfac6['include'],function(_0x49aabb){return{'model':db[_0x49aabb[_0x1266('0x1e')]],'as':_0x49aabb['as'],'attributes':_0x49aabb[_0x1266('0x1b')],'include':_0x49aabb[_0x1266('0x1c')]?_[_0x1266('0x1d')](_0x49aabb[_0x1266('0x1c')],function(_0x120d3b){return{'model':db[_0x120d3b[_0x1266('0x1e')]],'as':_0x120d3b['as'],'attributes':_0x120d3b[_0x1266('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1266('0xd')](function(_0x5bae11){logger['info'](_0x1266('0x1f'),_0x51ff20);logger[_0x1266('0x11')](_0x1266('0x1f'),_0x51ff20,JSON[_0x1266('0x12')](_0x5bae11));_0x241ee1(_0x5bae11);})[_0x1266('0x16')](function(_0x40056c){logger[_0x1266('0x13')](_0x1266('0x1f'),_0x40056c[_0x1266('0x14')],_0x51ff20);_0x2a5b4a(_0x39f215[_0x1266('0x13')](0x1f4,_0x40056c[_0x1266('0x14')]));});});}; \ No newline at end of file +var _0xaa7d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','result','ShowSetting','Setting','options','raw','attributes','include','model','map','catch','lodash','util','moment','bluebird'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xaa7d,0x1ec));var _0xdaa7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xaa7d[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xdaa7('0x0'));var util=require(_0xdaa7('0x1'));var moment=require(_0xdaa7('0x2'));var BPromise=require(_0xdaa7('0x3'));var rs=require(_0xdaa7('0x4'));var fs=require('fs');var Redis=require(_0xdaa7('0x5'));var db=require(_0xdaa7('0x6'))['db'];var utils=require(_0xdaa7('0x7'));var logger=require(_0xdaa7('0x8'))(_0xdaa7('0x9'));var config=require(_0xdaa7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdaa7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2112fa,_0x143f60,_0xe099c0){return new BPromise(function(_0x39c2db,_0x4366b8){return client['request'](_0x2112fa,_0xe099c0)[_0xdaa7('0xc')](function(_0x443b6d){logger[_0xdaa7('0xd')]('Setting,\x20%s,\x20%s',_0x143f60,_0xdaa7('0xe'));logger[_0xdaa7('0xf')](_0xdaa7('0x10'),_0x143f60,'request\x20sent',JSON['stringify'](_0x443b6d));if(_0x443b6d[_0xdaa7('0x11')]){if(_0x443b6d[_0xdaa7('0x11')][_0xdaa7('0x12')]===0x1f4){logger[_0xdaa7('0x11')]('Setting,\x20%s,\x20%s',_0x143f60,_0x443b6d[_0xdaa7('0x11')]['message']);return _0x4366b8(_0x443b6d[_0xdaa7('0x11')][_0xdaa7('0x13')]);}logger[_0xdaa7('0x11')](_0xdaa7('0x14'),_0x143f60,_0x443b6d[_0xdaa7('0x11')]['message']);return _0x39c2db(_0x443b6d[_0xdaa7('0x11')][_0xdaa7('0x13')]);}else{logger[_0xdaa7('0xd')](_0xdaa7('0x14'),_0x143f60,_0xdaa7('0xe'));_0x39c2db(_0x443b6d[_0xdaa7('0x15')]['message']);}})['catch'](function(_0x2bdb86){logger[_0xdaa7('0x11')](_0xdaa7('0x14'),_0x143f60,_0x2bdb86);_0x4366b8(_0x2bdb86);});});}exports[_0xdaa7('0x16')]=function(_0x11822e){var _0x26981d=this;return new Promise(function(_0xb98c91,_0x20d737){return db[_0xdaa7('0x17')]['find']({'raw':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')][_0xdaa7('0x19')]===undefined?!![]:![]:!![],'where':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')]['where']||null:null,'attributes':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')][_0xdaa7('0x1a')]||null:null,'include':_0x11822e[_0xdaa7('0x18')]?_0x11822e[_0xdaa7('0x18')][_0xdaa7('0x1b')]?_['map'](_0x11822e['options']['include'],function(_0x1c60eb){return{'model':db[_0x1c60eb[_0xdaa7('0x1c')]],'as':_0x1c60eb['as'],'attributes':_0x1c60eb[_0xdaa7('0x1a')],'include':_0x1c60eb[_0xdaa7('0x1b')]?_[_0xdaa7('0x1d')](_0x1c60eb['include'],function(_0x517c22){return{'model':db[_0x517c22[_0xdaa7('0x1c')]],'as':_0x517c22['as'],'attributes':_0x517c22[_0xdaa7('0x1a')],'include':_0x517c22['include']?_[_0xdaa7('0x1d')](_0x517c22[_0xdaa7('0x1b')],function(_0x24538c){return{'model':db[_0x24538c[_0xdaa7('0x1c')]],'as':_0x24538c['as'],'attributes':_0x24538c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaa7('0xc')](function(_0x10eb69){logger[_0xdaa7('0xd')](_0xdaa7('0x16'),_0x11822e);logger[_0xdaa7('0xf')](_0xdaa7('0x16'),_0x11822e,JSON['stringify'](_0x10eb69));_0xb98c91(_0x10eb69);})[_0xdaa7('0x1e')](function(_0x35640a){logger[_0xdaa7('0x11')](_0xdaa7('0x16'),_0x35640a[_0xdaa7('0x13')],_0x11822e);_0x20d737(_0x26981d['error'](0x1f4,_0x35640a[_0xdaa7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 1cf1120..04c7454 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3db0ba,_0x2be65c){var _0x2d8e9a=function(_0x780700){while(--_0x780700){_0x3db0ba['push'](_0x3db0ba['shift']());}};_0x2d8e9a(++_0x2be65c);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x4bc6de,_0x36765a){var _0x22507f=function(_0x442b43){while(--_0x442b43){_0x4bc6de['push'](_0x4bc6de['shift']());}};_0x22507f(++_0x36765a);}(_0x7a54,0x106));var _0x47a5=function(_0x3421a1,_0x5800d8){_0x3421a1=_0x3421a1-0x0;var _0x4c04c1=_0x7a54[_0x3421a1];return _0x4c04c1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 26e1b10..e674a92 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 _0x5700=['csc','infobip','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','plivo'];(function(_0x4ffe5f,_0xbb38e9){var _0x5792e8=function(_0x43dce){while(--_0x43dce){_0x4ffe5f['push'](_0x4ffe5f['shift']());}};_0x5792e8(++_0xbb38e9);}(_0x5700,0x137));var _0x0570=function(_0xd3cf67,_0x18edee){_0xd3cf67=_0xd3cf67-0x0;var _0x2f59eb=_0x5700[_0xd3cf67];return _0x2f59eb;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0570('0x0'));module[_0x0570('0x1')]={'name':{'type':Sequelize[_0x0570('0x2')],'unique':_0x0570('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x0570('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0570('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x0570('0x5'),_0x0570('0x6'),_0x0570('0x7'),'clicksend',_0x0570('0x8'),'clickatell','bandwidth',_0x0570('0x9'),_0x0570('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x0570('0x2')]},'authId':{'type':Sequelize[_0x0570('0x2')]},'authToken':{'type':Sequelize[_0x0570('0x2')]},'smsMethod':{'type':Sequelize[_0x0570('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0570('0x2')]},'password':{'type':Sequelize[_0x0570('0x2')]},'apiKey':{'type':Sequelize[_0x0570('0x2')]},'applicationId':{'type':Sequelize[_0x0570('0x2')]},'accountId':{'type':Sequelize[_0x0570('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x0570('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0570('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0570('0xd')],'defaultValue':function(){return _0x0570('0xe');}},'notificationSound':{'type':Sequelize[_0x0570('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0570('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0570('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0570('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0570('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0570('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0570('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0570('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0570('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0570('0xf')],'comment':_0x0570('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x0570('0xc')],'defaultValue':![],'comment':_0x0570('0x11'),'set':function(_0x7ef3d1){if(!_0x7ef3d1)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0570('0x12')](_0x0570('0x13'),_0x7ef3d1);}}}; \ No newline at end of file +var _0x93ba=['plivo','bandwidth','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','twilio','connectel','clicksend'];(function(_0x2af117,_0x5763b7){var _0x28c6a7=function(_0x55051f){while(--_0x55051f){_0x2af117['push'](_0x2af117['shift']());}};_0x28c6a7(++_0x5763b7);}(_0x93ba,0x100));var _0xa93b=function(_0x19fba4,_0x34a771){_0x19fba4=_0x19fba4-0x0;var _0x37ed3b=_0x93ba[_0x19fba4];return _0x37ed3b;};'use strict';var Sequelize=require(_0xa93b('0x0'));var rs=require(_0xa93b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa93b('0x2')],'unique':_0xa93b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa93b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa93b('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa93b('0x4')]();}},'phone':{'type':Sequelize[_0xa93b('0x2')]},'type':{'type':Sequelize['ENUM'](_0xa93b('0x5'),'skebby',_0xa93b('0x6'),_0xa93b('0x7'),_0xa93b('0x8'),'clickatell',_0xa93b('0x9'),_0xa93b('0xa'),_0xa93b('0xb'),_0xa93b('0xc'))},'accountSid':{'type':Sequelize[_0xa93b('0x2')]},'authId':{'type':Sequelize[_0xa93b('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa93b('0xd')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa93b('0x2')]},'apiKey':{'type':Sequelize[_0xa93b('0x2')]},'applicationId':{'type':Sequelize[_0xa93b('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa93b('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa93b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa93b('0xe')],'defaultValue':function(){return _0xa93b('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa93b('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa93b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa93b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa93b('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa93b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa93b('0x11')],'comment':_0xa93b('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa93b('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x358a4b){if(!_0x358a4b)this[_0xa93b('0x13')](_0xa93b('0x14'),null);this[_0xa93b('0x13')](_0xa93b('0x15'),_0x358a4b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f937efe..31c0d9a 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 _0x9d43=['filter','merge','includeAll','SmsAccount','show','params','Pause','intersection','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getDispositions','findOne','Disposition','sort','pick','findAll','rows','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','results','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','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','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','isNil','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','bandwidth','statusGet','csc','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','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where'];(function(_0x5e7dfe,_0x38df7a){var _0x2548cc=function(_0x4f8e30){while(--_0x4f8e30){_0x5e7dfe['push'](_0x5e7dfe['shift']());}};_0x2548cc(++_0x38df7a);}(_0x9d43,0x9b));var _0x39d4=function(_0x2e5e94,_0x10ccd9){_0x2e5e94=_0x2e5e94-0x0;var _0x41e337=_0x9d43[_0x2e5e94];return _0x41e337;};'use strict';var emlformat=require(_0x39d4('0x0'));var rimraf=require(_0x39d4('0x1'));var zipdir=require(_0x39d4('0x2'));var jsonpatch=require(_0x39d4('0x3'));var rp=require(_0x39d4('0x4'));var moment=require(_0x39d4('0x5'));var BPromise=require(_0x39d4('0x6'));var Mustache=require(_0x39d4('0x7'));var util=require('util');var path=require(_0x39d4('0x8'));var sox=require('sox');var csv=require(_0x39d4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39d4('0xa'));var _=require(_0x39d4('0xb'));var squel=require('squel');var crypto=require(_0x39d4('0xc'));var jsforce=require(_0x39d4('0xd'));var deskjs=require(_0x39d4('0xe'));var toCsv=require(_0x39d4('0x9'));var querystring=require('querystring');var Papa=require(_0x39d4('0xf'));var Redis=require(_0x39d4('0x10'));var authService=require(_0x39d4('0x11'));var qs=require(_0x39d4('0x12'));var as=require(_0x39d4('0x13'));var hardwareService=require(_0x39d4('0x14'));var logger=require(_0x39d4('0x15'))('api');var utils=require(_0x39d4('0x16'));var config=require(_0x39d4('0x17'));var licenseUtil=require(_0x39d4('0x18'));var db=require(_0x39d4('0x19'))['db'];config[_0x39d4('0x1a')]=_[_0x39d4('0x1b')](config[_0x39d4('0x1a')],{'host':_0x39d4('0x1c'),'port':0x18eb});var socket=require(_0x39d4('0x1d'))(new Redis(config[_0x39d4('0x1a')]));require(_0x39d4('0x1e'))[_0x39d4('0x1f')](socket);var jayson=require(_0x39d4('0x20'));var client=jayson[_0x39d4('0x21')][_0x39d4('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x264717,_0x38d7ee,_0xf6c76b,_0x47fe00){return new BPromise(function(_0x2cf3d4,_0x433419){var _0x22b4eb=_0x47fe00||client;return _0x22b4eb['request'](_0x264717,_0xf6c76b)['then'](function(_0x5a2696){logger[_0x39d4('0x23')]('SmsAccount,\x20%s,\x20%s',_0x38d7ee,_0x39d4('0x24'));logger[_0x39d4('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38d7ee,'request\x20sent',JSON[_0x39d4('0x26')](_0x5a2696));if(_0x5a2696[_0x39d4('0x27')]){if(_0x5a2696['error']['code']===0x1f4){logger['error'](_0x39d4('0x28'),_0x38d7ee,_0x5a2696[_0x39d4('0x27')][_0x39d4('0x29')]);return _0x433419(_0x5a2696['error']['message']);}logger[_0x39d4('0x27')]('SmsAccount,\x20%s,\x20%s',_0x38d7ee,_0x5a2696['error'][_0x39d4('0x29')]);return _0x2cf3d4(_0x5a2696[_0x39d4('0x27')]['message']);}else{logger['info'](_0x39d4('0x28'),_0x38d7ee,'request\x20sent');_0x2cf3d4(_0x5a2696['result'][_0x39d4('0x29')]);}})[_0x39d4('0x2a')](function(_0x1ed50f){logger[_0x39d4('0x27')]('SmsAccount,\x20%s,\x20%s',_0x38d7ee,_0x1ed50f);_0x433419(_0x1ed50f);});});}function respondWithStatusCode(_0x138426,_0x41b295){_0x41b295=_0x41b295||0xcc;return function(_0x14547f){if(_0x14547f){return _0x138426[_0x39d4('0x2b')](_0x41b295);}return _0x138426[_0x39d4('0x2c')](_0x41b295)['end']();};}function respondWithResult(_0x5cd757,_0x2dabd4){_0x2dabd4=_0x2dabd4||0xc8;return function(_0x59a549){if(_0x59a549){return _0x5cd757['status'](_0x2dabd4)[_0x39d4('0x2d')](_0x59a549);}};}function respondWithFilteredResult(_0x4364a4,_0x239f20){return function(_0x16e098){if(_0x16e098){var _0xa43b43=typeof _0x239f20['offset']===_0x39d4('0x2e')&&typeof _0x239f20['limit']==='undefined';var _0x56b709=_0x16e098[_0x39d4('0x2f')];var _0x10a857=_0xa43b43?0x0:_0x239f20['offset'];var _0x526ac0=_0xa43b43?_0x16e098[_0x39d4('0x2f')]:_0x239f20['offset']+_0x239f20[_0x39d4('0x30')];var _0x2234af;if(_0x526ac0>=_0x56b709){_0x526ac0=_0x56b709;_0x2234af=0xc8;}else{_0x2234af=0xce;}_0x4364a4[_0x39d4('0x2c')](_0x2234af);return _0x4364a4[_0x39d4('0x31')](_0x39d4('0x32'),_0x10a857+'-'+_0x526ac0+'/'+_0x56b709)[_0x39d4('0x2d')](_0x16e098);}return null;};}function patchUpdates(_0x5b492d){return function(_0x3ba0f1){try{jsonpatch[_0x39d4('0x33')](_0x3ba0f1,_0x5b492d,!![]);}catch(_0x446650){return BPromise[_0x39d4('0x34')](_0x446650);}return _0x3ba0f1[_0x39d4('0x35')]();};}function saveUpdates(_0x1e59af,_0x5bba06){return function(_0x19a07f){if(_0x19a07f){return _0x19a07f[_0x39d4('0x36')](_0x1e59af)['then'](function(_0x45fe68){return _0x45fe68;});}return null;};}function removeEntity(_0x5cc66c,_0x19cf1c){return function(_0x55064a){if(_0x55064a){return _0x55064a[_0x39d4('0x37')]()[_0x39d4('0x38')](function(){var _0x866f6a=_0x55064a[_0x39d4('0x39')]({'plain':!![]});var _0x4c9488=_0x39d4('0x3a');return db[_0x39d4('0x3b')][_0x39d4('0x37')]({'where':{'type':_0x4c9488,'resourceId':_0x866f6a['id']}})[_0x39d4('0x38')](function(){return _0x55064a;});})[_0x39d4('0x38')](function(){_0x5cc66c[_0x39d4('0x2c')](0xcc)[_0x39d4('0x3c')]();});}};}function handleEntityNotFound(_0x55c023,_0x596aa5){return function(_0x518c54){if(!_0x518c54){_0x55c023[_0x39d4('0x2b')](0x194);}return _0x518c54;};}function handleError(_0x15c65c,_0x260091){_0x260091=_0x260091||0x1f4;return function(_0x1897fd){logger[_0x39d4('0x27')](_0x1897fd[_0x39d4('0x3d')]);if(_0x1897fd[_0x39d4('0x3e')]){delete _0x1897fd[_0x39d4('0x3e')];}_0x15c65c[_0x39d4('0x2c')](_0x260091)[_0x39d4('0x3f')](_0x1897fd);};}exports[_0x39d4('0x40')]=function(_0x4995fc,_0xc9b936){var _0x16a554={'include':[{'model':db['Pause'],'as':_0x39d4('0x41')}]},_0xea5466={},_0x262f0f={'count':0x0,'rows':[]};var _0x4ce3ba=_[_0x39d4('0x42')](db['SmsAccount'][_0x39d4('0x43')],function(_0x4caa07){return{'name':_0x4caa07[_0x39d4('0x44')],'type':_0x4caa07[_0x39d4('0x45')][_0x39d4('0x46')]};});_0xea5466[_0x39d4('0x47')]=_[_0x39d4('0x42')](_0x4ce3ba,'name');_0xea5466[_0x39d4('0x48')]=_[_0x39d4('0x49')](_0x4995fc[_0x39d4('0x48')]);_0xea5466[_0x39d4('0x4a')]=_['intersection'](_0xea5466[_0x39d4('0x47')],_0xea5466[_0x39d4('0x48')]);_0x16a554[_0x39d4('0x4b')]=_['intersection'](_0xea5466[_0x39d4('0x47')],qs[_0x39d4('0x4c')](_0x4995fc[_0x39d4('0x48')][_0x39d4('0x4c')]));_0x16a554[_0x39d4('0x4b')]=_0x16a554['attributes'][_0x39d4('0x4d')]?_0x16a554[_0x39d4('0x4b')]:_0xea5466[_0x39d4('0x47')];if(!_0x4995fc[_0x39d4('0x48')][_0x39d4('0x4e')](_0x39d4('0x4f'))){_0x16a554[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x4995fc[_0x39d4('0x48')]['limit']);_0x16a554[_0x39d4('0x50')]=qs[_0x39d4('0x50')](_0x4995fc[_0x39d4('0x48')][_0x39d4('0x50')]);}_0x16a554[_0x39d4('0x51')]=qs['sort'](_0x4995fc[_0x39d4('0x48')]['sort']);_0x16a554[_0x39d4('0x52')]=qs[_0x39d4('0x4a')](_['pick'](_0x4995fc[_0x39d4('0x48')],_0xea5466[_0x39d4('0x4a')]),_0x4ce3ba);if(_0x4995fc[_0x39d4('0x48')][_0x39d4('0x53')]){_0x16a554['where']=_[_0x39d4('0x54')](_0x16a554[_0x39d4('0x52')],{'$or':_[_0x39d4('0x42')](_0x4ce3ba,function(_0x209e2a){if(_0x209e2a[_0x39d4('0x45')]!=='VIRTUAL'){var _0x1be2a2={};_0x1be2a2[_0x209e2a['name']]={'$like':'%'+_0x4995fc[_0x39d4('0x48')][_0x39d4('0x53')]+'%'};return _0x1be2a2;}})});}_0x16a554=_[_0x39d4('0x54')]({},_0x16a554,_0x4995fc['options']);var _0x57e75e={'where':_0x16a554[_0x39d4('0x52')]};return db['SmsAccount'][_0x39d4('0x2f')](_0x57e75e)[_0x39d4('0x38')](function(_0x4094f5){_0x262f0f[_0x39d4('0x2f')]=_0x4094f5;if(_0x4995fc['query'][_0x39d4('0x55')]){_0x16a554['include']=[{'all':!![]}];}return db[_0x39d4('0x56')]['findAll'](_0x16a554);})[_0x39d4('0x38')](function(_0x10cf9b){_0x262f0f['rows']=_0x10cf9b;return _0x262f0f;})['then'](respondWithFilteredResult(_0xc9b936,_0x16a554))['catch'](handleError(_0xc9b936,null));};exports[_0x39d4('0x57')]=function(_0x105d49,_0x2c5805){var _0x235c19={'raw':![],'where':{'id':_0x105d49[_0x39d4('0x58')]['id']},'include':[{'model':db[_0x39d4('0x59')],'as':_0x39d4('0x41')}]},_0x36b8f6={};_0x36b8f6[_0x39d4('0x47')]=_[_0x39d4('0x49')](db['SmsAccount'][_0x39d4('0x43')]);_0x36b8f6['query']=_['keys'](_0x105d49[_0x39d4('0x48')]);_0x36b8f6[_0x39d4('0x4a')]=_[_0x39d4('0x5a')](_0x36b8f6['model'],_0x36b8f6[_0x39d4('0x48')]);_0x235c19['attributes']=_[_0x39d4('0x5a')](_0x36b8f6[_0x39d4('0x47')],qs[_0x39d4('0x4c')](_0x105d49[_0x39d4('0x48')][_0x39d4('0x4c')]));_0x235c19[_0x39d4('0x4b')]=_0x235c19['attributes'][_0x39d4('0x4d')]?_0x235c19[_0x39d4('0x4b')]:_0x36b8f6[_0x39d4('0x47')];if(_0x105d49['query'][_0x39d4('0x55')]){_0x235c19[_0x39d4('0x5b')]=[{'all':!![]}];}_0x235c19=_[_0x39d4('0x54')]({},_0x235c19,_0x105d49[_0x39d4('0x5c')]);return db[_0x39d4('0x56')][_0x39d4('0x5d')](_0x235c19)[_0x39d4('0x38')](handleEntityNotFound(_0x2c5805,null))[_0x39d4('0x38')](respondWithResult(_0x2c5805,null))[_0x39d4('0x2a')](handleError(_0x2c5805,null));};exports[_0x39d4('0x5e')]=function(_0x28edd6,_0x8702d1){return db[_0x39d4('0x56')]['create'](_0x28edd6[_0x39d4('0x5f')],{})[_0x39d4('0x38')](function(_0x20c2b7){var _0x444606=_0x28edd6[_0x39d4('0x60')][_0x39d4('0x39')]({'plain':!![]});if(!_0x444606)throw new Error(_0x39d4('0x61'));if(_0x444606[_0x39d4('0x62')]===_0x39d4('0x60')){var _0x1b9381=_0x20c2b7[_0x39d4('0x39')]({'plain':!![]});var _0x3da3b0='SmsAccounts';return db[_0x39d4('0x63')][_0x39d4('0x5d')]({'where':{'name':_0x3da3b0,'userProfileId':_0x444606[_0x39d4('0x64')]},'raw':!![]})[_0x39d4('0x38')](function(_0x5fd5fe){if(_0x5fd5fe&&_0x5fd5fe[_0x39d4('0x65')]===0x0){return db[_0x39d4('0x3b')][_0x39d4('0x5e')]({'name':_0x1b9381[_0x39d4('0x3e')],'resourceId':_0x1b9381['id'],'type':_0x5fd5fe[_0x39d4('0x3e')],'sectionId':_0x5fd5fe['id']},{})[_0x39d4('0x38')](function(){return _0x20c2b7;});}else{return _0x20c2b7;}})[_0x39d4('0x2a')](function(_0x126581){logger[_0x39d4('0x27')](_0x39d4('0x66'),_0x126581);throw _0x126581;});}return _0x20c2b7;})['then'](respondWithResult(_0x8702d1,0xc9))[_0x39d4('0x2a')](handleError(_0x8702d1,null));};exports[_0x39d4('0x36')]=function(_0xe736a9,_0x1639c7){if(_0xe736a9[_0x39d4('0x5f')]['id']){delete _0xe736a9[_0x39d4('0x5f')]['id'];}return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0xe736a9['params']['id']},'include':[{'model':db[_0x39d4('0x59')],'as':_0x39d4('0x41')}]})[_0x39d4('0x38')](handleEntityNotFound(_0x1639c7,null))['then'](saveUpdates(_0xe736a9[_0x39d4('0x5f')],null))['then'](respondWithResult(_0x1639c7,null))[_0x39d4('0x2a')](handleError(_0x1639c7,null));};exports[_0x39d4('0x37')]=function(_0x11b62c,_0x24e0f7){return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x11b62c[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x24e0f7,null))[_0x39d4('0x38')](removeEntity(_0x24e0f7,null))[_0x39d4('0x2a')](handleError(_0x24e0f7,null));};exports['describe']=function(_0xc04d21,_0x4bc18d){return db[_0x39d4('0x56')]['describe']()[_0x39d4('0x38')](respondWithResult(_0x4bc18d,null))['catch'](handleError(_0x4bc18d,null));};exports['addDisposition']=function(_0x42b819,_0x39051e,_0x4ef37a){if(_0x42b819['body']['id']){delete _0x42b819[_0x39d4('0x5f')]['id'];}return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x42b819[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x39051e,null))['then'](function(_0x1b76b9){if(_0x1b76b9){_0x42b819[_0x39d4('0x5f')]['SmsAccountId']=_0x1b76b9['id'];return db['Disposition'][_0x39d4('0x5e')](_0x42b819[_0x39d4('0x5f')]);}})[_0x39d4('0x38')](respondWithResult(_0x39051e,null))[_0x39d4('0x2a')](handleError(_0x39051e,null));};exports[_0x39d4('0x67')]=function(_0x40ae0c,_0x45a171,_0x591973){var _0x713a57={'raw':![],'where':{}};var _0x213b03={};var _0x1fb054={'count':0x0,'rows':[]};return db[_0x39d4('0x56')][_0x39d4('0x68')]({'where':{'id':_0x40ae0c[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x45a171,null))[_0x39d4('0x38')](function(_0x1c194a){if(_0x1c194a){_0x213b03[_0x39d4('0x47')]=_[_0x39d4('0x49')](db[_0x39d4('0x69')]['rawAttributes']);_0x213b03[_0x39d4('0x48')]=_[_0x39d4('0x49')](_0x40ae0c[_0x39d4('0x48')]);_0x213b03[_0x39d4('0x4a')]=_[_0x39d4('0x5a')](_0x213b03[_0x39d4('0x47')],_0x213b03[_0x39d4('0x48')]);_0x713a57[_0x39d4('0x4b')]=_[_0x39d4('0x5a')](_0x213b03['model'],qs['fields'](_0x40ae0c['query'][_0x39d4('0x4c')]));_0x713a57['attributes']=_0x713a57[_0x39d4('0x4b')][_0x39d4('0x4d')]?_0x713a57[_0x39d4('0x4b')]:_0x213b03['model'];if(!_0x40ae0c[_0x39d4('0x48')]['hasOwnProperty']('nolimit')){_0x713a57[_0x39d4('0x30')]=qs['limit'](_0x40ae0c[_0x39d4('0x48')][_0x39d4('0x30')]);_0x713a57[_0x39d4('0x50')]=qs['offset'](_0x40ae0c[_0x39d4('0x48')][_0x39d4('0x50')]);}_0x713a57[_0x39d4('0x51')]=qs[_0x39d4('0x6a')](_0x40ae0c['query'][_0x39d4('0x6a')]);_0x713a57['where']=qs[_0x39d4('0x4a')](_[_0x39d4('0x6b')](_0x40ae0c[_0x39d4('0x48')],_0x213b03[_0x39d4('0x4a')]));_0x713a57[_0x39d4('0x52')]['SmsAccountId']=_0x1c194a['id'];if(_0x40ae0c['query'][_0x39d4('0x53')]){_0x713a57[_0x39d4('0x52')]=_[_0x39d4('0x54')](_0x713a57[_0x39d4('0x52')],{'$or':_[_0x39d4('0x42')](_0x713a57[_0x39d4('0x4b')],function(_0x5f2b39){var _0x3cc0dd={};_0x3cc0dd[_0x5f2b39]={'$like':'%'+_0x40ae0c[_0x39d4('0x48')][_0x39d4('0x53')]+'%'};return _0x3cc0dd;})});}_0x713a57=_[_0x39d4('0x54')]({},_0x713a57,_0x40ae0c[_0x39d4('0x5c')]);return db[_0x39d4('0x69')][_0x39d4('0x2f')]({'where':_0x713a57[_0x39d4('0x52')]})[_0x39d4('0x38')](function(_0x160424){_0x1fb054[_0x39d4('0x2f')]=_0x160424;if(_0x40ae0c['query'][_0x39d4('0x55')]){_0x713a57[_0x39d4('0x5b')]=[{'all':!![]}];}return db[_0x39d4('0x69')][_0x39d4('0x6c')](_0x713a57);})[_0x39d4('0x38')](function(_0xe13d22){_0x1fb054[_0x39d4('0x6d')]=_0xe13d22;return _0x1fb054;});}})[_0x39d4('0x38')](respondWithFilteredResult(_0x45a171,_0x713a57))['catch'](handleError(_0x45a171,null));};exports[_0x39d4('0x6e')]=function(_0x568ef5,_0x5b7389,_0x41bcf3){return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x568ef5[_0x39d4('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b7389,null))[_0x39d4('0x38')](function(_0x2b1299){if(_0x2b1299){return _0x2b1299[_0x39d4('0x6e')](_0x568ef5['query'][_0x39d4('0x6f')]);}})['then'](respondWithStatusCode(_0x5b7389,null))[_0x39d4('0x2a')](handleError(_0x5b7389,null));};exports[_0x39d4('0x70')]=function(_0x4ca8dd,_0x32c7b5,_0x21baca){if(_0x4ca8dd[_0x39d4('0x5f')]['id']){delete _0x4ca8dd[_0x39d4('0x5f')]['id'];}return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x4ca8dd[_0x39d4('0x58')]['id']}})['then'](handleEntityNotFound(_0x32c7b5,null))['then'](function(_0x251c1a){if(_0x251c1a){_0x4ca8dd[_0x39d4('0x5f')][_0x39d4('0x71')]=_0x251c1a['id'];return db[_0x39d4('0x72')][_0x39d4('0x5e')](_0x4ca8dd[_0x39d4('0x5f')]);}})[_0x39d4('0x38')](respondWithResult(_0x32c7b5,null))[_0x39d4('0x2a')](handleError(_0x32c7b5,null));};exports[_0x39d4('0x73')]=function(_0xaee15f,_0x2c6dd9,_0x468ca9){var _0x3037cd={'raw':![],'where':{}};var _0x46520c={};var _0x279912={'count':0x0,'rows':[]};return db[_0x39d4('0x56')][_0x39d4('0x68')]({'where':{'id':_0xaee15f[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x2c6dd9,null))[_0x39d4('0x38')](function(_0x39a9a3){if(_0x39a9a3){_0x46520c['model']=_['keys'](db['CannedAnswer'][_0x39d4('0x43')]);_0x46520c[_0x39d4('0x48')]=_[_0x39d4('0x49')](_0xaee15f[_0x39d4('0x48')]);_0x46520c['filters']=_[_0x39d4('0x5a')](_0x46520c[_0x39d4('0x47')],_0x46520c[_0x39d4('0x48')]);_0x3037cd[_0x39d4('0x4b')]=_['intersection'](_0x46520c[_0x39d4('0x47')],qs[_0x39d4('0x4c')](_0xaee15f[_0x39d4('0x48')][_0x39d4('0x4c')]));_0x3037cd[_0x39d4('0x4b')]=_0x3037cd['attributes'][_0x39d4('0x4d')]?_0x3037cd[_0x39d4('0x4b')]:_0x46520c[_0x39d4('0x47')];if(!_0xaee15f[_0x39d4('0x48')][_0x39d4('0x4e')](_0x39d4('0x4f'))){_0x3037cd['limit']=qs[_0x39d4('0x30')](_0xaee15f[_0x39d4('0x48')][_0x39d4('0x30')]);_0x3037cd[_0x39d4('0x50')]=qs[_0x39d4('0x50')](_0xaee15f[_0x39d4('0x48')][_0x39d4('0x50')]);}_0x3037cd[_0x39d4('0x51')]=qs[_0x39d4('0x6a')](_0xaee15f[_0x39d4('0x48')][_0x39d4('0x6a')]);_0x3037cd[_0x39d4('0x52')]=qs[_0x39d4('0x4a')](_[_0x39d4('0x6b')](_0xaee15f['query'],_0x46520c[_0x39d4('0x4a')]));_0x3037cd[_0x39d4('0x52')][_0x39d4('0x71')]=_0x39a9a3['id'];if(_0xaee15f['query'][_0x39d4('0x53')]){_0x3037cd[_0x39d4('0x52')]=_[_0x39d4('0x54')](_0x3037cd[_0x39d4('0x52')],{'$or':_[_0x39d4('0x42')](_0x3037cd[_0x39d4('0x4b')],function(_0x334a03){var _0x20b7a2={};_0x20b7a2[_0x334a03]={'$like':'%'+_0xaee15f[_0x39d4('0x48')][_0x39d4('0x53')]+'%'};return _0x20b7a2;})});}_0x3037cd=_[_0x39d4('0x54')]({},_0x3037cd,_0xaee15f['options']);return db[_0x39d4('0x72')]['count']({'where':_0x3037cd[_0x39d4('0x52')]})[_0x39d4('0x38')](function(_0x3a0fc4){_0x279912[_0x39d4('0x2f')]=_0x3a0fc4;if(_0xaee15f[_0x39d4('0x48')][_0x39d4('0x55')]){_0x3037cd[_0x39d4('0x5b')]=[{'all':!![]}];}return db[_0x39d4('0x72')]['findAll'](_0x3037cd);})['then'](function(_0x2939e1){_0x279912[_0x39d4('0x6d')]=_0x2939e1;return _0x279912;});}})[_0x39d4('0x38')](respondWithFilteredResult(_0x2c6dd9,_0x3037cd))[_0x39d4('0x2a')](handleError(_0x2c6dd9,null));};exports[_0x39d4('0x74')]=function(_0x1ab4c4,_0x91d347,_0x2a3ed6){return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x1ab4c4['params']['id']}})['then'](handleEntityNotFound(_0x91d347,null))[_0x39d4('0x38')](function(_0x36071e){if(_0x36071e){return _0x36071e[_0x39d4('0x74')](_0x1ab4c4[_0x39d4('0x48')][_0x39d4('0x6f')]);}})['then'](respondWithStatusCode(_0x91d347,null))[_0x39d4('0x2a')](handleError(_0x91d347,null));};exports['notify']=function(_0x55f1d7,_0xef48a4,_0x264b8e){var _0x2f8fbd={'channel':_0x39d4('0x75')};var _0x3790fe=[];var _0x28bdf1=[];var _0x4373fe={};return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x55f1d7['params']['id']},'include':[{'model':db[_0x39d4('0x76')],'as':'Applications'}]})[_0x39d4('0x38')](handleEntityNotFound(_0xef48a4,null))[_0x39d4('0x38')](function(_0x1fbbb7){_0x2f8fbd['account']=_0x1fbbb7;_0x2f8fbd[_0x39d4('0x77')]=_[_0x39d4('0x78')](_0x1fbbb7[_0x39d4('0x79')],[_0x39d4('0x7a')],[_0x39d4('0x7b')]);if(_0x2f8fbd[_0x39d4('0x7c')]['Applications']){delete _0x2f8fbd[_0x39d4('0x7c')][_0x39d4('0x79')];}return db[_0x39d4('0x7d')][_0x39d4('0x7e')]();})[_0x39d4('0x38')](function(_0x23691d){if(!_0x23691d){throw new db[(_0x39d4('0x7f'))][(_0x39d4('0x80'))](_0x39d4('0x81'));}_0x3790fe=_['difference'](_[_0x39d4('0x49')](_0x23691d),['createdAt',_0x39d4('0x82')]);_0x28bdf1=_['difference'](_['keys'](_0x23691d),[_0x39d4('0x83'),_0x39d4('0x82'),_0x39d4('0x84'),_0x39d4('0x85')]);_0x2f8fbd[_0x39d4('0x5f')]={'mapKey':_0x39d4('0x86')};if(_0x2f8fbd[_0x39d4('0x7c')][_0x39d4('0x45')]){switch(_0x2f8fbd[_0x39d4('0x7c')]['type']){case _0x39d4('0x87'):_0x2f8fbd['body'][_0x39d4('0x88')]=_0x55f1d7[_0x39d4('0x5f')]['From'];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x89')];_0x2f8fbd['body'][_0x39d4('0x8a')]=_0x55f1d7[_0x39d4('0x5f')]['MessageSid'];break;case _0x39d4('0x8b'):_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')]='+'+_0x55f1d7['body'][_0x39d4('0x8c')];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x8d')];break;case _0x39d4('0x8e'):_0x2f8fbd['body']['from']=_0x55f1d7[_0x39d4('0x5f')]['from'];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7['body']['message'];break;case _0x39d4('0x8f'):_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x88')];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7['body'][_0x39d4('0x5f')];_0x2f8fbd['body'][_0x39d4('0x8a')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x90')];break;case _0x39d4('0x91'):_0x2f8fbd[_0x39d4('0x5f')]['from']=_0x55f1d7['body'][_0x39d4('0x92')];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x93')];_0x2f8fbd[_0x39d4('0x5f')]['messageId']=_0x55f1d7['body'][_0x39d4('0x94')];break;case'infobip':_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')]='+'+_0x55f1d7[_0x39d4('0x5f')]['results'][0x0]['from'];_0x2f8fbd['body'][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x95')][0x0][_0x39d4('0x8d')];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x8a')]=_0x55f1d7[_0x39d4('0x5f')]['results'][0x0][_0x39d4('0x8a')];break;case'csc':_0x2f8fbd['body'][_0x39d4('0x88')]=_0x55f1d7[_0x39d4('0x5f')]['originatingAddress'];_0x2f8fbd[_0x39d4('0x5f')]['body']=_0x55f1d7['body'][_0x39d4('0x96')][_0x39d4('0x29')];break;case _0x39d4('0x97'):_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')]=_0x55f1d7['body'][_0x39d4('0x98')];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x8d')];_0x2f8fbd[_0x39d4('0x5f')]['messageId']=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x99')];break;case'bandwidth':_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x8a')]=_0x55f1d7[_0x39d4('0x5f')][0x0][_0x39d4('0x29')]['id'];_0x2f8fbd[_0x39d4('0x5f')]['from']=_0x55f1d7['body'][0x0][_0x39d4('0x29')][_0x39d4('0x88')];_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][0x0][_0x39d4('0x29')]['text'];break;case _0x39d4('0x9a'):_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')]=_0x55f1d7[_0x39d4('0x5f')]['from'];_0x2f8fbd['body'][_0x39d4('0x5f')]=_0x55f1d7[_0x39d4('0x5f')][_0x39d4('0x29')];_0x2f8fbd[_0x39d4('0x5f')]['messageId']=_0x55f1d7['body'][_0x39d4('0x9b')];break;}}if(_0x2f8fbd[_0x39d4('0x5f')]['id']){delete _0x2f8fbd[_0x39d4('0x5f')]['id'];}if(_['isNil'](_0x2f8fbd[_0x39d4('0x5f')]['from'])){throw new db['Sequelize'][(_0x39d4('0x80'))](_0x39d4('0x9c'));}if(_['isNil'](_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')])||_0x2f8fbd[_0x39d4('0x5f')]['body']===''){throw new db['Sequelize'][(_0x39d4('0x80'))](_0x39d4('0x9d'));}if(_['isNil'](_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x9e')])){throw new db[(_0x39d4('0x7f'))]['ValidationError'](_0x39d4('0x9f')+_0x28bdf1);}if(!_['includes'](_0x28bdf1,_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x9e')])){throw new db[(_0x39d4('0x7f'))][(_0x39d4('0x80'))](_0x39d4('0xa0')+_0x28bdf1);}_0x4373fe[_0x2f8fbd[_0x39d4('0x5f')]['mapKey']]=_0x2f8fbd[_0x39d4('0x5f')]['from'];return db[_0x39d4('0xa1')][_0x39d4('0x5d')]({'where':{'id':_0x2f8fbd[_0x39d4('0x7c')][_0x39d4('0x85')]},'include':[{'model':db[_0x39d4('0x7d')],'as':_0x39d4('0xa2'),'where':_0x4373fe,'limit':0x1,'order':[[_0x39d4('0x82'),_0x39d4('0xa3')]]}]});})[_0x39d4('0x38')](handleEntityNotFound(_0xef48a4,null))[_0x39d4('0x38')](function(_0x35f5fe){if(_0x35f5fe){_0x2f8fbd[_0x39d4('0xa4')]=_[_0x39d4('0xa5')](_0x35f5fe,[_0x39d4('0xa2')]);if(_0x35f5fe['Contacts']['length']){return _0x35f5fe[_0x39d4('0xa2')][0x0];}var _0x576bdc=_['defaults'](_0x2f8fbd['body'],{'firstName':_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')],'ListId':_0x35f5fe['id']});_0x576bdc[_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x9e')]]=_0x2f8fbd['body'][_0x39d4('0x88')];return db['CmContact'][_0x39d4('0x5e')](_0x576bdc,{'fields':_0x3790fe,'raw':!![]});}})['then'](handleEntityNotFound(_0xef48a4,null))['then'](function(_0x4924dc){if(_0x4924dc){_0x2f8fbd[_0x39d4('0xa6')]=_0x4924dc;var _0x42686d={'ContactId':_0x4924dc['id'],'phone':_0x2f8fbd['body'][_0x39d4('0x88')],'SmsAccountId':_0x55f1d7[_0x39d4('0x58')]['id']};var _0x140a8b={'ContactId':_0x4924dc['id'],'SmsAccountId':_0x55f1d7[_0x39d4('0x58')]['id'],'closed':![]};return db[_0x39d4('0xa7')]['find']({'where':_0x140a8b})['then'](function(_0x2c44b7){if(_0x2c44b7){return[_0x2c44b7,![]];}return db[_0x39d4('0xa7')][_0x39d4('0x5e')](_0x42686d)[_0x39d4('0x38')](function(_0x16eef8){return[_0x16eef8,!![]];});});}})[_0x39d4('0xa8')](function(_0x1df4b9,_0x2be527){_0x2f8fbd['interaction']=_0x1df4b9[_0x39d4('0x39')]({'plain':!![]});_0x2f8fbd[_0x39d4('0xa9')]['created']=![];if(_0x2be527){if(_0x2f8fbd[_0x39d4('0x7c')][_0x39d4('0xaa')]){_0x2f8fbd[_0x39d4('0x77')][_0x39d4('0xab')]({'id':0x0,'priority':_0x2f8fbd[_0x39d4('0x77')][_0x39d4('0x4d')]+0x1,'app':'close','appdata':_0x39d4('0xac'),'interval':_0x39d4('0xad')});}_0x2f8fbd[_0x39d4('0xa9')]['created']=!![];}return db[_0x39d4('0xae')][_0x39d4('0x5e')]({'phone':_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x88')],'messageId':_0x2f8fbd['body'][_0x39d4('0x8a')],'body':_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0x5f')],'SmsAccountId':_0x55f1d7[_0x39d4('0x58')]['id'],'SmsInteractionId':_0x1df4b9['id'],'direction':'in','ContactId':_0x1df4b9[_0x39d4('0xaf')],'AttachmentId':_0x2f8fbd[_0x39d4('0x5f')][_0x39d4('0xb0')]});})[_0x39d4('0x38')](function(_0x2ec2af){_0x2f8fbd[_0x39d4('0x29')]=_0x2ec2af;if(!_0x2f8fbd[_0x39d4('0xa9')][_0x39d4('0xb1')])return;return db[_0x39d4('0xb2')][_0x39d4('0x5d')]({'attributes':['id',_0x39d4('0x3e')],'where':{'id':_0x2f8fbd[_0x39d4('0xa9')][_0x39d4('0xb1')]}});})[_0x39d4('0x38')](function(_0x56e921){if(_0x56e921){_0x2f8fbd[_0x39d4('0x77')][_0x39d4('0xb3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x56e921[_0x39d4('0x3e')]+','+(_0x2f8fbd[_0x39d4('0x7c')][_0x39d4('0xb4')]||0xa),'interval':'*,*,*,*'});}if(!_0x2f8fbd[_0x39d4('0xa9')][_0x39d4('0xb5')])return;return db['SmsQueue'][_0x39d4('0x5d')]({'attributes':['id',_0x39d4('0x3e')],'where':{'id':_0x2f8fbd['interaction']['queueId']}});})['then'](function(_0xae73e5){if(_0xae73e5){_0x2f8fbd[_0x39d4('0x77')][_0x39d4('0xb3')]({'id':0x0,'priority':0x1,'app':_0x39d4('0xb6'),'appdata':_0xae73e5['name']+','+(_0x2f8fbd[_0x39d4('0x7c')][_0x39d4('0xb7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x39d4('0xb8'),_0x39d4('0xb9'),_0x2f8fbd);})['then'](function(_0x34b96f){if(_0x34b96f){var _0x496559=0xc8;var _0x2eb7c8=_0x39d4('0xba');logger['info'](_0x39d4('0xbb'),_0x2eb7c8,_0x496559,_0x39d4('0xbc'));logger[_0x39d4('0x25')](_0x39d4('0xbd'),_0x2eb7c8,_0x496559,_0x39d4('0xbc'),JSON['stringify'](_0x34b96f));if(_0x2f8fbd['account'][_0x39d4('0x45')]==='twilio'){return _0xef48a4['status'](_0x496559)[_0x39d4('0x31')](_0x39d4('0xbe'),_0x39d4('0xbf'))['send']('\x0a');}else{return _0xef48a4[_0x39d4('0x2c')](_0x496559)['json'](_0x34b96f);}}})[_0x39d4('0x2a')](handleError(_0xef48a4,null));};exports['addApplications']=function(_0x56ce41,_0x240e87){var _0x4f4364=_0x56ce41['params']['id'];var _0x26cf33=_0x56ce41[_0x39d4('0x5f')];var _0x30670b=0xc8;var _0x19adc6=null;return db[_0x39d4('0xc0')][_0x39d4('0xc1')]({'isolationLevel':db[_0x39d4('0xc0')]['Transaction']['ISOLATION_LEVELS'][_0x39d4('0xc2')]},function(_0x3dc4c0){return db[_0x39d4('0x56')][_0x39d4('0x68')]({'where':{'id':_0x4f4364},'transaction':_0x3dc4c0})['then'](function(_0x419a4a){if(_0x419a4a){return db['SmsApplication'][_0x39d4('0x37')]({'where':{'SmsAccountId':_0x4f4364},'transaction':_0x3dc4c0})[_0x39d4('0x38')](function(){var _0x53dca9=_[_0x39d4('0x42')](_0x26cf33,function(_0x108869){_0x108869[_0x39d4('0x71')]=_0x4f4364;return _0x108869;});return db[_0x39d4('0x76')][_0x39d4('0xc3')](_0x53dca9,{'transaction':_0x3dc4c0});});}else{_0x30670b=0x194;_0x19adc6=[];}});})[_0x39d4('0x38')](function(){if(_0x30670b!==0x194){return db[_0x39d4('0x76')][_0x39d4('0xc4')]({'where':{'SmsAccountId':_0x4f4364},'order':_0x39d4('0x7a')})[_0x39d4('0x38')](function(_0x4efb50){_0x19adc6=_0x4efb50;});}})[_0x39d4('0x2a')](function(_0x40bd16){_0x30670b=0x1f4;logger[_0x39d4('0x27')](_0x40bd16[_0x39d4('0x3d')]);if(_0x40bd16[_0x39d4('0x3e')]){delete _0x40bd16['name'];}_0x19adc6=_0x40bd16;})['finally'](function(){if(_0x19adc6===null){_0x240e87[_0x39d4('0x2b')](_0x30670b);}else{if(_0x30670b===0x1f4){_0x240e87['status'](_0x30670b)[_0x39d4('0x3f')](_0x19adc6);}else{_0x240e87[_0x39d4('0x2c')](_0x30670b)['json'](_0x19adc6);}}});};exports[_0x39d4('0xc5')]=function(_0x12828d,_0x2924da,_0x14edca){var _0x40cb5b={};var _0xa01b5d={};var _0x5e46bc;var _0x22116d;return db[_0x39d4('0x56')][_0x39d4('0x68')]({'where':{'id':_0x12828d[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x2924da,null))[_0x39d4('0x38')](function(_0xefc54c){if(_0xefc54c){_0x5e46bc=_0xefc54c;_0xa01b5d[_0x39d4('0x47')]=_[_0x39d4('0x49')](db[_0x39d4('0x76')]['rawAttributes']);_0xa01b5d[_0x39d4('0x48')]=_[_0x39d4('0x49')](_0x12828d[_0x39d4('0x48')]);_0xa01b5d[_0x39d4('0x4a')]=_[_0x39d4('0x5a')](_0xa01b5d[_0x39d4('0x47')],_0xa01b5d[_0x39d4('0x48')]);_0x40cb5b[_0x39d4('0x4b')]=_[_0x39d4('0x5a')](_0xa01b5d[_0x39d4('0x47')],qs[_0x39d4('0x4c')](_0x12828d[_0x39d4('0x48')][_0x39d4('0x4c')]));_0x40cb5b[_0x39d4('0x4b')]=_0x40cb5b['attributes']['length']?_0x40cb5b['attributes']:_0xa01b5d[_0x39d4('0x47')];_0x40cb5b[_0x39d4('0x51')]=qs[_0x39d4('0x6a')](_0x12828d[_0x39d4('0x48')][_0x39d4('0x6a')]);_0x40cb5b[_0x39d4('0x52')]=qs['filters'](_[_0x39d4('0x6b')](_0x12828d['query'],_0xa01b5d[_0x39d4('0x4a')]));if(_0x12828d[_0x39d4('0x48')][_0x39d4('0x53')]){_0x40cb5b['where']=_[_0x39d4('0x54')](_0x40cb5b[_0x39d4('0x52')],{'$or':_[_0x39d4('0x42')](_0x40cb5b[_0x39d4('0x4b')],function(_0x4d6eb5){var _0x3e8ae1={};_0x3e8ae1[_0x4d6eb5]={'$like':'%'+_0x12828d[_0x39d4('0x48')][_0x39d4('0x53')]+'%'};return _0x3e8ae1;})});}_0x40cb5b=_[_0x39d4('0x54')]({},_0x40cb5b,_0x12828d[_0x39d4('0x5c')]);return _0x5e46bc['getApplications'](_0x40cb5b);}})[_0x39d4('0x38')](function(_0x5990ad){if(_0x5990ad){_0x22116d=_0x5990ad[_0x39d4('0x4d')];if(!_0x12828d[_0x39d4('0x48')]['hasOwnProperty'](_0x39d4('0x4f'))){_0x40cb5b[_0x39d4('0x30')]=qs['limit'](_0x12828d['query'][_0x39d4('0x30')]);_0x40cb5b[_0x39d4('0x50')]=qs[_0x39d4('0x50')](_0x12828d['query']['offset']);}return _0x5e46bc['getApplications'](_0x40cb5b);}})[_0x39d4('0x38')](function(_0x21f2f4){if(_0x21f2f4){return _0x21f2f4?{'count':_0x22116d,'rows':_0x21f2f4}:null;}})[_0x39d4('0x38')](respondWithResult(_0x2924da,null))[_0x39d4('0x2a')](handleError(_0x2924da,null));};exports[_0x39d4('0xc6')]=function(_0x153238,_0x25d43a,_0x1975f3){var _0x5201e9={'raw':![],'where':{}};var _0x49b8c9={};var _0x363799={'count':0x0,'rows':[]};return db[_0x39d4('0x56')][_0x39d4('0x68')]({'where':{'id':_0x153238['params']['id']}})['then'](handleEntityNotFound(_0x25d43a,null))[_0x39d4('0x38')](function(_0xfd4687){if(_0xfd4687){_0x49b8c9[_0x39d4('0x47')]=_[_0x39d4('0x49')](db['SmsInteraction'][_0x39d4('0x43')]);_0x49b8c9[_0x39d4('0x48')]=_[_0x39d4('0x49')](_0x153238[_0x39d4('0x48')]);_0x49b8c9['filters']=_[_0x39d4('0x5a')](_0x49b8c9[_0x39d4('0x47')],_0x49b8c9['query']);_0x5201e9[_0x39d4('0x4b')]=_[_0x39d4('0x5a')](_0x49b8c9[_0x39d4('0x47')],qs[_0x39d4('0x4c')](_0x153238[_0x39d4('0x48')][_0x39d4('0x4c')]));_0x5201e9[_0x39d4('0x4b')]=_0x5201e9[_0x39d4('0x4b')][_0x39d4('0x4d')]?_0x5201e9['attributes']:_0x49b8c9[_0x39d4('0x47')];if(!_0x153238[_0x39d4('0x48')]['hasOwnProperty'](_0x39d4('0x4f'))){_0x5201e9[_0x39d4('0x30')]=qs[_0x39d4('0x30')](_0x153238['query']['limit']);_0x5201e9[_0x39d4('0x50')]=qs[_0x39d4('0x50')](_0x153238[_0x39d4('0x48')][_0x39d4('0x50')]);}_0x5201e9['order']=qs[_0x39d4('0x6a')](_0x153238[_0x39d4('0x48')][_0x39d4('0x6a')]);_0x5201e9[_0x39d4('0x52')]=qs['filters'](_[_0x39d4('0x6b')](_0x153238[_0x39d4('0x48')],_0x49b8c9[_0x39d4('0x4a')]));_0x5201e9[_0x39d4('0x52')][_0x39d4('0x71')]=_0xfd4687['id'];if(_0x153238[_0x39d4('0x48')][_0x39d4('0x53')]){_0x5201e9[_0x39d4('0x52')]=_[_0x39d4('0x54')](_0x5201e9['where'],{'$or':_[_0x39d4('0x42')](_0x5201e9[_0x39d4('0x4b')],function(_0x350c7c){var _0x3200b3={};_0x3200b3[_0x350c7c]={'$like':'%'+_0x153238[_0x39d4('0x48')][_0x39d4('0x53')]+'%'};return _0x3200b3;})});}_0x5201e9=_[_0x39d4('0x54')]({},_0x5201e9,_0x153238['options']);return db['SmsInteraction'][_0x39d4('0x2f')]({'where':_0x5201e9[_0x39d4('0x52')]})[_0x39d4('0x38')](function(_0x572650){_0x363799['count']=_0x572650;if(_0x153238[_0x39d4('0x48')][_0x39d4('0x55')]){_0x5201e9[_0x39d4('0x5b')]=[{'model':db[_0x39d4('0x7d')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x39d4('0xc7'),'attributes':[_0x39d4('0x3e'),_0x39d4('0xc8'),_0x39d4('0xc9')],'required':![]},{'model':db[_0x39d4('0xca')],'as':_0x39d4('0xcb'),'attributes':['id',_0x39d4('0x3e'),_0x39d4('0xcc')],'where':_0x153238[_0x39d4('0x48')]['tag']?{'id':_0x153238['query']['tag']}:undefined,'required':_0x153238[_0x39d4('0x48')][_0x39d4('0xcd')]?!![]:![]}];}return db[_0x39d4('0xa7')][_0x39d4('0x6c')](_0x5201e9);})[_0x39d4('0x38')](function(_0x2ddca1){_0x363799[_0x39d4('0x6d')]=_0x2ddca1;return _0x363799;});}})[_0x39d4('0x38')](respondWithFilteredResult(_0x25d43a,_0x5201e9))[_0x39d4('0x2a')](handleError(_0x25d43a,null));};exports['send']=function(_0x49adc3,_0x50d100,_0x93f7f4){var _0x1ca313,_0x21464c,_0xa143b2;if(_[_0x39d4('0xce')](_0x49adc3['body'][_0x39d4('0x5f')])||_0x49adc3[_0x39d4('0x5f')]['body']===''){throw new db[(_0x39d4('0x7f'))][(_0x39d4('0x80'))](_0x39d4('0x9d'));}if(_[_0x39d4('0xce')](_0x49adc3['body']['to'])){throw new db[(_0x39d4('0x7f'))][(_0x39d4('0x80'))](_0x39d4('0xcf'));}_0x1ca313=_0x49adc3['body']['to'];return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x49adc3[_0x39d4('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x39d4('0xd0'),'include':[{'model':db['CmContact'],'as':_0x39d4('0xa2'),'where':{'mobile':_0x1ca313},'limit':0x1,'order':[[_0x39d4('0x82'),_0x39d4('0xa3')]]}]}]})[_0x39d4('0x38')](handleEntityNotFound(_0x50d100,null))['then'](function(_0x415ead){if(_0x415ead&&_0x415ead[_0x39d4('0xd0')]){_0x21464c=_0x415ead[_0x39d4('0x39')]({'plain':!![]});if(_0x21464c['List']&&_0x21464c[_0x39d4('0xd0')][_0x39d4('0xa2')][_0x39d4('0x4d')]){return _0x21464c[_0x39d4('0xd0')][_0x39d4('0xa2')][0x0];}return db[_0x39d4('0x7d')][_0x39d4('0x5e')](_[_0x39d4('0x1b')](_0x49adc3[_0x39d4('0x5f')],{'firstName':_0x1ca313,'mobile':_0x1ca313,'phone':_0x1ca313,'ListId':_0x21464c[_0x39d4('0x85')]}));}})[_0x39d4('0x38')](handleEntityNotFound(_0x50d100,null))[_0x39d4('0x38')](function(_0x5b18a2){if(_0x5b18a2){_0xa143b2=_0x5b18a2;return db[_0x39d4('0xa7')]['find']({'where':{'ContactId':_0xa143b2['id'],'closed':![],'SmsAccountId':_0x21464c['id']}})[_0x39d4('0x38')](function(_0x1fff39){if(_0x1fff39){return[_0x1fff39,![]];}return db[_0x39d4('0xa7')][_0x39d4('0x5e')]({'UserId':_0x49adc3['user']['id'],'ContactId':_0xa143b2['id'],'SmsAccountId':_0x21464c['id'],'phone':_0x1ca313,'firstMsgDirection':_0x39d4('0xd1'),'Messages':[_[_0x39d4('0x54')](_0x49adc3[_0x39d4('0x5f')],{'read':![],'body':_0x49adc3['body'][_0x39d4('0x5f')],'phone':_0x1ca313,'SmsAccountId':_0x21464c['id'],'UserId':_0x49adc3[_0x39d4('0x60')]['id'],'ContactId':_0xa143b2['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x39d4('0x38')](function(_0x43d446){return[_0x43d446,!![]];});});}})[_0x39d4('0xa8')](function(_0x33191b,_0x3da54a){if(_0x3da54a){return _0x33191b;}return db[_0x39d4('0xae')][_0x39d4('0x5e')](_[_0x39d4('0x54')](_0x49adc3[_0x39d4('0x5f')],{'read':![],'body':_0x49adc3[_0x39d4('0x5f')][_0x39d4('0x5f')],'phone':_0x1ca313,'SmsAccountId':_0x21464c['id'],'SmsInteractionId':_0x33191b['id'],'UserId':_0x49adc3[_0x39d4('0x60')]['id'],'ContactId':_0xa143b2['id']}))[_0x39d4('0x38')](function(_0x50883c){_0x33191b['dataValues'][_0x39d4('0xd2')]=[];_0x33191b[_0x39d4('0xd3')][_0x39d4('0xd2')][_0x39d4('0xab')](_0x50883c['dataValues']);return _0x33191b;});})['then'](respondWithResult(_0x50d100,null))[_0x39d4('0x2a')](handleError(_0x50d100,null));};exports[_0x39d4('0x2c')]=function(_0xd43bb2,_0x27a136,_0x2f73b5){if(_0xd43bb2[_0x39d4('0x5f')]['id']){delete _0xd43bb2[_0x39d4('0x5f')]['id'];}var _0x366282,_0xfa56,_0x15b2f0;return db['SmsAccount'][_0x39d4('0x5d')]({'where':{'id':_0xd43bb2[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x27a136,null))[_0x39d4('0x38')](function(_0x406c40){if(_0x406c40){_0x15b2f0=_0x406c40;logger[_0x39d4('0x25')](_0x39d4('0xbb'),_0x39d4('0x2c'),_0x39d4('0xd4'),_0x406c40[_0x39d4('0x45')],util[_0x39d4('0xd5')](_0xd43bb2['body'],{'showHidden':![],'depth':null}));switch(_0x406c40[_0x39d4('0x45')]){case _0x39d4('0x8b'):if(_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xd6')]&&_0xd43bb2[_0x39d4('0x5f')]['status']){_0xfa56=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x2c')];return db['SmsMessage'][_0x39d4('0x5d')]({'where':{'messageId':_0xd43bb2['body']['skebby_dispatch_id']}});}break;case _0x39d4('0x8e'):if(_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xd7')]&&_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xd8')]){_0xfa56=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xd8')];return db[_0x39d4('0xae')][_0x39d4('0x5d')]({'where':{'messageId':_0xd43bb2['body'][_0x39d4('0xd7')]}});}break;case'clicksend':if(_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x90')]&&_0xd43bb2[_0x39d4('0x5f')]['status_code']){_0xfa56=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xd9')];return db[_0x39d4('0xae')]['find']({'where':{'messageId':_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x90')]}});}break;case _0x39d4('0xda'):var _0x540e5b=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x95')][0x0];if(_0x540e5b[_0x39d4('0x8a')]&&_0x540e5b[_0x39d4('0x2c')][_0x39d4('0xdb')]===_0x39d4('0xdc')){_0xfa56=_0x540e5b[_0x39d4('0x2c')]['groupName'];return db[_0x39d4('0xae')]['find']({'where':{'messageId':_0x540e5b[_0x39d4('0x8a')]}});}break;case _0x39d4('0x97'):if(_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x8a')]&&_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x2c')]){_0xfa56=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x2c')];return db[_0x39d4('0xae')][_0x39d4('0x5d')]({'where':{'messageId':_0xd43bb2['body'][_0x39d4('0x8a')]}});}break;case'bandwidth':if(_0xd43bb2['body'][0x0][_0x39d4('0x29')]['id']){_0xfa56=_0xd43bb2[_0x39d4('0x5f')][0x0][_0x39d4('0x45')];return db['SmsMessage'][_0x39d4('0x5d')]({'where':{'messageId':_0xd43bb2['body'][0x0][_0x39d4('0x29')]['id']}});}break;case _0x39d4('0x9a'):if(_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xdd')]&&_0xd43bb2[_0x39d4('0x5f')]['status']){_0xfa56=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x2c')];return db[_0x39d4('0xae')][_0x39d4('0x5d')]({'where':{'messageId':_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0xdd')]}});}break;}}})[_0x39d4('0x38')](handleEntityNotFound(_0x27a136,null))[_0x39d4('0x38')](function(_0x41927f){if(_0x41927f){_0x366282=_0x41927f;switch(_0x15b2f0[_0x39d4('0x45')]){case'skebby':if(_0xfa56===_0x39d4('0xdc')){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger[_0x39d4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x39d4('0x2c'),'skebby',util[_0x39d4('0xd5')](_0xd43bb2[_0x39d4('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x39d4('0x8e'):if(_0xfa56==='1'){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger[_0x39d4('0x27')](_0x39d4('0xbb'),_0x39d4('0x2c'),'skebby',util[_0x39d4('0xd5')](_0xd43bb2[_0x39d4('0x5f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xd43bb2['body'][_0x39d4('0xde')]&&_0xfa56>=0xc8&&_0xfa56<=0xce){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger[_0x39d4('0x27')](_0x39d4('0xbb'),_0x39d4('0x2c'),_0x39d4('0x8f'),util[_0x39d4('0xd5')](_0xd43bb2[_0x39d4('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x39d4('0xda'):var _0x76c8fa=_0xd43bb2[_0x39d4('0x5f')][_0x39d4('0x95')][0x0];if(_0x76c8fa[_0x39d4('0x2c')][_0x39d4('0xdb')]==='DELIVERED'){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger['error'](_0x39d4('0xbb'),_0x39d4('0x2c'),_0x39d4('0xda'),util['inspect'](_0xd43bb2['body'],{'showHidden':![],'depth':null}));}break;case _0x39d4('0x97'):if(_0xfa56==_0x39d4('0xdf')||_0xfa56==_0x39d4('0xe0')){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger[_0x39d4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x39d4('0x2c'),_0x39d4('0x97'),util[_0x39d4('0xd5')](_0xd43bb2[_0x39d4('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xfa56==_0x39d4('0xe1')){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger[_0x39d4('0x27')](_0x39d4('0xbb'),_0x39d4('0x2c'),_0x39d4('0xe2'),util[_0x39d4('0xd5')](_0xd43bb2['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xfa56==='DELIVRD'||_0xfa56==='ACCEPTD'){return _0x366282[_0x39d4('0x36')]({'read':!![]});}else{logger[_0x39d4('0x27')](_0x39d4('0xbb'),_0x39d4('0x2c'),_0x39d4('0x9a'),util[_0x39d4('0xd5')](_0xd43bb2[_0x39d4('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x366282;}})[_0x39d4('0x38')](respondWithResult(_0x27a136,null))[_0x39d4('0x2a')](handleError(_0x27a136,null));};exports[_0x39d4('0xe3')]=function(_0x3c2700,_0x289536,_0x52ce77){var _0x39e8e0,_0x3d274e,_0x456ab7;return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x3c2700[_0x39d4('0x58')]['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x289536,null))[_0x39d4('0x38')](function(_0x3c3fc0){if(_0x3c3fc0){_0x456ab7=_0x3c3fc0;logger[_0x39d4('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x39d4('0x2c'),_0x39d4('0xd4'),_0x3c3fc0['type'],util[_0x39d4('0xd5')](_0x3c2700[_0x39d4('0x48')],{'showHidden':![],'depth':null}));switch(_0x3c3fc0[_0x39d4('0x45')]){case _0x39d4('0xe4'):if(_0x3c2700['query'][_0x39d4('0xe5')]&&_0x3c2700[_0x39d4('0x48')][_0x39d4('0xe6')]){_0x3d274e=_0x3c2700['query'][_0x39d4('0xe6')];return db[_0x39d4('0xae')][_0x39d4('0x5d')]({'where':{'messageId':_0x3c2700[_0x39d4('0x48')][_0x39d4('0xe5')]}});}break;}}})['then'](handleEntityNotFound(_0x289536,null))[_0x39d4('0x38')](function(_0x45b768){if(_0x45b768){_0x39e8e0=_0x45b768;switch(_0x456ab7[_0x39d4('0x45')]){case'csc':if(_0x3d274e==='2'||_0x3d274e==='6'){return _0x39e8e0['update']({'read':!![]});}else{logger[_0x39d4('0x27')](_0x39d4('0xbb'),'status',_0x39d4('0xe4'),util[_0x39d4('0xd5')](_0x3c2700[_0x39d4('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x39e8e0;}})[_0x39d4('0x38')](respondWithResult(_0x289536,null))[_0x39d4('0x2a')](handleError(_0x289536,null));};exports[_0x39d4('0xe7')]=function(_0x112476,_0x5c0d08,_0x670eef){return db[_0x39d4('0x56')][_0x39d4('0x5d')]({'where':{'id':_0x112476['params']['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x5c0d08,null))['then'](function(_0x244d93){if(_0x244d93){return _0x244d93[_0x39d4('0xe7')](_0x112476[_0x39d4('0x5f')]['ids'],_[_0x39d4('0xa5')](_0x112476[_0x39d4('0x5f')],[_0x39d4('0x6f'),'id'])||{})['spread'](function(_0x163a9c){for(var _0x40e873=0x0;_0x40e873<_0x112476[_0x39d4('0x5f')]['ids'][_0x39d4('0x4d')];_0x40e873+=0x1){socket[_0x39d4('0xe8')](_0x39d4('0xe9'),{'UserId':Number(_0x112476[_0x39d4('0x5f')][_0x39d4('0x6f')][_0x40e873]),'SmsAccountId':Number(_0x112476['params']['id'])});}return _0x163a9c;});}})[_0x39d4('0x38')](respondWithResult(_0x5c0d08,null))[_0x39d4('0x2a')](handleError(_0x5c0d08,null));};exports['removeAgents']=function(_0x5205e6,_0x531c2a,_0x15fa60){return db['SmsAccount'][_0x39d4('0x5d')]({'where':{'id':_0x5205e6['params']['id']}})[_0x39d4('0x38')](handleEntityNotFound(_0x531c2a,null))[_0x39d4('0x38')](function(_0xfd9984){if(_0xfd9984){return _0xfd9984[_0x39d4('0xea')](_0x5205e6[_0x39d4('0x48')][_0x39d4('0x6f')])[_0x39d4('0x38')](function(){if(_[_0x39d4('0xeb')](_0x5205e6[_0x39d4('0x48')][_0x39d4('0x6f')])){for(var _0x161abd=0x0;_0x161abd<_0x5205e6[_0x39d4('0x48')][_0x39d4('0x6f')][_0x39d4('0x4d')];_0x161abd+=0x1){socket[_0x39d4('0xe8')](_0x39d4('0xec'),{'UserId':Number(_0x5205e6['query'][_0x39d4('0x6f')][_0x161abd]),'SmsAccountId':Number(_0x5205e6['params']['id'])});}}else{socket[_0x39d4('0xe8')](_0x39d4('0xec'),{'UserId':Number(_0x5205e6[_0x39d4('0x48')][_0x39d4('0x6f')]),'SmsAccountId':Number(_0x5205e6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x531c2a,null))[_0x39d4('0x2a')](handleError(_0x531c2a,null));};exports[_0x39d4('0xed')]=function(_0x59e87f,_0xcfdc4,_0x66db88){var _0x206497={};var _0xaec4f0={};var _0x490bb3;var _0x16e5e8;return db['SmsAccount'][_0x39d4('0x68')]({'where':{'id':_0x59e87f[_0x39d4('0x58')]['id']}})['then'](handleEntityNotFound(_0xcfdc4,null))[_0x39d4('0x38')](function(_0xcc4ba5){if(_0xcc4ba5){_0x490bb3=_0xcc4ba5;_0xaec4f0[_0x39d4('0x47')]=_[_0x39d4('0x49')](db[_0x39d4('0xb2')][_0x39d4('0x43')]);_0xaec4f0[_0x39d4('0x48')]=_[_0x39d4('0x49')](_0x59e87f[_0x39d4('0x48')]);_0xaec4f0[_0x39d4('0x4a')]=_[_0x39d4('0x5a')](_0xaec4f0[_0x39d4('0x47')],_0xaec4f0['query']);_0x206497[_0x39d4('0x4b')]=_[_0x39d4('0x5a')](_0xaec4f0[_0x39d4('0x47')],qs[_0x39d4('0x4c')](_0x59e87f['query'][_0x39d4('0x4c')]));_0x206497[_0x39d4('0x4b')]=_0x206497[_0x39d4('0x4b')]['length']?_0x206497[_0x39d4('0x4b')]:_0xaec4f0[_0x39d4('0x47')];_0x206497[_0x39d4('0x51')]=qs[_0x39d4('0x6a')](_0x59e87f[_0x39d4('0x48')]['sort']);_0x206497[_0x39d4('0x52')]=qs[_0x39d4('0x4a')](_['pick'](_0x59e87f['query'],_0xaec4f0[_0x39d4('0x4a')]));if(_0x59e87f['query'][_0x39d4('0x53')]){_0x206497['where']=_[_0x39d4('0x54')](_0x206497['where'],{'$or':_[_0x39d4('0x42')](_0x206497['attributes'],function(_0x1ff474){var _0x470a99={};_0x470a99[_0x1ff474]={'$like':'%'+_0x59e87f['query'][_0x39d4('0x53')]+'%'};return _0x470a99;})});}_0x206497=_['merge']({},_0x206497,_0x59e87f[_0x39d4('0x5c')]);return _0x490bb3['getAgents'](_0x206497);}})[_0x39d4('0x38')](function(_0x16a23a){if(_0x16a23a){_0x16e5e8=_0x16a23a['length'];if(!_0x59e87f[_0x39d4('0x48')][_0x39d4('0x4e')](_0x39d4('0x4f'))){_0x206497['limit']=qs[_0x39d4('0x30')](_0x59e87f[_0x39d4('0x48')][_0x39d4('0x30')]);_0x206497[_0x39d4('0x50')]=qs[_0x39d4('0x50')](_0x59e87f[_0x39d4('0x48')][_0x39d4('0x50')]);}return _0x490bb3[_0x39d4('0xed')](_0x206497);}})[_0x39d4('0x38')](function(_0x2f8584){if(_0x2f8584){return _0x2f8584?{'count':_0x16e5e8,'rows':_0x2f8584}:null;}})[_0x39d4('0x38')](respondWithResult(_0xcfdc4,null))[_0x39d4('0x2a')](handleError(_0xcfdc4,null));}; \ No newline at end of file +var _0xec7f=['updatedAt','CompanyId','ListId','mobile','twilio','From','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','messageId','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','SmsQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','to\x20is\x20mandatory','List','out','spread','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','bandwidth','redif','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','localhost','socket.io-emitter','register','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','info','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','get','end','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','count','include','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','Disposition','order','sort','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','findAll','removeAnswers','ids','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x1ffc83,_0x4b9278){var _0x372ccc=function(_0x34016b){while(--_0x34016b){_0x1ffc83['push'](_0x1ffc83['shift']());}};_0x372ccc(++_0x4b9278);}(_0xec7f,0x157));var _0xfec7=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xec7f[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfec7('0x0'));var zipdir=require(_0xfec7('0x1'));var jsonpatch=require(_0xfec7('0x2'));var rp=require('request-promise');var moment=require(_0xfec7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfec7('0x4'));var util=require('util');var path=require(_0xfec7('0x5'));var sox=require(_0xfec7('0x6'));var csv=require('to-csv');var ejs=require(_0xfec7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfec7('0x8'));var squel=require(_0xfec7('0x9'));var crypto=require(_0xfec7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfec7('0xb'));var toCsv=require(_0xfec7('0xc'));var querystring=require(_0xfec7('0xd'));var Papa=require(_0xfec7('0xe'));var Redis=require('ioredis');var authService=require(_0xfec7('0xf'));var qs=require(_0xfec7('0x10'));var as=require(_0xfec7('0x11'));var hardwareService=require(_0xfec7('0x12'));var logger=require(_0xfec7('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfec7('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xfec7('0x15')],{'host':_0xfec7('0x16'),'port':0x18eb});var socket=require(_0xfec7('0x17'))(new Redis(config[_0xfec7('0x15')]));require('./smsAccount.socket')[_0xfec7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfec7('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x4cf33b,_0x2833d9,_0x43519f,_0x25964e){return new BPromise(function(_0x3db2cb,_0x247c3e){var _0x395739=_0x25964e||client;return _0x395739[_0xfec7('0x1a')](_0x4cf33b,_0x43519f)[_0xfec7('0x1b')](function(_0x24e398){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2833d9,_0xfec7('0x1c'));logger[_0xfec7('0x1d')](_0xfec7('0x1e'),_0x2833d9,_0xfec7('0x1c'),JSON['stringify'](_0x24e398));if(_0x24e398['error']){if(_0x24e398[_0xfec7('0x1f')][_0xfec7('0x20')]===0x1f4){logger[_0xfec7('0x1f')](_0xfec7('0x21'),_0x2833d9,_0x24e398['error'][_0xfec7('0x22')]);return _0x247c3e(_0x24e398[_0xfec7('0x1f')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x2833d9,_0x24e398[_0xfec7('0x1f')]['message']);return _0x3db2cb(_0x24e398[_0xfec7('0x1f')][_0xfec7('0x22')]);}else{logger[_0xfec7('0x23')](_0xfec7('0x21'),_0x2833d9,_0xfec7('0x1c'));_0x3db2cb(_0x24e398['result'][_0xfec7('0x22')]);}})['catch'](function(_0x4d5e3d){logger[_0xfec7('0x1f')](_0xfec7('0x21'),_0x2833d9,_0x4d5e3d);_0x247c3e(_0x4d5e3d);});});}function respondWithStatusCode(_0x508e4e,_0x3c5e35){_0x3c5e35=_0x3c5e35||0xcc;return function(_0x99d4dd){if(_0x99d4dd){return _0x508e4e[_0xfec7('0x24')](_0x3c5e35);}return _0x508e4e[_0xfec7('0x25')](_0x3c5e35)['end']();};}function respondWithResult(_0x18ee85,_0x31981b){_0x31981b=_0x31981b||0xc8;return function(_0xded539){if(_0xded539){return _0x18ee85[_0xfec7('0x25')](_0x31981b)[_0xfec7('0x26')](_0xded539);}};}function respondWithFilteredResult(_0x16bc98,_0x491eac){return function(_0x3ac24a){if(_0x3ac24a){var _0x2876c8=typeof _0x491eac[_0xfec7('0x27')]==='undefined'&&typeof _0x491eac[_0xfec7('0x28')]===_0xfec7('0x29');var _0xfcb20d=_0x3ac24a['count'];var _0x179d9a=_0x2876c8?0x0:_0x491eac[_0xfec7('0x27')];var _0x1ead66=_0x2876c8?_0x3ac24a['count']:_0x491eac[_0xfec7('0x27')]+_0x491eac[_0xfec7('0x28')];var _0x2bf5a1;if(_0x1ead66>=_0xfcb20d){_0x1ead66=_0xfcb20d;_0x2bf5a1=0xc8;}else{_0x2bf5a1=0xce;}_0x16bc98['status'](_0x2bf5a1);return _0x16bc98[_0xfec7('0x2a')](_0xfec7('0x2b'),_0x179d9a+'-'+_0x1ead66+'/'+_0xfcb20d)[_0xfec7('0x26')](_0x3ac24a);}return null;};}function patchUpdates(_0x40b0ea){return function(_0x532156){try{jsonpatch[_0xfec7('0x2c')](_0x532156,_0x40b0ea,!![]);}catch(_0x55edc0){return BPromise[_0xfec7('0x2d')](_0x55edc0);}return _0x532156[_0xfec7('0x2e')]();};}function saveUpdates(_0x35a6f5,_0x599012){return function(_0x34d221){if(_0x34d221){return _0x34d221[_0xfec7('0x2f')](_0x35a6f5)[_0xfec7('0x1b')](function(_0x45a287){return _0x45a287;});}return null;};}function removeEntity(_0x58805f,_0x3f27aa){return function(_0x597fb5){if(_0x597fb5){return _0x597fb5['destroy']()[_0xfec7('0x1b')](function(){var _0x5d8591=_0x597fb5[_0xfec7('0x30')]({'plain':!![]});var _0x315a4b='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x315a4b,'resourceId':_0x5d8591['id']}})[_0xfec7('0x1b')](function(){return _0x597fb5;});})[_0xfec7('0x1b')](function(){_0x58805f[_0xfec7('0x25')](0xcc)[_0xfec7('0x31')]();});}};}function handleEntityNotFound(_0x3f11fb,_0x3db979){return function(_0xc3a3f5){if(!_0xc3a3f5){_0x3f11fb['sendStatus'](0x194);}return _0xc3a3f5;};}function handleError(_0x656d91,_0x49289f){_0x49289f=_0x49289f||0x1f4;return function(_0x5b99b9){logger['error'](_0x5b99b9[_0xfec7('0x32')]);if(_0x5b99b9[_0xfec7('0x33')]){delete _0x5b99b9[_0xfec7('0x33')];}_0x656d91[_0xfec7('0x25')](_0x49289f)[_0xfec7('0x34')](_0x5b99b9);};}exports[_0xfec7('0x35')]=function(_0x4d112b,_0x3bf967){var _0x35a3ec={'include':[{'model':db[_0xfec7('0x36')],'as':_0xfec7('0x37')}]},_0x3bc303={},_0x26aca9={'count':0x0,'rows':[]};var _0x279f25=_['map'](db[_0xfec7('0x38')][_0xfec7('0x39')],function(_0x2b5265){return{'name':_0x2b5265[_0xfec7('0x3a')],'type':_0x2b5265[_0xfec7('0x3b')]['key']};});_0x3bc303[_0xfec7('0x3c')]=_[_0xfec7('0x3d')](_0x279f25,_0xfec7('0x33'));_0x3bc303[_0xfec7('0x3e')]=_[_0xfec7('0x3f')](_0x4d112b['query']);_0x3bc303[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x3bc303[_0xfec7('0x3c')],_0x3bc303[_0xfec7('0x3e')]);_0x35a3ec[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x3bc303['model'],qs[_0xfec7('0x43')](_0x4d112b['query'][_0xfec7('0x43')]));_0x35a3ec[_0xfec7('0x42')]=_0x35a3ec['attributes'][_0xfec7('0x44')]?_0x35a3ec[_0xfec7('0x42')]:_0x3bc303[_0xfec7('0x3c')];if(!_0x4d112b['query'][_0xfec7('0x45')](_0xfec7('0x46'))){_0x35a3ec[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x28')]);_0x35a3ec['offset']=qs['offset'](_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x27')]);}_0x35a3ec['order']=qs['sort'](_0x4d112b[_0xfec7('0x3e')]['sort']);_0x35a3ec[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x4d112b[_0xfec7('0x3e')],_0x3bc303[_0xfec7('0x40')]),_0x279f25);if(_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x35a3ec['where']=_['merge'](_0x35a3ec['where'],{'$or':_[_0xfec7('0x3d')](_0x279f25,function(_0x4fd474){if(_0x4fd474['type']!=='VIRTUAL'){var _0x5d73a8={};_0x5d73a8[_0x4fd474[_0xfec7('0x33')]]={'$like':'%'+_0x4d112b[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x5d73a8;}})});}_0x35a3ec=_[_0xfec7('0x4a')]({},_0x35a3ec,_0x4d112b[_0xfec7('0x4b')]);var _0x2a912f={'where':_0x35a3ec['where']};return db[_0xfec7('0x38')][_0xfec7('0x4c')](_0x2a912f)[_0xfec7('0x1b')](function(_0x2e7a2c){_0x26aca9[_0xfec7('0x4c')]=_0x2e7a2c;if(_0x4d112b['query']['includeAll']){_0x35a3ec[_0xfec7('0x4d')]=[{'all':!![]}];}return db[_0xfec7('0x38')]['findAll'](_0x35a3ec);})[_0xfec7('0x1b')](function(_0x47843d){_0x26aca9[_0xfec7('0x4e')]=_0x47843d;return _0x26aca9;})['then'](respondWithFilteredResult(_0x3bf967,_0x35a3ec))['catch'](handleError(_0x3bf967,null));};exports[_0xfec7('0x4f')]=function(_0x470ed7,_0x3b46cf){var _0x10b50d={'raw':![],'where':{'id':_0x470ed7[_0xfec7('0x50')]['id']},'include':[{'model':db[_0xfec7('0x36')],'as':_0xfec7('0x37')}]},_0x139692={};_0x139692[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x38')][_0xfec7('0x39')]);_0x139692[_0xfec7('0x3e')]=_[_0xfec7('0x3f')](_0x470ed7['query']);_0x139692['filters']=_[_0xfec7('0x41')](_0x139692[_0xfec7('0x3c')],_0x139692['query']);_0x10b50d[_0xfec7('0x42')]=_['intersection'](_0x139692[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x470ed7[_0xfec7('0x3e')][_0xfec7('0x43')]));_0x10b50d[_0xfec7('0x42')]=_0x10b50d[_0xfec7('0x42')][_0xfec7('0x44')]?_0x10b50d[_0xfec7('0x42')]:_0x139692['model'];if(_0x470ed7[_0xfec7('0x3e')][_0xfec7('0x51')]){_0x10b50d[_0xfec7('0x4d')]=[{'all':!![]}];}_0x10b50d=_['merge']({},_0x10b50d,_0x470ed7[_0xfec7('0x4b')]);return db[_0xfec7('0x38')][_0xfec7('0x52')](_0x10b50d)[_0xfec7('0x1b')](handleEntityNotFound(_0x3b46cf,null))['then'](respondWithResult(_0x3b46cf,null))[_0xfec7('0x53')](handleError(_0x3b46cf,null));};exports[_0xfec7('0x54')]=function(_0x1a6f7f,_0x41b14e){return db[_0xfec7('0x38')][_0xfec7('0x54')](_0x1a6f7f[_0xfec7('0x55')],{})[_0xfec7('0x1b')](function(_0x63869d){var _0x5cca85=_0x1a6f7f['user'][_0xfec7('0x30')]({'plain':!![]});if(!_0x5cca85)throw new Error(_0xfec7('0x56'));if(_0x5cca85['role']===_0xfec7('0x57')){var _0x158127=_0x63869d[_0xfec7('0x30')]({'plain':!![]});var _0x1f29ea=_0xfec7('0x58');return db[_0xfec7('0x59')][_0xfec7('0x52')]({'where':{'name':_0x1f29ea,'userProfileId':_0x5cca85[_0xfec7('0x5a')]},'raw':!![]})[_0xfec7('0x1b')](function(_0x1baf2e){if(_0x1baf2e&&_0x1baf2e[_0xfec7('0x5b')]===0x0){return db[_0xfec7('0x5c')]['create']({'name':_0x158127[_0xfec7('0x33')],'resourceId':_0x158127['id'],'type':_0x1baf2e[_0xfec7('0x33')],'sectionId':_0x1baf2e['id']},{})[_0xfec7('0x1b')](function(){return _0x63869d;});}else{return _0x63869d;}})['catch'](function(_0x2c8f8c){logger[_0xfec7('0x1f')](_0xfec7('0x5d'),_0x2c8f8c);throw _0x2c8f8c;});}return _0x63869d;})[_0xfec7('0x1b')](respondWithResult(_0x41b14e,0xc9))[_0xfec7('0x53')](handleError(_0x41b14e,null));};exports[_0xfec7('0x2f')]=function(_0x26602e,_0x323697){if(_0x26602e['body']['id']){delete _0x26602e[_0xfec7('0x55')]['id'];}return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x26602e[_0xfec7('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xfec7('0x1b')](handleEntityNotFound(_0x323697,null))[_0xfec7('0x1b')](saveUpdates(_0x26602e[_0xfec7('0x55')],null))[_0xfec7('0x1b')](respondWithResult(_0x323697,null))[_0xfec7('0x53')](handleError(_0x323697,null));};exports['destroy']=function(_0x223633,_0x1c2b89){return db['SmsAccount'][_0xfec7('0x52')]({'where':{'id':_0x223633[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x1c2b89,null))[_0xfec7('0x1b')](removeEntity(_0x1c2b89,null))[_0xfec7('0x53')](handleError(_0x1c2b89,null));};exports[_0xfec7('0x5e')]=function(_0x4ad5be,_0x1245ff){return db[_0xfec7('0x38')]['describe']()[_0xfec7('0x1b')](respondWithResult(_0x1245ff,null))['catch'](handleError(_0x1245ff,null));};exports[_0xfec7('0x5f')]=function(_0x35daa9,_0x3f1b00,_0x48abd2){if(_0x35daa9['body']['id']){delete _0x35daa9[_0xfec7('0x55')]['id'];}return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x35daa9['params']['id']}})['then'](handleEntityNotFound(_0x3f1b00,null))[_0xfec7('0x1b')](function(_0x323df8){if(_0x323df8){_0x35daa9['body'][_0xfec7('0x60')]=_0x323df8['id'];return db['Disposition']['create'](_0x35daa9[_0xfec7('0x55')]);}})['then'](respondWithResult(_0x3f1b00,null))[_0xfec7('0x53')](handleError(_0x3f1b00,null));};exports[_0xfec7('0x61')]=function(_0x51ac9d,_0x2802ee,_0x7a7846){var _0x52fdb7={'raw':![],'where':{}};var _0x2e0c9c={};var _0x4aad70={'count':0x0,'rows':[]};return db[_0xfec7('0x38')]['findOne']({'where':{'id':_0x51ac9d[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x2802ee,null))[_0xfec7('0x1b')](function(_0x15fa87){if(_0x15fa87){_0x2e0c9c[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x62')][_0xfec7('0x39')]);_0x2e0c9c['query']=_['keys'](_0x51ac9d['query']);_0x2e0c9c[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x2e0c9c[_0xfec7('0x3c')],_0x2e0c9c[_0xfec7('0x3e')]);_0x52fdb7['attributes']=_['intersection'](_0x2e0c9c[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x51ac9d[_0xfec7('0x3e')]['fields']));_0x52fdb7[_0xfec7('0x42')]=_0x52fdb7['attributes'][_0xfec7('0x44')]?_0x52fdb7[_0xfec7('0x42')]:_0x2e0c9c[_0xfec7('0x3c')];if(!_0x51ac9d[_0xfec7('0x3e')][_0xfec7('0x45')]('nolimit')){_0x52fdb7[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x51ac9d[_0xfec7('0x3e')]['limit']);_0x52fdb7[_0xfec7('0x27')]=qs[_0xfec7('0x27')](_0x51ac9d[_0xfec7('0x3e')][_0xfec7('0x27')]);}_0x52fdb7[_0xfec7('0x63')]=qs[_0xfec7('0x64')](_0x51ac9d['query'][_0xfec7('0x64')]);_0x52fdb7['where']=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x51ac9d[_0xfec7('0x3e')],_0x2e0c9c[_0xfec7('0x40')]));_0x52fdb7[_0xfec7('0x47')][_0xfec7('0x60')]=_0x15fa87['id'];if(_0x51ac9d['query'][_0xfec7('0x49')]){_0x52fdb7['where']=_[_0xfec7('0x4a')](_0x52fdb7[_0xfec7('0x47')],{'$or':_[_0xfec7('0x3d')](_0x52fdb7['attributes'],function(_0x3d2e9f){var _0x7d8d0f={};_0x7d8d0f[_0x3d2e9f]={'$like':'%'+_0x51ac9d[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x7d8d0f;})});}_0x52fdb7=_[_0xfec7('0x4a')]({},_0x52fdb7,_0x51ac9d[_0xfec7('0x4b')]);return db[_0xfec7('0x62')][_0xfec7('0x4c')]({'where':_0x52fdb7['where']})['then'](function(_0x1b670a){_0x4aad70['count']=_0x1b670a;if(_0x51ac9d[_0xfec7('0x3e')]['includeAll']){_0x52fdb7[_0xfec7('0x4d')]=[{'all':!![]}];}return db[_0xfec7('0x62')]['findAll'](_0x52fdb7);})['then'](function(_0x12e7a1){_0x4aad70[_0xfec7('0x4e')]=_0x12e7a1;return _0x4aad70;});}})['then'](respondWithFilteredResult(_0x2802ee,_0x52fdb7))[_0xfec7('0x53')](handleError(_0x2802ee,null));};exports[_0xfec7('0x65')]=function(_0x4a1679,_0x2b6360,_0x29531d){return db['SmsAccount']['find']({'where':{'id':_0x4a1679[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x2b6360,null))[_0xfec7('0x1b')](function(_0x4d98ca){if(_0x4d98ca){return _0x4d98ca['removeDispositions'](_0x4a1679[_0xfec7('0x3e')]['ids']);}})[_0xfec7('0x1b')](respondWithStatusCode(_0x2b6360,null))[_0xfec7('0x53')](handleError(_0x2b6360,null));};exports[_0xfec7('0x66')]=function(_0x245063,_0x581204,_0x43bc9c){if(_0x245063[_0xfec7('0x55')]['id']){delete _0x245063['body']['id'];}return db['SmsAccount'][_0xfec7('0x52')]({'where':{'id':_0x245063[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x581204,null))['then'](function(_0x3f4731){if(_0x3f4731){_0x245063['body'][_0xfec7('0x60')]=_0x3f4731['id'];return db['CannedAnswer'][_0xfec7('0x54')](_0x245063[_0xfec7('0x55')]);}})[_0xfec7('0x1b')](respondWithResult(_0x581204,null))[_0xfec7('0x53')](handleError(_0x581204,null));};exports[_0xfec7('0x67')]=function(_0x1b6288,_0x55e1f7,_0x37127f){var _0x39c767={'raw':![],'where':{}};var _0x203f5b={};var _0x42da41={'count':0x0,'rows':[]};return db[_0xfec7('0x38')][_0xfec7('0x68')]({'where':{'id':_0x1b6288[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x55e1f7,null))['then'](function(_0x3e8010){if(_0x3e8010){_0x203f5b[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x69')][_0xfec7('0x39')]);_0x203f5b[_0xfec7('0x3e')]=_[_0xfec7('0x3f')](_0x1b6288[_0xfec7('0x3e')]);_0x203f5b[_0xfec7('0x40')]=_['intersection'](_0x203f5b[_0xfec7('0x3c')],_0x203f5b[_0xfec7('0x3e')]);_0x39c767[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x203f5b['model'],qs[_0xfec7('0x43')](_0x1b6288['query'][_0xfec7('0x43')]));_0x39c767['attributes']=_0x39c767[_0xfec7('0x42')][_0xfec7('0x44')]?_0x39c767[_0xfec7('0x42')]:_0x203f5b[_0xfec7('0x3c')];if(!_0x1b6288['query'][_0xfec7('0x45')]('nolimit')){_0x39c767[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x28')]);_0x39c767[_0xfec7('0x27')]=qs['offset'](_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x27')]);}_0x39c767[_0xfec7('0x63')]=qs['sort'](_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x64')]);_0x39c767[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x1b6288[_0xfec7('0x3e')],_0x203f5b['filters']));_0x39c767[_0xfec7('0x47')][_0xfec7('0x60')]=_0x3e8010['id'];if(_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x39c767['where']=_['merge'](_0x39c767['where'],{'$or':_[_0xfec7('0x3d')](_0x39c767[_0xfec7('0x42')],function(_0x1ade4c){var _0x195ab9={};_0x195ab9[_0x1ade4c]={'$like':'%'+_0x1b6288[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x195ab9;})});}_0x39c767=_[_0xfec7('0x4a')]({},_0x39c767,_0x1b6288[_0xfec7('0x4b')]);return db[_0xfec7('0x69')][_0xfec7('0x4c')]({'where':_0x39c767[_0xfec7('0x47')]})[_0xfec7('0x1b')](function(_0x23abfc){_0x42da41[_0xfec7('0x4c')]=_0x23abfc;if(_0x1b6288['query']['includeAll']){_0x39c767[_0xfec7('0x4d')]=[{'all':!![]}];}return db[_0xfec7('0x69')][_0xfec7('0x6a')](_0x39c767);})[_0xfec7('0x1b')](function(_0x2d3133){_0x42da41['rows']=_0x2d3133;return _0x42da41;});}})['then'](respondWithFilteredResult(_0x55e1f7,_0x39c767))[_0xfec7('0x53')](handleError(_0x55e1f7,null));};exports[_0xfec7('0x6b')]=function(_0x524f90,_0x3080dc,_0x1477ec){return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x524f90[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x3080dc,null))['then'](function(_0x437af0){if(_0x437af0){return _0x437af0[_0xfec7('0x6b')](_0x524f90['query'][_0xfec7('0x6c')]);}})[_0xfec7('0x1b')](respondWithStatusCode(_0x3080dc,null))['catch'](handleError(_0x3080dc,null));};exports['notify']=function(_0x35a8d3,_0x31fe07,_0x51e6d9){var _0x2b0fd8={'channel':_0xfec7('0x6d')};var _0x26d88c=[];var _0x23709d=[];var _0x66b8e0={};return db['SmsAccount'][_0xfec7('0x52')]({'where':{'id':_0x35a8d3[_0xfec7('0x50')]['id']},'include':[{'model':db[_0xfec7('0x6e')],'as':_0xfec7('0x6f')}]})[_0xfec7('0x1b')](handleEntityNotFound(_0x31fe07,null))[_0xfec7('0x1b')](function(_0x47b68e){_0x2b0fd8[_0xfec7('0x70')]=_0x47b68e;_0x2b0fd8[_0xfec7('0x71')]=_[_0xfec7('0x72')](_0x47b68e[_0xfec7('0x6f')],[_0xfec7('0x73')],[_0xfec7('0x74')]);if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x6f')]){delete _0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x6f')];}return db[_0xfec7('0x75')][_0xfec7('0x5e')]();})[_0xfec7('0x1b')](function(_0x50baeb){if(!_0x50baeb){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))](_0xfec7('0x78'));}_0x26d88c=_[_0xfec7('0x79')](_[_0xfec7('0x3f')](_0x50baeb),[_0xfec7('0x7a'),'updatedAt']);_0x23709d=_[_0xfec7('0x79')](_[_0xfec7('0x3f')](_0x50baeb),[_0xfec7('0x7a'),_0xfec7('0x7b'),_0xfec7('0x7c'),_0xfec7('0x7d')]);_0x2b0fd8['body']={'mapKey':_0xfec7('0x7e')};if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x3b')]){switch(_0x2b0fd8[_0xfec7('0x70')]['type']){case _0xfec7('0x7f'):_0x2b0fd8[_0xfec7('0x55')]['from']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x80')];_0x2b0fd8['body'][_0xfec7('0x55')]=_0x35a8d3['body']['Body'];_0x2b0fd8[_0xfec7('0x55')]['messageId']=_0x35a8d3['body'][_0xfec7('0x81')];break;case _0xfec7('0x82'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]='+'+_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x84')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body'][_0xfec7('0x85')];break;case _0xfec7('0x86'):_0x2b0fd8['body'][_0xfec7('0x83')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')]['body']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x22')];break;case _0xfec7('0x87'):_0x2b0fd8['body'][_0xfec7('0x83')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body'][_0xfec7('0x55')];_0x2b0fd8['body']['messageId']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x88')];break;case _0xfec7('0x89'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3['body'][_0xfec7('0x80')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body'][_0xfec7('0x8a')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x8c')];break;case _0xfec7('0x8d'):_0x2b0fd8['body'][_0xfec7('0x83')]='+'+_0x35a8d3['body']['results'][0x0][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')]['body']=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x8e')][0x0]['text'];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3['body'][_0xfec7('0x8e')][0x0][_0xfec7('0x8b')];break;case _0xfec7('0x8f'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3['body'][_0xfec7('0x90')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3['body']['segmentedMessage']['message'];break;case _0xfec7('0x91'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3['body'][_0xfec7('0x92')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x85')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x93')];break;case'bandwidth':_0x2b0fd8['body'][_0xfec7('0x8b')]=_0x35a8d3['body'][0x0][_0xfec7('0x22')]['id'];_0x2b0fd8[_0xfec7('0x55')]['from']=_0x35a8d3[_0xfec7('0x55')][0x0]['message'][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3[_0xfec7('0x55')][0x0][_0xfec7('0x22')][_0xfec7('0x85')];break;case _0xfec7('0x94'):_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x83')];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')]=_0x35a8d3[_0xfec7('0x55')]['message'];_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x8b')]=_0x35a8d3[_0xfec7('0x55')][_0xfec7('0x95')];break;}}if(_0x2b0fd8[_0xfec7('0x55')]['id']){delete _0x2b0fd8[_0xfec7('0x55')]['id'];}if(_[_0xfec7('0x96')](_0x2b0fd8['body'][_0xfec7('0x83')])){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))](_0xfec7('0x97'));}if(_[_0xfec7('0x96')](_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x55')])||_0x2b0fd8[_0xfec7('0x55')]['body']===''){throw new db[(_0xfec7('0x76'))]['ValidationError'](_0xfec7('0x98'));}if(_[_0xfec7('0x96')](_0x2b0fd8[_0xfec7('0x55')]['mapKey'])){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x23709d);}if(!_[_0xfec7('0x99')](_0x23709d,_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x9a')])){throw new db['Sequelize'][(_0xfec7('0x77'))](_0xfec7('0x9b')+_0x23709d);}_0x66b8e0[_0x2b0fd8['body'][_0xfec7('0x9a')]]=_0x2b0fd8['body'][_0xfec7('0x83')];return db[_0xfec7('0x9c')][_0xfec7('0x52')]({'where':{'id':_0x2b0fd8[_0xfec7('0x70')]['ListId']},'include':[{'model':db[_0xfec7('0x75')],'as':_0xfec7('0x9d'),'where':_0x66b8e0,'limit':0x1,'order':[[_0xfec7('0x7b'),_0xfec7('0x9e')]]}]});})[_0xfec7('0x1b')](handleEntityNotFound(_0x31fe07,null))[_0xfec7('0x1b')](function(_0xf6a162){if(_0xf6a162){_0x2b0fd8[_0xfec7('0x9f')]=_[_0xfec7('0xa0')](_0xf6a162,['Contacts']);if(_0xf6a162[_0xfec7('0x9d')]['length']){return _0xf6a162['Contacts'][0x0];}var _0x4786ab=_[_0xfec7('0xa1')](_0x2b0fd8[_0xfec7('0x55')],{'firstName':_0x2b0fd8['body'][_0xfec7('0x83')],'ListId':_0xf6a162['id']});_0x4786ab[_0x2b0fd8['body']['mapKey']]=_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0x83')];return db[_0xfec7('0x75')][_0xfec7('0x54')](_0x4786ab,{'fields':_0x26d88c,'raw':!![]});}})[_0xfec7('0x1b')](handleEntityNotFound(_0x31fe07,null))[_0xfec7('0x1b')](function(_0x49d55d){if(_0x49d55d){_0x2b0fd8[_0xfec7('0xa2')]=_0x49d55d;var _0xe937aa={'ContactId':_0x49d55d['id'],'phone':_0x2b0fd8['body'][_0xfec7('0x83')],'SmsAccountId':_0x35a8d3[_0xfec7('0x50')]['id']};var _0x2aae01={'ContactId':_0x49d55d['id'],'SmsAccountId':_0x35a8d3[_0xfec7('0x50')]['id'],'closed':![]};return db[_0xfec7('0xa3')][_0xfec7('0x52')]({'where':_0x2aae01})[_0xfec7('0x1b')](function(_0x494937){if(_0x494937){return[_0x494937,![]];}return db[_0xfec7('0xa3')][_0xfec7('0x54')](_0xe937aa)[_0xfec7('0x1b')](function(_0x5b0fb8){return[_0x5b0fb8,!![]];});});}})['spread'](function(_0x34554b,_0x419f13){_0x2b0fd8[_0xfec7('0xa4')]=_0x34554b[_0xfec7('0x30')]({'plain':!![]});_0x2b0fd8['interaction']['created']=![];if(_0x419f13){if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0xa5')]){_0x2b0fd8['applications'][_0xfec7('0xa6')]({'id':0x0,'priority':_0x2b0fd8[_0xfec7('0x71')][_0xfec7('0x44')]+0x1,'app':_0xfec7('0xa7'),'appdata':_0xfec7('0xa8'),'interval':'*,*,*,*'});}_0x2b0fd8[_0xfec7('0xa4')][_0xfec7('0xa9')]=!![];}return db[_0xfec7('0xaa')][_0xfec7('0x54')]({'phone':_0x2b0fd8[_0xfec7('0x55')]['from'],'messageId':_0x2b0fd8['body']['messageId'],'body':_0x2b0fd8['body'][_0xfec7('0x55')],'SmsAccountId':_0x35a8d3[_0xfec7('0x50')]['id'],'SmsInteractionId':_0x34554b['id'],'direction':'in','ContactId':_0x34554b[_0xfec7('0xab')],'AttachmentId':_0x2b0fd8[_0xfec7('0x55')][_0xfec7('0xac')]});})[_0xfec7('0x1b')](function(_0x3e1d9d){_0x2b0fd8[_0xfec7('0x22')]=_0x3e1d9d;if(!_0x2b0fd8[_0xfec7('0xa4')][_0xfec7('0xad')])return;return db[_0xfec7('0xae')][_0xfec7('0x52')]({'attributes':['id',_0xfec7('0x33')],'where':{'id':_0x2b0fd8[_0xfec7('0xa4')]['UserId']}});})[_0xfec7('0x1b')](function(_0x55bbe0){if(_0x55bbe0){_0x2b0fd8[_0xfec7('0x71')][_0xfec7('0xaf')]({'id':0x0,'priority':0x0,'app':_0xfec7('0xb0'),'appdata':_0x55bbe0['name']+','+(_0x2b0fd8['account'][_0xfec7('0xb1')]||0xa),'interval':_0xfec7('0xb2')});}if(!_0x2b0fd8[_0xfec7('0xa4')]['queueId'])return;return db[_0xfec7('0xb3')][_0xfec7('0x52')]({'attributes':['id',_0xfec7('0x33')],'where':{'id':_0x2b0fd8[_0xfec7('0xa4')][_0xfec7('0xb4')]}});})[_0xfec7('0x1b')](function(_0x5399e1){if(_0x5399e1){_0x2b0fd8['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xfec7('0xb5'),'appdata':_0x5399e1['name']+','+(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0xb6')]||0x12c),'interval':_0xfec7('0xb2')});}return respondWithRpcPromise(_0xfec7('0xb7'),_0xfec7('0xb8'),_0x2b0fd8);})['then'](function(_0x1ac0a3){if(_0x1ac0a3){var _0x2eff1d=0xc8;var _0x4cc4e1=_0xfec7('0xb9');logger[_0xfec7('0x23')](_0xfec7('0x1e'),_0x4cc4e1,_0x2eff1d,_0xfec7('0xba'));logger[_0xfec7('0x1d')](_0xfec7('0xbb'),_0x4cc4e1,_0x2eff1d,_0xfec7('0xba'),JSON[_0xfec7('0xbc')](_0x1ac0a3));if(_0x2b0fd8[_0xfec7('0x70')][_0xfec7('0x3b')]===_0xfec7('0x7f')){return _0x31fe07[_0xfec7('0x25')](_0x2eff1d)['set'](_0xfec7('0xbd'),'text/xml')[_0xfec7('0x34')](_0xfec7('0xbe'));}else{return _0x31fe07[_0xfec7('0x25')](_0x2eff1d)['json'](_0x1ac0a3);}}})[_0xfec7('0x53')](handleError(_0x31fe07,null));};exports[_0xfec7('0xbf')]=function(_0xdc57eb,_0x53ab53){var _0x2370a1=_0xdc57eb[_0xfec7('0x50')]['id'];var _0x24ec80=_0xdc57eb['body'];var _0x54e84e=0xc8;var _0xf15e00=null;return db[_0xfec7('0xc0')]['transaction']({'isolationLevel':db[_0xfec7('0xc0')][_0xfec7('0xc1')][_0xfec7('0xc2')][_0xfec7('0xc3')]},function(_0x5565b6){return db['SmsAccount']['findOne']({'where':{'id':_0x2370a1},'transaction':_0x5565b6})[_0xfec7('0x1b')](function(_0x20e933){if(_0x20e933){return db[_0xfec7('0x6e')][_0xfec7('0xc4')]({'where':{'SmsAccountId':_0x2370a1},'transaction':_0x5565b6})[_0xfec7('0x1b')](function(){var _0x14db55=_[_0xfec7('0x3d')](_0x24ec80,function(_0x21bb9a){_0x21bb9a[_0xfec7('0x60')]=_0x2370a1;return _0x21bb9a;});return db[_0xfec7('0x6e')][_0xfec7('0xc5')](_0x14db55,{'transaction':_0x5565b6});});}else{_0x54e84e=0x194;_0xf15e00=[];}});})[_0xfec7('0x1b')](function(){if(_0x54e84e!==0x194){return db[_0xfec7('0x6e')][_0xfec7('0xc6')]({'where':{'SmsAccountId':_0x2370a1},'order':'priority'})[_0xfec7('0x1b')](function(_0x53f09b){_0xf15e00=_0x53f09b;});}})[_0xfec7('0x53')](function(_0x326c5e){_0x54e84e=0x1f4;logger[_0xfec7('0x1f')](_0x326c5e['stack']);if(_0x326c5e[_0xfec7('0x33')]){delete _0x326c5e['name'];}_0xf15e00=_0x326c5e;})['finally'](function(){if(_0xf15e00===null){_0x53ab53[_0xfec7('0x24')](_0x54e84e);}else{if(_0x54e84e===0x1f4){_0x53ab53[_0xfec7('0x25')](_0x54e84e)[_0xfec7('0x34')](_0xf15e00);}else{_0x53ab53[_0xfec7('0x25')](_0x54e84e)[_0xfec7('0x26')](_0xf15e00);}}});};exports[_0xfec7('0xc7')]=function(_0x524463,_0x33e222,_0x498c23){var _0x521768={};var _0x327783={};var _0x7562a9;var _0x49e453;return db['SmsAccount'][_0xfec7('0x68')]({'where':{'id':_0x524463['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x33e222,null))[_0xfec7('0x1b')](function(_0x2cc1d9){if(_0x2cc1d9){_0x7562a9=_0x2cc1d9;_0x327783[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db[_0xfec7('0x6e')][_0xfec7('0x39')]);_0x327783[_0xfec7('0x3e')]=_['keys'](_0x524463[_0xfec7('0x3e')]);_0x327783[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x327783[_0xfec7('0x3c')],_0x327783[_0xfec7('0x3e')]);_0x521768[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x327783['model'],qs[_0xfec7('0x43')](_0x524463[_0xfec7('0x3e')][_0xfec7('0x43')]));_0x521768[_0xfec7('0x42')]=_0x521768['attributes'][_0xfec7('0x44')]?_0x521768[_0xfec7('0x42')]:_0x327783[_0xfec7('0x3c')];_0x521768[_0xfec7('0x63')]=qs['sort'](_0x524463[_0xfec7('0x3e')][_0xfec7('0x64')]);_0x521768[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_[_0xfec7('0x48')](_0x524463['query'],_0x327783[_0xfec7('0x40')]));if(_0x524463[_0xfec7('0x3e')]['filter']){_0x521768[_0xfec7('0x47')]=_[_0xfec7('0x4a')](_0x521768[_0xfec7('0x47')],{'$or':_[_0xfec7('0x3d')](_0x521768[_0xfec7('0x42')],function(_0x3c1d8c){var _0x12793a={};_0x12793a[_0x3c1d8c]={'$like':'%'+_0x524463[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x12793a;})});}_0x521768=_[_0xfec7('0x4a')]({},_0x521768,_0x524463[_0xfec7('0x4b')]);return _0x7562a9['getApplications'](_0x521768);}})[_0xfec7('0x1b')](function(_0x47b8c5){if(_0x47b8c5){_0x49e453=_0x47b8c5['length'];if(!_0x524463['query']['hasOwnProperty'](_0xfec7('0x46'))){_0x521768['limit']=qs[_0xfec7('0x28')](_0x524463[_0xfec7('0x3e')][_0xfec7('0x28')]);_0x521768['offset']=qs['offset'](_0x524463[_0xfec7('0x3e')][_0xfec7('0x27')]);}return _0x7562a9['getApplications'](_0x521768);}})['then'](function(_0x17fdc3){if(_0x17fdc3){return _0x17fdc3?{'count':_0x49e453,'rows':_0x17fdc3}:null;}})[_0xfec7('0x1b')](respondWithResult(_0x33e222,null))['catch'](handleError(_0x33e222,null));};exports[_0xfec7('0xc8')]=function(_0x345ea2,_0x22c85a,_0x28a710){var _0x4f6b16={'raw':![],'where':{}};var _0x20565e={};var _0x3cb6f4={'count':0x0,'rows':[]};return db['SmsAccount'][_0xfec7('0x68')]({'where':{'id':_0x345ea2['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x22c85a,null))[_0xfec7('0x1b')](function(_0x326d5c){if(_0x326d5c){_0x20565e[_0xfec7('0x3c')]=_[_0xfec7('0x3f')](db['SmsInteraction'][_0xfec7('0x39')]);_0x20565e['query']=_[_0xfec7('0x3f')](_0x345ea2[_0xfec7('0x3e')]);_0x20565e[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x20565e[_0xfec7('0x3c')],_0x20565e[_0xfec7('0x3e')]);_0x4f6b16[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x20565e[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x345ea2['query'][_0xfec7('0x43')]));_0x4f6b16['attributes']=_0x4f6b16[_0xfec7('0x42')][_0xfec7('0x44')]?_0x4f6b16[_0xfec7('0x42')]:_0x20565e[_0xfec7('0x3c')];if(!_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x45')](_0xfec7('0x46'))){_0x4f6b16[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x345ea2[_0xfec7('0x3e')]['limit']);_0x4f6b16[_0xfec7('0x27')]=qs['offset'](_0x345ea2['query']['offset']);}_0x4f6b16['order']=qs[_0xfec7('0x64')](_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x64')]);_0x4f6b16[_0xfec7('0x47')]=qs[_0xfec7('0x40')](_['pick'](_0x345ea2[_0xfec7('0x3e')],_0x20565e[_0xfec7('0x40')]));_0x4f6b16['where']['SmsAccountId']=_0x326d5c['id'];if(_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x4f6b16['where']=_[_0xfec7('0x4a')](_0x4f6b16['where'],{'$or':_[_0xfec7('0x3d')](_0x4f6b16[_0xfec7('0x42')],function(_0x140e0f){var _0x355bf5={};_0x355bf5[_0x140e0f]={'$like':'%'+_0x345ea2[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x355bf5;})});}_0x4f6b16=_['merge']({},_0x4f6b16,_0x345ea2['options']);return db['SmsInteraction'][_0xfec7('0x4c')]({'where':_0x4f6b16['where']})['then'](function(_0x3ef2a5){_0x3cb6f4[_0xfec7('0x4c')]=_0x3ef2a5;if(_0x345ea2['query'][_0xfec7('0x51')]){_0x4f6b16[_0xfec7('0x4d')]=[{'model':db[_0xfec7('0x75')],'as':_0xfec7('0xc9'),'required':![]},{'model':db['User'],'as':_0xfec7('0xca'),'attributes':[_0xfec7('0x33'),'fullname',_0xfec7('0xcb')],'required':![]},{'model':db[_0xfec7('0xcc')],'as':_0xfec7('0xcd'),'attributes':['id',_0xfec7('0x33'),_0xfec7('0xce')],'where':_0x345ea2['query']['tag']?{'id':_0x345ea2[_0xfec7('0x3e')]['tag']}:undefined,'required':_0x345ea2[_0xfec7('0x3e')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x4f6b16);})[_0xfec7('0x1b')](function(_0x372fa5){_0x3cb6f4[_0xfec7('0x4e')]=_0x372fa5;return _0x3cb6f4;});}})[_0xfec7('0x1b')](respondWithFilteredResult(_0x22c85a,_0x4f6b16))[_0xfec7('0x53')](handleError(_0x22c85a,null));};exports[_0xfec7('0x34')]=function(_0xcdd26,_0x100a36,_0x59b1af){var _0x4d2492,_0x34f739,_0x40e24c;if(_[_0xfec7('0x96')](_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')])||_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')]===''){throw new db[(_0xfec7('0x76'))][(_0xfec7('0x77'))](_0xfec7('0x98'));}if(_[_0xfec7('0x96')](_0xcdd26[_0xfec7('0x55')]['to'])){throw new db[(_0xfec7('0x76'))]['ValidationError'](_0xfec7('0xcf'));}_0x4d2492=_0xcdd26['body']['to'];return db[_0xfec7('0x38')]['find']({'where':{'id':_0xcdd26[_0xfec7('0x50')]['id']},'include':[{'model':db[_0xfec7('0x9c')],'as':_0xfec7('0xd0'),'include':[{'model':db[_0xfec7('0x75')],'as':'Contacts','where':{'mobile':_0x4d2492},'limit':0x1,'order':[[_0xfec7('0x7b'),'DESC']]}]}]})[_0xfec7('0x1b')](handleEntityNotFound(_0x100a36,null))[_0xfec7('0x1b')](function(_0x4bbeaf){if(_0x4bbeaf&&_0x4bbeaf['List']){_0x34f739=_0x4bbeaf['get']({'plain':!![]});if(_0x34f739[_0xfec7('0xd0')]&&_0x34f739['List'][_0xfec7('0x9d')][_0xfec7('0x44')]){return _0x34f739['List']['Contacts'][0x0];}return db[_0xfec7('0x75')][_0xfec7('0x54')](_[_0xfec7('0xa1')](_0xcdd26['body'],{'firstName':_0x4d2492,'mobile':_0x4d2492,'phone':_0x4d2492,'ListId':_0x34f739[_0xfec7('0x7d')]}));}})[_0xfec7('0x1b')](handleEntityNotFound(_0x100a36,null))['then'](function(_0x27bbb9){if(_0x27bbb9){_0x40e24c=_0x27bbb9;return db[_0xfec7('0xa3')][_0xfec7('0x52')]({'where':{'ContactId':_0x40e24c['id'],'closed':![],'SmsAccountId':_0x34f739['id']}})[_0xfec7('0x1b')](function(_0xfe61e1){if(_0xfe61e1){return[_0xfe61e1,![]];}return db['SmsInteraction']['create']({'UserId':_0xcdd26[_0xfec7('0x57')]['id'],'ContactId':_0x40e24c['id'],'SmsAccountId':_0x34f739['id'],'phone':_0x4d2492,'firstMsgDirection':_0xfec7('0xd1'),'Messages':[_['merge'](_0xcdd26[_0xfec7('0x55')],{'read':![],'body':_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')],'phone':_0x4d2492,'SmsAccountId':_0x34f739['id'],'UserId':_0xcdd26[_0xfec7('0x57')]['id'],'ContactId':_0x40e24c['id']})]},{'include':[{'model':db[_0xfec7('0xaa')],'as':'Messages'}]})[_0xfec7('0x1b')](function(_0x4c0ea0){return[_0x4c0ea0,!![]];});});}})[_0xfec7('0xd2')](function(_0xcf1ed9,_0x4ebe47){if(_0x4ebe47){return _0xcf1ed9;}return db['SmsMessage'][_0xfec7('0x54')](_[_0xfec7('0x4a')](_0xcdd26[_0xfec7('0x55')],{'read':![],'body':_0xcdd26[_0xfec7('0x55')][_0xfec7('0x55')],'phone':_0x4d2492,'SmsAccountId':_0x34f739['id'],'SmsInteractionId':_0xcf1ed9['id'],'UserId':_0xcdd26[_0xfec7('0x57')]['id'],'ContactId':_0x40e24c['id']}))['then'](function(_0x194e08){_0xcf1ed9['dataValues'][_0xfec7('0xd3')]=[];_0xcf1ed9[_0xfec7('0xd4')]['Messages'][_0xfec7('0xa6')](_0x194e08[_0xfec7('0xd4')]);return _0xcf1ed9;});})[_0xfec7('0x1b')](respondWithResult(_0x100a36,null))['catch'](handleError(_0x100a36,null));};exports['status']=function(_0x3c71a2,_0x1edec2,_0x543f97){if(_0x3c71a2[_0xfec7('0x55')]['id']){delete _0x3c71a2[_0xfec7('0x55')]['id'];}var _0x1730f5,_0x72f22,_0x411691;return db['SmsAccount']['find']({'where':{'id':_0x3c71a2['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x1edec2,null))[_0xfec7('0x1b')](function(_0x5dc6bd){if(_0x5dc6bd){_0x411691=_0x5dc6bd;logger[_0xfec7('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xfec7('0xd5'),_0x5dc6bd[_0xfec7('0x3b')],util[_0xfec7('0xd6')](_0x3c71a2['body'],{'showHidden':![],'depth':null}));switch(_0x5dc6bd[_0xfec7('0x3b')]){case'skebby':if(_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd7')]&&_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd7')]}});}break;case _0xfec7('0x86'):if(_0x3c71a2[_0xfec7('0x55')]['requestid']&&_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd8')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd8')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xd9')]}});}break;case _0xfec7('0x87'):if(_0x3c71a2['body']['message_id']&&_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xda')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')]['status_code'];return db[_0xfec7('0xaa')]['find']({'where':{'messageId':_0x3c71a2['body'][_0xfec7('0x88')]}});}break;case _0xfec7('0x8d'):var _0x2bb8e1=_0x3c71a2['body'][_0xfec7('0x8e')][0x0];if(_0x2bb8e1[_0xfec7('0x8b')]&&_0x2bb8e1[_0xfec7('0x25')][_0xfec7('0xdb')]==='DELIVERED'){_0x72f22=_0x2bb8e1['status'][_0xfec7('0xdb')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x2bb8e1['messageId']}});}break;case _0xfec7('0x91'):if(_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x8b')]&&_0x3c71a2[_0xfec7('0x55')]['status']){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')];return db['SmsMessage'][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2['body'][_0xfec7('0x8b')]}});}break;case _0xfec7('0xdc'):if(_0x3c71a2['body'][0x0]['message']['id']){_0x72f22=_0x3c71a2[_0xfec7('0x55')][0x0][_0xfec7('0x3b')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2[_0xfec7('0x55')][0x0][_0xfec7('0x22')]['id']}});}break;case _0xfec7('0x94'):if(_0x3c71a2[_0xfec7('0x55')][_0xfec7('0xdd')]&&_0x3c71a2['body'][_0xfec7('0x25')]){_0x72f22=_0x3c71a2[_0xfec7('0x55')][_0xfec7('0x25')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x3c71a2['body'][_0xfec7('0xdd')]}});}break;}}})['then'](handleEntityNotFound(_0x1edec2,null))[_0xfec7('0x1b')](function(_0x2b5476){if(_0x2b5476){_0x1730f5=_0x2b5476;switch(_0x411691[_0xfec7('0x3b')]){case'skebby':if(_0x72f22===_0xfec7('0xde')){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfec7('0x25'),_0xfec7('0x82'),util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x86'):if(_0x72f22==='1'){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),_0xfec7('0x25'),_0xfec7('0x82'),util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x87'):if(!_0x3c71a2[_0xfec7('0x55')]['error_code']&&_0x72f22>=0xc8&&_0x72f22<=0xce){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),_0xfec7('0x25'),_0xfec7('0x87'),util[_0xfec7('0xd6')](_0x3c71a2['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x55e5f3=_0x3c71a2['body'][_0xfec7('0x8e')][0x0];if(_0x55e5f3[_0xfec7('0x25')][_0xfec7('0xdb')]===_0xfec7('0xde')){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status',_0xfec7('0x8d'),util[_0xfec7('0xd6')](_0x3c71a2['body'],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x91'):if(_0x72f22==_0xfec7('0xdf')||_0x72f22=='RECEIVED_BY_RECIPIENT'){return _0x1730f5['update']({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status',_0xfec7('0x91'),util['inspect'](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0xdc'):if(_0x72f22==_0xfec7('0xe0')){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status','bandwidth',util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfec7('0x94'):if(_0x72f22===_0xfec7('0xe1')||_0x72f22==='ACCEPTD'){return _0x1730f5[_0xfec7('0x2f')]({'read':!![]});}else{logger[_0xfec7('0x1f')](_0xfec7('0x1e'),'status',_0xfec7('0x94'),util[_0xfec7('0xd6')](_0x3c71a2[_0xfec7('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1730f5;}})['then'](respondWithResult(_0x1edec2,null))[_0xfec7('0x53')](handleError(_0x1edec2,null));};exports['statusGet']=function(_0x53cc0f,_0x2944d9,_0x415d70){var _0x4c8041,_0x259137,_0x255c6a;return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x53cc0f[_0xfec7('0x50')]['id']}})['then'](handleEntityNotFound(_0x2944d9,null))['then'](function(_0x19b268){if(_0x19b268){_0x255c6a=_0x19b268;logger[_0xfec7('0x1d')](_0xfec7('0x1e'),'status',_0xfec7('0xd5'),_0x19b268[_0xfec7('0x3b')],util[_0xfec7('0xd6')](_0x53cc0f[_0xfec7('0x3e')],{'showHidden':![],'depth':null}));switch(_0x19b268[_0xfec7('0x3b')]){case _0xfec7('0x8f'):if(_0x53cc0f[_0xfec7('0x3e')][_0xfec7('0xe2')]&&_0x53cc0f[_0xfec7('0x3e')][_0xfec7('0xe3')]){_0x259137=_0x53cc0f[_0xfec7('0x3e')][_0xfec7('0xe3')];return db[_0xfec7('0xaa')][_0xfec7('0x52')]({'where':{'messageId':_0x53cc0f['query'][_0xfec7('0xe2')]}});}break;}}})['then'](handleEntityNotFound(_0x2944d9,null))[_0xfec7('0x1b')](function(_0x3a6ccf){if(_0x3a6ccf){_0x4c8041=_0x3a6ccf;switch(_0x255c6a[_0xfec7('0x3b')]){case _0xfec7('0x8f'):if(_0x259137==='2'||_0x259137==='6'){return _0x4c8041['update']({'read':!![]});}else{logger[_0xfec7('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfec7('0x25'),_0xfec7('0x8f'),util[_0xfec7('0xd6')](_0x53cc0f[_0xfec7('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x4c8041;}})[_0xfec7('0x1b')](respondWithResult(_0x2944d9,null))[_0xfec7('0x53')](handleError(_0x2944d9,null));};exports[_0xfec7('0xe4')]=function(_0x4e37cd,_0x792b59,_0xd4410e){return db[_0xfec7('0x38')]['find']({'where':{'id':_0x4e37cd['params']['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x792b59,null))['then'](function(_0x5cc07d){if(_0x5cc07d){return _0x5cc07d[_0xfec7('0xe4')](_0x4e37cd[_0xfec7('0x55')][_0xfec7('0x6c')],_[_0xfec7('0xa0')](_0x4e37cd[_0xfec7('0x55')],['ids','id'])||{})[_0xfec7('0xd2')](function(_0xb74a26){for(var _0x4b9537=0x0;_0x4b9537<_0x4e37cd[_0xfec7('0x55')][_0xfec7('0x6c')][_0xfec7('0x44')];_0x4b9537+=0x1){socket[_0xfec7('0xe5')](_0xfec7('0xe6'),{'UserId':Number(_0x4e37cd[_0xfec7('0x55')]['ids'][_0x4b9537]),'SmsAccountId':Number(_0x4e37cd['params']['id'])});}return _0xb74a26;});}})['then'](respondWithResult(_0x792b59,null))['catch'](handleError(_0x792b59,null));};exports[_0xfec7('0xe7')]=function(_0x2c877b,_0x43e130,_0x466875){return db[_0xfec7('0x38')][_0xfec7('0x52')]({'where':{'id':_0x2c877b[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0x43e130,null))['then'](function(_0x4542ae){if(_0x4542ae){return _0x4542ae[_0xfec7('0xe7')](_0x2c877b[_0xfec7('0x3e')][_0xfec7('0x6c')])['then'](function(){if(_['isArray'](_0x2c877b[_0xfec7('0x3e')][_0xfec7('0x6c')])){for(var _0x53a149=0x0;_0x53a149<_0x2c877b[_0xfec7('0x3e')][_0xfec7('0x6c')][_0xfec7('0x44')];_0x53a149+=0x1){socket[_0xfec7('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x2c877b['query']['ids'][_0x53a149]),'SmsAccountId':Number(_0x2c877b[_0xfec7('0x50')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x2c877b[_0xfec7('0x3e')]['ids']),'SmsAccountId':Number(_0x2c877b['params']['id'])});}});}})[_0xfec7('0x1b')](respondWithStatusCode(_0x43e130,null))[_0xfec7('0x53')](handleError(_0x43e130,null));};exports['getAgents']=function(_0x366e63,_0xc63b32,_0x251533){var _0x29cb71={};var _0x307a98={};var _0x2d92b6;var _0x359ad2;return db[_0xfec7('0x38')][_0xfec7('0x68')]({'where':{'id':_0x366e63[_0xfec7('0x50')]['id']}})[_0xfec7('0x1b')](handleEntityNotFound(_0xc63b32,null))[_0xfec7('0x1b')](function(_0x5c97e3){if(_0x5c97e3){_0x2d92b6=_0x5c97e3;_0x307a98['model']=_[_0xfec7('0x3f')](db[_0xfec7('0xae')][_0xfec7('0x39')]);_0x307a98[_0xfec7('0x3e')]=_['keys'](_0x366e63[_0xfec7('0x3e')]);_0x307a98[_0xfec7('0x40')]=_[_0xfec7('0x41')](_0x307a98[_0xfec7('0x3c')],_0x307a98[_0xfec7('0x3e')]);_0x29cb71[_0xfec7('0x42')]=_[_0xfec7('0x41')](_0x307a98[_0xfec7('0x3c')],qs[_0xfec7('0x43')](_0x366e63[_0xfec7('0x3e')][_0xfec7('0x43')]));_0x29cb71[_0xfec7('0x42')]=_0x29cb71[_0xfec7('0x42')][_0xfec7('0x44')]?_0x29cb71[_0xfec7('0x42')]:_0x307a98[_0xfec7('0x3c')];_0x29cb71[_0xfec7('0x63')]=qs[_0xfec7('0x64')](_0x366e63['query'][_0xfec7('0x64')]);_0x29cb71['where']=qs['filters'](_[_0xfec7('0x48')](_0x366e63['query'],_0x307a98[_0xfec7('0x40')]));if(_0x366e63[_0xfec7('0x3e')][_0xfec7('0x49')]){_0x29cb71['where']=_[_0xfec7('0x4a')](_0x29cb71[_0xfec7('0x47')],{'$or':_['map'](_0x29cb71[_0xfec7('0x42')],function(_0x3831ff){var _0x1ba1be={};_0x1ba1be[_0x3831ff]={'$like':'%'+_0x366e63[_0xfec7('0x3e')][_0xfec7('0x49')]+'%'};return _0x1ba1be;})});}_0x29cb71=_[_0xfec7('0x4a')]({},_0x29cb71,_0x366e63['options']);return _0x2d92b6[_0xfec7('0xe8')](_0x29cb71);}})[_0xfec7('0x1b')](function(_0x442dec){if(_0x442dec){_0x359ad2=_0x442dec['length'];if(!_0x366e63[_0xfec7('0x3e')][_0xfec7('0x45')](_0xfec7('0x46'))){_0x29cb71[_0xfec7('0x28')]=qs[_0xfec7('0x28')](_0x366e63['query'][_0xfec7('0x28')]);_0x29cb71[_0xfec7('0x27')]=qs[_0xfec7('0x27')](_0x366e63[_0xfec7('0x3e')]['offset']);}return _0x2d92b6['getAgents'](_0x29cb71);}})[_0xfec7('0x1b')](function(_0x157b22){if(_0x157b22){return _0x157b22?{'count':_0x359ad2,'rows':_0x157b22}:null;}})[_0xfec7('0x1b')](respondWithResult(_0xc63b32,null))[_0xfec7('0x53')](handleError(_0xc63b32,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2917dd9..95e9402 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 _0x2081=['remove','emit','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x2081,0x1ee));var _0x1208=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x2081[_0x204eb7];return _0x37e444;};'use strict';var EventEmitter=require(_0x1208('0x0'));var SmsAccount=require(_0x1208('0x1'))['db'][_0x1208('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1208('0x3')](0x0);var events={'afterCreate':_0x1208('0x4'),'afterUpdate':_0x1208('0x5'),'afterDestroy':_0x1208('0x6')};function emitEvent(_0x1d1a36){return function(_0x58e358,_0x1a6d25,_0x1f8e3a){SmsAccountEvents[_0x1208('0x7')](_0x1d1a36+':'+_0x58e358['id'],_0x58e358);SmsAccountEvents['emit'](_0x1d1a36,_0x58e358);_0x1f8e3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x1208('0x8')](e,emitEvent(event));}}module[_0x1208('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x6e2a=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','SmsAccount'];(function(_0x1c0fc3,_0x3537bb){var _0x338237=function(_0x4ebb72){while(--_0x4ebb72){_0x1c0fc3['push'](_0x1c0fc3['shift']());}};_0x338237(++_0x3537bb);}(_0x6e2a,0x185));var _0xa6e2=function(_0x51a1bf,_0x148868){_0x51a1bf=_0x51a1bf-0x0;var _0x279ab7=_0x6e2a[_0x51a1bf];return _0x279ab7;};'use strict';var EventEmitter=require(_0xa6e2('0x0'));var SmsAccount=require(_0xa6e2('0x1'))['db'][_0xa6e2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa6e2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6e2('0x4'),'afterDestroy':_0xa6e2('0x5')};function emitEvent(_0x4ad871){return function(_0xd6f29b,_0xf138a5,_0x1deb2d){SmsAccountEvents[_0xa6e2('0x6')](_0x4ad871+':'+_0xd6f29b['id'],_0xd6f29b);SmsAccountEvents[_0xa6e2('0x6')](_0x4ad871,_0xd6f29b);_0x1deb2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xa6e2('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3ceb62c..c87f9ac 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 _0xa7bf=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','sms_accounts','lodash'];(function(_0x5a8f97,_0x594ca9){var _0x588a6f=function(_0x5686e8){while(--_0x5686e8){_0x5a8f97['push'](_0x5a8f97['shift']());}};_0x588a6f(++_0x594ca9);}(_0xa7bf,0xef));var _0xfa7b=function(_0x42150d,_0x542bbc){_0x42150d=_0x42150d-0x0;var _0x4a1009=_0xa7bf[_0x42150d];return _0x4a1009;};'use strict';var _=require(_0xfa7b('0x0'));var util=require(_0xfa7b('0x1'));var logger=require(_0xfa7b('0x2'))('api');var moment=require(_0xfa7b('0x3'));var BPromise=require(_0xfa7b('0x4'));var rp=require(_0xfa7b('0x5'));var fs=require('fs');var path=require(_0xfa7b('0x6'));var rimraf=require(_0xfa7b('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa7b('0x8'));module[_0xfa7b('0x9')]=function(_0x3ddd5e,_0x3a158a){return _0x3ddd5e[_0xfa7b('0xa')]('SmsAccount',attributes,{'tableName':_0xfa7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc834=['define','SmsAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0xb1c60b,_0x385134){var _0x4c391d=function(_0x34a8f3){while(--_0x34a8f3){_0xb1c60b['push'](_0xb1c60b['shift']());}};_0x4c391d(++_0x385134);}(_0xc834,0x7a));var _0x4c83=function(_0x2fe771,_0x1df697){_0x2fe771=_0x2fe771-0x0;var _0x572bbe=_0xc834[_0x2fe771];return _0x572bbe;};'use strict';var _=require(_0x4c83('0x0'));var util=require(_0x4c83('0x1'));var logger=require(_0x4c83('0x2'))(_0x4c83('0x3'));var moment=require(_0x4c83('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c83('0x5'));var rimraf=require(_0x4c83('0x6'));var config=require(_0x4c83('0x7'));var attributes=require(_0x4c83('0x8'));module[_0x4c83('0x9')]=function(_0x3c0e2b,_0x7e2c14){return _0x3c0e2b[_0x4c83('0xa')](_0x4c83('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 439513b..f05dab3 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 _0xd0d7=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x283e41,_0x3342a8){var _0x295438=function(_0x2c7b08){while(--_0x2c7b08){_0x283e41['push'](_0x283e41['shift']());}};_0x295438(++_0x3342a8);}(_0xd0d7,0x11a));var _0x7d0d=function(_0x1f79c9,_0x21021b){_0x1f79c9=_0x1f79c9-0x0;var _0x1cfcf9=_0xd0d7[_0x1f79c9];return _0x1cfcf9;};'use strict';var _=require(_0x7d0d('0x0'));var util=require(_0x7d0d('0x1'));var moment=require('moment');var BPromise=require(_0x7d0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d0d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d0d('0x4'));var logger=require(_0x7d0d('0x5'))(_0x7d0d('0x6'));var config=require(_0x7d0d('0x7'));var jayson=require(_0x7d0d('0x8'));var client=jayson['client'][_0x7d0d('0x9')]({'port':0x232a});config[_0x7d0d('0xa')]=_[_0x7d0d('0xb')](config[_0x7d0d('0xa')],{'host':_0x7d0d('0xc'),'port':0x18eb});var socket=require(_0x7d0d('0xd'))(new Redis(config['redis']));require(_0x7d0d('0xe'))[_0x7d0d('0xf')](socket);function respondWithRpcPromise(_0x3a5f74,_0x10ea24,_0x3a91da){return new BPromise(function(_0x16d74e,_0x13fdca){return client[_0x7d0d('0x10')](_0x3a5f74,_0x3a91da)[_0x7d0d('0x11')](function(_0x5246da){logger[_0x7d0d('0x12')](_0x7d0d('0x13'),_0x10ea24,_0x7d0d('0x14'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10ea24,_0x7d0d('0x14'),JSON['stringify'](_0x5246da));if(_0x5246da[_0x7d0d('0x15')]){if(_0x5246da['error'][_0x7d0d('0x16')]===0x1f4){logger[_0x7d0d('0x15')]('SmsAccount,\x20%s,\x20%s',_0x10ea24,_0x5246da[_0x7d0d('0x15')][_0x7d0d('0x17')]);return _0x13fdca(_0x5246da[_0x7d0d('0x15')][_0x7d0d('0x17')]);}logger[_0x7d0d('0x15')]('SmsAccount,\x20%s,\x20%s',_0x10ea24,_0x5246da['error'][_0x7d0d('0x17')]);return _0x16d74e(_0x5246da[_0x7d0d('0x15')][_0x7d0d('0x17')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x10ea24,_0x7d0d('0x14'));_0x16d74e(_0x5246da[_0x7d0d('0x18')][_0x7d0d('0x17')]);}})['catch'](function(_0x29d4d4){logger[_0x7d0d('0x15')](_0x7d0d('0x13'),_0x10ea24,_0x29d4d4);_0x13fdca(_0x29d4d4);});});}exports[_0x7d0d('0x19')]=function(_0x387b03){var _0x59d8d5=this;return new Promise(function(_0xa1b9e8,_0x327bbf){return db[_0x7d0d('0x1a')][_0x7d0d('0x1b')]({'raw':_0x387b03['options']?_0x387b03[_0x7d0d('0x1c')][_0x7d0d('0x1d')]===undefined?!![]:![]:!![],'where':_0x387b03[_0x7d0d('0x1c')]?_0x387b03['options'][_0x7d0d('0x1e')]||null:null,'attributes':_0x387b03[_0x7d0d('0x1c')]?_0x387b03[_0x7d0d('0x1c')][_0x7d0d('0x1f')]||null:null,'include':_0x387b03[_0x7d0d('0x1c')]?_0x387b03['options'][_0x7d0d('0x20')]?_[_0x7d0d('0x21')](_0x387b03[_0x7d0d('0x1c')][_0x7d0d('0x20')],function(_0x508f58){return{'model':db[_0x508f58['model']],'as':_0x508f58['as'],'attributes':_0x508f58[_0x7d0d('0x1f')],'include':_0x508f58[_0x7d0d('0x20')]?_[_0x7d0d('0x21')](_0x508f58['include'],function(_0x645aaf){return{'model':db[_0x645aaf[_0x7d0d('0x22')]],'as':_0x645aaf['as'],'attributes':_0x645aaf[_0x7d0d('0x1f')],'include':_0x645aaf['include']?_[_0x7d0d('0x21')](_0x645aaf[_0x7d0d('0x20')],function(_0x3c3c69){return{'model':db[_0x3c3c69[_0x7d0d('0x22')]],'as':_0x3c3c69['as'],'attributes':_0x3c3c69[_0x7d0d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7d0d('0x11')](function(_0x5139f7){logger[_0x7d0d('0x12')](_0x7d0d('0x19'),_0x387b03);logger[_0x7d0d('0x23')](_0x7d0d('0x19'),_0x387b03,JSON['stringify'](_0x5139f7));_0xa1b9e8(_0x5139f7);})['catch'](function(_0x51aa66){logger[_0x7d0d('0x15')](_0x7d0d('0x19'),_0x51aa66[_0x7d0d('0x17')],_0x387b03);_0x327bbf(_0x59d8d5[_0x7d0d('0x15')](0x1f4,_0x51aa66[_0x7d0d('0x17')]));});});}; \ No newline at end of file +var _0xa41b=['options','raw','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa41b,0x12e));var _0xba41=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xa41b[_0x3dc68d];return _0xdf7f94;};'use strict';var _=require(_0xba41('0x0'));var util=require(_0xba41('0x1'));var moment=require(_0xba41('0x2'));var BPromise=require(_0xba41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba41('0x5'));var logger=require('../../config/logger')(_0xba41('0x6'));var config=require(_0xba41('0x7'));var jayson=require(_0xba41('0x8'));var client=jayson[_0xba41('0x9')][_0xba41('0xa')]({'port':0x232a});config[_0xba41('0xb')]=_[_0xba41('0xc')](config['redis'],{'host':_0xba41('0xd'),'port':0x18eb});var socket=require(_0xba41('0xe'))(new Redis(config[_0xba41('0xb')]));require(_0xba41('0xf'))['register'](socket);function respondWithRpcPromise(_0x54a6ac,_0x2ed7e9,_0x25b548){return new BPromise(function(_0x1cd77c,_0x469913){return client[_0xba41('0x10')](_0x54a6ac,_0x25b548)[_0xba41('0x11')](function(_0x357957){logger[_0xba41('0x12')](_0xba41('0x13'),_0x2ed7e9,_0xba41('0x14'));logger[_0xba41('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2ed7e9,_0xba41('0x14'),JSON[_0xba41('0x16')](_0x357957));if(_0x357957['error']){if(_0x357957['error'][_0xba41('0x17')]===0x1f4){logger[_0xba41('0x18')](_0xba41('0x13'),_0x2ed7e9,_0x357957['error'][_0xba41('0x19')]);return _0x469913(_0x357957['error'][_0xba41('0x19')]);}logger[_0xba41('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2ed7e9,_0x357957[_0xba41('0x18')][_0xba41('0x19')]);return _0x1cd77c(_0x357957[_0xba41('0x18')][_0xba41('0x19')]);}else{logger[_0xba41('0x12')](_0xba41('0x13'),_0x2ed7e9,_0xba41('0x14'));_0x1cd77c(_0x357957[_0xba41('0x1a')][_0xba41('0x19')]);}})[_0xba41('0x1b')](function(_0x1b97d1){logger[_0xba41('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2ed7e9,_0x1b97d1);_0x469913(_0x1b97d1);});});}exports[_0xba41('0x1c')]=function(_0x1a9a8f){var _0x1a57b7=this;return new Promise(function(_0x36dc53,_0x2438e9){return db[_0xba41('0x1d')][_0xba41('0x1e')]({'raw':_0x1a9a8f[_0xba41('0x1f')]?_0x1a9a8f['options'][_0xba41('0x20')]===undefined?!![]:![]:!![],'where':_0x1a9a8f['options']?_0x1a9a8f['options']['where']||null:null,'attributes':_0x1a9a8f['options']?_0x1a9a8f[_0xba41('0x1f')][_0xba41('0x21')]||null:null,'include':_0x1a9a8f[_0xba41('0x1f')]?_0x1a9a8f[_0xba41('0x1f')][_0xba41('0x22')]?_['map'](_0x1a9a8f[_0xba41('0x1f')][_0xba41('0x22')],function(_0x4e7455){return{'model':db[_0x4e7455[_0xba41('0x23')]],'as':_0x4e7455['as'],'attributes':_0x4e7455[_0xba41('0x21')],'include':_0x4e7455[_0xba41('0x22')]?_[_0xba41('0x24')](_0x4e7455['include'],function(_0x1a0444){return{'model':db[_0x1a0444[_0xba41('0x23')]],'as':_0x1a0444['as'],'attributes':_0x1a0444[_0xba41('0x21')],'include':_0x1a0444[_0xba41('0x22')]?_[_0xba41('0x24')](_0x1a0444[_0xba41('0x22')],function(_0x511587){return{'model':db[_0x511587[_0xba41('0x23')]],'as':_0x511587['as'],'attributes':_0x511587['attributes']};}):[]};}):[]};}):[]:[]})[_0xba41('0x11')](function(_0x45a185){logger[_0xba41('0x12')](_0xba41('0x1c'),_0x1a9a8f);logger[_0xba41('0x15')](_0xba41('0x1c'),_0x1a9a8f,JSON['stringify'](_0x45a185));_0x36dc53(_0x45a185);})[_0xba41('0x1b')](function(_0x47a2f0){logger[_0xba41('0x18')](_0xba41('0x1c'),_0x47a2f0['message'],_0x1a9a8f);_0x2438e9(_0x1a57b7[_0xba41('0x18')](0x1f4,_0x47a2f0[_0xba41('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5175e78..e68da6d 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 0e73880..7353115 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0xe2221a,_0x13aa1e){var _0x28e80e=function(_0x50db59){while(--_0x50db59){_0xe2221a['push'](_0xe2221a['shift']());}};_0x28e80e(++_0x13aa1e);}(_0x008c,0x188));var _0xc008=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0x008c[_0x57062a];return _0xa178da;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +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(_0x3cca7a,_0x109a23){var _0x34e717=function(_0x19a41f){while(--_0x19a41f){_0x3cca7a['push'](_0x3cca7a['shift']());}};_0x34e717(++_0x109a23);}(_0x3e74,0x175));var _0x43e7=function(_0x4eb6a2,_0x1a610c){_0x4eb6a2=_0x4eb6a2-0x0;var _0x3bdd59=_0x3e74[_0x4eb6a2];return _0x3bdd59;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9544666..6696f15 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 _0x5cdd=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x148932,_0x2febe5){var _0x3eecd1=function(_0x6c3ad2){while(--_0x6c3ad2){_0x148932['push'](_0x148932['shift']());}};_0x3eecd1(++_0x2febe5);}(_0x5cdd,0x161));var _0xd5cd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5cdd[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0xd5cd('0x0')]={'priority':{'type':Sequelize[_0xd5cd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd5cd('0x2')],'allowNull':![],'defaultValue':_0xd5cd('0x3')},'appdata':{'type':Sequelize[_0xd5cd('0x4')]()},'description':{'type':Sequelize[_0xd5cd('0x2')]},'interval':{'type':Sequelize[_0xd5cd('0x2')],'defaultValue':_0xd5cd('0x5')}}; \ No newline at end of file +var _0xd574=['sequelize','INTEGER','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd574,0xa8));var _0x4d57=function(_0x5dbd4b,_0x363948){_0x5dbd4b=_0x5dbd4b-0x0;var _0x22d54a=_0xd574[_0x5dbd4b];return _0x22d54a;};'use strict';var Sequelize=require(_0x4d57('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4d57('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4d57('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4d57('0x3')]()},'description':{'type':Sequelize[_0x4d57('0x2')]},'interval':{'type':Sequelize[_0x4d57('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4c0477b..1bc16f0 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 _0xea13=['save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','SmsApplication','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','Content-Range','apply','reject'];(function(_0x3bf235,_0x13fe7b){var _0x3ecfaa=function(_0x3941eb){while(--_0x3941eb){_0x3bf235['push'](_0x3bf235['shift']());}};_0x3ecfaa(++_0x13fe7b);}(_0xea13,0x71));var _0x3ea1=function(_0x316fb1,_0x531561){_0x316fb1=_0x316fb1-0x0;var _0x5168a7=_0xea13[_0x316fb1];return _0x5168a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ea1('0x0'));var jsonpatch=require(_0x3ea1('0x1'));var rp=require(_0x3ea1('0x2'));var moment=require(_0x3ea1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ea1('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ea1('0x5'));var fs=require('fs');var fs_extra=require(_0x3ea1('0x6'));var _=require(_0x3ea1('0x7'));var squel=require(_0x3ea1('0x8'));var crypto=require(_0x3ea1('0x9'));var jsforce=require(_0x3ea1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3ea1('0xb'));var querystring=require(_0x3ea1('0xc'));var Papa=require(_0x3ea1('0xd'));var Redis=require(_0x3ea1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3ea1('0xf'));var hardwareService=require(_0x3ea1('0x10'));var logger=require(_0x3ea1('0x11'))(_0x3ea1('0x12'));var utils=require('../../config/utils');var config=require(_0x3ea1('0x13'));var licenseUtil=require(_0x3ea1('0x14'));var db=require(_0x3ea1('0x15'))['db'];function respondWithStatusCode(_0x4a02d8,_0x1aefbd){_0x1aefbd=_0x1aefbd||0xcc;return function(_0x47c1ff){if(_0x47c1ff){return _0x4a02d8[_0x3ea1('0x16')](_0x1aefbd);}return _0x4a02d8[_0x3ea1('0x17')](_0x1aefbd)['end']();};}function respondWithResult(_0x285bd4,_0x428a79){_0x428a79=_0x428a79||0xc8;return function(_0x1d6f32){if(_0x1d6f32){return _0x285bd4[_0x3ea1('0x17')](_0x428a79)['json'](_0x1d6f32);}};}function respondWithFilteredResult(_0x3bd344,_0x2e54ed){return function(_0x492c65){if(_0x492c65){var _0x35bc13=typeof _0x2e54ed['offset']==='undefined'&&typeof _0x2e54ed[_0x3ea1('0x18')]===_0x3ea1('0x19');var _0x29bb94=_0x492c65[_0x3ea1('0x1a')];var _0x2879e3=_0x35bc13?0x0:_0x2e54ed[_0x3ea1('0x1b')];var _0x86716d=_0x35bc13?_0x492c65[_0x3ea1('0x1a')]:_0x2e54ed[_0x3ea1('0x1b')]+_0x2e54ed[_0x3ea1('0x18')];var _0x5ed72a;if(_0x86716d>=_0x29bb94){_0x86716d=_0x29bb94;_0x5ed72a=0xc8;}else{_0x5ed72a=0xce;}_0x3bd344[_0x3ea1('0x17')](_0x5ed72a);return _0x3bd344['set'](_0x3ea1('0x1c'),_0x2879e3+'-'+_0x86716d+'/'+_0x29bb94)['json'](_0x492c65);}return null;};}function patchUpdates(_0x5a87d4){return function(_0x2b93a){try{jsonpatch[_0x3ea1('0x1d')](_0x2b93a,_0x5a87d4,!![]);}catch(_0x3159f8){return BPromise[_0x3ea1('0x1e')](_0x3159f8);}return _0x2b93a[_0x3ea1('0x1f')]();};}function saveUpdates(_0x529432,_0xbcf175){return function(_0x36ce0e){if(_0x36ce0e){return _0x36ce0e[_0x3ea1('0x20')](_0x529432)[_0x3ea1('0x21')](function(_0x17a50c){return _0x17a50c;});}return null;};}function removeEntity(_0x51b027,_0x28cc9f){return function(_0x5a91fe){if(_0x5a91fe){return _0x5a91fe[_0x3ea1('0x22')]()[_0x3ea1('0x21')](function(){_0x51b027[_0x3ea1('0x17')](0xcc)[_0x3ea1('0x23')]();});}};}function handleEntityNotFound(_0x5483b0,_0x3d7caf){return function(_0x511708){if(!_0x511708){_0x5483b0[_0x3ea1('0x16')](0x194);}return _0x511708;};}function handleError(_0x577454,_0x450012){_0x450012=_0x450012||0x1f4;return function(_0x112362){logger[_0x3ea1('0x24')](_0x112362[_0x3ea1('0x25')]);if(_0x112362[_0x3ea1('0x26')]){delete _0x112362['name'];}_0x577454['status'](_0x450012)[_0x3ea1('0x27')](_0x112362);};}exports[_0x3ea1('0x28')]=function(_0x1ff15f,_0x1795b7){var _0x5d4fff={},_0x42bc9f={},_0x3f5de3={'count':0x0,'rows':[]};var _0x47908f=_[_0x3ea1('0x29')](db['SmsApplication'][_0x3ea1('0x2a')],function(_0x3fc065){return{'name':_0x3fc065['fieldName'],'type':_0x3fc065[_0x3ea1('0x2b')][_0x3ea1('0x2c')]};});_0x42bc9f[_0x3ea1('0x2d')]=_['map'](_0x47908f,'name');_0x42bc9f[_0x3ea1('0x2e')]=_[_0x3ea1('0x2f')](_0x1ff15f[_0x3ea1('0x2e')]);_0x42bc9f[_0x3ea1('0x30')]=_[_0x3ea1('0x31')](_0x42bc9f[_0x3ea1('0x2d')],_0x42bc9f['query']);_0x5d4fff[_0x3ea1('0x32')]=_[_0x3ea1('0x31')](_0x42bc9f[_0x3ea1('0x2d')],qs['fields'](_0x1ff15f['query'][_0x3ea1('0x33')]));_0x5d4fff[_0x3ea1('0x32')]=_0x5d4fff[_0x3ea1('0x32')][_0x3ea1('0x34')]?_0x5d4fff[_0x3ea1('0x32')]:_0x42bc9f[_0x3ea1('0x2d')];if(!_0x1ff15f['query']['hasOwnProperty'](_0x3ea1('0x35'))){_0x5d4fff[_0x3ea1('0x18')]=qs[_0x3ea1('0x18')](_0x1ff15f['query'][_0x3ea1('0x18')]);_0x5d4fff[_0x3ea1('0x1b')]=qs[_0x3ea1('0x1b')](_0x1ff15f['query'][_0x3ea1('0x1b')]);}_0x5d4fff['order']=qs['sort'](_0x1ff15f['query'][_0x3ea1('0x36')]);_0x5d4fff[_0x3ea1('0x37')]=qs[_0x3ea1('0x30')](_[_0x3ea1('0x38')](_0x1ff15f[_0x3ea1('0x2e')],_0x42bc9f[_0x3ea1('0x30')]),_0x47908f);if(_0x1ff15f[_0x3ea1('0x2e')][_0x3ea1('0x39')]){_0x5d4fff[_0x3ea1('0x37')]=_['merge'](_0x5d4fff['where'],{'$or':_['map'](_0x47908f,function(_0x2b45f6){if(_0x2b45f6[_0x3ea1('0x2b')]!==_0x3ea1('0x3a')){var _0x361bbb={};_0x361bbb[_0x2b45f6['name']]={'$like':'%'+_0x1ff15f['query'][_0x3ea1('0x39')]+'%'};return _0x361bbb;}})});}_0x5d4fff=_[_0x3ea1('0x3b')]({},_0x5d4fff,_0x1ff15f['options']);var _0x57024e={'where':_0x5d4fff[_0x3ea1('0x37')]};return db[_0x3ea1('0x3c')][_0x3ea1('0x1a')](_0x57024e)[_0x3ea1('0x21')](function(_0x29377e){_0x3f5de3[_0x3ea1('0x1a')]=_0x29377e;if(_0x1ff15f[_0x3ea1('0x2e')][_0x3ea1('0x3d')]){_0x5d4fff[_0x3ea1('0x3e')]=[{'all':!![]}];}return db[_0x3ea1('0x3c')][_0x3ea1('0x3f')](_0x5d4fff);})[_0x3ea1('0x21')](function(_0x58d5a6){_0x3f5de3[_0x3ea1('0x40')]=_0x58d5a6;return _0x3f5de3;})['then'](respondWithFilteredResult(_0x1795b7,_0x5d4fff))[_0x3ea1('0x41')](handleError(_0x1795b7,null));};exports[_0x3ea1('0x42')]=function(_0x4cda70,_0x449ba3){var _0x3c693b={'raw':!![],'where':{'id':_0x4cda70['params']['id']}},_0x377df3={};_0x377df3[_0x3ea1('0x2d')]=_[_0x3ea1('0x2f')](db['SmsApplication'][_0x3ea1('0x2a')]);_0x377df3[_0x3ea1('0x2e')]=_[_0x3ea1('0x2f')](_0x4cda70[_0x3ea1('0x2e')]);_0x377df3['filters']=_[_0x3ea1('0x31')](_0x377df3[_0x3ea1('0x2d')],_0x377df3[_0x3ea1('0x2e')]);_0x3c693b['attributes']=_[_0x3ea1('0x31')](_0x377df3[_0x3ea1('0x2d')],qs[_0x3ea1('0x33')](_0x4cda70[_0x3ea1('0x2e')][_0x3ea1('0x33')]));_0x3c693b['attributes']=_0x3c693b[_0x3ea1('0x32')][_0x3ea1('0x34')]?_0x3c693b[_0x3ea1('0x32')]:_0x377df3['model'];if(_0x4cda70[_0x3ea1('0x2e')][_0x3ea1('0x3d')]){_0x3c693b[_0x3ea1('0x3e')]=[{'all':!![]}];}_0x3c693b=_[_0x3ea1('0x3b')]({},_0x3c693b,_0x4cda70[_0x3ea1('0x43')]);return db[_0x3ea1('0x3c')]['find'](_0x3c693b)[_0x3ea1('0x21')](handleEntityNotFound(_0x449ba3,null))[_0x3ea1('0x21')](respondWithResult(_0x449ba3,null))[_0x3ea1('0x41')](handleError(_0x449ba3,null));};exports['create']=function(_0x156e25,_0x2d3762){return db[_0x3ea1('0x3c')][_0x3ea1('0x44')](_0x156e25[_0x3ea1('0x45')],{})[_0x3ea1('0x21')](respondWithResult(_0x2d3762,0xc9))['catch'](handleError(_0x2d3762,null));};exports[_0x3ea1('0x20')]=function(_0x2bf999,_0x5013e7){if(_0x2bf999[_0x3ea1('0x45')]['id']){delete _0x2bf999['body']['id'];}return db[_0x3ea1('0x3c')][_0x3ea1('0x46')]({'where':{'id':_0x2bf999[_0x3ea1('0x47')]['id']}})[_0x3ea1('0x21')](handleEntityNotFound(_0x5013e7,null))['then'](saveUpdates(_0x2bf999[_0x3ea1('0x45')],null))[_0x3ea1('0x21')](respondWithResult(_0x5013e7,null))['catch'](handleError(_0x5013e7,null));};exports[_0x3ea1('0x22')]=function(_0x4dda9b,_0x2b5d2a){return db['SmsApplication']['find']({'where':{'id':_0x4dda9b['params']['id']}})[_0x3ea1('0x21')](handleEntityNotFound(_0x2b5d2a,null))[_0x3ea1('0x21')](removeEntity(_0x2b5d2a,null))[_0x3ea1('0x41')](handleError(_0x2b5d2a,null));}; \ No newline at end of file +var _0xc090=['includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','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','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params'];(function(_0x362519,_0x5d067b){var _0x134ba4=function(_0xc12a5e){while(--_0xc12a5e){_0x362519['push'](_0x362519['shift']());}};_0x134ba4(++_0x5d067b);}(_0xc090,0x1de));var _0x0c09=function(_0x1b299e,_0x20a0d5){_0x1b299e=_0x1b299e-0x0;var _0x456c63=_0xc090[_0x1b299e];return _0x456c63;};'use strict';var emlformat=require(_0x0c09('0x0'));var rimraf=require(_0x0c09('0x1'));var zipdir=require(_0x0c09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0c09('0x6'));var sox=require('sox');var csv=require(_0x0c09('0x7'));var ejs=require(_0x0c09('0x8'));var fs=require('fs');var fs_extra=require(_0x0c09('0x9'));var _=require(_0x0c09('0xa'));var squel=require(_0x0c09('0xb'));var crypto=require(_0x0c09('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c09('0xd'));var toCsv=require(_0x0c09('0x7'));var querystring=require('querystring');var Papa=require(_0x0c09('0xe'));var Redis=require(_0x0c09('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0c09('0x10'));var as=require(_0x0c09('0x11'));var hardwareService=require(_0x0c09('0x12'));var logger=require(_0x0c09('0x13'))(_0x0c09('0x14'));var utils=require(_0x0c09('0x15'));var config=require(_0x0c09('0x16'));var licenseUtil=require(_0x0c09('0x17'));var db=require(_0x0c09('0x18'))['db'];function respondWithStatusCode(_0x3b4e0c,_0x299ca9){_0x299ca9=_0x299ca9||0xcc;return function(_0x25c3db){if(_0x25c3db){return _0x3b4e0c[_0x0c09('0x19')](_0x299ca9);}return _0x3b4e0c[_0x0c09('0x1a')](_0x299ca9)[_0x0c09('0x1b')]();};}function respondWithResult(_0x1cb3f8,_0x2e172f){_0x2e172f=_0x2e172f||0xc8;return function(_0x3810a5){if(_0x3810a5){return _0x1cb3f8[_0x0c09('0x1a')](_0x2e172f)[_0x0c09('0x1c')](_0x3810a5);}};}function respondWithFilteredResult(_0x1975f9,_0x295014){return function(_0x4f72a4){if(_0x4f72a4){var _0x46d428=typeof _0x295014[_0x0c09('0x1d')]===_0x0c09('0x1e')&&typeof _0x295014[_0x0c09('0x1f')]==='undefined';var _0x167176=_0x4f72a4[_0x0c09('0x20')];var _0x205d4d=_0x46d428?0x0:_0x295014[_0x0c09('0x1d')];var _0xe4b4de=_0x46d428?_0x4f72a4[_0x0c09('0x20')]:_0x295014[_0x0c09('0x1d')]+_0x295014[_0x0c09('0x1f')];var _0x2790e4;if(_0xe4b4de>=_0x167176){_0xe4b4de=_0x167176;_0x2790e4=0xc8;}else{_0x2790e4=0xce;}_0x1975f9[_0x0c09('0x1a')](_0x2790e4);return _0x1975f9[_0x0c09('0x21')]('Content-Range',_0x205d4d+'-'+_0xe4b4de+'/'+_0x167176)[_0x0c09('0x1c')](_0x4f72a4);}return null;};}function patchUpdates(_0x2f89ca){return function(_0x515129){try{jsonpatch[_0x0c09('0x22')](_0x515129,_0x2f89ca,!![]);}catch(_0x22a32d){return BPromise[_0x0c09('0x23')](_0x22a32d);}return _0x515129[_0x0c09('0x24')]();};}function saveUpdates(_0x780fe0,_0x3b6372){return function(_0x362ec3){if(_0x362ec3){return _0x362ec3[_0x0c09('0x25')](_0x780fe0)[_0x0c09('0x26')](function(_0x161d2e){return _0x161d2e;});}return null;};}function removeEntity(_0x1c1174,_0x610e29){return function(_0x1c7ebb){if(_0x1c7ebb){return _0x1c7ebb[_0x0c09('0x27')]()['then'](function(){_0x1c1174[_0x0c09('0x1a')](0xcc)[_0x0c09('0x1b')]();});}};}function handleEntityNotFound(_0x1b2d6a,_0x42c7d3){return function(_0x576a61){if(!_0x576a61){_0x1b2d6a[_0x0c09('0x19')](0x194);}return _0x576a61;};}function handleError(_0x1a81be,_0x48232){_0x48232=_0x48232||0x1f4;return function(_0x41e4f4){logger[_0x0c09('0x28')](_0x41e4f4[_0x0c09('0x29')]);if(_0x41e4f4['name']){delete _0x41e4f4[_0x0c09('0x2a')];}_0x1a81be['status'](_0x48232)[_0x0c09('0x2b')](_0x41e4f4);};}exports[_0x0c09('0x2c')]=function(_0x18a517,_0x12a101){var _0x387875={},_0x417dc2={},_0x4656bf={'count':0x0,'rows':[]};var _0x5c9909=_[_0x0c09('0x2d')](db[_0x0c09('0x2e')][_0x0c09('0x2f')],function(_0x390199){return{'name':_0x390199[_0x0c09('0x30')],'type':_0x390199[_0x0c09('0x31')][_0x0c09('0x32')]};});_0x417dc2['model']=_[_0x0c09('0x2d')](_0x5c9909,'name');_0x417dc2[_0x0c09('0x33')]=_[_0x0c09('0x34')](_0x18a517[_0x0c09('0x33')]);_0x417dc2[_0x0c09('0x35')]=_['intersection'](_0x417dc2['model'],_0x417dc2[_0x0c09('0x33')]);_0x387875[_0x0c09('0x36')]=_[_0x0c09('0x37')](_0x417dc2[_0x0c09('0x38')],qs[_0x0c09('0x39')](_0x18a517[_0x0c09('0x33')]['fields']));_0x387875[_0x0c09('0x36')]=_0x387875['attributes'][_0x0c09('0x3a')]?_0x387875[_0x0c09('0x36')]:_0x417dc2[_0x0c09('0x38')];if(!_0x18a517[_0x0c09('0x33')][_0x0c09('0x3b')](_0x0c09('0x3c'))){_0x387875[_0x0c09('0x1f')]=qs[_0x0c09('0x1f')](_0x18a517[_0x0c09('0x33')][_0x0c09('0x1f')]);_0x387875[_0x0c09('0x1d')]=qs['offset'](_0x18a517[_0x0c09('0x33')][_0x0c09('0x1d')]);}_0x387875[_0x0c09('0x3d')]=qs[_0x0c09('0x3e')](_0x18a517['query'][_0x0c09('0x3e')]);_0x387875[_0x0c09('0x3f')]=qs['filters'](_[_0x0c09('0x40')](_0x18a517[_0x0c09('0x33')],_0x417dc2[_0x0c09('0x35')]),_0x5c9909);if(_0x18a517[_0x0c09('0x33')][_0x0c09('0x41')]){_0x387875[_0x0c09('0x3f')]=_['merge'](_0x387875[_0x0c09('0x3f')],{'$or':_['map'](_0x5c9909,function(_0xb835e5){if(_0xb835e5[_0x0c09('0x31')]!==_0x0c09('0x42')){var _0x5d0817={};_0x5d0817[_0xb835e5['name']]={'$like':'%'+_0x18a517['query'][_0x0c09('0x41')]+'%'};return _0x5d0817;}})});}_0x387875=_[_0x0c09('0x43')]({},_0x387875,_0x18a517[_0x0c09('0x44')]);var _0x14e81c={'where':_0x387875[_0x0c09('0x3f')]};return db[_0x0c09('0x2e')][_0x0c09('0x20')](_0x14e81c)[_0x0c09('0x26')](function(_0x222f88){_0x4656bf[_0x0c09('0x20')]=_0x222f88;if(_0x18a517['query']['includeAll']){_0x387875[_0x0c09('0x45')]=[{'all':!![]}];}return db[_0x0c09('0x2e')][_0x0c09('0x46')](_0x387875);})[_0x0c09('0x26')](function(_0x5423b0){_0x4656bf[_0x0c09('0x47')]=_0x5423b0;return _0x4656bf;})[_0x0c09('0x26')](respondWithFilteredResult(_0x12a101,_0x387875))[_0x0c09('0x48')](handleError(_0x12a101,null));};exports[_0x0c09('0x49')]=function(_0x3708e6,_0x3768a8){var _0x5e2503={'raw':!![],'where':{'id':_0x3708e6[_0x0c09('0x4a')]['id']}},_0x4c0b22={};_0x4c0b22[_0x0c09('0x38')]=_[_0x0c09('0x34')](db[_0x0c09('0x2e')][_0x0c09('0x2f')]);_0x4c0b22['query']=_[_0x0c09('0x34')](_0x3708e6[_0x0c09('0x33')]);_0x4c0b22['filters']=_[_0x0c09('0x37')](_0x4c0b22['model'],_0x4c0b22[_0x0c09('0x33')]);_0x5e2503[_0x0c09('0x36')]=_[_0x0c09('0x37')](_0x4c0b22[_0x0c09('0x38')],qs['fields'](_0x3708e6['query']['fields']));_0x5e2503[_0x0c09('0x36')]=_0x5e2503[_0x0c09('0x36')][_0x0c09('0x3a')]?_0x5e2503[_0x0c09('0x36')]:_0x4c0b22[_0x0c09('0x38')];if(_0x3708e6[_0x0c09('0x33')][_0x0c09('0x4b')]){_0x5e2503['include']=[{'all':!![]}];}_0x5e2503=_[_0x0c09('0x43')]({},_0x5e2503,_0x3708e6[_0x0c09('0x44')]);return db[_0x0c09('0x2e')][_0x0c09('0x4c')](_0x5e2503)[_0x0c09('0x26')](handleEntityNotFound(_0x3768a8,null))[_0x0c09('0x26')](respondWithResult(_0x3768a8,null))[_0x0c09('0x48')](handleError(_0x3768a8,null));};exports['create']=function(_0x5245e5,_0x174739){return db['SmsApplication'][_0x0c09('0x4d')](_0x5245e5[_0x0c09('0x4e')],{})[_0x0c09('0x26')](respondWithResult(_0x174739,0xc9))[_0x0c09('0x48')](handleError(_0x174739,null));};exports[_0x0c09('0x25')]=function(_0x958eb,_0x497049){if(_0x958eb[_0x0c09('0x4e')]['id']){delete _0x958eb[_0x0c09('0x4e')]['id'];}return db[_0x0c09('0x2e')][_0x0c09('0x4c')]({'where':{'id':_0x958eb['params']['id']}})['then'](handleEntityNotFound(_0x497049,null))[_0x0c09('0x26')](saveUpdates(_0x958eb['body'],null))['then'](respondWithResult(_0x497049,null))['catch'](handleError(_0x497049,null));};exports[_0x0c09('0x27')]=function(_0x4f8a75,_0x507ee5){return db[_0x0c09('0x2e')][_0x0c09('0x4c')]({'where':{'id':_0x4f8a75[_0x0c09('0x4a')]['id']}})[_0x0c09('0x26')](handleEntityNotFound(_0x507ee5,null))[_0x0c09('0x26')](removeEntity(_0x507ee5,null))[_0x0c09('0x48')](handleError(_0x507ee5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5ba1f82..94fe994 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 _0x4d15=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x543491,_0x1197dc){var _0x4410b5=function(_0x432503){while(--_0x432503){_0x543491['push'](_0x543491['shift']());}};_0x4410b5(++_0x1197dc);}(_0x4d15,0x1f1));var _0x54d1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4d15[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x54d1('0x0'));var util=require('util');var logger=require(_0x54d1('0x1'))(_0x54d1('0x2'));var moment=require('moment');var BPromise=require(_0x54d1('0x3'));var rp=require(_0x54d1('0x4'));var fs=require('fs');var path=require(_0x54d1('0x5'));var rimraf=require(_0x54d1('0x6'));var config=require(_0x54d1('0x7'));var attributes=require(_0x54d1('0x8'));module[_0x54d1('0x9')]=function(_0x197724,_0x52bf83){return _0x197724[_0x54d1('0xa')](_0x54d1('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x54d1('0xc'),'collate':_0x54d1('0xd')});}; \ No newline at end of file +var _0xd9c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd9c8[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var logger=require('../../config/logger')(_0x8d9c('0x2'));var moment=require(_0x8d9c('0x3'));var BPromise=require(_0x8d9c('0x4'));var rp=require(_0x8d9c('0x5'));var fs=require('fs');var path=require(_0x8d9c('0x6'));var rimraf=require(_0x8d9c('0x7'));var config=require(_0x8d9c('0x8'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x53567f,_0x2c083c){return _0x53567f[_0x8d9c('0x9')](_0x8d9c('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d9c('0xb'),'collate':_0x8d9c('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 0c9f32f..8865b5e 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 _0x57ef=['SmsApplication,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x95302,_0x29b30e){var _0x926f07=function(_0x2d7d4a){while(--_0x2d7d4a){_0x95302['push'](_0x95302['shift']());}};_0x926f07(++_0x29b30e);}(_0x57ef,0xdb));var _0xf57e=function(_0x3cba0b,_0x43b35d){_0x3cba0b=_0x3cba0b-0x0;var _0x3db7f2=_0x57ef[_0x3cba0b];return _0x3db7f2;};'use strict';var _=require('lodash');var util=require(_0xf57e('0x0'));var moment=require(_0xf57e('0x1'));var BPromise=require(_0xf57e('0x2'));var rs=require(_0xf57e('0x3'));var fs=require('fs');var Redis=require(_0xf57e('0x4'));var db=require(_0xf57e('0x5'))['db'];var utils=require(_0xf57e('0x6'));var logger=require('../../config/logger')(_0xf57e('0x7'));var config=require(_0xf57e('0x8'));var jayson=require(_0xf57e('0x9'));var client=jayson[_0xf57e('0xa')][_0xf57e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f47b5,_0x2498c5,_0x29ad0f){return new BPromise(function(_0x48031b,_0x2c69e6){return client[_0xf57e('0xc')](_0x2f47b5,_0x29ad0f)[_0xf57e('0xd')](function(_0x2430b1){logger[_0xf57e('0xe')]('SmsApplication,\x20%s,\x20%s',_0x2498c5,_0xf57e('0xf'));logger[_0xf57e('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2498c5,_0xf57e('0xf'),JSON[_0xf57e('0x11')](_0x2430b1));if(_0x2430b1[_0xf57e('0x12')]){if(_0x2430b1[_0xf57e('0x12')][_0xf57e('0x13')]===0x1f4){logger[_0xf57e('0x12')]('SmsApplication,\x20%s,\x20%s',_0x2498c5,_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);return _0x2c69e6(_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);}logger[_0xf57e('0x12')](_0xf57e('0x15'),_0x2498c5,_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);return _0x48031b(_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);}else{logger[_0xf57e('0xe')](_0xf57e('0x15'),_0x2498c5,_0xf57e('0xf'));_0x48031b(_0x2430b1[_0xf57e('0x16')][_0xf57e('0x14')]);}})[_0xf57e('0x17')](function(_0x464d53){logger[_0xf57e('0x12')](_0xf57e('0x15'),_0x2498c5,_0x464d53);_0x2c69e6(_0x464d53);});});} \ No newline at end of file +var _0x9563=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9563,0x1e7));var _0x3956=function(_0xdbb433,_0x1293d7){_0xdbb433=_0xdbb433-0x0;var _0x941fb6=_0x9563[_0xdbb433];return _0x941fb6;};'use strict';var _=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var moment=require('moment');var BPromise=require(_0x3956('0x2'));var rs=require(_0x3956('0x3'));var fs=require('fs');var Redis=require(_0x3956('0x4'));var db=require(_0x3956('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3956('0x6'));var config=require('../../config/environment');var jayson=require(_0x3956('0x7'));var client=jayson[_0x3956('0x8')][_0x3956('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xba3e4b,_0x47bdbc,_0x234e06){return new BPromise(function(_0xf1e100,_0x2863cd){return client[_0x3956('0xa')](_0xba3e4b,_0x234e06)[_0x3956('0xb')](function(_0x4dd27f){logger['info'](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));logger[_0x3956('0xe')](_0x3956('0xf'),_0x47bdbc,'request\x20sent',JSON[_0x3956('0x10')](_0x4dd27f));if(_0x4dd27f[_0x3956('0x11')]){if(_0x4dd27f[_0x3956('0x11')][_0x3956('0x12')]===0x1f4){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0x2863cd(_0x4dd27f[_0x3956('0x11')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0xf1e100(_0x4dd27f['error'][_0x3956('0x13')]);}else{logger[_0x3956('0x14')](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));_0xf1e100(_0x4dd27f[_0x3956('0x15')][_0x3956('0x13')]);}})[_0x3956('0x16')](function(_0x458b4a){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x458b4a);_0x2863cd(_0x458b4a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9bf0c17..bf37bfc 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','sms','addTags','put','tracked','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','express'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x27e9a0,_0x39d0db){_0x27e9a0=_0x27e9a0-0x0;var _0x143e82=_0xdd4f[_0x27e9a0];return _0x143e82;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./smsInteraction.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x11')](_0xfdd4('0xd'),auth[_0xfdd4('0x7')](),controller['addMessage']);router[_0xfdd4('0x11')](_0xfdd4('0x13'),auth[_0xfdd4('0x7')](),interaction['tracked'](_0xfdd4('0x14'),'smsinteraction:addtags'),controller[_0xfdd4('0x15')]);router[_0xfdd4('0x16')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')]('sms','smsinteraction:update'),controller['update']);router[_0xfdd4('0x18')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')](_0xfdd4('0x14'),_0xfdd4('0x19')),controller[_0xfdd4('0x1a')]);router[_0xfdd4('0x18')](_0xfdd4('0x13'),auth['isAuthenticated'](),controller[_0xfdd4('0x1b')]);module[_0xfdd4('0x1c')]=router; \ No newline at end of file +var _0x4024=['addTags','put','smsinteraction:update','update','delete','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x4024,0x89));var _0x4402=function(_0x190e48,_0x2110c2){_0x190e48=_0x190e48-0x0;var _0x58e588=_0x4024[_0x190e48];return _0x58e588;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/describe',auth[_0x4402('0x7')](),controller['describe']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4402('0x9')]('/:id/messages',auth[_0x4402('0x7')](),controller['getMessages']);router[_0x4402('0x9')]('/:id/download',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xc')]);router[_0x4402('0xd')]('/:id/messages',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xd')](_0x4402('0xf'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x12')),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')](_0x4402('0x11'),_0x4402('0x15')),controller[_0x4402('0x16')]);router[_0x4402('0x17')](_0x4402('0xa'),auth[_0x4402('0x7')](),interaction[_0x4402('0x10')]('sms','smsinteraction:destroy'),controller[_0x4402('0x18')]);router[_0x4402('0x17')]('/:id/tags',auth[_0x4402('0x7')](),controller[_0x4402('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f21da27..6d57ecd 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 _0x49db=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x1f196d,_0x5c84af){var _0x5c271d=function(_0x22c036){while(--_0x22c036){_0x1f196d['push'](_0x1f196d['shift']());}};_0x5c271d(++_0x5c84af);}(_0x49db,0xc5));var _0xb49d=function(_0x342959,_0x2a3eb1){_0x342959=_0x342959-0x0;var _0x27dc43=_0x49db[_0x342959];return _0x27dc43;};'use strict';var Sequelize=require(_0xb49d('0x0'));var moment=require(_0xb49d('0x1'));module[_0xb49d('0x2')]={'closed':{'type':Sequelize[_0xb49d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb49d('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb49d('0x5')]},'thirdDisposition':{'type':Sequelize[_0xb49d('0x5')]},'note':{'type':Sequelize[_0xb49d('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb49d('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb49d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb49d('0x6')]('in',_0xb49d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb49d('0x8')]}}; \ No newline at end of file +var _0x0972=['out','INTEGER','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x11f1b6,_0xe0b177){var _0x44071b=function(_0x5c5624){while(--_0x5c5624){_0x11f1b6['push'](_0x11f1b6['shift']());}};_0x44071b(++_0xe0b177);}(_0x0972,0x64));var _0x2097=function(_0x5a3ecd,_0x3983dd){_0x5a3ecd=_0x5a3ecd-0x0;var _0xe7de76=_0x0972[_0x5a3ecd];return _0xe7de76;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2097('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2097('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2097('0x2')]},'secondDisposition':{'type':Sequelize[_0x2097('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2097('0x2')]},'phone':{'type':Sequelize[_0x2097('0x2')]},'read1stAt':{'type':Sequelize[_0x2097('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2097('0x4')]('in',_0x2097('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2097('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2097('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2097('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2097('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index be04764..4c61aa2 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 _0x8e6a=['System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','undefined','count','offset','limit','set','Content-Range','json','update','then','error','stack','name','send','index','SmsInteraction','rawAttributes','type','key','getOptions','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','merge','create','body','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','nolimit','order','sort','pick','where','SmsInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','smsInteractionTags:save','removeTags','download','toString','join','root','server','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','createdAt','closed','closedAt','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8e6a,0x85));var _0xa8e6=function(_0x11916d,_0x477d6b){_0x11916d=_0x11916d-0x0;var _0x4393ce=_0x8e6a[_0x11916d];return _0x4393ce;};'use strict';var rimraf=require(_0xa8e6('0x0'));var zipdir=require(_0xa8e6('0x1'));var moment=require('moment');var BPromise=require(_0xa8e6('0x2'));var util=require('util');var path=require(_0xa8e6('0x3'));var ejs=require(_0xa8e6('0x4'));var fs=require('fs');var _=require(_0xa8e6('0x5'));var Redis=require(_0xa8e6('0x6'));var interaction=require(_0xa8e6('0x7'));var qs=require(_0xa8e6('0x8'));var pdf=require(_0xa8e6('0x9'));var logger=require('../../config/logger')(_0xa8e6('0xa'));var config=require(_0xa8e6('0xb'));var db=require(_0xa8e6('0xc'))['db'];config['redis']=_[_0xa8e6('0xd')](config[_0xa8e6('0xe')],{'host':_0xa8e6('0xf'),'port':0x18eb});var socket=require(_0xa8e6('0x10'))(new Redis(config[_0xa8e6('0xe')]));require('./smsInteraction.socket')[_0xa8e6('0x11')](socket);function respondWithStatusCode(_0x313e57,_0x4bfc31){_0x4bfc31=_0x4bfc31||0xcc;return function(_0x5e9b5a){if(_0x5e9b5a){return _0x313e57[_0xa8e6('0x12')](_0x4bfc31);}return _0x313e57['status'](_0x4bfc31)[_0xa8e6('0x13')]();};}function respondWithResult(_0x546db3,_0x53f8c0){_0x53f8c0=_0x53f8c0||0xc8;return function(_0x488c62){if(_0x488c62){return _0x546db3['status'](_0x53f8c0)['json'](_0x488c62);}};}function respondWithFilteredResult(_0x3fbf4c,_0x22d018){return function(_0x287721){if(_0x287721){var _0x2bafdd=typeof _0x22d018['offset']===_0xa8e6('0x14')&&typeof _0x22d018['limit']==='undefined';var _0x51afc1=_0x287721[_0xa8e6('0x15')];var _0x29398e=_0x2bafdd?0x0:_0x22d018[_0xa8e6('0x16')];var _0x1891b0=_0x2bafdd?_0x287721['count']:_0x22d018[_0xa8e6('0x16')]+_0x22d018[_0xa8e6('0x17')];var _0x3d1cb1;if(_0x1891b0>=_0x51afc1){_0x1891b0=_0x51afc1;_0x3d1cb1=0xc8;}else{_0x3d1cb1=0xce;}_0x3fbf4c['status'](_0x3d1cb1);return _0x3fbf4c[_0xa8e6('0x18')](_0xa8e6('0x19'),_0x29398e+'-'+_0x1891b0+'/'+_0x51afc1)[_0xa8e6('0x1a')](_0x287721);}return null;};}function saveUpdates(_0x13be6e){return function(_0x22965e){if(_0x22965e){return _0x22965e[_0xa8e6('0x1b')](_0x13be6e)['then'](function(_0x3fbabe){return _0x3fbabe;});}return null;};}function removeEntity(_0x2ff401){return function(_0x35529d){if(_0x35529d){return _0x35529d['destroy']()[_0xa8e6('0x1c')](function(){_0x2ff401['status'](0xcc)[_0xa8e6('0x13')]();});}};}function handleEntityNotFound(_0x10846c){return function(_0x24a1bc){if(!_0x24a1bc){_0x10846c[_0xa8e6('0x12')](0x194);}return _0x24a1bc;};}function handleError(_0x7ae4fa,_0x30ab28){_0x30ab28=_0x30ab28||0x1f4;return function(_0x17331d){logger[_0xa8e6('0x1d')](_0x17331d[_0xa8e6('0x1e')]);if(_0x17331d[_0xa8e6('0x1f')]){delete _0x17331d[_0xa8e6('0x1f')];}_0x7ae4fa['status'](_0x30ab28)[_0xa8e6('0x20')](_0x17331d);};}exports[_0xa8e6('0x21')]=function(_0x1dc450,_0x48e7c9){var _0x2c4a74={};var _0x3fe160=_['map'](db[_0xa8e6('0x22')][_0xa8e6('0x23')],function(_0x5903c9){return{'name':_0x5903c9['fieldName'],'type':_0x5903c9[_0xa8e6('0x24')][_0xa8e6('0x25')]};});_0x2c4a74=qs[_0xa8e6('0x26')](_0x3fe160,_0x1dc450);return interaction['findAll'](_0xa8e6('0x27'),_0x1dc450[_0xa8e6('0x28')],_0x1dc450[_0xa8e6('0x29')],_0x2c4a74,_0x3fe160)[_0xa8e6('0x1c')](respondWithFilteredResult(_0x48e7c9,_0x2c4a74))[_0xa8e6('0x2a')](handleError(_0x48e7c9,null));};exports[_0xa8e6('0x2b')]=function(_0x2e92df,_0x4e2de1){var _0x5c299c={'raw':![],'where':{'id':_0x2e92df[_0xa8e6('0x2c')]['id']}},_0x350a21={};_0x350a21[_0xa8e6('0x2d')]=_[_0xa8e6('0x2e')](db[_0xa8e6('0x22')]['rawAttributes']);_0x350a21[_0xa8e6('0x28')]=_[_0xa8e6('0x2e')](_0x2e92df[_0xa8e6('0x28')]);_0x350a21[_0xa8e6('0x2f')]=_[_0xa8e6('0x30')](_0x350a21[_0xa8e6('0x2d')],_0x350a21['query']);_0x5c299c[_0xa8e6('0x31')]=_[_0xa8e6('0x30')](_0x350a21[_0xa8e6('0x2d')],qs[_0xa8e6('0x32')](_0x2e92df[_0xa8e6('0x28')][_0xa8e6('0x32')]));_0x5c299c[_0xa8e6('0x31')]=_0x5c299c['attributes'][_0xa8e6('0x33')]?_0x5c299c['attributes']:_0x350a21['model'];if(_0x2e92df[_0xa8e6('0x28')]['includeAll']){_0x5c299c[_0xa8e6('0x34')]=[{'all':!![]}];}_0x5c299c=_[_0xa8e6('0x35')]({},_0x5c299c,_0x2e92df['options']);return db['SmsInteraction']['find'](_0x5c299c)[_0xa8e6('0x1c')](handleEntityNotFound(_0x4e2de1,null))[_0xa8e6('0x1c')](respondWithResult(_0x4e2de1,null))[_0xa8e6('0x2a')](handleError(_0x4e2de1,null));};exports[_0xa8e6('0x36')]=function(_0x54d02f,_0x33d1f2){return db['SmsInteraction'][_0xa8e6('0x36')](_0x54d02f[_0xa8e6('0x37')],{})[_0xa8e6('0x1c')](respondWithResult(_0x33d1f2,0xc9))['catch'](handleError(_0x33d1f2,null));};exports[_0xa8e6('0x1b')]=function(_0x103c58,_0x2ef461){if(_0x103c58['body']['id']){delete _0x103c58[_0xa8e6('0x37')]['id'];}return db['SmsInteraction'][_0xa8e6('0x38')]({'where':{'id':_0x103c58[_0xa8e6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2ef461,null))[_0xa8e6('0x1c')](saveUpdates(_0x103c58[_0xa8e6('0x37')],null))[_0xa8e6('0x1c')](respondWithResult(_0x2ef461,null))[_0xa8e6('0x2a')](handleError(_0x2ef461,null));};exports[_0xa8e6('0x39')]=function(_0x18d427,_0x35b633){return db[_0xa8e6('0x22')][_0xa8e6('0x38')]({'where':{'id':_0x18d427[_0xa8e6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x35b633,null))[_0xa8e6('0x1c')](removeEntity(_0x35b633,null))[_0xa8e6('0x2a')](handleError(_0x35b633,null));};exports[_0xa8e6('0x3a')]=function(_0x4d062b,_0x2ed295){return db[_0xa8e6('0x22')][_0xa8e6('0x3a')]()['then'](respondWithResult(_0x2ed295,null))[_0xa8e6('0x2a')](handleError(_0x2ed295,null));};exports[_0xa8e6('0x3b')]=function(_0x5c9995,_0x468567){return db['SmsMessage'][_0xa8e6('0x38')]({'where':{'id':_0x5c9995['params']['id']}})[_0xa8e6('0x1c')](handleEntityNotFound(_0x468567,null))['then'](function(_0x1777ed){if(_0x1777ed){return _0x1777ed[_0xa8e6('0x3b')](_0x5c9995['body'][_0xa8e6('0x3c')],_[_0xa8e6('0x3d')](_0x5c9995['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x468567,null))['catch'](handleError(_0x468567,null));};exports[_0xa8e6('0x3e')]=function(_0x23e367,_0x5a8e6c){var _0x3b9749={'raw':![],'where':{}};var _0x141340={};var _0x3f070b={'count':0x0,'rows':[]};return db[_0xa8e6('0x22')][_0xa8e6('0x3f')]({'where':{'id':_0x23e367['params']['id']}})[_0xa8e6('0x1c')](handleEntityNotFound(_0x5a8e6c,null))['then'](function(_0x31c703){if(_0x31c703){_0x141340[_0xa8e6('0x2d')]=_[_0xa8e6('0x2e')](db[_0xa8e6('0x40')][_0xa8e6('0x23')]);_0x141340[_0xa8e6('0x28')]=_[_0xa8e6('0x2e')](_0x23e367[_0xa8e6('0x28')]);_0x141340[_0xa8e6('0x2f')]=_[_0xa8e6('0x30')](_0x141340['model'],_0x141340[_0xa8e6('0x28')]);_0x3b9749[_0xa8e6('0x31')]=_['intersection'](_0x141340['model'],qs[_0xa8e6('0x32')](_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x32')]));_0x3b9749[_0xa8e6('0x31')]=_0x3b9749[_0xa8e6('0x31')][_0xa8e6('0x33')]?_0x3b9749[_0xa8e6('0x31')]:_0x141340[_0xa8e6('0x2d')];if(!_0x23e367[_0xa8e6('0x28')]['hasOwnProperty'](_0xa8e6('0x41'))){_0x3b9749[_0xa8e6('0x17')]=qs[_0xa8e6('0x17')](_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x17')]);_0x3b9749['offset']=qs[_0xa8e6('0x16')](_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x16')]);}_0x3b9749[_0xa8e6('0x42')]=qs['sort'](_0x23e367['query'][_0xa8e6('0x43')]);_0x3b9749['where']=qs['filters'](_[_0xa8e6('0x44')](_0x23e367[_0xa8e6('0x28')],_0x141340[_0xa8e6('0x2f')]));_0x3b9749[_0xa8e6('0x45')][_0xa8e6('0x46')]=_0x31c703['id'];if(_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x47')]){_0x3b9749[_0xa8e6('0x45')]=_['merge'](_0x3b9749[_0xa8e6('0x45')],{'$or':_[_0xa8e6('0x48')](_0x3b9749[_0xa8e6('0x31')],function(_0x550d45){var _0x26bf31={};_0x26bf31[_0x550d45]={'$like':'%'+_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x47')]+'%'};return _0x26bf31;})});}if(_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x49')]){var _0x1a4d39=_0x23e367[_0xa8e6('0x28')][_0xa8e6('0x49')][_0xa8e6('0x4a')](',');var _0x372ab8={};_0x372ab8[_0x1a4d39[0x0]]={'$gte':moment(_0x1a4d39[0x1])['format'](_0xa8e6('0x4b'))};_0x3b9749[_0xa8e6('0x45')]=_[_0xa8e6('0x35')](_0x3b9749[_0xa8e6('0x45')],_0x372ab8);}_0x3b9749=_[_0xa8e6('0x35')]({},_0x3b9749,_0x23e367['options']);return db[_0xa8e6('0x40')][_0xa8e6('0x15')]({'where':_0x3b9749[_0xa8e6('0x45')]})['then'](function(_0x4179d3){_0x3f070b['count']=_0x4179d3;if(_0x23e367[_0xa8e6('0x28')]['includeAll']){_0x3b9749['include']=[{'all':!![]}];}return db[_0xa8e6('0x40')][_0xa8e6('0x4c')](_0x3b9749);})[_0xa8e6('0x1c')](function(_0x1353ab){_0x3f070b[_0xa8e6('0x4d')]=_0x1353ab;return _0x3f070b;});}})[_0xa8e6('0x1c')](respondWithFilteredResult(_0x5a8e6c,_0x3b9749))[_0xa8e6('0x2a')](handleError(_0x5a8e6c,null));};exports[_0xa8e6('0x4e')]=function(_0x191b16,_0x942343){return db['SmsInteraction'][_0xa8e6('0x38')]({'where':{'id':_0x191b16[_0xa8e6('0x2c')]['id']}})[_0xa8e6('0x1c')](handleEntityNotFound(_0x942343,null))[_0xa8e6('0x1c')](function(_0x2161e9){if(_0x2161e9){return _0x2161e9[_0xa8e6('0x4f')](_0x191b16[_0xa8e6('0x37')][_0xa8e6('0x3c')],_['omit'](_0x191b16[_0xa8e6('0x37')],[_0xa8e6('0x3c'),'id'])||{})['spread'](function(){return db['Tag'][_0xa8e6('0x4c')]({'attributes':['id','name',_0xa8e6('0x50')],'where':{'id':_0x191b16[_0xa8e6('0x37')][_0xa8e6('0x3c')]}});})[_0xa8e6('0x1c')](function(_0x513448){socket['emit'](_0xa8e6('0x51'),{'id':Number(_0x191b16[_0xa8e6('0x2c')]['id']),'tags':_0x513448||[]});return{'id':Number(_0x191b16[_0xa8e6('0x2c')]['id']),'tags':_0x513448||[]};});}})[_0xa8e6('0x1c')](respondWithResult(_0x942343,null))[_0xa8e6('0x2a')](handleError(_0x942343,null));};exports[_0xa8e6('0x52')]=function(_0x591075,_0x3d8fe5){return db[_0xa8e6('0x22')][_0xa8e6('0x38')]({'where':{'id':_0x591075['params']['id']}})['then'](handleEntityNotFound(_0x3d8fe5,null))[_0xa8e6('0x1c')](function(_0x534dd1){if(_0x534dd1){return _0x534dd1[_0xa8e6('0x52')](_0x591075[_0xa8e6('0x28')][_0xa8e6('0x3c')]);}})[_0xa8e6('0x1c')](respondWithStatusCode(_0x3d8fe5,null))['catch'](handleError(_0x3d8fe5,null));};exports[_0xa8e6('0x53')]=function(_0x1259ac,_0xccbd53){var _0x66f36e=moment()['unix']()[_0xa8e6('0x54')]();var _0x45821d=path[_0xa8e6('0x55')](config[_0xa8e6('0x56')],_0xa8e6('0x57'),'files','tmp');var _0x3d6f01=path[_0xa8e6('0x55')](_0x45821d,_0x66f36e);var _0x160734=util[_0xa8e6('0x58')](_0xa8e6('0x59'),_0x1259ac['params']['id'],_0x66f36e);var _0x5bf199=path[_0xa8e6('0x55')](_0x45821d,_0x160734);var _0x5d3182=[];_0x5d3182[_0xa8e6('0x5a')]({'model':db[_0xa8e6('0x5b')],'as':_0xa8e6('0x5b'),'attributes':['id',_0xa8e6('0x5c')],'raw':!![]});_0x5d3182['push']({'model':db[_0xa8e6('0x5d')],'as':_0xa8e6('0x5e'),'attributes':['id','firstName',_0xa8e6('0x5f')],'raw':!![]});var _0x2bbfb1=[{'model':db[_0xa8e6('0x40')],'as':_0xa8e6('0x60'),'attributes':['id',_0xa8e6('0x37'),'createdAt',_0xa8e6('0x61'),_0xa8e6('0x62'),'read'],'include':_0x5d3182}];_0x2bbfb1[_0xa8e6('0x5a')]({'model':db[_0xa8e6('0x63')],'as':_0xa8e6('0x64'),'attributes':['id','name']});_0x2bbfb1[_0xa8e6('0x5a')]({'model':db[_0xa8e6('0x5b')],'as':_0xa8e6('0x65'),'attributes':['id',_0xa8e6('0x5c')]});return db['SmsInteraction'][_0xa8e6('0x38')]({'where':{'id':_0x1259ac[_0xa8e6('0x2c')]['id']},'include':_0x2bbfb1})['then'](handleEntityNotFound(_0xccbd53,null))[_0xa8e6('0x1c')](function(_0x4ceb23){if(_0x4ceb23){var _0x171131=_0x4ceb23[_0xa8e6('0x66')]({'plain':!![]});fs['mkdirSync'](_0x3d6f01);var _0xa7b03b={'channel':_0xa8e6('0x67'),'account':_0x171131[_0xa8e6('0x64')][_0xa8e6('0x1f')],'agent':_0x171131['Owner']?_0x171131[_0xa8e6('0x65')]['fullname']:_0xa8e6('0x68'),'createdAt':moment(_0x171131[_0xa8e6('0x69')])['format'](_0xa8e6('0x4b'))['toString'](),'closedAt':_0x171131[_0xa8e6('0x6a')]?moment(_0x171131[_0xa8e6('0x6b')])[_0xa8e6('0x58')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x171131['disposition'],'messages':_(_0x171131['Messages'])[_0xa8e6('0x47')]({'secret':![]})[_0xa8e6('0x48')](function(_0x58d653){return{'date':moment(_0x58d653['createdAt'])[_0xa8e6('0x58')](_0xa8e6('0x4b'))[_0xa8e6('0x54')](),'sender':_0x58d653['direction']===_0xa8e6('0x6c')?_0x58d653[_0xa8e6('0x5b')]?_0x58d653[_0xa8e6('0x5b')][_0xa8e6('0x5c')]:_0xa8e6('0x6d'):_0x58d653[_0xa8e6('0x5e')]['firstName']+(_0x58d653[_0xa8e6('0x5e')]['lastName']?'\x20'+_0x58d653[_0xa8e6('0x5e')]['lastName']:''),'body':_0x58d653[_0xa8e6('0x37')],'direction':_0x58d653[_0xa8e6('0x61')]==='out'?'A':'C','secret':_0x58d653['secret'],'read':_0x58d653[_0xa8e6('0x6e')]};})[_0xa8e6('0x6f')]()};return ejs[_0xa8e6('0x70')](path['join'](config[_0xa8e6('0x56')],_0xa8e6('0x57'),_0xa8e6('0x71'),_0xa8e6('0x72')),{'interaction':_0xa7b03b})[_0xa8e6('0x1c')](function(_0x2291c1){var _0x971dfc=path[_0xa8e6('0x55')](_0x3d6f01,_0xa8e6('0x73')+_0x171131['id']+'-'+_0x66f36e+_0xa8e6('0x74'));var _0x3dac31={'path':_0x971dfc,'channel':_0xa8e6('0x67'),'interactionId':_0x171131['id']};return pdf[_0xa8e6('0x75')](_0x2291c1,_0x3dac31);})[_0xa8e6('0x1c')](function(){return new BPromise(function(_0x192282,_0x5f36d6){zipdir(_0x3d6f01,{'saveTo':_0x5bf199},function(_0x43616c,_0x2ecc28){if(_0x43616c)return _0x5f36d6(_0x43616c);return _0x192282(_0x2ecc28);});})[_0xa8e6('0x1c')](function(){return new BPromise(function(_0x63fcc2,_0xf8b345){rimraf(_0x3d6f01,function(_0x4d1629){if(_0x4d1629)_0xf8b345(_0x4d1629);return _0x63fcc2();});});})[_0xa8e6('0x1c')](function(){return _0xccbd53[_0xa8e6('0x53')](_0x5bf199,_0x160734,function(_0x3796fc){if(_0x3796fc){console[_0xa8e6('0x76')](_0xa8e6('0x77'),_0x3796fc);}else{fs[_0xa8e6('0x78')](_0x5bf199);}});});});}else{return _0xccbd53[_0xa8e6('0x12')](0xc8);}})[_0xa8e6('0x2a')](handleError(_0xccbd53,null));}; \ No newline at end of file +var _0x0886=['../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','update','destroy','then','error','stack','name','send','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','catch','model','keys','filters','intersection','fields','attributes','includeAll','include','merge','find','create','body','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','secret','read','SmsAccount','Account','Owner','Sms','N.A.','createdAt','format','closed','out','direction','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/parsers/qs'];(function(_0x17791a,_0x5598fa){var _0x11a666=function(_0x218b34){while(--_0x218b34){_0x17791a['push'](_0x17791a['shift']());}};_0x11a666(++_0x5598fa);}(_0x0886,0x1bf));var _0x6088=function(_0x43a196,_0x433c1f){_0x43a196=_0x43a196-0x0;var _0x55eb1a=_0x0886[_0x43a196];return _0x55eb1a;};'use strict';var rimraf=require(_0x6088('0x0'));var zipdir=require(_0x6088('0x1'));var moment=require(_0x6088('0x2'));var BPromise=require(_0x6088('0x3'));var util=require(_0x6088('0x4'));var path=require(_0x6088('0x5'));var ejs=require(_0x6088('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6088('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x6088('0x8'));var pdf=require(_0x6088('0x9'));var logger=require(_0x6088('0xa'))(_0x6088('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x6088('0xc')]=_[_0x6088('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6088('0xe'))(new Redis(config[_0x6088('0xc')]));require(_0x6088('0xf'))[_0x6088('0x10')](socket);function respondWithStatusCode(_0x329435,_0x11daca){_0x11daca=_0x11daca||0xcc;return function(_0x45da28){if(_0x45da28){return _0x329435[_0x6088('0x11')](_0x11daca);}return _0x329435[_0x6088('0x12')](_0x11daca)[_0x6088('0x13')]();};}function respondWithResult(_0x3d7829,_0x245d2c){_0x245d2c=_0x245d2c||0xc8;return function(_0x195b2f){if(_0x195b2f){return _0x3d7829[_0x6088('0x12')](_0x245d2c)['json'](_0x195b2f);}};}function respondWithFilteredResult(_0x553188,_0x43deac){return function(_0x3088aa){if(_0x3088aa){var _0x1a78c8=typeof _0x43deac[_0x6088('0x14')]===_0x6088('0x15')&&typeof _0x43deac[_0x6088('0x16')]===_0x6088('0x15');var _0x4439ca=_0x3088aa[_0x6088('0x17')];var _0x7485b7=_0x1a78c8?0x0:_0x43deac['offset'];var _0x4be23a=_0x1a78c8?_0x3088aa['count']:_0x43deac[_0x6088('0x14')]+_0x43deac[_0x6088('0x16')];var _0x163b01;if(_0x4be23a>=_0x4439ca){_0x4be23a=_0x4439ca;_0x163b01=0xc8;}else{_0x163b01=0xce;}_0x553188[_0x6088('0x12')](_0x163b01);return _0x553188[_0x6088('0x18')]('Content-Range',_0x7485b7+'-'+_0x4be23a+'/'+_0x4439ca)['json'](_0x3088aa);}return null;};}function saveUpdates(_0xb34540){return function(_0x357845){if(_0x357845){return _0x357845[_0x6088('0x19')](_0xb34540)['then'](function(_0x5a1781){return _0x5a1781;});}return null;};}function removeEntity(_0x1ad3a7){return function(_0x4b51e1){if(_0x4b51e1){return _0x4b51e1[_0x6088('0x1a')]()[_0x6088('0x1b')](function(){_0x1ad3a7[_0x6088('0x12')](0xcc)[_0x6088('0x13')]();});}};}function handleEntityNotFound(_0x5ae492){return function(_0x23fe16){if(!_0x23fe16){_0x5ae492[_0x6088('0x11')](0x194);}return _0x23fe16;};}function handleError(_0x427094,_0x5e4f6e){_0x5e4f6e=_0x5e4f6e||0x1f4;return function(_0x26ccb7){logger[_0x6088('0x1c')](_0x26ccb7[_0x6088('0x1d')]);if(_0x26ccb7[_0x6088('0x1e')]){delete _0x26ccb7[_0x6088('0x1e')];}_0x427094[_0x6088('0x12')](_0x5e4f6e)[_0x6088('0x1f')](_0x26ccb7);};}exports['index']=function(_0x6a868a,_0x313c34){var _0x2af282={};var _0x49ada0=_[_0x6088('0x20')](db[_0x6088('0x21')][_0x6088('0x22')],function(_0x27f693){return{'name':_0x27f693[_0x6088('0x23')],'type':_0x27f693[_0x6088('0x24')][_0x6088('0x25')]};});_0x2af282=qs['getOptions'](_0x49ada0,_0x6a868a);return interaction[_0x6088('0x26')](_0x6088('0x27'),_0x6a868a[_0x6088('0x28')],_0x6a868a['user'],_0x2af282,_0x49ada0)[_0x6088('0x1b')](respondWithFilteredResult(_0x313c34,_0x2af282))[_0x6088('0x29')](handleError(_0x313c34,null));};exports['show']=function(_0x4d9420,_0x4ea998){var _0x572c21={'raw':![],'where':{'id':_0x4d9420['params']['id']}},_0x48fba8={};_0x48fba8[_0x6088('0x2a')]=_[_0x6088('0x2b')](db['SmsInteraction'][_0x6088('0x22')]);_0x48fba8[_0x6088('0x28')]=_[_0x6088('0x2b')](_0x4d9420[_0x6088('0x28')]);_0x48fba8[_0x6088('0x2c')]=_[_0x6088('0x2d')](_0x48fba8[_0x6088('0x2a')],_0x48fba8[_0x6088('0x28')]);_0x572c21['attributes']=_[_0x6088('0x2d')](_0x48fba8[_0x6088('0x2a')],qs[_0x6088('0x2e')](_0x4d9420[_0x6088('0x28')][_0x6088('0x2e')]));_0x572c21['attributes']=_0x572c21[_0x6088('0x2f')]['length']?_0x572c21[_0x6088('0x2f')]:_0x48fba8[_0x6088('0x2a')];if(_0x4d9420[_0x6088('0x28')][_0x6088('0x30')]){_0x572c21[_0x6088('0x31')]=[{'all':!![]}];}_0x572c21=_[_0x6088('0x32')]({},_0x572c21,_0x4d9420['options']);return db['SmsInteraction'][_0x6088('0x33')](_0x572c21)[_0x6088('0x1b')](handleEntityNotFound(_0x4ea998,null))[_0x6088('0x1b')](respondWithResult(_0x4ea998,null))[_0x6088('0x29')](handleError(_0x4ea998,null));};exports[_0x6088('0x34')]=function(_0x3a0fe9,_0x15496b){return db[_0x6088('0x21')][_0x6088('0x34')](_0x3a0fe9[_0x6088('0x35')],{})[_0x6088('0x1b')](respondWithResult(_0x15496b,0xc9))['catch'](handleError(_0x15496b,null));};exports[_0x6088('0x19')]=function(_0x3a5c04,_0x5811e3){if(_0x3a5c04['body']['id']){delete _0x3a5c04[_0x6088('0x35')]['id'];}return db[_0x6088('0x21')][_0x6088('0x33')]({'where':{'id':_0x3a5c04[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x5811e3,null))[_0x6088('0x1b')](saveUpdates(_0x3a5c04[_0x6088('0x35')],null))[_0x6088('0x1b')](respondWithResult(_0x5811e3,null))[_0x6088('0x29')](handleError(_0x5811e3,null));};exports[_0x6088('0x1a')]=function(_0x3a063f,_0x51eddb){return db[_0x6088('0x21')]['find']({'where':{'id':_0x3a063f[_0x6088('0x36')]['id']}})[_0x6088('0x1b')](handleEntityNotFound(_0x51eddb,null))[_0x6088('0x1b')](removeEntity(_0x51eddb,null))[_0x6088('0x29')](handleError(_0x51eddb,null));};exports[_0x6088('0x37')]=function(_0xedde4,_0x2a0547){return db[_0x6088('0x21')][_0x6088('0x37')]()['then'](respondWithResult(_0x2a0547,null))[_0x6088('0x29')](handleError(_0x2a0547,null));};exports[_0x6088('0x38')]=function(_0x53122e,_0x53703f){return db[_0x6088('0x39')][_0x6088('0x33')]({'where':{'id':_0x53122e[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x53703f,null))[_0x6088('0x1b')](function(_0x1951a6){if(_0x1951a6){return _0x1951a6[_0x6088('0x38')](_0x53122e[_0x6088('0x35')][_0x6088('0x3a')],_['omit'](_0x53122e['body'],['ids','id'])||{});}})[_0x6088('0x1b')](respondWithResult(_0x53703f,null))[_0x6088('0x29')](handleError(_0x53703f,null));};exports[_0x6088('0x3b')]=function(_0x4713e4,_0x357aa8){var _0x4eaba2={'raw':![],'where':{}};var _0x22ae2d={};var _0x2aece5={'count':0x0,'rows':[]};return db[_0x6088('0x21')][_0x6088('0x3c')]({'where':{'id':_0x4713e4['params']['id']}})[_0x6088('0x1b')](handleEntityNotFound(_0x357aa8,null))['then'](function(_0x4c5424){if(_0x4c5424){_0x22ae2d[_0x6088('0x2a')]=_['keys'](db[_0x6088('0x39')][_0x6088('0x22')]);_0x22ae2d['query']=_[_0x6088('0x2b')](_0x4713e4['query']);_0x22ae2d[_0x6088('0x2c')]=_[_0x6088('0x2d')](_0x22ae2d[_0x6088('0x2a')],_0x22ae2d[_0x6088('0x28')]);_0x4eaba2['attributes']=_[_0x6088('0x2d')](_0x22ae2d[_0x6088('0x2a')],qs[_0x6088('0x2e')](_0x4713e4[_0x6088('0x28')][_0x6088('0x2e')]));_0x4eaba2[_0x6088('0x2f')]=_0x4eaba2['attributes'][_0x6088('0x3d')]?_0x4eaba2[_0x6088('0x2f')]:_0x22ae2d[_0x6088('0x2a')];if(!_0x4713e4[_0x6088('0x28')][_0x6088('0x3e')](_0x6088('0x3f'))){_0x4eaba2[_0x6088('0x16')]=qs['limit'](_0x4713e4[_0x6088('0x28')][_0x6088('0x16')]);_0x4eaba2['offset']=qs[_0x6088('0x14')](_0x4713e4[_0x6088('0x28')][_0x6088('0x14')]);}_0x4eaba2[_0x6088('0x40')]=qs['sort'](_0x4713e4[_0x6088('0x28')][_0x6088('0x41')]);_0x4eaba2[_0x6088('0x42')]=qs[_0x6088('0x2c')](_['pick'](_0x4713e4[_0x6088('0x28')],_0x22ae2d['filters']));_0x4eaba2[_0x6088('0x42')][_0x6088('0x43')]=_0x4c5424['id'];if(_0x4713e4[_0x6088('0x28')][_0x6088('0x44')]){_0x4eaba2[_0x6088('0x42')]=_[_0x6088('0x32')](_0x4eaba2[_0x6088('0x42')],{'$or':_[_0x6088('0x20')](_0x4eaba2[_0x6088('0x2f')],function(_0x4aa695){var _0x334e65={};_0x334e65[_0x4aa695]={'$like':'%'+_0x4713e4[_0x6088('0x28')][_0x6088('0x44')]+'%'};return _0x334e65;})});}if(_0x4713e4[_0x6088('0x28')][_0x6088('0x45')]){var _0x3d8626=_0x4713e4[_0x6088('0x28')]['$gte'][_0x6088('0x46')](',');var _0x39eef1={};_0x39eef1[_0x3d8626[0x0]]={'$gte':moment(_0x3d8626[0x1])['format'](_0x6088('0x47'))};_0x4eaba2[_0x6088('0x42')]=_[_0x6088('0x32')](_0x4eaba2[_0x6088('0x42')],_0x39eef1);}_0x4eaba2=_[_0x6088('0x32')]({},_0x4eaba2,_0x4713e4[_0x6088('0x48')]);return db['SmsMessage'][_0x6088('0x17')]({'where':_0x4eaba2[_0x6088('0x42')]})[_0x6088('0x1b')](function(_0x540e17){_0x2aece5[_0x6088('0x17')]=_0x540e17;if(_0x4713e4[_0x6088('0x28')][_0x6088('0x30')]){_0x4eaba2[_0x6088('0x31')]=[{'all':!![]}];}return db[_0x6088('0x39')][_0x6088('0x26')](_0x4eaba2);})['then'](function(_0x285524){_0x2aece5['rows']=_0x285524;return _0x2aece5;});}})[_0x6088('0x1b')](respondWithFilteredResult(_0x357aa8,_0x4eaba2))[_0x6088('0x29')](handleError(_0x357aa8,null));};exports[_0x6088('0x49')]=function(_0x137465,_0x4b0850){return db['SmsInteraction'][_0x6088('0x33')]({'where':{'id':_0x137465[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x4b0850,null))['then'](function(_0x454120){if(_0x454120){return _0x454120[_0x6088('0x4a')](_0x137465[_0x6088('0x35')][_0x6088('0x3a')],_['omit'](_0x137465['body'],[_0x6088('0x3a'),'id'])||{})[_0x6088('0x4b')](function(){return db[_0x6088('0x4c')][_0x6088('0x26')]({'attributes':['id',_0x6088('0x1e'),_0x6088('0x4d')],'where':{'id':_0x137465[_0x6088('0x35')]['ids']}});})['then'](function(_0x2eb88c){socket[_0x6088('0x4e')]('smsInteractionTags:save',{'id':Number(_0x137465[_0x6088('0x36')]['id']),'tags':_0x2eb88c||[]});return{'id':Number(_0x137465[_0x6088('0x36')]['id']),'tags':_0x2eb88c||[]};});}})[_0x6088('0x1b')](respondWithResult(_0x4b0850,null))[_0x6088('0x29')](handleError(_0x4b0850,null));};exports[_0x6088('0x4f')]=function(_0x5412be,_0x1fea25){return db['SmsInteraction'][_0x6088('0x33')]({'where':{'id':_0x5412be[_0x6088('0x36')]['id']}})['then'](handleEntityNotFound(_0x1fea25,null))['then'](function(_0x3aefe6){if(_0x3aefe6){return _0x3aefe6[_0x6088('0x4f')](_0x5412be[_0x6088('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x1fea25,null))[_0x6088('0x29')](handleError(_0x1fea25,null));};exports[_0x6088('0x50')]=function(_0x40653d,_0x500711){var _0x44b3d0=moment()[_0x6088('0x51')]()[_0x6088('0x52')]();var _0x14547e=path[_0x6088('0x53')](config[_0x6088('0x54')],_0x6088('0x55'),_0x6088('0x56'),'tmp');var _0xa020ff=path[_0x6088('0x53')](_0x14547e,_0x44b3d0);var _0x240b35=util['format'](_0x6088('0x57'),_0x40653d[_0x6088('0x36')]['id'],_0x44b3d0);var _0x276d8d=path[_0x6088('0x53')](_0x14547e,_0x240b35);var _0x3a534a=[];_0x3a534a['push']({'model':db[_0x6088('0x58')],'as':_0x6088('0x58'),'attributes':['id',_0x6088('0x59')],'raw':!![]});_0x3a534a[_0x6088('0x5a')]({'model':db[_0x6088('0x5b')],'as':_0x6088('0x5c'),'attributes':['id',_0x6088('0x5d'),_0x6088('0x5e')],'raw':!![]});var _0x53002c=[{'model':db[_0x6088('0x39')],'as':_0x6088('0x5f'),'attributes':['id',_0x6088('0x35'),'createdAt','direction',_0x6088('0x60'),_0x6088('0x61')],'include':_0x3a534a}];_0x53002c[_0x6088('0x5a')]({'model':db[_0x6088('0x62')],'as':_0x6088('0x63'),'attributes':['id',_0x6088('0x1e')]});_0x53002c[_0x6088('0x5a')]({'model':db['User'],'as':_0x6088('0x64'),'attributes':['id',_0x6088('0x59')]});return db['SmsInteraction']['find']({'where':{'id':_0x40653d[_0x6088('0x36')]['id']},'include':_0x53002c})[_0x6088('0x1b')](handleEntityNotFound(_0x500711,null))[_0x6088('0x1b')](function(_0x16f5a9){if(_0x16f5a9){var _0x5b1c23=_0x16f5a9['get']({'plain':!![]});fs['mkdirSync'](_0xa020ff);var _0x48ea4a={'channel':_0x6088('0x65'),'account':_0x5b1c23[_0x6088('0x63')]['name'],'agent':_0x5b1c23[_0x6088('0x64')]?_0x5b1c23['Owner'][_0x6088('0x59')]:_0x6088('0x66'),'createdAt':moment(_0x5b1c23[_0x6088('0x67')])[_0x6088('0x68')](_0x6088('0x47'))['toString'](),'closedAt':_0x5b1c23[_0x6088('0x69')]?moment(_0x5b1c23['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6088('0x52')]():'','disposition':_0x5b1c23['disposition'],'messages':_(_0x5b1c23[_0x6088('0x5f')])[_0x6088('0x44')]({'secret':![]})['map'](function(_0x32edf6){return{'date':moment(_0x32edf6[_0x6088('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6088('0x52')](),'sender':_0x32edf6['direction']===_0x6088('0x6a')?_0x32edf6[_0x6088('0x58')]?_0x32edf6[_0x6088('0x58')][_0x6088('0x59')]:'System':_0x32edf6[_0x6088('0x5c')][_0x6088('0x5d')]+(_0x32edf6['Contact'][_0x6088('0x5e')]?'\x20'+_0x32edf6[_0x6088('0x5c')][_0x6088('0x5e')]:''),'body':_0x32edf6[_0x6088('0x35')],'direction':_0x32edf6[_0x6088('0x6b')]===_0x6088('0x6a')?'A':'C','secret':_0x32edf6[_0x6088('0x60')],'read':_0x32edf6[_0x6088('0x61')]};})['value']()};return ejs[_0x6088('0x6c')](path['join'](config[_0x6088('0x54')],_0x6088('0x55'),_0x6088('0x6d'),_0x6088('0x6e')),{'interaction':_0x48ea4a})[_0x6088('0x1b')](function(_0x56723e){var _0x45eb3c=path['join'](_0xa020ff,'transcript-'+_0x5b1c23['id']+'-'+_0x44b3d0+'.pdf');var _0x27d098={'path':_0x45eb3c,'channel':_0x6088('0x65'),'interactionId':_0x5b1c23['id']};return pdf[_0x6088('0x6f')](_0x56723e,_0x27d098);})['then'](function(){return new BPromise(function(_0xe2e38f,_0x1d9599){zipdir(_0xa020ff,{'saveTo':_0x276d8d},function(_0x371994,_0x3ab106){if(_0x371994)return _0x1d9599(_0x371994);return _0xe2e38f(_0x3ab106);});})[_0x6088('0x1b')](function(){return new BPromise(function(_0x2e8b14,_0x1d661c){rimraf(_0xa020ff,function(_0x18d180){if(_0x18d180)_0x1d661c(_0x18d180);return _0x2e8b14();});});})['then'](function(){return _0x500711[_0x6088('0x50')](_0x276d8d,_0x240b35,function(_0x67585a){if(_0x67585a){console[_0x6088('0x70')](_0x6088('0x71'),_0x67585a);}else{fs['unlinkSync'](_0x276d8d);}});});});}else{return _0x500711['sendStatus'](0xc8);}})['catch'](handleError(_0x500711,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fff78dc..3cf43be 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 _0xcf66=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xcf66,0x71));var _0x6cf6=function(_0x1ba199,_0x1b040a){_0x1ba199=_0x1ba199-0x0;var _0x41b6f8=_0xcf66[_0x1ba199];return _0x41b6f8;};'use strict';var EventEmitter=require(_0x6cf6('0x0'));var SmsInteraction=require(_0x6cf6('0x1'))['db'][_0x6cf6('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x6cf6('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6cf6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6cf6('0x5')};function emitEvent(_0x45d0d8){return function(_0x57f22f,_0x39f1d6,_0x1fbedd){_0x57f22f[_0x6cf6('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x94c6a9){_0x57f22f[_0x6cf6('0x7')](_0x6cf6('0x8'),_0x94c6a9[_0x6cf6('0x9')](function(_0x175b18){return{'id':_0x175b18['id']};}));return SmsMessage[_0x6cf6('0xa')]({'where':{'SmsInteractionId':_0x57f22f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x58378c){_0x57f22f['setDataValue'](_0x6cf6('0xb'),_0x58378c['length']);SmsInteractionEvents[_0x6cf6('0xc')](_0x45d0d8+':'+_0x57f22f['id'],_0x57f22f);SmsInteractionEvents[_0x6cf6('0xc')](_0x45d0d8,_0x57f22f);_0x1fbedd(null);})[_0x6cf6('0xd')](_0x1fbedd(null));};}for(var e in events){if(events[_0x6cf6('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x22209f,_0x13bf3d){var _0x57a462=function(_0x5bb2a4){while(--_0x5bb2a4){_0x22209f['push'](_0x22209f['shift']());}};_0x57a462(++_0x13bf3d);}(_0x02ce,0x1ac));var _0xe02c=function(_0x234b6b,_0x280a78){_0x234b6b=_0x234b6b-0x0;var _0x33d38a=_0x02ce[_0x234b6b];return _0x33d38a;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 38a0b72..e0c368d 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 _0x7c5d=['path','rimraf','../../config/environment','exports','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c5d,0x17b));var _0xd7c5=function(_0x50221b,_0x957894){_0x50221b=_0x50221b-0x0;var _0x10a2cc=_0x7c5d[_0x50221b];return _0x10a2cc;};'use strict';var _=require(_0xd7c5('0x0'));var util=require('util');var logger=require(_0xd7c5('0x1'))(_0xd7c5('0x2'));var moment=require('moment');var BPromise=require(_0xd7c5('0x3'));var rp=require(_0xd7c5('0x4'));var fs=require('fs');var path=require(_0xd7c5('0x5'));var rimraf=require(_0xd7c5('0x6'));var config=require(_0xd7c5('0x7'));var attributes=require('./smsInteraction.attributes');module[_0xd7c5('0x8')]=function(_0x4ebbf9,_0x73880e){return _0x4ebbf9['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3aa2b7,_0x7f4053,_0x5e7304){if(_0x3aa2b7['changed'](_0xd7c5('0x9'))){_0x3aa2b7[_0xd7c5('0xa')]=moment()['format'](_0xd7c5('0xb'));}_0x5e7304(null,_0x3aa2b7);}}});}; \ No newline at end of file +var _0x585a=['path','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4bfab7,_0x1f92fc){var _0x232fd7=function(_0x2fb73c){while(--_0x2fb73c){_0x4bfab7['push'](_0x4bfab7['shift']());}};_0x232fd7(++_0x1f92fc);}(_0x585a,0xaa));var _0xa585=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0x585a[_0x4b0008];return _0x401c96;};'use strict';var _=require(_0xa585('0x0'));var util=require(_0xa585('0x1'));var logger=require('../../config/logger')(_0xa585('0x2'));var moment=require(_0xa585('0x3'));var BPromise=require(_0xa585('0x4'));var rp=require(_0xa585('0x5'));var fs=require('fs');var path=require(_0xa585('0x6'));var rimraf=require('rimraf');var config=require(_0xa585('0x7'));var attributes=require(_0xa585('0x8'));module[_0xa585('0x9')]=function(_0x57d102,_0x598b0b){return _0x57d102['define'](_0xa585('0xa'),attributes,{'tableName':_0xa585('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d748f,_0x2f1bbf,_0x3b1bbc){if(_0x2d748f[_0xa585('0xc')](_0xa585('0xd'))){_0x2d748f[_0xa585('0xe')]=moment()['format'](_0xa585('0xf'));}_0x3b1bbc(null,_0x2d748f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a7f738a..7007227 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 _0x5b2f=['client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','update','body','options','attributes','limit','UpdateSmsInteraction','SmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x963b10,_0x485a31){var _0x1f2314=function(_0xdb5826){while(--_0xdb5826){_0x963b10['push'](_0x963b10['shift']());}};_0x1f2314(++_0x485a31);}(_0x5b2f,0x124));var _0xf5b2=function(_0x3ac34b,_0x278b53){_0x3ac34b=_0x3ac34b-0x0;var _0x3a02a7=_0x5b2f[_0x3ac34b];return _0x3a02a7;};'use strict';var _=require(_0xf5b2('0x0'));var util=require(_0xf5b2('0x1'));var moment=require(_0xf5b2('0x2'));var BPromise=require(_0xf5b2('0x3'));var rs=require(_0xf5b2('0x4'));var fs=require('fs');var Redis=require(_0xf5b2('0x5'));var db=require(_0xf5b2('0x6'))['db'];var utils=require(_0xf5b2('0x7'));var logger=require('../../config/logger')(_0xf5b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5b2('0x9')][_0xf5b2('0xa')]({'port':0x232a});config[_0xf5b2('0xb')]=_[_0xf5b2('0xc')](config[_0xf5b2('0xb')],{'host':_0xf5b2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5b2('0xb')]));require(_0xf5b2('0xe'))[_0xf5b2('0xf')](socket);function respondWithRpcPromise(_0xf0cca5,_0xb9d4be,_0x15b147){return new BPromise(function(_0x487393,_0x11f77f){return client[_0xf5b2('0x10')](_0xf0cca5,_0x15b147)[_0xf5b2('0x11')](function(_0x3d43bf){logger['info'](_0xf5b2('0x12'),_0xb9d4be,'request\x20sent');logger[_0xf5b2('0x13')](_0xf5b2('0x14'),_0xb9d4be,_0xf5b2('0x15'),JSON[_0xf5b2('0x16')](_0x3d43bf));if(_0x3d43bf['error']){if(_0x3d43bf['error'][_0xf5b2('0x17')]===0x1f4){logger['error'](_0xf5b2('0x12'),_0xb9d4be,_0x3d43bf['error'][_0xf5b2('0x18')]);return _0x11f77f(_0x3d43bf[_0xf5b2('0x19')][_0xf5b2('0x18')]);}logger[_0xf5b2('0x19')](_0xf5b2('0x12'),_0xb9d4be,_0x3d43bf[_0xf5b2('0x19')]['message']);return _0x487393(_0x3d43bf[_0xf5b2('0x19')][_0xf5b2('0x18')]);}else{logger[_0xf5b2('0x1a')](_0xf5b2('0x12'),_0xb9d4be,'request\x20sent');_0x487393(_0x3d43bf[_0xf5b2('0x1b')][_0xf5b2('0x18')]);}})[_0xf5b2('0x1c')](function(_0x5ba10e){logger[_0xf5b2('0x19')](_0xf5b2('0x12'),_0xb9d4be,_0x5ba10e);_0x11f77f(_0x5ba10e);});});}exports['UpdateSmsInteraction']=function(_0x3bebbf){var _0x5862a4=this;return new Promise(function(_0x415ebc,_0x50ff0e){return db['SmsInteraction'][_0xf5b2('0x1d')](_0x3bebbf[_0xf5b2('0x1e')],{'raw':_0x3bebbf[_0xf5b2('0x1f')]?_0x3bebbf[_0xf5b2('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bebbf[_0xf5b2('0x1f')]?_0x3bebbf[_0xf5b2('0x1f')]['where']||null:null,'attributes':_0x3bebbf[_0xf5b2('0x1f')]?_0x3bebbf['options'][_0xf5b2('0x20')]||null:null,'limit':_0x3bebbf[_0xf5b2('0x1f')]?_0x3bebbf[_0xf5b2('0x1f')][_0xf5b2('0x21')]||null:null})['then'](function(_0x2ebc25){logger[_0xf5b2('0x1a')](_0xf5b2('0x22'),_0x3bebbf);logger[_0xf5b2('0x13')](_0xf5b2('0x22'),_0x3bebbf,JSON[_0xf5b2('0x16')](_0x2ebc25));_0x415ebc(_0x2ebc25);})[_0xf5b2('0x1c')](function(_0x79c545){logger['error'](_0xf5b2('0x22'),_0x79c545['message'],_0x3bebbf);_0x50ff0e(_0x5862a4[_0xf5b2('0x19')](0x1f4,_0x79c545[_0xf5b2('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x59ad50){return new Promise(function(_0x2fc7a7,_0x120fd8){return db[_0xf5b2('0x23')][_0xf5b2('0x24')]({'where':_0x59ad50[_0xf5b2('0x1f')]?_0x59ad50[_0xf5b2('0x1f')][_0xf5b2('0x25')]||null:null})[_0xf5b2('0x11')](function(_0x5a1167){if(_0x5a1167){return _0x5a1167[_0xf5b2('0x26')](_0x59ad50[_0xf5b2('0x1e')]['ids'],_[_0xf5b2('0x27')](_0x59ad50['body'],[_0xf5b2('0x28'),'id'])||{});}})[_0xf5b2('0x29')](function(_0x27eeb0){logger[_0xf5b2('0x1a')](_0xf5b2('0x2a'),_0x59ad50);logger[_0xf5b2('0x13')](_0xf5b2('0x2a'),_0x59ad50,JSON[_0xf5b2('0x16')](_0x27eeb0));_0x2fc7a7(_0x27eeb0);})[_0xf5b2('0x1c')](function(_0x521de8){logger[_0xf5b2('0x19')](_0xf5b2('0x2a'),_0x521de8[_0xf5b2('0x18')],_0x59ad50);_0x120fd8(_this['error'](0x1f4,_0x521de8[_0xf5b2('0x18')]));});});}; \ No newline at end of file +var _0x258b=['catch','AddTagsToSmsInteraction','SmsInteraction','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','update','body','options','raw','attributes'];(function(_0x57379d,_0xcceb5f){var _0x285c1c=function(_0x450f37){while(--_0x450f37){_0x57379d['push'](_0x57379d['shift']());}};_0x285c1c(++_0xcceb5f);}(_0x258b,0x1f3));var _0xb258=function(_0x13db3b,_0x1b212c){_0x13db3b=_0x13db3b-0x0;var _0xaf724e=_0x258b[_0x13db3b];return _0xaf724e;};'use strict';var _=require(_0xb258('0x0'));var util=require(_0xb258('0x1'));var moment=require(_0xb258('0x2'));var BPromise=require('bluebird');var rs=require(_0xb258('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb258('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb258('0x5'))(_0xb258('0x6'));var config=require(_0xb258('0x7'));var jayson=require(_0xb258('0x8'));var client=jayson[_0xb258('0x9')]['http']({'port':0x232a});config[_0xb258('0xa')]=_[_0xb258('0xb')](config[_0xb258('0xa')],{'host':_0xb258('0xc'),'port':0x18eb});var socket=require(_0xb258('0xd'))(new Redis(config[_0xb258('0xa')]));require(_0xb258('0xe'))[_0xb258('0xf')](socket);function respondWithRpcPromise(_0x18e46d,_0x4960e5,_0x37d768){return new BPromise(function(_0x84532f,_0x298c09){return client[_0xb258('0x10')](_0x18e46d,_0x37d768)[_0xb258('0x11')](function(_0x1f0624){logger[_0xb258('0x12')](_0xb258('0x13'),_0x4960e5,_0xb258('0x14'));logger[_0xb258('0x15')](_0xb258('0x16'),_0x4960e5,_0xb258('0x14'),JSON[_0xb258('0x17')](_0x1f0624));if(_0x1f0624['error']){if(_0x1f0624[_0xb258('0x18')][_0xb258('0x19')]===0x1f4){logger[_0xb258('0x18')](_0xb258('0x13'),_0x4960e5,_0x1f0624[_0xb258('0x18')]['message']);return _0x298c09(_0x1f0624[_0xb258('0x18')][_0xb258('0x1a')]);}logger[_0xb258('0x18')](_0xb258('0x13'),_0x4960e5,_0x1f0624[_0xb258('0x18')][_0xb258('0x1a')]);return _0x84532f(_0x1f0624[_0xb258('0x18')][_0xb258('0x1a')]);}else{logger[_0xb258('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x4960e5,_0xb258('0x14'));_0x84532f(_0x1f0624[_0xb258('0x1b')][_0xb258('0x1a')]);}})['catch'](function(_0x16f81b){logger[_0xb258('0x18')](_0xb258('0x13'),_0x4960e5,_0x16f81b);_0x298c09(_0x16f81b);});});}exports[_0xb258('0x1c')]=function(_0x368d56){var _0x122621=this;return new Promise(function(_0xb91381,_0x13f08e){return db['SmsInteraction'][_0xb258('0x1d')](_0x368d56[_0xb258('0x1e')],{'raw':_0x368d56[_0xb258('0x1f')]?_0x368d56[_0xb258('0x1f')][_0xb258('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x368d56['options']?_0x368d56[_0xb258('0x1f')]['where']||null:null,'attributes':_0x368d56[_0xb258('0x1f')]?_0x368d56[_0xb258('0x1f')][_0xb258('0x21')]||null:null,'limit':_0x368d56['options']?_0x368d56[_0xb258('0x1f')]['limit']||null:null})['then'](function(_0x4c97d5){logger[_0xb258('0x12')](_0xb258('0x1c'),_0x368d56);logger['debug'](_0xb258('0x1c'),_0x368d56,JSON['stringify'](_0x4c97d5));_0xb91381(_0x4c97d5);})[_0xb258('0x22')](function(_0x78c094){logger['error']('UpdateSmsInteraction',_0x78c094[_0xb258('0x1a')],_0x368d56);_0x13f08e(_0x122621[_0xb258('0x18')](0x1f4,_0x78c094['message']));});});};exports[_0xb258('0x23')]=function(_0x534e02){return new Promise(function(_0x3938a7,_0x2fd30a){return db[_0xb258('0x24')]['find']({'where':_0x534e02[_0xb258('0x1f')]?_0x534e02[_0xb258('0x1f')]['where']||null:null})[_0xb258('0x11')](function(_0x33fca8){if(_0x33fca8){return _0x33fca8[_0xb258('0x25')](_0x534e02[_0xb258('0x1e')][_0xb258('0x26')],_[_0xb258('0x27')](_0x534e02[_0xb258('0x1e')],[_0xb258('0x26'),'id'])||{});}})['spread'](function(_0x3b2e3f){logger['info'](_0xb258('0x28'),_0x534e02);logger[_0xb258('0x15')](_0xb258('0x28'),_0x534e02,JSON[_0xb258('0x17')](_0x3b2e3f));_0x3938a7(_0x3b2e3f);})[_0xb258('0x22')](function(_0x249954){logger[_0xb258('0x18')](_0xb258('0x28'),_0x249954[_0xb258('0x1a')],_0x534e02);_0x2fd30a(_this[_0xb258('0x18')](0x1f4,_0x249954[_0xb258('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 6e310e1..1e13e39 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 _0x95ca=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','register'];(function(_0x382cf6,_0x332319){var _0x4657fa=function(_0x2fa030){while(--_0x2fa030){_0x382cf6['push'](_0x382cf6['shift']());}};_0x4657fa(++_0x332319);}(_0x95ca,0x7a));var _0xa95c=function(_0x4df770,_0x50cb01){_0x4df770=_0x4df770-0x0;var _0x51bb05=_0x95ca[_0x4df770];return _0x51bb05;};'use strict';var SmsInteractionEvents=require(_0xa95c('0x0'));var events=[_0xa95c('0x1'),_0xa95c('0x2'),_0xa95c('0x3')];function createListener(_0x3b6970,_0x518402){return function(_0x1201ab){_0x518402[_0xa95c('0x4')](_0x3b6970,_0x1201ab);};}function removeListener(_0x4f653e,_0x522786){return function(){SmsInteractionEvents['removeListener'](_0x4f653e,_0x522786);};}exports[_0xa95c('0x5')]=function(_0xf0c724){for(var _0xc42a7=0x0,_0x595636=events[_0xa95c('0x6')];_0xc42a7<_0x595636;_0xc42a7++){var _0xa26c3f=events[_0xc42a7];var _0x42706d=createListener(_0xa95c('0x7')+_0xa26c3f,_0xf0c724);SmsInteractionEvents['on'](_0xa26c3f,_0x42706d);}}; \ No newline at end of file +var _0x1690=['smsInteraction:','./smsInteraction.events','remove','update','removeListener','register'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x1690,0x193));var _0x0169=function(_0x4bfda9,_0x446ba2){_0x4bfda9=_0x4bfda9-0x0;var _0x213edc=_0x1690[_0x4bfda9];return _0x213edc;};'use strict';var SmsInteractionEvents=require(_0x0169('0x0'));var events=['save',_0x0169('0x1'),_0x0169('0x2')];function createListener(_0x59a89f,_0x5ac648){return function(_0x476869){_0x5ac648['emit'](_0x59a89f,_0x476869);};}function removeListener(_0x2aff92,_0x31d415){return function(){SmsInteractionEvents[_0x0169('0x3')](_0x2aff92,_0x31d415);};}exports[_0x0169('0x4')]=function(_0x33ef23){for(var _0x5be0c2=0x0,_0x47e799=events['length'];_0x5be0c2<_0x47e799;_0x5be0c2++){var _0x2ed3c3=events[_0x5be0c2];var _0x2a0918=createListener(_0x0169('0x5')+_0x2ed3c3,_0x33ef23);SmsInteractionEvents['on'](_0x2ed3c3,_0x2a0918);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d4246c0..2653d77 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 _0xe255=['express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','sms','status','put','update','reject','delete','destroy','exports','util','connect-timeout'];(function(_0x58ab89,_0xf01b2d){var _0xb93c04=function(_0x29e1b2){while(--_0x29e1b2){_0x58ab89['push'](_0x58ab89['shift']());}};_0xb93c04(++_0xf01b2d);}(_0xe255,0xcf));var _0x5e25=function(_0x3ffcec,_0x42033d){_0x3ffcec=_0x3ffcec-0x0;var _0x2ee569=_0xe255[_0x3ffcec];return _0x2ee569;};'use strict';var multer=require('multer');var util=require(_0x5e25('0x0'));var path=require('path');var timeout=require(_0x5e25('0x1'));var express=require(_0x5e25('0x2'));var router=express[_0x5e25('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e25('0x4'));var config=require(_0x5e25('0x5'));var controller=require(_0x5e25('0x6'));router[_0x5e25('0x7')]('/',auth[_0x5e25('0x8')](),controller[_0x5e25('0x9')]);router[_0x5e25('0x7')]('/describe',auth[_0x5e25('0x8')](),controller['describe']);router[_0x5e25('0x7')](_0x5e25('0xa'),auth[_0x5e25('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x5e25('0xb'),'smsmessage:create'),controller['create']);router['post']('/:id/status',controller[_0x5e25('0xc')]);router[_0x5e25('0xd')](_0x5e25('0xa'),auth[_0x5e25('0x8')](),controller[_0x5e25('0xe')]);router[_0x5e25('0xd')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x5e25('0xd')]('/:id/reject',auth[_0x5e25('0x8')](),controller[_0x5e25('0xf')]);router[_0x5e25('0x10')]('/:id',auth[_0x5e25('0x8')](),controller[_0x5e25('0x11')]);module[_0x5e25('0x12')]=router; \ No newline at end of file +var _0xbc5e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','sms','create','/:id/status','update','put','/:id/accept','accept','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x207e23,_0x17740f){var _0x58aa8a=function(_0x397193){while(--_0x397193){_0x207e23['push'](_0x207e23['shift']());}};_0x58aa8a(++_0x17740f);}(_0xbc5e,0x7d));var _0xebc5=function(_0x3b65c1,_0x280d3a){_0x3b65c1=_0x3b65c1-0x0;var _0xaddd51=_0xbc5e[_0x3b65c1];return _0xaddd51;};'use strict';var multer=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var path=require(_0xebc5('0x2'));var timeout=require(_0xebc5('0x3'));var express=require(_0xebc5('0x4'));var router=express[_0xebc5('0x5')]();var fs_extra=require(_0xebc5('0x6'));var auth=require(_0xebc5('0x7'));var interaction=require(_0xebc5('0x8'));var config=require('../../config/environment');var controller=require(_0xebc5('0x9'));router[_0xebc5('0xa')]('/',auth[_0xebc5('0xb')](),controller[_0xebc5('0xc')]);router[_0xebc5('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xebc5('0xd')]);router[_0xebc5('0xa')](_0xebc5('0xe'),auth[_0xebc5('0xb')](),controller['show']);router[_0xebc5('0xf')]('/',auth['isAuthenticated'](),interaction[_0xebc5('0x10')](_0xebc5('0x11'),'smsmessage:create'),controller[_0xebc5('0x12')]);router[_0xebc5('0xf')](_0xebc5('0x13'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xebc5('0x14')]);router[_0xebc5('0x15')](_0xebc5('0x16'),auth[_0xebc5('0xb')](),controller[_0xebc5('0x17')]);router[_0xebc5('0x15')]('/:id/reject',auth[_0xebc5('0xb')](),controller['reject']);router[_0xebc5('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xebc5('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 80f4b89..d8db8c4 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 _0x2070=['BOOLEAN','out','STRING','DATE','TEXT','medium'];(function(_0x439af6,_0x479095){var _0x259601=function(_0x375ea9){while(--_0x375ea9){_0x439af6['push'](_0x439af6['shift']());}};_0x259601(++_0x479095);}(_0x2070,0x1a2));var _0x0207=function(_0x568e44,_0x4cec37){_0x568e44=_0x568e44-0x0;var _0x1217c8=_0x2070[_0x568e44];return _0x1217c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x0207('0x0')](_0x0207('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0207('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0207('0x3')),'defaultValue':_0x0207('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0207('0x4')]},'readAt':{'type':Sequelize[_0x0207('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0207('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8c77=['DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x14495c,_0x3f8b3a){var _0x31beb9=function(_0x37f725){while(--_0x37f725){_0x14495c['push'](_0x14495c['shift']());}};_0x31beb9(++_0x3f8b3a);}(_0x8c77,0x1d6));var _0x78c7=function(_0x3639c5,_0x204b0d){_0x3639c5=_0x3639c5-0x0;var _0x5f06ca=_0x8c77[_0x3639c5];return _0x5f06ca;};'use strict';var Sequelize=require(_0x78c7('0x0'));module[_0x78c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x78c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x78c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x78c7('0x4')]('in',_0x78c7('0x5')),'defaultValue':_0x78c7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x78c7('0x6')](0xbe)},'phone':{'type':Sequelize[_0x78c7('0x6')]},'readAt':{'type':Sequelize[_0x78c7('0x7')]},'secret':{'type':Sequelize[_0x78c7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x78c7('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e6fc251..f369fee 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 _0x52fd=['acceptmessage','reject','sms','SmsInteractionId','stringify','RejectMessage','rejectMessage','SELECT','fullname','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','inspect','results','groupName','DELIVERED','infobip','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','redis','./smsMessage.socket','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','params','includeAll','merge','options','create','body','find','describe','read','format','UserId','user','agent','get','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[SMSMESSAGE: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','email','internal','manual','interface','SIP/%s','channel','event','accept'];(function(_0x521d05,_0x1d4917){var _0x3a9c09=function(_0x274706){while(--_0x274706){_0x521d05['push'](_0x521d05['shift']());}};_0x3a9c09(++_0x1d4917);}(_0x52fd,0x1df));var _0xd52f=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x52fd[_0x4ae829];return _0x256b31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd52f('0x0'));var zipdir=require(_0xd52f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd52f('0x2'));var moment=require(_0xd52f('0x3'));var BPromise=require(_0xd52f('0x4'));var Mustache=require(_0xd52f('0x5'));var util=require('util');var path=require(_0xd52f('0x6'));var sox=require(_0xd52f('0x7'));var csv=require('to-csv');var ejs=require(_0xd52f('0x8'));var fs=require('fs');var fs_extra=require(_0xd52f('0x9'));var _=require(_0xd52f('0xa'));var squel=require(_0xd52f('0xb'));var crypto=require(_0xd52f('0xc'));var jsforce=require(_0xd52f('0xd'));var deskjs=require(_0xd52f('0xe'));var toCsv=require(_0xd52f('0xf'));var querystring=require(_0xd52f('0x10'));var Papa=require(_0xd52f('0x11'));var Redis=require(_0xd52f('0x12'));var authService=require(_0xd52f('0x13'));var qs=require(_0xd52f('0x14'));var as=require(_0xd52f('0x15'));var hardwareService=require(_0xd52f('0x16'));var logger=require(_0xd52f('0x17'))(_0xd52f('0x18'));var utils=require(_0xd52f('0x19'));var config=require(_0xd52f('0x1a'));var licenseUtil=require(_0xd52f('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd52f('0x1c')](config['redis'],{'host':_0xd52f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd52f('0x1e')]));require(_0xd52f('0x1f'))['register'](socket);var jayson=require(_0xd52f('0x20'));var client=jayson[_0xd52f('0x21')][_0xd52f('0x22')]({'port':0x232c});var client9002=jayson[_0xd52f('0x21')][_0xd52f('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x23ae22,_0x106873,_0x3a27b8,_0x761be7){return new BPromise(function(_0x412137,_0x6cf77a){var _0x150d95=_0x761be7||client;return _0x150d95[_0xd52f('0x23')](_0x23ae22,_0x3a27b8)[_0xd52f('0x24')](function(_0x597ab1){logger['info'](_0xd52f('0x25'),_0x106873,_0xd52f('0x26'));logger['debug'](_0xd52f('0x27'),_0x106873,_0xd52f('0x26'),JSON['stringify'](_0x597ab1));if(_0x597ab1[_0xd52f('0x28')]){if(_0x597ab1[_0xd52f('0x28')]['code']===0x1f4){logger[_0xd52f('0x28')](_0xd52f('0x25'),_0x106873,_0x597ab1[_0xd52f('0x28')][_0xd52f('0x29')]);return _0x6cf77a(_0x597ab1[_0xd52f('0x28')][_0xd52f('0x29')]);}logger['error'](_0xd52f('0x25'),_0x106873,_0x597ab1[_0xd52f('0x28')][_0xd52f('0x29')]);return _0x412137(_0x597ab1['error'][_0xd52f('0x29')]);}else{logger['info'](_0xd52f('0x25'),_0x106873,_0xd52f('0x26'));_0x412137(_0x597ab1[_0xd52f('0x2a')][_0xd52f('0x29')]);}})[_0xd52f('0x2b')](function(_0x4cecfe){logger[_0xd52f('0x28')](_0xd52f('0x25'),_0x106873,_0x4cecfe);_0x6cf77a(_0x4cecfe);});});}function respondWithStatusCode(_0x2c23a6,_0x257e00){_0x257e00=_0x257e00||0xcc;return function(_0x456add){if(_0x456add){return _0x2c23a6[_0xd52f('0x2c')](_0x257e00);}return _0x2c23a6[_0xd52f('0x2d')](_0x257e00)['end']();};}function respondWithResult(_0x2fd567,_0x62ec32){_0x62ec32=_0x62ec32||0xc8;return function(_0x399fe8){if(_0x399fe8){return _0x2fd567[_0xd52f('0x2d')](_0x62ec32)['json'](_0x399fe8);}};}function respondWithFilteredResult(_0x4966c4,_0x56abdc){return function(_0xe77cdc){if(_0xe77cdc){var _0x12989e=typeof _0x56abdc[_0xd52f('0x2e')]===_0xd52f('0x2f')&&typeof _0x56abdc[_0xd52f('0x30')]==='undefined';var _0x317615=_0xe77cdc['count'];var _0x473c34=_0x12989e?0x0:_0x56abdc[_0xd52f('0x2e')];var _0x45e967=_0x12989e?_0xe77cdc[_0xd52f('0x31')]:_0x56abdc[_0xd52f('0x2e')]+_0x56abdc[_0xd52f('0x30')];var _0x59f134;if(_0x45e967>=_0x317615){_0x45e967=_0x317615;_0x59f134=0xc8;}else{_0x59f134=0xce;}_0x4966c4['status'](_0x59f134);return _0x4966c4[_0xd52f('0x32')](_0xd52f('0x33'),_0x473c34+'-'+_0x45e967+'/'+_0x317615)[_0xd52f('0x34')](_0xe77cdc);}return null;};}function patchUpdates(_0x5f45e9){return function(_0x21327d){try{jsonpatch[_0xd52f('0x35')](_0x21327d,_0x5f45e9,!![]);}catch(_0x497ba6){return BPromise['reject'](_0x497ba6);}return _0x21327d[_0xd52f('0x36')]();};}function saveUpdates(_0x2f4d26,_0x24e354){return function(_0x1e6b66){if(_0x1e6b66){return _0x1e6b66[_0xd52f('0x37')](_0x2f4d26)['then'](function(_0x55d32a){return _0x55d32a;});}return null;};}function removeEntity(_0x1126e1,_0x23e8a9){return function(_0x5dac8e){if(_0x5dac8e){return _0x5dac8e[_0xd52f('0x38')]()[_0xd52f('0x24')](function(){_0x1126e1[_0xd52f('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27d02a,_0x2d5cc0){return function(_0x50d68e){if(!_0x50d68e){_0x27d02a[_0xd52f('0x2c')](0x194);}return _0x50d68e;};}function handleError(_0x46af7c,_0x48242b){_0x48242b=_0x48242b||0x1f4;return function(_0x24c689){logger[_0xd52f('0x28')](_0x24c689[_0xd52f('0x39')]);if(_0x24c689[_0xd52f('0x3a')]){delete _0x24c689[_0xd52f('0x3a')];}_0x46af7c['status'](_0x48242b)[_0xd52f('0x3b')](_0x24c689);};}exports['index']=function(_0x3c3676,_0x56eb48){var _0x27c8bc={},_0x17ec8c={},_0x448df1={'count':0x0,'rows':[]};var _0x39fe90=_[_0xd52f('0x3c')](db[_0xd52f('0x3d')][_0xd52f('0x3e')],function(_0x2f752c){return{'name':_0x2f752c[_0xd52f('0x3f')],'type':_0x2f752c[_0xd52f('0x40')][_0xd52f('0x41')]};});_0x17ec8c[_0xd52f('0x42')]=_[_0xd52f('0x3c')](_0x39fe90,_0xd52f('0x3a'));_0x17ec8c[_0xd52f('0x43')]=_[_0xd52f('0x44')](_0x3c3676['query']);_0x17ec8c[_0xd52f('0x45')]=_[_0xd52f('0x46')](_0x17ec8c['model'],_0x17ec8c[_0xd52f('0x43')]);_0x27c8bc[_0xd52f('0x47')]=_[_0xd52f('0x46')](_0x17ec8c[_0xd52f('0x42')],qs[_0xd52f('0x48')](_0x3c3676['query'][_0xd52f('0x48')]));_0x27c8bc[_0xd52f('0x47')]=_0x27c8bc[_0xd52f('0x47')][_0xd52f('0x49')]?_0x27c8bc['attributes']:_0x17ec8c[_0xd52f('0x42')];if(!_0x3c3676[_0xd52f('0x43')][_0xd52f('0x4a')]('nolimit')){_0x27c8bc[_0xd52f('0x30')]=qs['limit'](_0x3c3676[_0xd52f('0x43')][_0xd52f('0x30')]);_0x27c8bc[_0xd52f('0x2e')]=qs['offset'](_0x3c3676[_0xd52f('0x43')]['offset']);}_0x27c8bc[_0xd52f('0x4b')]=qs['sort'](_0x3c3676[_0xd52f('0x43')][_0xd52f('0x4c')]);_0x27c8bc[_0xd52f('0x4d')]=qs['filters'](_[_0xd52f('0x4e')](_0x3c3676[_0xd52f('0x43')],_0x17ec8c[_0xd52f('0x45')]),_0x39fe90);if(_0x3c3676[_0xd52f('0x43')][_0xd52f('0x4f')]){_0x27c8bc[_0xd52f('0x4d')]=_['merge'](_0x27c8bc[_0xd52f('0x4d')],{'$or':_['map'](_0x39fe90,function(_0x2efbf1){if(_0x2efbf1[_0xd52f('0x40')]!==_0xd52f('0x50')){var _0x2884ea={};_0x2884ea[_0x2efbf1[_0xd52f('0x3a')]]={'$like':'%'+_0x3c3676[_0xd52f('0x43')][_0xd52f('0x4f')]+'%'};return _0x2884ea;}})});}_0x27c8bc=_['merge']({},_0x27c8bc,_0x3c3676['options']);var _0x2e175e={'where':_0x27c8bc[_0xd52f('0x4d')]};return db['SmsMessage']['count'](_0x2e175e)[_0xd52f('0x24')](function(_0x4060a5){_0x448df1[_0xd52f('0x31')]=_0x4060a5;if(_0x3c3676[_0xd52f('0x43')]['includeAll']){_0x27c8bc[_0xd52f('0x51')]=[{'all':!![]}];}return db[_0xd52f('0x3d')][_0xd52f('0x52')](_0x27c8bc);})[_0xd52f('0x24')](function(_0xcd3727){_0x448df1[_0xd52f('0x53')]=_0xcd3727;return _0x448df1;})[_0xd52f('0x24')](respondWithFilteredResult(_0x56eb48,_0x27c8bc))['catch'](handleError(_0x56eb48,null));};exports['show']=function(_0x35ed0d,_0x2d27eb){var _0x469674={'raw':!![],'where':{'id':_0x35ed0d[_0xd52f('0x54')]['id']}},_0x44f945={};_0x44f945[_0xd52f('0x42')]=_[_0xd52f('0x44')](db[_0xd52f('0x3d')]['rawAttributes']);_0x44f945[_0xd52f('0x43')]=_[_0xd52f('0x44')](_0x35ed0d[_0xd52f('0x43')]);_0x44f945['filters']=_[_0xd52f('0x46')](_0x44f945[_0xd52f('0x42')],_0x44f945[_0xd52f('0x43')]);_0x469674[_0xd52f('0x47')]=_['intersection'](_0x44f945['model'],qs[_0xd52f('0x48')](_0x35ed0d[_0xd52f('0x43')]['fields']));_0x469674['attributes']=_0x469674[_0xd52f('0x47')][_0xd52f('0x49')]?_0x469674[_0xd52f('0x47')]:_0x44f945['model'];if(_0x35ed0d['query'][_0xd52f('0x55')]){_0x469674[_0xd52f('0x51')]=[{'all':!![]}];}_0x469674=_[_0xd52f('0x56')]({},_0x469674,_0x35ed0d[_0xd52f('0x57')]);return db[_0xd52f('0x3d')]['find'](_0x469674)['then'](handleEntityNotFound(_0x2d27eb,null))[_0xd52f('0x24')](respondWithResult(_0x2d27eb,null))['catch'](handleError(_0x2d27eb,null));};exports['create']=function(_0x281674,_0x29c1bf){return db['SmsMessage'][_0xd52f('0x58')](_0x281674[_0xd52f('0x59')],{})[_0xd52f('0x24')](respondWithResult(_0x29c1bf,0xc9))[_0xd52f('0x2b')](handleError(_0x29c1bf,null));};exports[_0xd52f('0x37')]=function(_0x422f25,_0x30e2d1){if(_0x422f25[_0xd52f('0x59')]['id']){delete _0x422f25[_0xd52f('0x59')]['id'];}return db[_0xd52f('0x3d')][_0xd52f('0x5a')]({'where':{'id':_0x422f25[_0xd52f('0x54')]['id']}})[_0xd52f('0x24')](handleEntityNotFound(_0x30e2d1,null))[_0xd52f('0x24')](saveUpdates(_0x422f25[_0xd52f('0x59')],null))['then'](respondWithResult(_0x30e2d1,null))[_0xd52f('0x2b')](handleError(_0x30e2d1,null));};exports['destroy']=function(_0x5011fe,_0x264c6b){return db[_0xd52f('0x3d')][_0xd52f('0x5a')]({'where':{'id':_0x5011fe[_0xd52f('0x54')]['id']}})['then'](handleEntityNotFound(_0x264c6b,null))[_0xd52f('0x24')](removeEntity(_0x264c6b,null))[_0xd52f('0x2b')](handleError(_0x264c6b,null));};exports[_0xd52f('0x5b')]=function(_0xf529de,_0x4055d9){return db[_0xd52f('0x3d')][_0xd52f('0x5b')]()[_0xd52f('0x24')](respondWithResult(_0x4055d9,null))[_0xd52f('0x2b')](handleError(_0x4055d9,null));};var interaction_log=require(_0xd52f('0x17'))('sms-interactions');exports['accept']=function(_0x2eda9a,_0x8b5c76,_0xf3671c){var _0xff90f6={'agent':{},'channel':'sms'};if(_0x2eda9a[_0xd52f('0x59')]['id']){delete _0x2eda9a['body']['id'];}_0x2eda9a[_0xd52f('0x59')][_0xd52f('0x5c')]=!![];_0x2eda9a[_0xd52f('0x59')]['readAt']=moment()[_0xd52f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2eda9a['body'][_0xd52f('0x5e')]=_0x2eda9a[_0xd52f('0x59')][_0xd52f('0x5e')]||_0x2eda9a[_0xd52f('0x5f')]['id'];_0xff90f6[_0xd52f('0x60')]['id']=_0x2eda9a[_0xd52f('0x59')][_0xd52f('0x5e')];return db[_0xd52f('0x3d')][_0xd52f('0x5a')]({'where':{'id':_0x2eda9a[_0xd52f('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x8b5c76,null))[_0xd52f('0x24')](saveUpdates(_0x2eda9a[_0xd52f('0x59')],null))['then'](function(_0x5c0b0c){if(_0x5c0b0c){_0xff90f6[_0xd52f('0x29')]=_0x5c0b0c[_0xd52f('0x61')]({'plain':!![]});return db[_0xd52f('0x62')][_0xd52f('0x5a')]({'where':{'id':_0x5c0b0c['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x8b5c76,null))['then'](function(_0x32baf6){if(_0x32baf6){return _0x32baf6['update']({'UserId':_0x2eda9a['body'][_0xd52f('0x5e')],'read1stAt':_[_0xd52f('0x63')](_0x32baf6['read1stAt'])?moment()[_0xd52f('0x5d')](_0xd52f('0x64')):undefined});}return null;})['then'](function(_0x4c11b5){if(_0x4c11b5){_0xff90f6[_0xd52f('0x65')]=_0x4c11b5['get']({'plain':!![]});interaction_log[_0xd52f('0x66')](_0xd52f('0x67'),_0x2eda9a[_0xd52f('0x5f')]['id'],_0x2eda9a[_0xd52f('0x5f')][_0xd52f('0x3a')],_0x2eda9a[_0xd52f('0x5f')][_0xd52f('0x68')],_0xff90f6[_0xd52f('0x65')]['id'],_0x2eda9a[_0xd52f('0x59')]?JSON['stringify'](_0x2eda9a[_0xd52f('0x59')]):_0xd52f('0x69'));return respondWithRpcPromise(_0xd52f('0x6a'),_0xd52f('0x6b'),_0xff90f6);}return null;})[_0xd52f('0x24')](function(_0x21ee4d){var _0x164de3=_0xd52f('0x6c')+_0x21ee4d[_0xd52f('0x29')][_0xd52f('0x6d')];return db[_0xd52f('0x6e')][_0xd52f('0x43')](_0x164de3,{'type':db[_0xd52f('0x6f')][_0xd52f('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x396a1d){return _0x396a1d;});})[_0xd52f('0x24')](function(_0x543ba0){if(_0x543ba0){_0xff90f6[_0xd52f('0x29')]['contact']=_0x543ba0[0x0];if(!_0x2eda9a['body'][_0xd52f('0x5e')])return;return db['User'][_0xd52f('0x5a')]({'where':{'id':_0x2eda9a[_0xd52f('0x59')]['UserId'],'role':_0xd52f('0x60')},'attributes':['id',_0xd52f('0x3a'),'fullname',_0xd52f('0x71'),_0xd52f('0x72')],'raw':!![]});}return null;})['then'](function(_0x1d263a){if(!_0x1d263a)return null;_0xff90f6[_0xd52f('0x29')][_0xd52f('0x60')]=_0x1d263a;return _0xff90f6;})[_0xd52f('0x24')](function(_0x37c4bb){if(_0x37c4bb){if(_0x2eda9a['body'][_0xd52f('0x73')]){_0xff90f6[_0xd52f('0x29')][_0xd52f('0x74')]=util['format'](_0xd52f('0x75'),_0x2eda9a[_0xd52f('0x5f')][_0xd52f('0x3a')]);_0xff90f6['message'][_0xd52f('0x76')]=_0xff90f6['channel'];_0xff90f6[_0xd52f('0x29')]['motionChannel']=_0xff90f6[_0xd52f('0x76')];_0xff90f6[_0xd52f('0x29')][_0xd52f('0x77')]=_0xd52f('0x78');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd52f('0x79'),'message':_0xff90f6[_0xd52f('0x29')]},client9002)[_0xd52f('0x24')](function(){return _0xff90f6;});}return _0xff90f6;}return null;})[_0xd52f('0x24')](respondWithResult(_0x8b5c76,null))[_0xd52f('0x2b')](handleError(_0x8b5c76,null));};var interaction_log=require(_0xd52f('0x17'))('sms-interactions');exports[_0xd52f('0x7a')]=function(_0x343543,_0x55f25d,_0x3c85be){var _0xd1a7a7={'agent':{},'channel':_0xd52f('0x7b')};if(_0x343543[_0xd52f('0x59')]['id']){delete _0x343543[_0xd52f('0x59')]['id'];}_0x343543[_0xd52f('0x59')][_0xd52f('0x5e')]=_0x343543[_0xd52f('0x59')]['UserId']||_0x343543[_0xd52f('0x5f')]['id'];_0xd1a7a7[_0xd52f('0x60')]['id']=_0x343543[_0xd52f('0x59')][_0xd52f('0x5e')];return db[_0xd52f('0x3d')][_0xd52f('0x5a')]({'where':{'id':_0x343543[_0xd52f('0x54')]['id'],'UserId':null}})[_0xd52f('0x24')](handleEntityNotFound(_0x55f25d,null))[_0xd52f('0x24')](function(_0x593731){if(_0x593731){_0xd1a7a7[_0xd52f('0x29')]=_0x593731[_0xd52f('0x61')]({'plain':!![]});return db[_0xd52f('0x62')][_0xd52f('0x5a')]({'where':{'id':_0x593731[_0xd52f('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x55f25d,null))[_0xd52f('0x24')](function(_0x271e4b){if(_0x271e4b){_0xd1a7a7[_0xd52f('0x65')]=_0x271e4b[_0xd52f('0x61')]({'plain':!![]});interaction_log[_0xd52f('0x66')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x343543[_0xd52f('0x5f')]['id'],_0x343543[_0xd52f('0x5f')][_0xd52f('0x3a')],_0x343543[_0xd52f('0x5f')][_0xd52f('0x68')],_0xd1a7a7[_0xd52f('0x65')]['id'],_0x343543[_0xd52f('0x59')]?JSON[_0xd52f('0x7d')](_0x343543[_0xd52f('0x59')]):'null');return respondWithRpcPromise(_0xd52f('0x7e'),_0xd52f('0x7f'),_0xd1a7a7);}return null;})[_0xd52f('0x24')](function(_0xb48a42){var _0x185106=_0xd52f('0x6c')+_0xb48a42[_0xd52f('0x29')]['ContactId'];return db[_0xd52f('0x6e')][_0xd52f('0x43')](_0x185106,{'type':db['Sequelize'][_0xd52f('0x70')][_0xd52f('0x80')],'raw':!![]})[_0xd52f('0x24')](function(_0x37e89d){return _0x37e89d;});})[_0xd52f('0x24')](function(_0x3fc0bb){if(_0x3fc0bb){_0xd1a7a7['message']['contact']=_0x3fc0bb[0x0];if(!_0x343543[_0xd52f('0x59')]['UserId'])return;return db['User'][_0xd52f('0x5a')]({'where':{'id':_0x343543[_0xd52f('0x59')][_0xd52f('0x5e')],'role':_0xd52f('0x60')},'attributes':['id','name',_0xd52f('0x81'),'email',_0xd52f('0x72')],'raw':!![]});}return null;})[_0xd52f('0x24')](function(_0x4eee2c){if(!_0x4eee2c)return null;_0xd1a7a7[_0xd52f('0x29')][_0xd52f('0x60')]=_0x4eee2c;return _0xd1a7a7;})[_0xd52f('0x24')](function(_0x15a0a2){if(_0x15a0a2){_0x15a0a2[_0xd52f('0x29')][_0xd52f('0x74')]=util[_0xd52f('0x5d')]('SIP/%s',_0x343543['user'][_0xd52f('0x3a')]);_0x15a0a2[_0xd52f('0x29')]['channel']=_0xd1a7a7[_0xd52f('0x76')];_0x15a0a2['message'][_0xd52f('0x82')]=_0xd1a7a7[_0xd52f('0x76')];_0x15a0a2[_0xd52f('0x29')][_0xd52f('0x77')]='reject';respondWithRpcPromise(_0xd52f('0x83'),'EventManager',{'event':_0xd52f('0x84'),'message':_0x15a0a2[_0xd52f('0x29')]},client9002);return _0xd1a7a7;}return null;})[_0xd52f('0x24')](respondWithResult(_0x55f25d,null))['catch'](handleError(_0x55f25d,null));};exports[_0xd52f('0x2d')]=function(_0x164c6e,_0x3f1edb,_0x3155c1){if(_0x164c6e[_0xd52f('0x59')]['id']){delete _0x164c6e[_0xd52f('0x59')]['id'];}var _0x3b62b8;return db[_0xd52f('0x3d')][_0xd52f('0x5a')]({'where':{'id':_0x164c6e[_0xd52f('0x54')]['id']}})[_0xd52f('0x24')](handleEntityNotFound(_0x3f1edb,null))[_0xd52f('0x24')](function(_0x31e2d7){if(_0x31e2d7){_0x3b62b8=_0x31e2d7;return db[_0xd52f('0x85')][_0xd52f('0x5a')]({'where':{'id':_0x31e2d7[_0xd52f('0x86')]}});}})['then'](handleEntityNotFound(_0x3f1edb,null))[_0xd52f('0x24')](function(_0x5efa45){if(_0x5efa45){logger['debug'](_0xd52f('0x27'),_0xd52f('0x2d'),'received\x20delivery\x20report\x20from',_0x5efa45['type'],util['inspect'](_0x164c6e[_0xd52f('0x59')],{'showHidden':![],'depth':null}));switch(_0x5efa45[_0xd52f('0x40')]){case _0xd52f('0x87'):if(_0x164c6e[_0xd52f('0x59')][_0xd52f('0x88')]&&_0x164c6e[_0xd52f('0x59')][_0xd52f('0x88')]===_0x3b62b8[_0xd52f('0x89')]){return _0x3b62b8[_0xd52f('0x37')]({'read':!![]});}else{logger[_0xd52f('0x28')](_0xd52f('0x8a'),_0xd52f('0x2d'),_0xd52f('0x87'),util['inspect'](_0x164c6e[_0xd52f('0x59')],{'showHidden':![],'depth':null}));}break;case _0xd52f('0x8b'):if(_0x164c6e[_0xd52f('0x59')]['MessageUUID']&&_0x164c6e[_0xd52f('0x59')][_0xd52f('0x8c')]===_0x3b62b8[_0xd52f('0x89')]&&_['indexOf']([_0xd52f('0x8d'),_0xd52f('0x8e')],_0x164c6e[_0xd52f('0x59')][_0xd52f('0x8f')])>=0x0){return _0x3b62b8[_0xd52f('0x37')]({'read':!![]});}else{logger[_0xd52f('0x28')](_0xd52f('0x8a'),_0xd52f('0x2d'),_0xd52f('0x90'),util[_0xd52f('0x91')](_0x164c6e['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5dcb18=_0x164c6e['body'][_0xd52f('0x92')][0x0];if(_0x5dcb18[_0xd52f('0x2d')][_0xd52f('0x93')]===_0xd52f('0x94')){return _0x3b62b8[_0xd52f('0x37')]({'read':!![]});}else{logger[_0xd52f('0x28')](_0xd52f('0x8a'),'status',_0xd52f('0x95'),util[_0xd52f('0x91')](_0x164c6e[_0xd52f('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3b62b8;}})['then'](respondWithResult(_0x3f1edb,null))['catch'](handleError(_0x3f1edb,null));}; \ No newline at end of file +var _0x9a2d=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','destroy','stack','name','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','SmsMessage','count','includeAll','include','findAll','rows','show','rawAttributes','filters','options','find','create','body','update','params','describe','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x46f9cd,_0x4337c4){var _0x30a5f9=function(_0x580dbf){while(--_0x580dbf){_0x46f9cd['push'](_0x46f9cd['shift']());}};_0x30a5f9(++_0x4337c4);}(_0x9a2d,0x123));var _0xd9a2=function(_0x5926d9,_0x1e007e){_0x5926d9=_0x5926d9-0x0;var _0xc64b9f=_0x9a2d[_0x5926d9];return _0xc64b9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9a2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9a2('0x1'));var moment=require(_0xd9a2('0x2'));var BPromise=require(_0xd9a2('0x3'));var Mustache=require(_0xd9a2('0x4'));var util=require(_0xd9a2('0x5'));var path=require(_0xd9a2('0x6'));var sox=require(_0xd9a2('0x7'));var csv=require(_0xd9a2('0x8'));var ejs=require(_0xd9a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd9a2('0xa'));var _=require(_0xd9a2('0xb'));var squel=require(_0xd9a2('0xc'));var crypto=require(_0xd9a2('0xd'));var jsforce=require(_0xd9a2('0xe'));var deskjs=require(_0xd9a2('0xf'));var toCsv=require(_0xd9a2('0x8'));var querystring=require(_0xd9a2('0x10'));var Papa=require(_0xd9a2('0x11'));var Redis=require(_0xd9a2('0x12'));var authService=require(_0xd9a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a2('0x14'));var logger=require('../../config/logger')(_0xd9a2('0x15'));var utils=require('../../config/utils');var config=require(_0xd9a2('0x16'));var licenseUtil=require(_0xd9a2('0x17'));var db=require(_0xd9a2('0x18'))['db'];config[_0xd9a2('0x19')]=_['defaults'](config[_0xd9a2('0x19')],{'host':_0xd9a2('0x1a'),'port':0x18eb});var socket=require(_0xd9a2('0x1b'))(new Redis(config['redis']));require(_0xd9a2('0x1c'))['register'](socket);var jayson=require(_0xd9a2('0x1d'));var client=jayson['client'][_0xd9a2('0x1e')]({'port':0x232c});var client9002=jayson[_0xd9a2('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee6ea8,_0x1447e6,_0x4a8d26,_0x36764b){return new BPromise(function(_0x53f6fb,_0x34ee99){var _0x5185d0=_0x36764b||client;return _0x5185d0[_0xd9a2('0x20')](_0xee6ea8,_0x4a8d26)[_0xd9a2('0x21')](function(_0x53dace){logger[_0xd9a2('0x22')](_0xd9a2('0x23'),_0x1447e6,_0xd9a2('0x24'));logger[_0xd9a2('0x25')](_0xd9a2('0x26'),_0x1447e6,_0xd9a2('0x24'),JSON[_0xd9a2('0x27')](_0x53dace));if(_0x53dace['error']){if(_0x53dace['error'][_0xd9a2('0x28')]===0x1f4){logger[_0xd9a2('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);return _0x34ee99(_0x53dace['error'][_0xd9a2('0x2a')]);}logger[_0xd9a2('0x29')](_0xd9a2('0x23'),_0x1447e6,_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);return _0x53f6fb(_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0xd9a2('0x24'));_0x53f6fb(_0x53dace[_0xd9a2('0x2b')][_0xd9a2('0x2a')]);}})[_0xd9a2('0x2c')](function(_0x492320){logger[_0xd9a2('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0x492320);_0x34ee99(_0x492320);});});}function respondWithStatusCode(_0x3ee7fe,_0x2093ea){_0x2093ea=_0x2093ea||0xcc;return function(_0x5ea1fc){if(_0x5ea1fc){return _0x3ee7fe[_0xd9a2('0x2d')](_0x2093ea);}return _0x3ee7fe[_0xd9a2('0x2e')](_0x2093ea)[_0xd9a2('0x2f')]();};}function respondWithResult(_0x4c89d8,_0x308dde){_0x308dde=_0x308dde||0xc8;return function(_0x392d24){if(_0x392d24){return _0x4c89d8[_0xd9a2('0x2e')](_0x308dde)[_0xd9a2('0x30')](_0x392d24);}};}function respondWithFilteredResult(_0x53723f,_0x1c8557){return function(_0x5a6f29){if(_0x5a6f29){var _0xc422b0=typeof _0x1c8557['offset']===_0xd9a2('0x31')&&typeof _0x1c8557[_0xd9a2('0x32')]===_0xd9a2('0x31');var _0x1c07b9=_0x5a6f29['count'];var _0x41aca0=_0xc422b0?0x0:_0x1c8557[_0xd9a2('0x33')];var _0x3e6e47=_0xc422b0?_0x5a6f29['count']:_0x1c8557[_0xd9a2('0x33')]+_0x1c8557['limit'];var _0x592ff3;if(_0x3e6e47>=_0x1c07b9){_0x3e6e47=_0x1c07b9;_0x592ff3=0xc8;}else{_0x592ff3=0xce;}_0x53723f['status'](_0x592ff3);return _0x53723f['set'](_0xd9a2('0x34'),_0x41aca0+'-'+_0x3e6e47+'/'+_0x1c07b9)['json'](_0x5a6f29);}return null;};}function patchUpdates(_0x55973c){return function(_0x2885ad){try{jsonpatch[_0xd9a2('0x35')](_0x2885ad,_0x55973c,!![]);}catch(_0xeddcd){return BPromise[_0xd9a2('0x36')](_0xeddcd);}return _0x2885ad['save']();};}function saveUpdates(_0x53bbfc,_0x47ecf2){return function(_0x3ee4c3){if(_0x3ee4c3){return _0x3ee4c3['update'](_0x53bbfc)[_0xd9a2('0x21')](function(_0x475236){return _0x475236;});}return null;};}function removeEntity(_0x33ed44,_0x28de27){return function(_0x322303){if(_0x322303){return _0x322303[_0xd9a2('0x37')]()['then'](function(){_0x33ed44[_0xd9a2('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2e455,_0x5bbeef){return function(_0x2db13d){if(!_0x2db13d){_0xd2e455[_0xd9a2('0x2d')](0x194);}return _0x2db13d;};}function handleError(_0x3c7bb1,_0x41e47f){_0x41e47f=_0x41e47f||0x1f4;return function(_0x535c8f){logger[_0xd9a2('0x29')](_0x535c8f[_0xd9a2('0x38')]);if(_0x535c8f[_0xd9a2('0x39')]){delete _0x535c8f[_0xd9a2('0x39')];}_0x3c7bb1[_0xd9a2('0x2e')](_0x41e47f)['send'](_0x535c8f);};}exports['index']=function(_0xff9e89,_0x147ad8){var _0x3c6a68={},_0x291766={},_0x110064={'count':0x0,'rows':[]};var _0x3228df=_['map'](db['SmsMessage']['rawAttributes'],function(_0x3dae16){return{'name':_0x3dae16[_0xd9a2('0x3a')],'type':_0x3dae16['type'][_0xd9a2('0x3b')]};});_0x291766[_0xd9a2('0x3c')]=_[_0xd9a2('0x3d')](_0x3228df,'name');_0x291766[_0xd9a2('0x3e')]=_['keys'](_0xff9e89[_0xd9a2('0x3e')]);_0x291766['filters']=_['intersection'](_0x291766[_0xd9a2('0x3c')],_0x291766[_0xd9a2('0x3e')]);_0x3c6a68[_0xd9a2('0x3f')]=_[_0xd9a2('0x40')](_0x291766[_0xd9a2('0x3c')],qs[_0xd9a2('0x41')](_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x41')]));_0x3c6a68[_0xd9a2('0x3f')]=_0x3c6a68[_0xd9a2('0x3f')][_0xd9a2('0x42')]?_0x3c6a68['attributes']:_0x291766[_0xd9a2('0x3c')];if(!_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x43')](_0xd9a2('0x44'))){_0x3c6a68['limit']=qs[_0xd9a2('0x32')](_0xff9e89[_0xd9a2('0x3e')]['limit']);_0x3c6a68['offset']=qs[_0xd9a2('0x33')](_0xff9e89['query']['offset']);}_0x3c6a68[_0xd9a2('0x45')]=qs[_0xd9a2('0x46')](_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x46')]);_0x3c6a68[_0xd9a2('0x47')]=qs['filters'](_['pick'](_0xff9e89[_0xd9a2('0x3e')],_0x291766['filters']),_0x3228df);if(_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x48')]){_0x3c6a68[_0xd9a2('0x47')]=_[_0xd9a2('0x49')](_0x3c6a68[_0xd9a2('0x47')],{'$or':_[_0xd9a2('0x3d')](_0x3228df,function(_0x2e0dce){if(_0x2e0dce[_0xd9a2('0x4a')]!==_0xd9a2('0x4b')){var _0x3ddadf={};_0x3ddadf[_0x2e0dce[_0xd9a2('0x39')]]={'$like':'%'+_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x48')]+'%'};return _0x3ddadf;}})});}_0x3c6a68=_[_0xd9a2('0x49')]({},_0x3c6a68,_0xff9e89['options']);var _0x2a098f={'where':_0x3c6a68[_0xd9a2('0x47')]};return db[_0xd9a2('0x4c')][_0xd9a2('0x4d')](_0x2a098f)[_0xd9a2('0x21')](function(_0x4d76fc){_0x110064['count']=_0x4d76fc;if(_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x4e')]){_0x3c6a68[_0xd9a2('0x4f')]=[{'all':!![]}];}return db[_0xd9a2('0x4c')][_0xd9a2('0x50')](_0x3c6a68);})[_0xd9a2('0x21')](function(_0xe7d5c0){_0x110064[_0xd9a2('0x51')]=_0xe7d5c0;return _0x110064;})[_0xd9a2('0x21')](respondWithFilteredResult(_0x147ad8,_0x3c6a68))[_0xd9a2('0x2c')](handleError(_0x147ad8,null));};exports[_0xd9a2('0x52')]=function(_0x156608,_0xd184db){var _0xc43dea={'raw':!![],'where':{'id':_0x156608['params']['id']}},_0x43c91b={};_0x43c91b[_0xd9a2('0x3c')]=_['keys'](db[_0xd9a2('0x4c')][_0xd9a2('0x53')]);_0x43c91b[_0xd9a2('0x3e')]=_['keys'](_0x156608[_0xd9a2('0x3e')]);_0x43c91b[_0xd9a2('0x54')]=_[_0xd9a2('0x40')](_0x43c91b[_0xd9a2('0x3c')],_0x43c91b[_0xd9a2('0x3e')]);_0xc43dea[_0xd9a2('0x3f')]=_[_0xd9a2('0x40')](_0x43c91b[_0xd9a2('0x3c')],qs[_0xd9a2('0x41')](_0x156608[_0xd9a2('0x3e')][_0xd9a2('0x41')]));_0xc43dea[_0xd9a2('0x3f')]=_0xc43dea[_0xd9a2('0x3f')]['length']?_0xc43dea[_0xd9a2('0x3f')]:_0x43c91b[_0xd9a2('0x3c')];if(_0x156608['query'][_0xd9a2('0x4e')]){_0xc43dea[_0xd9a2('0x4f')]=[{'all':!![]}];}_0xc43dea=_[_0xd9a2('0x49')]({},_0xc43dea,_0x156608[_0xd9a2('0x55')]);return db[_0xd9a2('0x4c')][_0xd9a2('0x56')](_0xc43dea)[_0xd9a2('0x21')](handleEntityNotFound(_0xd184db,null))[_0xd9a2('0x21')](respondWithResult(_0xd184db,null))[_0xd9a2('0x2c')](handleError(_0xd184db,null));};exports[_0xd9a2('0x57')]=function(_0x5dda06,_0x555e8f){return db['SmsMessage'][_0xd9a2('0x57')](_0x5dda06[_0xd9a2('0x58')],{})[_0xd9a2('0x21')](respondWithResult(_0x555e8f,0xc9))['catch'](handleError(_0x555e8f,null));};exports[_0xd9a2('0x59')]=function(_0x500c40,_0x4305da){if(_0x500c40[_0xd9a2('0x58')]['id']){delete _0x500c40[_0xd9a2('0x58')]['id'];}return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x500c40[_0xd9a2('0x5a')]['id']}})[_0xd9a2('0x21')](handleEntityNotFound(_0x4305da,null))['then'](saveUpdates(_0x500c40[_0xd9a2('0x58')],null))[_0xd9a2('0x21')](respondWithResult(_0x4305da,null))[_0xd9a2('0x2c')](handleError(_0x4305da,null));};exports[_0xd9a2('0x37')]=function(_0x3a882a,_0x16350d){return db[_0xd9a2('0x4c')]['find']({'where':{'id':_0x3a882a[_0xd9a2('0x5a')]['id']}})[_0xd9a2('0x21')](handleEntityNotFound(_0x16350d,null))[_0xd9a2('0x21')](removeEntity(_0x16350d,null))['catch'](handleError(_0x16350d,null));};exports[_0xd9a2('0x5b')]=function(_0x1a42db,_0xe094dc){return db['SmsMessage'][_0xd9a2('0x5b')]()[_0xd9a2('0x21')](respondWithResult(_0xe094dc,null))['catch'](handleError(_0xe094dc,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xd9a2('0x5c')]=function(_0x96a587,_0xb549a9,_0x2c482a){var _0x416c03={'agent':{},'channel':_0xd9a2('0x5d')};if(_0x96a587[_0xd9a2('0x58')]['id']){delete _0x96a587[_0xd9a2('0x58')]['id'];}_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x5e')]=!![];_0x96a587['body'][_0xd9a2('0x5f')]=moment()[_0xd9a2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x96a587['body']['UserId']=_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')]||_0x96a587[_0xd9a2('0x62')]['id'];_0x416c03[_0xd9a2('0x63')]['id']=_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')];return db[_0xd9a2('0x4c')]['find']({'where':{'id':_0x96a587[_0xd9a2('0x5a')]['id'],'UserId':null}})[_0xd9a2('0x21')](handleEntityNotFound(_0xb549a9,null))[_0xd9a2('0x21')](saveUpdates(_0x96a587[_0xd9a2('0x58')],null))[_0xd9a2('0x21')](function(_0x10b10f){if(_0x10b10f){_0x416c03['message']=_0x10b10f[_0xd9a2('0x64')]({'plain':!![]});return db[_0xd9a2('0x65')][_0xd9a2('0x56')]({'where':{'id':_0x10b10f[_0xd9a2('0x66')]}});}return null;})[_0xd9a2('0x21')](handleEntityNotFound(_0xb549a9,null))[_0xd9a2('0x21')](function(_0x4883f0){if(_0x4883f0){return _0x4883f0[_0xd9a2('0x59')]({'UserId':_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')],'read1stAt':_[_0xd9a2('0x67')](_0x4883f0[_0xd9a2('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x65bfe1){if(_0x65bfe1){_0x416c03[_0xd9a2('0x69')]=_0x65bfe1[_0xd9a2('0x64')]({'plain':!![]});interaction_log[_0xd9a2('0x22')](_0xd9a2('0x6a'),_0x96a587['user']['id'],_0x96a587[_0xd9a2('0x62')]['name'],_0x96a587['user'][_0xd9a2('0x6b')],_0x416c03[_0xd9a2('0x69')]['id'],_0x96a587[_0xd9a2('0x58')]?JSON[_0xd9a2('0x27')](_0x96a587[_0xd9a2('0x58')]):'null');return respondWithRpcPromise(_0xd9a2('0x6c'),_0xd9a2('0x6d'),_0x416c03);}return null;})[_0xd9a2('0x21')](function(_0x359ffb){var _0x17a77f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x359ffb[_0xd9a2('0x2a')][_0xd9a2('0x6e')];return db[_0xd9a2('0x6f')][_0xd9a2('0x3e')](_0x17a77f,{'type':db[_0xd9a2('0x70')][_0xd9a2('0x71')][_0xd9a2('0x72')],'raw':!![]})[_0xd9a2('0x21')](function(_0x140484){return _0x140484;});})['then'](function(_0x5dabb5){if(_0x5dabb5){_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x73')]=_0x5dabb5[0x0];if(!_0x96a587['body'][_0xd9a2('0x61')])return;return db[_0xd9a2('0x74')]['find']({'where':{'id':_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')],'role':'agent'},'attributes':['id',_0xd9a2('0x39'),_0xd9a2('0x75'),_0xd9a2('0x76'),_0xd9a2('0x77')],'raw':!![]});}return null;})[_0xd9a2('0x21')](function(_0x406964){if(!_0x406964)return null;_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x63')]=_0x406964;return _0x416c03;})[_0xd9a2('0x21')](function(_0x50020d){if(_0x50020d){if(_0x96a587[_0xd9a2('0x58')]['manual']){_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x78')]=util[_0xd9a2('0x60')](_0xd9a2('0x79'),_0x96a587[_0xd9a2('0x62')][_0xd9a2('0x39')]);_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7a')]=_0x416c03['channel'];_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7b')]=_0x416c03[_0xd9a2('0x7a')];_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7c')]=_0xd9a2('0x5c');return respondWithRpcPromise(_0xd9a2('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x416c03[_0xd9a2('0x2a')]},client9002)[_0xd9a2('0x21')](function(){return _0x416c03;});}return _0x416c03;}return null;})[_0xd9a2('0x21')](respondWithResult(_0xb549a9,null))['catch'](handleError(_0xb549a9,null));};var interaction_log=require('../../config/logger')(_0xd9a2('0x7e'));exports[_0xd9a2('0x36')]=function(_0x5df83c,_0x4c1cf3,_0x37e307){var _0x3ae1bc={'agent':{},'channel':_0xd9a2('0x5d')};if(_0x5df83c[_0xd9a2('0x58')]['id']){delete _0x5df83c[_0xd9a2('0x58')]['id'];}_0x5df83c['body'][_0xd9a2('0x61')]=_0x5df83c['body']['UserId']||_0x5df83c[_0xd9a2('0x62')]['id'];_0x3ae1bc[_0xd9a2('0x63')]['id']=_0x5df83c[_0xd9a2('0x58')]['UserId'];return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x5df83c['params']['id'],'UserId':null}})[_0xd9a2('0x21')](handleEntityNotFound(_0x4c1cf3,null))[_0xd9a2('0x21')](function(_0x24eb4b){if(_0x24eb4b){_0x3ae1bc[_0xd9a2('0x2a')]=_0x24eb4b[_0xd9a2('0x64')]({'plain':!![]});return db[_0xd9a2('0x65')][_0xd9a2('0x56')]({'where':{'id':_0x24eb4b['SmsInteractionId']}});}return null;})[_0xd9a2('0x21')](handleEntityNotFound(_0x4c1cf3,null))[_0xd9a2('0x21')](function(_0x5b3735){if(_0x5b3735){_0x3ae1bc[_0xd9a2('0x69')]=_0x5b3735['get']({'plain':!![]});interaction_log[_0xd9a2('0x22')](_0xd9a2('0x7f'),_0x5df83c[_0xd9a2('0x62')]['id'],_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x39')],_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x6b')],_0x3ae1bc[_0xd9a2('0x69')]['id'],_0x5df83c[_0xd9a2('0x58')]?JSON['stringify'](_0x5df83c[_0xd9a2('0x58')]):_0xd9a2('0x80'));return respondWithRpcPromise(_0xd9a2('0x81'),'rejectMessage',_0x3ae1bc);}return null;})[_0xd9a2('0x21')](function(_0x4fb154){var _0x2c9b15=_0xd9a2('0x82')+_0x4fb154[_0xd9a2('0x2a')][_0xd9a2('0x6e')];return db[_0xd9a2('0x6f')][_0xd9a2('0x3e')](_0x2c9b15,{'type':db[_0xd9a2('0x70')][_0xd9a2('0x71')]['SELECT'],'raw':!![]})[_0xd9a2('0x21')](function(_0x1fd236){return _0x1fd236;});})[_0xd9a2('0x21')](function(_0x5ade4d){if(_0x5ade4d){_0x3ae1bc[_0xd9a2('0x2a')][_0xd9a2('0x73')]=_0x5ade4d[0x0];if(!_0x5df83c[_0xd9a2('0x58')][_0xd9a2('0x61')])return;return db[_0xd9a2('0x74')][_0xd9a2('0x56')]({'where':{'id':_0x5df83c[_0xd9a2('0x58')][_0xd9a2('0x61')],'role':_0xd9a2('0x63')},'attributes':['id',_0xd9a2('0x39'),'fullname',_0xd9a2('0x76'),'internal'],'raw':!![]});}return null;})[_0xd9a2('0x21')](function(_0x5e9bdd){if(!_0x5e9bdd)return null;_0x3ae1bc['message'][_0xd9a2('0x63')]=_0x5e9bdd;return _0x3ae1bc;})[_0xd9a2('0x21')](function(_0x339d19){if(_0x339d19){_0x339d19[_0xd9a2('0x2a')]['interface']=util[_0xd9a2('0x60')](_0xd9a2('0x79'),_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x39')]);_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7a')]=_0x3ae1bc['channel'];_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7b')]=_0x3ae1bc[_0xd9a2('0x7a')];_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7c')]=_0xd9a2('0x36');respondWithRpcPromise(_0xd9a2('0x7d'),_0xd9a2('0x7d'),{'event':_0xd9a2('0x83'),'message':_0x339d19[_0xd9a2('0x2a')]},client9002);return _0x3ae1bc;}return null;})['then'](respondWithResult(_0x4c1cf3,null))[_0xd9a2('0x2c')](handleError(_0x4c1cf3,null));};exports['status']=function(_0x4b8b48,_0x1213f1,_0x1dba0c){if(_0x4b8b48[_0xd9a2('0x58')]['id']){delete _0x4b8b48[_0xd9a2('0x58')]['id'];}var _0x35e050;return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x4b8b48['params']['id']}})['then'](handleEntityNotFound(_0x1213f1,null))[_0xd9a2('0x21')](function(_0x6e0fc7){if(_0x6e0fc7){_0x35e050=_0x6e0fc7;return db['SmsAccount'][_0xd9a2('0x56')]({'where':{'id':_0x6e0fc7['SmsAccountId']}});}})[_0xd9a2('0x21')](handleEntityNotFound(_0x1213f1,null))[_0xd9a2('0x21')](function(_0x1dd219){if(_0x1dd219){logger[_0xd9a2('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9a2('0x2e'),_0xd9a2('0x84'),_0x1dd219[_0xd9a2('0x4a')],util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));switch(_0x1dd219[_0xd9a2('0x4a')]){case _0xd9a2('0x86'):if(_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x87')]&&_0x4b8b48[_0xd9a2('0x58')]['MessageSid']===_0x35e050[_0xd9a2('0x88')]){return _0x35e050[_0xd9a2('0x59')]({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),'twilio',util['inspect'](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4b8b48[_0xd9a2('0x58')]['MessageUUID']&&_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x8a')]===_0x35e050[_0xd9a2('0x88')]&&_[_0xd9a2('0x8b')]([_0xd9a2('0x8c'),_0xd9a2('0x8d')],_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x8e')])>=0x0){return _0x35e050['update']({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),_0xd9a2('0x8f'),util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd9a2('0x90'):var _0x460b62=_0x4b8b48['body'][_0xd9a2('0x91')][0x0];if(_0x460b62[_0xd9a2('0x2e')][_0xd9a2('0x92')]===_0xd9a2('0x93')){return _0x35e050['update']({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),_0xd9a2('0x90'),util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x35e050;}})[_0xd9a2('0x21')](respondWithResult(_0x1213f1,null))[_0xd9a2('0x2c')](handleError(_0x1213f1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a97d378..7bbd242 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 _0x396c=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x5a4f3b,_0x344159){var _0x33e973=function(_0x2ff5b0){while(--_0x2ff5b0){_0x5a4f3b['push'](_0x5a4f3b['shift']());}};_0x33e973(++_0x344159);}(_0x396c,0x1db));var _0xc396=function(_0x5f33f5,_0x19ec85){_0x5f33f5=_0x5f33f5-0x0;var _0x1d22ec=_0x396c[_0x5f33f5];return _0x1d22ec;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xc396('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc396('0x1')](0x0);var events={'afterCreate':_0xc396('0x2'),'afterUpdate':_0xc396('0x3'),'afterDestroy':_0xc396('0x4')};function emitEvent(_0x16e27c){return function(_0x2b2f7f,_0x1da0c6,_0x39bce0){SmsMessageEvents[_0xc396('0x5')](_0x16e27c+':'+_0x2b2f7f['id'],_0x2b2f7f);SmsMessageEvents['emit'](_0x16e27c,_0x2b2f7f);_0x39bce0(null);};}for(var e in events){if(events[_0xc396('0x6')](e)){var event=events[e];SmsMessage[_0xc396('0x7')](e,emitEvent(event));}}module[_0xc396('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x4c8b=['setMaxListeners','update','remove','emit','exports','SmsMessage'];(function(_0x543346,_0x2871d9){var _0x53389a=function(_0x2fdc13){while(--_0x2fdc13){_0x543346['push'](_0x543346['shift']());}};_0x53389a(++_0x2871d9);}(_0x4c8b,0xe3));var _0xb4c8=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x4c8b[_0x4452f1];return _0x6cedd0;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xb4c8('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb4c8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4c8('0x2'),'afterDestroy':_0xb4c8('0x3')};function emitEvent(_0x5c4bd8){return function(_0x3e32f8,_0x2c23f6,_0x4da923){SmsMessageEvents[_0xb4c8('0x4')](_0x5c4bd8+':'+_0x3e32f8['id'],_0x3e32f8);SmsMessageEvents[_0xb4c8('0x4')](_0x5c4bd8,_0x3e32f8);_0x4da923(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xb4c8('0x5')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 668e3fb..87e37a5 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 _0x04c0=['total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','authId','remote','format','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','createHash','md5','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','createdAt','catch','SmsAccount','twilio','accountSid','authToken','messages','create','phone','/api/sms/messages/','/status?token=','token','sid','update','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x04c0,0xc0));var _0x004c=function(_0x467405,_0x16143d){_0x467405=_0x467405-0x0;var _0x342c39=_0x04c0[_0x467405];return _0x342c39;};'use strict';var _=require(_0x004c('0x0'));var util=require(_0x004c('0x1'));var logger=require(_0x004c('0x2'))(_0x004c('0x3'));var moment=require(_0x004c('0x4'));var BPromise=require(_0x004c('0x5'));var rp=require(_0x004c('0x6'));var fs=require('fs');var path=require(_0x004c('0x7'));var rimraf=require(_0x004c('0x8'));var config=require(_0x004c('0x9'));var attributes=require(_0x004c('0xa'));module[_0x004c('0xb')]=function(_0x3f334b,_0xb42160){return _0x3f334b[_0x004c('0xc')]('SmsMessage',attributes,{'tableName':_0x004c('0xd'),'paranoid':![],'indexes':[{'name':_0x004c('0xe'),'fields':[_0x004c('0xe')]},{'name':'fti_sms_messages','fields':[_0x004c('0xf')],'type':_0x004c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3963d1,_0xc65ee7,_0x32bbeb){var _0x2796f2=_0x3f334b[_0x004c('0x11')];var _0x352731=_0x3963d1[_0x004c('0x12')]({'plain':!![]});if(_0x352731['direction'][_0x004c('0x13')]()==='in'||_0x352731[_0x004c('0x14')][_0x004c('0x13')]()===_0x004c('0x15')&&!_0x352731[_0x004c('0x16')]&&!_[_0x004c('0x17')](_0x352731[_0x004c('0x18')])&&!_[_0x004c('0x17')](_0x352731[_0x004c('0x19')])){_0x2796f2[_0x004c('0x1a')]['findOne']({'where':{'id':_0x352731['SmsInteractionId']}})[_0x004c('0x1b')](function(_0x44e4b7){if(_0x44e4b7){_0x44e4b7['update']({'lastMsgAt':_0x352731[_0x004c('0x1c')],'lastMsgDirection':_0x352731[_0x004c('0x14')][_0x004c('0x13')]()});}})[_0x004c('0x1d')](function(_0x35f7cd){console['error'](_0x35f7cd);});}if(_0x352731[_0x004c('0x14')]==='out'&&!_0x352731[_0x004c('0x16')]){var _0x1a4555;_0x2796f2[_0x004c('0x1e')]['find']({'where':{'id':_0x352731['SmsAccountId']},'raw':!![]})[_0x004c('0x1b')](function(_0x2ff1a1){_0x1a4555=_0x2ff1a1;if(_0x1a4555&&_0x1a4555['type']){switch(_0x1a4555['type']){case'twilio':var _0x59bce1=require(_0x004c('0x1f'));if(_0x1a4555[_0x004c('0x20')]&&_0x1a4555['authToken']&&_0x1a4555['phone']){var _0x148dcb=new _0x59bce1(_0x1a4555[_0x004c('0x20')],_0x1a4555[_0x004c('0x21')]);_0x148dcb[_0x004c('0x22')][_0x004c('0x23')]({'body':_0x352731[_0x004c('0xf')],'to':_0x352731[_0x004c('0x24')],'from':_0x1a4555[_0x004c('0x24')],'statusCallback':_0x1a4555['remote']+_0x004c('0x25')+_0x352731['id']+_0x004c('0x26')+_0x1a4555[_0x004c('0x27')]})[_0x004c('0x1b')](function(_0x10e1f5){if(_0x10e1f5[_0x004c('0x28')]){return _0x3963d1[_0x004c('0x29')]({'messageId':_0x10e1f5[_0x004c('0x28')]});}})[_0x004c('0x1d')](function(_0x332eee){logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),'twilio',util[_0x004c('0x2d')](_0x332eee,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),'twilio',_0x004c('0x2e'));}break;case _0x004c('0x2f'):var _0x23a22e=_0x004c('0x30');if(_0x1a4555[_0x004c('0x31')]&&_0x1a4555[_0x004c('0x32')]){var _0x2bef6b={'recipient':[_0x352731[_0x004c('0x24')]],'message':_0x352731[_0x004c('0xf')],'message_type':_0x1a4555['smsMethod']};if(_0x1a4555[_0x004c('0x33')]&&_0x1a4555[_0x004c('0x33')]!=='SI'){_0x2bef6b[_0x004c('0x34')]=_0x1a4555[_0x004c('0x24')];}var _0x293da6={'url':_0x23a22e+'login?username='+_0x1a4555[_0x004c('0x31')]+_0x004c('0x35')+_0x1a4555[_0x004c('0x32')],'method':_0x004c('0x36')};rp(_0x293da6)[_0x004c('0x1b')](function(_0x6abe96){var _0x4a1b60=_0x6abe96[_0x004c('0x37')](';');var _0x1892f8={'user_key':_0x4a1b60[0x0],'session_key':_0x4a1b60[0x1]};_0x293da6={'url':_0x23a22e+_0x004c('0x38'),'method':_0x004c('0x39'),'headers':{'user_key':_0x1892f8['user_key'],'Session_key':_0x1892f8['session_key']},'json':!![],'body':_0x2bef6b};return rp(_0x293da6);})[_0x004c('0x1b')](function(_0x46e219){if(_0x46e219[_0x004c('0x3a')]>=0x1){var _0x43cb37={'messageId':_0x46e219['internal_order_id']};if(_0x1a4555[_0x004c('0x33')]!=='GP'||!_0x1a4555['deliveryReport']){_0x43cb37[_0x004c('0x3b')]=!![];}return _0x3963d1[_0x004c('0x29')](_0x43cb37);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x004c('0x2d')](_0x46e219,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2157bb){return logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x2f'),util['inspect'](_0x2157bb,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x004c('0x2c'),_0x004c('0x2f'),_0x004c('0x3c'));}break;case _0x004c('0x3d'):if(_0x1a4555['authToken']){var _0x28b6f7={'recipient':_0x352731[_0x004c('0x24')],'message':_0x352731[_0x004c('0xf')],'sender':_0x1a4555[_0x004c('0x3e')]||_0x1a4555[_0x004c('0x24')],'authorization':_0x1a4555[_0x004c('0x21')]};var _0xc65ee7={'method':'POST','uri':_0x004c('0x3f'),'body':_0x28b6f7,'json':!![]};rp(_0xc65ee7)[_0x004c('0x1b')](function(_0x27df35){var _0x50c3ae={'messageId':_0x27df35[_0x004c('0x40')]};if(!_0x1a4555[_0x004c('0x41')]){_0x50c3ae[_0x004c('0x3b')]=!![];}return _0x3963d1[_0x004c('0x29')](_0x50c3ae);})[_0x004c('0x1d')](function(_0x55d133){logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x3d'),util[_0x004c('0x2d')](_0x55d133,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x004c('0x2c'),_0x004c('0x3d'),_0x004c('0x42'));}break;case _0x004c('0x43'):if(_0x1a4555[_0x004c('0x31')]&&_0x1a4555['password']){var _0x28b6f7={'messages':[{'source':_0x004c('0x44'),'to':_0x352731['phone'],'body':_0x352731[_0x004c('0xf')],'from':_0x1a4555[_0x004c('0x3e')]||_0x1a4555['phone']}]};var _0x31e165=util['format'](_0x004c('0x45'),_0x1a4555[_0x004c('0x31')],_0x1a4555['password']);var _0xc65ee7={'method':_0x004c('0x39'),'uri':_0x004c('0x46'),'body':_0x28b6f7,'headers':{'Authorization':util['format'](_0x004c('0x47'),new Buffer(_0x31e165)[_0x004c('0x48')]('base64'))},'json':!![]};rp(_0xc65ee7)[_0x004c('0x1b')](function(_0x1d9f5d){if(_0x1d9f5d[_0x004c('0x49')]>=0xc8&&_0x1d9f5d[_0x004c('0x49')]<=0xce){if(_0x1d9f5d[_0x004c('0x4a')]&&_0x1d9f5d['data'][_0x004c('0x4b')]>0x0){var _0x120e8c=_[_0x004c('0x4c')](_0x1d9f5d[_0x004c('0x4a')][_0x004c('0x22')]);var _0x583ad5={'messageId':_0x120e8c[_0x004c('0x4d')]};if(!_0x1a4555[_0x004c('0x41')]){_0x583ad5[_0x004c('0x3b')]=!![];}return _0x3963d1[_0x004c('0x29')](_0x583ad5);}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate',_0x004c('0x4e'),util[_0x004c('0x2d')](_0x1d9f5d,{'showHidden':![],'depth':null}));}}else{logger[_0x004c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x004c('0x2c'),_0x004c('0x4e'),util[_0x004c('0x2d')](_0x1d9f5d,{'showHidden':![],'depth':null}));}})[_0x004c('0x1d')](function(_0x1b3b69){logger[_0x004c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x004c('0x2d')](_0x1b3b69,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate',_0x004c('0x4e'),_0x004c('0x3c'));}break;case'plivo':if(_0x1a4555[_0x004c('0x4f')]&&_0x1a4555[_0x004c('0x21')]){var _0x28b6f7={'dst':_0x352731[_0x004c('0x24')],'text':_0x352731[_0x004c('0xf')],'src':_0x1a4555['senderString']||_0x1a4555['phone'],'url':_0x1a4555[_0x004c('0x50')]+'/api/sms/messages/'+_0x352731['id']+'/status?token='+_0x1a4555['token']};var _0x31e165=util['format'](_0x004c('0x45'),_0x1a4555[_0x004c('0x4f')],_0x1a4555['authToken']);var _0xc65ee7={'method':'POST','uri':util[_0x004c('0x51')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1a4555[_0x004c('0x4f')]),'body':_0x28b6f7,'headers':{'Authorization':util[_0x004c('0x51')](_0x004c('0x47'),new Buffer(_0x31e165)[_0x004c('0x48')]('base64'))},'json':!![]};rp(_0xc65ee7)[_0x004c('0x1b')](function(_0x224aff){var _0x5b4c01={'messageId':_0x224aff[_0x004c('0x52')][0x0]};return _0x3963d1[_0x004c('0x29')](_0x5b4c01);})[_0x004c('0x1d')](function(_0x3247e0){logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),'plivo',util[_0x004c('0x2d')](_0x3247e0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x004c('0x2c'),_0x004c('0x53'),_0x004c('0x54'));}break;case _0x004c('0x55'):if(_0x1a4555[_0x004c('0x31')]&&_0x1a4555[_0x004c('0x32')]){if(_0x1a4555[_0x004c('0x56')]){var _0x5cdcfa={'method':_0x004c('0x39'),'uri':_0x1a4555[_0x004c('0x56')]+_0x004c('0x57'),'body':{'username':_0x1a4555['username'],'password':_0x1a4555[_0x004c('0x32')]},'json':!![]};return rp(_0x5cdcfa)['then'](function(_0x43655c){var _0x3d99a2={'method':_0x004c('0x39'),'uri':_0x1a4555[_0x004c('0x56')]+_0x004c('0x58'),'body':{'messages':[{'from':_0x1a4555['phone'],'destinations':[{'to':_0x352731[_0x004c('0x24')]}],'text':_0x352731[_0x004c('0xf')],'notifyUrl':_0x1a4555[_0x004c('0x50')]+_0x004c('0x25')+_0x352731['id']+_0x004c('0x26')+_0x1a4555['token'],'notifyContentType':_0x004c('0x59'),'callbackData':_0x1a4555['phone']+';'+_0x352731['body']}]},'headers':{'Authorization':_0x004c('0x5a')+_0x43655c[_0x004c('0x27')]},'json':!![]};return rp(_0x3d99a2)[_0x004c('0x1b')](function(_0x44170d){if(_0x44170d['messages']){var _0x37fe36={'messageId':_0x44170d[_0x004c('0x22')][0x0][_0x004c('0xe')]};if(!_0x1a4555[_0x004c('0x41')]){_0x37fe36['read']=!![];}return _0x3963d1[_0x004c('0x29')](_0x37fe36);}else{return logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x55'),util['inspect'](_0x44170d,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x210c5c){return logger[_0x004c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x004c('0x2c'),'infobip',util['inspect'](_0x210c5c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x55'),_0x004c('0x5b'));}}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate',_0x004c('0x55'),_0x004c('0x3c'));}break;case _0x004c('0x5c'):var _0x2b3c1a=require('crypto');if(_0x1a4555[_0x004c('0x5d')]){var _0x12d5d={};_0x12d5d['login']=_0x1a4555[_0x004c('0x31')];_0x12d5d[_0x004c('0x24')]=_0x352731[_0x004c('0x24')];_0x12d5d[_0x004c('0x34')]=_0x1a4555[_0x004c('0x24')];_0x12d5d[_0x004c('0x5e')]=_0x352731[_0x004c('0xf')];_0x12d5d[_0x004c('0x5f')]=+new Date();var _0xabe9ee='';var _0x20b83a='';var _0x416668=Object[_0x004c('0x60')](_0x12d5d);_0x416668[_0x004c('0x61')]();for(var _0x2cf074=0x0;_0x2cf074<_0x416668['length'];_0x2cf074++){if(_0xabe9ee!=''){_0xabe9ee+='&';}_0xabe9ee+=_0x416668[_0x2cf074]+'='+encodeURIComponent(_0x12d5d[_0x416668[_0x2cf074]]);_0x20b83a+=_0x12d5d[_0x416668[_0x2cf074]];}_0x20b83a+=_0x1a4555[_0x004c('0x5d')];_0x20b83a=_0x2b3c1a[_0x004c('0x62')](_0x004c('0x63'))[_0x004c('0x29')](_0x20b83a)['digest']('hex');if(_0xabe9ee!==''){_0xabe9ee+='&';}_0xabe9ee+=_0x004c('0x64')+_0x20b83a;var _0x293da6={'method':'GET','uri':_0x1a4555[_0x004c('0x56')]+'/external/get/send.php?'+_0xabe9ee,'json':!![]};return rp(_0x293da6)['then'](function(_0x40360c){var _0x254cb7=Object[_0x004c('0x60')](_0x40360c);if(_0x40360c[_0x254cb7[0x0]]['error']&&parseInt(_0x40360c[_0x254cb7[0x0]][_0x004c('0x2a')])===0x0){var _0x1e8d02={'messageId':_0x40360c[_0x254cb7[0x0]][_0x004c('0x65')]};if(!_0x1a4555[_0x004c('0x41')]){_0x1e8d02[_0x004c('0x3b')]=!![];}return _0x3963d1[_0x004c('0x29')](_0x1e8d02);}else{return logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x5c'),util[_0x004c('0x2d')](_0x40360c['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x186e3e){return logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),'csc',util[_0x004c('0x2d')](_0x186e3e,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate',_0x004c('0x5c'),_0x004c('0x66'));}break;case _0x004c('0x67'):if(_0x1a4555[_0x004c('0x5d')]){var _0x21c50a={'method':_0x004c('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x1a4555['apiKey']},'body':{'content':_0x352731[_0x004c('0xf')],'to':[_0x352731[_0x004c('0x24')]],'from':_0x1a4555[_0x004c('0x24')],'binary':![],'clientMessageId':_0x004c('0x68'),'charset':_0x004c('0x69')},'json':!![]};rp(_0x21c50a)[_0x004c('0x1b')](function(_0x1d8b7c){if(!_0x1d8b7c['error']){var _0x14eeb4={'messageId':_0x1d8b7c[_0x004c('0x22')][0x0][_0x004c('0x6a')]};if(!_0x1a4555[_0x004c('0x41')]){_0x14eeb4[_0x004c('0x3b')]=!![];}return _0x3963d1[_0x004c('0x29')](_0x14eeb4);}else{return logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate',_0x004c('0x67'),util[_0x004c('0x2d')](_0x1d8b7c[_0x004c('0x2a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x343a89){return logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x67'),util['inspect'](_0x343a89,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x67'),'Missing\x20parameters:\x20apiKey');}break;case _0x004c('0x6b'):if(_0x1a4555['username']&&_0x1a4555[_0x004c('0x32')]){var _0x31e165=util[_0x004c('0x51')](_0x004c('0x45'),_0x1a4555[_0x004c('0x31')],_0x1a4555[_0x004c('0x32')]);var _0xc65ee7={'method':_0x004c('0x39'),'uri':_0x004c('0x6c')+_0x1a4555[_0x004c('0x6d')]+_0x004c('0x6e'),'body':{'to':[_0x352731[_0x004c('0x24')]],'text':_0x352731[_0x004c('0xf')],'from':_0x1a4555[_0x004c('0x24')],'applicationId':_0x1a4555[_0x004c('0x6f')]},'headers':{'Authorization':util[_0x004c('0x51')](_0x004c('0x47'),new Buffer(_0x31e165)[_0x004c('0x48')](_0x004c('0x70')))},'json':!![]};rp(_0xc65ee7)[_0x004c('0x1b')](function(_0x368de7){if(_0x368de7['id']){var _0x216da4={'messageId':_0x368de7['id']};return _0x3963d1[_0x004c('0x29')](_0x216da4);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x004c('0x6b'),util[_0x004c('0x2d')](_0x368de7,{'showHidden':![],'depth':null}));}})[_0x004c('0x1d')](function(_0x3397ac){logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x6b'),util[_0x004c('0x2d')](_0x3397ac,{'showHidden':![],'depth':null}));});}else{logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate','bandwidth',_0x004c('0x3c'));}break;case _0x004c('0x71'):if(_0x1a4555['apiKey']){var _0x2338ca={};var _0x293da6={'method':_0x004c('0x39'),'uri':_0x004c('0x72'),'headers':{'Authorization':_0x004c('0x73')+_0x1a4555[_0x004c('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x1a4555[_0x004c('0x24')],'to':_0x352731['phone'],'text':_0x352731[_0x004c('0xf')]},'json':!![]};return rp(_0x293da6)[_0x004c('0x1b')](function(_0x1762f5){if(_0x1762f5[_0x004c('0x74')]==0xca){_0x2338ca['message']=_0x1762f5;var _0x2c9698={'method':_0x004c('0x39'),'uri':_0x004c('0x75'),'headers':{'Authorization':_0x004c('0x73')+_0x1a4555[_0x004c('0x5d')],'Content-Type':_0x004c('0x59')},'body':{'refid':_0x2338ca[_0x004c('0x76')][_0x004c('0x77')]},'json':!![]};return rp(_0x2c9698)[_0x004c('0x1b')](function(_0xf64c87){_0x2338ca[_0x004c('0x78')]=_0xf64c87;var _0x5f586d={'messageId':_0x2338ca[_0x004c('0x76')]['refid'],'read':!![]};return _0x3963d1['update'](_0x5f586d);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x004c('0x71'),util[_0x004c('0x2d')](_0x1762f5,{'showHidden':![],'depth':null}));}})[_0x004c('0x1d')](function(_0x428594){return logger[_0x004c('0x2a')](_0x004c('0x2b'),'afterCreate',_0x004c('0x71'),util[_0x004c('0x2d')](_0x428594,{'showHidden':![],'depth':null}));});}else{return logger[_0x004c('0x2a')](_0x004c('0x2b'),_0x004c('0x2c'),_0x004c('0x71'),_0x004c('0x79'));}break;}}})[_0x004c('0x7a')](function(){_0x32bbeb();});}else{_0x32bbeb();}}},'charset':_0x004c('0x7b'),'collate':_0x004c('0x7c')});}; \ No newline at end of file +var _0x05b8=['base64','http_code','data','head','messages','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','apiKey','createHash','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','type','twilio','accountSid','authToken','phone','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','clicksend','password','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x05b8,0x190));var _0x805b=function(_0x499ab9,_0x7c1cdd){_0x499ab9=_0x499ab9-0x0;var _0x2ce335=_0x05b8[_0x499ab9];return _0x2ce335;};'use strict';var _=require(_0x805b('0x0'));var util=require(_0x805b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x805b('0x2'));var BPromise=require(_0x805b('0x3'));var rp=require(_0x805b('0x4'));var fs=require('fs');var path=require(_0x805b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x805b('0x6')]=function(_0x176628,_0x498f53){return _0x176628['define'](_0x805b('0x7'),attributes,{'tableName':_0x805b('0x8'),'paranoid':![],'indexes':[{'name':_0x805b('0x9'),'fields':['messageId']},{'name':_0x805b('0xa'),'fields':[_0x805b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x486564,_0x5a01de,_0x526440){var _0x1254c2=_0x176628[_0x805b('0xc')];var _0x17ca49=_0x486564[_0x805b('0xd')]({'plain':!![]});if(_0x17ca49[_0x805b('0xe')][_0x805b('0xf')]()==='in'||_0x17ca49[_0x805b('0xe')][_0x805b('0xf')]()===_0x805b('0x10')&&!_0x17ca49[_0x805b('0x11')]&&!_[_0x805b('0x12')](_0x17ca49[_0x805b('0x13')])&&!_[_0x805b('0x12')](_0x17ca49[_0x805b('0x14')])){_0x1254c2[_0x805b('0x15')][_0x805b('0x16')]({'where':{'id':_0x17ca49[_0x805b('0x14')]}})[_0x805b('0x17')](function(_0x5b4b31){if(_0x5b4b31){_0x5b4b31[_0x805b('0x18')]({'lastMsgAt':_0x17ca49[_0x805b('0x19')],'lastMsgDirection':_0x17ca49[_0x805b('0xe')][_0x805b('0xf')]()});}})[_0x805b('0x1a')](function(_0x4c9662){console['error'](_0x4c9662);});}if(_0x17ca49[_0x805b('0xe')]===_0x805b('0x10')&&!_0x17ca49[_0x805b('0x11')]){var _0x30cc1e;_0x1254c2[_0x805b('0x1b')][_0x805b('0x1c')]({'where':{'id':_0x17ca49['SmsAccountId']},'raw':!![]})[_0x805b('0x17')](function(_0x4110a5){_0x30cc1e=_0x4110a5;if(_0x30cc1e&&_0x30cc1e[_0x805b('0x1d')]){switch(_0x30cc1e['type']){case _0x805b('0x1e'):var _0x132f96=require(_0x805b('0x1e'));if(_0x30cc1e[_0x805b('0x1f')]&&_0x30cc1e[_0x805b('0x20')]&&_0x30cc1e[_0x805b('0x21')]){var _0x4def66=new _0x132f96(_0x30cc1e[_0x805b('0x1f')],_0x30cc1e[_0x805b('0x20')]);_0x4def66['messages']['create']({'body':_0x17ca49[_0x805b('0xb')],'to':_0x17ca49[_0x805b('0x21')],'from':_0x30cc1e[_0x805b('0x21')],'statusCallback':_0x30cc1e['remote']+_0x805b('0x22')+_0x17ca49['id']+_0x805b('0x23')+_0x30cc1e[_0x805b('0x24')]})[_0x805b('0x17')](function(_0x405789){if(_0x405789['sid']){return _0x486564[_0x805b('0x18')]({'messageId':_0x405789[_0x805b('0x25')]});}})['catch'](function(_0x4578c5){logger[_0x805b('0x26')](_0x805b('0x27'),'afterCreate',_0x805b('0x1e'),util[_0x805b('0x28')](_0x4578c5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x1e'),_0x805b('0x2a'));}break;case _0x805b('0x2b'):var _0x482a98=_0x805b('0x2c');if(_0x30cc1e['username']&&_0x30cc1e['password']){var _0x369626={'recipient':[_0x17ca49[_0x805b('0x21')]],'message':_0x17ca49[_0x805b('0xb')],'message_type':_0x30cc1e[_0x805b('0x2d')]};if(_0x30cc1e[_0x805b('0x2d')]&&_0x30cc1e[_0x805b('0x2d')]!=='SI'){_0x369626[_0x805b('0x2e')]=_0x30cc1e[_0x805b('0x21')];}var _0x579aa8={'url':_0x482a98+_0x805b('0x2f')+_0x30cc1e[_0x805b('0x30')]+_0x805b('0x31')+_0x30cc1e['password'],'method':_0x805b('0x32')};rp(_0x579aa8)[_0x805b('0x17')](function(_0x32a671){var _0x473cec=_0x32a671[_0x805b('0x33')](';');var _0x2983a6={'user_key':_0x473cec[0x0],'session_key':_0x473cec[0x1]};_0x579aa8={'url':_0x482a98+_0x805b('0x34'),'method':_0x805b('0x35'),'headers':{'user_key':_0x2983a6[_0x805b('0x36')],'Session_key':_0x2983a6['session_key']},'json':!![],'body':_0x369626};return rp(_0x579aa8);})[_0x805b('0x17')](function(_0x285156){if(_0x285156[_0x805b('0x37')]>=0x1){var _0x5c7df1={'messageId':_0x285156['internal_order_id']};if(_0x30cc1e[_0x805b('0x2d')]!=='GP'||!_0x30cc1e[_0x805b('0x38')]){_0x5c7df1[_0x805b('0x39')]=!![];}return _0x486564[_0x805b('0x18')](_0x5c7df1);}else{return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x2b'),util[_0x805b('0x28')](_0x285156,{'showHidden':![],'depth':null}));}})['catch'](function(_0x12a129){return logger['error'](_0x805b('0x27'),_0x805b('0x29'),'skebby',util[_0x805b('0x28')](_0x12a129,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x2b'),_0x805b('0x3a'));}break;case _0x805b('0x3b'):if(_0x30cc1e[_0x805b('0x20')]){var _0x3daa40={'recipient':_0x17ca49[_0x805b('0x21')],'message':_0x17ca49[_0x805b('0xb')],'sender':_0x30cc1e['senderString']||_0x30cc1e[_0x805b('0x21')],'authorization':_0x30cc1e[_0x805b('0x20')]};var _0x5a01de={'method':_0x805b('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3daa40,'json':!![]};rp(_0x5a01de)[_0x805b('0x17')](function(_0x3404ff){var _0x241b3c={'messageId':_0x3404ff['requestid']};if(!_0x30cc1e[_0x805b('0x38')]){_0x241b3c[_0x805b('0x39')]=!![];}return _0x486564[_0x805b('0x18')](_0x241b3c);})[_0x805b('0x1a')](function(_0x5b58a9){logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x3b'),util['inspect'](_0x5b58a9,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x805b('0x3c'):if(_0x30cc1e[_0x805b('0x30')]&&_0x30cc1e[_0x805b('0x3d')]){var _0x3daa40={'messages':[{'source':'xCALLY\x20Motion','to':_0x17ca49[_0x805b('0x21')],'body':_0x17ca49[_0x805b('0xb')],'from':_0x30cc1e[_0x805b('0x3e')]||_0x30cc1e['phone']}]};var _0x56bb3e=util[_0x805b('0x3f')](_0x805b('0x40'),_0x30cc1e[_0x805b('0x30')],_0x30cc1e[_0x805b('0x3d')]);var _0x5a01de={'method':'POST','uri':_0x805b('0x41'),'body':_0x3daa40,'headers':{'Authorization':util[_0x805b('0x3f')](_0x805b('0x42'),new Buffer(_0x56bb3e)[_0x805b('0x43')](_0x805b('0x44')))},'json':!![]};rp(_0x5a01de)[_0x805b('0x17')](function(_0x2554ea){if(_0x2554ea[_0x805b('0x45')]>=0xc8&&_0x2554ea[_0x805b('0x45')]<=0xce){if(_0x2554ea[_0x805b('0x46')]&&_0x2554ea['data']['queued_count']>0x0){var _0x1d10ef=_[_0x805b('0x47')](_0x2554ea[_0x805b('0x46')][_0x805b('0x48')]);var _0x1d18a0={'messageId':_0x1d10ef['message_id']};if(!_0x30cc1e[_0x805b('0x38')]){_0x1d18a0[_0x805b('0x39')]=!![];}return _0x486564['update'](_0x1d18a0);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x49'),util[_0x805b('0x28')](_0x2554ea,{'showHidden':![],'depth':null}));}}else{logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x805b('0x49'),util[_0x805b('0x28')](_0x2554ea,{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x16dd6c){logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),'clickSend',util[_0x805b('0x28')](_0x16dd6c,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x805b('0x4a'):if(_0x30cc1e[_0x805b('0x4b')]&&_0x30cc1e[_0x805b('0x20')]){var _0x3daa40={'dst':_0x17ca49['phone'],'text':_0x17ca49['body'],'src':_0x30cc1e[_0x805b('0x3e')]||_0x30cc1e[_0x805b('0x21')],'url':_0x30cc1e[_0x805b('0x4c')]+_0x805b('0x22')+_0x17ca49['id']+'/status?token='+_0x30cc1e[_0x805b('0x24')]};var _0x56bb3e=util[_0x805b('0x3f')](_0x805b('0x40'),_0x30cc1e['authId'],_0x30cc1e[_0x805b('0x20')]);var _0x5a01de={'method':_0x805b('0x35'),'uri':util[_0x805b('0x3f')](_0x805b('0x4d'),_0x30cc1e[_0x805b('0x4b')]),'body':_0x3daa40,'headers':{'Authorization':util[_0x805b('0x3f')]('Basic\x20%s',new Buffer(_0x56bb3e)[_0x805b('0x43')](_0x805b('0x44')))},'json':!![]};rp(_0x5a01de)[_0x805b('0x17')](function(_0x26577){var _0x134711={'messageId':_0x26577[_0x805b('0x4e')][0x0]};return _0x486564[_0x805b('0x18')](_0x134711);})[_0x805b('0x1a')](function(_0x4fed80){logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x4a'),util[_0x805b('0x28')](_0x4fed80,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),'plivo',_0x805b('0x4f'));}break;case _0x805b('0x50'):if(_0x30cc1e[_0x805b('0x30')]&&_0x30cc1e[_0x805b('0x3d')]){if(_0x30cc1e[_0x805b('0x51')]){var _0x112566={'method':_0x805b('0x35'),'uri':_0x30cc1e[_0x805b('0x51')]+_0x805b('0x52'),'body':{'username':_0x30cc1e[_0x805b('0x30')],'password':_0x30cc1e[_0x805b('0x3d')]},'json':!![]};return rp(_0x112566)[_0x805b('0x17')](function(_0x4a4683){var _0x282145={'method':'POST','uri':_0x30cc1e['baseUrl']+_0x805b('0x53'),'body':{'messages':[{'from':_0x30cc1e[_0x805b('0x21')],'destinations':[{'to':_0x17ca49[_0x805b('0x21')]}],'text':_0x17ca49[_0x805b('0xb')],'notifyUrl':_0x30cc1e[_0x805b('0x4c')]+_0x805b('0x22')+_0x17ca49['id']+_0x805b('0x23')+_0x30cc1e[_0x805b('0x24')],'notifyContentType':_0x805b('0x54'),'callbackData':_0x30cc1e['phone']+';'+_0x17ca49[_0x805b('0xb')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x4a4683[_0x805b('0x24')]},'json':!![]};return rp(_0x282145)['then'](function(_0x2675b5){if(_0x2675b5[_0x805b('0x48')]){var _0x13dd9e={'messageId':_0x2675b5[_0x805b('0x48')][0x0]['messageId']};if(!_0x30cc1e[_0x805b('0x38')]){_0x13dd9e['read']=!![];}return _0x486564[_0x805b('0x18')](_0x13dd9e);}else{return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x50'),util[_0x805b('0x28')](_0x2675b5,{'showHidden':![],'depth':null}));}});})[_0x805b('0x1a')](function(_0x337198){return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x50'),util['inspect'](_0x337198,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x50'),_0x805b('0x55'));}}else{logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x50'),_0x805b('0x3a'));}break;case _0x805b('0x56'):var _0x34ee16=require(_0x805b('0x57'));if(_0x30cc1e['apiKey']){var _0x426e1b={};_0x426e1b[_0x805b('0x58')]=_0x30cc1e[_0x805b('0x30')];_0x426e1b['phone']=_0x17ca49[_0x805b('0x21')];_0x426e1b[_0x805b('0x2e')]=_0x30cc1e[_0x805b('0x21')];_0x426e1b[_0x805b('0x59')]=_0x17ca49['body'];_0x426e1b['timestamp']=+new Date();var _0xfd3e4f='';var _0x4896e0='';var _0x5b2af1=Object[_0x805b('0x5a')](_0x426e1b);_0x5b2af1[_0x805b('0x5b')]();for(var _0x3ea14e=0x0;_0x3ea14e<_0x5b2af1['length'];_0x3ea14e++){if(_0xfd3e4f!=''){_0xfd3e4f+='&';}_0xfd3e4f+=_0x5b2af1[_0x3ea14e]+'='+encodeURIComponent(_0x426e1b[_0x5b2af1[_0x3ea14e]]);_0x4896e0+=_0x426e1b[_0x5b2af1[_0x3ea14e]];}_0x4896e0+=_0x30cc1e[_0x805b('0x5c')];_0x4896e0=_0x34ee16[_0x805b('0x5d')]('md5')[_0x805b('0x18')](_0x4896e0)[_0x805b('0x5e')](_0x805b('0x5f'));if(_0xfd3e4f!==''){_0xfd3e4f+='&';}_0xfd3e4f+=_0x805b('0x60')+_0x4896e0;var _0x579aa8={'method':_0x805b('0x32'),'uri':_0x30cc1e[_0x805b('0x51')]+'/external/get/send.php?'+_0xfd3e4f,'json':!![]};return rp(_0x579aa8)[_0x805b('0x17')](function(_0x4f514d){var _0x5dd370=Object[_0x805b('0x5a')](_0x4f514d);if(_0x4f514d[_0x5dd370[0x0]][_0x805b('0x26')]&&parseInt(_0x4f514d[_0x5dd370[0x0]][_0x805b('0x26')])===0x0){var _0x36191d={'messageId':_0x4f514d[_0x5dd370[0x0]][_0x805b('0x61')]};if(!_0x30cc1e[_0x805b('0x38')]){_0x36191d['read']=!![];}return _0x486564[_0x805b('0x18')](_0x36191d);}else{return logger['error'](_0x805b('0x27'),'afterCreate',_0x805b('0x56'),util[_0x805b('0x28')](_0x4f514d[_0x805b('0x26')],{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x52df7b){return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x56'),util[_0x805b('0x28')](_0x52df7b,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),'csc',_0x805b('0x62'));}break;case _0x805b('0x63'):if(_0x30cc1e['apiKey']){var _0x2548bb={'method':'POST','uri':_0x805b('0x64'),'headers':{'Authorization':_0x30cc1e[_0x805b('0x5c')]},'body':{'content':_0x17ca49['body'],'to':[_0x17ca49[_0x805b('0x21')]],'from':_0x30cc1e['phone'],'binary':![],'clientMessageId':_0x805b('0x65'),'charset':_0x805b('0x66')},'json':!![]};rp(_0x2548bb)[_0x805b('0x17')](function(_0x2bb665){if(!_0x2bb665[_0x805b('0x26')]){var _0x269262={'messageId':_0x2bb665[_0x805b('0x48')][0x0][_0x805b('0x67')]};if(!_0x30cc1e[_0x805b('0x38')]){_0x269262['read']=!![];}return _0x486564[_0x805b('0x18')](_0x269262);}else{return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x63'),util[_0x805b('0x28')](_0x2bb665[_0x805b('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8d544d){return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x805b('0x63'),util[_0x805b('0x28')](_0x8d544d,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x30cc1e['username']&&_0x30cc1e[_0x805b('0x3d')]){var _0x56bb3e=util[_0x805b('0x3f')](_0x805b('0x40'),_0x30cc1e[_0x805b('0x30')],_0x30cc1e[_0x805b('0x3d')]);var _0x5a01de={'method':_0x805b('0x35'),'uri':_0x805b('0x68')+_0x30cc1e[_0x805b('0x69')]+_0x805b('0x6a'),'body':{'to':[_0x17ca49[_0x805b('0x21')]],'text':_0x17ca49['body'],'from':_0x30cc1e[_0x805b('0x21')],'applicationId':_0x30cc1e[_0x805b('0x6b')]},'headers':{'Authorization':util[_0x805b('0x3f')]('Basic\x20%s',new Buffer(_0x56bb3e)[_0x805b('0x43')](_0x805b('0x44')))},'json':!![]};rp(_0x5a01de)['then'](function(_0x171f91){if(_0x171f91['id']){var _0x3b1fc0={'messageId':_0x171f91['id']};return _0x486564[_0x805b('0x18')](_0x3b1fc0);}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6c'),util[_0x805b('0x28')](_0x171f91,{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x1ef59a){logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6c'),util['inspect'](_0x1ef59a,{'showHidden':![],'depth':null}));});}else{logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6c'),_0x805b('0x3a'));}break;case _0x805b('0x6d'):if(_0x30cc1e[_0x805b('0x5c')]){var _0x2c2102={};var _0x579aa8={'method':_0x805b('0x35'),'uri':_0x805b('0x6e'),'headers':{'Authorization':_0x805b('0x6f')+_0x30cc1e[_0x805b('0x5c')],'Content-Type':_0x805b('0x54')},'body':{'from':_0x30cc1e[_0x805b('0x21')],'to':_0x17ca49[_0x805b('0x21')],'text':_0x17ca49['body']},'json':!![]};return rp(_0x579aa8)[_0x805b('0x17')](function(_0x2b05c2){if(_0x2b05c2['code']==0xca){_0x2c2102[_0x805b('0x70')]=_0x2b05c2;var _0x14004d={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x805b('0x6f')+_0x30cc1e[_0x805b('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x2c2102[_0x805b('0x70')]['refid']},'json':!![]};return rp(_0x14004d)[_0x805b('0x17')](function(_0x30b1c6){_0x2c2102['status']=_0x30b1c6;var _0x517c61={'messageId':_0x2c2102[_0x805b('0x70')]['refid'],'read':!![]};return _0x486564[_0x805b('0x18')](_0x517c61);});}else{return logger['error'](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6d'),util['inspect'](_0x2b05c2,{'showHidden':![],'depth':null}));}})[_0x805b('0x1a')](function(_0x2c4544){return logger[_0x805b('0x26')](_0x805b('0x27'),_0x805b('0x29'),_0x805b('0x6d'),util[_0x805b('0x28')](_0x2c4544,{'showHidden':![],'depth':null}));});}else{return logger[_0x805b('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x805b('0x29'),_0x805b('0x6d'),_0x805b('0x71'));}break;}}})[_0x805b('0x72')](function(){_0x526440();});}else{_0x526440();}}},'charset':_0x805b('0x73'),'collate':_0x805b('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3b96a91..c0f7a0a 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 _0x463e=['CreateSmsMessage','SmsMessage','create','options','raw','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x33051f,_0x161df3){var _0x6f841f=function(_0xb21a39){while(--_0xb21a39){_0x33051f['push'](_0x33051f['shift']());}};_0x6f841f(++_0x161df3);}(_0x463e,0x10b));var _0xe463=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x463e[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xe463('0x0'));var util=require('util');var moment=require(_0xe463('0x1'));var BPromise=require(_0xe463('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe463('0x3'));var logger=require(_0xe463('0x4'))(_0xe463('0x5'));var config=require('../../config/environment');var jayson=require(_0xe463('0x6'));var client=jayson['client'][_0xe463('0x7')]({'port':0x232a});config[_0xe463('0x8')]=_[_0xe463('0x9')](config[_0xe463('0x8')],{'host':_0xe463('0xa'),'port':0x18eb});var socket=require(_0xe463('0xb'))(new Redis(config[_0xe463('0x8')]));require('./smsMessage.socket')[_0xe463('0xc')](socket);function respondWithRpcPromise(_0x47fe71,_0x4fbd06,_0x3aa651){return new BPromise(function(_0x7ec2c3,_0x59961c){return client[_0xe463('0xd')](_0x47fe71,_0x3aa651)[_0xe463('0xe')](function(_0x5b78b1){logger[_0xe463('0xf')](_0xe463('0x10'),_0x4fbd06,_0xe463('0x11'));logger[_0xe463('0x12')](_0xe463('0x13'),_0x4fbd06,_0xe463('0x11'),JSON['stringify'](_0x5b78b1));if(_0x5b78b1['error']){if(_0x5b78b1[_0xe463('0x14')][_0xe463('0x15')]===0x1f4){logger['error'](_0xe463('0x10'),_0x4fbd06,_0x5b78b1['error']['message']);return _0x59961c(_0x5b78b1['error'][_0xe463('0x16')]);}logger[_0xe463('0x14')](_0xe463('0x10'),_0x4fbd06,_0x5b78b1[_0xe463('0x14')][_0xe463('0x16')]);return _0x7ec2c3(_0x5b78b1[_0xe463('0x14')]['message']);}else{logger[_0xe463('0xf')](_0xe463('0x10'),_0x4fbd06,_0xe463('0x11'));_0x7ec2c3(_0x5b78b1['result'][_0xe463('0x16')]);}})['catch'](function(_0x16e613){logger[_0xe463('0x14')](_0xe463('0x10'),_0x4fbd06,_0x16e613);_0x59961c(_0x16e613);});});}exports[_0xe463('0x17')]=function(_0x39f373){var _0x2b2d93=this;return new Promise(function(_0x3933b7,_0x32eae6){return db[_0xe463('0x18')][_0xe463('0x19')](_0x39f373['body'],{'raw':_0x39f373[_0xe463('0x1a')]?_0x39f373[_0xe463('0x1a')][_0xe463('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22cb2f){logger[_0xe463('0xf')](_0xe463('0x17'),_0x39f373);logger[_0xe463('0x12')]('CreateSmsMessage',_0x39f373,JSON['stringify'](_0x22cb2f));_0x3933b7(_0x22cb2f);})[_0xe463('0x1c')](function(_0x7765f){logger[_0xe463('0x14')]('CreateSmsMessage',_0x7765f[_0xe463('0x16')],_0x39f373);_0x32eae6(_0x2b2d93[_0xe463('0x14')](0x1f4,_0x7765f[_0xe463('0x16')]));});});}; \ No newline at end of file +var _0x38f0=['socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x38f0,0x114));var _0x038f=function(_0x3293c1,_0x1add7d){_0x3293c1=_0x3293c1-0x0;var _0x3fc954=_0x38f0[_0x3293c1];return _0x3fc954;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x038f('0x0'));var BPromise=require(_0x038f('0x1'));var rs=require(_0x038f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x038f('0x3'));var logger=require(_0x038f('0x4'))(_0x038f('0x5'));var config=require(_0x038f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x038f('0x7')][_0x038f('0x8')]({'port':0x232a});config['redis']=_[_0x038f('0x9')](config[_0x038f('0xa')],{'host':_0x038f('0xb'),'port':0x18eb});var socket=require(_0x038f('0xc'))(new Redis(config[_0x038f('0xa')]));require(_0x038f('0xd'))['register'](socket);function respondWithRpcPromise(_0x58a417,_0x4db23c,_0x2394b7){return new BPromise(function(_0x7ff248,_0x30d650){return client[_0x038f('0xe')](_0x58a417,_0x2394b7)['then'](function(_0x5c1d0c){logger[_0x038f('0xf')](_0x038f('0x10'),_0x4db23c,_0x038f('0x11'));logger[_0x038f('0x12')](_0x038f('0x13'),_0x4db23c,_0x038f('0x11'),JSON[_0x038f('0x14')](_0x5c1d0c));if(_0x5c1d0c['error']){if(_0x5c1d0c[_0x038f('0x15')][_0x038f('0x16')]===0x1f4){logger['error'](_0x038f('0x10'),_0x4db23c,_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);return _0x30d650(_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);}logger[_0x038f('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4db23c,_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);return _0x7ff248(_0x5c1d0c[_0x038f('0x15')][_0x038f('0x17')]);}else{logger[_0x038f('0xf')](_0x038f('0x10'),_0x4db23c,'request\x20sent');_0x7ff248(_0x5c1d0c[_0x038f('0x18')][_0x038f('0x17')]);}})[_0x038f('0x19')](function(_0x26a8be){logger[_0x038f('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4db23c,_0x26a8be);_0x30d650(_0x26a8be);});});}exports[_0x038f('0x1a')]=function(_0x53480f){var _0x513f2a=this;return new Promise(function(_0x32199c,_0x8c9cef){return db[_0x038f('0x1b')][_0x038f('0x1c')](_0x53480f[_0x038f('0x1d')],{'raw':_0x53480f[_0x038f('0x1e')]?_0x53480f[_0x038f('0x1e')][_0x038f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1552b1){logger[_0x038f('0xf')](_0x038f('0x1a'),_0x53480f);logger[_0x038f('0x12')](_0x038f('0x1a'),_0x53480f,JSON['stringify'](_0x1552b1));_0x32199c(_0x1552b1);})[_0x038f('0x19')](function(_0x41b3d3){logger['error'](_0x038f('0x1a'),_0x41b3d3[_0x038f('0x17')],_0x53480f);_0x8c9cef(_0x513f2a[_0x038f('0x15')](0x1f4,_0x41b3d3[_0x038f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c24fa86..bc024dd 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 _0x7b60=['save','removeListener','register','length','smsMessage:'];(function(_0x32d225,_0x459300){var _0x22293b=function(_0x27cc1c){while(--_0x27cc1c){_0x32d225['push'](_0x32d225['shift']());}};_0x22293b(++_0x459300);}(_0x7b60,0x64));var _0x07b6=function(_0x37c637,_0x859c6b){_0x37c637=_0x37c637-0x0;var _0x318b6a=_0x7b60[_0x37c637];return _0x318b6a;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x07b6('0x0'),'remove','update'];function createListener(_0x5b3434,_0x10658b){return function(_0x17cbe8){_0x10658b['emit'](_0x5b3434,_0x17cbe8);};}function removeListener(_0x36474d,_0x333bfc){return function(){SmsMessageEvents[_0x07b6('0x1')](_0x36474d,_0x333bfc);};}exports[_0x07b6('0x2')]=function(_0x23caec){for(var _0x5bc56b=0x0,_0x4ca2b1=events[_0x07b6('0x3')];_0x5bc56b<_0x4ca2b1;_0x5bc56b++){var _0x4e0398=events[_0x5bc56b];var _0xf6b566=createListener(_0x07b6('0x4')+_0x4e0398,_0x23caec);SmsMessageEvents['on'](_0x4e0398,_0xf6b566);}}; \ No newline at end of file +var _0x4aa5=['length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener','register'];(function(_0x16566d,_0x532597){var _0x1e235b=function(_0x5cc12f){while(--_0x5cc12f){_0x16566d['push'](_0x16566d['shift']());}};_0x1e235b(++_0x532597);}(_0x4aa5,0x1da));var _0x54aa=function(_0x32d54b,_0x3fd338){_0x32d54b=_0x32d54b-0x0;var _0x3d8958=_0x4aa5[_0x32d54b];return _0x3d8958;};'use strict';var SmsMessageEvents=require(_0x54aa('0x0'));var events=[_0x54aa('0x1'),_0x54aa('0x2'),'update'];function createListener(_0xd27791,_0x5e0bcf){return function(_0x21e386){_0x5e0bcf[_0x54aa('0x3')](_0xd27791,_0x21e386);};}function removeListener(_0x32a87e,_0x1d1204){return function(){SmsMessageEvents[_0x54aa('0x4')](_0x32a87e,_0x1d1204);};}exports[_0x54aa('0x5')]=function(_0x1380f7){for(var _0x46162c=0x0,_0xa1234f=events[_0x54aa('0x6')];_0x46162c<_0xa1234f;_0x46162c++){var _0x40245d=events[_0x46162c];var _0x622f4f=createListener(_0x54aa('0x7')+_0x40245d,_0x1380f7);SmsMessageEvents['on'](_0x40245d,_0x622f4f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c3a41fc..8dd319d 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 _0xdd44=['post','create','addTeams','/:id/users','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0xdd44,0x1d9));var _0x4dd4=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xdd44[_0x102b0c];return _0x9b15ca;};'use strict';var multer=require('multer');var util=require(_0x4dd4('0x0'));var path=require(_0x4dd4('0x1'));var timeout=require(_0x4dd4('0x2'));var express=require(_0x4dd4('0x3'));var router=express[_0x4dd4('0x4')]();var fs_extra=require(_0x4dd4('0x5'));var auth=require(_0x4dd4('0x6'));var interaction=require(_0x4dd4('0x7'));var config=require(_0x4dd4('0x8'));var controller=require(_0x4dd4('0x9'));router[_0x4dd4('0xa')]('/',auth[_0x4dd4('0xb')](),controller['index']);router[_0x4dd4('0xa')](_0x4dd4('0xc'),auth['isAuthenticated'](),controller[_0x4dd4('0xd')]);router[_0x4dd4('0xa')](_0x4dd4('0xe'),auth[_0x4dd4('0xb')](),controller[_0x4dd4('0xf')]);router[_0x4dd4('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x4dd4('0x10')]);router[_0x4dd4('0xa')](_0x4dd4('0x11'),auth['isAuthenticated'](),controller[_0x4dd4('0x12')]);router[_0x4dd4('0xa')]('/:id/users',auth[_0x4dd4('0xb')](),controller[_0x4dd4('0x13')]);router[_0x4dd4('0x14')]('/',auth[_0x4dd4('0xb')](),controller[_0x4dd4('0x15')]);router['post'](_0x4dd4('0x11'),auth[_0x4dd4('0xb')](),controller[_0x4dd4('0x16')]);router[_0x4dd4('0x14')](_0x4dd4('0x17'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x4dd4('0xe'),auth[_0x4dd4('0xb')](),controller[_0x4dd4('0x18')]);router[_0x4dd4('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x4dd4('0x19')](_0x4dd4('0x11'),auth[_0x4dd4('0xb')](),controller[_0x4dd4('0x1a')]);router['delete']('/:id/users',auth[_0x4dd4('0xb')](),controller[_0x4dd4('0x1b')]);module[_0x4dd4('0x1c')]=router; \ No newline at end of file +var _0xef1f=['addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./smsQueue.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x1d889e,_0x3cf023){var _0x37c76b=function(_0x316a3b){while(--_0x316a3b){_0x1d889e['push'](_0x1d889e['shift']());}};_0x37c76b(++_0x3cf023);}(_0xef1f,0xcb));var _0xfef1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xef1f[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xfef1('0x0'));var util=require(_0xfef1('0x1'));var path=require(_0xfef1('0x2'));var timeout=require(_0xfef1('0x3'));var express=require(_0xfef1('0x4'));var router=express['Router']();var fs_extra=require(_0xfef1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfef1('0x6'));var config=require('../../config/environment');var controller=require(_0xfef1('0x7'));router[_0xfef1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfef1('0x8')](_0xfef1('0x9'),auth['isAuthenticated'](),controller[_0xfef1('0xa')]);router['get'](_0xfef1('0xb'),auth[_0xfef1('0xc')](),controller[_0xfef1('0xd')]);router[_0xfef1('0x8')](_0xfef1('0xe'),auth[_0xfef1('0xc')](),controller[_0xfef1('0xf')]);router['get'](_0xfef1('0x10'),auth[_0xfef1('0xc')](),controller['getTeams']);router[_0xfef1('0x8')](_0xfef1('0x11'),auth[_0xfef1('0xc')](),controller[_0xfef1('0x12')]);router[_0xfef1('0x13')]('/',auth[_0xfef1('0xc')](),controller[_0xfef1('0x14')]);router[_0xfef1('0x13')](_0xfef1('0x10'),auth['isAuthenticated'](),controller[_0xfef1('0x15')]);router['post'](_0xfef1('0x11'),auth[_0xfef1('0xc')](),controller[_0xfef1('0x16')]);router[_0xfef1('0x17')]('/:id',auth[_0xfef1('0xc')](),controller[_0xfef1('0x18')]);router[_0xfef1('0x19')](_0xfef1('0xb'),auth['isAuthenticated'](),controller[_0xfef1('0x1a')]);router['delete'](_0xfef1('0x10'),auth[_0xfef1('0xc')](),controller[_0xfef1('0x1b')]);router[_0xfef1('0x19')](_0xfef1('0x11'),auth[_0xfef1('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index a667851..18250c5 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 _0x5c58=['sequelize','exports','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x454db3,_0xcd150e){var _0x3b36da=function(_0xcbf82c){while(--_0xcbf82c){_0x454db3['push'](_0x454db3['shift']());}};_0x3b36da(++_0xcd150e);}(_0x5c58,0x134));var _0x85c5=function(_0x395a42,_0x22859a){_0x395a42=_0x395a42-0x0;var _0x339991=_0x5c58[_0x395a42];return _0x339991;};'use strict';var Sequelize=require(_0x85c5('0x0'));module[_0x85c5('0x1')]={'name':{'type':Sequelize[_0x85c5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x85c5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x85c5('0x4'),_0x85c5('0x5'),_0x85c5('0x6'))}}; \ No newline at end of file +var _0xb48b=['sequelize','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x56cb2d,_0x3a642c){var _0x1ecf61=function(_0xc6da4e){while(--_0xc6da4e){_0x56cb2d['push'](_0x56cb2d['shift']());}};_0x1ecf61(++_0x3a642c);}(_0xb48b,0x9a));var _0xbb48=function(_0x279f18,_0x1bd627){_0x279f18=_0x279f18-0x0;var _0x51a5ad=_0xb48b[_0x279f18];return _0x51a5ad;};'use strict';var Sequelize=require(_0xbb48('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb48('0x1')],'unique':_0xbb48('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb48('0x1')]},'timeout':{'type':Sequelize[_0xbb48('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb48('0x4')]('rrmemory',_0xbb48('0x5'),_0xbb48('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 550518e..165b944 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0xadb5,0xad));var _0x5adb=function(_0x3101e,_0x1af9f8){_0x3101e=_0x3101e-0x0;var _0x226bba=_0xadb5[_0x3101e];return _0x226bba;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x0b0e[_0x571c1d];return _0x33c609;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 98810e6..df0c06c 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 _0x23c5=['setMaxListeners','save','remove','hasOwnProperty','hook','events','../../mysqldb','SmsQueue'];(function(_0x38b0fc,_0x5bb5dc){var _0x1d651b=function(_0x193619){while(--_0x193619){_0x38b0fc['push'](_0x38b0fc['shift']());}};_0x1d651b(++_0x5bb5dc);}(_0x23c5,0x1ed));var _0x523c=function(_0x31db94,_0x3292d5){_0x31db94=_0x31db94-0x0;var _0x355174=_0x23c5[_0x31db94];return _0x355174;};'use strict';var EventEmitter=require(_0x523c('0x0'));var SmsQueue=require(_0x523c('0x1'))['db'][_0x523c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x523c('0x3')](0x0);var events={'afterCreate':_0x523c('0x4'),'afterUpdate':'update','afterDestroy':_0x523c('0x5')};function emitEvent(_0x5f5538){return function(_0x9d8c67,_0x9b5697,_0x1eef4a){SmsQueueEvents['emit'](_0x5f5538+':'+_0x9d8c67['id'],_0x9d8c67);SmsQueueEvents['emit'](_0x5f5538,_0x9d8c67);_0x1eef4a(null);};}for(var e in events){if(events[_0x523c('0x6')](e)){var event=events[e];SmsQueue[_0x523c('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xb430=['hasOwnProperty','exports','events','setMaxListeners','save','update','emit'];(function(_0x13c0bf,_0x4dee02){var _0x3ea5da=function(_0x56b1cd){while(--_0x56b1cd){_0x13c0bf['push'](_0x13c0bf['shift']());}};_0x3ea5da(++_0x4dee02);}(_0xb430,0x10c));var _0x0b43=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xb430[_0x291f8b];return _0x275171;};'use strict';var EventEmitter=require(_0x0b43('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0b43('0x1')](0x0);var events={'afterCreate':_0x0b43('0x2'),'afterUpdate':_0x0b43('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2a0f5f){return function(_0x521d6d,_0x1e94d1,_0x39e487){SmsQueueEvents['emit'](_0x2a0f5f+':'+_0x521d6d['id'],_0x521d6d);SmsQueueEvents[_0x0b43('0x4')](_0x2a0f5f,_0x521d6d);_0x39e487(null);};}for(var e in events){if(events[_0x0b43('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x0b43('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index bec8fb3..8308b62 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 _0xba25=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x56fb4e,_0xfaaf61){var _0x46b663=function(_0x2da20b){while(--_0x2da20b){_0x56fb4e['push'](_0x56fb4e['shift']());}};_0x46b663(++_0xfaaf61);}(_0xba25,0x1ad));var _0x5ba2=function(_0x501e6e,_0xbb6239){_0x501e6e=_0x501e6e-0x0;var _0x5724a3=_0xba25[_0x501e6e];return _0x5724a3;};'use strict';var _=require(_0x5ba2('0x0'));var util=require(_0x5ba2('0x1'));var logger=require(_0x5ba2('0x2'))(_0x5ba2('0x3'));var moment=require(_0x5ba2('0x4'));var BPromise=require(_0x5ba2('0x5'));var rp=require(_0x5ba2('0x6'));var fs=require('fs');var path=require(_0x5ba2('0x7'));var rimraf=require(_0x5ba2('0x8'));var config=require(_0x5ba2('0x9'));var attributes=require(_0x5ba2('0xa'));module['exports']=function(_0xf1a26,_0x2190b6){return _0xf1a26[_0x5ba2('0xb')](_0x5ba2('0xc'),attributes,{'tableName':_0x5ba2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5093=['define','sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueue.attributes'];(function(_0x144c0c,_0x113cfe){var _0x436221=function(_0x231dd7){while(--_0x231dd7){_0x144c0c['push'](_0x144c0c['shift']());}};_0x436221(++_0x113cfe);}(_0x5093,0x174));var _0x3509=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0x5093[_0x5ce34a];return _0x309350;};'use strict';var _=require(_0x3509('0x0'));var util=require(_0x3509('0x1'));var logger=require(_0x3509('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3509('0x3'));var rp=require(_0x3509('0x4'));var fs=require('fs');var path=require(_0x3509('0x5'));var rimraf=require(_0x3509('0x6'));var config=require('../../config/environment');var attributes=require(_0x3509('0x7'));module['exports']=function(_0x1e6dcf,_0x185c87){return _0x1e6dcf[_0x3509('0x8')]('SmsQueue',attributes,{'tableName':_0x3509('0x9'),'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 0952636..f75d562 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 _0x3fbc=['../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','limit','include','model','attributes','map','ShowSmsQueue','find','where','moment','randomstring','ioredis','../../mysqldb'];(function(_0x506df9,_0x1b3001){var _0x26b786=function(_0x1bbea4){while(--_0x1bbea4){_0x506df9['push'](_0x506df9['shift']());}};_0x26b786(++_0x1b3001);}(_0x3fbc,0xe6));var _0xc3fb=function(_0x45cd85,_0x113166){_0x45cd85=_0x45cd85-0x0;var _0x247281=_0x3fbc[_0x45cd85];return _0x247281;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3fb('0x0'));var BPromise=require('bluebird');var rs=require(_0xc3fb('0x1'));var fs=require('fs');var Redis=require(_0xc3fb('0x2'));var db=require(_0xc3fb('0x3'))['db'];var utils=require(_0xc3fb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc3fb('0x5'));var jayson=require(_0xc3fb('0x6'));var client=jayson[_0xc3fb('0x7')]['http']({'port':0x232a});config['redis']=_[_0xc3fb('0x8')](config[_0xc3fb('0x9')],{'host':_0xc3fb('0xa'),'port':0x18eb});var socket=require(_0xc3fb('0xb'))(new Redis(config[_0xc3fb('0x9')]));require(_0xc3fb('0xc'))[_0xc3fb('0xd')](socket);function respondWithRpcPromise(_0x4442ef,_0x4deaa1,_0xd216b7){return new BPromise(function(_0xd9d8b1,_0x2c9dc3){return client[_0xc3fb('0xe')](_0x4442ef,_0xd216b7)[_0xc3fb('0xf')](function(_0xe28e87){logger[_0xc3fb('0x10')](_0xc3fb('0x11'),_0x4deaa1,_0xc3fb('0x12'));logger[_0xc3fb('0x13')](_0xc3fb('0x14'),_0x4deaa1,'request\x20sent',JSON[_0xc3fb('0x15')](_0xe28e87));if(_0xe28e87[_0xc3fb('0x16')]){if(_0xe28e87[_0xc3fb('0x16')][_0xc3fb('0x17')]===0x1f4){logger['error'](_0xc3fb('0x11'),_0x4deaa1,_0xe28e87[_0xc3fb('0x16')][_0xc3fb('0x18')]);return _0x2c9dc3(_0xe28e87[_0xc3fb('0x16')]['message']);}logger[_0xc3fb('0x16')](_0xc3fb('0x11'),_0x4deaa1,_0xe28e87[_0xc3fb('0x16')][_0xc3fb('0x18')]);return _0xd9d8b1(_0xe28e87['error'][_0xc3fb('0x18')]);}else{logger[_0xc3fb('0x10')](_0xc3fb('0x11'),_0x4deaa1,_0xc3fb('0x12'));_0xd9d8b1(_0xe28e87[_0xc3fb('0x19')][_0xc3fb('0x18')]);}})[_0xc3fb('0x1a')](function(_0x1443d7){logger[_0xc3fb('0x16')](_0xc3fb('0x11'),_0x4deaa1,_0x1443d7);_0x2c9dc3(_0x1443d7);});});}exports[_0xc3fb('0x1b')]=function(_0x3925f7){var _0x73a412=this;return new Promise(function(_0x5ea624,_0x396e1e){return db['SmsQueue'][_0xc3fb('0x1c')]({'raw':_0x3925f7[_0xc3fb('0x1d')]?_0x3925f7[_0xc3fb('0x1d')][_0xc3fb('0x1e')]===undefined?!![]:![]:!![],'where':_0x3925f7[_0xc3fb('0x1d')]?_0x3925f7[_0xc3fb('0x1d')]['where']||null:null,'attributes':_0x3925f7['options']?_0x3925f7['options']['attributes']||null:null,'limit':_0x3925f7[_0xc3fb('0x1d')]?_0x3925f7[_0xc3fb('0x1d')][_0xc3fb('0x1f')]||null:null,'include':_0x3925f7[_0xc3fb('0x1d')]?_0x3925f7[_0xc3fb('0x1d')][_0xc3fb('0x20')]?_['map'](_0x3925f7['options'][_0xc3fb('0x20')],function(_0x35e245){return{'model':db[_0x35e245[_0xc3fb('0x21')]],'as':_0x35e245['as'],'attributes':_0x35e245[_0xc3fb('0x22')],'include':_0x35e245['include']?_[_0xc3fb('0x23')](_0x35e245[_0xc3fb('0x20')],function(_0x2e3e1c){return{'model':db[_0x2e3e1c[_0xc3fb('0x21')]],'as':_0x2e3e1c['as'],'attributes':_0x2e3e1c[_0xc3fb('0x22')],'include':_0x2e3e1c[_0xc3fb('0x20')]?_[_0xc3fb('0x23')](_0x2e3e1c[_0xc3fb('0x20')],function(_0x54057a){return{'model':db[_0x54057a[_0xc3fb('0x21')]],'as':_0x54057a['as'],'attributes':_0x54057a[_0xc3fb('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5886d5){logger[_0xc3fb('0x10')]('GetSmsQueue',_0x3925f7);logger[_0xc3fb('0x13')]('GetSmsQueue',_0x3925f7,JSON[_0xc3fb('0x15')](_0x5886d5));_0x5ea624(_0x5886d5);})[_0xc3fb('0x1a')](function(_0x5eb3b9){logger['error'](_0xc3fb('0x1b'),_0x5eb3b9[_0xc3fb('0x18')],_0x3925f7);_0x396e1e(_0x73a412['error'](0x1f4,_0x5eb3b9[_0xc3fb('0x18')]));});});};exports[_0xc3fb('0x24')]=function(_0x33cf3d){var _0x1d64b8=this;return new Promise(function(_0x5cf0dd,_0x312916){return db['SmsQueue'][_0xc3fb('0x25')]({'raw':_0x33cf3d[_0xc3fb('0x1d')]?_0x33cf3d['options']['raw']===undefined?!![]:![]:!![],'where':_0x33cf3d['options']?_0x33cf3d[_0xc3fb('0x1d')][_0xc3fb('0x26')]||null:null,'attributes':_0x33cf3d[_0xc3fb('0x1d')]?_0x33cf3d[_0xc3fb('0x1d')][_0xc3fb('0x22')]||null:null,'include':_0x33cf3d['options']?_0x33cf3d[_0xc3fb('0x1d')][_0xc3fb('0x20')]?_['map'](_0x33cf3d['options'][_0xc3fb('0x20')],function(_0x3fff41){return{'model':db[_0x3fff41['model']],'as':_0x3fff41['as'],'attributes':_0x3fff41['attributes'],'include':_0x3fff41[_0xc3fb('0x20')]?_[_0xc3fb('0x23')](_0x3fff41['include'],function(_0x10f931){return{'model':db[_0x10f931[_0xc3fb('0x21')]],'as':_0x10f931['as'],'attributes':_0x10f931[_0xc3fb('0x22')],'include':_0x10f931[_0xc3fb('0x20')]?_[_0xc3fb('0x23')](_0x10f931['include'],function(_0x4a73a0){return{'model':db[_0x4a73a0['model']],'as':_0x4a73a0['as'],'attributes':_0x4a73a0[_0xc3fb('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6ed6){logger[_0xc3fb('0x10')](_0xc3fb('0x24'),_0x33cf3d);logger['debug'](_0xc3fb('0x24'),_0x33cf3d,JSON['stringify'](_0x1a6ed6));_0x5cf0dd(_0x1a6ed6);})['catch'](function(_0xb4d461){logger[_0xc3fb('0x16')](_0xc3fb('0x24'),_0xb4d461[_0xc3fb('0x18')],_0x33cf3d);_0x312916(_0x1d64b8[_0xc3fb('0x16')](0x1f4,_0xb4d461[_0xc3fb('0x18')]));});});}; \ No newline at end of file +var _0x59a1=['../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','info','request\x20sent','debug','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','SmsQueue','options','raw','where','attributes','limit','include','map','model','then','GetSmsQueue','stringify','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0x59a1,0xb7));var _0x159a=function(_0x52d6ef,_0x35b8d2){_0x52d6ef=_0x52d6ef-0x0;var _0x427017=_0x59a1[_0x52d6ef];return _0x427017;};'use strict';var _=require(_0x159a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x159a('0x1'));var rs=require(_0x159a('0x2'));var fs=require('fs');var Redis=require(_0x159a('0x3'));var db=require(_0x159a('0x4'))['db'];var utils=require(_0x159a('0x5'));var logger=require('../../config/logger')(_0x159a('0x6'));var config=require(_0x159a('0x7'));var jayson=require(_0x159a('0x8'));var client=jayson[_0x159a('0x9')][_0x159a('0xa')]({'port':0x232a});config[_0x159a('0xb')]=_['defaults'](config[_0x159a('0xb')],{'host':_0x159a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x159a('0xb')]));require(_0x159a('0xd'))[_0x159a('0xe')](socket);function respondWithRpcPromise(_0x17b6f1,_0x5e217f,_0x4127fc){return new BPromise(function(_0x56bc49,_0x14c6c1){return client['request'](_0x17b6f1,_0x4127fc)['then'](function(_0x982631){logger[_0x159a('0xf')]('SmsQueue,\x20%s,\x20%s',_0x5e217f,_0x159a('0x10'));logger[_0x159a('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5e217f,_0x159a('0x10'),JSON['stringify'](_0x982631));if(_0x982631[_0x159a('0x12')]){if(_0x982631[_0x159a('0x12')][_0x159a('0x13')]===0x1f4){logger[_0x159a('0x12')]('SmsQueue,\x20%s,\x20%s',_0x5e217f,_0x982631[_0x159a('0x12')][_0x159a('0x14')]);return _0x14c6c1(_0x982631[_0x159a('0x12')][_0x159a('0x14')]);}logger[_0x159a('0x12')](_0x159a('0x15'),_0x5e217f,_0x982631[_0x159a('0x12')][_0x159a('0x14')]);return _0x56bc49(_0x982631[_0x159a('0x12')][_0x159a('0x14')]);}else{logger[_0x159a('0xf')](_0x159a('0x15'),_0x5e217f,_0x159a('0x10'));_0x56bc49(_0x982631[_0x159a('0x16')][_0x159a('0x14')]);}})[_0x159a('0x17')](function(_0x206fae){logger[_0x159a('0x12')](_0x159a('0x15'),_0x5e217f,_0x206fae);_0x14c6c1(_0x206fae);});});}exports['GetSmsQueue']=function(_0x342049){var _0x1cc66f=this;return new Promise(function(_0x4a0aa3,_0x407504){return db[_0x159a('0x18')]['findAll']({'raw':_0x342049[_0x159a('0x19')]?_0x342049['options'][_0x159a('0x1a')]===undefined?!![]:![]:!![],'where':_0x342049[_0x159a('0x19')]?_0x342049[_0x159a('0x19')][_0x159a('0x1b')]||null:null,'attributes':_0x342049[_0x159a('0x19')]?_0x342049[_0x159a('0x19')][_0x159a('0x1c')]||null:null,'limit':_0x342049[_0x159a('0x19')]?_0x342049[_0x159a('0x19')][_0x159a('0x1d')]||null:null,'include':_0x342049['options']?_0x342049[_0x159a('0x19')][_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x342049[_0x159a('0x19')][_0x159a('0x1e')],function(_0x12b9f8){return{'model':db[_0x12b9f8[_0x159a('0x20')]],'as':_0x12b9f8['as'],'attributes':_0x12b9f8[_0x159a('0x1c')],'include':_0x12b9f8[_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x12b9f8[_0x159a('0x1e')],function(_0x15d900){return{'model':db[_0x15d900[_0x159a('0x20')]],'as':_0x15d900['as'],'attributes':_0x15d900[_0x159a('0x1c')],'include':_0x15d900[_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x15d900[_0x159a('0x1e')],function(_0x122bea){return{'model':db[_0x122bea[_0x159a('0x20')]],'as':_0x122bea['as'],'attributes':_0x122bea[_0x159a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x159a('0x21')](function(_0x2e113b){logger['info'](_0x159a('0x22'),_0x342049);logger[_0x159a('0x11')](_0x159a('0x22'),_0x342049,JSON[_0x159a('0x23')](_0x2e113b));_0x4a0aa3(_0x2e113b);})[_0x159a('0x17')](function(_0xa11899){logger[_0x159a('0x12')](_0x159a('0x22'),_0xa11899[_0x159a('0x14')],_0x342049);_0x407504(_0x1cc66f['error'](0x1f4,_0xa11899[_0x159a('0x14')]));});});};exports[_0x159a('0x24')]=function(_0x2abc1d){var _0x4fbdde=this;return new Promise(function(_0x46fe90,_0x25691d){return db[_0x159a('0x18')][_0x159a('0x25')]({'raw':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d[_0x159a('0x19')][_0x159a('0x1a')]===undefined?!![]:![]:!![],'where':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d['options'][_0x159a('0x1b')]||null:null,'attributes':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d[_0x159a('0x19')][_0x159a('0x1c')]||null:null,'include':_0x2abc1d[_0x159a('0x19')]?_0x2abc1d[_0x159a('0x19')]['include']?_['map'](_0x2abc1d[_0x159a('0x19')]['include'],function(_0x204ede){return{'model':db[_0x204ede[_0x159a('0x20')]],'as':_0x204ede['as'],'attributes':_0x204ede['attributes'],'include':_0x204ede[_0x159a('0x1e')]?_[_0x159a('0x1f')](_0x204ede[_0x159a('0x1e')],function(_0x3845c9){return{'model':db[_0x3845c9[_0x159a('0x20')]],'as':_0x3845c9['as'],'attributes':_0x3845c9['attributes'],'include':_0x3845c9['include']?_[_0x159a('0x1f')](_0x3845c9[_0x159a('0x1e')],function(_0x42436b){return{'model':db[_0x42436b[_0x159a('0x20')]],'as':_0x42436b['as'],'attributes':_0x42436b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd213c0){logger[_0x159a('0xf')](_0x159a('0x24'),_0x2abc1d);logger[_0x159a('0x11')](_0x159a('0x24'),_0x2abc1d,JSON[_0x159a('0x23')](_0xd213c0));_0x46fe90(_0xd213c0);})['catch'](function(_0x1e67e9){logger[_0x159a('0x12')](_0x159a('0x24'),_0x1e67e9[_0x159a('0x14')],_0x2abc1d);_0x25691d(_0x4fbdde[_0x159a('0x12')](0x1f4,_0x1e67e9[_0x159a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 72c78a9..13610fa 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 _0x36d8=['save','update','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x86d177,_0x2190aa){var _0x431f6e=function(_0x42b64d){while(--_0x42b64d){_0x86d177['push'](_0x86d177['shift']());}};_0x431f6e(++_0x2190aa);}(_0x36d8,0x7d));var _0x836d=function(_0x4b1757,_0x5e383b){_0x4b1757=_0x4b1757-0x0;var _0x5ea773=_0x36d8[_0x4b1757];return _0x5ea773;};'use strict';var SmsQueueEvents=require(_0x836d('0x0'));var events=[_0x836d('0x1'),'remove',_0x836d('0x2')];function createListener(_0x2e07d8,_0x284ea6){return function(_0x3e8ca0){_0x284ea6['emit'](_0x2e07d8,_0x3e8ca0);};}function removeListener(_0x4678ec,_0x25a26a){return function(){SmsQueueEvents[_0x836d('0x3')](_0x4678ec,_0x25a26a);};}exports[_0x836d('0x4')]=function(_0x247ab5){for(var _0x38ba99=0x0,_0x80acc9=events[_0x836d('0x5')];_0x38ba99<_0x80acc9;_0x38ba99++){var _0xf7070c=events[_0x38ba99];var _0x400098=createListener(_0x836d('0x6')+_0xf7070c,_0x247ab5);SmsQueueEvents['on'](_0xf7070c,_0x400098);}}; \ No newline at end of file +var _0x5ab4=['remove','update','emit','removeListener','length','save'];(function(_0x5bb0f5,_0x502471){var _0x2f66e2=function(_0x574fdf){while(--_0x574fdf){_0x5bb0f5['push'](_0x5bb0f5['shift']());}};_0x2f66e2(++_0x502471);}(_0x5ab4,0x191));var _0x45ab=function(_0x484809,_0x4312b9){_0x484809=_0x484809-0x0;var _0x449dd8=_0x5ab4[_0x484809];return _0x449dd8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x45ab('0x0'),_0x45ab('0x1'),_0x45ab('0x2')];function createListener(_0x1e95eb,_0x1e77d4){return function(_0x3f7b80){_0x1e77d4[_0x45ab('0x3')](_0x1e95eb,_0x3f7b80);};}function removeListener(_0x1d47ad,_0x58e7a9){return function(){SmsQueueEvents[_0x45ab('0x4')](_0x1d47ad,_0x58e7a9);};}exports['register']=function(_0x3d508c){for(var _0x1ad7d1=0x0,_0xb7c885=events[_0x45ab('0x5')];_0x1ad7d1<_0xb7c885;_0x1ad7d1++){var _0x2b83a8=events[_0x1ad7d1];var _0xc5068c=createListener('smsQueue:'+_0x2b83a8,_0x3d508c);SmsQueueEvents['on'](_0x2b83a8,_0xc5068c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c3b4aa2..48fd808 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 _0x4a9c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3e7bfc,_0x5df48f){var _0x243593=function(_0x199b25){while(--_0x199b25){_0x3e7bfc['push'](_0x3e7bfc['shift']());}};_0x243593(++_0x5df48f);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x15baf1,_0x27ac2a){_0x15baf1=_0x15baf1-0x0;var _0x56f257=_0x4a9c[_0x15baf1];return _0x56f257;};'use strict';var multer=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var path=require(_0xc4a9('0x2'));var timeout=require(_0xc4a9('0x3'));var express=require(_0xc4a9('0x4'));var router=express[_0xc4a9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc4a9('0x6'));var interaction=require(_0xc4a9('0x7'));var config=require(_0xc4a9('0x8'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xc4a9('0x9')](),controller[_0xc4a9('0xa')]);router[_0xc4a9('0xb')](_0xc4a9('0xc'),auth['isAuthenticated'](),controller[_0xc4a9('0xd')]);router['get']('/:id',auth[_0xc4a9('0x9')](),controller[_0xc4a9('0xe')]);router[_0xc4a9('0xf')]('/',auth[_0xc4a9('0x9')](),controller[_0xc4a9('0x10')]);router[_0xc4a9('0x11')](_0xc4a9('0x12'),auth[_0xc4a9('0x9')](),controller[_0xc4a9('0x13')]);router[_0xc4a9('0x14')](_0xc4a9('0x12'),auth['isAuthenticated'](),controller[_0xc4a9('0x15')]);module[_0xc4a9('0x16')]=router; \ No newline at end of file +var _0x4556=['/describe','describe','/:id','show','post','update','delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x2f1b14,_0x1c9087){var _0x3dd6ca=function(_0x6f960e){while(--_0x6f960e){_0x2f1b14['push'](_0x2f1b14['shift']());}};_0x3dd6ca(++_0x1c9087);}(_0x4556,0x8f));var _0x6455=function(_0x27b56d,_0x3fa1f2){_0x27b56d=_0x27b56d-0x0;var _0x37eafa=_0x4556[_0x27b56d];return _0x37eafa;};'use strict';var multer=require(_0x6455('0x0'));var util=require('util');var path=require(_0x6455('0x1'));var timeout=require(_0x6455('0x2'));var express=require(_0x6455('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6455('0x4'));var config=require(_0x6455('0x5'));var controller=require(_0x6455('0x6'));router[_0x6455('0x7')]('/',auth[_0x6455('0x8')](),controller[_0x6455('0x9')]);router[_0x6455('0x7')](_0x6455('0xa'),auth[_0x6455('0x8')](),controller[_0x6455('0xb')]);router[_0x6455('0x7')](_0x6455('0xc'),auth['isAuthenticated'](),controller[_0x6455('0xd')]);router[_0x6455('0xe')]('/',auth[_0x6455('0x8')](),controller['create']);router['put'](_0x6455('0xc'),auth[_0x6455('0x8')](),controller[_0x6455('0xf')]);router[_0x6455('0x10')](_0x6455('0xc'),auth[_0x6455('0x8')](),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 f9e0423..74dcf02 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 _0xa9e7=['moment','sequelize','exports','DATE','STRING'];(function(_0x51a096,_0x2fd393){var _0x44ed0d=function(_0x56ebe1){while(--_0x56ebe1){_0x51a096['push'](_0x51a096['shift']());}};_0x44ed0d(++_0x2fd393);}(_0xa9e7,0xfa));var _0x7a9e=function(_0x2fed64,_0x2cfb73){_0x2fed64=_0x2fed64-0x0;var _0x4e93b9=_0xa9e7[_0x2fed64];return _0x4e93b9;};'use strict';var moment=require(_0x7a9e('0x0'));var Sequelize=require(_0x7a9e('0x1'));module[_0x7a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7a9e('0x3')]},'acceptAt':{'type':Sequelize[_0x7a9e('0x3')]},'exitAt':{'type':Sequelize[_0x7a9e('0x3')]},'reason':{'type':Sequelize[_0x7a9e('0x4')]}}; \ No newline at end of file +var _0x3d32=['STRING','moment','DATE'];(function(_0x1dff47,_0x3005a6){var _0xaa69ba=function(_0x333738){while(--_0x333738){_0x1dff47['push'](_0x1dff47['shift']());}};_0xaa69ba(++_0x3005a6);}(_0x3d32,0x13c));var _0x23d3=function(_0x2efc46,_0x4997fb){_0x2efc46=_0x2efc46-0x0;var _0x30f56e=_0x3d32[_0x2efc46];return _0x30f56e;};'use strict';var moment=require(_0x23d3('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x23d3('0x1')]},'acceptAt':{'type':Sequelize[_0x23d3('0x1')]},'exitAt':{'type':Sequelize[_0x23d3('0x1')]},'reason':{'type':Sequelize[_0x23d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ee9711e..a718091 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 _0x67c7=['catch','create','body','update','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','set','reject','then','destroy','sendStatus','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','params','includeAll','options','find'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x67c7,0xd3));var _0x767c=function(_0x1cd577,_0x180f2a){_0x1cd577=_0x1cd577-0x0;var _0x790837=_0x67c7[_0x1cd577];return _0x790837;};'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(_0x767c('0x0'));var moment=require(_0x767c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x767c('0x2'));var util=require(_0x767c('0x3'));var path=require(_0x767c('0x4'));var sox=require(_0x767c('0x5'));var csv=require(_0x767c('0x6'));var ejs=require(_0x767c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x767c('0x8'));var squel=require(_0x767c('0x9'));var crypto=require(_0x767c('0xa'));var jsforce=require(_0x767c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x767c('0x6'));var querystring=require(_0x767c('0xc'));var Papa=require(_0x767c('0xd'));var Redis=require('ioredis');var authService=require(_0x767c('0xe'));var qs=require(_0x767c('0xf'));var as=require(_0x767c('0x10'));var hardwareService=require(_0x767c('0x11'));var logger=require(_0x767c('0x12'))(_0x767c('0x13'));var utils=require(_0x767c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x767c('0x15'))['db'];function respondWithStatusCode(_0xf6c3bd,_0x390cc9){_0x390cc9=_0x390cc9||0xcc;return function(_0x54f414){if(_0x54f414){return _0xf6c3bd['sendStatus'](_0x390cc9);}return _0xf6c3bd[_0x767c('0x16')](_0x390cc9)[_0x767c('0x17')]();};}function respondWithResult(_0x1530de,_0x4bfb26){_0x4bfb26=_0x4bfb26||0xc8;return function(_0x17e386){if(_0x17e386){return _0x1530de[_0x767c('0x16')](_0x4bfb26)[_0x767c('0x18')](_0x17e386);}};}function respondWithFilteredResult(_0x58804b,_0x1cc60a){return function(_0x4cd2e9){if(_0x4cd2e9){var _0x2ea6db=typeof _0x1cc60a['offset']==='undefined'&&typeof _0x1cc60a[_0x767c('0x19')]===_0x767c('0x1a');var _0x50ecb1=_0x4cd2e9[_0x767c('0x1b')];var _0x329b0a=_0x2ea6db?0x0:_0x1cc60a[_0x767c('0x1c')];var _0x4a436b=_0x2ea6db?_0x4cd2e9['count']:_0x1cc60a['offset']+_0x1cc60a[_0x767c('0x19')];var _0x3a78d9;if(_0x4a436b>=_0x50ecb1){_0x4a436b=_0x50ecb1;_0x3a78d9=0xc8;}else{_0x3a78d9=0xce;}_0x58804b[_0x767c('0x16')](_0x3a78d9);return _0x58804b[_0x767c('0x1d')]('Content-Range',_0x329b0a+'-'+_0x4a436b+'/'+_0x50ecb1)[_0x767c('0x18')](_0x4cd2e9);}return null;};}function patchUpdates(_0x5b81fc){return function(_0x4d62e8){try{jsonpatch['apply'](_0x4d62e8,_0x5b81fc,!![]);}catch(_0x35f705){return BPromise[_0x767c('0x1e')](_0x35f705);}return _0x4d62e8['save']();};}function saveUpdates(_0x796691,_0x520e4d){return function(_0x55355a){if(_0x55355a){return _0x55355a['update'](_0x796691)[_0x767c('0x1f')](function(_0x411f06){return _0x411f06;});}return null;};}function removeEntity(_0x2cc0d7,_0x4575f6){return function(_0x3137d1){if(_0x3137d1){return _0x3137d1[_0x767c('0x20')]()[_0x767c('0x1f')](function(){_0x2cc0d7[_0x767c('0x16')](0xcc)[_0x767c('0x17')]();});}};}function handleEntityNotFound(_0x51b557,_0x16e877){return function(_0xbbe004){if(!_0xbbe004){_0x51b557[_0x767c('0x21')](0x194);}return _0xbbe004;};}function handleError(_0x419ba1,_0x2896fe){_0x2896fe=_0x2896fe||0x1f4;return function(_0x102038){logger['error'](_0x102038[_0x767c('0x22')]);if(_0x102038['name']){delete _0x102038[_0x767c('0x23')];}_0x419ba1[_0x767c('0x16')](_0x2896fe)[_0x767c('0x24')](_0x102038);};}exports['index']=function(_0x20c9f5,_0x38284e){var _0x2e7421={},_0x5edcfb={},_0x412fa1={'count':0x0,'rows':[]};var _0x5a1681=_[_0x767c('0x25')](db[_0x767c('0x26')][_0x767c('0x27')],function(_0x5d424a){return{'name':_0x5d424a[_0x767c('0x28')],'type':_0x5d424a[_0x767c('0x29')][_0x767c('0x2a')]};});_0x5edcfb[_0x767c('0x2b')]=_[_0x767c('0x25')](_0x5a1681,'name');_0x5edcfb[_0x767c('0x2c')]=_[_0x767c('0x2d')](_0x20c9f5[_0x767c('0x2c')]);_0x5edcfb['filters']=_[_0x767c('0x2e')](_0x5edcfb[_0x767c('0x2b')],_0x5edcfb[_0x767c('0x2c')]);_0x2e7421['attributes']=_['intersection'](_0x5edcfb[_0x767c('0x2b')],qs[_0x767c('0x2f')](_0x20c9f5[_0x767c('0x2c')][_0x767c('0x2f')]));_0x2e7421[_0x767c('0x30')]=_0x2e7421[_0x767c('0x30')][_0x767c('0x31')]?_0x2e7421[_0x767c('0x30')]:_0x5edcfb[_0x767c('0x2b')];if(!_0x20c9f5[_0x767c('0x2c')]['hasOwnProperty'](_0x767c('0x32'))){_0x2e7421[_0x767c('0x19')]=qs['limit'](_0x20c9f5['query'][_0x767c('0x19')]);_0x2e7421[_0x767c('0x1c')]=qs[_0x767c('0x1c')](_0x20c9f5[_0x767c('0x2c')]['offset']);}_0x2e7421[_0x767c('0x33')]=qs[_0x767c('0x34')](_0x20c9f5[_0x767c('0x2c')][_0x767c('0x34')]);_0x2e7421[_0x767c('0x35')]=qs[_0x767c('0x36')](_[_0x767c('0x37')](_0x20c9f5[_0x767c('0x2c')],_0x5edcfb[_0x767c('0x36')]),_0x5a1681);if(_0x20c9f5[_0x767c('0x2c')][_0x767c('0x38')]){_0x2e7421[_0x767c('0x35')]=_[_0x767c('0x39')](_0x2e7421['where'],{'$or':_[_0x767c('0x25')](_0x5a1681,function(_0x3ad0e4){if(_0x3ad0e4[_0x767c('0x29')]!=='VIRTUAL'){var _0x4515be={};_0x4515be[_0x3ad0e4[_0x767c('0x23')]]={'$like':'%'+_0x20c9f5[_0x767c('0x2c')][_0x767c('0x38')]+'%'};return _0x4515be;}})});}_0x2e7421=_['merge']({},_0x2e7421,_0x20c9f5['options']);var _0x1ef9e4={'where':_0x2e7421[_0x767c('0x35')]};return db['SmsQueueReport'][_0x767c('0x1b')](_0x1ef9e4)['then'](function(_0x507302){_0x412fa1[_0x767c('0x1b')]=_0x507302;if(_0x20c9f5['query']['includeAll']){_0x2e7421[_0x767c('0x3a')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x767c('0x3b')](_0x2e7421);})[_0x767c('0x1f')](function(_0x211799){_0x412fa1[_0x767c('0x3c')]=_0x211799;return _0x412fa1;})[_0x767c('0x1f')](respondWithFilteredResult(_0x38284e,_0x2e7421))['catch'](handleError(_0x38284e,null));};exports['show']=function(_0x39ac44,_0x25c025){var _0x544719={'raw':!![],'where':{'id':_0x39ac44[_0x767c('0x3d')]['id']}},_0x434e5f={};_0x434e5f[_0x767c('0x2b')]=_[_0x767c('0x2d')](db[_0x767c('0x26')]['rawAttributes']);_0x434e5f[_0x767c('0x2c')]=_[_0x767c('0x2d')](_0x39ac44[_0x767c('0x2c')]);_0x434e5f['filters']=_[_0x767c('0x2e')](_0x434e5f[_0x767c('0x2b')],_0x434e5f[_0x767c('0x2c')]);_0x544719[_0x767c('0x30')]=_[_0x767c('0x2e')](_0x434e5f['model'],qs[_0x767c('0x2f')](_0x39ac44[_0x767c('0x2c')][_0x767c('0x2f')]));_0x544719[_0x767c('0x30')]=_0x544719[_0x767c('0x30')][_0x767c('0x31')]?_0x544719['attributes']:_0x434e5f[_0x767c('0x2b')];if(_0x39ac44[_0x767c('0x2c')][_0x767c('0x3e')]){_0x544719[_0x767c('0x3a')]=[{'all':!![]}];}_0x544719=_['merge']({},_0x544719,_0x39ac44[_0x767c('0x3f')]);return db[_0x767c('0x26')][_0x767c('0x40')](_0x544719)[_0x767c('0x1f')](handleEntityNotFound(_0x25c025,null))[_0x767c('0x1f')](respondWithResult(_0x25c025,null))[_0x767c('0x41')](handleError(_0x25c025,null));};exports['create']=function(_0xaffac5,_0x17f889){return db[_0x767c('0x26')][_0x767c('0x42')](_0xaffac5[_0x767c('0x43')],{})[_0x767c('0x1f')](respondWithResult(_0x17f889,0xc9))['catch'](handleError(_0x17f889,null));};exports[_0x767c('0x44')]=function(_0x45797c,_0x346989){if(_0x45797c[_0x767c('0x43')]['id']){delete _0x45797c[_0x767c('0x43')]['id'];}return db[_0x767c('0x26')][_0x767c('0x40')]({'where':{'id':_0x45797c[_0x767c('0x3d')]['id']}})[_0x767c('0x1f')](handleEntityNotFound(_0x346989,null))[_0x767c('0x1f')](saveUpdates(_0x45797c[_0x767c('0x43')],null))[_0x767c('0x1f')](respondWithResult(_0x346989,null))[_0x767c('0x41')](handleError(_0x346989,null));};exports[_0x767c('0x20')]=function(_0x165256,_0x49807e){return db['SmsQueueReport'][_0x767c('0x40')]({'where':{'id':_0x165256[_0x767c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x49807e,null))['then'](removeEntity(_0x49807e,null))[_0x767c('0x41')](handleError(_0x49807e,null));};exports['describe']=function(_0x3fe155,_0x4fe437){return db['SmsQueueReport']['describe']()[_0x767c('0x1f')](respondWithResult(_0x4fe437,null))[_0x767c('0x41')](handleError(_0x4fe437,null));}; \ No newline at end of file +var _0xe62f=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','SmsQueueReport','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x270883,_0x49e29f){var _0x476b65=function(_0x1dc96f){while(--_0x1dc96f){_0x270883['push'](_0x270883['shift']());}};_0x476b65(++_0x49e29f);}(_0xe62f,0xe4));var _0xfe62=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xe62f[_0x1acc2d];return _0xabfa6d;};'use strict';var emlformat=require(_0xfe62('0x0'));var rimraf=require(_0xfe62('0x1'));var zipdir=require(_0xfe62('0x2'));var jsonpatch=require(_0xfe62('0x3'));var rp=require(_0xfe62('0x4'));var moment=require(_0xfe62('0x5'));var BPromise=require(_0xfe62('0x6'));var Mustache=require(_0xfe62('0x7'));var util=require(_0xfe62('0x8'));var path=require('path');var sox=require(_0xfe62('0x9'));var csv=require('to-csv');var ejs=require(_0xfe62('0xa'));var fs=require('fs');var fs_extra=require(_0xfe62('0xb'));var _=require(_0xfe62('0xc'));var squel=require(_0xfe62('0xd'));var crypto=require(_0xfe62('0xe'));var jsforce=require(_0xfe62('0xf'));var deskjs=require(_0xfe62('0x10'));var toCsv=require(_0xfe62('0x11'));var querystring=require(_0xfe62('0x12'));var Papa=require(_0xfe62('0x13'));var Redis=require(_0xfe62('0x14'));var authService=require(_0xfe62('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xfe62('0x16'));var hardwareService=require(_0xfe62('0x17'));var logger=require(_0xfe62('0x18'))(_0xfe62('0x19'));var utils=require('../../config/utils');var config=require(_0xfe62('0x1a'));var licenseUtil=require(_0xfe62('0x1b'));var db=require(_0xfe62('0x1c'))['db'];function respondWithStatusCode(_0x5746ab,_0x532748){_0x532748=_0x532748||0xcc;return function(_0x5a62c0){if(_0x5a62c0){return _0x5746ab[_0xfe62('0x1d')](_0x532748);}return _0x5746ab['status'](_0x532748)[_0xfe62('0x1e')]();};}function respondWithResult(_0x2f8000,_0x3ee3e8){_0x3ee3e8=_0x3ee3e8||0xc8;return function(_0xb6dee3){if(_0xb6dee3){return _0x2f8000['status'](_0x3ee3e8)[_0xfe62('0x1f')](_0xb6dee3);}};}function respondWithFilteredResult(_0x1032ed,_0x430a4c){return function(_0x5919bd){if(_0x5919bd){var _0x498dc5=typeof _0x430a4c['offset']==='undefined'&&typeof _0x430a4c[_0xfe62('0x20')]===_0xfe62('0x21');var _0x588b1f=_0x5919bd[_0xfe62('0x22')];var _0x1d9353=_0x498dc5?0x0:_0x430a4c[_0xfe62('0x23')];var _0x465eea=_0x498dc5?_0x5919bd['count']:_0x430a4c[_0xfe62('0x23')]+_0x430a4c['limit'];var _0x2f761e;if(_0x465eea>=_0x588b1f){_0x465eea=_0x588b1f;_0x2f761e=0xc8;}else{_0x2f761e=0xce;}_0x1032ed[_0xfe62('0x24')](_0x2f761e);return _0x1032ed[_0xfe62('0x25')](_0xfe62('0x26'),_0x1d9353+'-'+_0x465eea+'/'+_0x588b1f)['json'](_0x5919bd);}return null;};}function patchUpdates(_0x2129ec){return function(_0x576908){try{jsonpatch[_0xfe62('0x27')](_0x576908,_0x2129ec,!![]);}catch(_0x4b13d1){return BPromise[_0xfe62('0x28')](_0x4b13d1);}return _0x576908[_0xfe62('0x29')]();};}function saveUpdates(_0x223c6c,_0x2ad82f){return function(_0xc1ccb1){if(_0xc1ccb1){return _0xc1ccb1[_0xfe62('0x2a')](_0x223c6c)['then'](function(_0x200e94){return _0x200e94;});}return null;};}function removeEntity(_0x355d5a,_0x4eecc0){return function(_0x11b37d){if(_0x11b37d){return _0x11b37d['destroy']()[_0xfe62('0x2b')](function(){_0x355d5a[_0xfe62('0x24')](0xcc)[_0xfe62('0x1e')]();});}};}function handleEntityNotFound(_0xc11b39,_0x4d366b){return function(_0x566b28){if(!_0x566b28){_0xc11b39[_0xfe62('0x1d')](0x194);}return _0x566b28;};}function handleError(_0x5a5b9c,_0x19e734){_0x19e734=_0x19e734||0x1f4;return function(_0x5bbf06){logger[_0xfe62('0x2c')](_0x5bbf06[_0xfe62('0x2d')]);if(_0x5bbf06[_0xfe62('0x2e')]){delete _0x5bbf06['name'];}_0x5a5b9c['status'](_0x19e734)['send'](_0x5bbf06);};}exports[_0xfe62('0x2f')]=function(_0x354fea,_0x345fdc){var _0x2e538f={},_0x585d2d={},_0x4854a5={'count':0x0,'rows':[]};var _0x321334=_['map'](db[_0xfe62('0x30')][_0xfe62('0x31')],function(_0x559905){return{'name':_0x559905['fieldName'],'type':_0x559905['type'][_0xfe62('0x32')]};});_0x585d2d['model']=_[_0xfe62('0x33')](_0x321334,'name');_0x585d2d[_0xfe62('0x34')]=_[_0xfe62('0x35')](_0x354fea[_0xfe62('0x34')]);_0x585d2d[_0xfe62('0x36')]=_[_0xfe62('0x37')](_0x585d2d[_0xfe62('0x38')],_0x585d2d[_0xfe62('0x34')]);_0x2e538f[_0xfe62('0x39')]=_[_0xfe62('0x37')](_0x585d2d[_0xfe62('0x38')],qs[_0xfe62('0x3a')](_0x354fea[_0xfe62('0x34')][_0xfe62('0x3a')]));_0x2e538f[_0xfe62('0x39')]=_0x2e538f[_0xfe62('0x39')]['length']?_0x2e538f[_0xfe62('0x39')]:_0x585d2d[_0xfe62('0x38')];if(!_0x354fea['query']['hasOwnProperty'](_0xfe62('0x3b'))){_0x2e538f[_0xfe62('0x20')]=qs[_0xfe62('0x20')](_0x354fea[_0xfe62('0x34')][_0xfe62('0x20')]);_0x2e538f[_0xfe62('0x23')]=qs[_0xfe62('0x23')](_0x354fea[_0xfe62('0x34')][_0xfe62('0x23')]);}_0x2e538f[_0xfe62('0x3c')]=qs['sort'](_0x354fea[_0xfe62('0x34')][_0xfe62('0x3d')]);_0x2e538f[_0xfe62('0x3e')]=qs[_0xfe62('0x36')](_[_0xfe62('0x3f')](_0x354fea[_0xfe62('0x34')],_0x585d2d[_0xfe62('0x36')]),_0x321334);if(_0x354fea['query'][_0xfe62('0x40')]){_0x2e538f['where']=_['merge'](_0x2e538f[_0xfe62('0x3e')],{'$or':_[_0xfe62('0x33')](_0x321334,function(_0x582597){if(_0x582597['type']!==_0xfe62('0x41')){var _0x4ddcce={};_0x4ddcce[_0x582597[_0xfe62('0x2e')]]={'$like':'%'+_0x354fea['query'][_0xfe62('0x40')]+'%'};return _0x4ddcce;}})});}_0x2e538f=_[_0xfe62('0x42')]({},_0x2e538f,_0x354fea[_0xfe62('0x43')]);var _0x11ce7c={'where':_0x2e538f[_0xfe62('0x3e')]};return db['SmsQueueReport'][_0xfe62('0x22')](_0x11ce7c)[_0xfe62('0x2b')](function(_0x81d574){_0x4854a5['count']=_0x81d574;if(_0x354fea[_0xfe62('0x34')][_0xfe62('0x44')]){_0x2e538f['include']=[{'all':!![]}];}return db[_0xfe62('0x30')][_0xfe62('0x45')](_0x2e538f);})[_0xfe62('0x2b')](function(_0x341173){_0x4854a5[_0xfe62('0x46')]=_0x341173;return _0x4854a5;})['then'](respondWithFilteredResult(_0x345fdc,_0x2e538f))[_0xfe62('0x47')](handleError(_0x345fdc,null));};exports['show']=function(_0xb77297,_0xca3358){var _0x1f41e0={'raw':!![],'where':{'id':_0xb77297['params']['id']}},_0x44f0e9={};_0x44f0e9[_0xfe62('0x38')]=_[_0xfe62('0x35')](db['SmsQueueReport'][_0xfe62('0x31')]);_0x44f0e9['query']=_[_0xfe62('0x35')](_0xb77297[_0xfe62('0x34')]);_0x44f0e9[_0xfe62('0x36')]=_[_0xfe62('0x37')](_0x44f0e9[_0xfe62('0x38')],_0x44f0e9[_0xfe62('0x34')]);_0x1f41e0[_0xfe62('0x39')]=_['intersection'](_0x44f0e9[_0xfe62('0x38')],qs['fields'](_0xb77297[_0xfe62('0x34')]['fields']));_0x1f41e0[_0xfe62('0x39')]=_0x1f41e0[_0xfe62('0x39')][_0xfe62('0x48')]?_0x1f41e0[_0xfe62('0x39')]:_0x44f0e9[_0xfe62('0x38')];if(_0xb77297[_0xfe62('0x34')][_0xfe62('0x44')]){_0x1f41e0[_0xfe62('0x49')]=[{'all':!![]}];}_0x1f41e0=_[_0xfe62('0x42')]({},_0x1f41e0,_0xb77297[_0xfe62('0x43')]);return db[_0xfe62('0x30')][_0xfe62('0x4a')](_0x1f41e0)[_0xfe62('0x2b')](handleEntityNotFound(_0xca3358,null))[_0xfe62('0x2b')](respondWithResult(_0xca3358,null))[_0xfe62('0x47')](handleError(_0xca3358,null));};exports[_0xfe62('0x4b')]=function(_0x4190b4,_0x14ccb5){return db[_0xfe62('0x30')][_0xfe62('0x4b')](_0x4190b4[_0xfe62('0x4c')],{})[_0xfe62('0x2b')](respondWithResult(_0x14ccb5,0xc9))[_0xfe62('0x47')](handleError(_0x14ccb5,null));};exports[_0xfe62('0x2a')]=function(_0x4ba22f,_0x5bb63d){if(_0x4ba22f[_0xfe62('0x4c')]['id']){delete _0x4ba22f[_0xfe62('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x4ba22f[_0xfe62('0x4d')]['id']}})[_0xfe62('0x2b')](handleEntityNotFound(_0x5bb63d,null))[_0xfe62('0x2b')](saveUpdates(_0x4ba22f[_0xfe62('0x4c')],null))['then'](respondWithResult(_0x5bb63d,null))[_0xfe62('0x47')](handleError(_0x5bb63d,null));};exports['destroy']=function(_0x449f7c,_0x4c2628){return db[_0xfe62('0x30')][_0xfe62('0x4a')]({'where':{'id':_0x449f7c[_0xfe62('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c2628,null))[_0xfe62('0x2b')](removeEntity(_0x4c2628,null))[_0xfe62('0x47')](handleError(_0x4c2628,null));};exports[_0xfe62('0x4e')]=function(_0x2e01df,_0x581052){return db[_0xfe62('0x30')]['describe']()['then'](respondWithResult(_0x581052,null))[_0xfe62('0x47')](handleError(_0x581052,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index cdf45dc..83b03f3 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x55b3ae,_0x45017c){var _0xe5088d=function(_0x5bbf33){while(--_0x5bbf33){_0x55b3ae['push'](_0x55b3ae['shift']());}};_0xe5088d(++_0x45017c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0f9b0ee..584b181 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 _0xe6ab=['body','options','catch','UpdateSmsQueueReport','SmsQueueReport','raw','where','attributes','limit','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','CreateSmsQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6ab,0x1c9));var _0xbe6a=function(_0x5cbadf,_0x5188e2){_0x5cbadf=_0x5cbadf-0x0;var _0x56a25b=_0xe6ab[_0x5cbadf];return _0x56a25b;};'use strict';var _=require('lodash');var util=require(_0xbe6a('0x0'));var moment=require(_0xbe6a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe6a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe6a('0x3'));var logger=require(_0xbe6a('0x4'))('rpc');var config=require(_0xbe6a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xbe6a('0x6')][_0xbe6a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b687e,_0x2ab3bd,_0x56766b){return new BPromise(function(_0x3dfa01,_0x8147c7){return client[_0xbe6a('0x8')](_0x2b687e,_0x56766b)[_0xbe6a('0x9')](function(_0x57734d){logger['info'](_0xbe6a('0xa'),_0x2ab3bd,_0xbe6a('0xb'));logger[_0xbe6a('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2ab3bd,_0xbe6a('0xb'),JSON[_0xbe6a('0xd')](_0x57734d));if(_0x57734d[_0xbe6a('0xe')]){if(_0x57734d[_0xbe6a('0xe')][_0xbe6a('0xf')]===0x1f4){logger[_0xbe6a('0xe')](_0xbe6a('0xa'),_0x2ab3bd,_0x57734d[_0xbe6a('0xe')][_0xbe6a('0x10')]);return _0x8147c7(_0x57734d[_0xbe6a('0xe')][_0xbe6a('0x10')]);}logger[_0xbe6a('0xe')](_0xbe6a('0xa'),_0x2ab3bd,_0x57734d['error'][_0xbe6a('0x10')]);return _0x3dfa01(_0x57734d[_0xbe6a('0xe')]['message']);}else{logger[_0xbe6a('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2ab3bd,_0xbe6a('0xb'));_0x3dfa01(_0x57734d['result']['message']);}})['catch'](function(_0x6ee62c){logger[_0xbe6a('0xe')](_0xbe6a('0xa'),_0x2ab3bd,_0x6ee62c);_0x8147c7(_0x6ee62c);});});}exports[_0xbe6a('0x12')]=function(_0x42ef74){var _0x4ba581=this;return new Promise(function(_0xb97a0d,_0xb30919){return db['SmsQueueReport']['create'](_0x42ef74[_0xbe6a('0x13')],{'raw':_0x42ef74[_0xbe6a('0x14')]?_0x42ef74[_0xbe6a('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4bbb09){logger['info'](_0xbe6a('0x12'),_0x42ef74);logger[_0xbe6a('0xc')]('CreateSmsQueueReport',_0x42ef74,JSON[_0xbe6a('0xd')](_0x4bbb09));_0xb97a0d(_0x4bbb09);})[_0xbe6a('0x15')](function(_0x51a02d){logger[_0xbe6a('0xe')](_0xbe6a('0x12'),_0x51a02d[_0xbe6a('0x10')],_0x42ef74);_0xb30919(_0x4ba581[_0xbe6a('0xe')](0x1f4,_0x51a02d['message']));});});};exports[_0xbe6a('0x16')]=function(_0xef3eb8){var _0x2b3ef7=this;return new Promise(function(_0x3879e2,_0x587f9e){return db[_0xbe6a('0x17')]['update'](_0xef3eb8['body'],{'raw':_0xef3eb8[_0xbe6a('0x14')]?_0xef3eb8[_0xbe6a('0x14')][_0xbe6a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xef3eb8[_0xbe6a('0x14')]?_0xef3eb8['options'][_0xbe6a('0x19')]||null:null,'attributes':_0xef3eb8['options']?_0xef3eb8['options'][_0xbe6a('0x1a')]||null:null,'limit':_0xef3eb8[_0xbe6a('0x14')]?_0xef3eb8[_0xbe6a('0x14')][_0xbe6a('0x1b')]||null:null})[_0xbe6a('0x9')](function(_0x360736){logger['info'](_0xbe6a('0x16'),_0xef3eb8);logger['debug'](_0xbe6a('0x16'),_0xef3eb8,JSON[_0xbe6a('0xd')](_0x360736));_0x3879e2(_0x360736);})[_0xbe6a('0x15')](function(_0x50c738){logger['error'](_0xbe6a('0x16'),_0x50c738[_0xbe6a('0x10')],_0xef3eb8);_0x587f9e(_0x2b3ef7['error'](0x1f4,_0x50c738['message']));});});}; \ No newline at end of file +var _0xd623=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','catch','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd623,0x171));var _0x3d62=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd623[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x3d62('0x0'));var util=require(_0x3d62('0x1'));var moment=require(_0x3d62('0x2'));var BPromise=require(_0x3d62('0x3'));var rs=require(_0x3d62('0x4'));var fs=require('fs');var Redis=require(_0x3d62('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d62('0x6'));var logger=require(_0x3d62('0x7'))('rpc');var config=require(_0x3d62('0x8'));var jayson=require(_0x3d62('0x9'));var client=jayson[_0x3d62('0xa')][_0x3d62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23c24f,_0x18e57b,_0x37a675){return new BPromise(function(_0x4c2f8d,_0x322bfa){return client['request'](_0x23c24f,_0x37a675)['then'](function(_0x6cda40){logger[_0x3d62('0xc')](_0x3d62('0xd'),_0x18e57b,_0x3d62('0xe'));logger[_0x3d62('0xf')](_0x3d62('0x10'),_0x18e57b,_0x3d62('0xe'),JSON[_0x3d62('0x11')](_0x6cda40));if(_0x6cda40[_0x3d62('0x12')]){if(_0x6cda40['error'][_0x3d62('0x13')]===0x1f4){logger['error'](_0x3d62('0xd'),_0x18e57b,_0x6cda40[_0x3d62('0x12')][_0x3d62('0x14')]);return _0x322bfa(_0x6cda40[_0x3d62('0x12')][_0x3d62('0x14')]);}logger[_0x3d62('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x18e57b,_0x6cda40['error'][_0x3d62('0x14')]);return _0x4c2f8d(_0x6cda40[_0x3d62('0x12')][_0x3d62('0x14')]);}else{logger[_0x3d62('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x18e57b,_0x3d62('0xe'));_0x4c2f8d(_0x6cda40[_0x3d62('0x15')][_0x3d62('0x14')]);}})['catch'](function(_0x5af4b5){logger[_0x3d62('0x12')](_0x3d62('0xd'),_0x18e57b,_0x5af4b5);_0x322bfa(_0x5af4b5);});});}exports[_0x3d62('0x16')]=function(_0x2695a0){var _0x96306f=this;return new Promise(function(_0x2d3bf,_0x660b7a){return db[_0x3d62('0x17')]['create'](_0x2695a0[_0x3d62('0x18')],{'raw':_0x2695a0[_0x3d62('0x19')]?_0x2695a0[_0x3d62('0x19')][_0x3d62('0x1a')]===undefined?!![]:![]:!![]})[_0x3d62('0x1b')](function(_0x3044ea){logger[_0x3d62('0xc')](_0x3d62('0x16'),_0x2695a0);logger[_0x3d62('0xf')]('CreateSmsQueueReport',_0x2695a0,JSON['stringify'](_0x3044ea));_0x2d3bf(_0x3044ea);})[_0x3d62('0x1c')](function(_0x559fc6){logger[_0x3d62('0x12')](_0x3d62('0x16'),_0x559fc6[_0x3d62('0x14')],_0x2695a0);_0x660b7a(_0x96306f[_0x3d62('0x12')](0x1f4,_0x559fc6[_0x3d62('0x14')]));});});};exports[_0x3d62('0x1d')]=function(_0xf20c4f){var _0x5815ae=this;return new Promise(function(_0x2d58a6,_0x367944){return db[_0x3d62('0x17')][_0x3d62('0x1e')](_0xf20c4f[_0x3d62('0x18')],{'raw':_0xf20c4f[_0x3d62('0x19')]?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf20c4f[_0x3d62('0x19')]?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x1f')]||null:null,'attributes':_0xf20c4f['options']?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x20')]||null:null,'limit':_0xf20c4f[_0x3d62('0x19')]?_0xf20c4f[_0x3d62('0x19')][_0x3d62('0x21')]||null:null})['then'](function(_0x1b174d){logger[_0x3d62('0xc')](_0x3d62('0x1d'),_0xf20c4f);logger['debug']('UpdateSmsQueueReport',_0xf20c4f,JSON[_0x3d62('0x11')](_0x1b174d));_0x2d58a6(_0x1b174d);})[_0x3d62('0x1c')](function(_0x2fb6a3){logger[_0x3d62('0x12')]('UpdateSmsQueueReport',_0x2fb6a3[_0x3d62('0x14')],_0xf20c4f);_0x367944(_0x5815ae['error'](0x1f4,_0x2fb6a3[_0x3d62('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5bb591d..5cf25b2 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 _0x4873=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39c7d9,_0x3c68b9){var _0x2cb6b9=function(_0x5f5afe){while(--_0x5f5afe){_0x39c7d9['push'](_0x39c7d9['shift']());}};_0x2cb6b9(++_0x3c68b9);}(_0x4873,0x1df));var _0x3487=function(_0x57ae81,_0xb86e51){_0x57ae81=_0x57ae81-0x0;var _0x38c6ef=_0x4873[_0x57ae81];return _0x38c6ef;};'use strict';var multer=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var path=require(_0x3487('0x2'));var timeout=require('connect-timeout');var express=require(_0x3487('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3487('0x4'));var interaction=require(_0x3487('0x5'));var config=require(_0x3487('0x6'));var controller=require(_0x3487('0x7'));router[_0x3487('0x8')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xa')]);router[_0x3487('0x8')]('/describe',auth[_0x3487('0x9')](),controller[_0x3487('0xb')]);router[_0x3487('0x8')](_0x3487('0xc'),auth[_0x3487('0x9')](),controller['show']);router[_0x3487('0xd')]('/',auth['isAuthenticated'](),controller[_0x3487('0xe')]);router[_0x3487('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3487('0x10')]);router[_0x3487('0x11')]('/:id',auth[_0x3487('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x217480,_0x368df7){_0x217480=_0x217480-0x0;var _0x4301e5=_0xdc97[_0x217480];return _0x4301e5;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3fcf07b..afe8cfd 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x53f270,_0x9b04f0){var _0x514a74=function(_0xf696c4){while(--_0xf696c4){_0x53f270['push'](_0x53f270['shift']());}};_0x514a74(++_0x9b04f0);}(_0xedd9,0xfc));var _0x9edd=function(_0x13493a,_0x2ba135){_0x13493a=_0x13493a-0x0;var _0x6a8183=_0xedd9[_0x13493a];return _0x6a8183;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xb42ec7,_0x4a0132){var _0x5824d5=function(_0x3dfd6f){while(--_0x3dfd6f){_0xb42ec7['push'](_0xb42ec7['shift']());}};_0x5824d5(++_0x4a0132);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d0d6480..d72ded5 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 _0xffa9=['error','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x4123f2,_0x227240){var _0x51c7de=function(_0x1e202f){while(--_0x1e202f){_0x4123f2['push'](_0x4123f2['shift']());}};_0x51c7de(++_0x227240);}(_0xffa9,0x19d));var _0x9ffa=function(_0x524b2a,_0x13e281){_0x524b2a=_0x524b2a-0x0;var _0x176cc5=_0xffa9[_0x524b2a];return _0x176cc5;};'use strict';var emlformat=require(_0x9ffa('0x0'));var rimraf=require(_0x9ffa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ffa('0x2'));var rp=require(_0x9ffa('0x3'));var moment=require('moment');var BPromise=require(_0x9ffa('0x4'));var Mustache=require(_0x9ffa('0x5'));var util=require(_0x9ffa('0x6'));var path=require(_0x9ffa('0x7'));var sox=require(_0x9ffa('0x8'));var csv=require(_0x9ffa('0x9'));var ejs=require(_0x9ffa('0xa'));var fs=require('fs');var fs_extra=require(_0x9ffa('0xb'));var _=require('lodash');var squel=require(_0x9ffa('0xc'));var crypto=require(_0x9ffa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ffa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ffa('0xf'));var Papa=require(_0x9ffa('0x10'));var Redis=require('ioredis');var authService=require(_0x9ffa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ffa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ffa('0x13'))(_0x9ffa('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9ffa('0x15'));var db=require(_0x9ffa('0x16'))['db'];function respondWithStatusCode(_0xf33b1a,_0x10a5bc){_0x10a5bc=_0x10a5bc||0xcc;return function(_0x76f8d8){if(_0x76f8d8){return _0xf33b1a[_0x9ffa('0x17')](_0x10a5bc);}return _0xf33b1a['status'](_0x10a5bc)[_0x9ffa('0x18')]();};}function respondWithResult(_0x40b9b2,_0x359927){_0x359927=_0x359927||0xc8;return function(_0x57a759){if(_0x57a759){return _0x40b9b2[_0x9ffa('0x19')](_0x359927)[_0x9ffa('0x1a')](_0x57a759);}};}function respondWithFilteredResult(_0x4aeb0d,_0x3e32c0){return function(_0x212957){if(_0x212957){var _0x4e9e76=typeof _0x3e32c0[_0x9ffa('0x1b')]===_0x9ffa('0x1c')&&typeof _0x3e32c0[_0x9ffa('0x1d')]===_0x9ffa('0x1c');var _0x550b8c=_0x212957[_0x9ffa('0x1e')];var _0x11df12=_0x4e9e76?0x0:_0x3e32c0['offset'];var _0x13dff4=_0x4e9e76?_0x212957[_0x9ffa('0x1e')]:_0x3e32c0[_0x9ffa('0x1b')]+_0x3e32c0[_0x9ffa('0x1d')];var _0x232773;if(_0x13dff4>=_0x550b8c){_0x13dff4=_0x550b8c;_0x232773=0xc8;}else{_0x232773=0xce;}_0x4aeb0d[_0x9ffa('0x19')](_0x232773);return _0x4aeb0d[_0x9ffa('0x1f')](_0x9ffa('0x20'),_0x11df12+'-'+_0x13dff4+'/'+_0x550b8c)[_0x9ffa('0x1a')](_0x212957);}return null;};}function patchUpdates(_0x3d8f5e){return function(_0x1ffca1){try{jsonpatch[_0x9ffa('0x21')](_0x1ffca1,_0x3d8f5e,!![]);}catch(_0x517865){return BPromise['reject'](_0x517865);}return _0x1ffca1[_0x9ffa('0x22')]();};}function saveUpdates(_0x2e0798,_0x9d7c3a){return function(_0x19fd3b){if(_0x19fd3b){return _0x19fd3b[_0x9ffa('0x23')](_0x2e0798)[_0x9ffa('0x24')](function(_0x41d9fc){return _0x41d9fc;});}return null;};}function removeEntity(_0x3c7b32,_0x10eeb9){return function(_0x3b00e2){if(_0x3b00e2){return _0x3b00e2['destroy']()['then'](function(){_0x3c7b32[_0x9ffa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e34c7,_0x592f34){return function(_0x221a33){if(!_0x221a33){_0x5e34c7['sendStatus'](0x194);}return _0x221a33;};}function handleError(_0x39d380,_0x52db38){_0x52db38=_0x52db38||0x1f4;return function(_0x26a47e){logger[_0x9ffa('0x25')](_0x26a47e['stack']);if(_0x26a47e['name']){delete _0x26a47e[_0x9ffa('0x26')];}_0x39d380['status'](_0x52db38)[_0x9ffa('0x27')](_0x26a47e);};}exports['index']=function(_0x149463,_0x800471){var _0x432bb8={},_0x646f5a={},_0x536e66={'count':0x0,'rows':[]};var _0x252157=_[_0x9ffa('0x28')](db[_0x9ffa('0x29')][_0x9ffa('0x2a')],function(_0x2d28e5){return{'name':_0x2d28e5[_0x9ffa('0x2b')],'type':_0x2d28e5[_0x9ffa('0x2c')][_0x9ffa('0x2d')]};});_0x646f5a[_0x9ffa('0x2e')]=_[_0x9ffa('0x28')](_0x252157,_0x9ffa('0x26'));_0x646f5a[_0x9ffa('0x2f')]=_[_0x9ffa('0x30')](_0x149463[_0x9ffa('0x2f')]);_0x646f5a['filters']=_[_0x9ffa('0x31')](_0x646f5a[_0x9ffa('0x2e')],_0x646f5a[_0x9ffa('0x2f')]);_0x432bb8[_0x9ffa('0x32')]=_[_0x9ffa('0x31')](_0x646f5a[_0x9ffa('0x2e')],qs[_0x9ffa('0x33')](_0x149463[_0x9ffa('0x2f')][_0x9ffa('0x33')]));_0x432bb8['attributes']=_0x432bb8[_0x9ffa('0x32')][_0x9ffa('0x34')]?_0x432bb8[_0x9ffa('0x32')]:_0x646f5a[_0x9ffa('0x2e')];if(!_0x149463['query'][_0x9ffa('0x35')](_0x9ffa('0x36'))){_0x432bb8['limit']=qs[_0x9ffa('0x1d')](_0x149463[_0x9ffa('0x2f')][_0x9ffa('0x1d')]);_0x432bb8[_0x9ffa('0x1b')]=qs['offset'](_0x149463[_0x9ffa('0x2f')][_0x9ffa('0x1b')]);}_0x432bb8[_0x9ffa('0x37')]=qs[_0x9ffa('0x38')](_0x149463[_0x9ffa('0x2f')][_0x9ffa('0x38')]);_0x432bb8[_0x9ffa('0x39')]=qs[_0x9ffa('0x3a')](_['pick'](_0x149463['query'],_0x646f5a[_0x9ffa('0x3a')]),_0x252157);if(_0x149463[_0x9ffa('0x2f')][_0x9ffa('0x3b')]){_0x432bb8[_0x9ffa('0x39')]=_[_0x9ffa('0x3c')](_0x432bb8[_0x9ffa('0x39')],{'$or':_[_0x9ffa('0x28')](_0x252157,function(_0x1998ac){if(_0x1998ac[_0x9ffa('0x2c')]!==_0x9ffa('0x3d')){var _0x1faab2={};_0x1faab2[_0x1998ac[_0x9ffa('0x26')]]={'$like':'%'+_0x149463[_0x9ffa('0x2f')][_0x9ffa('0x3b')]+'%'};return _0x1faab2;}})});}_0x432bb8=_[_0x9ffa('0x3c')]({},_0x432bb8,_0x149463[_0x9ffa('0x3e')]);var _0x5a6ab3={'where':_0x432bb8[_0x9ffa('0x39')]};return db['SmsTransferReport'][_0x9ffa('0x1e')](_0x5a6ab3)[_0x9ffa('0x24')](function(_0x73020a){_0x536e66[_0x9ffa('0x1e')]=_0x73020a;if(_0x149463['query'][_0x9ffa('0x3f')]){_0x432bb8[_0x9ffa('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x9ffa('0x41')](_0x432bb8);})[_0x9ffa('0x24')](function(_0x30db00){_0x536e66[_0x9ffa('0x42')]=_0x30db00;return _0x536e66;})[_0x9ffa('0x24')](respondWithFilteredResult(_0x800471,_0x432bb8))[_0x9ffa('0x43')](handleError(_0x800471,null));};exports[_0x9ffa('0x44')]=function(_0x27c949,_0x2879e7){var _0x11a8f1={'raw':!![],'where':{'id':_0x27c949[_0x9ffa('0x45')]['id']}},_0x4e53f4={};_0x4e53f4[_0x9ffa('0x2e')]=_[_0x9ffa('0x30')](db[_0x9ffa('0x29')][_0x9ffa('0x2a')]);_0x4e53f4[_0x9ffa('0x2f')]=_[_0x9ffa('0x30')](_0x27c949['query']);_0x4e53f4[_0x9ffa('0x3a')]=_[_0x9ffa('0x31')](_0x4e53f4[_0x9ffa('0x2e')],_0x4e53f4[_0x9ffa('0x2f')]);_0x11a8f1[_0x9ffa('0x32')]=_['intersection'](_0x4e53f4[_0x9ffa('0x2e')],qs[_0x9ffa('0x33')](_0x27c949[_0x9ffa('0x2f')][_0x9ffa('0x33')]));_0x11a8f1[_0x9ffa('0x32')]=_0x11a8f1[_0x9ffa('0x32')]['length']?_0x11a8f1['attributes']:_0x4e53f4[_0x9ffa('0x2e')];if(_0x27c949[_0x9ffa('0x2f')][_0x9ffa('0x3f')]){_0x11a8f1['include']=[{'all':!![]}];}_0x11a8f1=_[_0x9ffa('0x3c')]({},_0x11a8f1,_0x27c949[_0x9ffa('0x3e')]);return db['SmsTransferReport'][_0x9ffa('0x46')](_0x11a8f1)[_0x9ffa('0x24')](handleEntityNotFound(_0x2879e7,null))['then'](respondWithResult(_0x2879e7,null))['catch'](handleError(_0x2879e7,null));};exports['create']=function(_0x186670,_0x536a93){return db[_0x9ffa('0x29')][_0x9ffa('0x47')](_0x186670[_0x9ffa('0x48')],{})['then'](respondWithResult(_0x536a93,0xc9))[_0x9ffa('0x43')](handleError(_0x536a93,null));};exports[_0x9ffa('0x23')]=function(_0x517c65,_0x462d80){if(_0x517c65[_0x9ffa('0x48')]['id']){delete _0x517c65['body']['id'];}return db[_0x9ffa('0x29')][_0x9ffa('0x46')]({'where':{'id':_0x517c65[_0x9ffa('0x45')]['id']}})[_0x9ffa('0x24')](handleEntityNotFound(_0x462d80,null))['then'](saveUpdates(_0x517c65[_0x9ffa('0x48')],null))[_0x9ffa('0x24')](respondWithResult(_0x462d80,null))[_0x9ffa('0x43')](handleError(_0x462d80,null));};exports[_0x9ffa('0x49')]=function(_0x389af3,_0xa7e772){return db[_0x9ffa('0x29')][_0x9ffa('0x46')]({'where':{'id':_0x389af3[_0x9ffa('0x45')]['id']}})[_0x9ffa('0x24')](handleEntityNotFound(_0xa7e772,null))[_0x9ffa('0x24')](removeEntity(_0xa7e772,null))[_0x9ffa('0x43')](handleError(_0xa7e772,null));};exports['describe']=function(_0x4d64b3,_0x59cffc){return db[_0x9ffa('0x29')][_0x9ffa('0x4a')]()[_0x9ffa('0x24')](respondWithResult(_0x59cffc,null))[_0x9ffa('0x43')](handleError(_0x59cffc,null));}; \ No newline at end of file +var _0xdda2=['ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2084b1,_0x3ac9f3){var _0x2ae65a=function(_0x4f4ab3){while(--_0x4f4ab3){_0x2084b1['push'](_0x2084b1['shift']());}};_0x2ae65a(++_0x3ac9f3);}(_0xdda2,0xdc));var _0x2dda=function(_0x33bb5a,_0x5668aa){_0x33bb5a=_0x33bb5a-0x0;var _0x2cbcd7=_0xdda2[_0x33bb5a];return _0x2cbcd7;};'use strict';var emlformat=require(_0x2dda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dda('0x1'));var jsonpatch=require(_0x2dda('0x2'));var rp=require(_0x2dda('0x3'));var moment=require(_0x2dda('0x4'));var BPromise=require(_0x2dda('0x5'));var Mustache=require(_0x2dda('0x6'));var util=require(_0x2dda('0x7'));var path=require(_0x2dda('0x8'));var sox=require(_0x2dda('0x9'));var csv=require(_0x2dda('0xa'));var ejs=require(_0x2dda('0xb'));var fs=require('fs');var fs_extra=require(_0x2dda('0xc'));var _=require(_0x2dda('0xd'));var squel=require(_0x2dda('0xe'));var crypto=require('crypto');var jsforce=require(_0x2dda('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2dda('0xa'));var querystring=require('querystring');var Papa=require(_0x2dda('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2dda('0x11'));var as=require(_0x2dda('0x12'));var hardwareService=require(_0x2dda('0x13'));var logger=require('../../config/logger')(_0x2dda('0x14'));var utils=require(_0x2dda('0x15'));var config=require(_0x2dda('0x16'));var licenseUtil=require(_0x2dda('0x17'));var db=require(_0x2dda('0x18'))['db'];function respondWithStatusCode(_0x24df91,_0x3b0809){_0x3b0809=_0x3b0809||0xcc;return function(_0x531bf){if(_0x531bf){return _0x24df91[_0x2dda('0x19')](_0x3b0809);}return _0x24df91['status'](_0x3b0809)[_0x2dda('0x1a')]();};}function respondWithResult(_0x99078b,_0x46fb5f){_0x46fb5f=_0x46fb5f||0xc8;return function(_0x1dbfaa){if(_0x1dbfaa){return _0x99078b[_0x2dda('0x1b')](_0x46fb5f)[_0x2dda('0x1c')](_0x1dbfaa);}};}function respondWithFilteredResult(_0x4eaafd,_0x3701d3){return function(_0x1790ec){if(_0x1790ec){var _0x2e23ce=typeof _0x3701d3[_0x2dda('0x1d')]===_0x2dda('0x1e')&&typeof _0x3701d3[_0x2dda('0x1f')]===_0x2dda('0x1e');var _0x20dd35=_0x1790ec[_0x2dda('0x20')];var _0x327546=_0x2e23ce?0x0:_0x3701d3[_0x2dda('0x1d')];var _0x5bc9f5=_0x2e23ce?_0x1790ec[_0x2dda('0x20')]:_0x3701d3['offset']+_0x3701d3['limit'];var _0x4ef4da;if(_0x5bc9f5>=_0x20dd35){_0x5bc9f5=_0x20dd35;_0x4ef4da=0xc8;}else{_0x4ef4da=0xce;}_0x4eaafd['status'](_0x4ef4da);return _0x4eaafd[_0x2dda('0x21')](_0x2dda('0x22'),_0x327546+'-'+_0x5bc9f5+'/'+_0x20dd35)['json'](_0x1790ec);}return null;};}function patchUpdates(_0x8b68aa){return function(_0x8ba14e){try{jsonpatch[_0x2dda('0x23')](_0x8ba14e,_0x8b68aa,!![]);}catch(_0x233678){return BPromise['reject'](_0x233678);}return _0x8ba14e[_0x2dda('0x24')]();};}function saveUpdates(_0x2e509b,_0x5d3aa2){return function(_0x43590f){if(_0x43590f){return _0x43590f[_0x2dda('0x25')](_0x2e509b)[_0x2dda('0x26')](function(_0x358c2a){return _0x358c2a;});}return null;};}function removeEntity(_0x48a975,_0x3872f3){return function(_0x96b58d){if(_0x96b58d){return _0x96b58d[_0x2dda('0x27')]()['then'](function(){_0x48a975[_0x2dda('0x1b')](0xcc)[_0x2dda('0x1a')]();});}};}function handleEntityNotFound(_0x5a1266,_0x149009){return function(_0x45b8cf){if(!_0x45b8cf){_0x5a1266[_0x2dda('0x19')](0x194);}return _0x45b8cf;};}function handleError(_0x2e90fc,_0x26bec2){_0x26bec2=_0x26bec2||0x1f4;return function(_0x4d4360){logger[_0x2dda('0x28')](_0x4d4360[_0x2dda('0x29')]);if(_0x4d4360[_0x2dda('0x2a')]){delete _0x4d4360[_0x2dda('0x2a')];}_0x2e90fc[_0x2dda('0x1b')](_0x26bec2)[_0x2dda('0x2b')](_0x4d4360);};}exports['index']=function(_0x226398,_0x3e9f59){var _0xd1a94a={},_0xf5c886={},_0x590e8e={'count':0x0,'rows':[]};var _0x11abd9=_[_0x2dda('0x2c')](db[_0x2dda('0x2d')]['rawAttributes'],function(_0x1610d6){return{'name':_0x1610d6[_0x2dda('0x2e')],'type':_0x1610d6[_0x2dda('0x2f')][_0x2dda('0x30')]};});_0xf5c886['model']=_['map'](_0x11abd9,_0x2dda('0x2a'));_0xf5c886[_0x2dda('0x31')]=_[_0x2dda('0x32')](_0x226398['query']);_0xf5c886[_0x2dda('0x33')]=_[_0x2dda('0x34')](_0xf5c886[_0x2dda('0x35')],_0xf5c886[_0x2dda('0x31')]);_0xd1a94a['attributes']=_[_0x2dda('0x34')](_0xf5c886[_0x2dda('0x35')],qs['fields'](_0x226398[_0x2dda('0x31')][_0x2dda('0x36')]));_0xd1a94a[_0x2dda('0x37')]=_0xd1a94a[_0x2dda('0x37')][_0x2dda('0x38')]?_0xd1a94a[_0x2dda('0x37')]:_0xf5c886[_0x2dda('0x35')];if(!_0x226398['query'][_0x2dda('0x39')](_0x2dda('0x3a'))){_0xd1a94a['limit']=qs[_0x2dda('0x1f')](_0x226398['query'][_0x2dda('0x1f')]);_0xd1a94a[_0x2dda('0x1d')]=qs[_0x2dda('0x1d')](_0x226398[_0x2dda('0x31')]['offset']);}_0xd1a94a[_0x2dda('0x3b')]=qs[_0x2dda('0x3c')](_0x226398['query'][_0x2dda('0x3c')]);_0xd1a94a['where']=qs['filters'](_[_0x2dda('0x3d')](_0x226398[_0x2dda('0x31')],_0xf5c886['filters']),_0x11abd9);if(_0x226398[_0x2dda('0x31')][_0x2dda('0x3e')]){_0xd1a94a[_0x2dda('0x3f')]=_[_0x2dda('0x40')](_0xd1a94a[_0x2dda('0x3f')],{'$or':_[_0x2dda('0x2c')](_0x11abd9,function(_0x421ebe){if(_0x421ebe[_0x2dda('0x2f')]!==_0x2dda('0x41')){var _0x4cc7ef={};_0x4cc7ef[_0x421ebe[_0x2dda('0x2a')]]={'$like':'%'+_0x226398[_0x2dda('0x31')][_0x2dda('0x3e')]+'%'};return _0x4cc7ef;}})});}_0xd1a94a=_[_0x2dda('0x40')]({},_0xd1a94a,_0x226398[_0x2dda('0x42')]);var _0x581a32={'where':_0xd1a94a[_0x2dda('0x3f')]};return db[_0x2dda('0x2d')][_0x2dda('0x20')](_0x581a32)['then'](function(_0x17e43e){_0x590e8e[_0x2dda('0x20')]=_0x17e43e;if(_0x226398[_0x2dda('0x31')][_0x2dda('0x43')]){_0xd1a94a[_0x2dda('0x44')]=[{'all':!![]}];}return db[_0x2dda('0x2d')][_0x2dda('0x45')](_0xd1a94a);})[_0x2dda('0x26')](function(_0x4d917e){_0x590e8e[_0x2dda('0x46')]=_0x4d917e;return _0x590e8e;})[_0x2dda('0x26')](respondWithFilteredResult(_0x3e9f59,_0xd1a94a))[_0x2dda('0x47')](handleError(_0x3e9f59,null));};exports[_0x2dda('0x48')]=function(_0x30dde6,_0x4c797b){var _0x3d96dd={'raw':!![],'where':{'id':_0x30dde6[_0x2dda('0x49')]['id']}},_0x516477={};_0x516477[_0x2dda('0x35')]=_[_0x2dda('0x32')](db['SmsTransferReport']['rawAttributes']);_0x516477['query']=_[_0x2dda('0x32')](_0x30dde6[_0x2dda('0x31')]);_0x516477[_0x2dda('0x33')]=_['intersection'](_0x516477[_0x2dda('0x35')],_0x516477[_0x2dda('0x31')]);_0x3d96dd['attributes']=_[_0x2dda('0x34')](_0x516477[_0x2dda('0x35')],qs[_0x2dda('0x36')](_0x30dde6['query']['fields']));_0x3d96dd[_0x2dda('0x37')]=_0x3d96dd[_0x2dda('0x37')][_0x2dda('0x38')]?_0x3d96dd[_0x2dda('0x37')]:_0x516477['model'];if(_0x30dde6[_0x2dda('0x31')][_0x2dda('0x43')]){_0x3d96dd[_0x2dda('0x44')]=[{'all':!![]}];}_0x3d96dd=_['merge']({},_0x3d96dd,_0x30dde6[_0x2dda('0x42')]);return db[_0x2dda('0x2d')][_0x2dda('0x4a')](_0x3d96dd)[_0x2dda('0x26')](handleEntityNotFound(_0x4c797b,null))[_0x2dda('0x26')](respondWithResult(_0x4c797b,null))[_0x2dda('0x47')](handleError(_0x4c797b,null));};exports['create']=function(_0x4c66c9,_0x4fb11e){return db[_0x2dda('0x2d')]['create'](_0x4c66c9[_0x2dda('0x4b')],{})[_0x2dda('0x26')](respondWithResult(_0x4fb11e,0xc9))[_0x2dda('0x47')](handleError(_0x4fb11e,null));};exports[_0x2dda('0x25')]=function(_0x2ae44f,_0x4c659a){if(_0x2ae44f['body']['id']){delete _0x2ae44f[_0x2dda('0x4b')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2ae44f[_0x2dda('0x49')]['id']}})[_0x2dda('0x26')](handleEntityNotFound(_0x4c659a,null))[_0x2dda('0x26')](saveUpdates(_0x2ae44f[_0x2dda('0x4b')],null))[_0x2dda('0x26')](respondWithResult(_0x4c659a,null))[_0x2dda('0x47')](handleError(_0x4c659a,null));};exports[_0x2dda('0x27')]=function(_0x112248,_0x487e07){return db[_0x2dda('0x2d')][_0x2dda('0x4a')]({'where':{'id':_0x112248[_0x2dda('0x49')]['id']}})['then'](handleEntityNotFound(_0x487e07,null))[_0x2dda('0x26')](removeEntity(_0x487e07,null))[_0x2dda('0x47')](handleError(_0x487e07,null));};exports['describe']=function(_0x5b950d,_0x26ae5a){return db[_0x2dda('0x2d')][_0x2dda('0x4c')]()['then'](respondWithResult(_0x26ae5a,null))[_0x2dda('0x47')](handleError(_0x26ae5a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 8b6ae30..db504c3 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 _0x9491=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_sms_transfer','uniqueid'];(function(_0xa7bd4,_0x3a17c9){var _0x2b971e=function(_0x208baf){while(--_0x208baf){_0xa7bd4['push'](_0xa7bd4['shift']());}};_0x2b971e(++_0x3a17c9);}(_0x9491,0xb6));var _0x1949=function(_0x526a38,_0x107fdb){_0x526a38=_0x526a38-0x0;var _0x26aa09=_0x9491[_0x526a38];return _0x26aa09;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var logger=require(_0x1949('0x2'))(_0x1949('0x3'));var moment=require(_0x1949('0x4'));var BPromise=require(_0x1949('0x5'));var rp=require(_0x1949('0x6'));var fs=require('fs');var path=require(_0x1949('0x7'));var rimraf=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x1949('0xa')]=function(_0x5b01b9,_0x14c30e){return _0x5b01b9[_0x1949('0xb')]('SmsTransferReport',attributes,{'tableName':_0x1949('0xc'),'paranoid':![],'indexes':[{'name':_0x1949('0xd'),'fields':[_0x1949('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc52f=['util','bluebird','request-promise','path','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x49ccf0,_0x2e9d53){var _0x23ed5c=function(_0x376de5){while(--_0x376de5){_0x49ccf0['push'](_0x49ccf0['shift']());}};_0x23ed5c(++_0x2e9d53);}(_0xc52f,0x1e3));var _0xfc52=function(_0x395e4f,_0x196c84){_0x395e4f=_0x395e4f-0x0;var _0x15a669=_0xc52f[_0x395e4f];return _0x15a669;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc52('0x2'));var rp=require(_0xfc52('0x3'));var fs=require('fs');var path=require(_0xfc52('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc52('0x5'));module[_0xfc52('0x6')]=function(_0x29636f,_0x5cb478){return _0x29636f[_0xfc52('0x7')](_0xfc52('0x8'),attributes,{'tableName':_0xfc52('0x9'),'paranoid':![],'indexes':[{'name':_0xfc52('0xa'),'fields':[_0xfc52('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fd8aeab..fe0c472 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 _0x9c50=['message','catch','bluebird','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x9c50,0xec));var _0x09c5=function(_0x2098ea,_0x2ebf9b){_0x2098ea=_0x2098ea-0x0;var _0xd72d9=_0x9c50[_0x2098ea];return _0xd72d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x09c5('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09c5('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x09c5('0x2'))(_0x09c5('0x3'));var config=require('../../config/environment');var jayson=require(_0x09c5('0x4'));var client=jayson['client'][_0x09c5('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2830e5,_0x1f068b,_0x51ff47){return new BPromise(function(_0x27d297,_0x2ca015){return client[_0x09c5('0x6')](_0x2830e5,_0x51ff47)[_0x09c5('0x7')](function(_0x4a8703){logger[_0x09c5('0x8')]('SmsTransferReport,\x20%s,\x20%s',_0x1f068b,'request\x20sent');logger[_0x09c5('0x9')](_0x09c5('0xa'),_0x1f068b,_0x09c5('0xb'),JSON[_0x09c5('0xc')](_0x4a8703));if(_0x4a8703['error']){if(_0x4a8703[_0x09c5('0xd')][_0x09c5('0xe')]===0x1f4){logger[_0x09c5('0xd')](_0x09c5('0xf'),_0x1f068b,_0x4a8703[_0x09c5('0xd')][_0x09c5('0x10')]);return _0x2ca015(_0x4a8703['error']['message']);}logger[_0x09c5('0xd')](_0x09c5('0xf'),_0x1f068b,_0x4a8703[_0x09c5('0xd')][_0x09c5('0x10')]);return _0x27d297(_0x4a8703['error']['message']);}else{logger[_0x09c5('0x8')]('SmsTransferReport,\x20%s,\x20%s',_0x1f068b,'request\x20sent');_0x27d297(_0x4a8703['result'][_0x09c5('0x10')]);}})[_0x09c5('0x11')](function(_0x3d160f){logger[_0x09c5('0xd')](_0x09c5('0xf'),_0x1f068b,_0x3d160f);_0x2ca015(_0x3d160f);});});} \ No newline at end of file +var _0x03db=['client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x551d20,_0x2f9c1c){var _0x296e3d=function(_0x14cd4b){while(--_0x14cd4b){_0x551d20['push'](_0x551d20['shift']());}};_0x296e3d(++_0x2f9c1c);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb03d('0x0'));var util=require(_0xb03d('0x1'));var moment=require(_0xb03d('0x2'));var BPromise=require(_0xb03d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb03d('0x4'));var db=require(_0xb03d('0x5'))['db'];var utils=require(_0xb03d('0x6'));var logger=require(_0xb03d('0x7'))(_0xb03d('0x8'));var config=require('../../config/environment');var jayson=require(_0xb03d('0x9'));var client=jayson[_0xb03d('0xa')][_0xb03d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57a19b,_0xedddf,_0x5f1238){return new BPromise(function(_0x181291,_0x24ff92){return client[_0xb03d('0xc')](_0x57a19b,_0x5f1238)[_0xb03d('0xd')](function(_0x2748f7){logger[_0xb03d('0xe')](_0xb03d('0xf'),_0xedddf,'request\x20sent');logger[_0xb03d('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xedddf,'request\x20sent',JSON[_0xb03d('0x11')](_0x2748f7));if(_0x2748f7[_0xb03d('0x12')]){if(_0x2748f7['error']['code']===0x1f4){logger[_0xb03d('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0xedddf,_0x2748f7['error'][_0xb03d('0x13')]);return _0x24ff92(_0x2748f7['error'][_0xb03d('0x13')]);}logger[_0xb03d('0x12')](_0xb03d('0xf'),_0xedddf,_0x2748f7[_0xb03d('0x12')][_0xb03d('0x13')]);return _0x181291(_0x2748f7[_0xb03d('0x12')][_0xb03d('0x13')]);}else{logger['info'](_0xb03d('0xf'),_0xedddf,_0xb03d('0x14'));_0x181291(_0x2748f7[_0xb03d('0x15')]['message']);}})['catch'](function(_0x21fd7a){logger[_0xb03d('0x12')](_0xb03d('0xf'),_0xedddf,_0x21fd7a);_0x24ff92(_0x21fd7a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 73f561a..9c2b380 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 _0x68c2=['originalname','replace','format','basename','extname','now','file','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','get','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x68c2,0x1e8));var _0x268c=function(_0x27f9d3,_0x54ee48){_0x27f9d3=_0x27f9d3-0x0;var _0x1d2c10=_0x68c2[_0x27f9d3];return _0x1d2c10;};'use strict';var multer=require('multer');var util=require(_0x268c('0x0'));var path=require(_0x268c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x268c('0x2')]();var fs_extra=require(_0x268c('0x3'));var auth=require(_0x268c('0x4'));var interaction=require(_0x268c('0x5'));var config=require('../../config/environment');var controller=require(_0x268c('0x6'));router['get']('/',auth[_0x268c('0x7')](),controller['index']);router[_0x268c('0x8')](_0x268c('0x9'),auth[_0x268c('0x7')](),controller['show']);router[_0x268c('0x8')](_0x268c('0xa'),auth['isAuthenticated'](),controller[_0x268c('0xb')]);var upload=multer({'storage':multer[_0x268c('0xc')]({'destination':function(_0x404a2a,_0x9dda8c,_0xe60317){_0xe60317(null,path[_0x268c('0xd')](config[_0x268c('0xe')],_0x268c('0xf')));},'filename':function(_0x4e56aa,_0x3607af,_0x32d420){_0x3607af[_0x268c('0x10')]=_0x3607af[_0x268c('0x10')][_0x268c('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32d420(null,util[_0x268c('0x12')]('%s-%s%s',path[_0x268c('0x13')](_0x3607af['originalname'],path[_0x268c('0x14')](_0x3607af[_0x268c('0x10')])),Date[_0x268c('0x15')](),path[_0x268c('0x14')](_0x3607af[_0x268c('0x10')])));}})});router['post']('/',upload['single'](_0x268c('0x16')),controller[_0x268c('0x17')]);router[_0x268c('0x18')]('/:id',auth[_0x268c('0x7')](),controller[_0x268c('0x19')]);router[_0x268c('0x1a')](_0x268c('0x9'),auth[_0x268c('0x7')](),controller[_0x268c('0x1a')]);module[_0x268c('0x1b')]=router; \ No newline at end of file +var _0xf5fd=['originalname','extname','post','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','replace','format','%s-%s%s','basename'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf5fd,0xae));var _0xdf5f=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf5fd[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xdf5f('0x0'));var util=require(_0xdf5f('0x1'));var path=require(_0xdf5f('0x2'));var timeout=require(_0xdf5f('0x3'));var express=require(_0xdf5f('0x4'));var router=express[_0xdf5f('0x5')]();var fs_extra=require(_0xdf5f('0x6'));var auth=require(_0xdf5f('0x7'));var interaction=require(_0xdf5f('0x8'));var config=require(_0xdf5f('0x9'));var controller=require(_0xdf5f('0xa'));router[_0xdf5f('0xb')]('/',auth[_0xdf5f('0xc')](),controller[_0xdf5f('0xd')]);router[_0xdf5f('0xb')](_0xdf5f('0xe'),auth['isAuthenticated'](),controller[_0xdf5f('0xf')]);router['get'](_0xdf5f('0x10'),auth['isAuthenticated'](),controller[_0xdf5f('0x11')]);var upload=multer({'storage':multer[_0xdf5f('0x12')]({'destination':function(_0x520d84,_0x26dcc2,_0x38011b){_0x38011b(null,path['join'](config[_0xdf5f('0x13')],'server/files/sounds/original/'));},'filename':function(_0x53ab5b,_0x565d4c,_0x2ebad7){_0x565d4c['originalname']=_0x565d4c['originalname'][_0xdf5f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ebad7(null,util[_0xdf5f('0x15')](_0xdf5f('0x16'),path[_0xdf5f('0x17')](_0x565d4c[_0xdf5f('0x18')],path[_0xdf5f('0x19')](_0x565d4c[_0xdf5f('0x18')])),Date['now'](),path[_0xdf5f('0x19')](_0x565d4c[_0xdf5f('0x18')])));}})});router[_0xdf5f('0x1a')]('/',upload['single'](_0xdf5f('0x1b')),controller[_0xdf5f('0x1c')]);router[_0xdf5f('0x1d')](_0xdf5f('0xe'),auth[_0xdf5f('0xc')](),controller[_0xdf5f('0x1e')]);router[_0xdf5f('0x1f')](_0xdf5f('0xe'),auth[_0xdf5f('0xc')](),controller[_0xdf5f('0x1f')]);module[_0xdf5f('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e232f5b..d07754d 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 _0x2c0b=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x2c0b,0xfb));var _0xb2c0=function(_0x4e711f,_0x1562d2){_0x4e711f=_0x4e711f-0x0;var _0x20f62a=_0x2c0b[_0x4e711f];return _0x20f62a;};'use strict';var Sequelize=require(_0xb2c0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2c0('0x1')],'unique':_0xb2c0('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb2c0('0x1')]},'display_name':{'type':Sequelize[_0xb2c0('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xb2c0('0x1')]},'original_format':{'type':Sequelize[_0xb2c0('0x1')]},'original_duration':{'type':Sequelize[_0xb2c0('0x3')]},'original_sampleCount':{'type':Sequelize[_0xb2c0('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xb2c0('0x4')]},'original_sampleRate':{'type':Sequelize[_0xb2c0('0x5')]},'converted_format':{'type':Sequelize[_0xb2c0('0x1')]},'converted_duration':{'type':Sequelize[_0xb2c0('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xb2c0('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xb2c0('0x5')]}}; \ No newline at end of file +var _0x9a30=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x9a30,0xf8));var _0x09a3=function(_0x1b2a03,_0x133acf){_0x1b2a03=_0x1b2a03-0x0;var _0x21f98a=_0x9a30[_0x1b2a03];return _0x21f98a;};'use strict';var Sequelize=require(_0x09a3('0x0'));module[_0x09a3('0x1')]={'name':{'type':Sequelize[_0x09a3('0x2')],'unique':_0x09a3('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x09a3('0x2')]},'display_name':{'type':Sequelize[_0x09a3('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x09a3('0x2')]},'original_duration':{'type':Sequelize[_0x09a3('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x09a3('0x5')]},'original_sampleRate':{'type':Sequelize[_0x09a3('0x6')]},'converted_format':{'type':Sequelize[_0x09a3('0x2')]},'converted_duration':{'type':Sequelize[_0x09a3('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x09a3('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x09a3('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0228018..e1919db 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 _0x9b58=['reject','save','update','then','destroy','get','Sounds','sendStatus','error','stack','name','send','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','include','rows','catch','show','length','find','download','params','save_name','converted_format','root','Sequelize','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','join','server/files/sounds/converted','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set'];(function(_0x32bba8,_0x2a68b3){var _0x598abb=function(_0x4c76ec){while(--_0x4c76ec){_0x32bba8['push'](_0x32bba8['shift']());}};_0x598abb(++_0x2a68b3);}(_0x9b58,0x1bd));var _0x89b5=function(_0x5df245,_0x2ef682){_0x5df245=_0x5df245-0x0;var _0x207b88=_0x9b58[_0x5df245];return _0x207b88;};'use strict';var emlformat=require(_0x89b5('0x0'));var rimraf=require(_0x89b5('0x1'));var zipdir=require(_0x89b5('0x2'));var jsonpatch=require(_0x89b5('0x3'));var rp=require(_0x89b5('0x4'));var moment=require(_0x89b5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x89b5('0x6'));var csv=require(_0x89b5('0x7'));var ejs=require(_0x89b5('0x8'));var fs=require('fs');var fs_extra=require(_0x89b5('0x9'));var _=require(_0x89b5('0xa'));var squel=require('squel');var crypto=require(_0x89b5('0xb'));var jsforce=require(_0x89b5('0xc'));var deskjs=require(_0x89b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x89b5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x89b5('0xf'));var as=require(_0x89b5('0x10'));var hardwareService=require(_0x89b5('0x11'));var logger=require(_0x89b5('0x12'))('api');var utils=require(_0x89b5('0x13'));var config=require(_0x89b5('0x14'));var licenseUtil=require(_0x89b5('0x15'));var db=require(_0x89b5('0x16'))['db'];function respondWithStatusCode(_0x217edd,_0x60ae01){_0x60ae01=_0x60ae01||0xcc;return function(_0x2666aa){if(_0x2666aa){return _0x217edd['sendStatus'](_0x60ae01);}return _0x217edd[_0x89b5('0x17')](_0x60ae01)[_0x89b5('0x18')]();};}function respondWithResult(_0x1fea70,_0x3446f1){_0x3446f1=_0x3446f1||0xc8;return function(_0x533112){if(_0x533112){return _0x1fea70[_0x89b5('0x17')](_0x3446f1)[_0x89b5('0x19')](_0x533112);}};}function respondWithFilteredResult(_0x4f5bb4,_0x339c88){return function(_0x48f781){if(_0x48f781){var _0x240d23=typeof _0x339c88['offset']===_0x89b5('0x1a')&&typeof _0x339c88['limit']===_0x89b5('0x1a');var _0x48f68b=_0x48f781[_0x89b5('0x1b')];var _0x4e7b80=_0x240d23?0x0:_0x339c88[_0x89b5('0x1c')];var _0x14c23f=_0x240d23?_0x48f781[_0x89b5('0x1b')]:_0x339c88['offset']+_0x339c88[_0x89b5('0x1d')];var _0x365986;if(_0x14c23f>=_0x48f68b){_0x14c23f=_0x48f68b;_0x365986=0xc8;}else{_0x365986=0xce;}_0x4f5bb4[_0x89b5('0x17')](_0x365986);return _0x4f5bb4[_0x89b5('0x1e')]('Content-Range',_0x4e7b80+'-'+_0x14c23f+'/'+_0x48f68b)[_0x89b5('0x19')](_0x48f781);}return null;};}function patchUpdates(_0x169417){return function(_0x218725){try{jsonpatch['apply'](_0x218725,_0x169417,!![]);}catch(_0x4d5528){return BPromise[_0x89b5('0x1f')](_0x4d5528);}return _0x218725[_0x89b5('0x20')]();};}function saveUpdates(_0x49a465,_0x8ebe21){return function(_0x4dbbe4){if(_0x4dbbe4){return _0x4dbbe4[_0x89b5('0x21')](_0x49a465)[_0x89b5('0x22')](function(_0x30e0d5){return _0x30e0d5;});}return null;};}function removeEntity(_0x475b89,_0x1bdfbc){return function(_0x314651){if(_0x314651){return _0x314651[_0x89b5('0x23')]()[_0x89b5('0x22')](function(){var _0x3a8885=_0x314651[_0x89b5('0x24')]({'plain':!![]});var _0x9750bd=_0x89b5('0x25');return db['UserProfileResource'][_0x89b5('0x23')]({'where':{'type':_0x9750bd,'resourceId':_0x3a8885['id']}})[_0x89b5('0x22')](function(){return _0x314651;});})[_0x89b5('0x22')](function(){_0x475b89[_0x89b5('0x17')](0xcc)[_0x89b5('0x18')]();});}};}function handleEntityNotFound(_0x1ea707,_0x1e0b4a){return function(_0x2a4d20){if(!_0x2a4d20){_0x1ea707[_0x89b5('0x26')](0x194);}return _0x2a4d20;};}function handleError(_0x1678c3,_0x4d7b10){_0x4d7b10=_0x4d7b10||0x1f4;return function(_0x4da0c8){logger[_0x89b5('0x27')](_0x4da0c8[_0x89b5('0x28')]);if(_0x4da0c8[_0x89b5('0x29')]){delete _0x4da0c8[_0x89b5('0x29')];}_0x1678c3[_0x89b5('0x17')](_0x4d7b10)[_0x89b5('0x2a')](_0x4da0c8);};}exports['index']=function(_0x3061dd,_0x3d577e){var _0x3480ed={},_0x41e94c={},_0xb511d3={'count':0x0,'rows':[]};var _0x80dd5f=_[_0x89b5('0x2b')](db[_0x89b5('0x2c')][_0x89b5('0x2d')],function(_0x53e1e4){return{'name':_0x53e1e4['fieldName'],'type':_0x53e1e4[_0x89b5('0x2e')][_0x89b5('0x2f')]};});_0x41e94c[_0x89b5('0x30')]=_[_0x89b5('0x2b')](_0x80dd5f,'name');_0x41e94c[_0x89b5('0x31')]=_[_0x89b5('0x32')](_0x3061dd[_0x89b5('0x31')]);_0x41e94c[_0x89b5('0x33')]=_[_0x89b5('0x34')](_0x41e94c[_0x89b5('0x30')],_0x41e94c['query']);_0x3480ed[_0x89b5('0x35')]=_[_0x89b5('0x34')](_0x41e94c['model'],qs[_0x89b5('0x36')](_0x3061dd[_0x89b5('0x31')]['fields']));_0x3480ed[_0x89b5('0x35')]=_0x3480ed['attributes']['length']?_0x3480ed[_0x89b5('0x35')]:_0x41e94c[_0x89b5('0x30')];if(!_0x3061dd['query'][_0x89b5('0x37')](_0x89b5('0x38'))){_0x3480ed[_0x89b5('0x1d')]=qs[_0x89b5('0x1d')](_0x3061dd[_0x89b5('0x31')][_0x89b5('0x1d')]);_0x3480ed['offset']=qs[_0x89b5('0x1c')](_0x3061dd[_0x89b5('0x31')][_0x89b5('0x1c')]);}_0x3480ed[_0x89b5('0x39')]=qs['sort'](_0x3061dd[_0x89b5('0x31')]['sort']);_0x3480ed[_0x89b5('0x3a')]=qs['filters'](_[_0x89b5('0x3b')](_0x3061dd[_0x89b5('0x31')],_0x41e94c[_0x89b5('0x33')]),_0x80dd5f);if(_0x3061dd['query']['filter']){_0x3480ed['where']=_[_0x89b5('0x3c')](_0x3480ed[_0x89b5('0x3a')],{'$or':_[_0x89b5('0x2b')](_0x80dd5f,function(_0x537b58){if(_0x537b58['type']!=='VIRTUAL'){var _0x2fcb81={};_0x2fcb81[_0x537b58['name']]={'$like':'%'+_0x3061dd[_0x89b5('0x31')][_0x89b5('0x3d')]+'%'};return _0x2fcb81;}})});}_0x3480ed=_['merge']({},_0x3480ed,_0x3061dd[_0x89b5('0x3e')]);var _0x53ce06={'where':_0x3480ed[_0x89b5('0x3a')]};return db[_0x89b5('0x2c')][_0x89b5('0x1b')](_0x53ce06)[_0x89b5('0x22')](function(_0x39070b){_0xb511d3['count']=_0x39070b;if(_0x3061dd['query'][_0x89b5('0x3f')]){_0x3480ed[_0x89b5('0x40')]=[{'all':!![]}];}return db[_0x89b5('0x2c')]['findAll'](_0x3480ed);})[_0x89b5('0x22')](function(_0x2eb0ee){_0xb511d3[_0x89b5('0x41')]=_0x2eb0ee;return _0xb511d3;})[_0x89b5('0x22')](respondWithFilteredResult(_0x3d577e,_0x3480ed))[_0x89b5('0x42')](handleError(_0x3d577e,null));};exports[_0x89b5('0x43')]=function(_0x111fbd,_0x26b935){var _0x5c1d17={'raw':!![],'where':{'id':_0x111fbd['params']['id']}},_0x323550={};_0x323550['model']=_[_0x89b5('0x32')](db[_0x89b5('0x2c')][_0x89b5('0x2d')]);_0x323550[_0x89b5('0x31')]=_[_0x89b5('0x32')](_0x111fbd[_0x89b5('0x31')]);_0x323550[_0x89b5('0x33')]=_[_0x89b5('0x34')](_0x323550[_0x89b5('0x30')],_0x323550[_0x89b5('0x31')]);_0x5c1d17[_0x89b5('0x35')]=_[_0x89b5('0x34')](_0x323550['model'],qs[_0x89b5('0x36')](_0x111fbd[_0x89b5('0x31')][_0x89b5('0x36')]));_0x5c1d17[_0x89b5('0x35')]=_0x5c1d17[_0x89b5('0x35')][_0x89b5('0x44')]?_0x5c1d17[_0x89b5('0x35')]:_0x323550[_0x89b5('0x30')];if(_0x111fbd['query']['includeAll']){_0x5c1d17[_0x89b5('0x40')]=[{'all':!![]}];}_0x5c1d17=_[_0x89b5('0x3c')]({},_0x5c1d17,_0x111fbd[_0x89b5('0x3e')]);return db[_0x89b5('0x2c')][_0x89b5('0x45')](_0x5c1d17)['then'](handleEntityNotFound(_0x26b935,null))[_0x89b5('0x22')](respondWithResult(_0x26b935,null))[_0x89b5('0x42')](handleError(_0x26b935,null));};exports[_0x89b5('0x46')]=function(_0x56fbb2,_0x420317,_0x37bc34){return db[_0x89b5('0x2c')][_0x89b5('0x45')]({'where':{'id':_0x56fbb2[_0x89b5('0x47')]['id']},'attributes':[_0x89b5('0x29'),_0x89b5('0x48'),_0x89b5('0x49')],'raw':!![]})[_0x89b5('0x22')](handleEntityNotFound(_0x420317,null))[_0x89b5('0x22')](function(_0x37e259){if(_0x37e259){if(!fs['existsSync'](path['join'](config[_0x89b5('0x4a')],'server/files/sounds/converted',_0x37e259['save_name']+'.'+_0x37e259[_0x89b5('0x49')]))){throw new db[(_0x89b5('0x4b'))]['ValidationError']('Sound\x20not\x20found');}return _0x420317['download'](path['join'](config[_0x89b5('0x4a')],'server/files/sounds/converted',util[_0x89b5('0x4c')](_0x89b5('0x4d'),_0x37e259['save_name'],_0x37e259[_0x89b5('0x49')])),util['format'](_0x89b5('0x4d'),_0x37e259[_0x89b5('0x29')],_0x37e259[_0x89b5('0x49')]));}return null;})[_0x89b5('0x42')](handleError(_0x420317,null));};exports[_0x89b5('0x4e')]=function(_0x2b15eb,_0x3c8590,_0x306ae6){var _0x5e1165={'name':path[_0x89b5('0x4f')](_0x2b15eb[_0x89b5('0x50')][_0x89b5('0x51')],path['extname'](_0x2b15eb[_0x89b5('0x50')]['originalname'])),'save_name':path[_0x89b5('0x4f')](_0x2b15eb['file'][_0x89b5('0x52')],path[_0x89b5('0x53')](_0x2b15eb[_0x89b5('0x50')][_0x89b5('0x52')])),'original_format':path[_0x89b5('0x53')](_0x2b15eb[_0x89b5('0x50')][_0x89b5('0x51')])[_0x89b5('0x54')](0x1),'converted_format':_0x89b5('0x55')};var _0x2f55f0=path['join'](config[_0x89b5('0x4a')],_0x89b5('0x56'),_0x2b15eb['file']['filename']);var _0x3036c9=path[_0x89b5('0x57')](config[_0x89b5('0x4a')],_0x89b5('0x58'),util[_0x89b5('0x4c')]('%s.%s',path['basename'](_0x2b15eb[_0x89b5('0x50')][_0x89b5('0x52')],path[_0x89b5('0x53')](_0x2b15eb[_0x89b5('0x50')][_0x89b5('0x52')])),_0x5e1165[_0x89b5('0x49')]));logger['info'](_0x89b5('0x59'),_0x2f55f0);logger[_0x89b5('0x5a')](_0x89b5('0x5b'),_0x3036c9);try{fs[_0x89b5('0x5c')](_0x2f55f0,parseInt(_0x89b5('0x5d'),0x8));var _0x131515=sox[_0x89b5('0x5e')](_0x2f55f0,_0x3036c9,{'sampleRate':0x1f40,'format':_0x89b5('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x131515['on'](_0x89b5('0x27'),function(_0x512584){fs[_0x89b5('0x5f')](_0x2f55f0);_0x3c8590[_0x89b5('0x17')](0x1f4)[_0x89b5('0x2a')](_0x512584);});_0x131515['on'](_0x89b5('0x60'),function(_0x3d981a){_0x5e1165['original_duration']=isNaN(_0x3d981a[_0x89b5('0x61')])?null:_0x3d981a['duration']*0x3e8;_0x5e1165['original_sampleCount']=isNaN(_0x3d981a[_0x89b5('0x62')])?null:_0x3d981a[_0x89b5('0x62')];_0x5e1165[_0x89b5('0x63')]=isNaN(_0x3d981a[_0x89b5('0x64')])?null:_0x3d981a[_0x89b5('0x64')];_0x5e1165[_0x89b5('0x65')]=isNaN(_0x3d981a[_0x89b5('0x66')])?null:_0x3d981a[_0x89b5('0x66')];_0x5e1165[_0x89b5('0x67')]=isNaN(_0x3d981a['sampleRate'])?null:_0x3d981a[_0x89b5('0x68')];});_0x131515['on'](_0x89b5('0x69'),function(_0x2b3441){_0x5e1165['converted_duration']=isNaN(_0x2b3441[_0x89b5('0x61')])?null:_0x2b3441[_0x89b5('0x61')]*0x3e8;_0x5e1165[_0x89b5('0x6a')]=isNaN(_0x2b3441[_0x89b5('0x62')])?null:_0x2b3441['sampleCount'];_0x5e1165[_0x89b5('0x6b')]=isNaN(_0x2b3441[_0x89b5('0x64')])?null:_0x2b3441[_0x89b5('0x64')];_0x5e1165[_0x89b5('0x6c')]=isNaN(_0x2b3441[_0x89b5('0x66')])?null:_0x2b3441[_0x89b5('0x66')];_0x5e1165[_0x89b5('0x6d')]=isNaN(_0x2b3441[_0x89b5('0x68')])?null:_0x2b3441[_0x89b5('0x68')];});_0x131515['on']('end',function(){fs[_0x89b5('0x5c')](_0x3036c9,parseInt(_0x89b5('0x5d'),0x8));return db[_0x89b5('0x2c')]['create'](_0x5e1165)['then'](function(_0x8c349b){var _0x41b83c={'role':_0x2b15eb[_0x89b5('0x6e')][_0x89b5('0x6f')],'userProfileId':_0x2b15eb[_0x89b5('0x6e')][_0x89b5('0x70')]};if(!_0x41b83c)throw new Error(_0x89b5('0x71'));if(_0x41b83c[_0x89b5('0x6f')]===_0x89b5('0x72')){var _0x272708=_0x8c349b[_0x89b5('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x89b5('0x45')]({'where':{'name':_0x89b5('0x25'),'userProfileId':_0x41b83c[_0x89b5('0x70')]},'raw':!![]})[_0x89b5('0x22')](function(_0x228c5a){if(_0x228c5a&&_0x228c5a['autoAssociation']===0x0){return db[_0x89b5('0x73')][_0x89b5('0x4e')]({'name':_0x272708[_0x89b5('0x29')],'resourceId':_0x272708['id'],'type':_0x228c5a['name'],'sectionId':_0x228c5a['id']},{})['then'](function(){return _0x8c349b;});}else{return _0x8c349b;}})[_0x89b5('0x42')](function(_0x178009){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x178009);throw _0x178009;});}return _0x8c349b;})['then'](respondWithResult(_0x3c8590,null))['catch'](handleError(_0x3c8590,null));});_0x131515[_0x89b5('0x74')]();}catch(_0xc4922c){_0x3c8590[_0x89b5('0x17')](0x1f4)['send'](_0xc4922c);}};exports[_0x89b5('0x21')]=function(_0x448c41,_0x1f8947,_0x503927){return db[_0x89b5('0x2c')][_0x89b5('0x45')]({'where':{'id':_0x448c41[_0x89b5('0x47')]['id']}})[_0x89b5('0x22')](handleEntityNotFound(_0x1f8947,null))[_0x89b5('0x22')](saveUpdates(_[_0x89b5('0x3b')](_0x448c41[_0x89b5('0x6e')],['name','description']),null))['then'](respondWithResult(_0x1f8947,null))[_0x89b5('0x42')](handleError(_0x1f8947,null));};exports[_0x89b5('0x75')]=function(_0xae3898,_0x2abdbc,_0x3658d5){return db[_0x89b5('0x2c')][_0x89b5('0x45')]({'where':{'id':_0xae3898[_0x89b5('0x47')]['id']}})['then'](function(_0x2b1da7){if(_0x2b1da7){return _0x2b1da7[_0x89b5('0x23')]();}})['then'](function(_0x3b0155){var _0x49876d=path[_0x89b5('0x57')](config[_0x89b5('0x4a')],_0x89b5('0x56'),util[_0x89b5('0x4c')]('%s.%s',_0x3b0155[_0x89b5('0x48')],_0x3b0155[_0x89b5('0x76')]));var _0x3f280b=path[_0x89b5('0x57')](config[_0x89b5('0x4a')],'server/files/sounds/converted',util[_0x89b5('0x4c')](_0x89b5('0x4d'),_0x3b0155['save_name'],_0x3b0155[_0x89b5('0x49')]));fs['unlinkSync'](_0x49876d);fs['unlinkSync'](_0x3f280b);return _0x3b0155;})['then'](function(_0x3bdf73){if(_0x3bdf73){return _0x2abdbc[_0x89b5('0x17')](0xcc)[_0x89b5('0x18')]();}})[_0x89b5('0x22')](handleEntityNotFound(_0x2abdbc,null))[_0x89b5('0x42')](handleError(_0x2abdbc,null));}; \ No newline at end of file +var _0x6bcd=['start','params','delete','server/files/sounds/original','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','find','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','format','%s.%s','create','basename','file','extname','filename','originalname','wav','join','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','autoAssociation'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0x6bcd,0x7d));var _0xd6bc=function(_0x51958d,_0xf61731){_0x51958d=_0x51958d-0x0;var _0x4313fe=_0x6bcd[_0x51958d];return _0x4313fe;};'use strict';var emlformat=require(_0xd6bc('0x0'));var rimraf=require(_0xd6bc('0x1'));var zipdir=require(_0xd6bc('0x2'));var jsonpatch=require(_0xd6bc('0x3'));var rp=require('request-promise');var moment=require(_0xd6bc('0x4'));var BPromise=require(_0xd6bc('0x5'));var Mustache=require('mustache');var util=require(_0xd6bc('0x6'));var path=require('path');var sox=require(_0xd6bc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6bc('0x8'));var _=require(_0xd6bc('0x9'));var squel=require('squel');var crypto=require(_0xd6bc('0xa'));var jsforce=require(_0xd6bc('0xb'));var deskjs=require(_0xd6bc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6bc('0xd'));var Redis=require(_0xd6bc('0xe'));var authService=require(_0xd6bc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd6bc('0x10'));var hardwareService=require(_0xd6bc('0x11'));var logger=require(_0xd6bc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd6bc('0x13'));var licenseUtil=require(_0xd6bc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14fa16,_0x30dd80){_0x30dd80=_0x30dd80||0xcc;return function(_0x578664){if(_0x578664){return _0x14fa16['sendStatus'](_0x30dd80);}return _0x14fa16['status'](_0x30dd80)[_0xd6bc('0x15')]();};}function respondWithResult(_0x1f6746,_0xc2449c){_0xc2449c=_0xc2449c||0xc8;return function(_0x35f5eb){if(_0x35f5eb){return _0x1f6746['status'](_0xc2449c)[_0xd6bc('0x16')](_0x35f5eb);}};}function respondWithFilteredResult(_0xd9f9cb,_0x506940){return function(_0x3d5a14){if(_0x3d5a14){var _0x2a7608=typeof _0x506940[_0xd6bc('0x17')]==='undefined'&&typeof _0x506940[_0xd6bc('0x18')]===_0xd6bc('0x19');var _0x4d846f=_0x3d5a14[_0xd6bc('0x1a')];var _0xfab39f=_0x2a7608?0x0:_0x506940[_0xd6bc('0x17')];var _0x4f8b9a=_0x2a7608?_0x3d5a14[_0xd6bc('0x1a')]:_0x506940[_0xd6bc('0x17')]+_0x506940['limit'];var _0x2efc41;if(_0x4f8b9a>=_0x4d846f){_0x4f8b9a=_0x4d846f;_0x2efc41=0xc8;}else{_0x2efc41=0xce;}_0xd9f9cb[_0xd6bc('0x1b')](_0x2efc41);return _0xd9f9cb[_0xd6bc('0x1c')](_0xd6bc('0x1d'),_0xfab39f+'-'+_0x4f8b9a+'/'+_0x4d846f)['json'](_0x3d5a14);}return null;};}function patchUpdates(_0x13c2e8){return function(_0x442bb8){try{jsonpatch[_0xd6bc('0x1e')](_0x442bb8,_0x13c2e8,!![]);}catch(_0x10b797){return BPromise[_0xd6bc('0x1f')](_0x10b797);}return _0x442bb8['save']();};}function saveUpdates(_0xc3bce4,_0x182cfc){return function(_0x1fb211){if(_0x1fb211){return _0x1fb211[_0xd6bc('0x20')](_0xc3bce4)['then'](function(_0x4d1ae0){return _0x4d1ae0;});}return null;};}function removeEntity(_0x50cd84,_0x1bd94d){return function(_0x1b5487){if(_0x1b5487){return _0x1b5487['destroy']()['then'](function(){var _0x14a1b7=_0x1b5487[_0xd6bc('0x21')]({'plain':!![]});var _0xe103fe='Sounds';return db[_0xd6bc('0x22')][_0xd6bc('0x23')]({'where':{'type':_0xe103fe,'resourceId':_0x14a1b7['id']}})[_0xd6bc('0x24')](function(){return _0x1b5487;});})[_0xd6bc('0x24')](function(){_0x50cd84[_0xd6bc('0x1b')](0xcc)[_0xd6bc('0x15')]();});}};}function handleEntityNotFound(_0x4c6093,_0x135c47){return function(_0x232deb){if(!_0x232deb){_0x4c6093[_0xd6bc('0x25')](0x194);}return _0x232deb;};}function handleError(_0x6e6708,_0x31ff0f){_0x31ff0f=_0x31ff0f||0x1f4;return function(_0x4fbb99){logger[_0xd6bc('0x26')](_0x4fbb99[_0xd6bc('0x27')]);if(_0x4fbb99['name']){delete _0x4fbb99[_0xd6bc('0x28')];}_0x6e6708[_0xd6bc('0x1b')](_0x31ff0f)[_0xd6bc('0x29')](_0x4fbb99);};}exports[_0xd6bc('0x2a')]=function(_0x49e5d1,_0x30ec35){var _0x53ecc4={},_0x4abbc4={},_0xe4926d={'count':0x0,'rows':[]};var _0x29e5c4=_[_0xd6bc('0x2b')](db[_0xd6bc('0x2c')][_0xd6bc('0x2d')],function(_0x3dd4e8){return{'name':_0x3dd4e8[_0xd6bc('0x2e')],'type':_0x3dd4e8['type'][_0xd6bc('0x2f')]};});_0x4abbc4[_0xd6bc('0x30')]=_['map'](_0x29e5c4,_0xd6bc('0x28'));_0x4abbc4[_0xd6bc('0x31')]=_['keys'](_0x49e5d1[_0xd6bc('0x31')]);_0x4abbc4[_0xd6bc('0x32')]=_['intersection'](_0x4abbc4[_0xd6bc('0x30')],_0x4abbc4['query']);_0x53ecc4['attributes']=_[_0xd6bc('0x33')](_0x4abbc4[_0xd6bc('0x30')],qs[_0xd6bc('0x34')](_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x34')]));_0x53ecc4[_0xd6bc('0x35')]=_0x53ecc4[_0xd6bc('0x35')][_0xd6bc('0x36')]?_0x53ecc4[_0xd6bc('0x35')]:_0x4abbc4['model'];if(!_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x37')](_0xd6bc('0x38'))){_0x53ecc4[_0xd6bc('0x18')]=qs[_0xd6bc('0x18')](_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x18')]);_0x53ecc4['offset']=qs[_0xd6bc('0x17')](_0x49e5d1['query'][_0xd6bc('0x17')]);}_0x53ecc4[_0xd6bc('0x39')]=qs[_0xd6bc('0x3a')](_0x49e5d1['query'][_0xd6bc('0x3a')]);_0x53ecc4[_0xd6bc('0x3b')]=qs[_0xd6bc('0x32')](_[_0xd6bc('0x3c')](_0x49e5d1['query'],_0x4abbc4[_0xd6bc('0x32')]),_0x29e5c4);if(_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x3d')]){_0x53ecc4[_0xd6bc('0x3b')]=_['merge'](_0x53ecc4[_0xd6bc('0x3b')],{'$or':_['map'](_0x29e5c4,function(_0x39e3c6){if(_0x39e3c6['type']!=='VIRTUAL'){var _0x46381a={};_0x46381a[_0x39e3c6['name']]={'$like':'%'+_0x49e5d1[_0xd6bc('0x31')][_0xd6bc('0x3d')]+'%'};return _0x46381a;}})});}_0x53ecc4=_[_0xd6bc('0x3e')]({},_0x53ecc4,_0x49e5d1[_0xd6bc('0x3f')]);var _0xd23b82={'where':_0x53ecc4[_0xd6bc('0x3b')]};return db[_0xd6bc('0x2c')]['count'](_0xd23b82)[_0xd6bc('0x24')](function(_0x32fe7c){_0xe4926d['count']=_0x32fe7c;if(_0x49e5d1['query'][_0xd6bc('0x40')]){_0x53ecc4[_0xd6bc('0x41')]=[{'all':!![]}];}return db[_0xd6bc('0x2c')]['findAll'](_0x53ecc4);})[_0xd6bc('0x24')](function(_0x12aa6a){_0xe4926d[_0xd6bc('0x42')]=_0x12aa6a;return _0xe4926d;})[_0xd6bc('0x24')](respondWithFilteredResult(_0x30ec35,_0x53ecc4))[_0xd6bc('0x43')](handleError(_0x30ec35,null));};exports[_0xd6bc('0x44')]=function(_0x24a10c,_0x26a5fb){var _0x101f24={'raw':!![],'where':{'id':_0x24a10c['params']['id']}},_0x54e1c9={};_0x54e1c9['model']=_[_0xd6bc('0x45')](db[_0xd6bc('0x2c')][_0xd6bc('0x2d')]);_0x54e1c9[_0xd6bc('0x31')]=_[_0xd6bc('0x45')](_0x24a10c[_0xd6bc('0x31')]);_0x54e1c9[_0xd6bc('0x32')]=_[_0xd6bc('0x33')](_0x54e1c9[_0xd6bc('0x30')],_0x54e1c9['query']);_0x101f24[_0xd6bc('0x35')]=_[_0xd6bc('0x33')](_0x54e1c9['model'],qs[_0xd6bc('0x34')](_0x24a10c['query'][_0xd6bc('0x34')]));_0x101f24[_0xd6bc('0x35')]=_0x101f24[_0xd6bc('0x35')][_0xd6bc('0x36')]?_0x101f24[_0xd6bc('0x35')]:_0x54e1c9['model'];if(_0x24a10c[_0xd6bc('0x31')][_0xd6bc('0x40')]){_0x101f24['include']=[{'all':!![]}];}_0x101f24=_[_0xd6bc('0x3e')]({},_0x101f24,_0x24a10c['options']);return db[_0xd6bc('0x2c')]['find'](_0x101f24)[_0xd6bc('0x24')](handleEntityNotFound(_0x26a5fb,null))[_0xd6bc('0x24')](respondWithResult(_0x26a5fb,null))['catch'](handleError(_0x26a5fb,null));};exports['download']=function(_0x3d2989,_0x392404,_0x43587c){return db[_0xd6bc('0x2c')][_0xd6bc('0x46')]({'where':{'id':_0x3d2989['params']['id']},'attributes':[_0xd6bc('0x28'),_0xd6bc('0x47'),'converted_format'],'raw':!![]})[_0xd6bc('0x24')](handleEntityNotFound(_0x392404,null))[_0xd6bc('0x24')](function(_0x4fcbab){if(_0x4fcbab){if(!fs[_0xd6bc('0x48')](path['join'](config[_0xd6bc('0x49')],_0xd6bc('0x4a'),_0x4fcbab[_0xd6bc('0x47')]+'.'+_0x4fcbab[_0xd6bc('0x4b')]))){throw new db[(_0xd6bc('0x4c'))][(_0xd6bc('0x4d'))]('Sound\x20not\x20found');}return _0x392404['download'](path['join'](config['root'],_0xd6bc('0x4a'),util[_0xd6bc('0x4e')]('%s.%s',_0x4fcbab[_0xd6bc('0x47')],_0x4fcbab[_0xd6bc('0x4b')])),util['format'](_0xd6bc('0x4f'),_0x4fcbab[_0xd6bc('0x28')],_0x4fcbab[_0xd6bc('0x4b')]));}return null;})[_0xd6bc('0x43')](handleError(_0x392404,null));};exports[_0xd6bc('0x50')]=function(_0x2ed683,_0x3e0da2,_0x12ab09){var _0x5d3ac4={'name':path[_0xd6bc('0x51')](_0x2ed683[_0xd6bc('0x52')]['originalname'],path[_0xd6bc('0x53')](_0x2ed683[_0xd6bc('0x52')]['originalname'])),'save_name':path[_0xd6bc('0x51')](_0x2ed683[_0xd6bc('0x52')]['filename'],path['extname'](_0x2ed683[_0xd6bc('0x52')][_0xd6bc('0x54')])),'original_format':path[_0xd6bc('0x53')](_0x2ed683[_0xd6bc('0x52')][_0xd6bc('0x55')])['substring'](0x1),'converted_format':_0xd6bc('0x56')};var _0x28ddab=path['join'](config[_0xd6bc('0x49')],'server/files/sounds/original',_0x2ed683['file'][_0xd6bc('0x54')]);var _0x1d74d8=path[_0xd6bc('0x57')](config[_0xd6bc('0x49')],_0xd6bc('0x4a'),util[_0xd6bc('0x4e')](_0xd6bc('0x4f'),path[_0xd6bc('0x51')](_0x2ed683['file']['filename'],path[_0xd6bc('0x53')](_0x2ed683[_0xd6bc('0x52')][_0xd6bc('0x54')])),_0x5d3ac4[_0xd6bc('0x4b')]));logger['info'](_0xd6bc('0x58'),_0x28ddab);logger['info'](_0xd6bc('0x59'),_0x1d74d8);try{fs[_0xd6bc('0x5a')](_0x28ddab,parseInt(_0xd6bc('0x5b'),0x8));var _0x265d54=sox[_0xd6bc('0x5c')](_0x28ddab,_0x1d74d8,{'sampleRate':0x1f40,'format':_0xd6bc('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x265d54['on'](_0xd6bc('0x26'),function(_0x435e21){fs[_0xd6bc('0x5d')](_0x28ddab);_0x3e0da2[_0xd6bc('0x1b')](0x1f4)[_0xd6bc('0x29')](_0x435e21);});_0x265d54['on'](_0xd6bc('0x5e'),function(_0x33651f){_0x5d3ac4[_0xd6bc('0x5f')]=isNaN(_0x33651f[_0xd6bc('0x60')])?null:_0x33651f[_0xd6bc('0x60')]*0x3e8;_0x5d3ac4[_0xd6bc('0x61')]=isNaN(_0x33651f[_0xd6bc('0x62')])?null:_0x33651f[_0xd6bc('0x62')];_0x5d3ac4[_0xd6bc('0x63')]=isNaN(_0x33651f[_0xd6bc('0x64')])?null:_0x33651f[_0xd6bc('0x64')];_0x5d3ac4[_0xd6bc('0x65')]=isNaN(_0x33651f[_0xd6bc('0x66')])?null:_0x33651f[_0xd6bc('0x66')];_0x5d3ac4[_0xd6bc('0x67')]=isNaN(_0x33651f[_0xd6bc('0x68')])?null:_0x33651f[_0xd6bc('0x68')];});_0x265d54['on'](_0xd6bc('0x69'),function(_0x24d8f5){_0x5d3ac4[_0xd6bc('0x6a')]=isNaN(_0x24d8f5[_0xd6bc('0x60')])?null:_0x24d8f5[_0xd6bc('0x60')]*0x3e8;_0x5d3ac4[_0xd6bc('0x6b')]=isNaN(_0x24d8f5[_0xd6bc('0x62')])?null:_0x24d8f5[_0xd6bc('0x62')];_0x5d3ac4[_0xd6bc('0x6c')]=isNaN(_0x24d8f5[_0xd6bc('0x64')])?null:_0x24d8f5[_0xd6bc('0x64')];_0x5d3ac4[_0xd6bc('0x6d')]=isNaN(_0x24d8f5[_0xd6bc('0x66')])?null:_0x24d8f5[_0xd6bc('0x66')];_0x5d3ac4['converted_sampleRate']=isNaN(_0x24d8f5['sampleRate'])?null:_0x24d8f5[_0xd6bc('0x68')];});_0x265d54['on'](_0xd6bc('0x15'),function(){fs[_0xd6bc('0x5a')](_0x1d74d8,parseInt(_0xd6bc('0x5b'),0x8));return db['Sound'][_0xd6bc('0x50')](_0x5d3ac4)['then'](function(_0xa4c468){var _0x4a8c23={'role':_0x2ed683['body'][_0xd6bc('0x6e')],'userProfileId':_0x2ed683[_0xd6bc('0x6f')][_0xd6bc('0x70')]};if(!_0x4a8c23)throw new Error(_0xd6bc('0x71'));if(_0x4a8c23[_0xd6bc('0x6e')]==='user'){var _0x53b490=_0xa4c468[_0xd6bc('0x21')]({'plain':!![]});return db[_0xd6bc('0x72')][_0xd6bc('0x46')]({'where':{'name':_0xd6bc('0x73'),'userProfileId':_0x4a8c23[_0xd6bc('0x70')]},'raw':!![]})[_0xd6bc('0x24')](function(_0x5d71f7){if(_0x5d71f7&&_0x5d71f7[_0xd6bc('0x74')]===0x0){return db['UserProfileResource']['create']({'name':_0x53b490[_0xd6bc('0x28')],'resourceId':_0x53b490['id'],'type':_0x5d71f7[_0xd6bc('0x28')],'sectionId':_0x5d71f7['id']},{})[_0xd6bc('0x24')](function(){return _0xa4c468;});}else{return _0xa4c468;}})[_0xd6bc('0x43')](function(_0x1b7fee){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b7fee);throw _0x1b7fee;});}return _0xa4c468;})[_0xd6bc('0x24')](respondWithResult(_0x3e0da2,null))[_0xd6bc('0x43')](handleError(_0x3e0da2,null));});_0x265d54[_0xd6bc('0x75')]();}catch(_0x14ed57){_0x3e0da2[_0xd6bc('0x1b')](0x1f4)[_0xd6bc('0x29')](_0x14ed57);}};exports[_0xd6bc('0x20')]=function(_0x36bb41,_0xfa7928,_0x5cf8dd){return db[_0xd6bc('0x2c')][_0xd6bc('0x46')]({'where':{'id':_0x36bb41[_0xd6bc('0x76')]['id']}})['then'](handleEntityNotFound(_0xfa7928,null))[_0xd6bc('0x24')](saveUpdates(_['pick'](_0x36bb41['body'],['name','description']),null))[_0xd6bc('0x24')](respondWithResult(_0xfa7928,null))['catch'](handleError(_0xfa7928,null));};exports[_0xd6bc('0x77')]=function(_0x27c1ad,_0x58b741,_0x44afd9){return db['Sound'][_0xd6bc('0x46')]({'where':{'id':_0x27c1ad['params']['id']}})['then'](function(_0x443bf4){if(_0x443bf4){return _0x443bf4['destroy']();}})['then'](function(_0x1fa8c7){var _0x3ad0a4=path['join'](config[_0xd6bc('0x49')],_0xd6bc('0x78'),util[_0xd6bc('0x4e')](_0xd6bc('0x4f'),_0x1fa8c7[_0xd6bc('0x47')],_0x1fa8c7['original_format']));var _0x4ad2a9=path[_0xd6bc('0x57')](config[_0xd6bc('0x49')],'server/files/sounds/converted',util[_0xd6bc('0x4e')]('%s.%s',_0x1fa8c7[_0xd6bc('0x47')],_0x1fa8c7[_0xd6bc('0x4b')]));fs[_0xd6bc('0x5d')](_0x3ad0a4);fs[_0xd6bc('0x5d')](_0x4ad2a9);return _0x1fa8c7;})['then'](function(_0x327886){if(_0x327886){return _0x58b741['status'](0xcc)[_0xd6bc('0x15')]();}})['then'](handleEntityNotFound(_0x58b741,null))[_0xd6bc('0x43')](handleError(_0x58b741,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4ee2f10..4b96c05 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 _0x03e7=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','Sound','tools_sounds'];(function(_0x4c31d1,_0x2e4c7b){var _0x264ddc=function(_0x3ebf94){while(--_0x3ebf94){_0x4c31d1['push'](_0x4c31d1['shift']());}};_0x264ddc(++_0x2e4c7b);}(_0x03e7,0x1ad));var _0x703e=function(_0x13a1f5,_0x3c58a2){_0x13a1f5=_0x13a1f5-0x0;var _0xf47183=_0x03e7[_0x13a1f5];return _0xf47183;};'use strict';var _=require(_0x703e('0x0'));var util=require(_0x703e('0x1'));var logger=require(_0x703e('0x2'))('api');var moment=require(_0x703e('0x3'));var BPromise=require(_0x703e('0x4'));var rp=require(_0x703e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x703e('0x6'));var config=require(_0x703e('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x5dc1b9,_0x2a9dd6){return _0x5dc1b9[_0x703e('0x8')](_0x703e('0x9'),attributes,{'tableName':_0x703e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf324=['api','moment','bluebird','path','rimraf','../../config/environment','define','Sound','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf324,0x15c));var _0x4f32=function(_0x29ca93,_0x182f70){_0x29ca93=_0x29ca93-0x0;var _0x58c0a0=_0xf324[_0x29ca93];return _0x58c0a0;};'use strict';var _=require('lodash');var util=require(_0x4f32('0x0'));var logger=require(_0x4f32('0x1'))(_0x4f32('0x2'));var moment=require(_0x4f32('0x3'));var BPromise=require(_0x4f32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f32('0x5'));var rimraf=require(_0x4f32('0x6'));var config=require(_0x4f32('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x51458d,_0x3d4703){return _0x51458d[_0x4f32('0x8')](_0x4f32('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 345c51b..8e12736 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 _0x19ad=['../../config/environment','jayson/promise','client','http','request','Sound,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model','stringify','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x44a136,_0x276d95){var _0x2efa92=function(_0xe20349){while(--_0xe20349){_0x44a136['push'](_0x44a136['shift']());}};_0x2efa92(++_0x276d95);}(_0x19ad,0x6a));var _0xd19a=function(_0x590455,_0x338a42){_0x590455=_0x590455-0x0;var _0x1b5a98=_0x19ad[_0x590455];return _0x1b5a98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd19a('0x0'));var BPromise=require(_0xd19a('0x1'));var rs=require(_0xd19a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd19a('0x3'));var logger=require(_0xd19a('0x4'))(_0xd19a('0x5'));var config=require(_0xd19a('0x6'));var jayson=require(_0xd19a('0x7'));var client=jayson[_0xd19a('0x8')][_0xd19a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47c40d,_0x18242b,_0x516df1){return new BPromise(function(_0x20f6d4,_0x49c7e9){return client[_0xd19a('0xa')](_0x47c40d,_0x516df1)['then'](function(_0x1a1b12){logger['info'](_0xd19a('0xb'),_0x18242b,'request\x20sent');logger[_0xd19a('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x18242b,'request\x20sent',JSON['stringify'](_0x1a1b12));if(_0x1a1b12['error']){if(_0x1a1b12[_0xd19a('0xd')]['code']===0x1f4){logger[_0xd19a('0xd')](_0xd19a('0xb'),_0x18242b,_0x1a1b12[_0xd19a('0xd')]['message']);return _0x49c7e9(_0x1a1b12[_0xd19a('0xd')][_0xd19a('0xe')]);}logger['error'](_0xd19a('0xb'),_0x18242b,_0x1a1b12[_0xd19a('0xd')][_0xd19a('0xe')]);return _0x20f6d4(_0x1a1b12[_0xd19a('0xd')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x18242b,_0xd19a('0xf'));_0x20f6d4(_0x1a1b12[_0xd19a('0x10')][_0xd19a('0xe')]);}})[_0xd19a('0x11')](function(_0x1dfbc5){logger['error']('Sound,\x20%s,\x20%s',_0x18242b,_0x1dfbc5);_0x49c7e9(_0x1dfbc5);});});}exports[_0xd19a('0x12')]=function(_0x5c9f1c){var _0x30060a=this;return new Promise(function(_0x5810b4,_0x3488f9){return db[_0xd19a('0x13')][_0xd19a('0x14')]({'raw':_0x5c9f1c[_0xd19a('0x15')]?_0x5c9f1c['options'][_0xd19a('0x16')]===undefined?!![]:![]:!![],'where':_0x5c9f1c[_0xd19a('0x15')]?_0x5c9f1c['options'][_0xd19a('0x17')]||null:null,'attributes':_0x5c9f1c['options']?_0x5c9f1c[_0xd19a('0x15')][_0xd19a('0x18')]||null:null,'include':_0x5c9f1c['options']?_0x5c9f1c[_0xd19a('0x15')][_0xd19a('0x19')]?_['map'](_0x5c9f1c[_0xd19a('0x15')][_0xd19a('0x19')],function(_0x483fa1){return{'model':db[_0x483fa1[_0xd19a('0x1a')]],'as':_0x483fa1['as'],'attributes':_0x483fa1[_0xd19a('0x18')],'include':_0x483fa1[_0xd19a('0x19')]?_['map'](_0x483fa1[_0xd19a('0x19')],function(_0x21edd6){return{'model':db[_0x21edd6[_0xd19a('0x1a')]],'as':_0x21edd6['as'],'attributes':_0x21edd6[_0xd19a('0x18')],'include':_0x21edd6['include']?_['map'](_0x21edd6['include'],function(_0x2de285){return{'model':db[_0x2de285[_0xd19a('0x1a')]],'as':_0x2de285['as'],'attributes':_0x2de285['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a439){logger['info'](_0xd19a('0x12'),_0x5c9f1c);logger['debug'](_0xd19a('0x12'),_0x5c9f1c,JSON[_0xd19a('0x1b')](_0x56a439));_0x5810b4(_0x56a439);})[_0xd19a('0x11')](function(_0x4053de){logger[_0xd19a('0xd')]('ShowSound',_0x4053de[_0xd19a('0xe')],_0x5c9f1c);_0x3488f9(_0x30060a[_0xd19a('0xd')](0x1f4,_0x4053de['message']));});});}; \ No newline at end of file +var _0xb660=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','message','catch','Sound,\x20%s,\x20%s','ShowSound','find','options','raw','where','attributes','include','map','model','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5d7294,_0x1bf034){var _0x2e5ecd=function(_0x3b4135){while(--_0x3b4135){_0x5d7294['push'](_0x5d7294['shift']());}};_0x2e5ecd(++_0x1bf034);}(_0xb660,0x101));var _0x0b66=function(_0x25300c,_0x8d65be){_0x25300c=_0x25300c-0x0;var _0x2dd3e4=_0xb660[_0x25300c];return _0x2dd3e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b66('0x0'));var BPromise=require('bluebird');var rs=require(_0x0b66('0x1'));var fs=require('fs');var Redis=require(_0x0b66('0x2'));var db=require(_0x0b66('0x3'))['db'];var utils=require(_0x0b66('0x4'));var logger=require(_0x0b66('0x5'))('rpc');var config=require(_0x0b66('0x6'));var jayson=require(_0x0b66('0x7'));var client=jayson[_0x0b66('0x8')][_0x0b66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5314f9,_0x145a05,_0x2cf57d){return new BPromise(function(_0x1d20a9,_0x45155f){return client[_0x0b66('0xa')](_0x5314f9,_0x2cf57d)[_0x0b66('0xb')](function(_0x43ccc5){logger[_0x0b66('0xc')]('Sound,\x20%s,\x20%s',_0x145a05,'request\x20sent');logger[_0x0b66('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x145a05,_0x0b66('0xe'),JSON['stringify'](_0x43ccc5));if(_0x43ccc5[_0x0b66('0xf')]){if(_0x43ccc5[_0x0b66('0xf')][_0x0b66('0x10')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x145a05,_0x43ccc5[_0x0b66('0xf')]['message']);return _0x45155f(_0x43ccc5['error'][_0x0b66('0x11')]);}logger[_0x0b66('0xf')]('Sound,\x20%s,\x20%s',_0x145a05,_0x43ccc5[_0x0b66('0xf')][_0x0b66('0x11')]);return _0x1d20a9(_0x43ccc5[_0x0b66('0xf')]['message']);}else{logger[_0x0b66('0xc')]('Sound,\x20%s,\x20%s',_0x145a05,_0x0b66('0xe'));_0x1d20a9(_0x43ccc5['result'][_0x0b66('0x11')]);}})[_0x0b66('0x12')](function(_0xd5e187){logger[_0x0b66('0xf')](_0x0b66('0x13'),_0x145a05,_0xd5e187);_0x45155f(_0xd5e187);});});}exports[_0x0b66('0x14')]=function(_0x289e4c){var _0x427732=this;return new Promise(function(_0x3f9e68,_0x27045a){return db['Sound'][_0x0b66('0x15')]({'raw':_0x289e4c[_0x0b66('0x16')]?_0x289e4c[_0x0b66('0x16')][_0x0b66('0x17')]===undefined?!![]:![]:!![],'where':_0x289e4c[_0x0b66('0x16')]?_0x289e4c[_0x0b66('0x16')][_0x0b66('0x18')]||null:null,'attributes':_0x289e4c[_0x0b66('0x16')]?_0x289e4c['options'][_0x0b66('0x19')]||null:null,'include':_0x289e4c[_0x0b66('0x16')]?_0x289e4c[_0x0b66('0x16')][_0x0b66('0x1a')]?_[_0x0b66('0x1b')](_0x289e4c[_0x0b66('0x16')][_0x0b66('0x1a')],function(_0x2f2398){return{'model':db[_0x2f2398[_0x0b66('0x1c')]],'as':_0x2f2398['as'],'attributes':_0x2f2398[_0x0b66('0x19')],'include':_0x2f2398[_0x0b66('0x1a')]?_[_0x0b66('0x1b')](_0x2f2398[_0x0b66('0x1a')],function(_0x3cdbb3){return{'model':db[_0x3cdbb3['model']],'as':_0x3cdbb3['as'],'attributes':_0x3cdbb3[_0x0b66('0x19')],'include':_0x3cdbb3[_0x0b66('0x1a')]?_[_0x0b66('0x1b')](_0x3cdbb3[_0x0b66('0x1a')],function(_0x52979c){return{'model':db[_0x52979c['model']],'as':_0x52979c['as'],'attributes':_0x52979c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b66('0xb')](function(_0x222927){logger[_0x0b66('0xc')](_0x0b66('0x14'),_0x289e4c);logger[_0x0b66('0xd')](_0x0b66('0x14'),_0x289e4c,JSON['stringify'](_0x222927));_0x3f9e68(_0x222927);})[_0x0b66('0x12')](function(_0x59a2ed){logger['error'](_0x0b66('0x14'),_0x59a2ed[_0x0b66('0x11')],_0x289e4c);_0x27045a(_0x427732[_0x0b66('0xf')](0x1f4,_0x59a2ed[_0x0b66('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7ec247d..7c87583 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0x4fc2,0x111));var _0x24fc=function(_0x7eef7d,_0x50412d){_0x7eef7d=_0x7eef7d-0x0;var _0x416035=_0x4fc2[_0x7eef7d];return _0x416035;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x2437d1,_0x3cc15c){var _0x2133fd=function(_0x360849){while(--_0x360849){_0x2437d1['push'](_0x2437d1['shift']());}};_0x2133fd(++_0x3cc15c);}(_0x757a,0xde));var _0xa757=function(_0x2be80a,_0x48bcd5){_0x2be80a=_0x2be80a-0x0;var _0x598b18=_0x757a[_0x2be80a];return _0x598b18;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 600b7d0..9ec0f40 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 _0xaa23=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x2329a9,_0x1ecca4){var _0x50e19f=function(_0x59daf8){while(--_0x59daf8){_0x2329a9['push'](_0x2329a9['shift']());}};_0x50e19f(++_0x1ecca4);}(_0xaa23,0x182));var _0x3aa2=function(_0x216bdd,_0x22e02b){_0x216bdd=_0x216bdd-0x0;var _0x3422b0=_0xaa23[_0x216bdd];return _0x3422b0;};'use strict';var Sequelize=require(_0x3aa2('0x0'));module[_0x3aa2('0x1')]={'uniqueid':{'type':Sequelize[_0x3aa2('0x2')]},'body':{'type':Sequelize[_0x3aa2('0x3')](_0x3aa2('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x3aa2('0x5')]('in',_0x3aa2('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x3aa2('0x2')]},'providerResponse':{'type':Sequelize[_0x3aa2('0x3')]}}; \ No newline at end of file +var _0x5440=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x5440,0xe0));var _0x0544=function(_0xfe01e8,_0x1592d8){_0xfe01e8=_0xfe01e8-0x0;var _0x3b302d=_0x5440[_0xfe01e8];return _0x3b302d;};'use strict';var Sequelize=require(_0x0544('0x0'));module[_0x0544('0x1')]={'uniqueid':{'type':Sequelize[_0x0544('0x2')]},'body':{'type':Sequelize[_0x0544('0x3')](_0x0544('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x0544('0x5')]('in',_0x0544('0x6')),'defaultValue':_0x0544('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0544('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0ed8454..3228e98 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 _0xb286=['json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','find','catch','create','update','body','params','eml-format','rimraf','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x264f48,_0x2c82d8){var _0xb99167=function(_0x4a6be7){while(--_0x4a6be7){_0x264f48['push'](_0x264f48['shift']());}};_0xb99167(++_0x2c82d8);}(_0xb286,0x151));var _0x6b28=function(_0x161b1d,_0x427582){_0x161b1d=_0x161b1d-0x0;var _0x189e6c=_0xb286[_0x161b1d];return _0x189e6c;};'use strict';var emlformat=require(_0x6b28('0x0'));var rimraf=require(_0x6b28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b28('0x2'));var path=require(_0x6b28('0x3'));var sox=require(_0x6b28('0x4'));var csv=require(_0x6b28('0x5'));var ejs=require(_0x6b28('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b28('0x7'));var squel=require(_0x6b28('0x8'));var crypto=require(_0x6b28('0x9'));var jsforce=require(_0x6b28('0xa'));var deskjs=require(_0x6b28('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6b28('0xc'));var Papa=require(_0x6b28('0xd'));var Redis=require(_0x6b28('0xe'));var authService=require(_0x6b28('0xf'));var qs=require(_0x6b28('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b28('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6b28('0x12'));var config=require(_0x6b28('0x13'));var licenseUtil=require(_0x6b28('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6dbb1e,_0x4d5f64){_0x4d5f64=_0x4d5f64||0xcc;return function(_0x18ab61){if(_0x18ab61){return _0x6dbb1e[_0x6b28('0x15')](_0x4d5f64);}return _0x6dbb1e[_0x6b28('0x16')](_0x4d5f64)['end']();};}function respondWithResult(_0x25fdae,_0x5b13d8){_0x5b13d8=_0x5b13d8||0xc8;return function(_0x108dfe){if(_0x108dfe){return _0x25fdae[_0x6b28('0x16')](_0x5b13d8)[_0x6b28('0x17')](_0x108dfe);}};}function respondWithFilteredResult(_0x4962ca,_0x4ddec1){return function(_0x139751){if(_0x139751){var _0x108a08=typeof _0x4ddec1['offset']===_0x6b28('0x18')&&typeof _0x4ddec1['limit']==='undefined';var _0x14a47b=_0x139751[_0x6b28('0x19')];var _0x499082=_0x108a08?0x0:_0x4ddec1[_0x6b28('0x1a')];var _0x4b8a08=_0x108a08?_0x139751[_0x6b28('0x19')]:_0x4ddec1[_0x6b28('0x1a')]+_0x4ddec1[_0x6b28('0x1b')];var _0x5f40b3;if(_0x4b8a08>=_0x14a47b){_0x4b8a08=_0x14a47b;_0x5f40b3=0xc8;}else{_0x5f40b3=0xce;}_0x4962ca['status'](_0x5f40b3);return _0x4962ca[_0x6b28('0x1c')](_0x6b28('0x1d'),_0x499082+'-'+_0x4b8a08+'/'+_0x14a47b)[_0x6b28('0x17')](_0x139751);}return null;};}function patchUpdates(_0x37e2f5){return function(_0x77b579){try{jsonpatch[_0x6b28('0x1e')](_0x77b579,_0x37e2f5,!![]);}catch(_0x2b825c){return BPromise['reject'](_0x2b825c);}return _0x77b579[_0x6b28('0x1f')]();};}function saveUpdates(_0x3ddd28,_0xa6d667){return function(_0x1bed78){if(_0x1bed78){return _0x1bed78['update'](_0x3ddd28)[_0x6b28('0x20')](function(_0x289221){return _0x289221;});}return null;};}function removeEntity(_0x2a8a5d,_0x319945){return function(_0x32707a){if(_0x32707a){return _0x32707a[_0x6b28('0x21')]()['then'](function(){_0x2a8a5d['status'](0xcc)[_0x6b28('0x22')]();});}};}function handleEntityNotFound(_0x17191f,_0xcb3730){return function(_0x2975a2){if(!_0x2975a2){_0x17191f[_0x6b28('0x15')](0x194);}return _0x2975a2;};}function handleError(_0x289d15,_0xda5a5){_0xda5a5=_0xda5a5||0x1f4;return function(_0x335d68){logger['error'](_0x335d68[_0x6b28('0x23')]);if(_0x335d68[_0x6b28('0x24')]){delete _0x335d68['name'];}_0x289d15[_0x6b28('0x16')](_0xda5a5)[_0x6b28('0x25')](_0x335d68);};}exports[_0x6b28('0x26')]=function(_0xe4808e,_0x53ed3a){var _0x2a18ee={},_0x57ee8c={},_0x6e1b6f={'count':0x0,'rows':[]};var _0x59245f=_[_0x6b28('0x27')](db[_0x6b28('0x28')][_0x6b28('0x29')],function(_0x58de00){return{'name':_0x58de00[_0x6b28('0x2a')],'type':_0x58de00[_0x6b28('0x2b')][_0x6b28('0x2c')]};});_0x57ee8c[_0x6b28('0x2d')]=_['map'](_0x59245f,_0x6b28('0x24'));_0x57ee8c[_0x6b28('0x2e')]=_[_0x6b28('0x2f')](_0xe4808e[_0x6b28('0x2e')]);_0x57ee8c[_0x6b28('0x30')]=_[_0x6b28('0x31')](_0x57ee8c[_0x6b28('0x2d')],_0x57ee8c[_0x6b28('0x2e')]);_0x2a18ee[_0x6b28('0x32')]=_[_0x6b28('0x31')](_0x57ee8c['model'],qs[_0x6b28('0x33')](_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x33')]));_0x2a18ee[_0x6b28('0x32')]=_0x2a18ee[_0x6b28('0x32')][_0x6b28('0x34')]?_0x2a18ee[_0x6b28('0x32')]:_0x57ee8c[_0x6b28('0x2d')];if(!_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x35')](_0x6b28('0x36'))){_0x2a18ee[_0x6b28('0x1b')]=qs[_0x6b28('0x1b')](_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x1b')]);_0x2a18ee[_0x6b28('0x1a')]=qs['offset'](_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x1a')]);}_0x2a18ee[_0x6b28('0x37')]=qs['sort'](_0xe4808e['query'][_0x6b28('0x38')]);_0x2a18ee[_0x6b28('0x39')]=qs[_0x6b28('0x30')](_[_0x6b28('0x3a')](_0xe4808e[_0x6b28('0x2e')],_0x57ee8c[_0x6b28('0x30')]),_0x59245f);if(_0xe4808e['query'][_0x6b28('0x3b')]){_0x2a18ee[_0x6b28('0x39')]=_['merge'](_0x2a18ee[_0x6b28('0x39')],{'$or':_[_0x6b28('0x27')](_0x59245f,function(_0x1ef70f){if(_0x1ef70f[_0x6b28('0x2b')]!=='VIRTUAL'){var _0x2c2d9a={};_0x2c2d9a[_0x1ef70f[_0x6b28('0x24')]]={'$like':'%'+_0xe4808e[_0x6b28('0x2e')]['filter']+'%'};return _0x2c2d9a;}})});}_0x2a18ee=_[_0x6b28('0x3c')]({},_0x2a18ee,_0xe4808e['options']);var _0x48b90a={'where':_0x2a18ee['where']};return db[_0x6b28('0x28')][_0x6b28('0x19')](_0x48b90a)[_0x6b28('0x20')](function(_0x48ba59){_0x6e1b6f[_0x6b28('0x19')]=_0x48ba59;if(_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x3d')]){_0x2a18ee[_0x6b28('0x3e')]=[{'all':!![]}];}return db['SquareMessage'][_0x6b28('0x3f')](_0x2a18ee);})[_0x6b28('0x20')](function(_0x38bac1){_0x6e1b6f[_0x6b28('0x40')]=_0x38bac1;return _0x6e1b6f;})[_0x6b28('0x20')](respondWithFilteredResult(_0x53ed3a,_0x2a18ee))['catch'](handleError(_0x53ed3a,null));};exports[_0x6b28('0x41')]=function(_0x4b2851,_0x2f4dd8){var _0x1b1ba9={'raw':!![],'where':{'id':_0x4b2851['params']['id']}},_0x59315b={};_0x59315b[_0x6b28('0x2d')]=_[_0x6b28('0x2f')](db[_0x6b28('0x28')][_0x6b28('0x29')]);_0x59315b[_0x6b28('0x2e')]=_[_0x6b28('0x2f')](_0x4b2851[_0x6b28('0x2e')]);_0x59315b['filters']=_[_0x6b28('0x31')](_0x59315b['model'],_0x59315b[_0x6b28('0x2e')]);_0x1b1ba9['attributes']=_[_0x6b28('0x31')](_0x59315b['model'],qs[_0x6b28('0x33')](_0x4b2851[_0x6b28('0x2e')][_0x6b28('0x33')]));_0x1b1ba9[_0x6b28('0x32')]=_0x1b1ba9[_0x6b28('0x32')]['length']?_0x1b1ba9[_0x6b28('0x32')]:_0x59315b['model'];if(_0x4b2851['query']['includeAll']){_0x1b1ba9[_0x6b28('0x3e')]=[{'all':!![]}];}_0x1b1ba9=_[_0x6b28('0x3c')]({},_0x1b1ba9,_0x4b2851['options']);return db[_0x6b28('0x28')][_0x6b28('0x42')](_0x1b1ba9)[_0x6b28('0x20')](handleEntityNotFound(_0x2f4dd8,null))['then'](respondWithResult(_0x2f4dd8,null))[_0x6b28('0x43')](handleError(_0x2f4dd8,null));};exports[_0x6b28('0x44')]=function(_0x22b33d,_0x5e1fb6){return db[_0x6b28('0x28')][_0x6b28('0x44')](_0x22b33d['body'],{})[_0x6b28('0x20')](respondWithResult(_0x5e1fb6,0xc9))[_0x6b28('0x43')](handleError(_0x5e1fb6,null));};exports[_0x6b28('0x45')]=function(_0x20c4c3,_0x1ca0a1){if(_0x20c4c3['body']['id']){delete _0x20c4c3[_0x6b28('0x46')]['id'];}return db[_0x6b28('0x28')]['find']({'where':{'id':_0x20c4c3[_0x6b28('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ca0a1,null))[_0x6b28('0x20')](saveUpdates(_0x20c4c3[_0x6b28('0x46')],null))[_0x6b28('0x20')](respondWithResult(_0x1ca0a1,null))[_0x6b28('0x43')](handleError(_0x1ca0a1,null));};exports[_0x6b28('0x21')]=function(_0x36c45a,_0x20cfaf){return db[_0x6b28('0x28')]['find']({'where':{'id':_0x36c45a[_0x6b28('0x47')]['id']}})[_0x6b28('0x20')](handleEntityNotFound(_0x20cfaf,null))[_0x6b28('0x20')](removeEntity(_0x20cfaf,null))[_0x6b28('0x43')](handleError(_0x20cfaf,null));}; \ No newline at end of file +var _0x11e7=['bluebird','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','include','SquareMessage','findAll','rows','params','fields','includeAll','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x11e7,0x1d8));var _0x711e=function(_0x33d898,_0x42e297){_0x33d898=_0x33d898-0x0;var _0x4913cf=_0x11e7[_0x33d898];return _0x4913cf;};'use strict';var emlformat=require(_0x711e('0x0'));var rimraf=require(_0x711e('0x1'));var zipdir=require(_0x711e('0x2'));var jsonpatch=require(_0x711e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x711e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x711e('0x5'));var sox=require(_0x711e('0x6'));var csv=require('to-csv');var ejs=require(_0x711e('0x7'));var fs=require('fs');var fs_extra=require(_0x711e('0x8'));var _=require(_0x711e('0x9'));var squel=require(_0x711e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x711e('0xb'));var toCsv=require(_0x711e('0xc'));var querystring=require(_0x711e('0xd'));var Papa=require(_0x711e('0xe'));var Redis=require(_0x711e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x711e('0x10'));var as=require(_0x711e('0x11'));var hardwareService=require(_0x711e('0x12'));var logger=require(_0x711e('0x13'))(_0x711e('0x14'));var utils=require('../../config/utils');var config=require(_0x711e('0x15'));var licenseUtil=require(_0x711e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259f09,_0x559e54){_0x559e54=_0x559e54||0xcc;return function(_0x599bec){if(_0x599bec){return _0x259f09[_0x711e('0x17')](_0x559e54);}return _0x259f09['status'](_0x559e54)[_0x711e('0x18')]();};}function respondWithResult(_0x6841ed,_0x5b5b94){_0x5b5b94=_0x5b5b94||0xc8;return function(_0xe5257c){if(_0xe5257c){return _0x6841ed[_0x711e('0x19')](_0x5b5b94)[_0x711e('0x1a')](_0xe5257c);}};}function respondWithFilteredResult(_0x8505f2,_0x6dc60){return function(_0x3d29c3){if(_0x3d29c3){var _0x31c2d3=typeof _0x6dc60[_0x711e('0x1b')]==='undefined'&&typeof _0x6dc60[_0x711e('0x1c')]===_0x711e('0x1d');var _0x54d053=_0x3d29c3[_0x711e('0x1e')];var _0x9e3ae6=_0x31c2d3?0x0:_0x6dc60['offset'];var _0x16d493=_0x31c2d3?_0x3d29c3['count']:_0x6dc60[_0x711e('0x1b')]+_0x6dc60['limit'];var _0x5db4d4;if(_0x16d493>=_0x54d053){_0x16d493=_0x54d053;_0x5db4d4=0xc8;}else{_0x5db4d4=0xce;}_0x8505f2[_0x711e('0x19')](_0x5db4d4);return _0x8505f2['set']('Content-Range',_0x9e3ae6+'-'+_0x16d493+'/'+_0x54d053)[_0x711e('0x1a')](_0x3d29c3);}return null;};}function patchUpdates(_0x343c0e){return function(_0x32f5c8){try{jsonpatch['apply'](_0x32f5c8,_0x343c0e,!![]);}catch(_0x176f0b){return BPromise['reject'](_0x176f0b);}return _0x32f5c8[_0x711e('0x1f')]();};}function saveUpdates(_0x37ab45,_0x53e820){return function(_0xd5ad20){if(_0xd5ad20){return _0xd5ad20['update'](_0x37ab45)[_0x711e('0x20')](function(_0x13e91d){return _0x13e91d;});}return null;};}function removeEntity(_0x2b22a2,_0x4f7e62){return function(_0xdc39a8){if(_0xdc39a8){return _0xdc39a8[_0x711e('0x21')]()['then'](function(){_0x2b22a2[_0x711e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41bd9f,_0x3e2133){return function(_0x22dd27){if(!_0x22dd27){_0x41bd9f['sendStatus'](0x194);}return _0x22dd27;};}function handleError(_0x45a3a3,_0x46cfbe){_0x46cfbe=_0x46cfbe||0x1f4;return function(_0x108a98){logger[_0x711e('0x22')](_0x108a98['stack']);if(_0x108a98['name']){delete _0x108a98[_0x711e('0x23')];}_0x45a3a3[_0x711e('0x19')](_0x46cfbe)['send'](_0x108a98);};}exports[_0x711e('0x24')]=function(_0xfe12d1,_0x116e6e){var _0x8a2bea={},_0x500993={},_0x3baeb6={'count':0x0,'rows':[]};var _0x3808aa=_[_0x711e('0x25')](db['SquareMessage'][_0x711e('0x26')],function(_0x43ea51){return{'name':_0x43ea51[_0x711e('0x27')],'type':_0x43ea51[_0x711e('0x28')][_0x711e('0x29')]};});_0x500993[_0x711e('0x2a')]=_['map'](_0x3808aa,_0x711e('0x23'));_0x500993[_0x711e('0x2b')]=_[_0x711e('0x2c')](_0xfe12d1['query']);_0x500993[_0x711e('0x2d')]=_['intersection'](_0x500993['model'],_0x500993[_0x711e('0x2b')]);_0x8a2bea[_0x711e('0x2e')]=_[_0x711e('0x2f')](_0x500993['model'],qs['fields'](_0xfe12d1['query']['fields']));_0x8a2bea[_0x711e('0x2e')]=_0x8a2bea[_0x711e('0x2e')][_0x711e('0x30')]?_0x8a2bea['attributes']:_0x500993[_0x711e('0x2a')];if(!_0xfe12d1['query'][_0x711e('0x31')]('nolimit')){_0x8a2bea[_0x711e('0x1c')]=qs[_0x711e('0x1c')](_0xfe12d1[_0x711e('0x2b')]['limit']);_0x8a2bea[_0x711e('0x1b')]=qs['offset'](_0xfe12d1[_0x711e('0x2b')][_0x711e('0x1b')]);}_0x8a2bea['order']=qs[_0x711e('0x32')](_0xfe12d1['query']['sort']);_0x8a2bea[_0x711e('0x33')]=qs['filters'](_['pick'](_0xfe12d1['query'],_0x500993[_0x711e('0x2d')]),_0x3808aa);if(_0xfe12d1[_0x711e('0x2b')][_0x711e('0x34')]){_0x8a2bea[_0x711e('0x33')]=_[_0x711e('0x35')](_0x8a2bea['where'],{'$or':_[_0x711e('0x25')](_0x3808aa,function(_0x17bf6d){if(_0x17bf6d[_0x711e('0x28')]!==_0x711e('0x36')){var _0xcdd1eb={};_0xcdd1eb[_0x17bf6d['name']]={'$like':'%'+_0xfe12d1[_0x711e('0x2b')][_0x711e('0x34')]+'%'};return _0xcdd1eb;}})});}_0x8a2bea=_[_0x711e('0x35')]({},_0x8a2bea,_0xfe12d1['options']);var _0x3a167d={'where':_0x8a2bea['where']};return db['SquareMessage']['count'](_0x3a167d)[_0x711e('0x20')](function(_0x5705d6){_0x3baeb6[_0x711e('0x1e')]=_0x5705d6;if(_0xfe12d1[_0x711e('0x2b')]['includeAll']){_0x8a2bea[_0x711e('0x37')]=[{'all':!![]}];}return db[_0x711e('0x38')][_0x711e('0x39')](_0x8a2bea);})[_0x711e('0x20')](function(_0x1ad7e5){_0x3baeb6[_0x711e('0x3a')]=_0x1ad7e5;return _0x3baeb6;})['then'](respondWithFilteredResult(_0x116e6e,_0x8a2bea))['catch'](handleError(_0x116e6e,null));};exports['show']=function(_0x5c9bfe,_0x22dcda){var _0x12496e={'raw':!![],'where':{'id':_0x5c9bfe[_0x711e('0x3b')]['id']}},_0x16f936={};_0x16f936[_0x711e('0x2a')]=_[_0x711e('0x2c')](db[_0x711e('0x38')][_0x711e('0x26')]);_0x16f936[_0x711e('0x2b')]=_['keys'](_0x5c9bfe['query']);_0x16f936[_0x711e('0x2d')]=_['intersection'](_0x16f936['model'],_0x16f936[_0x711e('0x2b')]);_0x12496e[_0x711e('0x2e')]=_[_0x711e('0x2f')](_0x16f936[_0x711e('0x2a')],qs[_0x711e('0x3c')](_0x5c9bfe[_0x711e('0x2b')][_0x711e('0x3c')]));_0x12496e[_0x711e('0x2e')]=_0x12496e[_0x711e('0x2e')][_0x711e('0x30')]?_0x12496e[_0x711e('0x2e')]:_0x16f936[_0x711e('0x2a')];if(_0x5c9bfe[_0x711e('0x2b')][_0x711e('0x3d')]){_0x12496e['include']=[{'all':!![]}];}_0x12496e=_[_0x711e('0x35')]({},_0x12496e,_0x5c9bfe[_0x711e('0x3e')]);return db[_0x711e('0x38')][_0x711e('0x3f')](_0x12496e)[_0x711e('0x20')](handleEntityNotFound(_0x22dcda,null))['then'](respondWithResult(_0x22dcda,null))[_0x711e('0x40')](handleError(_0x22dcda,null));};exports[_0x711e('0x41')]=function(_0x4bf1d2,_0xdaa91){return db[_0x711e('0x38')][_0x711e('0x41')](_0x4bf1d2[_0x711e('0x42')],{})['then'](respondWithResult(_0xdaa91,0xc9))['catch'](handleError(_0xdaa91,null));};exports[_0x711e('0x43')]=function(_0x3cf3e5,_0x561925){if(_0x3cf3e5[_0x711e('0x42')]['id']){delete _0x3cf3e5[_0x711e('0x42')]['id'];}return db[_0x711e('0x38')][_0x711e('0x3f')]({'where':{'id':_0x3cf3e5[_0x711e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x561925,null))[_0x711e('0x20')](saveUpdates(_0x3cf3e5[_0x711e('0x42')],null))[_0x711e('0x20')](respondWithResult(_0x561925,null))['catch'](handleError(_0x561925,null));};exports['destroy']=function(_0xac7905,_0x4e9d90){return db['SquareMessage'][_0x711e('0x3f')]({'where':{'id':_0xac7905[_0x711e('0x3b')]['id']}})[_0x711e('0x20')](handleEntityNotFound(_0x4e9d90,null))[_0x711e('0x20')](removeEntity(_0x4e9d90,null))[_0x711e('0x40')](handleError(_0x4e9d90,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1f707dc..7170f39 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 _0xbc21=['../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x168399,_0x261e7e){var _0x2e1080=function(_0x1818ae){while(--_0x1818ae){_0x168399['push'](_0x168399['shift']());}};_0x2e1080(++_0x261e7e);}(_0xbc21,0x10d));var _0x1bc2=function(_0xd1d73e,_0x5ea73a){_0xd1d73e=_0xd1d73e-0x0;var _0x4eb7fe=_0xbc21[_0xd1d73e];return _0x4eb7fe;};'use strict';var _=require(_0x1bc2('0x0'));var util=require(_0x1bc2('0x1'));var logger=require(_0x1bc2('0x2'))(_0x1bc2('0x3'));var moment=require(_0x1bc2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bc2('0x5'));var rimraf=require(_0x1bc2('0x6'));var config=require(_0x1bc2('0x7'));var attributes=require('./squareMessage.attributes');module[_0x1bc2('0x8')]=function(_0x2f0014,_0x2a7b39){return _0x2f0014[_0x1bc2('0x9')](_0x1bc2('0xa'),attributes,{'tableName':_0x1bc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d9=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash'];(function(_0x7efb7,_0x5ee7c1){var _0x5a7999=function(_0x50f90a){while(--_0x50f90a){_0x7efb7['push'](_0x7efb7['shift']());}};_0x5a7999(++_0x5ee7c1);}(_0x98d9,0x12b));var _0x998d=function(_0x1fcaca,_0x23288d){_0x1fcaca=_0x1fcaca-0x0;var _0x17d29c=_0x98d9[_0x1fcaca];return _0x17d29c;};'use strict';var _=require(_0x998d('0x0'));var util=require(_0x998d('0x1'));var logger=require(_0x998d('0x2'))(_0x998d('0x3'));var moment=require(_0x998d('0x4'));var BPromise=require(_0x998d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x998d('0x6'));var rimraf=require(_0x998d('0x7'));var config=require(_0x998d('0x8'));var attributes=require(_0x998d('0x9'));module['exports']=function(_0x302edc,_0x1fa331){return _0x302edc['define'](_0x998d('0xa'),attributes,{'tableName':_0x998d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 9d70b0a..c8c683d 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 _0xbd30=['request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x338c8c,_0x19df14){var _0x371a9a=function(_0x4da3fe){while(--_0x4da3fe){_0x338c8c['push'](_0x338c8c['shift']());}};_0x371a9a(++_0x19df14);}(_0xbd30,0x161));var _0x0bd3=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xbd30[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x0bd3('0x0'));var util=require(_0x0bd3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0bd3('0x2'));var fs=require('fs');var Redis=require(_0x0bd3('0x3'));var db=require(_0x0bd3('0x4'))['db'];var utils=require(_0x0bd3('0x5'));var logger=require('../../config/logger')(_0x0bd3('0x6'));var config=require(_0x0bd3('0x7'));var jayson=require(_0x0bd3('0x8'));var client=jayson[_0x0bd3('0x9')][_0x0bd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x317293,_0xe4b2e3,_0x4c45c8){return new BPromise(function(_0x291d6d,_0xb8dab0){return client[_0x0bd3('0xb')](_0x317293,_0x4c45c8)[_0x0bd3('0xc')](function(_0x2dfc2a){logger[_0x0bd3('0xd')](_0x0bd3('0xe'),_0xe4b2e3,_0x0bd3('0xf'));logger[_0x0bd3('0x10')](_0x0bd3('0x11'),_0xe4b2e3,'request\x20sent',JSON['stringify'](_0x2dfc2a));if(_0x2dfc2a['error']){if(_0x2dfc2a[_0x0bd3('0x12')][_0x0bd3('0x13')]===0x1f4){logger['error'](_0x0bd3('0xe'),_0xe4b2e3,_0x2dfc2a[_0x0bd3('0x12')][_0x0bd3('0x14')]);return _0xb8dab0(_0x2dfc2a['error'][_0x0bd3('0x14')]);}logger['error'](_0x0bd3('0xe'),_0xe4b2e3,_0x2dfc2a[_0x0bd3('0x12')][_0x0bd3('0x14')]);return _0x291d6d(_0x2dfc2a['error'][_0x0bd3('0x14')]);}else{logger[_0x0bd3('0xd')](_0x0bd3('0xe'),_0xe4b2e3,_0x0bd3('0xf'));_0x291d6d(_0x2dfc2a['result'][_0x0bd3('0x14')]);}})[_0x0bd3('0x15')](function(_0x3b5606){logger[_0x0bd3('0x12')]('SquareMessage,\x20%s,\x20%s',_0xe4b2e3,_0x3b5606);_0xb8dab0(_0x3b5606);});});}exports[_0x0bd3('0x16')]=function(_0x216aa1){var _0x13bbf9=this;return new Promise(function(_0x2e4272,_0x252fac){return db[_0x0bd3('0x17')]['create'](_0x216aa1['body'],{'raw':_0x216aa1[_0x0bd3('0x18')]?_0x216aa1[_0x0bd3('0x18')][_0x0bd3('0x19')]===undefined?!![]:![]:!![]})[_0x0bd3('0xc')](function(_0x277125){logger[_0x0bd3('0xd')](_0x0bd3('0x16'),_0x216aa1);logger[_0x0bd3('0x10')](_0x0bd3('0x16'),_0x216aa1,JSON['stringify'](_0x277125));_0x2e4272(_0x277125);})['catch'](function(_0x292019){logger[_0x0bd3('0x12')](_0x0bd3('0x16'),_0x292019['message'],_0x216aa1);_0x252fac(_0x13bbf9[_0x0bd3('0x12')](0x1f4,_0x292019['message']));});});}; \ No newline at end of file +var _0x3029=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5b870a,_0x5cd285){var _0x37ebf1=function(_0x76b2c4){while(--_0x76b2c4){_0x5b870a['push'](_0x5b870a['shift']());}};_0x37ebf1(++_0x5cd285);}(_0x3029,0x1e0));var _0x9302=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0x3029[_0x4ed37d];return _0x4fb2c5;};'use strict';var _=require(_0x9302('0x0'));var util=require(_0x9302('0x1'));var moment=require('moment');var BPromise=require(_0x9302('0x2'));var rs=require(_0x9302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9302('0x4'));var logger=require(_0x9302('0x5'))(_0x9302('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9302('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2588,_0x26a96b,_0x80cf90){return new BPromise(function(_0x3e50b2,_0x39e29c){return client[_0x9302('0x8')](_0x2e2588,_0x80cf90)[_0x9302('0x9')](function(_0x3348fe){logger[_0x9302('0xa')](_0x9302('0xb'),_0x26a96b,_0x9302('0xc'));logger[_0x9302('0xd')](_0x9302('0xe'),_0x26a96b,'request\x20sent',JSON[_0x9302('0xf')](_0x3348fe));if(_0x3348fe[_0x9302('0x10')]){if(_0x3348fe[_0x9302('0x10')][_0x9302('0x11')]===0x1f4){logger['error'](_0x9302('0xb'),_0x26a96b,_0x3348fe['error'][_0x9302('0x12')]);return _0x39e29c(_0x3348fe[_0x9302('0x10')][_0x9302('0x12')]);}logger[_0x9302('0x10')](_0x9302('0xb'),_0x26a96b,_0x3348fe['error'][_0x9302('0x12')]);return _0x3e50b2(_0x3348fe['error']['message']);}else{logger[_0x9302('0xa')]('SquareMessage,\x20%s,\x20%s',_0x26a96b,_0x9302('0xc'));_0x3e50b2(_0x3348fe['result'][_0x9302('0x12')]);}})[_0x9302('0x13')](function(_0x5a65ca){logger['error'](_0x9302('0xb'),_0x26a96b,_0x5a65ca);_0x39e29c(_0x5a65ca);});});}exports[_0x9302('0x14')]=function(_0x1b5744){var _0x357802=this;return new Promise(function(_0x584357,_0x31e617){return db[_0x9302('0x15')][_0x9302('0x16')](_0x1b5744[_0x9302('0x17')],{'raw':_0x1b5744[_0x9302('0x18')]?_0x1b5744[_0x9302('0x18')][_0x9302('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4de7){logger[_0x9302('0xa')]('CreateSquareMessage',_0x1b5744);logger['debug'](_0x9302('0x14'),_0x1b5744,JSON[_0x9302('0xf')](_0x2d4de7));_0x584357(_0x2d4de7);})['catch'](function(_0x46f0f8){logger[_0x9302('0x10')](_0x9302('0x14'),_0x46f0f8['message'],_0x1b5744);_0x31e617(_0x357802[_0x9302('0x10')](0x1f4,_0x46f0f8[_0x9302('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ccaf954..04db606 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 _0x0640=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/test','15s','test','post','create','/:id','update','delete','destroy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0640,0x1cf));var _0x0064=function(_0x336526,_0x53512b){_0x336526=_0x336526-0x0;var _0x1d1382=_0x0640[_0x336526];return _0x1d1382;};'use strict';var multer=require(_0x0064('0x0'));var util=require(_0x0064('0x1'));var path=require(_0x0064('0x2'));var timeout=require('connect-timeout');var express=require(_0x0064('0x3'));var router=express[_0x0064('0x4')]();var fs_extra=require(_0x0064('0x5'));var auth=require(_0x0064('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0064('0x7'));var controller=require('./squareOdbc.controller');router[_0x0064('0x8')]('/',auth[_0x0064('0x9')](),controller['index']);router[_0x0064('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0064('0xa')]);router[_0x0064('0x8')](_0x0064('0xb'),auth[_0x0064('0x9')](),timeout(_0x0064('0xc')),controller[_0x0064('0xd')]);router[_0x0064('0xe')]('/',auth['isAuthenticated'](),controller[_0x0064('0xf')]);router['put'](_0x0064('0x10'),auth[_0x0064('0x9')](),controller[_0x0064('0x11')]);router[_0x0064('0x12')](_0x0064('0x10'),auth['isAuthenticated'](),controller[_0x0064('0x13')]);module[_0x0064('0x14')]=router; \ No newline at end of file +var _0xd8c9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/test','test','post','create','put','update','destroy'];(function(_0x397ee7,_0x586e59){var _0x41f6d0=function(_0x561945){while(--_0x561945){_0x397ee7['push'](_0x397ee7['shift']());}};_0x41f6d0(++_0x586e59);}(_0xd8c9,0x119));var _0x9d8c=function(_0x1d7be2,_0x377136){_0x1d7be2=_0x1d7be2-0x0;var _0xba17ee=_0xd8c9[_0x1d7be2];return _0xba17ee;};'use strict';var multer=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var path=require(_0x9d8c('0x2'));var timeout=require(_0x9d8c('0x3'));var express=require(_0x9d8c('0x4'));var router=express[_0x9d8c('0x5')]();var fs_extra=require(_0x9d8c('0x6'));var auth=require(_0x9d8c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x9d8c('0x8')]('/',auth[_0x9d8c('0x9')](),controller[_0x9d8c('0xa')]);router[_0x9d8c('0x8')](_0x9d8c('0xb'),auth[_0x9d8c('0x9')](),controller['show']);router[_0x9d8c('0x8')](_0x9d8c('0xc'),auth[_0x9d8c('0x9')](),timeout('15s'),controller[_0x9d8c('0xd')]);router[_0x9d8c('0xe')]('/',auth[_0x9d8c('0x9')](),controller[_0x9d8c('0xf')]);router[_0x9d8c('0x10')](_0x9d8c('0xb'),auth[_0x9d8c('0x9')](),controller[_0x9d8c('0x11')]);router['delete'](_0x9d8c('0xb'),auth[_0x9d8c('0x9')](),controller[_0x9d8c('0x12')]);module[_0x9d8c('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5c989df..041db41 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 _0x3b50=['STRING','sequelize'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x3b50,0x1d5));var _0x03b5=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x3b50[_0x2c9b79];return _0x265032;};'use strict';var Sequelize=require(_0x03b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x03b5('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x03b5('0x1')]}}; \ No newline at end of file +var _0xf3f9=['name','sequelize','STRING'];(function(_0x21653f,_0x41dcba){var _0xbddc35=function(_0x4fa458){while(--_0x4fa458){_0x21653f['push'](_0x21653f['shift']());}};_0xbddc35(++_0x41dcba);}(_0xf3f9,0xb5));var _0x9f3f=function(_0x11a572,_0x38670d){_0x11a572=_0x11a572-0x0;var _0x289db4=_0xf3f9[_0x11a572];return _0x289db4;};'use strict';var Sequelize=require(_0x9f3f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f3f('0x1')],'unique':_0x9f3f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9f3f('0x1')]},'description':{'type':Sequelize[_0x9f3f('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 917d16e..33596d4 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 _0x8c29=['crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','SquareOdbc','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dbfe7,_0xcf1cef){var _0x6d4044=function(_0x306e34){while(--_0x306e34){_0x3dbfe7['push'](_0x3dbfe7['shift']());}};_0x6d4044(++_0xcf1cef);}(_0x8c29,0xfc));var _0x98c2=function(_0x4b4bef,_0x588260){_0x4b4bef=_0x4b4bef-0x0;var _0xedf8fc=_0x8c29[_0x4b4bef];return _0xedf8fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98c2('0x1'));var rp=require('request-promise');var moment=require(_0x98c2('0x2'));var BPromise=require(_0x98c2('0x3'));var Mustache=require(_0x98c2('0x4'));var util=require(_0x98c2('0x5'));var path=require(_0x98c2('0x6'));var sox=require('sox');var csv=require(_0x98c2('0x7'));var ejs=require(_0x98c2('0x8'));var fs=require('fs');var fs_extra=require(_0x98c2('0x9'));var _=require(_0x98c2('0xa'));var squel=require(_0x98c2('0xb'));var crypto=require(_0x98c2('0xc'));var jsforce=require(_0x98c2('0xd'));var deskjs=require(_0x98c2('0xe'));var toCsv=require(_0x98c2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98c2('0xf'));var authService=require(_0x98c2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98c2('0x11'));var logger=require(_0x98c2('0x12'))(_0x98c2('0x13'));var utils=require(_0x98c2('0x14'));var config=require(_0x98c2('0x15'));var licenseUtil=require(_0x98c2('0x16'));var db=require(_0x98c2('0x17'))['db'];function respondWithStatusCode(_0x4a924a,_0x101367){_0x101367=_0x101367||0xcc;return function(_0x29a7c6){if(_0x29a7c6){return _0x4a924a[_0x98c2('0x18')](_0x101367);}return _0x4a924a['status'](_0x101367)[_0x98c2('0x19')]();};}function respondWithResult(_0x6c7788,_0x420364){_0x420364=_0x420364||0xc8;return function(_0x4db3f5){if(_0x4db3f5){return _0x6c7788['status'](_0x420364)[_0x98c2('0x1a')](_0x4db3f5);}};}function respondWithFilteredResult(_0x2a923d,_0x20ceb7){return function(_0x429b16){if(_0x429b16){var _0x27efff=typeof _0x20ceb7[_0x98c2('0x1b')]==='undefined'&&typeof _0x20ceb7[_0x98c2('0x1c')]===_0x98c2('0x1d');var _0x213eea=_0x429b16[_0x98c2('0x1e')];var _0x3789c6=_0x27efff?0x0:_0x20ceb7['offset'];var _0x43fca7=_0x27efff?_0x429b16[_0x98c2('0x1e')]:_0x20ceb7[_0x98c2('0x1b')]+_0x20ceb7[_0x98c2('0x1c')];var _0x1ba98c;if(_0x43fca7>=_0x213eea){_0x43fca7=_0x213eea;_0x1ba98c=0xc8;}else{_0x1ba98c=0xce;}_0x2a923d[_0x98c2('0x1f')](_0x1ba98c);return _0x2a923d[_0x98c2('0x20')](_0x98c2('0x21'),_0x3789c6+'-'+_0x43fca7+'/'+_0x213eea)['json'](_0x429b16);}return null;};}function patchUpdates(_0x54843b){return function(_0x4eb856){try{jsonpatch['apply'](_0x4eb856,_0x54843b,!![]);}catch(_0x183fd3){return BPromise[_0x98c2('0x22')](_0x183fd3);}return _0x4eb856['save']();};}function saveUpdates(_0x43ec0f,_0x32c1){return function(_0x2b1416){if(_0x2b1416){return _0x2b1416[_0x98c2('0x23')](_0x43ec0f)[_0x98c2('0x24')](function(_0x429080){return _0x429080;});}return null;};}function removeEntity(_0x4cf85b,_0x5f78a8){return function(_0x1ce7af){if(_0x1ce7af){return _0x1ce7af[_0x98c2('0x25')]()['then'](function(){var _0x53c210=_0x1ce7af['get']({'plain':!![]});var _0x48509f='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x48509f,'resourceId':_0x53c210['id']}})[_0x98c2('0x24')](function(){return _0x1ce7af;});})[_0x98c2('0x24')](function(){_0x4cf85b[_0x98c2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25814f,_0x26f265){return function(_0x314c29){if(!_0x314c29){_0x25814f[_0x98c2('0x18')](0x194);}return _0x314c29;};}function handleError(_0x9419b0,_0x34e733){_0x34e733=_0x34e733||0x1f4;return function(_0x25d82e){logger[_0x98c2('0x26')](_0x25d82e[_0x98c2('0x27')]);if(_0x25d82e['name']){delete _0x25d82e[_0x98c2('0x28')];}_0x9419b0['status'](_0x34e733)['send'](_0x25d82e);};}exports[_0x98c2('0x29')]=function(_0x199ea6,_0x4c04f9){var _0x1a027a={},_0x20b1ca={},_0x17f48c={'count':0x0,'rows':[]};var _0x344f4e=_[_0x98c2('0x2a')](db[_0x98c2('0x2b')][_0x98c2('0x2c')],function(_0xb65a0c){return{'name':_0xb65a0c['fieldName'],'type':_0xb65a0c[_0x98c2('0x2d')]['key']};});_0x20b1ca[_0x98c2('0x2e')]=_[_0x98c2('0x2a')](_0x344f4e,'name');_0x20b1ca['query']=_['keys'](_0x199ea6[_0x98c2('0x2f')]);_0x20b1ca[_0x98c2('0x30')]=_[_0x98c2('0x31')](_0x20b1ca['model'],_0x20b1ca[_0x98c2('0x2f')]);_0x1a027a[_0x98c2('0x32')]=_[_0x98c2('0x31')](_0x20b1ca[_0x98c2('0x2e')],qs[_0x98c2('0x33')](_0x199ea6[_0x98c2('0x2f')]['fields']));_0x1a027a[_0x98c2('0x32')]=_0x1a027a[_0x98c2('0x32')][_0x98c2('0x34')]?_0x1a027a[_0x98c2('0x32')]:_0x20b1ca[_0x98c2('0x2e')];if(!_0x199ea6['query'][_0x98c2('0x35')](_0x98c2('0x36'))){_0x1a027a[_0x98c2('0x1c')]=qs[_0x98c2('0x1c')](_0x199ea6[_0x98c2('0x2f')]['limit']);_0x1a027a[_0x98c2('0x1b')]=qs['offset'](_0x199ea6[_0x98c2('0x2f')]['offset']);}_0x1a027a[_0x98c2('0x37')]=qs[_0x98c2('0x38')](_0x199ea6[_0x98c2('0x2f')][_0x98c2('0x38')]);_0x1a027a[_0x98c2('0x39')]=qs[_0x98c2('0x30')](_[_0x98c2('0x3a')](_0x199ea6['query'],_0x20b1ca[_0x98c2('0x30')]),_0x344f4e);if(_0x199ea6['query'][_0x98c2('0x3b')]){_0x1a027a[_0x98c2('0x39')]=_[_0x98c2('0x3c')](_0x1a027a[_0x98c2('0x39')],{'$or':_[_0x98c2('0x2a')](_0x344f4e,function(_0x4f164c){if(_0x4f164c[_0x98c2('0x2d')]!==_0x98c2('0x3d')){var _0xc7afd6={};_0xc7afd6[_0x4f164c[_0x98c2('0x28')]]={'$like':'%'+_0x199ea6['query'][_0x98c2('0x3b')]+'%'};return _0xc7afd6;}})});}_0x1a027a=_[_0x98c2('0x3c')]({},_0x1a027a,_0x199ea6[_0x98c2('0x3e')]);var _0x5695a7={'where':_0x1a027a[_0x98c2('0x39')]};return db[_0x98c2('0x2b')][_0x98c2('0x1e')](_0x5695a7)['then'](function(_0x21341c){_0x17f48c['count']=_0x21341c;if(_0x199ea6[_0x98c2('0x2f')][_0x98c2('0x3f')]){_0x1a027a[_0x98c2('0x40')]=[{'all':!![]}];}return db['SquareOdbc'][_0x98c2('0x41')](_0x1a027a);})['then'](function(_0x5d4794){_0x17f48c[_0x98c2('0x42')]=_0x5d4794;return _0x17f48c;})['then'](respondWithFilteredResult(_0x4c04f9,_0x1a027a))[_0x98c2('0x43')](handleError(_0x4c04f9,null));};exports[_0x98c2('0x44')]=function(_0x33008b,_0x313ff2){var _0x2da889={'raw':!![],'where':{'id':_0x33008b[_0x98c2('0x45')]['id']}},_0x29055b={};_0x29055b[_0x98c2('0x2e')]=_['keys'](db[_0x98c2('0x2b')][_0x98c2('0x2c')]);_0x29055b[_0x98c2('0x2f')]=_[_0x98c2('0x46')](_0x33008b[_0x98c2('0x2f')]);_0x29055b[_0x98c2('0x30')]=_['intersection'](_0x29055b[_0x98c2('0x2e')],_0x29055b[_0x98c2('0x2f')]);_0x2da889[_0x98c2('0x32')]=_[_0x98c2('0x31')](_0x29055b['model'],qs[_0x98c2('0x33')](_0x33008b[_0x98c2('0x2f')][_0x98c2('0x33')]));_0x2da889[_0x98c2('0x32')]=_0x2da889[_0x98c2('0x32')][_0x98c2('0x34')]?_0x2da889[_0x98c2('0x32')]:_0x29055b[_0x98c2('0x2e')];if(_0x33008b[_0x98c2('0x2f')]['includeAll']){_0x2da889[_0x98c2('0x40')]=[{'all':!![]}];}_0x2da889=_[_0x98c2('0x3c')]({},_0x2da889,_0x33008b[_0x98c2('0x3e')]);return db['SquareOdbc'][_0x98c2('0x47')](_0x2da889)[_0x98c2('0x24')](handleEntityNotFound(_0x313ff2,null))['then'](respondWithResult(_0x313ff2,null))['catch'](handleError(_0x313ff2,null));};exports['create']=function(_0x34fb20,_0x34c412){return db[_0x98c2('0x2b')][_0x98c2('0x48')](_0x34fb20[_0x98c2('0x49')],{})[_0x98c2('0x24')](function(_0x345968){var _0x103d87=_0x34fb20[_0x98c2('0x4a')][_0x98c2('0x4b')]({'plain':!![]});if(!_0x103d87)throw new Error(_0x98c2('0x4c'));if(_0x103d87[_0x98c2('0x4d')]===_0x98c2('0x4a')){var _0x10e25f=_0x345968[_0x98c2('0x4b')]({'plain':!![]});var _0x4b86ea=_0x98c2('0x4e');return db['UserProfileSection'][_0x98c2('0x47')]({'where':{'name':_0x4b86ea,'userProfileId':_0x103d87[_0x98c2('0x4f')]},'raw':!![]})[_0x98c2('0x24')](function(_0x113e71){if(_0x113e71&&_0x113e71[_0x98c2('0x50')]===0x0){return db[_0x98c2('0x51')]['create']({'name':_0x10e25f[_0x98c2('0x28')],'resourceId':_0x10e25f['id'],'type':_0x113e71[_0x98c2('0x28')],'sectionId':_0x113e71['id']},{})['then'](function(){return _0x345968;});}else{return _0x345968;}})[_0x98c2('0x43')](function(_0x2209d5){logger[_0x98c2('0x26')](_0x98c2('0x52'),_0x2209d5);throw _0x2209d5;});}return _0x345968;})[_0x98c2('0x24')](respondWithResult(_0x34c412,0xc9))[_0x98c2('0x43')](handleError(_0x34c412,null));};exports[_0x98c2('0x23')]=function(_0x1d6892,_0x47cb64){if(_0x1d6892[_0x98c2('0x49')]['id']){delete _0x1d6892[_0x98c2('0x49')]['id'];}return db[_0x98c2('0x2b')][_0x98c2('0x47')]({'where':{'id':_0x1d6892[_0x98c2('0x45')]['id']}})[_0x98c2('0x24')](handleEntityNotFound(_0x47cb64,null))[_0x98c2('0x24')](saveUpdates(_0x1d6892[_0x98c2('0x49')],null))[_0x98c2('0x24')](respondWithResult(_0x47cb64,null))[_0x98c2('0x43')](handleError(_0x47cb64,null));};exports['destroy']=function(_0x2435be,_0x13981c){return db[_0x98c2('0x2b')][_0x98c2('0x47')]({'where':{'id':_0x2435be[_0x98c2('0x45')]['id']}})[_0x98c2('0x24')](handleEntityNotFound(_0x13981c,null))[_0x98c2('0x24')](removeEntity(_0x13981c,null))[_0x98c2('0x43')](handleError(_0x13981c,null));};exports[_0x98c2('0x53')]=function(_0x3fae91,_0x1b1e29,_0x1b3420){var _0x5bfaef;return db[_0x98c2('0x2b')]['find']({'where':{'id':_0x3fae91[_0x98c2('0x45')]['id']},'attributes':['id','dsn']})[_0x98c2('0x24')](handleEntityNotFound(_0x1b1e29,null))[_0x98c2('0x24')](function(_0xbdccb0){if(_0xbdccb0){var _0x5dea68=require(_0x98c2('0x54'))();_0x5dea68[_0x98c2('0x55')](_0xbdccb0[_0x98c2('0x56')]);_0x5dea68[_0x98c2('0x57')]();return _0xbdccb0;}})[_0x98c2('0x24')](respondWithResult(_0x1b1e29,null))['catch'](handleError(_0x1b1e29,null));}; \ No newline at end of file +var _0x11de=['UserProfileResource','end','error','stack','name','send','index','map','SquareOdbc','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','ODBC'];(function(_0x206f81,_0x162277){var _0x2cf08f=function(_0x131532){while(--_0x131532){_0x206f81['push'](_0x206f81['shift']());}};_0x2cf08f(++_0x162277);}(_0x11de,0x184));var _0xe11d=function(_0x33944c,_0x2fd7f3){_0x33944c=_0x33944c-0x0;var _0x3a8a1e=_0x11de[_0x33944c];return _0x3a8a1e;};'use strict';var emlformat=require(_0xe11d('0x0'));var rimraf=require(_0xe11d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe11d('0x2'));var BPromise=require(_0xe11d('0x3'));var Mustache=require(_0xe11d('0x4'));var util=require(_0xe11d('0x5'));var path=require(_0xe11d('0x6'));var sox=require(_0xe11d('0x7'));var csv=require(_0xe11d('0x8'));var ejs=require(_0xe11d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe11d('0xa'));var jsforce=require(_0xe11d('0xb'));var deskjs=require(_0xe11d('0xc'));var toCsv=require(_0xe11d('0x8'));var querystring=require(_0xe11d('0xd'));var Papa=require('papaparse');var Redis=require(_0xe11d('0xe'));var authService=require(_0xe11d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe11d('0x10'));var hardwareService=require(_0xe11d('0x11'));var logger=require(_0xe11d('0x12'))(_0xe11d('0x13'));var utils=require(_0xe11d('0x14'));var config=require(_0xe11d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe11d('0x16'))['db'];function respondWithStatusCode(_0x443043,_0x5e7bab){_0x5e7bab=_0x5e7bab||0xcc;return function(_0x1a1096){if(_0x1a1096){return _0x443043[_0xe11d('0x17')](_0x5e7bab);}return _0x443043[_0xe11d('0x18')](_0x5e7bab)['end']();};}function respondWithResult(_0x5b162d,_0xcaa7ee){_0xcaa7ee=_0xcaa7ee||0xc8;return function(_0x768319){if(_0x768319){return _0x5b162d['status'](_0xcaa7ee)[_0xe11d('0x19')](_0x768319);}};}function respondWithFilteredResult(_0x5bb337,_0x268d87){return function(_0x5f1912){if(_0x5f1912){var _0x421402=typeof _0x268d87[_0xe11d('0x1a')]==='undefined'&&typeof _0x268d87[_0xe11d('0x1b')]==='undefined';var _0x57ebcd=_0x5f1912[_0xe11d('0x1c')];var _0x9b7b9b=_0x421402?0x0:_0x268d87[_0xe11d('0x1a')];var _0x4129ae=_0x421402?_0x5f1912[_0xe11d('0x1c')]:_0x268d87['offset']+_0x268d87[_0xe11d('0x1b')];var _0x14aa7c;if(_0x4129ae>=_0x57ebcd){_0x4129ae=_0x57ebcd;_0x14aa7c=0xc8;}else{_0x14aa7c=0xce;}_0x5bb337[_0xe11d('0x18')](_0x14aa7c);return _0x5bb337[_0xe11d('0x1d')](_0xe11d('0x1e'),_0x9b7b9b+'-'+_0x4129ae+'/'+_0x57ebcd)[_0xe11d('0x19')](_0x5f1912);}return null;};}function patchUpdates(_0xa690b2){return function(_0x127b40){try{jsonpatch['apply'](_0x127b40,_0xa690b2,!![]);}catch(_0x50ef55){return BPromise['reject'](_0x50ef55);}return _0x127b40[_0xe11d('0x1f')]();};}function saveUpdates(_0x284b95,_0x236ce8){return function(_0xadee7a){if(_0xadee7a){return _0xadee7a[_0xe11d('0x20')](_0x284b95)[_0xe11d('0x21')](function(_0x329dd7){return _0x329dd7;});}return null;};}function removeEntity(_0x4c66f8,_0x3e05f7){return function(_0x15f85f){if(_0x15f85f){return _0x15f85f[_0xe11d('0x22')]()[_0xe11d('0x21')](function(){var _0x37767b=_0x15f85f[_0xe11d('0x23')]({'plain':!![]});var _0x216786=_0xe11d('0x24');return db[_0xe11d('0x25')][_0xe11d('0x22')]({'where':{'type':_0x216786,'resourceId':_0x37767b['id']}})[_0xe11d('0x21')](function(){return _0x15f85f;});})[_0xe11d('0x21')](function(){_0x4c66f8[_0xe11d('0x18')](0xcc)[_0xe11d('0x26')]();});}};}function handleEntityNotFound(_0x186df2,_0x5eed39){return function(_0x2b9a65){if(!_0x2b9a65){_0x186df2['sendStatus'](0x194);}return _0x2b9a65;};}function handleError(_0x1f4512,_0x3b8b35){_0x3b8b35=_0x3b8b35||0x1f4;return function(_0x56fa50){logger[_0xe11d('0x27')](_0x56fa50[_0xe11d('0x28')]);if(_0x56fa50[_0xe11d('0x29')]){delete _0x56fa50['name'];}_0x1f4512[_0xe11d('0x18')](_0x3b8b35)[_0xe11d('0x2a')](_0x56fa50);};}exports[_0xe11d('0x2b')]=function(_0x20274e,_0x7f2f34){var _0x4074f0={},_0x3d8c68={},_0x34068b={'count':0x0,'rows':[]};var _0x3a5594=_[_0xe11d('0x2c')](db[_0xe11d('0x2d')][_0xe11d('0x2e')],function(_0x4e4204){return{'name':_0x4e4204['fieldName'],'type':_0x4e4204['type'][_0xe11d('0x2f')]};});_0x3d8c68[_0xe11d('0x30')]=_[_0xe11d('0x2c')](_0x3a5594,_0xe11d('0x29'));_0x3d8c68[_0xe11d('0x31')]=_['keys'](_0x20274e[_0xe11d('0x31')]);_0x3d8c68['filters']=_[_0xe11d('0x32')](_0x3d8c68['model'],_0x3d8c68['query']);_0x4074f0['attributes']=_['intersection'](_0x3d8c68['model'],qs['fields'](_0x20274e[_0xe11d('0x31')][_0xe11d('0x33')]));_0x4074f0['attributes']=_0x4074f0[_0xe11d('0x34')][_0xe11d('0x35')]?_0x4074f0[_0xe11d('0x34')]:_0x3d8c68[_0xe11d('0x30')];if(!_0x20274e[_0xe11d('0x31')][_0xe11d('0x36')](_0xe11d('0x37'))){_0x4074f0['limit']=qs[_0xe11d('0x1b')](_0x20274e[_0xe11d('0x31')][_0xe11d('0x1b')]);_0x4074f0[_0xe11d('0x1a')]=qs['offset'](_0x20274e[_0xe11d('0x31')]['offset']);}_0x4074f0[_0xe11d('0x38')]=qs['sort'](_0x20274e[_0xe11d('0x31')][_0xe11d('0x39')]);_0x4074f0[_0xe11d('0x3a')]=qs['filters'](_[_0xe11d('0x3b')](_0x20274e[_0xe11d('0x31')],_0x3d8c68[_0xe11d('0x3c')]),_0x3a5594);if(_0x20274e[_0xe11d('0x31')]['filter']){_0x4074f0[_0xe11d('0x3a')]=_[_0xe11d('0x3d')](_0x4074f0[_0xe11d('0x3a')],{'$or':_[_0xe11d('0x2c')](_0x3a5594,function(_0x130c78){if(_0x130c78['type']!==_0xe11d('0x3e')){var _0x3d5fc0={};_0x3d5fc0[_0x130c78[_0xe11d('0x29')]]={'$like':'%'+_0x20274e['query']['filter']+'%'};return _0x3d5fc0;}})});}_0x4074f0=_[_0xe11d('0x3d')]({},_0x4074f0,_0x20274e[_0xe11d('0x3f')]);var _0x23d9a0={'where':_0x4074f0[_0xe11d('0x3a')]};return db[_0xe11d('0x2d')][_0xe11d('0x1c')](_0x23d9a0)[_0xe11d('0x21')](function(_0x36c8ef){_0x34068b[_0xe11d('0x1c')]=_0x36c8ef;if(_0x20274e['query'][_0xe11d('0x40')]){_0x4074f0['include']=[{'all':!![]}];}return db[_0xe11d('0x2d')][_0xe11d('0x41')](_0x4074f0);})[_0xe11d('0x21')](function(_0x1c0b8e){_0x34068b[_0xe11d('0x42')]=_0x1c0b8e;return _0x34068b;})[_0xe11d('0x21')](respondWithFilteredResult(_0x7f2f34,_0x4074f0))[_0xe11d('0x43')](handleError(_0x7f2f34,null));};exports[_0xe11d('0x44')]=function(_0x51ccdf,_0x399890){var _0x590f13={'raw':!![],'where':{'id':_0x51ccdf['params']['id']}},_0x2a8af6={};_0x2a8af6[_0xe11d('0x30')]=_[_0xe11d('0x45')](db[_0xe11d('0x2d')]['rawAttributes']);_0x2a8af6[_0xe11d('0x31')]=_[_0xe11d('0x45')](_0x51ccdf[_0xe11d('0x31')]);_0x2a8af6['filters']=_[_0xe11d('0x32')](_0x2a8af6[_0xe11d('0x30')],_0x2a8af6['query']);_0x590f13['attributes']=_[_0xe11d('0x32')](_0x2a8af6[_0xe11d('0x30')],qs['fields'](_0x51ccdf[_0xe11d('0x31')]['fields']));_0x590f13[_0xe11d('0x34')]=_0x590f13[_0xe11d('0x34')][_0xe11d('0x35')]?_0x590f13['attributes']:_0x2a8af6[_0xe11d('0x30')];if(_0x51ccdf[_0xe11d('0x31')][_0xe11d('0x40')]){_0x590f13[_0xe11d('0x46')]=[{'all':!![]}];}_0x590f13=_[_0xe11d('0x3d')]({},_0x590f13,_0x51ccdf[_0xe11d('0x3f')]);return db['SquareOdbc'][_0xe11d('0x47')](_0x590f13)[_0xe11d('0x21')](handleEntityNotFound(_0x399890,null))[_0xe11d('0x21')](respondWithResult(_0x399890,null))[_0xe11d('0x43')](handleError(_0x399890,null));};exports[_0xe11d('0x48')]=function(_0x349985,_0x1b04f0){return db[_0xe11d('0x2d')][_0xe11d('0x48')](_0x349985[_0xe11d('0x49')],{})[_0xe11d('0x21')](function(_0x3d606d){var _0x5ecf11=_0x349985[_0xe11d('0x4a')]['get']({'plain':!![]});if(!_0x5ecf11)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ecf11[_0xe11d('0x4b')]===_0xe11d('0x4a')){var _0x41f5d8=_0x3d606d[_0xe11d('0x23')]({'plain':!![]});var _0x34079a='ODBC';return db[_0xe11d('0x4c')]['find']({'where':{'name':_0x34079a,'userProfileId':_0x5ecf11[_0xe11d('0x4d')]},'raw':!![]})[_0xe11d('0x21')](function(_0x1a8ce6){if(_0x1a8ce6&&_0x1a8ce6[_0xe11d('0x4e')]===0x0){return db['UserProfileResource'][_0xe11d('0x48')]({'name':_0x41f5d8[_0xe11d('0x29')],'resourceId':_0x41f5d8['id'],'type':_0x1a8ce6[_0xe11d('0x29')],'sectionId':_0x1a8ce6['id']},{})['then'](function(){return _0x3d606d;});}else{return _0x3d606d;}})[_0xe11d('0x43')](function(_0x35a69d){logger[_0xe11d('0x27')](_0xe11d('0x4f'),_0x35a69d);throw _0x35a69d;});}return _0x3d606d;})[_0xe11d('0x21')](respondWithResult(_0x1b04f0,0xc9))[_0xe11d('0x43')](handleError(_0x1b04f0,null));};exports['update']=function(_0x2cbe6a,_0x4e8f44){if(_0x2cbe6a[_0xe11d('0x49')]['id']){delete _0x2cbe6a[_0xe11d('0x49')]['id'];}return db[_0xe11d('0x2d')][_0xe11d('0x47')]({'where':{'id':_0x2cbe6a[_0xe11d('0x50')]['id']}})[_0xe11d('0x21')](handleEntityNotFound(_0x4e8f44,null))[_0xe11d('0x21')](saveUpdates(_0x2cbe6a['body'],null))['then'](respondWithResult(_0x4e8f44,null))[_0xe11d('0x43')](handleError(_0x4e8f44,null));};exports['destroy']=function(_0x459ba1,_0x270478){return db['SquareOdbc'][_0xe11d('0x47')]({'where':{'id':_0x459ba1[_0xe11d('0x50')]['id']}})['then'](handleEntityNotFound(_0x270478,null))['then'](removeEntity(_0x270478,null))[_0xe11d('0x43')](handleError(_0x270478,null));};exports[_0xe11d('0x51')]=function(_0x3a435a,_0x32d0a8,_0x3d4b29){var _0x5c11c3;return db[_0xe11d('0x2d')][_0xe11d('0x47')]({'where':{'id':_0x3a435a[_0xe11d('0x50')]['id']},'attributes':['id',_0xe11d('0x52')]})['then'](handleEntityNotFound(_0x32d0a8,null))['then'](function(_0x11d0f9){if(_0x11d0f9){var _0x5f1bcb=require(_0xe11d('0x53'))();_0x5f1bcb[_0xe11d('0x54')](_0x11d0f9['dsn']);_0x5f1bcb['closeSync']();return _0x11d0f9;}})['then'](respondWithResult(_0x32d0a8,null))[_0xe11d('0x43')](handleError(_0x32d0a8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5af854a..39b6a9e 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 _0xb592=['rimraf','../../config/environment','exports','SquareOdbc','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb592,0x136));var _0x2b59=function(_0xc56c46,_0x3fc792){_0xc56c46=_0xc56c46-0x0;var _0x2055d6=_0xb592[_0xc56c46];return _0x2055d6;};'use strict';var _=require(_0x2b59('0x0'));var util=require('util');var logger=require(_0x2b59('0x1'))('api');var moment=require(_0x2b59('0x2'));var BPromise=require(_0x2b59('0x3'));var rp=require(_0x2b59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b59('0x5'));var config=require(_0x2b59('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x2b59('0x7')]=function(_0xfca2f,_0x24ad71){return _0xfca2f['define'](_0x2b59('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ee2=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x5ee2,0x180));var _0x25ee=function(_0x2fc051,_0x5cca4c){_0x2fc051=_0x2fc051-0x0;var _0x1af0fd=_0x5ee2[_0x2fc051];return _0x1af0fd;};'use strict';var _=require(_0x25ee('0x0'));var util=require('util');var logger=require(_0x25ee('0x1'))(_0x25ee('0x2'));var moment=require('moment');var BPromise=require(_0x25ee('0x3'));var rp=require(_0x25ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ee('0x5'));var config=require(_0x25ee('0x6'));var attributes=require(_0x25ee('0x7'));module['exports']=function(_0x299b0a,_0x73c23a){return _0x299b0a[_0x25ee('0x8')](_0x25ee('0x9'),attributes,{'tableName':_0x25ee('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 17fcb00..d393b72 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 _0x341b=['SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SquareOdbc','options','raw','where','include','map','model','attributes','ShowSquareOdbc','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug'];(function(_0x9ece06,_0x4e3eec){var _0x4b0a41=function(_0x20f5f3){while(--_0x20f5f3){_0x9ece06['push'](_0x9ece06['shift']());}};_0x4b0a41(++_0x4e3eec);}(_0x341b,0x88));var _0xb341=function(_0x1c2d26,_0x2c119b){_0x1c2d26=_0x1c2d26-0x0;var _0x1d9a5e=_0x341b[_0x1c2d26];return _0x1d9a5e;};'use strict';var _=require(_0xb341('0x0'));var util=require('util');var moment=require(_0xb341('0x1'));var BPromise=require(_0xb341('0x2'));var rs=require(_0xb341('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb341('0x4'));var config=require(_0xb341('0x5'));var jayson=require(_0xb341('0x6'));var client=jayson[_0xb341('0x7')][_0xb341('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a108e,_0x3e5e79,_0x22aea7){return new BPromise(function(_0x37e87b,_0x5c01b4){return client[_0xb341('0x9')](_0x1a108e,_0x22aea7)[_0xb341('0xa')](function(_0x190e69){logger[_0xb341('0xb')](_0xb341('0xc'),_0x3e5e79,'request\x20sent');logger[_0xb341('0xd')](_0xb341('0xe'),_0x3e5e79,_0xb341('0xf'),JSON[_0xb341('0x10')](_0x190e69));if(_0x190e69[_0xb341('0x11')]){if(_0x190e69[_0xb341('0x11')][_0xb341('0x12')]===0x1f4){logger['error'](_0xb341('0xc'),_0x3e5e79,_0x190e69[_0xb341('0x11')][_0xb341('0x13')]);return _0x5c01b4(_0x190e69[_0xb341('0x11')][_0xb341('0x13')]);}logger['error'](_0xb341('0xc'),_0x3e5e79,_0x190e69[_0xb341('0x11')][_0xb341('0x13')]);return _0x37e87b(_0x190e69['error'][_0xb341('0x13')]);}else{logger[_0xb341('0xb')](_0xb341('0xc'),_0x3e5e79,_0xb341('0xf'));_0x37e87b(_0x190e69['result'][_0xb341('0x13')]);}})[_0xb341('0x14')](function(_0x364c94){logger[_0xb341('0x11')](_0xb341('0xc'),_0x3e5e79,_0x364c94);_0x5c01b4(_0x364c94);});});}exports['ShowSquareOdbc']=function(_0x5b851c){var _0x3e237f=this;return new Promise(function(_0x5aded4,_0xa270b){return db[_0xb341('0x15')]['find']({'raw':_0x5b851c['options']?_0x5b851c[_0xb341('0x16')][_0xb341('0x17')]===undefined?!![]:![]:!![],'where':_0x5b851c[_0xb341('0x16')]?_0x5b851c[_0xb341('0x16')][_0xb341('0x18')]||null:null,'attributes':_0x5b851c['options']?_0x5b851c['options']['attributes']||null:null,'include':_0x5b851c['options']?_0x5b851c[_0xb341('0x16')][_0xb341('0x19')]?_[_0xb341('0x1a')](_0x5b851c['options'][_0xb341('0x19')],function(_0x1636b0){return{'model':db[_0x1636b0[_0xb341('0x1b')]],'as':_0x1636b0['as'],'attributes':_0x1636b0['attributes'],'include':_0x1636b0[_0xb341('0x19')]?_[_0xb341('0x1a')](_0x1636b0[_0xb341('0x19')],function(_0x21b006){return{'model':db[_0x21b006[_0xb341('0x1b')]],'as':_0x21b006['as'],'attributes':_0x21b006[_0xb341('0x1c')],'include':_0x21b006['include']?_[_0xb341('0x1a')](_0x21b006[_0xb341('0x19')],function(_0x46b2f4){return{'model':db[_0x46b2f4[_0xb341('0x1b')]],'as':_0x46b2f4['as'],'attributes':_0x46b2f4[_0xb341('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb341('0xa')](function(_0x4dd2b3){logger[_0xb341('0xb')](_0xb341('0x1d'),_0x5b851c);logger[_0xb341('0xd')](_0xb341('0x1d'),_0x5b851c,JSON['stringify'](_0x4dd2b3));_0x5aded4(_0x4dd2b3);})[_0xb341('0x14')](function(_0x591336){logger[_0xb341('0x11')](_0xb341('0x1d'),_0x591336['message'],_0x5b851c);_0xa270b(_0x3e237f[_0xb341('0x11')](0x1f4,_0x591336[_0xb341('0x13')]));});});}; \ No newline at end of file +var _0xf54f=['jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','debug','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf54f,0x108));var _0xff54=function(_0x2e9e6c,_0x5f12d4){_0x2e9e6c=_0x2e9e6c-0x0;var _0x560cd0=_0xf54f[_0x2e9e6c];return _0x560cd0;};'use strict';var _=require(_0xff54('0x0'));var util=require('util');var moment=require(_0xff54('0x1'));var BPromise=require('bluebird');var rs=require(_0xff54('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff54('0x3'))['db'];var utils=require(_0xff54('0x4'));var logger=require(_0xff54('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xff54('0x6'));var client=jayson[_0xff54('0x7')][_0xff54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x200613,_0x4b794a,_0x980d8b){return new BPromise(function(_0x582c58,_0x3277ba){return client[_0xff54('0x9')](_0x200613,_0x980d8b)[_0xff54('0xa')](function(_0x338474){logger[_0xff54('0xb')](_0xff54('0xc'),_0x4b794a,'request\x20sent');logger['debug'](_0xff54('0xd'),_0x4b794a,'request\x20sent',JSON['stringify'](_0x338474));if(_0x338474[_0xff54('0xe')]){if(_0x338474[_0xff54('0xe')][_0xff54('0xf')]===0x1f4){logger[_0xff54('0xe')](_0xff54('0xc'),_0x4b794a,_0x338474[_0xff54('0xe')]['message']);return _0x3277ba(_0x338474[_0xff54('0xe')][_0xff54('0x10')]);}logger[_0xff54('0xe')](_0xff54('0xc'),_0x4b794a,_0x338474[_0xff54('0xe')]['message']);return _0x582c58(_0x338474[_0xff54('0xe')][_0xff54('0x10')]);}else{logger['info'](_0xff54('0xc'),_0x4b794a,_0xff54('0x11'));_0x582c58(_0x338474['result'][_0xff54('0x10')]);}})[_0xff54('0x12')](function(_0x1eefa8){logger[_0xff54('0xe')](_0xff54('0xc'),_0x4b794a,_0x1eefa8);_0x3277ba(_0x1eefa8);});});}exports[_0xff54('0x13')]=function(_0xddd6ac){var _0x1ed096=this;return new Promise(function(_0x30fcb4,_0x151dba){return db[_0xff54('0x14')]['find']({'raw':_0xddd6ac[_0xff54('0x15')]?_0xddd6ac['options'][_0xff54('0x16')]===undefined?!![]:![]:!![],'where':_0xddd6ac['options']?_0xddd6ac['options'][_0xff54('0x17')]||null:null,'attributes':_0xddd6ac[_0xff54('0x15')]?_0xddd6ac[_0xff54('0x15')][_0xff54('0x18')]||null:null,'include':_0xddd6ac[_0xff54('0x15')]?_0xddd6ac[_0xff54('0x15')][_0xff54('0x19')]?_[_0xff54('0x1a')](_0xddd6ac[_0xff54('0x15')][_0xff54('0x19')],function(_0x4d1daf){return{'model':db[_0x4d1daf['model']],'as':_0x4d1daf['as'],'attributes':_0x4d1daf[_0xff54('0x18')],'include':_0x4d1daf[_0xff54('0x19')]?_[_0xff54('0x1a')](_0x4d1daf[_0xff54('0x19')],function(_0xbdacc0){return{'model':db[_0xbdacc0[_0xff54('0x1b')]],'as':_0xbdacc0['as'],'attributes':_0xbdacc0['attributes'],'include':_0xbdacc0[_0xff54('0x19')]?_['map'](_0xbdacc0[_0xff54('0x19')],function(_0x5d13c1){return{'model':db[_0x5d13c1[_0xff54('0x1b')]],'as':_0x5d13c1['as'],'attributes':_0x5d13c1[_0xff54('0x18')]};}):[]};}):[]};}):[]:[]})[_0xff54('0xa')](function(_0x1f8ba0){logger[_0xff54('0xb')](_0xff54('0x13'),_0xddd6ac);logger[_0xff54('0x1c')](_0xff54('0x13'),_0xddd6ac,JSON[_0xff54('0x1d')](_0x1f8ba0));_0x30fcb4(_0x1f8ba0);})['catch'](function(_0x423c41){logger[_0xff54('0xe')](_0xff54('0x13'),_0x423c41[_0xff54('0x10')],_0xddd6ac);_0x151dba(_0x1ed096['error'](0x1f4,_0x423c41[_0xff54('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 053cd7c..22adf0f 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 _0xadec=['show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id'];(function(_0x291722,_0x407b93){var _0x2cb2f9=function(_0x5db64e){while(--_0x5db64e){_0x291722['push'](_0x291722['shift']());}};_0x2cb2f9(++_0x407b93);}(_0xadec,0x170));var _0xcade=function(_0x302aea,_0x16e445){_0x302aea=_0x302aea-0x0;var _0x3112be=_0xadec[_0x302aea];return _0x3112be;};'use strict';var multer=require('multer');var util=require(_0xcade('0x0'));var path=require(_0xcade('0x1'));var timeout=require(_0xcade('0x2'));var express=require(_0xcade('0x3'));var router=express[_0xcade('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcade('0x5'));var interaction=require(_0xcade('0x6'));var config=require('../../config/environment');var controller=require(_0xcade('0x7'));router[_0xcade('0x8')]('/',auth[_0xcade('0x9')](),controller[_0xcade('0xa')]);router[_0xcade('0x8')](_0xcade('0xb'),auth[_0xcade('0x9')](),controller[_0xcade('0xc')]);router[_0xcade('0xd')]('/',auth[_0xcade('0x9')](),controller[_0xcade('0xe')]);router['put'](_0xcade('0xb'),auth[_0xcade('0x9')](),controller[_0xcade('0xf')]);router[_0xcade('0x10')](_0xcade('0xb'),auth[_0xcade('0x9')](),controller[_0xcade('0x11')]);module[_0xcade('0x12')]=router; \ No newline at end of file +var _0xe37c=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1cb96f,_0x1f21ec){var _0x418399=function(_0x35979d){while(--_0x35979d){_0x1cb96f['push'](_0x1cb96f['shift']());}};_0x418399(++_0x1f21ec);}(_0xe37c,0x88));var _0xce37=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xe37c[_0x7791d5];return _0x5ce288;};'use strict';var multer=require(_0xce37('0x0'));var util=require(_0xce37('0x1'));var path=require(_0xce37('0x2'));var timeout=require(_0xce37('0x3'));var express=require(_0xce37('0x4'));var router=express[_0xce37('0x5')]();var fs_extra=require(_0xce37('0x6'));var auth=require(_0xce37('0x7'));var interaction=require(_0xce37('0x8'));var config=require(_0xce37('0x9'));var controller=require('./squareProject.controller');router[_0xce37('0xa')]('/',auth[_0xce37('0xb')](),controller['index']);router[_0xce37('0xa')]('/:id',auth[_0xce37('0xb')](),controller[_0xce37('0xc')]);router[_0xce37('0xd')]('/',auth[_0xce37('0xb')](),controller[_0xce37('0xe')]);router[_0xce37('0xf')](_0xce37('0x10'),auth['isAuthenticated'](),controller[_0xce37('0x11')]);router[_0xce37('0x12')](_0xce37('0x10'),auth[_0xce37('0xb')](),controller[_0xce37('0x13')]);module[_0xce37('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4feaee3..7b1d9d7 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 _0x9e29=['BLOB','production','utf8','DATE','sequelize','STRING','name','TEXT','long','getDataValue','toString'];(function(_0x233b65,_0x438922){var _0xcc12a0=function(_0x32280f){while(--_0x32280f){_0x233b65['push'](_0x233b65['shift']());}};_0xcc12a0(++_0x438922);}(_0x9e29,0xd5));var _0x99e2=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x9e29[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require(_0x99e2('0x0'));module['exports']={'name':{'type':Sequelize[_0x99e2('0x1')],'unique':_0x99e2('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x99e2('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x99e2('0x4')),'get':function(){if(this[_0x99e2('0x5')]('preproduction')){return this[_0x99e2('0x5')]('preproduction')[_0x99e2('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x99e2('0x7')](_0x99e2('0x4')),'get':function(){if(this[_0x99e2('0x5')](_0x99e2('0x8'))){return this[_0x99e2('0x5')](_0x99e2('0x8'))['toString'](_0x99e2('0x9'));}}},'savedAt':{'type':Sequelize[_0x99e2('0xa')]},'publishedAt':{'type':Sequelize[_0x99e2('0xa')]}}; \ No newline at end of file +var _0x8786=['STRING','TEXT','BLOB','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','exports'];(function(_0x10a71a,_0x578551){var _0x5e00c6=function(_0x1a3ada){while(--_0x1a3ada){_0x10a71a['push'](_0x10a71a['shift']());}};_0x5e00c6(++_0x578551);}(_0x8786,0x153));var _0x6878=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8786[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x6878('0x0'));module[_0x6878('0x1')]={'name':{'type':Sequelize[_0x6878('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6878('0x2')]},'notes':{'type':Sequelize[_0x6878('0x3')]},'preproduction':{'type':Sequelize[_0x6878('0x4')]('long'),'get':function(){if(this[_0x6878('0x5')](_0x6878('0x6'))){return this[_0x6878('0x5')](_0x6878('0x6'))['toString'](_0x6878('0x7'));}}},'production':{'type':Sequelize[_0x6878('0x4')]('long'),'get':function(){if(this[_0x6878('0x5')]('production')){return this[_0x6878('0x5')](_0x6878('0x8'))[_0x6878('0x9')](_0x6878('0x7'));}}},'savedAt':{'type':Sequelize[_0x6878('0xa')]},'publishedAt':{'type':Sequelize[_0x6878('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d39b8e0..6bc46aa 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 _0x3aea=['type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','agi','production','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','undefined','limit','count','Content-Range','json','update','then','get','SquareProjects','destroy','publish','stringify','error','stack','name','send','index','SquareProject','fieldName'];(function(_0x29ddaf,_0x57b3dc){var _0x48dc01=function(_0x3624c0){while(--_0x3624c0){_0x29ddaf['push'](_0x29ddaf['shift']());}};_0x48dc01(++_0x57b3dc);}(_0x3aea,0xf1));var _0xa3ae=function(_0x1fb497,_0x111cae){_0x1fb497=_0x1fb497-0x0;var _0x178a27=_0x3aea[_0x1fb497];return _0x178a27;};'use strict';var _=require('lodash');var Redis=require(_0xa3ae('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xa3ae('0x1'))(_0xa3ae('0x2'));var config=require(_0xa3ae('0x3'));var db=require(_0xa3ae('0x4'))['db'];config[_0xa3ae('0x5')]=_['defaults'](config[_0xa3ae('0x5')],{'host':_0xa3ae('0x6'),'port':0x18eb});var socket=require(_0xa3ae('0x7'))(new Redis(config['redis']));require(_0xa3ae('0x8'))[_0xa3ae('0x9')](socket);function respondWithResult(_0x4e6e0e,_0x29828a){_0x29828a=_0x29828a||0xc8;return function(_0x18b7b8){if(_0x18b7b8){return _0x4e6e0e[_0xa3ae('0xa')](_0x29828a)['json'](_0x18b7b8);}};}function respondWithFilteredResult(_0x553482,_0x5a26b0){return function(_0x363cf7){if(_0x363cf7){var _0x56b329=typeof _0x5a26b0[_0xa3ae('0xb')]===_0xa3ae('0xc')&&typeof _0x5a26b0[_0xa3ae('0xd')]===_0xa3ae('0xc');var _0x177794=_0x363cf7[_0xa3ae('0xe')];var _0x85088f=_0x56b329?0x0:_0x5a26b0[_0xa3ae('0xb')];var _0x1b9d1b=_0x56b329?_0x363cf7['count']:_0x5a26b0[_0xa3ae('0xb')]+_0x5a26b0[_0xa3ae('0xd')];var _0x4bd1bc;if(_0x1b9d1b>=_0x177794){_0x1b9d1b=_0x177794;_0x4bd1bc=0xc8;}else{_0x4bd1bc=0xce;}_0x553482[_0xa3ae('0xa')](_0x4bd1bc);return _0x553482['set'](_0xa3ae('0xf'),_0x85088f+'-'+_0x1b9d1b+'/'+_0x177794)[_0xa3ae('0x10')](_0x363cf7);}return null;};}function saveUpdates(_0x36a835){return function(_0x19f012){if(_0x19f012){return _0x19f012[_0xa3ae('0x11')](_0x36a835)['then'](function(_0x3046d4){return _0x3046d4;});}return null;};}function removeEntity(_0x3461c2){return function(_0x4731fb){if(_0x4731fb){return _0x4731fb['destroy']()[_0xa3ae('0x12')](function(){var _0x43dcf1=_0x4731fb[_0xa3ae('0x13')]({'plain':!![]});var _0x176a3a=_0xa3ae('0x14');return db['UserProfileResource'][_0xa3ae('0x15')]({'where':{'type':_0x176a3a,'resourceId':_0x43dcf1['id']}})['then'](function(){return _0x4731fb;});})[_0xa3ae('0x12')](function(){var _0xb7e9f2=new Redis(config[_0xa3ae('0x5')]);_0xb7e9f2[_0xa3ae('0x16')]('agi',JSON[_0xa3ae('0x17')]({'id':_0x4731fb['id'],'deleted':!![]}));})[_0xa3ae('0x12')](function(){_0x3461c2[_0xa3ae('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e32e6){return function(_0x2a3d46){if(!_0x2a3d46){_0x7e32e6['sendStatus'](0x194);}return _0x2a3d46;};}function handleError(_0x4b07d6,_0x297bb7){_0x297bb7=_0x297bb7||0x1f4;return function(_0x282cd6){logger[_0xa3ae('0x18')](_0x282cd6[_0xa3ae('0x19')]);if(_0x282cd6['name']){delete _0x282cd6[_0xa3ae('0x1a')];}_0x4b07d6['status'](_0x297bb7)[_0xa3ae('0x1b')](_0x282cd6);};}exports[_0xa3ae('0x1c')]=function(_0x546a4e,_0x37f688){var _0x2e208e={},_0x5d094b={},_0x628c58={'count':0x0,'rows':[]};var _0x283b38=_['map'](db[_0xa3ae('0x1d')]['rawAttributes'],function(_0x40c8a1){return{'name':_0x40c8a1[_0xa3ae('0x1e')],'type':_0x40c8a1[_0xa3ae('0x1f')][_0xa3ae('0x20')]};});_0x5d094b[_0xa3ae('0x21')]=_[_0xa3ae('0x22')](_0x283b38,'name');_0x5d094b[_0xa3ae('0x23')]=_[_0xa3ae('0x24')](_0x546a4e[_0xa3ae('0x23')]);_0x5d094b[_0xa3ae('0x25')]=_[_0xa3ae('0x26')](_0x5d094b[_0xa3ae('0x21')],_0x5d094b[_0xa3ae('0x23')]);_0x2e208e[_0xa3ae('0x27')]=_['intersection'](_0x5d094b[_0xa3ae('0x21')],qs[_0xa3ae('0x28')](_0x546a4e[_0xa3ae('0x23')][_0xa3ae('0x28')]));_0x2e208e[_0xa3ae('0x27')]=_0x2e208e[_0xa3ae('0x27')]['length']?_0x2e208e[_0xa3ae('0x27')]:_0x5d094b[_0xa3ae('0x21')];if(!_0x546a4e[_0xa3ae('0x23')][_0xa3ae('0x29')]('nolimit')){_0x2e208e[_0xa3ae('0xd')]=qs[_0xa3ae('0xd')](_0x546a4e[_0xa3ae('0x23')]['limit']);_0x2e208e[_0xa3ae('0xb')]=qs[_0xa3ae('0xb')](_0x546a4e[_0xa3ae('0x23')][_0xa3ae('0xb')]);}_0x2e208e[_0xa3ae('0x2a')]=qs['sort'](_0x546a4e[_0xa3ae('0x23')]['sort']);_0x2e208e[_0xa3ae('0x2b')]=qs[_0xa3ae('0x25')](_['pick'](_0x546a4e[_0xa3ae('0x23')],_0x5d094b['filters']),_0x283b38);if(_0x546a4e[_0xa3ae('0x23')][_0xa3ae('0x2c')]){_0x2e208e[_0xa3ae('0x2b')]=_[_0xa3ae('0x2d')](_0x2e208e[_0xa3ae('0x2b')],{'$or':_[_0xa3ae('0x22')](_0x283b38,function(_0x890760){if(_0x890760[_0xa3ae('0x1f')]!==_0xa3ae('0x2e')){var _0x1610e2={};_0x1610e2[_0x890760[_0xa3ae('0x1a')]]={'$like':'%'+_0x546a4e[_0xa3ae('0x23')][_0xa3ae('0x2c')]+'%'};return _0x1610e2;}})});}_0x2e208e=_[_0xa3ae('0x2d')]({},_0x2e208e,_0x546a4e[_0xa3ae('0x2f')]);var _0x3775ba={'where':_0x2e208e[_0xa3ae('0x2b')]};return db[_0xa3ae('0x1d')][_0xa3ae('0xe')](_0x3775ba)['then'](function(_0x3c0105){_0x628c58[_0xa3ae('0xe')]=_0x3c0105;if(_0x546a4e[_0xa3ae('0x23')][_0xa3ae('0x30')]){_0x2e208e[_0xa3ae('0x31')]=[{'all':!![]}];}return db['SquareProject'][_0xa3ae('0x32')](_0x2e208e);})['then'](function(_0x25ecb1){_0x628c58[_0xa3ae('0x33')]=_0x25ecb1;return _0x628c58;})[_0xa3ae('0x12')](respondWithFilteredResult(_0x37f688,_0x2e208e))['catch'](handleError(_0x37f688,null));};exports[_0xa3ae('0x34')]=function(_0x322069,_0x24d39d){var _0x367c39={'raw':![],'where':{'id':_0x322069[_0xa3ae('0x35')]['id']}},_0x130dd1={};_0x130dd1[_0xa3ae('0x21')]=_[_0xa3ae('0x24')](db['SquareProject'][_0xa3ae('0x36')]);_0x130dd1[_0xa3ae('0x23')]=_['keys'](_0x322069['query']);_0x130dd1['filters']=_[_0xa3ae('0x26')](_0x130dd1[_0xa3ae('0x21')],_0x130dd1[_0xa3ae('0x23')]);_0x367c39[_0xa3ae('0x27')]=_[_0xa3ae('0x26')](_0x130dd1[_0xa3ae('0x21')],qs['fields'](_0x322069['query']['fields']));_0x367c39[_0xa3ae('0x27')]=_0x367c39[_0xa3ae('0x27')][_0xa3ae('0x37')]?_0x367c39[_0xa3ae('0x27')]:_0x130dd1[_0xa3ae('0x21')];if(_0x322069['query']['includeAll']){_0x367c39[_0xa3ae('0x31')]=[{'all':!![]}];}_0x367c39=_[_0xa3ae('0x2d')]({},_0x367c39,_0x322069['options']);return db[_0xa3ae('0x1d')][_0xa3ae('0x38')](_0x367c39)[_0xa3ae('0x12')](handleEntityNotFound(_0x24d39d,null))[_0xa3ae('0x12')](respondWithResult(_0x24d39d,null))[_0xa3ae('0x39')](handleError(_0x24d39d,null));};exports['create']=function(_0x402cd5,_0x3b0d0f){return db[_0xa3ae('0x1d')][_0xa3ae('0x3a')](_0x402cd5['body'],{})[_0xa3ae('0x12')](function(_0x483c18){var _0xfd8d6d=_0x402cd5[_0xa3ae('0x3b')][_0xa3ae('0x13')]({'plain':!![]});if(!_0xfd8d6d)throw new Error(_0xa3ae('0x3c'));if(_0xfd8d6d['role']==='user'){var _0x55a083=_0x483c18['get']({'plain':!![]});var _0x1aec05=_0xa3ae('0x14');return db[_0xa3ae('0x3d')][_0xa3ae('0x38')]({'where':{'name':_0x1aec05,'userProfileId':_0xfd8d6d[_0xa3ae('0x3e')]},'raw':!![]})[_0xa3ae('0x12')](function(_0x5d8282){if(_0x5d8282&&_0x5d8282['autoAssociation']===0x0){return db[_0xa3ae('0x3f')]['create']({'name':_0x55a083[_0xa3ae('0x1a')],'resourceId':_0x55a083['id'],'type':_0x5d8282['name'],'sectionId':_0x5d8282['id']},{})[_0xa3ae('0x12')](function(){return _0x483c18;});}else{return _0x483c18;}})[_0xa3ae('0x39')](function(_0x510042){logger[_0xa3ae('0x18')](_0xa3ae('0x40'),_0x510042);throw _0x510042;});}return _0x483c18;})[_0xa3ae('0x12')](respondWithResult(_0x3b0d0f,0xc9))[_0xa3ae('0x39')](handleError(_0x3b0d0f,null));};exports[_0xa3ae('0x11')]=function(_0x4afd1e,_0x17df36){if(_0x4afd1e[_0xa3ae('0x41')]['id']){delete _0x4afd1e['body']['id'];}return db[_0xa3ae('0x1d')][_0xa3ae('0x38')]({'where':{'id':_0x4afd1e[_0xa3ae('0x35')]['id']}})['then'](handleEntityNotFound(_0x17df36,null))[_0xa3ae('0x12')](saveUpdates(_0x4afd1e[_0xa3ae('0x41')],null))[_0xa3ae('0x12')](function(_0x3b7205){if(!_0x3b7205)return;var _0x208424=_0x3b7205['get']({'plain':!![]});return _0x208424;})['then'](function(_0x3d944c){var _0x4b1ccf=new Redis(config[_0xa3ae('0x5')]);_0x4b1ccf[_0xa3ae('0x16')](_0xa3ae('0x42'),JSON[_0xa3ae('0x17')](_['pick'](_0x3d944c,['id',_0xa3ae('0x1a'),_0xa3ae('0x43')])));return _0x3d944c;})[_0xa3ae('0x12')](respondWithResult(_0x17df36,null))['catch'](handleError(_0x17df36,null));};exports[_0xa3ae('0x15')]=function(_0x2bbc32,_0xb9d601){return db[_0xa3ae('0x1d')][_0xa3ae('0x38')]({'where':{'id':_0x2bbc32[_0xa3ae('0x35')]['id']}})[_0xa3ae('0x12')](handleEntityNotFound(_0xb9d601,null))[_0xa3ae('0x12')](removeEntity(_0xb9d601,null))[_0xa3ae('0x39')](handleError(_0xb9d601,null));}; \ No newline at end of file +var _0x65cf=['filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','find','autoAssociation','UserProfileResource','publish','agi','production','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','stringify','end','error','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys'];(function(_0x38f3c0,_0x4d234a){var _0x2f086f=function(_0x2e9ea0){while(--_0x2e9ea0){_0x38f3c0['push'](_0x38f3c0['shift']());}};_0x2f086f(++_0x4d234a);}(_0x65cf,0x1a6));var _0xf65c=function(_0x87bfd1,_0x14ce47){_0x87bfd1=_0x87bfd1-0x0;var _0x26aa16=_0x65cf[_0x87bfd1];return _0x26aa16;};'use strict';var _=require(_0xf65c('0x0'));var Redis=require(_0xf65c('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf65c('0x2'));var config=require(_0xf65c('0x3'));var db=require(_0xf65c('0x4'))['db'];config[_0xf65c('0x5')]=_['defaults'](config[_0xf65c('0x5')],{'host':_0xf65c('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf65c('0x5')]));require(_0xf65c('0x7'))[_0xf65c('0x8')](socket);function respondWithResult(_0x44979b,_0x39245c){_0x39245c=_0x39245c||0xc8;return function(_0xd93006){if(_0xd93006){return _0x44979b[_0xf65c('0x9')](_0x39245c)['json'](_0xd93006);}};}function respondWithFilteredResult(_0x17c002,_0x407b0f){return function(_0x35d923){if(_0x35d923){var _0x3d531e=typeof _0x407b0f['offset']===_0xf65c('0xa')&&typeof _0x407b0f[_0xf65c('0xb')]===_0xf65c('0xa');var _0x475f91=_0x35d923[_0xf65c('0xc')];var _0xb70a1a=_0x3d531e?0x0:_0x407b0f[_0xf65c('0xd')];var _0x163ceb=_0x3d531e?_0x35d923[_0xf65c('0xc')]:_0x407b0f[_0xf65c('0xd')]+_0x407b0f[_0xf65c('0xb')];var _0x2d5535;if(_0x163ceb>=_0x475f91){_0x163ceb=_0x475f91;_0x2d5535=0xc8;}else{_0x2d5535=0xce;}_0x17c002[_0xf65c('0x9')](_0x2d5535);return _0x17c002[_0xf65c('0xe')](_0xf65c('0xf'),_0xb70a1a+'-'+_0x163ceb+'/'+_0x475f91)[_0xf65c('0x10')](_0x35d923);}return null;};}function saveUpdates(_0x28c814){return function(_0x1987db){if(_0x1987db){return _0x1987db[_0xf65c('0x11')](_0x28c814)[_0xf65c('0x12')](function(_0x3c311f){return _0x3c311f;});}return null;};}function removeEntity(_0x31041e){return function(_0x4a978a){if(_0x4a978a){return _0x4a978a[_0xf65c('0x13')]()[_0xf65c('0x12')](function(){var _0x492015=_0x4a978a['get']({'plain':!![]});var _0x3fc515='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x3fc515,'resourceId':_0x492015['id']}})[_0xf65c('0x12')](function(){return _0x4a978a;});})[_0xf65c('0x12')](function(){var _0x2794f7=new Redis(config['redis']);_0x2794f7['publish']('agi',JSON[_0xf65c('0x14')]({'id':_0x4a978a['id'],'deleted':!![]}));})[_0xf65c('0x12')](function(){_0x31041e['status'](0xcc)[_0xf65c('0x15')]();});}};}function handleEntityNotFound(_0x258444){return function(_0x48e78a){if(!_0x48e78a){_0x258444['sendStatus'](0x194);}return _0x48e78a;};}function handleError(_0x530966,_0x4a42a1){_0x4a42a1=_0x4a42a1||0x1f4;return function(_0x2ec1ee){logger[_0xf65c('0x16')](_0x2ec1ee['stack']);if(_0x2ec1ee[_0xf65c('0x17')]){delete _0x2ec1ee[_0xf65c('0x17')];}_0x530966['status'](_0x4a42a1)['send'](_0x2ec1ee);};}exports[_0xf65c('0x18')]=function(_0x307abc,_0x156ee9){var _0x3d7892={},_0x17c11d={},_0x2178e9={'count':0x0,'rows':[]};var _0x57eadd=_[_0xf65c('0x19')](db[_0xf65c('0x1a')][_0xf65c('0x1b')],function(_0x598077){return{'name':_0x598077[_0xf65c('0x1c')],'type':_0x598077[_0xf65c('0x1d')]['key']};});_0x17c11d[_0xf65c('0x1e')]=_[_0xf65c('0x19')](_0x57eadd,'name');_0x17c11d[_0xf65c('0x1f')]=_[_0xf65c('0x20')](_0x307abc['query']);_0x17c11d[_0xf65c('0x21')]=_[_0xf65c('0x22')](_0x17c11d[_0xf65c('0x1e')],_0x17c11d[_0xf65c('0x1f')]);_0x3d7892[_0xf65c('0x23')]=_['intersection'](_0x17c11d['model'],qs[_0xf65c('0x24')](_0x307abc[_0xf65c('0x1f')][_0xf65c('0x24')]));_0x3d7892[_0xf65c('0x23')]=_0x3d7892[_0xf65c('0x23')][_0xf65c('0x25')]?_0x3d7892[_0xf65c('0x23')]:_0x17c11d[_0xf65c('0x1e')];if(!_0x307abc[_0xf65c('0x1f')]['hasOwnProperty']('nolimit')){_0x3d7892['limit']=qs[_0xf65c('0xb')](_0x307abc[_0xf65c('0x1f')][_0xf65c('0xb')]);_0x3d7892[_0xf65c('0xd')]=qs['offset'](_0x307abc[_0xf65c('0x1f')][_0xf65c('0xd')]);}_0x3d7892[_0xf65c('0x26')]=qs[_0xf65c('0x27')](_0x307abc['query'][_0xf65c('0x27')]);_0x3d7892[_0xf65c('0x28')]=qs[_0xf65c('0x21')](_[_0xf65c('0x29')](_0x307abc['query'],_0x17c11d[_0xf65c('0x21')]),_0x57eadd);if(_0x307abc[_0xf65c('0x1f')][_0xf65c('0x2a')]){_0x3d7892[_0xf65c('0x28')]=_[_0xf65c('0x2b')](_0x3d7892[_0xf65c('0x28')],{'$or':_[_0xf65c('0x19')](_0x57eadd,function(_0x2f0bdd){if(_0x2f0bdd['type']!==_0xf65c('0x2c')){var _0x3f7b0c={};_0x3f7b0c[_0x2f0bdd['name']]={'$like':'%'+_0x307abc['query'][_0xf65c('0x2a')]+'%'};return _0x3f7b0c;}})});}_0x3d7892=_[_0xf65c('0x2b')]({},_0x3d7892,_0x307abc[_0xf65c('0x2d')]);var _0x4389c6={'where':_0x3d7892[_0xf65c('0x28')]};return db[_0xf65c('0x1a')][_0xf65c('0xc')](_0x4389c6)[_0xf65c('0x12')](function(_0x736198){_0x2178e9[_0xf65c('0xc')]=_0x736198;if(_0x307abc[_0xf65c('0x1f')][_0xf65c('0x2e')]){_0x3d7892['include']=[{'all':!![]}];}return db[_0xf65c('0x1a')][_0xf65c('0x2f')](_0x3d7892);})[_0xf65c('0x12')](function(_0x58aac9){_0x2178e9[_0xf65c('0x30')]=_0x58aac9;return _0x2178e9;})[_0xf65c('0x12')](respondWithFilteredResult(_0x156ee9,_0x3d7892))[_0xf65c('0x31')](handleError(_0x156ee9,null));};exports['show']=function(_0x18f659,_0x2af4cc){var _0x224f64={'raw':![],'where':{'id':_0x18f659[_0xf65c('0x32')]['id']}},_0x3a77a6={};_0x3a77a6[_0xf65c('0x1e')]=_[_0xf65c('0x20')](db[_0xf65c('0x1a')][_0xf65c('0x1b')]);_0x3a77a6[_0xf65c('0x1f')]=_[_0xf65c('0x20')](_0x18f659['query']);_0x3a77a6['filters']=_[_0xf65c('0x22')](_0x3a77a6[_0xf65c('0x1e')],_0x3a77a6[_0xf65c('0x1f')]);_0x224f64[_0xf65c('0x23')]=_[_0xf65c('0x22')](_0x3a77a6[_0xf65c('0x1e')],qs['fields'](_0x18f659[_0xf65c('0x1f')][_0xf65c('0x24')]));_0x224f64[_0xf65c('0x23')]=_0x224f64['attributes'][_0xf65c('0x25')]?_0x224f64[_0xf65c('0x23')]:_0x3a77a6[_0xf65c('0x1e')];if(_0x18f659[_0xf65c('0x1f')][_0xf65c('0x2e')]){_0x224f64[_0xf65c('0x33')]=[{'all':!![]}];}_0x224f64=_['merge']({},_0x224f64,_0x18f659[_0xf65c('0x2d')]);return db[_0xf65c('0x1a')]['find'](_0x224f64)[_0xf65c('0x12')](handleEntityNotFound(_0x2af4cc,null))['then'](respondWithResult(_0x2af4cc,null))[_0xf65c('0x31')](handleError(_0x2af4cc,null));};exports[_0xf65c('0x34')]=function(_0x358c2f,_0xa27579){return db[_0xf65c('0x1a')][_0xf65c('0x34')](_0x358c2f[_0xf65c('0x35')],{})[_0xf65c('0x12')](function(_0x4b9d88){var _0x44b86c=_0x358c2f[_0xf65c('0x36')][_0xf65c('0x37')]({'plain':!![]});if(!_0x44b86c)throw new Error(_0xf65c('0x38'));if(_0x44b86c[_0xf65c('0x39')]===_0xf65c('0x36')){var _0x23a4b7=_0x4b9d88[_0xf65c('0x37')]({'plain':!![]});var _0x4c126c=_0xf65c('0x3a');return db['UserProfileSection'][_0xf65c('0x3b')]({'where':{'name':_0x4c126c,'userProfileId':_0x44b86c['userProfileId']},'raw':!![]})[_0xf65c('0x12')](function(_0x2aa405){if(_0x2aa405&&_0x2aa405[_0xf65c('0x3c')]===0x0){return db[_0xf65c('0x3d')]['create']({'name':_0x23a4b7['name'],'resourceId':_0x23a4b7['id'],'type':_0x2aa405['name'],'sectionId':_0x2aa405['id']},{})[_0xf65c('0x12')](function(){return _0x4b9d88;});}else{return _0x4b9d88;}})[_0xf65c('0x31')](function(_0x244eab){logger[_0xf65c('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x244eab);throw _0x244eab;});}return _0x4b9d88;})['then'](respondWithResult(_0xa27579,0xc9))['catch'](handleError(_0xa27579,null));};exports[_0xf65c('0x11')]=function(_0x5d4477,_0x40a204){if(_0x5d4477['body']['id']){delete _0x5d4477['body']['id'];}return db[_0xf65c('0x1a')][_0xf65c('0x3b')]({'where':{'id':_0x5d4477['params']['id']}})['then'](handleEntityNotFound(_0x40a204,null))[_0xf65c('0x12')](saveUpdates(_0x5d4477['body'],null))[_0xf65c('0x12')](function(_0x2b8073){if(!_0x2b8073)return;var _0x41d614=_0x2b8073['get']({'plain':!![]});return _0x41d614;})[_0xf65c('0x12')](function(_0x291e44){var _0x4993ae=new Redis(config[_0xf65c('0x5')]);_0x4993ae[_0xf65c('0x3e')](_0xf65c('0x3f'),JSON['stringify'](_[_0xf65c('0x29')](_0x291e44,['id',_0xf65c('0x17'),_0xf65c('0x40')])));return _0x291e44;})['then'](respondWithResult(_0x40a204,null))[_0xf65c('0x31')](handleError(_0x40a204,null));};exports[_0xf65c('0x13')]=function(_0xced29c,_0x2f79b5){return db[_0xf65c('0x1a')]['find']({'where':{'id':_0xced29c[_0xf65c('0x32')]['id']}})[_0xf65c('0x12')](handleEntityNotFound(_0x2f79b5,null))[_0xf65c('0x12')](removeEntity(_0x2f79b5,null))[_0xf65c('0x31')](handleError(_0x2f79b5,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3a99f3c..f345b42 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 _0x2a6c=['hasOwnProperty','hook','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x7e9f94,_0x32e5b9){var _0x39e424=function(_0x400768){while(--_0x400768){_0x7e9f94['push'](_0x7e9f94['shift']());}};_0x39e424(++_0x32e5b9);}(_0x2a6c,0x1bb));var _0xc2a6=function(_0x4fbfb8,_0x381238){_0x4fbfb8=_0x4fbfb8-0x0;var _0x5b43ad=_0x2a6c[_0x4fbfb8];return _0x5b43ad;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xc2a6('0x0'))['db'][_0xc2a6('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc2a6('0x2')](0x0);var events={'afterCreate':_0xc2a6('0x3'),'afterUpdate':_0xc2a6('0x4'),'afterDestroy':_0xc2a6('0x5')};function emitEvent(_0x4b36a7){return function(_0x46bf45,_0x38ab8c,_0x188def){SquareProjectEvents[_0xc2a6('0x6')](_0x4b36a7+':'+_0x46bf45['id'],_0x46bf45);SquareProjectEvents[_0xc2a6('0x6')](_0x4b36a7,_0x46bf45);_0x188def(null);};}for(var e in events){if(events[_0xc2a6('0x7')](e)){var event=events[e];SquareProject[_0xc2a6('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x3171=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','remove'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x3171,0x7c));var _0x1317=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x3171[_0x1ccbcc];return _0x1e873f;};'use strict';var EventEmitter=require(_0x1317('0x0'));var SquareProject=require(_0x1317('0x1'))['db'][_0x1317('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1317('0x3')](0x0);var events={'afterCreate':_0x1317('0x4'),'afterUpdate':'update','afterDestroy':_0x1317('0x5')};function emitEvent(_0x2bb9a4){return function(_0x1b68ae,_0x11e932,_0x2f7d9d){SquareProjectEvents[_0x1317('0x6')](_0x2bb9a4+':'+_0x1b68ae['id'],_0x1b68ae);SquareProjectEvents[_0x1317('0x6')](_0x2bb9a4,_0x1b68ae);_0x2f7d9d(null);};}for(var e in events){if(events[_0x1317('0x7')](e)){var event=events[e];SquareProject[_0x1317('0x8')](e,emitEvent(event));}}module[_0x1317('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 10eace7..4d9e3c4 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 _0x60e7=['./squareProject.attributes','exports','square_projects','changed','preproduction','savedAt','production','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x60e7,0xe1));var _0x760e=function(_0x333195,_0x366608){_0x333195=_0x333195-0x0;var _0x2e44de=_0x60e7[_0x333195];return _0x2e44de;};'use strict';var _=require(_0x760e('0x0'));var util=require(_0x760e('0x1'));var logger=require(_0x760e('0x2'))(_0x760e('0x3'));var moment=require(_0x760e('0x4'));var BPromise=require(_0x760e('0x5'));var rp=require(_0x760e('0x6'));var fs=require('fs');var path=require(_0x760e('0x7'));var rimraf=require(_0x760e('0x8'));var config=require('../../config/environment');var attributes=require(_0x760e('0x9'));module[_0x760e('0xa')]=function(_0x845439,_0x24268c){return _0x845439['define']('SquareProject',attributes,{'tableName':_0x760e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11739b,_0x466270,_0x259499){if(_0x11739b[_0x760e('0xc')](_0x760e('0xd'))){_0x11739b[_0x760e('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x11739b['changed'](_0x760e('0xf'))){_0x11739b['publishedAt']=moment()[_0x760e('0x10')](_0x760e('0x11'));}_0x259499(null,_0x11739b);}}});}; \ No newline at end of file +var _0x2f38=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x2f38,0x1b0));var _0x82f3=function(_0x34ca54,_0x251d16){_0x34ca54=_0x34ca54-0x0;var _0x153a5e=_0x2f38[_0x34ca54];return _0x153a5e;};'use strict';var _=require(_0x82f3('0x0'));var util=require(_0x82f3('0x1'));var logger=require(_0x82f3('0x2'))(_0x82f3('0x3'));var moment=require('moment');var BPromise=require(_0x82f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f3('0x5'));var rimraf=require(_0x82f3('0x6'));var config=require(_0x82f3('0x7'));var attributes=require(_0x82f3('0x8'));module['exports']=function(_0x4bac95,_0x22e982){return _0x4bac95[_0x82f3('0x9')]('SquareProject',attributes,{'tableName':_0x82f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe4f58d,_0x56e7ca,_0x336a6e){if(_0xe4f58d[_0x82f3('0xb')](_0x82f3('0xc'))){_0xe4f58d[_0x82f3('0xd')]=moment()[_0x82f3('0xe')](_0x82f3('0xf'));}if(_0xe4f58d[_0x82f3('0xb')](_0x82f3('0x10'))){_0xe4f58d[_0x82f3('0x11')]=moment()[_0x82f3('0xe')](_0x82f3('0xf'));}_0x336a6e(null,_0xe4f58d);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index ea121e3..81027c2 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 _0xc2f5=['defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','error','message','find','info','debug','ShowSquareProject','catch','lodash','ioredis','rpc','redis'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0xc2f5,0x6c));var _0x5c2f=function(_0x5da12a,_0x5dc184){_0x5da12a=_0x5da12a-0x0;var _0x59645e=_0xc2f5[_0x5da12a];return _0x59645e;};'use strict';var _=require(_0x5c2f('0x0'));var Redis=require(_0x5c2f('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x5c2f('0x2'));var config=require('../../config/environment');config[_0x5c2f('0x3')]=_[_0x5c2f('0x4')](config[_0x5c2f('0x3')],{'host':_0x5c2f('0x5'),'port':0x18eb});var socket=require(_0x5c2f('0x6'))(new Redis(config[_0x5c2f('0x3')]));require(_0x5c2f('0x7'))[_0x5c2f('0x8')](socket);exports[_0x5c2f('0x9')]=function(_0x41a094){var _0x394ac9=this;return new Promise(function(_0x246b09,_0x219b52){return db['SquareProject'][_0x5c2f('0xa')]({'raw':_0x41a094[_0x5c2f('0xb')]?_0x41a094[_0x5c2f('0xb')][_0x5c2f('0xc')]===undefined?!![]:![]:!![],'where':_0x41a094[_0x5c2f('0xb')]?_0x41a094[_0x5c2f('0xb')][_0x5c2f('0xd')]||null:null,'attributes':_0x41a094[_0x5c2f('0xb')]?_0x41a094[_0x5c2f('0xb')][_0x5c2f('0xe')]||null:null,'limit':_0x41a094['options']?_0x41a094[_0x5c2f('0xb')][_0x5c2f('0xf')]||null:null,'include':_0x41a094[_0x5c2f('0xb')]?_0x41a094[_0x5c2f('0xb')][_0x5c2f('0x10')]?_[_0x5c2f('0x11')](_0x41a094[_0x5c2f('0xb')]['include'],function(_0xb67ac){return{'model':db[_0xb67ac[_0x5c2f('0x12')]],'as':_0xb67ac['as'],'attributes':_0xb67ac['attributes'],'include':_0xb67ac[_0x5c2f('0x10')]?_[_0x5c2f('0x11')](_0xb67ac[_0x5c2f('0x10')],function(_0x22f740){return{'model':db[_0x22f740['model']],'as':_0x22f740['as'],'attributes':_0x22f740[_0x5c2f('0xe')],'include':_0x22f740[_0x5c2f('0x10')]?_['map'](_0x22f740[_0x5c2f('0x10')],function(_0x2cf247){return{'model':db[_0x2cf247[_0x5c2f('0x12')]],'as':_0x2cf247['as'],'attributes':_0x2cf247[_0x5c2f('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5c2f('0x13')](function(_0x4f08bc){logger['info'](_0x5c2f('0x9'),_0x41a094);logger['debug'](_0x5c2f('0x9'),_0x41a094,JSON[_0x5c2f('0x14')](_0x4f08bc));_0x246b09(_0x4f08bc);})['catch'](function(_0x12dfff){logger[_0x5c2f('0x15')](_0x5c2f('0x9'),_0x12dfff[_0x5c2f('0x16')],_0x41a094);_0x219b52(_0x394ac9[_0x5c2f('0x15')](0x1f4,_0x12dfff[_0x5c2f('0x16')]));});});};exports['ShowSquareProject']=function(_0x4a5e66){var _0xd84fe=this;return new Promise(function(_0x5bf6b1,_0xe9429){return db['SquareProject'][_0x5c2f('0x17')]({'raw':_0x4a5e66[_0x5c2f('0xb')]?_0x4a5e66['options'][_0x5c2f('0xc')]===undefined?!![]:![]:!![],'where':_0x4a5e66[_0x5c2f('0xb')]?_0x4a5e66[_0x5c2f('0xb')]['where']||null:null,'attributes':_0x4a5e66[_0x5c2f('0xb')]?_0x4a5e66[_0x5c2f('0xb')]['attributes']||null:null,'include':_0x4a5e66[_0x5c2f('0xb')]?_0x4a5e66[_0x5c2f('0xb')][_0x5c2f('0x10')]?_[_0x5c2f('0x11')](_0x4a5e66[_0x5c2f('0xb')]['include'],function(_0x494f71){return{'model':db[_0x494f71[_0x5c2f('0x12')]],'as':_0x494f71['as'],'attributes':_0x494f71[_0x5c2f('0xe')],'include':_0x494f71['include']?_['map'](_0x494f71[_0x5c2f('0x10')],function(_0x293d3b){return{'model':db[_0x293d3b[_0x5c2f('0x12')]],'as':_0x293d3b['as'],'attributes':_0x293d3b[_0x5c2f('0xe')],'include':_0x293d3b[_0x5c2f('0x10')]?_['map'](_0x293d3b[_0x5c2f('0x10')],function(_0x36381c){return{'model':db[_0x36381c[_0x5c2f('0x12')]],'as':_0x36381c['as'],'attributes':_0x36381c[_0x5c2f('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56ed65){logger[_0x5c2f('0x18')]('ShowSquareProject',_0x4a5e66);logger[_0x5c2f('0x19')](_0x5c2f('0x1a'),_0x4a5e66,JSON[_0x5c2f('0x14')](_0x56ed65));_0x5bf6b1(_0x56ed65);})[_0x5c2f('0x1b')](function(_0x302070){logger['error'](_0x5c2f('0x1a'),_0x302070[_0x5c2f('0x16')],_0x4a5e66);_0xe9429(_0xd84fe[_0x5c2f('0x15')](0x1f4,_0x302070[_0x5c2f('0x16')]));});});}; \ No newline at end of file +var _0x8240=['../../config/logger','rpc','defaults','localhost','socket.io-emitter','redis','register','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','then','../../mysqldb'];(function(_0x36a39c,_0x5c9dea){var _0x7ff16=function(_0x3d3b7d){while(--_0x3d3b7d){_0x36a39c['push'](_0x36a39c['shift']());}};_0x7ff16(++_0x5c9dea);}(_0x8240,0x11d));var _0x0824=function(_0x2de0ab,_0x353746){_0x2de0ab=_0x2de0ab-0x0;var _0x7f8af9=_0x8240[_0x2de0ab];return _0x7f8af9;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x0824('0x0'))['db'];var logger=require(_0x0824('0x1'))(_0x0824('0x2'));var config=require('../../config/environment');config['redis']=_[_0x0824('0x3')](config['redis'],{'host':_0x0824('0x4'),'port':0x18eb});var socket=require(_0x0824('0x5'))(new Redis(config[_0x0824('0x6')]));require('./squareProject.socket')[_0x0824('0x7')](socket);exports['GetSquareProjects']=function(_0x5c9fcd){var _0x47318e=this;return new Promise(function(_0x12f29e,_0x2defa5){return db[_0x0824('0x8')][_0x0824('0x9')]({'raw':_0x5c9fcd[_0x0824('0xa')]?_0x5c9fcd[_0x0824('0xa')][_0x0824('0xb')]===undefined?!![]:![]:!![],'where':_0x5c9fcd['options']?_0x5c9fcd['options'][_0x0824('0xc')]||null:null,'attributes':_0x5c9fcd['options']?_0x5c9fcd[_0x0824('0xa')][_0x0824('0xd')]||null:null,'limit':_0x5c9fcd[_0x0824('0xa')]?_0x5c9fcd[_0x0824('0xa')][_0x0824('0xe')]||null:null,'include':_0x5c9fcd['options']?_0x5c9fcd[_0x0824('0xa')]['include']?_['map'](_0x5c9fcd[_0x0824('0xa')][_0x0824('0xf')],function(_0x25619c){return{'model':db[_0x25619c[_0x0824('0x10')]],'as':_0x25619c['as'],'attributes':_0x25619c[_0x0824('0xd')],'include':_0x25619c[_0x0824('0xf')]?_[_0x0824('0x11')](_0x25619c['include'],function(_0x3c95ac){return{'model':db[_0x3c95ac['model']],'as':_0x3c95ac['as'],'attributes':_0x3c95ac[_0x0824('0xd')],'include':_0x3c95ac[_0x0824('0xf')]?_[_0x0824('0x11')](_0x3c95ac['include'],function(_0x4f860a){return{'model':db[_0x4f860a[_0x0824('0x10')]],'as':_0x4f860a['as'],'attributes':_0x4f860a[_0x0824('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ff95b){logger['info'](_0x0824('0x12'),_0x5c9fcd);logger[_0x0824('0x13')]('GetSquareProjects',_0x5c9fcd,JSON[_0x0824('0x14')](_0x4ff95b));_0x12f29e(_0x4ff95b);})[_0x0824('0x15')](function(_0x3a403f){logger[_0x0824('0x16')](_0x0824('0x12'),_0x3a403f[_0x0824('0x17')],_0x5c9fcd);_0x2defa5(_0x47318e['error'](0x1f4,_0x3a403f[_0x0824('0x17')]));});});};exports[_0x0824('0x18')]=function(_0x3de2f1){var _0x1140e5=this;return new Promise(function(_0x19e350,_0xc991f1){return db[_0x0824('0x8')]['find']({'raw':_0x3de2f1[_0x0824('0xa')]?_0x3de2f1['options'][_0x0824('0xb')]===undefined?!![]:![]:!![],'where':_0x3de2f1[_0x0824('0xa')]?_0x3de2f1[_0x0824('0xa')][_0x0824('0xc')]||null:null,'attributes':_0x3de2f1[_0x0824('0xa')]?_0x3de2f1[_0x0824('0xa')][_0x0824('0xd')]||null:null,'include':_0x3de2f1['options']?_0x3de2f1[_0x0824('0xa')]['include']?_[_0x0824('0x11')](_0x3de2f1['options'][_0x0824('0xf')],function(_0x5998b1){return{'model':db[_0x5998b1['model']],'as':_0x5998b1['as'],'attributes':_0x5998b1[_0x0824('0xd')],'include':_0x5998b1['include']?_['map'](_0x5998b1['include'],function(_0x2bdc37){return{'model':db[_0x2bdc37[_0x0824('0x10')]],'as':_0x2bdc37['as'],'attributes':_0x2bdc37['attributes'],'include':_0x2bdc37['include']?_[_0x0824('0x11')](_0x2bdc37[_0x0824('0xf')],function(_0x406a71){return{'model':db[_0x406a71[_0x0824('0x10')]],'as':_0x406a71['as'],'attributes':_0x406a71[_0x0824('0xd')]};}):[]};}):[]};}):[]:[]})[_0x0824('0x19')](function(_0x474341){logger['info'](_0x0824('0x18'),_0x3de2f1);logger[_0x0824('0x13')](_0x0824('0x18'),_0x3de2f1,JSON[_0x0824('0x14')](_0x474341));_0x19e350(_0x474341);})[_0x0824('0x15')](function(_0x400e3a){logger[_0x0824('0x16')]('ShowSquareProject',_0x400e3a[_0x0824('0x17')],_0x3de2f1);_0xc991f1(_0x1140e5[_0x0824('0x16')](0x1f4,_0x400e3a[_0x0824('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 673cae8..4e02a3e 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 _0xeb34=['removeListener','register','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x17e667,_0x1e6019){var _0x49c33d=function(_0x2649d3){while(--_0x2649d3){_0x17e667['push'](_0x17e667['shift']());}};_0x49c33d(++_0x1e6019);}(_0xeb34,0x1db));var _0x4eb3=function(_0x28c4db,_0x2ccd05){_0x28c4db=_0x28c4db-0x0;var _0x5907ed=_0xeb34[_0x28c4db];return _0x5907ed;};'use strict';var SquareProjectEvents=require(_0x4eb3('0x0'));var events=[_0x4eb3('0x1'),_0x4eb3('0x2'),_0x4eb3('0x3')];function createListener(_0x3a358d,_0x4dc684){return function(_0x55da72){_0x4dc684[_0x4eb3('0x4')](_0x3a358d,_0x55da72);};}function removeListener(_0x4286b8,_0xc5e308){return function(){SquareProjectEvents[_0x4eb3('0x5')](_0x4286b8,_0xc5e308);};}exports[_0x4eb3('0x6')]=function(_0xb1ae0c){for(var _0x2dbb74=0x0,_0x2a02f9=events['length'];_0x2dbb74<_0x2a02f9;_0x2dbb74++){var _0x13b8b1=events[_0x2dbb74];var _0x1f72fc=createListener(_0x4eb3('0x7')+_0x13b8b1,_0xb1ae0c);SquareProjectEvents['on'](_0x13b8b1,_0x1f72fc);}}; \ No newline at end of file +var _0x9d01=['./squareProject.events','save','length','squareProject:'];(function(_0x453cc2,_0x1be9fc){var _0x4a499b=function(_0x22929f){while(--_0x22929f){_0x453cc2['push'](_0x453cc2['shift']());}};_0x4a499b(++_0x1be9fc);}(_0x9d01,0x19c));var _0x19d0=function(_0x11cc3c,_0x3d7dcf){_0x11cc3c=_0x11cc3c-0x0;var _0x4b3627=_0x9d01[_0x11cc3c];return _0x4b3627;};'use strict';var SquareProjectEvents=require(_0x19d0('0x0'));var events=[_0x19d0('0x1'),'remove','update'];function createListener(_0x19da90,_0x3409cc){return function(_0x44730b){_0x3409cc['emit'](_0x19da90,_0x44730b);};}function removeListener(_0x2590c2,_0x4bb126){return function(){SquareProjectEvents['removeListener'](_0x2590c2,_0x4bb126);};}exports['register']=function(_0x21f35b){for(var _0x5ae4f9=0x0,_0x1dfa88=events[_0x19d0('0x2')];_0x5ae4f9<_0x1dfa88;_0x5ae4f9++){var _0x59e199=events[_0x5ae4f9];var _0x9d993f=createListener(_0x19d0('0x3')+_0x59e199,_0x21f35b);SquareProjectEvents['on'](_0x59e199,_0x9d993f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fd1963d..06a0bcb 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x26d133,_0x133b7b){var _0x391d58=function(_0x362d3f){while(--_0x362d3f){_0x26d133['push'](_0x26d133['shift']());}};_0x391d58(++_0x133b7b);}(_0x5fab,0x177));var _0xb5fa=function(_0x5bd103,_0x3b8037){_0x5bd103=_0x5bd103-0x0;var _0xc33b64=_0x5fab[_0x5bd103];return _0xc33b64;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x52937e,_0x51b2c4){var _0x196172=function(_0x4616ce){while(--_0x4616ce){_0x52937e['push'](_0x52937e['shift']());}};_0x196172(++_0x51b2c4);}(_0x326f,0xd1));var _0xf326=function(_0x58d33e,_0x20eaa9){_0x58d33e=_0x58d33e-0x0;var _0x5569e4=_0x326f[_0x58d33e];return _0x5569e4;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ea0d386..5d891fe 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 _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x4cfaf6,_0x4a1c09){var _0x334077=function(_0x57c02e){while(--_0x57c02e){_0x4cfaf6['push'](_0x4cfaf6['shift']());}};_0x334077(++_0x4a1c09);}(_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')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file +var _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x2414cc,_0x5bd321){var _0x292184=function(_0x5c0361){while(--_0x5c0361){_0x2414cc['push'](_0x2414cc['shift']());}};_0x292184(++_0x5bd321);}(_0x81bd,0x7c));var _0xd81b=function(_0x3e2789,_0x6d23c6){_0x3e2789=_0x3e2789-0x0;var _0x4371ba=_0x81bd[_0x3e2789];return _0x4371ba;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c1241b4..a9e74a7 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 _0x38d2=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','show','params','find','catch','create','body','download','uniqueid','savePath','filename','format','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format'];(function(_0x280f1f,_0xacadb7){var _0x538510=function(_0x2e55ab){while(--_0x2e55ab){_0x280f1f['push'](_0x280f1f['shift']());}};_0x538510(++_0xacadb7);}(_0x38d2,0x177));var _0x238d=function(_0x582f3f,_0x2c5dc9){_0x582f3f=_0x582f3f-0x0;var _0x4573b0=_0x38d2[_0x582f3f];return _0x4573b0;};'use strict';var emlformat=require(_0x238d('0x0'));var rimraf=require(_0x238d('0x1'));var zipdir=require(_0x238d('0x2'));var jsonpatch=require(_0x238d('0x3'));var rp=require(_0x238d('0x4'));var moment=require(_0x238d('0x5'));var BPromise=require(_0x238d('0x6'));var Mustache=require(_0x238d('0x7'));var util=require(_0x238d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x238d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x238d('0xa'));var _=require(_0x238d('0xb'));var squel=require(_0x238d('0xc'));var crypto=require(_0x238d('0xd'));var jsforce=require(_0x238d('0xe'));var deskjs=require(_0x238d('0xf'));var toCsv=require(_0x238d('0x9'));var querystring=require(_0x238d('0x10'));var Papa=require(_0x238d('0x11'));var Redis=require(_0x238d('0x12'));var authService=require(_0x238d('0x13'));var qs=require(_0x238d('0x14'));var as=require(_0x238d('0x15'));var hardwareService=require(_0x238d('0x16'));var logger=require(_0x238d('0x17'))(_0x238d('0x18'));var utils=require(_0x238d('0x19'));var config=require(_0x238d('0x1a'));var licenseUtil=require(_0x238d('0x1b'));var db=require(_0x238d('0x1c'))['db'];function respondWithStatusCode(_0x38fe2a,_0x145b91){_0x145b91=_0x145b91||0xcc;return function(_0x19f493){if(_0x19f493){return _0x38fe2a['sendStatus'](_0x145b91);}return _0x38fe2a[_0x238d('0x1d')](_0x145b91)[_0x238d('0x1e')]();};}function respondWithResult(_0x3709c7,_0x1c675e){_0x1c675e=_0x1c675e||0xc8;return function(_0x41d266){if(_0x41d266){return _0x3709c7[_0x238d('0x1d')](_0x1c675e)['json'](_0x41d266);}};}function respondWithFilteredResult(_0xefd18a,_0x578c4f){return function(_0x8c5c13){if(_0x8c5c13){var _0x47a36b=typeof _0x578c4f[_0x238d('0x1f')]==='undefined'&&typeof _0x578c4f['limit']===_0x238d('0x20');var _0x3efdda=_0x8c5c13[_0x238d('0x21')];var _0x4bbf12=_0x47a36b?0x0:_0x578c4f[_0x238d('0x1f')];var _0x40a01a=_0x47a36b?_0x8c5c13[_0x238d('0x21')]:_0x578c4f['offset']+_0x578c4f['limit'];var _0x2c68f1;if(_0x40a01a>=_0x3efdda){_0x40a01a=_0x3efdda;_0x2c68f1=0xc8;}else{_0x2c68f1=0xce;}_0xefd18a[_0x238d('0x1d')](_0x2c68f1);return _0xefd18a[_0x238d('0x22')](_0x238d('0x23'),_0x4bbf12+'-'+_0x40a01a+'/'+_0x3efdda)['json'](_0x8c5c13);}return null;};}function patchUpdates(_0x1eb43d){return function(_0x4f3f56){try{jsonpatch['apply'](_0x4f3f56,_0x1eb43d,!![]);}catch(_0x32efbb){return BPromise['reject'](_0x32efbb);}return _0x4f3f56[_0x238d('0x24')]();};}function saveUpdates(_0x1a6806,_0x5398c7){return function(_0x282b12){if(_0x282b12){return _0x282b12[_0x238d('0x25')](_0x1a6806)[_0x238d('0x26')](function(_0x3c8a5c){return _0x3c8a5c;});}return null;};}function removeEntity(_0x32688d,_0x486991){return function(_0x10af33){if(_0x10af33){return _0x10af33[_0x238d('0x27')]()[_0x238d('0x26')](function(){_0x32688d[_0x238d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x927c78,_0x53b30b){return function(_0x863a10){if(!_0x863a10){_0x927c78[_0x238d('0x28')](0x194);}return _0x863a10;};}function handleError(_0x2af762,_0x57be2c){_0x57be2c=_0x57be2c||0x1f4;return function(_0x52d4e0){logger['error'](_0x52d4e0[_0x238d('0x29')]);if(_0x52d4e0[_0x238d('0x2a')]){delete _0x52d4e0[_0x238d('0x2a')];}_0x2af762[_0x238d('0x1d')](_0x57be2c)['send'](_0x52d4e0);};}exports['index']=function(_0x3361d4,_0x508c5d){var _0x423e4e={},_0x44e17a={},_0x23ac2a={'count':0x0,'rows':[]};var _0x15bfd5=_[_0x238d('0x2b')](db['SquareRecording']['rawAttributes'],function(_0x2341c5){return{'name':_0x2341c5[_0x238d('0x2c')],'type':_0x2341c5[_0x238d('0x2d')][_0x238d('0x2e')]};});_0x44e17a[_0x238d('0x2f')]=_[_0x238d('0x2b')](_0x15bfd5,_0x238d('0x2a'));_0x44e17a[_0x238d('0x30')]=_[_0x238d('0x31')](_0x3361d4[_0x238d('0x30')]);_0x44e17a[_0x238d('0x32')]=_[_0x238d('0x33')](_0x44e17a[_0x238d('0x2f')],_0x44e17a[_0x238d('0x30')]);_0x423e4e['attributes']=_[_0x238d('0x33')](_0x44e17a[_0x238d('0x2f')],qs[_0x238d('0x34')](_0x3361d4[_0x238d('0x30')][_0x238d('0x34')]));_0x423e4e[_0x238d('0x35')]=_0x423e4e[_0x238d('0x35')][_0x238d('0x36')]?_0x423e4e[_0x238d('0x35')]:_0x44e17a[_0x238d('0x2f')];if(!_0x3361d4[_0x238d('0x30')][_0x238d('0x37')](_0x238d('0x38'))){_0x423e4e[_0x238d('0x39')]=qs['limit'](_0x3361d4[_0x238d('0x30')][_0x238d('0x39')]);_0x423e4e['offset']=qs[_0x238d('0x1f')](_0x3361d4[_0x238d('0x30')][_0x238d('0x1f')]);}_0x423e4e['order']=qs[_0x238d('0x3a')](_0x3361d4[_0x238d('0x30')][_0x238d('0x3a')]);_0x423e4e[_0x238d('0x3b')]=qs[_0x238d('0x32')](_[_0x238d('0x3c')](_0x3361d4['query'],_0x44e17a[_0x238d('0x32')]),_0x15bfd5);if(_0x3361d4['query'][_0x238d('0x3d')]){_0x423e4e[_0x238d('0x3b')]=_[_0x238d('0x3e')](_0x423e4e[_0x238d('0x3b')],{'$or':_[_0x238d('0x2b')](_0x15bfd5,function(_0x3ab324){if(_0x3ab324[_0x238d('0x2d')]!==_0x238d('0x3f')){var _0x4429be={};_0x4429be[_0x3ab324['name']]={'$like':'%'+_0x3361d4[_0x238d('0x30')][_0x238d('0x3d')]+'%'};return _0x4429be;}})});}_0x423e4e=_[_0x238d('0x3e')]({},_0x423e4e,_0x3361d4[_0x238d('0x40')]);var _0x10b02a={'where':_0x423e4e['where']};return db[_0x238d('0x41')]['count'](_0x10b02a)[_0x238d('0x26')](function(_0x56c0c3){_0x23ac2a[_0x238d('0x21')]=_0x56c0c3;if(_0x3361d4[_0x238d('0x30')][_0x238d('0x42')]){_0x423e4e[_0x238d('0x43')]=[{'all':!![]}];}return db[_0x238d('0x41')][_0x238d('0x44')](_0x423e4e);})[_0x238d('0x26')](function(_0x58d045){_0x23ac2a['rows']=_0x58d045;return _0x23ac2a;})[_0x238d('0x26')](respondWithFilteredResult(_0x508c5d,_0x423e4e))['catch'](handleError(_0x508c5d,null));};exports[_0x238d('0x45')]=function(_0x5db7d5,_0x4aac06){var _0x1a6ccd={'raw':!![],'where':{'id':_0x5db7d5[_0x238d('0x46')]['id']}},_0x54469e={};_0x54469e[_0x238d('0x2f')]=_['keys'](db[_0x238d('0x41')]['rawAttributes']);_0x54469e['query']=_[_0x238d('0x31')](_0x5db7d5[_0x238d('0x30')]);_0x54469e[_0x238d('0x32')]=_[_0x238d('0x33')](_0x54469e[_0x238d('0x2f')],_0x54469e[_0x238d('0x30')]);_0x1a6ccd['attributes']=_[_0x238d('0x33')](_0x54469e[_0x238d('0x2f')],qs['fields'](_0x5db7d5[_0x238d('0x30')][_0x238d('0x34')]));_0x1a6ccd[_0x238d('0x35')]=_0x1a6ccd[_0x238d('0x35')][_0x238d('0x36')]?_0x1a6ccd[_0x238d('0x35')]:_0x54469e[_0x238d('0x2f')];if(_0x5db7d5['query'][_0x238d('0x42')]){_0x1a6ccd[_0x238d('0x43')]=[{'all':!![]}];}_0x1a6ccd=_[_0x238d('0x3e')]({},_0x1a6ccd,_0x5db7d5[_0x238d('0x40')]);return db[_0x238d('0x41')][_0x238d('0x47')](_0x1a6ccd)['then'](handleEntityNotFound(_0x4aac06,null))[_0x238d('0x26')](respondWithResult(_0x4aac06,null))[_0x238d('0x48')](handleError(_0x4aac06,null));};exports[_0x238d('0x49')]=function(_0x509cc8,_0x33867c){return db['SquareRecording'][_0x238d('0x49')](_0x509cc8['body'],{})['then'](respondWithResult(_0x33867c,0xc9))[_0x238d('0x48')](handleError(_0x33867c,null));};exports[_0x238d('0x25')]=function(_0x3c5efd,_0x4b863d){if(_0x3c5efd['body']['id']){delete _0x3c5efd['body']['id'];}return db[_0x238d('0x41')]['find']({'where':{'id':_0x3c5efd[_0x238d('0x46')]['id']}})[_0x238d('0x26')](handleEntityNotFound(_0x4b863d,null))[_0x238d('0x26')](saveUpdates(_0x3c5efd[_0x238d('0x4a')],null))[_0x238d('0x26')](respondWithResult(_0x4b863d,null))['catch'](handleError(_0x4b863d,null));};exports[_0x238d('0x4b')]=function(_0x40dd93,_0x19b4fa,_0x437d04){var _0x250e12=require('../../components/encryptor');var _0x26728c=![];var _0x10ffe0={};if(_0x40dd93[_0x238d('0x30')][_0x238d('0x2d')]&&_0x40dd93['query'][_0x238d('0x2d')]===_0x238d('0x4c')){_0x10ffe0[_0x238d('0x4c')]=_0x40dd93['params']['id'];}else{_0x10ffe0['id']=_0x40dd93[_0x238d('0x46')]['id'];}return db['SquareRecording'][_0x238d('0x47')]({'where':_0x10ffe0,'attributes':['id',_0x238d('0x4d'),_0x238d('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x19b4fa,null))[_0x238d('0x26')](function(_0x4dc025){if(_0x4dc025){var _0x42e3c1=_0x4dc025[_0x238d('0x4d')];var _0x4b10c5=util[_0x238d('0x4f')]('%s.cypher',_0x42e3c1);if(fs[_0x238d('0x50')](_0x4b10c5)){_0x26728c=!![];return _0x250e12['decryptFile'](_0x4b10c5,_0x42e3c1,config[_0x238d('0x51')]['recording'])['then'](function(){return _0x4dc025;});}return _0x4dc025;}})[_0x238d('0x26')](function(_0xebc267){if(_0xebc267){var _0x9bf6b2=_0xebc267['savePath'];if(!fs['existsSync'](_0x9bf6b2)){throw new db[(_0x238d('0x52'))][(_0x238d('0x53'))](_0x238d('0x54'));}if(_0xebc267['filename']){return _0x19b4fa[_0x238d('0x4b')](_0x9bf6b2,_0xebc267['filename']+path[_0x238d('0x55')](_0x9bf6b2),function(){if(_0x26728c){fs['unlink'](_0x9bf6b2);}});}else{return _0x19b4fa[_0x238d('0x4b')](_0x9bf6b2,function(_0x51f06d){if(_0x26728c){fs[_0x238d('0x56')](_0x9bf6b2);}});}}})[_0x238d('0x48')](function(_0x57b400){if(_0x57b400['message']===_0x238d('0x54')){_0x19b4fa['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x19b4fa,null);}});};exports['destroy']=function(_0xbd3e01,_0x374ee7){return db[_0x238d('0x41')][_0x238d('0x47')]({'where':{'id':_0xbd3e01['params']['id']}})[_0x238d('0x26')](function(_0x449665){if(_[_0x238d('0x57')](_0x449665)){throw new ReferenceError(_0x238d('0x58'));}return _0x449665;})['then'](function(_0x1b91d2){var _0x1d51b9=_0x1b91d2[_0x238d('0x4d')];logger[_0x238d('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x1d51b9);if(!_[_0x238d('0x57')](_0x1b91d2[_0x238d('0x4d')])&&fs['existsSync'](_0x1d51b9)){logger[_0x238d('0x59')](_0x238d('0x5a')+_0x1d51b9+_0x238d('0x5b'));fs[_0x238d('0x5c')](_0x1d51b9);}_0x1d51b9=_0x1d51b9+_0x238d('0x5d');if(!_[_0x238d('0x57')](_0x1b91d2[_0x238d('0x4d')])&&fs['existsSync'](_0x1d51b9)){logger[_0x238d('0x59')](_0x238d('0x5a')+_0x1d51b9+_0x238d('0x5b'));fs[_0x238d('0x5c')](_0x1d51b9);}return _0x1b91d2;})[_0x238d('0x26')](function(_0x1b04cb){if(!_0x1b04cb)throw new InternalError();return _0x1b04cb[_0x238d('0x27')]();})[_0x238d('0x26')](function(){_0x374ee7[_0x238d('0x1d')](0xcc)[_0x238d('0x1e')]();})[_0x238d('0x48')](handleError(_0x374ee7,null));}; \ No newline at end of file +var _0x8617=['filename','unlink','message','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found'];(function(_0x468c37,_0x543eec){var _0x2fc8c0=function(_0x28d933){while(--_0x28d933){_0x468c37['push'](_0x468c37['shift']());}};_0x2fc8c0(++_0x543eec);}(_0x8617,0x191));var _0x7861=function(_0x54af33,_0x459b0f){_0x54af33=_0x54af33-0x0;var _0x51943c=_0x8617[_0x54af33];return _0x51943c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7861('0x0'));var zipdir=require(_0x7861('0x1'));var jsonpatch=require(_0x7861('0x2'));var rp=require(_0x7861('0x3'));var moment=require(_0x7861('0x4'));var BPromise=require(_0x7861('0x5'));var Mustache=require(_0x7861('0x6'));var util=require(_0x7861('0x7'));var path=require(_0x7861('0x8'));var sox=require(_0x7861('0x9'));var csv=require(_0x7861('0xa'));var ejs=require(_0x7861('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7861('0xc'));var squel=require(_0x7861('0xd'));var crypto=require(_0x7861('0xe'));var jsforce=require(_0x7861('0xf'));var deskjs=require(_0x7861('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7861('0x11'));var Papa=require(_0x7861('0x12'));var Redis=require(_0x7861('0x13'));var authService=require(_0x7861('0x14'));var qs=require(_0x7861('0x15'));var as=require(_0x7861('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7861('0x17'))(_0x7861('0x18'));var utils=require(_0x7861('0x19'));var config=require(_0x7861('0x1a'));var licenseUtil=require(_0x7861('0x1b'));var db=require(_0x7861('0x1c'))['db'];function respondWithStatusCode(_0x2c534d,_0x4aa9eb){_0x4aa9eb=_0x4aa9eb||0xcc;return function(_0xbe090f){if(_0xbe090f){return _0x2c534d['sendStatus'](_0x4aa9eb);}return _0x2c534d[_0x7861('0x1d')](_0x4aa9eb)[_0x7861('0x1e')]();};}function respondWithResult(_0x1687cd,_0x1fdafd){_0x1fdafd=_0x1fdafd||0xc8;return function(_0x4bb684){if(_0x4bb684){return _0x1687cd[_0x7861('0x1d')](_0x1fdafd)[_0x7861('0x1f')](_0x4bb684);}};}function respondWithFilteredResult(_0x4bab09,_0x4a8e6c){return function(_0x23a07e){if(_0x23a07e){var _0x9815bc=typeof _0x4a8e6c[_0x7861('0x20')]===_0x7861('0x21')&&typeof _0x4a8e6c['limit']==='undefined';var _0x3fe90c=_0x23a07e[_0x7861('0x22')];var _0x902820=_0x9815bc?0x0:_0x4a8e6c['offset'];var _0x5073e2=_0x9815bc?_0x23a07e['count']:_0x4a8e6c[_0x7861('0x20')]+_0x4a8e6c[_0x7861('0x23')];var _0x34a435;if(_0x5073e2>=_0x3fe90c){_0x5073e2=_0x3fe90c;_0x34a435=0xc8;}else{_0x34a435=0xce;}_0x4bab09[_0x7861('0x1d')](_0x34a435);return _0x4bab09[_0x7861('0x24')]('Content-Range',_0x902820+'-'+_0x5073e2+'/'+_0x3fe90c)[_0x7861('0x1f')](_0x23a07e);}return null;};}function patchUpdates(_0xfb08b9){return function(_0x5574db){try{jsonpatch[_0x7861('0x25')](_0x5574db,_0xfb08b9,!![]);}catch(_0x52b07a){return BPromise[_0x7861('0x26')](_0x52b07a);}return _0x5574db[_0x7861('0x27')]();};}function saveUpdates(_0x390773,_0x3917a9){return function(_0x19e470){if(_0x19e470){return _0x19e470[_0x7861('0x28')](_0x390773)[_0x7861('0x29')](function(_0x1b75f3){return _0x1b75f3;});}return null;};}function removeEntity(_0x3e7eeb,_0x3a6eb4){return function(_0x2c7498){if(_0x2c7498){return _0x2c7498[_0x7861('0x2a')]()[_0x7861('0x29')](function(){_0x3e7eeb[_0x7861('0x1d')](0xcc)[_0x7861('0x1e')]();});}};}function handleEntityNotFound(_0x1b2ee6,_0x16f443){return function(_0x290583){if(!_0x290583){_0x1b2ee6['sendStatus'](0x194);}return _0x290583;};}function handleError(_0x3f7ffa,_0x347210){_0x347210=_0x347210||0x1f4;return function(_0x5e9cc8){logger[_0x7861('0x2b')](_0x5e9cc8[_0x7861('0x2c')]);if(_0x5e9cc8[_0x7861('0x2d')]){delete _0x5e9cc8['name'];}_0x3f7ffa[_0x7861('0x1d')](_0x347210)[_0x7861('0x2e')](_0x5e9cc8);};}exports[_0x7861('0x2f')]=function(_0x4f0b3b,_0x49037c){var _0x3ed081={},_0x443152={},_0x388c0b={'count':0x0,'rows':[]};var _0x4b0eb9=_[_0x7861('0x30')](db[_0x7861('0x31')][_0x7861('0x32')],function(_0x26a45b){return{'name':_0x26a45b[_0x7861('0x33')],'type':_0x26a45b[_0x7861('0x34')][_0x7861('0x35')]};});_0x443152[_0x7861('0x36')]=_['map'](_0x4b0eb9,'name');_0x443152[_0x7861('0x37')]=_[_0x7861('0x38')](_0x4f0b3b[_0x7861('0x37')]);_0x443152[_0x7861('0x39')]=_['intersection'](_0x443152[_0x7861('0x36')],_0x443152['query']);_0x3ed081[_0x7861('0x3a')]=_[_0x7861('0x3b')](_0x443152[_0x7861('0x36')],qs['fields'](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x3c')]));_0x3ed081[_0x7861('0x3a')]=_0x3ed081[_0x7861('0x3a')][_0x7861('0x3d')]?_0x3ed081['attributes']:_0x443152['model'];if(!_0x4f0b3b[_0x7861('0x37')][_0x7861('0x3e')](_0x7861('0x3f'))){_0x3ed081['limit']=qs['limit'](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x23')]);_0x3ed081[_0x7861('0x20')]=qs[_0x7861('0x20')](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x20')]);}_0x3ed081[_0x7861('0x40')]=qs[_0x7861('0x41')](_0x4f0b3b[_0x7861('0x37')][_0x7861('0x41')]);_0x3ed081['where']=qs['filters'](_['pick'](_0x4f0b3b[_0x7861('0x37')],_0x443152[_0x7861('0x39')]),_0x4b0eb9);if(_0x4f0b3b[_0x7861('0x37')][_0x7861('0x42')]){_0x3ed081['where']=_[_0x7861('0x43')](_0x3ed081[_0x7861('0x44')],{'$or':_['map'](_0x4b0eb9,function(_0x5e9cf2){if(_0x5e9cf2['type']!==_0x7861('0x45')){var _0x4b8cd9={};_0x4b8cd9[_0x5e9cf2[_0x7861('0x2d')]]={'$like':'%'+_0x4f0b3b[_0x7861('0x37')][_0x7861('0x42')]+'%'};return _0x4b8cd9;}})});}_0x3ed081=_[_0x7861('0x43')]({},_0x3ed081,_0x4f0b3b[_0x7861('0x46')]);var _0x2f353b={'where':_0x3ed081[_0x7861('0x44')]};return db[_0x7861('0x31')][_0x7861('0x22')](_0x2f353b)[_0x7861('0x29')](function(_0x5b0711){_0x388c0b[_0x7861('0x22')]=_0x5b0711;if(_0x4f0b3b[_0x7861('0x37')][_0x7861('0x47')]){_0x3ed081['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x3ed081);})[_0x7861('0x29')](function(_0x4bcdf){_0x388c0b['rows']=_0x4bcdf;return _0x388c0b;})[_0x7861('0x29')](respondWithFilteredResult(_0x49037c,_0x3ed081))[_0x7861('0x48')](handleError(_0x49037c,null));};exports[_0x7861('0x49')]=function(_0x27c4d4,_0x562dbb){var _0x517ef3={'raw':!![],'where':{'id':_0x27c4d4[_0x7861('0x4a')]['id']}},_0x5cc643={};_0x5cc643['model']=_[_0x7861('0x38')](db[_0x7861('0x31')][_0x7861('0x32')]);_0x5cc643[_0x7861('0x37')]=_[_0x7861('0x38')](_0x27c4d4['query']);_0x5cc643[_0x7861('0x39')]=_[_0x7861('0x3b')](_0x5cc643['model'],_0x5cc643[_0x7861('0x37')]);_0x517ef3['attributes']=_['intersection'](_0x5cc643[_0x7861('0x36')],qs[_0x7861('0x3c')](_0x27c4d4[_0x7861('0x37')][_0x7861('0x3c')]));_0x517ef3[_0x7861('0x3a')]=_0x517ef3[_0x7861('0x3a')]['length']?_0x517ef3[_0x7861('0x3a')]:_0x5cc643['model'];if(_0x27c4d4[_0x7861('0x37')][_0x7861('0x47')]){_0x517ef3[_0x7861('0x4b')]=[{'all':!![]}];}_0x517ef3=_[_0x7861('0x43')]({},_0x517ef3,_0x27c4d4['options']);return db[_0x7861('0x31')][_0x7861('0x4c')](_0x517ef3)[_0x7861('0x29')](handleEntityNotFound(_0x562dbb,null))[_0x7861('0x29')](respondWithResult(_0x562dbb,null))[_0x7861('0x48')](handleError(_0x562dbb,null));};exports['create']=function(_0x2f6c1d,_0x1d45b8){return db[_0x7861('0x31')][_0x7861('0x4d')](_0x2f6c1d[_0x7861('0x4e')],{})['then'](respondWithResult(_0x1d45b8,0xc9))[_0x7861('0x48')](handleError(_0x1d45b8,null));};exports[_0x7861('0x28')]=function(_0xe9fc4b,_0x4f0535){if(_0xe9fc4b[_0x7861('0x4e')]['id']){delete _0xe9fc4b['body']['id'];}return db['SquareRecording'][_0x7861('0x4c')]({'where':{'id':_0xe9fc4b[_0x7861('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f0535,null))[_0x7861('0x29')](saveUpdates(_0xe9fc4b[_0x7861('0x4e')],null))[_0x7861('0x29')](respondWithResult(_0x4f0535,null))[_0x7861('0x48')](handleError(_0x4f0535,null));};exports[_0x7861('0x4f')]=function(_0x86daeb,_0x408959,_0x13f9a9){var _0x58056a=require('../../components/encryptor');var _0x44ecc1=![];var _0x6c56db={};if(_0x86daeb[_0x7861('0x37')][_0x7861('0x34')]&&_0x86daeb[_0x7861('0x37')][_0x7861('0x34')]===_0x7861('0x50')){_0x6c56db[_0x7861('0x50')]=_0x86daeb[_0x7861('0x4a')]['id'];}else{_0x6c56db['id']=_0x86daeb[_0x7861('0x4a')]['id'];}return db[_0x7861('0x31')]['find']({'where':_0x6c56db,'attributes':['id',_0x7861('0x51'),'filename'],'raw':!![]})[_0x7861('0x29')](handleEntityNotFound(_0x408959,null))['then'](function(_0x40c19e){if(_0x40c19e){var _0x5c92e0=_0x40c19e[_0x7861('0x51')];var _0x53b9c1=util[_0x7861('0x52')](_0x7861('0x53'),_0x5c92e0);if(fs[_0x7861('0x54')](_0x53b9c1)){_0x44ecc1=!![];return _0x58056a[_0x7861('0x55')](_0x53b9c1,_0x5c92e0,config['secrets'][_0x7861('0x56')])['then'](function(){return _0x40c19e;});}return _0x40c19e;}})[_0x7861('0x29')](function(_0x11b5d4){if(_0x11b5d4){var _0x35123d=_0x11b5d4[_0x7861('0x51')];if(!fs[_0x7861('0x54')](_0x35123d)){throw new db['Sequelize'][(_0x7861('0x57'))](_0x7861('0x58'));}if(_0x11b5d4[_0x7861('0x59')]){return _0x408959[_0x7861('0x4f')](_0x35123d,_0x11b5d4['filename']+path['extname'](_0x35123d),function(){if(_0x44ecc1){fs['unlink'](_0x35123d);}});}else{return _0x408959[_0x7861('0x4f')](_0x35123d,function(_0x1f047b){if(_0x44ecc1){fs[_0x7861('0x5a')](_0x35123d);}});}}})[_0x7861('0x48')](function(_0x151d29){if(_0x151d29[_0x7861('0x5b')]===_0x7861('0x58')){_0x408959[_0x7861('0x1d')](0x194)['send']('Not\x20found');}else{return handleError(_0x408959,null);}});};exports[_0x7861('0x2a')]=function(_0x558627,_0x28464d){return db[_0x7861('0x31')][_0x7861('0x4c')]({'where':{'id':_0x558627[_0x7861('0x4a')]['id']}})[_0x7861('0x29')](function(_0x43a249){if(_['isNil'](_0x43a249)){throw new ReferenceError('Entity\x20not\x20found');}return _0x43a249;})[_0x7861('0x29')](function(_0x5b3704){var _0x348095=_0x5b3704['savePath'];logger[_0x7861('0x5c')](_0x7861('0x5d'),_0x348095);if(!_[_0x7861('0x5e')](_0x5b3704[_0x7861('0x51')])&&fs[_0x7861('0x54')](_0x348095)){logger[_0x7861('0x5c')]('File:\x20\x22'+_0x348095+_0x7861('0x5f'));fs[_0x7861('0x60')](_0x348095);}_0x348095=_0x348095+_0x7861('0x61');if(!_['isNil'](_0x5b3704[_0x7861('0x51')])&&fs[_0x7861('0x54')](_0x348095)){logger['info']('File:\x20\x22'+_0x348095+_0x7861('0x5f'));fs[_0x7861('0x60')](_0x348095);}return _0x5b3704;})[_0x7861('0x29')](function(_0x5cb90b){if(!_0x5cb90b)throw new InternalError();return _0x5cb90b[_0x7861('0x2a')]();})[_0x7861('0x29')](function(){_0x28464d[_0x7861('0x1d')](0xcc)[_0x7861('0x1e')]();})[_0x7861('0x48')](handleError(_0x28464d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a247703..8fa9ca1 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 _0xde3a=['square_recordings','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording'];(function(_0x57c1c4,_0x457db3){var _0x58a505=function(_0x597931){while(--_0x597931){_0x57c1c4['push'](_0x57c1c4['shift']());}};_0x58a505(++_0x457db3);}(_0xde3a,0x140));var _0xade3=function(_0x1d195f,_0x50b9bd){_0x1d195f=_0x1d195f-0x0;var _0x3be955=_0xde3a[_0x1d195f];return _0x3be955;};'use strict';var _=require(_0xade3('0x0'));var util=require(_0xade3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xade3('0x2'));var rp=require(_0xade3('0x3'));var fs=require('fs');var path=require(_0xade3('0x4'));var rimraf=require(_0xade3('0x5'));var config=require(_0xade3('0x6'));var attributes=require(_0xade3('0x7'));module[_0xade3('0x8')]=function(_0x3c5d92,_0x3a3078){return _0x3c5d92['define'](_0xade3('0x9'),attributes,{'tableName':_0xade3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./squareRecording.attributes','define','SquareRecording','lodash','util','../../config/logger','api','moment'];(function(_0x4cabaf,_0x24b4c7){var _0x516afc=function(_0xff644f){while(--_0xff644f){_0x4cabaf['push'](_0x4cabaf['shift']());}};_0x516afc(++_0x24b4c7);}(_0x53ec,0x192));var _0xc53e=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x53ec[_0x30e4c0];return _0x30b6d0;};'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':'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 1f1ec1e..df6b87a 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 _0xda33=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','create','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0xda33,0x7b));var _0x3da3=function(_0x5481c9,_0x21506b){_0x5481c9=_0x5481c9-0x0;var _0x59d4c4=_0xda33[_0x5481c9];return _0x59d4c4;};'use strict';var _=require(_0x3da3('0x0'));var util=require(_0x3da3('0x1'));var moment=require(_0x3da3('0x2'));var BPromise=require(_0x3da3('0x3'));var rs=require(_0x3da3('0x4'));var fs=require('fs');var Redis=require(_0x3da3('0x5'));var db=require(_0x3da3('0x6'))['db'];var utils=require(_0x3da3('0x7'));var logger=require('../../config/logger')(_0x3da3('0x8'));var config=require(_0x3da3('0x9'));var jayson=require(_0x3da3('0xa'));var client=jayson[_0x3da3('0xb')][_0x3da3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b5451,_0x2ccd9c,_0x470f87){return new BPromise(function(_0x33c536,_0x8b3703){return client['request'](_0x2b5451,_0x470f87)[_0x3da3('0xd')](function(_0x776018){logger[_0x3da3('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2ccd9c,'request\x20sent');logger[_0x3da3('0xf')](_0x3da3('0x10'),_0x2ccd9c,'request\x20sent',JSON[_0x3da3('0x11')](_0x776018));if(_0x776018[_0x3da3('0x12')]){if(_0x776018[_0x3da3('0x12')]['code']===0x1f4){logger[_0x3da3('0x12')](_0x3da3('0x13'),_0x2ccd9c,_0x776018['error'][_0x3da3('0x14')]);return _0x8b3703(_0x776018['error'][_0x3da3('0x14')]);}logger[_0x3da3('0x12')](_0x3da3('0x13'),_0x2ccd9c,_0x776018[_0x3da3('0x12')][_0x3da3('0x14')]);return _0x33c536(_0x776018[_0x3da3('0x12')][_0x3da3('0x14')]);}else{logger[_0x3da3('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2ccd9c,'request\x20sent');_0x33c536(_0x776018['result'][_0x3da3('0x14')]);}})[_0x3da3('0x15')](function(_0x2a7062){logger[_0x3da3('0x12')](_0x3da3('0x13'),_0x2ccd9c,_0x2a7062);_0x8b3703(_0x2a7062);});});}exports['CreateSquareRecording']=function(_0x34e5cd){var _0xbc8af9=this;return new Promise(function(_0x551c16,_0x13468a){return db['SquareRecording'][_0x3da3('0x16')](_0x34e5cd['body'],{'raw':_0x34e5cd[_0x3da3('0x17')]?_0x34e5cd[_0x3da3('0x17')][_0x3da3('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4f07b3){logger['info']('CreateSquareRecording',_0x34e5cd);logger[_0x3da3('0xf')](_0x3da3('0x19'),_0x34e5cd,JSON['stringify'](_0x4f07b3));_0x551c16(_0x4f07b3);})[_0x3da3('0x15')](function(_0x23eb4d){logger[_0x3da3('0x12')](_0x3da3('0x19'),_0x23eb4d[_0x3da3('0x14')],_0x34e5cd);_0x13468a(_0xbc8af9[_0x3da3('0x12')](0x1f4,_0x23eb4d[_0x3da3('0x14')]));});});}; \ No newline at end of file +var _0xf85b=['code','SquareRecording,\x20%s,\x20%s','message','info','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ae6de,_0x4cb081){var _0x572942=function(_0x5281d7){while(--_0x5281d7){_0x3ae6de['push'](_0x3ae6de['shift']());}};_0x572942(++_0x4cb081);}(_0xf85b,0xac));var _0xbf85=function(_0x3fe870,_0x5b006c){_0x3fe870=_0x3fe870-0x0;var _0x2077f7=_0xf85b[_0x3fe870];return _0x2077f7;};'use strict';var _=require(_0xbf85('0x0'));var util=require(_0xbf85('0x1'));var moment=require(_0xbf85('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf85('0x3'));var db=require(_0xbf85('0x4'))['db'];var utils=require(_0xbf85('0x5'));var logger=require(_0xbf85('0x6'))(_0xbf85('0x7'));var config=require(_0xbf85('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a078,_0x581fd0,_0x398b39){return new BPromise(function(_0x37faa7,_0x1c08d5){return client[_0xbf85('0xa')](_0x32a078,_0x398b39)[_0xbf85('0xb')](function(_0x526bb9){logger['info']('SquareRecording,\x20%s,\x20%s',_0x581fd0,_0xbf85('0xc'));logger[_0xbf85('0xd')](_0xbf85('0xe'),_0x581fd0,_0xbf85('0xc'),JSON[_0xbf85('0xf')](_0x526bb9));if(_0x526bb9[_0xbf85('0x10')]){if(_0x526bb9['error'][_0xbf85('0x11')]===0x1f4){logger[_0xbf85('0x10')](_0xbf85('0x12'),_0x581fd0,_0x526bb9[_0xbf85('0x10')][_0xbf85('0x13')]);return _0x1c08d5(_0x526bb9['error'][_0xbf85('0x13')]);}logger[_0xbf85('0x10')](_0xbf85('0x12'),_0x581fd0,_0x526bb9[_0xbf85('0x10')]['message']);return _0x37faa7(_0x526bb9[_0xbf85('0x10')][_0xbf85('0x13')]);}else{logger[_0xbf85('0x14')](_0xbf85('0x12'),_0x581fd0,_0xbf85('0xc'));_0x37faa7(_0x526bb9['result']['message']);}})[_0xbf85('0x15')](function(_0x293fe4){logger[_0xbf85('0x10')](_0xbf85('0x12'),_0x581fd0,_0x293fe4);_0x1c08d5(_0x293fe4);});});}exports[_0xbf85('0x16')]=function(_0x5bb32e){var _0x4c8de1=this;return new Promise(function(_0x49492a,_0xce18f3){return db[_0xbf85('0x17')]['create'](_0x5bb32e[_0xbf85('0x18')],{'raw':_0x5bb32e[_0xbf85('0x19')]?_0x5bb32e[_0xbf85('0x19')][_0xbf85('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x42a4b8){logger['info'](_0xbf85('0x16'),_0x5bb32e);logger[_0xbf85('0xd')]('CreateSquareRecording',_0x5bb32e,JSON[_0xbf85('0xf')](_0x42a4b8));_0x49492a(_0x42a4b8);})[_0xbf85('0x15')](function(_0x54412a){logger['error'](_0xbf85('0x16'),_0x54412a['message'],_0x5bb32e);_0xce18f3(_0x4c8de1[_0xbf85('0x10')](0x1f4,_0x54412a[_0xbf85('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 652ef7d..72c7f36 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 _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(_0x4c432d,_0x435c91){var _0x4213b0=function(_0xadc21e){while(--_0xadc21e){_0x4c432d['push'](_0x4c432d['shift']());}};_0x4213b0(++_0x435c91);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fc414a6..e61662f 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 _0x126b=['BOOLEAN','exports','STRING','DATE'];(function(_0x6e1b00,_0x1b8b63){var _0x4bb476=function(_0x4bdead){while(--_0x4bdead){_0x6e1b00['push'](_0x6e1b00['shift']());}};_0x4bb476(++_0x1b8b63);}(_0x126b,0x1e1));var _0xb126=function(_0x233f38,_0x1a0530){_0x233f38=_0x233f38-0x0;var _0x484de3=_0x126b[_0x233f38];return _0x484de3;};'use strict';var Sequelize=require('sequelize');module[_0xb126('0x0')]={'network':{'type':Sequelize[_0xb126('0x1')]},'network_script':{'type':Sequelize[_0xb126('0x1')]},'request':{'type':Sequelize[_0xb126('0x1')]},'channel':{'type':Sequelize[_0xb126('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb126('0x1')]},'uniqueid':{'type':Sequelize[_0xb126('0x1')]},'version':{'type':Sequelize[_0xb126('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb126('0x1')]},'callingpres':{'type':Sequelize[_0xb126('0x1')]},'callingani2':{'type':Sequelize[_0xb126('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xb126('0x1')]},'dnid':{'type':Sequelize[_0xb126('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb126('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xb126('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xb126('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb126('0x2')]},'bot':{'type':Sequelize[_0xb126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3970=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x5420c4,_0x506787){var _0x19d5cd=function(_0x3b7fa2){while(--_0x3b7fa2){_0x5420c4['push'](_0x5420c4['shift']());}};_0x19d5cd(++_0x506787);}(_0x3970,0x1d4));var _0x0397=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x3970[_0x33080e];return _0x407395;};'use strict';var Sequelize=require(_0x0397('0x0'));module[_0x0397('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x0397('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0397('0x2')]},'language':{'type':Sequelize[_0x0397('0x2')]},'type':{'type':Sequelize[_0x0397('0x2')]},'uniqueid':{'type':Sequelize[_0x0397('0x2')]},'version':{'type':Sequelize[_0x0397('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0397('0x2')]},'callingpres':{'type':Sequelize[_0x0397('0x2')]},'callingani2':{'type':Sequelize[_0x0397('0x2')]},'callington':{'type':Sequelize[_0x0397('0x2')]},'callingtns':{'type':Sequelize[_0x0397('0x2')]},'dnid':{'type':Sequelize[_0x0397('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0397('0x2')]},'priority':{'type':Sequelize[_0x0397('0x2')]},'enhanced':{'type':Sequelize[_0x0397('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0397('0x2')]},'project_name':{'type':Sequelize[_0x0397('0x2')]},'joinAt':{'type':Sequelize[_0x0397('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x0397('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1d84218..f4011c4 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 _0x654d=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x42274c,_0x54d569){var _0x1d7b72=function(_0x2fac4f){while(--_0x2fac4f){_0x42274c['push'](_0x42274c['shift']());}};_0x1d7b72(++_0x54d569);}(_0x654d,0xac));var _0xd654=function(_0x5bf8dd,_0x482bfd){_0x5bf8dd=_0x5bf8dd-0x0;var _0xdedf75=_0x654d[_0x5bf8dd];return _0xdedf75;};'use strict';var emlformat=require(_0xd654('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd654('0x1'));var jsonpatch=require(_0xd654('0x2'));var rp=require(_0xd654('0x3'));var moment=require(_0xd654('0x4'));var BPromise=require(_0xd654('0x5'));var Mustache=require(_0xd654('0x6'));var util=require(_0xd654('0x7'));var path=require(_0xd654('0x8'));var sox=require(_0xd654('0x9'));var csv=require('to-csv');var ejs=require(_0xd654('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd654('0xb'));var squel=require(_0xd654('0xc'));var crypto=require(_0xd654('0xd'));var jsforce=require(_0xd654('0xe'));var deskjs=require(_0xd654('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd654('0x10'));var Papa=require(_0xd654('0x11'));var Redis=require('ioredis');var authService=require(_0xd654('0x12'));var qs=require(_0xd654('0x13'));var as=require(_0xd654('0x14'));var hardwareService=require(_0xd654('0x15'));var logger=require('../../config/logger')(_0xd654('0x16'));var utils=require(_0xd654('0x17'));var config=require(_0xd654('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd2b8,_0x48aa16){_0x48aa16=_0x48aa16||0xcc;return function(_0x1c9bf0){if(_0x1c9bf0){return _0x2bd2b8[_0xd654('0x19')](_0x48aa16);}return _0x2bd2b8['status'](_0x48aa16)[_0xd654('0x1a')]();};}function respondWithResult(_0xc03207,_0x116413){_0x116413=_0x116413||0xc8;return function(_0x5300fe){if(_0x5300fe){return _0xc03207[_0xd654('0x1b')](_0x116413)[_0xd654('0x1c')](_0x5300fe);}};}function respondWithFilteredResult(_0x5eeee5,_0x146925){return function(_0x1e556a){if(_0x1e556a){var _0x5292ec=typeof _0x146925[_0xd654('0x1d')]==='undefined'&&typeof _0x146925[_0xd654('0x1e')]===_0xd654('0x1f');var _0x23ab50=_0x1e556a[_0xd654('0x20')];var _0x406adf=_0x5292ec?0x0:_0x146925['offset'];var _0x366c7f=_0x5292ec?_0x1e556a['count']:_0x146925[_0xd654('0x1d')]+_0x146925[_0xd654('0x1e')];var _0x282be6;if(_0x366c7f>=_0x23ab50){_0x366c7f=_0x23ab50;_0x282be6=0xc8;}else{_0x282be6=0xce;}_0x5eeee5[_0xd654('0x1b')](_0x282be6);return _0x5eeee5[_0xd654('0x21')](_0xd654('0x22'),_0x406adf+'-'+_0x366c7f+'/'+_0x23ab50)['json'](_0x1e556a);}return null;};}function patchUpdates(_0x508622){return function(_0x558aea){try{jsonpatch['apply'](_0x558aea,_0x508622,!![]);}catch(_0x1173f3){return BPromise['reject'](_0x1173f3);}return _0x558aea[_0xd654('0x23')]();};}function saveUpdates(_0x3ac7f4,_0x30c62b){return function(_0x3da513){if(_0x3da513){return _0x3da513[_0xd654('0x24')](_0x3ac7f4)[_0xd654('0x25')](function(_0x12440e){return _0x12440e;});}return null;};}function removeEntity(_0x3b3f35,_0x4829d5){return function(_0x2f1d4d){if(_0x2f1d4d){return _0x2f1d4d[_0xd654('0x26')]()[_0xd654('0x25')](function(){_0x3b3f35[_0xd654('0x1b')](0xcc)[_0xd654('0x1a')]();});}};}function handleEntityNotFound(_0x233449,_0x4d069c){return function(_0x1704eb){if(!_0x1704eb){_0x233449[_0xd654('0x19')](0x194);}return _0x1704eb;};}function handleError(_0x159474,_0x4eb629){_0x4eb629=_0x4eb629||0x1f4;return function(_0x298e3d){logger['error'](_0x298e3d[_0xd654('0x27')]);if(_0x298e3d[_0xd654('0x28')]){delete _0x298e3d[_0xd654('0x28')];}_0x159474[_0xd654('0x1b')](_0x4eb629)[_0xd654('0x29')](_0x298e3d);};}exports['index']=function(_0x246495,_0x190d22){var _0x4f1076={},_0x45fd7c={},_0x42038c={'count':0x0,'rows':[]};var _0x1b390b=_[_0xd654('0x2a')](db[_0xd654('0x2b')][_0xd654('0x2c')],function(_0x4169e2){return{'name':_0x4169e2[_0xd654('0x2d')],'type':_0x4169e2[_0xd654('0x2e')][_0xd654('0x2f')]};});_0x45fd7c[_0xd654('0x30')]=_[_0xd654('0x2a')](_0x1b390b,_0xd654('0x28'));_0x45fd7c[_0xd654('0x31')]=_[_0xd654('0x32')](_0x246495[_0xd654('0x31')]);_0x45fd7c[_0xd654('0x33')]=_[_0xd654('0x34')](_0x45fd7c[_0xd654('0x30')],_0x45fd7c[_0xd654('0x31')]);_0x4f1076[_0xd654('0x35')]=_['intersection'](_0x45fd7c[_0xd654('0x30')],qs[_0xd654('0x36')](_0x246495[_0xd654('0x31')][_0xd654('0x36')]));_0x4f1076['attributes']=_0x4f1076['attributes'][_0xd654('0x37')]?_0x4f1076['attributes']:_0x45fd7c[_0xd654('0x30')];if(!_0x246495[_0xd654('0x31')][_0xd654('0x38')](_0xd654('0x39'))){_0x4f1076[_0xd654('0x1e')]=qs[_0xd654('0x1e')](_0x246495[_0xd654('0x31')]['limit']);_0x4f1076[_0xd654('0x1d')]=qs[_0xd654('0x1d')](_0x246495[_0xd654('0x31')][_0xd654('0x1d')]);}_0x4f1076[_0xd654('0x3a')]=qs[_0xd654('0x3b')](_0x246495['query']['sort']);_0x4f1076[_0xd654('0x3c')]=qs['filters'](_[_0xd654('0x3d')](_0x246495['query'],_0x45fd7c[_0xd654('0x33')]),_0x1b390b);if(_0x246495[_0xd654('0x31')][_0xd654('0x3e')]){_0x4f1076['where']=_[_0xd654('0x3f')](_0x4f1076[_0xd654('0x3c')],{'$or':_['map'](_0x1b390b,function(_0x238631){if(_0x238631[_0xd654('0x2e')]!==_0xd654('0x40')){var _0x46b67f={};_0x46b67f[_0x238631[_0xd654('0x28')]]={'$like':'%'+_0x246495[_0xd654('0x31')][_0xd654('0x3e')]+'%'};return _0x46b67f;}})});}_0x4f1076=_[_0xd654('0x3f')]({},_0x4f1076,_0x246495[_0xd654('0x41')]);var _0x32744f={'where':_0x4f1076['where']};return db[_0xd654('0x2b')]['count'](_0x32744f)[_0xd654('0x25')](function(_0x5df7b1){_0x42038c[_0xd654('0x20')]=_0x5df7b1;if(_0x246495[_0xd654('0x31')][_0xd654('0x42')]){_0x4f1076[_0xd654('0x43')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x4f1076);})['then'](function(_0x4650d6){_0x42038c['rows']=_0x4650d6;return _0x42038c;})[_0xd654('0x25')](respondWithFilteredResult(_0x190d22,_0x4f1076))[_0xd654('0x44')](handleError(_0x190d22,null));};exports['show']=function(_0x4ba274,_0x138169){var _0x229123={'raw':!![],'where':{'id':_0x4ba274[_0xd654('0x45')]['id']}},_0x4ebf29={};_0x4ebf29[_0xd654('0x30')]=_['keys'](db[_0xd654('0x2b')][_0xd654('0x2c')]);_0x4ebf29[_0xd654('0x31')]=_['keys'](_0x4ba274['query']);_0x4ebf29[_0xd654('0x33')]=_[_0xd654('0x34')](_0x4ebf29[_0xd654('0x30')],_0x4ebf29[_0xd654('0x31')]);_0x229123[_0xd654('0x35')]=_[_0xd654('0x34')](_0x4ebf29[_0xd654('0x30')],qs[_0xd654('0x36')](_0x4ba274[_0xd654('0x31')][_0xd654('0x36')]));_0x229123[_0xd654('0x35')]=_0x229123['attributes'][_0xd654('0x37')]?_0x229123[_0xd654('0x35')]:_0x4ebf29[_0xd654('0x30')];if(_0x4ba274['query'][_0xd654('0x42')]){_0x229123[_0xd654('0x43')]=[{'all':!![]}];}_0x229123=_[_0xd654('0x3f')]({},_0x229123,_0x4ba274[_0xd654('0x41')]);return db['SquareReport'][_0xd654('0x46')](_0x229123)[_0xd654('0x25')](handleEntityNotFound(_0x138169,null))[_0xd654('0x25')](respondWithResult(_0x138169,null))['catch'](handleError(_0x138169,null));};exports[_0xd654('0x47')]=function(_0x5e79eb,_0x508112){return db[_0xd654('0x2b')][_0xd654('0x47')](_0x5e79eb[_0xd654('0x48')],{})[_0xd654('0x25')](respondWithResult(_0x508112,0xc9))['catch'](handleError(_0x508112,null));};exports['update']=function(_0x4607d6,_0x37c353){if(_0x4607d6[_0xd654('0x48')]['id']){delete _0x4607d6[_0xd654('0x48')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x4607d6[_0xd654('0x45')]['id']}})['then'](handleEntityNotFound(_0x37c353,null))[_0xd654('0x25')](saveUpdates(_0x4607d6[_0xd654('0x48')],null))['then'](respondWithResult(_0x37c353,null))[_0xd654('0x44')](handleError(_0x37c353,null));};exports[_0xd654('0x26')]=function(_0x3691fa,_0xf5b759){return db[_0xd654('0x2b')][_0xd654('0x46')]({'where':{'id':_0x3691fa['params']['id']}})[_0xd654('0x25')](handleEntityNotFound(_0xf5b759,null))[_0xd654('0x25')](removeEntity(_0xf5b759,null))[_0xd654('0x44')](handleError(_0xf5b759,null));};exports[_0xd654('0x49')]=function(_0x3cf618,_0x4d8561){return db[_0xd654('0x2b')][_0xd654('0x49')]()[_0xd654('0x25')](respondWithResult(_0x4d8561,null))[_0xd654('0x44')](handleError(_0x4d8561,null));}; \ No newline at end of file +var _0xa6aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','SquareReport','fieldName','type','model','keys','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xa6aa,0x195));var _0xaa6a=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xa6aa[_0x2134b7];return _0x6c5914;};'use strict';var emlformat=require(_0xaa6a('0x0'));var rimraf=require(_0xaa6a('0x1'));var zipdir=require(_0xaa6a('0x2'));var jsonpatch=require(_0xaa6a('0x3'));var rp=require(_0xaa6a('0x4'));var moment=require(_0xaa6a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa6a('0x6'));var path=require(_0xaa6a('0x7'));var sox=require('sox');var csv=require(_0xaa6a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa6a('0x9'));var _=require(_0xaa6a('0xa'));var squel=require(_0xaa6a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa6a('0xc'));var Papa=require(_0xaa6a('0xd'));var Redis=require(_0xaa6a('0xe'));var authService=require(_0xaa6a('0xf'));var qs=require(_0xaa6a('0x10'));var as=require(_0xaa6a('0x11'));var hardwareService=require(_0xaa6a('0x12'));var logger=require('../../config/logger')(_0xaa6a('0x13'));var utils=require(_0xaa6a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x746622,_0x1ea46c){_0x1ea46c=_0x1ea46c||0xcc;return function(_0x224e93){if(_0x224e93){return _0x746622[_0xaa6a('0x15')](_0x1ea46c);}return _0x746622[_0xaa6a('0x16')](_0x1ea46c)[_0xaa6a('0x17')]();};}function respondWithResult(_0x895af,_0x501b68){_0x501b68=_0x501b68||0xc8;return function(_0x14b8be){if(_0x14b8be){return _0x895af[_0xaa6a('0x16')](_0x501b68)[_0xaa6a('0x18')](_0x14b8be);}};}function respondWithFilteredResult(_0x4f8a6e,_0x5bcc1a){return function(_0x11f9b8){if(_0x11f9b8){var _0x466022=typeof _0x5bcc1a[_0xaa6a('0x19')]===_0xaa6a('0x1a')&&typeof _0x5bcc1a[_0xaa6a('0x1b')]===_0xaa6a('0x1a');var _0x3060bb=_0x11f9b8[_0xaa6a('0x1c')];var _0x3031b2=_0x466022?0x0:_0x5bcc1a[_0xaa6a('0x19')];var _0x2f020b=_0x466022?_0x11f9b8[_0xaa6a('0x1c')]:_0x5bcc1a[_0xaa6a('0x19')]+_0x5bcc1a[_0xaa6a('0x1b')];var _0x40988f;if(_0x2f020b>=_0x3060bb){_0x2f020b=_0x3060bb;_0x40988f=0xc8;}else{_0x40988f=0xce;}_0x4f8a6e[_0xaa6a('0x16')](_0x40988f);return _0x4f8a6e[_0xaa6a('0x1d')]('Content-Range',_0x3031b2+'-'+_0x2f020b+'/'+_0x3060bb)[_0xaa6a('0x18')](_0x11f9b8);}return null;};}function patchUpdates(_0x3dc6b2){return function(_0x25c10c){try{jsonpatch[_0xaa6a('0x1e')](_0x25c10c,_0x3dc6b2,!![]);}catch(_0x4fa361){return BPromise[_0xaa6a('0x1f')](_0x4fa361);}return _0x25c10c['save']();};}function saveUpdates(_0x225a5c,_0x49e947){return function(_0x3b8d72){if(_0x3b8d72){return _0x3b8d72[_0xaa6a('0x20')](_0x225a5c)[_0xaa6a('0x21')](function(_0x5a5072){return _0x5a5072;});}return null;};}function removeEntity(_0x34c4ac,_0x377a1d){return function(_0x42b8d3){if(_0x42b8d3){return _0x42b8d3[_0xaa6a('0x22')]()['then'](function(){_0x34c4ac[_0xaa6a('0x16')](0xcc)[_0xaa6a('0x17')]();});}};}function handleEntityNotFound(_0x2ee9a1,_0x11b347){return function(_0x4b6b07){if(!_0x4b6b07){_0x2ee9a1['sendStatus'](0x194);}return _0x4b6b07;};}function handleError(_0x5a9e8b,_0xceb371){_0xceb371=_0xceb371||0x1f4;return function(_0x4db5c6){logger[_0xaa6a('0x23')](_0x4db5c6[_0xaa6a('0x24')]);if(_0x4db5c6[_0xaa6a('0x25')]){delete _0x4db5c6[_0xaa6a('0x25')];}_0x5a9e8b[_0xaa6a('0x16')](_0xceb371)['send'](_0x4db5c6);};}exports[_0xaa6a('0x26')]=function(_0x7b2296,_0x3831c9){var _0x3c3888={},_0x388074={},_0x11147f={'count':0x0,'rows':[]};var _0x1de4ab=_[_0xaa6a('0x27')](db[_0xaa6a('0x28')]['rawAttributes'],function(_0x52fec5){return{'name':_0x52fec5[_0xaa6a('0x29')],'type':_0x52fec5[_0xaa6a('0x2a')]['key']};});_0x388074[_0xaa6a('0x2b')]=_[_0xaa6a('0x27')](_0x1de4ab,'name');_0x388074['query']=_[_0xaa6a('0x2c')](_0x7b2296[_0xaa6a('0x2d')]);_0x388074[_0xaa6a('0x2e')]=_['intersection'](_0x388074['model'],_0x388074[_0xaa6a('0x2d')]);_0x3c3888['attributes']=_['intersection'](_0x388074[_0xaa6a('0x2b')],qs[_0xaa6a('0x2f')](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x2f')]));_0x3c3888[_0xaa6a('0x30')]=_0x3c3888[_0xaa6a('0x30')][_0xaa6a('0x31')]?_0x3c3888['attributes']:_0x388074[_0xaa6a('0x2b')];if(!_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x32')]('nolimit')){_0x3c3888['limit']=qs[_0xaa6a('0x1b')](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x1b')]);_0x3c3888[_0xaa6a('0x19')]=qs['offset'](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x19')]);}_0x3c3888[_0xaa6a('0x33')]=qs[_0xaa6a('0x34')](_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x34')]);_0x3c3888[_0xaa6a('0x35')]=qs[_0xaa6a('0x2e')](_[_0xaa6a('0x36')](_0x7b2296[_0xaa6a('0x2d')],_0x388074['filters']),_0x1de4ab);if(_0x7b2296['query'][_0xaa6a('0x37')]){_0x3c3888[_0xaa6a('0x35')]=_[_0xaa6a('0x38')](_0x3c3888[_0xaa6a('0x35')],{'$or':_[_0xaa6a('0x27')](_0x1de4ab,function(_0x48e85e){if(_0x48e85e[_0xaa6a('0x2a')]!==_0xaa6a('0x39')){var _0x2eb547={};_0x2eb547[_0x48e85e[_0xaa6a('0x25')]]={'$like':'%'+_0x7b2296['query'][_0xaa6a('0x37')]+'%'};return _0x2eb547;}})});}_0x3c3888=_[_0xaa6a('0x38')]({},_0x3c3888,_0x7b2296[_0xaa6a('0x3a')]);var _0x3fdc46={'where':_0x3c3888[_0xaa6a('0x35')]};return db[_0xaa6a('0x28')][_0xaa6a('0x1c')](_0x3fdc46)[_0xaa6a('0x21')](function(_0x12f0c6){_0x11147f[_0xaa6a('0x1c')]=_0x12f0c6;if(_0x7b2296[_0xaa6a('0x2d')][_0xaa6a('0x3b')]){_0x3c3888[_0xaa6a('0x3c')]=[{'all':!![]}];}return db[_0xaa6a('0x28')][_0xaa6a('0x3d')](_0x3c3888);})['then'](function(_0x18aec4){_0x11147f[_0xaa6a('0x3e')]=_0x18aec4;return _0x11147f;})[_0xaa6a('0x21')](respondWithFilteredResult(_0x3831c9,_0x3c3888))[_0xaa6a('0x3f')](handleError(_0x3831c9,null));};exports['show']=function(_0x303a49,_0x3b7ed6){var _0x5d1fff={'raw':!![],'where':{'id':_0x303a49[_0xaa6a('0x40')]['id']}},_0x33dbad={};_0x33dbad[_0xaa6a('0x2b')]=_['keys'](db[_0xaa6a('0x28')][_0xaa6a('0x41')]);_0x33dbad[_0xaa6a('0x2d')]=_['keys'](_0x303a49['query']);_0x33dbad['filters']=_['intersection'](_0x33dbad[_0xaa6a('0x2b')],_0x33dbad['query']);_0x5d1fff['attributes']=_[_0xaa6a('0x42')](_0x33dbad[_0xaa6a('0x2b')],qs[_0xaa6a('0x2f')](_0x303a49[_0xaa6a('0x2d')][_0xaa6a('0x2f')]));_0x5d1fff[_0xaa6a('0x30')]=_0x5d1fff[_0xaa6a('0x30')][_0xaa6a('0x31')]?_0x5d1fff[_0xaa6a('0x30')]:_0x33dbad[_0xaa6a('0x2b')];if(_0x303a49[_0xaa6a('0x2d')][_0xaa6a('0x3b')]){_0x5d1fff[_0xaa6a('0x3c')]=[{'all':!![]}];}_0x5d1fff=_['merge']({},_0x5d1fff,_0x303a49['options']);return db[_0xaa6a('0x28')][_0xaa6a('0x43')](_0x5d1fff)['then'](handleEntityNotFound(_0x3b7ed6,null))[_0xaa6a('0x21')](respondWithResult(_0x3b7ed6,null))['catch'](handleError(_0x3b7ed6,null));};exports[_0xaa6a('0x44')]=function(_0x32b5a2,_0x101bc7){return db[_0xaa6a('0x28')]['create'](_0x32b5a2['body'],{})[_0xaa6a('0x21')](respondWithResult(_0x101bc7,0xc9))[_0xaa6a('0x3f')](handleError(_0x101bc7,null));};exports['update']=function(_0x50d235,_0x32aa62){if(_0x50d235[_0xaa6a('0x45')]['id']){delete _0x50d235[_0xaa6a('0x45')]['id'];}return db[_0xaa6a('0x28')]['find']({'where':{'id':_0x50d235[_0xaa6a('0x40')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x32aa62,null))[_0xaa6a('0x21')](saveUpdates(_0x50d235[_0xaa6a('0x45')],null))[_0xaa6a('0x21')](respondWithResult(_0x32aa62,null))[_0xaa6a('0x3f')](handleError(_0x32aa62,null));};exports[_0xaa6a('0x22')]=function(_0x5ba429,_0x2484d6){return db[_0xaa6a('0x28')]['find']({'where':{'id':_0x5ba429[_0xaa6a('0x40')]['id']}})[_0xaa6a('0x21')](handleEntityNotFound(_0x2484d6,null))['then'](removeEntity(_0x2484d6,null))[_0xaa6a('0x3f')](handleError(_0x2484d6,null));};exports['describe']=function(_0x4a4a7f,_0x4f585b){return db['SquareReport'][_0xaa6a('0x46')]()[_0xaa6a('0x21')](respondWithResult(_0x4f585b,null))[_0xaa6a('0x3f')](handleError(_0x4f585b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 62290e9..57a5750 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 _0xe1f9=['uniqueid','leaveAt','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname'];(function(_0x582930,_0x595eb9){var _0x3de803=function(_0x264ae5){while(--_0x264ae5){_0x582930['push'](_0x582930['shift']());}};_0x3de803(++_0x595eb9);}(_0xe1f9,0x15e));var _0x9e1f=function(_0x24fbcc,_0x529487){_0x24fbcc=_0x24fbcc-0x0;var _0x2eaca4=_0xe1f9[_0x24fbcc];return _0x2eaca4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9e1f('0x0'));var BPromise=require(_0x9e1f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e1f('0x2'));var rimraf=require(_0x9e1f('0x3'));var config=require(_0x9e1f('0x4'));var attributes=require(_0x9e1f('0x5'));module['exports']=function(_0x154639,_0x2ead94){return _0x154639[_0x9e1f('0x6')](_0x9e1f('0x7'),attributes,{'tableName':_0x9e1f('0x8'),'paranoid':![],'indexes':[{'name':_0x9e1f('0x9'),'fields':[_0x9e1f('0xa'),'project_name']},{'name':_0x9e1f('0xb'),'fields':[_0x9e1f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1df=['../../config/environment','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x53a7c0,_0xc62e44){var _0x42a478=function(_0x477dec){while(--_0x477dec){_0x53a7c0['push'](_0x53a7c0['shift']());}};_0x42a478(++_0xc62e44);}(_0xf1df,0x88));var _0xff1d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf1df[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xff1d('0x0'));var util=require(_0xff1d('0x1'));var logger=require(_0xff1d('0x2'))(_0xff1d('0x3'));var moment=require(_0xff1d('0x4'));var BPromise=require(_0xff1d('0x5'));var rp=require(_0xff1d('0x6'));var fs=require('fs');var path=require(_0xff1d('0x7'));var rimraf=require('rimraf');var config=require(_0xff1d('0x8'));var attributes=require('./squareReport.attributes');module[_0xff1d('0x9')]=function(_0xade73a,_0x124e3e){return _0xade73a[_0xff1d('0xa')](_0xff1d('0xb'),attributes,{'tableName':_0xff1d('0xc'),'paranoid':![],'indexes':[{'name':_0xff1d('0xd'),'fields':['uniqueid',_0xff1d('0xe')]},{'name':_0xff1d('0xf'),'fields':[_0xff1d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 57423b9..4adca65 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 _0x8f81=['update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport'];(function(_0x1d84b1,_0x599872){var _0x54fa39=function(_0x48ef05){while(--_0x48ef05){_0x1d84b1['push'](_0x1d84b1['shift']());}};_0x54fa39(++_0x599872);}(_0x8f81,0x162));var _0x18f8=function(_0x57f1f4,_0x526065){_0x57f1f4=_0x57f1f4-0x0;var _0x2907b7=_0x8f81[_0x57f1f4];return _0x2907b7;};'use strict';var _=require(_0x18f8('0x0'));var util=require(_0x18f8('0x1'));var moment=require(_0x18f8('0x2'));var BPromise=require(_0x18f8('0x3'));var rs=require(_0x18f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x18f8('0x6'))(_0x18f8('0x7'));var config=require(_0x18f8('0x8'));var jayson=require(_0x18f8('0x9'));var client=jayson[_0x18f8('0xa')][_0x18f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b0bf7,_0x520d4e,_0x2a86cb){return new BPromise(function(_0x44799e,_0x7308de){return client[_0x18f8('0xc')](_0x2b0bf7,_0x2a86cb)[_0x18f8('0xd')](function(_0x230b31){logger['info'](_0x18f8('0xe'),_0x520d4e,_0x18f8('0xf'));logger[_0x18f8('0x10')](_0x18f8('0x11'),_0x520d4e,_0x18f8('0xf'),JSON[_0x18f8('0x12')](_0x230b31));if(_0x230b31[_0x18f8('0x13')]){if(_0x230b31[_0x18f8('0x13')][_0x18f8('0x14')]===0x1f4){logger[_0x18f8('0x13')](_0x18f8('0xe'),_0x520d4e,_0x230b31[_0x18f8('0x13')][_0x18f8('0x15')]);return _0x7308de(_0x230b31[_0x18f8('0x13')]['message']);}logger[_0x18f8('0x13')]('SquareReport,\x20%s,\x20%s',_0x520d4e,_0x230b31[_0x18f8('0x13')][_0x18f8('0x15')]);return _0x44799e(_0x230b31[_0x18f8('0x13')][_0x18f8('0x15')]);}else{logger[_0x18f8('0x16')](_0x18f8('0xe'),_0x520d4e,_0x18f8('0xf'));_0x44799e(_0x230b31[_0x18f8('0x17')][_0x18f8('0x15')]);}})[_0x18f8('0x18')](function(_0x34bdbc){logger[_0x18f8('0x13')](_0x18f8('0xe'),_0x520d4e,_0x34bdbc);_0x7308de(_0x34bdbc);});});}exports[_0x18f8('0x19')]=function(_0x37d1a1){var _0x524046=this;return new Promise(function(_0x516f0e,_0x4a8cd9){return db[_0x18f8('0x1a')]['create'](_0x37d1a1[_0x18f8('0x1b')],{'raw':_0x37d1a1[_0x18f8('0x1c')]?_0x37d1a1['options'][_0x18f8('0x1d')]===undefined?!![]:![]:!![]})[_0x18f8('0xd')](function(_0x21f9c3){logger[_0x18f8('0x16')](_0x18f8('0x19'),_0x37d1a1);logger['debug'](_0x18f8('0x19'),_0x37d1a1,JSON[_0x18f8('0x12')](_0x21f9c3));_0x516f0e(_0x21f9c3);})[_0x18f8('0x18')](function(_0x2ef361){logger[_0x18f8('0x13')](_0x18f8('0x19'),_0x2ef361[_0x18f8('0x15')],_0x37d1a1);_0x4a8cd9(_0x524046[_0x18f8('0x13')](0x1f4,_0x2ef361[_0x18f8('0x15')]));});});};exports[_0x18f8('0x1e')]=function(_0x1a3a9a){var _0x1cddb7=this;return new Promise(function(_0x3dddc1,_0x54a68c){return db[_0x18f8('0x1a')][_0x18f8('0x1f')](_0x1a3a9a[_0x18f8('0x1b')],{'raw':_0x1a3a9a['options']?_0x1a3a9a[_0x18f8('0x1c')][_0x18f8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a3a9a[_0x18f8('0x1c')]?_0x1a3a9a[_0x18f8('0x1c')][_0x18f8('0x20')]||null:null,'attributes':_0x1a3a9a[_0x18f8('0x1c')]?_0x1a3a9a[_0x18f8('0x1c')][_0x18f8('0x21')]||null:null,'limit':_0x1a3a9a[_0x18f8('0x1c')]?_0x1a3a9a[_0x18f8('0x1c')][_0x18f8('0x22')]||null:null})['then'](function(_0x375d56){logger[_0x18f8('0x16')]('UpdateSquareReport',_0x1a3a9a);logger['debug'](_0x18f8('0x1e'),_0x1a3a9a,JSON[_0x18f8('0x12')](_0x375d56));_0x3dddc1(_0x375d56);})[_0x18f8('0x18')](function(_0x4e7f96){logger[_0x18f8('0x13')](_0x18f8('0x1e'),_0x4e7f96[_0x18f8('0x15')],_0x1a3a9a);_0x54a68c(_0x1cddb7['error'](0x1f4,_0x4e7f96[_0x18f8('0x15')]));});});}; \ No newline at end of file +var _0x625f=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x595995,_0x4def88){var _0x1bf997=function(_0x2406f0){while(--_0x2406f0){_0x595995['push'](_0x595995['shift']());}};_0x1bf997(++_0x4def88);}(_0x625f,0x1e1));var _0xf625=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x625f[_0x29632e];return _0x426e04;};'use strict';var _=require('lodash');var util=require(_0xf625('0x0'));var moment=require('moment');var BPromise=require(_0xf625('0x1'));var rs=require(_0xf625('0x2'));var fs=require('fs');var Redis=require(_0xf625('0x3'));var db=require(_0xf625('0x4'))['db'];var utils=require(_0xf625('0x5'));var logger=require('../../config/logger')(_0xf625('0x6'));var config=require('../../config/environment');var jayson=require(_0xf625('0x7'));var client=jayson['client'][_0xf625('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3436de,_0x3af250,_0x45fcb1){return new BPromise(function(_0x3623f3,_0x591963){return client[_0xf625('0x9')](_0x3436de,_0x45fcb1)[_0xf625('0xa')](function(_0x420ecc){logger[_0xf625('0xb')](_0xf625('0xc'),_0x3af250,_0xf625('0xd'));logger[_0xf625('0xe')](_0xf625('0xf'),_0x3af250,_0xf625('0xd'),JSON[_0xf625('0x10')](_0x420ecc));if(_0x420ecc['error']){if(_0x420ecc[_0xf625('0x11')]['code']===0x1f4){logger[_0xf625('0x11')]('SquareReport,\x20%s,\x20%s',_0x3af250,_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);return _0x591963(_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);}logger[_0xf625('0x11')](_0xf625('0xc'),_0x3af250,_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);return _0x3623f3(_0x420ecc[_0xf625('0x11')][_0xf625('0x12')]);}else{logger[_0xf625('0xb')](_0xf625('0xc'),_0x3af250,'request\x20sent');_0x3623f3(_0x420ecc[_0xf625('0x13')][_0xf625('0x12')]);}})[_0xf625('0x14')](function(_0x1ad37b){logger['error'](_0xf625('0xc'),_0x3af250,_0x1ad37b);_0x591963(_0x1ad37b);});});}exports[_0xf625('0x15')]=function(_0x34d17f){var _0x44e7da=this;return new Promise(function(_0x2b746b,_0x4cd183){return db['SquareReport'][_0xf625('0x16')](_0x34d17f[_0xf625('0x17')],{'raw':_0x34d17f[_0xf625('0x18')]?_0x34d17f[_0xf625('0x18')][_0xf625('0x19')]===undefined?!![]:![]:!![]})[_0xf625('0xa')](function(_0x42cfbb){logger['info'](_0xf625('0x15'),_0x34d17f);logger[_0xf625('0xe')](_0xf625('0x15'),_0x34d17f,JSON['stringify'](_0x42cfbb));_0x2b746b(_0x42cfbb);})[_0xf625('0x14')](function(_0x3f959f){logger[_0xf625('0x11')](_0xf625('0x15'),_0x3f959f[_0xf625('0x12')],_0x34d17f);_0x4cd183(_0x44e7da[_0xf625('0x11')](0x1f4,_0x3f959f[_0xf625('0x12')]));});});};exports[_0xf625('0x1a')]=function(_0x4b3684){var _0x1d5be6=this;return new Promise(function(_0x103192,_0x3e6eea){return db[_0xf625('0x1b')]['update'](_0x4b3684[_0xf625('0x17')],{'raw':_0x4b3684[_0xf625('0x18')]?_0x4b3684[_0xf625('0x18')][_0xf625('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3684[_0xf625('0x18')]?_0x4b3684['options'][_0xf625('0x1c')]||null:null,'attributes':_0x4b3684[_0xf625('0x18')]?_0x4b3684[_0xf625('0x18')][_0xf625('0x1d')]||null:null,'limit':_0x4b3684[_0xf625('0x18')]?_0x4b3684[_0xf625('0x18')][_0xf625('0x1e')]||null:null})[_0xf625('0xa')](function(_0x12b588){logger[_0xf625('0xb')](_0xf625('0x1a'),_0x4b3684);logger[_0xf625('0xe')](_0xf625('0x1a'),_0x4b3684,JSON[_0xf625('0x10')](_0x12b588));_0x103192(_0x12b588);})[_0xf625('0x14')](function(_0x425fb3){logger[_0xf625('0x11')](_0xf625('0x1a'),_0x425fb3[_0xf625('0x12')],_0x4b3684);_0x3e6eea(_0x1d5be6['error'](0x1f4,_0x425fb3[_0xf625('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index fa812e2..e9dbab4 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 _0xe205=['./squareReportDetail.controller','get','index','/describe','isAuthenticated','/:id','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xe205,0x185));var _0x5e20=function(_0x38b163,_0x5230ce){_0x38b163=_0x38b163-0x0;var _0x39393a=_0xe205[_0x38b163];return _0x39393a;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require(_0x5e20('0x9'));var controller=require(_0x5e20('0xa'));router[_0x5e20('0xb')]('/',auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router[_0x5e20('0xb')](_0x5e20('0xd'),auth[_0x5e20('0xe')](),controller['describe']);router[_0x5e20('0xb')](_0x5e20('0xf'),auth[_0x5e20('0xe')](),controller['show']);router['post']('/',auth[_0x5e20('0xe')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0xf'),auth[_0x5e20('0xe')](),controller[_0x5e20('0x12')]);router['delete'](_0x5e20('0xf'),auth[_0x5e20('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcdf4=['delete','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','describe','get','/:id','create','put','update'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xcdf4,0x153));var _0x4cdf=function(_0x2fc75b,_0xc58375){_0x2fc75b=_0x2fc75b-0x0;var _0x45319a=_0xcdf4[_0x2fc75b];return _0x45319a;};'use strict';var multer=require('multer');var util=require(_0x4cdf('0x0'));var path=require('path');var timeout=require(_0x4cdf('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4cdf('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4cdf('0x3'));var config=require(_0x4cdf('0x4'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4cdf('0x5'),auth[_0x4cdf('0x6')](),controller[_0x4cdf('0x7')]);router[_0x4cdf('0x8')](_0x4cdf('0x9'),auth[_0x4cdf('0x6')](),controller['show']);router['post']('/',auth[_0x4cdf('0x6')](),controller[_0x4cdf('0xa')]);router[_0x4cdf('0xb')](_0x4cdf('0x9'),auth[_0x4cdf('0x6')](),controller[_0x4cdf('0xc')]);router[_0x4cdf('0xd')]('/:id',auth[_0x4cdf('0x6')](),controller[_0x4cdf('0xe')]);module[_0x4cdf('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6f6883d..21853e8 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 _0x3fcc=['exports','STRING','sequelize'];(function(_0x58dceb,_0x1784e7){var _0xe62a51=function(_0x121330){while(--_0x121330){_0x58dceb['push'](_0x58dceb['shift']());}};_0xe62a51(++_0x1784e7);}(_0x3fcc,0x104));var _0xc3fc=function(_0x2f201f,_0x5ecca7){_0x2f201f=_0x2f201f-0x0;var _0x2c38d2=_0x3fcc[_0x2f201f];return _0x2c38d2;};'use strict';var Sequelize=require(_0xc3fc('0x0'));module[_0xc3fc('0x1')]={'uniqueid':{'type':Sequelize[_0xc3fc('0x2')]},'node':{'type':Sequelize[_0xc3fc('0x2')]},'application':{'type':Sequelize[_0xc3fc('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc3fc('0x2')]}}; \ No newline at end of file +var _0x649b=['TEXT','exports','STRING'];(function(_0x1f16a5,_0x4cf74c){var _0x4a1e18=function(_0x25a61f){while(--_0x25a61f){_0x1f16a5['push'](_0x1f16a5['shift']());}};_0x4a1e18(++_0x4cf74c);}(_0x649b,0x15d));var _0xb649=function(_0x233126,_0x62a15){_0x233126=_0x233126-0x0;var _0x16da1a=_0x649b[_0x233126];return _0x16da1a;};'use strict';var Sequelize=require('sequelize');module[_0xb649('0x0')]={'uniqueid':{'type':Sequelize[_0xb649('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xb649('0x1')]},'data':{'type':Sequelize[_0xb649('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb649('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d90d971..cc5e723 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 _0x5a9b=['then','include','findAll','rows','catch','show','params','length','includeAll','merge','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','VIRTUAL','filter','options'];(function(_0x3fe7be,_0x413d60){var _0x534d83=function(_0x598a22){while(--_0x598a22){_0x3fe7be['push'](_0x3fe7be['shift']());}};_0x534d83(++_0x413d60);}(_0x5a9b,0x1b3));var _0xb5a9=function(_0x1e69ec,_0x231cf2){_0x1e69ec=_0x1e69ec-0x0;var _0x503657=_0x5a9b[_0x1e69ec];return _0x503657;};'use strict';var emlformat=require(_0xb5a9('0x0'));var rimraf=require(_0xb5a9('0x1'));var zipdir=require(_0xb5a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb5a9('0x4'));var util=require('util');var path=require(_0xb5a9('0x5'));var sox=require(_0xb5a9('0x6'));var csv=require('to-csv');var ejs=require(_0xb5a9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5a9('0x8'));var squel=require(_0xb5a9('0x9'));var crypto=require(_0xb5a9('0xa'));var jsforce=require(_0xb5a9('0xb'));var deskjs=require(_0xb5a9('0xc'));var toCsv=require(_0xb5a9('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb5a9('0xe'));var qs=require(_0xb5a9('0xf'));var as=require(_0xb5a9('0x10'));var hardwareService=require(_0xb5a9('0x11'));var logger=require(_0xb5a9('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb5a9('0x13'));var db=require(_0xb5a9('0x14'))['db'];function respondWithStatusCode(_0x40304d,_0x1390f2){_0x1390f2=_0x1390f2||0xcc;return function(_0x4b7cdb){if(_0x4b7cdb){return _0x40304d['sendStatus'](_0x1390f2);}return _0x40304d[_0xb5a9('0x15')](_0x1390f2)[_0xb5a9('0x16')]();};}function respondWithResult(_0xf51ead,_0x16d16f){_0x16d16f=_0x16d16f||0xc8;return function(_0x27115a){if(_0x27115a){return _0xf51ead[_0xb5a9('0x15')](_0x16d16f)[_0xb5a9('0x17')](_0x27115a);}};}function respondWithFilteredResult(_0x54a670,_0x2ea1a1){return function(_0x34825e){if(_0x34825e){var _0x315a98=typeof _0x2ea1a1[_0xb5a9('0x18')]===_0xb5a9('0x19')&&typeof _0x2ea1a1[_0xb5a9('0x1a')]===_0xb5a9('0x19');var _0x1c8138=_0x34825e[_0xb5a9('0x1b')];var _0x596802=_0x315a98?0x0:_0x2ea1a1[_0xb5a9('0x18')];var _0x215a96=_0x315a98?_0x34825e['count']:_0x2ea1a1[_0xb5a9('0x18')]+_0x2ea1a1[_0xb5a9('0x1a')];var _0x80394a;if(_0x215a96>=_0x1c8138){_0x215a96=_0x1c8138;_0x80394a=0xc8;}else{_0x80394a=0xce;}_0x54a670[_0xb5a9('0x15')](_0x80394a);return _0x54a670[_0xb5a9('0x1c')](_0xb5a9('0x1d'),_0x596802+'-'+_0x215a96+'/'+_0x1c8138)[_0xb5a9('0x17')](_0x34825e);}return null;};}function patchUpdates(_0x25bc3b){return function(_0x4f9d2d){try{jsonpatch[_0xb5a9('0x1e')](_0x4f9d2d,_0x25bc3b,!![]);}catch(_0x2c8d46){return BPromise[_0xb5a9('0x1f')](_0x2c8d46);}return _0x4f9d2d[_0xb5a9('0x20')]();};}function saveUpdates(_0x58fbd6,_0x31c389){return function(_0x13f702){if(_0x13f702){return _0x13f702['update'](_0x58fbd6)['then'](function(_0x40a8d7){return _0x40a8d7;});}return null;};}function removeEntity(_0x41eecf,_0x59996e){return function(_0x4b17bb){if(_0x4b17bb){return _0x4b17bb[_0xb5a9('0x21')]()['then'](function(){_0x41eecf['status'](0xcc)[_0xb5a9('0x16')]();});}};}function handleEntityNotFound(_0x108854,_0x18b3d2){return function(_0x1ba541){if(!_0x1ba541){_0x108854['sendStatus'](0x194);}return _0x1ba541;};}function handleError(_0x1acfb7,_0xd1dc34){_0xd1dc34=_0xd1dc34||0x1f4;return function(_0x17eee6){logger['error'](_0x17eee6[_0xb5a9('0x22')]);if(_0x17eee6[_0xb5a9('0x23')]){delete _0x17eee6[_0xb5a9('0x23')];}_0x1acfb7[_0xb5a9('0x15')](_0xd1dc34)[_0xb5a9('0x24')](_0x17eee6);};}exports['index']=function(_0x438b7,_0x31a563){var _0x594bf3={},_0x41fde6={},_0x5c9215={'count':0x0,'rows':[]};var _0x12686d=_['map'](db[_0xb5a9('0x25')][_0xb5a9('0x26')],function(_0x331a90){return{'name':_0x331a90[_0xb5a9('0x27')],'type':_0x331a90[_0xb5a9('0x28')][_0xb5a9('0x29')]};});_0x41fde6[_0xb5a9('0x2a')]=_['map'](_0x12686d,_0xb5a9('0x23'));_0x41fde6[_0xb5a9('0x2b')]=_[_0xb5a9('0x2c')](_0x438b7[_0xb5a9('0x2b')]);_0x41fde6[_0xb5a9('0x2d')]=_[_0xb5a9('0x2e')](_0x41fde6[_0xb5a9('0x2a')],_0x41fde6[_0xb5a9('0x2b')]);_0x594bf3[_0xb5a9('0x2f')]=_[_0xb5a9('0x2e')](_0x41fde6[_0xb5a9('0x2a')],qs[_0xb5a9('0x30')](_0x438b7[_0xb5a9('0x2b')]['fields']));_0x594bf3[_0xb5a9('0x2f')]=_0x594bf3[_0xb5a9('0x2f')]['length']?_0x594bf3[_0xb5a9('0x2f')]:_0x41fde6[_0xb5a9('0x2a')];if(!_0x438b7[_0xb5a9('0x2b')][_0xb5a9('0x31')]('nolimit')){_0x594bf3[_0xb5a9('0x1a')]=qs['limit'](_0x438b7[_0xb5a9('0x2b')][_0xb5a9('0x1a')]);_0x594bf3[_0xb5a9('0x18')]=qs['offset'](_0x438b7[_0xb5a9('0x2b')][_0xb5a9('0x18')]);}_0x594bf3['order']=qs['sort'](_0x438b7[_0xb5a9('0x2b')]['sort']);_0x594bf3[_0xb5a9('0x32')]=qs[_0xb5a9('0x2d')](_[_0xb5a9('0x33')](_0x438b7[_0xb5a9('0x2b')],_0x41fde6[_0xb5a9('0x2d')]),_0x12686d);if(_0x438b7[_0xb5a9('0x2b')]['filter']){_0x594bf3[_0xb5a9('0x32')]=_['merge'](_0x594bf3[_0xb5a9('0x32')],{'$or':_['map'](_0x12686d,function(_0x555d4a){if(_0x555d4a[_0xb5a9('0x28')]!==_0xb5a9('0x34')){var _0x46b5c3={};_0x46b5c3[_0x555d4a[_0xb5a9('0x23')]]={'$like':'%'+_0x438b7[_0xb5a9('0x2b')][_0xb5a9('0x35')]+'%'};return _0x46b5c3;}})});}_0x594bf3=_['merge']({},_0x594bf3,_0x438b7[_0xb5a9('0x36')]);var _0x447226={'where':_0x594bf3[_0xb5a9('0x32')]};return db[_0xb5a9('0x25')]['count'](_0x447226)[_0xb5a9('0x37')](function(_0x42d7dc){_0x5c9215['count']=_0x42d7dc;if(_0x438b7[_0xb5a9('0x2b')]['includeAll']){_0x594bf3[_0xb5a9('0x38')]=[{'all':!![]}];}return db[_0xb5a9('0x25')][_0xb5a9('0x39')](_0x594bf3);})[_0xb5a9('0x37')](function(_0x4daaba){_0x5c9215[_0xb5a9('0x3a')]=_0x4daaba;return _0x5c9215;})[_0xb5a9('0x37')](respondWithFilteredResult(_0x31a563,_0x594bf3))[_0xb5a9('0x3b')](handleError(_0x31a563,null));};exports[_0xb5a9('0x3c')]=function(_0x5018ba,_0x446975){var _0x58abd9={'raw':!![],'where':{'id':_0x5018ba[_0xb5a9('0x3d')]['id']}},_0x2e6519={};_0x2e6519[_0xb5a9('0x2a')]=_[_0xb5a9('0x2c')](db[_0xb5a9('0x25')][_0xb5a9('0x26')]);_0x2e6519['query']=_[_0xb5a9('0x2c')](_0x5018ba[_0xb5a9('0x2b')]);_0x2e6519[_0xb5a9('0x2d')]=_[_0xb5a9('0x2e')](_0x2e6519[_0xb5a9('0x2a')],_0x2e6519['query']);_0x58abd9['attributes']=_['intersection'](_0x2e6519[_0xb5a9('0x2a')],qs[_0xb5a9('0x30')](_0x5018ba['query']['fields']));_0x58abd9['attributes']=_0x58abd9[_0xb5a9('0x2f')][_0xb5a9('0x3e')]?_0x58abd9[_0xb5a9('0x2f')]:_0x2e6519[_0xb5a9('0x2a')];if(_0x5018ba[_0xb5a9('0x2b')][_0xb5a9('0x3f')]){_0x58abd9[_0xb5a9('0x38')]=[{'all':!![]}];}_0x58abd9=_[_0xb5a9('0x40')]({},_0x58abd9,_0x5018ba[_0xb5a9('0x36')]);return db[_0xb5a9('0x25')][_0xb5a9('0x41')](_0x58abd9)[_0xb5a9('0x37')](handleEntityNotFound(_0x446975,null))['then'](respondWithResult(_0x446975,null))['catch'](handleError(_0x446975,null));};exports[_0xb5a9('0x42')]=function(_0x322c25,_0x29f34f){return db['SquareDetailsReport'][_0xb5a9('0x42')](_0x322c25['body'],{})['then'](respondWithResult(_0x29f34f,0xc9))[_0xb5a9('0x3b')](handleError(_0x29f34f,null));};exports[_0xb5a9('0x43')]=function(_0x496993,_0x282166){if(_0x496993[_0xb5a9('0x44')]['id']){delete _0x496993[_0xb5a9('0x44')]['id'];}return db[_0xb5a9('0x25')][_0xb5a9('0x41')]({'where':{'id':_0x496993[_0xb5a9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x282166,null))[_0xb5a9('0x37')](saveUpdates(_0x496993['body'],null))['then'](respondWithResult(_0x282166,null))[_0xb5a9('0x3b')](handleError(_0x282166,null));};exports[_0xb5a9('0x21')]=function(_0x68afd5,_0x23349a){return db[_0xb5a9('0x25')][_0xb5a9('0x41')]({'where':{'id':_0x68afd5[_0xb5a9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23349a,null))['then'](removeEntity(_0x23349a,null))[_0xb5a9('0x3b')](handleError(_0x23349a,null));};exports[_0xb5a9('0x45')]=function(_0x1128ce,_0x1cefac){return db[_0xb5a9('0x25')][_0xb5a9('0x45')]()['then'](respondWithResult(_0x1cefac,null))['catch'](handleError(_0x1cefac,null));}; \ No newline at end of file +var _0xb01f=['pick','filter','where','merge','VIRTUAL','options','SquareDetailsReport','include','catch','show','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3c2889,_0x1f4fe2){var _0x24ebe0=function(_0x50b0f8){while(--_0x50b0f8){_0x3c2889['push'](_0x3c2889['shift']());}};_0x24ebe0(++_0x1f4fe2);}(_0xb01f,0xa5));var _0xfb01=function(_0x5ac5ee,_0x23bd4f){_0x5ac5ee=_0x5ac5ee-0x0;var _0x140189=_0xb01f[_0x5ac5ee];return _0x140189;};'use strict';var emlformat=require(_0xfb01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb01('0x1'));var jsonpatch=require(_0xfb01('0x2'));var rp=require(_0xfb01('0x3'));var moment=require(_0xfb01('0x4'));var BPromise=require(_0xfb01('0x5'));var Mustache=require('mustache');var util=require(_0xfb01('0x6'));var path=require(_0xfb01('0x7'));var sox=require(_0xfb01('0x8'));var csv=require('to-csv');var ejs=require(_0xfb01('0x9'));var fs=require('fs');var fs_extra=require(_0xfb01('0xa'));var _=require(_0xfb01('0xb'));var squel=require(_0xfb01('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb01('0xd'));var deskjs=require(_0xfb01('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfb01('0xf'));var Papa=require(_0xfb01('0x10'));var Redis=require('ioredis');var authService=require(_0xfb01('0x11'));var qs=require(_0xfb01('0x12'));var as=require(_0xfb01('0x13'));var hardwareService=require(_0xfb01('0x14'));var logger=require(_0xfb01('0x15'))(_0xfb01('0x16'));var utils=require('../../config/utils');var config=require(_0xfb01('0x17'));var licenseUtil=require(_0xfb01('0x18'));var db=require(_0xfb01('0x19'))['db'];function respondWithStatusCode(_0x247d1f,_0x3efb02){_0x3efb02=_0x3efb02||0xcc;return function(_0x1a2d2b){if(_0x1a2d2b){return _0x247d1f[_0xfb01('0x1a')](_0x3efb02);}return _0x247d1f[_0xfb01('0x1b')](_0x3efb02)[_0xfb01('0x1c')]();};}function respondWithResult(_0x562dac,_0x57fc75){_0x57fc75=_0x57fc75||0xc8;return function(_0x45a2b8){if(_0x45a2b8){return _0x562dac[_0xfb01('0x1b')](_0x57fc75)[_0xfb01('0x1d')](_0x45a2b8);}};}function respondWithFilteredResult(_0x51f7ee,_0xa443ff){return function(_0x2a2478){if(_0x2a2478){var _0x226337=typeof _0xa443ff[_0xfb01('0x1e')]===_0xfb01('0x1f')&&typeof _0xa443ff[_0xfb01('0x20')]==='undefined';var _0x1cef13=_0x2a2478['count'];var _0xcaeaa4=_0x226337?0x0:_0xa443ff[_0xfb01('0x1e')];var _0x56fe8f=_0x226337?_0x2a2478[_0xfb01('0x21')]:_0xa443ff[_0xfb01('0x1e')]+_0xa443ff[_0xfb01('0x20')];var _0x16a628;if(_0x56fe8f>=_0x1cef13){_0x56fe8f=_0x1cef13;_0x16a628=0xc8;}else{_0x16a628=0xce;}_0x51f7ee['status'](_0x16a628);return _0x51f7ee['set'](_0xfb01('0x22'),_0xcaeaa4+'-'+_0x56fe8f+'/'+_0x1cef13)['json'](_0x2a2478);}return null;};}function patchUpdates(_0x2f58e1){return function(_0x8a281){try{jsonpatch[_0xfb01('0x23')](_0x8a281,_0x2f58e1,!![]);}catch(_0x5b60f9){return BPromise[_0xfb01('0x24')](_0x5b60f9);}return _0x8a281['save']();};}function saveUpdates(_0x536d3,_0x585fea){return function(_0x1f206d){if(_0x1f206d){return _0x1f206d[_0xfb01('0x25')](_0x536d3)[_0xfb01('0x26')](function(_0x4646eb){return _0x4646eb;});}return null;};}function removeEntity(_0x557a3,_0x534fc8){return function(_0x14303d){if(_0x14303d){return _0x14303d[_0xfb01('0x27')]()[_0xfb01('0x26')](function(){_0x557a3[_0xfb01('0x1b')](0xcc)[_0xfb01('0x1c')]();});}};}function handleEntityNotFound(_0x3dc2b0,_0x3dfd26){return function(_0x2ee654){if(!_0x2ee654){_0x3dc2b0[_0xfb01('0x1a')](0x194);}return _0x2ee654;};}function handleError(_0x57a6db,_0x4999a9){_0x4999a9=_0x4999a9||0x1f4;return function(_0x49b950){logger[_0xfb01('0x28')](_0x49b950[_0xfb01('0x29')]);if(_0x49b950[_0xfb01('0x2a')]){delete _0x49b950[_0xfb01('0x2a')];}_0x57a6db[_0xfb01('0x1b')](_0x4999a9)[_0xfb01('0x2b')](_0x49b950);};}exports[_0xfb01('0x2c')]=function(_0x400da4,_0x34ee1c){var _0x591e0c={},_0x49dbf2={},_0x187968={'count':0x0,'rows':[]};var _0x5a7536=_[_0xfb01('0x2d')](db['SquareDetailsReport'][_0xfb01('0x2e')],function(_0x17ec9f){return{'name':_0x17ec9f['fieldName'],'type':_0x17ec9f[_0xfb01('0x2f')][_0xfb01('0x30')]};});_0x49dbf2[_0xfb01('0x31')]=_[_0xfb01('0x2d')](_0x5a7536,'name');_0x49dbf2[_0xfb01('0x32')]=_[_0xfb01('0x33')](_0x400da4[_0xfb01('0x32')]);_0x49dbf2[_0xfb01('0x34')]=_[_0xfb01('0x35')](_0x49dbf2[_0xfb01('0x31')],_0x49dbf2[_0xfb01('0x32')]);_0x591e0c[_0xfb01('0x36')]=_['intersection'](_0x49dbf2[_0xfb01('0x31')],qs[_0xfb01('0x37')](_0x400da4[_0xfb01('0x32')]['fields']));_0x591e0c[_0xfb01('0x36')]=_0x591e0c[_0xfb01('0x36')]['length']?_0x591e0c['attributes']:_0x49dbf2['model'];if(!_0x400da4[_0xfb01('0x32')][_0xfb01('0x38')](_0xfb01('0x39'))){_0x591e0c[_0xfb01('0x20')]=qs['limit'](_0x400da4[_0xfb01('0x32')]['limit']);_0x591e0c[_0xfb01('0x1e')]=qs[_0xfb01('0x1e')](_0x400da4[_0xfb01('0x32')]['offset']);}_0x591e0c[_0xfb01('0x3a')]=qs[_0xfb01('0x3b')](_0x400da4[_0xfb01('0x32')]['sort']);_0x591e0c['where']=qs['filters'](_[_0xfb01('0x3c')](_0x400da4[_0xfb01('0x32')],_0x49dbf2[_0xfb01('0x34')]),_0x5a7536);if(_0x400da4[_0xfb01('0x32')][_0xfb01('0x3d')]){_0x591e0c[_0xfb01('0x3e')]=_[_0xfb01('0x3f')](_0x591e0c[_0xfb01('0x3e')],{'$or':_[_0xfb01('0x2d')](_0x5a7536,function(_0x58623e){if(_0x58623e['type']!==_0xfb01('0x40')){var _0x4b5399={};_0x4b5399[_0x58623e[_0xfb01('0x2a')]]={'$like':'%'+_0x400da4[_0xfb01('0x32')]['filter']+'%'};return _0x4b5399;}})});}_0x591e0c=_[_0xfb01('0x3f')]({},_0x591e0c,_0x400da4[_0xfb01('0x41')]);var _0x45a947={'where':_0x591e0c[_0xfb01('0x3e')]};return db[_0xfb01('0x42')]['count'](_0x45a947)[_0xfb01('0x26')](function(_0x228275){_0x187968[_0xfb01('0x21')]=_0x228275;if(_0x400da4['query']['includeAll']){_0x591e0c[_0xfb01('0x43')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x591e0c);})['then'](function(_0x462bd2){_0x187968['rows']=_0x462bd2;return _0x187968;})[_0xfb01('0x26')](respondWithFilteredResult(_0x34ee1c,_0x591e0c))[_0xfb01('0x44')](handleError(_0x34ee1c,null));};exports[_0xfb01('0x45')]=function(_0x1866eb,_0x1b279f){var _0x1b9f12={'raw':!![],'where':{'id':_0x1866eb['params']['id']}},_0x2c5523={};_0x2c5523[_0xfb01('0x31')]=_['keys'](db[_0xfb01('0x42')]['rawAttributes']);_0x2c5523[_0xfb01('0x32')]=_[_0xfb01('0x33')](_0x1866eb[_0xfb01('0x32')]);_0x2c5523[_0xfb01('0x34')]=_['intersection'](_0x2c5523[_0xfb01('0x31')],_0x2c5523[_0xfb01('0x32')]);_0x1b9f12[_0xfb01('0x36')]=_[_0xfb01('0x35')](_0x2c5523[_0xfb01('0x31')],qs['fields'](_0x1866eb[_0xfb01('0x32')][_0xfb01('0x37')]));_0x1b9f12[_0xfb01('0x36')]=_0x1b9f12[_0xfb01('0x36')][_0xfb01('0x46')]?_0x1b9f12[_0xfb01('0x36')]:_0x2c5523[_0xfb01('0x31')];if(_0x1866eb[_0xfb01('0x32')]['includeAll']){_0x1b9f12[_0xfb01('0x43')]=[{'all':!![]}];}_0x1b9f12=_[_0xfb01('0x3f')]({},_0x1b9f12,_0x1866eb[_0xfb01('0x41')]);return db[_0xfb01('0x42')][_0xfb01('0x47')](_0x1b9f12)[_0xfb01('0x26')](handleEntityNotFound(_0x1b279f,null))[_0xfb01('0x26')](respondWithResult(_0x1b279f,null))[_0xfb01('0x44')](handleError(_0x1b279f,null));};exports[_0xfb01('0x48')]=function(_0x676cd7,_0xe85a95){return db[_0xfb01('0x42')][_0xfb01('0x48')](_0x676cd7['body'],{})['then'](respondWithResult(_0xe85a95,0xc9))[_0xfb01('0x44')](handleError(_0xe85a95,null));};exports[_0xfb01('0x25')]=function(_0x240527,_0x33d403){if(_0x240527[_0xfb01('0x49')]['id']){delete _0x240527[_0xfb01('0x49')]['id'];}return db[_0xfb01('0x42')][_0xfb01('0x47')]({'where':{'id':_0x240527[_0xfb01('0x4a')]['id']}})[_0xfb01('0x26')](handleEntityNotFound(_0x33d403,null))[_0xfb01('0x26')](saveUpdates(_0x240527[_0xfb01('0x49')],null))['then'](respondWithResult(_0x33d403,null))[_0xfb01('0x44')](handleError(_0x33d403,null));};exports[_0xfb01('0x27')]=function(_0x304d76,_0x48693a){return db[_0xfb01('0x42')]['find']({'where':{'id':_0x304d76['params']['id']}})[_0xfb01('0x26')](handleEntityNotFound(_0x48693a,null))['then'](removeEntity(_0x48693a,null))[_0xfb01('0x44')](handleError(_0x48693a,null));};exports['describe']=function(_0x48f29f,_0x3ab78d){return db[_0xfb01('0x42')]['describe']()['then'](respondWithResult(_0x3ab78d,null))[_0xfb01('0x44')](handleError(_0x3ab78d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1b20d11..e2f6519 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 _0xb6e4=['define','SquareDetailsReport','report_square_details','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x3045fb,_0x944098){var _0x17c684=function(_0xda47f3){while(--_0xda47f3){_0x3045fb['push'](_0x3045fb['shift']());}};_0x17c684(++_0x944098);}(_0xb6e4,0x1bb));var _0x4b6e=function(_0x34f4c,_0x3c2fcf){_0x34f4c=_0x34f4c-0x0;var _0x28c887=_0xb6e4[_0x34f4c];return _0x28c887;};'use strict';var _=require(_0x4b6e('0x0'));var util=require(_0x4b6e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b6e('0x2'));var BPromise=require('bluebird');var rp=require(_0x4b6e('0x3'));var fs=require('fs');var path=require(_0x4b6e('0x4'));var rimraf=require(_0x4b6e('0x5'));var config=require(_0x4b6e('0x6'));var attributes=require(_0x4b6e('0x7'));module['exports']=function(_0xe771de,_0x12f0c2){return _0xe771de[_0x4b6e('0x8')](_0x4b6e('0x9'),attributes,{'tableName':_0x4b6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf551=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x5650cb,_0x5b9132){var _0x13bc22=function(_0x2454e0){while(--_0x2454e0){_0x5650cb['push'](_0x5650cb['shift']());}};_0x13bc22(++_0x5b9132);}(_0xf551,0x1e6));var _0x1f55=function(_0x459546,_0x482824){_0x459546=_0x459546-0x0;var _0x493bb0=_0xf551[_0x459546];return _0x493bb0;};'use strict';var _=require(_0x1f55('0x0'));var util=require(_0x1f55('0x1'));var logger=require(_0x1f55('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f55('0x3'));var rp=require(_0x1f55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f55('0x5'));var config=require(_0x1f55('0x6'));var attributes=require(_0x1f55('0x7'));module[_0x1f55('0x8')]=function(_0x3d9768,_0x5cfb9d){return _0x3d9768[_0x1f55('0x9')](_0x1f55('0xa'),attributes,{'tableName':_0x1f55('0xb'),'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 4ad4637..c373008 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 _0xa1cc=['then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options'];(function(_0x17c770,_0x2474f0){var _0x384c0e=function(_0x3e0640){while(--_0x3e0640){_0x17c770['push'](_0x17c770['shift']());}};_0x384c0e(++_0x2474f0);}(_0xa1cc,0x10f));var _0xca1c=function(_0x5d5d0e,_0x4ae72d){_0x5d5d0e=_0x5d5d0e-0x0;var _0x2bc03c=_0xa1cc[_0x5d5d0e];return _0x2bc03c;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var moment=require(_0xca1c('0x2'));var BPromise=require('bluebird');var rs=require(_0xca1c('0x3'));var fs=require('fs');var Redis=require(_0xca1c('0x4'));var db=require(_0xca1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca1c('0x6'))('rpc');var config=require(_0xca1c('0x7'));var jayson=require(_0xca1c('0x8'));var client=jayson[_0xca1c('0x9')][_0xca1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d5101,_0x5132e2,_0x4ff3f7){return new BPromise(function(_0x8fc787,_0x21f118){return client['request'](_0x5d5101,_0x4ff3f7)['then'](function(_0x57807b){logger[_0xca1c('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x5132e2,_0xca1c('0xc'));logger[_0xca1c('0xd')](_0xca1c('0xe'),_0x5132e2,_0xca1c('0xc'),JSON[_0xca1c('0xf')](_0x57807b));if(_0x57807b['error']){if(_0x57807b[_0xca1c('0x10')][_0xca1c('0x11')]===0x1f4){logger['error'](_0xca1c('0x12'),_0x5132e2,_0x57807b['error'][_0xca1c('0x13')]);return _0x21f118(_0x57807b[_0xca1c('0x10')][_0xca1c('0x13')]);}logger['error'](_0xca1c('0x12'),_0x5132e2,_0x57807b[_0xca1c('0x10')]['message']);return _0x8fc787(_0x57807b['error'][_0xca1c('0x13')]);}else{logger[_0xca1c('0xb')](_0xca1c('0x12'),_0x5132e2,_0xca1c('0xc'));_0x8fc787(_0x57807b[_0xca1c('0x14')][_0xca1c('0x13')]);}})[_0xca1c('0x15')](function(_0x357321){logger[_0xca1c('0x10')](_0xca1c('0x12'),_0x5132e2,_0x357321);_0x21f118(_0x357321);});});}exports[_0xca1c('0x16')]=function(_0x10b126){var _0x14480c=this;return new Promise(function(_0x447547,_0x329244){return db[_0xca1c('0x17')]['create'](_0x10b126[_0xca1c('0x18')],{'raw':_0x10b126[_0xca1c('0x19')]?_0x10b126['options']['raw']===undefined?!![]:![]:!![]})[_0xca1c('0x1a')](function(_0x10f801){logger[_0xca1c('0xb')](_0xca1c('0x16'),_0x10b126);logger[_0xca1c('0xd')](_0xca1c('0x16'),_0x10b126,JSON[_0xca1c('0xf')](_0x10f801));_0x447547(_0x10f801);})['catch'](function(_0x115b4d){logger['error'](_0xca1c('0x16'),_0x115b4d[_0xca1c('0x13')],_0x10b126);_0x329244(_0x14480c[_0xca1c('0x10')](0x1f4,_0x115b4d[_0xca1c('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x2fd770,_0x2bccac){var _0x184848=function(_0xbe5951){while(--_0xbe5951){_0x2fd770['push'](_0x2fd770['shift']());}};_0x184848(++_0x2bccac);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c568e,_0xc5e4b0){_0x5c568e=_0x5c568e-0x0;var _0x5aff74=_0xb10b[_0x5c568e];return _0x5aff74;};'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')]('CreateSquareDetailsReport',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 50e3535..426a696 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 _0x9fde=['isAuthenticated','index','killProcess','express','Router','./system.controller','get'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x9fde,0x1d8));var _0xe9fd=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x9fde[_0x3de7e0];return _0x11d0b3;};'use strict';var express=require(_0xe9fd('0x0'));var router=express[_0xe9fd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe9fd('0x2'));router[_0xe9fd('0x3')]('/',auth[_0xe9fd('0x4')](),controller[_0xe9fd('0x5')]);router[_0xe9fd('0x3')]('/process/:pid/kill',auth[_0xe9fd('0x4')](),controller[_0xe9fd('0x6')]);module['exports']=router; \ No newline at end of file +var _0x5518=['/process/:pid/kill','exports','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x5518,0xb1));var _0x8551=function(_0xd7e1ac,_0x5d253b){_0xd7e1ac=_0xd7e1ac-0x0;var _0x270568=_0x5518[_0xd7e1ac];return _0x270568;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8551('0x0'));var controller=require(_0x8551('0x1'));router['get']('/',auth[_0x8551('0x2')](),controller[_0x8551('0x3')]);router[_0x8551('0x4')](_0x8551('0x5'),auth[_0x8551('0x2')](),controller['killProcess']);module[_0x8551('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5628d44..084e9c6 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 _0x2994=['api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger'];(function(_0x583bf0,_0x4b59aa){var _0x210ec6=function(_0x3a7abb){while(--_0x3a7abb){_0x583bf0['push'](_0x583bf0['shift']());}};_0x210ec6(++_0x4b59aa);}(_0x2994,0x101));var _0x4299=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x2994[_0x487ab4];return _0x3bef77;};'use strict';var info=require(_0x4299('0x0'));var exec=require(_0x4299('0x1'))[_0x4299('0x2')];var logger=require(_0x4299('0x3'))(_0x4299('0x4'));var util=require(_0x4299('0x5'));var BPromise=require(_0x4299('0x6'));var _=require(_0x4299('0x7'));function handleError(_0x192597,_0x1fff6d,_0x507453){_0x1fff6d=_0x1fff6d||0x1f4;return function(_0x554529){logger[_0x4299('0x8')](_0x4299('0x9'),_0x507453,_0x1fff6d,util[_0x4299('0xa')](_0x554529,{'showHidden':![],'depth':null}));delete _0x554529[_0x4299('0xb')];_0x192597[_0x4299('0xc')](_0x1fff6d)[_0x4299('0xd')](_0x554529);};}exports[_0x4299('0xe')]=function(_0x3364ad,_0x44d345){return info[_0x4299('0xf')]()[_0x4299('0x10')](function(_0x3c6e3d){return _0x44d345[_0x4299('0xc')](0xc8)[_0x4299('0x11')](_0x3c6e3d);})[_0x4299('0x12')](function(_0x4611ce){return _0x44d345[_0x4299('0xc')](0x1f4)[_0x4299('0x11')](_0x4611ce);});};exports['killProcess']=function(_0x3c8072,_0x254057){var _0x222418=[_0x4299('0x13')];return new BPromise(function(_0x29e4d2,_0x16ce61){return exec(util['format'](_0x4299('0x14'),_0x3c8072[_0x4299('0x15')]['pid']),function(_0x19cf1f,_0x17d585,_0x1d8184){if(_0x19cf1f){return _0x16ce61(_0x19cf1f);}return _0x29e4d2(_0x17d585);});})[_0x4299('0x10')](function(_0x6b74f7){var _0xabdb65=![];var _0x892877=_0x6b74f7[_0x4299('0x16')](/\n/);for(var _0x34e4c9=0x0,_0xa0de29=_0x222418[_0x4299('0x17')];_0x34e4c9<_0xa0de29,_0xabdb65===![];_0x34e4c9+=0x1){if(_0x6b74f7[_0x4299('0x18')](_0x222418[_0x34e4c9])>=0x0){_0xabdb65=!![];}}if(!_0xabdb65){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3c8072['params'][_0x4299('0x19')]));}process['kill'](_0x3c8072[_0x4299('0x15')][_0x4299('0x19')],_0x4299('0x1a'));return _0x254057['status'](0xc8)[_0x4299('0x11')]({'message':util['format'](_0x4299('0x1b'),_0x3c8072[_0x4299('0x15')][_0x4299('0x19')])});})[_0x4299('0x12')](handleError(_0x254057,null,_0x4299('0x1c')));}; \ No newline at end of file +var _0x06d5=['api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x06d5,0x134));var _0x506d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x06d5[_0x17d9e3];return _0x14192d;};'use strict';var info=require(_0x506d('0x0'));var exec=require(_0x506d('0x1'))[_0x506d('0x2')];var logger=require(_0x506d('0x3'))(_0x506d('0x4'));var util=require(_0x506d('0x5'));var BPromise=require('bluebird');var _=require(_0x506d('0x6'));function handleError(_0x1ca3ed,_0x4a6da1,_0x1d57c2){_0x4a6da1=_0x4a6da1||0x1f4;return function(_0x5a07e2){logger[_0x506d('0x7')](_0x506d('0x8'),_0x1d57c2,_0x4a6da1,util[_0x506d('0x9')](_0x5a07e2,{'showHidden':![],'depth':null}));delete _0x5a07e2[_0x506d('0xa')];_0x1ca3ed[_0x506d('0xb')](_0x4a6da1)[_0x506d('0xc')](_0x5a07e2);};}exports[_0x506d('0xd')]=function(_0x3b38ad,_0x16dda5){return info['getAllData']()[_0x506d('0xe')](function(_0x42c892){return _0x16dda5[_0x506d('0xb')](0xc8)['json'](_0x42c892);})[_0x506d('0xf')](function(_0x4e6338){return _0x16dda5[_0x506d('0xb')](0x1f4)['json'](_0x4e6338);});};exports[_0x506d('0x10')]=function(_0x8fcfe0,_0xa113cc){var _0x4ccf9e=['components/import/cm'];return new BPromise(function(_0x42df73,_0x3432eb){return exec(util[_0x506d('0x11')](_0x506d('0x12'),_0x8fcfe0[_0x506d('0x13')][_0x506d('0x14')]),function(_0x5d959f,_0x2716ea,_0x1728a8){if(_0x5d959f){return _0x3432eb(_0x5d959f);}return _0x42df73(_0x2716ea);});})[_0x506d('0xe')](function(_0xe0e297){var _0xcdf0b7=![];var _0x3a499e=_0xe0e297['split'](/\n/);for(var _0x122c91=0x0,_0x12ebbd=_0x4ccf9e['length'];_0x122c91<_0x12ebbd,_0xcdf0b7===![];_0x122c91+=0x1){if(_0xe0e297['indexOf'](_0x4ccf9e[_0x122c91])>=0x0){_0xcdf0b7=!![];}}if(!_0xcdf0b7){throw new Error(util['format'](_0x506d('0x15'),_0x8fcfe0[_0x506d('0x13')][_0x506d('0x14')]));}process[_0x506d('0x16')](_0x8fcfe0[_0x506d('0x13')][_0x506d('0x14')],'SIGINT');return _0xa113cc[_0x506d('0xb')](0xc8)['json']({'message':util['format'](_0x506d('0x17'),_0x8fcfe0[_0x506d('0x13')]['pid'])});})['catch'](handleError(_0xa113cc,null,_0x506d('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 813fef8..99cb6b0 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 _0xcd26=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','exports'];(function(_0x5bc6f0,_0x2296b0){var _0x34b12b=function(_0x3f4576){while(--_0x3f4576){_0x5bc6f0['push'](_0x5bc6f0['shift']());}};_0x34b12b(++_0x2296b0);}(_0xcd26,0x77));var _0x6cd2=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0xcd26[_0x584308];return _0x45865b;};'use strict';var multer=require('multer');var util=require(_0x6cd2('0x0'));var path=require('path');var timeout=require(_0x6cd2('0x1'));var express=require(_0x6cd2('0x2'));var router=express[_0x6cd2('0x3')]();var fs_extra=require(_0x6cd2('0x4'));var auth=require(_0x6cd2('0x5'));var interaction=require(_0x6cd2('0x6'));var config=require(_0x6cd2('0x7'));var controller=require('./tag.controller');router['get']('/',auth[_0x6cd2('0x8')](),controller[_0x6cd2('0x9')]);router[_0x6cd2('0xa')](_0x6cd2('0xb'),auth[_0x6cd2('0x8')](),controller['show']);router[_0x6cd2('0xc')]('/',auth['isAuthenticated'](),controller[_0x6cd2('0xd')]);router[_0x6cd2('0xe')](_0x6cd2('0xb'),auth['isAuthenticated'](),controller[_0x6cd2('0xf')]);router['delete'](_0x6cd2('0xb'),auth[_0x6cd2('0x8')](),controller['destroy']);module[_0x6cd2('0x10')]=router; \ No newline at end of file +var _0x6d5c=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x6d5c,0x179));var _0xc6d5=function(_0x46cd27,_0x290a56){_0x46cd27=_0x46cd27-0x0;var _0x2d030d=_0x6d5c[_0x46cd27];return _0x2d030d;};'use strict';var multer=require(_0xc6d5('0x0'));var util=require(_0xc6d5('0x1'));var path=require(_0xc6d5('0x2'));var timeout=require(_0xc6d5('0x3'));var express=require('express');var router=express[_0xc6d5('0x4')]();var fs_extra=require(_0xc6d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc6d5('0x6'));var config=require(_0xc6d5('0x7'));var controller=require(_0xc6d5('0x8'));router[_0xc6d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc6d5('0xa')]);router[_0xc6d5('0x9')](_0xc6d5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc6d5('0xc')]('/',auth[_0xc6d5('0xd')](),controller[_0xc6d5('0xe')]);router[_0xc6d5('0xf')](_0xc6d5('0xb'),auth[_0xc6d5('0xd')](),controller[_0xc6d5('0x10')]);router[_0xc6d5('0x11')]('/:id',auth[_0xc6d5('0xd')](),controller[_0xc6d5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 05db0ed..bcfa241 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 _0xbb35=['STRING','name','#0091EA','exports'];(function(_0x399a68,_0x32b703){var _0x283d8c=function(_0x22a206){while(--_0x22a206){_0x399a68['push'](_0x399a68['shift']());}};_0x283d8c(++_0x32b703);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x52bd5e,_0x35594a){_0x52bd5e=_0x52bd5e-0x0;var _0xa8ab1e=_0xbb35[_0x52bd5e];return _0xa8ab1e;};'use strict';var Sequelize=require('sequelize');module[_0x5bb3('0x0')]={'name':{'type':Sequelize[_0x5bb3('0x1')],'unique':_0x5bb3('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5bb3('0x1')],'defaultValue':_0x5bb3('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8603=['name','exports','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8603,0x190));var _0x3860=function(_0x1af5d2,_0xa9d37c){_0x1af5d2=_0x1af5d2-0x0;var _0x173993=_0x8603[_0x1af5d2];return _0x173993;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3860('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3255cbf..1d749c2 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 _0x1be1=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Tags','destroy','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','moment'];(function(_0x27d42d,_0x63daa5){var _0x2ed3d7=function(_0x59f494){while(--_0x59f494){_0x27d42d['push'](_0x27d42d['shift']());}};_0x2ed3d7(++_0x63daa5);}(_0x1be1,0x192));var _0x11be=function(_0x540ef1,_0x5f0cf4){_0x540ef1=_0x540ef1-0x0;var _0x419185=_0x1be1[_0x540ef1];return _0x419185;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['Tag'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));}; \ No newline at end of file +var _0xee24=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','create','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','Tag','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xee24,0x1a6));var _0x4ee2=function(_0x2b4629,_0x2cfe26){_0x2b4629=_0x2b4629-0x0;var _0x1d8fa9=_0xee24[_0x2b4629];return _0x1d8fa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee2('0x0'));var zipdir=require(_0x4ee2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ee2('0x2'));var moment=require(_0x4ee2('0x3'));var BPromise=require(_0x4ee2('0x4'));var Mustache=require(_0x4ee2('0x5'));var util=require('util');var path=require(_0x4ee2('0x6'));var sox=require(_0x4ee2('0x7'));var csv=require(_0x4ee2('0x8'));var ejs=require(_0x4ee2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee2('0xa'));var squel=require(_0x4ee2('0xb'));var crypto=require(_0x4ee2('0xc'));var jsforce=require(_0x4ee2('0xd'));var deskjs=require(_0x4ee2('0xe'));var toCsv=require(_0x4ee2('0x8'));var querystring=require(_0x4ee2('0xf'));var Papa=require(_0x4ee2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ee2('0x11'));var as=require(_0x4ee2('0x12'));var hardwareService=require(_0x4ee2('0x13'));var logger=require(_0x4ee2('0x14'))(_0x4ee2('0x15'));var utils=require('../../config/utils');var config=require(_0x4ee2('0x16'));var licenseUtil=require(_0x4ee2('0x17'));var db=require(_0x4ee2('0x18'))['db'];function respondWithStatusCode(_0x322780,_0x51f09d){_0x51f09d=_0x51f09d||0xcc;return function(_0x1f7125){if(_0x1f7125){return _0x322780[_0x4ee2('0x19')](_0x51f09d);}return _0x322780[_0x4ee2('0x1a')](_0x51f09d)[_0x4ee2('0x1b')]();};}function respondWithResult(_0x4f41cb,_0x481181){_0x481181=_0x481181||0xc8;return function(_0x2357c5){if(_0x2357c5){return _0x4f41cb[_0x4ee2('0x1a')](_0x481181)['json'](_0x2357c5);}};}function respondWithFilteredResult(_0x34dacb,_0x231d5){return function(_0x3c4279){if(_0x3c4279){var _0x1b95c5=typeof _0x231d5[_0x4ee2('0x1c')]===_0x4ee2('0x1d')&&typeof _0x231d5['limit']===_0x4ee2('0x1d');var _0xde92d=_0x3c4279[_0x4ee2('0x1e')];var _0x4aba2b=_0x1b95c5?0x0:_0x231d5[_0x4ee2('0x1c')];var _0xb8e027=_0x1b95c5?_0x3c4279[_0x4ee2('0x1e')]:_0x231d5[_0x4ee2('0x1c')]+_0x231d5[_0x4ee2('0x1f')];var _0x341ca3;if(_0xb8e027>=_0xde92d){_0xb8e027=_0xde92d;_0x341ca3=0xc8;}else{_0x341ca3=0xce;}_0x34dacb[_0x4ee2('0x1a')](_0x341ca3);return _0x34dacb[_0x4ee2('0x20')]('Content-Range',_0x4aba2b+'-'+_0xb8e027+'/'+_0xde92d)['json'](_0x3c4279);}return null;};}function patchUpdates(_0x33e66e){return function(_0x4901ff){try{jsonpatch[_0x4ee2('0x21')](_0x4901ff,_0x33e66e,!![]);}catch(_0x1d29bf){return BPromise[_0x4ee2('0x22')](_0x1d29bf);}return _0x4901ff[_0x4ee2('0x23')]();};}function saveUpdates(_0x4507d6,_0x53f246){return function(_0x1d5037){if(_0x1d5037){return _0x1d5037['update'](_0x4507d6)[_0x4ee2('0x24')](function(_0x3e6344){return _0x3e6344;});}return null;};}function removeEntity(_0x2560fe,_0x1f4f90){return function(_0x1ca982){if(_0x1ca982){return _0x1ca982[_0x4ee2('0x25')]()[_0x4ee2('0x24')](function(){var _0x581c75=_0x1ca982[_0x4ee2('0x26')]({'plain':!![]});var _0x5127b8='Tags';return db[_0x4ee2('0x27')][_0x4ee2('0x25')]({'where':{'type':_0x5127b8,'resourceId':_0x581c75['id']}})[_0x4ee2('0x24')](function(){return _0x1ca982;});})[_0x4ee2('0x24')](function(){_0x2560fe[_0x4ee2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50005e,_0x404fba){return function(_0x2a078f){if(!_0x2a078f){_0x50005e['sendStatus'](0x194);}return _0x2a078f;};}function handleError(_0x2fe02a,_0x5a052b){_0x5a052b=_0x5a052b||0x1f4;return function(_0x49b1be){logger['error'](_0x49b1be[_0x4ee2('0x28')]);if(_0x49b1be[_0x4ee2('0x29')]){delete _0x49b1be['name'];}_0x2fe02a[_0x4ee2('0x1a')](_0x5a052b)[_0x4ee2('0x2a')](_0x49b1be);};}exports['index']=function(_0xc7df80,_0x4bf072){var _0x239ab7={},_0x3a0881={},_0x1fea65={'count':0x0,'rows':[]};var _0x4da154=_['map'](db[_0x4ee2('0x2b')][_0x4ee2('0x2c')],function(_0x3ab2a1){return{'name':_0x3ab2a1['fieldName'],'type':_0x3ab2a1[_0x4ee2('0x2d')][_0x4ee2('0x2e')]};});_0x3a0881[_0x4ee2('0x2f')]=_[_0x4ee2('0x30')](_0x4da154,_0x4ee2('0x29'));_0x3a0881[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0xc7df80[_0x4ee2('0x31')]);_0x3a0881[_0x4ee2('0x33')]=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],_0x3a0881[_0x4ee2('0x31')]);_0x239ab7['attributes']=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],qs['fields'](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x239ab7[_0x4ee2('0x36')]=_0x239ab7[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x239ab7[_0x4ee2('0x36')]:_0x3a0881[_0x4ee2('0x2f')];if(!_0xc7df80['query'][_0x4ee2('0x38')](_0x4ee2('0x39'))){_0x239ab7[_0x4ee2('0x1f')]=qs['limit'](_0xc7df80[_0x4ee2('0x31')]['limit']);_0x239ab7[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x1c')]);}_0x239ab7[_0x4ee2('0x3a')]=qs[_0x4ee2('0x3b')](_0xc7df80['query']['sort']);_0x239ab7[_0x4ee2('0x3c')]=qs[_0x4ee2('0x33')](_[_0x4ee2('0x3d')](_0xc7df80[_0x4ee2('0x31')],_0x3a0881[_0x4ee2('0x33')]),_0x4da154);if(_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]){_0x239ab7[_0x4ee2('0x3c')]=_[_0x4ee2('0x3f')](_0x239ab7[_0x4ee2('0x3c')],{'$or':_['map'](_0x4da154,function(_0x492595){if(_0x492595[_0x4ee2('0x2d')]!==_0x4ee2('0x40')){var _0x1255ff={};_0x1255ff[_0x492595['name']]={'$like':'%'+_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]+'%'};return _0x1255ff;}})});}_0x239ab7=_[_0x4ee2('0x3f')]({},_0x239ab7,_0xc7df80[_0x4ee2('0x41')]);var _0x31901e={'where':_0x239ab7[_0x4ee2('0x3c')]};return db[_0x4ee2('0x2b')][_0x4ee2('0x1e')](_0x31901e)[_0x4ee2('0x24')](function(_0x2b099b){_0x1fea65['count']=_0x2b099b;if(_0xc7df80['query'][_0x4ee2('0x42')]){_0x239ab7[_0x4ee2('0x43')]=[{'all':!![]}];}return db[_0x4ee2('0x2b')]['findAll'](_0x239ab7);})[_0x4ee2('0x24')](function(_0x56fd09){_0x1fea65[_0x4ee2('0x44')]=_0x56fd09;return _0x1fea65;})['then'](respondWithFilteredResult(_0x4bf072,_0x239ab7))[_0x4ee2('0x45')](handleError(_0x4bf072,null));};exports[_0x4ee2('0x46')]=function(_0x41607a,_0x5bc5f3){var _0x58a5de={'raw':!![],'where':{'id':_0x41607a[_0x4ee2('0x47')]['id']}},_0x4e7a92={};_0x4e7a92[_0x4ee2('0x2f')]=_[_0x4ee2('0x32')](db[_0x4ee2('0x2b')]['rawAttributes']);_0x4e7a92[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x41607a['query']);_0x4e7a92[_0x4ee2('0x33')]=_['intersection'](_0x4e7a92['model'],_0x4e7a92[_0x4ee2('0x31')]);_0x58a5de['attributes']=_[_0x4ee2('0x34')](_0x4e7a92['model'],qs[_0x4ee2('0x35')](_0x41607a[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x58a5de['attributes']=_0x58a5de[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x58a5de[_0x4ee2('0x36')]:_0x4e7a92[_0x4ee2('0x2f')];if(_0x41607a[_0x4ee2('0x31')]['includeAll']){_0x58a5de[_0x4ee2('0x43')]=[{'all':!![]}];}_0x58a5de=_[_0x4ee2('0x3f')]({},_0x58a5de,_0x41607a['options']);return db['Tag'][_0x4ee2('0x48')](_0x58a5de)['then'](handleEntityNotFound(_0x5bc5f3,null))[_0x4ee2('0x24')](respondWithResult(_0x5bc5f3,null))[_0x4ee2('0x45')](handleError(_0x5bc5f3,null));};exports['create']=function(_0x43ca98,_0x2bf21a){return db[_0x4ee2('0x2b')]['create'](_0x43ca98[_0x4ee2('0x49')],{})[_0x4ee2('0x24')](function(_0x4f3fa6){var _0x5204b0=_0x43ca98['user']['get']({'plain':!![]});if(!_0x5204b0)throw new Error(_0x4ee2('0x4a'));if(_0x5204b0[_0x4ee2('0x4b')]==='user'){var _0x1379c0=_0x4f3fa6[_0x4ee2('0x26')]({'plain':!![]});var _0x391424=_0x4ee2('0x4c');return db[_0x4ee2('0x4d')][_0x4ee2('0x48')]({'where':{'name':_0x391424,'userProfileId':_0x5204b0[_0x4ee2('0x4e')]},'raw':!![]})['then'](function(_0x4498af){if(_0x4498af&&_0x4498af['autoAssociation']===0x0){return db[_0x4ee2('0x27')][_0x4ee2('0x4f')]({'name':_0x1379c0[_0x4ee2('0x29')],'resourceId':_0x1379c0['id'],'type':_0x4498af['name'],'sectionId':_0x4498af['id']},{})[_0x4ee2('0x24')](function(){return _0x4f3fa6;});}else{return _0x4f3fa6;}})[_0x4ee2('0x45')](function(_0x304d64){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x304d64);throw _0x304d64;});}return _0x4f3fa6;})[_0x4ee2('0x24')](respondWithResult(_0x2bf21a,0xc9))[_0x4ee2('0x45')](handleError(_0x2bf21a,null));};exports[_0x4ee2('0x50')]=function(_0x3df5b3,_0x5ee68c){if(_0x3df5b3[_0x4ee2('0x49')]['id']){delete _0x3df5b3[_0x4ee2('0x49')]['id'];}return db[_0x4ee2('0x2b')][_0x4ee2('0x48')]({'where':{'id':_0x3df5b3[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x5ee68c,null))[_0x4ee2('0x24')](saveUpdates(_0x3df5b3[_0x4ee2('0x49')],null))[_0x4ee2('0x24')](respondWithResult(_0x5ee68c,null))[_0x4ee2('0x45')](handleError(_0x5ee68c,null));};exports[_0x4ee2('0x25')]=function(_0x1a1021,_0x58dac3){return db['Tag'][_0x4ee2('0x48')]({'where':{'id':_0x1a1021[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x58dac3,null))['then'](removeEntity(_0x58dac3,null))['catch'](handleError(_0x58dac3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2ed039c..7097748 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 _0xc71a=['util','../../config/logger','api','moment','path','rimraf','./tag.attributes','lodash'];(function(_0x5ee243,_0x3a7ce4){var _0x2cd274=function(_0x3a0d8a){while(--_0x3a0d8a){_0x5ee243['push'](_0x5ee243['shift']());}};_0x2cd274(++_0x3a7ce4);}(_0xc71a,0x137));var _0xac71=function(_0x1c0221,_0x57e98d){_0x1c0221=_0x1c0221-0x0;var _0x3c1ab9=_0xc71a[_0x1c0221];return _0x3c1ab9;};'use strict';var _=require(_0xac71('0x0'));var util=require(_0xac71('0x1'));var logger=require(_0xac71('0x2'))(_0xac71('0x3'));var moment=require(_0xac71('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xac71('0x5'));var rimraf=require(_0xac71('0x6'));var config=require('../../config/environment');var attributes=require(_0xac71('0x7'));module['exports']=function(_0x5ac1ad,_0x2c0967){return _0x5ac1ad['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c07=['../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4a8356,_0x3007c3){var _0x46ac5d=function(_0x4e334c){while(--_0x4e334c){_0x4a8356['push'](_0x4a8356['shift']());}};_0x46ac5d(++_0x3007c3);}(_0x9c07,0x163));var _0x79c0=function(_0x34202f,_0x903ec){_0x34202f=_0x34202f-0x0;var _0xd09a92=_0x9c07[_0x34202f];return _0xd09a92;};'use strict';var _=require(_0x79c0('0x0'));var util=require(_0x79c0('0x1'));var logger=require(_0x79c0('0x2'))(_0x79c0('0x3'));var moment=require(_0x79c0('0x4'));var BPromise=require(_0x79c0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79c0('0x6'));var rimraf=require(_0x79c0('0x7'));var config=require(_0x79c0('0x8'));var attributes=require('./tag.attributes');module[_0x79c0('0x9')]=function(_0x1daa09,_0x50728e){return _0x1daa09[_0x79c0('0xa')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 4a2c19d..a78d746 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 _0x202c=['message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b1533,_0x27e66c){var _0x1ea41d=function(_0x56d2d7){while(--_0x56d2d7){_0x5b1533['push'](_0x5b1533['shift']());}};_0x1ea41d(++_0x27e66c);}(_0x202c,0x178));var _0xc202=function(_0x4763f7,_0x7c6950){_0x4763f7=_0x4763f7-0x0;var _0x5d419e=_0x202c[_0x4763f7];return _0x5d419e;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Tag,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});} \ No newline at end of file +var _0xfd0f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x73b415,_0x1c22f6){_0x73b415=_0x73b415-0x0;var _0x2f6072=_0xfd0f[_0x73b415];return _0x2f6072;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var moment=require('moment');var BPromise=require(_0xffd0('0x2'));var rs=require(_0xffd0('0x3'));var fs=require('fs');var Redis=require(_0xffd0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xffd0('0x5'));var logger=require('../../config/logger')(_0xffd0('0x6'));var config=require(_0xffd0('0x7'));var jayson=require(_0xffd0('0x8'));var client=jayson[_0xffd0('0x9')][_0xffd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b64a5,_0x2aaee6,_0x3fcf31){return new BPromise(function(_0x55488d,_0x4e2d54){return client[_0xffd0('0xb')](_0x1b64a5,_0x3fcf31)[_0xffd0('0xc')](function(_0x1b3842){logger[_0xffd0('0xd')]('Tag,\x20%s,\x20%s',_0x2aaee6,'request\x20sent');logger[_0xffd0('0xe')](_0xffd0('0xf'),_0x2aaee6,_0xffd0('0x10'),JSON['stringify'](_0x1b3842));if(_0x1b3842['error']){if(_0x1b3842[_0xffd0('0x11')][_0xffd0('0x12')]===0x1f4){logger['error'](_0xffd0('0x13'),_0x2aaee6,_0x1b3842[_0xffd0('0x11')][_0xffd0('0x14')]);return _0x4e2d54(_0x1b3842['error'][_0xffd0('0x14')]);}logger[_0xffd0('0x11')]('Tag,\x20%s,\x20%s',_0x2aaee6,_0x1b3842[_0xffd0('0x11')]['message']);return _0x55488d(_0x1b3842['error'][_0xffd0('0x14')]);}else{logger['info'](_0xffd0('0x13'),_0x2aaee6,_0xffd0('0x10'));_0x55488d(_0x1b3842[_0xffd0('0x15')][_0xffd0('0x14')]);}})[_0xffd0('0x16')](function(_0x5582df){logger['error'](_0xffd0('0x13'),_0x2aaee6,_0x5582df);_0x4e2d54(_0x5582df);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ae02ec3..cedec36 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 c2443c4..f332ffa 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x33a35d,_0x5cf6f1){var _0x1b6157=function(_0x5a8b49){while(--_0x5a8b49){_0x33a35d['push'](_0x33a35d['shift']());}};_0x1b6157(++_0x5cf6f1);}(_0x757a,0xde));var _0xa757=function(_0x2d0857,_0xf3190){_0x2d0857=_0x2d0857-0x0;var _0xa7b8a9=_0x757a[_0x2d0857];return _0xa7b8a9;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 818a5f8..cfec675 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 _0x08c3=['name','map','Team','rawAttributes','fieldName','type','key','keys','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','Sequelize','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','sendStatus','send','findOne','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','channel','add','Queues','ids','removeQueues','addAgents','isArray','Chat','Mail','Sms','Fax','transaction','Voice','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','upsert','isNil','SIP/%s','interface','voicePause','all','VoicePrefixId','removeAgents','Openchannel','Whatsapp','UserVoiceQueueRt','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack'];(function(_0x4b4bda,_0x5d75b3){var _0x126215=function(_0x3c8c6a){while(--_0x3c8c6a){_0x4b4bda['push'](_0x4b4bda['shift']());}};_0x126215(++_0x5d75b3);}(_0x08c3,0x6c));var _0x308c=function(_0xca54f9,_0x1d837b){_0xca54f9=_0xca54f9-0x0;var _0x183c63=_0x08c3[_0xca54f9];return _0x183c63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x308c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x308c('0x1'));var rp=require(_0x308c('0x2'));var moment=require(_0x308c('0x3'));var BPromise=require(_0x308c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x308c('0x5'));var sox=require(_0x308c('0x6'));var csv=require(_0x308c('0x7'));var ejs=require(_0x308c('0x8'));var fs=require('fs');var fs_extra=require(_0x308c('0x9'));var _=require('lodash');var squel=require(_0x308c('0xa'));var crypto=require(_0x308c('0xb'));var jsforce=require(_0x308c('0xc'));var deskjs=require(_0x308c('0xd'));var toCsv=require(_0x308c('0x7'));var querystring=require(_0x308c('0xe'));var Papa=require(_0x308c('0xf'));var Redis=require('ioredis');var authService=require(_0x308c('0x10'));var qs=require(_0x308c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x308c('0x12'));var logger=require(_0x308c('0x13'))(_0x308c('0x14'));var utils=require(_0x308c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x308c('0x16'));var db=require(_0x308c('0x17'))['db'];config[_0x308c('0x18')]=_[_0x308c('0x19')](config[_0x308c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x308c('0x1a'))(new Redis(config[_0x308c('0x18')]));require('./team.socket')[_0x308c('0x1b')](socket);function respondWithStatusCode(_0x527826,_0x9eced9){_0x9eced9=_0x9eced9||0xcc;return function(_0x9e5369){if(_0x9e5369){return _0x527826['sendStatus'](_0x9eced9);}return _0x527826[_0x308c('0x1c')](_0x9eced9)[_0x308c('0x1d')]();};}function respondWithResult(_0x443512,_0x4095e1){_0x4095e1=_0x4095e1||0xc8;return function(_0x2cf1d2){if(_0x2cf1d2){return _0x443512[_0x308c('0x1c')](_0x4095e1)[_0x308c('0x1e')](_0x2cf1d2);}};}function respondWithFilteredResult(_0x4913c8,_0x3b293e){return function(_0x5cc4ad){if(_0x5cc4ad){var _0x142466=typeof _0x3b293e[_0x308c('0x1f')]===_0x308c('0x20')&&typeof _0x3b293e[_0x308c('0x21')]===_0x308c('0x20');var _0x1b10d1=_0x5cc4ad[_0x308c('0x22')];var _0x46694d=_0x142466?0x0:_0x3b293e[_0x308c('0x1f')];var _0x152009=_0x142466?_0x5cc4ad[_0x308c('0x22')]:_0x3b293e[_0x308c('0x1f')]+_0x3b293e[_0x308c('0x21')];var _0x4f97b1;if(_0x152009>=_0x1b10d1){_0x152009=_0x1b10d1;_0x4f97b1=0xc8;}else{_0x4f97b1=0xce;}_0x4913c8[_0x308c('0x1c')](_0x4f97b1);return _0x4913c8[_0x308c('0x23')]('Content-Range',_0x46694d+'-'+_0x152009+'/'+_0x1b10d1)[_0x308c('0x1e')](_0x5cc4ad);}return null;};}function patchUpdates(_0x48c1db){return function(_0x11ae51){try{jsonpatch[_0x308c('0x24')](_0x11ae51,_0x48c1db,!![]);}catch(_0x3c1b77){return BPromise[_0x308c('0x25')](_0x3c1b77);}return _0x11ae51[_0x308c('0x26')]();};}function saveUpdates(_0x1e4981,_0x5efb34){return function(_0x1e7ab4){if(_0x1e7ab4){return _0x1e7ab4[_0x308c('0x27')](_0x1e4981)[_0x308c('0x28')](function(_0x2cc7e8){return _0x2cc7e8;});}return null;};}function handleEntityNotFound(_0x2ff1e7,_0x2f9e07){return function(_0x2f79ac){if(!_0x2f79ac){_0x2ff1e7['sendStatus'](0x194);}return _0x2f79ac;};}function handleError(_0x4ba155,_0x23165a){_0x23165a=_0x23165a||0x1f4;return function(_0xbf2d3){logger[_0x308c('0x29')](_0xbf2d3[_0x308c('0x2a')]);if(_0xbf2d3[_0x308c('0x2b')]){delete _0xbf2d3['name'];}_0x4ba155[_0x308c('0x1c')](_0x23165a)['send'](_0xbf2d3);};}exports['index']=function(_0x453f21,_0x5b7a77){var _0x5e822c={},_0x9acc3e={},_0x2965ec={'count':0x0,'rows':[]};var _0x4e3b6a=_[_0x308c('0x2c')](db[_0x308c('0x2d')][_0x308c('0x2e')],function(_0x3b6cc1){return{'name':_0x3b6cc1[_0x308c('0x2f')],'type':_0x3b6cc1[_0x308c('0x30')][_0x308c('0x31')]};});_0x9acc3e['model']=_[_0x308c('0x2c')](_0x4e3b6a,_0x308c('0x2b'));_0x9acc3e['query']=_[_0x308c('0x32')](_0x453f21['query']);_0x9acc3e[_0x308c('0x33')]=_[_0x308c('0x34')](_0x9acc3e['model'],_0x9acc3e[_0x308c('0x35')]);_0x5e822c[_0x308c('0x36')]=_['intersection'](_0x9acc3e['model'],qs[_0x308c('0x37')](_0x453f21[_0x308c('0x35')]['fields']));_0x5e822c[_0x308c('0x36')]=_0x5e822c[_0x308c('0x36')][_0x308c('0x38')]?_0x5e822c[_0x308c('0x36')]:_0x9acc3e[_0x308c('0x39')];if(!_0x453f21[_0x308c('0x35')][_0x308c('0x3a')]('nolimit')){_0x5e822c['limit']=qs[_0x308c('0x21')](_0x453f21[_0x308c('0x35')][_0x308c('0x21')]);_0x5e822c[_0x308c('0x1f')]=qs[_0x308c('0x1f')](_0x453f21[_0x308c('0x35')][_0x308c('0x1f')]);}_0x5e822c[_0x308c('0x3b')]=qs['sort'](_0x453f21[_0x308c('0x35')][_0x308c('0x3c')]);_0x5e822c[_0x308c('0x3d')]=qs['filters'](_[_0x308c('0x3e')](_0x453f21[_0x308c('0x35')],_0x9acc3e[_0x308c('0x33')]),_0x4e3b6a);if(_0x453f21[_0x308c('0x35')][_0x308c('0x3f')]){_0x5e822c['where']=_[_0x308c('0x40')](_0x5e822c[_0x308c('0x3d')],{'$or':_[_0x308c('0x2c')](_0x4e3b6a,function(_0x571091){if(_0x571091[_0x308c('0x30')]!==_0x308c('0x41')){var _0x50272f={};_0x50272f[_0x571091[_0x308c('0x2b')]]={'$like':'%'+_0x453f21[_0x308c('0x35')][_0x308c('0x3f')]+'%'};return _0x50272f;}})});}_0x5e822c=_[_0x308c('0x40')]({},_0x5e822c,_0x453f21[_0x308c('0x42')]);var _0x5d77c0={'where':_0x5e822c[_0x308c('0x3d')]};return db[_0x308c('0x2d')][_0x308c('0x22')](_0x5d77c0)[_0x308c('0x28')](function(_0xc3674d){_0x2965ec[_0x308c('0x22')]=_0xc3674d;if(_0x453f21[_0x308c('0x35')]['includeAll']){_0x5e822c['include']=[{'all':!![]}];}return db['Team'][_0x308c('0x43')](_0x5e822c);})[_0x308c('0x28')](function(_0x116f4e){_0x2965ec[_0x308c('0x44')]=_0x116f4e;return _0x2965ec;})[_0x308c('0x28')](respondWithFilteredResult(_0x5b7a77,_0x5e822c))[_0x308c('0x45')](handleError(_0x5b7a77,null));};exports[_0x308c('0x46')]=function(_0x54256a,_0xe22515){var _0x510c63={'raw':![],'where':{'id':_0x54256a[_0x308c('0x47')]['id']}},_0x6b6d89={};_0x6b6d89[_0x308c('0x39')]=_[_0x308c('0x32')](db[_0x308c('0x2d')][_0x308c('0x2e')]);_0x6b6d89['query']=_[_0x308c('0x32')](_0x54256a[_0x308c('0x35')]);_0x6b6d89[_0x308c('0x33')]=_[_0x308c('0x34')](_0x6b6d89[_0x308c('0x39')],_0x6b6d89[_0x308c('0x35')]);_0x510c63[_0x308c('0x36')]=_['intersection'](_0x6b6d89[_0x308c('0x39')],qs[_0x308c('0x37')](_0x54256a[_0x308c('0x35')][_0x308c('0x37')]));_0x510c63[_0x308c('0x36')]=_0x510c63[_0x308c('0x36')][_0x308c('0x38')]?_0x510c63[_0x308c('0x36')]:_0x6b6d89[_0x308c('0x39')];if(_0x54256a[_0x308c('0x35')][_0x308c('0x48')]){_0x510c63['include']=[{'all':!![]}];}_0x510c63=_[_0x308c('0x40')]({},_0x510c63,_0x54256a['options']);return db[_0x308c('0x2d')][_0x308c('0x49')](_0x510c63)[_0x308c('0x28')](handleEntityNotFound(_0xe22515,null))[_0x308c('0x28')](respondWithResult(_0xe22515,null))[_0x308c('0x45')](handleError(_0xe22515,null));};exports[_0x308c('0x4a')]=function(_0x396e77,_0x344e4a){return db[_0x308c('0x2d')]['create'](_0x396e77['body'],{})[_0x308c('0x28')](function(_0x553494){var _0x540166=_0x396e77['user']['get']({'plain':!![]});if(!_0x540166)throw new Error(_0x308c('0x4b'));if(_0x540166[_0x308c('0x4c')]===_0x308c('0x4d')){var _0x3c0749=_0x553494[_0x308c('0x4e')]({'plain':!![]});var _0x3e65cc=_0x308c('0x4f');return db[_0x308c('0x50')]['find']({'where':{'name':_0x3e65cc,'userProfileId':_0x540166['userProfileId']},'raw':!![]})['then'](function(_0x4665f0){if(_0x4665f0&&_0x4665f0[_0x308c('0x51')]===0x0){return db[_0x308c('0x52')][_0x308c('0x4a')]({'name':_0x3c0749['name'],'resourceId':_0x3c0749['id'],'type':_0x4665f0['name'],'sectionId':_0x4665f0['id']},{})[_0x308c('0x28')](function(){return _0x553494;});}else{return _0x553494;}})['catch'](function(_0x2a490e){logger['error'](_0x308c('0x53'),_0x2a490e);throw _0x2a490e;});}return _0x553494;})[_0x308c('0x28')](respondWithResult(_0x344e4a,0xc9))[_0x308c('0x45')](handleError(_0x344e4a,null));};exports[_0x308c('0x27')]=function(_0x28686a,_0x44206d){if(_0x28686a[_0x308c('0x54')]['id']){delete _0x28686a[_0x308c('0x54')]['id'];}return db['Team']['find']({'where':{'id':_0x28686a[_0x308c('0x47')]['id']}})['then'](handleEntityNotFound(_0x44206d,null))['then'](saveUpdates(_0x28686a['body'],null))[_0x308c('0x28')](respondWithResult(_0x44206d,null))[_0x308c('0x45')](handleError(_0x44206d,null));};exports[_0x308c('0x55')]=function(_0x4a47f3,_0x54d995){var _0x4ac71b=_0x4a47f3[_0x308c('0x47')]['id'];var _0xc3d9e5=[];return db[_0x308c('0x56')]['transaction'](function(_0x1a0302){var _0x1c5aa2=_0x308c('0x57')+_0x4ac71b;return db[_0x308c('0x56')][_0x308c('0x35')](_0x1c5aa2,{'type':db['Sequelize'][_0x308c('0x58')][_0x308c('0x59')],'raw':!![],'transaction':_0x1a0302})['then'](function(_0x1cf26d){_0xc3d9e5=_[_0x308c('0x2c')](_0x1cf26d,function(_0x5671f1){return Number(_0x5671f1[_0x308c('0x5a')]);});})[_0x308c('0x28')](function(){var _0x53be1e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4ac71b;return db['sequelize']['query'](_0x53be1e,{'type':db[_0x308c('0x5b')][_0x308c('0x58')][_0x308c('0x59')],'raw':!![],'transaction':_0x1a0302});})['then'](function(_0x432b47){var _0x48d19a=_[_0x308c('0x2c')](_0x432b47,function(_0x3b3d53){return Number(_0x3b3d53['VoiceQueueId']);});return db[_0x308c('0x5c')][_0x308c('0x55')]({'where':{'UserId':{'$in':_0xc3d9e5},'VoiceQueueId':{'$in':_0x48d19a}},'transaction':_0x1a0302});})['then'](function(){var _0x325857=_0x308c('0x5d')+_0x4ac71b;return db['sequelize'][_0x308c('0x35')](_0x325857,{'type':db[_0x308c('0x5b')][_0x308c('0x58')][_0x308c('0x59')],'raw':!![],'transaction':_0x1a0302});})[_0x308c('0x28')](function(_0xe9d85){var _0x15f777=_[_0x308c('0x2c')](_0xe9d85,function(_0x3f6d5d){return Number(_0x3f6d5d['MailQueueId']);});return db[_0x308c('0x5e')][_0x308c('0x55')]({'where':{'UserId':{'$in':_0xc3d9e5},'MailQueueId':{'$in':_0x15f777}},'transaction':_0x1a0302});})[_0x308c('0x28')](function(){var _0x11ad52=_0x308c('0x5f')+_0x4ac71b;return db[_0x308c('0x56')][_0x308c('0x35')](_0x11ad52,{'type':db['Sequelize'][_0x308c('0x58')][_0x308c('0x59')],'raw':!![],'transaction':_0x1a0302});})[_0x308c('0x28')](function(_0x3468aa){var _0x10b649=_[_0x308c('0x2c')](_0x3468aa,function(_0x3a470b){return Number(_0x3a470b[_0x308c('0x60')]);});return db['UserSmsQueue'][_0x308c('0x55')]({'where':{'UserId':{'$in':_0xc3d9e5},'SmsQueueId':{'$in':_0x10b649}},'transaction':_0x1a0302});})[_0x308c('0x28')](function(){var _0x4b7910=_0x308c('0x61')+_0x4ac71b;return db[_0x308c('0x56')]['query'](_0x4b7910,{'type':db[_0x308c('0x5b')][_0x308c('0x58')][_0x308c('0x59')],'raw':!![],'transaction':_0x1a0302});})[_0x308c('0x28')](function(_0x3917ea){var _0xf68a9b=_[_0x308c('0x2c')](_0x3917ea,function(_0x45f747){return Number(_0x45f747[_0x308c('0x62')]);});return db[_0x308c('0x63')]['destroy']({'where':{'UserId':{'$in':_0xc3d9e5},'ChatQueueId':{'$in':_0xf68a9b}},'transaction':_0x1a0302});})[_0x308c('0x28')](function(){var _0x1286b3=_0x308c('0x64')+_0x4ac71b;return db[_0x308c('0x56')][_0x308c('0x35')](_0x1286b3,{'type':db[_0x308c('0x5b')][_0x308c('0x58')]['SELECT'],'raw':!![],'transaction':_0x1a0302});})[_0x308c('0x28')](function(_0x13f9a7){var _0x44d0f5=_[_0x308c('0x2c')](_0x13f9a7,function(_0x4c61b9){return Number(_0x4c61b9['FaxQueueId']);});return db[_0x308c('0x65')][_0x308c('0x55')]({'where':{'UserId':{'$in':_0xc3d9e5},'FaxQueueId':{'$in':_0x44d0f5}},'transaction':_0x1a0302});})[_0x308c('0x28')](function(){var _0x15e31e=_0x308c('0x66')+_0x4ac71b;return db[_0x308c('0x56')]['query'](_0x15e31e,{'type':db['Sequelize'][_0x308c('0x58')]['SELECT'],'raw':!![],'transaction':_0x1a0302});})['then'](function(_0x187674){var _0x2101c3=_['map'](_0x187674,function(_0x1cd46c){return Number(_0x1cd46c[_0x308c('0x67')]);});return db[_0x308c('0x68')][_0x308c('0x55')]({'where':{'UserId':{'$in':_0xc3d9e5},'OpenchannelQueueId':{'$in':_0x2101c3}},'transaction':_0x1a0302});})['then'](function(){var _0x470fd7='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4ac71b;return db[_0x308c('0x56')][_0x308c('0x35')](_0x470fd7,{'type':db[_0x308c('0x5b')]['QueryTypes'][_0x308c('0x59')],'raw':!![],'transaction':_0x1a0302});})[_0x308c('0x28')](function(_0x23ee66){var _0x345777=_['map'](_0x23ee66,function(_0x22f698){return Number(_0x22f698[_0x308c('0x69')]);});return db[_0x308c('0x6a')][_0x308c('0x55')]({'where':{'UserId':{'$in':_0xc3d9e5},'WhatsappQueueId':{'$in':_0x345777}},'transaction':_0x1a0302});})['then'](function(){return db[_0x308c('0x6b')][_0x308c('0x49')]({'where':{'TeamId':_0x4ac71b}});})[_0x308c('0x28')](function(_0x12d7d4){if(_0x12d7d4===null){return;}return db[_0x308c('0x6c')]['destroy']({'where':{'UserId':{'$in':_0xc3d9e5},'VoicePrefixId':_0x12d7d4['VoicePrefixId']},'transaction':_0x1a0302});})[_0x308c('0x28')](function(){return db[_0x308c('0x2d')]['destroy']({'where':{'id':_0x4ac71b},'cascade':!![],'transaction':_0x1a0302});})[_0x308c('0x28')](function(_0x6dc671){if(_0x6dc671===0x0){_0x54d995[_0x308c('0x6d')](0x194);}else{return db[_0x308c('0x52')][_0x308c('0x55')]({'where':{'type':_0x308c('0x4f'),'resourceId':_0x4ac71b},'cascade':!![],'transaction':_0x1a0302})[_0x308c('0x28')](function(){_0x54d995[_0x308c('0x1c')](0xcc)[_0x308c('0x1d')]();});}})[_0x308c('0x45')](function(_0x30ee49){_0x54d995[_0x308c('0x1c')](0x1f4)[_0x308c('0x6e')](_0x30ee49);});});};exports['getQueues']=function(_0x152ca8,_0x9c0c5e,_0x397b6b){return db[_0x308c('0x2d')][_0x308c('0x6f')]({'where':{'id':_0x152ca8[_0x308c('0x47')]['id']}})[_0x308c('0x28')](handleEntityNotFound(_0x9c0c5e,null))[_0x308c('0x28')](function(_0x5f1682){if(!_0x152ca8[_0x308c('0x35')]['channel']||!utils[_0x308c('0x70')](_0x152ca8[_0x308c('0x35')]['channel'])){throw new db[(_0x308c('0x5b'))][(_0x308c('0x71'))](_0x308c('0x72'));}var _0x49e574={};var _0x4aa13b={};_0x4aa13b[_0x308c('0x39')]=_[_0x308c('0x32')](db[_[_0x308c('0x73')](_0x152ca8[_0x308c('0x35')]['channel'][_0x308c('0x74')]())+_0x308c('0x75')]['rawAttributes']);_0x4aa13b[_0x308c('0x35')]=_['keys'](_0x152ca8[_0x308c('0x35')]);_0x4aa13b[_0x308c('0x33')]=_[_0x308c('0x34')](_0x4aa13b['model'],_0x4aa13b[_0x308c('0x35')]);_0x49e574[_0x308c('0x36')]=_['intersection'](_0x4aa13b[_0x308c('0x39')],qs[_0x308c('0x37')](_0x152ca8['query'][_0x308c('0x37')]));_0x49e574[_0x308c('0x36')]=_0x49e574['attributes']['length']?_0x49e574[_0x308c('0x36')]:_0x4aa13b[_0x308c('0x39')];_0x49e574['limit']=qs[_0x308c('0x21')](_0x152ca8[_0x308c('0x35')][_0x308c('0x21')]);_0x49e574[_0x308c('0x1f')]=qs['offset'](_0x152ca8[_0x308c('0x35')]['offset']);_0x49e574[_0x308c('0x3b')]=qs[_0x308c('0x3c')](_0x152ca8['query'][_0x308c('0x3c')]);_0x49e574[_0x308c('0x3d')]=qs[_0x308c('0x33')](_[_0x308c('0x3e')](_0x152ca8['query'],_0x4aa13b[_0x308c('0x33')]));_0x49e574=_['merge']({},_0x49e574,_0x152ca8['options']);return _0x5f1682[_0x308c('0x4e')+_['capitalize'](_0x152ca8[_0x308c('0x35')]['channel'][_0x308c('0x74')]())+'Queues'](_0x49e574);})['then'](respondWithResult(_0x9c0c5e,null))[_0x308c('0x45')](handleError(_0x9c0c5e,null));};exports[_0x308c('0x76')]=function(_0x512454,_0x3371e7,_0x3ee54e){return db[_0x308c('0x2d')]['findOne']({'where':{'id':_0x512454[_0x308c('0x47')]['id']}})[_0x308c('0x28')](function(_0x5c32d0){if(_0x5c32d0){if(!_0x512454[_0x308c('0x54')][_0x308c('0x77')]||!utils[_0x308c('0x70')](_0x512454['body'][_0x308c('0x77')])){throw new db[(_0x308c('0x5b'))][(_0x308c('0x71'))](_0x308c('0x72'));}return _0x5c32d0[_0x308c('0x78')+_[_0x308c('0x73')](_0x512454['body']['channel'][_0x308c('0x74')]())+_0x308c('0x79')](_0x512454[_0x308c('0x54')][_0x308c('0x7a')]);}return null;})[_0x308c('0x28')](handleEntityNotFound(_0x3371e7,null))[_0x308c('0x28')](respondWithStatusCode(_0x3371e7,null))[_0x308c('0x45')](handleError(_0x3371e7,null));};exports[_0x308c('0x7b')]=function(_0x64bec6,_0x4399fd,_0x47ab97){return db[_0x308c('0x2d')]['findOne']({'where':{'id':_0x64bec6[_0x308c('0x47')]['id']}})['then'](function(_0x48ab7e){if(_0x48ab7e){if(!_0x64bec6[_0x308c('0x35')][_0x308c('0x77')]||!utils[_0x308c('0x70')](_0x64bec6[_0x308c('0x35')][_0x308c('0x77')])){throw new db[(_0x308c('0x5b'))][(_0x308c('0x71'))](_0x308c('0x72'));}return _0x48ab7e['remove'+_['capitalize'](_0x64bec6['query'][_0x308c('0x77')]['toLowerCase']())+'Queues'](_0x64bec6['query'][_0x308c('0x7a')]);}return null;})[_0x308c('0x28')](handleEntityNotFound(_0x4399fd,null))['then'](respondWithStatusCode(_0x4399fd,null))[_0x308c('0x45')](handleError(_0x4399fd,null));};exports[_0x308c('0x7c')]=function(_0x2af936,_0x49d934){var _0x2d4182=_[_0x308c('0x7d')](_0x2af936['body']['ids'])?_0x2af936[_0x308c('0x54')][_0x308c('0x7a')]:[_0x2af936['body'][_0x308c('0x7a')]];var _0x3f0e06=_0x2af936[_0x308c('0x47')]['id'];return db[_0x308c('0x2d')]['find']({'where':{'id':_0x3f0e06}})[_0x308c('0x28')](handleEntityNotFound(_0x49d934,null))[_0x308c('0x28')](function(_0x5490dd){if(_0x5490dd){var _0x4d27f5=['Voice',_0x308c('0x7e'),_0x308c('0x7f'),_0x308c('0x80'),_0x308c('0x81'),'Openchannel','Whatsapp'];return db['sequelize'][_0x308c('0x82')](function(_0x542c8a){var _0x24c6d0=_['map'](_0x4d27f5,function(_0x4ae08b){var _0x219221={'attributes':['id',_0x308c('0x2b')]};if(_0x4ae08b===_0x308c('0x83')){_0x219221['through']={'attributes':['penalty']};}return _0x5490dd[_0x308c('0x4e')+_0x4ae08b+_0x308c('0x79')](_0x219221)[_0x308c('0x28')](function(_0x1c35dc){var _0x5289d3=_[_0x308c('0x2c')](_0x1c35dc,function(_0x37183d){var _0x5f1180=_[_0x308c('0x2c')](_0x2d4182,function(_0x17851d){var _0x315544={'where':{'UserId':_0x17851d,[_0x4ae08b+_0x308c('0x84')]:_0x37183d['id']},'transaction':_0x542c8a};if(_0x4ae08b===_0x308c('0x83')){_0x315544[_0x308c('0x19')]={'penalty':_0x37183d[_0x308c('0x85')][_0x308c('0x86')]};}return db[_0x308c('0x87')+_0x4ae08b+'Queue'][_0x308c('0x88')](_0x315544)['then'](function(){socket[_0x308c('0x89')](_0x308c('0x4d')+_0x4ae08b+_0x308c('0x8a'),{'UserId':_0x17851d,[_0x4ae08b+_0x308c('0x84')]:_0x37183d['id']});if(_0x4ae08b!==_0x308c('0x83')){return;}return db[_0x308c('0x87')][_0x308c('0x43')]({'where':{'id':_0x2d4182,'online':0x1},'attributes':['id',_0x308c('0x2b'),'online','voicePause','interface'],'raw':!![]})[_0x308c('0x28')](function(_0x1fc7e4){var _0x1cbcaa=_[_0x308c('0x2c')](_0x1fc7e4,function(_0x51d1c5){return db['UserVoiceQueueRt'][_0x308c('0x8b')]({'membername':_0x51d1c5[_0x308c('0x2b')],'UserId':_0x51d1c5['id'],'queue_name':_0x37183d[_0x308c('0x2b')],'VoiceQueueId':_0x37183d['id'],'interface':_[_0x308c('0x8c')](_0x51d1c5['interface'])?util['format'](_0x308c('0x8d'),_0x51d1c5[_0x308c('0x2b')]):_0x51d1c5[_0x308c('0x8e')],'paused':_0x51d1c5[_0x308c('0x8f')]||![],'penalty':_0x37183d['TeamVoiceQueue'][_0x308c('0x86')]},{'transaction':_0x542c8a});});return Promise[_0x308c('0x90')](_0x1cbcaa);});});});return Promise[_0x308c('0x90')](_0x5f1180);});return Promise[_0x308c('0x90')](_0x5289d3);})[_0x308c('0x28')](function(){return db[_0x308c('0x6b')][_0x308c('0x6f')]({'where':{'teamId':_0x3f0e06}})[_0x308c('0x28')](function(_0x111c18){if(_0x111c18){var _0x555061=_[_0x308c('0x2c')](_0x2d4182,function(_0x14e7b3){db['UserVoicePrefix'][_0x308c('0x8b')]({'UserId':_0x14e7b3,'VoicePrefixId':_0x111c18[_0x308c('0x91')]});});return Promise[_0x308c('0x90')](_0x555061);}});});});return Promise['all'](_0x24c6d0)[_0x308c('0x28')](function(){return _0x5490dd['addAgents'](_0x2d4182,{'transaction':_0x542c8a})['spread'](function(_0x3825a1){return _0x3825a1;});});});}})[_0x308c('0x28')](respondWithResult(_0x49d934,null))[_0x308c('0x45')](handleError(_0x49d934,null));};exports[_0x308c('0x92')]=function(_0xe61aa2,_0x7b56fe){var _0xfb5eb4=_['isArray'](_0xe61aa2[_0x308c('0x35')][_0x308c('0x7a')])?_0xe61aa2[_0x308c('0x35')][_0x308c('0x7a')]:[_0xe61aa2[_0x308c('0x35')][_0x308c('0x7a')]];var _0x3ca629=_0xe61aa2[_0x308c('0x47')]['id'];return db[_0x308c('0x2d')][_0x308c('0x49')]({'where':{'id':_0x3ca629}})['then'](handleEntityNotFound(_0x7b56fe,null))[_0x308c('0x28')](function(_0x551136){if(_0x551136){var _0x17e371=[_0x308c('0x83'),_0x308c('0x7e'),_0x308c('0x7f'),_0x308c('0x80'),_0x308c('0x81'),_0x308c('0x93'),_0x308c('0x94')];return db[_0x308c('0x56')][_0x308c('0x82')](function(_0x13d380){var _0x43adf=_[_0x308c('0x2c')](_0x17e371,function(_0x3f45d3){var _0x13abaa={'attributes':['id','name']};return _0x551136['get'+_0x3f45d3+_0x308c('0x79')](_0x13abaa)[_0x308c('0x28')](function(_0x3a4d6d){var _0x17a25e=_[_0x308c('0x2c')](_0x3a4d6d,function(_0x1717f3){return _0x1717f3[_0x308c('0x92')](_0xfb5eb4,{'transaction':_0x13d380})[_0x308c('0x28')](function(){var _0x40cc70=_[_0x308c('0x2c')](_0xfb5eb4,function(_0x385cd2){socket[_0x308c('0x89')](_0x308c('0x4d')+_0x3f45d3+'Queue:remove',{'UserId':Number(_0x385cd2),[_0x3f45d3+_0x308c('0x84')]:_0x1717f3['id']});if(_0x3f45d3!==_0x308c('0x83')){return;}return db[_0x308c('0x95')]['destroy']({'where':{'VoiceQueueId':_0x1717f3['id'],'UserId':_0x385cd2},'transaction':_0x13d380});});return Promise[_0x308c('0x90')](_0x40cc70);});});return Promise[_0x308c('0x90')](_0x17a25e);});});return Promise[_0x308c('0x90')](_0x43adf)[_0x308c('0x28')](function(){return _0x551136[_0x308c('0x92')](_0xfb5eb4,{'transaction':_0x13d380});})[_0x308c('0x28')](function(){return db['TeamVoicePrefix'][_0x308c('0x6f')]({'where':{'teamId':_0x3ca629}})[_0x308c('0x28')](function(_0x5115c8){if(_0x5115c8){var _0x5a79d0=_[_0x308c('0x2c')](_0xfb5eb4,function(_0x2e468b){db[_0x308c('0x6c')][_0x308c('0x55')]({'where':{'UserId':_0x2e468b,'VoicePrefixId':_0x5115c8[_0x308c('0x91')]}});});return Promise[_0x308c('0x90')](_0x5a79d0);}});});});}})[_0x308c('0x28')](respondWithStatusCode(_0x7b56fe,null))[_0x308c('0x45')](handleError(_0x7b56fe,null));};exports[_0x308c('0x96')]=function(_0x5ba0e1,_0x3a36fd,_0x4287cb){var _0x3fc987={};var _0x146b4f={};var _0x5d138a;var _0x282e46;return db[_0x308c('0x2d')][_0x308c('0x6f')]({'where':{'id':_0x5ba0e1[_0x308c('0x47')]['id']}})[_0x308c('0x28')](handleEntityNotFound(_0x3a36fd,null))['then'](function(_0x4411e0){if(_0x4411e0){_0x5d138a=_0x4411e0;_0x146b4f[_0x308c('0x39')]=_[_0x308c('0x32')](db[_0x308c('0x87')][_0x308c('0x2e')]);_0x146b4f['query']=_[_0x308c('0x32')](_0x5ba0e1[_0x308c('0x35')]);_0x146b4f['filters']=_['intersection'](_0x146b4f[_0x308c('0x39')],_0x146b4f['query']);_0x3fc987[_0x308c('0x36')]=_[_0x308c('0x34')](_0x146b4f[_0x308c('0x39')],qs[_0x308c('0x37')](_0x5ba0e1[_0x308c('0x35')][_0x308c('0x37')]));_0x3fc987[_0x308c('0x36')]=_0x3fc987[_0x308c('0x36')][_0x308c('0x38')]?_0x3fc987[_0x308c('0x36')]:_0x146b4f[_0x308c('0x39')];_0x3fc987['order']=qs[_0x308c('0x3c')](_0x5ba0e1[_0x308c('0x35')][_0x308c('0x3c')]);_0x3fc987[_0x308c('0x3d')]=qs[_0x308c('0x33')](_['pick'](_0x5ba0e1[_0x308c('0x35')],_0x146b4f[_0x308c('0x33')]));if(_0x5ba0e1['query'][_0x308c('0x3f')]){_0x3fc987[_0x308c('0x3d')]=_[_0x308c('0x40')](_0x3fc987[_0x308c('0x3d')],{'$or':_[_0x308c('0x2c')](_0x3fc987[_0x308c('0x36')],function(_0x26d0ce){var _0x1b8f16={};_0x1b8f16[_0x26d0ce]={'$like':'%'+_0x5ba0e1[_0x308c('0x35')]['filter']+'%'};return _0x1b8f16;})});}_0x3fc987=_[_0x308c('0x40')]({},_0x3fc987,_0x5ba0e1[_0x308c('0x42')]);return _0x5d138a[_0x308c('0x96')](_0x3fc987);}})[_0x308c('0x28')](function(_0x4251ee){if(_0x4251ee){_0x282e46=_0x4251ee[_0x308c('0x38')];if(!_0x5ba0e1[_0x308c('0x35')][_0x308c('0x3a')]('nolimit')){_0x3fc987[_0x308c('0x21')]=qs['limit'](_0x5ba0e1[_0x308c('0x35')][_0x308c('0x21')]);_0x3fc987[_0x308c('0x1f')]=qs[_0x308c('0x1f')](_0x5ba0e1['query'][_0x308c('0x1f')]);}return _0x5d138a[_0x308c('0x96')](_0x3fc987);}})[_0x308c('0x28')](function(_0x36155a){if(_0x36155a){return _0x36155a?{'count':_0x282e46,'rows':_0x36155a}:null;}})[_0x308c('0x28')](respondWithResult(_0x3a36fd,null))[_0x308c('0x45')](handleError(_0x3a36fd,null));}; \ No newline at end of file +var _0x835a=['ValidationError','add','toLowerCase','ids','removeQueues','remove','isArray','Chat','Mail','Sms','Fax','Whatsapp','Voice','through','penalty','User','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','addAgents','spread','removeAgents','Openchannel','emit','TeamVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','Queues','addQueues','findOne'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x835a,0xc9));var _0xa835=function(_0x1c40f0,_0x281c8a){_0x1c40f0=_0x1c40f0-0x0;var _0x5970a4=_0x835a[_0x1c40f0];return _0x5970a4;};'use strict';var emlformat=require(_0xa835('0x0'));var rimraf=require(_0xa835('0x1'));var zipdir=require(_0xa835('0x2'));var jsonpatch=require(_0xa835('0x3'));var rp=require(_0xa835('0x4'));var moment=require(_0xa835('0x5'));var BPromise=require(_0xa835('0x6'));var Mustache=require(_0xa835('0x7'));var util=require('util');var path=require(_0xa835('0x8'));var sox=require(_0xa835('0x9'));var csv=require(_0xa835('0xa'));var ejs=require(_0xa835('0xb'));var fs=require('fs');var fs_extra=require(_0xa835('0xc'));var _=require(_0xa835('0xd'));var squel=require(_0xa835('0xe'));var crypto=require(_0xa835('0xf'));var jsforce=require(_0xa835('0x10'));var deskjs=require(_0xa835('0x11'));var toCsv=require(_0xa835('0xa'));var querystring=require(_0xa835('0x12'));var Papa=require('papaparse');var Redis=require(_0xa835('0x13'));var authService=require(_0xa835('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa835('0x15'));var logger=require(_0xa835('0x16'))(_0xa835('0x17'));var utils=require(_0xa835('0x18'));var config=require(_0xa835('0x19'));var licenseUtil=require(_0xa835('0x1a'));var db=require(_0xa835('0x1b'))['db'];config[_0xa835('0x1c')]=_[_0xa835('0x1d')](config[_0xa835('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa835('0x1e'))(new Redis(config[_0xa835('0x1c')]));require(_0xa835('0x1f'))[_0xa835('0x20')](socket);function respondWithStatusCode(_0x45fe18,_0xdd7412){_0xdd7412=_0xdd7412||0xcc;return function(_0x4605b3){if(_0x4605b3){return _0x45fe18['sendStatus'](_0xdd7412);}return _0x45fe18[_0xa835('0x21')](_0xdd7412)['end']();};}function respondWithResult(_0x547264,_0x109933){_0x109933=_0x109933||0xc8;return function(_0x549f0f){if(_0x549f0f){return _0x547264[_0xa835('0x21')](_0x109933)[_0xa835('0x22')](_0x549f0f);}};}function respondWithFilteredResult(_0x20a95b,_0x17a050){return function(_0x4d54a4){if(_0x4d54a4){var _0x641164=typeof _0x17a050[_0xa835('0x23')]===_0xa835('0x24')&&typeof _0x17a050[_0xa835('0x25')]==='undefined';var _0x234c14=_0x4d54a4['count'];var _0x20c629=_0x641164?0x0:_0x17a050[_0xa835('0x23')];var _0x4485cd=_0x641164?_0x4d54a4[_0xa835('0x26')]:_0x17a050[_0xa835('0x23')]+_0x17a050[_0xa835('0x25')];var _0x4fd2e7;if(_0x4485cd>=_0x234c14){_0x4485cd=_0x234c14;_0x4fd2e7=0xc8;}else{_0x4fd2e7=0xce;}_0x20a95b[_0xa835('0x21')](_0x4fd2e7);return _0x20a95b[_0xa835('0x27')](_0xa835('0x28'),_0x20c629+'-'+_0x4485cd+'/'+_0x234c14)[_0xa835('0x22')](_0x4d54a4);}return null;};}function patchUpdates(_0x457971){return function(_0x206fe1){try{jsonpatch[_0xa835('0x29')](_0x206fe1,_0x457971,!![]);}catch(_0x437bb5){return BPromise[_0xa835('0x2a')](_0x437bb5);}return _0x206fe1[_0xa835('0x2b')]();};}function saveUpdates(_0x410abb,_0x4b828e){return function(_0x33573a){if(_0x33573a){return _0x33573a[_0xa835('0x2c')](_0x410abb)[_0xa835('0x2d')](function(_0x1a3d06){return _0x1a3d06;});}return null;};}function handleEntityNotFound(_0x33636e,_0x1b5fb9){return function(_0x3f543a){if(!_0x3f543a){_0x33636e[_0xa835('0x2e')](0x194);}return _0x3f543a;};}function handleError(_0x11935b,_0x21e545){_0x21e545=_0x21e545||0x1f4;return function(_0xf1969b){logger['error'](_0xf1969b[_0xa835('0x2f')]);if(_0xf1969b['name']){delete _0xf1969b[_0xa835('0x30')];}_0x11935b[_0xa835('0x21')](_0x21e545)[_0xa835('0x31')](_0xf1969b);};}exports[_0xa835('0x32')]=function(_0x5deadb,_0x3416c6){var _0x132ca2={},_0x5edae6={},_0x1b1e73={'count':0x0,'rows':[]};var _0x1d0f75=_[_0xa835('0x33')](db[_0xa835('0x34')][_0xa835('0x35')],function(_0x11dc3a){return{'name':_0x11dc3a[_0xa835('0x36')],'type':_0x11dc3a[_0xa835('0x37')]['key']};});_0x5edae6[_0xa835('0x38')]=_[_0xa835('0x33')](_0x1d0f75,_0xa835('0x30'));_0x5edae6[_0xa835('0x39')]=_[_0xa835('0x3a')](_0x5deadb[_0xa835('0x39')]);_0x5edae6['filters']=_[_0xa835('0x3b')](_0x5edae6[_0xa835('0x38')],_0x5edae6['query']);_0x132ca2[_0xa835('0x3c')]=_[_0xa835('0x3b')](_0x5edae6[_0xa835('0x38')],qs['fields'](_0x5deadb[_0xa835('0x39')][_0xa835('0x3d')]));_0x132ca2[_0xa835('0x3c')]=_0x132ca2['attributes']['length']?_0x132ca2[_0xa835('0x3c')]:_0x5edae6[_0xa835('0x38')];if(!_0x5deadb['query'][_0xa835('0x3e')](_0xa835('0x3f'))){_0x132ca2[_0xa835('0x25')]=qs[_0xa835('0x25')](_0x5deadb[_0xa835('0x39')][_0xa835('0x25')]);_0x132ca2[_0xa835('0x23')]=qs[_0xa835('0x23')](_0x5deadb[_0xa835('0x39')][_0xa835('0x23')]);}_0x132ca2[_0xa835('0x40')]=qs[_0xa835('0x41')](_0x5deadb[_0xa835('0x39')]['sort']);_0x132ca2['where']=qs[_0xa835('0x42')](_[_0xa835('0x43')](_0x5deadb['query'],_0x5edae6[_0xa835('0x42')]),_0x1d0f75);if(_0x5deadb['query'][_0xa835('0x44')]){_0x132ca2[_0xa835('0x45')]=_[_0xa835('0x46')](_0x132ca2['where'],{'$or':_[_0xa835('0x33')](_0x1d0f75,function(_0x871a2e){if(_0x871a2e[_0xa835('0x37')]!==_0xa835('0x47')){var _0x42efd0={};_0x42efd0[_0x871a2e[_0xa835('0x30')]]={'$like':'%'+_0x5deadb[_0xa835('0x39')][_0xa835('0x44')]+'%'};return _0x42efd0;}})});}_0x132ca2=_[_0xa835('0x46')]({},_0x132ca2,_0x5deadb[_0xa835('0x48')]);var _0x8e59d3={'where':_0x132ca2[_0xa835('0x45')]};return db[_0xa835('0x34')][_0xa835('0x26')](_0x8e59d3)[_0xa835('0x2d')](function(_0x3df089){_0x1b1e73['count']=_0x3df089;if(_0x5deadb[_0xa835('0x39')][_0xa835('0x49')]){_0x132ca2[_0xa835('0x4a')]=[{'all':!![]}];}return db[_0xa835('0x34')][_0xa835('0x4b')](_0x132ca2);})[_0xa835('0x2d')](function(_0x36338d){_0x1b1e73[_0xa835('0x4c')]=_0x36338d;return _0x1b1e73;})[_0xa835('0x2d')](respondWithFilteredResult(_0x3416c6,_0x132ca2))[_0xa835('0x4d')](handleError(_0x3416c6,null));};exports[_0xa835('0x4e')]=function(_0x29128e,_0x1ffec0){var _0x55230e={'raw':![],'where':{'id':_0x29128e[_0xa835('0x4f')]['id']}},_0xe7f4fc={};_0xe7f4fc[_0xa835('0x38')]=_[_0xa835('0x3a')](db[_0xa835('0x34')]['rawAttributes']);_0xe7f4fc[_0xa835('0x39')]=_[_0xa835('0x3a')](_0x29128e[_0xa835('0x39')]);_0xe7f4fc[_0xa835('0x42')]=_[_0xa835('0x3b')](_0xe7f4fc[_0xa835('0x38')],_0xe7f4fc[_0xa835('0x39')]);_0x55230e[_0xa835('0x3c')]=_[_0xa835('0x3b')](_0xe7f4fc[_0xa835('0x38')],qs['fields'](_0x29128e[_0xa835('0x39')][_0xa835('0x3d')]));_0x55230e[_0xa835('0x3c')]=_0x55230e[_0xa835('0x3c')][_0xa835('0x50')]?_0x55230e['attributes']:_0xe7f4fc['model'];if(_0x29128e['query'][_0xa835('0x49')]){_0x55230e['include']=[{'all':!![]}];}_0x55230e=_[_0xa835('0x46')]({},_0x55230e,_0x29128e['options']);return db[_0xa835('0x34')][_0xa835('0x51')](_0x55230e)[_0xa835('0x2d')](handleEntityNotFound(_0x1ffec0,null))['then'](respondWithResult(_0x1ffec0,null))[_0xa835('0x4d')](handleError(_0x1ffec0,null));};exports['create']=function(_0x593a41,_0x450be1){return db[_0xa835('0x34')][_0xa835('0x52')](_0x593a41[_0xa835('0x53')],{})[_0xa835('0x2d')](function(_0x35af93){var _0x155b9e=_0x593a41[_0xa835('0x54')][_0xa835('0x55')]({'plain':!![]});if(!_0x155b9e)throw new Error(_0xa835('0x56'));if(_0x155b9e[_0xa835('0x57')]===_0xa835('0x54')){var _0x2ea1a0=_0x35af93[_0xa835('0x55')]({'plain':!![]});var _0x4c8717=_0xa835('0x58');return db[_0xa835('0x59')][_0xa835('0x51')]({'where':{'name':_0x4c8717,'userProfileId':_0x155b9e[_0xa835('0x5a')]},'raw':!![]})['then'](function(_0x504ece){if(_0x504ece&&_0x504ece[_0xa835('0x5b')]===0x0){return db[_0xa835('0x5c')]['create']({'name':_0x2ea1a0[_0xa835('0x30')],'resourceId':_0x2ea1a0['id'],'type':_0x504ece[_0xa835('0x30')],'sectionId':_0x504ece['id']},{})[_0xa835('0x2d')](function(){return _0x35af93;});}else{return _0x35af93;}})['catch'](function(_0x3c2e2e){logger[_0xa835('0x5d')](_0xa835('0x5e'),_0x3c2e2e);throw _0x3c2e2e;});}return _0x35af93;})[_0xa835('0x2d')](respondWithResult(_0x450be1,0xc9))[_0xa835('0x4d')](handleError(_0x450be1,null));};exports['update']=function(_0x558eb4,_0x2396e6){if(_0x558eb4[_0xa835('0x53')]['id']){delete _0x558eb4[_0xa835('0x53')]['id'];}return db['Team'][_0xa835('0x51')]({'where':{'id':_0x558eb4[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](handleEntityNotFound(_0x2396e6,null))[_0xa835('0x2d')](saveUpdates(_0x558eb4[_0xa835('0x53')],null))[_0xa835('0x2d')](respondWithResult(_0x2396e6,null))['catch'](handleError(_0x2396e6,null));};exports[_0xa835('0x5f')]=function(_0x434994,_0xb931f4){var _0x312c2c=_0x434994['params']['id'];var _0x474d13=[];return db[_0xa835('0x60')][_0xa835('0x61')](function(_0x32dbb3){var _0x552c37=_0xa835('0x62')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x552c37,{'type':db[_0xa835('0x63')][_0xa835('0x64')][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3})[_0xa835('0x2d')](function(_0x38655f){_0x474d13=_[_0xa835('0x33')](_0x38655f,function(_0x3dc68b){return Number(_0x3dc68b[_0xa835('0x66')]);});})[_0xa835('0x2d')](function(){var _0x49d4a5='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x49d4a5,{'type':db['Sequelize'][_0xa835('0x64')]['SELECT'],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0xcdc686){var _0x2c20c4=_[_0xa835('0x33')](_0xcdc686,function(_0x256f7e){return Number(_0x256f7e[_0xa835('0x67')]);});return db[_0xa835('0x68')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'VoiceQueueId':{'$in':_0x2c20c4}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x69ca47=_0xa835('0x69')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x69ca47,{'type':db['Sequelize']['QueryTypes'][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x3c8252){var _0x3fded5=_[_0xa835('0x33')](_0x3c8252,function(_0xcf25e9){return Number(_0xcf25e9['MailQueueId']);});return db['UserMailQueue'][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'MailQueueId':{'$in':_0x3fded5}},'transaction':_0x32dbb3});})['then'](function(){var _0x2638f6='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x2638f6,{'type':db[_0xa835('0x63')]['QueryTypes'][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})['then'](function(_0x5aba89){var _0x1c12f2=_['map'](_0x5aba89,function(_0x34ff42){return Number(_0x34ff42[_0xa835('0x6a')]);});return db[_0xa835('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x474d13},'SmsQueueId':{'$in':_0x1c12f2}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x2407be=_0xa835('0x6c')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x2407be,{'type':db[_0xa835('0x63')][_0xa835('0x64')][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x4cde9f){var _0x3d6e36=_['map'](_0x4cde9f,function(_0x4261be){return Number(_0x4261be[_0xa835('0x6d')]);});return db[_0xa835('0x6e')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'ChatQueueId':{'$in':_0x3d6e36}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x5b6d5b=_0xa835('0x6f')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x5b6d5b,{'type':db['Sequelize'][_0xa835('0x64')]['SELECT'],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x2eb2fa){var _0x4f683b=_[_0xa835('0x33')](_0x2eb2fa,function(_0x5eccab){return Number(_0x5eccab[_0xa835('0x70')]);});return db[_0xa835('0x71')]['destroy']({'where':{'UserId':{'$in':_0x474d13},'FaxQueueId':{'$in':_0x4f683b}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x4b5ada=_0xa835('0x72')+_0x312c2c;return db['sequelize']['query'](_0x4b5ada,{'type':db[_0xa835('0x63')][_0xa835('0x64')][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})['then'](function(_0xabdd5a){var _0x28a1c6=_['map'](_0xabdd5a,function(_0x39c958){return Number(_0x39c958['OpenchannelQueueId']);});return db[_0xa835('0x73')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'OpenchannelQueueId':{'$in':_0x28a1c6}},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){var _0x4d903a=_0xa835('0x74')+_0x312c2c;return db[_0xa835('0x60')][_0xa835('0x39')](_0x4d903a,{'type':db[_0xa835('0x63')]['QueryTypes'][_0xa835('0x65')],'raw':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x322f5f){var _0x2112fc=_[_0xa835('0x33')](_0x322f5f,function(_0x3389ec){return Number(_0x3389ec[_0xa835('0x75')]);});return db[_0xa835('0x76')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'WhatsappQueueId':{'$in':_0x2112fc}},'transaction':_0x32dbb3});})['then'](function(){return db['TeamVoicePrefix'][_0xa835('0x51')]({'where':{'TeamId':_0x312c2c}});})['then'](function(_0x202597){if(_0x202597===null){return;}return db[_0xa835('0x77')][_0xa835('0x5f')]({'where':{'UserId':{'$in':_0x474d13},'VoicePrefixId':_0x202597[_0xa835('0x78')]},'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(){return db[_0xa835('0x34')][_0xa835('0x5f')]({'where':{'id':_0x312c2c},'cascade':!![],'transaction':_0x32dbb3});})[_0xa835('0x2d')](function(_0x5c4dfc){if(_0x5c4dfc===0x0){_0xb931f4[_0xa835('0x2e')](0x194);}else{return db[_0xa835('0x5c')][_0xa835('0x5f')]({'where':{'type':_0xa835('0x58'),'resourceId':_0x312c2c},'cascade':!![],'transaction':_0x32dbb3})[_0xa835('0x2d')](function(){_0xb931f4[_0xa835('0x21')](0xcc)[_0xa835('0x79')]();});}})[_0xa835('0x4d')](function(_0x2fbe3d){_0xb931f4[_0xa835('0x21')](0x1f4)[_0xa835('0x31')](_0x2fbe3d);});});};exports[_0xa835('0x7a')]=function(_0x26308a,_0x498859,_0x4189df){return db[_0xa835('0x34')]['findOne']({'where':{'id':_0x26308a[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](handleEntityNotFound(_0x498859,null))[_0xa835('0x2d')](function(_0x5e786a){if(!_0x26308a[_0xa835('0x39')][_0xa835('0x7b')]||!utils[_0xa835('0x7c')](_0x26308a[_0xa835('0x39')][_0xa835('0x7b')])){throw new db[(_0xa835('0x63'))]['ValidationError'](_0xa835('0x7d'));}var _0x45c40d={};var _0x33f911={};_0x33f911[_0xa835('0x38')]=_[_0xa835('0x3a')](db[_[_0xa835('0x7e')](_0x26308a[_0xa835('0x39')]['channel']['toLowerCase']())+_0xa835('0x7f')][_0xa835('0x35')]);_0x33f911['query']=_[_0xa835('0x3a')](_0x26308a[_0xa835('0x39')]);_0x33f911[_0xa835('0x42')]=_[_0xa835('0x3b')](_0x33f911['model'],_0x33f911[_0xa835('0x39')]);_0x45c40d['attributes']=_[_0xa835('0x3b')](_0x33f911[_0xa835('0x38')],qs[_0xa835('0x3d')](_0x26308a[_0xa835('0x39')][_0xa835('0x3d')]));_0x45c40d[_0xa835('0x3c')]=_0x45c40d[_0xa835('0x3c')][_0xa835('0x50')]?_0x45c40d[_0xa835('0x3c')]:_0x33f911[_0xa835('0x38')];_0x45c40d[_0xa835('0x25')]=qs[_0xa835('0x25')](_0x26308a[_0xa835('0x39')][_0xa835('0x25')]);_0x45c40d['offset']=qs['offset'](_0x26308a[_0xa835('0x39')][_0xa835('0x23')]);_0x45c40d[_0xa835('0x40')]=qs[_0xa835('0x41')](_0x26308a['query'][_0xa835('0x41')]);_0x45c40d[_0xa835('0x45')]=qs[_0xa835('0x42')](_[_0xa835('0x43')](_0x26308a[_0xa835('0x39')],_0x33f911[_0xa835('0x42')]));_0x45c40d=_[_0xa835('0x46')]({},_0x45c40d,_0x26308a[_0xa835('0x48')]);return _0x5e786a[_0xa835('0x55')+_[_0xa835('0x7e')](_0x26308a[_0xa835('0x39')]['channel']['toLowerCase']())+_0xa835('0x80')](_0x45c40d);})[_0xa835('0x2d')](respondWithResult(_0x498859,null))[_0xa835('0x4d')](handleError(_0x498859,null));};exports[_0xa835('0x81')]=function(_0x3de9cb,_0x21b087,_0x404f3e){return db['Team'][_0xa835('0x82')]({'where':{'id':_0x3de9cb['params']['id']}})[_0xa835('0x2d')](function(_0x15b50d){if(_0x15b50d){if(!_0x3de9cb[_0xa835('0x53')][_0xa835('0x7b')]||!utils[_0xa835('0x7c')](_0x3de9cb[_0xa835('0x53')]['channel'])){throw new db[(_0xa835('0x63'))][(_0xa835('0x83'))](_0xa835('0x7d'));}return _0x15b50d[_0xa835('0x84')+_[_0xa835('0x7e')](_0x3de9cb['body'][_0xa835('0x7b')][_0xa835('0x85')]())+_0xa835('0x80')](_0x3de9cb['body'][_0xa835('0x86')]);}return null;})[_0xa835('0x2d')](handleEntityNotFound(_0x21b087,null))[_0xa835('0x2d')](respondWithStatusCode(_0x21b087,null))[_0xa835('0x4d')](handleError(_0x21b087,null));};exports[_0xa835('0x87')]=function(_0x334170,_0x3db63a,_0x4a9498){return db[_0xa835('0x34')][_0xa835('0x82')]({'where':{'id':_0x334170[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](function(_0x7d8e53){if(_0x7d8e53){if(!_0x334170[_0xa835('0x39')]['channel']||!utils[_0xa835('0x7c')](_0x334170[_0xa835('0x39')]['channel'])){throw new db[(_0xa835('0x63'))][(_0xa835('0x83'))](_0xa835('0x7d'));}return _0x7d8e53[_0xa835('0x88')+_[_0xa835('0x7e')](_0x334170[_0xa835('0x39')]['channel'][_0xa835('0x85')]())+_0xa835('0x80')](_0x334170[_0xa835('0x39')][_0xa835('0x86')]);}return null;})[_0xa835('0x2d')](handleEntityNotFound(_0x3db63a,null))[_0xa835('0x2d')](respondWithStatusCode(_0x3db63a,null))[_0xa835('0x4d')](handleError(_0x3db63a,null));};exports['addAgents']=function(_0x2c6bb0,_0xa24e32){var _0x7e6bdd=_[_0xa835('0x89')](_0x2c6bb0['body'][_0xa835('0x86')])?_0x2c6bb0[_0xa835('0x53')][_0xa835('0x86')]:[_0x2c6bb0[_0xa835('0x53')][_0xa835('0x86')]];var _0x20c1f2=_0x2c6bb0[_0xa835('0x4f')]['id'];return db[_0xa835('0x34')][_0xa835('0x51')]({'where':{'id':_0x20c1f2}})[_0xa835('0x2d')](handleEntityNotFound(_0xa24e32,null))[_0xa835('0x2d')](function(_0xa73c6a){if(_0xa73c6a){var _0x31325a=['Voice',_0xa835('0x8a'),_0xa835('0x8b'),_0xa835('0x8c'),_0xa835('0x8d'),'Openchannel',_0xa835('0x8e')];return db[_0xa835('0x60')][_0xa835('0x61')](function(_0x201764){var _0x52f432=_[_0xa835('0x33')](_0x31325a,function(_0x2d43ba){var _0x28fc52={'attributes':['id',_0xa835('0x30')]};if(_0x2d43ba===_0xa835('0x8f')){_0x28fc52[_0xa835('0x90')]={'attributes':[_0xa835('0x91')]};}return _0xa73c6a[_0xa835('0x55')+_0x2d43ba+'Queues'](_0x28fc52)[_0xa835('0x2d')](function(_0x37e4ab){var _0x5e6d75=_[_0xa835('0x33')](_0x37e4ab,function(_0x606b42){var _0x2adb96=_[_0xa835('0x33')](_0x7e6bdd,function(_0x3fedb9){var _0x13a08f={'where':{'UserId':_0x3fedb9,[_0x2d43ba+'QueueId']:_0x606b42['id']},'transaction':_0x201764};if(_0x2d43ba===_0xa835('0x8f')){_0x13a08f[_0xa835('0x1d')]={'penalty':_0x606b42['TeamVoiceQueue'][_0xa835('0x91')]};}return db[_0xa835('0x92')+_0x2d43ba+_0xa835('0x7f')]['findOrCreate'](_0x13a08f)[_0xa835('0x2d')](function(){socket['emit'](_0xa835('0x54')+_0x2d43ba+_0xa835('0x93'),{'UserId':_0x3fedb9,[_0x2d43ba+_0xa835('0x94')]:_0x606b42['id']});if(_0x2d43ba!==_0xa835('0x8f')){return;}return db['User']['findAll']({'where':{'id':_0x7e6bdd,'online':0x1},'attributes':['id',_0xa835('0x30'),_0xa835('0x95'),_0xa835('0x96'),_0xa835('0x97')],'raw':!![]})[_0xa835('0x2d')](function(_0x284e54){var _0x20020f=_[_0xa835('0x33')](_0x284e54,function(_0x2991f3){return db[_0xa835('0x98')][_0xa835('0x99')]({'membername':_0x2991f3[_0xa835('0x30')],'UserId':_0x2991f3['id'],'queue_name':_0x606b42[_0xa835('0x30')],'VoiceQueueId':_0x606b42['id'],'interface':_[_0xa835('0x9a')](_0x2991f3[_0xa835('0x97')])?util[_0xa835('0x9b')](_0xa835('0x9c'),_0x2991f3[_0xa835('0x30')]):_0x2991f3[_0xa835('0x97')],'paused':_0x2991f3[_0xa835('0x96')]||![],'penalty':_0x606b42[_0xa835('0x9d')][_0xa835('0x91')]},{'transaction':_0x201764});});return Promise[_0xa835('0x9e')](_0x20020f);});});});return Promise[_0xa835('0x9e')](_0x2adb96);});return Promise[_0xa835('0x9e')](_0x5e6d75);})['then'](function(){return db['TeamVoicePrefix'][_0xa835('0x82')]({'where':{'teamId':_0x20c1f2}})[_0xa835('0x2d')](function(_0x567ea9){if(_0x567ea9){var _0x5d3151=_[_0xa835('0x33')](_0x7e6bdd,function(_0x3038ae){db['UserVoicePrefix'][_0xa835('0x99')]({'UserId':_0x3038ae,'VoicePrefixId':_0x567ea9['VoicePrefixId']});});return Promise[_0xa835('0x9e')](_0x5d3151);}});});});return Promise[_0xa835('0x9e')](_0x52f432)[_0xa835('0x2d')](function(){return _0xa73c6a[_0xa835('0x9f')](_0x7e6bdd,{'transaction':_0x201764})[_0xa835('0xa0')](function(_0x3d9d87){return _0x3d9d87;});});});}})[_0xa835('0x2d')](respondWithResult(_0xa24e32,null))[_0xa835('0x4d')](handleError(_0xa24e32,null));};exports[_0xa835('0xa1')]=function(_0x515bc4,_0x514c85){var _0x42de7e=_['isArray'](_0x515bc4[_0xa835('0x39')][_0xa835('0x86')])?_0x515bc4[_0xa835('0x39')][_0xa835('0x86')]:[_0x515bc4['query'][_0xa835('0x86')]];var _0x4e309e=_0x515bc4['params']['id'];return db[_0xa835('0x34')]['find']({'where':{'id':_0x4e309e}})[_0xa835('0x2d')](handleEntityNotFound(_0x514c85,null))[_0xa835('0x2d')](function(_0x460681){if(_0x460681){var _0x437303=['Voice',_0xa835('0x8a'),_0xa835('0x8b'),_0xa835('0x8c'),'Fax',_0xa835('0xa2'),'Whatsapp'];return db[_0xa835('0x60')]['transaction'](function(_0x4dceca){var _0x5bcab8=_[_0xa835('0x33')](_0x437303,function(_0x17f7aa){var _0x3bf078={'attributes':['id',_0xa835('0x30')]};return _0x460681['get'+_0x17f7aa+_0xa835('0x80')](_0x3bf078)[_0xa835('0x2d')](function(_0x3d34a1){var _0x535fda=_[_0xa835('0x33')](_0x3d34a1,function(_0x217a2c){return _0x217a2c[_0xa835('0xa1')](_0x42de7e,{'transaction':_0x4dceca})[_0xa835('0x2d')](function(){var _0x363aef=_[_0xa835('0x33')](_0x42de7e,function(_0x341531){socket[_0xa835('0xa3')](_0xa835('0x54')+_0x17f7aa+'Queue:remove',{'UserId':Number(_0x341531),[_0x17f7aa+_0xa835('0x94')]:_0x217a2c['id']});if(_0x17f7aa!==_0xa835('0x8f')){return;}return db[_0xa835('0x98')][_0xa835('0x5f')]({'where':{'VoiceQueueId':_0x217a2c['id'],'UserId':_0x341531},'transaction':_0x4dceca});});return Promise[_0xa835('0x9e')](_0x363aef);});});return Promise[_0xa835('0x9e')](_0x535fda);});});return Promise[_0xa835('0x9e')](_0x5bcab8)[_0xa835('0x2d')](function(){return _0x460681['removeAgents'](_0x42de7e,{'transaction':_0x4dceca});})[_0xa835('0x2d')](function(){return db[_0xa835('0xa4')]['findOne']({'where':{'teamId':_0x4e309e}})[_0xa835('0x2d')](function(_0x5a1265){if(_0x5a1265){var _0x7313de=_[_0xa835('0x33')](_0x42de7e,function(_0xc716d7){db[_0xa835('0x77')][_0xa835('0x5f')]({'where':{'UserId':_0xc716d7,'VoicePrefixId':_0x5a1265['VoicePrefixId']}});});return Promise[_0xa835('0x9e')](_0x7313de);}});});});}})['then'](respondWithStatusCode(_0x514c85,null))[_0xa835('0x4d')](handleError(_0x514c85,null));};exports['getAgents']=function(_0x4f00fa,_0x3ec31a,_0x4c4f6c){var _0x46bc8c={};var _0x311315={};var _0x368e29;var _0x3b794e;return db[_0xa835('0x34')][_0xa835('0x82')]({'where':{'id':_0x4f00fa[_0xa835('0x4f')]['id']}})[_0xa835('0x2d')](handleEntityNotFound(_0x3ec31a,null))[_0xa835('0x2d')](function(_0x499c4f){if(_0x499c4f){_0x368e29=_0x499c4f;_0x311315[_0xa835('0x38')]=_[_0xa835('0x3a')](db[_0xa835('0x92')][_0xa835('0x35')]);_0x311315[_0xa835('0x39')]=_[_0xa835('0x3a')](_0x4f00fa[_0xa835('0x39')]);_0x311315[_0xa835('0x42')]=_[_0xa835('0x3b')](_0x311315[_0xa835('0x38')],_0x311315[_0xa835('0x39')]);_0x46bc8c[_0xa835('0x3c')]=_[_0xa835('0x3b')](_0x311315['model'],qs['fields'](_0x4f00fa['query']['fields']));_0x46bc8c[_0xa835('0x3c')]=_0x46bc8c[_0xa835('0x3c')]['length']?_0x46bc8c['attributes']:_0x311315[_0xa835('0x38')];_0x46bc8c['order']=qs[_0xa835('0x41')](_0x4f00fa[_0xa835('0x39')]['sort']);_0x46bc8c[_0xa835('0x45')]=qs[_0xa835('0x42')](_[_0xa835('0x43')](_0x4f00fa[_0xa835('0x39')],_0x311315[_0xa835('0x42')]));if(_0x4f00fa[_0xa835('0x39')][_0xa835('0x44')]){_0x46bc8c[_0xa835('0x45')]=_['merge'](_0x46bc8c['where'],{'$or':_[_0xa835('0x33')](_0x46bc8c[_0xa835('0x3c')],function(_0x5a4485){var _0x2b78ce={};_0x2b78ce[_0x5a4485]={'$like':'%'+_0x4f00fa[_0xa835('0x39')][_0xa835('0x44')]+'%'};return _0x2b78ce;})});}_0x46bc8c=_[_0xa835('0x46')]({},_0x46bc8c,_0x4f00fa['options']);return _0x368e29[_0xa835('0xa5')](_0x46bc8c);}})[_0xa835('0x2d')](function(_0x41a98d){if(_0x41a98d){_0x3b794e=_0x41a98d[_0xa835('0x50')];if(!_0x4f00fa[_0xa835('0x39')][_0xa835('0x3e')](_0xa835('0x3f'))){_0x46bc8c['limit']=qs['limit'](_0x4f00fa[_0xa835('0x39')][_0xa835('0x25')]);_0x46bc8c[_0xa835('0x23')]=qs[_0xa835('0x23')](_0x4f00fa[_0xa835('0x39')][_0xa835('0x23')]);}return _0x368e29[_0xa835('0xa5')](_0x46bc8c);}})[_0xa835('0x2d')](function(_0x237159){if(_0x237159){return _0x237159?{'count':_0x3b794e,'rows':_0x237159}:null;}})[_0xa835('0x2d')](respondWithResult(_0x3ec31a,null))[_0xa835('0x4d')](handleError(_0x3ec31a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a43c9e0..0eadde9 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 _0xe839=['exports','events','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe839,0x1a5));var _0x9e83=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0xe839[_0x4b6507];return _0x2001ec;};'use strict';var EventEmitter=require(_0x9e83('0x0'));var Team=require('../../mysqldb')['db'][_0x9e83('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x9e83('0x2')](0x0);var events={'afterCreate':_0x9e83('0x3'),'afterUpdate':_0x9e83('0x4'),'afterDestroy':_0x9e83('0x5')};function emitEvent(_0x19cb00){return function(_0x544bfa,_0x57c0af,_0x1f179c){TeamEvents[_0x9e83('0x6')](_0x19cb00+':'+_0x544bfa['id'],_0x544bfa);TeamEvents[_0x9e83('0x6')](_0x19cb00,_0x544bfa);_0x1f179c(null);};}for(var e in events){if(events[_0x9e83('0x7')](e)){var event=events[e];Team[_0x9e83('0x8')](e,emitEvent(event));}}module[_0x9e83('0x9')]=TeamEvents; \ No newline at end of file +var _0x82ca=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ca,0x18a));var _0xa82c=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x82ca[_0x43776a];return _0x18eb8f;};'use strict';var EventEmitter=require(_0xa82c('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xa82c('0x1')](0x0);var events={'afterCreate':_0xa82c('0x2'),'afterUpdate':'update','afterDestroy':_0xa82c('0x3')};function emitEvent(_0x3398a0){return function(_0x37aa32,_0x5c24b0,_0x234b8){TeamEvents[_0xa82c('0x4')](_0x3398a0+':'+_0x37aa32['id'],_0x37aa32);TeamEvents[_0xa82c('0x4')](_0x3398a0,_0x37aa32);_0x234b8(null);};}for(var e in events){if(events[_0xa82c('0x5')](e)){var event=events[e];Team[_0xa82c('0x6')](e,emitEvent(event));}}module[_0xa82c('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 98f9c58..1a02a0d 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 _0x765d=['define','Team','teams','Fax','Mail','Sms','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0x765d,0x185));var _0xd765=function(_0x468f9b,_0xf6d3fa){_0x468f9b=_0x468f9b-0x0;var _0x5da3f6=_0x765d[_0x468f9b];return _0x5da3f6;};'use strict';var _=require(_0xd765('0x0'));var attributes=require(_0xd765('0x1'));function getQueuesByChannel(_0x15f4bd,_0x254f2c){var _0x1143a2=_0xd765('0x2')+_0x254f2c+_0xd765('0x3');return _0x15f4bd[_0x1143a2]()[_0xd765('0x4')](function(_0x2807c2){return _[_0xd765('0x5')](_0x2807c2,function(_0x23b1d4){_0x23b1d4[_0xd765('0x6')](_0xd765('0x7'),_0x254f2c);return _0x23b1d4;});})[_0xd765('0x8')](function(_0x3bfb32){throw _0x3bfb32;});}module[_0xd765('0x9')]=function(_0x5fbfd9){return _0x5fbfd9[_0xd765('0xa')](_0xd765('0xb'),attributes,{'tableName':_0xd765('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x36a877=this;var _0x4e06fe=['Chat',_0xd765('0xd'),_0xd765('0xe'),'Openchannel',_0xd765('0xf'),_0xd765('0x10'),_0xd765('0x11')];return Promise['resolve']()['then'](function(){var _0x4b5837=_[_0xd765('0x5')](_0x4e06fe,function(_0x954c60){return getQueuesByChannel(_0x36a877,_0x954c60);});return Promise[_0xd765('0x12')](_0x4b5837);})[_0xd765('0x8')](function(_0x1d2344){throw _0x1d2344;});}}});}; \ No newline at end of file +var _0x01e9=['define','Team','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','all','Queues','then','map','setDataValue','channel','catch','exports'];(function(_0x2e1777,_0x1f056a){var _0x35628f=function(_0x50499e){while(--_0x50499e){_0x2e1777['push'](_0x2e1777['shift']());}};_0x35628f(++_0x1f056a);}(_0x01e9,0x129));var _0x901e=function(_0x796ad,_0x14500b){_0x796ad=_0x796ad-0x0;var _0x2c0004=_0x01e9[_0x796ad];return _0x2c0004;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x523f21,_0x3fc9ab){var _0x3f8042='get'+_0x3fc9ab+_0x901e('0x0');return _0x523f21[_0x3f8042]()[_0x901e('0x1')](function(_0x3ae125){return _[_0x901e('0x2')](_0x3ae125,function(_0x572227){_0x572227[_0x901e('0x3')](_0x901e('0x4'),_0x3fc9ab);return _0x572227;});})[_0x901e('0x5')](function(_0xeed784){throw _0xeed784;});}module[_0x901e('0x6')]=function(_0x3e235b){return _0x3e235b[_0x901e('0x7')](_0x901e('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x27fb83=this;var _0x544962=[_0x901e('0x9'),_0x901e('0xa'),_0x901e('0xb'),_0x901e('0xc'),_0x901e('0xd'),'Voice',_0x901e('0xe')];return Promise['resolve']()[_0x901e('0x1')](function(){var _0x2711f7=_[_0x901e('0x2')](_0x544962,function(_0x2e4beb){return getQueuesByChannel(_0x27fb83,_0x2e4beb);});return Promise[_0x901e('0xf')](_0x2711f7);})[_0x901e('0x5')](function(_0x2e54f2){throw _0x2e54f2;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 30ec955..84271e2 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 _0xbd20=['moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','lodash'];(function(_0x1b9747,_0x3af152){var _0x76dde6=function(_0x3874b3){while(--_0x3874b3){_0x1b9747['push'](_0x1b9747['shift']());}};_0x76dde6(++_0x3af152);}(_0xbd20,0x14f));var _0x0bd2=function(_0x10e633,_0x30e941){_0x10e633=_0x10e633-0x0;var _0x5dc12f=_0xbd20[_0x10e633];return _0x5dc12f;};'use strict';var _=require(_0x0bd2('0x0'));var util=require('util');var moment=require(_0x0bd2('0x1'));var BPromise=require(_0x0bd2('0x2'));var rs=require(_0x0bd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bd2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0bd2('0x5'));var jayson=require(_0x0bd2('0x6'));var client=jayson['client'][_0x0bd2('0x7')]({'port':0x232a});config[_0x0bd2('0x8')]=_[_0x0bd2('0x9')](config[_0x0bd2('0x8')],{'host':_0x0bd2('0xa'),'port':0x18eb});var socket=require(_0x0bd2('0xb'))(new Redis(config[_0x0bd2('0x8')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x410bd8,_0x78b4c7,_0x20ba25){return new BPromise(function(_0x205900,_0x16308f){return client[_0x0bd2('0xc')](_0x410bd8,_0x20ba25)[_0x0bd2('0xd')](function(_0xc16c40){logger[_0x0bd2('0xe')]('Team,\x20%s,\x20%s',_0x78b4c7,'request\x20sent');logger[_0x0bd2('0xf')](_0x0bd2('0x10'),_0x78b4c7,_0x0bd2('0x11'),JSON[_0x0bd2('0x12')](_0xc16c40));if(_0xc16c40[_0x0bd2('0x13')]){if(_0xc16c40['error'][_0x0bd2('0x14')]===0x1f4){logger[_0x0bd2('0x13')](_0x0bd2('0x15'),_0x78b4c7,_0xc16c40['error'][_0x0bd2('0x16')]);return _0x16308f(_0xc16c40[_0x0bd2('0x13')][_0x0bd2('0x16')]);}logger[_0x0bd2('0x13')](_0x0bd2('0x15'),_0x78b4c7,_0xc16c40[_0x0bd2('0x13')][_0x0bd2('0x16')]);return _0x205900(_0xc16c40[_0x0bd2('0x13')]['message']);}else{logger['info'](_0x0bd2('0x15'),_0x78b4c7,'request\x20sent');_0x205900(_0xc16c40[_0x0bd2('0x17')]['message']);}})['catch'](function(_0x5b83ca){logger['error']('Team,\x20%s,\x20%s',_0x78b4c7,_0x5b83ca);_0x16308f(_0x5b83ca);});});} \ No newline at end of file +var _0xfdc4=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x277849,_0x36d9b7){var _0x315fb6=function(_0x290a88){while(--_0x290a88){_0x277849['push'](_0x277849['shift']());}};_0x315fb6(++_0x36d9b7);}(_0xfdc4,0x81));var _0x4fdc=function(_0x146182,_0x3d9f69){_0x146182=_0x146182-0x0;var _0x5d2636=_0xfdc4[_0x146182];return _0x5d2636;};'use strict';var _=require(_0x4fdc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4fdc('0x1'));var rs=require(_0x4fdc('0x2'));var fs=require('fs');var Redis=require(_0x4fdc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fdc('0x4'));var logger=require(_0x4fdc('0x5'))(_0x4fdc('0x6'));var config=require(_0x4fdc('0x7'));var jayson=require(_0x4fdc('0x8'));var client=jayson[_0x4fdc('0x9')][_0x4fdc('0xa')]({'port':0x232a});config[_0x4fdc('0xb')]=_['defaults'](config[_0x4fdc('0xb')],{'host':_0x4fdc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fdc('0xb')]));require(_0x4fdc('0xd'))[_0x4fdc('0xe')](socket);function respondWithRpcPromise(_0x3154c7,_0x562acb,_0x55f349){return new BPromise(function(_0x2fd1d9,_0x3c04bd){return client[_0x4fdc('0xf')](_0x3154c7,_0x55f349)[_0x4fdc('0x10')](function(_0x180536){logger[_0x4fdc('0x11')](_0x4fdc('0x12'),_0x562acb,_0x4fdc('0x13'));logger[_0x4fdc('0x14')](_0x4fdc('0x15'),_0x562acb,_0x4fdc('0x13'),JSON['stringify'](_0x180536));if(_0x180536[_0x4fdc('0x16')]){if(_0x180536[_0x4fdc('0x16')][_0x4fdc('0x17')]===0x1f4){logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x180536['error'][_0x4fdc('0x18')]);return _0x3c04bd(_0x180536['error'][_0x4fdc('0x18')]);}logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x180536[_0x4fdc('0x16')][_0x4fdc('0x18')]);return _0x2fd1d9(_0x180536['error'][_0x4fdc('0x18')]);}else{logger['info'](_0x4fdc('0x12'),_0x562acb,_0x4fdc('0x13'));_0x2fd1d9(_0x180536[_0x4fdc('0x19')][_0x4fdc('0x18')]);}})[_0x4fdc('0x1a')](function(_0x3969df){logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x3969df);_0x3c04bd(_0x3969df);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 41c2b5a..f889706 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 _0x49d9=['emit','removeListener','length','./team.events','save','remove','update'];(function(_0x116deb,_0x19c146){var _0x9e9b19=function(_0x426919){while(--_0x426919){_0x116deb['push'](_0x116deb['shift']());}};_0x9e9b19(++_0x19c146);}(_0x49d9,0x13e));var _0x949d=function(_0x79fe80,_0x209993){_0x79fe80=_0x79fe80-0x0;var _0x4c51c1=_0x49d9[_0x79fe80];return _0x4c51c1;};'use strict';var TeamEvents=require(_0x949d('0x0'));var events=[_0x949d('0x1'),_0x949d('0x2'),_0x949d('0x3')];function createListener(_0x16ab72,_0x49c4f0){return function(_0xb9af91){_0x49c4f0[_0x949d('0x4')](_0x16ab72,_0xb9af91);};}function removeListener(_0x29136d,_0x8c78c0){return function(){TeamEvents[_0x949d('0x5')](_0x29136d,_0x8c78c0);};}exports['register']=function(_0x3ef6db){for(var _0x19fa65=0x0,_0x2b9a11=events[_0x949d('0x6')];_0x19fa65<_0x2b9a11;_0x19fa65++){var _0x188acb=events[_0x19fa65];var _0x27ed2d=createListener('team:'+_0x188acb,_0x3ef6db);TeamEvents['on'](_0x188acb,_0x27ed2d);}}; \ No newline at end of file +var _0xa866=['remove','update','emit','removeListener','register','length','team:','./team.events','save'];(function(_0x24802c,_0x12c479){var _0x41c440=function(_0x4bc95d){while(--_0x4bc95d){_0x24802c['push'](_0x24802c['shift']());}};_0x41c440(++_0x12c479);}(_0xa866,0x6a));var _0x6a86=function(_0xe64805,_0x1a4a2e){_0xe64805=_0xe64805-0x0;var _0x350c5e=_0xa866[_0xe64805];return _0x350c5e;};'use strict';var TeamEvents=require(_0x6a86('0x0'));var events=[_0x6a86('0x1'),_0x6a86('0x2'),_0x6a86('0x3')];function createListener(_0x43d158,_0x58d5c6){return function(_0x15236c){_0x58d5c6[_0x6a86('0x4')](_0x43d158,_0x15236c);};}function removeListener(_0x3d1631,_0x4a6d5a){return function(){TeamEvents[_0x6a86('0x5')](_0x3d1631,_0x4a6d5a);};}exports[_0x6a86('0x6')]=function(_0xac49a){for(var _0x5e7673=0x0,_0x183997=events[_0x6a86('0x7')];_0x5e7673<_0x183997;_0x5e7673++){var _0x3ed589=events[_0x5e7673];var _0x1330e1=createListener(_0x6a86('0x8')+_0x3ed589,_0xac49a);TeamEvents['on'](_0x3ed589,_0x1330e1);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index ab7173b..ea41eb6 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 _0xc560=['sequelize','INTEGER'];(function(_0x4f45f9,_0x3f7dc9){var _0x4f885d=function(_0x440850){while(--_0x440850){_0x4f45f9['push'](_0x4f45f9['shift']());}};_0x4f885d(++_0x3f7dc9);}(_0xc560,0x82));var _0x0c56=function(_0x5a7c68,_0x4180c5){_0x5a7c68=_0x5a7c68-0x0;var _0xfd4365=_0xc560[_0x5a7c68];return _0xfd4365;};'use strict';var Sequelize=require(_0x0c56('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x0c56('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x96cc=['sequelize','INTEGER'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0x96cc,0x16c));var _0xc96c=function(_0x5a1e67,_0x3b9c7a){_0x5a1e67=_0x5a1e67-0x0;var _0x28603f=_0x96cc[_0x5a1e67];return _0x28603f;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc96c('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 90e966b..d56694e 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 _0xde9f=['lodash','api','moment','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xde9f,0x118));var _0xfde9=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0xde9f[_0x4653f7];return _0x5454da;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfde9('0x1'));var moment=require(_0xfde9('0x2'));var BPromise=require('bluebird');var rp=require(_0xfde9('0x3'));var fs=require('fs');var path=require(_0xfde9('0x4'));var rimraf=require('rimraf');var config=require(_0xfde9('0x5'));var attributes=require(_0xfde9('0x6'));module[_0xfde9('0x7')]=function(_0xe30eaf,_0x5e69c0){return _0xe30eaf['define'](_0xfde9('0x8'),attributes,{'tableName':_0xfde9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3d4=['api','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x1744a3,_0x3a9d5a){var _0x486e65=function(_0x5914fd){while(--_0x5914fd){_0x1744a3['push'](_0x1744a3['shift']());}};_0x486e65(++_0x3a9d5a);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x335f37,_0x37302b){_0x335f37=_0x335f37-0x0;var _0x1768f4=_0xe3d4[_0x335f37];return _0x1768f4;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x4e3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0d1c29b..b962f2a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x466434,_0x58903b){var _0x17125b=function(_0x4f2f70){while(--_0x4f2f70){_0x466434['push'](_0x466434['shift']());}};_0x17125b(++_0x58903b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xcb91[_0x872b02];return _0x1a6b24;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 56e65a3..28585f5 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 _0xdbbe=['exports','INTEGER','sequelize'];(function(_0x5e5964,_0x201efc){var _0xb11687=function(_0x544c1b){while(--_0x544c1b){_0x5e5964['push'](_0x5e5964['shift']());}};_0xb11687(++_0x201efc);}(_0xdbbe,0x1f1));var _0xedbb=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xdbbe[_0x277107];return _0x1da046;};'use strict';var Sequelize=require(_0xedbb('0x0'));module[_0xedbb('0x1')]={'penalty':{'type':Sequelize[_0xedbb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7fbe=['INTEGER'];(function(_0x72e9d8,_0x6684ee){var _0x5e3873=function(_0x51ec5a){while(--_0x51ec5a){_0x72e9d8['push'](_0x72e9d8['shift']());}};_0x5e3873(++_0x6684ee);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b9bb7,_0x4e24df){_0x3b9bb7=_0x3b9bb7-0x0;var _0x4c0b9e=_0x7fbe[_0x3b9bb7];return _0x4c0b9e;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe7fb('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index bdfbbb6..f231294 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 _0xa37e=['moment','bluebird','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','../../config/logger','api'];(function(_0x2ffcc5,_0x4bd168){var _0x5d15fb=function(_0x4d9fb1){while(--_0x4d9fb1){_0x2ffcc5['push'](_0x2ffcc5['shift']());}};_0x5d15fb(++_0x4bd168);}(_0xa37e,0x97));var _0xea37=function(_0x21aa09,_0x670f63){_0x21aa09=_0x21aa09-0x0;var _0x13e543=_0xa37e[_0x21aa09];return _0x13e543;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ade=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','moment','request-promise','path','./teamVoiceQueue.attributes','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9ade,0x107));var _0xe9ad=function(_0x4c217f,_0x82a1ae){_0x4c217f=_0x4c217f-0x0;var _0x4033b2=_0x9ade[_0x4c217f];return _0x4033b2;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9ad('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9ad('0x3'));var fs=require('fs');var path=require(_0xe9ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9ad('0x5'));module[_0xe9ad('0x6')]=function(_0xdd1549,_0x3e4092){return _0xdd1549[_0xe9ad('0x7')](_0xe9ad('0x8'),attributes,{'tableName':_0xe9ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 857e427..b45302f 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 _0x8413=['message','TeamVoiceQueue,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x450281,_0x2c8209){var _0x1f042d=function(_0x26721d){while(--_0x26721d){_0x450281['push'](_0x450281['shift']());}};_0x1f042d(++_0x2c8209);}(_0x8413,0x7b));var _0x3841=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8413[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x3841('0x0'));var util=require(_0x3841('0x1'));var moment=require(_0x3841('0x2'));var BPromise=require(_0x3841('0x3'));var rs=require(_0x3841('0x4'));var fs=require('fs');var Redis=require(_0x3841('0x5'));var db=require(_0x3841('0x6'))['db'];var utils=require(_0x3841('0x7'));var logger=require(_0x3841('0x8'))('rpc');var config=require(_0x3841('0x9'));var jayson=require(_0x3841('0xa'));var client=jayson[_0x3841('0xb')][_0x3841('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd32bba,_0x5c081a,_0x407337){return new BPromise(function(_0x5792d5,_0x3ebc3c){return client[_0x3841('0xd')](_0xd32bba,_0x407337)[_0x3841('0xe')](function(_0x12f751){logger[_0x3841('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5c081a,_0x3841('0x10'));logger[_0x3841('0x11')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c081a,_0x3841('0x10'),JSON[_0x3841('0x12')](_0x12f751));if(_0x12f751[_0x3841('0x13')]){if(_0x12f751[_0x3841('0x13')][_0x3841('0x14')]===0x1f4){logger[_0x3841('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5c081a,_0x12f751[_0x3841('0x13')][_0x3841('0x15')]);return _0x3ebc3c(_0x12f751['error'][_0x3841('0x15')]);}logger[_0x3841('0x13')](_0x3841('0x16'),_0x5c081a,_0x12f751[_0x3841('0x13')][_0x3841('0x15')]);return _0x5792d5(_0x12f751[_0x3841('0x13')]['message']);}else{logger[_0x3841('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5c081a,_0x3841('0x10'));_0x5792d5(_0x12f751['result'][_0x3841('0x15')]);}})[_0x3841('0x17')](function(_0x52224f){logger['error'](_0x3841('0x16'),_0x5c081a,_0x52224f);_0x3ebc3c(_0x52224f);});});} \ No newline at end of file +var _0x0be1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x36aeb1,_0x312c10){var _0x1a1bea=function(_0x3fb92f){while(--_0x3fb92f){_0x36aeb1['push'](_0x36aeb1['shift']());}};_0x1a1bea(++_0x312c10);}(_0x0be1,0x1b0));var _0x10be=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x0be1[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x10be('0x0'));var util=require(_0x10be('0x1'));var moment=require(_0x10be('0x2'));var BPromise=require(_0x10be('0x3'));var rs=require(_0x10be('0x4'));var fs=require('fs');var Redis=require(_0x10be('0x5'));var db=require(_0x10be('0x6'))['db'];var utils=require(_0x10be('0x7'));var logger=require(_0x10be('0x8'))(_0x10be('0x9'));var config=require(_0x10be('0xa'));var jayson=require(_0x10be('0xb'));var client=jayson[_0x10be('0xc')][_0x10be('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x359366,_0xb93875,_0x8bd130){return new BPromise(function(_0x75dfd4,_0x20357f){return client['request'](_0x359366,_0x8bd130)[_0x10be('0xe')](function(_0x32a646){logger['info'](_0x10be('0xf'),_0xb93875,_0x10be('0x10'));logger[_0x10be('0x11')](_0x10be('0x12'),_0xb93875,_0x10be('0x10'),JSON[_0x10be('0x13')](_0x32a646));if(_0x32a646['error']){if(_0x32a646[_0x10be('0x14')][_0x10be('0x15')]===0x1f4){logger[_0x10be('0x14')](_0x10be('0xf'),_0xb93875,_0x32a646[_0x10be('0x14')][_0x10be('0x16')]);return _0x20357f(_0x32a646[_0x10be('0x14')][_0x10be('0x16')]);}logger[_0x10be('0x14')](_0x10be('0xf'),_0xb93875,_0x32a646['error'][_0x10be('0x16')]);return _0x75dfd4(_0x32a646[_0x10be('0x14')][_0x10be('0x16')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0xb93875,_0x10be('0x10'));_0x75dfd4(_0x32a646['result'][_0x10be('0x16')]);}})[_0x10be('0x17')](function(_0x545f76){logger[_0x10be('0x14')](_0x10be('0xf'),_0xb93875,_0x545f76);_0x20357f(_0x545f76);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c420905..67ffc99 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 _0x4123=['Router','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x3be855,_0x305fdf){var _0x2b319a=function(_0x4a6388){while(--_0x4a6388){_0x3be855['push'](_0x3be855['shift']());}};_0x2b319a(++_0x305fdf);}(_0x4123,0x87));var _0x3412=function(_0xf662fb,_0x27067f){_0xf662fb=_0xf662fb-0x0;var _0x35a3c4=_0x4123[_0xf662fb];return _0x35a3c4;};'use strict';var multer=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var path=require(_0x3412('0x2'));var timeout=require(_0x3412('0x3'));var express=require(_0x3412('0x4'));var router=express[_0x3412('0x5')]();var fs_extra=require(_0x3412('0x6'));var auth=require(_0x3412('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3412('0x8'));router[_0x3412('0x9')]('/',auth['isAuthenticated'](),controller[_0x3412('0xa')]);router[_0x3412('0x9')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0xd')]);router[_0x3412('0xe')]('/',auth['isAuthenticated'](),controller[_0x3412('0xf')]);router[_0x3412('0x10')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x11')]);router[_0x3412('0x12')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0954=['put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post'];(function(_0x27b509,_0x463d6d){var _0x263cd9=function(_0x25c79c){while(--_0x25c79c){_0x27b509['push'](_0x27b509['shift']());}};_0x263cd9(++_0x463d6d);}(_0x0954,0x135));var _0x4095=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x0954[_0x11e30d];return _0x2d4e29;};'use strict';var multer=require(_0x4095('0x0'));var util=require('util');var path=require(_0x4095('0x1'));var timeout=require(_0x4095('0x2'));var express=require('express');var router=express[_0x4095('0x3')]();var fs_extra=require(_0x4095('0x4'));var auth=require(_0x4095('0x5'));var interaction=require(_0x4095('0x6'));var config=require(_0x4095('0x7'));var controller=require(_0x4095('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4095('0x9')](_0x4095('0xa'),auth[_0x4095('0xb')](),controller[_0x4095('0xc')]);router[_0x4095('0xd')]('/',auth[_0x4095('0xb')](),controller['create']);router[_0x4095('0xe')](_0x4095('0xa'),auth[_0x4095('0xb')](),controller['update']);router[_0x4095('0xf')](_0x4095('0xa'),auth[_0x4095('0xb')](),controller['destroy']);module[_0x4095('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a44fa67..ca33621 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 _0x01af=['STRING','TEXT'];(function(_0x3710ef,_0x5bc2e8){var _0x5199b7=function(_0x45031d){while(--_0x45031d){_0x3710ef['push'](_0x3710ef['shift']());}};_0x5199b7(++_0x5bc2e8);}(_0x01af,0x158));var _0xf01a=function(_0x586d69,_0x3c40bd){_0x586d69=_0x586d69-0x0;var _0x3a7931=_0x01af[_0x586d69];return _0x3a7931;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf01a('0x0')]},'description':{'type':Sequelize[_0xf01a('0x0')]},'html':{'type':Sequelize[_0xf01a('0x1')]}}; \ No newline at end of file +var _0x1b39=['sequelize','STRING','TEXT'];(function(_0x553e80,_0x4b0792){var _0x5a206c=function(_0x303fef){while(--_0x303fef){_0x553e80['push'](_0x553e80['shift']());}};_0x5a206c(++_0x4b0792);}(_0x1b39,0x129));var _0x91b3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b39[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x91b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x91b3('0x1')]},'description':{'type':Sequelize[_0x91b3('0x1')]},'html':{'type':Sequelize[_0x91b3('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8057a93..2e42571 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 _0x5a83=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Templates','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5a83,0x194));var _0x35a8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5a83[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x35a8('0x0'));var jsonpatch=require(_0x35a8('0x1'));var rp=require(_0x35a8('0x2'));var moment=require(_0x35a8('0x3'));var BPromise=require(_0x35a8('0x4'));var Mustache=require(_0x35a8('0x5'));var util=require(_0x35a8('0x6'));var path=require('path');var sox=require(_0x35a8('0x7'));var csv=require('to-csv');var ejs=require(_0x35a8('0x8'));var fs=require('fs');var fs_extra=require(_0x35a8('0x9'));var _=require(_0x35a8('0xa'));var squel=require(_0x35a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x35a8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x35a8('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x35a8('0xe'));var authService=require(_0x35a8('0xf'));var qs=require(_0x35a8('0x10'));var as=require(_0x35a8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a8('0x12'))(_0x35a8('0x13'));var utils=require(_0x35a8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x35a8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x415dd2,_0x40f7b9){_0x40f7b9=_0x40f7b9||0xcc;return function(_0x25d8a3){if(_0x25d8a3){return _0x415dd2[_0x35a8('0x16')](_0x40f7b9);}return _0x415dd2[_0x35a8('0x17')](_0x40f7b9)[_0x35a8('0x18')]();};}function respondWithResult(_0x41a989,_0x2ae861){_0x2ae861=_0x2ae861||0xc8;return function(_0xf85659){if(_0xf85659){return _0x41a989['status'](_0x2ae861)[_0x35a8('0x19')](_0xf85659);}};}function respondWithFilteredResult(_0x1b6ecd,_0x88f7bd){return function(_0x4ec07b){if(_0x4ec07b){var _0x461552=typeof _0x88f7bd[_0x35a8('0x1a')]==='undefined'&&typeof _0x88f7bd['limit']===_0x35a8('0x1b');var _0x2fc984=_0x4ec07b[_0x35a8('0x1c')];var _0x1be0a3=_0x461552?0x0:_0x88f7bd[_0x35a8('0x1a')];var _0x24ce57=_0x461552?_0x4ec07b[_0x35a8('0x1c')]:_0x88f7bd[_0x35a8('0x1a')]+_0x88f7bd[_0x35a8('0x1d')];var _0x26c75c;if(_0x24ce57>=_0x2fc984){_0x24ce57=_0x2fc984;_0x26c75c=0xc8;}else{_0x26c75c=0xce;}_0x1b6ecd['status'](_0x26c75c);return _0x1b6ecd['set'](_0x35a8('0x1e'),_0x1be0a3+'-'+_0x24ce57+'/'+_0x2fc984)[_0x35a8('0x19')](_0x4ec07b);}return null;};}function patchUpdates(_0x4fd913){return function(_0x1ac1e1){try{jsonpatch[_0x35a8('0x1f')](_0x1ac1e1,_0x4fd913,!![]);}catch(_0x22abb2){return BPromise[_0x35a8('0x20')](_0x22abb2);}return _0x1ac1e1[_0x35a8('0x21')]();};}function saveUpdates(_0x1555fe,_0x101b56){return function(_0x118c1d){if(_0x118c1d){return _0x118c1d[_0x35a8('0x22')](_0x1555fe)[_0x35a8('0x23')](function(_0x209bcc){return _0x209bcc;});}return null;};}function removeEntity(_0xfaeca7,_0x1fd878){return function(_0x43311c){if(_0x43311c){return _0x43311c[_0x35a8('0x24')]()[_0x35a8('0x23')](function(){var _0x4515c6=_0x43311c[_0x35a8('0x25')]({'plain':!![]});var _0x439404=_0x35a8('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x439404,'resourceId':_0x4515c6['id']}})[_0x35a8('0x23')](function(){return _0x43311c;});})[_0x35a8('0x23')](function(){_0xfaeca7[_0x35a8('0x17')](0xcc)[_0x35a8('0x18')]();});}};}function handleEntityNotFound(_0x16f3a0,_0x1bb724){return function(_0x4dc75d){if(!_0x4dc75d){_0x16f3a0[_0x35a8('0x16')](0x194);}return _0x4dc75d;};}function handleError(_0x4fba7a,_0x232d12){_0x232d12=_0x232d12||0x1f4;return function(_0x353ea8){logger[_0x35a8('0x27')](_0x353ea8[_0x35a8('0x28')]);if(_0x353ea8[_0x35a8('0x29')]){delete _0x353ea8[_0x35a8('0x29')];}_0x4fba7a[_0x35a8('0x17')](_0x232d12)[_0x35a8('0x2a')](_0x353ea8);};}exports[_0x35a8('0x2b')]=function(_0x19d28b,_0x5b1b59){var _0x317d15={},_0x275609={},_0x3f45d9={'count':0x0,'rows':[]};var _0x2cfae4=_[_0x35a8('0x2c')](db[_0x35a8('0x2d')][_0x35a8('0x2e')],function(_0x445c3a){return{'name':_0x445c3a[_0x35a8('0x2f')],'type':_0x445c3a[_0x35a8('0x30')][_0x35a8('0x31')]};});_0x275609[_0x35a8('0x32')]=_[_0x35a8('0x2c')](_0x2cfae4,_0x35a8('0x29'));_0x275609[_0x35a8('0x33')]=_[_0x35a8('0x34')](_0x19d28b['query']);_0x275609[_0x35a8('0x35')]=_[_0x35a8('0x36')](_0x275609[_0x35a8('0x32')],_0x275609[_0x35a8('0x33')]);_0x317d15[_0x35a8('0x37')]=_['intersection'](_0x275609[_0x35a8('0x32')],qs['fields'](_0x19d28b[_0x35a8('0x33')]['fields']));_0x317d15[_0x35a8('0x37')]=_0x317d15[_0x35a8('0x37')][_0x35a8('0x38')]?_0x317d15[_0x35a8('0x37')]:_0x275609['model'];if(!_0x19d28b[_0x35a8('0x33')][_0x35a8('0x39')](_0x35a8('0x3a'))){_0x317d15[_0x35a8('0x1d')]=qs[_0x35a8('0x1d')](_0x19d28b[_0x35a8('0x33')]['limit']);_0x317d15[_0x35a8('0x1a')]=qs[_0x35a8('0x1a')](_0x19d28b[_0x35a8('0x33')]['offset']);}_0x317d15[_0x35a8('0x3b')]=qs[_0x35a8('0x3c')](_0x19d28b[_0x35a8('0x33')][_0x35a8('0x3c')]);_0x317d15['where']=qs[_0x35a8('0x35')](_[_0x35a8('0x3d')](_0x19d28b['query'],_0x275609[_0x35a8('0x35')]),_0x2cfae4);if(_0x19d28b['query'][_0x35a8('0x3e')]){_0x317d15['where']=_[_0x35a8('0x3f')](_0x317d15[_0x35a8('0x40')],{'$or':_[_0x35a8('0x2c')](_0x2cfae4,function(_0x46d848){if(_0x46d848[_0x35a8('0x30')]!==_0x35a8('0x41')){var _0x309c12={};_0x309c12[_0x46d848[_0x35a8('0x29')]]={'$like':'%'+_0x19d28b['query'][_0x35a8('0x3e')]+'%'};return _0x309c12;}})});}_0x317d15=_[_0x35a8('0x3f')]({},_0x317d15,_0x19d28b[_0x35a8('0x42')]);var _0x36e2ad={'where':_0x317d15['where']};return db[_0x35a8('0x2d')][_0x35a8('0x1c')](_0x36e2ad)[_0x35a8('0x23')](function(_0x1ae746){_0x3f45d9['count']=_0x1ae746;if(_0x19d28b['query'][_0x35a8('0x43')]){_0x317d15[_0x35a8('0x44')]=[{'all':!![]}];}return db['Template'][_0x35a8('0x45')](_0x317d15);})[_0x35a8('0x23')](function(_0x38168b){_0x3f45d9[_0x35a8('0x46')]=_0x38168b;return _0x3f45d9;})[_0x35a8('0x23')](respondWithFilteredResult(_0x5b1b59,_0x317d15))[_0x35a8('0x47')](handleError(_0x5b1b59,null));};exports[_0x35a8('0x48')]=function(_0x5bc1f1,_0x2085b2){var _0x29a84c={'raw':!![],'where':{'id':_0x5bc1f1[_0x35a8('0x49')]['id']}},_0x24767d={};_0x24767d['model']=_[_0x35a8('0x34')](db['Template']['rawAttributes']);_0x24767d['query']=_[_0x35a8('0x34')](_0x5bc1f1[_0x35a8('0x33')]);_0x24767d['filters']=_[_0x35a8('0x36')](_0x24767d[_0x35a8('0x32')],_0x24767d[_0x35a8('0x33')]);_0x29a84c[_0x35a8('0x37')]=_[_0x35a8('0x36')](_0x24767d['model'],qs[_0x35a8('0x4a')](_0x5bc1f1[_0x35a8('0x33')][_0x35a8('0x4a')]));_0x29a84c[_0x35a8('0x37')]=_0x29a84c[_0x35a8('0x37')][_0x35a8('0x38')]?_0x29a84c[_0x35a8('0x37')]:_0x24767d[_0x35a8('0x32')];if(_0x5bc1f1[_0x35a8('0x33')][_0x35a8('0x43')]){_0x29a84c[_0x35a8('0x44')]=[{'all':!![]}];}_0x29a84c=_[_0x35a8('0x3f')]({},_0x29a84c,_0x5bc1f1['options']);return db[_0x35a8('0x2d')]['find'](_0x29a84c)[_0x35a8('0x23')](handleEntityNotFound(_0x2085b2,null))[_0x35a8('0x23')](respondWithResult(_0x2085b2,null))[_0x35a8('0x47')](handleError(_0x2085b2,null));};exports[_0x35a8('0x4b')]=function(_0x1689fd,_0x1e00cb){return db[_0x35a8('0x2d')][_0x35a8('0x4b')](_0x1689fd[_0x35a8('0x4c')],{})[_0x35a8('0x23')](function(_0x3fe8b0){var _0x1199a2=_0x1689fd[_0x35a8('0x4d')][_0x35a8('0x25')]({'plain':!![]});if(!_0x1199a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1199a2[_0x35a8('0x4e')]===_0x35a8('0x4d')){var _0x271e00=_0x3fe8b0[_0x35a8('0x25')]({'plain':!![]});var _0x3b7136=_0x35a8('0x26');return db[_0x35a8('0x4f')]['find']({'where':{'name':_0x3b7136,'userProfileId':_0x1199a2[_0x35a8('0x50')]},'raw':!![]})[_0x35a8('0x23')](function(_0x4182ea){if(_0x4182ea&&_0x4182ea[_0x35a8('0x51')]===0x0){return db['UserProfileResource'][_0x35a8('0x4b')]({'name':_0x271e00['name'],'resourceId':_0x271e00['id'],'type':_0x4182ea['name'],'sectionId':_0x4182ea['id']},{})[_0x35a8('0x23')](function(){return _0x3fe8b0;});}else{return _0x3fe8b0;}})[_0x35a8('0x47')](function(_0x999546){logger[_0x35a8('0x27')](_0x35a8('0x52'),_0x999546);throw _0x999546;});}return _0x3fe8b0;})[_0x35a8('0x23')](respondWithResult(_0x1e00cb,0xc9))[_0x35a8('0x47')](handleError(_0x1e00cb,null));};exports['update']=function(_0x35bdd9,_0x584704){if(_0x35bdd9[_0x35a8('0x4c')]['id']){delete _0x35bdd9[_0x35a8('0x4c')]['id'];}return db[_0x35a8('0x2d')]['find']({'where':{'id':_0x35bdd9[_0x35a8('0x49')]['id']}})[_0x35a8('0x23')](handleEntityNotFound(_0x584704,null))[_0x35a8('0x23')](saveUpdates(_0x35bdd9['body'],null))[_0x35a8('0x23')](respondWithResult(_0x584704,null))[_0x35a8('0x47')](handleError(_0x584704,null));};exports[_0x35a8('0x24')]=function(_0xdcf4d0,_0x3da450){return db[_0x35a8('0x2d')][_0x35a8('0x53')]({'where':{'id':_0xdcf4d0[_0x35a8('0x49')]['id']}})[_0x35a8('0x23')](handleEntityNotFound(_0x3da450,null))[_0x35a8('0x23')](removeEntity(_0x3da450,null))[_0x35a8('0x47')](handleError(_0x3da450,null));}; \ No newline at end of file +var _0xc899=['merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','UserProfileResource','error','stack','name','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where'];(function(_0x4ca288,_0x254dd8){var _0x2362c1=function(_0x5504d8){while(--_0x5504d8){_0x4ca288['push'](_0x4ca288['shift']());}};_0x2362c1(++_0x254dd8);}(_0xc899,0x1ef));var _0x9c89=function(_0x2fe9f7,_0x4af956){_0x2fe9f7=_0x2fe9f7-0x0;var _0x51f274=_0xc899[_0x2fe9f7];return _0x51f274;};'use strict';var emlformat=require(_0x9c89('0x0'));var rimraf=require(_0x9c89('0x1'));var zipdir=require(_0x9c89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c89('0x3'));var moment=require(_0x9c89('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c89('0x5'));var util=require(_0x9c89('0x6'));var path=require(_0x9c89('0x7'));var sox=require(_0x9c89('0x8'));var csv=require(_0x9c89('0x9'));var ejs=require(_0x9c89('0xa'));var fs=require('fs');var fs_extra=require(_0x9c89('0xb'));var _=require(_0x9c89('0xc'));var squel=require(_0x9c89('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9c89('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9c89('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c89('0x10'));var qs=require(_0x9c89('0x11'));var as=require(_0x9c89('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c89('0x13'));var utils=require('../../config/utils');var config=require(_0x9c89('0x14'));var licenseUtil=require(_0x9c89('0x15'));var db=require(_0x9c89('0x16'))['db'];function respondWithStatusCode(_0x53796f,_0x7a49c6){_0x7a49c6=_0x7a49c6||0xcc;return function(_0x2f8d62){if(_0x2f8d62){return _0x53796f[_0x9c89('0x17')](_0x7a49c6);}return _0x53796f[_0x9c89('0x18')](_0x7a49c6)[_0x9c89('0x19')]();};}function respondWithResult(_0x417840,_0x19828f){_0x19828f=_0x19828f||0xc8;return function(_0x2d578a){if(_0x2d578a){return _0x417840[_0x9c89('0x18')](_0x19828f)[_0x9c89('0x1a')](_0x2d578a);}};}function respondWithFilteredResult(_0x467326,_0x1f2d0c){return function(_0x99c2e6){if(_0x99c2e6){var _0x2fc800=typeof _0x1f2d0c[_0x9c89('0x1b')]===_0x9c89('0x1c')&&typeof _0x1f2d0c[_0x9c89('0x1d')]===_0x9c89('0x1c');var _0x1977b6=_0x99c2e6[_0x9c89('0x1e')];var _0x4b6056=_0x2fc800?0x0:_0x1f2d0c[_0x9c89('0x1b')];var _0x297138=_0x2fc800?_0x99c2e6[_0x9c89('0x1e')]:_0x1f2d0c['offset']+_0x1f2d0c['limit'];var _0x3a23b6;if(_0x297138>=_0x1977b6){_0x297138=_0x1977b6;_0x3a23b6=0xc8;}else{_0x3a23b6=0xce;}_0x467326[_0x9c89('0x18')](_0x3a23b6);return _0x467326[_0x9c89('0x1f')](_0x9c89('0x20'),_0x4b6056+'-'+_0x297138+'/'+_0x1977b6)['json'](_0x99c2e6);}return null;};}function patchUpdates(_0x34a56b){return function(_0x15d3c7){try{jsonpatch[_0x9c89('0x21')](_0x15d3c7,_0x34a56b,!![]);}catch(_0x301eb7){return BPromise['reject'](_0x301eb7);}return _0x15d3c7['save']();};}function saveUpdates(_0x4b8756,_0x38f1d8){return function(_0x429eeb){if(_0x429eeb){return _0x429eeb['update'](_0x4b8756)[_0x9c89('0x22')](function(_0x49e9d3){return _0x49e9d3;});}return null;};}function removeEntity(_0x3eb31d,_0x5bb452){return function(_0x44b960){if(_0x44b960){return _0x44b960[_0x9c89('0x23')]()['then'](function(){var _0x16f5c6=_0x44b960[_0x9c89('0x24')]({'plain':!![]});var _0x3c730d='Templates';return db[_0x9c89('0x25')][_0x9c89('0x23')]({'where':{'type':_0x3c730d,'resourceId':_0x16f5c6['id']}})[_0x9c89('0x22')](function(){return _0x44b960;});})[_0x9c89('0x22')](function(){_0x3eb31d[_0x9c89('0x18')](0xcc)[_0x9c89('0x19')]();});}};}function handleEntityNotFound(_0x4f655a,_0x3c46b8){return function(_0x177662){if(!_0x177662){_0x4f655a['sendStatus'](0x194);}return _0x177662;};}function handleError(_0x184aa3,_0x4aff6f){_0x4aff6f=_0x4aff6f||0x1f4;return function(_0x5bca83){logger[_0x9c89('0x26')](_0x5bca83[_0x9c89('0x27')]);if(_0x5bca83[_0x9c89('0x28')]){delete _0x5bca83['name'];}_0x184aa3['status'](_0x4aff6f)['send'](_0x5bca83);};}exports['index']=function(_0x5c65f7,_0x529977){var _0xe21047={},_0x216f4f={},_0x3fd54a={'count':0x0,'rows':[]};var _0x507c03=_[_0x9c89('0x29')](db[_0x9c89('0x2a')][_0x9c89('0x2b')],function(_0x4fb3cb){return{'name':_0x4fb3cb[_0x9c89('0x2c')],'type':_0x4fb3cb[_0x9c89('0x2d')][_0x9c89('0x2e')]};});_0x216f4f[_0x9c89('0x2f')]=_[_0x9c89('0x29')](_0x507c03,'name');_0x216f4f[_0x9c89('0x30')]=_[_0x9c89('0x31')](_0x5c65f7[_0x9c89('0x30')]);_0x216f4f[_0x9c89('0x32')]=_['intersection'](_0x216f4f[_0x9c89('0x2f')],_0x216f4f[_0x9c89('0x30')]);_0xe21047['attributes']=_[_0x9c89('0x33')](_0x216f4f[_0x9c89('0x2f')],qs[_0x9c89('0x34')](_0x5c65f7[_0x9c89('0x30')]['fields']));_0xe21047[_0x9c89('0x35')]=_0xe21047['attributes'][_0x9c89('0x36')]?_0xe21047[_0x9c89('0x35')]:_0x216f4f['model'];if(!_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x37')]('nolimit')){_0xe21047[_0x9c89('0x1d')]=qs[_0x9c89('0x1d')](_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x1d')]);_0xe21047[_0x9c89('0x1b')]=qs['offset'](_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x1b')]);}_0xe21047['order']=qs[_0x9c89('0x38')](_0x5c65f7[_0x9c89('0x30')]['sort']);_0xe21047[_0x9c89('0x39')]=qs[_0x9c89('0x32')](_['pick'](_0x5c65f7[_0x9c89('0x30')],_0x216f4f[_0x9c89('0x32')]),_0x507c03);if(_0x5c65f7[_0x9c89('0x30')]['filter']){_0xe21047[_0x9c89('0x39')]=_[_0x9c89('0x3a')](_0xe21047[_0x9c89('0x39')],{'$or':_[_0x9c89('0x29')](_0x507c03,function(_0x479af3){if(_0x479af3[_0x9c89('0x2d')]!==_0x9c89('0x3b')){var _0x1a2bd3={};_0x1a2bd3[_0x479af3['name']]={'$like':'%'+_0x5c65f7['query'][_0x9c89('0x3c')]+'%'};return _0x1a2bd3;}})});}_0xe21047=_['merge']({},_0xe21047,_0x5c65f7[_0x9c89('0x3d')]);var _0x1a7885={'where':_0xe21047[_0x9c89('0x39')]};return db['Template']['count'](_0x1a7885)[_0x9c89('0x22')](function(_0x2497b6){_0x3fd54a[_0x9c89('0x1e')]=_0x2497b6;if(_0x5c65f7[_0x9c89('0x30')][_0x9c89('0x3e')]){_0xe21047['include']=[{'all':!![]}];}return db['Template'][_0x9c89('0x3f')](_0xe21047);})[_0x9c89('0x22')](function(_0xe365dc){_0x3fd54a[_0x9c89('0x40')]=_0xe365dc;return _0x3fd54a;})['then'](respondWithFilteredResult(_0x529977,_0xe21047))[_0x9c89('0x41')](handleError(_0x529977,null));};exports[_0x9c89('0x42')]=function(_0xbabf21,_0x585f88){var _0x2216f4={'raw':!![],'where':{'id':_0xbabf21['params']['id']}},_0x35367a={};_0x35367a[_0x9c89('0x2f')]=_[_0x9c89('0x31')](db[_0x9c89('0x2a')][_0x9c89('0x2b')]);_0x35367a[_0x9c89('0x30')]=_[_0x9c89('0x31')](_0xbabf21[_0x9c89('0x30')]);_0x35367a[_0x9c89('0x32')]=_[_0x9c89('0x33')](_0x35367a[_0x9c89('0x2f')],_0x35367a['query']);_0x2216f4[_0x9c89('0x35')]=_[_0x9c89('0x33')](_0x35367a[_0x9c89('0x2f')],qs[_0x9c89('0x34')](_0xbabf21['query'][_0x9c89('0x34')]));_0x2216f4[_0x9c89('0x35')]=_0x2216f4[_0x9c89('0x35')][_0x9c89('0x36')]?_0x2216f4[_0x9c89('0x35')]:_0x35367a[_0x9c89('0x2f')];if(_0xbabf21[_0x9c89('0x30')][_0x9c89('0x3e')]){_0x2216f4['include']=[{'all':!![]}];}_0x2216f4=_[_0x9c89('0x3a')]({},_0x2216f4,_0xbabf21[_0x9c89('0x3d')]);return db['Template']['find'](_0x2216f4)[_0x9c89('0x22')](handleEntityNotFound(_0x585f88,null))[_0x9c89('0x22')](respondWithResult(_0x585f88,null))[_0x9c89('0x41')](handleError(_0x585f88,null));};exports[_0x9c89('0x43')]=function(_0x3b6ed4,_0x1dbe39){return db['Template']['create'](_0x3b6ed4[_0x9c89('0x44')],{})[_0x9c89('0x22')](function(_0x52691b){var _0x118951=_0x3b6ed4[_0x9c89('0x45')][_0x9c89('0x24')]({'plain':!![]});if(!_0x118951)throw new Error(_0x9c89('0x46'));if(_0x118951[_0x9c89('0x47')]===_0x9c89('0x45')){var _0x248ed2=_0x52691b['get']({'plain':!![]});var _0x3a1893='Templates';return db[_0x9c89('0x48')]['find']({'where':{'name':_0x3a1893,'userProfileId':_0x118951[_0x9c89('0x49')]},'raw':!![]})[_0x9c89('0x22')](function(_0x5ac7bc){if(_0x5ac7bc&&_0x5ac7bc[_0x9c89('0x4a')]===0x0){return db[_0x9c89('0x25')][_0x9c89('0x43')]({'name':_0x248ed2[_0x9c89('0x28')],'resourceId':_0x248ed2['id'],'type':_0x5ac7bc['name'],'sectionId':_0x5ac7bc['id']},{})['then'](function(){return _0x52691b;});}else{return _0x52691b;}})[_0x9c89('0x41')](function(_0x58eb10){logger[_0x9c89('0x26')](_0x9c89('0x4b'),_0x58eb10);throw _0x58eb10;});}return _0x52691b;})['then'](respondWithResult(_0x1dbe39,0xc9))[_0x9c89('0x41')](handleError(_0x1dbe39,null));};exports[_0x9c89('0x4c')]=function(_0x38fc9c,_0x341c8a){if(_0x38fc9c[_0x9c89('0x44')]['id']){delete _0x38fc9c[_0x9c89('0x44')]['id'];}return db[_0x9c89('0x2a')][_0x9c89('0x4d')]({'where':{'id':_0x38fc9c[_0x9c89('0x4e')]['id']}})['then'](handleEntityNotFound(_0x341c8a,null))[_0x9c89('0x22')](saveUpdates(_0x38fc9c['body'],null))[_0x9c89('0x22')](respondWithResult(_0x341c8a,null))[_0x9c89('0x41')](handleError(_0x341c8a,null));};exports[_0x9c89('0x23')]=function(_0x3cbd99,_0x3f6561){return db[_0x9c89('0x2a')][_0x9c89('0x4d')]({'where':{'id':_0x3cbd99[_0x9c89('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f6561,null))[_0x9c89('0x22')](removeEntity(_0x3f6561,null))['catch'](handleError(_0x3f6561,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 898e157..89d2b78 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 _0xb1b3=['tools_templates','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template'];(function(_0x4869f4,_0x35d421){var _0x5048f2=function(_0x1f535e){while(--_0x1f535e){_0x4869f4['push'](_0x4869f4['shift']());}};_0x5048f2(++_0x35d421);}(_0xb1b3,0x76));var _0x3b1b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb1b3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x3b1b('0x0'));var util=require(_0x3b1b('0x1'));var logger=require(_0x3b1b('0x2'))('api');var moment=require(_0x3b1b('0x3'));var BPromise=require(_0x3b1b('0x4'));var rp=require(_0x3b1b('0x5'));var fs=require('fs');var path=require(_0x3b1b('0x6'));var rimraf=require(_0x3b1b('0x7'));var config=require(_0x3b1b('0x8'));var attributes=require(_0x3b1b('0x9'));module['exports']=function(_0x204d37,_0x314423){return _0x204d37[_0x3b1b('0xa')](_0x3b1b('0xb'),attributes,{'tableName':_0x3b1b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20f9=['moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger','api'];(function(_0x4aa662,_0x1cc90c){var _0x336478=function(_0x18b6ef){while(--_0x18b6ef){_0x4aa662['push'](_0x4aa662['shift']());}};_0x336478(++_0x1cc90c);}(_0x20f9,0x7e));var _0x920f=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x20f9[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x920f('0x0'));var util=require(_0x920f('0x1'));var logger=require(_0x920f('0x2'))(_0x920f('0x3'));var moment=require(_0x920f('0x4'));var BPromise=require('bluebird');var rp=require(_0x920f('0x5'));var fs=require('fs');var path=require(_0x920f('0x6'));var rimraf=require(_0x920f('0x7'));var config=require(_0x920f('0x8'));var attributes=require(_0x920f('0x9'));module[_0x920f('0xa')]=function(_0x507965,_0x4cda21){return _0x507965[_0x920f('0xb')]('Template',attributes,{'tableName':_0x920f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 11d757c..c13dfa5 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 _0x29c1=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','findAll','options','raw','where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0xbc6566,_0x32d463){var _0x4ed128=function(_0x5555ae){while(--_0x5555ae){_0xbc6566['push'](_0xbc6566['shift']());}};_0x4ed128(++_0x32d463);}(_0x29c1,0x72));var _0x129c=function(_0x32be39,_0x223aa9){_0x32be39=_0x32be39-0x0;var _0x245ab8=_0x29c1[_0x32be39];return _0x245ab8;};'use strict';var _=require('lodash');var util=require(_0x129c('0x0'));var moment=require(_0x129c('0x1'));var BPromise=require(_0x129c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x129c('0x3'));var db=require(_0x129c('0x4'))['db'];var utils=require(_0x129c('0x5'));var logger=require(_0x129c('0x6'))(_0x129c('0x7'));var config=require(_0x129c('0x8'));var jayson=require(_0x129c('0x9'));var client=jayson['client'][_0x129c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e146e,_0x327481,_0x203e50){return new BPromise(function(_0x4955f4,_0x303ad7){return client[_0x129c('0xb')](_0x1e146e,_0x203e50)[_0x129c('0xc')](function(_0x59d810){logger[_0x129c('0xd')]('Template,\x20%s,\x20%s',_0x327481,_0x129c('0xe'));logger[_0x129c('0xf')](_0x129c('0x10'),_0x327481,_0x129c('0xe'),JSON[_0x129c('0x11')](_0x59d810));if(_0x59d810[_0x129c('0x12')]){if(_0x59d810[_0x129c('0x12')][_0x129c('0x13')]===0x1f4){logger[_0x129c('0x12')](_0x129c('0x14'),_0x327481,_0x59d810[_0x129c('0x12')][_0x129c('0x15')]);return _0x303ad7(_0x59d810[_0x129c('0x12')][_0x129c('0x15')]);}logger[_0x129c('0x12')](_0x129c('0x14'),_0x327481,_0x59d810[_0x129c('0x12')]['message']);return _0x4955f4(_0x59d810[_0x129c('0x12')][_0x129c('0x15')]);}else{logger[_0x129c('0xd')](_0x129c('0x14'),_0x327481,_0x129c('0xe'));_0x4955f4(_0x59d810[_0x129c('0x16')][_0x129c('0x15')]);}})['catch'](function(_0x37c4e9){logger[_0x129c('0x12')](_0x129c('0x14'),_0x327481,_0x37c4e9);_0x303ad7(_0x37c4e9);});});}exports[_0x129c('0x17')]=function(_0x5dfb8e){var _0x3423f2=this;return new Promise(function(_0x22610e,_0x4a0836){return db['Template'][_0x129c('0x18')]({'raw':_0x5dfb8e[_0x129c('0x19')]?_0x5dfb8e['options'][_0x129c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5dfb8e[_0x129c('0x19')]?_0x5dfb8e[_0x129c('0x19')][_0x129c('0x1b')]||null:null,'attributes':_0x5dfb8e[_0x129c('0x19')]?_0x5dfb8e[_0x129c('0x19')][_0x129c('0x1c')]||null:null,'limit':_0x5dfb8e[_0x129c('0x19')]?_0x5dfb8e[_0x129c('0x19')]['limit']||null:null,'include':_0x5dfb8e[_0x129c('0x19')]?_0x5dfb8e[_0x129c('0x19')][_0x129c('0x1d')]?_[_0x129c('0x1e')](_0x5dfb8e[_0x129c('0x19')][_0x129c('0x1d')],function(_0x4e830e){return{'model':db[_0x4e830e['model']],'as':_0x4e830e['as'],'attributes':_0x4e830e[_0x129c('0x1c')],'include':_0x4e830e[_0x129c('0x1d')]?_[_0x129c('0x1e')](_0x4e830e[_0x129c('0x1d')],function(_0x457095){return{'model':db[_0x457095[_0x129c('0x1f')]],'as':_0x457095['as'],'attributes':_0x457095['attributes'],'include':_0x457095[_0x129c('0x1d')]?_[_0x129c('0x1e')](_0x457095[_0x129c('0x1d')],function(_0x529e09){return{'model':db[_0x529e09[_0x129c('0x1f')]],'as':_0x529e09['as'],'attributes':_0x529e09[_0x129c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x129c('0xc')](function(_0x3707d5){logger[_0x129c('0xd')](_0x129c('0x17'),_0x5dfb8e);logger[_0x129c('0xf')](_0x129c('0x17'),_0x5dfb8e,JSON[_0x129c('0x11')](_0x3707d5));_0x22610e(_0x3707d5);})['catch'](function(_0x2e9a5e){logger[_0x129c('0x12')](_0x129c('0x17'),_0x2e9a5e[_0x129c('0x15')],_0x5dfb8e);_0x4a0836(_0x3423f2[_0x129c('0x12')](0x1f4,_0x2e9a5e[_0x129c('0x15')]));});});}; \ No newline at end of file +var _0xb3ee=['request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http'];(function(_0x1c3c9c,_0xd0946a){var _0x1a89a1=function(_0x231eea){while(--_0x231eea){_0x1c3c9c['push'](_0x1c3c9c['shift']());}};_0x1a89a1(++_0xd0946a);}(_0xb3ee,0x6c));var _0xeb3e=function(_0x5ef18f,_0x15af7f){_0x5ef18f=_0x5ef18f-0x0;var _0x19192f=_0xb3ee[_0x5ef18f];return _0x19192f;};'use strict';var _=require('lodash');var util=require(_0xeb3e('0x0'));var moment=require(_0xeb3e('0x1'));var BPromise=require('bluebird');var rs=require(_0xeb3e('0x2'));var fs=require('fs');var Redis=require(_0xeb3e('0x3'));var db=require(_0xeb3e('0x4'))['db'];var utils=require(_0xeb3e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeb3e('0x6')][_0xeb3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x261b0e,_0x5713e8,_0x33fed2){return new BPromise(function(_0x1e2cb4,_0x5ead5a){return client[_0xeb3e('0x8')](_0x261b0e,_0x33fed2)[_0xeb3e('0x9')](function(_0x252914){logger[_0xeb3e('0xa')](_0xeb3e('0xb'),_0x5713e8,'request\x20sent');logger[_0xeb3e('0xc')](_0xeb3e('0xd'),_0x5713e8,'request\x20sent',JSON[_0xeb3e('0xe')](_0x252914));if(_0x252914[_0xeb3e('0xf')]){if(_0x252914[_0xeb3e('0xf')]['code']===0x1f4){logger[_0xeb3e('0xf')](_0xeb3e('0xb'),_0x5713e8,_0x252914['error'][_0xeb3e('0x10')]);return _0x5ead5a(_0x252914[_0xeb3e('0xf')][_0xeb3e('0x10')]);}logger['error'](_0xeb3e('0xb'),_0x5713e8,_0x252914['error'][_0xeb3e('0x10')]);return _0x1e2cb4(_0x252914[_0xeb3e('0xf')]['message']);}else{logger[_0xeb3e('0xa')](_0xeb3e('0xb'),_0x5713e8,_0xeb3e('0x11'));_0x1e2cb4(_0x252914[_0xeb3e('0x12')]['message']);}})[_0xeb3e('0x13')](function(_0x3fd9a5){logger[_0xeb3e('0xf')]('Template,\x20%s,\x20%s',_0x5713e8,_0x3fd9a5);_0x5ead5a(_0x3fd9a5);});});}exports[_0xeb3e('0x14')]=function(_0x35b61c){var _0x18ab29=this;return new Promise(function(_0x5d8faf,_0x1e296f){return db[_0xeb3e('0x15')][_0xeb3e('0x16')]({'raw':_0x35b61c['options']?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x18')]===undefined?!![]:![]:!![],'where':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x19')]||null:null,'attributes':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x1a')]||null:null,'limit':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')]['limit']||null:null,'include':_0x35b61c[_0xeb3e('0x17')]?_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x1b')]?_['map'](_0x35b61c[_0xeb3e('0x17')][_0xeb3e('0x1b')],function(_0x4f5480){return{'model':db[_0x4f5480['model']],'as':_0x4f5480['as'],'attributes':_0x4f5480[_0xeb3e('0x1a')],'include':_0x4f5480['include']?_[_0xeb3e('0x1c')](_0x4f5480[_0xeb3e('0x1b')],function(_0x25606d){return{'model':db[_0x25606d['model']],'as':_0x25606d['as'],'attributes':_0x25606d[_0xeb3e('0x1a')],'include':_0x25606d[_0xeb3e('0x1b')]?_[_0xeb3e('0x1c')](_0x25606d[_0xeb3e('0x1b')],function(_0x6da3af){return{'model':db[_0x6da3af['model']],'as':_0x6da3af['as'],'attributes':_0x6da3af[_0xeb3e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xeb3e('0x9')](function(_0x4aa088){logger[_0xeb3e('0xa')](_0xeb3e('0x14'),_0x35b61c);logger['debug'](_0xeb3e('0x14'),_0x35b61c,JSON[_0xeb3e('0xe')](_0x4aa088));_0x5d8faf(_0x4aa088);})[_0xeb3e('0x13')](function(_0x1f3624){logger[_0xeb3e('0xf')](_0xeb3e('0x14'),_0x1f3624[_0xeb3e('0x10')],_0x35b61c);_0x1e296f(_0x18ab29[_0xeb3e('0xf')](0x1f4,_0x1f3624[_0xeb3e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 20d4356..a293aef 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 _0xdd8e=['post','addAnyCondition','addAction','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','create','addAllCondition'];(function(_0x2cfbef,_0x2d8e4c){var _0x356ae3=function(_0x258749){while(--_0x258749){_0x2cfbef['push'](_0x2cfbef['shift']());}};_0x356ae3(++_0x2d8e4c);}(_0xdd8e,0x1f4));var _0xedd8=function(_0x4c7559,_0x21cc16){_0x4c7559=_0x4c7559-0x0;var _0x17bb0d=_0xdd8e[_0x4c7559];return _0x17bb0d;};'use strict';var multer=require(_0xedd8('0x0'));var util=require('util');var path=require(_0xedd8('0x1'));var timeout=require(_0xedd8('0x2'));var express=require(_0xedd8('0x3'));var router=express[_0xedd8('0x4')]();var fs_extra=require(_0xedd8('0x5'));var auth=require(_0xedd8('0x6'));var interaction=require(_0xedd8('0x7'));var config=require(_0xedd8('0x8'));var controller=require(_0xedd8('0x9'));router[_0xedd8('0xa')]('/',auth[_0xedd8('0xb')](),controller[_0xedd8('0xc')]);router[_0xedd8('0xa')](_0xedd8('0xd'),auth['isAuthenticated'](),controller[_0xedd8('0xe')]);router[_0xedd8('0xa')](_0xedd8('0xf'),auth['isAuthenticated'](),controller[_0xedd8('0x10')]);router['get']('/:id/any_conditions',auth[_0xedd8('0xb')](),controller[_0xedd8('0x11')]);router[_0xedd8('0xa')](_0xedd8('0x12'),auth[_0xedd8('0xb')](),controller[_0xedd8('0x13')]);router['post']('/',auth[_0xedd8('0xb')](),controller[_0xedd8('0x14')]);router['post'](_0xedd8('0xf'),auth[_0xedd8('0xb')](),controller[_0xedd8('0x15')]);router[_0xedd8('0x16')]('/:id/any_conditions',auth[_0xedd8('0xb')](),controller[_0xedd8('0x17')]);router[_0xedd8('0x16')]('/:id/actions',auth[_0xedd8('0xb')](),controller[_0xedd8('0x18')]);router[_0xedd8('0x19')](_0xedd8('0xd'),auth[_0xedd8('0xb')](),controller[_0xedd8('0x1a')]);router['delete'](_0xedd8('0xd'),auth[_0xedd8('0xb')](),controller[_0xedd8('0x1b')]);module[_0xedd8('0x1c')]=router; \ No newline at end of file +var _0x19a3=['addAction','put','/:id','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x19a3,0x1d9));var _0x319a=function(_0x18ed60,_0x3e3d4c){_0x18ed60=_0x18ed60-0x0;var _0x4cabfd=_0x19a3[_0x18ed60];return _0x4cabfd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x319a('0x0'));var timeout=require(_0x319a('0x1'));var express=require(_0x319a('0x2'));var router=express[_0x319a('0x3')]();var fs_extra=require(_0x319a('0x4'));var auth=require(_0x319a('0x5'));var interaction=require(_0x319a('0x6'));var config=require(_0x319a('0x7'));var controller=require(_0x319a('0x8'));router[_0x319a('0x9')]('/',auth[_0x319a('0xa')](),controller['index']);router[_0x319a('0x9')]('/:id',auth[_0x319a('0xa')](),controller[_0x319a('0xb')]);router[_0x319a('0x9')](_0x319a('0xc'),auth[_0x319a('0xa')](),controller[_0x319a('0xd')]);router[_0x319a('0x9')](_0x319a('0xe'),auth[_0x319a('0xa')](),controller[_0x319a('0xf')]);router[_0x319a('0x9')](_0x319a('0x10'),auth[_0x319a('0xa')](),controller['getActions']);router[_0x319a('0x11')]('/',auth[_0x319a('0xa')](),controller[_0x319a('0x12')]);router[_0x319a('0x11')](_0x319a('0xc'),auth[_0x319a('0xa')](),controller[_0x319a('0x13')]);router[_0x319a('0x11')](_0x319a('0xe'),auth[_0x319a('0xa')](),controller[_0x319a('0x14')]);router[_0x319a('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x319a('0x15')]);router[_0x319a('0x16')](_0x319a('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x319a('0x18')](_0x319a('0x17'),auth[_0x319a('0xa')](),controller[_0x319a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 74a8b14..3d2183b 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 _0x3a2c=['exports','STRING','BOOLEAN'];(function(_0x1c816e,_0xbd3af5){var _0x2e0234=function(_0x138c41){while(--_0x138c41){_0x1c816e['push'](_0x1c816e['shift']());}};_0x2e0234(++_0xbd3af5);}(_0x3a2c,0xa5));var _0xc3a2=function(_0x4fd0b1,_0x4760cc){_0x4fd0b1=_0x4fd0b1-0x0;var _0x18044b=_0x3a2c[_0x4fd0b1];return _0x18044b;};'use strict';var Sequelize=require('sequelize');module[_0xc3a2('0x0')]={'name':{'type':Sequelize[_0xc3a2('0x1')]},'channel':{'type':Sequelize[_0xc3a2('0x1')]},'description':{'type':Sequelize[_0xc3a2('0x1')]},'status':{'type':Sequelize[_0xc3a2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7f5d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x50aa9d,_0x26b4a4){var _0x294187=function(_0x686ceb){while(--_0x686ceb){_0x50aa9d['push'](_0x50aa9d['shift']());}};_0x294187(++_0x26b4a4);}(_0x7f5d,0x183));var _0xd7f5=function(_0x2f3ab1,_0x102415){_0x2f3ab1=_0x2f3ab1-0x0;var _0x67c4c9=_0x7f5d[_0x2f3ab1];return _0x67c4c9;};'use strict';var Sequelize=require(_0xd7f5('0x0'));module[_0xd7f5('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7f5('0x2')]},'status':{'type':Sequelize[_0xd7f5('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 f1f8db8..20f711d 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 _0xed8b=['stack','name','send','map','Trigger','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','error'];(function(_0x346551,_0x13ddd7){var _0x3fc4c5=function(_0x552e85){while(--_0x552e85){_0x346551['push'](_0x346551['shift']());}};_0x3fc4c5(++_0x13ddd7);}(_0xed8b,0x9b));var _0xbed8=function(_0x48103a,_0x5eb351){_0x48103a=_0x48103a-0x0;var _0x3585a8=_0xed8b[_0x48103a];return _0x3585a8;};'use strict';var emlformat=require(_0xbed8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbed8('0x1'));var jsonpatch=require(_0xbed8('0x2'));var rp=require(_0xbed8('0x3'));var moment=require(_0xbed8('0x4'));var BPromise=require(_0xbed8('0x5'));var Mustache=require(_0xbed8('0x6'));var util=require(_0xbed8('0x7'));var path=require(_0xbed8('0x8'));var sox=require(_0xbed8('0x9'));var csv=require(_0xbed8('0xa'));var ejs=require(_0xbed8('0xb'));var fs=require('fs');var fs_extra=require(_0xbed8('0xc'));var _=require(_0xbed8('0xd'));var squel=require(_0xbed8('0xe'));var crypto=require(_0xbed8('0xf'));var jsforce=require(_0xbed8('0x10'));var deskjs=require(_0xbed8('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbed8('0x12'));var Papa=require('papaparse');var Redis=require(_0xbed8('0x13'));var authService=require(_0xbed8('0x14'));var qs=require(_0xbed8('0x15'));var as=require(_0xbed8('0x16'));var hardwareService=require(_0xbed8('0x17'));var logger=require(_0xbed8('0x18'))(_0xbed8('0x19'));var utils=require(_0xbed8('0x1a'));var config=require(_0xbed8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29ff8c,_0x112eeb){_0x112eeb=_0x112eeb||0xcc;return function(_0x4ee246){if(_0x4ee246){return _0x29ff8c[_0xbed8('0x1c')](_0x112eeb);}return _0x29ff8c[_0xbed8('0x1d')](_0x112eeb)[_0xbed8('0x1e')]();};}function respondWithResult(_0xc2f372,_0x5187b7){_0x5187b7=_0x5187b7||0xc8;return function(_0x5aae9d){if(_0x5aae9d){return _0xc2f372[_0xbed8('0x1d')](_0x5187b7)[_0xbed8('0x1f')](_0x5aae9d);}};}function respondWithFilteredResult(_0x59960a,_0x481656){return function(_0x17e882){if(_0x17e882){var _0xc34968=typeof _0x481656[_0xbed8('0x20')]===_0xbed8('0x21')&&typeof _0x481656['limit']==='undefined';var _0x552e19=_0x17e882[_0xbed8('0x22')];var _0x3deb24=_0xc34968?0x0:_0x481656[_0xbed8('0x20')];var _0x44ccb0=_0xc34968?_0x17e882[_0xbed8('0x22')]:_0x481656[_0xbed8('0x20')]+_0x481656[_0xbed8('0x23')];var _0xa0abc;if(_0x44ccb0>=_0x552e19){_0x44ccb0=_0x552e19;_0xa0abc=0xc8;}else{_0xa0abc=0xce;}_0x59960a['status'](_0xa0abc);return _0x59960a[_0xbed8('0x24')](_0xbed8('0x25'),_0x3deb24+'-'+_0x44ccb0+'/'+_0x552e19)['json'](_0x17e882);}return null;};}function patchUpdates(_0x292911){return function(_0x524880){try{jsonpatch[_0xbed8('0x26')](_0x524880,_0x292911,!![]);}catch(_0x8558e0){return BPromise[_0xbed8('0x27')](_0x8558e0);}return _0x524880['save']();};}function saveUpdates(_0x2ecf03,_0x398f61){return function(_0x332cfc){if(_0x332cfc){return _0x332cfc[_0xbed8('0x28')](_0x2ecf03)[_0xbed8('0x29')](function(_0x4f85cf){return _0x4f85cf;});}return null;};}function removeEntity(_0x564d3a,_0x498651){return function(_0x43763d){if(_0x43763d){return _0x43763d[_0xbed8('0x2a')]()[_0xbed8('0x29')](function(){var _0x5a9009=_0x43763d[_0xbed8('0x2b')]({'plain':!![]});var _0x1744e0=_0xbed8('0x2c');return db[_0xbed8('0x2d')][_0xbed8('0x2a')]({'where':{'type':_0x1744e0,'resourceId':_0x5a9009['id']}})[_0xbed8('0x29')](function(){return _0x43763d;});})[_0xbed8('0x29')](function(){_0x564d3a[_0xbed8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c652,_0x269bcc){return function(_0x2f27f9){if(!_0x2f27f9){_0x58c652[_0xbed8('0x1c')](0x194);}return _0x2f27f9;};}function handleError(_0x6be0f1,_0x5d9e96){_0x5d9e96=_0x5d9e96||0x1f4;return function(_0x46ddbd){logger[_0xbed8('0x2e')](_0x46ddbd[_0xbed8('0x2f')]);if(_0x46ddbd['name']){delete _0x46ddbd[_0xbed8('0x30')];}_0x6be0f1['status'](_0x5d9e96)[_0xbed8('0x31')](_0x46ddbd);};}exports['index']=function(_0x33b711,_0x1aeaf2){var _0x469df3={},_0x412230={},_0x2d3bc7={'count':0x0,'rows':[]};var _0x36e039=_[_0xbed8('0x32')](db[_0xbed8('0x33')][_0xbed8('0x34')],function(_0x1bbb05){return{'name':_0x1bbb05[_0xbed8('0x35')],'type':_0x1bbb05['type'][_0xbed8('0x36')]};});_0x412230[_0xbed8('0x37')]=_[_0xbed8('0x32')](_0x36e039,_0xbed8('0x30'));_0x412230['query']=_['keys'](_0x33b711['query']);_0x412230[_0xbed8('0x38')]=_[_0xbed8('0x39')](_0x412230[_0xbed8('0x37')],_0x412230[_0xbed8('0x3a')]);_0x469df3[_0xbed8('0x3b')]=_[_0xbed8('0x39')](_0x412230[_0xbed8('0x37')],qs[_0xbed8('0x3c')](_0x33b711[_0xbed8('0x3a')][_0xbed8('0x3c')]));_0x469df3[_0xbed8('0x3b')]=_0x469df3['attributes'][_0xbed8('0x3d')]?_0x469df3[_0xbed8('0x3b')]:_0x412230[_0xbed8('0x37')];if(!_0x33b711[_0xbed8('0x3a')][_0xbed8('0x3e')](_0xbed8('0x3f'))){_0x469df3[_0xbed8('0x23')]=qs[_0xbed8('0x23')](_0x33b711[_0xbed8('0x3a')]['limit']);_0x469df3[_0xbed8('0x20')]=qs['offset'](_0x33b711['query']['offset']);}_0x469df3[_0xbed8('0x40')]=qs[_0xbed8('0x41')](_0x33b711[_0xbed8('0x3a')]['sort']);_0x469df3[_0xbed8('0x42')]=qs['filters'](_[_0xbed8('0x43')](_0x33b711[_0xbed8('0x3a')],_0x412230[_0xbed8('0x38')]),_0x36e039);if(_0x33b711[_0xbed8('0x3a')][_0xbed8('0x44')]){_0x469df3[_0xbed8('0x42')]=_['merge'](_0x469df3['where'],{'$or':_[_0xbed8('0x32')](_0x36e039,function(_0x352601){if(_0x352601[_0xbed8('0x45')]!==_0xbed8('0x46')){var _0x4f82f3={};_0x4f82f3[_0x352601['name']]={'$like':'%'+_0x33b711[_0xbed8('0x3a')][_0xbed8('0x44')]+'%'};return _0x4f82f3;}})});}_0x469df3=_[_0xbed8('0x47')]({},_0x469df3,_0x33b711['options']);var _0x378b9c={'where':_0x469df3[_0xbed8('0x42')]};return db[_0xbed8('0x33')][_0xbed8('0x22')](_0x378b9c)[_0xbed8('0x29')](function(_0x50a0f1){_0x2d3bc7[_0xbed8('0x22')]=_0x50a0f1;if(_0x33b711[_0xbed8('0x3a')][_0xbed8('0x48')]){_0x469df3[_0xbed8('0x49')]=[{'all':!![]}];}return db[_0xbed8('0x33')][_0xbed8('0x4a')](_0x469df3);})[_0xbed8('0x29')](function(_0x41fb92){_0x2d3bc7[_0xbed8('0x4b')]=_0x41fb92;return _0x2d3bc7;})['then'](respondWithFilteredResult(_0x1aeaf2,_0x469df3))['catch'](handleError(_0x1aeaf2,null));};exports[_0xbed8('0x4c')]=function(_0x4deb6b,_0x23338d){var _0x1e1386={'raw':![],'where':{'id':_0x4deb6b[_0xbed8('0x4d')]['id']}},_0x40ed41={};_0x40ed41[_0xbed8('0x37')]=_['keys'](db[_0xbed8('0x33')]['rawAttributes']);_0x40ed41[_0xbed8('0x3a')]=_[_0xbed8('0x4e')](_0x4deb6b['query']);_0x40ed41[_0xbed8('0x38')]=_[_0xbed8('0x39')](_0x40ed41[_0xbed8('0x37')],_0x40ed41['query']);_0x1e1386['attributes']=_[_0xbed8('0x39')](_0x40ed41[_0xbed8('0x37')],qs[_0xbed8('0x3c')](_0x4deb6b[_0xbed8('0x3a')][_0xbed8('0x3c')]));_0x1e1386[_0xbed8('0x3b')]=_0x1e1386['attributes'][_0xbed8('0x3d')]?_0x1e1386[_0xbed8('0x3b')]:_0x40ed41['model'];if(_0x4deb6b[_0xbed8('0x3a')]['includeAll']){_0x1e1386[_0xbed8('0x49')]=[{'all':!![]}];}_0x1e1386=_[_0xbed8('0x47')]({},_0x1e1386,_0x4deb6b[_0xbed8('0x4f')]);return db[_0xbed8('0x33')]['find'](_0x1e1386)['then'](handleEntityNotFound(_0x23338d,null))[_0xbed8('0x29')](respondWithResult(_0x23338d,null))[_0xbed8('0x50')](handleError(_0x23338d,null));};exports[_0xbed8('0x51')]=function(_0x1fc6e4,_0x7f2fe){return db[_0xbed8('0x33')]['create'](_0x1fc6e4[_0xbed8('0x52')],{})[_0xbed8('0x29')](function(_0x290d53){var _0x5be074=_0x1fc6e4[_0xbed8('0x53')][_0xbed8('0x2b')]({'plain':!![]});if(!_0x5be074)throw new Error(_0xbed8('0x54'));if(_0x5be074[_0xbed8('0x55')]===_0xbed8('0x53')){var _0x468afb=_0x290d53[_0xbed8('0x2b')]({'plain':!![]});var _0xe53630=_0xbed8('0x2c');return db[_0xbed8('0x56')][_0xbed8('0x57')]({'where':{'name':_0xe53630,'userProfileId':_0x5be074[_0xbed8('0x58')]},'raw':!![]})[_0xbed8('0x29')](function(_0x4390af){if(_0x4390af&&_0x4390af[_0xbed8('0x59')]===0x0){return db[_0xbed8('0x2d')][_0xbed8('0x51')]({'name':_0x468afb[_0xbed8('0x30')],'resourceId':_0x468afb['id'],'type':_0x4390af['name'],'sectionId':_0x4390af['id']},{})[_0xbed8('0x29')](function(){return _0x290d53;});}else{return _0x290d53;}})[_0xbed8('0x50')](function(_0x1b21d3){logger[_0xbed8('0x2e')](_0xbed8('0x5a'),_0x1b21d3);throw _0x1b21d3;});}return _0x290d53;})[_0xbed8('0x29')](respondWithResult(_0x7f2fe,0xc9))['catch'](handleError(_0x7f2fe,null));};exports['update']=function(_0x39951c,_0x30348f){if(_0x39951c[_0xbed8('0x52')]['id']){delete _0x39951c[_0xbed8('0x52')]['id'];}return db['Trigger'][_0xbed8('0x57')]({'where':{'id':_0x39951c[_0xbed8('0x4d')]['id']}})[_0xbed8('0x29')](handleEntityNotFound(_0x30348f,null))['then'](saveUpdates(_0x39951c[_0xbed8('0x52')],null))[_0xbed8('0x29')](respondWithResult(_0x30348f,null))[_0xbed8('0x50')](handleError(_0x30348f,null));};exports['destroy']=function(_0x31e4fd,_0x5e8e07){return db[_0xbed8('0x33')][_0xbed8('0x57')]({'where':{'id':_0x31e4fd[_0xbed8('0x4d')]['id']}})[_0xbed8('0x29')](handleEntityNotFound(_0x5e8e07,null))[_0xbed8('0x29')](removeEntity(_0x5e8e07,null))[_0xbed8('0x50')](handleError(_0x5e8e07,null));};exports[_0xbed8('0x5b')]=function(_0x46ab99,_0x28d417,_0x334da4){if(_0x46ab99[_0xbed8('0x52')]['id']){delete _0x46ab99[_0xbed8('0x52')]['id'];}return db[_0xbed8('0x33')]['find']({'where':{'id':_0x46ab99['params']['id']}})[_0xbed8('0x29')](handleEntityNotFound(_0x28d417,null))['then'](function(_0x4c393b){if(_0x4c393b){_0x46ab99[_0xbed8('0x52')][_0xbed8('0x5c')]=_0x4c393b['id'];return db[_0xbed8('0x5d')]['create'](_0x46ab99[_0xbed8('0x52')]);}})[_0xbed8('0x29')](respondWithResult(_0x28d417,null))[_0xbed8('0x50')](handleError(_0x28d417,null));};exports[_0xbed8('0x5e')]=function(_0x284422,_0xe9bdb6,_0x166a84){if(_0x284422[_0xbed8('0x52')]['id']){delete _0x284422[_0xbed8('0x52')]['id'];}return db[_0xbed8('0x33')][_0xbed8('0x57')]({'where':{'id':_0x284422[_0xbed8('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe9bdb6,null))[_0xbed8('0x29')](function(_0x472d1d){if(_0x472d1d){_0x284422[_0xbed8('0x52')]['TriggerAnyId']=_0x472d1d['id'];return db[_0xbed8('0x5d')]['create'](_0x284422['body']);}})[_0xbed8('0x29')](respondWithResult(_0xe9bdb6,null))[_0xbed8('0x50')](handleError(_0xe9bdb6,null));};exports[_0xbed8('0x5f')]=function(_0x2e7e5b,_0x41b8ff,_0x4f5b3c){var _0x27dbba={};var _0x30317b={};var _0x25199e;var _0x572b43;return db[_0xbed8('0x33')][_0xbed8('0x60')]({'where':{'id':_0x2e7e5b[_0xbed8('0x4d')]['id']}})[_0xbed8('0x29')](handleEntityNotFound(_0x41b8ff,null))[_0xbed8('0x29')](function(_0x45e832){if(_0x45e832){_0x25199e=_0x45e832;_0x30317b[_0xbed8('0x37')]=_[_0xbed8('0x4e')](db[_0xbed8('0x5d')][_0xbed8('0x34')]);_0x30317b[_0xbed8('0x3a')]=_['keys'](_0x2e7e5b['query']);_0x30317b['filters']=_[_0xbed8('0x39')](_0x30317b[_0xbed8('0x37')],_0x30317b['query']);_0x27dbba[_0xbed8('0x3b')]=_[_0xbed8('0x39')](_0x30317b[_0xbed8('0x37')],qs['fields'](_0x2e7e5b[_0xbed8('0x3a')]['fields']));_0x27dbba['attributes']=_0x27dbba['attributes'][_0xbed8('0x3d')]?_0x27dbba['attributes']:_0x30317b[_0xbed8('0x37')];_0x27dbba[_0xbed8('0x40')]=qs[_0xbed8('0x41')](_0x2e7e5b[_0xbed8('0x3a')][_0xbed8('0x41')]);_0x27dbba[_0xbed8('0x42')]=qs[_0xbed8('0x38')](_[_0xbed8('0x43')](_0x2e7e5b[_0xbed8('0x3a')],_0x30317b[_0xbed8('0x38')]));if(_0x2e7e5b[_0xbed8('0x3a')][_0xbed8('0x44')]){_0x27dbba[_0xbed8('0x42')]=_['merge'](_0x27dbba[_0xbed8('0x42')],{'$or':_[_0xbed8('0x32')](_0x27dbba['attributes'],function(_0x396e3f){var _0x1d8b24={};_0x1d8b24[_0x396e3f]={'$like':'%'+_0x2e7e5b[_0xbed8('0x3a')][_0xbed8('0x44')]+'%'};return _0x1d8b24;})});}_0x27dbba=_[_0xbed8('0x47')]({},_0x27dbba,_0x2e7e5b[_0xbed8('0x4f')]);return _0x25199e[_0xbed8('0x5f')](_0x27dbba);}})['then'](function(_0x4b94ed){if(_0x4b94ed){_0x572b43=_0x4b94ed['length'];if(!_0x2e7e5b['query']['hasOwnProperty'](_0xbed8('0x3f'))){_0x27dbba[_0xbed8('0x23')]=qs[_0xbed8('0x23')](_0x2e7e5b[_0xbed8('0x3a')][_0xbed8('0x23')]);_0x27dbba[_0xbed8('0x20')]=qs[_0xbed8('0x20')](_0x2e7e5b[_0xbed8('0x3a')][_0xbed8('0x20')]);}return _0x25199e[_0xbed8('0x5f')](_0x27dbba);}})[_0xbed8('0x29')](function(_0x3a1c58){if(_0x3a1c58){return _0x3a1c58?{'count':_0x572b43,'rows':_0x3a1c58}:null;}})[_0xbed8('0x29')](respondWithResult(_0x41b8ff,null))['catch'](handleError(_0x41b8ff,null));};exports['getAnyConditions']=function(_0x2682d4,_0x7b4cc1,_0x19e736){var _0x4ac9f3={};var _0x331eaf={};var _0x37707b;var _0x485510;return db[_0xbed8('0x33')]['findOne']({'where':{'id':_0x2682d4[_0xbed8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7b4cc1,null))[_0xbed8('0x29')](function(_0x3adbb0){if(_0x3adbb0){_0x37707b=_0x3adbb0;_0x331eaf[_0xbed8('0x37')]=_[_0xbed8('0x4e')](db['Condition'][_0xbed8('0x34')]);_0x331eaf[_0xbed8('0x3a')]=_['keys'](_0x2682d4[_0xbed8('0x3a')]);_0x331eaf[_0xbed8('0x38')]=_[_0xbed8('0x39')](_0x331eaf[_0xbed8('0x37')],_0x331eaf[_0xbed8('0x3a')]);_0x4ac9f3[_0xbed8('0x3b')]=_[_0xbed8('0x39')](_0x331eaf[_0xbed8('0x37')],qs['fields'](_0x2682d4[_0xbed8('0x3a')][_0xbed8('0x3c')]));_0x4ac9f3[_0xbed8('0x3b')]=_0x4ac9f3[_0xbed8('0x3b')][_0xbed8('0x3d')]?_0x4ac9f3[_0xbed8('0x3b')]:_0x331eaf[_0xbed8('0x37')];_0x4ac9f3[_0xbed8('0x40')]=qs['sort'](_0x2682d4[_0xbed8('0x3a')][_0xbed8('0x41')]);_0x4ac9f3[_0xbed8('0x42')]=qs['filters'](_['pick'](_0x2682d4[_0xbed8('0x3a')],_0x331eaf['filters']));if(_0x2682d4[_0xbed8('0x3a')][_0xbed8('0x44')]){_0x4ac9f3[_0xbed8('0x42')]=_['merge'](_0x4ac9f3['where'],{'$or':_[_0xbed8('0x32')](_0x4ac9f3['attributes'],function(_0x41275f){var _0x2e5e93={};_0x2e5e93[_0x41275f]={'$like':'%'+_0x2682d4[_0xbed8('0x3a')][_0xbed8('0x44')]+'%'};return _0x2e5e93;})});}_0x4ac9f3=_[_0xbed8('0x47')]({},_0x4ac9f3,_0x2682d4[_0xbed8('0x4f')]);return _0x37707b['getAnyConditions'](_0x4ac9f3);}})[_0xbed8('0x29')](function(_0x2351ec){if(_0x2351ec){_0x485510=_0x2351ec['length'];if(!_0x2682d4['query'][_0xbed8('0x3e')](_0xbed8('0x3f'))){_0x4ac9f3['limit']=qs['limit'](_0x2682d4['query'][_0xbed8('0x23')]);_0x4ac9f3[_0xbed8('0x20')]=qs[_0xbed8('0x20')](_0x2682d4[_0xbed8('0x3a')][_0xbed8('0x20')]);}return _0x37707b[_0xbed8('0x61')](_0x4ac9f3);}})['then'](function(_0x36510a){if(_0x36510a){return _0x36510a?{'count':_0x485510,'rows':_0x36510a}:null;}})['then'](respondWithResult(_0x7b4cc1,null))[_0xbed8('0x50')](handleError(_0x7b4cc1,null));};exports['addAction']=function(_0x306397,_0x49c5f4,_0x5546d5){if(_0x306397[_0xbed8('0x52')]['id']){delete _0x306397[_0xbed8('0x52')]['id'];}return db['Trigger'][_0xbed8('0x57')]({'where':{'id':_0x306397[_0xbed8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49c5f4,null))[_0xbed8('0x29')](function(_0x34d355){if(_0x34d355){_0x306397[_0xbed8('0x52')][_0xbed8('0x62')]=_0x34d355['id'];return db[_0xbed8('0x63')][_0xbed8('0x51')](_0x306397[_0xbed8('0x52')]);}})[_0xbed8('0x29')](respondWithResult(_0x49c5f4,null))[_0xbed8('0x50')](handleError(_0x49c5f4,null));};exports[_0xbed8('0x64')]=function(_0x59adc6,_0x50603e,_0x2885e0){var _0x3ff3bf={};var _0x19d238={};var _0x5a2ab5;var _0x1ceb5d;return db[_0xbed8('0x33')][_0xbed8('0x60')]({'where':{'id':_0x59adc6[_0xbed8('0x4d')]['id']}})[_0xbed8('0x29')](handleEntityNotFound(_0x50603e,null))[_0xbed8('0x29')](function(_0x28f18d){if(_0x28f18d){_0x5a2ab5=_0x28f18d;_0x19d238['model']=_[_0xbed8('0x4e')](db[_0xbed8('0x63')][_0xbed8('0x34')]);_0x19d238[_0xbed8('0x3a')]=_[_0xbed8('0x4e')](_0x59adc6[_0xbed8('0x3a')]);_0x19d238[_0xbed8('0x38')]=_[_0xbed8('0x39')](_0x19d238[_0xbed8('0x37')],_0x19d238[_0xbed8('0x3a')]);_0x3ff3bf[_0xbed8('0x3b')]=_[_0xbed8('0x39')](_0x19d238['model'],qs['fields'](_0x59adc6[_0xbed8('0x3a')]['fields']));_0x3ff3bf['attributes']=_0x3ff3bf[_0xbed8('0x3b')]['length']?_0x3ff3bf[_0xbed8('0x3b')]:_0x19d238[_0xbed8('0x37')];_0x3ff3bf['order']=qs[_0xbed8('0x41')](_0x59adc6[_0xbed8('0x3a')][_0xbed8('0x41')]);_0x3ff3bf['where']=qs['filters'](_[_0xbed8('0x43')](_0x59adc6[_0xbed8('0x3a')],_0x19d238[_0xbed8('0x38')]));if(_0x59adc6[_0xbed8('0x3a')]['filter']){_0x3ff3bf[_0xbed8('0x42')]=_['merge'](_0x3ff3bf[_0xbed8('0x42')],{'$or':_[_0xbed8('0x32')](_0x3ff3bf[_0xbed8('0x3b')],function(_0x5df6a8){var _0x11e9fe={};_0x11e9fe[_0x5df6a8]={'$like':'%'+_0x59adc6[_0xbed8('0x3a')][_0xbed8('0x44')]+'%'};return _0x11e9fe;})});}_0x3ff3bf=_['merge']({},_0x3ff3bf,_0x59adc6['options']);return _0x5a2ab5[_0xbed8('0x64')](_0x3ff3bf);}})[_0xbed8('0x29')](function(_0x144e7f){if(_0x144e7f){_0x1ceb5d=_0x144e7f[_0xbed8('0x3d')];if(!_0x59adc6[_0xbed8('0x3a')][_0xbed8('0x3e')](_0xbed8('0x3f'))){_0x3ff3bf[_0xbed8('0x23')]=qs['limit'](_0x59adc6[_0xbed8('0x3a')][_0xbed8('0x23')]);_0x3ff3bf[_0xbed8('0x20')]=qs[_0xbed8('0x20')](_0x59adc6[_0xbed8('0x3a')][_0xbed8('0x20')]);}return _0x5a2ab5[_0xbed8('0x64')](_0x3ff3bf);}})[_0xbed8('0x29')](function(_0x58cce5){if(_0x58cce5){return _0x58cce5?{'count':_0x1ceb5d,'rows':_0x58cce5}:null;}})[_0xbed8('0x29')](respondWithResult(_0x50603e,null))[_0xbed8('0x50')](handleError(_0x50603e,null));}; \ No newline at end of file +var _0x4fb7=['ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x4fb7,0x107));var _0x74fb=function(_0xeac141,_0x161353){_0xeac141=_0xeac141-0x0;var _0x4e8f20=_0x4fb7[_0xeac141];return _0x4e8f20;};'use strict';var emlformat=require(_0x74fb('0x0'));var rimraf=require(_0x74fb('0x1'));var zipdir=require(_0x74fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74fb('0x3'));var moment=require(_0x74fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x74fb('0x5'));var util=require(_0x74fb('0x6'));var path=require(_0x74fb('0x7'));var sox=require(_0x74fb('0x8'));var csv=require(_0x74fb('0x9'));var ejs=require(_0x74fb('0xa'));var fs=require('fs');var fs_extra=require(_0x74fb('0xb'));var _=require(_0x74fb('0xc'));var squel=require('squel');var crypto=require(_0x74fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x74fb('0xe'));var toCsv=require(_0x74fb('0x9'));var querystring=require('querystring');var Papa=require(_0x74fb('0xf'));var Redis=require(_0x74fb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x74fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x74fb('0x12'));var utils=require(_0x74fb('0x13'));var config=require(_0x74fb('0x14'));var licenseUtil=require(_0x74fb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37b8d3,_0x4bb21f){_0x4bb21f=_0x4bb21f||0xcc;return function(_0x2d498e){if(_0x2d498e){return _0x37b8d3['sendStatus'](_0x4bb21f);}return _0x37b8d3['status'](_0x4bb21f)[_0x74fb('0x16')]();};}function respondWithResult(_0x80f915,_0x3b93bf){_0x3b93bf=_0x3b93bf||0xc8;return function(_0x2664e4){if(_0x2664e4){return _0x80f915[_0x74fb('0x17')](_0x3b93bf)[_0x74fb('0x18')](_0x2664e4);}};}function respondWithFilteredResult(_0x50fd34,_0x4f0815){return function(_0x43f357){if(_0x43f357){var _0x39944c=typeof _0x4f0815[_0x74fb('0x19')]===_0x74fb('0x1a')&&typeof _0x4f0815[_0x74fb('0x1b')]===_0x74fb('0x1a');var _0x4e3987=_0x43f357[_0x74fb('0x1c')];var _0x33a80b=_0x39944c?0x0:_0x4f0815['offset'];var _0x3db75d=_0x39944c?_0x43f357[_0x74fb('0x1c')]:_0x4f0815[_0x74fb('0x19')]+_0x4f0815[_0x74fb('0x1b')];var _0x5eaf10;if(_0x3db75d>=_0x4e3987){_0x3db75d=_0x4e3987;_0x5eaf10=0xc8;}else{_0x5eaf10=0xce;}_0x50fd34[_0x74fb('0x17')](_0x5eaf10);return _0x50fd34[_0x74fb('0x1d')]('Content-Range',_0x33a80b+'-'+_0x3db75d+'/'+_0x4e3987)[_0x74fb('0x18')](_0x43f357);}return null;};}function patchUpdates(_0x1b8dd8){return function(_0x4a6067){try{jsonpatch[_0x74fb('0x1e')](_0x4a6067,_0x1b8dd8,!![]);}catch(_0x2da02b){return BPromise[_0x74fb('0x1f')](_0x2da02b);}return _0x4a6067[_0x74fb('0x20')]();};}function saveUpdates(_0x8397b2,_0x32c825){return function(_0x5ee96b){if(_0x5ee96b){return _0x5ee96b[_0x74fb('0x21')](_0x8397b2)['then'](function(_0x2c7da4){return _0x2c7da4;});}return null;};}function removeEntity(_0x4a2e2d,_0x4085db){return function(_0x1d2e2c){if(_0x1d2e2c){return _0x1d2e2c[_0x74fb('0x22')]()[_0x74fb('0x23')](function(){var _0x121304=_0x1d2e2c[_0x74fb('0x24')]({'plain':!![]});var _0x5c39d2=_0x74fb('0x25');return db[_0x74fb('0x26')][_0x74fb('0x22')]({'where':{'type':_0x5c39d2,'resourceId':_0x121304['id']}})[_0x74fb('0x23')](function(){return _0x1d2e2c;});})[_0x74fb('0x23')](function(){_0x4a2e2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eb68,_0x509823){return function(_0xaf9474){if(!_0xaf9474){_0x44eb68['sendStatus'](0x194);}return _0xaf9474;};}function handleError(_0x11012f,_0x58c3c4){_0x58c3c4=_0x58c3c4||0x1f4;return function(_0x306a83){logger[_0x74fb('0x27')](_0x306a83['stack']);if(_0x306a83[_0x74fb('0x28')]){delete _0x306a83[_0x74fb('0x28')];}_0x11012f['status'](_0x58c3c4)['send'](_0x306a83);};}exports[_0x74fb('0x29')]=function(_0x10dc6a,_0x313003){var _0x3b3261={},_0x596baa={},_0x18628b={'count':0x0,'rows':[]};var _0x4990ee=_[_0x74fb('0x2a')](db[_0x74fb('0x2b')][_0x74fb('0x2c')],function(_0x898160){return{'name':_0x898160[_0x74fb('0x2d')],'type':_0x898160[_0x74fb('0x2e')][_0x74fb('0x2f')]};});_0x596baa[_0x74fb('0x30')]=_['map'](_0x4990ee,_0x74fb('0x28'));_0x596baa['query']=_[_0x74fb('0x31')](_0x10dc6a['query']);_0x596baa[_0x74fb('0x32')]=_['intersection'](_0x596baa[_0x74fb('0x30')],_0x596baa[_0x74fb('0x33')]);_0x3b3261['attributes']=_[_0x74fb('0x34')](_0x596baa[_0x74fb('0x30')],qs[_0x74fb('0x35')](_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x35')]));_0x3b3261[_0x74fb('0x36')]=_0x3b3261[_0x74fb('0x36')][_0x74fb('0x37')]?_0x3b3261[_0x74fb('0x36')]:_0x596baa[_0x74fb('0x30')];if(!_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x38')](_0x74fb('0x39'))){_0x3b3261[_0x74fb('0x1b')]=qs[_0x74fb('0x1b')](_0x10dc6a['query']['limit']);_0x3b3261[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x19')]);}_0x3b3261['order']=qs[_0x74fb('0x3a')](_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x3a')]);_0x3b3261[_0x74fb('0x3b')]=qs['filters'](_[_0x74fb('0x3c')](_0x10dc6a[_0x74fb('0x33')],_0x596baa['filters']),_0x4990ee);if(_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x3d')]){_0x3b3261[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0x3b3261[_0x74fb('0x3b')],{'$or':_[_0x74fb('0x2a')](_0x4990ee,function(_0x50f1d1){if(_0x50f1d1[_0x74fb('0x2e')]!==_0x74fb('0x3f')){var _0x37345e={};_0x37345e[_0x50f1d1['name']]={'$like':'%'+_0x10dc6a['query'][_0x74fb('0x3d')]+'%'};return _0x37345e;}})});}_0x3b3261=_[_0x74fb('0x3e')]({},_0x3b3261,_0x10dc6a[_0x74fb('0x40')]);var _0x37c9e0={'where':_0x3b3261['where']};return db['Trigger']['count'](_0x37c9e0)[_0x74fb('0x23')](function(_0xe0fbac){_0x18628b['count']=_0xe0fbac;if(_0x10dc6a[_0x74fb('0x33')][_0x74fb('0x41')]){_0x3b3261['include']=[{'all':!![]}];}return db[_0x74fb('0x2b')][_0x74fb('0x42')](_0x3b3261);})['then'](function(_0xbfa0fc){_0x18628b[_0x74fb('0x43')]=_0xbfa0fc;return _0x18628b;})['then'](respondWithFilteredResult(_0x313003,_0x3b3261))[_0x74fb('0x44')](handleError(_0x313003,null));};exports[_0x74fb('0x45')]=function(_0xa1d1a6,_0x8fcf2b){var _0x58bcf7={'raw':![],'where':{'id':_0xa1d1a6[_0x74fb('0x46')]['id']}},_0x53aa94={};_0x53aa94[_0x74fb('0x30')]=_[_0x74fb('0x31')](db[_0x74fb('0x2b')][_0x74fb('0x2c')]);_0x53aa94[_0x74fb('0x33')]=_[_0x74fb('0x31')](_0xa1d1a6[_0x74fb('0x33')]);_0x53aa94[_0x74fb('0x32')]=_['intersection'](_0x53aa94[_0x74fb('0x30')],_0x53aa94[_0x74fb('0x33')]);_0x58bcf7[_0x74fb('0x36')]=_['intersection'](_0x53aa94[_0x74fb('0x30')],qs['fields'](_0xa1d1a6['query']['fields']));_0x58bcf7[_0x74fb('0x36')]=_0x58bcf7[_0x74fb('0x36')][_0x74fb('0x37')]?_0x58bcf7[_0x74fb('0x36')]:_0x53aa94[_0x74fb('0x30')];if(_0xa1d1a6[_0x74fb('0x33')][_0x74fb('0x41')]){_0x58bcf7[_0x74fb('0x47')]=[{'all':!![]}];}_0x58bcf7=_['merge']({},_0x58bcf7,_0xa1d1a6['options']);return db[_0x74fb('0x2b')][_0x74fb('0x48')](_0x58bcf7)[_0x74fb('0x23')](handleEntityNotFound(_0x8fcf2b,null))['then'](respondWithResult(_0x8fcf2b,null))['catch'](handleError(_0x8fcf2b,null));};exports[_0x74fb('0x49')]=function(_0x5d2082,_0x35b54a){return db[_0x74fb('0x2b')][_0x74fb('0x49')](_0x5d2082[_0x74fb('0x4a')],{})[_0x74fb('0x23')](function(_0x40d4fb){var _0x184d44=_0x5d2082[_0x74fb('0x4b')][_0x74fb('0x24')]({'plain':!![]});if(!_0x184d44)throw new Error(_0x74fb('0x4c'));if(_0x184d44[_0x74fb('0x4d')]===_0x74fb('0x4b')){var _0x5830f7=_0x40d4fb[_0x74fb('0x24')]({'plain':!![]});var _0x5bb05a=_0x74fb('0x25');return db[_0x74fb('0x4e')][_0x74fb('0x48')]({'where':{'name':_0x5bb05a,'userProfileId':_0x184d44[_0x74fb('0x4f')]},'raw':!![]})[_0x74fb('0x23')](function(_0x44bdb3){if(_0x44bdb3&&_0x44bdb3[_0x74fb('0x50')]===0x0){return db['UserProfileResource'][_0x74fb('0x49')]({'name':_0x5830f7[_0x74fb('0x28')],'resourceId':_0x5830f7['id'],'type':_0x44bdb3[_0x74fb('0x28')],'sectionId':_0x44bdb3['id']},{})['then'](function(){return _0x40d4fb;});}else{return _0x40d4fb;}})['catch'](function(_0x1d4440){logger[_0x74fb('0x27')](_0x74fb('0x51'),_0x1d4440);throw _0x1d4440;});}return _0x40d4fb;})['then'](respondWithResult(_0x35b54a,0xc9))[_0x74fb('0x44')](handleError(_0x35b54a,null));};exports[_0x74fb('0x21')]=function(_0x4bb79c,_0x2a5fa4){if(_0x4bb79c[_0x74fb('0x4a')]['id']){delete _0x4bb79c[_0x74fb('0x4a')]['id'];}return db['Trigger'][_0x74fb('0x48')]({'where':{'id':_0x4bb79c[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x2a5fa4,null))[_0x74fb('0x23')](saveUpdates(_0x4bb79c[_0x74fb('0x4a')],null))[_0x74fb('0x23')](respondWithResult(_0x2a5fa4,null))[_0x74fb('0x44')](handleError(_0x2a5fa4,null));};exports['destroy']=function(_0x269c1f,_0x132d8a){return db[_0x74fb('0x2b')][_0x74fb('0x48')]({'where':{'id':_0x269c1f[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x132d8a,null))[_0x74fb('0x23')](removeEntity(_0x132d8a,null))[_0x74fb('0x44')](handleError(_0x132d8a,null));};exports[_0x74fb('0x52')]=function(_0xff1de8,_0x9b25f7,_0x463c3c){if(_0xff1de8[_0x74fb('0x4a')]['id']){delete _0xff1de8[_0x74fb('0x4a')]['id'];}return db[_0x74fb('0x2b')][_0x74fb('0x48')]({'where':{'id':_0xff1de8[_0x74fb('0x46')]['id']}})['then'](handleEntityNotFound(_0x9b25f7,null))[_0x74fb('0x23')](function(_0xcdc397){if(_0xcdc397){_0xff1de8[_0x74fb('0x4a')][_0x74fb('0x53')]=_0xcdc397['id'];return db[_0x74fb('0x54')][_0x74fb('0x49')](_0xff1de8[_0x74fb('0x4a')]);}})[_0x74fb('0x23')](respondWithResult(_0x9b25f7,null))[_0x74fb('0x44')](handleError(_0x9b25f7,null));};exports['addAnyCondition']=function(_0x2e902b,_0x3a61d4,_0x4073fe){if(_0x2e902b[_0x74fb('0x4a')]['id']){delete _0x2e902b[_0x74fb('0x4a')]['id'];}return db[_0x74fb('0x2b')][_0x74fb('0x48')]({'where':{'id':_0x2e902b[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x3a61d4,null))[_0x74fb('0x23')](function(_0x1c599c){if(_0x1c599c){_0x2e902b[_0x74fb('0x4a')][_0x74fb('0x55')]=_0x1c599c['id'];return db[_0x74fb('0x54')][_0x74fb('0x49')](_0x2e902b[_0x74fb('0x4a')]);}})['then'](respondWithResult(_0x3a61d4,null))['catch'](handleError(_0x3a61d4,null));};exports[_0x74fb('0x56')]=function(_0x1d759a,_0x30cb4a,_0x2c88da){var _0x7935d7={};var _0x64ffd2={};var _0x4d6a7c;var _0xde6f94;return db[_0x74fb('0x2b')][_0x74fb('0x57')]({'where':{'id':_0x1d759a[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x30cb4a,null))[_0x74fb('0x23')](function(_0xc81f69){if(_0xc81f69){_0x4d6a7c=_0xc81f69;_0x64ffd2[_0x74fb('0x30')]=_[_0x74fb('0x31')](db['Condition'][_0x74fb('0x2c')]);_0x64ffd2[_0x74fb('0x33')]=_[_0x74fb('0x31')](_0x1d759a[_0x74fb('0x33')]);_0x64ffd2[_0x74fb('0x32')]=_[_0x74fb('0x34')](_0x64ffd2['model'],_0x64ffd2[_0x74fb('0x33')]);_0x7935d7[_0x74fb('0x36')]=_[_0x74fb('0x34')](_0x64ffd2[_0x74fb('0x30')],qs[_0x74fb('0x35')](_0x1d759a[_0x74fb('0x33')]['fields']));_0x7935d7[_0x74fb('0x36')]=_0x7935d7[_0x74fb('0x36')]['length']?_0x7935d7[_0x74fb('0x36')]:_0x64ffd2['model'];_0x7935d7[_0x74fb('0x58')]=qs[_0x74fb('0x3a')](_0x1d759a[_0x74fb('0x33')][_0x74fb('0x3a')]);_0x7935d7[_0x74fb('0x3b')]=qs['filters'](_[_0x74fb('0x3c')](_0x1d759a[_0x74fb('0x33')],_0x64ffd2[_0x74fb('0x32')]));if(_0x1d759a['query'][_0x74fb('0x3d')]){_0x7935d7[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0x7935d7['where'],{'$or':_['map'](_0x7935d7[_0x74fb('0x36')],function(_0x4bedd0){var _0x1259f6={};_0x1259f6[_0x4bedd0]={'$like':'%'+_0x1d759a[_0x74fb('0x33')][_0x74fb('0x3d')]+'%'};return _0x1259f6;})});}_0x7935d7=_[_0x74fb('0x3e')]({},_0x7935d7,_0x1d759a[_0x74fb('0x40')]);return _0x4d6a7c[_0x74fb('0x56')](_0x7935d7);}})[_0x74fb('0x23')](function(_0x401a63){if(_0x401a63){_0xde6f94=_0x401a63[_0x74fb('0x37')];if(!_0x1d759a[_0x74fb('0x33')]['hasOwnProperty'](_0x74fb('0x39'))){_0x7935d7[_0x74fb('0x1b')]=qs['limit'](_0x1d759a[_0x74fb('0x33')][_0x74fb('0x1b')]);_0x7935d7[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x1d759a[_0x74fb('0x33')][_0x74fb('0x19')]);}return _0x4d6a7c['getAllConditions'](_0x7935d7);}})[_0x74fb('0x23')](function(_0x1f4444){if(_0x1f4444){return _0x1f4444?{'count':_0xde6f94,'rows':_0x1f4444}:null;}})[_0x74fb('0x23')](respondWithResult(_0x30cb4a,null))[_0x74fb('0x44')](handleError(_0x30cb4a,null));};exports['getAnyConditions']=function(_0x3e934b,_0x21e1bf,_0x28cc36){var _0xc52946={};var _0x16a242={};var _0x365e7e;var _0x5eba21;return db[_0x74fb('0x2b')][_0x74fb('0x57')]({'where':{'id':_0x3e934b['params']['id']}})['then'](handleEntityNotFound(_0x21e1bf,null))[_0x74fb('0x23')](function(_0x3032d2){if(_0x3032d2){_0x365e7e=_0x3032d2;_0x16a242[_0x74fb('0x30')]=_['keys'](db['Condition'][_0x74fb('0x2c')]);_0x16a242['query']=_[_0x74fb('0x31')](_0x3e934b[_0x74fb('0x33')]);_0x16a242[_0x74fb('0x32')]=_[_0x74fb('0x34')](_0x16a242[_0x74fb('0x30')],_0x16a242[_0x74fb('0x33')]);_0xc52946[_0x74fb('0x36')]=_['intersection'](_0x16a242[_0x74fb('0x30')],qs['fields'](_0x3e934b[_0x74fb('0x33')][_0x74fb('0x35')]));_0xc52946['attributes']=_0xc52946[_0x74fb('0x36')][_0x74fb('0x37')]?_0xc52946[_0x74fb('0x36')]:_0x16a242[_0x74fb('0x30')];_0xc52946[_0x74fb('0x58')]=qs[_0x74fb('0x3a')](_0x3e934b[_0x74fb('0x33')][_0x74fb('0x3a')]);_0xc52946[_0x74fb('0x3b')]=qs['filters'](_['pick'](_0x3e934b[_0x74fb('0x33')],_0x16a242[_0x74fb('0x32')]));if(_0x3e934b[_0x74fb('0x33')]['filter']){_0xc52946[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0xc52946[_0x74fb('0x3b')],{'$or':_[_0x74fb('0x2a')](_0xc52946[_0x74fb('0x36')],function(_0x44debd){var _0x3a3a34={};_0x3a3a34[_0x44debd]={'$like':'%'+_0x3e934b['query'][_0x74fb('0x3d')]+'%'};return _0x3a3a34;})});}_0xc52946=_[_0x74fb('0x3e')]({},_0xc52946,_0x3e934b[_0x74fb('0x40')]);return _0x365e7e[_0x74fb('0x59')](_0xc52946);}})[_0x74fb('0x23')](function(_0x1a3655){if(_0x1a3655){_0x5eba21=_0x1a3655['length'];if(!_0x3e934b[_0x74fb('0x33')][_0x74fb('0x38')]('nolimit')){_0xc52946[_0x74fb('0x1b')]=qs[_0x74fb('0x1b')](_0x3e934b[_0x74fb('0x33')][_0x74fb('0x1b')]);_0xc52946[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x3e934b[_0x74fb('0x33')]['offset']);}return _0x365e7e[_0x74fb('0x59')](_0xc52946);}})[_0x74fb('0x23')](function(_0x412cf0){if(_0x412cf0){return _0x412cf0?{'count':_0x5eba21,'rows':_0x412cf0}:null;}})[_0x74fb('0x23')](respondWithResult(_0x21e1bf,null))[_0x74fb('0x44')](handleError(_0x21e1bf,null));};exports[_0x74fb('0x5a')]=function(_0x2bd98e,_0x5e7eb1,_0x5e3e73){if(_0x2bd98e[_0x74fb('0x4a')]['id']){delete _0x2bd98e[_0x74fb('0x4a')]['id'];}return db[_0x74fb('0x2b')]['find']({'where':{'id':_0x2bd98e[_0x74fb('0x46')]['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x5e7eb1,null))['then'](function(_0x15d393){if(_0x15d393){_0x2bd98e[_0x74fb('0x4a')]['TriggerId']=_0x15d393['id'];return db[_0x74fb('0x5b')][_0x74fb('0x49')](_0x2bd98e['body']);}})[_0x74fb('0x23')](respondWithResult(_0x5e7eb1,null))[_0x74fb('0x44')](handleError(_0x5e7eb1,null));};exports[_0x74fb('0x5c')]=function(_0x4e6b77,_0x226c86,_0x3f0371){var _0x3bf22f={};var _0x153185={};var _0x1a8fbd;var _0x6f4a2d;return db[_0x74fb('0x2b')]['findOne']({'where':{'id':_0x4e6b77['params']['id']}})[_0x74fb('0x23')](handleEntityNotFound(_0x226c86,null))[_0x74fb('0x23')](function(_0x51e3a7){if(_0x51e3a7){_0x1a8fbd=_0x51e3a7;_0x153185[_0x74fb('0x30')]=_[_0x74fb('0x31')](db[_0x74fb('0x5b')]['rawAttributes']);_0x153185['query']=_[_0x74fb('0x31')](_0x4e6b77[_0x74fb('0x33')]);_0x153185[_0x74fb('0x32')]=_[_0x74fb('0x34')](_0x153185[_0x74fb('0x30')],_0x153185['query']);_0x3bf22f[_0x74fb('0x36')]=_[_0x74fb('0x34')](_0x153185[_0x74fb('0x30')],qs[_0x74fb('0x35')](_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x35')]));_0x3bf22f[_0x74fb('0x36')]=_0x3bf22f['attributes'][_0x74fb('0x37')]?_0x3bf22f[_0x74fb('0x36')]:_0x153185[_0x74fb('0x30')];_0x3bf22f[_0x74fb('0x58')]=qs['sort'](_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x3a')]);_0x3bf22f[_0x74fb('0x3b')]=qs[_0x74fb('0x32')](_[_0x74fb('0x3c')](_0x4e6b77[_0x74fb('0x33')],_0x153185[_0x74fb('0x32')]));if(_0x4e6b77['query'][_0x74fb('0x3d')]){_0x3bf22f[_0x74fb('0x3b')]=_[_0x74fb('0x3e')](_0x3bf22f[_0x74fb('0x3b')],{'$or':_[_0x74fb('0x2a')](_0x3bf22f[_0x74fb('0x36')],function(_0x4ae0a6){var _0x49d4fa={};_0x49d4fa[_0x4ae0a6]={'$like':'%'+_0x4e6b77[_0x74fb('0x33')]['filter']+'%'};return _0x49d4fa;})});}_0x3bf22f=_[_0x74fb('0x3e')]({},_0x3bf22f,_0x4e6b77[_0x74fb('0x40')]);return _0x1a8fbd[_0x74fb('0x5c')](_0x3bf22f);}})[_0x74fb('0x23')](function(_0x4fd702){if(_0x4fd702){_0x6f4a2d=_0x4fd702[_0x74fb('0x37')];if(!_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x38')]('nolimit')){_0x3bf22f['limit']=qs[_0x74fb('0x1b')](_0x4e6b77[_0x74fb('0x33')]['limit']);_0x3bf22f[_0x74fb('0x19')]=qs[_0x74fb('0x19')](_0x4e6b77[_0x74fb('0x33')][_0x74fb('0x19')]);}return _0x1a8fbd['getActions'](_0x3bf22f);}})[_0x74fb('0x23')](function(_0x593b8f){if(_0x593b8f){return _0x593b8f?{'count':_0x6f4a2d,'rows':_0x593b8f}:null;}})['then'](respondWithResult(_0x226c86,null))['catch'](handleError(_0x226c86,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6edf191..0e2fec9 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 _0x2cd3=['tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./trigger.attributes','exports','define','Trigger'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2cd3,0xf1));var _0x32cd=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x2cd3[_0x4c260a];return _0x17bbdd;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var logger=require(_0x32cd('0x1'))(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var rp=require(_0x32cd('0x5'));var fs=require('fs');var path=require(_0x32cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32cd('0x7'));module[_0x32cd('0x8')]=function(_0x1af8c8,_0x1024e0){return _0x1af8c8[_0x32cd('0x9')](_0x32cd('0xa'),attributes,{'tableName':_0x32cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b04=['./trigger.attributes','exports','define','tools_triggers','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x136e5c,_0x409583){var _0x22e069=function(_0x4fae98){while(--_0x4fae98){_0x136e5c['push'](_0x136e5c['shift']());}};_0x22e069(++_0x409583);}(_0x8b04,0x130));var _0x48b0=function(_0x559da0,_0x371559){_0x559da0=_0x559da0-0x0;var _0x284239=_0x8b04[_0x559da0];return _0x284239;};'use strict';var _=require(_0x48b0('0x0'));var util=require(_0x48b0('0x1'));var logger=require('../../config/logger')(_0x48b0('0x2'));var moment=require('moment');var BPromise=require(_0x48b0('0x3'));var rp=require(_0x48b0('0x4'));var fs=require('fs');var path=require(_0x48b0('0x5'));var rimraf=require(_0x48b0('0x6'));var config=require(_0x48b0('0x7'));var attributes=require(_0x48b0('0x8'));module[_0x48b0('0x9')]=function(_0x43e21c,_0x357849){return _0x43e21c[_0x48b0('0xa')]('Trigger',attributes,{'tableName':_0x48b0('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 63c03d7..c34c814 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 _0x2c0c=['../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1b7171,_0x533d9a){var _0x3c3db2=function(_0x4d7038){while(--_0x4d7038){_0x1b7171['push'](_0x1b7171['shift']());}};_0x3c3db2(++_0x533d9a);}(_0x2c0c,0x1cb));var _0xc2c0=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x2c0c[_0x4c2623];return _0x2be431;};'use strict';var _=require('lodash');var util=require(_0xc2c0('0x0'));var moment=require(_0xc2c0('0x1'));var BPromise=require(_0xc2c0('0x2'));var rs=require(_0xc2c0('0x3'));var fs=require('fs');var Redis=require(_0xc2c0('0x4'));var db=require(_0xc2c0('0x5'))['db'];var utils=require(_0xc2c0('0x6'));var logger=require(_0xc2c0('0x7'))(_0xc2c0('0x8'));var config=require(_0xc2c0('0x9'));var jayson=require(_0xc2c0('0xa'));var client=jayson[_0xc2c0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e92d4,_0x363e2b,_0x5d160f){return new BPromise(function(_0x2be73c,_0x117817){return client['request'](_0x4e92d4,_0x5d160f)['then'](function(_0x30ca42){logger[_0xc2c0('0xc')]('Trigger,\x20%s,\x20%s',_0x363e2b,_0xc2c0('0xd'));logger[_0xc2c0('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x363e2b,_0xc2c0('0xd'),JSON[_0xc2c0('0xf')](_0x30ca42));if(_0x30ca42['error']){if(_0x30ca42[_0xc2c0('0x10')][_0xc2c0('0x11')]===0x1f4){logger[_0xc2c0('0x10')](_0xc2c0('0x12'),_0x363e2b,_0x30ca42[_0xc2c0('0x10')][_0xc2c0('0x13')]);return _0x117817(_0x30ca42[_0xc2c0('0x10')]['message']);}logger['error'](_0xc2c0('0x12'),_0x363e2b,_0x30ca42[_0xc2c0('0x10')]['message']);return _0x2be73c(_0x30ca42['error'][_0xc2c0('0x13')]);}else{logger[_0xc2c0('0xc')](_0xc2c0('0x12'),_0x363e2b,_0xc2c0('0xd'));_0x2be73c(_0x30ca42[_0xc2c0('0x14')]['message']);}})[_0xc2c0('0x15')](function(_0x3ae763){logger[_0xc2c0('0x10')](_0xc2c0('0x12'),_0x363e2b,_0x3ae763);_0x117817(_0x3ae763);});});}exports['GetTrigger']=function(_0x21d213){var _0x26a7a4=this;return new Promise(function(_0x3d026c,_0x5bfea1){return db[_0xc2c0('0x16')][_0xc2c0('0x17')]({'raw':_0x21d213[_0xc2c0('0x18')]?_0x21d213[_0xc2c0('0x18')][_0xc2c0('0x19')]===undefined?!![]:![]:!![],'where':_0x21d213['options']?_0x21d213[_0xc2c0('0x18')][_0xc2c0('0x1a')]||null:null,'attributes':_0x21d213[_0xc2c0('0x18')]?_0x21d213[_0xc2c0('0x18')][_0xc2c0('0x1b')]||null:null,'limit':_0x21d213[_0xc2c0('0x18')]?_0x21d213['options'][_0xc2c0('0x1c')]||null:null,'include':_0x21d213[_0xc2c0('0x18')]?_0x21d213[_0xc2c0('0x18')][_0xc2c0('0x1d')]?_[_0xc2c0('0x1e')](_0x21d213[_0xc2c0('0x18')][_0xc2c0('0x1d')],function(_0x18c2f8){return{'model':db[_0x18c2f8[_0xc2c0('0x1f')]],'as':_0x18c2f8['as'],'attributes':_0x18c2f8[_0xc2c0('0x1b')],'include':_0x18c2f8[_0xc2c0('0x1d')]?_[_0xc2c0('0x1e')](_0x18c2f8[_0xc2c0('0x1d')],function(_0x1b4646){return{'model':db[_0x1b4646[_0xc2c0('0x1f')]],'as':_0x1b4646['as'],'attributes':_0x1b4646[_0xc2c0('0x1b')],'include':_0x1b4646[_0xc2c0('0x1d')]?_[_0xc2c0('0x1e')](_0x1b4646[_0xc2c0('0x1d')],function(_0x4800be){return{'model':db[_0x4800be['model']],'as':_0x4800be['as'],'attributes':_0x4800be[_0xc2c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2c0('0x20')](function(_0x275d1e){logger[_0xc2c0('0xc')](_0xc2c0('0x21'),_0x21d213);logger['debug'](_0xc2c0('0x21'),_0x21d213,JSON[_0xc2c0('0xf')](_0x275d1e));_0x3d026c(_0x275d1e);})['catch'](function(_0x4e8201){logger[_0xc2c0('0x10')](_0xc2c0('0x21'),_0x4e8201[_0xc2c0('0x13')],_0x21d213);_0x5bfea1(_0x26a7a4[_0xc2c0('0x10')](0x1f4,_0x4e8201['message']));});});};exports[_0xc2c0('0x22')]=function(_0x178561){var _0xde9a3e=this;return new Promise(function(_0x255821,_0x34e4f2){return db[_0xc2c0('0x16')][_0xc2c0('0x23')]({'raw':_0x178561['options']?_0x178561[_0xc2c0('0x18')][_0xc2c0('0x19')]===undefined?!![]:![]:!![],'where':_0x178561['options']?_0x178561[_0xc2c0('0x18')][_0xc2c0('0x1a')]||null:null,'attributes':_0x178561['options']?_0x178561['options'][_0xc2c0('0x1b')]||null:null,'include':_0x178561['options']?_0x178561['options'][_0xc2c0('0x1d')]?_['map'](_0x178561[_0xc2c0('0x18')][_0xc2c0('0x1d')],function(_0x511fd2){return{'model':db[_0x511fd2['model']],'as':_0x511fd2['as'],'attributes':_0x511fd2[_0xc2c0('0x1b')],'include':_0x511fd2[_0xc2c0('0x1d')]?_[_0xc2c0('0x1e')](_0x511fd2['include'],function(_0x3cd9ae){return{'model':db[_0x3cd9ae[_0xc2c0('0x1f')]],'as':_0x3cd9ae['as'],'attributes':_0x3cd9ae[_0xc2c0('0x1b')],'include':_0x3cd9ae[_0xc2c0('0x1d')]?_[_0xc2c0('0x1e')](_0x3cd9ae['include'],function(_0x6cddb0){return{'model':db[_0x6cddb0[_0xc2c0('0x1f')]],'as':_0x6cddb0['as'],'attributes':_0x6cddb0['attributes']};}):[]};}):[]};}):[]:[]})[_0xc2c0('0x20')](function(_0x32f844){logger[_0xc2c0('0xc')](_0xc2c0('0x22'),_0x178561);logger[_0xc2c0('0xe')](_0xc2c0('0x22'),_0x178561,JSON[_0xc2c0('0xf')](_0x32f844));_0x255821(_0x32f844);})[_0xc2c0('0x15')](function(_0x132ed6){logger[_0xc2c0('0x10')](_0xc2c0('0x22'),_0x132ed6['message'],_0x178561);_0x34e4f2(_0xde9a3e[_0xc2c0('0x10')](0x1f4,_0x132ed6[_0xc2c0('0x13')]));});});}; \ No newline at end of file +var _0xf7eb=['http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x307c47,_0x3922a4){var _0xe799dd=function(_0x53f6c4){while(--_0x53f6c4){_0x307c47['push'](_0x307c47['shift']());}};_0xe799dd(++_0x3922a4);}(_0xf7eb,0x1b1));var _0xbf7e=function(_0x5d995b,_0x232fb9){_0x5d995b=_0x5d995b-0x0;var _0x58e1f7=_0xf7eb[_0x5d995b];return _0x58e1f7;};'use strict';var _=require(_0xbf7e('0x0'));var util=require('util');var moment=require(_0xbf7e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf7e('0x2'))['db'];var utils=require(_0xbf7e('0x3'));var logger=require(_0xbf7e('0x4'))(_0xbf7e('0x5'));var config=require(_0xbf7e('0x6'));var jayson=require(_0xbf7e('0x7'));var client=jayson[_0xbf7e('0x8')][_0xbf7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f19c,_0x23444a,_0x23ed4c){return new BPromise(function(_0x130c58,_0x386c1c){return client[_0xbf7e('0xa')](_0x45f19c,_0x23ed4c)[_0xbf7e('0xb')](function(_0x530a68){logger[_0xbf7e('0xc')](_0xbf7e('0xd'),_0x23444a,_0xbf7e('0xe'));logger[_0xbf7e('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x23444a,_0xbf7e('0xe'),JSON[_0xbf7e('0x10')](_0x530a68));if(_0x530a68[_0xbf7e('0x11')]){if(_0x530a68[_0xbf7e('0x11')][_0xbf7e('0x12')]===0x1f4){logger['error'](_0xbf7e('0xd'),_0x23444a,_0x530a68['error']['message']);return _0x386c1c(_0x530a68[_0xbf7e('0x11')][_0xbf7e('0x13')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x23444a,_0x530a68['error'][_0xbf7e('0x13')]);return _0x130c58(_0x530a68[_0xbf7e('0x11')][_0xbf7e('0x13')]);}else{logger[_0xbf7e('0xc')](_0xbf7e('0xd'),_0x23444a,_0xbf7e('0xe'));_0x130c58(_0x530a68[_0xbf7e('0x14')][_0xbf7e('0x13')]);}})[_0xbf7e('0x15')](function(_0x363b01){logger[_0xbf7e('0x11')](_0xbf7e('0xd'),_0x23444a,_0x363b01);_0x386c1c(_0x363b01);});});}exports[_0xbf7e('0x16')]=function(_0xdfd49b){var _0x5dfae9=this;return new Promise(function(_0x407f3b,_0x2f3310){return db[_0xbf7e('0x17')]['findAll']({'raw':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x19')]===undefined?!![]:![]:!![],'where':_0xdfd49b['options']?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1a')]||null:null,'attributes':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1b')]||null:null,'limit':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1c')]||null:null,'include':_0xdfd49b[_0xbf7e('0x18')]?_0xdfd49b['options'][_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0xdfd49b[_0xbf7e('0x18')][_0xbf7e('0x1d')],function(_0x52c75a){return{'model':db[_0x52c75a['model']],'as':_0x52c75a['as'],'attributes':_0x52c75a['attributes'],'include':_0x52c75a[_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0x52c75a[_0xbf7e('0x1d')],function(_0x1b7da1){return{'model':db[_0x1b7da1[_0xbf7e('0x1f')]],'as':_0x1b7da1['as'],'attributes':_0x1b7da1['attributes'],'include':_0x1b7da1[_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0x1b7da1[_0xbf7e('0x1d')],function(_0x1c9d2f){return{'model':db[_0x1c9d2f[_0xbf7e('0x1f')]],'as':_0x1c9d2f['as'],'attributes':_0x1c9d2f[_0xbf7e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbf7e('0xb')](function(_0xb692f6){logger[_0xbf7e('0xc')](_0xbf7e('0x16'),_0xdfd49b);logger[_0xbf7e('0xf')]('GetTrigger',_0xdfd49b,JSON[_0xbf7e('0x10')](_0xb692f6));_0x407f3b(_0xb692f6);})[_0xbf7e('0x15')](function(_0x5c235f){logger[_0xbf7e('0x11')](_0xbf7e('0x16'),_0x5c235f[_0xbf7e('0x13')],_0xdfd49b);_0x2f3310(_0x5dfae9[_0xbf7e('0x11')](0x1f4,_0x5c235f[_0xbf7e('0x13')]));});});};exports[_0xbf7e('0x20')]=function(_0x4a986e){var _0x2b6520=this;return new Promise(function(_0x11755d,_0x5d3995){return db[_0xbf7e('0x17')][_0xbf7e('0x21')]({'raw':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x19')]===undefined?!![]:![]:!![],'where':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x1a')]||null:null,'attributes':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x1b')]||null:null,'include':_0x4a986e[_0xbf7e('0x18')]?_0x4a986e[_0xbf7e('0x18')][_0xbf7e('0x1d')]?_[_0xbf7e('0x1e')](_0x4a986e['options']['include'],function(_0x285686){return{'model':db[_0x285686[_0xbf7e('0x1f')]],'as':_0x285686['as'],'attributes':_0x285686[_0xbf7e('0x1b')],'include':_0x285686['include']?_[_0xbf7e('0x1e')](_0x285686[_0xbf7e('0x1d')],function(_0x38df1b){return{'model':db[_0x38df1b[_0xbf7e('0x1f')]],'as':_0x38df1b['as'],'attributes':_0x38df1b[_0xbf7e('0x1b')],'include':_0x38df1b[_0xbf7e('0x1d')]?_['map'](_0x38df1b[_0xbf7e('0x1d')],function(_0x387d5b){return{'model':db[_0x387d5b[_0xbf7e('0x1f')]],'as':_0x387d5b['as'],'attributes':_0x387d5b[_0xbf7e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbf7e('0xb')](function(_0x573618){logger[_0xbf7e('0xc')](_0xbf7e('0x20'),_0x4a986e);logger[_0xbf7e('0xf')](_0xbf7e('0x20'),_0x4a986e,JSON['stringify'](_0x573618));_0x11755d(_0x573618);})['catch'](function(_0x1d0fcb){logger[_0xbf7e('0x11')](_0xbf7e('0x20'),_0x1d0fcb['message'],_0x4a986e);_0x5d3995(_0x2b6520[_0xbf7e('0x11')](0x1f4,_0x1d0fcb['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 05a01e3..5235de4 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 _0x7bfd=['destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7bfd,0x188));var _0xd7bf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7bfd[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xd7bf('0x0'));var util=require('util');var path=require(_0xd7bf('0x1'));var timeout=require(_0xd7bf('0x2'));var express=require(_0xd7bf('0x3'));var router=express['Router']();var fs_extra=require(_0xd7bf('0x4'));var auth=require(_0xd7bf('0x5'));var interaction=require(_0xd7bf('0x6'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xd7bf('0x7')]('/',auth[_0xd7bf('0x8')](),controller[_0xd7bf('0x9')]);router[_0xd7bf('0x7')](_0xd7bf('0xa'),auth['isAuthenticated'](),controller[_0xd7bf('0xb')]);router[_0xd7bf('0xc')]('/:id/clone',auth[_0xd7bf('0x8')](),controller['clone']);router[_0xd7bf('0xc')]('/',auth[_0xd7bf('0x8')](),controller['create']);router[_0xd7bf('0xd')](_0xd7bf('0xa'),auth[_0xd7bf('0x8')](),controller[_0xd7bf('0xe')]);router[_0xd7bf('0xf')](_0xd7bf('0xa'),auth['isAuthenticated'](),controller[_0xd7bf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4a86=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','create','put','update','destroy','exports','util','connect-timeout'];(function(_0xef442b,_0x2ce34a){var _0x37429e=function(_0x56ee46){while(--_0x56ee46){_0xef442b['push'](_0xef442b['shift']());}};_0x37429e(++_0x2ce34a);}(_0x4a86,0x167));var _0x64a8=function(_0x3b658d,_0x33fd28){_0x3b658d=_0x3b658d-0x0;var _0x6dd480=_0x4a86[_0x3b658d];return _0x6dd480;};'use strict';var multer=require('multer');var util=require(_0x64a8('0x0'));var path=require('path');var timeout=require(_0x64a8('0x1'));var express=require(_0x64a8('0x2'));var router=express[_0x64a8('0x3')]();var fs_extra=require(_0x64a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x64a8('0x5'));var config=require(_0x64a8('0x6'));var controller=require(_0x64a8('0x7'));router[_0x64a8('0x8')]('/',auth[_0x64a8('0x9')](),controller['index']);router[_0x64a8('0x8')](_0x64a8('0xa'),auth['isAuthenticated'](),controller[_0x64a8('0xb')]);router[_0x64a8('0xc')](_0x64a8('0xd'),auth[_0x64a8('0x9')](),controller['clone']);router[_0x64a8('0xc')]('/',auth[_0x64a8('0x9')](),controller[_0x64a8('0xe')]);router[_0x64a8('0xf')]('/:id',auth[_0x64a8('0x9')](),controller[_0x64a8('0x10')]);router['delete'](_0x64a8('0xa'),auth['isAuthenticated'](),controller[_0x64a8('0x11')]);module[_0x64a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f568540..17145c9 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 _0xc1a5=['pai','fingerprint','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','ENUM','yes','nonat','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas'];(function(_0x4b4c3b,_0x121398){var _0x125d77=function(_0x3cdff5){while(--_0x3cdff5){_0x4b4c3b['push'](_0x4b4c3b['shift']());}};_0x125d77(++_0x121398);}(_0xc1a5,0x70));var _0x5c1a=function(_0x3da3f0,_0x20d1cf){_0x3da3f0=_0x3da3f0-0x0;var _0x434438=_0xc1a5[_0x3da3f0];return _0x434438;};'use strict';var Sequelize=require(_0x5c1a('0x0'));module[_0x5c1a('0x1')]={'name':{'type':Sequelize[_0x5c1a('0x2')],'allowNull':![],'unique':_0x5c1a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5c1a('0x4'),'user','peer'),'allowNull':![],'defaultValue':_0x5c1a('0x4')},'context':{'type':Sequelize[_0x5c1a('0x2')],'allowNull':![],'defaultValue':_0x5c1a('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x5c1a('0x6'),_0x5c1a('0x7'),_0x5c1a('0x8'),'ALLOWED',_0x5c1a('0x9'),_0x5c1a('0xa'),_0x5c1a('0xb'),_0x5c1a('0xc'))},'deny':{'type':Sequelize[_0x5c1a('0x2')]},'permit':{'type':Sequelize[_0x5c1a('0x2')]},'secret':{'type':Sequelize[_0x5c1a('0x2')]},'md5secret':{'type':Sequelize[_0x5c1a('0x2')]},'remotesecret':{'type':Sequelize[_0x5c1a('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x4154a1){this['setDataValue'](_0x5c1a('0xd'),_0x4154a1?_0x4154a1[_0x5c1a('0xe')](','):null);},'get':function(){return this[_0x5c1a('0xf')]('transport')?this[_0x5c1a('0xf')](_0x5c1a('0xd'))[_0x5c1a('0x10')](','):null;},'comment':_0x5c1a('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5c1a('0x12'),_0x5c1a('0x13'),_0x5c1a('0x14'),_0x5c1a('0x15'),_0x5c1a('0x16')),'defaultValue':_0x5c1a('0x12')},'directmedia':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no',_0x5c1a('0x19'),'update',_0x5c1a('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5c1a('0x17')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5c1a('0x2')]},'directmediadeny':{'type':Sequelize[_0x5c1a('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x5c1a('0x1b'),'set':function(_0x570a4c){this[_0x5c1a('0x1c')]('nat',_0x570a4c?_0x570a4c['join'](','):null);},'get':function(){return this['getDataValue'](_0x5c1a('0x1d'))?this['getDataValue'](_0x5c1a('0x1d'))['split'](','):null;},'comment':_0x5c1a('0x1e')},'callgroup':{'type':Sequelize[_0x5c1a('0x2')]},'namedcallgroup':{'type':Sequelize[_0x5c1a('0x2')]},'pickupgroup':{'type':Sequelize[_0x5c1a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5c1a('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x5c1a('0x1f')},'allow':{'type':Sequelize[_0x5c1a('0x2')],'allowNull':![],'defaultValue':_0x5c1a('0x20'),'set':function(_0x3bface){this[_0x5c1a('0x1c')](_0x5c1a('0x21'),_0x3bface?_0x3bface[_0x5c1a('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x5c1a('0xf')](_0x5c1a('0x21'))?this[_0x5c1a('0xf')](_0x5c1a('0x21'))[_0x5c1a('0x10')](';'):null;},'comment':_0x5c1a('0x22')},'autoframing':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x5c1a('0x23'),'set':function(_0x5eca33){this[_0x5c1a('0x1c')]('insecure',_0x5eca33?_0x5eca33[_0x5c1a('0xe')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x5c1a('0xf')]('insecure')[_0x5c1a('0x10')](','):null;},'comment':_0x5c1a('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'setvar':{'type':Sequelize[_0x5c1a('0x2')]},'callerid':{'type':Sequelize[_0x5c1a('0x2')],'defaultValue':_0x5c1a('0x26')},'amaflags':{'type':Sequelize[_0x5c1a('0x2')]},'callcounter':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no'),'defaultValue':_0x5c1a('0x18')},'busylevel':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x5c1a('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no',_0x5c1a('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x5c1a('0x2')]},'session_timers':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x28'),_0x5c1a('0x29'),_0x5c1a('0x2a'))},'session_expires':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x5c1a('0x17')]('uac',_0x5c1a('0x2b')),'defaultValue':_0x5c1a('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x5c1a('0x2')]},'regexten':{'type':Sequelize[_0x5c1a('0x2')]},'fromdomain':{'type':Sequelize[_0x5c1a('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5c1a('0x25')](0x5)},'qualify':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x5c1a('0x2')]},'defaultuser':{'type':Sequelize[_0x5c1a('0x2')]},'rtptimeout':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no',_0x5c1a('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5c1a('0x2')]},'callbackextension':{'type':Sequelize[_0x5c1a('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x5c1a('0x2')]},'contactdeny':{'type':Sequelize[_0x5c1a('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x5c1a('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x5c1a('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'force_avp':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no',_0x5c1a('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x5c1a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x5c1a('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5c1a('0x2')]},'dtlssetup':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x2e'),_0x5c1a('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5c1a('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x5c1a('0x2')]},'call_limit':{'type':Sequelize[_0x5c1a('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x5c1a('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x5c1a('0x17')](_0x5c1a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x5c1a('0x2')]},'mohinterpret':{'type':Sequelize[_0x5c1a('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c1a('0x2')]},'host':{'type':Sequelize[_0x5c1a('0x2')],'defaultValue':_0x5c1a('0x30')},'canreinvite':{'type':Sequelize[_0x5c1a('0x17')]('yes','no','nonat',_0x5c1a('0x31'),_0x5c1a('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5c1a('0x2')]},'otherFields':{'type':Sequelize[_0x5c1a('0x2')]},'active':{'type':Sequelize[_0x5c1a('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x401c=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite'];(function(_0x55f647,_0x463a1c){var _0x1ad8c6=function(_0x5dfcaf){while(--_0x5dfcaf){_0x55f647['push'](_0x55f647['shift']());}};_0x1ad8c6(++_0x463a1c);}(_0x401c,0xdd));var _0xc401=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0x401c[_0x29d6e6];return _0xc75ff0;};'use strict';var Sequelize=require(_0xc401('0x0'));module[_0xc401('0x1')]={'name':{'type':Sequelize[_0xc401('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x4'),_0xc401('0x5'),'peer'),'allowNull':![],'defaultValue':_0xc401('0x4')},'context':{'type':Sequelize[_0xc401('0x2')],'allowNull':![],'defaultValue':_0xc401('0x6')},'callingpres':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x7'),_0xc401('0x8'),_0xc401('0x9'),'ALLOWED',_0xc401('0xa'),_0xc401('0xb'),_0xc401('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc401('0x2')]},'remotesecret':{'type':Sequelize[_0xc401('0x2')]},'transport':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0xd'),'set':function(_0x126b46){this[_0xc401('0xe')](_0xc401('0xf'),_0x126b46?_0x126b46[_0xc401('0x10')](','):null);},'get':function(){return this[_0xc401('0x11')](_0xc401('0xf'))?this[_0xc401('0x11')](_0xc401('0xf'))[_0xc401('0x12')](','):null;},'comment':_0xc401('0x13')},'dtmfmode':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x14'),_0xc401('0x15'),_0xc401('0x16'),_0xc401('0x17'),_0xc401('0x18')),'defaultValue':_0xc401('0x14')},'directmedia':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no','nonat',_0xc401('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc401('0x2')]},'directmediadeny':{'type':Sequelize[_0xc401('0x2')]},'nat':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0x1b'),'set':function(_0x5614db){this[_0xc401('0xe')](_0xc401('0x1c'),_0x5614db?_0x5614db[_0xc401('0x10')](','):null);},'get':function(){return this[_0xc401('0x11')](_0xc401('0x1c'))?this[_0xc401('0x11')]('nat')[_0xc401('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc401('0x2')]},'namedcallgroup':{'type':Sequelize[_0xc401('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc401('0x2')]},'language':{'type':Sequelize[_0xc401('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc401('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0x1d')},'allow':{'type':Sequelize[_0xc401('0x2')],'allowNull':![],'defaultValue':_0xc401('0x1e'),'set':function(_0x1f8113){this[_0xc401('0xe')](_0xc401('0x1f'),_0x1f8113?_0x1f8113[_0xc401('0x10')](';'):_0xc401('0x1e'));},'get':function(){return this[_0xc401('0x11')](_0xc401('0x1f'))?this[_0xc401('0x11')](_0xc401('0x1f'))['split'](';'):null;},'comment':_0xc401('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'insecure':{'type':Sequelize[_0xc401('0x2')],'defaultValue':_0xc401('0x21'),'set':function(_0x20ab62){this[_0xc401('0xe')]('insecure',_0x20ab62?_0x20ab62[_0xc401('0x10')](','):null);},'get':function(){return this[_0xc401('0x11')]('insecure')?this[_0xc401('0x11')](_0xc401('0x22'))[_0xc401('0x12')](','):null;},'comment':_0xc401('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x24'))},'promiscredir':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xc401('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xc401('0x25')](0xb)},'setvar':{'type':Sequelize[_0xc401('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xc401('0x26')},'amaflags':{'type':Sequelize[_0xc401('0x2')]},'callcounter':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no'),'defaultValue':_0xc401('0x19')},'busylevel':{'type':Sequelize[_0xc401('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xc401('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xc401('0x2')]},'template':{'type':Sequelize[_0xc401('0x2')]},'videosupport':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'mailbox':{'type':Sequelize[_0xc401('0x2')]},'session_timers':{'type':Sequelize[_0xc401('0x3')]('accept',_0xc401('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xc401('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xc401('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xc401('0x29'),_0xc401('0x2a')),'defaultValue':_0xc401('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xc401('0x2')]},'regexten':{'type':Sequelize[_0xc401('0x2')]},'fromdomain':{'type':Sequelize[_0xc401('0x2')]},'fromuser':{'type':Sequelize[_0xc401('0x2')]},'port':{'type':Sequelize[_0xc401('0x25')](0x5)},'qualify':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc401('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc401('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc401('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xc401('0x2')]},'timert1':{'type':Sequelize[_0xc401('0x25')](0xb)},'timerb':{'type':Sequelize[_0xc401('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc401('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xc401('0x2')]},'contactdeny':{'type':Sequelize[_0xc401('0x2')]},'contactacl':{'type':Sequelize[_0xc401('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xc401('0x2')]},'use_q850_reason':{'type':Sequelize[_0xc401('0x2')]},'maxforwards':{'type':Sequelize[_0xc401('0x25')](0xb)},'encryption':{'type':Sequelize[_0xc401('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'force_avp':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no')},'icesupport':{'type':Sequelize[_0xc401('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no',_0xc401('0x2c'),_0xc401('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xc401('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc401('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc401('0x2')]},'dtlscapath':{'type':Sequelize[_0xc401('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xc401('0x2e'),_0xc401('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc401('0x2')]},'usereqphone':{'type':Sequelize[_0xc401('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc401('0x2')]},'call_limit':{'type':Sequelize[_0xc401('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc401('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xc401('0x2')]},'mohinterpret':{'type':Sequelize[_0xc401('0x2')]},'mohsuggest':{'type':Sequelize[_0xc401('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc401('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xc401('0x3')](_0xc401('0x19'),'no',_0xc401('0x30'),_0xc401('0x1a'),_0xc401('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xc401('0x2')]},'active':{'type':Sequelize[_0xc401('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc401('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 13ddfb3..c2c4ffc 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 _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x31aa0d,_0x217049){var _0x53e7e0=function(_0x244397){while(--_0x244397){_0x31aa0d['push'](_0x31aa0d['shift']());}};_0x53e7e0(++_0x217049);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x29aec6,_0x2139c8){_0x29aec6=_0x29aec6-0x0;var _0x3d265a=_0x8d0e[_0x29aec6];return _0x3d265a;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x445daf,_0x5603d9){var _0x4f3106=function(_0x3a505f){while(--_0x3a505f){_0x445daf['push'](_0x445daf['shift']());}};_0x4f3106(++_0x5603d9);}(_0x98a8,0x12c));var _0x898a=function(_0x32ba70,_0x2a4598){_0x32ba70=_0x32ba70-0x0;var _0x3cdd89=_0x98a8[_0x32ba70];return _0x3cdd89;};'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'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ccb1702..b970dd1 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 _0xfb37=['path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','util','api','bluebird','request-promise'];(function(_0x4ea77f,_0x5c57d6){var _0x42842f=function(_0x598828){while(--_0x598828){_0x4ea77f['push'](_0x4ea77f['shift']());}};_0x42842f(++_0x5c57d6);}(_0xfb37,0xb7));var _0x7fb3=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0xfb37[_0x466af7];return _0x348c96;};'use strict';var _=require('lodash');var util=require(_0x7fb3('0x0'));var logger=require('../../config/logger')(_0x7fb3('0x1'));var moment=require('moment');var BPromise=require(_0x7fb3('0x2'));var rp=require(_0x7fb3('0x3'));var fs=require('fs');var path=require(_0x7fb3('0x4'));var rimraf=require(_0x7fb3('0x5'));var config=require(_0x7fb3('0x6'));var attributes=require(_0x7fb3('0x7'));module[_0x7fb3('0x8')]=function(_0x1fa894,_0x5ed7b8){return _0x1fa894['define'](_0x7fb3('0x9'),attributes,{'tableName':_0x7fb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc37d=['bluebird','request-promise','rimraf','./trunk.attributes','exports','Trunk','tools_trunks','util','../../config/logger','api','moment'];(function(_0x78fd79,_0x58888a){var _0x9aae9a=function(_0x291920){while(--_0x291920){_0x78fd79['push'](_0x78fd79['shift']());}};_0x9aae9a(++_0x58888a);}(_0xc37d,0x1a9));var _0xdc37=function(_0x2c6104,_0x40a18a){_0x2c6104=_0x2c6104-0x0;var _0x37f38f=_0xc37d[_0x2c6104];return _0x37f38f;};'use strict';var _=require('lodash');var util=require(_0xdc37('0x0'));var logger=require(_0xdc37('0x1'))(_0xdc37('0x2'));var moment=require(_0xdc37('0x3'));var BPromise=require(_0xdc37('0x4'));var rp=require(_0xdc37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc37('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc37('0x7'));module[_0xdc37('0x8')]=function(_0x4a4de5,_0x417bee){return _0x4a4de5['define'](_0xdc37('0x9'),attributes,{'tableName':_0xdc37('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 e27b9ee..f1e5dd5 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 _0xcb3b=['jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrunk','Trunk','findAll','options','include','map','model','attributes','ShowTrunk','find','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x417bf4,_0x10ef20){var _0x5a627d=function(_0x16601e){while(--_0x16601e){_0x417bf4['push'](_0x417bf4['shift']());}};_0x5a627d(++_0x10ef20);}(_0xcb3b,0x12f));var _0xbcb3=function(_0x5e2ecf,_0x4c626c){_0x5e2ecf=_0x5e2ecf-0x0;var _0x5d82df=_0xcb3b[_0x5e2ecf];return _0x5d82df;};'use strict';var _=require(_0xbcb3('0x0'));var util=require(_0xbcb3('0x1'));var moment=require('moment');var BPromise=require(_0xbcb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcb3('0x3'))['db'];var utils=require(_0xbcb3('0x4'));var logger=require('../../config/logger')(_0xbcb3('0x5'));var config=require(_0xbcb3('0x6'));var jayson=require(_0xbcb3('0x7'));var client=jayson[_0xbcb3('0x8')][_0xbcb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581c16,_0x4a3f10,_0x10a39c){return new BPromise(function(_0x242379,_0x3b3ad7){return client['request'](_0x581c16,_0x10a39c)[_0xbcb3('0xa')](function(_0x36bed5){logger['info'](_0xbcb3('0xb'),_0x4a3f10,_0xbcb3('0xc'));logger[_0xbcb3('0xd')](_0xbcb3('0xe'),_0x4a3f10,_0xbcb3('0xc'),JSON[_0xbcb3('0xf')](_0x36bed5));if(_0x36bed5[_0xbcb3('0x10')]){if(_0x36bed5[_0xbcb3('0x10')][_0xbcb3('0x11')]===0x1f4){logger[_0xbcb3('0x10')](_0xbcb3('0xb'),_0x4a3f10,_0x36bed5[_0xbcb3('0x10')][_0xbcb3('0x12')]);return _0x3b3ad7(_0x36bed5[_0xbcb3('0x10')][_0xbcb3('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x4a3f10,_0x36bed5[_0xbcb3('0x10')][_0xbcb3('0x12')]);return _0x242379(_0x36bed5[_0xbcb3('0x10')]['message']);}else{logger[_0xbcb3('0x13')](_0xbcb3('0xb'),_0x4a3f10,'request\x20sent');_0x242379(_0x36bed5['result'][_0xbcb3('0x12')]);}})[_0xbcb3('0x14')](function(_0x4c78d5){logger[_0xbcb3('0x10')](_0xbcb3('0xb'),_0x4a3f10,_0x4c78d5);_0x3b3ad7(_0x4c78d5);});});}exports[_0xbcb3('0x15')]=function(_0x176516){var _0x3678e9=this;return new Promise(function(_0x48d72f,_0x350be2){return db[_0xbcb3('0x16')][_0xbcb3('0x17')]({'raw':_0x176516[_0xbcb3('0x18')]?_0x176516[_0xbcb3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x176516[_0xbcb3('0x18')]?_0x176516[_0xbcb3('0x18')]['where']||null:null,'attributes':_0x176516[_0xbcb3('0x18')]?_0x176516[_0xbcb3('0x18')]['attributes']||null:null,'limit':_0x176516[_0xbcb3('0x18')]?_0x176516[_0xbcb3('0x18')]['limit']||null:null,'include':_0x176516[_0xbcb3('0x18')]?_0x176516[_0xbcb3('0x18')][_0xbcb3('0x19')]?_['map'](_0x176516[_0xbcb3('0x18')][_0xbcb3('0x19')],function(_0x1d754b){return{'model':db[_0x1d754b['model']],'as':_0x1d754b['as'],'attributes':_0x1d754b['attributes'],'include':_0x1d754b[_0xbcb3('0x19')]?_[_0xbcb3('0x1a')](_0x1d754b[_0xbcb3('0x19')],function(_0x3aa134){return{'model':db[_0x3aa134[_0xbcb3('0x1b')]],'as':_0x3aa134['as'],'attributes':_0x3aa134[_0xbcb3('0x1c')],'include':_0x3aa134[_0xbcb3('0x19')]?_[_0xbcb3('0x1a')](_0x3aa134[_0xbcb3('0x19')],function(_0x79d408){return{'model':db[_0x79d408[_0xbcb3('0x1b')]],'as':_0x79d408['as'],'attributes':_0x79d408[_0xbcb3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbcb3('0xa')](function(_0x3bdd8e){logger['info'](_0xbcb3('0x15'),_0x176516);logger['debug'](_0xbcb3('0x15'),_0x176516,JSON[_0xbcb3('0xf')](_0x3bdd8e));_0x48d72f(_0x3bdd8e);})[_0xbcb3('0x14')](function(_0x242b5a){logger[_0xbcb3('0x10')](_0xbcb3('0x15'),_0x242b5a['message'],_0x176516);_0x350be2(_0x3678e9[_0xbcb3('0x10')](0x1f4,_0x242b5a['message']));});});};exports[_0xbcb3('0x1d')]=function(_0x2dc159){var _0x2149c1=this;return new Promise(function(_0x196cbe,_0x516ee2){return db['Trunk'][_0xbcb3('0x1e')]({'raw':_0x2dc159[_0xbcb3('0x18')]?_0x2dc159[_0xbcb3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc159['options']?_0x2dc159[_0xbcb3('0x18')]['where']||null:null,'attributes':_0x2dc159[_0xbcb3('0x18')]?_0x2dc159['options'][_0xbcb3('0x1c')]||null:null,'include':_0x2dc159[_0xbcb3('0x18')]?_0x2dc159[_0xbcb3('0x18')]['include']?_['map'](_0x2dc159[_0xbcb3('0x18')][_0xbcb3('0x19')],function(_0x537819){return{'model':db[_0x537819[_0xbcb3('0x1b')]],'as':_0x537819['as'],'attributes':_0x537819[_0xbcb3('0x1c')],'include':_0x537819['include']?_[_0xbcb3('0x1a')](_0x537819['include'],function(_0x3977b6){return{'model':db[_0x3977b6[_0xbcb3('0x1b')]],'as':_0x3977b6['as'],'attributes':_0x3977b6['attributes'],'include':_0x3977b6['include']?_[_0xbcb3('0x1a')](_0x3977b6[_0xbcb3('0x19')],function(_0x4950d7){return{'model':db[_0x4950d7[_0xbcb3('0x1b')]],'as':_0x4950d7['as'],'attributes':_0x4950d7[_0xbcb3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbcb3('0xa')](function(_0x5f1c22){logger[_0xbcb3('0x13')](_0xbcb3('0x1d'),_0x2dc159);logger[_0xbcb3('0xd')](_0xbcb3('0x1d'),_0x2dc159,JSON[_0xbcb3('0xf')](_0x5f1c22));_0x196cbe(_0x5f1c22);})[_0xbcb3('0x14')](function(_0x39fb30){logger[_0xbcb3('0x10')](_0xbcb3('0x1d'),_0x39fb30[_0xbcb3('0x12')],_0x2dc159);_0x516ee2(_0x2149c1[_0xbcb3('0x10')](0x1f4,_0x39fb30['message']));});});}; \ No newline at end of file +var _0xa93d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','model','map','debug','stringify','ShowTrunk','lodash','moment','bluebird','randomstring'];(function(_0x2619a1,_0x1f8f66){var _0x517c07=function(_0x17567f){while(--_0x17567f){_0x2619a1['push'](_0x2619a1['shift']());}};_0x517c07(++_0x1f8f66);}(_0xa93d,0xa6));var _0xda93=function(_0xdead06,_0x3fcddb){_0xdead06=_0xdead06-0x0;var _0x338677=_0xa93d[_0xdead06];return _0x338677;};'use strict';var _=require(_0xda93('0x0'));var util=require('util');var moment=require(_0xda93('0x1'));var BPromise=require(_0xda93('0x2'));var rs=require(_0xda93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda93('0x4'))['db'];var utils=require(_0xda93('0x5'));var logger=require(_0xda93('0x6'))(_0xda93('0x7'));var config=require(_0xda93('0x8'));var jayson=require(_0xda93('0x9'));var client=jayson['client'][_0xda93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5608a1,_0x2da0d9,_0x3c1504){return new BPromise(function(_0x57b194,_0x1e42d6){return client[_0xda93('0xb')](_0x5608a1,_0x3c1504)[_0xda93('0xc')](function(_0x1a2204){logger[_0xda93('0xd')](_0xda93('0xe'),_0x2da0d9,_0xda93('0xf'));logger['debug'](_0xda93('0x10'),_0x2da0d9,'request\x20sent',JSON['stringify'](_0x1a2204));if(_0x1a2204[_0xda93('0x11')]){if(_0x1a2204[_0xda93('0x11')][_0xda93('0x12')]===0x1f4){logger[_0xda93('0x11')](_0xda93('0xe'),_0x2da0d9,_0x1a2204['error']['message']);return _0x1e42d6(_0x1a2204['error']['message']);}logger[_0xda93('0x11')](_0xda93('0xe'),_0x2da0d9,_0x1a2204[_0xda93('0x11')][_0xda93('0x13')]);return _0x57b194(_0x1a2204[_0xda93('0x11')][_0xda93('0x13')]);}else{logger[_0xda93('0xd')](_0xda93('0xe'),_0x2da0d9,_0xda93('0xf'));_0x57b194(_0x1a2204['result']['message']);}})[_0xda93('0x14')](function(_0x37743b){logger[_0xda93('0x11')](_0xda93('0xe'),_0x2da0d9,_0x37743b);_0x1e42d6(_0x37743b);});});}exports[_0xda93('0x15')]=function(_0x43a60f){var _0x411d17=this;return new Promise(function(_0x152463,_0x50c69e){return db[_0xda93('0x16')][_0xda93('0x17')]({'raw':_0x43a60f['options']?_0x43a60f[_0xda93('0x18')][_0xda93('0x19')]===undefined?!![]:![]:!![],'where':_0x43a60f['options']?_0x43a60f[_0xda93('0x18')][_0xda93('0x1a')]||null:null,'attributes':_0x43a60f[_0xda93('0x18')]?_0x43a60f['options'][_0xda93('0x1b')]||null:null,'limit':_0x43a60f[_0xda93('0x18')]?_0x43a60f[_0xda93('0x18')]['limit']||null:null,'include':_0x43a60f[_0xda93('0x18')]?_0x43a60f[_0xda93('0x18')][_0xda93('0x1c')]?_['map'](_0x43a60f[_0xda93('0x18')][_0xda93('0x1c')],function(_0x5dcaf2){return{'model':db[_0x5dcaf2[_0xda93('0x1d')]],'as':_0x5dcaf2['as'],'attributes':_0x5dcaf2[_0xda93('0x1b')],'include':_0x5dcaf2[_0xda93('0x1c')]?_[_0xda93('0x1e')](_0x5dcaf2[_0xda93('0x1c')],function(_0x3742f1){return{'model':db[_0x3742f1['model']],'as':_0x3742f1['as'],'attributes':_0x3742f1[_0xda93('0x1b')],'include':_0x3742f1[_0xda93('0x1c')]?_['map'](_0x3742f1[_0xda93('0x1c')],function(_0x13e2f5){return{'model':db[_0x13e2f5['model']],'as':_0x13e2f5['as'],'attributes':_0x13e2f5[_0xda93('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda93('0xc')](function(_0x8565a0){logger[_0xda93('0xd')](_0xda93('0x15'),_0x43a60f);logger[_0xda93('0x1f')](_0xda93('0x15'),_0x43a60f,JSON[_0xda93('0x20')](_0x8565a0));_0x152463(_0x8565a0);})[_0xda93('0x14')](function(_0x389ddc){logger[_0xda93('0x11')](_0xda93('0x15'),_0x389ddc['message'],_0x43a60f);_0x50c69e(_0x411d17[_0xda93('0x11')](0x1f4,_0x389ddc[_0xda93('0x13')]));});});};exports[_0xda93('0x21')]=function(_0x2063b7){var _0x57a924=this;return new Promise(function(_0x3d69cd,_0x3758a5){return db[_0xda93('0x16')]['find']({'raw':_0x2063b7[_0xda93('0x18')]?_0x2063b7[_0xda93('0x18')][_0xda93('0x19')]===undefined?!![]:![]:!![],'where':_0x2063b7[_0xda93('0x18')]?_0x2063b7['options']['where']||null:null,'attributes':_0x2063b7['options']?_0x2063b7[_0xda93('0x18')][_0xda93('0x1b')]||null:null,'include':_0x2063b7[_0xda93('0x18')]?_0x2063b7[_0xda93('0x18')][_0xda93('0x1c')]?_[_0xda93('0x1e')](_0x2063b7[_0xda93('0x18')]['include'],function(_0x13d943){return{'model':db[_0x13d943[_0xda93('0x1d')]],'as':_0x13d943['as'],'attributes':_0x13d943[_0xda93('0x1b')],'include':_0x13d943[_0xda93('0x1c')]?_['map'](_0x13d943[_0xda93('0x1c')],function(_0x16c140){return{'model':db[_0x16c140[_0xda93('0x1d')]],'as':_0x16c140['as'],'attributes':_0x16c140[_0xda93('0x1b')],'include':_0x16c140[_0xda93('0x1c')]?_['map'](_0x16c140[_0xda93('0x1c')],function(_0x242d1f){return{'model':db[_0x242d1f['model']],'as':_0x242d1f['as'],'attributes':_0x242d1f[_0xda93('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda93('0xc')](function(_0x2888ab){logger[_0xda93('0xd')](_0xda93('0x21'),_0x2063b7);logger[_0xda93('0x1f')](_0xda93('0x21'),_0x2063b7,JSON[_0xda93('0x20')](_0x2888ab));_0x3d69cd(_0x2888ab);})[_0xda93('0x14')](function(_0x3b2e5d){logger[_0xda93('0x11')]('ShowTrunk',_0x3b2e5d[_0xda93('0x13')],_0x2063b7);_0x3758a5(_0x57a924['error'](0x1f4,_0x3b2e5d[_0xda93('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 6e7ef10..061c1df 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5c5=['exports','express','Router','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x49c74a,_0x460efb){var _0x52fe8a=function(_0x11c217){while(--_0x11c217){_0x49c74a['push'](_0x49c74a['shift']());}};_0x52fe8a(++_0x460efb);}(_0xc5c5,0xe8));var _0x5c5c=function(_0x290604,_0x54d9f6){_0x290604=_0x290604-0x0;var _0x32b6e9=_0xc5c5[_0x290604];return _0x32b6e9;};'use strict';var express=require(_0x5c5c('0x0'));var router=express[_0x5c5c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5c5c('0x2'));router['put'](_0x5c5c('0x3'),auth[_0x5c5c('0x4')](),controller[_0x5c5c('0x5')]);module[_0x5c5c('0x6')]=router; \ No newline at end of file +var _0xc70f=['put','/:id','isAuthenticated','exports','express','Router','./user-setting.controller'];(function(_0x4f0c60,_0x4f5d3a){var _0x48c3fd=function(_0x224fa1){while(--_0x224fa1){_0x4f0c60['push'](_0x4f0c60['shift']());}};_0x48c3fd(++_0x4f5d3a);}(_0xc70f,0x185));var _0xfc70=function(_0x43c815,_0x5c85dc){_0x43c815=_0x43c815-0x0;var _0x1998d2=_0xc70f[_0x43c815];return _0x1998d2;};'use strict';var express=require(_0xfc70('0x0'));var router=express[_0xfc70('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfc70('0x2'));router[_0xfc70('0x3')](_0xfc70('0x4'),auth[_0xfc70('0x5')](),controller['update']);module[_0xfc70('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 1540ccb..d804fe5 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7de9=['sequelize','error','warning','info','debug','exports','ENUM','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x4ca530,_0x4a6814){var _0x431c9a=function(_0x482d37){while(--_0x482d37){_0x4ca530['push'](_0x4ca530['shift']());}};_0x431c9a(++_0x4a6814);}(_0x7de9,0x1c3));var _0x97de=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7de9[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require(_0x97de('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x97de('0x1'),_0x97de('0x2'),_0x97de('0x3'),_0x97de('0x4')];module[_0x97de('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x97de('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x97de('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x97de('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x97de('0x9')],'unique':_0x97de('0xa')}}; \ No newline at end of file +var _0xa205=['debug','exports','ENUM','error','BOOLEAN','TEXT','DATE','warning','info'];(function(_0x22b490,_0x3a50d0){var _0x2700c9=function(_0x2a45d2){while(--_0x2a45d2){_0x22b490['push'](_0x22b490['shift']());}};_0x2700c9(++_0x3a50d0);}(_0xa205,0xfa));var _0x5a20=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0xa205[_0x3e961c];return _0x474f9c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x5a20('0x0'),_0x5a20('0x1'),_0x5a20('0x2')];module[_0x5a20('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5a20('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5a20('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5a20('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5a20('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5a20('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index aea7cf3..2c519a0 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc8d=['then','sendStatus','error','name','send','role','admin','params','UserSetting','find','body','ioredis','../../config/logger','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','update'];(function(_0xdc2aad,_0x40c65d){var _0x4c1e47=function(_0x57fa8c){while(--_0x57fa8c){_0xdc2aad['push'](_0xdc2aad['shift']());}};_0x4c1e47(++_0x40c65d);}(_0xcc8d,0xbb));var _0xdcc8=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0xcc8d[_0xdd82b4];return _0x549bb2;};'use strict';var _=require('lodash');var Redis=require(_0xdcc8('0x0'));var logger=require(_0xdcc8('0x1'))('api');var config=require('../../config/environment');var db=require(_0xdcc8('0x2'))['db'];var socket=require(_0xdcc8('0x3'))(new Redis(config[_0xdcc8('0x4')]));require(_0xdcc8('0x5'))[_0xdcc8('0x6')](socket);config[_0xdcc8('0x4')]=_[_0xdcc8('0x7')](config['redis'],{'host':_0xdcc8('0x8'),'port':0x18eb});function respondWithResult(_0xfeebba,_0x10dd63){_0x10dd63=_0x10dd63||0xc8;return function(_0x237528){if(_0x237528){return _0xfeebba[_0xdcc8('0x9')](_0x10dd63)['json'](_0x237528);}};}function saveUpdates(_0x2bdaff){return function(_0xa991a1){if(_0xa991a1){return _0xa991a1[_0xdcc8('0xa')](_0x2bdaff)[_0xdcc8('0xb')](function(_0x2bd473){return _0x2bd473;});}return null;};}function handleEntityNotFound(_0x24f510){return function(_0x32d04a){if(!_0x32d04a){_0x24f510[_0xdcc8('0xc')](0x194);}return _0x32d04a;};}function handleError(_0x304993,_0x390f8c){_0x390f8c=_0x390f8c||0x1f4;return function(_0x771c05){logger[_0xdcc8('0xd')](_0x771c05['stack']);if(_0x771c05[_0xdcc8('0xe')]){delete _0x771c05[_0xdcc8('0xe')];}_0x304993['status'](_0x390f8c)[_0xdcc8('0xf')](_0x771c05);};}exports[_0xdcc8('0xa')]=function(_0xb23ffe,_0x378a27){if(_0xb23ffe['user'][_0xdcc8('0x10')]!==_0xdcc8('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0xb23ffe[_0xdcc8('0x12')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xdcc8('0x13')][_0xdcc8('0x14')]({'where':{'id':_0xb23ffe[_0xdcc8('0x12')]['id']}})[_0xdcc8('0xb')](handleEntityNotFound(_0x378a27,null))[_0xdcc8('0xb')](saveUpdates(_0xb23ffe[_0xdcc8('0x15')],null))[_0xdcc8('0xb')](respondWithResult(_0x378a27,null))['catch'](handleError(_0x378a27,null));}; \ No newline at end of file +var _0x032e=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','lodash','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x416d69,_0x3d0fbe){var _0x8a73cb=function(_0x169804){while(--_0x169804){_0x416d69['push'](_0x416d69['shift']());}};_0x8a73cb(++_0x3d0fbe);}(_0x032e,0x124));var _0xe032=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x032e[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xe032('0x0'));var Redis=require('ioredis');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xe032('0x3'))(new Redis(config[_0xe032('0x4')]));require(_0xe032('0x5'))[_0xe032('0x6')](socket);config[_0xe032('0x4')]=_[_0xe032('0x7')](config[_0xe032('0x4')],{'host':_0xe032('0x8'),'port':0x18eb});function respondWithResult(_0x37432f,_0x1576c8){_0x1576c8=_0x1576c8||0xc8;return function(_0x3289b0){if(_0x3289b0){return _0x37432f[_0xe032('0x9')](_0x1576c8)[_0xe032('0xa')](_0x3289b0);}};}function saveUpdates(_0x3b0ef8){return function(_0x3d62fa){if(_0x3d62fa){return _0x3d62fa[_0xe032('0xb')](_0x3b0ef8)[_0xe032('0xc')](function(_0x167bd9){return _0x167bd9;});}return null;};}function handleEntityNotFound(_0x4aec53){return function(_0x1382e1){if(!_0x1382e1){_0x4aec53[_0xe032('0xd')](0x194);}return _0x1382e1;};}function handleError(_0x13c126,_0x42e2ba){_0x42e2ba=_0x42e2ba||0x1f4;return function(_0x244f93){logger[_0xe032('0xe')](_0x244f93[_0xe032('0xf')]);if(_0x244f93['name']){delete _0x244f93[_0xe032('0x10')];}_0x13c126[_0xe032('0x9')](_0x42e2ba)[_0xe032('0x11')](_0x244f93);};}exports[_0xe032('0xb')]=function(_0x4aee44,_0x311592){if(_0x4aee44[_0xe032('0x12')][_0xe032('0x13')]!==_0xe032('0x14'))throw new Error(_0xe032('0x15'));if(isNaN(Number(_0x4aee44[_0xe032('0x16')]['id'])))throw new Error(_0xe032('0x17'));return db['UserSetting'][_0xe032('0x18')]({'where':{'id':_0x4aee44[_0xe032('0x16')]['id']}})[_0xe032('0xc')](handleEntityNotFound(_0x311592,null))[_0xe032('0xc')](saveUpdates(_0x4aee44[_0xe032('0x19')],null))[_0xe032('0xc')](respondWithResult(_0x311592,null))['catch'](handleError(_0x311592,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index d3c68da..6201635 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x322e=['../../mysqldb','save','update','remove','emit','hook','exports','events'];(function(_0x27657c,_0x36813e){var _0x12324a=function(_0x3f6eea){while(--_0x3f6eea){_0x27657c['push'](_0x27657c['shift']());}};_0x12324a(++_0x36813e);}(_0x322e,0x187));var _0xe322=function(_0x259bce,_0x1992c3){_0x259bce=_0x259bce-0x0;var _0x25faac=_0x322e[_0x259bce];return _0x25faac;};'use strict';var EventEmitter=require(_0xe322('0x0'));var UserSetting=require(_0xe322('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe322('0x2'),'afterUpdate':_0xe322('0x3'),'afterDestroy':_0xe322('0x4')};function emitEvent(_0x3c801d){return function(_0x27e7c5,_0x5cd4c4,_0x882a15){UserSettingEvents[_0xe322('0x5')](_0x3c801d+':'+_0x27e7c5['id'],_0x27e7c5);UserSettingEvents['emit'](_0x3c801d,_0x27e7c5);_0x882a15(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe322('0x6')](e,emitEvent(event));}}module[_0xe322('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x3840=['../../mysqldb','UserSetting','save','update','remove','emit','hook','exports','events'];(function(_0x12b955,_0x2df692){var _0x9b217d=function(_0x52a764){while(--_0x52a764){_0x12b955['push'](_0x12b955['shift']());}};_0x9b217d(++_0x2df692);}(_0x3840,0x104));var _0x0384=function(_0x19657f,_0x4b124d){_0x19657f=_0x19657f-0x0;var _0x129bba=_0x3840[_0x19657f];return _0x129bba;};'use strict';var EventEmitter=require(_0x0384('0x0'));var UserSetting=require(_0x0384('0x1'))['db'][_0x0384('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0384('0x3'),'afterUpdate':_0x0384('0x4'),'afterDestroy':_0x0384('0x5')};function emitEvent(_0x341377){return function(_0x3e369e,_0x47c181,_0x4670cd){UserSettingEvents[_0x0384('0x6')](_0x341377+':'+_0x3e369e['id'],_0x3e369e);UserSettingEvents[_0x0384('0x6')](_0x341377,_0x3e369e);_0x4670cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0384('0x7')](e,emitEvent(event));}}module[_0x0384('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 7cf4c2a..504655b 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9234=['clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x119680,_0x1e6a47){var _0x21e81e=function(_0x313bd0){while(--_0x313bd0){_0x119680['push'](_0x119680['shift']());}};_0x21e81e(++_0x1e6a47);}(_0x9234,0x1bd));var _0x4923=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0x9234[_0x7abd7];return _0x3a2577;};'use strict';var attributes=require(_0x4923('0x0'));module['exports']=function(_0x1ece6e){return _0x1ece6e[_0x4923('0x1')](_0x4923('0x2'),attributes,{'tableName':_0x4923('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x481178){if(!_0x481178[_0x4923('0x4')])_0x481178[_0x4923('0x5')]=null;else if(_0x481178['clientSideLoggingEnabledSince']===null)_0x481178[_0x4923('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x0565=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x44d344,_0x36f469){var _0x431075=function(_0x22ed7a){while(--_0x22ed7a){_0x44d344['push'](_0x44d344['shift']());}};_0x431075(++_0x36f469);}(_0x0565,0xf2));var _0x5056=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0565[_0x47aa64];return _0x549c7a;};'use strict';var attributes=require(_0x5056('0x0'));module[_0x5056('0x1')]=function(_0x2790a7){return _0x2790a7[_0x5056('0x2')](_0x5056('0x3'),attributes,{'tableName':_0x5056('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd4624d){if(!_0xd4624d[_0x5056('0x5')])_0xd4624d[_0x5056('0x6')]=null;else if(_0xd4624d[_0x5056('0x6')]===null)_0xd4624d['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 245433b..1d1e313 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab4c=['length','user-setting:','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x621eb,_0x18f803){var _0x21a180=function(_0x4995a0){while(--_0x4995a0){_0x621eb['push'](_0x621eb['shift']());}};_0x21a180(++_0x18f803);}(_0xab4c,0x158));var _0xcab4=function(_0x8f7d2b,_0x1bebaf){_0x8f7d2b=_0x8f7d2b-0x0;var _0x13c298=_0xab4c[_0x8f7d2b];return _0x13c298;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xcab4('0x0'),_0xcab4('0x1')];function createListener(_0xb31521,_0x435fa4){return function(_0x4f9d3a){_0x435fa4[_0xcab4('0x2')](_0xb31521,_0x4f9d3a);if(_0xb31521===_0xcab4('0x3')){_0x435fa4[_0xcab4('0x2')](_0xcab4('0x4')+_0x4f9d3a[_0xcab4('0x5')],_0x4f9d3a);}};}exports[_0xcab4('0x6')]=function(_0x1492a3){for(var _0x1f5112=0x0,_0x124513=events[_0xcab4('0x7')];_0x1f5112<_0x124513;_0x1f5112++){var _0x16a13f=events[_0x1f5112];var _0x43ef64=createListener(_0xcab4('0x8')+_0x16a13f,_0x1492a3);UserSettingEvents['on'](_0x16a13f,_0x43ef64);}}; \ No newline at end of file +var _0x7f31=['user-setting:update','emit','user-setting:update:user-','UserId','register','length','user-setting:','save','remove','update'];(function(_0x1d7a9,_0x16b2b7){var _0xc73c49=function(_0x3ed158){while(--_0x3ed158){_0x1d7a9['push'](_0x1d7a9['shift']());}};_0xc73c49(++_0x16b2b7);}(_0x7f31,0x13d));var _0x17f3=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x7f31[_0x59ae8f];return _0x3900b5;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x17f3('0x0'),_0x17f3('0x1'),_0x17f3('0x2')];function createListener(_0xf0f7c2,_0x1d590e){return function(_0x155acc){_0x1d590e['emit'](_0xf0f7c2,_0x155acc);if(_0xf0f7c2===_0x17f3('0x3')){_0x1d590e[_0x17f3('0x4')](_0x17f3('0x5')+_0x155acc[_0x17f3('0x6')],_0x155acc);}};}exports[_0x17f3('0x7')]=function(_0x417611){for(var _0x3d9165=0x0,_0x4ec639=events[_0x17f3('0x8')];_0x3d9165<_0x4ec639;_0x3d9165++){var _0x2c15dd=events[_0x3d9165];var _0x50b54e=createListener(_0x17f3('0x9')+_0x2c15dd,_0x417611);UserSettingEvents['on'](_0x2c15dd,_0x50b54e);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 514a1f0..2e2ae78 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 _0x1aaf=['/:id/mail_interactions','addMailInteractions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','%s-%s','now','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions'];(function(_0x11212d,_0x5d4290){var _0x535977=function(_0x31f2cd){while(--_0x31f2cd){_0x11212d['push'](_0x11212d['shift']());}};_0x535977(++_0x5d4290);}(_0x1aaf,0x103));var _0xf1aa=function(_0x438aa6,_0x447f3b){_0x438aa6=_0x438aa6-0x0;var _0x5eacb1=_0x1aaf[_0x438aa6];return _0x5eacb1;};'use strict';var multer=require(_0xf1aa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf1aa('0x1'));var express=require(_0xf1aa('0x2'));var router=express[_0xf1aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf1aa('0x4'));var interaction=require(_0xf1aa('0x5'));var config=require(_0xf1aa('0x6'));var controller=require(_0xf1aa('0x7'));router[_0xf1aa('0x8')]('/',auth[_0xf1aa('0x9')](),controller['index']);router[_0xf1aa('0x8')]('/describe',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xa')]);router['get'](_0xf1aa('0xb'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xc')]);router[_0xf1aa('0x8')]('/presence',auth['isAuthenticated'](),controller['getPresence']);router[_0xf1aa('0x8')](_0xf1aa('0xd'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0xe')]);router[_0xf1aa('0x8')](_0xf1aa('0xf'),controller[_0xf1aa('0x10')]);router['get'](_0xf1aa('0x11'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x12')]);router[_0xf1aa('0x8')](_0xf1aa('0x13'),auth['isAuthenticated'](),controller[_0xf1aa('0x14')]);router['get'](_0xf1aa('0x15'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x16')]);router[_0xf1aa('0x8')](_0xf1aa('0x17'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x18')]);router['get']('/:id/groups',auth[_0xf1aa('0x9')](),controller['getGroups']);router[_0xf1aa('0x8')](_0xf1aa('0x19'),auth['isAuthenticated'](),controller[_0xf1aa('0x1a')]);router[_0xf1aa('0x8')](_0xf1aa('0x1b'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x1c')]);router[_0xf1aa('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xf1aa('0x8')](_0xf1aa('0x1d'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x1e')]);router['get'](_0xf1aa('0x1f'),auth['isAuthenticated'](),controller[_0xf1aa('0x20')]);router[_0xf1aa('0x8')](_0xf1aa('0x21'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x22')]);router[_0xf1aa('0x8')]('/:id/fax/interactions',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x23')]);router['get'](_0xf1aa('0x24'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x25')]);router[_0xf1aa('0x8')](_0xf1aa('0x26'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x27')]);router[_0xf1aa('0x8')](_0xf1aa('0x28'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x29')]);router[_0xf1aa('0x8')](_0xf1aa('0x2a'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xf1aa('0x2b'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x2c')]);router[_0xf1aa('0x8')](_0xf1aa('0x2d'),auth['isAuthenticated'](),controller[_0xf1aa('0x2e')]);router[_0xf1aa('0x8')](_0xf1aa('0x2f'),auth[_0xf1aa('0x9')](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x30')]);router[_0xf1aa('0x8')]('/:id/sms_accounts',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x31')]);router['get']('/:id/chat_websites',auth[_0xf1aa('0x9')](),controller['getChatWebsites']);router[_0xf1aa('0x8')](_0xf1aa('0x32'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x33')]);router['get'](_0xf1aa('0x34'),auth[_0xf1aa('0x9')](),controller['getScheduledCalls']);router[_0xf1aa('0x8')](_0xf1aa('0x35'),auth[_0xf1aa('0x9')](),controller['getApiKey']);router[_0xf1aa('0x36')](_0xf1aa('0x13'),auth['isAuthenticated'](),controller[_0xf1aa('0x37')]);router[_0xf1aa('0x36')]('/',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x38')]);router[_0xf1aa('0x36')](_0xf1aa('0x39'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x3a')]);router['post'](_0xf1aa('0x15'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa95f3,_0x5314d6,_0x5ee99b){_0x5ee99b(null,path[_0xf1aa('0x3c')](config[_0xf1aa('0x3d')],_0xf1aa('0x3e')));},'filename':function(_0x305062,_0x574525,_0xb4d80d){_0xb4d80d(null,util['format'](_0xf1aa('0x3f'),Date[_0xf1aa('0x40')](),_0x574525['originalname']));}})});router[_0xf1aa('0x36')](_0xf1aa('0xf'),upload[_0xf1aa('0x41')](_0xf1aa('0x42')),controller['addAvatar']);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0xf1aa('0x43')]);router[_0xf1aa('0x36')](_0xf1aa('0x44'),auth['isAuthenticated'](),controller[_0xf1aa('0x45')]);router['post'](_0xf1aa('0x46'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x47')]);router['post'](_0xf1aa('0x48'),auth['isAuthenticated'](),controller[_0xf1aa('0x49')]);router['post'](_0xf1aa('0x26'),auth['isAuthenticated'](),controller[_0xf1aa('0x4a')]);router[_0xf1aa('0x36')](_0xf1aa('0x4b'),auth['isAuthenticated'](),controller[_0xf1aa('0x4c')]);router[_0xf1aa('0x36')](_0xf1aa('0x4d'),auth['isAuthenticated'](),controller[_0xf1aa('0x4e')]);router[_0xf1aa('0x36')]('/:id/fax_interactions',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x4f')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xf1aa('0x50')]);router[_0xf1aa('0x36')](_0xf1aa('0x51'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x52')]);router[_0xf1aa('0x36')](_0xf1aa('0x53'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xf1aa('0x36')](_0xf1aa('0x2d'),auth[_0xf1aa('0x9')](),controller['addFaxAccounts']);router[_0xf1aa('0x36')](_0xf1aa('0x2f'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x54')]);router[_0xf1aa('0x36')](_0xf1aa('0x55'),auth[_0xf1aa('0x9')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x56')]);router[_0xf1aa('0x36')](_0xf1aa('0x57'),auth['isAuthenticated'](),controller[_0xf1aa('0x58')]);router[_0xf1aa('0x36')](_0xf1aa('0x32'),auth[_0xf1aa('0x9')](),controller['addWhatsappAccounts']);router[_0xf1aa('0x36')](_0xf1aa('0x35'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xf1aa('0x59')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf1aa('0x59')](_0xf1aa('0x5a'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x5b')]);router[_0xf1aa('0x5c')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router[_0xf1aa('0x5c')](_0xf1aa('0x26'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x5d')]);router[_0xf1aa('0x5c')](_0xf1aa('0xd'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x5e')]);router[_0xf1aa('0x5c')](_0xf1aa('0x4b'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x5f')]);router[_0xf1aa('0x5c')](_0xf1aa('0x4d'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x60')]);router[_0xf1aa('0x5c')](_0xf1aa('0x61'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x62')]);router[_0xf1aa('0x5c')]('/:id/sms_interactions',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x63')]);router['delete'](_0xf1aa('0x51'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x64')]);router['delete'](_0xf1aa('0x53'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x65')]);router['delete']('/:id/fax_accounts',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x66')]);router[_0xf1aa('0x5c')]('/:id/mail_accounts',auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x67')]);router[_0xf1aa('0x5c')](_0xf1aa('0x55'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x68')]);router['delete'](_0xf1aa('0x69'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x6a')]);router['delete'](_0xf1aa('0x57'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xf1aa('0x5c')](_0xf1aa('0x32'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x6b')]);router[_0xf1aa('0x5c')](_0xf1aa('0x35'),auth['isAuthenticated'](),controller[_0xf1aa('0x6c')]);router[_0xf1aa('0x36')](_0xf1aa('0x6d'),auth[_0xf1aa('0x9')](),controller[_0xf1aa('0x6e')]);module[_0xf1aa('0x6f')]=router; \ No newline at end of file +var _0xf4b9=['messengerSoundNotification','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','diskStorage','join','server/files/images/','originalname','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey'];(function(_0x433195,_0x58b789){var _0x30a4c4=function(_0x5f6f90){while(--_0x5f6f90){_0x433195['push'](_0x433195['shift']());}};_0x30a4c4(++_0x58b789);}(_0xf4b9,0x6d));var _0x9f4b=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf4b9[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x9f4b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9f4b('0x1'));var express=require(_0x9f4b('0x2'));var router=express[_0x9f4b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f4b('0x4'));var config=require(_0x9f4b('0x5'));var controller=require(_0x9f4b('0x6'));router[_0x9f4b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9f4b('0x7')](_0x9f4b('0x8'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xa')]);router[_0x9f4b('0x7')]('/whoami',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xb')]);router[_0x9f4b('0x7')]('/presence',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xc')]);router[_0x9f4b('0x7')](_0x9f4b('0xd'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0xe')]);router['get'](_0x9f4b('0xf'),controller[_0x9f4b('0x10')]);router[_0x9f4b('0x7')](_0x9f4b('0x11'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x12')]);router['get'](_0x9f4b('0x13'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x14')]);router[_0x9f4b('0x7')](_0x9f4b('0x15'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x16')]);router[_0x9f4b('0x7')](_0x9f4b('0x17'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x18')]);router[_0x9f4b('0x7')](_0x9f4b('0x19'),auth['isAuthenticated'](),controller[_0x9f4b('0x1a')]);router['get']('/:id/recordings',auth[_0x9f4b('0x9')](),controller['getRecordings']);router[_0x9f4b('0x7')]('/:id/screen_recordings',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x1b')]);router[_0x9f4b('0x7')](_0x9f4b('0x1c'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x1d')]);router['get']('/:id/openchannel/interactions',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x1e')]);router[_0x9f4b('0x7')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x9f4b('0x1f')]);router[_0x9f4b('0x7')](_0x9f4b('0x20'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x21')]);router[_0x9f4b('0x7')](_0x9f4b('0x22'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x9f4b('0x7')](_0x9f4b('0x23'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x24')]);router[_0x9f4b('0x7')](_0x9f4b('0x25'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9f4b('0x7')](_0x9f4b('0x26'),auth[_0x9f4b('0x9')](),controller['getLists']);router[_0x9f4b('0x7')](_0x9f4b('0x27'),auth['isAuthenticated'](),controller[_0x9f4b('0x28')]);router[_0x9f4b('0x7')](_0x9f4b('0x29'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x2a')]);router[_0x9f4b('0x7')](_0x9f4b('0x2b'),auth['isAuthenticated'](),controller[_0x9f4b('0x2c')]);router[_0x9f4b('0x7')](_0x9f4b('0x2d'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x2e')]);router[_0x9f4b('0x7')]('/:id/openchannel_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x2f')]);router[_0x9f4b('0x7')](_0x9f4b('0x30'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x31')]);router[_0x9f4b('0x7')]('/:id/chat_websites',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x32')]);router['get'](_0x9f4b('0x33'),auth[_0x9f4b('0x9')](),controller['getWhatsappAccounts']);router['get'](_0x9f4b('0x34'),auth['isAuthenticated'](),controller[_0x9f4b('0x35')]);router['get'](_0x9f4b('0x36'),auth['isAuthenticated'](),controller[_0x9f4b('0x37')]);router['post'](_0x9f4b('0x13'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x38')]);router[_0x9f4b('0x39')]('/',auth['isAuthenticated'](),controller[_0x9f4b('0x3a')]);router['post'](_0x9f4b('0x3b'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x3c')]);router['post']('/:id/queues',auth[_0x9f4b('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9f4b('0x3d')]({'destination':function(_0x19aaef,_0x2ab4f6,_0x41e376){_0x41e376(null,path[_0x9f4b('0x3e')](config['root'],_0x9f4b('0x3f')));},'filename':function(_0xfa8132,_0x366806,_0x956833){_0x956833(null,util['format']('%s-%s',Date['now'](),_0x366806[_0x9f4b('0x40')]));}})});router[_0x9f4b('0x39')]('/:id/avatar',upload['single']('file'),controller[_0x9f4b('0x41')]);router[_0x9f4b('0x39')](_0x9f4b('0x42'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x43')]);router[_0x9f4b('0x39')](_0x9f4b('0x44'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x45')]);router[_0x9f4b('0x39')]('/:id/pause',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x46')]);router['post'](_0x9f4b('0x47'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x48')]);router[_0x9f4b('0x39')](_0x9f4b('0x25'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x49')]);router[_0x9f4b('0x39')](_0x9f4b('0x4a'),auth[_0x9f4b('0x9')](),controller['addChatInteractions']);router[_0x9f4b('0x39')](_0x9f4b('0x4b'),auth[_0x9f4b('0x9')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x9f4b('0x9')](),controller['addFaxInteractions']);router[_0x9f4b('0x39')](_0x9f4b('0x4c'),auth['isAuthenticated'](),controller['addSmsInteractions']);router['post'](_0x9f4b('0x4d'),auth[_0x9f4b('0x9')](),controller['addOpenchannelInteractions']);router[_0x9f4b('0x39')](_0x9f4b('0x4e'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x4f')]);router[_0x9f4b('0x39')](_0x9f4b('0x2b'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x50')]);router['post']('/:id/mail_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x51')]);router[_0x9f4b('0x39')]('/:id/openchannel_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x52')]);router[_0x9f4b('0x39')](_0x9f4b('0x30'),auth[_0x9f4b('0x9')](),controller['addSmsAccounts']);router[_0x9f4b('0x39')](_0x9f4b('0x53'),auth[_0x9f4b('0x9')](),controller['addChatWebsites']);router[_0x9f4b('0x39')](_0x9f4b('0x33'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x54')]);router[_0x9f4b('0x39')](_0x9f4b('0x36'),auth['isAuthenticated'](),controller[_0x9f4b('0x55')]);router['put'](_0x9f4b('0xd'),auth['isAuthenticated'](),controller[_0x9f4b('0x56')]);router[_0x9f4b('0x57')](_0x9f4b('0x58'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x59')]);router[_0x9f4b('0x5a')](_0x9f4b('0x15'),auth[_0x9f4b('0x9')](),controller['removeQueues']);router[_0x9f4b('0x5a')](_0x9f4b('0x25'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5b')]);router[_0x9f4b('0x5a')](_0x9f4b('0xd'),auth['isAuthenticated'](),controller[_0x9f4b('0x5c')]);router[_0x9f4b('0x5a')](_0x9f4b('0x4a'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5d')]);router[_0x9f4b('0x5a')](_0x9f4b('0x4b'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5e')]);router[_0x9f4b('0x5a')]('/:id/fax_interactions',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x5f')]);router[_0x9f4b('0x5a')](_0x9f4b('0x4c'),auth['isAuthenticated'](),controller[_0x9f4b('0x60')]);router['delete'](_0x9f4b('0x4d'),auth[_0x9f4b('0x9')](),controller['removeOpenchannelInteractions']);router[_0x9f4b('0x5a')](_0x9f4b('0x4e'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x61')]);router[_0x9f4b('0x5a')](_0x9f4b('0x2b'),auth[_0x9f4b('0x9')](),controller['removeFaxAccounts']);router[_0x9f4b('0x5a')](_0x9f4b('0x2d'),auth['isAuthenticated'](),controller[_0x9f4b('0x62')]);router[_0x9f4b('0x5a')](_0x9f4b('0x63'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x64')]);router[_0x9f4b('0x5a')](_0x9f4b('0x30'),auth['isAuthenticated'](),controller[_0x9f4b('0x65')]);router[_0x9f4b('0x5a')](_0x9f4b('0x53'),auth['isAuthenticated'](),controller[_0x9f4b('0x66')]);router[_0x9f4b('0x5a')]('/:id/whatsapp_accounts',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x67')]);router[_0x9f4b('0x5a')](_0x9f4b('0x36'),auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x68')]);router['post']('/:id/messengerSoundNotification',auth[_0x9f4b('0x9')](),controller[_0x9f4b('0x69')]);module[_0x9f4b('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b7cd1d7..4c16123 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 _0x8799=['transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','TEXT','showWebBar','get','isArray','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','force_avp','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','agent','telephone','local','INTEGER','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x58fe8d,_0x405de7){var _0x18ecec=function(_0x4cdc4a){while(--_0x4cdc4a){_0x58fe8d['push'](_0x58fe8d['shift']());}};_0x18ecec(++_0x405de7);}(_0x8799,0xf5));var _0x9879=function(_0x41cdf1,_0x204a09){_0x41cdf1=_0x41cdf1-0x0;var _0x1fb097=_0x8799[_0x41cdf1];return _0x1fb097;};'use strict';var Sequelize=require(_0x9879('0x0'));var moment=require(_0x9879('0x1'));var util=require(_0x9879('0x2'));var _=require(_0x9879('0x3'));module[_0x9879('0x4')]={'name':{'type':Sequelize[_0x9879('0x5')],'allowNull':![],'unique':_0x9879('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3af6aa){this[_0x9879('0x7')](_0x9879('0x6'),_0x3af6aa);this[_0x9879('0x7')](_0x9879('0x8'),_0x3af6aa);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x154ea3){this[_0x9879('0x7')]('fullname',_0x154ea3);this['setDataValue'](_0x9879('0x9'),util[_0x9879('0xa')](_0x9879('0xb'),_0x154ea3,this[_0x9879('0xc')](_0x9879('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9879('0xe'),'validate':{'isEmail':!![]},'set':function(_0x4cf9cd){if(_0x4cf9cd){this[_0x9879('0x7')](_0x9879('0xe'),_0x4cf9cd[_0x9879('0xf')]());}}},'role':{'type':Sequelize['ENUM']('admin','user',_0x9879('0x10'),_0x9879('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x9879('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x9879('0x12')},'internal':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x570094){this[_0x9879('0x7')](_0x9879('0xd'),_0x570094);this[_0x9879('0x7')]('accountcode',_0x570094);this['setDataValue'](_0x9879('0x9'),util[_0x9879('0xa')](_0x9879('0xb'),this['getDataValue']('fullname'),_0x570094));}},'salt':{'type':Sequelize[_0x9879('0x5')]},'phone':{'type':Sequelize[_0x9879('0x5')]},'mobile':{'type':Sequelize[_0x9879('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9879('0x5')]},'country':{'type':Sequelize[_0x9879('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9879('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9879('0x5')],'defaultValue':_0x9879('0x16')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9879('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9879('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![],'defaultValue':_0x9879('0x17')},'ipaddr':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x9879('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x19'),_0x9879('0x1a'),_0x9879('0x1b')),'allowNull':!![],'defaultValue':_0x9879('0x19')},'context':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![],'defaultValue':_0x9879('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9879('0x1d'),_0x9879('0x1e'),_0x9879('0x1f'),'ALLOWED',_0x9879('0x20'),_0x9879('0x21'),_0x9879('0x22'),_0x9879('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![],'defaultValue':_0x9879('0x24'),'set':function(_0x260b24){this[_0x9879('0x7')](_0x9879('0x25'),_0x260b24?_0x260b24[_0x9879('0x26')](','):null);},'get':function(){return this[_0x9879('0xc')]('transport')?this[_0x9879('0xc')]('transport')[_0x9879('0x27')](','):null;},'comment':_0x9879('0x28')},'dtmfmode':{'type':Sequelize[_0x9879('0x18')]('rfc2833',_0x9879('0x29'),_0x9879('0x2a'),_0x9879('0x2b'),_0x9879('0x2c')),'allowNull':!![],'defaultValue':_0x9879('0x2d')},'directmedia':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no',_0x9879('0x2f'),_0x9879('0x30'),_0x9879('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2b444c){this[_0x9879('0x7')](_0x9879('0x32'),_0x2b444c?_0x2b444c['join'](','):null);},'get':function(){return this['getDataValue'](_0x9879('0x32'))?this[_0x9879('0xc')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9879('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9879('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9879('0x33')},'allow':{'type':Sequelize[_0x9879('0x5')],'allowNull':![],'defaultValue':_0x9879('0x34'),'set':function(_0x2349ef){this[_0x9879('0x7')](_0x9879('0x35'),_0x2349ef?_0x2349ef['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9879('0xc')](_0x9879('0x35'))?this[_0x9879('0xc')](_0x9879('0x35'))[_0x9879('0x27')](';'):null;},'comment':_0x9879('0x36')},'autoframing':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![],'set':function(_0x1a81c1){this[_0x9879('0x7')](_0x9879('0x37'),_0x1a81c1?_0x1a81c1[_0x9879('0x26')](','):null);},'get':function(){return this[_0x9879('0xc')](_0x9879('0x37'))?this['getDataValue'](_0x9879('0x37'))[_0x9879('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x9879('0x2e'),'no',_0x9879('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![],'defaultValue':_0x9879('0x39')},'amaflags':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x9879('0x2e')},'busylevel':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9879('0x18')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9879('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9879('0x18')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no',_0x9879('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9879('0x18')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x3b'),_0x9879('0x3c'),_0x9879('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x9879('0x3e'),_0x9879('0x3f')),'allowNull':!![],'defaultValue':_0x9879('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x9879('0x2e')},'keepalive':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9879('0x18')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x9879('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9879('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x9879('0x2e'),'no',_0x9879('0x40'),_0x9879('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9879('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x9879('0x42'),'passive',_0x9879('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9879('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9879('0x18')](_0x9879('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9879('0x18')]('yes','no','nonat',_0x9879('0x30'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9879('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x9879('0x14')]},'passwordResetAt':{'type':Sequelize[_0x9879('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9879('0x44')]},'showWebBar':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0,'set':function(_0x54df00){this[_0x9879('0x7')](_0x9879('0x45'),_0x54df00);var _0x58af27=this[_0x9879('0x46')]({'plain':!![]});switch(_0x54df00){case 0x0:case 0x1:var _0x8c0d7=_0x58af27[_0x9879('0x25')]?_[_0x9879('0x47')](_0x58af27[_0x9879('0x25')])?_0x58af27['transport'][_0x9879('0x26')]():_0x58af27[_0x9879('0x25')]:'udp';if(_0x8c0d7==='wss'){_0x8c0d7=_0x9879('0x24');}this[_0x9879('0x7')](_0x9879('0x25'),_0x8c0d7);this[_0x9879('0x7')]('encryption','no');this[_0x9879('0x7')](_0x9879('0x48'),null);this[_0x9879('0x7')]('force_avp',null);this[_0x9879('0x7')](_0x9879('0x49'),null);this[_0x9879('0x7')](_0x9879('0x4a'),null);this[_0x9879('0x7')](_0x9879('0x4b'),null);this[_0x9879('0x7')](_0x9879('0x4c'),null);this['setDataValue'](_0x9879('0x4d'),null);this[_0x9879('0x7')](_0x9879('0x4e'),null);this['setDataValue'](_0x9879('0x4f'),'no');break;case 0x2:this[_0x9879('0x7')](_0x9879('0x25'),'wss');this[_0x9879('0x7')](_0x9879('0x50'),_0x9879('0x2e'));this[_0x9879('0x7')]('avpf','yes');this[_0x9879('0x7')](_0x9879('0x51'),_0x9879('0x2e'));this['setDataValue'](_0x9879('0x49'),_0x9879('0x2e'));this['setDataValue']('dtlsenable',_0x9879('0x2e'));this[_0x9879('0x7')](_0x9879('0x4b'),'no');this[_0x9879('0x7')](_0x9879('0x4c'),'actpass');this[_0x9879('0x7')](_0x9879('0x4d'),_0x58af27['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x9879('0x7')]('dtlsprivatekey',_0x58af27[_0x9879('0x4e')]||_0x9879('0x52'));this[_0x9879('0x7')](_0x9879('0x4f'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5c7edb){this['setDataValue'](_0x9879('0x53'),_0x5c7edb?_0x5c7edb[_0x9879('0x26')](','):[]);},'get':function(){return this[_0x9879('0xc')]('permissions')?_[_0x9879('0x54')](this[_0x9879('0xc')](_0x9879('0x53'))[_0x9879('0x27')](','),function(_0x1f0785){return parseInt(_0x1f0785,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9879('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9879('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9879('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9879('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9879('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9879('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9879('0x18')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9879('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9879('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9879('0x55')],'get':function(){return this[_0x9879('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0x9879('0xc')](_0x9879('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9879('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9879('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![],'set':function(_0x3d9975){if(typeof _0x3d9975===_0x9879('0x57')){var _0x4a4fd4=_0x3d9975==='1'?!![]:_0x3d9975==='0'?![]:_0x3d9975==='true'?!![]:_0x3d9975===_0x9879('0x58')?![]:![];this[_0x9879('0x7')]('screenrecording',_0x4a4fd4);}else{this[_0x9879('0x7')](_0x9879('0x59'),_0x3d9975);}}},'blocked':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![],'set':function(_0xc038a3){this[_0x9879('0x7')](_0x9879('0x5a'),_0xc038a3);if(_0xc038a3===!![]){this[_0x9879('0x7')](_0x9879('0x5b'),moment());this[_0x9879('0x7')](_0x9879('0x5c'),0x0);}else{this['setDataValue'](_0x9879('0x5b'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9879('0x13')](0x5)[_0x9879('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9879('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9879('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9879('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x9879('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x7535=['blockedAt','loginAttempts','UNSIGNED','moment','util','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','internal','email','ENUM','admin','user','INTEGER','\x22%s\x22\x20<%s>','DATE','BOOLEAN','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','get','isArray','wss','udp','avpf','force_avp','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','icesupport','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked'];(function(_0x13affe,_0x1ceaf7){var _0x3a05a4=function(_0x126814){while(--_0x126814){_0x13affe['push'](_0x13affe['shift']());}};_0x3a05a4(++_0x1ceaf7);}(_0x7535,0x10b));var _0x5753=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7535[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5753('0x0'));var util=require(_0x5753('0x1'));var _=require('lodash');module[_0x5753('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5753('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b3320){this[_0x5753('0x4')](_0x5753('0x3'),_0x5b3320);this[_0x5753('0x4')]('defaultuser',_0x5b3320);},'comment':_0x5753('0x5')},'fullname':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'set':function(_0x5788c0){this[_0x5753('0x4')](_0x5753('0x7'),_0x5788c0);this['setDataValue'](_0x5753('0x8'),util[_0x5753('0x9')]('\x22%s\x22\x20<%s>',_0x5788c0,this[_0x5753('0xa')](_0x5753('0xb'))));}},'alias':{'type':Sequelize[_0x5753('0x6')]},'email':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'unique':_0x5753('0xc'),'validate':{'isEmail':!![]},'set':function(_0x17d30f){if(_0x17d30f){this[_0x5753('0x4')](_0x5753('0xc'),_0x17d30f['toLowerCase']());}}},'role':{'type':Sequelize[_0x5753('0xd')](_0x5753('0xe'),_0x5753('0xf'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':![],'unique':_0x5753('0xb'),'set':function(_0x25a98e){this[_0x5753('0x4')]('internal',_0x25a98e);this['setDataValue']('accountcode',_0x25a98e);this['setDataValue'](_0x5753('0x8'),util[_0x5753('0x9')](_0x5753('0x11'),this['getDataValue'](_0x5753('0x7')),_0x25a98e));}},'salt':{'type':Sequelize[_0x5753('0x6')]},'phone':{'type':Sequelize[_0x5753('0x6')]},'mobile':{'type':Sequelize[_0x5753('0x6')]},'address':{'type':Sequelize[_0x5753('0x6')]},'zipcode':{'type':Sequelize[_0x5753('0x6')]},'userpic':{'type':Sequelize[_0x5753('0x6')]},'city':{'type':Sequelize[_0x5753('0x6')]},'country':{'type':Sequelize[_0x5753('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5753('0x12')]},'voicePause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5753('0x6')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5753('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5753('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![],'defaultValue':_0x5753('0x14')},'ipaddr':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x5753('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x5753('0x15'),'user',_0x5753('0x16')),'allowNull':!![],'defaultValue':_0x5753('0x15')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5753('0x17')},'callingpres':{'type':Sequelize['ENUM'](_0x5753('0x18'),_0x5753('0x19'),_0x5753('0x1a'),'ALLOWED','PROHIB_NOT_SCREENED',_0x5753('0x1b'),_0x5753('0x1c'),_0x5753('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![],'defaultValue':'udp','set':function(_0x198394){this[_0x5753('0x4')](_0x5753('0x1e'),_0x198394?_0x198394[_0x5753('0x1f')](','):null);},'get':function(){return this[_0x5753('0xa')](_0x5753('0x1e'))?this[_0x5753('0xa')](_0x5753('0x1e'))[_0x5753('0x20')](','):null;},'comment':_0x5753('0x21')},'dtmfmode':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x22'),'info','shortinfo',_0x5753('0x23'),_0x5753('0x24')),'allowNull':!![],'defaultValue':_0x5753('0x22')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x5753('0x25'),_0x5753('0x26'),_0x5753('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5753('0x29'),'set':function(_0x52dcc6){this['setDataValue'](_0x5753('0x2a'),_0x52dcc6?_0x52dcc6[_0x5753('0x1f')](','):null);},'get':function(){return this[_0x5753('0xa')](_0x5753('0x2a'))?this[_0x5753('0xa')]('nat')[_0x5753('0x20')](','):null;},'comment':_0x5753('0x2b')},'callgroup':{'type':Sequelize[_0x5753('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5753('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5753('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5753('0x2c')},'allow':{'type':Sequelize[_0x5753('0x6')],'allowNull':![],'defaultValue':_0x5753('0x2d'),'set':function(_0x185e7e){this['setDataValue'](_0x5753('0x2e'),_0x185e7e?_0x185e7e[_0x5753('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x5753('0xa')](_0x5753('0x2e'))?this['getDataValue'](_0x5753('0x2e'))[_0x5753('0x20')](';'):null;},'comment':_0x5753('0x2f')},'autoframing':{'type':Sequelize[_0x5753('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x367f7d){this[_0x5753('0x4')](_0x5753('0x30'),_0x367f7d?_0x367f7d[_0x5753('0x1f')](','):null);},'get':function(){return this[_0x5753('0xa')](_0x5753('0x30'))?this['getDataValue'](_0x5753('0x30'))[_0x5753('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no',_0x5753('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':_0x5753('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no',_0x5753('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x5753('0x33'),_0x5753('0x34'),_0x5753('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x36'),'uas'),'allowNull':!![],'defaultValue':_0x5753('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':_0x5753('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5753('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x5753('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5753('0xd')]('yes','no',_0x5753('0x38'),_0x5753('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5753('0xd')]('active',_0x5753('0x3a'),_0x5753('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5753('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5753('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5753('0xd')](_0x5753('0x28'),'no',_0x5753('0x25'),_0x5753('0x26'),_0x5753('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5753('0x6')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x5753('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5753('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x37043f){this[_0x5753('0x4')]('showWebBar',_0x37043f);var _0x5c1902=this[_0x5753('0x3e')]({'plain':!![]});switch(_0x37043f){case 0x0:case 0x1:var _0x59f5ef=_0x5c1902[_0x5753('0x1e')]?_[_0x5753('0x3f')](_0x5c1902[_0x5753('0x1e')])?_0x5c1902[_0x5753('0x1e')]['join']():_0x5c1902[_0x5753('0x1e')]:'udp';if(_0x59f5ef===_0x5753('0x40')){_0x59f5ef=_0x5753('0x41');}this[_0x5753('0x4')](_0x5753('0x1e'),_0x59f5ef);this[_0x5753('0x4')]('encryption','no');this['setDataValue'](_0x5753('0x42'),null);this[_0x5753('0x4')](_0x5753('0x43'),null);this['setDataValue']('icesupport',null);this[_0x5753('0x4')](_0x5753('0x44'),null);this[_0x5753('0x4')]('dtlsverify',null);this['setDataValue'](_0x5753('0x45'),null);this['setDataValue'](_0x5753('0x46'),null);this[_0x5753('0x4')]('dtlsprivatekey',null);this[_0x5753('0x4')](_0x5753('0x47'),'no');break;case 0x2:this['setDataValue']('transport',_0x5753('0x40'));this[_0x5753('0x4')]('encryption',_0x5753('0x28'));this['setDataValue']('avpf',_0x5753('0x28'));this[_0x5753('0x4')](_0x5753('0x43'),_0x5753('0x28'));this['setDataValue'](_0x5753('0x48'),_0x5753('0x28'));this[_0x5753('0x4')](_0x5753('0x44'),_0x5753('0x28'));this[_0x5753('0x4')](_0x5753('0x49'),'no');this[_0x5753('0x4')](_0x5753('0x45'),_0x5753('0x3b'));this[_0x5753('0x4')](_0x5753('0x46'),_0x5c1902[_0x5753('0x46')]||_0x5753('0x4a'));this[_0x5753('0x4')](_0x5753('0x4b'),_0x5c1902[_0x5753('0x4b')]||_0x5753('0x4c'));this['setDataValue']('rtcp_mux',_0x5753('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x5753('0x3d')],'set':function(_0x1a60f4){this['setDataValue'](_0x5753('0x4d'),_0x1a60f4?_0x1a60f4['join'](','):[]);},'get':function(){return this[_0x5753('0xa')]('permissions')?_[_0x5753('0x4e')](this[_0x5753('0xa')](_0x5753('0x4d'))[_0x5753('0x20')](','),function(_0x194a5d){return parseInt(_0x194a5d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5753('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5753('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5753('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5753('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5753('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x5753('0x4f'))?this['getDataValue'](_0x5753('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5753('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![],'set':function(_0x5ed30f){if(typeof _0x5ed30f===_0x5753('0x50')){var _0x5d2fc5=_0x5ed30f==='1'?!![]:_0x5ed30f==='0'?![]:_0x5ed30f===_0x5753('0x51')?!![]:_0x5ed30f===_0x5753('0x52')?![]:![];this[_0x5753('0x4')](_0x5753('0x53'),_0x5d2fc5);}else{this[_0x5753('0x4')](_0x5753('0x53'),_0x5ed30f);}}},'blocked':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![],'set':function(_0x158b66){this['setDataValue'](_0x5753('0x54'),_0x158b66);if(_0x158b66===!![]){this[_0x5753('0x4')](_0x5753('0x55'),moment());this['setDataValue'](_0x5753('0x56'),0x0);}else{this['setDataValue'](_0x5753('0x55'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5753('0x10')](0x5)[_0x5753('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5753('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x5753('0x10')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x5753('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 50cbac5..125e4b9 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 _0x21f3=['email','permissions','101','102','103','113','110','106','108','109','100','111','114','115','create','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','VoiceMail','UserProfileSection','userProfileId','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','Telephones','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','toLowerCase','Queues','capitalize','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','emit','Queue:remove','addAvatar','userpic','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','hasOwnProperty','CmList','List','Tags','color','tag','getQueues','model','keys','filters','intersection','fields','order','sort','where','merge','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','pick','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','forEach','pause','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','transaction','getAssociatedQueues','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','CmHopper','$gt','$lt','$lte','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','toString','lower','col','asc','desc','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','path','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','./user.socket','redis','localhost','sendStatus','status','undefined','limit','count','offset','Content-Range','json','update','then','agent','destroy','get','role','admin','user','Agents','telephone','filter','ignore','value','includes','find','name','UserProfileResource','error','User','rawAttributes','map','fieldName','type','password','salt','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','query','include','UserSetting','userSetting','attributes','push','findAll','rows','true','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','catch','show','params','includeAll','options','openTabs','all','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','QueryTypes','SELECT','from','fullname'];(function(_0x5824ea,_0x1fbc62){var _0x4a9ee0=function(_0x2d25bc){while(--_0x2d25bc){_0x5824ea['push'](_0x5824ea['shift']());}};_0x4a9ee0(++_0x1fbc62);}(_0x21f3,0x11a));var _0x321f=function(_0x3acd52,_0x37e1ab){_0x3acd52=_0x3acd52-0x0;var _0x5af6b5=_0x21f3[_0x3acd52];return _0x5af6b5;};'use strict';var moment=require(_0x321f('0x0'));var util=require('util');var path=require(_0x321f('0x1'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0x321f('0x2'));var authService=require(_0x321f('0x3'));var contacts=require(_0x321f('0x4'));var qs=require(_0x321f('0x5'));var rta=require('../../components/realtime/agents');var logger=require(_0x321f('0x6'))(_0x321f('0x7'));var utils=require(_0x321f('0x8'));var config=require(_0x321f('0x9'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x321f('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0x321f('0xa'))[_0x321f('0xb')];var APIForbiddenError=require(_0x321f('0xa'))[_0x321f('0xc')];var APIHandleError=require('../../errors/api')[_0x321f('0xd')];var db=require(_0x321f('0xe'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x321f('0xf'))['register'](socket);config[_0x321f('0x10')]=_['defaults'](config[_0x321f('0x10')],{'host':_0x321f('0x11'),'port':0x18eb});var values;function respondWithStatusCode(_0x111434,_0x3ea6e0){_0x3ea6e0=_0x3ea6e0||0xcc;return function(_0x5afdd2){if(_0x5afdd2){return _0x111434[_0x321f('0x12')](_0x3ea6e0);}return _0x111434['status'](_0x3ea6e0)['end']();};}function respondWithResult(_0x1c8c2e,_0x152cf8){_0x152cf8=_0x152cf8||0xc8;return function(_0x476b5b){if(_0x476b5b){return _0x1c8c2e[_0x321f('0x13')](_0x152cf8)['json'](_0x476b5b);}};}function respondWithFilteredResult(_0xa198da,_0x35dfdc){return function(_0x574f8b){if(_0x574f8b){var _0x3d01d7=typeof _0x35dfdc['offset']===_0x321f('0x14')&&typeof _0x35dfdc[_0x321f('0x15')]===_0x321f('0x14');var _0x1c1cf1=_0x574f8b[_0x321f('0x16')];var _0x2b2ae7=_0x3d01d7?0x0:_0x35dfdc['offset'];var _0x2175b1=_0x3d01d7?_0x574f8b[_0x321f('0x16')]:_0x35dfdc[_0x321f('0x17')]+_0x35dfdc[_0x321f('0x15')];var _0x4fb061;if(_0x2175b1>=_0x1c1cf1){_0x2175b1=_0x1c1cf1;_0x4fb061=0xc8;}else{_0x4fb061=0xce;}_0xa198da[_0x321f('0x13')](_0x4fb061);return _0xa198da['set'](_0x321f('0x18'),_0x2b2ae7+'-'+_0x2175b1+'/'+_0x1c1cf1)[_0x321f('0x19')](_0x574f8b);}return null;};}function saveUpdates(_0x4a5663){return function(_0x100ada){if(_0x100ada){return _0x100ada[_0x321f('0x1a')](_0x4a5663)[_0x321f('0x1b')](function(_0x55a009){if(_0x55a009['role']===_0x321f('0x1c')){socket['emit']('userNotification:recalc:'+_0x55a009['id'],_0x55a009);}return _0x55a009;});}return null;};}function removeEntity(_0x2a0506,_0xbc4e18){return function(_0x4ea9d1){if(_0x4ea9d1){return _0x4ea9d1[_0x321f('0x1d')]({'transaction':_0xbc4e18})[_0x321f('0x1b')](function(){var _0x3ff686=_0x4ea9d1[_0x321f('0x1e')]({'plain':!![]});if(_0x3ff686[_0x321f('0x1f')]===_0x321f('0x20'))return;var _0x1cf171=[{'name':'Users','value':_0x321f('0x21'),'ignore':!![]},{'name':_0x321f('0x22'),'value':_0x321f('0x1c'),'ignore':![]},{'name':'Telephones','value':_0x321f('0x23'),'ignore':![]}];var _0x48c1e4=_(_0x1cf171)[_0x321f('0x24')](_0x321f('0x25'))['map'](_0x321f('0x26'))['value']();if(_[_0x321f('0x27')](_0x48c1e4,_0x3ff686['role'])){return;}var _0x4d8812=_[_0x321f('0x28')](_0x1cf171,[_0x321f('0x26'),_0x3ff686[_0x321f('0x1f')]])[_0x321f('0x29')];return db[_0x321f('0x2a')][_0x321f('0x1d')]({'where':{'type':_0x4d8812,'resourceId':_0x3ff686['id']},'transaction':_0xbc4e18})[_0x321f('0x1b')](function(){return _0x4ea9d1;});})['then'](function(){_0x2a0506[_0x321f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186852){return function(_0x1951c1){if(!_0x1951c1){_0x186852[_0x321f('0x12')](0x194);}return _0x1951c1;};}function handleError(_0x18056a,_0x18f9e5){_0x18f9e5=_0x18f9e5||0x1f4;return function(_0x28dc20){logger[_0x321f('0x2b')](_0x28dc20['stack']);if(_0x28dc20[_0x321f('0x29')]){delete _0x28dc20[_0x321f('0x29')];}_0x18056a[_0x321f('0x13')](_0x18f9e5)['send'](_0x28dc20);};}function getUserAttributes(){return _(db[_0x321f('0x2c')][_0x321f('0x2d')])[_0x321f('0x2e')](function(_0x2bcca5){return{'name':_0x2bcca5[_0x321f('0x2f')],'type':_0x2bcca5[_0x321f('0x30')]['key']};})[_0x321f('0x24')](function(_0x4934e9){return![_0x321f('0x31'),_0x321f('0x32'),_0x321f('0x33'),'resetPasswordToken',_0x321f('0x34'),_0x321f('0x35')]['includes'](_0x4934e9[_0x321f('0x29')]);})[_0x321f('0x26')]();}exports[_0x321f('0x36')]=function(_0x32e2bf,_0x1e4848){var _0x5725a5={},_0xafbe4a={'count':0x0,'rows':[]};var _0xd22b46=getUserAttributes();_0x5725a5=qs[_0x321f('0x37')](_0xd22b46,_0x32e2bf);var _0x319b81={'where':_0x5725a5['where']};return db['User'][_0x321f('0x16')](_0x319b81)[_0x321f('0x1b')](function(_0x526429){_0xafbe4a['count']=_0x526429;if(_0x32e2bf[_0x321f('0x38')]['includeAll']){_0x5725a5[_0x321f('0x39')]=[{'all':!![]}];}if(_0x32e2bf[_0x321f('0x38')]['userSetting']==='true'){_0x5725a5[_0x321f('0x39')]=[{'model':db[_0x321f('0x3a')],'as':_0x321f('0x3b')}];}if(!_[_0x321f('0x27')](_0x5725a5[_0x321f('0x3c')],'id')){_0x5725a5[_0x321f('0x3c')][_0x321f('0x3d')]('id');}return db[_0x321f('0x2c')][_0x321f('0x3e')](_0x5725a5);})[_0x321f('0x1b')](function(_0x6b047e){_0xafbe4a[_0x321f('0x3f')]=_0x6b047e;if(_0x32e2bf[_0x321f('0x38')]['openTabs']===_0x321f('0x40')){var _0x269be8=[];for(var _0x352f56=0x0;_0x352f56<_0xafbe4a[_0x321f('0x3f')][_0x321f('0x41')];_0x352f56++){_0x269be8[_0x321f('0x3d')](get_open_tabs(_0x321f('0x42'),_0xafbe4a[_0x321f('0x3f')][_0x352f56][_0x321f('0x43')]));_0x269be8[_0x321f('0x3d')](get_open_tabs(_0x321f('0x44'),_0xafbe4a[_0x321f('0x3f')][_0x352f56][_0x321f('0x43')]));_0x269be8[_0x321f('0x3d')](get_open_tabs(_0x321f('0x45'),_0xafbe4a[_0x321f('0x3f')][_0x352f56][_0x321f('0x43')]));_0x269be8[_0x321f('0x3d')](get_open_tabs(_0x321f('0x46'),_0xafbe4a[_0x321f('0x3f')][_0x352f56]['dataValues']));_0x269be8['push'](get_open_tabs(_0x321f('0x47'),_0xafbe4a[_0x321f('0x3f')][_0x352f56][_0x321f('0x43')]));_0x269be8[_0x321f('0x3d')](get_open_tabs(_0x321f('0x48'),_0xafbe4a[_0x321f('0x3f')][_0x352f56][_0x321f('0x43')]));}return Promise['all'](_0x269be8)[_0x321f('0x1b')](function(){return _0xafbe4a;});}else{return _0xafbe4a;}})[_0x321f('0x1b')](respondWithFilteredResult(_0x1e4848,_0x5725a5))[_0x321f('0x49')](handleError(_0x1e4848,null));};exports[_0x321f('0x4a')]=function(_0x427a03,_0x266bcf){var _0x17c5da=getUserAttributes();_0x427a03['query']['id']=_0x427a03[_0x321f('0x4b')]['id'];var _0x4e11a7=qs[_0x321f('0x37')](_0x17c5da,_0x427a03);if(_0x427a03[_0x321f('0x38')][_0x321f('0x4c')]){_0x4e11a7['include']=[{'all':!![]}];}if(_0x427a03[_0x321f('0x38')][_0x321f('0x3b')]==='true'){_0x4e11a7[_0x321f('0x39')]=[{'model':db['UserSetting'],'as':_0x321f('0x3b')}];}_0x4e11a7=_['merge']({},_0x4e11a7,_0x427a03[_0x321f('0x4d')]);if(!_[_0x321f('0x27')](_0x4e11a7[_0x321f('0x3c')],'id')){_0x4e11a7['attributes'][_0x321f('0x3d')]('id');}return db[_0x321f('0x2c')]['find'](_0x4e11a7)[_0x321f('0x1b')](handleEntityNotFound(_0x266bcf,null))['then'](function(_0x45e68f){var _0x1a8e03=[];values=_0x45e68f;if(_0x427a03['query'][_0x321f('0x4e')]===_0x321f('0x40')){_0x1a8e03['push'](get_open_tabs(_0x321f('0x42'),_0x45e68f[_0x321f('0x43')]));_0x1a8e03[_0x321f('0x3d')](get_open_tabs('sms',_0x45e68f[_0x321f('0x43')]));_0x1a8e03['push'](get_open_tabs(_0x321f('0x47'),_0x45e68f['dataValues']));_0x1a8e03[_0x321f('0x3d')](get_open_tabs(_0x321f('0x48'),_0x45e68f['dataValues']));_0x1a8e03[_0x321f('0x3d')](get_open_tabs(_0x321f('0x45'),_0x45e68f[_0x321f('0x43')]));_0x1a8e03[_0x321f('0x3d')](get_open_tabs(_0x321f('0x46'),_0x45e68f[_0x321f('0x43')]));return Promise[_0x321f('0x4f')](_0x1a8e03);}else{return values;}})['then'](function(){return values;})[_0x321f('0x1b')](respondWithResult(_0x266bcf,null))[_0x321f('0x49')](handleError(_0x266bcf,null));};exports['update']=function(_0x3990d1,_0x539af4){if(_0x3990d1[_0x321f('0x50')]['id']){delete _0x3990d1['body']['id'];}delete _0x3990d1[_0x321f('0x50')]['role'];return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x3990d1[_0x321f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x539af4,null))[_0x321f('0x1b')](saveUpdates(_0x3990d1[_0x321f('0x50')],null))[_0x321f('0x1b')](respondWithResult(_0x539af4,null))[_0x321f('0x49')](handleError(_0x539af4,null));};exports['describe']=function(_0x1b1a6f,_0x21ff2c){return db[_0x321f('0x2c')][_0x321f('0x51')]()[_0x321f('0x1b')](respondWithResult(_0x21ff2c,null))[_0x321f('0x49')](handleError(_0x21ff2c,null));};exports[_0x321f('0x52')]=function(_0x319c7e,_0x238dd1){return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x319c7e['params']['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x238dd1,null))[_0x321f('0x1b')](function(_0x3f5378){if(_0x3f5378){return _0x3f5378[_0x321f('0x52')](_0x319c7e[_0x321f('0x50')][_0x321f('0x53')],_[_0x321f('0x54')](_0x319c7e[_0x321f('0x50')],[_0x321f('0x53'),'id'])||{});}})[_0x321f('0x1b')](respondWithResult(_0x238dd1,null))[_0x321f('0x49')](handleError(_0x238dd1,null));};function validateUser(_0xded1be){return new Promise(function(_0x166852,_0x15bfd2){if(_0xded1be[_0x321f('0x55')])return _0x166852(_0xded1be);return db[_0x321f('0x56')]['findById'](0x1)[_0x321f('0x1b')](function(_0x2e770a){if(_0x2e770a[_0x321f('0x57')])authService[_0x321f('0x58')](_0xded1be[_0x321f('0x31')]);db[_0x321f('0x2c')]['max']('internal')[_0x321f('0x1b')](function(_0x480009){if(_[_0x321f('0x59')](_0x480009)){_0xded1be['internal']=_0x2e770a[_0x321f('0x5a')]||0x1;return;}if(_[_0x321f('0x59')](_0x2e770a['min_internal'])||_0x2e770a[_0x321f('0x5a')]===_0x480009){_0xded1be[_0x321f('0x55')]=_0x480009+0x1;return;}if(_0x2e770a[_0x321f('0x5a')]>_0x480009){_0xded1be['internal']=_0x2e770a['min_internal'];return;}return db[_0x321f('0x5b')]['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[_0x321f('0x5b')][_0x321f('0x5c')][_0x321f('0x5d')]})[_0x321f('0x1b')](function(_0x16daa4){if(_0x16daa4&&_0x16daa4[_0x321f('0x41')]){for(var _0x39291f=0x0,_0x38c2d6=_0x16daa4['length'];_0x39291f<_0x38c2d6&&_[_0x321f('0x59')](_0xded1be['internal']);_0x39291f++){if(_0x2e770a[_0x321f('0x5a')]<=_0x16daa4[_0x39291f]['from']){_0xded1be[_0x321f('0x55')]=_0x16daa4[_0x39291f]['from'];}else if(_0x2e770a[_0x321f('0x5a')]>_0x16daa4[_0x39291f][_0x321f('0x5e')]&&_0x2e770a[_0x321f('0x5a')]<=_0x16daa4[_0x39291f]['to']){_0xded1be[_0x321f('0x55')]=_0x2e770a['min_internal'];}}}if(_[_0x321f('0x59')](_0xded1be['internal'])){_0xded1be[_0x321f('0x55')]=_0x480009+0x1;}return _0x166852(_0xded1be);});});})[_0x321f('0x49')](function(_0x3ecf03){_0x15bfd2(_0x3ecf03);});});}function updateUser(_0x20d499){return new Promise(function(_0x2db0db,_0x2b9c27){try{if(_0x20d499['voicemail']){_0x20d499['mailbox']=_0x20d499['internal'];_0x20d499['VoiceMail']={'mailbox':_0x20d499[_0x321f('0x55')],'password':_0x20d499['password'],'fullname':_0x20d499[_0x321f('0x5f')],'email':_0x20d499[_0x321f('0x60')]};}if(_0x20d499[_0x321f('0x1f')]===_0x321f('0x1c')){if(!_0x20d499[_0x321f('0x61')])_0x20d499[_0x321f('0x61')]=[_0x321f('0x62'),_0x321f('0x63'),_0x321f('0x64'),_0x321f('0x65'),_0x321f('0x66'),'104','105',_0x321f('0x67'),'107',_0x321f('0x68'),_0x321f('0x69'),_0x321f('0x6a'),_0x321f('0x6b'),_0x321f('0x6c'),_0x321f('0x6d')];}_0x2db0db(_0x20d499);}catch(_0x31b7cd){_0x2b9c27(_0x31b7cd);}});}exports[_0x321f('0x6e')]=function(_0x2dde65,_0x554160){if(_0x2dde65[_0x321f('0x21')][_0x321f('0x1f')]===_0x321f('0x1c'))throw new Error('Unauthorized');if(_0x2dde65['body']['role']===_0x321f('0x21')&&_0x2dde65[_0x321f('0x21')][_0x321f('0x1f')]!==_0x321f('0x20')){throw new Error(_0x321f('0x6f'));}if(_0x2dde65['body'][_0x321f('0x1f')]===_0x321f('0x20')&&_0x2dde65[_0x321f('0x21')][_0x321f('0x1f')]!=='admin'){throw new Error(_0x321f('0x70'));}return licenseUtil[_0x321f('0x71')]([_0x2dde65[_0x321f('0x50')]])[_0x321f('0x1b')](function(){return validateUser(_0x2dde65[_0x321f('0x50')]);})['then'](function(_0x564885){return updateUser(_0x564885)['then'](function(_0x486661){if(_0x486661[_0x321f('0x1f')]==='admin'){_0x486661[_0x321f('0x72')]=_0x2dde65[_0x321f('0x21')][_0x321f('0x72')];delete _0x486661['userProfileId'];}return _0x486661;});})[_0x321f('0x1b')](function(_0x37ddad){return db[_0x321f('0x2c')][_0x321f('0x6e')](_0x37ddad,{'include':[{'model':db[_0x321f('0x73')],'as':_0x321f('0x73')}]});})[_0x321f('0x1b')](function(_0x3916bb){if(_0x2dde65[_0x321f('0x50')][_0x321f('0x1f')]===_0x321f('0x21'))return _0x3916bb;if(_0x2dde65[_0x321f('0x21')]['role']!=='user')return _0x3916bb;return db[_0x321f('0x74')][_0x321f('0x28')]({'where':{'name':_0x3916bb[_0x321f('0x1f')]===_0x321f('0x1c')?_0x321f('0x22'):'Telephones','userProfileId':_0x2dde65[_0x321f('0x21')][_0x321f('0x75')]},'raw':!![]})[_0x321f('0x1b')](function(_0x4de43f){if(!_0x4de43f||_0x4de43f['autoAssociation']!=0x0)return _0x3916bb;return db[_0x321f('0x2a')][_0x321f('0x6e')]({'name':_0x3916bb[_0x321f('0x29')],'resourceId':_0x3916bb['id'],'type':_0x4de43f[_0x321f('0x29')],'sectionId':_0x4de43f['id']},{})[_0x321f('0x1b')](function(){return _0x3916bb;});})[_0x321f('0x49')](function(_0x29afbd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29afbd);throw _0x29afbd;});})[_0x321f('0x1b')](respondWithResult(_0x554160,0xc9))[_0x321f('0x49')](handleError(_0x554160,null));};exports[_0x321f('0x76')]=function(_0x3b50c0,_0x58c000){var _0x441477=_0x3b50c0[_0x321f('0x50')];var _0xca9436=[];if(_0x3b50c0[_0x321f('0x21')][_0x321f('0x1f')]==='agent')throw new Error('Unauthorized');if(_[_0x321f('0x77')](_0x441477,[_0x321f('0x1f'),_0x321f('0x21')])&&_0x3b50c0['user']['role']!=='admin'){throw new Error(_0x321f('0x6f'));}if(_[_0x321f('0x77')](_0x441477,[_0x321f('0x1f'),_0x321f('0x20')])&&_0x3b50c0[_0x321f('0x21')][_0x321f('0x1f')]!==_0x321f('0x20')){throw new Error(_0x321f('0x78'));}return licenseUtil[_0x321f('0x71')](_0x441477)['then'](function(){return validateUser(_0x441477[0x0]);})[_0x321f('0x1b')](function(){for(var _0x5a08fc=0x1;_0x5a08fc<_0x441477['length'];_0x5a08fc++){var _0x3b5300=_0x441477[_0x5a08fc-0x1][_0x321f('0x55')];if(!_0x441477[_0x5a08fc][_0x321f('0x55')])_0x441477[_0x5a08fc][_0x321f('0x55')]=_0x3b5300+0x1;_0xca9436[_0x321f('0x3d')](validateUser(_0x441477[_0x5a08fc]));}return Promise[_0x321f('0x4f')](_0xca9436);})[_0x321f('0x1b')](function(){_0xca9436=[];for(var _0x460ee1=0x0;_0x460ee1<_0x441477['length'];_0x460ee1++){_0xca9436[_0x321f('0x3d')](updateUser(_0x441477[_0x460ee1]));}return Promise[_0x321f('0x4f')](_0xca9436);})['then'](function(){_0xca9436=_0x441477[_0x321f('0x2e')](function(_0x3d7311){return db[_0x321f('0x2c')][_0x321f('0x6e')](_0x3d7311,{'include':[{'model':db[_0x321f('0x73')],'as':_0x321f('0x73')}]})[_0x321f('0x1b')](function(_0x204211){_0x3d7311['id']=_0x204211['id'];return _0x3d7311;});});return Promise[_0x321f('0x4f')](_0xca9436);})[_0x321f('0x1b')](function(_0x5c39b1){if(_0x3b50c0['body'][_0x321f('0x1f')]===_0x321f('0x21'))return _0x5c39b1;if(_0x3b50c0['user'][_0x321f('0x1f')]!==_0x321f('0x21'))return _0x5c39b1;var _0x1a4e6f=_['some'](_0x5c39b1,function(_0x1fc499){return _0x1fc499[_0x321f('0x1f')]===_0x321f('0x1c')||_0x1fc499[_0x321f('0x1f')]===_0x321f('0x23');});if(!_0x1a4e6f)return _0x5c39b1;return db[_0x321f('0x74')][_0x321f('0x3e')]({'where':{'name':{'$or':[_0x321f('0x22'),_0x321f('0x79')]},'userProfileId':_0x3b50c0[_0x321f('0x21')][_0x321f('0x75')]},'raw':!![]})[_0x321f('0x1b')](function(_0x5f1b50){if(_[_0x321f('0x7a')](_0x5f1b50)||!_[_0x321f('0x77')](_0x5f1b50,[_0x321f('0x7b'),0x0]))return _0x5c39b1;_0xca9436=[];var _0x1086d0=_(_0x5f1b50)[_0x321f('0x2e')](function(_0x53fb14){if(_0x53fb14[_0x321f('0x7b')]===0x1)return;return _0x53fb14['name']===_0x321f('0x22')?'agent':_0x321f('0x23');})[_0x321f('0x7c')]()[_0x321f('0x26')]();for(var _0xdc2bda=0x0;_0xdc2bda<_0x5c39b1[_0x321f('0x41')];_0xdc2bda++){if(!_[_0x321f('0x27')](_0x1086d0,_0x5c39b1[_0xdc2bda]['role']))return;var _0x2bc2af=_0x5c39b1[_0xdc2bda][_0x321f('0x1f')]===_0x321f('0x1c')?_0x321f('0x22'):'Telephones';_0xca9436[_0x321f('0x3d')](db[_0x321f('0x2a')][_0x321f('0x6e')]({'name':_0x5c39b1[_0xdc2bda]['name'],'resourceId':_0x5c39b1[_0xdc2bda]['id'],'type':_0x2bc2af,'sectionId':_[_0x321f('0x28')](_0x5f1b50,['name',_0x2bc2af])['id']},{}));}return Promise[_0x321f('0x4f')](_0xca9436);});})['then'](respondWithResult(_0x58c000,0xc9))['catch'](handleError(_0x58c000,null));};exports[_0x321f('0x7d')]=function(_0x36b185,_0x3c15b8){if(_0x36b185[_0x321f('0x50')]['id']){delete _0x36b185[_0x321f('0x50')]['id'];}return db['User']['find']({'where':{'id':_0x36b185[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](function(_0x38ae17){if(!_0x38ae17)return null;if(_0x38ae17['id']===_0x36b185[_0x321f('0x21')]['id']){if(!_0x36b185[_0x321f('0x50')][_0x321f('0x7e')]||!_0x36b185[_0x321f('0x50')][_0x321f('0x7f')]){throw new db[(_0x321f('0x80'))][(_0x321f('0x81'))](_0x321f('0x82'));}if(!_0x38ae17[_0x321f('0x83')](_0x36b185[_0x321f('0x50')]['oldPassword'])){throw new db[(_0x321f('0x80'))][(_0x321f('0x81'))](_0x321f('0x84'));}if(_0x36b185[_0x321f('0x50')][_0x321f('0x7e')]===_0x36b185[_0x321f('0x50')][_0x321f('0x7f')]){throw new db[(_0x321f('0x80'))][(_0x321f('0x81'))](_0x321f('0x85'));}}else if(_0x36b185['user'][_0x321f('0x1f')]===_0x321f('0x20')){if(!_0x36b185[_0x321f('0x50')][_0x321f('0x7f')]){throw new db['Sequelize']['ValidationError'](_0x321f('0x86'));}}else if(_0x36b185[_0x321f('0x21')][_0x321f('0x1f')]===_0x321f('0x21')){if(!_0x36b185[_0x321f('0x50')][_0x321f('0x7f')]){throw new db[(_0x321f('0x80'))][(_0x321f('0x81'))](_0x321f('0x86'));}if(_0x38ae17[_0x321f('0x1f')]!=='agent'){throw new db[(_0x321f('0x80'))][(_0x321f('0x81'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x321f('0x81'))](_0x321f('0x87'));}return _0x38ae17;})['then'](handleEntityNotFound(_0x3c15b8,null))[_0x321f('0x1b')](function(_0x48c10a){return db[_0x321f('0x56')][_0x321f('0x88')]({'attributes':['id',_0x321f('0x57'),_0x321f('0x89'),_0x321f('0x8a')]})['then'](function(_0x571486){if(_0x571486[_0x321f('0x57')])authService[_0x321f('0x58')](_0x36b185[_0x321f('0x50')][_0x321f('0x7f')]);if(!_0x571486['enforcePasswordHistory']||!_0x48c10a[_0x321f('0x33')])return _0x48c10a;authService[_0x321f('0x8b')](_0x36b185['body']['newPassword'],_0x48c10a[_0x321f('0x33')],_0x571486[_0x321f('0x8a')]);return _0x48c10a;})[_0x321f('0x1b')](saveUpdates({'password':_0x36b185[_0x321f('0x50')][_0x321f('0x7f')],'passwordResetAt':_0x36b185[_0x321f('0x21')]['id']==_0x36b185['params']['id']?moment():null,'previousPasswords':authService[_0x321f('0x8c')](_0x36b185[_0x321f('0x50')][_0x321f('0x7f')],_0x48c10a['previousPasswords'])},null));})['then'](respondWithResult(_0x3c15b8,null))[_0x321f('0x49')](handleError(_0x3c15b8,null));};exports[_0x321f('0x8d')]=function(_0x1e17dd,_0x2027bd){var _0x2d45ce=_0x1e17dd['body'][_0x321f('0x8e')];return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x1e17dd['params']['id']},'attributes':['id',_0x321f('0x29'),'role',_0x321f('0x8f'),_0x321f('0x90'),_0x321f('0x91'),_0x321f('0x92')]})[_0x321f('0x1b')](handleEntityNotFound(_0x2027bd,null))[_0x321f('0x1b')](function(_0x2cc4ce){if(_0x2cc4ce){if(!utils[_0x321f('0x93')](_0x2d45ce)){throw new db['Sequelize'][(_0x321f('0x81'))](_0x321f('0x94'));}return _0x2cc4ce['add'+_['capitalize'](_0x2d45ce[_0x321f('0x95')]())+_0x321f('0x96')](_0x1e17dd[_0x321f('0x50')]['ids'],{'penalty':_0x1e17dd['body']['penalty']||0x0})['spread'](function(_0x314e35){for(var _0x47eab8=0x0;_0x47eab8<_0x1e17dd['body'][_0x321f('0x53')][_0x321f('0x41')];_0x47eab8+=0x1){var _0x51778a={'UserId':Number(_0x1e17dd[_0x321f('0x4b')]['id'])};_0x51778a[_[_0x321f('0x97')](_0x2d45ce[_0x321f('0x95')]())+_0x321f('0x98')]=Number(_0x1e17dd[_0x321f('0x50')][_0x321f('0x53')][_0x47eab8]);socket['emit'](_0x321f('0x21')+_[_0x321f('0x97')](_0x2d45ce['toLowerCase']())+_0x321f('0x99'),_0x51778a);}return _0x314e35;})[_0x321f('0x1b')](function(){if(_0x2d45ce===_0x321f('0x9a')){return db[_0x321f('0x9b')][_0x321f('0x3e')]({'where':{'id':_0x1e17dd['body'][_0x321f('0x53')]||[]},'raw':!![],'attributes':['id',_0x321f('0x29')]});}})['then'](function(_0x44577d){var _0x5f217b=_0x2cc4ce['get']({'plain':!![]});var _0x57fa89=[];if(_0x2d45ce==='voice'&&_0x5f217b[_0x321f('0x1f')]===_0x321f('0x1c')&&_0x5f217b[_0x321f('0x8f')]){for(let _0xef1b34=0x0;_0xef1b34<_0x44577d[_0x321f('0x41')];_0xef1b34+=0x1){_0x57fa89[_0x321f('0x3d')]({'membername':_0x5f217b[_0x321f('0x29')],'UserId':_0x5f217b['id'],'queue_name':_0x44577d[_0xef1b34][_0x321f('0x29')],'VoiceQueueId':_0x44577d[_0xef1b34]['id'],'interface':_[_0x321f('0x59')](_0x5f217b[_0x321f('0x92')])?util[_0x321f('0x9c')](_0x321f('0x9d'),_0x5f217b[_0x321f('0x29')]):_0x5f217b[_0x321f('0x92')],'paused':_0x5f217b['voicePause']||![],'penalty':_0x1e17dd[_0x321f('0x50')][_0x321f('0x9e')]||0x0});}return Promise[_0x321f('0x4f')](_0x57fa89[_0x321f('0x2e')](function(_0x5f297b){return db[_0x321f('0x9f')][_0x321f('0xa0')](_0x5f297b);}));}return _0x2cc4ce;});}})[_0x321f('0x1b')](respondWithStatusCode(_0x2027bd,null))[_0x321f('0x49')](handleError(_0x2027bd,null));};exports[_0x321f('0xa1')]=function(_0x39ae9b,_0x477845){var _0x341804,_0x16bc2d;return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x39ae9b[_0x321f('0x4b')]['id']},'attributes':['id',_0x321f('0x29'),_0x321f('0x1f')]})['then'](handleEntityNotFound(_0x477845,null))[_0x321f('0x1b')](function(_0x5a2906){if(_0x5a2906){_0x341804=_0x5a2906;if(!_0x39ae9b[_0x321f('0x38')]['channel']||!utils[_0x321f('0x93')](_0x39ae9b[_0x321f('0x38')][_0x321f('0x8e')])){throw new db['Sequelize'][(_0x321f('0x81'))](_0x321f('0x94'));}return _0x5a2906[_0x321f('0xa2')+_[_0x321f('0x97')](_0x39ae9b[_0x321f('0x38')][_0x321f('0x8e')]['toLowerCase']())+_0x321f('0x96')](_0x39ae9b[_0x321f('0x38')][_0x321f('0x53')]);}})[_0x321f('0x1b')](function(_0x2363ec){if(_[_0x321f('0xa3')](_0x39ae9b[_0x321f('0x38')]['ids'])){for(var _0x454aff=0x0;_0x454aff<_0x39ae9b[_0x321f('0x38')]['ids'][_0x321f('0x41')];_0x454aff+=0x1){_0x16bc2d={'UserId':Number(_0x39ae9b['params']['id'])};_0x16bc2d[_['capitalize'](_0x39ae9b[_0x321f('0x38')][_0x321f('0x8e')][_0x321f('0x95')]())+_0x321f('0x98')]=Number(_0x39ae9b[_0x321f('0x38')][_0x321f('0x53')][_0x454aff]);socket[_0x321f('0xa4')](_0x321f('0x21')+_['capitalize'](_0x39ae9b['query']['channel'][_0x321f('0x95')]())+_0x321f('0xa5'),_0x16bc2d);}}else{_0x16bc2d={'UserId':Number(_0x39ae9b['params']['id'])};_0x16bc2d[_[_0x321f('0x97')](_0x39ae9b[_0x321f('0x38')][_0x321f('0x8e')]['toLowerCase']())+_0x321f('0x98')]=Number(_0x39ae9b[_0x321f('0x38')]['ids']);socket[_0x321f('0xa4')]('user'+_[_0x321f('0x97')](_0x39ae9b[_0x321f('0x38')]['channel'][_0x321f('0x95')]())+_0x321f('0xa5'),_0x16bc2d);}return _0x2363ec;})[_0x321f('0x1b')](function(){if(_0x39ae9b[_0x321f('0x38')]['channel']===_0x321f('0x9a')){return db[_0x321f('0x9f')]['destroy']({'where':{'UserId':_0x39ae9b[_0x321f('0x4b')]['id'],'VoiceQueueId':_0x39ae9b[_0x321f('0x38')]['ids']},'individualHooks':!![]})[_0x321f('0x1b')](function(){return _0x341804;});}return _0x341804;})[_0x321f('0x1b')](respondWithStatusCode(_0x477845,null))[_0x321f('0x49')](handleError(_0x477845,null));};exports[_0x321f('0xa6')]=function(_0x2ababe,_0x4b2625){_0x2ababe[_0x321f('0x50')][_0x321f('0xa7')]=_0x2ababe['file']['filename'];return db[_0x321f('0x2c')]['find']({'where':{'id':_0x2ababe[_0x321f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b2625,null))[_0x321f('0x1b')](saveUpdates(_0x2ababe[_0x321f('0x50')],null))[_0x321f('0x1b')](respondWithResult(_0x4b2625,null))['catch'](handleError(_0x4b2625,null));};exports[_0x321f('0xa8')]=function(_0x57eeb1,_0x3b43b4){var _0xbf04b0=path['join'](config[_0x321f('0xa9')],_0x321f('0xaa'));return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x57eeb1[_0x321f('0x4b')]['id']},'attributes':['id',_0x321f('0xa7')],'raw':!![]})['then'](handleEntityNotFound(_0x3b43b4,null))[_0x321f('0x1b')](function(_0x129cec){if(_0x129cec){if(_[_0x321f('0x59')](_0x129cec[_0x321f('0xa7')])){return _0x3b43b4[_0x321f('0xab')](_0xbf04b0);}else{if(!fs[_0x321f('0xac')](path[_0x321f('0xad')](config[_0x321f('0xa9')],_0x321f('0xae'),_0x129cec['userpic']))){return _0x3b43b4[_0x321f('0xab')](_0xbf04b0);}return _0x3b43b4[_0x321f('0xab')](path[_0x321f('0xad')](config['root'],_0x321f('0xae'),_0x129cec[_0x321f('0xa7')]));}}})[_0x321f('0x49')](handleError(_0x3b43b4,null));};exports[_0x321f('0xaf')]=function(_0x4d23fb,_0x193cba){return db['User']['find']({'where':{'id':_0x4d23fb[_0x321f('0x4b')]['id']},'attributes':['id']})[_0x321f('0x1b')](handleEntityNotFound(_0x193cba,null))['then'](function(_0x48d72f){var _0x57cad5=[];values=_0x48d72f['dataValues'];_0x57cad5[_0x321f('0x3d')](get_open_tabs('chat',_0x48d72f['dataValues']));_0x57cad5['push'](get_open_tabs('sms',_0x48d72f['dataValues']));_0x57cad5['push'](get_open_tabs('openchannel',_0x48d72f[_0x321f('0x43')]));_0x57cad5[_0x321f('0x3d')](get_open_tabs(_0x321f('0x48'),_0x48d72f[_0x321f('0x43')]));_0x57cad5[_0x321f('0x3d')](get_open_tabs(_0x321f('0x45'),_0x48d72f[_0x321f('0x43')]));_0x57cad5[_0x321f('0x3d')](get_open_tabs('mail',_0x48d72f[_0x321f('0x43')]));return Promise[_0x321f('0x4f')](_0x57cad5);})[_0x321f('0x1b')](function(_0x15f4fb){if(_0x15f4fb){var _0x2d0a1d=_[_0x321f('0x2e')](values[_0x321f('0xb0')],function(_0x1ab626){return{'channel':_0x321f('0xb1'),'id':_0x1ab626['id'],'createdAt':_0x1ab626[_0x321f('0xb2')]};});var _0x5a488b=_[_0x321f('0x2e')](values[_0x321f('0xb3')],function(_0x2a11ae){return{'channel':_0x321f('0xb4'),'id':_0x2a11ae['id'],'createdAt':_0x2a11ae[_0x321f('0xb2')]};});var _0x52e71a=_[_0x321f('0x2e')](values[_0x321f('0xb5')],function(_0x4c2e20){return{'channel':'OPENCHANNEL','id':_0x4c2e20['id'],'createdAt':_0x4c2e20[_0x321f('0xb2')]};});var _0x195c01=_[_0x321f('0x2e')](values[_0x321f('0xb6')],function(_0x11bd78){return{'channel':_0x321f('0xb7'),'id':_0x11bd78['id'],'createdAt':_0x11bd78[_0x321f('0xb2')]};});var _0x2cfa46=_[_0x321f('0x2e')](values['SmsOpenTabs'],function(_0x1fa089){return{'channel':'SMS','id':_0x1fa089['id'],'createdAt':_0x1fa089['createdAt']};});var _0x8ce00d=_['map'](values[_0x321f('0xb8')],function(_0x3995ec){return{'channel':_0x321f('0xb9'),'id':_0x3995ec['id'],'createdAt':_0x3995ec[_0x321f('0xb2')]};});var _0x2e6438=_['concat'](_0x2d0a1d,_0x5a488b,_0x52e71a,_0x195c01,_0x2cfa46,_0x8ce00d);var _0x41c712={'count':_0x2e6438['length'],'rows':_0x2e6438};return _0x41c712;}else return null;})[_0x321f('0x1b')](respondWithResult(_0x193cba,null))['catch'](handleError(_0x193cba,null));};exports['getContacts']=function(_0x394f3f,_0x5ccbb2){var _0x251748={};return db['User'][_0x321f('0x88')]({'where':{'id':_0x394f3f[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](function(_0x5805fb){if(!_0x5805fb){throw new APINotFoundError(util[_0x321f('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x394f3f[_0x321f('0x4b')]['id']));}return contacts[_0x321f('0x51')]();})[_0x321f('0x1b')](function(_0x55da29){_0x394f3f[_0x321f('0x38')]['User']=_0x394f3f[_0x321f('0x4b')]['id'];_0x251748=qs[_0x321f('0x37')](_0x55da29,_0x394f3f);if(_0x394f3f[_0x321f('0x38')][_0x321f('0xba')](_0x321f('0x4c'))){_0x251748[_0x321f('0x39')]=[{'model':db[_0x321f('0xbb')],'as':_0x321f('0xbc'),'required':![]},{'model':db['Tag'],'as':_0x321f('0xbd'),'attributes':['id',_0x321f('0x29'),_0x321f('0xbe')],'where':_0x394f3f[_0x321f('0x38')][_0x321f('0xbf')]?{'id':_0x394f3f[_0x321f('0x38')][_0x321f('0xbf')]}:undefined,'required':_0x394f3f[_0x321f('0x38')][_0x321f('0xbf')]?!![]:![]}];}return contacts[_0x321f('0x3e')](_0x394f3f[_0x321f('0x38')],_0x394f3f[_0x321f('0x21')],_0x251748,_0x55da29);})[_0x321f('0x1b')](respondWithFilteredResult(_0x5ccbb2,_0x251748))[_0x321f('0x49')](APIHandleError(_0x5ccbb2));};exports[_0x321f('0xc0')]=function(_0x1140c6,_0x11604b){var _0x28345d;var _0x4670ab={};var _0x334a94;return db[_0x321f('0x2c')]['findOne']({'where':{'id':_0x1140c6[_0x321f('0x4b')]['id']},'attributes':['id','name','role']})[_0x321f('0x1b')](handleEntityNotFound(_0x11604b,null))['then'](function(_0x5e85ea){if(!utils[_0x321f('0x93')](_0x1140c6[_0x321f('0x38')][_0x321f('0x8e')])){throw new db[(_0x321f('0x80'))][(_0x321f('0x81'))](_0x321f('0x94'));}_0x28345d=_0x5e85ea;var _0xffc477={};_0xffc477[_0x321f('0xc1')]=_['keys'](db[_[_0x321f('0x97')](_0x1140c6[_0x321f('0x38')][_0x321f('0x8e')])+'Queue'][_0x321f('0x2d')]);_0xffc477[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x1140c6['query']);_0xffc477[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0xffc477[_0x321f('0xc1')],_0xffc477[_0x321f('0x38')]);_0x4670ab['attributes']=_['intersection'](_0xffc477[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x1140c6[_0x321f('0x38')][_0x321f('0xc5')]));_0x4670ab[_0x321f('0x3c')]=_0x4670ab[_0x321f('0x3c')][_0x321f('0x41')]?_0x4670ab[_0x321f('0x3c')]:_0xffc477[_0x321f('0xc1')];_0x4670ab[_0x321f('0xc6')]=qs[_0x321f('0xc7')](_0x1140c6[_0x321f('0x38')][_0x321f('0xc7')]);_0x4670ab[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_['pick'](_0x1140c6[_0x321f('0x38')],_0xffc477[_0x321f('0xc3')]));if(_0x1140c6[_0x321f('0x38')][_0x321f('0x24')]){_0x4670ab[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x4670ab[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x4670ab[_0x321f('0x3c')],function(_0x2ee007){var _0x3d61b0={};_0x3d61b0[_0x2ee007]={'$like':'%'+_0x1140c6[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x3d61b0;})});}_0x4670ab=_[_0x321f('0xc9')]({},_0x4670ab,_0x1140c6[_0x321f('0x4d')]);switch(_0x28345d[_0x321f('0x1f')]){case'admin':return db[_['capitalize'](_0x1140c6[_0x321f('0x38')][_0x321f('0x8e')])+_0x321f('0xca')][_0x321f('0x3e')](_0x4670ab);case _0x321f('0x21'):case _0x321f('0x1c'):return _0x28345d[_0x321f('0x1e')+_[_0x321f('0x97')](_0x1140c6[_0x321f('0x38')]['channel'])+'Queues'](_0x4670ab);default:throw new db[(_0x321f('0x80'))]['ValidationError'](_0x321f('0xcb'));}})[_0x321f('0x1b')](function(_0x4417bb){_0x334a94=_0x4417bb[_0x321f('0x41')];if(!_0x1140c6['query'][_0x321f('0xba')](_0x321f('0xcc'))){_0x4670ab[_0x321f('0x15')]=qs['limit'](_0x1140c6[_0x321f('0x38')][_0x321f('0x15')]);_0x4670ab['offset']=qs[_0x321f('0x17')](_0x1140c6['query'][_0x321f('0x17')]);}switch(_0x28345d['role']){case'admin':return db[_[_0x321f('0x97')](_0x1140c6[_0x321f('0x38')][_0x321f('0x8e')])+'Queue'][_0x321f('0x3e')](_0x4670ab);case _0x321f('0x21'):case'agent':return _0x28345d['get'+_['capitalize'](_0x1140c6[_0x321f('0x38')][_0x321f('0x8e')])+_0x321f('0x96')](_0x4670ab);}})[_0x321f('0x1b')](function(_0x319947){return{'count':_0x334a94,'rows':_0x319947};})[_0x321f('0x1b')](respondWithResult(_0x11604b,null))['catch'](handleError(_0x11604b,null));};exports[_0x321f('0xcd')]=function(_0x19efcd,_0x1670d8){var _0x382b60={};var _0x3f9b0b={};var _0x16262f;var _0x3b5be3;return db['User'][_0x321f('0x88')]({'where':{'id':_0x19efcd['params']['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x1670d8,null))[_0x321f('0x1b')](function(_0x113763){if(_0x113763){_0x16262f=_0x113763;_0x3f9b0b[_0x321f('0xc1')]=_[_0x321f('0xc2')](db[_0x321f('0x9f')][_0x321f('0x2d')]);_0x3f9b0b[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x19efcd[_0x321f('0x38')]);_0x3f9b0b[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x3f9b0b[_0x321f('0xc1')],_0x3f9b0b[_0x321f('0x38')]);_0x382b60[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x3f9b0b[_0x321f('0xc1')],qs['fields'](_0x19efcd[_0x321f('0x38')][_0x321f('0xc5')]));_0x382b60[_0x321f('0x3c')]=_0x382b60[_0x321f('0x3c')][_0x321f('0x41')]?_0x382b60['attributes']:_0x3f9b0b[_0x321f('0xc1')];_0x382b60[_0x321f('0xc6')]=qs[_0x321f('0xc7')](_0x19efcd[_0x321f('0x38')][_0x321f('0xc7')]);_0x382b60[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_['pick'](_0x19efcd[_0x321f('0x38')],_0x3f9b0b[_0x321f('0xc3')]));if(_0x19efcd['query'][_0x321f('0x24')]){_0x382b60[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x382b60[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x382b60[_0x321f('0x3c')],function(_0x631e7f){var _0x29c860={};_0x29c860[_0x631e7f]={'$like':'%'+_0x19efcd[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x29c860;})});}_0x382b60=_[_0x321f('0xc9')]({},_0x382b60,_0x19efcd[_0x321f('0x4d')]);return _0x16262f['getVoiceQueuesRt'](_0x382b60);}})[_0x321f('0x1b')](function(_0x40e735){if(_0x40e735){_0x3b5be3=_0x40e735[_0x321f('0x41')];if(!_0x19efcd['query'][_0x321f('0xba')](_0x321f('0xcc'))){_0x382b60['limit']=qs[_0x321f('0x15')](_0x19efcd[_0x321f('0x38')][_0x321f('0x15')]);_0x382b60[_0x321f('0x17')]=qs[_0x321f('0x17')](_0x19efcd[_0x321f('0x38')][_0x321f('0x17')]);}return _0x16262f[_0x321f('0xcd')](_0x382b60);}})[_0x321f('0x1b')](function(_0x3f01dc){if(_0x3f01dc){return _0x3f01dc?{'count':_0x3b5be3,'rows':_0x3f01dc}:null;}})['then'](respondWithResult(_0x1670d8,null))[_0x321f('0x49')](handleError(_0x1670d8,null));};exports[_0x321f('0xce')]=function(_0xb32eb0,_0x3502e0){var _0x45e0fc={};var _0x1a27ea={};var _0x4959af;var _0x533d22;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0xb32eb0[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x3502e0,null))[_0x321f('0x1b')](function(_0x501057){if(_0x501057){_0x4959af=_0x501057;_0x1a27ea[_0x321f('0xc1')]=_[_0x321f('0xc2')](db[_0x321f('0xcf')][_0x321f('0x2d')]);_0x1a27ea['query']=_[_0x321f('0xc2')](_0xb32eb0[_0x321f('0x38')]);_0x1a27ea[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x1a27ea[_0x321f('0xc1')],_0x1a27ea[_0x321f('0x38')]);_0x45e0fc[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x1a27ea[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0xb32eb0[_0x321f('0x38')]['fields']));_0x45e0fc[_0x321f('0x3c')]=_0x45e0fc[_0x321f('0x3c')]['length']?_0x45e0fc[_0x321f('0x3c')]:_0x1a27ea[_0x321f('0xc1')];_0x45e0fc['order']=qs[_0x321f('0xc7')](_0xb32eb0[_0x321f('0x38')][_0x321f('0xc7')]);_0x45e0fc['where']=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0xb32eb0[_0x321f('0x38')],_0x1a27ea['filters']));if(_0xb32eb0['query'][_0x321f('0x24')]){_0x45e0fc[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x45e0fc['where'],{'$or':_[_0x321f('0x2e')](_0x45e0fc[_0x321f('0x3c')],function(_0x5894b5){var _0x504220={};_0x504220[_0x5894b5]={'$like':'%'+_0xb32eb0[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x504220;})});}_0x45e0fc=_[_0x321f('0xc9')]({},_0x45e0fc,_0xb32eb0[_0x321f('0x4d')]);return _0x4959af[_0x321f('0xce')](_0x45e0fc);}})[_0x321f('0x1b')](function(_0x5380ef){if(_0x5380ef){_0x533d22=_0x5380ef[_0x321f('0x41')];if(!_0xb32eb0[_0x321f('0x38')][_0x321f('0xba')](_0x321f('0xcc'))){_0x45e0fc[_0x321f('0x15')]=qs[_0x321f('0x15')](_0xb32eb0[_0x321f('0x38')][_0x321f('0x15')]);_0x45e0fc[_0x321f('0x17')]=qs['offset'](_0xb32eb0[_0x321f('0x38')]['offset']);}return _0x4959af[_0x321f('0xce')](_0x45e0fc);}})[_0x321f('0x1b')](function(_0x3f96b2){if(_0x3f96b2){return _0x3f96b2?{'count':_0x533d22,'rows':_0x3f96b2}:null;}})['then'](respondWithResult(_0x3502e0,null))[_0x321f('0x49')](handleError(_0x3502e0,null));};exports[_0x321f('0xd1')]=function(_0x1c683f,_0x3d905e){var _0x3363cd={'raw':!![],'where':{}};var _0xefabb8={};var _0x264ddf={'count':0x0,'rows':[]};return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x1c683f[_0x321f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d905e,null))[_0x321f('0x1b')](function(_0x5d5e1d){if(_0x5d5e1d){_0xefabb8[_0x321f('0xc1')]=_[_0x321f('0xc2')](db[_0x321f('0xd2')]['rawAttributes']);_0xefabb8[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x1c683f[_0x321f('0x38')]);_0xefabb8['filters']=_['intersection'](_0xefabb8[_0x321f('0xc1')],_0xefabb8[_0x321f('0x38')]);_0x3363cd['attributes']=_[_0x321f('0xc4')](_0xefabb8[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x1c683f[_0x321f('0x38')]['fields']));_0x3363cd[_0x321f('0x3c')]=_0x3363cd[_0x321f('0x3c')][_0x321f('0x41')]?_0x3363cd[_0x321f('0x3c')]:_0xefabb8[_0x321f('0xc1')];if(!_0x1c683f[_0x321f('0x38')][_0x321f('0xba')](_0x321f('0xcc'))){_0x3363cd[_0x321f('0x15')]=qs['limit'](_0x1c683f['query'][_0x321f('0x15')]);_0x3363cd[_0x321f('0x17')]=qs['offset'](_0x1c683f[_0x321f('0x38')][_0x321f('0x17')]);}_0x3363cd[_0x321f('0xc6')]=qs[_0x321f('0xc7')](_0x1c683f['query'][_0x321f('0xc7')]);_0x3363cd['where']=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x1c683f[_0x321f('0x38')],_0xefabb8['filters']));_0x3363cd[_0x321f('0xc8')][_0x321f('0xd3')]=_0x5d5e1d['id'];if(_0x1c683f[_0x321f('0x38')][_0x321f('0x24')]){_0x3363cd['where']=_[_0x321f('0xc9')](_0x3363cd[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x3363cd[_0x321f('0x3c')],function(_0x35fabf){var _0x1d125e={};_0x1d125e[_0x35fabf]={'$like':'%'+_0x1c683f[_0x321f('0x38')]['filter']+'%'};return _0x1d125e;})});}_0x3363cd=_[_0x321f('0xc9')]({},_0x3363cd,_0x1c683f[_0x321f('0x4d')]);return db[_0x321f('0xd2')]['count']({'where':_0x3363cd['where']})['then'](function(_0x350bdd){_0x264ddf[_0x321f('0x16')]=_0x350bdd;if(_0x1c683f[_0x321f('0x38')]['includeAll']){_0x3363cd[_0x321f('0x39')]=[{'all':!![]}];}return db[_0x321f('0xd2')][_0x321f('0x3e')](_0x3363cd);})[_0x321f('0x1b')](function(_0x5cdc61){_0x264ddf[_0x321f('0x3f')]=_0x5cdc61;return _0x264ddf;});}})[_0x321f('0x1b')](respondWithFilteredResult(_0x3d905e,_0x3363cd))[_0x321f('0x49')](handleError(_0x3d905e,null));};exports[_0x321f('0xd4')]=function(_0x56bdeb,_0x56e8ac){var _0x10edd6={'raw':!![],'where':{}};var _0x145e32={};var _0x447b92={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x56bdeb[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x56e8ac,null))[_0x321f('0x1b')](function(_0x44ef21){if(_0x44ef21){_0x145e32[_0x321f('0xc1')]=_[_0x321f('0xc2')](db[_0x321f('0xd5')][_0x321f('0x2d')]);_0x145e32[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x56bdeb[_0x321f('0x38')]);_0x145e32[_0x321f('0xc3')]=_['intersection'](_0x145e32['model'],_0x145e32[_0x321f('0x38')]);_0x10edd6[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x145e32[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x56bdeb[_0x321f('0x38')][_0x321f('0xc5')]));_0x10edd6['attributes']=_0x10edd6[_0x321f('0x3c')]['length']?_0x10edd6[_0x321f('0x3c')]:_0x145e32[_0x321f('0xc1')];if(!_0x56bdeb[_0x321f('0x38')]['hasOwnProperty'](_0x321f('0xcc'))){_0x10edd6[_0x321f('0x15')]=qs[_0x321f('0x15')](_0x56bdeb[_0x321f('0x38')][_0x321f('0x15')]);_0x10edd6['offset']=qs[_0x321f('0x17')](_0x56bdeb['query'][_0x321f('0x17')]);}_0x10edd6['order']=qs['sort'](_0x56bdeb[_0x321f('0x38')][_0x321f('0xc7')]);_0x10edd6['where']=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x56bdeb[_0x321f('0x38')],_0x145e32['filters']));_0x10edd6[_0x321f('0xc8')][_0x321f('0xd3')]=_0x44ef21['id'];if(_0x56bdeb['query']['filter']){_0x10edd6['where']=_[_0x321f('0xc9')](_0x10edd6[_0x321f('0xc8')],{'$or':_['map'](_0x10edd6[_0x321f('0x3c')],function(_0x3507b8){var _0x4bec76={};_0x4bec76[_0x3507b8]={'$like':'%'+_0x56bdeb[_0x321f('0x38')]['filter']+'%'};return _0x4bec76;})});}_0x10edd6=_['merge']({},_0x10edd6,_0x56bdeb[_0x321f('0x4d')]);return db[_0x321f('0xd5')][_0x321f('0x16')]({'where':_0x10edd6['where']})['then'](function(_0x5d5cc2){_0x447b92[_0x321f('0x16')]=_0x5d5cc2;if(_0x56bdeb[_0x321f('0x38')][_0x321f('0x4c')]){_0x10edd6[_0x321f('0x39')]=[{'all':!![]}];}return db['ScreenRecording'][_0x321f('0x3e')](_0x10edd6);})[_0x321f('0x1b')](function(_0x16b369){_0x447b92[_0x321f('0x3f')]=_0x16b369;return _0x447b92;});}})[_0x321f('0x1b')](respondWithFilteredResult(_0x56e8ac,_0x10edd6))[_0x321f('0x49')](handleError(_0x56e8ac,null));};exports['getChatInteractions']=function(_0x503a10,_0x4cce85){var _0x3b2a5d={};var _0x469fd7={};var _0x8a49f8;var _0x3220b6;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x503a10[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x4cce85,null))[_0x321f('0x1b')](function(_0x37bed6){if(_0x37bed6){_0x8a49f8=_0x37bed6;_0x469fd7[_0x321f('0xc1')]=_['keys'](db[_0x321f('0xd6')][_0x321f('0x2d')]);_0x469fd7[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x503a10[_0x321f('0x38')]);_0x469fd7[_0x321f('0xc3')]=_['intersection'](_0x469fd7['model'],_0x469fd7[_0x321f('0x38')]);_0x3b2a5d[_0x321f('0x3c')]=_['intersection'](_0x469fd7['model'],qs[_0x321f('0xc5')](_0x503a10[_0x321f('0x38')]['fields']));_0x3b2a5d['attributes']=_0x3b2a5d[_0x321f('0x3c')][_0x321f('0x41')]?_0x3b2a5d['attributes']:_0x469fd7[_0x321f('0xc1')];_0x3b2a5d[_0x321f('0xc6')]=qs['sort'](_0x503a10[_0x321f('0x38')][_0x321f('0xc7')]);_0x3b2a5d[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_['pick'](_0x503a10[_0x321f('0x38')],_0x469fd7['filters']));if(_0x503a10[_0x321f('0x38')]['filter']){_0x3b2a5d[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x3b2a5d[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x3b2a5d[_0x321f('0x3c')],function(_0x400603){var _0xae5d75={};_0xae5d75[_0x400603]={'$like':'%'+_0x503a10[_0x321f('0x38')]['filter']+'%'};return _0xae5d75;})});}_0x3b2a5d=_[_0x321f('0xc9')]({},_0x3b2a5d,_0x503a10['options']);return _0x8a49f8[_0x321f('0xd7')](_0x3b2a5d);}})[_0x321f('0x1b')](function(_0x20fec2){if(_0x20fec2){_0x3220b6=_0x20fec2['length'];if(!_0x503a10[_0x321f('0x38')]['hasOwnProperty']('nolimit')){_0x3b2a5d[_0x321f('0x15')]=qs['limit'](_0x503a10[_0x321f('0x38')][_0x321f('0x15')]);_0x3b2a5d['offset']=qs[_0x321f('0x17')](_0x503a10[_0x321f('0x38')][_0x321f('0x17')]);}return _0x8a49f8[_0x321f('0xd7')](_0x3b2a5d);}})[_0x321f('0x1b')](function(_0x52ba92){if(_0x52ba92){return _0x52ba92?{'count':_0x3220b6,'rows':_0x52ba92}:null;}})[_0x321f('0x1b')](respondWithResult(_0x4cce85,null))['catch'](handleError(_0x4cce85,null));};exports['getOpenchannelInteractions']=function(_0x50bd4b,_0x14deac){var _0x27a362={};var _0x15f278={};var _0x2dbb17;var _0x282b6f;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x50bd4b[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x14deac,null))[_0x321f('0x1b')](function(_0xe9f7c3){if(_0xe9f7c3){_0x2dbb17=_0xe9f7c3;_0x15f278[_0x321f('0xc1')]=_[_0x321f('0xc2')](db[_0x321f('0xd8')][_0x321f('0x2d')]);_0x15f278['query']=_[_0x321f('0xc2')](_0x50bd4b[_0x321f('0x38')]);_0x15f278[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x15f278[_0x321f('0xc1')],_0x15f278[_0x321f('0x38')]);_0x27a362[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x15f278[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x50bd4b[_0x321f('0x38')]['fields']));_0x27a362[_0x321f('0x3c')]=_0x27a362[_0x321f('0x3c')][_0x321f('0x41')]?_0x27a362[_0x321f('0x3c')]:_0x15f278['model'];_0x27a362[_0x321f('0xc6')]=qs['sort'](_0x50bd4b[_0x321f('0x38')]['sort']);_0x27a362[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x50bd4b['query'],_0x15f278['filters']));if(_0x50bd4b[_0x321f('0x38')][_0x321f('0x24')]){_0x27a362[_0x321f('0xc8')]=_['merge'](_0x27a362[_0x321f('0xc8')],{'$or':_['map'](_0x27a362[_0x321f('0x3c')],function(_0x5cb6f1){var _0x53b520={};_0x53b520[_0x5cb6f1]={'$like':'%'+_0x50bd4b[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x53b520;})});}_0x27a362=_[_0x321f('0xc9')]({},_0x27a362,_0x50bd4b[_0x321f('0x4d')]);return _0x2dbb17[_0x321f('0xd9')](_0x27a362);}})[_0x321f('0x1b')](function(_0x1dd9a1){if(_0x1dd9a1){_0x282b6f=_0x1dd9a1[_0x321f('0x41')];if(!_0x50bd4b['query'][_0x321f('0xba')](_0x321f('0xcc'))){_0x27a362[_0x321f('0x15')]=qs['limit'](_0x50bd4b[_0x321f('0x38')][_0x321f('0x15')]);_0x27a362[_0x321f('0x17')]=qs[_0x321f('0x17')](_0x50bd4b[_0x321f('0x38')][_0x321f('0x17')]);}return _0x2dbb17[_0x321f('0xd9')](_0x27a362);}})[_0x321f('0x1b')](function(_0x25db72){if(_0x25db72){return _0x25db72?{'count':_0x282b6f,'rows':_0x25db72}:null;}})['then'](respondWithResult(_0x14deac,null))[_0x321f('0x49')](handleError(_0x14deac,null));};exports['getMailInteractions']=function(_0x3f57ef,_0x5f47c5){var _0x3b8462={'raw':!![],'where':{}};var _0x211753={};var _0x1d69a4={'count':0x0,'rows':[]};return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x3f57ef[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x5f47c5,null))['then'](function(_0x54f402){if(_0x54f402){_0x211753[_0x321f('0xc1')]=_[_0x321f('0xc2')](db['MailInteraction'][_0x321f('0x2d')]);_0x211753[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x3f57ef[_0x321f('0x38')]);_0x211753[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x211753[_0x321f('0xc1')],_0x211753[_0x321f('0x38')]);_0x3b8462['attributes']=_['intersection'](_0x211753[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x3f57ef[_0x321f('0x38')][_0x321f('0xc5')]));_0x3b8462[_0x321f('0x3c')]=_0x3b8462['attributes'][_0x321f('0x41')]?_0x3b8462[_0x321f('0x3c')]:_0x211753[_0x321f('0xc1')];if(!_0x3f57ef[_0x321f('0x38')]['hasOwnProperty'](_0x321f('0xcc'))){_0x3b8462[_0x321f('0x15')]=qs['limit'](_0x3f57ef['query'][_0x321f('0x15')]);_0x3b8462['offset']=qs['offset'](_0x3f57ef['query'][_0x321f('0x17')]);}_0x3b8462[_0x321f('0xc6')]=qs[_0x321f('0xc7')](_0x3f57ef['query'][_0x321f('0xc7')]);_0x3b8462[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x3f57ef['query'],_0x211753['filters']));_0x3b8462[_0x321f('0xc8')]['UserId']=_0x54f402['id'];if(_0x3f57ef[_0x321f('0x38')][_0x321f('0x24')]){_0x3b8462['where']=_[_0x321f('0xc9')](_0x3b8462[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x3b8462[_0x321f('0x3c')],function(_0x579504){var _0x48abd2={};_0x48abd2[_0x579504]={'$like':'%'+_0x3f57ef['query'][_0x321f('0x24')]+'%'};return _0x48abd2;})});}_0x3b8462=_[_0x321f('0xc9')]({},_0x3b8462,_0x3f57ef[_0x321f('0x4d')]);return db['MailInteraction'][_0x321f('0x16')]({'where':_0x3b8462[_0x321f('0xc8')]})[_0x321f('0x1b')](function(_0x36ee20){_0x1d69a4[_0x321f('0x16')]=_0x36ee20;if(_0x3f57ef[_0x321f('0x38')][_0x321f('0x4c')]){_0x3b8462[_0x321f('0x39')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x3b8462);})['then'](function(_0x48edc4){_0x1d69a4[_0x321f('0x3f')]=_0x48edc4;return _0x1d69a4;});}})[_0x321f('0x1b')](respondWithFilteredResult(_0x5f47c5,_0x3b8462))[_0x321f('0x49')](handleError(_0x5f47c5,null));};exports[_0x321f('0xda')]=function(_0x55fb02,_0x1fd407){var _0x5eaae5={};var _0x3f00f1={};var _0x52841f;var _0x2db2f8;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x55fb02[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x1fd407,null))[_0x321f('0x1b')](function(_0x3e551a){if(_0x3e551a){_0x52841f=_0x3e551a;_0x3f00f1[_0x321f('0xc1')]=_['keys'](db['SmsInteraction'][_0x321f('0x2d')]);_0x3f00f1[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x55fb02[_0x321f('0x38')]);_0x3f00f1[_0x321f('0xc3')]=_['intersection'](_0x3f00f1[_0x321f('0xc1')],_0x3f00f1['query']);_0x5eaae5[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x3f00f1[_0x321f('0xc1')],qs['fields'](_0x55fb02[_0x321f('0x38')][_0x321f('0xc5')]));_0x5eaae5[_0x321f('0x3c')]=_0x5eaae5[_0x321f('0x3c')][_0x321f('0x41')]?_0x5eaae5[_0x321f('0x3c')]:_0x3f00f1[_0x321f('0xc1')];_0x5eaae5['order']=qs[_0x321f('0xc7')](_0x55fb02['query'][_0x321f('0xc7')]);_0x5eaae5['where']=qs['filters'](_['pick'](_0x55fb02[_0x321f('0x38')],_0x3f00f1[_0x321f('0xc3')]));if(_0x55fb02[_0x321f('0x38')][_0x321f('0x24')]){_0x5eaae5[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x5eaae5[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x5eaae5['attributes'],function(_0x721b70){var _0x562899={};_0x562899[_0x721b70]={'$like':'%'+_0x55fb02[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x562899;})});}_0x5eaae5=_['merge']({},_0x5eaae5,_0x55fb02[_0x321f('0x4d')]);return _0x52841f['getSmsInteractions'](_0x5eaae5);}})[_0x321f('0x1b')](function(_0x4a1f77){if(_0x4a1f77){_0x2db2f8=_0x4a1f77[_0x321f('0x41')];if(!_0x55fb02[_0x321f('0x38')][_0x321f('0xba')](_0x321f('0xcc'))){_0x5eaae5[_0x321f('0x15')]=qs['limit'](_0x55fb02[_0x321f('0x38')][_0x321f('0x15')]);_0x5eaae5[_0x321f('0x17')]=qs[_0x321f('0x17')](_0x55fb02[_0x321f('0x38')][_0x321f('0x17')]);}return _0x52841f[_0x321f('0xda')](_0x5eaae5);}})[_0x321f('0x1b')](function(_0x170763){if(_0x170763){return _0x170763?{'count':_0x2db2f8,'rows':_0x170763}:null;}})[_0x321f('0x1b')](respondWithResult(_0x1fd407,null))['catch'](handleError(_0x1fd407,null));};exports[_0x321f('0xdb')]=function(_0x4c90e1,_0x30dd83){var _0x30ed7d={};var _0x5780cd={};var _0x46a80a;var _0x553276;return db[_0x321f('0x2c')]['findOne']({'where':{'id':_0x4c90e1[_0x321f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30dd83,null))[_0x321f('0x1b')](function(_0x235d76){if(_0x235d76){_0x46a80a=_0x235d76;_0x5780cd['model']=_['keys'](db[_0x321f('0xdc')]['rawAttributes']);_0x5780cd['query']=_[_0x321f('0xc2')](_0x4c90e1[_0x321f('0x38')]);_0x5780cd[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x5780cd[_0x321f('0xc1')],_0x5780cd[_0x321f('0x38')]);_0x30ed7d[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x5780cd[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x4c90e1[_0x321f('0x38')]['fields']));_0x30ed7d[_0x321f('0x3c')]=_0x30ed7d[_0x321f('0x3c')][_0x321f('0x41')]?_0x30ed7d[_0x321f('0x3c')]:_0x5780cd[_0x321f('0xc1')];_0x30ed7d[_0x321f('0xc6')]=qs['sort'](_0x4c90e1[_0x321f('0x38')]['sort']);_0x30ed7d[_0x321f('0xc8')]=qs['filters'](_[_0x321f('0xd0')](_0x4c90e1[_0x321f('0x38')],_0x5780cd['filters']));if(_0x4c90e1[_0x321f('0x38')][_0x321f('0x24')]){_0x30ed7d[_0x321f('0xc8')]=_['merge'](_0x30ed7d[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x30ed7d[_0x321f('0x3c')],function(_0x464a9f){var _0x377b56={};_0x377b56[_0x464a9f]={'$like':'%'+_0x4c90e1[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x377b56;})});}_0x30ed7d=_[_0x321f('0xc9')]({},_0x30ed7d,_0x4c90e1[_0x321f('0x4d')]);return _0x46a80a[_0x321f('0xdb')](_0x30ed7d);}})['then'](function(_0x2e3708){if(_0x2e3708){_0x553276=_0x2e3708[_0x321f('0x41')];if(!_0x4c90e1[_0x321f('0x38')]['hasOwnProperty'](_0x321f('0xcc'))){_0x30ed7d['limit']=qs[_0x321f('0x15')](_0x4c90e1[_0x321f('0x38')][_0x321f('0x15')]);_0x30ed7d[_0x321f('0x17')]=qs[_0x321f('0x17')](_0x4c90e1[_0x321f('0x38')][_0x321f('0x17')]);}return _0x46a80a['getFaxInteractions'](_0x30ed7d);}})['then'](function(_0x4061b5){if(_0x4061b5){return _0x4061b5?{'count':_0x553276,'rows':_0x4061b5}:null;}})[_0x321f('0x1b')](respondWithResult(_0x30dd83,null))['catch'](handleError(_0x30dd83,null));};exports[_0x321f('0xdd')]=function(_0x5f4c68,_0x18e8ae){var _0x170be8={};var _0x248a9b={};var _0x5cf780;var _0x3cfe2a;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x5f4c68[_0x321f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18e8ae,null))[_0x321f('0x1b')](function(_0x3a341e){if(_0x3a341e){_0x5cf780=_0x3a341e;_0x248a9b[_0x321f('0xc1')]=_[_0x321f('0xc2')](db['WhatsappInteraction']['rawAttributes']);_0x248a9b[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x5f4c68[_0x321f('0x38')]);_0x248a9b[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x248a9b['model'],_0x248a9b[_0x321f('0x38')]);_0x170be8[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x248a9b[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x5f4c68[_0x321f('0x38')][_0x321f('0xc5')]));_0x170be8['attributes']=_0x170be8[_0x321f('0x3c')][_0x321f('0x41')]?_0x170be8['attributes']:_0x248a9b[_0x321f('0xc1')];_0x170be8['order']=qs[_0x321f('0xc7')](_0x5f4c68[_0x321f('0x38')][_0x321f('0xc7')]);_0x170be8[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x5f4c68['query'],_0x248a9b[_0x321f('0xc3')]));if(_0x5f4c68[_0x321f('0x38')][_0x321f('0x24')]){_0x170be8['where']=_[_0x321f('0xc9')](_0x170be8[_0x321f('0xc8')],{'$or':_['map'](_0x170be8[_0x321f('0x3c')],function(_0xa317d1){var _0x2bbf24={};_0x2bbf24[_0xa317d1]={'$like':'%'+_0x5f4c68[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x2bbf24;})});}_0x170be8=_[_0x321f('0xc9')]({},_0x170be8,_0x5f4c68[_0x321f('0x4d')]);return _0x5cf780[_0x321f('0xdd')](_0x170be8);}})['then'](function(_0x56d39a){if(_0x56d39a){_0x3cfe2a=_0x56d39a[_0x321f('0x41')];if(!_0x5f4c68[_0x321f('0x38')]['hasOwnProperty'](_0x321f('0xcc'))){_0x170be8[_0x321f('0x15')]=qs[_0x321f('0x15')](_0x5f4c68[_0x321f('0x38')]['limit']);_0x170be8[_0x321f('0x17')]=qs[_0x321f('0x17')](_0x5f4c68[_0x321f('0x38')]['offset']);}return _0x5cf780[_0x321f('0xdd')](_0x170be8);}})[_0x321f('0x1b')](function(_0x13eea9){if(_0x13eea9){return _0x13eea9?{'count':_0x3cfe2a,'rows':_0x13eea9}:null;}})[_0x321f('0x1b')](respondWithResult(_0x18e8ae,null))[_0x321f('0x49')](handleError(_0x18e8ae,null));};exports[_0x321f('0xde')]=function(_0x2b709d,_0x41b701,_0x1ec374){var _0x197b0e;var _0x27f2ba;var _0x17fd42;var _0x1c573b=!_[_0x321f('0x59')](_0x2b709d['params']['id'])?_0x2b709d[_0x321f('0x4b')]['id']:!_[_0x321f('0x59')](_0x2b709d[_0x321f('0x21')]['id'])?_0x2b709d[_0x321f('0x21')]['id']:null;return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x1c573b,'role':{'$or':['admin',_0x321f('0x21'),_0x321f('0x1c')]}},'attributes':['id',_0x321f('0x29'),'phone',_0x321f('0xdf'),_0x321f('0x1f'),'internal',_0x321f('0x90')]})[_0x321f('0x1b')](function(_0x519446){if(_0x519446){if(_0x519446[_0x321f('0x1f')]==='agent'){_0x197b0e=_0x519446;if(_0x2b709d[_0x321f('0x50')]['interface']){_0x17fd42=util[_0x321f('0x9c')](_0x321f('0xe0'),_0x197b0e[_0x2b709d[_0x321f('0x50')][_0x321f('0x92')]]);}else if(_0x2b709d[_0x321f('0x50')][_0x321f('0xe1')]){_0x17fd42=util[_0x321f('0x9c')](_0x321f('0x9d'),_0x2b709d[_0x321f('0x50')][_0x321f('0xe1')]);}else{_0x17fd42=util[_0x321f('0x9c')]('SIP/%s',_0x197b0e[_0x321f('0x29')]);}socket['to'](util[_0x321f('0x9c')](_0x321f('0xe2'),_0x197b0e[_0x321f('0x29')]))[_0x321f('0xa4')](_0x321f('0xe3'),{'user':{'id':_0x197b0e['id'],'name':_0x197b0e[_0x321f('0x29')]},'ip':_0x2b709d[_0x321f('0xe4')][_0x321f('0xe5')]||_0x2b709d[_0x321f('0xe6')]['remoteAddress']||_0x2b709d[_0x321f('0xe7')]['remoteAddress']||_0x2b709d[_0x321f('0xe6')][_0x321f('0xe7')][_0x321f('0xe8')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x197b0e['name']},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x321f('0x1b')](function(){if(_0x197b0e){return _0x197b0e[_0x321f('0xe9')]({'raw':!![]});}})[_0x321f('0x1b')](function(_0x173f93){if(_0x197b0e){if(_0x173f93){_0x27f2ba=_0x173f93;if(_0x27f2ba[_0x321f('0x41')]){var _0xa56774=_0x27f2ba[_0x321f('0x2e')](function(_0x107e41){var _0x2944c3={'membername':_0x197b0e[_0x321f('0x29')],'UserId':_0x197b0e['id'],'queue_name':_0x107e41['name'],'VoiceQueueId':_0x107e41['id'],'interface':_0x17fd42,'paused':_0x197b0e[_0x321f('0x90')]||![],'penalty':_0x107e41[_0x321f('0xea')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x2944c3);});return Promise['all'](_0xa56774);}}}})[_0x321f('0x1b')](function(){if(_0x197b0e){return db[_0x321f('0xeb')][_0x321f('0x3e')]({'where':{'membername':_0x197b0e['name'],'exitAt':null}});}})['then'](function(_0x1b8d30){if(_0x197b0e){var _0x27a3e6=[];_0x1b8d30['forEach'](function(_0x149a29){_0x27a3e6[_0x321f('0x3d')](_0x149a29[_0x321f('0x1a')]({'exitAt':moment()[_0x321f('0x9c')](_0x321f('0xec'))}));});return Promise['all'](_0x27a3e6);}})['then'](function(){if(_0x197b0e){var _0x330198=[];var _0x289584=[];var _0x456386=utils['getChannels']();var _0x10eed7={'membername':_0x197b0e['name'],'interface':_0x17fd42,'enterAt':moment()[_0x321f('0x9c')](_0x321f('0xec')),'role':_0x197b0e[_0x321f('0x1f')],'internal':_0x197b0e[_0x321f('0x55')]};_0x456386['forEach'](function(_0x1d6c09){_0x330198[_0x321f('0x3d')](_[_0x321f('0xc9')]({'channel':_0x1d6c09,'type':'LOGIN','data1':_0x2b709d['body']['device'],'data2':_0x17fd42},_0x10eed7));if(_0x197b0e[_0x321f('0x90')]){_0x289584['push'](_[_0x321f('0xc9')]({'channel':_0x1d6c09,'type':_0x321f('0xed'),'data1':_0x321f('0xee')},_0x10eed7));}});return db['MemberReport'][_0x321f('0x76')](_0x330198[_0x321f('0xef')](_0x289584),{'individualHooks':!![]});}})[_0x321f('0x1b')](function(){if(_0x197b0e){return _0x197b0e['update']({'online':!![],'lastLoginAt':moment()['format'](_0x321f('0xec')),'voicePause':_0x197b0e[_0x321f('0x90')]||![],'mailPause':_0x197b0e[_0x321f('0x90')]||![],'chatPause':_0x197b0e['loginInPause']||![],'faxPause':_0x197b0e[_0x321f('0x90')]||![],'smsPause':_0x197b0e['loginInPause']||![],'openchannelPause':_0x197b0e['loginInPause']||![],'whatsappPause':_0x197b0e['loginInPause']||![],'pauseType':_0x197b0e['loginInPause']?_0x321f('0xee'):null,'interface':_0x17fd42,'lastPauseAt':moment()['format'](_0x321f('0xec'))});}})['then'](function(_0x2cc39b){if(_0x2b709d[_0x321f('0xf0')]){return _0x1ec374();}else{return Promise[_0x321f('0xf1')](_0x2cc39b)[_0x321f('0x1b')](respondWithResult(_0x41b701,null));}})['catch'](handleError(_0x41b701,null));};exports[_0x321f('0xf2')]=function(_0x2ab1c2,_0x37ac42){var _0xd51558;return db['User'][_0x321f('0x28')]({'where':{'id':_0x2ab1c2['params']['id'],'role':_0x321f('0x1c')},'attributes':['id',_0x321f('0x29'),_0x321f('0x1f')]})[_0x321f('0x1b')](handleEntityNotFound(_0x37ac42,null))['then'](function(_0x1d5c2c){if(_0x1d5c2c){_0xd51558=_0x1d5c2c;return db['UserVoiceQueueRt'][_0x321f('0x1d')]({'where':{'membername':_0xd51558[_0x321f('0x29')]},'individualHooks':!![]});}})[_0x321f('0x1b')](function(){return db[_0x321f('0xeb')][_0x321f('0x3e')]({'where':{'membername':_0xd51558[_0x321f('0x29')],'exitAt':null}});})[_0x321f('0x1b')](function(_0x2e89ce){var _0x37bd56=[];_0x2e89ce[_0x321f('0xf3')](function(_0x3cc5b6){_0x37bd56[_0x321f('0x3d')](_0x3cc5b6[_0x321f('0x1a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x321f('0x4f')](_0x37bd56);})['then'](function(){return _0xd51558['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x37ac42,null))[_0x321f('0x49')](handleError(_0x37ac42,null));};exports[_0x321f('0xf4')]=function(_0x252f8d,_0x568cf7){var _0x2ba6eb;return db['UserVoiceQueueRt'][_0x321f('0x1a')]({'paused':0x1},{'where':{'UserId':_0x252f8d['params']['id']},'individualHooks':!![]})[_0x321f('0x1b')](function(){return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x252f8d[_0x321f('0x4b')]['id'],'role':'agent'},'attributes':['id',_0x321f('0x29'),_0x321f('0x1f'),_0x321f('0x55'),_0x321f('0x92'),_0x321f('0x8f')]});})[_0x321f('0x1b')](handleEntityNotFound(_0x568cf7,null))[_0x321f('0x1b')](function(_0x36fad2){if(_0x36fad2){_0x2ba6eb=_0x36fad2;return db[_0x321f('0xeb')][_0x321f('0x3e')]({'where':{'membername':_0x2ba6eb[_0x321f('0x29')],'type':_0x321f('0xed'),'exitAt':null}});}})[_0x321f('0x1b')](function(_0x46d0b1){if(_0x46d0b1[_0x321f('0x41')]){var _0x213bd4=moment()[_0x321f('0x9c')](_0x321f('0xec'));for(var _0x756bf5=0x0,_0xfe3ffb=_0x46d0b1[_0x321f('0x41')];_0x756bf5<_0xfe3ffb;_0x756bf5++){_0x46d0b1[_0x756bf5]['updateAttributes']({'exitAt':_0x213bd4});}}})['then'](function(){var _0x3ddd35=[];var _0x5805db=utils[_0x321f('0xf5')]();_0x5805db[_0x321f('0xf3')](function(_0x102255){_0x3ddd35[_0x321f('0x3d')]({'channel':_0x102255,'membername':_0x2ba6eb['name'],'interface':_[_0x321f('0x59')](_0x2ba6eb['interface'])?util[_0x321f('0x9c')](_0x321f('0x9d'),_0x2ba6eb[_0x321f('0x29')]):_0x2ba6eb[_0x321f('0x92')],'type':_0x321f('0xed'),'enterAt':moment()[_0x321f('0x9c')](_0x321f('0xec')),'data1':_0x252f8d['body']['type']||_0x321f('0xf6'),'role':_0x2ba6eb[_0x321f('0x1f')],'internal':_0x2ba6eb['internal']});});return db[_0x321f('0xeb')][_0x321f('0x76')](_0x3ddd35,{'individualHooks':!![]});})[_0x321f('0x1b')](function(){return _0x2ba6eb[_0x321f('0x1a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x252f8d[_0x321f('0x50')][_0x321f('0x30')]||_0x321f('0xf6'),'lastPauseAt':moment()[_0x321f('0x9c')](_0x321f('0xec'))});})[_0x321f('0x1b')](respondWithResult(_0x568cf7,null))[_0x321f('0x49')](handleError(_0x568cf7,null));};exports[_0x321f('0xf7')]=function(_0x511a68,_0x201a52){if(_0x511a68['body'][_0x321f('0x8e')]&&!utils[_0x321f('0x93')](_0x511a68['body']['channel'])){throw new APIBadRequestError(util[_0x321f('0x9c')](_0x321f('0xf8'),_0x511a68['body'][_0x321f('0x8e')]));}return db[_0x321f('0x2c')][_0x321f('0x28')]({'where':{'id':_0x511a68[_0x321f('0x4b')]['id']},'attributes':['id','name',_0x321f('0x1f'),_0x321f('0x55'),'interface','online',_0x321f('0x91'),_0x321f('0xf9'),_0x321f('0xfa'),_0x321f('0xfb'),'openchannelPause',_0x321f('0xfc'),_0x321f('0xfd'),_0x321f('0xfe'),'lastPauseAt']})[_0x321f('0x1b')](function(_0x1b2858){if(!_0x1b2858){throw new APINotFoundError(util[_0x321f('0x9c')](_0x321f('0xff'),_0x511a68['params']['id']));}return _0x1b2858[_0x321f('0xf7')](_0x511a68['body'][_0x321f('0x8e')]);})[_0x321f('0x1b')](respondWithResult(_0x201a52,null))['catch'](APIHandleError(_0x201a52));};exports[_0x321f('0x100')]=function(_0x54a03f,_0x4cb1a5){var _0x50a36f={};var _0x45f53d={};var _0x41f509;var _0x132501;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x54a03f['params']['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x4cb1a5,null))['then'](function(_0x32a460){if(_0x32a460){_0x41f509=_0x32a460;_0x45f53d['model']=_[_0x321f('0xc2')](db[_0x321f('0x101')][_0x321f('0x2d')]);_0x45f53d[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x54a03f[_0x321f('0x38')]);_0x45f53d[_0x321f('0xc3')]=_['intersection'](_0x45f53d[_0x321f('0xc1')],_0x45f53d[_0x321f('0x38')]);_0x50a36f[_0x321f('0x3c')]=_['intersection'](_0x45f53d[_0x321f('0xc1')],qs[_0x321f('0xc5')](_0x54a03f[_0x321f('0x38')]['fields']));_0x50a36f[_0x321f('0x3c')]=_0x50a36f[_0x321f('0x3c')][_0x321f('0x41')]?_0x50a36f[_0x321f('0x3c')]:_0x45f53d['model'];_0x50a36f[_0x321f('0xc6')]=qs[_0x321f('0xc7')](_0x54a03f[_0x321f('0x38')]['sort']);_0x50a36f[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x54a03f[_0x321f('0x38')],_0x45f53d[_0x321f('0xc3')]));if(_0x54a03f[_0x321f('0x38')]['filter']){_0x50a36f['where']=_['merge'](_0x50a36f[_0x321f('0xc8')],{'$or':_[_0x321f('0x2e')](_0x50a36f[_0x321f('0x3c')],function(_0x420f8d){var _0x1868b1={};_0x1868b1[_0x420f8d]={'$like':'%'+_0x54a03f[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x1868b1;})});}_0x50a36f=_['merge']({},_0x50a36f,_0x54a03f[_0x321f('0x4d')]);return _0x41f509['getTeams'](_0x50a36f);}})[_0x321f('0x1b')](function(_0x311385){if(_0x311385){_0x132501=_0x311385['length'];if(!_0x54a03f[_0x321f('0x38')]['hasOwnProperty']('nolimit')){_0x50a36f[_0x321f('0x15')]=qs[_0x321f('0x15')](_0x54a03f[_0x321f('0x38')][_0x321f('0x15')]);_0x50a36f['offset']=qs['offset'](_0x54a03f['query'][_0x321f('0x17')]);}return _0x41f509[_0x321f('0x100')](_0x50a36f);}})[_0x321f('0x1b')](function(_0x42a4ca){if(_0x42a4ca){return _0x42a4ca?{'count':_0x132501,'rows':_0x42a4ca}:null;}})['then'](respondWithResult(_0x4cb1a5,null))[_0x321f('0x49')](handleError(_0x4cb1a5,null));};exports[_0x321f('0x102')]=function(_0x56c387,_0x992346){var _0x16f68d=_0x56c387[_0x321f('0x4b')]['id'];var _0x53b50e=_0x56c387['body']?_0x56c387[_0x321f('0x50')][_0x321f('0x53')]:null;var _0xfd6075=[];return Promise['resolve']()[_0x321f('0x1b')](function(){if(!_0x53b50e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x321f('0x1b')](function(){return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x16f68d}});})[_0x321f('0x1b')](function(_0x5eaafb){if(!_0x5eaafb)throw new APINotFoundError(util[_0x321f('0x9c')](_0x321f('0xff'),_0x56c387[_0x321f('0x4b')]['id']));return db[_0x321f('0x5b')][_0x321f('0x103')](function(_0x550999){return _0x5eaafb[_0x321f('0x102')](_0x53b50e,{'transaction':_0x550999})[_0x321f('0x1b')](function(){return db[_0x321f('0x101')][_0x321f('0x3e')]({'where':{'id':{'$in':_0x53b50e}}});})[_0x321f('0x1b')](function(_0x3f55da){var _0x5e8faf=_['map'](_0x3f55da,function(_0x32ca48){return _0x32ca48[_0x321f('0x104')]();});return Promise[_0x321f('0x4f')](_0x5e8faf);})[_0x321f('0x1b')](function(_0x58fd00){_0xfd6075=_['flattenDeep'](_0x58fd00);var _0x354a8e=_['map'](_0xfd6075,function(_0x5d0a2c){return _0x5d0a2c[_0x321f('0x105')](_0x5eaafb['id'],{'transaction':_0x550999});});return Promise[_0x321f('0x4f')](_0x354a8e);})[_0x321f('0x1b')](function(){if(!_0x5eaafb['online'])return;var _0x50694c=_[_0x321f('0x24')](_0xfd6075,function(_0xf172f5){return _0xf172f5[_0x321f('0x106')]('channel')===_0x321f('0x107');});var _0x14ab0c=_[_0x321f('0x2e')](_0x50694c,function(_0x2a9203){return db[_0x321f('0x9f')]['upsert']({'membername':_0x5eaafb['name'],'UserId':_0x5eaafb['id'],'queue_name':_0x2a9203['name'],'VoiceQueueId':_0x2a9203['id'],'interface':_[_0x321f('0x59')](_0x5eaafb[_0x321f('0x92')])?util[_0x321f('0x9c')](_0x321f('0x9d'),_0x5eaafb[_0x321f('0x29')]):_0x5eaafb['interface'],'paused':_0x5eaafb['voicePause']||![],'penalty':_0x5eaafb['penalty']},{'transaction':_0x550999});});return Promise[_0x321f('0x4f')](_0x14ab0c);})[_0x321f('0x1b')](function(){return db[_0x321f('0x108')][_0x321f('0x3e')]({'where':{'teamId':{'$in':_0x53b50e}}});})[_0x321f('0x1b')](function(_0x2385ba){var _0x75bad=_[_0x321f('0x2e')](_0x2385ba,function(_0x1c05d0){return db['UserVoicePrefix'][_0x321f('0x6e')]({'UserId':_0x5eaafb['id'],'VoicePrefixId':_0x1c05d0[_0x321f('0x109')]},{'transaction':_0x550999});});return Promise['all'](_0x75bad);});});})[_0x321f('0x1b')](function(){for(var _0x4c78d1=0x0;_0x4c78d1<_0xfd6075[_0x321f('0x41')];_0x4c78d1++){var _0x59672a=_0xfd6075[_0x4c78d1]['getDataValue'](_0x321f('0x8e'));var _0x3338d5=_0x59672a+_0x321f('0x98');socket['emit'](_0x321f('0x21')+_0x59672a+_0x321f('0x99'),{'UserId':_0x16f68d,['queueField']:_0xfd6075[_0x4c78d1]['id']});}})[_0x321f('0x1b')](respondWithStatusCode(_0x992346,null))[_0x321f('0x49')](APIHandleError(_0x992346));};exports[_0x321f('0x10a')]=function(_0xffaf44,_0x572e47){var _0x570a46=_0xffaf44[_0x321f('0x4b')]['id'];var _0x2e421f=null;if(_0xffaf44[_0x321f('0x38')]['ids']){_0x2e421f=_[_0x321f('0xa3')](_0xffaf44[_0x321f('0x38')][_0x321f('0x53')])?_0xffaf44['query']['ids']:[_0xffaf44['query'][_0x321f('0x53')]];}var _0x4e3a03=[];return Promise['resolve']()[_0x321f('0x1b')](function(){if(!_0x2e421f)throw new APIBadRequestError(_0x321f('0x10b'));})[_0x321f('0x1b')](function(){return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x570a46}});})[_0x321f('0x1b')](function(_0x157a1b){if(!_0x157a1b)throw new APINotFoundError(util[_0x321f('0x9c')](_0x321f('0xff'),_0xffaf44['params']['id']));return db[_0x321f('0x5b')][_0x321f('0x103')](function(_0x4e318c){return _0x157a1b[_0x321f('0x10a')](_0x2e421f,{'transaction':_0x4e318c})[_0x321f('0x1b')](function(){return db[_0x321f('0x101')][_0x321f('0x3e')]({'where':{'id':{'$in':_0x2e421f}}});})[_0x321f('0x1b')](function(_0x39d29a){var _0x1c43ea=_['map'](_0x39d29a,function(_0x3a7ab9){return _0x3a7ab9[_0x321f('0x104')]();});return Promise[_0x321f('0x4f')](_0x1c43ea);})[_0x321f('0x1b')](function(_0x11c068){_0x4e3a03=_[_0x321f('0x10c')](_0x11c068);var _0x338e3c=_['map'](_0x4e3a03,function(_0x263772){return _0x263772[_0x321f('0x10d')](_0x157a1b['id'],{'transaction':_0x4e318c});});return Promise['all'](_0x338e3c);})[_0x321f('0x1b')](function(){if(!_0x157a1b[_0x321f('0x8f')])return;var _0x3d0cee=_[_0x321f('0x24')](_0x4e3a03,function(_0x25386b){return _0x25386b[_0x321f('0x106')](_0x321f('0x8e'))===_0x321f('0x107');});var _0x337cdb=_[_0x321f('0x2e')](_0x3d0cee,function(_0x5f2366){return db[_0x321f('0x9f')][_0x321f('0x1d')]({'where':{'VoiceQueueId':_0x5f2366['id'],'UserId':_0x157a1b['id']},'transaction':_0x4e318c});});return Promise[_0x321f('0x4f')](_0x337cdb);})[_0x321f('0x1b')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x2e421f}}});})[_0x321f('0x1b')](function(_0x3e34ab){var _0x53a0c=_[_0x321f('0x2e')](_0x3e34ab,function(_0x4e56c7){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x157a1b['id'],'VoicePrefixId':_0x4e56c7['VoicePrefixId']}},{'transaction':_0x4e318c});});return Promise[_0x321f('0x4f')](_0x53a0c);});});})[_0x321f('0x1b')](function(){for(var _0x220026=0x0;_0x220026<_0x4e3a03[_0x321f('0x41')];_0x220026++){var _0x41dec0=_0x4e3a03[_0x220026][_0x321f('0x106')](_0x321f('0x8e'));var _0x1e6bf1=_0x41dec0+_0x321f('0x98');socket[_0x321f('0xa4')](_0x321f('0x21')+_0x41dec0+_0x321f('0xa5'),{'UserId':_0x570a46,['queueField']:_0x4e3a03[_0x220026]['id']});}})[_0x321f('0x1b')](respondWithStatusCode(_0x572e47,null))[_0x321f('0x49')](APIHandleError(_0x572e47));};exports[_0x321f('0x10e')]=function(_0x488adc,_0x1cca04){var _0x5d0019={};var _0x5bc6cf={};var _0x288da2;var _0xacc7d6;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x488adc[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x1cca04,null))['then'](function(_0x14c402){if(_0x14c402){_0x288da2=_0x14c402;_0x5bc6cf[_0x321f('0xc1')]=_[_0x321f('0xc2')](db['CmList']['rawAttributes']);_0x5bc6cf[_0x321f('0x38')]=_[_0x321f('0xc2')](_0x488adc[_0x321f('0x38')]);_0x5bc6cf['filters']=_[_0x321f('0xc4')](_0x5bc6cf[_0x321f('0xc1')],_0x5bc6cf[_0x321f('0x38')]);_0x5d0019[_0x321f('0x3c')]=_[_0x321f('0xc4')](_0x5bc6cf['model'],qs[_0x321f('0xc5')](_0x488adc[_0x321f('0x38')]['fields']));_0x5d0019['attributes']=_0x5d0019[_0x321f('0x3c')][_0x321f('0x41')]?_0x5d0019[_0x321f('0x3c')]:_0x5bc6cf['model'];_0x5d0019[_0x321f('0xc6')]=qs[_0x321f('0xc7')](_0x488adc['query']['sort']);_0x5d0019[_0x321f('0xc8')]=qs[_0x321f('0xc3')](_[_0x321f('0xd0')](_0x488adc[_0x321f('0x38')],_0x5bc6cf[_0x321f('0xc3')]));if(_0x488adc[_0x321f('0x38')]['filter']){_0x5d0019[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x5d0019['where'],{'$or':_[_0x321f('0x2e')](_0x5d0019[_0x321f('0x3c')],function(_0x371b1a){var _0x45cc5c={};_0x45cc5c[_0x371b1a]={'$like':'%'+_0x488adc[_0x321f('0x38')][_0x321f('0x24')]+'%'};return _0x45cc5c;})});}_0x5d0019=_['merge']({},_0x5d0019,_0x488adc[_0x321f('0x4d')]);return _0x288da2[_0x321f('0x10e')](_0x5d0019);}})[_0x321f('0x1b')](function(_0x31b9de){if(_0x31b9de){_0xacc7d6=_0x31b9de[_0x321f('0x41')];if(!_0x488adc[_0x321f('0x38')][_0x321f('0xba')]('nolimit')){_0x5d0019[_0x321f('0x15')]=qs[_0x321f('0x15')](_0x488adc[_0x321f('0x38')][_0x321f('0x15')]);_0x5d0019[_0x321f('0x17')]=qs[_0x321f('0x17')](_0x488adc[_0x321f('0x38')][_0x321f('0x17')]);}return _0x288da2[_0x321f('0x10e')](_0x5d0019);}})[_0x321f('0x1b')](function(_0x555afb){if(_0x555afb){return _0x555afb?{'count':_0xacc7d6,'rows':_0x555afb}:null;}})['then'](respondWithResult(_0x1cca04,null))[_0x321f('0x49')](handleError(_0x1cca04,null));};exports[_0x321f('0x10f')]=function(_0x1d9c5f,_0x2aef4f){var _0x166b42={};var _0x7eea48={};var _0x444a11;return db[_0x321f('0x2c')][_0x321f('0x88')]({'where':{'id':_0x1d9c5f[_0x321f('0x4b')]['id']}})[_0x321f('0x1b')](handleEntityNotFound(_0x2aef4f,null))['then'](function(_0x3412e5){if(_0x3412e5){_0x444a11=_0x3412e5;_0x7eea48['model']=_['keys'](db[_0x321f('0x2c')][_0x321f('0x2d')]);_0x7eea48['query']=_[_0x321f('0xc2')](_0x1d9c5f['query']);_0x7eea48[_0x321f('0xc3')]=_[_0x321f('0xc4')](_0x7eea48[_0x321f('0xc1')],_0x7eea48[_0x321f('0x38')]);_0x166b42['attributes']=_[_0x321f('0xc4')](_0x7eea48['model'],qs['fields'](_0x1d9c5f[_0x321f('0x38')]['fields']));_0x166b42[_0x321f('0x3c')]=_0x166b42[_0x321f('0x3c')][_0x321f('0x41')]?_0x166b42['attributes']:_0x7eea48['model'];_0x166b42[_0x321f('0xc6')]=qs['sort'](_0x1d9c5f[_0x321f('0x38')][_0x321f('0xc7')]);_0x166b42[_0x321f('0xc8')]=qs['filters'](_[_0x321f('0xd0')](_0x1d9c5f[_0x321f('0x38')],_0x7eea48[_0x321f('0xc3')]));if(_0x1d9c5f[_0x321f('0x38')][_0x321f('0x24')]){_0x166b42[_0x321f('0xc8')]=_[_0x321f('0xc9')](_0x166b42['where'],{'$or':_['map'](_0x166b42['attributes'],function(_0x34dd10){var _0x9269ee={};_0x9269ee[_0x34dd10]={'$like':'%'+_0x1d9c5f['query']['filter']+'%'};return _0x9269ee;})});}_0x166b42[_0x321f('0xc1')]=db[_0x321f('0x2c')];_0x166b42['as']=_0x321f('0x22');_0x166b42=_[_0x321f('0xc9')]({},_0x166b42,_0x1d9c5f[_0x321f('0x4d')]);return _0x444a11[_0x321f('0xe9')]({'include':[_0x166b42]});}})['then'](function(_0x393e38){if(_0x393e38){var _0x10576a={},_0x2e19f7=[];for(var _0xe2d5a2=0x0;_0xe2d5a2<_0x393e38[_0x321f('0x41')];_0xe2d5a2+=0x1){for(var _0x555fed=0x0,_0x3dc8ca;_0x555fed<_0x393e38[_0xe2d5a2]['Agents'][_0x321f('0x41')];_0x555fed+=0x1){_0x3dc8ca=_0x393e38[_0xe2d5a2][_0x321f('0x22')][_0x555fed][_0x321f('0x1e')]({'plain':!![]});_0x10576a[_0x3dc8ca['id']]=_0x3dc8ca;}}_0x10576a=_[_0x321f('0x110')](_0x10576a);for(var _0x3d8747=qs[_0x321f('0x17')](_0x1d9c5f[_0x321f('0x38')][_0x321f('0x17')]);_0x3d8747<_0x10576a['length']&&_0x2e19f7[_0x321f('0x41')]=_0x575d9d){_0x23631f=_0x575d9d;_0x46ee88=0xc8;}else{_0x46ee88=0xce;}_0x56fc83[_0x3039('0x16')](_0x46ee88);return _0x56fc83[_0x3039('0x1d')]('Content-Range',_0x93cf4f+'-'+_0x23631f+'/'+_0x575d9d)['json'](_0x571b0f);}return null;};}function saveUpdates(_0x44a489){return function(_0x477726){if(_0x477726){return _0x477726[_0x3039('0x1e')](_0x44a489)['then'](function(_0x393a4d){if(_0x393a4d[_0x3039('0x1f')]==='agent'){socket[_0x3039('0x20')](_0x3039('0x21')+_0x393a4d['id'],_0x393a4d);}return _0x393a4d;});}return null;};}function removeEntity(_0x3c26d0,_0x192c1a){return function(_0x47cda3){if(_0x47cda3){return _0x47cda3['destroy']({'transaction':_0x192c1a})['then'](function(){var _0x50854d=_0x47cda3[_0x3039('0x22')]({'plain':!![]});if(_0x50854d[_0x3039('0x1f')]===_0x3039('0x23'))return;var _0x17a0f=[{'name':_0x3039('0x24'),'value':_0x3039('0x25'),'ignore':!![]},{'name':_0x3039('0x26'),'value':_0x3039('0x27'),'ignore':![]},{'name':_0x3039('0x28'),'value':_0x3039('0x29'),'ignore':![]}];var _0x28b58f=_(_0x17a0f)[_0x3039('0x2a')](_0x3039('0x2b'))[_0x3039('0x2c')](_0x3039('0x2d'))[_0x3039('0x2d')]();if(_['includes'](_0x28b58f,_0x50854d[_0x3039('0x1f')])){return;}var _0x6508a4=_[_0x3039('0x2e')](_0x17a0f,[_0x3039('0x2d'),_0x50854d['role']])['name'];return db[_0x3039('0x2f')]['destroy']({'where':{'type':_0x6508a4,'resourceId':_0x50854d['id']},'transaction':_0x192c1a})[_0x3039('0x30')](function(){return _0x47cda3;});})[_0x3039('0x30')](function(){_0x3c26d0[_0x3039('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346a44){return function(_0x5b3963){if(!_0x5b3963){_0x346a44['sendStatus'](0x194);}return _0x5b3963;};}function handleError(_0x201b33,_0x547f1f){_0x547f1f=_0x547f1f||0x1f4;return function(_0x1a8bcb){logger['error'](_0x1a8bcb[_0x3039('0x31')]);if(_0x1a8bcb['name']){delete _0x1a8bcb[_0x3039('0x32')];}_0x201b33[_0x3039('0x16')](_0x547f1f)[_0x3039('0x33')](_0x1a8bcb);};}function getUserAttributes(){return _(db[_0x3039('0x34')][_0x3039('0x35')])[_0x3039('0x2c')](function(_0x3e8b83){return{'name':_0x3e8b83['fieldName'],'type':_0x3e8b83['type'][_0x3039('0x36')]};})[_0x3039('0x2a')](function(_0x2837bf){return!['password',_0x3039('0x37'),'previousPasswords',_0x3039('0x38'),_0x3039('0x39'),'md5secret']['includes'](_0x2837bf['name']);})[_0x3039('0x2d')]();}exports['index']=function(_0x3a855d,_0x3309f8){var _0x5beb63={},_0x4bbc12={'count':0x0,'rows':[]};var _0x4bc5c7=getUserAttributes();_0x5beb63=qs[_0x3039('0x3a')](_0x4bc5c7,_0x3a855d);var _0x1e39b9={'where':_0x5beb63[_0x3039('0x3b')]};return db[_0x3039('0x34')][_0x3039('0x1c')](_0x1e39b9)[_0x3039('0x30')](function(_0x2de6bb){_0x4bbc12[_0x3039('0x1c')]=_0x2de6bb;if(_0x3a855d[_0x3039('0x3c')][_0x3039('0x3d')]){_0x5beb63[_0x3039('0x3e')]=[{'all':!![]}];}if(_0x3a855d[_0x3039('0x3c')][_0x3039('0x3f')]===_0x3039('0x40')){_0x5beb63['include']=[{'model':db[_0x3039('0x41')],'as':_0x3039('0x3f')}];}if(!_[_0x3039('0x42')](_0x5beb63[_0x3039('0x43')],'id')){_0x5beb63[_0x3039('0x43')]['push']('id');}return db[_0x3039('0x34')][_0x3039('0x44')](_0x5beb63);})['then'](function(_0x2a5024){_0x4bbc12[_0x3039('0x45')]=_0x2a5024;if(_0x3a855d[_0x3039('0x3c')][_0x3039('0x46')]===_0x3039('0x40')){var _0x1127cd=[];for(var _0x4666e4=0x0;_0x4666e4<_0x4bbc12[_0x3039('0x45')][_0x3039('0x47')];_0x4666e4++){_0x1127cd[_0x3039('0x48')](get_open_tabs('chat',_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));_0x1127cd['push'](get_open_tabs(_0x3039('0x4a'),_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs(_0x3039('0x4b'),_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs('mail',_0x4bbc12[_0x3039('0x45')][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs(_0x3039('0x4c'),_0x4bbc12[_0x3039('0x45')][_0x4666e4][_0x3039('0x49')]));_0x1127cd[_0x3039('0x48')](get_open_tabs(_0x3039('0x4d'),_0x4bbc12['rows'][_0x4666e4][_0x3039('0x49')]));}return Promise[_0x3039('0x4e')](_0x1127cd)[_0x3039('0x30')](function(){return _0x4bbc12;});}else{return _0x4bbc12;}})[_0x3039('0x30')](respondWithFilteredResult(_0x3309f8,_0x5beb63))[_0x3039('0x4f')](handleError(_0x3309f8,null));};exports['show']=function(_0xdad61d,_0x45b6e8){var _0x49e02c=getUserAttributes();_0xdad61d['query']['id']=_0xdad61d[_0x3039('0x50')]['id'];var _0x28c803=qs[_0x3039('0x3a')](_0x49e02c,_0xdad61d);if(_0xdad61d[_0x3039('0x3c')]['includeAll']){_0x28c803[_0x3039('0x3e')]=[{'all':!![]}];}if(_0xdad61d[_0x3039('0x3c')][_0x3039('0x3f')]===_0x3039('0x40')){_0x28c803[_0x3039('0x3e')]=[{'model':db[_0x3039('0x41')],'as':_0x3039('0x3f')}];}_0x28c803=_[_0x3039('0x51')]({},_0x28c803,_0xdad61d[_0x3039('0x52')]);if(!_['includes'](_0x28c803[_0x3039('0x43')],'id')){_0x28c803[_0x3039('0x43')][_0x3039('0x48')]('id');}return db['User'][_0x3039('0x2e')](_0x28c803)['then'](handleEntityNotFound(_0x45b6e8,null))['then'](function(_0x41e214){var _0x24d399=[];values=_0x41e214;if(_0xdad61d[_0x3039('0x3c')]['openTabs']===_0x3039('0x40')){_0x24d399['push'](get_open_tabs(_0x3039('0x53'),_0x41e214['dataValues']));_0x24d399['push'](get_open_tabs(_0x3039('0x4a'),_0x41e214[_0x3039('0x49')]));_0x24d399[_0x3039('0x48')](get_open_tabs(_0x3039('0x4c'),_0x41e214[_0x3039('0x49')]));_0x24d399['push'](get_open_tabs('whatsapp',_0x41e214['dataValues']));_0x24d399[_0x3039('0x48')](get_open_tabs(_0x3039('0x4b'),_0x41e214[_0x3039('0x49')]));_0x24d399['push'](get_open_tabs(_0x3039('0x54'),_0x41e214[_0x3039('0x49')]));return Promise[_0x3039('0x4e')](_0x24d399);}else{return values;}})[_0x3039('0x30')](function(){return values;})[_0x3039('0x30')](respondWithResult(_0x45b6e8,null))['catch'](handleError(_0x45b6e8,null));};exports[_0x3039('0x1e')]=function(_0x3626fe,_0x40e2c2){if(_0x3626fe[_0x3039('0x55')]['id']){delete _0x3626fe[_0x3039('0x55')]['id'];}delete _0x3626fe[_0x3039('0x55')][_0x3039('0x1f')];return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x3626fe[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x40e2c2,null))[_0x3039('0x30')](saveUpdates(_0x3626fe[_0x3039('0x55')],null))[_0x3039('0x30')](respondWithResult(_0x40e2c2,null))[_0x3039('0x4f')](handleError(_0x40e2c2,null));};exports[_0x3039('0x56')]=function(_0x498f78,_0x259efd){return db['User'][_0x3039('0x56')]()[_0x3039('0x30')](respondWithResult(_0x259efd,null))[_0x3039('0x4f')](handleError(_0x259efd,null));};exports[_0x3039('0x57')]=function(_0xffc738,_0x33aec2){return db['User'][_0x3039('0x2e')]({'where':{'id':_0xffc738[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x33aec2,null))[_0x3039('0x30')](function(_0x5911e5){if(_0x5911e5){return _0x5911e5['addContacts'](_0xffc738['body'][_0x3039('0x58')],_[_0x3039('0x59')](_0xffc738['body'],['ids','id'])||{});}})[_0x3039('0x30')](respondWithResult(_0x33aec2,null))[_0x3039('0x4f')](handleError(_0x33aec2,null));};function validateUser(_0xba3431){return new Promise(function(_0x221405,_0xbcd2a){if(_0xba3431[_0x3039('0x5a')])return _0x221405(_0xba3431);return db[_0x3039('0x5b')][_0x3039('0x5c')](0x1)[_0x3039('0x30')](function(_0x3d069f){if(_0x3d069f[_0x3039('0x5d')])authService['validatePasswordPattern'](_0xba3431[_0x3039('0x5e')]);db[_0x3039('0x34')][_0x3039('0x5f')](_0x3039('0x5a'))['then'](function(_0x5ef2e6){if(_['isNil'](_0x5ef2e6)){_0xba3431[_0x3039('0x5a')]=_0x3d069f[_0x3039('0x60')]||0x1;return;}if(_['isNil'](_0x3d069f[_0x3039('0x60')])||_0x3d069f['min_internal']===_0x5ef2e6){_0xba3431[_0x3039('0x5a')]=_0x5ef2e6+0x1;return;}if(_0x3d069f[_0x3039('0x60')]>_0x5ef2e6){_0xba3431[_0x3039('0x5a')]=_0x3d069f['min_internal'];return;}return db['sequelize'][_0x3039('0x3c')](_0x3039('0x61'),{'type':db[_0x3039('0x62')]['QueryTypes'][_0x3039('0x63')]})['then'](function(_0x58f218){if(_0x58f218&&_0x58f218[_0x3039('0x47')]){for(var _0x185140=0x0,_0x30bd4e=_0x58f218[_0x3039('0x47')];_0x185140<_0x30bd4e&&_[_0x3039('0x64')](_0xba3431[_0x3039('0x5a')]);_0x185140++){if(_0x3d069f['min_internal']<=_0x58f218[_0x185140][_0x3039('0x65')]){_0xba3431['internal']=_0x58f218[_0x185140]['from'];}else if(_0x3d069f[_0x3039('0x60')]>_0x58f218[_0x185140]['from']&&_0x3d069f['min_internal']<=_0x58f218[_0x185140]['to']){_0xba3431[_0x3039('0x5a')]=_0x3d069f['min_internal'];}}}if(_[_0x3039('0x64')](_0xba3431[_0x3039('0x5a')])){_0xba3431['internal']=_0x5ef2e6+0x1;}return _0x221405(_0xba3431);});});})[_0x3039('0x4f')](function(_0x1ede8a){_0xbcd2a(_0x1ede8a);});});}function updateUser(_0x4b24b1){return new Promise(function(_0x231279,_0x4ad308){try{if(_0x4b24b1[_0x3039('0x66')]){_0x4b24b1[_0x3039('0x67')]=_0x4b24b1['internal'];_0x4b24b1[_0x3039('0x68')]={'mailbox':_0x4b24b1[_0x3039('0x5a')],'password':_0x4b24b1[_0x3039('0x5e')],'fullname':_0x4b24b1[_0x3039('0x69')],'email':_0x4b24b1['email']};}if(_0x4b24b1['role']===_0x3039('0x27')){if(!_0x4b24b1[_0x3039('0x6a')])_0x4b24b1[_0x3039('0x6a')]=[_0x3039('0x6b'),_0x3039('0x6c'),'103',_0x3039('0x6d'),_0x3039('0x6e'),_0x3039('0x6f'),'105',_0x3039('0x70'),_0x3039('0x71'),'108',_0x3039('0x72'),_0x3039('0x73'),'111','114','115'];}_0x231279(_0x4b24b1);}catch(_0x57ba25){_0x4ad308(_0x57ba25);}});}exports[_0x3039('0x74')]=function(_0xd95f90,_0x38cbca){if(_0xd95f90['user'][_0x3039('0x1f')]===_0x3039('0x27'))throw new Error(_0x3039('0x75'));if(_0xd95f90['body'][_0x3039('0x1f')]===_0x3039('0x25')&&_0xd95f90[_0x3039('0x25')]['role']!=='admin'){throw new Error(_0x3039('0x76'));}if(_0xd95f90[_0x3039('0x55')][_0x3039('0x1f')]===_0x3039('0x23')&&_0xd95f90[_0x3039('0x25')][_0x3039('0x1f')]!==_0x3039('0x23')){throw new Error(_0x3039('0x77'));}return licenseUtil[_0x3039('0x78')]([_0xd95f90[_0x3039('0x55')]])['then'](function(){return validateUser(_0xd95f90[_0x3039('0x55')]);})[_0x3039('0x30')](function(_0x30a4f3){return updateUser(_0x30a4f3)['then'](function(_0x2fd66c){if(_0x2fd66c[_0x3039('0x1f')]==='admin'){_0x2fd66c[_0x3039('0x79')]=_0xd95f90['user'][_0x3039('0x79')];delete _0x2fd66c['userProfileId'];}return _0x2fd66c;});})['then'](function(_0x466eff){return db['User']['create'](_0x466eff,{'include':[{'model':db[_0x3039('0x68')],'as':_0x3039('0x68')}]});})[_0x3039('0x30')](function(_0x105e45){if(_0xd95f90[_0x3039('0x55')][_0x3039('0x1f')]==='user')return _0x105e45;if(_0xd95f90[_0x3039('0x25')][_0x3039('0x1f')]!=='user')return _0x105e45;return db[_0x3039('0x7a')]['find']({'where':{'name':_0x105e45['role']===_0x3039('0x27')?_0x3039('0x26'):_0x3039('0x28'),'userProfileId':_0xd95f90[_0x3039('0x25')][_0x3039('0x7b')]},'raw':!![]})[_0x3039('0x30')](function(_0xab6004){if(!_0xab6004||_0xab6004[_0x3039('0x7c')]!=0x0)return _0x105e45;return db[_0x3039('0x2f')][_0x3039('0x74')]({'name':_0x105e45[_0x3039('0x32')],'resourceId':_0x105e45['id'],'type':_0xab6004[_0x3039('0x32')],'sectionId':_0xab6004['id']},{})[_0x3039('0x30')](function(){return _0x105e45;});})[_0x3039('0x4f')](function(_0x5362e5){logger['error'](_0x3039('0x7d'),_0x5362e5);throw _0x5362e5;});})[_0x3039('0x30')](respondWithResult(_0x38cbca,0xc9))[_0x3039('0x4f')](handleError(_0x38cbca,null));};exports[_0x3039('0x7e')]=function(_0x3ae679,_0x190ef0){var _0x3b35d1=_0x3ae679[_0x3039('0x55')];var _0x5f045b=[];if(_0x3ae679[_0x3039('0x25')][_0x3039('0x1f')]===_0x3039('0x27'))throw new Error(_0x3039('0x75'));if(_[_0x3039('0x7f')](_0x3b35d1,[_0x3039('0x1f'),_0x3039('0x25')])&&_0x3ae679[_0x3039('0x25')][_0x3039('0x1f')]!==_0x3039('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x3039('0x7f')](_0x3b35d1,[_0x3039('0x1f'),'admin'])&&_0x3ae679[_0x3039('0x25')][_0x3039('0x1f')]!==_0x3039('0x23')){throw new Error(_0x3039('0x80'));}return licenseUtil['checkUserLimits'](_0x3b35d1)[_0x3039('0x30')](function(){return validateUser(_0x3b35d1[0x0]);})[_0x3039('0x30')](function(){for(var _0x434ce2=0x1;_0x434ce2<_0x3b35d1['length'];_0x434ce2++){var _0x51aa1b=_0x3b35d1[_0x434ce2-0x1][_0x3039('0x5a')];if(!_0x3b35d1[_0x434ce2][_0x3039('0x5a')])_0x3b35d1[_0x434ce2]['internal']=_0x51aa1b+0x1;_0x5f045b[_0x3039('0x48')](validateUser(_0x3b35d1[_0x434ce2]));}return Promise[_0x3039('0x4e')](_0x5f045b);})[_0x3039('0x30')](function(){_0x5f045b=[];for(var _0x4c5f1f=0x0;_0x4c5f1f<_0x3b35d1['length'];_0x4c5f1f++){_0x5f045b[_0x3039('0x48')](updateUser(_0x3b35d1[_0x4c5f1f]));}return Promise[_0x3039('0x4e')](_0x5f045b);})[_0x3039('0x30')](function(){_0x5f045b=_0x3b35d1[_0x3039('0x2c')](function(_0x1de004){return db[_0x3039('0x34')][_0x3039('0x74')](_0x1de004,{'include':[{'model':db[_0x3039('0x68')],'as':_0x3039('0x68')}]})['then'](function(_0x2f8108){_0x1de004['id']=_0x2f8108['id'];return _0x1de004;});});return Promise[_0x3039('0x4e')](_0x5f045b);})['then'](function(_0x3f15e1){if(_0x3ae679['body'][_0x3039('0x1f')]==='user')return _0x3f15e1;if(_0x3ae679['user'][_0x3039('0x1f')]!==_0x3039('0x25'))return _0x3f15e1;var _0x38dc03=_[_0x3039('0x7f')](_0x3f15e1,function(_0x335e25){return _0x335e25[_0x3039('0x1f')]===_0x3039('0x27')||_0x335e25[_0x3039('0x1f')]===_0x3039('0x29');});if(!_0x38dc03)return _0x3f15e1;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x3039('0x26'),_0x3039('0x28')]},'userProfileId':_0x3ae679[_0x3039('0x25')][_0x3039('0x7b')]},'raw':!![]})[_0x3039('0x30')](function(_0x5cf548){if(_['isEmpty'](_0x5cf548)||!_[_0x3039('0x7f')](_0x5cf548,[_0x3039('0x7c'),0x0]))return _0x3f15e1;_0x5f045b=[];var _0x3f54e5=_(_0x5cf548)['map'](function(_0x2634b6){if(_0x2634b6['autoAssociation']===0x1)return;return _0x2634b6[_0x3039('0x32')]==='Agents'?_0x3039('0x27'):_0x3039('0x29');})[_0x3039('0x81')]()[_0x3039('0x2d')]();for(var _0x4b3082=0x0;_0x4b3082<_0x3f15e1[_0x3039('0x47')];_0x4b3082++){if(!_[_0x3039('0x42')](_0x3f54e5,_0x3f15e1[_0x4b3082][_0x3039('0x1f')]))return;var _0x407db1=_0x3f15e1[_0x4b3082][_0x3039('0x1f')]===_0x3039('0x27')?_0x3039('0x26'):_0x3039('0x28');_0x5f045b[_0x3039('0x48')](db[_0x3039('0x2f')][_0x3039('0x74')]({'name':_0x3f15e1[_0x4b3082][_0x3039('0x32')],'resourceId':_0x3f15e1[_0x4b3082]['id'],'type':_0x407db1,'sectionId':_[_0x3039('0x2e')](_0x5cf548,[_0x3039('0x32'),_0x407db1])['id']},{}));}return Promise[_0x3039('0x4e')](_0x5f045b);});})[_0x3039('0x30')](respondWithResult(_0x190ef0,0xc9))[_0x3039('0x4f')](handleError(_0x190ef0,null));};exports[_0x3039('0x82')]=function(_0x4fd3f1,_0x22c603){if(_0x4fd3f1['body']['id']){delete _0x4fd3f1['body']['id'];}return db['User'][_0x3039('0x2e')]({'where':{'id':_0x4fd3f1[_0x3039('0x50')]['id']}})[_0x3039('0x30')](function(_0x2fb8d0){if(!_0x2fb8d0)return null;if(_0x2fb8d0['id']===_0x4fd3f1[_0x3039('0x25')]['id']){if(!_0x4fd3f1[_0x3039('0x55')]['oldPassword']||!_0x4fd3f1['body'][_0x3039('0x83')]){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x86'));}if(!_0x2fb8d0[_0x3039('0x87')](_0x4fd3f1[_0x3039('0x55')]['oldPassword'])){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x88'));}if(_0x4fd3f1[_0x3039('0x55')]['oldPassword']===_0x4fd3f1['body'][_0x3039('0x83')]){throw new db['Sequelize'][(_0x3039('0x85'))](_0x3039('0x89'));}}else if(_0x4fd3f1[_0x3039('0x25')][_0x3039('0x1f')]===_0x3039('0x23')){if(!_0x4fd3f1['body']['newPassword']){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x8a'));}}else if(_0x4fd3f1[_0x3039('0x25')][_0x3039('0x1f')]===_0x3039('0x25')){if(!_0x4fd3f1['body'][_0x3039('0x83')]){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x8a'));}if(_0x2fb8d0['role']!=='agent'){throw new db[(_0x3039('0x84'))]['ValidationError'](_0x3039('0x75'));}}else{throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))]('Unauthorized');}return _0x2fb8d0;})[_0x3039('0x30')](handleEntityNotFound(_0x22c603,null))[_0x3039('0x30')](function(_0x52e9aa){return db[_0x3039('0x5b')][_0x3039('0x8b')]({'attributes':['id',_0x3039('0x5d'),'enforcePasswordHistory',_0x3039('0x8c')]})[_0x3039('0x30')](function(_0x4a0c8a){if(_0x4a0c8a[_0x3039('0x5d')])authService['validatePasswordPattern'](_0x4fd3f1[_0x3039('0x55')][_0x3039('0x83')]);if(!_0x4a0c8a['enforcePasswordHistory']||!_0x52e9aa[_0x3039('0x8d')])return _0x52e9aa;authService[_0x3039('0x8e')](_0x4fd3f1['body']['newPassword'],_0x52e9aa['previousPasswords'],_0x4a0c8a[_0x3039('0x8c')]);return _0x52e9aa;})[_0x3039('0x30')](saveUpdates({'password':_0x4fd3f1[_0x3039('0x55')][_0x3039('0x83')],'passwordResetAt':_0x4fd3f1[_0x3039('0x25')]['id']==_0x4fd3f1[_0x3039('0x50')]['id']?moment():null,'previousPasswords':authService[_0x3039('0x8f')](_0x4fd3f1[_0x3039('0x55')]['newPassword'],_0x52e9aa['previousPasswords'])},null));})[_0x3039('0x30')](respondWithResult(_0x22c603,null))[_0x3039('0x4f')](handleError(_0x22c603,null));};exports['addQueues']=function(_0x4f9cb7,_0x3ab77f){var _0x1bb7f2=_0x4f9cb7[_0x3039('0x55')][_0x3039('0x90')];return db[_0x3039('0x34')]['find']({'where':{'id':_0x4f9cb7['params']['id']},'attributes':['id',_0x3039('0x32'),_0x3039('0x1f'),_0x3039('0x91'),_0x3039('0x92'),'voicePause',_0x3039('0x93')]})['then'](handleEntityNotFound(_0x3ab77f,null))['then'](function(_0xe316c6){if(_0xe316c6){if(!utils[_0x3039('0x94')](_0x1bb7f2)){throw new db[(_0x3039('0x84'))][(_0x3039('0x85'))](_0x3039('0x95'));}return _0xe316c6[_0x3039('0x96')+_[_0x3039('0x97')](_0x1bb7f2[_0x3039('0x98')]())+_0x3039('0x99')](_0x4f9cb7[_0x3039('0x55')]['ids'],{'penalty':_0x4f9cb7[_0x3039('0x55')]['penalty']||0x0})['spread'](function(_0x338a8b){for(var _0x37848e=0x0;_0x37848e<_0x4f9cb7['body'][_0x3039('0x58')][_0x3039('0x47')];_0x37848e+=0x1){var _0x359129={'UserId':Number(_0x4f9cb7[_0x3039('0x50')]['id'])};_0x359129[_[_0x3039('0x97')](_0x1bb7f2[_0x3039('0x98')]())+_0x3039('0x9a')]=Number(_0x4f9cb7[_0x3039('0x55')][_0x3039('0x58')][_0x37848e]);socket[_0x3039('0x20')](_0x3039('0x25')+_['capitalize'](_0x1bb7f2[_0x3039('0x98')]())+_0x3039('0x9b'),_0x359129);}return _0x338a8b;})['then'](function(){if(_0x1bb7f2===_0x3039('0x9c')){return db[_0x3039('0x9d')][_0x3039('0x44')]({'where':{'id':_0x4f9cb7[_0x3039('0x55')][_0x3039('0x58')]||[]},'raw':!![],'attributes':['id',_0x3039('0x32')]});}})[_0x3039('0x30')](function(_0x305006){var _0x36577f=_0xe316c6['get']({'plain':!![]});var _0xa060e7=[];if(_0x1bb7f2==='voice'&&_0x36577f[_0x3039('0x1f')]==='agent'&&_0x36577f[_0x3039('0x91')]){for(let _0x313ce5=0x0;_0x313ce5<_0x305006[_0x3039('0x47')];_0x313ce5+=0x1){_0xa060e7[_0x3039('0x48')]({'membername':_0x36577f['name'],'UserId':_0x36577f['id'],'queue_name':_0x305006[_0x313ce5][_0x3039('0x32')],'VoiceQueueId':_0x305006[_0x313ce5]['id'],'interface':_[_0x3039('0x64')](_0x36577f[_0x3039('0x93')])?util[_0x3039('0x9e')](_0x3039('0x9f'),_0x36577f[_0x3039('0x32')]):_0x36577f[_0x3039('0x93')],'paused':_0x36577f[_0x3039('0xa0')]||![],'penalty':_0x4f9cb7[_0x3039('0x55')]['penalty']||0x0});}return Promise['all'](_0xa060e7[_0x3039('0x2c')](function(_0x524ecf){return db[_0x3039('0xa1')]['upsert'](_0x524ecf);}));}return _0xe316c6;});}})[_0x3039('0x30')](respondWithStatusCode(_0x3ab77f,null))[_0x3039('0x4f')](handleError(_0x3ab77f,null));};exports[_0x3039('0xa2')]=function(_0x23c2de,_0x1eb4e4){var _0xc8fa10,_0x3df94d;return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x23c2de['params']['id']},'attributes':['id',_0x3039('0x32'),_0x3039('0x1f')]})[_0x3039('0x30')](handleEntityNotFound(_0x1eb4e4,null))[_0x3039('0x30')](function(_0x27e117){if(_0x27e117){_0xc8fa10=_0x27e117;if(!_0x23c2de[_0x3039('0x3c')]['channel']||!utils[_0x3039('0x94')](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')])){throw new db['Sequelize'][(_0x3039('0x85'))](_0x3039('0x95'));}return _0x27e117[_0x3039('0xa3')+_[_0x3039('0x97')](_0x23c2de['query'][_0x3039('0x90')][_0x3039('0x98')]())+_0x3039('0x99')](_0x23c2de[_0x3039('0x3c')][_0x3039('0x58')]);}})['then'](function(_0x71b08d){if(_[_0x3039('0xa4')](_0x23c2de['query'][_0x3039('0x58')])){for(var _0x13b65a=0x0;_0x13b65a<_0x23c2de[_0x3039('0x3c')][_0x3039('0x58')][_0x3039('0x47')];_0x13b65a+=0x1){_0x3df94d={'UserId':Number(_0x23c2de[_0x3039('0x50')]['id'])};_0x3df94d[_['capitalize'](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')][_0x3039('0x98')]())+'QueueId']=Number(_0x23c2de[_0x3039('0x3c')][_0x3039('0x58')][_0x13b65a]);socket[_0x3039('0x20')](_0x3039('0x25')+_[_0x3039('0x97')](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')][_0x3039('0x98')]())+_0x3039('0xa5'),_0x3df94d);}}else{_0x3df94d={'UserId':Number(_0x23c2de['params']['id'])};_0x3df94d[_['capitalize'](_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')][_0x3039('0x98')]())+_0x3039('0x9a')]=Number(_0x23c2de[_0x3039('0x3c')]['ids']);socket['emit'](_0x3039('0x25')+_[_0x3039('0x97')](_0x23c2de[_0x3039('0x3c')]['channel'][_0x3039('0x98')]())+_0x3039('0xa5'),_0x3df94d);}return _0x71b08d;})[_0x3039('0x30')](function(){if(_0x23c2de[_0x3039('0x3c')][_0x3039('0x90')]===_0x3039('0x9c')){return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'UserId':_0x23c2de[_0x3039('0x50')]['id'],'VoiceQueueId':_0x23c2de[_0x3039('0x3c')]['ids']},'individualHooks':!![]})[_0x3039('0x30')](function(){return _0xc8fa10;});}return _0xc8fa10;})[_0x3039('0x30')](respondWithStatusCode(_0x1eb4e4,null))[_0x3039('0x4f')](handleError(_0x1eb4e4,null));};exports[_0x3039('0xa7')]=function(_0x444547,_0xdac50b){_0x444547['body'][_0x3039('0xa8')]=_0x444547[_0x3039('0xa9')][_0x3039('0xaa')];return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x444547[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0xdac50b,null))[_0x3039('0x30')](saveUpdates(_0x444547[_0x3039('0x55')],null))[_0x3039('0x30')](respondWithResult(_0xdac50b,null))[_0x3039('0x4f')](handleError(_0xdac50b,null));};exports[_0x3039('0xab')]=function(_0x2dc559,_0x1501d6){var _0x5a5709=path['join'](config[_0x3039('0xac')],'server/files/images/logos/default_profile.png');return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x2dc559[_0x3039('0x50')]['id']},'attributes':['id',_0x3039('0xa8')],'raw':!![]})[_0x3039('0x30')](handleEntityNotFound(_0x1501d6,null))[_0x3039('0x30')](function(_0x2c76c8){if(_0x2c76c8){if(_[_0x3039('0x64')](_0x2c76c8[_0x3039('0xa8')])){return _0x1501d6[_0x3039('0xad')](_0x5a5709);}else{if(!fs[_0x3039('0xae')](path[_0x3039('0xaf')](config['root'],_0x3039('0xb0'),_0x2c76c8['userpic']))){return _0x1501d6[_0x3039('0xad')](_0x5a5709);}return _0x1501d6[_0x3039('0xad')](path[_0x3039('0xaf')](config[_0x3039('0xac')],_0x3039('0xb0'),_0x2c76c8[_0x3039('0xa8')]));}}})[_0x3039('0x4f')](handleError(_0x1501d6,null));};exports[_0x3039('0xb1')]=function(_0x1c06c2,_0x51a3be){return db[_0x3039('0x34')]['find']({'where':{'id':_0x1c06c2[_0x3039('0x50')]['id']},'attributes':['id']})[_0x3039('0x30')](handleEntityNotFound(_0x51a3be,null))[_0x3039('0x30')](function(_0x3ce5b1){var _0x1bfc7c=[];values=_0x3ce5b1['dataValues'];_0x1bfc7c[_0x3039('0x48')](get_open_tabs('chat',_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs('sms',_0x3ce5b1['dataValues']));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x4c'),_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x4d'),_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x4b'),_0x3ce5b1[_0x3039('0x49')]));_0x1bfc7c[_0x3039('0x48')](get_open_tabs(_0x3039('0x54'),_0x3ce5b1[_0x3039('0x49')]));return Promise['all'](_0x1bfc7c);})[_0x3039('0x30')](function(_0x40a3ec){if(_0x40a3ec){var _0x48554a=_['map'](values[_0x3039('0xb2')],function(_0x180e06){return{'channel':_0x3039('0xb3'),'id':_0x180e06['id'],'createdAt':_0x180e06[_0x3039('0xb4')]};});var _0x3477c9=_[_0x3039('0x2c')](values['FaxOpenTabs'],function(_0x5b3c7f){return{'channel':_0x3039('0xb5'),'id':_0x5b3c7f['id'],'createdAt':_0x5b3c7f['createdAt']};});var _0x2a28e2=_[_0x3039('0x2c')](values[_0x3039('0xb6')],function(_0x4ac7af){return{'channel':'OPENCHANNEL','id':_0x4ac7af['id'],'createdAt':_0x4ac7af[_0x3039('0xb4')]};});var _0xbfa531=_[_0x3039('0x2c')](values[_0x3039('0xb7')],function(_0x27bfdc){return{'channel':_0x3039('0xb8'),'id':_0x27bfdc['id'],'createdAt':_0x27bfdc[_0x3039('0xb4')]};});var _0x5af399=_[_0x3039('0x2c')](values[_0x3039('0xb9')],function(_0x376363){return{'channel':_0x3039('0xba'),'id':_0x376363['id'],'createdAt':_0x376363[_0x3039('0xb4')]};});var _0x55b5da=_[_0x3039('0x2c')](values['WhatsappOpenTabs'],function(_0x2d2719){return{'channel':_0x3039('0xbb'),'id':_0x2d2719['id'],'createdAt':_0x2d2719['createdAt']};});var _0x30cdbb=_[_0x3039('0xbc')](_0x48554a,_0x3477c9,_0x2a28e2,_0xbfa531,_0x5af399,_0x55b5da);var _0x5e34d4={'count':_0x30cdbb[_0x3039('0x47')],'rows':_0x30cdbb};return _0x5e34d4;}else return null;})[_0x3039('0x30')](respondWithResult(_0x51a3be,null))['catch'](handleError(_0x51a3be,null));};exports[_0x3039('0xbd')]=function(_0x580da9,_0x4675fd){var _0x11cfd2={};return db['User'][_0x3039('0x8b')]({'where':{'id':_0x580da9['params']['id']}})[_0x3039('0x30')](function(_0x4bb585){if(!_0x4bb585){throw new APINotFoundError(util[_0x3039('0x9e')](_0x3039('0xbe'),_0x580da9['params']['id']));}return contacts[_0x3039('0x56')]();})['then'](function(_0x10c36d){_0x580da9['query'][_0x3039('0x34')]=_0x580da9[_0x3039('0x50')]['id'];_0x11cfd2=qs['getOptions'](_0x10c36d,_0x580da9);if(_0x580da9[_0x3039('0x3c')]['hasOwnProperty'](_0x3039('0x3d'))){_0x11cfd2[_0x3039('0x3e')]=[{'model':db['CmList'],'as':_0x3039('0xbf'),'required':![]},{'model':db[_0x3039('0xc0')],'as':_0x3039('0xc1'),'attributes':['id','name','color'],'where':_0x580da9[_0x3039('0x3c')][_0x3039('0xc2')]?{'id':_0x580da9[_0x3039('0x3c')][_0x3039('0xc2')]}:undefined,'required':_0x580da9[_0x3039('0x3c')][_0x3039('0xc2')]?!![]:![]}];}return contacts['findAll'](_0x580da9[_0x3039('0x3c')],_0x580da9[_0x3039('0x25')],_0x11cfd2,_0x10c36d);})[_0x3039('0x30')](respondWithFilteredResult(_0x4675fd,_0x11cfd2))[_0x3039('0x4f')](APIHandleError(_0x4675fd));};exports[_0x3039('0xc3')]=function(_0x1308c6,_0x5b8f66){var _0x43b696;var _0x5910a9={};var _0x40d1de;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1308c6[_0x3039('0x50')]['id']},'attributes':['id',_0x3039('0x32'),'role']})[_0x3039('0x30')](handleEntityNotFound(_0x5b8f66,null))['then'](function(_0xe921ca){if(!utils[_0x3039('0x94')](_0x1308c6[_0x3039('0x3c')][_0x3039('0x90')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}_0x43b696=_0xe921ca;var _0xa0698d={};_0xa0698d[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_['capitalize'](_0x1308c6[_0x3039('0x3c')][_0x3039('0x90')])+'Queue'][_0x3039('0x35')]);_0xa0698d['query']=_[_0x3039('0xc5')](_0x1308c6[_0x3039('0x3c')]);_0xa0698d['filters']=_[_0x3039('0xc6')](_0xa0698d[_0x3039('0xc4')],_0xa0698d[_0x3039('0x3c')]);_0x5910a9[_0x3039('0x43')]=_[_0x3039('0xc6')](_0xa0698d[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x1308c6['query'][_0x3039('0xc7')]));_0x5910a9[_0x3039('0x43')]=_0x5910a9[_0x3039('0x43')][_0x3039('0x47')]?_0x5910a9['attributes']:_0xa0698d[_0x3039('0xc4')];_0x5910a9[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x1308c6[_0x3039('0x3c')]['sort']);_0x5910a9[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x1308c6[_0x3039('0x3c')],_0xa0698d[_0x3039('0xca')]));if(_0x1308c6[_0x3039('0x3c')]['filter']){_0x5910a9[_0x3039('0x3b')]=_['merge'](_0x5910a9[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x5910a9[_0x3039('0x43')],function(_0x910ad7){var _0x6cb2cd={};_0x6cb2cd[_0x910ad7]={'$like':'%'+_0x1308c6[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x6cb2cd;})});}_0x5910a9=_[_0x3039('0x51')]({},_0x5910a9,_0x1308c6[_0x3039('0x52')]);switch(_0x43b696['role']){case'admin':return db[_['capitalize'](_0x1308c6[_0x3039('0x3c')][_0x3039('0x90')])+_0x3039('0xcc')][_0x3039('0x44')](_0x5910a9);case _0x3039('0x25'):case'agent':return _0x43b696[_0x3039('0x22')+_['capitalize'](_0x1308c6['query'][_0x3039('0x90')])+'Queues'](_0x5910a9);default:throw new db[(_0x3039('0x84'))]['ValidationError']('Unknown\x20role');}})[_0x3039('0x30')](function(_0x28942a){_0x40d1de=_0x28942a[_0x3039('0x47')];if(!_0x1308c6['query'][_0x3039('0xcd')]('nolimit')){_0x5910a9['limit']=qs[_0x3039('0x1b')](_0x1308c6[_0x3039('0x3c')][_0x3039('0x1b')]);_0x5910a9[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x1308c6[_0x3039('0x3c')][_0x3039('0x19')]);}switch(_0x43b696[_0x3039('0x1f')]){case _0x3039('0x23'):return db[_[_0x3039('0x97')](_0x1308c6[_0x3039('0x3c')]['channel'])+'Queue'][_0x3039('0x44')](_0x5910a9);case'user':case'agent':return _0x43b696[_0x3039('0x22')+_[_0x3039('0x97')](_0x1308c6['query'][_0x3039('0x90')])+_0x3039('0x99')](_0x5910a9);}})[_0x3039('0x30')](function(_0x5b9535){return{'count':_0x40d1de,'rows':_0x5b9535};})[_0x3039('0x30')](respondWithResult(_0x5b8f66,null))[_0x3039('0x4f')](handleError(_0x5b8f66,null));};exports['getVoiceQueuesRt']=function(_0x2a155c,_0x426ac3){var _0x3826e1={};var _0x28c139={};var _0x15ce4a;var _0x36929e;return db[_0x3039('0x34')]['findOne']({'where':{'id':_0x2a155c['params']['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x426ac3,null))[_0x3039('0x30')](function(_0x337f8f){if(_0x337f8f){_0x15ce4a=_0x337f8f;_0x28c139[_0x3039('0xc4')]=_[_0x3039('0xc5')](db['UserVoiceQueueRt']['rawAttributes']);_0x28c139[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x2a155c[_0x3039('0x3c')]);_0x28c139[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x28c139[_0x3039('0xc4')],_0x28c139['query']);_0x3826e1[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x28c139[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x2a155c[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3826e1[_0x3039('0x43')]=_0x3826e1[_0x3039('0x43')][_0x3039('0x47')]?_0x3826e1[_0x3039('0x43')]:_0x28c139[_0x3039('0xc4')];_0x3826e1[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x2a155c[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3826e1[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x2a155c['query'],_0x28c139[_0x3039('0xca')]));if(_0x2a155c[_0x3039('0x3c')]['filter']){_0x3826e1[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x3826e1[_0x3039('0x3b')],{'$or':_['map'](_0x3826e1[_0x3039('0x43')],function(_0x5dbb10){var _0x2ea0a4={};_0x2ea0a4[_0x5dbb10]={'$like':'%'+_0x2a155c[_0x3039('0x3c')]['filter']+'%'};return _0x2ea0a4;})});}_0x3826e1=_[_0x3039('0x51')]({},_0x3826e1,_0x2a155c[_0x3039('0x52')]);return _0x15ce4a[_0x3039('0xce')](_0x3826e1);}})[_0x3039('0x30')](function(_0xbc3b96){if(_0xbc3b96){_0x36929e=_0xbc3b96[_0x3039('0x47')];if(!_0x2a155c[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3826e1[_0x3039('0x1b')]=qs['limit'](_0x2a155c[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3826e1[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x2a155c[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x15ce4a[_0x3039('0xce')](_0x3826e1);}})[_0x3039('0x30')](function(_0x529e7d){if(_0x529e7d){return _0x529e7d?{'count':_0x36929e,'rows':_0x529e7d}:null;}})[_0x3039('0x30')](respondWithResult(_0x426ac3,null))['catch'](handleError(_0x426ac3,null));};exports[_0x3039('0xd0')]=function(_0x1c63a1,_0x4efd1f){var _0xc0d5d9={};var _0x4075c2={};var _0x45fcc5;var _0x28206b;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1c63a1[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x4efd1f,null))[_0x3039('0x30')](function(_0x51cb0f){if(_0x51cb0f){_0x45fcc5=_0x51cb0f;_0x4075c2[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0xd1')][_0x3039('0x35')]);_0x4075c2[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x1c63a1['query']);_0x4075c2[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x4075c2[_0x3039('0xc4')],_0x4075c2[_0x3039('0x3c')]);_0xc0d5d9['attributes']=_['intersection'](_0x4075c2['model'],qs[_0x3039('0xc7')](_0x1c63a1[_0x3039('0x3c')][_0x3039('0xc7')]));_0xc0d5d9[_0x3039('0x43')]=_0xc0d5d9[_0x3039('0x43')][_0x3039('0x47')]?_0xc0d5d9[_0x3039('0x43')]:_0x4075c2[_0x3039('0xc4')];_0xc0d5d9[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x1c63a1['query'][_0x3039('0xc9')]);_0xc0d5d9[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x1c63a1[_0x3039('0x3c')],_0x4075c2[_0x3039('0xca')]));if(_0x1c63a1[_0x3039('0x3c')]['filter']){_0xc0d5d9[_0x3039('0x3b')]=_['merge'](_0xc0d5d9['where'],{'$or':_[_0x3039('0x2c')](_0xc0d5d9[_0x3039('0x43')],function(_0x513a87){var _0x2e3648={};_0x2e3648[_0x513a87]={'$like':'%'+_0x1c63a1['query'][_0x3039('0x2a')]+'%'};return _0x2e3648;})});}_0xc0d5d9=_['merge']({},_0xc0d5d9,_0x1c63a1['options']);return _0x45fcc5[_0x3039('0xd0')](_0xc0d5d9);}})[_0x3039('0x30')](function(_0x4b6f17){if(_0x4b6f17){_0x28206b=_0x4b6f17[_0x3039('0x47')];if(!_0x1c63a1[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0xc0d5d9[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x1c63a1[_0x3039('0x3c')][_0x3039('0x1b')]);_0xc0d5d9['offset']=qs[_0x3039('0x19')](_0x1c63a1[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x45fcc5['getGroups'](_0xc0d5d9);}})['then'](function(_0x1c94b1){if(_0x1c94b1){return _0x1c94b1?{'count':_0x28206b,'rows':_0x1c94b1}:null;}})['then'](respondWithResult(_0x4efd1f,null))['catch'](handleError(_0x4efd1f,null));};exports[_0x3039('0xd2')]=function(_0x19c25c,_0x3314cb){var _0x3b2cf0={'raw':!![],'where':{}};var _0x4f60b5={};var _0x453c9c={'count':0x0,'rows':[]};return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x19c25c[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x3314cb,null))[_0x3039('0x30')](function(_0x5d384a){if(_0x5d384a){_0x4f60b5['model']=_['keys'](db[_0x3039('0xd3')][_0x3039('0x35')]);_0x4f60b5[_0x3039('0x3c')]=_['keys'](_0x19c25c[_0x3039('0x3c')]);_0x4f60b5[_0x3039('0xca')]=_['intersection'](_0x4f60b5[_0x3039('0xc4')],_0x4f60b5[_0x3039('0x3c')]);_0x3b2cf0[_0x3039('0x43')]=_['intersection'](_0x4f60b5[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x19c25c[_0x3039('0x3c')]['fields']));_0x3b2cf0[_0x3039('0x43')]=_0x3b2cf0[_0x3039('0x43')][_0x3039('0x47')]?_0x3b2cf0['attributes']:_0x4f60b5[_0x3039('0xc4')];if(!_0x19c25c[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3b2cf0['limit']=qs[_0x3039('0x1b')](_0x19c25c[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3b2cf0[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x19c25c[_0x3039('0x3c')][_0x3039('0x19')]);}_0x3b2cf0['order']=qs[_0x3039('0xc9')](_0x19c25c[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3b2cf0[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x19c25c[_0x3039('0x3c')],_0x4f60b5[_0x3039('0xca')]));_0x3b2cf0[_0x3039('0x3b')][_0x3039('0xd4')]=_0x5d384a['id'];if(_0x19c25c[_0x3039('0x3c')][_0x3039('0x2a')]){_0x3b2cf0['where']=_[_0x3039('0x51')](_0x3b2cf0[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x3b2cf0[_0x3039('0x43')],function(_0x840151){var _0xc6ce2={};_0xc6ce2[_0x840151]={'$like':'%'+_0x19c25c[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0xc6ce2;})});}_0x3b2cf0=_['merge']({},_0x3b2cf0,_0x19c25c[_0x3039('0x52')]);return db[_0x3039('0xd3')][_0x3039('0x1c')]({'where':_0x3b2cf0[_0x3039('0x3b')]})[_0x3039('0x30')](function(_0x78e2f){_0x453c9c['count']=_0x78e2f;if(_0x19c25c[_0x3039('0x3c')][_0x3039('0x3d')]){_0x3b2cf0[_0x3039('0x3e')]=[{'all':!![]}];}return db[_0x3039('0xd3')][_0x3039('0x44')](_0x3b2cf0);})[_0x3039('0x30')](function(_0x1e122e){_0x453c9c['rows']=_0x1e122e;return _0x453c9c;});}})[_0x3039('0x30')](respondWithFilteredResult(_0x3314cb,_0x3b2cf0))[_0x3039('0x4f')](handleError(_0x3314cb,null));};exports[_0x3039('0xd5')]=function(_0x76808c,_0x336d08){var _0x241a10={'raw':!![],'where':{}};var _0x26bdf8={};var _0x6a0622={'count':0x0,'rows':[]};return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x76808c[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x336d08,null))['then'](function(_0x250d60){if(_0x250d60){_0x26bdf8[_0x3039('0xc4')]=_[_0x3039('0xc5')](db['ScreenRecording'][_0x3039('0x35')]);_0x26bdf8['query']=_['keys'](_0x76808c[_0x3039('0x3c')]);_0x26bdf8[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x26bdf8[_0x3039('0xc4')],_0x26bdf8[_0x3039('0x3c')]);_0x241a10[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x26bdf8[_0x3039('0xc4')],qs['fields'](_0x76808c[_0x3039('0x3c')]['fields']));_0x241a10[_0x3039('0x43')]=_0x241a10['attributes']['length']?_0x241a10[_0x3039('0x43')]:_0x26bdf8['model'];if(!_0x76808c[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x241a10[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x76808c[_0x3039('0x3c')][_0x3039('0x1b')]);_0x241a10['offset']=qs['offset'](_0x76808c[_0x3039('0x3c')]['offset']);}_0x241a10[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x76808c['query'][_0x3039('0xc9')]);_0x241a10['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x76808c[_0x3039('0x3c')],_0x26bdf8[_0x3039('0xca')]));_0x241a10[_0x3039('0x3b')]['UserId']=_0x250d60['id'];if(_0x76808c[_0x3039('0x3c')]['filter']){_0x241a10[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x241a10[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x241a10[_0x3039('0x43')],function(_0x6ad512){var _0x56158f={};_0x56158f[_0x6ad512]={'$like':'%'+_0x76808c[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x56158f;})});}_0x241a10=_['merge']({},_0x241a10,_0x76808c[_0x3039('0x52')]);return db[_0x3039('0xd6')][_0x3039('0x1c')]({'where':_0x241a10[_0x3039('0x3b')]})[_0x3039('0x30')](function(_0x2cc895){_0x6a0622[_0x3039('0x1c')]=_0x2cc895;if(_0x76808c['query']['includeAll']){_0x241a10[_0x3039('0x3e')]=[{'all':!![]}];}return db[_0x3039('0xd6')][_0x3039('0x44')](_0x241a10);})['then'](function(_0x22f7b2){_0x6a0622[_0x3039('0x45')]=_0x22f7b2;return _0x6a0622;});}})[_0x3039('0x30')](respondWithFilteredResult(_0x336d08,_0x241a10))[_0x3039('0x4f')](handleError(_0x336d08,null));};exports[_0x3039('0xd7')]=function(_0x3a3948,_0x2071ff){var _0x3f5519={};var _0x1bcf89={};var _0x1e7b5f;var _0x559043;return db['User'][_0x3039('0x8b')]({'where':{'id':_0x3a3948[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x2071ff,null))[_0x3039('0x30')](function(_0x44d536){if(_0x44d536){_0x1e7b5f=_0x44d536;_0x1bcf89['model']=_['keys'](db[_0x3039('0xd8')][_0x3039('0x35')]);_0x1bcf89[_0x3039('0x3c')]=_['keys'](_0x3a3948[_0x3039('0x3c')]);_0x1bcf89[_0x3039('0xca')]=_['intersection'](_0x1bcf89[_0x3039('0xc4')],_0x1bcf89['query']);_0x3f5519['attributes']=_[_0x3039('0xc6')](_0x1bcf89[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x3a3948[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3f5519[_0x3039('0x43')]=_0x3f5519[_0x3039('0x43')][_0x3039('0x47')]?_0x3f5519[_0x3039('0x43')]:_0x1bcf89[_0x3039('0xc4')];_0x3f5519['order']=qs[_0x3039('0xc9')](_0x3a3948[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3f5519[_0x3039('0x3b')]=qs['filters'](_[_0x3039('0xcb')](_0x3a3948['query'],_0x1bcf89['filters']));if(_0x3a3948[_0x3039('0x3c')][_0x3039('0x2a')]){_0x3f5519[_0x3039('0x3b')]=_['merge'](_0x3f5519['where'],{'$or':_[_0x3039('0x2c')](_0x3f5519[_0x3039('0x43')],function(_0x16ba3d){var _0x4addd3={};_0x4addd3[_0x16ba3d]={'$like':'%'+_0x3a3948[_0x3039('0x3c')]['filter']+'%'};return _0x4addd3;})});}_0x3f5519=_['merge']({},_0x3f5519,_0x3a3948[_0x3039('0x52')]);return _0x1e7b5f[_0x3039('0xd7')](_0x3f5519);}})[_0x3039('0x30')](function(_0x52072f){if(_0x52072f){_0x559043=_0x52072f[_0x3039('0x47')];if(!_0x3a3948[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3f5519[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x3a3948['query'][_0x3039('0x1b')]);_0x3f5519[_0x3039('0x19')]=qs['offset'](_0x3a3948[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x1e7b5f['getChatInteractions'](_0x3f5519);}})[_0x3039('0x30')](function(_0x1aa9cc){if(_0x1aa9cc){return _0x1aa9cc?{'count':_0x559043,'rows':_0x1aa9cc}:null;}})[_0x3039('0x30')](respondWithResult(_0x2071ff,null))[_0x3039('0x4f')](handleError(_0x2071ff,null));};exports[_0x3039('0xd9')]=function(_0x1bab5d,_0x2a0a85){var _0x1743b1={};var _0x18bd6={};var _0x2782aa;var _0x3f9663;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1bab5d[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x2a0a85,null))[_0x3039('0x30')](function(_0x15bfdd){if(_0x15bfdd){_0x2782aa=_0x15bfdd;_0x18bd6['model']=_['keys'](db[_0x3039('0xda')][_0x3039('0x35')]);_0x18bd6[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x1bab5d[_0x3039('0x3c')]);_0x18bd6[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x18bd6['model'],_0x18bd6[_0x3039('0x3c')]);_0x1743b1[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x18bd6['model'],qs[_0x3039('0xc7')](_0x1bab5d['query']['fields']));_0x1743b1[_0x3039('0x43')]=_0x1743b1[_0x3039('0x43')]['length']?_0x1743b1[_0x3039('0x43')]:_0x18bd6[_0x3039('0xc4')];_0x1743b1[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x1bab5d['query'][_0x3039('0xc9')]);_0x1743b1['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x1bab5d['query'],_0x18bd6[_0x3039('0xca')]));if(_0x1bab5d[_0x3039('0x3c')]['filter']){_0x1743b1['where']=_[_0x3039('0x51')](_0x1743b1[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x1743b1[_0x3039('0x43')],function(_0xa2c571){var _0x14a024={};_0x14a024[_0xa2c571]={'$like':'%'+_0x1bab5d[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x14a024;})});}_0x1743b1=_[_0x3039('0x51')]({},_0x1743b1,_0x1bab5d[_0x3039('0x52')]);return _0x2782aa[_0x3039('0xd9')](_0x1743b1);}})['then'](function(_0x11c4a7){if(_0x11c4a7){_0x3f9663=_0x11c4a7['length'];if(!_0x1bab5d[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x1743b1[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x1bab5d[_0x3039('0x3c')][_0x3039('0x1b')]);_0x1743b1['offset']=qs[_0x3039('0x19')](_0x1bab5d[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x2782aa[_0x3039('0xd9')](_0x1743b1);}})[_0x3039('0x30')](function(_0x469477){if(_0x469477){return _0x469477?{'count':_0x3f9663,'rows':_0x469477}:null;}})['then'](respondWithResult(_0x2a0a85,null))[_0x3039('0x4f')](handleError(_0x2a0a85,null));};exports[_0x3039('0xdb')]=function(_0xd72ab7,_0x293f52){var _0x197aed={'raw':!![],'where':{}};var _0x5e284c={};var _0x27e7b4={'count':0x0,'rows':[]};return db[_0x3039('0x34')]['findOne']({'where':{'id':_0xd72ab7[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x293f52,null))[_0x3039('0x30')](function(_0x4b991a){if(_0x4b991a){_0x5e284c[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0xdc')][_0x3039('0x35')]);_0x5e284c[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0xd72ab7[_0x3039('0x3c')]);_0x5e284c['filters']=_[_0x3039('0xc6')](_0x5e284c[_0x3039('0xc4')],_0x5e284c[_0x3039('0x3c')]);_0x197aed[_0x3039('0x43')]=_['intersection'](_0x5e284c[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0xd72ab7[_0x3039('0x3c')]['fields']));_0x197aed['attributes']=_0x197aed['attributes'][_0x3039('0x47')]?_0x197aed[_0x3039('0x43')]:_0x5e284c[_0x3039('0xc4')];if(!_0xd72ab7[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x197aed[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0xd72ab7[_0x3039('0x3c')][_0x3039('0x1b')]);_0x197aed[_0x3039('0x19')]=qs['offset'](_0xd72ab7[_0x3039('0x3c')][_0x3039('0x19')]);}_0x197aed['order']=qs[_0x3039('0xc9')](_0xd72ab7['query']['sort']);_0x197aed[_0x3039('0x3b')]=qs[_0x3039('0xca')](_['pick'](_0xd72ab7[_0x3039('0x3c')],_0x5e284c[_0x3039('0xca')]));_0x197aed[_0x3039('0x3b')][_0x3039('0xd4')]=_0x4b991a['id'];if(_0xd72ab7['query'][_0x3039('0x2a')]){_0x197aed['where']=_[_0x3039('0x51')](_0x197aed[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x197aed['attributes'],function(_0x456b43){var _0x5a0426={};_0x5a0426[_0x456b43]={'$like':'%'+_0xd72ab7[_0x3039('0x3c')]['filter']+'%'};return _0x5a0426;})});}_0x197aed=_['merge']({},_0x197aed,_0xd72ab7[_0x3039('0x52')]);return db[_0x3039('0xdc')]['count']({'where':_0x197aed[_0x3039('0x3b')]})[_0x3039('0x30')](function(_0x2e8eab){_0x27e7b4[_0x3039('0x1c')]=_0x2e8eab;if(_0xd72ab7[_0x3039('0x3c')][_0x3039('0x3d')]){_0x197aed[_0x3039('0x3e')]=[{'all':!![]}];}return db[_0x3039('0xdc')][_0x3039('0x44')](_0x197aed);})[_0x3039('0x30')](function(_0x196f7f){_0x27e7b4[_0x3039('0x45')]=_0x196f7f;return _0x27e7b4;});}})['then'](respondWithFilteredResult(_0x293f52,_0x197aed))[_0x3039('0x4f')](handleError(_0x293f52,null));};exports[_0x3039('0xdd')]=function(_0x2bc9d6,_0x31e4f5){var _0x34c92d={};var _0x4aaa8e={};var _0x10563b;var _0x2cff00;return db['User'][_0x3039('0x8b')]({'where':{'id':_0x2bc9d6[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x31e4f5,null))[_0x3039('0x30')](function(_0x514af1){if(_0x514af1){_0x10563b=_0x514af1;_0x4aaa8e[_0x3039('0xc4')]=_[_0x3039('0xc5')](db['SmsInteraction'][_0x3039('0x35')]);_0x4aaa8e[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x2bc9d6[_0x3039('0x3c')]);_0x4aaa8e['filters']=_[_0x3039('0xc6')](_0x4aaa8e['model'],_0x4aaa8e[_0x3039('0x3c')]);_0x34c92d[_0x3039('0x43')]=_['intersection'](_0x4aaa8e[_0x3039('0xc4')],qs['fields'](_0x2bc9d6[_0x3039('0x3c')][_0x3039('0xc7')]));_0x34c92d['attributes']=_0x34c92d[_0x3039('0x43')][_0x3039('0x47')]?_0x34c92d[_0x3039('0x43')]:_0x4aaa8e['model'];_0x34c92d[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x2bc9d6[_0x3039('0x3c')][_0x3039('0xc9')]);_0x34c92d['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x2bc9d6[_0x3039('0x3c')],_0x4aaa8e['filters']));if(_0x2bc9d6['query']['filter']){_0x34c92d[_0x3039('0x3b')]=_['merge'](_0x34c92d['where'],{'$or':_[_0x3039('0x2c')](_0x34c92d[_0x3039('0x43')],function(_0x1c2d2b){var _0xf05bfb={};_0xf05bfb[_0x1c2d2b]={'$like':'%'+_0x2bc9d6[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0xf05bfb;})});}_0x34c92d=_[_0x3039('0x51')]({},_0x34c92d,_0x2bc9d6[_0x3039('0x52')]);return _0x10563b[_0x3039('0xdd')](_0x34c92d);}})[_0x3039('0x30')](function(_0x592947){if(_0x592947){_0x2cff00=_0x592947[_0x3039('0x47')];if(!_0x2bc9d6[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x34c92d[_0x3039('0x1b')]=qs['limit'](_0x2bc9d6['query'][_0x3039('0x1b')]);_0x34c92d[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x2bc9d6[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x10563b['getSmsInteractions'](_0x34c92d);}})['then'](function(_0x3ea931){if(_0x3ea931){return _0x3ea931?{'count':_0x2cff00,'rows':_0x3ea931}:null;}})[_0x3039('0x30')](respondWithResult(_0x31e4f5,null))['catch'](handleError(_0x31e4f5,null));};exports[_0x3039('0xde')]=function(_0x456260,_0x3f8645){var _0x3d9b1d={};var _0x134ece={};var _0x131bed;var _0x38ead9;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x456260[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x3f8645,null))['then'](function(_0x283840){if(_0x283840){_0x131bed=_0x283840;_0x134ece['model']=_[_0x3039('0xc5')](db[_0x3039('0xdf')]['rawAttributes']);_0x134ece[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x456260[_0x3039('0x3c')]);_0x134ece[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x134ece[_0x3039('0xc4')],_0x134ece['query']);_0x3d9b1d['attributes']=_[_0x3039('0xc6')](_0x134ece['model'],qs[_0x3039('0xc7')](_0x456260[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3d9b1d[_0x3039('0x43')]=_0x3d9b1d['attributes'][_0x3039('0x47')]?_0x3d9b1d[_0x3039('0x43')]:_0x134ece[_0x3039('0xc4')];_0x3d9b1d[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x456260[_0x3039('0x3c')]['sort']);_0x3d9b1d[_0x3039('0x3b')]=qs['filters'](_[_0x3039('0xcb')](_0x456260['query'],_0x134ece[_0x3039('0xca')]));if(_0x456260[_0x3039('0x3c')]['filter']){_0x3d9b1d[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x3d9b1d[_0x3039('0x3b')],{'$or':_['map'](_0x3d9b1d[_0x3039('0x43')],function(_0x175884){var _0x2ffc2a={};_0x2ffc2a[_0x175884]={'$like':'%'+_0x456260[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x2ffc2a;})});}_0x3d9b1d=_[_0x3039('0x51')]({},_0x3d9b1d,_0x456260[_0x3039('0x52')]);return _0x131bed[_0x3039('0xde')](_0x3d9b1d);}})[_0x3039('0x30')](function(_0x30b207){if(_0x30b207){_0x38ead9=_0x30b207[_0x3039('0x47')];if(!_0x456260['query'][_0x3039('0xcd')]('nolimit')){_0x3d9b1d[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x456260[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3d9b1d[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x456260[_0x3039('0x3c')]['offset']);}return _0x131bed[_0x3039('0xde')](_0x3d9b1d);}})[_0x3039('0x30')](function(_0x14dd49){if(_0x14dd49){return _0x14dd49?{'count':_0x38ead9,'rows':_0x14dd49}:null;}})['then'](respondWithResult(_0x3f8645,null))['catch'](handleError(_0x3f8645,null));};exports['getWhatsappInteractions']=function(_0x208dd6,_0x1cac2b){var _0x3a65d2={};var _0x42cea4={};var _0x49afb1;var _0x3b87cb;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x208dd6[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x1cac2b,null))[_0x3039('0x30')](function(_0x35d5f8){if(_0x35d5f8){_0x49afb1=_0x35d5f8;_0x42cea4[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0xe0')][_0x3039('0x35')]);_0x42cea4[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x208dd6[_0x3039('0x3c')]);_0x42cea4[_0x3039('0xca')]=_['intersection'](_0x42cea4[_0x3039('0xc4')],_0x42cea4[_0x3039('0x3c')]);_0x3a65d2[_0x3039('0x43')]=_[_0x3039('0xc6')](_0x42cea4[_0x3039('0xc4')],qs[_0x3039('0xc7')](_0x208dd6[_0x3039('0x3c')][_0x3039('0xc7')]));_0x3a65d2[_0x3039('0x43')]=_0x3a65d2['attributes'][_0x3039('0x47')]?_0x3a65d2[_0x3039('0x43')]:_0x42cea4[_0x3039('0xc4')];_0x3a65d2[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x208dd6[_0x3039('0x3c')][_0x3039('0xc9')]);_0x3a65d2['where']=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x208dd6[_0x3039('0x3c')],_0x42cea4[_0x3039('0xca')]));if(_0x208dd6['query'][_0x3039('0x2a')]){_0x3a65d2[_0x3039('0x3b')]=_['merge'](_0x3a65d2[_0x3039('0x3b')],{'$or':_[_0x3039('0x2c')](_0x3a65d2['attributes'],function(_0x3d9260){var _0x357865={};_0x357865[_0x3d9260]={'$like':'%'+_0x208dd6['query']['filter']+'%'};return _0x357865;})});}_0x3a65d2=_[_0x3039('0x51')]({},_0x3a65d2,_0x208dd6['options']);return _0x49afb1['getWhatsappInteractions'](_0x3a65d2);}})[_0x3039('0x30')](function(_0x11b5b2){if(_0x11b5b2){_0x3b87cb=_0x11b5b2[_0x3039('0x47')];if(!_0x208dd6[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x3a65d2['limit']=qs[_0x3039('0x1b')](_0x208dd6[_0x3039('0x3c')][_0x3039('0x1b')]);_0x3a65d2[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x208dd6[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x49afb1['getWhatsappInteractions'](_0x3a65d2);}})['then'](function(_0x2b28e5){if(_0x2b28e5){return _0x2b28e5?{'count':_0x3b87cb,'rows':_0x2b28e5}:null;}})[_0x3039('0x30')](respondWithResult(_0x1cac2b,null))[_0x3039('0x4f')](handleError(_0x1cac2b,null));};exports[_0x3039('0xe1')]=function(_0x226465,_0x3789b9,_0x2d89d9){var _0x3dc0e5;var _0x4413c7;var _0x5b9392;var _0x45e50d=!_[_0x3039('0x64')](_0x226465[_0x3039('0x50')]['id'])?_0x226465['params']['id']:!_['isNil'](_0x226465[_0x3039('0x25')]['id'])?_0x226465[_0x3039('0x25')]['id']:null;return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x45e50d,'role':{'$or':[_0x3039('0x23'),'user',_0x3039('0x27')]}},'attributes':['id','name',_0x3039('0xe2'),'mobile',_0x3039('0x1f'),_0x3039('0x5a'),'loginInPause']})['then'](function(_0x389635){if(_0x389635){if(_0x389635[_0x3039('0x1f')]===_0x3039('0x27')){_0x3dc0e5=_0x389635;if(_0x226465[_0x3039('0x55')][_0x3039('0x93')]){_0x5b9392=util['format'](_0x3039('0xe3'),_0x3dc0e5[_0x226465[_0x3039('0x55')][_0x3039('0x93')]]);}else if(_0x226465[_0x3039('0x55')][_0x3039('0xe4')]){_0x5b9392=util[_0x3039('0x9e')](_0x3039('0x9f'),_0x226465['body']['intrf']);}else{_0x5b9392=util[_0x3039('0x9e')]('SIP/%s',_0x3dc0e5[_0x3039('0x32')]);}socket['to'](util['format'](_0x3039('0xe5'),_0x3dc0e5[_0x3039('0x32')]))[_0x3039('0x20')](_0x3039('0xe6'),{'user':{'id':_0x3dc0e5['id'],'name':_0x3dc0e5[_0x3039('0x32')]},'ip':_0x226465['headers'][_0x3039('0xe7')]||_0x226465[_0x3039('0xe8')]['remoteAddress']||_0x226465[_0x3039('0xe9')][_0x3039('0xea')]||_0x226465[_0x3039('0xe8')][_0x3039('0xe9')][_0x3039('0xea')]});return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'membername':_0x3dc0e5['name']},'individualHooks':!![]});}}else{throw new db[(_0x3039('0x84'))]['ValidationError'](_0x3039('0xeb'));}})[_0x3039('0x30')](function(){if(_0x3dc0e5){return _0x3dc0e5[_0x3039('0xec')]({'raw':!![]});}})[_0x3039('0x30')](function(_0x2a66f0){if(_0x3dc0e5){if(_0x2a66f0){_0x4413c7=_0x2a66f0;if(_0x4413c7[_0x3039('0x47')]){var _0x184609=_0x4413c7[_0x3039('0x2c')](function(_0x64c5e8){var _0x5d2eaa={'membername':_0x3dc0e5['name'],'UserId':_0x3dc0e5['id'],'queue_name':_0x64c5e8[_0x3039('0x32')],'VoiceQueueId':_0x64c5e8['id'],'interface':_0x5b9392,'paused':_0x3dc0e5[_0x3039('0x92')]||![],'penalty':_0x64c5e8[_0x3039('0xed')]||0x0};return db[_0x3039('0xa1')]['upsert'](_0x5d2eaa);});return Promise[_0x3039('0x4e')](_0x184609);}}}})[_0x3039('0x30')](function(){if(_0x3dc0e5){return db[_0x3039('0xee')][_0x3039('0x44')]({'where':{'membername':_0x3dc0e5[_0x3039('0x32')],'exitAt':null}});}})[_0x3039('0x30')](function(_0x93c0c8){if(_0x3dc0e5){var _0x3bc87f=[];_0x93c0c8[_0x3039('0xef')](function(_0x1d36c2){_0x3bc87f['push'](_0x1d36c2[_0x3039('0x1e')]({'exitAt':moment()['format'](_0x3039('0xf0'))}));});return Promise['all'](_0x3bc87f);}})[_0x3039('0x30')](function(){if(_0x3dc0e5){var _0x99a388=[];var _0x3fa3bf=[];var _0x1490d9=utils['getChannels']();var _0x8ef786={'membername':_0x3dc0e5['name'],'interface':_0x5b9392,'enterAt':moment()[_0x3039('0x9e')](_0x3039('0xf0')),'role':_0x3dc0e5[_0x3039('0x1f')],'internal':_0x3dc0e5['internal']};_0x1490d9['forEach'](function(_0x3cccba){_0x99a388[_0x3039('0x48')](_[_0x3039('0x51')]({'channel':_0x3cccba,'type':_0x3039('0xf1'),'data1':_0x226465[_0x3039('0x55')]['device'],'data2':_0x5b9392},_0x8ef786));if(_0x3dc0e5[_0x3039('0x92')]){_0x3fa3bf[_0x3039('0x48')](_[_0x3039('0x51')]({'channel':_0x3cccba,'type':_0x3039('0xf2'),'data1':_0x3039('0xf3')},_0x8ef786));}});return db[_0x3039('0xee')][_0x3039('0x7e')](_0x99a388[_0x3039('0xbc')](_0x3fa3bf),{'individualHooks':!![]});}})[_0x3039('0x30')](function(){if(_0x3dc0e5){return _0x3dc0e5[_0x3039('0x1e')]({'online':!![],'lastLoginAt':moment()[_0x3039('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3dc0e5[_0x3039('0x92')]||![],'mailPause':_0x3dc0e5['loginInPause']||![],'chatPause':_0x3dc0e5[_0x3039('0x92')]||![],'faxPause':_0x3dc0e5[_0x3039('0x92')]||![],'smsPause':_0x3dc0e5[_0x3039('0x92')]||![],'openchannelPause':_0x3dc0e5[_0x3039('0x92')]||![],'whatsappPause':_0x3dc0e5['loginInPause']||![],'pauseType':_0x3dc0e5[_0x3039('0x92')]?_0x3039('0xf3'):null,'interface':_0x5b9392,'lastPauseAt':moment()['format'](_0x3039('0xf0'))});}})[_0x3039('0x30')](function(_0x347475){if(_0x226465['isMiddleware']){return _0x2d89d9();}else{return Promise['resolve'](_0x347475)[_0x3039('0x30')](respondWithResult(_0x3789b9,null));}})['catch'](handleError(_0x3789b9,null));};exports[_0x3039('0xf4')]=function(_0x583a7c,_0x1b0045){var _0x27f159;return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x583a7c['params']['id'],'role':_0x3039('0x27')},'attributes':['id','name','role']})[_0x3039('0x30')](handleEntityNotFound(_0x1b0045,null))[_0x3039('0x30')](function(_0x5ced6b){if(_0x5ced6b){_0x27f159=_0x5ced6b;return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'membername':_0x27f159[_0x3039('0x32')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x3039('0x44')]({'where':{'membername':_0x27f159[_0x3039('0x32')],'exitAt':null}});})[_0x3039('0x30')](function(_0x1129da){var _0x21a8d0=[];_0x1129da[_0x3039('0xef')](function(_0x515693){_0x21a8d0['push'](_0x515693[_0x3039('0x1e')]({'exitAt':moment()[_0x3039('0x9e')](_0x3039('0xf0'))}));});return Promise['all'](_0x21a8d0);})[_0x3039('0x30')](function(){return _0x27f159[_0x3039('0x1e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3039('0x30')](respondWithResult(_0x1b0045,null))[_0x3039('0x4f')](handleError(_0x1b0045,null));};exports[_0x3039('0xf5')]=function(_0x8ca8cb,_0x2c10b7){var _0x998a97;return db[_0x3039('0xa1')][_0x3039('0x1e')]({'paused':0x1},{'where':{'UserId':_0x8ca8cb['params']['id']},'individualHooks':!![]})[_0x3039('0x30')](function(){return db['User'][_0x3039('0x2e')]({'where':{'id':_0x8ca8cb[_0x3039('0x50')]['id'],'role':_0x3039('0x27')},'attributes':['id',_0x3039('0x32'),_0x3039('0x1f'),'internal',_0x3039('0x93'),_0x3039('0x91')]});})['then'](handleEntityNotFound(_0x2c10b7,null))[_0x3039('0x30')](function(_0x2e7842){if(_0x2e7842){_0x998a97=_0x2e7842;return db[_0x3039('0xee')][_0x3039('0x44')]({'where':{'membername':_0x998a97['name'],'type':'PAUSE','exitAt':null}});}})[_0x3039('0x30')](function(_0x542e24){if(_0x542e24[_0x3039('0x47')]){var _0x1ccd17=moment()[_0x3039('0x9e')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x540332=0x0,_0x47dd12=_0x542e24['length'];_0x540332<_0x47dd12;_0x540332++){_0x542e24[_0x540332]['updateAttributes']({'exitAt':_0x1ccd17});}}})[_0x3039('0x30')](function(){var _0x5147d1=[];var _0x4fe789=utils[_0x3039('0xf6')]();_0x4fe789[_0x3039('0xef')](function(_0x32fce7){_0x5147d1[_0x3039('0x48')]({'channel':_0x32fce7,'membername':_0x998a97[_0x3039('0x32')],'interface':_['isNil'](_0x998a97[_0x3039('0x93')])?util[_0x3039('0x9e')]('SIP/%s',_0x998a97[_0x3039('0x32')]):_0x998a97['interface'],'type':'PAUSE','enterAt':moment()[_0x3039('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x8ca8cb[_0x3039('0x55')][_0x3039('0xf7')]||_0x3039('0xf8'),'role':_0x998a97['role'],'internal':_0x998a97[_0x3039('0x5a')]});});return db[_0x3039('0xee')]['bulkCreate'](_0x5147d1,{'individualHooks':!![]});})[_0x3039('0x30')](function(){return _0x998a97['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x8ca8cb[_0x3039('0x55')][_0x3039('0xf7')]||_0x3039('0xf8'),'lastPauseAt':moment()[_0x3039('0x9e')](_0x3039('0xf0'))});})[_0x3039('0x30')](respondWithResult(_0x2c10b7,null))['catch'](handleError(_0x2c10b7,null));};exports['unpause']=function(_0x7d0179,_0x4433f1){if(_0x7d0179[_0x3039('0x55')][_0x3039('0x90')]&&!utils[_0x3039('0x94')](_0x7d0179[_0x3039('0x55')]['channel'])){throw new APIBadRequestError(util[_0x3039('0x9e')](_0x3039('0xf9'),_0x7d0179[_0x3039('0x55')][_0x3039('0x90')]));}return db[_0x3039('0x34')][_0x3039('0x2e')]({'where':{'id':_0x7d0179['params']['id']},'attributes':['id',_0x3039('0x32'),'role','internal',_0x3039('0x93'),_0x3039('0x91'),_0x3039('0xa0'),_0x3039('0xfa'),_0x3039('0xfb'),_0x3039('0xfc'),_0x3039('0xfd'),'smsPause',_0x3039('0xfe'),_0x3039('0xff'),_0x3039('0x100')]})[_0x3039('0x30')](function(_0x1a6bbc){if(!_0x1a6bbc){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x7d0179[_0x3039('0x50')]['id']));}return _0x1a6bbc[_0x3039('0x101')](_0x7d0179['body']['channel']);})[_0x3039('0x30')](respondWithResult(_0x4433f1,null))['catch'](APIHandleError(_0x4433f1));};exports[_0x3039('0x102')]=function(_0x599e10,_0x2f046b){var _0x5d6b47={};var _0x3a3565={};var _0x2ea162;var _0xa4867;return db[_0x3039('0x34')]['findOne']({'where':{'id':_0x599e10[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x2f046b,null))[_0x3039('0x30')](function(_0x862545){if(_0x862545){_0x2ea162=_0x862545;_0x3a3565[_0x3039('0xc4')]=_[_0x3039('0xc5')](db[_0x3039('0x103')][_0x3039('0x35')]);_0x3a3565['query']=_[_0x3039('0xc5')](_0x599e10['query']);_0x3a3565[_0x3039('0xca')]=_['intersection'](_0x3a3565[_0x3039('0xc4')],_0x3a3565[_0x3039('0x3c')]);_0x5d6b47['attributes']=_[_0x3039('0xc6')](_0x3a3565['model'],qs[_0x3039('0xc7')](_0x599e10[_0x3039('0x3c')][_0x3039('0xc7')]));_0x5d6b47['attributes']=_0x5d6b47['attributes'][_0x3039('0x47')]?_0x5d6b47[_0x3039('0x43')]:_0x3a3565[_0x3039('0xc4')];_0x5d6b47['order']=qs[_0x3039('0xc9')](_0x599e10[_0x3039('0x3c')]['sort']);_0x5d6b47['where']=qs[_0x3039('0xca')](_['pick'](_0x599e10['query'],_0x3a3565['filters']));if(_0x599e10[_0x3039('0x3c')][_0x3039('0x2a')]){_0x5d6b47['where']=_['merge'](_0x5d6b47['where'],{'$or':_[_0x3039('0x2c')](_0x5d6b47[_0x3039('0x43')],function(_0x236b06){var _0x4c9f40={};_0x4c9f40[_0x236b06]={'$like':'%'+_0x599e10[_0x3039('0x3c')][_0x3039('0x2a')]+'%'};return _0x4c9f40;})});}_0x5d6b47=_[_0x3039('0x51')]({},_0x5d6b47,_0x599e10['options']);return _0x2ea162[_0x3039('0x102')](_0x5d6b47);}})[_0x3039('0x30')](function(_0x2b1961){if(_0x2b1961){_0xa4867=_0x2b1961[_0x3039('0x47')];if(!_0x599e10[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x5d6b47[_0x3039('0x1b')]=qs['limit'](_0x599e10[_0x3039('0x3c')][_0x3039('0x1b')]);_0x5d6b47[_0x3039('0x19')]=qs[_0x3039('0x19')](_0x599e10[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x2ea162[_0x3039('0x102')](_0x5d6b47);}})['then'](function(_0xcf222a){if(_0xcf222a){return _0xcf222a?{'count':_0xa4867,'rows':_0xcf222a}:null;}})['then'](respondWithResult(_0x2f046b,null))[_0x3039('0x4f')](handleError(_0x2f046b,null));};exports['addTeams']=function(_0x2c9d44,_0x57983a){var _0x1a403f=_0x2c9d44[_0x3039('0x50')]['id'];var _0x1ff44f=_0x2c9d44[_0x3039('0x55')]?_0x2c9d44[_0x3039('0x55')][_0x3039('0x58')]:null;var _0x842a12=[];return Promise[_0x3039('0x104')]()['then'](function(){if(!_0x1ff44f)throw new APIBadRequestError(_0x3039('0x105'));})['then'](function(){return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x1a403f}});})[_0x3039('0x30')](function(_0x2c9cc1){if(!_0x2c9cc1)throw new APINotFoundError(util[_0x3039('0x9e')](_0x3039('0xbe'),_0x2c9d44['params']['id']));return db[_0x3039('0x62')]['transaction'](function(_0x1789d1){return _0x2c9cc1['addTeams'](_0x1ff44f,{'transaction':_0x1789d1})[_0x3039('0x30')](function(){return db[_0x3039('0x103')][_0x3039('0x44')]({'where':{'id':{'$in':_0x1ff44f}}});})['then'](function(_0x1fce29){var _0x3fc961=_['map'](_0x1fce29,function(_0x4d0997){return _0x4d0997[_0x3039('0x106')]();});return Promise['all'](_0x3fc961);})['then'](function(_0x550d0b){_0x842a12=_[_0x3039('0x107')](_0x550d0b);var _0x1021b3=_['map'](_0x842a12,function(_0x279010){return _0x279010[_0x3039('0x108')](_0x2c9cc1['id'],{'transaction':_0x1789d1});});return Promise[_0x3039('0x4e')](_0x1021b3);})[_0x3039('0x30')](function(){if(!_0x2c9cc1[_0x3039('0x91')])return;var _0x563f7f=_[_0x3039('0x2a')](_0x842a12,function(_0x77dbf4){return _0x77dbf4['getDataValue'](_0x3039('0x90'))===_0x3039('0x109');});var _0x244146=_[_0x3039('0x2c')](_0x563f7f,function(_0x2fe280){return db[_0x3039('0xa1')][_0x3039('0x10a')]({'membername':_0x2c9cc1['name'],'UserId':_0x2c9cc1['id'],'queue_name':_0x2fe280[_0x3039('0x32')],'VoiceQueueId':_0x2fe280['id'],'interface':_[_0x3039('0x64')](_0x2c9cc1['interface'])?util[_0x3039('0x9e')](_0x3039('0x9f'),_0x2c9cc1[_0x3039('0x32')]):_0x2c9cc1[_0x3039('0x93')],'paused':_0x2c9cc1[_0x3039('0xa0')]||![],'penalty':_0x2c9cc1['penalty']},{'transaction':_0x1789d1});});return Promise[_0x3039('0x4e')](_0x244146);})[_0x3039('0x30')](function(){return db['TeamVoicePrefix'][_0x3039('0x44')]({'where':{'teamId':{'$in':_0x1ff44f}}});})[_0x3039('0x30')](function(_0xec2c77){var _0x168f92=_[_0x3039('0x2c')](_0xec2c77,function(_0x189dac){return db[_0x3039('0x10b')]['create']({'UserId':_0x2c9cc1['id'],'VoicePrefixId':_0x189dac[_0x3039('0x10c')]},{'transaction':_0x1789d1});});return Promise[_0x3039('0x4e')](_0x168f92);});});})[_0x3039('0x30')](function(){for(var _0x536145=0x0;_0x536145<_0x842a12['length'];_0x536145++){var _0x3641e1=_0x842a12[_0x536145][_0x3039('0x10d')](_0x3039('0x90'));var _0x4d04f2=_0x3641e1+_0x3039('0x9a');socket[_0x3039('0x20')](_0x3039('0x25')+_0x3641e1+_0x3039('0x9b'),{'UserId':_0x1a403f,['queueField']:_0x842a12[_0x536145]['id']});}})[_0x3039('0x30')](respondWithStatusCode(_0x57983a,null))['catch'](APIHandleError(_0x57983a));};exports[_0x3039('0x10e')]=function(_0x3f87b7,_0x3e7cf7){var _0x39e739=_0x3f87b7[_0x3039('0x50')]['id'];var _0x28be22=null;if(_0x3f87b7[_0x3039('0x3c')][_0x3039('0x58')]){_0x28be22=_['isArray'](_0x3f87b7[_0x3039('0x3c')][_0x3039('0x58')])?_0x3f87b7['query']['ids']:[_0x3f87b7[_0x3039('0x3c')][_0x3039('0x58')]];}var _0x1cf979=[];return Promise[_0x3039('0x104')]()[_0x3039('0x30')](function(){if(!_0x28be22)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x39e739}});})[_0x3039('0x30')](function(_0x4d269e){if(!_0x4d269e)throw new APINotFoundError(util['format'](_0x3039('0xbe'),_0x3f87b7[_0x3039('0x50')]['id']));return db[_0x3039('0x62')][_0x3039('0x10f')](function(_0x2f8a04){return _0x4d269e[_0x3039('0x10e')](_0x28be22,{'transaction':_0x2f8a04})[_0x3039('0x30')](function(){return db[_0x3039('0x103')]['findAll']({'where':{'id':{'$in':_0x28be22}}});})[_0x3039('0x30')](function(_0x1ed161){var _0x1f2e43=_['map'](_0x1ed161,function(_0x4d2cb7){return _0x4d2cb7[_0x3039('0x106')]();});return Promise[_0x3039('0x4e')](_0x1f2e43);})[_0x3039('0x30')](function(_0x5d8f34){_0x1cf979=_[_0x3039('0x107')](_0x5d8f34);var _0x2178a0=_[_0x3039('0x2c')](_0x1cf979,function(_0x2869b0){return _0x2869b0[_0x3039('0x110')](_0x4d269e['id'],{'transaction':_0x2f8a04});});return Promise[_0x3039('0x4e')](_0x2178a0);})[_0x3039('0x30')](function(){if(!_0x4d269e[_0x3039('0x91')])return;var _0x3ec9f6=_[_0x3039('0x2a')](_0x1cf979,function(_0x5ba26c){return _0x5ba26c[_0x3039('0x10d')](_0x3039('0x90'))==='Voice';});var _0x7a07d6=_[_0x3039('0x2c')](_0x3ec9f6,function(_0x53bf2f){return db[_0x3039('0xa1')][_0x3039('0xa6')]({'where':{'VoiceQueueId':_0x53bf2f['id'],'UserId':_0x4d269e['id']},'transaction':_0x2f8a04});});return Promise[_0x3039('0x4e')](_0x7a07d6);})[_0x3039('0x30')](function(){return db[_0x3039('0x111')]['findAll']({'where':{'teamId':{'$in':_0x28be22}}});})[_0x3039('0x30')](function(_0x184908){var _0x51c4fb=_[_0x3039('0x2c')](_0x184908,function(_0x296985){return db['UserVoicePrefix'][_0x3039('0xa6')]({'where':{'UserId':_0x4d269e['id'],'VoicePrefixId':_0x296985['VoicePrefixId']}},{'transaction':_0x2f8a04});});return Promise[_0x3039('0x4e')](_0x51c4fb);});});})[_0x3039('0x30')](function(){for(var _0x2e2a6a=0x0;_0x2e2a6a<_0x1cf979[_0x3039('0x47')];_0x2e2a6a++){var _0x33349c=_0x1cf979[_0x2e2a6a][_0x3039('0x10d')](_0x3039('0x90'));var _0x459618=_0x33349c+'QueueId';socket[_0x3039('0x20')]('user'+_0x33349c+_0x3039('0xa5'),{'UserId':_0x39e739,['queueField']:_0x1cf979[_0x2e2a6a]['id']});}})[_0x3039('0x30')](respondWithStatusCode(_0x3e7cf7,null))[_0x3039('0x4f')](APIHandleError(_0x3e7cf7));};exports[_0x3039('0x112')]=function(_0x55c2f4,_0x229baf){var _0x1e2db0={};var _0x507c64={};var _0x3b3b55;var _0x48bdde;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x55c2f4[_0x3039('0x50')]['id']}})[_0x3039('0x30')](handleEntityNotFound(_0x229baf,null))[_0x3039('0x30')](function(_0x2ecc90){if(_0x2ecc90){_0x3b3b55=_0x2ecc90;_0x507c64['model']=_[_0x3039('0xc5')](db[_0x3039('0x113')][_0x3039('0x35')]);_0x507c64[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x55c2f4[_0x3039('0x3c')]);_0x507c64[_0x3039('0xca')]=_[_0x3039('0xc6')](_0x507c64['model'],_0x507c64[_0x3039('0x3c')]);_0x1e2db0[_0x3039('0x43')]=_['intersection'](_0x507c64['model'],qs[_0x3039('0xc7')](_0x55c2f4[_0x3039('0x3c')][_0x3039('0xc7')]));_0x1e2db0[_0x3039('0x43')]=_0x1e2db0[_0x3039('0x43')][_0x3039('0x47')]?_0x1e2db0[_0x3039('0x43')]:_0x507c64[_0x3039('0xc4')];_0x1e2db0[_0x3039('0xc8')]=qs['sort'](_0x55c2f4[_0x3039('0x3c')]['sort']);_0x1e2db0[_0x3039('0x3b')]=qs[_0x3039('0xca')](_[_0x3039('0xcb')](_0x55c2f4[_0x3039('0x3c')],_0x507c64['filters']));if(_0x55c2f4[_0x3039('0x3c')]['filter']){_0x1e2db0['where']=_[_0x3039('0x51')](_0x1e2db0[_0x3039('0x3b')],{'$or':_['map'](_0x1e2db0[_0x3039('0x43')],function(_0x11c3b2){var _0x4cb068={};_0x4cb068[_0x11c3b2]={'$like':'%'+_0x55c2f4[_0x3039('0x3c')]['filter']+'%'};return _0x4cb068;})});}_0x1e2db0=_[_0x3039('0x51')]({},_0x1e2db0,_0x55c2f4[_0x3039('0x52')]);return _0x3b3b55[_0x3039('0x112')](_0x1e2db0);}})[_0x3039('0x30')](function(_0x1a87f3){if(_0x1a87f3){_0x48bdde=_0x1a87f3[_0x3039('0x47')];if(!_0x55c2f4[_0x3039('0x3c')][_0x3039('0xcd')](_0x3039('0xcf'))){_0x1e2db0[_0x3039('0x1b')]=qs[_0x3039('0x1b')](_0x55c2f4[_0x3039('0x3c')]['limit']);_0x1e2db0['offset']=qs['offset'](_0x55c2f4[_0x3039('0x3c')][_0x3039('0x19')]);}return _0x3b3b55[_0x3039('0x112')](_0x1e2db0);}})[_0x3039('0x30')](function(_0x3f15ad){if(_0x3f15ad){return _0x3f15ad?{'count':_0x48bdde,'rows':_0x3f15ad}:null;}})[_0x3039('0x30')](respondWithResult(_0x229baf,null))[_0x3039('0x4f')](handleError(_0x229baf,null));};exports[_0x3039('0x114')]=function(_0x29568a,_0x267d07){var _0x1ca46d={};var _0xbaba7c={};var _0x50dd93;return db[_0x3039('0x34')][_0x3039('0x8b')]({'where':{'id':_0x29568a[_0x3039('0x50')]['id']}})['then'](handleEntityNotFound(_0x267d07,null))[_0x3039('0x30')](function(_0x5d8573){if(_0x5d8573){_0x50dd93=_0x5d8573;_0xbaba7c[_0x3039('0xc4')]=_['keys'](db[_0x3039('0x34')][_0x3039('0x35')]);_0xbaba7c[_0x3039('0x3c')]=_[_0x3039('0xc5')](_0x29568a[_0x3039('0x3c')]);_0xbaba7c[_0x3039('0xca')]=_[_0x3039('0xc6')](_0xbaba7c[_0x3039('0xc4')],_0xbaba7c[_0x3039('0x3c')]);_0x1ca46d['attributes']=_['intersection'](_0xbaba7c['model'],qs[_0x3039('0xc7')](_0x29568a['query'][_0x3039('0xc7')]));_0x1ca46d[_0x3039('0x43')]=_0x1ca46d[_0x3039('0x43')]['length']?_0x1ca46d[_0x3039('0x43')]:_0xbaba7c[_0x3039('0xc4')];_0x1ca46d[_0x3039('0xc8')]=qs[_0x3039('0xc9')](_0x29568a[_0x3039('0x3c')]['sort']);_0x1ca46d['where']=qs[_0x3039('0xca')](_['pick'](_0x29568a[_0x3039('0x3c')],_0xbaba7c[_0x3039('0xca')]));if(_0x29568a[_0x3039('0x3c')][_0x3039('0x2a')]){_0x1ca46d[_0x3039('0x3b')]=_[_0x3039('0x51')](_0x1ca46d['where'],{'$or':_[_0x3039('0x2c')](_0x1ca46d[_0x3039('0x43')],function(_0x2a7468){var _0x45094c={};_0x45094c[_0x2a7468]={'$like':'%'+_0x29568a[_0x3039('0x3c')]['filter']+'%'};return _0x45094c;})});}_0x1ca46d[_0x3039('0xc4')]=db[_0x3039('0x34')];_0x1ca46d['as']='Agents';_0x1ca46d=_[_0x3039('0x51')]({},_0x1ca46d,_0x29568a[_0x3039('0x52')]);return _0x50dd93[_0x3039('0xec')]({'include':[_0x1ca46d]});}})[_0x3039('0x30')](function(_0xde2da5){if(_0xde2da5){var _0x1b8a5c={},_0x544b6f=[];for(var _0x3551c2=0x0;_0x3551c2<_0xde2da5[_0x3039('0x47')];_0x3551c2+=0x1){for(var _0x395929=0x0,_0x113bcf;_0x395929<_0xde2da5[_0x3551c2]['Agents'][_0x3039('0x47')];_0x395929+=0x1){_0x113bcf=_0xde2da5[_0x3551c2][_0x3039('0x26')][_0x395929]['get']({'plain':!![]});_0x1b8a5c[_0x113bcf['id']]=_0x113bcf;}}_0x1b8a5c=_[_0x3039('0x115')](_0x1b8a5c);for(var _0x2c7416=qs[_0x3039('0x19')](_0x29568a[_0x3039('0x3c')]['offset']);_0x2c7416<_0x1b8a5c[_0x3039('0x47')]&&_0x544b6f['length']=_0x1ebea8[_0xf3dd('0x4d')]){throw new Error(_0xf3dd('0x4e'));}})[_0xf3dd('0x15')](function(){if(_0x2aee6c){return db[_0xf3dd('0x23')][_0xf3dd('0x45')]({'where':{'membername':_0x2aee6c[_0xf3dd('0x1e')]},'individualHooks':!![]});}})[_0xf3dd('0x15')](function(){if(_0x2aee6c){return _0x2aee6c[_0xf3dd('0x4f')]({'raw':!![]});}})[_0xf3dd('0x15')](function(_0x3f7ad3){if(_0x2aee6c){if(_0x3f7ad3){var _0x1b8dfa=[];_0x476043=_0x3f7ad3;if(_0x476043[_0xf3dd('0x28')]){for(var _0x40e133=0x0;_0x40e133<_0x476043[_0xf3dd('0x28')];_0x40e133++){_0x1b8dfa[_0xf3dd('0x2c')](db[_0xf3dd('0x23')][_0xf3dd('0x50')]({'membername':_0x2aee6c[_0xf3dd('0x1e')],'UserId':_0x2aee6c['id'],'queue_name':_0x476043[_0x40e133][_0xf3dd('0x1e')],'VoiceQueueId':_0x476043[_0x40e133]['id'],'interface':_0x497fa8,'paused':_0x2aee6c['loginInPause']||![],'penalty':_0x476043[_0x40e133][_0xf3dd('0x51')]||0x0}));}return BPromise[_0xf3dd('0x46')](_0x1b8dfa);}}}})[_0xf3dd('0x15')](function(){if(_0x2aee6c){return db[_0xf3dd('0x25')][_0xf3dd('0x26')]({'where':{'membername':_0x2aee6c['name'],'exitAt':null}});}})['then'](function(_0x391aae){if(_0x2aee6c){if(_0x391aae&&_0x391aae[_0xf3dd('0x28')]){var _0x14bbd6=[];_0x391aae[_0xf3dd('0x2b')](function(_0x1ef61b){_0x14bbd6[_0xf3dd('0x2c')](_0x1ef61b[_0xf3dd('0x24')]({'exitAt':moment()[_0xf3dd('0x20')](_0xf3dd('0x35'))}));});return BPromise[_0xf3dd('0x46')](_0x14bbd6);}}})[_0xf3dd('0x15')](function(){if(_0x2aee6c){var _0x52b528=[];var _0x3c5f08=[];var _0x1cd93b=utils['getChannels']();var _0x5c3ee={'membername':_0x2aee6c[_0xf3dd('0x1e')],'interface':_0x497fa8,'enterAt':moment()['format'](_0xf3dd('0x35')),'role':_0x2aee6c[_0xf3dd('0x31')],'internal':_0x2aee6c[_0xf3dd('0x1f')]};_0x1cd93b['forEach'](function(_0xeb4fe2){_0x52b528[_0xf3dd('0x2c')](_['merge']({'channel':_0xeb4fe2,'type':_0xf3dd('0x52'),'data1':_0xf3dd('0x53'),'data2':_0x497fa8},_0x5c3ee));if(_0x2aee6c[_0xf3dd('0x54')]){_0x3c5f08[_0xf3dd('0x2c')](_[_0xf3dd('0x55')]({'channel':_0xeb4fe2,'type':_0xf3dd('0x27'),'data1':_0xf3dd('0x56')},_0x5c3ee));}});return db[_0xf3dd('0x25')][_0xf3dd('0x33')](_0x52b528[_0xf3dd('0x57')](_0x3c5f08),{'individualHooks':!![]});}})['then'](function(){if(_0x2aee6c){return _0x2aee6c[_0xf3dd('0x24')]({'online':!![],'lastLoginAt':moment()[_0xf3dd('0x20')](_0xf3dd('0x35')),'voicePause':_0x2aee6c[_0xf3dd('0x54')]||![],'mailPause':_0x2aee6c[_0xf3dd('0x54')]||![],'chatPause':_0x2aee6c[_0xf3dd('0x54')]||![],'faxPause':_0x2aee6c[_0xf3dd('0x54')]||![],'smsPause':_0x2aee6c[_0xf3dd('0x54')]||![],'openchannelPause':_0x2aee6c[_0xf3dd('0x54')]||![],'pauseType':_0x2aee6c[_0xf3dd('0x54')]?_0xf3dd('0x56'):null,'lastPauseAt':moment()[_0xf3dd('0x20')](_0xf3dd('0x35')),'interface':_0x497fa8});}})[_0xf3dd('0x15')](function(_0x19f4c2){_0x3acf9b(_0x19f4c2);})[_0xf3dd('0x18')](function(_0x44a5d7){_0x2e09d1(_0x1e70df[_0xf3dd('0x19')](0x1f4,_0x44a5d7[_0xf3dd('0x1a')]));});});}; \ No newline at end of file +var _0xd5b2=['smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','system','catch','LogoutUser','findOne','destroy','all','LoginUser','mobile','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','MemberReport','getChannels','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','error','message','ShowUser','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','mailPause','chatPause','faxPause','openchannelPause'];(function(_0x5f522f,_0x2765be){var _0x344635=function(_0x57cd9){while(--_0x57cd9){_0x5f522f['push'](_0x5f522f['shift']());}};_0x344635(++_0x2765be);}(_0xd5b2,0x1a5));var _0x2d5b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xd5b2[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x2d5b('0x0'));var util=require(_0x2d5b('0x1'));var moment=require(_0x2d5b('0x2'));var BPromise=require(_0x2d5b('0x3'));var Redis=require(_0x2d5b('0x4'));var db=require(_0x2d5b('0x5'))['db'];var utils=require(_0x2d5b('0x6'));var logger=require(_0x2d5b('0x7'))(_0x2d5b('0x8'));var config=require(_0x2d5b('0x9'));config[_0x2d5b('0xa')]=_[_0x2d5b('0xb')](config['redis'],{'host':_0x2d5b('0xc'),'port':0x18eb});var socket=require(_0x2d5b('0xd'))(new Redis(config['redis']));require(_0x2d5b('0xe'))[_0x2d5b('0xf')](socket);exports[_0x2d5b('0x10')]=function(_0x2e5cee){var _0x16a762=this;return new Promise(function(_0x482e0d,_0x53272e){return db[_0x2d5b('0x11')][_0x2d5b('0x12')]({'raw':_0x2e5cee[_0x2d5b('0x13')]?_0x2e5cee[_0x2d5b('0x13')][_0x2d5b('0x14')]===undefined?!![]:![]:!![],'where':_0x2e5cee[_0x2d5b('0x13')]?_0x2e5cee[_0x2d5b('0x13')][_0x2d5b('0x15')]||null:null,'attributes':_0x2e5cee[_0x2d5b('0x13')]?_0x2e5cee[_0x2d5b('0x13')][_0x2d5b('0x16')]||null:null,'limit':_0x2e5cee[_0x2d5b('0x13')]?_0x2e5cee['options'][_0x2d5b('0x17')]||null:null,'include':_0x2e5cee['options']?_0x2e5cee['options']['include']?_['map'](_0x2e5cee[_0x2d5b('0x13')][_0x2d5b('0x18')],function(_0x118635){return{'model':db[_0x118635[_0x2d5b('0x19')]],'as':_0x118635['as'],'attributes':_0x118635['attributes'],'include':_0x118635[_0x2d5b('0x18')]?_[_0x2d5b('0x1a')](_0x118635[_0x2d5b('0x18')],function(_0x2feb04){return{'model':db[_0x2feb04[_0x2d5b('0x19')]],'as':_0x2feb04['as'],'attributes':_0x2feb04[_0x2d5b('0x16')],'include':_0x2feb04[_0x2d5b('0x18')]?_[_0x2d5b('0x1a')](_0x2feb04[_0x2d5b('0x18')],function(_0x48ddbd){return{'model':db[_0x48ddbd[_0x2d5b('0x19')]],'as':_0x48ddbd['as'],'attributes':_0x48ddbd[_0x2d5b('0x16')]};}):[]};}):[]};}):[]:[]})[_0x2d5b('0x1b')](function(_0x42c318){logger[_0x2d5b('0x1c')]('GetUser',_0x2e5cee);logger[_0x2d5b('0x1d')]('GetUser',_0x2e5cee,JSON[_0x2d5b('0x1e')](_0x42c318));_0x482e0d(_0x42c318);})['catch'](function(_0x20be65){logger[_0x2d5b('0x1f')](_0x2d5b('0x10'),_0x20be65['message'],_0x2e5cee);_0x53272e(_0x16a762[_0x2d5b('0x1f')](0x1f4,_0x20be65[_0x2d5b('0x20')]));});});};exports[_0x2d5b('0x21')]=function(_0x258335){var _0x1e1a23=this;return new Promise(function(_0x4fdab1,_0x5f12ab){return db[_0x2d5b('0x11')][_0x2d5b('0x22')]({'raw':_0x258335[_0x2d5b('0x13')]?_0x258335[_0x2d5b('0x13')][_0x2d5b('0x14')]===undefined?!![]:![]:!![],'where':_0x258335[_0x2d5b('0x13')]?_0x258335[_0x2d5b('0x13')][_0x2d5b('0x15')]||null:null,'attributes':_0x258335['options']?_0x258335['options'][_0x2d5b('0x16')]||null:null,'include':_0x258335['options']?_0x258335[_0x2d5b('0x13')][_0x2d5b('0x18')]?_['map'](_0x258335[_0x2d5b('0x13')][_0x2d5b('0x18')],function(_0x156c9f){return{'model':db[_0x156c9f['model']],'as':_0x156c9f['as'],'attributes':_0x156c9f[_0x2d5b('0x16')],'include':_0x156c9f[_0x2d5b('0x18')]?_['map'](_0x156c9f[_0x2d5b('0x18')],function(_0x51b684){return{'model':db[_0x51b684['model']],'as':_0x51b684['as'],'attributes':_0x51b684['attributes'],'include':_0x51b684['include']?_['map'](_0x51b684[_0x2d5b('0x18')],function(_0x16ec20){return{'model':db[_0x16ec20[_0x2d5b('0x19')]],'as':_0x16ec20['as'],'attributes':_0x16ec20['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d5b('0x1b')](function(_0xc9e481){logger[_0x2d5b('0x1c')](_0x2d5b('0x21'),_0x258335);logger[_0x2d5b('0x1d')](_0x2d5b('0x21'),_0x258335,JSON[_0x2d5b('0x1e')](_0xc9e481));_0x4fdab1(_0xc9e481);})['catch'](function(_0x2bf4a7){logger[_0x2d5b('0x1f')](_0x2d5b('0x21'),_0x2bf4a7[_0x2d5b('0x20')],_0x258335);_0x5f12ab(_0x1e1a23[_0x2d5b('0x1f')](0x1f4,_0x2bf4a7[_0x2d5b('0x20')]));});});};exports[_0x2d5b('0x23')]=function(_0x4dab46){var _0x2c4ec7;return db[_0x2d5b('0x11')][_0x2d5b('0x22')]({'where':_0x4dab46[_0x2d5b('0x13')][_0x2d5b('0x15')]||{},'attributes':['id',_0x2d5b('0x24'),_0x2d5b('0x25'),_0x2d5b('0x26'),_0x2d5b('0x27')]})[_0x2d5b('0x1b')](function(_0x9e46b0){if(!_0x9e46b0){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4dab46['params']['id']));}_0x2c4ec7=_0x9e46b0;return db[_0x2d5b('0x28')][_0x2d5b('0x29')]({'paused':0x1},{'where':{'UserId':_0x2c4ec7['id']},'individualHooks':!![]});})[_0x2d5b('0x1b')](function(){return db['MemberReport'][_0x2d5b('0x12')]({'where':{'membername':_0x2c4ec7[_0x2d5b('0x24')],'type':_0x2d5b('0x2a'),'exitAt':null}});})[_0x2d5b('0x1b')](function(_0x518036){if(_0x518036&&_0x518036[_0x2d5b('0x2b')]){var _0x46b402=moment()[_0x2d5b('0x2c')](_0x2d5b('0x2d'));for(var _0x1fcacb=0x0,_0x25c3c5=_0x518036[_0x2d5b('0x2b')];_0x1fcacb<_0x25c3c5;_0x1fcacb++){_0x518036[_0x1fcacb][_0x2d5b('0x2e')]({'exitAt':_0x46b402});}}})[_0x2d5b('0x1b')](function(){var _0x57f061=[];var _0x5f0cd7=utils['getChannels']();_0x5f0cd7[_0x2d5b('0x2f')](function(_0x15c2bc){_0x57f061[_0x2d5b('0x30')]({'channel':_0x15c2bc,'membername':_0x2c4ec7[_0x2d5b('0x24')],'interface':_[_0x2d5b('0x31')](_0x2c4ec7[_0x2d5b('0x27')])?util[_0x2d5b('0x2c')]('SIP/%s',_0x2c4ec7[_0x2d5b('0x24')]):_0x2c4ec7['interface'],'type':_0x2d5b('0x2a'),'enterAt':moment()[_0x2d5b('0x2c')](_0x2d5b('0x2d')),'data1':_0x4dab46[_0x2d5b('0x32')][_0x2d5b('0x33')]||_0x2d5b('0x34'),'role':_0x2c4ec7[_0x2d5b('0x25')],'internal':_0x2c4ec7['internal'],'uniqueid':_0x4dab46[_0x2d5b('0x32')][_0x2d5b('0x35')]||null});});return db['MemberReport'][_0x2d5b('0x36')](_0x57f061,{'individualHooks':!![]});})[_0x2d5b('0x1b')](function(){return _0x2c4ec7[_0x2d5b('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4dab46[_0x2d5b('0x32')]['type']||_0x2d5b('0x34'),'lastPauseAt':moment()[_0x2d5b('0x2c')](_0x2d5b('0x2d'))});})['catch'](function(_0x17625c){throw _0x17625c;});};exports[_0x2d5b('0x37')]=function(_0x4bb7b4){return Promise[_0x2d5b('0x38')]()[_0x2d5b('0x1b')](function(){if(_0x4bb7b4['body']['channel']&&!utils[_0x2d5b('0x39')](_0x4bb7b4['body']['channel'])){throw new Error(util[_0x2d5b('0x2c')](_0x2d5b('0x3a'),_0x4bb7b4['body'][_0x2d5b('0x3b')]));}return db['User']['findOne']({'where':_0x4bb7b4[_0x2d5b('0x13')][_0x2d5b('0x15')]||{},'attributes':['id','name',_0x2d5b('0x25'),_0x2d5b('0x26'),_0x2d5b('0x27'),'online','voicePause',_0x2d5b('0x3c'),_0x2d5b('0x3d'),_0x2d5b('0x3e'),_0x2d5b('0x3f'),_0x2d5b('0x40'),_0x2d5b('0x41'),_0x2d5b('0x42'),_0x2d5b('0x43')]});})[_0x2d5b('0x1b')](function(_0x42e548){if(!_0x42e548){throw new Error(util['format'](_0x2d5b('0x44'),_0x4bb7b4[_0x2d5b('0x45')]['id']));}return _0x42e548['unpause'](_0x4bb7b4[_0x2d5b('0x32')][_0x2d5b('0x3b')],_0x2d5b('0x46'));})[_0x2d5b('0x47')](function(_0x524271){throw _0x524271;});};exports[_0x2d5b('0x48')]=function(_0x9f68b9){var _0x40ee9e=this;return new Promise(function(_0x2362d3,_0x50b30b){var _0x2110b2;return db['User'][_0x2d5b('0x49')]({'where':_0x9f68b9[_0x2d5b('0x13')][_0x2d5b('0x15')]||{},'attributes':['id',_0x2d5b('0x24')]})[_0x2d5b('0x1b')](function(_0x18028e){if(_0x18028e){_0x2110b2=_0x18028e;return db['UserVoiceQueueRt'][_0x2d5b('0x4a')]({'where':{'membername':_0x2110b2[_0x2d5b('0x24')]},'individualHooks':!![]});}})['then'](function(){if(_0x2110b2){return db['MemberReport']['findAll']({'where':{'membername':_0x2110b2[_0x2d5b('0x24')],'exitAt':null}});}})[_0x2d5b('0x1b')](function(_0x2cb5ed){if(_0x2110b2){if(_0x2cb5ed&&_0x2cb5ed[_0x2d5b('0x2b')]){var _0x293849=[];_0x2cb5ed[_0x2d5b('0x2f')](function(_0x21256c){_0x293849[_0x2d5b('0x30')](_0x21256c[_0x2d5b('0x29')]({'exitAt':moment()['format'](_0x2d5b('0x2d'))}));});return BPromise[_0x2d5b('0x4b')](_0x293849);}}})[_0x2d5b('0x1b')](function(){if(_0x2110b2){return _0x2110b2[_0x2d5b('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2d5b('0x1b')](function(_0xf132d9){_0x2362d3(_0xf132d9);})[_0x2d5b('0x47')](function(_0x4f9f35){_0x50b30b(_0x40ee9e[_0x2d5b('0x1f')](0x1f4,_0x4f9f35[_0x2d5b('0x20')]));});});};exports[_0x2d5b('0x4c')]=function(_0x236cc5){var _0x59a740=this;return new Promise(function(_0x2c40cc,_0x256f36){var _0x548e21;var _0x471883;var _0x1f5b08;var _0x428809;return db[_0x2d5b('0x11')][_0x2d5b('0x49')]({'where':_0x236cc5['options'][_0x2d5b('0x15')]||{},'attributes':['id',_0x2d5b('0x24'),_0x2d5b('0x25'),_0x2d5b('0x4d'),_0x2d5b('0x4e'),'internal',_0x2d5b('0x4f'),_0x2d5b('0x27')]})[_0x2d5b('0x1b')](function(_0x42fe61){if(_0x42fe61){_0x548e21=_0x42fe61;_0x428809=_0x236cc5[_0x2d5b('0x32')]['interface']?_0x236cc5[_0x2d5b('0x32')][_0x2d5b('0x27')]:util['format'](_0x2d5b('0x50'),_0x548e21['name']);return db[_0x2d5b('0x11')][_0x2d5b('0x51')]({'where':{'role':_0x2d5b('0x52'),'online':!![],'id':{'$ne':_0x548e21['id']}}});}})[_0x2d5b('0x1b')](function(_0x170bbd){if(_0x170bbd){_0x1f5b08=_0x170bbd;return require(_0x2d5b('0x53'))[_0x2d5b('0x54')]();}})[_0x2d5b('0x1b')](function(_0xc13a35){if(_0xc13a35&&_0xc13a35[_0x2d5b('0x55')]&&_0x1f5b08>=_0xc13a35[_0x2d5b('0x55')]){throw new Error(_0x2d5b('0x56'));}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return db[_0x2d5b('0x28')]['destroy']({'where':{'membername':_0x548e21[_0x2d5b('0x24')]},'individualHooks':!![]});}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return _0x548e21[_0x2d5b('0x57')]({'raw':!![]});}})[_0x2d5b('0x1b')](function(_0x272e78){if(_0x548e21){if(_0x272e78){var _0x5196ac=[];_0x471883=_0x272e78;if(_0x471883[_0x2d5b('0x2b')]){for(var _0x500fa3=0x0;_0x500fa3<_0x471883['length'];_0x500fa3++){_0x5196ac[_0x2d5b('0x30')](db['UserVoiceQueueRt'][_0x2d5b('0x58')]({'membername':_0x548e21[_0x2d5b('0x24')],'UserId':_0x548e21['id'],'queue_name':_0x471883[_0x500fa3][_0x2d5b('0x24')],'VoiceQueueId':_0x471883[_0x500fa3]['id'],'interface':_0x428809,'paused':_0x548e21['loginInPause']||![],'penalty':_0x471883[_0x500fa3][_0x2d5b('0x59')]||0x0}));}return BPromise[_0x2d5b('0x4b')](_0x5196ac);}}}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return db[_0x2d5b('0x5a')]['findAll']({'where':{'membername':_0x548e21[_0x2d5b('0x24')],'exitAt':null}});}})[_0x2d5b('0x1b')](function(_0x2417b8){if(_0x548e21){if(_0x2417b8&&_0x2417b8[_0x2d5b('0x2b')]){var _0x957eb8=[];_0x2417b8['forEach'](function(_0x5edf04){_0x957eb8['push'](_0x5edf04['update']({'exitAt':moment()[_0x2d5b('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2d5b('0x4b')](_0x957eb8);}}})['then'](function(){if(_0x548e21){var _0x1904f7=[];var _0x5c659d=[];var _0x3d5053=utils[_0x2d5b('0x5b')]();var _0x34784d={'membername':_0x548e21[_0x2d5b('0x24')],'interface':_0x428809,'enterAt':moment()[_0x2d5b('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x548e21[_0x2d5b('0x25')],'internal':_0x548e21[_0x2d5b('0x26')]};_0x3d5053[_0x2d5b('0x2f')](function(_0x1e4114){_0x1904f7[_0x2d5b('0x30')](_[_0x2d5b('0x5c')]({'channel':_0x1e4114,'type':_0x2d5b('0x5d'),'data1':_0x2d5b('0x5e'),'data2':_0x428809},_0x34784d));if(_0x548e21[_0x2d5b('0x4f')]){_0x5c659d['push'](_[_0x2d5b('0x5c')]({'channel':_0x1e4114,'type':_0x2d5b('0x2a'),'data1':'LOGININPAUSE'},_0x34784d));}});return db['MemberReport']['bulkCreate'](_0x1904f7[_0x2d5b('0x5f')](_0x5c659d),{'individualHooks':!![]});}})[_0x2d5b('0x1b')](function(){if(_0x548e21){return _0x548e21[_0x2d5b('0x29')]({'online':!![],'lastLoginAt':moment()[_0x2d5b('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x548e21[_0x2d5b('0x4f')]||![],'mailPause':_0x548e21['loginInPause']||![],'chatPause':_0x548e21[_0x2d5b('0x4f')]||![],'faxPause':_0x548e21['loginInPause']||![],'smsPause':_0x548e21[_0x2d5b('0x4f')]||![],'openchannelPause':_0x548e21[_0x2d5b('0x4f')]||![],'pauseType':_0x548e21[_0x2d5b('0x4f')]?_0x2d5b('0x60'):null,'lastPauseAt':moment()[_0x2d5b('0x2c')](_0x2d5b('0x2d')),'interface':_0x428809});}})[_0x2d5b('0x1b')](function(_0x340310){_0x2c40cc(_0x340310);})[_0x2d5b('0x47')](function(_0x10efcd){_0x256f36(_0x59a740[_0x2d5b('0x1f')](0x1f4,_0x10efcd[_0x2d5b('0x20')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ced355c..d6fc3af 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 _0x27cf=['emit','removeListener','register','length','./user.events'];(function(_0x7a0046,_0x1a9194){var _0xeddb7c=function(_0x1fd6f3){while(--_0x1fd6f3){_0x7a0046['push'](_0x7a0046['shift']());}};_0xeddb7c(++_0x1a9194);}(_0x27cf,0xb3));var _0xf27c=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x27cf[_0x2dadb9];return _0x2f0097;};'use strict';var UserEvents=require(_0xf27c('0x0'));var events=['save','remove','update'];function createListener(_0x12fb7d,_0x559ca3){return function(_0x4496b5){_0x559ca3[_0xf27c('0x1')](_0x12fb7d,_0x4496b5);};}function removeListener(_0x3756e1,_0x1df46a){return function(){UserEvents[_0xf27c('0x2')](_0x3756e1,_0x1df46a);};}exports[_0xf27c('0x3')]=function(_0x411684){for(var _0x2fb59e=0x0,_0x59a957=events[_0xf27c('0x4')];_0x2fb59e<_0x59a957;_0x2fb59e++){var _0x339ff7=events[_0x2fb59e];var _0x5a3547=createListener('user:'+_0x339ff7,_0x411684);UserEvents['on'](_0x339ff7,_0x5a3547);}}; \ No newline at end of file +var _0xca01=['remove','emit','removeListener','register','length','user:','./user.events','save'];(function(_0xc27d6,_0x5dd679){var _0x692658=function(_0x56e819){while(--_0x56e819){_0xc27d6['push'](_0xc27d6['shift']());}};_0x692658(++_0x5dd679);}(_0xca01,0x66));var _0x1ca0=function(_0x3a8963,_0x4a27fd){_0x3a8963=_0x3a8963-0x0;var _0x47e069=_0xca01[_0x3a8963];return _0x47e069;};'use strict';var UserEvents=require(_0x1ca0('0x0'));var events=[_0x1ca0('0x1'),_0x1ca0('0x2'),'update'];function createListener(_0x417123,_0x2d8569){return function(_0x14e6ce){_0x2d8569[_0x1ca0('0x3')](_0x417123,_0x14e6ce);};}function removeListener(_0x2c00f9,_0x2cc96e){return function(){UserEvents[_0x1ca0('0x4')](_0x2c00f9,_0x2cc96e);};}exports[_0x1ca0('0x5')]=function(_0x53af99){for(var _0x5a07fa=0x0,_0x76f6e3=events[_0x1ca0('0x6')];_0x5a07fa<_0x76f6e3;_0x5a07fa++){var _0x75a7a7=events[_0x5a07fa];var _0x163626=createListener(_0x1ca0('0x7')+_0x75a7a7,_0x53af99);UserEvents['on'](_0x75a7a7,_0x163626);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6efabce..4ac5b99 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3f62ac,_0x55fecd){var _0x2ceef7=function(_0x23ed54){while(--_0x23ed54){_0x3f62ac['push'](_0x3f62ac['shift']());}};_0x2ceef7(++_0x55fecd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xcb91[_0x495e9f];return _0xb249d2;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1c2fd7,_0x595cf1){var _0x369e9d=function(_0x12d274){while(--_0x12d274){_0x1c2fd7['push'](_0x1c2fd7['shift']());}};_0x369e9d(++_0x595cf1);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b972eaf..c8cb564 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 _0x4e2b=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e2b,0xa9));var _0xb4e2=function(_0x5099d7,_0x1c0edc){_0x5099d7=_0x5099d7-0x0;var _0x184264=_0x4e2b[_0x5099d7];return _0x184264;};'use strict';var Sequelize=require('sequelize');module[_0xb4e2('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f59=['exports','INTEGER'];(function(_0x21aa0f,_0x1b7cbb){var _0x2a27f0=function(_0x5abaf1){while(--_0x5abaf1){_0x21aa0f['push'](_0x21aa0f['shift']());}};_0x2a27f0(++_0x1b7cbb);}(_0x3f59,0x12a));var _0x93f5=function(_0x1b2f2b,_0x3fd926){_0x1b2f2b=_0x1b2f2b-0x0;var _0x165926=_0x3f59[_0x1b2f2b];return _0x165926;};'use strict';var Sequelize=require('sequelize');module[_0x93f5('0x0')]={'penalty':{'type':Sequelize[_0x93f5('0x1')],'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 ed1979d..0391983 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 _0x0aa1=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports'];(function(_0x47b7d6,_0x5f06d8){var _0x55da9c=function(_0x283647){while(--_0x283647){_0x47b7d6['push'](_0x47b7d6['shift']());}};_0x55da9c(++_0x5f06d8);}(_0x0aa1,0x17b));var _0x10aa=function(_0x418589,_0x2047a5){_0x418589=_0x418589-0x0;var _0x32712e=_0x0aa1[_0x418589];return _0x32712e;};'use strict';var _=require(_0x10aa('0x0'));var util=require(_0x10aa('0x1'));var logger=require(_0x10aa('0x2'))(_0x10aa('0x3'));var moment=require(_0x10aa('0x4'));var BPromise=require(_0x10aa('0x5'));var rp=require(_0x10aa('0x6'));var fs=require('fs');var path=require(_0x10aa('0x7'));var rimraf=require(_0x10aa('0x8'));var config=require('../../config/environment');var attributes=require(_0x10aa('0x9'));module[_0x10aa('0xa')]=function(_0x289e40,_0x44653a){return _0x289e40['define'](_0x10aa('0xb'),attributes,{'tableName':_0x10aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47eb=['api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x10c5b5,_0x20422a){var _0x3a2afd=function(_0x64d174){while(--_0x64d174){_0x10c5b5['push'](_0x10c5b5['shift']());}};_0x3a2afd(++_0x20422a);}(_0x47eb,0x1a1));var _0xb47e=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x47eb[_0x3efe87];return _0x56a4cc;};'use strict';var _=require(_0xb47e('0x0'));var util=require(_0xb47e('0x1'));var logger=require(_0xb47e('0x2'))(_0xb47e('0x3'));var moment=require(_0xb47e('0x4'));var BPromise=require(_0xb47e('0x5'));var rp=require(_0xb47e('0x6'));var fs=require('fs');var path=require(_0xb47e('0x7'));var rimraf=require(_0xb47e('0x8'));var config=require('../../config/environment');var attributes=require(_0xb47e('0x9'));module['exports']=function(_0xdfc1ee,_0x12bcc9){return _0xdfc1ee['define'](_0xb47e('0xa'),attributes,{'tableName':_0xb47e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index dceadad..824c279 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 _0x2468=['then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x589aa1,_0x2e0522){var _0x2d614f=function(_0x16f383){while(--_0x16f383){_0x589aa1['push'](_0x589aa1['shift']());}};_0x2d614f(++_0x2e0522);}(_0x2468,0x1eb));var _0x8246=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x2468[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x8246('0x0'));var util=require(_0x8246('0x1'));var moment=require(_0x8246('0x2'));var BPromise=require(_0x8246('0x3'));var rs=require(_0x8246('0x4'));var fs=require('fs');var Redis=require(_0x8246('0x5'));var db=require(_0x8246('0x6'))['db'];var utils=require(_0x8246('0x7'));var logger=require(_0x8246('0x8'))('rpc');var config=require(_0x8246('0x9'));var jayson=require(_0x8246('0xa'));var client=jayson[_0x8246('0xb')][_0x8246('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5641e4,_0x18dcf5,_0x2488ba){return new BPromise(function(_0x99972d,_0x489388){return client['request'](_0x5641e4,_0x2488ba)[_0x8246('0xd')](function(_0x34c523){logger['info'](_0x8246('0xe'),_0x18dcf5,_0x8246('0xf'));logger[_0x8246('0x10')](_0x8246('0x11'),_0x18dcf5,_0x8246('0xf'),JSON[_0x8246('0x12')](_0x34c523));if(_0x34c523[_0x8246('0x13')]){if(_0x34c523['error'][_0x8246('0x14')]===0x1f4){logger[_0x8246('0x13')](_0x8246('0xe'),_0x18dcf5,_0x34c523[_0x8246('0x13')][_0x8246('0x15')]);return _0x489388(_0x34c523[_0x8246('0x13')][_0x8246('0x15')]);}logger[_0x8246('0x13')](_0x8246('0xe'),_0x18dcf5,_0x34c523[_0x8246('0x13')][_0x8246('0x15')]);return _0x99972d(_0x34c523[_0x8246('0x13')][_0x8246('0x15')]);}else{logger[_0x8246('0x16')](_0x8246('0xe'),_0x18dcf5,_0x8246('0xf'));_0x99972d(_0x34c523['result'][_0x8246('0x15')]);}})[_0x8246('0x17')](function(_0x1ac323){logger['error'](_0x8246('0xe'),_0x18dcf5,_0x1ac323);_0x489388(_0x1ac323);});});} \ No newline at end of file +var _0x6d4b=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x48871b,_0x546dc8){var _0x19cdfa=function(_0x456466){while(--_0x456466){_0x48871b['push'](_0x48871b['shift']());}};_0x19cdfa(++_0x546dc8);}(_0x6d4b,0x1d2));var _0xb6d4=function(_0x3599c8,_0x58a4b9){_0x3599c8=_0x3599c8-0x0;var _0x58611f=_0x6d4b[_0x3599c8];return _0x58611f;};'use strict';var _=require(_0xb6d4('0x0'));var util=require('util');var moment=require(_0xb6d4('0x1'));var BPromise=require(_0xb6d4('0x2'));var rs=require(_0xb6d4('0x3'));var fs=require('fs');var Redis=require(_0xb6d4('0x4'));var db=require(_0xb6d4('0x5'))['db'];var utils=require(_0xb6d4('0x6'));var logger=require(_0xb6d4('0x7'))(_0xb6d4('0x8'));var config=require(_0xb6d4('0x9'));var jayson=require(_0xb6d4('0xa'));var client=jayson['client'][_0xb6d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56ac46,_0x5231c8,_0x34cf3b){return new BPromise(function(_0x5f0715,_0x294bb0){return client[_0xb6d4('0xc')](_0x56ac46,_0x34cf3b)['then'](function(_0xefae5c){logger[_0xb6d4('0xd')](_0xb6d4('0xe'),_0x5231c8,'request\x20sent');logger['debug'](_0xb6d4('0xf'),_0x5231c8,_0xb6d4('0x10'),JSON[_0xb6d4('0x11')](_0xefae5c));if(_0xefae5c[_0xb6d4('0x12')]){if(_0xefae5c[_0xb6d4('0x12')][_0xb6d4('0x13')]===0x1f4){logger[_0xb6d4('0x12')](_0xb6d4('0xe'),_0x5231c8,_0xefae5c[_0xb6d4('0x12')][_0xb6d4('0x14')]);return _0x294bb0(_0xefae5c[_0xb6d4('0x12')]['message']);}logger[_0xb6d4('0x12')](_0xb6d4('0xe'),_0x5231c8,_0xefae5c[_0xb6d4('0x12')][_0xb6d4('0x14')]);return _0x5f0715(_0xefae5c[_0xb6d4('0x12')]['message']);}else{logger[_0xb6d4('0xd')](_0xb6d4('0xe'),_0x5231c8,_0xb6d4('0x10'));_0x5f0715(_0xefae5c[_0xb6d4('0x15')][_0xb6d4('0x14')]);}})[_0xb6d4('0x16')](function(_0x23e6ba){logger[_0xb6d4('0x12')](_0xb6d4('0xe'),_0x5231c8,_0x23e6ba);_0x294bb0(_0x23e6ba);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 6c7bd19..2049f96 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a854d,_0xdff488){var _0x38f126=function(_0x3964ef){while(--_0x3964ef){_0x2a854d['push'](_0x2a854d['shift']());}};_0x38f126(++_0xdff488);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x60dd04,_0x2ef711){var _0x285a78=function(_0x1a8a64){while(--_0x1a8a64){_0x60dd04['push'](_0x60dd04['shift']());}};_0x285a78(++_0x2ef711);}(_0xe706,0xa3));var _0x6e70=function(_0x102287,_0x1c82dc){_0x102287=_0x102287-0x0;var _0x43d29e=_0xe706[_0x102287];return _0x43d29e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f3af8b1..3a7ca96 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 _0x6609=['INTEGER','STRING','exports'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x6609,0x74));var _0x9660=function(_0x4c32a6,_0x156c29){_0x4c32a6=_0x4c32a6-0x0;var _0x20c927=_0x6609[_0x4c32a6];return _0x20c927;};'use strict';var Sequelize=require('sequelize');module[_0x9660('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9660('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9660('0x2')]}}; \ No newline at end of file +var _0xc065=['STRING','sequelize','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc065,0xee));var _0x5c06=function(_0x10cae5,_0x3fbcd6){_0x10cae5=_0x10cae5-0x0;var _0x5c0592=_0xc065[_0x10cae5];return _0x5c0592;};'use strict';var Sequelize=require(_0x5c06('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5c06('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5c06('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5c06('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4d8b039..82c126a 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 _0x8f2b=['define','UserFaxQueue','lodash','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x2507b6,_0x2d059a){var _0x22c8a4=function(_0x3deebb){while(--_0x3deebb){_0x2507b6['push'](_0x2507b6['shift']());}};_0x22c8a4(++_0x2d059a);}(_0x8f2b,0x107));var _0xb8f2=function(_0x27d37f,_0x4f8a1c){_0x27d37f=_0x27d37f-0x0;var _0x3367ed=_0x8f2b[_0x27d37f];return _0x3367ed;};'use strict';var _=require(_0xb8f2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb8f2('0x1'));var rp=require(_0xb8f2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8f2('0x3'));var config=require(_0xb8f2('0x4'));var attributes=require(_0xb8f2('0x5'));module[_0xb8f2('0x6')]=function(_0x5525ed,_0x596658){return _0x5525ed[_0xb8f2('0x7')](_0xb8f2('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2925=['define','UserFaxQueue','user_has_fax_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x3c44d1,_0x46884c){var _0x4b7da9=function(_0x33b6ff){while(--_0x33b6ff){_0x3c44d1['push'](_0x3c44d1['shift']());}};_0x4b7da9(++_0x46884c);}(_0x2925,0x1ca));var _0x5292=function(_0x373087,_0x19ce52){_0x373087=_0x373087-0x0;var _0x57016b=_0x2925[_0x373087];return _0x57016b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5292('0x0'))(_0x5292('0x1'));var moment=require(_0x5292('0x2'));var BPromise=require(_0x5292('0x3'));var rp=require(_0x5292('0x4'));var fs=require('fs');var path=require(_0x5292('0x5'));var rimraf=require(_0x5292('0x6'));var config=require(_0x5292('0x7'));var attributes=require(_0x5292('0x8'));module[_0x5292('0x9')]=function(_0x21a2f4,_0x4b0f81){return _0x21a2f4[_0x5292('0xa')](_0x5292('0xb'),attributes,{'tableName':_0x5292('0xc'),'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 64f5e40..95f13c2 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 _0x7790=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2445f1,_0x38d368){var _0x29dec8=function(_0x39274f){while(--_0x39274f){_0x2445f1['push'](_0x2445f1['shift']());}};_0x29dec8(++_0x38d368);}(_0x7790,0x19a));var _0x0779=function(_0x5e4188,_0x20b280){_0x5e4188=_0x5e4188-0x0;var _0xcc1fe2=_0x7790[_0x5e4188];return _0xcc1fe2;};'use strict';var _=require(_0x0779('0x0'));var util=require(_0x0779('0x1'));var moment=require('moment');var BPromise=require(_0x0779('0x2'));var rs=require(_0x0779('0x3'));var fs=require('fs');var Redis=require(_0x0779('0x4'));var db=require(_0x0779('0x5'))['db'];var utils=require(_0x0779('0x6'));var logger=require(_0x0779('0x7'))(_0x0779('0x8'));var config=require(_0x0779('0x9'));var jayson=require(_0x0779('0xa'));var client=jayson[_0x0779('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5825fa,_0x390e4a,_0x361316){return new BPromise(function(_0x35b6cf,_0x2cd7db){return client[_0x0779('0xc')](_0x5825fa,_0x361316)[_0x0779('0xd')](function(_0x2d0e4e){logger[_0x0779('0xe')](_0x0779('0xf'),_0x390e4a,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x390e4a,'request\x20sent',JSON[_0x0779('0x10')](_0x2d0e4e));if(_0x2d0e4e[_0x0779('0x11')]){if(_0x2d0e4e[_0x0779('0x11')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x390e4a,_0x2d0e4e[_0x0779('0x11')][_0x0779('0x12')]);return _0x2cd7db(_0x2d0e4e[_0x0779('0x11')][_0x0779('0x12')]);}logger['error'](_0x0779('0xf'),_0x390e4a,_0x2d0e4e[_0x0779('0x11')][_0x0779('0x12')]);return _0x35b6cf(_0x2d0e4e[_0x0779('0x11')]['message']);}else{logger[_0x0779('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x390e4a,_0x0779('0x13'));_0x35b6cf(_0x2d0e4e[_0x0779('0x14')][_0x0779('0x12')]);}})[_0x0779('0x15')](function(_0x36eee2){logger['error'](_0x0779('0xf'),_0x390e4a,_0x36eee2);_0x2cd7db(_0x36eee2);});});} \ No newline at end of file +var _0x1a95=['util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','UserFaxQueue,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x3c2bfe,_0x550be9){var _0x1f7cd2=function(_0x369ada){while(--_0x369ada){_0x3c2bfe['push'](_0x3c2bfe['shift']());}};_0x1f7cd2(++_0x550be9);}(_0x1a95,0xef));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x51a9('0x0'));var util=require(_0x51a9('0x1'));var moment=require(_0x51a9('0x2'));var BPromise=require(_0x51a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51a9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x51a9('0x6'));var jayson=require(_0x51a9('0x7'));var client=jayson[_0x51a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x75876b,_0x503b6f,_0x18a6b3){return new BPromise(function(_0x7cfa22,_0x16710c){return client['request'](_0x75876b,_0x18a6b3)[_0x51a9('0x9')](function(_0x189814){logger[_0x51a9('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x503b6f,_0x51a9('0xb'));logger[_0x51a9('0xc')](_0x51a9('0xd'),_0x503b6f,'request\x20sent',JSON[_0x51a9('0xe')](_0x189814));if(_0x189814['error']){if(_0x189814['error'][_0x51a9('0xf')]===0x1f4){logger['error'](_0x51a9('0x10'),_0x503b6f,_0x189814[_0x51a9('0x11')]['message']);return _0x16710c(_0x189814[_0x51a9('0x11')][_0x51a9('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x503b6f,_0x189814[_0x51a9('0x11')][_0x51a9('0x12')]);return _0x7cfa22(_0x189814[_0x51a9('0x11')][_0x51a9('0x12')]);}else{logger[_0x51a9('0xa')](_0x51a9('0x10'),_0x503b6f,_0x51a9('0xb'));_0x7cfa22(_0x189814[_0x51a9('0x13')][_0x51a9('0x12')]);}})['catch'](function(_0x43b544){logger['error'](_0x51a9('0x10'),_0x503b6f,_0x43b544);_0x16710c(_0x43b544);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7f5118c..33b572f 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa4f047,_0x30cffe){var _0x280a03=function(_0x1c4c36){while(--_0x1c4c36){_0xa4f047['push'](_0xa4f047['shift']());}};_0x280a03(++_0x30cffe);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1bd34a,_0x574c63){var _0x1ed08e=function(_0x4f3977){while(--_0x4f3977){_0x1bd34a['push'](_0x1bd34a['shift']());}};_0x1ed08e(++_0x574c63);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1c5a6e7..ef61df9 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 _0xe436=['exports','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe436,0x1ef));var _0x6e43=function(_0x1c7ec6,_0x38f925){_0x1c7ec6=_0x1c7ec6-0x0;var _0x3b0663=_0xe436[_0x1c7ec6];return _0x3b0663;};'use strict';var Sequelize=require(_0x6e43('0x0'));module[_0x6e43('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd6d7=['INTEGER','sequelize','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd6d7,0x70));var _0x7d6d=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xd6d7[_0xb6e2ea];return _0x2a57bb;};'use strict';var Sequelize=require(_0x7d6d('0x0'));module[_0x7d6d('0x1')]={'penalty':{'type':Sequelize[_0x7d6d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4bed3a7..f1e3392 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 _0x3440=['define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0x3440,0xac));var _0x0344=function(_0x9e8c25,_0x2c4ee3){_0x9e8c25=_0x9e8c25-0x0;var _0x130b1d=_0x3440[_0x9e8c25];return _0x130b1d;};'use strict';var _=require(_0x0344('0x0'));var util=require(_0x0344('0x1'));var logger=require('../../config/logger')(_0x0344('0x2'));var moment=require(_0x0344('0x3'));var BPromise=require(_0x0344('0x4'));var rp=require(_0x0344('0x5'));var fs=require('fs');var path=require(_0x0344('0x6'));var rimraf=require('rimraf');var config=require(_0x0344('0x7'));var attributes=require(_0x0344('0x8'));module[_0x0344('0x9')]=function(_0x17c152,_0x5a361d){return _0x17c152[_0x0344('0xa')](_0x0344('0xb'),attributes,{'tableName':_0x0344('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe19d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash'];(function(_0x3212d9,_0x1382e8){var _0x1d875d=function(_0x2e30d4){while(--_0x2e30d4){_0x3212d9['push'](_0x3212d9['shift']());}};_0x1d875d(++_0x1382e8);}(_0xe19d,0xa7));var _0xde19=function(_0x302f85,_0x5bcca3){_0x302f85=_0x302f85-0x0;var _0x5ef7cb=_0xe19d[_0x302f85];return _0x5ef7cb;};'use strict';var _=require(_0xde19('0x0'));var util=require(_0xde19('0x1'));var logger=require(_0xde19('0x2'))(_0xde19('0x3'));var moment=require(_0xde19('0x4'));var BPromise=require(_0xde19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde19('0x6'));var rimraf=require(_0xde19('0x7'));var config=require(_0xde19('0x8'));var attributes=require(_0xde19('0x9'));module['exports']=function(_0x7e6185,_0x20c283){return _0x7e6185[_0xde19('0xa')]('UserMailQueue',attributes,{'tableName':_0xde19('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 1335b88..78c805c 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 _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(_0x55f019,_0x2f1e2a){var _0x25d2ba=function(_0x29c85a){while(--_0x29c85a){_0x55f019['push'](_0x55f019['shift']());}};_0x25d2ba(++_0x2f1e2a);}(_0x34e8,0x12c));var _0x834e=function(_0x17a14d,_0x94a7c1){_0x17a14d=_0x17a14d-0x0;var _0x443486=_0x34e8[_0x17a14d];return _0x443486;};'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 +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2d87dc,_0x988802){var _0x31ac48=function(_0x3d5fe1){while(--_0x3d5fe1){_0x2d87dc['push'](_0x2d87dc['shift']());}};_0x31ac48(++_0x988802);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0x7fbe[_0x83c716];return _0xab9893;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 714f60b..cb62ebe 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 _0x04dd=['connect-timeout','express','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','path'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x04dd,0x1c0));var _0xd04d=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x04dd[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0xd04d('0x0'));var util=require(_0xd04d('0x1'));var path=require(_0xd04d('0x2'));var timeout=require(_0xd04d('0x3'));var express=require(_0xd04d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd04d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd04d('0x6'));var controller=require(_0xd04d('0x7'));router[_0xd04d('0x8')]('/',auth[_0xd04d('0x9')](),controller[_0xd04d('0xa')]);module['exports']=router; \ No newline at end of file +var _0xd003=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0xd003,0xb6));var _0x3d00=function(_0x3c6755,_0x391785){_0x3c6755=_0x3c6755-0x0;var _0x18bc7d=_0xd003[_0x3c6755];return _0x18bc7d;};'use strict';var multer=require(_0x3d00('0x0'));var util=require(_0x3d00('0x1'));var path=require(_0x3d00('0x2'));var timeout=require(_0x3d00('0x3'));var express=require(_0x3d00('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d00('0x5'));var interaction=require(_0x3d00('0x6'));var config=require(_0x3d00('0x7'));var controller=require(_0x3d00('0x8'));router[_0x3d00('0x9')]('/',auth[_0x3d00('0xa')](),controller[_0x3d00('0xb')]);module[_0x3d00('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 cf08501..254c84d 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 _0xdf18=['BOOLEAN','exports','TEXT'];(function(_0x4d086a,_0x88b18b){var _0x4ccc4e=function(_0xf00926){while(--_0xf00926){_0x4d086a['push'](_0x4d086a['shift']());}};_0x4ccc4e(++_0x88b18b);}(_0xdf18,0x19c));var _0x8df1=function(_0xfb63d3,_0x308062){_0xfb63d3=_0xfb63d3-0x0;var _0x523dac=_0xdf18[_0xfb63d3];return _0x523dac;};'use strict';var Sequelize=require('sequelize');module[_0x8df1('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x8df1('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x8df1('0x2')]}}; \ No newline at end of file +var _0x5145=['STRING','TEXT','BOOLEAN'];(function(_0x55f6fa,_0x4fe705){var _0x2445aa=function(_0x3cce64){while(--_0x3cce64){_0x55f6fa['push'](_0x55f6fa['shift']());}};_0x2445aa(++_0x4fe705);}(_0x5145,0x19e));var _0x5514=function(_0x2c5036,_0x3b3da9){_0x2c5036=_0x2c5036-0x0;var _0x4f48b3=_0x5145[_0x2c5036];return _0x4f48b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5514('0x0')]},'recipientsId':{'type':Sequelize[_0x5514('0x1')]},'recipientsDescription':{'type':Sequelize[_0x5514('0x0')]},'beep':{'type':Sequelize[_0x5514('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 11f48a2..e6aaee8 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 _0xc853=['sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','ids','queue','replace','push','all','flatten','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','then','destroy','error','name'];(function(_0x86f85e,_0x3717a0){var _0x240e70=function(_0x17629d){while(--_0x17629d){_0x86f85e['push'](_0x86f85e['shift']());}};_0x240e70(++_0x3717a0);}(_0xc853,0x1be));var _0x3c85=function(_0x25fc82,_0x38fbbc){_0x25fc82=_0x25fc82-0x0;var _0x5bff96=_0xc853[_0x25fc82];return _0x5bff96;};'use strict';var emlformat=require(_0x3c85('0x0'));var rimraf=require(_0x3c85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c85('0x2'));var rp=require(_0x3c85('0x3'));var moment=require(_0x3c85('0x4'));var BPromise=require(_0x3c85('0x5'));var Mustache=require(_0x3c85('0x6'));var util=require(_0x3c85('0x7'));var path=require(_0x3c85('0x8'));var sox=require(_0x3c85('0x9'));var csv=require(_0x3c85('0xa'));var ejs=require(_0x3c85('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c85('0xc'));var squel=require('squel');var crypto=require(_0x3c85('0xd'));var jsforce=require(_0x3c85('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c85('0xf'));var Papa=require(_0x3c85('0x10'));var Redis=require(_0x3c85('0x11'));var authService=require(_0x3c85('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c85('0x13'));var logger=require(_0x3c85('0x14'))('api');var utils=require(_0x3c85('0x15'));var config=require(_0x3c85('0x16'));var licenseUtil=require(_0x3c85('0x17'));var db=require(_0x3c85('0x18'))['db'];config['redis']=_[_0x3c85('0x19')](config[_0x3c85('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c85('0x1b'))(new Redis(config[_0x3c85('0x1a')]));require('./userNotification.socket')[_0x3c85('0x1c')](socket);function respondWithStatusCode(_0x311666,_0x2fd50a){_0x2fd50a=_0x2fd50a||0xcc;return function(_0x2dfad4){if(_0x2dfad4){return _0x311666[_0x3c85('0x1d')](_0x2fd50a);}return _0x311666['status'](_0x2fd50a)[_0x3c85('0x1e')]();};}function respondWithResult(_0x56c4b2,_0x569e54){_0x569e54=_0x569e54||0xc8;return function(_0x42f827){if(_0x42f827){return _0x56c4b2['status'](_0x569e54)[_0x3c85('0x1f')](_0x42f827);}};}function respondWithFilteredResult(_0x2e7d18,_0x3275ba){return function(_0x553481){if(_0x553481){var _0x1c3bf1=typeof _0x3275ba['offset']==='undefined'&&typeof _0x3275ba['limit']==='undefined';var _0x2be4bc=_0x553481[_0x3c85('0x20')];var _0x2febef=_0x1c3bf1?0x0:_0x3275ba[_0x3c85('0x21')];var _0x58f7cb=_0x1c3bf1?_0x553481[_0x3c85('0x20')]:_0x3275ba['offset']+_0x3275ba[_0x3c85('0x22')];var _0x30b77e;if(_0x58f7cb>=_0x2be4bc){_0x58f7cb=_0x2be4bc;_0x30b77e=0xc8;}else{_0x30b77e=0xce;}_0x2e7d18[_0x3c85('0x23')](_0x30b77e);return _0x2e7d18[_0x3c85('0x24')](_0x3c85('0x25'),_0x2febef+'-'+_0x58f7cb+'/'+_0x2be4bc)[_0x3c85('0x1f')](_0x553481);}return null;};}function patchUpdates(_0x4e7b8b){return function(_0x54e6f3){try{jsonpatch['apply'](_0x54e6f3,_0x4e7b8b,!![]);}catch(_0x2f6dd9){return BPromise['reject'](_0x2f6dd9);}return _0x54e6f3[_0x3c85('0x26')]();};}function saveUpdates(_0x518de6,_0x4bca5c){return function(_0x2978ab){if(_0x2978ab){return _0x2978ab[_0x3c85('0x27')](_0x518de6)[_0x3c85('0x28')](function(_0x8a908b){return _0x8a908b;});}return null;};}function removeEntity(_0x44a8ce,_0x31c7a4){return function(_0x437ac5){if(_0x437ac5){return _0x437ac5[_0x3c85('0x29')]()[_0x3c85('0x28')](function(){_0x44a8ce[_0x3c85('0x23')](0xcc)[_0x3c85('0x1e')]();});}};}function handleEntityNotFound(_0x18a3e8,_0x54dedf){return function(_0x36b1bc){if(!_0x36b1bc){_0x18a3e8[_0x3c85('0x1d')](0x194);}return _0x36b1bc;};}function handleError(_0x4036e0,_0x59db6b){_0x59db6b=_0x59db6b||0x1f4;return function(_0x4948b9){logger[_0x3c85('0x2a')](_0x4948b9['stack']);if(_0x4948b9[_0x3c85('0x2b')]){delete _0x4948b9[_0x3c85('0x2b')];}_0x4036e0[_0x3c85('0x23')](_0x59db6b)['send'](_0x4948b9);};}exports[_0x3c85('0x2c')]=function(_0x5b829e,_0x45714e,_0x21f9dc){if(!_0x5b829e['body'][_0x3c85('0x2d')](_0x3c85('0x2e'))&&!_0x5b829e[_0x3c85('0x2f')]['hasOwnProperty'](_0x3c85('0x30'))){throw new db[(_0x3c85('0x31'))][(_0x3c85('0x32'))](_0x3c85('0x33'));}else{if(_0x5b829e[_0x3c85('0x2f')][_0x3c85('0x2d')]('TemplateId')&&!_0x5b829e['body'][_0x3c85('0x2d')](_0x3c85('0x34'))){throw new db[(_0x3c85('0x31'))][(_0x3c85('0x32'))](_0x3c85('0x35'));}if(!_0x5b829e['body'][_0x3c85('0x2d')]('recipients')){throw new db[(_0x3c85('0x31'))]['ValidationError'](_0x3c85('0x36'));}else{try{var _0x21c471=JSON[_0x3c85('0x37')](_0x5b829e[_0x3c85('0x2f')][_0x3c85('0x38')]);}catch(_0x15e0dd){logger[_0x3c85('0x2a')](_0x15e0dd);throw new db[(_0x3c85('0x31'))][(_0x3c85('0x32'))](_0x3c85('0x39'));}var _0x476b35=['chatqueue',_0x3c85('0x3a'),_0x3c85('0x3b'),_0x3c85('0x3c'),_0x3c85('0x3d'),_0x3c85('0x3e'),'whatsappqueue','team',_0x3c85('0x3f')];if(_['some'](_0x21c471,function(_0x59d641){return!_[_0x3c85('0x40')](_0x476b35,_0x59d641['model'][_0x3c85('0x41')]());})){throw new db[(_0x3c85('0x31'))]['ValidationError'](_0x3c85('0x42'));}}}var _0x5a7b45={};_0x5a7b45[_0x3c85('0x43')]=_0x5b829e[_0x3c85('0x2f')]['hasOwnProperty'](_0x3c85('0x43'))?_0x5b829e[_0x3c85('0x2f')][_0x3c85('0x43')]:_0x5b829e[_0x3c85('0x3f')][_0x3c85('0x44')];_0x5a7b45[_0x3c85('0x45')]=_[_0x3c85('0x46')](_0x5b829e[_0x3c85('0x2f')][_0x3c85('0x45')])?null:_0x5b829e['body'][_0x3c85('0x45')];_0x5a7b45[_0x3c85('0x47')]=_0x5b829e['body'][_0x3c85('0x47')]||![];_0x5a7b45['SenderId']=_0x5b829e[_0x3c85('0x3f')]['id'];return getContent(_0x5b829e['body'])['then'](function(_0x5e3f8e){_0x5a7b45[_0x3c85('0x2f')]=_0x5e3f8e;return getRecipients(_0x21c471);})['then'](function(_0x2e3510){_0x5a7b45[_0x3c85('0x48')]=_[_0x3c85('0x49')](_0x2e3510)[_0x3c85('0x4a')](',');return db[_0x3c85('0x4b')][_0x3c85('0x4c')](function(_0x2068ab){return db[_0x3c85('0x4d')][_0x3c85('0x4e')](_0x5a7b45,{'raw':!![],'transaction':_0x2068ab})[_0x3c85('0x28')](function(_0x14560f){var _0x270d94={'sender':_0x5a7b45[_0x3c85('0x43')],'description':_0x5a7b45['recipientsDescription'],'content':_0x5a7b45['body'],'beep':_0x5a7b45[_0x3c85('0x47')]};_0x2e3510[_0x3c85('0x4f')](function(_0x3ffbc1){_0x270d94[_0x3c85('0x50')]=_0x3ffbc1;socket['emit']('userNotification:send',_0x270d94);});return _0x14560f;});});})[_0x3c85('0x28')](respondWithResult(_0x45714e,0xc9))[_0x3c85('0x51')](handleError(_0x45714e,null));};function getContent(_0x1ab0ab){return new BPromise(function(_0x3cd5a1,_0x32c215){if(_0x1ab0ab[_0x3c85('0x2e')]){_0x3cd5a1(_0x1ab0ab[_0x3c85('0x2e')]);return;}return db[_0x3c85('0x52')][_0x3c85('0x53')]({'attributes':[_0x3c85('0x54')],'where':{'id':_0x1ab0ab[_0x3c85('0x30')]},'raw':!![]})['then'](function(_0xe6be5e){if(!_0xe6be5e)throw new db[(_0x3c85('0x31'))][(_0x3c85('0x32'))](_0x3c85('0x55'));var _0x561a94=Mustache[_0x3c85('0x56')](_0xe6be5e[_0x3c85('0x54')],_0x1ab0ab[_0x3c85('0x34')]);_0x3cd5a1(_0x561a94);})[_0x3c85('0x51')](function(_0x12efea){_0x32c215(_0x12efea);});});}function getRecipients(_0x4c0051){return new BPromise(function(_0x59bfd5,_0x572a60){var _0x35f933=[];var _0x856119=[];_0x4c0051[_0x3c85('0x4f')](function(_0x499c4a){var _0x2e9b80=_[_0x3c85('0x57')](_0x499c4a[_0x3c85('0x58')]['toLowerCase']());if(_0x2e9b80===_0x3c85('0x59')){_0x35f933=_[_0x3c85('0x5a')](_0x35f933,_0x499c4a[_0x3c85('0x5b')]);}else{if(_[_0x3c85('0x40')](_0x2e9b80,_0x3c85('0x5c')))_0x2e9b80=_0x2e9b80[_0x3c85('0x5d')](_0x3c85('0x5c'),'Queue');_0x499c4a['ids']['forEach'](function(_0x3abb66){_0x856119[_0x3c85('0x5e')](getAgents(_0x2e9b80,_0x3abb66));});}});return BPromise[_0x3c85('0x5f')](_0x856119)[_0x3c85('0x28')](function(_0x45f652){_0x35f933=_[_0x3c85('0x5a')](_0x35f933,_[_0x3c85('0x60')](_0x45f652));_0x59bfd5(_0x35f933);})[_0x3c85('0x51')](function(_0x1c6994){_0x572a60(_0x1c6994);});});}function getAgents(_0x2e242e,_0x5ceb29){return new BPromise(function(_0x51d627,_0x9256c2){return db[_0x2e242e][_0x3c85('0x53')]({'where':{'id':_0x5ceb29}})['then'](function(_0x3b54cf){return _0x3b54cf[_0x3c85('0x61')]({'attributes':['id'],'raw':!![]})[_0x3c85('0x28')](function(_0x380529){var _0x50d036=_['map'](_0x380529,'id');_0x51d627(_0x50d036);});})['catch'](function(_0x45a2cd){_0x9256c2(_0x45a2cd);});});} \ No newline at end of file +var _0x76ef=['path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','ValidationError','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','includes','model','toLowerCase','senderName','user','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','render','view','User','union','ids','queue','replace','Queue','push','flatten','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x3f5a57,_0x256158){var _0x39a7cd=function(_0x5eb202){while(--_0x5eb202){_0x3f5a57['push'](_0x3f5a57['shift']());}};_0x39a7cd(++_0x256158);}(_0x76ef,0x120));var _0xf76e=function(_0x4265cd,_0xf65194){_0x4265cd=_0x4265cd-0x0;var _0x3c03ca=_0x76ef[_0x4265cd];return _0x3c03ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf76e('0x0'));var zipdir=require(_0xf76e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf76e('0x2'));var BPromise=require(_0xf76e('0x3'));var Mustache=require(_0xf76e('0x4'));var util=require(_0xf76e('0x5'));var path=require(_0xf76e('0x6'));var sox=require('sox');var csv=require(_0xf76e('0x7'));var ejs=require(_0xf76e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf76e('0x9'));var squel=require(_0xf76e('0xa'));var crypto=require(_0xf76e('0xb'));var jsforce=require(_0xf76e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf76e('0x7'));var querystring=require(_0xf76e('0xd'));var Papa=require(_0xf76e('0xe'));var Redis=require(_0xf76e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf76e('0x10'));var as=require(_0xf76e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf76e('0x12'))(_0xf76e('0x13'));var utils=require(_0xf76e('0x14'));var config=require(_0xf76e('0x15'));var licenseUtil=require(_0xf76e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf76e('0x17')](config[_0xf76e('0x18')],{'host':_0xf76e('0x19'),'port':0x18eb});var socket=require(_0xf76e('0x1a'))(new Redis(config[_0xf76e('0x18')]));require(_0xf76e('0x1b'))[_0xf76e('0x1c')](socket);function respondWithStatusCode(_0x3285e7,_0x40a79e){_0x40a79e=_0x40a79e||0xcc;return function(_0x1f7008){if(_0x1f7008){return _0x3285e7[_0xf76e('0x1d')](_0x40a79e);}return _0x3285e7[_0xf76e('0x1e')](_0x40a79e)[_0xf76e('0x1f')]();};}function respondWithResult(_0x14ff60,_0x8218e0){_0x8218e0=_0x8218e0||0xc8;return function(_0x5774cb){if(_0x5774cb){return _0x14ff60['status'](_0x8218e0)[_0xf76e('0x20')](_0x5774cb);}};}function respondWithFilteredResult(_0x37285d,_0x53f21f){return function(_0x4bb819){if(_0x4bb819){var _0x5e9c43=typeof _0x53f21f['offset']===_0xf76e('0x21')&&typeof _0x53f21f[_0xf76e('0x22')]===_0xf76e('0x21');var _0x1c543c=_0x4bb819[_0xf76e('0x23')];var _0x205707=_0x5e9c43?0x0:_0x53f21f[_0xf76e('0x24')];var _0x59f605=_0x5e9c43?_0x4bb819['count']:_0x53f21f[_0xf76e('0x24')]+_0x53f21f['limit'];var _0x4ec031;if(_0x59f605>=_0x1c543c){_0x59f605=_0x1c543c;_0x4ec031=0xc8;}else{_0x4ec031=0xce;}_0x37285d[_0xf76e('0x1e')](_0x4ec031);return _0x37285d[_0xf76e('0x25')](_0xf76e('0x26'),_0x205707+'-'+_0x59f605+'/'+_0x1c543c)[_0xf76e('0x20')](_0x4bb819);}return null;};}function patchUpdates(_0x3c1193){return function(_0x3d7cc9){try{jsonpatch[_0xf76e('0x27')](_0x3d7cc9,_0x3c1193,!![]);}catch(_0x257d84){return BPromise[_0xf76e('0x28')](_0x257d84);}return _0x3d7cc9[_0xf76e('0x29')]();};}function saveUpdates(_0x29cb40,_0x51ab45){return function(_0x4a9204){if(_0x4a9204){return _0x4a9204[_0xf76e('0x2a')](_0x29cb40)[_0xf76e('0x2b')](function(_0x5378f6){return _0x5378f6;});}return null;};}function removeEntity(_0x37775b,_0xa2bd3){return function(_0x4afd91){if(_0x4afd91){return _0x4afd91[_0xf76e('0x2c')]()['then'](function(){_0x37775b[_0xf76e('0x1e')](0xcc)[_0xf76e('0x1f')]();});}};}function handleEntityNotFound(_0x4be3d7,_0xd5e48c){return function(_0x46b600){if(!_0x46b600){_0x4be3d7[_0xf76e('0x1d')](0x194);}return _0x46b600;};}function handleError(_0x54e929,_0xd2b2e2){_0xd2b2e2=_0xd2b2e2||0x1f4;return function(_0x143f43){logger[_0xf76e('0x2d')](_0x143f43[_0xf76e('0x2e')]);if(_0x143f43[_0xf76e('0x2f')]){delete _0x143f43[_0xf76e('0x2f')];}_0x54e929[_0xf76e('0x1e')](_0xd2b2e2)[_0xf76e('0x30')](_0x143f43);};}exports[_0xf76e('0x31')]=function(_0x435561,_0x27cba4,_0x54bec5){if(!_0x435561[_0xf76e('0x32')]['hasOwnProperty']('text')&&!_0x435561[_0xf76e('0x32')][_0xf76e('0x33')](_0xf76e('0x34'))){throw new db['Sequelize']['ValidationError'](_0xf76e('0x35'));}else{if(_0x435561[_0xf76e('0x32')]['hasOwnProperty'](_0xf76e('0x34'))&&!_0x435561[_0xf76e('0x32')][_0xf76e('0x33')]('view')){throw new db[(_0xf76e('0x36'))]['ValidationError'](_0xf76e('0x37'));}if(!_0x435561[_0xf76e('0x32')][_0xf76e('0x33')](_0xf76e('0x38'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1b6585=JSON[_0xf76e('0x39')](_0x435561[_0xf76e('0x32')][_0xf76e('0x38')]);}catch(_0x34315f){logger[_0xf76e('0x2d')](_0x34315f);throw new db['Sequelize'][(_0xf76e('0x3a'))](_0xf76e('0x3b'));}var _0x256452=[_0xf76e('0x3c'),_0xf76e('0x3d'),'mailqueue',_0xf76e('0x3e'),'smsqueue',_0xf76e('0x3f'),_0xf76e('0x40'),'team','user'];if(_['some'](_0x1b6585,function(_0x1dcf32){return!_[_0xf76e('0x41')](_0x256452,_0x1dcf32[_0xf76e('0x42')][_0xf76e('0x43')]());})){throw new db[(_0xf76e('0x36'))][(_0xf76e('0x3a'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4bfeb9={};_0x4bfeb9[_0xf76e('0x44')]=_0x435561[_0xf76e('0x32')][_0xf76e('0x33')]('senderName')?_0x435561[_0xf76e('0x32')][_0xf76e('0x44')]:_0x435561[_0xf76e('0x45')][_0xf76e('0x46')];_0x4bfeb9['recipientsDescription']=_['isEmpty'](_0x435561['body'][_0xf76e('0x47')])?null:_0x435561[_0xf76e('0x32')][_0xf76e('0x47')];_0x4bfeb9[_0xf76e('0x48')]=_0x435561[_0xf76e('0x32')]['beep']||![];_0x4bfeb9['SenderId']=_0x435561['user']['id'];return getContent(_0x435561[_0xf76e('0x32')])[_0xf76e('0x2b')](function(_0x523310){_0x4bfeb9[_0xf76e('0x32')]=_0x523310;return getRecipients(_0x1b6585);})[_0xf76e('0x2b')](function(_0x312f1c){_0x4bfeb9[_0xf76e('0x49')]=_[_0xf76e('0x4a')](_0x312f1c)[_0xf76e('0x4b')](',');return db[_0xf76e('0x4c')]['transaction'](function(_0x847ff9){return db[_0xf76e('0x4d')][_0xf76e('0x4e')](_0x4bfeb9,{'raw':!![],'transaction':_0x847ff9})[_0xf76e('0x2b')](function(_0x2c60a7){var _0x247e23={'sender':_0x4bfeb9[_0xf76e('0x44')],'description':_0x4bfeb9['recipientsDescription'],'content':_0x4bfeb9[_0xf76e('0x32')],'beep':_0x4bfeb9[_0xf76e('0x48')]};_0x312f1c[_0xf76e('0x4f')](function(_0x21c112){_0x247e23[_0xf76e('0x50')]=_0x21c112;socket[_0xf76e('0x51')](_0xf76e('0x52'),_0x247e23);});return _0x2c60a7;});});})[_0xf76e('0x2b')](respondWithResult(_0x27cba4,0xc9))[_0xf76e('0x53')](handleError(_0x27cba4,null));};function getContent(_0x5aef1f){return new BPromise(function(_0x218d7c,_0x25c1e6){if(_0x5aef1f[_0xf76e('0x54')]){_0x218d7c(_0x5aef1f[_0xf76e('0x54')]);return;}return db[_0xf76e('0x55')][_0xf76e('0x56')]({'attributes':[_0xf76e('0x57')],'where':{'id':_0x5aef1f[_0xf76e('0x34')]},'raw':!![]})[_0xf76e('0x2b')](function(_0x4bbf14){if(!_0x4bbf14)throw new db[(_0xf76e('0x36'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3529db=Mustache[_0xf76e('0x58')](_0x4bbf14[_0xf76e('0x57')],_0x5aef1f[_0xf76e('0x59')]);_0x218d7c(_0x3529db);})[_0xf76e('0x53')](function(_0x2719c1){_0x25c1e6(_0x2719c1);});});}function getRecipients(_0x56369d){return new BPromise(function(_0x17efad,_0x1de54d){var _0x3ccbcf=[];var _0xed0b6e=[];_0x56369d[_0xf76e('0x4f')](function(_0x36e938){var _0x4641db=_['startCase'](_0x36e938[_0xf76e('0x42')][_0xf76e('0x43')]());if(_0x4641db===_0xf76e('0x5a')){_0x3ccbcf=_[_0xf76e('0x5b')](_0x3ccbcf,_0x36e938[_0xf76e('0x5c')]);}else{if(_[_0xf76e('0x41')](_0x4641db,_0xf76e('0x5d')))_0x4641db=_0x4641db[_0xf76e('0x5e')](_0xf76e('0x5d'),_0xf76e('0x5f'));_0x36e938[_0xf76e('0x5c')][_0xf76e('0x4f')](function(_0x33baa7){_0xed0b6e[_0xf76e('0x60')](getAgents(_0x4641db,_0x33baa7));});}});return BPromise['all'](_0xed0b6e)[_0xf76e('0x2b')](function(_0x5aa3c0){_0x3ccbcf=_[_0xf76e('0x5b')](_0x3ccbcf,_[_0xf76e('0x61')](_0x5aa3c0));_0x17efad(_0x3ccbcf);})['catch'](function(_0x129586){_0x1de54d(_0x129586);});});}function getAgents(_0x60b9e2,_0x5ed472){return new BPromise(function(_0x35bde5,_0x58697d){return db[_0x60b9e2][_0xf76e('0x56')]({'where':{'id':_0x5ed472}})[_0xf76e('0x2b')](function(_0x4804d6){return _0x4804d6['getAgents']({'attributes':['id'],'raw':!![]})[_0xf76e('0x2b')](function(_0x4e86b1){var _0x5190cc=_['map'](_0x4e86b1,'id');_0x35bde5(_0x5190cc);});})[_0xf76e('0x53')](function(_0x3c9da5){_0x58697d(_0x3c9da5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d470132..4b47326 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 _0x0216=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3ebf7,_0x1f7ede){var _0x31ad7f=function(_0x2c9dd0){while(--_0x2c9dd0){_0x3ebf7['push'](_0x3ebf7['shift']());}};_0x31ad7f(++_0x1f7ede);}(_0x0216,0xd3));var _0x6021=function(_0xa6649a,_0x50f78b){_0xa6649a=_0xa6649a-0x0;var _0x2925d0=_0x0216[_0xa6649a];return _0x2925d0;};'use strict';var EventEmitter=require(_0x6021('0x0'));var UserNotification=require(_0x6021('0x1'))['db'][_0x6021('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6021('0x3')](0x0);var events={'afterCreate':_0x6021('0x4'),'afterUpdate':_0x6021('0x5'),'afterDestroy':_0x6021('0x6')};function emitEvent(_0x1df6dc){return function(_0x4337b8,_0x4e6472,_0x2ba114){UserNotificationEvents[_0x6021('0x7')](_0x1df6dc+':'+_0x4337b8['id'],_0x4337b8);UserNotificationEvents[_0x6021('0x7')](_0x1df6dc,_0x4337b8);_0x2ba114(null);};}for(var e in events){if(events[_0x6021('0x8')](e)){var event=events[e];UserNotification[_0x6021('0x9')](e,emitEvent(event));}}module[_0x6021('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x8ccb=['exports','../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x544d8c,_0x29fc75){var _0xf372a3=function(_0x25015e){while(--_0x25015e){_0x544d8c['push'](_0x544d8c['shift']());}};_0xf372a3(++_0x29fc75);}(_0x8ccb,0x196));var _0xb8cc=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x8ccb[_0x685346];return _0x52e15b;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xb8cc('0x0'))['db'][_0xb8cc('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8cc('0x2'),'afterUpdate':_0xb8cc('0x3'),'afterDestroy':_0xb8cc('0x4')};function emitEvent(_0x26e9f1){return function(_0x162f73,_0x35d236,_0x2cc68b){UserNotificationEvents[_0xb8cc('0x5')](_0x26e9f1+':'+_0x162f73['id'],_0x162f73);UserNotificationEvents['emit'](_0x26e9f1,_0x162f73);_0x2cc68b(null);};}for(var e in events){if(events[_0xb8cc('0x6')](e)){var event=events[e];UserNotification[_0xb8cc('0x7')](e,emitEvent(event));}}module[_0xb8cc('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b808498..5e88586 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 _0xcd6f=['rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','api','bluebird','path'];(function(_0x3e2e40,_0x5e42ed){var _0x3cdf0a=function(_0x5ad21e){while(--_0x5ad21e){_0x3e2e40['push'](_0x3e2e40['shift']());}};_0x3cdf0a(++_0x5e42ed);}(_0xcd6f,0x73));var _0xfcd6=function(_0x54dd89,_0x5af9a4){_0x54dd89=_0x54dd89-0x0;var _0x17fa1a=_0xcd6f[_0x54dd89];return _0x17fa1a;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var logger=require('../../config/logger')(_0xfcd6('0x2'));var moment=require('moment');var BPromise=require(_0xfcd6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd6('0x4'));var rimraf=require(_0xfcd6('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcd6('0x6'));module[_0xfcd6('0x7')]=function(_0x52ad4c,_0x38e3b1){return _0x52ad4c[_0xfcd6('0x8')](_0xfcd6('0x9'),attributes,{'tableName':_0xfcd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfcd6('0xb')});}; \ No newline at end of file +var _0x0198=['rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','lodash','api','moment','bluebird','request-promise','path'];(function(_0x14f769,_0x7523a1){var _0x4d675f=function(_0x3bed34){while(--_0x3bed34){_0x14f769['push'](_0x14f769['shift']());}};_0x4d675f(++_0x7523a1);}(_0x0198,0x14c));var _0x8019=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x0198[_0x45313f];return _0x402910;};'use strict';var _=require(_0x8019('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8019('0x1'));var moment=require(_0x8019('0x2'));var BPromise=require(_0x8019('0x3'));var rp=require(_0x8019('0x4'));var fs=require('fs');var path=require(_0x8019('0x5'));var rimraf=require(_0x8019('0x6'));var config=require(_0x8019('0x7'));var attributes=require(_0x8019('0x8'));module[_0x8019('0x9')]=function(_0x408817,_0x1de70d){return _0x408817[_0x8019('0xa')](_0x8019('0xb'),attributes,{'tableName':_0x8019('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0d8fd7c..32216c0 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 _0x744a=['request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x744a,0x1ec));var _0xa744=function(_0x542063,_0x423b71){_0x542063=_0x542063-0x0;var _0x36f4d7=_0x744a[_0x542063];return _0x36f4d7;};'use strict';var _=require(_0xa744('0x0'));var util=require(_0xa744('0x1'));var moment=require('moment');var BPromise=require(_0xa744('0x2'));var rs=require(_0xa744('0x3'));var fs=require('fs');var Redis=require(_0xa744('0x4'));var db=require(_0xa744('0x5'))['db'];var utils=require(_0xa744('0x6'));var logger=require(_0xa744('0x7'))(_0xa744('0x8'));var config=require(_0xa744('0x9'));var jayson=require(_0xa744('0xa'));var client=jayson[_0xa744('0xb')][_0xa744('0xc')]({'port':0x232a});config[_0xa744('0xd')]=_[_0xa744('0xe')](config[_0xa744('0xd')],{'host':_0xa744('0xf'),'port':0x18eb});var socket=require(_0xa744('0x10'))(new Redis(config[_0xa744('0xd')]));require('./userNotification.socket')[_0xa744('0x11')](socket);function respondWithRpcPromise(_0x1a42ff,_0x5040f2,_0x30aa36){return new BPromise(function(_0x59d100,_0x1bd09f){return client[_0xa744('0x12')](_0x1a42ff,_0x30aa36)[_0xa744('0x13')](function(_0x491dc6){logger[_0xa744('0x14')](_0xa744('0x15'),_0x5040f2,_0xa744('0x16'));logger[_0xa744('0x17')](_0xa744('0x18'),_0x5040f2,_0xa744('0x16'),JSON[_0xa744('0x19')](_0x491dc6));if(_0x491dc6[_0xa744('0x1a')]){if(_0x491dc6[_0xa744('0x1a')]['code']===0x1f4){logger[_0xa744('0x1a')](_0xa744('0x15'),_0x5040f2,_0x491dc6[_0xa744('0x1a')][_0xa744('0x1b')]);return _0x1bd09f(_0x491dc6[_0xa744('0x1a')]['message']);}logger[_0xa744('0x1a')]('UserNotification,\x20%s,\x20%s',_0x5040f2,_0x491dc6[_0xa744('0x1a')][_0xa744('0x1b')]);return _0x59d100(_0x491dc6['error'][_0xa744('0x1b')]);}else{logger['info'](_0xa744('0x15'),_0x5040f2,'request\x20sent');_0x59d100(_0x491dc6[_0xa744('0x1c')][_0xa744('0x1b')]);}})[_0xa744('0x1d')](function(_0x12e5c8){logger['error'](_0xa744('0x15'),_0x5040f2,_0x12e5c8);_0x1bd09f(_0x12e5c8);});});} \ No newline at end of file +var _0xd4bb=['redis','localhost','socket.io-emitter','./userNotification.socket','register','UserNotification,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd4bb,0x1a4));var _0xbd4b=function(_0x540d5b,_0x3bfabf){_0x540d5b=_0x540d5b-0x0;var _0x32603c=_0xd4bb[_0x540d5b];return _0x32603c;};'use strict';var _=require(_0xbd4b('0x0'));var util=require(_0xbd4b('0x1'));var moment=require(_0xbd4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd4b('0x3'));var fs=require('fs');var Redis=require(_0xbd4b('0x4'));var db=require(_0xbd4b('0x5'))['db'];var utils=require(_0xbd4b('0x6'));var logger=require(_0xbd4b('0x7'))(_0xbd4b('0x8'));var config=require(_0xbd4b('0x9'));var jayson=require(_0xbd4b('0xa'));var client=jayson[_0xbd4b('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xbd4b('0xc')],{'host':_0xbd4b('0xd'),'port':0x18eb});var socket=require(_0xbd4b('0xe'))(new Redis(config['redis']));require(_0xbd4b('0xf'))[_0xbd4b('0x10')](socket);function respondWithRpcPromise(_0x412e32,_0x845910,_0x45e549){return new BPromise(function(_0x53ddb9,_0x5d191f){return client['request'](_0x412e32,_0x45e549)['then'](function(_0x9229c5){logger['info'](_0xbd4b('0x11'),_0x845910,_0xbd4b('0x12'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x845910,'request\x20sent',JSON['stringify'](_0x9229c5));if(_0x9229c5['error']){if(_0x9229c5[_0xbd4b('0x13')][_0xbd4b('0x14')]===0x1f4){logger[_0xbd4b('0x13')](_0xbd4b('0x11'),_0x845910,_0x9229c5[_0xbd4b('0x13')][_0xbd4b('0x15')]);return _0x5d191f(_0x9229c5['error'][_0xbd4b('0x15')]);}logger[_0xbd4b('0x13')](_0xbd4b('0x11'),_0x845910,_0x9229c5['error']['message']);return _0x53ddb9(_0x9229c5['error'][_0xbd4b('0x15')]);}else{logger['info'](_0xbd4b('0x11'),_0x845910,_0xbd4b('0x12'));_0x53ddb9(_0x9229c5[_0xbd4b('0x16')]['message']);}})[_0xbd4b('0x17')](function(_0x5c6b11){logger[_0xbd4b('0x13')](_0xbd4b('0x11'),_0x845910,_0x5c6b11);_0x5d191f(_0x5c6b11);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1bb27f2..de51962 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 _0x5f80=['length','./userNotification.events','remove','update','emit','removeListener','register'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x5f80,0x16d));var _0x05f8=function(_0x250ad4,_0x26c311){_0x250ad4=_0x250ad4-0x0;var _0x8503e7=_0x5f80[_0x250ad4];return _0x8503e7;};'use strict';var UserNotificationEvents=require(_0x05f8('0x0'));var events=['save',_0x05f8('0x1'),_0x05f8('0x2')];function createListener(_0x3f4df3,_0x41c52b){return function(_0x2d6412){_0x41c52b[_0x05f8('0x3')](_0x3f4df3,_0x2d6412);};}function removeListener(_0x1ff7a4,_0x3f342a){return function(){UserNotificationEvents[_0x05f8('0x4')](_0x1ff7a4,_0x3f342a);};}exports[_0x05f8('0x5')]=function(_0xc6e6ff){for(var _0x232539=0x0,_0x57b071=events[_0x05f8('0x6')];_0x232539<_0x57b071;_0x232539++){var _0x7c4fa4=events[_0x232539];var _0x5650ab=createListener('userNotification:'+_0x7c4fa4,_0xc6e6ff);UserNotificationEvents['on'](_0x7c4fa4,_0x5650ab);}}; \ No newline at end of file +var _0x9061=['register','length','userNotification:','save','remove','update','emit','removeListener'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x9061,0x103));var _0x1906=function(_0x471782,_0x15bc89){_0x471782=_0x471782-0x0;var _0x85894b=_0x9061[_0x471782];return _0x85894b;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1906('0x0'),_0x1906('0x1'),_0x1906('0x2')];function createListener(_0x11bbe8,_0x41142a){return function(_0x277611){_0x41142a[_0x1906('0x3')](_0x11bbe8,_0x277611);};}function removeListener(_0x209023,_0x3591f9){return function(){UserNotificationEvents[_0x1906('0x4')](_0x209023,_0x3591f9);};}exports[_0x1906('0x5')]=function(_0x7b9cd3){for(var _0x4d0231=0x0,_0x5cec2f=events[_0x1906('0x6')];_0x4d0231<_0x5cec2f;_0x4d0231++){var _0x4dff42=events[_0x4d0231];var _0x50f09d=createListener(_0x1906('0x7')+_0x4dff42,_0x7b9cd3);UserNotificationEvents['on'](_0x4dff42,_0x50f09d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e9b66f5..f45ad5f 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(_0x514f78,_0x29c344){var _0x5f5690=function(_0x41a8dd){while(--_0x41a8dd){_0x514f78['push'](_0x514f78['shift']());}};_0x5f5690(++_0x29c344);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xcb91[_0x4b73a2];return _0x383c66;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cd721,_0x349fb4){var _0x5a1721=function(_0x4e3b6b){while(--_0x4e3b6b){_0x1cd721['push'](_0x1cd721['shift']());}};_0x5a1721(++_0x349fb4);}(_0xe706,0xa3));var _0x6e70=function(_0x4de1c3,_0xbe77b9){_0x4de1c3=_0x4de1c3-0x0;var _0x26acfe=_0xe706[_0x4de1c3];return _0x26acfe;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9f5781d..55fd9f9 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 _0xf12b=['exports','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf12b,0x133));var _0xbf12=function(_0x2a5c9d,_0x47bb2d){_0x2a5c9d=_0x2a5c9d-0x0;var _0x29c58d=_0xf12b[_0x2a5c9d];return _0x29c58d;};'use strict';var Sequelize=require(_0xbf12('0x0'));module[_0xbf12('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdad9=['INTEGER','exports'];(function(_0xcd4d2c,_0x1a5200){var _0x3480e4=function(_0xbb9af6){while(--_0xbb9af6){_0xcd4d2c['push'](_0xcd4d2c['shift']());}};_0x3480e4(++_0x1a5200);}(_0xdad9,0xad));var _0x9dad=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdad9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x9dad('0x0')]={'penalty':{'type':Sequelize[_0x9dad('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4970726..fdfcbde 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 _0xa7d5=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54a1d9,_0x1ebd80){var _0xa1b953=function(_0x5736e1){while(--_0x5736e1){_0x54a1d9['push'](_0x54a1d9['shift']());}};_0xa1b953(++_0x1ebd80);}(_0xa7d5,0x117));var _0x5a7d=function(_0x435bcd,_0x38ff77){_0x435bcd=_0x435bcd-0x0;var _0x341b86=_0xa7d5[_0x435bcd];return _0x341b86;};'use strict';var _=require(_0x5a7d('0x0'));var util=require(_0x5a7d('0x1'));var logger=require(_0x5a7d('0x2'))(_0x5a7d('0x3'));var moment=require(_0x5a7d('0x4'));var BPromise=require(_0x5a7d('0x5'));var rp=require(_0x5a7d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a7d('0x7'));var config=require(_0x5a7d('0x8'));var attributes=require(_0x5a7d('0x9'));module[_0x5a7d('0xa')]=function(_0x347877,_0xe3bc92){return _0x347877[_0x5a7d('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0x5a7d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb65c=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb65c,0x163));var _0xcb65=function(_0x3046da,_0x599123){_0x3046da=_0x3046da-0x0;var _0x467db2=_0xb65c[_0x3046da];return _0x467db2;};'use strict';var _=require(_0xcb65('0x0'));var util=require(_0xcb65('0x1'));var logger=require(_0xcb65('0x2'))(_0xcb65('0x3'));var moment=require(_0xcb65('0x4'));var BPromise=require(_0xcb65('0x5'));var rp=require(_0xcb65('0x6'));var fs=require('fs');var path=require(_0xcb65('0x7'));var rimraf=require(_0xcb65('0x8'));var config=require(_0xcb65('0x9'));var attributes=require(_0xcb65('0xa'));module[_0xcb65('0xb')]=function(_0x1b797d,_0x5eeceb){return _0x1b797d[_0xcb65('0xc')](_0xcb65('0xd'),attributes,{'tableName':_0xcb65('0xe'),'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 daa8bcb..4bd204d 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 _0x711d=['client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x271641,_0x449056){var _0x4a86bf=function(_0x1eabc5){while(--_0x1eabc5){_0x271641['push'](_0x271641['shift']());}};_0x4a86bf(++_0x449056);}(_0x711d,0x1da));var _0xd711=function(_0x522780,_0x3ef830){_0x522780=_0x522780-0x0;var _0x52f53a=_0x711d[_0x522780];return _0x52f53a;};'use strict';var _=require(_0xd711('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd711('0x1'));var rs=require(_0xd711('0x2'));var fs=require('fs');var Redis=require(_0xd711('0x3'));var db=require(_0xd711('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd711('0x5'))(_0xd711('0x6'));var config=require(_0xd711('0x7'));var jayson=require(_0xd711('0x8'));var client=jayson[_0xd711('0x9')][_0xd711('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eced8,_0x25b18a,_0x2daa1e){return new BPromise(function(_0x3bb3ce,_0x3e24be){return client[_0xd711('0xb')](_0x1eced8,_0x2daa1e)[_0xd711('0xc')](function(_0x29686c){logger[_0xd711('0xd')](_0xd711('0xe'),_0x25b18a,_0xd711('0xf'));logger[_0xd711('0x10')](_0xd711('0x11'),_0x25b18a,_0xd711('0xf'),JSON[_0xd711('0x12')](_0x29686c));if(_0x29686c['error']){if(_0x29686c[_0xd711('0x13')][_0xd711('0x14')]===0x1f4){logger[_0xd711('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x25b18a,_0x29686c[_0xd711('0x13')][_0xd711('0x15')]);return _0x3e24be(_0x29686c[_0xd711('0x13')]['message']);}logger[_0xd711('0x13')](_0xd711('0xe'),_0x25b18a,_0x29686c[_0xd711('0x13')][_0xd711('0x15')]);return _0x3bb3ce(_0x29686c[_0xd711('0x13')][_0xd711('0x15')]);}else{logger['info'](_0xd711('0xe'),_0x25b18a,_0xd711('0xf'));_0x3bb3ce(_0x29686c['result'][_0xd711('0x15')]);}})[_0xd711('0x16')](function(_0x2a137f){logger[_0xd711('0x13')](_0xd711('0xe'),_0x25b18a,_0x2a137f);_0x3e24be(_0x2a137f);});});} \ No newline at end of file +var _0xa65d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird'];(function(_0xc216fa,_0x1c4a45){var _0x31213e=function(_0x29d648){while(--_0x29d648){_0xc216fa['push'](_0xc216fa['shift']());}};_0x31213e(++_0x1c4a45);}(_0xa65d,0x142));var _0xda65=function(_0x439f12,_0x5ab687){_0x439f12=_0x439f12-0x0;var _0x393579=_0xa65d[_0x439f12];return _0x393579;};'use strict';var _=require('lodash');var util=require(_0xda65('0x0'));var moment=require(_0xda65('0x1'));var BPromise=require(_0xda65('0x2'));var rs=require(_0xda65('0x3'));var fs=require('fs');var Redis=require(_0xda65('0x4'));var db=require(_0xda65('0x5'))['db'];var utils=require(_0xda65('0x6'));var logger=require(_0xda65('0x7'))('rpc');var config=require(_0xda65('0x8'));var jayson=require(_0xda65('0x9'));var client=jayson[_0xda65('0xa')][_0xda65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574a8a,_0x474a3b,_0x2bdfb4){return new BPromise(function(_0x5b6d98,_0x15fb50){return client[_0xda65('0xc')](_0x574a8a,_0x2bdfb4)[_0xda65('0xd')](function(_0x5f19eb){logger[_0xda65('0xe')](_0xda65('0xf'),_0x474a3b,'request\x20sent');logger[_0xda65('0x10')](_0xda65('0x11'),_0x474a3b,'request\x20sent',JSON[_0xda65('0x12')](_0x5f19eb));if(_0x5f19eb[_0xda65('0x13')]){if(_0x5f19eb['error'][_0xda65('0x14')]===0x1f4){logger[_0xda65('0x13')](_0xda65('0xf'),_0x474a3b,_0x5f19eb['error']['message']);return _0x15fb50(_0x5f19eb['error']['message']);}logger[_0xda65('0x13')](_0xda65('0xf'),_0x474a3b,_0x5f19eb[_0xda65('0x13')][_0xda65('0x15')]);return _0x5b6d98(_0x5f19eb[_0xda65('0x13')][_0xda65('0x15')]);}else{logger[_0xda65('0xe')](_0xda65('0xf'),_0x474a3b,_0xda65('0x16'));_0x5b6d98(_0x5f19eb[_0xda65('0x17')][_0xda65('0x15')]);}})[_0xda65('0x18')](function(_0x567644){logger['error'](_0xda65('0xf'),_0x474a3b,_0x567644);_0x15fb50(_0x567644);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3937ae8..918811a 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 _0x2a4f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','describe','/:id','isAuthenticated','/:id/sections','/:id/resources','getResources','create','clone','post','addSections','put','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express'];(function(_0x11e49c,_0x3f1d29){var _0x23dcdb=function(_0x1dea7c){while(--_0x1dea7c){_0x11e49c['push'](_0x11e49c['shift']());}};_0x23dcdb(++_0x3f1d29);}(_0x2a4f,0x1af));var _0xf2a4=function(_0x1f1bbc,_0x40ca9b){_0x1f1bbc=_0x1f1bbc-0x0;var _0x3f9d0d=_0x2a4f[_0x1f1bbc];return _0x3f9d0d;};'use strict';var multer=require('multer');var util=require(_0xf2a4('0x0'));var path=require(_0xf2a4('0x1'));var timeout=require(_0xf2a4('0x2'));var express=require(_0xf2a4('0x3'));var router=express[_0xf2a4('0x4')]();var fs_extra=require(_0xf2a4('0x5'));var auth=require(_0xf2a4('0x6'));var interaction=require(_0xf2a4('0x7'));var config=require(_0xf2a4('0x8'));var controller=require(_0xf2a4('0x9'));router[_0xf2a4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf2a4('0xb'),auth['isAuthenticated'](),controller[_0xf2a4('0xc')]);router[_0xf2a4('0xa')](_0xf2a4('0xd'),auth[_0xf2a4('0xe')](),controller['show']);router[_0xf2a4('0xa')](_0xf2a4('0xf'),auth[_0xf2a4('0xe')](),controller['getSections']);router['get'](_0xf2a4('0x10'),auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x11')]);router['post']('/',auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x12')]);router['post']('/:id/clone',auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x13')]);router[_0xf2a4('0x14')](_0xf2a4('0xf'),auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x15')]);router['post'](_0xf2a4('0x10'),auth[_0xf2a4('0xe')](),controller['addResources']);router[_0xf2a4('0x16')]('/:id',auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x17')]);router[_0xf2a4('0x18')]('/:id',auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x19')]);router[_0xf2a4('0x18')](_0xf2a4('0xf'),auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x1a')]);router[_0xf2a4('0x18')]('/:id/resources',auth[_0xf2a4('0xe')](),controller[_0xf2a4('0x1b')]);module[_0xf2a4('0x1c')]=router; \ No newline at end of file +var _0xb30b=['addSections','addResources','update','delete','destroy','removeSections','removeResources','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','getSections','/:id/resources','post','create','/:id/clone','clone','/:id/sections'];(function(_0x95dd85,_0x4c85d2){var _0x2752fb=function(_0x52e490){while(--_0x52e490){_0x95dd85['push'](_0x95dd85['shift']());}};_0x2752fb(++_0x4c85d2);}(_0xb30b,0x181));var _0xbb30=function(_0x53b304,_0x1efbab){_0x53b304=_0x53b304-0x0;var _0x471654=_0xb30b[_0x53b304];return _0x471654;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbb30('0x0'));var express=require(_0xbb30('0x1'));var router=express[_0xbb30('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbb30('0x3'));var interaction=require(_0xbb30('0x4'));var config=require(_0xbb30('0x5'));var controller=require(_0xbb30('0x6'));router[_0xbb30('0x7')]('/',auth[_0xbb30('0x8')](),controller[_0xbb30('0x9')]);router[_0xbb30('0x7')]('/describe',auth[_0xbb30('0x8')](),controller[_0xbb30('0xa')]);router[_0xbb30('0x7')](_0xbb30('0xb'),auth[_0xbb30('0x8')](),controller[_0xbb30('0xc')]);router[_0xbb30('0x7')]('/:id/sections',auth[_0xbb30('0x8')](),controller[_0xbb30('0xd')]);router[_0xbb30('0x7')](_0xbb30('0xe'),auth[_0xbb30('0x8')](),controller['getResources']);router[_0xbb30('0xf')]('/',auth[_0xbb30('0x8')](),controller[_0xbb30('0x10')]);router['post'](_0xbb30('0x11'),auth['isAuthenticated'](),controller[_0xbb30('0x12')]);router['post'](_0xbb30('0x13'),auth[_0xbb30('0x8')](),controller[_0xbb30('0x14')]);router[_0xbb30('0xf')]('/:id/resources',auth['isAuthenticated'](),controller[_0xbb30('0x15')]);router['put'](_0xbb30('0xb'),auth[_0xbb30('0x8')](),controller[_0xbb30('0x16')]);router[_0xbb30('0x17')](_0xbb30('0xb'),auth[_0xbb30('0x8')](),controller[_0xbb30('0x18')]);router[_0xbb30('0x17')]('/:id/sections',auth[_0xbb30('0x8')](),controller[_0xbb30('0x19')]);router['delete']('/:id/resources',auth[_0xbb30('0x8')](),controller[_0xbb30('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5c9f6d8..f23d025 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 _0xb209=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x561935,_0x5a6071){var _0x4f01b2=function(_0x45a82f){while(--_0x45a82f){_0x561935['push'](_0x561935['shift']());}};_0x4f01b2(++_0x5a6071);}(_0xb209,0xe8));var _0x9b20=function(_0x1780b4,_0x16801c){_0x1780b4=_0x1780b4-0x0;var _0x199010=_0xb209[_0x1780b4];return _0x199010;};'use strict';var Sequelize=require(_0x9b20('0x0'));module[_0x9b20('0x1')]={'name':{'type':Sequelize[_0x9b20('0x2')],'allowNull':![],'unique':_0x9b20('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x48d036){this[_0x9b20('0x4')](_0x9b20('0x5'),_0x48d036?_0x48d036[_0x9b20('0x6')](''):[]);},'get':function(){return this[_0x9b20('0x7')]('crudPermissions')?this[_0x9b20('0x7')](_0x9b20('0x5'))[_0x9b20('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9b20('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9b20('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9b20('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9b20('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9b20('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9b20('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9b20('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7630=['BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x7630,0xfd));var _0x0763=function(_0x22790f,_0x381a53){_0x22790f=_0x22790f-0x0;var _0x440429=_0x7630[_0x22790f];return _0x440429;};'use strict';var Sequelize=require(_0x0763('0x0'));module[_0x0763('0x1')]={'name':{'type':Sequelize[_0x0763('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4e4597){this[_0x0763('0x3')](_0x0763('0x4'),_0x4e4597?_0x4e4597[_0x0763('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0763('0x4'))?this[_0x0763('0x6')](_0x0763('0x4'))[_0x0763('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0763('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0763('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1584d82..d0f11d4 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 _0xfda5=['transaction','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','destroy','describe','addSections','each','push','removeSections','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','then','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','rows','catch','params','fields','includeAll','include','find','create','body','clone','get','omit','createdAt','crudPermissions','updatedAt','sequelize'];(function(_0xfafe54,_0x23c9a6){var _0x4ab8e6=function(_0x23942c){while(--_0x23942c){_0xfafe54['push'](_0xfafe54['shift']());}};_0x4ab8e6(++_0x23c9a6);}(_0xfda5,0x91));var _0x5fda=function(_0x5b7f40,_0x2c1e5f){_0x5b7f40=_0x5b7f40-0x0;var _0x34d5f4=_0xfda5[_0x5b7f40];return _0x34d5f4;};'use strict';var emlformat=require(_0x5fda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fda('0x1'));var jsonpatch=require(_0x5fda('0x2'));var rp=require('request-promise');var moment=require(_0x5fda('0x3'));var BPromise=require(_0x5fda('0x4'));var Mustache=require(_0x5fda('0x5'));var util=require('util');var path=require(_0x5fda('0x6'));var sox=require(_0x5fda('0x7'));var csv=require(_0x5fda('0x8'));var ejs=require(_0x5fda('0x9'));var fs=require('fs');var fs_extra=require(_0x5fda('0xa'));var _=require(_0x5fda('0xb'));var squel=require(_0x5fda('0xc'));var crypto=require(_0x5fda('0xd'));var jsforce=require(_0x5fda('0xe'));var deskjs=require(_0x5fda('0xf'));var toCsv=require(_0x5fda('0x8'));var querystring=require('querystring');var Papa=require(_0x5fda('0x10'));var Redis=require(_0x5fda('0x11'));var authService=require(_0x5fda('0x12'));var qs=require(_0x5fda('0x13'));var as=require(_0x5fda('0x14'));var hardwareService=require(_0x5fda('0x15'));var logger=require(_0x5fda('0x16'))(_0x5fda('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5fda('0x18'))['db'];config[_0x5fda('0x19')]=_[_0x5fda('0x1a')](config['redis'],{'host':_0x5fda('0x1b'),'port':0x18eb});var socket=require(_0x5fda('0x1c'))(new Redis(config[_0x5fda('0x19')]));require(_0x5fda('0x1d'))[_0x5fda('0x1e')](socket);function respondWithStatusCode(_0x22203b,_0x2a6b48){_0x2a6b48=_0x2a6b48||0xcc;return function(_0x234dc2){if(_0x234dc2){return _0x22203b[_0x5fda('0x1f')](_0x2a6b48);}return _0x22203b['status'](_0x2a6b48)[_0x5fda('0x20')]();};}function respondWithResult(_0x56c4e8,_0x5d1ba6){_0x5d1ba6=_0x5d1ba6||0xc8;return function(_0x48886a){if(_0x48886a){return _0x56c4e8[_0x5fda('0x21')](_0x5d1ba6)[_0x5fda('0x22')](_0x48886a);}};}function respondWithFilteredResult(_0x565542,_0x633b5d){return function(_0x54e635){if(_0x54e635){var _0x5d1fed=typeof _0x633b5d[_0x5fda('0x23')]===_0x5fda('0x24')&&typeof _0x633b5d[_0x5fda('0x25')]===_0x5fda('0x24');var _0x35265c=_0x54e635['count'];var _0x36569e=_0x5d1fed?0x0:_0x633b5d[_0x5fda('0x23')];var _0x32c55b=_0x5d1fed?_0x54e635['count']:_0x633b5d[_0x5fda('0x23')]+_0x633b5d['limit'];var _0xa06a85;if(_0x32c55b>=_0x35265c){_0x32c55b=_0x35265c;_0xa06a85=0xc8;}else{_0xa06a85=0xce;}_0x565542[_0x5fda('0x21')](_0xa06a85);return _0x565542[_0x5fda('0x26')](_0x5fda('0x27'),_0x36569e+'-'+_0x32c55b+'/'+_0x35265c)[_0x5fda('0x22')](_0x54e635);}return null;};}function patchUpdates(_0x12b910){return function(_0x25041d){try{jsonpatch[_0x5fda('0x28')](_0x25041d,_0x12b910,!![]);}catch(_0x538141){return BPromise['reject'](_0x538141);}return _0x25041d[_0x5fda('0x29')]();};}function saveUpdates(_0x2b6758,_0x15a5bb){return function(_0x41171c){if(_0x41171c){return _0x41171c['update'](_0x2b6758)['then'](function(_0x3b15d5){return _0x3b15d5;});}return null;};}function removeEntity(_0x1d28c5,_0x5bedad){return function(_0x3d6fda){if(_0x3d6fda){return _0x3d6fda['destroy']()[_0x5fda('0x2a')](function(){_0x1d28c5[_0x5fda('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0989f,_0x1a94d9){return function(_0x462ad0){if(!_0x462ad0){_0xd0989f[_0x5fda('0x1f')](0x194);}return _0x462ad0;};}function handleError(_0x25a0d4,_0x1cae2d){_0x1cae2d=_0x1cae2d||0x1f4;return function(_0x511152){logger[_0x5fda('0x2b')](_0x511152[_0x5fda('0x2c')]);if(_0x511152[_0x5fda('0x2d')]){delete _0x511152['name'];}_0x25a0d4[_0x5fda('0x21')](_0x1cae2d)[_0x5fda('0x2e')](_0x511152);};}exports['index']=function(_0x1d8b77,_0x20c6a7){var _0x124216={},_0x5d55b6={},_0x376bb5={'count':0x0,'rows':[]};var _0x3f9f7b=_['map'](db[_0x5fda('0x2f')][_0x5fda('0x30')],function(_0xc4899){return{'name':_0xc4899[_0x5fda('0x31')],'type':_0xc4899[_0x5fda('0x32')][_0x5fda('0x33')]};});_0x5d55b6[_0x5fda('0x34')]=_[_0x5fda('0x35')](_0x3f9f7b,'name');_0x5d55b6[_0x5fda('0x36')]=_[_0x5fda('0x37')](_0x1d8b77[_0x5fda('0x36')]);_0x5d55b6[_0x5fda('0x38')]=_[_0x5fda('0x39')](_0x5d55b6['model'],_0x5d55b6['query']);_0x124216[_0x5fda('0x3a')]=_[_0x5fda('0x39')](_0x5d55b6[_0x5fda('0x34')],qs['fields'](_0x1d8b77[_0x5fda('0x36')]['fields']));_0x124216['attributes']=_0x124216[_0x5fda('0x3a')][_0x5fda('0x3b')]?_0x124216[_0x5fda('0x3a')]:_0x5d55b6[_0x5fda('0x34')];if(!_0x1d8b77[_0x5fda('0x36')][_0x5fda('0x3c')](_0x5fda('0x3d'))){_0x124216[_0x5fda('0x25')]=qs[_0x5fda('0x25')](_0x1d8b77[_0x5fda('0x36')][_0x5fda('0x25')]);_0x124216[_0x5fda('0x23')]=qs[_0x5fda('0x23')](_0x1d8b77[_0x5fda('0x36')][_0x5fda('0x23')]);}_0x124216[_0x5fda('0x3e')]=qs[_0x5fda('0x3f')](_0x1d8b77[_0x5fda('0x36')][_0x5fda('0x3f')]);_0x124216[_0x5fda('0x40')]=qs[_0x5fda('0x38')](_[_0x5fda('0x41')](_0x1d8b77[_0x5fda('0x36')],_0x5d55b6[_0x5fda('0x38')]),_0x3f9f7b);if(_0x1d8b77[_0x5fda('0x36')][_0x5fda('0x42')]){_0x124216[_0x5fda('0x40')]=_['merge'](_0x124216[_0x5fda('0x40')],{'$or':_['map'](_0x3f9f7b,function(_0x1de62b){if(_0x1de62b[_0x5fda('0x32')]!==_0x5fda('0x43')){var _0x385d9e={};_0x385d9e[_0x1de62b['name']]={'$like':'%'+_0x1d8b77[_0x5fda('0x36')][_0x5fda('0x42')]+'%'};return _0x385d9e;}})});}_0x124216=_[_0x5fda('0x44')]({},_0x124216,_0x1d8b77[_0x5fda('0x45')]);var _0xfec80e={'where':_0x124216[_0x5fda('0x40')]};return db['UserProfile']['count'](_0xfec80e)[_0x5fda('0x2a')](function(_0x41daae){_0x376bb5[_0x5fda('0x46')]=_0x41daae;if(_0x1d8b77['query']['includeAll']){_0x124216['include']=[{'all':!![]}];}return db[_0x5fda('0x2f')]['findAll'](_0x124216);})[_0x5fda('0x2a')](function(_0x4e0bb6){_0x376bb5[_0x5fda('0x47')]=_0x4e0bb6;return _0x376bb5;})[_0x5fda('0x2a')](respondWithFilteredResult(_0x20c6a7,_0x124216))[_0x5fda('0x48')](handleError(_0x20c6a7,null));};exports['show']=function(_0x11a1d8,_0x9550b8){var _0x248e67={'raw':![],'where':{'id':_0x11a1d8[_0x5fda('0x49')]['id']}},_0x560bd7={};_0x560bd7[_0x5fda('0x34')]=_[_0x5fda('0x37')](db[_0x5fda('0x2f')][_0x5fda('0x30')]);_0x560bd7[_0x5fda('0x36')]=_[_0x5fda('0x37')](_0x11a1d8[_0x5fda('0x36')]);_0x560bd7[_0x5fda('0x38')]=_[_0x5fda('0x39')](_0x560bd7[_0x5fda('0x34')],_0x560bd7[_0x5fda('0x36')]);_0x248e67[_0x5fda('0x3a')]=_['intersection'](_0x560bd7[_0x5fda('0x34')],qs[_0x5fda('0x4a')](_0x11a1d8[_0x5fda('0x36')]['fields']));_0x248e67[_0x5fda('0x3a')]=_0x248e67['attributes'][_0x5fda('0x3b')]?_0x248e67['attributes']:_0x560bd7['model'];if(_0x11a1d8['query'][_0x5fda('0x4b')]){_0x248e67[_0x5fda('0x4c')]=[{'all':!![]}];}_0x248e67=_[_0x5fda('0x44')]({},_0x248e67,_0x11a1d8[_0x5fda('0x45')]);return db[_0x5fda('0x2f')][_0x5fda('0x4d')](_0x248e67)['then'](handleEntityNotFound(_0x9550b8,null))[_0x5fda('0x2a')](respondWithResult(_0x9550b8,null))[_0x5fda('0x48')](handleError(_0x9550b8,null));};exports[_0x5fda('0x4e')]=function(_0x22560a,_0x40c5d3){return db['UserProfile'][_0x5fda('0x4e')](_0x22560a[_0x5fda('0x4f')],{})[_0x5fda('0x2a')](respondWithResult(_0x40c5d3,0xc9))[_0x5fda('0x48')](handleError(_0x40c5d3,null));};exports[_0x5fda('0x50')]=function(_0x25f615,_0x3c884a){var _0x3da2cb={'where':{'id':_0x25f615['params']['id']}},_0x1ab198={};_0x1ab198[_0x5fda('0x34')]=_[_0x5fda('0x37')](db['UserProfile'][_0x5fda('0x30')]);_0x3da2cb[_0x5fda('0x3a')]=_[_0x5fda('0x39')](_0x1ab198[_0x5fda('0x34')],qs[_0x5fda('0x4a')](_0x25f615[_0x5fda('0x36')][_0x5fda('0x4a')]));_0x3da2cb[_0x5fda('0x3a')]=_0x3da2cb[_0x5fda('0x3a')]['length']?_0x3da2cb[_0x5fda('0x3a')]:_0x1ab198[_0x5fda('0x34')];if(_0x25f615['query'][_0x5fda('0x4b')]){_0x3da2cb[_0x5fda('0x4c')]=[{'all':!![]}];}_0x3da2cb=_[_0x5fda('0x44')]({},_0x3da2cb,_0x25f615[_0x5fda('0x45')]);return db['UserProfile']['find'](_0x3da2cb)[_0x5fda('0x2a')](handleEntityNotFound(_0x3c884a,null))['then'](function(_0xa2059f){if(_0xa2059f){var _0x1827fb=_0xa2059f[_0x5fda('0x51')]({'plain':!![]});_0x1827fb=qs[_0x5fda('0x52')](_0x1827fb,['id',_0x5fda('0x53'),'updatedAt',_0x5fda('0x54')]);_0x25f615[_0x5fda('0x4f')]=_['omit'](_0x25f615[_0x5fda('0x4f')],['id',_0x5fda('0x53'),_0x5fda('0x55')]);return db[_0x5fda('0x56')][_0x5fda('0x57')](function(_0x587e89){return db[_0x5fda('0x2f')]['create'](_[_0x5fda('0x44')](_0x1827fb,_0x25f615[_0x5fda('0x4f')]),{'include':_0x25f615[_0x5fda('0x36')][_0x5fda('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x587e89})[_0x5fda('0x2a')](function(_0x102c9b){var _0x48b446=_0x102c9b[_0x5fda('0x51')]({'plain':!![]});return db[_0x5fda('0x58')][_0x5fda('0x59')]({'where':{'userProfileId':_0x25f615[_0x5fda('0x49')]['id']},'raw':!![]})[_0x5fda('0x2a')](function(_0x3ab18f){if(_0x3ab18f){return BPromise['each'](_0x3ab18f,function(_0x47c460){return new BPromise(function(_0x76c684,_0x1741e5){if(_0x47c460[_0x5fda('0x5a')]===null||_0x47c460[_0x5fda('0x5a')]===0x1)_0x76c684(null);return db[_0x5fda('0x5b')][_0x5fda('0x59')]({'where':{'sectionId':_0x47c460['id']},'raw':!![]})[_0x5fda('0x2a')](function(_0x576c43){var _0x53142e=_[_0x5fda('0x35')](_0x576c43,function(_0x2cd999){return qs[_0x5fda('0x52')](_0x2cd999,['id',_0x5fda('0x53'),_0x5fda('0x55'),_0x5fda('0x5c')]);});_0x76c684(_0x53142e);})[_0x5fda('0x48')](function(_0x290335){_0x1741e5(_0x290335);});})['then'](function(_0x3077a0){var _0x1edece=qs[_0x5fda('0x52')](_0x47c460,['id',_0x5fda('0x53'),_0x5fda('0x55')]);_0x1edece[_0x5fda('0x5d')]=_0x48b446['id'];if(_0x3077a0)_0x1edece[_0x5fda('0x5e')]=_0x3077a0;return _0x1edece;})['then'](function(_0xa3fac2){return db[_0x5fda('0x58')]['create'](_0xa3fac2,{'include':[{'model':db[_0x5fda('0x5b')],'as':_0x5fda('0x5e')}],'raw':!![],'transaction':_0x587e89});});})[_0x5fda('0x2a')](function(){return _0x48b446;});}});});});}})[_0x5fda('0x2a')](respondWithResult(_0x3c884a,0xc9))['catch'](handleError(_0x3c884a,null));};exports[_0x5fda('0x5f')]=function(_0xf3615d,_0xe6f21f){if(_0xf3615d[_0x5fda('0x4f')]['id']){delete _0xf3615d[_0x5fda('0x4f')]['id'];}return db[_0x5fda('0x2f')][_0x5fda('0x4d')]({'where':{'id':_0xf3615d['params']['id']}})[_0x5fda('0x2a')](handleEntityNotFound(_0xe6f21f,null))['then'](saveUpdates(_0xf3615d[_0x5fda('0x4f')],null))[_0x5fda('0x2a')](respondWithResult(_0xe6f21f,null))['catch'](handleError(_0xe6f21f,null));};exports[_0x5fda('0x60')]=function(_0x2c24ac,_0x2341f6){return db[_0x5fda('0x2f')]['find']({'where':{'id':_0x2c24ac[_0x5fda('0x49')]['id']}})['then'](handleEntityNotFound(_0x2341f6,null))[_0x5fda('0x2a')](removeEntity(_0x2341f6,null))[_0x5fda('0x48')](handleError(_0x2341f6,null));};exports[_0x5fda('0x61')]=function(_0x10b14c,_0x2b328c){return db[_0x5fda('0x2f')][_0x5fda('0x61')]()[_0x5fda('0x2a')](respondWithResult(_0x2b328c,null))['catch'](handleError(_0x2b328c,null));};exports[_0x5fda('0x62')]=function(_0x1d3cd1,_0x30f047){var _0x11c376=_0x1d3cd1['body'];return db[_0x5fda('0x2f')]['find']({'where':{'id':_0x1d3cd1[_0x5fda('0x49')]['id']}})[_0x5fda('0x2a')](handleEntityNotFound(_0x30f047,null))['then'](function(_0x291925){if(_0x291925){return db[_0x5fda('0x56')][_0x5fda('0x57')](function(_0x39c832){return db['UserProfileSection'][_0x5fda('0x60')]({'where':{'userProfileId':_0x1d3cd1[_0x5fda('0x49')]['id'],'sectionId':_[_0x5fda('0x35')](_0x11c376,function(_0x5440b9){return _0x5440b9['sectionId'];})},'transaction':_0x39c832})['then'](function(){var _0x92e6eb=_[_0x5fda('0x35')](_0x11c376,function(_0x91a12c){_0x91a12c[_0x5fda('0x5d')]=_0x1d3cd1[_0x5fda('0x49')]['id'];return _0x91a12c;});var _0x18ac04=[];return BPromise[_0x5fda('0x63')](_0x92e6eb,function(_0x429ef3){return db[_0x5fda('0x58')]['create'](_0x429ef3,{'include':[{'model':db[_0x5fda('0x5b')],'as':_0x5fda('0x5e')}],'raw':!![],'transaction':_0x39c832})[_0x5fda('0x2a')](function(_0x559a70){_0x18ac04[_0x5fda('0x64')](_0x559a70['get']({'plain':!![]}));});})['then'](function(){return _0x18ac04;});});});}})[_0x5fda('0x2a')](function(_0x324c19){return _0x324c19;})[_0x5fda('0x2a')](respondWithResult(_0x30f047,null))[_0x5fda('0x48')](handleError(_0x30f047,null));};exports[_0x5fda('0x65')]=function(_0x12517b,_0x59ab8c){var _0x542c87;return db['UserProfile'][_0x5fda('0x4d')]({'where':{'id':_0x12517b[_0x5fda('0x49')]['id']},'attributes':['id','name']})[_0x5fda('0x2a')](handleEntityNotFound(_0x59ab8c,null))[_0x5fda('0x2a')](function(_0x270e67){if(_0x270e67){_0x542c87=_0x270e67;return db[_0x5fda('0x58')]['destroy']({'where':{'userProfileId':_0x12517b[_0x5fda('0x49')]['id'],'sectionId':_0x12517b['query']['ids']}});}})[_0x5fda('0x2a')](function(){return _0x542c87;})[_0x5fda('0x2a')](respondWithStatusCode(_0x59ab8c,null))[_0x5fda('0x48')](handleError(_0x59ab8c,null));};exports[_0x5fda('0x66')]=function(_0x29745c,_0x5769a1){var _0x69e23c=[];var _0x909ef6=[];return db[_0x5fda('0x58')][_0x5fda('0x59')]({'where':{'userProfileId':_0x29745c[_0x5fda('0x49')]['id']},'raw':!![]})['then'](function(_0x5e3d3f){_0x69e23c=_['filter'](_0x5e3d3f,function(_0x131c75){return _0x131c75[_0x5fda('0x67')]===0x1||_[_0x5fda('0x68')]([0x3eb,0x709],_0x131c75[_0x5fda('0x5c')]);});if(!_['isEmpty'](_0x69e23c)){return _[_0x5fda('0x35')](_0x69e23c,function(_0x1db5f5){return _0x1db5f5['sectionId'];});}else{return;}})[_0x5fda('0x2a')](function(_0x2f7248){if(_0x2f7248)_0x909ef6=_0x2f7248;if(_[_0x5fda('0x68')](_0x909ef6,0x64)){var _0x552986=_['find'](_0x69e23c,{'sectionId':0x64});return hasDefaultDashboard(_0x552986)[_0x5fda('0x2a')](function(_0x1955d9){return _[_0x5fda('0x35')](_0x69e23c,function(_0x1020f0){if(_0x1020f0[_0x5fda('0x5c')]===0x64){_0x1020f0[_0x5fda('0x69')]=_0x1955d9;}return _0x1020f0;});});}else{return;}})[_0x5fda('0x2a')](function(_0x1f530a){if(_0x1f530a)_0x69e23c=_0x1f530a;if(_[_0x5fda('0x68')](_0x909ef6,0x3eb)){var _0x454860=_[_0x5fda('0x4d')](_0x69e23c,{'sectionId':0x3eb});return getCustomDashboards(_0x454860)[_0x5fda('0x2a')](function(_0x338f10){return _['map'](_0x69e23c,function(_0x52e8b2){if(_0x454860[_0x5fda('0x67')]){if(_0x52e8b2[_0x5fda('0x5c')]===0x3eb){_0x52e8b2[_0x5fda('0x69')]=_0x338f10;}}else{if(_0x52e8b2[_0x5fda('0x5c')]===0x64){if(!_0x52e8b2[_0x5fda('0x69')]){_0x52e8b2[_0x5fda('0x69')]=[];}_0x52e8b2[_0x5fda('0x69')]=_0x52e8b2[_0x5fda('0x69')][_0x5fda('0x6a')](_0x338f10);}}return _0x52e8b2;});});}else{return;}})[_0x5fda('0x2a')](function(_0x44c4b6){if(_0x44c4b6)_0x69e23c=_0x44c4b6;if(_[_0x5fda('0x68')](_0x909ef6,0x709)){var _0x46105a=_[_0x5fda('0x4d')](_0x69e23c,{'sectionId':0x709});return getPlugins(_0x46105a)['then'](function(_0x49e437){if(_0x46105a[_0x5fda('0x67')]){return _[_0x5fda('0x35')](_0x69e23c,function(_0x4eaeb8){if(_0x4eaeb8[_0x5fda('0x5c')]===0x709){_0x4eaeb8[_0x5fda('0x69')]=_0x49e437;}return _0x4eaeb8;});}else{var _0x2c0c4d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x49e437};var _0x11e616=_[_0x5fda('0x35')](_0x69e23c);_0x11e616['push'](_0x2c0c4d);return _0x11e616;}});}else{return;}})[_0x5fda('0x2a')](function(_0x5e84b4){if(_0x5e84b4)_0x69e23c=_0x5e84b4;return _[_0x5fda('0x42')](_0x69e23c,[_0x5fda('0x67'),0x1]);})[_0x5fda('0x2a')](respondWithResult(_0x5769a1,null))[_0x5fda('0x48')](handleError(_0x5769a1,null));};function hasDefaultDashboard(_0x2ee774){var _0x2b914f=[0x65];return new BPromise(function(_0x570e5d,_0x1aea7d){try{if(_0x2ee774[_0x5fda('0x5a')]){_0x570e5d(_0x2b914f);}else{return db[_0x5fda('0x5b')][_0x5fda('0x6b')]({'where':{'sectionId':_0x2ee774['id']},'raw':!![]})['then'](function(_0x27e11a){_0x27e11a?_0x570e5d(_0x2b914f):_0x570e5d();});}}catch(_0xecdbff){_0x1aea7d(_0xecdbff);}});}function getCustomDashboards(_0x1cb8bf){var _0xcc5670=[];return new BPromise(function(_0x1b5d4d,_0x1a745b){try{if(_0x1cb8bf[_0x5fda('0x5a')]){return db[_0x5fda('0x6c')]['findAll']({'raw':!![]})[_0x5fda('0x2a')](function(_0x298094){_0x298094[_0x5fda('0x6d')](function(_0x5eff5b){_0xcc5670[_0x5fda('0x64')](_0x5eff5b['id']+0x1869f);});_0x1b5d4d(_0xcc5670);});}else{return db[_0x5fda('0x5b')][_0x5fda('0x59')]({'where':{'sectionId':_0x1cb8bf['id']},'raw':!![]})[_0x5fda('0x2a')](function(_0x3c9003){_0x3c9003[_0x5fda('0x6d')](function(_0x2a6f1c){_0xcc5670['push'](_0x2a6f1c[_0x5fda('0x6e')]+0x1869f);});_0x1b5d4d(_0xcc5670);});}}catch(_0xf0d97b){_0x1a745b(_0xf0d97b);}});}function getPlugins(_0x2d0b33){var _0x549fa7=[];return new BPromise(function(_0x23e515,_0x1b0995){try{if(_0x2d0b33[_0x5fda('0x5a')]){return db['Plugin']['findAll']({'raw':!![]})['then'](function(_0x24013d){_0x24013d[_0x5fda('0x6d')](function(_0x19e6a0){_0x549fa7[_0x5fda('0x64')](_0x19e6a0['id']+0x15b38);});_0x23e515(_0x549fa7);});}else{return db['UserProfileResource'][_0x5fda('0x59')]({'where':{'sectionId':_0x2d0b33['id']},'raw':!![]})[_0x5fda('0x2a')](function(_0x14d0b3){_0x14d0b3[_0x5fda('0x6d')](function(_0x3fcf0a){_0x549fa7[_0x5fda('0x64')](_0x3fcf0a[_0x5fda('0x6e')]+0x15b38);});_0x23e515(_0x549fa7);});}}catch(_0x180c80){_0x1b0995(_0x180c80);}});}exports[_0x5fda('0x6f')]=function(_0x5a7b35,_0x190bd5){return db['UserProfile'][_0x5fda('0x4d')]({'where':{'id':_0x5a7b35['params']['id']}})[_0x5fda('0x2a')](handleEntityNotFound(_0x190bd5,null))[_0x5fda('0x2a')](function(_0xff2d2b){if(_0xff2d2b){return db[_0x5fda('0x56')]['transaction'](function(_0x389000){return db[_0x5fda('0x58')][_0x5fda('0x59')]({'where':{'userProfileId':_0x5a7b35['params']['id']},'attributes':['id'],'raw':!![]})[_0x5fda('0x2a')](function(_0x47daed){if(_0x47daed){return db[_0x5fda('0x58')]['destroy']({'where':{'userProfileId':_0x5a7b35[_0x5fda('0x49')]['id'],'id':_[_0x5fda('0x35')](_0x47daed,function(_0xa11c25){return _0xa11c25['id'];})},'transaction':_0x389000});}})[_0x5fda('0x2a')](function(_0x2796ca){var _0x44f789=_[_0x5fda('0x35')](_0x5a7b35[_0x5fda('0x4f')],function(_0x342262){_0x342262['userProfileId']=_0x5a7b35['params']['id'];return _0x342262;});return db[_0x5fda('0x58')][_0x5fda('0x70')](_0x44f789,{'raw':!![],'transaction':_0x389000});})[_0x5fda('0x2a')](function(_0x30f65c){var _0x1c3715=_[_0x5fda('0x42')](_[_0x5fda('0x35')](_0x30f65c,function(_0x261c3e){return _0x261c3e[_0x5fda('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x1c3715){return db[_0x5fda('0x58')]['findAll']({'where':{'userProfileId':_0x5a7b35[_0x5fda('0x49')]['id'],'sectionId':_[_0x5fda('0x35')](_0x1c3715,function(_0x1cef8c){return _0x1cef8c[_0x5fda('0x5c')];})},'attributes':['id',_0x5fda('0x5c')],'raw':!![]})[_0x5fda('0x2a')](function(_0xd297de){var _0x36efa5=_[_0x5fda('0x35')](_0x5a7b35[_0x5fda('0x4f')],function(_0x32f8b2){_0x32f8b2['userProfileId']=_0x5a7b35[_0x5fda('0x49')]['id'];return _0x32f8b2;});return db[_0x5fda('0x5b')][_0x5fda('0x70')](_0x36efa5,{'raw':!![],'transaction':_0x389000});});}})['catch'](handleError(_0x190bd5,null));});}})['then'](function(_0x19cc5c){var _0x134ed6=_['map'](_0x19cc5c,function(_0x2c5def){return _0x2c5def[_0x5fda('0x51')]({'plain':!![]});});})[_0x5fda('0x2a')](respondWithResult(_0x190bd5,null))[_0x5fda('0x48')](handleError(_0x190bd5,null));};exports['removeResources']=function(_0x3857f2,_0x3e89eb,_0x3c5180){return db[_0x5fda('0x2f')][_0x5fda('0x4d')]({'where':{'id':_0x3857f2[_0x5fda('0x49')]['id']}})[_0x5fda('0x2a')](handleEntityNotFound(_0x3e89eb,null))['then'](function(_0x2408a3){if(_0x2408a3){return _0x2408a3['removeResources'](_0x3857f2[_0x5fda('0x36')]['ids']);}})[_0x5fda('0x2a')](respondWithStatusCode(_0x3e89eb,null))['catch'](handleError(_0x3e89eb,null));};exports[_0x5fda('0x71')]=function(_0x585a13,_0x38a5d8){var _0x4e2272={};if(!_0x585a13[_0x5fda('0x36')]['section'])throw new Error(_0x5fda('0x72'));if(!_0x585a13[_0x5fda('0x36')][_0x5fda('0x3c')](_0x5fda('0x3d'))){_0x4e2272[_0x5fda('0x25')]=qs['limit'](_0x585a13[_0x5fda('0x36')][_0x5fda('0x25')]);_0x4e2272[_0x5fda('0x23')]=qs[_0x5fda('0x23')](_0x585a13[_0x5fda('0x36')][_0x5fda('0x23')]);}return db[_0x5fda('0x2f')]['find']({'where':{'id':_0x585a13[_0x5fda('0x49')]['id']}})['then'](function(_0x55acd){if(!_0x55acd)throw new Error(_0x5fda('0x73')+_0x585a13[_0x5fda('0x49')]['id']);return db[_0x5fda('0x2f')][_0x5fda('0x71')](_0x585a13);})[_0x5fda('0x2a')](respondWithFilteredResult(_0x38a5d8,_0x4e2272))[_0x5fda('0x48')](handleError(_0x38a5d8,null));}; \ No newline at end of file +var _0x1111=['send','index','map','UserProfile','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','get','omit','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources','update','find','describe','addSections','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x5d3639,_0xb59c8){var _0x1aaa93=function(_0x1c0d89){while(--_0x1c0d89){_0x5d3639['push'](_0x5d3639['shift']());}};_0x1aaa93(++_0xb59c8);}(_0x1111,0x195));var _0x1111=function(_0x3ac7e0,_0x46c5fd){_0x3ac7e0=_0x3ac7e0-0x0;var _0x4b5f0b=_0x1111[_0x3ac7e0];return _0x4b5f0b;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require(_0x1111('0x1'));var zipdir=require(_0x1111('0x2'));var jsonpatch=require(_0x1111('0x3'));var rp=require('request-promise');var moment=require(_0x1111('0x4'));var BPromise=require(_0x1111('0x5'));var Mustache=require('mustache');var util=require(_0x1111('0x6'));var path=require('path');var sox=require(_0x1111('0x7'));var csv=require(_0x1111('0x8'));var ejs=require(_0x1111('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1111('0xa'));var squel=require(_0x1111('0xb'));var crypto=require(_0x1111('0xc'));var jsforce=require(_0x1111('0xd'));var deskjs=require(_0x1111('0xe'));var toCsv=require(_0x1111('0x8'));var querystring=require('querystring');var Papa=require(_0x1111('0xf'));var Redis=require(_0x1111('0x10'));var authService=require(_0x1111('0x11'));var qs=require(_0x1111('0x12'));var as=require(_0x1111('0x13'));var hardwareService=require(_0x1111('0x14'));var logger=require(_0x1111('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1111('0x16'));var licenseUtil=require(_0x1111('0x17'));var db=require('../../mysqldb')['db'];config[_0x1111('0x18')]=_[_0x1111('0x19')](config['redis'],{'host':_0x1111('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1111('0x18')]));require(_0x1111('0x1b'))[_0x1111('0x1c')](socket);function respondWithStatusCode(_0x5d212c,_0x50c7f0){_0x50c7f0=_0x50c7f0||0xcc;return function(_0x563e34){if(_0x563e34){return _0x5d212c[_0x1111('0x1d')](_0x50c7f0);}return _0x5d212c[_0x1111('0x1e')](_0x50c7f0)[_0x1111('0x1f')]();};}function respondWithResult(_0x416809,_0x3cb618){_0x3cb618=_0x3cb618||0xc8;return function(_0x5b5d9a){if(_0x5b5d9a){return _0x416809['status'](_0x3cb618)[_0x1111('0x20')](_0x5b5d9a);}};}function respondWithFilteredResult(_0xe7b012,_0x210d23){return function(_0x6f64d0){if(_0x6f64d0){var _0x282e5f=typeof _0x210d23[_0x1111('0x21')]===_0x1111('0x22')&&typeof _0x210d23[_0x1111('0x23')]===_0x1111('0x22');var _0x442408=_0x6f64d0[_0x1111('0x24')];var _0x1218f5=_0x282e5f?0x0:_0x210d23[_0x1111('0x21')];var _0x5303ad=_0x282e5f?_0x6f64d0[_0x1111('0x24')]:_0x210d23[_0x1111('0x21')]+_0x210d23['limit'];var _0x1ae06b;if(_0x5303ad>=_0x442408){_0x5303ad=_0x442408;_0x1ae06b=0xc8;}else{_0x1ae06b=0xce;}_0xe7b012[_0x1111('0x1e')](_0x1ae06b);return _0xe7b012[_0x1111('0x25')](_0x1111('0x26'),_0x1218f5+'-'+_0x5303ad+'/'+_0x442408)[_0x1111('0x20')](_0x6f64d0);}return null;};}function patchUpdates(_0x236e85){return function(_0x1e04a3){try{jsonpatch[_0x1111('0x27')](_0x1e04a3,_0x236e85,!![]);}catch(_0xb58226){return BPromise[_0x1111('0x28')](_0xb58226);}return _0x1e04a3[_0x1111('0x29')]();};}function saveUpdates(_0x31e4b0,_0x2d1184){return function(_0x1eced6){if(_0x1eced6){return _0x1eced6['update'](_0x31e4b0)[_0x1111('0x2a')](function(_0x126310){return _0x126310;});}return null;};}function removeEntity(_0x537bf5,_0x156ea2){return function(_0x32f453){if(_0x32f453){return _0x32f453[_0x1111('0x2b')]()[_0x1111('0x2a')](function(){_0x537bf5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32d284,_0x1ef660){return function(_0x209fe6){if(!_0x209fe6){_0x32d284[_0x1111('0x1d')](0x194);}return _0x209fe6;};}function handleError(_0x323829,_0x3f0630){_0x3f0630=_0x3f0630||0x1f4;return function(_0x210b0b){logger[_0x1111('0x2c')](_0x210b0b[_0x1111('0x2d')]);if(_0x210b0b[_0x1111('0x2e')]){delete _0x210b0b[_0x1111('0x2e')];}_0x323829[_0x1111('0x1e')](_0x3f0630)[_0x1111('0x2f')](_0x210b0b);};}exports[_0x1111('0x30')]=function(_0x869c6a,_0x430182){var _0x3d075a={},_0x1f35cf={},_0x36e5c4={'count':0x0,'rows':[]};var _0x5dc2a7=_[_0x1111('0x31')](db[_0x1111('0x32')][_0x1111('0x33')],function(_0x31bf01){return{'name':_0x31bf01[_0x1111('0x34')],'type':_0x31bf01['type'][_0x1111('0x35')]};});_0x1f35cf['model']=_[_0x1111('0x31')](_0x5dc2a7,_0x1111('0x2e'));_0x1f35cf[_0x1111('0x36')]=_['keys'](_0x869c6a[_0x1111('0x36')]);_0x1f35cf[_0x1111('0x37')]=_[_0x1111('0x38')](_0x1f35cf[_0x1111('0x39')],_0x1f35cf[_0x1111('0x36')]);_0x3d075a[_0x1111('0x3a')]=_[_0x1111('0x38')](_0x1f35cf['model'],qs['fields'](_0x869c6a[_0x1111('0x36')]['fields']));_0x3d075a[_0x1111('0x3a')]=_0x3d075a[_0x1111('0x3a')][_0x1111('0x3b')]?_0x3d075a['attributes']:_0x1f35cf[_0x1111('0x39')];if(!_0x869c6a[_0x1111('0x36')][_0x1111('0x3c')](_0x1111('0x3d'))){_0x3d075a[_0x1111('0x23')]=qs[_0x1111('0x23')](_0x869c6a[_0x1111('0x36')]['limit']);_0x3d075a[_0x1111('0x21')]=qs['offset'](_0x869c6a[_0x1111('0x36')][_0x1111('0x21')]);}_0x3d075a['order']=qs[_0x1111('0x3e')](_0x869c6a[_0x1111('0x36')]['sort']);_0x3d075a['where']=qs['filters'](_[_0x1111('0x3f')](_0x869c6a[_0x1111('0x36')],_0x1f35cf[_0x1111('0x37')]),_0x5dc2a7);if(_0x869c6a['query'][_0x1111('0x40')]){_0x3d075a['where']=_[_0x1111('0x41')](_0x3d075a[_0x1111('0x42')],{'$or':_[_0x1111('0x31')](_0x5dc2a7,function(_0x4ee147){if(_0x4ee147[_0x1111('0x43')]!=='VIRTUAL'){var _0x4480ab={};_0x4480ab[_0x4ee147[_0x1111('0x2e')]]={'$like':'%'+_0x869c6a[_0x1111('0x36')]['filter']+'%'};return _0x4480ab;}})});}_0x3d075a=_[_0x1111('0x41')]({},_0x3d075a,_0x869c6a[_0x1111('0x44')]);var _0x3ef40a={'where':_0x3d075a['where']};return db[_0x1111('0x32')][_0x1111('0x24')](_0x3ef40a)[_0x1111('0x2a')](function(_0x9af7c4){_0x36e5c4['count']=_0x9af7c4;if(_0x869c6a[_0x1111('0x36')][_0x1111('0x45')]){_0x3d075a[_0x1111('0x46')]=[{'all':!![]}];}return db[_0x1111('0x32')][_0x1111('0x47')](_0x3d075a);})['then'](function(_0x338127){_0x36e5c4[_0x1111('0x48')]=_0x338127;return _0x36e5c4;})['then'](respondWithFilteredResult(_0x430182,_0x3d075a))[_0x1111('0x49')](handleError(_0x430182,null));};exports[_0x1111('0x4a')]=function(_0x526491,_0x4d5213){var _0x158b22={'raw':![],'where':{'id':_0x526491[_0x1111('0x4b')]['id']}},_0x599dda={};_0x599dda[_0x1111('0x39')]=_[_0x1111('0x4c')](db[_0x1111('0x32')][_0x1111('0x33')]);_0x599dda['query']=_[_0x1111('0x4c')](_0x526491['query']);_0x599dda['filters']=_[_0x1111('0x38')](_0x599dda[_0x1111('0x39')],_0x599dda['query']);_0x158b22[_0x1111('0x3a')]=_[_0x1111('0x38')](_0x599dda[_0x1111('0x39')],qs[_0x1111('0x4d')](_0x526491[_0x1111('0x36')][_0x1111('0x4d')]));_0x158b22['attributes']=_0x158b22['attributes'][_0x1111('0x3b')]?_0x158b22[_0x1111('0x3a')]:_0x599dda[_0x1111('0x39')];if(_0x526491[_0x1111('0x36')][_0x1111('0x45')]){_0x158b22[_0x1111('0x46')]=[{'all':!![]}];}_0x158b22=_[_0x1111('0x41')]({},_0x158b22,_0x526491['options']);return db['UserProfile']['find'](_0x158b22)[_0x1111('0x2a')](handleEntityNotFound(_0x4d5213,null))['then'](respondWithResult(_0x4d5213,null))['catch'](handleError(_0x4d5213,null));};exports['create']=function(_0x568c2f,_0x2d62cb){return db[_0x1111('0x32')][_0x1111('0x4e')](_0x568c2f[_0x1111('0x4f')],{})['then'](respondWithResult(_0x2d62cb,0xc9))['catch'](handleError(_0x2d62cb,null));};exports['clone']=function(_0x4eac7d,_0x24ce28){var _0x46d3bc={'where':{'id':_0x4eac7d['params']['id']}},_0x47f917={};_0x47f917['model']=_[_0x1111('0x4c')](db['UserProfile'][_0x1111('0x33')]);_0x46d3bc[_0x1111('0x3a')]=_['intersection'](_0x47f917[_0x1111('0x39')],qs[_0x1111('0x4d')](_0x4eac7d[_0x1111('0x36')][_0x1111('0x4d')]));_0x46d3bc[_0x1111('0x3a')]=_0x46d3bc[_0x1111('0x3a')][_0x1111('0x3b')]?_0x46d3bc[_0x1111('0x3a')]:_0x47f917[_0x1111('0x39')];if(_0x4eac7d[_0x1111('0x36')][_0x1111('0x45')]){_0x46d3bc[_0x1111('0x46')]=[{'all':!![]}];}_0x46d3bc=_[_0x1111('0x41')]({},_0x46d3bc,_0x4eac7d[_0x1111('0x44')]);return db[_0x1111('0x32')]['find'](_0x46d3bc)[_0x1111('0x2a')](handleEntityNotFound(_0x24ce28,null))[_0x1111('0x2a')](function(_0x475221){if(_0x475221){var _0x14358b=_0x475221[_0x1111('0x50')]({'plain':!![]});_0x14358b=qs[_0x1111('0x51')](_0x14358b,['id','createdAt','updatedAt',_0x1111('0x52')]);_0x4eac7d[_0x1111('0x4f')]=_[_0x1111('0x51')](_0x4eac7d[_0x1111('0x4f')],['id',_0x1111('0x53'),'updatedAt']);return db[_0x1111('0x54')][_0x1111('0x55')](function(_0x475f67){return db[_0x1111('0x32')][_0x1111('0x4e')](_[_0x1111('0x41')](_0x14358b,_0x4eac7d[_0x1111('0x4f')]),{'include':_0x4eac7d[_0x1111('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x475f67})[_0x1111('0x2a')](function(_0x13e589){var _0x54700d=_0x13e589[_0x1111('0x50')]({'plain':!![]});return db[_0x1111('0x56')][_0x1111('0x47')]({'where':{'userProfileId':_0x4eac7d[_0x1111('0x4b')]['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x123436){if(_0x123436){return BPromise[_0x1111('0x57')](_0x123436,function(_0x3b6290){return new BPromise(function(_0xf70f33,_0x77b3ab){if(_0x3b6290[_0x1111('0x58')]===null||_0x3b6290[_0x1111('0x58')]===0x1)_0xf70f33(null);return db[_0x1111('0x59')][_0x1111('0x47')]({'where':{'sectionId':_0x3b6290['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x1fe4b4){var _0x544993=_[_0x1111('0x31')](_0x1fe4b4,function(_0x1b7b55){return qs[_0x1111('0x51')](_0x1b7b55,['id',_0x1111('0x53'),_0x1111('0x5a'),'sectionId']);});_0xf70f33(_0x544993);})[_0x1111('0x49')](function(_0x5c460b){_0x77b3ab(_0x5c460b);});})[_0x1111('0x2a')](function(_0x2a5f1d){var _0x45ade6=qs[_0x1111('0x51')](_0x3b6290,['id',_0x1111('0x53'),_0x1111('0x5a')]);_0x45ade6[_0x1111('0x5b')]=_0x54700d['id'];if(_0x2a5f1d)_0x45ade6['Resources']=_0x2a5f1d;return _0x45ade6;})[_0x1111('0x2a')](function(_0x4bb9ed){return db[_0x1111('0x56')][_0x1111('0x4e')](_0x4bb9ed,{'include':[{'model':db[_0x1111('0x59')],'as':_0x1111('0x5c')}],'raw':!![],'transaction':_0x475f67});});})[_0x1111('0x2a')](function(){return _0x54700d;});}});});});}})[_0x1111('0x2a')](respondWithResult(_0x24ce28,0xc9))[_0x1111('0x49')](handleError(_0x24ce28,null));};exports[_0x1111('0x5d')]=function(_0x38748a,_0x1cde51){if(_0x38748a[_0x1111('0x4f')]['id']){delete _0x38748a[_0x1111('0x4f')]['id'];}return db['UserProfile'][_0x1111('0x5e')]({'where':{'id':_0x38748a[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x1cde51,null))['then'](saveUpdates(_0x38748a[_0x1111('0x4f')],null))[_0x1111('0x2a')](respondWithResult(_0x1cde51,null))[_0x1111('0x49')](handleError(_0x1cde51,null));};exports['destroy']=function(_0x36f2b6,_0x550be3){return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x36f2b6[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x550be3,null))[_0x1111('0x2a')](removeEntity(_0x550be3,null))[_0x1111('0x49')](handleError(_0x550be3,null));};exports['describe']=function(_0x1482bc,_0x254f94){return db['UserProfile'][_0x1111('0x5f')]()[_0x1111('0x2a')](respondWithResult(_0x254f94,null))[_0x1111('0x49')](handleError(_0x254f94,null));};exports[_0x1111('0x60')]=function(_0x26421a,_0x14ea45){var _0x984dd2=_0x26421a['body'];return db['UserProfile']['find']({'where':{'id':_0x26421a[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x14ea45,null))[_0x1111('0x2a')](function(_0x5ace8f){if(_0x5ace8f){return db[_0x1111('0x54')][_0x1111('0x55')](function(_0x24d8f4){return db['UserProfileSection'][_0x1111('0x2b')]({'where':{'userProfileId':_0x26421a['params']['id'],'sectionId':_[_0x1111('0x31')](_0x984dd2,function(_0x4fe99d){return _0x4fe99d[_0x1111('0x61')];})},'transaction':_0x24d8f4})[_0x1111('0x2a')](function(){var _0x1f6293=_['map'](_0x984dd2,function(_0x2b7b82){_0x2b7b82['userProfileId']=_0x26421a['params']['id'];return _0x2b7b82;});var _0x815d28=[];return BPromise[_0x1111('0x57')](_0x1f6293,function(_0x4effcd){return db['UserProfileSection'][_0x1111('0x4e')](_0x4effcd,{'include':[{'model':db[_0x1111('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x24d8f4})[_0x1111('0x2a')](function(_0x51b0a4){_0x815d28[_0x1111('0x62')](_0x51b0a4[_0x1111('0x50')]({'plain':!![]}));});})[_0x1111('0x2a')](function(){return _0x815d28;});});});}})[_0x1111('0x2a')](function(_0x1f3833){return _0x1f3833;})['then'](respondWithResult(_0x14ea45,null))[_0x1111('0x49')](handleError(_0x14ea45,null));};exports[_0x1111('0x63')]=function(_0x31425f,_0xda044f){var _0x166094;return db[_0x1111('0x32')]['find']({'where':{'id':_0x31425f[_0x1111('0x4b')]['id']},'attributes':['id',_0x1111('0x2e')]})[_0x1111('0x2a')](handleEntityNotFound(_0xda044f,null))[_0x1111('0x2a')](function(_0x23caf8){if(_0x23caf8){_0x166094=_0x23caf8;return db['UserProfileSection'][_0x1111('0x2b')]({'where':{'userProfileId':_0x31425f[_0x1111('0x4b')]['id'],'sectionId':_0x31425f[_0x1111('0x36')][_0x1111('0x64')]}});}})[_0x1111('0x2a')](function(){return _0x166094;})['then'](respondWithStatusCode(_0xda044f,null))[_0x1111('0x49')](handleError(_0xda044f,null));};exports[_0x1111('0x65')]=function(_0x46265c,_0x55397e){var _0x418cf9=[];var _0x8384=[];return db[_0x1111('0x56')][_0x1111('0x47')]({'where':{'userProfileId':_0x46265c[_0x1111('0x4b')]['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x276c4f){_0x418cf9=_[_0x1111('0x40')](_0x276c4f,function(_0x51da6a){return _0x51da6a[_0x1111('0x66')]===0x1||_[_0x1111('0x67')]([0x3eb,0x709],_0x51da6a[_0x1111('0x61')]);});if(!_['isEmpty'](_0x418cf9)){return _['map'](_0x418cf9,function(_0x54e933){return _0x54e933['sectionId'];});}else{return;}})[_0x1111('0x2a')](function(_0x3a6b1b){if(_0x3a6b1b)_0x8384=_0x3a6b1b;if(_[_0x1111('0x67')](_0x8384,0x64)){var _0x545e81=_['find'](_0x418cf9,{'sectionId':0x64});return hasDefaultDashboard(_0x545e81)['then'](function(_0x247f41){return _[_0x1111('0x31')](_0x418cf9,function(_0x540bd4){if(_0x540bd4[_0x1111('0x61')]===0x64){_0x540bd4['subsections']=_0x247f41;}return _0x540bd4;});});}else{return;}})[_0x1111('0x2a')](function(_0x5d4da3){if(_0x5d4da3)_0x418cf9=_0x5d4da3;if(_[_0x1111('0x67')](_0x8384,0x3eb)){var _0x2a8f0f=_[_0x1111('0x5e')](_0x418cf9,{'sectionId':0x3eb});return getCustomDashboards(_0x2a8f0f)[_0x1111('0x2a')](function(_0x347401){return _[_0x1111('0x31')](_0x418cf9,function(_0x35531d){if(_0x2a8f0f[_0x1111('0x66')]){if(_0x35531d['sectionId']===0x3eb){_0x35531d[_0x1111('0x68')]=_0x347401;}}else{if(_0x35531d[_0x1111('0x61')]===0x64){if(!_0x35531d[_0x1111('0x68')]){_0x35531d['subsections']=[];}_0x35531d[_0x1111('0x68')]=_0x35531d['subsections'][_0x1111('0x69')](_0x347401);}}return _0x35531d;});});}else{return;}})[_0x1111('0x2a')](function(_0x115fd4){if(_0x115fd4)_0x418cf9=_0x115fd4;if(_['includes'](_0x8384,0x709)){var _0x5bf5a6=_[_0x1111('0x5e')](_0x418cf9,{'sectionId':0x709});return getPlugins(_0x5bf5a6)[_0x1111('0x2a')](function(_0x505c1f){if(_0x5bf5a6['enabled']){return _[_0x1111('0x31')](_0x418cf9,function(_0x26d444){if(_0x26d444[_0x1111('0x61')]===0x709){_0x26d444[_0x1111('0x68')]=_0x505c1f;}return _0x26d444;});}else{var _0xa30b60={'sectionId':0x76c,'enabled':0x1,'subsections':_0x505c1f};var _0x1e0ad5=_['map'](_0x418cf9);_0x1e0ad5[_0x1111('0x62')](_0xa30b60);return _0x1e0ad5;}});}else{return;}})[_0x1111('0x2a')](function(_0x15eb6f){if(_0x15eb6f)_0x418cf9=_0x15eb6f;return _['filter'](_0x418cf9,[_0x1111('0x66'),0x1]);})[_0x1111('0x2a')](respondWithResult(_0x55397e,null))[_0x1111('0x49')](handleError(_0x55397e,null));};function hasDefaultDashboard(_0x2aa92a){var _0x555a29=[0x65];return new BPromise(function(_0x394af6,_0x506442){try{if(_0x2aa92a[_0x1111('0x58')]){_0x394af6(_0x555a29);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2aa92a['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x5f517b){_0x5f517b?_0x394af6(_0x555a29):_0x394af6();});}}catch(_0x3da05e){_0x506442(_0x3da05e);}});}function getCustomDashboards(_0x2fec16){var _0x45a101=[];return new BPromise(function(_0xb75126,_0x1ff84a){try{if(_0x2fec16[_0x1111('0x58')]){return db['Dashboard'][_0x1111('0x47')]({'raw':!![]})[_0x1111('0x2a')](function(_0x11d3ac){_0x11d3ac[_0x1111('0x6a')](function(_0x192030){_0x45a101['push'](_0x192030['id']+0x1869f);});_0xb75126(_0x45a101);});}else{return db[_0x1111('0x59')][_0x1111('0x47')]({'where':{'sectionId':_0x2fec16['id']},'raw':!![]})[_0x1111('0x2a')](function(_0x2be5df){_0x2be5df[_0x1111('0x6a')](function(_0x233110){_0x45a101[_0x1111('0x62')](_0x233110['resourceId']+0x1869f);});_0xb75126(_0x45a101);});}}catch(_0x4e2f0e){_0x1ff84a(_0x4e2f0e);}});}function getPlugins(_0x25459c){var _0x38e21e=[];return new BPromise(function(_0x2c461a,_0x58a068){try{if(_0x25459c[_0x1111('0x58')]){return db['Plugin'][_0x1111('0x47')]({'raw':!![]})[_0x1111('0x2a')](function(_0x3cb0ff){_0x3cb0ff[_0x1111('0x6a')](function(_0x468b44){_0x38e21e[_0x1111('0x62')](_0x468b44['id']+0x15b38);});_0x2c461a(_0x38e21e);});}else{return db[_0x1111('0x59')][_0x1111('0x47')]({'where':{'sectionId':_0x25459c['id']},'raw':!![]})['then'](function(_0x4006b7){_0x4006b7[_0x1111('0x6a')](function(_0x703617){_0x38e21e['push'](_0x703617[_0x1111('0x6b')]+0x15b38);});_0x2c461a(_0x38e21e);});}}catch(_0x2184c9){_0x58a068(_0x2184c9);}});}exports[_0x1111('0x6c')]=function(_0x334050,_0x3bbb89){return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x334050['params']['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x3bbb89,null))[_0x1111('0x2a')](function(_0x117469){if(_0x117469){return db['sequelize'][_0x1111('0x55')](function(_0xa75f6e){return db[_0x1111('0x56')][_0x1111('0x47')]({'where':{'userProfileId':_0x334050[_0x1111('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x1111('0x2a')](function(_0x56e557){if(_0x56e557){return db[_0x1111('0x56')][_0x1111('0x2b')]({'where':{'userProfileId':_0x334050['params']['id'],'id':_[_0x1111('0x31')](_0x56e557,function(_0x4e8766){return _0x4e8766['id'];})},'transaction':_0xa75f6e});}})[_0x1111('0x2a')](function(_0x37b644){var _0x8b8631=_[_0x1111('0x31')](_0x334050[_0x1111('0x4f')],function(_0x1c751a){_0x1c751a[_0x1111('0x5b')]=_0x334050[_0x1111('0x4b')]['id'];return _0x1c751a;});return db[_0x1111('0x56')][_0x1111('0x6d')](_0x8b8631,{'raw':!![],'transaction':_0xa75f6e});})['then'](function(_0xa9b647){var _0x1fb5e5=_[_0x1111('0x40')](_[_0x1111('0x31')](_0xa9b647,function(_0x556299){return _0x556299[_0x1111('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1fb5e5){return db[_0x1111('0x56')]['findAll']({'where':{'userProfileId':_0x334050[_0x1111('0x4b')]['id'],'sectionId':_[_0x1111('0x31')](_0x1fb5e5,function(_0x48ab15){return _0x48ab15['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x310933){var _0x2bf77c=_[_0x1111('0x31')](_0x334050[_0x1111('0x4f')],function(_0x395955){_0x395955[_0x1111('0x5b')]=_0x334050['params']['id'];return _0x395955;});return db[_0x1111('0x59')][_0x1111('0x6d')](_0x2bf77c,{'raw':!![],'transaction':_0xa75f6e});});}})['catch'](handleError(_0x3bbb89,null));});}})['then'](function(_0x440f5d){var _0x55f730=_[_0x1111('0x31')](_0x440f5d,function(_0x526f08){return _0x526f08[_0x1111('0x50')]({'plain':!![]});});})[_0x1111('0x2a')](respondWithResult(_0x3bbb89,null))['catch'](handleError(_0x3bbb89,null));};exports[_0x1111('0x6e')]=function(_0x2d8376,_0x11d7cc,_0x11c621){return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x2d8376[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](handleEntityNotFound(_0x11d7cc,null))[_0x1111('0x2a')](function(_0x14ba13){if(_0x14ba13){return _0x14ba13[_0x1111('0x6e')](_0x2d8376[_0x1111('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x11d7cc,null))[_0x1111('0x49')](handleError(_0x11d7cc,null));};exports[_0x1111('0x6f')]=function(_0x2b6619,_0x47301d){var _0x235fcc={};if(!_0x2b6619[_0x1111('0x36')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x2b6619[_0x1111('0x36')][_0x1111('0x3c')]('nolimit')){_0x235fcc[_0x1111('0x23')]=qs['limit'](_0x2b6619[_0x1111('0x36')][_0x1111('0x23')]);_0x235fcc[_0x1111('0x21')]=qs['offset'](_0x2b6619[_0x1111('0x36')][_0x1111('0x21')]);}return db[_0x1111('0x32')][_0x1111('0x5e')]({'where':{'id':_0x2b6619[_0x1111('0x4b')]['id']}})[_0x1111('0x2a')](function(_0xdc0d2){if(!_0xdc0d2)throw new Error(_0x1111('0x70')+_0x2b6619[_0x1111('0x4b')]['id']);return db['UserProfile'][_0x1111('0x6f')](_0x2b6619);})['then'](respondWithFilteredResult(_0x47301d,_0x235fcc))['catch'](handleError(_0x47301d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ac52e63..69319f7 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 _0x627e=['events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x627e,0x14a));var _0xe627=function(_0x3e2c9d,_0x37a09d){_0x3e2c9d=_0x3e2c9d-0x0;var _0x1f8ba7=_0x627e[_0x3e2c9d];return _0x1f8ba7;};'use strict';var EventEmitter=require(_0xe627('0x0'));var UserProfile=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe627('0x3')](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':'update','afterDestroy':_0xe627('0x5')};function emitEvent(_0x328881){return function(_0x2abdc7,_0x59a2c8,_0x52923f){UserProfileEvents['emit'](_0x328881+':'+_0x2abdc7['id'],_0x2abdc7);UserProfileEvents[_0xe627('0x6')](_0x328881,_0x2abdc7);_0x52923f(null);};}for(var e in events){if(events[_0xe627('0x7')](e)){var event=events[e];UserProfile[_0xe627('0x8')](e,emitEvent(event));}}module[_0xe627('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x6ac2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x5e36af,_0x40fbca){var _0x28c09c=function(_0x5a72da){while(--_0x5a72da){_0x5e36af['push'](_0x5e36af['shift']());}};_0x28c09c(++_0x40fbca);}(_0x6ac2,0x184));var _0x26ac=function(_0x36f051,_0x21946b){_0x36f051=_0x36f051-0x0;var _0x479e5b=_0x6ac2[_0x36f051];return _0x479e5b;};'use strict';var EventEmitter=require(_0x26ac('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x26ac('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x26ac('0x2')](0x0);var events={'afterCreate':_0x26ac('0x3'),'afterUpdate':_0x26ac('0x4'),'afterDestroy':_0x26ac('0x5')};function emitEvent(_0x2a650c){return function(_0x595aa9,_0x40d8d0,_0x5b40f6){UserProfileEvents[_0x26ac('0x6')](_0x2a650c+':'+_0x595aa9['id'],_0x595aa9);UserProfileEvents[_0x26ac('0x6')](_0x2a650c,_0x595aa9);_0x5b40f6(null);};}for(var e in events){if(events[_0x26ac('0x7')](e)){var event=events[e];UserProfile[_0x26ac('0x8')](e,emitEvent(event));}}module[_0x26ac('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1008081..5505902 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 _0x7f6c=['Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','../../components/parsers/qs','section','mergeResources','isEmpty','length','UserProfileSection','find','params','all','ignore','autoAssociation','push','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','include','sms','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','models','filter','field','value','then','map','catch','model','findAll','associatedResources','AnalyticExtractedReport','type','resourceId','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','name','projectName','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses'];(function(_0x13458e,_0x23d954){var _0x5952ff=function(_0x79a080){while(--_0x79a080){_0x13458e['push'](_0x13458e['shift']());}};_0x5952ff(++_0x23d954);}(_0x7f6c,0x1c1));var _0xc7f6=function(_0x8b3750,_0x3ccd39){_0x8b3750=_0x8b3750-0x0;var _0x1f4f2f=_0x7f6c[_0x8b3750];return _0x1f4f2f;};'use strict';var _=require('lodash');var attributes=require(_0xc7f6('0x0'));var squel=require('squel');module['exports']=function(_0x32c4d0){var _0x5f071d=_0x32c4d0[_0xc7f6('0x1')];function _0x59d01c(_0x415865,_0xda9073){return new Promise(function(_0x2ff4a0,_0x4d76e6){if(!_0xda9073)return _0x2ff4a0(null);var _0x39d0e8=_0xda9073['filter']?{[_0xda9073[_0xc7f6('0x2')][_0xc7f6('0x3')]]:_0xda9073[_0xc7f6('0x2')][_0xc7f6('0x4')]}:undefined;return _0x5f071d[_0x415865]['findAll']({'where':_0x39d0e8,'raw':!![]})[_0xc7f6('0x5')](function(_0x3097a8){_0xda9073['associatedResources']=_[_0xc7f6('0x6')](_0x3097a8,'id');_0x2ff4a0(_0xda9073);})[_0xc7f6('0x7')](function(_0x581854){_0x4d76e6(_0x581854);});});}function _0x4e5f52(_0x53c622,_0x1958c7){return new Promise(function(_0x4102d0,_0x39009f){var _0x25a2a4=_0x53c622['filter']?{[_0x53c622[_0xc7f6('0x2')][_0xc7f6('0x3')]]:_0x53c622['filter'][_0xc7f6('0x4')]}:undefined;return _0x5f071d[_0x53c622[_0xc7f6('0x8')]][_0xc7f6('0x9')]({'where':_0x25a2a4,'raw':!![]})['then'](function(_0x302b8f){_0x1958c7[_0xc7f6('0xa')]=_['map'](_0x302b8f,function(_0x109302){return _0x109302['name'];});_0x4102d0(_0x1958c7);})[_0xc7f6('0x7')](function(_0x271d0a){_0x39009f(_0x271d0a);});});}function _0x12e8de(_0x3196c6,_0x440fa0,_0x32299a){if(!_0x440fa0)return Promise['resolve'](null);return new Promise(function(_0x1ea715,_0x6cb8e4){return _0x5f071d['UserProfileResource']['findAll']({'where':{'sectionId':_0x440fa0['id']},'raw':!![]})['then'](function(_0x5ac964){if(_0x3196c6['field']&&_0x3196c6[_0xc7f6('0x3')]!=='id'){_0x440fa0['associatedResources']=_[_0xc7f6('0x6')](_0x5ac964,function(_0x44c6e5){return _0x44c6e5[_0x3196c6[_0xc7f6('0x3')]];});}else{if(_0x32299a===_0xc7f6('0xb')){_0x440fa0[_0xc7f6('0xa')]=_['map'](_0x5ac964,function(_0x3bae80){return{'id':_0x3bae80['resourceId'],'type':_0x3bae80[_0xc7f6('0xc')]};});}else{_0x440fa0[_0xc7f6('0xa')]=_[_0xc7f6('0x6')](_0x5ac964,function(_0x556d30){return _0x556d30[_0xc7f6('0xd')];});}}_0x1ea715(_0x440fa0);})['catch'](function(_0x49f4d5){_0x6cb8e4(_0x49f4d5);});});}function _0x491d40(_0x3c2306,_0x55d06a){var _0xa62835={'parentSections':[]};switch(_0x3c2306[_0xc7f6('0xe')]()){case'squareprojects':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x10');break;case _0xc7f6('0x11'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x12');break;case _0xc7f6('0x13'):_0xa62835[_0xc7f6('0xf')]='SquareRecording';_0xa62835[_0xc7f6('0x14')]=[{'name':'SquareProjects','field':_0xc7f6('0x15'),'foreignKey':_0xc7f6('0x16')}];break;case'projects':_0xa62835[_0xc7f6('0xf')]='JscriptyProject';break;case'contacts':_0xa62835[_0xc7f6('0xf')]='CmContact';_0xa62835[_0xc7f6('0x14')]=[{'name':_0xc7f6('0x17'),'field':'id','foreignKey':_0xc7f6('0x18')}];break;case _0xc7f6('0x19'):_0xa62835['childModel']=_0xc7f6('0x1a');break;case _0xc7f6('0x1b'):_0xa62835['childModel']=_0xc7f6('0x1c');break;case'globalcustomfields':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x1d');break;case'chatqueues':_0xa62835[_0xc7f6('0xf')]='ChatQueue';break;case'chatwebsites':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x1e');break;case'faxqueues':_0xa62835['childModel']=_0xc7f6('0x1f');break;case _0xc7f6('0x20'):_0xa62835['childModel']=_0xc7f6('0x21');break;case _0xc7f6('0x22'):case _0xc7f6('0x23'):case _0xc7f6('0x24'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x25');break;case _0xc7f6('0x26'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x27');break;case _0xc7f6('0x28'):_0xa62835['childModel']=_0xc7f6('0x29');break;case _0xc7f6('0x2a'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x2b');_0xa62835[_0xc7f6('0x14')]=[{'name':'Agents','field':_0xc7f6('0x15'),'foreignKey':_0xc7f6('0x2c'),'model':_0xc7f6('0x2d'),'filter':{'field':_0xc7f6('0x2e'),'value':[_0xc7f6('0x2f')]}},{'name':_0xc7f6('0x30'),'field':_0xc7f6('0x15'),'foreignKey':_0xc7f6('0x2c'),'model':_0xc7f6('0x2d'),'filter':{'field':_0xc7f6('0x2e'),'value':[_0xc7f6('0x31')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0xc7f6('0x32'),'model':_0xc7f6('0x33'),'filter':{'field':_0xc7f6('0xc'),'value':[_0xc7f6('0x34')]}},{'name':_0xc7f6('0x35'),'field':_0xc7f6('0x15'),'foreignKey':_0xc7f6('0x32'),'model':_0xc7f6('0x33'),'filter':{'field':_0xc7f6('0xc'),'value':['outbound']}}];break;case _0xc7f6('0x36'):_0xa62835[_0xc7f6('0xf')]='VoiceMusicOnHold';break;case _0xc7f6('0x37'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x38');break;case'voiceprefixes':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x39');break;case'ivrcampaigns':_0xa62835[_0xc7f6('0xf')]='Campaign';break;case _0xc7f6('0x3a'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x3b');break;case _0xc7f6('0x3c'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x3d');break;case _0xc7f6('0x3e'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x3f');break;case _0xc7f6('0x40'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x41');break;case _0xc7f6('0x42'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x43');break;case _0xc7f6('0x44'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x45');break;case _0xc7f6('0x46'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x47');break;case _0xc7f6('0x48'):_0xa62835[_0xc7f6('0xf')]='WhatsappQueue';break;case _0xc7f6('0x49'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x4a');break;case _0xc7f6('0x4b'):_0xa62835['childModel']=_0xc7f6('0x4c');break;case'voicequeues':case _0xc7f6('0x4d'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x33');if(_0x55d06a){_0xa62835[_0xc7f6('0x14')]=[{'name':_0xc7f6('0x4e')},{'name':_0xc7f6('0x35')}];}break;case _0xc7f6('0x4f'):case _0xc7f6('0x50'):case _0xc7f6('0x51'):_0xa62835['childModel']=_0xc7f6('0x2d');if(_0x55d06a){_0xa62835[_0xc7f6('0x14')]=[{'name':_0xc7f6('0x52'),'filter':{'field':'role','value':[_0xc7f6('0x53'),_0xc7f6('0x54')]},'ignore':!![]},{'name':_0xc7f6('0x55')},{'name':_0xc7f6('0x30')}];}break;case _0xc7f6('0x56'):_0xa62835['childModel']=_0xc7f6('0x57');break;case _0xc7f6('0x58'):_0xa62835[_0xc7f6('0xf')]='SalesforceAccount';break;case _0xc7f6('0x59'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x5a');break;case'sugarcrmaccounts':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x5b');break;case _0xc7f6('0x5c'):_0xa62835[_0xc7f6('0xf')]='DeskAccount';break;case'zohoaccounts':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x5d');break;case _0xc7f6('0x5e'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x2d');break;case _0xc7f6('0x5f'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x60');break;case _0xc7f6('0x61'):_0xa62835['childModel']='Disposition';break;case _0xc7f6('0x62'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x63');break;case _0xc7f6('0x64'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x65');break;case _0xc7f6('0x66'):_0xa62835['childModel']=_0xc7f6('0x67');break;case _0xc7f6('0x68'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x69');break;case'sounds':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x6a');break;case _0xc7f6('0x6b'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x6c');break;case _0xc7f6('0x6d'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x6e');break;case _0xc7f6('0x6f'):_0xa62835['childModel']=_0xc7f6('0x70');break;case'trunks':_0xa62835[_0xc7f6('0xf')]='Trunk';break;case'variables':_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x71');break;case _0xc7f6('0x72'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x73');break;case _0xc7f6('0x74'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0xb');_0xa62835[_0xc7f6('0x14')]=[{'name':_0xc7f6('0x75'),'field':'id','foreignKey':_0xc7f6('0x76')}];break;case _0xc7f6('0x77'):_0xa62835[_0xc7f6('0xf')]=_0xc7f6('0x78');break;}return _0xa62835;}function _0x5ec232(_0x3b891d,_0x7a6809){var _0x8d412=_0x3b891d['charAt'](0x0)[_0xc7f6('0x79')]()+_0x3b891d[_0xc7f6('0x7a')](0x1);var _0x3a4973={'type':_0x5f071d[_0xc7f6('0x7b')]['QueryTypes'][_0xc7f6('0x7c')],'raw':!![]};return new Promise(function(_0xfc11ab,_0x14f260){var _0x45288f=squel[_0xc7f6('0x7d')]()['field']('ui.'+_0x8d412+'InteractionId','id')[_0xc7f6('0x3')]('ui.createdAt')['from'](_0xc7f6('0x7e')+_0x3b891d+_0xc7f6('0x7f'),'ui')[_0xc7f6('0x80')](_0xc7f6('0x81'),_0x7a6809['id']);return _0x5f071d[_0xc7f6('0x82')][_0xc7f6('0x83')](_0x45288f[_0xc7f6('0x84')](),_0x3a4973)[_0xc7f6('0x5')](function(_0x18ea2e){_0x7a6809[_0x8d412+_0xc7f6('0x85')]=_0x18ea2e;_0xfc11ab(_0x18ea2e);})[_0xc7f6('0x7')](function(_0x45f5d6){_0x14f260(_0x45f5d6);});});}return _0x32c4d0['define']('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x32d118){var _0x41c4f9=require(_0xc7f6('0x86'));var _0x30ca21={'raw':_0x32d118[_0xc7f6('0x83')]['raw'],'where':{}};var _0x1270cf={};var _0x9eebf={'count':0x0,'rows':[]};var _0x17717a=_0x32d118['query'][_0xc7f6('0x87')];var _0x102c3c=_0x32d118[_0xc7f6('0x83')][_0xc7f6('0x88')]||![];var _0x293339=_0x491d40(_0x17717a,_0x102c3c);if(!_0x293339[_0xc7f6('0xf')])throw new Error('Invalid\x20section\x20\x27'+_0x17717a+'\x27');var _0xcfbdfb=[{'name':_0x17717a}];if(!_[_0xc7f6('0x89')](_0x293339[_0xc7f6('0x14')]))_0xcfbdfb=_0x293339[_0xc7f6('0x14')];var _0x466cab=[];for(var _0x15dad2=0x0;_0x15dad2<_0xcfbdfb[_0xc7f6('0x8a')];_0x15dad2++){_0x466cab['push'](_0x5f071d[_0xc7f6('0x8b')][_0xc7f6('0x8c')]({'where':{'userProfileId':_0x32d118[_0xc7f6('0x8d')]['id'],'name':_0xcfbdfb[_0x15dad2][_0xc7f6('0x15')]},'raw':!![]}));}return Promise[_0xc7f6('0x8e')](_0x466cab)[_0xc7f6('0x5')](function(_0x2236ae){var _0x4b5889=_[_0xc7f6('0x2')](_0x2236ae,function(_0x434121){return _0x434121?_0x434121:undefined;});var _0x1e2526=_[_0xc7f6('0x2')](_0xcfbdfb,[_0xc7f6('0x8f'),!![]]);var _0x1aa9fd=_['isEmpty'](_0x4b5889)&&_[_0xc7f6('0x89')](_0x1e2526)?null:_['union'](_0x1e2526,_0x4b5889);if(!_0x1aa9fd)return null;var _0x1f4f8a=[];for(var _0x5e70c7=0x0;_0x5e70c7<_0x1aa9fd[_0xc7f6('0x8a')];_0x5e70c7++){var _0x7002bf=_[_0xc7f6('0x8c')](_0xcfbdfb,function(_0x30e163){return _0x1aa9fd[_0x5e70c7]?_0x30e163[_0xc7f6('0x15')]===_0x1aa9fd[_0x5e70c7][_0xc7f6('0x15')]:null;});if(_0x7002bf){if(_0x1aa9fd[_0x5e70c7][_0xc7f6('0x8f')]){_0x1f4f8a['push'](_0x59d01c(_0x293339[_0xc7f6('0xf')],_0x1aa9fd[_0x5e70c7]));}else{if(!_0x1aa9fd[_0x5e70c7][_0xc7f6('0x90')]){_0x1f4f8a[_0xc7f6('0x91')](_0x12e8de(_0x7002bf,_0x1aa9fd[_0x5e70c7],_0x293339[_0xc7f6('0xf')]));}else{if(_0x7002bf['model']){_0x1f4f8a[_0xc7f6('0x91')](_0x4e5f52(_0x7002bf,_0x1aa9fd[_0x5e70c7]));}}}}}return Promise['all'](_0x1f4f8a);})[_0xc7f6('0x5')](function(_0x3e0ce0){var _0x55da1d=_0x3e0ce0;var _0x355928=null;if(_0x55da1d){_0x355928=_0x55da1d[_0xc7f6('0x8a')]===0x1?_0x55da1d[0x0]:null;}if(!_0x355928&&!_0x55da1d)return _0x9eebf;var _0x33a040=_0x5f071d[_0x293339['childModel']]['rawAttributes'];_0x1270cf[_0xc7f6('0x8')]=_[_0xc7f6('0x92')](_0x33a040);_0x1270cf[_0xc7f6('0x83')]=_['keys'](_0x32d118[_0xc7f6('0x83')]);_0x1270cf[_0xc7f6('0x93')]=_[_0xc7f6('0x94')](_0x1270cf[_0xc7f6('0x8')],_0x1270cf['query']);_0x30ca21['attributes']=_[_0xc7f6('0x94')](_0x1270cf[_0xc7f6('0x8')],_0x41c4f9[_0xc7f6('0x95')](_0x32d118[_0xc7f6('0x83')][_0xc7f6('0x95')]));_0x30ca21[_0xc7f6('0x96')]=_0x30ca21[_0xc7f6('0x96')][_0xc7f6('0x8a')]?_0x30ca21['attributes']:_0x1270cf[_0xc7f6('0x8')];if(!_0x32d118[_0xc7f6('0x83')][_0xc7f6('0x97')]('nolimit')){_0x30ca21[_0xc7f6('0x98')]=_0x41c4f9[_0xc7f6('0x98')](_0x32d118[_0xc7f6('0x83')][_0xc7f6('0x98')]);_0x30ca21[_0xc7f6('0x99')]=_0x41c4f9[_0xc7f6('0x99')](_0x32d118['query'][_0xc7f6('0x99')]);}_0x30ca21[_0xc7f6('0x9a')]=_0x41c4f9[_0xc7f6('0x9b')](_0x32d118[_0xc7f6('0x83')][_0xc7f6('0x9b')]);_0x30ca21[_0xc7f6('0x80')]=_0x41c4f9[_0xc7f6('0x93')](_[_0xc7f6('0x9c')](_0x32d118[_0xc7f6('0x83')],_0x1270cf[_0xc7f6('0x93')]));if(_0x32d118[_0xc7f6('0x83')][_0xc7f6('0x2')]){_0x30ca21[_0xc7f6('0x80')]=_[_0xc7f6('0x9d')](_0x30ca21[_0xc7f6('0x80')],{'$or':_['map'](_0x33a040,function(_0x2d8001){if(_0x2d8001['type'][_0xc7f6('0x9e')]!==_0xc7f6('0x9f')){var _0x33be9d={};_0x33be9d[_0x2d8001[_0xc7f6('0x3')]]={'$like':'%'+_0x32d118['query']['filter']+'%'};return _0x33be9d;}})});}var _0x2c74b3=[];var _0x500dd9=null;var _0x203752={};if(_0x355928){_0x500dd9=_[_0xc7f6('0x8c')](_0xcfbdfb,['name',_0x355928[_0xc7f6('0x15')]]);if(_0x500dd9[_0xc7f6('0x3')]){_0x203752={};if(_0x293339[_0xc7f6('0xf')]===_0xc7f6('0xb')){_0x203752[_0x500dd9[_0xc7f6('0xa0')]]=_[_0xc7f6('0x6')](_0x355928[_0xc7f6('0xa')],'id');}else{_0x203752[_0x500dd9['foreignKey']]=_0x355928[_0xc7f6('0xa')];}_0x2c74b3[_0xc7f6('0x91')](_0x203752);}else{_0x30ca21['where']['id']=_0x355928[_0xc7f6('0xa')];}}else{for(var _0x334f01=0x0;_0x334f01<_0x55da1d[_0xc7f6('0x8a')];_0x334f01++){_0x500dd9=_[_0xc7f6('0x8c')](_0xcfbdfb,['name',_0x55da1d[_0x334f01]['name']]);if(_0x500dd9[_0xc7f6('0x3')]){_0x203752={};_0x203752[_0x500dd9[_0xc7f6('0xa0')]]=_0x55da1d[_0x334f01]['associatedResources'];_0x2c74b3[_0xc7f6('0x91')](_0x203752);}else{if(!_0x30ca21[_0xc7f6('0x80')]['id'])_0x30ca21[_0xc7f6('0x80')]['id']=[];_0x55da1d[_0x334f01][_0xc7f6('0xa')][_0xc7f6('0xa1')](function(_0x432735){_0x30ca21[_0xc7f6('0x80')]['id'][_0xc7f6('0x91')](_0x432735);});}}}if(!_[_0xc7f6('0x89')](_0x2c74b3)){_0x30ca21[_0xc7f6('0x80')]=_['merge'](_0x30ca21[_0xc7f6('0x80')],{'$and':{'$or':_0x2c74b3}});}_0x30ca21=_[_0xc7f6('0x9d')]({},_0x30ca21,_0x32d118[_0xc7f6('0xa2')]);if(_0x355928&&!_0x355928[_0xc7f6('0x90')]&&_0x293339[_0xc7f6('0xf')]===_0xc7f6('0xb')){if(_0x32d118[_0xc7f6('0x83')][_0xc7f6('0xa3')]){_0x30ca21['include']=[{'all':!![]}];}return _0x5f071d[_0x293339[_0xc7f6('0xf')]][_0xc7f6('0x9')](_0x30ca21)[_0xc7f6('0x5')](function(_0x56597c){var _0x596add=[];_0x56597c[_0xc7f6('0xa1')](function(_0x4e32ff){var _0x542fbe;switch(_0x4e32ff[_0xc7f6('0xa4')]){case'default':_0x542fbe=_['find'](_0x355928['associatedResources'],function(_0x4af796){return _0x4af796['id']===_0x4e32ff[_0xc7f6('0x76')]&&_0x4af796['type']==='DefaultReports';});break;case _0xc7f6('0xa5'):_0x542fbe=_[_0xc7f6('0x8c')](_0x355928[_0xc7f6('0xa')],function(_0x18dd9d){return _0x18dd9d['id']===_0x4e32ff[_0xc7f6('0x76')]&&_0x18dd9d['type']===_0xc7f6('0xa6');});break;}if(_0x542fbe)_0x596add[_0xc7f6('0x91')](_0x4e32ff);});_0x9eebf[_0xc7f6('0xa7')]=_0x596add['length'];_0x9eebf[_0xc7f6('0xa8')]=_0x596add;return _0x9eebf;});}else{if(!_[_0xc7f6('0x89')](_0x32d118[_0xc7f6('0x83')]['ids'])){_0x30ca21[_0xc7f6('0x80')]['id']=_0x30ca21[_0xc7f6('0x80')]['id']?_[_0xc7f6('0x94')](_0x30ca21[_0xc7f6('0x80')]['id'],_0x32d118[_0xc7f6('0x83')][_0xc7f6('0xa9')]):_0x32d118['query'][_0xc7f6('0xa9')];if(_0x32d118[_0xc7f6('0x83')][_0xc7f6('0xaa')]){_0x30ca21['order']=_0x32d118[_0xc7f6('0x83')]['customSorting'];}}if(_0x32d118[_0xc7f6('0x83')][_0xc7f6('0xab')]){_0x30ca21[_0xc7f6('0x80')]=_['merge'](_0x30ca21[_0xc7f6('0x80')],{'$and':_0x32d118[_0xc7f6('0x83')]['extraQueryConditions']});}return _0x5f071d[_0x293339[_0xc7f6('0xf')]][_0xc7f6('0xa7')]({'where':_0x30ca21['where']})[_0xc7f6('0x5')](function(_0x3befc6){_0x9eebf['count']=_0x3befc6;if(_0x32d118[_0xc7f6('0x83')]['includeAll']){if(_0x293339['childModel']===_0xc7f6('0xac')){_0x30ca21['include']=[{'model':_0x5f071d[_0xc7f6('0x6c')],'as':_0xc7f6('0xad'),'attributes':['id',_0xc7f6('0x15'),_0xc7f6('0xae')],'required':_0x32d118[_0xc7f6('0x83')][_0xc7f6('0xaf')]?!![]:![]},{'model':_0x5f071d[_0xc7f6('0x6c')],'as':_0xc7f6('0xb0'),'attributes':['id','name',_0xc7f6('0xae')],'through':_0x32d118[_0xc7f6('0x83')]['tag']?{'attributes':[],'where':{'TagId':_0x32d118[_0xc7f6('0x83')]['tag']||undefined}}:{},'required':_0x32d118[_0xc7f6('0x83')][_0xc7f6('0xaf')]?!![]:![]}];}else{_0x30ca21[_0xc7f6('0xb1')]=[{'all':!![]}];}}return _0x5f071d[_0x293339[_0xc7f6('0xf')]][_0xc7f6('0x9')](_0x30ca21);})['then'](function(_0x545811){_0x9eebf[_0xc7f6('0xa8')]=_0x545811;if(_0x17717a===_0xc7f6('0x55')&&_0x32d118['query']['openTabs']==='true'){var _0x5b55f4=[];for(var _0x5aff40=0x0;_0x5aff40<_0x9eebf[_0xc7f6('0xa8')]['length'];_0x5aff40++){_0x5b55f4[_0xc7f6('0x91')](_0x5ec232('chat',_0x9eebf[_0xc7f6('0xa8')][_0x5aff40]['dataValues']));_0x5b55f4[_0xc7f6('0x91')](_0x5ec232(_0xc7f6('0xb2'),_0x9eebf['rows'][_0x5aff40][_0xc7f6('0xb3')]));_0x5b55f4['push'](_0x5ec232(_0xc7f6('0xb4'),_0x9eebf[_0xc7f6('0xa8')][_0x5aff40]['dataValues']));_0x5b55f4[_0xc7f6('0x91')](_0x5ec232(_0xc7f6('0xb5'),_0x9eebf[_0xc7f6('0xa8')][_0x5aff40][_0xc7f6('0xb3')]));_0x5b55f4[_0xc7f6('0x91')](_0x5ec232(_0xc7f6('0xb6'),_0x9eebf[_0xc7f6('0xa8')][_0x5aff40][_0xc7f6('0xb3')]));_0x5b55f4[_0xc7f6('0x91')](_0x5ec232(_0xc7f6('0xb7'),_0x9eebf[_0xc7f6('0xa8')][_0x5aff40][_0xc7f6('0xb3')]));}return Promise[_0xc7f6('0x8e')](_0x5b55f4)[_0xc7f6('0x5')](function(){return _0x9eebf;});}return _0x9eebf;});}});}}});}; \ No newline at end of file +var _0xd2f0=['DefaultReports','custom','CustomReports','ids','customSorting','extraQueryConditions','count','Tags','color','tag','include','openTabs','true','rows','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','associatedResources','map','catch','model','then','name','resolve','UserProfileResource','field','type','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','VoiceExtension','VoiceMail','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','push','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','includeAll','findAll','reportType'];(function(_0x55ad36,_0xdc8afd){var _0x15c9f8=function(_0x907dfc){while(--_0x907dfc){_0x55ad36['push'](_0x55ad36['shift']());}};_0x15c9f8(++_0xdc8afd);}(_0xd2f0,0xd3));var _0x0d2f=function(_0xde79d1,_0x407441){_0xde79d1=_0xde79d1-0x0;var _0x4f891e=_0xd2f0[_0xde79d1];return _0x4f891e;};'use strict';var _=require(_0x0d2f('0x0'));var attributes=require(_0x0d2f('0x1'));var squel=require('squel');module['exports']=function(_0x5c579e){var _0x5d81b9=_0x5c579e[_0x0d2f('0x2')];function _0x51a518(_0x1bf052,_0x425a0c){return new Promise(function(_0x58d6af,_0x3178e4){if(!_0x425a0c)return _0x58d6af(null);var _0x514c7a=_0x425a0c['filter']?{[_0x425a0c[_0x0d2f('0x3')]['field']]:_0x425a0c['filter']['value']}:undefined;return _0x5d81b9[_0x1bf052]['findAll']({'where':_0x514c7a,'raw':!![]})['then'](function(_0xb913c7){_0x425a0c[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0xb913c7,'id');_0x58d6af(_0x425a0c);})[_0x0d2f('0x6')](function(_0x3bd2c5){_0x3178e4(_0x3bd2c5);});});}function _0x2661db(_0x4cd401,_0x1c69b5){return new Promise(function(_0x23c421,_0x1a4c44){var _0x489710=_0x4cd401[_0x0d2f('0x3')]?{[_0x4cd401[_0x0d2f('0x3')]['field']]:_0x4cd401[_0x0d2f('0x3')]['value']}:undefined;return _0x5d81b9[_0x4cd401[_0x0d2f('0x7')]]['findAll']({'where':_0x489710,'raw':!![]})[_0x0d2f('0x8')](function(_0x44feeb){_0x1c69b5[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0x44feeb,function(_0x13d1a6){return _0x13d1a6[_0x0d2f('0x9')];});_0x23c421(_0x1c69b5);})['catch'](function(_0x13052a){_0x1a4c44(_0x13052a);});});}function _0x2e9424(_0x3c5825,_0x2ba9b6,_0x233d81){if(!_0x2ba9b6)return Promise[_0x0d2f('0xa')](null);return new Promise(function(_0x442691,_0x1f381d){return _0x5d81b9[_0x0d2f('0xb')]['findAll']({'where':{'sectionId':_0x2ba9b6['id']},'raw':!![]})[_0x0d2f('0x8')](function(_0x1ba352){if(_0x3c5825[_0x0d2f('0xc')]&&_0x3c5825[_0x0d2f('0xc')]!=='id'){_0x2ba9b6[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0x1ba352,function(_0x3a6be3){return _0x3a6be3[_0x3c5825['field']];});}else{if(_0x233d81==='AnalyticExtractedReport'){_0x2ba9b6['associatedResources']=_[_0x0d2f('0x5')](_0x1ba352,function(_0xdb41aa){return{'id':_0xdb41aa['resourceId'],'type':_0xdb41aa[_0x0d2f('0xd')]};});}else{_0x2ba9b6[_0x0d2f('0x4')]=_[_0x0d2f('0x5')](_0x1ba352,function(_0x353fe){return _0x353fe[_0x0d2f('0xe')];});}}_0x442691(_0x2ba9b6);})[_0x0d2f('0x6')](function(_0x3fc00d){_0x1f381d(_0x3fc00d);});});}function _0x26c5f8(_0x4892d9,_0x5bc65d){var _0x4e376e={'parentSections':[]};switch(_0x4892d9[_0x0d2f('0xf')]()){case _0x0d2f('0x10'):_0x4e376e[_0x0d2f('0x11')]='SquareProject';break;case _0x0d2f('0x12'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x13');break;case _0x0d2f('0x14'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x15');_0x4e376e[_0x0d2f('0x16')]=[{'name':_0x0d2f('0x17'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x18')}];break;case _0x0d2f('0x19'):_0x4e376e['childModel']='JscriptyProject';break;case _0x0d2f('0x1a'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x1b');_0x4e376e[_0x0d2f('0x16')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x1c');break;case _0x0d2f('0x1d'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x1e');break;case _0x0d2f('0x1f'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x20');break;case _0x0d2f('0x21'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x22');break;case _0x0d2f('0x23'):_0x4e376e['childModel']=_0x0d2f('0x24');break;case _0x0d2f('0x25'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x26');break;case'faxaccounts':_0x4e376e[_0x0d2f('0x11')]='FaxAccount';break;case _0x0d2f('0x27'):case _0x0d2f('0x28'):case'outboundroutes':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x29');break;case'contexts':_0x4e376e[_0x0d2f('0x11')]='VoiceContext';break;case'voicemails':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x2a');break;case'voicerecordings':_0x4e376e[_0x0d2f('0x11')]='VoiceRecording';_0x4e376e[_0x0d2f('0x16')]=[{'name':'Agents','field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x2b'),'model':_0x0d2f('0x2c'),'filter':{'field':'role','value':[_0x0d2f('0x2d')]}},{'name':_0x0d2f('0x2e'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x2b'),'model':_0x0d2f('0x2c'),'filter':{'field':_0x0d2f('0x2f'),'value':[_0x0d2f('0x30')]}},{'name':_0x0d2f('0x31'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x32'),'model':_0x0d2f('0x33'),'filter':{'field':_0x0d2f('0xd'),'value':[_0x0d2f('0x34')]}},{'name':_0x0d2f('0x35'),'field':_0x0d2f('0x9'),'foreignKey':_0x0d2f('0x32'),'model':_0x0d2f('0x33'),'filter':{'field':'type','value':['outbound']}}];break;case _0x0d2f('0x36'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x37');break;case'chanspies':_0x4e376e['childModel']='VoiceChanSpy';break;case _0x0d2f('0x38'):_0x4e376e['childModel']=_0x0d2f('0x39');break;case _0x0d2f('0x3a'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x3b');break;case _0x0d2f('0x3c'):_0x4e376e['childModel']=_0x0d2f('0x3d');break;case _0x0d2f('0x3e'):_0x4e376e[_0x0d2f('0x11')]='MailAccount';break;case _0x0d2f('0x3f'):_0x4e376e['childModel']=_0x0d2f('0x40');break;case _0x0d2f('0x41'):_0x4e376e[_0x0d2f('0x11')]='OpenchannelQueue';break;case'openchannelaccounts':_0x4e376e['childModel']='OpenchannelAccount';break;case _0x0d2f('0x42'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x43');break;case _0x0d2f('0x44'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x45');break;case'whatsappqueues':_0x4e376e['childModel']=_0x0d2f('0x46');break;case _0x0d2f('0x47'):_0x4e376e[_0x0d2f('0x11')]='WhatsappAccount';break;case _0x0d2f('0x48'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x49');break;case _0x0d2f('0x4a'):case'queuecampaigns':_0x4e376e['childModel']=_0x0d2f('0x33');if(_0x5bc65d){_0x4e376e[_0x0d2f('0x16')]=[{'name':_0x0d2f('0x31')},{'name':_0x0d2f('0x35')}];}break;case _0x0d2f('0x4b'):case _0x0d2f('0x4c'):case _0x0d2f('0x4d'):_0x4e376e['childModel']=_0x0d2f('0x2c');if(_0x5bc65d){_0x4e376e['parentSections']=[{'name':_0x0d2f('0x4e'),'filter':{'field':'role','value':[_0x0d2f('0x4f'),_0x0d2f('0x50')]},'ignore':!![]},{'name':_0x0d2f('0x51')},{'name':_0x0d2f('0x2e')}];}break;case _0x0d2f('0x52'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x53');break;case _0x0d2f('0x54'):_0x4e376e['childModel']=_0x0d2f('0x55');break;case _0x0d2f('0x56'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x57');break;case'sugarcrmaccounts':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x58');break;case _0x0d2f('0x59'):_0x4e376e['childModel']=_0x0d2f('0x5a');break;case _0x0d2f('0x5b'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x5c');break;case _0x0d2f('0x5d'):_0x4e376e['childModel']=_0x0d2f('0x2c');break;case _0x0d2f('0x5e'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x5f');break;case'dispositions':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x60');break;case _0x0d2f('0x61'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x62');break;case _0x0d2f('0x63'):_0x4e376e['childModel']=_0x0d2f('0x64');break;case _0x0d2f('0x65'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x66');break;case _0x0d2f('0x67'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x68');break;case _0x0d2f('0x69'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6a');break;case _0x0d2f('0x6b'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6c');break;case'templates':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6d');break;case'triggers':_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x6e');break;case _0x0d2f('0x6f'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x70');break;case _0x0d2f('0x71'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x72');break;case _0x0d2f('0x73'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x74');break;case _0x0d2f('0x75'):_0x4e376e[_0x0d2f('0x11')]='AnalyticExtractedReport';_0x4e376e[_0x0d2f('0x16')]=[{'name':_0x0d2f('0x76'),'field':'id','foreignKey':'reportId'}];break;case _0x0d2f('0x77'):_0x4e376e[_0x0d2f('0x11')]=_0x0d2f('0x78');break;}return _0x4e376e;}function _0x339e3c(_0x55bf6f,_0x21b20c){var _0xa665f6=_0x55bf6f[_0x0d2f('0x79')](0x0)['toUpperCase']()+_0x55bf6f[_0x0d2f('0x7a')](0x1);var _0x945575={'type':_0x5d81b9[_0x0d2f('0x7b')][_0x0d2f('0x7c')][_0x0d2f('0x7d')],'raw':!![]};return new Promise(function(_0x6c44ec,_0x2b57b6){var _0x1b4be7=squel[_0x0d2f('0x7e')]()[_0x0d2f('0xc')](_0x0d2f('0x7f')+_0xa665f6+_0x0d2f('0x80'),'id')[_0x0d2f('0xc')]('ui.createdAt')[_0x0d2f('0x81')](_0x0d2f('0x82')+_0x55bf6f+'_interactions','ui')[_0x0d2f('0x83')](_0x0d2f('0x84'),_0x21b20c['id']);return _0x5d81b9[_0x0d2f('0x85')][_0x0d2f('0x86')](_0x1b4be7[_0x0d2f('0x87')](),_0x945575)[_0x0d2f('0x8')](function(_0x39be35){_0x21b20c[_0xa665f6+_0x0d2f('0x88')]=_0x39be35;_0x6c44ec(_0x39be35);})['catch'](function(_0x140e5b){_0x2b57b6(_0x140e5b);});});}return _0x5c579e['define'](_0x0d2f('0x89'),attributes,{'tableName':_0x0d2f('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x191bca){var _0x307daa=require(_0x0d2f('0x8b'));var _0x4cd878={'raw':_0x191bca['query']['raw'],'where':{}};var _0x283019={};var _0x544ebd={'count':0x0,'rows':[]};var _0x464d66=_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x8c')];var _0xf52f6=_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x8d')]||![];var _0x93346d=_0x26c5f8(_0x464d66,_0xf52f6);if(!_0x93346d[_0x0d2f('0x11')])throw new Error(_0x0d2f('0x8e')+_0x464d66+'\x27');var _0x3ec9b2=[{'name':_0x464d66}];if(!_[_0x0d2f('0x8f')](_0x93346d[_0x0d2f('0x16')]))_0x3ec9b2=_0x93346d[_0x0d2f('0x16')];var _0x565454=[];for(var _0xfbec39=0x0;_0xfbec39<_0x3ec9b2[_0x0d2f('0x90')];_0xfbec39++){_0x565454['push'](_0x5d81b9['UserProfileSection'][_0x0d2f('0x91')]({'where':{'userProfileId':_0x191bca[_0x0d2f('0x92')]['id'],'name':_0x3ec9b2[_0xfbec39]['name']},'raw':!![]}));}return Promise[_0x0d2f('0x93')](_0x565454)[_0x0d2f('0x8')](function(_0xe7fd80){var _0x26acb3=_['filter'](_0xe7fd80,function(_0x2137ab){return _0x2137ab?_0x2137ab:undefined;});var _0x4a92b5=_['filter'](_0x3ec9b2,[_0x0d2f('0x94'),!![]]);var _0x4b4a0d=_['isEmpty'](_0x26acb3)&&_[_0x0d2f('0x8f')](_0x4a92b5)?null:_['union'](_0x4a92b5,_0x26acb3);if(!_0x4b4a0d)return null;var _0x3eb177=[];for(var _0x40d8a9=0x0;_0x40d8a9<_0x4b4a0d[_0x0d2f('0x90')];_0x40d8a9++){var _0x23f04d=_['find'](_0x3ec9b2,function(_0x27339a){return _0x4b4a0d[_0x40d8a9]?_0x27339a['name']===_0x4b4a0d[_0x40d8a9][_0x0d2f('0x9')]:null;});if(_0x23f04d){if(_0x4b4a0d[_0x40d8a9][_0x0d2f('0x94')]){_0x3eb177[_0x0d2f('0x95')](_0x51a518(_0x93346d['childModel'],_0x4b4a0d[_0x40d8a9]));}else{if(!_0x4b4a0d[_0x40d8a9][_0x0d2f('0x96')]){_0x3eb177[_0x0d2f('0x95')](_0x2e9424(_0x23f04d,_0x4b4a0d[_0x40d8a9],_0x93346d[_0x0d2f('0x11')]));}else{if(_0x23f04d[_0x0d2f('0x7')]){_0x3eb177['push'](_0x2661db(_0x23f04d,_0x4b4a0d[_0x40d8a9]));}}}}}return Promise[_0x0d2f('0x93')](_0x3eb177);})[_0x0d2f('0x8')](function(_0x16f3c5){var _0x50d1b8=_0x16f3c5;var _0x298a6b=null;if(_0x50d1b8){_0x298a6b=_0x50d1b8[_0x0d2f('0x90')]===0x1?_0x50d1b8[0x0]:null;}if(!_0x298a6b&&!_0x50d1b8)return _0x544ebd;var _0x112fbc=_0x5d81b9[_0x93346d['childModel']]['rawAttributes'];_0x283019[_0x0d2f('0x7')]=_[_0x0d2f('0x97')](_0x112fbc);_0x283019[_0x0d2f('0x86')]=_['keys'](_0x191bca[_0x0d2f('0x86')]);_0x283019[_0x0d2f('0x98')]=_[_0x0d2f('0x99')](_0x283019['model'],_0x283019[_0x0d2f('0x86')]);_0x4cd878[_0x0d2f('0x9a')]=_[_0x0d2f('0x99')](_0x283019[_0x0d2f('0x7')],_0x307daa['fields'](_0x191bca['query'][_0x0d2f('0x9b')]));_0x4cd878[_0x0d2f('0x9a')]=_0x4cd878[_0x0d2f('0x9a')][_0x0d2f('0x90')]?_0x4cd878[_0x0d2f('0x9a')]:_0x283019[_0x0d2f('0x7')];if(!_0x191bca['query'][_0x0d2f('0x9c')](_0x0d2f('0x9d'))){_0x4cd878['limit']=_0x307daa[_0x0d2f('0x9e')](_0x191bca[_0x0d2f('0x86')]['limit']);_0x4cd878[_0x0d2f('0x9f')]=_0x307daa[_0x0d2f('0x9f')](_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x9f')]);}_0x4cd878[_0x0d2f('0xa0')]=_0x307daa[_0x0d2f('0xa1')](_0x191bca[_0x0d2f('0x86')]['sort']);_0x4cd878[_0x0d2f('0x83')]=_0x307daa['filters'](_[_0x0d2f('0xa2')](_0x191bca[_0x0d2f('0x86')],_0x283019[_0x0d2f('0x98')]));if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0x3')]){_0x4cd878[_0x0d2f('0x83')]=_[_0x0d2f('0xa3')](_0x4cd878[_0x0d2f('0x83')],{'$or':_[_0x0d2f('0x5')](_0x112fbc,function(_0x579b12){if(_0x579b12[_0x0d2f('0xd')][_0x0d2f('0xa4')]!==_0x0d2f('0xa5')){var _0x4a8818={};_0x4a8818[_0x579b12[_0x0d2f('0xc')]]={'$like':'%'+_0x191bca['query']['filter']+'%'};return _0x4a8818;}})});}var _0x2755aa=[];var _0x4b5933=null;var _0x32d0a7={};if(_0x298a6b){_0x4b5933=_['find'](_0x3ec9b2,[_0x0d2f('0x9'),_0x298a6b[_0x0d2f('0x9')]]);if(_0x4b5933[_0x0d2f('0xc')]){_0x32d0a7={};if(_0x93346d[_0x0d2f('0x11')]===_0x0d2f('0xa6')){_0x32d0a7[_0x4b5933[_0x0d2f('0xa7')]]=_[_0x0d2f('0x5')](_0x298a6b[_0x0d2f('0x4')],'id');}else{_0x32d0a7[_0x4b5933[_0x0d2f('0xa7')]]=_0x298a6b[_0x0d2f('0x4')];}_0x2755aa[_0x0d2f('0x95')](_0x32d0a7);}else{_0x4cd878['where']['id']=_0x298a6b[_0x0d2f('0x4')];}}else{for(var _0x388e52=0x0;_0x388e52<_0x50d1b8[_0x0d2f('0x90')];_0x388e52++){_0x4b5933=_['find'](_0x3ec9b2,[_0x0d2f('0x9'),_0x50d1b8[_0x388e52][_0x0d2f('0x9')]]);if(_0x4b5933['field']){_0x32d0a7={};_0x32d0a7[_0x4b5933[_0x0d2f('0xa7')]]=_0x50d1b8[_0x388e52][_0x0d2f('0x4')];_0x2755aa['push'](_0x32d0a7);}else{if(!_0x4cd878['where']['id'])_0x4cd878[_0x0d2f('0x83')]['id']=[];_0x50d1b8[_0x388e52][_0x0d2f('0x4')][_0x0d2f('0xa8')](function(_0x44b099){_0x4cd878['where']['id'][_0x0d2f('0x95')](_0x44b099);});}}}if(!_[_0x0d2f('0x8f')](_0x2755aa)){_0x4cd878[_0x0d2f('0x83')]=_[_0x0d2f('0xa3')](_0x4cd878[_0x0d2f('0x83')],{'$and':{'$or':_0x2755aa}});}_0x4cd878=_['merge']({},_0x4cd878,_0x191bca[_0x0d2f('0xa9')]);if(_0x298a6b&&!_0x298a6b[_0x0d2f('0x96')]&&_0x93346d[_0x0d2f('0x11')]===_0x0d2f('0xa6')){if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xaa')]){_0x4cd878['include']=[{'all':!![]}];}return _0x5d81b9[_0x93346d['childModel']][_0x0d2f('0xab')](_0x4cd878)[_0x0d2f('0x8')](function(_0x6071d6){var _0x2f5a96=[];_0x6071d6[_0x0d2f('0xa8')](function(_0x5b9674){var _0x17e6df;switch(_0x5b9674[_0x0d2f('0xac')]){case'default':_0x17e6df=_[_0x0d2f('0x91')](_0x298a6b[_0x0d2f('0x4')],function(_0x38553d){return _0x38553d['id']===_0x5b9674['reportId']&&_0x38553d[_0x0d2f('0xd')]===_0x0d2f('0xad');});break;case _0x0d2f('0xae'):_0x17e6df=_['find'](_0x298a6b[_0x0d2f('0x4')],function(_0x339c71){return _0x339c71['id']===_0x5b9674['reportId']&&_0x339c71['type']===_0x0d2f('0xaf');});break;}if(_0x17e6df)_0x2f5a96[_0x0d2f('0x95')](_0x5b9674);});_0x544ebd['count']=_0x2f5a96[_0x0d2f('0x90')];_0x544ebd['rows']=_0x2f5a96;return _0x544ebd;});}else{if(!_['isEmpty'](_0x191bca[_0x0d2f('0x86')]['ids'])){_0x4cd878[_0x0d2f('0x83')]['id']=_0x4cd878[_0x0d2f('0x83')]['id']?_[_0x0d2f('0x99')](_0x4cd878[_0x0d2f('0x83')]['id'],_0x191bca[_0x0d2f('0x86')]['ids']):_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb0')];if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb1')]){_0x4cd878[_0x0d2f('0xa0')]=_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb1')];}}if(_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb2')]){_0x4cd878[_0x0d2f('0x83')]=_[_0x0d2f('0xa3')](_0x4cd878[_0x0d2f('0x83')],{'$and':_0x191bca['query'][_0x0d2f('0xb2')]});}return _0x5d81b9[_0x93346d[_0x0d2f('0x11')]][_0x0d2f('0xb3')]({'where':_0x4cd878[_0x0d2f('0x83')]})[_0x0d2f('0x8')](function(_0x4b6bdf){_0x544ebd[_0x0d2f('0xb3')]=_0x4b6bdf;if(_0x191bca[_0x0d2f('0x86')]['includeAll']){if(_0x93346d[_0x0d2f('0x11')]===_0x0d2f('0x1b')){_0x4cd878['include']=[{'model':_0x5d81b9[_0x0d2f('0x6c')],'as':_0x0d2f('0xb4'),'attributes':['id',_0x0d2f('0x9'),_0x0d2f('0xb5')],'required':_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb6')]?!![]:![]},{'model':_0x5d81b9[_0x0d2f('0x6c')],'as':'ThroughTags','attributes':['id',_0x0d2f('0x9'),_0x0d2f('0xb5')],'through':_0x191bca[_0x0d2f('0x86')]['tag']?{'attributes':[],'where':{'TagId':_0x191bca['query'][_0x0d2f('0xb6')]||undefined}}:{},'required':_0x191bca['query'][_0x0d2f('0xb6')]?!![]:![]}];}else{_0x4cd878[_0x0d2f('0xb7')]=[{'all':!![]}];}}return _0x5d81b9[_0x93346d[_0x0d2f('0x11')]][_0x0d2f('0xab')](_0x4cd878);})['then'](function(_0x328742){_0x544ebd['rows']=_0x328742;if(_0x464d66==='Agents'&&_0x191bca[_0x0d2f('0x86')][_0x0d2f('0xb8')]===_0x0d2f('0xb9')){var _0x969e41=[];for(var _0x4bfd3c=0x0;_0x4bfd3c<_0x544ebd[_0x0d2f('0xba')]['length'];_0x4bfd3c++){_0x969e41[_0x0d2f('0x95')](_0x339e3c('chat',_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c][_0x0d2f('0xbb')]));_0x969e41[_0x0d2f('0x95')](_0x339e3c('sms',_0x544ebd['rows'][_0x4bfd3c][_0x0d2f('0xbb')]));_0x969e41['push'](_0x339e3c(_0x0d2f('0xbc'),_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c]['dataValues']));_0x969e41[_0x0d2f('0x95')](_0x339e3c(_0x0d2f('0xbd'),_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c]['dataValues']));_0x969e41['push'](_0x339e3c(_0x0d2f('0xbe'),_0x544ebd['rows'][_0x4bfd3c][_0x0d2f('0xbb')]));_0x969e41[_0x0d2f('0x95')](_0x339e3c(_0x0d2f('0xbf'),_0x544ebd[_0x0d2f('0xba')][_0x4bfd3c][_0x0d2f('0xbb')]));}return Promise[_0x0d2f('0x93')](_0x969e41)[_0x0d2f('0x8')](function(){return _0x544ebd;});}return _0x544ebd;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 983943e..659c425 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 _0xff22=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x319c30,_0x44a3b9){var _0x3bc49a=function(_0x363496){while(--_0x363496){_0x319c30['push'](_0x319c30['shift']());}};_0x3bc49a(++_0x44a3b9);}(_0xff22,0x1a0));var _0x2ff2=function(_0x2ae4bb,_0x4aa8d0){_0x2ae4bb=_0x2ae4bb-0x0;var _0x48b35c=_0xff22[_0x2ae4bb];return _0x48b35c;};'use strict';var _=require(_0x2ff2('0x0'));var util=require(_0x2ff2('0x1'));var moment=require('moment');var BPromise=require(_0x2ff2('0x2'));var rs=require(_0x2ff2('0x3'));var fs=require('fs');var Redis=require(_0x2ff2('0x4'));var db=require(_0x2ff2('0x5'))['db'];var utils=require(_0x2ff2('0x6'));var logger=require(_0x2ff2('0x7'))(_0x2ff2('0x8'));var config=require(_0x2ff2('0x9'));var jayson=require(_0x2ff2('0xa'));var client=jayson['client'][_0x2ff2('0xb')]({'port':0x232a});config[_0x2ff2('0xc')]=_[_0x2ff2('0xd')](config[_0x2ff2('0xc')],{'host':_0x2ff2('0xe'),'port':0x18eb});var socket=require(_0x2ff2('0xf'))(new Redis(config[_0x2ff2('0xc')]));require('./userProfile.socket')[_0x2ff2('0x10')](socket);function respondWithRpcPromise(_0x820f1f,_0x15822a,_0x24e4b4){return new BPromise(function(_0x255028,_0x571fb3){return client['request'](_0x820f1f,_0x24e4b4)['then'](function(_0x421472){logger[_0x2ff2('0x11')](_0x2ff2('0x12'),_0x15822a,_0x2ff2('0x13'));logger[_0x2ff2('0x14')](_0x2ff2('0x15'),_0x15822a,_0x2ff2('0x13'),JSON['stringify'](_0x421472));if(_0x421472[_0x2ff2('0x16')]){if(_0x421472[_0x2ff2('0x16')][_0x2ff2('0x17')]===0x1f4){logger[_0x2ff2('0x16')](_0x2ff2('0x12'),_0x15822a,_0x421472['error']['message']);return _0x571fb3(_0x421472[_0x2ff2('0x16')]['message']);}logger[_0x2ff2('0x16')](_0x2ff2('0x12'),_0x15822a,_0x421472[_0x2ff2('0x16')][_0x2ff2('0x18')]);return _0x255028(_0x421472[_0x2ff2('0x16')][_0x2ff2('0x18')]);}else{logger[_0x2ff2('0x11')]('UserProfile,\x20%s,\x20%s',_0x15822a,_0x2ff2('0x13'));_0x255028(_0x421472['result'][_0x2ff2('0x18')]);}})[_0x2ff2('0x19')](function(_0xfd2c26){logger[_0x2ff2('0x16')](_0x2ff2('0x12'),_0x15822a,_0xfd2c26);_0x571fb3(_0xfd2c26);});});} \ No newline at end of file +var _0xcedf=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','defaults','socket.io-emitter','redis'];(function(_0x3a9c5c,_0x5e0d92){var _0x20d55e=function(_0x100aad){while(--_0x100aad){_0x3a9c5c['push'](_0x3a9c5c['shift']());}};_0x20d55e(++_0x5e0d92);}(_0xcedf,0x1b6));var _0xfced=function(_0x1bab76,_0x4ce891){_0x1bab76=_0x1bab76-0x0;var _0x3cb893=_0xcedf[_0x1bab76];return _0x3cb893;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var moment=require(_0xfced('0x2'));var BPromise=require(_0xfced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfced('0x4'));var db=require(_0xfced('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfced('0x6'));var config=require('../../config/environment');var jayson=require(_0xfced('0x7'));var client=jayson['client'][_0xfced('0x8')]({'port':0x232a});config['redis']=_[_0xfced('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfced('0xa'))(new Redis(config[_0xfced('0xb')]));require(_0xfced('0xc'))[_0xfced('0xd')](socket);function respondWithRpcPromise(_0x4cee14,_0x3dacd0,_0x3487bd){return new BPromise(function(_0x35098c,_0x472717){return client[_0xfced('0xe')](_0x4cee14,_0x3487bd)[_0xfced('0xf')](function(_0x30aaba){logger[_0xfced('0x10')](_0xfced('0x11'),_0x3dacd0,'request\x20sent');logger[_0xfced('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3dacd0,_0xfced('0x13'),JSON[_0xfced('0x14')](_0x30aaba));if(_0x30aaba[_0xfced('0x15')]){if(_0x30aaba[_0xfced('0x15')]['code']===0x1f4){logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x30aaba[_0xfced('0x15')][_0xfced('0x16')]);return _0x472717(_0x30aaba[_0xfced('0x15')][_0xfced('0x16')]);}logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x30aaba['error'][_0xfced('0x16')]);return _0x35098c(_0x30aaba['error'][_0xfced('0x16')]);}else{logger[_0xfced('0x10')](_0xfced('0x11'),_0x3dacd0,_0xfced('0x13'));_0x35098c(_0x30aaba[_0xfced('0x17')][_0xfced('0x16')]);}})[_0xfced('0x18')](function(_0x31ea41){logger[_0xfced('0x15')](_0xfced('0x11'),_0x3dacd0,_0x31ea41);_0x472717(_0x31ea41);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 84d12b4..e67e69e 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 _0x0076=['update','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0076,0x71));var _0x6007=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x0076[_0xbf8ebe];return _0x1e25e8;};'use strict';var UserProfileEvents=require(_0x6007('0x0'));var events=['save','remove',_0x6007('0x1')];function createListener(_0x1f03e9,_0xe28fe9){return function(_0x4b04bb){_0xe28fe9['emit'](_0x1f03e9,_0x4b04bb);};}function removeListener(_0x5be2e9,_0x1c7f5b){return function(){UserProfileEvents[_0x6007('0x2')](_0x5be2e9,_0x1c7f5b);};}exports[_0x6007('0x3')]=function(_0x12a7f7){for(var _0x4d588f=0x0,_0x15c0f7=events[_0x6007('0x4')];_0x4d588f<_0x15c0f7;_0x4d588f++){var _0x8774da=events[_0x4d588f];var _0xf2b59b=createListener(_0x6007('0x5')+_0x8774da,_0x12a7f7);UserProfileEvents['on'](_0x8774da,_0xf2b59b);}}; \ No newline at end of file +var _0x982a=['userProfile:','./userProfile.events','save','update','emit','removeListener','length'];(function(_0x1c81af,_0x269e00){var _0x5ab42b=function(_0x47fca7){while(--_0x47fca7){_0x1c81af['push'](_0x1c81af['shift']());}};_0x5ab42b(++_0x269e00);}(_0x982a,0x135));var _0xa982=function(_0x562219,_0x19e393){_0x562219=_0x562219-0x0;var _0x2cc355=_0x982a[_0x562219];return _0x2cc355;};'use strict';var UserProfileEvents=require(_0xa982('0x0'));var events=[_0xa982('0x1'),'remove',_0xa982('0x2')];function createListener(_0x35f7b1,_0x22a285){return function(_0xfc6ff4){_0x22a285[_0xa982('0x3')](_0x35f7b1,_0xfc6ff4);};}function removeListener(_0x46eff4,_0x223cc3){return function(){UserProfileEvents[_0xa982('0x4')](_0x46eff4,_0x223cc3);};}exports['register']=function(_0x14d7bf){for(var _0x33bd0b=0x0,_0x48c68a=events[_0xa982('0x5')];_0x33bd0b<_0x48c68a;_0x33bd0b++){var _0x114a45=events[_0x33bd0b];var _0x4f2872=createListener(_0xa982('0x6')+_0x114a45,_0x14d7bf);UserProfileEvents['on'](_0x114a45,_0x4f2872);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f3558ec..9b6e192 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 _0xa28f=['index','/describe','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x14040d,_0x229ab2){var _0x4806e0=function(_0x311295){while(--_0x311295){_0x14040d['push'](_0x14040d['shift']());}};_0x4806e0(++_0x229ab2);}(_0xa28f,0x15f));var _0xfa28=function(_0x116c0c,_0x49e35e){_0x116c0c=_0x116c0c-0x0;var _0x5d5a2f=_0xa28f[_0x116c0c];return _0x5d5a2f;};'use strict';var multer=require(_0xfa28('0x0'));var util=require(_0xfa28('0x1'));var path=require(_0xfa28('0x2'));var timeout=require(_0xfa28('0x3'));var express=require('express');var router=express[_0xfa28('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa28('0x5'));var config=require(_0xfa28('0x6'));var controller=require('./userProfileResource.controller');router[_0xfa28('0x7')]('/',auth[_0xfa28('0x8')](),controller[_0xfa28('0x9')]);router[_0xfa28('0x7')](_0xfa28('0xa'),auth[_0xfa28('0x8')](),controller[_0xfa28('0xb')]);router['get'](_0xfa28('0xc'),auth[_0xfa28('0x8')](),controller['show']);router[_0xfa28('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa28('0xe')]);router['put'](_0xfa28('0xc'),auth[_0xfa28('0x8')](),controller[_0xfa28('0xf')]);router[_0xfa28('0x10')](_0xfa28('0xc'),auth[_0xfa28('0x8')](),controller[_0xfa28('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbc5a=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x45b865,_0xdbd681){var _0x8dba10=function(_0x3be43d){while(--_0x3be43d){_0x45b865['push'](_0x45b865['shift']());}};_0x8dba10(++_0xdbd681);}(_0xbc5a,0x66));var _0xabc5=function(_0x2f30f0,_0x56aa74){_0x2f30f0=_0x2f30f0-0x0;var _0x56a36a=_0xbc5a[_0x2f30f0];return _0x56a36a;};'use strict';var multer=require('multer');var util=require(_0xabc5('0x0'));var path=require(_0xabc5('0x1'));var timeout=require(_0xabc5('0x2'));var express=require(_0xabc5('0x3'));var router=express[_0xabc5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xabc5('0x5'));var interaction=require(_0xabc5('0x6'));var config=require(_0xabc5('0x7'));var controller=require(_0xabc5('0x8'));router[_0xabc5('0x9')]('/',auth[_0xabc5('0xa')](),controller[_0xabc5('0xb')]);router[_0xabc5('0x9')](_0xabc5('0xc'),auth[_0xabc5('0xa')](),controller['describe']);router[_0xabc5('0x9')](_0xabc5('0xd'),auth[_0xabc5('0xa')](),controller[_0xabc5('0xe')]);router['post']('/',auth[_0xabc5('0xa')](),controller[_0xabc5('0xf')]);router[_0xabc5('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xabc5('0xd'),auth[_0xabc5('0xa')](),controller['destroy']);module[_0xabc5('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index ba051d0..86e334c 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 _0x0f0e=['sequelize','exports','INTEGER','STRING'];(function(_0x4227d2,_0x22dad4){var _0x108656=function(_0x48ad3f){while(--_0x48ad3f){_0x4227d2['push'](_0x4227d2['shift']());}};_0x108656(++_0x22dad4);}(_0x0f0e,0x90));var _0xe0f0=function(_0x88510,_0x44bc36){_0x88510=_0x88510-0x0;var _0x1a0ab4=_0x0f0e[_0x88510];return _0x1a0ab4;};'use strict';var Sequelize=require(_0xe0f0('0x0'));module[_0xe0f0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe0f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe0f0('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x8ca3=['sequelize','exports','STRING','INTEGER'];(function(_0x29da8f,_0x11c0db){var _0x3da1cd=function(_0x4910a0){while(--_0x4910a0){_0x29da8f['push'](_0x29da8f['shift']());}};_0x3da1cd(++_0x11c0db);}(_0x8ca3,0x150));var _0x38ca=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x8ca3[_0x568f96];return _0x5a053a;};'use strict';var Sequelize=require(_0x38ca('0x0'));module[_0x38ca('0x1')]={'name':{'type':Sequelize[_0x38ca('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x38ca('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x38ca('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 c78ecb3..2f0afc8 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','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','describe','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','end','status'];(function(_0x1a7edf,_0x5c4e04){var _0x56c1d9=function(_0x23947e){while(--_0x23947e){_0x1a7edf['push'](_0x1a7edf['shift']());}};_0x56c1d9(++_0x5c4e04);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46e94c,_0x461216){_0x46e94c=_0x46e94c-0x0;var _0x597221=_0x5f2f[_0x46e94c];return _0x597221;};'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));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +var _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x5e5d41,_0x208901){var _0xbb31ba=function(_0x699284){while(--_0x699284){_0x5e5d41['push'](_0x5e5d41['shift']());}};_0xbb31ba(++_0x208901);}(_0xafc4,0x69));var _0x4afc=function(_0x4d6510,_0x3f71fd){_0x4d6510=_0x4d6510-0x0;var _0xc62d5c=_0xafc4[_0x4d6510];return _0xc62d5c;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 285121a..8e0b59c 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 _0xcce2=['sectionId','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','resourceId'];(function(_0x138802,_0x1f960a){var _0x2c06ad=function(_0x3b6413){while(--_0x3b6413){_0x138802['push'](_0x138802['shift']());}};_0x2c06ad(++_0x1f960a);}(_0xcce2,0x112));var _0x2cce=function(_0x5d86c6,_0x59b424){_0x5d86c6=_0x5d86c6-0x0;var _0x114d51=_0xcce2[_0x5d86c6];return _0x114d51;};'use strict';var _=require(_0x2cce('0x0'));var util=require(_0x2cce('0x1'));var logger=require(_0x2cce('0x2'))(_0x2cce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cce('0x4'));var rimraf=require(_0x2cce('0x5'));var config=require(_0x2cce('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x2cce('0x7')]=function(_0x5c306d,_0x1cd786){return _0x5c306d[_0x2cce('0x8')](_0x2cce('0x9'),attributes,{'tableName':_0x2cce('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x2cce('0xb'),_0x2cce('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5651=['moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5651,0x6d));var _0x1565=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x5651[_0x28578d];return _0x524826;};'use strict';var _=require(_0x1565('0x0'));var util=require('util');var logger=require(_0x1565('0x1'))(_0x1565('0x2'));var moment=require(_0x1565('0x3'));var BPromise=require(_0x1565('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1565('0x5'));var config=require(_0x1565('0x6'));var attributes=require(_0x1565('0x7'));module[_0x1565('0x8')]=function(_0x12a1cc,_0x55458d){return _0x12a1cc[_0x1565('0x9')](_0x1565('0xa'),attributes,{'tableName':_0x1565('0xb'),'paranoid':![],'indexes':[{'name':_0x1565('0xc'),'fields':[_0x1565('0xd'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 84667a4..dbd1b24 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 _0x87ee=['client','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x28109a,_0x35d0bf){var _0x3ef25a=function(_0x98c8c1){while(--_0x98c8c1){_0x28109a['push'](_0x28109a['shift']());}};_0x3ef25a(++_0x35d0bf);}(_0x87ee,0xa3));var _0xe87e=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x87ee[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require(_0xe87e('0x0'));var moment=require(_0xe87e('0x1'));var BPromise=require(_0xe87e('0x2'));var rs=require(_0xe87e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe87e('0x4'));var logger=require('../../config/logger')(_0xe87e('0x5'));var config=require(_0xe87e('0x6'));var jayson=require(_0xe87e('0x7'));var client=jayson[_0xe87e('0x8')][_0xe87e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38c5f6,_0x1bb256,_0x2006bf){return new BPromise(function(_0x31ac57,_0x5de13e){return client[_0xe87e('0xa')](_0x38c5f6,_0x2006bf)['then'](function(_0x583326){logger['info'](_0xe87e('0xb'),_0x1bb256,_0xe87e('0xc'));logger[_0xe87e('0xd')](_0xe87e('0xe'),_0x1bb256,_0xe87e('0xc'),JSON[_0xe87e('0xf')](_0x583326));if(_0x583326[_0xe87e('0x10')]){if(_0x583326[_0xe87e('0x10')]['code']===0x1f4){logger[_0xe87e('0x10')](_0xe87e('0xb'),_0x1bb256,_0x583326[_0xe87e('0x10')][_0xe87e('0x11')]);return _0x5de13e(_0x583326[_0xe87e('0x10')][_0xe87e('0x11')]);}logger[_0xe87e('0x10')](_0xe87e('0xb'),_0x1bb256,_0x583326['error'][_0xe87e('0x11')]);return _0x31ac57(_0x583326[_0xe87e('0x10')][_0xe87e('0x11')]);}else{logger[_0xe87e('0x12')](_0xe87e('0xb'),_0x1bb256,_0xe87e('0xc'));_0x31ac57(_0x583326['result'][_0xe87e('0x11')]);}})['catch'](function(_0x45e271){logger[_0xe87e('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x1bb256,_0x45e271);_0x5de13e(_0x45e271);});});} \ No newline at end of file +var _0xafb3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x55c947,_0x5e20a8){var _0x2556b3=function(_0x239288){while(--_0x239288){_0x55c947['push'](_0x55c947['shift']());}};_0x2556b3(++_0x5e20a8);}(_0xafb3,0xa3));var _0x3afb=function(_0x48c249,_0xedd7){_0x48c249=_0x48c249-0x0;var _0x665d95=_0xafb3[_0x48c249];return _0x665d95;};'use strict';var _=require(_0x3afb('0x0'));var util=require(_0x3afb('0x1'));var moment=require(_0x3afb('0x2'));var BPromise=require('bluebird');var rs=require(_0x3afb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3afb('0x4'))['db'];var utils=require(_0x3afb('0x5'));var logger=require(_0x3afb('0x6'))('rpc');var config=require(_0x3afb('0x7'));var jayson=require(_0x3afb('0x8'));var client=jayson['client'][_0x3afb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15adb2,_0x25d8df,_0x28bcb6){return new BPromise(function(_0x465a01,_0x8960a5){return client[_0x3afb('0xa')](_0x15adb2,_0x28bcb6)['then'](function(_0x4f860a){logger[_0x3afb('0xb')](_0x3afb('0xc'),_0x25d8df,_0x3afb('0xd'));logger[_0x3afb('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x25d8df,_0x3afb('0xd'),JSON[_0x3afb('0xf')](_0x4f860a));if(_0x4f860a['error']){if(_0x4f860a[_0x3afb('0x10')][_0x3afb('0x11')]===0x1f4){logger['error'](_0x3afb('0xc'),_0x25d8df,_0x4f860a['error'][_0x3afb('0x12')]);return _0x8960a5(_0x4f860a[_0x3afb('0x10')]['message']);}logger[_0x3afb('0x10')](_0x3afb('0xc'),_0x25d8df,_0x4f860a[_0x3afb('0x10')][_0x3afb('0x12')]);return _0x465a01(_0x4f860a[_0x3afb('0x10')][_0x3afb('0x12')]);}else{logger[_0x3afb('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x25d8df,_0x3afb('0xd'));_0x465a01(_0x4f860a[_0x3afb('0x13')][_0x3afb('0x12')]);}})[_0x3afb('0x14')](function(_0x5da6d6){logger[_0x3afb('0x10')](_0x3afb('0xc'),_0x25d8df,_0x5da6d6);_0x8960a5(_0x5da6d6);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 34cae07..648fac1 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 _0x65be=['get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller'];(function(_0x2a772a,_0xa6c93a){var _0x44067c=function(_0x5002dd){while(--_0x5002dd){_0x2a772a['push'](_0x2a772a['shift']());}};_0x44067c(++_0xa6c93a);}(_0x65be,0xb5));var _0xe65b=function(_0x291efe,_0x2a4444){_0x291efe=_0x291efe-0x0;var _0x1794b1=_0x65be[_0x291efe];return _0x1794b1;};'use strict';var multer=require(_0xe65b('0x0'));var util=require(_0xe65b('0x1'));var path=require(_0xe65b('0x2'));var timeout=require(_0xe65b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe65b('0x4'));var auth=require(_0xe65b('0x5'));var interaction=require(_0xe65b('0x6'));var config=require('../../config/environment');var controller=require(_0xe65b('0x7'));router[_0xe65b('0x8')]('/',auth['isAuthenticated'](),controller[_0xe65b('0x9')]);router[_0xe65b('0x8')](_0xe65b('0xa'),auth['isAuthenticated'](),controller[_0xe65b('0xb')]);router[_0xe65b('0x8')](_0xe65b('0xc'),auth[_0xe65b('0xd')](),controller[_0xe65b('0xe')]);router[_0xe65b('0xf')]('/',auth[_0xe65b('0xd')](),controller[_0xe65b('0x10')]);router[_0xe65b('0x11')](_0xe65b('0xc'),auth[_0xe65b('0xd')](),controller[_0xe65b('0x12')]);router[_0xe65b('0x13')](_0xe65b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe65b('0x14')]=router; \ No newline at end of file +var _0x109d=['create','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x173d33,_0xb14c60){var _0x4a55dd=function(_0x3e6c03){while(--_0x3e6c03){_0x173d33['push'](_0x173d33['shift']());}};_0x4a55dd(++_0xb14c60);}(_0x109d,0x122));var _0xd109=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x109d[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xd109('0x0'));var util=require(_0xd109('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd109('0x2')]();var fs_extra=require(_0xd109('0x3'));var auth=require(_0xd109('0x4'));var interaction=require(_0xd109('0x5'));var config=require(_0xd109('0x6'));var controller=require(_0xd109('0x7'));router[_0xd109('0x8')]('/',auth[_0xd109('0x9')](),controller['index']);router['get'](_0xd109('0xa'),auth[_0xd109('0x9')](),controller['describe']);router[_0xd109('0x8')](_0xd109('0xb'),auth['isAuthenticated'](),controller[_0xd109('0xc')]);router[_0xd109('0xd')]('/',auth['isAuthenticated'](),controller[_0xd109('0xe')]);router['put'](_0xd109('0xb'),auth[_0xd109('0x9')](),controller[_0xd109('0xf')]);router[_0xd109('0x10')](_0xd109('0xb'),auth[_0xd109('0x9')](),controller[_0xd109('0x11')]);module[_0xd109('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b2ada37..289f3e5 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 _0xeb3b=['sequelize','exports','STRING','INTEGER','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x25040c,_0x120f19){var _0x126420=function(_0xf7318){while(--_0xf7318){_0x25040c['push'](_0x25040c['shift']());}};_0x126420(++_0x120f19);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0xeb3b[_0x6978c0];return _0x361377;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbeb3('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbeb3('0x2')],'set':function(_0x5b0e3b){this[_0xbeb3('0x4')]('crudPermissions',_0x5b0e3b?_0x5b0e3b[_0xbeb3('0x5')](''):[]);},'get':function(){return this[_0xbeb3('0x6')](_0xbeb3('0x7'))?this[_0xbeb3('0x6')](_0xbeb3('0x7'))[_0xbeb3('0x8')](''):[];}}}; \ No newline at end of file +var _0x97c1=['exports','STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x39eb5f,_0x45eafb){var _0x18cb99=function(_0x5c9399){while(--_0x5c9399){_0x39eb5f['push'](_0x39eb5f['shift']());}};_0x18cb99(++_0x45eafb);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x197c('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x197c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x197c('0x2')],'set':function(_0x26833e){this[_0x197c('0x4')](_0x197c('0x5'),_0x26833e?_0x26833e['join'](''):[]);},'get':function(){return this['getDataValue'](_0x197c('0x5'))?this[_0x197c('0x6')](_0x197c('0x5'))[_0x197c('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 81e86f6..c8607de 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 _0x177c=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','includeAll','include','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count'];(function(_0xaec935,_0x5f3d12){var _0x28a8e1=function(_0x4ca7a1){while(--_0x4ca7a1){_0xaec935['push'](_0xaec935['shift']());}};_0x28a8e1(++_0x5f3d12);}(_0x177c,0x7d));var _0xc177=function(_0x34e974,_0x35897e){_0x34e974=_0x34e974-0x0;var _0x123d6d=_0x177c[_0x34e974];return _0x123d6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc177('0x0'));var zipdir=require(_0xc177('0x1'));var jsonpatch=require(_0xc177('0x2'));var rp=require('request-promise');var moment=require(_0xc177('0x3'));var BPromise=require(_0xc177('0x4'));var Mustache=require(_0xc177('0x5'));var util=require(_0xc177('0x6'));var path=require(_0xc177('0x7'));var sox=require(_0xc177('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc177('0x9'));var _=require(_0xc177('0xa'));var squel=require(_0xc177('0xb'));var crypto=require(_0xc177('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc177('0xd'));var toCsv=require(_0xc177('0xe'));var querystring=require(_0xc177('0xf'));var Papa=require(_0xc177('0x10'));var Redis=require(_0xc177('0x11'));var authService=require(_0xc177('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc177('0x13'));var hardwareService=require(_0xc177('0x14'));var logger=require(_0xc177('0x15'))(_0xc177('0x16'));var utils=require(_0xc177('0x17'));var config=require(_0xc177('0x18'));var licenseUtil=require(_0xc177('0x19'));var db=require(_0xc177('0x1a'))['db'];function respondWithStatusCode(_0x2a6410,_0x2d11f2){_0x2d11f2=_0x2d11f2||0xcc;return function(_0x22c612){if(_0x22c612){return _0x2a6410[_0xc177('0x1b')](_0x2d11f2);}return _0x2a6410[_0xc177('0x1c')](_0x2d11f2)[_0xc177('0x1d')]();};}function respondWithResult(_0x5ee2aa,_0x3b51d8){_0x3b51d8=_0x3b51d8||0xc8;return function(_0x1fd72c){if(_0x1fd72c){return _0x5ee2aa[_0xc177('0x1c')](_0x3b51d8)['json'](_0x1fd72c);}};}function respondWithFilteredResult(_0x2b8858,_0x1d34a0){return function(_0xa93f7d){if(_0xa93f7d){var _0x24b16a=typeof _0x1d34a0[_0xc177('0x1e')]===_0xc177('0x1f')&&typeof _0x1d34a0['limit']==='undefined';var _0x84f206=_0xa93f7d[_0xc177('0x20')];var _0x347b03=_0x24b16a?0x0:_0x1d34a0[_0xc177('0x1e')];var _0x3f5008=_0x24b16a?_0xa93f7d[_0xc177('0x20')]:_0x1d34a0[_0xc177('0x1e')]+_0x1d34a0['limit'];var _0xfe6bf4;if(_0x3f5008>=_0x84f206){_0x3f5008=_0x84f206;_0xfe6bf4=0xc8;}else{_0xfe6bf4=0xce;}_0x2b8858[_0xc177('0x1c')](_0xfe6bf4);return _0x2b8858[_0xc177('0x21')](_0xc177('0x22'),_0x347b03+'-'+_0x3f5008+'/'+_0x84f206)['json'](_0xa93f7d);}return null;};}function patchUpdates(_0x4a5988){return function(_0x25b581){try{jsonpatch[_0xc177('0x23')](_0x25b581,_0x4a5988,!![]);}catch(_0x3374ab){return BPromise[_0xc177('0x24')](_0x3374ab);}return _0x25b581[_0xc177('0x25')]();};}function saveUpdates(_0x2bad50,_0x4869b9){return function(_0x41fb6d){if(_0x41fb6d){return _0x41fb6d[_0xc177('0x26')](_0x2bad50)[_0xc177('0x27')](function(_0x2cdbff){return _0x2cdbff;});}return null;};}function removeEntity(_0x171389,_0x1dc8e2){return function(_0x2db5bf){if(_0x2db5bf){return _0x2db5bf[_0xc177('0x28')]()[_0xc177('0x27')](function(){_0x171389['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f721,_0x4406c8){return function(_0x481bab){if(!_0x481bab){_0x27f721['sendStatus'](0x194);}return _0x481bab;};}function handleError(_0x4b4821,_0x3e9134){_0x3e9134=_0x3e9134||0x1f4;return function(_0x1684ff){logger[_0xc177('0x29')](_0x1684ff[_0xc177('0x2a')]);if(_0x1684ff[_0xc177('0x2b')]){delete _0x1684ff[_0xc177('0x2b')];}_0x4b4821[_0xc177('0x1c')](_0x3e9134)[_0xc177('0x2c')](_0x1684ff);};}exports[_0xc177('0x2d')]=function(_0x443a07,_0x26ff07){var _0x2c0cc1={},_0xbd98ad={},_0x130b28={'count':0x0,'rows':[]};var _0x9d8d9d=_['map'](db[_0xc177('0x2e')][_0xc177('0x2f')],function(_0x17a61f){return{'name':_0x17a61f[_0xc177('0x30')],'type':_0x17a61f[_0xc177('0x31')]['key']};});_0xbd98ad[_0xc177('0x32')]=_[_0xc177('0x33')](_0x9d8d9d,_0xc177('0x2b'));_0xbd98ad[_0xc177('0x34')]=_[_0xc177('0x35')](_0x443a07[_0xc177('0x34')]);_0xbd98ad[_0xc177('0x36')]=_['intersection'](_0xbd98ad[_0xc177('0x32')],_0xbd98ad[_0xc177('0x34')]);_0x2c0cc1['attributes']=_[_0xc177('0x37')](_0xbd98ad['model'],qs['fields'](_0x443a07[_0xc177('0x34')][_0xc177('0x38')]));_0x2c0cc1[_0xc177('0x39')]=_0x2c0cc1[_0xc177('0x39')][_0xc177('0x3a')]?_0x2c0cc1[_0xc177('0x39')]:_0xbd98ad[_0xc177('0x32')];if(!_0x443a07[_0xc177('0x34')][_0xc177('0x3b')]('nolimit')){_0x2c0cc1[_0xc177('0x3c')]=qs[_0xc177('0x3c')](_0x443a07['query'][_0xc177('0x3c')]);_0x2c0cc1['offset']=qs[_0xc177('0x1e')](_0x443a07[_0xc177('0x34')]['offset']);}_0x2c0cc1[_0xc177('0x3d')]=qs['sort'](_0x443a07[_0xc177('0x34')][_0xc177('0x3e')]);_0x2c0cc1[_0xc177('0x3f')]=qs[_0xc177('0x36')](_[_0xc177('0x40')](_0x443a07[_0xc177('0x34')],_0xbd98ad['filters']),_0x9d8d9d);if(_0x443a07[_0xc177('0x34')]['filter']){_0x2c0cc1[_0xc177('0x3f')]=_[_0xc177('0x41')](_0x2c0cc1[_0xc177('0x3f')],{'$or':_['map'](_0x9d8d9d,function(_0xd736bf){if(_0xd736bf[_0xc177('0x31')]!==_0xc177('0x42')){var _0x2379f2={};_0x2379f2[_0xd736bf[_0xc177('0x2b')]]={'$like':'%'+_0x443a07[_0xc177('0x34')][_0xc177('0x43')]+'%'};return _0x2379f2;}})});}_0x2c0cc1=_['merge']({},_0x2c0cc1,_0x443a07['options']);var _0x13e4f1={'where':_0x2c0cc1[_0xc177('0x3f')]};return db['UserProfileSection']['count'](_0x13e4f1)[_0xc177('0x27')](function(_0x100bcb){_0x130b28[_0xc177('0x20')]=_0x100bcb;if(_0x443a07[_0xc177('0x34')]['includeAll']){_0x2c0cc1['include']=[{'all':!![]}];}return db[_0xc177('0x2e')][_0xc177('0x44')](_0x2c0cc1);})[_0xc177('0x27')](function(_0x2a66db){_0x130b28[_0xc177('0x45')]=_0x2a66db;return _0x130b28;})[_0xc177('0x27')](respondWithFilteredResult(_0x26ff07,_0x2c0cc1))[_0xc177('0x46')](handleError(_0x26ff07,null));};exports['show']=function(_0x10dae8,_0x52639b){var _0x4774ad={'raw':![],'where':{'id':_0x10dae8['params']['id']}},_0x29e831={};_0x29e831[_0xc177('0x32')]=_[_0xc177('0x35')](db[_0xc177('0x2e')][_0xc177('0x2f')]);_0x29e831[_0xc177('0x34')]=_[_0xc177('0x35')](_0x10dae8['query']);_0x29e831['filters']=_[_0xc177('0x37')](_0x29e831[_0xc177('0x32')],_0x29e831[_0xc177('0x34')]);_0x4774ad[_0xc177('0x39')]=_[_0xc177('0x37')](_0x29e831[_0xc177('0x32')],qs[_0xc177('0x38')](_0x10dae8[_0xc177('0x34')][_0xc177('0x38')]));_0x4774ad[_0xc177('0x39')]=_0x4774ad[_0xc177('0x39')][_0xc177('0x3a')]?_0x4774ad['attributes']:_0x29e831[_0xc177('0x32')];if(_0x10dae8[_0xc177('0x34')][_0xc177('0x47')]){_0x4774ad[_0xc177('0x48')]=[{'all':!![]}];}_0x4774ad=_[_0xc177('0x41')]({},_0x4774ad,_0x10dae8[_0xc177('0x49')]);return db['UserProfileSection'][_0xc177('0x4a')](_0x4774ad)[_0xc177('0x27')](handleEntityNotFound(_0x52639b,null))['then'](respondWithResult(_0x52639b,null))[_0xc177('0x46')](handleError(_0x52639b,null));};exports[_0xc177('0x4b')]=function(_0x27714c,_0x349d14){return db[_0xc177('0x2e')]['create'](_0x27714c[_0xc177('0x4c')],{})['then'](respondWithResult(_0x349d14,0xc9))[_0xc177('0x46')](handleError(_0x349d14,null));};exports[_0xc177('0x26')]=function(_0x514059,_0x9c582d){if(_0x514059[_0xc177('0x4c')]['id']){delete _0x514059[_0xc177('0x4c')]['id'];}return db[_0xc177('0x2e')]['find']({'where':{'id':_0x514059[_0xc177('0x4d')]['id']}})[_0xc177('0x27')](handleEntityNotFound(_0x9c582d,null))[_0xc177('0x27')](saveUpdates(_0x514059[_0xc177('0x4c')],null))['then'](respondWithResult(_0x9c582d,null))[_0xc177('0x46')](handleError(_0x9c582d,null));};exports['destroy']=function(_0x4944e0,_0x281df7){return db[_0xc177('0x2e')][_0xc177('0x4a')]({'where':{'id':_0x4944e0[_0xc177('0x4d')]['id']}})['then'](handleEntityNotFound(_0x281df7,null))['then'](removeEntity(_0x281df7,null))[_0xc177('0x46')](handleError(_0x281df7,null));};exports[_0xc177('0x4e')]=function(_0x367cbd,_0x56d3cd){return db['UserProfileSection']['describe']()[_0xc177('0x27')](respondWithResult(_0x56d3cd,null))['catch'](handleError(_0x56d3cd,null));}; \ No newline at end of file +var _0xd08b=['error','name','send','index','UserProfileSection','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','rows','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','save','update','then','destroy','sendStatus'];(function(_0x58ca82,_0x4f469c){var _0x477987=function(_0x89cf00){while(--_0x89cf00){_0x58ca82['push'](_0x58ca82['shift']());}};_0x477987(++_0x4f469c);}(_0xd08b,0x1e4));var _0xbd08=function(_0x43139e,_0x762629){_0x43139e=_0x43139e-0x0;var _0x2bc838=_0xd08b[_0x43139e];return _0x2bc838;};'use strict';var emlformat=require(_0xbd08('0x0'));var rimraf=require(_0xbd08('0x1'));var zipdir=require(_0xbd08('0x2'));var jsonpatch=require(_0xbd08('0x3'));var rp=require(_0xbd08('0x4'));var moment=require(_0xbd08('0x5'));var BPromise=require(_0xbd08('0x6'));var Mustache=require(_0xbd08('0x7'));var util=require(_0xbd08('0x8'));var path=require(_0xbd08('0x9'));var sox=require(_0xbd08('0xa'));var csv=require(_0xbd08('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd08('0xc'));var _=require(_0xbd08('0xd'));var squel=require(_0xbd08('0xe'));var crypto=require(_0xbd08('0xf'));var jsforce=require(_0xbd08('0x10'));var deskjs=require(_0xbd08('0x11'));var toCsv=require(_0xbd08('0xb'));var querystring=require(_0xbd08('0x12'));var Papa=require(_0xbd08('0x13'));var Redis=require('ioredis');var authService=require(_0xbd08('0x14'));var qs=require(_0xbd08('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd08('0x16'));var logger=require(_0xbd08('0x17'))('api');var utils=require(_0xbd08('0x18'));var config=require(_0xbd08('0x19'));var licenseUtil=require(_0xbd08('0x1a'));var db=require(_0xbd08('0x1b'))['db'];function respondWithStatusCode(_0x56b368,_0x3c0563){_0x3c0563=_0x3c0563||0xcc;return function(_0x304341){if(_0x304341){return _0x56b368['sendStatus'](_0x3c0563);}return _0x56b368['status'](_0x3c0563)[_0xbd08('0x1c')]();};}function respondWithResult(_0x2d820b,_0x56f97b){_0x56f97b=_0x56f97b||0xc8;return function(_0x172e18){if(_0x172e18){return _0x2d820b[_0xbd08('0x1d')](_0x56f97b)[_0xbd08('0x1e')](_0x172e18);}};}function respondWithFilteredResult(_0x12334f,_0x430e4b){return function(_0x478162){if(_0x478162){var _0x46592e=typeof _0x430e4b[_0xbd08('0x1f')]===_0xbd08('0x20')&&typeof _0x430e4b['limit']==='undefined';var _0xc77f1c=_0x478162[_0xbd08('0x21')];var _0x2f0dde=_0x46592e?0x0:_0x430e4b['offset'];var _0x4e80d5=_0x46592e?_0x478162[_0xbd08('0x21')]:_0x430e4b[_0xbd08('0x1f')]+_0x430e4b[_0xbd08('0x22')];var _0x3c2b30;if(_0x4e80d5>=_0xc77f1c){_0x4e80d5=_0xc77f1c;_0x3c2b30=0xc8;}else{_0x3c2b30=0xce;}_0x12334f[_0xbd08('0x1d')](_0x3c2b30);return _0x12334f[_0xbd08('0x23')]('Content-Range',_0x2f0dde+'-'+_0x4e80d5+'/'+_0xc77f1c)[_0xbd08('0x1e')](_0x478162);}return null;};}function patchUpdates(_0x20c687){return function(_0x340ff5){try{jsonpatch['apply'](_0x340ff5,_0x20c687,!![]);}catch(_0x1ca2dd){return BPromise['reject'](_0x1ca2dd);}return _0x340ff5[_0xbd08('0x24')]();};}function saveUpdates(_0xc7ba03,_0x133389){return function(_0x319b81){if(_0x319b81){return _0x319b81[_0xbd08('0x25')](_0xc7ba03)[_0xbd08('0x26')](function(_0x5903db){return _0x5903db;});}return null;};}function removeEntity(_0x1a084b,_0x5db7b6){return function(_0x1d9ee8){if(_0x1d9ee8){return _0x1d9ee8[_0xbd08('0x27')]()[_0xbd08('0x26')](function(){_0x1a084b[_0xbd08('0x1d')](0xcc)[_0xbd08('0x1c')]();});}};}function handleEntityNotFound(_0x3c4e63,_0xa8a771){return function(_0x4810bd){if(!_0x4810bd){_0x3c4e63[_0xbd08('0x28')](0x194);}return _0x4810bd;};}function handleError(_0x5525a2,_0x30df5b){_0x30df5b=_0x30df5b||0x1f4;return function(_0x24a714){logger[_0xbd08('0x29')](_0x24a714['stack']);if(_0x24a714['name']){delete _0x24a714[_0xbd08('0x2a')];}_0x5525a2['status'](_0x30df5b)[_0xbd08('0x2b')](_0x24a714);};}exports[_0xbd08('0x2c')]=function(_0x191445,_0xf4a7b7){var _0x50c3da={},_0x279bce={},_0x2f909b={'count':0x0,'rows':[]};var _0x2640b6=_['map'](db[_0xbd08('0x2d')][_0xbd08('0x2e')],function(_0x3dea2e){return{'name':_0x3dea2e[_0xbd08('0x2f')],'type':_0x3dea2e[_0xbd08('0x30')]['key']};});_0x279bce[_0xbd08('0x31')]=_[_0xbd08('0x32')](_0x2640b6,_0xbd08('0x2a'));_0x279bce['query']=_[_0xbd08('0x33')](_0x191445[_0xbd08('0x34')]);_0x279bce[_0xbd08('0x35')]=_[_0xbd08('0x36')](_0x279bce[_0xbd08('0x31')],_0x279bce[_0xbd08('0x34')]);_0x50c3da[_0xbd08('0x37')]=_[_0xbd08('0x36')](_0x279bce[_0xbd08('0x31')],qs[_0xbd08('0x38')](_0x191445[_0xbd08('0x34')][_0xbd08('0x38')]));_0x50c3da[_0xbd08('0x37')]=_0x50c3da[_0xbd08('0x37')][_0xbd08('0x39')]?_0x50c3da[_0xbd08('0x37')]:_0x279bce[_0xbd08('0x31')];if(!_0x191445['query'][_0xbd08('0x3a')]('nolimit')){_0x50c3da[_0xbd08('0x22')]=qs[_0xbd08('0x22')](_0x191445[_0xbd08('0x34')]['limit']);_0x50c3da[_0xbd08('0x1f')]=qs[_0xbd08('0x1f')](_0x191445[_0xbd08('0x34')]['offset']);}_0x50c3da[_0xbd08('0x3b')]=qs[_0xbd08('0x3c')](_0x191445[_0xbd08('0x34')][_0xbd08('0x3c')]);_0x50c3da[_0xbd08('0x3d')]=qs['filters'](_[_0xbd08('0x3e')](_0x191445[_0xbd08('0x34')],_0x279bce[_0xbd08('0x35')]),_0x2640b6);if(_0x191445[_0xbd08('0x34')][_0xbd08('0x3f')]){_0x50c3da[_0xbd08('0x3d')]=_[_0xbd08('0x40')](_0x50c3da['where'],{'$or':_[_0xbd08('0x32')](_0x2640b6,function(_0x2a09b2){if(_0x2a09b2[_0xbd08('0x30')]!=='VIRTUAL'){var _0xd836d2={};_0xd836d2[_0x2a09b2[_0xbd08('0x2a')]]={'$like':'%'+_0x191445[_0xbd08('0x34')][_0xbd08('0x3f')]+'%'};return _0xd836d2;}})});}_0x50c3da=_[_0xbd08('0x40')]({},_0x50c3da,_0x191445[_0xbd08('0x41')]);var _0x26d7b5={'where':_0x50c3da['where']};return db[_0xbd08('0x2d')]['count'](_0x26d7b5)[_0xbd08('0x26')](function(_0x17456c){_0x2f909b[_0xbd08('0x21')]=_0x17456c;if(_0x191445['query'][_0xbd08('0x42')]){_0x50c3da['include']=[{'all':!![]}];}return db[_0xbd08('0x2d')]['findAll'](_0x50c3da);})[_0xbd08('0x26')](function(_0x1337de){_0x2f909b[_0xbd08('0x43')]=_0x1337de;return _0x2f909b;})[_0xbd08('0x26')](respondWithFilteredResult(_0xf4a7b7,_0x50c3da))['catch'](handleError(_0xf4a7b7,null));};exports['show']=function(_0x412871,_0xc4a908){var _0x462fbe={'raw':![],'where':{'id':_0x412871['params']['id']}},_0x6e9f2c={};_0x6e9f2c[_0xbd08('0x31')]=_['keys'](db['UserProfileSection'][_0xbd08('0x2e')]);_0x6e9f2c['query']=_[_0xbd08('0x33')](_0x412871['query']);_0x6e9f2c[_0xbd08('0x35')]=_[_0xbd08('0x36')](_0x6e9f2c[_0xbd08('0x31')],_0x6e9f2c['query']);_0x462fbe[_0xbd08('0x37')]=_[_0xbd08('0x36')](_0x6e9f2c[_0xbd08('0x31')],qs[_0xbd08('0x38')](_0x412871[_0xbd08('0x34')][_0xbd08('0x38')]));_0x462fbe[_0xbd08('0x37')]=_0x462fbe[_0xbd08('0x37')][_0xbd08('0x39')]?_0x462fbe[_0xbd08('0x37')]:_0x6e9f2c[_0xbd08('0x31')];if(_0x412871['query'][_0xbd08('0x42')]){_0x462fbe[_0xbd08('0x44')]=[{'all':!![]}];}_0x462fbe=_['merge']({},_0x462fbe,_0x412871[_0xbd08('0x41')]);return db[_0xbd08('0x2d')][_0xbd08('0x45')](_0x462fbe)[_0xbd08('0x26')](handleEntityNotFound(_0xc4a908,null))[_0xbd08('0x26')](respondWithResult(_0xc4a908,null))[_0xbd08('0x46')](handleError(_0xc4a908,null));};exports[_0xbd08('0x47')]=function(_0x5ef6cc,_0x49f9c1){return db[_0xbd08('0x2d')][_0xbd08('0x47')](_0x5ef6cc[_0xbd08('0x48')],{})[_0xbd08('0x26')](respondWithResult(_0x49f9c1,0xc9))[_0xbd08('0x46')](handleError(_0x49f9c1,null));};exports[_0xbd08('0x25')]=function(_0x39421c,_0x5900b6){if(_0x39421c['body']['id']){delete _0x39421c['body']['id'];}return db[_0xbd08('0x2d')][_0xbd08('0x45')]({'where':{'id':_0x39421c[_0xbd08('0x49')]['id']}})[_0xbd08('0x26')](handleEntityNotFound(_0x5900b6,null))[_0xbd08('0x26')](saveUpdates(_0x39421c[_0xbd08('0x48')],null))[_0xbd08('0x26')](respondWithResult(_0x5900b6,null))['catch'](handleError(_0x5900b6,null));};exports[_0xbd08('0x27')]=function(_0x1c0942,_0x4a4b5b){return db[_0xbd08('0x2d')][_0xbd08('0x45')]({'where':{'id':_0x1c0942['params']['id']}})[_0xbd08('0x26')](handleEntityNotFound(_0x4a4b5b,null))['then'](removeEntity(_0x4a4b5b,null))['catch'](handleError(_0x4a4b5b,null));};exports[_0xbd08('0x4a')]=function(_0x3409a0,_0x52d248){return db[_0xbd08('0x2d')]['describe']()[_0xbd08('0x26')](respondWithResult(_0x52d248,null))[_0xbd08('0x46')](handleError(_0x52d248,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 57dd7cc..afd5a17 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 _0x1008=['exports','UserProfileSection','sectionId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d6bf9,_0xef75ce){var _0x1f32fe=function(_0x5c92f2){while(--_0x5c92f2){_0x3d6bf9['push'](_0x3d6bf9['shift']());}};_0x1f32fe(++_0xef75ce);}(_0x1008,0x7c));var _0x8100=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1008[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0x8100('0x0'));var logger=require(_0x8100('0x1'))('api');var moment=require(_0x8100('0x2'));var BPromise=require(_0x8100('0x3'));var rp=require(_0x8100('0x4'));var fs=require('fs');var path=require(_0x8100('0x5'));var rimraf=require(_0x8100('0x6'));var config=require(_0x8100('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x8100('0x8')]=function(_0x2b55ef,_0x3407f5){return _0x2b55ef['define'](_0x8100('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x8100('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d76=['../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x74768a,_0x53f9b){var _0x29929f=function(_0x28dde0){while(--_0x28dde0){_0x74768a['push'](_0x74768a['shift']());}};_0x29929f(++_0x53f9b);}(_0x5d76,0x1f1));var _0x65d7=function(_0x520260,_0x56db83){_0x520260=_0x520260-0x0;var _0xd8cd16=_0x5d76[_0x520260];return _0xd8cd16;};'use strict';var _=require(_0x65d7('0x0'));var util=require(_0x65d7('0x1'));var logger=require('../../config/logger')(_0x65d7('0x2'));var moment=require('moment');var BPromise=require(_0x65d7('0x3'));var rp=require(_0x65d7('0x4'));var fs=require('fs');var path=require(_0x65d7('0x5'));var rimraf=require(_0x65d7('0x6'));var config=require(_0x65d7('0x7'));var attributes=require(_0x65d7('0x8'));module[_0x65d7('0x9')]=function(_0x2b4113,_0x399eeb){return _0x2b4113['define'](_0x65d7('0xa'),attributes,{'tableName':_0x65d7('0xb'),'paranoid':![],'indexes':[{'name':_0x65d7('0xc'),'fields':['sectionId',_0x65d7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 125e61b..55ac997 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 _0x8a87=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','moment','bluebird'];(function(_0x534c87,_0x53da8c){var _0x4e2cf6=function(_0x5ee4d4){while(--_0x5ee4d4){_0x534c87['push'](_0x534c87['shift']());}};_0x4e2cf6(++_0x53da8c);}(_0x8a87,0xa5));var _0x78a8=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x8a87[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x78a8('0x0'));var util=require('util');var moment=require(_0x78a8('0x1'));var BPromise=require(_0x78a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78a8('0x3'));var db=require(_0x78a8('0x4'))['db'];var utils=require(_0x78a8('0x5'));var logger=require(_0x78a8('0x6'))(_0x78a8('0x7'));var config=require(_0x78a8('0x8'));var jayson=require(_0x78a8('0x9'));var client=jayson[_0x78a8('0xa')][_0x78a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31591c,_0x2fcf0f,_0x15d233){return new BPromise(function(_0x4fd2ea,_0x30943c){return client[_0x78a8('0xc')](_0x31591c,_0x15d233)[_0x78a8('0xd')](function(_0x248309){logger[_0x78a8('0xe')](_0x78a8('0xf'),_0x2fcf0f,'request\x20sent');logger['debug'](_0x78a8('0x10'),_0x2fcf0f,_0x78a8('0x11'),JSON['stringify'](_0x248309));if(_0x248309[_0x78a8('0x12')]){if(_0x248309[_0x78a8('0x12')][_0x78a8('0x13')]===0x1f4){logger[_0x78a8('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2fcf0f,_0x248309[_0x78a8('0x12')][_0x78a8('0x14')]);return _0x30943c(_0x248309[_0x78a8('0x12')]['message']);}logger['error'](_0x78a8('0xf'),_0x2fcf0f,_0x248309[_0x78a8('0x12')][_0x78a8('0x14')]);return _0x4fd2ea(_0x248309[_0x78a8('0x12')][_0x78a8('0x14')]);}else{logger[_0x78a8('0xe')](_0x78a8('0xf'),_0x2fcf0f,_0x78a8('0x11'));_0x4fd2ea(_0x248309['result'][_0x78a8('0x14')]);}})['catch'](function(_0x444e3f){logger[_0x78a8('0x12')](_0x78a8('0xf'),_0x2fcf0f,_0x444e3f);_0x30943c(_0x444e3f);});});} \ No newline at end of file +var _0x3e67=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x143e98,_0xcacf43){var _0xaf0498=function(_0x53731b){while(--_0x53731b){_0x143e98['push'](_0x143e98['shift']());}};_0xaf0498(++_0xcacf43);}(_0x3e67,0x88));var _0x73e6=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x3e67[_0x57966a];return _0x191765;};'use strict';var _=require(_0x73e6('0x0'));var util=require(_0x73e6('0x1'));var moment=require(_0x73e6('0x2'));var BPromise=require(_0x73e6('0x3'));var rs=require(_0x73e6('0x4'));var fs=require('fs');var Redis=require(_0x73e6('0x5'));var db=require(_0x73e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x73e6('0x7'))(_0x73e6('0x8'));var config=require(_0x73e6('0x9'));var jayson=require(_0x73e6('0xa'));var client=jayson['client'][_0x73e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359e66,_0x1c6091,_0x34b33f){return new BPromise(function(_0x4ca9a9,_0x17a35a){return client[_0x73e6('0xc')](_0x359e66,_0x34b33f)[_0x73e6('0xd')](function(_0xfcc41){logger[_0x73e6('0xe')](_0x73e6('0xf'),_0x1c6091,_0x73e6('0x10'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1c6091,_0x73e6('0x10'),JSON[_0x73e6('0x11')](_0xfcc41));if(_0xfcc41[_0x73e6('0x12')]){if(_0xfcc41[_0x73e6('0x12')][_0x73e6('0x13')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1c6091,_0xfcc41[_0x73e6('0x12')][_0x73e6('0x14')]);return _0x17a35a(_0xfcc41[_0x73e6('0x12')][_0x73e6('0x14')]);}logger[_0x73e6('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x1c6091,_0xfcc41[_0x73e6('0x12')]['message']);return _0x4ca9a9(_0xfcc41['error'][_0x73e6('0x14')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1c6091,'request\x20sent');_0x4ca9a9(_0xfcc41['result']['message']);}})[_0x73e6('0x15')](function(_0x1f52b6){logger[_0x73e6('0x12')](_0x73e6('0xf'),_0x1c6091,_0x1f52b6);_0x17a35a(_0x1f52b6);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5ca52b3..02a79ef 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x25c5d8,_0x44e73a){var _0x469f66=function(_0x4baed1){while(--_0x4baed1){_0x25c5d8['push'](_0x25c5d8['shift']());}};_0x469f66(++_0x44e73a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xcb91[_0x245afe];return _0x4eefde;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x486b88,_0x10faca){var _0x20dee9=function(_0x5130a3){while(--_0x5130a3){_0x486b88['push'](_0x486b88['shift']());}};_0x20dee9(++_0x10faca);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a179676..9006424 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 _0x7d4f=['sequelize'];(function(_0x37c3db,_0x120a2c){var _0x49a6aa=function(_0x3ffc9f){while(--_0x3ffc9f){_0x37c3db['push'](_0x37c3db['shift']());}};_0x49a6aa(++_0x120a2c);}(_0x7d4f,0x167));var _0xf7d4=function(_0x12ca16,_0x281fd9){_0x12ca16=_0x12ca16-0x0;var _0x56fb78=_0x7d4f[_0x12ca16];return _0x56fb78;};'use strict';var Sequelize=require(_0xf7d4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');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 21366f2..95b0e38 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 _0x4fb4=['./userSmsQueue.attributes','exports','define','UserSmsQueue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4fb4,0x190));var _0x44fb=function(_0x24af02,_0x4b70f4){_0x24af02=_0x24af02-0x0;var _0x60f4a1=_0x4fb4[_0x24af02];return _0x60f4a1;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0xfc9852,_0x37f8ad){var _0x283262=function(_0xe7489a){while(--_0xe7489a){_0xfc9852['push'](_0xfc9852['shift']());}};_0x283262(++_0x37f8ad);}(_0x4745,0x1e7));var _0x5474=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4745[_0x521929];return _0x632436;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('UserSmsQueue',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index bd10048..f88bf8e 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 _0xe57c=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x2806f6,_0x294105){var _0x32ebb1=function(_0x5e875d){while(--_0x5e875d){_0x2806f6['push'](_0x2806f6['shift']());}};_0x32ebb1(++_0x294105);}(_0xe57c,0x8b));var _0xce57=function(_0x98a2d0,_0x78a6fb){_0x98a2d0=_0x98a2d0-0x0;var _0x5ae4f3=_0xe57c[_0x98a2d0];return _0x5ae4f3;};'use strict';var _=require(_0xce57('0x0'));var util=require(_0xce57('0x1'));var moment=require(_0xce57('0x2'));var BPromise=require(_0xce57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce57('0x4'));var db=require(_0xce57('0x5'))['db'];var utils=require(_0xce57('0x6'));var logger=require(_0xce57('0x7'))(_0xce57('0x8'));var config=require(_0xce57('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xce57('0xa')][_0xce57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf6ee23,_0x4c1127,_0x2633b2){return new BPromise(function(_0x159a15,_0x1face1){return client[_0xce57('0xc')](_0xf6ee23,_0x2633b2)['then'](function(_0x3a7732){logger[_0xce57('0xd')](_0xce57('0xe'),_0x4c1127,_0xce57('0xf'));logger[_0xce57('0x10')](_0xce57('0x11'),_0x4c1127,'request\x20sent',JSON[_0xce57('0x12')](_0x3a7732));if(_0x3a7732['error']){if(_0x3a7732['error'][_0xce57('0x13')]===0x1f4){logger[_0xce57('0x14')](_0xce57('0xe'),_0x4c1127,_0x3a7732[_0xce57('0x14')][_0xce57('0x15')]);return _0x1face1(_0x3a7732[_0xce57('0x14')][_0xce57('0x15')]);}logger[_0xce57('0x14')](_0xce57('0xe'),_0x4c1127,_0x3a7732[_0xce57('0x14')][_0xce57('0x15')]);return _0x159a15(_0x3a7732[_0xce57('0x14')]['message']);}else{logger['info'](_0xce57('0xe'),_0x4c1127,'request\x20sent');_0x159a15(_0x3a7732[_0xce57('0x16')][_0xce57('0x15')]);}})['catch'](function(_0x2c7c0a){logger[_0xce57('0x14')](_0xce57('0xe'),_0x4c1127,_0x2c7c0a);_0x1face1(_0x2c7c0a);});});} \ No newline at end of file +var _0xef07=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','randomstring','ioredis'];(function(_0x3d43c5,_0x220293){var _0x4bb168=function(_0x5b9cc9){while(--_0x5b9cc9){_0x3d43c5['push'](_0x3d43c5['shift']());}};_0x4bb168(++_0x220293);}(_0xef07,0xa3));var _0x7ef0=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xef07[_0x39fd11];return _0x302799;};'use strict';var _=require(_0x7ef0('0x0'));var util=require(_0x7ef0('0x1'));var moment=require(_0x7ef0('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ef0('0x3'));var fs=require('fs');var Redis=require(_0x7ef0('0x4'));var db=require(_0x7ef0('0x5'))['db'];var utils=require(_0x7ef0('0x6'));var logger=require(_0x7ef0('0x7'))('rpc');var config=require(_0x7ef0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7ef0('0x9')][_0x7ef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222814,_0x5af9d8,_0xcd2339){return new BPromise(function(_0x5edb6a,_0x5d9bdd){return client[_0x7ef0('0xb')](_0x222814,_0xcd2339)[_0x7ef0('0xc')](function(_0x48a35c){logger[_0x7ef0('0xd')](_0x7ef0('0xe'),_0x5af9d8,_0x7ef0('0xf'));logger[_0x7ef0('0x10')](_0x7ef0('0x11'),_0x5af9d8,'request\x20sent',JSON['stringify'](_0x48a35c));if(_0x48a35c['error']){if(_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x13')]===0x1f4){logger[_0x7ef0('0x12')](_0x7ef0('0xe'),_0x5af9d8,_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x14')]);return _0x5d9bdd(_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x14')]);}logger[_0x7ef0('0x12')](_0x7ef0('0xe'),_0x5af9d8,_0x48a35c[_0x7ef0('0x12')][_0x7ef0('0x14')]);return _0x5edb6a(_0x48a35c['error'][_0x7ef0('0x14')]);}else{logger['info'](_0x7ef0('0xe'),_0x5af9d8,_0x7ef0('0xf'));_0x5edb6a(_0x48a35c['result'][_0x7ef0('0x14')]);}})['catch'](function(_0xea2b6d){logger[_0x7ef0('0x12')](_0x7ef0('0xe'),_0x5af9d8,_0xea2b6d);_0x5d9bdd(_0xea2b6d);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f4b0778..fb94fea 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 _0x1620=['exports','INTEGER','sequelize'];(function(_0x477270,_0x4adea6){var _0x21ae0d=function(_0x22cf7c){while(--_0x22cf7c){_0x477270['push'](_0x477270['shift']());}};_0x21ae0d(++_0x4adea6);}(_0x1620,0x1f1));var _0x0162=function(_0x1f703a,_0x42bec7){_0x1f703a=_0x1f703a-0x0;var _0x59e2d3=_0x1620[_0x1f703a];return _0x59e2d3;};'use strict';var Sequelize=require(_0x0162('0x0'));module[_0x0162('0x1')]={'UserId':{'type':Sequelize[_0x0162('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0162('0x2')]}}; \ No newline at end of file +var _0x8192=['INTEGER','sequelize','exports'];(function(_0x2b4b40,_0x437970){var _0x34a346=function(_0x18a8cd){while(--_0x18a8cd){_0x2b4b40['push'](_0x2b4b40['shift']());}};_0x34a346(++_0x437970);}(_0x8192,0x18d));var _0x2819=function(_0x40c8f6,_0x485bbb){_0x40c8f6=_0x40c8f6-0x0;var _0xb66a88=_0x8192[_0x40c8f6];return _0xb66a88;};'use strict';var Sequelize=require(_0x2819('0x0'));module[_0x2819('0x1')]={'UserId':{'type':Sequelize[_0x2819('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2819('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0272143..aa68cc7 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(_0x3f4f37,_0x460fc0){var _0x59c5bc=function(_0x44eb8a){while(--_0x44eb8a){_0x3f4f37['push'](_0x3f4f37['shift']());}};_0x59c5bc(++_0x460fc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x55e97b,_0x59bcdd){var _0x443812=function(_0x196fc3){while(--_0x196fc3){_0x55e97b['push'](_0x55e97b['shift']());}};_0x443812(++_0x59bcdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index e2e0f21..5cc7438 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2c8b96,_0x12e420){var _0x44df04=function(_0x222b85){while(--_0x222b85){_0x2c8b96['push'](_0x2c8b96['shift']());}};_0x44df04(++_0x12e420);}(_0x70e0,0x17b));var _0x070e=function(_0x19d237,_0x1423ce){_0x19d237=_0x19d237-0x0;var _0x5e3d1c=_0x70e0[_0x19d237];return _0x5e3d1c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x348d67,_0x311ff1){var _0xafa1e4=function(_0x5de80a){while(--_0x5de80a){_0x348d67['push'](_0x348d67['shift']());}};_0xafa1e4(++_0x311ff1);}(_0xe706,0xa3));var _0x6e70=function(_0x19cee7,_0x562ecb){_0x19cee7=_0x19cee7-0x0;var _0x45657b=_0xe706[_0x19cee7];return _0x45657b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b372b2f..cd3f763 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 _0x220b=['INTEGER','exports'];(function(_0x37e66f,_0x490b48){var _0x13e363=function(_0x4c4bdf){while(--_0x4c4bdf){_0x37e66f['push'](_0x37e66f['shift']());}};_0x13e363(++_0x490b48);}(_0x220b,0x1b7));var _0xb220=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x220b[_0xfc406a];return _0x395473;};'use strict';var Sequelize=require('sequelize');module[_0xb220('0x0')]={'penalty':{'type':Sequelize[_0xb220('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x942a=['INTEGER','sequelize'];(function(_0x1e289b,_0x5acdf3){var _0x12d470=function(_0x38bb79){while(--_0x38bb79){_0x1e289b['push'](_0x1e289b['shift']());}};_0x12d470(++_0x5acdf3);}(_0x942a,0x175));var _0xa942=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x942a[_0x5a7f64];return _0x3d30f1;};'use strict';var Sequelize=require(_0xa942('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa942('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index d403950..ecb6d67 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 _0xf138=['request-promise','path','rimraf','../../config/environment','UserVoiceQueue','lodash','util','api'];(function(_0x29f1d4,_0x19b0c0){var _0x11be5a=function(_0x63cc6c){while(--_0x63cc6c){_0x29f1d4['push'](_0x29f1d4['shift']());}};_0x11be5a(++_0x19b0c0);}(_0xf138,0x8d));var _0x8f13=function(_0x4606c0,_0x1d6cfa){_0x4606c0=_0x4606c0-0x0;var _0x5dc724=_0xf138[_0x4606c0];return _0x5dc724;};'use strict';var _=require(_0x8f13('0x0'));var util=require(_0x8f13('0x1'));var logger=require('../../config/logger')(_0x8f13('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f13('0x3'));var fs=require('fs');var path=require(_0x8f13('0x4'));var rimraf=require(_0x8f13('0x5'));var config=require(_0x8f13('0x6'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x55e240,_0x38148a){return _0x55e240['define'](_0x8f13('0x7'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31c7=['exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','bluebird','rimraf','./userVoiceQueue.attributes'];(function(_0x53e9ed,_0x1282e5){var _0x54990a=function(_0x4a4db4){while(--_0x4a4db4){_0x53e9ed['push'](_0x53e9ed['shift']());}};_0x54990a(++_0x1282e5);}(_0x31c7,0x1e4));var _0x731c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x31c7[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x731c('0x0'));var logger=require(_0x731c('0x1'))(_0x731c('0x2'));var moment=require('moment');var BPromise=require(_0x731c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x731c('0x4'));var config=require('../../config/environment');var attributes=require(_0x731c('0x5'));module[_0x731c('0x6')]=function(_0x5d1a11,_0x1eb558){return _0x5d1a11[_0x731c('0x7')](_0x731c('0x8'),attributes,{'tableName':_0x731c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 04a9dcb..032d078 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 _0x6c40=['jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0x6c40,0x1c7));var _0x06c4=function(_0x47ed12,_0x269847){_0x47ed12=_0x47ed12-0x0;var _0x10d36c=_0x6c40[_0x47ed12];return _0x10d36c;};'use strict';var _=require(_0x06c4('0x0'));var util=require(_0x06c4('0x1'));var moment=require('moment');var BPromise=require(_0x06c4('0x2'));var rs=require(_0x06c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x06c4('0x5'));var config=require(_0x06c4('0x6'));var jayson=require(_0x06c4('0x7'));var client=jayson[_0x06c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11b1e8,_0x1592fd,_0x4a07a7){return new BPromise(function(_0x5804ee,_0x548892){return client[_0x06c4('0x9')](_0x11b1e8,_0x4a07a7)[_0x06c4('0xa')](function(_0x38a73e){logger[_0x06c4('0xb')](_0x06c4('0xc'),_0x1592fd,_0x06c4('0xd'));logger[_0x06c4('0xe')](_0x06c4('0xf'),_0x1592fd,_0x06c4('0xd'),JSON[_0x06c4('0x10')](_0x38a73e));if(_0x38a73e[_0x06c4('0x11')]){if(_0x38a73e['error']['code']===0x1f4){logger[_0x06c4('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1592fd,_0x38a73e[_0x06c4('0x11')]['message']);return _0x548892(_0x38a73e[_0x06c4('0x11')][_0x06c4('0x12')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1592fd,_0x38a73e[_0x06c4('0x11')][_0x06c4('0x12')]);return _0x5804ee(_0x38a73e[_0x06c4('0x11')][_0x06c4('0x12')]);}else{logger[_0x06c4('0xb')](_0x06c4('0xc'),_0x1592fd,_0x06c4('0xd'));_0x5804ee(_0x38a73e[_0x06c4('0x13')][_0x06c4('0x12')]);}})[_0x06c4('0x14')](function(_0x6d0b22){logger[_0x06c4('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1592fd,_0x6d0b22);_0x548892(_0x6d0b22);});});} \ No newline at end of file +var _0x2345=['http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41426d,_0x10e308){var _0x1a1440=function(_0x127300){while(--_0x127300){_0x41426d['push'](_0x41426d['shift']());}};_0x1a1440(++_0x10e308);}(_0x2345,0xd4));var _0x5234=function(_0x2cc730,_0x3fa148){_0x2cc730=_0x2cc730-0x0;var _0x353684=_0x2345[_0x2cc730];return _0x353684;};'use strict';var _=require(_0x5234('0x0'));var util=require(_0x5234('0x1'));var moment=require(_0x5234('0x2'));var BPromise=require(_0x5234('0x3'));var rs=require(_0x5234('0x4'));var fs=require('fs');var Redis=require(_0x5234('0x5'));var db=require(_0x5234('0x6'))['db'];var utils=require(_0x5234('0x7'));var logger=require(_0x5234('0x8'))(_0x5234('0x9'));var config=require(_0x5234('0xa'));var jayson=require(_0x5234('0xb'));var client=jayson[_0x5234('0xc')][_0x5234('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a31b9,_0x60a575,_0x153ad4){return new BPromise(function(_0x184175,_0x4b7cde){return client[_0x5234('0xe')](_0x1a31b9,_0x153ad4)[_0x5234('0xf')](function(_0x51e9dd){logger[_0x5234('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x60a575,_0x5234('0x11'));logger['debug'](_0x5234('0x12'),_0x60a575,_0x5234('0x11'),JSON[_0x5234('0x13')](_0x51e9dd));if(_0x51e9dd['error']){if(_0x51e9dd[_0x5234('0x14')][_0x5234('0x15')]===0x1f4){logger[_0x5234('0x14')](_0x5234('0x16'),_0x60a575,_0x51e9dd[_0x5234('0x14')][_0x5234('0x17')]);return _0x4b7cde(_0x51e9dd[_0x5234('0x14')][_0x5234('0x17')]);}logger[_0x5234('0x14')](_0x5234('0x16'),_0x60a575,_0x51e9dd[_0x5234('0x14')]['message']);return _0x184175(_0x51e9dd[_0x5234('0x14')][_0x5234('0x17')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x60a575,_0x5234('0x11'));_0x184175(_0x51e9dd['result']['message']);}})[_0x5234('0x18')](function(_0x285521){logger[_0x5234('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x60a575,_0x285521);_0x4b7cde(_0x285521);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9d38073..9c26b57 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4900e4,_0x125f32){var _0x3ed7f5=function(_0x3083c2){while(--_0x3083c2){_0x4900e4['push'](_0x4900e4['shift']());}};_0x3ed7f5(++_0x125f32);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x25d68d,_0x69adf9){var _0x3f5c89=function(_0x27791a){while(--_0x27791a){_0x25d68d['push'](_0x25d68d['shift']());}};_0x3f5c89(++_0x69adf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b95f874..0c886ba 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 _0x2ef1=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x37333f,_0x544eca){var _0x58b7ec=function(_0x1add86){while(--_0x1add86){_0x37333f['push'](_0x37333f['shift']());}};_0x58b7ec(++_0x544eca);}(_0x2ef1,0x9e));var _0x12ef=function(_0x3e2ffe,_0x48ff1b){_0x3e2ffe=_0x3e2ffe-0x0;var _0xaaca01=_0x2ef1[_0x3e2ffe];return _0xaaca01;};'use strict';var Sequelize=require(_0x12ef('0x0'));module[_0x12ef('0x1')]={'uniqueid':{'type':Sequelize[_0x12ef('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x12ef('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x12ef('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x12ef('0x4')],'allowNull':![],'unique':_0x12ef('0x5'),'comment':_0x12ef('0x3')},'VoiceQueueId':{'type':Sequelize[_0x12ef('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x12ef('0x4')],'allowNull':![],'unique':_0x12ef('0x5'),'comment':_0x12ef('0x3')},'penalty':{'type':Sequelize[_0x12ef('0x2')](0xb),'defaultValue':0x0,'comment':_0x12ef('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xe3a8=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x431c49,_0x2c7d00){var _0x2d3010=function(_0xd6af48){while(--_0xd6af48){_0x431c49['push'](_0x431c49['shift']());}};_0x2d3010(++_0x2c7d00);}(_0xe3a8,0x94));var _0x8e3a=function(_0x5ab626,_0x3737c7){_0x5ab626=_0x5ab626-0x0;var _0x3d2fc5=_0xe3a8[_0x5ab626];return _0x3d2fc5;};'use strict';var Sequelize=require('sequelize');module[_0x8e3a('0x0')]={'uniqueid':{'type':Sequelize[_0x8e3a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8e3a('0x2')},'membername':{'type':Sequelize[_0x8e3a('0x3')],'allowNull':![],'comment':_0x8e3a('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8e3a('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x8e3a('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8e3a('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8e3a('0x4'),'comment':_0x8e3a('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x8e3a('0x2')},'paused':{'type':Sequelize[_0x8e3a('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 76f6f5e..e20b985 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 _0x54e6=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x420fe3,_0x50647e){var _0x123c87=function(_0x4ae8db){while(--_0x4ae8db){_0x420fe3['push'](_0x420fe3['shift']());}};_0x123c87(++_0x50647e);}(_0x54e6,0x131));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x654e('0x0'));var UserVoiceQueueRt=require(_0x654e('0x1'))['db'][_0x654e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x654e('0x3')](0x0);var events={'afterCreate':_0x654e('0x4'),'afterUpdate':_0x654e('0x5'),'afterDestroy':_0x654e('0x6')};function emitEvent(_0x2b5b99){return function(_0x48a769,_0x3a3c77,_0x2b5c26){UserVoiceQueueRtEvents[_0x654e('0x7')](_0x2b5b99+':'+_0x48a769['id'],_0x48a769);UserVoiceQueueRtEvents[_0x654e('0x7')](_0x2b5b99,_0x48a769);_0x2b5c26(null);};}for(var e in events){if(events[_0x654e('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x654e('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3e81=['UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x305140,_0x5d473a){var _0x356e64=function(_0xe933de){while(--_0xe933de){_0x305140['push'](_0x305140['shift']());}};_0x356e64(++_0x5d473a);}(_0x3e81,0x1d4));var _0x13e8=function(_0x383597,_0x415582){_0x383597=_0x383597-0x0;var _0x3425aa=_0x3e81[_0x383597];return _0x3425aa;};'use strict';var EventEmitter=require(_0x13e8('0x0'));var UserVoiceQueueRt=require(_0x13e8('0x1'))['db'][_0x13e8('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x13e8('0x3')](0x0);var events={'afterCreate':_0x13e8('0x4'),'afterUpdate':_0x13e8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4765ec){return function(_0x578f92,_0x3cb69d,_0x9cb5ec){UserVoiceQueueRtEvents[_0x13e8('0x6')](_0x4765ec+':'+_0x578f92['id'],_0x578f92);UserVoiceQueueRtEvents[_0x13e8('0x6')](_0x4765ec,_0x578f92);_0x9cb5ec(null);};}for(var e in events){if(events[_0x13e8('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x13e8('0x8')](e,emitEvent(event));}}module[_0x13e8('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8075f2b..476c0dd 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 _0x0aaa=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0x0aaa,0xe5));var _0xa0aa=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x0aaa[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var logger=require(_0xa0aa('0x2'))(_0xa0aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa0aa('0x4'));var fs=require('fs');var path=require(_0xa0aa('0x5'));var rimraf=require(_0xa0aa('0x6'));var config=require(_0xa0aa('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xa0aa('0x8')]=function(_0x389478,_0x4f1583){return _0x389478['define'](_0xa0aa('0x9'),attributes,{'tableName':_0xa0aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac3=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x697190,_0x5db743){var _0x312648=function(_0x581044){while(--_0x581044){_0x697190['push'](_0x697190['shift']());}};_0x312648(++_0x5db743);}(_0x0ac3,0x191));var _0x30ac=function(_0x5abd01,_0xa03557){_0x5abd01=_0x5abd01-0x0;var _0x24e9bb=_0x0ac3[_0x5abd01];return _0x24e9bb;};'use strict';var _=require(_0x30ac('0x0'));var util=require('util');var logger=require(_0x30ac('0x1'))(_0x30ac('0x2'));var moment=require(_0x30ac('0x3'));var BPromise=require('bluebird');var rp=require(_0x30ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30ac('0x5'));var config=require(_0x30ac('0x6'));var attributes=require(_0x30ac('0x7'));module[_0x30ac('0x8')]=function(_0x2a2c94,_0x1f1afb){return _0x2a2c94[_0x30ac('0x9')](_0x30ac('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 3313222..57bbd3c 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 _0x9c25=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x9c25,0x163));var _0x59c2=function(_0x44a304,_0x1a0c5b){_0x44a304=_0x44a304-0x0;var _0xd9128d=_0x9c25[_0x44a304];return _0xd9128d;};'use strict';var _=require('lodash');var util=require(_0x59c2('0x0'));var moment=require('moment');var BPromise=require(_0x59c2('0x1'));var rs=require(_0x59c2('0x2'));var fs=require('fs');var Redis=require(_0x59c2('0x3'));var db=require(_0x59c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x59c2('0x5'))('rpc');var config=require(_0x59c2('0x6'));var jayson=require(_0x59c2('0x7'));var client=jayson[_0x59c2('0x8')][_0x59c2('0x9')]({'port':0x232a});config[_0x59c2('0xa')]=_[_0x59c2('0xb')](config[_0x59c2('0xa')],{'host':_0x59c2('0xc'),'port':0x18eb});var socket=require(_0x59c2('0xd'))(new Redis(config[_0x59c2('0xa')]));require(_0x59c2('0xe'))[_0x59c2('0xf')](socket);function respondWithRpcPromise(_0x30322c,_0x2b8bd8,_0x2c9b3f){return new BPromise(function(_0x2c5707,_0x2e6426){return client[_0x59c2('0x10')](_0x30322c,_0x2c9b3f)[_0x59c2('0x11')](function(_0x5adaaf){logger[_0x59c2('0x12')](_0x59c2('0x13'),_0x2b8bd8,_0x59c2('0x14'));logger['debug'](_0x59c2('0x15'),_0x2b8bd8,_0x59c2('0x14'),JSON[_0x59c2('0x16')](_0x5adaaf));if(_0x5adaaf['error']){if(_0x5adaaf['error']['code']===0x1f4){logger[_0x59c2('0x17')](_0x59c2('0x13'),_0x2b8bd8,_0x5adaaf[_0x59c2('0x17')][_0x59c2('0x18')]);return _0x2e6426(_0x5adaaf['error'][_0x59c2('0x18')]);}logger[_0x59c2('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2b8bd8,_0x5adaaf[_0x59c2('0x17')][_0x59c2('0x18')]);return _0x2c5707(_0x5adaaf[_0x59c2('0x17')][_0x59c2('0x18')]);}else{logger[_0x59c2('0x12')](_0x59c2('0x13'),_0x2b8bd8,_0x59c2('0x14'));_0x2c5707(_0x5adaaf[_0x59c2('0x19')][_0x59c2('0x18')]);}})[_0x59c2('0x1a')](function(_0x151a1e){logger[_0x59c2('0x17')](_0x59c2('0x13'),_0x2b8bd8,_0x151a1e);_0x2e6426(_0x151a1e);});});}exports[_0x59c2('0x1b')]=function(_0x5c09af){var _0x4100e8=this;return new Promise(function(_0x3a9292,_0xf7a986){return db['UserVoiceQueueRt'][_0x59c2('0x1c')]({'raw':_0x5c09af[_0x59c2('0x1d')]?_0x5c09af[_0x59c2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c09af[_0x59c2('0x1d')]?_0x5c09af[_0x59c2('0x1d')][_0x59c2('0x1e')]||null:null,'attributes':[[db[_0x59c2('0x1f')]['fn'](_0x59c2('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x59c2('0x21')](_0x59c2('0x22')))),_0x59c2('0x23')]]})[_0x59c2('0x11')](function(_0x43a9fb){logger['info'](_0x59c2('0x1b'),_0x5c09af);logger[_0x59c2('0x24')]('GetVoiceQueueRtPauses',_0x5c09af,JSON[_0x59c2('0x16')](_0x43a9fb));_0x3a9292(_0x43a9fb);})[_0x59c2('0x1a')](function(_0x375469){logger[_0x59c2('0x17')](_0x59c2('0x1b'),_0x375469[_0x59c2('0x18')],_0x5c09af);_0xf7a986(_0x4100e8[_0x59c2('0x17')](0x1f4,_0x375469[_0x59c2('0x18')]));});});}; \ No newline at end of file +var _0x2a88=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x3173df,_0x31bec7){var _0x3911d8=function(_0x5c901f){while(--_0x5c901f){_0x3173df['push'](_0x3173df['shift']());}};_0x3911d8(++_0x31bec7);}(_0x2a88,0x173));var _0x82a8=function(_0x79d71b,_0x34e76b){_0x79d71b=_0x79d71b-0x0;var _0x225cda=_0x2a88[_0x79d71b];return _0x225cda;};'use strict';var _=require(_0x82a8('0x0'));var util=require(_0x82a8('0x1'));var moment=require(_0x82a8('0x2'));var BPromise=require(_0x82a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82a8('0x4'));var db=require(_0x82a8('0x5'))['db'];var utils=require(_0x82a8('0x6'));var logger=require(_0x82a8('0x7'))(_0x82a8('0x8'));var config=require(_0x82a8('0x9'));var jayson=require(_0x82a8('0xa'));var client=jayson[_0x82a8('0xb')]['http']({'port':0x232a});config[_0x82a8('0xc')]=_[_0x82a8('0xd')](config[_0x82a8('0xc')],{'host':_0x82a8('0xe'),'port':0x18eb});var socket=require(_0x82a8('0xf'))(new Redis(config[_0x82a8('0xc')]));require(_0x82a8('0x10'))[_0x82a8('0x11')](socket);function respondWithRpcPromise(_0x2ceb89,_0x4af72f,_0x2d1ff3){return new BPromise(function(_0x51dd77,_0x2e728f){return client[_0x82a8('0x12')](_0x2ceb89,_0x2d1ff3)['then'](function(_0x77c686){logger['info'](_0x82a8('0x13'),_0x4af72f,_0x82a8('0x14'));logger[_0x82a8('0x15')](_0x82a8('0x16'),_0x4af72f,_0x82a8('0x14'),JSON[_0x82a8('0x17')](_0x77c686));if(_0x77c686[_0x82a8('0x18')]){if(_0x77c686[_0x82a8('0x18')][_0x82a8('0x19')]===0x1f4){logger['error'](_0x82a8('0x13'),_0x4af72f,_0x77c686[_0x82a8('0x18')]['message']);return _0x2e728f(_0x77c686[_0x82a8('0x18')][_0x82a8('0x1a')]);}logger[_0x82a8('0x18')](_0x82a8('0x13'),_0x4af72f,_0x77c686[_0x82a8('0x18')][_0x82a8('0x1a')]);return _0x51dd77(_0x77c686[_0x82a8('0x18')][_0x82a8('0x1a')]);}else{logger[_0x82a8('0x1b')](_0x82a8('0x13'),_0x4af72f,_0x82a8('0x14'));_0x51dd77(_0x77c686[_0x82a8('0x1c')]['message']);}})[_0x82a8('0x1d')](function(_0x154de2){logger[_0x82a8('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4af72f,_0x154de2);_0x2e728f(_0x154de2);});});}exports[_0x82a8('0x1e')]=function(_0x1c5b49){var _0x459b5a=this;return new Promise(function(_0x57c569,_0x34d89d){return db[_0x82a8('0x1f')][_0x82a8('0x20')]({'raw':_0x1c5b49[_0x82a8('0x21')]?_0x1c5b49['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c5b49['options']?_0x1c5b49[_0x82a8('0x21')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x82a8('0x22'),db[_0x82a8('0x23')]['fn']('IF',db[_0x82a8('0x23')][_0x82a8('0x24')](_0x82a8('0x25')))),_0x82a8('0x26')]]})[_0x82a8('0x27')](function(_0x3068ce){logger[_0x82a8('0x1b')]('GetVoiceQueueRtPauses',_0x1c5b49);logger[_0x82a8('0x15')](_0x82a8('0x1e'),_0x1c5b49,JSON[_0x82a8('0x17')](_0x3068ce));_0x57c569(_0x3068ce);})[_0x82a8('0x1d')](function(_0x477245){logger['error']('GetVoiceQueueRtPauses',_0x477245[_0x82a8('0x1a')],_0x1c5b49);_0x34d89d(_0x459b5a[_0x82a8('0x18')](0x1f4,_0x477245['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cc433b8..709bd84 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 _0x972c=['register','length','remove','update','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x972c,0xf2));var _0xc972=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0x972c[_0x83c716];return _0xab9893;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xc972('0x0'),_0xc972('0x1')];function createListener(_0x5ebc6c,_0x3c04a5){return function(_0x1a41f9){_0x3c04a5['emit'](_0x5ebc6c,_0x1a41f9);};}function removeListener(_0x511ad4,_0x140e13){return function(){UserVoiceQueueRtEvents[_0xc972('0x2')](_0x511ad4,_0x140e13);};}exports[_0xc972('0x3')]=function(_0x5dd2c8){for(var _0xd70261=0x0,_0x4cff66=events[_0xc972('0x4')];_0xd70261<_0x4cff66;_0xd70261++){var _0xd8cd25=events[_0xd70261];var _0x304d08=createListener('userVoiceQueueRt:'+_0xd8cd25,_0x5dd2c8);UserVoiceQueueRtEvents['on'](_0xd8cd25,_0x304d08);}}; \ No newline at end of file +var _0xc2d6=['emit','removeListener','userVoiceQueueRt:','save','remove','update'];(function(_0x460387,_0x48ea4a){var _0x2d0d84=function(_0x1edd3f){while(--_0x1edd3f){_0x460387['push'](_0x460387['shift']());}};_0x2d0d84(++_0x48ea4a);}(_0xc2d6,0x171));var _0x6c2d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc2d6[_0x6c993a];return _0x27f547;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x6c2d('0x0'),_0x6c2d('0x1'),_0x6c2d('0x2')];function createListener(_0x36f034,_0x1d92f7){return function(_0x3b94d4){_0x1d92f7[_0x6c2d('0x3')](_0x36f034,_0x3b94d4);};}function removeListener(_0x304229,_0x47057e){return function(){UserVoiceQueueRtEvents[_0x6c2d('0x4')](_0x304229,_0x47057e);};}exports['register']=function(_0x1141f7){for(var _0x3cf33f=0x0,_0x33c7a9=events['length'];_0x3cf33f<_0x33c7a9;_0x3cf33f++){var _0x2595b5=events[_0x3cf33f];var _0x5f5134=createListener(_0x6c2d('0x5')+_0x2595b5,_0x1141f7);UserVoiceQueueRtEvents['on'](_0x2595b5,_0x5f5134);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index fb5c203..10f638e 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(_0xdb7138,_0x2ad4bd){var _0x39031c=function(_0x4fe1e2){while(--_0x4fe1e2){_0xdb7138['push'](_0xdb7138['shift']());}};_0x39031c(++_0x2ad4bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4cd689,_0x12d4ca){var _0x5a9a03=function(_0x48ea01){while(--_0x48ea01){_0x4cd689['push'](_0x4cd689['shift']());}};_0x5a9a03(++_0x12d4ca);}(_0xe706,0xa3));var _0x6e70=function(_0x3a831f,_0x31c8a4){_0x3a831f=_0x3a831f-0x0;var _0x26786c=_0xe706[_0x3a831f];return _0x26786c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6cc895d..f910644 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 _0x6d5f=['INTEGER','exports'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x6d5f,0xcf));var _0xf6d5=function(_0x27cb15,_0x37bc08){_0x27cb15=_0x27cb15-0x0;var _0x155d1b=_0x6d5f[_0x27cb15];return _0x155d1b;};'use strict';var Sequelize=require('sequelize');module[_0xf6d5('0x0')]={'penalty':{'type':Sequelize[_0xf6d5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x86c9=['INTEGER'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x86c9,0x100));var _0x986c=function(_0x5831cd,_0x309b94){_0x5831cd=_0x5831cd-0x0;var _0x466ef7=_0x86c9[_0x5831cd];return _0x466ef7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x986c('0x0')],'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 d0effc9..c2fb2ae 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 _0xbbc5=['rimraf','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25e218,_0x21206f){var _0x3df59f=function(_0x1d9bdf){while(--_0x1d9bdf){_0x25e218['push'](_0x25e218['shift']());}};_0x3df59f(++_0x21206f);}(_0xbbc5,0x131));var _0x5bbc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbbc5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5bbc('0x0'));var util=require(_0x5bbc('0x1'));var logger=require(_0x5bbc('0x2'))(_0x5bbc('0x3'));var moment=require(_0x5bbc('0x4'));var BPromise=require(_0x5bbc('0x5'));var rp=require(_0x5bbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bbc('0x7'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x5bbc('0x8')]=function(_0x454fbf,_0x2cbfb6){return _0x454fbf[_0x5bbc('0x9')](_0x5bbc('0xa'),attributes,{'tableName':_0x5bbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bfe=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x0bfe,0xe6));var _0xe0bf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0bfe[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe0bf('0x0'));var util=require(_0xe0bf('0x1'));var logger=require(_0xe0bf('0x2'))(_0xe0bf('0x3'));var moment=require(_0xe0bf('0x4'));var BPromise=require(_0xe0bf('0x5'));var rp=require(_0xe0bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0bf('0x7'));var config=require(_0xe0bf('0x8'));var attributes=require(_0xe0bf('0x9'));module[_0xe0bf('0xa')]=function(_0x2f40d1,_0x29244f){return _0x2f40d1[_0xe0bf('0xb')](_0xe0bf('0xc'),attributes,{'tableName':_0xe0bf('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 0f85cee..fdd9f8e 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 _0xd6df=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x376d15,_0x424a73){var _0x215fde=function(_0x59f664){while(--_0x59f664){_0x376d15['push'](_0x376d15['shift']());}};_0x215fde(++_0x424a73);}(_0xd6df,0x1a7));var _0xfd6d=function(_0x334847,_0x48eb24){_0x334847=_0x334847-0x0;var _0xe9b1a6=_0xd6df[_0x334847];return _0xe9b1a6;};'use strict';var _=require(_0xfd6d('0x0'));var util=require(_0xfd6d('0x1'));var moment=require('moment');var BPromise=require(_0xfd6d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd6d('0x3'))['db'];var utils=require(_0xfd6d('0x4'));var logger=require('../../config/logger')(_0xfd6d('0x5'));var config=require(_0xfd6d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd6d('0x7')][_0xfd6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22f304,_0x387b5a,_0x41104b){return new BPromise(function(_0x15283a,_0x5d0583){return client['request'](_0x22f304,_0x41104b)[_0xfd6d('0x9')](function(_0x5117c5){logger[_0xfd6d('0xa')](_0xfd6d('0xb'),_0x387b5a,_0xfd6d('0xc'));logger[_0xfd6d('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x387b5a,'request\x20sent',JSON[_0xfd6d('0xe')](_0x5117c5));if(_0x5117c5[_0xfd6d('0xf')]){if(_0x5117c5[_0xfd6d('0xf')][_0xfd6d('0x10')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x387b5a,_0x5117c5[_0xfd6d('0xf')][_0xfd6d('0x11')]);return _0x5d0583(_0x5117c5[_0xfd6d('0xf')][_0xfd6d('0x11')]);}logger[_0xfd6d('0xf')](_0xfd6d('0xb'),_0x387b5a,_0x5117c5['error'][_0xfd6d('0x11')]);return _0x15283a(_0x5117c5['error'][_0xfd6d('0x11')]);}else{logger[_0xfd6d('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x387b5a,'request\x20sent');_0x15283a(_0x5117c5[_0xfd6d('0x12')][_0xfd6d('0x11')]);}})[_0xfd6d('0x13')](function(_0x4954e6){logger[_0xfd6d('0xf')](_0xfd6d('0xb'),_0x387b5a,_0x4954e6);_0x5d0583(_0x4954e6);});});} \ No newline at end of file +var _0x44f6=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch'];(function(_0x23c827,_0x37332a){var _0x3d7f1f=function(_0x3ff0f2){while(--_0x3ff0f2){_0x23c827['push'](_0x23c827['shift']());}};_0x3d7f1f(++_0x37332a);}(_0x44f6,0x13b));var _0x644f=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x44f6[_0x574ce3];return _0x3447a0;};'use strict';var _=require(_0x644f('0x0'));var util=require('util');var moment=require(_0x644f('0x1'));var BPromise=require(_0x644f('0x2'));var rs=require(_0x644f('0x3'));var fs=require('fs');var Redis=require(_0x644f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x644f('0x5'));var logger=require(_0x644f('0x6'))(_0x644f('0x7'));var config=require(_0x644f('0x8'));var jayson=require(_0x644f('0x9'));var client=jayson[_0x644f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2519ba,_0x3de98b,_0x5588cc){return new BPromise(function(_0x3cddba,_0x1372ac){return client['request'](_0x2519ba,_0x5588cc)[_0x644f('0xb')](function(_0x1faa20){logger[_0x644f('0xc')](_0x644f('0xd'),_0x3de98b,'request\x20sent');logger[_0x644f('0xe')](_0x644f('0xf'),_0x3de98b,'request\x20sent',JSON[_0x644f('0x10')](_0x1faa20));if(_0x1faa20[_0x644f('0x11')]){if(_0x1faa20['error']['code']===0x1f4){logger['error'](_0x644f('0xd'),_0x3de98b,_0x1faa20['error'][_0x644f('0x12')]);return _0x1372ac(_0x1faa20[_0x644f('0x11')][_0x644f('0x12')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3de98b,_0x1faa20[_0x644f('0x11')]['message']);return _0x3cddba(_0x1faa20[_0x644f('0x11')][_0x644f('0x12')]);}else{logger[_0x644f('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3de98b,_0x644f('0x13'));_0x3cddba(_0x1faa20['result'][_0x644f('0x12')]);}})[_0x644f('0x14')](function(_0x5e6c34){logger[_0x644f('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3de98b,_0x5e6c34);_0x1372ac(_0x5e6c34);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e6c1be8..bfc588f 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 _0xd2ce=['get','index','/:id','show','isAuthenticated','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x576815,_0x508e34){var _0x2926e6=function(_0x135100){while(--_0x135100){_0x576815['push'](_0x576815['shift']());}};_0x2926e6(++_0x508e34);}(_0xd2ce,0x13c));var _0xed2c=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xd2ce[_0x37c22c];return _0x119d79;};'use strict';var multer=require('multer');var util=require(_0xed2c('0x0'));var path=require('path');var timeout=require(_0xed2c('0x1'));var express=require(_0xed2c('0x2'));var router=express[_0xed2c('0x3')]();var fs_extra=require(_0xed2c('0x4'));var auth=require(_0xed2c('0x5'));var interaction=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var controller=require('./variable.controller');router[_0xed2c('0x8')]('/',auth['isAuthenticated'](),controller[_0xed2c('0x9')]);router[_0xed2c('0x8')](_0xed2c('0xa'),auth['isAuthenticated'](),controller[_0xed2c('0xb')]);router['post']('/',auth[_0xed2c('0xc')](),controller[_0xed2c('0xd')]);router['put']('/:id',auth[_0xed2c('0xc')](),controller[_0xed2c('0xe')]);router[_0xed2c('0xf')](_0xed2c('0xa'),auth['isAuthenticated'](),controller[_0xed2c('0x10')]);module[_0xed2c('0x11')]=router; \ No newline at end of file +var _0xa98d=['put','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x2d44a6,_0x2f8ce3){var _0x444670=function(_0x2fb63e){while(--_0x2fb63e){_0x2d44a6['push'](_0x2d44a6['shift']());}};_0x444670(++_0x2f8ce3);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xda98('0x0'));var util=require('util');var path=require(_0xda98('0x1'));var timeout=require('connect-timeout');var express=require(_0xda98('0x2'));var router=express[_0xda98('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xda98('0x4'));var interaction=require(_0xda98('0x5'));var config=require(_0xda98('0x6'));var controller=require('./variable.controller');router[_0xda98('0x7')]('/',auth[_0xda98('0x8')](),controller[_0xda98('0x9')]);router[_0xda98('0x7')](_0xda98('0xa'),auth[_0xda98('0x8')](),controller['show']);router[_0xda98('0xb')]('/',auth['isAuthenticated'](),controller[_0xda98('0xc')]);router[_0xda98('0xd')]('/:id',auth[_0xda98('0x8')](),controller[_0xda98('0xe')]);router['delete'](_0xda98('0xa'),auth[_0xda98('0x8')](),controller[_0xda98('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5b10d53..7ccb8a8 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 _0x88fa=['exports','STRING','name','sequelize'];(function(_0x42d0ce,_0x41d505){var _0x25837e=function(_0x14caaf){while(--_0x14caaf){_0x42d0ce['push'](_0x42d0ce['shift']());}};_0x25837e(++_0x41d505);}(_0x88fa,0x19f));var _0xa88f=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x88fa[_0x3c487b];return _0x1d65f6;};'use strict';var Sequelize=require(_0xa88f('0x0'));module[_0xa88f('0x1')]={'name':{'type':Sequelize[_0xa88f('0x2')],'unique':_0xa88f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa88f('0x2')]}}; \ No newline at end of file +var _0xbdf3=['exports','STRING'];(function(_0xb59e7f,_0x1d9a99){var _0x3fea4c=function(_0x3d73e9){while(--_0x3d73e9){_0xb59e7f['push'](_0xb59e7f['shift']());}};_0x3fea4c(++_0x1d9a99);}(_0xbdf3,0x10a));var _0x3bdf=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xbdf3[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require('sequelize');module[_0x3bdf('0x0')]={'name':{'type':Sequelize[_0x3bdf('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3bdf('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 412b6ae..f550bef 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 _0xed37=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName'];(function(_0x52cb89,_0x42fca1){var _0x4ab7be=function(_0x4e4688){while(--_0x4e4688){_0x52cb89['push'](_0x52cb89['shift']());}};_0x4ab7be(++_0x42fca1);}(_0xed37,0x10b));var _0x7ed3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xed37[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x7ed3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ed3('0x1'));var jsonpatch=require(_0x7ed3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ed3('0x3'));var Mustache=require(_0x7ed3('0x4'));var util=require(_0x7ed3('0x5'));var path=require(_0x7ed3('0x6'));var sox=require('sox');var csv=require(_0x7ed3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ed3('0x8'));var _=require('lodash');var squel=require(_0x7ed3('0x9'));var crypto=require(_0x7ed3('0xa'));var jsforce=require(_0x7ed3('0xb'));var deskjs=require(_0x7ed3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7ed3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7ed3('0xe'));var as=require(_0x7ed3('0xf'));var hardwareService=require(_0x7ed3('0x10'));var logger=require(_0x7ed3('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ed3('0x12'));var db=require(_0x7ed3('0x13'))['db'];function respondWithStatusCode(_0x135119,_0x1e312f){_0x1e312f=_0x1e312f||0xcc;return function(_0x1590c4){if(_0x1590c4){return _0x135119[_0x7ed3('0x14')](_0x1e312f);}return _0x135119[_0x7ed3('0x15')](_0x1e312f)[_0x7ed3('0x16')]();};}function respondWithResult(_0x17689d,_0x4c67e6){_0x4c67e6=_0x4c67e6||0xc8;return function(_0x5e55fb){if(_0x5e55fb){return _0x17689d[_0x7ed3('0x15')](_0x4c67e6)[_0x7ed3('0x17')](_0x5e55fb);}};}function respondWithFilteredResult(_0x43c868,_0xc49628){return function(_0x1c4329){if(_0x1c4329){var _0x2cdb18=typeof _0xc49628['offset']===_0x7ed3('0x18')&&typeof _0xc49628[_0x7ed3('0x19')]==='undefined';var _0x1d35bf=_0x1c4329[_0x7ed3('0x1a')];var _0x119868=_0x2cdb18?0x0:_0xc49628[_0x7ed3('0x1b')];var _0x1c0899=_0x2cdb18?_0x1c4329['count']:_0xc49628[_0x7ed3('0x1b')]+_0xc49628[_0x7ed3('0x19')];var _0x216bcb;if(_0x1c0899>=_0x1d35bf){_0x1c0899=_0x1d35bf;_0x216bcb=0xc8;}else{_0x216bcb=0xce;}_0x43c868['status'](_0x216bcb);return _0x43c868[_0x7ed3('0x1c')]('Content-Range',_0x119868+'-'+_0x1c0899+'/'+_0x1d35bf)[_0x7ed3('0x17')](_0x1c4329);}return null;};}function patchUpdates(_0x15bf47){return function(_0x3d3a48){try{jsonpatch[_0x7ed3('0x1d')](_0x3d3a48,_0x15bf47,!![]);}catch(_0x50ab99){return BPromise['reject'](_0x50ab99);}return _0x3d3a48[_0x7ed3('0x1e')]();};}function saveUpdates(_0xebedf5,_0x569607){return function(_0x2e0f4e){if(_0x2e0f4e){return _0x2e0f4e['update'](_0xebedf5)[_0x7ed3('0x1f')](function(_0x54e5b7){return _0x54e5b7;});}return null;};}function removeEntity(_0x23c5a5,_0x206690){return function(_0x26482b){if(_0x26482b){return _0x26482b[_0x7ed3('0x20')]()[_0x7ed3('0x1f')](function(){var _0x4cc6a4=_0x26482b[_0x7ed3('0x21')]({'plain':!![]});var _0x5b3838=_0x7ed3('0x22');return db[_0x7ed3('0x23')]['destroy']({'where':{'type':_0x5b3838,'resourceId':_0x4cc6a4['id']}})['then'](function(){return _0x26482b;});})[_0x7ed3('0x1f')](function(){_0x23c5a5[_0x7ed3('0x15')](0xcc)[_0x7ed3('0x16')]();});}};}function handleEntityNotFound(_0x51c1e1,_0x55cbdb){return function(_0x52e9c3){if(!_0x52e9c3){_0x51c1e1[_0x7ed3('0x14')](0x194);}return _0x52e9c3;};}function handleError(_0x5d8ac9,_0x545f2e){_0x545f2e=_0x545f2e||0x1f4;return function(_0x1e1f48){logger[_0x7ed3('0x24')](_0x1e1f48[_0x7ed3('0x25')]);if(_0x1e1f48[_0x7ed3('0x26')]){delete _0x1e1f48[_0x7ed3('0x26')];}_0x5d8ac9[_0x7ed3('0x15')](_0x545f2e)[_0x7ed3('0x27')](_0x1e1f48);};}exports[_0x7ed3('0x28')]=function(_0x1d8828,_0x9fbeef){var _0x53d2c4={},_0x953daf={},_0x341564={'count':0x0,'rows':[]};var _0x68f040=_[_0x7ed3('0x29')](db[_0x7ed3('0x2a')][_0x7ed3('0x2b')],function(_0x44e5be){return{'name':_0x44e5be[_0x7ed3('0x2c')],'type':_0x44e5be['type'][_0x7ed3('0x2d')]};});_0x953daf['model']=_[_0x7ed3('0x29')](_0x68f040,_0x7ed3('0x26'));_0x953daf[_0x7ed3('0x2e')]=_[_0x7ed3('0x2f')](_0x1d8828[_0x7ed3('0x2e')]);_0x953daf[_0x7ed3('0x30')]=_[_0x7ed3('0x31')](_0x953daf[_0x7ed3('0x32')],_0x953daf[_0x7ed3('0x2e')]);_0x53d2c4[_0x7ed3('0x33')]=_[_0x7ed3('0x31')](_0x953daf[_0x7ed3('0x32')],qs[_0x7ed3('0x34')](_0x1d8828[_0x7ed3('0x2e')][_0x7ed3('0x34')]));_0x53d2c4['attributes']=_0x53d2c4['attributes'][_0x7ed3('0x35')]?_0x53d2c4[_0x7ed3('0x33')]:_0x953daf[_0x7ed3('0x32')];if(!_0x1d8828['query'][_0x7ed3('0x36')](_0x7ed3('0x37'))){_0x53d2c4[_0x7ed3('0x19')]=qs[_0x7ed3('0x19')](_0x1d8828[_0x7ed3('0x2e')]['limit']);_0x53d2c4[_0x7ed3('0x1b')]=qs[_0x7ed3('0x1b')](_0x1d8828[_0x7ed3('0x2e')][_0x7ed3('0x1b')]);}_0x53d2c4['order']=qs[_0x7ed3('0x38')](_0x1d8828[_0x7ed3('0x2e')][_0x7ed3('0x38')]);_0x53d2c4[_0x7ed3('0x39')]=qs[_0x7ed3('0x30')](_[_0x7ed3('0x3a')](_0x1d8828[_0x7ed3('0x2e')],_0x953daf[_0x7ed3('0x30')]),_0x68f040);if(_0x1d8828['query']['filter']){_0x53d2c4[_0x7ed3('0x39')]=_[_0x7ed3('0x3b')](_0x53d2c4[_0x7ed3('0x39')],{'$or':_[_0x7ed3('0x29')](_0x68f040,function(_0x1f4eaa){if(_0x1f4eaa['type']!=='VIRTUAL'){var _0x478934={};_0x478934[_0x1f4eaa[_0x7ed3('0x26')]]={'$like':'%'+_0x1d8828[_0x7ed3('0x2e')]['filter']+'%'};return _0x478934;}})});}_0x53d2c4=_[_0x7ed3('0x3b')]({},_0x53d2c4,_0x1d8828[_0x7ed3('0x3c')]);var _0x52950d={'where':_0x53d2c4[_0x7ed3('0x39')]};return db[_0x7ed3('0x2a')][_0x7ed3('0x1a')](_0x52950d)['then'](function(_0x43db51){_0x341564[_0x7ed3('0x1a')]=_0x43db51;if(_0x1d8828[_0x7ed3('0x2e')][_0x7ed3('0x3d')]){_0x53d2c4[_0x7ed3('0x3e')]=[{'all':!![]}];}return db[_0x7ed3('0x2a')][_0x7ed3('0x3f')](_0x53d2c4);})[_0x7ed3('0x1f')](function(_0x2fe75b){_0x341564[_0x7ed3('0x40')]=_0x2fe75b;return _0x341564;})[_0x7ed3('0x1f')](respondWithFilteredResult(_0x9fbeef,_0x53d2c4))[_0x7ed3('0x41')](handleError(_0x9fbeef,null));};exports[_0x7ed3('0x42')]=function(_0x347439,_0x4cb630){var _0x3b449e={'raw':!![],'where':{'id':_0x347439[_0x7ed3('0x43')]['id']}},_0x2f9a87={};_0x2f9a87[_0x7ed3('0x32')]=_[_0x7ed3('0x2f')](db[_0x7ed3('0x2a')][_0x7ed3('0x2b')]);_0x2f9a87[_0x7ed3('0x2e')]=_[_0x7ed3('0x2f')](_0x347439[_0x7ed3('0x2e')]);_0x2f9a87['filters']=_['intersection'](_0x2f9a87[_0x7ed3('0x32')],_0x2f9a87[_0x7ed3('0x2e')]);_0x3b449e[_0x7ed3('0x33')]=_[_0x7ed3('0x31')](_0x2f9a87['model'],qs[_0x7ed3('0x34')](_0x347439[_0x7ed3('0x2e')]['fields']));_0x3b449e[_0x7ed3('0x33')]=_0x3b449e[_0x7ed3('0x33')][_0x7ed3('0x35')]?_0x3b449e[_0x7ed3('0x33')]:_0x2f9a87[_0x7ed3('0x32')];if(_0x347439[_0x7ed3('0x2e')]['includeAll']){_0x3b449e[_0x7ed3('0x3e')]=[{'all':!![]}];}_0x3b449e=_[_0x7ed3('0x3b')]({},_0x3b449e,_0x347439[_0x7ed3('0x3c')]);return db['Variable'][_0x7ed3('0x44')](_0x3b449e)[_0x7ed3('0x1f')](handleEntityNotFound(_0x4cb630,null))[_0x7ed3('0x1f')](respondWithResult(_0x4cb630,null))[_0x7ed3('0x41')](handleError(_0x4cb630,null));};exports[_0x7ed3('0x45')]=function(_0x34688e,_0x340bd4){return db['Variable']['create'](_0x34688e[_0x7ed3('0x46')],{})['then'](function(_0x4ae644){var _0x5aab78=_0x34688e[_0x7ed3('0x47')][_0x7ed3('0x21')]({'plain':!![]});if(!_0x5aab78)throw new Error(_0x7ed3('0x48'));if(_0x5aab78[_0x7ed3('0x49')]===_0x7ed3('0x47')){var _0x56c211=_0x4ae644['get']({'plain':!![]});var _0x5c03aa=_0x7ed3('0x22');return db[_0x7ed3('0x4a')][_0x7ed3('0x44')]({'where':{'name':_0x5c03aa,'userProfileId':_0x5aab78[_0x7ed3('0x4b')]},'raw':!![]})[_0x7ed3('0x1f')](function(_0x32231e){if(_0x32231e&&_0x32231e[_0x7ed3('0x4c')]===0x0){return db[_0x7ed3('0x23')][_0x7ed3('0x45')]({'name':_0x56c211[_0x7ed3('0x26')],'resourceId':_0x56c211['id'],'type':_0x32231e[_0x7ed3('0x26')],'sectionId':_0x32231e['id']},{})[_0x7ed3('0x1f')](function(){return _0x4ae644;});}else{return _0x4ae644;}})[_0x7ed3('0x41')](function(_0x160575){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x160575);throw _0x160575;});}return _0x4ae644;})['then'](respondWithResult(_0x340bd4,0xc9))[_0x7ed3('0x41')](handleError(_0x340bd4,null));};exports[_0x7ed3('0x4d')]=function(_0x4bb52d,_0x5f2be8){if(_0x4bb52d[_0x7ed3('0x46')]['id']){delete _0x4bb52d[_0x7ed3('0x46')]['id'];}return db[_0x7ed3('0x2a')][_0x7ed3('0x44')]({'where':{'id':_0x4bb52d[_0x7ed3('0x43')]['id']}})[_0x7ed3('0x1f')](handleEntityNotFound(_0x5f2be8,null))[_0x7ed3('0x1f')](saveUpdates(_0x4bb52d[_0x7ed3('0x46')],null))[_0x7ed3('0x1f')](respondWithResult(_0x5f2be8,null))[_0x7ed3('0x41')](handleError(_0x5f2be8,null));};exports[_0x7ed3('0x20')]=function(_0x4d0751,_0x133d6b){return db[_0x7ed3('0x2a')][_0x7ed3('0x44')]({'where':{'id':_0x4d0751[_0x7ed3('0x43')]['id']}})[_0x7ed3('0x1f')](handleEntityNotFound(_0x133d6b,null))[_0x7ed3('0x1f')](removeEntity(_0x133d6b,null))[_0x7ed3('0x41')](handleError(_0x133d6b,null));}; \ No newline at end of file +var _0x984b=['fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x984b,0xb9));var _0xb984=function(_0x1c14f7,_0x5489bb){_0x1c14f7=_0x1c14f7-0x0;var _0x29e505=_0x984b[_0x1c14f7];return _0x29e505;};'use strict';var emlformat=require(_0xb984('0x0'));var rimraf=require(_0xb984('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb984('0x2'));var rp=require('request-promise');var moment=require(_0xb984('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb984('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb984('0x5'));var ejs=require(_0xb984('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb984('0x7'));var squel=require(_0xb984('0x8'));var crypto=require(_0xb984('0x9'));var jsforce=require(_0xb984('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb984('0x5'));var querystring=require('querystring');var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb984('0xe'));var hardwareService=require(_0xb984('0xf'));var logger=require(_0xb984('0x10'))(_0xb984('0x11'));var utils=require('../../config/utils');var config=require(_0xb984('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb984('0x13'))['db'];function respondWithStatusCode(_0x21268e,_0xa3380b){_0xa3380b=_0xa3380b||0xcc;return function(_0x3ae6c3){if(_0x3ae6c3){return _0x21268e[_0xb984('0x14')](_0xa3380b);}return _0x21268e[_0xb984('0x15')](_0xa3380b)[_0xb984('0x16')]();};}function respondWithResult(_0x32f75b,_0x3d19f2){_0x3d19f2=_0x3d19f2||0xc8;return function(_0x41ae6c){if(_0x41ae6c){return _0x32f75b['status'](_0x3d19f2)[_0xb984('0x17')](_0x41ae6c);}};}function respondWithFilteredResult(_0x5d3a01,_0x2797c9){return function(_0x1c5fc4){if(_0x1c5fc4){var _0x1af682=typeof _0x2797c9[_0xb984('0x18')]===_0xb984('0x19')&&typeof _0x2797c9[_0xb984('0x1a')]===_0xb984('0x19');var _0x339806=_0x1c5fc4[_0xb984('0x1b')];var _0x3f958a=_0x1af682?0x0:_0x2797c9[_0xb984('0x18')];var _0x2d1cdc=_0x1af682?_0x1c5fc4['count']:_0x2797c9[_0xb984('0x18')]+_0x2797c9[_0xb984('0x1a')];var _0x4ccd22;if(_0x2d1cdc>=_0x339806){_0x2d1cdc=_0x339806;_0x4ccd22=0xc8;}else{_0x4ccd22=0xce;}_0x5d3a01[_0xb984('0x15')](_0x4ccd22);return _0x5d3a01[_0xb984('0x1c')](_0xb984('0x1d'),_0x3f958a+'-'+_0x2d1cdc+'/'+_0x339806)[_0xb984('0x17')](_0x1c5fc4);}return null;};}function patchUpdates(_0x465099){return function(_0x1339cc){try{jsonpatch['apply'](_0x1339cc,_0x465099,!![]);}catch(_0x5efb46){return BPromise['reject'](_0x5efb46);}return _0x1339cc[_0xb984('0x1e')]();};}function saveUpdates(_0x1d6b80,_0xa744e5){return function(_0x43315f){if(_0x43315f){return _0x43315f[_0xb984('0x1f')](_0x1d6b80)['then'](function(_0x5ed241){return _0x5ed241;});}return null;};}function removeEntity(_0x471a06,_0x322155){return function(_0x333256){if(_0x333256){return _0x333256[_0xb984('0x20')]()[_0xb984('0x21')](function(){var _0x1c9d6c=_0x333256[_0xb984('0x22')]({'plain':!![]});var _0x5c9395=_0xb984('0x23');return db[_0xb984('0x24')][_0xb984('0x20')]({'where':{'type':_0x5c9395,'resourceId':_0x1c9d6c['id']}})[_0xb984('0x21')](function(){return _0x333256;});})[_0xb984('0x21')](function(){_0x471a06[_0xb984('0x15')](0xcc)[_0xb984('0x16')]();});}};}function handleEntityNotFound(_0x1444e3,_0x486b98){return function(_0x451d32){if(!_0x451d32){_0x1444e3[_0xb984('0x14')](0x194);}return _0x451d32;};}function handleError(_0x3a05f8,_0x200da8){_0x200da8=_0x200da8||0x1f4;return function(_0x428d37){logger['error'](_0x428d37[_0xb984('0x25')]);if(_0x428d37[_0xb984('0x26')]){delete _0x428d37[_0xb984('0x26')];}_0x3a05f8[_0xb984('0x15')](_0x200da8)[_0xb984('0x27')](_0x428d37);};}exports[_0xb984('0x28')]=function(_0x5c5638,_0x506109){var _0x1bc8da={},_0x50a14c={},_0x3d36b5={'count':0x0,'rows':[]};var _0x2eab8f=_[_0xb984('0x29')](db[_0xb984('0x2a')]['rawAttributes'],function(_0x5cfd8f){return{'name':_0x5cfd8f[_0xb984('0x2b')],'type':_0x5cfd8f[_0xb984('0x2c')][_0xb984('0x2d')]};});_0x50a14c[_0xb984('0x2e')]=_[_0xb984('0x29')](_0x2eab8f,'name');_0x50a14c[_0xb984('0x2f')]=_[_0xb984('0x30')](_0x5c5638[_0xb984('0x2f')]);_0x50a14c[_0xb984('0x31')]=_[_0xb984('0x32')](_0x50a14c[_0xb984('0x2e')],_0x50a14c[_0xb984('0x2f')]);_0x1bc8da[_0xb984('0x33')]=_[_0xb984('0x32')](_0x50a14c['model'],qs[_0xb984('0x34')](_0x5c5638[_0xb984('0x2f')][_0xb984('0x34')]));_0x1bc8da[_0xb984('0x33')]=_0x1bc8da[_0xb984('0x33')]['length']?_0x1bc8da[_0xb984('0x33')]:_0x50a14c[_0xb984('0x2e')];if(!_0x5c5638['query']['hasOwnProperty'](_0xb984('0x35'))){_0x1bc8da['limit']=qs[_0xb984('0x1a')](_0x5c5638[_0xb984('0x2f')][_0xb984('0x1a')]);_0x1bc8da[_0xb984('0x18')]=qs[_0xb984('0x18')](_0x5c5638[_0xb984('0x2f')][_0xb984('0x18')]);}_0x1bc8da[_0xb984('0x36')]=qs['sort'](_0x5c5638[_0xb984('0x2f')][_0xb984('0x37')]);_0x1bc8da['where']=qs[_0xb984('0x31')](_[_0xb984('0x38')](_0x5c5638[_0xb984('0x2f')],_0x50a14c[_0xb984('0x31')]),_0x2eab8f);if(_0x5c5638[_0xb984('0x2f')][_0xb984('0x39')]){_0x1bc8da[_0xb984('0x3a')]=_['merge'](_0x1bc8da['where'],{'$or':_[_0xb984('0x29')](_0x2eab8f,function(_0x360d80){if(_0x360d80['type']!==_0xb984('0x3b')){var _0x36847e={};_0x36847e[_0x360d80[_0xb984('0x26')]]={'$like':'%'+_0x5c5638[_0xb984('0x2f')]['filter']+'%'};return _0x36847e;}})});}_0x1bc8da=_[_0xb984('0x3c')]({},_0x1bc8da,_0x5c5638[_0xb984('0x3d')]);var _0x37d04d={'where':_0x1bc8da[_0xb984('0x3a')]};return db[_0xb984('0x2a')][_0xb984('0x1b')](_0x37d04d)[_0xb984('0x21')](function(_0x12dbc9){_0x3d36b5['count']=_0x12dbc9;if(_0x5c5638[_0xb984('0x2f')][_0xb984('0x3e')]){_0x1bc8da[_0xb984('0x3f')]=[{'all':!![]}];}return db['Variable'][_0xb984('0x40')](_0x1bc8da);})['then'](function(_0x37e715){_0x3d36b5[_0xb984('0x41')]=_0x37e715;return _0x3d36b5;})[_0xb984('0x21')](respondWithFilteredResult(_0x506109,_0x1bc8da))[_0xb984('0x42')](handleError(_0x506109,null));};exports[_0xb984('0x43')]=function(_0x4df0db,_0x20a9c1){var _0x2c28ce={'raw':!![],'where':{'id':_0x4df0db[_0xb984('0x44')]['id']}},_0x23686c={};_0x23686c[_0xb984('0x2e')]=_[_0xb984('0x30')](db[_0xb984('0x2a')]['rawAttributes']);_0x23686c['query']=_['keys'](_0x4df0db[_0xb984('0x2f')]);_0x23686c[_0xb984('0x31')]=_[_0xb984('0x32')](_0x23686c[_0xb984('0x2e')],_0x23686c['query']);_0x2c28ce[_0xb984('0x33')]=_[_0xb984('0x32')](_0x23686c['model'],qs[_0xb984('0x34')](_0x4df0db[_0xb984('0x2f')][_0xb984('0x34')]));_0x2c28ce[_0xb984('0x33')]=_0x2c28ce[_0xb984('0x33')]['length']?_0x2c28ce[_0xb984('0x33')]:_0x23686c[_0xb984('0x2e')];if(_0x4df0db[_0xb984('0x2f')][_0xb984('0x3e')]){_0x2c28ce[_0xb984('0x3f')]=[{'all':!![]}];}_0x2c28ce=_[_0xb984('0x3c')]({},_0x2c28ce,_0x4df0db[_0xb984('0x3d')]);return db[_0xb984('0x2a')][_0xb984('0x45')](_0x2c28ce)[_0xb984('0x21')](handleEntityNotFound(_0x20a9c1,null))['then'](respondWithResult(_0x20a9c1,null))[_0xb984('0x42')](handleError(_0x20a9c1,null));};exports['create']=function(_0x4ef774,_0x2fe0e6){return db[_0xb984('0x2a')]['create'](_0x4ef774[_0xb984('0x46')],{})[_0xb984('0x21')](function(_0x2c29b1){var _0x10df4=_0x4ef774[_0xb984('0x47')][_0xb984('0x22')]({'plain':!![]});if(!_0x10df4)throw new Error(_0xb984('0x48'));if(_0x10df4[_0xb984('0x49')]==='user'){var _0x17faca=_0x2c29b1['get']({'plain':!![]});var _0x4f1ada='Variables';return db[_0xb984('0x4a')][_0xb984('0x45')]({'where':{'name':_0x4f1ada,'userProfileId':_0x10df4[_0xb984('0x4b')]},'raw':!![]})[_0xb984('0x21')](function(_0x130df8){if(_0x130df8&&_0x130df8[_0xb984('0x4c')]===0x0){return db[_0xb984('0x24')]['create']({'name':_0x17faca[_0xb984('0x26')],'resourceId':_0x17faca['id'],'type':_0x130df8['name'],'sectionId':_0x130df8['id']},{})['then'](function(){return _0x2c29b1;});}else{return _0x2c29b1;}})['catch'](function(_0x47e080){logger[_0xb984('0x4d')](_0xb984('0x4e'),_0x47e080);throw _0x47e080;});}return _0x2c29b1;})[_0xb984('0x21')](respondWithResult(_0x2fe0e6,0xc9))[_0xb984('0x42')](handleError(_0x2fe0e6,null));};exports[_0xb984('0x1f')]=function(_0x4399df,_0x26eb84){if(_0x4399df[_0xb984('0x46')]['id']){delete _0x4399df[_0xb984('0x46')]['id'];}return db[_0xb984('0x2a')][_0xb984('0x45')]({'where':{'id':_0x4399df[_0xb984('0x44')]['id']}})[_0xb984('0x21')](handleEntityNotFound(_0x26eb84,null))[_0xb984('0x21')](saveUpdates(_0x4399df[_0xb984('0x46')],null))[_0xb984('0x21')](respondWithResult(_0x26eb84,null))['catch'](handleError(_0x26eb84,null));};exports[_0xb984('0x20')]=function(_0x499270,_0x82758f){return db[_0xb984('0x2a')][_0xb984('0x45')]({'where':{'id':_0x499270[_0xb984('0x44')]['id']}})[_0xb984('0x21')](handleEntityNotFound(_0x82758f,null))[_0xb984('0x21')](removeEntity(_0x82758f,null))[_0xb984('0x42')](handleError(_0x82758f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4d49ebd..bb4e747 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 _0xdab9=['api','bluebird','path','../../config/environment','exports','Variable','util','../../config/logger'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xdab9,0xfe));var _0x9dab=function(_0x3087c1,_0x4f387d){_0x3087c1=_0x3087c1-0x0;var _0x1353b9=_0xdab9[_0x3087c1];return _0x1353b9;};'use strict';var _=require('lodash');var util=require(_0x9dab('0x0'));var logger=require(_0x9dab('0x1'))(_0x9dab('0x2'));var moment=require('moment');var BPromise=require(_0x9dab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dab('0x4'));var rimraf=require('rimraf');var config=require(_0x9dab('0x5'));var attributes=require('./variable.attributes');module[_0x9dab('0x6')]=function(_0x40fa80,_0x82db7){return _0x40fa80['define'](_0x9dab('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69a2=['tools_variables','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x36f20f,_0x3558ab){var _0x39334c=function(_0x7c80c){while(--_0x7c80c){_0x36f20f['push'](_0x36f20f['shift']());}};_0x39334c(++_0x3558ab);}(_0x69a2,0x1a1));var _0x269a=function(_0x491188,_0x473223){_0x491188=_0x491188-0x0;var _0x30310a=_0x69a2[_0x491188];return _0x30310a;};'use strict';var _=require(_0x269a('0x0'));var util=require('util');var logger=require(_0x269a('0x1'))(_0x269a('0x2'));var moment=require(_0x269a('0x3'));var BPromise=require(_0x269a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x269a('0x5'));var rimraf=require(_0x269a('0x6'));var config=require(_0x269a('0x7'));var attributes=require(_0x269a('0x8'));module[_0x269a('0x9')]=function(_0x20f512,_0x592a71){return _0x20f512[_0x269a('0xa')](_0x269a('0xb'),attributes,{'tableName':_0x269a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 78b0bd2..2d2bce8 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x15ed9f,_0x1dd70f){var _0x565e05=function(_0x4ca0dc){while(--_0x4ca0dc){_0x15ed9f['push'](_0x15ed9f['shift']());}};_0x565e05(++_0x1dd70f);}(_0xe14b,0x93));var _0xbe14=function(_0x1c29e4,_0x17525e){_0x1c29e4=_0x1c29e4-0x0;var _0x14a658=_0xe14b[_0x1c29e4];return _0x14a658;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x4d9a48,_0x20bc50){var _0xef464d=function(_0x30e968){while(--_0x30e968){_0x4d9a48['push'](_0x4d9a48['shift']());}};_0xef464d(++_0x20bc50);}(_0x1cb9,0x14e));var _0x91cb=function(_0x266834,_0x3d5f49){_0x266834=_0x266834-0x0;var _0x5834c7=_0x1cb9[_0x266834];return _0x5834c7;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 01f6f2c..eec096d 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 _0xbdc8=['/pull','pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','reset'];(function(_0x427198,_0x212994){var _0x486b35=function(_0x29d03d){while(--_0x29d03d){_0x427198['push'](_0x427198['shift']());}};_0x486b35(++_0x212994);}(_0xbdc8,0x1c0));var _0x8bdc=function(_0x4b142f,_0x42cf82){_0x4b142f=_0x4b142f-0x0;var _0x2c2628=_0xbdc8[_0x4b142f];return _0x2c2628;};'use strict';var express=require('express');var router=express[_0x8bdc('0x0')]();var auth=require(_0x8bdc('0x1'));var controller=require(_0x8bdc('0x2'));router[_0x8bdc('0x3')]('/',controller['index']);router[_0x8bdc('0x3')]('/fetch',auth[_0x8bdc('0x4')](),auth[_0x8bdc('0x5')](),controller['fetch']);router[_0x8bdc('0x3')]('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x8bdc('0x6')]);router[_0x8bdc('0x3')](_0x8bdc('0x7'),auth['isAuthenticated'](),auth[_0x8bdc('0x5')](),controller[_0x8bdc('0x8')]);router[_0x8bdc('0x3')](_0x8bdc('0x9'),auth[_0x8bdc('0x4')](),controller[_0x8bdc('0xa')]);router['get'](_0x8bdc('0xb'),controller['migrations']);module[_0x8bdc('0xc')]=router; \ No newline at end of file +var _0xec19=['/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','restart','exports','express','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xec19,0x1bc));var _0x9ec1=function(_0x35e931,_0x1b2c90){_0x35e931=_0x35e931-0x0;var _0x4fe0ad=_0xec19[_0x35e931];return _0x4fe0ad;};'use strict';var express=require(_0x9ec1('0x0'));var router=express[_0x9ec1('0x1')]();var auth=require(_0x9ec1('0x2'));var controller=require(_0x9ec1('0x3'));router[_0x9ec1('0x4')]('/',controller[_0x9ec1('0x5')]);router[_0x9ec1('0x4')](_0x9ec1('0x6'),auth[_0x9ec1('0x7')](),auth['canUpdate'](),controller[_0x9ec1('0x8')]);router[_0x9ec1('0x4')]('/reset',auth[_0x9ec1('0x7')](),auth[_0x9ec1('0x9')](),controller[_0x9ec1('0xa')]);router['get'](_0x9ec1('0xb'),auth[_0x9ec1('0x7')](),auth[_0x9ec1('0x9')](),controller[_0x9ec1('0xc')]);router['get']('/restart',auth[_0x9ec1('0x7')](),controller[_0x9ec1('0xd')]);router[_0x9ec1('0x4')]('/migrations',controller['migrations']);module[_0x9ec1('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 74c803c..a1a72d8 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 _0x93b1=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','update','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x2093d2,_0x493e6c){var _0x3960e8=function(_0x3beb96){while(--_0x3beb96){_0x2093d2['push'](_0x2093d2['shift']());}};_0x3960e8(++_0x493e6c);}(_0x93b1,0x16c));var _0x193b=function(_0x124bf2,_0x1e0919){_0x124bf2=_0x124bf2-0x0;var _0x197fc2=_0x93b1[_0x124bf2];return _0x197fc2;};'use strict';var Umzug=require(_0x193b('0x0'));var path=require(_0x193b('0x1'));var fs=require('fs');var _=require(_0x193b('0x2'));var pkginfo=require(_0x193b('0x3'))(module,'version');var compareVersions=require(_0x193b('0x4'));var exec=require('child_process')[_0x193b('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x193b('0x6'));var pm2=require(_0x193b('0x7'));var logger=require(_0x193b('0x8'))(_0x193b('0x9'));var git=require('simple-git')(config['root']);exports[_0x193b('0xa')]=function(_0x306880,_0x47a536){var _0x29cba0={'current':module[_0x193b('0xb')]['version'],'phonebar':0x2};if(_0x306880[_0x193b('0xc')]&&_0x306880[_0x193b('0xc')][_0x193b('0xd')]){return git[_0x193b('0xe')]()['tags'](function(_0xeab9d8,_0xfc1123){_0x29cba0['latest']=(_0xeab9d8?module[_0x193b('0xb')]['version']:_0xfc1123[_0x193b('0xd')])||_0x193b('0xf');return _0x47a536[_0x193b('0x10')](0xc8)[_0x193b('0x11')](_0x29cba0);});}else{return _0x47a536[_0x193b('0x10')](0xc8)['json'](_0x29cba0);}};exports['fetch']=function(_0x325470,_0x527c71){return git[_0x193b('0xe')]([_0x193b('0x12'),_0x193b('0x13')],function(_0x32520c){if(_0x32520c){logger['error'](_0x32520c);return _0x527c71[_0x193b('0x10')](0x1f4)[_0x193b('0x11')](_0x32520c);}logger[_0x193b('0x14')](_0x193b('0x15'));return _0x527c71[_0x193b('0x10')](0xc8)[_0x193b('0x11')]({'output':_0x193b('0x16')});});};exports[_0x193b('0x17')]=function(_0x5af87b,_0x363f2f){return git['reset']([_0x193b('0x18'),_0x193b('0x19')],function(_0x27bf37){if(_0x27bf37){logger[_0x193b('0x1a')](_0x27bf37);return _0x363f2f[_0x193b('0x10')](0x1f4)[_0x193b('0x11')](_0x27bf37);}logger[_0x193b('0x14')](_0x193b('0x1b'));return _0x363f2f[_0x193b('0x10')](0xc8)[_0x193b('0x11')]({'output':_0x193b('0x1c')});});};exports[_0x193b('0x1d')]=function(_0x541ffb,_0x353331){exec(_0x193b('0x1e'),function(_0x5caf4f,_0x2965e0,_0x304ed1){logger[_0x193b('0x14')](_0x2965e0);logger['info'](_0x304ed1);if(_0x5caf4f){logger['error'](_0x5caf4f);return _0x353331[_0x193b('0x10')](0x1f4)['json'](_0x5caf4f);}return _0x353331['status'](0xc8)[_0x193b('0x11')]({'output':_0x2965e0});});};exports[_0x193b('0x1f')]=function(_0x301c50,_0x2cf3e3){return pm2[_0x193b('0x1f')](_0x193b('0x20'))[_0x193b('0x21')](function(_0x520ca6){logger[_0x193b('0x14')](_0x193b('0x22'),_0x520ca6);return _0x2cf3e3[_0x193b('0x10')](0xc8)['json']({'output':_0x193b('0x23')});})[_0x193b('0x24')](function(_0x21e2a1){logger[_0x193b('0x1a')](_0x21e2a1);return _0x2cf3e3[_0x193b('0x10')](0x1f4)[_0x193b('0x11')](_0x21e2a1);});};exports[_0x193b('0x25')]=function(_0x5ee738,_0x323f15){var _0x2faab5=fs[_0x193b('0x26')](path[_0x193b('0x27')](config['root'],_0x193b('0x28'),'migrations'));var _0x765878=[];for(var _0x1d75dd=0x0;_0x1d75dd<_0x2faab5[_0x193b('0x29')];_0x1d75dd++){var _0x2dac7e=_0x2faab5[_0x1d75dd][_0x193b('0x2a')]('.js','');if(compareVersions(module[_0x193b('0xb')]['version'],_0x2dac7e)===-0x1){_0x765878[_0x193b('0x2b')](_0x2dac7e);}}if(_0x765878['length']){var _0x16f88f=_0x765878[_0x193b('0x2c')](compareVersions);var _0x5724aa=new Umzug({'storage':_0x193b('0x2d'),'storageOptions':{'model':db[_0x193b('0x2e')],'modelName':_0x193b('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0x193b('0x2d')][_0x193b('0x2f')](),db[_0x193b('0x2d')][_0x193b('0x30')],function(){throw new Error(_0x193b('0x31'));}],'path':path[_0x193b('0x27')](config['root'],_0x193b('0x28'),_0x193b('0x25')),'pattern':/\.js$/}});_0x5724aa['up']({'migrations':_[_0x193b('0x32')](_0x16f88f,function(_0x4d1dd3){return _0x4d1dd3+_0x193b('0x33');})})[_0x193b('0x21')](function(){return _0x323f15[_0x193b('0x10')](0xc8)[_0x193b('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x193b('0xb')]['version']+_0x193b('0x34')+_[_0x193b('0x35')](_0x16f88f),'migrations':_['join'](_0x16f88f)});})[_0x193b('0x24')](function(_0x295fd7){if(_0x295fd7 instanceof db[_0x193b('0x2d')][_0x193b('0x36')]){return _0x323f15[_0x193b('0x10')](0xc8)[_0x193b('0x11')]({'output':_0x193b('0x37')});}else{return _0x323f15['status'](0x1f4)['json'](_0x295fd7);}});}else{return _0x323f15['status'](0xc8)[_0x193b('0x11')]({'output':_0x193b('0x37')});}}; \ No newline at end of file +var _0x7b9e=['../../config/logger','simple-git','root','index','exports','query','tags','version','2.0.0','status','json','fetch','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','../../mysqldb','../../config/environment','../../config/pm2'];(function(_0xe2b8fc,_0x3ec76a){var _0x1bfefb=function(_0x11e1ec){while(--_0x11e1ec){_0xe2b8fc['push'](_0xe2b8fc['shift']());}};_0x1bfefb(++_0x3ec76a);}(_0x7b9e,0x10c));var _0xe7b9=function(_0xac9995,_0x28da64){_0xac9995=_0xac9995-0x0;var _0x369a26=_0x7b9e[_0xac9995];return _0x369a26;};'use strict';var Umzug=require(_0xe7b9('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe7b9('0x1'));var pkginfo=require(_0xe7b9('0x2'))(module,'version');var compareVersions=require(_0xe7b9('0x3'));var exec=require('child_process')['exec'];var db=require(_0xe7b9('0x4'))['db'];var config=require(_0xe7b9('0x5'));var pm2=require(_0xe7b9('0x6'));var logger=require(_0xe7b9('0x7'))('update');var git=require(_0xe7b9('0x8'))(config[_0xe7b9('0x9')]);exports[_0xe7b9('0xa')]=function(_0x4c193d,_0xe48f3f){var _0x51c09d={'current':module[_0xe7b9('0xb')]['version'],'phonebar':0x2};if(_0x4c193d[_0xe7b9('0xc')]&&_0x4c193d[_0xe7b9('0xc')]['latest']){return git['fetch']()[_0xe7b9('0xd')](function(_0x2d8b3e,_0x1b7d65){_0x51c09d['latest']=(_0x2d8b3e?module[_0xe7b9('0xb')][_0xe7b9('0xe')]:_0x1b7d65['latest'])||_0xe7b9('0xf');return _0xe48f3f[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')](_0x51c09d);});}else{return _0xe48f3f['status'](0xc8)[_0xe7b9('0x11')](_0x51c09d);}};exports[_0xe7b9('0x12')]=function(_0x2a86ae,_0x456093){return git[_0xe7b9('0x12')](['origin',_0xe7b9('0x13')],function(_0x509121){if(_0x509121){logger[_0xe7b9('0x14')](_0x509121);return _0x456093[_0xe7b9('0x10')](0x1f4)[_0xe7b9('0x11')](_0x509121);}logger['info'](_0xe7b9('0x15'));return _0x456093['status'](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x16')});});};exports[_0xe7b9('0x17')]=function(_0x422602,_0x4d442f){return git[_0xe7b9('0x17')]([_0xe7b9('0x18'),_0xe7b9('0x19')],function(_0x2ba0f7){if(_0x2ba0f7){logger['error'](_0x2ba0f7);return _0x4d442f[_0xe7b9('0x10')](0x1f4)[_0xe7b9('0x11')](_0x2ba0f7);}logger[_0xe7b9('0x1a')](_0xe7b9('0x1b'));return _0x4d442f[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x1c')});});};exports[_0xe7b9('0x1d')]=function(_0x381285,_0x49ea87){exec(_0xe7b9('0x1e'),function(_0x55d641,_0x4a5bc4,_0x16163b){logger['info'](_0x4a5bc4);logger['info'](_0x16163b);if(_0x55d641){logger[_0xe7b9('0x14')](_0x55d641);return _0x49ea87['status'](0x1f4)[_0xe7b9('0x11')](_0x55d641);}return _0x49ea87[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0x4a5bc4});});};exports[_0xe7b9('0x1f')]=function(_0x5715c0,_0xf6b4aa){return pm2[_0xe7b9('0x1f')](_0xe7b9('0x20'))[_0xe7b9('0x21')](function(_0xccf68d){logger[_0xe7b9('0x1a')](_0xe7b9('0x22'),_0xccf68d);return _0xf6b4aa[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x23')});})[_0xe7b9('0x24')](function(_0x506917){logger['error'](_0x506917);return _0xf6b4aa[_0xe7b9('0x10')](0x1f4)[_0xe7b9('0x11')](_0x506917);});};exports[_0xe7b9('0x25')]=function(_0x2ebe55,_0x22ecb2){var _0x20464c=fs['readdirSync'](path[_0xe7b9('0x26')](config[_0xe7b9('0x9')],'server',_0xe7b9('0x25')));var _0x3ca1dd=[];for(var _0x1134e8=0x0;_0x1134e8<_0x20464c[_0xe7b9('0x27')];_0x1134e8++){var _0x25b982=_0x20464c[_0x1134e8][_0xe7b9('0x28')](_0xe7b9('0x29'),'');if(compareVersions(module[_0xe7b9('0xb')][_0xe7b9('0xe')],_0x25b982)===-0x1){_0x3ca1dd['push'](_0x25b982);}}if(_0x3ca1dd[_0xe7b9('0x27')]){var _0xeb349f=_0x3ca1dd[_0xe7b9('0x2a')](compareVersions);var _0x5b54ec=new Umzug({'storage':_0xe7b9('0x2b'),'storageOptions':{'model':db[_0xe7b9('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xe7b9('0x2b')][_0xe7b9('0x2d')](),db[_0xe7b9('0x2b')][_0xe7b9('0x2e')],function(){throw new Error(_0xe7b9('0x2f'));}],'path':path[_0xe7b9('0x26')](config[_0xe7b9('0x9')],_0xe7b9('0x30'),'migrations'),'pattern':/\.js$/}});_0x5b54ec['up']({'migrations':_[_0xe7b9('0x31')](_0xeb349f,function(_0x34a4e4){return _0x34a4e4+_0xe7b9('0x29');})})[_0xe7b9('0x21')](function(){return _0x22ecb2['status'](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x32')+module[_0xe7b9('0xb')]['version']+_0xe7b9('0x33')+_[_0xe7b9('0x34')](_0xeb349f),'migrations':_[_0xe7b9('0x26')](_0xeb349f)});})[_0xe7b9('0x24')](function(_0x310a56){if(_0x310a56 instanceof db[_0xe7b9('0x2b')][_0xe7b9('0x35')]){return _0x22ecb2[_0xe7b9('0x10')](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x36')});}else{return _0x22ecb2['status'](0x1f4)[_0xe7b9('0x11')](_0x310a56);}});}else{return _0x22ecb2['status'](0xc8)[_0xe7b9('0x11')]({'output':_0xe7b9('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 6375c12..fce0c1b 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 _0xe564=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path'];(function(_0x5baa06,_0x38c5cb){var _0x2e23b3=function(_0x50a5bc){while(--_0x50a5bc){_0x5baa06['push'](_0x5baa06['shift']());}};_0x2e23b3(++_0x38c5cb);}(_0xe564,0x1a1));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e56('0x0'));var util=require(_0x4e56('0x1'));var path=require(_0x4e56('0x2'));var timeout=require(_0x4e56('0x3'));var express=require('express');var router=express[_0x4e56('0x4')]();var fs_extra=require(_0x4e56('0x5'));var auth=require(_0x4e56('0x6'));var interaction=require(_0x4e56('0x7'));var config=require('../../config/environment');var controller=require(_0x4e56('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e56('0x9')]);router[_0x4e56('0xa')]('/describe',auth[_0x4e56('0xb')](),controller[_0x4e56('0xc')]);router[_0x4e56('0xa')](_0x4e56('0xd'),auth[_0x4e56('0xb')](),controller[_0x4e56('0xe')]);router[_0x4e56('0xf')]('/',auth[_0x4e56('0xb')](),controller[_0x4e56('0x10')]);router['put'](_0x4e56('0xd'),auth[_0x4e56('0xb')](),controller['update']);router[_0x4e56('0x11')](_0x4e56('0xd'),auth[_0x4e56('0xb')](),controller[_0x4e56('0x12')]);module[_0x4e56('0x13')]=router; \ No newline at end of file +var _0xb191=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xb191,0x1d8));var _0x1b19=function(_0x3fc761,_0x1f657e){_0x3fc761=_0x3fc761-0x0;var _0x2e4f45=_0xb191[_0x3fc761];return _0x2e4f45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b19('0x0'));var timeout=require(_0x1b19('0x1'));var express=require(_0x1b19('0x2'));var router=express[_0x1b19('0x3')]();var fs_extra=require(_0x1b19('0x4'));var auth=require(_0x1b19('0x5'));var interaction=require(_0x1b19('0x6'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x1b19('0x7')]('/',auth[_0x1b19('0x8')](),controller['index']);router[_0x1b19('0x7')](_0x1b19('0x9'),auth['isAuthenticated'](),controller[_0x1b19('0xa')]);router[_0x1b19('0x7')]('/:id',auth[_0x1b19('0x8')](),controller[_0x1b19('0xb')]);router[_0x1b19('0xc')]('/',auth[_0x1b19('0x8')](),controller['create']);router[_0x1b19('0xd')]('/:id',auth[_0x1b19('0x8')](),controller[_0x1b19('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1b19('0xf')]);module[_0x1b19('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0a8aceb..0b9424d 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 _0x2b65=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x12dd63,_0xa8901){var _0x1887e3=function(_0x55b035){while(--_0x55b035){_0x12dd63['push'](_0x12dd63['shift']());}};_0x1887e3(++_0xa8901);}(_0x2b65,0x131));var _0x52b6=function(_0x2f2ff5,_0x352b1c){_0x2f2ff5=_0x2f2ff5-0x0;var _0x1df50c=_0x2b65[_0x2f2ff5];return _0x1df50c;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'type':{'type':Sequelize[_0x52b6('0x2')]},'uniqueid':{'type':Sequelize[_0x52b6('0x2')]},'calleridnum':{'type':Sequelize[_0x52b6('0x2')]},'calleridname':{'type':Sequelize[_0x52b6('0x2')]},'queue':{'type':Sequelize[_0x52b6('0x2')]},'interface':{'type':Sequelize[_0x52b6('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x52b6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x52b6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x52b6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x52b6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x52b6('0x3')]},'holdtime':{'type':Sequelize[_0x52b6('0x4')]},'agentcomplete':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x52b6('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x52b6('0x4')]},'reason':{'type':Sequelize[_0x52b6('0x2')]},'lastevent':{'type':Sequelize[_0x52b6('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x52b6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x52b6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x52b6('0x2')]},'connectedlinename':{'type':Sequelize[_0x52b6('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x52b6('0x2')]},'context':{'type':Sequelize[_0x52b6('0x2')]},'exten':{'type':Sequelize[_0x52b6('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x52b6('0x2')]},'destchannelstate':{'type':Sequelize[_0x52b6('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x52b6('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x52b6('0x2')]},'destlanguage':{'type':Sequelize[_0x52b6('0x2')]},'destaccountcode':{'type':Sequelize[_0x52b6('0x2')]},'destcontext':{'type':Sequelize[_0x52b6('0x2')]},'destexten':{'type':Sequelize[_0x52b6('0x2')]},'destpriority':{'type':Sequelize[_0x52b6('0x2')]},'destuniqueid':{'type':Sequelize[_0x52b6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x52b6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x52b6('0x2')]},'transfer':{'type':Sequelize[_0x52b6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x52b6('0x2')],'comment':_0x52b6('0x6')},'transferexten':{'type':Sequelize[_0x52b6('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x52b6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3609=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x212462,_0x2bb92c){var _0x47a35d=function(_0x9513dd){while(--_0x9513dd){_0x212462['push'](_0x212462['shift']());}};_0x47a35d(++_0x2bb92c);}(_0x3609,0x101));var _0x9360=function(_0x48d5ec,_0x30a089){_0x48d5ec=_0x48d5ec-0x0;var _0x3a4414=_0x3609[_0x48d5ec];return _0x3a4414;};'use strict';var Sequelize=require(_0x9360('0x0'));module[_0x9360('0x1')]={'type':{'type':Sequelize[_0x9360('0x2')]},'uniqueid':{'type':Sequelize[_0x9360('0x2')]},'calleridnum':{'type':Sequelize[_0x9360('0x2')]},'calleridname':{'type':Sequelize[_0x9360('0x2')]},'queue':{'type':Sequelize[_0x9360('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9360('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9360('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9360('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x9360('0x4')]},'agentcomplete':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9360('0x4')]},'agentacw':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9360('0x4')]},'reason':{'type':Sequelize[_0x9360('0x2')]},'lastevent':{'type':Sequelize[_0x9360('0x2')]},'channel':{'type':Sequelize[_0x9360('0x2')]},'channelstate':{'type':Sequelize[_0x9360('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9360('0x2')]},'language':{'type':Sequelize[_0x9360('0x2')]},'accountcode':{'type':Sequelize[_0x9360('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9360('0x2')]},'priority':{'type':Sequelize[_0x9360('0x2')]},'destchannel':{'type':Sequelize[_0x9360('0x2')]},'destchannelstate':{'type':Sequelize[_0x9360('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x9360('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9360('0x2')]},'destcalleridname':{'type':Sequelize[_0x9360('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9360('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9360('0x2')]},'destexten':{'type':Sequelize[_0x9360('0x2')]},'destpriority':{'type':Sequelize[_0x9360('0x2')]},'destuniqueid':{'type':Sequelize[_0x9360('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x9360('0x2')]},'transfer':{'type':Sequelize[_0x9360('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9360('0x2')],'comment':_0x9360('0x6')},'transferexten':{'type':Sequelize[_0x9360('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9360('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 37cf0ed..cbc5aef 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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 188da31..6dc538d 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 _0xe14b=['bluebird','path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','lodash','util','moment'];(function(_0x5d32ad,_0x480eca){var _0x31b86e=function(_0x2c199c){while(--_0x2c199c){_0x5d32ad['push'](_0x5d32ad['shift']());}};_0x31b86e(++_0x480eca);}(_0xe14b,0x93));var _0xbe14=function(_0x173e74,_0x5cd27c){_0x173e74=_0x173e74-0x0;var _0x41dbc9=_0xe14b[_0x173e74];return _0x41dbc9;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x99c9=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x6adec3,_0x3d264a){var _0xf68ec2=function(_0x54a2c1){while(--_0x54a2c1){_0x6adec3['push'](_0x6adec3['shift']());}};_0xf68ec2(++_0x3d264a);}(_0x99c9,0x13c));var _0x999c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x99c9[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require(_0x999c('0x5'));var rp=require(_0x999c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var attributes=require(_0x999c('0x9'));module[_0x999c('0xa')]=function(_0x2bdd73,_0x14df32){return _0x2bdd73[_0x999c('0xb')](_0x999c('0xc'),attributes,{'tableName':_0x999c('0xd'),'paranoid':![],'indexes':[{'fields':[_0x999c('0xe'),_0x999c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5d30b07..3455e4c 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 _0x95aa=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','then','info','CreateVoiceAgentReport','catch','UpdateVoiceAgentReport','update','raw','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x95aa,0x1d3));var _0xa95a=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x95aa[_0x12aaee];return _0x37c350;};'use strict';var _=require(_0xa95a('0x0'));var util=require(_0xa95a('0x1'));var moment=require(_0xa95a('0x2'));var BPromise=require(_0xa95a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa95a('0x4'));var db=require(_0xa95a('0x5'))['db'];var utils=require(_0xa95a('0x6'));var logger=require(_0xa95a('0x7'))('rpc');var config=require(_0xa95a('0x8'));var jayson=require(_0xa95a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6489d5,_0x16df46,_0x3e87f2){return new BPromise(function(_0x5e9e34,_0x5a2081){return client['request'](_0x6489d5,_0x3e87f2)['then'](function(_0x494cf7){logger['info'](_0xa95a('0xa'),_0x16df46,_0xa95a('0xb'));logger[_0xa95a('0xc')](_0xa95a('0xd'),_0x16df46,'request\x20sent',JSON[_0xa95a('0xe')](_0x494cf7));if(_0x494cf7['error']){if(_0x494cf7[_0xa95a('0xf')][_0xa95a('0x10')]===0x1f4){logger['error'](_0xa95a('0xa'),_0x16df46,_0x494cf7[_0xa95a('0xf')][_0xa95a('0x11')]);return _0x5a2081(_0x494cf7[_0xa95a('0xf')][_0xa95a('0x11')]);}logger[_0xa95a('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x16df46,_0x494cf7[_0xa95a('0xf')][_0xa95a('0x11')]);return _0x5e9e34(_0x494cf7[_0xa95a('0xf')][_0xa95a('0x11')]);}else{logger['info'](_0xa95a('0xa'),_0x16df46,_0xa95a('0xb'));_0x5e9e34(_0x494cf7[_0xa95a('0x12')][_0xa95a('0x11')]);}})['catch'](function(_0x367b20){logger[_0xa95a('0xf')](_0xa95a('0xa'),_0x16df46,_0x367b20);_0x5a2081(_0x367b20);});});}exports['CreateVoiceAgentReport']=function(_0x15be2d){var _0x1fc966=this;return new Promise(function(_0x302dfc,_0x22f246){return db['VoiceAgentReport'][_0xa95a('0x13')](_0x15be2d[_0xa95a('0x14')],{'raw':_0x15be2d[_0xa95a('0x15')]?_0x15be2d[_0xa95a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xa95a('0x16')](function(_0x350669){logger[_0xa95a('0x17')](_0xa95a('0x18'),_0x15be2d);logger[_0xa95a('0xc')]('CreateVoiceAgentReport',_0x15be2d,JSON[_0xa95a('0xe')](_0x350669));_0x302dfc(_0x350669);})[_0xa95a('0x19')](function(_0xeadbfa){logger[_0xa95a('0xf')](_0xa95a('0x18'),_0xeadbfa[_0xa95a('0x11')],_0x15be2d);_0x22f246(_0x1fc966[_0xa95a('0xf')](0x1f4,_0xeadbfa[_0xa95a('0x11')]));});});};exports[_0xa95a('0x1a')]=function(_0x1f4837){var _0x138f40=this;return new Promise(function(_0x242e13,_0xa51806){return db['VoiceAgentReport'][_0xa95a('0x1b')](_0x1f4837[_0xa95a('0x14')],{'raw':_0x1f4837[_0xa95a('0x15')]?_0x1f4837[_0xa95a('0x15')][_0xa95a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4837[_0xa95a('0x15')]?_0x1f4837[_0xa95a('0x15')]['where']||null:null,'attributes':_0x1f4837[_0xa95a('0x15')]?_0x1f4837[_0xa95a('0x15')]['attributes']||null:null,'limit':_0x1f4837[_0xa95a('0x15')]?_0x1f4837[_0xa95a('0x15')][_0xa95a('0x1d')]||null:null})['then'](function(_0x45fc21){logger[_0xa95a('0x17')](_0xa95a('0x1a'),_0x1f4837);logger[_0xa95a('0xc')]('UpdateVoiceAgentReport',_0x1f4837,JSON[_0xa95a('0xe')](_0x45fc21));_0x242e13(_0x45fc21);})[_0xa95a('0x19')](function(_0x3c16fb){logger['error'](_0xa95a('0x1a'),_0x3c16fb[_0xa95a('0x11')],_0x1f4837);_0xa51806(_0x138f40['error'](0x1f4,_0x3c16fb[_0xa95a('0x11')]));});});}; \ No newline at end of file +var _0xf2cc=['error','message','info','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x56899b,_0x80fce){var _0x47d591=function(_0x23d7cf){while(--_0x23d7cf){_0x56899b['push'](_0x56899b['shift']());}};_0x47d591(++_0x80fce);}(_0xf2cc,0xb4));var _0xcf2c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf2cc[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xcf2c('0x0'));var util=require(_0xcf2c('0x1'));var moment=require(_0xcf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf2c('0x3'));var fs=require('fs');var Redis=require(_0xcf2c('0x4'));var db=require(_0xcf2c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf2c('0x6'))(_0xcf2c('0x7'));var config=require(_0xcf2c('0x8'));var jayson=require(_0xcf2c('0x9'));var client=jayson[_0xcf2c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57f2a6,_0x481122,_0x47a339){return new BPromise(function(_0x2ce0bf,_0x1f1e01){return client['request'](_0x57f2a6,_0x47a339)[_0xcf2c('0xb')](function(_0x46d6b8){logger['info'](_0xcf2c('0xc'),_0x481122,_0xcf2c('0xd'));logger[_0xcf2c('0xe')](_0xcf2c('0xf'),_0x481122,_0xcf2c('0xd'),JSON[_0xcf2c('0x10')](_0x46d6b8));if(_0x46d6b8['error']){if(_0x46d6b8['error'][_0xcf2c('0x11')]===0x1f4){logger[_0xcf2c('0x12')](_0xcf2c('0xc'),_0x481122,_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);return _0x1f1e01(_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x481122,_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);return _0x2ce0bf(_0x46d6b8[_0xcf2c('0x12')][_0xcf2c('0x13')]);}else{logger[_0xcf2c('0x14')](_0xcf2c('0xc'),_0x481122,_0xcf2c('0xd'));_0x2ce0bf(_0x46d6b8[_0xcf2c('0x15')]['message']);}})[_0xcf2c('0x16')](function(_0x4b932d){logger[_0xcf2c('0x12')](_0xcf2c('0xc'),_0x481122,_0x4b932d);_0x1f1e01(_0x4b932d);});});}exports['CreateVoiceAgentReport']=function(_0x4d6fc3){var _0x3a1150=this;return new Promise(function(_0x50f2a3,_0x3c3e68){return db[_0xcf2c('0x17')][_0xcf2c('0x18')](_0x4d6fc3[_0xcf2c('0x19')],{'raw':_0x4d6fc3[_0xcf2c('0x1a')]?_0x4d6fc3[_0xcf2c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x56c2d9){logger[_0xcf2c('0x14')](_0xcf2c('0x1b'),_0x4d6fc3);logger[_0xcf2c('0xe')](_0xcf2c('0x1b'),_0x4d6fc3,JSON[_0xcf2c('0x10')](_0x56c2d9));_0x50f2a3(_0x56c2d9);})['catch'](function(_0x4e898f){logger[_0xcf2c('0x12')]('CreateVoiceAgentReport',_0x4e898f[_0xcf2c('0x13')],_0x4d6fc3);_0x3c3e68(_0x3a1150[_0xcf2c('0x12')](0x1f4,_0x4e898f[_0xcf2c('0x13')]));});});};exports[_0xcf2c('0x1c')]=function(_0x285270){var _0x1e6a76=this;return new Promise(function(_0x1da4df,_0x30546){return db[_0xcf2c('0x17')][_0xcf2c('0x1d')](_0x285270['body'],{'raw':_0x285270['options']?_0x285270['options'][_0xcf2c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285270[_0xcf2c('0x1a')]?_0x285270[_0xcf2c('0x1a')][_0xcf2c('0x1f')]||null:null,'attributes':_0x285270[_0xcf2c('0x1a')]?_0x285270[_0xcf2c('0x1a')][_0xcf2c('0x20')]||null:null,'limit':_0x285270[_0xcf2c('0x1a')]?_0x285270[_0xcf2c('0x1a')]['limit']||null:null})[_0xcf2c('0xb')](function(_0x34f583){logger[_0xcf2c('0x14')](_0xcf2c('0x1c'),_0x285270);logger[_0xcf2c('0xe')](_0xcf2c('0x1c'),_0x285270,JSON[_0xcf2c('0x10')](_0x34f583));_0x1da4df(_0x34f583);})[_0xcf2c('0x16')](function(_0x3cbcdd){logger[_0xcf2c('0x12')](_0xcf2c('0x1c'),_0x3cbcdd[_0xcf2c('0x13')],_0x285270);_0x30546(_0x1e6a76['error'](0x1f4,_0x3cbcdd[_0xcf2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7a9f198..b7cc87f 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 _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x1fa4cb,_0x5ad09a){var _0x22d7c8=function(_0x51b246){while(--_0x51b246){_0x1fa4cb['push'](_0x1fa4cb['shift']());}};_0x22d7c8(++_0x5ad09a);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xe0ae[_0x4a93bb];return _0x208468;};'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('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file +var _0xf69d=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf69d,0xd3));var _0xdf69=function(_0xbd3b11,_0x4fb444){_0xbd3b11=_0xbd3b11-0x0;var _0x56128a=_0xf69d[_0xbd3b11];return _0x56128a;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var fs_extra=require(_0xdf69('0x5'));var auth=require(_0xdf69('0x6'));var interaction=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var controller=require(_0xdf69('0x9'));router[_0xdf69('0xa')]('/',auth[_0xdf69('0xb')](),controller[_0xdf69('0xc')]);router[_0xdf69('0xa')](_0xdf69('0xd'),auth[_0xdf69('0xb')](),controller[_0xdf69('0xe')]);router[_0xdf69('0xa')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x10')]);router[_0xdf69('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf69('0x12')]);router[_0xdf69('0x13')](_0xdf69('0xf'),auth[_0xdf69('0xb')](),controller[_0xdf69('0x14')]);router[_0xdf69('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d0c5dfd..d44bbd3 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 _0x93ef=['inbound','internal','outbound','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x93ef,0x15f));var _0xf93e=function(_0x45286e,_0x2df9c2){_0x45286e=_0x45286e-0x0;var _0x4ec7e8=_0x93ef[_0x45286e];return _0x4ec7e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xf93e('0x0'),_0xf93e('0x1'),_0xf93e('0x2'),_0xf93e('0x3'),'outbound-fax',_0xf93e('0x4'))},'tag':{'type':Sequelize[_0xf93e('0x5')]},'accountcode':{'type':Sequelize[_0xf93e('0x5')]},'source':{'type':Sequelize[_0xf93e('0x5')]},'destination':{'type':Sequelize[_0xf93e('0x5')]},'destinationcontext':{'type':Sequelize[_0xf93e('0x5')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf93e('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf93e('0x6')]},'starttime':{'type':Sequelize[_0xf93e('0x7')]},'systemanswertime':{'type':Sequelize[_0xf93e('0x7')]},'answertime':{'type':Sequelize[_0xf93e('0x7')]},'endtime':{'type':Sequelize[_0xf93e('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xf93e('0x8')]},'mohtime':{'type':Sequelize[_0xf93e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf93e('0x5')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xf93e('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xf93e('0x5')]},'note':{'type':Sequelize[_0xf93e('0x5')]},'prefix':{'type':Sequelize[_0xf93e('0x5')]},'routeid':{'type':Sequelize[_0xf93e('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6edc=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','outbound','inbound-fax','outbound-fax'];(function(_0x2bb896,_0x2d6e41){var _0x320cd6=function(_0x2d328b){while(--_0x2d328b){_0x2bb896['push'](_0x2bb896['shift']());}};_0x320cd6(++_0x2d6e41);}(_0x6edc,0x138));var _0xc6ed=function(_0x4d79d7,_0x2cf4e0){_0x4d79d7=_0x4d79d7-0x0;var _0x4c2f47=_0x6edc[_0x4d79d7];return _0x4c2f47;};'use strict';var Sequelize=require(_0xc6ed('0x0'));module[_0xc6ed('0x1')]={'uniqueid':{'type':Sequelize[_0xc6ed('0x2')]},'type':{'type':Sequelize[_0xc6ed('0x3')]('inbound','internal',_0xc6ed('0x4'),_0xc6ed('0x5'),_0xc6ed('0x6'),_0xc6ed('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc6ed('0x2')]},'source':{'type':Sequelize[_0xc6ed('0x2')]},'destination':{'type':Sequelize[_0xc6ed('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc6ed('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc6ed('0x2')]},'lastapplication':{'type':Sequelize[_0xc6ed('0x2')]},'lastdata':{'type':Sequelize[_0xc6ed('0x8')]},'starttime':{'type':Sequelize[_0xc6ed('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc6ed('0x9')]},'endtime':{'type':Sequelize[_0xc6ed('0x9')]},'duration':{'type':Sequelize[_0xc6ed('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc6ed('0x2')]},'amaflags':{'type':Sequelize[_0xc6ed('0x2')]},'userfield':{'type':Sequelize[_0xc6ed('0x2')]},'userDisposition':{'type':Sequelize[_0xc6ed('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xc6ed('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc6ed('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xc6ed('0xa')]},'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 faca9fb..742cb44 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x53ca61,_0x56be09){_0x53ca61=_0x53ca61-0x0;var _0x55687a=_0x2032[_0x53ca61];return _0x55687a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','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','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x561134,_0x287a49){_0x561134=_0x561134-0x0;var _0x5587f3=_0x5f2f[_0x561134];return _0x5587f3;};'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')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 519767b..73457e2 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 _0x77f4=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','report_call'];(function(_0x5a986e,_0x21bf9f){var _0x3b8eb9=function(_0x789cc6){while(--_0x789cc6){_0x5a986e['push'](_0x5a986e['shift']());}};_0x3b8eb9(++_0x21bf9f);}(_0x77f4,0x1a1));var _0x477f=function(_0x2223d1,_0x3937ce){_0x2223d1=_0x2223d1-0x0;var _0x30b1c6=_0x77f4[_0x2223d1];return _0x30b1c6;};'use strict';var _=require(_0x477f('0x0'));var util=require(_0x477f('0x1'));var logger=require(_0x477f('0x2'))(_0x477f('0x3'));var moment=require(_0x477f('0x4'));var BPromise=require(_0x477f('0x5'));var rp=require(_0x477f('0x6'));var fs=require('fs');var path=require(_0x477f('0x7'));var rimraf=require('rimraf');var config=require(_0x477f('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x477f('0x9')]=function(_0x5da219,_0x4ebb39){return _0x5da219[_0x477f('0xa')]('VoiceCallReport',attributes,{'tableName':_0x477f('0xb'),'paranoid':![],'indexes':[{'fields':[_0x477f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8393=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0x8393,0x1e1));var _0x3839=function(_0x864751,_0x3efea3){_0x864751=_0x864751-0x0;var _0x4d61ab=_0x8393[_0x864751];return _0x4d61ab;};'use strict';var _=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var logger=require(_0x3839('0x2'))(_0x3839('0x3'));var moment=require('moment');var BPromise=require(_0x3839('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3839('0x5'));var rimraf=require(_0x3839('0x6'));var config=require(_0x3839('0x7'));var attributes=require(_0x3839('0x8'));module[_0x3839('0x9')]=function(_0xbec458,_0x1303d3){return _0xbec458[_0x3839('0xa')]('VoiceCallReport',attributes,{'tableName':_0x3839('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3839('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 6c54701..3fa6a04 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 _0x3dc7=['limit','include','map','model','GetVoiceCallReport','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceCallReport','options','raw','where','attributes'];(function(_0x36c426,_0x288b97){var _0x20f278=function(_0x5918c4){while(--_0x5918c4){_0x36c426['push'](_0x36c426['shift']());}};_0x20f278(++_0x288b97);}(_0x3dc7,0x1eb));var _0x73dc=function(_0x29e98d,_0x4fb94c){_0x29e98d=_0x29e98d-0x0;var _0x5f45fc=_0x3dc7[_0x29e98d];return _0x5f45fc;};'use strict';var _=require(_0x73dc('0x0'));var util=require(_0x73dc('0x1'));var moment=require('moment');var BPromise=require(_0x73dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73dc('0x3'));var db=require(_0x73dc('0x4'))['db'];var utils=require(_0x73dc('0x5'));var logger=require(_0x73dc('0x6'))('rpc');var config=require(_0x73dc('0x7'));var jayson=require(_0x73dc('0x8'));var client=jayson[_0x73dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3249c1,_0x1acf74,_0x185af2){return new BPromise(function(_0xd3d205,_0x4a912c){return client[_0x73dc('0xa')](_0x3249c1,_0x185af2)[_0x73dc('0xb')](function(_0xf1f036){logger[_0x73dc('0xc')](_0x73dc('0xd'),_0x1acf74,_0x73dc('0xe'));logger[_0x73dc('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1acf74,_0x73dc('0xe'),JSON[_0x73dc('0x10')](_0xf1f036));if(_0xf1f036[_0x73dc('0x11')]){if(_0xf1f036['error'][_0x73dc('0x12')]===0x1f4){logger[_0x73dc('0x11')](_0x73dc('0xd'),_0x1acf74,_0xf1f036[_0x73dc('0x11')][_0x73dc('0x13')]);return _0x4a912c(_0xf1f036[_0x73dc('0x11')][_0x73dc('0x13')]);}logger[_0x73dc('0x11')](_0x73dc('0xd'),_0x1acf74,_0xf1f036[_0x73dc('0x11')]['message']);return _0xd3d205(_0xf1f036[_0x73dc('0x11')][_0x73dc('0x13')]);}else{logger[_0x73dc('0xc')](_0x73dc('0xd'),_0x1acf74,_0x73dc('0xe'));_0xd3d205(_0xf1f036[_0x73dc('0x14')][_0x73dc('0x13')]);}})[_0x73dc('0x15')](function(_0x4c2f02){logger[_0x73dc('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1acf74,_0x4c2f02);_0x4a912c(_0x4c2f02);});});}exports['GetVoiceCallReport']=function(_0x17e336){var _0x17667a=this;return new Promise(function(_0x5d13a5,_0x3e2e3a){return db[_0x73dc('0x16')]['findAll']({'raw':_0x17e336[_0x73dc('0x17')]?_0x17e336[_0x73dc('0x17')][_0x73dc('0x18')]===undefined?!![]:![]:!![],'where':_0x17e336[_0x73dc('0x17')]?_0x17e336[_0x73dc('0x17')][_0x73dc('0x19')]||null:null,'attributes':_0x17e336[_0x73dc('0x17')]?_0x17e336[_0x73dc('0x17')][_0x73dc('0x1a')]||null:null,'limit':_0x17e336['options']?_0x17e336[_0x73dc('0x17')][_0x73dc('0x1b')]||null:null,'include':_0x17e336[_0x73dc('0x17')]?_0x17e336[_0x73dc('0x17')][_0x73dc('0x1c')]?_[_0x73dc('0x1d')](_0x17e336[_0x73dc('0x17')][_0x73dc('0x1c')],function(_0x5e5731){return{'model':db[_0x5e5731[_0x73dc('0x1e')]],'as':_0x5e5731['as'],'attributes':_0x5e5731[_0x73dc('0x1a')],'include':_0x5e5731[_0x73dc('0x1c')]?_[_0x73dc('0x1d')](_0x5e5731[_0x73dc('0x1c')],function(_0x28a544){return{'model':db[_0x28a544[_0x73dc('0x1e')]],'as':_0x28a544['as'],'attributes':_0x28a544[_0x73dc('0x1a')],'include':_0x28a544['include']?_[_0x73dc('0x1d')](_0x28a544[_0x73dc('0x1c')],function(_0x5c1470){return{'model':db[_0x5c1470['model']],'as':_0x5c1470['as'],'attributes':_0x5c1470[_0x73dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x73dc('0xb')](function(_0x954575){logger['info'](_0x73dc('0x1f'),_0x17e336);logger['debug'](_0x73dc('0x1f'),_0x17e336,JSON[_0x73dc('0x10')](_0x954575));_0x5d13a5(_0x954575);})[_0x73dc('0x15')](function(_0x215fd7){logger[_0x73dc('0x11')]('GetVoiceCallReport',_0x215fd7[_0x73dc('0x13')],_0x17e336);_0x3e2e3a(_0x17667a[_0x73dc('0x11')](0x1f4,_0x215fd7[_0x73dc('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x17a6a3){var _0x5b8d3e=this;return new Promise(function(_0x3c989d,_0xf4ef79){return db[_0x73dc('0x16')][_0x73dc('0x20')](_0x17a6a3['body'],{'raw':_0x17a6a3[_0x73dc('0x17')]?_0x17a6a3['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a7a60){logger[_0x73dc('0xc')](_0x73dc('0x21'),_0x17a6a3);logger[_0x73dc('0xf')](_0x73dc('0x21'),_0x17a6a3,JSON[_0x73dc('0x10')](_0x1a7a60));_0x3c989d(_0x1a7a60);})[_0x73dc('0x15')](function(_0x2c84f0){logger['error']('CreateVoiceCallReport',_0x2c84f0[_0x73dc('0x13')],_0x17a6a3);_0xf4ef79(_0x5b8d3e['error'](0x1f4,_0x2c84f0[_0x73dc('0x13')]));});});};exports[_0x73dc('0x22')]=function(_0x950ad5){var _0x19ae33=this;return new Promise(function(_0x3eb94f,_0x38b15d){return db[_0x73dc('0x16')][_0x73dc('0x23')](_0x950ad5[_0x73dc('0x24')],{'raw':_0x950ad5[_0x73dc('0x17')]?_0x950ad5[_0x73dc('0x17')][_0x73dc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x950ad5[_0x73dc('0x17')]?_0x950ad5[_0x73dc('0x17')][_0x73dc('0x19')]||null:null,'attributes':_0x950ad5[_0x73dc('0x17')]?_0x950ad5['options'][_0x73dc('0x1a')]||null:null,'limit':_0x950ad5[_0x73dc('0x17')]?_0x950ad5[_0x73dc('0x17')][_0x73dc('0x1b')]||null:null})[_0x73dc('0xb')](function(_0x5b6957){logger[_0x73dc('0xc')](_0x73dc('0x22'),_0x950ad5);logger['debug'](_0x73dc('0x22'),_0x950ad5,JSON['stringify'](_0x5b6957));_0x3eb94f(_0x5b6957);})[_0x73dc('0x15')](function(_0x15d709){logger[_0x73dc('0x11')](_0x73dc('0x22'),_0x15d709[_0x73dc('0x13')],_0x950ad5);_0x38b15d(_0x19ae33['error'](0x1f4,_0x15d709[_0x73dc('0x13')]));});});}; \ No newline at end of file +var _0xf595=['VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','attributes','map','include','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xd9d0bf,_0x522d1f){var _0x4c809f=function(_0x554610){while(--_0x554610){_0xd9d0bf['push'](_0xd9d0bf['shift']());}};_0x4c809f(++_0x522d1f);}(_0xf595,0x68));var _0x5f59=function(_0x2a93f0,_0x1f8fb7){_0x2a93f0=_0x2a93f0-0x0;var _0x439217=_0xf595[_0x2a93f0];return _0x439217;};'use strict';var _=require(_0x5f59('0x0'));var util=require(_0x5f59('0x1'));var moment=require(_0x5f59('0x2'));var BPromise=require(_0x5f59('0x3'));var rs=require(_0x5f59('0x4'));var fs=require('fs');var Redis=require(_0x5f59('0x5'));var db=require(_0x5f59('0x6'))['db'];var utils=require(_0x5f59('0x7'));var logger=require(_0x5f59('0x8'))(_0x5f59('0x9'));var config=require('../../config/environment');var jayson=require(_0x5f59('0xa'));var client=jayson[_0x5f59('0xb')][_0x5f59('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x423c84,_0x474120,_0x45e46d){return new BPromise(function(_0x32a9ba,_0x2bc644){return client[_0x5f59('0xd')](_0x423c84,_0x45e46d)[_0x5f59('0xe')](function(_0x5bb208){logger[_0x5f59('0xf')](_0x5f59('0x10'),_0x474120,'request\x20sent');logger[_0x5f59('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x474120,_0x5f59('0x12'),JSON[_0x5f59('0x13')](_0x5bb208));if(_0x5bb208[_0x5f59('0x14')]){if(_0x5bb208[_0x5f59('0x14')][_0x5f59('0x15')]===0x1f4){logger['error'](_0x5f59('0x10'),_0x474120,_0x5bb208[_0x5f59('0x14')]['message']);return _0x2bc644(_0x5bb208[_0x5f59('0x14')][_0x5f59('0x16')]);}logger[_0x5f59('0x14')](_0x5f59('0x10'),_0x474120,_0x5bb208['error']['message']);return _0x32a9ba(_0x5bb208[_0x5f59('0x14')][_0x5f59('0x16')]);}else{logger[_0x5f59('0xf')](_0x5f59('0x10'),_0x474120,_0x5f59('0x12'));_0x32a9ba(_0x5bb208[_0x5f59('0x17')][_0x5f59('0x16')]);}})[_0x5f59('0x18')](function(_0x5a81a8){logger[_0x5f59('0x14')](_0x5f59('0x10'),_0x474120,_0x5a81a8);_0x2bc644(_0x5a81a8);});});}exports[_0x5f59('0x19')]=function(_0x28e290){var _0x83bfd0=this;return new Promise(function(_0x26ea1f,_0x1365e9){return db[_0x5f59('0x1a')][_0x5f59('0x1b')]({'raw':_0x28e290['options']?_0x28e290['options'][_0x5f59('0x1c')]===undefined?!![]:![]:!![],'where':_0x28e290[_0x5f59('0x1d')]?_0x28e290[_0x5f59('0x1d')]['where']||null:null,'attributes':_0x28e290['options']?_0x28e290[_0x5f59('0x1d')][_0x5f59('0x1e')]||null:null,'limit':_0x28e290[_0x5f59('0x1d')]?_0x28e290[_0x5f59('0x1d')]['limit']||null:null,'include':_0x28e290['options']?_0x28e290[_0x5f59('0x1d')]['include']?_[_0x5f59('0x1f')](_0x28e290[_0x5f59('0x1d')][_0x5f59('0x20')],function(_0x2fbe60){return{'model':db[_0x2fbe60[_0x5f59('0x21')]],'as':_0x2fbe60['as'],'attributes':_0x2fbe60[_0x5f59('0x1e')],'include':_0x2fbe60[_0x5f59('0x20')]?_[_0x5f59('0x1f')](_0x2fbe60[_0x5f59('0x20')],function(_0x179c86){return{'model':db[_0x179c86[_0x5f59('0x21')]],'as':_0x179c86['as'],'attributes':_0x179c86[_0x5f59('0x1e')],'include':_0x179c86[_0x5f59('0x20')]?_[_0x5f59('0x1f')](_0x179c86[_0x5f59('0x20')],function(_0x1c4194){return{'model':db[_0x1c4194[_0x5f59('0x21')]],'as':_0x1c4194['as'],'attributes':_0x1c4194[_0x5f59('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa3c622){logger[_0x5f59('0xf')](_0x5f59('0x19'),_0x28e290);logger[_0x5f59('0x11')]('GetVoiceCallReport',_0x28e290,JSON[_0x5f59('0x13')](_0xa3c622));_0x26ea1f(_0xa3c622);})[_0x5f59('0x18')](function(_0x6aa3f8){logger[_0x5f59('0x14')](_0x5f59('0x19'),_0x6aa3f8[_0x5f59('0x16')],_0x28e290);_0x1365e9(_0x83bfd0[_0x5f59('0x14')](0x1f4,_0x6aa3f8[_0x5f59('0x16')]));});});};exports[_0x5f59('0x22')]=function(_0x56326a){var _0x2b36b6=this;return new Promise(function(_0x10c86c,_0x1567f0){return db['VoiceCallReport'][_0x5f59('0x23')](_0x56326a[_0x5f59('0x24')],{'raw':_0x56326a[_0x5f59('0x1d')]?_0x56326a[_0x5f59('0x1d')][_0x5f59('0x1c')]===undefined?!![]:![]:!![]})[_0x5f59('0xe')](function(_0x4e09ff){logger[_0x5f59('0xf')](_0x5f59('0x22'),_0x56326a);logger[_0x5f59('0x11')]('CreateVoiceCallReport',_0x56326a,JSON[_0x5f59('0x13')](_0x4e09ff));_0x10c86c(_0x4e09ff);})[_0x5f59('0x18')](function(_0x59389e){logger[_0x5f59('0x14')]('CreateVoiceCallReport',_0x59389e[_0x5f59('0x16')],_0x56326a);_0x1567f0(_0x2b36b6['error'](0x1f4,_0x59389e[_0x5f59('0x16')]));});});};exports[_0x5f59('0x25')]=function(_0xe83a13){var _0x3f14b3=this;return new Promise(function(_0x2ec0e4,_0x592225){return db['VoiceCallReport'][_0x5f59('0x26')](_0xe83a13[_0x5f59('0x24')],{'raw':_0xe83a13[_0x5f59('0x1d')]?_0xe83a13[_0x5f59('0x1d')][_0x5f59('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe83a13['options']?_0xe83a13[_0x5f59('0x1d')]['where']||null:null,'attributes':_0xe83a13['options']?_0xe83a13['options'][_0x5f59('0x1e')]||null:null,'limit':_0xe83a13[_0x5f59('0x1d')]?_0xe83a13[_0x5f59('0x1d')][_0x5f59('0x27')]||null:null})['then'](function(_0x1e0f47){logger[_0x5f59('0xf')](_0x5f59('0x25'),_0xe83a13);logger['debug']('UpdateVoiceCallReport',_0xe83a13,JSON['stringify'](_0x1e0f47));_0x2ec0e4(_0x1e0f47);})[_0x5f59('0x18')](function(_0x5d6b4e){logger['error'](_0x5f59('0x25'),_0x5d6b4e['message'],_0xe83a13);_0x592225(_0x3f14b3['error'](0x1f4,_0x5d6b4e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 33f22ff..b616b04 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 _0x2a0b=['fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','post','create','update','destroy','exports','multer','connect-timeout','express'];(function(_0x1cc3da,_0x26b5ba){var _0x322dc7=function(_0x4c9ef2){while(--_0x4c9ef2){_0x1cc3da['push'](_0x1cc3da['shift']());}};_0x322dc7(++_0x26b5ba);}(_0x2a0b,0x192));var _0xb2a0=function(_0x36d75b,_0x1ebd1e){_0x36d75b=_0x36d75b-0x0;var _0x39cbf2=_0x2a0b[_0x36d75b];return _0x39cbf2;};'use strict';var multer=require(_0xb2a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2a0('0x1'));var express=require(_0xb2a0('0x2'));var router=express['Router']();var fs_extra=require(_0xb2a0('0x3'));var auth=require(_0xb2a0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb2a0('0x5'));var controller=require(_0xb2a0('0x6'));router[_0xb2a0('0x7')]('/',auth[_0xb2a0('0x8')](),controller['index']);router[_0xb2a0('0x7')](_0xb2a0('0x9'),auth[_0xb2a0('0x8')](),controller['show']);router[_0xb2a0('0xa')]('/',auth[_0xb2a0('0x8')](),controller[_0xb2a0('0xb')]);router['put'](_0xb2a0('0x9'),auth[_0xb2a0('0x8')](),controller[_0xb2a0('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb2a0('0xd')]);module[_0xb2a0('0xe')]=router; \ No newline at end of file +var _0x0179=['./voiceChanSpy.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x0179,0x1a9));var _0x9017=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x0179[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require('multer');var util=require(_0x9017('0x0'));var path=require('path');var timeout=require(_0x9017('0x1'));var express=require('express');var router=express[_0x9017('0x2')]();var fs_extra=require(_0x9017('0x3'));var auth=require(_0x9017('0x4'));var interaction=require(_0x9017('0x5'));var config=require(_0x9017('0x6'));var controller=require(_0x9017('0x7'));router['get']('/',auth[_0x9017('0x8')](),controller['index']);router[_0x9017('0x9')](_0x9017('0xa'),auth['isAuthenticated'](),controller[_0x9017('0xb')]);router[_0x9017('0xc')]('/',auth['isAuthenticated'](),controller[_0x9017('0xd')]);router[_0x9017('0xe')](_0x9017('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9017('0xf')](_0x9017('0xa'),auth[_0x9017('0x8')](),controller[_0x9017('0x10')]);module[_0x9017('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2c9c96a..4bc63ea 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 _0x7197=['sequelize','exports','STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x7197,0x118));var _0x7719=function(_0x13f7c0,_0x4562a4){_0x13f7c0=_0x13f7c0-0x0;var _0x2b42d6=_0x7197[_0x13f7c0];return _0x2b42d6;};'use strict';var Sequelize=require(_0x7719('0x0'));module[_0x7719('0x1')]={'name':{'type':Sequelize[_0x7719('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x7719('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2acbc2){this[_0x7719('0x4')]('options',_0x2acbc2?_0x2acbc2[_0x7719('0x5')](''):[]);},'get':function(){return this[_0x7719('0x6')](_0x7719('0x7'))?this[_0x7719('0x6')](_0x7719('0x7'))[_0x7719('0x8')](''):[];}},'auth':{'type':Sequelize[_0x7719('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x7719('0x2')]},'record':{'type':Sequelize[_0x7719('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7719('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb4e6=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x175628,_0x5cb9f1){var _0x3fa21b=function(_0x3ec34d){while(--_0x3ec34d){_0x175628['push'](_0x175628['shift']());}};_0x3fa21b(++_0x5cb9f1);}(_0xb4e6,0x1b6));var _0x6b4e=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xb4e6[_0x37cc52];return _0x2b4a90;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module[_0x6b4e('0x1')]={'name':{'type':Sequelize[_0x6b4e('0x2')]},'prefix':{'type':Sequelize[_0x6b4e('0x2')],'unique':_0x6b4e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6b4e('0x2')],'set':function(_0x22efec){this[_0x6b4e('0x4')](_0x6b4e('0x5'),_0x22efec?_0x22efec[_0x6b4e('0x6')](''):[]);},'get':function(){return this[_0x6b4e('0x7')](_0x6b4e('0x5'))?this['getDataValue']('options')[_0x6b4e('0x8')](''):[];}},'auth':{'type':Sequelize[_0x6b4e('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x6b4e('0x2')]},'record':{'type':Sequelize[_0x6b4e('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6b4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 10ae69e..6e7f488 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 _0x89c4=['reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range'];(function(_0x1c29e4,_0x25182e){var _0x2925eb=function(_0x462a6b){while(--_0x462a6b){_0x1c29e4['push'](_0x1c29e4['shift']());}};_0x2925eb(++_0x25182e);}(_0x89c4,0x82));var _0x489c=function(_0x20c44b,_0x478247){_0x20c44b=_0x20c44b-0x0;var _0x24a0c1=_0x89c4[_0x20c44b];return _0x24a0c1;};'use strict';var emlformat=require(_0x489c('0x0'));var rimraf=require(_0x489c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x489c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x489c('0x3'));var Mustache=require(_0x489c('0x4'));var util=require(_0x489c('0x5'));var path=require(_0x489c('0x6'));var sox=require(_0x489c('0x7'));var csv=require(_0x489c('0x8'));var ejs=require(_0x489c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x489c('0xa'));var squel=require(_0x489c('0xb'));var crypto=require(_0x489c('0xc'));var jsforce=require(_0x489c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x489c('0xe'));var Papa=require('papaparse');var Redis=require(_0x489c('0xf'));var authService=require(_0x489c('0x10'));var qs=require(_0x489c('0x11'));var as=require(_0x489c('0x12'));var hardwareService=require(_0x489c('0x13'));var logger=require(_0x489c('0x14'))(_0x489c('0x15'));var utils=require(_0x489c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x489c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdfbcb,_0x4a9f45){_0x4a9f45=_0x4a9f45||0xcc;return function(_0x5340ce){if(_0x5340ce){return _0xfdfbcb[_0x489c('0x18')](_0x4a9f45);}return _0xfdfbcb['status'](_0x4a9f45)[_0x489c('0x19')]();};}function respondWithResult(_0x5d1b10,_0x305e40){_0x305e40=_0x305e40||0xc8;return function(_0x45983e){if(_0x45983e){return _0x5d1b10['status'](_0x305e40)[_0x489c('0x1a')](_0x45983e);}};}function respondWithFilteredResult(_0x39725a,_0x4861e2){return function(_0x4f37c3){if(_0x4f37c3){var _0x1bb98a=typeof _0x4861e2['offset']===_0x489c('0x1b')&&typeof _0x4861e2[_0x489c('0x1c')]===_0x489c('0x1b');var _0x39f9a9=_0x4f37c3[_0x489c('0x1d')];var _0x4519ce=_0x1bb98a?0x0:_0x4861e2[_0x489c('0x1e')];var _0x431782=_0x1bb98a?_0x4f37c3[_0x489c('0x1d')]:_0x4861e2[_0x489c('0x1e')]+_0x4861e2[_0x489c('0x1c')];var _0x19fb45;if(_0x431782>=_0x39f9a9){_0x431782=_0x39f9a9;_0x19fb45=0xc8;}else{_0x19fb45=0xce;}_0x39725a[_0x489c('0x1f')](_0x19fb45);return _0x39725a[_0x489c('0x20')](_0x489c('0x21'),_0x4519ce+'-'+_0x431782+'/'+_0x39f9a9)[_0x489c('0x1a')](_0x4f37c3);}return null;};}function patchUpdates(_0x14677b){return function(_0x381b56){try{jsonpatch['apply'](_0x381b56,_0x14677b,!![]);}catch(_0x4d0e03){return BPromise[_0x489c('0x22')](_0x4d0e03);}return _0x381b56[_0x489c('0x23')]();};}function saveUpdates(_0x1a1b68,_0x18cf8b){return function(_0x5b6ea3){if(_0x5b6ea3){return _0x5b6ea3[_0x489c('0x24')](_0x1a1b68)[_0x489c('0x25')](function(_0x37a59b){return _0x37a59b;});}return null;};}function removeEntity(_0x552384,_0x2a6d5c){return function(_0x1de4bf){if(_0x1de4bf){return _0x1de4bf['destroy']()[_0x489c('0x25')](function(){var _0x7914ad=_0x1de4bf['get']({'plain':!![]});var _0x35db69='ChanSpies';return db[_0x489c('0x26')][_0x489c('0x27')]({'where':{'type':_0x35db69,'resourceId':_0x7914ad['id']}})['then'](function(){return _0x1de4bf;});})[_0x489c('0x25')](function(){_0x552384[_0x489c('0x1f')](0xcc)[_0x489c('0x19')]();});}};}function handleEntityNotFound(_0x228c06,_0x5285e4){return function(_0x29c012){if(!_0x29c012){_0x228c06['sendStatus'](0x194);}return _0x29c012;};}function handleError(_0x2ce72c,_0x1f86cb){_0x1f86cb=_0x1f86cb||0x1f4;return function(_0x3b8f79){logger[_0x489c('0x28')](_0x3b8f79[_0x489c('0x29')]);if(_0x3b8f79[_0x489c('0x2a')]){delete _0x3b8f79['name'];}_0x2ce72c[_0x489c('0x1f')](_0x1f86cb)[_0x489c('0x2b')](_0x3b8f79);};}exports['index']=function(_0x445d7d,_0x299fcf){var _0x58b523={},_0x1fe531={},_0x21d1ec={'count':0x0,'rows':[]};var _0x222e1d=_[_0x489c('0x2c')](db['VoiceChanSpy'][_0x489c('0x2d')],function(_0x335436){return{'name':_0x335436['fieldName'],'type':_0x335436[_0x489c('0x2e')][_0x489c('0x2f')]};});_0x1fe531[_0x489c('0x30')]=_['map'](_0x222e1d,_0x489c('0x2a'));_0x1fe531[_0x489c('0x31')]=_[_0x489c('0x32')](_0x445d7d[_0x489c('0x31')]);_0x1fe531[_0x489c('0x33')]=_[_0x489c('0x34')](_0x1fe531[_0x489c('0x30')],_0x1fe531[_0x489c('0x31')]);_0x58b523['attributes']=_[_0x489c('0x34')](_0x1fe531[_0x489c('0x30')],qs[_0x489c('0x35')](_0x445d7d[_0x489c('0x31')][_0x489c('0x35')]));_0x58b523[_0x489c('0x36')]=_0x58b523[_0x489c('0x36')][_0x489c('0x37')]?_0x58b523[_0x489c('0x36')]:_0x1fe531[_0x489c('0x30')];if(!_0x445d7d['query'][_0x489c('0x38')]('nolimit')){_0x58b523[_0x489c('0x1c')]=qs[_0x489c('0x1c')](_0x445d7d[_0x489c('0x31')][_0x489c('0x1c')]);_0x58b523['offset']=qs[_0x489c('0x1e')](_0x445d7d[_0x489c('0x31')][_0x489c('0x1e')]);}_0x58b523[_0x489c('0x39')]=qs[_0x489c('0x3a')](_0x445d7d[_0x489c('0x31')][_0x489c('0x3a')]);_0x58b523['where']=qs[_0x489c('0x33')](_[_0x489c('0x3b')](_0x445d7d[_0x489c('0x31')],_0x1fe531[_0x489c('0x33')]),_0x222e1d);if(_0x445d7d[_0x489c('0x31')]['filter']){_0x58b523[_0x489c('0x3c')]=_['merge'](_0x58b523[_0x489c('0x3c')],{'$or':_['map'](_0x222e1d,function(_0x410270){if(_0x410270[_0x489c('0x2e')]!==_0x489c('0x3d')){var _0xdcf742={};_0xdcf742[_0x410270[_0x489c('0x2a')]]={'$like':'%'+_0x445d7d[_0x489c('0x31')][_0x489c('0x3e')]+'%'};return _0xdcf742;}})});}_0x58b523=_[_0x489c('0x3f')]({},_0x58b523,_0x445d7d[_0x489c('0x40')]);var _0x44bf35={'where':_0x58b523[_0x489c('0x3c')]};return db[_0x489c('0x41')][_0x489c('0x1d')](_0x44bf35)[_0x489c('0x25')](function(_0x3cccca){_0x21d1ec['count']=_0x3cccca;if(_0x445d7d['query'][_0x489c('0x42')]){_0x58b523[_0x489c('0x43')]=[{'all':!![]}];}return db[_0x489c('0x41')][_0x489c('0x44')](_0x58b523);})['then'](function(_0xea1236){_0x21d1ec[_0x489c('0x45')]=_0xea1236;return _0x21d1ec;})['then'](respondWithFilteredResult(_0x299fcf,_0x58b523))[_0x489c('0x46')](handleError(_0x299fcf,null));};exports['show']=function(_0xc8ded3,_0x5d6692){var _0x2ddf07={'raw':![],'where':{'id':_0xc8ded3[_0x489c('0x47')]['id']}},_0xe374e4={};_0xe374e4[_0x489c('0x30')]=_[_0x489c('0x32')](db[_0x489c('0x41')][_0x489c('0x2d')]);_0xe374e4[_0x489c('0x31')]=_[_0x489c('0x32')](_0xc8ded3[_0x489c('0x31')]);_0xe374e4[_0x489c('0x33')]=_[_0x489c('0x34')](_0xe374e4[_0x489c('0x30')],_0xe374e4[_0x489c('0x31')]);_0x2ddf07[_0x489c('0x36')]=_[_0x489c('0x34')](_0xe374e4[_0x489c('0x30')],qs[_0x489c('0x35')](_0xc8ded3['query'][_0x489c('0x35')]));_0x2ddf07['attributes']=_0x2ddf07[_0x489c('0x36')][_0x489c('0x37')]?_0x2ddf07['attributes']:_0xe374e4[_0x489c('0x30')];if(_0xc8ded3[_0x489c('0x31')][_0x489c('0x42')]){_0x2ddf07['include']=[{'all':!![]}];}_0x2ddf07=_['merge']({},_0x2ddf07,_0xc8ded3[_0x489c('0x40')]);return db[_0x489c('0x41')]['find'](_0x2ddf07)[_0x489c('0x25')](handleEntityNotFound(_0x5d6692,null))[_0x489c('0x25')](respondWithResult(_0x5d6692,null))[_0x489c('0x46')](handleError(_0x5d6692,null));};exports[_0x489c('0x48')]=function(_0x1d4466,_0x81bc95){return db[_0x489c('0x41')][_0x489c('0x48')](_0x1d4466[_0x489c('0x49')],{})[_0x489c('0x25')](function(_0x187ae7){var _0x33ccfc=_0x1d4466[_0x489c('0x4a')][_0x489c('0x4b')]({'plain':!![]});if(!_0x33ccfc)throw new Error(_0x489c('0x4c'));if(_0x33ccfc[_0x489c('0x4d')]===_0x489c('0x4a')){var _0x547926=_0x187ae7[_0x489c('0x4b')]({'plain':!![]});var _0x26c013=_0x489c('0x4e');return db['UserProfileSection'][_0x489c('0x4f')]({'where':{'name':_0x26c013,'userProfileId':_0x33ccfc[_0x489c('0x50')]},'raw':!![]})[_0x489c('0x25')](function(_0x553b4e){if(_0x553b4e&&_0x553b4e['autoAssociation']===0x0){return db[_0x489c('0x26')][_0x489c('0x48')]({'name':_0x547926[_0x489c('0x2a')],'resourceId':_0x547926['id'],'type':_0x553b4e[_0x489c('0x2a')],'sectionId':_0x553b4e['id']},{})['then'](function(){return _0x187ae7;});}else{return _0x187ae7;}})[_0x489c('0x46')](function(_0x216f54){logger['error'](_0x489c('0x51'),_0x216f54);throw _0x216f54;});}return _0x187ae7;})['then'](respondWithResult(_0x81bc95,0xc9))['catch'](handleError(_0x81bc95,null));};exports[_0x489c('0x24')]=function(_0x219d1f,_0x3afdb3){if(_0x219d1f[_0x489c('0x49')]['id']){delete _0x219d1f[_0x489c('0x49')]['id'];}return db[_0x489c('0x41')][_0x489c('0x4f')]({'where':{'id':_0x219d1f[_0x489c('0x47')]['id']}})[_0x489c('0x25')](handleEntityNotFound(_0x3afdb3,null))[_0x489c('0x25')](saveUpdates(_0x219d1f[_0x489c('0x49')],null))[_0x489c('0x25')](respondWithResult(_0x3afdb3,null))['catch'](handleError(_0x3afdb3,null));};exports[_0x489c('0x27')]=function(_0x3752b6,_0x2df0ce){return db['VoiceChanSpy'][_0x489c('0x4f')]({'where':{'id':_0x3752b6['params']['id']}})['then'](handleEntityNotFound(_0x2df0ce,null))[_0x489c('0x25')](removeEntity(_0x2df0ce,null))[_0x489c('0x46')](handleError(_0x2df0ce,null));}; \ No newline at end of file +var _0xa1b9=['intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','model','query','filters'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa1b9,0x71));var _0x9a1b=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa1b9[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];function respondWithStatusCode(_0x27062b,_0x5ee9d3){_0x5ee9d3=_0x5ee9d3||0xcc;return function(_0x1d016d){if(_0x1d016d){return _0x27062b[_0x9a1b('0x1a')](_0x5ee9d3);}return _0x27062b[_0x9a1b('0x1b')](_0x5ee9d3)[_0x9a1b('0x1c')]();};}function respondWithResult(_0x390ad9,_0x157b6f){_0x157b6f=_0x157b6f||0xc8;return function(_0x3fe388){if(_0x3fe388){return _0x390ad9[_0x9a1b('0x1b')](_0x157b6f)[_0x9a1b('0x1d')](_0x3fe388);}};}function respondWithFilteredResult(_0x101622,_0x5c397f){return function(_0x357cd9){if(_0x357cd9){var _0x2440fc=typeof _0x5c397f['offset']===_0x9a1b('0x1e')&&typeof _0x5c397f[_0x9a1b('0x1f')]===_0x9a1b('0x1e');var _0x1a7324=_0x357cd9[_0x9a1b('0x20')];var _0x478626=_0x2440fc?0x0:_0x5c397f[_0x9a1b('0x21')];var _0x599325=_0x2440fc?_0x357cd9[_0x9a1b('0x20')]:_0x5c397f[_0x9a1b('0x21')]+_0x5c397f[_0x9a1b('0x1f')];var _0x1f1dea;if(_0x599325>=_0x1a7324){_0x599325=_0x1a7324;_0x1f1dea=0xc8;}else{_0x1f1dea=0xce;}_0x101622[_0x9a1b('0x1b')](_0x1f1dea);return _0x101622['set'](_0x9a1b('0x22'),_0x478626+'-'+_0x599325+'/'+_0x1a7324)[_0x9a1b('0x1d')](_0x357cd9);}return null;};}function patchUpdates(_0x36c95c){return function(_0x1977a7){try{jsonpatch['apply'](_0x1977a7,_0x36c95c,!![]);}catch(_0x2ccb02){return BPromise[_0x9a1b('0x23')](_0x2ccb02);}return _0x1977a7[_0x9a1b('0x24')]();};}function saveUpdates(_0x13f828,_0x1c9ab3){return function(_0x327cac){if(_0x327cac){return _0x327cac[_0x9a1b('0x25')](_0x13f828)[_0x9a1b('0x26')](function(_0xb6b23a){return _0xb6b23a;});}return null;};}function removeEntity(_0x37971c,_0x5841c1){return function(_0x2439e9){if(_0x2439e9){return _0x2439e9[_0x9a1b('0x27')]()[_0x9a1b('0x26')](function(){var _0x4bb81c=_0x2439e9['get']({'plain':!![]});var _0x3b0ff3='ChanSpies';return db[_0x9a1b('0x28')]['destroy']({'where':{'type':_0x3b0ff3,'resourceId':_0x4bb81c['id']}})['then'](function(){return _0x2439e9;});})['then'](function(){_0x37971c[_0x9a1b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd6b3,_0x116d3e){return function(_0x4983f6){if(!_0x4983f6){_0x2bd6b3[_0x9a1b('0x1a')](0x194);}return _0x4983f6;};}function handleError(_0x44f930,_0x15812d){_0x15812d=_0x15812d||0x1f4;return function(_0x1c13d6){logger[_0x9a1b('0x29')](_0x1c13d6[_0x9a1b('0x2a')]);if(_0x1c13d6[_0x9a1b('0x2b')]){delete _0x1c13d6['name'];}_0x44f930['status'](_0x15812d)[_0x9a1b('0x2c')](_0x1c13d6);};}exports[_0x9a1b('0x2d')]=function(_0x56e6ed,_0x14ea6b){var _0x43c2e7={},_0x4028f0={},_0x3bc034={'count':0x0,'rows':[]};var _0x311432=_[_0x9a1b('0x2e')](db[_0x9a1b('0x2f')][_0x9a1b('0x30')],function(_0x1e7f23){return{'name':_0x1e7f23['fieldName'],'type':_0x1e7f23[_0x9a1b('0x31')]['key']};});_0x4028f0[_0x9a1b('0x32')]=_[_0x9a1b('0x2e')](_0x311432,_0x9a1b('0x2b'));_0x4028f0[_0x9a1b('0x33')]=_['keys'](_0x56e6ed[_0x9a1b('0x33')]);_0x4028f0[_0x9a1b('0x34')]=_[_0x9a1b('0x35')](_0x4028f0[_0x9a1b('0x32')],_0x4028f0[_0x9a1b('0x33')]);_0x43c2e7[_0x9a1b('0x36')]=_[_0x9a1b('0x35')](_0x4028f0[_0x9a1b('0x32')],qs[_0x9a1b('0x37')](_0x56e6ed['query'][_0x9a1b('0x37')]));_0x43c2e7[_0x9a1b('0x36')]=_0x43c2e7[_0x9a1b('0x36')][_0x9a1b('0x38')]?_0x43c2e7[_0x9a1b('0x36')]:_0x4028f0[_0x9a1b('0x32')];if(!_0x56e6ed[_0x9a1b('0x33')]['hasOwnProperty'](_0x9a1b('0x39'))){_0x43c2e7[_0x9a1b('0x1f')]=qs[_0x9a1b('0x1f')](_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x1f')]);_0x43c2e7[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x21')]);}_0x43c2e7['order']=qs[_0x9a1b('0x3a')](_0x56e6ed[_0x9a1b('0x33')]['sort']);_0x43c2e7[_0x9a1b('0x3b')]=qs[_0x9a1b('0x34')](_['pick'](_0x56e6ed['query'],_0x4028f0['filters']),_0x311432);if(_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x3c')]){_0x43c2e7[_0x9a1b('0x3b')]=_[_0x9a1b('0x3d')](_0x43c2e7[_0x9a1b('0x3b')],{'$or':_['map'](_0x311432,function(_0x28cac7){if(_0x28cac7[_0x9a1b('0x31')]!==_0x9a1b('0x3e')){var _0x383003={};_0x383003[_0x28cac7[_0x9a1b('0x2b')]]={'$like':'%'+_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x3c')]+'%'};return _0x383003;}})});}_0x43c2e7=_['merge']({},_0x43c2e7,_0x56e6ed[_0x9a1b('0x3f')]);var _0x1599df={'where':_0x43c2e7['where']};return db[_0x9a1b('0x2f')][_0x9a1b('0x20')](_0x1599df)[_0x9a1b('0x26')](function(_0x69c499){_0x3bc034['count']=_0x69c499;if(_0x56e6ed[_0x9a1b('0x33')][_0x9a1b('0x40')]){_0x43c2e7[_0x9a1b('0x41')]=[{'all':!![]}];}return db[_0x9a1b('0x2f')][_0x9a1b('0x42')](_0x43c2e7);})[_0x9a1b('0x26')](function(_0x515bb8){_0x3bc034[_0x9a1b('0x43')]=_0x515bb8;return _0x3bc034;})[_0x9a1b('0x26')](respondWithFilteredResult(_0x14ea6b,_0x43c2e7))[_0x9a1b('0x44')](handleError(_0x14ea6b,null));};exports['show']=function(_0x1a7c68,_0x3ffa84){var _0x3c1fc3={'raw':![],'where':{'id':_0x1a7c68[_0x9a1b('0x45')]['id']}},_0xd86ff5={};_0xd86ff5[_0x9a1b('0x32')]=_[_0x9a1b('0x46')](db['VoiceChanSpy'][_0x9a1b('0x30')]);_0xd86ff5[_0x9a1b('0x33')]=_[_0x9a1b('0x46')](_0x1a7c68[_0x9a1b('0x33')]);_0xd86ff5['filters']=_[_0x9a1b('0x35')](_0xd86ff5[_0x9a1b('0x32')],_0xd86ff5[_0x9a1b('0x33')]);_0x3c1fc3[_0x9a1b('0x36')]=_[_0x9a1b('0x35')](_0xd86ff5[_0x9a1b('0x32')],qs[_0x9a1b('0x37')](_0x1a7c68['query']['fields']));_0x3c1fc3[_0x9a1b('0x36')]=_0x3c1fc3[_0x9a1b('0x36')]['length']?_0x3c1fc3[_0x9a1b('0x36')]:_0xd86ff5[_0x9a1b('0x32')];if(_0x1a7c68[_0x9a1b('0x33')]['includeAll']){_0x3c1fc3['include']=[{'all':!![]}];}_0x3c1fc3=_['merge']({},_0x3c1fc3,_0x1a7c68[_0x9a1b('0x3f')]);return db[_0x9a1b('0x2f')]['find'](_0x3c1fc3)[_0x9a1b('0x26')](handleEntityNotFound(_0x3ffa84,null))[_0x9a1b('0x26')](respondWithResult(_0x3ffa84,null))['catch'](handleError(_0x3ffa84,null));};exports['create']=function(_0x23e3b8,_0x2ff4b5){return db['VoiceChanSpy'][_0x9a1b('0x47')](_0x23e3b8[_0x9a1b('0x48')],{})[_0x9a1b('0x26')](function(_0x3eab82){var _0x4b0353=_0x23e3b8['user']['get']({'plain':!![]});if(!_0x4b0353)throw new Error(_0x9a1b('0x49'));if(_0x4b0353[_0x9a1b('0x4a')]===_0x9a1b('0x4b')){var _0x3f9c17=_0x3eab82[_0x9a1b('0x4c')]({'plain':!![]});var _0x36bb41=_0x9a1b('0x4d');return db[_0x9a1b('0x4e')][_0x9a1b('0x4f')]({'where':{'name':_0x36bb41,'userProfileId':_0x4b0353[_0x9a1b('0x50')]},'raw':!![]})[_0x9a1b('0x26')](function(_0xd1f1fc){if(_0xd1f1fc&&_0xd1f1fc[_0x9a1b('0x51')]===0x0){return db[_0x9a1b('0x28')]['create']({'name':_0x3f9c17['name'],'resourceId':_0x3f9c17['id'],'type':_0xd1f1fc[_0x9a1b('0x2b')],'sectionId':_0xd1f1fc['id']},{})[_0x9a1b('0x26')](function(){return _0x3eab82;});}else{return _0x3eab82;}})[_0x9a1b('0x44')](function(_0x2ae8f3){logger[_0x9a1b('0x29')](_0x9a1b('0x52'),_0x2ae8f3);throw _0x2ae8f3;});}return _0x3eab82;})[_0x9a1b('0x26')](respondWithResult(_0x2ff4b5,0xc9))[_0x9a1b('0x44')](handleError(_0x2ff4b5,null));};exports[_0x9a1b('0x25')]=function(_0x5c35b7,_0x11b466){if(_0x5c35b7[_0x9a1b('0x48')]['id']){delete _0x5c35b7[_0x9a1b('0x48')]['id'];}return db[_0x9a1b('0x2f')]['find']({'where':{'id':_0x5c35b7[_0x9a1b('0x45')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0x11b466,null))['then'](saveUpdates(_0x5c35b7[_0x9a1b('0x48')],null))['then'](respondWithResult(_0x11b466,null))['catch'](handleError(_0x11b466,null));};exports[_0x9a1b('0x27')]=function(_0x160f22,_0xa6215){return db['VoiceChanSpy'][_0x9a1b('0x4f')]({'where':{'id':_0x160f22[_0x9a1b('0x45')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0xa6215,null))[_0x9a1b('0x26')](removeEntity(_0xa6215,null))[_0x9a1b('0x44')](handleError(_0xa6215,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b1f6190..ba5a78d 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 _0xdc70=['password','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','length','VoiceExtension','bulkCreate','bluebird','./voiceChanSpy.attributes','%s%s','prefix','system','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate'];(function(_0x32aae5,_0x90b20d){var _0x5de8b9=function(_0x4f69f4){while(--_0x4f69f4){_0x32aae5['push'](_0x32aae5['shift']());}};_0x5de8b9(++_0x90b20d);}(_0xdc70,0xec));var _0x0dc7=function(_0x33c14b,_0x4179ed){_0x33c14b=_0x33c14b-0x0;var _0x2ca50d=_0xdc70[_0x33c14b];return _0x2ca50d;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x0dc7('0x0'));var attributes=require(_0x0dc7('0x1'));var getUserApplications=function(_0x13c141,_0x5b56f9,_0x5e4ab5){var _0x53ac0b=0x1;var _0x4e2df0=[];var _0x71bd15={'context':_0x5b56f9['context']||'from-sip','exten':util['format'](_0x0dc7('0x2'),_0x13c141[_0x0dc7('0x3')],_0x5e4ab5),'type':_0x0dc7('0x4'),'isApp':![],'ChanSpyId':_0x13c141['id'],'UserId':_0x5b56f9['id']};_0x4e2df0['push'](_[_0x0dc7('0x5')]({'app':'Set','appdata':util['format'](_0x0dc7('0x6'),_0x0dc7('0x7')),'priority':_0x53ac0b++},_0x71bd15));if(_0x13c141[_0x0dc7('0x8')]){_0x4e2df0[_0x0dc7('0x9')](_[_0x0dc7('0x5')]({'app':_0x0dc7('0xa'),'appdata':util[_0x0dc7('0xb')](_0x0dc7('0xc'),_0x13c141[_0x0dc7('0xd')]),'priority':_0x53ac0b++},_0x71bd15));}if(_0x13c141[_0x0dc7('0xe')]){_0x4e2df0[_0x0dc7('0x9')](_[_0x0dc7('0x5')]({'app':_0x0dc7('0xf'),'appdata':_0x13c141[_0x0dc7('0x10')],'priority':_0x53ac0b++},_0x71bd15));}_0x4e2df0[_0x0dc7('0x9')](_[_0x0dc7('0x5')]({'app':'ChanSpy','appdata':util[_0x0dc7('0xb')](_0x0dc7('0x11'),_0x5b56f9[_0x0dc7('0x12')],_0x13c141[_0x0dc7('0x13')]?_0x13c141[_0x0dc7('0x13')][_0x0dc7('0x14')](''):''),'priority':_0x53ac0b++},_0x71bd15));if(_0x13c141[_0x0dc7('0x8')]){_0x4e2df0[_0x0dc7('0x9')](_[_0x0dc7('0x5')]({'app':_0x0dc7('0x15'),'priority':_0x53ac0b++},_0x71bd15));}return _0x4e2df0;};var getChanSpyApplications=function(_0x247663,_0x492a8b){var _0x55813b=[];for(var _0x4bea86=0x0,_0x124570=0x1;_0x4bea86<_0x492a8b['length'];_0x4bea86++,_0x124570=0x1){_0x55813b=_0x55813b[_0x0dc7('0x16')](getUserApplications(_0x247663,_0x492a8b[_0x4bea86],_0x492a8b[_0x4bea86][_0x0dc7('0x17')]));if(_0x492a8b[_0x4bea86]['internal']!=_0x492a8b[_0x4bea86][_0x0dc7('0x12')]){_0x55813b=_0x55813b[_0x0dc7('0x16')](getUserApplications(_0x247663,_0x492a8b[_0x4bea86],_0x492a8b[_0x4bea86]['name']));}}return _0x55813b;};var getChanSpyPromise=function(_0x54a2a8,_0x2ff90d){return new BPromise(function(_0x9e946d,_0xd4950d){return _0x54a2a8[_0x0dc7('0x18')][_0x0dc7('0x19')]({'attributes':['id',_0x0dc7('0x12'),'internal'],'where':{'role':_0x0dc7('0x1a'),'chanspy':!![]},'raw':!![]})[_0x0dc7('0x1b')](function(_0x4a9f4b){if(_0x4a9f4b){return _0x9e946d(getChanSpyApplications(_0x2ff90d,_0x4a9f4b));}return _0x9e946d([]);})[_0x0dc7('0x1c')](function(_0x2d1c0c){_0xd4950d(_0x2d1c0c);});});};module[_0x0dc7('0x1d')]=function(_0x4cc1ee,_0x511a89){var _0x3e99b5=_0x4cc1ee[_0x0dc7('0x1e')];return _0x4cc1ee[_0x0dc7('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x0dc7('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dd157,_0x539923,_0x4dc606){return getChanSpyPromise(_0x3e99b5,_0x2dd157)[_0x0dc7('0x1b')](function(_0x2c0998){if(_0x2c0998&&_0x2c0998[_0x0dc7('0x21')]){return _0x3e99b5['VoiceExtension']['bulkCreate'](_0x2c0998);}})[_0x0dc7('0x1b')](function(){_0x4dc606();})[_0x0dc7('0x1c')](function(_0x30ec8b){_0x4dc606(_0x30ec8b);});},'afterUpdate':function(_0x56d779,_0x5ade27,_0x2d3cce){return _0x3e99b5['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x56d779['id']}})['then'](function(){return getChanSpyPromise(_0x3e99b5,_0x56d779);})['then'](function(_0x513eb5){if(_0x513eb5&&_0x513eb5[_0x0dc7('0x21')]){return _0x3e99b5[_0x0dc7('0x22')][_0x0dc7('0x23')](_0x513eb5);}})[_0x0dc7('0x1b')](function(){_0x2d3cce();})[_0x0dc7('0x1c')](function(_0xbd0478){_0x2d3cce(_0xbd0478);});},'afterDestroy':function(_0x50ed16,_0x3533d7,_0x554499){return _0x3e99b5['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x50ed16['id']}})[_0x0dc7('0x1b')](function(){_0x554499();})['catch'](function(_0x8b6863){_0x554499(_0x8b6863);});}}});}; \ No newline at end of file +var _0x75f3=['merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','name','User','findAll','internal','agent','then','catch','models','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','util','bluebird','context','format','%s%s','prefix','push'];(function(_0x1914f6,_0x56874c){var _0x5ba267=function(_0x3a0985){while(--_0x3a0985){_0x1914f6['push'](_0x1914f6['shift']());}};_0x5ba267(++_0x56874c);}(_0x75f3,0x17a));var _0x375f=function(_0x1e2c43,_0x1b6ef8){_0x1e2c43=_0x1e2c43-0x0;var _0x1a1467=_0x75f3[_0x1e2c43];return _0x1a1467;};'use strict';var _=require('lodash');var util=require(_0x375f('0x0'));var BPromise=require(_0x375f('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3bcb9c,_0x51fd43,_0x3debfe){var _0x1b1fec=0x1;var _0xe14647=[];var _0x3bd1e7={'context':_0x51fd43[_0x375f('0x2')]||'from-sip','exten':util[_0x375f('0x3')](_0x375f('0x4'),_0x3bcb9c[_0x375f('0x5')],_0x3debfe),'type':'system','isApp':![],'ChanSpyId':_0x3bcb9c['id'],'UserId':_0x51fd43['id']};_0xe14647[_0x375f('0x6')](_[_0x375f('0x7')]({'app':'Set','appdata':util[_0x375f('0x3')](_0x375f('0x8'),'chanspy'),'priority':_0x1b1fec++},_0x3bd1e7));if(_0x3bcb9c[_0x375f('0x9')]){_0xe14647[_0x375f('0x6')](_[_0x375f('0x7')]({'app':_0x375f('0xa'),'appdata':util['format'](_0x375f('0xb'),_0x3bcb9c[_0x375f('0xc')]),'priority':_0x1b1fec++},_0x3bd1e7));}if(_0x3bcb9c[_0x375f('0xd')]){_0xe14647['push'](_[_0x375f('0x7')]({'app':_0x375f('0xe'),'appdata':_0x3bcb9c[_0x375f('0xf')],'priority':_0x1b1fec++},_0x3bd1e7));}_0xe14647['push'](_[_0x375f('0x7')]({'app':_0x375f('0x10'),'appdata':util['format'](_0x375f('0x11'),_0x51fd43['name'],_0x3bcb9c[_0x375f('0x12')]?_0x3bcb9c[_0x375f('0x12')][_0x375f('0x13')](''):''),'priority':_0x1b1fec++},_0x3bd1e7));if(_0x3bcb9c[_0x375f('0x9')]){_0xe14647['push'](_[_0x375f('0x7')]({'app':_0x375f('0x14'),'priority':_0x1b1fec++},_0x3bd1e7));}return _0xe14647;};var getChanSpyApplications=function(_0xfab572,_0x4e5151){var _0x366f25=[];for(var _0x1b61a4=0x0,_0x62def3=0x1;_0x1b61a4<_0x4e5151[_0x375f('0x15')];_0x1b61a4++,_0x62def3=0x1){_0x366f25=_0x366f25[_0x375f('0x16')](getUserApplications(_0xfab572,_0x4e5151[_0x1b61a4],_0x4e5151[_0x1b61a4]['internal']));if(_0x4e5151[_0x1b61a4]['internal']!=_0x4e5151[_0x1b61a4][_0x375f('0x17')]){_0x366f25=_0x366f25['concat'](getUserApplications(_0xfab572,_0x4e5151[_0x1b61a4],_0x4e5151[_0x1b61a4]['name']));}}return _0x366f25;};var getChanSpyPromise=function(_0x1a70df,_0x46b304){return new BPromise(function(_0x59445a,_0x163c28){return _0x1a70df[_0x375f('0x18')][_0x375f('0x19')]({'attributes':['id',_0x375f('0x17'),_0x375f('0x1a')],'where':{'role':_0x375f('0x1b'),'chanspy':!![]},'raw':!![]})[_0x375f('0x1c')](function(_0x51f972){if(_0x51f972){return _0x59445a(getChanSpyApplications(_0x46b304,_0x51f972));}return _0x59445a([]);})[_0x375f('0x1d')](function(_0x132f5f){_0x163c28(_0x132f5f);});});};module['exports']=function(_0x2bea0b,_0x431dc8){var _0x1ecafb=_0x2bea0b[_0x375f('0x1e')];return _0x2bea0b['define'](_0x375f('0x1f'),attributes,{'tableName':_0x375f('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x582fbd,_0xd3f3e5,_0x192461){return getChanSpyPromise(_0x1ecafb,_0x582fbd)[_0x375f('0x1c')](function(_0x9618d8){if(_0x9618d8&&_0x9618d8[_0x375f('0x15')]){return _0x1ecafb['VoiceExtension'][_0x375f('0x21')](_0x9618d8);}})[_0x375f('0x1c')](function(){_0x192461();})[_0x375f('0x1d')](function(_0x23b7fe){_0x192461(_0x23b7fe);});},'afterUpdate':function(_0x392b29,_0xfa66c5,_0x464ec9){return _0x1ecafb[_0x375f('0x22')]['destroy']({'where':{'ChanSpyId':_0x392b29['id']}})[_0x375f('0x1c')](function(){return getChanSpyPromise(_0x1ecafb,_0x392b29);})[_0x375f('0x1c')](function(_0x4d4a71){if(_0x4d4a71&&_0x4d4a71[_0x375f('0x15')]){return _0x1ecafb['VoiceExtension'][_0x375f('0x21')](_0x4d4a71);}})[_0x375f('0x1c')](function(){_0x464ec9();})[_0x375f('0x1d')](function(_0x41197a){_0x464ec9(_0x41197a);});},'afterDestroy':function(_0x725086,_0x2f826b,_0x111d63){return _0x1ecafb[_0x375f('0x22')]['destroy']({'where':{'ChanSpyId':_0x725086['id']}})['then'](function(){_0x111d63();})[_0x375f('0x1d')](function(_0x504e0f){_0x111d63(_0x504e0f);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fa3813b..caa8a80 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 _0x74f0=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x74f0,0xf3));var _0x074f=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x74f0[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});} \ No newline at end of file +var _0x19ea=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x16fe0d,_0x6e648a){var _0x5230c8=function(_0x43815a){while(--_0x43815a){_0x16fe0d['push'](_0x16fe0d['shift']());}};_0x5230c8(++_0x6e648a);}(_0x19ea,0xfe));var _0xa19e=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x19ea[_0x365be9];return _0x185c12;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f5ff05f..60052fa 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 _0x0857=['./voiceContext.controller','get','index','isAuthenticated','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xd734c5,_0x2d6668){var _0x169b64=function(_0x27e446){while(--_0x27e446){_0xd734c5['push'](_0xd734c5['shift']());}};_0x169b64(++_0x2d6668);}(_0x0857,0x91));var _0x7085=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x0857[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require(_0x7085('0x0'));var path=require(_0x7085('0x1'));var timeout=require(_0x7085('0x2'));var express=require(_0x7085('0x3'));var router=express[_0x7085('0x4')]();var fs_extra=require(_0x7085('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7085('0x6'));var config=require(_0x7085('0x7'));var controller=require(_0x7085('0x8'));router[_0x7085('0x9')]('/',auth['isAuthenticated'](),controller[_0x7085('0xa')]);router['get']('/:id',auth[_0x7085('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7085('0xc')](_0x7085('0xd'),auth[_0x7085('0xb')](),controller[_0x7085('0xe')]);router['delete'](_0x7085('0xd'),auth[_0x7085('0xb')](),controller[_0x7085('0xf')]);module[_0x7085('0x10')]=router; \ No newline at end of file +var _0x25a7=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','multer','util'];(function(_0x5106c9,_0xdbb539){var _0x207f72=function(_0x12c8bc){while(--_0x12c8bc){_0x5106c9['push'](_0x5106c9['shift']());}};_0x207f72(++_0xdbb539);}(_0x25a7,0xb9));var _0x725a=function(_0x623ac3,_0xc0d039){_0x623ac3=_0x623ac3-0x0;var _0x2a4b2c=_0x25a7[_0x623ac3];return _0x2a4b2c;};'use strict';var multer=require(_0x725a('0x0'));var util=require(_0x725a('0x1'));var path=require(_0x725a('0x2'));var timeout=require('connect-timeout');var express=require(_0x725a('0x3'));var router=express[_0x725a('0x4')]();var fs_extra=require(_0x725a('0x5'));var auth=require(_0x725a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x725a('0x7'));var controller=require(_0x725a('0x8'));router[_0x725a('0x9')]('/',auth[_0x725a('0xa')](),controller[_0x725a('0xb')]);router['get'](_0x725a('0xc'),auth[_0x725a('0xa')](),controller['show']);router[_0x725a('0xd')]('/',auth[_0x725a('0xa')](),controller['create']);router[_0x725a('0xe')](_0x725a('0xc'),auth[_0x725a('0xa')](),controller['update']);router[_0x725a('0xf')](_0x725a('0xc'),auth['isAuthenticated'](),controller[_0x725a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1a7e341..f67a57e 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 _0x381b=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0x10206b,_0x2e0ade){var _0x58baaf=function(_0xd9bfa9){while(--_0xd9bfa9){_0x10206b['push'](_0x10206b['shift']());}};_0x58baaf(++_0x2e0ade);}(_0x381b,0xc9));var _0xb381=function(_0x31e584,_0x4d9f7f){_0x31e584=_0x31e584-0x0;var _0x5686d0=_0x381b[_0x31e584];return _0x5686d0;};'use strict';var Sequelize=require(_0xb381('0x0'));module[_0xb381('0x1')]={'name':{'type':Sequelize[_0xb381('0x2')],'unique':_0xb381('0x3')},'description':{'type':Sequelize[_0xb381('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb381('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2fde=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x2fde,0x8a));var _0xe2fd=function(_0x5842db,_0x21ff7a){_0x5842db=_0x5842db-0x0;var _0x5ccaa5=_0x2fde[_0x5842db];return _0x5ccaa5;};'use strict';var Sequelize=require(_0xe2fd('0x0'));module[_0xe2fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe2fd('0x2')},'description':{'type':Sequelize[_0xe2fd('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe2fd('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 4de4474..d2cb31c 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 _0x25af=['find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','root','utf8','destroy','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','Contexts','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','length','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','fields','create','body','readFileSync','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','role'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x25af,0x140));var _0xf25a=function(_0x38b3b4,_0x45d75a){_0x38b3b4=_0x38b3b4-0x0;var _0x3dd296=_0x25af[_0x38b3b4];return _0x3dd296;};'use strict';var emlformat=require(_0xf25a('0x0'));var rimraf=require(_0xf25a('0x1'));var zipdir=require(_0xf25a('0x2'));var jsonpatch=require(_0xf25a('0x3'));var rp=require(_0xf25a('0x4'));var moment=require(_0xf25a('0x5'));var BPromise=require(_0xf25a('0x6'));var Mustache=require(_0xf25a('0x7'));var util=require('util');var path=require(_0xf25a('0x8'));var sox=require(_0xf25a('0x9'));var csv=require(_0xf25a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf25a('0xb'));var _=require(_0xf25a('0xc'));var squel=require(_0xf25a('0xd'));var crypto=require('crypto');var jsforce=require(_0xf25a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf25a('0xa'));var querystring=require('querystring');var Papa=require(_0xf25a('0xf'));var Redis=require('ioredis');var authService=require(_0xf25a('0x10'));var qs=require(_0xf25a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf25a('0x12'))(_0xf25a('0x13'));var utils=require(_0xf25a('0x14'));var config=require(_0xf25a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf25a('0x16'))['db'];var jayson=require(_0xf25a('0x17'));var client=jayson[_0xf25a('0x18')][_0xf25a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5ec3dd,_0x4c20c7,_0x3ba4d4,_0x3e37d5){return new BPromise(function(_0x5cb472,_0x45ab6c){var _0x50694b=_0x3e37d5||client;return _0x50694b[_0xf25a('0x1a')](_0x5ec3dd,_0x3ba4d4)[_0xf25a('0x1b')](function(_0x398fe4){logger['info'](_0xf25a('0x1c'),_0x4c20c7,_0xf25a('0x1d'));logger[_0xf25a('0x1e')](_0xf25a('0x1f'),_0x4c20c7,'request\x20sent',JSON[_0xf25a('0x20')](_0x398fe4));if(_0x398fe4[_0xf25a('0x21')]){if(_0x398fe4[_0xf25a('0x21')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4c20c7,_0x398fe4['error'][_0xf25a('0x22')]);return _0x45ab6c(_0x398fe4[_0xf25a('0x21')]['message']);}logger['error'](_0xf25a('0x1c'),_0x4c20c7,_0x398fe4[_0xf25a('0x21')][_0xf25a('0x22')]);return _0x5cb472(_0x398fe4[_0xf25a('0x21')][_0xf25a('0x22')]);}else{logger['info'](_0xf25a('0x1c'),_0x4c20c7,_0xf25a('0x1d'));_0x5cb472(_0x398fe4[_0xf25a('0x23')][_0xf25a('0x22')]);}})[_0xf25a('0x24')](function(_0x44b3f5){logger['error'](_0xf25a('0x1c'),_0x4c20c7,_0x44b3f5);_0x45ab6c(_0x44b3f5);});});}function respondWithStatusCode(_0x24ab8d,_0x5255a5){_0x5255a5=_0x5255a5||0xcc;return function(_0x25de0f){if(_0x25de0f){return _0x24ab8d[_0xf25a('0x25')](_0x5255a5);}return _0x24ab8d['status'](_0x5255a5)[_0xf25a('0x26')]();};}function respondWithResult(_0x231dbe,_0x36112a){_0x36112a=_0x36112a||0xc8;return function(_0x3d6875){if(_0x3d6875){return _0x231dbe[_0xf25a('0x27')](_0x36112a)['json'](_0x3d6875);}};}function respondWithFilteredResult(_0x113f9c,_0x2d9fe6){return function(_0x36b576){if(_0x36b576){var _0xa74882=typeof _0x2d9fe6[_0xf25a('0x28')]==='undefined'&&typeof _0x2d9fe6[_0xf25a('0x29')]===_0xf25a('0x2a');var _0x1d2abd=_0x36b576[_0xf25a('0x2b')];var _0xd78e08=_0xa74882?0x0:_0x2d9fe6['offset'];var _0x340683=_0xa74882?_0x36b576[_0xf25a('0x2b')]:_0x2d9fe6[_0xf25a('0x28')]+_0x2d9fe6['limit'];var _0x3f287e;if(_0x340683>=_0x1d2abd){_0x340683=_0x1d2abd;_0x3f287e=0xc8;}else{_0x3f287e=0xce;}_0x113f9c[_0xf25a('0x27')](_0x3f287e);return _0x113f9c[_0xf25a('0x2c')](_0xf25a('0x2d'),_0xd78e08+'-'+_0x340683+'/'+_0x1d2abd)[_0xf25a('0x2e')](_0x36b576);}return null;};}function patchUpdates(_0x180ad7){return function(_0x4c216a){try{jsonpatch[_0xf25a('0x2f')](_0x4c216a,_0x180ad7,!![]);}catch(_0x10a332){return BPromise[_0xf25a('0x30')](_0x10a332);}return _0x4c216a['save']();};}function saveUpdates(_0x513a1,_0x5f079a){return function(_0x3de34a){if(_0x3de34a){return _0x3de34a['update'](_0x513a1)[_0xf25a('0x1b')](function(_0x58c0dd){return _0x58c0dd;});}return null;};}function removeEntity(_0x244347,_0x349e69){return function(_0x4aa692){if(_0x4aa692){return _0x4aa692['destroy']()[_0xf25a('0x1b')](function(){var _0x3d4bac=_0x4aa692['get']({'plain':!![]});var _0x282611=_0xf25a('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x282611,'resourceId':_0x3d4bac['id']}})[_0xf25a('0x1b')](function(){return _0x4aa692;});})[_0xf25a('0x1b')](function(){_0x244347['status'](0xcc)[_0xf25a('0x26')]();});}};}function handleEntityNotFound(_0x289d49,_0x1d8852){return function(_0x449792){if(!_0x449792){_0x289d49[_0xf25a('0x25')](0x194);}return _0x449792;};}function handleError(_0x5c5897,_0x1474df){_0x1474df=_0x1474df||0x1f4;return function(_0x128684){logger[_0xf25a('0x21')](_0x128684[_0xf25a('0x32')]);if(_0x128684[_0xf25a('0x33')]){delete _0x128684[_0xf25a('0x33')];}_0x5c5897['status'](_0x1474df)[_0xf25a('0x34')](_0x128684);};}exports['index']=function(_0xbc0f12,_0x32f2bd){var _0x6c5705={},_0x42947b={},_0x52fb61={'count':0x0,'rows':[]};var _0x145026=_[_0xf25a('0x35')](db[_0xf25a('0x36')][_0xf25a('0x37')],function(_0x5916c9){return{'name':_0x5916c9[_0xf25a('0x38')],'type':_0x5916c9[_0xf25a('0x39')][_0xf25a('0x3a')]};});_0x42947b['model']=_[_0xf25a('0x35')](_0x145026,_0xf25a('0x33'));_0x42947b['query']=_[_0xf25a('0x3b')](_0xbc0f12[_0xf25a('0x3c')]);_0x42947b['filters']=_[_0xf25a('0x3d')](_0x42947b[_0xf25a('0x3e')],_0x42947b[_0xf25a('0x3c')]);_0x6c5705[_0xf25a('0x3f')]=_['intersection'](_0x42947b[_0xf25a('0x3e')],qs['fields'](_0xbc0f12[_0xf25a('0x3c')]['fields']));_0x6c5705[_0xf25a('0x3f')]=_0x6c5705[_0xf25a('0x3f')][_0xf25a('0x40')]?_0x6c5705[_0xf25a('0x3f')]:_0x42947b['model'];if(!_0xbc0f12[_0xf25a('0x3c')]['hasOwnProperty'](_0xf25a('0x41'))){_0x6c5705[_0xf25a('0x29')]=qs[_0xf25a('0x29')](_0xbc0f12['query'][_0xf25a('0x29')]);_0x6c5705['offset']=qs['offset'](_0xbc0f12[_0xf25a('0x3c')][_0xf25a('0x28')]);}_0x6c5705[_0xf25a('0x42')]=qs['sort'](_0xbc0f12['query']['sort']);_0x6c5705[_0xf25a('0x43')]=qs[_0xf25a('0x44')](_[_0xf25a('0x45')](_0xbc0f12[_0xf25a('0x3c')],_0x42947b[_0xf25a('0x44')]),_0x145026);if(_0xbc0f12[_0xf25a('0x3c')][_0xf25a('0x46')]){_0x6c5705[_0xf25a('0x43')]=_['merge'](_0x6c5705[_0xf25a('0x43')],{'$or':_['map'](_0x145026,function(_0x5dc392){if(_0x5dc392[_0xf25a('0x39')]!==_0xf25a('0x47')){var _0x2a302b={};_0x2a302b[_0x5dc392[_0xf25a('0x33')]]={'$like':'%'+_0xbc0f12[_0xf25a('0x3c')]['filter']+'%'};return _0x2a302b;}})});}_0x6c5705=_[_0xf25a('0x48')]({},_0x6c5705,_0xbc0f12[_0xf25a('0x49')]);var _0x26f0e0={'where':_0x6c5705['where']};return db['VoiceContext'][_0xf25a('0x2b')](_0x26f0e0)[_0xf25a('0x1b')](function(_0x9695bd){_0x52fb61[_0xf25a('0x2b')]=_0x9695bd;if(_0xbc0f12[_0xf25a('0x3c')][_0xf25a('0x4a')]){_0x6c5705[_0xf25a('0x4b')]=[{'all':!![]}];}return db[_0xf25a('0x36')][_0xf25a('0x4c')](_0x6c5705);})[_0xf25a('0x1b')](function(_0x41b813){_0x52fb61[_0xf25a('0x4d')]=_0x41b813;return _0x52fb61;})[_0xf25a('0x1b')](respondWithFilteredResult(_0x32f2bd,_0x6c5705))[_0xf25a('0x24')](handleError(_0x32f2bd,null));};exports[_0xf25a('0x4e')]=function(_0x3f6de1,_0xf4de2d){var _0x5da827={'raw':![],'where':{'id':_0x3f6de1[_0xf25a('0x4f')]['id']}},_0xda2312={};_0xda2312[_0xf25a('0x3e')]=_[_0xf25a('0x3b')](db[_0xf25a('0x36')][_0xf25a('0x37')]);_0xda2312['query']=_[_0xf25a('0x3b')](_0x3f6de1[_0xf25a('0x3c')]);_0xda2312['filters']=_[_0xf25a('0x3d')](_0xda2312[_0xf25a('0x3e')],_0xda2312[_0xf25a('0x3c')]);_0x5da827[_0xf25a('0x3f')]=_['intersection'](_0xda2312['model'],qs[_0xf25a('0x50')](_0x3f6de1[_0xf25a('0x3c')][_0xf25a('0x50')]));_0x5da827[_0xf25a('0x3f')]=_0x5da827[_0xf25a('0x3f')][_0xf25a('0x40')]?_0x5da827[_0xf25a('0x3f')]:_0xda2312['model'];if(_0x3f6de1['query'][_0xf25a('0x4a')]){_0x5da827['include']=[{'all':!![]}];}_0x5da827=_['merge']({},_0x5da827,_0x3f6de1[_0xf25a('0x49')]);return db[_0xf25a('0x36')]['find'](_0x5da827)['then'](handleEntityNotFound(_0xf4de2d,null))[_0xf25a('0x1b')](respondWithResult(_0xf4de2d,null))[_0xf25a('0x24')](handleError(_0xf4de2d,null));};exports['create']=function(_0x4beb02,_0x4e8dd4,_0x6e5605){var _0x3ac0c4;return db[_0xf25a('0x36')][_0xf25a('0x51')](_0x4beb02[_0xf25a('0x52')],{'raw':!![]})[_0xf25a('0x1b')](function(_0x3b5363){_0x3ac0c4=_0x3b5363;return db[_0xf25a('0x36')][_0xf25a('0x4c')]({'raw':!![]});})[_0xf25a('0x1b')](function(_0x1d1dc2){var _0x33045b=fs[_0xf25a('0x53')](path['join'](config['root'],_0xf25a('0x54')),'utf8');var _0x3459b1=ejs[_0xf25a('0x55')](_0x33045b,{'contexts':_0x1d1dc2||[]});fs[_0xf25a('0x56')](_0xf25a('0x57'),_0x3459b1);})[_0xf25a('0x1b')](function(){return respondWithRpcPromise(_0xf25a('0x58'),_0xf25a('0x51'),{'module':'chan_sip.so'});})[_0xf25a('0x1b')](function(){var _0x44a5c5=_0x4beb02[_0xf25a('0x59')][_0xf25a('0x5a')]({'plain':!![]});if(!_0x44a5c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44a5c5[_0xf25a('0x5b')]===_0xf25a('0x59')){var _0x54d4ef=_0x3ac0c4[_0xf25a('0x5a')]({'plain':!![]});return db['UserProfileSection'][_0xf25a('0x5c')]({'where':{'name':_0xf25a('0x31'),'userProfileId':_0x44a5c5[_0xf25a('0x5d')]},'raw':!![]})[_0xf25a('0x1b')](function(_0x19b417){if(_0x19b417&&_0x19b417[_0xf25a('0x5e')]===0x0){return db[_0xf25a('0x5f')][_0xf25a('0x51')]({'name':_0x54d4ef[_0xf25a('0x33')],'resourceId':_0x54d4ef['id'],'type':_0x19b417[_0xf25a('0x33')],'sectionId':_0x19b417['id']},{})[_0xf25a('0x1b')](function(){return _0x3ac0c4;});}else{return _0x3ac0c4;}})['catch'](function(_0x2b7781){logger[_0xf25a('0x21')](_0xf25a('0x60'),_0x2b7781);throw _0x2b7781;});}return _0x3ac0c4;})[_0xf25a('0x1b')](respondWithResult(_0x4e8dd4,0xc9))[_0xf25a('0x24')](handleError(_0x4e8dd4,null));};exports[_0xf25a('0x61')]=function(_0x1ba14e,_0x2c74d6,_0x30362d){var _0x222870;return db['VoiceContext'][_0xf25a('0x5c')]({'where':{'id':_0x1ba14e[_0xf25a('0x4f')]['id']}})[_0xf25a('0x1b')](handleEntityNotFound(_0x2c74d6,null))[_0xf25a('0x1b')](saveUpdates(_0x1ba14e['body'],null))[_0xf25a('0x1b')](function(_0x6236dd){if(_0x6236dd){_0x222870=_0x6236dd;return db[_0xf25a('0x36')][_0xf25a('0x4c')]({'raw':!![]});}})['then'](function(_0x4bd69b){var _0x153a8f=fs[_0xf25a('0x53')](path[_0xf25a('0x62')](config[_0xf25a('0x63')],'server/files/templates/context.ejs'),_0xf25a('0x64'));var _0x5c029b=ejs[_0xf25a('0x55')](_0x153a8f,{'contexts':_0x4bd69b||[]});fs[_0xf25a('0x56')](_0xf25a('0x57'),_0x5c029b);})['then'](function(){return respondWithRpcPromise(_0xf25a('0x58'),'update',{'module':'chan_sip.so'});})[_0xf25a('0x1b')](function(){return _0x222870;})[_0xf25a('0x1b')](respondWithResult(_0x2c74d6,null))[_0xf25a('0x24')](handleError(_0x2c74d6,null));};exports[_0xf25a('0x65')]=function(_0x85043b,_0x201335,_0x16b07a){var _0x5761e8;return db[_0xf25a('0x36')]['find']({'where':{'id':_0x85043b[_0xf25a('0x4f')]['id']}})[_0xf25a('0x1b')](handleEntityNotFound(_0x201335,null))[_0xf25a('0x1b')](removeEntity(_0x201335,null))[_0xf25a('0x1b')](function(){return db[_0xf25a('0x36')]['findAll']({'raw':!![]});})[_0xf25a('0x1b')](function(_0x49d0d5){var _0x55d7e3=fs['readFileSync'](path[_0xf25a('0x62')](config[_0xf25a('0x63')],'server/files/templates/context.ejs'),'utf8');var _0x1d8d89=ejs['render'](_0x55d7e3,{'contexts':_0x49d0d5});fs[_0xf25a('0x56')](_0xf25a('0x57'),_0x1d8d89);return respondWithRpcPromise('Reload',_0xf25a('0x65'),{'module':_0xf25a('0x66')});})['catch'](handleError(_0x201335,null));}; \ No newline at end of file +var _0x8c11=['squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Contexts','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','merge','filter','VoiceContext','includeAll','include','rows','catch','show','params','length','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','findAll','writeFileSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x2fb0b5,_0x52ee98){var _0x4c7090=function(_0x4f0b3b){while(--_0x4f0b3b){_0x2fb0b5['push'](_0x2fb0b5['shift']());}};_0x4c7090(++_0x52ee98);}(_0x8c11,0xb6));var _0x18c1=function(_0x52b920,_0x1263b9){_0x52b920=_0x52b920-0x0;var _0x399490=_0x8c11[_0x52b920];return _0x399490;};'use strict';var emlformat=require(_0x18c1('0x0'));var rimraf=require(_0x18c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18c1('0x2'));var rp=require(_0x18c1('0x3'));var moment=require(_0x18c1('0x4'));var BPromise=require(_0x18c1('0x5'));var Mustache=require(_0x18c1('0x6'));var util=require(_0x18c1('0x7'));var path=require('path');var sox=require(_0x18c1('0x8'));var csv=require(_0x18c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18c1('0xa'));var _=require(_0x18c1('0xb'));var squel=require(_0x18c1('0xc'));var crypto=require(_0x18c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18c1('0x9'));var querystring=require(_0x18c1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x18c1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x18c1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18c1('0x11'))('api');var utils=require(_0x18c1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x18c1('0x13'));var db=require(_0x18c1('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x18c1('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x372f57,_0x4c5607,_0x46039c,_0x4a70c4){return new BPromise(function(_0x132c9,_0x3eda19){var _0x5a68a7=_0x4a70c4||client;return _0x5a68a7[_0x18c1('0x16')](_0x372f57,_0x46039c)['then'](function(_0x512f31){logger[_0x18c1('0x17')](_0x18c1('0x18'),_0x4c5607,_0x18c1('0x19'));logger['debug'](_0x18c1('0x1a'),_0x4c5607,'request\x20sent',JSON[_0x18c1('0x1b')](_0x512f31));if(_0x512f31[_0x18c1('0x1c')]){if(_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1d')]===0x1f4){logger[_0x18c1('0x1c')](_0x18c1('0x18'),_0x4c5607,_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);return _0x3eda19(_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);}logger[_0x18c1('0x1c')](_0x18c1('0x18'),_0x4c5607,_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);return _0x132c9(_0x512f31[_0x18c1('0x1c')][_0x18c1('0x1e')]);}else{logger[_0x18c1('0x17')](_0x18c1('0x18'),_0x4c5607,'request\x20sent');_0x132c9(_0x512f31[_0x18c1('0x1f')]['message']);}})['catch'](function(_0x2162f9){logger[_0x18c1('0x1c')](_0x18c1('0x18'),_0x4c5607,_0x2162f9);_0x3eda19(_0x2162f9);});});}function respondWithStatusCode(_0x796df2,_0x47702b){_0x47702b=_0x47702b||0xcc;return function(_0x33e505){if(_0x33e505){return _0x796df2['sendStatus'](_0x47702b);}return _0x796df2[_0x18c1('0x20')](_0x47702b)[_0x18c1('0x21')]();};}function respondWithResult(_0x2de090,_0x454ef3){_0x454ef3=_0x454ef3||0xc8;return function(_0x48c55b){if(_0x48c55b){return _0x2de090['status'](_0x454ef3)[_0x18c1('0x22')](_0x48c55b);}};}function respondWithFilteredResult(_0x31bff5,_0x571313){return function(_0x445d16){if(_0x445d16){var _0x5bd2e0=typeof _0x571313[_0x18c1('0x23')]===_0x18c1('0x24')&&typeof _0x571313['limit']===_0x18c1('0x24');var _0x3a6d93=_0x445d16['count'];var _0x4fd118=_0x5bd2e0?0x0:_0x571313[_0x18c1('0x23')];var _0x216d5b=_0x5bd2e0?_0x445d16[_0x18c1('0x25')]:_0x571313[_0x18c1('0x23')]+_0x571313[_0x18c1('0x26')];var _0x3784c7;if(_0x216d5b>=_0x3a6d93){_0x216d5b=_0x3a6d93;_0x3784c7=0xc8;}else{_0x3784c7=0xce;}_0x31bff5[_0x18c1('0x20')](_0x3784c7);return _0x31bff5[_0x18c1('0x27')](_0x18c1('0x28'),_0x4fd118+'-'+_0x216d5b+'/'+_0x3a6d93)['json'](_0x445d16);}return null;};}function patchUpdates(_0x2b61f9){return function(_0x131a9b){try{jsonpatch[_0x18c1('0x29')](_0x131a9b,_0x2b61f9,!![]);}catch(_0x142508){return BPromise[_0x18c1('0x2a')](_0x142508);}return _0x131a9b[_0x18c1('0x2b')]();};}function saveUpdates(_0x9098f5,_0x26142d){return function(_0x226f1f){if(_0x226f1f){return _0x226f1f[_0x18c1('0x2c')](_0x9098f5)['then'](function(_0x29d78e){return _0x29d78e;});}return null;};}function removeEntity(_0x34ea0e,_0x4aaba2){return function(_0x2587ae){if(_0x2587ae){return _0x2587ae[_0x18c1('0x2d')]()[_0x18c1('0x2e')](function(){var _0x542ba4=_0x2587ae[_0x18c1('0x2f')]({'plain':!![]});var _0x13824c=_0x18c1('0x30');return db[_0x18c1('0x31')][_0x18c1('0x2d')]({'where':{'type':_0x13824c,'resourceId':_0x542ba4['id']}})[_0x18c1('0x2e')](function(){return _0x2587ae;});})[_0x18c1('0x2e')](function(){_0x34ea0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19459a,_0x54d996){return function(_0x56ad12){if(!_0x56ad12){_0x19459a[_0x18c1('0x32')](0x194);}return _0x56ad12;};}function handleError(_0x729489,_0x558b4d){_0x558b4d=_0x558b4d||0x1f4;return function(_0x5e53dc){logger['error'](_0x5e53dc['stack']);if(_0x5e53dc['name']){delete _0x5e53dc[_0x18c1('0x33')];}_0x729489[_0x18c1('0x20')](_0x558b4d)[_0x18c1('0x34')](_0x5e53dc);};}exports[_0x18c1('0x35')]=function(_0x375a0e,_0x327df0){var _0x5c148e={},_0x4c3cee={},_0x42bdc0={'count':0x0,'rows':[]};var _0x38b539=_[_0x18c1('0x36')](db['VoiceContext'][_0x18c1('0x37')],function(_0x2f58e9){return{'name':_0x2f58e9['fieldName'],'type':_0x2f58e9[_0x18c1('0x38')][_0x18c1('0x39')]};});_0x4c3cee['model']=_[_0x18c1('0x36')](_0x38b539,_0x18c1('0x33'));_0x4c3cee[_0x18c1('0x3a')]=_[_0x18c1('0x3b')](_0x375a0e[_0x18c1('0x3a')]);_0x4c3cee[_0x18c1('0x3c')]=_[_0x18c1('0x3d')](_0x4c3cee[_0x18c1('0x3e')],_0x4c3cee[_0x18c1('0x3a')]);_0x5c148e[_0x18c1('0x3f')]=_[_0x18c1('0x3d')](_0x4c3cee[_0x18c1('0x3e')],qs[_0x18c1('0x40')](_0x375a0e['query'][_0x18c1('0x40')]));_0x5c148e['attributes']=_0x5c148e[_0x18c1('0x3f')]['length']?_0x5c148e[_0x18c1('0x3f')]:_0x4c3cee[_0x18c1('0x3e')];if(!_0x375a0e[_0x18c1('0x3a')]['hasOwnProperty'](_0x18c1('0x41'))){_0x5c148e['limit']=qs[_0x18c1('0x26')](_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x26')]);_0x5c148e[_0x18c1('0x23')]=qs[_0x18c1('0x23')](_0x375a0e[_0x18c1('0x3a')]['offset']);}_0x5c148e['order']=qs[_0x18c1('0x42')](_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x42')]);_0x5c148e[_0x18c1('0x43')]=qs['filters'](_['pick'](_0x375a0e[_0x18c1('0x3a')],_0x4c3cee['filters']),_0x38b539);if(_0x375a0e[_0x18c1('0x3a')]['filter']){_0x5c148e[_0x18c1('0x43')]=_[_0x18c1('0x44')](_0x5c148e[_0x18c1('0x43')],{'$or':_[_0x18c1('0x36')](_0x38b539,function(_0x484391){if(_0x484391[_0x18c1('0x38')]!=='VIRTUAL'){var _0x495507={};_0x495507[_0x484391[_0x18c1('0x33')]]={'$like':'%'+_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x45')]+'%'};return _0x495507;}})});}_0x5c148e=_[_0x18c1('0x44')]({},_0x5c148e,_0x375a0e['options']);var _0x297535={'where':_0x5c148e['where']};return db[_0x18c1('0x46')][_0x18c1('0x25')](_0x297535)[_0x18c1('0x2e')](function(_0x1b449d){_0x42bdc0[_0x18c1('0x25')]=_0x1b449d;if(_0x375a0e[_0x18c1('0x3a')][_0x18c1('0x47')]){_0x5c148e[_0x18c1('0x48')]=[{'all':!![]}];}return db[_0x18c1('0x46')]['findAll'](_0x5c148e);})[_0x18c1('0x2e')](function(_0x4ba77c){_0x42bdc0[_0x18c1('0x49')]=_0x4ba77c;return _0x42bdc0;})[_0x18c1('0x2e')](respondWithFilteredResult(_0x327df0,_0x5c148e))[_0x18c1('0x4a')](handleError(_0x327df0,null));};exports[_0x18c1('0x4b')]=function(_0x4f0b6b,_0x40035c){var _0xa2c59c={'raw':![],'where':{'id':_0x4f0b6b[_0x18c1('0x4c')]['id']}},_0x2fa91f={};_0x2fa91f['model']=_[_0x18c1('0x3b')](db['VoiceContext'][_0x18c1('0x37')]);_0x2fa91f[_0x18c1('0x3a')]=_[_0x18c1('0x3b')](_0x4f0b6b[_0x18c1('0x3a')]);_0x2fa91f['filters']=_[_0x18c1('0x3d')](_0x2fa91f[_0x18c1('0x3e')],_0x2fa91f[_0x18c1('0x3a')]);_0xa2c59c[_0x18c1('0x3f')]=_[_0x18c1('0x3d')](_0x2fa91f[_0x18c1('0x3e')],qs[_0x18c1('0x40')](_0x4f0b6b[_0x18c1('0x3a')][_0x18c1('0x40')]));_0xa2c59c[_0x18c1('0x3f')]=_0xa2c59c[_0x18c1('0x3f')][_0x18c1('0x4d')]?_0xa2c59c[_0x18c1('0x3f')]:_0x2fa91f[_0x18c1('0x3e')];if(_0x4f0b6b[_0x18c1('0x3a')][_0x18c1('0x47')]){_0xa2c59c[_0x18c1('0x48')]=[{'all':!![]}];}_0xa2c59c=_[_0x18c1('0x44')]({},_0xa2c59c,_0x4f0b6b[_0x18c1('0x4e')]);return db[_0x18c1('0x46')][_0x18c1('0x4f')](_0xa2c59c)['then'](handleEntityNotFound(_0x40035c,null))[_0x18c1('0x2e')](respondWithResult(_0x40035c,null))[_0x18c1('0x4a')](handleError(_0x40035c,null));};exports[_0x18c1('0x50')]=function(_0x460f7b,_0x55a5e8,_0x7f9528){var _0x539996;return db[_0x18c1('0x46')]['create'](_0x460f7b[_0x18c1('0x51')],{'raw':!![]})['then'](function(_0x44c438){_0x539996=_0x44c438;return db[_0x18c1('0x46')]['findAll']({'raw':!![]});})['then'](function(_0x5dcec2){var _0xfb3266=fs[_0x18c1('0x52')](path[_0x18c1('0x53')](config[_0x18c1('0x54')],_0x18c1('0x55')),_0x18c1('0x56'));var _0x58f928=ejs[_0x18c1('0x57')](_0xfb3266,{'contexts':_0x5dcec2||[]});fs['writeFileSync'](_0x18c1('0x58'),_0x58f928);})[_0x18c1('0x2e')](function(){return respondWithRpcPromise(_0x18c1('0x59'),'create',{'module':_0x18c1('0x5a')});})['then'](function(){var _0x18b1f7=_0x460f7b[_0x18c1('0x5b')][_0x18c1('0x2f')]({'plain':!![]});if(!_0x18b1f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18b1f7[_0x18c1('0x5c')]===_0x18c1('0x5b')){var _0x4d0562=_0x539996[_0x18c1('0x2f')]({'plain':!![]});return db[_0x18c1('0x5d')]['find']({'where':{'name':_0x18c1('0x30'),'userProfileId':_0x18b1f7[_0x18c1('0x5e')]},'raw':!![]})[_0x18c1('0x2e')](function(_0x454a1d){if(_0x454a1d&&_0x454a1d['autoAssociation']===0x0){return db[_0x18c1('0x31')][_0x18c1('0x50')]({'name':_0x4d0562['name'],'resourceId':_0x4d0562['id'],'type':_0x454a1d[_0x18c1('0x33')],'sectionId':_0x454a1d['id']},{})['then'](function(){return _0x539996;});}else{return _0x539996;}})['catch'](function(_0x3e2108){logger[_0x18c1('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2108);throw _0x3e2108;});}return _0x539996;})[_0x18c1('0x2e')](respondWithResult(_0x55a5e8,0xc9))['catch'](handleError(_0x55a5e8,null));};exports[_0x18c1('0x2c')]=function(_0x7e8e8a,_0x4a8a6e,_0x411642){var _0x2eaef4;return db[_0x18c1('0x46')][_0x18c1('0x4f')]({'where':{'id':_0x7e8e8a[_0x18c1('0x4c')]['id']}})[_0x18c1('0x2e')](handleEntityNotFound(_0x4a8a6e,null))[_0x18c1('0x2e')](saveUpdates(_0x7e8e8a[_0x18c1('0x51')],null))['then'](function(_0x4ca8f8){if(_0x4ca8f8){_0x2eaef4=_0x4ca8f8;return db[_0x18c1('0x46')][_0x18c1('0x5f')]({'raw':!![]});}})[_0x18c1('0x2e')](function(_0x59dbc8){var _0x2f97d1=fs[_0x18c1('0x52')](path[_0x18c1('0x53')](config['root'],_0x18c1('0x55')),_0x18c1('0x56'));var _0x3f9dcb=ejs[_0x18c1('0x57')](_0x2f97d1,{'contexts':_0x59dbc8||[]});fs[_0x18c1('0x60')](_0x18c1('0x58'),_0x3f9dcb);})[_0x18c1('0x2e')](function(){return respondWithRpcPromise(_0x18c1('0x59'),_0x18c1('0x2c'),{'module':_0x18c1('0x5a')});})['then'](function(){return _0x2eaef4;})['then'](respondWithResult(_0x4a8a6e,null))[_0x18c1('0x4a')](handleError(_0x4a8a6e,null));};exports['destroy']=function(_0x2ac8d4,_0xd70118,_0x3bdfc9){var _0x12ba09;return db['VoiceContext'][_0x18c1('0x4f')]({'where':{'id':_0x2ac8d4['params']['id']}})['then'](handleEntityNotFound(_0xd70118,null))['then'](removeEntity(_0xd70118,null))[_0x18c1('0x2e')](function(){return db[_0x18c1('0x46')]['findAll']({'raw':!![]});})[_0x18c1('0x2e')](function(_0x598d8a){var _0x29815a=fs[_0x18c1('0x52')](path['join'](config[_0x18c1('0x54')],_0x18c1('0x55')),_0x18c1('0x56'));var _0x3c2d1b=ejs[_0x18c1('0x57')](_0x29815a,{'contexts':_0x598d8a});fs[_0x18c1('0x60')](_0x18c1('0x58'),_0x3c2d1b);return respondWithRpcPromise('Reload','destroy',{'module':_0x18c1('0x5a')});})[_0x18c1('0x4a')](handleError(_0xd70118,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fcde0d7..f28ec09 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 _0x8a99=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x8a99,0x184));var _0x98a9=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x8a99[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x98a9('0x0'));var util=require('util');var logger=require(_0x98a9('0x1'))(_0x98a9('0x2'));var moment=require(_0x98a9('0x3'));var BPromise=require(_0x98a9('0x4'));var rp=require(_0x98a9('0x5'));var fs=require('fs');var path=require(_0x98a9('0x6'));var rimraf=require(_0x98a9('0x7'));var config=require(_0x98a9('0x8'));var attributes=require(_0x98a9('0x9'));module[_0x98a9('0xa')]=function(_0x28a124,_0x2e7206){return _0x28a124[_0x98a9('0xb')](_0x98a9('0xc'),attributes,{'tableName':_0x98a9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31dc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','util','../../config/logger'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x31dc,0x1ab));var _0xc31d=function(_0x42120b,_0x2900c5){_0x42120b=_0x42120b-0x0;var _0x3dccf2=_0x31dc[_0x42120b];return _0x3dccf2;};'use strict';var _=require('lodash');var util=require(_0xc31d('0x0'));var logger=require(_0xc31d('0x1'))(_0xc31d('0x2'));var moment=require(_0xc31d('0x3'));var BPromise=require(_0xc31d('0x4'));var rp=require(_0xc31d('0x5'));var fs=require('fs');var path=require(_0xc31d('0x6'));var rimraf=require(_0xc31d('0x7'));var config=require(_0xc31d('0x8'));var attributes=require(_0xc31d('0x9'));module[_0xc31d('0xa')]=function(_0x1f179c,_0x1e15bd){return _0x1f179c[_0xc31d('0xb')](_0xc31d('0xc'),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 61172ec..31049a2 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 _0x8c7a=['client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x1b75af,_0x31e65c){var _0x3c6e5e=function(_0x9c7c4a){while(--_0x9c7c4a){_0x1b75af['push'](_0x1b75af['shift']());}};_0x3c6e5e(++_0x31e65c);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x109bb,_0x1a07cb){_0x109bb=_0x109bb-0x0;var _0x3e1a73=_0x8c7a[_0x109bb];return _0x3e1a73;};'use strict';var _=require(_0xa8c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa8c7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8c7('0x2'));var db=require(_0xa8c7('0x3'))['db'];var utils=require(_0xa8c7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8c7('0x5'));var jayson=require(_0xa8c7('0x6'));var client=jayson[_0xa8c7('0x7')][_0xa8c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x416db0,_0x4ce345,_0x37d743){return new BPromise(function(_0x5b85e2,_0x1338c6){return client[_0xa8c7('0x9')](_0x416db0,_0x37d743)[_0xa8c7('0xa')](function(_0x31e479){logger[_0xa8c7('0xb')]('VoiceContext,\x20%s,\x20%s',_0x4ce345,_0xa8c7('0xc'));logger[_0xa8c7('0xd')](_0xa8c7('0xe'),_0x4ce345,_0xa8c7('0xc'),JSON['stringify'](_0x31e479));if(_0x31e479['error']){if(_0x31e479['error'][_0xa8c7('0xf')]===0x1f4){logger[_0xa8c7('0x10')](_0xa8c7('0x11'),_0x4ce345,_0x31e479[_0xa8c7('0x10')][_0xa8c7('0x12')]);return _0x1338c6(_0x31e479[_0xa8c7('0x10')][_0xa8c7('0x12')]);}logger[_0xa8c7('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4ce345,_0x31e479[_0xa8c7('0x10')][_0xa8c7('0x12')]);return _0x5b85e2(_0x31e479[_0xa8c7('0x10')][_0xa8c7('0x12')]);}else{logger[_0xa8c7('0xb')](_0xa8c7('0x11'),_0x4ce345,_0xa8c7('0xc'));_0x5b85e2(_0x31e479[_0xa8c7('0x13')][_0xa8c7('0x12')]);}})[_0xa8c7('0x14')](function(_0x2a99bc){logger[_0xa8c7('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4ce345,_0x2a99bc);_0x1338c6(_0x2a99bc);});});} \ No newline at end of file +var _0x2ea1=['message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error'];(function(_0x1d157f,_0xfabfa4){var _0x1d16c6=function(_0x5f2126){while(--_0x5f2126){_0x1d157f['push'](_0x1d157f['shift']());}};_0x1d16c6(++_0xfabfa4);}(_0x2ea1,0xca));var _0x12ea=function(_0x32572d,_0x5062c9){_0x32572d=_0x32572d-0x0;var _0x5e9831=_0x2ea1[_0x32572d];return _0x5e9831;};'use strict';var _=require(_0x12ea('0x0'));var util=require(_0x12ea('0x1'));var moment=require(_0x12ea('0x2'));var BPromise=require(_0x12ea('0x3'));var rs=require(_0x12ea('0x4'));var fs=require('fs');var Redis=require(_0x12ea('0x5'));var db=require(_0x12ea('0x6'))['db'];var utils=require(_0x12ea('0x7'));var logger=require('../../config/logger')(_0x12ea('0x8'));var config=require(_0x12ea('0x9'));var jayson=require(_0x12ea('0xa'));var client=jayson['client'][_0x12ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x242d90,_0x46885c,_0x18108b){return new BPromise(function(_0x3d83e1,_0xacc885){return client[_0x12ea('0xc')](_0x242d90,_0x18108b)['then'](function(_0x5984f7){logger[_0x12ea('0xd')]('VoiceContext,\x20%s,\x20%s',_0x46885c,_0x12ea('0xe'));logger[_0x12ea('0xf')](_0x12ea('0x10'),_0x46885c,_0x12ea('0xe'),JSON['stringify'](_0x5984f7));if(_0x5984f7[_0x12ea('0x11')]){if(_0x5984f7[_0x12ea('0x11')]['code']===0x1f4){logger[_0x12ea('0x11')]('VoiceContext,\x20%s,\x20%s',_0x46885c,_0x5984f7['error'][_0x12ea('0x12')]);return _0xacc885(_0x5984f7[_0x12ea('0x11')][_0x12ea('0x12')]);}logger[_0x12ea('0x11')](_0x12ea('0x13'),_0x46885c,_0x5984f7[_0x12ea('0x11')][_0x12ea('0x12')]);return _0x3d83e1(_0x5984f7[_0x12ea('0x11')]['message']);}else{logger[_0x12ea('0xd')](_0x12ea('0x13'),_0x46885c,_0x12ea('0xe'));_0x3d83e1(_0x5984f7[_0x12ea('0x14')]['message']);}})[_0x12ea('0x15')](function(_0x4d8c57){logger[_0x12ea('0x11')](_0x12ea('0x13'),_0x46885c,_0x4d8c57);_0xacc885(_0x4d8c57);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4d27c4d..cc30f24 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 _0x43e4=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','/:id','delete','destroy','exports'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x43e4,0x17c));var _0x443e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x43e4[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var path=require(_0x443e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x443e('0x3')]();var fs_extra=require(_0x443e('0x4'));var auth=require(_0x443e('0x5'));var interaction=require(_0x443e('0x6'));var config=require(_0x443e('0x7'));var controller=require('./voiceDialReport.controller');router[_0x443e('0x8')]('/',auth[_0x443e('0x9')](),controller[_0x443e('0xa')]);router['get'](_0x443e('0xb'),auth['isAuthenticated'](),controller[_0x443e('0xc')]);router[_0x443e('0x8')]('/:id',auth[_0x443e('0x9')](),controller[_0x443e('0xd')]);router['post']('/',auth[_0x443e('0x9')](),controller[_0x443e('0xe')]);router['put'](_0x443e('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x443e('0x10')]('/:id',auth[_0x443e('0x9')](),controller[_0x443e('0x11')]);module[_0x443e('0x12')]=router; \ No newline at end of file +var _0x3b5b=['../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3b5b,0xc2));var _0xb3b5=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0x3b5b[_0x135704];return _0x24e9fd;};'use strict';var multer=require(_0xb3b5('0x0'));var util=require(_0xb3b5('0x1'));var path=require('path');var timeout=require(_0xb3b5('0x2'));var express=require(_0xb3b5('0x3'));var router=express[_0xb3b5('0x4')]();var fs_extra=require(_0xb3b5('0x5'));var auth=require(_0xb3b5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3b5('0x7'));var controller=require(_0xb3b5('0x8'));router[_0xb3b5('0x9')]('/',auth[_0xb3b5('0xa')](),controller['index']);router['get'](_0xb3b5('0xb'),auth[_0xb3b5('0xa')](),controller[_0xb3b5('0xc')]);router[_0xb3b5('0x9')](_0xb3b5('0xd'),auth['isAuthenticated'](),controller[_0xb3b5('0xe')]);router[_0xb3b5('0xf')]('/',auth['isAuthenticated'](),controller[_0xb3b5('0x10')]);router['put'](_0xb3b5('0xd'),auth[_0xb3b5('0xa')](),controller['update']);router[_0xb3b5('0x11')](_0xb3b5('0xd'),auth[_0xb3b5('0xa')](),controller[_0xb3b5('0x12')]);module[_0xb3b5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9a0aaaa..bdb1516 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(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x9f62,0x154));var _0x29f6=function(_0x4787e4,_0x4ca984){_0x4787e4=_0x4787e4-0x0;var _0x342d38=_0x9f62[_0x4787e4];return _0x342d38;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c135f36..4a20365 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 _0x3520=['params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceDialReport','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','rawAttributes','keys','fields','includeAll','find','create','body'];(function(_0x424f6b,_0x341058){var _0x289979=function(_0x35ae03){while(--_0x35ae03){_0x424f6b['push'](_0x424f6b['shift']());}};_0x289979(++_0x341058);}(_0x3520,0x126));var _0x0352=function(_0x2f6c15,_0x4a9b3c){_0x2f6c15=_0x2f6c15-0x0;var _0x3d28c5=_0x3520[_0x2f6c15];return _0x3d28c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0352('0x0'));var zipdir=require(_0x0352('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0352('0x2'));var moment=require(_0x0352('0x3'));var BPromise=require(_0x0352('0x4'));var Mustache=require(_0x0352('0x5'));var util=require('util');var path=require(_0x0352('0x6'));var sox=require(_0x0352('0x7'));var csv=require(_0x0352('0x8'));var ejs=require(_0x0352('0x9'));var fs=require('fs');var fs_extra=require(_0x0352('0xa'));var _=require(_0x0352('0xb'));var squel=require(_0x0352('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0352('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0352('0xe'));var Papa=require(_0x0352('0xf'));var Redis=require(_0x0352('0x10'));var authService=require(_0x0352('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0352('0x12'));var logger=require('../../config/logger')(_0x0352('0x13'));var utils=require(_0x0352('0x14'));var config=require(_0x0352('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508966,_0x40a418){_0x40a418=_0x40a418||0xcc;return function(_0x898b2a){if(_0x898b2a){return _0x508966[_0x0352('0x16')](_0x40a418);}return _0x508966[_0x0352('0x17')](_0x40a418)[_0x0352('0x18')]();};}function respondWithResult(_0x2ee7ae,_0x40f1fa){_0x40f1fa=_0x40f1fa||0xc8;return function(_0x37fdd9){if(_0x37fdd9){return _0x2ee7ae[_0x0352('0x17')](_0x40f1fa)[_0x0352('0x19')](_0x37fdd9);}};}function respondWithFilteredResult(_0x463e00,_0x15c509){return function(_0x3c528f){if(_0x3c528f){var _0x69c7e2=typeof _0x15c509[_0x0352('0x1a')]===_0x0352('0x1b')&&typeof _0x15c509['limit']==='undefined';var _0x246e43=_0x3c528f[_0x0352('0x1c')];var _0x48d883=_0x69c7e2?0x0:_0x15c509[_0x0352('0x1a')];var _0x5aae6b=_0x69c7e2?_0x3c528f[_0x0352('0x1c')]:_0x15c509[_0x0352('0x1a')]+_0x15c509[_0x0352('0x1d')];var _0x4ce3e0;if(_0x5aae6b>=_0x246e43){_0x5aae6b=_0x246e43;_0x4ce3e0=0xc8;}else{_0x4ce3e0=0xce;}_0x463e00[_0x0352('0x17')](_0x4ce3e0);return _0x463e00[_0x0352('0x1e')](_0x0352('0x1f'),_0x48d883+'-'+_0x5aae6b+'/'+_0x246e43)[_0x0352('0x19')](_0x3c528f);}return null;};}function patchUpdates(_0x410447){return function(_0x1db4e2){try{jsonpatch[_0x0352('0x20')](_0x1db4e2,_0x410447,!![]);}catch(_0x11c380){return BPromise[_0x0352('0x21')](_0x11c380);}return _0x1db4e2[_0x0352('0x22')]();};}function saveUpdates(_0x21be67,_0x375da2){return function(_0xcfb868){if(_0xcfb868){return _0xcfb868[_0x0352('0x23')](_0x21be67)[_0x0352('0x24')](function(_0x4c7c7a){return _0x4c7c7a;});}return null;};}function removeEntity(_0x76e100,_0x4f5cfd){return function(_0x235e33){if(_0x235e33){return _0x235e33[_0x0352('0x25')]()[_0x0352('0x24')](function(){_0x76e100[_0x0352('0x17')](0xcc)[_0x0352('0x18')]();});}};}function handleEntityNotFound(_0x64afcf,_0x3e803a){return function(_0x1f9275){if(!_0x1f9275){_0x64afcf[_0x0352('0x16')](0x194);}return _0x1f9275;};}function handleError(_0xa7165f,_0x465e85){_0x465e85=_0x465e85||0x1f4;return function(_0x272318){logger[_0x0352('0x26')](_0x272318[_0x0352('0x27')]);if(_0x272318[_0x0352('0x28')]){delete _0x272318[_0x0352('0x28')];}_0xa7165f[_0x0352('0x17')](_0x465e85)[_0x0352('0x29')](_0x272318);};}exports['index']=function(_0x581c60,_0x414edf){var _0x48a2d9={},_0x5c483a={},_0x50d9fe={'count':0x0,'rows':[]};var _0x4e5999=_[_0x0352('0x2a')](db[_0x0352('0x2b')]['rawAttributes'],function(_0x1295ea){return{'name':_0x1295ea['fieldName'],'type':_0x1295ea[_0x0352('0x2c')]['key']};});_0x5c483a[_0x0352('0x2d')]=_[_0x0352('0x2a')](_0x4e5999,'name');_0x5c483a['query']=_['keys'](_0x581c60[_0x0352('0x2e')]);_0x5c483a[_0x0352('0x2f')]=_[_0x0352('0x30')](_0x5c483a['model'],_0x5c483a['query']);_0x48a2d9[_0x0352('0x31')]=_[_0x0352('0x30')](_0x5c483a['model'],qs['fields'](_0x581c60['query']['fields']));_0x48a2d9[_0x0352('0x31')]=_0x48a2d9[_0x0352('0x31')][_0x0352('0x32')]?_0x48a2d9[_0x0352('0x31')]:_0x5c483a[_0x0352('0x2d')];if(!_0x581c60['query'][_0x0352('0x33')](_0x0352('0x34'))){_0x48a2d9[_0x0352('0x1d')]=qs[_0x0352('0x1d')](_0x581c60[_0x0352('0x2e')][_0x0352('0x1d')]);_0x48a2d9[_0x0352('0x1a')]=qs['offset'](_0x581c60[_0x0352('0x2e')][_0x0352('0x1a')]);}_0x48a2d9[_0x0352('0x35')]=qs[_0x0352('0x36')](_0x581c60[_0x0352('0x2e')]['sort']);_0x48a2d9[_0x0352('0x37')]=qs[_0x0352('0x2f')](_[_0x0352('0x38')](_0x581c60[_0x0352('0x2e')],_0x5c483a[_0x0352('0x2f')]),_0x4e5999);if(_0x581c60[_0x0352('0x2e')][_0x0352('0x39')]){_0x48a2d9[_0x0352('0x37')]=_['merge'](_0x48a2d9[_0x0352('0x37')],{'$or':_[_0x0352('0x2a')](_0x4e5999,function(_0x19bd6e){if(_0x19bd6e[_0x0352('0x2c')]!=='VIRTUAL'){var _0x4ad694={};_0x4ad694[_0x19bd6e[_0x0352('0x28')]]={'$like':'%'+_0x581c60[_0x0352('0x2e')][_0x0352('0x39')]+'%'};return _0x4ad694;}})});}_0x48a2d9=_[_0x0352('0x3a')]({},_0x48a2d9,_0x581c60[_0x0352('0x3b')]);var _0x3f86d6={'where':_0x48a2d9[_0x0352('0x37')]};return db['VoiceDialReport'][_0x0352('0x1c')](_0x3f86d6)[_0x0352('0x24')](function(_0x2a1a1c){_0x50d9fe['count']=_0x2a1a1c;if(_0x581c60[_0x0352('0x2e')]['includeAll']){_0x48a2d9[_0x0352('0x3c')]=[{'all':!![]}];}return db[_0x0352('0x2b')]['findAll'](_0x48a2d9);})[_0x0352('0x24')](function(_0x4a5d0e){_0x50d9fe[_0x0352('0x3d')]=_0x4a5d0e;return _0x50d9fe;})[_0x0352('0x24')](respondWithFilteredResult(_0x414edf,_0x48a2d9))[_0x0352('0x3e')](handleError(_0x414edf,null));};exports[_0x0352('0x3f')]=function(_0x20eddb,_0x3d0b27){var _0x1aef94={'raw':!![],'where':{'id':_0x20eddb['params']['id']}},_0x4cab75={};_0x4cab75[_0x0352('0x2d')]=_['keys'](db[_0x0352('0x2b')][_0x0352('0x40')]);_0x4cab75[_0x0352('0x2e')]=_[_0x0352('0x41')](_0x20eddb[_0x0352('0x2e')]);_0x4cab75['filters']=_[_0x0352('0x30')](_0x4cab75[_0x0352('0x2d')],_0x4cab75['query']);_0x1aef94[_0x0352('0x31')]=_[_0x0352('0x30')](_0x4cab75[_0x0352('0x2d')],qs['fields'](_0x20eddb['query'][_0x0352('0x42')]));_0x1aef94[_0x0352('0x31')]=_0x1aef94[_0x0352('0x31')][_0x0352('0x32')]?_0x1aef94[_0x0352('0x31')]:_0x4cab75[_0x0352('0x2d')];if(_0x20eddb['query'][_0x0352('0x43')]){_0x1aef94[_0x0352('0x3c')]=[{'all':!![]}];}_0x1aef94=_['merge']({},_0x1aef94,_0x20eddb[_0x0352('0x3b')]);return db[_0x0352('0x2b')][_0x0352('0x44')](_0x1aef94)[_0x0352('0x24')](handleEntityNotFound(_0x3d0b27,null))[_0x0352('0x24')](respondWithResult(_0x3d0b27,null))['catch'](handleError(_0x3d0b27,null));};exports['create']=function(_0x4d6b1c,_0x14a346){return db[_0x0352('0x2b')][_0x0352('0x45')](_0x4d6b1c[_0x0352('0x46')],{})[_0x0352('0x24')](respondWithResult(_0x14a346,0xc9))[_0x0352('0x3e')](handleError(_0x14a346,null));};exports[_0x0352('0x23')]=function(_0x36d07d,_0x4ec0ef){if(_0x36d07d[_0x0352('0x46')]['id']){delete _0x36d07d[_0x0352('0x46')]['id'];}return db[_0x0352('0x2b')]['find']({'where':{'id':_0x36d07d[_0x0352('0x47')]['id']}})[_0x0352('0x24')](handleEntityNotFound(_0x4ec0ef,null))[_0x0352('0x24')](saveUpdates(_0x36d07d[_0x0352('0x46')],null))[_0x0352('0x24')](respondWithResult(_0x4ec0ef,null))['catch'](handleError(_0x4ec0ef,null));};exports['destroy']=function(_0x58b329,_0x366c0e){return db[_0x0352('0x2b')][_0x0352('0x44')]({'where':{'id':_0x58b329[_0x0352('0x47')]['id']}})['then'](handleEntityNotFound(_0x366c0e,null))['then'](removeEntity(_0x366c0e,null))[_0x0352('0x3e')](handleError(_0x366c0e,null));};exports[_0x0352('0x48')]=function(_0x1a37a2,_0x5c1f82){return db['VoiceDialReport'][_0x0352('0x48')]()[_0x0352('0x24')](respondWithResult(_0x5c1f82,null))[_0x0352('0x3e')](handleError(_0x5c1f82,null));}; \ No newline at end of file +var _0x3c82=['lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','show','params','catch','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','mustache','to-csv','ejs','fs-extra'];(function(_0xf7cf7a,_0x4809db){var _0x49ddac=function(_0x404bf6){while(--_0x404bf6){_0xf7cf7a['push'](_0xf7cf7a['shift']());}};_0x49ddac(++_0x4809db);}(_0x3c82,0x129));var _0x23c8=function(_0x160803,_0x33353){_0x160803=_0x160803-0x0;var _0x147c1d=_0x3c82[_0x160803];return _0x147c1d;};'use strict';var emlformat=require(_0x23c8('0x0'));var rimraf=require(_0x23c8('0x1'));var zipdir=require(_0x23c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23c8('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x23c8('0x4'));var ejs=require(_0x23c8('0x5'));var fs=require('fs');var fs_extra=require(_0x23c8('0x6'));var _=require(_0x23c8('0x7'));var squel=require(_0x23c8('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23c8('0x9'));var toCsv=require(_0x23c8('0x4'));var querystring=require(_0x23c8('0xa'));var Papa=require(_0x23c8('0xb'));var Redis=require(_0x23c8('0xc'));var authService=require(_0x23c8('0xd'));var qs=require(_0x23c8('0xe'));var as=require(_0x23c8('0xf'));var hardwareService=require(_0x23c8('0x10'));var logger=require(_0x23c8('0x11'))(_0x23c8('0x12'));var utils=require('../../config/utils');var config=require(_0x23c8('0x13'));var licenseUtil=require(_0x23c8('0x14'));var db=require(_0x23c8('0x15'))['db'];function respondWithStatusCode(_0x1aaf7a,_0x22d035){_0x22d035=_0x22d035||0xcc;return function(_0x3bfea5){if(_0x3bfea5){return _0x1aaf7a[_0x23c8('0x16')](_0x22d035);}return _0x1aaf7a['status'](_0x22d035)[_0x23c8('0x17')]();};}function respondWithResult(_0x93183c,_0xf8b625){_0xf8b625=_0xf8b625||0xc8;return function(_0x477c24){if(_0x477c24){return _0x93183c[_0x23c8('0x18')](_0xf8b625)['json'](_0x477c24);}};}function respondWithFilteredResult(_0x4ca9c5,_0x5196ea){return function(_0x1ab5b4){if(_0x1ab5b4){var _0x2934ed=typeof _0x5196ea[_0x23c8('0x19')]===_0x23c8('0x1a')&&typeof _0x5196ea[_0x23c8('0x1b')]==='undefined';var _0x452b9d=_0x1ab5b4['count'];var _0x44be13=_0x2934ed?0x0:_0x5196ea[_0x23c8('0x19')];var _0x207f14=_0x2934ed?_0x1ab5b4[_0x23c8('0x1c')]:_0x5196ea[_0x23c8('0x19')]+_0x5196ea['limit'];var _0x50618e;if(_0x207f14>=_0x452b9d){_0x207f14=_0x452b9d;_0x50618e=0xc8;}else{_0x50618e=0xce;}_0x4ca9c5[_0x23c8('0x18')](_0x50618e);return _0x4ca9c5[_0x23c8('0x1d')](_0x23c8('0x1e'),_0x44be13+'-'+_0x207f14+'/'+_0x452b9d)[_0x23c8('0x1f')](_0x1ab5b4);}return null;};}function patchUpdates(_0xa8355f){return function(_0x139773){try{jsonpatch[_0x23c8('0x20')](_0x139773,_0xa8355f,!![]);}catch(_0x40644d){return BPromise[_0x23c8('0x21')](_0x40644d);}return _0x139773['save']();};}function saveUpdates(_0x28193f,_0x3ae091){return function(_0x45cf2f){if(_0x45cf2f){return _0x45cf2f[_0x23c8('0x22')](_0x28193f)[_0x23c8('0x23')](function(_0x1f808d){return _0x1f808d;});}return null;};}function removeEntity(_0x9d2570,_0x555011){return function(_0x56582e){if(_0x56582e){return _0x56582e['destroy']()[_0x23c8('0x23')](function(){_0x9d2570[_0x23c8('0x18')](0xcc)[_0x23c8('0x17')]();});}};}function handleEntityNotFound(_0x11b146,_0x460c0e){return function(_0x3dd598){if(!_0x3dd598){_0x11b146[_0x23c8('0x16')](0x194);}return _0x3dd598;};}function handleError(_0xee73ff,_0x1dde85){_0x1dde85=_0x1dde85||0x1f4;return function(_0x51dde8){logger[_0x23c8('0x24')](_0x51dde8[_0x23c8('0x25')]);if(_0x51dde8[_0x23c8('0x26')]){delete _0x51dde8[_0x23c8('0x26')];}_0xee73ff[_0x23c8('0x18')](_0x1dde85)[_0x23c8('0x27')](_0x51dde8);};}exports[_0x23c8('0x28')]=function(_0x18b8ac,_0x12ac4f){var _0x4516e1={},_0x123378={},_0x2f65c4={'count':0x0,'rows':[]};var _0x1b9d6f=_[_0x23c8('0x29')](db['VoiceDialReport'][_0x23c8('0x2a')],function(_0x3c84b7){return{'name':_0x3c84b7[_0x23c8('0x2b')],'type':_0x3c84b7[_0x23c8('0x2c')][_0x23c8('0x2d')]};});_0x123378['model']=_[_0x23c8('0x29')](_0x1b9d6f,_0x23c8('0x26'));_0x123378[_0x23c8('0x2e')]=_[_0x23c8('0x2f')](_0x18b8ac[_0x23c8('0x2e')]);_0x123378[_0x23c8('0x30')]=_[_0x23c8('0x31')](_0x123378[_0x23c8('0x32')],_0x123378['query']);_0x4516e1[_0x23c8('0x33')]=_[_0x23c8('0x31')](_0x123378[_0x23c8('0x32')],qs[_0x23c8('0x34')](_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x34')]));_0x4516e1[_0x23c8('0x33')]=_0x4516e1[_0x23c8('0x33')][_0x23c8('0x35')]?_0x4516e1[_0x23c8('0x33')]:_0x123378[_0x23c8('0x32')];if(!_0x18b8ac['query']['hasOwnProperty'](_0x23c8('0x36'))){_0x4516e1[_0x23c8('0x1b')]=qs[_0x23c8('0x1b')](_0x18b8ac[_0x23c8('0x2e')]['limit']);_0x4516e1[_0x23c8('0x19')]=qs[_0x23c8('0x19')](_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x19')]);}_0x4516e1[_0x23c8('0x37')]=qs['sort'](_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x38')]);_0x4516e1[_0x23c8('0x39')]=qs[_0x23c8('0x30')](_[_0x23c8('0x3a')](_0x18b8ac['query'],_0x123378[_0x23c8('0x30')]),_0x1b9d6f);if(_0x18b8ac['query'][_0x23c8('0x3b')]){_0x4516e1['where']=_[_0x23c8('0x3c')](_0x4516e1[_0x23c8('0x39')],{'$or':_[_0x23c8('0x29')](_0x1b9d6f,function(_0x2ef6e4){if(_0x2ef6e4[_0x23c8('0x2c')]!==_0x23c8('0x3d')){var _0x31331f={};_0x31331f[_0x2ef6e4[_0x23c8('0x26')]]={'$like':'%'+_0x18b8ac['query'][_0x23c8('0x3b')]+'%'};return _0x31331f;}})});}_0x4516e1=_[_0x23c8('0x3c')]({},_0x4516e1,_0x18b8ac[_0x23c8('0x3e')]);var _0x3964cd={'where':_0x4516e1[_0x23c8('0x39')]};return db[_0x23c8('0x3f')][_0x23c8('0x1c')](_0x3964cd)[_0x23c8('0x23')](function(_0x2fb6ed){_0x2f65c4['count']=_0x2fb6ed;if(_0x18b8ac[_0x23c8('0x2e')][_0x23c8('0x40')]){_0x4516e1[_0x23c8('0x41')]=[{'all':!![]}];}return db[_0x23c8('0x3f')][_0x23c8('0x42')](_0x4516e1);})[_0x23c8('0x23')](function(_0x335596){_0x2f65c4[_0x23c8('0x43')]=_0x335596;return _0x2f65c4;})[_0x23c8('0x23')](respondWithFilteredResult(_0x12ac4f,_0x4516e1))['catch'](handleError(_0x12ac4f,null));};exports[_0x23c8('0x44')]=function(_0x2591f0,_0x4a8b3d){var _0x2e6cb8={'raw':!![],'where':{'id':_0x2591f0[_0x23c8('0x45')]['id']}},_0x433208={};_0x433208['model']=_[_0x23c8('0x2f')](db['VoiceDialReport']['rawAttributes']);_0x433208[_0x23c8('0x2e')]=_[_0x23c8('0x2f')](_0x2591f0[_0x23c8('0x2e')]);_0x433208['filters']=_[_0x23c8('0x31')](_0x433208[_0x23c8('0x32')],_0x433208['query']);_0x2e6cb8[_0x23c8('0x33')]=_['intersection'](_0x433208[_0x23c8('0x32')],qs['fields'](_0x2591f0[_0x23c8('0x2e')]['fields']));_0x2e6cb8[_0x23c8('0x33')]=_0x2e6cb8[_0x23c8('0x33')][_0x23c8('0x35')]?_0x2e6cb8[_0x23c8('0x33')]:_0x433208[_0x23c8('0x32')];if(_0x2591f0[_0x23c8('0x2e')]['includeAll']){_0x2e6cb8[_0x23c8('0x41')]=[{'all':!![]}];}_0x2e6cb8=_[_0x23c8('0x3c')]({},_0x2e6cb8,_0x2591f0[_0x23c8('0x3e')]);return db['VoiceDialReport']['find'](_0x2e6cb8)[_0x23c8('0x23')](handleEntityNotFound(_0x4a8b3d,null))['then'](respondWithResult(_0x4a8b3d,null))[_0x23c8('0x46')](handleError(_0x4a8b3d,null));};exports[_0x23c8('0x47')]=function(_0x4807ec,_0xee7213){return db[_0x23c8('0x3f')]['create'](_0x4807ec['body'],{})[_0x23c8('0x23')](respondWithResult(_0xee7213,0xc9))[_0x23c8('0x46')](handleError(_0xee7213,null));};exports['update']=function(_0x239186,_0x1c6822){if(_0x239186[_0x23c8('0x48')]['id']){delete _0x239186['body']['id'];}return db[_0x23c8('0x3f')]['find']({'where':{'id':_0x239186[_0x23c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c6822,null))['then'](saveUpdates(_0x239186[_0x23c8('0x48')],null))['then'](respondWithResult(_0x1c6822,null))[_0x23c8('0x46')](handleError(_0x1c6822,null));};exports[_0x23c8('0x49')]=function(_0x11bb9e,_0xb8dd4b){return db[_0x23c8('0x3f')][_0x23c8('0x4a')]({'where':{'id':_0x11bb9e[_0x23c8('0x45')]['id']}})['then'](handleEntityNotFound(_0xb8dd4b,null))[_0x23c8('0x23')](removeEntity(_0xb8dd4b,null))[_0x23c8('0x46')](handleError(_0xb8dd4b,null));};exports[_0x23c8('0x4b')]=function(_0x59a5a0,_0x4836f0){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x4836f0,null))['catch'](handleError(_0x4836f0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1aaedb3..e1c42a6 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 _0x7de4=['../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1fed0b,_0x3bface){var _0x3677db=function(_0x3ec249){while(--_0x3ec249){_0x1fed0b['push'](_0x1fed0b['shift']());}};_0x3677db(++_0x3bface);}(_0x7de4,0xb4));var _0x47de=function(_0x57a94d,_0x18e8b3){_0x57a94d=_0x57a94d-0x0;var _0x1b3272=_0x7de4[_0x57a94d];return _0x1b3272;};'use strict';var _=require(_0x47de('0x0'));var util=require('util');var logger=require(_0x47de('0x1'))(_0x47de('0x2'));var moment=require('moment');var BPromise=require(_0x47de('0x3'));var rp=require(_0x47de('0x4'));var fs=require('fs');var path=require(_0x47de('0x5'));var rimraf=require(_0x47de('0x6'));var config=require(_0x47de('0x7'));var attributes=require(_0x47de('0x8'));module['exports']=function(_0x51864e,_0x36a9bc){return _0x51864e['define'](_0x47de('0x9'),attributes,{'tableName':_0x47de('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf589=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0x1b1bd5,_0xf50a3){var _0x12bf17=function(_0x5a1a9f){while(--_0x5a1a9f){_0x1b1bd5['push'](_0x1b1bd5['shift']());}};_0x12bf17(++_0xf50a3);}(_0xf589,0xe1));var _0x9f58=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf589[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9f58('0x0'));var util=require(_0x9f58('0x1'));var logger=require('../../config/logger')(_0x9f58('0x2'));var moment=require(_0x9f58('0x3'));var BPromise=require(_0x9f58('0x4'));var rp=require(_0x9f58('0x5'));var fs=require('fs');var path=require(_0x9f58('0x6'));var rimraf=require(_0x9f58('0x7'));var config=require(_0x9f58('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0x9f58('0x9')]=function(_0x4fdb49,_0x76c022){return _0x4fdb49[_0x9f58('0xa')](_0x9f58('0xb'),attributes,{'tableName':_0x9f58('0xc'),'paranoid':![],'indexes':[{'fields':[_0x9f58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ecead85..4afa693 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 _0xb8fc=['attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then','UpdateVoiceDialReport','update','raw','where'];(function(_0x573904,_0x5caa48){var _0x54579b=function(_0x4d5062){while(--_0x4d5062){_0x573904['push'](_0x573904['shift']());}};_0x54579b(++_0x5caa48);}(_0xb8fc,0x14b));var _0xcb8f=function(_0x3f1eb6,_0x3e066c){_0x3f1eb6=_0x3f1eb6-0x0;var _0x43c981=_0xb8fc[_0x3f1eb6];return _0x43c981;};'use strict';var _=require(_0xcb8f('0x0'));var util=require(_0xcb8f('0x1'));var moment=require(_0xcb8f('0x2'));var BPromise=require(_0xcb8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb8f('0x4'));var db=require(_0xcb8f('0x5'))['db'];var utils=require(_0xcb8f('0x6'));var logger=require(_0xcb8f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb8f('0x8'));var client=jayson['client'][_0xcb8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x85d18,_0x3c3033,_0x26e392){return new BPromise(function(_0x51e1fb,_0x137be0){return client[_0xcb8f('0xa')](_0x85d18,_0x26e392)['then'](function(_0x42e3d4){logger[_0xcb8f('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x3c3033,_0xcb8f('0xc'));logger[_0xcb8f('0xd')](_0xcb8f('0xe'),_0x3c3033,'request\x20sent',JSON[_0xcb8f('0xf')](_0x42e3d4));if(_0x42e3d4[_0xcb8f('0x10')]){if(_0x42e3d4[_0xcb8f('0x10')][_0xcb8f('0x11')]===0x1f4){logger[_0xcb8f('0x10')](_0xcb8f('0x12'),_0x3c3033,_0x42e3d4[_0xcb8f('0x10')][_0xcb8f('0x13')]);return _0x137be0(_0x42e3d4[_0xcb8f('0x10')][_0xcb8f('0x13')]);}logger['error'](_0xcb8f('0x12'),_0x3c3033,_0x42e3d4[_0xcb8f('0x10')][_0xcb8f('0x13')]);return _0x51e1fb(_0x42e3d4[_0xcb8f('0x10')][_0xcb8f('0x13')]);}else{logger[_0xcb8f('0xb')](_0xcb8f('0x12'),_0x3c3033,_0xcb8f('0xc'));_0x51e1fb(_0x42e3d4[_0xcb8f('0x14')][_0xcb8f('0x13')]);}})[_0xcb8f('0x15')](function(_0xdb6e85){logger[_0xcb8f('0x10')](_0xcb8f('0x12'),_0x3c3033,_0xdb6e85);_0x137be0(_0xdb6e85);});});}exports[_0xcb8f('0x16')]=function(_0x4063d6){var _0xc55831=this;return new Promise(function(_0x2a027c,_0x1fc404){return db[_0xcb8f('0x17')][_0xcb8f('0x18')](_0x4063d6[_0xcb8f('0x19')],{'raw':_0x4063d6[_0xcb8f('0x1a')]?_0x4063d6[_0xcb8f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcb8f('0x1b')](function(_0x244222){logger[_0xcb8f('0xb')](_0xcb8f('0x16'),_0x4063d6);logger['debug'](_0xcb8f('0x16'),_0x4063d6,JSON['stringify'](_0x244222));_0x2a027c(_0x244222);})[_0xcb8f('0x15')](function(_0x5da1c3){logger[_0xcb8f('0x10')](_0xcb8f('0x16'),_0x5da1c3[_0xcb8f('0x13')],_0x4063d6);_0x1fc404(_0xc55831[_0xcb8f('0x10')](0x1f4,_0x5da1c3[_0xcb8f('0x13')]));});});};exports[_0xcb8f('0x1c')]=function(_0x62febc){var _0x257b2d=this;return new Promise(function(_0x398987,_0x5b5aa0){return db[_0xcb8f('0x17')][_0xcb8f('0x1d')](_0x62febc['body'],{'raw':_0x62febc[_0xcb8f('0x1a')]?_0x62febc[_0xcb8f('0x1a')][_0xcb8f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62febc[_0xcb8f('0x1a')]?_0x62febc['options'][_0xcb8f('0x1f')]||null:null,'attributes':_0x62febc['options']?_0x62febc['options'][_0xcb8f('0x20')]||null:null,'limit':_0x62febc[_0xcb8f('0x1a')]?_0x62febc[_0xcb8f('0x1a')]['limit']||null:null})[_0xcb8f('0x1b')](function(_0x292ff4){logger[_0xcb8f('0xb')](_0xcb8f('0x1c'),_0x62febc);logger[_0xcb8f('0xd')](_0xcb8f('0x1c'),_0x62febc,JSON[_0xcb8f('0xf')](_0x292ff4));_0x398987(_0x292ff4);})['catch'](function(_0x1c701d){logger[_0xcb8f('0x10')](_0xcb8f('0x1c'),_0x1c701d['message'],_0x62febc);_0x5b5aa0(_0x257b2d[_0xcb8f('0x10')](0x1f4,_0x1c701d['message']));});});}; \ No newline at end of file +var _0x64ac=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','then','debug','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0xd99ed8,_0x41d1b7){var _0x31a4ee=function(_0x3c9e51){while(--_0x3c9e51){_0xd99ed8['push'](_0xd99ed8['shift']());}};_0x31a4ee(++_0x41d1b7);}(_0x64ac,0xea));var _0xc64a=function(_0x3dd119,_0x4c431a){_0x3dd119=_0x3dd119-0x0;var _0x37a8da=_0x64ac[_0x3dd119];return _0x37a8da;};'use strict';var _=require(_0xc64a('0x0'));var util=require(_0xc64a('0x1'));var moment=require(_0xc64a('0x2'));var BPromise=require(_0xc64a('0x3'));var rs=require(_0xc64a('0x4'));var fs=require('fs');var Redis=require(_0xc64a('0x5'));var db=require(_0xc64a('0x6'))['db'];var utils=require(_0xc64a('0x7'));var logger=require('../../config/logger')(_0xc64a('0x8'));var config=require(_0xc64a('0x9'));var jayson=require(_0xc64a('0xa'));var client=jayson[_0xc64a('0xb')][_0xc64a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ebe30,_0x15e2ba,_0x481fb4){return new BPromise(function(_0x221674,_0x4e3869){return client['request'](_0x3ebe30,_0x481fb4)['then'](function(_0x4abe1f){logger[_0xc64a('0xd')](_0xc64a('0xe'),_0x15e2ba,'request\x20sent');logger['debug'](_0xc64a('0xf'),_0x15e2ba,_0xc64a('0x10'),JSON[_0xc64a('0x11')](_0x4abe1f));if(_0x4abe1f['error']){if(_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x13')]===0x1f4){logger[_0xc64a('0x12')](_0xc64a('0xe'),_0x15e2ba,_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x14')]);return _0x4e3869(_0x4abe1f['error'][_0xc64a('0x14')]);}logger[_0xc64a('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x15e2ba,_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x14')]);return _0x221674(_0x4abe1f[_0xc64a('0x12')][_0xc64a('0x14')]);}else{logger[_0xc64a('0xd')](_0xc64a('0xe'),_0x15e2ba,_0xc64a('0x10'));_0x221674(_0x4abe1f[_0xc64a('0x15')]['message']);}})[_0xc64a('0x16')](function(_0x456b7a){logger[_0xc64a('0x12')](_0xc64a('0xe'),_0x15e2ba,_0x456b7a);_0x4e3869(_0x456b7a);});});}exports[_0xc64a('0x17')]=function(_0x2ead6a){var _0x179b14=this;return new Promise(function(_0x3ebe07,_0x1f2f30){return db[_0xc64a('0x18')]['create'](_0x2ead6a['body'],{'raw':_0x2ead6a['options']?_0x2ead6a[_0xc64a('0x19')][_0xc64a('0x1a')]===undefined?!![]:![]:!![]})[_0xc64a('0x1b')](function(_0x19f6ba){logger[_0xc64a('0xd')]('CreateVoiceDialReport',_0x2ead6a);logger[_0xc64a('0x1c')](_0xc64a('0x17'),_0x2ead6a,JSON[_0xc64a('0x11')](_0x19f6ba));_0x3ebe07(_0x19f6ba);})[_0xc64a('0x16')](function(_0x996286){logger[_0xc64a('0x12')](_0xc64a('0x17'),_0x996286[_0xc64a('0x14')],_0x2ead6a);_0x1f2f30(_0x179b14[_0xc64a('0x12')](0x1f4,_0x996286[_0xc64a('0x14')]));});});};exports[_0xc64a('0x1d')]=function(_0x4b8073){var _0x296199=this;return new Promise(function(_0x45b6e1,_0x52e7a2){return db[_0xc64a('0x18')][_0xc64a('0x1e')](_0x4b8073['body'],{'raw':_0x4b8073[_0xc64a('0x19')]?_0x4b8073['options'][_0xc64a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8073[_0xc64a('0x19')]?_0x4b8073['options'][_0xc64a('0x1f')]||null:null,'attributes':_0x4b8073['options']?_0x4b8073[_0xc64a('0x19')][_0xc64a('0x20')]||null:null,'limit':_0x4b8073[_0xc64a('0x19')]?_0x4b8073[_0xc64a('0x19')][_0xc64a('0x21')]||null:null})[_0xc64a('0x1b')](function(_0xefd99c){logger[_0xc64a('0xd')](_0xc64a('0x1d'),_0x4b8073);logger[_0xc64a('0x1c')](_0xc64a('0x1d'),_0x4b8073,JSON['stringify'](_0xefd99c));_0x45b6e1(_0xefd99c);})[_0xc64a('0x16')](function(_0x6f8528){logger[_0xc64a('0x12')](_0xc64a('0x1d'),_0x6f8528['message'],_0x4b8073);_0x52e7a2(_0x296199[_0xc64a('0x12')](0x1f4,_0x6f8528[_0xc64a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 232f599..bf6e317 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 _0xe58b=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','/:id/applications','put','update','exports','util'];(function(_0x4850d1,_0xcbcf96){var _0x5d296b=function(_0x1ccffd){while(--_0x1ccffd){_0x4850d1['push'](_0x4850d1['shift']());}};_0x5d296b(++_0xcbcf96);}(_0xe58b,0x167));var _0xbe58=function(_0x864cdf,_0x37682b){_0x864cdf=_0x864cdf-0x0;var _0x196fb6=_0xe58b[_0x864cdf];return _0x196fb6;};'use strict';var multer=require('multer');var util=require(_0xbe58('0x0'));var path=require(_0xbe58('0x1'));var timeout=require(_0xbe58('0x2'));var express=require(_0xbe58('0x3'));var router=express['Router']();var fs_extra=require(_0xbe58('0x4'));var auth=require(_0xbe58('0x5'));var interaction=require(_0xbe58('0x6'));var config=require(_0xbe58('0x7'));var controller=require(_0xbe58('0x8'));router[_0xbe58('0x9')]('/',auth[_0xbe58('0xa')](),controller[_0xbe58('0xb')]);router['get'](_0xbe58('0xc'),auth['isAuthenticated'](),controller[_0xbe58('0xd')]);router['post']('/',auth[_0xbe58('0xa')](),controller[_0xbe58('0xe')]);router[_0xbe58('0xf')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller['addApplications']);router[_0xbe58('0x11')]('/:id',auth[_0xbe58('0xa')](),controller[_0xbe58('0x12')]);router['delete'](_0xbe58('0xc'),auth[_0xbe58('0xa')](),controller['destroy']);module[_0xbe58('0x13')]=router; \ No newline at end of file +var _0x9fcf=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4e6731,_0x483f9e){var _0x342fe=function(_0x31efdf){while(--_0x31efdf){_0x4e6731['push'](_0x4e6731['shift']());}};_0x342fe(++_0x483f9e);}(_0x9fcf,0xfe));var _0xf9fc=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x9fcf[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require('multer');var util=require(_0xf9fc('0x0'));var path=require(_0xf9fc('0x1'));var timeout=require(_0xf9fc('0x2'));var express=require(_0xf9fc('0x3'));var router=express['Router']();var fs_extra=require(_0xf9fc('0x4'));var auth=require(_0xf9fc('0x5'));var interaction=require(_0xf9fc('0x6'));var config=require(_0xf9fc('0x7'));var controller=require(_0xf9fc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf9fc('0x9')](_0xf9fc('0xa'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0xc')]);router[_0xf9fc('0xd')]('/',auth[_0xf9fc('0xb')](),controller[_0xf9fc('0xe')]);router[_0xf9fc('0xd')](_0xf9fc('0xf'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0x10')]);router[_0xf9fc('0x11')](_0xf9fc('0xa'),auth[_0xf9fc('0xb')](),controller['update']);router['delete'](_0xf9fc('0xa'),auth[_0xf9fc('0xb')](),controller[_0xf9fc('0x12')]);module[_0xf9fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f36e285..14a9925 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 _0x3afa=['inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM'];(function(_0x4b3906,_0x22f527){var _0x3450ba=function(_0x561279){while(--_0x561279){_0x4b3906['push'](_0x4b3906['shift']());}};_0x3450ba(++_0x22f527);}(_0x3afa,0x86));var _0xa3af=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x3afa[_0x36c6eb];return _0x30675b;};'use strict';var Sequelize=require(_0xa3af('0x0'));module[_0xa3af('0x1')]={'context':{'type':Sequelize[_0xa3af('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3af('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xa3af('0x3')},'tag':{'type':Sequelize[_0xa3af('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa3af('0x2')],'allowNull':![],'defaultValue':_0xa3af('0x4')},'appdata':{'type':Sequelize[_0xa3af('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa3af('0x5')](_0xa3af('0x6'),_0xa3af('0x7'),_0xa3af('0x8'),_0xa3af('0x9'),_0xa3af('0xa'),_0xa3af('0xb'),_0xa3af('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xa3af('0x2')]},'interval':{'type':Sequelize[_0xa3af('0x2')],'allowNull':![],'defaultValue':_0xa3af('0xd')},'IntervalId':{'type':Sequelize[_0xa3af('0xe')]},'isApp':{'type':Sequelize[_0xa3af('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa3af('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa3af('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xa3af('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa3af('0xe')]},'recordingFormat':{'type':Sequelize[_0xa3af('0x2')],'defaultValue':_0xa3af('0x10')},'answer':{'type':Sequelize[_0xa3af('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa3af('0x11')],'get':function(_0x17309f){return this[_0xa3af('0x12')](_0xa3af('0x13'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5294=['inbound-fax','system','any','BOOLEAN','INTEGER','wav','exten','exports','STRING','compositeIndex','ENUM'];(function(_0x32b190,_0xbdaf4c){var _0x22fdd5=function(_0x455194){while(--_0x455194){_0x32b190['push'](_0x32b190['shift']());}};_0x22fdd5(++_0xbdaf4c);}(_0x5294,0x130));var _0x4529=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5294[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module[_0x4529('0x0')]={'context':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'unique':_0x4529('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'unique':_0x4529('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4529('0x2')},'tag':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4529('0x3')]('inbound','outbound','internal',_0x4529('0x4'),'outbound-fax',_0x4529('0x5'),_0x4529('0x6')),'allowNull':![]},'description':{'type':Sequelize[_0x4529('0x1')]},'interval':{'type':Sequelize[_0x4529('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4529('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4529('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4529('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x4529('0x7')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4529('0x8')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x4529('0x9')},'answer':{'type':Sequelize[_0x4529('0x7')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3995ce){return this['getDataValue'](_0x4529('0xa'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 5412483..daacaf0 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 _0x94ba=['sequelize','Transaction','findOne','isApp','bulkCreate','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./voiceExtension.socket','register','sendStatus','json','offset','limit','undefined','count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','end','error','stack','status','send','index','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','VoiceExtension','catch','show','params','options','find','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','transaction'];(function(_0x193bec,_0x5bbea3){var _0x3aea83=function(_0x2d9baa){while(--_0x2d9baa){_0x193bec['push'](_0x193bec['shift']());}};_0x3aea83(++_0x5bbea3);}(_0x94ba,0xbe));var _0xa94b=function(_0x1fd3e2,_0x1a6772){_0x1fd3e2=_0x1fd3e2-0x0;var _0x5a9210=_0x94ba[_0x1fd3e2];return _0x5a9210;};'use strict';var _=require(_0xa94b('0x0'));var Redis=require(_0xa94b('0x1'));var qs=require(_0xa94b('0x2'));var logger=require(_0xa94b('0x3'))(_0xa94b('0x4'));var config=require('../../config/environment');var db=require(_0xa94b('0x5'))['db'];config['redis']=_[_0xa94b('0x6')](config[_0xa94b('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa94b('0x7')]));require(_0xa94b('0x8'))[_0xa94b('0x9')](socket);function respondWithStatusCode(_0x262c09,_0x54c158){_0x54c158=_0x54c158||0xcc;return function(_0x41aca1){if(_0x41aca1){return _0x262c09[_0xa94b('0xa')](_0x54c158);}return _0x262c09['status'](_0x54c158)['end']();};}function respondWithResult(_0x1aaa45,_0x138a50){_0x138a50=_0x138a50||0xc8;return function(_0x1ba4f8){if(_0x1ba4f8){return _0x1aaa45['status'](_0x138a50)[_0xa94b('0xb')](_0x1ba4f8);}};}function respondWithFilteredResult(_0x10b8cc,_0xba8fdb){return function(_0x34e4bf){if(_0x34e4bf){var _0x43ffd8=typeof _0xba8fdb[_0xa94b('0xc')]==='undefined'&&typeof _0xba8fdb[_0xa94b('0xd')]===_0xa94b('0xe');var _0x25bb50=_0x34e4bf[_0xa94b('0xf')];var _0x162f7c=_0x43ffd8?0x0:_0xba8fdb[_0xa94b('0xc')];var _0x1f93bb=_0x43ffd8?_0x34e4bf[_0xa94b('0xf')]:_0xba8fdb['offset']+_0xba8fdb[_0xa94b('0xd')];var _0x1e5f23;if(_0x1f93bb>=_0x25bb50){_0x1f93bb=_0x25bb50;_0x1e5f23=0xc8;}else{_0x1e5f23=0xce;}_0x10b8cc['status'](_0x1e5f23);return _0x10b8cc[_0xa94b('0x10')]('Content-Range',_0x162f7c+'-'+_0x1f93bb+'/'+_0x25bb50)['json'](_0x34e4bf);}return null;};}function removeEntity(_0x511a2a){return function(_0x2199cd){if(_0x2199cd){return _0x2199cd[_0xa94b('0x11')]()[_0xa94b('0x12')](function(){var _0x29641d=_0x2199cd[_0xa94b('0x13')]({'plain':!![]});var _0x38e446=[{'name':_0xa94b('0x14'),'value':_0xa94b('0x15'),'ignore':![]},{'name':_0xa94b('0x16'),'value':_0xa94b('0x17'),'ignore':![]},{'name':_0xa94b('0x18'),'value':_0xa94b('0x19'),'ignore':![]}];var _0x24e2b0=_(_0x38e446)[_0xa94b('0x1a')](_0xa94b('0x1b'))[_0xa94b('0x1c')](_0xa94b('0x1d'))[_0xa94b('0x1d')]();if(_[_0xa94b('0x1e')](_0x24e2b0,_0x29641d[_0xa94b('0x1f')])){return;}var _0x394ac9=_['find'](_0x38e446,[_0xa94b('0x1d'),_0x29641d[_0xa94b('0x1f')]])[_0xa94b('0x20')];return db[_0xa94b('0x21')][_0xa94b('0x11')]({'where':{'type':_0x394ac9,'resourceId':_0x29641d['id']}})[_0xa94b('0x12')](function(){return _0x2199cd;});})[_0xa94b('0x12')](function(){_0x511a2a['status'](0xcc)[_0xa94b('0x22')]();});}};}function handleEntityNotFound(_0x987123){return function(_0x1f9577){if(!_0x1f9577){_0x987123[_0xa94b('0xa')](0x194);}return _0x1f9577;};}function handleError(_0x29df3d,_0x1d2869){_0x1d2869=_0x1d2869||0x1f4;return function(_0x6aa3e1){logger[_0xa94b('0x23')](_0x6aa3e1[_0xa94b('0x24')]);if(_0x6aa3e1['name']){delete _0x6aa3e1['name'];}_0x29df3d[_0xa94b('0x25')](_0x1d2869)[_0xa94b('0x26')](_0x6aa3e1);};}exports[_0xa94b('0x27')]=function(_0x1c598d,_0x242a7e){var _0x439d96={},_0x60f587={},_0x539b33={'count':0x0,'rows':[]};var _0x5cdbe1=_[_0xa94b('0x1c')](db['VoiceExtension'][_0xa94b('0x28')],function(_0x475566){return{'name':_0x475566[_0xa94b('0x29')],'type':_0x475566[_0xa94b('0x1f')][_0xa94b('0x2a')]};});_0x60f587['model']=_[_0xa94b('0x1c')](_0x5cdbe1,_0xa94b('0x20'));_0x60f587['query']=_[_0xa94b('0x2b')](_0x1c598d[_0xa94b('0x2c')]);_0x60f587[_0xa94b('0x2d')]=_[_0xa94b('0x2e')](_0x60f587[_0xa94b('0x2f')],_0x60f587[_0xa94b('0x2c')]);_0x439d96[_0xa94b('0x30')]=_[_0xa94b('0x2e')](_0x60f587[_0xa94b('0x2f')],qs[_0xa94b('0x31')](_0x1c598d[_0xa94b('0x2c')][_0xa94b('0x31')]));_0x439d96[_0xa94b('0x30')]=_0x439d96['attributes'][_0xa94b('0x32')]?_0x439d96[_0xa94b('0x30')]:_0x60f587[_0xa94b('0x2f')];if(!_0x1c598d[_0xa94b('0x2c')][_0xa94b('0x33')](_0xa94b('0x34'))){_0x439d96[_0xa94b('0xd')]=qs[_0xa94b('0xd')](_0x1c598d[_0xa94b('0x2c')][_0xa94b('0xd')]);_0x439d96[_0xa94b('0xc')]=qs[_0xa94b('0xc')](_0x1c598d[_0xa94b('0x2c')][_0xa94b('0xc')]);}_0x439d96[_0xa94b('0x35')]=qs[_0xa94b('0x36')](_0x1c598d[_0xa94b('0x2c')]['sort']);_0x439d96[_0xa94b('0x37')]=qs[_0xa94b('0x2d')](_[_0xa94b('0x38')](_0x1c598d[_0xa94b('0x2c')],_0x60f587['filters']),_0x5cdbe1);if(_0x1c598d[_0xa94b('0x2c')][_0xa94b('0x1a')]){_0x439d96['where']=_[_0xa94b('0x39')](_0x439d96[_0xa94b('0x37')],{'$or':_['map'](_0x5cdbe1,function(_0x6ce53b){if(_0x6ce53b[_0xa94b('0x1f')]!==_0xa94b('0x3a')){var _0x3fc5a7={};_0x3fc5a7[_0x6ce53b[_0xa94b('0x20')]]={'$like':'%'+_0x1c598d[_0xa94b('0x2c')][_0xa94b('0x1a')]+'%'};return _0x3fc5a7;}})});}_0x439d96=_[_0xa94b('0x39')]({},_0x439d96,_0x1c598d['options']);var _0x157bdb={'where':_0x439d96[_0xa94b('0x37')]};return db['VoiceExtension'][_0xa94b('0xf')](_0x157bdb)[_0xa94b('0x12')](function(_0x16695a){_0x539b33[_0xa94b('0xf')]=_0x16695a;if(_0x1c598d[_0xa94b('0x2c')][_0xa94b('0x3b')]){_0x439d96[_0xa94b('0x3c')]=[{'all':!![]}];}return db[_0xa94b('0x3d')]['findAll'](_0x439d96);})[_0xa94b('0x12')](function(_0x3e6c18){_0x539b33['rows']=_0x3e6c18;return _0x539b33;})['then'](respondWithFilteredResult(_0x242a7e,_0x439d96))[_0xa94b('0x3e')](handleError(_0x242a7e,null));};exports[_0xa94b('0x3f')]=function(_0x1a5094,_0x1dcdaa){var _0x439259={'raw':![],'where':{'id':_0x1a5094[_0xa94b('0x40')]['id']}},_0x4203c0={};_0x4203c0['model']=_[_0xa94b('0x2b')](db[_0xa94b('0x3d')][_0xa94b('0x28')]);_0x4203c0['query']=_[_0xa94b('0x2b')](_0x1a5094['query']);_0x4203c0[_0xa94b('0x2d')]=_[_0xa94b('0x2e')](_0x4203c0['model'],_0x4203c0[_0xa94b('0x2c')]);_0x439259[_0xa94b('0x30')]=_['intersection'](_0x4203c0['model'],qs[_0xa94b('0x31')](_0x1a5094[_0xa94b('0x2c')][_0xa94b('0x31')]));_0x439259['attributes']=_0x439259[_0xa94b('0x30')]['length']?_0x439259['attributes']:_0x4203c0[_0xa94b('0x2f')];if(_0x1a5094[_0xa94b('0x2c')][_0xa94b('0x3b')]){_0x439259[_0xa94b('0x3c')]=[{'all':!![]}];}_0x439259=_[_0xa94b('0x39')]({},_0x439259,_0x1a5094[_0xa94b('0x41')]);return db[_0xa94b('0x3d')][_0xa94b('0x42')](_0x439259)[_0xa94b('0x12')](handleEntityNotFound(_0x1dcdaa,null))[_0xa94b('0x12')](respondWithResult(_0x1dcdaa,null))[_0xa94b('0x3e')](handleError(_0x1dcdaa,null));};exports[_0xa94b('0x11')]=function(_0x21856d,_0x485ec3){return db['VoiceExtension']['find']({'where':{'id':_0x21856d[_0xa94b('0x40')]['id']}})[_0xa94b('0x12')](handleEntityNotFound(_0x485ec3,null))[_0xa94b('0x12')](removeEntity(_0x485ec3,null))[_0xa94b('0x3e')](handleError(_0x485ec3,null));};exports[_0xa94b('0x43')]=function(_0x13aecc,_0x8a1f8e){if(_0x13aecc[_0xa94b('0x44')][_0xa94b('0x1f')]===_0xa94b('0x17')&&!_[_0xa94b('0x45')](_0x13aecc[_0xa94b('0x44')][_0xa94b('0x46')],'_')){_0x13aecc[_0xa94b('0x44')][_0xa94b('0x46')]='_'[_0xa94b('0x47')](_0x13aecc['body']['exten']);}return db[_0xa94b('0x3d')][_0xa94b('0x43')](_0x13aecc[_0xa94b('0x44')],{'raw':![]})[_0xa94b('0x12')](function(_0x7e8121){var _0x59cb88=_0x13aecc[_0xa94b('0x48')]['get']({'plain':!![]});if(!_0x59cb88)throw new Error(_0xa94b('0x49'));if(_0x59cb88[_0xa94b('0x4a')]===_0xa94b('0x48')){var _0x51a470=_0x7e8121[_0xa94b('0x13')]({'plain':!![]});var _0x4c96ec=[{'name':_0xa94b('0x14'),'value':'inbound'},{'name':_0xa94b('0x16'),'value':_0xa94b('0x17')},{'name':_0xa94b('0x18'),'value':_0xa94b('0x19')}];var _0x442498=_[_0xa94b('0x42')](_0x4c96ec,['value',_0x51a470[_0xa94b('0x1f')]])[_0xa94b('0x20')];return db[_0xa94b('0x4b')]['find']({'where':{'name':_0x442498,'userProfileId':_0x59cb88[_0xa94b('0x4c')]},'raw':!![]})['then'](function(_0x817d16){if(_0x817d16&&_0x817d16[_0xa94b('0x4d')]===0x0){return db['UserProfileResource'][_0xa94b('0x43')]({'name':_0x51a470['name'],'resourceId':_0x51a470['id'],'type':_0x817d16[_0xa94b('0x20')],'sectionId':_0x817d16['id']},{})[_0xa94b('0x12')](function(){return _0x7e8121;});}else{return _0x7e8121;}})[_0xa94b('0x3e')](function(_0x44fcc4){logger[_0xa94b('0x23')](_0xa94b('0x4e'),_0x44fcc4);throw _0x44fcc4;});}return _0x7e8121;})['then'](respondWithResult(_0x8a1f8e,0xc9))[_0xa94b('0x3e')](handleError(_0x8a1f8e,null));};exports[_0xa94b('0x4f')]=function(_0x153146,_0x5788e7){if(_0x153146[_0xa94b('0x44')]['id']){delete _0x153146[_0xa94b('0x44')]['id'];}return db[_0xa94b('0x3d')][_0xa94b('0x42')]({'where':{'id':_0x153146['params']['id']}})[_0xa94b('0x12')](handleEntityNotFound(_0x5788e7,null))[_0xa94b('0x12')](function(_0x465b37){if(_0x465b37){return db[_0xa94b('0x3d')][_0xa94b('0x4f')](_[_0xa94b('0x38')](_0x153146[_0xa94b('0x44')],[_0xa94b('0x46'),_0xa94b('0x50'),'description',_0xa94b('0x51'),_0xa94b('0x52'),_0xa94b('0x53'),_0xa94b('0x54')]),{'where':{'context':_0x465b37[_0xa94b('0x50')],'exten':_0x465b37['exten']},'individualHooks':!![]})[_0xa94b('0x12')](function(_0x3af84e){return _0x3af84e;});}return null;})[_0xa94b('0x12')](respondWithStatusCode(_0x5788e7,null))['catch'](handleError(_0x5788e7,null));};exports['addApplications']=function(_0x35f47d,_0x4d1744){var _0x902813=_0x35f47d[_0xa94b('0x40')]['id'];var _0x17bbe8=_0x35f47d[_0xa94b('0x44')];var _0x4ac63a=0xc8;var _0x259ecf=null;return db['sequelize'][_0xa94b('0x55')]({'isolationLevel':db[_0xa94b('0x56')][_0xa94b('0x57')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x42de03){return db['VoiceExtension'][_0xa94b('0x58')]({'where':{'id':_0x902813},'transaction':_0x42de03})[_0xa94b('0x12')](function(_0x71a61e){if(_0x71a61e){return db['VoiceExtension'][_0xa94b('0x11')]({'where':{'VoiceExtensionId':_0x902813},'transaction':_0x42de03})[_0xa94b('0x12')](function(){var _0x3f5ddf=_[_0xa94b('0x1c')](_0x17bbe8,function(_0x29c8fa){_0x29c8fa['VoiceExtensionId']=_0x902813;_0x29c8fa[_0xa94b('0x59')]=!![];return _0x29c8fa;});return _0x71a61e['createRouting'](_0x3f5ddf);})[_0xa94b('0x12')](function(_0x15223c){return db['VoiceExtension'][_0xa94b('0x5a')](_0x15223c,{'transaction':_0x42de03});});}else{_0x4ac63a=0x194;_0x259ecf=[];}});})['then'](function(){if(_0x4ac63a!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x902813},'order':'cast(priority\x20as\x20unsigned)'})[_0xa94b('0x12')](function(_0x48f9ae){_0x259ecf=_0x48f9ae;});}})[_0xa94b('0x3e')](function(_0x43e8a7){_0x4ac63a=0x1f4;logger['error'](_0x43e8a7['stack']);if(_0x43e8a7['name']){delete _0x43e8a7[_0xa94b('0x20')];}_0x259ecf=_0x43e8a7;})[_0xa94b('0x5b')](function(){if(_0x259ecf===null){_0x4d1744['sendStatus'](_0x4ac63a);}else{if(_0x4ac63a===0x1f4){_0x4d1744['status'](_0x4ac63a)[_0xa94b('0x26')](_0x259ecf);}else{_0x4d1744['status'](_0x4ac63a)[_0xa94b('0xb')](_0x259ecf);}}});}; \ No newline at end of file +var _0x4588=['UserProfileResource','sendStatus','error','stack','index','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','VoiceExtension','includeAll','include','findAll','catch','show','keys','body','startsWith','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','recordingFormat','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name'];(function(_0x306c3a,_0x5797b5){var _0x1ae671=function(_0xc152ae){while(--_0xc152ae){_0x306c3a['push'](_0x306c3a['shift']());}};_0x1ae671(++_0x5797b5);}(_0x4588,0x1bc));var _0x8458=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x4588[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0x8458('0x0'));var Redis=require(_0x8458('0x1'));var qs=require(_0x8458('0x2'));var logger=require('../../config/logger')(_0x8458('0x3'));var config=require(_0x8458('0x4'));var db=require(_0x8458('0x5'))['db'];config['redis']=_[_0x8458('0x6')](config[_0x8458('0x7')],{'host':_0x8458('0x8'),'port':0x18eb});var socket=require(_0x8458('0x9'))(new Redis(config[_0x8458('0x7')]));require('./voiceExtension.socket')[_0x8458('0xa')](socket);function respondWithStatusCode(_0x115ca3,_0x503187){_0x503187=_0x503187||0xcc;return function(_0x446416){if(_0x446416){return _0x115ca3['sendStatus'](_0x503187);}return _0x115ca3['status'](_0x503187)[_0x8458('0xb')]();};}function respondWithResult(_0x1d7e38,_0xccbd63){_0xccbd63=_0xccbd63||0xc8;return function(_0x549bb1){if(_0x549bb1){return _0x1d7e38[_0x8458('0xc')](_0xccbd63)[_0x8458('0xd')](_0x549bb1);}};}function respondWithFilteredResult(_0x3493b2,_0x358b25){return function(_0x83682a){if(_0x83682a){var _0xc775fd=typeof _0x358b25[_0x8458('0xe')]==='undefined'&&typeof _0x358b25[_0x8458('0xf')]===_0x8458('0x10');var _0xc851ae=_0x83682a['count'];var _0xc837af=_0xc775fd?0x0:_0x358b25['offset'];var _0x9fbaa6=_0xc775fd?_0x83682a[_0x8458('0x11')]:_0x358b25['offset']+_0x358b25['limit'];var _0x24e3dc;if(_0x9fbaa6>=_0xc851ae){_0x9fbaa6=_0xc851ae;_0x24e3dc=0xc8;}else{_0x24e3dc=0xce;}_0x3493b2['status'](_0x24e3dc);return _0x3493b2[_0x8458('0x12')]('Content-Range',_0xc837af+'-'+_0x9fbaa6+'/'+_0xc851ae)['json'](_0x83682a);}return null;};}function removeEntity(_0x46dfa7){return function(_0x4dabcc){if(_0x4dabcc){return _0x4dabcc[_0x8458('0x13')]()[_0x8458('0x14')](function(){var _0x1f284d=_0x4dabcc[_0x8458('0x15')]({'plain':!![]});var _0x3518dc=[{'name':_0x8458('0x16'),'value':_0x8458('0x17'),'ignore':![]},{'name':_0x8458('0x18'),'value':_0x8458('0x19'),'ignore':![]},{'name':_0x8458('0x1a'),'value':_0x8458('0x1b'),'ignore':![]}];var _0x242875=_(_0x3518dc)[_0x8458('0x1c')](_0x8458('0x1d'))[_0x8458('0x1e')](_0x8458('0x1f'))[_0x8458('0x1f')]();if(_[_0x8458('0x20')](_0x242875,_0x1f284d[_0x8458('0x21')])){return;}var _0x43bc10=_[_0x8458('0x22')](_0x3518dc,[_0x8458('0x1f'),_0x1f284d[_0x8458('0x21')]])[_0x8458('0x23')];return db[_0x8458('0x24')][_0x8458('0x13')]({'where':{'type':_0x43bc10,'resourceId':_0x1f284d['id']}})[_0x8458('0x14')](function(){return _0x4dabcc;});})[_0x8458('0x14')](function(){_0x46dfa7[_0x8458('0xc')](0xcc)[_0x8458('0xb')]();});}};}function handleEntityNotFound(_0x17b5fe){return function(_0x3a047f){if(!_0x3a047f){_0x17b5fe[_0x8458('0x25')](0x194);}return _0x3a047f;};}function handleError(_0x1c6242,_0x4e7653){_0x4e7653=_0x4e7653||0x1f4;return function(_0x611f73){logger[_0x8458('0x26')](_0x611f73[_0x8458('0x27')]);if(_0x611f73[_0x8458('0x23')]){delete _0x611f73['name'];}_0x1c6242['status'](_0x4e7653)['send'](_0x611f73);};}exports[_0x8458('0x28')]=function(_0x828d1a,_0x528e81){var _0x55be93={},_0x57ed59={},_0x4d1acf={'count':0x0,'rows':[]};var _0xc652d2=_['map'](db['VoiceExtension']['rawAttributes'],function(_0xcf28f){return{'name':_0xcf28f[_0x8458('0x29')],'type':_0xcf28f[_0x8458('0x21')][_0x8458('0x2a')]};});_0x57ed59['model']=_[_0x8458('0x1e')](_0xc652d2,_0x8458('0x23'));_0x57ed59[_0x8458('0x2b')]=_['keys'](_0x828d1a[_0x8458('0x2b')]);_0x57ed59[_0x8458('0x2c')]=_[_0x8458('0x2d')](_0x57ed59[_0x8458('0x2e')],_0x57ed59[_0x8458('0x2b')]);_0x55be93[_0x8458('0x2f')]=_[_0x8458('0x2d')](_0x57ed59[_0x8458('0x2e')],qs['fields'](_0x828d1a[_0x8458('0x2b')][_0x8458('0x30')]));_0x55be93[_0x8458('0x2f')]=_0x55be93['attributes'][_0x8458('0x31')]?_0x55be93[_0x8458('0x2f')]:_0x57ed59[_0x8458('0x2e')];if(!_0x828d1a[_0x8458('0x2b')][_0x8458('0x32')](_0x8458('0x33'))){_0x55be93[_0x8458('0xf')]=qs['limit'](_0x828d1a[_0x8458('0x2b')][_0x8458('0xf')]);_0x55be93[_0x8458('0xe')]=qs[_0x8458('0xe')](_0x828d1a[_0x8458('0x2b')]['offset']);}_0x55be93[_0x8458('0x34')]=qs[_0x8458('0x35')](_0x828d1a[_0x8458('0x2b')][_0x8458('0x35')]);_0x55be93[_0x8458('0x36')]=qs[_0x8458('0x2c')](_[_0x8458('0x37')](_0x828d1a[_0x8458('0x2b')],_0x57ed59['filters']),_0xc652d2);if(_0x828d1a[_0x8458('0x2b')][_0x8458('0x1c')]){_0x55be93[_0x8458('0x36')]=_[_0x8458('0x38')](_0x55be93[_0x8458('0x36')],{'$or':_['map'](_0xc652d2,function(_0x5a8ce4){if(_0x5a8ce4['type']!=='VIRTUAL'){var _0x53a860={};_0x53a860[_0x5a8ce4[_0x8458('0x23')]]={'$like':'%'+_0x828d1a[_0x8458('0x2b')][_0x8458('0x1c')]+'%'};return _0x53a860;}})});}_0x55be93=_[_0x8458('0x38')]({},_0x55be93,_0x828d1a[_0x8458('0x39')]);var _0x4390b7={'where':_0x55be93[_0x8458('0x36')]};return db[_0x8458('0x3a')][_0x8458('0x11')](_0x4390b7)['then'](function(_0x2f48f9){_0x4d1acf[_0x8458('0x11')]=_0x2f48f9;if(_0x828d1a['query'][_0x8458('0x3b')]){_0x55be93[_0x8458('0x3c')]=[{'all':!![]}];}return db[_0x8458('0x3a')][_0x8458('0x3d')](_0x55be93);})['then'](function(_0x2efe9b){_0x4d1acf['rows']=_0x2efe9b;return _0x4d1acf;})['then'](respondWithFilteredResult(_0x528e81,_0x55be93))[_0x8458('0x3e')](handleError(_0x528e81,null));};exports[_0x8458('0x3f')]=function(_0xc673b7,_0x5f2649){var _0x1a096d={'raw':![],'where':{'id':_0xc673b7['params']['id']}},_0x3619ef={};_0x3619ef[_0x8458('0x2e')]=_[_0x8458('0x40')](db[_0x8458('0x3a')]['rawAttributes']);_0x3619ef[_0x8458('0x2b')]=_[_0x8458('0x40')](_0xc673b7[_0x8458('0x2b')]);_0x3619ef['filters']=_[_0x8458('0x2d')](_0x3619ef[_0x8458('0x2e')],_0x3619ef[_0x8458('0x2b')]);_0x1a096d[_0x8458('0x2f')]=_[_0x8458('0x2d')](_0x3619ef[_0x8458('0x2e')],qs['fields'](_0xc673b7[_0x8458('0x2b')][_0x8458('0x30')]));_0x1a096d[_0x8458('0x2f')]=_0x1a096d['attributes'][_0x8458('0x31')]?_0x1a096d[_0x8458('0x2f')]:_0x3619ef['model'];if(_0xc673b7[_0x8458('0x2b')]['includeAll']){_0x1a096d[_0x8458('0x3c')]=[{'all':!![]}];}_0x1a096d=_[_0x8458('0x38')]({},_0x1a096d,_0xc673b7[_0x8458('0x39')]);return db[_0x8458('0x3a')]['find'](_0x1a096d)[_0x8458('0x14')](handleEntityNotFound(_0x5f2649,null))[_0x8458('0x14')](respondWithResult(_0x5f2649,null))[_0x8458('0x3e')](handleError(_0x5f2649,null));};exports['destroy']=function(_0xb616c4,_0x4b4dcd){return db[_0x8458('0x3a')]['find']({'where':{'id':_0xb616c4['params']['id']}})[_0x8458('0x14')](handleEntityNotFound(_0x4b4dcd,null))['then'](removeEntity(_0x4b4dcd,null))[_0x8458('0x3e')](handleError(_0x4b4dcd,null));};exports['create']=function(_0x1a8d9c,_0x354f9b){if(_0x1a8d9c[_0x8458('0x41')]['type']==='outbound'&&!_[_0x8458('0x42')](_0x1a8d9c[_0x8458('0x41')]['exten'],'_')){_0x1a8d9c['body'][_0x8458('0x43')]='_'['concat'](_0x1a8d9c[_0x8458('0x41')][_0x8458('0x43')]);}return db['VoiceExtension'][_0x8458('0x44')](_0x1a8d9c[_0x8458('0x41')],{'raw':![]})['then'](function(_0x3a3562){var _0x4ff6cf=_0x1a8d9c[_0x8458('0x45')][_0x8458('0x15')]({'plain':!![]});if(!_0x4ff6cf)throw new Error(_0x8458('0x46'));if(_0x4ff6cf[_0x8458('0x47')]==='user'){var _0x2b5254=_0x3a3562[_0x8458('0x15')]({'plain':!![]});var _0x5e05ca=[{'name':'InboundRoutes','value':_0x8458('0x17')},{'name':'OutboundRoutes','value':_0x8458('0x19')},{'name':_0x8458('0x1a'),'value':'internal'}];var _0xbd2edb=_[_0x8458('0x22')](_0x5e05ca,[_0x8458('0x1f'),_0x2b5254['type']])[_0x8458('0x23')];return db[_0x8458('0x48')]['find']({'where':{'name':_0xbd2edb,'userProfileId':_0x4ff6cf[_0x8458('0x49')]},'raw':!![]})['then'](function(_0x55f46d){if(_0x55f46d&&_0x55f46d[_0x8458('0x4a')]===0x0){return db[_0x8458('0x24')][_0x8458('0x44')]({'name':_0x2b5254[_0x8458('0x23')],'resourceId':_0x2b5254['id'],'type':_0x55f46d[_0x8458('0x23')],'sectionId':_0x55f46d['id']},{})[_0x8458('0x14')](function(){return _0x3a3562;});}else{return _0x3a3562;}})['catch'](function(_0x211c34){logger[_0x8458('0x26')](_0x8458('0x4b'),_0x211c34);throw _0x211c34;});}return _0x3a3562;})['then'](respondWithResult(_0x354f9b,0xc9))[_0x8458('0x3e')](handleError(_0x354f9b,null));};exports[_0x8458('0x4c')]=function(_0x3e4350,_0x594777){if(_0x3e4350[_0x8458('0x41')]['id']){delete _0x3e4350[_0x8458('0x41')]['id'];}return db['VoiceExtension'][_0x8458('0x22')]({'where':{'id':_0x3e4350[_0x8458('0x4d')]['id']}})[_0x8458('0x14')](handleEntityNotFound(_0x594777,null))['then'](function(_0x40815d){if(_0x40815d){return db[_0x8458('0x3a')]['update'](_[_0x8458('0x37')](_0x3e4350[_0x8458('0x41')],[_0x8458('0x43'),'context','description',_0x8458('0x4e'),'cutdigits',_0x8458('0x4f'),_0x8458('0x50')]),{'where':{'context':_0x40815d[_0x8458('0x51')],'exten':_0x40815d[_0x8458('0x43')]},'individualHooks':!![]})[_0x8458('0x14')](function(_0x49372a){return _0x49372a;});}return null;})[_0x8458('0x14')](respondWithStatusCode(_0x594777,null))[_0x8458('0x3e')](handleError(_0x594777,null));};exports[_0x8458('0x52')]=function(_0x5864b4,_0x112782){var _0x1da20d=_0x5864b4['params']['id'];var _0x39df41=_0x5864b4[_0x8458('0x41')];var _0x5d6247=0xc8;var _0x5f22fe=null;return db[_0x8458('0x53')][_0x8458('0x54')]({'isolationLevel':db[_0x8458('0x53')]['Transaction'][_0x8458('0x55')][_0x8458('0x56')]},function(_0x3d0c4c){return db[_0x8458('0x3a')][_0x8458('0x57')]({'where':{'id':_0x1da20d},'transaction':_0x3d0c4c})[_0x8458('0x14')](function(_0x22565a){if(_0x22565a){return db[_0x8458('0x3a')][_0x8458('0x13')]({'where':{'VoiceExtensionId':_0x1da20d},'transaction':_0x3d0c4c})['then'](function(){var _0x59337e=_['map'](_0x39df41,function(_0x299d95){_0x299d95[_0x8458('0x58')]=_0x1da20d;_0x299d95[_0x8458('0x59')]=!![];return _0x299d95;});return _0x22565a[_0x8458('0x5a')](_0x59337e);})['then'](function(_0x274c81){return db[_0x8458('0x3a')][_0x8458('0x5b')](_0x274c81,{'transaction':_0x3d0c4c});});}else{_0x5d6247=0x194;_0x5f22fe=[];}});})[_0x8458('0x14')](function(){if(_0x5d6247!==0x194){return db[_0x8458('0x3a')][_0x8458('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1da20d},'order':_0x8458('0x5d')})[_0x8458('0x14')](function(_0x206651){_0x5f22fe=_0x206651;});}})[_0x8458('0x3e')](function(_0x31d00e){_0x5d6247=0x1f4;logger['error'](_0x31d00e[_0x8458('0x27')]);if(_0x31d00e[_0x8458('0x23')]){delete _0x31d00e[_0x8458('0x23')];}_0x5f22fe=_0x31d00e;})[_0x8458('0x5e')](function(){if(_0x5f22fe===null){_0x112782['sendStatus'](_0x5d6247);}else{if(_0x5d6247===0x1f4){_0x112782[_0x8458('0xc')](_0x5d6247)[_0x8458('0x5f')](_0x5f22fe);}else{_0x112782['status'](_0x5d6247)[_0x8458('0xd')](_0x5f22fe);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ff79b7f..b38c143 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 _0xebf9=['save','update','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners'];(function(_0xa28b17,_0x171472){var _0x2129b9=function(_0x4cbfff){while(--_0x4cbfff){_0xa28b17['push'](_0xa28b17['shift']());}};_0x2129b9(++_0x171472);}(_0xebf9,0x192));var _0x9ebf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xebf9[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x9ebf('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9ebf('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9ebf('0x2')](0x0);var events={'afterCreate':_0x9ebf('0x3'),'afterUpdate':_0x9ebf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53bb5c){return function(_0x4588f4,_0xa56ffd,_0x9497cf){VoiceExtensionEvents[_0x9ebf('0x5')](_0x53bb5c+':'+_0x4588f4['id'],_0x4588f4);VoiceExtensionEvents[_0x9ebf('0x5')](_0x53bb5c,_0x4588f4);_0x9497cf(null);};}for(var e in events){if(events[_0x9ebf('0x6')](e)){var event=events[e];VoiceExtension[_0x9ebf('0x7')](e,emitEvent(event));}}module[_0x9ebf('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb6cc=['hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','save','update','remove','emit'];(function(_0x3d76ac,_0x505692){var _0x5f138b=function(_0x4247f7){while(--_0x4247f7){_0x3d76ac['push'](_0x3d76ac['shift']());}};_0x5f138b(++_0x505692);}(_0xb6cc,0x13e));var _0xcb6c=function(_0x47143f,_0x3942b4){_0x47143f=_0x47143f-0x0;var _0x3cc09f=_0xb6cc[_0x47143f];return _0x3cc09f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xcb6c('0x0'))['db'][_0xcb6c('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb6c('0x2'),'afterUpdate':_0xcb6c('0x3'),'afterDestroy':_0xcb6c('0x4')};function emitEvent(_0x55f0b2){return function(_0x4f1b1c,_0xa66e18,_0x1080b3){VoiceExtensionEvents[_0xcb6c('0x5')](_0x55f0b2+':'+_0x4f1b1c['id'],_0x4f1b1c);VoiceExtensionEvents[_0xcb6c('0x5')](_0x55f0b2,_0x4f1b1c);_0x1080b3(null);};}for(var e in events){if(events[_0xcb6c('0x6')](e)){var event=events[e];VoiceExtension[_0xcb6c('0x7')](e,emitEvent(event));}}module[_0xcb6c('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b1dab95..24d5efc 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 _0x96c8=['context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','options','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','./voiceExtension.attributes','exports','models','type','Set'];(function(_0x4226e8,_0x5cdd46){var _0x13c031=function(_0x59356b){while(--_0x59356b){_0x4226e8['push'](_0x4226e8['shift']());}};_0x13c031(++_0x5cdd46);}(_0x96c8,0xa3));var _0x896c=function(_0x4d6873,_0x251f7a){_0x4d6873=_0x4d6873-0x0;var _0x11fdff=_0x96c8[_0x4d6873];return _0x11fdff;};'use strict';var _=require('lodash');var attributes=require(_0x896c('0x0'));module[_0x896c('0x1')]=function(_0x53809d){var _0x2d7278=_0x53809d[_0x896c('0x2')];function _0x4a3de1(_0x5e3506){var _0x2a189c=0x2;var _0x40c034=[{'type':_0x5e3506[_0x896c('0x3')],'app':_0x896c('0x4'),'appdata':'CDR(type)='+_0x5e3506[_0x896c('0x3')],'context':_0x5e3506[_0x896c('0x5')],'exten':_0x5e3506[_0x896c('0x6')],'priority':_0x2a189c++,'VoiceExtensionId':_0x5e3506['id']},{'type':_0x5e3506[_0x896c('0x3')],'app':_0x5e3506[_0x896c('0x7')]?_0x896c('0x4'):'NoOp','appdata':_0x5e3506[_0x896c('0x7')]?_0x896c('0x8')+_0x5e3506[_0x896c('0x7')]:_0x896c('0x9'),'context':_0x5e3506[_0x896c('0x5')],'exten':_0x5e3506[_0x896c('0x6')],'priority':_0x2a189c++,'VoiceExtensionId':_0x5e3506['id']}];if(_0x5e3506[_0x896c('0x3')]==='inbound'){_0x40c034[_0x896c('0xa')]({'type':_0x896c('0xb'),'app':_0x896c('0x4'),'appdata':_0x896c('0xc')+_0x5e3506['id'],'context':_0x5e3506['context'],'exten':_0x5e3506[_0x896c('0x6')],'priority':_0x2a189c++,'VoiceExtensionId':_0x5e3506['id']});}_0x40c034[_0x896c('0xa')]({'type':_0x5e3506['type'],'app':'Set','appdata':_0x896c('0xd'),'context':_0x5e3506[_0x896c('0x5')],'exten':_0x5e3506[_0x896c('0x6')],'priority':_0x2a189c++,'VoiceExtensionId':_0x5e3506['id']},{'type':_0x5e3506['type'],'app':'Set','appdata':_0x896c('0xe'),'context':_0x5e3506[_0x896c('0x5')],'exten':_0x5e3506['exten'],'priority':_0x2a189c++,'VoiceExtensionId':_0x5e3506['id']},{'type':_0x5e3506[_0x896c('0x3')],'app':_0x896c('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5e3506[_0x896c('0x5')],'exten':_0x5e3506[_0x896c('0x6')],'priority':_0x2a189c++,'VoiceExtensionId':_0x5e3506['id']});return _0x40c034;}function _0xcd04fa(_0x1f92c2){var _0x4b5d34=0x2;var _0xd09e14=[{'type':_0x896c('0xf'),'app':_0x896c('0x4'),'appdata':_0x896c('0x10'),'context':_0x1f92c2['context'],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x1f92c2[_0x896c('0x7')]?_0x896c('0x4'):_0x896c('0x11'),'appdata':_0x1f92c2[_0x896c('0x7')]?'CDR(routeAlias)='+_0x1f92c2['alias']:_0x896c('0x9'),'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2['exten'],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x896c('0x4'),'appdata':_0x896c('0x12')+(_0x1f92c2['cutdigits']?_0x896c('0x13')+_0x1f92c2[_0x896c('0x14')]+'}':'${EXTEN}'),'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':'outbound','app':_0x896c('0x4'),'appdata':_0x896c('0xc')+_0x1f92c2['id'],'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x896c('0x15'),'appdata':_0x896c('0x16')+(_0x4b5d34+0x2)+_0x896c('0x17')+(_0x4b5d34+0x1)+')','context':_0x1f92c2['context'],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x896c('0x4'),'appdata':_0x1f92c2[_0x896c('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x1f92c2[_0x896c('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x1f92c2['context'],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x896c('0x4'),'appdata':_0x896c('0xd'),'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x896c('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1f92c2['context'],'exten':_0x1f92c2['exten'],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':'outbound','app':'Set','appdata':_0x896c('0x18')+_0x1f92c2['id'],'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']}];if(_0x1f92c2[_0x896c('0x19')](_0x896c('0x1a'))&&_0x1f92c2['recordingFormat']!=='none'){_0xd09e14[_0x896c('0xa')]({'type':'outbound','app':_0x896c('0x4'),'appdata':_0x896c('0x1b'),'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2[_0x896c('0x6')],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']},{'type':_0x896c('0xf'),'app':_0x896c('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1f92c2[_0x896c('0x1a')]||_0x896c('0x1c'),'context':_0x1f92c2[_0x896c('0x5')],'exten':_0x1f92c2['exten'],'priority':_0x4b5d34++,'VoiceExtensionId':_0x1f92c2['id']});}return _0xd09e14;}function _0x3d9716(_0x51b71f,_0x337618){var _0x1cc65a=[{'name':_0x896c('0x1d'),'param':0x0},{'name':_0x896c('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0x896c('0x1f'),'param':0x3}];var _0x49754d={};var _0x4757d2=_0x337618[_0x896c('0x20')](',');var _0x3df032=[];for(var _0x1c24b2=0x0;_0x1c24b2<_0x1cc65a[_0x896c('0x21')];_0x1c24b2++){switch(_0x1cc65a[_0x1c24b2][_0x896c('0x22')]){case'trunk':_0x49754d['trunk']=_0x4757d2[_0x1cc65a[_0x1c24b2][_0x896c('0x23')]][_0x896c('0x20')]('/')[0x1];_0x49754d[_0x896c('0x24')]=_0x4757d2[_0x1cc65a[_0x1c24b2]['param']]['split']('/')[0x2];_0x49754d[_0x896c('0x25')]=_0x49754d[_0x896c('0x24')]?_0x49754d[_0x896c('0x24')][_0x896c('0x20')]('$')[0x0]:undefined;_0x49754d[_0x896c('0x24')]=_0x51b71f[_0x896c('0x14')]?(_0x49754d[_0x896c('0x25')]||'')+_0x896c('0x13')+_0x51b71f['cutdigits']+'}':(_0x49754d[_0x896c('0x25')]||'')+_0x896c('0x26');_0x3df032[_0x1cc65a[_0x1c24b2][_0x896c('0x23')]]=[_0x896c('0x27'),_0x49754d[_0x896c('0x1d')],_0x49754d['phone']]['join']('/');break;case _0x896c('0x28'):_0x49754d[_0x896c('0x28')]=_0x4757d2[_0x1cc65a[_0x1c24b2][_0x896c('0x23')]];if(_0x51b71f[_0x896c('0x1a')]!=='none'){if(_0x49754d[_0x896c('0x28')][_0x896c('0x29')](_0x896c('0x2a'))<0x0){_0x49754d['options']+=_0x896c('0x2a');}}else{_0x49754d[_0x896c('0x28')]=_0x49754d[_0x896c('0x28')][_0x896c('0x2b')](_0x896c('0x2a'),'');}_0x3df032[_0x1cc65a[_0x1c24b2][_0x896c('0x23')]]=_0x49754d[_0x896c('0x28')];break;default:_0x3df032[_0x1cc65a[_0x1c24b2][_0x896c('0x23')]]=_0x4757d2[_0x1cc65a[_0x1c24b2][_0x896c('0x23')]];}}return _0x3df032[_0x896c('0x2c')](',');}function _0x146bb5(_0xb130cb,_0xfd037a,_0x57b68b){return new Promise(function(_0xbad4a,_0x100f2a){var _0x30b7c0=[];if(_['isEmpty'](_0xfd037a))return _0xbad4a(_0x30b7c0);_0x2d7278[_0x896c('0x2d')][_0x896c('0x2e')]({'attributes':['id',_0x896c('0x2f'),_0x896c('0x30')],'raw':!![]})[_0x896c('0x31')](function(_0x275892){for(var _0x574884=0x0,_0x4eef92=0x0;_0x574884<_0xfd037a[_0x896c('0x21')];_0x574884++,_0x4eef92=0x0){var _0x160df2=_0xfd037a[_0x574884];var _0x3f65db=[];var _0x496099=[];delete _0x160df2['id'];if(_0x160df2[_0x896c('0x2f')]!==_0x896c('0x32')){_0x160df2['intervals']=[_0x160df2[_0x896c('0x2f')]];}else{_0x160df2[_0x896c('0x33')]=_0x160df2[_0x896c('0x30')]?_[_0x896c('0x34')](_['filter'](_0x275892,{'IntervalId':_0x160df2[_0x896c('0x30')]}),_0x896c('0x2f')):[];}_0x160df2[_0x896c('0x5')]=_0xb130cb[_0x896c('0x5')];_0x160df2[_0x896c('0x6')]=_0xb130cb[_0x896c('0x6')];if(_0x160df2[_0x896c('0x3')])_0x160df2[_0x896c('0x3')]=_0x160df2[_0x896c('0x3')]['toLowerCase']();if(_0xb130cb[_0x896c('0x3')]===_0x896c('0xf')){if(_0x160df2[_0x896c('0x19')]('tag')&&_0x160df2[_0x896c('0x35')]&&_0x160df2[_0x896c('0x35')]!=='--'){_0x3f65db[_0x896c('0xa')]({'type':_0x160df2[_0x896c('0x3')][_0x896c('0x36')](),'app':_0x896c('0x4'),'appdata':_0x896c('0x37')+_0x160df2[_0x896c('0x35')],'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb[_0x896c('0x6')],'priority':_0x160df2['intervals']['length']+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});}_0x3f65db['push']({'type':_0x160df2[_0x896c('0x3')][_0x896c('0x36')](),'app':_0x896c('0x15'),'appdata':_0x896c('0x38')+(_0x160df2[_0x896c('0x39')]?_0x896c('0x3a')+_0x160df2[_0x896c('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb[_0x896c('0x6')],'priority':_0x160df2[_0x896c('0x33')][_0x896c('0x21')]+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});}else{if(_0x160df2[_0x896c('0x19')](_0x896c('0x3b'))){if([_0x896c('0x3c'),_0x896c('0x3d')][_0x896c('0x3e')](_0x160df2[_0x896c('0x3f')][_0x896c('0x36')]())&&_0x160df2[_0x896c('0x40')]!=='custom'){if(_0x160df2[_0x896c('0x3b')]){_0x3f65db[_0x896c('0xa')]({'type':_0x160df2[_0x896c('0x3')][_0x896c('0x36')](),'app':_0x896c('0x15'),'appdata':_0x896c('0x41'),'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb['exten'],'priority':_0x160df2[_0x896c('0x33')]['length']+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});_0x3f65db[_0x896c('0xa')]({'type':_0x160df2[_0x896c('0x3')][_0x896c('0x36')](),'app':'Set','appdata':_0x896c('0x42'),'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb['exten'],'priority':_0x160df2[_0x896c('0x33')][_0x896c('0x21')]+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});}else{_0x3f65db[_0x896c('0xa')]({'type':_0x160df2[_0x896c('0x3')][_0x896c('0x36')](),'app':_0x896c('0x15'),'appdata':_0x896c('0x43'),'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb[_0x896c('0x6')],'priority':_0x160df2[_0x896c('0x33')][_0x896c('0x21')]+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});_0x3f65db['push']({'type':_0x160df2['type'][_0x896c('0x36')](),'app':'Set','appdata':_0x896c('0x44'),'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb['exten'],'priority':_0x160df2[_0x896c('0x33')]['length']+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});}}}}for(var _0x1c2484=0x0;_0x1c2484<_0x160df2[_0x896c('0x33')]['length'];_0x1c2484++){var _0x330fc5=_0x57b68b+_0x160df2[_0x896c('0x33')][_0x896c('0x21')];var _0x573827=_0x1c2484===_0x160df2['intervals'][_0x896c('0x21')]-0x1?_0x57b68b+_0x3f65db[_0x896c('0x21')]+_0x496099['length']+0x2:_0x57b68b+_0x1c2484+0x1;_0x3f65db[_0x896c('0x45')](_0x1c2484,0x0,{'type':_0xb130cb[_0x896c('0x3')],'app':_0x896c('0x46'),'appdata':_0x160df2[_0x896c('0x33')][_0x1c2484]+'?'+_0xb130cb[_0x896c('0x5')]+',${EXTEN},'+_0x330fc5+':'+_0xb130cb[_0x896c('0x5')]+_0x896c('0x47')+_0x573827,'exten':_0xb130cb[_0x896c('0x6')],'context':_0xb130cb[_0x896c('0x5')],'priority':_0x57b68b+_0x1c2484,'VoiceExtensionId':_0xb130cb['id']});}if(_0x160df2[_0x896c('0x40')]===_0x896c('0x48')){_0x160df2['appdata']=_0x3d9716(_0xb130cb,_0x160df2[_0x896c('0x49')]);}if(_0x160df2['appType']===_0x896c('0x4a')){_0x3f65db[_0x896c('0xa')]({'type':_0x160df2[_0x896c('0x3')][_0x896c('0x36')](),'app':'Set','appdata':_0x896c('0x4b'),'context':_0xb130cb[_0x896c('0x5')],'exten':_0xb130cb[_0x896c('0x6')],'priority':_0x160df2[_0x896c('0x33')]['length']+_0x57b68b+_0x4eef92++,'VoiceExtensionId':_0xb130cb['id']});}_0x160df2['priority']=_0x3f65db[_0x896c('0x21')]?_[_0x896c('0x4c')](_0x3f65db)[_0x896c('0x4d')]+0x1:_0x57b68b;_0x30b7c0=_[_0x896c('0x4e')](_0x30b7c0,_0x3f65db,[_0x160df2],_0x496099);_0x57b68b=_[_0x896c('0x4c')](_0x30b7c0)[_0x896c('0x4d')]+0x1;}return _0xbad4a(_0x30b7c0);})[_0x896c('0x4f')](function(_0xa30fcb){_0x100f2a(_0xa30fcb);});});}return _0x53809d[_0x896c('0x50')](_0x896c('0x51'),attributes,{'tableName':_0x896c('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x20e796){var _0x56bfd8=this[_0x896c('0x53')]({'plain':!![]});var _0x5cfc4a=_0x56bfd8[_0x896c('0x3')]===_0x896c('0xf')?_0xcd04fa(_0x56bfd8):_0x4a3de1(_0x56bfd8);return _0x146bb5(_0x56bfd8,_0x20e796,_[_0x896c('0x4c')](_0x5cfc4a)['priority']+0x1)[_0x896c('0x31')](function(_0xa90d8c){var _0x2cbac1=_[_0x896c('0x4e')](_0x5cfc4a,_0xa90d8c);_0x2cbac1['push']({'type':_0x56bfd8[_0x896c('0x3')],'app':'Hangup','exten':_0x56bfd8[_0x896c('0x6')],'context':_0x56bfd8[_0x896c('0x5')],'priority':_[_0x896c('0x4c')](_0x2cbac1)[_0x896c('0x4d')]+0x1,'VoiceExtensionId':_0x56bfd8['id']});return _0x2cbac1;});}}});}; \ No newline at end of file +var _0x320e=['${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','phone','param','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','length','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','get','then','lodash','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:'];(function(_0x18031e,_0x5e6c20){var _0x559c7e=function(_0xf636cb){while(--_0xf636cb){_0x18031e['push'](_0x18031e['shift']());}};_0x559c7e(++_0x5e6c20);}(_0x320e,0x8c));var _0xe320=function(_0x30d371,_0x198ed4){_0x30d371=_0x30d371-0x0;var _0x5cc451=_0x320e[_0x30d371];return _0x5cc451;};'use strict';var _=require(_0xe320('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4ff8f5){var _0x429180=_0x4ff8f5[_0xe320('0x1')];function _0x3da6dd(_0x3684d6){var _0x4da752=0x2;var _0x320e09=[{'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0x4')+_0x3684d6[_0xe320('0x2')],'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6['exten'],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6[_0xe320('0x2')],'app':_0x3684d6[_0xe320('0x6')]?_0xe320('0x3'):_0xe320('0x7'),'appdata':_0x3684d6[_0xe320('0x6')]?_0xe320('0x8')+_0x3684d6[_0xe320('0x6')]:_0xe320('0x9'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']}];if(_0x3684d6[_0xe320('0x2')]===_0xe320('0xb')){_0x320e09[_0xe320('0xc')]({'type':'inbound','app':_0xe320('0x3'),'appdata':_0xe320('0xd')+_0x3684d6['id'],'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']});}_0x320e09[_0xe320('0xc')]({'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0xe'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6[_0xe320('0x2')],'app':_0xe320('0x3'),'appdata':_0xe320('0xf'),'context':_0x3684d6['context'],'exten':_0x3684d6['exten'],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']},{'type':_0x3684d6['type'],'app':_0xe320('0x3'),'appdata':_0xe320('0x10'),'context':_0x3684d6[_0xe320('0x5')],'exten':_0x3684d6[_0xe320('0xa')],'priority':_0x4da752++,'VoiceExtensionId':_0x3684d6['id']});return _0x320e09;}function _0x257467(_0x225428){var _0x2a726b=0x2;var _0xc9cfee=[{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x12'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':_0x225428[_0xe320('0x6')]?'Set':'NoOp','appdata':_0x225428[_0xe320('0x6')]?'CDR(routeAlias)='+_0x225428[_0xe320('0x6')]:_0xe320('0x9'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x13')+(_0x225428[_0xe320('0x14')]?_0xe320('0x15')+_0x225428[_0xe320('0x14')]+'}':_0xe320('0x16')),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0xd')+_0x225428['id'],'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x17'),'appdata':_0xe320('0x18')+(_0x2a726b+0x2)+_0xe320('0x19')+(_0x2a726b+0x1)+')','context':_0x225428['context'],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0x225428['cutdigits']?_0xe320('0x1a')+_0x225428[_0xe320('0x14')]+'}':_0xe320('0x1b'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0xf'),'context':_0x225428['context'],'exten':_0x225428['exten'],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x10'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':_0xe320('0x11'),'app':_0xe320('0x3'),'appdata':_0xe320('0x1c')+_0x225428['id'],'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']}];if(_0x225428[_0xe320('0x1d')](_0xe320('0x1e'))&&_0x225428[_0xe320('0x1e')]!==_0xe320('0x1f')){_0xc9cfee[_0xe320('0xc')]({'type':'outbound','app':_0xe320('0x3'),'appdata':_0xe320('0x20'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428[_0xe320('0xa')],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']},{'type':'outbound','app':_0xe320('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x225428[_0xe320('0x1e')]||_0xe320('0x21'),'context':_0x225428[_0xe320('0x5')],'exten':_0x225428['exten'],'priority':_0x2a726b++,'VoiceExtensionId':_0x225428['id']});}return _0xc9cfee;}function _0x2e1bd9(_0x3a39b5,_0x345933){var _0x27bc0a=[{'name':_0xe320('0x22'),'param':0x0},{'name':_0xe320('0x23'),'param':0x1},{'name':_0xe320('0x24'),'param':0x2},{'name':_0xe320('0x25'),'param':0x3}];var _0x316ba5={};var _0x5bc940=_0x345933[_0xe320('0x26')](',');var _0x410160=[];for(var _0x50c564=0x0;_0x50c564<_0x27bc0a['length'];_0x50c564++){switch(_0x27bc0a[_0x50c564]['name']){case _0xe320('0x22'):_0x316ba5[_0xe320('0x22')]=_0x5bc940[_0x27bc0a[_0x50c564]['param']][_0xe320('0x26')]('/')[0x1];_0x316ba5[_0xe320('0x27')]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]][_0xe320('0x26')]('/')[0x2];_0x316ba5['prefix']=_0x316ba5['phone']?_0x316ba5[_0xe320('0x27')]['split']('$')[0x0]:undefined;_0x316ba5[_0xe320('0x27')]=_0x3a39b5['cutdigits']?(_0x316ba5[_0xe320('0x29')]||'')+'${EXTEN:'+_0x3a39b5[_0xe320('0x14')]+'}':(_0x316ba5[_0xe320('0x29')]||'')+_0xe320('0x16');_0x410160[_0x27bc0a[_0x50c564][_0xe320('0x28')]]=[_0xe320('0x2a'),_0x316ba5[_0xe320('0x22')],_0x316ba5[_0xe320('0x27')]][_0xe320('0x2b')]('/');break;case _0xe320('0x24'):_0x316ba5[_0xe320('0x24')]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]];if(_0x3a39b5[_0xe320('0x1e')]!==_0xe320('0x1f')){if(_0x316ba5[_0xe320('0x24')]['indexOf'](_0xe320('0x2c'))<0x0){_0x316ba5[_0xe320('0x24')]+=_0xe320('0x2c');}}else{_0x316ba5[_0xe320('0x24')]=_0x316ba5[_0xe320('0x24')][_0xe320('0x2d')](_0xe320('0x2c'),'');}_0x410160[_0x27bc0a[_0x50c564][_0xe320('0x28')]]=_0x316ba5[_0xe320('0x24')];break;default:_0x410160[_0x27bc0a[_0x50c564]['param']]=_0x5bc940[_0x27bc0a[_0x50c564][_0xe320('0x28')]];}}return _0x410160['join'](',');}function _0x2aa61a(_0x46283f,_0x4abaa9,_0x125cf3){return new Promise(function(_0x53d126,_0xf80a57){var _0x24cfbb=[];if(_['isEmpty'](_0x4abaa9))return _0x53d126(_0x24cfbb);_0x429180[_0xe320('0x2e')][_0xe320('0x2f')]({'attributes':['id',_0xe320('0x30'),_0xe320('0x31')],'raw':!![]})['then'](function(_0x4acee9){for(var _0x4ae682=0x0,_0xdf1c06=0x0;_0x4ae682<_0x4abaa9[_0xe320('0x32')];_0x4ae682++,_0xdf1c06=0x0){var _0x1602d3=_0x4abaa9[_0x4ae682];var _0x344874=[];var _0x436a03=[];delete _0x1602d3['id'];if(_0x1602d3[_0xe320('0x30')]!=='*,*,*,*'){_0x1602d3['intervals']=[_0x1602d3[_0xe320('0x30')]];}else{_0x1602d3[_0xe320('0x33')]=_0x1602d3[_0xe320('0x31')]?_[_0xe320('0x34')](_[_0xe320('0x35')](_0x4acee9,{'IntervalId':_0x1602d3[_0xe320('0x31')]}),_0xe320('0x30')):[];}_0x1602d3['context']=_0x46283f[_0xe320('0x5')];_0x1602d3[_0xe320('0xa')]=_0x46283f['exten'];if(_0x1602d3[_0xe320('0x2')])_0x1602d3[_0xe320('0x2')]=_0x1602d3[_0xe320('0x2')][_0xe320('0x36')]();if(_0x46283f['type']===_0xe320('0x11')){if(_0x1602d3[_0xe320('0x1d')](_0xe320('0x37'))&&_0x1602d3[_0xe320('0x37')]&&_0x1602d3[_0xe320('0x37')]!=='--'){_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type']['toLowerCase'](),'app':_0xe320('0x3'),'appdata':_0xe320('0x38')+_0x1602d3[_0xe320('0x37')],'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}_0x344874['push']({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1602d3[_0xe320('0x39')]?_0xe320('0x3a')+_0x1602d3[_0xe320('0x39')]+')':_0xe320('0x3b')),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')]['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}else{if(_0x1602d3['hasOwnProperty'](_0xe320('0x3c'))){if(['queue',_0xe320('0x3d')][_0xe320('0x3e')](_0x1602d3[_0xe320('0x3f')][_0xe320('0x36')]())&&_0x1602d3[_0xe320('0x40')]!==_0xe320('0x41')){if(_0x1602d3[_0xe320('0x3c')]){_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':_0xe320('0x42'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3['intervals']['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x3'),'appdata':_0xe320('0x43'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f['exten'],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}else{_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type'][_0xe320('0x36')](),'app':_0xe320('0x17'),'appdata':_0xe320('0x44'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});_0x344874[_0xe320('0xc')]({'type':_0x1602d3['type']['toLowerCase'](),'app':_0xe320('0x3'),'appdata':_0xe320('0x45'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3['intervals']['length']+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}}}}for(var _0x3a94ad=0x0;_0x3a94ad<_0x1602d3['intervals'][_0xe320('0x32')];_0x3a94ad++){var _0x456d75=_0x125cf3+_0x1602d3[_0xe320('0x33')][_0xe320('0x32')];var _0x100014=_0x3a94ad===_0x1602d3['intervals'][_0xe320('0x32')]-0x1?_0x125cf3+_0x344874['length']+_0x436a03[_0xe320('0x32')]+0x2:_0x125cf3+_0x3a94ad+0x1;_0x344874[_0xe320('0x46')](_0x3a94ad,0x0,{'type':_0x46283f[_0xe320('0x2')],'app':_0xe320('0x47'),'appdata':_0x1602d3[_0xe320('0x33')][_0x3a94ad]+'?'+_0x46283f[_0xe320('0x5')]+',${EXTEN},'+_0x456d75+':'+_0x46283f[_0xe320('0x5')]+',${EXTEN},'+_0x100014,'exten':_0x46283f[_0xe320('0xa')],'context':_0x46283f[_0xe320('0x5')],'priority':_0x125cf3+_0x3a94ad,'VoiceExtensionId':_0x46283f['id']});}if(_0x1602d3[_0xe320('0x40')]===_0xe320('0x48')){_0x1602d3['appdata']=_0x2e1bd9(_0x46283f,_0x1602d3[_0xe320('0x49')]);}if(_0x1602d3[_0xe320('0x40')]===_0xe320('0x4a')){_0x344874[_0xe320('0xc')]({'type':_0x1602d3[_0xe320('0x2')][_0xe320('0x36')](),'app':_0xe320('0x3'),'appdata':_0xe320('0x4b'),'context':_0x46283f[_0xe320('0x5')],'exten':_0x46283f[_0xe320('0xa')],'priority':_0x1602d3[_0xe320('0x33')][_0xe320('0x32')]+_0x125cf3+_0xdf1c06++,'VoiceExtensionId':_0x46283f['id']});}_0x1602d3[_0xe320('0x4c')]=_0x344874['length']?_[_0xe320('0x4d')](_0x344874)[_0xe320('0x4c')]+0x1:_0x125cf3;_0x24cfbb=_[_0xe320('0x4e')](_0x24cfbb,_0x344874,[_0x1602d3],_0x436a03);_0x125cf3=_['last'](_0x24cfbb)[_0xe320('0x4c')]+0x1;}return _0x53d126(_0x24cfbb);})['catch'](function(_0x52249f){_0xf80a57(_0x52249f);});});}return _0x4ff8f5['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x7cd781){var _0x3eafb1=this[_0xe320('0x4f')]({'plain':!![]});var _0x267f7d=_0x3eafb1[_0xe320('0x2')]===_0xe320('0x11')?_0x257467(_0x3eafb1):_0x3da6dd(_0x3eafb1);return _0x2aa61a(_0x3eafb1,_0x7cd781,_['last'](_0x267f7d)[_0xe320('0x4c')]+0x1)[_0xe320('0x50')](function(_0x5b68f0){var _0x31f3dc=_[_0xe320('0x4e')](_0x267f7d,_0x5b68f0);_0x31f3dc[_0xe320('0xc')]({'type':_0x3eafb1['type'],'app':'Hangup','exten':_0x3eafb1[_0xe320('0xa')],'context':_0x3eafb1[_0xe320('0x5')],'priority':_[_0xe320('0x4d')](_0x31f3dc)[_0xe320('0x4c')]+0x1,'VoiceExtensionId':_0x3eafb1['id']});return _0x31f3dc;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 838cfde..29b15f0 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 _0x1228=['socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','GetVoiceExtension','VoiceExtension','options','raw','where','limit','include','map','model','attributes','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x1228,0x12f));var _0x8122=function(_0x1822c5,_0x5d33b0){_0x1822c5=_0x1822c5-0x0;var _0x3d8bb3=_0x1228[_0x1822c5];return _0x3d8bb3;};'use strict';var _=require(_0x8122('0x0'));var util=require('util');var moment=require(_0x8122('0x1'));var BPromise=require('bluebird');var rs=require(_0x8122('0x2'));var fs=require('fs');var Redis=require(_0x8122('0x3'));var db=require(_0x8122('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var config=require('../../config/environment');var jayson=require(_0x8122('0x7'));var client=jayson[_0x8122('0x8')]['http']({'port':0x232a});config[_0x8122('0x9')]=_[_0x8122('0xa')](config['redis'],{'host':_0x8122('0xb'),'port':0x18eb});var socket=require(_0x8122('0xc'))(new Redis(config['redis']));require(_0x8122('0xd'))[_0x8122('0xe')](socket);function respondWithRpcPromise(_0x4a1378,_0x5a7875,_0x4fa7b3){return new BPromise(function(_0x52f48b,_0x208043){return client['request'](_0x4a1378,_0x4fa7b3)[_0x8122('0xf')](function(_0x23a9e4){logger[_0x8122('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5a7875,_0x8122('0x11'));logger['debug'](_0x8122('0x12'),_0x5a7875,_0x8122('0x11'),JSON[_0x8122('0x13')](_0x23a9e4));if(_0x23a9e4[_0x8122('0x14')]){if(_0x23a9e4[_0x8122('0x14')][_0x8122('0x15')]===0x1f4){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);return _0x208043(_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);}logger['error'](_0x8122('0x16'),_0x5a7875,_0x23a9e4['error'][_0x8122('0x17')]);return _0x52f48b(_0x23a9e4['error'][_0x8122('0x17')]);}else{logger[_0x8122('0x10')](_0x8122('0x16'),_0x5a7875,_0x8122('0x11'));_0x52f48b(_0x23a9e4['result']['message']);}})['catch'](function(_0x56a926){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x56a926);_0x208043(_0x56a926);});});}exports[_0x8122('0x18')]=function(_0x5a5a57){var _0x5df55f=this;return new Promise(function(_0x1162a8,_0x174321){return db[_0x8122('0x19')]['findAll']({'raw':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1c')]||null:null,'attributes':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')]['attributes']||null:null,'limit':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57['options'][_0x8122('0x1d')]||null:null,'include':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1e')]?_[_0x8122('0x1f')](_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1e')],function(_0x2708a5){return{'model':db[_0x2708a5[_0x8122('0x20')]],'as':_0x2708a5['as'],'attributes':_0x2708a5['attributes'],'include':_0x2708a5[_0x8122('0x1e')]?_[_0x8122('0x1f')](_0x2708a5[_0x8122('0x1e')],function(_0xc90a18){return{'model':db[_0xc90a18[_0x8122('0x20')]],'as':_0xc90a18['as'],'attributes':_0xc90a18[_0x8122('0x21')],'include':_0xc90a18[_0x8122('0x1e')]?_[_0x8122('0x1f')](_0xc90a18[_0x8122('0x1e')],function(_0x4610b1){return{'model':db[_0x4610b1['model']],'as':_0x4610b1['as'],'attributes':_0x4610b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8122('0xf')](function(_0x264ccf){logger['info']('GetVoiceExtension',_0x5a5a57);logger[_0x8122('0x22')](_0x8122('0x18'),_0x5a5a57,JSON[_0x8122('0x13')](_0x264ccf));_0x1162a8(_0x264ccf);})['catch'](function(_0x4c8339){logger[_0x8122('0x14')](_0x8122('0x18'),_0x4c8339[_0x8122('0x17')],_0x5a5a57);_0x174321(_0x5df55f[_0x8122('0x14')](0x1f4,_0x4c8339[_0x8122('0x17')]));});});}; \ No newline at end of file +var _0x0dee=['redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','VoiceExtension,\x20%s,\x20%s','request\x20sent','result','catch','GetVoiceExtension','findAll','options','where','include','model','map','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x14bca7,_0x1e79f8){var _0x4bfaf5=function(_0x4f1c4f){while(--_0x4f1c4f){_0x14bca7['push'](_0x14bca7['shift']());}};_0x4bfaf5(++_0x1e79f8);}(_0x0dee,0xf7));var _0xe0de=function(_0x229c29,_0x5afad4){_0x229c29=_0x229c29-0x0;var _0x3a93c9=_0x0dee[_0x229c29];return _0x3a93c9;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var moment=require('moment');var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0de('0x8')]['http']({'port':0x232a});config[_0xe0de('0x9')]=_[_0xe0de('0xa')](config[_0xe0de('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0de('0xb'))(new Redis(config['redis']));require(_0xe0de('0xc'))['register'](socket);function respondWithRpcPromise(_0x401250,_0x301e88,_0xd2fd6){return new BPromise(function(_0x107be5,_0x53930a){return client[_0xe0de('0xd')](_0x401250,_0xd2fd6)[_0xe0de('0xe')](function(_0x15dfc8){logger[_0xe0de('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x301e88,'request\x20sent');logger[_0xe0de('0x10')](_0xe0de('0x11'),_0x301e88,'request\x20sent',JSON['stringify'](_0x15dfc8));if(_0x15dfc8[_0xe0de('0x12')]){if(_0x15dfc8[_0xe0de('0x12')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x301e88,_0x15dfc8['error'][_0xe0de('0x13')]);return _0x53930a(_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);}logger[_0xe0de('0x12')](_0xe0de('0x14'),_0x301e88,_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);return _0x107be5(_0x15dfc8[_0xe0de('0x12')][_0xe0de('0x13')]);}else{logger[_0xe0de('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x301e88,_0xe0de('0x15'));_0x107be5(_0x15dfc8[_0xe0de('0x16')][_0xe0de('0x13')]);}})[_0xe0de('0x17')](function(_0x22c5b7){logger[_0xe0de('0x12')](_0xe0de('0x14'),_0x301e88,_0x22c5b7);_0x53930a(_0x22c5b7);});});}exports[_0xe0de('0x18')]=function(_0x2c728e){var _0x194211=this;return new Promise(function(_0x509353,_0x2d7ad8){return db['VoiceExtension'][_0xe0de('0x19')]({'raw':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')][_0xe0de('0x1b')]||null:null,'attributes':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')]['attributes']||null:null,'limit':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')]['limit']||null:null,'include':_0x2c728e[_0xe0de('0x1a')]?_0x2c728e[_0xe0de('0x1a')][_0xe0de('0x1c')]?_['map'](_0x2c728e['options']['include'],function(_0x3a41a9){return{'model':db[_0x3a41a9[_0xe0de('0x1d')]],'as':_0x3a41a9['as'],'attributes':_0x3a41a9['attributes'],'include':_0x3a41a9[_0xe0de('0x1c')]?_[_0xe0de('0x1e')](_0x3a41a9[_0xe0de('0x1c')],function(_0xb95460){return{'model':db[_0xb95460['model']],'as':_0xb95460['as'],'attributes':_0xb95460[_0xe0de('0x1f')],'include':_0xb95460[_0xe0de('0x1c')]?_['map'](_0xb95460[_0xe0de('0x1c')],function(_0x32ba02){return{'model':db[_0x32ba02['model']],'as':_0x32ba02['as'],'attributes':_0x32ba02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fec50){logger[_0xe0de('0xf')]('GetVoiceExtension',_0x2c728e);logger[_0xe0de('0x10')](_0xe0de('0x18'),_0x2c728e,JSON['stringify'](_0x4fec50));_0x509353(_0x4fec50);})[_0xe0de('0x17')](function(_0x497183){logger[_0xe0de('0x12')](_0xe0de('0x18'),_0x497183[_0xe0de('0x13')],_0x2c728e);_0x2d7ad8(_0x194211[_0xe0de('0x12')](0x1f4,_0x497183['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b4b14d1..ad03f7d 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x4ce0bd,_0x3ffba4){var _0xc2fda4=function(_0x32bb52){while(--_0x32bb52){_0x4ce0bd['push'](_0x4ce0bd['shift']());}};_0xc2fda4(++_0x3ffba4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5ed800,_0x34e5aa){var _0x17c54f=function(_0xe3e5aa){while(--_0xe3e5aa){_0x5ed800['push'](_0x5ed800['shift']());}};_0x17c54f(++_0x34e5aa);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 751ba6c..0edba38 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 _0x33af=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','getMessages','post','create','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x29b25b,_0x49f67b){var _0x599cb1=function(_0x42744e){while(--_0x42744e){_0x29b25b['push'](_0x29b25b['shift']());}};_0x599cb1(++_0x49f67b);}(_0x33af,0xec));var _0xf33a=function(_0x3aadde,_0x50f23f){_0x3aadde=_0x3aadde-0x0;var _0x21df4e=_0x33af[_0x3aadde];return _0x21df4e;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id/messages',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router[_0xf33a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf33a('0x11')]);router[_0xf33a('0x12')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x4d22af,_0x2da329){var _0x1aa3f4=function(_0x58538c){while(--_0x58538c){_0x4d22af['push'](_0x4d22af['shift']());}};_0x1aa3f4(++_0x2da329);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x304292,_0xcb4fb6){_0x304292=_0x304292-0x0;var _0x1b5918=_0x3f8a[_0x304292];return _0x1b5918;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['post']('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0x14')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);module[_0xa3f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a246bd3..f1817f4 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 _0xa669=['from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa669,0xc4));var _0x9a66=function(_0x25bfde,_0x51162b){_0x25bfde=_0x25bfde-0x0;var _0x1fda28=_0xa669[_0x25bfde];return _0x1fda28;};'use strict';var Sequelize=require('sequelize');module[_0x9a66('0x0')]={'customer_id':{'type':Sequelize[_0x9a66('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9a66('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9a66('0x3')},'password':{'type':Sequelize[_0x9a66('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9a66('0x1')],'validate':{'isEmail':!![]},'set':function(_0x18d572){this[_0x9a66('0x4')](_0x9a66('0x5'),typeof _0x18d572===_0x9a66('0x6')&&_0x18d572[_0x9a66('0x7')]()?_0x18d572[_0x9a66('0x7')]():null);}},'pager':{'type':Sequelize[_0x9a66('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x9a66('0x8')},'attach':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':_0x9a66('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x9a66('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9a66('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9a66('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9a66('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':_0x9a66('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9a66('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9a66('0x9')](_0x9a66('0xa'),'no'),'defaultValue':_0x9a66('0xa'),'allowNull':![]},'stamp':{'type':_0x9a66('0xc')},'emailsubject':{'type':Sequelize[_0x9a66('0x1')]},'emailbody':{'type':Sequelize[_0x9a66('0x1')]},'maxsecs':{'type':Sequelize[_0x9a66('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9a66('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9a66('0xe')],'get':function(){return this[_0x9a66('0xf')](_0x9a66('0x10'))+_0x9a66('0x11')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x09a2=['getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','\x20-\x20'];(function(_0x4ea8dd,_0x541ae3){var _0x1cc939=function(_0x133a08){while(--_0x133a08){_0x4ea8dd['push'](_0x4ea8dd['shift']());}};_0x1cc939(++_0x541ae3);}(_0x09a2,0x1d2));var _0x209a=function(_0x1dc9d1,_0x2947a4){_0x1dc9d1=_0x1dc9d1-0x0;var _0x20316e=_0x09a2[_0x1dc9d1];return _0x20316e;};'use strict';var Sequelize=require(_0x209a('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x209a('0x1')]},'context':{'type':Sequelize[_0x209a('0x1')],'defaultValue':_0x209a('0x2'),'unique':_0x209a('0x3')},'mailbox':{'type':Sequelize[_0x209a('0x1')],'defaultValue':'','allowNull':![],'unique':_0x209a('0x3')},'password':{'type':Sequelize[_0x209a('0x1')]},'fullname':{'type':Sequelize[_0x209a('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3b7ca9){this[_0x209a('0x4')](_0x209a('0x5'),typeof _0x3b7ca9==='string'&&_0x3b7ca9[_0x209a('0x6')]()?_0x3b7ca9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x209a('0x7')},'attach':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':_0x209a('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x209a('0x8')]('yes','no'),'defaultValue':_0x209a('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x209a('0x1')]},'callback':{'type':Sequelize[_0x209a('0x1')]},'review':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x209a('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x209a('0x8')](_0x209a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x209a('0x9'),'no'),'defaultValue':_0x209a('0x9'),'allowNull':![]},'stamp':{'type':_0x209a('0xb')},'emailsubject':{'type':Sequelize[_0x209a('0x1')]},'emailbody':{'type':Sequelize[_0x209a('0x1')]},'maxsecs':{'type':Sequelize[_0x209a('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x209a('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+_0x209a('0xd')+this[_0x209a('0xe')](_0x209a('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index fdcdc50..620f321 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 _0x69d3=['Voicemails','UserProfileResource','error','name','send','index','map','VoiceMail','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','findAll','catch','show','params','include','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','VoiceMailMessage','mailbox','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then'];(function(_0x10cb7b,_0x2f3c3e){var _0x34f7a5=function(_0x589c46){while(--_0x589c46){_0x10cb7b['push'](_0x10cb7b['shift']());}};_0x34f7a5(++_0x2f3c3e);}(_0x69d3,0xda));var _0x369d=function(_0x3b63a8,_0x5848e3){_0x3b63a8=_0x3b63a8-0x0;var _0x855d21=_0x69d3[_0x3b63a8];return _0x855d21;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x369d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x6'));var ejs=require(_0x369d('0x7'));var fs=require('fs');var fs_extra=require(_0x369d('0x8'));var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var licenseUtil=require(_0x369d('0x15'));var db=require(_0x369d('0x16'))['db'];function respondWithStatusCode(_0xee549e,_0x52c126){_0x52c126=_0x52c126||0xcc;return function(_0x15b417){if(_0x15b417){return _0xee549e[_0x369d('0x17')](_0x52c126);}return _0xee549e[_0x369d('0x18')](_0x52c126)[_0x369d('0x19')]();};}function respondWithResult(_0x121307,_0x539536){_0x539536=_0x539536||0xc8;return function(_0x5cd4c3){if(_0x5cd4c3){return _0x121307['status'](_0x539536)[_0x369d('0x1a')](_0x5cd4c3);}};}function respondWithFilteredResult(_0xa126c1,_0x389c43){return function(_0x5b4f55){if(_0x5b4f55){var _0x2c1a4a=typeof _0x389c43[_0x369d('0x1b')]===_0x369d('0x1c')&&typeof _0x389c43['limit']===_0x369d('0x1c');var _0x1f37ff=_0x5b4f55['count'];var _0x572513=_0x2c1a4a?0x0:_0x389c43['offset'];var _0x2946be=_0x2c1a4a?_0x5b4f55[_0x369d('0x1d')]:_0x389c43[_0x369d('0x1b')]+_0x389c43['limit'];var _0x410dbe;if(_0x2946be>=_0x1f37ff){_0x2946be=_0x1f37ff;_0x410dbe=0xc8;}else{_0x410dbe=0xce;}_0xa126c1[_0x369d('0x18')](_0x410dbe);return _0xa126c1[_0x369d('0x1e')](_0x369d('0x1f'),_0x572513+'-'+_0x2946be+'/'+_0x1f37ff)[_0x369d('0x1a')](_0x5b4f55);}return null;};}function patchUpdates(_0x538ca4){return function(_0x5c9fdd){try{jsonpatch[_0x369d('0x20')](_0x5c9fdd,_0x538ca4,!![]);}catch(_0x1edcd5){return BPromise[_0x369d('0x21')](_0x1edcd5);}return _0x5c9fdd[_0x369d('0x22')]();};}function saveUpdates(_0x84cc0f,_0x15fbef){return function(_0x1b262a){if(_0x1b262a){return _0x1b262a['update'](_0x84cc0f)['then'](function(_0x32ef9a){return _0x32ef9a;});}return null;};}function removeEntity(_0xed16e,_0xf7bc3a){return function(_0xcae58){if(_0xcae58){return _0xcae58[_0x369d('0x23')]()[_0x369d('0x24')](function(){var _0x36cf04=_0xcae58['get']({'plain':!![]});var _0x4dfe83=_0x369d('0x25');return db[_0x369d('0x26')][_0x369d('0x23')]({'where':{'type':_0x4dfe83,'resourceId':_0x36cf04['id']}})[_0x369d('0x24')](function(){return _0xcae58;});})[_0x369d('0x24')](function(){_0xed16e[_0x369d('0x18')](0xcc)[_0x369d('0x19')]();});}};}function handleEntityNotFound(_0x570db4,_0x23656b){return function(_0xe95742){if(!_0xe95742){_0x570db4[_0x369d('0x17')](0x194);}return _0xe95742;};}function handleError(_0xf952a3,_0x345be5){_0x345be5=_0x345be5||0x1f4;return function(_0x41367a){logger[_0x369d('0x27')](_0x41367a['stack']);if(_0x41367a[_0x369d('0x28')]){delete _0x41367a['name'];}_0xf952a3['status'](_0x345be5)[_0x369d('0x29')](_0x41367a);};}exports[_0x369d('0x2a')]=function(_0x5844c7,_0x104540){var _0x5a14ce={},_0x37274f={},_0x39d656={'count':0x0,'rows':[]};var _0xe45219=_[_0x369d('0x2b')](db[_0x369d('0x2c')][_0x369d('0x2d')],function(_0x119c00){return{'name':_0x119c00['fieldName'],'type':_0x119c00[_0x369d('0x2e')][_0x369d('0x2f')]};});_0x37274f[_0x369d('0x30')]=_[_0x369d('0x2b')](_0xe45219,_0x369d('0x28'));_0x37274f[_0x369d('0x31')]=_[_0x369d('0x32')](_0x5844c7[_0x369d('0x31')]);_0x37274f['filters']=_[_0x369d('0x33')](_0x37274f[_0x369d('0x30')],_0x37274f[_0x369d('0x31')]);_0x5a14ce[_0x369d('0x34')]=_[_0x369d('0x33')](_0x37274f['model'],qs[_0x369d('0x35')](_0x5844c7[_0x369d('0x31')][_0x369d('0x35')]));_0x5a14ce[_0x369d('0x34')]=_0x5a14ce[_0x369d('0x34')][_0x369d('0x36')]?_0x5a14ce['attributes']:_0x37274f[_0x369d('0x30')];if(!_0x5844c7[_0x369d('0x31')][_0x369d('0x37')](_0x369d('0x38'))){_0x5a14ce[_0x369d('0x39')]=qs[_0x369d('0x39')](_0x5844c7[_0x369d('0x31')][_0x369d('0x39')]);_0x5a14ce[_0x369d('0x1b')]=qs[_0x369d('0x1b')](_0x5844c7[_0x369d('0x31')][_0x369d('0x1b')]);}_0x5a14ce[_0x369d('0x3a')]=qs[_0x369d('0x3b')](_0x5844c7[_0x369d('0x31')][_0x369d('0x3b')]);_0x5a14ce[_0x369d('0x3c')]=qs[_0x369d('0x3d')](_[_0x369d('0x3e')](_0x5844c7[_0x369d('0x31')],_0x37274f[_0x369d('0x3d')]),_0xe45219);if(_0x5844c7[_0x369d('0x31')][_0x369d('0x3f')]){_0x5a14ce[_0x369d('0x3c')]=_['merge'](_0x5a14ce['where'],{'$or':_[_0x369d('0x2b')](_0xe45219,function(_0x319e5d){if(_0x319e5d[_0x369d('0x2e')]!==_0x369d('0x40')){var _0x3afa89={};_0x3afa89[_0x319e5d[_0x369d('0x28')]]={'$like':'%'+_0x5844c7[_0x369d('0x31')][_0x369d('0x3f')]+'%'};return _0x3afa89;}})});}_0x5a14ce=_[_0x369d('0x41')]({},_0x5a14ce,_0x5844c7['options']);var _0x322b13={'where':_0x5a14ce[_0x369d('0x3c')]};return db[_0x369d('0x2c')][_0x369d('0x1d')](_0x322b13)[_0x369d('0x24')](function(_0x25cf4e){_0x39d656[_0x369d('0x1d')]=_0x25cf4e;if(_0x5844c7[_0x369d('0x31')]['includeAll']){_0x5a14ce['include']=[{'all':!![]}];}return db[_0x369d('0x2c')][_0x369d('0x42')](_0x5a14ce);})[_0x369d('0x24')](function(_0x4dad71){_0x39d656['rows']=_0x4dad71;return _0x39d656;})['then'](respondWithFilteredResult(_0x104540,_0x5a14ce))[_0x369d('0x43')](handleError(_0x104540,null));};exports[_0x369d('0x44')]=function(_0x55dfde,_0xe7ba64){var _0x430040={'raw':!![],'where':{'id':_0x55dfde[_0x369d('0x45')]['id']}},_0x102a65={};_0x102a65['model']=_[_0x369d('0x32')](db['VoiceMail'][_0x369d('0x2d')]);_0x102a65['query']=_[_0x369d('0x32')](_0x55dfde[_0x369d('0x31')]);_0x102a65[_0x369d('0x3d')]=_['intersection'](_0x102a65['model'],_0x102a65[_0x369d('0x31')]);_0x430040[_0x369d('0x34')]=_[_0x369d('0x33')](_0x102a65['model'],qs[_0x369d('0x35')](_0x55dfde[_0x369d('0x31')][_0x369d('0x35')]));_0x430040[_0x369d('0x34')]=_0x430040[_0x369d('0x34')][_0x369d('0x36')]?_0x430040[_0x369d('0x34')]:_0x102a65[_0x369d('0x30')];if(_0x55dfde[_0x369d('0x31')]['includeAll']){_0x430040[_0x369d('0x46')]=[{'all':!![]}];}_0x430040=_[_0x369d('0x41')]({},_0x430040,_0x55dfde[_0x369d('0x47')]);return db[_0x369d('0x2c')][_0x369d('0x48')](_0x430040)[_0x369d('0x24')](handleEntityNotFound(_0xe7ba64,null))['then'](respondWithResult(_0xe7ba64,null))[_0x369d('0x43')](handleError(_0xe7ba64,null));};exports[_0x369d('0x49')]=function(_0x16dd8f,_0x44a357){return db[_0x369d('0x2c')][_0x369d('0x49')](_0x16dd8f[_0x369d('0x4a')],{})[_0x369d('0x24')](function(_0x3f8a54){var _0x3c15cb=_0x16dd8f[_0x369d('0x4b')][_0x369d('0x4c')]({'plain':!![]});if(!_0x3c15cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c15cb[_0x369d('0x4d')]===_0x369d('0x4b')){var _0x289eb8=_0x3f8a54[_0x369d('0x4c')]({'plain':!![]});var _0x648a0d='Voicemails';return db[_0x369d('0x4e')]['find']({'where':{'name':_0x648a0d,'userProfileId':_0x3c15cb[_0x369d('0x4f')]},'raw':!![]})[_0x369d('0x24')](function(_0x22b594){if(_0x22b594&&_0x22b594[_0x369d('0x50')]===0x0){return db[_0x369d('0x26')][_0x369d('0x49')]({'name':_0x289eb8[_0x369d('0x28')],'resourceId':_0x289eb8['id'],'type':_0x22b594[_0x369d('0x28')],'sectionId':_0x22b594['id']},{})[_0x369d('0x24')](function(){return _0x3f8a54;});}else{return _0x3f8a54;}})[_0x369d('0x43')](function(_0x4d582a){logger['error'](_0x369d('0x51'),_0x4d582a);throw _0x4d582a;});}return _0x3f8a54;})[_0x369d('0x24')](respondWithResult(_0x44a357,0xc9))[_0x369d('0x43')](handleError(_0x44a357,null));};exports[_0x369d('0x52')]=function(_0x347df4,_0x5cd43f){if(_0x347df4['body']['id']){delete _0x347df4[_0x369d('0x4a')]['id'];}return db[_0x369d('0x2c')]['find']({'where':{'id':_0x347df4[_0x369d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cd43f,null))[_0x369d('0x24')](saveUpdates(_0x347df4[_0x369d('0x4a')],null))[_0x369d('0x24')](respondWithResult(_0x5cd43f,null))['catch'](handleError(_0x5cd43f,null));};exports[_0x369d('0x23')]=function(_0x145ba8,_0x45ac3c){return db[_0x369d('0x2c')]['find']({'where':{'id':_0x145ba8['params']['id']}})[_0x369d('0x24')](handleEntityNotFound(_0x45ac3c,null))[_0x369d('0x24')](removeEntity(_0x45ac3c,null))[_0x369d('0x43')](handleError(_0x45ac3c,null));};exports['getMessages']=function(_0x43afd7,_0x2dbbee,_0x402aae){return db['VoiceMail']['findOne']({'where':{'id':_0x43afd7[_0x369d('0x45')]['id']}})[_0x369d('0x24')](handleEntityNotFound(_0x2dbbee,null))[_0x369d('0x24')](function(_0x158ce7){var _0x5408b3;var _0x33bba6={},_0x1fa6bb={};_0x1fa6bb[_0x369d('0x30')]=_[_0x369d('0x32')](db[_0x369d('0x53')]['rawAttributes']);_0x1fa6bb[_0x369d('0x31')]=_[_0x369d('0x32')](_0x43afd7[_0x369d('0x31')]);_0x1fa6bb['filters']=_[_0x369d('0x33')](_0x1fa6bb['model'],_0x1fa6bb[_0x369d('0x31')]);_0x33bba6['attributes']=_['intersection'](_0x1fa6bb['model'],qs['fields'](_0x43afd7[_0x369d('0x31')]['fields']));_0x33bba6[_0x369d('0x34')]=_0x33bba6['attributes'][_0x369d('0x36')]?_0x33bba6[_0x369d('0x34')]:_0x1fa6bb[_0x369d('0x30')];if(!_0x43afd7['query'][_0x369d('0x37')](_0x369d('0x38'))){_0x33bba6[_0x369d('0x39')]=qs[_0x369d('0x39')](_0x43afd7[_0x369d('0x31')][_0x369d('0x39')]);_0x33bba6['offset']=qs[_0x369d('0x1b')](_0x43afd7['query']['offset']);}_0x33bba6['order']=qs[_0x369d('0x3b')](_0x43afd7[_0x369d('0x31')][_0x369d('0x3b')]);_0x33bba6[_0x369d('0x3c')]=qs[_0x369d('0x3d')](_[_0x369d('0x3e')](_0x43afd7[_0x369d('0x31')],_0x1fa6bb[_0x369d('0x3d')]));if(_0x43afd7[_0x369d('0x31')][_0x369d('0x3f')]){_0x33bba6[_0x369d('0x3c')]=_[_0x369d('0x41')](_0x33bba6[_0x369d('0x3c')],{'$or':_[_0x369d('0x2b')](_0x33bba6[_0x369d('0x34')],function(_0x46f58a){var _0x4fe1b6={};_0x4fe1b6[_0x46f58a]={'$like':'%'+_0x43afd7[_0x369d('0x31')]['filter']+'%'};return _0x4fe1b6;})});}_0x33bba6[_0x369d('0x3c')]=_[_0x369d('0x41')](_0x33bba6[_0x369d('0x3c')],{'mailboxuser':_0x158ce7[_0x369d('0x54')]});_0x33bba6=_[_0x369d('0x41')]({},_0x33bba6,_0x43afd7['options']);return db[_0x369d('0x53')]['findAndCountAll'](_0x33bba6)['then'](respondWithFilteredResult(_0x2dbbee,_0x33bba6));})[_0x369d('0x43')](handleError(_0x2dbbee,null));}; \ No newline at end of file +var _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x4f9b05,_0x4e4203){var _0x62a1f7=function(_0x2d1a9a){while(--_0x2d1a9a){_0x4f9b05['push'](_0x4f9b05['shift']());}};_0x62a1f7(++_0x4e4203);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 666b714..e0c9aa9 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 _0xd0d6=['mailbox_context','mailbox','context','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x4197f6,_0x154a2b){var _0x574a38=function(_0x2897ec){while(--_0x2897ec){_0x4197f6['push'](_0x4197f6['shift']());}};_0x574a38(++_0x154a2b);}(_0xd0d6,0x133));var _0x6d0d=function(_0x59eb79,_0x7b8805){_0x59eb79=_0x59eb79-0x0;var _0x20bf3c=_0xd0d6[_0x59eb79];return _0x20bf3c;};'use strict';var _=require(_0x6d0d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6d0d('0x1'));var moment=require(_0x6d0d('0x2'));var BPromise=require(_0x6d0d('0x3'));var rp=require(_0x6d0d('0x4'));var fs=require('fs');var path=require(_0x6d0d('0x5'));var rimraf=require(_0x6d0d('0x6'));var config=require(_0x6d0d('0x7'));var attributes=require(_0x6d0d('0x8'));module[_0x6d0d('0x9')]=function(_0x4cf9d3,_0x48f173){return _0x4cf9d3[_0x6d0d('0xa')](_0x6d0d('0xb'),attributes,{'tableName':_0x6d0d('0xc'),'paranoid':![],'indexes':[{'name':_0x6d0d('0xd'),'fields':[_0x6d0d('0xe'),_0x6d0d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce5=['voice_voicemail','mailbox_context','mailbox','context','lodash','moment','request-promise','../../config/environment','define','VoiceMail'];(function(_0x53e9ed,_0x1282e5){var _0x54990a=function(_0x4a4db4){while(--_0x4a4db4){_0x53e9ed['push'](_0x53e9ed['shift']());}};_0x54990a(++_0x1282e5);}(_0x4ce5,0x112));var _0x54ce=function(_0x210e63,_0x21dc13){_0x210e63=_0x210e63-0x0;var _0x56c250=_0x4ce5[_0x210e63];return _0x56c250;};'use strict';var _=require(_0x54ce('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x54ce('0x1'));var BPromise=require('bluebird');var rp=require(_0x54ce('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54ce('0x3'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x318152,_0x18457e){return _0x318152[_0x54ce('0x4')](_0x54ce('0x5'),attributes,{'tableName':_0x54ce('0x6'),'paranoid':![],'indexes':[{'name':_0x54ce('0x7'),'fields':[_0x54ce('0x8'),_0x54ce('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3654cbd..3656c52 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 _0x7fa1=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3e1a76,_0x13f4d0){var _0x2dc542=function(_0x45f3f6){while(--_0x45f3f6){_0x3e1a76['push'](_0x3e1a76['shift']());}};_0x2dc542(++_0x13f4d0);}(_0x7fa1,0x164));var _0x17fa=function(_0x5ab28a,_0x4cb21f){_0x5ab28a=_0x5ab28a-0x0;var _0xf37643=_0x7fa1[_0x5ab28a];return _0xf37643;};'use strict';var _=require(_0x17fa('0x0'));var util=require(_0x17fa('0x1'));var moment=require('moment');var BPromise=require(_0x17fa('0x2'));var rs=require(_0x17fa('0x3'));var fs=require('fs');var Redis=require(_0x17fa('0x4'));var db=require(_0x17fa('0x5'))['db'];var utils=require(_0x17fa('0x6'));var logger=require(_0x17fa('0x7'))(_0x17fa('0x8'));var config=require(_0x17fa('0x9'));var jayson=require(_0x17fa('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1082d4,_0x430a11,_0x548195){return new BPromise(function(_0x1963d0,_0x17cde0){return client['request'](_0x1082d4,_0x548195)[_0x17fa('0xb')](function(_0x330e80){logger[_0x17fa('0xc')](_0x17fa('0xd'),_0x430a11,'request\x20sent');logger['debug'](_0x17fa('0xe'),_0x430a11,_0x17fa('0xf'),JSON[_0x17fa('0x10')](_0x330e80));if(_0x330e80[_0x17fa('0x11')]){if(_0x330e80[_0x17fa('0x11')][_0x17fa('0x12')]===0x1f4){logger[_0x17fa('0x11')](_0x17fa('0xd'),_0x430a11,_0x330e80['error']['message']);return _0x17cde0(_0x330e80[_0x17fa('0x11')][_0x17fa('0x13')]);}logger[_0x17fa('0x11')](_0x17fa('0xd'),_0x430a11,_0x330e80[_0x17fa('0x11')][_0x17fa('0x13')]);return _0x1963d0(_0x330e80[_0x17fa('0x11')]['message']);}else{logger[_0x17fa('0xc')](_0x17fa('0xd'),_0x430a11,_0x17fa('0xf'));_0x1963d0(_0x330e80[_0x17fa('0x14')][_0x17fa('0x13')]);}})[_0x17fa('0x15')](function(_0x12bd2a){logger[_0x17fa('0x11')](_0x17fa('0xd'),_0x430a11,_0x12bd2a);_0x17cde0(_0x12bd2a);});});} \ No newline at end of file +var _0x8bb0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x8bb0,0xf7));var _0x08bb=function(_0x1f03ef,_0x5bb5bd){_0x1f03ef=_0x1f03ef-0x0;var _0x190609=_0x8bb0[_0x1f03ef];return _0x190609;};'use strict';var _=require(_0x08bb('0x0'));var util=require(_0x08bb('0x1'));var moment=require(_0x08bb('0x2'));var BPromise=require(_0x08bb('0x3'));var rs=require(_0x08bb('0x4'));var fs=require('fs');var Redis=require(_0x08bb('0x5'));var db=require(_0x08bb('0x6'))['db'];var utils=require(_0x08bb('0x7'));var logger=require(_0x08bb('0x8'))(_0x08bb('0x9'));var config=require(_0x08bb('0xa'));var jayson=require(_0x08bb('0xb'));var client=jayson[_0x08bb('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512c1a,_0x9b0ef0,_0x2a6828){return new BPromise(function(_0x16e19d,_0x1fd8d7){return client['request'](_0x512c1a,_0x2a6828)[_0x08bb('0xd')](function(_0x3f1e77){logger[_0x08bb('0xe')]('VoiceMail,\x20%s,\x20%s',_0x9b0ef0,_0x08bb('0xf'));logger[_0x08bb('0x10')](_0x08bb('0x11'),_0x9b0ef0,_0x08bb('0xf'),JSON[_0x08bb('0x12')](_0x3f1e77));if(_0x3f1e77['error']){if(_0x3f1e77[_0x08bb('0x13')][_0x08bb('0x14')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x9b0ef0,_0x3f1e77[_0x08bb('0x13')][_0x08bb('0x15')]);return _0x1fd8d7(_0x3f1e77['error'][_0x08bb('0x15')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x9b0ef0,_0x3f1e77['error']['message']);return _0x16e19d(_0x3f1e77[_0x08bb('0x13')][_0x08bb('0x15')]);}else{logger['info'](_0x08bb('0x16'),_0x9b0ef0,'request\x20sent');_0x16e19d(_0x3f1e77[_0x08bb('0x17')][_0x08bb('0x15')]);}})[_0x08bb('0x18')](function(_0x31fd47){logger[_0x08bb('0x13')](_0x08bb('0x16'),_0x9b0ef0,_0x31fd47);_0x1fd8d7(_0x31fd47);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3a4c8f2..645f715 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 _0xf821=['put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','create'];(function(_0xe92f1b,_0x2209d8){var _0x121d9b=function(_0x53dc34){while(--_0x53dc34){_0xe92f1b['push'](_0xe92f1b['shift']());}};_0x121d9b(++_0x2209d8);}(_0xf821,0x120));var _0x1f82=function(_0x19faae,_0x5697bc){_0x19faae=_0x19faae-0x0;var _0x363543=_0xf821[_0x19faae];return _0x363543;};'use strict';var multer=require('multer');var util=require(_0x1f82('0x0'));var path=require(_0x1f82('0x1'));var timeout=require(_0x1f82('0x2'));var express=require(_0x1f82('0x3'));var router=express[_0x1f82('0x4')]();var fs_extra=require(_0x1f82('0x5'));var auth=require(_0x1f82('0x6'));var interaction=require(_0x1f82('0x7'));var config=require(_0x1f82('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x1f82('0x9')]('/',auth[_0x1f82('0xa')](),controller[_0x1f82('0xb')]);router[_0x1f82('0x9')](_0x1f82('0xc'),auth[_0x1f82('0xa')](),controller[_0x1f82('0xd')]);router[_0x1f82('0x9')]('/:id/download',auth[_0x1f82('0xa')](),controller[_0x1f82('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f82('0xf')]);router[_0x1f82('0x10')](_0x1f82('0xc'),auth[_0x1f82('0xa')](),controller['update']);router['delete'](_0x1f82('0xc'),auth['isAuthenticated'](),controller[_0x1f82('0x11')]);module[_0x1f82('0x12')]=router; \ No newline at end of file +var _0x1e4d=['isAuthenticated','index','show','download','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../config/environment','get'];(function(_0x585829,_0x81f0f0){var _0x3c1c02=function(_0x13a675){while(--_0x13a675){_0x585829['push'](_0x585829['shift']());}};_0x3c1c02(++_0x81f0f0);}(_0x1e4d,0x11a));var _0xd1e4=function(_0x41c29d,_0x8ff066){_0x41c29d=_0x41c29d-0x0;var _0x419d7d=_0x1e4d[_0x41c29d];return _0x419d7d;};'use strict';var multer=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var path=require(_0xd1e4('0x2'));var timeout=require(_0xd1e4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1e4('0x4'));var controller=require('./voiceMailMessage.controller');router[_0xd1e4('0x5')]('/',auth[_0xd1e4('0x6')](),controller[_0xd1e4('0x7')]);router[_0xd1e4('0x5')]('/:id',auth[_0xd1e4('0x6')](),controller[_0xd1e4('0x8')]);router[_0xd1e4('0x5')]('/:id/download',auth['isAuthenticated'](),controller[_0xd1e4('0x9')]);router[_0xd1e4('0xa')]('/',auth[_0xd1e4('0x6')](),controller['create']);router[_0xd1e4('0xb')](_0xd1e4('0xc'),auth[_0xd1e4('0x6')](),controller[_0xd1e4('0xd')]);router['delete'](_0xd1e4('0xc'),auth[_0xd1e4('0x6')](),controller[_0xd1e4('0xe')]);module[_0xd1e4('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index bd51a7d..f98bac0 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 _0x8ef7=['exports','VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x51bd84,_0x33f69e){var _0x4a63d1=function(_0x5d6b36){while(--_0x5d6b36){_0x51bd84['push'](_0x51bd84['shift']());}};_0x4a63d1(++_0x33f69e);}(_0x8ef7,0x155));var _0x78ef=function(_0x30a0b5,_0x8a437d){_0x30a0b5=_0x30a0b5-0x0;var _0x51cd8d=_0x8ef7[_0x30a0b5];return _0x51cd8d;};'use strict';var Sequelize=require(_0x78ef('0x0'));module[_0x78ef('0x1')]={'name':{'type':Sequelize[_0x78ef('0x2')],'get':function(_0x33e37a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x78ef('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x78ef('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x78ef('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x78ef('0x6'),'defaultValue':Sequelize[_0x78ef('0x7')](_0x78ef('0x8'))}}; \ No newline at end of file +var _0x40b0=['long','TIMESTAMP','literal','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x40b0,0x1e9));var _0x040b=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0x40b0[_0x336264];return _0x53cf91;};'use strict';var Sequelize=require(_0x040b('0x0'));module['exports']={'name':{'type':Sequelize[_0x040b('0x1')],'get':function(_0x543717){return this[_0x040b('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x040b('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x040b('0x5')](_0x040b('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x040b('0x4')],'defaultValue':''},'stamp':{'type':_0x040b('0x7'),'defaultValue':Sequelize[_0x040b('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f8bc0a9..b5b062b 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 _0x20f1=['attachment;\x20filename=\x22','.wav\x22','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','error','name','send','index','VoiceMailMessage','type','key','differenceBy','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','keys','fields','find','create','body','destroy','download','params','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition'];(function(_0x2ed5f6,_0x20acaa){var _0x13d58f=function(_0x29b3e2){while(--_0x29b3e2){_0x2ed5f6['push'](_0x2ed5f6['shift']());}};_0x13d58f(++_0x20acaa);}(_0x20f1,0x156));var _0x120f=function(_0x851ae1,_0x362760){_0x851ae1=_0x851ae1-0x0;var _0x1de5fb=_0x20f1[_0x851ae1];return _0x1de5fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x120f('0x0'));var jsonpatch=require(_0x120f('0x1'));var rp=require('request-promise');var moment=require(_0x120f('0x2'));var BPromise=require(_0x120f('0x3'));var Mustache=require(_0x120f('0x4'));var util=require(_0x120f('0x5'));var path=require(_0x120f('0x6'));var sox=require(_0x120f('0x7'));var csv=require('to-csv');var ejs=require(_0x120f('0x8'));var fs=require('fs');var fs_extra=require(_0x120f('0x9'));var _=require(_0x120f('0xa'));var squel=require(_0x120f('0xb'));var crypto=require('crypto');var jsforce=require(_0x120f('0xc'));var deskjs=require(_0x120f('0xd'));var toCsv=require(_0x120f('0xe'));var querystring=require(_0x120f('0xf'));var Papa=require(_0x120f('0x10'));var Redis=require(_0x120f('0x11'));var authService=require(_0x120f('0x12'));var qs=require(_0x120f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x120f('0x14'));var logger=require(_0x120f('0x15'))(_0x120f('0x16'));var utils=require(_0x120f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x120f('0x18'));var db=require(_0x120f('0x19'))['db'];function respondWithStatusCode(_0x5a5219,_0x36eb52){_0x36eb52=_0x36eb52||0xcc;return function(_0x2bc63b){if(_0x2bc63b){return _0x5a5219[_0x120f('0x1a')](_0x36eb52);}return _0x5a5219[_0x120f('0x1b')](_0x36eb52)[_0x120f('0x1c')]();};}function respondWithResult(_0x197c4c,_0x1b0442){_0x1b0442=_0x1b0442||0xc8;return function(_0x59d03c){if(_0x59d03c){return _0x197c4c[_0x120f('0x1b')](_0x1b0442)['json'](_0x59d03c);}};}function respondWithFilteredResult(_0x45ed80,_0x253b0a){return function(_0x27557a){if(_0x27557a){var _0x1ca988=typeof _0x253b0a[_0x120f('0x1d')]===_0x120f('0x1e')&&typeof _0x253b0a[_0x120f('0x1f')]===_0x120f('0x1e');var _0x31da9c=_0x27557a[_0x120f('0x20')];var _0x28185=_0x1ca988?0x0:_0x253b0a[_0x120f('0x1d')];var _0x28b140=_0x1ca988?_0x27557a[_0x120f('0x20')]:_0x253b0a[_0x120f('0x1d')]+_0x253b0a[_0x120f('0x1f')];var _0x1a7cdf;if(_0x28b140>=_0x31da9c){_0x28b140=_0x31da9c;_0x1a7cdf=0xc8;}else{_0x1a7cdf=0xce;}_0x45ed80[_0x120f('0x1b')](_0x1a7cdf);return _0x45ed80[_0x120f('0x21')](_0x120f('0x22'),_0x28185+'-'+_0x28b140+'/'+_0x31da9c)[_0x120f('0x23')](_0x27557a);}return null;};}function patchUpdates(_0x3e27e5){return function(_0xab1c28){try{jsonpatch[_0x120f('0x24')](_0xab1c28,_0x3e27e5,!![]);}catch(_0x3606b7){return BPromise[_0x120f('0x25')](_0x3606b7);}return _0xab1c28['save']();};}function saveUpdates(_0x361707,_0x1c676e){return function(_0x969689){if(_0x969689){return _0x969689[_0x120f('0x26')](_0x361707)['then'](function(_0x70bcad){return _0x70bcad;});}return null;};}function removeEntity(_0xa94d76,_0x200980){return function(_0x31d397){if(_0x31d397){return _0x31d397['destroy']()['then'](function(){_0xa94d76[_0x120f('0x1b')](0xcc)[_0x120f('0x1c')]();});}};}function handleEntityNotFound(_0x58b7e9,_0x50046a){return function(_0x3d0e98){if(!_0x3d0e98){_0x58b7e9[_0x120f('0x1a')](0x194);}return _0x3d0e98;};}function handleError(_0x4190c4,_0x36e004){_0x36e004=_0x36e004||0x1f4;return function(_0x505277){logger[_0x120f('0x27')](_0x505277['stack']);if(_0x505277[_0x120f('0x28')]){delete _0x505277[_0x120f('0x28')];}_0x4190c4['status'](_0x36e004)[_0x120f('0x29')](_0x505277);};}exports[_0x120f('0x2a')]=function(_0x32cc09,_0x10d2ae){var _0x5a7078={},_0x37f6e2={},_0x58f3c2={'count':0x0,'rows':[]};var _0x26a23c=_['map'](db[_0x120f('0x2b')]['rawAttributes'],function(_0x2e6ba7){return{'name':_0x2e6ba7['fieldName'],'type':_0x2e6ba7[_0x120f('0x2c')][_0x120f('0x2d')]};});_0x37f6e2['model']=_[_0x120f('0x2e')](_[_0x120f('0x2f')](_0x26a23c,_0x120f('0x28')),[_0x120f('0x28')]);_0x37f6e2[_0x120f('0x30')]=_['keys'](_0x32cc09[_0x120f('0x30')]);_0x37f6e2[_0x120f('0x31')]=_[_0x120f('0x32')](_0x37f6e2[_0x120f('0x33')],_0x37f6e2[_0x120f('0x30')]);_0x5a7078['attributes']=_['intersection'](_0x37f6e2[_0x120f('0x33')],qs['fields'](_0x32cc09['query']['fields']));_0x5a7078[_0x120f('0x34')]=_0x5a7078[_0x120f('0x34')][_0x120f('0x35')]?_0x5a7078[_0x120f('0x34')]:_0x37f6e2[_0x120f('0x33')];if(!_0x32cc09[_0x120f('0x30')][_0x120f('0x36')](_0x120f('0x37'))){_0x5a7078[_0x120f('0x1f')]=qs[_0x120f('0x1f')](_0x32cc09[_0x120f('0x30')][_0x120f('0x1f')]);_0x5a7078['offset']=qs[_0x120f('0x1d')](_0x32cc09['query']['offset']);}_0x5a7078[_0x120f('0x38')]=qs['sort'](_0x32cc09['query'][_0x120f('0x39')]);_0x5a7078['where']=qs['filters'](_['pick'](_0x32cc09[_0x120f('0x30')],_0x37f6e2[_0x120f('0x31')]),_0x26a23c);if(_0x32cc09[_0x120f('0x30')][_0x120f('0x3a')]){_0x5a7078[_0x120f('0x3b')]=_[_0x120f('0x3c')](_0x5a7078[_0x120f('0x3b')],{'$or':_['map'](_0x26a23c,function(_0x440c4e){if(_0x440c4e['type']!==_0x120f('0x3d')){var _0x16dd1e={};_0x16dd1e[_0x440c4e['name']]={'$like':'%'+_0x32cc09['query'][_0x120f('0x3a')]+'%'};return _0x16dd1e;}})});}_0x5a7078=_['merge']({},_0x5a7078,_0x32cc09[_0x120f('0x3e')]);var _0x507ca5={'where':_0x5a7078[_0x120f('0x3b')]};return db[_0x120f('0x2b')][_0x120f('0x20')](_0x507ca5)[_0x120f('0x3f')](function(_0x19c0f9){_0x58f3c2['count']=_0x19c0f9;if(_0x32cc09[_0x120f('0x30')][_0x120f('0x40')]){_0x5a7078[_0x120f('0x41')]=[{'all':!![]}];}return db[_0x120f('0x2b')][_0x120f('0x42')](_0x5a7078);})[_0x120f('0x3f')](function(_0x455fba){_0x58f3c2['rows']=_0x455fba;return _0x58f3c2;})[_0x120f('0x3f')](respondWithFilteredResult(_0x10d2ae,_0x5a7078))[_0x120f('0x43')](handleError(_0x10d2ae,null));};exports['show']=function(_0x41a02a,_0x2d5a30){var _0x1ac8c3={'raw':!![],'where':{'id':_0x41a02a['params']['id']}},_0x584d6f={};_0x584d6f['model']=_['keys'](db[_0x120f('0x2b')]['rawAttributes']);_0x584d6f[_0x120f('0x30')]=_[_0x120f('0x44')](_0x41a02a[_0x120f('0x30')]);_0x584d6f[_0x120f('0x31')]=_[_0x120f('0x32')](_0x584d6f[_0x120f('0x33')],_0x584d6f[_0x120f('0x30')]);_0x1ac8c3[_0x120f('0x34')]=_['intersection'](_0x584d6f['model'],qs[_0x120f('0x45')](_0x41a02a['query']['fields']));_0x1ac8c3[_0x120f('0x34')]=_0x1ac8c3[_0x120f('0x34')][_0x120f('0x35')]?_0x1ac8c3['attributes']:_0x584d6f['model'];if(_0x41a02a[_0x120f('0x30')][_0x120f('0x40')]){_0x1ac8c3[_0x120f('0x41')]=[{'all':!![]}];}_0x1ac8c3=_[_0x120f('0x3c')]({},_0x1ac8c3,_0x41a02a['options']);return db[_0x120f('0x2b')][_0x120f('0x46')](_0x1ac8c3)[_0x120f('0x3f')](handleEntityNotFound(_0x2d5a30,null))[_0x120f('0x3f')](respondWithResult(_0x2d5a30,null))[_0x120f('0x43')](handleError(_0x2d5a30,null));};exports[_0x120f('0x47')]=function(_0x1c5b41,_0x45d7ab){return db[_0x120f('0x2b')]['create'](_0x1c5b41[_0x120f('0x48')],{})[_0x120f('0x3f')](respondWithResult(_0x45d7ab,0xc9))[_0x120f('0x43')](handleError(_0x45d7ab,null));};exports['update']=function(_0x2a6f83,_0xe419b1){if(_0x2a6f83['body']['id']){delete _0x2a6f83[_0x120f('0x48')]['id'];}return db[_0x120f('0x2b')][_0x120f('0x46')]({'where':{'id':_0x2a6f83['params']['id']}})[_0x120f('0x3f')](handleEntityNotFound(_0xe419b1,null))[_0x120f('0x3f')](saveUpdates(_0x2a6f83['body'],null))['then'](respondWithResult(_0xe419b1,null))[_0x120f('0x43')](handleError(_0xe419b1,null));};exports[_0x120f('0x49')]=function(_0x2acca8,_0x4f7a8e){return db[_0x120f('0x2b')][_0x120f('0x46')]({'where':{'id':_0x2acca8['params']['id']}})[_0x120f('0x3f')](handleEntityNotFound(_0x4f7a8e,null))[_0x120f('0x3f')](removeEntity(_0x4f7a8e,null))[_0x120f('0x43')](handleError(_0x4f7a8e,null));};exports[_0x120f('0x4a')]=function(_0x310558,_0x51691b,_0x53e7a8){return db[_0x120f('0x2b')][_0x120f('0x46')]({'where':{'id':_0x310558[_0x120f('0x4b')]['id']},'attributes':['id',_0x120f('0x4c'),_0x120f('0x4d')]})[_0x120f('0x3f')](handleEntityNotFound(_0x51691b,null))[_0x120f('0x3f')](function(_0x2568e5){if(_0x2568e5){if(!_0x2568e5[_0x120f('0x4c')]){throw new db['Sequelize'][(_0x120f('0x4e'))](_0x120f('0x4f'));}var _0x23f354={'Content-Type':_0x120f('0x50'),'Content-Disposition':_0x120f('0x51')};if(_0x2568e5[_0x120f('0x4d')]){_0x23f354[_0x120f('0x52')]=_0x120f('0x53')+_0x2568e5[_0x120f('0x4d')]+_0x120f('0x54');}_0x51691b['set'](_0x23f354);return _0x51691b[_0x120f('0x29')](new Buffer(_0x2568e5['recording']));}})[_0x120f('0x43')](handleError(_0x51691b,null));}; \ No newline at end of file +var _0x8fb6=['name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','msg_id','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','apply','reject','save','update','then','destroy','error'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0x8fb6,0x127));var _0x68fb=function(_0x512fa9,_0x368a57){_0x512fa9=_0x512fa9-0x0;var _0x506d9f=_0x8fb6[_0x512fa9];return _0x506d9f;};'use strict';var emlformat=require(_0x68fb('0x0'));var rimraf=require(_0x68fb('0x1'));var zipdir=require(_0x68fb('0x2'));var jsonpatch=require(_0x68fb('0x3'));var rp=require(_0x68fb('0x4'));var moment=require(_0x68fb('0x5'));var BPromise=require(_0x68fb('0x6'));var Mustache=require(_0x68fb('0x7'));var util=require(_0x68fb('0x8'));var path=require('path');var sox=require(_0x68fb('0x9'));var csv=require(_0x68fb('0xa'));var ejs=require(_0x68fb('0xb'));var fs=require('fs');var fs_extra=require(_0x68fb('0xc'));var _=require(_0x68fb('0xd'));var squel=require('squel');var crypto=require(_0x68fb('0xe'));var jsforce=require(_0x68fb('0xf'));var deskjs=require(_0x68fb('0x10'));var toCsv=require(_0x68fb('0xa'));var querystring=require('querystring');var Papa=require(_0x68fb('0x11'));var Redis=require(_0x68fb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x68fb('0x13'));var as=require(_0x68fb('0x14'));var hardwareService=require(_0x68fb('0x15'));var logger=require(_0x68fb('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x68fb('0x17'));var db=require(_0x68fb('0x18'))['db'];function respondWithStatusCode(_0x2fe9cb,_0x3adcba){_0x3adcba=_0x3adcba||0xcc;return function(_0x178a65){if(_0x178a65){return _0x2fe9cb[_0x68fb('0x19')](_0x3adcba);}return _0x2fe9cb[_0x68fb('0x1a')](_0x3adcba)[_0x68fb('0x1b')]();};}function respondWithResult(_0x440001,_0x511194){_0x511194=_0x511194||0xc8;return function(_0x33a3cd){if(_0x33a3cd){return _0x440001[_0x68fb('0x1a')](_0x511194)['json'](_0x33a3cd);}};}function respondWithFilteredResult(_0x2e29e2,_0x3fc8a7){return function(_0x517ef3){if(_0x517ef3){var _0x523775=typeof _0x3fc8a7['offset']===_0x68fb('0x1c')&&typeof _0x3fc8a7['limit']===_0x68fb('0x1c');var _0x10d0ec=_0x517ef3['count'];var _0x4aad20=_0x523775?0x0:_0x3fc8a7[_0x68fb('0x1d')];var _0x55e1a6=_0x523775?_0x517ef3[_0x68fb('0x1e')]:_0x3fc8a7[_0x68fb('0x1d')]+_0x3fc8a7[_0x68fb('0x1f')];var _0x24d479;if(_0x55e1a6>=_0x10d0ec){_0x55e1a6=_0x10d0ec;_0x24d479=0xc8;}else{_0x24d479=0xce;}_0x2e29e2[_0x68fb('0x1a')](_0x24d479);return _0x2e29e2[_0x68fb('0x20')]('Content-Range',_0x4aad20+'-'+_0x55e1a6+'/'+_0x10d0ec)[_0x68fb('0x21')](_0x517ef3);}return null;};}function patchUpdates(_0x4333fd){return function(_0x430bcd){try{jsonpatch[_0x68fb('0x22')](_0x430bcd,_0x4333fd,!![]);}catch(_0x1e79da){return BPromise[_0x68fb('0x23')](_0x1e79da);}return _0x430bcd[_0x68fb('0x24')]();};}function saveUpdates(_0x30ff62,_0x5b3c52){return function(_0x3fd30e){if(_0x3fd30e){return _0x3fd30e[_0x68fb('0x25')](_0x30ff62)[_0x68fb('0x26')](function(_0x362fab){return _0x362fab;});}return null;};}function removeEntity(_0x509b97,_0xb78b27){return function(_0x424250){if(_0x424250){return _0x424250[_0x68fb('0x27')]()[_0x68fb('0x26')](function(){_0x509b97[_0x68fb('0x1a')](0xcc)[_0x68fb('0x1b')]();});}};}function handleEntityNotFound(_0x1f1aab,_0x3cd980){return function(_0x4529ac){if(!_0x4529ac){_0x1f1aab['sendStatus'](0x194);}return _0x4529ac;};}function handleError(_0x130efd,_0x2f339d){_0x2f339d=_0x2f339d||0x1f4;return function(_0x251cbe){logger[_0x68fb('0x28')](_0x251cbe['stack']);if(_0x251cbe[_0x68fb('0x29')]){delete _0x251cbe[_0x68fb('0x29')];}_0x130efd[_0x68fb('0x1a')](_0x2f339d)[_0x68fb('0x2a')](_0x251cbe);};}exports['index']=function(_0x4a57a2,_0x2da606){var _0x52cb2a={},_0x531d22={},_0xadad7b={'count':0x0,'rows':[]};var _0x26cf8a=_[_0x68fb('0x2b')](db[_0x68fb('0x2c')][_0x68fb('0x2d')],function(_0x64ca22){return{'name':_0x64ca22[_0x68fb('0x2e')],'type':_0x64ca22[_0x68fb('0x2f')][_0x68fb('0x30')]};});_0x531d22[_0x68fb('0x31')]=_[_0x68fb('0x32')](_[_0x68fb('0x2b')](_0x26cf8a,_0x68fb('0x29')),['name']);_0x531d22[_0x68fb('0x33')]=_['keys'](_0x4a57a2['query']);_0x531d22[_0x68fb('0x34')]=_[_0x68fb('0x35')](_0x531d22['model'],_0x531d22[_0x68fb('0x33')]);_0x52cb2a[_0x68fb('0x36')]=_[_0x68fb('0x35')](_0x531d22['model'],qs[_0x68fb('0x37')](_0x4a57a2['query'][_0x68fb('0x37')]));_0x52cb2a['attributes']=_0x52cb2a[_0x68fb('0x36')][_0x68fb('0x38')]?_0x52cb2a[_0x68fb('0x36')]:_0x531d22[_0x68fb('0x31')];if(!_0x4a57a2[_0x68fb('0x33')]['hasOwnProperty'](_0x68fb('0x39'))){_0x52cb2a[_0x68fb('0x1f')]=qs[_0x68fb('0x1f')](_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x1f')]);_0x52cb2a[_0x68fb('0x1d')]=qs['offset'](_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x1d')]);}_0x52cb2a['order']=qs[_0x68fb('0x3a')](_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x3a')]);_0x52cb2a['where']=qs[_0x68fb('0x34')](_[_0x68fb('0x3b')](_0x4a57a2[_0x68fb('0x33')],_0x531d22[_0x68fb('0x34')]),_0x26cf8a);if(_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x3c')]){_0x52cb2a['where']=_[_0x68fb('0x3d')](_0x52cb2a[_0x68fb('0x3e')],{'$or':_['map'](_0x26cf8a,function(_0x55b9c3){if(_0x55b9c3['type']!==_0x68fb('0x3f')){var _0x336b77={};_0x336b77[_0x55b9c3[_0x68fb('0x29')]]={'$like':'%'+_0x4a57a2[_0x68fb('0x33')]['filter']+'%'};return _0x336b77;}})});}_0x52cb2a=_['merge']({},_0x52cb2a,_0x4a57a2[_0x68fb('0x40')]);var _0x2109b9={'where':_0x52cb2a[_0x68fb('0x3e')]};return db['VoiceMailMessage'][_0x68fb('0x1e')](_0x2109b9)['then'](function(_0x41ed3a){_0xadad7b['count']=_0x41ed3a;if(_0x4a57a2[_0x68fb('0x33')][_0x68fb('0x41')]){_0x52cb2a['include']=[{'all':!![]}];}return db[_0x68fb('0x2c')][_0x68fb('0x42')](_0x52cb2a);})[_0x68fb('0x26')](function(_0x5a421f){_0xadad7b[_0x68fb('0x43')]=_0x5a421f;return _0xadad7b;})['then'](respondWithFilteredResult(_0x2da606,_0x52cb2a))[_0x68fb('0x44')](handleError(_0x2da606,null));};exports[_0x68fb('0x45')]=function(_0x487a17,_0x3c7501){var _0x267356={'raw':!![],'where':{'id':_0x487a17['params']['id']}},_0x2e6e9f={};_0x2e6e9f[_0x68fb('0x31')]=_['keys'](db['VoiceMailMessage'][_0x68fb('0x2d')]);_0x2e6e9f[_0x68fb('0x33')]=_['keys'](_0x487a17[_0x68fb('0x33')]);_0x2e6e9f['filters']=_[_0x68fb('0x35')](_0x2e6e9f[_0x68fb('0x31')],_0x2e6e9f['query']);_0x267356['attributes']=_[_0x68fb('0x35')](_0x2e6e9f[_0x68fb('0x31')],qs[_0x68fb('0x37')](_0x487a17['query'][_0x68fb('0x37')]));_0x267356[_0x68fb('0x36')]=_0x267356['attributes'][_0x68fb('0x38')]?_0x267356[_0x68fb('0x36')]:_0x2e6e9f[_0x68fb('0x31')];if(_0x487a17['query'][_0x68fb('0x41')]){_0x267356[_0x68fb('0x46')]=[{'all':!![]}];}_0x267356=_[_0x68fb('0x3d')]({},_0x267356,_0x487a17['options']);return db[_0x68fb('0x2c')][_0x68fb('0x47')](_0x267356)[_0x68fb('0x26')](handleEntityNotFound(_0x3c7501,null))[_0x68fb('0x26')](respondWithResult(_0x3c7501,null))['catch'](handleError(_0x3c7501,null));};exports[_0x68fb('0x48')]=function(_0x1870c9,_0x2902b6){return db[_0x68fb('0x2c')][_0x68fb('0x48')](_0x1870c9[_0x68fb('0x49')],{})[_0x68fb('0x26')](respondWithResult(_0x2902b6,0xc9))['catch'](handleError(_0x2902b6,null));};exports[_0x68fb('0x25')]=function(_0x82d9ab,_0x1b863b){if(_0x82d9ab[_0x68fb('0x49')]['id']){delete _0x82d9ab[_0x68fb('0x49')]['id'];}return db[_0x68fb('0x2c')][_0x68fb('0x47')]({'where':{'id':_0x82d9ab[_0x68fb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b863b,null))[_0x68fb('0x26')](saveUpdates(_0x82d9ab[_0x68fb('0x49')],null))[_0x68fb('0x26')](respondWithResult(_0x1b863b,null))[_0x68fb('0x44')](handleError(_0x1b863b,null));};exports[_0x68fb('0x27')]=function(_0x4eec45,_0x1b972d){return db[_0x68fb('0x2c')][_0x68fb('0x47')]({'where':{'id':_0x4eec45['params']['id']}})[_0x68fb('0x26')](handleEntityNotFound(_0x1b972d,null))[_0x68fb('0x26')](removeEntity(_0x1b972d,null))[_0x68fb('0x44')](handleError(_0x1b972d,null));};exports[_0x68fb('0x4b')]=function(_0x4395b0,_0x1c2b6c,_0x42ae65){return db[_0x68fb('0x2c')]['find']({'where':{'id':_0x4395b0[_0x68fb('0x4a')]['id']},'attributes':['id',_0x68fb('0x4c'),'msg_id']})[_0x68fb('0x26')](handleEntityNotFound(_0x1c2b6c,null))[_0x68fb('0x26')](function(_0x21ef7b){if(_0x21ef7b){if(!_0x21ef7b[_0x68fb('0x4c')]){throw new db[(_0x68fb('0x4d'))][(_0x68fb('0x4e'))](_0x68fb('0x4f'));}var _0x58dc13={'Content-Type':_0x68fb('0x50'),'Content-Disposition':_0x68fb('0x51')};if(_0x21ef7b['msg_id']){_0x58dc13[_0x68fb('0x52')]='attachment;\x20filename=\x22'+_0x21ef7b[_0x68fb('0x53')]+'.wav\x22';}_0x1c2b6c['set'](_0x58dc13);return _0x1c2b6c[_0x68fb('0x2a')](new Buffer(_0x21ef7b[_0x68fb('0x4c')]));}})[_0x68fb('0x44')](handleError(_0x1c2b6c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 32963f0..c052bd9 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 _0xa6e6=['bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x428dbd,_0x30eeb5){var _0xc411d8=function(_0x12cab8){while(--_0x12cab8){_0x428dbd['push'](_0x428dbd['shift']());}};_0xc411d8(++_0x30eeb5);}(_0xa6e6,0x175));var _0x6a6e=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xa6e6[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0x6a6e('0x0'));var util=require(_0x6a6e('0x1'));var logger=require(_0x6a6e('0x2'))(_0x6a6e('0x3'));var moment=require(_0x6a6e('0x4'));var BPromise=require(_0x6a6e('0x5'));var rp=require(_0x6a6e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a6e('0x7'));var config=require(_0x6a6e('0x8'));var attributes=require(_0x6a6e('0x9'));module[_0x6a6e('0xa')]=function(_0x1c1869,_0x26cc6e){return _0x1c1869[_0x6a6e('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x6a6e('0xc'),'paranoid':![],'indexes':[{'name':_0x6a6e('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xefce=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util'];(function(_0xcdfc4f,_0x8a111a){var _0x3f70d1=function(_0xc0f333){while(--_0xc0f333){_0xcdfc4f['push'](_0xcdfc4f['shift']());}};_0x3f70d1(++_0x8a111a);}(_0xefce,0xdb));var _0xeefc=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0xefce[_0x98db33];return _0x5ae63a;};'use strict';var _=require(_0xeefc('0x0'));var util=require(_0xeefc('0x1'));var logger=require(_0xeefc('0x2'))(_0xeefc('0x3'));var moment=require('moment');var BPromise=require(_0xeefc('0x4'));var rp=require(_0xeefc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeefc('0x6'));var config=require(_0xeefc('0x7'));var attributes=require(_0xeefc('0x8'));module[_0xeefc('0x9')]=function(_0xc01cf9,_0x46f732){return _0xc01cf9[_0xeefc('0xa')](_0xeefc('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xeefc('0xc'),'fields':[_0xeefc('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f1bc553..3396ef0 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 _0x6654=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x5045b5,_0x4056b6){var _0x3596f3=function(_0x48956a){while(--_0x48956a){_0x5045b5['push'](_0x5045b5['shift']());}};_0x3596f3(++_0x4056b6);}(_0x6654,0x97));var _0x4665=function(_0x41103e,_0x317384){_0x41103e=_0x41103e-0x0;var _0x31d0d1=_0x6654[_0x41103e];return _0x31d0d1;};'use strict';var _=require(_0x4665('0x0'));var util=require(_0x4665('0x1'));var moment=require(_0x4665('0x2'));var BPromise=require(_0x4665('0x3'));var rs=require(_0x4665('0x4'));var fs=require('fs');var Redis=require(_0x4665('0x5'));var db=require(_0x4665('0x6'))['db'];var utils=require(_0x4665('0x7'));var logger=require(_0x4665('0x8'))(_0x4665('0x9'));var config=require(_0x4665('0xa'));var jayson=require(_0x4665('0xb'));var client=jayson['client'][_0x4665('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d5249,_0x21802f,_0x17b988){return new BPromise(function(_0xdacaa1,_0x20d01d){return client[_0x4665('0xd')](_0x4d5249,_0x17b988)[_0x4665('0xe')](function(_0x1e7b2){logger[_0x4665('0xf')](_0x4665('0x10'),_0x21802f,_0x4665('0x11'));logger[_0x4665('0x12')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x21802f,_0x4665('0x11'),JSON[_0x4665('0x13')](_0x1e7b2));if(_0x1e7b2[_0x4665('0x14')]){if(_0x1e7b2[_0x4665('0x14')]['code']===0x1f4){logger[_0x4665('0x14')](_0x4665('0x10'),_0x21802f,_0x1e7b2[_0x4665('0x14')][_0x4665('0x15')]);return _0x20d01d(_0x1e7b2[_0x4665('0x14')]['message']);}logger['error'](_0x4665('0x10'),_0x21802f,_0x1e7b2['error']['message']);return _0xdacaa1(_0x1e7b2[_0x4665('0x14')]['message']);}else{logger['info'](_0x4665('0x10'),_0x21802f,_0x4665('0x11'));_0xdacaa1(_0x1e7b2[_0x4665('0x16')][_0x4665('0x15')]);}})[_0x4665('0x17')](function(_0x2ad77b){logger[_0x4665('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x21802f,_0x2ad77b);_0x20d01d(_0x2ad77b);});});} \ No newline at end of file +var _0xcbb4=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xcbb4,0x10f));var _0x4cbb=function(_0x3e4f74,_0x26ce71){_0x3e4f74=_0x3e4f74-0x0;var _0xd07d99=_0xcbb4[_0x3e4f74];return _0xd07d99;};'use strict';var _=require(_0x4cbb('0x0'));var util=require(_0x4cbb('0x1'));var moment=require(_0x4cbb('0x2'));var BPromise=require(_0x4cbb('0x3'));var rs=require(_0x4cbb('0x4'));var fs=require('fs');var Redis=require(_0x4cbb('0x5'));var db=require(_0x4cbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4cbb('0x7'))(_0x4cbb('0x8'));var config=require('../../config/environment');var jayson=require(_0x4cbb('0x9'));var client=jayson['client'][_0x4cbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208157,_0x2c98a5,_0x26d497){return new BPromise(function(_0x584e04,_0x3c80d1){return client['request'](_0x208157,_0x26d497)[_0x4cbb('0xb')](function(_0x355f78){logger[_0x4cbb('0xc')](_0x4cbb('0xd'),_0x2c98a5,_0x4cbb('0xe'));logger[_0x4cbb('0xf')](_0x4cbb('0x10'),_0x2c98a5,'request\x20sent',JSON[_0x4cbb('0x11')](_0x355f78));if(_0x355f78[_0x4cbb('0x12')]){if(_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x13')]===0x1f4){logger['error'](_0x4cbb('0xd'),_0x2c98a5,_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);return _0x3c80d1(_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);}logger[_0x4cbb('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x2c98a5,_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);return _0x584e04(_0x355f78[_0x4cbb('0x12')][_0x4cbb('0x14')]);}else{logger['info'](_0x4cbb('0xd'),_0x2c98a5,'request\x20sent');_0x584e04(_0x355f78[_0x4cbb('0x15')][_0x4cbb('0x14')]);}})['catch'](function(_0x1dca78){logger[_0x4cbb('0x12')](_0x4cbb('0xd'),_0x2c98a5,_0x1dca78);_0x3c80d1(_0x1dca78);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index cc1524d..10de29c 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 _0x373e=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22d3bf,_0x57c59d){var _0x4dc475=function(_0x39c10f){while(--_0x39c10f){_0x22d3bf['push'](_0x22d3bf['shift']());}};_0x4dc475(++_0x57c59d);}(_0x373e,0xc7));var _0xe373=function(_0x557d3c,_0x2801d5){_0x557d3c=_0x557d3c-0x0;var _0x497642=_0x373e[_0x557d3c];return _0x497642;};'use strict';var multer=require(_0xe373('0x0'));var util=require(_0xe373('0x1'));var path=require(_0xe373('0x2'));var timeout=require(_0xe373('0x3'));var express=require(_0xe373('0x4'));var router=express[_0xe373('0x5')]();var fs_extra=require(_0xe373('0x6'));var auth=require(_0xe373('0x7'));var interaction=require(_0xe373('0x8'));var config=require(_0xe373('0x9'));var controller=require(_0xe373('0xa'));router[_0xe373('0xb')]('/',auth[_0xe373('0xc')](),controller[_0xe373('0xd')]);router[_0xe373('0xb')](_0xe373('0xe'),auth[_0xe373('0xc')](),controller[_0xe373('0xf')]);router[_0xe373('0xb')](_0xe373('0x10'),auth[_0xe373('0xc')](),controller[_0xe373('0x11')]);router['post']('/',auth[_0xe373('0xc')](),controller[_0xe373('0x12')]);router[_0xe373('0x13')](_0xe373('0x10'),auth[_0xe373('0xc')](),controller['addSound']);router[_0xe373('0x14')](_0xe373('0xe'),auth[_0xe373('0xc')](),controller[_0xe373('0x15')]);router['delete'](_0xe373('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe373('0x16')](_0xe373('0x17'),auth['isAuthenticated'](),controller[_0xe373('0x18')]);module[_0xe373('0x19')]=router; \ No newline at end of file +var _0x0e7a=['./voiceMusicOnHold.controller','get','index','isAuthenticated','/:id/sounds','getSounds','create','post','put','/:id','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x26aa07,_0x55175f){var _0x3683e9=function(_0x484a30){while(--_0x484a30){_0x26aa07['push'](_0x26aa07['shift']());}};_0x3683e9(++_0x55175f);}(_0x0e7a,0x1db));var _0xa0e7=function(_0x24e3f0,_0x291458){_0x24e3f0=_0x24e3f0-0x0;var _0x36b770=_0x0e7a[_0x24e3f0];return _0x36b770;};'use strict';var multer=require('multer');var util=require(_0xa0e7('0x0'));var path=require(_0xa0e7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa0e7('0x2'));var auth=require(_0xa0e7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e7('0x4'));var controller=require(_0xa0e7('0x5'));router[_0xa0e7('0x6')]('/',auth['isAuthenticated'](),controller[_0xa0e7('0x7')]);router['get']('/:id',auth[_0xa0e7('0x8')](),controller['show']);router['get'](_0xa0e7('0x9'),auth[_0xa0e7('0x8')](),controller[_0xa0e7('0xa')]);router['post']('/',auth[_0xa0e7('0x8')](),controller[_0xa0e7('0xb')]);router[_0xa0e7('0xc')](_0xa0e7('0x9'),auth['isAuthenticated'](),controller['addSound']);router[_0xa0e7('0xd')](_0xa0e7('0xe'),auth[_0xa0e7('0x8')](),controller['update']);router[_0xa0e7('0xf')](_0xa0e7('0xe'),auth['isAuthenticated'](),controller[_0xa0e7('0x10')]);router[_0xa0e7('0xf')](_0xa0e7('0x11'),auth[_0xa0e7('0x8')](),controller[_0xa0e7('0x12')]);module[_0xa0e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 55dcd72..4a8a218 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 _0xbf71=['custom','files','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x2e1e22,_0x11be6a){var _0x57fd71=function(_0x2d934f){while(--_0x2d934f){_0x2e1e22['push'](_0x2e1e22['shift']());}};_0x57fd71(++_0x11be6a);}(_0xbf71,0x101));var _0x1bf7=function(_0x784035,_0x318960){_0x784035=_0x784035-0x0;var _0x18eb99=_0xbf71[_0x784035];return _0x18eb99;};'use strict';var Sequelize=require(_0x1bf7('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bf7('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x1bf7('0x2')](_0x1bf7('0x3'),_0x1bf7('0x4'),'mp3nb',_0x1bf7('0x5'),'quietmp3',_0x1bf7('0x6')),'allowNull':!![],'defaultValue':_0x1bf7('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1bf7('0x7')},'format':{'type':Sequelize[_0x1bf7('0x1')],'allowNull':!![]},'stamp':{'type':_0x1bf7('0x8')},'defaultEntry':{'type':Sequelize[_0x1bf7('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x050f=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','TIMESTAMP'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x050f,0xe5));var _0xf050=function(_0x373675,_0x441d59){_0x373675=_0x373675-0x0;var _0x62553e=_0x050f[_0x373675];return _0x62553e;};'use strict';var Sequelize=require(_0xf050('0x0'));module[_0xf050('0x1')]={'name':{'type':Sequelize[_0xf050('0x2')],'allowNull':![],'unique':_0xf050('0x3')},'mode':{'type':Sequelize[_0xf050('0x4')](_0xf050('0x5'),_0xf050('0x6'),_0xf050('0x7'),'quietmp3nb',_0xf050('0x8'),_0xf050('0x9')),'allowNull':!![],'defaultValue':_0xf050('0x6')},'directory':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf050('0x2')],'allowNull':!![]},'stamp':{'type':_0xf050('0xa')},'defaultEntry':{'type':Sequelize[_0xf050('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 8ab687d..918216c 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 _0x24cd=['index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','options','find','body','create','sequelize','transaction','mode','root','server/files/moh','files','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','join','rmdirSync','Sequelize','message','addSound','Sound','findOne','converted_format','createdAt','format','%s.%s','save_name','removeSound','id2','unlinkSync','ValidationError','getSounds','hasOwnProperty','nolimit','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','error','stack','name','send'];(function(_0x1f9744,_0x54a947){var _0x5aba67=function(_0x14dade){while(--_0x14dade){_0x1f9744['push'](_0x1f9744['shift']());}};_0x5aba67(++_0x54a947);}(_0x24cd,0x123));var _0xd24c=function(_0x2f77e4,_0x246dd3){_0x2f77e4=_0x2f77e4-0x0;var _0x486d91=_0x24cd[_0x2f77e4];return _0x486d91;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require(_0xd24c('0x2'));var jsonpatch=require(_0xd24c('0x3'));var rp=require(_0xd24c('0x4'));var moment=require(_0xd24c('0x5'));var BPromise=require(_0xd24c('0x6'));var Mustache=require(_0xd24c('0x7'));var util=require(_0xd24c('0x8'));var path=require(_0xd24c('0x9'));var sox=require(_0xd24c('0xa'));var csv=require(_0xd24c('0xb'));var ejs=require(_0xd24c('0xc'));var fs=require('fs');var fs_extra=require(_0xd24c('0xd'));var _=require(_0xd24c('0xe'));var squel=require(_0xd24c('0xf'));var crypto=require('crypto');var jsforce=require(_0xd24c('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd24c('0xb'));var querystring=require(_0xd24c('0x11'));var Papa=require('papaparse');var Redis=require(_0xd24c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd24c('0x13'));var as=require(_0xd24c('0x14'));var hardwareService=require(_0xd24c('0x15'));var logger=require(_0xd24c('0x16'))(_0xd24c('0x17'));var utils=require(_0xd24c('0x18'));var config=require(_0xd24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd24c('0x1a'))['db'];function respondWithStatusCode(_0x4e41c9,_0x1f330f){_0x1f330f=_0x1f330f||0xcc;return function(_0x5dd35d){if(_0x5dd35d){return _0x4e41c9[_0xd24c('0x1b')](_0x1f330f);}return _0x4e41c9[_0xd24c('0x1c')](_0x1f330f)[_0xd24c('0x1d')]();};}function respondWithResult(_0x12c23a,_0x1e52e8){_0x1e52e8=_0x1e52e8||0xc8;return function(_0x485aba){if(_0x485aba){return _0x12c23a[_0xd24c('0x1c')](_0x1e52e8)[_0xd24c('0x1e')](_0x485aba);}};}function respondWithFilteredResult(_0x558aed,_0x1f461f){return function(_0x5ab138){if(_0x5ab138){var _0xcef6cb=typeof _0x1f461f[_0xd24c('0x1f')]==='undefined'&&typeof _0x1f461f[_0xd24c('0x20')]==='undefined';var _0x4beeba=_0x5ab138[_0xd24c('0x21')];var _0x1d6783=_0xcef6cb?0x0:_0x1f461f[_0xd24c('0x1f')];var _0x1c5f4a=_0xcef6cb?_0x5ab138[_0xd24c('0x21')]:_0x1f461f[_0xd24c('0x1f')]+_0x1f461f['limit'];var _0xd383c;if(_0x1c5f4a>=_0x4beeba){_0x1c5f4a=_0x4beeba;_0xd383c=0xc8;}else{_0xd383c=0xce;}_0x558aed['status'](_0xd383c);return _0x558aed['set'](_0xd24c('0x22'),_0x1d6783+'-'+_0x1c5f4a+'/'+_0x4beeba)[_0xd24c('0x1e')](_0x5ab138);}return null;};}function patchUpdates(_0x16fe50){return function(_0x146cab){try{jsonpatch[_0xd24c('0x23')](_0x146cab,_0x16fe50,!![]);}catch(_0x2c40a7){return BPromise[_0xd24c('0x24')](_0x2c40a7);}return _0x146cab[_0xd24c('0x25')]();};}function saveUpdates(_0x1b42b1,_0x46c44b){return function(_0x119170){if(_0x119170){return _0x119170[_0xd24c('0x26')](_0x1b42b1)['then'](function(_0x9e15b8){return _0x9e15b8;});}return null;};}function removeEntity(_0x38c789,_0x38cc2f){return function(_0xdf81c7){if(_0xdf81c7){return _0xdf81c7[_0xd24c('0x27')]()['then'](function(){var _0x389e41=_0xdf81c7[_0xd24c('0x28')]({'plain':!![]});var _0x379075=_0xd24c('0x29');return db[_0xd24c('0x2a')]['destroy']({'where':{'type':_0x379075,'resourceId':_0x389e41['id']}})[_0xd24c('0x2b')](function(){return _0xdf81c7;});})[_0xd24c('0x2b')](function(){_0x38c789[_0xd24c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aba80,_0x595650){return function(_0x1435aa){if(!_0x1435aa){_0x2aba80[_0xd24c('0x1b')](0x194);}return _0x1435aa;};}function handleError(_0x2ad207,_0x1eae57){_0x1eae57=_0x1eae57||0x1f4;return function(_0x1d9ea3){logger[_0xd24c('0x2c')](_0x1d9ea3[_0xd24c('0x2d')]);if(_0x1d9ea3['name']){delete _0x1d9ea3[_0xd24c('0x2e')];}_0x2ad207[_0xd24c('0x1c')](_0x1eae57)[_0xd24c('0x2f')](_0x1d9ea3);};}exports[_0xd24c('0x30')]=function(_0x1f2793,_0x2376f3){var _0x5526c2={},_0x14f99f={},_0x458433={'count':0x0,'rows':[]};var _0x543a78=_[_0xd24c('0x31')](db[_0xd24c('0x32')][_0xd24c('0x33')],function(_0x4e2ef9){return{'name':_0x4e2ef9['fieldName'],'type':_0x4e2ef9[_0xd24c('0x34')][_0xd24c('0x35')]};});_0x14f99f[_0xd24c('0x36')]=_[_0xd24c('0x31')](_0x543a78,_0xd24c('0x2e'));_0x14f99f[_0xd24c('0x37')]=_[_0xd24c('0x38')](_0x1f2793['query']);_0x14f99f[_0xd24c('0x39')]=_[_0xd24c('0x3a')](_0x14f99f[_0xd24c('0x36')],_0x14f99f['query']);_0x5526c2[_0xd24c('0x3b')]=_[_0xd24c('0x3a')](_0x14f99f[_0xd24c('0x36')],qs[_0xd24c('0x3c')](_0x1f2793[_0xd24c('0x37')][_0xd24c('0x3c')]));_0x5526c2['attributes']=_0x5526c2[_0xd24c('0x3b')][_0xd24c('0x3d')]?_0x5526c2[_0xd24c('0x3b')]:_0x14f99f[_0xd24c('0x36')];if(!_0x1f2793[_0xd24c('0x37')]['hasOwnProperty']('nolimit')){_0x5526c2['limit']=qs[_0xd24c('0x20')](_0x1f2793['query'][_0xd24c('0x20')]);_0x5526c2[_0xd24c('0x1f')]=qs[_0xd24c('0x1f')](_0x1f2793[_0xd24c('0x37')][_0xd24c('0x1f')]);}_0x5526c2[_0xd24c('0x3e')]=qs[_0xd24c('0x3f')](_0x1f2793[_0xd24c('0x37')]['sort']);delete _0x1f2793[_0xd24c('0x37')][_0xd24c('0x3f')];_0x5526c2['where']=qs[_0xd24c('0x39')](_[_0xd24c('0x40')](_0x1f2793['query'],_0x14f99f['filters']),_0x543a78);if(_0x1f2793[_0xd24c('0x37')][_0xd24c('0x41')]){_0x5526c2[_0xd24c('0x42')]=_[_0xd24c('0x43')](_0x5526c2['where'],{'$or':_[_0xd24c('0x31')](_0x543a78,function(_0x9f6931){if(_0x9f6931[_0xd24c('0x34')]!==_0xd24c('0x44')){var _0x29f9f2={};_0x29f9f2[_0x9f6931[_0xd24c('0x2e')]]={'$like':'%'+_0x1f2793['query'][_0xd24c('0x41')]+'%'};return _0x29f9f2;}})});}_0x5526c2=_[_0xd24c('0x43')]({},_0x5526c2,_0x1f2793['options']);var _0x382c20={'where':_0x5526c2['where']};return db[_0xd24c('0x32')][_0xd24c('0x21')](_0x382c20)[_0xd24c('0x2b')](function(_0x1620c4){_0x458433[_0xd24c('0x21')]=_0x1620c4;if(_0x1f2793[_0xd24c('0x37')]['includeAll']){_0x5526c2[_0xd24c('0x45')]=[{'all':!![]}];}return db[_0xd24c('0x32')][_0xd24c('0x46')](_0x5526c2);})[_0xd24c('0x2b')](function(_0xa533a8){_0x458433[_0xd24c('0x47')]=_0xa533a8;return _0x458433;})['then'](respondWithFilteredResult(_0x2376f3,_0x5526c2))[_0xd24c('0x48')](handleError(_0x2376f3,null));};exports[_0xd24c('0x49')]=function(_0x48afd5,_0x5b3764){var _0xee0f0f={'raw':![],'where':{'id':_0x48afd5['params']['id']}},_0x28871c={};_0x28871c['model']=_[_0xd24c('0x38')](db[_0xd24c('0x32')]['rawAttributes']);_0x28871c[_0xd24c('0x37')]=_[_0xd24c('0x38')](_0x48afd5[_0xd24c('0x37')]);_0x28871c['filters']=_[_0xd24c('0x3a')](_0x28871c[_0xd24c('0x36')],_0x28871c[_0xd24c('0x37')]);_0xee0f0f[_0xd24c('0x3b')]=_[_0xd24c('0x3a')](_0x28871c[_0xd24c('0x36')],qs[_0xd24c('0x3c')](_0x48afd5['query'][_0xd24c('0x3c')]));_0xee0f0f['attributes']=_0xee0f0f[_0xd24c('0x3b')]['length']?_0xee0f0f['attributes']:_0x28871c['model'];if(_0x48afd5[_0xd24c('0x37')]['includeAll']){_0xee0f0f[_0xd24c('0x45')]=[{'all':!![]}];}_0xee0f0f=_[_0xd24c('0x43')]({},_0xee0f0f,_0x48afd5[_0xd24c('0x4a')]);return db[_0xd24c('0x32')][_0xd24c('0x4b')](_0xee0f0f)['then'](handleEntityNotFound(_0x5b3764,null))[_0xd24c('0x2b')](respondWithResult(_0x5b3764,null))['catch'](handleError(_0x5b3764,null));};exports[_0xd24c('0x26')]=function(_0x36c13a,_0x459062){if(_0x36c13a[_0xd24c('0x4c')]['id']){delete _0x36c13a['body']['id'];}return db[_0xd24c('0x32')][_0xd24c('0x4b')]({'where':{'id':_0x36c13a['params']['id']}})['then'](handleEntityNotFound(_0x459062,null))['then'](saveUpdates(_0x36c13a[_0xd24c('0x4c')],null))[_0xd24c('0x2b')](respondWithResult(_0x459062,null))[_0xd24c('0x48')](handleError(_0x459062,null));};exports[_0xd24c('0x4d')]=function(_0x4b370c,_0x1f355c,_0x210cfd){return db[_0xd24c('0x4e')][_0xd24c('0x4f')](function(_0x3c1a2c){if(_0x4b370c['body'][_0xd24c('0x50')]==='files'){_0x4b370c[_0xd24c('0x4c')]['directory']=path['join'](config[_0xd24c('0x51')],_0xd24c('0x52'),_0x4b370c[_0xd24c('0x4c')]['name']);}return db['VoiceMusicOnHold'][_0xd24c('0x4d')](_0x4b370c[_0xd24c('0x4c')],{'transaction':_0x3c1a2c})[_0xd24c('0x2b')](function(_0xd79ed6){if(_0x4b370c[_0xd24c('0x4c')][_0xd24c('0x50')]===_0xd24c('0x53')){fs[_0xd24c('0x54')](_0xd79ed6[_0xd24c('0x55')],parseInt(_0xd24c('0x56'),0x8));}var _0x481c9b=_0x4b370c['user'][_0xd24c('0x28')]({'plain':!![]});if(!_0x481c9b)throw new Error(_0xd24c('0x57'));if(_0x481c9b['role']===_0xd24c('0x58')){var _0x57829d=_0xd79ed6[_0xd24c('0x28')]({'plain':!![]});return db[_0xd24c('0x59')][_0xd24c('0x4b')]({'where':{'name':_0xd24c('0x29'),'userProfileId':_0x481c9b['userProfileId']},'raw':!![]})[_0xd24c('0x2b')](function(_0x16945e){if(_0x16945e&&_0x16945e[_0xd24c('0x5a')]===0x0){return db[_0xd24c('0x2a')]['create']({'name':_0x57829d[_0xd24c('0x2e')],'resourceId':_0x57829d['id'],'type':_0x16945e[_0xd24c('0x2e')],'sectionId':_0x16945e['id']},{})[_0xd24c('0x2b')](function(){return _0xd79ed6;});}else{return _0xd79ed6;}})[_0xd24c('0x48')](function(_0x2d3488){logger[_0xd24c('0x2c')](_0xd24c('0x5b'),_0x2d3488);});}return _0xd79ed6;});})[_0xd24c('0x2b')](respondWithResult(_0x1f355c,0xc9))[_0xd24c('0x48')](handleError(_0x1f355c,null));};exports[_0xd24c('0x27')]=function(_0x539697,_0x442937,_0x400551){var _0x2ffd93;return db[_0xd24c('0x32')][_0xd24c('0x4b')]({'where':{'id':_0x539697[_0xd24c('0x5c')]['id']}})[_0xd24c('0x2b')](function(_0x230090){if(_0x230090){return db['sequelize'][_0xd24c('0x4f')](function(_0x4bf9b5){return _0x230090[_0xd24c('0x27')]({'transaction':_0x4bf9b5,'raw':!![]})[_0xd24c('0x2b')](function(_0x1bc999){if(_0x1bc999['directory']){fs[_0xd24c('0x5d')](_0x1bc999[_0xd24c('0x55')])['forEach'](function(_0x4e0653){fs['unlinkSync'](path[_0xd24c('0x5e')](_0x1bc999[_0xd24c('0x55')],_0x4e0653));});fs[_0xd24c('0x5f')](_0x1bc999[_0xd24c('0x55')]);}return _0x1bc999;});})[_0xd24c('0x48')](function(_0x78dddd){throw new db[(_0xd24c('0x60'))]['ValidationError'](_0x78dddd[_0xd24c('0x61')]);});}})[_0xd24c('0x2b')](handleEntityNotFound(_0x442937,null))[_0xd24c('0x2b')](removeEntity(_0x442937,null))[_0xd24c('0x48')](handleError(_0x442937,null));};exports[_0xd24c('0x62')]=function(_0x12d59b,_0x3028d5,_0x36a9b9){return db[_0xd24c('0x4e')][_0xd24c('0x4f')](function(_0x430226){var _0xf0d573;return db['VoiceMusicOnHold'][_0xd24c('0x4b')]({'where':{'id':_0x12d59b['params']['id']}})[_0xd24c('0x2b')](function(_0x2a2498){if(_0x2a2498){_0xf0d573=_0x2a2498;return _0x2a2498[_0xd24c('0x62')](_0x12d59b[_0xd24c('0x4c')]['id'],{'transaction':_0x430226});}})[_0xd24c('0x2b')](function(_0x26fb49){if(_0x26fb49){return db[_0xd24c('0x63')][_0xd24c('0x64')]({'where':{'id':_0x12d59b[_0xd24c('0x4c')]['id']},'attributes':['id',_0xd24c('0x2e'),'save_name',_0xd24c('0x65'),_0xd24c('0x66')],'raw':!![]});}})[_0xd24c('0x2b')](function(_0x306a69){if(_0x306a69){var _0x414e39=path['join'](config[_0xd24c('0x51')],'server/files/sounds/converted',util[_0xd24c('0x67')](_0xd24c('0x68'),path['basename'](_0x306a69[_0xd24c('0x69')],path['extname'](_0x306a69[_0xd24c('0x69')])),_0x306a69[_0xd24c('0x65')]));var _0x2e6900=path[_0xd24c('0x5e')](config[_0xd24c('0x51')],'server/files/moh',_0xf0d573[_0xd24c('0x2e')],util['format'](_0xd24c('0x68'),_0x306a69[_0xd24c('0x2e')],_0x306a69['converted_format']));fs['symlinkSync'](_0x414e39,_0x2e6900);return _0x306a69;}})['catch'](function(_0x5e1219){throw new db[(_0xd24c('0x60'))]['ValidationError'](_0x5e1219[_0xd24c('0x61')]);});})[_0xd24c('0x2b')](handleEntityNotFound(_0x3028d5,null))[_0xd24c('0x2b')](respondWithResult(_0x3028d5,0xc9))[_0xd24c('0x48')](handleError(_0x3028d5,null));};exports[_0xd24c('0x6a')]=function(_0x34c3ab,_0x1e27c0,_0x3108e0){return db[_0xd24c('0x4e')]['transaction'](function(_0x25200d){var _0x5c9872;return db[_0xd24c('0x32')]['findOne']({'where':{'id':_0x34c3ab['params']['id']}})[_0xd24c('0x2b')](handleEntityNotFound(_0x1e27c0,null))[_0xd24c('0x2b')](function(_0x12302a){if(_0x12302a){_0x5c9872=_0x12302a;return _0x12302a['removeSound'](_0x34c3ab[_0xd24c('0x5c')][_0xd24c('0x6b')]);}})[_0xd24c('0x2b')](function(_0xcc8805){if(_0xcc8805){return db[_0xd24c('0x63')]['findOne']({'where':{'id':_0x34c3ab[_0xd24c('0x5c')][_0xd24c('0x6b')]},'attributes':['id',_0xd24c('0x2e'),_0xd24c('0x69'),'converted_format',_0xd24c('0x66')],'raw':!![]});}})[_0xd24c('0x2b')](function(_0xc01293){if(_0xc01293){fs[_0xd24c('0x6c')](path['join'](_0x5c9872[_0xd24c('0x55')],util[_0xd24c('0x67')](_0xd24c('0x68'),_0xc01293[_0xd24c('0x2e')],_0xc01293[_0xd24c('0x65')])));return _0xc01293;}})[_0xd24c('0x48')](function(_0x1a4b68){throw new db[(_0xd24c('0x60'))][(_0xd24c('0x6d'))](_0x1a4b68[_0xd24c('0x61')]);});})['then'](handleEntityNotFound(_0x1e27c0,null))['then'](respondWithStatusCode(_0x1e27c0,0xcc))[_0xd24c('0x48')](handleError(_0x1e27c0,null));};exports[_0xd24c('0x6e')]=function(_0x18d1fd,_0x4d9191,_0x4e7022){var _0x5cfc9f={};var _0x52317d={};var _0x11e5b9;var _0x43db61;return db[_0xd24c('0x32')][_0xd24c('0x64')]({'where':{'id':_0x18d1fd[_0xd24c('0x5c')]['id']}})[_0xd24c('0x2b')](handleEntityNotFound(_0x4d9191,null))[_0xd24c('0x2b')](function(_0x339d27){if(_0x339d27){_0x11e5b9=_0x339d27;_0x52317d['model']=_[_0xd24c('0x38')](db['Sound'][_0xd24c('0x33')]);_0x52317d['query']=_[_0xd24c('0x38')](_0x18d1fd[_0xd24c('0x37')]);_0x52317d[_0xd24c('0x39')]=_[_0xd24c('0x3a')](_0x52317d[_0xd24c('0x36')],_0x52317d['query']);_0x5cfc9f['attributes']=_['intersection'](_0x52317d[_0xd24c('0x36')],qs[_0xd24c('0x3c')](_0x18d1fd[_0xd24c('0x37')][_0xd24c('0x3c')]));_0x5cfc9f['attributes']=_0x5cfc9f['attributes'][_0xd24c('0x3d')]?_0x5cfc9f['attributes']:_0x52317d[_0xd24c('0x36')];_0x5cfc9f[_0xd24c('0x3e')]=qs[_0xd24c('0x3f')](_0x18d1fd[_0xd24c('0x37')]['sort']);_0x5cfc9f[_0xd24c('0x42')]=qs[_0xd24c('0x39')](_['pick'](_0x18d1fd['query'],_0x52317d[_0xd24c('0x39')]));if(_0x18d1fd[_0xd24c('0x37')][_0xd24c('0x41')]){_0x5cfc9f['where']=_[_0xd24c('0x43')](_0x5cfc9f[_0xd24c('0x42')],{'$or':_[_0xd24c('0x31')](_0x5cfc9f[_0xd24c('0x3b')],function(_0x3bc975){var _0xa35575={};_0xa35575[_0x3bc975]={'$like':'%'+_0x18d1fd[_0xd24c('0x37')]['filter']+'%'};return _0xa35575;})});}_0x5cfc9f=_['merge']({},_0x5cfc9f,_0x18d1fd[_0xd24c('0x4a')]);return _0x11e5b9[_0xd24c('0x6e')](_0x5cfc9f);}})[_0xd24c('0x2b')](function(_0x1aef62){if(_0x1aef62){_0x43db61=_0x1aef62['length'];if(!_0x18d1fd['query'][_0xd24c('0x6f')](_0xd24c('0x70'))){_0x5cfc9f[_0xd24c('0x20')]=qs['limit'](_0x18d1fd['query'][_0xd24c('0x20')]);_0x5cfc9f['offset']=qs['offset'](_0x18d1fd[_0xd24c('0x37')][_0xd24c('0x1f')]);}return _0x11e5b9[_0xd24c('0x6e')](_0x5cfc9f);}})[_0xd24c('0x2b')](function(_0x4b227f){if(_0x4b227f){return _0x4b227f?{'count':_0x43db61,'rows':_0x4b227f}:null;}})['then'](respondWithResult(_0x4d9191,null))['catch'](handleError(_0x4d9191,null));}; \ No newline at end of file +var _0xbcb1=['attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','length','include','find','body','create','sequelize','join','root','server/files/moh','files','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','transaction','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','Sequelize','removeSound','ValidationError','getSounds','order','pick','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','MusicOnHolds','UserProfileResource','then','end','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','query','keys','model','intersection'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbcb1,0xb2));var _0x1bcb=function(_0x174ac2,_0xa91d82){_0x174ac2=_0x174ac2-0x0;var _0x28ca76=_0xbcb1[_0x174ac2];return _0x28ca76;};'use strict';var emlformat=require(_0x1bcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bcb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1bcb('0x2'));var moment=require(_0x1bcb('0x3'));var BPromise=require(_0x1bcb('0x4'));var Mustache=require(_0x1bcb('0x5'));var util=require(_0x1bcb('0x6'));var path=require(_0x1bcb('0x7'));var sox=require(_0x1bcb('0x8'));var csv=require(_0x1bcb('0x9'));var ejs=require(_0x1bcb('0xa'));var fs=require('fs');var fs_extra=require(_0x1bcb('0xb'));var _=require(_0x1bcb('0xc'));var squel=require('squel');var crypto=require(_0x1bcb('0xd'));var jsforce=require(_0x1bcb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1bcb('0x9'));var querystring=require(_0x1bcb('0xf'));var Papa=require(_0x1bcb('0x10'));var Redis=require(_0x1bcb('0x11'));var authService=require(_0x1bcb('0x12'));var qs=require(_0x1bcb('0x13'));var as=require(_0x1bcb('0x14'));var hardwareService=require(_0x1bcb('0x15'));var logger=require(_0x1bcb('0x16'))(_0x1bcb('0x17'));var utils=require(_0x1bcb('0x18'));var config=require(_0x1bcb('0x19'));var licenseUtil=require(_0x1bcb('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27155d,_0x5a02b2){_0x5a02b2=_0x5a02b2||0xcc;return function(_0x18039e){if(_0x18039e){return _0x27155d[_0x1bcb('0x1b')](_0x5a02b2);}return _0x27155d[_0x1bcb('0x1c')](_0x5a02b2)['end']();};}function respondWithResult(_0x1f69f9,_0x3b5cec){_0x3b5cec=_0x3b5cec||0xc8;return function(_0x4e4f6a){if(_0x4e4f6a){return _0x1f69f9[_0x1bcb('0x1c')](_0x3b5cec)['json'](_0x4e4f6a);}};}function respondWithFilteredResult(_0x20883d,_0x355147){return function(_0xdb1b48){if(_0xdb1b48){var _0x43fbb6=typeof _0x355147[_0x1bcb('0x1d')]==='undefined'&&typeof _0x355147[_0x1bcb('0x1e')]==='undefined';var _0xf45fe6=_0xdb1b48[_0x1bcb('0x1f')];var _0x63a291=_0x43fbb6?0x0:_0x355147['offset'];var _0x9de6bf=_0x43fbb6?_0xdb1b48[_0x1bcb('0x1f')]:_0x355147[_0x1bcb('0x1d')]+_0x355147['limit'];var _0x2bac95;if(_0x9de6bf>=_0xf45fe6){_0x9de6bf=_0xf45fe6;_0x2bac95=0xc8;}else{_0x2bac95=0xce;}_0x20883d[_0x1bcb('0x1c')](_0x2bac95);return _0x20883d[_0x1bcb('0x20')](_0x1bcb('0x21'),_0x63a291+'-'+_0x9de6bf+'/'+_0xf45fe6)[_0x1bcb('0x22')](_0xdb1b48);}return null;};}function patchUpdates(_0x388bed){return function(_0x30a12f){try{jsonpatch[_0x1bcb('0x23')](_0x30a12f,_0x388bed,!![]);}catch(_0x7b58fe){return BPromise[_0x1bcb('0x24')](_0x7b58fe);}return _0x30a12f[_0x1bcb('0x25')]();};}function saveUpdates(_0x1d7309,_0xfd5fd1){return function(_0x140818){if(_0x140818){return _0x140818[_0x1bcb('0x26')](_0x1d7309)['then'](function(_0x5bc3ca){return _0x5bc3ca;});}return null;};}function removeEntity(_0x302632,_0x1d23dd){return function(_0x1497b6){if(_0x1497b6){return _0x1497b6[_0x1bcb('0x27')]()['then'](function(){var _0x4c9a55=_0x1497b6['get']({'plain':!![]});var _0x56a255=_0x1bcb('0x28');return db[_0x1bcb('0x29')][_0x1bcb('0x27')]({'where':{'type':_0x56a255,'resourceId':_0x4c9a55['id']}})[_0x1bcb('0x2a')](function(){return _0x1497b6;});})[_0x1bcb('0x2a')](function(){_0x302632[_0x1bcb('0x1c')](0xcc)[_0x1bcb('0x2b')]();});}};}function handleEntityNotFound(_0x51e307,_0x1aca9e){return function(_0x313664){if(!_0x313664){_0x51e307[_0x1bcb('0x1b')](0x194);}return _0x313664;};}function handleError(_0x38e5e2,_0x5e2cf4){_0x5e2cf4=_0x5e2cf4||0x1f4;return function(_0x2800c4){logger['error'](_0x2800c4[_0x1bcb('0x2c')]);if(_0x2800c4[_0x1bcb('0x2d')]){delete _0x2800c4[_0x1bcb('0x2d')];}_0x38e5e2[_0x1bcb('0x1c')](_0x5e2cf4)[_0x1bcb('0x2e')](_0x2800c4);};}exports['index']=function(_0x21db40,_0x567f9f){var _0x15f0c2={},_0x276884={},_0x551240={'count':0x0,'rows':[]};var _0x6a39b2=_[_0x1bcb('0x2f')](db[_0x1bcb('0x30')][_0x1bcb('0x31')],function(_0x56c166){return{'name':_0x56c166[_0x1bcb('0x32')],'type':_0x56c166[_0x1bcb('0x33')]['key']};});_0x276884['model']=_[_0x1bcb('0x2f')](_0x6a39b2,'name');_0x276884[_0x1bcb('0x34')]=_[_0x1bcb('0x35')](_0x21db40[_0x1bcb('0x34')]);_0x276884['filters']=_['intersection'](_0x276884[_0x1bcb('0x36')],_0x276884[_0x1bcb('0x34')]);_0x15f0c2['attributes']=_[_0x1bcb('0x37')](_0x276884[_0x1bcb('0x36')],qs['fields'](_0x21db40[_0x1bcb('0x34')]['fields']));_0x15f0c2[_0x1bcb('0x38')]=_0x15f0c2['attributes']['length']?_0x15f0c2['attributes']:_0x276884[_0x1bcb('0x36')];if(!_0x21db40['query'][_0x1bcb('0x39')]('nolimit')){_0x15f0c2['limit']=qs[_0x1bcb('0x1e')](_0x21db40[_0x1bcb('0x34')][_0x1bcb('0x1e')]);_0x15f0c2[_0x1bcb('0x1d')]=qs[_0x1bcb('0x1d')](_0x21db40['query'][_0x1bcb('0x1d')]);}_0x15f0c2['order']=qs[_0x1bcb('0x3a')](_0x21db40['query'][_0x1bcb('0x3a')]);delete _0x21db40['query'][_0x1bcb('0x3a')];_0x15f0c2[_0x1bcb('0x3b')]=qs[_0x1bcb('0x3c')](_['pick'](_0x21db40[_0x1bcb('0x34')],_0x276884['filters']),_0x6a39b2);if(_0x21db40[_0x1bcb('0x34')][_0x1bcb('0x3d')]){_0x15f0c2[_0x1bcb('0x3b')]=_[_0x1bcb('0x3e')](_0x15f0c2['where'],{'$or':_[_0x1bcb('0x2f')](_0x6a39b2,function(_0x10f039){if(_0x10f039[_0x1bcb('0x33')]!==_0x1bcb('0x3f')){var _0xcb6dac={};_0xcb6dac[_0x10f039[_0x1bcb('0x2d')]]={'$like':'%'+_0x21db40['query'][_0x1bcb('0x3d')]+'%'};return _0xcb6dac;}})});}_0x15f0c2=_[_0x1bcb('0x3e')]({},_0x15f0c2,_0x21db40[_0x1bcb('0x40')]);var _0x3933f2={'where':_0x15f0c2[_0x1bcb('0x3b')]};return db[_0x1bcb('0x30')][_0x1bcb('0x1f')](_0x3933f2)['then'](function(_0x332bf){_0x551240[_0x1bcb('0x1f')]=_0x332bf;if(_0x21db40[_0x1bcb('0x34')][_0x1bcb('0x41')]){_0x15f0c2['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1bcb('0x42')](_0x15f0c2);})[_0x1bcb('0x2a')](function(_0x1aeb8b){_0x551240[_0x1bcb('0x43')]=_0x1aeb8b;return _0x551240;})[_0x1bcb('0x2a')](respondWithFilteredResult(_0x567f9f,_0x15f0c2))[_0x1bcb('0x44')](handleError(_0x567f9f,null));};exports[_0x1bcb('0x45')]=function(_0x56632a,_0x40b6f8){var _0x262dec={'raw':![],'where':{'id':_0x56632a[_0x1bcb('0x46')]['id']}},_0x32827b={};_0x32827b[_0x1bcb('0x36')]=_[_0x1bcb('0x35')](db['VoiceMusicOnHold'][_0x1bcb('0x31')]);_0x32827b[_0x1bcb('0x34')]=_[_0x1bcb('0x35')](_0x56632a[_0x1bcb('0x34')]);_0x32827b[_0x1bcb('0x3c')]=_[_0x1bcb('0x37')](_0x32827b[_0x1bcb('0x36')],_0x32827b[_0x1bcb('0x34')]);_0x262dec[_0x1bcb('0x38')]=_[_0x1bcb('0x37')](_0x32827b[_0x1bcb('0x36')],qs['fields'](_0x56632a['query'][_0x1bcb('0x47')]));_0x262dec['attributes']=_0x262dec[_0x1bcb('0x38')][_0x1bcb('0x48')]?_0x262dec[_0x1bcb('0x38')]:_0x32827b['model'];if(_0x56632a['query'][_0x1bcb('0x41')]){_0x262dec[_0x1bcb('0x49')]=[{'all':!![]}];}_0x262dec=_[_0x1bcb('0x3e')]({},_0x262dec,_0x56632a[_0x1bcb('0x40')]);return db[_0x1bcb('0x30')][_0x1bcb('0x4a')](_0x262dec)[_0x1bcb('0x2a')](handleEntityNotFound(_0x40b6f8,null))[_0x1bcb('0x2a')](respondWithResult(_0x40b6f8,null))[_0x1bcb('0x44')](handleError(_0x40b6f8,null));};exports['update']=function(_0x325c33,_0x5ddda7){if(_0x325c33['body']['id']){delete _0x325c33[_0x1bcb('0x4b')]['id'];}return db[_0x1bcb('0x30')]['find']({'where':{'id':_0x325c33[_0x1bcb('0x46')]['id']}})[_0x1bcb('0x2a')](handleEntityNotFound(_0x5ddda7,null))[_0x1bcb('0x2a')](saveUpdates(_0x325c33[_0x1bcb('0x4b')],null))[_0x1bcb('0x2a')](respondWithResult(_0x5ddda7,null))['catch'](handleError(_0x5ddda7,null));};exports[_0x1bcb('0x4c')]=function(_0x185bc0,_0x4ce4d9,_0x45c460){return db[_0x1bcb('0x4d')]['transaction'](function(_0x37c859){if(_0x185bc0[_0x1bcb('0x4b')]['mode']==='files'){_0x185bc0['body']['directory']=path[_0x1bcb('0x4e')](config[_0x1bcb('0x4f')],_0x1bcb('0x50'),_0x185bc0[_0x1bcb('0x4b')][_0x1bcb('0x2d')]);}return db['VoiceMusicOnHold'][_0x1bcb('0x4c')](_0x185bc0[_0x1bcb('0x4b')],{'transaction':_0x37c859})[_0x1bcb('0x2a')](function(_0xd51972){if(_0x185bc0[_0x1bcb('0x4b')]['mode']===_0x1bcb('0x51')){fs['mkdirSync'](_0xd51972[_0x1bcb('0x52')],parseInt(_0x1bcb('0x53'),0x8));}var _0x23d468=_0x185bc0[_0x1bcb('0x54')][_0x1bcb('0x55')]({'plain':!![]});if(!_0x23d468)throw new Error(_0x1bcb('0x56'));if(_0x23d468[_0x1bcb('0x57')]===_0x1bcb('0x54')){var _0x532a43=_0xd51972['get']({'plain':!![]});return db[_0x1bcb('0x58')][_0x1bcb('0x4a')]({'where':{'name':_0x1bcb('0x28'),'userProfileId':_0x23d468[_0x1bcb('0x59')]},'raw':!![]})['then'](function(_0x732749){if(_0x732749&&_0x732749[_0x1bcb('0x5a')]===0x0){return db['UserProfileResource'][_0x1bcb('0x4c')]({'name':_0x532a43[_0x1bcb('0x2d')],'resourceId':_0x532a43['id'],'type':_0x732749[_0x1bcb('0x2d')],'sectionId':_0x732749['id']},{})['then'](function(){return _0xd51972;});}else{return _0xd51972;}})[_0x1bcb('0x44')](function(_0x88b4b3){logger[_0x1bcb('0x5b')](_0x1bcb('0x5c'),_0x88b4b3);});}return _0xd51972;});})[_0x1bcb('0x2a')](respondWithResult(_0x4ce4d9,0xc9))[_0x1bcb('0x44')](handleError(_0x4ce4d9,null));};exports[_0x1bcb('0x27')]=function(_0x683380,_0x2ef4f1,_0x4cb86b){var _0xb2cb76;return db[_0x1bcb('0x30')][_0x1bcb('0x4a')]({'where':{'id':_0x683380[_0x1bcb('0x46')]['id']}})[_0x1bcb('0x2a')](function(_0x5d737b){if(_0x5d737b){return db[_0x1bcb('0x4d')]['transaction'](function(_0xf977ac){return _0x5d737b['destroy']({'transaction':_0xf977ac,'raw':!![]})[_0x1bcb('0x2a')](function(_0x105ee7){if(_0x105ee7[_0x1bcb('0x52')]){fs[_0x1bcb('0x5d')](_0x105ee7['directory'])[_0x1bcb('0x5e')](function(_0x303621){fs[_0x1bcb('0x5f')](path[_0x1bcb('0x4e')](_0x105ee7['directory'],_0x303621));});fs[_0x1bcb('0x60')](_0x105ee7[_0x1bcb('0x52')]);}return _0x105ee7;});})[_0x1bcb('0x44')](function(_0x56002a){throw new db['Sequelize']['ValidationError'](_0x56002a[_0x1bcb('0x61')]);});}})[_0x1bcb('0x2a')](handleEntityNotFound(_0x2ef4f1,null))['then'](removeEntity(_0x2ef4f1,null))['catch'](handleError(_0x2ef4f1,null));};exports[_0x1bcb('0x62')]=function(_0x473809,_0xa8d6fe,_0x562e9d){return db['sequelize'][_0x1bcb('0x63')](function(_0x579110){var _0x13e3ba;return db[_0x1bcb('0x30')][_0x1bcb('0x4a')]({'where':{'id':_0x473809[_0x1bcb('0x46')]['id']}})['then'](function(_0x21f181){if(_0x21f181){_0x13e3ba=_0x21f181;return _0x21f181[_0x1bcb('0x62')](_0x473809[_0x1bcb('0x4b')]['id'],{'transaction':_0x579110});}})[_0x1bcb('0x2a')](function(_0x5add3a){if(_0x5add3a){return db[_0x1bcb('0x64')][_0x1bcb('0x65')]({'where':{'id':_0x473809['body']['id']},'attributes':['id','name','save_name',_0x1bcb('0x66'),_0x1bcb('0x67')],'raw':!![]});}})[_0x1bcb('0x2a')](function(_0x3c5cb7){if(_0x3c5cb7){var _0x36cfdf=path[_0x1bcb('0x4e')](config[_0x1bcb('0x4f')],'server/files/sounds/converted',util[_0x1bcb('0x68')](_0x1bcb('0x69'),path[_0x1bcb('0x6a')](_0x3c5cb7[_0x1bcb('0x6b')],path[_0x1bcb('0x6c')](_0x3c5cb7['save_name'])),_0x3c5cb7[_0x1bcb('0x66')]));var _0x430091=path[_0x1bcb('0x4e')](config[_0x1bcb('0x4f')],'server/files/moh',_0x13e3ba[_0x1bcb('0x2d')],util[_0x1bcb('0x68')](_0x1bcb('0x69'),_0x3c5cb7[_0x1bcb('0x2d')],_0x3c5cb7[_0x1bcb('0x66')]));fs[_0x1bcb('0x6d')](_0x36cfdf,_0x430091);return _0x3c5cb7;}})[_0x1bcb('0x44')](function(_0x2e0837){throw new db[(_0x1bcb('0x6e'))]['ValidationError'](_0x2e0837['message']);});})['then'](handleEntityNotFound(_0xa8d6fe,null))[_0x1bcb('0x2a')](respondWithResult(_0xa8d6fe,0xc9))[_0x1bcb('0x44')](handleError(_0xa8d6fe,null));};exports[_0x1bcb('0x6f')]=function(_0x3cd1db,_0x4893b9,_0x128651){return db['sequelize']['transaction'](function(_0x378435){var _0xccf76e;return db[_0x1bcb('0x30')][_0x1bcb('0x65')]({'where':{'id':_0x3cd1db['params']['id']}})[_0x1bcb('0x2a')](handleEntityNotFound(_0x4893b9,null))[_0x1bcb('0x2a')](function(_0x425627){if(_0x425627){_0xccf76e=_0x425627;return _0x425627[_0x1bcb('0x6f')](_0x3cd1db[_0x1bcb('0x46')]['id2']);}})[_0x1bcb('0x2a')](function(_0x544d73){if(_0x544d73){return db[_0x1bcb('0x64')]['findOne']({'where':{'id':_0x3cd1db[_0x1bcb('0x46')]['id2']},'attributes':['id',_0x1bcb('0x2d'),_0x1bcb('0x6b'),_0x1bcb('0x66'),_0x1bcb('0x67')],'raw':!![]});}})[_0x1bcb('0x2a')](function(_0x1cd046){if(_0x1cd046){fs['unlinkSync'](path['join'](_0xccf76e[_0x1bcb('0x52')],util[_0x1bcb('0x68')](_0x1bcb('0x69'),_0x1cd046[_0x1bcb('0x2d')],_0x1cd046[_0x1bcb('0x66')])));return _0x1cd046;}})['catch'](function(_0x27b749){throw new db[(_0x1bcb('0x6e'))][(_0x1bcb('0x70'))](_0x27b749['message']);});})[_0x1bcb('0x2a')](handleEntityNotFound(_0x4893b9,null))[_0x1bcb('0x2a')](respondWithStatusCode(_0x4893b9,0xcc))[_0x1bcb('0x44')](handleError(_0x4893b9,null));};exports[_0x1bcb('0x71')]=function(_0x214f9e,_0x515782,_0x3e9242){var _0xb4dce3={};var _0x2ebe43={};var _0xfb8233;var _0xaa81af;return db[_0x1bcb('0x30')][_0x1bcb('0x65')]({'where':{'id':_0x214f9e['params']['id']}})['then'](handleEntityNotFound(_0x515782,null))['then'](function(_0x10fc41){if(_0x10fc41){_0xfb8233=_0x10fc41;_0x2ebe43[_0x1bcb('0x36')]=_[_0x1bcb('0x35')](db[_0x1bcb('0x64')][_0x1bcb('0x31')]);_0x2ebe43[_0x1bcb('0x34')]=_[_0x1bcb('0x35')](_0x214f9e[_0x1bcb('0x34')]);_0x2ebe43[_0x1bcb('0x3c')]=_[_0x1bcb('0x37')](_0x2ebe43[_0x1bcb('0x36')],_0x2ebe43[_0x1bcb('0x34')]);_0xb4dce3[_0x1bcb('0x38')]=_[_0x1bcb('0x37')](_0x2ebe43[_0x1bcb('0x36')],qs[_0x1bcb('0x47')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x47')]));_0xb4dce3[_0x1bcb('0x38')]=_0xb4dce3[_0x1bcb('0x38')][_0x1bcb('0x48')]?_0xb4dce3[_0x1bcb('0x38')]:_0x2ebe43['model'];_0xb4dce3[_0x1bcb('0x72')]=qs[_0x1bcb('0x3a')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x3a')]);_0xb4dce3[_0x1bcb('0x3b')]=qs[_0x1bcb('0x3c')](_[_0x1bcb('0x73')](_0x214f9e[_0x1bcb('0x34')],_0x2ebe43[_0x1bcb('0x3c')]));if(_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x3d')]){_0xb4dce3[_0x1bcb('0x3b')]=_['merge'](_0xb4dce3['where'],{'$or':_['map'](_0xb4dce3[_0x1bcb('0x38')],function(_0x157c83){var _0x154897={};_0x154897[_0x157c83]={'$like':'%'+_0x214f9e['query'][_0x1bcb('0x3d')]+'%'};return _0x154897;})});}_0xb4dce3=_[_0x1bcb('0x3e')]({},_0xb4dce3,_0x214f9e[_0x1bcb('0x40')]);return _0xfb8233[_0x1bcb('0x71')](_0xb4dce3);}})[_0x1bcb('0x2a')](function(_0x5a2175){if(_0x5a2175){_0xaa81af=_0x5a2175['length'];if(!_0x214f9e[_0x1bcb('0x34')]['hasOwnProperty'](_0x1bcb('0x74'))){_0xb4dce3['limit']=qs[_0x1bcb('0x1e')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x1e')]);_0xb4dce3[_0x1bcb('0x1d')]=qs[_0x1bcb('0x1d')](_0x214f9e[_0x1bcb('0x34')][_0x1bcb('0x1d')]);}return _0xfb8233[_0x1bcb('0x71')](_0xb4dce3);}})[_0x1bcb('0x2a')](function(_0x304f9b){if(_0x304f9b){return _0x304f9b?{'count':_0xaa81af,'rows':_0x304f9b}:null;}})[_0x1bcb('0x2a')](respondWithResult(_0x515782,null))['catch'](handleError(_0x515782,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 309a450..7f1f721 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 _0x746c=['util','api','moment','bluebird','path','rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash'];(function(_0x1059f3,_0x290223){var _0x378744=function(_0x3cb599){while(--_0x3cb599){_0x1059f3['push'](_0x1059f3['shift']());}};_0x378744(++_0x290223);}(_0x746c,0x153));var _0xc746=function(_0x3640e2,_0x562103){_0x3640e2=_0x3640e2-0x0;var _0x277415=_0x746c[_0x3640e2];return _0x277415;};'use strict';var _=require(_0xc746('0x0'));var util=require(_0xc746('0x1'));var logger=require('../../config/logger')(_0xc746('0x2'));var moment=require(_0xc746('0x3'));var BPromise=require(_0xc746('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc746('0x5'));var rimraf=require(_0xc746('0x6'));var config=require('../../config/environment');var attributes=require(_0xc746('0x7'));module[_0xc746('0x8')]=function(_0x231a4b,_0x210fbe){return _0x231a4b['define'](_0xc746('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c0=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x12a46b,_0x33f441){var _0x53e16e=function(_0x11df48){while(--_0x11df48){_0x12a46b['push'](_0x12a46b['shift']());}};_0x53e16e(++_0x33f441);}(_0xd2c0,0x176));var _0x0d2c=function(_0x5bdca8,_0x1ec986){_0x5bdca8=_0x5bdca8-0x0;var _0x462691=_0xd2c0[_0x5bdca8];return _0x462691;};'use strict';var _=require(_0x0d2c('0x0'));var util=require(_0x0d2c('0x1'));var logger=require(_0x0d2c('0x2'))('api');var moment=require(_0x0d2c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d2c('0x4'));var rimraf=require(_0x0d2c('0x5'));var config=require(_0x0d2c('0x6'));var attributes=require(_0x0d2c('0x7'));module['exports']=function(_0x5a9f1f,_0x4393b5){return _0x5a9f1f[_0x0d2c('0x8')](_0x0d2c('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 2ff7dea..5ee9105 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x7b47af,_0x4527b3){var _0x4555b2=function(_0x3d8783){while(--_0x3d8783){_0x7b47af['push'](_0x7b47af['shift']());}};_0x4555b2(++_0x4527b3);}(_0xe706,0xa3));var _0x6e70=function(_0xea897b,_0x269096){_0xea897b=_0xea897b-0x0;var _0x8a736e=_0xe706[_0xea897b];return _0x8a736e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +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(_0x1f1b56,_0xee30aa){var _0x342eef=function(_0x123301){while(--_0x123301){_0x1f1b56['push'](_0x1f1b56['shift']());}};_0x342eef(++_0xee30aa);}(_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 b88f1ed..d35dfc5 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 _0xc978=['/:id/teams','getTeams','post','addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents'];(function(_0x5276b3,_0x25fbc1){var _0x389efa=function(_0x42617a){while(--_0x42617a){_0x5276b3['push'](_0x5276b3['shift']());}};_0x389efa(++_0x25fbc1);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router['get'](_0x8c97('0x11'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x12')]);router[_0x8c97('0xa')](_0x8c97('0x13'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x14')]);router[_0x8c97('0x15')]('/',auth[_0x8c97('0xb')](),controller['create']);router[_0x8c97('0x15')](_0x8c97('0x11'),auth['isAuthenticated'](),controller[_0x8c97('0x16')]);router[_0x8c97('0x15')]('/:id/teams',auth[_0x8c97('0xb')](),controller['addTeams']);router['put']('/:id',auth[_0x8c97('0xb')](),controller[_0x8c97('0x17')]);router[_0x8c97('0x18')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x19')]);router[_0x8c97('0x18')](_0x8c97('0x11'),auth[_0x8c97('0xb')](),controller['removeAgents']);router[_0x8c97('0x18')](_0x8c97('0x13'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x1a')]);module[_0x8c97('0x1b')]=router; \ No newline at end of file +var _0x9c5a=['create','addAgents','addTeams','put','/:id','update','delete','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','/:id/users','/:id/teams','getTeams','post'];(function(_0x2858f4,_0x5beb17){var _0x482446=function(_0x48563a){while(--_0x48563a){_0x2858f4['push'](_0x2858f4['shift']());}};_0x482446(++_0x5beb17);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x10ffd5,_0x31e6ae){_0x10ffd5=_0x10ffd5-0x0;var _0x33049b=_0x9c5a[_0x10ffd5];return _0x33049b;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voicePrefix.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['get'](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller['getAgents']);router['get'](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xf')]);router[_0xa9c5('0x10')]('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x10')](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x12')]);router['post'](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x14')](_0xa9c5('0x15'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x16')]);router[_0xa9c5('0x17')](_0xa9c5('0x15'),auth[_0xa9c5('0xb')](),controller['destroy']);router[_0xa9c5('0x17')](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller['removeAgents']);router[_0xa9c5('0x17')](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x18')]);module[_0xa9c5('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ac465c0..ac06ea5 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 _0x2fe2=['sequelize','STRING','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x2fe2,0x134));var _0x22fe=function(_0x57a012,_0x425160){_0x57a012=_0x57a012-0x0;var _0xbf4e0e=_0x2fe2[_0x57a012];return _0xbf4e0e;};'use strict';var Sequelize=require(_0x22fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x22fe('0x1')],'allowNull':![],'unique':_0x22fe('0x2')},'prefix':{'type':Sequelize[_0x22fe('0x3')],'get':function(_0x312767){return _0x22fe('0x4')+this[_0x22fe('0x5')](_0x22fe('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x22fe('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x22fe('0x6')]}}; \ No newline at end of file +var _0x6ebc=['INTEGER','sequelize','exports','STRING','name','system-','getDataValue'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x6ebc,0x78));var _0xc6eb=function(_0xce3a0b,_0x5b271b){_0xce3a0b=_0xce3a0b-0x0;var _0x1ca1b9=_0x6ebc[_0xce3a0b];return _0x1ca1b9;};'use strict';var Sequelize=require(_0xc6eb('0x0'));module[_0xc6eb('0x1')]={'name':{'type':Sequelize[_0xc6eb('0x2')],'allowNull':![],'unique':_0xc6eb('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x14e47e){return _0xc6eb('0x4')+this[_0xc6eb('0x5')](_0xc6eb('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xc6eb('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xc6eb('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9937643..20f10ab 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 _0x4213=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','name','index','map','VoicePrefix','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','Set','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','nolimit','Team','order','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','offset','undefined'];(function(_0x440c19,_0x30a454){var _0x469d40=function(_0x586cff){while(--_0x586cff){_0x440c19['push'](_0x440c19['shift']());}};_0x469d40(++_0x30a454);}(_0x4213,0x77));var _0x3421=function(_0x16ef70,_0x129c2c){_0x16ef70=_0x16ef70-0x0;var _0x32b040=_0x4213[_0x16ef70];return _0x32b040;};'use strict';var emlformat=require(_0x3421('0x0'));var rimraf=require(_0x3421('0x1'));var zipdir=require(_0x3421('0x2'));var jsonpatch=require(_0x3421('0x3'));var rp=require(_0x3421('0x4'));var moment=require(_0x3421('0x5'));var BPromise=require(_0x3421('0x6'));var Mustache=require('mustache');var util=require(_0x3421('0x7'));var path=require('path');var sox=require(_0x3421('0x8'));var csv=require(_0x3421('0x9'));var ejs=require(_0x3421('0xa'));var fs=require('fs');var fs_extra=require(_0x3421('0xb'));var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0x9'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];config['redis']=_[_0x3421('0x19')](config[_0x3421('0x1a')],{'host':_0x3421('0x1b'),'port':0x18eb});var socket=require(_0x3421('0x1c'))(new Redis(config[_0x3421('0x1a')]));require(_0x3421('0x1d'))[_0x3421('0x1e')](socket);function respondWithStatusCode(_0x59ea4a,_0xafd9e0){_0xafd9e0=_0xafd9e0||0xcc;return function(_0x4b5f43){if(_0x4b5f43){return _0x59ea4a[_0x3421('0x1f')](_0xafd9e0);}return _0x59ea4a[_0x3421('0x20')](_0xafd9e0)['end']();};}function respondWithResult(_0x1e33ab,_0x4c6f7b){_0x4c6f7b=_0x4c6f7b||0xc8;return function(_0x16bc8f){if(_0x16bc8f){return _0x1e33ab[_0x3421('0x20')](_0x4c6f7b)['json'](_0x16bc8f);}};}function respondWithFilteredResult(_0x3584d6,_0x3dec08){return function(_0x130d3c){if(_0x130d3c){var _0x104cc5=typeof _0x3dec08[_0x3421('0x21')]===_0x3421('0x22')&&typeof _0x3dec08[_0x3421('0x23')]===_0x3421('0x22');var _0x197b83=_0x130d3c[_0x3421('0x24')];var _0x538a8b=_0x104cc5?0x0:_0x3dec08['offset'];var _0x420114=_0x104cc5?_0x130d3c['count']:_0x3dec08['offset']+_0x3dec08['limit'];var _0x33155b;if(_0x420114>=_0x197b83){_0x420114=_0x197b83;_0x33155b=0xc8;}else{_0x33155b=0xce;}_0x3584d6[_0x3421('0x20')](_0x33155b);return _0x3584d6[_0x3421('0x25')](_0x3421('0x26'),_0x538a8b+'-'+_0x420114+'/'+_0x197b83)[_0x3421('0x27')](_0x130d3c);}return null;};}function patchUpdates(_0x39bed4){return function(_0x3df305){try{jsonpatch[_0x3421('0x28')](_0x3df305,_0x39bed4,!![]);}catch(_0xb9af5f){return BPromise[_0x3421('0x29')](_0xb9af5f);}return _0x3df305['save']();};}function saveUpdates(_0x57a4af,_0x494423){return function(_0x3fef90){if(_0x3fef90){return _0x3fef90[_0x3421('0x2a')](_0x57a4af)[_0x3421('0x2b')](function(_0x5bc28a){return _0x5bc28a;});}return null;};}function removeEntity(_0x506af4,_0x1b65d0){return function(_0x5b53b6){if(_0x5b53b6){return _0x5b53b6[_0x3421('0x2c')]()['then'](function(){var _0x15e73c=_0x5b53b6[_0x3421('0x2d')]({'plain':!![]});var _0x36d75f=_0x3421('0x2e');return db[_0x3421('0x2f')]['destroy']({'where':{'type':_0x36d75f,'resourceId':_0x15e73c['id']}})[_0x3421('0x2b')](function(){return _0x5b53b6;});})['then'](function(){_0x506af4['status'](0xcc)[_0x3421('0x30')]();});}};}function handleEntityNotFound(_0x5aa96b,_0x5074a2){return function(_0xb4eaf4){if(!_0xb4eaf4){_0x5aa96b['sendStatus'](0x194);}return _0xb4eaf4;};}function handleError(_0x20abc7,_0x5bcd19){_0x5bcd19=_0x5bcd19||0x1f4;return function(_0xc7f9fb){logger[_0x3421('0x31')](_0xc7f9fb['stack']);if(_0xc7f9fb[_0x3421('0x32')]){delete _0xc7f9fb[_0x3421('0x32')];}_0x20abc7[_0x3421('0x20')](_0x5bcd19)['send'](_0xc7f9fb);};}exports[_0x3421('0x33')]=function(_0x50d61b,_0x2b5af4){var _0xf0039={},_0x1045ab={},_0x841e08={'count':0x0,'rows':[]};var _0x3875c6=_[_0x3421('0x34')](db[_0x3421('0x35')][_0x3421('0x36')],function(_0x94559a){return{'name':_0x94559a[_0x3421('0x37')],'type':_0x94559a['type']['key']};});_0x1045ab[_0x3421('0x38')]=_[_0x3421('0x34')](_0x3875c6,'name');_0x1045ab[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x50d61b[_0x3421('0x39')]);_0x1045ab[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1045ab['model'],_0x1045ab[_0x3421('0x39')]);_0xf0039[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1045ab['model'],qs[_0x3421('0x3e')](_0x50d61b['query'][_0x3421('0x3e')]));_0xf0039[_0x3421('0x3d')]=_0xf0039[_0x3421('0x3d')][_0x3421('0x3f')]?_0xf0039[_0x3421('0x3d')]:_0x1045ab[_0x3421('0x38')];if(!_0x50d61b[_0x3421('0x39')]['hasOwnProperty']('nolimit')){_0xf0039['limit']=qs[_0x3421('0x23')](_0x50d61b['query']['limit']);_0xf0039[_0x3421('0x21')]=qs['offset'](_0x50d61b[_0x3421('0x39')][_0x3421('0x21')]);}_0xf0039['order']=qs[_0x3421('0x40')](_0x50d61b[_0x3421('0x39')][_0x3421('0x40')]);_0xf0039[_0x3421('0x41')]=qs['filters'](_[_0x3421('0x42')](_0x50d61b[_0x3421('0x39')],_0x1045ab[_0x3421('0x3b')]),_0x3875c6);if(_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]){_0xf0039['where']=_[_0x3421('0x44')](_0xf0039[_0x3421('0x41')],{'$or':_['map'](_0x3875c6,function(_0x15551c){if(_0x15551c['type']!=='VIRTUAL'){var _0x486ce8={};_0x486ce8[_0x15551c[_0x3421('0x32')]]={'$like':'%'+_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x486ce8;}})});}_0xf0039=_[_0x3421('0x44')]({},_0xf0039,_0x50d61b[_0x3421('0x45')]);var _0x417d6e={'where':_0xf0039[_0x3421('0x41')]};return db[_0x3421('0x35')][_0x3421('0x24')](_0x417d6e)[_0x3421('0x2b')](function(_0x3b9d15){_0x841e08[_0x3421('0x24')]=_0x3b9d15;if(_0x50d61b[_0x3421('0x39')][_0x3421('0x46')]){_0xf0039['include']=[{'all':!![]}];}return db[_0x3421('0x35')][_0x3421('0x47')](_0xf0039);})[_0x3421('0x2b')](function(_0x4466be){_0x841e08['rows']=_0x4466be;return _0x841e08;})[_0x3421('0x2b')](respondWithFilteredResult(_0x2b5af4,_0xf0039))['catch'](handleError(_0x2b5af4,null));};exports[_0x3421('0x48')]=function(_0x248f84,_0x669cfd){var _0x176aef={'raw':![],'where':{'id':_0x248f84[_0x3421('0x49')]['id']}},_0x2f9a84={};_0x2f9a84[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x35')][_0x3421('0x36')]);_0x2f9a84[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x248f84[_0x3421('0x39')]);_0x2f9a84['filters']=_[_0x3421('0x3c')](_0x2f9a84['model'],_0x2f9a84[_0x3421('0x39')]);_0x176aef[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x2f9a84[_0x3421('0x38')],qs[_0x3421('0x3e')](_0x248f84[_0x3421('0x39')][_0x3421('0x3e')]));_0x176aef[_0x3421('0x3d')]=_0x176aef[_0x3421('0x3d')][_0x3421('0x3f')]?_0x176aef['attributes']:_0x2f9a84[_0x3421('0x38')];if(_0x248f84[_0x3421('0x39')][_0x3421('0x46')]){_0x176aef['include']=[{'all':!![]}];}_0x176aef=_['merge']({},_0x176aef,_0x248f84[_0x3421('0x45')]);return db[_0x3421('0x35')][_0x3421('0x4a')](_0x176aef)['then'](handleEntityNotFound(_0x669cfd,null))[_0x3421('0x2b')](respondWithResult(_0x669cfd,null))[_0x3421('0x4b')](handleError(_0x669cfd,null));};exports[_0x3421('0x2c')]=function(_0x356376,_0x57554a){return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x356376[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x57554a,null))['then'](removeEntity(_0x57554a,null))['catch'](handleError(_0x57554a,null));};exports[_0x3421('0x4c')]=function(_0x1021f8,_0x5a9ccf){return db['VoicePrefix'][_0x3421('0x4c')]()[_0x3421('0x2b')](respondWithResult(_0x5a9ccf,null))[_0x3421('0x4b')](handleError(_0x5a9ccf,null));};exports[_0x3421('0x4d')]=function(_0x127835,_0x4987e3){var _0x27d284;return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x2f9ce1){return db['VoicePrefix'][_0x3421('0x4d')](_0x127835[_0x3421('0x50')],{'transaction':_0x2f9ce1})[_0x3421('0x2b')](function(_0x48a967){_0x27d284=_0x48a967[_0x3421('0x2d')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x27d284[_0x3421('0x51')]},'raw':!![]})['then'](function(_0x4e33a0){return createVoicePrefixExtensions(_0x27d284,_0x4e33a0,_0x2f9ce1);});});})[_0x3421('0x2b')](function(){var _0x12bd9a=_0x127835['user'][_0x3421('0x2d')]({'plain':!![]});if(!_0x12bd9a)throw new Error(_0x3421('0x52'));if(_0x12bd9a[_0x3421('0x53')]===_0x3421('0x54')){var _0x1c73b9=_0x27d284;return db[_0x3421('0x55')][_0x3421('0x4a')]({'where':{'name':_0x3421('0x2e'),'userProfileId':_0x12bd9a[_0x3421('0x56')]},'raw':!![]})['then'](function(_0x1e4add){if(_0x1e4add&&_0x1e4add[_0x3421('0x57')]===0x0){return db['UserProfileResource'][_0x3421('0x4d')]({'name':_0x1c73b9[_0x3421('0x32')],'resourceId':_0x1c73b9['id'],'type':_0x1e4add[_0x3421('0x32')],'sectionId':_0x1e4add['id']},{})['then'](function(){return _0x27d284;});}else{return _0x27d284;}})[_0x3421('0x4b')](function(_0x27085d){logger[_0x3421('0x31')](_0x3421('0x58'),_0x27085d);throw _0x27085d;});}return _0x27d284;})[_0x3421('0x2b')](respondWithResult(_0x4987e3,null))[_0x3421('0x4b')](handleError(_0x4987e3,null));};function Extension(_0x333b86,_0x3254aa,_0x31fd9b,_0x279b44){this[_0x3421('0x59')]=_0x3421('0x5a');this[_0x3421('0x5b')]=_0x333b86;this[_0x3421('0x5c')]=_0x31fd9b;this[_0x3421('0x5d')]='system';this[_0x3421('0x5e')]=_0x3421('0x5f');this[_0x3421('0x60')]=_0x3254aa;this[_0x3421('0x61')]=_0x279b44;}function createVoicePrefixExtensions(_0x1813c9,_0x25a641,_0x32c9a7){return new BPromise(function(_0x374a6a,_0x5d6488){var _0x379673=new Extension(formatPrefixName(_0x1813c9['prefix']),0x1,_0x3421('0x62'),_0x3421('0x63'));_0x379673[_0x3421('0x64')]=_0x1813c9['id'];return db[_0x3421('0x65')]['create'](_0x379673,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x21e11b){var _0x9def45=_0x21e11b[_0x3421('0x2d')]({'plain':!![]});var _0x9e649=_[_0x3421('0x34')](addVoicePrefixExtensions(_0x1813c9,_0x25a641),function(_0x5e6c4d){_0x5e6c4d[_0x3421('0x51')]=_0x9def45['id'];_0x5e6c4d[_0x3421('0x64')]=_0x1813c9['id'];return _0x5e6c4d;});return db[_0x3421('0x65')][_0x3421('0x66')](_0x9e649,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x1ba5e1){if(!_0x1ba5e1){return _0x5d6488(_0x3421('0x67'));}else{return _0x374a6a(_0x1ba5e1);}})[_0x3421('0x4b')](function(_0x4edb4e){return _0x5d6488(_0x4edb4e);});});;});};function addVoicePrefixExtensions(_0xfbdb57,_0x46717b){var _0x200958=[];var _0x40ae83=formatPrefixName(_0xfbdb57[_0x3421('0x68')]);_0x200958['push'](new Extension(_0x40ae83,0x2,'Set',_0x3421('0x69')+_0xfbdb57[_0x3421('0x32')]));if(_0xfbdb57[_0x3421('0x6a')]){_0x200958['push'](new Extension(_0x40ae83,0x3,_0x3421('0x6b'),'PREFIX-CALLERIDALL='+_0xfbdb57[_0x3421('0x6a')]));}else{_0x200958['push'](new Extension(_0x40ae83,0x3,'NoOp','No\x20callerid\x20available'));}_0x200958['push'](new Extension(_0x40ae83,0x4,'goto',_0x46717b[_0x3421('0x59')]+','+_0x3421('0x6c')+(0x8+_0xfbdb57[_0x3421('0x32')][_0x3421('0x3f')])+'}'+','+0x1));return _0x200958;}function formatPrefixName(_0xa05828){var _0x3ccb08='_';for(var _0x231067=0x0;_0x231067<_0xa05828[_0x3421('0x3f')];_0x231067++){if(_0xa05828[_0x3421('0x6d')](_0x231067)=='-'){_0x3ccb08+=_0xa05828[_0x3421('0x6d')](_0x231067);}else{_0x3ccb08+='['+_0xa05828['charAt'](_0x231067)+']';}}_0x3ccb08+='.';return _0x3ccb08;}exports[_0x3421('0x2a')]=function(_0x4dce60,_0x252b28,_0x41e5f8){var _0x40e0a6=_0x4dce60[_0x3421('0x50')];_0x40e0a6[_0x3421('0x68')]=_0x3421('0x6e')+_0x40e0a6[_0x3421('0x32')]+'-';return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x5c74a8){return db[_0x3421('0x35')][_0x3421('0x2a')](_0x40e0a6,{'where':{'id':_0x40e0a6['id']},'transaction':_0x5c74a8})[_0x3421('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x40e0a6['id']},'transaction':_0x5c74a8})['then'](function(){return db['VoiceExtension'][_0x3421('0x4a')]({'where':{'id':_0x40e0a6['VoiceExtensionId']},'raw':!![]})[_0x3421('0x2b')](function(_0x8aee05){return createVoicePrefixExtensions(_0x40e0a6,_0x8aee05,_0x5c74a8);});});});})[_0x3421('0x2b')](function(){return db[_0x3421('0x35')]['findById'](_0x40e0a6['id']);})[_0x3421('0x2b')](respondWithResult(_0x252b28,null))[_0x3421('0x4b')](handleError(_0x252b28,null));};exports[_0x3421('0x6f')]=function(_0xfb8c60,_0x151eaf,_0x4177cc){return db['VoicePrefix'][_0x3421('0x4a')]({'where':{'id':_0xfb8c60[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x151eaf,null))[_0x3421('0x2b')](function(_0x37e6d8){if(_0x37e6d8){return _0x37e6d8[_0x3421('0x6f')](_0xfb8c60[_0x3421('0x50')]['ids'],_['omit'](_0xfb8c60[_0x3421('0x50')],[_0x3421('0x70'),'id'])||{})[_0x3421('0x71')](function(_0x5d04c6){for(var _0x2dac40=0x0;_0x2dac40<_0xfb8c60['body'][_0x3421('0x70')]['length'];_0x2dac40+=0x1){socket[_0x3421('0x72')](_0x3421('0x73'),{'UserId':Number(_0xfb8c60[_0x3421('0x50')][_0x3421('0x70')][_0x2dac40]),'VoicePrefixId':Number(_0xfb8c60[_0x3421('0x49')]['id'])});}return _0x5d04c6;});}})[_0x3421('0x2b')](respondWithResult(_0x151eaf,null))[_0x3421('0x4b')](handleError(_0x151eaf,null));};exports[_0x3421('0x74')]=function(_0x3f1df5,_0x37ca80,_0x427013){return db[_0x3421('0x35')]['find']({'where':{'id':_0x3f1df5[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x37ca80,null))[_0x3421('0x2b')](function(_0x387d09){if(_0x387d09){return _0x387d09[_0x3421('0x74')](_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')])[_0x3421('0x2b')](function(){if(_['isArray'](_0x3f1df5[_0x3421('0x39')]['ids'])){for(var _0x4d92ed=0x0;_0x4d92ed<_0x3f1df5['query'][_0x3421('0x70')][_0x3421('0x3f')];_0x4d92ed+=0x1){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5['query'][_0x3421('0x70')][_0x4d92ed]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}}else{socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}});}})[_0x3421('0x2b')](respondWithStatusCode(_0x37ca80,null))[_0x3421('0x4b')](handleError(_0x37ca80,null));};exports[_0x3421('0x76')]=function(_0x19e35d,_0x414218,_0x1d65ba){var _0x170340={};var _0x456644={};var _0x355f47;var _0x826d7c;return db['VoicePrefix']['findOne']({'where':{'id':_0x19e35d[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x414218,null))[_0x3421('0x2b')](function(_0x2fd442){if(_0x2fd442){_0x355f47=_0x2fd442;_0x456644['model']=_[_0x3421('0x3a')](db[_0x3421('0x77')][_0x3421('0x36')]);_0x456644[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x19e35d[_0x3421('0x39')]);_0x456644[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],_0x456644[_0x3421('0x39')]);_0x170340[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],qs['fields'](_0x19e35d[_0x3421('0x39')]['fields']));_0x170340[_0x3421('0x3d')]=_0x170340[_0x3421('0x3d')]['length']?_0x170340[_0x3421('0x3d')]:_0x456644['model'];_0x170340['order']=qs[_0x3421('0x40')](_0x19e35d[_0x3421('0x39')][_0x3421('0x40')]);_0x170340['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x19e35d[_0x3421('0x39')],_0x456644['filters']));if(_0x19e35d['query'][_0x3421('0x43')]){_0x170340[_0x3421('0x41')]=_[_0x3421('0x44')](_0x170340[_0x3421('0x41')],{'$or':_['map'](_0x170340[_0x3421('0x3d')],function(_0x1fcd4b){var _0x298afc={};_0x298afc[_0x1fcd4b]={'$like':'%'+_0x19e35d[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x298afc;})});}_0x170340=_[_0x3421('0x44')]({},_0x170340,_0x19e35d[_0x3421('0x45')]);return _0x355f47[_0x3421('0x76')](_0x170340);}})['then'](function(_0x27967d){if(_0x27967d){_0x826d7c=_0x27967d[_0x3421('0x3f')];if(!_0x19e35d['query']['hasOwnProperty'](_0x3421('0x78'))){_0x170340[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x19e35d[_0x3421('0x39')][_0x3421('0x23')]);_0x170340['offset']=qs['offset'](_0x19e35d[_0x3421('0x39')]['offset']);}return _0x355f47['getAgents'](_0x170340);}})[_0x3421('0x2b')](function(_0x1a5b7c){if(_0x1a5b7c){return _0x1a5b7c?{'count':_0x826d7c,'rows':_0x1a5b7c}:null;}})[_0x3421('0x2b')](respondWithResult(_0x414218,null))[_0x3421('0x4b')](handleError(_0x414218,null));};exports['getTeams']=function(_0x595f0a,_0x335331,_0x5a922d){var _0x5af9c9={};var _0x1fb48f={};var _0x3fc2b6;var _0x4289f3;return db['VoicePrefix']['findOne']({'where':{'id':_0x595f0a['params']['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x335331,null))[_0x3421('0x2b')](function(_0x176b12){if(_0x176b12){_0x3fc2b6=_0x176b12;_0x1fb48f[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x79')][_0x3421('0x36')]);_0x1fb48f['query']=_[_0x3421('0x3a')](_0x595f0a[_0x3421('0x39')]);_0x1fb48f[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],_0x1fb48f[_0x3421('0x39')]);_0x5af9c9[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],qs['fields'](_0x595f0a['query'][_0x3421('0x3e')]));_0x5af9c9['attributes']=_0x5af9c9[_0x3421('0x3d')]['length']?_0x5af9c9[_0x3421('0x3d')]:_0x1fb48f[_0x3421('0x38')];_0x5af9c9[_0x3421('0x7a')]=qs[_0x3421('0x40')](_0x595f0a[_0x3421('0x39')]['sort']);_0x5af9c9['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x595f0a[_0x3421('0x39')],_0x1fb48f[_0x3421('0x3b')]));if(_0x595f0a['query'][_0x3421('0x43')]){_0x5af9c9[_0x3421('0x41')]=_[_0x3421('0x44')](_0x5af9c9[_0x3421('0x41')],{'$or':_[_0x3421('0x34')](_0x5af9c9[_0x3421('0x3d')],function(_0x31095c){var _0x4c3058={};_0x4c3058[_0x31095c]={'$like':'%'+_0x595f0a[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x4c3058;})});}_0x5af9c9=_['merge']({},_0x5af9c9,_0x595f0a[_0x3421('0x45')]);return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})[_0x3421('0x2b')](function(_0x58b3e4){if(_0x58b3e4){_0x4289f3=_0x58b3e4[_0x3421('0x3f')];if(!_0x595f0a[_0x3421('0x39')]['hasOwnProperty'](_0x3421('0x78'))){_0x5af9c9[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x595f0a[_0x3421('0x39')][_0x3421('0x23')]);_0x5af9c9[_0x3421('0x21')]=qs[_0x3421('0x21')](_0x595f0a[_0x3421('0x39')]['offset']);}return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})['then'](function(_0x5aaa8a){if(_0x5aaa8a){return _0x5aaa8a?{'count':_0x4289f3,'rows':_0x5aaa8a}:null;}})[_0x3421('0x2b')](respondWithResult(_0x335331,null))[_0x3421('0x4b')](handleError(_0x335331,null));};exports[_0x3421('0x7c')]=function(_0x2c62d7,_0x5cbf21,_0x25c6a0){var _0x44e166=_0x2c62d7[_0x3421('0x50')][_0x3421('0x70')];var _0x13b03f;return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x44e166},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id',_0x3421('0x32'),_0x3421('0x7e'),_0x3421('0x7f'),_0x3421('0x80')],'raw':!![]}]})[_0x3421('0x2b')](function(_0x1cde5f){if(_0x1cde5f){_0x13b03f=_0x1cde5f;var _0x1ddc33=_[_0x3421('0x81')](_0x1cde5f,function(_0x34f980){var _0x7d7398=_0x34f980[_0x3421('0x2d')]({'plain':!![]});return _0x7d7398[_0x3421('0x7d')];});return db['VoicePrefix']['find']({'where':{'id':_0x2c62d7[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](function(_0x1a7038){return db[_0x3421('0x4e')]['transaction'](function(_0x18f27a){return _0x1a7038[_0x3421('0x7c')](_0x44e166,{'transaction':_0x18f27a})['then'](function(){return BPromise[_0x3421('0x82')](_0x13b03f,function(_0x2eb3f4){return db[_0x3421('0x83')]['upsert']({'TeamId':_0x2eb3f4['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},{'transaction':_0x18f27a});});})['then'](function(){return BPromise[_0x3421('0x82')](_0x1ddc33,function(_0x3f6f2c){return db[_0x3421('0x84')][_0x3421('0x85')]({'where':{'UserId':_0x3f6f2c['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},'transaction':_0x18f27a});});})[_0x3421('0x2b')](function(){_0x1ddc33[_0x3421('0x86')](function(_0x50607f){socket[_0x3421('0x72')]('userVoicePrefix:save',{'UserId':_0x50607f['id'],'VoicePrefixId':_0x1a7038['id']});});});});});}})['then'](respondWithStatusCode(_0x5cbf21,null))[_0x3421('0x4b')](handleError(_0x5cbf21,null));};exports[_0x3421('0x87')]=function(_0x4a85d1,_0x1b48e1,_0x4c357e){return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x4a85d1[_0x3421('0x39')][_0x3421('0x70')]},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x3421('0x2b')](handleEntityNotFound(_0x1b48e1,null))[_0x3421('0x2b')](function(_0x2f38ec){var _0x11f294=_[_0x3421('0x34')](_0x2f38ec,'id');var _0x2d7330=[];var _0x5bf9a4=[];var _0x36868f=squel['select']();_0x36868f['field'](_0x3421('0x88'))[_0x3421('0x89')](_0x3421('0x8a'),'tq')[_0x3421('0x8b')]('user_has_teams','ut',_0x3421('0x8c'))[_0x3421('0x41')]('VoicePrefixId\x20=\x20?',_0x4a85d1[_0x3421('0x49')]['id']);for(var _0x4a933a=0x0;_0x4a933a<_0x2f38ec[_0x3421('0x3f')];_0x4a933a+=0x1){let _0x2defcb=_0x2f38ec[_0x4a933a];for(var _0x16735e=0x0;_0x16735e<_0x2defcb['Agents'][_0x3421('0x3f')];_0x16735e+=0x1){let _0x303df7=_0x2defcb[_0x3421('0x7d')][_0x16735e];var _0x1d8163=_0x36868f[_0x3421('0x8d')]();_0x1d8163[_0x3421('0x41')](_0x3421('0x8e'),_0x303df7['id']);_0x5bf9a4[_0x3421('0x8f')](db['sequelize'][_0x3421('0x39')](_0x1d8163[_0x3421('0x90')](),{'type':db[_0x3421('0x4e')][_0x3421('0x91')][_0x3421('0x92')]})[_0x3421('0x2b')](function(_0x3a5346){if(_0x3a5346['length']===0x1){return _0x303df7['id'];}else{var _0x3f64d0=_[_0x3421('0x93')](_['map'](_0x3a5346,'TeamId'),function(_0x4aa261){return _[_0x3421('0x94')](_0x11f294,_0x4aa261);});if(_0x3f64d0){return _0x303df7['id'];}}}));}}return BPromise[_0x3421('0x95')](_0x5bf9a4)['then'](function(_0x256976){_0x2d7330=_(_0x2d7330)[_0x3421('0x96')](_0x256976)[_0x3421('0x97')]()[_0x3421('0x98')]();return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x4a85d1[_0x3421('0x49')]['id']}})['then'](function(_0x224e26){return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x1e2a67){return _0x224e26[_0x3421('0x87')](_0x4a85d1[_0x3421('0x39')]['ids'],{'transaction':_0x1e2a67})[_0x3421('0x2b')](function(){if(!_[_0x3421('0x99')](_0x2d7330)){return _0x224e26['removeAgents'](_0x2d7330,{'transaction':_0x1e2a67});}})[_0x3421('0x2b')](function(){_0x2d7330[_0x3421('0x86')](function(_0x25cc13){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':_0x25cc13,'VoicePrefixId':_0x224e26['id']});});});});});});})[_0x3421('0x2b')](respondWithStatusCode(_0x1b48e1,null))[_0x3421('0x4b')](handleError(_0x1b48e1,null));}; \ No newline at end of file +var _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0xc9a48e,_0x4d3e72){var _0x419127=function(_0x186d3c){while(--_0x186d3c){_0xc9a48e['push'](_0xc9a48e['shift']());}};_0x419127(++_0x4d3e72);}(_0x4888,0x198));var _0x8488=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4888[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f933792..6cba3af 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 _0xdf27=['exports','events','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xdf27,0xe2));var _0x7df2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdf27[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x7df2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x7df2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7df2('0x2')](0x0);var events={'afterCreate':_0x7df2('0x3'),'afterUpdate':_0x7df2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x412acf){return function(_0x2a7922,_0x304118,_0x2a4c9e){VoicePrefixEvents[_0x7df2('0x5')](_0x412acf+':'+_0x2a7922['id'],_0x2a7922);VoicePrefixEvents[_0x7df2('0x5')](_0x412acf,_0x2a7922);_0x2a4c9e(null);};}for(var e in events){if(events[_0x7df2('0x6')](e)){var event=events[e];VoicePrefix[_0x7df2('0x7')](e,emitEvent(event));}}module[_0x7df2('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x6687=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6687,0xe8));var _0x7668=function(_0x4eeb6f,_0x1979cd){_0x4eeb6f=_0x4eeb6f-0x0;var _0x384eb9=_0x6687[_0x4eeb6f];return _0x384eb9;};'use strict';var EventEmitter=require(_0x7668('0x0'));var VoicePrefix=require(_0x7668('0x1'))['db'][_0x7668('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7668('0x3')](0x0);var events={'afterCreate':_0x7668('0x4'),'afterUpdate':'update','afterDestroy':_0x7668('0x5')};function emitEvent(_0x3f515c){return function(_0x57c44d,_0x193adf,_0x1ff277){VoicePrefixEvents[_0x7668('0x6')](_0x3f515c+':'+_0x57c44d['id'],_0x57c44d);VoicePrefixEvents['emit'](_0x3f515c,_0x57c44d);_0x1ff277(null);};}for(var e in events){if(events[_0x7668('0x7')](e)){var event=events[e];VoicePrefix[_0x7668('0x8')](e,emitEvent(event));}}module[_0x7668('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 4ce5dfe..5482fdb 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 _0xe45d=['lodash','util','../../config/logger','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe45d,0x104));var _0xde45=function(_0x56f7e2,_0x4e2a88){_0x56f7e2=_0x56f7e2-0x0;var _0x3cb214=_0xe45d[_0x56f7e2];return _0x3cb214;};'use strict';var _=require(_0xde45('0x0'));var util=require(_0xde45('0x1'));var logger=require(_0xde45('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde45('0x3'));var fs=require('fs');var path=require(_0xde45('0x4'));var rimraf=require(_0xde45('0x5'));var config=require('../../config/environment');var attributes=require(_0xde45('0x6'));module[_0xde45('0x7')]=function(_0x5d3fa9,_0xadc4cb){return _0x5d3fa9[_0xde45('0x8')]('VoicePrefix',attributes,{'tableName':_0xde45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5064=['../../config/environment','./voicePrefix.attributes','define','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x318c1b,_0x4af3ae){var _0x43bb7d=function(_0x2a17ab){while(--_0x2a17ab){_0x318c1b['push'](_0x318c1b['shift']());}};_0x43bb7d(++_0x4af3ae);}(_0x5064,0xdb));var _0x4506=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5064[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4506('0x0'));var util=require(_0x4506('0x1'));var logger=require(_0x4506('0x2'))('api');var moment=require(_0x4506('0x3'));var BPromise=require(_0x4506('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4506('0x5'));var rimraf=require('rimraf');var config=require(_0x4506('0x6'));var attributes=require(_0x4506('0x7'));module['exports']=function(_0x51e729,_0x2e9e03){return _0x51e729[_0x4506('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 05f5e0b..e397b72 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 _0x078a=['info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x078a,0x12d));var _0xa078=function(_0x1a2129,_0x13be7e){_0x1a2129=_0x1a2129-0x0;var _0xd30b98=_0x078a[_0x1a2129];return _0xd30b98;};'use strict';var _=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var moment=require(_0xa078('0x2'));var BPromise=require(_0xa078('0x3'));var rs=require(_0xa078('0x4'));var fs=require('fs');var Redis=require(_0xa078('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa078('0x6'));var logger=require(_0xa078('0x7'))(_0xa078('0x8'));var config=require('../../config/environment');var jayson=require(_0xa078('0x9'));var client=jayson['client'][_0xa078('0xa')]({'port':0x232a});config[_0xa078('0xb')]=_[_0xa078('0xc')](config[_0xa078('0xb')],{'host':_0xa078('0xd'),'port':0x18eb});var socket=require(_0xa078('0xe'))(new Redis(config[_0xa078('0xb')]));require(_0xa078('0xf'))['register'](socket);function respondWithRpcPromise(_0x158b08,_0x52eee7,_0x347943){return new BPromise(function(_0x1607f4,_0x5b3c33){return client[_0xa078('0x10')](_0x158b08,_0x347943)[_0xa078('0x11')](function(_0x2ace5f){logger[_0xa078('0x12')](_0xa078('0x13'),_0x52eee7,'request\x20sent');logger[_0xa078('0x14')](_0xa078('0x15'),_0x52eee7,_0xa078('0x16'),JSON[_0xa078('0x17')](_0x2ace5f));if(_0x2ace5f[_0xa078('0x18')]){if(_0x2ace5f[_0xa078('0x18')][_0xa078('0x19')]===0x1f4){logger[_0xa078('0x18')](_0xa078('0x13'),_0x52eee7,_0x2ace5f[_0xa078('0x18')][_0xa078('0x1a')]);return _0x5b3c33(_0x2ace5f[_0xa078('0x18')]['message']);}logger[_0xa078('0x18')](_0xa078('0x13'),_0x52eee7,_0x2ace5f[_0xa078('0x18')]['message']);return _0x1607f4(_0x2ace5f[_0xa078('0x18')][_0xa078('0x1a')]);}else{logger['info'](_0xa078('0x13'),_0x52eee7,_0xa078('0x16'));_0x1607f4(_0x2ace5f[_0xa078('0x1b')]['message']);}})[_0xa078('0x1c')](function(_0x257add){logger[_0xa078('0x18')](_0xa078('0x13'),_0x52eee7,_0x257add);_0x5b3c33(_0x257add);});});} \ No newline at end of file +var _0x7880=['defaults','localhost','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7880,0x1f4));var _0x0788=function(_0x4d05f8,_0x3efc70){_0x4d05f8=_0x4d05f8-0x0;var _0x220513=_0x7880[_0x4d05f8];return _0x220513;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./voicePrefix.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 42539d0..c309555 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 _0xe13a=['update','emit','removeListener','register','voicePrefix:','save','remove'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xe13a,0x178));var _0xae13=function(_0x1773f5,_0x4f42fc){_0x1773f5=_0x1773f5-0x0;var _0x5643a7=_0xe13a[_0x1773f5];return _0x5643a7;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xae13('0x0'),_0xae13('0x1'),_0xae13('0x2')];function createListener(_0x6066c0,_0x4cf961){return function(_0x3aaf90){_0x4cf961[_0xae13('0x3')](_0x6066c0,_0x3aaf90);};}function removeListener(_0x3ebbfe,_0x10abd7){return function(){VoicePrefixEvents[_0xae13('0x4')](_0x3ebbfe,_0x10abd7);};}exports[_0xae13('0x5')]=function(_0x412a07){for(var _0x3379ed=0x0,_0x341ba4=events['length'];_0x3379ed<_0x341ba4;_0x3379ed++){var _0x2f6d10=events[_0x3379ed];var _0x2b2e1f=createListener(_0xae13('0x6')+_0x2f6d10,_0x412a07);VoicePrefixEvents['on'](_0x2f6d10,_0x2b2e1f);}}; \ No newline at end of file +var _0x928c=['emit','register','voicePrefix:','remove','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x928c,0x17f));var _0xc928=function(_0x1d288f,_0x4ad29f){_0x1d288f=_0x1d288f-0x0;var _0x442f98=_0x928c[_0x1d288f];return _0x442f98;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xc928('0x0'),_0xc928('0x1')];function createListener(_0x597d43,_0x24354b){return function(_0x29bd30){_0x24354b[_0xc928('0x2')](_0x597d43,_0x29bd30);};}function removeListener(_0x3e4e60,_0x1dd54b){return function(){VoicePrefixEvents['removeListener'](_0x3e4e60,_0x1dd54b);};}exports[_0xc928('0x3')]=function(_0x4704bc){for(var _0x8c0fa5=0x0,_0x4ff9e6=events['length'];_0x8c0fa5<_0x4ff9e6;_0x8c0fa5++){var _0x5e433b=events[_0x8c0fa5];var _0x445248=createListener(_0xc928('0x4')+_0x5e433b,_0x4704bc);VoicePrefixEvents['on'](_0x5e433b,_0x445248);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 83380e3..e1b436e 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3b81eb,_0x175f32){var _0x149491=function(_0x454753){while(--_0x454753){_0x3b81eb['push'](_0x3b81eb['shift']());}};_0x149491(++_0x175f32);}(_0xb10b,0x12a));var _0xbb10=function(_0x340aa5,_0x2d5553){_0x340aa5=_0x340aa5-0x0;var _0x3a5b7f=_0xb10b[_0x340aa5];return _0x3a5b7f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4ee386,_0x1a9032){var _0x42450c=function(_0x51d08c){while(--_0x51d08c){_0x4ee386['push'](_0x4ee386['shift']());}};_0x42450c(++_0x1a9032);}(_0xb10b,0x12a));var _0xbb10=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xb10b[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 5d3bc6a..e67e93d 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 _0xe49a=['periodic_announce','split','joinempty','leavewhenempty','acw','Active/Disactive\x20Campaign','preview','progressive','power','predictive','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','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)','#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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','inbound','ringall','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','dialMethod','outbound','roundrobin','includes','INTEGER','STRING','yes','all','once','TEXT','join'];(function(_0x13ae89,_0x832c38){var _0x1744a0=function(_0x4c406a){while(--_0x4c406a){_0x13ae89['push'](_0x13ae89['shift']());}};_0x1744a0(++_0x832c38);}(_0xe49a,0x1c2));var _0xae49=function(_0x4a248f,_0x1cf1b6){_0x4a248f=_0x4a248f-0x0;var _0x1c7817=_0xe49a[_0x4a248f];return _0x1c7817;};'use strict';var Sequelize=require(_0xae49('0x0'));module[_0xae49('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x3'),'outbound'),'allowNull':![],'defaultValue':_0xae49('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xae49('0x4'),'leastrecent',_0xae49('0x5'),_0xae49('0x6'),_0xae49('0x7'),_0xae49('0x8'),'wrandom',_0xae49('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x3f76be){this[_0xae49('0xa')](_0xae49('0xb'),_0x3f76be?_0x3f76be:_0xae49('0x7'));},'get':function(){var _0x5ef566=this['getDataValue']('type');var _0x17dfb4=this[_0xae49('0xc')](_0xae49('0xd'));var _0x7b3736=this[_0xae49('0xc')](_0xae49('0xb'));if(_0x5ef566===_0xae49('0xe')){if(_0x17dfb4==='preview'){return null;}if(_0x17dfb4==='booked'&&![_0xae49('0x7'),_0xae49('0xf')][_0xae49('0x10')](_0x7b3736)){this[_0xae49('0xa')](_0xae49('0xb'),_0xae49('0x7'));}}return _0x7b3736;}},'servicelevel':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xae49('0x11')](0xb)},'timeout':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xae49('0x12')]},'weight':{'type':Sequelize[_0xae49('0x11')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xae49('0x2')]('yes','no'),'defaultValue':_0xae49('0x13')},'autopause':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no',_0xae49('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xae49('0x11')](0xb)},'autopausebusy':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xae49('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no',_0xae49('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xae49('0x12')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xae49('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xae49('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xae49('0x12')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xae49('0x12')]},'queue_youarenext':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xae49('0x12')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xae49('0x12')]},'queue_periodic_announce':{'type':Sequelize[_0xae49('0x12')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xae49('0x16')],'set':function(_0x16fcd8){this['setDataValue']('periodic_announce',_0x16fcd8?_0x16fcd8[_0xae49('0x17')](','):[]);},'get':function(){return this[_0xae49('0xc')]('periodic_announce')?this[_0xae49('0xc')](_0xae49('0x18'))[_0xae49('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xae49('0x12')],'defaultValue':_0xae49('0x13'),'set':function(_0x28257b){this['setDataValue'](_0xae49('0x1a'),_0x28257b?_0x28257b[_0xae49('0x17')](','):undefined);},'get':function(){return this[_0xae49('0xc')](_0xae49('0x1a'))?this[_0xae49('0xc')](_0xae49('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xae49('0x12')],'defaultValue':'no','set':function(_0x597547){this[_0xae49('0xa')]('leavewhenempty',_0x597547?_0x597547[_0xae49('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0xae49('0x1b'))?this['getDataValue'](_0xae49('0x1b'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xae49('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3868a1){this[_0xae49('0xa')](_0xae49('0x1c'),_0x3868a1);if(_0x3868a1){if(this['getDataValue']('wrapuptime')<0x2){this[_0xae49('0xa')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xae49('0x11')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xae49('0x1d')},'dialMethod':{'type':Sequelize['ENUM'](_0xae49('0x1e'),_0xae49('0x1f'),_0xae49('0x20'),_0xae49('0x21'),_0xae49('0x22')),'defaultValue':_0xae49('0x1f'),'comment':_0xae49('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae49('0x24')},'dialLimitQueue':{'type':Sequelize[_0xae49('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae49('0x25')},'dialPowerLevel':{'type':Sequelize[_0xae49('0x26')](0x2)[_0xae49('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xae49('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x29'),_0xae49('0x2a')),'defaultValue':_0xae49('0x2a'),'comment':_0xae49('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xae49('0x26')](0x2)[_0xae49('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xae49('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xae49('0x12')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xae49('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xae49('0x2d'),'comment':_0xae49('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x2f')},'dialQueueProject':{'type':Sequelize[_0xae49('0x12')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae49('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xae49('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)[_0xae49('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xae49('0x11')](0x3)[_0xae49('0x27')],'defaultValue':0x3,'comment':_0xae49('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)[_0xae49('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xae49('0x35')},'dialTimezone':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xae49('0x12')],'defaultValue':_0xae49('0x36')},'dialPrefix':{'type':Sequelize[_0xae49('0x12')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xae49('0x2')]('always','never','onlyIfOpen'),'defaultValue':_0xae49('0x37')},'dialAMDActive':{'type':Sequelize[_0xae49('0x38')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xae49('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xae49('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xae49('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xae49('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xae49('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xae49('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xae49('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xae49('0x11')](0x9)[_0xae49('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xae49('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xae49('0x38')],'defaultValue':0x0,'comment':_0xae49('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xae49('0x2')](_0xae49('0x3f'),_0xae49('0x40')),'defaultValue':_0xae49('0x3f')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xae49('0x38')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xae49('0x38')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xae49('0x11')](0x3)[_0xae49('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae49('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xae49('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae49('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae49('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)[_0xae49('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xae49('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)[_0xae49('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x46')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)[_0xae49('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xae49('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae49('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xae49('0x11')](0x5)[_0xae49('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae49('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xae49('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xae49('0x38')],'defaultValue':![],'comment':_0xae49('0x4c'),'set':function(_0xc3c75d){if(!_0xc3c75d)this['setDataValue'](_0xae49('0x4d'),null);this['setDataValue'](_0xae49('0x4e'),_0xc3c75d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xae49('0x11')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xae49('0x11')](0x3)[_0xae49('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xae49('0x38')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xae49('0x11')](0x3)[_0xae49('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd7cf=['join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','rrmemory','type','getDataValue','strategy','preview','roundrobin','setDataValue','INTEGER','yes','all','once','periodic_announce'];(function(_0x4d22cb,_0x4bec43){var _0x17d848=function(_0x2d10d7){while(--_0x2d10d7){_0x4d22cb['push'](_0x4d22cb['shift']());}};_0x17d848(++_0x4bec43);}(_0xd7cf,0x132));var _0xfd7c=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xd7cf[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0xfd7c('0x0'));module[_0xfd7c('0x1')]={'name':{'type':Sequelize[_0xfd7c('0x2')],'allowNull':![],'unique':_0xfd7c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x5'),_0xfd7c('0x6')),'allowNull':![],'defaultValue':_0xfd7c('0x5')},'musiconhold':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfd7c('0x7'),_0xfd7c('0x8'),_0xfd7c('0x9'),_0xfd7c('0xa'),'rrmemory',_0xfd7c('0xb'),_0xfd7c('0xc'),_0xfd7c('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x345f82){this['setDataValue']('strategy',_0x345f82?_0x345f82:_0xfd7c('0xe'));},'get':function(){var _0x595bc5=this['getDataValue'](_0xfd7c('0xf'));var _0x5a0868=this[_0xfd7c('0x10')]('dialMethod');var _0x2d7d8e=this[_0xfd7c('0x10')](_0xfd7c('0x11'));if(_0x595bc5===_0xfd7c('0x6')){if(_0x5a0868===_0xfd7c('0x12')){return null;}if(_0x5a0868==='booked'&&!['rrmemory',_0xfd7c('0x13')]['includes'](_0x2d7d8e)){this[_0xfd7c('0x14')](_0xfd7c('0x11'),_0xfd7c('0xe'));}}return _0x2d7d8e;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfd7c('0x15')](0xb)},'timeout':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xfd7c('0x16'),'no'),'defaultValue':_0xfd7c('0x16')},'autopause':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no',_0xfd7c('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfd7c('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfd7c('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xfd7c('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':_0xfd7c('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xfd7c('0x16'),'no',_0xfd7c('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xfd7c('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xfd7c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfd7c('0x2')]},'queue_youarenext':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfd7c('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfd7c('0x2')]},'queue_quantity1':{'type':Sequelize[_0xfd7c('0x2')]},'queue_quantity2':{'type':Sequelize[_0xfd7c('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xfd7c('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1886dc){this[_0xfd7c('0x14')](_0xfd7c('0x19'),_0x1886dc?_0x1886dc[_0xfd7c('0x1a')](','):[]);},'get':function(){return this[_0xfd7c('0x10')]('periodic_announce')?this[_0xfd7c('0x10')](_0xfd7c('0x19'))[_0xfd7c('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':_0xfd7c('0x16'),'set':function(_0x167db5){this[_0xfd7c('0x14')](_0xfd7c('0x1c'),_0x167db5?_0x167db5[_0xfd7c('0x1a')](','):undefined);},'get':function(){return this[_0xfd7c('0x10')](_0xfd7c('0x1c'))?this[_0xfd7c('0x10')](_0xfd7c('0x1c'))[_0xfd7c('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x394d2b){this[_0xfd7c('0x14')]('leavewhenempty',_0x394d2b?_0x394d2b[_0xfd7c('0x1a')](','):undefined);},'get':function(){return this[_0xfd7c('0x10')](_0xfd7c('0x1d'))?this[_0xfd7c('0x10')](_0xfd7c('0x1d'))[_0xfd7c('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfd7c('0x2')]},'description':{'type':Sequelize[_0xfd7c('0x2')]},'acw':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':0x0,'set':function(_0x906445){this[_0xfd7c('0x14')]('acw',_0x906445);if(_0x906445){if(this[_0xfd7c('0x10')](_0xfd7c('0x1f'))<0x2){this[_0xfd7c('0x14')](_0xfd7c('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfd7c('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':0x0,'comment':_0xfd7c('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0xfd7c('0x12'),_0xfd7c('0x21'),_0xfd7c('0x22'),_0xfd7c('0x23'),_0xfd7c('0x24')),'defaultValue':_0xfd7c('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xfd7c('0x15')](0x4)[_0xfd7c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfd7c('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfd7c('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xfd7c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfd7c('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xfd7c('0x4')](_0xfd7c('0x29'),_0xfd7c('0x2a')),'defaultValue':_0xfd7c('0x2a'),'comment':_0xfd7c('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfd7c('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfd7c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfd7c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':_0xfd7c('0x2f'),'comment':_0xfd7c('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x31')},'dialQueueProject':{'type':Sequelize[_0xfd7c('0x2')],'comment':_0xfd7c('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x34')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'comment':_0xfd7c('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfd7c('0x37')},'dialTimezone':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfd7c('0x38')},'dialPrefix':{'type':Sequelize[_0xfd7c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfd7c('0x4')]('always',_0xfd7c('0x39'),_0xfd7c('0x3a')),'defaultValue':_0xfd7c('0x3b')},'dialAMDActive':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':0x0,'comment':_0xfd7c('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfd7c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfd7c('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xfd7c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfd7c('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xfd7c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfd7c('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfd7c('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xfd7c('0x15')](0x9)[_0xfd7c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfd7c('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfd7c('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfd7c('0x15')](0x9)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfd7c('0x15')](0x9)[_0xfd7c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xfd7c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfd7c('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfd7c('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xfd7c('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfd7c('0x2')],'comment':_0xfd7c('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd7c('0x45')},'dialCutDigit':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd7c('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7c('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfd7c('0x15')](0x5)[_0xfd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7c('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfd7c('0x15')],'allowNull':!![],'comment':_0xfd7c('0x4f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfd7c('0x50'),'set':function(_0x466f4a){if(!_0x466f4a)this['setDataValue'](_0xfd7c('0x51'),null);this[_0xfd7c('0x14')](_0xfd7c('0x52'),_0x466f4a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfd7c('0x15')](0x3)[_0xfd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xfd7c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfd7c('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 265c7f4..31dff86 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 _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','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','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','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','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x6aa7,0x178));var _0x76aa=function(_0x5ab046,_0x2bd8a7){_0x5ab046=_0x5ab046-0x0;var _0x22122a=_0x6aa7[_0x5ab046];return _0x22122a;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file +var _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','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','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1a71a1,_0x503ae3){_0x1a71a1=_0x1a71a1-0x0;var _0x417fd9=_0x1cb9[_0x1a71a1];return _0x417fd9;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 0518d23..1763a87 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 _0x924c=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','save'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x924c,0xc3));var _0xc924=function(_0x3588e1,_0x41596d){_0x3588e1=_0x3588e1-0x0;var _0xcdf371=_0x924c[_0x3588e1];return _0xcdf371;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xc924('0x0'))['db'][_0xc924('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc924('0x2'),'afterUpdate':_0xc924('0x3'),'afterDestroy':_0xc924('0x4')};function emitEvent(_0x12d9cb){return function(_0x232cee,_0x2da9fc,_0xee0aa2){VoiceQueueEvents[_0xc924('0x5')](_0x12d9cb+':'+_0x232cee['id'],_0x232cee);VoiceQueueEvents[_0xc924('0x5')](_0x12d9cb,_0x232cee);_0xee0aa2(null);};}for(var e in events){if(events[_0xc924('0x6')](e)){var event=events[e];VoiceQueue[_0xc924('0x7')](e,emitEvent(event));}}module[_0xc924('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x0cf7=['VoiceQueue','setMaxListeners','save','update','remove','hasOwnProperty','events'];(function(_0x294f3d,_0x1b0f82){var _0x2c8f6c=function(_0x2303e6){while(--_0x2303e6){_0x294f3d['push'](_0x294f3d['shift']());}};_0x2c8f6c(++_0x1b0f82);}(_0x0cf7,0x1e2));var _0x70cf=function(_0x40e643,_0x2990a2){_0x40e643=_0x40e643-0x0;var _0x100010=_0x0cf7[_0x40e643];return _0x100010;};'use strict';var EventEmitter=require(_0x70cf('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x70cf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x70cf('0x2')](0x0);var events={'afterCreate':_0x70cf('0x3'),'afterUpdate':_0x70cf('0x4'),'afterDestroy':_0x70cf('0x5')};function emitEvent(_0x41d409){return function(_0x2e7b33,_0x541cdb,_0x276d0c){VoiceQueueEvents['emit'](_0x41d409+':'+_0x2e7b33['id'],_0x2e7b33);VoiceQueueEvents['emit'](_0x41d409,_0x2e7b33);_0x276d0c(null);};}for(var e in events){if(events[_0x70cf('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7b97830..4d51e49 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(_0x11c0cb,_0x4476aa){var _0x3dbf20=function(_0x58f366){while(--_0x58f366){_0x11c0cb['push'](_0x11c0cb['shift']());}};_0x3dbf20(++_0x4476aa);}(_0x008c,0x188));var _0xc008=function(_0x3a23b4,_0x49d839){_0x3a23b4=_0x3a23b4-0x0;var _0x302bca=_0x008c[_0x3a23b4];return _0x302bca;};'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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x55ca,0x126));var _0xa55c=function(_0x21f88f,_0x48cfba){_0x21f88f=_0x21f88f-0x0;var _0x3b9ff5=_0x55ca[_0x21f88f];return _0x3b9ff5;};'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')]('VoiceQueue',attributes,{'tableName':_0xa55c('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 075099a..2253a20 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 _0x404f=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','then','info','ShowVoiceQueue','find','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x35b05f,_0x1a4ecf){var _0x183859=function(_0x326490){while(--_0x326490){_0x35b05f['push'](_0x35b05f['shift']());}};_0x183859(++_0x1a4ecf);}(_0x404f,0x131));var _0xf404=function(_0x131297,_0x55aa10){_0x131297=_0x131297-0x0;var _0x4ddc1a=_0x404f[_0x131297];return _0x4ddc1a;};'use strict';var _=require(_0xf404('0x0'));var util=require('util');var moment=require(_0xf404('0x1'));var BPromise=require(_0xf404('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf404('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf404('0x4'));var logger=require(_0xf404('0x5'))('rpc');var config=require(_0xf404('0x6'));var jayson=require(_0xf404('0x7'));var client=jayson[_0xf404('0x8')]['http']({'port':0x232a});config[_0xf404('0x9')]=_[_0xf404('0xa')](config[_0xf404('0x9')],{'host':_0xf404('0xb'),'port':0x18eb});var socket=require(_0xf404('0xc'))(new Redis(config[_0xf404('0x9')]));require(_0xf404('0xd'))[_0xf404('0xe')](socket);function respondWithRpcPromise(_0x1d5df2,_0x4c8852,_0xf5b76b){return new BPromise(function(_0x3a1762,_0x43cc41){return client[_0xf404('0xf')](_0x1d5df2,_0xf5b76b)['then'](function(_0x513d79){logger['info'](_0xf404('0x10'),_0x4c8852,_0xf404('0x11'));logger[_0xf404('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4c8852,_0xf404('0x11'),JSON[_0xf404('0x13')](_0x513d79));if(_0x513d79['error']){if(_0x513d79[_0xf404('0x14')][_0xf404('0x15')]===0x1f4){logger[_0xf404('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x4c8852,_0x513d79[_0xf404('0x14')]['message']);return _0x43cc41(_0x513d79['error'][_0xf404('0x16')]);}logger[_0xf404('0x14')](_0xf404('0x10'),_0x4c8852,_0x513d79[_0xf404('0x14')]['message']);return _0x3a1762(_0x513d79[_0xf404('0x14')][_0xf404('0x16')]);}else{logger['info'](_0xf404('0x10'),_0x4c8852,_0xf404('0x11'));_0x3a1762(_0x513d79[_0xf404('0x17')][_0xf404('0x16')]);}})[_0xf404('0x18')](function(_0x22564c){logger[_0xf404('0x14')](_0xf404('0x10'),_0x4c8852,_0x22564c);_0x43cc41(_0x22564c);});});}exports[_0xf404('0x19')]=function(_0x578657){var _0x364fee=this;return new Promise(function(_0x228ebf,_0x5e1ca2){return db[_0xf404('0x1a')]['findAll']({'raw':_0x578657[_0xf404('0x1b')]?_0x578657[_0xf404('0x1b')][_0xf404('0x1c')]===undefined?!![]:![]:!![],'where':_0x578657[_0xf404('0x1b')]?_0x578657[_0xf404('0x1b')][_0xf404('0x1d')]||null:null,'attributes':_0x578657[_0xf404('0x1b')]?_0x578657[_0xf404('0x1b')][_0xf404('0x1e')]||null:null,'limit':_0x578657['options']?_0x578657[_0xf404('0x1b')][_0xf404('0x1f')]||null:null,'include':_0x578657[_0xf404('0x1b')]?_0x578657[_0xf404('0x1b')][_0xf404('0x20')]?_[_0xf404('0x21')](_0x578657['options'][_0xf404('0x20')],function(_0x36d97c){return{'model':db[_0x36d97c[_0xf404('0x22')]],'as':_0x36d97c['as'],'attributes':_0x36d97c[_0xf404('0x1e')],'include':_0x36d97c[_0xf404('0x20')]?_[_0xf404('0x21')](_0x36d97c[_0xf404('0x20')],function(_0x2e89ba){return{'model':db[_0x2e89ba[_0xf404('0x22')]],'as':_0x2e89ba['as'],'attributes':_0x2e89ba[_0xf404('0x1e')],'include':_0x2e89ba['include']?_[_0xf404('0x21')](_0x2e89ba[_0xf404('0x20')],function(_0x258196){return{'model':db[_0x258196[_0xf404('0x22')]],'as':_0x258196['as'],'attributes':_0x258196[_0xf404('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf404('0x23')](function(_0xc656aa){logger[_0xf404('0x24')](_0xf404('0x19'),_0x578657);logger['debug'](_0xf404('0x19'),_0x578657,JSON[_0xf404('0x13')](_0xc656aa));_0x228ebf(_0xc656aa);})[_0xf404('0x18')](function(_0x471935){logger['error'](_0xf404('0x19'),_0x471935['message'],_0x578657);_0x5e1ca2(_0x364fee[_0xf404('0x14')](0x1f4,_0x471935['message']));});});};exports[_0xf404('0x25')]=function(_0x2c2309){var _0x22411e=this;return new Promise(function(_0x54b1f1,_0x35dc31){return db['VoiceQueue'][_0xf404('0x26')]({'raw':_0x2c2309[_0xf404('0x1b')]?_0x2c2309['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c2309[_0xf404('0x1b')]?_0x2c2309[_0xf404('0x1b')][_0xf404('0x1d')]||null:null,'attributes':_0x2c2309[_0xf404('0x1b')]?_0x2c2309[_0xf404('0x1b')][_0xf404('0x1e')]||null:null,'include':_0x2c2309[_0xf404('0x1b')]?_0x2c2309[_0xf404('0x1b')][_0xf404('0x20')]?_[_0xf404('0x21')](_0x2c2309[_0xf404('0x1b')][_0xf404('0x20')],function(_0x5072db){return{'model':db[_0x5072db[_0xf404('0x22')]],'as':_0x5072db['as'],'attributes':_0x5072db['attributes'],'include':_0x5072db[_0xf404('0x20')]?_[_0xf404('0x21')](_0x5072db['include'],function(_0x18e1e6){return{'model':db[_0x18e1e6['model']],'as':_0x18e1e6['as'],'attributes':_0x18e1e6[_0xf404('0x1e')],'include':_0x18e1e6[_0xf404('0x20')]?_[_0xf404('0x21')](_0x18e1e6[_0xf404('0x20')],function(_0x59d98a){return{'model':db[_0x59d98a[_0xf404('0x22')]],'as':_0x59d98a['as'],'attributes':_0x59d98a[_0xf404('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf404('0x23')](function(_0x215c58){logger['info'](_0xf404('0x25'),_0x2c2309);logger[_0xf404('0x12')](_0xf404('0x25'),_0x2c2309,JSON['stringify'](_0x215c58));_0x54b1f1(_0x215c58);})[_0xf404('0x18')](function(_0x2f3f2a){logger[_0xf404('0x14')](_0xf404('0x25'),_0x2f3f2a[_0xf404('0x16')],_0x2c2309);_0x35dc31(_0x22411e[_0xf404('0x14')](0x1f4,_0x2f3f2a['message']));});});}; \ No newline at end of file +var _0x4c75=['ShowVoiceQueue','find','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','model','map','stringify'];(function(_0x847cfe,_0x372912){var _0x43924a=function(_0x197ea5){while(--_0x197ea5){_0x847cfe['push'](_0x847cfe['shift']());}};_0x43924a(++_0x372912);}(_0x4c75,0x14b));var _0x54c7=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x4c75[_0x553502];return _0x246c37;};'use strict';var _=require(_0x54c7('0x0'));var util=require(_0x54c7('0x1'));var moment=require(_0x54c7('0x2'));var BPromise=require(_0x54c7('0x3'));var rs=require(_0x54c7('0x4'));var fs=require('fs');var Redis=require(_0x54c7('0x5'));var db=require(_0x54c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54c7('0x7'));var config=require(_0x54c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54c7('0x9')][_0x54c7('0xa')]({'port':0x232a});config[_0x54c7('0xb')]=_[_0x54c7('0xc')](config[_0x54c7('0xb')],{'host':_0x54c7('0xd'),'port':0x18eb});var socket=require(_0x54c7('0xe'))(new Redis(config[_0x54c7('0xb')]));require(_0x54c7('0xf'))[_0x54c7('0x10')](socket);function respondWithRpcPromise(_0x28bb38,_0x239bdf,_0x231cd6){return new BPromise(function(_0x3049f1,_0x471961){return client[_0x54c7('0x11')](_0x28bb38,_0x231cd6)['then'](function(_0x1d8311){logger['info'](_0x54c7('0x12'),_0x239bdf,'request\x20sent');logger[_0x54c7('0x13')](_0x54c7('0x14'),_0x239bdf,_0x54c7('0x15'),JSON['stringify'](_0x1d8311));if(_0x1d8311['error']){if(_0x1d8311[_0x54c7('0x16')][_0x54c7('0x17')]===0x1f4){logger[_0x54c7('0x16')](_0x54c7('0x12'),_0x239bdf,_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);return _0x471961(_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);}logger[_0x54c7('0x16')](_0x54c7('0x12'),_0x239bdf,_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);return _0x3049f1(_0x1d8311[_0x54c7('0x16')][_0x54c7('0x18')]);}else{logger['info'](_0x54c7('0x12'),_0x239bdf,_0x54c7('0x15'));_0x3049f1(_0x1d8311[_0x54c7('0x19')][_0x54c7('0x18')]);}})[_0x54c7('0x1a')](function(_0x54c99f){logger[_0x54c7('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x239bdf,_0x54c99f);_0x471961(_0x54c99f);});});}exports[_0x54c7('0x1b')]=function(_0x96303){var _0x42899e=this;return new Promise(function(_0x596087,_0x29bfe4){return db[_0x54c7('0x1c')][_0x54c7('0x1d')]({'raw':_0x96303['options']?_0x96303[_0x54c7('0x1e')][_0x54c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x96303['options']?_0x96303[_0x54c7('0x1e')][_0x54c7('0x20')]||null:null,'attributes':_0x96303[_0x54c7('0x1e')]?_0x96303[_0x54c7('0x1e')][_0x54c7('0x21')]||null:null,'limit':_0x96303[_0x54c7('0x1e')]?_0x96303[_0x54c7('0x1e')]['limit']||null:null,'include':_0x96303[_0x54c7('0x1e')]?_0x96303[_0x54c7('0x1e')][_0x54c7('0x22')]?_['map'](_0x96303[_0x54c7('0x1e')][_0x54c7('0x22')],function(_0x52e4b4){return{'model':db[_0x52e4b4[_0x54c7('0x23')]],'as':_0x52e4b4['as'],'attributes':_0x52e4b4[_0x54c7('0x21')],'include':_0x52e4b4[_0x54c7('0x22')]?_[_0x54c7('0x24')](_0x52e4b4['include'],function(_0x53b952){return{'model':db[_0x53b952[_0x54c7('0x23')]],'as':_0x53b952['as'],'attributes':_0x53b952[_0x54c7('0x21')],'include':_0x53b952['include']?_[_0x54c7('0x24')](_0x53b952[_0x54c7('0x22')],function(_0x430a10){return{'model':db[_0x430a10['model']],'as':_0x430a10['as'],'attributes':_0x430a10[_0x54c7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xff3885){logger['info']('GetVoiceQueue',_0x96303);logger['debug'](_0x54c7('0x1b'),_0x96303,JSON[_0x54c7('0x25')](_0xff3885));_0x596087(_0xff3885);})[_0x54c7('0x1a')](function(_0x57db46){logger[_0x54c7('0x16')]('GetVoiceQueue',_0x57db46[_0x54c7('0x18')],_0x96303);_0x29bfe4(_0x42899e[_0x54c7('0x16')](0x1f4,_0x57db46['message']));});});};exports[_0x54c7('0x26')]=function(_0x24135){var _0x133212=this;return new Promise(function(_0x1e984d,_0x3ca213){return db[_0x54c7('0x1c')][_0x54c7('0x27')]({'raw':_0x24135[_0x54c7('0x1e')]?_0x24135[_0x54c7('0x1e')][_0x54c7('0x1f')]===undefined?!![]:![]:!![],'where':_0x24135['options']?_0x24135[_0x54c7('0x1e')][_0x54c7('0x20')]||null:null,'attributes':_0x24135[_0x54c7('0x1e')]?_0x24135[_0x54c7('0x1e')][_0x54c7('0x21')]||null:null,'include':_0x24135[_0x54c7('0x1e')]?_0x24135[_0x54c7('0x1e')][_0x54c7('0x22')]?_[_0x54c7('0x24')](_0x24135[_0x54c7('0x1e')][_0x54c7('0x22')],function(_0xe8a222){return{'model':db[_0xe8a222['model']],'as':_0xe8a222['as'],'attributes':_0xe8a222[_0x54c7('0x21')],'include':_0xe8a222['include']?_['map'](_0xe8a222[_0x54c7('0x22')],function(_0x5e5109){return{'model':db[_0x5e5109[_0x54c7('0x23')]],'as':_0x5e5109['as'],'attributes':_0x5e5109['attributes'],'include':_0x5e5109['include']?_[_0x54c7('0x24')](_0x5e5109[_0x54c7('0x22')],function(_0x5bf6d3){return{'model':db[_0x5bf6d3[_0x54c7('0x23')]],'as':_0x5bf6d3['as'],'attributes':_0x5bf6d3[_0x54c7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2985f3){logger[_0x54c7('0x28')](_0x54c7('0x26'),_0x24135);logger['debug'](_0x54c7('0x26'),_0x24135,JSON[_0x54c7('0x25')](_0x2985f3));_0x1e984d(_0x2985f3);})[_0x54c7('0x1a')](function(_0x515e1b){logger[_0x54c7('0x16')]('ShowVoiceQueue',_0x515e1b[_0x54c7('0x18')],_0x24135);_0x3ca213(_0x133212[_0x54c7('0x16')](0x1f4,_0x515e1b[_0x54c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3dc0ed3..9710a0e 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 _0x2306=['save','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x3a04af,_0x26f941){var _0xe14d64=function(_0x4b844c){while(--_0x4b844c){_0x3a04af['push'](_0x3a04af['shift']());}};_0xe14d64(++_0x26f941);}(_0x2306,0x117));var _0x6230=function(_0x59d1a6,_0x1f450b){_0x59d1a6=_0x59d1a6-0x0;var _0x4acc66=_0x2306[_0x59d1a6];return _0x4acc66;};'use strict';var VoiceQueueEvents=require(_0x6230('0x0'));var events=[_0x6230('0x1'),'remove','update'];function createListener(_0xc5cfc7,_0x1bd659){return function(_0x1ba87b){_0x1bd659[_0x6230('0x2')](_0xc5cfc7,_0x1ba87b);};}function removeListener(_0x59e095,_0x3b02e0){return function(){VoiceQueueEvents[_0x6230('0x3')](_0x59e095,_0x3b02e0);};}exports[_0x6230('0x4')]=function(_0x718adb){for(var _0x1066db=0x0,_0x4501c7=events[_0x6230('0x5')];_0x1066db<_0x4501c7;_0x1066db++){var _0x46446b=events[_0x1066db];var _0x2892e2=createListener(_0x6230('0x6')+_0x46446b,_0x718adb);VoiceQueueEvents['on'](_0x46446b,_0x2892e2);}}; \ No newline at end of file +var _0xd2ff=['emit','removeListener','length','voiceQueue:','remove'];(function(_0x3e5b7b,_0x1ca279){var _0x441af8=function(_0x3931e7){while(--_0x3931e7){_0x3e5b7b['push'](_0x3e5b7b['shift']());}};_0x441af8(++_0x1ca279);}(_0xd2ff,0xfe));var _0xfd2f=function(_0x15a3ad,_0x178cb4){_0x15a3ad=_0x15a3ad-0x0;var _0x2becb6=_0xd2ff[_0x15a3ad];return _0x2becb6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0xfd2f('0x0'),'update'];function createListener(_0x53be43,_0x38be21){return function(_0x1c0837){_0x38be21[_0xfd2f('0x1')](_0x53be43,_0x1c0837);};}function removeListener(_0x599860,_0x5a772e){return function(){VoiceQueueEvents[_0xfd2f('0x2')](_0x599860,_0x5a772e);};}exports['register']=function(_0x2f44ad){for(var _0x49b242=0x0,_0x2a127f=events[_0xfd2f('0x3')];_0x49b242<_0x2a127f;_0x49b242++){var _0x565860=events[_0x49b242];var _0x50beba=createListener(_0xfd2f('0x4')+_0x565860,_0x2f44ad);VoiceQueueEvents['on'](_0x565860,_0x50beba);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5793268..ef76768 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 _0xbf66=['getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/index'];(function(_0x374ea8,_0x444720){var _0x5bdf9f=function(_0x4f81b7){while(--_0x4f81b7){_0x374ea8['push'](_0x374ea8['shift']());}};_0x5bdf9f(++_0x444720);}(_0xbf66,0x1e5));var _0x6bf6=function(_0x32ba26,_0x2690b0){_0x32ba26=_0x32ba26-0x0;var _0x4d666c=_0xbf66[_0x32ba26];return _0x4d666c;};'use strict';var multer=require(_0x6bf6('0x0'));var util=require(_0x6bf6('0x1'));var path=require('path');var timeout=require(_0x6bf6('0x2'));var express=require(_0x6bf6('0x3'));var router=express[_0x6bf6('0x4')]();var fs_extra=require(_0x6bf6('0x5'));var auth=require(_0x6bf6('0x6'));var interaction=require(_0x6bf6('0x7'));var config=require(_0x6bf6('0x8'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x6bf6('0x9')](),controller[_0x6bf6('0xa')]);router['get'](_0x6bf6('0xb'),auth[_0x6bf6('0x9')](),controller[_0x6bf6('0xc')]);router[_0x6bf6('0xd')](_0x6bf6('0xe'),auth[_0x6bf6('0x9')](),controller[_0x6bf6('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6bf6('0x10')]);router[_0x6bf6('0x11')]('/',auth[_0x6bf6('0x9')](),controller[_0x6bf6('0x12')]);router[_0x6bf6('0x13')](_0x6bf6('0x14'),auth[_0x6bf6('0x9')](),controller[_0x6bf6('0x15')]);router[_0x6bf6('0x16')](_0x6bf6('0x14'),auth['isAuthenticated'](),controller[_0x6bf6('0x17')]);module[_0x6bf6('0x18')]=router; \ No newline at end of file +var _0x14e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','/:id','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x401886,_0x356024){var _0x1713b8=function(_0x5f5769){while(--_0x5f5769){_0x401886['push'](_0x401886['shift']());}};_0x1713b8(++_0x356024);}(_0x14e5,0x15f));var _0x514e=function(_0x26641c,_0x1ba2a5){_0x26641c=_0x26641c-0x0;var _0x42c01a=_0x14e5[_0x26641c];return _0x42c01a;};'use strict';var multer=require(_0x514e('0x0'));var util=require(_0x514e('0x1'));var path=require('path');var timeout=require(_0x514e('0x2'));var express=require(_0x514e('0x3'));var router=express[_0x514e('0x4')]();var fs_extra=require(_0x514e('0x5'));var auth=require(_0x514e('0x6'));var interaction=require(_0x514e('0x7'));var config=require(_0x514e('0x8'));var controller=require(_0x514e('0x9'));router[_0x514e('0xa')]('/',auth[_0x514e('0xb')](),controller[_0x514e('0xc')]);router[_0x514e('0xa')]('/describe',auth[_0x514e('0xb')](),controller[_0x514e('0xd')]);router[_0x514e('0xa')](_0x514e('0xe'),auth[_0x514e('0xb')](),controller['getVoiceQueuesReport']);router[_0x514e('0xa')](_0x514e('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x514e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x514e('0x11')]('/:id',auth[_0x514e('0xb')](),controller[_0x514e('0x12')]);router[_0x514e('0x13')](_0x514e('0xf'),auth[_0x514e('0xb')](),controller[_0x514e('0x14')]);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 cb2086e..367cfe9 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 _0xfe75=['diff','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0xfe75,0xdd));var _0x5fe7=function(_0x34196c,_0x98d7b2){_0x34196c=_0x34196c-0x0;var _0x5285dd=_0xfe75[_0x34196c];return _0x5285dd;};'use strict';var Sequelize=require(_0x5fe7('0x0'));var moment=require(_0x5fe7('0x1'));module[_0x5fe7('0x2')]={'type':{'type':Sequelize[_0x5fe7('0x3')]},'uniqueid':{'type':Sequelize[_0x5fe7('0x3')]},'calleridnum':{'type':Sequelize[_0x5fe7('0x3')]},'calleridname':{'type':Sequelize[_0x5fe7('0x3')]},'queue':{'type':Sequelize[_0x5fe7('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5fe7('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5fe7('0x4')],'set':function(_0x49984e){var _0x4c7cac=moment(_0x49984e);var _0x8ed561=moment(this['getDataValue'](_0x5fe7('0x5')))[_0x5fe7('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1cbc21=_0x4c7cac[_0x5fe7('0x7')](_0x8ed561,'seconds');this[_0x5fe7('0x8')](_0x5fe7('0x9'),_0x49984e);this[_0x5fe7('0x8')]('holdtime',_0x1cbc21||null);}},'position':{'type':Sequelize[_0x5fe7('0xa')]},'count':{'type':Sequelize[_0x5fe7('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x5fe7('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5fe7('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x5fe7('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5fe7('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5fe7('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5fe7('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5fe7('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x5fe7('0xa')]},'channel':{'type':Sequelize[_0x5fe7('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5fe7('0x3')]},'connectedlinename':{'type':Sequelize[_0x5fe7('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5fe7('0x3')]},'exten':{'type':Sequelize[_0x5fe7('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x5fe7('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5fe7('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5fe7('0x3')]},'transfer':{'type':Sequelize[_0x5fe7('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5fe7('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5fe7('0x3')]},'disposition':{'type':Sequelize[_0x5fe7('0x3')]},'secondDisposition':{'type':Sequelize[_0x5fe7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5fe7('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x5fe7('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x5fe7('0x3')]}}; \ No newline at end of file +var _0xc3e4=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xc3e4,0xfa));var _0x4c3e=function(_0x166d1c,_0x4daa0b){_0x166d1c=_0x166d1c-0x0;var _0x1070ff=_0xc3e4[_0x166d1c];return _0x1070ff;};'use strict';var Sequelize=require(_0x4c3e('0x0'));var moment=require(_0x4c3e('0x1'));module[_0x4c3e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4c3e('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4c3e('0x3')]},'queue':{'type':Sequelize[_0x4c3e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x4c3e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4c3e('0x4')],'set':function(_0x181ca2){var _0x1c4491=moment(_0x181ca2);var _0x2650d7=moment(this[_0x4c3e('0x5')](_0x4c3e('0x6')))[_0x4c3e('0x7')](_0x4c3e('0x8'));var _0x260fd8=_0x1c4491[_0x4c3e('0x9')](_0x2650d7,_0x4c3e('0xa'));this[_0x4c3e('0xb')](_0x4c3e('0xc'),_0x181ca2);this[_0x4c3e('0xb')](_0x4c3e('0xd'),_0x260fd8||null);}},'position':{'type':Sequelize[_0x4c3e('0xe')]},'count':{'type':Sequelize[_0x4c3e('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4c3e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4c3e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4c3e('0x3')],'comment':_0x4c3e('0x10')},'originalposition':{'type':Sequelize[_0x4c3e('0xe')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4c3e('0x3')]},'accountcode':{'type':Sequelize[_0x4c3e('0x3')]},'context':{'type':Sequelize[_0x4c3e('0x3')]},'exten':{'type':Sequelize[_0x4c3e('0x3')]},'priority':{'type':Sequelize[_0x4c3e('0x3')]},'holdtime':{'type':Sequelize[_0x4c3e('0xe')]},'mohtime':{'type':Sequelize[_0x4c3e('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4c3e('0x3')]},'transfer':{'type':Sequelize[_0x4c3e('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4c3e('0x3')],'comment':_0x4c3e('0x11')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x4c3e('0x3')]},'secondDisposition':{'type':Sequelize[_0x4c3e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x4c3e('0xe')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index cb01b9b..657959f 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 _0x722a=['pick','merge','map','VIRTUAL','include','then','catch','show','params','includeAll','options','find','create','body','describe','getVoiceQueuesReport','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x40d79b,_0x22a83d){var _0x3ff7a7=function(_0x48e8ae){while(--_0x48e8ae){_0x40d79b['push'](_0x40d79b['shift']());}};_0x3ff7a7(++_0x22a83d);}(_0x722a,0x1a1));var _0xa722=function(_0x161cf8,_0x5dd73a){_0x161cf8=_0x161cf8-0x0;var _0x32c491=_0x722a[_0x161cf8];return _0x32c491;};'use strict';var emlformat=require(_0xa722('0x0'));var rimraf=require(_0xa722('0x1'));var zipdir=require(_0xa722('0x2'));var jsonpatch=require(_0xa722('0x3'));var rp=require(_0xa722('0x4'));var moment=require(_0xa722('0x5'));var BPromise=require(_0xa722('0x6'));var Mustache=require('mustache');var util=require(_0xa722('0x7'));var path=require(_0xa722('0x8'));var sox=require(_0xa722('0x9'));var csv=require(_0xa722('0xa'));var ejs=require(_0xa722('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa722('0xc'));var squel=require(_0xa722('0xd'));var crypto=require('crypto');var jsforce=require(_0xa722('0xe'));var deskjs=require(_0xa722('0xf'));var toCsv=require(_0xa722('0xa'));var querystring=require(_0xa722('0x10'));var Papa=require(_0xa722('0x11'));var Redis=require('ioredis');var authService=require(_0xa722('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa722('0x13'));var hardwareService=require(_0xa722('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa722('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa722('0x16'))['db'];config[_0xa722('0x17')]=_[_0xa722('0x18')](config[_0xa722('0x17')],{'host':_0xa722('0x19'),'port':0x18eb});var socket=require(_0xa722('0x1a'))(new Redis(config[_0xa722('0x17')]));require(_0xa722('0x1b'))['register'](socket);function respondWithStatusCode(_0x2bce67,_0x2f0a31){_0x2f0a31=_0x2f0a31||0xcc;return function(_0xa5c071){if(_0xa5c071){return _0x2bce67[_0xa722('0x1c')](_0x2f0a31);}return _0x2bce67[_0xa722('0x1d')](_0x2f0a31)[_0xa722('0x1e')]();};}function respondWithResult(_0x17a2d8,_0x7623a4){_0x7623a4=_0x7623a4||0xc8;return function(_0x10a0ab){if(_0x10a0ab){return _0x17a2d8[_0xa722('0x1d')](_0x7623a4)[_0xa722('0x1f')](_0x10a0ab);}};}function respondWithFilteredResult(_0x30136c,_0x2e232e){return function(_0x546469){if(_0x546469){var _0x5df07a=typeof _0x2e232e[_0xa722('0x20')]===_0xa722('0x21')&&typeof _0x2e232e[_0xa722('0x22')]===_0xa722('0x21');var _0x270be3=_0x546469[_0xa722('0x23')];var _0x473f81=_0x5df07a?0x0:_0x2e232e[_0xa722('0x20')];var _0x5efb28=_0x5df07a?_0x546469['count']:_0x2e232e[_0xa722('0x20')]+_0x2e232e['limit'];var _0x38c11c;if(_0x5efb28>=_0x270be3){_0x5efb28=_0x270be3;_0x38c11c=0xc8;}else{_0x38c11c=0xce;}_0x30136c[_0xa722('0x1d')](_0x38c11c);return _0x30136c[_0xa722('0x24')](_0xa722('0x25'),_0x473f81+'-'+_0x5efb28+'/'+_0x270be3)[_0xa722('0x1f')](_0x546469);}return null;};}function patchUpdates(_0x2d2d1b){return function(_0x4564c5){try{jsonpatch['apply'](_0x4564c5,_0x2d2d1b,!![]);}catch(_0x2c2016){return BPromise[_0xa722('0x26')](_0x2c2016);}return _0x4564c5[_0xa722('0x27')]();};}function saveUpdates(_0x28de5e,_0x417cd9){return function(_0x5aad75){if(_0x5aad75){return _0x5aad75[_0xa722('0x28')](_0x28de5e)['then'](function(_0x1564ce){return _0x1564ce;});}return null;};}function removeEntity(_0x4d41e5,_0x561d54){return function(_0x52b7a8){if(_0x52b7a8){return _0x52b7a8[_0xa722('0x29')]()['then'](function(){_0x4d41e5[_0xa722('0x1d')](0xcc)[_0xa722('0x1e')]();});}};}function handleEntityNotFound(_0x3ba12d,_0x2703db){return function(_0x18891f){if(!_0x18891f){_0x3ba12d['sendStatus'](0x194);}return _0x18891f;};}function handleError(_0x108d25,_0x396ac1){_0x396ac1=_0x396ac1||0x1f4;return function(_0x4f942e){logger[_0xa722('0x2a')](_0x4f942e[_0xa722('0x2b')]);if(_0x4f942e[_0xa722('0x2c')]){delete _0x4f942e['name'];}_0x108d25[_0xa722('0x1d')](_0x396ac1)[_0xa722('0x2d')](_0x4f942e);};}exports['index']=function(_0x473be3,_0x2c94e3){var _0x1bfa99={},_0x176bd6={},_0x1f6dce={'count':0x0,'rows':[]};var _0x41fe89=_['map'](db[_0xa722('0x2e')][_0xa722('0x2f')],function(_0xd43f53){return{'name':_0xd43f53[_0xa722('0x30')],'type':_0xd43f53['type'][_0xa722('0x31')]};});_0x176bd6[_0xa722('0x32')]=_['map'](_0x41fe89,'name');_0x176bd6[_0xa722('0x33')]=_[_0xa722('0x34')](_0x473be3[_0xa722('0x33')]);_0x176bd6[_0xa722('0x35')]=_[_0xa722('0x36')](_0x176bd6[_0xa722('0x32')],_0x176bd6[_0xa722('0x33')]);_0x1bfa99[_0xa722('0x37')]=_[_0xa722('0x36')](_0x176bd6[_0xa722('0x32')],qs[_0xa722('0x38')](_0x473be3['query'][_0xa722('0x38')]));_0x1bfa99[_0xa722('0x37')]=_0x1bfa99[_0xa722('0x37')][_0xa722('0x39')]?_0x1bfa99['attributes']:_0x176bd6[_0xa722('0x32')];if(!_0x473be3[_0xa722('0x33')][_0xa722('0x3a')](_0xa722('0x3b'))){_0x1bfa99[_0xa722('0x22')]=qs[_0xa722('0x22')](_0x473be3[_0xa722('0x33')]['limit']);_0x1bfa99[_0xa722('0x20')]=qs['offset'](_0x473be3[_0xa722('0x33')][_0xa722('0x20')]);}_0x1bfa99[_0xa722('0x3c')]=qs[_0xa722('0x3d')](_0x473be3['query'][_0xa722('0x3d')]);_0x1bfa99[_0xa722('0x3e')]=qs[_0xa722('0x35')](_[_0xa722('0x3f')](_0x473be3['query'],_0x176bd6[_0xa722('0x35')]),_0x41fe89);if(_0x473be3[_0xa722('0x33')]['filter']){_0x1bfa99[_0xa722('0x3e')]=_[_0xa722('0x40')](_0x1bfa99['where'],{'$or':_[_0xa722('0x41')](_0x41fe89,function(_0x431961){if(_0x431961['type']!==_0xa722('0x42')){var _0x19f284={};_0x19f284[_0x431961['name']]={'$like':'%'+_0x473be3['query']['filter']+'%'};return _0x19f284;}})});}_0x1bfa99=_[_0xa722('0x40')]({},_0x1bfa99,_0x473be3['options']);var _0x59e36b={'where':_0x1bfa99[_0xa722('0x3e')]};return db[_0xa722('0x2e')][_0xa722('0x23')](_0x59e36b)['then'](function(_0x5f19ad){_0x1f6dce[_0xa722('0x23')]=_0x5f19ad;if(_0x473be3[_0xa722('0x33')]['includeAll']){_0x1bfa99[_0xa722('0x43')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1bfa99);})['then'](function(_0x3cdf63){_0x1f6dce['rows']=_0x3cdf63;return _0x1f6dce;})[_0xa722('0x44')](respondWithFilteredResult(_0x2c94e3,_0x1bfa99))[_0xa722('0x45')](handleError(_0x2c94e3,null));};exports[_0xa722('0x46')]=function(_0x4d02b0,_0x588f97){var _0x3ee7ef={'raw':![],'where':{'id':_0x4d02b0[_0xa722('0x47')]['id']}},_0x305a2c={};_0x305a2c[_0xa722('0x32')]=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x305a2c['query']=_[_0xa722('0x34')](_0x4d02b0[_0xa722('0x33')]);_0x305a2c['filters']=_['intersection'](_0x305a2c[_0xa722('0x32')],_0x305a2c['query']);_0x3ee7ef[_0xa722('0x37')]=_[_0xa722('0x36')](_0x305a2c['model'],qs[_0xa722('0x38')](_0x4d02b0[_0xa722('0x33')][_0xa722('0x38')]));_0x3ee7ef[_0xa722('0x37')]=_0x3ee7ef[_0xa722('0x37')][_0xa722('0x39')]?_0x3ee7ef[_0xa722('0x37')]:_0x305a2c[_0xa722('0x32')];if(_0x4d02b0[_0xa722('0x33')][_0xa722('0x48')]){_0x3ee7ef[_0xa722('0x43')]=[{'all':!![]}];}_0x3ee7ef=_[_0xa722('0x40')]({},_0x3ee7ef,_0x4d02b0[_0xa722('0x49')]);return db['VoiceQueueReport'][_0xa722('0x4a')](_0x3ee7ef)['then'](handleEntityNotFound(_0x588f97,null))['then'](respondWithResult(_0x588f97,null))[_0xa722('0x45')](handleError(_0x588f97,null));};exports[_0xa722('0x4b')]=function(_0x5a6127,_0x371eb9){return db[_0xa722('0x2e')][_0xa722('0x4b')](_0x5a6127[_0xa722('0x4c')],{})[_0xa722('0x44')](respondWithResult(_0x371eb9,0xc9))['catch'](handleError(_0x371eb9,null));};exports['update']=function(_0x4b482d,_0x3bcd65){if(_0x4b482d['body']['id']){delete _0x4b482d[_0xa722('0x4c')]['id'];}return db['VoiceQueueReport'][_0xa722('0x4a')]({'where':{'id':_0x4b482d[_0xa722('0x47')]['id']}})[_0xa722('0x44')](handleEntityNotFound(_0x3bcd65,null))[_0xa722('0x44')](saveUpdates(_0x4b482d[_0xa722('0x4c')],null))[_0xa722('0x44')](respondWithResult(_0x3bcd65,null))[_0xa722('0x45')](handleError(_0x3bcd65,null));};exports[_0xa722('0x29')]=function(_0x1ccccb,_0x18db28){return db[_0xa722('0x2e')][_0xa722('0x4a')]({'where':{'id':_0x1ccccb['params']['id']}})[_0xa722('0x44')](handleEntityNotFound(_0x18db28,null))[_0xa722('0x44')](removeEntity(_0x18db28,null))['catch'](handleError(_0x18db28,null));};exports[_0xa722('0x4d')]=function(_0x7d5892,_0x5d5561){return db['VoiceQueueReport'][_0xa722('0x4d')]()['then'](respondWithResult(_0x5d5561,null))['catch'](handleError(_0x5d5561,null));};exports[_0xa722('0x4e')]=function(_0x3e2581,_0x51fb15){var _0x5514a9={},_0x20a163={},_0xc05fbc={'count':0x0,'rows':[]};_0x20a163[_0xa722('0x32')]=_[_0xa722('0x34')](db[_0xa722('0x2e')][_0xa722('0x2f')]);_0x20a163[_0xa722('0x33')]=_[_0xa722('0x34')](_0x3e2581[_0xa722('0x33')]);_0x20a163[_0xa722('0x35')]=_[_0xa722('0x36')](_0x20a163['model'],_0x20a163[_0xa722('0x33')]);_0x5514a9[_0xa722('0x37')]=_['intersection'](_0x20a163[_0xa722('0x32')],qs[_0xa722('0x38')](_0x3e2581[_0xa722('0x33')][_0xa722('0x38')]));_0x5514a9[_0xa722('0x37')]=_0x5514a9[_0xa722('0x37')][_0xa722('0x39')]?_0x5514a9[_0xa722('0x37')]:_0x20a163[_0xa722('0x32')];if(!_0x3e2581['query']['hasOwnProperty'](_0xa722('0x3b'))){_0x5514a9[_0xa722('0x22')]=qs['limit'](_0x3e2581[_0xa722('0x33')]['limit']);_0x5514a9['offset']=qs['offset'](_0x3e2581[_0xa722('0x33')]['offset']);}_0x5514a9[_0xa722('0x3c')]=qs['sort'](_0x3e2581[_0xa722('0x33')][_0xa722('0x3d')]);_0x5514a9['where']=qs[_0xa722('0x35')](_[_0xa722('0x3f')](_0x3e2581[_0xa722('0x33')],_0x20a163[_0xa722('0x35')]));if(_0x3e2581[_0xa722('0x33')]['filter']){_0x5514a9[_0xa722('0x3e')]=_[_0xa722('0x40')](_0x5514a9[_0xa722('0x3e')],{'$or':_[_0xa722('0x41')](_0x5514a9[_0xa722('0x37')],function(_0x15bb35){var _0x3ae7a0={};_0x3ae7a0[_0x15bb35]={'$like':'%'+_0x3e2581['query']['filter']+'%'};return _0x3ae7a0;})});}_0x5514a9=_[_0xa722('0x40')]({},_0x5514a9,_0x3e2581[_0xa722('0x49')]);var _0xd165cf={'where':_0x5514a9[_0xa722('0x3e')]};return db[_0xa722('0x2e')][_0xa722('0x23')](_0xd165cf)[_0xa722('0x44')](function(_0x1afb83){_0xc05fbc[_0xa722('0x23')]=_0x1afb83;if(_0x3e2581[_0xa722('0x33')]['includeAll']){_0x5514a9[_0xa722('0x43')]=[{'all':!![]}];}return db[_0xa722('0x2e')]['findAll'](_0x5514a9);})[_0xa722('0x44')](function(_0x329b62){_0xc05fbc[_0xa722('0x4f')]=_0x329b62;return _0xc05fbc;})['then'](respondWithFilteredResult(_0x51fb15,_0x5514a9,_0xa722('0x4e')))[_0xa722('0x45')](handleError(_0x51fb15,null,_0xa722('0x4e')));}; \ No newline at end of file +var _0x2647=['describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','filters','include','find','create','body'];(function(_0x5a3775,_0x2c9777){var _0x39efe4=function(_0x35af52){while(--_0x35af52){_0x5a3775['push'](_0x5a3775['shift']());}};_0x39efe4(++_0x2c9777);}(_0x2647,0xac));var _0x7264=function(_0x4287b0,_0x5e551c){_0x4287b0=_0x4287b0-0x0;var _0x1e6a1e=_0x2647[_0x4287b0];return _0x1e6a1e;};'use strict';var emlformat=require(_0x7264('0x0'));var rimraf=require(_0x7264('0x1'));var zipdir=require(_0x7264('0x2'));var jsonpatch=require(_0x7264('0x3'));var rp=require(_0x7264('0x4'));var moment=require(_0x7264('0x5'));var BPromise=require(_0x7264('0x6'));var Mustache=require('mustache');var util=require(_0x7264('0x7'));var path=require('path');var sox=require(_0x7264('0x8'));var csv=require('to-csv');var ejs=require(_0x7264('0x9'));var fs=require('fs');var fs_extra=require(_0x7264('0xa'));var _=require('lodash');var squel=require(_0x7264('0xb'));var crypto=require('crypto');var jsforce=require(_0x7264('0xc'));var deskjs=require(_0x7264('0xd'));var toCsv=require(_0x7264('0xe'));var querystring=require('querystring');var Papa=require(_0x7264('0xf'));var Redis=require(_0x7264('0x10'));var authService=require(_0x7264('0x11'));var qs=require(_0x7264('0x12'));var as=require(_0x7264('0x13'));var hardwareService=require(_0x7264('0x14'));var logger=require(_0x7264('0x15'))(_0x7264('0x16'));var utils=require(_0x7264('0x17'));var config=require(_0x7264('0x18'));var licenseUtil=require(_0x7264('0x19'));var db=require(_0x7264('0x1a'))['db'];config[_0x7264('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7264('0x1c'))(new Redis(config[_0x7264('0x1b')]));require(_0x7264('0x1d'))['register'](socket);function respondWithStatusCode(_0x6ce5bb,_0x1cf808){_0x1cf808=_0x1cf808||0xcc;return function(_0x38a46f){if(_0x38a46f){return _0x6ce5bb[_0x7264('0x1e')](_0x1cf808);}return _0x6ce5bb[_0x7264('0x1f')](_0x1cf808)['end']();};}function respondWithResult(_0xd32dbf,_0x37508b){_0x37508b=_0x37508b||0xc8;return function(_0x34c773){if(_0x34c773){return _0xd32dbf[_0x7264('0x1f')](_0x37508b)[_0x7264('0x20')](_0x34c773);}};}function respondWithFilteredResult(_0xd69cb7,_0x411d3e){return function(_0x34c8f0){if(_0x34c8f0){var _0x39568a=typeof _0x411d3e['offset']==='undefined'&&typeof _0x411d3e[_0x7264('0x21')]===_0x7264('0x22');var _0x21ca10=_0x34c8f0[_0x7264('0x23')];var _0x161e9a=_0x39568a?0x0:_0x411d3e[_0x7264('0x24')];var _0xb4bc3c=_0x39568a?_0x34c8f0[_0x7264('0x23')]:_0x411d3e[_0x7264('0x24')]+_0x411d3e[_0x7264('0x21')];var _0x2b3774;if(_0xb4bc3c>=_0x21ca10){_0xb4bc3c=_0x21ca10;_0x2b3774=0xc8;}else{_0x2b3774=0xce;}_0xd69cb7[_0x7264('0x1f')](_0x2b3774);return _0xd69cb7[_0x7264('0x25')](_0x7264('0x26'),_0x161e9a+'-'+_0xb4bc3c+'/'+_0x21ca10)[_0x7264('0x20')](_0x34c8f0);}return null;};}function patchUpdates(_0x2dd415){return function(_0x3fa305){try{jsonpatch['apply'](_0x3fa305,_0x2dd415,!![]);}catch(_0x3c27e0){return BPromise[_0x7264('0x27')](_0x3c27e0);}return _0x3fa305[_0x7264('0x28')]();};}function saveUpdates(_0x4b2708,_0x290c00){return function(_0x327785){if(_0x327785){return _0x327785[_0x7264('0x29')](_0x4b2708)[_0x7264('0x2a')](function(_0x2ddce3){return _0x2ddce3;});}return null;};}function removeEntity(_0x50c366,_0x372bf8){return function(_0x1c7725){if(_0x1c7725){return _0x1c7725[_0x7264('0x2b')]()['then'](function(){_0x50c366['status'](0xcc)[_0x7264('0x2c')]();});}};}function handleEntityNotFound(_0x25f8c7,_0x59ef1c){return function(_0x4dd57b){if(!_0x4dd57b){_0x25f8c7[_0x7264('0x1e')](0x194);}return _0x4dd57b;};}function handleError(_0x175219,_0x2ecda4){_0x2ecda4=_0x2ecda4||0x1f4;return function(_0x5c0b49){logger[_0x7264('0x2d')](_0x5c0b49[_0x7264('0x2e')]);if(_0x5c0b49['name']){delete _0x5c0b49['name'];}_0x175219[_0x7264('0x1f')](_0x2ecda4)['send'](_0x5c0b49);};}exports[_0x7264('0x2f')]=function(_0x37b810,_0x420a1f){var _0x138c16={},_0x578830={},_0x5267e7={'count':0x0,'rows':[]};var _0x862240=_[_0x7264('0x30')](db[_0x7264('0x31')][_0x7264('0x32')],function(_0x27fce3){return{'name':_0x27fce3[_0x7264('0x33')],'type':_0x27fce3[_0x7264('0x34')][_0x7264('0x35')]};});_0x578830[_0x7264('0x36')]=_['map'](_0x862240,_0x7264('0x37'));_0x578830[_0x7264('0x38')]=_[_0x7264('0x39')](_0x37b810[_0x7264('0x38')]);_0x578830['filters']=_[_0x7264('0x3a')](_0x578830[_0x7264('0x36')],_0x578830[_0x7264('0x38')]);_0x138c16['attributes']=_[_0x7264('0x3a')](_0x578830[_0x7264('0x36')],qs['fields'](_0x37b810[_0x7264('0x38')][_0x7264('0x3b')]));_0x138c16[_0x7264('0x3c')]=_0x138c16[_0x7264('0x3c')][_0x7264('0x3d')]?_0x138c16[_0x7264('0x3c')]:_0x578830[_0x7264('0x36')];if(!_0x37b810[_0x7264('0x38')][_0x7264('0x3e')](_0x7264('0x3f'))){_0x138c16[_0x7264('0x21')]=qs['limit'](_0x37b810['query'][_0x7264('0x21')]);_0x138c16[_0x7264('0x24')]=qs[_0x7264('0x24')](_0x37b810['query']['offset']);}_0x138c16[_0x7264('0x40')]=qs[_0x7264('0x41')](_0x37b810[_0x7264('0x38')]['sort']);_0x138c16[_0x7264('0x42')]=qs['filters'](_[_0x7264('0x43')](_0x37b810[_0x7264('0x38')],_0x578830['filters']),_0x862240);if(_0x37b810[_0x7264('0x38')][_0x7264('0x44')]){_0x138c16['where']=_['merge'](_0x138c16['where'],{'$or':_[_0x7264('0x30')](_0x862240,function(_0x34a9f4){if(_0x34a9f4[_0x7264('0x34')]!==_0x7264('0x45')){var _0x48c374={};_0x48c374[_0x34a9f4[_0x7264('0x37')]]={'$like':'%'+_0x37b810[_0x7264('0x38')][_0x7264('0x44')]+'%'};return _0x48c374;}})});}_0x138c16=_[_0x7264('0x46')]({},_0x138c16,_0x37b810[_0x7264('0x47')]);var _0x2e0785={'where':_0x138c16['where']};return db[_0x7264('0x31')][_0x7264('0x23')](_0x2e0785)[_0x7264('0x2a')](function(_0x5c9849){_0x5267e7['count']=_0x5c9849;if(_0x37b810[_0x7264('0x38')][_0x7264('0x48')]){_0x138c16['include']=[{'all':!![]}];}return db[_0x7264('0x31')][_0x7264('0x49')](_0x138c16);})[_0x7264('0x2a')](function(_0x48246d){_0x5267e7[_0x7264('0x4a')]=_0x48246d;return _0x5267e7;})[_0x7264('0x2a')](respondWithFilteredResult(_0x420a1f,_0x138c16))[_0x7264('0x4b')](handleError(_0x420a1f,null));};exports[_0x7264('0x4c')]=function(_0xc5bd46,_0xefef7c){var _0x2c3f66={'raw':![],'where':{'id':_0xc5bd46[_0x7264('0x4d')]['id']}},_0x11ecf3={};_0x11ecf3[_0x7264('0x36')]=_['keys'](db['VoiceQueueReport'][_0x7264('0x32')]);_0x11ecf3['query']=_[_0x7264('0x39')](_0xc5bd46['query']);_0x11ecf3[_0x7264('0x4e')]=_['intersection'](_0x11ecf3[_0x7264('0x36')],_0x11ecf3[_0x7264('0x38')]);_0x2c3f66[_0x7264('0x3c')]=_[_0x7264('0x3a')](_0x11ecf3[_0x7264('0x36')],qs[_0x7264('0x3b')](_0xc5bd46[_0x7264('0x38')][_0x7264('0x3b')]));_0x2c3f66['attributes']=_0x2c3f66['attributes'][_0x7264('0x3d')]?_0x2c3f66[_0x7264('0x3c')]:_0x11ecf3[_0x7264('0x36')];if(_0xc5bd46['query'][_0x7264('0x48')]){_0x2c3f66[_0x7264('0x4f')]=[{'all':!![]}];}_0x2c3f66=_[_0x7264('0x46')]({},_0x2c3f66,_0xc5bd46['options']);return db[_0x7264('0x31')][_0x7264('0x50')](_0x2c3f66)['then'](handleEntityNotFound(_0xefef7c,null))[_0x7264('0x2a')](respondWithResult(_0xefef7c,null))['catch'](handleError(_0xefef7c,null));};exports[_0x7264('0x51')]=function(_0xa03de0,_0x415ccd){return db[_0x7264('0x31')][_0x7264('0x51')](_0xa03de0['body'],{})[_0x7264('0x2a')](respondWithResult(_0x415ccd,0xc9))[_0x7264('0x4b')](handleError(_0x415ccd,null));};exports['update']=function(_0x1787e5,_0x12fec4){if(_0x1787e5['body']['id']){delete _0x1787e5[_0x7264('0x52')]['id'];}return db[_0x7264('0x31')]['find']({'where':{'id':_0x1787e5[_0x7264('0x4d')]['id']}})[_0x7264('0x2a')](handleEntityNotFound(_0x12fec4,null))[_0x7264('0x2a')](saveUpdates(_0x1787e5[_0x7264('0x52')],null))[_0x7264('0x2a')](respondWithResult(_0x12fec4,null))['catch'](handleError(_0x12fec4,null));};exports['destroy']=function(_0x44811e,_0x4ea6e4){return db[_0x7264('0x31')][_0x7264('0x50')]({'where':{'id':_0x44811e[_0x7264('0x4d')]['id']}})[_0x7264('0x2a')](handleEntityNotFound(_0x4ea6e4,null))[_0x7264('0x2a')](removeEntity(_0x4ea6e4,null))[_0x7264('0x4b')](handleError(_0x4ea6e4,null));};exports[_0x7264('0x53')]=function(_0x2d1898,_0x14dcd9){return db[_0x7264('0x31')]['describe']()['then'](respondWithResult(_0x14dcd9,null))[_0x7264('0x4b')](handleError(_0x14dcd9,null));};exports[_0x7264('0x54')]=function(_0x31a33a,_0x9a19c2){var _0x261988={},_0x364e88={},_0x2ab357={'count':0x0,'rows':[]};_0x364e88[_0x7264('0x36')]=_['keys'](db[_0x7264('0x31')][_0x7264('0x32')]);_0x364e88[_0x7264('0x38')]=_[_0x7264('0x39')](_0x31a33a[_0x7264('0x38')]);_0x364e88[_0x7264('0x4e')]=_[_0x7264('0x3a')](_0x364e88['model'],_0x364e88[_0x7264('0x38')]);_0x261988[_0x7264('0x3c')]=_[_0x7264('0x3a')](_0x364e88['model'],qs[_0x7264('0x3b')](_0x31a33a[_0x7264('0x38')]['fields']));_0x261988['attributes']=_0x261988[_0x7264('0x3c')][_0x7264('0x3d')]?_0x261988['attributes']:_0x364e88[_0x7264('0x36')];if(!_0x31a33a[_0x7264('0x38')][_0x7264('0x3e')](_0x7264('0x3f'))){_0x261988['limit']=qs[_0x7264('0x21')](_0x31a33a['query'][_0x7264('0x21')]);_0x261988[_0x7264('0x24')]=qs[_0x7264('0x24')](_0x31a33a[_0x7264('0x38')][_0x7264('0x24')]);}_0x261988['order']=qs[_0x7264('0x41')](_0x31a33a[_0x7264('0x38')][_0x7264('0x41')]);_0x261988[_0x7264('0x42')]=qs[_0x7264('0x4e')](_[_0x7264('0x43')](_0x31a33a[_0x7264('0x38')],_0x364e88[_0x7264('0x4e')]));if(_0x31a33a[_0x7264('0x38')][_0x7264('0x44')]){_0x261988['where']=_[_0x7264('0x46')](_0x261988[_0x7264('0x42')],{'$or':_[_0x7264('0x30')](_0x261988['attributes'],function(_0x2b270d){var _0x8c4e84={};_0x8c4e84[_0x2b270d]={'$like':'%'+_0x31a33a['query'][_0x7264('0x44')]+'%'};return _0x8c4e84;})});}_0x261988=_['merge']({},_0x261988,_0x31a33a['options']);var _0x4b781e={'where':_0x261988[_0x7264('0x42')]};return db[_0x7264('0x31')]['count'](_0x4b781e)[_0x7264('0x2a')](function(_0x564797){_0x2ab357[_0x7264('0x23')]=_0x564797;if(_0x31a33a[_0x7264('0x38')][_0x7264('0x48')]){_0x261988[_0x7264('0x4f')]=[{'all':!![]}];}return db[_0x7264('0x31')]['findAll'](_0x261988);})[_0x7264('0x2a')](function(_0x13bbb3){_0x2ab357[_0x7264('0x4a')]=_0x13bbb3;return _0x2ab357;})[_0x7264('0x2a')](respondWithFilteredResult(_0x9a19c2,_0x261988,'getVoiceQueuesReport'))['catch'](handleError(_0x9a19c2,null,_0x7264('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e59a654..6300558 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 _0x73a8=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x21b0ef,_0x2bec64){var _0x135500=function(_0x4d155){while(--_0x4d155){_0x21b0ef['push'](_0x21b0ef['shift']());}};_0x135500(++_0x2bec64);}(_0x73a8,0x1de));var _0x873a=function(_0x30948d,_0x1bfab3){_0x30948d=_0x30948d-0x0;var _0x6aab06=_0x73a8[_0x30948d];return _0x6aab06;};'use strict';var EventEmitter=require(_0x873a('0x0'));var VoiceQueueReport=require(_0x873a('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x873a('0x2')](0x0);var events={'afterCreate':_0x873a('0x3'),'afterUpdate':_0x873a('0x4'),'afterDestroy':_0x873a('0x5')};function emitEvent(_0x50db07){return function(_0x11f6ec,_0x4a4b8d,_0x116fd4){VoiceQueueReportEvents[_0x873a('0x6')](_0x50db07+':'+_0x11f6ec['id'],_0x11f6ec);VoiceQueueReportEvents['emit'](_0x50db07,_0x11f6ec);_0x116fd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x873a('0x7')](e,emitEvent(event));}}module[_0x873a('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4a84=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x582cf6,_0xb0834c){var _0x6d541a=function(_0x56ecbe){while(--_0x56ecbe){_0x582cf6['push'](_0x582cf6['shift']());}};_0x6d541a(++_0xb0834c);}(_0x4a84,0xf3));var _0x44a8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4a84[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x44a8('0x0'));var VoiceQueueReport=require(_0x44a8('0x1'))['db'][_0x44a8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x44a8('0x3')](0x0);var events={'afterCreate':_0x44a8('0x4'),'afterUpdate':'update','afterDestroy':_0x44a8('0x5')};function emitEvent(_0x294048){return function(_0x52ff6a,_0x239f37,_0x101941){VoiceQueueReportEvents[_0x44a8('0x6')](_0x294048+':'+_0x52ff6a['id'],_0x52ff6a);VoiceQueueReportEvents[_0x44a8('0x6')](_0x294048,_0x52ff6a);_0x101941(null);};}for(var e in events){if(events[_0x44a8('0x7')](e)){var event=events[e];VoiceQueueReport[_0x44a8('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8380495..e99b5ff 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 _0x82db=['calleridnum','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid'];(function(_0x2cfe35,_0x319232){var _0x3bb9ec=function(_0x2d2b80){while(--_0x2d2b80){_0x2cfe35['push'](_0x2cfe35['shift']());}};_0x3bb9ec(++_0x319232);}(_0x82db,0xf1));var _0xb82d=function(_0x24f8c7,_0x599a67){_0x24f8c7=_0x24f8c7-0x0;var _0x38f7ff=_0x82db[_0x24f8c7];return _0x38f7ff;};'use strict';var _=require(_0xb82d('0x0'));var util=require(_0xb82d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb82d('0x2'));var BPromise=require('bluebird');var rp=require(_0xb82d('0x3'));var fs=require('fs');var path=require(_0xb82d('0x4'));var rimraf=require(_0xb82d('0x5'));var config=require(_0xb82d('0x6'));var attributes=require(_0xb82d('0x7'));module[_0xb82d('0x8')]=function(_0x4e20f3,_0x537bcf){return _0x4e20f3['define']('VoiceQueueReport',attributes,{'tableName':_0xb82d('0x9'),'paranoid':![],'indexes':[{'fields':[_0xb82d('0xa')]},{'fields':[_0xb82d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31ca=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','calleridnum','lodash','util','../../config/logger','api'];(function(_0x17e1dc,_0x495627){var _0x17dd25=function(_0x535bac){while(--_0x535bac){_0x17e1dc['push'](_0x17e1dc['shift']());}};_0x17dd25(++_0x495627);}(_0x31ca,0x14e));var _0xa31c=function(_0x56ebf2,_0x4a7b69){_0x56ebf2=_0x56ebf2-0x0;var _0x27f0fb=_0x31ca[_0x56ebf2];return _0x27f0fb;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var logger=require(_0xa31c('0x2'))(_0xa31c('0x3'));var moment=require(_0xa31c('0x4'));var BPromise=require(_0xa31c('0x5'));var rp=require(_0xa31c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa31c('0x7'));var config=require(_0xa31c('0x8'));var attributes=require(_0xa31c('0x9'));module[_0xa31c('0xa')]=function(_0x1593cd,_0x2dfdfb){return _0x1593cd['define'](_0xa31c('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa31c('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 391e98c..c652879 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 _0xdb4c=['UpdateVoiceQueueReport','where','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','http','defaults','redis','./voiceQueueReport.socket','register','request','then','info','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','findAll','options','attributes','include','map','model','GetVoiceQueueReport','VoiceQueueReport','create','body','raw','CreateVoiceQueueReport'];(function(_0x35fa73,_0x4e4983){var _0xc489b6=function(_0x2235b2){while(--_0x2235b2){_0x35fa73['push'](_0x35fa73['shift']());}};_0xc489b6(++_0x4e4983);}(_0xdb4c,0x132));var _0xcdb4=function(_0x2e2a53,_0x510e20){_0x2e2a53=_0x2e2a53-0x0;var _0x3a2cd0=_0xdb4c[_0x2e2a53];return _0x3a2cd0;};'use strict';var _=require(_0xcdb4('0x0'));var util=require(_0xcdb4('0x1'));var moment=require(_0xcdb4('0x2'));var BPromise=require('bluebird');var rs=require(_0xcdb4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdb4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcdb4('0x5'));var config=require(_0xcdb4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcdb4('0x7')]({'port':0x232a});config['redis']=_[_0xcdb4('0x8')](config[_0xcdb4('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdb4('0x9')]));require(_0xcdb4('0xa'))[_0xcdb4('0xb')](socket);function respondWithRpcPromise(_0x3fdd80,_0x788fea,_0x4eb351){return new BPromise(function(_0x25eb25,_0x1d7d5a){return client[_0xcdb4('0xc')](_0x3fdd80,_0x4eb351)[_0xcdb4('0xd')](function(_0xd2b5b4){logger[_0xcdb4('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x788fea,'request\x20sent');logger[_0xcdb4('0xf')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x788fea,'request\x20sent',JSON[_0xcdb4('0x10')](_0xd2b5b4));if(_0xd2b5b4['error']){if(_0xd2b5b4[_0xcdb4('0x11')][_0xcdb4('0x12')]===0x1f4){logger[_0xcdb4('0x11')](_0xcdb4('0x13'),_0x788fea,_0xd2b5b4[_0xcdb4('0x11')][_0xcdb4('0x14')]);return _0x1d7d5a(_0xd2b5b4['error']['message']);}logger[_0xcdb4('0x11')](_0xcdb4('0x13'),_0x788fea,_0xd2b5b4['error'][_0xcdb4('0x14')]);return _0x25eb25(_0xd2b5b4[_0xcdb4('0x11')][_0xcdb4('0x14')]);}else{logger['info'](_0xcdb4('0x13'),_0x788fea,_0xcdb4('0x15'));_0x25eb25(_0xd2b5b4[_0xcdb4('0x16')][_0xcdb4('0x14')]);}})[_0xcdb4('0x17')](function(_0x4fe8bd){logger[_0xcdb4('0x11')](_0xcdb4('0x13'),_0x788fea,_0x4fe8bd);_0x1d7d5a(_0x4fe8bd);});});}exports['GetVoiceQueueReport']=function(_0x285289){var _0x430c1a=this;return new Promise(function(_0xbc6fc6,_0x384d9d){return db['VoiceQueueReport'][_0xcdb4('0x18')]({'raw':_0x285289[_0xcdb4('0x19')]?_0x285289[_0xcdb4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x285289[_0xcdb4('0x19')]?_0x285289[_0xcdb4('0x19')]['where']||null:null,'attributes':_0x285289[_0xcdb4('0x19')]?_0x285289[_0xcdb4('0x19')][_0xcdb4('0x1a')]||null:null,'limit':_0x285289[_0xcdb4('0x19')]?_0x285289[_0xcdb4('0x19')]['limit']||null:null,'include':_0x285289[_0xcdb4('0x19')]?_0x285289[_0xcdb4('0x19')][_0xcdb4('0x1b')]?_[_0xcdb4('0x1c')](_0x285289[_0xcdb4('0x19')][_0xcdb4('0x1b')],function(_0x562491){return{'model':db[_0x562491[_0xcdb4('0x1d')]],'as':_0x562491['as'],'attributes':_0x562491[_0xcdb4('0x1a')],'include':_0x562491['include']?_[_0xcdb4('0x1c')](_0x562491[_0xcdb4('0x1b')],function(_0x15000){return{'model':db[_0x15000['model']],'as':_0x15000['as'],'attributes':_0x15000[_0xcdb4('0x1a')],'include':_0x15000[_0xcdb4('0x1b')]?_['map'](_0x15000['include'],function(_0x415a08){return{'model':db[_0x415a08[_0xcdb4('0x1d')]],'as':_0x415a08['as'],'attributes':_0x415a08[_0xcdb4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23c126){logger[_0xcdb4('0xe')](_0xcdb4('0x1e'),_0x285289);logger[_0xcdb4('0xf')](_0xcdb4('0x1e'),_0x285289,JSON[_0xcdb4('0x10')](_0x23c126));_0xbc6fc6(_0x23c126);})[_0xcdb4('0x17')](function(_0x55bbda){logger['error'](_0xcdb4('0x1e'),_0x55bbda[_0xcdb4('0x14')],_0x285289);_0x384d9d(_0x430c1a[_0xcdb4('0x11')](0x1f4,_0x55bbda[_0xcdb4('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0x1228e0){var _0x4b5851=this;return new Promise(function(_0x45bdcd,_0x286b79){return db[_0xcdb4('0x1f')][_0xcdb4('0x20')](_0x1228e0[_0xcdb4('0x21')],{'raw':_0x1228e0[_0xcdb4('0x19')]?_0x1228e0[_0xcdb4('0x19')][_0xcdb4('0x22')]===undefined?!![]:![]:!![]})[_0xcdb4('0xd')](function(_0x141b0d){logger[_0xcdb4('0xe')](_0xcdb4('0x23'),_0x1228e0);logger[_0xcdb4('0xf')]('CreateVoiceQueueReport',_0x1228e0,JSON['stringify'](_0x141b0d));_0x45bdcd(_0x141b0d);})[_0xcdb4('0x17')](function(_0xab030a){logger[_0xcdb4('0x11')](_0xcdb4('0x23'),_0xab030a[_0xcdb4('0x14')],_0x1228e0);_0x286b79(_0x4b5851['error'](0x1f4,_0xab030a[_0xcdb4('0x14')]));});});};exports[_0xcdb4('0x24')]=function(_0x42ac3b){var _0x5332a6=this;return new Promise(function(_0x3aa4b6,_0x27da6c){return db['VoiceQueueReport']['update'](_0x42ac3b[_0xcdb4('0x21')],{'raw':_0x42ac3b[_0xcdb4('0x19')]?_0x42ac3b[_0xcdb4('0x19')][_0xcdb4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42ac3b[_0xcdb4('0x19')]?_0x42ac3b[_0xcdb4('0x19')][_0xcdb4('0x25')]||null:null,'attributes':_0x42ac3b[_0xcdb4('0x19')]?_0x42ac3b[_0xcdb4('0x19')][_0xcdb4('0x1a')]||null:null,'limit':_0x42ac3b[_0xcdb4('0x19')]?_0x42ac3b['options']['limit']||null:null})[_0xcdb4('0xd')](function(_0x438733){logger[_0xcdb4('0xe')](_0xcdb4('0x24'),_0x42ac3b);logger[_0xcdb4('0xf')](_0xcdb4('0x24'),_0x42ac3b,JSON[_0xcdb4('0x10')](_0x438733));_0x3aa4b6(_0x438733);})[_0xcdb4('0x17')](function(_0x4b35c5){logger[_0xcdb4('0x11')](_0xcdb4('0x24'),_0x4b35c5[_0xcdb4('0x14')],_0x42ac3b);_0x27da6c(_0x5332a6[_0xcdb4('0x11')](0x1f4,_0x4b35c5['message']));});});}; \ No newline at end of file +var _0xa509=['message','info','request\x20sent','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','model','debug','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x481f9a,_0x4e2cdf){var _0x689304=function(_0x2739f7){while(--_0x2739f7){_0x481f9a['push'](_0x481f9a['shift']());}};_0x689304(++_0x4e2cdf);}(_0xa509,0x15a));var _0x9a50=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa509[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9a50('0x0'));var moment=require(_0x9a50('0x1'));var BPromise=require(_0x9a50('0x2'));var rs=require(_0x9a50('0x3'));var fs=require('fs');var Redis=require(_0x9a50('0x4'));var db=require(_0x9a50('0x5'))['db'];var utils=require(_0x9a50('0x6'));var logger=require('../../config/logger')(_0x9a50('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a50('0x8'));var client=jayson[_0x9a50('0x9')]['http']({'port':0x232a});config[_0x9a50('0xa')]=_[_0x9a50('0xb')](config[_0x9a50('0xa')],{'host':_0x9a50('0xc'),'port':0x18eb});var socket=require(_0x9a50('0xd'))(new Redis(config['redis']));require(_0x9a50('0xe'))[_0x9a50('0xf')](socket);function respondWithRpcPromise(_0x310132,_0x8ba0fe,_0x500e66){return new BPromise(function(_0x5b99ad,_0x278367){return client[_0x9a50('0x10')](_0x310132,_0x500e66)[_0x9a50('0x11')](function(_0x13f8db){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x8ba0fe,'request\x20sent');logger['debug'](_0x9a50('0x12'),_0x8ba0fe,'request\x20sent',JSON[_0x9a50('0x13')](_0x13f8db));if(_0x13f8db['error']){if(_0x13f8db[_0x9a50('0x14')][_0x9a50('0x15')]===0x1f4){logger[_0x9a50('0x14')](_0x9a50('0x16'),_0x8ba0fe,_0x13f8db['error'][_0x9a50('0x17')]);return _0x278367(_0x13f8db[_0x9a50('0x14')][_0x9a50('0x17')]);}logger['error'](_0x9a50('0x16'),_0x8ba0fe,_0x13f8db[_0x9a50('0x14')][_0x9a50('0x17')]);return _0x5b99ad(_0x13f8db[_0x9a50('0x14')][_0x9a50('0x17')]);}else{logger[_0x9a50('0x18')](_0x9a50('0x16'),_0x8ba0fe,_0x9a50('0x19'));_0x5b99ad(_0x13f8db['result']['message']);}})[_0x9a50('0x1a')](function(_0x48ff5e){logger[_0x9a50('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x8ba0fe,_0x48ff5e);_0x278367(_0x48ff5e);});});}exports[_0x9a50('0x1b')]=function(_0x2f0b50){var _0x21495d=this;return new Promise(function(_0x4477c8,_0x109d50){return db[_0x9a50('0x1c')]['findAll']({'raw':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2f0b50['options']?_0x2f0b50['options'][_0x9a50('0x1e')]||null:null,'attributes':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x1f')]||null:null,'limit':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x20')]||null:null,'include':_0x2f0b50[_0x9a50('0x1d')]?_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x21')]?_['map'](_0x2f0b50[_0x9a50('0x1d')][_0x9a50('0x21')],function(_0x3041be){return{'model':db[_0x3041be[_0x9a50('0x22')]],'as':_0x3041be['as'],'attributes':_0x3041be[_0x9a50('0x1f')],'include':_0x3041be[_0x9a50('0x21')]?_['map'](_0x3041be[_0x9a50('0x21')],function(_0x5a60d0){return{'model':db[_0x5a60d0[_0x9a50('0x22')]],'as':_0x5a60d0['as'],'attributes':_0x5a60d0[_0x9a50('0x1f')],'include':_0x5a60d0[_0x9a50('0x21')]?_['map'](_0x5a60d0['include'],function(_0x17be02){return{'model':db[_0x17be02[_0x9a50('0x22')]],'as':_0x17be02['as'],'attributes':_0x17be02[_0x9a50('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d2a16){logger[_0x9a50('0x18')]('GetVoiceQueueReport',_0x2f0b50);logger[_0x9a50('0x23')](_0x9a50('0x1b'),_0x2f0b50,JSON[_0x9a50('0x13')](_0x4d2a16));_0x4477c8(_0x4d2a16);})[_0x9a50('0x1a')](function(_0x3a1cc1){logger['error'](_0x9a50('0x1b'),_0x3a1cc1[_0x9a50('0x17')],_0x2f0b50);_0x109d50(_0x21495d[_0x9a50('0x14')](0x1f4,_0x3a1cc1[_0x9a50('0x17')]));});});};exports[_0x9a50('0x24')]=function(_0x993216){var _0x314556=this;return new Promise(function(_0x5dda52,_0x376e89){return db['VoiceQueueReport']['create'](_0x993216[_0x9a50('0x25')],{'raw':_0x993216[_0x9a50('0x1d')]?_0x993216[_0x9a50('0x1d')][_0x9a50('0x26')]===undefined?!![]:![]:!![]})[_0x9a50('0x11')](function(_0x5a121c){logger[_0x9a50('0x18')](_0x9a50('0x24'),_0x993216);logger[_0x9a50('0x23')](_0x9a50('0x24'),_0x993216,JSON['stringify'](_0x5a121c));_0x5dda52(_0x5a121c);})['catch'](function(_0x4c773a){logger[_0x9a50('0x14')]('CreateVoiceQueueReport',_0x4c773a[_0x9a50('0x17')],_0x993216);_0x376e89(_0x314556[_0x9a50('0x14')](0x1f4,_0x4c773a['message']));});});};exports[_0x9a50('0x27')]=function(_0x2d91c8){var _0x3500e3=this;return new Promise(function(_0x418088,_0x426086){return db['VoiceQueueReport'][_0x9a50('0x28')](_0x2d91c8[_0x9a50('0x25')],{'raw':_0x2d91c8['options']?_0x2d91c8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d91c8[_0x9a50('0x1d')]?_0x2d91c8[_0x9a50('0x1d')][_0x9a50('0x1e')]||null:null,'attributes':_0x2d91c8[_0x9a50('0x1d')]?_0x2d91c8[_0x9a50('0x1d')][_0x9a50('0x1f')]||null:null,'limit':_0x2d91c8['options']?_0x2d91c8[_0x9a50('0x1d')][_0x9a50('0x20')]||null:null})[_0x9a50('0x11')](function(_0x325c5d){logger['info']('UpdateVoiceQueueReport',_0x2d91c8);logger['debug']('UpdateVoiceQueueReport',_0x2d91c8,JSON[_0x9a50('0x13')](_0x325c5d));_0x418088(_0x325c5d);})[_0x9a50('0x1a')](function(_0x487b76){logger[_0x9a50('0x14')](_0x9a50('0x27'),_0x487b76[_0x9a50('0x17')],_0x2d91c8);_0x426086(_0x3500e3['error'](0x1f4,_0x487b76['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a1e6e63..10e7ad6 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 _0x9491=['./voiceQueueReport.events','save','remove','update','emit','register','voiceQueueReport:'];(function(_0x37f1d9,_0x5a2c20){var _0x2a723e=function(_0x9fd0b5){while(--_0x9fd0b5){_0x37f1d9['push'](_0x37f1d9['shift']());}};_0x2a723e(++_0x5a2c20);}(_0x9491,0xb6));var _0x1949=function(_0x4e4a4e,_0xf855fb){_0x4e4a4e=_0x4e4a4e-0x0;var _0x27a862=_0x9491[_0x4e4a4e];return _0x27a862;};'use strict';var VoiceQueueReportEvents=require(_0x1949('0x0'));var events=[_0x1949('0x1'),_0x1949('0x2'),_0x1949('0x3')];function createListener(_0x46e060,_0x1f05db){return function(_0x28621a){_0x1f05db[_0x1949('0x4')](_0x46e060,_0x28621a);};}function removeListener(_0x4270d7,_0x358907){return function(){VoiceQueueReportEvents['removeListener'](_0x4270d7,_0x358907);};}exports[_0x1949('0x5')]=function(_0x5b01b9){for(var _0x14c30e=0x0,_0x2d39a3=events['length'];_0x14c30e<_0x2d39a3;_0x14c30e++){var _0x28b2b6=events[_0x14c30e];var _0x3665b6=createListener(_0x1949('0x6')+_0x28b2b6,_0x5b01b9);VoiceQueueReportEvents['on'](_0x28b2b6,_0x3665b6);}}; \ No newline at end of file +var _0x059d=['./voiceQueueReport.events','save','remove','update','emit','removeListener','voiceQueueReport:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x059d,0x1b9));var _0xd059=function(_0x374447,_0x30082f){_0x374447=_0x374447-0x0;var _0x4a91d1=_0x059d[_0x374447];return _0x4a91d1;};'use strict';var VoiceQueueReportEvents=require(_0xd059('0x0'));var events=[_0xd059('0x1'),_0xd059('0x2'),_0xd059('0x3')];function createListener(_0x41a225,_0x1f0a13){return function(_0x51d3e2){_0x1f0a13[_0xd059('0x4')](_0x41a225,_0x51d3e2);};}function removeListener(_0x3d718f,_0x1bc791){return function(){VoiceQueueReportEvents[_0xd059('0x5')](_0x3d718f,_0x1bc791);};}exports['register']=function(_0x2e94fa){for(var _0x4755c4=0x0,_0x71a46a=events['length'];_0x4755c4<_0x71a46a;_0x4755c4++){var _0x45afbe=events[_0x4755c4];var _0x88d4a7=createListener(_0xd059('0x6')+_0x45afbe,_0x2e94fa);VoiceQueueReportEvents['on'](_0x45afbe,_0x88d4a7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f10f818..fd2a2a2 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 _0x40a9=['index','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3a4414,_0x45159c){var _0x13bb35=function(_0x1e26cc){while(--_0x1e26cc){_0x3a4414['push'](_0x3a4414['shift']());}};_0x13bb35(++_0x45159c);}(_0x40a9,0xd9));var _0x940a=function(_0x1a0e62,_0x5d1a78){_0x1a0e62=_0x1a0e62-0x0;var _0x3fa3db=_0x40a9[_0x1a0e62];return _0x3fa3db;};'use strict';var multer=require('multer');var util=require(_0x940a('0x0'));var path=require(_0x940a('0x1'));var timeout=require(_0x940a('0x2'));var express=require(_0x940a('0x3'));var router=express[_0x940a('0x4')]();var fs_extra=require(_0x940a('0x5'));var auth=require(_0x940a('0x6'));var interaction=require(_0x940a('0x7'));var config=require(_0x940a('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x940a('0x9')]('/',auth[_0x940a('0xa')](),controller[_0x940a('0xb')]);router[_0x940a('0x9')](_0x940a('0xc'),auth[_0x940a('0xa')](),controller[_0x940a('0xd')]);router[_0x940a('0xe')]('/',auth['isAuthenticated'](),controller[_0x940a('0xf')]);router[_0x940a('0x10')]('/:id',auth[_0x940a('0xa')](),controller[_0x940a('0x11')]);router['delete'](_0x940a('0xc'),auth[_0x940a('0xa')](),controller[_0x940a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x67f0=['create','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post'];(function(_0x49afa0,_0x236ac6){var _0x451731=function(_0x32144a){while(--_0x32144a){_0x49afa0['push'](_0x49afa0['shift']());}};_0x451731(++_0x236ac6);}(_0x67f0,0x106));var _0x067f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x67f0[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x067f('0x0'));var path=require('path');var timeout=require(_0x067f('0x1'));var express=require('express');var router=express[_0x067f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x067f('0x3'));var config=require(_0x067f('0x4'));var controller=require(_0x067f('0x5'));router[_0x067f('0x6')]('/',auth[_0x067f('0x7')](),controller['index']);router[_0x067f('0x6')](_0x067f('0x8'),auth['isAuthenticated'](),controller[_0x067f('0x9')]);router[_0x067f('0xa')]('/',auth['isAuthenticated'](),controller[_0x067f('0xb')]);router['put'](_0x067f('0x8'),auth[_0x067f('0x7')](),controller['update']);router['delete'](_0x067f('0x8'),auth[_0x067f('0x7')](),controller['destroy']);module[_0x067f('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f51f7bd..6c43ff6 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 _0x542f=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x5b0fdd,_0x59dff1){var _0x475ce8=function(_0xcdac64){while(--_0xcdac64){_0x5b0fdd['push'](_0x5b0fdd['shift']());}};_0x475ce8(++_0x59dff1);}(_0x542f,0x8f));var _0xf542=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x542f[_0x1acc2d];return _0xabfa6d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf542('0x0'));module[_0xf542('0x1')]={'time':{'type':Sequelize[_0xf542('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf542('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf542('0x3')](_0xf542('0x4'))}}; \ No newline at end of file +var _0x3ab9=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x3ab9,0x112));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x93ab('0x0'));var moment=require(_0x93ab('0x1'));module[_0x93ab('0x2')]={'time':{'type':Sequelize[_0x93ab('0x3')]},'callid':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x93ab('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x93ab('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x93ab('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2ab17a6..4922d48 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 _0xa4c3=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','update','then','destroy','error','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','options','VoiceQueuesLog','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4c3,0x1a7));var _0x3a4c=function(_0xa557c3,_0x41e885){_0xa557c3=_0xa557c3-0x0;var _0x21db69=_0xa4c3[_0xa557c3];return _0x21db69;};'use strict';var emlformat=require(_0x3a4c('0x0'));var rimraf=require(_0x3a4c('0x1'));var zipdir=require(_0x3a4c('0x2'));var jsonpatch=require(_0x3a4c('0x3'));var rp=require(_0x3a4c('0x4'));var moment=require(_0x3a4c('0x5'));var BPromise=require(_0x3a4c('0x6'));var Mustache=require(_0x3a4c('0x7'));var util=require(_0x3a4c('0x8'));var path=require(_0x3a4c('0x9'));var sox=require(_0x3a4c('0xa'));var csv=require(_0x3a4c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a4c('0xc'));var _=require(_0x3a4c('0xd'));var squel=require(_0x3a4c('0xe'));var crypto=require(_0x3a4c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3a4c('0x10'));var toCsv=require(_0x3a4c('0xb'));var querystring=require(_0x3a4c('0x11'));var Papa=require(_0x3a4c('0x12'));var Redis=require(_0x3a4c('0x13'));var authService=require(_0x3a4c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3a4c('0x15'));var hardwareService=require(_0x3a4c('0x16'));var logger=require('../../config/logger')(_0x3a4c('0x17'));var utils=require('../../config/utils');var config=require(_0x3a4c('0x18'));var licenseUtil=require(_0x3a4c('0x19'));var db=require(_0x3a4c('0x1a'))['db'];function respondWithStatusCode(_0x3c349f,_0x64e3aa){_0x64e3aa=_0x64e3aa||0xcc;return function(_0x529a0c){if(_0x529a0c){return _0x3c349f[_0x3a4c('0x1b')](_0x64e3aa);}return _0x3c349f[_0x3a4c('0x1c')](_0x64e3aa)[_0x3a4c('0x1d')]();};}function respondWithResult(_0x1bbcfe,_0x59b75f){_0x59b75f=_0x59b75f||0xc8;return function(_0x2e8a59){if(_0x2e8a59){return _0x1bbcfe[_0x3a4c('0x1c')](_0x59b75f)[_0x3a4c('0x1e')](_0x2e8a59);}};}function respondWithFilteredResult(_0x3649f4,_0x1b7fc5){return function(_0x1ea055){if(_0x1ea055){var _0x5d903f=typeof _0x1b7fc5[_0x3a4c('0x1f')]==='undefined'&&typeof _0x1b7fc5['limit']===_0x3a4c('0x20');var _0x177f46=_0x1ea055[_0x3a4c('0x21')];var _0x21b57d=_0x5d903f?0x0:_0x1b7fc5[_0x3a4c('0x1f')];var _0x564519=_0x5d903f?_0x1ea055[_0x3a4c('0x21')]:_0x1b7fc5[_0x3a4c('0x1f')]+_0x1b7fc5[_0x3a4c('0x22')];var _0x11605c;if(_0x564519>=_0x177f46){_0x564519=_0x177f46;_0x11605c=0xc8;}else{_0x11605c=0xce;}_0x3649f4[_0x3a4c('0x1c')](_0x11605c);return _0x3649f4['set']('Content-Range',_0x21b57d+'-'+_0x564519+'/'+_0x177f46)['json'](_0x1ea055);}return null;};}function patchUpdates(_0x1cc6d0){return function(_0x1a262e){try{jsonpatch['apply'](_0x1a262e,_0x1cc6d0,!![]);}catch(_0x482d6){return BPromise[_0x3a4c('0x23')](_0x482d6);}return _0x1a262e['save']();};}function saveUpdates(_0x4d5267,_0xe1afe2){return function(_0x302e4e){if(_0x302e4e){return _0x302e4e[_0x3a4c('0x24')](_0x4d5267)[_0x3a4c('0x25')](function(_0x4028fb){return _0x4028fb;});}return null;};}function removeEntity(_0x54d72b,_0x2cb027){return function(_0x2b8f87){if(_0x2b8f87){return _0x2b8f87[_0x3a4c('0x26')]()['then'](function(){_0x54d72b[_0x3a4c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e2a4,_0x15be83){return function(_0x388000){if(!_0x388000){_0x23e2a4['sendStatus'](0x194);}return _0x388000;};}function handleError(_0x3e39c5,_0x2b75a4){_0x2b75a4=_0x2b75a4||0x1f4;return function(_0xc18da7){logger[_0x3a4c('0x27')](_0xc18da7['stack']);if(_0xc18da7['name']){delete _0xc18da7[_0x3a4c('0x28')];}_0x3e39c5[_0x3a4c('0x1c')](_0x2b75a4)[_0x3a4c('0x29')](_0xc18da7);};}exports['index']=function(_0x1c0587,_0x50cf1d){var _0x12249b={},_0x3825aa={},_0x11b952={'count':0x0,'rows':[]};var _0x4af181=_['map'](db['VoiceQueuesLog'][_0x3a4c('0x2a')],function(_0x3f81f1){return{'name':_0x3f81f1[_0x3a4c('0x2b')],'type':_0x3f81f1[_0x3a4c('0x2c')][_0x3a4c('0x2d')]};});_0x3825aa['model']=_[_0x3a4c('0x2e')](_0x4af181,_0x3a4c('0x28'));_0x3825aa[_0x3a4c('0x2f')]=_[_0x3a4c('0x30')](_0x1c0587[_0x3a4c('0x2f')]);_0x3825aa[_0x3a4c('0x31')]=_[_0x3a4c('0x32')](_0x3825aa[_0x3a4c('0x33')],_0x3825aa['query']);_0x12249b[_0x3a4c('0x34')]=_[_0x3a4c('0x32')](_0x3825aa[_0x3a4c('0x33')],qs[_0x3a4c('0x35')](_0x1c0587['query']['fields']));_0x12249b[_0x3a4c('0x34')]=_0x12249b[_0x3a4c('0x34')]['length']?_0x12249b[_0x3a4c('0x34')]:_0x3825aa[_0x3a4c('0x33')];if(!_0x1c0587[_0x3a4c('0x2f')]['hasOwnProperty']('nolimit')){_0x12249b[_0x3a4c('0x22')]=qs['limit'](_0x1c0587[_0x3a4c('0x2f')][_0x3a4c('0x22')]);_0x12249b[_0x3a4c('0x1f')]=qs[_0x3a4c('0x1f')](_0x1c0587[_0x3a4c('0x2f')][_0x3a4c('0x1f')]);}_0x12249b[_0x3a4c('0x36')]=qs[_0x3a4c('0x37')](_0x1c0587['query'][_0x3a4c('0x37')]);_0x12249b[_0x3a4c('0x38')]=qs[_0x3a4c('0x31')](_[_0x3a4c('0x39')](_0x1c0587[_0x3a4c('0x2f')],_0x3825aa[_0x3a4c('0x31')]),_0x4af181);if(_0x1c0587[_0x3a4c('0x2f')][_0x3a4c('0x3a')]){_0x12249b[_0x3a4c('0x38')]=_['merge'](_0x12249b[_0x3a4c('0x38')],{'$or':_[_0x3a4c('0x2e')](_0x4af181,function(_0x1f73c1){if(_0x1f73c1[_0x3a4c('0x2c')]!=='VIRTUAL'){var _0x32832c={};_0x32832c[_0x1f73c1['name']]={'$like':'%'+_0x1c0587['query'][_0x3a4c('0x3a')]+'%'};return _0x32832c;}})});}_0x12249b=_[_0x3a4c('0x3b')]({},_0x12249b,_0x1c0587[_0x3a4c('0x3c')]);var _0x44e214={'where':_0x12249b[_0x3a4c('0x38')]};return db[_0x3a4c('0x3d')][_0x3a4c('0x21')](_0x44e214)[_0x3a4c('0x25')](function(_0x164d1c){_0x11b952['count']=_0x164d1c;if(_0x1c0587['query'][_0x3a4c('0x3e')]){_0x12249b[_0x3a4c('0x3f')]=[{'all':!![]}];}return db[_0x3a4c('0x3d')][_0x3a4c('0x40')](_0x12249b);})[_0x3a4c('0x25')](function(_0x26d792){_0x11b952[_0x3a4c('0x41')]=_0x26d792;return _0x11b952;})[_0x3a4c('0x25')](respondWithFilteredResult(_0x50cf1d,_0x12249b))['catch'](handleError(_0x50cf1d,null));};exports[_0x3a4c('0x42')]=function(_0x4ee2a0,_0x7971e5){var _0x3afe49={'raw':!![],'where':{'id':_0x4ee2a0[_0x3a4c('0x43')]['id']}},_0x235b0f={};_0x235b0f[_0x3a4c('0x33')]=_[_0x3a4c('0x30')](db['VoiceQueuesLog'][_0x3a4c('0x2a')]);_0x235b0f['query']=_['keys'](_0x4ee2a0['query']);_0x235b0f[_0x3a4c('0x31')]=_[_0x3a4c('0x32')](_0x235b0f[_0x3a4c('0x33')],_0x235b0f[_0x3a4c('0x2f')]);_0x3afe49['attributes']=_[_0x3a4c('0x32')](_0x235b0f[_0x3a4c('0x33')],qs[_0x3a4c('0x35')](_0x4ee2a0[_0x3a4c('0x2f')][_0x3a4c('0x35')]));_0x3afe49['attributes']=_0x3afe49[_0x3a4c('0x34')][_0x3a4c('0x44')]?_0x3afe49[_0x3a4c('0x34')]:_0x235b0f[_0x3a4c('0x33')];if(_0x4ee2a0['query'][_0x3a4c('0x3e')]){_0x3afe49[_0x3a4c('0x3f')]=[{'all':!![]}];}_0x3afe49=_[_0x3a4c('0x3b')]({},_0x3afe49,_0x4ee2a0['options']);return db['VoiceQueuesLog'][_0x3a4c('0x45')](_0x3afe49)[_0x3a4c('0x25')](handleEntityNotFound(_0x7971e5,null))[_0x3a4c('0x25')](respondWithResult(_0x7971e5,null))[_0x3a4c('0x46')](handleError(_0x7971e5,null));};exports[_0x3a4c('0x47')]=function(_0x1593e9,_0x153f99){return db[_0x3a4c('0x3d')]['create'](_0x1593e9[_0x3a4c('0x48')],{})[_0x3a4c('0x25')](respondWithResult(_0x153f99,0xc9))[_0x3a4c('0x46')](handleError(_0x153f99,null));};exports['update']=function(_0x3f1345,_0x354a1b){if(_0x3f1345[_0x3a4c('0x48')]['id']){delete _0x3f1345['body']['id'];}return db['VoiceQueuesLog'][_0x3a4c('0x45')]({'where':{'id':_0x3f1345[_0x3a4c('0x43')]['id']}})[_0x3a4c('0x25')](handleEntityNotFound(_0x354a1b,null))[_0x3a4c('0x25')](saveUpdates(_0x3f1345[_0x3a4c('0x48')],null))['then'](respondWithResult(_0x354a1b,null))['catch'](handleError(_0x354a1b,null));};exports[_0x3a4c('0x26')]=function(_0x4eea10,_0x15b444){return db[_0x3a4c('0x3d')][_0x3a4c('0x45')]({'where':{'id':_0x4eea10['params']['id']}})['then'](handleEntityNotFound(_0x15b444,null))[_0x3a4c('0x25')](removeEntity(_0x15b444,null))[_0x3a4c('0x46')](handleError(_0x15b444,null));}; \ No newline at end of file +var _0xb9a2=['moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','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','count','set','Content-Range','reject','update','destroy','then','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x48a236,_0x4256f1){var _0xa7c2be=function(_0x90f054){while(--_0x90f054){_0x48a236['push'](_0x48a236['shift']());}};_0xa7c2be(++_0x4256f1);}(_0xb9a2,0x1be));var _0x2b9a=function(_0x107568,_0x5bacdd){_0x107568=_0x107568-0x0;var _0x1d84eb=_0xb9a2[_0x107568];return _0x1d84eb;};'use strict';var emlformat=require(_0x2b9a('0x0'));var rimraf=require(_0x2b9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b9a('0x2'));var rp=require(_0x2b9a('0x3'));var moment=require(_0x2b9a('0x4'));var BPromise=require(_0x2b9a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b9a('0x6'));var sox=require('sox');var csv=require(_0x2b9a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b9a('0x8'));var _=require(_0x2b9a('0x9'));var squel=require('squel');var crypto=require(_0x2b9a('0xa'));var jsforce=require(_0x2b9a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2b9a('0x7'));var querystring=require('querystring');var Papa=require(_0x2b9a('0xc'));var Redis=require(_0x2b9a('0xd'));var authService=require(_0x2b9a('0xe'));var qs=require(_0x2b9a('0xf'));var as=require(_0x2b9a('0x10'));var hardwareService=require(_0x2b9a('0x11'));var logger=require(_0x2b9a('0x12'))(_0x2b9a('0x13'));var utils=require(_0x2b9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2b9a('0x15'));var db=require(_0x2b9a('0x16'))['db'];function respondWithStatusCode(_0xaaae3e,_0x273989){_0x273989=_0x273989||0xcc;return function(_0x2422df){if(_0x2422df){return _0xaaae3e[_0x2b9a('0x17')](_0x273989);}return _0xaaae3e[_0x2b9a('0x18')](_0x273989)[_0x2b9a('0x19')]();};}function respondWithResult(_0x4ce004,_0x339be7){_0x339be7=_0x339be7||0xc8;return function(_0x5997b4){if(_0x5997b4){return _0x4ce004[_0x2b9a('0x18')](_0x339be7)[_0x2b9a('0x1a')](_0x5997b4);}};}function respondWithFilteredResult(_0xfaff75,_0x2772ac){return function(_0x59d154){if(_0x59d154){var _0x3c0f60=typeof _0x2772ac[_0x2b9a('0x1b')]===_0x2b9a('0x1c')&&typeof _0x2772ac[_0x2b9a('0x1d')]==='undefined';var _0x45457b=_0x59d154['count'];var _0x11df2e=_0x3c0f60?0x0:_0x2772ac[_0x2b9a('0x1b')];var _0x3650ab=_0x3c0f60?_0x59d154[_0x2b9a('0x1e')]:_0x2772ac[_0x2b9a('0x1b')]+_0x2772ac[_0x2b9a('0x1d')];var _0x1b5202;if(_0x3650ab>=_0x45457b){_0x3650ab=_0x45457b;_0x1b5202=0xc8;}else{_0x1b5202=0xce;}_0xfaff75[_0x2b9a('0x18')](_0x1b5202);return _0xfaff75[_0x2b9a('0x1f')](_0x2b9a('0x20'),_0x11df2e+'-'+_0x3650ab+'/'+_0x45457b)['json'](_0x59d154);}return null;};}function patchUpdates(_0x52f0dc){return function(_0x11c9be){try{jsonpatch['apply'](_0x11c9be,_0x52f0dc,!![]);}catch(_0x436ad2){return BPromise[_0x2b9a('0x21')](_0x436ad2);}return _0x11c9be['save']();};}function saveUpdates(_0x1b1c4e,_0x37d96e){return function(_0x2bef96){if(_0x2bef96){return _0x2bef96[_0x2b9a('0x22')](_0x1b1c4e)['then'](function(_0x45fe44){return _0x45fe44;});}return null;};}function removeEntity(_0x35aee1,_0x1ed502){return function(_0x7b4992){if(_0x7b4992){return _0x7b4992[_0x2b9a('0x23')]()[_0x2b9a('0x24')](function(){_0x35aee1[_0x2b9a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21ea25,_0x38a51f){return function(_0x4eb9dc){if(!_0x4eb9dc){_0x21ea25[_0x2b9a('0x17')](0x194);}return _0x4eb9dc;};}function handleError(_0x215f44,_0x1e1a4a){_0x1e1a4a=_0x1e1a4a||0x1f4;return function(_0x587f1c){logger[_0x2b9a('0x25')](_0x587f1c['stack']);if(_0x587f1c[_0x2b9a('0x26')]){delete _0x587f1c[_0x2b9a('0x26')];}_0x215f44[_0x2b9a('0x18')](_0x1e1a4a)[_0x2b9a('0x27')](_0x587f1c);};}exports[_0x2b9a('0x28')]=function(_0x22e63a,_0x24d4cd){var _0x61efbe={},_0x5590f9={},_0xcf7961={'count':0x0,'rows':[]};var _0x56a454=_[_0x2b9a('0x29')](db[_0x2b9a('0x2a')][_0x2b9a('0x2b')],function(_0x2c2460){return{'name':_0x2c2460[_0x2b9a('0x2c')],'type':_0x2c2460[_0x2b9a('0x2d')][_0x2b9a('0x2e')]};});_0x5590f9[_0x2b9a('0x2f')]=_['map'](_0x56a454,_0x2b9a('0x26'));_0x5590f9['query']=_[_0x2b9a('0x30')](_0x22e63a[_0x2b9a('0x31')]);_0x5590f9['filters']=_[_0x2b9a('0x32')](_0x5590f9[_0x2b9a('0x2f')],_0x5590f9['query']);_0x61efbe['attributes']=_[_0x2b9a('0x32')](_0x5590f9[_0x2b9a('0x2f')],qs[_0x2b9a('0x33')](_0x22e63a['query'][_0x2b9a('0x33')]));_0x61efbe[_0x2b9a('0x34')]=_0x61efbe[_0x2b9a('0x34')][_0x2b9a('0x35')]?_0x61efbe[_0x2b9a('0x34')]:_0x5590f9[_0x2b9a('0x2f')];if(!_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x36')](_0x2b9a('0x37'))){_0x61efbe[_0x2b9a('0x1d')]=qs['limit'](_0x22e63a[_0x2b9a('0x31')]['limit']);_0x61efbe[_0x2b9a('0x1b')]=qs[_0x2b9a('0x1b')](_0x22e63a['query'][_0x2b9a('0x1b')]);}_0x61efbe[_0x2b9a('0x38')]=qs[_0x2b9a('0x39')](_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x39')]);_0x61efbe[_0x2b9a('0x3a')]=qs['filters'](_[_0x2b9a('0x3b')](_0x22e63a[_0x2b9a('0x31')],_0x5590f9[_0x2b9a('0x3c')]),_0x56a454);if(_0x22e63a[_0x2b9a('0x31')]['filter']){_0x61efbe[_0x2b9a('0x3a')]=_[_0x2b9a('0x3d')](_0x61efbe[_0x2b9a('0x3a')],{'$or':_['map'](_0x56a454,function(_0x50c194){if(_0x50c194[_0x2b9a('0x2d')]!==_0x2b9a('0x3e')){var _0xa6825={};_0xa6825[_0x50c194[_0x2b9a('0x26')]]={'$like':'%'+_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x3f')]+'%'};return _0xa6825;}})});}_0x61efbe=_[_0x2b9a('0x3d')]({},_0x61efbe,_0x22e63a[_0x2b9a('0x40')]);var _0x6aa31e={'where':_0x61efbe[_0x2b9a('0x3a')]};return db[_0x2b9a('0x2a')][_0x2b9a('0x1e')](_0x6aa31e)[_0x2b9a('0x24')](function(_0x25b1eb){_0xcf7961[_0x2b9a('0x1e')]=_0x25b1eb;if(_0x22e63a[_0x2b9a('0x31')][_0x2b9a('0x41')]){_0x61efbe[_0x2b9a('0x42')]=[{'all':!![]}];}return db[_0x2b9a('0x2a')][_0x2b9a('0x43')](_0x61efbe);})[_0x2b9a('0x24')](function(_0x1d12b4){_0xcf7961[_0x2b9a('0x44')]=_0x1d12b4;return _0xcf7961;})['then'](respondWithFilteredResult(_0x24d4cd,_0x61efbe))['catch'](handleError(_0x24d4cd,null));};exports[_0x2b9a('0x45')]=function(_0x6914ed,_0x2232ea){var _0x53e7b8={'raw':!![],'where':{'id':_0x6914ed['params']['id']}},_0x1a0352={};_0x1a0352['model']=_[_0x2b9a('0x30')](db[_0x2b9a('0x2a')][_0x2b9a('0x2b')]);_0x1a0352['query']=_[_0x2b9a('0x30')](_0x6914ed[_0x2b9a('0x31')]);_0x1a0352[_0x2b9a('0x3c')]=_[_0x2b9a('0x32')](_0x1a0352[_0x2b9a('0x2f')],_0x1a0352[_0x2b9a('0x31')]);_0x53e7b8[_0x2b9a('0x34')]=_['intersection'](_0x1a0352[_0x2b9a('0x2f')],qs[_0x2b9a('0x33')](_0x6914ed[_0x2b9a('0x31')][_0x2b9a('0x33')]));_0x53e7b8[_0x2b9a('0x34')]=_0x53e7b8['attributes']['length']?_0x53e7b8[_0x2b9a('0x34')]:_0x1a0352[_0x2b9a('0x2f')];if(_0x6914ed['query'][_0x2b9a('0x41')]){_0x53e7b8[_0x2b9a('0x42')]=[{'all':!![]}];}_0x53e7b8=_[_0x2b9a('0x3d')]({},_0x53e7b8,_0x6914ed[_0x2b9a('0x40')]);return db[_0x2b9a('0x2a')][_0x2b9a('0x46')](_0x53e7b8)[_0x2b9a('0x24')](handleEntityNotFound(_0x2232ea,null))[_0x2b9a('0x24')](respondWithResult(_0x2232ea,null))[_0x2b9a('0x47')](handleError(_0x2232ea,null));};exports['create']=function(_0x14fa9d,_0x18658a){return db[_0x2b9a('0x2a')][_0x2b9a('0x48')](_0x14fa9d[_0x2b9a('0x49')],{})[_0x2b9a('0x24')](respondWithResult(_0x18658a,0xc9))[_0x2b9a('0x47')](handleError(_0x18658a,null));};exports[_0x2b9a('0x22')]=function(_0x5c2128,_0xcf9fed){if(_0x5c2128[_0x2b9a('0x49')]['id']){delete _0x5c2128[_0x2b9a('0x49')]['id'];}return db[_0x2b9a('0x2a')]['find']({'where':{'id':_0x5c2128[_0x2b9a('0x4a')]['id']}})[_0x2b9a('0x24')](handleEntityNotFound(_0xcf9fed,null))[_0x2b9a('0x24')](saveUpdates(_0x5c2128[_0x2b9a('0x49')],null))[_0x2b9a('0x24')](respondWithResult(_0xcf9fed,null))[_0x2b9a('0x47')](handleError(_0xcf9fed,null));};exports[_0x2b9a('0x23')]=function(_0x258a23,_0x48ba53){return db[_0x2b9a('0x2a')][_0x2b9a('0x46')]({'where':{'id':_0x258a23[_0x2b9a('0x4a')]['id']}})[_0x2b9a('0x24')](handleEntityNotFound(_0x48ba53,null))[_0x2b9a('0x24')](removeEntity(_0x48ba53,null))[_0x2b9a('0x47')](handleError(_0x48ba53,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5babb39..ed84a01 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 _0x1801=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28cf1b,_0x589dbf){var _0x965f7f=function(_0x2a0bd6){while(--_0x2a0bd6){_0x28cf1b['push'](_0x28cf1b['shift']());}};_0x965f7f(++_0x589dbf);}(_0x1801,0xc6));var _0x1180=function(_0x2dc2b2,_0x1439f7){_0x2dc2b2=_0x2dc2b2-0x0;var _0x1835ca=_0x1801[_0x2dc2b2];return _0x1835ca;};'use strict';var _=require(_0x1180('0x0'));var util=require(_0x1180('0x1'));var logger=require(_0x1180('0x2'))(_0x1180('0x3'));var moment=require(_0x1180('0x4'));var BPromise=require(_0x1180('0x5'));var rp=require(_0x1180('0x6'));var fs=require('fs');var path=require(_0x1180('0x7'));var rimraf=require(_0x1180('0x8'));var config=require(_0x1180('0x9'));var attributes=require(_0x1180('0xa'));module[_0x1180('0xb')]=function(_0x300206,_0x5645fb){return _0x300206[_0x1180('0xc')](_0x1180('0xd'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x1180('0xe'),_0x1180('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7129=['../../config/logger','api','bluebird','request-promise','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x7129,0x99));var _0x9712=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7129[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x9712('0x0'));var logger=require(_0x9712('0x1'))(_0x9712('0x2'));var moment=require('moment');var BPromise=require(_0x9712('0x3'));var rp=require(_0x9712('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9712('0x5'));var config=require('../../config/environment');var attributes=require(_0x9712('0x6'));module[_0x9712('0x7')]=function(_0x5b94a0,_0x22bd66){return _0x5b94a0[_0x9712('0x8')](_0x9712('0x9'),attributes,{'tableName':_0x9712('0xa'),'paranoid':![],'indexes':[{'name':_0x9712('0xb'),'fields':[_0x9712('0xc'),_0x9712('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 614add5..487a832 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 _0xaffb=['http','request','then','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x204cfe,_0x4d024f){var _0xade4f=function(_0x54ad1e){while(--_0x54ad1e){_0x204cfe['push'](_0x204cfe['shift']());}};_0xade4f(++_0x4d024f);}(_0xaffb,0x85));var _0xbaff=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0xaffb[_0x54c695];return _0x3ce06b;};'use strict';var _=require(_0xbaff('0x0'));var util=require(_0xbaff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbaff('0x2'));var fs=require('fs');var Redis=require(_0xbaff('0x3'));var db=require(_0xbaff('0x4'))['db'];var utils=require(_0xbaff('0x5'));var logger=require(_0xbaff('0x6'))(_0xbaff('0x7'));var config=require(_0xbaff('0x8'));var jayson=require(_0xbaff('0x9'));var client=jayson[_0xbaff('0xa')][_0xbaff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f861e,_0xc23ea4,_0x295e39){return new BPromise(function(_0x34c512,_0x73a3d1){return client[_0xbaff('0xc')](_0x3f861e,_0x295e39)[_0xbaff('0xd')](function(_0x3c3d36){logger['info'](_0xbaff('0xe'),_0xc23ea4,'request\x20sent');logger['debug'](_0xbaff('0xf'),_0xc23ea4,'request\x20sent',JSON[_0xbaff('0x10')](_0x3c3d36));if(_0x3c3d36[_0xbaff('0x11')]){if(_0x3c3d36[_0xbaff('0x11')][_0xbaff('0x12')]===0x1f4){logger[_0xbaff('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0xc23ea4,_0x3c3d36[_0xbaff('0x11')][_0xbaff('0x13')]);return _0x73a3d1(_0x3c3d36['error'][_0xbaff('0x13')]);}logger[_0xbaff('0x11')](_0xbaff('0xe'),_0xc23ea4,_0x3c3d36[_0xbaff('0x11')]['message']);return _0x34c512(_0x3c3d36[_0xbaff('0x11')][_0xbaff('0x13')]);}else{logger[_0xbaff('0x14')](_0xbaff('0xe'),_0xc23ea4,_0xbaff('0x15'));_0x34c512(_0x3c3d36[_0xbaff('0x16')][_0xbaff('0x13')]);}})[_0xbaff('0x17')](function(_0xb40a10){logger[_0xbaff('0x11')](_0xbaff('0xe'),_0xc23ea4,_0xb40a10);_0x73a3d1(_0xb40a10);});});} \ No newline at end of file +var _0xd08c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3f93df,_0x324d5d){var _0x74a3e3=function(_0x7fb785){while(--_0x7fb785){_0x3f93df['push'](_0x3f93df['shift']());}};_0x74a3e3(++_0x324d5d);}(_0xd08c,0x106));var _0xcd08=function(_0x50aa4b,_0x77f234){_0x50aa4b=_0x50aa4b-0x0;var _0x20fbd9=_0xd08c[_0x50aa4b];return _0x20fbd9;};'use strict';var _=require(_0xcd08('0x0'));var util=require(_0xcd08('0x1'));var moment=require(_0xcd08('0x2'));var BPromise=require(_0xcd08('0x3'));var rs=require(_0xcd08('0x4'));var fs=require('fs');var Redis=require(_0xcd08('0x5'));var db=require(_0xcd08('0x6'))['db'];var utils=require(_0xcd08('0x7'));var logger=require(_0xcd08('0x8'))(_0xcd08('0x9'));var config=require('../../config/environment');var jayson=require(_0xcd08('0xa'));var client=jayson[_0xcd08('0xb')][_0xcd08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a2910,_0x3d9189,_0x125995){return new BPromise(function(_0x18b411,_0x4e00fb){return client[_0xcd08('0xd')](_0x3a2910,_0x125995)[_0xcd08('0xe')](function(_0x2fc649){logger[_0xcd08('0xf')](_0xcd08('0x10'),_0x3d9189,_0xcd08('0x11'));logger['debug'](_0xcd08('0x12'),_0x3d9189,'request\x20sent',JSON[_0xcd08('0x13')](_0x2fc649));if(_0x2fc649[_0xcd08('0x14')]){if(_0x2fc649[_0xcd08('0x14')]['code']===0x1f4){logger[_0xcd08('0x14')](_0xcd08('0x10'),_0x3d9189,_0x2fc649[_0xcd08('0x14')][_0xcd08('0x15')]);return _0x4e00fb(_0x2fc649['error'][_0xcd08('0x15')]);}logger[_0xcd08('0x14')](_0xcd08('0x10'),_0x3d9189,_0x2fc649[_0xcd08('0x14')][_0xcd08('0x15')]);return _0x18b411(_0x2fc649[_0xcd08('0x14')][_0xcd08('0x15')]);}else{logger['info'](_0xcd08('0x10'),_0x3d9189,_0xcd08('0x11'));_0x18b411(_0x2fc649[_0xcd08('0x16')]['message']);}})[_0xcd08('0x17')](function(_0x3321be){logger['error'](_0xcd08('0x10'),_0x3d9189,_0x3321be);_0x4e00fb(_0x3321be);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index cb4be00..dfbcdc9 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 _0xe12e=['downloadTranscribe','post','create','runTranscribe','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','/describe','isAuthenticated','describe','/:id','show','get','/:id/download','download','/:id/downloads','/:id/transcribe'];(function(_0x2665a3,_0x1bd09e){var _0x4f8fb0=function(_0x255207){while(--_0x255207){_0x2665a3['push'](_0x2665a3['shift']());}};_0x4f8fb0(++_0x1bd09e);}(_0xe12e,0x1ab));var _0xee12=function(_0x231e7b,_0x48cdd2){_0x231e7b=_0x231e7b-0x0;var _0x355fa7=_0xe12e[_0x231e7b];return _0x355fa7;};'use strict';var multer=require(_0xee12('0x0'));var util=require(_0xee12('0x1'));var path=require(_0xee12('0x2'));var timeout=require('connect-timeout');var express=require(_0xee12('0x3'));var router=express[_0xee12('0x4')]();var fs_extra=require(_0xee12('0x5'));var auth=require(_0xee12('0x6'));var interaction=require(_0xee12('0x7'));var config=require(_0xee12('0x8'));var controller=require(_0xee12('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xee12('0xa')]);router['get'](_0xee12('0xb'),auth[_0xee12('0xc')](),controller[_0xee12('0xd')]);router['get'](_0xee12('0xe'),auth[_0xee12('0xc')](),controller[_0xee12('0xf')]);router[_0xee12('0x10')](_0xee12('0x11'),auth[_0xee12('0xc')](),controller[_0xee12('0x12')]);router[_0xee12('0x10')](_0xee12('0x13'),controller['downloads']);router['get'](_0xee12('0x14'),auth['isAuthenticated'](),controller[_0xee12('0x15')]);router[_0xee12('0x16')]('/',auth[_0xee12('0xc')](),controller[_0xee12('0x17')]);router[_0xee12('0x16')]('/:id/transcribe',auth[_0xee12('0xc')](),controller[_0xee12('0x18')]);router[_0xee12('0x19')]('/:id',auth[_0xee12('0xc')](),controller[_0xee12('0x1a')]);router[_0xee12('0x1b')]('/:id',auth[_0xee12('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7f5f=['./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','create','post','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x7f5f,0x1c1));var _0xf7f5=function(_0x581511,_0x5306ec){_0x581511=_0x581511-0x0;var _0x40ae96=_0x7f5f[_0x581511];return _0x40ae96;};'use strict';var multer=require(_0xf7f5('0x0'));var util=require(_0xf7f5('0x1'));var path=require('path');var timeout=require(_0xf7f5('0x2'));var express=require(_0xf7f5('0x3'));var router=express['Router']();var fs_extra=require(_0xf7f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf7f5('0x5'));var config=require(_0xf7f5('0x6'));var controller=require(_0xf7f5('0x7'));router[_0xf7f5('0x8')]('/',auth[_0xf7f5('0x9')](),controller[_0xf7f5('0xa')]);router['get'](_0xf7f5('0xb'),auth[_0xf7f5('0x9')](),controller[_0xf7f5('0xc')]);router['get'](_0xf7f5('0xd'),auth[_0xf7f5('0x9')](),controller[_0xf7f5('0xe')]);router['get'](_0xf7f5('0xf'),auth[_0xf7f5('0x9')](),controller['download']);router[_0xf7f5('0x8')](_0xf7f5('0x10'),controller['downloads']);router[_0xf7f5('0x8')](_0xf7f5('0x11'),auth['isAuthenticated'](),controller[_0xf7f5('0x12')]);router['post']('/',auth[_0xf7f5('0x9')](),controller[_0xf7f5('0x13')]);router[_0xf7f5('0x14')]('/:id/transcribe',auth[_0xf7f5('0x9')](),controller['runTranscribe']);router[_0xf7f5('0x15')]('/:id',auth[_0xf7f5('0x9')](),controller[_0xf7f5('0x16')]);router['delete'](_0xf7f5('0xd'),auth[_0xf7f5('0x9')](),controller['destroy']);module[_0xf7f5('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b9092c5..925a99b 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 4533e74..13cd66c 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 _0x7a36=['TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','language','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','ValidationError','extname','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus'];(function(_0x1609b4,_0x3e9b50){var _0x479995=function(_0x264b4b){while(--_0x264b4b){_0x1609b4['push'](_0x1609b4['shift']());}};_0x479995(++_0x3e9b50);}(_0x7a36,0xb7));var _0x67a3=function(_0x4edd2a,_0x4578b4){_0x4edd2a=_0x4edd2a-0x0;var _0x351d32=_0x7a36[_0x4edd2a];return _0x351d32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67a3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67a3('0x1'));var rp=require(_0x67a3('0x2'));var moment=require(_0x67a3('0x3'));var BPromise=require(_0x67a3('0x4'));var Mustache=require('mustache');var util=require(_0x67a3('0x5'));var path=require(_0x67a3('0x6'));var sox=require(_0x67a3('0x7'));var csv=require(_0x67a3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67a3('0x9'));var _=require(_0x67a3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x67a3('0xb'));var deskjs=require(_0x67a3('0xc'));var toCsv=require(_0x67a3('0x8'));var querystring=require(_0x67a3('0xd'));var Papa=require(_0x67a3('0xe'));var AWS=require(_0x67a3('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x67a3('0x10'));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(_0x67a3('0x11'))(_0x67a3('0x12'));var utils=require(_0x67a3('0x13'));var config=require(_0x67a3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae46c,_0x2122e2){_0x2122e2=_0x2122e2||0xcc;return function(_0x47d506){if(_0x47d506){return _0x4ae46c[_0x67a3('0x15')](_0x2122e2);}return _0x4ae46c[_0x67a3('0x16')](_0x2122e2)[_0x67a3('0x17')]();};}function respondWithResult(_0x26c83a,_0x1e8f23){_0x1e8f23=_0x1e8f23||0xc8;return function(_0x2b7e64){if(_0x2b7e64){return _0x26c83a[_0x67a3('0x16')](_0x1e8f23)['json'](_0x2b7e64);}};}function respondWithFilteredResult(_0x189983,_0x5b96cd){return function(_0x391e01){if(_0x391e01){var _0x3230fa=typeof _0x5b96cd[_0x67a3('0x18')]===_0x67a3('0x19')&&typeof _0x5b96cd[_0x67a3('0x1a')]===_0x67a3('0x19');var _0x46a3c2=_0x391e01[_0x67a3('0x1b')];var _0x110fa4=_0x3230fa?0x0:_0x5b96cd[_0x67a3('0x18')];var _0xe1c5e9=_0x3230fa?_0x391e01[_0x67a3('0x1b')]:_0x5b96cd['offset']+_0x5b96cd[_0x67a3('0x1a')];var _0x429a73;if(_0xe1c5e9>=_0x46a3c2){_0xe1c5e9=_0x46a3c2;_0x429a73=0xc8;}else{_0x429a73=0xce;}_0x189983['status'](_0x429a73);return _0x189983[_0x67a3('0x1c')](_0x67a3('0x1d'),_0x110fa4+'-'+_0xe1c5e9+'/'+_0x46a3c2)[_0x67a3('0x1e')](_0x391e01);}return null;};}function patchUpdates(_0x704759){return function(_0x4ad0f6){try{jsonpatch['apply'](_0x4ad0f6,_0x704759,!![]);}catch(_0x2c5473){return BPromise[_0x67a3('0x1f')](_0x2c5473);}return _0x4ad0f6[_0x67a3('0x20')]();};}function saveUpdates(_0x1b878e,_0x3a69a5){return function(_0x562506){if(_0x562506){return _0x562506[_0x67a3('0x21')](_0x1b878e)[_0x67a3('0x22')](function(_0x3e967d){return _0x3e967d;});}return null;};}function removeEntity(_0x20f0fd,_0x3b7c21){return function(_0x7253a2){if(_0x7253a2){return _0x7253a2['destroy']()[_0x67a3('0x22')](function(){_0x20f0fd[_0x67a3('0x16')](0xcc)[_0x67a3('0x17')]();});}};}function handleEntityNotFound(_0x4da03b,_0x1ee21a){return function(_0x26a83b){if(!_0x26a83b){_0x4da03b[_0x67a3('0x15')](0x194);}return _0x26a83b;};}function handleError(_0x52ed0b,_0x439bbb){_0x439bbb=_0x439bbb||0x1f4;return function(_0x59b9cc){logger[_0x67a3('0x23')](_0x59b9cc[_0x67a3('0x24')]);if(_0x59b9cc['name']){delete _0x59b9cc['name'];}_0x52ed0b[_0x67a3('0x16')](_0x439bbb)[_0x67a3('0x25')](_0x59b9cc);};}exports[_0x67a3('0x26')]=function(_0x50a27e,_0x593a6b){var _0x452d71={},_0x8c6af0={},_0x350037={'count':0x0,'rows':[]};var _0x436842=_[_0x67a3('0x27')](db[_0x67a3('0x28')][_0x67a3('0x29')],function(_0x33b311){return{'name':_0x33b311[_0x67a3('0x2a')],'type':_0x33b311[_0x67a3('0x2b')][_0x67a3('0x2c')]};});_0x8c6af0[_0x67a3('0x2d')]=_[_0x67a3('0x2e')](_[_0x67a3('0x27')](_0x436842,_0x67a3('0x2f')),[_0x67a3('0x30')]);_0x8c6af0[_0x67a3('0x31')]=_['keys'](_0x50a27e[_0x67a3('0x31')]);_0x8c6af0[_0x67a3('0x32')]=_['intersection'](_0x8c6af0[_0x67a3('0x2d')],_0x8c6af0[_0x67a3('0x31')]);_0x452d71[_0x67a3('0x33')]=_['intersection'](_0x8c6af0[_0x67a3('0x2d')],qs['fields'](_0x50a27e[_0x67a3('0x31')][_0x67a3('0x34')]));_0x452d71[_0x67a3('0x33')]=_0x452d71[_0x67a3('0x33')]['length']?_0x452d71['attributes']:_0x8c6af0[_0x67a3('0x2d')];if(!_0x50a27e[_0x67a3('0x31')][_0x67a3('0x35')](_0x67a3('0x36'))){_0x452d71['limit']=qs[_0x67a3('0x1a')](_0x50a27e[_0x67a3('0x31')][_0x67a3('0x1a')]);_0x452d71[_0x67a3('0x18')]=qs[_0x67a3('0x18')](_0x50a27e[_0x67a3('0x31')][_0x67a3('0x18')]);}_0x452d71['order']=qs['sort'](_0x50a27e[_0x67a3('0x31')][_0x67a3('0x37')]);_0x452d71[_0x67a3('0x38')]=qs[_0x67a3('0x32')](_[_0x67a3('0x39')](_0x50a27e['query'],_0x8c6af0[_0x67a3('0x32')]),_0x436842);if(_0x50a27e[_0x67a3('0x31')][_0x67a3('0x3a')]){_0x452d71['where']=_[_0x67a3('0x3b')](_0x452d71[_0x67a3('0x38')],{'$or':_[_0x67a3('0x27')](_0x436842,function(_0x4cb008){if(_0x4cb008[_0x67a3('0x2b')]!==_0x67a3('0x3c')){var _0x43ae6a={};_0x43ae6a[_0x4cb008[_0x67a3('0x2f')]]={'$like':'%'+_0x50a27e[_0x67a3('0x31')][_0x67a3('0x3a')]+'%'};return _0x43ae6a;}})});}_0x452d71=_['merge']({},_0x452d71,_0x50a27e[_0x67a3('0x3d')]);var _0x230229={'where':_0x452d71[_0x67a3('0x38')]};return db[_0x67a3('0x28')][_0x67a3('0x1b')](_0x230229)['then'](function(_0x52bbec){_0x350037['count']=_0x52bbec;if(_0x50a27e[_0x67a3('0x31')][_0x67a3('0x3e')]){_0x452d71[_0x67a3('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x67a3('0x40')](_0x452d71);})['then'](function(_0x59fa08){_0x350037[_0x67a3('0x41')]=_0x59fa08;return _0x350037;})['then'](respondWithFilteredResult(_0x593a6b,_0x452d71))[_0x67a3('0x42')](handleError(_0x593a6b,null));};exports['show']=function(_0x4fcad7,_0x5d3b0e){var _0x2902ee={'raw':![],'where':{'id':_0x4fcad7[_0x67a3('0x43')]['id']}},_0x56b030={};_0x56b030[_0x67a3('0x2d')]=_[_0x67a3('0x44')](db['VoiceRecording'][_0x67a3('0x29')]);_0x56b030['query']=_['keys'](_0x4fcad7[_0x67a3('0x31')]);_0x56b030['filters']=_['intersection'](_0x56b030[_0x67a3('0x2d')],_0x56b030['query']);_0x2902ee[_0x67a3('0x33')]=_[_0x67a3('0x45')](_0x56b030[_0x67a3('0x2d')],qs[_0x67a3('0x34')](_0x4fcad7[_0x67a3('0x31')][_0x67a3('0x34')]));_0x2902ee[_0x67a3('0x33')]=_0x2902ee[_0x67a3('0x33')]['length']?_0x2902ee[_0x67a3('0x33')]:_0x56b030[_0x67a3('0x2d')];if(_0x4fcad7[_0x67a3('0x31')]['includeAll']){_0x2902ee['include']=[{'all':!![]}];}_0x2902ee=_[_0x67a3('0x3b')]({},_0x2902ee,_0x4fcad7[_0x67a3('0x3d')]);return db[_0x67a3('0x28')][_0x67a3('0x46')](_0x2902ee)[_0x67a3('0x22')](handleEntityNotFound(_0x5d3b0e,null))[_0x67a3('0x22')](respondWithResult(_0x5d3b0e,null))[_0x67a3('0x42')](handleError(_0x5d3b0e,null));};exports[_0x67a3('0x47')]=function(_0x419298,_0x186a2d){return db[_0x67a3('0x28')][_0x67a3('0x47')](_0x419298[_0x67a3('0x48')],{})[_0x67a3('0x22')](respondWithResult(_0x186a2d,0xc9))[_0x67a3('0x42')](handleError(_0x186a2d,null));};exports[_0x67a3('0x21')]=function(_0x24d506,_0x337654){if(_0x24d506[_0x67a3('0x48')]['id']){delete _0x24d506[_0x67a3('0x48')]['id'];}return db[_0x67a3('0x28')][_0x67a3('0x46')]({'where':{'id':_0x24d506[_0x67a3('0x43')]['id']}})['then'](handleEntityNotFound(_0x337654,null))[_0x67a3('0x22')](saveUpdates(_0x24d506[_0x67a3('0x48')],null))['then'](respondWithResult(_0x337654,null))[_0x67a3('0x42')](handleError(_0x337654,null));};exports[_0x67a3('0x49')]=function(_0x3d1714,_0x8322a){return db[_0x67a3('0x28')][_0x67a3('0x49')]()[_0x67a3('0x22')](respondWithResult(_0x8322a,null))[_0x67a3('0x42')](handleError(_0x8322a,null));};exports[_0x67a3('0x4a')]=function(_0x3a01be,_0x38a439,_0x499f95){var _0x428717=require(_0x67a3('0x4b'));var _0x775d90=![];var _0x930a16={};if(_0x3a01be[_0x67a3('0x31')]['type']&&_0x3a01be[_0x67a3('0x31')][_0x67a3('0x2b')]===_0x67a3('0x4c')){_0x930a16[_0x67a3('0x4c')]=_0x3a01be[_0x67a3('0x43')]['id'];}else{_0x930a16['id']=_0x3a01be[_0x67a3('0x43')]['id'];}return db[_0x67a3('0x28')][_0x67a3('0x46')]({'where':_0x930a16,'attributes':['id',_0x67a3('0x4d')],'raw':!![]})[_0x67a3('0x22')](handleEntityNotFound(_0x38a439,null))[_0x67a3('0x22')](function(_0x56b9d2){if(_0x56b9d2){var _0x3bc17d=_0x56b9d2[_0x67a3('0x4d')];var _0x1f5e86=util[_0x67a3('0x30')](_0x67a3('0x4e'),_0x3bc17d);if(fs[_0x67a3('0x4f')](_0x1f5e86)){_0x775d90=!![];return _0x428717[_0x67a3('0x50')](_0x1f5e86,_0x3bc17d,config[_0x67a3('0x51')][_0x67a3('0x52')])['then'](function(){return _0x56b9d2;});}return _0x56b9d2;}})[_0x67a3('0x22')](function(_0x2bc77c){if(_0x2bc77c){var _0x4b769c=_0x2bc77c[_0x67a3('0x4d')];if(!fs['existsSync'](_0x4b769c)){throw new db[(_0x67a3('0x53'))]['ValidationError'](_0x67a3('0x54'));}if(_0x2bc77c[_0x67a3('0x55')]){return _0x38a439[_0x67a3('0x4a')](_0x4b769c,_0x2bc77c['filename']+path['extname'](_0x4b769c),function(){if(_0x775d90){fs[_0x67a3('0x56')](_0x4b769c);}});}else{return _0x38a439['download'](_0x4b769c,function(_0x1eba41){if(_0x775d90){fs[_0x67a3('0x56')](_0x4b769c);}});}}})[_0x67a3('0x42')](function(_0x3ccce5){if(_0x3ccce5[_0x67a3('0x57')]==='VoiceRecording\x20not\x20found'){_0x38a439[_0x67a3('0x16')](0x194)[_0x67a3('0x25')](_0x67a3('0x58'));}else{return handleError(_0x38a439,null);}});};exports[_0x67a3('0x59')]=function(_0xd24b2e,_0x2c17e4,_0x4275af){var _0xef2c83=require(_0x67a3('0x4b'));var _0x10911b=![];var _0x41b939={'$and':[db[_0x67a3('0x5a')]['where'](db[_0x67a3('0x5a')]['fn'](_0x67a3('0x5b'),db['sequelize'][_0x67a3('0x5c')](_0x67a3('0x4c'))),_0xd24b2e[_0x67a3('0x31')][_0x67a3('0x5d')])]};if(_0xd24b2e[_0x67a3('0x31')][_0x67a3('0x2b')]&&_0xd24b2e[_0x67a3('0x31')][_0x67a3('0x2b')]===_0x67a3('0x4c')){_0x41b939['$and'][_0x67a3('0x5e')]({'uniqueid':_0xd24b2e[_0x67a3('0x43')]['id']});}else{_0x41b939[_0x67a3('0x5f')]['push']({'id':_0xd24b2e[_0x67a3('0x43')]['id']});}return db[_0x67a3('0x28')][_0x67a3('0x46')]({'where':_0x41b939,'attributes':['id',_0x67a3('0x4d')],'raw':!![]})[_0x67a3('0x22')](handleEntityNotFound(_0x2c17e4,null))['then'](function(_0x3e44a5){if(_0x3e44a5){var _0x40b7e0=util['format'](_0x67a3('0x4e'),_0x3e44a5[_0x67a3('0x4d')]);if(fs['existsSync'](_0x40b7e0)){_0x10911b=!![];return _0xef2c83[_0x67a3('0x50')](_0x40b7e0,_0x3e44a5[_0x67a3('0x4d')],config[_0x67a3('0x51')][_0x67a3('0x52')])[_0x67a3('0x22')](function(){return _0x3e44a5;});}return _0x3e44a5;}})[_0x67a3('0x22')](function(_0x27ee25){if(_0x27ee25){if(!fs[_0x67a3('0x4f')](_0x27ee25['value'])){throw new db['Sequelize'][(_0x67a3('0x60'))](_0x67a3('0x54'));}if(_0x27ee25[_0x67a3('0x55')]){return _0x2c17e4['download'](_0x27ee25['value'],_0x27ee25[_0x67a3('0x55')]+path[_0x67a3('0x61')](_0x27ee25[_0x67a3('0x4d')]),function(){if(_0x10911b){fs['unlink'](_0x27ee25['value']);}});}else{return _0x2c17e4[_0x67a3('0x4a')](_0x27ee25[_0x67a3('0x4d')],function(_0x587032){if(_0x10911b){fs['unlink'](_0x27ee25[_0x67a3('0x4d')]);}});}}})[_0x67a3('0x42')](handleError(_0x2c17e4,null));};exports[_0x67a3('0x62')]=function(_0x514c6d,_0x4bbae4){return db[_0x67a3('0x28')][_0x67a3('0x46')]({'where':{'id':_0x514c6d[_0x67a3('0x43')]['id']}})['then'](function(_0x4b65c7){if(_[_0x67a3('0x63')](_0x4b65c7)){throw new ReferenceError(_0x67a3('0x64'));}return _0x4b65c7;})[_0x67a3('0x22')](function(_0x16e359){var _0x1f5125=_0x16e359['value'];logger['info'](_0x67a3('0x65'),_0x1f5125);if(!_['isNil'](_0x16e359[_0x67a3('0x4d')])&&fs['existsSync'](_0x1f5125)){logger[_0x67a3('0x66')](_0x67a3('0x67')+_0x1f5125+_0x67a3('0x68'));fs['unlinkSync'](_0x1f5125);}_0x1f5125=_0x1f5125+_0x67a3('0x69');if(!_[_0x67a3('0x63')](_0x16e359[_0x67a3('0x4d')])&&fs[_0x67a3('0x4f')](_0x1f5125)){logger[_0x67a3('0x66')](_0x67a3('0x67')+_0x1f5125+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x67a3('0x6a')](_0x1f5125);}return _0x16e359;})['then'](function(_0x51d59b){if(!_0x51d59b)throw new InternalError();return _0x51d59b[_0x67a3('0x62')]();})[_0x67a3('0x22')](function(){_0x4bbae4[_0x67a3('0x16')](0xcc)['end']();})[_0x67a3('0x42')](handleError(_0x4bbae4,null));};function getBucketslist(_0x2a5606,_0x13dcc5,_0x5e04b8){return new Promise(function(_0x555d8d,_0x2c0723){var _0x2e8388=new AWS['S3']({'accessKeyId':_0x13dcc5,'secretAccessKey':_0x2a5606,'region':_0x5e04b8});_0x2e8388[_0x67a3('0x6b')]({},function(_0x1db665,_0x4c25b4){if(_0x1db665){return _0x2c0723(_0x1db665);}else{return _0x555d8d(_0x4c25b4);}});});}function createBucket(_0x46468c,_0x3b82f7,_0x364e92,_0x1e3549){return new Promise(function(_0x2f759a,_0x57a0fc){var _0x4f53db=new AWS['S3']({'accessKeyId':_0x3b82f7,'secretAccessKey':_0x46468c,'region':_0x364e92});_0x4f53db[_0x67a3('0x6c')]({'Bucket':_0x1e3549},function(_0x59c92b,_0x46e2c1){if(_0x59c92b){return _0x57a0fc(_0x59c92b);}else{return _0x2f759a(_0x46e2c1);}});});}function uploadFile(_0x408b04,_0x1a6552,_0x35a151,_0x4020b7,_0x3dd228,_0x249a35){return new Promise(function(_0x42e1f9,_0x11715c){var _0x4e57c1=new AWS['S3']({'accessKeyId':_0x1a6552,'secretAccessKey':_0x408b04,'region':_0x35a151});_0x4e57c1['upload']({'Bucket':_0x4020b7,'Key':_0x3dd228,'Body':_0x249a35},function(_0x4fb720,_0x562a83){if(_0x4fb720){return _0x11715c(_0x4fb720);}else{return _0x42e1f9(_0x562a83);}});});}function startTranscribe(_0x57d991,_0x5b9c40,_0x493c21,_0x498f7,_0x573d34,_0x2d3f9f){return new Promise(function(_0x738fc2,_0x5e0767){var _0x425acc=new AWS[(_0x67a3('0x6d'))]({'accessKeyId':_0x5b9c40,'secretAccessKey':_0x57d991,'region':_0x493c21});_0x425acc['startTranscriptionJob']({'TranscriptionJobName':_0x498f7,'LanguageCode':_0x573d34,'Media':{'MediaFileUri':_0x2d3f9f}},function(_0xcd6c4d,_0x26734c){if(_0xcd6c4d){return _0x5e0767(_0xcd6c4d);}else{return _0x738fc2(_0x26734c);}});});}function transcribe(_0x5e5538,_0x47fe84,_0x2573ce,_0x4f9585,_0x5279cc,_0x2352c6,_0x169949){return new Promise(function(_0x27a9d4,_0xb0a1d){var _0x188c5f={};logger[_0x67a3('0x66')](util[_0x67a3('0x30')](_0x67a3('0x6e'),_0x5e5538,_0x5279cc));return uploadFile(_0x47fe84,_0x2573ce,_0x4f9585,_0x5279cc,path[_0x67a3('0x6f')](_0x2352c6),fs[_0x67a3('0x70')](_0x2352c6))[_0x67a3('0x22')](function(_0x9db296){logger[_0x67a3('0x66')](util[_0x67a3('0x30')](_0x67a3('0x71'),_0x5e5538,_0x5279cc,_0x9db296[_0x67a3('0x72')]));_0x188c5f[_0x67a3('0x73')]=_0x9db296[_0x67a3('0x74')];_0x188c5f['location']=_0x9db296[_0x67a3('0x72')];logger[_0x67a3('0x66')](util[_0x67a3('0x30')](_0x67a3('0x75'),_0x5e5538));return startTranscribe(_0x47fe84,_0x2573ce,_0x4f9585,uuidv4(),_0x169949,_0x9db296[_0x67a3('0x72')]);})[_0x67a3('0x22')](function(_0x1db511){logger['info'](util['format'](_0x67a3('0x76'),_0x5e5538,_0x1db511[_0x67a3('0x77')][_0x67a3('0x78')]));_0x188c5f[_0x67a3('0x79')]=_0x1db511[_0x67a3('0x77')][_0x67a3('0x78')];_0x188c5f[_0x67a3('0x7a')]=_0x1db511['TranscriptionJob'][_0x67a3('0x7b')];return _0x27a9d4(_0x188c5f);})[_0x67a3('0x42')](function(_0x533b5c){return _0xb0a1d(_0x533b5c);});});}exports[_0x67a3('0x7c')]=function(_0x267077,_0x77a3b2,_0xc65d82){var _0xa22f96;var _0x288721;var _0x5dd7e6;var _0x4e07af=require(_0x67a3('0x4b'));return db[_0x67a3('0x28')][_0x67a3('0x7d')]({'where':{'id':_0x267077[_0x67a3('0x43')]['id']}})[_0x67a3('0x22')](function(_0x4a63d4){if(_0x4a63d4){var _0x5c0abb=util[_0x67a3('0x30')](_0x67a3('0x4e'),_0x4a63d4[_0x67a3('0x4d')]);if(fs[_0x67a3('0x4f')](_0x5c0abb)){cypher=!![];return _0x4e07af[_0x67a3('0x50')](_0x5c0abb,_0x4a63d4[_0x67a3('0x4d')],config['secrets'][_0x67a3('0x52')])[_0x67a3('0x22')](function(){return _0x4a63d4;});}return _0x4a63d4;}})[_0x67a3('0x22')](function(_0x2bdf4b){if(!_0x2bdf4b){throw new db[(_0x67a3('0x53'))]['ValidationError'](_0x67a3('0x7e'));}_0x288721=_0x2bdf4b;return db['Setting'][_0x67a3('0x7d')]({'where':{'id':0x1}});})[_0x67a3('0x22')](handleEntityNotFound(_0x77a3b2,null))[_0x67a3('0x22')](function(_0x2be7c3){if(_0x2be7c3){_0xa22f96=_0x2be7c3;if(!_0xa22f96[_0x67a3('0x7f')]||!_0xa22f96[_0x67a3('0x80')]||!_0xa22f96['transcribeRegion']||!_0xa22f96[_0x67a3('0x81')]||!_0xa22f96[_0x67a3('0x73')]){throw new db[(_0x67a3('0x53'))][(_0x67a3('0x60'))]('Transcribe\x20not\x20configured');}if(_0x267077['body']['runSentiment']&&(!_0xa22f96[_0x67a3('0x82')]||!_0xa22f96[_0x67a3('0x83')]||!_0xa22f96[_0x67a3('0x84')]||!_0xa22f96[_0x67a3('0x81')]||!_0xa22f96['bucket'])){throw new db[(_0x67a3('0x53'))][(_0x67a3('0x60'))](_0x67a3('0x85'));}return db[_0x67a3('0x86')][_0x67a3('0x7d')]({'where':{'id':_0xa22f96[_0x67a3('0x80')]}});}})[_0x67a3('0x22')](function(_0x4c5283){if(!_0x4c5283){throw new db[(_0x67a3('0x53'))][(_0x67a3('0x60'))](_0x67a3('0x87'));}if(!_0x4c5283[_0x67a3('0x88')]||!_0x4c5283[_0x67a3('0x89')]){throw new db[(_0x67a3('0x53'))][(_0x67a3('0x60'))](_0x67a3('0x8a'));}_0x5dd7e6=_0x4c5283;return getBucketslist(_0x5dd7e6[_0x67a3('0x88')],_0x5dd7e6[_0x67a3('0x89')],_0xa22f96['transcribeRegion']);})['then'](function(_0x184cf4){if(_0x184cf4&&_0x184cf4[_0x67a3('0x8b')]){var _0x317dcc=_[_0x67a3('0x46')](_0x184cf4['Buckets'],function(_0x4bd9fd){return _0x4bd9fd[_0x67a3('0x8c')]===_0xa22f96[_0x67a3('0x73')];});if(!_0x317dcc){logger[_0x67a3('0x66')](util[_0x67a3('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x267077['params']['id'],_0xa22f96[_0x67a3('0x73')]));return createBucket(_0x5dd7e6[_0x67a3('0x88')],_0x5dd7e6['data2'],_0xa22f96[_0x67a3('0x8d')],_0xa22f96[_0x67a3('0x73')]);}logger[_0x67a3('0x66')](util[_0x67a3('0x30')](_0x67a3('0x8e'),_0x267077[_0x67a3('0x43')]['id'],_0xa22f96[_0x67a3('0x73')]));return;}})[_0x67a3('0x22')](function(_0x1cbbce){if(_0x288721['transcribeStatus']===_0x67a3('0x8f')){return transcribe(_0x267077[_0x67a3('0x43')]['id'],_0x5dd7e6['data1'],_0x5dd7e6['data2'],_0xa22f96['transcribeRegion'],_0xa22f96[_0x67a3('0x73')],_0x288721[_0x67a3('0x4d')],_0xa22f96[_0x67a3('0x81')]);}else{logger[_0x67a3('0x66')](util[_0x67a3('0x30')](_0x67a3('0x90'),_0x267077['params']['id']));return{'transcribeStatus':_0x67a3('0x91')};}})['then'](function(_0x240648){if(_0x240648){_0x240648['tempSentiment']=_0x267077[_0x67a3('0x48')]['runSentiment'];return _0x288721[_0x67a3('0x92')](_0x240648);}})['then'](respondWithResult(_0x77a3b2,null))[_0x67a3('0x42')](handleError(_0x77a3b2,null));};function writeFile(_0x2aa368,_0x4b50e7){return new Promise(function(_0x2860b7,_0x16e60c){fs[_0x67a3('0x93')](_0x4b50e7,_0x2aa368,function(_0x46d994,_0x1f7918){if(_0x46d994){return _0x16e60c(_0x46d994);}else{return _0x2860b7(_0x1f7918);}});});}exports[_0x67a3('0x94')]=function(_0x2e9af8,_0x551ee1,_0x322da7){return db['VoiceRecording'][_0x67a3('0x7d')]({'where':{'id':_0x2e9af8[_0x67a3('0x43')]['id']}})[_0x67a3('0x22')](handleEntityNotFound(_0x551ee1))[_0x67a3('0x22')](function(_0x1eab49){if(_0x1eab49&&_0x1eab49[_0x67a3('0x95')]){var _0x4b2044=_0x1eab49[_0x67a3('0x95')];var _0x12d459=config[_0x67a3('0x96')]+_0x67a3('0x97')+_0x1eab49['id']+'.txt';if(fs[_0x67a3('0x4f')](_0x12d459)){return _0x12d459;}return writeFile(_0x4b2044,_0x12d459)['then'](function(){return _0x12d459;});}else{throw new db[(_0x67a3('0x53'))]['ValidationError'](_0x67a3('0x98'));}})[_0x67a3('0x22')](function(_0x1837ac){return _0x551ee1['download'](_0x1837ac);})[_0x67a3('0x42')](handleError(_0x551ee1));}; \ No newline at end of file +var _0x3301=['Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','VoiceRecording','includeAll','include','catch','show','params','keys','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','token','$and','push','ValidationError','isNil','Entity\x20not\x20found','info','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt'];(function(_0x3be885,_0xc8dbc6){var _0x3b8e1f=function(_0x2a15db){while(--_0x2a15db){_0x3be885['push'](_0x3be885['shift']());}};_0x3b8e1f(++_0xc8dbc6);}(_0x3301,0x129));var _0x1330=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x3301[_0x37d0bc];return _0x170e60;};'use strict';var emlformat=require(_0x1330('0x0'));var rimraf=require(_0x1330('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1330('0x2'));var rp=require(_0x1330('0x3'));var moment=require(_0x1330('0x4'));var BPromise=require(_0x1330('0x5'));var Mustache=require(_0x1330('0x6'));var util=require('util');var path=require(_0x1330('0x7'));var sox=require('sox');var csv=require(_0x1330('0x8'));var ejs=require(_0x1330('0x9'));var fs=require('fs');var fs_extra=require(_0x1330('0xa'));var _=require(_0x1330('0xb'));var squel=require(_0x1330('0xc'));var crypto=require('crypto');var jsforce=require(_0x1330('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1330('0x8'));var querystring=require(_0x1330('0xe'));var Papa=require(_0x1330('0xf'));var AWS=require(_0x1330('0x10'));var uuidv4=require(_0x1330('0x11'));var Redis=require('ioredis');var authService=require(_0x1330('0x12'));var qs=require(_0x1330('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1330('0x14'))(_0x1330('0x15'));var utils=require('../../config/utils');var config=require(_0x1330('0x16'));var licenseUtil=require(_0x1330('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557b8b,_0xbf4a93){_0xbf4a93=_0xbf4a93||0xcc;return function(_0x5b8412){if(_0x5b8412){return _0x557b8b['sendStatus'](_0xbf4a93);}return _0x557b8b[_0x1330('0x18')](_0xbf4a93)['end']();};}function respondWithResult(_0x1c1bfa,_0x2c0271){_0x2c0271=_0x2c0271||0xc8;return function(_0x1e7f9a){if(_0x1e7f9a){return _0x1c1bfa[_0x1330('0x18')](_0x2c0271)[_0x1330('0x19')](_0x1e7f9a);}};}function respondWithFilteredResult(_0xf147ad,_0x3a1671){return function(_0x265e25){if(_0x265e25){var _0x25eb9b=typeof _0x3a1671['offset']===_0x1330('0x1a')&&typeof _0x3a1671[_0x1330('0x1b')]===_0x1330('0x1a');var _0x56945e=_0x265e25['count'];var _0x5a3017=_0x25eb9b?0x0:_0x3a1671[_0x1330('0x1c')];var _0x277608=_0x25eb9b?_0x265e25[_0x1330('0x1d')]:_0x3a1671['offset']+_0x3a1671['limit'];var _0x4c4ed2;if(_0x277608>=_0x56945e){_0x277608=_0x56945e;_0x4c4ed2=0xc8;}else{_0x4c4ed2=0xce;}_0xf147ad['status'](_0x4c4ed2);return _0xf147ad[_0x1330('0x1e')](_0x1330('0x1f'),_0x5a3017+'-'+_0x277608+'/'+_0x56945e)[_0x1330('0x19')](_0x265e25);}return null;};}function patchUpdates(_0x53877d){return function(_0x245781){try{jsonpatch[_0x1330('0x20')](_0x245781,_0x53877d,!![]);}catch(_0x4301fe){return BPromise[_0x1330('0x21')](_0x4301fe);}return _0x245781[_0x1330('0x22')]();};}function saveUpdates(_0x4d3045,_0x16b361){return function(_0x7f9e56){if(_0x7f9e56){return _0x7f9e56['update'](_0x4d3045)[_0x1330('0x23')](function(_0x1b8858){return _0x1b8858;});}return null;};}function removeEntity(_0x184efc,_0x3eb574){return function(_0xfba6b8){if(_0xfba6b8){return _0xfba6b8[_0x1330('0x24')]()[_0x1330('0x23')](function(){_0x184efc[_0x1330('0x18')](0xcc)[_0x1330('0x25')]();});}};}function handleEntityNotFound(_0x22560c,_0x45b668){return function(_0x1afc10){if(!_0x1afc10){_0x22560c['sendStatus'](0x194);}return _0x1afc10;};}function handleError(_0x5ba892,_0x2774e4){_0x2774e4=_0x2774e4||0x1f4;return function(_0x598552){logger[_0x1330('0x26')](_0x598552[_0x1330('0x27')]);if(_0x598552[_0x1330('0x28')]){delete _0x598552[_0x1330('0x28')];}_0x5ba892['status'](_0x2774e4)['send'](_0x598552);};}exports[_0x1330('0x29')]=function(_0x14181f,_0x415e5f){var _0x20bc74={},_0x47791b={},_0x3b2e6b={'count':0x0,'rows':[]};var _0x3d4b10=_[_0x1330('0x2a')](db['VoiceRecording'][_0x1330('0x2b')],function(_0x4232c1){return{'name':_0x4232c1[_0x1330('0x2c')],'type':_0x4232c1[_0x1330('0x2d')][_0x1330('0x2e')]};});_0x47791b[_0x1330('0x2f')]=_[_0x1330('0x30')](_[_0x1330('0x2a')](_0x3d4b10,_0x1330('0x28')),[_0x1330('0x31')]);_0x47791b[_0x1330('0x32')]=_['keys'](_0x14181f[_0x1330('0x32')]);_0x47791b[_0x1330('0x33')]=_['intersection'](_0x47791b[_0x1330('0x2f')],_0x47791b['query']);_0x20bc74['attributes']=_[_0x1330('0x34')](_0x47791b[_0x1330('0x2f')],qs[_0x1330('0x35')](_0x14181f[_0x1330('0x32')][_0x1330('0x35')]));_0x20bc74['attributes']=_0x20bc74[_0x1330('0x36')][_0x1330('0x37')]?_0x20bc74[_0x1330('0x36')]:_0x47791b[_0x1330('0x2f')];if(!_0x14181f[_0x1330('0x32')][_0x1330('0x38')]('nolimit')){_0x20bc74[_0x1330('0x1b')]=qs[_0x1330('0x1b')](_0x14181f['query'][_0x1330('0x1b')]);_0x20bc74[_0x1330('0x1c')]=qs[_0x1330('0x1c')](_0x14181f['query'][_0x1330('0x1c')]);}_0x20bc74[_0x1330('0x39')]=qs[_0x1330('0x3a')](_0x14181f['query'][_0x1330('0x3a')]);_0x20bc74['where']=qs[_0x1330('0x33')](_[_0x1330('0x3b')](_0x14181f[_0x1330('0x32')],_0x47791b[_0x1330('0x33')]),_0x3d4b10);if(_0x14181f[_0x1330('0x32')][_0x1330('0x3c')]){_0x20bc74[_0x1330('0x3d')]=_['merge'](_0x20bc74[_0x1330('0x3d')],{'$or':_['map'](_0x3d4b10,function(_0x374453){if(_0x374453['type']!==_0x1330('0x3e')){var _0x857f9={};_0x857f9[_0x374453['name']]={'$like':'%'+_0x14181f['query']['filter']+'%'};return _0x857f9;}})});}_0x20bc74=_[_0x1330('0x3f')]({},_0x20bc74,_0x14181f['options']);var _0x138a01={'where':_0x20bc74[_0x1330('0x3d')]};return db[_0x1330('0x40')][_0x1330('0x1d')](_0x138a01)['then'](function(_0x16128f){_0x3b2e6b[_0x1330('0x1d')]=_0x16128f;if(_0x14181f[_0x1330('0x32')][_0x1330('0x41')]){_0x20bc74[_0x1330('0x42')]=[{'all':!![]}];}return db[_0x1330('0x40')]['findAll'](_0x20bc74);})[_0x1330('0x23')](function(_0x883397){_0x3b2e6b['rows']=_0x883397;return _0x3b2e6b;})[_0x1330('0x23')](respondWithFilteredResult(_0x415e5f,_0x20bc74))[_0x1330('0x43')](handleError(_0x415e5f,null));};exports[_0x1330('0x44')]=function(_0x24f37c,_0x313b58){var _0x5168f0={'raw':![],'where':{'id':_0x24f37c[_0x1330('0x45')]['id']}},_0x4f8468={};_0x4f8468['model']=_[_0x1330('0x46')](db[_0x1330('0x40')][_0x1330('0x2b')]);_0x4f8468[_0x1330('0x32')]=_[_0x1330('0x46')](_0x24f37c[_0x1330('0x32')]);_0x4f8468['filters']=_[_0x1330('0x34')](_0x4f8468['model'],_0x4f8468['query']);_0x5168f0[_0x1330('0x36')]=_[_0x1330('0x34')](_0x4f8468[_0x1330('0x2f')],qs[_0x1330('0x35')](_0x24f37c['query'][_0x1330('0x35')]));_0x5168f0[_0x1330('0x36')]=_0x5168f0[_0x1330('0x36')][_0x1330('0x37')]?_0x5168f0[_0x1330('0x36')]:_0x4f8468['model'];if(_0x24f37c[_0x1330('0x32')][_0x1330('0x41')]){_0x5168f0['include']=[{'all':!![]}];}_0x5168f0=_['merge']({},_0x5168f0,_0x24f37c[_0x1330('0x47')]);return db['VoiceRecording'][_0x1330('0x48')](_0x5168f0)[_0x1330('0x23')](handleEntityNotFound(_0x313b58,null))[_0x1330('0x23')](respondWithResult(_0x313b58,null))['catch'](handleError(_0x313b58,null));};exports['create']=function(_0x5ac8e9,_0x2e810f){return db[_0x1330('0x40')][_0x1330('0x49')](_0x5ac8e9[_0x1330('0x4a')],{})['then'](respondWithResult(_0x2e810f,0xc9))['catch'](handleError(_0x2e810f,null));};exports['update']=function(_0x42fd56,_0x12461c){if(_0x42fd56[_0x1330('0x4a')]['id']){delete _0x42fd56[_0x1330('0x4a')]['id'];}return db[_0x1330('0x40')]['find']({'where':{'id':_0x42fd56[_0x1330('0x45')]['id']}})[_0x1330('0x23')](handleEntityNotFound(_0x12461c,null))[_0x1330('0x23')](saveUpdates(_0x42fd56['body'],null))[_0x1330('0x23')](respondWithResult(_0x12461c,null))[_0x1330('0x43')](handleError(_0x12461c,null));};exports[_0x1330('0x4b')]=function(_0x4e640e,_0x235c6f){return db[_0x1330('0x40')][_0x1330('0x4b')]()[_0x1330('0x23')](respondWithResult(_0x235c6f,null))[_0x1330('0x43')](handleError(_0x235c6f,null));};exports[_0x1330('0x4c')]=function(_0x219abd,_0x504095,_0x455a63){var _0x1fc184=require(_0x1330('0x4d'));var _0x3b62b3=![];var _0x17f805={};if(_0x219abd[_0x1330('0x32')][_0x1330('0x2d')]&&_0x219abd[_0x1330('0x32')][_0x1330('0x2d')]===_0x1330('0x4e')){_0x17f805['uniqueid']=_0x219abd[_0x1330('0x45')]['id'];}else{_0x17f805['id']=_0x219abd[_0x1330('0x45')]['id'];}return db[_0x1330('0x40')][_0x1330('0x48')]({'where':_0x17f805,'attributes':['id',_0x1330('0x4f')],'raw':!![]})[_0x1330('0x23')](handleEntityNotFound(_0x504095,null))[_0x1330('0x23')](function(_0x5f0d38){if(_0x5f0d38){var _0x49d2a3=_0x5f0d38['value'];var _0x298ed8=util[_0x1330('0x31')](_0x1330('0x50'),_0x49d2a3);if(fs[_0x1330('0x51')](_0x298ed8)){_0x3b62b3=!![];return _0x1fc184[_0x1330('0x52')](_0x298ed8,_0x49d2a3,config[_0x1330('0x53')]['recording'])[_0x1330('0x23')](function(){return _0x5f0d38;});}return _0x5f0d38;}})[_0x1330('0x23')](function(_0x447737){if(_0x447737){var _0x2abf50=_0x447737[_0x1330('0x4f')];if(!fs['existsSync'](_0x2abf50)){throw new db[(_0x1330('0x54'))]['ValidationError'](_0x1330('0x55'));}if(_0x447737[_0x1330('0x56')]){return _0x504095[_0x1330('0x4c')](_0x2abf50,_0x447737[_0x1330('0x56')]+path[_0x1330('0x57')](_0x2abf50),function(){if(_0x3b62b3){fs[_0x1330('0x58')](_0x2abf50);}});}else{return _0x504095['download'](_0x2abf50,function(_0x45217c){if(_0x3b62b3){fs['unlink'](_0x2abf50);}});}}})[_0x1330('0x43')](function(_0x1c304b){if(_0x1c304b['message']===_0x1330('0x55')){_0x504095['status'](0x194)['send'](_0x1330('0x59'));}else{return handleError(_0x504095,null);}});};exports[_0x1330('0x5a')]=function(_0x37725a,_0x552410,_0x5be132){var _0x506016=require('../../components/encryptor');var _0x31ab9e=![];var _0x597e22={'$and':[db[_0x1330('0x5b')]['where'](db[_0x1330('0x5b')]['fn'](_0x1330('0x5c'),db[_0x1330('0x5b')]['col'](_0x1330('0x4e'))),_0x37725a['query'][_0x1330('0x5d')])]};if(_0x37725a[_0x1330('0x32')]['type']&&_0x37725a[_0x1330('0x32')][_0x1330('0x2d')]===_0x1330('0x4e')){_0x597e22[_0x1330('0x5e')]['push']({'uniqueid':_0x37725a['params']['id']});}else{_0x597e22[_0x1330('0x5e')][_0x1330('0x5f')]({'id':_0x37725a['params']['id']});}return db['VoiceRecording'][_0x1330('0x48')]({'where':_0x597e22,'attributes':['id',_0x1330('0x4f')],'raw':!![]})[_0x1330('0x23')](handleEntityNotFound(_0x552410,null))[_0x1330('0x23')](function(_0x17f412){if(_0x17f412){var _0x1e260d=util[_0x1330('0x31')](_0x1330('0x50'),_0x17f412[_0x1330('0x4f')]);if(fs['existsSync'](_0x1e260d)){_0x31ab9e=!![];return _0x506016[_0x1330('0x52')](_0x1e260d,_0x17f412[_0x1330('0x4f')],config[_0x1330('0x53')]['recording'])[_0x1330('0x23')](function(){return _0x17f412;});}return _0x17f412;}})[_0x1330('0x23')](function(_0x31de5a){if(_0x31de5a){if(!fs[_0x1330('0x51')](_0x31de5a['value'])){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))](_0x1330('0x55'));}if(_0x31de5a[_0x1330('0x56')]){return _0x552410[_0x1330('0x4c')](_0x31de5a[_0x1330('0x4f')],_0x31de5a['filename']+path[_0x1330('0x57')](_0x31de5a[_0x1330('0x4f')]),function(){if(_0x31ab9e){fs[_0x1330('0x58')](_0x31de5a[_0x1330('0x4f')]);}});}else{return _0x552410[_0x1330('0x4c')](_0x31de5a['value'],function(_0x31bedb){if(_0x31ab9e){fs['unlink'](_0x31de5a[_0x1330('0x4f')]);}});}}})[_0x1330('0x43')](handleError(_0x552410,null));};exports[_0x1330('0x24')]=function(_0x30a0b1,_0x2a645c){return db[_0x1330('0x40')][_0x1330('0x48')]({'where':{'id':_0x30a0b1[_0x1330('0x45')]['id']}})['then'](function(_0x252406){if(_[_0x1330('0x61')](_0x252406)){throw new ReferenceError(_0x1330('0x62'));}return _0x252406;})['then'](function(_0x56f801){var _0xa9e863=_0x56f801[_0x1330('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xa9e863);if(!_['isNil'](_0x56f801['value'])&&fs[_0x1330('0x51')](_0xa9e863)){logger[_0x1330('0x63')]('File:\x20\x22'+_0xa9e863+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1330('0x64')](_0xa9e863);}_0xa9e863=_0xa9e863+'.cypher';if(!_[_0x1330('0x61')](_0x56f801['value'])&&fs[_0x1330('0x51')](_0xa9e863)){logger[_0x1330('0x63')]('File:\x20\x22'+_0xa9e863+_0x1330('0x65'));fs['unlinkSync'](_0xa9e863);}return _0x56f801;})[_0x1330('0x23')](function(_0x575176){if(!_0x575176)throw new InternalError();return _0x575176[_0x1330('0x24')]();})[_0x1330('0x23')](function(){_0x2a645c[_0x1330('0x18')](0xcc)['end']();})[_0x1330('0x43')](handleError(_0x2a645c,null));};function getBucketslist(_0x33b2ae,_0x10598c,_0x4291eb){return new Promise(function(_0x301e5a,_0x1f6241){var _0x3c938b=new AWS['S3']({'accessKeyId':_0x10598c,'secretAccessKey':_0x33b2ae,'region':_0x4291eb});_0x3c938b['listBuckets']({},function(_0x4de87b,_0x27eac0){if(_0x4de87b){return _0x1f6241(_0x4de87b);}else{return _0x301e5a(_0x27eac0);}});});}function createBucket(_0x5c7630,_0x29e008,_0x10880b,_0x9b6bc4){return new Promise(function(_0x3fe7f5,_0x938e04){var _0x24b063=new AWS['S3']({'accessKeyId':_0x29e008,'secretAccessKey':_0x5c7630,'region':_0x10880b});_0x24b063[_0x1330('0x66')]({'Bucket':_0x9b6bc4},function(_0x469fb7,_0x2cf09c){if(_0x469fb7){return _0x938e04(_0x469fb7);}else{return _0x3fe7f5(_0x2cf09c);}});});}function uploadFile(_0x41e1a3,_0x5065cd,_0x500199,_0x191dc6,_0x3f8aa8,_0x23cd0c){return new Promise(function(_0x231bb1,_0x25807f){var _0x4f526e=new AWS['S3']({'accessKeyId':_0x5065cd,'secretAccessKey':_0x41e1a3,'region':_0x500199});_0x4f526e[_0x1330('0x67')]({'Bucket':_0x191dc6,'Key':_0x3f8aa8,'Body':_0x23cd0c},function(_0x263a68,_0x838fd9){if(_0x263a68){return _0x25807f(_0x263a68);}else{return _0x231bb1(_0x838fd9);}});});}function startTranscribe(_0x372495,_0x586cff,_0x34c12d,_0x41f19b,_0x392bc5,_0x2b72fd){return new Promise(function(_0x4a8cfd,_0x25a322){var _0x273d7b=new AWS[(_0x1330('0x68'))]({'accessKeyId':_0x586cff,'secretAccessKey':_0x372495,'region':_0x34c12d});_0x273d7b['startTranscriptionJob']({'TranscriptionJobName':_0x41f19b,'LanguageCode':_0x392bc5,'Media':{'MediaFileUri':_0x2b72fd}},function(_0x31c0ba,_0x89f796){if(_0x31c0ba){return _0x25a322(_0x31c0ba);}else{return _0x4a8cfd(_0x89f796);}});});}function transcribe(_0x15c7e0,_0x519095,_0x26004c,_0x5a114d,_0x21021a,_0x2fa0cc,_0x349879){return new Promise(function(_0x1e9253,_0x46a1bc){var _0x596021={};logger['info'](util[_0x1330('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x15c7e0,_0x21021a));return uploadFile(_0x519095,_0x26004c,_0x5a114d,_0x21021a,path['basename'](_0x2fa0cc),fs[_0x1330('0x69')](_0x2fa0cc))[_0x1330('0x23')](function(_0x5744c1){logger[_0x1330('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x15c7e0,_0x21021a,_0x5744c1[_0x1330('0x6a')]));_0x596021['bucket']=_0x5744c1[_0x1330('0x6b')];_0x596021[_0x1330('0x6c')]=_0x5744c1[_0x1330('0x6a')];logger[_0x1330('0x63')](util['format'](_0x1330('0x6d'),_0x15c7e0));return startTranscribe(_0x519095,_0x26004c,_0x5a114d,uuidv4(),_0x349879,_0x5744c1[_0x1330('0x6a')]);})['then'](function(_0x3ae7a9){logger['info'](util[_0x1330('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x15c7e0,_0x3ae7a9[_0x1330('0x6e')][_0x1330('0x6f')]));_0x596021[_0x1330('0x70')]=_0x3ae7a9[_0x1330('0x6e')][_0x1330('0x6f')];_0x596021[_0x1330('0x71')]=_0x3ae7a9[_0x1330('0x6e')]['TranscriptionJobStatus'];return _0x1e9253(_0x596021);})[_0x1330('0x43')](function(_0x197952){return _0x46a1bc(_0x197952);});});}exports[_0x1330('0x72')]=function(_0x15ab84,_0x4a9338,_0x4bd151){var _0x370232;var _0x37934e;var _0x1e2164;var _0x250bdd=require(_0x1330('0x4d'));return db['VoiceRecording'][_0x1330('0x73')]({'where':{'id':_0x15ab84[_0x1330('0x45')]['id']}})[_0x1330('0x23')](function(_0xd4d041){if(_0xd4d041){var _0x125e4d=util[_0x1330('0x31')](_0x1330('0x50'),_0xd4d041[_0x1330('0x4f')]);if(fs[_0x1330('0x51')](_0x125e4d)){cypher=!![];return _0x250bdd[_0x1330('0x52')](_0x125e4d,_0xd4d041[_0x1330('0x4f')],config[_0x1330('0x53')][_0x1330('0x74')])[_0x1330('0x23')](function(){return _0xd4d041;});}return _0xd4d041;}})[_0x1330('0x23')](function(_0x387a4b){if(!_0x387a4b){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))](_0x1330('0x75'));}_0x37934e=_0x387a4b;return db[_0x1330('0x76')][_0x1330('0x73')]({'where':{'id':0x1}});})[_0x1330('0x23')](handleEntityNotFound(_0x4a9338,null))[_0x1330('0x23')](function(_0x39afed){if(_0x39afed){_0x370232=_0x39afed;if(!_0x370232[_0x1330('0x77')]||!_0x370232[_0x1330('0x78')]||!_0x370232[_0x1330('0x79')]||!_0x370232['language']||!_0x370232[_0x1330('0x7a')]){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))](_0x1330('0x7b'));}if(_0x15ab84[_0x1330('0x4a')][_0x1330('0x7c')]&&(!_0x370232[_0x1330('0x7d')]||!_0x370232[_0x1330('0x7e')]||!_0x370232[_0x1330('0x7f')]||!_0x370232[_0x1330('0x80')]||!_0x370232[_0x1330('0x7a')])){throw new db[(_0x1330('0x54'))][(_0x1330('0x60'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1330('0x81')][_0x1330('0x73')]({'where':{'id':_0x370232[_0x1330('0x78')]}});}})['then'](function(_0x3e5468){if(!_0x3e5468){throw new db['Sequelize'][(_0x1330('0x60'))](_0x1330('0x82'));}if(!_0x3e5468[_0x1330('0x83')]||!_0x3e5468[_0x1330('0x84')]){throw new db[(_0x1330('0x54'))]['ValidationError'](_0x1330('0x85'));}_0x1e2164=_0x3e5468;return getBucketslist(_0x1e2164[_0x1330('0x83')],_0x1e2164[_0x1330('0x84')],_0x370232['transcribeRegion']);})['then'](function(_0x1139d7){if(_0x1139d7&&_0x1139d7[_0x1330('0x86')]){var _0xbf47a8=_[_0x1330('0x48')](_0x1139d7[_0x1330('0x86')],function(_0x5e4140){return _0x5e4140[_0x1330('0x87')]===_0x370232[_0x1330('0x7a')];});if(!_0xbf47a8){logger[_0x1330('0x63')](util[_0x1330('0x31')](_0x1330('0x88'),_0x15ab84[_0x1330('0x45')]['id'],_0x370232[_0x1330('0x7a')]));return createBucket(_0x1e2164['data1'],_0x1e2164[_0x1330('0x84')],_0x370232[_0x1330('0x79')],_0x370232[_0x1330('0x7a')]);}logger[_0x1330('0x63')](util['format'](_0x1330('0x89'),_0x15ab84[_0x1330('0x45')]['id'],_0x370232['bucket']));return;}})['then'](function(_0x4aa846){if(_0x37934e[_0x1330('0x71')]===_0x1330('0x8a')){return transcribe(_0x15ab84[_0x1330('0x45')]['id'],_0x1e2164[_0x1330('0x83')],_0x1e2164[_0x1330('0x84')],_0x370232[_0x1330('0x79')],_0x370232[_0x1330('0x7a')],_0x37934e['value'],_0x370232['language']);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x15ab84[_0x1330('0x45')]['id']));return{'transcribeStatus':_0x1330('0x8b')};}})[_0x1330('0x23')](function(_0x273aab){if(_0x273aab){_0x273aab['tempSentiment']=_0x15ab84[_0x1330('0x4a')][_0x1330('0x7c')];return _0x37934e[_0x1330('0x8c')](_0x273aab);}})[_0x1330('0x23')](respondWithResult(_0x4a9338,null))[_0x1330('0x43')](handleError(_0x4a9338,null));};function writeFile(_0x642a97,_0x17ce12){return new Promise(function(_0x5f122e,_0x352d79){fs[_0x1330('0x8d')](_0x17ce12,_0x642a97,function(_0x4ecdf0,_0x22bb49){if(_0x4ecdf0){return _0x352d79(_0x4ecdf0);}else{return _0x5f122e(_0x22bb49);}});});}exports[_0x1330('0x8e')]=function(_0x5b801c,_0x4f1cc9,_0x396a80){return db[_0x1330('0x40')][_0x1330('0x73')]({'where':{'id':_0x5b801c[_0x1330('0x45')]['id']}})[_0x1330('0x23')](handleEntityNotFound(_0x4f1cc9))[_0x1330('0x23')](function(_0x52c56d){if(_0x52c56d&&_0x52c56d[_0x1330('0x8f')]){var _0x5e3e5c=_0x52c56d['fileText'];var _0x5d3c10=config[_0x1330('0x90')]+_0x1330('0x91')+_0x52c56d['id']+_0x1330('0x92');if(fs['existsSync'](_0x5d3c10)){return _0x5d3c10;}return writeFile(_0x5e3e5c,_0x5d3c10)[_0x1330('0x23')](function(){return _0x5d3c10;});}else{throw new db['Sequelize'][(_0x1330('0x60'))](_0x1330('0x93'));}})[_0x1330('0x23')](function(_0x17716c){return _0x4f1cc9[_0x1330('0x4c')](_0x17716c);})[_0x1330('0x43')](handleError(_0x4f1cc9));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 66afa6c..a00747f 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 _0x1b73=['define','voice_recordings','uniqueid','transcribeStatus','exports'];(function(_0x3dfa3b,_0x2d74f3){var _0x2b5697=function(_0x274f01){while(--_0x274f01){_0x3dfa3b['push'](_0x3dfa3b['shift']());}};_0x2b5697(++_0x2d74f3);}(_0x1b73,0x1d5));var _0x31b7=function(_0x4229e8,_0x5e278a){_0x4229e8=_0x4229e8-0x0;var _0x2964d3=_0x1b73[_0x4229e8];return _0x2964d3;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x31b7('0x0')]=function(_0x25ee36,_0x46222e){return _0x25ee36[_0x31b7('0x1')]('VoiceRecording',attributes,{'tableName':_0x31b7('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x31b7('0x3')]},{'name':_0x31b7('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e5c=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x42057f,_0x150e8b){var _0x295184=function(_0x29de9f){while(--_0x29de9f){_0x42057f['push'](_0x42057f['shift']());}};_0x295184(++_0x150e8b);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x46eeea,_0x30d3a7){_0x46eeea=_0x46eeea-0x0;var _0x227574=_0x3e5c[_0x46eeea];return _0x227574;};'use strict';var attributes=require(_0xc3e5('0x0'));module[_0xc3e5('0x1')]=function(_0x160b5a,_0x28330c){return _0x160b5a['define'](_0xc3e5('0x2'),attributes,{'tableName':_0xc3e5('0x3'),'paranoid':![],'indexes':[{'name':_0xc3e5('0x4'),'fields':[_0xc3e5('0x4')]},{'name':_0xc3e5('0x5'),'fields':[_0xc3e5('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0ef7238..989a1ba 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 _0x7a54=['../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','encryptFile','secrets','unlink','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','then','UpdateVoiceRecording','CreateVoiceRecording'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0x7a54,0x106));var _0x47a5=function(_0x331022,_0x37142a){_0x331022=_0x331022-0x0;var _0x3af629=_0x7a54[_0x331022];return _0x3af629;};'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')]('VoiceRecording,\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['UpdateVoiceRecording']=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?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateVoiceRecording',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});};exports[_0x47a5('0x1f')]=function(_0x5686db){var _0x1ea9c8=this;return new Promise(function(_0x5b6c4e,_0x23cb77){var _0x378208=require(_0x47a5('0x20'));var _0x1dac65;return db[_0x47a5('0x21')][_0x47a5('0x22')]({'attributes':['id',_0x47a5('0x23')],'where':{'id':0x1},'raw':!![]})[_0x47a5('0x1d')](function(_0x16631f){_0x1dac65=_0x16631f;return db[_0x47a5('0x15')][_0x47a5('0x24')](_0x5686db[_0x47a5('0x17')]);})[_0x47a5('0x1d')](function(_0x528582){if(_0x1dac65[_0x47a5('0x23')]&&fs['existsSync'](_0x528582[_0x47a5('0x25')])){var _0x9ac908=util[_0x47a5('0x26')]('%s.cypher',_0x528582[_0x47a5('0x25')]);return _0x378208[_0x47a5('0x27')](_0x528582[_0x47a5('0x25')],_0x9ac908,config[_0x47a5('0x28')]['recording'])['then'](function(){fs[_0x47a5('0x29')](_0x528582[_0x47a5('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x528582;});}return _0x528582;})[_0x47a5('0x1d')](function(_0x51544e){logger['info'](_0x47a5('0x1f'),_0x5686db);logger['debug'](_0x47a5('0x1f'),_0x5686db,JSON[_0x47a5('0xe')](_0x51544e));_0x5b6c4e(_0x51544e);})['catch'](function(_0x4843c0){logger[_0x47a5('0xf')]('CreateVoiceRecording',_0x4843c0[_0x47a5('0x11')],_0x5686db);_0x23cb77(_0x1ea9c8[_0x47a5('0xf')](0x1f4,_0x4843c0[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xbbbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','stringify'];(function(_0x3c8253,_0x4b59db){var _0x3e96cb=function(_0x33b2ca){while(--_0x33b2ca){_0x3c8253['push'](_0x3c8253['shift']());}};_0x3e96cb(++_0x4b59db);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x419700,_0x7d992c){_0x419700=_0x419700-0x0;var _0x917339=_0xbbbc[_0x419700];return _0x917339;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['VoiceRecording'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1a')]||null:null,'attributes':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')]['attributes']||null:null,'limit':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1b')]||null:null})[_0xcbbb('0xd')](function(_0x258d1f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON['stringify'](_0x258d1f));_0x5052df(_0x258d1f);})[_0xcbbb('0x14')](function(_0x4490c1){logger['error'](_0xcbbb('0x15'),_0x4490c1['message'],_0x3436af);_0x57c5e9(_0x3572bb['error'](0x1f4,_0x4490c1[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1c')]=function(_0x548440){var _0x59c422=this;return new Promise(function(_0x5499a1,_0x4439ea){var _0x55e1d8=require('../../components/encryptor');var _0x21e3b1;return db[_0xcbbb('0x1d')][_0xcbbb('0x1e')]({'attributes':['id',_0xcbbb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xcbbb('0xd')](function(_0x39ba8b){_0x21e3b1=_0x39ba8b;return db[_0xcbbb('0x20')][_0xcbbb('0x21')](_0x548440[_0xcbbb('0x17')]);})[_0xcbbb('0xd')](function(_0x1c2ac9){if(_0x21e3b1[_0xcbbb('0x1f')]&&fs[_0xcbbb('0x22')](_0x1c2ac9[_0xcbbb('0x23')])){var _0x2a9639=util[_0xcbbb('0x24')](_0xcbbb('0x25'),_0x1c2ac9[_0xcbbb('0x23')]);return _0x55e1d8['encryptFile'](_0x1c2ac9[_0xcbbb('0x23')],_0x2a9639,config[_0xcbbb('0x26')]['recording'])[_0xcbbb('0xd')](function(){fs['unlink'](_0x1c2ac9[_0xcbbb('0x23')]);logger[_0xcbbb('0xe')](_0xcbbb('0x27'));return _0x1c2ac9;});}return _0x1c2ac9;})['then'](function(_0x38ee99){logger[_0xcbbb('0xe')](_0xcbbb('0x1c'),_0x548440);logger[_0xcbbb('0xf')](_0xcbbb('0x1c'),_0x548440,JSON[_0xcbbb('0x28')](_0x38ee99));_0x5499a1(_0x38ee99);})[_0xcbbb('0x14')](function(_0x1ac1a2){logger[_0xcbbb('0x11')](_0xcbbb('0x1c'),_0x1ac1a2['message'],_0x548440);_0x4439ea(_0x59c422['error'](0x1f4,_0x1ac1a2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 3f86b24..c9627f0 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 _0x0c25=['/describe','describe','get','show','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c25,0x1c5));var _0x50c2=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x0c25[_0x5a5395];return _0x4da43d;};'use strict';var multer=require('multer');var util=require(_0x50c2('0x0'));var path=require('path');var timeout=require(_0x50c2('0x1'));var express=require('express');var router=express[_0x50c2('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50c2('0x3'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x50c2('0x4')](),controller[_0x50c2('0x5')]);router['get'](_0x50c2('0x6'),auth['isAuthenticated'](),controller[_0x50c2('0x7')]);router[_0x50c2('0x8')]('/:id',auth[_0x50c2('0x4')](),controller[_0x50c2('0x9')]);router[_0x50c2('0xa')]('/',auth[_0x50c2('0x4')](),controller[_0x50c2('0xb')]);router[_0x50c2('0xc')](_0x50c2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x50c2('0xe')](_0x50c2('0xd'),auth['isAuthenticated'](),controller[_0x50c2('0xf')]);module[_0x50c2('0x10')]=router; \ No newline at end of file +var _0x3264=['put','delete','/:id','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','post','create'];(function(_0x5cac53,_0x47927c){var _0x38a57f=function(_0x108ce8){while(--_0x108ce8){_0x5cac53['push'](_0x5cac53['shift']());}};_0x38a57f(++_0x47927c);}(_0x3264,0xf3));var _0x4326=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3264[_0xd09668];return _0x68726;};'use strict';var multer=require('multer');var util=require(_0x4326('0x0'));var path=require(_0x4326('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4326('0x2'));var auth=require(_0x4326('0x3'));var interaction=require(_0x4326('0x4'));var config=require(_0x4326('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x4326('0x6')]('/',auth[_0x4326('0x7')](),controller['index']);router[_0x4326('0x6')](_0x4326('0x8'),auth[_0x4326('0x7')](),controller[_0x4326('0x9')]);router[_0x4326('0x6')]('/:id',auth[_0x4326('0x7')](),controller['show']);router[_0x4326('0xa')]('/',auth[_0x4326('0x7')](),controller[_0x4326('0xb')]);router[_0x4326('0xc')]('/:id',auth[_0x4326('0x7')](),controller['update']);router[_0x4326('0xd')](_0x4326('0xe'),auth[_0x4326('0x7')](),controller[_0x4326('0xf')]);module[_0x4326('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 720783d..073bef4 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 _0xb977=['ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x3b1502,_0xa23e9d){var _0x1c8537=function(_0x3c05f1){while(--_0x3c05f1){_0x3b1502['push'](_0x3b1502['shift']());}};_0x1c8537(++_0xa23e9d);}(_0xb977,0xd7));var _0x7b97=function(_0x150c8b,_0x165c7a){_0x150c8b=_0x150c8b-0x0;var _0x3073e7=_0xb977[_0x150c8b];return _0x3073e7;};'use strict';var Sequelize=require(_0x7b97('0x0'));var moment=require(_0x7b97('0x1'));module['exports']={'type':{'type':Sequelize[_0x7b97('0x2')](_0x7b97('0x3'),_0x7b97('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x7b97('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x7b97('0x5')]},'transferercalleridname':{'type':Sequelize[_0x7b97('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7b97('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x7b97('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x7b97('0x5')]},'transferercontext':{'type':Sequelize[_0x7b97('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7b97('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x7b97('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7b97('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x7b97('0x5')]},'transfereecontext':{'type':Sequelize[_0x7b97('0x5')]},'transfereeexten':{'type':Sequelize[_0x7b97('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7b97('0x2')](_0x7b97('0x6'),'No')},'context':{'type':Sequelize[_0x7b97('0x5')]},'extension':{'type':Sequelize[_0x7b97('0x5')]}}; \ No newline at end of file +var _0x86c8=['exports','ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x3e5e48,_0x4afbbe){var _0x30388c=function(_0x44aa54){while(--_0x44aa54){_0x3e5e48['push'](_0x3e5e48['shift']());}};_0x30388c(++_0x4afbbe);}(_0x86c8,0x83));var _0x886c=function(_0x5a9980,_0x4c54a7){_0x5a9980=_0x5a9980-0x0;var _0x200d99=_0x86c8[_0x5a9980];return _0x200d99;};'use strict';var Sequelize=require(_0x886c('0x0'));var moment=require(_0x886c('0x1'));module[_0x886c('0x2')]={'type':{'type':Sequelize[_0x886c('0x3')](_0x886c('0x4'),_0x886c('0x5'))},'result':{'type':Sequelize[_0x886c('0x6')]},'transfererchannel':{'type':Sequelize[_0x886c('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x886c('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x886c('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x886c('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x886c('0x6')]},'transfererexten':{'type':Sequelize[_0x886c('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x886c('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x886c('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x886c('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x886c('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x886c('0x6')]},'transfereecontext':{'type':Sequelize[_0x886c('0x6')]},'transfereeexten':{'type':Sequelize[_0x886c('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x886c('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 69ac5e2..c42b1b1 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 _0x66cc=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','options','find','create','body','params','describe','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../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','apply','save','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x66cc,0xf6));var _0xc66c=function(_0x3467d8,_0x74a6b8){_0x3467d8=_0x3467d8-0x0;var _0x3b182a=_0x66cc[_0x3467d8];return _0x3b182a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc66c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc66c('0x1'));var moment=require(_0xc66c('0x2'));var BPromise=require(_0xc66c('0x3'));var Mustache=require(_0xc66c('0x4'));var util=require(_0xc66c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc66c('0x6'));var ejs=require(_0xc66c('0x7'));var fs=require('fs');var fs_extra=require(_0xc66c('0x8'));var _=require(_0xc66c('0x9'));var squel=require(_0xc66c('0xa'));var crypto=require(_0xc66c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc66c('0x6'));var querystring=require(_0xc66c('0xc'));var Papa=require(_0xc66c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc66c('0xe'));var as=require(_0xc66c('0xf'));var hardwareService=require(_0xc66c('0x10'));var logger=require(_0xc66c('0x11'))(_0xc66c('0x12'));var utils=require('../../config/utils');var config=require(_0xc66c('0x13'));var licenseUtil=require(_0xc66c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb2d20,_0xacc54c){_0xacc54c=_0xacc54c||0xcc;return function(_0x43adaa){if(_0x43adaa){return _0xeb2d20[_0xc66c('0x15')](_0xacc54c);}return _0xeb2d20[_0xc66c('0x16')](_0xacc54c)[_0xc66c('0x17')]();};}function respondWithResult(_0x3422c,_0x5b7de1){_0x5b7de1=_0x5b7de1||0xc8;return function(_0x214ffc){if(_0x214ffc){return _0x3422c[_0xc66c('0x16')](_0x5b7de1)[_0xc66c('0x18')](_0x214ffc);}};}function respondWithFilteredResult(_0x1f284e,_0x3b4758){return function(_0x4230ae){if(_0x4230ae){var _0x1bf1c3=typeof _0x3b4758[_0xc66c('0x19')]===_0xc66c('0x1a')&&typeof _0x3b4758['limit']==='undefined';var _0x48c309=_0x4230ae[_0xc66c('0x1b')];var _0x28a3cf=_0x1bf1c3?0x0:_0x3b4758[_0xc66c('0x19')];var _0x3a0bd2=_0x1bf1c3?_0x4230ae[_0xc66c('0x1b')]:_0x3b4758[_0xc66c('0x19')]+_0x3b4758[_0xc66c('0x1c')];var _0x46450b;if(_0x3a0bd2>=_0x48c309){_0x3a0bd2=_0x48c309;_0x46450b=0xc8;}else{_0x46450b=0xce;}_0x1f284e['status'](_0x46450b);return _0x1f284e[_0xc66c('0x1d')](_0xc66c('0x1e'),_0x28a3cf+'-'+_0x3a0bd2+'/'+_0x48c309)[_0xc66c('0x18')](_0x4230ae);}return null;};}function patchUpdates(_0x5e1730){return function(_0x2b0531){try{jsonpatch[_0xc66c('0x1f')](_0x2b0531,_0x5e1730,!![]);}catch(_0x5e4894){return BPromise['reject'](_0x5e4894);}return _0x2b0531[_0xc66c('0x20')]();};}function saveUpdates(_0x5f0d6e,_0x422619){return function(_0x332c11){if(_0x332c11){return _0x332c11[_0xc66c('0x21')](_0x5f0d6e)[_0xc66c('0x22')](function(_0x4e7dd5){return _0x4e7dd5;});}return null;};}function removeEntity(_0x186555,_0x53643d){return function(_0x1df4f3){if(_0x1df4f3){return _0x1df4f3[_0xc66c('0x23')]()[_0xc66c('0x22')](function(){_0x186555[_0xc66c('0x16')](0xcc)[_0xc66c('0x17')]();});}};}function handleEntityNotFound(_0x2a3813,_0x581f72){return function(_0x19cca9){if(!_0x19cca9){_0x2a3813[_0xc66c('0x15')](0x194);}return _0x19cca9;};}function handleError(_0x5876d4,_0x2f6b6d){_0x2f6b6d=_0x2f6b6d||0x1f4;return function(_0x57ed01){logger[_0xc66c('0x24')](_0x57ed01[_0xc66c('0x25')]);if(_0x57ed01['name']){delete _0x57ed01[_0xc66c('0x26')];}_0x5876d4[_0xc66c('0x16')](_0x2f6b6d)[_0xc66c('0x27')](_0x57ed01);};}exports['index']=function(_0x4a51d3,_0x22ef22){var _0x18c7ef={},_0x3794bc={},_0x15ab54={'count':0x0,'rows':[]};var _0x4e1623=_[_0xc66c('0x28')](db[_0xc66c('0x29')][_0xc66c('0x2a')],function(_0x4bcdd3){return{'name':_0x4bcdd3[_0xc66c('0x2b')],'type':_0x4bcdd3[_0xc66c('0x2c')]['key']};});_0x3794bc[_0xc66c('0x2d')]=_[_0xc66c('0x28')](_0x4e1623,'name');_0x3794bc[_0xc66c('0x2e')]=_[_0xc66c('0x2f')](_0x4a51d3['query']);_0x3794bc[_0xc66c('0x30')]=_[_0xc66c('0x31')](_0x3794bc[_0xc66c('0x2d')],_0x3794bc[_0xc66c('0x2e')]);_0x18c7ef[_0xc66c('0x32')]=_[_0xc66c('0x31')](_0x3794bc[_0xc66c('0x2d')],qs[_0xc66c('0x33')](_0x4a51d3[_0xc66c('0x2e')][_0xc66c('0x33')]));_0x18c7ef[_0xc66c('0x32')]=_0x18c7ef['attributes'][_0xc66c('0x34')]?_0x18c7ef[_0xc66c('0x32')]:_0x3794bc[_0xc66c('0x2d')];if(!_0x4a51d3[_0xc66c('0x2e')][_0xc66c('0x35')](_0xc66c('0x36'))){_0x18c7ef[_0xc66c('0x1c')]=qs[_0xc66c('0x1c')](_0x4a51d3['query'][_0xc66c('0x1c')]);_0x18c7ef[_0xc66c('0x19')]=qs[_0xc66c('0x19')](_0x4a51d3['query'][_0xc66c('0x19')]);}_0x18c7ef[_0xc66c('0x37')]=qs[_0xc66c('0x38')](_0x4a51d3['query'][_0xc66c('0x38')]);_0x18c7ef[_0xc66c('0x39')]=qs[_0xc66c('0x30')](_[_0xc66c('0x3a')](_0x4a51d3[_0xc66c('0x2e')],_0x3794bc[_0xc66c('0x30')]),_0x4e1623);if(_0x4a51d3[_0xc66c('0x2e')][_0xc66c('0x3b')]){_0x18c7ef[_0xc66c('0x39')]=_['merge'](_0x18c7ef[_0xc66c('0x39')],{'$or':_[_0xc66c('0x28')](_0x4e1623,function(_0xdaa1ef){if(_0xdaa1ef[_0xc66c('0x2c')]!==_0xc66c('0x3c')){var _0x40c52a={};_0x40c52a[_0xdaa1ef[_0xc66c('0x26')]]={'$like':'%'+_0x4a51d3[_0xc66c('0x2e')][_0xc66c('0x3b')]+'%'};return _0x40c52a;}})});}_0x18c7ef=_['merge']({},_0x18c7ef,_0x4a51d3['options']);var _0x1ab11a={'where':_0x18c7ef['where']};return db['VoiceTransferReport'][_0xc66c('0x1b')](_0x1ab11a)[_0xc66c('0x22')](function(_0x74930e){_0x15ab54[_0xc66c('0x1b')]=_0x74930e;if(_0x4a51d3[_0xc66c('0x2e')][_0xc66c('0x3d')]){_0x18c7ef[_0xc66c('0x3e')]=[{'all':!![]}];}return db[_0xc66c('0x29')][_0xc66c('0x3f')](_0x18c7ef);})['then'](function(_0x43022c){_0x15ab54[_0xc66c('0x40')]=_0x43022c;return _0x15ab54;})[_0xc66c('0x22')](respondWithFilteredResult(_0x22ef22,_0x18c7ef))[_0xc66c('0x41')](handleError(_0x22ef22,null));};exports[_0xc66c('0x42')]=function(_0x522a8b,_0x391f5e){var _0x560aca={'raw':!![],'where':{'id':_0x522a8b['params']['id']}},_0x2e0913={};_0x2e0913['model']=_['keys'](db[_0xc66c('0x29')][_0xc66c('0x2a')]);_0x2e0913[_0xc66c('0x2e')]=_[_0xc66c('0x2f')](_0x522a8b['query']);_0x2e0913[_0xc66c('0x30')]=_[_0xc66c('0x31')](_0x2e0913[_0xc66c('0x2d')],_0x2e0913[_0xc66c('0x2e')]);_0x560aca[_0xc66c('0x32')]=_[_0xc66c('0x31')](_0x2e0913[_0xc66c('0x2d')],qs[_0xc66c('0x33')](_0x522a8b[_0xc66c('0x2e')][_0xc66c('0x33')]));_0x560aca[_0xc66c('0x32')]=_0x560aca[_0xc66c('0x32')][_0xc66c('0x34')]?_0x560aca[_0xc66c('0x32')]:_0x2e0913[_0xc66c('0x2d')];if(_0x522a8b[_0xc66c('0x2e')][_0xc66c('0x3d')]){_0x560aca[_0xc66c('0x3e')]=[{'all':!![]}];}_0x560aca=_[_0xc66c('0x43')]({},_0x560aca,_0x522a8b[_0xc66c('0x44')]);return db[_0xc66c('0x29')][_0xc66c('0x45')](_0x560aca)[_0xc66c('0x22')](handleEntityNotFound(_0x391f5e,null))[_0xc66c('0x22')](respondWithResult(_0x391f5e,null))['catch'](handleError(_0x391f5e,null));};exports[_0xc66c('0x46')]=function(_0x5ce9f2,_0xaebf9f){return db[_0xc66c('0x29')]['create'](_0x5ce9f2[_0xc66c('0x47')],{})[_0xc66c('0x22')](respondWithResult(_0xaebf9f,0xc9))['catch'](handleError(_0xaebf9f,null));};exports['update']=function(_0x559953,_0x18f857){if(_0x559953[_0xc66c('0x47')]['id']){delete _0x559953[_0xc66c('0x47')]['id'];}return db[_0xc66c('0x29')][_0xc66c('0x45')]({'where':{'id':_0x559953[_0xc66c('0x48')]['id']}})['then'](handleEntityNotFound(_0x18f857,null))[_0xc66c('0x22')](saveUpdates(_0x559953[_0xc66c('0x47')],null))[_0xc66c('0x22')](respondWithResult(_0x18f857,null))[_0xc66c('0x41')](handleError(_0x18f857,null));};exports[_0xc66c('0x23')]=function(_0x339523,_0x38aca6){return db[_0xc66c('0x29')][_0xc66c('0x45')]({'where':{'id':_0x339523[_0xc66c('0x48')]['id']}})['then'](handleEntityNotFound(_0x38aca6,null))[_0xc66c('0x22')](removeEntity(_0x38aca6,null))[_0xc66c('0x41')](handleError(_0x38aca6,null));};exports[_0xc66c('0x49')]=function(_0x5f510b,_0xc56aa9){return db[_0xc66c('0x29')][_0xc66c('0x49')]()[_0xc66c('0x22')](respondWithResult(_0xc56aa9,null))['catch'](handleError(_0xc56aa9,null));}; \ No newline at end of file +var _0x0dcf=['then','error','stack','name','index','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','merge','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0dcf,0xb6));var _0xf0dc=function(_0x583bec,_0x24e052){_0x583bec=_0x583bec-0x0;var _0x5854a2=_0x0dcf[_0x583bec];return _0x5854a2;};'use strict';var emlformat=require(_0xf0dc('0x0'));var rimraf=require(_0xf0dc('0x1'));var zipdir=require(_0xf0dc('0x2'));var jsonpatch=require(_0xf0dc('0x3'));var rp=require(_0xf0dc('0x4'));var moment=require(_0xf0dc('0x5'));var BPromise=require(_0xf0dc('0x6'));var Mustache=require(_0xf0dc('0x7'));var util=require('util');var path=require(_0xf0dc('0x8'));var sox=require(_0xf0dc('0x9'));var csv=require(_0xf0dc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf0dc('0xb'));var jsforce=require(_0xf0dc('0xc'));var deskjs=require(_0xf0dc('0xd'));var toCsv=require(_0xf0dc('0xa'));var querystring=require(_0xf0dc('0xe'));var Papa=require(_0xf0dc('0xf'));var Redis=require(_0xf0dc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf0dc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0dc('0x12'))(_0xf0dc('0x13'));var utils=require(_0xf0dc('0x14'));var config=require(_0xf0dc('0x15'));var licenseUtil=require(_0xf0dc('0x16'));var db=require(_0xf0dc('0x17'))['db'];function respondWithStatusCode(_0x25b3d2,_0x25fd64){_0x25fd64=_0x25fd64||0xcc;return function(_0x15c75d){if(_0x15c75d){return _0x25b3d2['sendStatus'](_0x25fd64);}return _0x25b3d2[_0xf0dc('0x18')](_0x25fd64)[_0xf0dc('0x19')]();};}function respondWithResult(_0x4d719b,_0x3b9bc7){_0x3b9bc7=_0x3b9bc7||0xc8;return function(_0x44e636){if(_0x44e636){return _0x4d719b[_0xf0dc('0x18')](_0x3b9bc7)[_0xf0dc('0x1a')](_0x44e636);}};}function respondWithFilteredResult(_0x4e7db0,_0x2754f8){return function(_0x385f79){if(_0x385f79){var _0x48b93b=typeof _0x2754f8[_0xf0dc('0x1b')]===_0xf0dc('0x1c')&&typeof _0x2754f8[_0xf0dc('0x1d')]===_0xf0dc('0x1c');var _0x4606d9=_0x385f79[_0xf0dc('0x1e')];var _0x2188a3=_0x48b93b?0x0:_0x2754f8[_0xf0dc('0x1b')];var _0x4e6716=_0x48b93b?_0x385f79[_0xf0dc('0x1e')]:_0x2754f8[_0xf0dc('0x1b')]+_0x2754f8['limit'];var _0x26b6e6;if(_0x4e6716>=_0x4606d9){_0x4e6716=_0x4606d9;_0x26b6e6=0xc8;}else{_0x26b6e6=0xce;}_0x4e7db0[_0xf0dc('0x18')](_0x26b6e6);return _0x4e7db0[_0xf0dc('0x1f')](_0xf0dc('0x20'),_0x2188a3+'-'+_0x4e6716+'/'+_0x4606d9)[_0xf0dc('0x1a')](_0x385f79);}return null;};}function patchUpdates(_0x17bc51){return function(_0x324e43){try{jsonpatch[_0xf0dc('0x21')](_0x324e43,_0x17bc51,!![]);}catch(_0x13fda8){return BPromise[_0xf0dc('0x22')](_0x13fda8);}return _0x324e43[_0xf0dc('0x23')]();};}function saveUpdates(_0x2a99f6,_0x1f3118){return function(_0x5e4f4f){if(_0x5e4f4f){return _0x5e4f4f[_0xf0dc('0x24')](_0x2a99f6)['then'](function(_0x356de3){return _0x356de3;});}return null;};}function removeEntity(_0x31147d,_0x1d6180){return function(_0xa0fda9){if(_0xa0fda9){return _0xa0fda9['destroy']()[_0xf0dc('0x25')](function(){_0x31147d[_0xf0dc('0x18')](0xcc)[_0xf0dc('0x19')]();});}};}function handleEntityNotFound(_0x487635,_0x1ce617){return function(_0x54351a){if(!_0x54351a){_0x487635['sendStatus'](0x194);}return _0x54351a;};}function handleError(_0x1ab096,_0x3658e6){_0x3658e6=_0x3658e6||0x1f4;return function(_0x5c3a7d){logger[_0xf0dc('0x26')](_0x5c3a7d[_0xf0dc('0x27')]);if(_0x5c3a7d[_0xf0dc('0x28')]){delete _0x5c3a7d[_0xf0dc('0x28')];}_0x1ab096['status'](_0x3658e6)['send'](_0x5c3a7d);};}exports[_0xf0dc('0x29')]=function(_0x9f859f,_0x37f3dd){var _0x4496fb={},_0x3d436f={},_0x2f7951={'count':0x0,'rows':[]};var _0x88c8b0=_['map'](db['VoiceTransferReport'][_0xf0dc('0x2a')],function(_0x38bf42){return{'name':_0x38bf42['fieldName'],'type':_0x38bf42[_0xf0dc('0x2b')][_0xf0dc('0x2c')]};});_0x3d436f[_0xf0dc('0x2d')]=_['map'](_0x88c8b0,'name');_0x3d436f[_0xf0dc('0x2e')]=_[_0xf0dc('0x2f')](_0x9f859f[_0xf0dc('0x2e')]);_0x3d436f['filters']=_[_0xf0dc('0x30')](_0x3d436f['model'],_0x3d436f[_0xf0dc('0x2e')]);_0x4496fb[_0xf0dc('0x31')]=_[_0xf0dc('0x30')](_0x3d436f['model'],qs[_0xf0dc('0x32')](_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x32')]));_0x4496fb[_0xf0dc('0x31')]=_0x4496fb[_0xf0dc('0x31')][_0xf0dc('0x33')]?_0x4496fb[_0xf0dc('0x31')]:_0x3d436f[_0xf0dc('0x2d')];if(!_0x9f859f['query']['hasOwnProperty'](_0xf0dc('0x34'))){_0x4496fb[_0xf0dc('0x1d')]=qs['limit'](_0x9f859f[_0xf0dc('0x2e')]['limit']);_0x4496fb[_0xf0dc('0x1b')]=qs[_0xf0dc('0x1b')](_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x1b')]);}_0x4496fb['order']=qs[_0xf0dc('0x35')](_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x35')]);_0x4496fb[_0xf0dc('0x36')]=qs['filters'](_[_0xf0dc('0x37')](_0x9f859f[_0xf0dc('0x2e')],_0x3d436f[_0xf0dc('0x38')]),_0x88c8b0);if(_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x39')]){_0x4496fb['where']=_['merge'](_0x4496fb[_0xf0dc('0x36')],{'$or':_['map'](_0x88c8b0,function(_0xb1ee75){if(_0xb1ee75[_0xf0dc('0x2b')]!=='VIRTUAL'){var _0x320f37={};_0x320f37[_0xb1ee75[_0xf0dc('0x28')]]={'$like':'%'+_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x39')]+'%'};return _0x320f37;}})});}_0x4496fb=_['merge']({},_0x4496fb,_0x9f859f[_0xf0dc('0x3a')]);var _0xcb68a1={'where':_0x4496fb['where']};return db['VoiceTransferReport'][_0xf0dc('0x1e')](_0xcb68a1)['then'](function(_0x2b448c){_0x2f7951['count']=_0x2b448c;if(_0x9f859f[_0xf0dc('0x2e')][_0xf0dc('0x3b')]){_0x4496fb[_0xf0dc('0x3c')]=[{'all':!![]}];}return db[_0xf0dc('0x3d')][_0xf0dc('0x3e')](_0x4496fb);})[_0xf0dc('0x25')](function(_0x5aaa99){_0x2f7951[_0xf0dc('0x3f')]=_0x5aaa99;return _0x2f7951;})[_0xf0dc('0x25')](respondWithFilteredResult(_0x37f3dd,_0x4496fb))[_0xf0dc('0x40')](handleError(_0x37f3dd,null));};exports[_0xf0dc('0x41')]=function(_0x3a06cf,_0x7949f6){var _0x1edcfd={'raw':!![],'where':{'id':_0x3a06cf[_0xf0dc('0x42')]['id']}},_0x40e43e={};_0x40e43e[_0xf0dc('0x2d')]=_[_0xf0dc('0x2f')](db[_0xf0dc('0x3d')][_0xf0dc('0x2a')]);_0x40e43e[_0xf0dc('0x2e')]=_[_0xf0dc('0x2f')](_0x3a06cf[_0xf0dc('0x2e')]);_0x40e43e[_0xf0dc('0x38')]=_[_0xf0dc('0x30')](_0x40e43e[_0xf0dc('0x2d')],_0x40e43e[_0xf0dc('0x2e')]);_0x1edcfd['attributes']=_[_0xf0dc('0x30')](_0x40e43e[_0xf0dc('0x2d')],qs[_0xf0dc('0x32')](_0x3a06cf[_0xf0dc('0x2e')]['fields']));_0x1edcfd[_0xf0dc('0x31')]=_0x1edcfd[_0xf0dc('0x31')][_0xf0dc('0x33')]?_0x1edcfd[_0xf0dc('0x31')]:_0x40e43e[_0xf0dc('0x2d')];if(_0x3a06cf[_0xf0dc('0x2e')][_0xf0dc('0x3b')]){_0x1edcfd[_0xf0dc('0x3c')]=[{'all':!![]}];}_0x1edcfd=_[_0xf0dc('0x43')]({},_0x1edcfd,_0x3a06cf[_0xf0dc('0x3a')]);return db[_0xf0dc('0x3d')][_0xf0dc('0x44')](_0x1edcfd)[_0xf0dc('0x25')](handleEntityNotFound(_0x7949f6,null))[_0xf0dc('0x25')](respondWithResult(_0x7949f6,null))[_0xf0dc('0x40')](handleError(_0x7949f6,null));};exports[_0xf0dc('0x45')]=function(_0x29da7a,_0x4a3f23){return db['VoiceTransferReport']['create'](_0x29da7a[_0xf0dc('0x46')],{})[_0xf0dc('0x25')](respondWithResult(_0x4a3f23,0xc9))[_0xf0dc('0x40')](handleError(_0x4a3f23,null));};exports['update']=function(_0x538a4f,_0x12a2be){if(_0x538a4f[_0xf0dc('0x46')]['id']){delete _0x538a4f[_0xf0dc('0x46')]['id'];}return db[_0xf0dc('0x3d')]['find']({'where':{'id':_0x538a4f[_0xf0dc('0x42')]['id']}})['then'](handleEntityNotFound(_0x12a2be,null))[_0xf0dc('0x25')](saveUpdates(_0x538a4f[_0xf0dc('0x46')],null))['then'](respondWithResult(_0x12a2be,null))[_0xf0dc('0x40')](handleError(_0x12a2be,null));};exports[_0xf0dc('0x47')]=function(_0x527241,_0x520602){return db[_0xf0dc('0x3d')][_0xf0dc('0x44')]({'where':{'id':_0x527241[_0xf0dc('0x42')]['id']}})[_0xf0dc('0x25')](handleEntityNotFound(_0x520602,null))[_0xf0dc('0x25')](removeEntity(_0x520602,null))[_0xf0dc('0x40')](handleError(_0x520602,null));};exports[_0xf0dc('0x48')]=function(_0x1f803b,_0x3194ac){return db[_0xf0dc('0x3d')][_0xf0dc('0x48')]()[_0xf0dc('0x25')](respondWithResult(_0x3194ac,null))[_0xf0dc('0x40')](handleError(_0x3194ac,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 3295e97..6ddcc61 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 _0x4e70=['moment','path','rimraf','../../config/environment','define','report_call_transfer','util','../../config/logger','api'];(function(_0x20fc54,_0xdcce2e){var _0x2fce90=function(_0x3aecfd){while(--_0x3aecfd){_0x20fc54['push'](_0x20fc54['shift']());}};_0x2fce90(++_0xdcce2e);}(_0x4e70,0xde));var _0x04e7=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x4e70[_0x47fd36];return _0x21a0fc;};'use strict';var _=require('lodash');var util=require(_0x04e7('0x0'));var logger=require(_0x04e7('0x1'))(_0x04e7('0x2'));var moment=require(_0x04e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04e7('0x4'));var rimraf=require(_0x04e7('0x5'));var config=require(_0x04e7('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x5ef0c2,_0x44f68f){return _0x5ef0c2[_0x04e7('0x7')]('VoiceTransferReport',attributes,{'tableName':_0x04e7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ce5=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x5ce5,0x150));var _0x55ce=function(_0x323ce4,_0x13a508){_0x323ce4=_0x323ce4-0x0;var _0x10832f=_0x5ce5[_0x323ce4];return _0x10832f;};'use strict';var _=require(_0x55ce('0x0'));var util=require(_0x55ce('0x1'));var logger=require(_0x55ce('0x2'))(_0x55ce('0x3'));var moment=require(_0x55ce('0x4'));var BPromise=require(_0x55ce('0x5'));var rp=require(_0x55ce('0x6'));var fs=require('fs');var path=require(_0x55ce('0x7'));var rimraf=require(_0x55ce('0x8'));var config=require(_0x55ce('0x9'));var attributes=require(_0x55ce('0xa'));module[_0x55ce('0xb')]=function(_0xa0c9b5,_0x5dedb1){return _0xa0c9b5[_0x55ce('0xc')](_0x55ce('0xd'),attributes,{'tableName':_0x55ce('0xe'),'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 f6213a9..d1e04ee 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 _0x072c=['http','request','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x072c,0x116));var _0xc072=function(_0x48965d,_0x4c4777){_0x48965d=_0x48965d-0x0;var _0x44d0d7=_0x072c[_0x48965d];return _0x44d0d7;};'use strict';var _=require('lodash');var util=require(_0xc072('0x0'));var moment=require(_0xc072('0x1'));var BPromise=require(_0xc072('0x2'));var rs=require(_0xc072('0x3'));var fs=require('fs');var Redis=require(_0xc072('0x4'));var db=require(_0xc072('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc072('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc072('0x7')][_0xc072('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33302a,_0x30a403,_0x67b5ca){return new BPromise(function(_0x33c44e,_0x2d6d8e){return client[_0xc072('0x9')](_0x33302a,_0x67b5ca)['then'](function(_0x4c6881){logger['info'](_0xc072('0xa'),_0x30a403,'request\x20sent');logger[_0xc072('0xb')](_0xc072('0xc'),_0x30a403,_0xc072('0xd'),JSON[_0xc072('0xe')](_0x4c6881));if(_0x4c6881[_0xc072('0xf')]){if(_0x4c6881[_0xc072('0xf')][_0xc072('0x10')]===0x1f4){logger[_0xc072('0xf')](_0xc072('0xa'),_0x30a403,_0x4c6881[_0xc072('0xf')]['message']);return _0x2d6d8e(_0x4c6881['error']['message']);}logger[_0xc072('0xf')](_0xc072('0xa'),_0x30a403,_0x4c6881[_0xc072('0xf')][_0xc072('0x11')]);return _0x33c44e(_0x4c6881[_0xc072('0xf')]['message']);}else{logger[_0xc072('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x30a403,'request\x20sent');_0x33c44e(_0x4c6881[_0xc072('0x13')][_0xc072('0x11')]);}})[_0xc072('0x14')](function(_0x36a0bb){logger[_0xc072('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x30a403,_0x36a0bb);_0x2d6d8e(_0x36a0bb);});});}exports[_0xc072('0x15')]=function(_0x5810af){var _0x4a4090=this;return new Promise(function(_0x10841f,_0x32508f){return db[_0xc072('0x16')]['create'](_0x5810af[_0xc072('0x17')],{'raw':_0x5810af[_0xc072('0x18')]?_0x5810af[_0xc072('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc072('0x19')](function(_0x34c495){logger[_0xc072('0x12')](_0xc072('0x15'),_0x5810af);logger['debug'](_0xc072('0x15'),_0x5810af,JSON[_0xc072('0xe')](_0x34c495));_0x10841f(_0x34c495);})[_0xc072('0x14')](function(_0x2ec372){logger[_0xc072('0xf')](_0xc072('0x15'),_0x2ec372[_0xc072('0x11')],_0x5810af);_0x32508f(_0x4a4090[_0xc072('0xf')](0x1f4,_0x2ec372[_0xc072('0x11')]));});});}; \ No newline at end of file +var _0x9de4=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x24dcc0,_0x13c1c6){var _0x525f29=function(_0x27b476){while(--_0x27b476){_0x24dcc0['push'](_0x24dcc0['shift']());}};_0x525f29(++_0x13c1c6);}(_0x9de4,0x1b6));var _0x49de=function(_0x38bcae,_0x3f0e15){_0x38bcae=_0x38bcae-0x0;var _0xacbb3e=_0x9de4[_0x38bcae];return _0xacbb3e;};'use strict';var _=require(_0x49de('0x0'));var util=require('util');var moment=require(_0x49de('0x1'));var BPromise=require('bluebird');var rs=require(_0x49de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x49de('0x3'));var logger=require(_0x49de('0x4'))(_0x49de('0x5'));var config=require('../../config/environment');var jayson=require(_0x49de('0x6'));var client=jayson[_0x49de('0x7')][_0x49de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c30dd,_0x4dbc1d,_0x273b5d){return new BPromise(function(_0x4a60f9,_0x3ace5e){return client[_0x49de('0x9')](_0x2c30dd,_0x273b5d)[_0x49de('0xa')](function(_0x5b37df){logger[_0x49de('0xb')](_0x49de('0xc'),_0x4dbc1d,'request\x20sent');logger[_0x49de('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4dbc1d,_0x49de('0xe'),JSON[_0x49de('0xf')](_0x5b37df));if(_0x5b37df[_0x49de('0x10')]){if(_0x5b37df[_0x49de('0x10')]['code']===0x1f4){logger['error'](_0x49de('0xc'),_0x4dbc1d,_0x5b37df['error'][_0x49de('0x11')]);return _0x3ace5e(_0x5b37df[_0x49de('0x10')][_0x49de('0x11')]);}logger[_0x49de('0x10')](_0x49de('0xc'),_0x4dbc1d,_0x5b37df[_0x49de('0x10')][_0x49de('0x11')]);return _0x4a60f9(_0x5b37df[_0x49de('0x10')][_0x49de('0x11')]);}else{logger['info'](_0x49de('0xc'),_0x4dbc1d,'request\x20sent');_0x4a60f9(_0x5b37df[_0x49de('0x12')][_0x49de('0x11')]);}})[_0x49de('0x13')](function(_0x3a3b63){logger[_0x49de('0x10')](_0x49de('0xc'),_0x4dbc1d,_0x3a3b63);_0x3ace5e(_0x3a3b63);});});}exports[_0x49de('0x14')]=function(_0x52f1cf){var _0x1eb938=this;return new Promise(function(_0x75884d,_0x540d29){return db[_0x49de('0x15')]['create'](_0x52f1cf['body'],{'raw':_0x52f1cf[_0x49de('0x16')]?_0x52f1cf[_0x49de('0x16')][_0x49de('0x17')]===undefined?!![]:![]:!![]})[_0x49de('0xa')](function(_0x248cb2){logger[_0x49de('0xb')](_0x49de('0x14'),_0x52f1cf);logger['debug']('CreateVoiceTransferReport',_0x52f1cf,JSON['stringify'](_0x248cb2));_0x75884d(_0x248cb2);})[_0x49de('0x13')](function(_0x385b4d){logger[_0x49de('0x10')](_0x49de('0x14'),_0x385b4d[_0x49de('0x11')],_0x52f1cf);_0x540d29(_0x1eb938[_0x49de('0x10')](0x1f4,_0x385b4d[_0x49de('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 76ffbff..94e51c7 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 _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x443636,_0x31732a){var _0x5e83b2=function(_0x1fa51b){while(--_0x1fa51b){_0x443636['push'](_0x443636['shift']());}};_0x5e83b2(++_0x31732a);}(_0x9a19,0x114));var _0x99a1=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x9a19[_0x377a6e];return _0x37f751;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0x34e8,0x12c));var _0x834e=function(_0x352a6b,_0x2b2d0c){_0x352a6b=_0x352a6b-0x0;var _0x477e87=_0x34e8[_0x352a6b];return _0x477e87;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b1058b6..f9bd3e1 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 _0x5c12=['name','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','all','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','handleError:','error','status','send'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5c12,0x188));var _0x25c1=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x5c12[_0x59d89e];return _0x554e93;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x25c1('0x0'));var db=require(_0x25c1('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var jayson=require(_0x25c1('0x4'));var amiClient=jayson[_0x25c1('0x5')][_0x25c1('0x6')]({'port':0x232a});var logger=require(_0x25c1('0x7'))(_0x25c1('0x8'));var Redis=require('ioredis');config[_0x25c1('0x9')]=_[_0x25c1('0xa')](config[_0x25c1('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25c1('0x9')]));var Schema=require(_0x25c1('0xb'));var originateValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'callNumber':{'type':_0x25c1('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x25c1('0xe')},'callbackUrl':{'type':_0x25c1('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':[!![],_0x25c1('0xf')]},'transferNumber':{'type':_0x25c1('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]}});function emit(_0x55b62d,_0x5d631e,_0x5b852a){logger[_0x25c1('0x10')](_0x55b62d,_0x5d631e,JSON[_0x25c1('0x11')](_0x5b852a));io['to'](_0x55b62d)['emit'](_0x5d631e,_0x5b852a);}function handleError(_0x4c55e7){return function(_0x61a29f){console['log'](_0x25c1('0x12'),_0x61a29f,_0x61a29f instanceof RangeError);logger[_0x25c1('0x13')](_0x61a29f['stack']);if(_0x61a29f instanceof RangeError){if(_0x61a29f['name']){delete _0x61a29f['name'];}_0x4c55e7[_0x25c1('0x14')](0x194)[_0x25c1('0x15')](_0x61a29f);}else{if(_0x61a29f[_0x25c1('0x16')]){delete _0x61a29f[_0x25c1('0x16')];}_0x4c55e7['status'](0x1f4)[_0x25c1('0x15')](_0x61a29f);}};}function checkError(){return function(_0x9f54e3){if(!_0x9f54e3){throw new RangeError(_0x25c1('0x17'));}return _0x9f54e3;};}function respondWithRpcPromise(_0x29e637,_0x517a46){return new BPromise(function(_0x4c3259,_0x2a8a84){var _0xac3335=amiClient;return _0xac3335[_0x25c1('0x18')](_0x29e637,_0x517a46)[_0x25c1('0x19')](function(_0x15cf2f){if(_0x15cf2f[_0x25c1('0x13')]){if(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1a')]===0x1f4){return _0x2a8a84(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}return _0x4c3259(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}else{_0x4c3259(_0x15cf2f[_0x25c1('0x1c')]);}})['catch'](function(_0x2dadae){_0x2a8a84(_0x2dadae);});});}function getAgent(_0x20dbb9){return db[_0x25c1('0x1d')][_0x25c1('0x1e')]({'where':{'id':_0x20dbb9,'role':_0x25c1('0x1f')}})[_0x25c1('0x19')](checkError());}function getAgentCheckSession(_0x5ad776,_0x17c924){return new BPromise(function(_0x428ce8,_0x6cb14f){var _0x38c1d5=respondWithRpcPromise(_0x25c1('0x20'));var _0x193a68=getAgent(_0x5ad776);Promise['all']([_0x38c1d5,_0x193a68])[_0x25c1('0x19')](function(_0x478f1e){var _0x76b360=_0x478f1e[0x0];var _0x31c153=_0x478f1e[0x1];var _0x2c42b9=_[_0x25c1('0x21')](_0x76b360[_0x25c1('0x22')],function(_0x21069c){return _0x21069c[_0x25c1('0x23')]==_0x31c153['id']&&_0x21069c[_0x25c1('0x24')]==_0x17c924;});if(_0x2c42b9[_0x25c1('0x25')]==0x1){_0x428ce8(_0x31c153);}else{_0x6cb14f(new RangeError('sessionId\x20'+_0x17c924+_0x25c1('0x26')));}});});}exports['originate']=function(_0x492715,_0x3db0ee){logger[_0x25c1('0x10')]('originate\x20fired:',_0x492715[_0x25c1('0x27')]);var _0x5a5a32=originateValidation[_0x25c1('0xb')](_0x492715['body']);if(_0x5a5a32[_0x25c1('0x25')]>0x0){return _0x3db0ee[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x5a5a32);}var _0x148e2a=_0x492715[_0x25c1('0x27')][_0x25c1('0x29')];var _0x461d23=_0x492715[_0x25c1('0x27')]['callNumber'];var _0x20a273=_0x492715['body'][_0x25c1('0x2a')];var _0x56de5e=_0x492715[_0x25c1('0x27')][_0x25c1('0x2b')];return getAgent(_0x148e2a)[_0x25c1('0x19')](function(_0x2f86de){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x2f86de[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x2f86de[_0x25c1('0x16')]),_0x25c1('0x2f'),{'callNumber':_0x461d23,'callerId':_0x20a273,'callbackUrl':_0x56de5e});return _0x3db0ee[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x30')});})[_0x25c1('0x31')](handleError(_0x3db0ee));};exports[_0x25c1('0x32')]=function(_0x349aef,_0x30b1d7){logger[_0x25c1('0x10')](_0x25c1('0x33'),_0x349aef['body']);var _0x32cc49=hangupValidation[_0x25c1('0xb')](_0x349aef['body']);if(_0x32cc49[_0x25c1('0x25')]>0x0){return _0x30b1d7['status'](0x190)[_0x25c1('0x28')](_0x32cc49);}var _0x4f978c=_0x349aef[_0x25c1('0x27')][_0x25c1('0x29')];var _0x1cf0b8=_0x349aef[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x4f978c)['then'](function(_0x1fe6d7){logger['info'](_0x25c1('0x2c'),_0x1fe6d7[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x1fe6d7['name']),'webbar:hangup',{'sessionId':_0x1cf0b8});return _0x30b1d7['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x34')});})['catch'](handleError(_0x30b1d7));};exports[_0x25c1('0x35')]=function(_0x58792d,_0x3d5172){logger[_0x25c1('0x10')](_0x25c1('0x36'),_0x58792d['body']);var _0x5502c1=answerValidation['validate'](_0x58792d[_0x25c1('0x27')]);if(_0x5502c1[_0x25c1('0x25')]>0x0){return _0x3d5172['status'](0x190)[_0x25c1('0x28')](_0x5502c1);}var _0x4c90f6=_0x58792d[_0x25c1('0x27')]['userId'];var _0x5e43dc=_0x58792d['body']['sessionId'];return getAgent(_0x4c90f6)[_0x25c1('0x19')](function(_0x259250){logger['info'](_0x25c1('0x2c'),_0x259250[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x259250[_0x25c1('0x16')]),_0x25c1('0x37'),{'sessionId':_0x5e43dc});return _0x3d5172[_0x25c1('0x14')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x25c1('0x31')](handleError(_0x3d5172));};exports[_0x25c1('0x38')]=function(_0x389547,_0x4bed0a){logger[_0x25c1('0x10')](_0x25c1('0x39'),_0x389547[_0x25c1('0x27')]);var _0xa009d1=holdValidation['validate'](_0x389547[_0x25c1('0x27')]);if(_0xa009d1[_0x25c1('0x25')]>0x0){return _0x4bed0a[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0xa009d1);}var _0x5d2ecc=_0x389547['body'][_0x25c1('0x29')];var _0x2cd055=_0x389547[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5d2ecc)['then'](function(_0x6eff9e){logger[_0x25c1('0x10')]('entityFound:',_0x6eff9e[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x6eff9e[_0x25c1('0x16')]),'webbar:hold',{'sessionId':_0x2cd055});return _0x4bed0a['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x3a')});})[_0x25c1('0x31')](handleError(_0x4bed0a));};exports['unhold']=function(_0x19028a,_0x2d874b){logger['info'](_0x25c1('0x3b'),_0x19028a[_0x25c1('0x27')]);var _0x2b58a3=unholdValidation[_0x25c1('0xb')](_0x19028a[_0x25c1('0x27')]);if(_0x2b58a3[_0x25c1('0x25')]>0x0){return _0x2d874b[_0x25c1('0x14')](0x190)['json'](_0x2b58a3);}var _0x5344da=_0x19028a['body'][_0x25c1('0x29')];var _0x5c588c=_0x19028a[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5344da)[_0x25c1('0x19')](function(_0x153603){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x153603['name']);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x153603[_0x25c1('0x16')]),_0x25c1('0x3c'),{'sessionId':_0x5c588c});return _0x2d874b[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':'unhold\x20executed!'});})[_0x25c1('0x31')](handleError(_0x2d874b));};exports[_0x25c1('0x3d')]=function(_0x18f7c5,_0xbff8ad){logger[_0x25c1('0x10')]('calls\x20fired:',_0xbff8ad[_0x25c1('0x27')]);var _0x3df219=callsValidation['validate'](_0x18f7c5[_0x25c1('0x27')]);if(_0x3df219[_0x25c1('0x25')]>0x0){return _0xbff8ad[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x3df219);}var _0x30ca5d=_0x18f7c5[_0x25c1('0x27')]['userId'];var _0x20ff17=respondWithRpcPromise(_0x25c1('0x20'));var _0x2760ef=getAgent(_0x30ca5d);return Promise[_0x25c1('0x3e')]([_0x20ff17,_0x2760ef])[_0x25c1('0x19')](function(_0x4052c1){var _0x2745b6=_0x4052c1[0x0];var _0x5d54cd=_0x4052c1[0x1];var _0x321833=_[_0x25c1('0x21')](_0x2745b6[_0x25c1('0x22')],function(_0x2d9e6b){return _0x2d9e6b[_0x25c1('0x23')]==_0x5d54cd['id'];});return _0xbff8ad[_0x25c1('0x14')](0xc8)['json']({'count':_0x321833[_0x25c1('0x25')],'rows':_0x321833});})[_0x25c1('0x31')](handleError(_0xbff8ad));};exports[_0x25c1('0x3f')]=function(_0x7a1d7a,_0x3d3ea2){logger[_0x25c1('0x10')](_0x25c1('0x40'),_0x7a1d7a['body']);var _0x44efc9=conferenceValidation['validate'](_0x7a1d7a[_0x25c1('0x27')]);if(_0x44efc9[_0x25c1('0x25')]>0x0){return _0x3d3ea2[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x44efc9);}var _0x3b0785=_0x7a1d7a[_0x25c1('0x27')][_0x25c1('0x29')];return getAgent(_0x3b0785)[_0x25c1('0x19')](function(_0x4c435c){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x4c435c[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x4c435c[_0x25c1('0x16')]),_0x25c1('0x41'));return _0x3d3ea2['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3d3ea2));};exports['transfer']=function(_0x188b51,_0x4b1ead){logger[_0x25c1('0x10')](_0x25c1('0x42'),_0x188b51[_0x25c1('0x27')]);var _0x58c743=transferValidation[_0x25c1('0xb')](_0x188b51['body']);if(_0x58c743[_0x25c1('0x25')]>0x0){return _0x4b1ead[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x58c743);}var _0x34579c=_0x188b51[_0x25c1('0x27')][_0x25c1('0x29')];var _0x11bdc4=_0x188b51['body'][_0x25c1('0x24')];var _0x46f71f=_0x188b51[_0x25c1('0x27')][_0x25c1('0x43')];return getAgent(_0x34579c)[_0x25c1('0x19')](function(_0x425f3e){logger['info'](_0x25c1('0x2c'),_0x425f3e['name']);emit(util[_0x25c1('0x2d')]('user:%s',_0x425f3e['name']),_0x25c1('0x44'),{'sessionId':_0x11bdc4,'transferNumber':_0x46f71f});return _0x4b1ead['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4b1ead));}; \ No newline at end of file +var _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x293136,_0x21d7b7){var _0x4b3280=function(_0x2ce198){while(--_0x2ce198){_0x293136['push'](_0x293136['shift']());}};_0x4b3280(++_0x21d7b7);}(_0x7341,0xe4));var _0x1734=function(_0x464d1f,_0x3f8b32){_0x464d1f=_0x464d1f-0x0;var _0x19a2c9=_0x7341[_0x464d1f];return _0x19a2c9;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index fb7be86..9b02add 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 _0x193a=['post','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','removeAnswers','/:id/users','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','create','addDisposition'];(function(_0x527e5f,_0x2e4242){var _0x5d7a68=function(_0x42fc6f){while(--_0x42fc6f){_0x527e5f['push'](_0x527e5f['shift']());}};_0x5d7a68(++_0x2e4242);}(_0x193a,0x110));var _0xa193=function(_0x24278b,_0x1e42f9){_0x24278b=_0x24278b-0x0;var _0x35214a=_0x193a[_0x24278b];return _0x35214a;};'use strict';var multer=require('multer');var util=require(_0xa193('0x0'));var path=require(_0xa193('0x1'));var timeout=require(_0xa193('0x2'));var express=require(_0xa193('0x3'));var router=express[_0xa193('0x4')]();var fs_extra=require(_0xa193('0x5'));var auth=require(_0xa193('0x6'));var interaction=require(_0xa193('0x7'));var config=require(_0xa193('0x8'));var controller=require(_0xa193('0x9'));router[_0xa193('0xa')]('/',auth['isAuthenticated'](),controller[_0xa193('0xb')]);router['get'](_0xa193('0xc'),auth[_0xa193('0xd')](),controller[_0xa193('0xe')]);router['get']('/:id',auth[_0xa193('0xd')](),controller[_0xa193('0xf')]);router[_0xa193('0xa')](_0xa193('0x10'),auth[_0xa193('0xd')](),controller[_0xa193('0x11')]);router[_0xa193('0xa')](_0xa193('0x12'),auth[_0xa193('0xd')](),controller[_0xa193('0x13')]);router[_0xa193('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xa193('0xa')](_0xa193('0x14'),auth['isAuthenticated'](),controller[_0xa193('0x15')]);router['post']('/',auth[_0xa193('0xd')](),controller[_0xa193('0x16')]);router['post'](_0xa193('0x10'),auth[_0xa193('0xd')](),controller[_0xa193('0x17')]);router[_0xa193('0x18')]('/:id/canned_answers',auth[_0xa193('0xd')](),controller[_0xa193('0x19')]);router['post']('/:id/users',auth[_0xa193('0xd')](),controller[_0xa193('0x1a')]);router['post']('/:id/applications',auth[_0xa193('0xd')](),controller[_0xa193('0x1b')]);router['post'](_0xa193('0x1c'),controller['notify']);router[_0xa193('0x18')](_0xa193('0x1d'),auth[_0xa193('0xd')](),controller[_0xa193('0x1e')]);router[_0xa193('0x1f')](_0xa193('0x20'),auth['isAuthenticated'](),controller[_0xa193('0x21')]);router[_0xa193('0x22')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xa193('0x12'),auth[_0xa193('0xd')](),controller[_0xa193('0x23')]);router[_0xa193('0x22')](_0xa193('0x24'),auth[_0xa193('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6654=['/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','create','post','addDisposition','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xda65fa,_0x175bdc){var _0x479dd1=function(_0x2a9c8b){while(--_0x2a9c8b){_0xda65fa['push'](_0xda65fa['shift']());}};_0x479dd1(++_0x175bdc);}(_0x6654,0xca));var _0x4665=function(_0x3e0736,_0x7967bb){_0x3e0736=_0x3e0736-0x0;var _0x5310b9=_0x6654[_0x3e0736];return _0x5310b9;};'use strict';var multer=require(_0x4665('0x0'));var util=require('util');var path=require(_0x4665('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4665('0x2')]();var fs_extra=require(_0x4665('0x3'));var auth=require(_0x4665('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4665('0x5'));var controller=require(_0x4665('0x6'));router[_0x4665('0x7')]('/',auth[_0x4665('0x8')](),controller[_0x4665('0x9')]);router[_0x4665('0x7')](_0x4665('0xa'),auth['isAuthenticated'](),controller[_0x4665('0xb')]);router['get'](_0x4665('0xc'),auth[_0x4665('0x8')](),controller[_0x4665('0xd')]);router[_0x4665('0x7')](_0x4665('0xe'),auth[_0x4665('0x8')](),controller['getDispositions']);router[_0x4665('0x7')](_0x4665('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4665('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x4665('0x10')]);router[_0x4665('0x7')](_0x4665('0x11'),auth[_0x4665('0x8')](),controller[_0x4665('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4665('0x13')]);router[_0x4665('0x14')](_0x4665('0xe'),auth[_0x4665('0x8')](),controller[_0x4665('0x15')]);router[_0x4665('0x14')](_0x4665('0xf'),auth[_0x4665('0x8')](),controller['addAnswer']);router['post'](_0x4665('0x16'),auth[_0x4665('0x8')](),controller['addAgents']);router['post'](_0x4665('0x11'),auth[_0x4665('0x8')](),controller[_0x4665('0x17')]);router[_0x4665('0x14')](_0x4665('0x18'),controller[_0x4665('0x19')]);router[_0x4665('0x14')](_0x4665('0x1a'),auth['isAuthenticated'](),controller[_0x4665('0x1b')]);router[_0x4665('0x1c')](_0x4665('0xc'),auth[_0x4665('0x8')](),controller[_0x4665('0x1d')]);router[_0x4665('0x1e')](_0x4665('0xc'),auth[_0x4665('0x8')](),controller[_0x4665('0x1f')]);router[_0x4665('0x1e')](_0x4665('0xe'),auth[_0x4665('0x8')](),controller[_0x4665('0x20')]);router[_0x4665('0x1e')](_0x4665('0xf'),auth['isAuthenticated'](),controller[_0x4665('0x21')]);router[_0x4665('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x4665('0x22')]);module[_0x4665('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 357a7b0..3a9ba28 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 _0xe1e4=['sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','ENUM','twilio'];(function(_0x4838ed,_0x3ae45d){var _0x4a073a=function(_0x1dffcb){while(--_0x1dffcb){_0x4838ed['push'](_0x4838ed['shift']());}};_0x4a073a(++_0x3ae45d);}(_0xe1e4,0x18e));var _0x4e1e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe1e4[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4e1e('0x0'));var rs=require(_0x4e1e('0x1'));module['exports']={'name':{'type':Sequelize[_0x4e1e('0x2')],'unique':_0x4e1e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4e1e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4e1e('0x2')],'defaultValue':function(){return rs[_0x4e1e('0x4')]();}},'phone':{'type':Sequelize[_0x4e1e('0x2')]},'type':{'type':Sequelize[_0x4e1e('0x5')](_0x4e1e('0x6'),_0x4e1e('0x7'))},'accountSid':{'type':Sequelize[_0x4e1e('0x2')]},'baseUrl':{'type':Sequelize[_0x4e1e('0x2')]},'authToken':{'type':Sequelize[_0x4e1e('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4e1e('0x8');}},'notificationSound':{'type':Sequelize[_0x4e1e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e1e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4e1e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4e1e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4e1e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4e1e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4e1e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4e1e('0xa')],'comment':_0x4e1e('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x4e1e('0x9')],'defaultValue':![],'comment':_0x4e1e('0xc'),'set':function(_0x7e772d){if(!_0x7e772d){this[_0x4e1e('0xd')](_0x4e1e('0xe'),null);}this[_0x4e1e('0xd')]('mandatoryDisposition',_0x7e772d);}},'description':{'type':Sequelize[_0x4e1e('0x2')]}}; \ No newline at end of file +var _0x4e2e=['ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x18f693,_0x130321){var _0x34f115=function(_0x188170){while(--_0x188170){_0x18f693['push'](_0x18f693['shift']());}};_0x34f115(++_0x130321);}(_0x4e2e,0x193));var _0xe4e2=function(_0x12bf16,_0x33f0c1){_0x12bf16=_0x12bf16-0x0;var _0x2f6628=_0x4e2e[_0x12bf16];return _0x2f6628;};'use strict';var Sequelize=require(_0xe4e2('0x0'));var rs=require(_0xe4e2('0x1'));module[_0xe4e2('0x2')]={'name':{'type':Sequelize[_0xe4e2('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe4e2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe4e2('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe4e2('0x3')],'defaultValue':function(){return rs[_0xe4e2('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe4e2('0x5')](_0xe4e2('0x6'),_0xe4e2('0x7'))},'accountSid':{'type':Sequelize[_0xe4e2('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe4e2('0x8')],'defaultValue':function(){return _0xe4e2('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe4e2('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe4e2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe4e2('0xb')],'comment':_0xe4e2('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xe4e2('0xa')],'defaultValue':![],'comment':_0xe4e2('0xd'),'set':function(_0x1c05de){if(!_0x1c05de){this[_0xe4e2('0xe')](_0xe4e2('0xf'),null);}this[_0xe4e2('0xe')](_0xe4e2('0x10'),_0x1c05de);}},'description':{'type':Sequelize[_0xe4e2('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8057083..ae36462 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 _0xd0d5=['finally','json','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','update','then','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','Pause','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority'];(function(_0x2be904,_0x501cb2){var _0x5c35d1=function(_0x1fdc89){while(--_0x1fdc89){_0x2be904['push'](_0x2be904['shift']());}};_0x5c35d1(++_0x501cb2);}(_0xd0d5,0x1e3));var _0x5d0d=function(_0x56ed30,_0x43d260){_0x56ed30=_0x56ed30-0x0;var _0x384f6a=_0xd0d5[_0x56ed30];return _0x384f6a;};'use strict';var emlformat=require(_0x5d0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d0d('0x1'));var jsonpatch=require(_0x5d0d('0x2'));var rp=require(_0x5d0d('0x3'));var moment=require(_0x5d0d('0x4'));var BPromise=require(_0x5d0d('0x5'));var Mustache=require(_0x5d0d('0x6'));var util=require(_0x5d0d('0x7'));var path=require(_0x5d0d('0x8'));var sox=require(_0x5d0d('0x9'));var csv=require(_0x5d0d('0xa'));var ejs=require(_0x5d0d('0xb'));var fs=require('fs');var fs_extra=require(_0x5d0d('0xc'));var _=require('lodash');var squel=require(_0x5d0d('0xd'));var crypto=require(_0x5d0d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d0d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d0d('0x10'));var Papa=require(_0x5d0d('0x11'));var Redis=require(_0x5d0d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d0d('0x13'));var hardwareService=require(_0x5d0d('0x14'));var logger=require(_0x5d0d('0x15'))(_0x5d0d('0x16'));var utils=require('../../config/utils');var config=require(_0x5d0d('0x17'));var licenseUtil=require(_0x5d0d('0x18'));var db=require('../../mysqldb')['db'];config[_0x5d0d('0x19')]=_['defaults'](config[_0x5d0d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5d0d('0x1a'))(new Redis(config[_0x5d0d('0x19')]));require(_0x5d0d('0x1b'))[_0x5d0d('0x1c')](socket);var jayson=require(_0x5d0d('0x1d'));var client=jayson[_0x5d0d('0x1e')][_0x5d0d('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x318f04,_0x5054f7,_0x30641a,_0x3e141c){return new BPromise(function(_0x2148c2,_0x2aef48){var _0x1978ae=_0x3e141c||client;return _0x1978ae[_0x5d0d('0x20')](_0x318f04,_0x30641a)['then'](function(_0x330f2d){logger[_0x5d0d('0x21')](_0x5d0d('0x22'),_0x5054f7,_0x5d0d('0x23'));logger[_0x5d0d('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5054f7,_0x5d0d('0x23'),JSON[_0x5d0d('0x25')](_0x330f2d));if(_0x330f2d[_0x5d0d('0x26')]){if(_0x330f2d[_0x5d0d('0x26')]['code']===0x1f4){logger[_0x5d0d('0x26')](_0x5d0d('0x22'),_0x5054f7,_0x330f2d[_0x5d0d('0x26')][_0x5d0d('0x27')]);return _0x2aef48(_0x330f2d[_0x5d0d('0x26')][_0x5d0d('0x27')]);}logger[_0x5d0d('0x26')](_0x5d0d('0x22'),_0x5054f7,_0x330f2d[_0x5d0d('0x26')]['message']);return _0x2148c2(_0x330f2d[_0x5d0d('0x26')][_0x5d0d('0x27')]);}else{logger[_0x5d0d('0x21')](_0x5d0d('0x22'),_0x5054f7,'request\x20sent');_0x2148c2(_0x330f2d[_0x5d0d('0x28')]['message']);}})[_0x5d0d('0x29')](function(_0xf0df0e){logger[_0x5d0d('0x26')](_0x5d0d('0x22'),_0x5054f7,_0xf0df0e);_0x2aef48(_0xf0df0e);});});}function respondWithStatusCode(_0x5f5ac9,_0x1aa820){_0x1aa820=_0x1aa820||0xcc;return function(_0x2b02ea){if(_0x2b02ea){return _0x5f5ac9[_0x5d0d('0x2a')](_0x1aa820);}return _0x5f5ac9[_0x5d0d('0x2b')](_0x1aa820)[_0x5d0d('0x2c')]();};}function respondWithResult(_0x5e7326,_0x537548){_0x537548=_0x537548||0xc8;return function(_0x5b4f43){if(_0x5b4f43){return _0x5e7326['status'](_0x537548)['json'](_0x5b4f43);}};}function respondWithFilteredResult(_0x2550aa,_0x48b709){return function(_0x130258){if(_0x130258){var _0x4e7be0=typeof _0x48b709['offset']===_0x5d0d('0x2d')&&typeof _0x48b709[_0x5d0d('0x2e')]===_0x5d0d('0x2d');var _0x3877ee=_0x130258[_0x5d0d('0x2f')];var _0x3d70a0=_0x4e7be0?0x0:_0x48b709[_0x5d0d('0x30')];var _0x4a9fe2=_0x4e7be0?_0x130258[_0x5d0d('0x2f')]:_0x48b709[_0x5d0d('0x30')]+_0x48b709['limit'];var _0x4b4aa3;if(_0x4a9fe2>=_0x3877ee){_0x4a9fe2=_0x3877ee;_0x4b4aa3=0xc8;}else{_0x4b4aa3=0xce;}_0x2550aa[_0x5d0d('0x2b')](_0x4b4aa3);return _0x2550aa[_0x5d0d('0x31')]('Content-Range',_0x3d70a0+'-'+_0x4a9fe2+'/'+_0x3877ee)['json'](_0x130258);}return null;};}function patchUpdates(_0x435f28){return function(_0x96d65a){try{jsonpatch[_0x5d0d('0x32')](_0x96d65a,_0x435f28,!![]);}catch(_0x4d780a){return BPromise[_0x5d0d('0x33')](_0x4d780a);}return _0x96d65a[_0x5d0d('0x34')]();};}function saveUpdates(_0x1c21f0,_0x4406ac){return function(_0x59e295){if(_0x59e295){return _0x59e295[_0x5d0d('0x35')](_0x1c21f0)['then'](function(_0x41fceb){return _0x41fceb;});}return null;};}function removeEntity(_0x22e837,_0x1f9d8d){return function(_0x4c01b8){if(_0x4c01b8){return _0x4c01b8['destroy']()[_0x5d0d('0x36')](function(){var _0x356d44=_0x4c01b8[_0x5d0d('0x37')]({'plain':!![]});var _0x4db4b2=_0x5d0d('0x38');return db[_0x5d0d('0x39')]['destroy']({'where':{'type':_0x4db4b2,'resourceId':_0x356d44['id']}})[_0x5d0d('0x36')](function(){return _0x4c01b8;});})[_0x5d0d('0x36')](function(){_0x22e837[_0x5d0d('0x2b')](0xcc)[_0x5d0d('0x2c')]();});}};}function handleEntityNotFound(_0x52ada1,_0x177d0e){return function(_0x4e9908){if(!_0x4e9908){_0x52ada1[_0x5d0d('0x2a')](0x194);}return _0x4e9908;};}function handleError(_0x517d41,_0x49e62c){_0x49e62c=_0x49e62c||0x1f4;return function(_0x1c0d46){logger['error'](_0x1c0d46[_0x5d0d('0x3a')]);if(_0x1c0d46['name']){delete _0x1c0d46[_0x5d0d('0x3b')];}_0x517d41[_0x5d0d('0x2b')](_0x49e62c)[_0x5d0d('0x3c')](_0x1c0d46);};}exports[_0x5d0d('0x3d')]=function(_0x14d978,_0x1e56fa){var _0x2836dc={'include':[{'model':db['Pause'],'as':_0x5d0d('0x3e')}]},_0x792a7={},_0x4cfc53={'count':0x0,'rows':[]};var _0x3080b8=_[_0x5d0d('0x3f')](db[_0x5d0d('0x40')]['rawAttributes'],function(_0x34e230){return{'name':_0x34e230[_0x5d0d('0x41')],'type':_0x34e230[_0x5d0d('0x42')][_0x5d0d('0x43')]};});_0x792a7[_0x5d0d('0x44')]=_['map'](_0x3080b8,_0x5d0d('0x3b'));_0x792a7[_0x5d0d('0x45')]=_[_0x5d0d('0x46')](_0x14d978[_0x5d0d('0x45')]);_0x792a7[_0x5d0d('0x47')]=_[_0x5d0d('0x48')](_0x792a7['model'],_0x792a7[_0x5d0d('0x45')]);_0x2836dc['attributes']=_[_0x5d0d('0x48')](_0x792a7['model'],qs[_0x5d0d('0x49')](_0x14d978[_0x5d0d('0x45')][_0x5d0d('0x49')]));_0x2836dc[_0x5d0d('0x4a')]=_0x2836dc[_0x5d0d('0x4a')][_0x5d0d('0x4b')]?_0x2836dc[_0x5d0d('0x4a')]:_0x792a7[_0x5d0d('0x44')];if(!_0x14d978['query'][_0x5d0d('0x4c')](_0x5d0d('0x4d'))){_0x2836dc['limit']=qs[_0x5d0d('0x2e')](_0x14d978[_0x5d0d('0x45')][_0x5d0d('0x2e')]);_0x2836dc[_0x5d0d('0x30')]=qs['offset'](_0x14d978[_0x5d0d('0x45')][_0x5d0d('0x30')]);}_0x2836dc[_0x5d0d('0x4e')]=qs[_0x5d0d('0x4f')](_0x14d978[_0x5d0d('0x45')][_0x5d0d('0x4f')]);_0x2836dc[_0x5d0d('0x50')]=qs[_0x5d0d('0x47')](_[_0x5d0d('0x51')](_0x14d978['query'],_0x792a7[_0x5d0d('0x47')]),_0x3080b8);if(_0x14d978['query'][_0x5d0d('0x52')]){_0x2836dc[_0x5d0d('0x50')]=_[_0x5d0d('0x53')](_0x2836dc['where'],{'$or':_[_0x5d0d('0x3f')](_0x3080b8,function(_0x200a0d){if(_0x200a0d['type']!==_0x5d0d('0x54')){var _0x15cef5={};_0x15cef5[_0x200a0d[_0x5d0d('0x3b')]]={'$like':'%'+_0x14d978['query'][_0x5d0d('0x52')]+'%'};return _0x15cef5;}})});}_0x2836dc=_[_0x5d0d('0x53')]({},_0x2836dc,_0x14d978['options']);var _0x4d40d3={'where':_0x2836dc[_0x5d0d('0x50')]};return db[_0x5d0d('0x40')][_0x5d0d('0x2f')](_0x4d40d3)[_0x5d0d('0x36')](function(_0x3709cc){_0x4cfc53[_0x5d0d('0x2f')]=_0x3709cc;if(_0x14d978[_0x5d0d('0x45')][_0x5d0d('0x55')]){_0x2836dc[_0x5d0d('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x5d0d('0x57')](_0x2836dc);})['then'](function(_0x2a5010){_0x4cfc53[_0x5d0d('0x58')]=_0x2a5010;return _0x4cfc53;})[_0x5d0d('0x36')](respondWithFilteredResult(_0x1e56fa,_0x2836dc))['catch'](handleError(_0x1e56fa,null));};exports['show']=function(_0x266727,_0x3c4369){var _0x32b65e={'raw':![],'where':{'id':_0x266727[_0x5d0d('0x59')]['id']},'include':[{'model':db[_0x5d0d('0x5a')],'as':_0x5d0d('0x3e')}]},_0x94ccc0={};_0x94ccc0['model']=_[_0x5d0d('0x46')](db[_0x5d0d('0x40')][_0x5d0d('0x5b')]);_0x94ccc0[_0x5d0d('0x45')]=_[_0x5d0d('0x46')](_0x266727['query']);_0x94ccc0[_0x5d0d('0x47')]=_[_0x5d0d('0x48')](_0x94ccc0[_0x5d0d('0x44')],_0x94ccc0[_0x5d0d('0x45')]);_0x32b65e[_0x5d0d('0x4a')]=_[_0x5d0d('0x48')](_0x94ccc0[_0x5d0d('0x44')],qs[_0x5d0d('0x49')](_0x266727['query']['fields']));_0x32b65e['attributes']=_0x32b65e[_0x5d0d('0x4a')][_0x5d0d('0x4b')]?_0x32b65e[_0x5d0d('0x4a')]:_0x94ccc0[_0x5d0d('0x44')];if(_0x266727[_0x5d0d('0x45')]['includeAll']){_0x32b65e['include']=[{'all':!![]}];}_0x32b65e=_['merge']({},_0x32b65e,_0x266727[_0x5d0d('0x5c')]);return db[_0x5d0d('0x40')][_0x5d0d('0x5d')](_0x32b65e)['then'](handleEntityNotFound(_0x3c4369,null))[_0x5d0d('0x36')](respondWithResult(_0x3c4369,null))[_0x5d0d('0x29')](handleError(_0x3c4369,null));};exports[_0x5d0d('0x5e')]=function(_0x5f9018,_0x463f05){return db[_0x5d0d('0x40')][_0x5d0d('0x5e')](_0x5f9018[_0x5d0d('0x5f')],{})['then'](function(_0x200fda){var _0x481d9e=_0x5f9018[_0x5d0d('0x60')][_0x5d0d('0x37')]({'plain':!![]});if(!_0x481d9e)throw new Error(_0x5d0d('0x61'));if(_0x481d9e[_0x5d0d('0x62')]===_0x5d0d('0x60')){var _0x108674=_0x200fda['get']({'plain':!![]});var _0x2d0354=_0x5d0d('0x38');return db[_0x5d0d('0x63')][_0x5d0d('0x5d')]({'where':{'name':_0x2d0354,'userProfileId':_0x481d9e[_0x5d0d('0x64')]},'raw':!![]})[_0x5d0d('0x36')](function(_0x48fff7){if(_0x48fff7&&_0x48fff7[_0x5d0d('0x65')]===0x0){return db[_0x5d0d('0x39')][_0x5d0d('0x5e')]({'name':_0x108674[_0x5d0d('0x3b')],'resourceId':_0x108674['id'],'type':_0x48fff7[_0x5d0d('0x3b')],'sectionId':_0x48fff7['id']},{})['then'](function(){return _0x200fda;});}else{return _0x200fda;}})[_0x5d0d('0x29')](function(_0x2fefc5){logger[_0x5d0d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fefc5);throw _0x2fefc5;});}return _0x200fda;})[_0x5d0d('0x36')](respondWithResult(_0x463f05,0xc9))[_0x5d0d('0x29')](handleError(_0x463f05,null));};exports[_0x5d0d('0x35')]=function(_0x5b3063,_0x5a91b1){if(_0x5b3063[_0x5d0d('0x5f')]['id']){delete _0x5b3063[_0x5d0d('0x5f')]['id'];}return db[_0x5d0d('0x40')][_0x5d0d('0x5d')]({'where':{'id':_0x5b3063[_0x5d0d('0x59')]['id']},'include':[{'model':db[_0x5d0d('0x5a')],'as':'mandatoryDispositionPause'}]})[_0x5d0d('0x36')](handleEntityNotFound(_0x5a91b1,null))[_0x5d0d('0x36')](saveUpdates(_0x5b3063['body'],null))[_0x5d0d('0x36')](respondWithResult(_0x5a91b1,null))[_0x5d0d('0x29')](handleError(_0x5a91b1,null));};exports['destroy']=function(_0x3d9925,_0x469eee){return db[_0x5d0d('0x40')][_0x5d0d('0x5d')]({'where':{'id':_0x3d9925['params']['id']}})['then'](handleEntityNotFound(_0x469eee,null))[_0x5d0d('0x36')](removeEntity(_0x469eee,null))['catch'](handleError(_0x469eee,null));};exports[_0x5d0d('0x66')]=function(_0x32e356,_0x50a928){return db['WhatsappAccount'][_0x5d0d('0x66')]()['then'](respondWithResult(_0x50a928,null))['catch'](handleError(_0x50a928,null));};exports[_0x5d0d('0x67')]=function(_0x4854ab,_0x1301cc,_0x46d7bc){if(_0x4854ab[_0x5d0d('0x5f')]['id']){delete _0x4854ab[_0x5d0d('0x5f')]['id'];}return db[_0x5d0d('0x40')]['find']({'where':{'id':_0x4854ab[_0x5d0d('0x59')]['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x1301cc,null))['then'](function(_0x5be699){if(_0x5be699){_0x4854ab['body']['WhatsappAccountId']=_0x5be699['id'];return db['Disposition'][_0x5d0d('0x5e')](_0x4854ab[_0x5d0d('0x5f')]);}})[_0x5d0d('0x36')](respondWithResult(_0x1301cc,null))[_0x5d0d('0x29')](handleError(_0x1301cc,null));};exports['getDispositions']=function(_0x44c6eb,_0x3710ed,_0x2b7a82){var _0x145895={'raw':![],'where':{}};var _0x1adb64={};var _0x56c099={'count':0x0,'rows':[]};return db[_0x5d0d('0x40')]['findOne']({'where':{'id':_0x44c6eb[_0x5d0d('0x59')]['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x3710ed,null))['then'](function(_0x69c59c){if(_0x69c59c){_0x1adb64[_0x5d0d('0x44')]=_['keys'](db['Disposition'][_0x5d0d('0x5b')]);_0x1adb64[_0x5d0d('0x45')]=_['keys'](_0x44c6eb[_0x5d0d('0x45')]);_0x1adb64[_0x5d0d('0x47')]=_[_0x5d0d('0x48')](_0x1adb64[_0x5d0d('0x44')],_0x1adb64[_0x5d0d('0x45')]);_0x145895[_0x5d0d('0x4a')]=_[_0x5d0d('0x48')](_0x1adb64[_0x5d0d('0x44')],qs[_0x5d0d('0x49')](_0x44c6eb[_0x5d0d('0x45')][_0x5d0d('0x49')]));_0x145895['attributes']=_0x145895[_0x5d0d('0x4a')]['length']?_0x145895[_0x5d0d('0x4a')]:_0x1adb64['model'];if(!_0x44c6eb['query'][_0x5d0d('0x4c')](_0x5d0d('0x4d'))){_0x145895[_0x5d0d('0x2e')]=qs[_0x5d0d('0x2e')](_0x44c6eb[_0x5d0d('0x45')]['limit']);_0x145895['offset']=qs['offset'](_0x44c6eb[_0x5d0d('0x45')]['offset']);}_0x145895['order']=qs[_0x5d0d('0x4f')](_0x44c6eb[_0x5d0d('0x45')]['sort']);_0x145895[_0x5d0d('0x50')]=qs[_0x5d0d('0x47')](_['pick'](_0x44c6eb[_0x5d0d('0x45')],_0x1adb64[_0x5d0d('0x47')]));_0x145895['where'][_0x5d0d('0x68')]=_0x69c59c['id'];if(_0x44c6eb[_0x5d0d('0x45')][_0x5d0d('0x52')]){_0x145895[_0x5d0d('0x50')]=_[_0x5d0d('0x53')](_0x145895['where'],{'$or':_[_0x5d0d('0x3f')](_0x145895[_0x5d0d('0x4a')],function(_0x25d6f5){var _0x30bbc1={};_0x30bbc1[_0x25d6f5]={'$like':'%'+_0x44c6eb[_0x5d0d('0x45')][_0x5d0d('0x52')]+'%'};return _0x30bbc1;})});}_0x145895=_['merge']({},_0x145895,_0x44c6eb[_0x5d0d('0x5c')]);return db[_0x5d0d('0x69')][_0x5d0d('0x2f')]({'where':_0x145895[_0x5d0d('0x50')]})[_0x5d0d('0x36')](function(_0x560b5a){_0x56c099[_0x5d0d('0x2f')]=_0x560b5a;if(_0x44c6eb['query'][_0x5d0d('0x55')]){_0x145895[_0x5d0d('0x56')]=[{'all':!![]}];}return db[_0x5d0d('0x69')][_0x5d0d('0x57')](_0x145895);})['then'](function(_0x2b8c16){_0x56c099[_0x5d0d('0x58')]=_0x2b8c16;return _0x56c099;});}})[_0x5d0d('0x36')](respondWithFilteredResult(_0x3710ed,_0x145895))[_0x5d0d('0x29')](handleError(_0x3710ed,null));};exports['removeDispositions']=function(_0xf6239d,_0x31302a,_0x4548f4){return db[_0x5d0d('0x40')][_0x5d0d('0x5d')]({'where':{'id':_0xf6239d['params']['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x31302a,null))[_0x5d0d('0x36')](function(_0xe8de58){if(_0xe8de58){return _0xe8de58[_0x5d0d('0x6a')](_0xf6239d[_0x5d0d('0x45')][_0x5d0d('0x6b')]);}})['then'](respondWithStatusCode(_0x31302a,null))[_0x5d0d('0x29')](handleError(_0x31302a,null));};exports[_0x5d0d('0x6c')]=function(_0x42cdfc,_0x9ac739,_0xdfaca5){if(_0x42cdfc[_0x5d0d('0x5f')]['id']){delete _0x42cdfc[_0x5d0d('0x5f')]['id'];}return db['WhatsappAccount'][_0x5d0d('0x5d')]({'where':{'id':_0x42cdfc[_0x5d0d('0x59')]['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x9ac739,null))[_0x5d0d('0x36')](function(_0x2289e9){if(_0x2289e9){_0x42cdfc[_0x5d0d('0x5f')][_0x5d0d('0x68')]=_0x2289e9['id'];return db[_0x5d0d('0x6d')][_0x5d0d('0x5e')](_0x42cdfc[_0x5d0d('0x5f')]);}})['then'](respondWithResult(_0x9ac739,null))[_0x5d0d('0x29')](handleError(_0x9ac739,null));};exports[_0x5d0d('0x6e')]=function(_0x21c5cf,_0x8999b9,_0x35ab37){var _0x50e66c={'raw':![],'where':{}};var _0x344115={};var _0x129f14={'count':0x0,'rows':[]};return db[_0x5d0d('0x40')][_0x5d0d('0x6f')]({'where':{'id':_0x21c5cf[_0x5d0d('0x59')]['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x8999b9,null))[_0x5d0d('0x36')](function(_0x31c6c2){if(_0x31c6c2){_0x344115[_0x5d0d('0x44')]=_[_0x5d0d('0x46')](db[_0x5d0d('0x6d')][_0x5d0d('0x5b')]);_0x344115['query']=_['keys'](_0x21c5cf['query']);_0x344115['filters']=_[_0x5d0d('0x48')](_0x344115['model'],_0x344115['query']);_0x50e66c['attributes']=_[_0x5d0d('0x48')](_0x344115['model'],qs[_0x5d0d('0x49')](_0x21c5cf[_0x5d0d('0x45')][_0x5d0d('0x49')]));_0x50e66c[_0x5d0d('0x4a')]=_0x50e66c[_0x5d0d('0x4a')]['length']?_0x50e66c[_0x5d0d('0x4a')]:_0x344115[_0x5d0d('0x44')];if(!_0x21c5cf[_0x5d0d('0x45')][_0x5d0d('0x4c')](_0x5d0d('0x4d'))){_0x50e66c[_0x5d0d('0x2e')]=qs[_0x5d0d('0x2e')](_0x21c5cf[_0x5d0d('0x45')][_0x5d0d('0x2e')]);_0x50e66c[_0x5d0d('0x30')]=qs[_0x5d0d('0x30')](_0x21c5cf[_0x5d0d('0x45')][_0x5d0d('0x30')]);}_0x50e66c[_0x5d0d('0x4e')]=qs[_0x5d0d('0x4f')](_0x21c5cf[_0x5d0d('0x45')][_0x5d0d('0x4f')]);_0x50e66c[_0x5d0d('0x50')]=qs[_0x5d0d('0x47')](_[_0x5d0d('0x51')](_0x21c5cf[_0x5d0d('0x45')],_0x344115[_0x5d0d('0x47')]));_0x50e66c[_0x5d0d('0x50')][_0x5d0d('0x68')]=_0x31c6c2['id'];if(_0x21c5cf[_0x5d0d('0x45')]['filter']){_0x50e66c[_0x5d0d('0x50')]=_[_0x5d0d('0x53')](_0x50e66c['where'],{'$or':_[_0x5d0d('0x3f')](_0x50e66c[_0x5d0d('0x4a')],function(_0x29f19f){var _0x3a6593={};_0x3a6593[_0x29f19f]={'$like':'%'+_0x21c5cf[_0x5d0d('0x45')]['filter']+'%'};return _0x3a6593;})});}_0x50e66c=_[_0x5d0d('0x53')]({},_0x50e66c,_0x21c5cf['options']);return db[_0x5d0d('0x6d')][_0x5d0d('0x2f')]({'where':_0x50e66c['where']})[_0x5d0d('0x36')](function(_0x4fc9fb){_0x129f14[_0x5d0d('0x2f')]=_0x4fc9fb;if(_0x21c5cf[_0x5d0d('0x45')]['includeAll']){_0x50e66c[_0x5d0d('0x56')]=[{'all':!![]}];}return db[_0x5d0d('0x6d')][_0x5d0d('0x57')](_0x50e66c);})[_0x5d0d('0x36')](function(_0x326141){_0x129f14[_0x5d0d('0x58')]=_0x326141;return _0x129f14;});}})[_0x5d0d('0x36')](respondWithFilteredResult(_0x8999b9,_0x50e66c))['catch'](handleError(_0x8999b9,null));};exports[_0x5d0d('0x70')]=function(_0x328784,_0x29d07c,_0x1be38d){return db[_0x5d0d('0x40')]['find']({'where':{'id':_0x328784[_0x5d0d('0x59')]['id']}})['then'](handleEntityNotFound(_0x29d07c,null))[_0x5d0d('0x36')](function(_0x375147){if(_0x375147){return _0x375147[_0x5d0d('0x70')](_0x328784[_0x5d0d('0x45')][_0x5d0d('0x6b')]);}})[_0x5d0d('0x36')](respondWithStatusCode(_0x29d07c,null))[_0x5d0d('0x29')](handleError(_0x29d07c,null));};exports['addAgents']=function(_0x1582cc,_0x5967de,_0x32c52d){return db[_0x5d0d('0x40')][_0x5d0d('0x5d')]({'where':{'id':_0x1582cc['params']['id']}})['then'](handleEntityNotFound(_0x5967de,null))[_0x5d0d('0x36')](function(_0x56bf70){if(_0x56bf70){return _0x56bf70[_0x5d0d('0x71')](_0x1582cc[_0x5d0d('0x5f')][_0x5d0d('0x6b')],_['omit'](_0x1582cc['body'],[_0x5d0d('0x6b'),'id'])||{})[_0x5d0d('0x72')](function(_0x1641d5){for(var _0x2854f1=0x0;_0x2854f1<_0x1582cc[_0x5d0d('0x5f')][_0x5d0d('0x6b')][_0x5d0d('0x4b')];_0x2854f1+=0x1){socket['emit'](_0x5d0d('0x73'),{'UserId':Number(_0x1582cc[_0x5d0d('0x5f')][_0x5d0d('0x6b')][_0x2854f1]),'WhatsappAccountId':Number(_0x1582cc[_0x5d0d('0x59')]['id'])});}return _0x1641d5;});}})[_0x5d0d('0x36')](respondWithResult(_0x5967de,null))[_0x5d0d('0x29')](handleError(_0x5967de,null));};exports[_0x5d0d('0x74')]=function(_0x5d9248,_0x3a3e8d,_0x4f7db0){return db[_0x5d0d('0x40')][_0x5d0d('0x5d')]({'where':{'id':_0x5d9248['params']['id']}})['then'](handleEntityNotFound(_0x3a3e8d,null))[_0x5d0d('0x36')](function(_0x573255){if(_0x573255){return _0x573255['removeAgents'](_0x5d9248[_0x5d0d('0x45')]['ids'])['then'](function(){if(_[_0x5d0d('0x75')](_0x5d9248[_0x5d0d('0x45')]['ids'])){for(var _0x5cd824=0x0;_0x5cd824<_0x5d9248['query'][_0x5d0d('0x6b')][_0x5d0d('0x4b')];_0x5cd824+=0x1){socket[_0x5d0d('0x76')](_0x5d0d('0x77'),{'UserId':Number(_0x5d9248[_0x5d0d('0x45')]['ids'][_0x5cd824]),'WhatsappAccountId':Number(_0x5d9248[_0x5d0d('0x59')]['id'])});}}else{socket[_0x5d0d('0x76')](_0x5d0d('0x77'),{'UserId':Number(_0x5d9248[_0x5d0d('0x45')][_0x5d0d('0x6b')]),'WhatsappAccountId':Number(_0x5d9248[_0x5d0d('0x59')]['id'])});}});}})[_0x5d0d('0x36')](respondWithStatusCode(_0x3a3e8d,null))[_0x5d0d('0x29')](handleError(_0x3a3e8d,null));};exports[_0x5d0d('0x78')]=function(_0x401f56,_0x2d548a,_0x5d11f4){var _0x3e5f26={};var _0x4ef886={};var _0x3703b3;var _0x1532f1;return db[_0x5d0d('0x40')]['findOne']({'where':{'id':_0x401f56[_0x5d0d('0x59')]['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x2d548a,null))[_0x5d0d('0x36')](function(_0x1b0492){if(_0x1b0492){_0x3703b3=_0x1b0492;_0x4ef886[_0x5d0d('0x44')]=_[_0x5d0d('0x46')](db[_0x5d0d('0x79')][_0x5d0d('0x5b')]);_0x4ef886['query']=_[_0x5d0d('0x46')](_0x401f56[_0x5d0d('0x45')]);_0x4ef886[_0x5d0d('0x47')]=_[_0x5d0d('0x48')](_0x4ef886[_0x5d0d('0x44')],_0x4ef886[_0x5d0d('0x45')]);_0x3e5f26['attributes']=_[_0x5d0d('0x48')](_0x4ef886[_0x5d0d('0x44')],qs['fields'](_0x401f56[_0x5d0d('0x45')][_0x5d0d('0x49')]));_0x3e5f26[_0x5d0d('0x4a')]=_0x3e5f26[_0x5d0d('0x4a')]['length']?_0x3e5f26[_0x5d0d('0x4a')]:_0x4ef886[_0x5d0d('0x44')];_0x3e5f26['order']=qs[_0x5d0d('0x4f')](_0x401f56[_0x5d0d('0x45')][_0x5d0d('0x4f')]);_0x3e5f26[_0x5d0d('0x50')]=qs[_0x5d0d('0x47')](_[_0x5d0d('0x51')](_0x401f56['query'],_0x4ef886['filters']));if(_0x401f56[_0x5d0d('0x45')][_0x5d0d('0x52')]){_0x3e5f26[_0x5d0d('0x50')]=_[_0x5d0d('0x53')](_0x3e5f26[_0x5d0d('0x50')],{'$or':_[_0x5d0d('0x3f')](_0x3e5f26['attributes'],function(_0x4bd0d3){var _0x74dc44={};_0x74dc44[_0x4bd0d3]={'$like':'%'+_0x401f56[_0x5d0d('0x45')][_0x5d0d('0x52')]+'%'};return _0x74dc44;})});}_0x3e5f26=_['merge']({},_0x3e5f26,_0x401f56[_0x5d0d('0x5c')]);return _0x3703b3[_0x5d0d('0x78')](_0x3e5f26);}})[_0x5d0d('0x36')](function(_0x5e9d48){if(_0x5e9d48){_0x1532f1=_0x5e9d48[_0x5d0d('0x4b')];if(!_0x401f56[_0x5d0d('0x45')][_0x5d0d('0x4c')](_0x5d0d('0x4d'))){_0x3e5f26[_0x5d0d('0x2e')]=qs['limit'](_0x401f56[_0x5d0d('0x45')]['limit']);_0x3e5f26[_0x5d0d('0x30')]=qs[_0x5d0d('0x30')](_0x401f56[_0x5d0d('0x45')][_0x5d0d('0x30')]);}return _0x3703b3['getAgents'](_0x3e5f26);}})[_0x5d0d('0x36')](function(_0x505831){if(_0x505831){return _0x505831?{'count':_0x1532f1,'rows':_0x505831}:null;}})['then'](respondWithResult(_0x2d548a,null))[_0x5d0d('0x29')](handleError(_0x2d548a,null));};exports['addApplications']=function(_0x45fb6d,_0x49ddb8){var _0x268d5a=_0x45fb6d[_0x5d0d('0x59')]['id'];var _0x390aa6=_0x45fb6d['body'];var _0x3d0e5c=0xc8;var _0x97171a=null;return db[_0x5d0d('0x7a')][_0x5d0d('0x7b')]({'isolationLevel':db[_0x5d0d('0x7a')][_0x5d0d('0x7c')][_0x5d0d('0x7d')][_0x5d0d('0x7e')]},function(_0x5f4113){return db[_0x5d0d('0x40')][_0x5d0d('0x6f')]({'where':{'id':_0x268d5a},'transaction':_0x5f4113})[_0x5d0d('0x36')](function(_0x1a0d0b){if(_0x1a0d0b){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x268d5a},'transaction':_0x5f4113})[_0x5d0d('0x36')](function(){var _0x14b13c=_[_0x5d0d('0x3f')](_0x390aa6,function(_0x13837e){_0x13837e['WhatsappAccountId']=_0x268d5a;return _0x13837e;});return db[_0x5d0d('0x7f')]['bulkCreate'](_0x14b13c,{'transaction':_0x5f4113});});}else{_0x3d0e5c=0x194;_0x97171a=[];}});})[_0x5d0d('0x36')](function(){if(_0x3d0e5c!==0x194){return db[_0x5d0d('0x7f')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x268d5a},'order':_0x5d0d('0x80')})[_0x5d0d('0x36')](function(_0x38eb75){_0x97171a=_0x38eb75;});}})[_0x5d0d('0x29')](function(_0x47e63e){_0x3d0e5c=0x1f4;logger['error'](_0x47e63e['stack']);if(_0x47e63e[_0x5d0d('0x3b')]){delete _0x47e63e[_0x5d0d('0x3b')];}_0x97171a=_0x47e63e;})[_0x5d0d('0x81')](function(){if(_0x97171a===null){_0x49ddb8[_0x5d0d('0x2a')](_0x3d0e5c);}else{if(_0x3d0e5c===0x1f4){_0x49ddb8[_0x5d0d('0x2b')](_0x3d0e5c)[_0x5d0d('0x3c')](_0x97171a);}else{_0x49ddb8[_0x5d0d('0x2b')](_0x3d0e5c)[_0x5d0d('0x82')](_0x97171a);}}});};exports[_0x5d0d('0x83')]=function(_0x559034,_0x57755f,_0x536e85){var _0x57b6ee={};var _0x2bbefa={};var _0x190d24;var _0x15fa10;return db[_0x5d0d('0x40')][_0x5d0d('0x6f')]({'where':{'id':_0x559034[_0x5d0d('0x59')]['id']}})[_0x5d0d('0x36')](handleEntityNotFound(_0x57755f,null))[_0x5d0d('0x36')](function(_0x5579c6){if(_0x5579c6){_0x190d24=_0x5579c6;_0x2bbefa['model']=_['keys'](db['WhatsappApplication'][_0x5d0d('0x5b')]);_0x2bbefa[_0x5d0d('0x45')]=_[_0x5d0d('0x46')](_0x559034[_0x5d0d('0x45')]);_0x2bbefa[_0x5d0d('0x47')]=_[_0x5d0d('0x48')](_0x2bbefa['model'],_0x2bbefa[_0x5d0d('0x45')]);_0x57b6ee[_0x5d0d('0x4a')]=_[_0x5d0d('0x48')](_0x2bbefa[_0x5d0d('0x44')],qs['fields'](_0x559034['query']['fields']));_0x57b6ee[_0x5d0d('0x4a')]=_0x57b6ee[_0x5d0d('0x4a')][_0x5d0d('0x4b')]?_0x57b6ee[_0x5d0d('0x4a')]:_0x2bbefa['model'];_0x57b6ee['order']=qs[_0x5d0d('0x4f')](_0x559034[_0x5d0d('0x45')][_0x5d0d('0x4f')]);_0x57b6ee[_0x5d0d('0x50')]=qs[_0x5d0d('0x47')](_[_0x5d0d('0x51')](_0x559034[_0x5d0d('0x45')],_0x2bbefa[_0x5d0d('0x47')]));if(_0x559034['query'][_0x5d0d('0x52')]){_0x57b6ee[_0x5d0d('0x50')]=_[_0x5d0d('0x53')](_0x57b6ee['where'],{'$or':_[_0x5d0d('0x3f')](_0x57b6ee[_0x5d0d('0x4a')],function(_0x28bd59){var _0x3372b2={};_0x3372b2[_0x28bd59]={'$like':'%'+_0x559034[_0x5d0d('0x45')][_0x5d0d('0x52')]+'%'};return _0x3372b2;})});}_0x57b6ee=_[_0x5d0d('0x53')]({},_0x57b6ee,_0x559034[_0x5d0d('0x5c')]);return _0x190d24[_0x5d0d('0x83')](_0x57b6ee);}})[_0x5d0d('0x36')](function(_0x11c372){if(_0x11c372){_0x15fa10=_0x11c372['length'];if(!_0x559034[_0x5d0d('0x45')][_0x5d0d('0x4c')](_0x5d0d('0x4d'))){_0x57b6ee[_0x5d0d('0x2e')]=qs[_0x5d0d('0x2e')](_0x559034[_0x5d0d('0x45')][_0x5d0d('0x2e')]);_0x57b6ee[_0x5d0d('0x30')]=qs[_0x5d0d('0x30')](_0x559034['query']['offset']);}return _0x190d24[_0x5d0d('0x83')](_0x57b6ee);}})[_0x5d0d('0x36')](function(_0x5035b8){if(_0x5035b8){return _0x5035b8?{'count':_0x15fa10,'rows':_0x5035b8}:null;}})[_0x5d0d('0x36')](respondWithResult(_0x57755f,null))[_0x5d0d('0x29')](handleError(_0x57755f,null));};exports[_0x5d0d('0x84')]=function(_0x14e2e9,_0x2a43b1,_0x3985d7){var _0x522af3={'channel':_0x5d0d('0x85')};var _0x4493af=[];var _0xc3f118=[];var _0x3cf4b0={};return db[_0x5d0d('0x40')][_0x5d0d('0x5d')]({'where':{'id':_0x14e2e9[_0x5d0d('0x59')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x5d0d('0x86')}]})['then'](handleEntityNotFound(_0x2a43b1,null))[_0x5d0d('0x36')](function(_0x2626e1){_0x522af3[_0x5d0d('0x87')]=_0x2626e1;if(_0x522af3[_0x5d0d('0x87')]&&_0x522af3[_0x5d0d('0x87')][_0x5d0d('0x42')]===_0x5d0d('0x88')&&_0x14e2e9[_0x5d0d('0x5f')][_0x5d0d('0x89')]){if(_0x14e2e9[_0x5d0d('0x5f')][_0x5d0d('0x89')]['length']===0x0)return;if(_0x14e2e9['body'][_0x5d0d('0x89')][0x0][_0x5d0d('0x8a')]!==_0x5d0d('0x8b'))return;return db[_0x5d0d('0x8c')][_0x5d0d('0x35')]({'read':!![],'readAt':_0x14e2e9[_0x5d0d('0x5f')][_0x5d0d('0x89')][0x0][_0x5d0d('0x8d')]},{'where':{'messageId':_0x14e2e9[_0x5d0d('0x5f')][_0x5d0d('0x89')][0x0][_0x5d0d('0x8e')]},'individualHooks':!![]})[_0x5d0d('0x36')](function(_0x507576){return _0x2a43b1[_0x5d0d('0x2b')](0xc8)[_0x5d0d('0x82')](_0x507576);});}_0x522af3[_0x5d0d('0x8f')]=_[_0x5d0d('0x90')](_0x2626e1[_0x5d0d('0x86')],[_0x5d0d('0x80')],['asc']);if(_0x522af3[_0x5d0d('0x87')][_0x5d0d('0x86')]){delete _0x522af3['account']['Applications'];}return db['CmContact'][_0x5d0d('0x66')]()[_0x5d0d('0x36')](function(_0x5b0c61){if(!_0x5b0c61){throw new db[(_0x5d0d('0x91'))][(_0x5d0d('0x92'))](_0x5d0d('0x93'));}_0x4493af=_['difference'](_[_0x5d0d('0x46')](_0x5b0c61),[_0x5d0d('0x94'),'updatedAt']);_0xc3f118=_['difference'](_['keys'](_0x5b0c61),[_0x5d0d('0x94'),_0x5d0d('0x95'),_0x5d0d('0x96'),_0x5d0d('0x97')]);_0x522af3['body']={'mapKey':_0x5d0d('0x98')};if(_0x522af3[_0x5d0d('0x87')]&&_0x522af3[_0x5d0d('0x87')][_0x5d0d('0x42')]===_0x5d0d('0x99')){_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9a')]=_0x14e2e9['body'][_0x5d0d('0x9b')][_0x5d0d('0x9c')]('whatsapp:','');_0x522af3[_0x5d0d('0x5f')]['body']=_0x14e2e9[_0x5d0d('0x5f')][_0x5d0d('0x9d')];_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9e')]=_0x14e2e9['body'][_0x5d0d('0x9f')];}if(_0x522af3['account']&&_0x522af3[_0x5d0d('0x87')]['type']===_0x5d0d('0x88')){_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9a')]=_0x14e2e9[_0x5d0d('0x5f')][_0x5d0d('0xa0')][0x0][_0x5d0d('0x9a')];_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x5f')]=_0x14e2e9[_0x5d0d('0x5f')]['notifications'][0x0]['message']['body'];_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9e')]=_0x14e2e9[_0x5d0d('0x5f')]['notifications'][0x0][_0x5d0d('0x8e')];}if(_0x522af3[_0x5d0d('0x5f')]['id']){delete _0x522af3[_0x5d0d('0x5f')]['id'];}if(_[_0x5d0d('0xa1')](_0x522af3['body']['from'])){throw new db['Sequelize']['ValidationError'](_0x5d0d('0xa2'));}if(_[_0x5d0d('0xa1')](_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x5f')])||_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x5f')]===''){throw new db[(_0x5d0d('0x91'))][(_0x5d0d('0x92'))](_0x5d0d('0xa3'));}if(_['isNil'](_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0xa4')])){throw new db['Sequelize'][(_0x5d0d('0x92'))](_0x5d0d('0xa5')+_0xc3f118);}if(!_[_0x5d0d('0xa6')](_0xc3f118,_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0xa4')])){throw new db[(_0x5d0d('0x91'))]['ValidationError'](_0x5d0d('0xa7')+_0xc3f118);}_0x3cf4b0[_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0xa4')]]=_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9a')];return db[_0x5d0d('0xa8')][_0x5d0d('0x5d')]({'where':{'id':_0x522af3[_0x5d0d('0x87')]['ListId']},'include':[{'model':db[_0x5d0d('0xa9')],'as':_0x5d0d('0xaa'),'where':_0x3cf4b0,'limit':0x1,'order':[[_0x5d0d('0x95'),_0x5d0d('0xab')]]}]});})[_0x5d0d('0x36')](handleEntityNotFound(_0x2a43b1,null))['then'](function(_0x4c0796){if(_0x4c0796){_0x522af3[_0x5d0d('0xac')]=_[_0x5d0d('0xad')](_0x4c0796,['Contacts']);if(_0x4c0796['Contacts'][_0x5d0d('0x4b')]){return _0x4c0796[_0x5d0d('0xaa')][0x0];}var _0x45ff1f=_[_0x5d0d('0xae')](_0x522af3[_0x5d0d('0x5f')],{'firstName':_0x522af3[_0x5d0d('0x5f')]['from'],'ListId':_0x4c0796['id']});_0x45ff1f[_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0xa4')]]=_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9a')];return db[_0x5d0d('0xa9')][_0x5d0d('0x5e')](_0x45ff1f,{'fields':_0x4493af,'raw':!![]});}})[_0x5d0d('0x36')](handleEntityNotFound(_0x2a43b1,null))[_0x5d0d('0x36')](function(_0x552afa){if(_0x552afa){_0x522af3[_0x5d0d('0xaf')]=_0x552afa;var _0x4fac7c={'ContactId':_0x552afa['id'],'phone':_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9a')],'WhatsappAccountId':_0x14e2e9['params']['id']};var _0x281577={'ContactId':_0x552afa['id'],'WhatsappAccountId':_0x14e2e9[_0x5d0d('0x59')]['id'],'closed':![]};return db[_0x5d0d('0xb0')][_0x5d0d('0x5d')]({'where':_0x281577})[_0x5d0d('0x36')](function(_0xb73f48){if(_0xb73f48){return[_0xb73f48,![]];}return db['WhatsappInteraction'][_0x5d0d('0x5e')](_0x4fac7c)[_0x5d0d('0x36')](function(_0x58ab99){return[_0x58ab99,!![]];});});}})[_0x5d0d('0x72')](function(_0x4510d4,_0x5bb5ca){_0x522af3[_0x5d0d('0xb1')]=_0x4510d4[_0x5d0d('0x37')]({'plain':!![]});_0x522af3[_0x5d0d('0xb1')][_0x5d0d('0xb2')]=![];if(_0x5bb5ca){if(_0x522af3['account'][_0x5d0d('0xb3')]){_0x522af3[_0x5d0d('0x8f')][_0x5d0d('0xb4')]({'id':0x0,'priority':_0x522af3[_0x5d0d('0x8f')][_0x5d0d('0x4b')]+0x1,'app':_0x5d0d('0xb5'),'appdata':_0x5d0d('0xb6'),'interval':_0x5d0d('0xb7')});}_0x522af3[_0x5d0d('0xb1')][_0x5d0d('0xb2')]=!![];}return db[_0x5d0d('0x8c')][_0x5d0d('0x5e')]({'phone':_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9a')],'messageId':_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0x9e')],'body':_0x522af3[_0x5d0d('0x5f')]['body'],'WhatsappAccountId':_0x14e2e9[_0x5d0d('0x59')]['id'],'WhatsappInteractionId':_0x4510d4['id'],'direction':'in','ContactId':_0x4510d4['ContactId'],'AttachmentId':_0x522af3[_0x5d0d('0x5f')][_0x5d0d('0xb8')]});})['then'](function(_0x21b575){_0x522af3[_0x5d0d('0x27')]=_0x21b575;if(!_0x522af3[_0x5d0d('0xb1')]['UserId'])return;return db[_0x5d0d('0x79')][_0x5d0d('0x5d')]({'attributes':['id','name'],'where':{'id':_0x522af3[_0x5d0d('0xb1')][_0x5d0d('0xb9')]}});})[_0x5d0d('0x36')](function(_0x28cf14){if(_0x28cf14){_0x522af3[_0x5d0d('0x8f')][_0x5d0d('0xba')]({'id':0x0,'priority':0x0,'app':_0x5d0d('0xbb'),'appdata':_0x28cf14[_0x5d0d('0x3b')]+','+(_0x522af3[_0x5d0d('0x87')][_0x5d0d('0xbc')]||0xa),'interval':_0x5d0d('0xb7')});}if(!_0x522af3[_0x5d0d('0xb1')][_0x5d0d('0xbd')])return;return db['WhatsappQueue'][_0x5d0d('0x5d')]({'attributes':['id',_0x5d0d('0x3b')],'where':{'id':_0x522af3['interaction'][_0x5d0d('0xbd')]}});})[_0x5d0d('0x36')](function(_0x582b64){if(_0x582b64){_0x522af3['applications'][_0x5d0d('0xba')]({'id':0x0,'priority':0x1,'app':_0x5d0d('0xbe'),'appdata':_0x582b64[_0x5d0d('0x3b')]+','+(_0x522af3['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5d0d('0xbf'),_0x5d0d('0xc0'),_0x522af3);})[_0x5d0d('0x36')](function(_0x4e0dd9){if(_0x4e0dd9){var _0x298e0d=0xc8;var _0x2701a9=_0x5d0d('0xc1');logger[_0x5d0d('0x21')](_0x5d0d('0xc2'),_0x2701a9,_0x298e0d,_0x5d0d('0xc3'));logger[_0x5d0d('0x24')](_0x5d0d('0xc4'),_0x2701a9,_0x298e0d,_0x5d0d('0xc3'),JSON[_0x5d0d('0x25')](_0x4e0dd9));if(_0x522af3[_0x5d0d('0x87')][_0x5d0d('0x42')]===_0x5d0d('0x99')){return _0x2a43b1[_0x5d0d('0x2b')](_0x298e0d)[_0x5d0d('0x31')]('Content-Type',_0x5d0d('0xc5'))['send'](_0x5d0d('0xc6'));}else{return _0x2a43b1[_0x5d0d('0x2b')](_0x298e0d)[_0x5d0d('0x82')](_0x4e0dd9);}}});})[_0x5d0d('0x29')](handleError(_0x2a43b1,null));};exports[_0x5d0d('0x3c')]=function(_0x2d8e95,_0x3c800b,_0x2cfe6d){var _0x175411,_0xdcc7ee,_0x1934af;if(_[_0x5d0d('0xa1')](_0x2d8e95[_0x5d0d('0x5f')][_0x5d0d('0x5f')])||_0x2d8e95[_0x5d0d('0x5f')][_0x5d0d('0x5f')]===''){throw new db[(_0x5d0d('0x91'))][(_0x5d0d('0x92'))](_0x5d0d('0xa3'));}if(_['isNil'](_0x2d8e95[_0x5d0d('0x5f')]['to'])){throw new db[(_0x5d0d('0x91'))][(_0x5d0d('0x92'))](_0x5d0d('0xc7'));}_0x175411=_0x2d8e95[_0x5d0d('0x5f')]['to'];return db['WhatsappAccount'][_0x5d0d('0x5d')]({'where':{'id':_0x2d8e95[_0x5d0d('0x59')]['id']},'include':[{'model':db[_0x5d0d('0xa8')],'as':_0x5d0d('0xc8'),'include':[{'model':db[_0x5d0d('0xa9')],'as':_0x5d0d('0xaa'),'where':{'mobile':_0x175411},'limit':0x1,'order':[[_0x5d0d('0x95'),_0x5d0d('0xab')]]}]}]})['then'](handleEntityNotFound(_0x3c800b,null))[_0x5d0d('0x36')](function(_0x3f9cff){if(_0x3f9cff&&_0x3f9cff[_0x5d0d('0xc8')]){_0xdcc7ee=_0x3f9cff[_0x5d0d('0x37')]({'plain':!![]});if(_0xdcc7ee[_0x5d0d('0xc8')]&&_0xdcc7ee[_0x5d0d('0xc8')][_0x5d0d('0xaa')][_0x5d0d('0x4b')]){return _0xdcc7ee[_0x5d0d('0xc8')][_0x5d0d('0xaa')][0x0];}return db[_0x5d0d('0xa9')][_0x5d0d('0x5e')](_['defaults'](_0x2d8e95[_0x5d0d('0x5f')],{'firstName':_0x175411,'mobile':_0x175411,'phone':_0x175411,'ListId':_0xdcc7ee[_0x5d0d('0x97')]}));}})['then'](handleEntityNotFound(_0x3c800b,null))[_0x5d0d('0x36')](function(_0x2a1f5f){if(_0x2a1f5f){_0x1934af=_0x2a1f5f;return db[_0x5d0d('0xb0')][_0x5d0d('0x5d')]({'where':{'ContactId':_0x1934af['id'],'closed':![],'WhatsappAccountId':_0xdcc7ee['id']}})[_0x5d0d('0x36')](function(_0x47369b){if(_0x47369b){return[_0x47369b,![]];}return db[_0x5d0d('0xb0')][_0x5d0d('0x5e')]({'UserId':_0x2d8e95[_0x5d0d('0x60')]['id'],'ContactId':_0x1934af['id'],'WhatsappAccountId':_0xdcc7ee['id'],'phone':_0x175411,'firstMsgDirection':_0x5d0d('0xc9'),'Messages':[_['merge'](_0x2d8e95[_0x5d0d('0x5f')],{'read':![],'body':_0x2d8e95[_0x5d0d('0x5f')][_0x5d0d('0x5f')],'phone':_0x175411,'WhatsappAccountId':_0xdcc7ee['id'],'UserId':_0x2d8e95[_0x5d0d('0x60')]['id'],'ContactId':_0x1934af['id']})]},{'include':[{'model':db[_0x5d0d('0x8c')],'as':'Messages'}]})[_0x5d0d('0x36')](function(_0xf9daa6){return[_0xf9daa6,!![]];});});}})[_0x5d0d('0x72')](function(_0x457c27,_0x5a3486){if(_0x5a3486){return _0x457c27;}return db[_0x5d0d('0x8c')][_0x5d0d('0x5e')](_[_0x5d0d('0x53')](_0x2d8e95[_0x5d0d('0x5f')],{'read':![],'body':_0x2d8e95[_0x5d0d('0x5f')]['body'],'phone':_0x175411,'WhatsappAccountId':_0xdcc7ee['id'],'WhatsappInteractionId':_0x457c27['id'],'UserId':_0x2d8e95[_0x5d0d('0x60')]['id'],'ContactId':_0x1934af['id']}))['then'](function(_0x56e9f1){_0x457c27['dataValues'][_0x5d0d('0xca')]=[];_0x457c27[_0x5d0d('0xcb')][_0x5d0d('0xca')][_0x5d0d('0xb4')](_0x56e9f1['dataValues']);return _0x457c27;});})['then'](respondWithResult(_0x3c800b,null))['catch'](handleError(_0x3c800b,null));}; \ No newline at end of file +var _0x56bd=['isNil','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','CmList','CmContact','Contacts','list','WhatsappInteraction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','interaction','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','options','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappAccounts','UserProfileSection','userProfileId','body','addDisposition','WhatsappAccountId','Disposition','findOne','include','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x56bd,0xe9));var _0xd56b=function(_0x3da10e,_0x3527d4){_0x3da10e=_0x3da10e-0x0;var _0x3b5ad7=_0x56bd[_0x3da10e];return _0x3b5ad7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd56b('0x0'));var zipdir=require(_0xd56b('0x1'));var jsonpatch=require(_0xd56b('0x2'));var rp=require('request-promise');var moment=require(_0xd56b('0x3'));var BPromise=require(_0xd56b('0x4'));var Mustache=require(_0xd56b('0x5'));var util=require(_0xd56b('0x6'));var path=require('path');var sox=require(_0xd56b('0x7'));var csv=require(_0xd56b('0x8'));var ejs=require(_0xd56b('0x9'));var fs=require('fs');var fs_extra=require(_0xd56b('0xa'));var _=require(_0xd56b('0xb'));var squel=require(_0xd56b('0xc'));var crypto=require(_0xd56b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd56b('0xe'));var toCsv=require(_0xd56b('0x8'));var querystring=require(_0xd56b('0xf'));var Papa=require(_0xd56b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd56b('0x11'));var as=require(_0xd56b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd56b('0x13'))(_0xd56b('0x14'));var utils=require(_0xd56b('0x15'));var config=require(_0xd56b('0x16'));var licenseUtil=require(_0xd56b('0x17'));var db=require(_0xd56b('0x18'))['db'];config[_0xd56b('0x19')]=_[_0xd56b('0x1a')](config[_0xd56b('0x19')],{'host':_0xd56b('0x1b'),'port':0x18eb});var socket=require(_0xd56b('0x1c'))(new Redis(config[_0xd56b('0x19')]));require(_0xd56b('0x1d'))[_0xd56b('0x1e')](socket);var jayson=require(_0xd56b('0x1f'));var client=jayson['client'][_0xd56b('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5a2886,_0x174413,_0x27aeee,_0x3f8775){return new BPromise(function(_0x1dbdc6,_0x209442){var _0x472e7e=_0x3f8775||client;return _0x472e7e[_0xd56b('0x21')](_0x5a2886,_0x27aeee)[_0xd56b('0x22')](function(_0x3f1f40){logger[_0xd56b('0x23')](_0xd56b('0x24'),_0x174413,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x174413,_0xd56b('0x25'),JSON[_0xd56b('0x26')](_0x3f1f40));if(_0x3f1f40[_0xd56b('0x27')]){if(_0x3f1f40[_0xd56b('0x27')][_0xd56b('0x28')]===0x1f4){logger[_0xd56b('0x27')](_0xd56b('0x24'),_0x174413,_0x3f1f40['error'][_0xd56b('0x29')]);return _0x209442(_0x3f1f40[_0xd56b('0x27')][_0xd56b('0x29')]);}logger[_0xd56b('0x27')](_0xd56b('0x24'),_0x174413,_0x3f1f40[_0xd56b('0x27')]['message']);return _0x1dbdc6(_0x3f1f40['error'][_0xd56b('0x29')]);}else{logger[_0xd56b('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x174413,_0xd56b('0x25'));_0x1dbdc6(_0x3f1f40['result'][_0xd56b('0x29')]);}})['catch'](function(_0xc9027d){logger[_0xd56b('0x27')](_0xd56b('0x24'),_0x174413,_0xc9027d);_0x209442(_0xc9027d);});});}function respondWithStatusCode(_0x5ab429,_0x42e907){_0x42e907=_0x42e907||0xcc;return function(_0x1a2f0c){if(_0x1a2f0c){return _0x5ab429[_0xd56b('0x2a')](_0x42e907);}return _0x5ab429[_0xd56b('0x2b')](_0x42e907)[_0xd56b('0x2c')]();};}function respondWithResult(_0x446c8a,_0x3c9730){_0x3c9730=_0x3c9730||0xc8;return function(_0x5c0f33){if(_0x5c0f33){return _0x446c8a['status'](_0x3c9730)[_0xd56b('0x2d')](_0x5c0f33);}};}function respondWithFilteredResult(_0x4393a9,_0x241e95){return function(_0x171ca5){if(_0x171ca5){var _0x45a45d=typeof _0x241e95[_0xd56b('0x2e')]===_0xd56b('0x2f')&&typeof _0x241e95[_0xd56b('0x30')]===_0xd56b('0x2f');var _0x65fb97=_0x171ca5[_0xd56b('0x31')];var _0x8737b4=_0x45a45d?0x0:_0x241e95['offset'];var _0x59674a=_0x45a45d?_0x171ca5[_0xd56b('0x31')]:_0x241e95['offset']+_0x241e95['limit'];var _0x3d18b6;if(_0x59674a>=_0x65fb97){_0x59674a=_0x65fb97;_0x3d18b6=0xc8;}else{_0x3d18b6=0xce;}_0x4393a9[_0xd56b('0x2b')](_0x3d18b6);return _0x4393a9[_0xd56b('0x32')](_0xd56b('0x33'),_0x8737b4+'-'+_0x59674a+'/'+_0x65fb97)[_0xd56b('0x2d')](_0x171ca5);}return null;};}function patchUpdates(_0x3d9d62){return function(_0x13900e){try{jsonpatch[_0xd56b('0x34')](_0x13900e,_0x3d9d62,!![]);}catch(_0x53f4d3){return BPromise[_0xd56b('0x35')](_0x53f4d3);}return _0x13900e['save']();};}function saveUpdates(_0x1b30aa,_0x333102){return function(_0x38c3a4){if(_0x38c3a4){return _0x38c3a4[_0xd56b('0x36')](_0x1b30aa)[_0xd56b('0x22')](function(_0x4d8815){return _0x4d8815;});}return null;};}function removeEntity(_0xa84b74,_0x311182){return function(_0x59cd61){if(_0x59cd61){return _0x59cd61[_0xd56b('0x37')]()[_0xd56b('0x22')](function(){var _0x56be53=_0x59cd61['get']({'plain':!![]});var _0x308ff5='WhatsappAccounts';return db[_0xd56b('0x38')][_0xd56b('0x37')]({'where':{'type':_0x308ff5,'resourceId':_0x56be53['id']}})[_0xd56b('0x22')](function(){return _0x59cd61;});})[_0xd56b('0x22')](function(){_0xa84b74[_0xd56b('0x2b')](0xcc)[_0xd56b('0x2c')]();});}};}function handleEntityNotFound(_0x4b6c00,_0xfc0c9d){return function(_0x3a142f){if(!_0x3a142f){_0x4b6c00['sendStatus'](0x194);}return _0x3a142f;};}function handleError(_0x150d00,_0x8d3d6b){_0x8d3d6b=_0x8d3d6b||0x1f4;return function(_0x2106e6){logger[_0xd56b('0x27')](_0x2106e6[_0xd56b('0x39')]);if(_0x2106e6[_0xd56b('0x3a')]){delete _0x2106e6[_0xd56b('0x3a')];}_0x150d00['status'](_0x8d3d6b)[_0xd56b('0x3b')](_0x2106e6);};}exports[_0xd56b('0x3c')]=function(_0x332e38,_0x45a9ae){var _0x5d0102={'include':[{'model':db[_0xd56b('0x3d')],'as':_0xd56b('0x3e')}]},_0x179bb8={},_0x10f4dc={'count':0x0,'rows':[]};var _0x626006=_[_0xd56b('0x3f')](db[_0xd56b('0x40')][_0xd56b('0x41')],function(_0x436c9e){return{'name':_0x436c9e[_0xd56b('0x42')],'type':_0x436c9e[_0xd56b('0x43')][_0xd56b('0x44')]};});_0x179bb8[_0xd56b('0x45')]=_[_0xd56b('0x3f')](_0x626006,_0xd56b('0x3a'));_0x179bb8[_0xd56b('0x46')]=_['keys'](_0x332e38['query']);_0x179bb8[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x179bb8[_0xd56b('0x45')],_0x179bb8['query']);_0x5d0102[_0xd56b('0x49')]=_['intersection'](_0x179bb8[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x332e38[_0xd56b('0x46')][_0xd56b('0x4a')]));_0x5d0102[_0xd56b('0x49')]=_0x5d0102['attributes'][_0xd56b('0x4b')]?_0x5d0102['attributes']:_0x179bb8[_0xd56b('0x45')];if(!_0x332e38[_0xd56b('0x46')][_0xd56b('0x4c')](_0xd56b('0x4d'))){_0x5d0102[_0xd56b('0x30')]=qs['limit'](_0x332e38[_0xd56b('0x46')][_0xd56b('0x30')]);_0x5d0102['offset']=qs[_0xd56b('0x2e')](_0x332e38[_0xd56b('0x46')]['offset']);}_0x5d0102[_0xd56b('0x4e')]=qs[_0xd56b('0x4f')](_0x332e38[_0xd56b('0x46')][_0xd56b('0x4f')]);_0x5d0102[_0xd56b('0x50')]=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x332e38[_0xd56b('0x46')],_0x179bb8[_0xd56b('0x47')]),_0x626006);if(_0x332e38['query'][_0xd56b('0x52')]){_0x5d0102[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0x5d0102['where'],{'$or':_[_0xd56b('0x3f')](_0x626006,function(_0x5a3f62){if(_0x5a3f62['type']!==_0xd56b('0x54')){var _0x1f1cfd={};_0x1f1cfd[_0x5a3f62[_0xd56b('0x3a')]]={'$like':'%'+_0x332e38[_0xd56b('0x46')][_0xd56b('0x52')]+'%'};return _0x1f1cfd;}})});}_0x5d0102=_[_0xd56b('0x53')]({},_0x5d0102,_0x332e38['options']);var _0x3e587a={'where':_0x5d0102[_0xd56b('0x50')]};return db[_0xd56b('0x40')]['count'](_0x3e587a)[_0xd56b('0x22')](function(_0xdd906b){_0x10f4dc[_0xd56b('0x31')]=_0xdd906b;if(_0x332e38[_0xd56b('0x46')][_0xd56b('0x55')]){_0x5d0102['include']=[{'all':!![]}];}return db[_0xd56b('0x40')][_0xd56b('0x56')](_0x5d0102);})[_0xd56b('0x22')](function(_0x26ab10){_0x10f4dc[_0xd56b('0x57')]=_0x26ab10;return _0x10f4dc;})[_0xd56b('0x22')](respondWithFilteredResult(_0x45a9ae,_0x5d0102))['catch'](handleError(_0x45a9ae,null));};exports[_0xd56b('0x58')]=function(_0x3dd378,_0x2e7b29){var _0x4b31e6={'raw':![],'where':{'id':_0x3dd378[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0x3d')],'as':_0xd56b('0x3e')}]},_0x34dc97={};_0x34dc97[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db[_0xd56b('0x40')][_0xd56b('0x41')]);_0x34dc97[_0xd56b('0x46')]=_['keys'](_0x3dd378[_0xd56b('0x46')]);_0x34dc97[_0xd56b('0x47')]=_['intersection'](_0x34dc97[_0xd56b('0x45')],_0x34dc97[_0xd56b('0x46')]);_0x4b31e6['attributes']=_[_0xd56b('0x48')](_0x34dc97['model'],qs[_0xd56b('0x4a')](_0x3dd378[_0xd56b('0x46')]['fields']));_0x4b31e6[_0xd56b('0x49')]=_0x4b31e6['attributes'][_0xd56b('0x4b')]?_0x4b31e6['attributes']:_0x34dc97['model'];if(_0x3dd378[_0xd56b('0x46')][_0xd56b('0x55')]){_0x4b31e6['include']=[{'all':!![]}];}_0x4b31e6=_[_0xd56b('0x53')]({},_0x4b31e6,_0x3dd378[_0xd56b('0x5b')]);return db['WhatsappAccount'][_0xd56b('0x5c')](_0x4b31e6)[_0xd56b('0x22')](handleEntityNotFound(_0x2e7b29,null))['then'](respondWithResult(_0x2e7b29,null))[_0xd56b('0x5d')](handleError(_0x2e7b29,null));};exports[_0xd56b('0x5e')]=function(_0x44a165,_0x162a58){return db['WhatsappAccount'][_0xd56b('0x5e')](_0x44a165['body'],{})[_0xd56b('0x22')](function(_0xcee0b9){var _0x484a5b=_0x44a165['user'][_0xd56b('0x5f')]({'plain':!![]});if(!_0x484a5b)throw new Error(_0xd56b('0x60'));if(_0x484a5b['role']===_0xd56b('0x61')){var _0x1e5250=_0xcee0b9['get']({'plain':!![]});var _0x3e6341=_0xd56b('0x62');return db[_0xd56b('0x63')][_0xd56b('0x5c')]({'where':{'name':_0x3e6341,'userProfileId':_0x484a5b[_0xd56b('0x64')]},'raw':!![]})[_0xd56b('0x22')](function(_0x5db063){if(_0x5db063&&_0x5db063['autoAssociation']===0x0){return db[_0xd56b('0x38')][_0xd56b('0x5e')]({'name':_0x1e5250[_0xd56b('0x3a')],'resourceId':_0x1e5250['id'],'type':_0x5db063[_0xd56b('0x3a')],'sectionId':_0x5db063['id']},{})[_0xd56b('0x22')](function(){return _0xcee0b9;});}else{return _0xcee0b9;}})[_0xd56b('0x5d')](function(_0x35df51){logger[_0xd56b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35df51);throw _0x35df51;});}return _0xcee0b9;})[_0xd56b('0x22')](respondWithResult(_0x162a58,0xc9))[_0xd56b('0x5d')](handleError(_0x162a58,null));};exports['update']=function(_0x2c1b7b,_0x3f993f){if(_0x2c1b7b[_0xd56b('0x65')]['id']){delete _0x2c1b7b[_0xd56b('0x65')]['id'];}return db[_0xd56b('0x40')]['find']({'where':{'id':_0x2c1b7b[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0x3d')],'as':_0xd56b('0x3e')}]})['then'](handleEntityNotFound(_0x3f993f,null))['then'](saveUpdates(_0x2c1b7b[_0xd56b('0x65')],null))['then'](respondWithResult(_0x3f993f,null))[_0xd56b('0x5d')](handleError(_0x3f993f,null));};exports[_0xd56b('0x37')]=function(_0x5c0b21,_0x2474e7){return db['WhatsappAccount']['find']({'where':{'id':_0x5c0b21[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x2474e7,null))[_0xd56b('0x22')](removeEntity(_0x2474e7,null))[_0xd56b('0x5d')](handleError(_0x2474e7,null));};exports['describe']=function(_0x10090b,_0x247a68){return db[_0xd56b('0x40')]['describe']()[_0xd56b('0x22')](respondWithResult(_0x247a68,null))[_0xd56b('0x5d')](handleError(_0x247a68,null));};exports[_0xd56b('0x66')]=function(_0xbb4694,_0x586a80,_0x2ee422){if(_0xbb4694['body']['id']){delete _0xbb4694[_0xd56b('0x65')]['id'];}return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0xbb4694['params']['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x586a80,null))[_0xd56b('0x22')](function(_0x47b4d7){if(_0x47b4d7){_0xbb4694['body'][_0xd56b('0x67')]=_0x47b4d7['id'];return db[_0xd56b('0x68')][_0xd56b('0x5e')](_0xbb4694[_0xd56b('0x65')]);}})[_0xd56b('0x22')](respondWithResult(_0x586a80,null))['catch'](handleError(_0x586a80,null));};exports['getDispositions']=function(_0x28bbd0,_0xebcc21,_0x42b032){var _0x36d1b8={'raw':![],'where':{}};var _0x5e6edc={};var _0x5954b1={'count':0x0,'rows':[]};return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x28bbd0[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0xebcc21,null))[_0xd56b('0x22')](function(_0x47a6ee){if(_0x47a6ee){_0x5e6edc[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db[_0xd56b('0x68')]['rawAttributes']);_0x5e6edc[_0xd56b('0x46')]=_['keys'](_0x28bbd0['query']);_0x5e6edc[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x5e6edc[_0xd56b('0x45')],_0x5e6edc[_0xd56b('0x46')]);_0x36d1b8[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0x5e6edc['model'],qs[_0xd56b('0x4a')](_0x28bbd0['query'][_0xd56b('0x4a')]));_0x36d1b8['attributes']=_0x36d1b8['attributes'][_0xd56b('0x4b')]?_0x36d1b8[_0xd56b('0x49')]:_0x5e6edc[_0xd56b('0x45')];if(!_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x4c')]('nolimit')){_0x36d1b8[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x28bbd0[_0xd56b('0x46')]['limit']);_0x36d1b8[_0xd56b('0x2e')]=qs['offset'](_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x2e')]);}_0x36d1b8[_0xd56b('0x4e')]=qs[_0xd56b('0x4f')](_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x4f')]);_0x36d1b8['where']=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x28bbd0['query'],_0x5e6edc[_0xd56b('0x47')]));_0x36d1b8[_0xd56b('0x50')][_0xd56b('0x67')]=_0x47a6ee['id'];if(_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x52')]){_0x36d1b8[_0xd56b('0x50')]=_['merge'](_0x36d1b8['where'],{'$or':_[_0xd56b('0x3f')](_0x36d1b8[_0xd56b('0x49')],function(_0x3a10f7){var _0x3e9b66={};_0x3e9b66[_0x3a10f7]={'$like':'%'+_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x52')]+'%'};return _0x3e9b66;})});}_0x36d1b8=_['merge']({},_0x36d1b8,_0x28bbd0['options']);return db[_0xd56b('0x68')]['count']({'where':_0x36d1b8['where']})[_0xd56b('0x22')](function(_0x3b9c38){_0x5954b1['count']=_0x3b9c38;if(_0x28bbd0[_0xd56b('0x46')][_0xd56b('0x55')]){_0x36d1b8[_0xd56b('0x6a')]=[{'all':!![]}];}return db[_0xd56b('0x68')]['findAll'](_0x36d1b8);})[_0xd56b('0x22')](function(_0x406898){_0x5954b1[_0xd56b('0x57')]=_0x406898;return _0x5954b1;});}})[_0xd56b('0x22')](respondWithFilteredResult(_0xebcc21,_0x36d1b8))[_0xd56b('0x5d')](handleError(_0xebcc21,null));};exports[_0xd56b('0x6b')]=function(_0x1e8e05,_0x2b7080,_0x99f53b){return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0x1e8e05[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x2b7080,null))['then'](function(_0x13662e){if(_0x13662e){return _0x13662e[_0xd56b('0x6b')](_0x1e8e05[_0xd56b('0x46')][_0xd56b('0x6c')]);}})[_0xd56b('0x22')](respondWithStatusCode(_0x2b7080,null))[_0xd56b('0x5d')](handleError(_0x2b7080,null));};exports['addAnswer']=function(_0x13cec3,_0x10bc95,_0x3c945c){if(_0x13cec3[_0xd56b('0x65')]['id']){delete _0x13cec3[_0xd56b('0x65')]['id'];}return db['WhatsappAccount'][_0xd56b('0x5c')]({'where':{'id':_0x13cec3[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x10bc95,null))['then'](function(_0x95bc15){if(_0x95bc15){_0x13cec3['body'][_0xd56b('0x67')]=_0x95bc15['id'];return db[_0xd56b('0x6d')][_0xd56b('0x5e')](_0x13cec3['body']);}})[_0xd56b('0x22')](respondWithResult(_0x10bc95,null))['catch'](handleError(_0x10bc95,null));};exports[_0xd56b('0x6e')]=function(_0x1ca320,_0x5ea669,_0x2f5415){var _0x416eed={'raw':![],'where':{}};var _0x540e64={};var _0x1af619={'count':0x0,'rows':[]};return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x1ca320[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x5ea669,null))['then'](function(_0x11ac1a){if(_0x11ac1a){_0x540e64['model']=_[_0xd56b('0x5a')](db[_0xd56b('0x6d')][_0xd56b('0x41')]);_0x540e64['query']=_[_0xd56b('0x5a')](_0x1ca320[_0xd56b('0x46')]);_0x540e64[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x540e64['model'],_0x540e64[_0xd56b('0x46')]);_0x416eed[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0x540e64[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x1ca320['query'][_0xd56b('0x4a')]));_0x416eed[_0xd56b('0x49')]=_0x416eed['attributes'][_0xd56b('0x4b')]?_0x416eed[_0xd56b('0x49')]:_0x540e64['model'];if(!_0x1ca320['query'][_0xd56b('0x4c')](_0xd56b('0x4d'))){_0x416eed[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x1ca320[_0xd56b('0x46')][_0xd56b('0x30')]);_0x416eed[_0xd56b('0x2e')]=qs[_0xd56b('0x2e')](_0x1ca320[_0xd56b('0x46')]['offset']);}_0x416eed['order']=qs[_0xd56b('0x4f')](_0x1ca320[_0xd56b('0x46')]['sort']);_0x416eed[_0xd56b('0x50')]=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x1ca320[_0xd56b('0x46')],_0x540e64[_0xd56b('0x47')]));_0x416eed[_0xd56b('0x50')][_0xd56b('0x67')]=_0x11ac1a['id'];if(_0x1ca320['query'][_0xd56b('0x52')]){_0x416eed[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0x416eed[_0xd56b('0x50')],{'$or':_[_0xd56b('0x3f')](_0x416eed[_0xd56b('0x49')],function(_0x5c7e0d){var _0x2b5711={};_0x2b5711[_0x5c7e0d]={'$like':'%'+_0x1ca320[_0xd56b('0x46')][_0xd56b('0x52')]+'%'};return _0x2b5711;})});}_0x416eed=_[_0xd56b('0x53')]({},_0x416eed,_0x1ca320[_0xd56b('0x5b')]);return db[_0xd56b('0x6d')][_0xd56b('0x31')]({'where':_0x416eed['where']})[_0xd56b('0x22')](function(_0x366576){_0x1af619[_0xd56b('0x31')]=_0x366576;if(_0x1ca320[_0xd56b('0x46')]['includeAll']){_0x416eed[_0xd56b('0x6a')]=[{'all':!![]}];}return db[_0xd56b('0x6d')]['findAll'](_0x416eed);})[_0xd56b('0x22')](function(_0x5a1cd1){_0x1af619[_0xd56b('0x57')]=_0x5a1cd1;return _0x1af619;});}})[_0xd56b('0x22')](respondWithFilteredResult(_0x5ea669,_0x416eed))[_0xd56b('0x5d')](handleError(_0x5ea669,null));};exports[_0xd56b('0x6f')]=function(_0x541b25,_0xd770f2,_0x1384be){return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0x541b25[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0xd770f2,null))[_0xd56b('0x22')](function(_0x36cffb){if(_0x36cffb){return _0x36cffb['removeAnswers'](_0x541b25[_0xd56b('0x46')]['ids']);}})[_0xd56b('0x22')](respondWithStatusCode(_0xd770f2,null))[_0xd56b('0x5d')](handleError(_0xd770f2,null));};exports[_0xd56b('0x70')]=function(_0x5cc7e9,_0x4b5ca0,_0x5c30de){return db['WhatsappAccount'][_0xd56b('0x5c')]({'where':{'id':_0x5cc7e9[_0xd56b('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b5ca0,null))[_0xd56b('0x22')](function(_0xf332d){if(_0xf332d){return _0xf332d['addAgents'](_0x5cc7e9[_0xd56b('0x65')][_0xd56b('0x6c')],_[_0xd56b('0x71')](_0x5cc7e9[_0xd56b('0x65')],['ids','id'])||{})[_0xd56b('0x72')](function(_0xa5b5f7){for(var _0x43e7bf=0x0;_0x43e7bf<_0x5cc7e9[_0xd56b('0x65')]['ids'][_0xd56b('0x4b')];_0x43e7bf+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x5cc7e9['body'][_0xd56b('0x6c')][_0x43e7bf]),'WhatsappAccountId':Number(_0x5cc7e9[_0xd56b('0x59')]['id'])});}return _0xa5b5f7;});}})[_0xd56b('0x22')](respondWithResult(_0x4b5ca0,null))[_0xd56b('0x5d')](handleError(_0x4b5ca0,null));};exports[_0xd56b('0x73')]=function(_0x2aee69,_0x27872f,_0x3fc0f9){return db[_0xd56b('0x40')][_0xd56b('0x5c')]({'where':{'id':_0x2aee69[_0xd56b('0x59')]['id']}})['then'](handleEntityNotFound(_0x27872f,null))[_0xd56b('0x22')](function(_0x40eaa5){if(_0x40eaa5){return _0x40eaa5[_0xd56b('0x73')](_0x2aee69['query'][_0xd56b('0x6c')])[_0xd56b('0x22')](function(){if(_[_0xd56b('0x74')](_0x2aee69['query'][_0xd56b('0x6c')])){for(var _0x4814b9=0x0;_0x4814b9<_0x2aee69[_0xd56b('0x46')][_0xd56b('0x6c')]['length'];_0x4814b9+=0x1){socket['emit'](_0xd56b('0x75'),{'UserId':Number(_0x2aee69[_0xd56b('0x46')]['ids'][_0x4814b9]),'WhatsappAccountId':Number(_0x2aee69['params']['id'])});}}else{socket[_0xd56b('0x76')](_0xd56b('0x75'),{'UserId':Number(_0x2aee69[_0xd56b('0x46')]['ids']),'WhatsappAccountId':Number(_0x2aee69[_0xd56b('0x59')]['id'])});}});}})[_0xd56b('0x22')](respondWithStatusCode(_0x27872f,null))[_0xd56b('0x5d')](handleError(_0x27872f,null));};exports[_0xd56b('0x77')]=function(_0x5b426e,_0x2f1f7b,_0x2ccdd5){var _0xad270d={};var _0x2820d7={};var _0x3a1447;var _0x13a5f9;return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x5b426e['params']['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0x2f1f7b,null))[_0xd56b('0x22')](function(_0x1fdb97){if(_0x1fdb97){_0x3a1447=_0x1fdb97;_0x2820d7[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db['User'][_0xd56b('0x41')]);_0x2820d7[_0xd56b('0x46')]=_[_0xd56b('0x5a')](_0x5b426e[_0xd56b('0x46')]);_0x2820d7[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0x2820d7[_0xd56b('0x45')],_0x2820d7['query']);_0xad270d[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0x2820d7[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x4a')]));_0xad270d[_0xd56b('0x49')]=_0xad270d['attributes']['length']?_0xad270d[_0xd56b('0x49')]:_0x2820d7[_0xd56b('0x45')];_0xad270d[_0xd56b('0x4e')]=qs['sort'](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x4f')]);_0xad270d['where']=qs[_0xd56b('0x47')](_[_0xd56b('0x51')](_0x5b426e['query'],_0x2820d7[_0xd56b('0x47')]));if(_0x5b426e['query'][_0xd56b('0x52')]){_0xad270d[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0xad270d[_0xd56b('0x50')],{'$or':_[_0xd56b('0x3f')](_0xad270d[_0xd56b('0x49')],function(_0x459288){var _0x238247={};_0x238247[_0x459288]={'$like':'%'+_0x5b426e[_0xd56b('0x46')]['filter']+'%'};return _0x238247;})});}_0xad270d=_[_0xd56b('0x53')]({},_0xad270d,_0x5b426e[_0xd56b('0x5b')]);return _0x3a1447[_0xd56b('0x77')](_0xad270d);}})['then'](function(_0x5ec2b3){if(_0x5ec2b3){_0x13a5f9=_0x5ec2b3[_0xd56b('0x4b')];if(!_0x5b426e['query'][_0xd56b('0x4c')]('nolimit')){_0xad270d[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x30')]);_0xad270d[_0xd56b('0x2e')]=qs[_0xd56b('0x2e')](_0x5b426e[_0xd56b('0x46')][_0xd56b('0x2e')]);}return _0x3a1447[_0xd56b('0x77')](_0xad270d);}})['then'](function(_0x137316){if(_0x137316){return _0x137316?{'count':_0x13a5f9,'rows':_0x137316}:null;}})[_0xd56b('0x22')](respondWithResult(_0x2f1f7b,null))[_0xd56b('0x5d')](handleError(_0x2f1f7b,null));};exports[_0xd56b('0x78')]=function(_0xe2266f,_0x1e32a4){var _0x801287=_0xe2266f[_0xd56b('0x59')]['id'];var _0x57728d=_0xe2266f[_0xd56b('0x65')];var _0x1daa7a=0xc8;var _0x203ad6=null;return db[_0xd56b('0x79')][_0xd56b('0x7a')]({'isolationLevel':db[_0xd56b('0x79')][_0xd56b('0x7b')][_0xd56b('0x7c')][_0xd56b('0x7d')]},function(_0xe1d2dc){return db[_0xd56b('0x40')][_0xd56b('0x69')]({'where':{'id':_0x801287},'transaction':_0xe1d2dc})[_0xd56b('0x22')](function(_0x1649ea){if(_0x1649ea){return db[_0xd56b('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x801287},'transaction':_0xe1d2dc})[_0xd56b('0x22')](function(){var _0x1e3f9a=_[_0xd56b('0x3f')](_0x57728d,function(_0x3747a4){_0x3747a4[_0xd56b('0x67')]=_0x801287;return _0x3747a4;});return db[_0xd56b('0x7e')]['bulkCreate'](_0x1e3f9a,{'transaction':_0xe1d2dc});});}else{_0x1daa7a=0x194;_0x203ad6=[];}});})[_0xd56b('0x22')](function(){if(_0x1daa7a!==0x194){return db[_0xd56b('0x7e')][_0xd56b('0x7f')]({'where':{'WhatsappAccountId':_0x801287},'order':_0xd56b('0x80')})[_0xd56b('0x22')](function(_0x1f0d6f){_0x203ad6=_0x1f0d6f;});}})[_0xd56b('0x5d')](function(_0x194da9){_0x1daa7a=0x1f4;logger[_0xd56b('0x27')](_0x194da9[_0xd56b('0x39')]);if(_0x194da9[_0xd56b('0x3a')]){delete _0x194da9[_0xd56b('0x3a')];}_0x203ad6=_0x194da9;})['finally'](function(){if(_0x203ad6===null){_0x1e32a4[_0xd56b('0x2a')](_0x1daa7a);}else{if(_0x1daa7a===0x1f4){_0x1e32a4[_0xd56b('0x2b')](_0x1daa7a)[_0xd56b('0x3b')](_0x203ad6);}else{_0x1e32a4[_0xd56b('0x2b')](_0x1daa7a)[_0xd56b('0x2d')](_0x203ad6);}}});};exports[_0xd56b('0x81')]=function(_0x8a3cf2,_0xe0deb3,_0xfb5837){var _0x35560e={};var _0xd5bb3c={};var _0x554a25;var _0xe8e658;return db[_0xd56b('0x40')]['findOne']({'where':{'id':_0x8a3cf2[_0xd56b('0x59')]['id']}})[_0xd56b('0x22')](handleEntityNotFound(_0xe0deb3,null))[_0xd56b('0x22')](function(_0x4866ad){if(_0x4866ad){_0x554a25=_0x4866ad;_0xd5bb3c[_0xd56b('0x45')]=_[_0xd56b('0x5a')](db['WhatsappApplication'][_0xd56b('0x41')]);_0xd5bb3c[_0xd56b('0x46')]=_[_0xd56b('0x5a')](_0x8a3cf2[_0xd56b('0x46')]);_0xd5bb3c[_0xd56b('0x47')]=_[_0xd56b('0x48')](_0xd5bb3c['model'],_0xd5bb3c[_0xd56b('0x46')]);_0x35560e[_0xd56b('0x49')]=_[_0xd56b('0x48')](_0xd5bb3c[_0xd56b('0x45')],qs[_0xd56b('0x4a')](_0x8a3cf2[_0xd56b('0x46')][_0xd56b('0x4a')]));_0x35560e['attributes']=_0x35560e[_0xd56b('0x49')][_0xd56b('0x4b')]?_0x35560e[_0xd56b('0x49')]:_0xd5bb3c[_0xd56b('0x45')];_0x35560e['order']=qs[_0xd56b('0x4f')](_0x8a3cf2[_0xd56b('0x46')][_0xd56b('0x4f')]);_0x35560e[_0xd56b('0x50')]=qs['filters'](_[_0xd56b('0x51')](_0x8a3cf2[_0xd56b('0x46')],_0xd5bb3c[_0xd56b('0x47')]));if(_0x8a3cf2['query'][_0xd56b('0x52')]){_0x35560e[_0xd56b('0x50')]=_[_0xd56b('0x53')](_0x35560e[_0xd56b('0x50')],{'$or':_[_0xd56b('0x3f')](_0x35560e[_0xd56b('0x49')],function(_0x2d0d30){var _0x3ee637={};_0x3ee637[_0x2d0d30]={'$like':'%'+_0x8a3cf2['query'][_0xd56b('0x52')]+'%'};return _0x3ee637;})});}_0x35560e=_['merge']({},_0x35560e,_0x8a3cf2['options']);return _0x554a25[_0xd56b('0x81')](_0x35560e);}})['then'](function(_0x5a2114){if(_0x5a2114){_0xe8e658=_0x5a2114['length'];if(!_0x8a3cf2[_0xd56b('0x46')]['hasOwnProperty'](_0xd56b('0x4d'))){_0x35560e[_0xd56b('0x30')]=qs[_0xd56b('0x30')](_0x8a3cf2[_0xd56b('0x46')]['limit']);_0x35560e[_0xd56b('0x2e')]=qs[_0xd56b('0x2e')](_0x8a3cf2[_0xd56b('0x46')]['offset']);}return _0x554a25[_0xd56b('0x81')](_0x35560e);}})['then'](function(_0x4c987d){if(_0x4c987d){return _0x4c987d?{'count':_0xe8e658,'rows':_0x4c987d}:null;}})[_0xd56b('0x22')](respondWithResult(_0xe0deb3,null))[_0xd56b('0x5d')](handleError(_0xe0deb3,null));};exports[_0xd56b('0x82')]=function(_0x4af205,_0x7951d,_0x5b2bba){var _0x9e56d1={'channel':'whatsapp'};var _0x45455f=[];var _0x3d8bdc=[];var _0x82ce0={};return db['WhatsappAccount'][_0xd56b('0x5c')]({'where':{'id':_0x4af205[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0x7e')],'as':_0xd56b('0x83')}]})[_0xd56b('0x22')](handleEntityNotFound(_0x7951d,null))[_0xd56b('0x22')](function(_0x13a7e1){_0x9e56d1[_0xd56b('0x84')]=_0x13a7e1;if(_0x9e56d1['account']&&_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x43')]===_0xd56b('0x85')&&_0x4af205[_0xd56b('0x65')][_0xd56b('0x86')]){if(_0x4af205[_0xd56b('0x65')][_0xd56b('0x86')][_0xd56b('0x4b')]===0x0)return;if(_0x4af205['body'][_0xd56b('0x86')][0x0][_0xd56b('0x87')]!==_0xd56b('0x88'))return;return db[_0xd56b('0x89')][_0xd56b('0x36')]({'read':!![],'readAt':_0x4af205['body'][_0xd56b('0x86')][0x0][_0xd56b('0x8a')]},{'where':{'messageId':_0x4af205['body'][_0xd56b('0x86')][0x0][_0xd56b('0x8b')]},'individualHooks':!![]})[_0xd56b('0x22')](function(_0x32a5c0){return _0x7951d[_0xd56b('0x2b')](0xc8)[_0xd56b('0x2d')](_0x32a5c0);});}_0x9e56d1[_0xd56b('0x8c')]=_[_0xd56b('0x8d')](_0x13a7e1[_0xd56b('0x83')],[_0xd56b('0x80')],[_0xd56b('0x8e')]);if(_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x83')]){delete _0x9e56d1['account'][_0xd56b('0x83')];}return db['CmContact'][_0xd56b('0x8f')]()[_0xd56b('0x22')](function(_0x96c797){if(!_0x96c797){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0x92'));}_0x45455f=_['difference'](_[_0xd56b('0x5a')](_0x96c797),[_0xd56b('0x93'),_0xd56b('0x94')]);_0x3d8bdc=_[_0xd56b('0x95')](_[_0xd56b('0x5a')](_0x96c797),[_0xd56b('0x93'),_0xd56b('0x94'),_0xd56b('0x96'),_0xd56b('0x97')]);_0x9e56d1['body']={'mapKey':_0xd56b('0x98')};if(_0x9e56d1[_0xd56b('0x84')]&&_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x43')]===_0xd56b('0x99')){_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')]=_0x4af205[_0xd56b('0x65')][_0xd56b('0x9b')][_0xd56b('0x9c')](_0xd56b('0x9d'),'');_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x65')]=_0x4af205[_0xd56b('0x65')]['Body'];_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9e')]=_0x4af205['body'][_0xd56b('0x9f')];}if(_0x9e56d1[_0xd56b('0x84')]&&_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x43')]===_0xd56b('0x85')){_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')]=_0x4af205[_0xd56b('0x65')][_0xd56b('0xa0')][0x0][_0xd56b('0x9a')];_0x9e56d1['body'][_0xd56b('0x65')]=_0x4af205['body'][_0xd56b('0xa0')][0x0]['message'][_0xd56b('0x65')];_0x9e56d1[_0xd56b('0x65')]['messageId']=_0x4af205['body'][_0xd56b('0xa0')][0x0][_0xd56b('0x8b')];}if(_0x9e56d1['body']['id']){delete _0x9e56d1[_0xd56b('0x65')]['id'];}if(_[_0xd56b('0xa1')](_0x9e56d1[_0xd56b('0x65')]['from'])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xa2'));}if(_['isNil'](_0x9e56d1['body'][_0xd56b('0x65')])||_0x9e56d1[_0xd56b('0x65')]['body']===''){throw new db[(_0xd56b('0x90'))]['ValidationError'](_0xd56b('0xa3'));}if(_['isNil'](_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xa4')])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xa5')+_0x3d8bdc);}if(!_['includes'](_0x3d8bdc,_0x9e56d1['body']['mapKey'])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xa6')+_0x3d8bdc);}_0x82ce0[_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xa4')]]=_0x9e56d1['body'][_0xd56b('0x9a')];return db[_0xd56b('0xa7')]['find']({'where':{'id':_0x9e56d1[_0xd56b('0x84')][_0xd56b('0x97')]},'include':[{'model':db[_0xd56b('0xa8')],'as':_0xd56b('0xa9'),'where':_0x82ce0,'limit':0x1,'order':[[_0xd56b('0x94'),'DESC']]}]});})[_0xd56b('0x22')](handleEntityNotFound(_0x7951d,null))[_0xd56b('0x22')](function(_0x184569){if(_0x184569){_0x9e56d1[_0xd56b('0xaa')]=_[_0xd56b('0x71')](_0x184569,[_0xd56b('0xa9')]);if(_0x184569[_0xd56b('0xa9')][_0xd56b('0x4b')]){return _0x184569['Contacts'][0x0];}var _0x1f22ec=_[_0xd56b('0x1a')](_0x9e56d1[_0xd56b('0x65')],{'firstName':_0x9e56d1['body'][_0xd56b('0x9a')],'ListId':_0x184569['id']});_0x1f22ec[_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xa4')]]=_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')];return db[_0xd56b('0xa8')][_0xd56b('0x5e')](_0x1f22ec,{'fields':_0x45455f,'raw':!![]});}})[_0xd56b('0x22')](handleEntityNotFound(_0x7951d,null))['then'](function(_0x3396ae){if(_0x3396ae){_0x9e56d1['contact']=_0x3396ae;var _0x1b2215={'ContactId':_0x3396ae['id'],'phone':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')],'WhatsappAccountId':_0x4af205['params']['id']};var _0x53352c={'ContactId':_0x3396ae['id'],'WhatsappAccountId':_0x4af205[_0xd56b('0x59')]['id'],'closed':![]};return db[_0xd56b('0xab')][_0xd56b('0x5c')]({'where':_0x53352c})[_0xd56b('0x22')](function(_0x4f1502){if(_0x4f1502){return[_0x4f1502,![]];}return db[_0xd56b('0xab')][_0xd56b('0x5e')](_0x1b2215)['then'](function(_0x44e9b5){return[_0x44e9b5,!![]];});});}})['spread'](function(_0xb43fcf,_0x577da5){_0x9e56d1['interaction']=_0xb43fcf['get']({'plain':!![]});_0x9e56d1['interaction'][_0xd56b('0xac')]=![];if(_0x577da5){if(_0x9e56d1[_0xd56b('0x84')]['autoclose']){_0x9e56d1['applications'][_0xd56b('0xad')]({'id':0x0,'priority':_0x9e56d1[_0xd56b('0x8c')]['length']+0x1,'app':'close','appdata':_0xd56b('0xae'),'interval':_0xd56b('0xaf')});}_0x9e56d1['interaction'][_0xd56b('0xac')]=!![];}return db['WhatsappMessage'][_0xd56b('0x5e')]({'phone':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9a')],'messageId':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x9e')],'body':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0x65')],'WhatsappAccountId':_0x4af205[_0xd56b('0x59')]['id'],'WhatsappInteractionId':_0xb43fcf['id'],'direction':'in','ContactId':_0xb43fcf[_0xd56b('0xb0')],'AttachmentId':_0x9e56d1[_0xd56b('0x65')][_0xd56b('0xb1')]});})[_0xd56b('0x22')](function(_0x40e7ae){_0x9e56d1[_0xd56b('0x29')]=_0x40e7ae;if(!_0x9e56d1['interaction'][_0xd56b('0xb2')])return;return db['User'][_0xd56b('0x5c')]({'attributes':['id',_0xd56b('0x3a')],'where':{'id':_0x9e56d1[_0xd56b('0xb3')][_0xd56b('0xb2')]}});})['then'](function(_0x56d8da){if(_0x56d8da){_0x9e56d1[_0xd56b('0x8c')][_0xd56b('0xb4')]({'id':0x0,'priority':0x0,'app':_0xd56b('0xb5'),'appdata':_0x56d8da['name']+','+(_0x9e56d1[_0xd56b('0x84')][_0xd56b('0xb6')]||0xa),'interval':_0xd56b('0xaf')});}if(!_0x9e56d1[_0xd56b('0xb3')][_0xd56b('0xb7')])return;return db[_0xd56b('0xb8')][_0xd56b('0x5c')]({'attributes':['id',_0xd56b('0x3a')],'where':{'id':_0x9e56d1[_0xd56b('0xb3')][_0xd56b('0xb7')]}});})[_0xd56b('0x22')](function(_0x524360){if(_0x524360){_0x9e56d1[_0xd56b('0x8c')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x524360[_0xd56b('0x3a')]+','+(_0x9e56d1[_0xd56b('0x84')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd56b('0xb9'),'startRouting',_0x9e56d1);})[_0xd56b('0x22')](function(_0x2dd1f9){if(_0x2dd1f9){var _0x382997=0xc8;var _0x103e91=_0xd56b('0xba');logger[_0xd56b('0x23')](_0xd56b('0xbb'),_0x103e91,_0x382997,_0xd56b('0xbc'));logger['debug'](_0xd56b('0xbd'),_0x103e91,_0x382997,'entity\x20found',JSON[_0xd56b('0x26')](_0x2dd1f9));if(_0x9e56d1['account']['type']===_0xd56b('0x99')){return _0x7951d[_0xd56b('0x2b')](_0x382997)[_0xd56b('0x32')](_0xd56b('0xbe'),_0xd56b('0xbf'))[_0xd56b('0x3b')]('\x0a');}else{return _0x7951d['status'](_0x382997)[_0xd56b('0x2d')](_0x2dd1f9);}}});})[_0xd56b('0x5d')](handleError(_0x7951d,null));};exports[_0xd56b('0x3b')]=function(_0x5d7d18,_0x231081,_0x450173){var _0x4551b6,_0x542eb0,_0x2932fc;if(_[_0xd56b('0xa1')](_0x5d7d18[_0xd56b('0x65')][_0xd56b('0x65')])||_0x5d7d18['body'][_0xd56b('0x65')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd56b('0xa1')](_0x5d7d18[_0xd56b('0x65')]['to'])){throw new db[(_0xd56b('0x90'))][(_0xd56b('0x91'))](_0xd56b('0xc0'));}_0x4551b6=_0x5d7d18['body']['to'];return db[_0xd56b('0x40')]['find']({'where':{'id':_0x5d7d18[_0xd56b('0x59')]['id']},'include':[{'model':db[_0xd56b('0xa7')],'as':_0xd56b('0xc1'),'include':[{'model':db['CmContact'],'as':_0xd56b('0xa9'),'where':{'mobile':_0x4551b6},'limit':0x1,'order':[[_0xd56b('0x94'),'DESC']]}]}]})[_0xd56b('0x22')](handleEntityNotFound(_0x231081,null))[_0xd56b('0x22')](function(_0x553ba7){if(_0x553ba7&&_0x553ba7['List']){_0x542eb0=_0x553ba7[_0xd56b('0x5f')]({'plain':!![]});if(_0x542eb0['List']&&_0x542eb0[_0xd56b('0xc1')][_0xd56b('0xa9')][_0xd56b('0x4b')]){return _0x542eb0[_0xd56b('0xc1')][_0xd56b('0xa9')][0x0];}return db[_0xd56b('0xa8')][_0xd56b('0x5e')](_[_0xd56b('0x1a')](_0x5d7d18[_0xd56b('0x65')],{'firstName':_0x4551b6,'mobile':_0x4551b6,'phone':_0x4551b6,'ListId':_0x542eb0[_0xd56b('0x97')]}));}})[_0xd56b('0x22')](handleEntityNotFound(_0x231081,null))['then'](function(_0x241b79){if(_0x241b79){_0x2932fc=_0x241b79;return db[_0xd56b('0xab')][_0xd56b('0x5c')]({'where':{'ContactId':_0x2932fc['id'],'closed':![],'WhatsappAccountId':_0x542eb0['id']}})['then'](function(_0x10e02a){if(_0x10e02a){return[_0x10e02a,![]];}return db[_0xd56b('0xab')][_0xd56b('0x5e')]({'UserId':_0x5d7d18[_0xd56b('0x61')]['id'],'ContactId':_0x2932fc['id'],'WhatsappAccountId':_0x542eb0['id'],'phone':_0x4551b6,'firstMsgDirection':_0xd56b('0xc2'),'Messages':[_[_0xd56b('0x53')](_0x5d7d18['body'],{'read':![],'body':_0x5d7d18['body'][_0xd56b('0x65')],'phone':_0x4551b6,'WhatsappAccountId':_0x542eb0['id'],'UserId':_0x5d7d18[_0xd56b('0x61')]['id'],'ContactId':_0x2932fc['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xd56b('0x22')](function(_0x40ddf2){return[_0x40ddf2,!![]];});});}})[_0xd56b('0x72')](function(_0x2c87a9,_0x2a953d){if(_0x2a953d){return _0x2c87a9;}return db[_0xd56b('0x89')][_0xd56b('0x5e')](_['merge'](_0x5d7d18['body'],{'read':![],'body':_0x5d7d18[_0xd56b('0x65')][_0xd56b('0x65')],'phone':_0x4551b6,'WhatsappAccountId':_0x542eb0['id'],'WhatsappInteractionId':_0x2c87a9['id'],'UserId':_0x5d7d18['user']['id'],'ContactId':_0x2932fc['id']}))['then'](function(_0x4ca3ae){_0x2c87a9[_0xd56b('0xc3')][_0xd56b('0xc4')]=[];_0x2c87a9[_0xd56b('0xc3')][_0xd56b('0xc4')][_0xd56b('0xad')](_0x4ca3ae[_0xd56b('0xc3')]);return _0x2c87a9;});})[_0xd56b('0x22')](respondWithResult(_0x231081,null))['catch'](handleError(_0x231081,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c1dc8f7..dd09600 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 _0x793f=['hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x793f,0xfe));var _0xf793=function(_0x1047cc,_0x2e2c14){_0x1047cc=_0x1047cc-0x0;var _0x1d67ce=_0x793f[_0x1047cc];return _0x1d67ce;};'use strict';var EventEmitter=require(_0xf793('0x0'));var WhatsappAccount=require(_0xf793('0x1'))['db'][_0xf793('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf793('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a72de){return function(_0x1c4a89,_0x2685fe,_0x4d56c0){WhatsappAccountEvents[_0xf793('0x4')](_0x4a72de+':'+_0x1c4a89['id'],_0x1c4a89);WhatsappAccountEvents[_0xf793('0x4')](_0x4a72de,_0x1c4a89);_0x4d56c0(null);};}for(var e in events){if(events[_0xf793('0x5')](e)){var event=events[e];WhatsappAccount[_0xf793('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x5783=['WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2fceb5,_0x229415){var _0x35edaa=function(_0x8204e7){while(--_0x8204e7){_0x2fceb5['push'](_0x2fceb5['shift']());}};_0x35edaa(++_0x229415);}(_0x5783,0x177));var _0x3578=function(_0x587f89,_0x2272f3){_0x587f89=_0x587f89-0x0;var _0x18c8c7=_0x5783[_0x587f89];return _0x18c8c7;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x3578('0x0'))['db'][_0x3578('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3578('0x2'),'afterUpdate':_0x3578('0x3'),'afterDestroy':_0x3578('0x4')};function emitEvent(_0x4070ab){return function(_0x3ce04d,_0x5ab0fc,_0x3e5ebe){WhatsappAccountEvents[_0x3578('0x5')](_0x4070ab+':'+_0x3ce04d['id'],_0x3ce04d);WhatsappAccountEvents['emit'](_0x4070ab,_0x3ce04d);_0x3e5ebe(null);};}for(var e in events){if(events[_0x3578('0x6')](e)){var event=events[e];WhatsappAccount[_0x3578('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index aab1c4b..dca5d34 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 _0xc405=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_accounts','lodash','util'];(function(_0x2dfd2b,_0x522d82){var _0x3fda3a=function(_0x3d28ef){while(--_0x3d28ef){_0x2dfd2b['push'](_0x2dfd2b['shift']());}};_0x3fda3a(++_0x522d82);}(_0xc405,0xca));var _0x5c40=function(_0x303875,_0x29fc7f){_0x303875=_0x303875-0x0;var _0x507814=_0xc405[_0x303875];return _0x507814;};'use strict';var _=require(_0x5c40('0x0'));var util=require(_0x5c40('0x1'));var logger=require(_0x5c40('0x2'))(_0x5c40('0x3'));var moment=require('moment');var BPromise=require(_0x5c40('0x4'));var rp=require(_0x5c40('0x5'));var fs=require('fs');var path=require(_0x5c40('0x6'));var rimraf=require(_0x5c40('0x7'));var config=require(_0x5c40('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0x5c40('0x9')]=function(_0x3c79d8,_0x3691ef){return _0x3c79d8[_0x5c40('0xa')]('WhatsappAccount',attributes,{'tableName':_0x5c40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xa5fd,0x1b8));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require(_0xda5f('0x1'));var logger=require(_0xda5f('0x2'))(_0xda5f('0x3'));var moment=require(_0xda5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xda5f('0x5'));var fs=require('fs');var path=require(_0xda5f('0x6'));var rimraf=require(_0xda5f('0x7'));var config=require(_0xda5f('0x8'));var attributes=require(_0xda5f('0x9'));module[_0xda5f('0xa')]=function(_0x3f7423,_0x495eea){return _0x3f7423[_0xda5f('0xb')]('WhatsappAccount',attributes,{'tableName':_0xda5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index da5fa6d..d3a3f23 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 _0x0b4b=['localhost','./whatsappAccount.socket','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','options','raw','attributes','map','include','model','ShowWhatsappAccount','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x394b30,_0xebe552){var _0x3900e4=function(_0x2f280b){while(--_0x2f280b){_0x394b30['push'](_0x394b30['shift']());}};_0x3900e4(++_0xebe552);}(_0x0b4b,0x16a));var _0xb0b4=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x0b4b[_0x102b0c];return _0x9b15ca;};'use strict';var _=require(_0xb0b4('0x0'));var util=require('util');var moment=require(_0xb0b4('0x1'));var BPromise=require(_0xb0b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0b4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0b4('0x4'));var logger=require('../../config/logger')(_0xb0b4('0x5'));var config=require(_0xb0b4('0x6'));var jayson=require(_0xb0b4('0x7'));var client=jayson[_0xb0b4('0x8')][_0xb0b4('0x9')]({'port':0x232a});config[_0xb0b4('0xa')]=_[_0xb0b4('0xb')](config[_0xb0b4('0xa')],{'host':_0xb0b4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0b4('0xa')]));require(_0xb0b4('0xd'))['register'](socket);function respondWithRpcPromise(_0x18e12c,_0x2350cf,_0x46b523){return new BPromise(function(_0x29bff5,_0x59c422){return client[_0xb0b4('0xe')](_0x18e12c,_0x46b523)[_0xb0b4('0xf')](function(_0x20f592){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2350cf,_0xb0b4('0x10'));logger[_0xb0b4('0x11')](_0xb0b4('0x12'),_0x2350cf,'request\x20sent',JSON[_0xb0b4('0x13')](_0x20f592));if(_0x20f592[_0xb0b4('0x14')]){if(_0x20f592[_0xb0b4('0x14')][_0xb0b4('0x15')]===0x1f4){logger[_0xb0b4('0x14')](_0xb0b4('0x16'),_0x2350cf,_0x20f592[_0xb0b4('0x14')][_0xb0b4('0x17')]);return _0x59c422(_0x20f592[_0xb0b4('0x14')][_0xb0b4('0x17')]);}logger[_0xb0b4('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x2350cf,_0x20f592['error'][_0xb0b4('0x17')]);return _0x29bff5(_0x20f592['error'][_0xb0b4('0x17')]);}else{logger[_0xb0b4('0x18')](_0xb0b4('0x16'),_0x2350cf,_0xb0b4('0x10'));_0x29bff5(_0x20f592[_0xb0b4('0x19')][_0xb0b4('0x17')]);}})['catch'](function(_0x428c25){logger[_0xb0b4('0x14')](_0xb0b4('0x16'),_0x2350cf,_0x428c25);_0x59c422(_0x428c25);});});}exports['ShowWhatsappAccount']=function(_0x5af140){var _0xc6ece8=this;return new Promise(function(_0x456a52,_0x49205f){return db['WhatsappAccount']['find']({'raw':_0x5af140[_0xb0b4('0x1a')]?_0x5af140['options'][_0xb0b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5af140[_0xb0b4('0x1a')]?_0x5af140[_0xb0b4('0x1a')]['where']||null:null,'attributes':_0x5af140[_0xb0b4('0x1a')]?_0x5af140['options'][_0xb0b4('0x1c')]||null:null,'include':_0x5af140[_0xb0b4('0x1a')]?_0x5af140['options']['include']?_[_0xb0b4('0x1d')](_0x5af140[_0xb0b4('0x1a')][_0xb0b4('0x1e')],function(_0x278ead){return{'model':db[_0x278ead[_0xb0b4('0x1f')]],'as':_0x278ead['as'],'attributes':_0x278ead[_0xb0b4('0x1c')],'include':_0x278ead[_0xb0b4('0x1e')]?_[_0xb0b4('0x1d')](_0x278ead['include'],function(_0xfc78d8){return{'model':db[_0xfc78d8[_0xb0b4('0x1f')]],'as':_0xfc78d8['as'],'attributes':_0xfc78d8[_0xb0b4('0x1c')],'include':_0xfc78d8[_0xb0b4('0x1e')]?_['map'](_0xfc78d8[_0xb0b4('0x1e')],function(_0x3e22c9){return{'model':db[_0x3e22c9['model']],'as':_0x3e22c9['as'],'attributes':_0x3e22c9[_0xb0b4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb0b4('0xf')](function(_0x22b98d){logger[_0xb0b4('0x18')](_0xb0b4('0x20'),_0x5af140);logger[_0xb0b4('0x11')](_0xb0b4('0x20'),_0x5af140,JSON[_0xb0b4('0x13')](_0x22b98d));_0x456a52(_0x22b98d);})[_0xb0b4('0x21')](function(_0x334dca){logger['error'](_0xb0b4('0x20'),_0x334dca['message'],_0x5af140);_0x49205f(_0xc6ece8[_0xb0b4('0x14')](0x1f4,_0x334dca[_0xb0b4('0x17')]));});});}; \ No newline at end of file +var _0x8dc7=['then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model'];(function(_0x53e198,_0x4e0e84){var _0x3fae6f=function(_0x8e3943){while(--_0x8e3943){_0x53e198['push'](_0x53e198['shift']());}};_0x3fae6f(++_0x4e0e84);}(_0x8dc7,0xf6));var _0x78dc=function(_0x24ed8f,_0x16ead4){_0x24ed8f=_0x24ed8f-0x0;var _0x484567=_0x8dc7[_0x24ed8f];return _0x484567;};'use strict';var _=require('lodash');var util=require(_0x78dc('0x0'));var moment=require(_0x78dc('0x1'));var BPromise=require(_0x78dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78dc('0x4'));var logger=require(_0x78dc('0x5'))(_0x78dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x78dc('0x7')][_0x78dc('0x8')]({'port':0x232a});config[_0x78dc('0x9')]=_[_0x78dc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x78dc('0xb'))(new Redis(config['redis']));require(_0x78dc('0xc'))[_0x78dc('0xd')](socket);function respondWithRpcPromise(_0x60c6d8,_0xf3ebd1,_0x1b1044){return new BPromise(function(_0x53fa5a,_0x4270b4){return client[_0x78dc('0xe')](_0x60c6d8,_0x1b1044)['then'](function(_0x11de0d){logger['info'](_0x78dc('0xf'),_0xf3ebd1,_0x78dc('0x10'));logger[_0x78dc('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xf3ebd1,_0x78dc('0x10'),JSON[_0x78dc('0x12')](_0x11de0d));if(_0x11de0d[_0x78dc('0x13')]){if(_0x11de0d['error'][_0x78dc('0x14')]===0x1f4){logger['error'](_0x78dc('0xf'),_0xf3ebd1,_0x11de0d[_0x78dc('0x13')]['message']);return _0x4270b4(_0x11de0d[_0x78dc('0x13')][_0x78dc('0x15')]);}logger[_0x78dc('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xf3ebd1,_0x11de0d[_0x78dc('0x13')]['message']);return _0x53fa5a(_0x11de0d[_0x78dc('0x13')][_0x78dc('0x15')]);}else{logger[_0x78dc('0x16')](_0x78dc('0xf'),_0xf3ebd1,_0x78dc('0x10'));_0x53fa5a(_0x11de0d[_0x78dc('0x17')]['message']);}})[_0x78dc('0x18')](function(_0xf7c8ce){logger[_0x78dc('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xf3ebd1,_0xf7c8ce);_0x4270b4(_0xf7c8ce);});});}exports[_0x78dc('0x19')]=function(_0x183f16){var _0x5cc468=this;return new Promise(function(_0x6e5f16,_0x10f03b){return db[_0x78dc('0x1a')][_0x78dc('0x1b')]({'raw':_0x183f16[_0x78dc('0x1c')]?_0x183f16[_0x78dc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x183f16[_0x78dc('0x1c')]?_0x183f16['options'][_0x78dc('0x1d')]||null:null,'attributes':_0x183f16[_0x78dc('0x1c')]?_0x183f16[_0x78dc('0x1c')][_0x78dc('0x1e')]||null:null,'include':_0x183f16[_0x78dc('0x1c')]?_0x183f16['options'][_0x78dc('0x1f')]?_[_0x78dc('0x20')](_0x183f16[_0x78dc('0x1c')]['include'],function(_0x466c9f){return{'model':db[_0x466c9f[_0x78dc('0x21')]],'as':_0x466c9f['as'],'attributes':_0x466c9f['attributes'],'include':_0x466c9f[_0x78dc('0x1f')]?_['map'](_0x466c9f['include'],function(_0x315c54){return{'model':db[_0x315c54[_0x78dc('0x21')]],'as':_0x315c54['as'],'attributes':_0x315c54[_0x78dc('0x1e')],'include':_0x315c54['include']?_['map'](_0x315c54[_0x78dc('0x1f')],function(_0x486762){return{'model':db[_0x486762[_0x78dc('0x21')]],'as':_0x486762['as'],'attributes':_0x486762[_0x78dc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x78dc('0x22')](function(_0x12b39d){logger[_0x78dc('0x16')](_0x78dc('0x19'),_0x183f16);logger['debug'](_0x78dc('0x19'),_0x183f16,JSON[_0x78dc('0x12')](_0x12b39d));_0x6e5f16(_0x12b39d);})['catch'](function(_0x46b15a){logger[_0x78dc('0x13')](_0x78dc('0x19'),_0x46b15a[_0x78dc('0x15')],_0x183f16);_0x10f03b(_0x5cc468[_0x78dc('0x13')](0x1f4,_0x46b15a[_0x78dc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2c7844d..ed8e200 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 _0x4659=['emit','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4659,0x16c));var _0x9465=function(_0x2a8c82,_0x3720ce){_0x2a8c82=_0x2a8c82-0x0;var _0x574900=_0x4659[_0x2a8c82];return _0x574900;};'use strict';var WhatsappAccountEvents=require(_0x9465('0x0'));var events=[_0x9465('0x1'),_0x9465('0x2'),_0x9465('0x3')];function createListener(_0x32e421,_0x2a9b34){return function(_0x2caa6c){_0x2a9b34[_0x9465('0x4')](_0x32e421,_0x2caa6c);};}function removeListener(_0x5797f6,_0x164674){return function(){WhatsappAccountEvents['removeListener'](_0x5797f6,_0x164674);};}exports[_0x9465('0x5')]=function(_0x379e76){for(var _0x5e3e8a=0x0,_0x20ccb9=events[_0x9465('0x6')];_0x5e3e8a<_0x20ccb9;_0x5e3e8a++){var _0x48fbb7=events[_0x5e3e8a];var _0x235684=createListener(_0x9465('0x7')+_0x48fbb7,_0x379e76);WhatsappAccountEvents['on'](_0x48fbb7,_0x235684);}}; \ No newline at end of file +var _0xe2d2=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x178216,_0x20a145){var _0x279c80=function(_0x370f1e){while(--_0x370f1e){_0x178216['push'](_0x178216['shift']());}};_0x279c80(++_0x20a145);}(_0xe2d2,0x65));var _0x2e2d=function(_0x38b55f,_0x321cc8){_0x38b55f=_0x38b55f-0x0;var _0x53306d=_0xe2d2[_0x38b55f];return _0x53306d;};'use strict';var WhatsappAccountEvents=require(_0x2e2d('0x0'));var events=[_0x2e2d('0x1'),_0x2e2d('0x2'),_0x2e2d('0x3')];function createListener(_0x424b7a,_0x3a55e3){return function(_0x4e7e6b){_0x3a55e3[_0x2e2d('0x4')](_0x424b7a,_0x4e7e6b);};}function removeListener(_0x259442,_0x51a4a9){return function(){WhatsappAccountEvents[_0x2e2d('0x5')](_0x259442,_0x51a4a9);};}exports[_0x2e2d('0x6')]=function(_0x3030db){for(var _0x10484c=0x0,_0x531574=events[_0x2e2d('0x7')];_0x10484c<_0x531574;_0x10484c++){var _0x42786d=events[_0x10484c];var _0x11ebcd=createListener(_0x2e2d('0x8')+_0x42786d,_0x3030db);WhatsappAccountEvents['on'](_0x42786d,_0x11ebcd);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 58c70fc..1ada2c6 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 _0x84ab=['get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x379171,_0x5cfb17){var _0x128dc6=function(_0x594e2e){while(--_0x594e2e){_0x379171['push'](_0x379171['shift']());}};_0x128dc6(++_0x5cfb17);}(_0x84ab,0x7c));var _0xb84a=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x84ab[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0xb84a('0x0'));var util=require('util');var path=require(_0xb84a('0x1'));var timeout=require(_0xb84a('0x2'));var express=require(_0xb84a('0x3'));var router=express[_0xb84a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth[_0xb84a('0xa')](),controller['index']);router[_0xb84a('0x9')](_0xb84a('0xb'),auth[_0xb84a('0xa')](),controller[_0xb84a('0xc')]);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xa')](),controller[_0xb84a('0xe')]);router[_0xb84a('0xf')](_0xb84a('0xb'),auth[_0xb84a('0xa')](),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')]('/:id',auth[_0xb84a('0xa')](),controller['destroy']);module[_0xb84a('0x12')]=router; \ No newline at end of file +var _0xa0a6=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x6480bf,_0x42234e){var _0x32021d=function(_0x633e1c){while(--_0x633e1c){_0x6480bf['push'](_0x6480bf['shift']());}};_0x32021d(++_0x42234e);}(_0xa0a6,0xc1));var _0x6a0a=function(_0x232918,_0x83fd62){_0x232918=_0x232918-0x0;var _0x5bdd24=_0xa0a6[_0x232918];return _0x5bdd24;};'use strict';var multer=require(_0x6a0a('0x0'));var util=require('util');var path=require(_0x6a0a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a0a('0x2')]();var fs_extra=require(_0x6a0a('0x3'));var auth=require(_0x6a0a('0x4'));var interaction=require(_0x6a0a('0x5'));var config=require(_0x6a0a('0x6'));var controller=require(_0x6a0a('0x7'));router[_0x6a0a('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a0a('0x9')]);router[_0x6a0a('0x8')](_0x6a0a('0xa'),auth[_0x6a0a('0xb')](),controller[_0x6a0a('0xc')]);router[_0x6a0a('0xd')]('/',auth['isAuthenticated'](),controller[_0x6a0a('0xe')]);router[_0x6a0a('0xf')](_0x6a0a('0xa'),auth[_0x6a0a('0xb')](),controller['update']);router[_0x6a0a('0x10')](_0x6a0a('0xa'),auth[_0x6a0a('0xb')](),controller['destroy']);module[_0x6a0a('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 365d8d5..d4dd7d3 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 _0xa135=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x4f6400,_0x58343e){var _0x42acf3=function(_0x188c5b){while(--_0x188c5b){_0x4f6400['push'](_0x4f6400['shift']());}};_0x42acf3(++_0x58343e);}(_0xa135,0x14d));var _0x5a13=function(_0x218a9b,_0x433f7c){_0x218a9b=_0x218a9b-0x0;var _0x449efb=_0xa135[_0x218a9b];return _0x449efb;};'use strict';var Sequelize=require(_0x5a13('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5a13('0x1')],'allowNull':![],'defaultValue':_0x5a13('0x2')},'appdata':{'type':Sequelize[_0x5a13('0x3')]()},'description':{'type':Sequelize[_0x5a13('0x1')]},'interval':{'type':Sequelize[_0x5a13('0x1')],'defaultValue':_0x5a13('0x4')}}; \ No newline at end of file +var _0xcc9f=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x39462a,_0xafa23b){var _0x417529=function(_0x10800e){while(--_0x10800e){_0x39462a['push'](_0x39462a['shift']());}};_0x417529(++_0xafa23b);}(_0xcc9f,0x1c5));var _0xfcc9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc9f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfcc9('0x0'));module[_0xfcc9('0x1')]={'priority':{'type':Sequelize[_0xfcc9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfcc9('0x3')],'allowNull':![],'defaultValue':_0xfcc9('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfcc9('0x3')],'defaultValue':_0xfcc9('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e51b246..14e0723 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 _0x5a43=['intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','status','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x538b4b,_0x1ab8fa){var _0x1db0ae=function(_0x383aac){while(--_0x383aac){_0x538b4b['push'](_0x538b4b['shift']());}};_0x1db0ae(++_0x1ab8fa);}(_0x5a43,0xf1));var _0x35a4=function(_0x33213c,_0x27ff43){_0x33213c=_0x33213c-0x0;var _0x4960a7=_0x5a43[_0x33213c];return _0x4960a7;};'use strict';var emlformat=require(_0x35a4('0x0'));var rimraf=require(_0x35a4('0x1'));var zipdir=require(_0x35a4('0x2'));var jsonpatch=require(_0x35a4('0x3'));var rp=require(_0x35a4('0x4'));var moment=require(_0x35a4('0x5'));var BPromise=require(_0x35a4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x35a4('0x7'));var ejs=require(_0x35a4('0x8'));var fs=require('fs');var fs_extra=require(_0x35a4('0x9'));var _=require(_0x35a4('0xa'));var squel=require(_0x35a4('0xb'));var crypto=require(_0x35a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x35a4('0xd'));var toCsv=require(_0x35a4('0x7'));var querystring=require(_0x35a4('0xe'));var Papa=require(_0x35a4('0xf'));var Redis=require(_0x35a4('0x10'));var authService=require(_0x35a4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a4('0x12'))('api');var utils=require(_0x35a4('0x13'));var config=require(_0x35a4('0x14'));var licenseUtil=require(_0x35a4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fef5e,_0x311af9){_0x311af9=_0x311af9||0xcc;return function(_0x5fc594){if(_0x5fc594){return _0x3fef5e[_0x35a4('0x16')](_0x311af9);}return _0x3fef5e['status'](_0x311af9)[_0x35a4('0x17')]();};}function respondWithResult(_0xf9f6d3,_0x4bc73b){_0x4bc73b=_0x4bc73b||0xc8;return function(_0x417c52){if(_0x417c52){return _0xf9f6d3['status'](_0x4bc73b)[_0x35a4('0x18')](_0x417c52);}};}function respondWithFilteredResult(_0x3d0027,_0x4533c7){return function(_0x19e719){if(_0x19e719){var _0x2609a7=typeof _0x4533c7[_0x35a4('0x19')]===_0x35a4('0x1a')&&typeof _0x4533c7[_0x35a4('0x1b')]===_0x35a4('0x1a');var _0x4b214e=_0x19e719[_0x35a4('0x1c')];var _0x41b56c=_0x2609a7?0x0:_0x4533c7[_0x35a4('0x19')];var _0x61f568=_0x2609a7?_0x19e719[_0x35a4('0x1c')]:_0x4533c7[_0x35a4('0x19')]+_0x4533c7[_0x35a4('0x1b')];var _0x3e29ba;if(_0x61f568>=_0x4b214e){_0x61f568=_0x4b214e;_0x3e29ba=0xc8;}else{_0x3e29ba=0xce;}_0x3d0027['status'](_0x3e29ba);return _0x3d0027[_0x35a4('0x1d')]('Content-Range',_0x41b56c+'-'+_0x61f568+'/'+_0x4b214e)['json'](_0x19e719);}return null;};}function patchUpdates(_0x3e48b3){return function(_0x3ef8a8){try{jsonpatch[_0x35a4('0x1e')](_0x3ef8a8,_0x3e48b3,!![]);}catch(_0x4a39ed){return BPromise[_0x35a4('0x1f')](_0x4a39ed);}return _0x3ef8a8[_0x35a4('0x20')]();};}function saveUpdates(_0x44121d,_0x56b424){return function(_0xa1130){if(_0xa1130){return _0xa1130[_0x35a4('0x21')](_0x44121d)['then'](function(_0x13fc5a){return _0x13fc5a;});}return null;};}function removeEntity(_0x417767,_0x34fc8d){return function(_0x2af3ff){if(_0x2af3ff){return _0x2af3ff['destroy']()['then'](function(){_0x417767[_0x35a4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469728,_0x311428){return function(_0x1d0cfc){if(!_0x1d0cfc){_0x469728[_0x35a4('0x16')](0x194);}return _0x1d0cfc;};}function handleError(_0x446cd1,_0x2f8e6c){_0x2f8e6c=_0x2f8e6c||0x1f4;return function(_0x503719){logger['error'](_0x503719['stack']);if(_0x503719[_0x35a4('0x23')]){delete _0x503719[_0x35a4('0x23')];}_0x446cd1['status'](_0x2f8e6c)['send'](_0x503719);};}exports[_0x35a4('0x24')]=function(_0x410aa9,_0x2426bd){var _0x13fad7={},_0x5d3313={},_0x586721={'count':0x0,'rows':[]};var _0x4dd9bf=_['map'](db[_0x35a4('0x25')][_0x35a4('0x26')],function(_0x3ce259){return{'name':_0x3ce259[_0x35a4('0x27')],'type':_0x3ce259[_0x35a4('0x28')][_0x35a4('0x29')]};});_0x5d3313[_0x35a4('0x2a')]=_[_0x35a4('0x2b')](_0x4dd9bf,_0x35a4('0x23'));_0x5d3313[_0x35a4('0x2c')]=_[_0x35a4('0x2d')](_0x410aa9[_0x35a4('0x2c')]);_0x5d3313[_0x35a4('0x2e')]=_[_0x35a4('0x2f')](_0x5d3313[_0x35a4('0x2a')],_0x5d3313[_0x35a4('0x2c')]);_0x13fad7['attributes']=_[_0x35a4('0x2f')](_0x5d3313[_0x35a4('0x2a')],qs[_0x35a4('0x30')](_0x410aa9['query'][_0x35a4('0x30')]));_0x13fad7[_0x35a4('0x31')]=_0x13fad7[_0x35a4('0x31')]['length']?_0x13fad7['attributes']:_0x5d3313[_0x35a4('0x2a')];if(!_0x410aa9['query'][_0x35a4('0x32')](_0x35a4('0x33'))){_0x13fad7[_0x35a4('0x1b')]=qs['limit'](_0x410aa9['query'][_0x35a4('0x1b')]);_0x13fad7[_0x35a4('0x19')]=qs[_0x35a4('0x19')](_0x410aa9[_0x35a4('0x2c')][_0x35a4('0x19')]);}_0x13fad7[_0x35a4('0x34')]=qs[_0x35a4('0x35')](_0x410aa9[_0x35a4('0x2c')]['sort']);_0x13fad7['where']=qs[_0x35a4('0x2e')](_[_0x35a4('0x36')](_0x410aa9[_0x35a4('0x2c')],_0x5d3313[_0x35a4('0x2e')]),_0x4dd9bf);if(_0x410aa9[_0x35a4('0x2c')]['filter']){_0x13fad7[_0x35a4('0x37')]=_['merge'](_0x13fad7[_0x35a4('0x37')],{'$or':_['map'](_0x4dd9bf,function(_0x233751){if(_0x233751[_0x35a4('0x28')]!==_0x35a4('0x38')){var _0x1dd4aa={};_0x1dd4aa[_0x233751[_0x35a4('0x23')]]={'$like':'%'+_0x410aa9[_0x35a4('0x2c')]['filter']+'%'};return _0x1dd4aa;}})});}_0x13fad7=_[_0x35a4('0x39')]({},_0x13fad7,_0x410aa9[_0x35a4('0x3a')]);var _0x2bdaf4={'where':_0x13fad7[_0x35a4('0x37')]};return db[_0x35a4('0x25')][_0x35a4('0x1c')](_0x2bdaf4)[_0x35a4('0x3b')](function(_0x23ba67){_0x586721[_0x35a4('0x1c')]=_0x23ba67;if(_0x410aa9[_0x35a4('0x2c')][_0x35a4('0x3c')]){_0x13fad7[_0x35a4('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x35a4('0x3e')](_0x13fad7);})['then'](function(_0x251282){_0x586721[_0x35a4('0x3f')]=_0x251282;return _0x586721;})[_0x35a4('0x3b')](respondWithFilteredResult(_0x2426bd,_0x13fad7))[_0x35a4('0x40')](handleError(_0x2426bd,null));};exports[_0x35a4('0x41')]=function(_0x1add8d,_0x19a281){var _0x5f6b75={'raw':!![],'where':{'id':_0x1add8d[_0x35a4('0x42')]['id']}},_0x3e2f33={};_0x3e2f33['model']=_[_0x35a4('0x2d')](db[_0x35a4('0x25')][_0x35a4('0x26')]);_0x3e2f33[_0x35a4('0x2c')]=_[_0x35a4('0x2d')](_0x1add8d[_0x35a4('0x2c')]);_0x3e2f33[_0x35a4('0x2e')]=_['intersection'](_0x3e2f33[_0x35a4('0x2a')],_0x3e2f33[_0x35a4('0x2c')]);_0x5f6b75[_0x35a4('0x31')]=_['intersection'](_0x3e2f33[_0x35a4('0x2a')],qs[_0x35a4('0x30')](_0x1add8d[_0x35a4('0x2c')][_0x35a4('0x30')]));_0x5f6b75[_0x35a4('0x31')]=_0x5f6b75[_0x35a4('0x31')][_0x35a4('0x43')]?_0x5f6b75['attributes']:_0x3e2f33[_0x35a4('0x2a')];if(_0x1add8d['query'][_0x35a4('0x3c')]){_0x5f6b75[_0x35a4('0x3d')]=[{'all':!![]}];}_0x5f6b75=_[_0x35a4('0x39')]({},_0x5f6b75,_0x1add8d[_0x35a4('0x3a')]);return db['WhatsappApplication'][_0x35a4('0x44')](_0x5f6b75)[_0x35a4('0x3b')](handleEntityNotFound(_0x19a281,null))[_0x35a4('0x3b')](respondWithResult(_0x19a281,null))[_0x35a4('0x40')](handleError(_0x19a281,null));};exports[_0x35a4('0x45')]=function(_0x44228c,_0x187a0c){return db[_0x35a4('0x25')][_0x35a4('0x45')](_0x44228c['body'],{})[_0x35a4('0x3b')](respondWithResult(_0x187a0c,0xc9))[_0x35a4('0x40')](handleError(_0x187a0c,null));};exports['update']=function(_0xc3dcb6,_0x1e7d68){if(_0xc3dcb6[_0x35a4('0x46')]['id']){delete _0xc3dcb6[_0x35a4('0x46')]['id'];}return db['WhatsappApplication'][_0x35a4('0x44')]({'where':{'id':_0xc3dcb6[_0x35a4('0x42')]['id']}})[_0x35a4('0x3b')](handleEntityNotFound(_0x1e7d68,null))['then'](saveUpdates(_0xc3dcb6[_0x35a4('0x46')],null))['then'](respondWithResult(_0x1e7d68,null))[_0x35a4('0x40')](handleError(_0x1e7d68,null));};exports[_0x35a4('0x47')]=function(_0x4aacd8,_0xc7ac3e){return db['WhatsappApplication'][_0x35a4('0x44')]({'where':{'id':_0x4aacd8['params']['id']}})[_0x35a4('0x3b')](handleEntityNotFound(_0xc7ac3e,null))[_0x35a4('0x3b')](removeEntity(_0xc7ac3e,null))[_0x35a4('0x40')](handleError(_0xc7ac3e,null));}; \ No newline at end of file +var _0xa30a=['catch','includeAll','find','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows'];(function(_0x3d9ce8,_0xd8d033){var _0xd1947c=function(_0x777125){while(--_0x777125){_0x3d9ce8['push'](_0x3d9ce8['shift']());}};_0xd1947c(++_0xd8d033);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){_0x13128a[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x12da2f,_0x97b038){return function(_0x2a59ce){if(!_0x2a59ce){_0x12da2f['sendStatus'](0x194);}return _0x2a59ce;};}function handleError(_0x467850,_0x465701){_0x465701=_0x465701||0x1f4;return function(_0x5d4da8){logger[_0xaa30('0x24')](_0x5d4da8['stack']);if(_0x5d4da8[_0xaa30('0x25')]){delete _0x5d4da8[_0xaa30('0x25')];}_0x467850[_0xaa30('0x19')](_0x465701)[_0xaa30('0x26')](_0x5d4da8);};}exports[_0xaa30('0x27')]=function(_0xc10b8f,_0x6ff09a){var _0x39f708={},_0x1f288c={},_0x43fb30={'count':0x0,'rows':[]};var _0x44aa9b=_[_0xaa30('0x28')](db[_0xaa30('0x29')][_0xaa30('0x2a')],function(_0x40e4ee){return{'name':_0x40e4ee[_0xaa30('0x2b')],'type':_0x40e4ee[_0xaa30('0x2c')][_0xaa30('0x2d')]};});_0x1f288c['model']=_[_0xaa30('0x28')](_0x44aa9b,_0xaa30('0x25'));_0x1f288c[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0xc10b8f[_0xaa30('0x2e')]);_0x1f288c[_0xaa30('0x30')]=_['intersection'](_0x1f288c['model'],_0x1f288c['query']);_0x39f708[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x1f288c[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0xc10b8f[_0xaa30('0x2e')]['fields']));_0x39f708['attributes']=_0x39f708[_0xaa30('0x31')][_0xaa30('0x35')]?_0x39f708['attributes']:_0x1f288c[_0xaa30('0x33')];if(!_0xc10b8f['query'][_0xaa30('0x36')]('nolimit')){_0x39f708[_0xaa30('0x1f')]=qs[_0xaa30('0x1f')](_0xc10b8f['query'][_0xaa30('0x1f')]);_0x39f708[_0xaa30('0x1c')]=qs[_0xaa30('0x1c')](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x1c')]);}_0x39f708[_0xaa30('0x37')]=qs['sort'](_0xc10b8f[_0xaa30('0x2e')][_0xaa30('0x38')]);_0x39f708['where']=qs[_0xaa30('0x30')](_[_0xaa30('0x39')](_0xc10b8f[_0xaa30('0x2e')],_0x1f288c['filters']),_0x44aa9b);if(_0xc10b8f['query'][_0xaa30('0x3a')]){_0x39f708[_0xaa30('0x3b')]=_[_0xaa30('0x3c')](_0x39f708[_0xaa30('0x3b')],{'$or':_[_0xaa30('0x28')](_0x44aa9b,function(_0x291854){if(_0x291854['type']!=='VIRTUAL'){var _0x120c43={};_0x120c43[_0x291854[_0xaa30('0x25')]]={'$like':'%'+_0xc10b8f[_0xaa30('0x2e')]['filter']+'%'};return _0x120c43;}})});}_0x39f708=_[_0xaa30('0x3c')]({},_0x39f708,_0xc10b8f[_0xaa30('0x3d')]);var _0x8fb95e={'where':_0x39f708[_0xaa30('0x3b')]};return db['WhatsappApplication'][_0xaa30('0x1e')](_0x8fb95e)[_0xaa30('0x23')](function(_0x2c5ddb){_0x43fb30[_0xaa30('0x1e')]=_0x2c5ddb;if(_0xc10b8f[_0xaa30('0x2e')]['includeAll']){_0x39f708[_0xaa30('0x3e')]=[{'all':!![]}];}return db[_0xaa30('0x29')][_0xaa30('0x3f')](_0x39f708);})[_0xaa30('0x23')](function(_0x13f08f){_0x43fb30[_0xaa30('0x40')]=_0x13f08f;return _0x43fb30;})[_0xaa30('0x23')](respondWithFilteredResult(_0x6ff09a,_0x39f708))[_0xaa30('0x41')](handleError(_0x6ff09a,null));};exports['show']=function(_0x59ef25,_0x18771d){var _0x4a170a={'raw':!![],'where':{'id':_0x59ef25['params']['id']}},_0x5208f8={};_0x5208f8[_0xaa30('0x33')]=_['keys'](db[_0xaa30('0x29')]['rawAttributes']);_0x5208f8[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x59ef25[_0xaa30('0x2e')]);_0x5208f8[_0xaa30('0x30')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],_0x5208f8[_0xaa30('0x2e')]);_0x4a170a[_0xaa30('0x31')]=_[_0xaa30('0x32')](_0x5208f8[_0xaa30('0x33')],qs[_0xaa30('0x34')](_0x59ef25['query'][_0xaa30('0x34')]));_0x4a170a[_0xaa30('0x31')]=_0x4a170a[_0xaa30('0x31')][_0xaa30('0x35')]?_0x4a170a[_0xaa30('0x31')]:_0x5208f8['model'];if(_0x59ef25['query'][_0xaa30('0x42')]){_0x4a170a['include']=[{'all':!![]}];}_0x4a170a=_[_0xaa30('0x3c')]({},_0x4a170a,_0x59ef25[_0xaa30('0x3d')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x4a170a)[_0xaa30('0x23')](handleEntityNotFound(_0x18771d,null))[_0xaa30('0x23')](respondWithResult(_0x18771d,null))[_0xaa30('0x41')](handleError(_0x18771d,null));};exports['create']=function(_0x3cf0bb,_0x6c9da6){return db[_0xaa30('0x29')]['create'](_0x3cf0bb[_0xaa30('0x44')],{})[_0xaa30('0x23')](respondWithResult(_0x6c9da6,0xc9))['catch'](handleError(_0x6c9da6,null));};exports[_0xaa30('0x22')]=function(_0x4a8fcc,_0x25d227){if(_0x4a8fcc['body']['id']){delete _0x4a8fcc['body']['id'];}return db[_0xaa30('0x29')]['find']({'where':{'id':_0x4a8fcc['params']['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x25d227,null))[_0xaa30('0x23')](saveUpdates(_0x4a8fcc[_0xaa30('0x44')],null))[_0xaa30('0x23')](respondWithResult(_0x25d227,null))[_0xaa30('0x41')](handleError(_0x25d227,null));};exports[_0xaa30('0x45')]=function(_0x5616cd,_0x17d75d){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x5616cd['params']['id']}})['then'](handleEntityNotFound(_0x17d75d,null))['then'](removeEntity(_0x17d75d,null))['catch'](handleError(_0x17d75d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 261f65e..013240c 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 _0xd6ce=['bluebird','request-promise','path','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd6ce,0x127));var _0xed6c=function(_0x2c0253,_0x336597){_0x2c0253=_0x2c0253-0x0;var _0x1d600b=_0xd6ce[_0x2c0253];return _0x1d600b;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var logger=require(_0xed6c('0x2'))(_0xed6c('0x3'));var moment=require(_0xed6c('0x4'));var BPromise=require(_0xed6c('0x5'));var rp=require(_0xed6c('0x6'));var fs=require('fs');var path=require(_0xed6c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed6c('0x8'));module[_0xed6c('0x9')]=function(_0x1a6d96,_0x1d0912){return _0x1a6d96['define']('WhatsappApplication',attributes,{'tableName':_0xed6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed6c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe5b3=['../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x65ed3c,_0x57ab47){var _0x4e2397=function(_0x15d6a9){while(--_0x15d6a9){_0x65ed3c['push'](_0x65ed3c['shift']());}};_0x4e2397(++_0x57ab47);}(_0xe5b3,0x133));var _0x3e5b=function(_0x58ff4c,_0x320115){_0x58ff4c=_0x58ff4c-0x0;var _0x2a49df=_0xe5b3[_0x58ff4c];return _0x2a49df;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('WhatsappApplication',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e5b('0xd'),'collate':_0x3e5b('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1861652..8170441 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4dc280,_0xca175f){var _0x324d75=function(_0x4ae8dd){while(--_0x4ae8dd){_0x4dc280['push'](_0x4dc280['shift']());}};_0x324d75(++_0xca175f);}(_0xe14d,0x1ee));var _0xde14=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe14d[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x53a11c,_0x393441){var _0x2680d5=function(_0xd3d1e2){while(--_0xd3d1e2){_0x53a11c['push'](_0x53a11c['shift']());}};_0x2680d5(++_0x393441);}(_0x99e9,0xb4));var _0x999e=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x99e9[_0x5e2b34];return _0x4859f9;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 8a3d385..2bc9d58 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 _0x126e=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x126e,0x108));var _0xe126=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x126e[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var fs_extra=require(_0xe126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var controller=require(_0xe126('0x8'));router[_0xe126('0x9')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xb')]);router[_0xe126('0x9')]('/describe',auth[_0xe126('0xa')](),controller[_0xe126('0xc')]);router[_0xe126('0x9')](_0xe126('0xd'),auth[_0xe126('0xa')](),controller['show']);router[_0xe126('0x9')](_0xe126('0xe'),auth['isAuthenticated'](),controller[_0xe126('0xf')]);router[_0xe126('0x9')]('/:id/download',auth[_0xe126('0xa')](),controller['download']);router[_0xe126('0x10')]('/',auth['isAuthenticated'](),controller[_0xe126('0x11')]);router[_0xe126('0x10')](_0xe126('0xe'),auth[_0xe126('0xa')](),controller[_0xe126('0x12')]);router[_0xe126('0x10')](_0xe126('0x13'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),'whatsappinteraction:addtags'),controller[_0xe126('0x16')]);router[_0xe126('0x17')](_0xe126('0xd'),auth[_0xe126('0xa')](),interaction['tracked'](_0xe126('0x15'),_0xe126('0x18')),controller[_0xe126('0x19')]);router['delete'](_0xe126('0xd'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),_0xe126('0x1a')),controller[_0xe126('0x1b')]);router[_0xe126('0x1c')](_0xe126('0x13'),auth[_0xe126('0xa')](),controller[_0xe126('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xa630=['/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x5aea38,_0x5f22a0){var _0x2cf0fd=function(_0x4ccfca){while(--_0x4ccfca){_0x5aea38['push'](_0x5aea38['shift']());}};_0x2cf0fd(++_0x5f22a0);}(_0xa630,0xbe));var _0x0a63=function(_0x23d06c,_0x33030a){_0x23d06c=_0x23d06c-0x0;var _0x292bf4=_0xa630[_0x23d06c];return _0x292bf4;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0x7')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0x7')](_0x0a63('0xf'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')]('/',auth['isAuthenticated'](),controller[_0x0a63('0x12')]);router[_0x0a63('0x11')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller['addMessage']);router[_0x0a63('0x11')]('/:id/tags',auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x15')),controller[_0x0a63('0x16')]);router[_0x0a63('0x17')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction['tracked'](_0x0a63('0x14'),'whatsappinteraction:update'),controller[_0x0a63('0x18')]);router[_0x0a63('0x19')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x1a')),controller[_0x0a63('0x1b')]);router[_0x0a63('0x19')](_0x0a63('0x1c'),auth[_0x0a63('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 877af33..aa869bc 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 _0x6d0c=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x3cdbc7,_0x2a7cb3){var _0x422d20=function(_0x11ac87){while(--_0x11ac87){_0x3cdbc7['push'](_0x3cdbc7['shift']());}};_0x422d20(++_0x2a7cb3);}(_0x6d0c,0x8c));var _0xc6d0=function(_0xc3ce7e,_0x20de64){_0xc3ce7e=_0xc3ce7e-0x0;var _0x322cc2=_0x6d0c[_0xc3ce7e];return _0x322cc2;};'use strict';var Sequelize=require(_0xc6d0('0x0'));var moment=require(_0xc6d0('0x1'));module[_0xc6d0('0x2')]={'closed':{'type':Sequelize[_0xc6d0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc6d0('0x4')]},'disposition':{'type':Sequelize[_0xc6d0('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc6d0('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc6d0('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc6d0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc6d0('0x6')]('in',_0xc6d0('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc6d0('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc6d0('0x8')]}}; \ No newline at end of file +var _0x1e82=['STRING','out','ENUM','INTEGER','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x51e449,_0xb03365){var _0x7313ca=function(_0xe4da1e){while(--_0xe4da1e){_0x51e449['push'](_0x51e449['shift']());}};_0x7313ca(++_0xb03365);}(_0x1e82,0x8b));var _0x21e8=function(_0x1a4f37,_0x4e7395){_0x1a4f37=_0x1a4f37-0x0;var _0x41e379=_0x1e82[_0x1a4f37];return _0x41e379;};'use strict';var Sequelize=require(_0x21e8('0x0'));var moment=require(_0x21e8('0x1'));module[_0x21e8('0x2')]={'closed':{'type':Sequelize[_0x21e8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x21e8('0x4')]},'disposition':{'type':Sequelize[_0x21e8('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x21e8('0x5')]},'note':{'type':Sequelize[_0x21e8('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x21e8('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x21e8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x21e8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x21e8('0x7')]('in',_0x21e8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x21e8('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f028d9a..4983d2e 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 _0xcd7f=['Content-Range','json','update','then','destroy','sendStatus','stack','name','send','WhatsappInteraction','fieldName','type','key','getOptions','whatsapp','user','show','params','model','keys','query','filters','intersection','fields','attributes','includeAll','include','merge','options','catch','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','rawAttributes','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','findAll','rows','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','get','Whatsapp','Owner','format','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','direction','value','renderFile','views','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','status','undefined','limit','count','offset','set'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcd7f,0x16e));var _0xfcd7=function(_0x21e841,_0x5674c2){_0x21e841=_0x21e841-0x0;var _0x36b0a7=_0xcd7f[_0x21e841];return _0x36b0a7;};'use strict';var rimraf=require(_0xfcd7('0x0'));var zipdir=require(_0xfcd7('0x1'));var moment=require(_0xfcd7('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var ejs=require(_0xfcd7('0x3'));var fs=require('fs');var _=require(_0xfcd7('0x4'));var Redis=require(_0xfcd7('0x5'));var interaction=require(_0xfcd7('0x6'));var qs=require(_0xfcd7('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xfcd7('0x8'))(_0xfcd7('0x9'));var config=require(_0xfcd7('0xa'));var db=require(_0xfcd7('0xb'))['db'];config[_0xfcd7('0xc')]=_['defaults'](config['redis'],{'host':_0xfcd7('0xd'),'port':0x18eb});var socket=require(_0xfcd7('0xe'))(new Redis(config[_0xfcd7('0xc')]));require(_0xfcd7('0xf'))[_0xfcd7('0x10')](socket);function respondWithStatusCode(_0x2cd793,_0x2f20a1){_0x2f20a1=_0x2f20a1||0xcc;return function(_0x3bb243){if(_0x3bb243){return _0x2cd793['sendStatus'](_0x2f20a1);}return _0x2cd793['status'](_0x2f20a1)[_0xfcd7('0x11')]();};}function respondWithResult(_0x18f8ca,_0x5883fc){_0x5883fc=_0x5883fc||0xc8;return function(_0x5969f9){if(_0x5969f9){return _0x18f8ca[_0xfcd7('0x12')](_0x5883fc)['json'](_0x5969f9);}};}function respondWithFilteredResult(_0xa5329d,_0x341d9d){return function(_0x50441a){if(_0x50441a){var _0x3616c9=typeof _0x341d9d['offset']===_0xfcd7('0x13')&&typeof _0x341d9d[_0xfcd7('0x14')]===_0xfcd7('0x13');var _0x50be12=_0x50441a[_0xfcd7('0x15')];var _0x54ffe8=_0x3616c9?0x0:_0x341d9d[_0xfcd7('0x16')];var _0x1ba619=_0x3616c9?_0x50441a[_0xfcd7('0x15')]:_0x341d9d['offset']+_0x341d9d[_0xfcd7('0x14')];var _0x490554;if(_0x1ba619>=_0x50be12){_0x1ba619=_0x50be12;_0x490554=0xc8;}else{_0x490554=0xce;}_0xa5329d[_0xfcd7('0x12')](_0x490554);return _0xa5329d[_0xfcd7('0x17')](_0xfcd7('0x18'),_0x54ffe8+'-'+_0x1ba619+'/'+_0x50be12)[_0xfcd7('0x19')](_0x50441a);}return null;};}function saveUpdates(_0x58916c){return function(_0x3c8924){if(_0x3c8924){return _0x3c8924[_0xfcd7('0x1a')](_0x58916c)[_0xfcd7('0x1b')](function(_0x4e1965){return _0x4e1965;});}return null;};}function removeEntity(_0x22e53d){return function(_0x1e941d){if(_0x1e941d){return _0x1e941d[_0xfcd7('0x1c')]()[_0xfcd7('0x1b')](function(){_0x22e53d['status'](0xcc)[_0xfcd7('0x11')]();});}};}function handleEntityNotFound(_0x4c56e1){return function(_0xc2e152){if(!_0xc2e152){_0x4c56e1[_0xfcd7('0x1d')](0x194);}return _0xc2e152;};}function handleError(_0x3417e7,_0x49602f){_0x49602f=_0x49602f||0x1f4;return function(_0x503899){logger['error'](_0x503899[_0xfcd7('0x1e')]);if(_0x503899[_0xfcd7('0x1f')]){delete _0x503899['name'];}_0x3417e7[_0xfcd7('0x12')](_0x49602f)[_0xfcd7('0x20')](_0x503899);};}exports['index']=function(_0x46628d,_0x214d1c){var _0x458292={};var _0x2b48ab=_['map'](db[_0xfcd7('0x21')]['rawAttributes'],function(_0x57e177){return{'name':_0x57e177[_0xfcd7('0x22')],'type':_0x57e177[_0xfcd7('0x23')][_0xfcd7('0x24')]};});_0x458292=qs[_0xfcd7('0x25')](_0x2b48ab,_0x46628d);return interaction['findAll'](_0xfcd7('0x26'),_0x46628d['query'],_0x46628d[_0xfcd7('0x27')],_0x458292,_0x2b48ab)[_0xfcd7('0x1b')](respondWithFilteredResult(_0x214d1c,_0x458292))['catch'](handleError(_0x214d1c,null));};exports[_0xfcd7('0x28')]=function(_0x454a4c,_0x3f3fae){var _0x527edb={'raw':![],'where':{'id':_0x454a4c[_0xfcd7('0x29')]['id']}},_0x16f2d8={};_0x16f2d8[_0xfcd7('0x2a')]=_[_0xfcd7('0x2b')](db[_0xfcd7('0x21')]['rawAttributes']);_0x16f2d8[_0xfcd7('0x2c')]=_[_0xfcd7('0x2b')](_0x454a4c['query']);_0x16f2d8[_0xfcd7('0x2d')]=_[_0xfcd7('0x2e')](_0x16f2d8['model'],_0x16f2d8[_0xfcd7('0x2c')]);_0x527edb['attributes']=_[_0xfcd7('0x2e')](_0x16f2d8['model'],qs[_0xfcd7('0x2f')](_0x454a4c[_0xfcd7('0x2c')][_0xfcd7('0x2f')]));_0x527edb[_0xfcd7('0x30')]=_0x527edb[_0xfcd7('0x30')]['length']?_0x527edb[_0xfcd7('0x30')]:_0x16f2d8['model'];if(_0x454a4c['query'][_0xfcd7('0x31')]){_0x527edb[_0xfcd7('0x32')]=[{'all':!![]}];}_0x527edb=_[_0xfcd7('0x33')]({},_0x527edb,_0x454a4c[_0xfcd7('0x34')]);return db[_0xfcd7('0x21')]['find'](_0x527edb)['then'](handleEntityNotFound(_0x3f3fae,null))[_0xfcd7('0x1b')](respondWithResult(_0x3f3fae,null))[_0xfcd7('0x35')](handleError(_0x3f3fae,null));};exports[_0xfcd7('0x36')]=function(_0x4b74af,_0x4ed6e1){return db[_0xfcd7('0x21')][_0xfcd7('0x36')](_0x4b74af[_0xfcd7('0x37')],{})[_0xfcd7('0x1b')](respondWithResult(_0x4ed6e1,0xc9))['catch'](handleError(_0x4ed6e1,null));};exports[_0xfcd7('0x1a')]=function(_0x49d697,_0x247e93){if(_0x49d697[_0xfcd7('0x37')]['id']){delete _0x49d697[_0xfcd7('0x37')]['id'];}return db[_0xfcd7('0x21')][_0xfcd7('0x38')]({'where':{'id':_0x49d697[_0xfcd7('0x29')]['id']}})[_0xfcd7('0x1b')](handleEntityNotFound(_0x247e93,null))[_0xfcd7('0x1b')](saveUpdates(_0x49d697[_0xfcd7('0x37')],null))[_0xfcd7('0x1b')](respondWithResult(_0x247e93,null))['catch'](handleError(_0x247e93,null));};exports[_0xfcd7('0x1c')]=function(_0x2bbabb,_0x3a097c){return db[_0xfcd7('0x21')]['find']({'where':{'id':_0x2bbabb[_0xfcd7('0x29')]['id']}})[_0xfcd7('0x1b')](handleEntityNotFound(_0x3a097c,null))['then'](removeEntity(_0x3a097c,null))[_0xfcd7('0x35')](handleError(_0x3a097c,null));};exports['describe']=function(_0x19807f,_0x42a0bd){return db[_0xfcd7('0x21')][_0xfcd7('0x39')]()[_0xfcd7('0x1b')](respondWithResult(_0x42a0bd,null))[_0xfcd7('0x35')](handleError(_0x42a0bd,null));};exports[_0xfcd7('0x3a')]=function(_0x1ff89c,_0x34f071){return db['WhatsappMessage'][_0xfcd7('0x38')]({'where':{'id':_0x1ff89c[_0xfcd7('0x29')]['id']}})[_0xfcd7('0x1b')](handleEntityNotFound(_0x34f071,null))[_0xfcd7('0x1b')](function(_0xda0d23){if(_0xda0d23){return _0xda0d23[_0xfcd7('0x3a')](_0x1ff89c[_0xfcd7('0x37')][_0xfcd7('0x3b')],_[_0xfcd7('0x3c')](_0x1ff89c[_0xfcd7('0x37')],[_0xfcd7('0x3b'),'id'])||{});}})[_0xfcd7('0x1b')](respondWithResult(_0x34f071,null))[_0xfcd7('0x35')](handleError(_0x34f071,null));};exports[_0xfcd7('0x3d')]=function(_0x1b80d0,_0x13ed14){var _0x52459c={'raw':![],'where':{}};var _0x4c512a={};var _0x56750a={'count':0x0,'rows':[]};return db[_0xfcd7('0x21')][_0xfcd7('0x3e')]({'where':{'id':_0x1b80d0[_0xfcd7('0x29')]['id']}})[_0xfcd7('0x1b')](handleEntityNotFound(_0x13ed14,null))[_0xfcd7('0x1b')](function(_0x224293){if(_0x224293){_0x4c512a[_0xfcd7('0x2a')]=_['keys'](db['WhatsappMessage'][_0xfcd7('0x3f')]);_0x4c512a[_0xfcd7('0x2c')]=_['keys'](_0x1b80d0['query']);_0x4c512a[_0xfcd7('0x2d')]=_[_0xfcd7('0x2e')](_0x4c512a[_0xfcd7('0x2a')],_0x4c512a[_0xfcd7('0x2c')]);_0x52459c['attributes']=_['intersection'](_0x4c512a[_0xfcd7('0x2a')],qs[_0xfcd7('0x2f')](_0x1b80d0['query'][_0xfcd7('0x2f')]));_0x52459c[_0xfcd7('0x30')]=_0x52459c[_0xfcd7('0x30')][_0xfcd7('0x40')]?_0x52459c[_0xfcd7('0x30')]:_0x4c512a[_0xfcd7('0x2a')];if(!_0x1b80d0['query'][_0xfcd7('0x41')](_0xfcd7('0x42'))){_0x52459c['limit']=qs[_0xfcd7('0x14')](_0x1b80d0[_0xfcd7('0x2c')][_0xfcd7('0x14')]);_0x52459c[_0xfcd7('0x16')]=qs[_0xfcd7('0x16')](_0x1b80d0[_0xfcd7('0x2c')][_0xfcd7('0x16')]);}_0x52459c[_0xfcd7('0x43')]=qs[_0xfcd7('0x44')](_0x1b80d0[_0xfcd7('0x2c')][_0xfcd7('0x44')]);_0x52459c[_0xfcd7('0x45')]=qs[_0xfcd7('0x2d')](_[_0xfcd7('0x46')](_0x1b80d0[_0xfcd7('0x2c')],_0x4c512a[_0xfcd7('0x2d')]));_0x52459c[_0xfcd7('0x45')][_0xfcd7('0x47')]=_0x224293['id'];if(_0x1b80d0[_0xfcd7('0x2c')][_0xfcd7('0x48')]){_0x52459c[_0xfcd7('0x45')]=_['merge'](_0x52459c[_0xfcd7('0x45')],{'$or':_[_0xfcd7('0x49')](_0x52459c[_0xfcd7('0x30')],function(_0x379adb){var _0x41db85={};_0x41db85[_0x379adb]={'$like':'%'+_0x1b80d0[_0xfcd7('0x2c')][_0xfcd7('0x48')]+'%'};return _0x41db85;})});}if(_0x1b80d0[_0xfcd7('0x2c')]['$gte']){var _0x590309=_0x1b80d0[_0xfcd7('0x2c')]['$gte']['split'](',');var _0x59aa24={};_0x59aa24[_0x590309[0x0]]={'$gte':moment(_0x590309[0x1])['format'](_0xfcd7('0x4a'))};_0x52459c[_0xfcd7('0x45')]=_[_0xfcd7('0x33')](_0x52459c[_0xfcd7('0x45')],_0x59aa24);}_0x52459c=_['merge']({},_0x52459c,_0x1b80d0['options']);return db[_0xfcd7('0x4b')][_0xfcd7('0x15')]({'where':_0x52459c[_0xfcd7('0x45')]})[_0xfcd7('0x1b')](function(_0x1e4f83){_0x56750a[_0xfcd7('0x15')]=_0x1e4f83;if(_0x1b80d0[_0xfcd7('0x2c')]['includeAll']){_0x52459c[_0xfcd7('0x32')]=[{'all':!![]}];}return db[_0xfcd7('0x4b')][_0xfcd7('0x4c')](_0x52459c);})[_0xfcd7('0x1b')](function(_0x2c16cf){_0x56750a[_0xfcd7('0x4d')]=_0x2c16cf;return _0x56750a;});}})[_0xfcd7('0x1b')](respondWithFilteredResult(_0x13ed14,_0x52459c))[_0xfcd7('0x35')](handleError(_0x13ed14,null));};exports['addTags']=function(_0x271a86,_0x8f9a32){return db[_0xfcd7('0x21')][_0xfcd7('0x38')]({'where':{'id':_0x271a86['params']['id']}})[_0xfcd7('0x1b')](handleEntityNotFound(_0x8f9a32,null))['then'](function(_0x3eea46){if(_0x3eea46){return _0x3eea46['setTags'](_0x271a86[_0xfcd7('0x37')]['ids'],_['omit'](_0x271a86[_0xfcd7('0x37')],[_0xfcd7('0x3b'),'id'])||{})[_0xfcd7('0x4e')](function(){return db[_0xfcd7('0x4f')][_0xfcd7('0x4c')]({'attributes':['id','name',_0xfcd7('0x50')],'where':{'id':_0x271a86[_0xfcd7('0x37')][_0xfcd7('0x3b')]}});})[_0xfcd7('0x1b')](function(_0x1186c5){socket[_0xfcd7('0x51')]('whatsappInteractionTags:save',{'id':Number(_0x271a86[_0xfcd7('0x29')]['id']),'tags':_0x1186c5||[]});return{'id':Number(_0x271a86[_0xfcd7('0x29')]['id']),'tags':_0x1186c5||[]};});}})[_0xfcd7('0x1b')](respondWithResult(_0x8f9a32,null))[_0xfcd7('0x35')](handleError(_0x8f9a32,null));};exports['removeTags']=function(_0x40d74b,_0x34dcfe){return db[_0xfcd7('0x21')][_0xfcd7('0x38')]({'where':{'id':_0x40d74b['params']['id']}})[_0xfcd7('0x1b')](handleEntityNotFound(_0x34dcfe,null))[_0xfcd7('0x1b')](function(_0x3dcde8){if(_0x3dcde8){return _0x3dcde8[_0xfcd7('0x52')](_0x40d74b[_0xfcd7('0x2c')][_0xfcd7('0x3b')]);}})['then'](respondWithStatusCode(_0x34dcfe,null))[_0xfcd7('0x35')](handleError(_0x34dcfe,null));};exports[_0xfcd7('0x53')]=function(_0xc04e27,_0x230bb3){var _0x1d73ab=moment()[_0xfcd7('0x54')]()[_0xfcd7('0x55')]();var _0x4b4994=path[_0xfcd7('0x56')](config[_0xfcd7('0x57')],_0xfcd7('0x58'),_0xfcd7('0x59'),_0xfcd7('0x5a'));var _0x1a505e=path[_0xfcd7('0x56')](config[_0xfcd7('0x57')],'server',_0xfcd7('0x59'),_0xfcd7('0x5b'));var _0x34f041=path['join'](_0x4b4994,_0x1d73ab);var _0x2f23ba=util['format'](_0xfcd7('0x5c'),_0xc04e27[_0xfcd7('0x29')]['id'],_0x1d73ab);var _0x341ce8=path[_0xfcd7('0x56')](_0x4b4994,_0x2f23ba);var _0x4c381c=[];_0x4c381c['push']({'model':db[_0xfcd7('0x5d')],'as':_0xfcd7('0x5d'),'attributes':['id',_0xfcd7('0x5e')],'raw':!![]});_0x4c381c[_0xfcd7('0x5f')]({'model':db[_0xfcd7('0x60')],'as':_0xfcd7('0x61'),'attributes':['id',_0xfcd7('0x62'),'lastName'],'raw':!![]});if(_0xc04e27[_0xfcd7('0x2c')][_0xfcd7('0x5b')]){_0x4c381c['push']({'model':db[_0xfcd7('0x63')],'as':_0xfcd7('0x63'),'raw':!![]});}var _0x51b770=[{'model':db[_0xfcd7('0x4b')],'as':_0xfcd7('0x64'),'attributes':['id',_0xfcd7('0x37'),_0xfcd7('0x65'),'direction',_0xfcd7('0x66'),_0xfcd7('0x67')],'include':_0x4c381c}];_0x51b770[_0xfcd7('0x5f')]({'model':db[_0xfcd7('0x68')],'as':_0xfcd7('0x69'),'attributes':['id',_0xfcd7('0x1f')]});_0x51b770['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xfcd7('0x5e')]});return db[_0xfcd7('0x21')]['find']({'where':{'id':_0xc04e27[_0xfcd7('0x29')]['id']},'include':_0x51b770})[_0xfcd7('0x1b')](handleEntityNotFound(_0x230bb3,null))[_0xfcd7('0x1b')](function(_0x3c94d2){if(_0x3c94d2){var _0x2f419e=_0x3c94d2[_0xfcd7('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x34f041);var _0x1cc354={'channel':_0xfcd7('0x6b'),'account':_0x2f419e['Account'][_0xfcd7('0x1f')],'agent':_0x2f419e[_0xfcd7('0x6c')]?_0x2f419e[_0xfcd7('0x6c')][_0xfcd7('0x5e')]:'N.A.','createdAt':moment(_0x2f419e['createdAt'])[_0xfcd7('0x6d')](_0xfcd7('0x4a'))[_0xfcd7('0x55')](),'closedAt':_0x2f419e[_0xfcd7('0x6e')]?moment(_0x2f419e[_0xfcd7('0x6f')])[_0xfcd7('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2f419e[_0xfcd7('0x70')],'messages':_(_0x2f419e[_0xfcd7('0x64')])['filter']({'secret':![]})[_0xfcd7('0x49')](function(_0x2ae93c){if(_0x2ae93c[_0xfcd7('0x63')]){var _0x535f9d=path['join'](_0x1a505e,_0x2ae93c['Attachment'][_0xfcd7('0x71')]);if(fs[_0xfcd7('0x72')](_0x535f9d)){fs[_0xfcd7('0x73')](_0x535f9d)[_0xfcd7('0x74')](fs[_0xfcd7('0x75')](path['join'](_0x34f041,_0x2ae93c['Attachment']['basename'])));}}return{'date':moment(_0x2ae93c[_0xfcd7('0x65')])[_0xfcd7('0x6d')](_0xfcd7('0x4a'))['toString'](),'sender':_0x2ae93c['direction']===_0xfcd7('0x76')?_0x2ae93c[_0xfcd7('0x5d')]?_0x2ae93c['User'][_0xfcd7('0x5e')]:_0xfcd7('0x77'):_0x2ae93c[_0xfcd7('0x61')][_0xfcd7('0x62')]+(_0x2ae93c[_0xfcd7('0x61')][_0xfcd7('0x78')]?'\x20'+_0x2ae93c[_0xfcd7('0x61')][_0xfcd7('0x78')]:''),'body':_0x2ae93c[_0xfcd7('0x63')]?_0x2ae93c[_0xfcd7('0x63')][_0xfcd7('0x71')]:_0x2ae93c[_0xfcd7('0x37')],'direction':_0x2ae93c[_0xfcd7('0x79')]===_0xfcd7('0x76')?'A':'C','secret':_0x2ae93c['secret'],'read':_0x2ae93c['read'],'attachment':_0x2ae93c[_0xfcd7('0x63')]};})[_0xfcd7('0x7a')]()};return ejs[_0xfcd7('0x7b')](path['join'](config['root'],_0xfcd7('0x58'),_0xfcd7('0x7c'),'downloadInteraction.ejs'),{'interaction':_0x1cc354})[_0xfcd7('0x1b')](function(_0x5ac86c){var _0x216264=path[_0xfcd7('0x56')](_0x34f041,'transcript-'+_0x2f419e['id']+'-'+_0x1d73ab+_0xfcd7('0x7d'));var _0x2e0866={'path':_0x216264,'channel':_0xfcd7('0x6b'),'interactionId':_0x2f419e['id']};return pdf[_0xfcd7('0x7e')](_0x5ac86c,_0x2e0866);})['then'](function(){return new BPromise(function(_0x29f39d,_0x5044a0){zipdir(_0x34f041,{'saveTo':_0x341ce8},function(_0x155e56,_0x5ba4fe){if(_0x155e56)return _0x5044a0(_0x155e56);return _0x29f39d(_0x5ba4fe);});})[_0xfcd7('0x1b')](function(){return new BPromise(function(_0x1b216e,_0x1a80cd){rimraf(_0x34f041,function(_0x2d4bca){if(_0x2d4bca)_0x1a80cd(_0x2d4bca);return _0x1b216e();});});})[_0xfcd7('0x1b')](function(){return _0x230bb3[_0xfcd7('0x53')](_0x341ce8,_0x2f23ba,function(_0x4f7dab){if(_0x4f7dab){console[_0xfcd7('0x7f')](_0xfcd7('0x80'),_0x4f7dab);}else{fs[_0xfcd7('0x81')](_0x341ce8);}});});});}else{return _0x230bb3[_0xfcd7('0x1d')](0xc8);}})['catch'](handleError(_0x230bb3,null));}; \ No newline at end of file +var _0x157f=['order','sort','where','pick','WhatsappInteractionId','filter','$gte','format','includeAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','transcript-%d-%s.zip','User','fullname','push','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','Contact','value','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','user','catch','show','params','model','keys','query','filters','attributes','intersection','fields','include','merge','options','create','body','update','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','length','nolimit'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x157f,0x141));var _0xf157=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x157f[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xf157('0x0'));var zipdir=require(_0xf157('0x1'));var moment=require(_0xf157('0x2'));var BPromise=require(_0xf157('0x3'));var util=require(_0xf157('0x4'));var path=require(_0xf157('0x5'));var ejs=require(_0xf157('0x6'));var fs=require('fs');var _=require(_0xf157('0x7'));var Redis=require(_0xf157('0x8'));var interaction=require(_0xf157('0x9'));var qs=require(_0xf157('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0xf157('0xb'))(_0xf157('0xc'));var config=require('../../config/environment');var db=require(_0xf157('0xd'))['db'];config[_0xf157('0xe')]=_['defaults'](config[_0xf157('0xe')],{'host':_0xf157('0xf'),'port':0x18eb});var socket=require(_0xf157('0x10'))(new Redis(config[_0xf157('0xe')]));require(_0xf157('0x11'))[_0xf157('0x12')](socket);function respondWithStatusCode(_0x5aa59e,_0x46c557){_0x46c557=_0x46c557||0xcc;return function(_0xab3f48){if(_0xab3f48){return _0x5aa59e[_0xf157('0x13')](_0x46c557);}return _0x5aa59e[_0xf157('0x14')](_0x46c557)[_0xf157('0x15')]();};}function respondWithResult(_0x4d19fd,_0x349267){_0x349267=_0x349267||0xc8;return function(_0x2456cb){if(_0x2456cb){return _0x4d19fd['status'](_0x349267)[_0xf157('0x16')](_0x2456cb);}};}function respondWithFilteredResult(_0x5756cb,_0x3ede4b){return function(_0x451274){if(_0x451274){var _0x4322e9=typeof _0x3ede4b[_0xf157('0x17')]===_0xf157('0x18')&&typeof _0x3ede4b[_0xf157('0x19')]===_0xf157('0x18');var _0x53585e=_0x451274[_0xf157('0x1a')];var _0x57e918=_0x4322e9?0x0:_0x3ede4b['offset'];var _0x3b728a=_0x4322e9?_0x451274[_0xf157('0x1a')]:_0x3ede4b[_0xf157('0x17')]+_0x3ede4b[_0xf157('0x19')];var _0x395776;if(_0x3b728a>=_0x53585e){_0x3b728a=_0x53585e;_0x395776=0xc8;}else{_0x395776=0xce;}_0x5756cb['status'](_0x395776);return _0x5756cb[_0xf157('0x1b')](_0xf157('0x1c'),_0x57e918+'-'+_0x3b728a+'/'+_0x53585e)['json'](_0x451274);}return null;};}function saveUpdates(_0x518753){return function(_0x14b73f){if(_0x14b73f){return _0x14b73f['update'](_0x518753)[_0xf157('0x1d')](function(_0x49ec6b){return _0x49ec6b;});}return null;};}function removeEntity(_0xc591da){return function(_0x1ff735){if(_0x1ff735){return _0x1ff735[_0xf157('0x1e')]()['then'](function(){_0xc591da[_0xf157('0x14')](0xcc)[_0xf157('0x15')]();});}};}function handleEntityNotFound(_0x511314){return function(_0x586db4){if(!_0x586db4){_0x511314[_0xf157('0x13')](0x194);}return _0x586db4;};}function handleError(_0x111a46,_0x2033b9){_0x2033b9=_0x2033b9||0x1f4;return function(_0x381505){logger[_0xf157('0x1f')](_0x381505[_0xf157('0x20')]);if(_0x381505[_0xf157('0x21')]){delete _0x381505[_0xf157('0x21')];}_0x111a46[_0xf157('0x14')](_0x2033b9)[_0xf157('0x22')](_0x381505);};}exports['index']=function(_0x54874c,_0x343e6e){var _0x3e3a18={};var _0x481d5f=_[_0xf157('0x23')](db[_0xf157('0x24')][_0xf157('0x25')],function(_0x434b96){return{'name':_0x434b96['fieldName'],'type':_0x434b96[_0xf157('0x26')][_0xf157('0x27')]};});_0x3e3a18=qs[_0xf157('0x28')](_0x481d5f,_0x54874c);return interaction[_0xf157('0x29')]('whatsapp',_0x54874c['query'],_0x54874c[_0xf157('0x2a')],_0x3e3a18,_0x481d5f)[_0xf157('0x1d')](respondWithFilteredResult(_0x343e6e,_0x3e3a18))[_0xf157('0x2b')](handleError(_0x343e6e,null));};exports[_0xf157('0x2c')]=function(_0x2bec90,_0x166183){var _0x3d6ce0={'raw':![],'where':{'id':_0x2bec90[_0xf157('0x2d')]['id']}},_0x31666b={};_0x31666b[_0xf157('0x2e')]=_[_0xf157('0x2f')](db[_0xf157('0x24')][_0xf157('0x25')]);_0x31666b[_0xf157('0x30')]=_[_0xf157('0x2f')](_0x2bec90[_0xf157('0x30')]);_0x31666b[_0xf157('0x31')]=_['intersection'](_0x31666b[_0xf157('0x2e')],_0x31666b['query']);_0x3d6ce0[_0xf157('0x32')]=_[_0xf157('0x33')](_0x31666b['model'],qs[_0xf157('0x34')](_0x2bec90[_0xf157('0x30')][_0xf157('0x34')]));_0x3d6ce0[_0xf157('0x32')]=_0x3d6ce0['attributes']['length']?_0x3d6ce0[_0xf157('0x32')]:_0x31666b[_0xf157('0x2e')];if(_0x2bec90['query']['includeAll']){_0x3d6ce0[_0xf157('0x35')]=[{'all':!![]}];}_0x3d6ce0=_[_0xf157('0x36')]({},_0x3d6ce0,_0x2bec90[_0xf157('0x37')]);return db['WhatsappInteraction']['find'](_0x3d6ce0)[_0xf157('0x1d')](handleEntityNotFound(_0x166183,null))['then'](respondWithResult(_0x166183,null))[_0xf157('0x2b')](handleError(_0x166183,null));};exports[_0xf157('0x38')]=function(_0x780985,_0x4de24e){return db[_0xf157('0x24')][_0xf157('0x38')](_0x780985[_0xf157('0x39')],{})['then'](respondWithResult(_0x4de24e,0xc9))['catch'](handleError(_0x4de24e,null));};exports[_0xf157('0x3a')]=function(_0x335e0b,_0xb7ca95){if(_0x335e0b[_0xf157('0x39')]['id']){delete _0x335e0b[_0xf157('0x39')]['id'];}return db[_0xf157('0x24')][_0xf157('0x3b')]({'where':{'id':_0x335e0b[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0xb7ca95,null))[_0xf157('0x1d')](saveUpdates(_0x335e0b['body'],null))[_0xf157('0x1d')](respondWithResult(_0xb7ca95,null))[_0xf157('0x2b')](handleError(_0xb7ca95,null));};exports['destroy']=function(_0xa02894,_0x3986ac){return db[_0xf157('0x24')][_0xf157('0x3b')]({'where':{'id':_0xa02894[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x3986ac,null))['then'](removeEntity(_0x3986ac,null))[_0xf157('0x2b')](handleError(_0x3986ac,null));};exports[_0xf157('0x3c')]=function(_0x3a33c2,_0x1113f9){return db[_0xf157('0x24')]['describe']()[_0xf157('0x1d')](respondWithResult(_0x1113f9,null))[_0xf157('0x2b')](handleError(_0x1113f9,null));};exports[_0xf157('0x3d')]=function(_0x473ff7,_0x43a657){return db[_0xf157('0x3e')][_0xf157('0x3b')]({'where':{'id':_0x473ff7[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x43a657,null))[_0xf157('0x1d')](function(_0x2e6090){if(_0x2e6090){return _0x2e6090['addMessage'](_0x473ff7[_0xf157('0x39')][_0xf157('0x3f')],_[_0xf157('0x40')](_0x473ff7[_0xf157('0x39')],[_0xf157('0x3f'),'id'])||{});}})[_0xf157('0x1d')](respondWithResult(_0x43a657,null))[_0xf157('0x2b')](handleError(_0x43a657,null));};exports[_0xf157('0x41')]=function(_0xee1e1d,_0x40e298){var _0x412543={'raw':![],'where':{}};var _0x541703={};var _0x3b3b58={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xf157('0x42')]({'where':{'id':_0xee1e1d[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x40e298,null))[_0xf157('0x1d')](function(_0x2d8e06){if(_0x2d8e06){_0x541703[_0xf157('0x2e')]=_[_0xf157('0x2f')](db['WhatsappMessage'][_0xf157('0x25')]);_0x541703[_0xf157('0x30')]=_[_0xf157('0x2f')](_0xee1e1d[_0xf157('0x30')]);_0x541703['filters']=_[_0xf157('0x33')](_0x541703[_0xf157('0x2e')],_0x541703[_0xf157('0x30')]);_0x412543[_0xf157('0x32')]=_[_0xf157('0x33')](_0x541703[_0xf157('0x2e')],qs[_0xf157('0x34')](_0xee1e1d['query'][_0xf157('0x34')]));_0x412543[_0xf157('0x32')]=_0x412543[_0xf157('0x32')][_0xf157('0x43')]?_0x412543['attributes']:_0x541703[_0xf157('0x2e')];if(!_0xee1e1d['query']['hasOwnProperty'](_0xf157('0x44'))){_0x412543[_0xf157('0x19')]=qs[_0xf157('0x19')](_0xee1e1d['query'][_0xf157('0x19')]);_0x412543['offset']=qs[_0xf157('0x17')](_0xee1e1d[_0xf157('0x30')]['offset']);}_0x412543[_0xf157('0x45')]=qs[_0xf157('0x46')](_0xee1e1d[_0xf157('0x30')][_0xf157('0x46')]);_0x412543[_0xf157('0x47')]=qs['filters'](_[_0xf157('0x48')](_0xee1e1d[_0xf157('0x30')],_0x541703[_0xf157('0x31')]));_0x412543[_0xf157('0x47')][_0xf157('0x49')]=_0x2d8e06['id'];if(_0xee1e1d[_0xf157('0x30')]['filter']){_0x412543[_0xf157('0x47')]=_['merge'](_0x412543[_0xf157('0x47')],{'$or':_[_0xf157('0x23')](_0x412543[_0xf157('0x32')],function(_0xcc43b2){var _0x141d68={};_0x141d68[_0xcc43b2]={'$like':'%'+_0xee1e1d[_0xf157('0x30')][_0xf157('0x4a')]+'%'};return _0x141d68;})});}if(_0xee1e1d[_0xf157('0x30')]['$gte']){var _0x4a0333=_0xee1e1d[_0xf157('0x30')][_0xf157('0x4b')]['split'](',');var _0x220242={};_0x220242[_0x4a0333[0x0]]={'$gte':moment(_0x4a0333[0x1])[_0xf157('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x412543[_0xf157('0x47')]=_[_0xf157('0x36')](_0x412543[_0xf157('0x47')],_0x220242);}_0x412543=_[_0xf157('0x36')]({},_0x412543,_0xee1e1d['options']);return db[_0xf157('0x3e')][_0xf157('0x1a')]({'where':_0x412543[_0xf157('0x47')]})[_0xf157('0x1d')](function(_0x1c6b1d){_0x3b3b58['count']=_0x1c6b1d;if(_0xee1e1d[_0xf157('0x30')][_0xf157('0x4d')]){_0x412543[_0xf157('0x35')]=[{'all':!![]}];}return db[_0xf157('0x3e')][_0xf157('0x29')](_0x412543);})[_0xf157('0x1d')](function(_0x1e2d75){_0x3b3b58[_0xf157('0x4e')]=_0x1e2d75;return _0x3b3b58;});}})[_0xf157('0x1d')](respondWithFilteredResult(_0x40e298,_0x412543))[_0xf157('0x2b')](handleError(_0x40e298,null));};exports[_0xf157('0x4f')]=function(_0x3661f9,_0x2910f9){return db['WhatsappInteraction'][_0xf157('0x3b')]({'where':{'id':_0x3661f9[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x2910f9,null))[_0xf157('0x1d')](function(_0x1d60da){if(_0x1d60da){return _0x1d60da[_0xf157('0x50')](_0x3661f9[_0xf157('0x39')][_0xf157('0x3f')],_[_0xf157('0x40')](_0x3661f9[_0xf157('0x39')],['ids','id'])||{})[_0xf157('0x51')](function(){return db[_0xf157('0x52')][_0xf157('0x29')]({'attributes':['id',_0xf157('0x21'),'color'],'where':{'id':_0x3661f9[_0xf157('0x39')][_0xf157('0x3f')]}});})[_0xf157('0x1d')](function(_0x508ac1){socket[_0xf157('0x53')](_0xf157('0x54'),{'id':Number(_0x3661f9['params']['id']),'tags':_0x508ac1||[]});return{'id':Number(_0x3661f9[_0xf157('0x2d')]['id']),'tags':_0x508ac1||[]};});}})[_0xf157('0x1d')](respondWithResult(_0x2910f9,null))[_0xf157('0x2b')](handleError(_0x2910f9,null));};exports[_0xf157('0x55')]=function(_0x19088,_0x452077){return db[_0xf157('0x24')][_0xf157('0x3b')]({'where':{'id':_0x19088[_0xf157('0x2d')]['id']}})[_0xf157('0x1d')](handleEntityNotFound(_0x452077,null))[_0xf157('0x1d')](function(_0x3db148){if(_0x3db148){return _0x3db148[_0xf157('0x55')](_0x19088[_0xf157('0x30')][_0xf157('0x3f')]);}})[_0xf157('0x1d')](respondWithStatusCode(_0x452077,null))['catch'](handleError(_0x452077,null));};exports[_0xf157('0x56')]=function(_0x40a385,_0x17b536){var _0x1edddc=moment()['unix']()[_0xf157('0x57')]();var _0x133895=path[_0xf157('0x58')](config[_0xf157('0x59')],_0xf157('0x5a'),'files',_0xf157('0x5b'));var _0x71b5a8=path[_0xf157('0x58')](config[_0xf157('0x59')],_0xf157('0x5a'),_0xf157('0x5c'),'attachments');var _0x7ff2b6=path[_0xf157('0x58')](_0x133895,_0x1edddc);var _0x3a8772=util['format'](_0xf157('0x5d'),_0x40a385[_0xf157('0x2d')]['id'],_0x1edddc);var _0x86466d=path[_0xf157('0x58')](_0x133895,_0x3a8772);var _0x3daab3=[];_0x3daab3['push']({'model':db[_0xf157('0x5e')],'as':_0xf157('0x5e'),'attributes':['id',_0xf157('0x5f')],'raw':!![]});_0x3daab3[_0xf157('0x60')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xf157('0x61')],'raw':!![]});if(_0x40a385[_0xf157('0x30')][_0xf157('0x62')]){_0x3daab3['push']({'model':db[_0xf157('0x63')],'as':_0xf157('0x63'),'raw':!![]});}var _0x1ba46f=[{'model':db[_0xf157('0x3e')],'as':_0xf157('0x64'),'attributes':['id',_0xf157('0x39'),_0xf157('0x65'),_0xf157('0x66'),_0xf157('0x67'),_0xf157('0x68')],'include':_0x3daab3}];_0x1ba46f[_0xf157('0x60')]({'model':db[_0xf157('0x69')],'as':_0xf157('0x6a'),'attributes':['id',_0xf157('0x21')]});_0x1ba46f[_0xf157('0x60')]({'model':db[_0xf157('0x5e')],'as':_0xf157('0x6b'),'attributes':['id',_0xf157('0x5f')]});return db['WhatsappInteraction'][_0xf157('0x3b')]({'where':{'id':_0x40a385[_0xf157('0x2d')]['id']},'include':_0x1ba46f})[_0xf157('0x1d')](handleEntityNotFound(_0x17b536,null))[_0xf157('0x1d')](function(_0x149bbf){if(_0x149bbf){var _0x43cb4a=_0x149bbf[_0xf157('0x6c')]({'plain':!![]});fs[_0xf157('0x6d')](_0x7ff2b6);var _0x1fb4ee={'channel':'Whatsapp','account':_0x43cb4a['Account'][_0xf157('0x21')],'agent':_0x43cb4a['Owner']?_0x43cb4a[_0xf157('0x6b')][_0xf157('0x5f')]:_0xf157('0x6e'),'createdAt':moment(_0x43cb4a[_0xf157('0x65')])['format'](_0xf157('0x6f'))[_0xf157('0x57')](),'closedAt':_0x43cb4a[_0xf157('0x70')]?moment(_0x43cb4a[_0xf157('0x71')])[_0xf157('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf157('0x57')]():'','disposition':_0x43cb4a[_0xf157('0x72')],'messages':_(_0x43cb4a[_0xf157('0x64')])['filter']({'secret':![]})[_0xf157('0x23')](function(_0x17db12){if(_0x17db12[_0xf157('0x63')]){var _0x40c71a=path[_0xf157('0x58')](_0x71b5a8,_0x17db12['Attachment'][_0xf157('0x73')]);if(fs[_0xf157('0x74')](_0x40c71a)){fs[_0xf157('0x75')](_0x40c71a)[_0xf157('0x76')](fs['createWriteStream'](path[_0xf157('0x58')](_0x7ff2b6,_0x17db12[_0xf157('0x63')]['basename'])));}}return{'date':moment(_0x17db12['createdAt'])[_0xf157('0x4c')](_0xf157('0x6f'))[_0xf157('0x57')](),'sender':_0x17db12[_0xf157('0x66')]===_0xf157('0x77')?_0x17db12[_0xf157('0x5e')]?_0x17db12[_0xf157('0x5e')][_0xf157('0x5f')]:_0xf157('0x78'):_0x17db12[_0xf157('0x79')]['firstName']+(_0x17db12[_0xf157('0x79')][_0xf157('0x61')]?'\x20'+_0x17db12['Contact'][_0xf157('0x61')]:''),'body':_0x17db12[_0xf157('0x63')]?_0x17db12['Attachment']['basename']:_0x17db12[_0xf157('0x39')],'direction':_0x17db12[_0xf157('0x66')]==='out'?'A':'C','secret':_0x17db12['secret'],'read':_0x17db12[_0xf157('0x68')],'attachment':_0x17db12['Attachment']};})[_0xf157('0x7a')]()};return ejs[_0xf157('0x7b')](path[_0xf157('0x58')](config[_0xf157('0x59')],_0xf157('0x5a'),_0xf157('0x7c'),_0xf157('0x7d')),{'interaction':_0x1fb4ee})['then'](function(_0x4689c5){var _0x47a6a4=path[_0xf157('0x58')](_0x7ff2b6,'transcript-'+_0x43cb4a['id']+'-'+_0x1edddc+_0xf157('0x7e'));var _0x16fc80={'path':_0x47a6a4,'channel':_0xf157('0x7f'),'interactionId':_0x43cb4a['id']};return pdf['createPdfFromHTML'](_0x4689c5,_0x16fc80);})[_0xf157('0x1d')](function(){return new BPromise(function(_0x5ab97e,_0xc0c42a){zipdir(_0x7ff2b6,{'saveTo':_0x86466d},function(_0x42b6b1,_0x14ffa8){if(_0x42b6b1)return _0xc0c42a(_0x42b6b1);return _0x5ab97e(_0x14ffa8);});})['then'](function(){return new BPromise(function(_0x44598a,_0x16fd10){rimraf(_0x7ff2b6,function(_0x5e5d5d){if(_0x5e5d5d)_0x16fd10(_0x5e5d5d);return _0x44598a();});});})[_0xf157('0x1d')](function(){return _0x17b536[_0xf157('0x56')](_0x86466d,_0x3a8772,function(_0x59f0ae){if(_0x59f0ae){console[_0xf157('0x80')](_0xf157('0x81'),_0x59f0ae);}else{fs['unlinkSync'](_0x86466d);}});});});}else{return _0x17b536['sendStatus'](0xc8);}})[_0xf157('0x2b')](handleError(_0x17b536,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 158bc16..70d4d60 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 _0x028d=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0xddcd56,_0x3465ed){var _0x4ef1fd=function(_0x4d11e7){while(--_0x4d11e7){_0xddcd56['push'](_0xddcd56['shift']());}};_0x4ef1fd(++_0x3465ed);}(_0x028d,0xff));var _0xd028=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x028d[_0x1ebc6c];return _0x3a826d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd028('0x0'))['db'][_0xd028('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xd028('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd028('0x3')](0x0);var events={'afterCreate':_0xd028('0x4'),'afterUpdate':_0xd028('0x5'),'afterDestroy':_0xd028('0x6')};function emitEvent(_0x67d150){return function(_0x5094d8,_0x153af8,_0x4592fd){_0x5094d8[_0xd028('0x7')]({'attributes':['id'],'raw':!![]})[_0xd028('0x8')](function(_0x110b50){_0x5094d8[_0xd028('0x9')](_0xd028('0xa'),_0x110b50[_0xd028('0xb')](function(_0xadea4b){return{'id':_0xadea4b['id']};}));return WhatsappMessage[_0xd028('0xc')]({'where':{'WhatsappInteractionId':_0x5094d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd028('0x8')](function(_0x1211c6){_0x5094d8[_0xd028('0x9')](_0xd028('0xd'),_0x1211c6['length']);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150+':'+_0x5094d8['id'],_0x5094d8);WhatsappInteractionEvents[_0xd028('0xe')](_0x67d150,_0x5094d8);_0x4592fd(null);})[_0xd028('0xf')](_0x4592fd(null));};}for(var e in events){if(events[_0xd028('0x10')](e)){var event=events[e];WhatsappInteraction[_0xd028('0x11')](e,emitEvent(event));}}module[_0xd028('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xb910=['remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update'];(function(_0x20848c,_0x1498fe){var _0x2d83ab=function(_0x54c33b){while(--_0x54c33b){_0x20848c['push'](_0x20848c['shift']());}};_0x2d83ab(++_0x1498fe);}(_0xb910,0x12b));var _0x0b91=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb910[_0x75f869];return _0x10af8b;};'use strict';var EventEmitter=require(_0x0b91('0x0'));var WhatsappInteraction=require(_0x0b91('0x1'))['db'][_0x0b91('0x2')];var WhatsappMessage=require(_0x0b91('0x1'))['db'][_0x0b91('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0b91('0x4')](0x0);var events={'afterCreate':_0x0b91('0x5'),'afterUpdate':_0x0b91('0x6'),'afterDestroy':_0x0b91('0x7')};function emitEvent(_0x1bfbc7){return function(_0x432232,_0x28d88b,_0x295749){_0x432232[_0x0b91('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x156fd1){_0x432232[_0x0b91('0x9')](_0x0b91('0xa'),_0x156fd1[_0x0b91('0xb')](function(_0x44c97f){return{'id':_0x44c97f['id']};}));return WhatsappMessage[_0x0b91('0xc')]({'where':{'WhatsappInteractionId':_0x432232['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0b91('0xd')](function(_0x13b9b7){_0x432232[_0x0b91('0x9')]('unreadMessages',_0x13b9b7[_0x0b91('0xe')]);WhatsappInteractionEvents['emit'](_0x1bfbc7+':'+_0x432232['id'],_0x432232);WhatsappInteractionEvents[_0x0b91('0xf')](_0x1bfbc7,_0x432232);_0x295749(null);})['catch'](_0x295749(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x0b91('0x10')](e,emitEvent(event));}}module[_0x0b91('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 fa5db7f..c9a6ce4 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 _0xd983=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash'];(function(_0x423184,_0x2a2af2){var _0x5050a1=function(_0x39bfef){while(--_0x39bfef){_0x423184['push'](_0x423184['shift']());}};_0x5050a1(++_0x2a2af2);}(_0xd983,0x1df));var _0x3d98=function(_0x56120c,_0x4b188b){_0x56120c=_0x56120c-0x0;var _0x516295=_0xd983[_0x56120c];return _0x516295;};'use strict';var _=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var logger=require(_0x3d98('0x2'))(_0x3d98('0x3'));var moment=require(_0x3d98('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d98('0x5'));var rimraf=require(_0x3d98('0x6'));var config=require(_0x3d98('0x7'));var attributes=require(_0x3d98('0x8'));module[_0x3d98('0x9')]=function(_0x3e32c6,_0x394587){return _0x3e32c6['define'](_0x3d98('0xa'),attributes,{'tableName':_0x3d98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd1051d,_0x216a00,_0x1a9f37){if(_0xd1051d[_0x3d98('0xc')](_0x3d98('0xd'))){_0xd1051d[_0x3d98('0xe')]=moment()[_0x3d98('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a9f37(null,_0xd1051d);}}});}; \ No newline at end of file +var _0x62f8=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0x62f8,0xec));var _0x862f=function(_0x3a54ca,_0x5ec382){_0x3a54ca=_0x3a54ca-0x0;var _0x552e9e=_0x62f8[_0x3a54ca];return _0x552e9e;};'use strict';var _=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var logger=require(_0x862f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x862f('0x3'));var rp=require(_0x862f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x862f('0x5'));var attributes=require(_0x862f('0x6'));module[_0x862f('0x7')]=function(_0x2368e4,_0xd388c5){return _0x2368e4['define'](_0x862f('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50b65d,_0x2bfa87,_0x3d5b2d){if(_0x50b65d[_0x862f('0x9')](_0x862f('0xa'))){_0x50b65d['closedAt']=moment()[_0x862f('0xb')](_0x862f('0xc'));}_0x3d5b2d(null,_0x50b65d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 96f214d..239a6ba 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 _0x2802=['where','attributes','limit','debug','AddTagsToWhatsappInteraction','body','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2802,0x8f));var _0x2280=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x2802[_0x1347f8];return _0x218368;};'use strict';var _=require(_0x2280('0x0'));var util=require(_0x2280('0x1'));var moment=require(_0x2280('0x2'));var BPromise=require(_0x2280('0x3'));var rs=require(_0x2280('0x4'));var fs=require('fs');var Redis=require(_0x2280('0x5'));var db=require(_0x2280('0x6'))['db'];var utils=require(_0x2280('0x7'));var logger=require(_0x2280('0x8'))(_0x2280('0x9'));var config=require(_0x2280('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2280('0xb')][_0x2280('0xc')]({'port':0x232a});config[_0x2280('0xd')]=_[_0x2280('0xe')](config[_0x2280('0xd')],{'host':_0x2280('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2280('0x10'))[_0x2280('0x11')](socket);function respondWithRpcPromise(_0x33ed3d,_0x4e6e9a,_0x33d344){return new BPromise(function(_0x67e1d5,_0x4c3248){return client[_0x2280('0x12')](_0x33ed3d,_0x33d344)[_0x2280('0x13')](function(_0x17914d){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4e6e9a,_0x2280('0x14'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4e6e9a,_0x2280('0x14'),JSON[_0x2280('0x15')](_0x17914d));if(_0x17914d['error']){if(_0x17914d[_0x2280('0x16')][_0x2280('0x17')]===0x1f4){logger['error'](_0x2280('0x18'),_0x4e6e9a,_0x17914d[_0x2280('0x16')][_0x2280('0x19')]);return _0x4c3248(_0x17914d[_0x2280('0x16')][_0x2280('0x19')]);}logger[_0x2280('0x16')](_0x2280('0x18'),_0x4e6e9a,_0x17914d[_0x2280('0x16')][_0x2280('0x19')]);return _0x67e1d5(_0x17914d[_0x2280('0x16')][_0x2280('0x19')]);}else{logger[_0x2280('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0x4e6e9a,'request\x20sent');_0x67e1d5(_0x17914d[_0x2280('0x1b')]['message']);}})['catch'](function(_0x187181){logger[_0x2280('0x16')](_0x2280('0x18'),_0x4e6e9a,_0x187181);_0x4c3248(_0x187181);});});}exports[_0x2280('0x1c')]=function(_0x2c69cb){var _0x1634f5=this;return new Promise(function(_0x15393f,_0x53148c){return db[_0x2280('0x1d')][_0x2280('0x1e')](_0x2c69cb['body'],{'raw':_0x2c69cb[_0x2280('0x1f')]?_0x2c69cb[_0x2280('0x1f')][_0x2280('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c69cb[_0x2280('0x1f')]?_0x2c69cb[_0x2280('0x1f')][_0x2280('0x21')]||null:null,'attributes':_0x2c69cb[_0x2280('0x1f')]?_0x2c69cb[_0x2280('0x1f')][_0x2280('0x22')]||null:null,'limit':_0x2c69cb[_0x2280('0x1f')]?_0x2c69cb[_0x2280('0x1f')][_0x2280('0x23')]||null:null})[_0x2280('0x13')](function(_0x25df3e){logger[_0x2280('0x1a')](_0x2280('0x1c'),_0x2c69cb);logger[_0x2280('0x24')](_0x2280('0x1c'),_0x2c69cb,JSON[_0x2280('0x15')](_0x25df3e));_0x15393f(_0x25df3e);})['catch'](function(_0x589106){logger[_0x2280('0x16')]('UpdateWhatsappInteraction',_0x589106[_0x2280('0x19')],_0x2c69cb);_0x53148c(_0x1634f5['error'](0x1f4,_0x589106['message']));});});};exports[_0x2280('0x25')]=function(_0x724595){return new Promise(function(_0x3960a6,_0x3fd3d7){return db[_0x2280('0x1d')]['find']({'where':_0x724595[_0x2280('0x1f')]?_0x724595['options'][_0x2280('0x21')]||null:null})[_0x2280('0x13')](function(_0x2eb0ea){if(_0x2eb0ea){return _0x2eb0ea['addTags'](_0x724595[_0x2280('0x26')][_0x2280('0x27')],_[_0x2280('0x28')](_0x724595[_0x2280('0x26')],[_0x2280('0x27'),'id'])||{});}})[_0x2280('0x29')](function(_0x2ecee9){logger['info'](_0x2280('0x2a'),_0x724595);logger[_0x2280('0x24')](_0x2280('0x2a'),_0x724595,JSON[_0x2280('0x15')](_0x2ecee9));_0x3960a6(_0x2ecee9);})[_0x2280('0x2b')](function(_0x503033){logger[_0x2280('0x16')]('AddTags',_0x503033[_0x2280('0x19')],_0x724595);_0x3fd3d7(_this[_0x2280('0x16')](0x1f4,_0x503033[_0x2280('0x19')]));});});}; \ No newline at end of file +var _0xd802=['rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','catch','then','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4f81a5,_0x10432a){var _0x7be2b7=function(_0x35b8b0){while(--_0x35b8b0){_0x4f81a5['push'](_0x4f81a5['shift']());}};_0x7be2b7(++_0x10432a);}(_0xd802,0x169));var _0x2d80=function(_0x266945,_0x5c5e8c){_0x266945=_0x266945-0x0;var _0x4477d5=_0xd802[_0x266945];return _0x4477d5;};'use strict';var _=require(_0x2d80('0x0'));var util=require(_0x2d80('0x1'));var moment=require(_0x2d80('0x2'));var BPromise=require(_0x2d80('0x3'));var rs=require(_0x2d80('0x4'));var fs=require('fs');var Redis=require(_0x2d80('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d80('0x6'));var logger=require(_0x2d80('0x7'))(_0x2d80('0x8'));var config=require(_0x2d80('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2d80('0xa')]=_[_0x2d80('0xb')](config['redis'],{'host':_0x2d80('0xc'),'port':0x18eb});var socket=require(_0x2d80('0xd'))(new Redis(config['redis']));require(_0x2d80('0xe'))[_0x2d80('0xf')](socket);function respondWithRpcPromise(_0x157bdb,_0x3dc07b,_0x5ea25a){return new BPromise(function(_0x141ce6,_0x59e008){return client[_0x2d80('0x10')](_0x157bdb,_0x5ea25a)['then'](function(_0x45bdd4){logger[_0x2d80('0x11')](_0x2d80('0x12'),_0x3dc07b,_0x2d80('0x13'));logger[_0x2d80('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3dc07b,_0x2d80('0x13'),JSON['stringify'](_0x45bdd4));if(_0x45bdd4['error']){if(_0x45bdd4[_0x2d80('0x15')][_0x2d80('0x16')]===0x1f4){logger[_0x2d80('0x15')](_0x2d80('0x12'),_0x3dc07b,_0x45bdd4['error'][_0x2d80('0x17')]);return _0x59e008(_0x45bdd4[_0x2d80('0x15')][_0x2d80('0x17')]);}logger[_0x2d80('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3dc07b,_0x45bdd4[_0x2d80('0x15')][_0x2d80('0x17')]);return _0x141ce6(_0x45bdd4['error']['message']);}else{logger[_0x2d80('0x11')](_0x2d80('0x12'),_0x3dc07b,_0x2d80('0x13'));_0x141ce6(_0x45bdd4[_0x2d80('0x18')][_0x2d80('0x17')]);}})['catch'](function(_0x58f351){logger[_0x2d80('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3dc07b,_0x58f351);_0x59e008(_0x58f351);});});}exports[_0x2d80('0x19')]=function(_0x96d04c){var _0x11e5b4=this;return new Promise(function(_0x181040,_0xb3b00e){return db[_0x2d80('0x1a')][_0x2d80('0x1b')](_0x96d04c[_0x2d80('0x1c')],{'raw':_0x96d04c[_0x2d80('0x1d')]?_0x96d04c[_0x2d80('0x1d')][_0x2d80('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96d04c[_0x2d80('0x1d')]?_0x96d04c['options'][_0x2d80('0x1f')]||null:null,'attributes':_0x96d04c[_0x2d80('0x1d')]?_0x96d04c[_0x2d80('0x1d')][_0x2d80('0x20')]||null:null,'limit':_0x96d04c['options']?_0x96d04c[_0x2d80('0x1d')]['limit']||null:null})['then'](function(_0x517b4b){logger[_0x2d80('0x11')](_0x2d80('0x19'),_0x96d04c);logger[_0x2d80('0x14')](_0x2d80('0x19'),_0x96d04c,JSON['stringify'](_0x517b4b));_0x181040(_0x517b4b);})[_0x2d80('0x21')](function(_0xd66d04){logger[_0x2d80('0x15')](_0x2d80('0x19'),_0xd66d04[_0x2d80('0x17')],_0x96d04c);_0xb3b00e(_0x11e5b4[_0x2d80('0x15')](0x1f4,_0xd66d04[_0x2d80('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x12dc0f){return new Promise(function(_0x412f41,_0x1022e6){return db[_0x2d80('0x1a')]['find']({'where':_0x12dc0f['options']?_0x12dc0f[_0x2d80('0x1d')][_0x2d80('0x1f')]||null:null})[_0x2d80('0x22')](function(_0x149728){if(_0x149728){return _0x149728[_0x2d80('0x23')](_0x12dc0f[_0x2d80('0x1c')][_0x2d80('0x24')],_[_0x2d80('0x25')](_0x12dc0f[_0x2d80('0x1c')],[_0x2d80('0x24'),'id'])||{});}})[_0x2d80('0x26')](function(_0x5bc566){logger[_0x2d80('0x11')](_0x2d80('0x27'),_0x12dc0f);logger[_0x2d80('0x14')](_0x2d80('0x27'),_0x12dc0f,JSON[_0x2d80('0x28')](_0x5bc566));_0x412f41(_0x5bc566);})[_0x2d80('0x21')](function(_0x5e1910){logger[_0x2d80('0x15')](_0x2d80('0x27'),_0x5e1910['message'],_0x12dc0f);_0x1022e6(_this[_0x2d80('0x15')](0x1f4,_0x5e1910[_0x2d80('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6570c8c..eb330b0 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 _0xd8af=['emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x5c8bf4,_0x30b541){var _0x387d8a=function(_0x5aef51){while(--_0x5aef51){_0x5c8bf4['push'](_0x5c8bf4['shift']());}};_0x387d8a(++_0x30b541);}(_0xd8af,0xac));var _0xfd8a=function(_0x2920ce,_0x149060){_0x2920ce=_0x2920ce-0x0;var _0x216e9a=_0xd8af[_0x2920ce];return _0x216e9a;};'use strict';var WhatsappInteractionEvents=require(_0xfd8a('0x0'));var events=[_0xfd8a('0x1'),_0xfd8a('0x2'),_0xfd8a('0x3')];function createListener(_0x5b9a43,_0x1d50bc){return function(_0x420c51){_0x1d50bc[_0xfd8a('0x4')](_0x5b9a43,_0x420c51);};}function removeListener(_0x4243ed,_0x447e2b){return function(){WhatsappInteractionEvents['removeListener'](_0x4243ed,_0x447e2b);};}exports[_0xfd8a('0x5')]=function(_0x1e325e){for(var _0x5df0b1=0x0,_0xaefe19=events[_0xfd8a('0x6')];_0x5df0b1<_0xaefe19;_0x5df0b1++){var _0x20e723=events[_0x5df0b1];var _0x593f95=createListener(_0xfd8a('0x7')+_0x20e723,_0x1e325e);WhatsappInteractionEvents['on'](_0x20e723,_0x593f95);}}; \ No newline at end of file +var _0xaf10=['./whatsappInteraction.events','save','update','register','length','whatsappInteraction:'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xaf10,0xf0));var _0x0af1=function(_0x474afa,_0x3f52a4){_0x474afa=_0x474afa-0x0;var _0x43b336=_0xaf10[_0x474afa];return _0x43b336;};'use strict';var WhatsappInteractionEvents=require(_0x0af1('0x0'));var events=[_0x0af1('0x1'),'remove',_0x0af1('0x2')];function createListener(_0x3788b2,_0x2f1ff2){return function(_0x5ad7ad){_0x2f1ff2['emit'](_0x3788b2,_0x5ad7ad);};}function removeListener(_0x222245,_0x17cc93){return function(){WhatsappInteractionEvents['removeListener'](_0x222245,_0x17cc93);};}exports[_0x0af1('0x3')]=function(_0x5ecff8){for(var _0x5d4795=0x0,_0xe52596=events[_0x0af1('0x4')];_0x5d4795<_0xe52596;_0x5d4795++){var _0x29a964=events[_0x5d4795];var _0xd53610=createListener(_0x0af1('0x5')+_0x29a964,_0x5ecff8);WhatsappInteractionEvents['on'](_0x29a964,_0xd53610);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 47bce05..3aed46d 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 _0x02b1=['describe','/:id','post','tracked','whatsappmessage:create','/:id/status','status','put','update','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0x02b1,0x76));var _0x102b=function(_0x513fa1,_0x11f2e9){_0x513fa1=_0x513fa1-0x0;var _0x2c715e=_0x02b1[_0x513fa1];return _0x2c715e;};'use strict';var multer=require(_0x102b('0x0'));var util=require(_0x102b('0x1'));var path=require(_0x102b('0x2'));var timeout=require(_0x102b('0x3'));var express=require(_0x102b('0x4'));var router=express[_0x102b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x102b('0x6'));var config=require(_0x102b('0x7'));var controller=require(_0x102b('0x8'));router[_0x102b('0x9')]('/',auth[_0x102b('0xa')](),controller['index']);router[_0x102b('0x9')](_0x102b('0xb'),auth[_0x102b('0xa')](),controller[_0x102b('0xc')]);router[_0x102b('0x9')](_0x102b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x102b('0xe')]('/',auth[_0x102b('0xa')](),interaction[_0x102b('0xf')]('whatsapp',_0x102b('0x10')),controller['create']);router['post'](_0x102b('0x11'),controller[_0x102b('0x12')]);router[_0x102b('0x13')](_0x102b('0xd'),auth[_0x102b('0xa')](),controller[_0x102b('0x14')]);router['put']('/:id/accept',auth[_0x102b('0xa')](),controller[_0x102b('0x15')]);router[_0x102b('0x13')](_0x102b('0x16'),auth[_0x102b('0xa')](),controller[_0x102b('0x17')]);router['delete'](_0x102b('0xd'),auth['isAuthenticated'](),controller[_0x102b('0x18')]);module[_0x102b('0x19')]=router; \ No newline at end of file +var _0x29d5=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','tracked','whatsapp','whatsappmessage:create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x49f1dc,_0x359c51){var _0x442d8c=function(_0x4fd3bb){while(--_0x4fd3bb){_0x49f1dc['push'](_0x49f1dc['shift']());}};_0x442d8c(++_0x359c51);}(_0x29d5,0xc4));var _0x529d=function(_0x792207,_0x13e198){_0x792207=_0x792207-0x0;var _0x1b99c8=_0x29d5[_0x792207];return _0x1b99c8;};'use strict';var multer=require(_0x529d('0x0'));var util=require(_0x529d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x529d('0x2')]();var fs_extra=require(_0x529d('0x3'));var auth=require(_0x529d('0x4'));var interaction=require(_0x529d('0x5'));var config=require(_0x529d('0x6'));var controller=require(_0x529d('0x7'));router['get']('/',auth[_0x529d('0x8')](),controller[_0x529d('0x9')]);router['get'](_0x529d('0xa'),auth[_0x529d('0x8')](),controller[_0x529d('0xb')]);router[_0x529d('0xc')](_0x529d('0xd'),auth[_0x529d('0x8')](),controller[_0x529d('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x529d('0xf')](_0x529d('0x10'),_0x529d('0x11')),controller['create']);router[_0x529d('0x12')]('/:id/status',controller[_0x529d('0x13')]);router[_0x529d('0x14')](_0x529d('0xd'),auth['isAuthenticated'](),controller[_0x529d('0x15')]);router[_0x529d('0x14')](_0x529d('0x16'),auth['isAuthenticated'](),controller[_0x529d('0x17')]);router[_0x529d('0x14')](_0x529d('0x18'),auth[_0x529d('0x8')](),controller[_0x529d('0x19')]);router[_0x529d('0x1a')](_0x529d('0xd'),auth[_0x529d('0x8')](),controller[_0x529d('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 151c4b6..6ddae99 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 _0x0830=['sequelize','exports','medium','ENUM','out','STRING','BOOLEAN','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0830,0xd0));var _0x0083=function(_0x32b30c,_0x4c5567){_0x32b30c=_0x32b30c-0x0;var _0x59bc79=_0x0830[_0x32b30c];return _0x59bc79;};'use strict';var Sequelize=require(_0x0083('0x0'));module[_0x0083('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0083('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0083('0x3')]('in',_0x0083('0x4')),'defaultValue':_0x0083('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0083('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0083('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0083('0x5')]},'providerResponse':{'type':Sequelize[_0x0083('0x7')]}}; \ No newline at end of file +var _0xeedb=['medium','BOOLEAN','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x1b57ab,_0x5b8b1b){var _0x331f67=function(_0x3b8dcc){while(--_0x3b8dcc){_0x1b57ab['push'](_0x1b57ab['shift']());}};_0x331f67(++_0x5b8b1b);}(_0xeedb,0xc6));var _0xbeed=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xeedb[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xbeed('0x0'));module[_0xbeed('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbeed('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbeed('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbeed('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbeed('0x5')]},'readAt':{'type':Sequelize[_0xbeed('0x6')]},'secret':{'type':Sequelize[_0xbeed('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbeed('0x5')]},'providerResponse':{'type':Sequelize[_0xbeed('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 7331e41..3f6264c 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 _0xaa31=['params','length','merge','create','body','find','describe','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','fullname','email','internal','interface','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','contact','SIP/%s','event','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x16664a,_0x454cd0){var _0x280d12=function(_0x3fa850){while(--_0x3fa850){_0x16664a['push'](_0x16664a['shift']());}};_0x280d12(++_0x454cd0);}(_0xaa31,0x149));var _0x1aa3=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xaa31[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x1aa3('0x0'));var rimraf=require(_0x1aa3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1aa3('0x2'));var moment=require(_0x1aa3('0x3'));var BPromise=require(_0x1aa3('0x4'));var Mustache=require(_0x1aa3('0x5'));var util=require('util');var path=require(_0x1aa3('0x6'));var sox=require(_0x1aa3('0x7'));var csv=require(_0x1aa3('0x8'));var ejs=require(_0x1aa3('0x9'));var fs=require('fs');var fs_extra=require(_0x1aa3('0xa'));var _=require('lodash');var squel=require(_0x1aa3('0xb'));var crypto=require(_0x1aa3('0xc'));var jsforce=require(_0x1aa3('0xd'));var deskjs=require(_0x1aa3('0xe'));var toCsv=require(_0x1aa3('0x8'));var querystring=require(_0x1aa3('0xf'));var Papa=require('papaparse');var Redis=require(_0x1aa3('0x10'));var authService=require(_0x1aa3('0x11'));var qs=require(_0x1aa3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aa3('0x13'));var logger=require(_0x1aa3('0x14'))(_0x1aa3('0x15'));var utils=require(_0x1aa3('0x16'));var config=require(_0x1aa3('0x17'));var licenseUtil=require(_0x1aa3('0x18'));var db=require('../../mysqldb')['db'];config[_0x1aa3('0x19')]=_[_0x1aa3('0x1a')](config['redis'],{'host':_0x1aa3('0x1b'),'port':0x18eb});var socket=require(_0x1aa3('0x1c'))(new Redis(config['redis']));require(_0x1aa3('0x1d'))[_0x1aa3('0x1e')](socket);var jayson=require(_0x1aa3('0x1f'));var client=jayson['client'][_0x1aa3('0x20')]({'port':0x232c});var client9002=jayson[_0x1aa3('0x21')][_0x1aa3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xe20296,_0x374211,_0x3da644,_0xa5b168){return new BPromise(function(_0x1c57d5,_0x218e35){var _0x2d853b=_0xa5b168||client;return _0x2d853b['request'](_0xe20296,_0x3da644)[_0x1aa3('0x22')](function(_0x151f05){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x374211,_0x1aa3('0x23'));logger[_0x1aa3('0x24')](_0x1aa3('0x25'),_0x374211,_0x1aa3('0x23'),JSON['stringify'](_0x151f05));if(_0x151f05[_0x1aa3('0x26')]){if(_0x151f05['error'][_0x1aa3('0x27')]===0x1f4){logger[_0x1aa3('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x374211,_0x151f05[_0x1aa3('0x26')][_0x1aa3('0x28')]);return _0x218e35(_0x151f05[_0x1aa3('0x26')]['message']);}logger[_0x1aa3('0x26')](_0x1aa3('0x29'),_0x374211,_0x151f05[_0x1aa3('0x26')][_0x1aa3('0x28')]);return _0x1c57d5(_0x151f05['error'][_0x1aa3('0x28')]);}else{logger[_0x1aa3('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x374211,_0x1aa3('0x23'));_0x1c57d5(_0x151f05[_0x1aa3('0x2b')]['message']);}})[_0x1aa3('0x2c')](function(_0x2f1c80){logger[_0x1aa3('0x26')](_0x1aa3('0x29'),_0x374211,_0x2f1c80);_0x218e35(_0x2f1c80);});});}function respondWithStatusCode(_0x39eaae,_0x428bc5){_0x428bc5=_0x428bc5||0xcc;return function(_0x271e47){if(_0x271e47){return _0x39eaae['sendStatus'](_0x428bc5);}return _0x39eaae[_0x1aa3('0x2d')](_0x428bc5)[_0x1aa3('0x2e')]();};}function respondWithResult(_0x118005,_0x930596){_0x930596=_0x930596||0xc8;return function(_0x1613ee){if(_0x1613ee){return _0x118005[_0x1aa3('0x2d')](_0x930596)[_0x1aa3('0x2f')](_0x1613ee);}};}function respondWithFilteredResult(_0x13e3ed,_0x531d58){return function(_0x2e6360){if(_0x2e6360){var _0x1ab0bd=typeof _0x531d58[_0x1aa3('0x30')]===_0x1aa3('0x31')&&typeof _0x531d58[_0x1aa3('0x32')]===_0x1aa3('0x31');var _0x10eeb5=_0x2e6360[_0x1aa3('0x33')];var _0x392aa2=_0x1ab0bd?0x0:_0x531d58[_0x1aa3('0x30')];var _0x551574=_0x1ab0bd?_0x2e6360[_0x1aa3('0x33')]:_0x531d58[_0x1aa3('0x30')]+_0x531d58[_0x1aa3('0x32')];var _0x1e7894;if(_0x551574>=_0x10eeb5){_0x551574=_0x10eeb5;_0x1e7894=0xc8;}else{_0x1e7894=0xce;}_0x13e3ed['status'](_0x1e7894);return _0x13e3ed['set'](_0x1aa3('0x34'),_0x392aa2+'-'+_0x551574+'/'+_0x10eeb5)[_0x1aa3('0x2f')](_0x2e6360);}return null;};}function patchUpdates(_0x4fa142){return function(_0x301d0b){try{jsonpatch['apply'](_0x301d0b,_0x4fa142,!![]);}catch(_0x30a72d){return BPromise[_0x1aa3('0x35')](_0x30a72d);}return _0x301d0b['save']();};}function saveUpdates(_0x1d7ac,_0x529d5e){return function(_0x3ead67){if(_0x3ead67){return _0x3ead67[_0x1aa3('0x36')](_0x1d7ac)[_0x1aa3('0x22')](function(_0x18064e){return _0x18064e;});}return null;};}function removeEntity(_0x1ed9be,_0x2da880){return function(_0x98aa47){if(_0x98aa47){return _0x98aa47[_0x1aa3('0x37')]()['then'](function(){_0x1ed9be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x336994,_0x3cedcf){return function(_0x214867){if(!_0x214867){_0x336994[_0x1aa3('0x38')](0x194);}return _0x214867;};}function handleError(_0x5be6d7,_0x4c967f){_0x4c967f=_0x4c967f||0x1f4;return function(_0x12696d){logger[_0x1aa3('0x26')](_0x12696d[_0x1aa3('0x39')]);if(_0x12696d['name']){delete _0x12696d[_0x1aa3('0x3a')];}_0x5be6d7['status'](_0x4c967f)[_0x1aa3('0x3b')](_0x12696d);};}exports[_0x1aa3('0x3c')]=function(_0x4ed339,_0x26a4bf){var _0x3b80c1={},_0x4dc3ef={},_0x5d8da0={'count':0x0,'rows':[]};var _0x2c3529=_[_0x1aa3('0x3d')](db[_0x1aa3('0x3e')][_0x1aa3('0x3f')],function(_0x4eb9a2){return{'name':_0x4eb9a2[_0x1aa3('0x40')],'type':_0x4eb9a2[_0x1aa3('0x41')][_0x1aa3('0x42')]};});_0x4dc3ef['model']=_[_0x1aa3('0x3d')](_0x2c3529,_0x1aa3('0x3a'));_0x4dc3ef[_0x1aa3('0x43')]=_[_0x1aa3('0x44')](_0x4ed339[_0x1aa3('0x43')]);_0x4dc3ef['filters']=_[_0x1aa3('0x45')](_0x4dc3ef[_0x1aa3('0x46')],_0x4dc3ef['query']);_0x3b80c1[_0x1aa3('0x47')]=_[_0x1aa3('0x45')](_0x4dc3ef['model'],qs[_0x1aa3('0x48')](_0x4ed339[_0x1aa3('0x43')]['fields']));_0x3b80c1['attributes']=_0x3b80c1['attributes']['length']?_0x3b80c1[_0x1aa3('0x47')]:_0x4dc3ef[_0x1aa3('0x46')];if(!_0x4ed339['query']['hasOwnProperty'](_0x1aa3('0x49'))){_0x3b80c1[_0x1aa3('0x32')]=qs['limit'](_0x4ed339[_0x1aa3('0x43')][_0x1aa3('0x32')]);_0x3b80c1[_0x1aa3('0x30')]=qs[_0x1aa3('0x30')](_0x4ed339['query']['offset']);}_0x3b80c1['order']=qs['sort'](_0x4ed339[_0x1aa3('0x43')][_0x1aa3('0x4a')]);_0x3b80c1[_0x1aa3('0x4b')]=qs[_0x1aa3('0x4c')](_[_0x1aa3('0x4d')](_0x4ed339[_0x1aa3('0x43')],_0x4dc3ef[_0x1aa3('0x4c')]),_0x2c3529);if(_0x4ed339[_0x1aa3('0x43')]['filter']){_0x3b80c1[_0x1aa3('0x4b')]=_['merge'](_0x3b80c1[_0x1aa3('0x4b')],{'$or':_[_0x1aa3('0x3d')](_0x2c3529,function(_0x2f9c9f){if(_0x2f9c9f[_0x1aa3('0x41')]!==_0x1aa3('0x4e')){var _0x36606b={};_0x36606b[_0x2f9c9f[_0x1aa3('0x3a')]]={'$like':'%'+_0x4ed339[_0x1aa3('0x43')]['filter']+'%'};return _0x36606b;}})});}_0x3b80c1=_['merge']({},_0x3b80c1,_0x4ed339[_0x1aa3('0x4f')]);var _0x3f93d1={'where':_0x3b80c1[_0x1aa3('0x4b')]};return db[_0x1aa3('0x3e')][_0x1aa3('0x33')](_0x3f93d1)[_0x1aa3('0x22')](function(_0x35d8f8){_0x5d8da0[_0x1aa3('0x33')]=_0x35d8f8;if(_0x4ed339[_0x1aa3('0x43')][_0x1aa3('0x50')]){_0x3b80c1[_0x1aa3('0x51')]=[{'all':!![]}];}return db[_0x1aa3('0x3e')][_0x1aa3('0x52')](_0x3b80c1);})[_0x1aa3('0x22')](function(_0x5588dc){_0x5d8da0[_0x1aa3('0x53')]=_0x5588dc;return _0x5d8da0;})[_0x1aa3('0x22')](respondWithFilteredResult(_0x26a4bf,_0x3b80c1))['catch'](handleError(_0x26a4bf,null));};exports[_0x1aa3('0x54')]=function(_0x4e53ca,_0x54f029){var _0x10f806={'raw':!![],'where':{'id':_0x4e53ca[_0x1aa3('0x55')]['id']}},_0x23fa8d={};_0x23fa8d[_0x1aa3('0x46')]=_[_0x1aa3('0x44')](db[_0x1aa3('0x3e')]['rawAttributes']);_0x23fa8d[_0x1aa3('0x43')]=_[_0x1aa3('0x44')](_0x4e53ca[_0x1aa3('0x43')]);_0x23fa8d[_0x1aa3('0x4c')]=_['intersection'](_0x23fa8d[_0x1aa3('0x46')],_0x23fa8d['query']);_0x10f806['attributes']=_[_0x1aa3('0x45')](_0x23fa8d['model'],qs[_0x1aa3('0x48')](_0x4e53ca['query'][_0x1aa3('0x48')]));_0x10f806['attributes']=_0x10f806[_0x1aa3('0x47')][_0x1aa3('0x56')]?_0x10f806[_0x1aa3('0x47')]:_0x23fa8d[_0x1aa3('0x46')];if(_0x4e53ca[_0x1aa3('0x43')][_0x1aa3('0x50')]){_0x10f806[_0x1aa3('0x51')]=[{'all':!![]}];}_0x10f806=_[_0x1aa3('0x57')]({},_0x10f806,_0x4e53ca['options']);return db[_0x1aa3('0x3e')]['find'](_0x10f806)[_0x1aa3('0x22')](handleEntityNotFound(_0x54f029,null))[_0x1aa3('0x22')](respondWithResult(_0x54f029,null))[_0x1aa3('0x2c')](handleError(_0x54f029,null));};exports[_0x1aa3('0x58')]=function(_0x919209,_0x521182){return db[_0x1aa3('0x3e')][_0x1aa3('0x58')](_0x919209[_0x1aa3('0x59')],{})[_0x1aa3('0x22')](respondWithResult(_0x521182,0xc9))['catch'](handleError(_0x521182,null));};exports[_0x1aa3('0x36')]=function(_0x689a63,_0x23ccb2){if(_0x689a63[_0x1aa3('0x59')]['id']){delete _0x689a63[_0x1aa3('0x59')]['id'];}return db['WhatsappMessage'][_0x1aa3('0x5a')]({'where':{'id':_0x689a63[_0x1aa3('0x55')]['id']}})['then'](handleEntityNotFound(_0x23ccb2,null))[_0x1aa3('0x22')](saveUpdates(_0x689a63[_0x1aa3('0x59')],null))[_0x1aa3('0x22')](respondWithResult(_0x23ccb2,null))[_0x1aa3('0x2c')](handleError(_0x23ccb2,null));};exports[_0x1aa3('0x37')]=function(_0x27def8,_0x20ae6f){return db['WhatsappMessage'][_0x1aa3('0x5a')]({'where':{'id':_0x27def8[_0x1aa3('0x55')]['id']}})[_0x1aa3('0x22')](handleEntityNotFound(_0x20ae6f,null))[_0x1aa3('0x22')](removeEntity(_0x20ae6f,null))[_0x1aa3('0x2c')](handleError(_0x20ae6f,null));};exports[_0x1aa3('0x5b')]=function(_0x1d56aa,_0x75c053){return db[_0x1aa3('0x3e')][_0x1aa3('0x5b')]()[_0x1aa3('0x22')](respondWithResult(_0x75c053,null))[_0x1aa3('0x2c')](handleError(_0x75c053,null));};var interaction_log=require(_0x1aa3('0x14'))(_0x1aa3('0x5c'));exports[_0x1aa3('0x5d')]=function(_0x11391d,_0x1be3d5,_0x39f0c7){var _0x5592fa={'agent':{},'channel':'whatsapp'};if(_0x11391d[_0x1aa3('0x59')]['id']){delete _0x11391d[_0x1aa3('0x59')]['id'];}_0x11391d[_0x1aa3('0x59')]['read']=!![];_0x11391d[_0x1aa3('0x59')][_0x1aa3('0x5e')]=moment()[_0x1aa3('0x5f')](_0x1aa3('0x60'));_0x11391d[_0x1aa3('0x59')][_0x1aa3('0x61')]=_0x11391d[_0x1aa3('0x59')][_0x1aa3('0x61')]||_0x11391d[_0x1aa3('0x62')]['id'];_0x5592fa[_0x1aa3('0x63')]['id']=_0x11391d[_0x1aa3('0x59')][_0x1aa3('0x61')];return db[_0x1aa3('0x3e')][_0x1aa3('0x5a')]({'where':{'id':_0x11391d['params']['id'],'UserId':null}})[_0x1aa3('0x22')](handleEntityNotFound(_0x1be3d5,null))[_0x1aa3('0x22')](saveUpdates(_0x11391d['body'],null))[_0x1aa3('0x22')](function(_0x2083b0){if(_0x2083b0){_0x5592fa[_0x1aa3('0x28')]=_0x2083b0['get']({'plain':!![]});return db[_0x1aa3('0x64')][_0x1aa3('0x5a')]({'where':{'id':_0x2083b0[_0x1aa3('0x65')]}});}return null;})[_0x1aa3('0x22')](handleEntityNotFound(_0x1be3d5,null))['then'](function(_0x1af1a3){if(_0x1af1a3){return _0x1af1a3[_0x1aa3('0x36')]({'UserId':_0x11391d[_0x1aa3('0x59')][_0x1aa3('0x61')],'read1stAt':_[_0x1aa3('0x66')](_0x1af1a3[_0x1aa3('0x67')])?moment()[_0x1aa3('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1aa3('0x22')](function(_0x20aa0c){if(_0x20aa0c){_0x5592fa[_0x1aa3('0x68')]=_0x20aa0c[_0x1aa3('0x69')]({'plain':!![]});interaction_log[_0x1aa3('0x2a')](_0x1aa3('0x6a'),_0x11391d[_0x1aa3('0x62')]['id'],_0x11391d[_0x1aa3('0x62')][_0x1aa3('0x3a')],_0x11391d[_0x1aa3('0x62')][_0x1aa3('0x6b')],_0x5592fa[_0x1aa3('0x68')]['id'],_0x11391d[_0x1aa3('0x59')]?JSON[_0x1aa3('0x6c')](_0x11391d['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x1aa3('0x6d'),_0x5592fa);}return null;})[_0x1aa3('0x22')](function(_0x447d73){var _0x33ad9=_0x1aa3('0x6e')+_0x447d73[_0x1aa3('0x28')][_0x1aa3('0x6f')];return db['sequelize'][_0x1aa3('0x43')](_0x33ad9,{'type':db['Sequelize'][_0x1aa3('0x70')][_0x1aa3('0x71')],'raw':!![]})[_0x1aa3('0x22')](function(_0x147e5d){return _0x147e5d;});})[_0x1aa3('0x22')](function(_0x18f621){if(_0x18f621){_0x5592fa[_0x1aa3('0x28')]['contact']=_0x18f621[0x0];if(!_0x11391d[_0x1aa3('0x59')]['UserId'])return;return db[_0x1aa3('0x72')][_0x1aa3('0x5a')]({'where':{'id':_0x11391d['body'][_0x1aa3('0x61')],'role':'agent'},'attributes':['id',_0x1aa3('0x3a'),_0x1aa3('0x73'),_0x1aa3('0x74'),_0x1aa3('0x75')],'raw':!![]});}return null;})[_0x1aa3('0x22')](function(_0x421eee){if(!_0x421eee)return null;_0x5592fa[_0x1aa3('0x28')][_0x1aa3('0x63')]=_0x421eee;return _0x5592fa;})[_0x1aa3('0x22')](function(_0x1b3118){if(_0x1b3118){if(_0x11391d[_0x1aa3('0x59')]['manual']){_0x5592fa[_0x1aa3('0x28')][_0x1aa3('0x76')]=util[_0x1aa3('0x5f')]('SIP/%s',_0x11391d[_0x1aa3('0x62')][_0x1aa3('0x3a')]);_0x5592fa['message'][_0x1aa3('0x77')]=_0x5592fa['channel'];_0x5592fa['message'][_0x1aa3('0x78')]=_0x5592fa[_0x1aa3('0x77')];_0x5592fa[_0x1aa3('0x28')]['event']=_0x1aa3('0x5d');return respondWithRpcPromise('EventManager',_0x1aa3('0x79'),{'event':_0x1aa3('0x7a'),'message':_0x5592fa['message']},client9002)[_0x1aa3('0x22')](function(){return _0x5592fa;});}return _0x5592fa;}return null;})['then'](respondWithResult(_0x1be3d5,null))[_0x1aa3('0x2c')](handleError(_0x1be3d5,null));};var interaction_log=require(_0x1aa3('0x14'))(_0x1aa3('0x5c'));exports['reject']=function(_0x38d226,_0x423556,_0x439233){var _0x12859e={'agent':{},'channel':'whatsapp'};if(_0x38d226['body']['id']){delete _0x38d226[_0x1aa3('0x59')]['id'];}_0x38d226['body'][_0x1aa3('0x61')]=_0x38d226[_0x1aa3('0x59')][_0x1aa3('0x61')]||_0x38d226['user']['id'];_0x12859e[_0x1aa3('0x63')]['id']=_0x38d226[_0x1aa3('0x59')][_0x1aa3('0x61')];return db[_0x1aa3('0x3e')][_0x1aa3('0x5a')]({'where':{'id':_0x38d226['params']['id'],'UserId':null}})[_0x1aa3('0x22')](handleEntityNotFound(_0x423556,null))[_0x1aa3('0x22')](function(_0xd760c7){if(_0xd760c7){_0x12859e[_0x1aa3('0x28')]=_0xd760c7[_0x1aa3('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0x1aa3('0x5a')]({'where':{'id':_0xd760c7[_0x1aa3('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x423556,null))[_0x1aa3('0x22')](function(_0x27ba35){if(_0x27ba35){_0x12859e[_0x1aa3('0x68')]=_0x27ba35['get']({'plain':!![]});interaction_log[_0x1aa3('0x2a')](_0x1aa3('0x7b'),_0x38d226[_0x1aa3('0x62')]['id'],_0x38d226[_0x1aa3('0x62')][_0x1aa3('0x3a')],_0x38d226[_0x1aa3('0x62')][_0x1aa3('0x6b')],_0x12859e[_0x1aa3('0x68')]['id'],_0x38d226[_0x1aa3('0x59')]?JSON['stringify'](_0x38d226[_0x1aa3('0x59')]):_0x1aa3('0x7c'));return respondWithRpcPromise(_0x1aa3('0x7d'),_0x1aa3('0x7e'),_0x12859e);}return null;})[_0x1aa3('0x22')](function(_0x20a1b2){var _0x115812=_0x1aa3('0x6e')+_0x20a1b2[_0x1aa3('0x28')][_0x1aa3('0x6f')];return db[_0x1aa3('0x7f')][_0x1aa3('0x43')](_0x115812,{'type':db['Sequelize'][_0x1aa3('0x70')][_0x1aa3('0x71')],'raw':!![]})[_0x1aa3('0x22')](function(_0x1ebac4){return _0x1ebac4;});})['then'](function(_0x1f5406){if(_0x1f5406){_0x12859e[_0x1aa3('0x28')][_0x1aa3('0x80')]=_0x1f5406[0x0];if(!_0x38d226[_0x1aa3('0x59')]['UserId'])return;return db[_0x1aa3('0x72')]['find']({'where':{'id':_0x38d226[_0x1aa3('0x59')][_0x1aa3('0x61')],'role':_0x1aa3('0x63')},'attributes':['id',_0x1aa3('0x3a'),_0x1aa3('0x73'),'email',_0x1aa3('0x75')],'raw':!![]});}return null;})[_0x1aa3('0x22')](function(_0x481de1){if(!_0x481de1)return null;_0x12859e[_0x1aa3('0x28')][_0x1aa3('0x63')]=_0x481de1;return _0x12859e;})[_0x1aa3('0x22')](function(_0x5405b7){if(_0x5405b7){_0x5405b7['message']['interface']=util[_0x1aa3('0x5f')](_0x1aa3('0x81'),_0x38d226[_0x1aa3('0x62')][_0x1aa3('0x3a')]);_0x5405b7['message'][_0x1aa3('0x77')]=_0x12859e[_0x1aa3('0x77')];_0x5405b7['message'][_0x1aa3('0x78')]=_0x12859e[_0x1aa3('0x77')];_0x5405b7[_0x1aa3('0x28')][_0x1aa3('0x82')]='reject';respondWithRpcPromise(_0x1aa3('0x79'),_0x1aa3('0x79'),{'event':'rejectmessage','message':_0x5405b7['message']},client9002);return _0x12859e;}return null;})[_0x1aa3('0x22')](respondWithResult(_0x423556,null))['catch'](handleError(_0x423556,null));};exports[_0x1aa3('0x2d')]=function(_0xf8010e,_0x3dc32a,_0x51c08d){if(_0xf8010e[_0x1aa3('0x59')]['id']){delete _0xf8010e[_0x1aa3('0x59')]['id'];}var _0x59dcf2;return db[_0x1aa3('0x3e')]['find']({'where':{'id':_0xf8010e[_0x1aa3('0x55')]['id']}})[_0x1aa3('0x22')](handleEntityNotFound(_0x3dc32a,null))[_0x1aa3('0x22')](function(_0x48b812){if(_0x48b812){_0x59dcf2=_0x48b812;return db[_0x1aa3('0x83')]['find']({'where':{'id':_0x48b812['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x3dc32a,null))[_0x1aa3('0x22')](function(_0x10624b){if(_0x10624b){logger[_0x1aa3('0x24')](_0x1aa3('0x84'),_0x1aa3('0x2d'),'received\x20delivery\x20report\x20from',_0x10624b[_0x1aa3('0x41')],util[_0x1aa3('0x85')](_0xf8010e[_0x1aa3('0x59')],{'showHidden':![],'depth':null}));switch(_0x10624b[_0x1aa3('0x41')]){case _0x1aa3('0x86'):if(_0xf8010e['body'][_0x1aa3('0x87')]&&_0xf8010e[_0x1aa3('0x59')][_0x1aa3('0x87')]===_0x59dcf2[_0x1aa3('0x88')]&&_0xf8010e[_0x1aa3('0x59')][_0x1aa3('0x89')]&&_0xf8010e[_0x1aa3('0x59')]['MessageStatus']==='read'){return _0x59dcf2[_0x1aa3('0x36')]({'read':!![]});}else{logger[_0x1aa3('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1aa3('0x2d'),_0x1aa3('0x86'),util[_0x1aa3('0x85')](_0xf8010e[_0x1aa3('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x59dcf2;}})[_0x1aa3('0x22')](respondWithResult(_0x3dc32a,null))[_0x1aa3('0x2c')](handleError(_0x3dc32a,null));}; \ No newline at end of file +var _0xc1a6=['find','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','SIP/%s','channel','motionChannel','event','accept','EventManager','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','User','interface','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../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','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','stack','name','index','WhatsappMessage','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body'];(function(_0x45c73d,_0x1c8fb9){var _0x41b743=function(_0xcb6ee){while(--_0xcb6ee){_0x45c73d['push'](_0x45c73d['shift']());}};_0x41b743(++_0x1c8fb9);}(_0xc1a6,0x1d3));var _0x6c1a=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xc1a6[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c1a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c1a('0x1'));var rp=require(_0x6c1a('0x2'));var moment=require(_0x6c1a('0x3'));var BPromise=require(_0x6c1a('0x4'));var Mustache=require('mustache');var util=require(_0x6c1a('0x5'));var path=require('path');var sox=require(_0x6c1a('0x6'));var csv=require(_0x6c1a('0x7'));var ejs=require(_0x6c1a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c1a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c1a('0xa'));var deskjs=require(_0x6c1a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6c1a('0xc'));var Papa=require(_0x6c1a('0xd'));var Redis=require(_0x6c1a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c1a('0xf'));var as=require(_0x6c1a('0x10'));var hardwareService=require(_0x6c1a('0x11'));var logger=require(_0x6c1a('0x12'))('api');var utils=require(_0x6c1a('0x13'));var config=require(_0x6c1a('0x14'));var licenseUtil=require(_0x6c1a('0x15'));var db=require(_0x6c1a('0x16'))['db'];config[_0x6c1a('0x17')]=_[_0x6c1a('0x18')](config[_0x6c1a('0x17')],{'host':_0x6c1a('0x19'),'port':0x18eb});var socket=require(_0x6c1a('0x1a'))(new Redis(config[_0x6c1a('0x17')]));require(_0x6c1a('0x1b'))[_0x6c1a('0x1c')](socket);var jayson=require(_0x6c1a('0x1d'));var client=jayson[_0x6c1a('0x1e')][_0x6c1a('0x1f')]({'port':0x232c});var client9002=jayson[_0x6c1a('0x1e')][_0x6c1a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5f1862,_0x5464e5,_0x3ee00a,_0x241d7b){return new BPromise(function(_0x1494f6,_0x3d7a48){var _0x553e1d=_0x241d7b||client;return _0x553e1d['request'](_0x5f1862,_0x3ee00a)[_0x6c1a('0x20')](function(_0x4b7c84){logger[_0x6c1a('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x5464e5,_0x6c1a('0x22'));logger[_0x6c1a('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5464e5,_0x6c1a('0x22'),JSON[_0x6c1a('0x24')](_0x4b7c84));if(_0x4b7c84['error']){if(_0x4b7c84[_0x6c1a('0x25')][_0x6c1a('0x26')]===0x1f4){logger[_0x6c1a('0x25')](_0x6c1a('0x27'),_0x5464e5,_0x4b7c84['error'][_0x6c1a('0x28')]);return _0x3d7a48(_0x4b7c84[_0x6c1a('0x25')]['message']);}logger[_0x6c1a('0x25')](_0x6c1a('0x27'),_0x5464e5,_0x4b7c84[_0x6c1a('0x25')][_0x6c1a('0x28')]);return _0x1494f6(_0x4b7c84[_0x6c1a('0x25')]['message']);}else{logger['info'](_0x6c1a('0x27'),_0x5464e5,'request\x20sent');_0x1494f6(_0x4b7c84[_0x6c1a('0x29')][_0x6c1a('0x28')]);}})[_0x6c1a('0x2a')](function(_0x326192){logger['error'](_0x6c1a('0x27'),_0x5464e5,_0x326192);_0x3d7a48(_0x326192);});});}function respondWithStatusCode(_0x296840,_0x507988){_0x507988=_0x507988||0xcc;return function(_0x452349){if(_0x452349){return _0x296840[_0x6c1a('0x2b')](_0x507988);}return _0x296840[_0x6c1a('0x2c')](_0x507988)[_0x6c1a('0x2d')]();};}function respondWithResult(_0x5274c1,_0x5b8802){_0x5b8802=_0x5b8802||0xc8;return function(_0x564b4d){if(_0x564b4d){return _0x5274c1['status'](_0x5b8802)[_0x6c1a('0x2e')](_0x564b4d);}};}function respondWithFilteredResult(_0x454c60,_0x914ccc){return function(_0x17e37b){if(_0x17e37b){var _0x5ba5bf=typeof _0x914ccc[_0x6c1a('0x2f')]==='undefined'&&typeof _0x914ccc[_0x6c1a('0x30')]===_0x6c1a('0x31');var _0x4b9423=_0x17e37b['count'];var _0x43d894=_0x5ba5bf?0x0:_0x914ccc[_0x6c1a('0x2f')];var _0xfbdef6=_0x5ba5bf?_0x17e37b[_0x6c1a('0x32')]:_0x914ccc[_0x6c1a('0x2f')]+_0x914ccc[_0x6c1a('0x30')];var _0x37f87c;if(_0xfbdef6>=_0x4b9423){_0xfbdef6=_0x4b9423;_0x37f87c=0xc8;}else{_0x37f87c=0xce;}_0x454c60[_0x6c1a('0x2c')](_0x37f87c);return _0x454c60[_0x6c1a('0x33')](_0x6c1a('0x34'),_0x43d894+'-'+_0xfbdef6+'/'+_0x4b9423)[_0x6c1a('0x2e')](_0x17e37b);}return null;};}function patchUpdates(_0x30a745){return function(_0x431548){try{jsonpatch['apply'](_0x431548,_0x30a745,!![]);}catch(_0x37d43d){return BPromise[_0x6c1a('0x35')](_0x37d43d);}return _0x431548[_0x6c1a('0x36')]();};}function saveUpdates(_0x2a773,_0x2efbea){return function(_0x8c7e6e){if(_0x8c7e6e){return _0x8c7e6e[_0x6c1a('0x37')](_0x2a773)[_0x6c1a('0x20')](function(_0x2a3833){return _0x2a3833;});}return null;};}function removeEntity(_0x17fe72,_0x5d8bbd){return function(_0x1f0212){if(_0x1f0212){return _0x1f0212[_0x6c1a('0x38')]()['then'](function(){_0x17fe72[_0x6c1a('0x2c')](0xcc)[_0x6c1a('0x2d')]();});}};}function handleEntityNotFound(_0x6bf6da,_0x140dcf){return function(_0x503552){if(!_0x503552){_0x6bf6da[_0x6c1a('0x2b')](0x194);}return _0x503552;};}function handleError(_0x36e71e,_0x51efcd){_0x51efcd=_0x51efcd||0x1f4;return function(_0x36efed){logger[_0x6c1a('0x25')](_0x36efed[_0x6c1a('0x39')]);if(_0x36efed[_0x6c1a('0x3a')]){delete _0x36efed[_0x6c1a('0x3a')];}_0x36e71e['status'](_0x51efcd)['send'](_0x36efed);};}exports[_0x6c1a('0x3b')]=function(_0x414a8b,_0x4b7ec9){var _0x633d76={},_0x418c54={},_0x13f6a4={'count':0x0,'rows':[]};var _0x5c8f0c=_['map'](db[_0x6c1a('0x3c')]['rawAttributes'],function(_0x29a455){return{'name':_0x29a455[_0x6c1a('0x3d')],'type':_0x29a455[_0x6c1a('0x3e')]['key']};});_0x418c54['model']=_[_0x6c1a('0x3f')](_0x5c8f0c,_0x6c1a('0x3a'));_0x418c54[_0x6c1a('0x40')]=_['keys'](_0x414a8b[_0x6c1a('0x40')]);_0x418c54[_0x6c1a('0x41')]=_[_0x6c1a('0x42')](_0x418c54[_0x6c1a('0x43')],_0x418c54['query']);_0x633d76[_0x6c1a('0x44')]=_[_0x6c1a('0x42')](_0x418c54[_0x6c1a('0x43')],qs[_0x6c1a('0x45')](_0x414a8b['query'][_0x6c1a('0x45')]));_0x633d76[_0x6c1a('0x44')]=_0x633d76[_0x6c1a('0x44')][_0x6c1a('0x46')]?_0x633d76[_0x6c1a('0x44')]:_0x418c54[_0x6c1a('0x43')];if(!_0x414a8b['query'][_0x6c1a('0x47')](_0x6c1a('0x48'))){_0x633d76['limit']=qs[_0x6c1a('0x30')](_0x414a8b['query'][_0x6c1a('0x30')]);_0x633d76[_0x6c1a('0x2f')]=qs[_0x6c1a('0x2f')](_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x2f')]);}_0x633d76['order']=qs[_0x6c1a('0x49')](_0x414a8b['query']['sort']);_0x633d76[_0x6c1a('0x4a')]=qs[_0x6c1a('0x41')](_['pick'](_0x414a8b[_0x6c1a('0x40')],_0x418c54[_0x6c1a('0x41')]),_0x5c8f0c);if(_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x4b')]){_0x633d76[_0x6c1a('0x4a')]=_[_0x6c1a('0x4c')](_0x633d76['where'],{'$or':_[_0x6c1a('0x3f')](_0x5c8f0c,function(_0x57d0a2){if(_0x57d0a2[_0x6c1a('0x3e')]!==_0x6c1a('0x4d')){var _0x59ce0d={};_0x59ce0d[_0x57d0a2[_0x6c1a('0x3a')]]={'$like':'%'+_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x4b')]+'%'};return _0x59ce0d;}})});}_0x633d76=_['merge']({},_0x633d76,_0x414a8b[_0x6c1a('0x4e')]);var _0x8eb0c0={'where':_0x633d76['where']};return db[_0x6c1a('0x3c')]['count'](_0x8eb0c0)[_0x6c1a('0x20')](function(_0x2a738f){_0x13f6a4['count']=_0x2a738f;if(_0x414a8b[_0x6c1a('0x40')][_0x6c1a('0x4f')]){_0x633d76[_0x6c1a('0x50')]=[{'all':!![]}];}return db[_0x6c1a('0x3c')][_0x6c1a('0x51')](_0x633d76);})[_0x6c1a('0x20')](function(_0x391e6a){_0x13f6a4[_0x6c1a('0x52')]=_0x391e6a;return _0x13f6a4;})[_0x6c1a('0x20')](respondWithFilteredResult(_0x4b7ec9,_0x633d76))[_0x6c1a('0x2a')](handleError(_0x4b7ec9,null));};exports[_0x6c1a('0x53')]=function(_0x25c49f,_0x1c0b20){var _0x3c1207={'raw':!![],'where':{'id':_0x25c49f[_0x6c1a('0x54')]['id']}},_0x3055e4={};_0x3055e4['model']=_[_0x6c1a('0x55')](db['WhatsappMessage'][_0x6c1a('0x56')]);_0x3055e4[_0x6c1a('0x40')]=_[_0x6c1a('0x55')](_0x25c49f[_0x6c1a('0x40')]);_0x3055e4[_0x6c1a('0x41')]=_[_0x6c1a('0x42')](_0x3055e4['model'],_0x3055e4[_0x6c1a('0x40')]);_0x3c1207[_0x6c1a('0x44')]=_[_0x6c1a('0x42')](_0x3055e4['model'],qs['fields'](_0x25c49f[_0x6c1a('0x40')][_0x6c1a('0x45')]));_0x3c1207[_0x6c1a('0x44')]=_0x3c1207['attributes'][_0x6c1a('0x46')]?_0x3c1207[_0x6c1a('0x44')]:_0x3055e4[_0x6c1a('0x43')];if(_0x25c49f['query'][_0x6c1a('0x4f')]){_0x3c1207[_0x6c1a('0x50')]=[{'all':!![]}];}_0x3c1207=_[_0x6c1a('0x4c')]({},_0x3c1207,_0x25c49f[_0x6c1a('0x4e')]);return db[_0x6c1a('0x3c')]['find'](_0x3c1207)['then'](handleEntityNotFound(_0x1c0b20,null))['then'](respondWithResult(_0x1c0b20,null))[_0x6c1a('0x2a')](handleError(_0x1c0b20,null));};exports['create']=function(_0x3ae7c4,_0x45adf8){return db[_0x6c1a('0x3c')][_0x6c1a('0x57')](_0x3ae7c4[_0x6c1a('0x58')],{})[_0x6c1a('0x20')](respondWithResult(_0x45adf8,0xc9))[_0x6c1a('0x2a')](handleError(_0x45adf8,null));};exports['update']=function(_0x547551,_0x56b27c){if(_0x547551[_0x6c1a('0x58')]['id']){delete _0x547551[_0x6c1a('0x58')]['id'];}return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x547551[_0x6c1a('0x54')]['id']}})[_0x6c1a('0x20')](handleEntityNotFound(_0x56b27c,null))['then'](saveUpdates(_0x547551['body'],null))[_0x6c1a('0x20')](respondWithResult(_0x56b27c,null))['catch'](handleError(_0x56b27c,null));};exports['destroy']=function(_0x3e5bad,_0xb4636){return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x3e5bad[_0x6c1a('0x54')]['id']}})['then'](handleEntityNotFound(_0xb4636,null))[_0x6c1a('0x20')](removeEntity(_0xb4636,null))[_0x6c1a('0x2a')](handleError(_0xb4636,null));};exports['describe']=function(_0x66d92c,_0x50551c){return db['WhatsappMessage'][_0x6c1a('0x5a')]()[_0x6c1a('0x20')](respondWithResult(_0x50551c,null))[_0x6c1a('0x2a')](handleError(_0x50551c,null));};var interaction_log=require('../../config/logger')(_0x6c1a('0x5b'));exports['accept']=function(_0x4c1db7,_0x331b8d,_0x2d23de){var _0x45060e={'agent':{},'channel':_0x6c1a('0x5c')};if(_0x4c1db7['body']['id']){delete _0x4c1db7[_0x6c1a('0x58')]['id'];}_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x5d')]=!![];_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x5e')]=moment()[_0x6c1a('0x5f')](_0x6c1a('0x60'));_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')]=_0x4c1db7['body']['UserId']||_0x4c1db7['user']['id'];_0x45060e[_0x6c1a('0x62')]['id']=_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')];return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x4c1db7[_0x6c1a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x331b8d,null))[_0x6c1a('0x20')](saveUpdates(_0x4c1db7[_0x6c1a('0x58')],null))[_0x6c1a('0x20')](function(_0x36808a){if(_0x36808a){_0x45060e[_0x6c1a('0x28')]=_0x36808a[_0x6c1a('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x6c1a('0x59')]({'where':{'id':_0x36808a['WhatsappInteractionId']}});}return null;})[_0x6c1a('0x20')](handleEntityNotFound(_0x331b8d,null))[_0x6c1a('0x20')](function(_0x3ca4ea){if(_0x3ca4ea){return _0x3ca4ea[_0x6c1a('0x37')]({'UserId':_0x4c1db7['body'][_0x6c1a('0x61')],'read1stAt':_['isNil'](_0x3ca4ea[_0x6c1a('0x64')])?moment()[_0x6c1a('0x5f')](_0x6c1a('0x60')):undefined});}return null;})[_0x6c1a('0x20')](function(_0x57cf4e){if(_0x57cf4e){_0x45060e['interaction']=_0x57cf4e[_0x6c1a('0x63')]({'plain':!![]});interaction_log[_0x6c1a('0x21')](_0x6c1a('0x65'),_0x4c1db7['user']['id'],_0x4c1db7[_0x6c1a('0x66')][_0x6c1a('0x3a')],_0x4c1db7[_0x6c1a('0x66')]['role'],_0x45060e[_0x6c1a('0x67')]['id'],_0x4c1db7[_0x6c1a('0x58')]?JSON[_0x6c1a('0x24')](_0x4c1db7['body']):_0x6c1a('0x68'));return respondWithRpcPromise(_0x6c1a('0x69'),'acceptMessage',_0x45060e);}return null;})[_0x6c1a('0x20')](function(_0x345f8e){var _0x3e9b56=_0x6c1a('0x6a')+_0x345f8e['message'][_0x6c1a('0x6b')];return db[_0x6c1a('0x6c')][_0x6c1a('0x40')](_0x3e9b56,{'type':db[_0x6c1a('0x6d')][_0x6c1a('0x6e')][_0x6c1a('0x6f')],'raw':!![]})[_0x6c1a('0x20')](function(_0x3d0796){return _0x3d0796;});})[_0x6c1a('0x20')](function(_0x270aab){if(_0x270aab){_0x45060e[_0x6c1a('0x28')]['contact']=_0x270aab[0x0];if(!_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')])return;return db['User'][_0x6c1a('0x59')]({'where':{'id':_0x4c1db7[_0x6c1a('0x58')][_0x6c1a('0x61')],'role':_0x6c1a('0x62')},'attributes':['id',_0x6c1a('0x3a'),_0x6c1a('0x70'),_0x6c1a('0x71'),_0x6c1a('0x72')],'raw':!![]});}return null;})[_0x6c1a('0x20')](function(_0x2a2eef){if(!_0x2a2eef)return null;_0x45060e['message'][_0x6c1a('0x62')]=_0x2a2eef;return _0x45060e;})[_0x6c1a('0x20')](function(_0xcb623a){if(_0xcb623a){if(_0x4c1db7[_0x6c1a('0x58')]['manual']){_0x45060e[_0x6c1a('0x28')]['interface']=util[_0x6c1a('0x5f')](_0x6c1a('0x73'),_0x4c1db7[_0x6c1a('0x66')][_0x6c1a('0x3a')]);_0x45060e['message'][_0x6c1a('0x74')]=_0x45060e[_0x6c1a('0x74')];_0x45060e[_0x6c1a('0x28')][_0x6c1a('0x75')]=_0x45060e[_0x6c1a('0x74')];_0x45060e[_0x6c1a('0x28')][_0x6c1a('0x76')]=_0x6c1a('0x77');return respondWithRpcPromise(_0x6c1a('0x78'),_0x6c1a('0x78'),{'event':'acceptmessage','message':_0x45060e[_0x6c1a('0x28')]},client9002)[_0x6c1a('0x20')](function(){return _0x45060e;});}return _0x45060e;}return null;})[_0x6c1a('0x20')](respondWithResult(_0x331b8d,null))['catch'](handleError(_0x331b8d,null));};var interaction_log=require(_0x6c1a('0x12'))('whatsapp-interactions');exports[_0x6c1a('0x35')]=function(_0x39e3df,_0x1c8aaa,_0x943caa){var _0x4d0618={'agent':{},'channel':_0x6c1a('0x5c')};if(_0x39e3df[_0x6c1a('0x58')]['id']){delete _0x39e3df[_0x6c1a('0x58')]['id'];}_0x39e3df[_0x6c1a('0x58')][_0x6c1a('0x61')]=_0x39e3df['body'][_0x6c1a('0x61')]||_0x39e3df['user']['id'];_0x4d0618[_0x6c1a('0x62')]['id']=_0x39e3df[_0x6c1a('0x58')][_0x6c1a('0x61')];return db[_0x6c1a('0x3c')][_0x6c1a('0x59')]({'where':{'id':_0x39e3df[_0x6c1a('0x54')]['id'],'UserId':null}})[_0x6c1a('0x20')](handleEntityNotFound(_0x1c8aaa,null))['then'](function(_0x3f3d02){if(_0x3f3d02){_0x4d0618[_0x6c1a('0x28')]=_0x3f3d02['get']({'plain':!![]});return db[_0x6c1a('0x79')]['find']({'where':{'id':_0x3f3d02[_0x6c1a('0x7a')]}});}return null;})[_0x6c1a('0x20')](handleEntityNotFound(_0x1c8aaa,null))[_0x6c1a('0x20')](function(_0x57da27){if(_0x57da27){_0x4d0618[_0x6c1a('0x67')]=_0x57da27[_0x6c1a('0x63')]({'plain':!![]});interaction_log[_0x6c1a('0x21')](_0x6c1a('0x7b'),_0x39e3df[_0x6c1a('0x66')]['id'],_0x39e3df[_0x6c1a('0x66')][_0x6c1a('0x3a')],_0x39e3df[_0x6c1a('0x66')][_0x6c1a('0x7c')],_0x4d0618['interaction']['id'],_0x39e3df['body']?JSON[_0x6c1a('0x24')](_0x39e3df['body']):_0x6c1a('0x68'));return respondWithRpcPromise(_0x6c1a('0x7d'),_0x6c1a('0x7e'),_0x4d0618);}return null;})['then'](function(_0x5217e3){var _0x450596='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5217e3['message'][_0x6c1a('0x6b')];return db['sequelize'][_0x6c1a('0x40')](_0x450596,{'type':db[_0x6c1a('0x6d')]['QueryTypes'][_0x6c1a('0x6f')],'raw':!![]})[_0x6c1a('0x20')](function(_0x3c2d03){return _0x3c2d03;});})[_0x6c1a('0x20')](function(_0x5ec396){if(_0x5ec396){_0x4d0618['message'][_0x6c1a('0x7f')]=_0x5ec396[0x0];if(!_0x39e3df['body'][_0x6c1a('0x61')])return;return db[_0x6c1a('0x80')]['find']({'where':{'id':_0x39e3df[_0x6c1a('0x58')][_0x6c1a('0x61')],'role':_0x6c1a('0x62')},'attributes':['id',_0x6c1a('0x3a'),_0x6c1a('0x70'),_0x6c1a('0x71'),_0x6c1a('0x72')],'raw':!![]});}return null;})['then'](function(_0x1950af){if(!_0x1950af)return null;_0x4d0618[_0x6c1a('0x28')]['agent']=_0x1950af;return _0x4d0618;})[_0x6c1a('0x20')](function(_0x14370c){if(_0x14370c){_0x14370c['message'][_0x6c1a('0x81')]=util['format']('SIP/%s',_0x39e3df[_0x6c1a('0x66')][_0x6c1a('0x3a')]);_0x14370c[_0x6c1a('0x28')][_0x6c1a('0x74')]=_0x4d0618[_0x6c1a('0x74')];_0x14370c[_0x6c1a('0x28')][_0x6c1a('0x75')]=_0x4d0618[_0x6c1a('0x74')];_0x14370c[_0x6c1a('0x28')][_0x6c1a('0x76')]='reject';respondWithRpcPromise(_0x6c1a('0x78'),_0x6c1a('0x78'),{'event':_0x6c1a('0x82'),'message':_0x14370c[_0x6c1a('0x28')]},client9002);return _0x4d0618;}return null;})[_0x6c1a('0x20')](respondWithResult(_0x1c8aaa,null))[_0x6c1a('0x2a')](handleError(_0x1c8aaa,null));};exports[_0x6c1a('0x2c')]=function(_0x5c41f4,_0x2af40a,_0x9b40ac){if(_0x5c41f4[_0x6c1a('0x58')]['id']){delete _0x5c41f4[_0x6c1a('0x58')]['id'];}var _0x346b7;return db['WhatsappMessage'][_0x6c1a('0x59')]({'where':{'id':_0x5c41f4['params']['id']}})[_0x6c1a('0x20')](handleEntityNotFound(_0x2af40a,null))[_0x6c1a('0x20')](function(_0x4e8248){if(_0x4e8248){_0x346b7=_0x4e8248;return db['WhatsappAccount'][_0x6c1a('0x59')]({'where':{'id':_0x4e8248[_0x6c1a('0x83')]}});}})[_0x6c1a('0x20')](handleEntityNotFound(_0x2af40a,null))[_0x6c1a('0x20')](function(_0x10514d){if(_0x10514d){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x6c1a('0x2c'),_0x6c1a('0x84'),_0x10514d[_0x6c1a('0x3e')],util[_0x6c1a('0x85')](_0x5c41f4[_0x6c1a('0x58')],{'showHidden':![],'depth':null}));switch(_0x10514d[_0x6c1a('0x3e')]){case'twilio':if(_0x5c41f4[_0x6c1a('0x58')][_0x6c1a('0x86')]&&_0x5c41f4[_0x6c1a('0x58')]['MessageSid']===_0x346b7[_0x6c1a('0x87')]&&_0x5c41f4[_0x6c1a('0x58')][_0x6c1a('0x88')]&&_0x5c41f4[_0x6c1a('0x58')][_0x6c1a('0x88')]==='read'){return _0x346b7[_0x6c1a('0x37')]({'read':!![]});}else{logger[_0x6c1a('0x25')](_0x6c1a('0x89'),_0x6c1a('0x2c'),_0x6c1a('0x8a'),util['inspect'](_0x5c41f4[_0x6c1a('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x346b7;}})['then'](respondWithResult(_0x2af40a,null))['catch'](handleError(_0x2af40a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0c3e342..fb5cb38 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 _0x94d2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','WhatsappMessage'];(function(_0x2e01e5,_0x141d90){var _0x172c58=function(_0x343555){while(--_0x343555){_0x2e01e5['push'](_0x2e01e5['shift']());}};_0x172c58(++_0x141d90);}(_0x94d2,0x1cd));var _0x294d=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x94d2[_0x3a3c17];return _0xd07f21;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x294d('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x294d('0x1')](0x0);var events={'afterCreate':_0x294d('0x2'),'afterUpdate':_0x294d('0x3'),'afterDestroy':_0x294d('0x4')};function emitEvent(_0x5c1993){return function(_0x541332,_0x2f2fc8,_0x393430){WhatsappMessageEvents[_0x294d('0x5')](_0x5c1993+':'+_0x541332['id'],_0x541332);WhatsappMessageEvents[_0x294d('0x5')](_0x5c1993,_0x541332);_0x393430(null);};}for(var e in events){if(events[_0x294d('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9ffd=['events','../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a0182,_0x4a1b84){var _0x2ed1e4=function(_0x1a29dc){while(--_0x1a29dc){_0x4a0182['push'](_0x4a0182['shift']());}};_0x2ed1e4(++_0x4a1b84);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4d95a7,_0x2e8cb9){_0x4d95a7=_0x4d95a7-0x0;var _0x326e8b=_0x9ffd[_0x4d95a7];return _0x326e8b;};'use strict';var EventEmitter=require(_0xd9ff('0x0'));var WhatsappMessage=require(_0xd9ff('0x1'))['db'][_0xd9ff('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd9ff('0x3'),'afterUpdate':_0xd9ff('0x4'),'afterDestroy':_0xd9ff('0x5')};function emitEvent(_0x5493ae){return function(_0x53e962,_0x1c9460,_0x111697){WhatsappMessageEvents['emit'](_0x5493ae+':'+_0x53e962['id'],_0x53e962);WhatsappMessageEvents[_0xd9ff('0x6')](_0x5493ae,_0x53e962);_0x111697(null);};}for(var e in events){if(events[_0xd9ff('0x7')](e)){var event=events[e];WhatsappMessage[_0xd9ff('0x8')](e,emitEvent(event));}}module[_0xd9ff('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 74c5979..baa7f25 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 _0xa98d=['path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/whatsapp/messages/','/status?token=','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','node-fetch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var util=require('util');var logger=require(_0xda98('0x1'))('api');var moment=require(_0xda98('0x2'));var BPromise=require(_0xda98('0x3'));var rp=require('request-promise');var fetch=require(_0xda98('0x4'));var fs=require('fs');var path=require(_0xda98('0x5'));var rimraf=require(_0xda98('0x6'));var config=require('../../config/environment');var attributes=require(_0xda98('0x7'));module[_0xda98('0x8')]=function(_0x218e43,_0xd88a5f){return _0x218e43[_0xda98('0x9')](_0xda98('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xda98('0xb'),'fields':['messageId']},{'name':_0xda98('0xc'),'fields':[_0xda98('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ba148,_0x350a3c,_0x571b88){var _0x2fcd3a=_0x218e43[_0xda98('0xe')];var _0x351bdb=_0x3ba148['get']({'plain':!![]});if(_0x351bdb[_0xda98('0xf')][_0xda98('0x10')]()==='in'||_0x351bdb['direction'][_0xda98('0x10')]()===_0xda98('0x11')&&!_0x351bdb[_0xda98('0x12')]&&!_[_0xda98('0x13')](_0x351bdb[_0xda98('0x14')])){_0x2fcd3a[_0xda98('0x15')][_0xda98('0x16')]({'where':{'id':_0x351bdb['WhatsappInteractionId']}})['then'](function(_0x41c33b){if(_0x41c33b){_0x41c33b[_0xda98('0x17')]({'lastMsgAt':_0x351bdb[_0xda98('0x18')],'lastMsgDirection':_0x351bdb['direction'][_0xda98('0x10')]()});}})[_0xda98('0x19')](function(_0x13e47d){console[_0xda98('0x1a')](_0x13e47d);});}if(_0x351bdb['direction']===_0xda98('0x11')&&!_0x351bdb[_0xda98('0x12')]){var _0x2e86a3;_0x2fcd3a[_0xda98('0x1b')][_0xda98('0x1c')]({'where':{'id':_0x351bdb['WhatsappAccountId']},'raw':!![]})[_0xda98('0x1d')](function(_0x194892){_0x2e86a3=_0x194892;if(_0x2e86a3&&_0x2e86a3[_0xda98('0x1e')]){switch(_0x2e86a3['type']){case'twilio':var _0x478440=require(_0xda98('0x1f'));if(_0x2e86a3[_0xda98('0x20')]&&_0x2e86a3['authToken']&&_0x2e86a3[_0xda98('0x21')]){var _0x2d264e=new _0x478440(_0x2e86a3[_0xda98('0x20')],_0x2e86a3[_0xda98('0x22')]);_0x2d264e[_0xda98('0x23')][_0xda98('0x24')]({'body':_0x351bdb[_0xda98('0xd')],'to':'whatsapp:'+_0x351bdb['phone'],'from':'whatsapp:'+_0x2e86a3['phone'],'statusCallback':_0x2e86a3[_0xda98('0x25')]+_0xda98('0x26')+_0x351bdb['id']+_0xda98('0x27')+_0x2e86a3[_0xda98('0x28')]})[_0xda98('0x1d')](function(_0x52166c){if(_0x52166c['sid']){return _0x3ba148[_0xda98('0x17')]({'messageId':_0x52166c['sid']});}})[_0xda98('0x19')](function(_0x4a90f9){logger[_0xda98('0x1a')](_0xda98('0x29'),_0xda98('0x2a'),'twilio',util[_0xda98('0x2b')](_0x4a90f9,{'showHidden':![],'depth':null}));});}else{logger[_0xda98('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xda98('0x2a'),_0xda98('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x312f53=_0x2e86a3[_0xda98('0x20')];var _0x3c0be3=_0x2e86a3[_0xda98('0x22')];var _0x49334c=_0x2e86a3[_0xda98('0x2c')]+_0xda98('0x2d')+_0x312f53+_0xda98('0x2e');var _0x24d5c1={'to':[_0x351bdb[_0xda98('0x21')]],'message':{'type':_0xda98('0x2f'),'text':_0x351bdb[_0xda98('0xd')]}};var _0x3e0bb9={'method':'POST','uri':_0x49334c,'headers':{'Authorization':_0xda98('0x30')+_0x3c0be3,'Content-Type':_0xda98('0x31')},'body':_0x24d5c1,'json':!![]};rp(_0x3e0bb9)[_0xda98('0x1d')](function(_0x255a78){if(_0x255a78[_0xda98('0x32')][0x0][_0xda98('0x33')]){return _0x3ba148[_0xda98('0x17')]({'messageId':_0x255a78[_0xda98('0x32')][0x0][_0xda98('0x33')]});}})[_0xda98('0x19')](function(_0x462cb3){logger[_0xda98('0x34')]('WhatsappMessage,\x20%s',_0x462cb3);});break;}}})[_0xda98('0x35')](function(){_0x571b88();});}else{_0x571b88();}}},'charset':_0xda98('0x36'),'collate':_0xda98('0x37')});}; \ No newline at end of file +var _0x0677=['Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/whatsapp/v1/','/messages/','POST'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x0677,0x105));var _0x7067=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x0677[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0x7067('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7067('0x1'));var moment=require(_0x7067('0x2'));var BPromise=require(_0x7067('0x3'));var rp=require(_0x7067('0x4'));var fetch=require(_0x7067('0x5'));var fs=require('fs');var path=require(_0x7067('0x6'));var rimraf=require(_0x7067('0x7'));var config=require('../../config/environment');var attributes=require(_0x7067('0x8'));module['exports']=function(_0x439df7,_0x4aa395){return _0x439df7[_0x7067('0x9')](_0x7067('0xa'),attributes,{'tableName':_0x7067('0xb'),'paranoid':![],'indexes':[{'name':_0x7067('0xc'),'fields':[_0x7067('0xc')]},{'name':_0x7067('0xd'),'fields':[_0x7067('0xe')],'type':_0x7067('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10c326,_0x136988,_0x33955b){var _0x3dcbaf=_0x439df7[_0x7067('0x10')];var _0x38d689=_0x10c326[_0x7067('0x11')]({'plain':!![]});if(_0x38d689[_0x7067('0x12')][_0x7067('0x13')]()==='in'||_0x38d689[_0x7067('0x12')][_0x7067('0x13')]()==='out'&&!_0x38d689[_0x7067('0x14')]&&!_[_0x7067('0x15')](_0x38d689[_0x7067('0x16')])){_0x3dcbaf[_0x7067('0x17')][_0x7067('0x18')]({'where':{'id':_0x38d689[_0x7067('0x19')]}})[_0x7067('0x1a')](function(_0x3e449){if(_0x3e449){_0x3e449[_0x7067('0x1b')]({'lastMsgAt':_0x38d689[_0x7067('0x1c')],'lastMsgDirection':_0x38d689[_0x7067('0x12')]['toLowerCase']()});}})[_0x7067('0x1d')](function(_0x2b7c71){console[_0x7067('0x1e')](_0x2b7c71);});}if(_0x38d689[_0x7067('0x12')]===_0x7067('0x1f')&&!_0x38d689[_0x7067('0x14')]){var _0x47c03a;_0x3dcbaf[_0x7067('0x20')][_0x7067('0x21')]({'where':{'id':_0x38d689[_0x7067('0x22')]},'raw':!![]})[_0x7067('0x1a')](function(_0x1f7f96){_0x47c03a=_0x1f7f96;if(_0x47c03a&&_0x47c03a[_0x7067('0x23')]){switch(_0x47c03a[_0x7067('0x23')]){case _0x7067('0x24'):var _0xb711c2=require(_0x7067('0x24'));if(_0x47c03a[_0x7067('0x25')]&&_0x47c03a[_0x7067('0x26')]&&_0x47c03a[_0x7067('0x27')]){var _0x5b9ff7=new _0xb711c2(_0x47c03a['accountSid'],_0x47c03a[_0x7067('0x26')]);_0x5b9ff7[_0x7067('0x28')][_0x7067('0x29')]({'body':_0x38d689['body'],'to':_0x7067('0x2a')+_0x38d689[_0x7067('0x27')],'from':_0x7067('0x2a')+_0x47c03a['phone'],'statusCallback':_0x47c03a[_0x7067('0x2b')]+_0x7067('0x2c')+_0x38d689['id']+'/status?token='+_0x47c03a[_0x7067('0x2d')]})[_0x7067('0x1a')](function(_0x50bc5a){if(_0x50bc5a['sid']){return _0x10c326[_0x7067('0x1b')]({'messageId':_0x50bc5a[_0x7067('0x2e')]});}})[_0x7067('0x1d')](function(_0x1ade17){logger[_0x7067('0x1e')](_0x7067('0x2f'),_0x7067('0x30'),_0x7067('0x24'),util[_0x7067('0x31')](_0x1ade17,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7067('0x2f'),_0x7067('0x30'),_0x7067('0x24'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x51fe7f=_0x47c03a['accountSid'];var _0x184e38=_0x47c03a[_0x7067('0x26')];var _0xcd8920=_0x47c03a[_0x7067('0x32')]+_0x7067('0x33')+_0x51fe7f+_0x7067('0x34');var _0x45944b={'to':[_0x38d689[_0x7067('0x27')]],'message':{'type':'text','text':_0x38d689[_0x7067('0xe')]}};var _0x40ec88={'method':_0x7067('0x35'),'uri':_0xcd8920,'headers':{'Authorization':_0x7067('0x36')+_0x184e38,'Content-Type':_0x7067('0x37')},'body':_0x45944b,'json':!![]};rp(_0x40ec88)[_0x7067('0x1a')](function(_0x5d7543){if(_0x5d7543[_0x7067('0x38')][0x0][_0x7067('0x39')]){return _0x10c326[_0x7067('0x1b')]({'messageId':_0x5d7543[_0x7067('0x38')][0x0][_0x7067('0x39')]});}})['catch'](function(_0x189451){logger[_0x7067('0x3a')](_0x7067('0x3b'),_0x189451);});break;}}})[_0x7067('0x3c')](function(){_0x33955b();});}else{_0x33955b();}}},'charset':_0x7067('0x3d'),'collate':_0x7067('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2cbc80b..a20a5a3 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 _0xcb03=['options','CreateWhatsappMessage','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','WhatsappMessage','create','body'];(function(_0x3e4ebd,_0x53e2b8){var _0x5e920e=function(_0x609a1a){while(--_0x609a1a){_0x3e4ebd['push'](_0x3e4ebd['shift']());}};_0x5e920e(++_0x53e2b8);}(_0xcb03,0x183));var _0x3cb0=function(_0x14775c,_0x3e53d5){_0x14775c=_0x14775c-0x0;var _0x52e548=_0xcb03[_0x14775c];return _0x52e548;};'use strict';var _=require(_0x3cb0('0x0'));var util=require(_0x3cb0('0x1'));var moment=require(_0x3cb0('0x2'));var BPromise=require(_0x3cb0('0x3'));var rs=require(_0x3cb0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3cb0('0x5'));var logger=require(_0x3cb0('0x6'))(_0x3cb0('0x7'));var config=require(_0x3cb0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3cb0('0x9')][_0x3cb0('0xa')]({'port':0x232a});config[_0x3cb0('0xb')]=_[_0x3cb0('0xc')](config[_0x3cb0('0xb')],{'host':_0x3cb0('0xd'),'port':0x18eb});var socket=require(_0x3cb0('0xe'))(new Redis(config[_0x3cb0('0xb')]));require(_0x3cb0('0xf'))[_0x3cb0('0x10')](socket);function respondWithRpcPromise(_0x31c4c3,_0x5e29ea,_0x9aa4aa){return new BPromise(function(_0x2d1a58,_0x152af3){return client[_0x3cb0('0x11')](_0x31c4c3,_0x9aa4aa)['then'](function(_0x148980){logger['info'](_0x3cb0('0x12'),_0x5e29ea,_0x3cb0('0x13'));logger[_0x3cb0('0x14')](_0x3cb0('0x15'),_0x5e29ea,_0x3cb0('0x13'),JSON['stringify'](_0x148980));if(_0x148980[_0x3cb0('0x16')]){if(_0x148980[_0x3cb0('0x16')]['code']===0x1f4){logger[_0x3cb0('0x16')](_0x3cb0('0x12'),_0x5e29ea,_0x148980['error'][_0x3cb0('0x17')]);return _0x152af3(_0x148980['error']['message']);}logger[_0x3cb0('0x16')](_0x3cb0('0x12'),_0x5e29ea,_0x148980['error'][_0x3cb0('0x17')]);return _0x2d1a58(_0x148980[_0x3cb0('0x16')][_0x3cb0('0x17')]);}else{logger[_0x3cb0('0x18')](_0x3cb0('0x12'),_0x5e29ea,_0x3cb0('0x13'));_0x2d1a58(_0x148980[_0x3cb0('0x19')][_0x3cb0('0x17')]);}})['catch'](function(_0x39095a){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5e29ea,_0x39095a);_0x152af3(_0x39095a);});});}exports['CreateWhatsappMessage']=function(_0x2314a0){var _0x499ecc=this;return new Promise(function(_0x509a4d,_0x12316b){return db[_0x3cb0('0x1a')][_0x3cb0('0x1b')](_0x2314a0[_0x3cb0('0x1c')],{'raw':_0x2314a0[_0x3cb0('0x1d')]?_0x2314a0['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x192838){logger['info'](_0x3cb0('0x1e'),_0x2314a0);logger['debug'](_0x3cb0('0x1e'),_0x2314a0,JSON[_0x3cb0('0x1f')](_0x192838));_0x509a4d(_0x192838);})['catch'](function(_0x550095){logger[_0x3cb0('0x16')](_0x3cb0('0x1e'),_0x550095['message'],_0x2314a0);_0x12316b(_0x499ecc[_0x3cb0('0x16')](0x1f4,_0x550095[_0x3cb0('0x17')]));});});}; \ No newline at end of file +var _0x3ea3=['jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','WhatsappMessage','body','options','raw','CreateWhatsappMessage','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x156e60,_0x18ef4b){var _0xe8a8e3=function(_0x3960ea){while(--_0x3960ea){_0x156e60['push'](_0x156e60['shift']());}};_0xe8a8e3(++_0x18ef4b);}(_0x3ea3,0x107));var _0x33ea=function(_0x52f495,_0x2adf2e){_0x52f495=_0x52f495-0x0;var _0x2ea3f7=_0x3ea3[_0x52f495];return _0x2ea3f7;};'use strict';var _=require('lodash');var util=require(_0x33ea('0x0'));var moment=require(_0x33ea('0x1'));var BPromise=require(_0x33ea('0x2'));var rs=require(_0x33ea('0x3'));var fs=require('fs');var Redis=require(_0x33ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x33ea('0x5'))('rpc');var config=require(_0x33ea('0x6'));var jayson=require(_0x33ea('0x7'));var client=jayson['client'][_0x33ea('0x8')]({'port':0x232a});config['redis']=_[_0x33ea('0x9')](config[_0x33ea('0xa')],{'host':_0x33ea('0xb'),'port':0x18eb});var socket=require(_0x33ea('0xc'))(new Redis(config[_0x33ea('0xa')]));require(_0x33ea('0xd'))[_0x33ea('0xe')](socket);function respondWithRpcPromise(_0x4d2aaa,_0x25116f,_0x293935){return new BPromise(function(_0x2a332a,_0x5e6595){return client['request'](_0x4d2aaa,_0x293935)[_0x33ea('0xf')](function(_0x193c76){logger['info'](_0x33ea('0x10'),_0x25116f,'request\x20sent');logger[_0x33ea('0x11')](_0x33ea('0x12'),_0x25116f,'request\x20sent',JSON[_0x33ea('0x13')](_0x193c76));if(_0x193c76[_0x33ea('0x14')]){if(_0x193c76[_0x33ea('0x14')][_0x33ea('0x15')]===0x1f4){logger[_0x33ea('0x14')](_0x33ea('0x10'),_0x25116f,_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);return _0x5e6595(_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);}logger[_0x33ea('0x14')](_0x33ea('0x10'),_0x25116f,_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);return _0x2a332a(_0x193c76[_0x33ea('0x14')][_0x33ea('0x16')]);}else{logger[_0x33ea('0x17')](_0x33ea('0x10'),_0x25116f,'request\x20sent');_0x2a332a(_0x193c76['result'][_0x33ea('0x16')]);}})[_0x33ea('0x18')](function(_0x367cf9){logger[_0x33ea('0x14')](_0x33ea('0x10'),_0x25116f,_0x367cf9);_0x5e6595(_0x367cf9);});});}exports['CreateWhatsappMessage']=function(_0x45577d){var _0x211d47=this;return new Promise(function(_0xae23ea,_0x1c447f){return db[_0x33ea('0x19')]['create'](_0x45577d[_0x33ea('0x1a')],{'raw':_0x45577d[_0x33ea('0x1b')]?_0x45577d[_0x33ea('0x1b')][_0x33ea('0x1c')]===undefined?!![]:![]:!![]})[_0x33ea('0xf')](function(_0x203567){logger['info'](_0x33ea('0x1d'),_0x45577d);logger[_0x33ea('0x11')](_0x33ea('0x1d'),_0x45577d,JSON[_0x33ea('0x13')](_0x203567));_0xae23ea(_0x203567);})[_0x33ea('0x18')](function(_0x19b16b){logger['error'](_0x33ea('0x1d'),_0x19b16b['message'],_0x45577d);_0x1c447f(_0x211d47['error'](0x1f4,_0x19b16b[_0x33ea('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6e8abb6..b19ef76 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 _0x857a=['removeListener','register','whatsappMessage:','save','update'];(function(_0x354ce0,_0xe4fbab){var _0x3a8c81=function(_0x5725c8){while(--_0x5725c8){_0x354ce0['push'](_0x354ce0['shift']());}};_0x3a8c81(++_0xe4fbab);}(_0x857a,0x198));var _0xa857=function(_0x28d402,_0x18ee15){_0x28d402=_0x28d402-0x0;var _0x252028=_0x857a[_0x28d402];return _0x252028;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa857('0x0'),'remove',_0xa857('0x1')];function createListener(_0x1d43f0,_0x11e3ac){return function(_0x294733){_0x11e3ac['emit'](_0x1d43f0,_0x294733);};}function removeListener(_0x5f15de,_0x1ffcd8){return function(){WhatsappMessageEvents[_0xa857('0x2')](_0x5f15de,_0x1ffcd8);};}exports[_0xa857('0x3')]=function(_0x12f5fb){for(var _0x1b76e5=0x0,_0xb05210=events['length'];_0x1b76e5<_0xb05210;_0x1b76e5++){var _0x18d4ed=events[_0x1b76e5];var _0x24af7f=createListener(_0xa857('0x4')+_0x18d4ed,_0x12f5fb);WhatsappMessageEvents['on'](_0x18d4ed,_0x24af7f);}}; \ No newline at end of file +var _0xf164=['./whatsappMessage.events','save','remove','emit','removeListener','register','whatsappMessage:'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf164,0x1d5));var _0x4f16=function(_0x221246,_0x168ceb){_0x221246=_0x221246-0x0;var _0x13e1ea=_0xf164[_0x221246];return _0x13e1ea;};'use strict';var WhatsappMessageEvents=require(_0x4f16('0x0'));var events=[_0x4f16('0x1'),_0x4f16('0x2'),'update'];function createListener(_0x40cfad,_0x2d86ea){return function(_0x28c5d6){_0x2d86ea[_0x4f16('0x3')](_0x40cfad,_0x28c5d6);};}function removeListener(_0x26b65f,_0x537ae1){return function(){WhatsappMessageEvents[_0x4f16('0x4')](_0x26b65f,_0x537ae1);};}exports[_0x4f16('0x5')]=function(_0x545a47){for(var _0xe30825=0x0,_0xa8bfc3=events['length'];_0xe30825<_0xa8bfc3;_0xe30825++){var _0x3c0d21=events[_0xe30825];var _0x13edeb=createListener(_0x4f16('0x6')+_0x3c0d21,_0x545a47);WhatsappMessageEvents['on'](_0x3c0d21,_0x13edeb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ce8b4ae..0b81915 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 _0x1057=['post','addTeams','/:id/users','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','isAuthenticated','describe','getMembers','/:id/teams','getTeams','getAgents','create'];(function(_0xc3aef6,_0x772060){var _0x5c3b5c=function(_0x3d600b){while(--_0x3d600b){_0xc3aef6['push'](_0xc3aef6['shift']());}};_0x5c3b5c(++_0x772060);}(_0x1057,0xb0));var _0x7105=function(_0x5df070,_0x177ebb){_0x5df070=_0x5df070-0x0;var _0x2204f5=_0x1057[_0x5df070];return _0x2204f5;};'use strict';var multer=require(_0x7105('0x0'));var util=require(_0x7105('0x1'));var path=require(_0x7105('0x2'));var timeout=require(_0x7105('0x3'));var express=require(_0x7105('0x4'));var router=express['Router']();var fs_extra=require(_0x7105('0x5'));var auth=require(_0x7105('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7105('0x7'));router[_0x7105('0x8')]('/',auth[_0x7105('0x9')](),controller['index']);router[_0x7105('0x8')]('/describe',auth[_0x7105('0x9')](),controller[_0x7105('0xa')]);router['get']('/:id',auth[_0x7105('0x9')](),controller['show']);router[_0x7105('0x8')]('/:id/members',auth[_0x7105('0x9')](),controller[_0x7105('0xb')]);router[_0x7105('0x8')](_0x7105('0xc'),auth[_0x7105('0x9')](),controller[_0x7105('0xd')]);router['get']('/:id/users',auth[_0x7105('0x9')](),controller[_0x7105('0xe')]);router['post']('/',auth[_0x7105('0x9')](),controller[_0x7105('0xf')]);router[_0x7105('0x10')](_0x7105('0xc'),auth[_0x7105('0x9')](),controller[_0x7105('0x11')]);router['post'](_0x7105('0x12'),auth[_0x7105('0x9')](),controller['addAgents']);router[_0x7105('0x13')]('/:id',auth[_0x7105('0x9')](),controller[_0x7105('0x14')]);router[_0x7105('0x15')]('/:id',auth[_0x7105('0x9')](),controller['destroy']);router[_0x7105('0x15')](_0x7105('0xc'),auth[_0x7105('0x9')](),controller[_0x7105('0x16')]);router[_0x7105('0x15')](_0x7105('0x12'),auth[_0x7105('0x9')](),controller[_0x7105('0x17')]);module['exports']=router; \ No newline at end of file +var _0x514f=['../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','Router'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x514f,0x1e2));var _0xf514=function(_0xde62d8,_0x56459e){_0xde62d8=_0xde62d8-0x0;var _0x143c89=_0x514f[_0xde62d8];return _0x143c89;};'use strict';var multer=require(_0xf514('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf514('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf514('0x2'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xf514('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf514('0x3')](_0xf514('0x4'),auth[_0xf514('0x5')](),controller[_0xf514('0x6')]);router[_0xf514('0x3')](_0xf514('0x7'),auth[_0xf514('0x5')](),controller[_0xf514('0x8')]);router[_0xf514('0x3')](_0xf514('0x9'),auth[_0xf514('0x5')](),controller[_0xf514('0xa')]);router[_0xf514('0x3')](_0xf514('0xb'),auth[_0xf514('0x5')](),controller['getTeams']);router[_0xf514('0x3')](_0xf514('0xc'),auth[_0xf514('0x5')](),controller[_0xf514('0xd')]);router[_0xf514('0xe')]('/',auth[_0xf514('0x5')](),controller['create']);router[_0xf514('0xe')](_0xf514('0xb'),auth[_0xf514('0x5')](),controller['addTeams']);router[_0xf514('0xe')]('/:id/users',auth['isAuthenticated'](),controller[_0xf514('0xf')]);router[_0xf514('0x10')]('/:id',auth[_0xf514('0x5')](),controller['update']);router['delete'](_0xf514('0x7'),auth[_0xf514('0x5')](),controller[_0xf514('0x11')]);router[_0xf514('0x12')]('/:id/teams',auth[_0xf514('0x5')](),controller[_0xf514('0x13')]);router[_0xf514('0x12')](_0xf514('0xc'),auth[_0xf514('0x5')](),controller[_0xf514('0x14')]);module[_0xf514('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0821986..2e38c76 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 _0x1ae3=['STRING','sequelize','exports','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x26b250,_0x53d8b3){var _0x1f3670=function(_0x272650){while(--_0x272650){_0x26b250['push'](_0x26b250['shift']());}};_0x1f3670(++_0x53d8b3);}(_0x1ae3,0x139));var _0x31ae=function(_0x9c80f6,_0x313ad6){_0x9c80f6=_0x9c80f6-0x0;var _0x5a237b=_0x1ae3[_0x9c80f6];return _0x5a237b;};'use strict';var Sequelize=require(_0x31ae('0x0'));module[_0x31ae('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31ae('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x31ae('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x31ae('0x4')](_0x31ae('0x5'),'beepall',_0x31ae('0x6'))},'description':{'type':Sequelize[_0x31ae('0x7')]}}; \ No newline at end of file +var _0xe13a=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x5c1829,_0x5e5b18){var _0x45dd65=function(_0x2c08bf){while(--_0x2c08bf){_0x5c1829['push'](_0x5c1829['shift']());}};_0x45dd65(++_0x5e5b18);}(_0xe13a,0x178));var _0xae13=function(_0x369744,_0x24b792){_0x369744=_0x369744-0x0;var _0x4d26c8=_0xe13a[_0x369744];return _0x4d26c8;};'use strict';var Sequelize=require('sequelize');module[_0xae13('0x0')]={'name':{'type':Sequelize[_0xae13('0x1')],'unique':_0xae13('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xae13('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xae13('0x4'),_0xae13('0x5'),_0xae13('0x6'))},'description':{'type':Sequelize[_0xae13('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 7149591..7abbbd7 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 _0x45c2=['UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','Team','order','pick','getTeams','addTeams','voicePause','interface','flatMap','Agents','sequelize','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','User','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','transaction','ids','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','then','WhatsappQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','get','UserWhatsappQueue','hasOwnProperty','nolimit','sort','WhatsappQueueId','filter','findAndCountAll'];(function(_0x383e02,_0x4ef831){var _0x4fd882=function(_0x5d52d1){while(--_0x5d52d1){_0x383e02['push'](_0x383e02['shift']());}};_0x4fd882(++_0x4ef831);}(_0x45c2,0x128));var _0x245c=function(_0x27398c,_0x4ea33f){_0x27398c=_0x27398c-0x0;var _0x155fc5=_0x45c2[_0x27398c];return _0x155fc5;};'use strict';var BPromise=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var _=require(_0x245c('0x2'));var squel=require(_0x245c('0x3'));var Redis=require(_0x245c('0x4'));var qs=require(_0x245c('0x5'));var logger=require(_0x245c('0x6'))('api');var config=require('../../config/environment');var db=require(_0x245c('0x7'))['db'];config[_0x245c('0x8')]=_[_0x245c('0x9')](config[_0x245c('0x8')],{'host':_0x245c('0xa'),'port':0x18eb});var socket=require(_0x245c('0xb'))(new Redis(config[_0x245c('0x8')]));require('./whatsappQueue.socket')[_0x245c('0xc')](socket);function respondWithStatusCode(_0x124312,_0x252104){_0x252104=_0x252104||0xcc;return function(_0x3f5b1f){if(_0x3f5b1f){return _0x124312['sendStatus'](_0x252104);}return _0x124312[_0x245c('0xd')](_0x252104)[_0x245c('0xe')]();};}function respondWithResult(_0x458a4a,_0x56e9e3){_0x56e9e3=_0x56e9e3||0xc8;return function(_0x45f92f){if(_0x45f92f){return _0x458a4a[_0x245c('0xd')](_0x56e9e3)[_0x245c('0xf')](_0x45f92f);}};}function respondWithFilteredResult(_0x1746ac,_0x459b8b){return function(_0x152e35){if(_0x152e35){var _0x46eff9=typeof _0x459b8b[_0x245c('0x10')]===_0x245c('0x11')&&typeof _0x459b8b[_0x245c('0x12')]===_0x245c('0x11');var _0x1181d8=_0x152e35[_0x245c('0x13')];var _0xcf227=_0x46eff9?0x0:_0x459b8b[_0x245c('0x10')];var _0x36abb5=_0x46eff9?_0x152e35[_0x245c('0x13')]:_0x459b8b[_0x245c('0x10')]+_0x459b8b[_0x245c('0x12')];var _0x1eefe1;if(_0x36abb5>=_0x1181d8){_0x36abb5=_0x1181d8;_0x1eefe1=0xc8;}else{_0x1eefe1=0xce;}_0x1746ac['status'](_0x1eefe1);return _0x1746ac[_0x245c('0x14')]('Content-Range',_0xcf227+'-'+_0x36abb5+'/'+_0x1181d8)['json'](_0x152e35);}return null;};}function saveUpdates(_0x29b551){return function(_0x44733a){if(_0x44733a){return _0x44733a[_0x245c('0x15')](_0x29b551)[_0x245c('0x16')](function(_0x5621bf){return _0x5621bf;});}return null;};}function removeEntity(_0x16c560){return function(_0x57a759){if(_0x57a759){return _0x57a759['destroy']()[_0x245c('0x16')](function(){var _0x1b1ecd=_0x57a759['get']({'plain':!![]});var _0xf4f48=_0x245c('0x17');return db[_0x245c('0x18')][_0x245c('0x19')]({'where':{'type':_0xf4f48,'resourceId':_0x1b1ecd['id']}})[_0x245c('0x16')](function(){return _0x57a759;});})[_0x245c('0x16')](function(){_0x16c560[_0x245c('0xd')](0xcc)[_0x245c('0xe')]();});}};}function handleEntityNotFound(_0xf09fec){return function(_0x21b73e){if(!_0x21b73e){_0xf09fec[_0x245c('0x1a')](0x194);}return _0x21b73e;};}function handleError(_0x261bbe,_0x280e38){_0x280e38=_0x280e38||0x1f4;return function(_0x460ee8){logger['error'](_0x460ee8[_0x245c('0x1b')]);if(_0x460ee8[_0x245c('0x1c')]){delete _0x460ee8[_0x245c('0x1c')];}_0x261bbe[_0x245c('0xd')](_0x280e38)[_0x245c('0x1d')](_0x460ee8);};}exports[_0x245c('0x1e')]=function(_0xe7ba5d,_0x40c8d2){var _0x4695f9={};var _0xb99fb={'count':0x0,'rows':[]};var _0x1af5eb=_[_0x245c('0x1f')](db[_0x245c('0x20')][_0x245c('0x21')],function(_0x45a93a){return{'name':_0x45a93a[_0x245c('0x22')],'type':_0x45a93a[_0x245c('0x23')][_0x245c('0x24')]};});_0x4695f9=qs['getOptions'](_0x1af5eb,_0xe7ba5d);var _0x1f4592={'where':_0x4695f9[_0x245c('0x25')]};return db[_0x245c('0x20')][_0x245c('0x13')](_0x1f4592)['then'](function(_0x213b19){_0xb99fb[_0x245c('0x13')]=_0x213b19;_0x4695f9[_0x245c('0x26')]=qs[_0x245c('0x26')](_0xe7ba5d[_0x245c('0x27')]);return db[_0x245c('0x20')][_0x245c('0x28')](_0x4695f9);})[_0x245c('0x16')](function(_0x43b972){_0xb99fb[_0x245c('0x29')]=_0x43b972;return _0xb99fb;})[_0x245c('0x16')](respondWithFilteredResult(_0x40c8d2,_0x4695f9))['catch'](handleError(_0x40c8d2,null));};exports[_0x245c('0x2a')]=function(_0x553133,_0x1b06f7){var _0x44814c={'raw':!![],'where':{'id':_0x553133[_0x245c('0x2b')]['id']}},_0x2fd057={};_0x2fd057[_0x245c('0x2c')]=_['keys'](db[_0x245c('0x20')]['rawAttributes']);_0x2fd057[_0x245c('0x27')]=_[_0x245c('0x2d')](_0x553133[_0x245c('0x27')]);_0x2fd057[_0x245c('0x2e')]=_[_0x245c('0x2f')](_0x2fd057[_0x245c('0x2c')],_0x2fd057[_0x245c('0x27')]);_0x44814c[_0x245c('0x30')]=_[_0x245c('0x2f')](_0x2fd057[_0x245c('0x2c')],qs['fields'](_0x553133['query'][_0x245c('0x31')]));_0x44814c[_0x245c('0x30')]=_0x44814c[_0x245c('0x30')][_0x245c('0x32')]?_0x44814c[_0x245c('0x30')]:_0x2fd057[_0x245c('0x2c')];if(_0x553133[_0x245c('0x27')][_0x245c('0x33')]){_0x44814c['include']=[{'all':!![]}];}_0x44814c=_[_0x245c('0x34')]({},_0x44814c,_0x553133[_0x245c('0x35')]);return db[_0x245c('0x20')]['find'](_0x44814c)[_0x245c('0x16')](handleEntityNotFound(_0x1b06f7,null))['then'](respondWithResult(_0x1b06f7,null))['catch'](handleError(_0x1b06f7,null));};exports[_0x245c('0x36')]=function(_0x38e588,_0x3ee403){return db[_0x245c('0x20')]['create'](_0x38e588[_0x245c('0x37')],{})[_0x245c('0x16')](function(_0x2d898c){var _0x2ce413=_0x38e588[_0x245c('0x38')]['get']({'plain':!![]});if(!_0x2ce413)throw new Error(_0x245c('0x39'));if(_0x2ce413[_0x245c('0x3a')]==='user'){var _0x26f0d8=_0x2d898c['get']({'plain':!![]});var _0x332763=_0x245c('0x17');return db['UserProfileSection'][_0x245c('0x3b')]({'where':{'name':_0x332763,'userProfileId':_0x2ce413[_0x245c('0x3c')]},'raw':!![]})['then'](function(_0x2293e6){if(_0x2293e6&&_0x2293e6[_0x245c('0x3d')]===0x0){return db[_0x245c('0x18')]['create']({'name':_0x26f0d8[_0x245c('0x1c')],'resourceId':_0x26f0d8['id'],'type':_0x2293e6[_0x245c('0x1c')],'sectionId':_0x2293e6['id']},{})[_0x245c('0x16')](function(){return _0x2d898c;});}else{return _0x2d898c;}})['catch'](function(_0x2074ba){logger[_0x245c('0x3e')](_0x245c('0x3f'),_0x2074ba);throw _0x2074ba;});}return _0x2d898c;})[_0x245c('0x16')](respondWithResult(_0x3ee403,0xc9))[_0x245c('0x40')](handleError(_0x3ee403,null));};exports['update']=function(_0x1f5632,_0x441a5a){if(_0x1f5632['body']['id']){delete _0x1f5632[_0x245c('0x37')]['id'];}return db[_0x245c('0x20')][_0x245c('0x3b')]({'where':{'id':_0x1f5632[_0x245c('0x2b')]['id']}})[_0x245c('0x16')](handleEntityNotFound(_0x441a5a,null))[_0x245c('0x16')](saveUpdates(_0x1f5632[_0x245c('0x37')],null))[_0x245c('0x16')](respondWithResult(_0x441a5a,null))[_0x245c('0x40')](handleError(_0x441a5a,null));};exports[_0x245c('0x19')]=function(_0x47d476,_0xd02abe){return db['WhatsappQueue'][_0x245c('0x3b')]({'where':{'id':_0x47d476[_0x245c('0x2b')]['id']}})[_0x245c('0x16')](handleEntityNotFound(_0xd02abe,null))[_0x245c('0x16')](removeEntity(_0xd02abe,null))[_0x245c('0x40')](handleError(_0xd02abe,null));};exports[_0x245c('0x41')]=function(_0x5738e7,_0x59c6b1){return db[_0x245c('0x20')][_0x245c('0x41')]()[_0x245c('0x16')](respondWithResult(_0x59c6b1,null))['catch'](handleError(_0x59c6b1,null));};exports[_0x245c('0x42')]=function(_0xb16601,_0x21c43c){var _0x3226c6={'raw':!![],'where':{}},_0x52f932={},_0x1fedd6;return db['WhatsappQueue'][_0x245c('0x43')]({'where':{'id':_0xb16601[_0x245c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x21c43c,null))[_0x245c('0x16')](function(_0x260c2a){if(_0x260c2a){_0x1fedd6=_0x260c2a[_0x245c('0x44')]({'plain':!![]});_0x52f932[_0x245c('0x2c')]=_[_0x245c('0x2d')](db[_0x245c('0x45')][_0x245c('0x21')]);_0x52f932[_0x245c('0x27')]=_[_0x245c('0x2d')](_0xb16601[_0x245c('0x27')]);_0x52f932['filters']=_[_0x245c('0x2f')](_0x52f932[_0x245c('0x2c')],_0x52f932[_0x245c('0x27')]);_0x3226c6[_0x245c('0x30')]=_[_0x245c('0x2f')](_0x52f932[_0x245c('0x2c')],qs[_0x245c('0x31')](_0xb16601[_0x245c('0x27')][_0x245c('0x31')]));_0x3226c6['attributes']=_0x3226c6[_0x245c('0x30')][_0x245c('0x32')]?_0x3226c6['attributes']:_0x52f932[_0x245c('0x2c')];if(!_0xb16601[_0x245c('0x27')][_0x245c('0x46')](_0x245c('0x47'))){_0x3226c6['limit']=qs[_0x245c('0x12')](_0xb16601[_0x245c('0x27')][_0x245c('0x12')]);_0x3226c6['offset']=qs['offset'](_0xb16601[_0x245c('0x27')][_0x245c('0x10')]);}_0x3226c6['order']=qs[_0x245c('0x48')](_0xb16601[_0x245c('0x27')][_0x245c('0x48')]);_0x3226c6[_0x245c('0x25')]=qs[_0x245c('0x2e')](_['pick'](_0xb16601[_0x245c('0x27')],_0x52f932['filters']));_0x3226c6[_0x245c('0x25')][_0x245c('0x49')]=_0x260c2a['id'];if(_0xb16601['query'][_0x245c('0x4a')]){_0x3226c6['where']=_[_0x245c('0x34')](_0x3226c6[_0x245c('0x25')],{'$or':_[_0x245c('0x1f')](_0x3226c6[_0x245c('0x30')],function(_0x1ac21a){var _0x3b6526={};_0x3b6526[_0x1ac21a]={'$like':'%'+_0xb16601[_0x245c('0x27')]['filter']+'%'};return _0x3b6526;})});}_0x3226c6=_['merge']({},_0x3226c6,_0xb16601['options']);return db[_0x245c('0x45')][_0x245c('0x28')](_0x3226c6);}})['then'](function(_0x57dca3){if(_0x57dca3){return db['User'][_0x245c('0x4b')]({'where':{'id':_[_0x245c('0x1f')](_0x57dca3,_0x245c('0x4c')),'role':_0x245c('0x4d')},'attributes':['id','name','whatsappPause',_0x245c('0x4e'),_0x245c('0x4f')]});}})[_0x245c('0x16')](function(_0x50e176){if(_0x50e176){return{'count':_0x50e176[_0x245c('0x13')],'rows':_[_0x245c('0x1f')](_0x50e176[_0x245c('0x29')],function(_0x4bf52d){return{'membername':_0x4bf52d[_0x245c('0x1c')],'UserId':_0x4bf52d['id'],'queue_name':_0x1fedd6[_0x245c('0x1c')],'WhatsappQueueId':_0x1fedd6['id'],'interface':util[_0x245c('0x50')](_0x245c('0x51'),_0x245c('0x52'),_0x4bf52d['name']),'penalty':0x0,'paused':_0x4bf52d[_0x245c('0x53')],'createdAt':_0x4bf52d[_0x245c('0x4f')],'updatedAt':_0x4bf52d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x245c('0x16')](respondWithFilteredResult(_0x21c43c,_0x3226c6))['catch'](handleError(_0x21c43c,null));};exports['getTeams']=function(_0x3b3c07,_0x404a45){var _0x3810e4={};var _0x533466={};var _0x5ccd46;var _0x2fce2e;return db[_0x245c('0x20')][_0x245c('0x43')]({'where':{'id':_0x3b3c07[_0x245c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x404a45,null))[_0x245c('0x16')](function(_0x39dd64){if(_0x39dd64){_0x5ccd46=_0x39dd64;_0x533466[_0x245c('0x2c')]=_[_0x245c('0x2d')](db[_0x245c('0x54')][_0x245c('0x21')]);_0x533466[_0x245c('0x27')]=_['keys'](_0x3b3c07['query']);_0x533466[_0x245c('0x2e')]=_['intersection'](_0x533466[_0x245c('0x2c')],_0x533466['query']);_0x3810e4['attributes']=_[_0x245c('0x2f')](_0x533466[_0x245c('0x2c')],qs[_0x245c('0x31')](_0x3b3c07[_0x245c('0x27')][_0x245c('0x31')]));_0x3810e4[_0x245c('0x30')]=_0x3810e4[_0x245c('0x30')][_0x245c('0x32')]?_0x3810e4[_0x245c('0x30')]:_0x533466[_0x245c('0x2c')];_0x3810e4[_0x245c('0x55')]=qs['sort'](_0x3b3c07['query'][_0x245c('0x48')]);_0x3810e4['where']=qs['filters'](_[_0x245c('0x56')](_0x3b3c07['query'],_0x533466['filters']));if(_0x3b3c07[_0x245c('0x27')][_0x245c('0x4a')]){_0x3810e4['where']=_[_0x245c('0x34')](_0x3810e4['where'],{'$or':_[_0x245c('0x1f')](_0x3810e4['attributes'],function(_0x37964d){var _0x4efee8={};_0x4efee8[_0x37964d]={'$like':'%'+_0x3b3c07[_0x245c('0x27')]['filter']+'%'};return _0x4efee8;})});}_0x3810e4=_[_0x245c('0x34')]({},_0x3810e4,_0x3b3c07[_0x245c('0x35')]);return _0x5ccd46['getTeams'](_0x3810e4);}})[_0x245c('0x16')](function(_0x42f7d4){if(_0x42f7d4){_0x2fce2e=_0x42f7d4[_0x245c('0x32')];if(!_0x3b3c07[_0x245c('0x27')]['hasOwnProperty']('nolimit')){_0x3810e4[_0x245c('0x12')]=qs[_0x245c('0x12')](_0x3b3c07[_0x245c('0x27')][_0x245c('0x12')]);_0x3810e4['offset']=qs[_0x245c('0x10')](_0x3b3c07['query'][_0x245c('0x10')]);}return _0x5ccd46[_0x245c('0x57')](_0x3810e4);}})[_0x245c('0x16')](function(_0x14084c){if(_0x14084c){return _0x14084c?{'count':_0x2fce2e,'rows':_0x14084c}:null;}})['then'](respondWithResult(_0x404a45,null))[_0x245c('0x40')](handleError(_0x404a45,null));};exports[_0x245c('0x58')]=function(_0x478499,_0x263715){var _0x4dbd23=_0x478499[_0x245c('0x37')]['ids'];return db['Team'][_0x245c('0x28')]({'where':{'id':_0x4dbd23},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x245c('0x1c'),'online',_0x245c('0x59'),_0x245c('0x5a')],'raw':!![]}]})[_0x245c('0x16')](function(_0x446ff5){if(_0x446ff5){var _0x4bbb5d=_[_0x245c('0x5b')](_0x446ff5,function(_0xd6dfc8){var _0x4db254=_0xd6dfc8['get']({'plain':!![]});return _0x4db254[_0x245c('0x5c')];});return db[_0x245c('0x20')]['find']({'where':{'id':_0x478499[_0x245c('0x2b')]['id']}})['then'](function(_0x63cf8e){return db[_0x245c('0x5d')]['transaction'](function(_0x17498e){return _0x63cf8e['addTeams'](_0x4dbd23,{'transaction':_0x17498e})[_0x245c('0x16')](function(){return BPromise['each'](_0x4bbb5d,function(_0x5dbcf8){return db[_0x245c('0x45')][_0x245c('0x5e')]({'where':{'UserId':_0x5dbcf8['id'],'WhatsappQueueId':_0x478499['params']['id']},'transaction':_0x17498e});});})[_0x245c('0x16')](function(){_0x4bbb5d[_0x245c('0x5f')](function(_0x3e014c){socket[_0x245c('0x60')](_0x245c('0x61'),{'UserId':_0x3e014c['id'],'WhatsappQueueId':_0x63cf8e['id']});});});});});}})[_0x245c('0x16')](respondWithStatusCode(_0x263715,null))[_0x245c('0x40')](handleError(_0x263715,null));};exports[_0x245c('0x62')]=function(_0x4a7349,_0x4d6d13){return db[_0x245c('0x54')][_0x245c('0x28')]({'where':{'id':_0x4a7349[_0x245c('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x245c('0x63')],'as':_0x245c('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d6d13,null))['then'](function(_0x5dbef5){var _0x5f1996=_[_0x245c('0x1f')](_0x5dbef5,'id');var _0x4c0f4e=[];var _0x3cdc5e=[];var _0x1f46bf=squel['select']();_0x1f46bf[_0x245c('0x64')]('tq.TeamId')[_0x245c('0x65')]('team_has_whatsapp_queues','tq')['join'](_0x245c('0x66'),'ut',_0x245c('0x67'))[_0x245c('0x25')](_0x245c('0x68'),_0x4a7349[_0x245c('0x2b')]['id']);for(var _0x5078cc=0x0;_0x5078cc<_0x5dbef5[_0x245c('0x32')];_0x5078cc+=0x1){let _0x1a515b=_0x5dbef5[_0x5078cc];for(var _0x1f0797=0x0;_0x1f0797<_0x1a515b[_0x245c('0x5c')]['length'];_0x1f0797+=0x1){let _0x5252b0=_0x1a515b[_0x245c('0x5c')][_0x1f0797];var _0x414e12=_0x1f46bf[_0x245c('0x69')]();_0x414e12[_0x245c('0x25')](_0x245c('0x6a'),_0x5252b0['id']);_0x3cdc5e[_0x245c('0x6b')](db['sequelize']['query'](_0x414e12[_0x245c('0x6c')](),{'type':db[_0x245c('0x5d')][_0x245c('0x6d')][_0x245c('0x6e')]})[_0x245c('0x16')](function(_0x5e46de){if(_0x5e46de[_0x245c('0x32')]===0x1){return _0x5252b0['id'];}else{var _0x42ccd1=_[_0x245c('0x6f')](_[_0x245c('0x1f')](_0x5e46de,'TeamId'),function(_0x5534f0){return _[_0x245c('0x70')](_0x5f1996,_0x5534f0);});if(_0x42ccd1){return _0x5252b0['id'];}}}));}}return BPromise['all'](_0x3cdc5e)[_0x245c('0x16')](function(_0x67e88a){_0x4c0f4e=_(_0x4c0f4e)[_0x245c('0x71')](_0x67e88a)['compact']()['value']();return db[_0x245c('0x20')]['find']({'where':{'id':_0x4a7349['params']['id']}})['then'](function(_0x5084bd){return db[_0x245c('0x5d')][_0x245c('0x72')](function(_0x5bfae4){return _0x5084bd['removeTeams'](_0x4a7349['query'][_0x245c('0x73')],{'transaction':_0x5bfae4})[_0x245c('0x16')](function(){if(!_[_0x245c('0x74')](_0x4c0f4e)){return _0x5084bd[_0x245c('0x75')](_0x4c0f4e,{'transaction':_0x5bfae4});}})[_0x245c('0x16')](function(){_0x4c0f4e[_0x245c('0x5f')](function(_0x11d09f){socket['emit'](_0x245c('0x76'),{'UserId':_0x11d09f,'WhatsappQueueId':_0x5084bd['id']});});});});});});})['then'](respondWithStatusCode(_0x4d6d13,null))[_0x245c('0x40')](handleError(_0x4d6d13,null));};exports[_0x245c('0x77')]=function(_0x3807fd,_0x38a493){return db[_0x245c('0x20')][_0x245c('0x3b')]({'where':{'id':_0x3807fd['params']['id']}})[_0x245c('0x16')](handleEntityNotFound(_0x38a493,null))[_0x245c('0x16')](function(_0x4205ca){if(_0x4205ca){return _0x4205ca[_0x245c('0x77')](_0x3807fd[_0x245c('0x37')][_0x245c('0x73')],_[_0x245c('0x78')](_0x3807fd[_0x245c('0x37')],[_0x245c('0x73'),'id'])||{})[_0x245c('0x79')](function(_0x4a0bd6){for(var _0x2b99aa=0x0;_0x2b99aa<_0x3807fd[_0x245c('0x37')][_0x245c('0x73')][_0x245c('0x32')];_0x2b99aa+=0x1){socket['emit'](_0x245c('0x61'),{'UserId':Number(_0x3807fd['body'][_0x245c('0x73')][_0x2b99aa]),'WhatsappQueueId':Number(_0x3807fd[_0x245c('0x2b')]['id'])});}return _0x4a0bd6;});}})[_0x245c('0x16')](respondWithResult(_0x38a493,null))['catch'](handleError(_0x38a493,null));};exports[_0x245c('0x75')]=function(_0x1a60db,_0xa1f092){return db[_0x245c('0x20')]['find']({'where':{'id':_0x1a60db[_0x245c('0x2b')]['id']}})[_0x245c('0x16')](handleEntityNotFound(_0xa1f092,null))[_0x245c('0x16')](function(_0x3f5441){if(_0x3f5441){return _0x3f5441['removeAgents'](_0x1a60db[_0x245c('0x27')][_0x245c('0x73')])['then'](function(){if(_[_0x245c('0x7a')](_0x1a60db[_0x245c('0x27')][_0x245c('0x73')])){for(var _0x3c24f0=0x0;_0x3c24f0<_0x1a60db[_0x245c('0x27')][_0x245c('0x73')][_0x245c('0x32')];_0x3c24f0+=0x1){socket[_0x245c('0x60')]('userWhatsappQueue:remove',{'UserId':Number(_0x1a60db[_0x245c('0x27')][_0x245c('0x73')][_0x3c24f0]),'WhatsappQueueId':Number(_0x1a60db[_0x245c('0x2b')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1a60db[_0x245c('0x27')][_0x245c('0x73')]),'WhatsappQueueId':Number(_0x1a60db[_0x245c('0x2b')]['id'])});}});}})[_0x245c('0x16')](respondWithStatusCode(_0xa1f092,null))[_0x245c('0x40')](handleError(_0xa1f092,null));};exports[_0x245c('0x7b')]=function(_0x2b2b78,_0x403112){var _0x1d5dda={};var _0x337d09={};var _0x555009;var _0xb3a7f0;return db[_0x245c('0x20')]['findOne']({'where':{'id':_0x2b2b78['params']['id']}})[_0x245c('0x16')](handleEntityNotFound(_0x403112,null))['then'](function(_0x5e81b6){if(_0x5e81b6){_0x555009=_0x5e81b6;_0x337d09[_0x245c('0x2c')]=_[_0x245c('0x2d')](db[_0x245c('0x63')][_0x245c('0x21')]);_0x337d09['query']=_[_0x245c('0x2d')](_0x2b2b78['query']);_0x337d09[_0x245c('0x2e')]=_[_0x245c('0x2f')](_0x337d09['model'],_0x337d09[_0x245c('0x27')]);_0x1d5dda[_0x245c('0x30')]=_[_0x245c('0x2f')](_0x337d09[_0x245c('0x2c')],qs[_0x245c('0x31')](_0x2b2b78[_0x245c('0x27')][_0x245c('0x31')]));_0x1d5dda[_0x245c('0x30')]=_0x1d5dda[_0x245c('0x30')][_0x245c('0x32')]?_0x1d5dda[_0x245c('0x30')]:_0x337d09['model'];_0x1d5dda['order']=qs['sort'](_0x2b2b78[_0x245c('0x27')]['sort']);_0x1d5dda[_0x245c('0x25')]=qs[_0x245c('0x2e')](_[_0x245c('0x56')](_0x2b2b78['query'],_0x337d09[_0x245c('0x2e')]));if(_0x2b2b78[_0x245c('0x27')][_0x245c('0x4a')]){_0x1d5dda[_0x245c('0x25')]=_[_0x245c('0x34')](_0x1d5dda[_0x245c('0x25')],{'$or':_[_0x245c('0x1f')](_0x1d5dda[_0x245c('0x30')],function(_0x387794){var _0x2d39a3={};_0x2d39a3[_0x387794]={'$like':'%'+_0x2b2b78[_0x245c('0x27')][_0x245c('0x4a')]+'%'};return _0x2d39a3;})});}_0x1d5dda=_['merge']({},_0x1d5dda,_0x2b2b78[_0x245c('0x35')]);return _0x555009[_0x245c('0x7b')](_0x1d5dda);}})['then'](function(_0x28cce7){if(_0x28cce7){_0xb3a7f0=_0x28cce7[_0x245c('0x32')];if(!_0x2b2b78[_0x245c('0x27')][_0x245c('0x46')](_0x245c('0x47'))){_0x1d5dda['limit']=qs['limit'](_0x2b2b78[_0x245c('0x27')][_0x245c('0x12')]);_0x1d5dda[_0x245c('0x10')]=qs[_0x245c('0x10')](_0x2b2b78[_0x245c('0x27')][_0x245c('0x10')]);}return _0x555009[_0x245c('0x7b')](_0x1d5dda);}})[_0x245c('0x16')](function(_0x59537d){if(_0x59537d){return _0x59537d?{'count':_0xb3a7f0,'rows':_0x59537d}:null;}})[_0x245c('0x16')](respondWithResult(_0x403112,null))[_0x245c('0x40')](handleError(_0x403112,null));}; \ No newline at end of file +var _0x32c1=['format','SIP','whatsappPause','getTeams','Team','where','addTeams','ids','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','includes','all','compact','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','order','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','then','destroy','get','UserProfileResource','error','stack','index','map','fieldName','key','getOptions','WhatsappQueue','include','findAll','rows','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','catch','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','sort','pick','WhatsappQueueId','filter','merge','findAndCountAll','UserId','agent','updatedAt','createdAt'];(function(_0x5b60c5,_0x391a87){var _0x4e4537=function(_0x3591a6){while(--_0x3591a6){_0x5b60c5['push'](_0x5b60c5['shift']());}};_0x4e4537(++_0x391a87);}(_0x32c1,0xa7));var _0x132c=function(_0x3c39a6,_0x3101f8){_0x3c39a6=_0x3c39a6-0x0;var _0x4792a4=_0x32c1[_0x3c39a6];return _0x4792a4;};'use strict';var BPromise=require(_0x132c('0x0'));var util=require(_0x132c('0x1'));var _=require('lodash');var squel=require(_0x132c('0x2'));var Redis=require(_0x132c('0x3'));var qs=require(_0x132c('0x4'));var logger=require(_0x132c('0x5'))(_0x132c('0x6'));var config=require(_0x132c('0x7'));var db=require(_0x132c('0x8'))['db'];config[_0x132c('0x9')]=_[_0x132c('0xa')](config[_0x132c('0x9')],{'host':_0x132c('0xb'),'port':0x18eb});var socket=require(_0x132c('0xc'))(new Redis(config['redis']));require(_0x132c('0xd'))['register'](socket);function respondWithStatusCode(_0x39b232,_0xd45c74){_0xd45c74=_0xd45c74||0xcc;return function(_0x382d76){if(_0x382d76){return _0x39b232[_0x132c('0xe')](_0xd45c74);}return _0x39b232[_0x132c('0xf')](_0xd45c74)[_0x132c('0x10')]();};}function respondWithResult(_0x5c6777,_0x1e76b6){_0x1e76b6=_0x1e76b6||0xc8;return function(_0x6f78eb){if(_0x6f78eb){return _0x5c6777[_0x132c('0xf')](_0x1e76b6)['json'](_0x6f78eb);}};}function respondWithFilteredResult(_0x5b12a4,_0x5964b9){return function(_0x4f70f7){if(_0x4f70f7){var _0xea448a=typeof _0x5964b9['offset']===_0x132c('0x11')&&typeof _0x5964b9[_0x132c('0x12')]===_0x132c('0x11');var _0x19a235=_0x4f70f7[_0x132c('0x13')];var _0x31d1c4=_0xea448a?0x0:_0x5964b9['offset'];var _0x3a4702=_0xea448a?_0x4f70f7[_0x132c('0x13')]:_0x5964b9[_0x132c('0x14')]+_0x5964b9['limit'];var _0x56ddcf;if(_0x3a4702>=_0x19a235){_0x3a4702=_0x19a235;_0x56ddcf=0xc8;}else{_0x56ddcf=0xce;}_0x5b12a4[_0x132c('0xf')](_0x56ddcf);return _0x5b12a4[_0x132c('0x15')](_0x132c('0x16'),_0x31d1c4+'-'+_0x3a4702+'/'+_0x19a235)['json'](_0x4f70f7);}return null;};}function saveUpdates(_0x144dfe){return function(_0x4a76ed){if(_0x4a76ed){return _0x4a76ed['update'](_0x144dfe)[_0x132c('0x17')](function(_0x5b0459){return _0x5b0459;});}return null;};}function removeEntity(_0x37a27b){return function(_0x29129d){if(_0x29129d){return _0x29129d[_0x132c('0x18')]()[_0x132c('0x17')](function(){var _0x570f32=_0x29129d[_0x132c('0x19')]({'plain':!![]});var _0x223d31='WhatsappQueues';return db[_0x132c('0x1a')][_0x132c('0x18')]({'where':{'type':_0x223d31,'resourceId':_0x570f32['id']}})['then'](function(){return _0x29129d;});})['then'](function(){_0x37a27b[_0x132c('0xf')](0xcc)[_0x132c('0x10')]();});}};}function handleEntityNotFound(_0x1e7bfa){return function(_0xdd8e60){if(!_0xdd8e60){_0x1e7bfa['sendStatus'](0x194);}return _0xdd8e60;};}function handleError(_0x5c4c79,_0x279e2a){_0x279e2a=_0x279e2a||0x1f4;return function(_0x54e3eb){logger[_0x132c('0x1b')](_0x54e3eb[_0x132c('0x1c')]);if(_0x54e3eb['name']){delete _0x54e3eb['name'];}_0x5c4c79[_0x132c('0xf')](_0x279e2a)['send'](_0x54e3eb);};}exports[_0x132c('0x1d')]=function(_0x50077f,_0x27a906){var _0x508a06={};var _0xe70454={'count':0x0,'rows':[]};var _0x4f746f=_[_0x132c('0x1e')](db['WhatsappQueue']['rawAttributes'],function(_0x513ee0){return{'name':_0x513ee0[_0x132c('0x1f')],'type':_0x513ee0['type'][_0x132c('0x20')]};});_0x508a06=qs[_0x132c('0x21')](_0x4f746f,_0x50077f);var _0x1a12f1={'where':_0x508a06['where']};return db[_0x132c('0x22')][_0x132c('0x13')](_0x1a12f1)[_0x132c('0x17')](function(_0x3d4751){_0xe70454[_0x132c('0x13')]=_0x3d4751;_0x508a06['include']=qs[_0x132c('0x23')](_0x50077f['query']);return db['WhatsappQueue'][_0x132c('0x24')](_0x508a06);})['then'](function(_0x19d1e7){_0xe70454[_0x132c('0x25')]=_0x19d1e7;return _0xe70454;})['then'](respondWithFilteredResult(_0x27a906,_0x508a06))['catch'](handleError(_0x27a906,null));};exports[_0x132c('0x26')]=function(_0x55e0cb,_0x4d693f){var _0x10f252={'raw':!![],'where':{'id':_0x55e0cb[_0x132c('0x27')]['id']}},_0x54acf1={};_0x54acf1[_0x132c('0x28')]=_[_0x132c('0x29')](db[_0x132c('0x22')][_0x132c('0x2a')]);_0x54acf1['query']=_[_0x132c('0x29')](_0x55e0cb[_0x132c('0x2b')]);_0x54acf1[_0x132c('0x2c')]=_[_0x132c('0x2d')](_0x54acf1[_0x132c('0x28')],_0x54acf1[_0x132c('0x2b')]);_0x10f252[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x54acf1[_0x132c('0x28')],qs['fields'](_0x55e0cb[_0x132c('0x2b')][_0x132c('0x2f')]));_0x10f252[_0x132c('0x2e')]=_0x10f252[_0x132c('0x2e')][_0x132c('0x30')]?_0x10f252[_0x132c('0x2e')]:_0x54acf1[_0x132c('0x28')];if(_0x55e0cb[_0x132c('0x2b')]['includeAll']){_0x10f252[_0x132c('0x23')]=[{'all':!![]}];}_0x10f252=_['merge']({},_0x10f252,_0x55e0cb[_0x132c('0x31')]);return db[_0x132c('0x22')][_0x132c('0x32')](_0x10f252)[_0x132c('0x17')](handleEntityNotFound(_0x4d693f,null))[_0x132c('0x17')](respondWithResult(_0x4d693f,null))['catch'](handleError(_0x4d693f,null));};exports[_0x132c('0x33')]=function(_0x2f3c79,_0x67aa7b){return db[_0x132c('0x22')][_0x132c('0x33')](_0x2f3c79[_0x132c('0x34')],{})[_0x132c('0x17')](function(_0x5d9f87){var _0x343b13=_0x2f3c79[_0x132c('0x35')][_0x132c('0x19')]({'plain':!![]});if(!_0x343b13)throw new Error(_0x132c('0x36'));if(_0x343b13[_0x132c('0x37')]===_0x132c('0x35')){var _0x549497=_0x5d9f87[_0x132c('0x19')]({'plain':!![]});var _0x42a34f=_0x132c('0x38');return db[_0x132c('0x39')][_0x132c('0x32')]({'where':{'name':_0x42a34f,'userProfileId':_0x343b13['userProfileId']},'raw':!![]})[_0x132c('0x17')](function(_0x161a16){if(_0x161a16&&_0x161a16[_0x132c('0x3a')]===0x0){return db[_0x132c('0x1a')]['create']({'name':_0x549497[_0x132c('0x3b')],'resourceId':_0x549497['id'],'type':_0x161a16['name'],'sectionId':_0x161a16['id']},{})[_0x132c('0x17')](function(){return _0x5d9f87;});}else{return _0x5d9f87;}})['catch'](function(_0x42f9e8){logger[_0x132c('0x1b')](_0x132c('0x3c'),_0x42f9e8);throw _0x42f9e8;});}return _0x5d9f87;})[_0x132c('0x17')](respondWithResult(_0x67aa7b,0xc9))['catch'](handleError(_0x67aa7b,null));};exports[_0x132c('0x3d')]=function(_0x3d816d,_0x30d37c){if(_0x3d816d[_0x132c('0x34')]['id']){delete _0x3d816d['body']['id'];}return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x3d816d[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x30d37c,null))['then'](saveUpdates(_0x3d816d[_0x132c('0x34')],null))['then'](respondWithResult(_0x30d37c,null))[_0x132c('0x3e')](handleError(_0x30d37c,null));};exports[_0x132c('0x18')]=function(_0x5a5eef,_0x2a445c){return db['WhatsappQueue']['find']({'where':{'id':_0x5a5eef[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x2a445c,null))[_0x132c('0x17')](removeEntity(_0x2a445c,null))[_0x132c('0x3e')](handleError(_0x2a445c,null));};exports[_0x132c('0x3f')]=function(_0x559306,_0x183573){return db[_0x132c('0x22')]['describe']()[_0x132c('0x17')](respondWithResult(_0x183573,null))['catch'](handleError(_0x183573,null));};exports[_0x132c('0x40')]=function(_0xee6d48,_0x29c6c8){var _0x490d04={'raw':!![],'where':{}},_0x5307a4={},_0x99403e;return db[_0x132c('0x22')][_0x132c('0x41')]({'where':{'id':_0xee6d48[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x29c6c8,null))[_0x132c('0x17')](function(_0x1a2c9c){if(_0x1a2c9c){_0x99403e=_0x1a2c9c['get']({'plain':!![]});_0x5307a4['model']=_[_0x132c('0x29')](db[_0x132c('0x42')][_0x132c('0x2a')]);_0x5307a4['query']=_['keys'](_0xee6d48['query']);_0x5307a4[_0x132c('0x2c')]=_['intersection'](_0x5307a4[_0x132c('0x28')],_0x5307a4[_0x132c('0x2b')]);_0x490d04[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x5307a4[_0x132c('0x28')],qs['fields'](_0xee6d48[_0x132c('0x2b')]['fields']));_0x490d04[_0x132c('0x2e')]=_0x490d04[_0x132c('0x2e')][_0x132c('0x30')]?_0x490d04['attributes']:_0x5307a4['model'];if(!_0xee6d48[_0x132c('0x2b')][_0x132c('0x43')](_0x132c('0x44'))){_0x490d04[_0x132c('0x12')]=qs[_0x132c('0x12')](_0xee6d48[_0x132c('0x2b')][_0x132c('0x12')]);_0x490d04['offset']=qs[_0x132c('0x14')](_0xee6d48['query'][_0x132c('0x14')]);}_0x490d04['order']=qs['sort'](_0xee6d48[_0x132c('0x2b')][_0x132c('0x45')]);_0x490d04['where']=qs[_0x132c('0x2c')](_[_0x132c('0x46')](_0xee6d48[_0x132c('0x2b')],_0x5307a4[_0x132c('0x2c')]));_0x490d04['where'][_0x132c('0x47')]=_0x1a2c9c['id'];if(_0xee6d48['query'][_0x132c('0x48')]){_0x490d04['where']=_[_0x132c('0x49')](_0x490d04['where'],{'$or':_['map'](_0x490d04['attributes'],function(_0x1736fa){var _0xc89782={};_0xc89782[_0x1736fa]={'$like':'%'+_0xee6d48[_0x132c('0x2b')][_0x132c('0x48')]+'%'};return _0xc89782;})});}_0x490d04=_['merge']({},_0x490d04,_0xee6d48[_0x132c('0x31')]);return db['UserWhatsappQueue'][_0x132c('0x24')](_0x490d04);}})[_0x132c('0x17')](function(_0x180211){if(_0x180211){return db['User'][_0x132c('0x4a')]({'where':{'id':_['map'](_0x180211,_0x132c('0x4b')),'role':_0x132c('0x4c')},'attributes':['id',_0x132c('0x3b'),'whatsappPause',_0x132c('0x4d'),_0x132c('0x4e')]});}})[_0x132c('0x17')](function(_0x585f43){if(_0x585f43){return{'count':_0x585f43[_0x132c('0x13')],'rows':_[_0x132c('0x1e')](_0x585f43[_0x132c('0x25')],function(_0x4f7b7a){return{'membername':_0x4f7b7a[_0x132c('0x3b')],'UserId':_0x4f7b7a['id'],'queue_name':_0x99403e[_0x132c('0x3b')],'WhatsappQueueId':_0x99403e['id'],'interface':util[_0x132c('0x4f')]('%s/%s',_0x132c('0x50'),_0x4f7b7a[_0x132c('0x3b')]),'penalty':0x0,'paused':_0x4f7b7a[_0x132c('0x51')],'createdAt':_0x4f7b7a['createdAt'],'updatedAt':_0x4f7b7a[_0x132c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x132c('0x17')](respondWithFilteredResult(_0x29c6c8,_0x490d04))[_0x132c('0x3e')](handleError(_0x29c6c8,null));};exports[_0x132c('0x52')]=function(_0x1d0547,_0x1a4a9e){var _0x357039={};var _0x1b1ffd={};var _0x2a5b0b;var _0x3cc83a;return db[_0x132c('0x22')][_0x132c('0x41')]({'where':{'id':_0x1d0547['params']['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x1a4a9e,null))[_0x132c('0x17')](function(_0x56c5fa){if(_0x56c5fa){_0x2a5b0b=_0x56c5fa;_0x1b1ffd[_0x132c('0x28')]=_[_0x132c('0x29')](db[_0x132c('0x53')]['rawAttributes']);_0x1b1ffd[_0x132c('0x2b')]=_['keys'](_0x1d0547[_0x132c('0x2b')]);_0x1b1ffd[_0x132c('0x2c')]=_[_0x132c('0x2d')](_0x1b1ffd[_0x132c('0x28')],_0x1b1ffd[_0x132c('0x2b')]);_0x357039[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x1b1ffd[_0x132c('0x28')],qs[_0x132c('0x2f')](_0x1d0547['query'][_0x132c('0x2f')]));_0x357039[_0x132c('0x2e')]=_0x357039[_0x132c('0x2e')][_0x132c('0x30')]?_0x357039[_0x132c('0x2e')]:_0x1b1ffd[_0x132c('0x28')];_0x357039['order']=qs[_0x132c('0x45')](_0x1d0547['query'][_0x132c('0x45')]);_0x357039[_0x132c('0x54')]=qs[_0x132c('0x2c')](_[_0x132c('0x46')](_0x1d0547[_0x132c('0x2b')],_0x1b1ffd[_0x132c('0x2c')]));if(_0x1d0547[_0x132c('0x2b')]['filter']){_0x357039['where']=_[_0x132c('0x49')](_0x357039['where'],{'$or':_[_0x132c('0x1e')](_0x357039[_0x132c('0x2e')],function(_0x5904d4){var _0x5cbbfb={};_0x5cbbfb[_0x5904d4]={'$like':'%'+_0x1d0547['query']['filter']+'%'};return _0x5cbbfb;})});}_0x357039=_['merge']({},_0x357039,_0x1d0547[_0x132c('0x31')]);return _0x2a5b0b[_0x132c('0x52')](_0x357039);}})['then'](function(_0x14233a){if(_0x14233a){_0x3cc83a=_0x14233a[_0x132c('0x30')];if(!_0x1d0547[_0x132c('0x2b')][_0x132c('0x43')]('nolimit')){_0x357039[_0x132c('0x12')]=qs[_0x132c('0x12')](_0x1d0547[_0x132c('0x2b')][_0x132c('0x12')]);_0x357039[_0x132c('0x14')]=qs['offset'](_0x1d0547[_0x132c('0x2b')]['offset']);}return _0x2a5b0b['getTeams'](_0x357039);}})[_0x132c('0x17')](function(_0x4dc4d1){if(_0x4dc4d1){return _0x4dc4d1?{'count':_0x3cc83a,'rows':_0x4dc4d1}:null;}})[_0x132c('0x17')](respondWithResult(_0x1a4a9e,null))[_0x132c('0x3e')](handleError(_0x1a4a9e,null));};exports[_0x132c('0x55')]=function(_0x8faea7,_0x40206e){var _0x26ab76=_0x8faea7[_0x132c('0x34')][_0x132c('0x56')];return db[_0x132c('0x53')]['findAll']({'where':{'id':_0x26ab76},'attributes':['id'],'include':[{'model':db[_0x132c('0x57')],'as':_0x132c('0x58'),'attributes':['id',_0x132c('0x3b'),_0x132c('0x59'),_0x132c('0x5a'),'interface'],'raw':!![]}]})['then'](function(_0x9c52cf){if(_0x9c52cf){var _0x2b327e=_[_0x132c('0x5b')](_0x9c52cf,function(_0x5119bf){var _0x460209=_0x5119bf[_0x132c('0x19')]({'plain':!![]});return _0x460209[_0x132c('0x58')];});return db['WhatsappQueue'][_0x132c('0x32')]({'where':{'id':_0x8faea7[_0x132c('0x27')]['id']}})['then'](function(_0x314555){return db['sequelize'][_0x132c('0x5c')](function(_0x410c87){return _0x314555[_0x132c('0x55')](_0x26ab76,{'transaction':_0x410c87})[_0x132c('0x17')](function(){return BPromise[_0x132c('0x5d')](_0x2b327e,function(_0x3695a5){return db[_0x132c('0x42')][_0x132c('0x5e')]({'where':{'UserId':_0x3695a5['id'],'WhatsappQueueId':_0x8faea7[_0x132c('0x27')]['id']},'transaction':_0x410c87});});})[_0x132c('0x17')](function(){_0x2b327e[_0x132c('0x5f')](function(_0x2ca185){socket[_0x132c('0x60')](_0x132c('0x61'),{'UserId':_0x2ca185['id'],'WhatsappQueueId':_0x314555['id']});});});});});}})[_0x132c('0x17')](respondWithStatusCode(_0x40206e,null))[_0x132c('0x3e')](handleError(_0x40206e,null));};exports[_0x132c('0x62')]=function(_0x86b5fe,_0x12e46e){return db[_0x132c('0x53')][_0x132c('0x24')]({'where':{'id':_0x86b5fe['query'][_0x132c('0x56')]},'attributes':['id'],'include':[{'model':db[_0x132c('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x132c('0x17')](handleEntityNotFound(_0x12e46e,null))[_0x132c('0x17')](function(_0x14edd2){var _0x570ffe=_[_0x132c('0x1e')](_0x14edd2,'id');var _0x46c29b=[];var _0x2ec9f1=[];var _0x346449=squel[_0x132c('0x63')]();_0x346449[_0x132c('0x64')](_0x132c('0x65'))[_0x132c('0x66')]('team_has_whatsapp_queues','tq')['join'](_0x132c('0x67'),'ut',_0x132c('0x68'))[_0x132c('0x54')](_0x132c('0x69'),_0x86b5fe[_0x132c('0x27')]['id']);for(var _0x1cf70a=0x0;_0x1cf70a<_0x14edd2['length'];_0x1cf70a+=0x1){let _0x3526ba=_0x14edd2[_0x1cf70a];for(var _0x57d403=0x0;_0x57d403<_0x3526ba[_0x132c('0x58')][_0x132c('0x30')];_0x57d403+=0x1){let _0x17ad11=_0x3526ba[_0x132c('0x58')][_0x57d403];var _0x304fa3=_0x346449['clone']();_0x304fa3[_0x132c('0x54')](_0x132c('0x6a'),_0x17ad11['id']);_0x2ec9f1[_0x132c('0x6b')](db['sequelize'][_0x132c('0x2b')](_0x304fa3[_0x132c('0x6c')](),{'type':db[_0x132c('0x6d')]['QueryTypes'][_0x132c('0x6e')]})[_0x132c('0x17')](function(_0x3f8604){if(_0x3f8604[_0x132c('0x30')]===0x1){return _0x17ad11['id'];}else{var _0x17e87f=_[_0x132c('0x6f')](_[_0x132c('0x1e')](_0x3f8604,'TeamId'),function(_0x3e5a1d){return _[_0x132c('0x70')](_0x570ffe,_0x3e5a1d);});if(_0x17e87f){return _0x17ad11['id'];}}}));}}return BPromise[_0x132c('0x71')](_0x2ec9f1)[_0x132c('0x17')](function(_0x4c7f29){_0x46c29b=_(_0x46c29b)['union'](_0x4c7f29)[_0x132c('0x72')]()['value']();return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x86b5fe[_0x132c('0x27')]['id']}})[_0x132c('0x17')](function(_0xd26834){return db['sequelize']['transaction'](function(_0xf56c1e){return _0xd26834['removeTeams'](_0x86b5fe['query'][_0x132c('0x56')],{'transaction':_0xf56c1e})[_0x132c('0x17')](function(){if(!_['isEmpty'](_0x46c29b)){return _0xd26834['removeAgents'](_0x46c29b,{'transaction':_0xf56c1e});}})[_0x132c('0x17')](function(){_0x46c29b[_0x132c('0x5f')](function(_0x474ac5){socket[_0x132c('0x60')](_0x132c('0x73'),{'UserId':_0x474ac5,'WhatsappQueueId':_0xd26834['id']});});});});});});})[_0x132c('0x17')](respondWithStatusCode(_0x12e46e,null))['catch'](handleError(_0x12e46e,null));};exports[_0x132c('0x74')]=function(_0x58d827,_0x1f4f2f){return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x58d827['params']['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x1f4f2f,null))[_0x132c('0x17')](function(_0x54c826){if(_0x54c826){return _0x54c826['addAgents'](_0x58d827['body'][_0x132c('0x56')],_[_0x132c('0x75')](_0x58d827['body'],[_0x132c('0x56'),'id'])||{})[_0x132c('0x76')](function(_0x2dde2a){for(var _0x150401=0x0;_0x150401<_0x58d827[_0x132c('0x34')][_0x132c('0x56')][_0x132c('0x30')];_0x150401+=0x1){socket['emit'](_0x132c('0x61'),{'UserId':Number(_0x58d827[_0x132c('0x34')][_0x132c('0x56')][_0x150401]),'WhatsappQueueId':Number(_0x58d827[_0x132c('0x27')]['id'])});}return _0x2dde2a;});}})[_0x132c('0x17')](respondWithResult(_0x1f4f2f,null))['catch'](handleError(_0x1f4f2f,null));};exports[_0x132c('0x77')]=function(_0x19b5b9,_0x537726){return db[_0x132c('0x22')][_0x132c('0x32')]({'where':{'id':_0x19b5b9[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x537726,null))[_0x132c('0x17')](function(_0x53fa95){if(_0x53fa95){return _0x53fa95[_0x132c('0x77')](_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')])[_0x132c('0x17')](function(){if(_[_0x132c('0x78')](_0x19b5b9[_0x132c('0x2b')]['ids'])){for(var _0x3ae20d=0x0;_0x3ae20d<_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')]['length'];_0x3ae20d+=0x1){socket[_0x132c('0x60')](_0x132c('0x73'),{'UserId':Number(_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')][_0x3ae20d]),'WhatsappQueueId':Number(_0x19b5b9[_0x132c('0x27')]['id'])});}}else{socket[_0x132c('0x60')](_0x132c('0x73'),{'UserId':Number(_0x19b5b9[_0x132c('0x2b')][_0x132c('0x56')]),'WhatsappQueueId':Number(_0x19b5b9[_0x132c('0x27')]['id'])});}});}})[_0x132c('0x17')](respondWithStatusCode(_0x537726,null))['catch'](handleError(_0x537726,null));};exports[_0x132c('0x79')]=function(_0xd243b7,_0x48a2db){var _0xbb043={};var _0x3dfe2f={};var _0x9e5221;var _0xba9c86;return db['WhatsappQueue']['findOne']({'where':{'id':_0xd243b7[_0x132c('0x27')]['id']}})[_0x132c('0x17')](handleEntityNotFound(_0x48a2db,null))[_0x132c('0x17')](function(_0x5ddc5c){if(_0x5ddc5c){_0x9e5221=_0x5ddc5c;_0x3dfe2f[_0x132c('0x28')]=_['keys'](db['User'][_0x132c('0x2a')]);_0x3dfe2f[_0x132c('0x2b')]=_[_0x132c('0x29')](_0xd243b7[_0x132c('0x2b')]);_0x3dfe2f[_0x132c('0x2c')]=_['intersection'](_0x3dfe2f['model'],_0x3dfe2f['query']);_0xbb043[_0x132c('0x2e')]=_[_0x132c('0x2d')](_0x3dfe2f[_0x132c('0x28')],qs['fields'](_0xd243b7[_0x132c('0x2b')][_0x132c('0x2f')]));_0xbb043[_0x132c('0x2e')]=_0xbb043[_0x132c('0x2e')]['length']?_0xbb043[_0x132c('0x2e')]:_0x3dfe2f['model'];_0xbb043[_0x132c('0x7a')]=qs[_0x132c('0x45')](_0xd243b7['query'][_0x132c('0x45')]);_0xbb043[_0x132c('0x54')]=qs[_0x132c('0x2c')](_['pick'](_0xd243b7[_0x132c('0x2b')],_0x3dfe2f[_0x132c('0x2c')]));if(_0xd243b7[_0x132c('0x2b')][_0x132c('0x48')]){_0xbb043[_0x132c('0x54')]=_[_0x132c('0x49')](_0xbb043['where'],{'$or':_[_0x132c('0x1e')](_0xbb043[_0x132c('0x2e')],function(_0x174c99){var _0x3dfc7e={};_0x3dfc7e[_0x174c99]={'$like':'%'+_0xd243b7['query']['filter']+'%'};return _0x3dfc7e;})});}_0xbb043=_['merge']({},_0xbb043,_0xd243b7[_0x132c('0x31')]);return _0x9e5221[_0x132c('0x79')](_0xbb043);}})[_0x132c('0x17')](function(_0x2fa834){if(_0x2fa834){_0xba9c86=_0x2fa834[_0x132c('0x30')];if(!_0xd243b7['query']['hasOwnProperty'](_0x132c('0x44'))){_0xbb043[_0x132c('0x12')]=qs[_0x132c('0x12')](_0xd243b7['query']['limit']);_0xbb043[_0x132c('0x14')]=qs[_0x132c('0x14')](_0xd243b7[_0x132c('0x2b')][_0x132c('0x14')]);}return _0x9e5221[_0x132c('0x79')](_0xbb043);}})[_0x132c('0x17')](function(_0x59d3cc){if(_0x59d3cc){return _0x59d3cc?{'count':_0xba9c86,'rows':_0x59d3cc}:null;}})[_0x132c('0x17')](respondWithResult(_0x48a2db,null))['catch'](handleError(_0x48a2db,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 240037b..ce62251 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 _0xc71f=['hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc71f,0x1c3));var _0xfc71=function(_0x470291,_0x1ce9b4){_0x470291=_0x470291-0x0;var _0x398a4e=_0xc71f[_0x470291];return _0x398a4e;};'use strict';var EventEmitter=require(_0xfc71('0x0'));var WhatsappQueue=require(_0xfc71('0x1'))['db'][_0xfc71('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfc71('0x3')](0x0);var events={'afterCreate':_0xfc71('0x4'),'afterUpdate':_0xfc71('0x5'),'afterDestroy':_0xfc71('0x6')};function emitEvent(_0x45b465){return function(_0x47028d,_0x147081,_0x12d25e){WhatsappQueueEvents['emit'](_0x45b465+':'+_0x47028d['id'],_0x47028d);WhatsappQueueEvents['emit'](_0x45b465,_0x47028d);_0x12d25e(null);};}for(var e in events){if(events[_0xfc71('0x7')](e)){var event=events[e];WhatsappQueue[_0xfc71('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x0729=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0729,0x1a3));var _0x9072=function(_0x381e3b,_0x2313d4){_0x381e3b=_0x381e3b-0x0;var _0x18ea8c=_0x0729[_0x381e3b];return _0x18ea8c;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x9072('0x0'))['db'][_0x9072('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9072('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9072('0x3')};function emitEvent(_0x3404cd){return function(_0xff1c8d,_0x16d2a2,_0x2438db){WhatsappQueueEvents[_0x9072('0x4')](_0x3404cd+':'+_0xff1c8d['id'],_0xff1c8d);WhatsappQueueEvents[_0x9072('0x4')](_0x3404cd,_0xff1c8d);_0x2438db(null);};}for(var e in events){if(events[_0x9072('0x5')](e)){var event=events[e];WhatsappQueue[_0x9072('0x6')](e,emitEvent(event));}}module[_0x9072('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c9c43d2..4765d57 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 _0xcfd1=['path','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcfd1,0x95));var _0x1cfd=function(_0x273aab,_0x1db224){_0x273aab=_0x273aab-0x0;var _0x58eff6=_0xcfd1[_0x273aab];return _0x58eff6;};'use strict';var _=require(_0x1cfd('0x0'));var util=require(_0x1cfd('0x1'));var logger=require(_0x1cfd('0x2'))(_0x1cfd('0x3'));var moment=require(_0x1cfd('0x4'));var BPromise=require(_0x1cfd('0x5'));var rp=require(_0x1cfd('0x6'));var fs=require('fs');var path=require(_0x1cfd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1cfd('0x8'));module[_0x1cfd('0x9')]=function(_0x4ed72a,_0x429a68){return _0x4ed72a[_0x1cfd('0xa')](_0x1cfd('0xb'),attributes,{'tableName':_0x1cfd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f56=['./whatsappQueue.attributes','exports','define','whatsapp_queues','util','moment','bluebird','request-promise','path'];(function(_0x94ba2,_0x2b3641){var _0x45e8e6=function(_0x3a0c39){while(--_0x3a0c39){_0x94ba2['push'](_0x94ba2['shift']());}};_0x45e8e6(++_0x2b3641);}(_0x1f56,0x82));var _0x61f5=function(_0x36a260,_0x24d4ff){_0x36a260=_0x36a260-0x0;var _0x2dfb87=_0x1f56[_0x36a260];return _0x2dfb87;};'use strict';var _=require('lodash');var util=require(_0x61f5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x61f5('0x1'));var BPromise=require(_0x61f5('0x2'));var rp=require(_0x61f5('0x3'));var fs=require('fs');var path=require(_0x61f5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61f5('0x5'));module[_0x61f5('0x6')]=function(_0x23df51,_0x3437ee){return _0x23df51[_0x61f5('0x7')]('WhatsappQueue',attributes,{'tableName':_0x61f5('0x8'),'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 d3e1908..d8d8a84 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 _0x05f2=['include','model','then','ShowWhatsappQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','map'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x05f2,0x9e));var _0x205f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x05f2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x205f('0x0'));var util=require('util');var moment=require(_0x205f('0x1'));var BPromise=require(_0x205f('0x2'));var rs=require(_0x205f('0x3'));var fs=require('fs');var Redis=require(_0x205f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x205f('0x5'))('rpc');var config=require(_0x205f('0x6'));var jayson=require(_0x205f('0x7'));var client=jayson[_0x205f('0x8')][_0x205f('0x9')]({'port':0x232a});config[_0x205f('0xa')]=_[_0x205f('0xb')](config[_0x205f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x205f('0xc'))[_0x205f('0xd')](socket);function respondWithRpcPromise(_0x1e9e65,_0x21fa6d,_0x3fd54f){return new BPromise(function(_0x4cef8f,_0x138f6a){return client[_0x205f('0xe')](_0x1e9e65,_0x3fd54f)['then'](function(_0x1e62b6){logger[_0x205f('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x21fa6d,_0x205f('0x10'));logger[_0x205f('0x11')](_0x205f('0x12'),_0x21fa6d,_0x205f('0x10'),JSON[_0x205f('0x13')](_0x1e62b6));if(_0x1e62b6[_0x205f('0x14')]){if(_0x1e62b6[_0x205f('0x14')]['code']===0x1f4){logger['error'](_0x205f('0x15'),_0x21fa6d,_0x1e62b6[_0x205f('0x14')][_0x205f('0x16')]);return _0x138f6a(_0x1e62b6[_0x205f('0x14')][_0x205f('0x16')]);}logger[_0x205f('0x14')](_0x205f('0x15'),_0x21fa6d,_0x1e62b6[_0x205f('0x14')]['message']);return _0x4cef8f(_0x1e62b6[_0x205f('0x14')][_0x205f('0x16')]);}else{logger['info'](_0x205f('0x15'),_0x21fa6d,_0x205f('0x10'));_0x4cef8f(_0x1e62b6[_0x205f('0x17')]['message']);}})[_0x205f('0x18')](function(_0xc98966){logger[_0x205f('0x14')](_0x205f('0x15'),_0x21fa6d,_0xc98966);_0x138f6a(_0xc98966);});});}exports[_0x205f('0x19')]=function(_0x2cd6e4){var _0x9a93f6=this;return new Promise(function(_0x7273aa,_0x513f12){return db[_0x205f('0x1a')][_0x205f('0x1b')]({'raw':_0x2cd6e4[_0x205f('0x1c')]?_0x2cd6e4[_0x205f('0x1c')][_0x205f('0x1d')]===undefined?!![]:![]:!![],'where':_0x2cd6e4[_0x205f('0x1c')]?_0x2cd6e4[_0x205f('0x1c')]['where']||null:null,'attributes':_0x2cd6e4[_0x205f('0x1c')]?_0x2cd6e4['options'][_0x205f('0x1e')]||null:null,'limit':_0x2cd6e4['options']?_0x2cd6e4[_0x205f('0x1c')]['limit']||null:null,'include':_0x2cd6e4[_0x205f('0x1c')]?_0x2cd6e4[_0x205f('0x1c')]['include']?_[_0x205f('0x1f')](_0x2cd6e4[_0x205f('0x1c')][_0x205f('0x20')],function(_0xbf19d7){return{'model':db[_0xbf19d7[_0x205f('0x21')]],'as':_0xbf19d7['as'],'attributes':_0xbf19d7[_0x205f('0x1e')],'include':_0xbf19d7[_0x205f('0x20')]?_[_0x205f('0x1f')](_0xbf19d7[_0x205f('0x20')],function(_0x56282c){return{'model':db[_0x56282c[_0x205f('0x21')]],'as':_0x56282c['as'],'attributes':_0x56282c[_0x205f('0x1e')],'include':_0x56282c[_0x205f('0x20')]?_[_0x205f('0x1f')](_0x56282c[_0x205f('0x20')],function(_0x220d9f){return{'model':db[_0x220d9f[_0x205f('0x21')]],'as':_0x220d9f['as'],'attributes':_0x220d9f[_0x205f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x205f('0x22')](function(_0x474c09){logger[_0x205f('0xf')](_0x205f('0x19'),_0x2cd6e4);logger['debug'](_0x205f('0x19'),_0x2cd6e4,JSON[_0x205f('0x13')](_0x474c09));_0x7273aa(_0x474c09);})[_0x205f('0x18')](function(_0x24dc79){logger[_0x205f('0x14')]('GetWhatsappQueue',_0x24dc79[_0x205f('0x16')],_0x2cd6e4);_0x513f12(_0x9a93f6[_0x205f('0x14')](0x1f4,_0x24dc79[_0x205f('0x16')]));});});};exports[_0x205f('0x23')]=function(_0x41598f){var _0x2b8b07=this;return new Promise(function(_0x329c93,_0x650467){return db[_0x205f('0x1a')][_0x205f('0x24')]({'raw':_0x41598f[_0x205f('0x1c')]?_0x41598f['options'][_0x205f('0x1d')]===undefined?!![]:![]:!![],'where':_0x41598f[_0x205f('0x1c')]?_0x41598f[_0x205f('0x1c')][_0x205f('0x25')]||null:null,'attributes':_0x41598f[_0x205f('0x1c')]?_0x41598f['options'][_0x205f('0x1e')]||null:null,'include':_0x41598f['options']?_0x41598f['options'][_0x205f('0x20')]?_[_0x205f('0x1f')](_0x41598f['options']['include'],function(_0x5cf8e8){return{'model':db[_0x5cf8e8['model']],'as':_0x5cf8e8['as'],'attributes':_0x5cf8e8['attributes'],'include':_0x5cf8e8[_0x205f('0x20')]?_[_0x205f('0x1f')](_0x5cf8e8[_0x205f('0x20')],function(_0x1b9668){return{'model':db[_0x1b9668[_0x205f('0x21')]],'as':_0x1b9668['as'],'attributes':_0x1b9668[_0x205f('0x1e')],'include':_0x1b9668[_0x205f('0x20')]?_[_0x205f('0x1f')](_0x1b9668[_0x205f('0x20')],function(_0x16caed){return{'model':db[_0x16caed['model']],'as':_0x16caed['as'],'attributes':_0x16caed[_0x205f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x205f('0x22')](function(_0x5a37b3){logger['info'](_0x205f('0x23'),_0x41598f);logger[_0x205f('0x11')](_0x205f('0x23'),_0x41598f,JSON[_0x205f('0x13')](_0x5a37b3));_0x329c93(_0x5a37b3);})[_0x205f('0x18')](function(_0x1cd6ce){logger['error'](_0x205f('0x23'),_0x1cd6ce[_0x205f('0x16')],_0x41598f);_0x650467(_0x2b8b07['error'](0x1f4,_0x1cd6ce[_0x205f('0x16')]));});});}; \ No newline at end of file +var _0xac88=['localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetWhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xac88,0x74));var _0x8ac8=function(_0x12a3ec,_0x562c6d){_0x12a3ec=_0x12a3ec-0x0;var _0xa9c4ee=_0xac88[_0x12a3ec];return _0xa9c4ee;};'use strict';var _=require(_0x8ac8('0x0'));var util=require(_0x8ac8('0x1'));var moment=require(_0x8ac8('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ac8('0x3'));var fs=require('fs');var Redis=require(_0x8ac8('0x4'));var db=require(_0x8ac8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ac8('0x6'))(_0x8ac8('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ac8('0x8'));var client=jayson[_0x8ac8('0x9')][_0x8ac8('0xa')]({'port':0x232a});config['redis']=_[_0x8ac8('0xb')](config[_0x8ac8('0xc')],{'host':_0x8ac8('0xd'),'port':0x18eb});var socket=require(_0x8ac8('0xe'))(new Redis(config['redis']));require(_0x8ac8('0xf'))[_0x8ac8('0x10')](socket);function respondWithRpcPromise(_0x1bb62c,_0x7fa559,_0x302598){return new BPromise(function(_0x3e6c7a,_0x15df2d){return client[_0x8ac8('0x11')](_0x1bb62c,_0x302598)[_0x8ac8('0x12')](function(_0x18fa1d){logger[_0x8ac8('0x13')](_0x8ac8('0x14'),_0x7fa559,'request\x20sent');logger[_0x8ac8('0x15')](_0x8ac8('0x16'),_0x7fa559,'request\x20sent',JSON[_0x8ac8('0x17')](_0x18fa1d));if(_0x18fa1d[_0x8ac8('0x18')]){if(_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x19')]===0x1f4){logger[_0x8ac8('0x18')](_0x8ac8('0x14'),_0x7fa559,_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x1a')]);return _0x15df2d(_0x18fa1d[_0x8ac8('0x18')]['message']);}logger[_0x8ac8('0x18')](_0x8ac8('0x14'),_0x7fa559,_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x1a')]);return _0x3e6c7a(_0x18fa1d[_0x8ac8('0x18')][_0x8ac8('0x1a')]);}else{logger[_0x8ac8('0x13')](_0x8ac8('0x14'),_0x7fa559,_0x8ac8('0x1b'));_0x3e6c7a(_0x18fa1d[_0x8ac8('0x1c')][_0x8ac8('0x1a')]);}})[_0x8ac8('0x1d')](function(_0x1598a9){logger[_0x8ac8('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x7fa559,_0x1598a9);_0x15df2d(_0x1598a9);});});}exports[_0x8ac8('0x1e')]=function(_0x5a23d3){var _0x1398d5=this;return new Promise(function(_0x299ad7,_0x419050){return db['WhatsappQueue'][_0x8ac8('0x1f')]({'raw':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x21')]===undefined?!![]:![]:!![],'where':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x22')]||null:null,'attributes':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')]['attributes']||null:null,'limit':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x23')]||null:null,'include':_0x5a23d3[_0x8ac8('0x20')]?_0x5a23d3['options'][_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0x5a23d3[_0x8ac8('0x20')][_0x8ac8('0x24')],function(_0x274b98){return{'model':db[_0x274b98[_0x8ac8('0x26')]],'as':_0x274b98['as'],'attributes':_0x274b98['attributes'],'include':_0x274b98[_0x8ac8('0x24')]?_['map'](_0x274b98[_0x8ac8('0x24')],function(_0x33aec3){return{'model':db[_0x33aec3[_0x8ac8('0x26')]],'as':_0x33aec3['as'],'attributes':_0x33aec3[_0x8ac8('0x27')],'include':_0x33aec3[_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0x33aec3[_0x8ac8('0x24')],function(_0x15d995){return{'model':db[_0x15d995[_0x8ac8('0x26')]],'as':_0x15d995['as'],'attributes':_0x15d995['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ac8('0x12')](function(_0x304602){logger[_0x8ac8('0x13')](_0x8ac8('0x1e'),_0x5a23d3);logger[_0x8ac8('0x15')](_0x8ac8('0x1e'),_0x5a23d3,JSON[_0x8ac8('0x17')](_0x304602));_0x299ad7(_0x304602);})[_0x8ac8('0x1d')](function(_0x43934f){logger[_0x8ac8('0x18')](_0x8ac8('0x1e'),_0x43934f[_0x8ac8('0x1a')],_0x5a23d3);_0x419050(_0x1398d5[_0x8ac8('0x18')](0x1f4,_0x43934f[_0x8ac8('0x1a')]));});});};exports[_0x8ac8('0x28')]=function(_0xd916ff){var _0x183da8=this;return new Promise(function(_0x590756,_0x5bda84){return db[_0x8ac8('0x29')][_0x8ac8('0x2a')]({'raw':_0xd916ff[_0x8ac8('0x20')]?_0xd916ff[_0x8ac8('0x20')][_0x8ac8('0x21')]===undefined?!![]:![]:!![],'where':_0xd916ff['options']?_0xd916ff[_0x8ac8('0x20')]['where']||null:null,'attributes':_0xd916ff['options']?_0xd916ff[_0x8ac8('0x20')]['attributes']||null:null,'include':_0xd916ff['options']?_0xd916ff['options'][_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0xd916ff['options'][_0x8ac8('0x24')],function(_0x19c48e){return{'model':db[_0x19c48e[_0x8ac8('0x26')]],'as':_0x19c48e['as'],'attributes':_0x19c48e['attributes'],'include':_0x19c48e['include']?_['map'](_0x19c48e['include'],function(_0x36b75b){return{'model':db[_0x36b75b[_0x8ac8('0x26')]],'as':_0x36b75b['as'],'attributes':_0x36b75b[_0x8ac8('0x27')],'include':_0x36b75b[_0x8ac8('0x24')]?_[_0x8ac8('0x25')](_0x36b75b[_0x8ac8('0x24')],function(_0x20512b){return{'model':db[_0x20512b['model']],'as':_0x20512b['as'],'attributes':_0x20512b[_0x8ac8('0x27')]};}):[]};}):[]};}):[]:[]})[_0x8ac8('0x12')](function(_0x19883f){logger[_0x8ac8('0x13')](_0x8ac8('0x28'),_0xd916ff);logger[_0x8ac8('0x15')](_0x8ac8('0x28'),_0xd916ff,JSON['stringify'](_0x19883f));_0x590756(_0x19883f);})[_0x8ac8('0x1d')](function(_0x5e8db6){logger['error']('ShowWhatsappQueue',_0x5e8db6[_0x8ac8('0x1a')],_0xd916ff);_0x5bda84(_0x183da8[_0x8ac8('0x18')](0x1f4,_0x5e8db6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 98ec8ac..f0cd74b 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 _0x853b=['length','whatsappQueue:','./whatsappQueue.events','save','remove','emit'];(function(_0x2d1de3,_0x5da06c){var _0x4f86d4=function(_0x46ea68){while(--_0x46ea68){_0x2d1de3['push'](_0x2d1de3['shift']());}};_0x4f86d4(++_0x5da06c);}(_0x853b,0x1be));var _0xb853=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x853b[_0x2f5ac5];return _0x37c9a8;};'use strict';var WhatsappQueueEvents=require(_0xb853('0x0'));var events=[_0xb853('0x1'),_0xb853('0x2'),'update'];function createListener(_0x1d59d8,_0x403a7a){return function(_0x100719){_0x403a7a[_0xb853('0x3')](_0x1d59d8,_0x100719);};}function removeListener(_0x521453,_0x4552d6){return function(){WhatsappQueueEvents['removeListener'](_0x521453,_0x4552d6);};}exports['register']=function(_0x24c110){for(var _0x179e62=0x0,_0x5cee07=events[_0xb853('0x4')];_0x179e62<_0x5cee07;_0x179e62++){var _0x5040a8=events[_0x179e62];var _0x4d5e48=createListener(_0xb853('0x5')+_0x5040a8,_0x24c110);WhatsappQueueEvents['on'](_0x5040a8,_0x4d5e48);}}; \ No newline at end of file +var _0x17a8=['length','whatsappQueue:','remove','register'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x17a8,0x1ae));var _0x817a=function(_0x415ff8,_0x176fb5){_0x415ff8=_0x415ff8-0x0;var _0x1f347a=_0x17a8[_0x415ff8];return _0x1f347a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x817a('0x0'),'update'];function createListener(_0x9fceff,_0x26137e){return function(_0x560b39){_0x26137e['emit'](_0x9fceff,_0x560b39);};}function removeListener(_0x30ba80,_0x56c11e){return function(){WhatsappQueueEvents['removeListener'](_0x30ba80,_0x56c11e);};}exports[_0x817a('0x1')]=function(_0x5caae5){for(var _0x425417=0x0,_0x266927=events[_0x817a('0x2')];_0x425417<_0x266927;_0x425417++){var _0x30f8dc=events[_0x425417];var _0x551e85=createListener(_0x817a('0x3')+_0x30f8dc,_0x5caae5);WhatsappQueueEvents['on'](_0x30f8dc,_0x551e85);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8f0685f..b43bcfc 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 _0x5565=['isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0x5565,0x81));var _0x5556=function(_0x1eea9d,_0xbcf717){_0x1eea9d=_0x1eea9d-0x0;var _0x25a810=_0x5565[_0x1eea9d];return _0x25a810;};'use strict';var multer=require(_0x5556('0x0'));var util=require(_0x5556('0x1'));var path=require(_0x5556('0x2'));var timeout=require(_0x5556('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5556('0x4'));var auth=require(_0x5556('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x5556('0x6')]('/',auth[_0x5556('0x7')](),controller[_0x5556('0x8')]);router[_0x5556('0x6')](_0x5556('0x9'),auth[_0x5556('0x7')](),controller[_0x5556('0xa')]);router[_0x5556('0x6')](_0x5556('0xb'),auth[_0x5556('0x7')](),controller['show']);router[_0x5556('0xc')]('/',auth['isAuthenticated'](),controller[_0x5556('0xd')]);router[_0x5556('0xe')](_0x5556('0xb'),auth[_0x5556('0x7')](),controller['update']);router[_0x5556('0xf')](_0x5556('0xb'),auth[_0x5556('0x7')](),controller[_0x5556('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeb93=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create','put','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xeb93,0xfd));var _0x3eb9=function(_0x129fa8,_0x3dba2a){_0x129fa8=_0x129fa8-0x0;var _0x546bab=_0xeb93[_0x129fa8];return _0x546bab;};'use strict';var multer=require(_0x3eb9('0x0'));var util=require(_0x3eb9('0x1'));var path=require('path');var timeout=require(_0x3eb9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3eb9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3eb9('0x4'));var config=require(_0x3eb9('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x3eb9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x3eb9('0x7')](),controller[_0x3eb9('0x8')]);router['get']('/:id',auth[_0x3eb9('0x7')](),controller[_0x3eb9('0x9')]);router[_0x3eb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x3eb9('0xb')]);router[_0x3eb9('0xc')](_0x3eb9('0xd'),auth[_0x3eb9('0x7')](),controller['update']);router['delete'](_0x3eb9('0xd'),auth['isAuthenticated'](),controller[_0x3eb9('0xe')]);module[_0x3eb9('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 313e243..0dd671f 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(_0x548c60,_0x2bd948){var _0x3af077=function(_0x4789e3){while(--_0x4789e3){_0x548c60['push'](_0x548c60['shift']());}};_0x3af077(++_0x2bd948);}(_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(_0x5669f6,_0x2b4029){var _0x1cf487=function(_0x187a79){while(--_0x187a79){_0x5669f6['push'](_0x5669f6['shift']());}};_0x1cf487(++_0x2b4029);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 977b0b5..622e1a3 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 _0xfef3=['offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','then','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','zip-dir','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json'];(function(_0x47d7ec,_0x17f197){var _0x98674a=function(_0x4f7db3){while(--_0x4f7db3){_0x47d7ec['push'](_0x47d7ec['shift']());}};_0x98674a(++_0x17f197);}(_0xfef3,0x118));var _0x3fef=function(_0x33c147,_0xd24400){_0x33c147=_0x33c147-0x0;var _0x216d7d=_0xfef3[_0x33c147];return _0x216d7d;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){_0x50025f[_0x3fef('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45464b,_0x2c0848){return function(_0x64d3e6){if(!_0x64d3e6){_0x45464b[_0x3fef('0x19')](0x194);}return _0x64d3e6;};}function handleError(_0x30e17a,_0x492ea0){_0x492ea0=_0x492ea0||0x1f4;return function(_0x4b4dee){logger['error'](_0x4b4dee[_0x3fef('0x28')]);if(_0x4b4dee[_0x3fef('0x29')]){delete _0x4b4dee['name'];}_0x30e17a[_0x3fef('0x20')](_0x492ea0)[_0x3fef('0x2a')](_0x4b4dee);};}exports['index']=function(_0x30a954,_0x3bdf03){var _0xf892bb={},_0x2b73fb={},_0x3a1a0a={'count':0x0,'rows':[]};var _0x137849=_[_0x3fef('0x2b')](db['WhatsappQueueReport'][_0x3fef('0x2c')],function(_0xc20ce5){return{'name':_0xc20ce5[_0x3fef('0x2d')],'type':_0xc20ce5[_0x3fef('0x2e')]['key']};});_0x2b73fb[_0x3fef('0x2f')]=_['map'](_0x137849,_0x3fef('0x29'));_0x2b73fb[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x30a954[_0x3fef('0x30')]);_0x2b73fb[_0x3fef('0x32')]=_[_0x3fef('0x33')](_0x2b73fb[_0x3fef('0x2f')],_0x2b73fb[_0x3fef('0x30')]);_0xf892bb[_0x3fef('0x34')]=_[_0x3fef('0x33')](_0x2b73fb['model'],qs['fields'](_0x30a954[_0x3fef('0x30')]['fields']));_0xf892bb[_0x3fef('0x34')]=_0xf892bb[_0x3fef('0x34')][_0x3fef('0x35')]?_0xf892bb[_0x3fef('0x34')]:_0x2b73fb[_0x3fef('0x2f')];if(!_0x30a954[_0x3fef('0x30')][_0x3fef('0x36')](_0x3fef('0x37'))){_0xf892bb[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x1d')]);_0xf892bb[_0x3fef('0x1c')]=qs[_0x3fef('0x1c')](_0x30a954['query'][_0x3fef('0x1c')]);}_0xf892bb[_0x3fef('0x38')]=qs[_0x3fef('0x39')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x39')]);_0xf892bb[_0x3fef('0x3a')]=qs['filters'](_['pick'](_0x30a954[_0x3fef('0x30')],_0x2b73fb[_0x3fef('0x32')]),_0x137849);if(_0x30a954[_0x3fef('0x30')][_0x3fef('0x3b')]){_0xf892bb[_0x3fef('0x3a')]=_[_0x3fef('0x3c')](_0xf892bb[_0x3fef('0x3a')],{'$or':_[_0x3fef('0x2b')](_0x137849,function(_0x1fa70f){if(_0x1fa70f[_0x3fef('0x2e')]!==_0x3fef('0x3d')){var _0x560aae={};_0x560aae[_0x1fa70f[_0x3fef('0x29')]]={'$like':'%'+_0x30a954[_0x3fef('0x30')]['filter']+'%'};return _0x560aae;}})});}_0xf892bb=_['merge']({},_0xf892bb,_0x30a954[_0x3fef('0x3e')]);var _0x3dda68={'where':_0xf892bb[_0x3fef('0x3a')]};return db[_0x3fef('0x3f')][_0x3fef('0x1f')](_0x3dda68)[_0x3fef('0x40')](function(_0x17aff8){_0x3a1a0a[_0x3fef('0x1f')]=_0x17aff8;if(_0x30a954['query'][_0x3fef('0x41')]){_0xf892bb[_0x3fef('0x42')]=[{'all':!![]}];}return db[_0x3fef('0x3f')][_0x3fef('0x43')](_0xf892bb);})[_0x3fef('0x40')](function(_0x2143ec){_0x3a1a0a[_0x3fef('0x44')]=_0x2143ec;return _0x3a1a0a;})[_0x3fef('0x40')](respondWithFilteredResult(_0x3bdf03,_0xf892bb))[_0x3fef('0x45')](handleError(_0x3bdf03,null));};exports[_0x3fef('0x46')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x47')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x31')](db[_0x3fef('0x3f')][_0x3fef('0x2c')]);_0x15d2c7[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x12867c[_0x3fef('0x30')]);_0x15d2c7['filters']=_[_0x3fef('0x33')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x30')]);_0x2e1d7f[_0x3fef('0x34')]=_['intersection'](_0x15d2c7[_0x3fef('0x2f')],qs['fields'](_0x12867c[_0x3fef('0x30')][_0x3fef('0x48')]));_0x2e1d7f[_0x3fef('0x34')]=_0x2e1d7f[_0x3fef('0x34')][_0x3fef('0x35')]?_0x2e1d7f[_0x3fef('0x34')]:_0x15d2c7[_0x3fef('0x2f')];if(_0x12867c[_0x3fef('0x30')][_0x3fef('0x41')]){_0x2e1d7f[_0x3fef('0x42')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x3c')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x3e')]);return db[_0x3fef('0x3f')]['find'](_0x2e1d7f)[_0x3fef('0x40')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x40')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x49')]=function(_0x4210d6,_0x2f00c0){return db['WhatsappQueueReport'][_0x3fef('0x49')](_0x4210d6[_0x3fef('0x4a')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x45')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x4a')]['id'];}return db[_0x3fef('0x3f')]['find']({'where':{'id':_0x48322c[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x40')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x40')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x45')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x27')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x3f')][_0x3fef('0x4b')]({'where':{'id':_0x5b1acb[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x45')](handleError(_0x324f70,null));};exports[_0x3fef('0x4c')]=function(_0x39a4b1,_0x2b9275){return db[_0x3fef('0x3f')][_0x3fef('0x4c')]()[_0x3fef('0x40')](respondWithResult(_0x2b9275,null))[_0x3fef('0x45')](handleError(_0x2b9275,null));}; \ No newline at end of file +var _0xe511=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','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','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0xf3f40f,_0x5d529d){var _0x572507=function(_0x2352ac){while(--_0x2352ac){_0xf3f40f['push'](_0xf3f40f['shift']());}};_0x572507(++_0x5d529d);}(_0xe511,0x16f));var _0x1e51=function(_0x223649,_0x2de456){_0x223649=_0x223649-0x0;var _0x1f863a=_0xe511[_0x223649];return _0x1f863a;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 22e58bd..0f92f7e 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 _0x6642=['moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api'];(function(_0x5a865d,_0x3d97f7){var _0x4d806a=function(_0x6b223f){while(--_0x6b223f){_0x5a865d['push'](_0x5a865d['shift']());}};_0x4d806a(++_0x3d97f7);}(_0x6642,0x142));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2664('0x0'));var logger=require('../../config/logger')(_0x2664('0x1'));var moment=require(_0x2664('0x2'));var BPromise=require('bluebird');var rp=require(_0x2664('0x3'));var fs=require('fs');var path=require(_0x2664('0x4'));var rimraf=require(_0x2664('0x5'));var config=require(_0x2664('0x6'));var attributes=require(_0x2664('0x7'));module[_0x2664('0x8')]=function(_0x4c6193,_0x2efc63){return _0x4c6193['define'](_0x2664('0x9'),attributes,{'tableName':_0x2664('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2664('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f1c=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','moment','path','rimraf','../../config/environment'];(function(_0x4f7112,_0x4cb6bf){var _0x51d64c=function(_0x12c987){while(--_0x12c987){_0x4f7112['push'](_0x4f7112['shift']());}};_0x51d64c(++_0x4cb6bf);}(_0x0f1c,0x126));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc0f1('0x0'));var logger=require('../../config/logger')(_0xc0f1('0x1'));var moment=require(_0xc0f1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0f1('0x3'));var rimraf=require(_0xc0f1('0x4'));var config=require(_0xc0f1('0x5'));var attributes=require(_0xc0f1('0x6'));module[_0xc0f1('0x7')]=function(_0x228d01,_0x46cc27){return _0x228d01[_0xc0f1('0x8')](_0xc0f1('0x9'),attributes,{'tableName':_0xc0f1('0xa'),'paranoid':![],'indexes':[{'name':_0xc0f1('0xb'),'fields':[_0xc0f1('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 1b9489a..adbc5ec 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 _0x83d4=['util','randomstring','ioredis','../../mysqldb','jayson/promise','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','limit','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83d4,0x195));var _0x483d=function(_0x77894f,_0x23f038){_0x77894f=_0x77894f-0x0;var _0x3d8af2=_0x83d4[_0x77894f];return _0x3d8af2;};'use strict';var _=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x483d('0x2'));var fs=require('fs');var Redis=require(_0x483d('0x3'));var db=require(_0x483d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x483d('0x5'));var client=jayson['client'][_0x483d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58ec94,_0x2314ca,_0x5665cd){return new BPromise(function(_0x38a789,_0x4abd12){return client[_0x483d('0x7')](_0x58ec94,_0x5665cd)[_0x483d('0x8')](function(_0xea56cf){logger['info'](_0x483d('0x9'),_0x2314ca,_0x483d('0xa'));logger[_0x483d('0xb')](_0x483d('0xc'),_0x2314ca,_0x483d('0xa'),JSON[_0x483d('0xd')](_0xea56cf));if(_0xea56cf[_0x483d('0xe')]){if(_0xea56cf['error']['code']===0x1f4){logger['error'](_0x483d('0x9'),_0x2314ca,_0xea56cf['error'][_0x483d('0xf')]);return _0x4abd12(_0xea56cf['error'][_0x483d('0xf')]);}logger[_0x483d('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2314ca,_0xea56cf['error'][_0x483d('0xf')]);return _0x38a789(_0xea56cf[_0x483d('0xe')][_0x483d('0xf')]);}else{logger[_0x483d('0x10')](_0x483d('0x9'),_0x2314ca,_0x483d('0xa'));_0x38a789(_0xea56cf[_0x483d('0x11')][_0x483d('0xf')]);}})[_0x483d('0x12')](function(_0x412830){logger[_0x483d('0xe')](_0x483d('0x9'),_0x2314ca,_0x412830);_0x4abd12(_0x412830);});});}exports[_0x483d('0x13')]=function(_0x8f8e41){var _0x4fc195=this;return new Promise(function(_0x36c822,_0x2c7f6d){return db['WhatsappQueueReport'][_0x483d('0x14')](_0x8f8e41[_0x483d('0x15')],{'raw':_0x8f8e41[_0x483d('0x16')]?_0x8f8e41[_0x483d('0x16')][_0x483d('0x17')]===undefined?!![]:![]:!![]})[_0x483d('0x8')](function(_0x4e8a89){logger[_0x483d('0x10')](_0x483d('0x13'),_0x8f8e41);logger[_0x483d('0xb')](_0x483d('0x13'),_0x8f8e41,JSON[_0x483d('0xd')](_0x4e8a89));_0x36c822(_0x4e8a89);})[_0x483d('0x12')](function(_0x135206){logger[_0x483d('0xe')](_0x483d('0x13'),_0x135206['message'],_0x8f8e41);_0x2c7f6d(_0x4fc195[_0x483d('0xe')](0x1f4,_0x135206['message']));});});};exports[_0x483d('0x18')]=function(_0x579181){var _0x4cec6d=this;return new Promise(function(_0x359586,_0x236c7c){return db[_0x483d('0x19')][_0x483d('0x1a')](_0x579181[_0x483d('0x15')],{'raw':_0x579181['options']?_0x579181[_0x483d('0x16')][_0x483d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579181['options']?_0x579181[_0x483d('0x16')][_0x483d('0x1b')]||null:null,'attributes':_0x579181[_0x483d('0x16')]?_0x579181[_0x483d('0x16')]['attributes']||null:null,'limit':_0x579181['options']?_0x579181[_0x483d('0x16')][_0x483d('0x1c')]||null:null})[_0x483d('0x8')](function(_0x25cac6){logger[_0x483d('0x10')]('UpdateWhatsappQueueReport',_0x579181);logger[_0x483d('0xb')](_0x483d('0x18'),_0x579181,JSON['stringify'](_0x25cac6));_0x359586(_0x25cac6);})[_0x483d('0x12')](function(_0xdaaedc){logger[_0x483d('0xe')](_0x483d('0x18'),_0xdaaedc[_0x483d('0xf')],_0x579181);_0x236c7c(_0x4cec6d[_0x483d('0xe')](0x1f4,_0xdaaedc['message']));});});}; \ No newline at end of file +var _0xe532=['CreateWhatsappQueueReport','debug','stringify','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappQueueReport','create','body','options'];(function(_0x5ef783,_0x2acf4f){var _0x4ab7ec=function(_0x2faf95){while(--_0x2faf95){_0x5ef783['push'](_0x5ef783['shift']());}};_0x4ab7ec(++_0x2acf4f);}(_0xe532,0x1ce));var _0x2e53=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xe532[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x2e53('0x0'));var util=require(_0x2e53('0x1'));var moment=require(_0x2e53('0x2'));var BPromise=require(_0x2e53('0x3'));var rs=require(_0x2e53('0x4'));var fs=require('fs');var Redis=require(_0x2e53('0x5'));var db=require(_0x2e53('0x6'))['db'];var utils=require(_0x2e53('0x7'));var logger=require(_0x2e53('0x8'))(_0x2e53('0x9'));var config=require(_0x2e53('0xa'));var jayson=require(_0x2e53('0xb'));var client=jayson[_0x2e53('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1cc9,_0x4cbdfe,_0x4d67af){return new BPromise(function(_0x3a662a,_0x4ddae9){return client[_0x2e53('0xd')](_0x3f1cc9,_0x4d67af)[_0x2e53('0xe')](function(_0x3bec6a){logger[_0x2e53('0xf')](_0x2e53('0x10'),_0x4cbdfe,_0x2e53('0x11'));logger['debug'](_0x2e53('0x12'),_0x4cbdfe,_0x2e53('0x11'),JSON['stringify'](_0x3bec6a));if(_0x3bec6a['error']){if(_0x3bec6a['error'][_0x2e53('0x13')]===0x1f4){logger[_0x2e53('0x14')](_0x2e53('0x10'),_0x4cbdfe,_0x3bec6a[_0x2e53('0x14')][_0x2e53('0x15')]);return _0x4ddae9(_0x3bec6a[_0x2e53('0x14')][_0x2e53('0x15')]);}logger[_0x2e53('0x14')](_0x2e53('0x10'),_0x4cbdfe,_0x3bec6a[_0x2e53('0x14')][_0x2e53('0x15')]);return _0x3a662a(_0x3bec6a['error'][_0x2e53('0x15')]);}else{logger['info'](_0x2e53('0x10'),_0x4cbdfe,_0x2e53('0x11'));_0x3a662a(_0x3bec6a[_0x2e53('0x16')]['message']);}})[_0x2e53('0x17')](function(_0x4f94a7){logger[_0x2e53('0x14')](_0x2e53('0x10'),_0x4cbdfe,_0x4f94a7);_0x4ddae9(_0x4f94a7);});});}exports['CreateWhatsappQueueReport']=function(_0x58247c){var _0x45aa0c=this;return new Promise(function(_0x228f34,_0x537e8e){return db[_0x2e53('0x18')][_0x2e53('0x19')](_0x58247c[_0x2e53('0x1a')],{'raw':_0x58247c[_0x2e53('0x1b')]?_0x58247c['options']['raw']===undefined?!![]:![]:!![]})[_0x2e53('0xe')](function(_0x316966){logger[_0x2e53('0xf')](_0x2e53('0x1c'),_0x58247c);logger[_0x2e53('0x1d')](_0x2e53('0x1c'),_0x58247c,JSON[_0x2e53('0x1e')](_0x316966));_0x228f34(_0x316966);})['catch'](function(_0xde73d9){logger['error']('CreateWhatsappQueueReport',_0xde73d9['message'],_0x58247c);_0x537e8e(_0x45aa0c[_0x2e53('0x14')](0x1f4,_0xde73d9[_0x2e53('0x15')]));});});};exports[_0x2e53('0x1f')]=function(_0x33c282){var _0x190e94=this;return new Promise(function(_0x53d2b0,_0x4279d9){return db[_0x2e53('0x18')]['update'](_0x33c282[_0x2e53('0x1a')],{'raw':_0x33c282[_0x2e53('0x1b')]?_0x33c282[_0x2e53('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c282['options']?_0x33c282[_0x2e53('0x1b')][_0x2e53('0x20')]||null:null,'attributes':_0x33c282[_0x2e53('0x1b')]?_0x33c282[_0x2e53('0x1b')][_0x2e53('0x21')]||null:null,'limit':_0x33c282[_0x2e53('0x1b')]?_0x33c282[_0x2e53('0x1b')][_0x2e53('0x22')]||null:null})[_0x2e53('0xe')](function(_0xa12545){logger['info'](_0x2e53('0x1f'),_0x33c282);logger[_0x2e53('0x1d')](_0x2e53('0x1f'),_0x33c282,JSON[_0x2e53('0x1e')](_0xa12545));_0x53d2b0(_0xa12545);})[_0x2e53('0x17')](function(_0x5abdc7){logger['error'](_0x2e53('0x1f'),_0x5abdc7[_0x2e53('0x15')],_0x33c282);_0x4279d9(_0x190e94[_0x2e53('0x14')](0x1f4,_0x5abdc7[_0x2e53('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ae8cd02..89b2b60 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 _0x45b5=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x1ab504,_0x25ca51){var _0x50159e=function(_0x339c13){while(--_0x339c13){_0x1ab504['push'](_0x1ab504['shift']());}};_0x50159e(++_0x25ca51);}(_0x45b5,0xdb));var _0x545b=function(_0x4f1cd4,_0x302a8c){_0x4f1cd4=_0x4f1cd4-0x0;var _0x4b4e1b=_0x45b5[_0x4f1cd4];return _0x4b4e1b;};'use strict';var multer=require('multer');var util=require(_0x545b('0x0'));var path=require(_0x545b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x545b('0x2')]();var fs_extra=require(_0x545b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x545b('0x4'));var config=require(_0x545b('0x5'));var controller=require(_0x545b('0x6'));router[_0x545b('0x7')]('/',auth[_0x545b('0x8')](),controller[_0x545b('0x9')]);router[_0x545b('0x7')](_0x545b('0xa'),auth[_0x545b('0x8')](),controller[_0x545b('0xb')]);router[_0x545b('0x7')](_0x545b('0xc'),auth['isAuthenticated'](),controller[_0x545b('0xd')]);router['post']('/',auth[_0x545b('0x8')](),controller[_0x545b('0xe')]);router[_0x545b('0xf')](_0x545b('0xc'),auth[_0x545b('0x8')](),controller[_0x545b('0x10')]);router[_0x545b('0x11')]('/:id',auth[_0x545b('0x8')](),controller[_0x545b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8ab2=['update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x8ab2,0x1cc));var _0x28ab=function(_0x2462a8,_0x2baf04){_0x2462a8=_0x2462a8-0x0;var _0x25aaee=_0x8ab2[_0x2462a8];return _0x25aaee;};'use strict';var multer=require('multer');var util=require(_0x28ab('0x0'));var path=require(_0x28ab('0x1'));var timeout=require('connect-timeout');var express=require(_0x28ab('0x2'));var router=express['Router']();var fs_extra=require(_0x28ab('0x3'));var auth=require(_0x28ab('0x4'));var interaction=require(_0x28ab('0x5'));var config=require(_0x28ab('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x28ab('0x7')]('/',auth[_0x28ab('0x8')](),controller['index']);router[_0x28ab('0x7')](_0x28ab('0x9'),auth[_0x28ab('0x8')](),controller['describe']);router['get'](_0x28ab('0xa'),auth[_0x28ab('0x8')](),controller[_0x28ab('0xb')]);router[_0x28ab('0xc')]('/',auth['isAuthenticated'](),controller[_0x28ab('0xd')]);router[_0x28ab('0xe')](_0x28ab('0xa'),auth[_0x28ab('0x8')](),controller[_0x28ab('0xf')]);router[_0x28ab('0x10')](_0x28ab('0xa'),auth['isAuthenticated'](),controller[_0x28ab('0x11')]);module[_0x28ab('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 737d62a..99df854 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 _0x6f3e=['STRING','ENUM','account','agent','queue','sequelize','exports'];(function(_0x255e05,_0x323b20){var _0x18d702=function(_0x33e85f){while(--_0x33e85f){_0x255e05['push'](_0x255e05['shift']());}};_0x18d702(++_0x323b20);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xe6f3('0x0'));module[_0xe6f3('0x1')]={'uniqueid':{'type':Sequelize[_0xe6f3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe6f3('0x3')](_0xe6f3('0x4'),_0xe6f3('0x5'),_0xe6f3('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x97b2=['STRING','ENUM','account','agent','DATE','sequelize','exports'];(function(_0x2db253,_0x21659d){var _0x4f4ea2=function(_0x4c1883){while(--_0x4c1883){_0x2db253['push'](_0x2db253['shift']());}};_0x4f4ea2(++_0x21659d);}(_0x97b2,0x1b7));var _0x297b=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x97b2[_0x400322];return _0xfdd597;};'use strict';var Sequelize=require(_0x297b('0x0'));module[_0x297b('0x1')]={'uniqueid':{'type':Sequelize[_0x297b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x297b('0x3')](_0x297b('0x4'),_0x297b('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x297b('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7e363ce..a12cc60 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 _0xc2f7=['../../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','error','stack','name','send','index','map','WhatsappTransferReport','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','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','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2efc6e,_0xb20dd7){var _0x49a909=function(_0x4d028a){while(--_0x4d028a){_0x2efc6e['push'](_0x2efc6e['shift']());}};_0x49a909(++_0xb20dd7);}(_0xc2f7,0x1d5));var _0x7c2f=function(_0x17b0e9,_0x58d1a2){_0x17b0e9=_0x17b0e9-0x0;var _0x37ae00=_0xc2f7[_0x17b0e9];return _0x37ae00;};'use strict';var emlformat=require(_0x7c2f('0x0'));var rimraf=require(_0x7c2f('0x1'));var zipdir=require(_0x7c2f('0x2'));var jsonpatch=require(_0x7c2f('0x3'));var rp=require(_0x7c2f('0x4'));var moment=require(_0x7c2f('0x5'));var BPromise=require(_0x7c2f('0x6'));var Mustache=require(_0x7c2f('0x7'));var util=require(_0x7c2f('0x8'));var path=require(_0x7c2f('0x9'));var sox=require(_0x7c2f('0xa'));var csv=require(_0x7c2f('0xb'));var ejs=require(_0x7c2f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c2f('0xd'));var squel=require(_0x7c2f('0xe'));var crypto=require(_0x7c2f('0xf'));var jsforce=require(_0x7c2f('0x10'));var deskjs=require(_0x7c2f('0x11'));var toCsv=require(_0x7c2f('0xb'));var querystring=require(_0x7c2f('0x12'));var Papa=require(_0x7c2f('0x13'));var Redis=require(_0x7c2f('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x7c2f('0x15'));var as=require(_0x7c2f('0x16'));var hardwareService=require(_0x7c2f('0x17'));var logger=require(_0x7c2f('0x18'))(_0x7c2f('0x19'));var utils=require('../../config/utils');var config=require(_0x7c2f('0x1a'));var licenseUtil=require(_0x7c2f('0x1b'));var db=require(_0x7c2f('0x1c'))['db'];function respondWithStatusCode(_0x560e1a,_0x40d31a){_0x40d31a=_0x40d31a||0xcc;return function(_0x3d5010){if(_0x3d5010){return _0x560e1a[_0x7c2f('0x1d')](_0x40d31a);}return _0x560e1a[_0x7c2f('0x1e')](_0x40d31a)[_0x7c2f('0x1f')]();};}function respondWithResult(_0x57b714,_0x963a9f){_0x963a9f=_0x963a9f||0xc8;return function(_0x2bd9ff){if(_0x2bd9ff){return _0x57b714[_0x7c2f('0x1e')](_0x963a9f)[_0x7c2f('0x20')](_0x2bd9ff);}};}function respondWithFilteredResult(_0x501010,_0x1693df){return function(_0x2bb407){if(_0x2bb407){var _0x2fad6b=typeof _0x1693df[_0x7c2f('0x21')]===_0x7c2f('0x22')&&typeof _0x1693df[_0x7c2f('0x23')]==='undefined';var _0x30898d=_0x2bb407[_0x7c2f('0x24')];var _0x20f3f0=_0x2fad6b?0x0:_0x1693df[_0x7c2f('0x21')];var _0x1f9388=_0x2fad6b?_0x2bb407[_0x7c2f('0x24')]:_0x1693df['offset']+_0x1693df[_0x7c2f('0x23')];var _0x37a2cf;if(_0x1f9388>=_0x30898d){_0x1f9388=_0x30898d;_0x37a2cf=0xc8;}else{_0x37a2cf=0xce;}_0x501010['status'](_0x37a2cf);return _0x501010[_0x7c2f('0x25')](_0x7c2f('0x26'),_0x20f3f0+'-'+_0x1f9388+'/'+_0x30898d)[_0x7c2f('0x20')](_0x2bb407);}return null;};}function patchUpdates(_0x868bb8){return function(_0x3c0936){try{jsonpatch[_0x7c2f('0x27')](_0x3c0936,_0x868bb8,!![]);}catch(_0x4c2eb2){return BPromise[_0x7c2f('0x28')](_0x4c2eb2);}return _0x3c0936[_0x7c2f('0x29')]();};}function saveUpdates(_0x4fc076,_0x5cc955){return function(_0x2ff788){if(_0x2ff788){return _0x2ff788[_0x7c2f('0x2a')](_0x4fc076)[_0x7c2f('0x2b')](function(_0x1ff265){return _0x1ff265;});}return null;};}function removeEntity(_0xf89060,_0x368f72){return function(_0x308646){if(_0x308646){return _0x308646['destroy']()[_0x7c2f('0x2b')](function(){_0xf89060['status'](0xcc)[_0x7c2f('0x1f')]();});}};}function handleEntityNotFound(_0x2d437b,_0x5c8e2a){return function(_0x4aa8bd){if(!_0x4aa8bd){_0x2d437b[_0x7c2f('0x1d')](0x194);}return _0x4aa8bd;};}function handleError(_0x491e25,_0x7aab35){_0x7aab35=_0x7aab35||0x1f4;return function(_0x5f261d){logger[_0x7c2f('0x2c')](_0x5f261d[_0x7c2f('0x2d')]);if(_0x5f261d[_0x7c2f('0x2e')]){delete _0x5f261d[_0x7c2f('0x2e')];}_0x491e25[_0x7c2f('0x1e')](_0x7aab35)[_0x7c2f('0x2f')](_0x5f261d);};}exports[_0x7c2f('0x30')]=function(_0x58442e,_0x5950e1){var _0x16a9ad={},_0x3b8c33={},_0x52a8b0={'count':0x0,'rows':[]};var _0x2763fa=_[_0x7c2f('0x31')](db[_0x7c2f('0x32')]['rawAttributes'],function(_0x25da9c){return{'name':_0x25da9c['fieldName'],'type':_0x25da9c[_0x7c2f('0x33')][_0x7c2f('0x34')]};});_0x3b8c33[_0x7c2f('0x35')]=_[_0x7c2f('0x31')](_0x2763fa,_0x7c2f('0x2e'));_0x3b8c33['query']=_[_0x7c2f('0x36')](_0x58442e['query']);_0x3b8c33[_0x7c2f('0x37')]=_['intersection'](_0x3b8c33[_0x7c2f('0x35')],_0x3b8c33[_0x7c2f('0x38')]);_0x16a9ad['attributes']=_[_0x7c2f('0x39')](_0x3b8c33[_0x7c2f('0x35')],qs['fields'](_0x58442e[_0x7c2f('0x38')][_0x7c2f('0x3a')]));_0x16a9ad[_0x7c2f('0x3b')]=_0x16a9ad[_0x7c2f('0x3b')][_0x7c2f('0x3c')]?_0x16a9ad[_0x7c2f('0x3b')]:_0x3b8c33[_0x7c2f('0x35')];if(!_0x58442e[_0x7c2f('0x38')][_0x7c2f('0x3d')](_0x7c2f('0x3e'))){_0x16a9ad['limit']=qs['limit'](_0x58442e[_0x7c2f('0x38')]['limit']);_0x16a9ad[_0x7c2f('0x21')]=qs[_0x7c2f('0x21')](_0x58442e['query'][_0x7c2f('0x21')]);}_0x16a9ad['order']=qs[_0x7c2f('0x3f')](_0x58442e[_0x7c2f('0x38')][_0x7c2f('0x3f')]);_0x16a9ad[_0x7c2f('0x40')]=qs[_0x7c2f('0x37')](_[_0x7c2f('0x41')](_0x58442e[_0x7c2f('0x38')],_0x3b8c33['filters']),_0x2763fa);if(_0x58442e[_0x7c2f('0x38')][_0x7c2f('0x42')]){_0x16a9ad['where']=_[_0x7c2f('0x43')](_0x16a9ad[_0x7c2f('0x40')],{'$or':_['map'](_0x2763fa,function(_0x54935c){if(_0x54935c['type']!==_0x7c2f('0x44')){var _0xfb4fb5={};_0xfb4fb5[_0x54935c[_0x7c2f('0x2e')]]={'$like':'%'+_0x58442e['query'][_0x7c2f('0x42')]+'%'};return _0xfb4fb5;}})});}_0x16a9ad=_[_0x7c2f('0x43')]({},_0x16a9ad,_0x58442e['options']);var _0x3be307={'where':_0x16a9ad[_0x7c2f('0x40')]};return db['WhatsappTransferReport']['count'](_0x3be307)[_0x7c2f('0x2b')](function(_0x54ec95){_0x52a8b0[_0x7c2f('0x24')]=_0x54ec95;if(_0x58442e[_0x7c2f('0x38')][_0x7c2f('0x45')]){_0x16a9ad['include']=[{'all':!![]}];}return db[_0x7c2f('0x32')][_0x7c2f('0x46')](_0x16a9ad);})[_0x7c2f('0x2b')](function(_0x362b1e){_0x52a8b0[_0x7c2f('0x47')]=_0x362b1e;return _0x52a8b0;})[_0x7c2f('0x2b')](respondWithFilteredResult(_0x5950e1,_0x16a9ad))[_0x7c2f('0x48')](handleError(_0x5950e1,null));};exports[_0x7c2f('0x49')]=function(_0x37adba,_0x1e4621){var _0x10d58a={'raw':!![],'where':{'id':_0x37adba[_0x7c2f('0x4a')]['id']}},_0x573fc7={};_0x573fc7['model']=_['keys'](db[_0x7c2f('0x32')][_0x7c2f('0x4b')]);_0x573fc7['query']=_[_0x7c2f('0x36')](_0x37adba['query']);_0x573fc7[_0x7c2f('0x37')]=_['intersection'](_0x573fc7[_0x7c2f('0x35')],_0x573fc7[_0x7c2f('0x38')]);_0x10d58a[_0x7c2f('0x3b')]=_['intersection'](_0x573fc7[_0x7c2f('0x35')],qs[_0x7c2f('0x3a')](_0x37adba['query'][_0x7c2f('0x3a')]));_0x10d58a[_0x7c2f('0x3b')]=_0x10d58a[_0x7c2f('0x3b')][_0x7c2f('0x3c')]?_0x10d58a[_0x7c2f('0x3b')]:_0x573fc7[_0x7c2f('0x35')];if(_0x37adba[_0x7c2f('0x38')][_0x7c2f('0x45')]){_0x10d58a['include']=[{'all':!![]}];}_0x10d58a=_['merge']({},_0x10d58a,_0x37adba[_0x7c2f('0x4c')]);return db[_0x7c2f('0x32')][_0x7c2f('0x4d')](_0x10d58a)[_0x7c2f('0x2b')](handleEntityNotFound(_0x1e4621,null))[_0x7c2f('0x2b')](respondWithResult(_0x1e4621,null))[_0x7c2f('0x48')](handleError(_0x1e4621,null));};exports[_0x7c2f('0x4e')]=function(_0x3f2719,_0x53a3b3){return db[_0x7c2f('0x32')][_0x7c2f('0x4e')](_0x3f2719[_0x7c2f('0x4f')],{})[_0x7c2f('0x2b')](respondWithResult(_0x53a3b3,0xc9))[_0x7c2f('0x48')](handleError(_0x53a3b3,null));};exports[_0x7c2f('0x2a')]=function(_0x42d01a,_0x1efa2b){if(_0x42d01a[_0x7c2f('0x4f')]['id']){delete _0x42d01a['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x42d01a[_0x7c2f('0x4a')]['id']}})[_0x7c2f('0x2b')](handleEntityNotFound(_0x1efa2b,null))[_0x7c2f('0x2b')](saveUpdates(_0x42d01a[_0x7c2f('0x4f')],null))[_0x7c2f('0x2b')](respondWithResult(_0x1efa2b,null))[_0x7c2f('0x48')](handleError(_0x1efa2b,null));};exports[_0x7c2f('0x50')]=function(_0xfcc1ef,_0x2185f3){return db[_0x7c2f('0x32')][_0x7c2f('0x4d')]({'where':{'id':_0xfcc1ef[_0x7c2f('0x4a')]['id']}})[_0x7c2f('0x2b')](handleEntityNotFound(_0x2185f3,null))['then'](removeEntity(_0x2185f3,null))[_0x7c2f('0x48')](handleError(_0x2185f3,null));};exports[_0x7c2f('0x51')]=function(_0x1fcb94,_0x3c6d46){return db[_0x7c2f('0x32')][_0x7c2f('0x51')]()[_0x7c2f('0x2b')](respondWithResult(_0x3c6d46,null))['catch'](handleError(_0x3c6d46,null));}; \ No newline at end of file +var _0xcdec=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../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','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x62b49b,_0x2550cd){var _0x299d2a=function(_0x2d4af9){while(--_0x2d4af9){_0x62b49b['push'](_0x62b49b['shift']());}};_0x299d2a(++_0x2550cd);}(_0xcdec,0x173));var _0xccde=function(_0x56ff88,_0x259321){_0x56ff88=_0x56ff88-0x0;var _0x5e2666=_0xcdec[_0x56ff88];return _0x5e2666;};'use strict';var emlformat=require(_0xccde('0x0'));var rimraf=require(_0xccde('0x1'));var zipdir=require(_0xccde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccde('0x3'));var moment=require('moment');var BPromise=require(_0xccde('0x4'));var Mustache=require(_0xccde('0x5'));var util=require(_0xccde('0x6'));var path=require('path');var sox=require(_0xccde('0x7'));var csv=require(_0xccde('0x8'));var ejs=require(_0xccde('0x9'));var fs=require('fs');var fs_extra=require(_0xccde('0xa'));var _=require(_0xccde('0xb'));var squel=require(_0xccde('0xc'));var crypto=require(_0xccde('0xd'));var jsforce=require(_0xccde('0xe'));var deskjs=require(_0xccde('0xf'));var toCsv=require('to-csv');var querystring=require(_0xccde('0x10'));var Papa=require('papaparse');var Redis=require(_0xccde('0x11'));var authService=require(_0xccde('0x12'));var qs=require(_0xccde('0x13'));var as=require(_0xccde('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xccde('0x15'));var utils=require('../../config/utils');var config=require(_0xccde('0x16'));var licenseUtil=require(_0xccde('0x17'));var db=require(_0xccde('0x18'))['db'];function respondWithStatusCode(_0x1d9959,_0x1bb262){_0x1bb262=_0x1bb262||0xcc;return function(_0x3c6e62){if(_0x3c6e62){return _0x1d9959[_0xccde('0x19')](_0x1bb262);}return _0x1d9959[_0xccde('0x1a')](_0x1bb262)['end']();};}function respondWithResult(_0x25e505,_0x207dd7){_0x207dd7=_0x207dd7||0xc8;return function(_0x3cd741){if(_0x3cd741){return _0x25e505[_0xccde('0x1a')](_0x207dd7)[_0xccde('0x1b')](_0x3cd741);}};}function respondWithFilteredResult(_0x444019,_0x355516){return function(_0x448d11){if(_0x448d11){var _0x300f72=typeof _0x355516[_0xccde('0x1c')]===_0xccde('0x1d')&&typeof _0x355516[_0xccde('0x1e')]===_0xccde('0x1d');var _0x2a5e56=_0x448d11[_0xccde('0x1f')];var _0x4b4891=_0x300f72?0x0:_0x355516[_0xccde('0x1c')];var _0x1ea28d=_0x300f72?_0x448d11[_0xccde('0x1f')]:_0x355516[_0xccde('0x1c')]+_0x355516[_0xccde('0x1e')];var _0x93282e;if(_0x1ea28d>=_0x2a5e56){_0x1ea28d=_0x2a5e56;_0x93282e=0xc8;}else{_0x93282e=0xce;}_0x444019[_0xccde('0x1a')](_0x93282e);return _0x444019[_0xccde('0x20')](_0xccde('0x21'),_0x4b4891+'-'+_0x1ea28d+'/'+_0x2a5e56)[_0xccde('0x1b')](_0x448d11);}return null;};}function patchUpdates(_0x24c1ed){return function(_0x233b49){try{jsonpatch[_0xccde('0x22')](_0x233b49,_0x24c1ed,!![]);}catch(_0x461be9){return BPromise[_0xccde('0x23')](_0x461be9);}return _0x233b49[_0xccde('0x24')]();};}function saveUpdates(_0x19fc9a,_0x5629e0){return function(_0x47003f){if(_0x47003f){return _0x47003f[_0xccde('0x25')](_0x19fc9a)[_0xccde('0x26')](function(_0x1dd4a9){return _0x1dd4a9;});}return null;};}function removeEntity(_0x3e2f7a,_0x1dcc19){return function(_0x236c96){if(_0x236c96){return _0x236c96[_0xccde('0x27')]()['then'](function(){_0x3e2f7a[_0xccde('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a91d,_0xe279){return function(_0x1a1da4){if(!_0x1a1da4){_0x55a91d[_0xccde('0x19')](0x194);}return _0x1a1da4;};}function handleError(_0x3b2cff,_0x57839d){_0x57839d=_0x57839d||0x1f4;return function(_0x8a3573){logger[_0xccde('0x28')](_0x8a3573[_0xccde('0x29')]);if(_0x8a3573[_0xccde('0x2a')]){delete _0x8a3573['name'];}_0x3b2cff[_0xccde('0x1a')](_0x57839d)[_0xccde('0x2b')](_0x8a3573);};}exports[_0xccde('0x2c')]=function(_0x1c2ab4,_0x1b05fd){var _0x23a22e={},_0x6443bf={},_0xd6a0ba={'count':0x0,'rows':[]};var _0x5db999=_[_0xccde('0x2d')](db[_0xccde('0x2e')][_0xccde('0x2f')],function(_0x431d4f){return{'name':_0x431d4f[_0xccde('0x30')],'type':_0x431d4f['type']['key']};});_0x6443bf[_0xccde('0x31')]=_[_0xccde('0x2d')](_0x5db999,_0xccde('0x2a'));_0x6443bf[_0xccde('0x32')]=_[_0xccde('0x33')](_0x1c2ab4[_0xccde('0x32')]);_0x6443bf['filters']=_[_0xccde('0x34')](_0x6443bf[_0xccde('0x31')],_0x6443bf['query']);_0x23a22e[_0xccde('0x35')]=_['intersection'](_0x6443bf[_0xccde('0x31')],qs[_0xccde('0x36')](_0x1c2ab4[_0xccde('0x32')][_0xccde('0x36')]));_0x23a22e[_0xccde('0x35')]=_0x23a22e[_0xccde('0x35')]['length']?_0x23a22e[_0xccde('0x35')]:_0x6443bf[_0xccde('0x31')];if(!_0x1c2ab4[_0xccde('0x32')][_0xccde('0x37')](_0xccde('0x38'))){_0x23a22e[_0xccde('0x1e')]=qs[_0xccde('0x1e')](_0x1c2ab4[_0xccde('0x32')][_0xccde('0x1e')]);_0x23a22e[_0xccde('0x1c')]=qs[_0xccde('0x1c')](_0x1c2ab4['query'][_0xccde('0x1c')]);}_0x23a22e[_0xccde('0x39')]=qs['sort'](_0x1c2ab4[_0xccde('0x32')][_0xccde('0x3a')]);_0x23a22e[_0xccde('0x3b')]=qs[_0xccde('0x3c')](_[_0xccde('0x3d')](_0x1c2ab4['query'],_0x6443bf[_0xccde('0x3c')]),_0x5db999);if(_0x1c2ab4['query']['filter']){_0x23a22e[_0xccde('0x3b')]=_['merge'](_0x23a22e[_0xccde('0x3b')],{'$or':_['map'](_0x5db999,function(_0xb73057){if(_0xb73057[_0xccde('0x3e')]!==_0xccde('0x3f')){var _0x2f12b8={};_0x2f12b8[_0xb73057['name']]={'$like':'%'+_0x1c2ab4[_0xccde('0x32')]['filter']+'%'};return _0x2f12b8;}})});}_0x23a22e=_['merge']({},_0x23a22e,_0x1c2ab4['options']);var _0x3100ff={'where':_0x23a22e[_0xccde('0x3b')]};return db[_0xccde('0x2e')][_0xccde('0x1f')](_0x3100ff)['then'](function(_0x1a29cb){_0xd6a0ba[_0xccde('0x1f')]=_0x1a29cb;if(_0x1c2ab4[_0xccde('0x32')][_0xccde('0x40')]){_0x23a22e[_0xccde('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xccde('0x42')](_0x23a22e);})[_0xccde('0x26')](function(_0x36a514){_0xd6a0ba[_0xccde('0x43')]=_0x36a514;return _0xd6a0ba;})[_0xccde('0x26')](respondWithFilteredResult(_0x1b05fd,_0x23a22e))[_0xccde('0x44')](handleError(_0x1b05fd,null));};exports[_0xccde('0x45')]=function(_0x4c9391,_0x172d4b){var _0x521914={'raw':!![],'where':{'id':_0x4c9391[_0xccde('0x46')]['id']}},_0x532c96={};_0x532c96[_0xccde('0x31')]=_['keys'](db[_0xccde('0x2e')][_0xccde('0x2f')]);_0x532c96[_0xccde('0x32')]=_[_0xccde('0x33')](_0x4c9391[_0xccde('0x32')]);_0x532c96[_0xccde('0x3c')]=_[_0xccde('0x34')](_0x532c96['model'],_0x532c96[_0xccde('0x32')]);_0x521914['attributes']=_['intersection'](_0x532c96['model'],qs[_0xccde('0x36')](_0x4c9391[_0xccde('0x32')][_0xccde('0x36')]));_0x521914[_0xccde('0x35')]=_0x521914[_0xccde('0x35')][_0xccde('0x47')]?_0x521914[_0xccde('0x35')]:_0x532c96[_0xccde('0x31')];if(_0x4c9391[_0xccde('0x32')][_0xccde('0x40')]){_0x521914[_0xccde('0x41')]=[{'all':!![]}];}_0x521914=_[_0xccde('0x48')]({},_0x521914,_0x4c9391[_0xccde('0x49')]);return db[_0xccde('0x2e')][_0xccde('0x4a')](_0x521914)['then'](handleEntityNotFound(_0x172d4b,null))[_0xccde('0x26')](respondWithResult(_0x172d4b,null))[_0xccde('0x44')](handleError(_0x172d4b,null));};exports['create']=function(_0x1f6c42,_0x4265dc){return db[_0xccde('0x2e')][_0xccde('0x4b')](_0x1f6c42[_0xccde('0x4c')],{})['then'](respondWithResult(_0x4265dc,0xc9))[_0xccde('0x44')](handleError(_0x4265dc,null));};exports[_0xccde('0x25')]=function(_0x92bb28,_0x3c5602){if(_0x92bb28[_0xccde('0x4c')]['id']){delete _0x92bb28[_0xccde('0x4c')]['id'];}return db[_0xccde('0x2e')]['find']({'where':{'id':_0x92bb28[_0xccde('0x46')]['id']}})[_0xccde('0x26')](handleEntityNotFound(_0x3c5602,null))[_0xccde('0x26')](saveUpdates(_0x92bb28[_0xccde('0x4c')],null))[_0xccde('0x26')](respondWithResult(_0x3c5602,null))[_0xccde('0x44')](handleError(_0x3c5602,null));};exports[_0xccde('0x27')]=function(_0x3bc757,_0x1d5daf){return db['WhatsappTransferReport'][_0xccde('0x4a')]({'where':{'id':_0x3bc757[_0xccde('0x46')]['id']}})[_0xccde('0x26')](handleEntityNotFound(_0x1d5daf,null))[_0xccde('0x26')](removeEntity(_0x1d5daf,null))[_0xccde('0x44')](handleError(_0x1d5daf,null));};exports['describe']=function(_0x5b8dd7,_0xc38015){return db[_0xccde('0x2e')][_0xccde('0x4d')]()[_0xccde('0x26')](respondWithResult(_0xc38015,null))[_0xccde('0x44')](handleError(_0xc38015,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fdb9ebc..47dc668 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 _0x88d6=['api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x54fde2,_0x572038){var _0x1e1d9d=function(_0x3cd997){while(--_0x3cd997){_0x54fde2['push'](_0x54fde2['shift']());}};_0x1e1d9d(++_0x572038);}(_0x88d6,0x1de));var _0x688d=function(_0x364954,_0x1f0f7b){_0x364954=_0x364954-0x0;var _0x40802b=_0x88d6[_0x364954];return _0x40802b;};'use strict';var _=require(_0x688d('0x0'));var util=require(_0x688d('0x1'));var logger=require(_0x688d('0x2'))(_0x688d('0x3'));var moment=require('moment');var BPromise=require(_0x688d('0x4'));var rp=require(_0x688d('0x5'));var fs=require('fs');var path=require(_0x688d('0x6'));var rimraf=require(_0x688d('0x7'));var config=require(_0x688d('0x8'));var attributes=require(_0x688d('0x9'));module[_0x688d('0xa')]=function(_0x2cc73d,_0x2b8772){return _0x2cc73d['define']('WhatsappTransferReport',attributes,{'tableName':_0x688d('0xb'),'paranoid':![],'indexes':[{'name':_0x688d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfad3=['../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x1818b3,_0x36cdc4){var _0x5d3707=function(_0x18bf02){while(--_0x18bf02){_0x1818b3['push'](_0x1818b3['shift']());}};_0x5d3707(++_0x36cdc4);}(_0xfad3,0x1d0));var _0x3fad=function(_0x152499,_0x4eefc4){_0x152499=_0x152499-0x0;var _0x2804f2=_0xfad3[_0x152499];return _0x2804f2;};'use strict';var _=require(_0x3fad('0x0'));var util=require('util');var logger=require(_0x3fad('0x1'))(_0x3fad('0x2'));var moment=require(_0x3fad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fad('0x4'));var rimraf=require(_0x3fad('0x5'));var config=require(_0x3fad('0x6'));var attributes=require(_0x3fad('0x7'));module['exports']=function(_0x1eabd2,_0x640347){return _0x1eabd2['define'](_0x3fad('0x8'),attributes,{'tableName':_0x3fad('0x9'),'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 a1dc522..f22c96a 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 _0x4616=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x18ce59,_0x124e24){var _0x1e0e29=function(_0x22b821){while(--_0x22b821){_0x18ce59['push'](_0x18ce59['shift']());}};_0x1e0e29(++_0x124e24);}(_0x4616,0x180));var _0x6461=function(_0x5a7894,_0x2f9027){_0x5a7894=_0x5a7894-0x0;var _0x29a65f=_0x4616[_0x5a7894];return _0x29a65f;};'use strict';var _=require(_0x6461('0x0'));var util=require(_0x6461('0x1'));var moment=require(_0x6461('0x2'));var BPromise=require(_0x6461('0x3'));var rs=require(_0x6461('0x4'));var fs=require('fs');var Redis=require(_0x6461('0x5'));var db=require(_0x6461('0x6'))['db'];var utils=require(_0x6461('0x7'));var logger=require(_0x6461('0x8'))(_0x6461('0x9'));var config=require(_0x6461('0xa'));var jayson=require(_0x6461('0xb'));var client=jayson[_0x6461('0xc')][_0x6461('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x17306b,_0x4f4e82,_0x37b2a8){return new BPromise(function(_0x4d16ab,_0x2e6cb2){return client[_0x6461('0xe')](_0x17306b,_0x37b2a8)['then'](function(_0x4f25db){logger[_0x6461('0xf')](_0x6461('0x10'),_0x4f4e82,_0x6461('0x11'));logger[_0x6461('0x12')](_0x6461('0x13'),_0x4f4e82,_0x6461('0x11'),JSON[_0x6461('0x14')](_0x4f25db));if(_0x4f25db[_0x6461('0x15')]){if(_0x4f25db[_0x6461('0x15')][_0x6461('0x16')]===0x1f4){logger[_0x6461('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4f4e82,_0x4f25db[_0x6461('0x15')]['message']);return _0x2e6cb2(_0x4f25db['error'][_0x6461('0x17')]);}logger[_0x6461('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4f4e82,_0x4f25db[_0x6461('0x15')][_0x6461('0x17')]);return _0x4d16ab(_0x4f25db[_0x6461('0x15')][_0x6461('0x17')]);}else{logger[_0x6461('0xf')](_0x6461('0x10'),_0x4f4e82,'request\x20sent');_0x4d16ab(_0x4f25db['result'][_0x6461('0x17')]);}})['catch'](function(_0x4b2d07){logger[_0x6461('0x15')](_0x6461('0x10'),_0x4f4e82,_0x4b2d07);_0x2e6cb2(_0x4b2d07);});});} \ No newline at end of file +var _0xfb7a=['moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x5b92f7,_0x4b95a5){var _0x571fee=function(_0x2c3d80){while(--_0x2c3d80){_0x5b92f7['push'](_0x5b92f7['shift']());}};_0x571fee(++_0x4b95a5);}(_0xfb7a,0xae));var _0xafb7=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0xfb7a[_0x5bb1e9];return _0x262c24;};'use strict';var _=require(_0xafb7('0x0'));var util=require(_0xafb7('0x1'));var moment=require(_0xafb7('0x2'));var BPromise=require(_0xafb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafb7('0x5'));var logger=require('../../config/logger')(_0xafb7('0x6'));var config=require(_0xafb7('0x7'));var jayson=require(_0xafb7('0x8'));var client=jayson[_0xafb7('0x9')][_0xafb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37bfbf,_0x564ae9,_0x224600){return new BPromise(function(_0x3b0782,_0x3363a2){return client['request'](_0x37bfbf,_0x224600)[_0xafb7('0xb')](function(_0x254de9){logger['info'](_0xafb7('0xc'),_0x564ae9,_0xafb7('0xd'));logger[_0xafb7('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x564ae9,_0xafb7('0xd'),JSON[_0xafb7('0xf')](_0x254de9));if(_0x254de9['error']){if(_0x254de9[_0xafb7('0x10')][_0xafb7('0x11')]===0x1f4){logger[_0xafb7('0x10')](_0xafb7('0xc'),_0x564ae9,_0x254de9['error']['message']);return _0x3363a2(_0x254de9[_0xafb7('0x10')]['message']);}logger[_0xafb7('0x10')](_0xafb7('0xc'),_0x564ae9,_0x254de9[_0xafb7('0x10')][_0xafb7('0x12')]);return _0x3b0782(_0x254de9[_0xafb7('0x10')][_0xafb7('0x12')]);}else{logger[_0xafb7('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x564ae9,_0xafb7('0xd'));_0x3b0782(_0x254de9[_0xafb7('0x14')][_0xafb7('0x12')]);}})[_0xafb7('0x15')](function(_0x6d7847){logger[_0xafb7('0x10')](_0xafb7('0xc'),_0x564ae9,_0x6d7847);_0x3363a2(_0x6d7847);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a33c8af..f015d04 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9330=['sequelize','sync','then','seedDB','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider'];(function(_0x1cb046,_0x442870){var _0x4dae2a=function(_0x9f808c){while(--_0x9f808c){_0x1cb046['push'](_0x1cb046['shift']());}};_0x4dae2a(++_0x442870);}(_0x9330,0x14a));var _0x0933=function(_0x1ae4a3,_0x2c1ff9){_0x1ae4a3=_0x1ae4a3-0x0;var _0x1c7508=_0x9330[_0x1ae4a3];return _0x1c7508;};'use strict';var _=require(_0x0933('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x0933('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x0933('0x2'))(_0x0933('0x3'));var pm2=require(_0x0933('0x4'));var pm2Config=require(_0x0933('0x5'));var schedule=require(_0x0933('0x6'));var chat=require(_0x0933('0x7'));var whatsapp=require(_0x0933('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x0933('0x9'));function main(){return db[_0x0933('0xa')][_0x0933('0xb')]()[_0x0933('0xc')](function(){if(config[_0x0933('0xd')]){return seedDb[_0x0933('0xe')]();}})[_0x0933('0xc')](function(){return checkLicense[_0x0933('0xe')]();})[_0x0933('0xc')](function(){return rpc[_0x0933('0xf')]();})[_0x0933('0xc')](function(_0x30bbf8){logger[_0x0933('0x10')](_0x30bbf8);return chat[_0x0933('0x11')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x0933('0xc')](function(){return transcribe['start']();})['then'](function(){return provider['start']();})[_0x0933('0xc')](function(_0x36fe3c){logger['info'](_0x36fe3c);return pm2[_0x0933('0x11')](pm2Config);})[_0x0933('0xc')](function(_0x5cb5ba){var _0x54bdd4=_0x5cb5ba[_0x0933('0x12')](function(_0xb019db){return typeof _0xb019db['exitCode']===_0x0933('0x13')&&_0xb019db[_0x0933('0x14')]>=0x0;});if(_0x54bdd4[_0x0933('0x15')]>0x0){throw new Error(_0x54bdd4[_0x0933('0x15')]+_0x0933('0x16')+_[_0x0933('0x17')](_0x54bdd4,function(_0x536799){return'\x22'+_0x536799['pm2_env'][_0x0933('0x18')]+'\x22';}));}logger[_0x0933('0x10')](_0x0933('0x19'),_[_0x0933('0x17')](_[_0x0933('0x12')](_0x5cb5ba,{'status':_0x0933('0x1a')}),_0x0933('0x18'))[_0x0933('0x1b')]());logger[_0x0933('0x10')]('Offline\x20apps:',_['map'](_[_0x0933('0x12')](_0x5cb5ba,function(_0x5a5eae){return _0x5a5eae[_0x0933('0x1c')]!==_0x0933('0x1a');}),'name')[_0x0933('0x1b')]()||_0x0933('0x1d'));console[_0x0933('0x1e')]('App\x20Ready!');})[_0x0933('0x1f')](function(_0x28f723){console[_0x0933('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x28f723);logger['error'](_0x0933('0x20'),_0x28f723);process[_0x0933('0x21')](0x1);});}main(); \ No newline at end of file +var _0x4553=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','then','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x20e6ab,_0x143770){var _0x488887=function(_0x4e32be){while(--_0x4e32be){_0x20e6ab['push'](_0x20e6ab['shift']());}};_0x488887(++_0x143770);}(_0x4553,0x1be));var _0x3455=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4553[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var db=require(_0x3455('0x0'))['db'];var seedDb=require(_0x3455('0x1'));var checkLicense=require(_0x3455('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x3455('0x3'))(_0x3455('0x4'));var pm2=require(_0x3455('0x5'));var pm2Config=require(_0x3455('0x6'));var schedule=require(_0x3455('0x7'));var chat=require(_0x3455('0x8'));var whatsapp=require(_0x3455('0x9'));var transcribe=require(_0x3455('0xa'));var provider=require(_0x3455('0xb'));function main(){return db['sequelize'][_0x3455('0xc')]()['then'](function(){if(config[_0x3455('0xd')]){return seedDb['default']();}})[_0x3455('0xe')](function(){return checkLicense[_0x3455('0xf')]();})[_0x3455('0xe')](function(){return rpc['listen']();})['then'](function(_0x2a0338){logger[_0x3455('0x10')](_0x2a0338);return chat[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return whatsapp[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return schedule[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return transcribe[_0x3455('0x11')]();})[_0x3455('0xe')](function(){return provider[_0x3455('0x11')]();})[_0x3455('0xe')](function(_0x14b8f6){logger[_0x3455('0x10')](_0x14b8f6);return pm2[_0x3455('0x11')](pm2Config);})[_0x3455('0xe')](function(_0x3856f7){var _0x5168a3=_0x3856f7[_0x3455('0x12')](function(_0x31f2ac){return typeof _0x31f2ac[_0x3455('0x13')]===_0x3455('0x14')&&_0x31f2ac[_0x3455('0x13')]>=0x0;});if(_0x5168a3[_0x3455('0x15')]>0x0){throw new Error(_0x5168a3['length']+_0x3455('0x16')+_[_0x3455('0x17')](_0x5168a3,function(_0x147e95){return'\x22'+_0x147e95[_0x3455('0x18')][_0x3455('0x19')]+'\x22';}));}logger[_0x3455('0x10')]('Online\x20apps:',_[_0x3455('0x17')](_['filter'](_0x3856f7,{'status':_0x3455('0x1a')}),_0x3455('0x19'))[_0x3455('0x1b')]());logger[_0x3455('0x10')](_0x3455('0x1c'),_[_0x3455('0x17')](_[_0x3455('0x12')](_0x3856f7,function(_0x34d2ee){return _0x34d2ee[_0x3455('0x1d')]!=='online';}),_0x3455('0x19'))[_0x3455('0x1b')]()||_0x3455('0x1e'));console['log'](_0x3455('0x1f'));})[_0x3455('0x20')](function(_0x5a4535){console['log'](_0x3455('0x21'),_0x5a4535);logger[_0x3455('0x22')](_0x3455('0x23'),_0x5a4535);process[_0x3455('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 471e510..80cb584 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 _0xb31f=['passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','user','findOne','then','closed','query','status','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','authenticate','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger'];(function(_0x24f9d9,_0x6b4d81){var _0x392b6c=function(_0x4e685b){while(--_0x4e685b){_0x24f9d9['push'](_0x24f9d9['shift']());}};_0x392b6c(++_0x6b4d81);}(_0xb31f,0x6a));var _0xfb31=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xb31f[_0x37bd26];return _0xe83dc4;};'use strict';var db=require(_0xfb31('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xfb31('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfb31('0x2'));var _=require(_0xfb31('0x3'));var jwt=require(_0xfb31('0x4'));var expressJwt=require(_0xfb31('0x5'));var compose=require(_0xfb31('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0xfb31('0x7'));var BPromise=require(_0xfb31('0x8'));var util=require(_0xfb31('0x9'));var moment=require(_0xfb31('0xa'));var validateJwt=expressJwt({'secret':config[_0xfb31('0xb')][_0xfb31('0xc')]});var userAttributes=['id',_0xfb31('0xd'),_0xfb31('0xe'),_0xfb31('0xf'),'internal',_0xfb31('0x10'),_0xfb31('0x11'),_0xfb31('0x12'),_0xfb31('0x13'),_0xfb31('0x14'),_0xfb31('0x15'),_0xfb31('0x16'),_0xfb31('0x17'),'smsPause',_0xfb31('0x18'),_0xfb31('0x19'),'showWebBar',_0xfb31('0x1a'),_0xfb31('0x1b'),_0xfb31('0x1c'),_0xfb31('0x1d'),_0xfb31('0x1e'),'alias',_0xfb31('0x1f'),'phoneBarAutoAnswerDelay',_0xfb31('0x20'),_0xfb31('0x21'),'phoneBarEnableDtmfTone',_0xfb31('0x22'),_0xfb31('0x23'),_0xfb31('0x24'),'phoneBarRemoteControl',_0xfb31('0x25'),_0xfb31('0x26'),_0xfb31('0x27'),_0xfb31('0x28'),_0xfb31('0x29'),_0xfb31('0x2a'),_0xfb31('0x2b'),_0xfb31('0x2c'),'downloadOmnichannelInteractions',_0xfb31('0x2d'),_0xfb31('0x2e'),'selectRecallMeCampaign',_0xfb31('0x2f'),_0xfb31('0x30'),_0xfb31('0x31'),_0xfb31('0x32'),_0xfb31('0x33'),'smsAutoanswerDelay',_0xfb31('0x34'),'openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay',_0xfb31('0x35'),_0xfb31('0x36'),_0xfb31('0x37')];exports[_0xfb31('0x38')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x5f172b,_0xb395c2,_0x2082fd){if(_0x5f172b[_0xfb31('0x39')]){_0x2082fd();}else{return db['ChatInteraction'][_0xfb31('0x3a')]({'where':{'id':_0x5f172b['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xfb31('0x3b')](function(_0x3b3878){if(_0x3b3878&&_0x3b3878[_0xfb31('0x3c')]&&!_0x5f172b[_0xfb31('0x3d')]['forceDownload']){return _0xb395c2[_0xfb31('0x3e')](_0x3b3878[_0xfb31('0x3f')]===_0xfb31('0x40')?0x195:0x193)[_0xfb31('0x41')]({'message':_0x3b3878['disposition']===_0xfb31('0x40')?'Unmanaged.':_0xfb31('0x42')});}else{_0x2082fd();}})[_0xfb31('0x43')](function(_0x3b77e0){_0x2082fd(_0x3b77e0);});}});};exports[_0xfb31('0x44')]=function isAuthenticated(_0x58a7be){return compose()['use'](function(_0x49ef33,_0x4d0e89,_0x3aa313){var _0x434934;if(_0x49ef33[_0xfb31('0x45')][_0xfb31('0x46')]){if(_[_0xfb31('0x47')](_0x49ef33['headers'][_0xfb31('0x46')],_0xfb31('0x48'))){var _0x3ae2bb=basicAuth(_0x49ef33);db[_0xfb31('0x49')]['find']({'where':{'name':_0x3ae2bb[_0xfb31('0xf')]}})['then'](function(_0x2d47b0){if(!_0x2d47b0||!_0x2d47b0[_0xfb31('0x4a')](_0x3ae2bb['pass'])){return _0x4d0e89[_0xfb31('0x3e')](0x191)[_0xfb31('0x41')]({'message':'Wrong\x20credentials.'});}_0x49ef33[_0xfb31('0x39')]={'id':_0x2d47b0['id']};_0x3aa313();})[_0xfb31('0x43')](function(_0x5c0885){_0x3aa313(_0x5c0885);});}else if(_[_0xfb31('0x47')](_0x49ef33['headers'][_0xfb31('0x46')],_0xfb31('0x4b'))){validateJwt(_0x49ef33,_0x4d0e89,_0x3aa313);}else{if(_0x58a7be){_0x3aa313();}else{return _0x4d0e89[_0xfb31('0x3e')](0x193)[_0xfb31('0x41')]({'message':_0xfb31('0x4c')});}}}else if(_0x49ef33['query'][_0xfb31('0x4d')]){try{var _0x43647b={'audience':hardwareConf[_0xfb31('0x4e')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x49ef33[_0xfb31('0x3d')]['apikey'],_0x43647b)[_0xfb31('0x3b')](function(_0x31e4de){return db[_0xfb31('0x49')][_0xfb31('0x4f')]({'where':{'id':_0x31e4de[_0xfb31('0x50')]}})[_0xfb31('0x3b')](function(_0x4a632a){_0x434934=_0x4a632a;return db[_0xfb31('0x51')][_0xfb31('0x3a')]({'where':{'id':0x1},'attributes':[_0xfb31('0x52'),_0xfb31('0x53')],'raw':!![]});})['then'](function(_0x4cee16){if(!_0x434934||!_[_0xfb31('0x54')](_0x434934['apiKeyNonce'],_0x31e4de[_0xfb31('0x55')])){return _0x4d0e89[_0xfb31('0x3e')](0x191)[_0xfb31('0x41')]({'message':_0xfb31('0x56')});}if(_0x434934[_0xfb31('0x57')]){return _0x4d0e89[_0xfb31('0x3e')](0x191)[_0xfb31('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x434934[_0xfb31('0x58')]){if(_0x4cee16[_0xfb31('0x53')]>0x0){if(moment(_0x434934[_0xfb31('0x59')])[_0xfb31('0x5a')](_0x4cee16[_0xfb31('0x53')],_0xfb31('0x5b'))>moment()){return _0x4d0e89[_0xfb31('0x3e')](0x191)[_0xfb31('0x41')]({'message':_0xfb31('0x5c')});}}else{return _0x4d0e89[_0xfb31('0x3e')](0x191)[_0xfb31('0x41')]({'message':_0xfb31('0x5c')});}}_0x49ef33[_0xfb31('0x39')]={'id':_0x434934['id']};_0x3aa313();});})[_0xfb31('0x43')](function(){return _0x4d0e89[_0xfb31('0x3e')](0x191)[_0xfb31('0x41')]({'message':_0xfb31('0x5c')});});}catch(_0x58226b){_0x3aa313(_0x58226b);}}else if(_0x58a7be){_0x3aa313();}else{return _0x4d0e89['status'](0x193)[_0xfb31('0x41')]({'message':_0xfb31('0x4c')});}})['use'](function(_0x3a7ea8,_0x482cbc,_0x25d352){if(_0x3a7ea8['user']){db[_0xfb31('0x49')][_0xfb31('0x4f')]({'where':{'id':_0x3a7ea8['user']['id']},'attributes':userAttributes})[_0xfb31('0x3b')](function(_0x328bd9){if(!_0x328bd9){return _0x482cbc[_0xfb31('0x3e')](0x194)[_0xfb31('0x41')]({'message':'User\x20not\x20found.'});}_0x3a7ea8[_0xfb31('0x39')]=_0x328bd9;_0x25d352();})[_0xfb31('0x43')](function(_0x548dde){_0x25d352(_0x548dde);});}else if(_0x58a7be){_0x25d352();}else{return _0x482cbc['status'](0x194)[_0xfb31('0x41')]({'message':_0xfb31('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x39690d,_0x2312e4,_0x282605){return licenseUtil[_0xfb31('0x5e')]()[_0xfb31('0x3b')](function(_0x52b77b){if(_0x52b77b[_0xfb31('0x5f')]){_0x282605();}else{return _0x2312e4['status'](0x193)[_0xfb31('0x41')]({'message':'Forbidden'});}})[_0xfb31('0x43')](function(_0x2aa72e){_0x282605(_0x2aa72e);});});};exports[_0xfb31('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x1139ad,_0x4bc98b,_0x54ad7a){return licenseUtil[_0xfb31('0x5e')]()[_0xfb31('0x3b')](function(_0x215f58){if(_0x215f58[_0xfb31('0x61')]){_0x54ad7a();}else{return _0x4bc98b[_0xfb31('0x3e')](0x193)['json']({'message':'Forbidden'});}})[_0xfb31('0x43')](function(_0x145c14){_0x54ad7a(_0x145c14);});});};exports[_0xfb31('0x62')]=function(_0x3d129e,_0x2591cc,_0x1f78c5){_0x3d129e['isMiddleware']=!![];return _0x1f78c5();};exports['signToken']=function signToken(_0x439895){return signJwt(_0x439895);};exports[_0xfb31('0x63')]=function(_0x1efd3d,_0x5a0909){if(!_0x1efd3d[_0xfb31('0x39')]){return _0x5a0909[_0xfb31('0x3e')](0x194)[_0xfb31('0x41')]({'message':_0xfb31('0x64')});}var _0x18b521={'payload':{'id':_0x1efd3d['user']['id'],'role':_0x1efd3d[_0xfb31('0x39')][_0xfb31('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18b521)[_0xfb31('0x3b')](function(_0x5318cf){_0x5a0909[_0xfb31('0x65')](_0xfb31('0x66'),_0x5318cf);_0x5a0909[_0xfb31('0x67')](_0xfb31('0x68'));})[_0xfb31('0x43')](function(_0x248859){return _0x5a0909[_0xfb31('0x3e')](0x1f4)['send'](_0x248859);});};exports['retrieveApiKey']=function(_0x333fa0){if(_[_0xfb31('0x69')](_0x333fa0[_0xfb31('0x6a')])||_[_0xfb31('0x69')](_0x333fa0[_0xfb31('0x6b')])){return null;}else{return createJwt(_0x333fa0);}};exports['generateApiKey']=function(_0x47bcdf){_0x47bcdf[_0xfb31('0x6a')]=generateNonce();_0x47bcdf[_0xfb31('0x6b')]=generateIssuedAt();return createJwt(_0x47bcdf);};exports[_0xfb31('0x6c')]=function(_0x29afab,_0x1a2ad1){var _0x5ed1dd=_0x29afab['query']['apikey'];if(_0x5ed1dd){var _0x2ebc5c={'nonce':_0x1a2ad1[_0xfb31('0x6a')],'iat':_0x1a2ad1[_0xfb31('0x6b')],'audience':hardwareConf[_0xfb31('0x4e')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5ed1dd,_0x2ebc5c)[_0xfb31('0x3b')](function(){return generateApiKey(_0x1a2ad1);});}else{throw{'message':_0xfb31('0x6d')};}};exports[_0xfb31('0x6e')]=function(_0x5db750){var _0x2938db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2938db['test'](_0x5db750))throw new db['Sequelize'][(_0xfb31('0x6f'))](_0xfb31('0x70'));return;};exports[_0xfb31('0x71')]=function(_0xb255b0,_0x4ce0e9,_0x1657df){var _0x14226e=encryptor[_0xfb31('0x72')](_0x4ce0e9)['split'](',');for(var _0x597b6f=0x0;_0x597b6f<_0x1657df;_0x597b6f++){if(!_0x14226e[_0x597b6f])break;if(_0xb255b0[_0xfb31('0x73')]()===_0x14226e[_0x597b6f][_0xfb31('0x73')]()){var _0x9d4556=util[_0xfb31('0x74')](_0xfb31('0x75'),_0x1657df);if(_0x1657df===0x1){_0x9d4556=_0xfb31('0x76');}throw new db[(_0xfb31('0x77'))]['ValidationError'](_0x9d4556);}}return;};exports[_0xfb31('0x78')]=function(_0x3b02de,_0x2b1c91){var _0x4e6a36=_0x2b1c91?encryptor[_0xfb31('0x72')](_0x2b1c91)[_0xfb31('0x79')](','):[];if(_0x4e6a36[_0xfb31('0x7a')]===0x5){_0x4e6a36[_0xfb31('0x7b')](-0x1,0x1);}_0x4e6a36[_0xfb31('0x7c')](_0x3b02de);return encryptor[_0xfb31('0x7d')](_0x4e6a36[_0xfb31('0x7e')](','));};function signJwt(_0x13f427){var _0x561e66=BPromise[_0xfb31('0x7f')](jwt[_0xfb31('0x80')],{'context':jwt});var _0x200647=_0x13f427['secret']||config[_0xfb31('0xb')][_0xfb31('0xc')];return new BPromise(function(_0x5be984,_0x5937c1){_0x561e66(_0x13f427[_0xfb31('0x81')],_0x200647,_0x13f427[_0xfb31('0x82')])[_0xfb31('0x3b')](function(_0x2b0f8c){_0x5be984(_0x2b0f8c);})[_0xfb31('0x43')](function(_0x3f26b3){_0x5937c1(_0x3f26b3);});});}function verifyJwt(_0xaebdd7,_0x455c2a,_0x1caee2){var _0x455b2e=BPromise['promisify'](jwt[_0xfb31('0x83')],{'context':jwt});var _0x2ca834=_0x1caee2||config[_0xfb31('0xb')][_0xfb31('0xc')];return new BPromise(function(_0xa8935,_0x430a98){_0x455b2e(_0xaebdd7,_0x2ca834,_0x455c2a)[_0xfb31('0x3b')](function(_0x3cfb0f){_0xa8935(_0x3cfb0f);})[_0xfb31('0x43')](function(_0x49b670){_0x430a98(_0x49b670);});});}function generateNonce(){return crypto[_0xfb31('0x84')](0x10)[_0xfb31('0x85')](_0xfb31('0x86'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0xfb31('0x85')]();}function createJwt(_0x27674){var _0x42bf0a={'payload':{'iat':_0x27674[_0xfb31('0x6b')],'nonce':_0x27674['apiKeyNonce']},'options':{'algorithm':_0xfb31('0x87'),'subject':_0x27674['id'][_0xfb31('0x85')](),'issuer':hardwareConf[_0xfb31('0x4e')](),'audience':hardwareConf[_0xfb31('0x4e')]()}};return signJwt(_0x42bf0a)[_0xfb31('0x3b')](function(_0x2bf861){return{'iat':_0x27674['apiKeyIat'],'nonce':_0x27674[_0xfb31('0x6a')],'token':_0x2bf861};});} \ No newline at end of file +var _0x0ede=['now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','session','role','internal','email','userpic','permissions','chatPause','mailPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','settingsEnabled','downloadVoiceRecordings','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','then','closed','query','status','unmanaged','json','Unmanaged.','headers','authorization','startsWith','find','name','authenticate','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','encryptString','join','promisify','sign','secret','secrets','payload','verify','randomBytes','floor'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0ede,0x103));var _0xe0ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ede[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0xe0ed('0x0'))['db'];var config=require(_0xe0ed('0x1'));var hardwareConf=require(_0xe0ed('0x2'));var licenseUtil=require(_0xe0ed('0x3'));var encryptor=require(_0xe0ed('0x4'));var _=require('lodash');var jwt=require(_0xe0ed('0x5'));var expressJwt=require(_0xe0ed('0x6'));var compose=require(_0xe0ed('0x7'));var basicAuth=require(_0xe0ed('0x8'));var crypto=require('crypto');var BPromise=require(_0xe0ed('0x9'));var util=require(_0xe0ed('0xa'));var moment=require(_0xe0ed('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xe0ed('0xc')]});var userAttributes=['id',_0xe0ed('0xd'),'fullname','name',_0xe0ed('0xe'),_0xe0ed('0xf'),_0xe0ed('0x10'),_0xe0ed('0x11'),'md5secret','voicePause',_0xe0ed('0x12'),_0xe0ed('0x13'),'faxPause','smsPause',_0xe0ed('0x14'),'pauseType','showWebBar',_0xe0ed('0x15'),_0xe0ed('0x16'),_0xe0ed('0x17'),_0xe0ed('0x18'),'passwordResetAt',_0xe0ed('0x19'),_0xe0ed('0x1a'),_0xe0ed('0x1b'),_0xe0ed('0x1c'),_0xe0ed('0x1d'),_0xe0ed('0x1e'),_0xe0ed('0x1f'),_0xe0ed('0x20'),_0xe0ed('0x21'),_0xe0ed('0x22'),'phoneBarRemoteControlPort',_0xe0ed('0x23'),_0xe0ed('0x24'),'userProfileId','privacyEnabled',_0xe0ed('0x25'),'wssPort',_0xe0ed('0x26'),'downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls',_0xe0ed('0x27'),_0xe0ed('0x28'),_0xe0ed('0x29'),_0xe0ed('0x2a'),_0xe0ed('0x2b'),_0xe0ed('0x2c'),'smsAutoanswerDelay',_0xe0ed('0x2d'),'openchannelAutoanswerDelay',_0xe0ed('0x2e'),'faxAutoanswerDelay',_0xe0ed('0x2f'),_0xe0ed('0x30'),_0xe0ed('0x31')];exports[_0xe0ed('0x32')]=function(){return this[_0xe0ed('0x33')](!![])[_0xe0ed('0x34')](function(_0xf1629c,_0x96e787,_0x1cce65){if(_0xf1629c[_0xe0ed('0x35')]){_0x1cce65();}else{return db['ChatInteraction'][_0xe0ed('0x36')]({'where':{'id':_0xf1629c['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xe0ed('0x37')](function(_0x52e4ac){if(_0x52e4ac&&_0x52e4ac[_0xe0ed('0x38')]&&!_0xf1629c[_0xe0ed('0x39')]['forceDownload']){return _0x96e787[_0xe0ed('0x3a')](_0x52e4ac['disposition']===_0xe0ed('0x3b')?0x195:0x193)[_0xe0ed('0x3c')]({'message':_0x52e4ac['disposition']==='unmanaged'?_0xe0ed('0x3d'):'Forbidden.'});}else{_0x1cce65();}})['catch'](function(_0x24f9a0){_0x1cce65(_0x24f9a0);});}});};exports[_0xe0ed('0x33')]=function isAuthenticated(_0x18fa02){return compose()['use'](function(_0x358b93,_0x5ed481,_0x8798f6){var _0x10c51b;if(_0x358b93[_0xe0ed('0x3e')][_0xe0ed('0x3f')]){if(_[_0xe0ed('0x40')](_0x358b93[_0xe0ed('0x3e')]['authorization'],'Basic')){var _0x48da14=basicAuth(_0x358b93);db['User'][_0xe0ed('0x41')]({'where':{'name':_0x48da14[_0xe0ed('0x42')]}})[_0xe0ed('0x37')](function(_0x188807){if(!_0x188807||!_0x188807[_0xe0ed('0x43')](_0x48da14['pass'])){return _0x5ed481[_0xe0ed('0x3a')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x358b93[_0xe0ed('0x35')]={'id':_0x188807['id']};_0x8798f6();})[_0xe0ed('0x44')](function(_0x1cba03){_0x8798f6(_0x1cba03);});}else if(_[_0xe0ed('0x40')](_0x358b93[_0xe0ed('0x3e')][_0xe0ed('0x3f')],_0xe0ed('0x45'))){validateJwt(_0x358b93,_0x5ed481,_0x8798f6);}else{if(_0x18fa02){_0x8798f6();}else{return _0x5ed481['status'](0x193)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x46')});}}}else if(_0x358b93[_0xe0ed('0x39')][_0xe0ed('0x47')]){try{var _0x556291={'audience':hardwareConf[_0xe0ed('0x48')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x358b93[_0xe0ed('0x39')][_0xe0ed('0x47')],_0x556291)['then'](function(_0x39ab7d){return db[_0xe0ed('0x49')]['find']({'where':{'id':_0x39ab7d[_0xe0ed('0x4a')]}})[_0xe0ed('0x37')](function(_0xf404b7){_0x10c51b=_0xf404b7;return db[_0xe0ed('0x4b')][_0xe0ed('0x36')]({'where':{'id':0x1},'attributes':[_0xe0ed('0x4c'),_0xe0ed('0x4d')],'raw':!![]});})[_0xe0ed('0x37')](function(_0x216a30){if(!_0x10c51b||!_['isEqual'](_0x10c51b[_0xe0ed('0x4e')],_0x39ab7d['nonce'])){return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x4f')});}if(_0x10c51b[_0xe0ed('0x50')]){return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x51')});}if(_0x10c51b['blocked']){if(_0x216a30['blockDuration']>0x0){if(moment(_0x10c51b[_0xe0ed('0x52')])[_0xe0ed('0x53')](_0x216a30['blockDuration'],_0xe0ed('0x54'))>moment()){return _0x5ed481[_0xe0ed('0x3a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x51')});}}_0x358b93['user']={'id':_0x10c51b['id']};_0x8798f6();});})[_0xe0ed('0x44')](function(){return _0x5ed481[_0xe0ed('0x3a')](0x191)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x51')});});}catch(_0x391b01){_0x8798f6(_0x391b01);}}else if(_0x18fa02){_0x8798f6();}else{return _0x5ed481['status'](0x193)[_0xe0ed('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x48bfca,_0xe37602,_0x3121c2){if(_0x48bfca[_0xe0ed('0x35')]){db['User'][_0xe0ed('0x41')]({'where':{'id':_0x48bfca[_0xe0ed('0x35')]['id']},'attributes':userAttributes})[_0xe0ed('0x37')](function(_0x1f6832){if(!_0x1f6832){return _0xe37602[_0xe0ed('0x3a')](0x194)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x55')});}_0x48bfca[_0xe0ed('0x35')]=_0x1f6832;_0x3121c2();})[_0xe0ed('0x44')](function(_0x1e18fa){_0x3121c2(_0x1e18fa);});}else if(_0x18fa02){_0x3121c2();}else{return _0xe37602[_0xe0ed('0x3a')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xe0ed('0x56')]=function canUpdate(){return compose()['use'](function(_0x2a4bca,_0x5b2771,_0x2b8eec){return licenseUtil[_0xe0ed('0x57')]()[_0xe0ed('0x37')](function(_0x508907){if(_0x508907[_0xe0ed('0x58')]){_0x2b8eec();}else{return _0x5b2771[_0xe0ed('0x3a')](0x193)[_0xe0ed('0x3c')]({'message':'Forbidden'});}})[_0xe0ed('0x44')](function(_0x483619){_0x2b8eec(_0x483619);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xe0ed('0x34')](function(_0x29e36e,_0x348a84,_0x19d781){return licenseUtil[_0xe0ed('0x57')]()[_0xe0ed('0x37')](function(_0x26d66a){if(_0x26d66a['webrtc']){_0x19d781();}else{return _0x348a84['status'](0x193)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x59')});}})[_0xe0ed('0x44')](function(_0x51169c){_0x19d781(_0x51169c);});});};exports[_0xe0ed('0x5a')]=function(_0x5743cd,_0x45c009,_0x3f0677){_0x5743cd[_0xe0ed('0x5a')]=!![];return _0x3f0677();};exports['signToken']=function signToken(_0x5bd24e){return signJwt(_0x5bd24e);};exports[_0xe0ed('0x5b')]=function(_0x1831fd,_0x5b69ef){if(!_0x1831fd[_0xe0ed('0x35')]){return _0x5b69ef['status'](0x194)[_0xe0ed('0x3c')]({'message':_0xe0ed('0x5c')});}var _0x396d5a={'payload':{'id':_0x1831fd['user']['id'],'role':_0x1831fd[_0xe0ed('0x35')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x396d5a)[_0xe0ed('0x37')](function(_0x360510){_0x5b69ef[_0xe0ed('0x5d')](_0xe0ed('0x5e'),_0x360510);_0x5b69ef[_0xe0ed('0x5f')](_0xe0ed('0x60'));})['catch'](function(_0xff4bf6){return _0x5b69ef[_0xe0ed('0x3a')](0x1f4)[_0xe0ed('0x61')](_0xff4bf6);});};exports[_0xe0ed('0x62')]=function(_0x551aa6){if(_[_0xe0ed('0x63')](_0x551aa6[_0xe0ed('0x4e')])||_['isNil'](_0x551aa6[_0xe0ed('0x64')])){return null;}else{return createJwt(_0x551aa6);}};exports[_0xe0ed('0x65')]=function(_0x473c5d){_0x473c5d['apiKeyNonce']=generateNonce();_0x473c5d[_0xe0ed('0x64')]=generateIssuedAt();return createJwt(_0x473c5d);};exports['regenerateApiKey']=function(_0x58140f,_0x3df87d){var _0x22b505=_0x58140f['query'][_0xe0ed('0x47')];if(_0x22b505){var _0x3c44b9={'nonce':_0x3df87d[_0xe0ed('0x4e')],'iat':_0x3df87d[_0xe0ed('0x64')],'audience':hardwareConf[_0xe0ed('0x48')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x22b505,_0x3c44b9)[_0xe0ed('0x37')](function(){return generateApiKey(_0x3df87d);});}else{throw{'message':_0xe0ed('0x66')};}};exports[_0xe0ed('0x67')]=function(_0x46c17e){var _0x3670c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3670c9[_0xe0ed('0x68')](_0x46c17e))throw new db[(_0xe0ed('0x69'))][(_0xe0ed('0x6a'))]('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[_0xe0ed('0x6b')]=function(_0x101ba6,_0x241218,_0xbbe3a){var _0x123bf0=encryptor['decryptString'](_0x241218)[_0xe0ed('0x6c')](',');for(var _0x8b0c16=0x0;_0x8b0c16<_0xbbe3a;_0x8b0c16++){if(!_0x123bf0[_0x8b0c16])break;if(_0x101ba6[_0xe0ed('0x6d')]()===_0x123bf0[_0x8b0c16][_0xe0ed('0x6d')]()){var _0x82df84=util[_0xe0ed('0x6e')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xbbe3a);if(_0xbbe3a===0x1){_0x82df84=_0xe0ed('0x6f');}throw new db[(_0xe0ed('0x69'))][(_0xe0ed('0x6a'))](_0x82df84);}}return;};exports[_0xe0ed('0x70')]=function(_0x3be7a4,_0x203882){var _0x593502=_0x203882?encryptor[_0xe0ed('0x71')](_0x203882)[_0xe0ed('0x6c')](','):[];if(_0x593502[_0xe0ed('0x72')]===0x5){_0x593502['splice'](-0x1,0x1);}_0x593502['unshift'](_0x3be7a4);return encryptor[_0xe0ed('0x73')](_0x593502[_0xe0ed('0x74')](','));};function signJwt(_0x217cb8){var _0x26989b=BPromise[_0xe0ed('0x75')](jwt[_0xe0ed('0x76')],{'context':jwt});var _0x34422f=_0x217cb8[_0xe0ed('0x77')]||config[_0xe0ed('0x78')][_0xe0ed('0xc')];return new BPromise(function(_0x10b978,_0x2be48e){_0x26989b(_0x217cb8[_0xe0ed('0x79')],_0x34422f,_0x217cb8['options'])[_0xe0ed('0x37')](function(_0x108d8b){_0x10b978(_0x108d8b);})[_0xe0ed('0x44')](function(_0x4f1460){_0x2be48e(_0x4f1460);});});}function verifyJwt(_0x437304,_0x35a95c,_0x214025){var _0x1017a5=BPromise[_0xe0ed('0x75')](jwt[_0xe0ed('0x7a')],{'context':jwt});var _0x32e19b=_0x214025||config[_0xe0ed('0x78')][_0xe0ed('0xc')];return new BPromise(function(_0x385de1,_0x29035f){_0x1017a5(_0x437304,_0x32e19b,_0x35a95c)[_0xe0ed('0x37')](function(_0x2bed8d){_0x385de1(_0x2bed8d);})[_0xe0ed('0x44')](function(_0x587487){_0x29035f(_0x587487);});});}function generateNonce(){return crypto[_0xe0ed('0x7b')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xe0ed('0x7c')](Date[_0xe0ed('0x7d')]()/0x3e8)[_0xe0ed('0x7e')]();}function createJwt(_0x463630){var _0x13bc1c={'payload':{'iat':_0x463630[_0xe0ed('0x64')],'nonce':_0x463630[_0xe0ed('0x4e')]},'options':{'algorithm':_0xe0ed('0x7f'),'subject':_0x463630['id'][_0xe0ed('0x7e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x13bc1c)['then'](function(_0x1e458d){return{'iat':_0x463630['apiKeyIat'],'nonce':_0x463630[_0xe0ed('0x4e')],'token':_0x1e458d};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 030014f..0c0a644 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dc5=['CmContact','keys','filter','startsWith','cf_','CmCustomField','findOne','slice','all','length','type','map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','where','default','fields','user','clause','skip','search','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe'];(function(_0x13658a,_0x2874c4){var _0x5a27e7=function(_0x374fae){while(--_0x374fae){_0x13658a['push'](_0x13658a['shift']());}};_0x5a27e7(++_0x2874c4);}(_0x5dc5,0xe4));var _0x55dc=function(_0x5a7fb0,_0x4c5216){_0x5a7fb0=_0x5a7fb0-0x0;var _0x4f8439=_0x5dc5[_0x5a7fb0];return _0x4f8439;};'use strict';var _=require(_0x55dc('0x0'));var sqlUtils=require(_0x55dc('0x1'));var db=require(_0x55dc('0x2'))['db'];exports[_0x55dc('0x3')]=function(_0x50835e,_0xdd69cb,_0x390168,_0x3243e8){var _0x45909a={'count':0x0,'rows':[]};var _0x4ef163=sqlUtils[_0x55dc('0x4')](_0xdd69cb,_0x50835e);if(_0x4ef163){return Promise[_0x55dc('0x5')](_0x45909a);}var _0x15caf3=sqlUtils[_0x55dc('0x6')]();var _0x210781={};var _0x99625b=![];var _0x3b481d=![];return Promise[_0x55dc('0x5')]()[_0x55dc('0x7')](function(){if(_0x50835e['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x50835e['search'],_0x3243e8);}else{return sqlUtils['parseQueryParameters'](_0x50835e,_0x3243e8);}})[_0x55dc('0x7')](function(_0x37294a){_0x15caf3[_0x55dc('0x8')](_0x37294a[_0x55dc('0x9')]);_0x15caf3[_0x55dc('0x8')](_0x37294a[_0x55dc('0xa')]);_0x15caf3[_0x55dc('0x8')](_0x37294a['filter']);_0x15caf3[_0x55dc('0x8')](_0x37294a[_0x55dc('0xb')][_0x55dc('0xc')]);_0x210781=_0x37294a['tags'];_0x3b481d=_0x37294a['user'][_0x55dc('0xd')];return sqlUtils['checkListsRestrictions'](_0xdd69cb,_0x50835e,_0x3b481d);})['then'](function(_0x127464){_0x15caf3[_0x55dc('0x8')](_0x127464);var _0x140964=_0x50835e[_0x55dc('0xe')]?_0x210781[_0x55dc('0xf')]:_0x50835e['tag'];_0x99625b=_0x140964?!![]:![];return sqlUtils[_0x55dc('0x10')](_0x15caf3,_0x140964);})[_0x55dc('0x7')](function(_0x4da9ce){_0x45909a[_0x55dc('0x11')]=_0x4da9ce;if(_0x45909a[_0x55dc('0x11')]===0x0){return;}if(_0x50835e[_0x55dc('0x12')]){_0x3b481d=!![];}return sqlUtils[_0x55dc('0x13')](_0x15caf3,_0x50835e['fields'],_0x390168,_0x99625b,_0x210781['clause'],_0x3b481d);})[_0x55dc('0x7')](function(_0x4ab73f){if(!_0x4ab73f){return[];}return sqlUtils[_0x55dc('0x14')](_0x4ab73f,_0x50835e,_0x390168);})[_0x55dc('0x7')](function(_0x5509ca){_0x45909a[_0x55dc('0x15')]=_0x5509ca;return _0x45909a;})[_0x55dc('0x16')](function(_0xb2b75a){throw _0xb2b75a;});};exports[_0x55dc('0x17')]=function(){var _0x2da914={};var _0x4d8e3b=[];return db[_0x55dc('0x18')][_0x55dc('0x17')]()[_0x55dc('0x7')](function(_0x50acfa){_0x2da914=_0x50acfa;var _0x2b70f5=Object[_0x55dc('0x19')](_0x2da914)[_0x55dc('0x1a')](function(_0x35d2f2){return _[_0x55dc('0x1b')](_0x35d2f2,_0x55dc('0x1c'))?_0x35d2f2:undefined;});var _0x45f50b=_0x2b70f5['map'](function(_0x362dd4){return db[_0x55dc('0x1d')][_0x55dc('0x1e')]({'where':{'id':_0x362dd4[_0x55dc('0x1f')](0x3)},'raw':!![]});});return Promise[_0x55dc('0x20')](_0x45f50b);})[_0x55dc('0x7')](function(_0x48eba8){for(var _0x2ae2c1=0x0;_0x2ae2c1<_0x48eba8[_0x55dc('0x21')];_0x2ae2c1++){if(_0x48eba8[_0x2ae2c1]){var _0x57a45a='cf_'+_0x48eba8[_0x2ae2c1]['id'];_0x2da914[_0x57a45a]['fieldType']=_0x48eba8[_0x2ae2c1][_0x55dc('0x22')];}}_0x4d8e3b=_[_0x55dc('0x23')](Object[_0x55dc('0x19')](_0x2da914),function(_0x5ae9ee){return{'name':_0x5ae9ee,'type':_0x2da914[_0x5ae9ee][_0x55dc('0x22')]};});return _0x4d8e3b;})[_0x55dc('0x16')](function(_0x25612e){throw _0x25612e;});}; \ No newline at end of file +var _0x0f2d=['User','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','keys','startsWith','cf_','map','findOne','all','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','default','fields','where','filter','user','clause','skip','ids','tag','countFilteredContacts','count'];(function(_0x193ae5,_0x566d2b){var _0x1a134c=function(_0x414b1c){while(--_0x414b1c){_0x193ae5['push'](_0x193ae5['shift']());}};_0x1a134c(++_0x566d2b);}(_0x0f2d,0x149));var _0xd0f2=function(_0x4def5b,_0x108fea){_0x4def5b=_0x4def5b-0x0;var _0x899c0e=_0x0f2d[_0x4def5b];return _0x899c0e;};'use strict';var _=require(_0xd0f2('0x0'));var sqlUtils=require(_0xd0f2('0x1'));var db=require(_0xd0f2('0x2'))['db'];exports[_0xd0f2('0x3')]=function(_0x412069,_0x2e5fd8,_0x54ff57,_0xb2dd12){var _0x3bfc4a={'count':0x0,'rows':[]};var _0x412e2f=sqlUtils['skipContactsQuery'](_0x2e5fd8,_0x412069);if(_0x412e2f){return Promise[_0xd0f2('0x4')](_0x3bfc4a);}var _0x374829=sqlUtils[_0xd0f2('0x5')]();var _0x4ee4e6={};var _0x2650d5=![];var _0x195637=![];return Promise[_0xd0f2('0x4')]()['then'](function(){if(_0x412069[_0xd0f2('0x6')]){return sqlUtils[_0xd0f2('0x7')](_0x412069[_0xd0f2('0x6')],_0xb2dd12);}else{return sqlUtils[_0xd0f2('0x8')](_0x412069,_0xb2dd12);}})[_0xd0f2('0x9')](function(_0x1b64bb){_0x374829['where'](_0x1b64bb[_0xd0f2('0xa')]);_0x374829['where'](_0x1b64bb[_0xd0f2('0xb')]);_0x374829[_0xd0f2('0xc')](_0x1b64bb[_0xd0f2('0xd')]);_0x374829[_0xd0f2('0xc')](_0x1b64bb[_0xd0f2('0xe')][_0xd0f2('0xf')]);_0x4ee4e6=_0x1b64bb['tags'];_0x195637=_0x1b64bb[_0xd0f2('0xe')][_0xd0f2('0x10')];return sqlUtils['checkListsRestrictions'](_0x2e5fd8,_0x412069,_0x195637);})[_0xd0f2('0x9')](function(_0x3b9b2c){_0x374829[_0xd0f2('0xc')](_0x3b9b2c);var _0x30987d=_0x412069[_0xd0f2('0x6')]?_0x4ee4e6[_0xd0f2('0x11')]:_0x412069[_0xd0f2('0x12')];_0x2650d5=_0x30987d?!![]:![];return sqlUtils[_0xd0f2('0x13')](_0x374829,_0x30987d);})[_0xd0f2('0x9')](function(_0x4ed407){_0x3bfc4a[_0xd0f2('0x14')]=_0x4ed407;if(_0x3bfc4a[_0xd0f2('0x14')]===0x0){return;}if(_0x412069[_0xd0f2('0x15')]){_0x195637=!![];}return sqlUtils[_0xd0f2('0x16')](_0x374829,_0x412069[_0xd0f2('0xb')],_0x54ff57,_0x2650d5,_0x4ee4e6[_0xd0f2('0xf')],_0x195637);})[_0xd0f2('0x9')](function(_0x19e987){if(!_0x19e987){return[];}return sqlUtils[_0xd0f2('0x17')](_0x19e987,_0x412069,_0x54ff57);})[_0xd0f2('0x9')](function(_0x1bb418){_0x3bfc4a[_0xd0f2('0x18')]=_0x1bb418;return _0x3bfc4a;})[_0xd0f2('0x19')](function(_0x378d7f){throw _0x378d7f;});};exports['describe']=function(){var _0x5e07cd={};var _0x273983=[];return db[_0xd0f2('0x1a')]['describe']()[_0xd0f2('0x9')](function(_0x3e3e39){_0x5e07cd=_0x3e3e39;var _0x245516=Object[_0xd0f2('0x1b')](_0x5e07cd)[_0xd0f2('0xd')](function(_0x2cf1e0){return _[_0xd0f2('0x1c')](_0x2cf1e0,_0xd0f2('0x1d'))?_0x2cf1e0:undefined;});var _0x2d6e7c=_0x245516[_0xd0f2('0x1e')](function(_0x129f39){return db['CmCustomField'][_0xd0f2('0x1f')]({'where':{'id':_0x129f39['slice'](0x3)},'raw':!![]});});return Promise[_0xd0f2('0x20')](_0x2d6e7c);})[_0xd0f2('0x9')](function(_0x1e4d3b){for(var _0x5a8db6=0x0;_0x5a8db6<_0x1e4d3b['length'];_0x5a8db6++){if(_0x1e4d3b[_0x5a8db6]){var _0x22c9d1=_0xd0f2('0x1d')+_0x1e4d3b[_0x5a8db6]['id'];_0x5e07cd[_0x22c9d1][_0xd0f2('0x21')]=_0x1e4d3b[_0x5a8db6][_0xd0f2('0x22')];}}_0x273983=_[_0xd0f2('0x1e')](Object[_0xd0f2('0x1b')](_0x5e07cd),function(_0x596781){return{'name':_0x596781,'type':_0x5e07cd[_0x596781][_0xd0f2('0x22')]};});return _0x273983;})[_0xd0f2('0x19')](function(_0x181394){throw _0x181394;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 98ab29e..e85a499 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe2e=['exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','from','cm_contacts','where','subqry','left_join','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','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.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','buildExpression','type','default','text','value','start','end','Tag','map','ids','User','user','clause','and','uc.UserId\x20=\x20?','skip','keys','Contact','length','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','tags','filter','search','getLists','attributes','select','c.id','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbe2e,0x1bd));var _0xebe2=function(_0xcb45b4,_0x925bae){_0xcb45b4=_0xcb45b4-0x0;var _0x3ce95e=_0xbe2e[_0xcb45b4];return _0x3ce95e;};'use strict';var _=require(_0xebe2('0x0'));var squel=require(_0xebe2('0x1'));var as=require(_0xebe2('0x2'));var qs=require(_0xebe2('0x3'));var utils=require(_0xebe2('0x4'));var db=require(_0xebe2('0x5'))['db'];function skipContactsQuery(_0x10acaf,_0x412d7f){var _0x21352f=![];if(_0x10acaf[_0xebe2('0x6')]===_0xebe2('0x7')&&!_0x412d7f['search']&&!_0x412d7f[_0xebe2('0x8')]&&_0x412d7f[_0xebe2('0x9')]!==_0xebe2('0xa')){_0x21352f=!![];}return _0x21352f;}function getContactsSubquery(){return squel['select']()[_0xebe2('0xb')](_0xebe2('0xc'),'c')[_0xebe2('0xd')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x2f2d4d,_0xd74d99){var _0x53303a=_0xd74d99?'c':_0xebe2('0xe');_0x2f2d4d[_0xebe2('0xf')]('cm_user_has_contacts','uc',_0xebe2('0x10')+_0x53303a+_0xebe2('0x11'))[_0xebe2('0xf')]('cm_contact_has_tags','ct',_0xebe2('0x12')+_0x53303a+_0xebe2('0x11'))[_0xebe2('0xf')](_0xebe2('0x13'),'t',_0xebe2('0x14'));return _0x2f2d4d;}function addFieldsToQuery(_0x2b43c8,_0x1408ad,_0x17b780,_0x4d4655,_0x4d72b1){var _0x3416cc=_0x4d72b1?'c':_0xebe2('0xe');if(!_0x1408ad){_0x1408ad=['id',_0xebe2('0x15'),'lastName',_0xebe2('0x16'),_0xebe2('0x17'),_0xebe2('0x18'),_0xebe2('0x19'),'ListId','CompanyId',_0xebe2('0x1a'),_0xebe2('0x1b'),_0xebe2('0x1c'),_0xebe2('0x1d')];}else if(!_0x1408ad[_0xebe2('0x1e')]('id')){_0x1408ad[_0xebe2('0x1f')]('id');}var _0x57f186=_0x17b780&&_0x4d72b1||!_0x17b780&&!_0x4d72b1;if(_0x4d4655){_0x57f186=_0x4d4655&&_0x4d72b1||!_0x4d4655&&!_0x4d72b1;}_0x1408ad[_0xebe2('0x20')](function(_0x2e0c6e){if(_0x2e0c6e==='TagIds'){if(_0x57f186){_0x2b43c8[_0xebe2('0x21')](_0xebe2('0x22'),_0x2e0c6e);}else if(_0x17b780||_0x4d4655){_0x2b43c8[_0xebe2('0x21')](_0x3416cc+'.'+_0x2e0c6e);}}else{_0x2b43c8[_0xebe2('0x21')](_0x3416cc+'.'+_0x2e0c6e);}});return _0x2b43c8;}function getSqlClauses(){var _0x29832b={'default':squel[_0xebe2('0x23')](),'fields':squel[_0xebe2('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xebe2('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x29832b;}function parseTagParameter(_0x19f68b){var _0xf0522f=squel['expr']();if(_0x19f68b){var _0xe1c08f=utils[_0xebe2('0x24')](_0x19f68b);_0xe1c08f['forEach'](function(_0x417711){_0xf0522f['or'](_0xebe2('0x25'),'%,'+_0x417711+',%');});}return _0xf0522f;}function parseSearchFilter(_0x2ea4b2){var _0x5b23bb=squel[_0xebe2('0x23')]();if(_0x2ea4b2){var _0x4da1ae=_0x2ea4b2[_0xebe2('0x26')]('\x5c','\x5c\x5c')[_0xebe2('0x26')](/'/g,'\x27\x27');if(_0x4da1ae[_0xebe2('0x27')]('\x20')['length']>0x1){_0x5b23bb['or'](_0xebe2('0x28'),qs[_0xebe2('0x29')](_0x4da1ae,!![]),null);}else{if(qs[_0xebe2('0x2a')](_0x4da1ae)){_0x5b23bb['or'](_0xebe2('0x2b'),_0x4da1ae+'%');_0x5b23bb['or'](_0xebe2('0x2c'),_0x4da1ae+'%');_0x5b23bb['or'](_0xebe2('0x2d'),_0x4da1ae+'%');_0x5b23bb['or'](_0xebe2('0x2e'),_0x4da1ae+'%');}else if(qs[_0xebe2('0x2f')](_0x4da1ae)){_0x5b23bb['or']('c.email\x20LIKE\x20?',_0x4da1ae+'%');}else{_0x5b23bb['or'](_0xebe2('0x30'),'%'+_0x4da1ae+'%');_0x5b23bb['or'](_0xebe2('0x31'),'%'+_0x4da1ae+'%');_0x5b23bb['or']('c.email\x20LIKE\x20?','%'+_0x4da1ae+'%');}}}return _0x5b23bb;}function parseAdvancedSearchFilter(_0x210f7a,_0x126e6f){var _0x28273c=getSqlClauses();var _0x52cb62=as['parseSearch'](_0x210f7a);var _0x580438=_0x52cb62[_0xebe2('0x32')];for(var _0x5cc236=0x0;_0x5cc236<_0x52cb62[_0xebe2('0x33')]['length'];_0x5cc236++){var _0x3d1e48=_0x52cb62[_0xebe2('0x33')][_0x5cc236];var _0x1ab4e9='c';var _0x5e2e1a=_[_0xebe2('0x34')](_0x126e6f,[_0xebe2('0x35'),_0x3d1e48['field']]);if(_0x5e2e1a){if(_0x3d1e48[_0xebe2('0x21')]===_0xebe2('0x36')||_0x5e2e1a[_0xebe2('0x37')]==='datetime'){_0x3d1e48[_0xebe2('0x38')]='DATE';}var _0x118d8f=as[_0xebe2('0x39')](_0x1ab4e9,_0x5e2e1a[_0xebe2('0x3a')],_0x3d1e48);_0x28273c[_0xebe2('0x3b')][_0x580438](_0x118d8f[_0xebe2('0x3c')],_0x118d8f[_0xebe2('0x3d')][_0xebe2('0x3e')],_0x118d8f[_0xebe2('0x3d')][_0xebe2('0x3f')]);}else{if(_0x3d1e48['field']===_0xebe2('0x40')){var _0x2155f1=_0x3d1e48[_0xebe2('0x3d')][_0xebe2('0x27')](',')[_0xebe2('0x41')](function(_0x2ae284){return Number(_0x2ae284);});var _0x5863c6=parseTagParameter(_0x2155f1);_0x28273c['tags']['clause']['and'](_0x5863c6);_0x28273c['tags'][_0xebe2('0x42')]=_0x2155f1;}else if(_0x3d1e48['field']===_0xebe2('0x43')){_0x28273c[_0xebe2('0x44')][_0xebe2('0x45')][_0xebe2('0x46')](_0xebe2('0x47'),_0x3d1e48[_0xebe2('0x3d')]);_0x28273c['user'][_0xebe2('0x48')]=!![];}}}return _0x28273c;}function parseModelFields(_0x245071,_0x2ff292){var _0x4ceb4a=squel['expr']();var _0x79db30=_(_0x245071)[_0xebe2('0x49')]()[_0xebe2('0x41')](function(_0x1ad9ef){return _['some'](_0x2ff292,[_0xebe2('0x35'),_0x1ad9ef])?_0x1ad9ef:undefined;})['compact']()['value']();if(_0x245071[_0xebe2('0x4a')]){_0x79db30[_0xebe2('0x1f')](_0xebe2('0x4a'));}if(_0x245071[_0xebe2('0x43')]){_0x79db30[_0xebe2('0x1f')](_0xebe2('0x43'));}if(_0x79db30[_0xebe2('0x4b')]>0x0){_0x79db30[_0xebe2('0x20')](function(_0x2a95f9){if(_0x2a95f9===_0xebe2('0x8')){_0x4ceb4a[_0xebe2('0x46')](_0xebe2('0x4c'),[][_0xebe2('0x4d')](_0x245071[_0x2a95f9]));}else if(_0x2a95f9==='Contact'){var _0x449cfd='%'+_0x245071[_0x2a95f9]+'%';_0x4ceb4a['and'](_0xebe2('0x4e'),_0x449cfd);}else if(_0x2a95f9===_0xebe2('0x43')){_0x4ceb4a[_0xebe2('0x46')](_0xebe2('0x47'),_0x245071[_0x2a95f9]);}else{_0x4ceb4a[_0xebe2('0x46')]('c.'+_0x2a95f9+'\x20=\x20?',_0x245071[_0x2a95f9]);}});}return _0x4ceb4a;}function parseQueryParameters(_0x2080a5,_0x27b9fb){var _0x54e407=getSqlClauses();return Promise[_0xebe2('0x4f')]()['then'](function(){return parseModelFields(_0x2080a5,_0x27b9fb);})[_0xebe2('0x50')](function(_0x4e82ca){_0x54e407[_0xebe2('0x51')][_0xebe2('0x46')](_0x4e82ca);return parseTagParameter(_0x2080a5[_0xebe2('0x52')]);})['then'](function(_0xca41b){_0x54e407[_0xebe2('0x53')][_0xebe2('0x45')][_0xebe2('0x46')](_0xca41b);return parseSearchFilter(_0x2080a5[_0xebe2('0x54')]);})['then'](function(_0x13b250){_0x54e407['filter']=_0x13b250;return _0x54e407;});}function checkListsRestrictions(_0xedf825,_0xb4c5ff,_0x4c811f){var _0x115810=squel[_0xebe2('0x23')]();return Promise['resolve']()[_0xebe2('0x50')](function(){if(_0xb4c5ff[_0xebe2('0x55')]&&_0xedf825[_0xebe2('0x6')]===_0xebe2('0x7')&&!_0x4c811f){return _0xedf825[_0xebe2('0x56')]({'attributes':['id'],'raw':!![]});}})[_0xebe2('0x50')](function(_0x278efb){if(_0x278efb){if(_0x278efb[_0xebe2('0x4b')]===0x0){_0x115810[_0xebe2('0x46')]('c.ListId\x20IS\x20NULL');}else{_0x115810[_0xebe2('0x46')]('c.ListId\x20IN\x20?',_[_0xebe2('0x41')](_0x278efb,'id'));}}})[_0xebe2('0x50')](function(){return _0x115810;});}function buildContactsQuery(_0x2358f5,_0x49f215,_0x38c677,_0x436320,_0x110361,_0x1f4119){if(_0x49f215){_0x49f215=_0x38c677[_0xebe2('0x57')];}_0x2358f5=addFieldsToQuery(_0x2358f5,_0x49f215,_0x436320,_0x1f4119,!![]);var _0x5f0472=squel[_0xebe2('0x58')]();_0x5f0472=addFieldsToQuery(_0x5f0472,_0x49f215,_0x436320,_0x1f4119,![]);if(_0x436320||_0x1f4119){_0x2358f5=applyJoinClauses(_0x2358f5,!![]);_0x2358f5['group'](_0xebe2('0x59'));if(_0x38c677['limit']){_0x5f0472[_0xebe2('0x5a')](_0x38c677['limit']);}if(_0x38c677[_0xebe2('0x5b')]){_0x5f0472[_0xebe2('0x5b')](_0x38c677['offset']);}}else{_0x5f0472=applyJoinClauses(_0x5f0472,![]);_0x5f0472['group'](_0xebe2('0x5c'));if(_0x38c677[_0xebe2('0x5a')]){_0x2358f5[_0xebe2('0x5a')](_0x38c677[_0xebe2('0x5a')]);}if(_0x38c677[_0xebe2('0x5b')]){_0x2358f5[_0xebe2('0x5b')](_0x38c677['offset']);}}_0x5f0472[_0xebe2('0x5d')](_0x110361);if(_0x38c677[_0xebe2('0x5e')]){_0x38c677[_0xebe2('0x5e')][_0xebe2('0x20')](function(_0xa84960){_0x2358f5[_0xebe2('0x5e')]('c.'+_0xa84960[0x0],_0xa84960[0x1]===_0xebe2('0x5f')?![]:!![]);_0x5f0472[_0xebe2('0x5e')]('subqry.'+_0xa84960[0x0],_0xa84960[0x1]==='DESC'?![]:!![]);});}_0x5f0472[_0xebe2('0xb')](_0x2358f5,'subqry');return _0x5f0472;}function getFilteredContacts(_0x52af8e){var _0x2c0e75=[];return db['Tag'][_0xebe2('0x60')]({'attributes':['id',_0xebe2('0x35'),_0xebe2('0x61')],'raw':!![]})[_0xebe2('0x50')](function(_0x27e378){_0x2c0e75=_[_0xebe2('0x62')](_0x27e378,'id');var _0x944dbf={'type':db[_0xebe2('0x63')][_0xebe2('0x64')][_0xebe2('0x65')],'model':db[_0xebe2('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xebe2('0x67')][_0xebe2('0x68')](_0x52af8e[_0xebe2('0x69')](),_0x944dbf);})[_0xebe2('0x50')](function(_0x2464f9){_0x2464f9[_0xebe2('0x20')](function(_0x48e918){if(_0x48e918['TagIds']){_0x48e918['Tags']=[];_0x48e918[_0xebe2('0x1d')]['split'](',')[_0xebe2('0x20')](function(_0x468239){_0x48e918[_0xebe2('0x6a')]['push'](_0x2c0e75[_0x468239]);});}delete _0x48e918[_0xebe2('0x1d')];});return _0x2464f9;});}function countFilteredContacts(_0x435a8f,_0x3b6c79){var _0xec9bb0=_0x435a8f['clone']();_0xec9bb0[_0xebe2('0x21')](_0xebe2('0x6b'));_0xec9bb0=applyJoinClauses(_0xec9bb0,!![]);_0x435a8f['group']('c.id');var _0x5238d4=utils[_0xebe2('0x24')](_0x3b6c79);if(!_[_0xebe2('0x6c')](_0x5238d4)){_0xec9bb0[_0xebe2('0xd')](_0xebe2('0x6d'),_0x5238d4);}var _0x1fd06f={'type':db['Sequelize'][_0xebe2('0x64')][_0xebe2('0x65')],'raw':!![]};return db[_0xebe2('0x67')][_0xebe2('0x68')](_0xec9bb0[_0xebe2('0x69')](),_0x1fd06f)[_0xebe2('0x50')](function(_0x1c74a9){return _0x1c74a9[0x0]['COUNT(*)'];});}module[_0xebe2('0x6e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x96b8=['castTo','buildExpression','type','default','text','start','value','Tag','map','clause','and','tags','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','where','t.id\x20IN\x20?','toString','lodash','squel','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','length','conditions','find','name','datetime'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x96b8,0x17e));var _0x896b=function(_0x185fae,_0x32ba5a){_0x185fae=_0x185fae-0x0;var _0x1e0c34=_0x96b8[_0x185fae];return _0x1e0c34;};'use strict';var _=require(_0x896b('0x0'));var squel=require(_0x896b('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x896b('0x2'))['db'];function skipContactsQuery(_0x26ed57,_0x57e2e6){var _0x36ef20=![];if(_0x26ed57[_0x896b('0x3')]===_0x896b('0x4')&&!_0x57e2e6[_0x896b('0x5')]&&!_0x57e2e6[_0x896b('0x6')]&&_0x57e2e6[_0x896b('0x7')]!==_0x896b('0x8')){_0x36ef20=!![];}return _0x36ef20;}function getContactsSubquery(){return squel[_0x896b('0x9')]()[_0x896b('0xa')](_0x896b('0xb'),'c')['where'](_0x896b('0xc'));}function applyJoinClauses(_0x2c67f5,_0x493261){var _0x5c6ddf=_0x493261?'c':_0x896b('0xd');_0x2c67f5[_0x896b('0xe')](_0x896b('0xf'),'uc',_0x896b('0x10')+_0x5c6ddf+_0x896b('0x11'))['left_join'](_0x896b('0x12'),'ct',_0x896b('0x13')+_0x5c6ddf+_0x896b('0x11'))[_0x896b('0xe')](_0x896b('0x14'),'t',_0x896b('0x15'));return _0x2c67f5;}function addFieldsToQuery(_0x139b30,_0x527f4c,_0x420df1,_0x25d54a,_0x47d943){var _0x578427=_0x47d943?'c':_0x896b('0xd');if(!_0x527f4c){_0x527f4c=['id',_0x896b('0x16'),_0x896b('0x17'),_0x896b('0x18'),_0x896b('0x19'),_0x896b('0x1a'),_0x896b('0x1b'),_0x896b('0x6'),_0x896b('0x1c'),_0x896b('0x1d'),_0x896b('0x1e'),'deletedAt',_0x896b('0x1f')];}else if(!_0x527f4c[_0x896b('0x20')]('id')){_0x527f4c[_0x896b('0x21')]('id');}var _0x514a25=_0x420df1&&_0x47d943||!_0x420df1&&!_0x47d943;if(_0x25d54a){_0x514a25=_0x25d54a&&_0x47d943||!_0x25d54a&&!_0x47d943;}_0x527f4c['forEach'](function(_0x376234){if(_0x376234==='TagIds'){if(_0x514a25){_0x139b30[_0x896b('0x22')](_0x896b('0x23'),_0x376234);}else if(_0x420df1||_0x25d54a){_0x139b30[_0x896b('0x22')](_0x578427+'.'+_0x376234);}}else{_0x139b30['field'](_0x578427+'.'+_0x376234);}});return _0x139b30;}function getSqlClauses(){var _0x16e345={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x896b('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x16e345;}function parseTagParameter(_0x313c71){var _0x527500=squel['expr']();if(_0x313c71){var _0x50a714=utils[_0x896b('0x25')](_0x313c71);_0x50a714[_0x896b('0x26')](function(_0x4c585d){_0x527500['or'](_0x896b('0x27'),'%,'+_0x4c585d+',%');});}return _0x527500;}function parseSearchFilter(_0x58c23b){var _0x2b027a=squel[_0x896b('0x24')]();if(_0x58c23b){var _0x6ad908=_0x58c23b[_0x896b('0x28')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x6ad908['split']('\x20')['length']>0x1){_0x2b027a['or'](_0x896b('0x29'),qs[_0x896b('0x2a')](_0x6ad908,!![]),null);}else{if(qs[_0x896b('0x2b')](_0x6ad908)){_0x2b027a['or'](_0x896b('0x2c'),_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x2d'),_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x2e'),_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x2f'),_0x6ad908+'%');}else if(qs[_0x896b('0x30')](_0x6ad908)){_0x2b027a['or']('c.email\x20LIKE\x20?',_0x6ad908+'%');}else{_0x2b027a['or'](_0x896b('0x31'),'%'+_0x6ad908+'%');_0x2b027a['or'](_0x896b('0x32'),'%'+_0x6ad908+'%');_0x2b027a['or']('c.email\x20LIKE\x20?','%'+_0x6ad908+'%');}}}return _0x2b027a;}function parseAdvancedSearchFilter(_0x22470a,_0x568847){var _0x3cb70d=getSqlClauses();var _0x54cfd4=as[_0x896b('0x33')](_0x22470a);var _0xbfc1ea=_0x54cfd4[_0x896b('0x34')];for(var _0x14e893=0x0;_0x14e893<_0x54cfd4['conditions'][_0x896b('0x35')];_0x14e893++){var _0x17d546=_0x54cfd4[_0x896b('0x36')][_0x14e893];var _0x187d9c='c';var _0xeb3c19=_[_0x896b('0x37')](_0x568847,[_0x896b('0x38'),_0x17d546[_0x896b('0x22')]]);if(_0xeb3c19){if(_0x17d546['field']==='dateOfBirth'||_0xeb3c19['fieldType']===_0x896b('0x39')){_0x17d546[_0x896b('0x3a')]='DATE';}var _0x48ef11=as[_0x896b('0x3b')](_0x187d9c,_0xeb3c19[_0x896b('0x3c')],_0x17d546);_0x3cb70d[_0x896b('0x3d')][_0xbfc1ea](_0x48ef11[_0x896b('0x3e')],_0x48ef11['value'][_0x896b('0x3f')],_0x48ef11[_0x896b('0x40')]['end']);}else{if(_0x17d546[_0x896b('0x22')]===_0x896b('0x41')){var _0xfafc53=_0x17d546[_0x896b('0x40')]['split'](',')[_0x896b('0x42')](function(_0xfe2c53){return Number(_0xfe2c53);});var _0x23478a=parseTagParameter(_0xfafc53);_0x3cb70d['tags'][_0x896b('0x43')][_0x896b('0x44')](_0x23478a);_0x3cb70d[_0x896b('0x45')]['ids']=_0xfafc53;}else if(_0x17d546[_0x896b('0x22')]==='User'){_0x3cb70d[_0x896b('0x46')]['clause']['and'](_0x896b('0x47'),_0x17d546['value']);_0x3cb70d[_0x896b('0x46')][_0x896b('0x48')]=!![];}}}return _0x3cb70d;}function parseModelFields(_0x20ed9d,_0xd9adab){var _0x15393d=squel['expr']();var _0xc93f2c=_(_0x20ed9d)[_0x896b('0x49')]()['map'](function(_0x1a201a){return _[_0x896b('0x4a')](_0xd9adab,[_0x896b('0x38'),_0x1a201a])?_0x1a201a:undefined;})['compact']()[_0x896b('0x40')]();if(_0x20ed9d[_0x896b('0x4b')]){_0xc93f2c[_0x896b('0x21')](_0x896b('0x4b'));}if(_0x20ed9d[_0x896b('0x4c')]){_0xc93f2c[_0x896b('0x21')](_0x896b('0x4c'));}if(_0xc93f2c[_0x896b('0x35')]>0x0){_0xc93f2c['forEach'](function(_0x32041d){if(_0x32041d===_0x896b('0x6')){_0x15393d[_0x896b('0x44')](_0x896b('0x4d'),[]['concat'](_0x20ed9d[_0x32041d]));}else if(_0x32041d==='Contact'){var _0x51c124='%'+_0x20ed9d[_0x32041d]+'%';_0x15393d[_0x896b('0x44')](_0x896b('0x4e'),_0x51c124);}else if(_0x32041d===_0x896b('0x4c')){_0x15393d[_0x896b('0x44')]('uc.UserId\x20=\x20?',_0x20ed9d[_0x32041d]);}else{_0x15393d[_0x896b('0x44')]('c.'+_0x32041d+_0x896b('0x4f'),_0x20ed9d[_0x32041d]);}});}return _0x15393d;}function parseQueryParameters(_0xc7c284,_0x4b2202){var _0x265a7f=getSqlClauses();return Promise[_0x896b('0x50')]()[_0x896b('0x51')](function(){return parseModelFields(_0xc7c284,_0x4b2202);})[_0x896b('0x51')](function(_0x5818ab){_0x265a7f[_0x896b('0x52')][_0x896b('0x44')](_0x5818ab);return parseTagParameter(_0xc7c284[_0x896b('0x53')]);})[_0x896b('0x51')](function(_0x60ae2e){_0x265a7f[_0x896b('0x45')]['clause'][_0x896b('0x44')](_0x60ae2e);return parseSearchFilter(_0xc7c284[_0x896b('0x54')]);})[_0x896b('0x51')](function(_0x55c302){_0x265a7f['filter']=_0x55c302;return _0x265a7f;});}function checkListsRestrictions(_0x121108,_0x32f7f4,_0x3139d1){var _0x246d35=squel[_0x896b('0x24')]();return Promise[_0x896b('0x50')]()[_0x896b('0x51')](function(){if(_0x32f7f4[_0x896b('0x5')]&&_0x121108[_0x896b('0x3')]===_0x896b('0x4')&&!_0x3139d1){return _0x121108[_0x896b('0x55')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4b102c){if(_0x4b102c){if(_0x4b102c[_0x896b('0x35')]===0x0){_0x246d35[_0x896b('0x44')](_0x896b('0x56'));}else{_0x246d35[_0x896b('0x44')](_0x896b('0x4d'),_[_0x896b('0x42')](_0x4b102c,'id'));}}})[_0x896b('0x51')](function(){return _0x246d35;});}function buildContactsQuery(_0x931546,_0x11e346,_0x48978c,_0x5ea751,_0x84a255,_0x4dda22){if(_0x11e346){_0x11e346=_0x48978c[_0x896b('0x57')];}_0x931546=addFieldsToQuery(_0x931546,_0x11e346,_0x5ea751,_0x4dda22,!![]);var _0xc1797d=squel[_0x896b('0x9')]();_0xc1797d=addFieldsToQuery(_0xc1797d,_0x11e346,_0x5ea751,_0x4dda22,![]);if(_0x5ea751||_0x4dda22){_0x931546=applyJoinClauses(_0x931546,!![]);_0x931546[_0x896b('0x58')]('c.id');if(_0x48978c['limit']){_0xc1797d[_0x896b('0x59')](_0x48978c['limit']);}if(_0x48978c[_0x896b('0x5a')]){_0xc1797d['offset'](_0x48978c['offset']);}}else{_0xc1797d=applyJoinClauses(_0xc1797d,![]);_0xc1797d[_0x896b('0x58')](_0x896b('0x5b'));if(_0x48978c[_0x896b('0x59')]){_0x931546[_0x896b('0x59')](_0x48978c[_0x896b('0x59')]);}if(_0x48978c[_0x896b('0x5a')]){_0x931546[_0x896b('0x5a')](_0x48978c[_0x896b('0x5a')]);}}_0xc1797d[_0x896b('0x5c')](_0x84a255);if(_0x48978c['order']){_0x48978c[_0x896b('0x5d')][_0x896b('0x26')](function(_0x1513b6){_0x931546['order']('c.'+_0x1513b6[0x0],_0x1513b6[0x1]===_0x896b('0x5e')?![]:!![]);_0xc1797d['order']('subqry.'+_0x1513b6[0x0],_0x1513b6[0x1]===_0x896b('0x5e')?![]:!![]);});}_0xc1797d[_0x896b('0xa')](_0x931546,'subqry');return _0xc1797d;}function getFilteredContacts(_0x3590d2){var _0x16671f=[];return db[_0x896b('0x41')][_0x896b('0x5f')]({'attributes':['id',_0x896b('0x38'),_0x896b('0x60')],'raw':!![]})[_0x896b('0x51')](function(_0x34f5fa){_0x16671f=_[_0x896b('0x61')](_0x34f5fa,'id');var _0x5d4177={'type':db[_0x896b('0x62')][_0x896b('0x63')][_0x896b('0x64')],'model':db[_0x896b('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x896b('0x66')][_0x896b('0x67')](_0x3590d2['toString'](),_0x5d4177);})[_0x896b('0x51')](function(_0x5aec38){_0x5aec38[_0x896b('0x26')](function(_0xf84b8b){if(_0xf84b8b['TagIds']){_0xf84b8b[_0x896b('0x68')]=[];_0xf84b8b['TagIds']['split'](',')[_0x896b('0x26')](function(_0x36f9ea){_0xf84b8b[_0x896b('0x68')][_0x896b('0x21')](_0x16671f[_0x36f9ea]);});}delete _0xf84b8b['TagIds'];});return _0x5aec38;});}function countFilteredContacts(_0x52fce3,_0x37212b){var _0x5d26a4=_0x52fce3[_0x896b('0x69')]();_0x5d26a4[_0x896b('0x22')](_0x896b('0x6a'));_0x5d26a4=applyJoinClauses(_0x5d26a4,!![]);_0x52fce3[_0x896b('0x58')]('c.id');var _0x421589=utils[_0x896b('0x25')](_0x37212b);if(!_['isEmpty'](_0x421589)){_0x5d26a4[_0x896b('0x6b')](_0x896b('0x6c'),_0x421589);}var _0x100478={'type':db['Sequelize'][_0x896b('0x63')][_0x896b('0x64')],'raw':!![]};return db[_0x896b('0x66')][_0x896b('0x67')](_0x5d26a4[_0x896b('0x6d')](),_0x100478)['then'](function(_0x597591){return _0x597591[0x0][_0x896b('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f24be17..8fb40fc 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 _0x8dec=['filter','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','final','end','close','unlink','decryptFile','createWriteStream','createDecipher','secret','utf8','base64','decryptString','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers'];(function(_0x46914a,_0x16fe5f){var _0x520c41=function(_0x3c6142){while(--_0x3c6142){_0x46914a['push'](_0x46914a['shift']());}};_0x520c41(++_0x16fe5f);}(_0x8dec,0x9c));var _0xc8de=function(_0x50d94a,_0x4bb055){_0x50d94a=_0x50d94a-0x0;var _0x4b88ec=_0x8dec[_0x50d94a];return _0x4b88ec;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc8de('0x0'));var _=require(_0xc8de('0x1'));var config=require('../../config/environment');var logger=require(_0xc8de('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc8de('0x3')][_0xc8de('0x4')],'algorithm':_0xc8de('0x5')};const fileOptions={'algorithm':_0xc8de('0x6')};if(config[_0xc8de('0x7')]&&config[_0xc8de('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xc8de('0x7')][_0xc8de('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xc8de('0x7')][_0xc8de('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc8de('0x9')](',\x20');logger[_0xc8de('0xa')](config[_0xc8de('0x7')][_0xc8de('0x8')],_0xc8de('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x5de509){return AES_SUPPORTED_RX[_0xc8de('0xc')](_0x5de509);}function getSupportedCiphers(){return crypto[_0xc8de('0xd')]()[_0xc8de('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x219dae){return getSupportedCiphers()['indexOf'](_0x219dae)>-0x1;}function combineOptions(_0x118b06){var _0x5416f5={};for(var _0x1af03e in fileOptions){if(fileOptions[_0xc8de('0xf')](_0x1af03e)){_0x5416f5[_0x1af03e]=fileOptions[_0x1af03e];}}if(_0x118b06){for(var _0x4b4df6 in _0x118b06){if(_0x118b06[_0xc8de('0xf')](_0x4b4df6)){_0x5416f5[_0x4b4df6]=_0x118b06[_0x4b4df6];}}}return _0x5416f5;}exports[_0xc8de('0x10')]=function(_0x4977a9,_0x465a2d,_0x91f5d8,_0x318e6e){return new BPromise(function(_0xf05c68,_0x2833b2){_0x318e6e=combineOptions(_0x318e6e);var _0x30a3b7=new Buffer(_0x91f5d8);var _0x155b17=fs[_0xc8de('0x11')](_0x4977a9);var _0x4f4f21=fs['createWriteStream'](_0x465a2d);var _0x1e8771=crypto[_0xc8de('0x12')](_0x318e6e[_0xc8de('0x8')],_0x30a3b7);_0x155b17['on'](_0xc8de('0x13'),function(_0xcb8563){var _0x5dccb8=new Buffer(_0x1e8771[_0xc8de('0x14')](_0xcb8563),_0xc8de('0x15'));_0x4f4f21[_0xc8de('0x16')](_0x5dccb8);});_0x155b17['on']('end',function(){try{var _0x31f4ec=new Buffer(_0x1e8771[_0xc8de('0x17')](_0xc8de('0x15')),_0xc8de('0x15'));_0x4f4f21[_0xc8de('0x16')](_0x31f4ec);_0x4f4f21[_0xc8de('0x18')]();_0x4f4f21['on'](_0xc8de('0x19'),function(){return _0xf05c68(_0x465a2d);});}catch(_0x1a4a20){fs[_0xc8de('0x1a')](_0x465a2d);return _0x2833b2(_0x1a4a20);}});});};exports[_0xc8de('0x1b')]=function(_0x1755f,_0x279134,_0x4e2fde,_0x29ed2e){return new BPromise(function(_0x1f0a8a,_0x363378){_0x29ed2e=combineOptions(_0x29ed2e);var _0x26fd5a=new Buffer(_0x4e2fde);var _0x42b293=fs[_0xc8de('0x11')](_0x1755f);var _0x1e633b=fs[_0xc8de('0x1c')](_0x279134);var _0x31726b=crypto[_0xc8de('0x1d')](_0x29ed2e[_0xc8de('0x8')],_0x26fd5a);_0x42b293['on'](_0xc8de('0x13'),function(_0x2114e6){var _0x25d2af=new Buffer(_0x31726b[_0xc8de('0x14')](_0x2114e6),'binary');_0x1e633b[_0xc8de('0x16')](_0x25d2af);});_0x42b293['on']('end',function(){try{var _0x2c9519=new Buffer(_0x31726b['final'](_0xc8de('0x15')),'binary');_0x1e633b['write'](_0x2c9519);_0x1e633b[_0xc8de('0x18')]();_0x1e633b['on'](_0xc8de('0x19'),function(){return _0x1f0a8a(_0x279134);});}catch(_0x5525a1){fs[_0xc8de('0x1a')](_0x279134);return _0x363378(_0x5525a1);}});});};exports['encryptString']=function(_0x37916e,_0x5d5127,_0x508c74){var _0x57b58e=_0x508c74||stringOptions['algorithm'];var _0x313032=_0x5d5127||stringOptions[_0xc8de('0x1e')];var _0x215c90=crypto[_0xc8de('0x12')](_0x57b58e,_0x313032);var _0x1dfe80=_0x215c90['update'](_0x37916e,_0xc8de('0x1f'),_0xc8de('0x20'));_0x1dfe80+=_0x215c90['final']('base64');return _0x1dfe80;};exports[_0xc8de('0x21')]=function(_0x4d53f6,_0x4e5202,_0x20709c){var _0x522761=_0x20709c||stringOptions[_0xc8de('0x8')];var _0x30233c=_0x4e5202||stringOptions['secret'];var _0x1888ad=crypto[_0xc8de('0x1d')](_0x522761,_0x30233c);var _0x421c85=_0x1888ad[_0xc8de('0x14')](_0x4d53f6,_0xc8de('0x20'),_0xc8de('0x1f'));_0x421c85+=_0x1888ad[_0xc8de('0x17')](_0xc8de('0x1f'));return _0x421c85;}; \ No newline at end of file +var _0x33c8=['createWriteStream','createCipher','data','write','end','final','binary','close','unlink','createDecipher','update','secret','utf8','base64','decryptString','crypto','lodash','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x33c8,0x18f));var _0x833c=function(_0xf68caf,_0x3de0d5){_0xf68caf=_0xf68caf-0x0;var _0x1f48af=_0x33c8[_0xf68caf];return _0x1f48af;};'use strict';var crypto=require(_0x833c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x833c('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x833c('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x833c('0x3')][_0x833c('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x833c('0x5')};if(config[_0x833c('0x6')]&&config[_0x833c('0x6')][_0x833c('0x7')]){var isSupported=isAlgorithmSupported(config[_0x833c('0x6')][_0x833c('0x7')]);if(isSupported){fileOptions[_0x833c('0x7')]=config['encrypt'][_0x833c('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x833c('0x8')](',\x20');logger[_0x833c('0x9')](config[_0x833c('0x6')]['algorithm'],_0x833c('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4cd54f){return AES_SUPPORTED_RX['test'](_0x4cd54f);}function getSupportedCiphers(){return crypto[_0x833c('0xb')]()[_0x833c('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x552ddd){return getSupportedCiphers()[_0x833c('0xd')](_0x552ddd)>-0x1;}function combineOptions(_0xa51d52){var _0xa7d73b={};for(var _0x1d3025 in fileOptions){if(fileOptions[_0x833c('0xe')](_0x1d3025)){_0xa7d73b[_0x1d3025]=fileOptions[_0x1d3025];}}if(_0xa51d52){for(var _0x5e265a in _0xa51d52){if(_0xa51d52[_0x833c('0xe')](_0x5e265a)){_0xa7d73b[_0x5e265a]=_0xa51d52[_0x5e265a];}}}return _0xa7d73b;}exports[_0x833c('0xf')]=function(_0x441bd5,_0x2577aa,_0x318c77,_0x5253a6){return new BPromise(function(_0x10f09a,_0x13506e){_0x5253a6=combineOptions(_0x5253a6);var _0x2ae6db=new Buffer(_0x318c77);var _0x39b255=fs[_0x833c('0x10')](_0x441bd5);var _0x2bed60=fs[_0x833c('0x11')](_0x2577aa);var _0x3d6ff6=crypto[_0x833c('0x12')](_0x5253a6[_0x833c('0x7')],_0x2ae6db);_0x39b255['on'](_0x833c('0x13'),function(_0x3c21e1){var _0x5063f8=new Buffer(_0x3d6ff6['update'](_0x3c21e1),'binary');_0x2bed60[_0x833c('0x14')](_0x5063f8);});_0x39b255['on'](_0x833c('0x15'),function(){try{var _0x18736b=new Buffer(_0x3d6ff6[_0x833c('0x16')](_0x833c('0x17')),_0x833c('0x17'));_0x2bed60['write'](_0x18736b);_0x2bed60['end']();_0x2bed60['on'](_0x833c('0x18'),function(){return _0x10f09a(_0x2577aa);});}catch(_0x55993b){fs[_0x833c('0x19')](_0x2577aa);return _0x13506e(_0x55993b);}});});};exports['decryptFile']=function(_0x4fc7db,_0x26f8f7,_0x44b452,_0x31be72){return new BPromise(function(_0x1f8a33,_0x13ea5a){_0x31be72=combineOptions(_0x31be72);var _0x34e393=new Buffer(_0x44b452);var _0x10f205=fs[_0x833c('0x10')](_0x4fc7db);var _0x4070ab=fs[_0x833c('0x11')](_0x26f8f7);var _0x4c4c65=crypto[_0x833c('0x1a')](_0x31be72[_0x833c('0x7')],_0x34e393);_0x10f205['on'](_0x833c('0x13'),function(_0x5c5136){var _0x233614=new Buffer(_0x4c4c65[_0x833c('0x1b')](_0x5c5136),'binary');_0x4070ab[_0x833c('0x14')](_0x233614);});_0x10f205['on'](_0x833c('0x15'),function(){try{var _0x1cd85f=new Buffer(_0x4c4c65[_0x833c('0x16')](_0x833c('0x17')),'binary');_0x4070ab[_0x833c('0x14')](_0x1cd85f);_0x4070ab[_0x833c('0x15')]();_0x4070ab['on']('close',function(){return _0x1f8a33(_0x26f8f7);});}catch(_0x3ab125){fs[_0x833c('0x19')](_0x26f8f7);return _0x13ea5a(_0x3ab125);}});});};exports['encryptString']=function(_0x318c5e,_0xfcb346,_0x5e682b){var _0x347ebb=_0x5e682b||stringOptions[_0x833c('0x7')];var _0x419339=_0xfcb346||stringOptions[_0x833c('0x1c')];var _0x297bba=crypto[_0x833c('0x12')](_0x347ebb,_0x419339);var _0x2757c4=_0x297bba[_0x833c('0x1b')](_0x318c5e,_0x833c('0x1d'),_0x833c('0x1e'));_0x2757c4+=_0x297bba['final']('base64');return _0x2757c4;};exports[_0x833c('0x1f')]=function(_0x1903f0,_0x58ac9f,_0x2cd4b7){var _0x44a8fb=_0x2cd4b7||stringOptions[_0x833c('0x7')];var _0x12be36=_0x58ac9f||stringOptions[_0x833c('0x1c')];var _0x3d9365=crypto['createDecipher'](_0x44a8fb,_0x12be36);var _0x5d915e=_0x3d9365[_0x833c('0x1b')](_0x1903f0,_0x833c('0x1e'),'utf8');_0x5d915e+=_0x3d9365[_0x833c('0x16')](_0x833c('0x1d'));return _0x5d915e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ed7a124..d0d8c47 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 _0xf1b9=['Completed','zip','catch','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','argv','savename','AnalyticExtractedReport','info','CSV','Setting','find','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','Empty','length','range','isInteger','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','.csv','join','%s%d.%s','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x5f5b65,_0x3c0ad4){var _0x264057=function(_0x56175d){while(--_0x56175d){_0x5f5b65['push'](_0x5f5b65['shift']());}};_0x264057(++_0x3c0ad4);}(_0xf1b9,0x151));var _0x9f1b=function(_0x957133,_0x2b75fc){_0x957133=_0x957133-0x0;var _0x4cac53=_0xf1b9[_0x957133];return _0x4cac53;};'use strict';var util=require(_0x9f1b('0x0'));var path=require(_0x9f1b('0x1'));var _=require('lodash');var csv=require(_0x9f1b('0x2'));var fs=require('fs');var BPromise=require(_0x9f1b('0x3'));var zipdir=require(_0x9f1b('0x4'));var rimraf=require(_0x9f1b('0x5'));var db=require(_0x9f1b('0x6'))['db'];var dbH=require(_0x9f1b('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9f1b('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9f1b('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1e7362,_0x220276){var _0x31c848={'status':_0x1e7362};var _0x44bae3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x220276){_0x31c848[_0x9f1b('0x8')]=_0x220276;}return db[_0x9f1b('0x9')]['update'](_0x31c848,_0x44bae3);}function main(){var _0x126d93=0x1388;var _0x4966cb;logger[_0x9f1b('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9f1b('0xb')));return db[_0x9f1b('0xc')][_0x9f1b('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9f1b('0xe'),_0x9f1b('0xf')]})['then'](function(_0x1cf40a){if(_0x1cf40a){_0x4966cb=_0x1cf40a;_0x126d93=_0x4966cb[_0x9f1b('0xf')]||0x1388;}})[_0x9f1b('0x10')](function(){return dbH['sequelize'][_0x9f1b('0x11')](util[_0x9f1b('0x12')](_0x9f1b('0x13'),QUERY),{'type':dbH[_0x9f1b('0x14')]['QueryTypes'][_0x9f1b('0x15')]});})[_0x9f1b('0x10')](function(_0x4e8904){if(!_0x4e8904[0x0]['num']){return analyticExtractedReport(_0x9f1b('0x16'));}var _0x544df7=[];var _0x503c61=0x0;if(_0x4966cb['split']){if(_0x4e8904&&_0x4e8904[_0x9f1b('0x17')]){var _0x5185cb=_[_0x9f1b('0x18')](_0x4e8904[0x0]['num']/_0x126d93);var _0x1b8d85=Number[_0x9f1b('0x19')](_0x4e8904[0x0][_0x9f1b('0x1a')]/_0x126d93)?_0x4e8904[0x0][_0x9f1b('0x1a')]%_0x126d93:0x0;_0x5185cb[_0x9f1b('0x1b')](function(_0x18655f){if(_0x18655f>0x0){_0x503c61+=_0x126d93;}_0x544df7['push'](dbH[_0x9f1b('0x14')][_0x9f1b('0x11')](util[_0x9f1b('0x12')](_0x9f1b('0x1c'),QUERY,_0x126d93,_0x503c61),{'type':dbH[_0x9f1b('0x14')][_0x9f1b('0x1d')][_0x9f1b('0x15')]}));});if(_0x1b8d85>0x0){_0x503c61+=_0x126d93;_0x544df7['push'](dbH['sequelize'][_0x9f1b('0x11')](util[_0x9f1b('0x12')](_0x9f1b('0x1c'),QUERY,_0x1b8d85,_0x503c61),{'type':dbH[_0x9f1b('0x14')]['QueryTypes'][_0x9f1b('0x15')]}));}}}else{_0x544df7[_0x9f1b('0x1e')](dbH[_0x9f1b('0x14')][_0x9f1b('0x11')](QUERY,{'type':dbH[_0x9f1b('0x14')][_0x9f1b('0x1d')]['SELECT']}));}var _0x2ce2c1=path[_0x9f1b('0x1f')](PATH);var _0x2bf2b1=path['basename'](PATH,_0x9f1b('0x20'));var _0x395770=_0x4966cb[_0x9f1b('0xe')]&&_0x544df7[_0x9f1b('0x17')]>0x1;var _0x23824b=[];if(!fs['existsSync'](path[_0x9f1b('0x21')](_0x2ce2c1,_0x2bf2b1))&&_0x395770){fs['mkdirSync'](path['join'](_0x2ce2c1,_0x2bf2b1));}return BPromise['each'](_0x544df7,function(_0x25e578){_0x23824b[_0x9f1b('0x1e')](_0x25e578);})['then'](function(){for(var _0x290e5e=0x0;_0x290e5e<_0x23824b['length'];_0x290e5e+=0x1){var _0x1ef0ed;var _0x28ba36=_0x23824b[_0x290e5e];if(_0x395770){_0x1ef0ed=path[_0x9f1b('0x21')](_0x2ce2c1,_0x2bf2b1,util['format'](_0x9f1b('0x22'),_0x2bf2b1,_0x290e5e,_0x9f1b('0x23')));}else{_0x1ef0ed=path['join'](_0x2ce2c1,util[_0x9f1b('0x12')](_0x9f1b('0x24'),_0x2bf2b1,_0x9f1b('0x23')));}fs['writeFileSync'](_0x1ef0ed,csv(_0x28ba36));}})[_0x9f1b('0x10')](function(){if(_0x395770){return new Promise(function(_0x210325){zipdir(path[_0x9f1b('0x21')](_0x2ce2c1,_0x2bf2b1),{'saveTo':path[_0x9f1b('0x21')](_0x2ce2c1,util[_0x9f1b('0x12')]('%s.%s',_0x2bf2b1,'zip'))},function(_0x348da3,_0x31a5f9){rimraf(path[_0x9f1b('0x21')](_0x2ce2c1,_0x2bf2b1),function(){});_0x210325(_0x9f1b('0x25'));});});}})[_0x9f1b('0x10')](function(){logger[_0x9f1b('0xa')](util[_0x9f1b('0x12')](_0x9f1b('0x26'),EXTRACTED_REPORT_ID,_0x9f1b('0xb')));return analyticExtractedReport(_0x9f1b('0x27'),_0x395770?util[_0x9f1b('0x12')]('%s.%s',_0x2bf2b1,_0x395770?_0x9f1b('0x28'):_0x9f1b('0x23')):null);});})[_0x9f1b('0x29')](function(_0x68718e){logger['info'](util[_0x9f1b('0x12')](_0x9f1b('0x2a'),EXTRACTED_REPORT_ID,_0x9f1b('0xb')),util[_0x9f1b('0x2b')](_0x68718e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9f1b('0x2c'));})[_0x9f1b('0x2d')](function(){process[_0x9f1b('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x27eb=['%s%d.%s','%s.%s','csv','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT','num','Empty','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','length'];(function(_0x157f56,_0x2f6e64){var _0x4bd40f=function(_0x3e0083){while(--_0x3e0083){_0x157f56['push'](_0x157f56['shift']());}};_0x4bd40f(++_0x2f6e64);}(_0x27eb,0xd3));var _0xb27e=function(_0x234606,_0x38306d){_0x234606=_0x234606-0x0;var _0x565687=_0x27eb[_0x234606];return _0x565687;};'use strict';var util=require('util');var path=require(_0xb27e('0x0'));var _=require(_0xb27e('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb27e('0x2'));var zipdir=require(_0xb27e('0x3'));var rimraf=require(_0xb27e('0x4'));var db=require(_0xb27e('0x5'))['db'];var dbH=require('../../mysqldb')[_0xb27e('0x6')];var logger=require(_0xb27e('0x7'))(_0xb27e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb27e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x55be3a,_0x15385f){var _0x14189b={'status':_0x55be3a};var _0x90ad1e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15385f){_0x14189b[_0xb27e('0xa')]=_0x15385f;}return db[_0xb27e('0xb')][_0xb27e('0xc')](_0x14189b,_0x90ad1e);}function main(){var _0x367c5e=0x1388;var _0xb5b38f;logger[_0xb27e('0xd')](util[_0xb27e('0xe')](_0xb27e('0xf'),EXTRACTED_REPORT_ID,_0xb27e('0x10')));return db[_0xb27e('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb27e('0x12'),_0xb27e('0x13')]})[_0xb27e('0x14')](function(_0x1ae1f8){if(_0x1ae1f8){_0xb5b38f=_0x1ae1f8;_0x367c5e=_0xb5b38f[_0xb27e('0x13')]||0x1388;}})['then'](function(){return dbH[_0xb27e('0x15')][_0xb27e('0x16')](util[_0xb27e('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb27e('0x15')]['QueryTypes'][_0xb27e('0x17')]});})[_0xb27e('0x14')](function(_0x31be9b){if(!_0x31be9b[0x0][_0xb27e('0x18')]){return analyticExtractedReport(_0xb27e('0x19'));}var _0x1cd269=[];var _0x223bf1=0x0;if(_0xb5b38f['split']){if(_0x31be9b&&_0x31be9b['length']){var _0x5420ac=_[_0xb27e('0x1a')](_0x31be9b[0x0]['num']/_0x367c5e);var _0x226772=Number[_0xb27e('0x1b')](_0x31be9b[0x0][_0xb27e('0x18')]/_0x367c5e)?_0x31be9b[0x0]['num']%_0x367c5e:0x0;_0x5420ac['forEach'](function(_0x26a8a1){if(_0x26a8a1>0x0){_0x223bf1+=_0x367c5e;}_0x1cd269['push'](dbH[_0xb27e('0x15')][_0xb27e('0x16')](util[_0xb27e('0xe')](_0xb27e('0x1c'),QUERY,_0x367c5e,_0x223bf1),{'type':dbH[_0xb27e('0x15')][_0xb27e('0x1d')][_0xb27e('0x17')]}));});if(_0x226772>0x0){_0x223bf1+=_0x367c5e;_0x1cd269[_0xb27e('0x1e')](dbH[_0xb27e('0x15')][_0xb27e('0x16')](util[_0xb27e('0xe')](_0xb27e('0x1c'),QUERY,_0x226772,_0x223bf1),{'type':dbH[_0xb27e('0x15')][_0xb27e('0x1d')]['SELECT']}));}}}else{_0x1cd269[_0xb27e('0x1e')](dbH['sequelize'][_0xb27e('0x16')](QUERY,{'type':dbH[_0xb27e('0x15')]['QueryTypes']['SELECT']}));}var _0x5fb28e=path[_0xb27e('0x1f')](PATH);var _0xf103e3=path[_0xb27e('0x20')](PATH,_0xb27e('0x21'));var _0x4d1bc9=_0xb5b38f[_0xb27e('0x12')]&&_0x1cd269['length']>0x1;var _0xa9e7b9=[];if(!fs[_0xb27e('0x22')](path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3))&&_0x4d1bc9){fs[_0xb27e('0x24')](path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3));}return BPromise[_0xb27e('0x25')](_0x1cd269,function(_0x53ad10){_0xa9e7b9[_0xb27e('0x1e')](_0x53ad10);})[_0xb27e('0x14')](function(){for(var _0x470cb2=0x0;_0x470cb2<_0xa9e7b9[_0xb27e('0x26')];_0x470cb2+=0x1){var _0x52a47e;var _0x471939=_0xa9e7b9[_0x470cb2];if(_0x4d1bc9){_0x52a47e=path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3,util[_0xb27e('0xe')](_0xb27e('0x27'),_0xf103e3,_0x470cb2,'csv'));}else{_0x52a47e=path[_0xb27e('0x23')](_0x5fb28e,util[_0xb27e('0xe')](_0xb27e('0x28'),_0xf103e3,_0xb27e('0x29')));}fs['writeFileSync'](_0x52a47e,csv(_0x471939));}})[_0xb27e('0x14')](function(){if(_0x4d1bc9){return new Promise(function(_0x53908d){zipdir(path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3),{'saveTo':path[_0xb27e('0x23')](_0x5fb28e,util[_0xb27e('0xe')](_0xb27e('0x28'),_0xf103e3,_0xb27e('0x2a')))},function(_0x5c900f,_0x439ed9){rimraf(path[_0xb27e('0x23')](_0x5fb28e,_0xf103e3),function(){});_0x53908d(_0xb27e('0x2b'));});});}})[_0xb27e('0x14')](function(){logger[_0xb27e('0xd')](util[_0xb27e('0xe')](_0xb27e('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x4d1bc9?util[_0xb27e('0xe')](_0xb27e('0x28'),_0xf103e3,_0x4d1bc9?_0xb27e('0x2a'):'csv'):null);});})[_0xb27e('0x2d')](function(_0x20b1bf){logger[_0xb27e('0xd')](util[_0xb27e('0xe')](_0xb27e('0x2e'),EXTRACTED_REPORT_ID,_0xb27e('0x10')),util[_0xb27e('0x2f')](_0x20b1bf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb27e('0x30')](function(){process[_0xb27e('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 53b688c..00beb3b 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 _0x0fae=['center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','analytics','argv','update','map','tableHeader','toString','value','auto','body','push','concat','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','header','before','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting','find','split','splitSizePdf','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','join','mkdirSync','each','then','flatten','createPdfKitDocument','pdf','all','zip','zip\x20finished','info','%s.%s','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0fae,0x111));var _0xe0fa=function(_0xb32f1d,_0x4cbd63){_0xb32f1d=_0xb32f1d-0x0;var _0x31d076=_0x0fae[_0xb32f1d];return _0x31d076;};'use strict';var _=require(_0xe0fa('0x0'));var fs=require('fs');var util=require(_0xe0fa('0x1'));var path=require(_0xe0fa('0x2'));var moment=require(_0xe0fa('0x3'));var htmlToPdfmake=require(_0xe0fa('0x4'));var PdfPrinter=require(_0xe0fa('0x5'));var zipdir=require(_0xe0fa('0x6'));var rimraf=require(_0xe0fa('0x7'));var JSDOM=require(_0xe0fa('0x8'))[_0xe0fa('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0xe0fa('0xa'));var db=require(_0xe0fa('0xb'))['db'];var dbH=require(_0xe0fa('0xb'))[_0xe0fa('0xc')];var logger=require('../../config/logger')(_0xe0fa('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xe0fa('0xe')][0x2]);var QUERY=process[_0xe0fa('0xe')][0x3];var PATH=process[_0xe0fa('0xe')][0x4];var NAME=process[_0xe0fa('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3966c7,_0x17045e){var _0x27d699={'status':_0x3966c7};var _0x51e81c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17045e){_0x27d699['savename']=_0x17045e;}return db['AnalyticExtractedReport'][_0xe0fa('0xf')](_0x27d699,_0x51e81c);}function getHeaders(_0x29a977){return _[_0xe0fa('0x10')](_0x29a977,function(_0x194179){return{'text':_0x194179,'style':_0xe0fa('0x11')};});}function getRows(_0x120023,_0x83cc2f){return _[_0xe0fa('0x10')](_0x83cc2f,function(_0x13ffc8){return _(_0x13ffc8)['pick'](_0x120023)[_0xe0fa('0x10')](function(_0x562b9a){return _0x562b9a?_[_0xe0fa('0x12')](_0x562b9a):'';})[_0xe0fa('0x13')]();});}function createTable(_0x4e2b40,_0x2011e7){var _0x4b6050={'widths':_['fill'](Array(_0x4e2b40['length']),0x91),'heights':function(_0x4b2865){return _0x4b2865===0x0?_0xe0fa('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f0f50=getHeaders(_0x4e2b40);_0x4b6050[_0xe0fa('0x15')][_0xe0fa('0x16')](_0x4f0f50);var _0x5e77df=getRows(_0x4e2b40,_0x2011e7);_0x4b6050[_0xe0fa('0x15')]=_0x4b6050[_0xe0fa('0x15')][_0xe0fa('0x17')](_0x5e77df);return _0x4b6050;}function createTables(_0x3f304e){var _0x19f175=[];var _0x29b46b=_['chunk'](Object[_0xe0fa('0x18')](_0x3f304e[0x0]),0x5);_0x29b46b[_0xe0fa('0x19')](function(_0x377f9f){_0x19f175[_0xe0fa('0x16')](createTable(_0x377f9f,_0x3f304e));});return _0x19f175;}function getPDFDocDefinition(_0x582d92){var _0x1a7747=util['format'](_0xe0fa('0x1a'),NAME,EXTRACTED_REPORT[_0xe0fa('0x1b')],moment(EXTRACTED_REPORT[_0xe0fa('0x1c')])[_0xe0fa('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xe0fa('0x1e')])[_0xe0fa('0x1d')](FORMAT));var _0x55c884=[];for(var _0xbda9d8=0x0;_0xbda9d8<_0x582d92[_0xe0fa('0x1f')];_0xbda9d8++){var _0x1965b6=[];if(_0xbda9d8===0x0){_0x1965b6[_0xe0fa('0x16')]({'text':_0x1a7747,'style':_0xe0fa('0x20')});}var _0x181a21={'table':_0x582d92[_0xbda9d8]};if(_0xbda9d8>0x0){_0x181a21['pageBreak']=_0xe0fa('0x21');_0x181a21['margin']=[0x0,0x46,0x0,0x0];}_0x1965b6[_0xe0fa('0x16')](_0x181a21);_0x55c884[_0xe0fa('0x16')](_0x1965b6);}return{'pageSize':'A4','pageOrientation':_0xe0fa('0x22'),'content':_0x55c884,'footer':function(_0x2e9787,_0x12f316){return{'text':_0x2e9787[_0xe0fa('0x12')]()+_0xe0fa('0x23')+_0x12f316,'style':_0xe0fa('0x24')};},'defaultStyle':{'font':_0xe0fa('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe0fa('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x26f37a){var _0x231945=0x1388;var _0x3d068;if(!_0x26f37a[0x0][_0xe0fa('0x27')]){return analyticExtractedReport(_0xe0fa('0x28'));}return db[_0xe0fa('0x29')][_0xe0fa('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe0fa('0x2b'),_0xe0fa('0x2c')]})['then'](function(_0x3fb804){if(_0x3fb804){_0x3d068=_0x3fb804;_0x231945=_0x3d068[_0xe0fa('0x2c')]||0x3e8;}})['then'](function(){var _0x39577b=[];var _0x7860ef=0x0;if(_0x3d068[_0xe0fa('0x2b')]){if(_0x26f37a&&_0x26f37a[_0xe0fa('0x1f')]){var _0x51e927=_['range'](_0x26f37a[0x0]['num']/_0x231945);var _0x312415=Number[_0xe0fa('0x2d')](_0x26f37a[0x0]['num']/_0x231945)?_0x26f37a[0x0][_0xe0fa('0x27')]%_0x231945:0x0;_0x51e927[_0xe0fa('0x19')](function(_0x2c09bd){if(_0x2c09bd>0x0){_0x7860ef+=_0x231945;}_0x39577b[_0xe0fa('0x16')](dbH[_0xe0fa('0x2e')][_0xe0fa('0x2f')](util[_0xe0fa('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x231945,_0x7860ef),{'type':dbH['sequelize'][_0xe0fa('0x30')][_0xe0fa('0x31')]}));});if(_0x312415>0x0){_0x7860ef+=_0x231945;_0x39577b[_0xe0fa('0x16')](dbH[_0xe0fa('0x2e')]['query'](util[_0xe0fa('0x1d')](_0xe0fa('0x32'),QUERY,_0x312415,_0x7860ef),{'type':dbH['sequelize'][_0xe0fa('0x30')][_0xe0fa('0x31')]}));}}}else{_0x39577b[_0xe0fa('0x16')](dbH[_0xe0fa('0x2e')]['query'](QUERY,{'type':dbH[_0xe0fa('0x2e')][_0xe0fa('0x30')][_0xe0fa('0x31')]}));}var _0x4a3bf4=path[_0xe0fa('0x33')](PATH);var _0xeb707f=path[_0xe0fa('0x34')](PATH,_0xe0fa('0x35'));var _0x3d55f9=_0x3d068[_0xe0fa('0x2b')]&&_0x39577b[_0xe0fa('0x1f')]>0x1;var _0x547861=[];if(!fs['existsSync'](path[_0xe0fa('0x36')](_0x4a3bf4,_0xeb707f))&&_0x3d55f9){fs[_0xe0fa('0x37')](path['join'](_0x4a3bf4,_0xeb707f));}return BPromise[_0xe0fa('0x38')](_0x39577b,function(_0x208f8c){_0x547861[_0xe0fa('0x16')](_0x208f8c);})[_0xe0fa('0x39')](function(){var _0x5ee28b=[];for(var _0x3f864e=0x0;_0x3f864e<_0x547861['length'];_0x3f864e+=0x1){var _0x462329=_0x547861[_0x3f864e];var _0x56c5da=createTables(_[_0xe0fa('0x3a')](_0x462329));var _0x2c39c6;var _0x3610be=getPDFDocDefinition(_0x56c5da);var _0x392701=getPDFPrinter();var _0x64846=_0x392701[_0xe0fa('0x3b')](_0x3610be);if(_0x3d55f9){_0x2c39c6=path['join'](_0x4a3bf4,_0xeb707f,util[_0xe0fa('0x1d')]('%s%d.%s',_0xeb707f,_0x3f864e,_0xe0fa('0x3c')));}else{_0x2c39c6=path[_0xe0fa('0x36')](_0x4a3bf4,util['format']('%s.%s',_0xeb707f,'pdf'));}_0x5ee28b['push'](writePDFDocument(_0x64846,_0x2c39c6));}return Promise[_0xe0fa('0x3d')](_0x5ee28b);})[_0xe0fa('0x39')](function(){if(_0x3d55f9){return new Promise(function(_0x2edab4){zipdir(path[_0xe0fa('0x36')](_0x4a3bf4,_0xeb707f),{'saveTo':path[_0xe0fa('0x36')](_0x4a3bf4,util[_0xe0fa('0x1d')]('%s.%s',_0xeb707f,_0xe0fa('0x3e')))},function(){rimraf(path[_0xe0fa('0x36')](_0x4a3bf4,_0xeb707f),function(){});_0x2edab4(_0xe0fa('0x3f'));});});}})[_0xe0fa('0x39')](function(){if(!_0x3d55f9)return;rimraf(path['join'](_0x4a3bf4,_0xeb707f),function(){});})['then'](function(){logger[_0xe0fa('0x40')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x3d55f9?util[_0xe0fa('0x1d')](_0xe0fa('0x41'),_0xeb707f,_0x3d55f9?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe0fa('0x40')](util[_0xe0fa('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe0fa('0x42')));return db[_0xe0fa('0x43')][_0xe0fa('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe0fa('0x39')](function(_0x294492){EXTRACTED_REPORT=_0x294492;return dbH[_0xe0fa('0x2e')]['query'](util[_0xe0fa('0x1d')](_0xe0fa('0x45'),QUERY),{'type':dbH[_0xe0fa('0x2e')][_0xe0fa('0x30')]['SELECT']});})[_0xe0fa('0x39')](extractReport)[_0xe0fa('0x46')](function(_0x24f28f){logger[_0xe0fa('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe0fa('0x42')),util['inspect'](_0x24f28f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe0fa('0x47'));})[_0xe0fa('0x48')](function(){process[_0xe0fa('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5e3ad9=new PdfPrinter({'Arial':{'normal':__dirname+_0xe0fa('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xe0fa('0x4b')}});return _0x5e3ad9;}function getPDFDocDefinitionFromHTML(_0x12300b,_0x47be10){var _0x20a99f=util[_0xe0fa('0x1d')](_0xe0fa('0x4c'),_0x47be10[_0xe0fa('0x4d')],_0x47be10[_0xe0fa('0x4e')]);var _0x2eb063=moment()[_0xe0fa('0x1d')]('YYYY-MM-DD')[_0xe0fa('0x12')]();var _0x2aae94=htmlToPdfmake(_0x12300b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2aae94],'defaultStyle':{'font':_0xe0fa('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe0fa('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe0fa('0x4f')}},'header':function(){return[{'text':_0xe0fa('0x50'),'style':_0xe0fa('0x20')}];},'footer':function(_0x5d46ee,_0x4e2a4e){return[{'text':util[_0xe0fa('0x1d')](_0xe0fa('0x51'),_0x20a99f,_0x5d46ee,_0x4e2a4e,_0x2eb063),'style':_0xe0fa('0x24')}];}};}function writePDFDocument(_0x2495b9,_0x2c53d3){return new Promise(function(_0x4b1119,_0x1e2c18){var _0x54c98c=_0x2495b9[_0xe0fa('0x52')](fs[_0xe0fa('0x53')](_0x2c53d3));_0x54c98c['on'](_0xe0fa('0x54'),function(){_0x4b1119('finish');});_0x54c98c['on'](_0xe0fa('0x55'),function(_0x2673a2){_0x1e2c18(_0x2673a2);});_0x2495b9[_0xe0fa('0x56')]();});}exports[_0xe0fa('0x57')]=function(_0x2af9f4,_0x441f22){var _0x2393ff=getPDFPrinter();var _0x1d3c46=getPDFDocDefinitionFromHTML(_0x2af9f4,_0x441f22);var _0x4ef192=_0x2393ff[_0xe0fa('0x3b')](_0x1d3c46);return writePDFDocument(_0x4ef192,_0x441f22['path'])[_0xe0fa('0x46')](function(_0x1a4f1d){throw _0x1a4f1d;});}; \ No newline at end of file +var _0x1305=['createPdfFromHTML','catch','util','path','moment','pdfmake/src/printer','zip-dir','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','Empty','Setting','split','then','splitSizePdf','range','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','.pdf','existsSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end'];(function(_0x1145c8,_0x4fed40){var _0x3aabd5=function(_0x56c985){while(--_0x56c985){_0x1145c8['push'](_0x1145c8['shift']());}};_0x3aabd5(++_0x4fed40);}(_0x1305,0x176));var _0x5130=function(_0x258d72,_0x7b072a){_0x258d72=_0x258d72-0x0;var _0x4389b2=_0x1305[_0x258d72];return _0x4389b2;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x5130('0x0'));var path=require(_0x5130('0x1'));var moment=require(_0x5130('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5130('0x3'));var zipdir=require(_0x5130('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x5130('0x5'))['JSDOM'];var window=new JSDOM('')[_0x5130('0x6')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x5130('0x7'))[_0x5130('0x8')];var logger=require(_0x5130('0x9'))(_0x5130('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5130('0xb')][0x2]);var QUERY=process[_0x5130('0xb')][0x3];var PATH=process[_0x5130('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x5130('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x19e512,_0x3a6bf9){var _0x168c69={'status':_0x19e512};var _0x1b6d55={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a6bf9){_0x168c69[_0x5130('0xd')]=_0x3a6bf9;}return db['AnalyticExtractedReport'][_0x5130('0xe')](_0x168c69,_0x1b6d55);}function getHeaders(_0x9adc15){return _[_0x5130('0xf')](_0x9adc15,function(_0x33e3e8){return{'text':_0x33e3e8,'style':_0x5130('0x10')};});}function getRows(_0x528535,_0x1ae87a){return _['map'](_0x1ae87a,function(_0x12781b){return _(_0x12781b)[_0x5130('0x11')](_0x528535)[_0x5130('0xf')](function(_0x42cdd2){return _0x42cdd2?_[_0x5130('0x12')](_0x42cdd2):'';})[_0x5130('0x13')]();});}function createTable(_0x3c47e,_0x26d7bb){var _0x4e6efd={'widths':_[_0x5130('0x14')](Array(_0x3c47e[_0x5130('0x15')]),0x91),'heights':function(_0x1f2f42){return _0x1f2f42===0x0?_0x5130('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x38655b=getHeaders(_0x3c47e);_0x4e6efd['body']['push'](_0x38655b);var _0xf22027=getRows(_0x3c47e,_0x26d7bb);_0x4e6efd['body']=_0x4e6efd[_0x5130('0x17')][_0x5130('0x18')](_0xf22027);return _0x4e6efd;}function createTables(_0xed380d){var _0x2a90b5=[];var _0x43c7d9=_[_0x5130('0x19')](Object[_0x5130('0x1a')](_0xed380d[0x0]),0x5);_0x43c7d9[_0x5130('0x1b')](function(_0x151557){_0x2a90b5[_0x5130('0x1c')](createTable(_0x151557,_0xed380d));});return _0x2a90b5;}function getPDFDocDefinition(_0x59aa67){var _0x30d8ff=util[_0x5130('0x1d')](_0x5130('0x1e'),NAME,EXTRACTED_REPORT[_0x5130('0x1f')],moment(EXTRACTED_REPORT[_0x5130('0x20')])[_0x5130('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x5130('0x21')])[_0x5130('0x1d')](FORMAT));var _0x16e638=[];for(var _0xf5c98b=0x0;_0xf5c98b<_0x59aa67[_0x5130('0x15')];_0xf5c98b++){var _0x571ee6=[];if(_0xf5c98b===0x0){_0x571ee6[_0x5130('0x1c')]({'text':_0x30d8ff,'style':_0x5130('0x22')});}var _0x31b05d={'table':_0x59aa67[_0xf5c98b]};if(_0xf5c98b>0x0){_0x31b05d[_0x5130('0x23')]='before';_0x31b05d[_0x5130('0x24')]=[0x0,0x46,0x0,0x0];}_0x571ee6['push'](_0x31b05d);_0x16e638['push'](_0x571ee6);}return{'pageSize':'A4','pageOrientation':_0x5130('0x25'),'content':_0x16e638,'footer':function(_0xfc855e,_0x40cc32){return{'text':_0xfc855e['toString']()+_0x5130('0x26')+_0x40cc32,'style':_0x5130('0x27')};},'defaultStyle':{'font':_0x5130('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5130('0x29')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4f520a){var _0x139e16=0x1388;var _0x2fe059;if(!_0x4f520a[0x0]['num']){return analyticExtractedReport(_0x5130('0x2a'));}return db[_0x5130('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5130('0x2c'),'splitSizePdf']})[_0x5130('0x2d')](function(_0x233fa8){if(_0x233fa8){_0x2fe059=_0x233fa8;_0x139e16=_0x2fe059[_0x5130('0x2e')]||0x3e8;}})[_0x5130('0x2d')](function(){var _0x2985f9=[];var _0x438d1b=0x0;if(_0x2fe059[_0x5130('0x2c')]){if(_0x4f520a&&_0x4f520a[_0x5130('0x15')]){var _0x44801e=_[_0x5130('0x2f')](_0x4f520a[0x0][_0x5130('0x30')]/_0x139e16);var _0x17d1da=Number['isInteger'](_0x4f520a[0x0][_0x5130('0x30')]/_0x139e16)?_0x4f520a[0x0][_0x5130('0x30')]%_0x139e16:0x0;_0x44801e[_0x5130('0x1b')](function(_0x53c028){if(_0x53c028>0x0){_0x438d1b+=_0x139e16;}_0x2985f9['push'](dbH['sequelize'][_0x5130('0x31')](util[_0x5130('0x1d')](_0x5130('0x32'),QUERY,_0x139e16,_0x438d1b),{'type':dbH['sequelize'][_0x5130('0x33')][_0x5130('0x34')]}));});if(_0x17d1da>0x0){_0x438d1b+=_0x139e16;_0x2985f9[_0x5130('0x1c')](dbH[_0x5130('0x35')]['query'](util['format'](_0x5130('0x32'),QUERY,_0x17d1da,_0x438d1b),{'type':dbH[_0x5130('0x35')][_0x5130('0x33')][_0x5130('0x34')]}));}}}else{_0x2985f9[_0x5130('0x1c')](dbH[_0x5130('0x35')][_0x5130('0x31')](QUERY,{'type':dbH[_0x5130('0x35')][_0x5130('0x33')]['SELECT']}));}var _0x3af74c=path[_0x5130('0x36')](PATH);var _0x23d23c=path[_0x5130('0x37')](PATH,_0x5130('0x38'));var _0x13cfcf=_0x2fe059[_0x5130('0x2c')]&&_0x2985f9[_0x5130('0x15')]>0x1;var _0x218623=[];if(!fs[_0x5130('0x39')](path['join'](_0x3af74c,_0x23d23c))&&_0x13cfcf){fs['mkdirSync'](path[_0x5130('0x3a')](_0x3af74c,_0x23d23c));}return BPromise['each'](_0x2985f9,function(_0x13cc8a){_0x218623[_0x5130('0x1c')](_0x13cc8a);})[_0x5130('0x2d')](function(){var _0x38adcb=[];for(var _0x5992b3=0x0;_0x5992b3<_0x218623[_0x5130('0x15')];_0x5992b3+=0x1){var _0x4fddde=_0x218623[_0x5992b3];var _0x2f9244=createTables(_[_0x5130('0x3b')](_0x4fddde));var _0x35c678;var _0x586bcc=getPDFDocDefinition(_0x2f9244);var _0x2b724a=getPDFPrinter();var _0x2d1578=_0x2b724a[_0x5130('0x3c')](_0x586bcc);if(_0x13cfcf){_0x35c678=path[_0x5130('0x3a')](_0x3af74c,_0x23d23c,util['format'](_0x5130('0x3d'),_0x23d23c,_0x5992b3,_0x5130('0x3e')));}else{_0x35c678=path[_0x5130('0x3a')](_0x3af74c,util[_0x5130('0x1d')](_0x5130('0x3f'),_0x23d23c,_0x5130('0x3e')));}_0x38adcb[_0x5130('0x1c')](writePDFDocument(_0x2d1578,_0x35c678));}return Promise[_0x5130('0x40')](_0x38adcb);})[_0x5130('0x2d')](function(){if(_0x13cfcf){return new Promise(function(_0x571df4){zipdir(path[_0x5130('0x3a')](_0x3af74c,_0x23d23c),{'saveTo':path['join'](_0x3af74c,util[_0x5130('0x1d')](_0x5130('0x3f'),_0x23d23c,_0x5130('0x41')))},function(){rimraf(path[_0x5130('0x3a')](_0x3af74c,_0x23d23c),function(){});_0x571df4(_0x5130('0x42'));});});}})['then'](function(){if(!_0x13cfcf)return;rimraf(path[_0x5130('0x3a')](_0x3af74c,_0x23d23c),function(){});})[_0x5130('0x2d')](function(){logger['info'](util[_0x5130('0x1d')](_0x5130('0x43'),EXTRACTED_REPORT_ID,_0x5130('0x44')));return analyticExtractedReport(_0x5130('0x45'),_0x13cfcf?util[_0x5130('0x1d')](_0x5130('0x3f'),_0x23d23c,_0x13cfcf?_0x5130('0x41'):_0x5130('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x5130('0x1d')](_0x5130('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x5130('0x47')][_0x5130('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5130('0x2d')](function(_0x38adb3){EXTRACTED_REPORT=_0x38adb3;return dbH['sequelize'][_0x5130('0x31')](util[_0x5130('0x1d')](_0x5130('0x49'),QUERY),{'type':dbH[_0x5130('0x35')][_0x5130('0x33')]['SELECT']});})['then'](extractReport)['catch'](function(_0xcdb430){logger[_0x5130('0x4a')](util[_0x5130('0x1d')](_0x5130('0x4b'),EXTRACTED_REPORT_ID,'PDF'),util[_0x5130('0x4c')](_0xcdb430,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5130('0x4d')](function(){process[_0x5130('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x883a17=new PdfPrinter({'Arial':{'normal':__dirname+_0x5130('0x4f'),'bold':__dirname+_0x5130('0x50'),'italics':__dirname+_0x5130('0x51'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x883a17;}function getPDFDocDefinitionFromHTML(_0x19e94f,_0x300346){var _0xebb67e=util[_0x5130('0x1d')](_0x5130('0x52'),_0x300346['channel'],_0x300346['interactionId']);var _0xb93a27=moment()[_0x5130('0x1d')](_0x5130('0x53'))[_0x5130('0x12')]();var _0x23e949=htmlToPdfmake(_0x19e94f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x23e949],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5130('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5130('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x5130('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x5130('0x22')}];},'footer':function(_0x10212a,_0x19552a){return[{'text':util[_0x5130('0x1d')](_0x5130('0x55'),_0xebb67e,_0x10212a,_0x19552a,_0xb93a27),'style':_0x5130('0x27')}];}};}function writePDFDocument(_0x384362,_0x517ab7){return new Promise(function(_0x212848,_0x2ba61d){var _0x99b367=_0x384362[_0x5130('0x56')](fs[_0x5130('0x57')](_0x517ab7));_0x99b367['on']('finish',function(){_0x212848(_0x5130('0x58'));});_0x99b367['on'](_0x5130('0x59'),function(_0x3b6172){_0x2ba61d(_0x3b6172);});_0x384362[_0x5130('0x5a')]();});}exports[_0x5130('0x5b')]=function(_0x38f8ff,_0x922e79){var _0x49bc48=getPDFPrinter();var _0x41e44d=getPDFDocDefinitionFromHTML(_0x38f8ff,_0x922e79);var _0x265cc1=_0x49bc48[_0x5130('0x3c')](_0x41e44d);return writePDFDocument(_0x265cc1,_0x922e79['path'])[_0x5130('0x5c')](function(_0x3337d7){throw _0x3337d7;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0370c1a..6802c9d 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 _0xe2fa=['lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','then','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','length','existsSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','zip','catch','inspect','Failed','finally','exit'];(function(_0x1c2acb,_0x106166){var _0x3e2cd6=function(_0x50b5f7){while(--_0x50b5f7){_0x1c2acb['push'](_0x1c2acb['shift']());}};_0x3e2cd6(++_0x106166);}(_0xe2fa,0x1e0));var _0xae2f=function(_0x87d016,_0x1316ff){_0x87d016=_0x87d016-0x0;var _0x529cc6=_0xe2fa[_0x87d016];return _0x529cc6;};'use strict';var util=require('util');var path=require('path');var _=require(_0xae2f('0x0'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xae2f('0x1'));var zipdir=require(_0xae2f('0x2'));var rimraf=require(_0xae2f('0x3'));var db=require(_0xae2f('0x4'))['db'];var dbH=require('../../mysqldb')[_0xae2f('0x5')];var logger=require(_0xae2f('0x6'))(_0xae2f('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xae2f('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xae2f('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f533c,_0x59ddc7){var _0x533e91={'status':_0x3f533c};var _0x165df8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59ddc7){_0x533e91[_0xae2f('0x9')]=_0x59ddc7;}return db[_0xae2f('0xa')][_0xae2f('0xb')](_0x533e91,_0x165df8);}function main(){var _0x409a34=0x1388;var _0x1f3851;logger[_0xae2f('0xc')](util[_0xae2f('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xae2f('0xe')));return db[_0xae2f('0xf')][_0xae2f('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xae2f('0x11'),_0xae2f('0x12')]})['then'](function(_0x14fbb9){if(_0x14fbb9){_0x1f3851=_0x14fbb9;_0x409a34=_0x1f3851[_0xae2f('0x12')]||0x1388;}})['then'](function(){return dbH[_0xae2f('0x13')][_0xae2f('0x14')](util['format'](_0xae2f('0x15'),QUERY),{'type':dbH[_0xae2f('0x13')]['QueryTypes'][_0xae2f('0x16')]});})[_0xae2f('0x17')](function(_0x5e9586){if(!_0x5e9586[0x0][_0xae2f('0x18')]){return analyticExtractedReport('Empty');}var _0x19805f=[];var _0x696bfe=0x0;if(_0x1f3851['split']){if(_0x5e9586&&_0x5e9586['length']){var _0x560368=_['range'](_0x5e9586[0x0]['num']/_0x409a34);var _0x31f9f2=Number['isInteger'](_0x5e9586[0x0][_0xae2f('0x18')]/_0x409a34)?_0x5e9586[0x0][_0xae2f('0x18')]%_0x409a34:0x0;_0x560368['forEach'](function(_0x4b107d){if(_0x4b107d>0x0){_0x696bfe+=_0x409a34;}_0x19805f[_0xae2f('0x19')](dbH[_0xae2f('0x13')][_0xae2f('0x14')](util[_0xae2f('0xd')](_0xae2f('0x1a'),QUERY,_0x409a34,_0x696bfe),{'type':dbH[_0xae2f('0x13')][_0xae2f('0x1b')][_0xae2f('0x16')]}));});if(_0x31f9f2>0x0){_0x696bfe+=_0x409a34;_0x19805f['push'](dbH[_0xae2f('0x13')][_0xae2f('0x14')](util['format'](_0xae2f('0x1a'),QUERY,_0x31f9f2,_0x696bfe),{'type':dbH['sequelize']['QueryTypes'][_0xae2f('0x16')]}));}}}else{_0x19805f['push'](dbH[_0xae2f('0x13')]['query'](QUERY,{'type':dbH[_0xae2f('0x13')][_0xae2f('0x1b')][_0xae2f('0x16')]}));}var _0x594da4=path[_0xae2f('0x1c')](PATH);var _0xeb4255=path[_0xae2f('0x1d')](PATH,'.xlsx');var _0x664e2d=_0x1f3851['split']&&_0x19805f[_0xae2f('0x1e')]>0x1;var _0x432d12=[];if(!fs[_0xae2f('0x1f')](path[_0xae2f('0x20')](_0x594da4,_0xeb4255))&&_0x664e2d){fs['mkdirSync'](path['join'](_0x594da4,_0xeb4255));}return BPromise[_0xae2f('0x21')](_0x19805f,function(_0xfdda23){_0x432d12['push'](_0xfdda23);})[_0xae2f('0x17')](function(){for(var _0x9fee44=0x0;_0x9fee44<_0x432d12[_0xae2f('0x1e')];_0x9fee44+=0x1){var _0x4ff4cb;var _0x3172a0=_0x432d12[_0x9fee44];if(_0x664e2d){_0x4ff4cb=path[_0xae2f('0x20')](_0x594da4,_0xeb4255,util[_0xae2f('0xd')](_0xae2f('0x22'),_0xeb4255,_0x9fee44,_0xae2f('0x23')));}else{_0x4ff4cb=path['join'](_0x594da4,util[_0xae2f('0xd')]('%s.%s',_0xeb4255,'xlsx'));}fs[_0xae2f('0x24')](_0x4ff4cb,json2xls(_0x3172a0),_0xae2f('0x25'));}})[_0xae2f('0x17')](function(){if(_0x664e2d){return new Promise(function(_0x3647c1){zipdir(path[_0xae2f('0x20')](_0x594da4,_0xeb4255),{'saveTo':path[_0xae2f('0x20')](_0x594da4,util[_0xae2f('0xd')]('%s.%s',_0xeb4255,'zip'))},function(_0x441bbe,_0x15f34b){rimraf(path[_0xae2f('0x20')](_0x594da4,_0xeb4255),function(){});_0x3647c1(_0xae2f('0x26'));});});}})[_0xae2f('0x17')](function(){logger[_0xae2f('0xc')](util[_0xae2f('0xd')](_0xae2f('0x27'),EXTRACTED_REPORT_ID,_0xae2f('0xe')));return analyticExtractedReport(_0xae2f('0x28'),_0x664e2d?util[_0xae2f('0xd')](_0xae2f('0x29'),_0xeb4255,_0x664e2d?_0xae2f('0x2a'):'xlsx'):null);});})[_0xae2f('0x2b')](function(_0x2af9e4){logger[_0xae2f('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xae2f('0x2c')](_0x2af9e4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xae2f('0x2d'));})[_0xae2f('0x2e')](function(){process[_0xae2f('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2791=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','isInteger','forEach','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','xlsx','%s.%s','zip','zip\x20finished','XLSX','Completed'];(function(_0x261f3d,_0x175680){var _0x574b9a=function(_0x74376d){while(--_0x74376d){_0x261f3d['push'](_0x261f3d['shift']());}};_0x574b9a(++_0x175680);}(_0x2791,0x100));var _0x1279=function(_0x47f588,_0x2372b5){_0x47f588=_0x47f588-0x0;var _0x4f93a9=_0x2791[_0x47f588];return _0x4f93a9;};'use strict';var util=require(_0x1279('0x0'));var path=require(_0x1279('0x1'));var _=require(_0x1279('0x2'));var fs=require('fs');var json2xls=require(_0x1279('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x1279('0x4'));var rimraf=require(_0x1279('0x5'));var db=require(_0x1279('0x6'))['db'];var dbH=require(_0x1279('0x6'))[_0x1279('0x7')];var logger=require(_0x1279('0x8'))(_0x1279('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1279('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x880f5d,_0x2be205){var _0x1e1e64={'status':_0x880f5d};var _0x1f9ebe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2be205){_0x1e1e64[_0x1279('0xb')]=_0x2be205;}return db[_0x1279('0xc')][_0x1279('0xd')](_0x1e1e64,_0x1f9ebe);}function main(){var _0x2d4e2e=0x1388;var _0xffc4be;logger[_0x1279('0xe')](util[_0x1279('0xf')](_0x1279('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1279('0x11')][_0x1279('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1279('0x13'),_0x1279('0x14')]})[_0x1279('0x15')](function(_0x25291b){if(_0x25291b){_0xffc4be=_0x25291b;_0x2d4e2e=_0xffc4be[_0x1279('0x14')]||0x1388;}})[_0x1279('0x15')](function(){return dbH[_0x1279('0x16')][_0x1279('0x17')](util['format'](_0x1279('0x18'),QUERY),{'type':dbH[_0x1279('0x16')][_0x1279('0x19')]['SELECT']});})[_0x1279('0x15')](function(_0x31125e){if(!_0x31125e[0x0][_0x1279('0x1a')]){return analyticExtractedReport('Empty');}var _0xeebf04=[];var _0x53eaef=0x0;if(_0xffc4be[_0x1279('0x13')]){if(_0x31125e&&_0x31125e[_0x1279('0x1b')]){var _0x1f6fb8=_[_0x1279('0x1c')](_0x31125e[0x0][_0x1279('0x1a')]/_0x2d4e2e);var _0x28234a=Number[_0x1279('0x1d')](_0x31125e[0x0]['num']/_0x2d4e2e)?_0x31125e[0x0][_0x1279('0x1a')]%_0x2d4e2e:0x0;_0x1f6fb8[_0x1279('0x1e')](function(_0x41f6a5){if(_0x41f6a5>0x0){_0x53eaef+=_0x2d4e2e;}_0xeebf04['push'](dbH[_0x1279('0x16')]['query'](util[_0x1279('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2d4e2e,_0x53eaef),{'type':dbH[_0x1279('0x16')][_0x1279('0x19')][_0x1279('0x1f')]}));});if(_0x28234a>0x0){_0x53eaef+=_0x2d4e2e;_0xeebf04['push'](dbH[_0x1279('0x16')][_0x1279('0x17')](util[_0x1279('0xf')](_0x1279('0x20'),QUERY,_0x28234a,_0x53eaef),{'type':dbH['sequelize'][_0x1279('0x19')][_0x1279('0x1f')]}));}}}else{_0xeebf04[_0x1279('0x21')](dbH['sequelize'][_0x1279('0x17')](QUERY,{'type':dbH[_0x1279('0x16')]['QueryTypes'][_0x1279('0x1f')]}));}var _0x8b2bf0=path[_0x1279('0x22')](PATH);var _0x45750c=path[_0x1279('0x23')](PATH,_0x1279('0x24'));var _0x49602b=_0xffc4be[_0x1279('0x13')]&&_0xeebf04[_0x1279('0x1b')]>0x1;var _0x52e179=[];if(!fs['existsSync'](path['join'](_0x8b2bf0,_0x45750c))&&_0x49602b){fs['mkdirSync'](path['join'](_0x8b2bf0,_0x45750c));}return BPromise['each'](_0xeebf04,function(_0x546bb2){_0x52e179[_0x1279('0x21')](_0x546bb2);})[_0x1279('0x15')](function(){for(var _0x34b161=0x0;_0x34b161<_0x52e179[_0x1279('0x1b')];_0x34b161+=0x1){var _0x5c0485;var _0x336c06=_0x52e179[_0x34b161];if(_0x49602b){_0x5c0485=path[_0x1279('0x25')](_0x8b2bf0,_0x45750c,util['format']('%s%d.%s',_0x45750c,_0x34b161,_0x1279('0x26')));}else{_0x5c0485=path[_0x1279('0x25')](_0x8b2bf0,util[_0x1279('0xf')](_0x1279('0x27'),_0x45750c,_0x1279('0x26')));}fs['writeFileSync'](_0x5c0485,json2xls(_0x336c06),'binary');}})[_0x1279('0x15')](function(){if(_0x49602b){return new Promise(function(_0x3bff02){zipdir(path[_0x1279('0x25')](_0x8b2bf0,_0x45750c),{'saveTo':path[_0x1279('0x25')](_0x8b2bf0,util[_0x1279('0xf')]('%s.%s',_0x45750c,_0x1279('0x28')))},function(_0x538575,_0x35cf44){rimraf(path[_0x1279('0x25')](_0x8b2bf0,_0x45750c),function(){});_0x3bff02(_0x1279('0x29'));});});}})['then'](function(){logger[_0x1279('0xe')](util[_0x1279('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1279('0x2a')));return analyticExtractedReport(_0x1279('0x2b'),_0x49602b?util['format'](_0x1279('0x27'),_0x45750c,_0x49602b?_0x1279('0x28'):'xlsx'):null);});})[_0x1279('0x2c')](function(_0x3847a3){logger[_0x1279('0xe')](util[_0x1279('0xf')](_0x1279('0x2d'),EXTRACTED_REPORT_ID,_0x1279('0x2a')),util[_0x1279('0x2e')](_0x3847a3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1279('0x2f'));})[_0x1279('0x30')](function(){process[_0x1279('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 658b7b4..d98eefe 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 _0x5e64=['none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','updatedAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','catch','rewrite','lodash','util','models','Interval','findAll','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','hasOwnProperty','priority','extension','find','extensions','Set','format','type','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','recordingFormat'];(function(_0x3f7861,_0x13619b){var _0x36fdae=function(_0x6aa7b8){while(--_0x6aa7b8){_0x3f7861['push'](_0x3f7861['shift']());}};_0x36fdae(++_0x13619b);}(_0x5e64,0x15b));var _0x45e6=function(_0x8e20a1,_0x45f48f){_0x8e20a1=_0x8e20a1-0x0;var _0x1868f8=_0x5e64[_0x8e20a1];return _0x1868f8;};'use strict';var _=require(_0x45e6('0x0'));var util=require(_0x45e6('0x1'));function rewrite(_0x5c7716,_0x3f7739){var _0x514512=this;return _0x5c7716[_0x45e6('0x2')][_0x45e6('0x3')][_0x45e6('0x4')]({'raw':!![]})['then'](function(_0x177049){_0x514512[_0x45e6('0x5')]=_0x177049;return _0x5c7716['models']['VoiceExtension'][_0x45e6('0x4')]({'where':{'IntervalId':_0x3f7739[_0x45e6('0x6')]},'raw':!![]});})['then'](function(_0x18622d){return _0x5c7716[_0x45e6('0x2')][_0x45e6('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x45e6('0x8')](_[_0x45e6('0x9')](_0x18622d,_0x45e6('0xa')))}},'order':[{'raw':_0x45e6('0xb')}],'raw':!![]});})[_0x45e6('0xc')](function(_0x554383){var _0x24dc8b=_['filter'](_0x554383,{'priority':'1'});var _0x5bebab=_[_0x45e6('0xd')](_0x554383,{'isApp':0x1});var _0x1d565c=_[_0x45e6('0xe')](_0x5bebab,'exten');var _0x25a712=['queue','playback'];var _0x9861ea=[];var _0x27e4ab=[];for(var _0x395d6a in _0x1d565c){if(_0x1d565c[_0x45e6('0xf')](_0x395d6a)){_0x514512[_0x45e6('0x10')]=0x2;_0x514512['extensions']=[];_0x514512[_0x45e6('0x11')]=_[_0x45e6('0x12')](_0x24dc8b,{'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')]});_0x514512[_0x45e6('0x13')]['push']({'type':_0x1d565c[_0x395d6a][0x0]['type'],'app':_0x45e6('0x14'),'appdata':util[_0x45e6('0x15')]('CDR(type)=%s',_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')]),'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512['priority']++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});if(_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')]===_0x45e6('0x19')){_0x514512['extensions'][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':_0x45e6('0x14'),'appdata':_0x45e6('0x1b')+_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')],'context':_0x1d565c[_0x395d6a][0x0]['context'],'exten':_0x1d565c[_0x395d6a][0x0]['exten'],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});}else if(_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')]===_0x45e6('0x1c')){if(_0x514512[_0x45e6('0x11')]){_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':'Set','appdata':_0x45e6('0x1d')+(_0x514512[_0x45e6('0x11')]['cutdigits']?_0x45e6('0x1e')+_0x514512[_0x45e6('0x11')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});}_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':'Set','appdata':_0x45e6('0x1b')+_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')],'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});var _0x35c7da=_0x514512[_0x45e6('0x10')]++;_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':_0x45e6('0x1f'),'appdata':_0x45e6('0x20')+(_0x35c7da+0x2)+'):Goto('+(_0x35c7da+0x1)+')','context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x35c7da,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});if(_0x514512[_0x45e6('0x11')]){_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':_0x45e6('0x14'),'appdata':_0x514512[_0x45e6('0x11')]['cutdigits']?_0x45e6('0x21')+_0x514512['extension'][_0x45e6('0x22')]+'}':_0x45e6('0x23'),'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});}_0x514512[_0x45e6('0x13')]['push']({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':'Set','appdata':'outboundrouteid='+_0x1d565c[_0x395d6a][0x0]['VoiceExtensionId'],'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});if(_0x514512[_0x45e6('0x11')]&&_0x514512[_0x45e6('0x11')][_0x45e6('0xf')](_0x45e6('0x24'))&&_0x514512['extension'][_0x45e6('0x24')]!==_0x45e6('0x25')){_0x514512['extensions'][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});_0x514512['extensions'][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':_0x45e6('0x14'),'appdata':_0x45e6('0x26')+_0x514512[_0x45e6('0x11')][_0x45e6('0x24')]||_0x45e6('0x27'),'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0]['exten'],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});}}_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':'Set','appdata':_0x45e6('0x28'),'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':_0x45e6('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d565c[_0x395d6a][0x0]['context'],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512[_0x45e6('0x10')]++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x16')],'app':_0x45e6('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'priority':_0x514512['priority']++,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0]['VoiceExtensionId']});for(var _0xfef8fa=0x0,_0x4ecfe5=0x0;_0xfef8fa<_0x1d565c[_0x395d6a][_0x45e6('0x29')];_0xfef8fa+=0x1,_0x4ecfe5=0x0){var _0x158e3e=_0x1d565c[_0x395d6a][_0xfef8fa];if(_0x158e3e[_0x45e6('0x16')]){_0x158e3e[_0x45e6('0x16')]=_0x158e3e[_0x45e6('0x16')][_0x45e6('0x2a')]();}var _0x256c96=[];var _0x178806=[];delete _0x158e3e['id'];delete _0x158e3e['createdAt'];delete _0x158e3e[_0x45e6('0x2b')];var _0x19316d=_0x158e3e[_0x45e6('0x2c')]!=='*,*,*,*'?[_0x158e3e[_0x45e6('0x2c')]]:_0x158e3e[_0x45e6('0x6')]?_[_0x45e6('0x9')](_[_0x45e6('0xd')](_0x514512[_0x45e6('0x5')],{'IntervalId':_0x158e3e[_0x45e6('0x6')]}),_0x45e6('0x2c')):[];if(_0x158e3e[_0x45e6('0xf')](_0x45e6('0x2d'))){if(_0x158e3e['tag']&&_0x158e3e['tag']!=='--'){_0x256c96[_0x45e6('0x1a')]({'type':_0x158e3e[_0x45e6('0x16')],'app':'Set','appdata':'CDR(tag)='+_0x158e3e['tag'],'context':_0x158e3e['context'],'exten':_0x158e3e[_0x45e6('0xa')],'priority':_0x19316d['length']+_0x514512[_0x45e6('0x10')]+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e[_0x45e6('0x18')]});}}if(_0x158e3e[_0x45e6('0x16')]==='outbound'&&_0x158e3e[_0x45e6('0xf')]('callerID')){if(_0x158e3e[_0x45e6('0x2e')]){_0x256c96[_0x45e6('0x1a')]({'type':_0x158e3e[_0x45e6('0x16')],'app':_0x45e6('0x1f'),'appdata':_0x45e6('0x2f')+_0x158e3e['callerID']+')','context':_0x158e3e[_0x45e6('0x17')],'exten':_0x158e3e['exten'],'priority':_0x19316d[_0x45e6('0x29')]+_0x514512['priority']+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e['VoiceExtensionId']});}else{_0x256c96[_0x45e6('0x1a')]({'type':_0x158e3e[_0x45e6('0x16')],'app':_0x45e6('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x158e3e[_0x45e6('0x17')],'exten':_0x158e3e[_0x45e6('0xa')],'priority':_0x19316d[_0x45e6('0x29')]+_0x514512[_0x45e6('0x10')]+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e[_0x45e6('0x18')]});}}if(_0x158e3e[_0x45e6('0xf')]('answer')){if(_0x25a712[_0x45e6('0x30')](_0x158e3e[_0x45e6('0x31')][_0x45e6('0x2a')]())>=0x0&&_0x158e3e[_0x45e6('0x32')]!==_0x45e6('0x33')){if(_0x158e3e[_0x45e6('0x34')]){_0x256c96[_0x45e6('0x1a')]({'type':_0x158e3e[_0x45e6('0x16')],'app':_0x45e6('0x1f'),'appdata':_0x45e6('0x35'),'context':_0x158e3e[_0x45e6('0x17')],'exten':_0x158e3e[_0x45e6('0xa')],'priority':_0x19316d['length']+_0x514512[_0x45e6('0x10')]+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e[_0x45e6('0x18')]});_0x256c96[_0x45e6('0x1a')]({'type':_0x158e3e['type'],'app':_0x45e6('0x14'),'appdata':_0x45e6('0x36'),'context':_0x158e3e['context'],'exten':_0x158e3e[_0x45e6('0xa')],'priority':_0x19316d[_0x45e6('0x29')]+_0x514512['priority']+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e[_0x45e6('0x18')]});}else{_0x256c96['push']({'type':_0x158e3e[_0x45e6('0x16')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x158e3e[_0x45e6('0x17')],'exten':_0x158e3e[_0x45e6('0xa')],'priority':_0x19316d[_0x45e6('0x29')]+_0x514512[_0x45e6('0x10')]+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e[_0x45e6('0x18')]});_0x256c96[_0x45e6('0x1a')]({'type':_0x158e3e['type'],'app':_0x45e6('0x14'),'appdata':_0x45e6('0x37'),'context':_0x158e3e[_0x45e6('0x17')],'exten':_0x158e3e[_0x45e6('0xa')],'priority':_0x19316d[_0x45e6('0x29')]+_0x514512[_0x45e6('0x10')]+_0x4ecfe5++,'VoiceExtensionId':_0x158e3e[_0x45e6('0x18')]});}}}for(var _0x8caad=0x0;_0x8caad<_0x19316d[_0x45e6('0x29')];_0x8caad+=0x1){var _0x271148=_0x514512[_0x45e6('0x10')]+_0x19316d['length'];var _0x44db75=_0x8caad===_0x19316d[_0x45e6('0x29')]-0x1?_0x514512[_0x45e6('0x10')]+_0x256c96[_0x45e6('0x29')]+_0x178806[_0x45e6('0x29')]+0x2:_0x514512[_0x45e6('0x10')]+_0x8caad+0x1;_0x256c96[_0x45e6('0x38')](_0x8caad,0x0,{'type':_0x158e3e['type'],'app':'GotoIfTime','appdata':_0x19316d[_0x8caad]+'?'+_0x158e3e['context']+_0x45e6('0x39')+_0x271148+':'+_0x158e3e[_0x45e6('0x17')]+',${EXTEN},'+_0x44db75,'exten':_0x158e3e[_0x45e6('0xa')],'context':_0x158e3e['context'],'priority':_0x514512['priority']+_0x8caad,'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});}_0x158e3e[_0x45e6('0x10')]=_0x256c96['length']?_[_0x45e6('0x3a')](_0x256c96)[_0x45e6('0x10')]+0x1:_0x514512[_0x45e6('0x10')];_0x514512['priority']=(_0x178806[_0x45e6('0x29')]?_['last'](_0x178806)[_0x45e6('0x10')]:_0x158e3e[_0x45e6('0x10')])+0x1;_0x514512['extensions']=_[_0x45e6('0x3b')](_0x514512[_0x45e6('0x13')],_0x256c96,[_0x158e3e],_0x178806);}_0x514512[_0x45e6('0x13')][_0x45e6('0x1a')]({'type':_0x1d565c[_0x395d6a][0x0]['type'],'app':'Hangup','exten':_0x1d565c[_0x395d6a][0x0][_0x45e6('0xa')],'context':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x17')],'priority':_0x514512[_0x45e6('0x10')],'VoiceExtensionId':_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]});_0x9861ea[_0x45e6('0x1a')](_0x1d565c[_0x395d6a][0x0][_0x45e6('0x18')]);_0x27e4ab=_[_0x45e6('0x3b')](_0x27e4ab,_0x514512[_0x45e6('0x13')]);}}return _0x5c7716[_0x45e6('0x3c')](function(_0x311fca){return _0x5c7716[_0x45e6('0x2')][_0x45e6('0x7')][_0x45e6('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x9861ea}},'transaction':_0x311fca})['then'](function(_0x97f26){return _0x5c7716[_0x45e6('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x27e4ab,'priority'),{'transaction':_0x311fca});});});})[_0x45e6('0x3e')](function(_0x48fb97){console['error'](_0x48fb97);});}exports[_0x45e6('0x3f')]=rewrite; \ No newline at end of file +var _0x76e1=['destroy','bulkCreate','sortBy','error','rewrite','Interval','findAll','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','context','inbound','type','CDR(routeid)=','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','outbound','callerID','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','models'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x76e1,0x1a3));var _0x176e=function(_0x4436fe,_0x46fff7){_0x4436fe=_0x4436fe-0x0;var _0xe2a681=_0x76e1[_0x4436fe];return _0xe2a681;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3b24a1,_0x22da90){var _0xbd4692=this;return _0x3b24a1['models'][_0x176e('0x0')][_0x176e('0x1')]({'raw':!![]})[_0x176e('0x2')](function(_0x439692){_0xbd4692['intervals']=_0x439692;return _0x3b24a1['models'][_0x176e('0x3')]['findAll']({'where':{'IntervalId':_0x22da90['IntervalId']},'raw':!![]});})['then'](function(_0x17e1e4){return _0x3b24a1['models'][_0x176e('0x3')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x176e('0x4')](_0x17e1e4,_0x176e('0x5')))}},'order':[{'raw':_0x176e('0x6')}],'raw':!![]});})['then'](function(_0x4ee426){var _0x5394b7=_['filter'](_0x4ee426,{'priority':'1'});var _0x3fcafe=_[_0x176e('0x7')](_0x4ee426,{'isApp':0x1});var _0xc5cdae=_['groupBy'](_0x3fcafe,_0x176e('0x5'));var _0x2f0223=[_0x176e('0x8'),_0x176e('0x9')];var _0x416773=[];var _0x1baaff=[];for(var _0x1a7e7b in _0xc5cdae){if(_0xc5cdae[_0x176e('0xa')](_0x1a7e7b)){_0xbd4692[_0x176e('0xb')]=0x2;_0xbd4692[_0x176e('0xc')]=[];_0xbd4692[_0x176e('0xd')]=_[_0x176e('0xe')](_0x5394b7,{'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')]});_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':util[_0x176e('0x11')](_0x176e('0x12'),_0xc5cdae[_0x1a7e7b][0x0]['type']),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0]['exten'],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});if(_0xc5cdae[_0x1a7e7b][0x0]['type']===_0x176e('0x14')){_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':_0x176e('0x16')+_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});}else if(_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')]==='outbound'){if(_0xbd4692[_0x176e('0xd')]){_0xbd4692['extensions'][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':_0x176e('0x18')+(_0xbd4692['extension'][_0x176e('0x19')]?_0x176e('0x1a')+_0xbd4692['extension'][_0x176e('0x19')]+'}':_0x176e('0x1b')),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});}_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':_0x176e('0x16')+_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});var _0x546f7a=_0xbd4692[_0x176e('0xb')]++;_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x546f7a+0x2)+_0x176e('0x1d')+(_0x546f7a+0x1)+')','context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0x546f7a,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});if(_0xbd4692[_0x176e('0xd')]){_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0xbd4692['extension'][_0x176e('0x19')]?_0x176e('0x1e')+_0xbd4692[_0x176e('0xd')][_0x176e('0x19')]+'}':_0x176e('0x1f'),'context':_0xc5cdae[_0x1a7e7b][0x0]['context'],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});}_0xbd4692['extensions'][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':'outboundrouteid='+_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0]['VoiceExtensionId']});if(_0xbd4692[_0x176e('0xd')]&&_0xbd4692['extension'][_0x176e('0xa')](_0x176e('0x20'))&&_0xbd4692[_0x176e('0xd')][_0x176e('0x20')]!==_0x176e('0x21')){_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x22'),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692['priority']++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x23')+_0xbd4692[_0x176e('0xd')][_0x176e('0x20')]||'wav','context':_0xc5cdae[_0x1a7e7b][0x0]['context'],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});}}_0xbd4692[_0x176e('0xc')][_0x176e('0xf')]({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':'Set','appdata':_0x176e('0x24'),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0]['exten'],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0]['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x25'),'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':'MONITOR_OPTIONS=ab','context':_0xc5cdae[_0x1a7e7b][0x0]['context'],'exten':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x5')],'priority':_0xbd4692[_0x176e('0xb')]++,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});for(var _0x3fd539=0x0,_0x60bcc1=0x0;_0x3fd539<_0xc5cdae[_0x1a7e7b][_0x176e('0x26')];_0x3fd539+=0x1,_0x60bcc1=0x0){var _0x49560c=_0xc5cdae[_0x1a7e7b][_0x3fd539];if(_0x49560c['type']){_0x49560c[_0x176e('0x15')]=_0x49560c[_0x176e('0x15')][_0x176e('0x27')]();}var _0x525816=[];var _0x4ea49c=[];delete _0x49560c['id'];delete _0x49560c[_0x176e('0x28')];delete _0x49560c[_0x176e('0x29')];var _0x18605f=_0x49560c[_0x176e('0x2a')]!==_0x176e('0x2b')?[_0x49560c['interval']]:_0x49560c[_0x176e('0x2c')]?_[_0x176e('0x4')](_[_0x176e('0x7')](_0xbd4692[_0x176e('0x2d')],{'IntervalId':_0x49560c['IntervalId']}),_0x176e('0x2a')):[];if(_0x49560c[_0x176e('0xa')](_0x176e('0x2e'))){if(_0x49560c[_0x176e('0x2e')]&&_0x49560c['tag']!=='--'){_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':'CDR(tag)='+_0x49560c[_0x176e('0x2e')],'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}}if(_0x49560c[_0x176e('0x15')]===_0x176e('0x2f')&&_0x49560c[_0x176e('0xa')](_0x176e('0x30'))){if(_0x49560c[_0x176e('0x30')]){_0x525816['push']({'type':_0x49560c[_0x176e('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x49560c['callerID']+')','context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}else{_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f['length']+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}}if(_0x49560c[_0x176e('0xa')](_0x176e('0x31'))){if(_0x2f0223['indexOf'](_0x49560c[_0x176e('0x32')]['toLowerCase']())>=0x0&&_0x49560c[_0x176e('0x33')]!==_0x176e('0x34')){if(_0x49560c[_0x176e('0x31')]){_0x525816['push']({'type':_0x49560c[_0x176e('0x15')],'app':'ExecIf','appdata':_0x176e('0x35'),'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});_0x525816[_0x176e('0xf')]({'type':_0x49560c['type'],'app':_0x176e('0x10'),'appdata':_0x176e('0x36'),'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692[_0x176e('0xb')]+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}else{_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x1c'),'appdata':_0x176e('0x37'),'context':_0x49560c[_0x176e('0x13')],'exten':_0x49560c[_0x176e('0x5')],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692['priority']+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});_0x525816[_0x176e('0xf')]({'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x49560c['context'],'exten':_0x49560c['exten'],'priority':_0x18605f[_0x176e('0x26')]+_0xbd4692['priority']+_0x60bcc1++,'VoiceExtensionId':_0x49560c[_0x176e('0x17')]});}}}for(var _0x2ba158=0x0;_0x2ba158<_0x18605f['length'];_0x2ba158+=0x1){var _0x4a9c6f=_0xbd4692['priority']+_0x18605f['length'];var _0xcd9b50=_0x2ba158===_0x18605f[_0x176e('0x26')]-0x1?_0xbd4692['priority']+_0x525816[_0x176e('0x26')]+_0x4ea49c[_0x176e('0x26')]+0x2:_0xbd4692[_0x176e('0xb')]+_0x2ba158+0x1;_0x525816[_0x176e('0x38')](_0x2ba158,0x0,{'type':_0x49560c[_0x176e('0x15')],'app':_0x176e('0x39'),'appdata':_0x18605f[_0x2ba158]+'?'+_0x49560c[_0x176e('0x13')]+',${EXTEN},'+_0x4a9c6f+':'+_0x49560c[_0x176e('0x13')]+_0x176e('0x3a')+_0xcd9b50,'exten':_0x49560c[_0x176e('0x5')],'context':_0x49560c[_0x176e('0x13')],'priority':_0xbd4692['priority']+_0x2ba158,'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});}_0x49560c[_0x176e('0xb')]=_0x525816[_0x176e('0x26')]?_[_0x176e('0x3b')](_0x525816)[_0x176e('0xb')]+0x1:_0xbd4692[_0x176e('0xb')];_0xbd4692['priority']=(_0x4ea49c['length']?_[_0x176e('0x3b')](_0x4ea49c)[_0x176e('0xb')]:_0x49560c[_0x176e('0xb')])+0x1;_0xbd4692[_0x176e('0xc')]=_[_0x176e('0x3c')](_0xbd4692['extensions'],_0x525816,[_0x49560c],_0x4ea49c);}_0xbd4692[_0x176e('0xc')]['push']({'type':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x15')],'app':_0x176e('0x3d'),'exten':_0xc5cdae[_0x1a7e7b][0x0]['exten'],'context':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x13')],'priority':_0xbd4692['priority'],'VoiceExtensionId':_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]});_0x416773[_0x176e('0xf')](_0xc5cdae[_0x1a7e7b][0x0][_0x176e('0x17')]);_0x1baaff=_['concat'](_0x1baaff,_0xbd4692[_0x176e('0xc')]);}}return _0x3b24a1[_0x176e('0x3e')](function(_0x4943ae){return _0x3b24a1[_0x176e('0x3f')][_0x176e('0x3')][_0x176e('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x416773}},'transaction':_0x4943ae})[_0x176e('0x2')](function(_0x8807b5){return _0x3b24a1[_0x176e('0x3f')][_0x176e('0x3')][_0x176e('0x41')](_[_0x176e('0x42')](_0x1baaff,'priority'),{'transaction':_0x4943ae});});});})['catch'](function(_0x9b23f3){console[_0x176e('0x43')](_0x9b23f3);});}exports[_0x176e('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3185b7c..7ccc7b3 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 _0xa416=['util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','message','join','hasOwnProperty','firstName','phone','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','CmContact','create','keys','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','scheduledAt','toString','NOW()','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','into','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','then','all','outbound','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird'];(function(_0xcd1299,_0x584035){var _0x534b6a=function(_0x2fa78e){while(--_0x2fa78e){_0xcd1299['push'](_0xcd1299['shift']());}};_0x534b6a(++_0x584035);}(_0xa416,0x6d));var _0x6a41=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa416[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x6a41('0x0'));var util=require(_0x6a41('0x1'));var _=require(_0x6a41('0x2'));var fs=require('fs');var squel=require(_0x6a41('0x3'));var Papa=require(_0x6a41('0x4'));var Redis=require(_0x6a41('0x5'));var db=require(_0x6a41('0x6'))['db'];var config=require(_0x6a41('0x7'));var logger=require('../../../config/logger')(_0x6a41('0x8'));config[_0x6a41('0x9')]=_['defaults'](config['redis'],{'host':_0x6a41('0xa'),'port':0x18eb});var socket=require(_0x6a41('0xb'))(new Redis(config[_0x6a41('0x9')]));require(_0x6a41('0xc'))[_0x6a41('0xd')](socket);try{if(!process[_0x6a41('0xe')][0x2]||process[_0x6a41('0xe')][0x2]==='undefined'||process[_0x6a41('0xe')][0x2]===_0x6a41('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x6a41('0xe')][0x2];if(!process[_0x6a41('0xe')][0x3]||process[_0x6a41('0xe')][0x3]===_0x6a41('0x10')||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x6a41('0xe')][0x4]==='undefined'||process[_0x6a41('0xe')][0x4]===_0x6a41('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x6a41('0x11')](process['argv'][0x3]['split'](','),process[_0x6a41('0xe')][0x4][_0x6a41('0x12')](','));if(!process[_0x6a41('0xe')][0x5]||process['argv'][0x5]===_0x6a41('0x10')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6a41('0xe')][0x5];var COMPANYID=process[_0x6a41('0xe')][0x6]&&process[_0x6a41('0xe')][0x6]!=='undefined'&&process[_0x6a41('0xe')][0x6]!=='null'?process[_0x6a41('0xe')][0x6]:null;var DUPLICATES=process[_0x6a41('0xe')][0x7]&&process[_0x6a41('0xe')][0x7]!==_0x6a41('0x10')&&process[_0x6a41('0xe')][0x7]!==_0x6a41('0xf')?process[_0x6a41('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x6a41('0xe')][0x8]===_0x6a41('0x10')||process['argv'][0x8]===_0x6a41('0xf')){throw new Error(_0x6a41('0x13'));}var SOCKET_TIMESTAMP=process[_0x6a41('0xe')][0x8];}catch(_0x24e5e7){logger[_0x6a41('0x14')](_0x24e5e7);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(_0x121dff,_0x2a0669,_0x4dd1e3,_0x3043ac){var _0x3fb323={'message':_0x2a0669};_0x3fb323[_0x121dff]=!![];if(_0x4dd1e3){_0x3fb323[_0x6a41('0x15')]=_0x4dd1e3;}if(_0x3043ac){_0x3fb323[_0x6a41('0x16')]=_0x3043ac;}return _0x3fb323;}function isEmail(_0x3ec939){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))*$/[_0x6a41('0x17')](_0x3ec939);}function checkRow(_0x203878,_0x4e581,_0x857e0c){return new BPromise(function(_0x1d8713,_0x56c9b1){if(_[_0x6a41('0x18')](_0x203878)){return _0x56c9b1(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x857e0c));}if(_0x203878[_0x6a41('0x19')]&&_0x203878[_0x6a41('0x19')][_0x6a41('0x1a')]){var _0x41d3cc=_[_0x6a41('0x1b')](_0x203878[_0x6a41('0x19')],_0x6a41('0x1c'))[_0x6a41('0x1d')](';');return _0x56c9b1(handleCheckRowError('error',_0x41d3cc,null,_0x857e0c));}var _0x32c734={};for(var _0x4440c5 in FIELDS){if(FIELDS[_0x6a41('0x1e')](_0x4440c5)&&FIELDS[_0x4440c5]){_0x32c734[_0x4440c5]=_0x203878['data'][0x0][FIELDS[_0x4440c5]]||_0x203878['data'][0x0]['\ufeff'+FIELDS[_0x4440c5]];}}if(!_0x32c734[_0x6a41('0x1f')]){return _0x56c9b1(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x857e0c));}if(!_0x32c734[_0x6a41('0x20')]){return _0x56c9b1(handleCheckRowError(_0x6a41('0x14'),'phone\x20not\x20specified!',null,_0x857e0c));}if(_0x32c734[_0x6a41('0x21')]){var _0x55969d=moment(_0x32c734[_0x6a41('0x21')],'YYYY-MM-DD');if(!_0x55969d[_0x6a41('0x22')]()){return _0x56c9b1(handleCheckRowError(_0x6a41('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x857e0c));}}if(_0x32c734['email']){if(!isEmail(_0x32c734[_0x6a41('0x23')])){return _0x56c9b1(handleCheckRowError('error',_0x6a41('0x24'),null,_0x857e0c));}}_0x32c734['ListId']=LISTID;_0x32c734[_0x6a41('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6a41('0x1a')]&&_0x4e581){var _0x3b20e6={};for(var _0xae93c6=0x0,_0x33ae5e=DUPLICATES[_0x6a41('0x1a')];_0xae93c6<_0x33ae5e;_0xae93c6+=0x1){_0x3b20e6[DUPLICATES[_0xae93c6]]=_0x32c734[DUPLICATES[_0xae93c6]];}var _0x8f4bd1=_['find'](_0x4e581,_0x3b20e6);if(_0x8f4bd1){return _0x56c9b1(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x8f4bd1,_0x857e0c));}}return db[_0x6a41('0x26')][_0x6a41('0x27')](_0x32c734,{'raw':!![],'hooks':![],'fields':_[_0x6a41('0x28')](_0x32c734)})['then'](function(_0x4a5299){if(DUPLICATES&&DUPLICATES[_0x6a41('0x1a')]&&_0x4e581){_0x4e581[_0x6a41('0x29')](_[_0x6a41('0x2a')](_0x32c734,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4a5299['id'];return _0x1d8713();})[_0x6a41('0x2b')](function(_0x431b08){return _0x56c9b1(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x431b08[_0x6a41('0x1c')]||JSON[_0x6a41('0x2c')](_0x431b08)),null,_0x857e0c));});});}function checkHopper(){function _0x11ab1a(){return function(_0x3b3b5e){logger[_0x6a41('0x14')](_0x6a41('0x2d'),_0x6a41('0x2e'),util[_0x6a41('0x2f')](_0x3b3b5e,{'showHidden':![],'depth':null}));};}var _0x35279b=function(_0x145137,_0x20a5aa){var _0x5aa3dc=squel[_0x6a41('0x30')]()['into']('cm_hopper')[_0x6a41('0x31')]([_0x6a41('0x20'),'scheduledAt',_0x6a41('0x32'),_0x6a41('0x33'),_0x20a5aa,_0x6a41('0x34'),_0x6a41('0x35')],squel[_0x6a41('0x36')]()[_0x6a41('0x37')]('phone','phone')['field']('NOW()',_0x6a41('0x38'))['field']('id',_0x6a41('0x32'))[_0x6a41('0x37')](LISTID[_0x6a41('0x39')](),_0x6a41('0x33'))[_0x6a41('0x37')](_0x145137['id']['toString'](),_0x20a5aa)[_0x6a41('0x37')](_0x6a41('0x3a'),_0x6a41('0x34'))[_0x6a41('0x37')]('NOW()','updatedAt')[_0x6a41('0x3b')](_0x6a41('0x3c'))[_0x6a41('0x3d')]('deletedAt\x20IS\x20NULL')[_0x6a41('0x3d')](_0x6a41('0x3e'),LISTID[_0x6a41('0x39')]())[_0x6a41('0x3d')](_0x6a41('0x3f'))[_0x6a41('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6a41('0x36')]()[_0x6a41('0x37')](_0x6a41('0x20'))[_0x6a41('0x3b')](_0x6a41('0x40'))[_0x6a41('0x3d')](_0x20a5aa+_0x6a41('0x41'),_0x145137['id'][_0x6a41('0x39')]())))[_0x6a41('0x39')]();return _0x5aa3dc;};var _0x571a1d=function(_0x3ca774,_0x375810){var _0x1a50c0=squel['insert']()[_0x6a41('0x42')](_0x6a41('0x40'))[_0x6a41('0x31')]([_0x6a41('0x20'),_0x6a41('0x38'),_0x6a41('0x32'),_0x6a41('0x33'),_0x375810,_0x6a41('0x34'),'updatedAt'],squel['select']()['field'](_0x6a41('0x20'),_0x6a41('0x20'))[_0x6a41('0x37')]('NOW()',_0x6a41('0x38'))[_0x6a41('0x37')]('id',_0x6a41('0x32'))['field'](LISTID['toString'](),_0x6a41('0x33'))[_0x6a41('0x37')](_0x3ca774['id'][_0x6a41('0x39')](),_0x375810)['field']('NOW()',_0x6a41('0x34'))[_0x6a41('0x37')](_0x6a41('0x3a'),'updatedAt')[_0x6a41('0x3b')](_0x6a41('0x3c'))[_0x6a41('0x3d')]('deletedAt\x20IS\x20NULL')[_0x6a41('0x3d')](_0x6a41('0x3e'),LISTID[_0x6a41('0x39')]())['where'](_0x6a41('0x43'),squel[_0x6a41('0x44')](hopperContacts))[_0x6a41('0x3d')](_0x6a41('0x3f'))[_0x6a41('0x3d')](_0x6a41('0x45'),squel[_0x6a41('0x36')]()[_0x6a41('0x37')](_0x6a41('0x46'))[_0x6a41('0x3b')](_0x6a41('0x47'))[_0x6a41('0x3d')](_0x375810+_0x6a41('0x41'),_0x3ca774['id'][_0x6a41('0x39')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6a41('0x36')]()[_0x6a41('0x37')](_0x6a41('0x20'))[_0x6a41('0x3b')](_0x6a41('0x40'))[_0x6a41('0x3d')](_0x375810+_0x6a41('0x41'),_0x3ca774['id'][_0x6a41('0x39')]())))[_0x6a41('0x39')]();return _0x1a50c0;};function _0x83aee6(_0x378d1a,_0x3edadb){var _0x351299=squel['insert']()['into'](_0x6a41('0x40'))[_0x6a41('0x31')]([_0x6a41('0x20'),_0x6a41('0x38'),_0x6a41('0x32'),_0x6a41('0x33'),_0x3edadb,_0x6a41('0x34'),_0x6a41('0x35')],squel[_0x6a41('0x36')]()[_0x6a41('0x37')](_0x6a41('0x20'),'phone')['field'](_0x6a41('0x3a'),'scheduledAt')['field']('id','ContactId')[_0x6a41('0x37')](LISTID['toString'](),_0x6a41('0x33'))[_0x6a41('0x37')](_0x378d1a['id'][_0x6a41('0x39')](),_0x3edadb)[_0x6a41('0x37')](_0x6a41('0x3a'),'createdAt')[_0x6a41('0x37')](_0x6a41('0x3a'),_0x6a41('0x35'))[_0x6a41('0x3b')](_0x6a41('0x3c'))[_0x6a41('0x3d')](_0x6a41('0x48'))['where'](_0x6a41('0x3e'),LISTID['toString']())['where'](_0x6a41('0x43'),squel[_0x6a41('0x44')](hopperContacts))[_0x6a41('0x3d')](_0x6a41('0x3f')))[_0x6a41('0x39')]();return _0x351299;}function _0x1f3969(_0x5b9158,_0x51b56c){var _0x118686=squel[_0x6a41('0x30')]()['into'](_0x6a41('0x49'))[_0x6a41('0x31')]([_0x6a41('0x20'),'ContactId',_0x6a41('0x33'),_0x51b56c,_0x6a41('0x34'),_0x6a41('0x35')],squel[_0x6a41('0x36')]()[_0x6a41('0x37')](_0x6a41('0x20'),_0x6a41('0x20'))[_0x6a41('0x37')]('id','ContactId')[_0x6a41('0x37')](LISTID[_0x6a41('0x39')](),'ListId')['field'](_0x5b9158['id']['toString'](),_0x51b56c)['field']('NOW()',_0x6a41('0x34'))['field'](_0x6a41('0x3a'),'updatedAt')[_0x6a41('0x3b')](_0x6a41('0x3c'))[_0x6a41('0x3d')](_0x6a41('0x48'))[_0x6a41('0x3d')]('ListId\x20=\x20?',LISTID[_0x6a41('0x39')]())[_0x6a41('0x3d')](_0x6a41('0x43'),squel[_0x6a41('0x44')](hopperContacts))[_0x6a41('0x3d')](_0x6a41('0x3f')))['toString']();return _0x118686;}return db[_0x6a41('0x4a')][_0x6a41('0x4b')]({'where':{'type':'outbound'},'attributes':['id',_0x6a41('0x4c')],'include':[{'model':db[_0x6a41('0x4d')],'as':_0x6a41('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0xd99976){var _0x144ce8=[];if(_0xd99976){var _0x53acb2;for(var _0xacd6f0=0x0,_0x4e5c32;_0xacd6f0<_0xd99976[_0x6a41('0x1a')];_0xacd6f0+=0x1){_0x4e5c32=_0xd99976[_0xacd6f0][_0x6a41('0x4f')]({'plain':!![]});switch(_0x4e5c32[_0x6a41('0x4c')]){case _0x6a41('0x50'):_0x144ce8['push'](db['sequelize'][_0x6a41('0x51')](_0x571a1d(_0x4e5c32,_0x6a41('0x52')))['then'](function(){})[_0x6a41('0x2b')](_0x11ab1a()));break;case _0x6a41('0x53'):_0x144ce8['push'](db[_0x6a41('0x54')][_0x6a41('0x51')](_0x35279b(_0x4e5c32,_0x6a41('0x52')))[_0x6a41('0x55')](function(){})[_0x6a41('0x2b')](_0x11ab1a()));break;default:_0x144ce8[_0x6a41('0x29')](db['sequelize'][_0x6a41('0x51')](_0x83aee6(_0x4e5c32,_0x6a41('0x52')))[_0x6a41('0x55')](function(){})[_0x6a41('0x2b')](_0x11ab1a()));}}}return _0x144ce8;})[_0x6a41('0x56')]()[_0x6a41('0x55')](function(){return db[_0x6a41('0x4a')][_0x6a41('0x4b')]({'where':{'type':_0x6a41('0x57')},'attributes':['id'],'include':[{'model':db[_0x6a41('0x4d')],'as':_0x6a41('0x58'),'where':{'id':LISTID}}]})[_0x6a41('0x55')](function(_0x4cff4e){var _0x4a68=[];if(_0x4cff4e){var _0x57ccd8;for(var _0x54d103=0x0,_0xda6361;_0x54d103<_0x4cff4e[_0x6a41('0x1a')];_0x54d103+=0x1){_0xda6361=_0x4cff4e[_0x54d103]['get']({'plain':!![]});_0x4a68[_0x6a41('0x29')](db[_0x6a41('0x54')][_0x6a41('0x51')](_0x1f3969(_0xda6361,'VoiceQueueId'))['then'](function(){})[_0x6a41('0x2b')](_0x11ab1a()));}}return _0x4a68;})[_0x6a41('0x56')]();})[_0x6a41('0x55')](function(){return db[_0x6a41('0x59')]['findAll']({'attributes':['id',_0x6a41('0x4c')],'include':[{'model':db[_0x6a41('0x4d')],'as':_0x6a41('0x4e'),'where':{'id':LISTID}}]})[_0x6a41('0x55')](function(_0x738b58){var _0xcfbb1b=[];if(_0x738b58){for(var _0x45ae5c=0x0,_0x2da7d0;_0x45ae5c<_0x738b58[_0x6a41('0x1a')];_0x45ae5c+=0x1){_0x2da7d0=_0x738b58[_0x45ae5c][_0x6a41('0x4f')]({'plain':!![]});switch(_0x2da7d0[_0x6a41('0x4c')]){case _0x6a41('0x50'):_0xcfbb1b[_0x6a41('0x29')](db[_0x6a41('0x54')]['query'](_0x571a1d(_0x2da7d0,_0x6a41('0x5a')))['then'](function(){})['catch'](_0x11ab1a()));break;case _0x6a41('0x53'):_0xcfbb1b[_0x6a41('0x29')](db['sequelize'][_0x6a41('0x51')](_0x35279b(_0x2da7d0,'CampaignId'))['then'](function(){})[_0x6a41('0x2b')](_0x11ab1a()));break;default:_0xcfbb1b[_0x6a41('0x29')](db[_0x6a41('0x54')]['query'](_0x83aee6(_0x2da7d0,'CampaignId'))[_0x6a41('0x55')](function(){})['catch'](_0x11ab1a()));}}}return _0xcfbb1b;})[_0x6a41('0x56')]();})['then'](function(){return db[_0x6a41('0x59')][_0x6a41('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x6a41('0x4d')],'as':_0x6a41('0x58'),'where':{'id':LISTID}}]})[_0x6a41('0x55')](function(_0x205ac3){var _0x205edf=[];if(_0x205ac3){for(var _0x1cfecf=0x0,_0x26f117;_0x1cfecf<_0x205ac3['length'];_0x1cfecf+=0x1){_0x26f117=_0x205ac3[_0x1cfecf][_0x6a41('0x4f')]({'plain':!![]});_0x205edf['push'](db[_0x6a41('0x54')][_0x6a41('0x51')](_0x1f3969(_0x26f117,_0x6a41('0x5a')))[_0x6a41('0x55')](function(){})[_0x6a41('0x2b')](_0x11ab1a()));}}return _0x205edf;})[_0x6a41('0x56')]();})[_0x6a41('0x2b')](function(_0xcac634){logger['error'](_0x6a41('0x5b'),_0x6a41('0x5c'),_0xcac634[_0x6a41('0x1c')]);});}var processPromises=function(_0x5c4296){return BPromise['all'](promises)['then'](function(_0x5369a7){})[_0x6a41('0x2b')](function(_0x5e2872){logger['error'](_0x6a41('0x5d'),JSON[_0x6a41('0x2c')](_0x5e2872));})[_0x6a41('0x5e')](function(){socket[_0x6a41('0x5f')](_0x6a41('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5c4296){return _0x5c4296[_0x6a41('0x61')]();}});};var endCsv=function(){return BPromise[_0x6a41('0x62')]()[_0x6a41('0x55')](function(){if(hopperContacts){return checkHopper();}})[_0x6a41('0x55')](function(){socket['emit'](_0x6a41('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6a41('0x63')](FILEPATH);}catch(_0x25cd0a){logger[_0x6a41('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x6a41('0x2c')](_0x25cd0a));}finally{process[_0x6a41('0x64')](0x0);}});};process['on'](_0x6a41('0x65'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x6a41('0x62')]()[_0x6a41('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x6a41('0x26')][_0x6a41('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6a41('0x55')](function(_0x140a94){var _0x3345b7=fs[_0x6a41('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6a41('0x67')](_0x3345b7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5f5d23,_0x18e168){total+=0x1;var _0x5433c7=total;promises['push'](checkRow(_0x5f5d23,_0x140a94,_0x5433c7)[_0x6a41('0x55')](function(){success+=0x1;})[_0x6a41('0x2b')](function(_0x38594f){if(_0x38594f[_0x6a41('0x14')]){errors+=0x1;delete _0x38594f['error'];}else if(_0x38594f['duplicate']){duplicates+=0x1;delete _0x38594f[_0x6a41('0x68')];}rows['push'](_0x38594f);}));if(total%0xc8===0x0){_0x18e168[_0x6a41('0x69')]();return processPromises(_0x18e168);}},'complete':function(){return processPromises()['then'](function(){logger[_0x6a41('0x6a')](_0x6a41('0x6b'));endCsv();});},'error':function(_0x645c65,_0x13255a){logger[_0x6a41('0x6a')](_0x6a41('0x6c'),JSON[_0x6a41('0x2c')](_0x645c65));endCsv();}});})['catch'](function(_0x10257c){logger[_0x6a41('0x14')](_0x6a41('0x6d'),JSON[_0x6a41('0x2c')](_0x10257c));});}main(); \ No newline at end of file +var _0x5de0=['inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','field','phone','ContactId','toString','NOW()','updatedAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','Campaign','CampaignId','all','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','../../../mysqldb','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','then','push','Error\x20while\x20creating\x20contact:\x20','message','cmContact'];(function(_0x243e4c,_0x5614b7){var _0xf2e845=function(_0x1f7dc4){while(--_0x1f7dc4){_0x243e4c['push'](_0x243e4c['shift']());}};_0xf2e845(++_0x5614b7);}(_0x5de0,0x179));var _0x05de=function(_0x3b8476,_0x1a795d){_0x3b8476=_0x3b8476-0x0;var _0x430984=_0x5de0[_0x3b8476];return _0x430984;};'use strict';var BPromise=require(_0x05de('0x0'));var util=require(_0x05de('0x1'));var _=require(_0x05de('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x05de('0x3'));var Redis=require('ioredis');var db=require(_0x05de('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x05de('0x5')]=_[_0x05de('0x6')](config[_0x05de('0x5')],{'host':_0x05de('0x7'),'port':0x18eb});var socket=require(_0x05de('0x8'))(new Redis(config['redis']));require(_0x05de('0x9'))['register'](socket);try{if(!process[_0x05de('0xa')][0x2]||process[_0x05de('0xa')][0x2]===_0x05de('0xb')||process[_0x05de('0xa')][0x2]===_0x05de('0xc')){throw new Error(_0x05de('0xd'));}var FILEPATH=process[_0x05de('0xa')][0x2];if(!process[_0x05de('0xa')][0x3]||process[_0x05de('0xa')][0x3]===_0x05de('0xb')||process[_0x05de('0xa')][0x3]===_0x05de('0xc')||!process[_0x05de('0xa')][0x4]||process['argv'][0x4]===_0x05de('0xb')||process[_0x05de('0xa')][0x4]===_0x05de('0xc')){throw new Error(_0x05de('0xe'));}var FIELDS=_[_0x05de('0xf')](process['argv'][0x3][_0x05de('0x10')](','),process['argv'][0x4][_0x05de('0x10')](','));if(!process['argv'][0x5]||process[_0x05de('0xa')][0x5]==='undefined'||process[_0x05de('0xa')][0x5]===_0x05de('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x05de('0xa')][0x6]!==_0x05de('0xb')&&process[_0x05de('0xa')][0x6]!==_0x05de('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x05de('0xa')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0x05de('0xc')?process[_0x05de('0xa')][0x7]:null;if(!process[_0x05de('0xa')][0x8]||process[_0x05de('0xa')][0x8]===_0x05de('0xb')||process[_0x05de('0xa')][0x8]===_0x05de('0xc')){throw new Error(_0x05de('0x11'));}var SOCKET_TIMESTAMP=process[_0x05de('0xa')][0x8];}catch(_0x36f924){logger[_0x05de('0x12')](_0x36f924);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(_0x5f231e,_0x27f7cd,_0x415e67,_0x16a82a){var _0x579224={'message':_0x27f7cd};_0x579224[_0x5f231e]=!![];if(_0x415e67){_0x579224[_0x05de('0x13')]=_0x415e67;}if(_0x16a82a){_0x579224[_0x05de('0x14')]=_0x16a82a;}return _0x579224;}function isEmail(_0x1a0374){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))*$/[_0x05de('0x15')](_0x1a0374);}function checkRow(_0x499440,_0x2c2d74,_0x3c9562){return new BPromise(function(_0xbc8259,_0x57319c){if(_[_0x05de('0x16')](_0x499440)){return _0x57319c(handleCheckRowError(_0x05de('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3c9562));}if(_0x499440[_0x05de('0x17')]&&_0x499440[_0x05de('0x17')][_0x05de('0x18')]){var _0x53d55e=_[_0x05de('0x19')](_0x499440[_0x05de('0x17')],'message')['join'](';');return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x53d55e,null,_0x3c9562));}var _0x43813e={};for(var _0x2b3515 in FIELDS){if(FIELDS[_0x05de('0x1a')](_0x2b3515)&&FIELDS[_0x2b3515]){_0x43813e[_0x2b3515]=_0x499440[_0x05de('0x1b')][0x0][FIELDS[_0x2b3515]]||_0x499440['data'][0x0]['\ufeff'+FIELDS[_0x2b3515]];}}if(!_0x43813e['firstName']){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x1c'),null,_0x3c9562));}if(!_0x43813e['phone']){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x1d'),null,_0x3c9562));}if(_0x43813e[_0x05de('0x1e')]){var _0x5a5143=moment(_0x43813e[_0x05de('0x1e')],_0x05de('0x1f'));if(!_0x5a5143[_0x05de('0x20')]()){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x21'),null,_0x3c9562));}}if(_0x43813e[_0x05de('0x22')]){if(!isEmail(_0x43813e[_0x05de('0x22')])){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x23'),null,_0x3c9562));}}_0x43813e[_0x05de('0x24')]=LISTID;_0x43813e[_0x05de('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x05de('0x18')]&&_0x2c2d74){var _0x13b3d8={};for(var _0x4f57ce=0x0,_0xa75d2a=DUPLICATES['length'];_0x4f57ce<_0xa75d2a;_0x4f57ce+=0x1){_0x13b3d8[DUPLICATES[_0x4f57ce]]=_0x43813e[DUPLICATES[_0x4f57ce]];}var _0x19b09c=_[_0x05de('0x26')](_0x2c2d74,_0x13b3d8);if(_0x19b09c){return _0x57319c(handleCheckRowError(_0x05de('0x27'),_0x05de('0x28'),_0x19b09c,_0x3c9562));}}return db[_0x05de('0x29')]['create'](_0x43813e,{'raw':!![],'hooks':![],'fields':_['keys'](_0x43813e)})[_0x05de('0x2a')](function(_0x5f2406){if(DUPLICATES&&DUPLICATES[_0x05de('0x18')]&&_0x2c2d74){_0x2c2d74[_0x05de('0x2b')](_['pick'](_0x43813e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5f2406['id'];return _0xbc8259();})['catch'](function(_0x3726ba){return _0x57319c(handleCheckRowError(_0x05de('0x12'),_0x05de('0x2c')+(_0x3726ba[_0x05de('0x2d')]||JSON['stringify'](_0x3726ba)),null,_0x3c9562));});});}function checkHopper(){function _0x4c2c80(){return function(_0x177591){logger[_0x05de('0x12')](_0x05de('0x2e'),'checkHopper',util[_0x05de('0x2f')](_0x177591,{'showHidden':![],'depth':null}));};}var _0x4b1b0d=function(_0xad3ed4,_0x41cd35){var _0x2e0832=squel[_0x05de('0x30')]()[_0x05de('0x31')](_0x05de('0x32'))[_0x05de('0x33')](['phone',_0x05de('0x34'),'ContactId',_0x05de('0x24'),_0x41cd35,_0x05de('0x35'),'updatedAt'],squel['select']()[_0x05de('0x36')]('phone',_0x05de('0x37'))[_0x05de('0x36')]('NOW()','scheduledAt')[_0x05de('0x36')]('id',_0x05de('0x38'))[_0x05de('0x36')](LISTID[_0x05de('0x39')](),_0x05de('0x24'))['field'](_0xad3ed4['id'][_0x05de('0x39')](),_0x41cd35)[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x35'))[_0x05de('0x36')]('NOW()',_0x05de('0x3b'))[_0x05de('0x3c')]('cm_contacts')['where'](_0x05de('0x3d'))['where'](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())[_0x05de('0x3f')](_0x05de('0x40'))[_0x05de('0x3f')](_0x05de('0x41'),squel[_0x05de('0x42')]()['field'](_0x05de('0x37'))[_0x05de('0x3c')](_0x05de('0x32'))[_0x05de('0x3f')](_0x41cd35+_0x05de('0x43'),_0xad3ed4['id'][_0x05de('0x39')]())))['toString']();return _0x2e0832;};var _0x105ea9=function(_0x499a51,_0x4156e0){var _0x34a70f=squel['insert']()['into'](_0x05de('0x32'))[_0x05de('0x33')]([_0x05de('0x37'),_0x05de('0x34'),_0x05de('0x38'),_0x05de('0x24'),_0x4156e0,_0x05de('0x35'),'updatedAt'],squel[_0x05de('0x42')]()[_0x05de('0x36')]('phone',_0x05de('0x37'))['field']('NOW()',_0x05de('0x34'))[_0x05de('0x36')]('id',_0x05de('0x38'))[_0x05de('0x36')](LISTID[_0x05de('0x39')](),_0x05de('0x24'))[_0x05de('0x36')](_0x499a51['id']['toString'](),_0x4156e0)[_0x05de('0x36')]('NOW()',_0x05de('0x35'))[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x3b'))[_0x05de('0x3c')](_0x05de('0x44'))[_0x05de('0x3f')](_0x05de('0x3d'))['where'](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())[_0x05de('0x3f')](_0x05de('0x45'),squel[_0x05de('0x46')](hopperContacts))['where'](_0x05de('0x40'))[_0x05de('0x3f')](_0x05de('0x41'),squel['select']()[_0x05de('0x36')]('calleridnum')[_0x05de('0x3c')]('cm_hopper_final')[_0x05de('0x3f')](_0x4156e0+_0x05de('0x43'),_0x499a51['id'][_0x05de('0x39')]()))['where'](_0x05de('0x41'),squel[_0x05de('0x42')]()[_0x05de('0x36')](_0x05de('0x37'))['from'](_0x05de('0x32'))[_0x05de('0x3f')](_0x4156e0+'\x20=\x20?',_0x499a51['id']['toString']())))[_0x05de('0x39')]();return _0x34a70f;};function _0x2ef936(_0x34bb54,_0x724285){var _0x33f491=squel[_0x05de('0x30')]()[_0x05de('0x31')](_0x05de('0x32'))[_0x05de('0x33')]([_0x05de('0x37'),'scheduledAt',_0x05de('0x38'),_0x05de('0x24'),_0x724285,_0x05de('0x35'),'updatedAt'],squel[_0x05de('0x42')]()[_0x05de('0x36')](_0x05de('0x37'),_0x05de('0x37'))[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x34'))[_0x05de('0x36')]('id',_0x05de('0x38'))[_0x05de('0x36')](LISTID['toString'](),_0x05de('0x24'))['field'](_0x34bb54['id'][_0x05de('0x39')](),_0x724285)[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x35'))[_0x05de('0x36')](_0x05de('0x3a'),_0x05de('0x3b'))['from'](_0x05de('0x44'))[_0x05de('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())[_0x05de('0x3f')](_0x05de('0x45'),squel[_0x05de('0x46')](hopperContacts))[_0x05de('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x05de('0x39')]();return _0x33f491;}function _0x2ca806(_0x176c6b,_0xf1186e){var _0xee439=squel['insert']()['into'](_0x05de('0x47'))['fromQuery']([_0x05de('0x37'),_0x05de('0x38'),'ListId',_0xf1186e,_0x05de('0x35'),'updatedAt'],squel[_0x05de('0x42')]()[_0x05de('0x36')](_0x05de('0x37'),'phone')[_0x05de('0x36')]('id',_0x05de('0x38'))['field'](LISTID['toString'](),_0x05de('0x24'))['field'](_0x176c6b['id'][_0x05de('0x39')](),_0xf1186e)['field'](_0x05de('0x3a'),_0x05de('0x35'))['field'](_0x05de('0x3a'),_0x05de('0x3b'))[_0x05de('0x3c')](_0x05de('0x44'))[_0x05de('0x3f')](_0x05de('0x3d'))[_0x05de('0x3f')](_0x05de('0x3e'),LISTID[_0x05de('0x39')]())['where']('id\x20IN\x20?',squel[_0x05de('0x46')](hopperContacts))['where'](_0x05de('0x40')))[_0x05de('0x39')]();return _0xee439;}return db[_0x05de('0x48')][_0x05de('0x49')]({'where':{'type':_0x05de('0x4a')},'attributes':['id',_0x05de('0x4b')],'include':[{'model':db[_0x05de('0x4c')],'as':_0x05de('0x4d'),'where':{'id':LISTID}}]})['then'](function(_0x320b11){var _0x22568e=[];if(_0x320b11){var _0x4fb34d;for(var _0x481690=0x0,_0x456d05;_0x481690<_0x320b11[_0x05de('0x18')];_0x481690+=0x1){_0x456d05=_0x320b11[_0x481690][_0x05de('0x4e')]({'plain':!![]});switch(_0x456d05[_0x05de('0x4b')]){case _0x05de('0x4f'):_0x22568e[_0x05de('0x2b')](db[_0x05de('0x50')][_0x05de('0x51')](_0x105ea9(_0x456d05,_0x05de('0x52')))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));break;case _0x05de('0x54'):_0x22568e[_0x05de('0x2b')](db['sequelize'][_0x05de('0x51')](_0x4b1b0d(_0x456d05,'VoiceQueueId'))[_0x05de('0x2a')](function(){})[_0x05de('0x53')](_0x4c2c80()));break;default:_0x22568e[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x2ef936(_0x456d05,'VoiceQueueId'))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));}}}return _0x22568e;})['all']()['then'](function(){return db[_0x05de('0x48')][_0x05de('0x49')]({'where':{'type':_0x05de('0x4a')},'attributes':['id'],'include':[{'model':db[_0x05de('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x8f829b){var _0x1fce51=[];if(_0x8f829b){var _0x13fcfe;for(var _0x50a76a=0x0,_0x4d606e;_0x50a76a<_0x8f829b[_0x05de('0x18')];_0x50a76a+=0x1){_0x4d606e=_0x8f829b[_0x50a76a][_0x05de('0x4e')]({'plain':!![]});_0x1fce51[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x2ca806(_0x4d606e,'VoiceQueueId'))[_0x05de('0x2a')](function(){})['catch'](_0x4c2c80()));}}return _0x1fce51;})['all']();})[_0x05de('0x2a')](function(){return db[_0x05de('0x55')][_0x05de('0x49')]({'attributes':['id',_0x05de('0x4b')],'include':[{'model':db[_0x05de('0x4c')],'as':_0x05de('0x4d'),'where':{'id':LISTID}}]})[_0x05de('0x2a')](function(_0x2bff46){var _0x484ada=[];if(_0x2bff46){for(var _0xaf26fc=0x0,_0x14e92c;_0xaf26fc<_0x2bff46[_0x05de('0x18')];_0xaf26fc+=0x1){_0x14e92c=_0x2bff46[_0xaf26fc]['get']({'plain':!![]});switch(_0x14e92c[_0x05de('0x4b')]){case _0x05de('0x4f'):_0x484ada[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x105ea9(_0x14e92c,_0x05de('0x56')))[_0x05de('0x2a')](function(){})[_0x05de('0x53')](_0x4c2c80()));break;case _0x05de('0x54'):_0x484ada[_0x05de('0x2b')](db[_0x05de('0x50')]['query'](_0x4b1b0d(_0x14e92c,_0x05de('0x56')))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));break;default:_0x484ada[_0x05de('0x2b')](db[_0x05de('0x50')][_0x05de('0x51')](_0x2ef936(_0x14e92c,'CampaignId'))[_0x05de('0x2a')](function(){})[_0x05de('0x53')](_0x4c2c80()));}}}return _0x484ada;})[_0x05de('0x57')]();})[_0x05de('0x2a')](function(){return db['Campaign'][_0x05de('0x49')]({'attributes':['id'],'include':[{'model':db[_0x05de('0x4c')],'as':_0x05de('0x58'),'where':{'id':LISTID}}]})[_0x05de('0x2a')](function(_0x451f24){var _0x5c6c85=[];if(_0x451f24){for(var _0x4e5362=0x0,_0x170a6e;_0x4e5362<_0x451f24['length'];_0x4e5362+=0x1){_0x170a6e=_0x451f24[_0x4e5362][_0x05de('0x4e')]({'plain':!![]});_0x5c6c85[_0x05de('0x2b')](db[_0x05de('0x50')][_0x05de('0x51')](_0x2ca806(_0x170a6e,_0x05de('0x56')))['then'](function(){})[_0x05de('0x53')](_0x4c2c80()));}}return _0x5c6c85;})[_0x05de('0x57')]();})[_0x05de('0x53')](function(_0x57148c){logger[_0x05de('0x12')](_0x05de('0x59'),_0x05de('0x5a'),_0x57148c[_0x05de('0x2d')]);});}var processPromises=function(_0x449379){return BPromise[_0x05de('0x57')](promises)[_0x05de('0x2a')](function(_0x207452){})[_0x05de('0x53')](function(_0x3a9287){logger[_0x05de('0x12')](_0x05de('0x5b'),JSON[_0x05de('0x5c')](_0x3a9287));})['finally'](function(){socket[_0x05de('0x5d')](_0x05de('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x449379){return _0x449379[_0x05de('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x05de('0x2a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x05de('0x5d')](_0x05de('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x409e67){logger['error'](_0x05de('0x60'),JSON[_0x05de('0x5c')](_0x409e67));}finally{process[_0x05de('0x61')](0x0);}});};process['on'](_0x05de('0x62'),function(){logger[_0x05de('0x63')](_0x05de('0x64'));endCsv();});function main(){return BPromise[_0x05de('0x65')]()[_0x05de('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x05de('0x10')](',');return db[_0x05de('0x29')][_0x05de('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x05de('0x2a')](function(_0x2c08e6){var _0x304602=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x05de('0x66')](_0x304602,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c6434,_0x455300){total+=0x1;var _0x1f4708=total;promises[_0x05de('0x2b')](checkRow(_0x5c6434,_0x2c08e6,_0x1f4708)[_0x05de('0x2a')](function(){success+=0x1;})[_0x05de('0x53')](function(_0x2ee52a){if(_0x2ee52a[_0x05de('0x12')]){errors+=0x1;delete _0x2ee52a['error'];}else if(_0x2ee52a[_0x05de('0x27')]){duplicates+=0x1;delete _0x2ee52a[_0x05de('0x27')];}rows[_0x05de('0x2b')](_0x2ee52a);}));if(total%0xc8===0x0){_0x455300[_0x05de('0x67')]();return processPromises(_0x455300);}},'complete':function(){return processPromises()[_0x05de('0x2a')](function(){logger[_0x05de('0x63')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4bb6cd,_0x5a1698){logger['info'](_0x05de('0x68'),JSON[_0x05de('0x5c')](_0x4bb6cd));endCsv();}});})['catch'](function(_0x5dbf23){logger[_0x05de('0x12')](_0x05de('0x69'),JSON[_0x05de('0x5c')](_0x5dbf23));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 245dc9e..956fbfd 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 _0x1b4f=['\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','.CmListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','UserId','cm_hopper','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','message','exit','errors','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','timezones','dialTimezone','utcOffset','set','offset','main','stringify','start','binding','clone','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','header','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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()','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','DROP\x20TABLE\x20','finish','affectedRows','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','split','isNil','filter','push','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)'];(function(_0x3fb8ee,_0x2b0f23){var _0x1a2e74=function(_0x3a23c6){while(--_0x3a23c6){_0x3fb8ee['push'](_0x3fb8ee['shift']());}};_0x1a2e74(++_0x2b0f23);}(_0x1b4f,0x7b));var _0xf1b4=function(_0x520e83,_0x565ac7){_0x520e83=_0x520e83-0x0;var _0x4cd196=_0x1b4f[_0x520e83];return _0x4cd196;};'use strict';var fs=require('fs');var path=require(_0xf1b4('0x0'));var _=require(_0xf1b4('0x1'));var Papa=require(_0xf1b4('0x2'));var util=require(_0xf1b4('0x3'));var BPromise=require(_0xf1b4('0x4'));var moment=require(_0xf1b4('0x5'));var squel=require(_0xf1b4('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0xf1b4('0x7'));var logger=require(_0xf1b4('0x8'))(_0xf1b4('0x9'));config[_0xf1b4('0xa')]=_[_0xf1b4('0xb')](config[_0xf1b4('0xa')],{'host':_0xf1b4('0xc'),'port':0x18eb});var socket=require(_0xf1b4('0xd'))(new Redis(config[_0xf1b4('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xf1b4('0xe')](_0xf1b4('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xf1b4('0xf'));function isEmail(_0x1fbb34){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))*$/[_0xf1b4('0x10')](_0x1fbb34);}function selectNotIn(_0x1bfb3,_0x1293b2,_0x35d4f4,_0x459654,_0x14d0cf){return squel[_0xf1b4('0x11')]()[_0xf1b4('0x12')](_0xf1b4('0x13'))[_0xf1b4('0x14')](_0x459654)[_0xf1b4('0x15')](_0x1293b2,null,_0x1293b2+_0xf1b4('0x16')+_0x459654+'.'+_0x35d4f4)[_0xf1b4('0x17')](_0x459654+'.'+_0x35d4f4+_0xf1b4('0x18')+_0x1bfb3+'.'+_0x35d4f4)[_0xf1b4('0x17')](_0x1293b2+_0xf1b4('0x19')+_0x14d0cf[_0xf1b4('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x54ef41,_0x365234){promisesAdditionalPhones=[];return db['CmContact'][_0xf1b4('0x1a')]({'raw':!![],'attributes':['id',_0xf1b4('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xf1b4('0x1c')](function(_0x3ee658){if(_0x3ee658!==null){var _0x174f02=[];for(var _0x5ca51a=0x0;_0x5ca51a<_0x3ee658[_0xf1b4('0x1d')];_0x5ca51a++){var _0x4f2f89=_0x3ee658[_0x5ca51a];_0x174f02['push'](insertAdditionalPhones(_0x4f2f89));}}Promise['all'](_0x174f02)['then'](function(){_0x54ef41({'val':0x1});});});});}function insertAdditionalPhones(_0x528793){return new Promise(function(_0x4bf87d,_0x5b11ab){var _0x3b69ce=_0x528793[_0xf1b4('0x1b')];var _0x54e9a9=_0x3b69ce['split'](';');var _0x47cb31=[];orderBy=0x0;for(var _0x5c2fa0=0x0;_0x5c2fa0<_0x54e9a9[_0xf1b4('0x1d')];_0x5c2fa0++){_0x47cb31['push'](splitAdditionalPhone(_0x528793['id'],_0x54e9a9[_0x5c2fa0]));}Promise['all'](_0x47cb31)[_0xf1b4('0x1c')](function(){_0x4bf87d({'val':_0x54e9a9[_0xf1b4('0x1d')]});});});}function splitAdditionalPhone(_0x49643c,_0x4b425f){return new Promise(function(_0x33e07a,_0x4e40d3){var _0x2de728=_0x4b425f[_0xf1b4('0x1e')](':');var _0x585f85=_0x2de728[0x0];var _0x3d82f5=_0x2de728[0x1];if(!_[_0xf1b4('0x1f')](_0x3d82f5)){var _0x49ca3f=_0x3d82f5[_0xf1b4('0x1e')]('|');var _0x19ee40=[];for(var _0x590e78=0x0;_0x590e78<_0x49ca3f[_0xf1b4('0x1d')];_0x590e78++){if(_0x49ca3f[_0x590e78]!==''){var _0x512155=_[_0xf1b4('0x20')](promisesAdditionalPhones,{'contactId':_0x49643c,'phone':_0x49ca3f[_0x590e78]});if(_0x512155['length']==0x0){orderBy++;promisesAdditionalPhones[_0xf1b4('0x21')]({'contactId':_0x49643c,'contactTypeId':_0x585f85,'phone':_0x49ca3f[_0x590e78],'orderBy':orderBy});}}}_0x33e07a({'ok':0x1});}else _0x33e07a({'res':0x0});});}function createAdditionalPhone(_0xe934c7,_0x5faf78,_0x4d81bf,_0xe8c8f1){var _0x364916='';var _0x2f7869='';var _0x355753=_0x4d81bf[_0xf1b4('0x1e')]('§');_0x364916=_0x355753[0x0];if(_0x355753[_0xf1b4('0x1d')]==0x2)_0x2f7869=_0x355753[0x1];return new Promise(function(_0x401694,_0x23e4b0){return db[_0xf1b4('0x22')]['findOne']({'where':{'CmContactId':_0xe934c7,'item':_0x364916}})[_0xf1b4('0x1c')](function(_0x2ffd38){if(_0x2ffd38){return db['CmContactHasItem'][_0xf1b4('0x23')]({'ItemTypeId':_0x5faf78,'description':_0x2f7869,'OrderBy':_0xe8c8f1},{'where':{'CmContactId':_0xe934c7,'item':_0x364916}})[_0xf1b4('0x1c')](function(_0x1acca9){_0x401694({'res':_0xf1b4('0x24')});});}else{return db[_0xf1b4('0x22')][_0xf1b4('0x25')]({'CmContactId':_0xe934c7,'item':_0x364916,'description':_0x2f7869,'ItemTypeId':_0x5faf78,'OrderBy':_0xe8c8f1,'ItemClass':_0xf1b4('0x26')})[_0xf1b4('0x1c')](function(_0x11c696){_0x401694({'res':_0xf1b4('0x27')});});}});});}function insertCmHopper(_0x35b0eb,_0x3a0dfb,_0x36195c,_0x4aaf2d,_0x21244e){var _0x3d7603=[_0xf1b4('0x28'),_0xf1b4('0x29'),_0xf1b4('0x2a'),_0xf1b4('0x2b'),_0x3a0dfb+'.'+_0x4aaf2d,'cm_contacts.createdAt',_0xf1b4('0x2c'),_0xf1b4('0x2d'),'cm_contacts.UserId','\x22'+_0x21244e+'\x22'];return squel[_0xf1b4('0x2e')]()[_0xf1b4('0x2f')]('cm_hopper')[_0xf1b4('0x30')]([_0xf1b4('0x13'),_0xf1b4('0x31'),_0xf1b4('0x32'),_0xf1b4('0x33'),_0x4aaf2d,_0xf1b4('0x34'),_0xf1b4('0x35'),_0xf1b4('0x36'),'UserId',_0xf1b4('0x37')],squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')](_0x3d7603)[_0xf1b4('0x14')](_0x3a0dfb)[_0xf1b4('0x15')](_0xf1b4('0x39'),null,_0xf1b4('0x3a')+_0x3a0dfb+'.CmListId')['join'](_0x36195c,null,_0x36195c+_0xf1b4('0x16')+_0x3a0dfb+'.'+_0x4aaf2d)[_0xf1b4('0x17')](_0x3a0dfb+_0xf1b4('0x3b'),_0x35b0eb)[_0xf1b4('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf1b4('0x17')](_0xf1b4('0x3c'),selectNotIn(_0x3a0dfb,_0x36195c,_0x4aaf2d,'cm_hopper',[_0xf1b4('0x3d'),_0xf1b4('0x3e')]))[_0xf1b4('0x17')](_0xf1b4('0x3c'),selectNotIn(_0x3a0dfb,_0x36195c,_0x4aaf2d,'cm_hopper',[_0xf1b4('0x3d')])))[_0xf1b4('0x3f')]();}function insertCmHopperBlack(_0x1780dc,_0xfffb3,_0x305207,_0x4e145b){var _0x4b7fa6=[_0xf1b4('0x28'),_0xf1b4('0x2a'),'cm_contacts.ListId',_0xfffb3+'.'+_0x4e145b,_0xf1b4('0x40'),_0xf1b4('0x2c')];return squel[_0xf1b4('0x2e')]()[_0xf1b4('0x2f')](_0xf1b4('0x41'))[_0xf1b4('0x30')](['phone','ContactId',_0xf1b4('0x33'),_0x4e145b,_0xf1b4('0x34'),_0xf1b4('0x35')],squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')](_0x4b7fa6)[_0xf1b4('0x14')](_0xfffb3)[_0xf1b4('0x15')](_0xf1b4('0x39'),null,_0xf1b4('0x3a')+_0xfffb3+_0xf1b4('0x42'))[_0xf1b4('0x15')](_0x305207,null,_0x305207+_0xf1b4('0x16')+_0xfffb3+'.'+_0x4e145b)[_0xf1b4('0x17')](_0xfffb3+_0xf1b4('0x3b'),_0x1780dc)[_0xf1b4('0x17')](_0xf1b4('0x43'),NOW)[_0xf1b4('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf1b4('0x11')]()[_0xf1b4('0x12')](_0xf1b4('0x13'))[_0xf1b4('0x14')](_0xf1b4('0x41'))[_0xf1b4('0x17')](_0xf1b4('0x44'),_0x1780dc)[_0xf1b4('0x17')](_0x4e145b+_0xf1b4('0x18')+_0xfffb3+'.'+_0x4e145b)))['toString']();}function insertTzCmHopper(_0x3b240a,_0x5216bd,_0x43dce6,_0x249a59,_0x21da91,_0x16f5b2){var _0x3116ab=[_0xf1b4('0x28'),_0xf1b4('0x45')+_0x16f5b2+'.offset-cm_contacts.utcOffset\x20minute)',_0xf1b4('0x2a'),_0xf1b4('0x2b'),_0x5216bd+'.'+_0x249a59,'cm_contacts.createdAt',_0xf1b4('0x2c'),_0xf1b4('0x2d'),'cm_contacts.UserId','\x22'+_0x21da91+'\x22'];var _0x1689a7=squel[_0xf1b4('0x2e')]()[_0xf1b4('0x2f')]('cm_hopper')['fromQuery'](['phone',_0xf1b4('0x31'),_0xf1b4('0x32'),_0xf1b4('0x33'),_0x249a59,_0xf1b4('0x34'),'updatedAt',_0xf1b4('0x36'),_0xf1b4('0x46'),_0xf1b4('0x37')],squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')](_0x3116ab)['from'](_0x5216bd)[_0xf1b4('0x15')](_0xf1b4('0x39'),null,_0xf1b4('0x3a')+_0x5216bd+_0xf1b4('0x42'))[_0xf1b4('0x15')](_0x43dce6,null,_0x43dce6+'.id\x20=\x20'+_0x5216bd+'.'+_0x249a59)[_0xf1b4('0x15')](_0x16f5b2,null,_0x16f5b2+_0xf1b4('0x16')+_0x5216bd+'.'+_0x249a59)[_0xf1b4('0x17')](_0x5216bd+_0xf1b4('0x3b'),_0x3b240a)[_0xf1b4('0x17')](_0xf1b4('0x43'),NOW)[_0xf1b4('0x17')](_0xf1b4('0x3c'),selectNotIn(_0x5216bd,_0x43dce6,_0x249a59,'cm_hopper',[_0xf1b4('0x3d'),'\x22onlyIfOpen\x22']))[_0xf1b4('0x17')](_0xf1b4('0x3c'),selectNotIn(_0x5216bd,_0x43dce6,_0x249a59,_0xf1b4('0x47'),[_0xf1b4('0x3d')])))[_0xf1b4('0x3f')]();return _0x1689a7;}function insertTzCmHopperBlack(_0x374148,_0x308b72,_0x1dc53b,_0x5694a3){var _0x8ac663=[_0xf1b4('0x28'),_0xf1b4('0x2a'),_0xf1b4('0x2b'),_0x308b72+'.'+_0x5694a3,_0xf1b4('0x40'),'cm_contacts.updatedAt'];return squel[_0xf1b4('0x2e')]()[_0xf1b4('0x2f')](_0xf1b4('0x41'))['fromQuery'](['phone',_0xf1b4('0x32'),_0xf1b4('0x33'),_0x5694a3,_0xf1b4('0x34'),_0xf1b4('0x35')],squel['select']()[_0xf1b4('0x38')](_0x8ac663)[_0xf1b4('0x14')](_0x308b72)['join']('cm_contacts',null,_0xf1b4('0x3a')+_0x308b72+_0xf1b4('0x42'))[_0xf1b4('0x15')](_0x1dc53b,null,_0x1dc53b+_0xf1b4('0x16')+_0x308b72+'.'+_0x5694a3)[_0xf1b4('0x17')](_0x308b72+'.CmListId\x20=\x20?',_0x374148)[_0xf1b4('0x17')](_0xf1b4('0x43'),NOW)[_0xf1b4('0x17')](_0xf1b4('0x3c'),squel['select']()[_0xf1b4('0x12')](_0xf1b4('0x13'))[_0xf1b4('0x14')](_0xf1b4('0x41'))[_0xf1b4('0x17')](_0xf1b4('0x44'),_0x374148)[_0xf1b4('0x17')](_0x5694a3+_0xf1b4('0x18')+_0x308b72+'.'+_0x5694a3)))[_0xf1b4('0x3f')]();}function insertCmHopperAdditionalPhones(_0x18fad7){var _0x32e900=[_0xf1b4('0x48'),_0xf1b4('0x49'),_0xf1b4('0x4a'),_0xf1b4('0x4b'),_0xf1b4('0x4c')];return squel['insert']()[_0xf1b4('0x2f')]('cm_hopper_additional_phones')[_0xf1b4('0x30')]([_0xf1b4('0x4d'),_0xf1b4('0x13'),_0xf1b4('0x4e'),_0xf1b4('0x34'),_0xf1b4('0x35')],squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')](_0x32e900)[_0xf1b4('0x14')](_0xf1b4('0x47'))[_0xf1b4('0x15')](_0xf1b4('0x39'),null,_0xf1b4('0x4f'))[_0xf1b4('0x15')](_0xf1b4('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf1b4('0x17')](_0xf1b4('0x51'),_0x18fad7)[_0xf1b4('0x17')](_0xf1b4('0x43'),NOW))[_0xf1b4('0x3f')]();}function insertCmContact(_0x1182a7,_0x411f19,_0x5b2258,_0x9c9375){var _0x11c0a7=_[_0xf1b4('0x52')](_[_0xf1b4('0x53')](_0x9c9375),[_0xf1b4('0x33'),_0xf1b4('0x54'),'createdAt','updatedAt',_0xf1b4('0x55')]);return squel[_0xf1b4('0x2e')]()[_0xf1b4('0x2f')](_0xf1b4('0x39'))[_0xf1b4('0x30')](_0x11c0a7,squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')](_0x11c0a7)[_0xf1b4('0x14')](_0x411f19)[_0xf1b4('0x17')]('('+_0x5b2258[_0xf1b4('0x15')](',')+_0xf1b4('0x56'),squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')](_0x5b2258)[_0xf1b4('0x14')](_0xf1b4('0x39'))[_0xf1b4('0x17')](_0xf1b4('0x44'),_0x1182a7)[_0xf1b4('0x17')](_0xf1b4('0x57')))['where'](_0xf1b4('0x58'),squel[_0xf1b4('0x11')]()[_0xf1b4('0x12')](_0xf1b4('0x59'),'min_id')['from'](_0x411f19)[_0xf1b4('0x5a')](_0x5b2258['join'](','))))[_0xf1b4('0x3f')]();}function handleStop(){logger[_0xf1b4('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x258c78){logger['error'](_0x258c78[_0xf1b4('0x5c')]);process[_0xf1b4('0x5d')](0x1);}function handleError(_0x256ef2,_0x36ca2c){stats[_0xf1b4('0x5e')][_0xf1b4('0x21')]({'name':_0x36ca2c['code'],'message':_0x36ca2c[_0xf1b4('0x5c')],'row':_0x256ef2});}function handleQuery(_0x54717a){logger[_0xf1b4('0x5b')](_0x54717a);return db['sequelize']['query'](_0x54717a)[_0xf1b4('0x5f')](function(_0x3ea2ce){results[_0xf1b4('0x21')](_0x3ea2ce);})[_0xf1b4('0x60')](function(_0x531150){logger[_0xf1b4('0x61')](_0x531150[_0xf1b4('0x5c')]);});}function updateTzCampaigns(_0x34ab62){return new Promise(function(_0x4228cb,_0x524a01){var _0x4f84c3=squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')]([_0xf1b4('0x62'),_0xf1b4('0x63')])[_0xf1b4('0x14')](_0xf1b4('0x64'))[_0xf1b4('0x15')](_0xf1b4('0x65'),null,_0xf1b4('0x66'))[_0xf1b4('0x17')](_0xf1b4('0x67')+_0x34ab62);db[_0xf1b4('0x68')][_0xf1b4('0x69')](_0x4f84c3[_0xf1b4('0x3f')]())[_0xf1b4('0x5f')](function(_0x381c14){var _0x14a47a=[];for(var _0x11cd10=0x0;_0x11cd10<_0x381c14[_0xf1b4('0x1d')];_0x11cd10++){_0x14a47a['push'](getTimezoneData(_0x381c14[_0x11cd10],tmp_campaigns));}BPromise['all'](_0x14a47a)[_0xf1b4('0x1c')](function(){_0x4228cb({'val':0x1});});})[_0xf1b4('0x60')](function(_0x2144e5){logger[_0xf1b4('0x61')](_0x2144e5['message']);_0x4228cb({'val':0x0});});});}function updateTzVoiceQueues(_0x2916f){return new Promise(function(_0x3cfc8c,_0x11fde0){var _0x4d4321=squel[_0xf1b4('0x11')]()[_0xf1b4('0x38')]([_0xf1b4('0x6a'),_0xf1b4('0x6b')])['from'](_0xf1b4('0x6c'))[_0xf1b4('0x15')]('voice_queues_has_cm_lists',null,_0xf1b4('0x6d'))[_0xf1b4('0x17')](_0xf1b4('0x6e')+_0x2916f);db[_0xf1b4('0x68')]['query'](_0x4d4321['toString']())[_0xf1b4('0x5f')](function(_0xc1b0c9){var _0x5def80=[];for(var _0x927f2b=0x0;_0x927f2b<_0xc1b0c9[_0xf1b4('0x1d')];_0x927f2b++){_0x5def80[_0xf1b4('0x21')](getTimezoneData(_0xc1b0c9[_0x927f2b],tmp_voice_queues));}BPromise[_0xf1b4('0x6f')](_0x5def80)[_0xf1b4('0x1c')](function(){_0x3cfc8c({'val':0x1});});})[_0xf1b4('0x60')](function(_0x5ab416){logger[_0xf1b4('0x61')](_0x5ab416[_0xf1b4('0x5c')]);_0x3cfc8c({'val':0x0});});});}function getTimezoneData(_0x1e4816,_0x543645){return new Promise(function(_0x489488,_0x566c6c){var _0x27ba4a=shared[_0xf1b4('0x70')];var _0x36cba9=_0x27ba4a[_0x1e4816[_0xf1b4('0x71')]];if(_['isNil'](_0x36cba9)){_0x489488({'ret':0x1});}else{var _0x46f98a=_0x36cba9[_0xf1b4('0x72')];var _0x29dad8=squel[_0xf1b4('0x2e')]()[_0xf1b4('0x2f')](_0x543645)[_0xf1b4('0x73')]('id',_0x1e4816['id'])[_0xf1b4('0x73')](_0xf1b4('0x74'),_0x46f98a)[_0xf1b4('0x73')]('dialTimezone',_0x1e4816['dialTimezone'])[_0xf1b4('0x3f')]();return db[_0xf1b4('0x68')][_0xf1b4('0x69')](_0x29dad8)[_0xf1b4('0x5f')](function(_0x32f966){_0x489488({'ret':0x1});})[_0xf1b4('0x60')](function(_0x53e0d0){logger['error'](_0x53e0d0[_0xf1b4('0x5c')]);_0x566c6c({'ret':0x1});});}});}function handleTZQuery(_0x443532){logger[_0xf1b4('0x5b')](_0x443532);return db['sequelize']['query'](_0x443532)[_0xf1b4('0x5f')](function(_0x5d15aa){})['catch'](function(_0x5b968c){logger[_0xf1b4('0x61')](_0x5b968c[_0xf1b4('0x5c')]);});}function main(_0xe429f5,_0x58030f,_0x4d49e0,_0x3593e1){logger['info'](_0xf1b4('0x75'),_0xe429f5,JSON[_0xf1b4('0x76')](_0x58030f));process['send'](_0xf1b4('0x77'));var _0xa818f1=_0x58030f[_0xf1b4('0x78')];var _0x3012ce=_[_0xf1b4('0x79')](_0xa818f1);var _0x143209=_0x58030f['socket_timestamp'];var _0x4aa2f4=path[_0xf1b4('0x15')](config[_0xf1b4('0x7a')],_0xf1b4('0x7b'),_0x143209+_0xf1b4('0x7c'));hasTZ=_[_0xf1b4('0x53')](_0xa818f1)[_0xf1b4('0x7d')]('dialTimezone');var _0x30fc59=_[_0xf1b4('0x53')](_0xa818f1)[_0xf1b4('0x15')]();logger[_0xf1b4('0x5b')]('header',_0x30fc59);db[_0xf1b4('0x7e')]['findAll']({'raw':!![],'attributes':['id',_0xf1b4('0x7f')]})[_0xf1b4('0x1c')](function(_0x19ba90){for(var _0x2e8c1e=0x0;_0x2e8c1e<_0x19ba90[_0xf1b4('0x1d')];_0x2e8c1e++){if(_0x19ba90[_0x2e8c1e]['name']in _0xa818f1){contactItemTypes[_0xf1b4('0x21')](_0x19ba90[_0x2e8c1e]);delete _0x3012ce[_0x19ba90[_0x2e8c1e][_0xf1b4('0x7f')]];hasAdditionalPhones=!![];}for(var _0x59be43 in _0xa818f1){if(_0x19ba90[_0x2e8c1e][_0xf1b4('0x7f')]+_0xf1b4('0x80')===_0x59be43){phoneDescriptions[_0xf1b4('0x21')]({'itemTypeId':_0x19ba90[_0x2e8c1e]['id'],'description':_0x59be43});delete _0x3012ce[_0x59be43];}}}if(hasAdditionalPhones)_0x3012ce['AdditionalPhones']='';var _0x186231=_[_0xf1b4('0x53')](_0x3012ce)[_0xf1b4('0x15')]();logger['info'](_0xf1b4('0x81'),_0x186231);fs['writeFileSync'](_0x4aa2f4,_0x186231+'\x0a');Papa['parse'](fs['createReadStream'](_0xe429f5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x45ea8e,_0x335dfe){try{for(var _0x4054a2=0x0,_0x3f2045=[];_0x4054a2<_0x45ea8e[_0xf1b4('0x82')][_0xf1b4('0x1d')];_0x4054a2++){stats[_0xf1b4('0x83')]+=0x1;if(_0x45ea8e['errors'][_0x4054a2]){handleError(_0x45ea8e[_0xf1b4('0x82')][_0x4054a2],_0x45ea8e[_0xf1b4('0x5e')][_0x4054a2]);}else{var _0x1ae099=[];var _0x17f93c=[];var _0x192622={};for(var _0x289de4 in _0xa818f1){let _0x1c6a65=contactItemTypes[_0xf1b4('0x84')](_0x2a6b3b=>_0x2a6b3b[_0xf1b4('0x7f')]===_0x289de4);let _0xff67fe=contactItemTypes[_0xf1b4('0x84')](_0x5b2298=>_0x5b2298[_0xf1b4('0x7f')]+_0xf1b4('0x80')===_0x289de4);if(_[_0xf1b4('0x1f')](_0x1c6a65)&&_['isNil'](_0xff67fe)){if(_0xa818f1[_0xf1b4('0x85')](_0x289de4)){if(_0x45ea8e[_0xf1b4('0x82')][_0x4054a2][_0xa818f1[_0x289de4]]){var _0x5d1847=_[_0xf1b4('0x86')](_0x45ea8e[_0xf1b4('0x82')][_0x4054a2][_0xa818f1[_0x289de4]][_0xf1b4('0x87')](/"/g,'\x27'));switch(_0x289de4){case'scheduledat':var _0x560740=moment(_0x5d1847,_0xf1b4('0xf'),!![]);if(_0x560740['isValid']()){_0x3f2045[_0xf1b4('0x21')]('\x22'+_0x5d1847+'\x22');}else{_0x1ae099[_0xf1b4('0x21')](_0xf1b4('0x88'));}break;case _0xf1b4('0x36'):var _0x4c072d=parseInt(_0x5d1847);_0x5d1847=_[_0xf1b4('0x89')](_0x4c072d)||_0x4c072d<0x0||_0x4c072d>0x4?_0x3593e1?0x3:0x2:_0x4c072d;_0x3f2045[_0xf1b4('0x21')]('\x22'+_0x5d1847+'\x22');break;case'UserId':var _0x208cf9=parseInt(_0x5d1847);if(_[_0xf1b4('0x8a')](_0x208cf9)&&_[_0xf1b4('0x7d')](_0x4d49e0,_0x208cf9)){_0x3f2045[_0xf1b4('0x21')]('\x22'+_0x208cf9+'\x22');}else{_0x1ae099['push'](_0xf1b4('0x8b'));}break;case _0xf1b4('0x8c'):if(isEmail(_0x5d1847)){_0x3f2045[_0xf1b4('0x21')]('\x22'+_0x5d1847+'\x22');}else{_0x1ae099[_0xf1b4('0x21')]('email\x20wrong\x20format');}break;case _0xf1b4('0x8d'):var _0x9f1e5a=moment(_0x5d1847,_0xf1b4('0x8e'),!![]);if(_0x9f1e5a[_0xf1b4('0x8f')]()){_0x3f2045['push']('\x22'+_0x5d1847+'\x22');}else{_0x1ae099['push'](_0xf1b4('0x90'));}break;case _0xf1b4('0x71'):var _0x47b505=shared[_0xf1b4('0x70')];var _0x616bf5=_0x47b505[_0x5d1847];if(!_['isNil'](_0x616bf5)){var _0x4b9d85=_0x616bf5['utcOffset'];_0x3f2045[_0xf1b4('0x21')]('\x22'+_0x5d1847+'\x22');_0x3f2045['push']('\x22'+_0x4b9d85+'\x22');}break;default:_0x3f2045[_0xf1b4('0x21')]('\x22'+_0x5d1847+'\x22');}}else{switch(_0x289de4){case'firstName':case'phone':_0x1ae099['push'](_0x289de4+_0xf1b4('0x91'));break;default:_0x3f2045['push']('\x22\x22');}}}}else{var _0x2649f0='';if(!_['isNil'](_0x1c6a65)){if(!_0x192622[_0xf1b4('0x85')](_0x1c6a65['id'])){if(!_[_0xf1b4('0x1f')](_0x45ea8e[_0xf1b4('0x82')][_0x4054a2][_0xa818f1[_0x289de4]])){var _0x5d1847=_[_0xf1b4('0x86')](_0x45ea8e['data'][_0x4054a2][_0xa818f1[_0x289de4]][_0xf1b4('0x87')](/"/g,'\x27'));var _0x181289=phoneDescriptions[_0xf1b4('0x84')](_0x174773=>_0x174773[_0xf1b4('0x92')]===_0x1c6a65['id']);if(!_['isNil'](_0x181289)){var _0x340cdc=_[_0xf1b4('0x86')](_0x45ea8e[_0xf1b4('0x82')][_0x4054a2][_0xa818f1[_0x181289[_0xf1b4('0x93')]]][_0xf1b4('0x87')](/"/g,'\x27'));if(!_['isNil'](_0x340cdc))_0x5d1847=_0x5d1847+'§'+_0x340cdc;}if(_0x2649f0=='')_0x2649f0=_0x5d1847;else _0x2649f0+='|'+_0x5d1847;}_0x17f93c[_0xf1b4('0x21')](_0x1c6a65['id']+':'+_0x2649f0);_0x192622[_0x1c6a65['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3f2045['push']('\x22'+_0x17f93c[_0xf1b4('0x15')](';')+'\x22');}if(_0x1ae099[_0xf1b4('0x1d')]){handleError(_0x45ea8e[_0xf1b4('0x82')][_0x4054a2],{'code':_0xf1b4('0x94'),'message':_0x1ae099[_0xf1b4('0x15')]()});}else{fs[_0xf1b4('0x95')](_0x4aa2f4,_0x3f2045[_0xf1b4('0x15')]()+'\x0a');}_0x3f2045=[];}if(!(stats[_0xf1b4('0x83')]%0xc8)){socket[_0xf1b4('0x96')](_0xf1b4('0x97')+_0x143209,stats);stats[_0xf1b4('0x5e')]=[];}}if(stopped){logger[_0xf1b4('0x5b')]('Abort\x20parser');_0x335dfe['abort']();}}catch(_0x5e9198){handleError(_0x45ea8e[_0xf1b4('0x82')][_0x4054a2],{'code':'SystemError','message':_0x5e9198['message']});logger[_0xf1b4('0x61')]('step',_0x5e9198[_0xf1b4('0x5c')]);}},'complete':function(){try{var _0x4da1ba=[];var _0x5a61a5=[];var _0x35c9bd=_0xf1b4('0x39');if(_0x58030f[_0xf1b4('0x98')]&&_0x58030f[_0xf1b4('0x98')][_0xf1b4('0x1d')]){_0x35c9bd=_0xf1b4('0x99')+_0x143209;_0x4da1ba[_0xf1b4('0x21')](_0xf1b4('0x9a')+_0x35c9bd+_0xf1b4('0x9b'));}tmp_campaigns=_0xf1b4('0x9c')+_0x143209;tmp_voice_queues=_0xf1b4('0x9d')+_0x143209;_0x5a61a5['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0xf1b4('0x9e'));_0x5a61a5[_0xf1b4('0x21')](_0xf1b4('0x9a')+tmp_voice_queues+_0xf1b4('0x9e'));BPromise[_0xf1b4('0x9f')](_0x5a61a5,handleTZQuery)['then'](function(_0x325c94){updateTzCampaigns(_0x58030f[_0xf1b4('0x33')])['then'](function(_0x4f6473){updateTzVoiceQueues(_0x58030f[_0xf1b4('0x33')])[_0xf1b4('0x1c')](function(_0x3ee399){if(hasTZ)_0x186231=_0x186231[_0xf1b4('0x87')]('dialTimezone','dialTimezone,utcOffset');var _0x366d0d=util['format'](_0xf1b4('0xa0'),_0x4aa2f4,_0x35c9bd,_0x186231,_0x58030f[_0xf1b4('0x33')],_0x58030f[_0xf1b4('0x54')]||null,NOW,NOW);if(_[_0xf1b4('0x1f')](_0xa818f1[_0xf1b4('0x31')])){_0x366d0d+=_0xf1b4('0xa1');}_0x4da1ba['push'](_0x366d0d);if(_0x58030f[_0xf1b4('0x98')]&&_0x58030f['duplicates']['length']){_0x4da1ba['push'](insertCmContact(_0x58030f['ListId'],_0x35c9bd,_0x58030f[_0xf1b4('0x98')],_0xa818f1));_0x4da1ba[_0xf1b4('0x21')]('DROP\x20TABLE\x20'+_0x35c9bd+';');}BPromise['each'](_0x4da1ba,handleQuery)[_0xf1b4('0x1c')](function(_0x3c8651){BPromise['all']([handleAdditionalPhones()])[_0xf1b4('0x1c')](function(){_0x4da1ba=[];for(var _0xd98504=0x0;_0xd98504_0x7d41a7['name']===_0x4d1b1e);let _0x4a4c43=contactItemTypes['find'](_0x33f7ea=>_0x33f7ea['name']+'_description'===_0x4d1b1e);if(_[_0x5b83('0x1d')](_0x3d666a)&&_[_0x5b83('0x1d')](_0x4a4c43)){if(_0x5bcbeb[_0x5b83('0x81')](_0x4d1b1e)){if(_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]]){var _0x450df2=_['trim'](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]][_0x5b83('0x82')](/"/g,'\x27'));switch(_0x4d1b1e){case _0x5b83('0x42'):var _0x39c0ad=moment(_0x450df2,_0x5b83('0xe'),!![]);if(_0x39c0ad['isValid']()){_0x26f087['push']('\x22'+_0x450df2+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x83'));}break;case _0x5b83('0x2e'):var _0x5160f1=parseInt(_0x450df2);_0x450df2=_[_0x5b83('0x84')](_0x5160f1)||_0x5160f1<0x0||_0x5160f1>0x4?_0xa8ee8b?0x3:0x2:_0x5160f1;_0x26f087[_0x5b83('0x19')]('\x22'+_0x450df2+'\x22');break;case _0x5b83('0x44'):var _0x51a47e=parseInt(_0x450df2);if(_['isNumber'](_0x51a47e)&&_[_0x5b83('0x85')](_0x43d803,_0x51a47e)){_0x26f087[_0x5b83('0x19')]('\x22'+_0x51a47e+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x86'));}break;case'email':if(isEmail(_0x450df2)){_0x26f087[_0x5b83('0x19')]('\x22'+_0x450df2+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x87'));}break;case _0x5b83('0x88'):var _0x156116=moment(_0x450df2,_0x5b83('0x89'),!![]);if(_0x156116[_0x5b83('0x8a')]()){_0x26f087['push']('\x22'+_0x450df2+'\x22');}else{_0x1a7e02[_0x5b83('0x19')](_0x5b83('0x8b'));}break;case _0x5b83('0x6d'):var _0x5e485b=shared[_0x5b83('0x6c')];var _0x41c9fc=_0x5e485b[_0x450df2];if(!_[_0x5b83('0x1d')](_0x41c9fc)){var _0x3faf90=_0x41c9fc['utcOffset'];_0x26f087[_0x5b83('0x19')]('\x22'+_0x450df2+'\x22');_0x26f087[_0x5b83('0x19')]('\x22'+_0x3faf90+'\x22');}break;default:_0x26f087['push']('\x22'+_0x450df2+'\x22');}}else{switch(_0x4d1b1e){case _0x5b83('0x8c'):case _0x5b83('0x3d'):_0x1a7e02[_0x5b83('0x19')](_0x4d1b1e+_0x5b83('0x8d'));break;default:_0x26f087[_0x5b83('0x19')]('\x22\x22');}}}}else{var _0xdcb855='';if(!_[_0x5b83('0x1d')](_0x3d666a)){if(!_0x4fb8ef[_0x5b83('0x81')](_0x3d666a['id'])){if(!_['isNil'](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]])){var _0x450df2=_[_0x5b83('0x8e')](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0x4d1b1e]]['replace'](/"/g,'\x27'));var _0xa67365=phoneDescriptions[_0x5b83('0x8f')](_0x535bc1=>_0x535bc1[_0x5b83('0x90')]===_0x3d666a['id']);if(!_[_0x5b83('0x1d')](_0xa67365)){var _0x126421=_['trim'](_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0][_0x5bcbeb[_0xa67365[_0x5b83('0x91')]]][_0x5b83('0x82')](/"/g,'\x27'));if(!_[_0x5b83('0x1d')](_0x126421))_0x450df2=_0x450df2+'§'+_0x126421;}if(_0xdcb855=='')_0xdcb855=_0x450df2;else _0xdcb855+='|'+_0x450df2;}_0x5a9e3b['push'](_0x3d666a['id']+':'+_0xdcb855);_0x4fb8ef[_0x3d666a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x26f087['push']('\x22'+_0x5a9e3b['join'](';')+'\x22');}if(_0x1a7e02[_0x5b83('0x18')]){handleError(_0x56fcf1[_0x5b83('0x7f')][_0x1e96b0],{'code':_0x5b83('0x92'),'message':_0x1a7e02[_0x5b83('0x12')]()});}else{fs['appendFileSync'](_0x49f2bb,_0x26f087[_0x5b83('0x12')]()+'\x0a');}_0x26f087=[];}if(!(stats[_0x5b83('0x80')]%0xc8)){socket[_0x5b83('0x93')](_0x5b83('0x94')+_0x21a516,stats);stats[_0x5b83('0x5b')]=[];}}if(stopped){logger[_0x5b83('0x71')](_0x5b83('0x95'));_0x3be8b2[_0x5b83('0x96')]();}}catch(_0x5a149a){handleError(_0x56fcf1['data'][_0x1e96b0],{'code':_0x5b83('0x97'),'message':_0x5a149a[_0x5b83('0x5d')]});logger[_0x5b83('0x59')](_0x5b83('0x98'),_0x5a149a[_0x5b83('0x5d')]);}},'complete':function(){try{var _0x101b70=[];var _0xf9bff1=[];var _0x35e519=_0x5b83('0x30');if(_0x3bcabb[_0x5b83('0x99')]&&_0x3bcabb[_0x5b83('0x99')]['length']){_0x35e519=_0x5b83('0x9a')+_0x21a516;_0x101b70[_0x5b83('0x19')](_0x5b83('0x9b')+_0x35e519+_0x5b83('0x9c'));}tmp_campaigns=_0x5b83('0x9d')+_0x21a516;tmp_voice_queues=_0x5b83('0x9e')+_0x21a516;_0xf9bff1[_0x5b83('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x5b83('0x9f'));_0xf9bff1['push'](_0x5b83('0x9b')+tmp_voice_queues+_0x5b83('0x9f'));BPromise[_0x5b83('0xa0')](_0xf9bff1,handleTZQuery)['then'](function(_0x274b7b){updateTzCampaigns(_0x3bcabb[_0x5b83('0x43')])[_0x5b83('0x17')](function(_0x20e069){updateTzVoiceQueues(_0x3bcabb[_0x5b83('0x43')])[_0x5b83('0x17')](function(_0x526cb2){if(hasTZ)_0x3ae8a1=_0x3ae8a1[_0x5b83('0x82')](_0x5b83('0x6d'),_0x5b83('0xa1'));var _0x22c860=util[_0x5b83('0xd')]('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',_0x49f2bb,_0x35e519,_0x3ae8a1,_0x3bcabb[_0x5b83('0x43')],_0x3bcabb[_0x5b83('0x52')]||null,NOW,NOW);if(_[_0x5b83('0x1d')](_0x5bcbeb[_0x5b83('0x42')])){_0x22c860+=_0x5b83('0xa2');}_0x101b70[_0x5b83('0x19')](_0x22c860);if(_0x3bcabb[_0x5b83('0x99')]&&_0x3bcabb[_0x5b83('0x99')][_0x5b83('0x18')]){_0x101b70[_0x5b83('0x19')](insertCmContact(_0x3bcabb[_0x5b83('0x43')],_0x35e519,_0x3bcabb[_0x5b83('0x99')],_0x5bcbeb));_0x101b70[_0x5b83('0x19')](_0x5b83('0xa3')+_0x35e519+';');}BPromise[_0x5b83('0xa0')](_0x101b70,handleQuery)[_0x5b83('0x17')](function(_0x16c452){BPromise[_0x5b83('0x1a')]([handleAdditionalPhones()])[_0x5b83('0x17')](function(){_0x101b70=[];for(var _0x384e68=0x0;_0x384e68\x20\x20');}var _0x36d5ad=path[_0x5b83('0x12')](config[_0x5b83('0xb0')],_0x5b83('0x78'),process[_0x5b83('0xaf')][0x2]);if(!fs[_0x5b83('0xb1')](_0x36d5ad)){throw new Error(_0x5b83('0xb2'));}var _0x113e44={};try{_0x113e44=JSON[_0x5b83('0xb3')](process[_0x5b83('0xaf')][0x3]);if(!_0x113e44[_0x5b83('0x75')]){throw new Error(_0x5b83('0xb4'));}if(!_0x113e44[_0x5b83('0x75')][_0x5b83('0x3d')]){throw new Error(_0x5b83('0xb5'));}if(!_0x113e44['binding'][_0x5b83('0x8c')]){throw new Error(_0x5b83('0xb6'));}var _0x42504c=0x0;if(_0x113e44['binding'][_0x5b83('0x44')]){_0x42504c=0x1;}if(!_0x113e44[_0x5b83('0x43')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x48eef3){throw new Error(_0x5b83('0xb7'));}var _0x5de667=[];try{_0x5de667=_[_0x5b83('0xb8')](JSON[_0x5b83('0xb3')](process[_0x5b83('0xaf')][0x4]),'id');}catch(_0x1b88c9){logger[_0x5b83('0x71')](_0x5b83('0xb9'));}main(_0x36d5ad,_0x113e44,_0x5de667,_0x42504c);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index b6386b9..913cf08 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57c3=['find','isValid','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','hasOwnProperty','trim','replace','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','ContactId','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','message','exit','errors','code','stringify','send','start','binding','clone','socket_timestamp','root','.csv','body','ContactItemType','findAll','name','_description','parse','data','rows'];(function(_0x34c4b9,_0x3ba779){var _0xbce30c=function(_0xf1bd4a){while(--_0xf1bd4a){_0x34c4b9['push'](_0x34c4b9['shift']());}};_0xbce30c(++_0x3ba779);}(_0x57c3,0xc2));var _0x357c=function(_0x5b6564,_0x580970){_0x5b6564=_0x5b6564-0x0;var _0x85cba8=_0x57c3[_0x5b6564];return _0x85cba8;};'use strict';var fs=require('fs');var path=require(_0x357c('0x0'));var _=require(_0x357c('0x1'));var Papa=require(_0x357c('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x357c('0x3'));var Redis=require(_0x357c('0x4'));var db=require(_0x357c('0x5'))['db'];var config=require(_0x357c('0x6'));var logger=require('../../../config/logger')(_0x357c('0x7'));config['redis']=_[_0x357c('0x8')](config[_0x357c('0x9')],{'host':_0x357c('0xa'),'port':0x18eb});var socket=require(_0x357c('0xb'))(new Redis(config[_0x357c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x357c('0xc')](_0x357c('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x357c('0xc')](_0x357c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x214216){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))*$/[_0x357c('0xf')](_0x214216);}function selectNotIn(_0x46286d,_0xe99073,_0x271d88,_0x418df4,_0xd4399f){return squel[_0x357c('0x10')]()[_0x357c('0x11')](_0x357c('0x12'))['from'](_0x418df4)[_0x357c('0x13')](_0xe99073,null,_0xe99073+_0x357c('0x14')+_0x418df4+'.'+_0x271d88)[_0x357c('0x15')](_0x418df4+'.'+_0x271d88+'\x20=\x20'+_0x46286d+'.'+_0x271d88)['where'](_0xe99073+_0x357c('0x16')+_0xd4399f[_0x357c('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1465ee,_0x41f924){promisesAdditionalPhones=[];promisesContact=[];return db[_0x357c('0x17')][_0x357c('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x357c('0x19')](function(_0x288ed7){if(_0x288ed7!==null){var _0x5e01dc=[];for(var _0x590f6d=0x0;_0x590f6d<_0x288ed7[_0x357c('0x1a')];_0x590f6d++){var _0x42ef5b=_0x288ed7[_0x590f6d];if(!_[_0x357c('0x1b')](_0x42ef5b['phone'])){if(!_[_0x357c('0x1b')](_0x42ef5b[_0x357c('0x1c')]))_0x5e01dc[_0x357c('0x1d')](insertAdditionalPhones(_0x42ef5b));promisesContact[_0x357c('0x1d')]({'contact':_0x42ef5b});}}}Promise[_0x357c('0x1e')](_0x5e01dc)[_0x357c('0x1f')](function(){_0x1465ee({'val':0x1});});})[_0x357c('0x20')](function(_0x25622d){logger[_0x357c('0x21')](_0x25622d['message']);});});}function insertAdditionalPhones(_0x147b66){return new Promise(function(_0xe3956,_0x496938){var _0x51f71f=_0x147b66[_0x357c('0x1c')];if(_[_0x357c('0x1b')](_0x51f71f))_0x496938({'val':0x0});else{var _0x53ca28=_0x51f71f[_0x357c('0x22')](';');var _0x1e6c7f=[];orderBy=0x0;for(var _0x5e7f32=0x0;_0x5e7f32<_0x53ca28[_0x357c('0x1a')];_0x5e7f32++){_0x1e6c7f[_0x357c('0x1d')](splitAdditionalPhone(_0x147b66['id'],_0x53ca28[_0x5e7f32]));}Promise[_0x357c('0x1e')](_0x1e6c7f)[_0x357c('0x1f')](function(){_0xe3956({'val':_0x53ca28[_0x357c('0x1a')]});});}});}function splitAdditionalPhone(_0x1cbd6c,_0x328dfc){return new Promise(function(_0x23cde6,_0x47f4d8){var _0x563fee=_0x328dfc[_0x357c('0x22')](':');var _0xe1604d=_0x563fee[0x0];var _0x134274=_0x563fee[0x1];if(_0x134274!==''){var _0x1c5c51=_0x134274[_0x357c('0x22')]('|');var _0x5287e4=[];for(var _0x40983e=0x0;_0x40983e<_0x1c5c51['length'];_0x40983e++){if(_0x1c5c51[_0x40983e]!==''){var _0x406753=_[_0x357c('0x23')](promisesAdditionalPhones,{'contactId':_0x1cbd6c,'phone':_0x1c5c51[_0x40983e]});if(_0x406753[_0x357c('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1cbd6c,'contactTypeId':_0xe1604d,'phone':_0x1c5c51[_0x40983e],'orderBy':orderBy});}}}_0x23cde6({'ok':0x1});}else _0x23cde6({'res':0x0});});}function createAdditionalPhone(_0x11dc9c,_0x34d0a9,_0x34984f,_0x42a97a){var _0x28cdc3='';var _0x3125be='';var _0x28031a=_0x34984f[_0x357c('0x22')]('§');_0x28cdc3=_0x28031a[0x0];if(_0x28031a['length']==0x2)_0x3125be=_0x28031a[0x1];return new Promise(function(_0x25d6d5,_0x1a66cd){return db[_0x357c('0x24')][_0x357c('0x25')]({'where':{'CmContactId':_0x11dc9c,'item':_0x28cdc3}})[_0x357c('0x1f')](function(_0x51b7f4){if(_0x51b7f4){return db[_0x357c('0x24')][_0x357c('0x26')]({'ItemTypeId':_0x34d0a9,'description':_0x3125be,'OrderBy':_0x42a97a},{'where':{'CmContactId':_0x11dc9c,'item':_0x28cdc3}})[_0x357c('0x1f')](function(_0x34a9b3){_0x25d6d5({'res':_0x357c('0x27')});});}else{return db[_0x357c('0x24')][_0x357c('0x28')]({'CmContactId':_0x11dc9c,'item':_0x28cdc3,'ItemTypeId':_0x34d0a9,'description':_0x3125be,'OrderBy':_0x42a97a,'ItemClass':_0x357c('0x29')})[_0x357c('0x1f')](function(_0x98e241){_0x25d6d5({'res':_0x357c('0x2a')});});}});});}function updateContact(_0x280b5f){return new Promise(function(_0x4517ab,_0x4c19f9){var _0xd30165=_0x280b5f['id'];delete _0x280b5f['id'];return db[_0x357c('0x2b')]['update'](_0x280b5f,{'where':{'id':_0xd30165}})[_0x357c('0x1f')](function(_0x10849d){updatedRows+=0x1;return db[_0x357c('0x2c')][_0x357c('0x26')]({'phone':_0x280b5f[_0x357c('0x12')]},{'where':{'ContactId':_0xd30165}})[_0x357c('0x1f')](function(_0x4e4294){_0x4517ab({'ret':'OK'});});});});}function insertCmHopper(_0x453750,_0x3f20a3,_0x2e5f02,_0x4ca8c7,_0x102170){var _0x5afdf7=[_0x357c('0x2d'),'cm_contacts.scheduledat','cm_contacts.id',_0x357c('0x2e'),_0x3f20a3+'.'+_0x4ca8c7,_0x357c('0x2f'),_0x357c('0x30'),'cm_contacts.priority',_0x357c('0x31'),'\x22'+_0x102170+'\x22'];return squel['insert']()[_0x357c('0x32')](_0x357c('0x33'))[_0x357c('0x34')]([_0x357c('0x12'),_0x357c('0x35'),'ContactId',_0x357c('0x36'),_0x4ca8c7,_0x357c('0x37'),_0x357c('0x38'),_0x357c('0x39'),_0x357c('0x3a'),_0x357c('0x3b')],squel[_0x357c('0x10')]()[_0x357c('0x3c')](_0x5afdf7)[_0x357c('0x3d')](_0x3f20a3)['join'](_0x357c('0x3e'),null,_0x357c('0x3f')+_0x3f20a3+'.CmListId')[_0x357c('0x13')](_0x2e5f02,null,_0x2e5f02+_0x357c('0x14')+_0x3f20a3+'.'+_0x4ca8c7)[_0x357c('0x15')](_0x3f20a3+_0x357c('0x40'),_0x453750)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x357c('0x15')](_0x357c('0x41'),selectNotIn(_0x3f20a3,_0x2e5f02,_0x4ca8c7,_0x357c('0x33'),[_0x357c('0x42'),_0x357c('0x43')]))[_0x357c('0x15')](_0x357c('0x41'),selectNotIn(_0x3f20a3,_0x2e5f02,_0x4ca8c7,'cm_hopper',[_0x357c('0x42')])))[_0x357c('0x44')]();}function insertCmHopperBlack(_0x4c318a,_0x228e1b,_0x27a1d2,_0x4fe797){var _0x3172f4=[_0x357c('0x2d'),'cm_contacts.id',_0x357c('0x2e'),_0x228e1b+'.'+_0x4fe797,_0x357c('0x2f'),_0x357c('0x30')];return squel[_0x357c('0x45')]()[_0x357c('0x32')](_0x357c('0x46'))[_0x357c('0x34')]([_0x357c('0x12'),_0x357c('0x47'),_0x357c('0x36'),_0x4fe797,_0x357c('0x37'),_0x357c('0x38')],squel['select']()[_0x357c('0x3c')](_0x3172f4)['from'](_0x228e1b)[_0x357c('0x13')]('cm_contacts',null,_0x357c('0x3f')+_0x228e1b+_0x357c('0x48'))[_0x357c('0x13')](_0x27a1d2,null,_0x27a1d2+_0x357c('0x14')+_0x228e1b+'.'+_0x4fe797)['where'](_0x228e1b+'.CmListId\x20=\x20?',_0x4c318a)[_0x357c('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x357c('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x357c('0x11')](_0x357c('0x12'))[_0x357c('0x3d')](_0x357c('0x46'))[_0x357c('0x15')](_0x357c('0x49'),_0x4c318a)['where'](_0x4fe797+_0x357c('0x4a'),_0x228e1b+'.'+_0x4fe797)))['toString']();}function insertCmHopperAdditionalPhones(_0x2cd9a1){var _0x1ddb53=[_0x357c('0x4b'),_0x357c('0x4c'),_0x357c('0x4d'),_0x357c('0x4e'),_0x357c('0x4f')];return squel[_0x357c('0x45')]()['into'](_0x357c('0x50'))[_0x357c('0x34')]([_0x357c('0x51'),_0x357c('0x12'),_0x357c('0x52'),'createdAt',_0x357c('0x38')],squel[_0x357c('0x10')]()['fields'](_0x1ddb53)[_0x357c('0x3d')](_0x357c('0x33'))[_0x357c('0x13')](_0x357c('0x3e'),null,_0x357c('0x53'))[_0x357c('0x13')](_0x357c('0x54'),null,_0x357c('0x55'))[_0x357c('0x15')](_0x357c('0x56'),_0x2cd9a1)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x357c('0x44')]();}function insertCmContact(_0x1282b2,_0x6b2ca7,_0x45b755,_0x3a4189){var _0x5d92a1=_[_0x357c('0x57')](_[_0x357c('0x58')](_0x3a4189),['ListId',_0x357c('0x59'),_0x357c('0x37'),_0x357c('0x38')]);return squel[_0x357c('0x45')]()[_0x357c('0x32')]('cm_contacts')[_0x357c('0x34')](_0x5d92a1,squel[_0x357c('0x10')]()['fields'](_0x5d92a1)[_0x357c('0x3d')](_0x6b2ca7)[_0x357c('0x15')]('('+_0x45b755['join'](',')+_0x357c('0x5a'),squel[_0x357c('0x10')]()[_0x357c('0x3c')](_0x45b755)[_0x357c('0x3d')](_0x357c('0x3e'))[_0x357c('0x15')]('ListId\x20=\x20?',_0x1282b2))['where'](_0x357c('0x5b'),squel[_0x357c('0x10')]()[_0x357c('0x11')](_0x357c('0x5c'),_0x357c('0x5d'))[_0x357c('0x3d')](_0x6b2ca7)['group'](_0x45b755[_0x357c('0x13')](','))))[_0x357c('0x44')]();}function handleStop(){logger[_0x357c('0x5e')](_0x357c('0x5f'));stopped=!![];}function handleUncaughtException(_0x8538a4){logger[_0x357c('0x21')](_0x8538a4[_0x357c('0x60')]);process[_0x357c('0x61')](0x1);}function handleError(_0x44cb19,_0x468f6c){stats[_0x357c('0x62')][_0x357c('0x1d')]({'name':_0x468f6c[_0x357c('0x63')],'message':_0x468f6c[_0x357c('0x60')],'row':_0x44cb19});}function handleQuery(_0x187a81){logger[_0x357c('0x5e')](_0x187a81);return db['sequelize'][_0x357c('0x18')](_0x187a81)[_0x357c('0x19')](function(_0x5215cc){results[_0x357c('0x1d')](_0x5215cc);})[_0x357c('0x20')](function(_0x1fc9a2){logger[_0x357c('0x21')](_0x1fc9a2[_0x357c('0x60')]);});}function main(_0x233e64,_0x40e0d0,_0x346deb,_0x166e50){logger[_0x357c('0x5e')]('main',_0x233e64,JSON[_0x357c('0x64')](_0x40e0d0));process[_0x357c('0x65')](_0x357c('0x66'));var _0x284341=_0x40e0d0[_0x357c('0x67')];var _0x5e40bf=_[_0x357c('0x68')](_0x284341);var _0x460729=_0x40e0d0[_0x357c('0x69')];var _0x1abb73=path['join'](config[_0x357c('0x6a')],'server/files/tmp',_0x460729+_0x357c('0x6b'));logger['info'](_0x357c('0x6c'),_0x40e0d0);db[_0x357c('0x6d')][_0x357c('0x6e')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x194ec9){for(var _0x30d09b=0x0;_0x30d09b<_0x194ec9['length'];_0x30d09b++){if(_0x194ec9[_0x30d09b][_0x357c('0x6f')]in _0x284341){contactItemTypes[_0x357c('0x1d')](_0x194ec9[_0x30d09b]);delete _0x5e40bf[_0x194ec9[_0x30d09b][_0x357c('0x6f')]];hasAdditionalPhones=!![];}for(var _0x44fa0b in _0x284341){if(_0x194ec9[_0x30d09b][_0x357c('0x6f')]+_0x357c('0x70')===_0x44fa0b){phoneDescriptions[_0x357c('0x1d')]({'itemTypeId':_0x194ec9[_0x30d09b]['id'],'description':_0x44fa0b});delete _0x5e40bf[_0x44fa0b];}}}if(hasAdditionalPhones)_0x5e40bf[_0x357c('0x1c')]='';var _0x347ff9=_['keys'](_0x5e40bf)[_0x357c('0x13')]();logger['info']('header',_0x347ff9);fs['writeFileSync'](_0x1abb73,_0x347ff9+'\x0a');Papa[_0x357c('0x71')](fs['createReadStream'](_0x233e64),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2979bb,_0xed9b40){try{for(var _0x2e2490=0x0,_0x3b9e3f=[];_0x2e2490<_0x2979bb[_0x357c('0x72')][_0x357c('0x1a')];_0x2e2490++){stats[_0x357c('0x73')]+=0x1;if(_0x2979bb['errors'][_0x2e2490]){handleError(_0x2979bb[_0x357c('0x72')][_0x2e2490],_0x2979bb[_0x357c('0x62')][_0x2e2490]);}else{var _0x5e66a3=[];var _0x219a7e=[];var _0x2c8cf8={};for(var _0x1b6b4f in _0x284341){let _0x55a8c9=contactItemTypes[_0x357c('0x74')](_0x177cc0=>_0x177cc0[_0x357c('0x6f')]===_0x1b6b4f);let _0x2673da=contactItemTypes[_0x357c('0x74')](_0x4f3260=>_0x4f3260[_0x357c('0x6f')]+_0x357c('0x70')===_0x1b6b4f);if(_['isNil'](_0x55a8c9)&&_['isNil'](_0x2673da)){if(_0x284341['hasOwnProperty'](_0x1b6b4f)){if(_0x2979bb[_0x357c('0x72')][_0x2e2490][_0x284341[_0x1b6b4f]]){var _0x370be2=_['trim'](_0x2979bb[_0x357c('0x72')][_0x2e2490][_0x284341[_0x1b6b4f]]['replace'](/"/g,'\x27'));switch(_0x1b6b4f){case _0x357c('0x35'):var _0x2dfa72=moment(_0x370be2,_0x357c('0xd'),!![]);if(_0x2dfa72[_0x357c('0x75')]()){_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0x370be2+'\x22');}else{_0x5e66a3[_0x357c('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x357c('0x39'):var _0x60c790=parseInt(_0x370be2);_0x370be2=_['isNaN'](_0x60c790)||_0x60c790<0x0||_0x60c790>0x4?_0x166e50?0x3:0x2:_0x60c790;_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0x370be2+'\x22');break;case _0x357c('0x3a'):var _0xdf8b3a=parseInt(_0x370be2);if(_['isNumber'](_0xdf8b3a)&&_[_0x357c('0x76')](_0x346deb,_0xdf8b3a)){_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0xdf8b3a+'\x22');}else{_0x5e66a3['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x370be2)){_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0x370be2+'\x22');}else{_0x5e66a3[_0x357c('0x1d')](_0x357c('0x77'));}break;case _0x357c('0x78'):var _0x1f78fa=moment(_0x370be2,_0x357c('0x79'),!![]);if(_0x1f78fa[_0x357c('0x75')]()){_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0x370be2+'\x22');}else{_0x5e66a3[_0x357c('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0x370be2+'\x22');}}else{switch(_0x1b6b4f){case _0x357c('0x7a'):case'phone':_0x5e66a3['push'](_0x1b6b4f+_0x357c('0x7b'));break;default:_0x3b9e3f[_0x357c('0x1d')]('\x22\x22');}}}}else{var _0x522eb4='';if(!_[_0x357c('0x1b')](_0x55a8c9)){if(!_0x2c8cf8[_0x357c('0x7c')](_0x55a8c9['id'])){for(var _0x3f1748=0x0;_0x3f1748<_0x284341[_0x1b6b4f][_0x357c('0x1a')];_0x3f1748++){var _0x370be2=_[_0x357c('0x7d')](_0x2979bb[_0x357c('0x72')][_0x2e2490][_0x284341[_0x1b6b4f][_0x3f1748]][_0x357c('0x7e')](/"/g,'\x27'));var _0x1451ba=phoneDescriptions['find'](_0x8b1d6a=>_0x8b1d6a['itemTypeId']===_0x55a8c9['id']);if(!_[_0x357c('0x1b')](_0x1451ba)){var _0x148b4f=_[_0x357c('0x7d')](_0x2979bb['data'][_0x2e2490][_0x284341[_0x1451ba['description']][0x0]][_0x357c('0x7e')](/"/g,'\x27'));if(!_[_0x357c('0x1b')](_0x148b4f))_0x370be2=_0x370be2+'§'+_0x148b4f;}if(_0x522eb4=='')_0x522eb4=_0x370be2;else _0x522eb4+='|'+_0x370be2;}_0x219a7e[_0x357c('0x1d')](_0x55a8c9['id']+':'+_0x522eb4);_0x2c8cf8[_0x55a8c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3b9e3f[_0x357c('0x1d')]('\x22'+_0x219a7e[_0x357c('0x13')](';')+'\x22');}if(_0x5e66a3[_0x357c('0x1a')]){handleError(_0x2979bb['data'][_0x2e2490],{'code':_0x357c('0x7f'),'message':_0x5e66a3[_0x357c('0x13')]()});}else{fs[_0x357c('0x80')](_0x1abb73,_0x3b9e3f['join']()+'\x0a');}_0x3b9e3f=[];}if(!(stats[_0x357c('0x73')]%0xc8)){socket[_0x357c('0x81')]('contact:import:'+_0x460729,stats);stats[_0x357c('0x62')]=[];}}if(stopped){logger[_0x357c('0x5e')](_0x357c('0x82'));_0xed9b40[_0x357c('0x83')]();}}catch(_0x8506dc){handleError(_0x2979bb[_0x357c('0x72')][_0x2e2490],{'code':_0x357c('0x84'),'message':_0x8506dc[_0x357c('0x60')]});logger['error'](_0x357c('0x85'),_0x8506dc[_0x357c('0x60')]);}},'complete':function(){try{var _0x260893=[];var _0x479eb5=tempTableName;_0x260893[_0x357c('0x1d')](_0x357c('0x86')+_0x479eb5+'\x20LIKE\x20cm_contacts;');logger[_0x357c('0x5e')]('CIS\x20len',contactItemTypes[_0x357c('0x1a')]);var _0x502ebd=util[_0x357c('0xc')](_0x357c('0x87'),_0x1abb73,_0x479eb5,_0x347ff9,_0x40e0d0[_0x357c('0x36')],_0x40e0d0[_0x357c('0x59')]||null,NOW,NOW);if(_['isNil'](_0x284341[_0x357c('0x35')])){_0x502ebd+=_0x357c('0x88');}_0x260893[_0x357c('0x1d')](_0x502ebd);BPromise[_0x357c('0x89')](_0x260893,handleQuery)[_0x357c('0x1f')](function(_0x367b0d){BPromise[_0x357c('0x1e')]([handleAdditionalPhones()])[_0x357c('0x1f')](function(){_0x260893=[];for(var _0x33c64c=0x0;_0x33c64c\x20\x20');}var _0x29f798=path[_0x357c('0x13')](config['root'],'server/files/tmp',process[_0x357c('0x92')][0x2]);if(!fs[_0x357c('0x93')](_0x29f798)){throw new Error(_0x357c('0x94'));}var _0x11e12d={};try{_0x11e12d=JSON['parse'](process[_0x357c('0x92')][0x3]);if(!_0x11e12d[_0x357c('0x67')]){throw new Error(_0x357c('0x95'));}var _0x1dfd40=0x0;if(_0x11e12d[_0x357c('0x67')][_0x357c('0x3a')]){_0x1dfd40=0x1;}if(!_0x11e12d[_0x357c('0x36')]){throw new Error(_0x357c('0x96'));}}catch(_0xf58812){throw new Error('body\x20id\x20mandatory');}var _0x5a7a75=[];try{_0x5a7a75=_[_0x357c('0x97')](JSON[_0x357c('0x71')](process[_0x357c('0x92')][0x4]),'id');}catch(_0xca20a0){logger['info'](_0x357c('0x98'));}main(_0x29f798,_0x11e12d,_0x5a7a75,_0x1dfd40);}validate();process['on'](_0x357c('0x99'),handleStop);process['on'](_0x357c('0x9a'),handleUncaughtException); \ No newline at end of file +var _0xc306=['message','split','filter','findOne','CmContactHasItem','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','MIN(id)','group','info','Received\x20SIGINT','error','exit','errors','code','stringify','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','Abort\x20parser','SystemError','step','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','scheduledat','each','contact','contactId','contactTypeId','orderBy','finish','affectedRows','emit','argv','arguments\x20\x20\x20','existsSync','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','uncaughtException','path','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch'];(function(_0x17b648,_0x114f76){var _0x47d7cc=function(_0x616a3b){while(--_0x616a3b){_0x17b648['push'](_0x17b648['shift']());}};_0x47d7cc(++_0x114f76);}(_0xc306,0x1a9));var _0x6c30=function(_0x429fec,_0x5c1bf6){_0x429fec=_0x429fec-0x0;var _0x3aeae6=_0xc306[_0x429fec];return _0x3aeae6;};'use strict';var fs=require('fs');var path=require(_0x6c30('0x0'));var _=require('lodash');var Papa=require(_0x6c30('0x1'));var util=require(_0x6c30('0x2'));var BPromise=require(_0x6c30('0x3'));var moment=require(_0x6c30('0x4'));var squel=require(_0x6c30('0x5'));var Redis=require('ioredis');var db=require(_0x6c30('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x6c30('0x7'))(_0x6c30('0x8'));config[_0x6c30('0x9')]=_[_0x6c30('0xa')](config[_0x6c30('0x9')],{'host':_0x6c30('0xb'),'port':0x18eb});var socket=require(_0x6c30('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6c30('0xd')](_0x6c30('0xe'));var tempTableName=_0x6c30('0xf')+moment()['format'](_0x6c30('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4a6fd7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4a6fd7);}function selectNotIn(_0x459b83,_0x512397,_0x593772,_0x4ef518,_0x2778f3){return squel[_0x6c30('0x11')]()[_0x6c30('0x12')]('phone')[_0x6c30('0x13')](_0x4ef518)['join'](_0x512397,null,_0x512397+_0x6c30('0x14')+_0x4ef518+'.'+_0x593772)['where'](_0x4ef518+'.'+_0x593772+'\x20=\x20'+_0x459b83+'.'+_0x593772)[_0x6c30('0x15')](_0x512397+_0x6c30('0x16')+_0x2778f3['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1e7564,_0x10a584){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6c30('0x17')][_0x6c30('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x6c30('0x19')](function(_0x258e8d){if(_0x258e8d!==null){var _0x29a5e6=[];for(var _0x46fdfa=0x0;_0x46fdfa<_0x258e8d[_0x6c30('0x1a')];_0x46fdfa++){var _0x1009d0=_0x258e8d[_0x46fdfa];if(!_[_0x6c30('0x1b')](_0x1009d0[_0x6c30('0x1c')])){if(!_[_0x6c30('0x1b')](_0x1009d0[_0x6c30('0x1d')]))_0x29a5e6['push'](insertAdditionalPhones(_0x1009d0));promisesContact[_0x6c30('0x1e')]({'contact':_0x1009d0});}}}Promise[_0x6c30('0x1f')](_0x29a5e6)[_0x6c30('0x20')](function(){_0x1e7564({'val':0x1});});})[_0x6c30('0x21')](function(_0x215331){logger['error'](_0x215331[_0x6c30('0x22')]);});});}function insertAdditionalPhones(_0x46f852){return new Promise(function(_0x141d64,_0x3557f7){var _0x36a009=_0x46f852[_0x6c30('0x1d')];if(_['isNil'](_0x36a009))_0x3557f7({'val':0x0});else{var _0x57685d=_0x36a009[_0x6c30('0x23')](';');var _0x4688fa=[];orderBy=0x0;for(var _0x12cf4c=0x0;_0x12cf4c<_0x57685d[_0x6c30('0x1a')];_0x12cf4c++){_0x4688fa[_0x6c30('0x1e')](splitAdditionalPhone(_0x46f852['id'],_0x57685d[_0x12cf4c]));}Promise[_0x6c30('0x1f')](_0x4688fa)[_0x6c30('0x20')](function(){_0x141d64({'val':_0x57685d[_0x6c30('0x1a')]});});}});}function splitAdditionalPhone(_0x32ff68,_0xa4a3bc){return new Promise(function(_0x440b1f,_0x12db02){var _0x15f643=_0xa4a3bc[_0x6c30('0x23')](':');var _0x5df2a4=_0x15f643[0x0];var _0x42135d=_0x15f643[0x1];if(_0x42135d!==''){var _0x1152f3=_0x42135d['split']('|');var _0x190693=[];for(var _0x6fc3f8=0x0;_0x6fc3f8<_0x1152f3[_0x6c30('0x1a')];_0x6fc3f8++){if(_0x1152f3[_0x6fc3f8]!==''){var _0x478c75=_[_0x6c30('0x24')](promisesAdditionalPhones,{'contactId':_0x32ff68,'phone':_0x1152f3[_0x6fc3f8]});if(_0x478c75[_0x6c30('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x6c30('0x1e')]({'contactId':_0x32ff68,'contactTypeId':_0x5df2a4,'phone':_0x1152f3[_0x6fc3f8],'orderBy':orderBy});}}}_0x440b1f({'ok':0x1});}else _0x440b1f({'res':0x0});});}function createAdditionalPhone(_0x1a22e7,_0x32670f,_0x256159,_0x34c550){var _0x2c8af7='';var _0x58de1c='';var _0x20effb=_0x256159[_0x6c30('0x23')]('§');_0x2c8af7=_0x20effb[0x0];if(_0x20effb[_0x6c30('0x1a')]==0x2)_0x58de1c=_0x20effb[0x1];return new Promise(function(_0x3b6ac7,_0x4ccd1a){return db['CmContactHasItem'][_0x6c30('0x25')]({'where':{'CmContactId':_0x1a22e7,'item':_0x2c8af7}})[_0x6c30('0x20')](function(_0x29bc69){if(_0x29bc69){return db[_0x6c30('0x26')][_0x6c30('0x27')]({'ItemTypeId':_0x32670f,'description':_0x58de1c,'OrderBy':_0x34c550},{'where':{'CmContactId':_0x1a22e7,'item':_0x2c8af7}})[_0x6c30('0x20')](function(_0x2a14f7){_0x3b6ac7({'res':_0x6c30('0x28')});});}else{return db[_0x6c30('0x26')][_0x6c30('0x29')]({'CmContactId':_0x1a22e7,'item':_0x2c8af7,'ItemTypeId':_0x32670f,'description':_0x58de1c,'OrderBy':_0x34c550,'ItemClass':'PHONE'})[_0x6c30('0x20')](function(_0x9aa463){_0x3b6ac7({'res':'inserted'});});}});});}function updateContact(_0x1b8077){return new Promise(function(_0x1e9997,_0x314999){var _0x4cf1c5=_0x1b8077['id'];delete _0x1b8077['id'];return db['CmContact'][_0x6c30('0x27')](_0x1b8077,{'where':{'id':_0x4cf1c5}})['then'](function(_0x5e852c){updatedRows+=0x1;return db['CmHopper'][_0x6c30('0x27')]({'phone':_0x1b8077[_0x6c30('0x1c')]},{'where':{'ContactId':_0x4cf1c5}})[_0x6c30('0x20')](function(_0x2fb9d0){_0x1e9997({'ret':'OK'});});});});}function insertCmHopper(_0x2079af,_0x4f1e14,_0x5eacd3,_0x1e70fb,_0x5ef088){var _0x5b686e=[_0x6c30('0x2a'),_0x6c30('0x2b'),_0x6c30('0x2c'),_0x6c30('0x2d'),_0x4f1e14+'.'+_0x1e70fb,_0x6c30('0x2e'),_0x6c30('0x2f'),_0x6c30('0x30'),_0x6c30('0x31'),'\x22'+_0x5ef088+'\x22'];return squel[_0x6c30('0x32')]()[_0x6c30('0x33')](_0x6c30('0x34'))[_0x6c30('0x35')]([_0x6c30('0x1c'),'scheduledat',_0x6c30('0x36'),_0x6c30('0x37'),_0x1e70fb,_0x6c30('0x38'),_0x6c30('0x39'),_0x6c30('0x3a'),_0x6c30('0x3b'),_0x6c30('0x3c')],squel[_0x6c30('0x11')]()[_0x6c30('0x3d')](_0x5b686e)['from'](_0x4f1e14)[_0x6c30('0x3e')](_0x6c30('0x3f'),null,_0x6c30('0x40')+_0x4f1e14+_0x6c30('0x41'))[_0x6c30('0x3e')](_0x5eacd3,null,_0x5eacd3+'.id\x20=\x20'+_0x4f1e14+'.'+_0x1e70fb)[_0x6c30('0x15')](_0x4f1e14+_0x6c30('0x42'),_0x2079af)[_0x6c30('0x15')](_0x6c30('0x43'),NOW)[_0x6c30('0x15')](_0x6c30('0x44'),selectNotIn(_0x4f1e14,_0x5eacd3,_0x1e70fb,'cm_hopper',[_0x6c30('0x45'),_0x6c30('0x46')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f1e14,_0x5eacd3,_0x1e70fb,_0x6c30('0x34'),[_0x6c30('0x45')])))[_0x6c30('0x47')]();}function insertCmHopperBlack(_0x4811aa,_0x11b39a,_0x1e10d1,_0x4e5edb){var _0x1a86bb=['cm_contacts.phone',_0x6c30('0x2c'),_0x6c30('0x2d'),_0x11b39a+'.'+_0x4e5edb,_0x6c30('0x2e'),'cm_contacts.updatedAt'];return squel[_0x6c30('0x32')]()[_0x6c30('0x33')]('cm_hopper_black')[_0x6c30('0x35')]([_0x6c30('0x1c'),_0x6c30('0x36'),'ListId',_0x4e5edb,_0x6c30('0x38'),'updatedAt'],squel['select']()['fields'](_0x1a86bb)[_0x6c30('0x13')](_0x11b39a)[_0x6c30('0x3e')](_0x6c30('0x3f'),null,_0x6c30('0x40')+_0x11b39a+'.CmListId')[_0x6c30('0x3e')](_0x1e10d1,null,_0x1e10d1+_0x6c30('0x14')+_0x11b39a+'.'+_0x4e5edb)[_0x6c30('0x15')](_0x11b39a+_0x6c30('0x42'),_0x4811aa)['where'](_0x6c30('0x43'),NOW)[_0x6c30('0x15')](_0x6c30('0x44'),squel[_0x6c30('0x11')]()[_0x6c30('0x12')](_0x6c30('0x1c'))['from'](_0x6c30('0x48'))[_0x6c30('0x15')](_0x6c30('0x49'),_0x4811aa)['where'](_0x4e5edb+'\x20=\x20?',_0x11b39a+'.'+_0x4e5edb)))['toString']();}function insertCmHopperAdditionalPhones(_0x1e534e){var _0xb10de4=[_0x6c30('0x4a'),_0x6c30('0x4b'),_0x6c30('0x4c'),'cm_contact_has_items.createdAt',_0x6c30('0x4d')];return squel[_0x6c30('0x32')]()[_0x6c30('0x33')](_0x6c30('0x4e'))[_0x6c30('0x35')]([_0x6c30('0x4f'),_0x6c30('0x1c'),_0x6c30('0x50'),_0x6c30('0x38'),_0x6c30('0x39')],squel[_0x6c30('0x11')]()['fields'](_0xb10de4)[_0x6c30('0x13')](_0x6c30('0x34'))[_0x6c30('0x3e')](_0x6c30('0x3f'),null,_0x6c30('0x51'))[_0x6c30('0x3e')](_0x6c30('0x52'),null,_0x6c30('0x53'))[_0x6c30('0x15')]('cm_hopper.ListId\x20=\x20?',_0x1e534e)[_0x6c30('0x15')](_0x6c30('0x43'),NOW))['toString']();}function insertCmContact(_0x2507f0,_0x4a800c,_0x354435,_0x4a1a29){var _0x447f0e=_[_0x6c30('0x54')](_[_0x6c30('0x55')](_0x4a1a29),[_0x6c30('0x37'),_0x6c30('0x56'),_0x6c30('0x38'),_0x6c30('0x39')]);return squel[_0x6c30('0x32')]()[_0x6c30('0x33')](_0x6c30('0x3f'))[_0x6c30('0x35')](_0x447f0e,squel['select']()['fields'](_0x447f0e)['from'](_0x4a800c)[_0x6c30('0x15')]('('+_0x354435['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x6c30('0x11')]()[_0x6c30('0x3d')](_0x354435)[_0x6c30('0x13')](_0x6c30('0x3f'))[_0x6c30('0x15')]('ListId\x20=\x20?',_0x2507f0))[_0x6c30('0x15')]('id\x20IN\x20?',squel[_0x6c30('0x11')]()[_0x6c30('0x12')](_0x6c30('0x57'),'min_id')[_0x6c30('0x13')](_0x4a800c)[_0x6c30('0x58')](_0x354435[_0x6c30('0x3e')](','))))[_0x6c30('0x47')]();}function handleStop(){logger[_0x6c30('0x59')](_0x6c30('0x5a'));stopped=!![];}function handleUncaughtException(_0xc0271b){logger[_0x6c30('0x5b')](_0xc0271b['message']);process[_0x6c30('0x5c')](0x1);}function handleError(_0x361670,_0x2e242a){stats[_0x6c30('0x5d')][_0x6c30('0x1e')]({'name':_0x2e242a[_0x6c30('0x5e')],'message':_0x2e242a['message'],'row':_0x361670});}function handleQuery(_0x541b38){logger[_0x6c30('0x59')](_0x541b38);return db['sequelize'][_0x6c30('0x18')](_0x541b38)[_0x6c30('0x19')](function(_0xf330fc){results[_0x6c30('0x1e')](_0xf330fc);})[_0x6c30('0x21')](function(_0x323d3b){logger[_0x6c30('0x5b')](_0x323d3b[_0x6c30('0x22')]);});}function main(_0x175886,_0x57405e,_0x525acb,_0x483222){logger[_0x6c30('0x59')]('main',_0x175886,JSON[_0x6c30('0x5f')](_0x57405e));process['send']('start');var _0x3d1bbd=_0x57405e['binding'];var _0x47f26d=_[_0x6c30('0x60')](_0x3d1bbd);var _0x43beba=_0x57405e['socket_timestamp'];var _0x4d381a=path['join'](config[_0x6c30('0x61')],_0x6c30('0x62'),_0x43beba+_0x6c30('0x63'));logger[_0x6c30('0x59')](_0x6c30('0x64'),_0x57405e);db[_0x6c30('0x65')][_0x6c30('0x66')]({'raw':!![],'attributes':['id',_0x6c30('0x67')]})['then'](function(_0x36f1f7){for(var _0xcaf974=0x0;_0xcaf974<_0x36f1f7['length'];_0xcaf974++){if(_0x36f1f7[_0xcaf974][_0x6c30('0x67')]in _0x3d1bbd){contactItemTypes['push'](_0x36f1f7[_0xcaf974]);delete _0x47f26d[_0x36f1f7[_0xcaf974][_0x6c30('0x67')]];hasAdditionalPhones=!![];}for(var _0x2e786e in _0x3d1bbd){if(_0x36f1f7[_0xcaf974][_0x6c30('0x67')]+_0x6c30('0x68')===_0x2e786e){phoneDescriptions[_0x6c30('0x1e')]({'itemTypeId':_0x36f1f7[_0xcaf974]['id'],'description':_0x2e786e});delete _0x47f26d[_0x2e786e];}}}if(hasAdditionalPhones)_0x47f26d[_0x6c30('0x1d')]='';var _0x42726c=_[_0x6c30('0x55')](_0x47f26d)[_0x6c30('0x3e')]();logger[_0x6c30('0x59')](_0x6c30('0x69'),_0x42726c);fs[_0x6c30('0x6a')](_0x4d381a,_0x42726c+'\x0a');Papa['parse'](fs['createReadStream'](_0x175886),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29a52d,_0x5b8129){try{for(var _0x5d4d46=0x0,_0x462b6a=[];_0x5d4d46<_0x29a52d[_0x6c30('0x6b')]['length'];_0x5d4d46++){stats[_0x6c30('0x6c')]+=0x1;if(_0x29a52d[_0x6c30('0x5d')][_0x5d4d46]){handleError(_0x29a52d[_0x6c30('0x6b')][_0x5d4d46],_0x29a52d[_0x6c30('0x5d')][_0x5d4d46]);}else{var _0x4a6129=[];var _0x2a9751=[];var _0x5092f1={};for(var _0x285770 in _0x3d1bbd){let _0x5c50dd=contactItemTypes[_0x6c30('0x6d')](_0x4feadb=>_0x4feadb['name']===_0x285770);let _0x39d0a9=contactItemTypes[_0x6c30('0x6d')](_0x4fc131=>_0x4fc131[_0x6c30('0x67')]+'_description'===_0x285770);if(_[_0x6c30('0x1b')](_0x5c50dd)&&_[_0x6c30('0x1b')](_0x39d0a9)){if(_0x3d1bbd['hasOwnProperty'](_0x285770)){if(_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x285770]]){var _0x5c293c=_[_0x6c30('0x6e')](_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x285770]][_0x6c30('0x6f')](/"/g,'\x27'));switch(_0x285770){case'scheduledat':var _0x49909e=moment(_0x5c293c,_0x6c30('0xe'),!![]);if(_0x49909e[_0x6c30('0x70')]()){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}else{_0x4a6129['push'](_0x6c30('0x71'));}break;case _0x6c30('0x3a'):var _0x48e251=parseInt(_0x5c293c);_0x5c293c=_[_0x6c30('0x72')](_0x48e251)||_0x48e251<0x0||_0x48e251>0x4?_0x483222?0x3:0x2:_0x48e251;_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');break;case _0x6c30('0x3b'):var _0x3eb402=parseInt(_0x5c293c);if(_[_0x6c30('0x73')](_0x3eb402)&&_[_0x6c30('0x74')](_0x525acb,_0x3eb402)){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x3eb402+'\x22');}else{_0x4a6129[_0x6c30('0x1e')](_0x6c30('0x75'));}break;case _0x6c30('0x76'):if(isEmail(_0x5c293c)){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}else{_0x4a6129[_0x6c30('0x1e')](_0x6c30('0x77'));}break;case _0x6c30('0x78'):var _0x1da82a=moment(_0x5c293c,_0x6c30('0x79'),!![]);if(_0x1da82a[_0x6c30('0x70')]()){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}else{_0x4a6129[_0x6c30('0x1e')](_0x6c30('0x7a'));}break;default:_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x5c293c+'\x22');}}else{switch(_0x285770){case _0x6c30('0x7b'):case _0x6c30('0x1c'):_0x4a6129[_0x6c30('0x1e')](_0x285770+_0x6c30('0x7c'));break;default:_0x462b6a[_0x6c30('0x1e')]('\x22\x22');}}}}else{var _0x186461='';if(!_[_0x6c30('0x1b')](_0x5c50dd)){if(!_0x5092f1[_0x6c30('0x7d')](_0x5c50dd['id'])){for(var _0x402929=0x0;_0x402929<_0x3d1bbd[_0x285770][_0x6c30('0x1a')];_0x402929++){var _0x5c293c=_[_0x6c30('0x6e')](_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x285770][_0x402929]]['replace'](/"/g,'\x27'));var _0x526dac=phoneDescriptions[_0x6c30('0x6d')](_0x33788d=>_0x33788d[_0x6c30('0x7e')]===_0x5c50dd['id']);if(!_[_0x6c30('0x1b')](_0x526dac)){var _0x441fc3=_[_0x6c30('0x6e')](_0x29a52d[_0x6c30('0x6b')][_0x5d4d46][_0x3d1bbd[_0x526dac[_0x6c30('0x7f')]][0x0]][_0x6c30('0x6f')](/"/g,'\x27'));if(!_[_0x6c30('0x1b')](_0x441fc3))_0x5c293c=_0x5c293c+'§'+_0x441fc3;}if(_0x186461=='')_0x186461=_0x5c293c;else _0x186461+='|'+_0x5c293c;}_0x2a9751['push'](_0x5c50dd['id']+':'+_0x186461);_0x5092f1[_0x5c50dd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x462b6a[_0x6c30('0x1e')]('\x22'+_0x2a9751['join'](';')+'\x22');}if(_0x4a6129[_0x6c30('0x1a')]){handleError(_0x29a52d['data'][_0x5d4d46],{'code':_0x6c30('0x80'),'message':_0x4a6129[_0x6c30('0x3e')]()});}else{fs[_0x6c30('0x81')](_0x4d381a,_0x462b6a[_0x6c30('0x3e')]()+'\x0a');}_0x462b6a=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x43beba,stats);stats[_0x6c30('0x5d')]=[];}}if(stopped){logger[_0x6c30('0x59')](_0x6c30('0x82'));_0x5b8129['abort']();}}catch(_0x1e2f34){handleError(_0x29a52d[_0x6c30('0x6b')][_0x5d4d46],{'code':_0x6c30('0x83'),'message':_0x1e2f34[_0x6c30('0x22')]});logger[_0x6c30('0x5b')](_0x6c30('0x84'),_0x1e2f34[_0x6c30('0x22')]);}},'complete':function(){try{var _0xbbc489=[];var _0x149115=tempTableName;_0xbbc489[_0x6c30('0x1e')]('CREATE\x20TABLE\x20'+_0x149115+_0x6c30('0x85'));logger[_0x6c30('0x59')](_0x6c30('0x86'),contactItemTypes['length']);var _0x3d6a45=util[_0x6c30('0xd')](_0x6c30('0x87'),_0x4d381a,_0x149115,_0x42726c,_0x57405e[_0x6c30('0x37')],_0x57405e[_0x6c30('0x56')]||null,NOW,NOW);if(_[_0x6c30('0x1b')](_0x3d1bbd[_0x6c30('0x88')])){_0x3d6a45+=',\x20scheduledAt\x20=\x20NOW()';}_0xbbc489[_0x6c30('0x1e')](_0x3d6a45);BPromise[_0x6c30('0x89')](_0xbbc489,handleQuery)[_0x6c30('0x20')](function(_0x80f1d8){BPromise[_0x6c30('0x1f')]([handleAdditionalPhones()])['then'](function(){_0xbbc489=[];for(var _0x12e5da=0x0;_0x12e5da\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','Setting','findOne','enableEmailPreview','all','clone','getSelectedTags','isEmpty','t.id\x20IN\x20?','squel','../parsers/advancedSearch','./update-interaction','./utils','../../mysqldb','role','agent','search','select','field','name','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','forEach','replace','{OPERATOR}','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?'];(function(_0x209015,_0x236665){var _0x367ebb=function(_0x18097c){while(--_0x18097c){_0x209015['push'](_0x209015['shift']());}};_0x367ebb(++_0x236665);}(_0x9002,0x73));var _0x2900=function(_0x51a4c1,_0x2df6a4){_0x51a4c1=_0x51a4c1-0x0;var _0x4c152b=_0x9002[_0x51a4c1];return _0x4c152b;};'use strict';var _=require('lodash');var squel=require(_0x2900('0x0'));var as=require(_0x2900('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x2900('0x2'))['updateInteraction'];var utils=require(_0x2900('0x3'));var db=require(_0x2900('0x4'))['db'];function skipInteractionsQuery(_0x1aaa57,_0x1b9459,_0x3fca3c){var _0x43e07e=![];var _0x4d4069=utils['getAccountFK'](_0x1aaa57);if(_0x1b9459[_0x2900('0x5')]===_0x2900('0x6')&&!_0x3fca3c[_0x2900('0x7')]&&!_0x3fca3c[_0x4d4069]){_0x43e07e=!![];}return _0x43e07e;}function getTagsQuery(){return squel[_0x2900('0x8')]()['field']('id')[_0x2900('0x9')](_0x2900('0xa'))[_0x2900('0x9')]('color')[_0x2900('0xb')](_0x2900('0xc'));}function getUsersQuery(_0x320be6,_0x113fb6){var _0x34c6b4=utils[_0x2900('0xd')](_0x320be6);var _0x3ba77d=_0x2900('0xe')+_0x320be6+_0x2900('0xf');var _0x3e8710=squel[_0x2900('0x8')]()[_0x2900('0x9')](_0x2900('0x10'))[_0x2900('0x9')](_0x2900('0x11'))[_0x2900('0x9')](_0x2900('0x12')+_0x34c6b4)[_0x2900('0xb')](_0x3ba77d,'ui')[_0x2900('0x13')](_0x2900('0x14'),'u',_0x2900('0x15'));if(_0x113fb6[_0x2900('0x16')]>0x0){_0x3e8710[_0x2900('0x17')](_0x2900('0x12')+_0x34c6b4+_0x2900('0x18'),_[_0x2900('0x19')](_0x113fb6,'id'));}return _0x3e8710;}function getInteractionsQuery(_0x5edd52){var _0xeecd18=utils[_0x2900('0x1a')](_0x5edd52);var _0x53b400=utils[_0x2900('0x1b')](_0x5edd52);var _0x13b237=utils[_0x2900('0xd')](_0x5edd52);return squel[_0x2900('0x8')]()[_0x2900('0xb')](_0xeecd18[_0x2900('0x1c')],'i')[_0x2900('0x13')](_0x2900('0x1d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x2900('0x14'),'o',_0x2900('0x1e'))[_0x2900('0x13')](_0xeecd18[_0x2900('0x1f')],'a',_0x2900('0x20')+_0x53b400)[_0x2900('0x13')](_0xeecd18[_0x2900('0x21')],'me','me.'+_0x13b237+'\x20=\x20i.id')[_0x2900('0x13')](_0xeecd18[_0x2900('0x22')],'it',_0x2900('0x23')+_0x13b237+_0x2900('0x24'))[_0x2900('0x13')]('tools_tags','t',_0x2900('0x25'));}function getSqlClauses(){var _0x2de144={'body':squel[_0x2900('0x26')](),'contact':squel[_0x2900('0x26')](),'default':squel[_0x2900('0x26')](),'fields':squel[_0x2900('0x26')](),'filter':squel[_0x2900('0x26')](),'read':squel[_0x2900('0x26')](),'tags':{'clause':squel[_0x2900('0x26')](),'ids':null},'user':squel['expr']()};return _0x2de144;}function parseTagParameter(_0x3dc34f){var _0x3b59aa=squel[_0x2900('0x26')]();if(_0x3dc34f){var _0x23fdf9=utils['getSelectedTags'](_0x3dc34f);_0x23fdf9[_0x2900('0x27')](function(_0x40cb98){_0x3b59aa['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x40cb98+',%');});}return _0x3b59aa;}function parseReadParameter(_0x2c77fd){var _0x1306c9='';if(_0x2c77fd){_0x1306c9='unreadMessages\x20{OPERATOR}\x200';if(_0x2c77fd==='1'){_0x1306c9=_0x1306c9[_0x2900('0x28')](_0x2900('0x29'),'=');}else{_0x1306c9=_0x1306c9['replace'](_0x2900('0x29'),'>');}}return _0x1306c9;}function parseSearchFilter(_0x4491ce,_0x172022){var _0x5759be=squel['expr']();if(_0x172022){var _0xd04ec8=_0x172022[_0x2900('0x28')]('\x5c','\x5c\x5c')[_0x2900('0x28')](/'/g,'\x27\x27');if(qs[_0x2900('0x2a')](_0xd04ec8)){_0x5759be['or']('i.id\x20LIKE\x20?',_0xd04ec8+'%');if(['sms',_0x2900('0x2b')][_0x2900('0x2c')](_0x4491ce)){_0x5759be['or'](_0x2900('0x2d'),_0xd04ec8+'%');}else if(_0x4491ce===_0x2900('0x2e')){_0x5759be['or'](_0x2900('0x2f'),_0xd04ec8+'%');}else if(_0x4491ce===_0x2900('0x30')){_0x5759be['or'](_0x2900('0x31'),_0xd04ec8+'%');}}else if(_0x4491ce==='mail'&&qs[_0x2900('0x32')](_0xd04ec8)){_0x5759be['or']('c.email\x20LIKE\x20?',_0xd04ec8+'%');}else{if(_0x4491ce===_0x2900('0x33')){_0x5759be['or'](_0x2900('0x34'),qs[_0x2900('0x35')](_0xd04ec8,!![]))['or'](_0x2900('0x36'),qs[_0x2900('0x35')](_0xd04ec8));}else if(_0x4491ce!=='fax'){_0x5759be['or'](_0x2900('0x37'),qs[_0x2900('0x35')](_0xd04ec8));}_0x5759be['or'](_0x2900('0x38'),qs['getFullTextValue'](_0xd04ec8,!![]),null);}}return _0x5759be;}function parseAdvancedSearchFilter(_0x669fbc,_0x4151ec){var _0x3f6422=getSqlClauses();var _0x2379a=as[_0x2900('0x39')](_0x669fbc);var _0x20f1fb=_0x2379a['sqlOperator'];for(var _0x5b33ca=0x0;_0x5b33ca<_0x2379a[_0x2900('0x3a')][_0x2900('0x16')];_0x5b33ca++){var _0x3d5fe7=_0x2379a[_0x2900('0x3a')][_0x5b33ca];var _0x3fd937='i';var _0x583af0=_[_0x2900('0x3b')](_0x4151ec,[_0x2900('0xa'),_0x3d5fe7[_0x2900('0x9')]]);if(_0x583af0){var _0x143213=as['buildExpression'](_0x3fd937,_0x583af0[_0x2900('0x3c')],_0x3d5fe7);_0x3f6422['default'][_0x20f1fb](_0x143213[_0x2900('0x3d')],_0x143213[_0x2900('0x3e')]['start'],_0x143213[_0x2900('0x3e')][_0x2900('0x3f')]);}else{switch(_0x3d5fe7[_0x2900('0x9')]){case _0x2900('0x40'):var _0x419d19=parseReadParameter(_0x3d5fe7[_0x2900('0x3e')]);_0x3f6422[_0x2900('0x41')]['and'](_0x419d19);break;case _0x2900('0x42'):if(_0x3d5fe7[_0x2900('0x43')]===_0x2900('0x44')){if(_0x3d5fe7[_0x2900('0x3e')][_0x2900('0x45')]('\x20')['length']>0x1){_0x3f6422[_0x2900('0x46')][_0x20f1fb]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2900('0x35')](_0x3d5fe7[_0x2900('0x3e')],!![]),null);}else{var _0x3826e3='%'+_0x3d5fe7[_0x2900('0x3e')]+'%';_0x3f6422[_0x2900('0x46')][_0x20f1fb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3826e3,_0x3826e3,_0x3826e3);}}else{_0x583af0=_[_0x2900('0x3b')](_0x4151ec,[_0x2900('0xa'),'ContactId']);_0x3d5fe7['field']='ContactId';_0x143213=as[_0x2900('0x47')](_0x3fd937,_0x583af0['type'],_0x3d5fe7);_0x3f6422[_0x2900('0x46')][_0x20f1fb](_0x143213['text'],_0x143213[_0x2900('0x3e')][_0x2900('0x48')],_0x143213[_0x2900('0x3e')][_0x2900('0x3f')]);}break;case _0x2900('0x49'):var _0x518cc6=_0x3d5fe7['value'][_0x2900('0x45')](',')[_0x2900('0x19')](function(_0x202889){return Number(_0x202889);});var _0x1f4e0b=parseTagParameter(_0x518cc6);_0x3f6422['tags'][_0x2900('0x4a')]['and'](_0x1f4e0b);_0x3f6422[_0x2900('0x4b')][_0x2900('0x4c')]=_0x518cc6;break;case _0x2900('0x4d'):if(_0x3d5fe7[_0x2900('0x43')]===_0x2900('0x44')){_0x3f6422[_0x2900('0x4e')][_0x20f1fb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3d5fe7['value']+'%',null);}else{_0x583af0=_[_0x2900('0x3b')](_0x4151ec,['name',_0x2900('0x4f')]);_0x3d5fe7[_0x2900('0x9')]=_0x2900('0x4f');_0x143213=as[_0x2900('0x47')](_0x3fd937,_0x583af0[_0x2900('0x3c')],_0x3d5fe7);_0x3f6422[_0x2900('0x4e')][_0x20f1fb](_0x143213[_0x2900('0x3d')],_0x143213[_0x2900('0x3e')][_0x2900('0x48')],_0x143213['value'][_0x2900('0x3f')]);}break;case _0x2900('0x50'):case'plainBody':_0x143213=as[_0x2900('0x47')]('me',null,_0x3d5fe7);_0x3f6422[_0x2900('0x50')][_0x20f1fb](_0x143213['text'],_0x143213[_0x2900('0x3e')]['start'],_0x143213[_0x2900('0x3e')][_0x2900('0x3f')]);break;}}}return _0x3f6422;}function parseModelFields(_0x35dae6,_0x5d4776,_0x5846b6){var _0x56495b=utils[_0x2900('0x1b')](_0x35dae6);var _0x1028e7=squel[_0x2900('0x26')]();var _0x192cbe=_(_0x5d4776)[_0x2900('0x51')]()[_0x2900('0x19')](function(_0x2f4226){return _[_0x2900('0x52')](_0x5846b6,[_0x2900('0xa'),_0x2f4226])?_0x2f4226:undefined;})[_0x2900('0x53')]()[_0x2900('0x3e')]();if(_0x192cbe[_0x2900('0x16')]>0x0){_0x192cbe[_0x2900('0x27')](function(_0x26af73){if(_0x26af73===_0x56495b){_0x1028e7['and']('i.'+_0x56495b+_0x2900('0x18'),[][_0x2900('0x54')](_0x5d4776[_0x26af73]));}else if(_0x26af73===_0x2900('0x55')){var _0x881a77=JSON['parse'](_0x5d4776[_0x26af73])['$gte'];var _0x24112e=JSON['parse'](_0x5d4776[_0x26af73])[_0x2900('0x56')];_0x1028e7['and'](_0x2900('0x57'),_0x881a77,_0x24112e);}else{if(_0x5d4776[_0x26af73]===_0x2900('0x58')){_0x1028e7[_0x2900('0x59')]('i.'+_0x26af73+_0x2900('0x5a'));}else{_0x1028e7[_0x2900('0x59')]('i.'+_0x26af73+_0x2900('0x5b'),_0x5d4776[_0x26af73]);}}});}return _0x1028e7;}function parseQueryParameters(_0x57aa45,_0x4322b4,_0x1478a0){var _0x36f354=getSqlClauses();return Promise[_0x2900('0x5c')]()[_0x2900('0x5d')](function(){return parseModelFields(_0x57aa45,_0x4322b4,_0x1478a0);})['then'](function(_0x2c1a2e){_0x36f354['fields'][_0x2900('0x59')](_0x2c1a2e);return parseReadParameter(_0x4322b4['read']);})[_0x2900('0x5d')](function(_0x372302){_0x36f354['read']['and'](_0x372302);return parseTagParameter(_0x4322b4[_0x2900('0x5e')]);})[_0x2900('0x5d')](function(_0x37be6b){_0x36f354['tags'][_0x2900('0x4a')][_0x2900('0x59')](_0x37be6b);return parseSearchFilter(_0x57aa45,_0x4322b4[_0x2900('0x5f')]);})[_0x2900('0x5d')](function(_0x3d20cb){_0x36f354[_0x2900('0x5f')]=_0x3d20cb;return _0x36f354;});}function checkAccountsRestrictions(_0xfbc4df,_0x3bafba,_0x4b0cac){var _0x1c23c2=utils[_0x2900('0x1b')](_0xfbc4df);var _0x32eb88=_0x2900('0x60')+_[_0x2900('0x61')](_0xfbc4df)+(_0xfbc4df===_0x2900('0x62')?_0x2900('0x63'):_0x2900('0x64'));var _0x3c1cfb=squel[_0x2900('0x26')]();return Promise[_0x2900('0x5c')]()[_0x2900('0x5d')](function(){if(_0x4b0cac[_0x2900('0x7')]&&_0x3bafba['role']==='agent'){return _0x3bafba[_0x32eb88]({'attributes':['id'],'raw':!![]});}})[_0x2900('0x5d')](function(_0x538cf4){if(_0x538cf4){if(_0x538cf4[_0x2900('0x16')]===0x0){_0x3c1cfb[_0x2900('0x59')]('i.'+_0x1c23c2+_0x2900('0x5a'));}else{_0x3c1cfb[_0x2900('0x59')]('i.'+_0x1c23c2+_0x2900('0x18'),_[_0x2900('0x19')](_0x538cf4,'id'));}}else if(!_0x4b0cac[_0x1c23c2]){_0x3c1cfb[_0x2900('0x59')]('i.'+_0x1c23c2+'\x20IS\x20NOT\x20NULL');}})[_0x2900('0x5d')](function(){return _0x3c1cfb;});}function getClosedOrderClause(_0x5b2c31,_0x4a5ef6){var _0x2c368e='';var _0x231823=['i.thirdDisposition',_0x2900('0x65'),_0x2900('0x66')];if(_0x5b2c31===_0x2900('0x33')){_0x231823[_0x2900('0x67')](_0x2900('0x68'));}if(_0x4a5ef6[_0x2900('0x69')]==='0'&&_0x5b2c31===_0x2900('0x33')){_0x2c368e=_0x2900('0x68');}else{if(_0x4a5ef6['closed']==='1'){_0x231823[_0x2900('0x6a')]();}_0x2c368e=_0x2900('0x6b')+_0x231823[_0x2900('0x6c')](',\x20')+')';}return _0x2c368e;}function getFilteredInteractions(_0x46af66,_0x425a7a,_0x1a61f1,_0x169ed9){var _0x286168=utils['getInteractionFK'](_0x46af66);var _0x22a4c3=_[_0x2900('0x61')](_0x46af66)+_0x2900('0x6d');var _0x36ce36=[];var _0x470bce=getTagsQuery();var _0x2b4c32={'type':db[_0x2900('0x6e')]['QueryTypes'][_0x2900('0x6f')],'raw':!![]};var _0x2bcde6=[];var _0x35b42a=[];return db[_0x2900('0x70')][_0x2900('0x71')](_0x470bce[_0x2900('0x72')](),_0x2b4c32)[_0x2900('0x5d')](function(_0x1eb5a1){_0x36ce36=_['keyBy'](_0x1eb5a1,'id');_0x2b4c32=_[_0x2900('0x73')](_0x2b4c32,{'model':db[_0x22a4c3],'mapToModel':!![],'nest':!![]});if(_0x1a61f1[_0x2900('0x74')]){_0x169ed9[_0x2900('0x75')][_0x2900('0x27')](function(_0x5e5622){_0x425a7a['field']('i.'+_0x5e5622);});}else{_0x425a7a[_0x2900('0x9')](_0x2900('0x76'),'unreadMessages');_0x425a7a[_0x2900('0x9')](_0x2900('0x77'),'Account.key');_0x425a7a[_0x2900('0x9')](_0x2900('0x78'),_0x2900('0x79'));if(_0x46af66==='mail'){_0x425a7a[_0x2900('0x9')](_0x2900('0x7a'),'Account.email');_0x425a7a['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x2900('0x7b'));_0x425a7a[_0x2900('0x9')](_0x2900('0x7c'));_0x425a7a[_0x2900('0x9')](_0x2900('0x7d'));_0x425a7a['field']('i.updatedAt');_0x425a7a[_0x2900('0x9')]('i.closed');_0x425a7a[_0x2900('0x9')](_0x2900('0x7e'));_0x425a7a['field'](_0x2900('0x7f'));_0x425a7a['field'](_0x2900('0x80'));_0x425a7a['field'](_0x2900('0x81'));_0x425a7a['field'](_0x2900('0x82'));_0x425a7a['field'](_0x2900('0x66'));_0x425a7a[_0x2900('0x9')](_0x2900('0x65'));_0x425a7a[_0x2900('0x9')](_0x2900('0x83'));_0x425a7a[_0x2900('0x9')](_0x2900('0x68'));_0x425a7a['field'](_0x2900('0x84'));_0x425a7a[_0x2900('0x9')](_0x2900('0x85'));_0x425a7a[_0x2900('0x9')](_0x2900('0x86'));_0x425a7a[_0x2900('0x9')](_0x2900('0x87'));}else if(_0x46af66===_0x2900('0x30')){_0x425a7a[_0x2900('0x9')](_0x2900('0x88'),_0x2900('0x7b'));}else{_0x425a7a[_0x2900('0x9')](_0x2900('0x89'),_0x2900('0x7b'));}if(_0x46af66!==_0x2900('0x33')){_0x425a7a['field'](_0x2900('0x8a'));}_0x425a7a[_0x2900('0x9')](_0x2900('0x8b'),'Contact.firstName');_0x425a7a['field'](_0x2900('0x8c'),_0x2900('0x8d'));_0x425a7a['field'](_0x2900('0x8e'),_0x2900('0x8f'));_0x425a7a['field'](_0x2900('0x90'),_0x2900('0x91'));_0x425a7a['field'](_0x2900('0x92'),'Contact.mobile');_0x425a7a[_0x2900('0x9')](_0x2900('0x93'),_0x2900('0x94'));_0x425a7a[_0x2900('0x9')](_0x2900('0x95'),'Owner.fullname');_0x425a7a[_0x2900('0x9')](_0x2900('0x96'),_0x2900('0x97'));_0x425a7a[_0x2900('0x9')](_0x2900('0x98'),'TagIds');}if(_0x169ed9[_0x2900('0x99')]){_0x425a7a[_0x2900('0x99')](_0x169ed9['limit']);}if(_0x169ed9[_0x2900('0x9a')]){_0x425a7a[_0x2900('0x9a')](_0x169ed9[_0x2900('0x9a')]);}return db[_0x2900('0x70')][_0x2900('0x71')](_0x425a7a[_0x2900('0x72')](),_0x2b4c32);})['then'](function(_0x310624){_0x2bcde6=_0x310624;var _0x221d93=getUsersQuery(_0x46af66,_0x2bcde6);return db[_0x2900('0x70')]['query'](_0x221d93[_0x2900('0x72')](),_0x2b4c32);})[_0x2900('0x5d')](function(_0x385253){_0x35b42a=_['groupBy'](_0x385253,_0x286168);if(_0x46af66===_0x2900('0x33')){return db[_0x2900('0x9b')][_0x2900('0x9c')]({'attributes':[_0x2900('0x9d')],'raw':!![]});}})[_0x2900('0x5d')](function(_0x15792b){var _0x21b588=_0x15792b?_0x15792b[_0x2900('0x9d')]:undefined;var _0x76686a=_0x2bcde6[_0x2900('0x19')](function(_0x37edec){return updateInteraction(_0x37edec,_0x36ce36,_0x35b42a,_0x21b588);});return Promise[_0x2900('0x9e')](_0x76686a);});}function countFilteredInteractions(_0x200c97,_0x477d9f){var _0x4808f6=_0x200c97[_0x2900('0x9f')]();_0x4808f6[_0x2900('0x9')]('COUNT(*)');_0x4808f6[_0x2900('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x29790b=utils[_0x2900('0xa0')](_0x477d9f);if(!_[_0x2900('0xa1')](_0x29790b)){_0x4808f6[_0x2900('0x17')](_0x2900('0xa2'),_0x29790b);}var _0x520fbb={'type':db[_0x2900('0x6e')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x2900('0x70')][_0x2900('0x71')](_0x4808f6['toString'](),_0x520fbb);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x94ad=['i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','end','unreadMessages','read','and','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','tags','User','operator','user','UserId','body','plainBody','keys','some','compact','forEach','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','mail','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','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','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','getSelectedTags','lodash','squel','../parsers/qs','./update-interaction','./utils','getAccountFK','role','search','select','field','name','color','from','tools_tags','_interactions','u.id','ui.','users','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','cm_contacts','left_join','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric'];(function(_0x2ef6b5,_0x4ca68a){var _0x1314e8=function(_0xe013f7){while(--_0xe013f7){_0x2ef6b5['push'](_0x2ef6b5['shift']());}};_0x1314e8(++_0x4ca68a);}(_0x94ad,0x7a));var _0xd94a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94ad[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd94a('0x0'));var squel=require(_0xd94a('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xd94a('0x2'));var updateInteraction=require(_0xd94a('0x3'))['updateInteraction'];var utils=require(_0xd94a('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x2dcee7,_0x2aac01,_0x5e4cf3){var _0x43fba1=![];var _0x54ca68=utils[_0xd94a('0x5')](_0x2dcee7);if(_0x2aac01[_0xd94a('0x6')]==='agent'&&!_0x5e4cf3[_0xd94a('0x7')]&&!_0x5e4cf3[_0x54ca68]){_0x43fba1=!![];}return _0x43fba1;}function getTagsQuery(){return squel[_0xd94a('0x8')]()[_0xd94a('0x9')]('id')[_0xd94a('0x9')](_0xd94a('0xa'))['field'](_0xd94a('0xb'))[_0xd94a('0xc')](_0xd94a('0xd'));}function getUsersQuery(_0x3c5bd0,_0x1bafc3){var _0x9cbafe=utils['getInteractionFK'](_0x3c5bd0);var _0x26cd63='user_has_'+_0x3c5bd0+_0xd94a('0xe');var _0x58a5c7=squel['select']()['field'](_0xd94a('0xf'))[_0xd94a('0x9')]('u.fullname')[_0xd94a('0x9')](_0xd94a('0x10')+_0x9cbafe)[_0xd94a('0xc')](_0x26cd63,'ui')['left_join'](_0xd94a('0x11'),'u','u.id\x20=\x20ui.UserId');if(_0x1bafc3[_0xd94a('0x12')]>0x0){_0x58a5c7[_0xd94a('0x13')](_0xd94a('0x10')+_0x9cbafe+_0xd94a('0x14'),_[_0xd94a('0x15')](_0x1bafc3,'id'));}return _0x58a5c7;}function getInteractionsQuery(_0xe0aaea){var _0x7cda42=utils[_0xd94a('0x16')](_0xe0aaea);var _0x5c03de=utils[_0xd94a('0x5')](_0xe0aaea);var _0x56af8b=utils[_0xd94a('0x17')](_0xe0aaea);return squel['select']()['from'](_0x7cda42[_0xd94a('0x18')],'i')['left_join'](_0xd94a('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xd94a('0x11'),'o','o.id\x20=\x20i.UserId')[_0xd94a('0x1a')](_0x7cda42['accounts'],'a','a.id\x20=\x20i.'+_0x5c03de)[_0xd94a('0x1a')](_0x7cda42[_0xd94a('0x1b')],'me','me.'+_0x56af8b+_0xd94a('0x1c'))['left_join'](_0x7cda42[_0xd94a('0x1d')],'it',_0xd94a('0x1e')+_0x56af8b+_0xd94a('0x1c'))[_0xd94a('0x1a')](_0xd94a('0xd'),'t',_0xd94a('0x1f'));}function getSqlClauses(){var _0xa4a68a={'body':squel[_0xd94a('0x20')](),'contact':squel[_0xd94a('0x20')](),'default':squel[_0xd94a('0x20')](),'fields':squel[_0xd94a('0x20')](),'filter':squel[_0xd94a('0x20')](),'read':squel[_0xd94a('0x20')](),'tags':{'clause':squel[_0xd94a('0x20')](),'ids':null},'user':squel[_0xd94a('0x20')]()};return _0xa4a68a;}function parseTagParameter(_0x5007c9){var _0x84245d=squel[_0xd94a('0x20')]();if(_0x5007c9){var _0x3bc2bf=utils['getSelectedTags'](_0x5007c9);_0x3bc2bf['forEach'](function(_0x4ee2f5){_0x84245d['or'](_0xd94a('0x21'),'%,'+_0x4ee2f5+',%');});}return _0x84245d;}function parseReadParameter(_0x4d80ef){var _0x193041='';if(_0x4d80ef){_0x193041='unreadMessages\x20{OPERATOR}\x200';if(_0x4d80ef==='1'){_0x193041=_0x193041[_0xd94a('0x22')](_0xd94a('0x23'),'=');}else{_0x193041=_0x193041[_0xd94a('0x22')](_0xd94a('0x23'),'>');}}return _0x193041;}function parseSearchFilter(_0x3aa675,_0x944b6f){var _0x429b25=squel['expr']();if(_0x944b6f){var _0x1649b6=_0x944b6f[_0xd94a('0x22')]('\x5c','\x5c\x5c')[_0xd94a('0x22')](/'/g,'\x27\x27');if(qs[_0xd94a('0x24')](_0x1649b6)){_0x429b25['or'](_0xd94a('0x25'),_0x1649b6+'%');if([_0xd94a('0x26'),_0xd94a('0x27')][_0xd94a('0x28')](_0x3aa675)){_0x429b25['or'](_0xd94a('0x29'),_0x1649b6+'%');}else if(_0x3aa675===_0xd94a('0x2a')){_0x429b25['or'](_0xd94a('0x2b'),_0x1649b6+'%');}else if(_0x3aa675===_0xd94a('0x2c')){_0x429b25['or'](_0xd94a('0x2d'),_0x1649b6+'%');}}else if(_0x3aa675==='mail'&&qs[_0xd94a('0x2e')](_0x1649b6)){_0x429b25['or'](_0xd94a('0x2f'),_0x1649b6+'%');}else{if(_0x3aa675==='mail'){_0x429b25['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1649b6,!![]))['or'](_0xd94a('0x30'),qs[_0xd94a('0x31')](_0x1649b6));}else if(_0x3aa675!=='fax'){_0x429b25['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd94a('0x31')](_0x1649b6));}_0x429b25['or'](_0xd94a('0x32'),qs[_0xd94a('0x31')](_0x1649b6,!![]),null);}}return _0x429b25;}function parseAdvancedSearchFilter(_0x5464b7,_0x88ccc7){var _0x1c3d66=getSqlClauses();var _0x20d776=as[_0xd94a('0x33')](_0x5464b7);var _0x35d003=_0x20d776[_0xd94a('0x34')];for(var _0x2d1e10=0x0;_0x2d1e10<_0x20d776[_0xd94a('0x35')]['length'];_0x2d1e10++){var _0x427270=_0x20d776[_0xd94a('0x35')][_0x2d1e10];var _0x55f87f='i';var _0x1da716=_[_0xd94a('0x36')](_0x88ccc7,[_0xd94a('0xa'),_0x427270[_0xd94a('0x9')]]);if(_0x1da716){var _0x5a45e8=as[_0xd94a('0x37')](_0x55f87f,_0x1da716[_0xd94a('0x38')],_0x427270);_0x1c3d66[_0xd94a('0x39')][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8[_0xd94a('0x3b')]['start'],_0x5a45e8['value'][_0xd94a('0x3c')]);}else{switch(_0x427270[_0xd94a('0x9')]){case _0xd94a('0x3d'):var _0x293b79=parseReadParameter(_0x427270[_0xd94a('0x3b')]);_0x1c3d66[_0xd94a('0x3e')][_0xd94a('0x3f')](_0x293b79);break;case'Contact':if(_0x427270['operator']===_0xd94a('0x40')){if(_0x427270['value'][_0xd94a('0x41')]('\x20')['length']>0x1){_0x1c3d66[_0xd94a('0x42')][_0x35d003]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x427270[_0xd94a('0x3b')],!![]),null);}else{var _0x25bb5d='%'+_0x427270[_0xd94a('0x3b')]+'%';_0x1c3d66[_0xd94a('0x42')][_0x35d003](_0xd94a('0x43'),_0x25bb5d,_0x25bb5d,_0x25bb5d);}}else{_0x1da716=_[_0xd94a('0x36')](_0x88ccc7,[_0xd94a('0xa'),_0xd94a('0x44')]);_0x427270[_0xd94a('0x9')]='ContactId';_0x5a45e8=as[_0xd94a('0x37')](_0x55f87f,_0x1da716[_0xd94a('0x38')],_0x427270);_0x1c3d66['contact'][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8['value'][_0xd94a('0x45')],_0x5a45e8['value'][_0xd94a('0x3c')]);}break;case _0xd94a('0x46'):var _0x1fcf14=_0x427270['value'][_0xd94a('0x41')](',')['map'](function(_0x147310){return Number(_0x147310);});var _0x474ce1=parseTagParameter(_0x1fcf14);_0x1c3d66[_0xd94a('0x47')]['clause']['and'](_0x474ce1);_0x1c3d66[_0xd94a('0x47')]['ids']=_0x1fcf14;break;case _0xd94a('0x48'):if(_0x427270[_0xd94a('0x49')]==='$substring'){_0x1c3d66[_0xd94a('0x4a')][_0x35d003]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x427270[_0xd94a('0x3b')]+'%',null);}else{_0x1da716=_[_0xd94a('0x36')](_0x88ccc7,[_0xd94a('0xa'),_0xd94a('0x4b')]);_0x427270[_0xd94a('0x9')]='UserId';_0x5a45e8=as[_0xd94a('0x37')](_0x55f87f,_0x1da716[_0xd94a('0x38')],_0x427270);_0x1c3d66[_0xd94a('0x4a')][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8['value']['start'],_0x5a45e8['value'][_0xd94a('0x3c')]);}break;case _0xd94a('0x4c'):case _0xd94a('0x4d'):_0x5a45e8=as[_0xd94a('0x37')]('me',null,_0x427270);_0x1c3d66[_0xd94a('0x4c')][_0x35d003](_0x5a45e8[_0xd94a('0x3a')],_0x5a45e8['value'][_0xd94a('0x45')],_0x5a45e8[_0xd94a('0x3b')][_0xd94a('0x3c')]);break;}}}return _0x1c3d66;}function parseModelFields(_0x22b5af,_0x3f22a5,_0x337f90){var _0x57a18b=utils[_0xd94a('0x5')](_0x22b5af);var _0x4736e6=squel[_0xd94a('0x20')]();var _0x27dae2=_(_0x3f22a5)[_0xd94a('0x4e')]()[_0xd94a('0x15')](function(_0x207222){return _[_0xd94a('0x4f')](_0x337f90,[_0xd94a('0xa'),_0x207222])?_0x207222:undefined;})[_0xd94a('0x50')]()[_0xd94a('0x3b')]();if(_0x27dae2[_0xd94a('0x12')]>0x0){_0x27dae2[_0xd94a('0x51')](function(_0x3de335){if(_0x3de335===_0x57a18b){_0x4736e6['and']('i.'+_0x57a18b+_0xd94a('0x14'),[][_0xd94a('0x52')](_0x3f22a5[_0x3de335]));}else if(_0x3de335===_0xd94a('0x53')){var _0xe27ad5=JSON[_0xd94a('0x54')](_0x3f22a5[_0x3de335])['$gte'];var _0x44aa67=JSON[_0xd94a('0x54')](_0x3f22a5[_0x3de335])[_0xd94a('0x55')];_0x4736e6[_0xd94a('0x3f')](_0xd94a('0x56'),_0xe27ad5,_0x44aa67);}else{if(_0x3f22a5[_0x3de335]===_0xd94a('0x57')){_0x4736e6['and']('i.'+_0x3de335+_0xd94a('0x58'));}else{_0x4736e6[_0xd94a('0x3f')]('i.'+_0x3de335+_0xd94a('0x59'),_0x3f22a5[_0x3de335]);}}});}return _0x4736e6;}function parseQueryParameters(_0x310df7,_0x2b539c,_0x5d489b){var _0x505be4=getSqlClauses();return Promise[_0xd94a('0x5a')]()['then'](function(){return parseModelFields(_0x310df7,_0x2b539c,_0x5d489b);})[_0xd94a('0x5b')](function(_0x38235b){_0x505be4[_0xd94a('0x5c')][_0xd94a('0x3f')](_0x38235b);return parseReadParameter(_0x2b539c['read']);})[_0xd94a('0x5b')](function(_0x336f08){_0x505be4[_0xd94a('0x3e')][_0xd94a('0x3f')](_0x336f08);return parseTagParameter(_0x2b539c[_0xd94a('0x5d')]);})[_0xd94a('0x5b')](function(_0xe13aec){_0x505be4[_0xd94a('0x47')]['clause']['and'](_0xe13aec);return parseSearchFilter(_0x310df7,_0x2b539c[_0xd94a('0x5e')]);})['then'](function(_0x3866e4){_0x505be4[_0xd94a('0x5e')]=_0x3866e4;return _0x505be4;});}function checkAccountsRestrictions(_0x4c3c61,_0xa6dbea,_0x11531f){var _0x46759d=utils[_0xd94a('0x5')](_0x4c3c61);var _0x43f091='get'+_[_0xd94a('0x5f')](_0x4c3c61)+(_0x4c3c61==='chat'?_0xd94a('0x60'):_0xd94a('0x61'));var _0x4fb3ce=squel[_0xd94a('0x20')]();return Promise[_0xd94a('0x5a')]()[_0xd94a('0x5b')](function(){if(_0x11531f[_0xd94a('0x7')]&&_0xa6dbea[_0xd94a('0x6')]===_0xd94a('0x62')){return _0xa6dbea[_0x43f091]({'attributes':['id'],'raw':!![]});}})[_0xd94a('0x5b')](function(_0x595662){if(_0x595662){if(_0x595662[_0xd94a('0x12')]===0x0){_0x4fb3ce[_0xd94a('0x3f')]('i.'+_0x46759d+_0xd94a('0x58'));}else{_0x4fb3ce[_0xd94a('0x3f')]('i.'+_0x46759d+_0xd94a('0x14'),_[_0xd94a('0x15')](_0x595662,'id'));}}else if(!_0x11531f[_0x46759d]){_0x4fb3ce[_0xd94a('0x3f')]('i.'+_0x46759d+_0xd94a('0x63'));}})[_0xd94a('0x5b')](function(){return _0x4fb3ce;});}function getClosedOrderClause(_0x55a712,_0x4f9969){var _0x2af023='';var _0x2722aa=['i.thirdDisposition',_0xd94a('0x64'),_0xd94a('0x65')];if(_0x55a712===_0xd94a('0x66')){_0x2722aa[_0xd94a('0x67')](_0xd94a('0x68'));}if(_0x4f9969[_0xd94a('0x69')]==='0'&&_0x55a712==='mail'){_0x2af023=_0xd94a('0x68');}else{if(_0x4f9969[_0xd94a('0x69')]==='1'){_0x2722aa[_0xd94a('0x6a')]();}_0x2af023=_0xd94a('0x6b')+_0x2722aa[_0xd94a('0x6c')](',\x20')+')';}return _0x2af023;}function getFilteredInteractions(_0x1b0335,_0x6131c,_0x2158ec,_0x46b4e0){var _0x559ff9=utils['getInteractionFK'](_0x1b0335);var _0x2ed3c8=_['capitalize'](_0x1b0335)+_0xd94a('0x6d');var _0x504ec5=[];var _0x349b4c=getTagsQuery();var _0x447f1a={'type':db[_0xd94a('0x6e')][_0xd94a('0x6f')][_0xd94a('0x70')],'raw':!![]};var _0x225c4e=[];var _0x1ad3dc=[];return db[_0xd94a('0x71')][_0xd94a('0x72')](_0x349b4c[_0xd94a('0x73')](),_0x447f1a)[_0xd94a('0x5b')](function(_0x5e7051){_0x504ec5=_['keyBy'](_0x5e7051,'id');_0x447f1a=_[_0xd94a('0x74')](_0x447f1a,{'model':db[_0x2ed3c8],'mapToModel':!![],'nest':!![]});if(_0x2158ec[_0xd94a('0x5c')]){_0x46b4e0['attributes'][_0xd94a('0x51')](function(_0x2ed706){_0x6131c[_0xd94a('0x9')]('i.'+_0x2ed706);});}else{_0x6131c[_0xd94a('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x6131c['field'](_0xd94a('0x75'),_0xd94a('0x76'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x77'),_0xd94a('0x78'));if(_0x1b0335===_0xd94a('0x66')){_0x6131c[_0xd94a('0x9')](_0xd94a('0x79'),_0xd94a('0x7a'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x7b'),_0xd94a('0x7c'));_0x6131c[_0xd94a('0x9')]('i.id');_0x6131c[_0xd94a('0x9')]('i.createdAt');_0x6131c['field']('i.updatedAt');_0x6131c[_0xd94a('0x9')](_0xd94a('0x7d'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x7e'));_0x6131c['field'](_0xd94a('0x7f'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x80'));_0x6131c['field'](_0xd94a('0x81'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x82'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x65'));_0x6131c['field']('i.secondDisposition');_0x6131c[_0xd94a('0x9')](_0xd94a('0x83'));_0x6131c[_0xd94a('0x9')]('i.substatus');_0x6131c[_0xd94a('0x9')](_0xd94a('0x84'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x85'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x86'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x87'));}else if(_0x1b0335==='openchannel'){_0x6131c[_0xd94a('0x9')](_0xd94a('0x88'),_0xd94a('0x7c'));}else{_0x6131c[_0xd94a('0x9')](_0xd94a('0x89'),_0xd94a('0x7c'));}if(_0x1b0335!==_0xd94a('0x66')){_0x6131c[_0xd94a('0x9')](_0xd94a('0x8a'));}_0x6131c[_0xd94a('0x9')](_0xd94a('0x8b'),_0xd94a('0x8c'));_0x6131c[_0xd94a('0x9')]('c.lastName',_0xd94a('0x8d'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x8e'),_0xd94a('0x8f'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x90'),'Contact.phone');_0x6131c[_0xd94a('0x9')](_0xd94a('0x91'),_0xd94a('0x92'));_0x6131c['field']('c.fax','Contact.fax');_0x6131c['field']('o.fullname',_0xd94a('0x93'));_0x6131c[_0xd94a('0x9')]('o.internal',_0xd94a('0x94'));_0x6131c[_0xd94a('0x9')](_0xd94a('0x95'),_0xd94a('0x96'));}if(_0x46b4e0[_0xd94a('0x97')]){_0x6131c[_0xd94a('0x97')](_0x46b4e0[_0xd94a('0x97')]);}if(_0x46b4e0[_0xd94a('0x98')]){_0x6131c['offset'](_0x46b4e0[_0xd94a('0x98')]);}return db[_0xd94a('0x71')][_0xd94a('0x72')](_0x6131c[_0xd94a('0x73')](),_0x447f1a);})[_0xd94a('0x5b')](function(_0x3ea8df){_0x225c4e=_0x3ea8df;var _0xa8a7f6=getUsersQuery(_0x1b0335,_0x225c4e);return db[_0xd94a('0x71')][_0xd94a('0x72')](_0xa8a7f6['toString'](),_0x447f1a);})[_0xd94a('0x5b')](function(_0x20210b){_0x1ad3dc=_[_0xd94a('0x99')](_0x20210b,_0x559ff9);if(_0x1b0335==='mail'){return db[_0xd94a('0x9a')]['findOne']({'attributes':[_0xd94a('0x9b')],'raw':!![]});}})[_0xd94a('0x5b')](function(_0x5cb233){var _0x28833a=_0x5cb233?_0x5cb233[_0xd94a('0x9b')]:undefined;var _0x9316f9=_0x225c4e['map'](function(_0x2edf40){return updateInteraction(_0x2edf40,_0x504ec5,_0x1ad3dc,_0x28833a);});return Promise['all'](_0x9316f9);});}function countFilteredInteractions(_0x39b944,_0x48d51b){var _0x1aa418=_0x39b944[_0xd94a('0x9c')]();_0x1aa418[_0xd94a('0x9')](_0xd94a('0x9d'));_0x1aa418['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd94a('0x3d'));var _0x272d11=utils[_0xd94a('0x9e')](_0x48d51b);if(!_['isEmpty'](_0x272d11)){_0x1aa418[_0xd94a('0x13')]('t.id\x20IN\x20?',_0x272d11);}var _0x212cce={'type':db[_0xd94a('0x6e')][_0xd94a('0x6f')]['SELECT'],'raw':!![]};return db[_0xd94a('0x71')][_0xd94a('0x72')](_0x1aa418[_0xd94a('0x73')](),_0x212cce);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 8753894..112119c 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10e3=['answered','abandoned','closed','disposition','UserId','MailMessage','out','then','plainBody','lastMsgText','trimStart','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','split','waiting','talking'];(function(_0x32caa1,_0x3ef54b){var _0x2f822f=function(_0x52f2d){while(--_0x52f2d){_0x32caa1['push'](_0x32caa1['shift']());}};_0x2f822f(++_0x3ef54b);}(_0x10e3,0x19e));var _0x310e=function(_0x48261b,_0xea7b92){_0x48261b=_0x48261b-0x0;var _0xbe8b07=_0x10e3[_0x48261b];return _0xbe8b07;};'use strict';var _=require(_0x310e('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2d332d,_0x447702){return new Promise(function(_0x253eeb,_0x217845){try{var _0x2189b6=[];if(_0x447702[_0x2d332d]){_0x2189b6=_0x447702[_0x2d332d][_0x310e('0x1')](function(_0x528db6){return{'id':_0x528db6['id'],'fullname':_0x528db6[_0x310e('0x2')]};});}return _0x253eeb(_0x2189b6);}catch(_0x1cb17f){_0x217845(_0x1cb17f);}});}function getInteractionTags(_0x2d9498,_0x5d727b){var _0x2f4490=[];if(_0x2d9498){_0x2d9498[_0x310e('0x3')](',')['forEach'](function(_0x5733f2){_0x2f4490['push'](_0x5d727b[_0x5733f2]);});}return _0x2f4490;}function updateWaitingCounter(_0x2192ee){if(_0x2192ee[_0x310e('0x4')]){_0x2192ee[_0x310e('0x4')]-=0x1;}}function updateInteractionCounters(_0x43384b){_0x43384b[_0x310e('0x4')]=0x0;_0x43384b[_0x310e('0x5')]=0x0;_0x43384b[_0x310e('0x6')]=0x0;_0x43384b['unmanaged']=0x0;_0x43384b[_0x310e('0x7')]=0x0;_0x43384b['total']=0x0;if(_0x43384b[_0x310e('0x8')]){if(_0x43384b[_0x310e('0x9')]===_0x310e('0x7')){_0x43384b['abandoned']+=0x1;updateWaitingCounter(_0x43384b);}if(_0x43384b[_0x310e('0xa')]){_0x43384b['answered']+=0x1;if(_0x43384b[_0x310e('0x5')]){_0x43384b[_0x310e('0x5')]-=0x1;}}else{if(_0x43384b[_0x310e('0x9')]){_0x43384b['unmanaged']+=0x1;updateWaitingCounter(_0x43384b);}}}else{if(!_0x43384b[_0x310e('0xa')]){_0x43384b['waiting']+=0x1;}if(_0x43384b[_0x310e('0xa')]){_0x43384b[_0x310e('0x5')]+=0x1;updateWaitingCounter(_0x43384b);}}_0x43384b['total']+=0x1;return _0x43384b;}function getLastMessageText(_0x40ddcd){return db[_0x310e('0xb')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x40ddcd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x310e('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x310e('0xd')](function(_0x261d14){if(_0x261d14&&_0x261d14[_0x310e('0xe')]){_0x40ddcd[_0x310e('0xf')]=_[_0x310e('0x10')](_0x261d14[_0x310e('0xe')]);}return _0x40ddcd;})['catch'](function(_0x27ddc5){throw _0x27ddc5;});}exports[_0x310e('0x11')]=function(_0x45aea3,_0x4c6ca2,_0x15b1b9,_0xcb4440){return new Promise(function(_0x452ad2,_0x27f737){return getInteractionUsers(_0x45aea3['id'],_0x15b1b9)[_0x310e('0xd')](function(_0x1624df){_0x45aea3[_0x310e('0x12')]=_0x1624df;return getInteractionTags(_0x45aea3[_0x310e('0x13')],_0x4c6ca2);})['then'](function(_0x4771fd){_0x45aea3[_0x310e('0x14')]=_0x4771fd;delete _0x45aea3[_0x310e('0x13')];return updateInteractionCounters(_0x45aea3);})[_0x310e('0xd')](function(_0x5c7cd3){if(_0xcb4440){return getLastMessageText(_0x5c7cd3);}else{return _0x5c7cd3;}})['then'](function(_0x4f5ea9){_0x452ad2(_0x4f5ea9);})['catch'](function(_0xa15998){_0x27f737(_0xa15998);});});}; \ No newline at end of file +var _0xf424=['Users','TagIds','Tags','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','-id','plainBody','trimStart','catch','updateInteraction','then'];(function(_0x23e954,_0x17edbf){var _0x2291d3=function(_0x12f9e5){while(--_0x12f9e5){_0x23e954['push'](_0x23e954['shift']());}};_0x2291d3(++_0x17edbf);}(_0xf424,0xcb));var _0x4f42=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xf424[_0x4409e7];return _0x24c751;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2b9de8,_0x19d0a2){return new Promise(function(_0x159f7c,_0xa626a5){try{var _0x130058=[];if(_0x19d0a2[_0x2b9de8]){_0x130058=_0x19d0a2[_0x2b9de8]['map'](function(_0x2561ca){return{'id':_0x2561ca['id'],'fullname':_0x2561ca[_0x4f42('0x0')]};});}return _0x159f7c(_0x130058);}catch(_0x28d6e2){_0xa626a5(_0x28d6e2);}});}function getInteractionTags(_0x37e157,_0x1dd3b7){var _0x188577=[];if(_0x37e157){_0x37e157[_0x4f42('0x1')](',')[_0x4f42('0x2')](function(_0x5bb55f){_0x188577[_0x4f42('0x3')](_0x1dd3b7[_0x5bb55f]);});}return _0x188577;}function updateWaitingCounter(_0x5cb413){if(_0x5cb413[_0x4f42('0x4')]){_0x5cb413[_0x4f42('0x4')]-=0x1;}}function updateInteractionCounters(_0x5966b8){_0x5966b8[_0x4f42('0x4')]=0x0;_0x5966b8[_0x4f42('0x5')]=0x0;_0x5966b8[_0x4f42('0x6')]=0x0;_0x5966b8[_0x4f42('0x7')]=0x0;_0x5966b8[_0x4f42('0x8')]=0x0;_0x5966b8[_0x4f42('0x9')]=0x0;if(_0x5966b8[_0x4f42('0xa')]){if(_0x5966b8[_0x4f42('0xb')]===_0x4f42('0x8')){_0x5966b8[_0x4f42('0x8')]+=0x1;updateWaitingCounter(_0x5966b8);}if(_0x5966b8['UserId']){_0x5966b8[_0x4f42('0x6')]+=0x1;if(_0x5966b8[_0x4f42('0x5')]){_0x5966b8[_0x4f42('0x5')]-=0x1;}}else{if(_0x5966b8[_0x4f42('0xb')]){_0x5966b8[_0x4f42('0x7')]+=0x1;updateWaitingCounter(_0x5966b8);}}}else{if(!_0x5966b8[_0x4f42('0xc')]){_0x5966b8['waiting']+=0x1;}if(_0x5966b8[_0x4f42('0xc')]){_0x5966b8[_0x4f42('0x5')]+=0x1;updateWaitingCounter(_0x5966b8);}}_0x5966b8[_0x4f42('0x9')]+=0x1;return _0x5966b8;}function getLastMessageText(_0x9ad046){return db[_0x4f42('0xd')][_0x4f42('0xe')]({'where':{'$and':[{'MailInteractionId':_0x9ad046['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4f42('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x4f42('0x10'),'raw':!![]})['then'](function(_0x3fb33a){if(_0x3fb33a&&_0x3fb33a[_0x4f42('0x11')]){_0x9ad046['lastMsgText']=_[_0x4f42('0x12')](_0x3fb33a[_0x4f42('0x11')]);}return _0x9ad046;})[_0x4f42('0x13')](function(_0x51a6df){throw _0x51a6df;});}exports[_0x4f42('0x14')]=function(_0x35145d,_0xd4145d,_0x7d7e40,_0x3711f0){return new Promise(function(_0x161292,_0x20f664){return getInteractionUsers(_0x35145d['id'],_0x7d7e40)[_0x4f42('0x15')](function(_0x1976f8){_0x35145d[_0x4f42('0x16')]=_0x1976f8;return getInteractionTags(_0x35145d[_0x4f42('0x17')],_0xd4145d);})[_0x4f42('0x15')](function(_0x9a4b30){_0x35145d[_0x4f42('0x18')]=_0x9a4b30;delete _0x35145d[_0x4f42('0x17')];return updateInteractionCounters(_0x35145d);})['then'](function(_0x4332aa){if(_0x3711f0){return getLastMessageText(_0x4332aa);}else{return _0x4332aa;}})[_0x4f42('0x15')](function(_0x55835e){_0x161292(_0x55835e);})[_0x4f42('0x13')](function(_0x497944){_0x20f664(_0x497944);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 1cb4704..eec4206 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25d0=['upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','Interaction','update','error','lodash','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','capitalize','chat','Website','Account','InteractionId'];(function(_0x5c41e3,_0x260c34){var _0x27383b=function(_0x21e8d5){while(--_0x21e8d5){_0x5c41e3['push'](_0x5c41e3['shift']());}};_0x27383b(++_0x260c34);}(_0x25d0,0xfa));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x025d('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x025d('0x1'))(_0x025d('0x2')),'mail':require(_0x025d('0x1'))(_0x025d('0x3')),'fax':require(_0x025d('0x1'))('fax-interactions'),'sms':require(_0x025d('0x1'))(_0x025d('0x4')),'chat':require(_0x025d('0x1'))('chat-interactions'),'whatsapp':require(_0x025d('0x1'))('whatsapp-interactions')};function getAccountFK(_0x517baf){return _[_0x025d('0x5')](_0x517baf)+(_0x517baf===_0x025d('0x6')?_0x025d('0x7'):_0x025d('0x8'))+'Id';}function getInteractionFK(_0x1d5828){return _[_0x025d('0x5')](_0x1d5828)+_0x025d('0x9');}function getInteractionId(_0x265fbe,_0x5ab56f,_0x250e72){if(_0x265fbe&&_0x265fbe[_[_0x025d('0xa')](_0x250e72)+'InteractionId']){return _0x265fbe[_[_0x025d('0xa')](_0x250e72)+_0x025d('0x9')];}else if(_0x265fbe&&_0x265fbe['id']){return _0x265fbe['id'];}else if(_0x5ab56f&&_0x5ab56f['id']){return _0x5ab56f['id'];}else{return _0x025d('0xb');}}function getInteractionsTables(_0x205db4){return{'accounts':_0x205db4+'_'+(_0x205db4===_0x025d('0x6')?'websites':_0x025d('0xc')),'interactions':_0x205db4+_0x025d('0xd'),'interactionsTags':_0x205db4+_0x025d('0xe'),'messages':_0x205db4+_0x025d('0xf'),'userInteractions':_0x025d('0x10')+_0x205db4+'_interactions'};}function getSelectedTags(_0x28bc7e){var _0x54071e=[];if(_0x28bc7e){_0x54071e=Array[_0x025d('0x11')](_0x28bc7e)?_0x28bc7e:[_0x28bc7e];}return _0x54071e;}function log(_0x2d9c31,_0x16963c,_0x32148b,_0x57d33d,_0x474e59,_0x558caf){loggers[_0x474e59[_0x025d('0x12')]()][_0x2d9c31](_0x025d('0x13'),_0x558caf['toUpperCase'](),_0x16963c?_0x16963c['id']:null,_0x16963c?_0x16963c[_0x025d('0x14')]:null,_0x16963c?_0x16963c[_0x025d('0x15')]:null,getInteractionId(_0x32148b,_0x57d33d,_0x474e59),_0x32148b?JSON[_0x025d('0x16')](_0x32148b):'null');}function updateUser(_0xaceb3b,_0x5d5378,_0x56d2b6,_0x416667,_0x43448b){db[_[_0x025d('0xa')](_0x416667)+_0x025d('0x17')]['findOne']({'where':{'id':getInteractionId(_0x5d5378,_0x56d2b6,_0x416667)}})['then'](function(_0x50070b){if(_0x50070b){return _0x50070b[_0x025d('0x18')]({'UserId':_0xaceb3b?_0xaceb3b['id']:null});}})['then'](function(_0x44619d){if(_0x44619d){log('info',_0xaceb3b,_0x5d5378,_0x56d2b6,_0x416667,_0x43448b);}})['catch'](function(){log(_0x025d('0x19'),_0xaceb3b,_0x5d5378,_0x56d2b6,_0x416667,_0x43448b);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xd832=['info','catch','error','lodash','../../mysqldb','openchannel-interactions','mail-interactions','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','toUpperCase','name','role','stringify','null','Interaction','then'];(function(_0xd0f54d,_0x570712){var _0x225884=function(_0x369e60){while(--_0x369e60){_0xd0f54d['push'](_0xd0f54d['shift']());}};_0x225884(++_0x570712);}(_0xd832,0x1c3));var _0x2d83=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xd832[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x2d83('0x0'));var db=require(_0x2d83('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2d83('0x2')),'mail':require('../../config/logger')(_0x2d83('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x2d83('0x4'))(_0x2d83('0x5')),'chat':require(_0x2d83('0x4'))(_0x2d83('0x6')),'whatsapp':require(_0x2d83('0x4'))(_0x2d83('0x7'))};function getAccountFK(_0x9350f){return _[_0x2d83('0x8')](_0x9350f)+(_0x9350f===_0x2d83('0x9')?'Website':_0x2d83('0xa'))+'Id';}function getInteractionFK(_0x5d6b13){return _[_0x2d83('0x8')](_0x5d6b13)+_0x2d83('0xb');}function getInteractionId(_0x5518d4,_0x341c8f,_0x2a35bf){if(_0x5518d4&&_0x5518d4[_[_0x2d83('0xc')](_0x2a35bf)+'InteractionId']){return _0x5518d4[_[_0x2d83('0xc')](_0x2a35bf)+_0x2d83('0xb')];}else if(_0x5518d4&&_0x5518d4['id']){return _0x5518d4['id'];}else if(_0x341c8f&&_0x341c8f['id']){return _0x341c8f['id'];}else{return _0x2d83('0xd');}}function getInteractionsTables(_0x46684c){return{'accounts':_0x46684c+'_'+(_0x46684c==='chat'?_0x2d83('0xe'):'accounts'),'interactions':_0x46684c+_0x2d83('0xf'),'interactionsTags':_0x46684c+_0x2d83('0x10'),'messages':_0x46684c+_0x2d83('0x11'),'userInteractions':'user_has_'+_0x46684c+_0x2d83('0xf')};}function getSelectedTags(_0xedf4a0){var _0x4d97d8=[];if(_0xedf4a0){_0x4d97d8=Array['isArray'](_0xedf4a0)?_0xedf4a0:[_0xedf4a0];}return _0x4d97d8;}function log(_0x2ae0e7,_0x224065,_0x4418a6,_0x36ab10,_0x5beaf2,_0x1a2e82){loggers[_0x5beaf2['toLowerCase']()][_0x2ae0e7]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a2e82[_0x2d83('0x12')](),_0x224065?_0x224065['id']:null,_0x224065?_0x224065[_0x2d83('0x13')]:null,_0x224065?_0x224065[_0x2d83('0x14')]:null,getInteractionId(_0x4418a6,_0x36ab10,_0x5beaf2),_0x4418a6?JSON[_0x2d83('0x15')](_0x4418a6):_0x2d83('0x16'));}function updateUser(_0x418903,_0x5778aa,_0x4d41c3,_0x431344,_0x13603f){db[_[_0x2d83('0xc')](_0x431344)+_0x2d83('0x17')]['findOne']({'where':{'id':getInteractionId(_0x5778aa,_0x4d41c3,_0x431344)}})[_0x2d83('0x18')](function(_0x308ac9){if(_0x308ac9){return _0x308ac9['update']({'UserId':_0x418903?_0x418903['id']:null});}})[_0x2d83('0x18')](function(_0x53fbe1){if(_0x53fbe1){log(_0x2d83('0x19'),_0x418903,_0x5778aa,_0x4d41c3,_0x431344,_0x13603f);}})[_0x2d83('0x1a')](function(){log(_0x2d83('0x1b'),_0x418903,_0x5778aa,_0x4d41c3,_0x431344,_0x13603f);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index ae4417e..859c760 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 _0xb2ca=['User','admin','user','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x35025a,_0x58866e){var _0x9f82a0=function(_0x55dea5){while(--_0x55dea5){_0x35025a['push'](_0x35025a['shift']());}};_0x9f82a0(++_0x58866e);}(_0xb2ca,0x162));var _0xab2c=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb2ca[_0x2aec52];return _0x3b8835;};'use strict';var crypto=require(_0xab2c('0x0'));var util=require(_0xab2c('0x1'));var compose=require(_0xab2c('0x2'));var db=require(_0xab2c('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1b01ee,_0x58a19a){if(_0x1b01ee&&_0x58a19a){if(_0x58a19a[_0xab2c('0x4')]&&_0x58a19a[_0xab2c('0x5')]){var _0x79cf90=_0x58a19a[_0xab2c('0x4')];var _0x3cdfa4=_0x58a19a[_0xab2c('0x5')];var _0x3af972=_0x79cf90[_0xab2c('0x6')]('-')[0x4];var _0x293e5=_0x79cf90[_0xab2c('0x6')]('-')[0x0];var _0x5dc776=crypto[_0xab2c('0x7')]('aes-256-ctr',util[_0xab2c('0x8')](_0xab2c('0x9'),_0x3af972,_0x79cf90,_0x293e5));var _0x27e8ce=_0x5dc776[_0xab2c('0xa')](_0x3cdfa4,_0xab2c('0xb'),_0xab2c('0xc'));_0x27e8ce+=_0x5dc776[_0xab2c('0xd')](_0xab2c('0xc'));var _0x2f632b=JSON[_0xab2c('0xe')](_0x27e8ce);return _0x2f632b['hasOwnProperty'](_0x1b01ee)?_0x2f632b[_0x1b01ee]:null;}}return null;}function isLimit(_0x540738,_0x5b373e,_0xee0c25,_0x1b1605){var _0x2bb895=_0x5b373e;return compose()[_0xab2c('0xf')](function(_0x54fb44,_0x50217f,_0x549a27){return db[_0xab2c('0x10')][_0xab2c('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1c4d30){var _0x2ac01a=getValueFromLicense(_0x540738,_0x1c4d30);return _0x2ac01a?_0x2ac01a:_0x2bb895;})[_0xab2c('0x12')](function(_0x415eb9){_0x2bb895=_0x415eb9;return _0xee0c25[_0xab2c('0x13')](_0x1b1605);})[_0xab2c('0x12')](function(_0x4088d1){if(_0x4088d1>=_0x2bb895){return _0x50217f[_0xab2c('0x14')](0x193)['json']({'message':util[_0xab2c('0x8')](_0xab2c('0x15'),_0x540738)});}_0x549a27();})[_0xab2c('0x16')](function(_0x46f1e3){_0x549a27(_0x46f1e3);});});}function isUserLimit(){return isLimit(_0xab2c('0x17'),0x1,db[_0xab2c('0x18')],{'where':{'$or':[{'role':_0xab2c('0x19')},{'role':_0xab2c('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x70e9=['%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','status','json','catch','users','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split','aes-256-ctr','format'];(function(_0x128690,_0x5bd3fa){var _0x16d9b0=function(_0x15b907){while(--_0x15b907){_0x128690['push'](_0x128690['shift']());}};_0x16d9b0(++_0x5bd3fa);}(_0x70e9,0x1d2));var _0x970e=function(_0x35bcb6,_0xceae78){_0x35bcb6=_0x35bcb6-0x0;var _0x5930fe=_0x70e9[_0x35bcb6];return _0x5930fe;};'use strict';var crypto=require(_0x970e('0x0'));var util=require(_0x970e('0x1'));var compose=require(_0x970e('0x2'));var db=require(_0x970e('0x3'))['db'];var config=require(_0x970e('0x4'));function getValueFromLicense(_0x25b671,_0x338447){if(_0x25b671&&_0x338447){if(_0x338447['data1']&&_0x338447['license']){var _0x2cb6d1=_0x338447['data1'];var _0x4feac2=_0x338447[_0x970e('0x5')];var _0x3a2290=_0x2cb6d1['split']('-')[0x4];var _0xbd2ca3=_0x2cb6d1[_0x970e('0x6')]('-')[0x0];var _0x571841=crypto['createDecipher'](_0x970e('0x7'),util[_0x970e('0x8')](_0x970e('0x9'),_0x3a2290,_0x2cb6d1,_0xbd2ca3));var _0x289c56=_0x571841[_0x970e('0xa')](_0x4feac2,_0x970e('0xb'),_0x970e('0xc'));_0x289c56+=_0x571841[_0x970e('0xd')]('utf8');var _0x10f84e=JSON[_0x970e('0xe')](_0x289c56);return _0x10f84e[_0x970e('0xf')](_0x25b671)?_0x10f84e[_0x25b671]:null;}}return null;}function isLimit(_0x9b175,_0x5a7020,_0x195751,_0x35fc33){var _0x201508=_0x5a7020;return compose()['use'](function(_0xc1b72f,_0x1bd913,_0x3bfd6e){return db[_0x970e('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x970e('0x11')](function(_0x18f858){var _0x1cd2fa=getValueFromLicense(_0x9b175,_0x18f858);return _0x1cd2fa?_0x1cd2fa:_0x201508;})['then'](function(_0x27fddb){_0x201508=_0x27fddb;return _0x195751[_0x970e('0x12')](_0x35fc33);})[_0x970e('0x11')](function(_0x1374e1){if(_0x1374e1>=_0x201508){return _0x1bd913[_0x970e('0x13')](0x193)[_0x970e('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x9b175)});}_0x3bfd6e();})[_0x970e('0x15')](function(_0x19a1aa){_0x3bfd6e(_0x19a1aa);});});}function isUserLimit(){return isLimit(_0x970e('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x970e('0x17')},{'role':'user'}]}});}exports[_0x970e('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c0191f0..9fc2d01 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 _0x1b5d=['\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','seconds','lodash','parseSearch','startsWith','[$or]','replace','[$and]','split','forEach','shift','match','indexOf','push','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','field'];(function(_0x235e65,_0x2017d4){var _0x395018=function(_0xc2dd76){while(--_0xc2dd76){_0x235e65['push'](_0x235e65['shift']());}};_0x395018(++_0x2017d4);}(_0x1b5d,0x10c));var _0xd1b5=function(_0x1c388e,_0x31f2de){_0x1c388e=_0x1c388e-0x0;var _0x4e2966=_0x1b5d[_0x1c388e];return _0x4e2966;};'use strict';var _=require(_0xd1b5('0x0'));var moment=require('moment');exports[_0xd1b5('0x1')]=function(_0x3511bd){var _0x331bcb={'conditions':[]};_0x331bcb['sqlOperator']=_[_0xd1b5('0x2')](_0x3511bd,_0xd1b5('0x3'))?'or':'and';var _0x52453b=_0x3511bd[_0xd1b5('0x4')](_0xd1b5('0x5'),'')[_0xd1b5('0x4')]('[$or]','')[_0xd1b5('0x6')]('||');for(var _0x3088b0=0x0;_0x3088b0<_0x52453b['length'];_0x3088b0++){var _0x59620e=_0x52453b[_0x3088b0][_0xd1b5('0x6')](':=');var _0x520343=_0x59620e[0x0];var _0x408985=_0x59620e['slice'](0x1);_0x408985[_0xd1b5('0x7')](function(_0x36fc35){var _0x22edf7=_0x36fc35[_0xd1b5('0x6')]('[')[_0xd1b5('0x8')]();var _0x2b1417=_0x36fc35[_0xd1b5('0x9')](/\[(.*?)\]/g);_0x2b1417[_0xd1b5('0x7')](function(_0x1ff108){var _0x556e34=_0x1ff108[_0xd1b5('0x6')]('[')['filter'](function(_0x3c0171){return _0x3c0171[_0xd1b5('0xa')](']')>-0x1;})['map'](function(_0x154213){return _0x154213['split'](']')[0x0];})[0x0];_0x331bcb['conditions'][_0xd1b5('0xb')]({'field':_0x520343,'operator':_0x22edf7,'value':_0x556e34});});});}return _0x331bcb;};exports['buildExpression']=function(_0x438836,_0x525aed,_0x5a9276){var _0x17df5a={};if(_0x525aed===_0xd1b5('0xc')){if(_0x5a9276[_0xd1b5('0xd')]===_0xd1b5('0xe')){_0x5a9276[_0xd1b5('0xd')]=_0xd1b5('0xf');_0x5a9276[_0xd1b5('0x10')]+=','+_0x5a9276[_0xd1b5('0x10')];}else if(_[_0xd1b5('0x11')](['$gt',_0xd1b5('0x12')],_0x5a9276[_0xd1b5('0xd')])){_0x5a9276[_0xd1b5('0x10')]=moment(_0x5a9276[_0xd1b5('0x10')])[_0xd1b5('0x13')](0x1,_0xd1b5('0x14'))[_0xd1b5('0x15')](_0xd1b5('0x16'));}}if(_0x5a9276[_0xd1b5('0x17')]){_0x525aed=_0x5a9276['castTo'];_0x17df5a[_0xd1b5('0x18')]='CAST('+_0x438836+'.'+_0x5a9276[_0xd1b5('0x19')]+_0xd1b5('0x1a')+_0x5a9276[_0xd1b5('0x17')]+')\x20'+parseOperator(_0x5a9276[_0xd1b5('0xd')]);}else{_0x17df5a[_0xd1b5('0x18')]=_0x438836+'.'+_0x5a9276[_0xd1b5('0x19')]+'\x20'+parseOperator(_0x5a9276['operator']);}if(_[_0xd1b5('0x11')]([_0xd1b5('0x1b'),_0xd1b5('0x1c')],_0x5a9276[_0xd1b5('0xd')]))_0x17df5a[_0xd1b5('0x18')]='('+_0x17df5a[_0xd1b5('0x18')]+_0xd1b5('0x1d')+_0x438836+'.'+_0x5a9276[_0xd1b5('0x19')]+'\x20IS\x20NULL)';_0x17df5a[_0xd1b5('0x10')]=parseValue(_0x525aed,_0x5a9276[_0xd1b5('0xd')],_0x5a9276[_0xd1b5('0x10')]);return _0x17df5a;};function parseOperator(_0x23b6a7){var _0x2863cf;switch(_0x23b6a7){case _0xd1b5('0x1e'):_0x2863cf=_0xd1b5('0x1f');break;case _0xd1b5('0x1c'):_0x2863cf='NOT\x20IN\x20?';break;case _0xd1b5('0xe'):_0x2863cf=_0xd1b5('0x20');break;case _0xd1b5('0x1b'):_0x2863cf=_0xd1b5('0x21');break;case _0xd1b5('0x22'):case _0xd1b5('0x23'):case _0xd1b5('0x24'):_0x2863cf='LIKE\x20?';break;case'$lt':_0x2863cf=_0xd1b5('0x25');break;case _0xd1b5('0x26'):_0x2863cf=_0xd1b5('0x27');break;case _0xd1b5('0x12'):_0x2863cf=_0xd1b5('0x28');break;case _0xd1b5('0x29'):_0x2863cf=_0xd1b5('0x2a');break;case _0xd1b5('0xf'):_0x2863cf=_0xd1b5('0x2b');break;}return _0x2863cf;}function parseValue(_0x366213,_0xda9ec8,_0x39692a){var _0x46c95a={'start':undefined,'end':undefined};switch(_0xda9ec8){case _0xd1b5('0x1e'):case _0xd1b5('0x1c'):_0x46c95a[_0xd1b5('0x2c')]=_0x39692a[_0xd1b5('0x6')](',');break;case'$substring':_0x46c95a[_0xd1b5('0x2c')]='%'+_0x39692a+'%';break;case'$startsWith':_0x46c95a['start']=_0x39692a+'%';break;case'$endsWith':_0x46c95a['start']='%'+_0x39692a;break;case _0xd1b5('0xf'):var _0x37d17f=_0x39692a['split'](',');var _0x39692a=_0x37d17f[_0xd1b5('0x8')]();var _0x2b5b54=_0x37d17f[_0xd1b5('0x2d')]();if(_0x366213===_0xd1b5('0xc')){_0x39692a=moment(_0x39692a)[_0xd1b5('0x2e')](0x0,!![])[_0xd1b5('0x15')]();_0x2b5b54=moment(_0x2b5b54)[_0xd1b5('0x2e')](0x0,!![])['add'](0x17,_0xd1b5('0x2f'))[_0xd1b5('0x13')](0x3b,'minutes')[_0xd1b5('0x13')](0x3b,_0xd1b5('0x30'))[_0xd1b5('0x15')]();}_0x46c95a={'start':_0x39692a,'end':_0x2b5b54};break;default:_0x46c95a['start']=_0x39692a;break;}return _0x46c95a;} \ No newline at end of file +var _0x0e5a=['DATE','operator','$between','value','includes','$gt','$lte','format','YYYY-MM-DD','field','castTo','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','<=\x20?','$gte','>=\x20?','start','$endsWith','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split','length','slice','shift','forEach','filter','indexOf','conditions','buildExpression'];(function(_0x4c83d7,_0x100731){var _0x9d1336=function(_0xb4cf3e){while(--_0xb4cf3e){_0x4c83d7['push'](_0x4c83d7['shift']());}};_0x9d1336(++_0x100731);}(_0x0e5a,0x1ba));var _0xa0e5=function(_0x1cdf7a,_0x509238){_0x1cdf7a=_0x1cdf7a-0x0;var _0xea2d6e=_0x0e5a[_0x1cdf7a];return _0xea2d6e;};'use strict';var _=require(_0xa0e5('0x0'));var moment=require(_0xa0e5('0x1'));exports[_0xa0e5('0x2')]=function(_0x2cf4ef){var _0x2f3f48={'conditions':[]};_0x2f3f48[_0xa0e5('0x3')]=_[_0xa0e5('0x4')](_0x2cf4ef,'[$or]')?'or':'and';var _0x17418b=_0x2cf4ef[_0xa0e5('0x5')](_0xa0e5('0x6'),'')[_0xa0e5('0x5')](_0xa0e5('0x7'),'')[_0xa0e5('0x8')]('||');for(var _0x137b06=0x0;_0x137b06<_0x17418b[_0xa0e5('0x9')];_0x137b06++){var _0x5ee320=_0x17418b[_0x137b06][_0xa0e5('0x8')](':=');var _0x3181bf=_0x5ee320[0x0];var _0x4d920f=_0x5ee320[_0xa0e5('0xa')](0x1);_0x4d920f['forEach'](function(_0x5a058f){var _0x3ccd2a=_0x5a058f[_0xa0e5('0x8')]('[')[_0xa0e5('0xb')]();var _0x567a48=_0x5a058f['match'](/\[(.*?)\]/g);_0x567a48[_0xa0e5('0xc')](function(_0x328c5c){var _0x496e9e=_0x328c5c['split']('[')[_0xa0e5('0xd')](function(_0x383fdd){return _0x383fdd[_0xa0e5('0xe')](']')>-0x1;})['map'](function(_0x52b370){return _0x52b370['split'](']')[0x0];})[0x0];_0x2f3f48[_0xa0e5('0xf')]['push']({'field':_0x3181bf,'operator':_0x3ccd2a,'value':_0x496e9e});});});}return _0x2f3f48;};exports[_0xa0e5('0x10')]=function(_0x2ff64a,_0x261d32,_0x15ddbe){var _0xa6522e={};if(_0x261d32===_0xa0e5('0x11')){if(_0x15ddbe[_0xa0e5('0x12')]==='$eq'){_0x15ddbe[_0xa0e5('0x12')]=_0xa0e5('0x13');_0x15ddbe[_0xa0e5('0x14')]+=','+_0x15ddbe[_0xa0e5('0x14')];}else if(_[_0xa0e5('0x15')]([_0xa0e5('0x16'),_0xa0e5('0x17')],_0x15ddbe['operator'])){_0x15ddbe[_0xa0e5('0x14')]=moment(_0x15ddbe[_0xa0e5('0x14')])['add'](0x1,'days')[_0xa0e5('0x18')](_0xa0e5('0x19'));}}if(_0x15ddbe['castTo']){_0x261d32=_0x15ddbe['castTo'];_0xa6522e['text']='CAST('+_0x2ff64a+'.'+_0x15ddbe[_0xa0e5('0x1a')]+'\x20AS\x20'+_0x15ddbe[_0xa0e5('0x1b')]+')\x20'+parseOperator(_0x15ddbe['operator']);}else{_0xa6522e[_0xa0e5('0x1c')]=_0x2ff64a+'.'+_0x15ddbe[_0xa0e5('0x1a')]+'\x20'+parseOperator(_0x15ddbe['operator']);}if(_[_0xa0e5('0x15')]([_0xa0e5('0x1d'),_0xa0e5('0x1e')],_0x15ddbe['operator']))_0xa6522e['text']='('+_0xa6522e[_0xa0e5('0x1c')]+'\x20OR\x20'+_0x2ff64a+'.'+_0x15ddbe[_0xa0e5('0x1a')]+_0xa0e5('0x1f');_0xa6522e[_0xa0e5('0x14')]=parseValue(_0x261d32,_0x15ddbe[_0xa0e5('0x12')],_0x15ddbe['value']);return _0xa6522e;};function parseOperator(_0x2682cc){var _0x34d5c2;switch(_0x2682cc){case _0xa0e5('0x20'):_0x34d5c2=_0xa0e5('0x21');break;case _0xa0e5('0x1e'):_0x34d5c2=_0xa0e5('0x22');break;case _0xa0e5('0x23'):_0x34d5c2='=\x20?';break;case'$ne':_0x34d5c2=_0xa0e5('0x24');break;case _0xa0e5('0x25'):case _0xa0e5('0x26'):case'$endsWith':_0x34d5c2=_0xa0e5('0x27');break;case'$lt':_0x34d5c2='<\x20?';break;case'$gt':_0x34d5c2='>\x20?';break;case'$lte':_0x34d5c2=_0xa0e5('0x28');break;case _0xa0e5('0x29'):_0x34d5c2=_0xa0e5('0x2a');break;case'$between':_0x34d5c2='BETWEEN\x20?\x20AND\x20?';break;}return _0x34d5c2;}function parseValue(_0x1a8e45,_0x4d77f4,_0x547852){var _0x36c0fc={'start':undefined,'end':undefined};switch(_0x4d77f4){case _0xa0e5('0x20'):case'$notIn':_0x36c0fc[_0xa0e5('0x2b')]=_0x547852[_0xa0e5('0x8')](',');break;case _0xa0e5('0x25'):_0x36c0fc['start']='%'+_0x547852+'%';break;case _0xa0e5('0x26'):_0x36c0fc[_0xa0e5('0x2b')]=_0x547852+'%';break;case _0xa0e5('0x2c'):_0x36c0fc[_0xa0e5('0x2b')]='%'+_0x547852;break;case _0xa0e5('0x13'):var _0x5788e5=_0x547852[_0xa0e5('0x8')](',');var _0x547852=_0x5788e5['shift']();var _0x178e3c=_0x5788e5[_0xa0e5('0x2d')]();if(_0x1a8e45===_0xa0e5('0x11')){_0x547852=moment(_0x547852)[_0xa0e5('0x2e')](0x0,!![])[_0xa0e5('0x18')]();_0x178e3c=moment(_0x178e3c)[_0xa0e5('0x2e')](0x0,!![])[_0xa0e5('0x2f')](0x17,_0xa0e5('0x30'))['add'](0x3b,_0xa0e5('0x31'))[_0xa0e5('0x2f')](0x3b,_0xa0e5('0x32'))[_0xa0e5('0x18')]();}_0x36c0fc={'start':_0x547852,'end':_0x178e3c};break;default:_0x36c0fc['start']=_0x547852;break;}return _0x36c0fc;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ed747bd..6c78614 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 _0xe132=['substr','DESC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','\x22{EXPR}\x22','{EXPR}','replace','push','join','$id','query','intersection','attributes','nolimit','offset','order','where','pick','filter','object','value','merge','VIRTUAL','col','lower','include','includeAll','lodash','moment','../../mysqldb','keys','parse','model','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','unsigned'];(function(_0x57b092,_0x33cc77){var _0x4a15b0=function(_0x316c74){while(--_0x316c74){_0x57b092['push'](_0x57b092['shift']());}};_0x4a15b0(++_0x33cc77);}(_0xe132,0x162));var _0x2e13=function(_0x3ca948,_0x1d38d5){_0x3ca948=_0x3ca948-0x0;var _0x4b6004=_0xe132[_0x3ca948];return _0x4b6004;};'use strict';var _=require(_0x2e13('0x0'));var sequelize=require('sequelize');var moment=require(_0x2e13('0x1'));var db=require(_0x2e13('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x21dfef){var _0x2c2bdd=['ne'];try{var _0x2a5250=JSON['parse'](_0x21dfef);var _0x1ae6a9=Object[_0x2e13('0x3')](_0x2a5250)[0x0];return _0x2c2bdd['includes'](_0x1ae6a9);}catch(_0x49e04e){return![];}}function getOperatorValue(_0x260dc1){var _0x2f9d00=JSON[_0x2e13('0x4')](_0x260dc1);var _0x71f9d3=Object[_0x2e13('0x3')](_0x2f9d00)[0x0];var _0x2d9487=_0x2f9d00[_0x71f9d3];return{['$'+_0x71f9d3]:_0x2d9487};}function parseIncludeModel(_0x370a85){var _0x6de674=JSON[_0x2e13('0x4')](_0x370a85);return{'model':db[_0x6de674[_0x2e13('0x5')]],'as':_0x6de674['alias'],'attributes':_0x6de674[_0x2e13('0x6')],'raw':_0x6de674[_0x2e13('0x7')]};}exports[_0x2e13('0x6')]=function(_0x40c2eb){var _0xf8677=null;if(_0x40c2eb){_0xf8677=_0x40c2eb[_0x2e13('0x8')](',');}return _0xf8677;};exports[_0x2e13('0x9')]=function(_0x5f4ee2,_0x3796f8){var _0x441335={};if(!_[_0x2e13('0xa')](_0x5f4ee2)){_[_0x2e13('0xb')](_0x5f4ee2,function(_0x424e58,_0x40882c){try{if(_0x3796f8){var _0x23a32a=_['find'](_0x3796f8,{'name':_0x40882c})||{};if(hasSequelizeOperator(_0x424e58)){_0x441335[_0x40882c]=getOperatorValue(_0x424e58);}else if(_0x23a32a[_0x2e13('0xc')]===_0x2e13('0xd')&&_[_0x2e13('0xe')](_0x424e58)){var _0x4bc56a=JSON[_0x2e13('0x4')](_0x424e58);var _0x2a58e5={'$gte':moment(moment(_0x4bc56a[_0x2e13('0xf')])['format'](_0x2e13('0x10')))[_0x2e13('0x11')]()[_0x2e13('0x12')](),'$lte':moment(moment(_0x4bc56a['$lte'])['format'](_0x2e13('0x10')))[_0x2e13('0x11')]()[_0x2e13('0x13')](0x1,'s')[_0x2e13('0x12')]()};_0x441335[_0x40882c]=_0x2a58e5;}else if(_0x23a32a[_0x2e13('0x14')]===_0x2e13('0x15')){_0x441335[_0x40882c]=_0x424e58;}else{_0x441335[_0x40882c]=_[_0x2e13('0x16')](_0x424e58)?_0x424e58:JSON[_0x2e13('0x4')](_0x424e58);}}else{_0x441335[_0x40882c]=_['isArray'](_0x424e58)?_0x424e58:JSON[_0x2e13('0x4')](_0x424e58);}}catch(_0x9c37a9){_0x441335[_0x40882c]=_0x424e58[_0x2e13('0x8')](',');}});}return _0x441335;};exports[_0x2e13('0x17')]=function(_0x479013){_0x479013=parseInt(_0x479013,0xa);if(!_0x479013||_0x479013<0x0){_0x479013=LIMIT_VALUE;}return _0x479013;};exports['offset']=function(_0x2859bf){_0x2859bf=parseInt(_0x2859bf,0xa);if(!_0x2859bf||_0x2859bf<0x0){_0x2859bf=0x0;}return _0x2859bf;};exports[_0x2e13('0x18')]=function(_0x59c180){var _0x4c769c,_0x584040=null;if(_0x59c180){_0x4c769c=_0x59c180[_0x2e13('0x8')](',');_0x584040=_[_0x2e13('0x19')](_0x4c769c,function(_0x35f952){if(_0x35f952[_0x2e13('0x1a')]('-')===0x0){return[_0x35f952===_0x2e13('0x1b')?sequelize[_0x2e13('0x1c')](sequelize['col'](_0x2e13('0x1b')),_0x2e13('0x1d')):_0x35f952[_0x2e13('0x1e')](0x1),_0x2e13('0x1f')];}else{return[_0x35f952===_0x2e13('0x1b')?sequelize[_0x2e13('0x1c')](sequelize['col'](_0x2e13('0x1b')),_0x2e13('0x1d')):_0x35f952,'ASC'];}});}return _0x584040;};exports['omit']=function(_0x15c555,_0x468102){if(_[_0x2e13('0xa')](_0x15c555)){return _0x15c555;}if(_['isArray'](_0x15c555)){for(var _0x227ef8=0x0;_0x227ef8<_0x15c555[_0x2e13('0x20')];_0x227ef8+=0x1){_0x15c555[_0x227ef8]=this[_0x2e13('0x21')](_0x15c555[_0x227ef8],_0x468102);}return _0x15c555;}if(!_[_0x2e13('0x22')](_0x15c555)){return _0x15c555;}if(_[_0x2e13('0x23')](_0x468102)){_0x468102=[_0x468102];}if(!_[_0x2e13('0x16')](_0x468102)){return _0x15c555;}for(var _0x103867=0x0;_0x103867<_0x468102[_0x2e13('0x20')];_0x103867+=0x1){_[_0x2e13('0x24')](_0x15c555,_0x468102[_0x103867]);}for(var _0x6e09d9 in _0x15c555){if(_0x15c555[_0x2e13('0x25')](_0x6e09d9)){_0x15c555[_0x6e09d9]=this[_0x2e13('0x21')](_0x15c555[_0x6e09d9],_0x468102);}}return _0x15c555;};exports[_0x2e13('0x26')]=function(_0x28e2bf){return _0x28e2bf[_0x2e13('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x2e13('0x28')]=function(_0x3e4f9d){return _0x3e4f9d[_0x2e13('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5a7d9c,_0x2a4963){var _0x196999=[];var _0x1466f2=/[ `!@#$%^&*()_\-?~]/;var _0xc7fbc3=_0x2a4963?_0x2e13('0x29'):_0x2e13('0x2a');_0x5a7d9c['split'](/[ ,]+/)['forEach'](function(_0x2f0369){_0x2f0369=_0x2f0369[_0x2e13('0x2b')](/([^:]")"+/g,'$1');_0x2f0369='+'+_0x2f0369+'*';var _0x2449f3=_0x2f0369[_0x2e13('0x27')](_0x1466f2);if(_0x2449f3){_0x2f0369='\x22'+_0x2f0369+'\x22';}_0x196999[_0x2e13('0x2c')](_0x2f0369);});_0xc7fbc3=_0xc7fbc3[_0x2e13('0x2b')](_0x2e13('0x2a'),_0x196999[_0x2e13('0x2d')]('\x20'));return _0xc7fbc3;};exports['getOptions']=function(_0x471a78,_0x6034f4,_0x428efc){var _0x209f56={},_0xda59c6={};if(_0x6034f4['query'][_0x2e13('0x2e')]){_0x6034f4[_0x2e13('0x2f')]['id']=_0x6034f4['query'][_0x2e13('0x2e')];delete _0x6034f4[_0x2e13('0x2f')][_0x2e13('0x2e')];}_0x209f56['model']=_[_0x2e13('0x19')](_0x471a78,_0x2e13('0x14'));_0x209f56['query']=_[_0x2e13('0x3')](_0x6034f4[_0x2e13('0x2f')]);_0x209f56['filters']=_[_0x2e13('0x30')](_0x209f56['model'],_0x209f56[_0x2e13('0x2f')]);_0xda59c6[_0x2e13('0x31')]=_['intersection'](_0x209f56[_0x2e13('0x5')],this[_0x2e13('0x6')](_0x6034f4[_0x2e13('0x2f')][_0x2e13('0x6')]));_0xda59c6[_0x2e13('0x31')]=_0xda59c6[_0x2e13('0x31')][_0x2e13('0x20')]?_0xda59c6[_0x2e13('0x31')]:_0x209f56[_0x2e13('0x5')];if(!_0x6034f4[_0x2e13('0x2f')]['hasOwnProperty'](_0x2e13('0x32'))){_0xda59c6[_0x2e13('0x17')]=this[_0x2e13('0x17')](_0x6034f4[_0x2e13('0x2f')][_0x2e13('0x17')]);_0xda59c6['offset']=this[_0x2e13('0x33')](_0x6034f4['query'][_0x2e13('0x33')]);}_0xda59c6[_0x2e13('0x34')]=this['sort'](_0x6034f4[_0x2e13('0x2f')]['sort']);_0xda59c6[_0x2e13('0x35')]=this[_0x2e13('0x9')](_[_0x2e13('0x36')](_0x6034f4[_0x2e13('0x2f')],_0x209f56[_0x2e13('0x9')]),_0x471a78);if(_0x6034f4['query'][_0x2e13('0x37')]){var _0x499a56=_0x471a78;var _0x10a1ab=_0x6034f4[_0x2e13('0x2f')][_0x2e13('0x37')];if(typeof _0x10a1ab===_0x2e13('0x38')){_0x499a56=_[_0x2e13('0x37')](_0x471a78,function(_0xf14e4d){return _['includes'](_0x10a1ab['columns'],_0xf14e4d[_0x2e13('0x14')]);});_0x10a1ab=_0x10a1ab[_0x2e13('0x39')];}_0xda59c6['where']=_[_0x2e13('0x3a')](_0xda59c6[_0x2e13('0x35')],{'$or':_[_0x2e13('0x19')](_0x499a56,function(_0x4da900){if(_0x4da900['type']!==_0x2e13('0x3b')){if(_0x428efc){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x2e13('0x3c')](_0x4da900[_0x2e13('0x14')])),{'$like':sequelize['fn'](_0x2e13('0x3d'),'%'+_0x6034f4['query'][_0x2e13('0x37')]+'%')});}else{var _0x16bdf2={};_0x16bdf2[_0x4da900[_0x2e13('0x14')]]={'$like':'%'+_0x6034f4[_0x2e13('0x2f')]['filter']+'%'};return _0x16bdf2;}}})});}_0xda59c6=_[_0x2e13('0x3a')]({},_0xda59c6,_0x6034f4['options']);return _0xda59c6;};exports[_0x2e13('0x3e')]=function(_0x2f9c28){var _0x45b6de=[];if(_0x2f9c28[_0x2e13('0x3f')]){_0x45b6de[_0x2e13('0x2c')]({'all':!![]});}else if(_0x2f9c28[_0x2e13('0x3e')]){if(Array[_0x2e13('0x16')](_0x2f9c28[_0x2e13('0x3e')])){_0x45b6de=Object[_0x2e13('0x3')](_0x2f9c28[_0x2e13('0x3e')])['map'](function(_0xb9190b){return parseIncludeModel(_0x2f9c28[_0x2e13('0x3e')][_0xb9190b]);});}else{var _0x4780b7=parseIncludeModel(_0x2f9c28[_0x2e13('0x3e')]);_0x45b6de[_0x2e13('0x2c')](_0x4780b7);}}return _0x45b6de;}; \ No newline at end of file +var _0x5fed=['priority','cast','col','unsigned','substr','ASC','omit','isEmpty','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','forEach','replace','join','getOptions','query','$id','intersection','attributes','hasOwnProperty','nolimit','limit','order','pick','filter','object','name','where','merge','lower','options','include','includeAll','push','lodash','sequelize','moment','../../mysqldb','keys','parse','model','alias','raw','fields','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray','offset','sort','map'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5fed,0xed));var _0xd5fe=function(_0xf48d27,_0xc761af){_0xf48d27=_0xf48d27-0x0;var _0x172722=_0x5fed[_0xf48d27];return _0x172722;};'use strict';var _=require(_0xd5fe('0x0'));var sequelize=require(_0xd5fe('0x1'));var moment=require(_0xd5fe('0x2'));var db=require(_0xd5fe('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3063eb){var _0xc88774=['ne'];try{var _0x3d6a82=JSON['parse'](_0x3063eb);var _0x378b3a=Object[_0xd5fe('0x4')](_0x3d6a82)[0x0];return _0xc88774['includes'](_0x378b3a);}catch(_0x22a26e){return![];}}function getOperatorValue(_0x27f054){var _0x1d0496=JSON['parse'](_0x27f054);var _0x5b2567=Object['keys'](_0x1d0496)[0x0];var _0xed85ee=_0x1d0496[_0x5b2567];return{['$'+_0x5b2567]:_0xed85ee};}function parseIncludeModel(_0x314f7a){var _0x5edbed=JSON[_0xd5fe('0x5')](_0x314f7a);return{'model':db[_0x5edbed[_0xd5fe('0x6')]],'as':_0x5edbed[_0xd5fe('0x7')],'attributes':_0x5edbed['fields'],'raw':_0x5edbed[_0xd5fe('0x8')]};}exports[_0xd5fe('0x9')]=function(_0x417cb8){var _0x20a493=null;if(_0x417cb8){_0x20a493=_0x417cb8[_0xd5fe('0xa')](',');}return _0x20a493;};exports[_0xd5fe('0xb')]=function(_0x2d9d14,_0xd326f4){var _0x550750={};if(!_['isEmpty'](_0x2d9d14)){_[_0xd5fe('0xc')](_0x2d9d14,function(_0x25555e,_0x438303){try{if(_0xd326f4){var _0x1b23d6=_[_0xd5fe('0xd')](_0xd326f4,{'name':_0x438303})||{};if(hasSequelizeOperator(_0x25555e)){_0x550750[_0x438303]=getOperatorValue(_0x25555e);}else if(_0x1b23d6[_0xd5fe('0xe')]===_0xd5fe('0xf')&&_[_0xd5fe('0x10')](_0x25555e)){var _0x364278=JSON[_0xd5fe('0x5')](_0x25555e);var _0x2dd1a1={'$gte':moment(moment(_0x364278[_0xd5fe('0x11')])[_0xd5fe('0x12')](_0xd5fe('0x13')))['utc']()['format'](),'$lte':moment(moment(_0x364278['$lte'])[_0xd5fe('0x12')]('YYYY-MM-DD'))[_0xd5fe('0x14')]()[_0xd5fe('0x15')](0x1,'s')['format']()};_0x550750[_0x438303]=_0x2dd1a1;}else if(_0x1b23d6['name']===_0xd5fe('0x16')){_0x550750[_0x438303]=_0x25555e;}else{_0x550750[_0x438303]=_[_0xd5fe('0x17')](_0x25555e)?_0x25555e:JSON[_0xd5fe('0x5')](_0x25555e);}}else{_0x550750[_0x438303]=_['isArray'](_0x25555e)?_0x25555e:JSON['parse'](_0x25555e);}}catch(_0x20f191){_0x550750[_0x438303]=_0x25555e[_0xd5fe('0xa')](',');}});}return _0x550750;};exports['limit']=function(_0x46ac7e){_0x46ac7e=parseInt(_0x46ac7e,0xa);if(!_0x46ac7e||_0x46ac7e<0x0){_0x46ac7e=LIMIT_VALUE;}return _0x46ac7e;};exports[_0xd5fe('0x18')]=function(_0x2109f9){_0x2109f9=parseInt(_0x2109f9,0xa);if(!_0x2109f9||_0x2109f9<0x0){_0x2109f9=0x0;}return _0x2109f9;};exports[_0xd5fe('0x19')]=function(_0x211dfc){var _0x4555b0,_0x176132=null;if(_0x211dfc){_0x4555b0=_0x211dfc[_0xd5fe('0xa')](',');_0x176132=_[_0xd5fe('0x1a')](_0x4555b0,function(_0x4f47bc){if(_0x4f47bc['indexOf']('-')===0x0){return[_0x4f47bc===_0xd5fe('0x1b')?sequelize[_0xd5fe('0x1c')](sequelize[_0xd5fe('0x1d')]('priority'),_0xd5fe('0x1e')):_0x4f47bc[_0xd5fe('0x1f')](0x1),'DESC'];}else{return[_0x4f47bc===_0xd5fe('0x1b')?sequelize[_0xd5fe('0x1c')](sequelize['col'](_0xd5fe('0x1b')),_0xd5fe('0x1e')):_0x4f47bc,_0xd5fe('0x20')];}});}return _0x176132;};exports[_0xd5fe('0x21')]=function(_0x238be2,_0x32f553){if(_[_0xd5fe('0x22')](_0x238be2)){return _0x238be2;}if(_['isArray'](_0x238be2)){for(var _0x5a5f43=0x0;_0x5a5f43<_0x238be2[_0xd5fe('0x23')];_0x5a5f43+=0x1){_0x238be2[_0x5a5f43]=this[_0xd5fe('0x21')](_0x238be2[_0x5a5f43],_0x32f553);}return _0x238be2;}if(!_[_0xd5fe('0x24')](_0x238be2)){return _0x238be2;}if(_[_0xd5fe('0x25')](_0x32f553)){_0x32f553=[_0x32f553];}if(!_[_0xd5fe('0x17')](_0x32f553)){return _0x238be2;}for(var _0x3cc35c=0x0;_0x3cc35c<_0x32f553[_0xd5fe('0x23')];_0x3cc35c+=0x1){_[_0xd5fe('0x26')](_0x238be2,_0x32f553[_0x3cc35c]);}for(var _0x677fcb in _0x238be2){if(_0x238be2['hasOwnProperty'](_0x677fcb)){_0x238be2[_0x677fcb]=this[_0xd5fe('0x21')](_0x238be2[_0x677fcb],_0x32f553);}}return _0x238be2;};exports['isNumeric']=function(_0x34822f){return _0x34822f[_0xd5fe('0x27')](RegExp(_0xd5fe('0x28')))?!![]:![];};exports['isEmail']=function(_0x209d05){return _0x209d05['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd5fe('0x29')]=function(_0x4dd3e2,_0x2e812f){var _0x2394c8=[];var _0x171e6a=/[ `!@#$%^&*()_\-?~]/;var _0x5a59eb=_0x2e812f?'\x22{EXPR}\x22':_0xd5fe('0x2a');_0x4dd3e2[_0xd5fe('0xa')](/[ ,]+/)[_0xd5fe('0x2b')](function(_0x4d8547){_0x4d8547=_0x4d8547['replace'](/([^:]")"+/g,'$1');_0x4d8547='+'+_0x4d8547+'*';var _0x5ce96a=_0x4d8547[_0xd5fe('0x27')](_0x171e6a);if(_0x5ce96a){_0x4d8547='\x22'+_0x4d8547+'\x22';}_0x2394c8['push'](_0x4d8547);});_0x5a59eb=_0x5a59eb[_0xd5fe('0x2c')](_0xd5fe('0x2a'),_0x2394c8[_0xd5fe('0x2d')]('\x20'));return _0x5a59eb;};exports[_0xd5fe('0x2e')]=function(_0xe86c5a,_0x4e89d9,_0x150d6f){var _0x46b506={},_0x149806={};if(_0x4e89d9[_0xd5fe('0x2f')]['$id']){_0x4e89d9[_0xd5fe('0x2f')]['id']=_0x4e89d9[_0xd5fe('0x2f')]['$id'];delete _0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x30')];}_0x46b506[_0xd5fe('0x6')]=_[_0xd5fe('0x1a')](_0xe86c5a,'name');_0x46b506[_0xd5fe('0x2f')]=_[_0xd5fe('0x4')](_0x4e89d9[_0xd5fe('0x2f')]);_0x46b506['filters']=_[_0xd5fe('0x31')](_0x46b506[_0xd5fe('0x6')],_0x46b506[_0xd5fe('0x2f')]);_0x149806[_0xd5fe('0x32')]=_[_0xd5fe('0x31')](_0x46b506[_0xd5fe('0x6')],this['fields'](_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x9')]));_0x149806[_0xd5fe('0x32')]=_0x149806[_0xd5fe('0x32')][_0xd5fe('0x23')]?_0x149806[_0xd5fe('0x32')]:_0x46b506[_0xd5fe('0x6')];if(!_0x4e89d9['query'][_0xd5fe('0x33')](_0xd5fe('0x34'))){_0x149806[_0xd5fe('0x35')]=this['limit'](_0x4e89d9[_0xd5fe('0x2f')]['limit']);_0x149806[_0xd5fe('0x18')]=this[_0xd5fe('0x18')](_0x4e89d9['query'][_0xd5fe('0x18')]);}_0x149806[_0xd5fe('0x36')]=this[_0xd5fe('0x19')](_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x19')]);_0x149806['where']=this[_0xd5fe('0xb')](_[_0xd5fe('0x37')](_0x4e89d9['query'],_0x46b506[_0xd5fe('0xb')]),_0xe86c5a);if(_0x4e89d9['query']['filter']){var _0x1c53a0=_0xe86c5a;var _0x318934=_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x38')];if(typeof _0x318934===_0xd5fe('0x39')){_0x1c53a0=_['filter'](_0xe86c5a,function(_0x8d9be2){return _['includes'](_0x318934['columns'],_0x8d9be2[_0xd5fe('0x3a')]);});_0x318934=_0x318934['value'];}_0x149806[_0xd5fe('0x3b')]=_[_0xd5fe('0x3c')](_0x149806[_0xd5fe('0x3b')],{'$or':_['map'](_0x1c53a0,function(_0x5427a2){if(_0x5427a2[_0xd5fe('0xe')]!=='VIRTUAL'){if(_0x150d6f){return sequelize[_0xd5fe('0x3b')](sequelize['fn'](_0xd5fe('0x3d'),sequelize[_0xd5fe('0x1d')](_0x5427a2[_0xd5fe('0x3a')])),{'$like':sequelize['fn'](_0xd5fe('0x3d'),'%'+_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x38')]+'%')});}else{var _0x823dc0={};_0x823dc0[_0x5427a2[_0xd5fe('0x3a')]]={'$like':'%'+_0x4e89d9[_0xd5fe('0x2f')][_0xd5fe('0x38')]+'%'};return _0x823dc0;}}})});}_0x149806=_['merge']({},_0x149806,_0x4e89d9[_0xd5fe('0x3e')]);return _0x149806;};exports[_0xd5fe('0x3f')]=function(_0x47ae20){var _0x5cf7a5=[];if(_0x47ae20[_0xd5fe('0x40')]){_0x5cf7a5[_0xd5fe('0x41')]({'all':!![]});}else if(_0x47ae20[_0xd5fe('0x3f')]){if(Array[_0xd5fe('0x17')](_0x47ae20[_0xd5fe('0x3f')])){_0x5cf7a5=Object[_0xd5fe('0x4')](_0x47ae20['include'])['map'](function(_0x162f62){return parseIncludeModel(_0x47ae20[_0xd5fe('0x3f')][_0x162f62]);});}else{var _0x58efda=parseIncludeModel(_0x47ae20[_0xd5fe('0x3f')]);_0x5cf7a5['push'](_0x58efda);}}return _0x5cf7a5;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 5c738dc..d1f6639 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','validateSortParameter','toLowerCase','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','online','omit','pick','filterAgentAttributes','name','role','lastLoginAt','faxStatusTime','smsStatusTime','voiceStatusTime','faxCapacity','destconnectedlinenum','onhold','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','then','getAgents','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','fullname','mailPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split'];(function(_0x271624,_0x5a37bc){var _0x11bbc1=function(_0x45be2c){while(--_0x45be2c){_0x271624['push'](_0x271624['shift']());}};_0x11bbc1(++_0x5a37bc);}(_0x8ef6,0xf2));var _0x68ef=function(_0x23fca3,_0x53029c){_0x23fca3=_0x23fca3-0x0;var _0x613f28=_0x8ef6[_0x23fca3];return _0x613f28;};'use strict';var _=require(_0x68ef('0x0'));var jayson=require(_0x68ef('0x1'));var db=require(_0x68ef('0x2'))['db'];var amiClient=jayson[_0x68ef('0x3')][_0x68ef('0x4')]({'port':0x232a});var routingClient=jayson[_0x68ef('0x3')][_0x68ef('0x4')]({'port':0x232c});function isAgentPaused(_0x4a72b8,_0x27d0af){var _0x129ce=[_0x4a72b8[_0x68ef('0x5')],_0x4a72b8[_0x68ef('0x6')],_0x4a72b8['mailPause'],_0x4a72b8['openchannelPause'],_0x4a72b8[_0x68ef('0x7')],_0x4a72b8[_0x68ef('0x8')],_0x4a72b8[_0x68ef('0x9')]];if(!_0x27d0af)return _['every'](_0x129ce);var _0x228967=_[_0x68ef('0xa')](_0x129ce);return _0x228967[_0x68ef('0xb')]>0x0&&_0x228967[_0x68ef('0xb')]<_0x129ce[_0x68ef('0xb')]?!![]:![];}function isIdle(_0x51554d){return _0x51554d===_0x68ef('0xc')||_0x51554d===_0x68ef('0xd')||_0x51554d===_0x68ef('0xe')||_0x51554d===_0x68ef('0xf')||_[_0x68ef('0x10')](_0x51554d);}function isAgentIdle(_0xfa6763){if(_0xfa6763['voiceStatus']!==_0x68ef('0xc')&&_0xfa6763[_0x68ef('0x8')]){_0xfa6763[_0x68ef('0x11')]=_0x68ef('0x12');return![];}return _[_0x68ef('0x13')]([_0xfa6763[_0x68ef('0x14')],_0xfa6763['faxStatus'],_0xfa6763[_0x68ef('0x15')],_0xfa6763[_0x68ef('0x16')],_0xfa6763[_0x68ef('0x17')],_0xfa6763['voiceStatus'],_0xfa6763[_0x68ef('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x68ef('0x19')](_0x68ef('0x1a'),{})['then'](function(_0x35493d){if(_0x35493d[_0x68ef('0x1b')]){throw new Error(_0x68ef('0x1c'));}var _0x3780a4=_0x35493d['result'];return routingClient[_0x68ef('0x19')]('Agents',{})['then'](function(_0x2633c1){if(_0x2633c1[_0x68ef('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x527870=_0x2633c1[_0x68ef('0x1d')];return _[_0x68ef('0x1e')]({},_0x3780a4,_0x527870);});})[_0x68ef('0x1f')](function(_0x4fad1c){throw _0x4fad1c;});}exports[_0x68ef('0x20')]=getRealtimeAgents;function getAgentStatus(_0x36a4cb){var _0x183f5f='unknown';if(isAgentPaused(_0x36a4cb))_0x183f5f=_0x68ef('0x12');else if(isAgentPaused(_0x36a4cb,!![]))_0x183f5f=_0x68ef('0x21');else if(isAgentIdle(_0x36a4cb))_0x183f5f='idle';else _0x183f5f=_0x68ef('0x22');return _0x183f5f;}exports[_0x68ef('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x19aa3d,_0x5ddec7){var _0x59723c=_['isArray'](_0x19aa3d)?_0x19aa3d:[_0x19aa3d];var _0x26018d=_[_0x68ef('0x24')](_0x5ddec7)+_0x68ef('0x25');var _0x2e6e39=_[_0x68ef('0x26')](_0x59723c,function(_0xfe2595){return db[_0x26018d][_0x68ef('0x27')]({'where':{'id':_0xfe2595}})[_0x68ef('0x28')](function(_0x65fd09){if(!_0x65fd09)return[];return _0x65fd09[_0x68ef('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x2e6e39)[_0x68ef('0x28')](function(_0x57f9ee){var _0x599243=_(_0x57f9ee)['flatten']()[_0x68ef('0x26')]('id')[_0x68ef('0x2a')]()[_0x68ef('0x2b')]();return _0x599243;});}exports[_0x68ef('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x52e67e,_0x4a0550,_0x1cbe4f){try{if(_0x4a0550[_0x68ef('0xb')]>0x0){_0x52e67e=_0x52e67e[_0x68ef('0xa')](function(_0x263b30){return _0x4a0550[_0x68ef('0x2d')](_0x263b30['id']);});}var _0x201884=_0x52e67e[_0x68ef('0xa')](function(_0x4579cb){var _0x5a6dfd=_0x68ef('0x22');if(isAgentIdle(_0x4579cb)){_0x5a6dfd=_0x68ef('0xc');}return _0x5a6dfd===_0x1cbe4f;});return _[_0x68ef('0x26')](_0x201884,'id');}catch(_0x4c25aa){throw _0x4c25aa;}}exports[_0x68ef('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x523120,_0x133788,_0x17588a){return Promise['resolve']()['then'](function(){if(_0x133788[_0x68ef('0xb')]>0x0){_0x523120=_0x523120[_0x68ef('0xa')](function(_0x4b8fc8){return _0x133788[_0x68ef('0x2d')](_0x4b8fc8['id']);});}return _0x523120;})[_0x68ef('0x28')](function(){return db[_0x68ef('0x2f')][_0x68ef('0x30')]({'attributes':['id','name',_0x68ef('0x31'),_0x68ef('0x5'),'faxPause',_0x68ef('0x32'),'openchannelPause',_0x68ef('0x7'),_0x68ef('0x8'),'whatsappPause',_0x68ef('0x33')],'where':{'id':{'$in':_['map'](_0x523120,'id')}},'raw':!![]});})[_0x68ef('0x28')](function(_0x575f43){return _0x575f43[_0x68ef('0x26')](function(_0x1444e0){var _0x798276=_['find'](_0x523120,['id',_0x1444e0['id']]);var _0x1f91c7=filterAgentAttributes(_0x798276);_['merge'](_0x1444e0,_0x1f91c7);_0x1444e0[_0x68ef('0x34')]=getAgentStatus(_0x1444e0);return _0x1444e0;});})['then'](function(_0x474ffa){var _0x362ef1=sortAgentsByStatus(_0x474ffa,_0x17588a);return _[_0x68ef('0x26')](_0x362ef1,'id');})[_0x68ef('0x1f')](function(_0x2181d9){throw _0x2181d9;});}exports[_0x68ef('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x51ba3d){var _0x294fba={'fields':[],'order':null};var _0x15a6ab=_0x51ba3d[_0x68ef('0x36')](',');_0x294fba['fields']=_[_0x68ef('0xa')](_0x15a6ab,function(_0x3c5de6){if(!_0x3c5de6[_0x68ef('0x2d')]('globalStatus')){return!![];}_0x294fba['order']=_[_0x68ef('0x37')](_0x3c5de6,'-')?_0x68ef('0x38'):_0x68ef('0x39');return![];});return _0x294fba;}exports[_0x68ef('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x401459){if(!_0x401459){_0x401459=_0x68ef('0x3b');}if(_0x401459[_0x68ef('0x2d')]('fullname')&&!_0x401459[_0x68ef('0x2d')](_0x68ef('0x3c'))){var _0x2f6ee0=_0x401459[_0x68ef('0x3d')](0x0,_0x401459['indexOf'](_0x68ef('0x31')));_0x401459+=','+_0x2f6ee0+_0x68ef('0x3c');}return _0x401459;}exports[_0x68ef('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x410c10,_0x19169a){var _0x3b00ea=_0x410c10['sort'](function(_0x3f000f,_0x3f7699){if(_0x3f000f[_0x68ef('0x34')]===_0x3f7699[_0x68ef('0x34')]){if(_0x3f000f[_0x68ef('0x34')]===_0x68ef('0x12')){if(_0x19169a===_0x68ef('0x38')){return(_0x3f000f[_0x68ef('0x33')]||'')<(_0x3f7699[_0x68ef('0x33')]||'')||_0x3f000f['fullname'][_0x68ef('0x3f')]()>_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3f')]()?0x1:-0x1;}else{return(_0x3f000f[_0x68ef('0x33')]||'')<(_0x3f7699[_0x68ef('0x33')]||'')||_0x3f000f[_0x68ef('0x31')][_0x68ef('0x3f')]()>_0x3f7699['fullname'][_0x68ef('0x3f')]()?-0x1:0x1;}}else{if(_0x19169a==='DESC'){return _0x3f000f[_0x68ef('0x31')][_0x68ef('0x3f')]()<_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3f')]()?0x1:-0x1;}else{return _0x3f000f['fullname'][_0x68ef('0x3f')]()<_0x3f7699['fullname'][_0x68ef('0x3f')]()?-0x1:0x1;}}}else{if(_0x19169a==='DESC'){return _0x3f000f[_0x68ef('0x34')]<_0x3f7699[_0x68ef('0x34')]?0x1:-0x1;}else{return _0x3f000f[_0x68ef('0x34')]<_0x3f7699['globalStatus']?-0x1:0x1;}}});return _0x3b00ea;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x4044d5){var _0x399055=['userpic','online','lastLoginAt',_0x68ef('0x40'),_0x68ef('0x33'),_0x68ef('0x40'),_0x68ef('0x3c'),_0x68ef('0x41'),'chatPause','openchannelPause',_0x68ef('0x32'),_0x68ef('0x7'),_0x68ef('0x9'),_0x68ef('0x6'),'voicePause',_0x68ef('0x42'),_0x68ef('0x43'),_0x68ef('0x44'),_0x68ef('0x45'),'whatsappCapacity','faxCapacity',_0x68ef('0x46'),_0x68ef('0x47'),'mailCurrentCapacity',_0x68ef('0x48'),_0x68ef('0x49'),_0x68ef('0x4a'),_0x68ef('0x14'),_0x68ef('0x16'),'mailStatus',_0x68ef('0x17'),_0x68ef('0x18'),_0x68ef('0x4b'),'voiceStatus',_0x68ef('0x4c'),_0x68ef('0x4d'),_0x68ef('0x4e'),'smsStatusTime',_0x68ef('0x4f'),'faxStatusTime','voiceStatusTime',_0x68ef('0x50'),'destconnectedlinenum',_0x68ef('0x51'),_0x68ef('0x52'),_0x68ef('0x53'),_0x68ef('0x54')];var _0x2a0be0=[_0x68ef('0x5'),_0x68ef('0x55'),_0x68ef('0x32'),_0x68ef('0x7'),_0x68ef('0x9'),'faxPause','voicePause',_0x68ef('0x56')];var _0x27a449=_(_0x4044d5)[_0x68ef('0x57')](_0x2a0be0)[_0x68ef('0x58')](_0x399055)[_0x68ef('0x2b')]();return _0x27a449;}exports[_0x68ef('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x68ef('0x5a'),_0x68ef('0x31'),_0x68ef('0x5b'),'internal','online',_0x68ef('0x34'),'userpic',_0x68ef('0x5c'),'pauseType',_0x68ef('0x40'),_0x68ef('0x6'),'chatPause',_0x68ef('0x32'),'openchannelPause',_0x68ef('0x7'),_0x68ef('0x8'),_0x68ef('0x9'),_0x68ef('0x14'),_0x68ef('0x4b'),_0x68ef('0x15'),'openchannelStatus',_0x68ef('0x17'),_0x68ef('0x11'),_0x68ef('0x18'),_0x68ef('0x4c'),_0x68ef('0x5d'),_0x68ef('0x4e'),'openchannelStatusTime',_0x68ef('0x5e'),_0x68ef('0x5f'),'whatsappStatusTime',_0x68ef('0x42'),_0x68ef('0x60'),_0x68ef('0x44'),'openchannelCapacity',_0x68ef('0x45'),'whatsappCapacity','chatCurrentCapacity',_0x68ef('0x4a'),'mailCurrentCapacity',_0x68ef('0x47'),'smsCurrentCapacity',_0x68ef('0x49'),_0x68ef('0x52'),_0x68ef('0x53'),_0x68ef('0x61'),_0x68ef('0x62'),_0x68ef('0x50'),'routealias',_0x68ef('0x51')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x9957=['sort','toLowerCase','userpic','online','lastPauseAt','address','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','name','role','lastLoginAt','whatsappPause','mailStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','chatCapacity','mailCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','filter','getAgentIdsByStatus','includes','User','findAll','fullname','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var db=require(_0x7995('0x2'))['db'];var amiClient=jayson[_0x7995('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x7995('0x3')][_0x7995('0x4')]({'port':0x232c});function isAgentPaused(_0x1902b4,_0x462a03){var _0x576d89=[_0x1902b4[_0x7995('0x5')],_0x1902b4[_0x7995('0x6')],_0x1902b4[_0x7995('0x7')],_0x1902b4[_0x7995('0x8')],_0x1902b4[_0x7995('0x9')],_0x1902b4[_0x7995('0xa')],_0x1902b4['whatsappPause']];if(!_0x462a03)return _[_0x7995('0xb')](_0x576d89);var _0x1cad37=_['filter'](_0x576d89);return _0x1cad37[_0x7995('0xc')]>0x0&&_0x1cad37[_0x7995('0xc')]<_0x576d89[_0x7995('0xc')]?!![]:![];}function isIdle(_0x35b5fe){return _0x35b5fe===_0x7995('0xd')||_0x35b5fe===_0x7995('0xe')||_0x35b5fe===_0x7995('0xf')||_0x35b5fe==='ringing'||_[_0x7995('0x10')](_0x35b5fe);}function isAgentIdle(_0x41c652){if(_0x41c652['voiceStatus']!==_0x7995('0xd')&&_0x41c652[_0x7995('0xa')]){_0x41c652[_0x7995('0x11')]=_0x7995('0x12');return![];}return _[_0x7995('0xb')]([_0x41c652[_0x7995('0x13')],_0x41c652[_0x7995('0x14')],_0x41c652['mailStatus'],_0x41c652['openchannelStatus'],_0x41c652[_0x7995('0x15')],_0x41c652[_0x7995('0x11')],_0x41c652[_0x7995('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x2202ce){if(_0x2202ce[_0x7995('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2eeacc=_0x2202ce['result'];return routingClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x291317){if(_0x291317[_0x7995('0x1a')]){throw new Error(_0x7995('0x1b'));}var _0x4faa60=_0x291317['result'];return _[_0x7995('0x1c')]({},_0x2eeacc,_0x4faa60);});})['catch'](function(_0x555f74){throw _0x555f74;});}exports[_0x7995('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3d463e){var _0x4cbe10=_0x7995('0xe');if(isAgentPaused(_0x3d463e))_0x4cbe10='pause';else if(isAgentPaused(_0x3d463e,!![]))_0x4cbe10='*pause';else if(isAgentIdle(_0x3d463e))_0x4cbe10=_0x7995('0xd');else _0x4cbe10=_0x7995('0x1e');return _0x4cbe10;}exports[_0x7995('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1a8568,_0x460924){var _0x1c278a=_['isArray'](_0x1a8568)?_0x1a8568:[_0x1a8568];var _0x32a09a=_[_0x7995('0x20')](_0x460924)+_0x7995('0x21');var _0x285437=_[_0x7995('0x22')](_0x1c278a,function(_0x13bc35){return db[_0x32a09a][_0x7995('0x23')]({'where':{'id':_0x13bc35}})[_0x7995('0x19')](function(_0x59405a){if(!_0x59405a)return[];return _0x59405a[_0x7995('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7995('0x25')](_0x285437)[_0x7995('0x19')](function(_0x268ce7){var _0x3a3fcf=_(_0x268ce7)[_0x7995('0x26')]()['map']('id')[_0x7995('0x27')]()['value']();return _0x3a3fcf;});}exports[_0x7995('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x49bc7e,_0xf16cc2,_0x132a42){try{if(_0xf16cc2[_0x7995('0xc')]>0x0){_0x49bc7e=_0x49bc7e['filter'](function(_0x9b2a15){return _0xf16cc2['includes'](_0x9b2a15['id']);});}var _0x456a28=_0x49bc7e[_0x7995('0x29')](function(_0x4253e5){var _0x574574='busy';if(isAgentIdle(_0x4253e5)){_0x574574='idle';}return _0x574574===_0x132a42;});return _[_0x7995('0x22')](_0x456a28,'id');}catch(_0xe6b0b3){throw _0xe6b0b3;}}exports[_0x7995('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b874d,_0x2e3493,_0x1ca460){return Promise['resolve']()['then'](function(){if(_0x2e3493[_0x7995('0xc')]>0x0){_0x2b874d=_0x2b874d['filter'](function(_0x553671){return _0x2e3493[_0x7995('0x2b')](_0x553671['id']);});}return _0x2b874d;})[_0x7995('0x19')](function(){return db[_0x7995('0x2c')][_0x7995('0x2d')]({'attributes':['id','name',_0x7995('0x2e'),_0x7995('0x5'),'faxPause','mailPause','openchannelPause',_0x7995('0x9'),_0x7995('0xa'),'whatsappPause',_0x7995('0x2f')],'where':{'id':{'$in':_['map'](_0x2b874d,'id')}},'raw':!![]});})[_0x7995('0x19')](function(_0x1cb058){return _0x1cb058[_0x7995('0x22')](function(_0x5014d2){var _0x52d76d=_[_0x7995('0x30')](_0x2b874d,['id',_0x5014d2['id']]);var _0x5e67fe=filterAgentAttributes(_0x52d76d);_['merge'](_0x5014d2,_0x5e67fe);_0x5014d2[_0x7995('0x31')]=getAgentStatus(_0x5014d2);return _0x5014d2;});})[_0x7995('0x19')](function(_0x5212ff){var _0x1baa15=sortAgentsByStatus(_0x5212ff,_0x1ca460);return _[_0x7995('0x22')](_0x1baa15,'id');})[_0x7995('0x32')](function(_0x18667c){throw _0x18667c;});}exports[_0x7995('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x53002a){var _0x2d4285={'fields':[],'order':null};var _0x242713=_0x53002a[_0x7995('0x34')](',');_0x2d4285[_0x7995('0x35')]=_['filter'](_0x242713,function(_0x2be2c0){if(!_0x2be2c0[_0x7995('0x2b')](_0x7995('0x31'))){return!![];}_0x2d4285[_0x7995('0x36')]=_[_0x7995('0x37')](_0x2be2c0,'-')?_0x7995('0x38'):'ASC';return![];});return _0x2d4285;}exports[_0x7995('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x3be298){if(!_0x3be298){_0x3be298=_0x7995('0x3a');}if(_0x3be298[_0x7995('0x2b')](_0x7995('0x2e'))&&!_0x3be298[_0x7995('0x2b')](_0x7995('0x3b'))){var _0x270c0e=_0x3be298[_0x7995('0x3c')](0x0,_0x3be298[_0x7995('0x3d')](_0x7995('0x2e')));_0x3be298+=','+_0x270c0e+_0x7995('0x3b');}return _0x3be298;}exports[_0x7995('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x53cda2,_0x50a98e){var _0x334dff=_0x53cda2[_0x7995('0x3f')](function(_0x58523e,_0x4b0855){if(_0x58523e[_0x7995('0x31')]===_0x4b0855['globalStatus']){if(_0x58523e['globalStatus']===_0x7995('0x12')){if(_0x50a98e===_0x7995('0x38')){return(_0x58523e[_0x7995('0x2f')]||'')<(_0x4b0855['pauseType']||'')||_0x58523e[_0x7995('0x2e')]['toLowerCase']()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x58523e['pauseType']||'')<(_0x4b0855[_0x7995('0x2f')]||'')||_0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x50a98e===_0x7995('0x38')){return _0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()<_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x58523e['fullname'][_0x7995('0x40')]()<_0x4b0855['fullname'][_0x7995('0x40')]()?-0x1:0x1;}}}else{if(_0x50a98e==='DESC'){return _0x58523e[_0x7995('0x31')]<_0x4b0855['globalStatus']?0x1:-0x1;}else{return _0x58523e[_0x7995('0x31')]<_0x4b0855[_0x7995('0x31')]?-0x1:0x1;}}});return _0x334dff;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3e9e62){var _0x336ff2=[_0x7995('0x41'),_0x7995('0x42'),'lastLoginAt',_0x7995('0x43'),_0x7995('0x2f'),_0x7995('0x43'),'internal',_0x7995('0x44'),_0x7995('0x5'),_0x7995('0x8'),_0x7995('0x7'),_0x7995('0x9'),'whatsappPause',_0x7995('0x6'),_0x7995('0xa'),'chatCapacity',_0x7995('0x45'),'mailCapacity',_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x48'),_0x7995('0x49'),_0x7995('0x4a'),_0x7995('0x4b'),_0x7995('0x4c'),'whatsappCurrentCapacity',_0x7995('0x4d'),_0x7995('0x13'),_0x7995('0x4e'),'mailStatus',_0x7995('0x15'),_0x7995('0x16'),_0x7995('0x14'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x7995('0x4f'),_0x7995('0x50'),'whatsappStatusTime',_0x7995('0x51'),_0x7995('0x52'),_0x7995('0x53'),_0x7995('0x54'),_0x7995('0x55'),'phoneBarEnableScreenRecordingByAgent',_0x7995('0x56'),'routealias'];var _0x14fe7f=[_0x7995('0x5'),_0x7995('0x8'),'mailPause','smsPause','whatsappPause','faxPause',_0x7995('0xa'),_0x7995('0x42')];var _0x1a861c=_(_0x3e9e62)[_0x7995('0x57')](_0x14fe7f)[_0x7995('0x58')](_0x336ff2)[_0x7995('0x59')]();return _0x1a861c;}exports[_0x7995('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7995('0x5b'),_0x7995('0x2e'),_0x7995('0x5c'),_0x7995('0x3b'),_0x7995('0x42'),_0x7995('0x31'),_0x7995('0x41'),_0x7995('0x5d'),_0x7995('0x2f'),_0x7995('0x43'),_0x7995('0x6'),_0x7995('0x5'),'mailPause',_0x7995('0x8'),_0x7995('0x9'),_0x7995('0xa'),_0x7995('0x5e'),'chatStatus','faxStatus',_0x7995('0x5f'),_0x7995('0x4e'),_0x7995('0x15'),_0x7995('0x11'),'whatsappStatus',_0x7995('0x60'),_0x7995('0x51'),_0x7995('0x4f'),_0x7995('0x61'),'smsStatusTime','voiceStatusTime',_0x7995('0x62'),_0x7995('0x63'),_0x7995('0x48'),_0x7995('0x64'),_0x7995('0x45'),_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x49'),_0x7995('0x4d'),'mailCurrentCapacity',_0x7995('0x4a'),_0x7995('0x4c'),_0x7995('0x65'),_0x7995('0x66'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x7995('0x67'),_0x7995('0x53'),'routealias',_0x7995('0x55')];}exports[_0x7995('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index ba637a4..438676a 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8ec=['predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','get','outbound','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable'];(function(_0x519ff8,_0x579898){var _0xb8b52=function(_0x1db79a){while(--_0x1db79a){_0x519ff8['push'](_0x519ff8['shift']());}};_0xb8b52(++_0x579898);}(_0xe8ec,0x117));var _0xce8e=function(_0x9584a9,_0x413cec){_0x9584a9=_0x9584a9-0x0;var _0x2b3b6e=_0xe8ec[_0x9584a9];return _0x2b3b6e;};'use strict';var _=require(_0xce8e('0x0'));var jayson=require(_0xce8e('0x1'));var util=require(_0xce8e('0x2'));var amiClient=jayson[_0xce8e('0x3')][_0xce8e('0x4')]({'port':0x232a});var routingClient=jayson[_0xce8e('0x3')][_0xce8e('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xce8e('0x5'),_0xce8e('0x6'),_0xce8e('0x7'),_0xce8e('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xce8e('0x9'),_0xce8e('0xa'),_0xce8e('0xb'),_0xce8e('0xc'),_0xce8e('0xd'),_0xce8e('0xe'),_0xce8e('0xf'),'ringInUse',_0xce8e('0x10'),'unavailable',_0xce8e('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xce8e('0x12'),_0xce8e('0x13'),_0xce8e('0x14'),'statusMessage',_0xce8e('0x15'),'dialMethod',_0xce8e('0x16'),_0xce8e('0x17'),_0xce8e('0x18'),_0xce8e('0x19'),_0xce8e('0x1a'),_0xce8e('0x1b'),_0xce8e('0x1c'),_0xce8e('0x1d'),_0xce8e('0x1e'),_0xce8e('0x1f'),_0xce8e('0x20'),_0xce8e('0x21'),'predictiveIntervalAnsweredCalls',_0xce8e('0x22'),_0xce8e('0x23'),_0xce8e('0x24'),_0xce8e('0x25')];function getRealtimeQueues(_0x535467,_0x34cebb){var _0x2bba56=_0x34cebb===_0xce8e('0x26')?amiClient:routingClient;return _0x2bba56['request'](_['startCase'](_0x34cebb)+_0xce8e('0x27'),_0x535467)[_0xce8e('0x28')](function(_0x52b51c){if(_0x52b51c[_0xce8e('0x29')])throw new Error(util['format'](_0xce8e('0x2a'),_0x34cebb));return _0x52b51c[_0xce8e('0x2b')];})[_0xce8e('0x2c')](function(_0x1d78cb){throw _0x1d78cb;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x31b4c6,_0x30ec2d,_0x32ab0b,_0x46a25d){var _0x23c6d4=DEFAULT_QUEUE_ATTRIBUTES;if(_0x32ab0b===_0xce8e('0x26')){if(_0x46a25d===_0xce8e('0x2d')){_0x23c6d4=_0x23c6d4['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x46a25d==='outbound'){_0x23c6d4=_0x23c6d4[_0xce8e('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x31b4c6['map'](function(_0x3b8214){var _0x3f56ef=_0x3b8214[_0xce8e('0x2f')]({'plain':!![]});_0x3f56ef['paused']=0x0;_0x3f56ef[_0xce8e('0xc')]=0x0;_0x3f56ef[_0xce8e('0x6')]=0x0;_0x3f56ef[_0xce8e('0x5')]=0x0;_0x3f56ef[_0xce8e('0x8')]=0x0;if(_0x32ab0b==='voice'){_0x3f56ef['talking']=0x0;_0x3f56ef[_0xce8e('0x9')]=0x0;if(_0x46a25d===_0xce8e('0x30')){_0x3f56ef[_0xce8e('0x12')]=0x0;_0x3f56ef[_0xce8e('0x13')]=0x0;}}var _0x2e07a6=_[_0xce8e('0x31')](_0x30ec2d,['id',_0x3f56ef['id']]);if(_0x2e07a6){_[_0xce8e('0x32')](_0x3f56ef,_['pick'](_0x2e07a6,_0x23c6d4));}return _0x3f56ef;});}exports[_0xce8e('0x33')]=initializeQueues; \ No newline at end of file +var _0x677e=['talking','unavailable','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','available','outbound','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','loggedInDb','ringInUse'];(function(_0x21c112,_0x3c0a3a){var _0xc45f5f=function(_0x16e608){while(--_0x16e608){_0x21c112['push'](_0x21c112['shift']());}};_0xc45f5f(++_0x3c0a3a);}(_0x677e,0x1bf));var _0xe677=function(_0x41b6f5,_0x1ad42f){_0x41b6f5=_0x41b6f5-0x0;var _0x5d6142=_0x677e[_0x41b6f5];return _0x5d6142;};'use strict';var _=require(_0xe677('0x0'));var jayson=require(_0xe677('0x1'));var util=require(_0xe677('0x2'));var amiClient=jayson[_0xe677('0x3')][_0xe677('0x4')]({'port':0x232a});var routingClient=jayson[_0xe677('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xe677('0x5'),_0xe677('0x6'),_0xe677('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe677('0x8'),_0xe677('0x9'),'invalid',_0xe677('0xa'),'notInUse','onHold','ringing',_0xe677('0xb'),_0xe677('0xc'),_0xe677('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xe677('0xe'),_0xe677('0xf'),_0xe677('0x10'),_0xe677('0x11'),_0xe677('0x12'),_0xe677('0x13'),'startPredictive',_0xe677('0x14'),'erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0xe677('0x15'),_0xe677('0x16'),_0xe677('0x17'),'dialPredictiveIntervalMinThreshold',_0xe677('0x18'),_0xe677('0x19'),_0xe677('0x1a'),_0xe677('0x1b'),_0xe677('0x1c'),_0xe677('0x1d'),_0xe677('0x1e')];function getRealtimeQueues(_0x4539b1,_0x3740b1){var _0x4eb065=_0x3740b1===_0xe677('0x1f')?amiClient:routingClient;return _0x4eb065[_0xe677('0x20')](_[_0xe677('0x21')](_0x3740b1)+'Queues',_0x4539b1)[_0xe677('0x22')](function(_0x2f434c){if(_0x2f434c[_0xe677('0x23')])throw new Error(util[_0xe677('0x24')](_0xe677('0x25'),_0x3740b1));return _0x2f434c[_0xe677('0x26')];})[_0xe677('0x27')](function(_0x119a88){throw _0x119a88;});}exports[_0xe677('0x28')]=getRealtimeQueues;function initializeQueues(_0x9a5c27,_0x4424d6,_0x32f38d,_0xabc953){var _0x530d88=DEFAULT_QUEUE_ATTRIBUTES;if(_0x32f38d==='voice'){if(_0xabc953===_0xe677('0x29')){_0x530d88=_0x530d88[_0xe677('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xabc953==='outbound'){_0x530d88=_0x530d88[_0xe677('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x9a5c27[_0xe677('0x2b')](function(_0x46358b){var _0x4e40b0=_0x46358b[_0xe677('0x2c')]({'plain':!![]});_0x4e40b0[_0xe677('0x6')]=0x0;_0x4e40b0[_0xe677('0xa')]=0x0;_0x4e40b0[_0xe677('0x5')]=0x0;_0x4e40b0[_0xe677('0x2d')]=0x0;_0x4e40b0[_0xe677('0x7')]=0x0;if(_0x32f38d==='voice'){_0x4e40b0[_0xe677('0xc')]=0x0;_0x4e40b0[_0xe677('0x8')]=0x0;if(_0xabc953===_0xe677('0x2e')){_0x4e40b0['pTalking']=0x0;_0x4e40b0[_0xe677('0xe')]=0x0;}}var _0x4280ab=_[_0xe677('0x2f')](_0x4424d6,['id',_0x4e40b0['id']]);if(_0x4280ab){_[_0xe677('0x30')](_0x4e40b0,_[_0xe677('0x31')](_0x4280ab,_0x530d88));}return _0x4e40b0;});}exports[_0xe677('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e61f991..dcea0ab 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0xffa654,_0x4c734){var _0x5dd847=function(_0x64173a){while(--_0x64173a){_0xffa654['push'](_0xffa654['shift']());}};_0x5dd847(++_0x4c734);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7be3539..79fdd0d 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 _0xf950=['127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf950,0xb3));var _0x0f95=function(_0x34a974,_0x59f35d){_0x34a974=_0x34a974-0x0;var _0x3ab2da=_0xf950[_0x34a974];return _0x3ab2da;};'use strict';var _=require(_0x0f95('0x0'));var os=require('os');var crypto=require(_0x0f95('0x1'));var machine=require(_0x0f95('0x2'));var exec=require(_0x0f95('0x3'))[_0x0f95('0x4')];var config=require(_0x0f95('0x5'));function getInterfaces(){var _0x22cf4a=[];var _0x1ea3b9=os[_0x0f95('0x6')]();var _0x32ec8e=_['orderBy'](_[_0x0f95('0x7')](_0x1ea3b9));for(var _0x18f8e8=0x0;_0x18f8e8<_0x32ec8e['length'];_0x18f8e8++){var _0x4e8384=_0x1ea3b9[_0x32ec8e[_0x18f8e8]][_0x0f95('0x8')](function(_0x6cc896){return _0x6cc896[_0x0f95('0x9')]===_0x0f95('0xa')&&_0x6cc896[_0x0f95('0xb')]===![];});_0x22cf4a=_0x22cf4a['concat'](_0x4e8384);}return _0x22cf4a;}function getFirstInterface(){var _0x378ae2=_[_0x0f95('0xc')](getInterfaces());return{'macAddress':_0x378ae2&&_0x378ae2[_0x0f95('0xd')]?_0x378ae2[_0x0f95('0xd')]:_0x0f95('0xe'),'ipAddress':_0x378ae2&&_0x378ae2[_0x0f95('0xf')]?_0x378ae2[_0x0f95('0xf')]:_0x0f95('0x10')};}exports[_0x0f95('0x11')]=getFirstInterface;function getCPUhash(){var _0x23fd85=_[_0x0f95('0x12')](os['cpus']()[_0x0f95('0x13')](function(_0x422b2c){return _0x422b2c[_0x0f95('0x14')];}))[_0x0f95('0x15')](':');return crypto[_0x0f95('0x16')](_0x0f95('0x17'))[_0x0f95('0x18')](_0x23fd85)[_0x0f95('0x19')](_0x0f95('0x1a'));}exports[_0x0f95('0x1b')]=function(){var _0x412ef7=os[_0x0f95('0x1c')]();var _0x3e333b=/[0-9a-f-]{36}/;if(config[_0x0f95('0x1d')]&&_0x3e333b[_0x0f95('0x1e')](config[_0x0f95('0x1d')])){return config[_0x0f95('0x1d')];}else if(_0x412ef7===_0x0f95('0x1f')){return exec(_0x0f95('0x20'),{'encoding':_0x0f95('0x21')})[_0x0f95('0x22')]('\x0d\x0a','');}else{var _0x13c7e6=getFirstInterface();var _0x5b273a=getCPUhash();var _0x53302a=_0x5b273a+'|'+os[_0x0f95('0x23')]()+'|'+_0x13c7e6[_0x0f95('0x24')]+'|'+_0x13c7e6[_0x0f95('0x25')];var _0x3cc369=crypto[_0x0f95('0x16')](_0x0f95('0x17'))[_0x0f95('0x18')](_0x53302a)[_0x0f95('0x19')](_0x0f95('0x1a'));return _0x3cc369[_0x0f95('0x26')](0x0,0x8)+'-'+_0x3cc369[_0x0f95('0x26')](0x8,0xc)+'-'+_0x3cc369[_0x0f95('0x26')](0xc,0x10)+'-'+_0x3cc369[_0x0f95('0x26')](0x10,0x14)+'-'+_0x3cc369[_0x0f95('0x26')](0x14);}}; \ No newline at end of file +var _0xf563=['hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest'];(function(_0x175c40,_0x37f161){var _0x3feac9=function(_0x4016da){while(--_0x4016da){_0x175c40['push'](_0x175c40['shift']());}};_0x3feac9(++_0x37f161);}(_0xf563,0x1bb));var _0x3f56=function(_0x2034be,_0x8e1a0c){_0x2034be=_0x2034be-0x0;var _0x21566e=_0xf563[_0x2034be];return _0x21566e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x3f56('0x0'));var exec=require(_0x3f56('0x1'))[_0x3f56('0x2')];var config=require(_0x3f56('0x3'));function getInterfaces(){var _0x53a734=[];var _0x32fead=os[_0x3f56('0x4')]();var _0x4603be=_['orderBy'](_[_0x3f56('0x5')](_0x32fead));for(var _0x5dc09c=0x0;_0x5dc09c<_0x4603be[_0x3f56('0x6')];_0x5dc09c++){var _0x435c8a=_0x32fead[_0x4603be[_0x5dc09c]][_0x3f56('0x7')](function(_0x35888b){return _0x35888b[_0x3f56('0x8')]===_0x3f56('0x9')&&_0x35888b[_0x3f56('0xa')]===![];});_0x53a734=_0x53a734[_0x3f56('0xb')](_0x435c8a);}return _0x53a734;}function getFirstInterface(){var _0x1d9bc6=_[_0x3f56('0xc')](getInterfaces());return{'macAddress':_0x1d9bc6&&_0x1d9bc6['mac']?_0x1d9bc6['mac']:_0x3f56('0xd'),'ipAddress':_0x1d9bc6&&_0x1d9bc6[_0x3f56('0xe')]?_0x1d9bc6[_0x3f56('0xe')]:_0x3f56('0xf')};}exports[_0x3f56('0x10')]=getFirstInterface;function getCPUhash(){var _0x3b192f=_[_0x3f56('0x11')](os[_0x3f56('0x12')]()[_0x3f56('0x13')](function(_0x500ee1){return _0x500ee1[_0x3f56('0x14')];}))[_0x3f56('0x15')](':');return crypto['createHash'](_0x3f56('0x16'))[_0x3f56('0x17')](_0x3b192f)[_0x3f56('0x18')](_0x3f56('0x19'));}exports[_0x3f56('0x1a')]=function(){var _0x2b72a9=os[_0x3f56('0x1b')]();var _0x2c7516=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2c7516[_0x3f56('0x1c')](config[_0x3f56('0x1d')])){return config['licenseToken'];}else if(_0x2b72a9===_0x3f56('0x1e')){return exec(_0x3f56('0x1f'),{'encoding':_0x3f56('0x20')})[_0x3f56('0x21')]('\x0d\x0a','');}else{var _0x44e6f1=getFirstInterface();var _0x5b1b8a=getCPUhash();var _0x55da09=_0x5b1b8a+'|'+os[_0x3f56('0x22')]()+'|'+_0x44e6f1[_0x3f56('0x23')]+'|'+_0x44e6f1[_0x3f56('0x24')];var _0x1af2bf=crypto[_0x3f56('0x25')](_0x3f56('0x16'))[_0x3f56('0x17')](_0x55da09)[_0x3f56('0x18')](_0x3f56('0x19'));return _0x1af2bf[_0x3f56('0x26')](0x0,0x8)+'-'+_0x1af2bf[_0x3f56('0x26')](0x8,0xc)+'-'+_0x1af2bf[_0x3f56('0x26')](0xc,0x10)+'-'+_0x1af2bf[_0x3f56('0x26')](0x10,0x14)+'-'+_0x1af2bf[_0x3f56('0x26')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3069a54..dd68367 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 _0xb445=['error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','then','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s'];(function(_0x97b713,_0x13bdf4){var _0x57d533=function(_0x1392ee){while(--_0x1392ee){_0x97b713['push'](_0x97b713['shift']());}};_0x57d533(++_0x13bdf4);}(_0xb445,0x1b6));var _0x5b44=function(_0x244a0c,_0x126dde){_0x244a0c=_0x244a0c-0x0;var _0x1d64a0=_0xb445[_0x244a0c];return _0x1d64a0;};'use strict';var util=require(_0x5b44('0x0'));var moment=require('moment');var rp=require(_0x5b44('0x1'));var BPromise=require(_0x5b44('0x2'));var pkginfo=require(_0x5b44('0x3'))(module,'version');var db=require(_0x5b44('0x4'))['db'];var encryptor=require(_0x5b44('0x5'));var hardware=require('./hardware');var logger=require(_0x5b44('0x6'))(_0x5b44('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x30500e){return new BPromise(function(_0x18239e,_0x2bcc57){var _0xb3199=util[_0x5b44('0x8')](_0x5b44('0x9'),HOST,_0x30500e,module[_0x5b44('0xa')][_0x5b44('0xb')]);if(oldToken){_0xb3199=util['format'](_0x5b44('0xc'),HOST,_0x30500e,module[_0x5b44('0xa')][_0x5b44('0xb')],oldToken);}var _0xd6397a={'uri':_0xb3199,'method':_0x5b44('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xd6397a)['then'](function(_0x250bf7){_0x18239e(_0x250bf7);})[_0x5b44('0xe')](function(_0x473afc){_0x2bcc57(_0x473afc);});});}function manageLicense(_0x3ef687,_0xbba630){var _0xd8772c=_0xbba630['get']({'plain':!![]});if(!isOldTokenSent&&_0xd8772c[_0x5b44('0xf')]!==_0x3ef687&&!_0xd8772c['data2']){oldToken=_0xd8772c[_0x5b44('0xf')];}httpRequest(_0x3ef687)[_0x5b44('0x10')](function(_0x317550){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x317550[_0x5b44('0x11')]){isOldTokenSent=![];if(!_0xd8772c[_0x5b44('0x7')]&&_0xd8772c[_0x5b44('0x7')]!=_0x317550['license']||_0xd8772c[_0x5b44('0x7')]&&_0xd8772c[_0x5b44('0x12')]){logger[_0x5b44('0x13')](_0x5b44('0x14'));}if(_0xd8772c['license']&&!_0xd8772c[_0x5b44('0x12')]&&_0xd8772c['license']!=_0x317550[_0x5b44('0x7')]){logger[_0x5b44('0x13')](_0x5b44('0x15'));}if(_0xd8772c[_0x5b44('0x7')]&&!_0xd8772c['data2']&&_0xd8772c[_0x5b44('0x7')]==_0x317550[_0x5b44('0x7')]){return _0xbba630;}return _0xbba630[_0x5b44('0x16')]({'data1':_0x3ef687,'data2':null,'license':_0x317550['license']});}else{if(_0x317550[_0x5b44('0x7')]||_0xd8772c[_0x5b44('0x7')]){if(!_0xd8772c[_0x5b44('0x12')]){if(_0xd8772c['data1']==_0x3ef687){GRAY_PERIOD_REASON=_0x5b44('0x17');logger[_0x5b44('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x5b44('0x18');logger[_0x5b44('0x13')](_0x5b44('0x19'),_0xd8772c[_0x5b44('0xf')],_0x3ef687);}logger[_0x5b44('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x5b44('0x1a')](),moment()[_0x5b44('0x8')](_0x5b44('0x1b')));return _0xbba630['update']({'data2':encryptor['encryptString'](moment()[_0x5b44('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x5b44('0x1c')](encryptor['decryptString'](_0xd8772c[_0x5b44('0x12')]),'days')>DAYS){logger[_0x5b44('0x13')](_0x5b44('0x1d'),moment()[_0x5b44('0x8')](_0x5b44('0x1b')));isOldTokenSent=![];return _0xbba630['update']({'data1':_0x3ef687,'data2':null,'license':null});}}}else{if(_0xd8772c['data1']!=_0x3ef687){logger[_0x5b44('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd8772c[_0x5b44('0xf')],_0x3ef687);return _0xbba630[_0x5b44('0x16')]({'data1':_0x3ef687,'data2':null,'license':null});}}}return _0xbba630;})[_0x5b44('0x10')](function(_0xab0adb){_0xbba630=_0xab0adb;})[_0x5b44('0xe')](function(_0x500ca2){logger[_0x5b44('0x1e')](_0x500ca2[_0x5b44('0x1f')]);})[_0x5b44('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x5b44('0x21')](),_0xbba630);},TIME);});}function defaultLicense(){var _0x4b3d24=hardware[_0x5b44('0x21')]();if(_0x4b3d24){return db[_0x5b44('0x22')][_0x5b44('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x4b3d24}})[_0x5b44('0x24')](function(_0x2dd073,_0x433b88){logger[_0x5b44('0x13')](_0x5b44('0x25'),_0x4b3d24);manageLicense(_0x4b3d24,_0x2dd073);})[_0x5b44('0xe')](function(_0x4aa376){logger['error'](_0x4aa376[_0x5b44('0x1f')]);});}}exports[_0x5b44('0x26')]=defaultLicense; \ No newline at end of file +var _0xc4c5=['message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x50af9c,_0xf03b1e){var _0x5b5e5a=function(_0x309a92){while(--_0x309a92){_0x50af9c['push'](_0x50af9c['shift']());}};_0x5b5e5a(++_0xf03b1e);}(_0xc4c5,0xaf));var _0x5c4c=function(_0x3a92ec,_0x59e568){_0x3a92ec=_0x3a92ec-0x0;var _0x10bd78=_0xc4c5[_0x3a92ec];return _0x10bd78;};'use strict';var util=require(_0x5c4c('0x0'));var moment=require(_0x5c4c('0x1'));var rp=require(_0x5c4c('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x5c4c('0x3'))(module,_0x5c4c('0x4'));var db=require(_0x5c4c('0x5'))['db'];var encryptor=require(_0x5c4c('0x6'));var hardware=require(_0x5c4c('0x7'));var logger=require(_0x5c4c('0x8'))(_0x5c4c('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16d02f){return new BPromise(function(_0x5627db,_0x422859){var _0x1eacc7=util[_0x5c4c('0xa')](_0x5c4c('0xb'),HOST,_0x16d02f,module[_0x5c4c('0xc')][_0x5c4c('0x4')]);if(oldToken){_0x1eacc7=util[_0x5c4c('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x16d02f,module[_0x5c4c('0xc')][_0x5c4c('0x4')],oldToken);}var _0x16a3a4={'uri':_0x1eacc7,'method':_0x5c4c('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x16a3a4)[_0x5c4c('0xe')](function(_0x7f87cd){_0x5627db(_0x7f87cd);})[_0x5c4c('0xf')](function(_0x3e8b03){_0x422859(_0x3e8b03);});});}function manageLicense(_0x19e9f0,_0x57c4b0){var _0x4a9f21=_0x57c4b0[_0x5c4c('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4a9f21[_0x5c4c('0x11')]!==_0x19e9f0&&!_0x4a9f21['data2']){oldToken=_0x4a9f21['data1'];}httpRequest(_0x19e9f0)['then'](function(_0x5a9079){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5a9079[_0x5c4c('0x12')]){isOldTokenSent=![];if(!_0x4a9f21[_0x5c4c('0x9')]&&_0x4a9f21[_0x5c4c('0x9')]!=_0x5a9079[_0x5c4c('0x9')]||_0x4a9f21[_0x5c4c('0x9')]&&_0x4a9f21[_0x5c4c('0x13')]){logger[_0x5c4c('0x14')](_0x5c4c('0x15'));}if(_0x4a9f21[_0x5c4c('0x9')]&&!_0x4a9f21[_0x5c4c('0x13')]&&_0x4a9f21['license']!=_0x5a9079[_0x5c4c('0x9')]){logger[_0x5c4c('0x14')](_0x5c4c('0x16'));}if(_0x4a9f21[_0x5c4c('0x9')]&&!_0x4a9f21['data2']&&_0x4a9f21[_0x5c4c('0x9')]==_0x5a9079['license']){return _0x57c4b0;}return _0x57c4b0['update']({'data1':_0x19e9f0,'data2':null,'license':_0x5a9079['license']});}else{if(_0x5a9079['license']||_0x4a9f21[_0x5c4c('0x9')]){if(!_0x4a9f21[_0x5c4c('0x13')]){if(_0x4a9f21[_0x5c4c('0x11')]==_0x19e9f0){GRAY_PERIOD_REASON='Disabled';logger[_0x5c4c('0x14')](_0x5c4c('0x17'));}else{GRAY_PERIOD_REASON=_0x5c4c('0x18');logger[_0x5c4c('0x14')](_0x5c4c('0x19'),_0x4a9f21[_0x5c4c('0x11')],_0x19e9f0);}logger[_0x5c4c('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x5c4c('0x1a')](),moment()['format'](_0x5c4c('0x1b')));return _0x57c4b0[_0x5c4c('0x1c')]({'data2':encryptor[_0x5c4c('0x1d')](moment()['format'](_0x5c4c('0x1b')))});}else{if(moment()[_0x5c4c('0x1e')](encryptor[_0x5c4c('0x1f')](_0x4a9f21[_0x5c4c('0x13')]),_0x5c4c('0x20'))>DAYS){logger['info'](_0x5c4c('0x21'),moment()[_0x5c4c('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x57c4b0['update']({'data1':_0x19e9f0,'data2':null,'license':null});}}}else{if(_0x4a9f21[_0x5c4c('0x11')]!=_0x19e9f0){logger[_0x5c4c('0x14')](_0x5c4c('0x19'),_0x4a9f21[_0x5c4c('0x11')],_0x19e9f0);return _0x57c4b0[_0x5c4c('0x1c')]({'data1':_0x19e9f0,'data2':null,'license':null});}}}return _0x57c4b0;})[_0x5c4c('0xe')](function(_0x5e7a2c){_0x57c4b0=_0x5e7a2c;})[_0x5c4c('0xf')](function(_0x2016f4){logger[_0x5c4c('0x22')](_0x2016f4[_0x5c4c('0x23')]);})[_0x5c4c('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x5c4c('0x25')](),_0x57c4b0);},TIME);});}function defaultLicense(){var _0x154790=hardware['getUuid']();if(_0x154790){return db[_0x5c4c('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x154790}})[_0x5c4c('0x27')](function(_0x61c057,_0x57dca3){logger[_0x5c4c('0x14')](_0x5c4c('0x28'),_0x154790);manageLicense(_0x154790,_0x61c057);})[_0x5c4c('0xf')](function(_0x31fc24){logger[_0x5c4c('0x22')](_0x31fc24[_0x5c4c('0x23')]);});}}exports[_0x5c4c('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 894e716..a32f269 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 _0xbfab=['COUNT','col','role','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','grayReason','disabled','message','User','findAll','sequelize'];(function(_0x298d63,_0x37444d){var _0x13b277=function(_0x21711d){while(--_0x21711d){_0x298d63['push'](_0x298d63['shift']());}};_0x13b277(++_0x37444d);}(_0xbfab,0x195));var _0xbbfa=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xbfab[_0x368e09];return _0x14b7df;};'use strict';var util=require(_0xbbfa('0x0'));var _=require(_0xbbfa('0x1'));var moment=require('moment');var BPromise=require(_0xbbfa('0x2'));var hardware=require(_0xbbfa('0x3'));var encryptor=require(_0xbbfa('0x4'));var db=require(_0xbbfa('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbbfa('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbbfa('0x7'),'machineUuid':hardware[_0xbbfa('0x8')](),'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':_0xbbfa('0x9'),'machineUuid':hardware[_0xbbfa('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3450dd){return new BPromise(function(_0x2c5c9d,_0x40427f){return db[_0xbbfa('0xa')][_0xbbfa('0xb')](_[_0xbbfa('0xc')](_0x3450dd,{'raw':!![],'where':{'id':0x1}}))[_0xbbfa('0xd')](function(_0x566134){return checkLicense(_0x566134,null);})[_0xbbfa('0xd')](function(_0x2024a1){_0x2c5c9d(_0x2024a1);return;})[_0xbbfa('0xe')](function(_0x29ba28){_0x40427f(_0x29ba28);});});}function checkLicense(_0x2e944f,_0xc64cd){if(!_0x2e944f){demoLicense[_0xbbfa('0xf')]=_0x2e944f[_0xbbfa('0x10')];return demoLicense;}try{var _0x155c22=_0xc64cd||_0x2e944f[_0xbbfa('0x11')];if(_['isEmpty'](_0x155c22)){throw new Error(_0xbbfa('0x12'));}var _0x22f341=_0x2e944f[_0xbbfa('0x10')];var _0x37a9c3=_0x2e944f[_0xbbfa('0x13')];var _0x353d80=_0x22f341[_0xbbfa('0x14')]('-')[0x4];var _0x46d92b=_0x22f341['split']('-')[0x0];var _0x4fc734=encryptor[_0xbbfa('0x15')](_0x155c22,util[_0xbbfa('0x16')](_0xbbfa('0x17'),_0x353d80,_0x22f341,_0x46d92b));var _0x457100=JSON[_0xbbfa('0x18')](_0x4fc734);_0x457100[_0xbbfa('0x19')]=![];_0x457100[_0xbbfa('0xf')]=_0x22f341;_0x457100[_0xbbfa('0x1a')]=hardware[_0xbbfa('0x8')]();if(_0x37a9c3){var _0x53c7f2=encryptor[_0xbbfa('0x15')](_0x37a9c3);_0x457100[_0xbbfa('0x1b')]=_0x53c7f2;_0x457100[_0xbbfa('0x1c')]=moment(_0x53c7f2)['add'](0x7,_0xbbfa('0x1d'))[_0xbbfa('0x16')]();_0x457100[_0xbbfa('0x1e')]=_0x457100[_0xbbfa('0xf')]!=_0x457100['machineUuid']?'changed':_0xbbfa('0x1f');}return _0x457100;}catch(_0x4a522a){breakingLicense['uuid']=_0x2e944f[_0xbbfa('0x10')];breakingLicense[_0xbbfa('0x20')]=_0x4a522a[_0xbbfa('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x321378,_0x1e28c7){getLicense()[_0xbbfa('0xd')](function(_0x8810e0){return db[_0xbbfa('0x21')][_0xbbfa('0x22')]({'attributes':['role',[db[_0xbbfa('0x23')]['fn'](_0xbbfa('0x24'),db['sequelize'][_0xbbfa('0x25')](_0xbbfa('0x26'))),_0xbbfa('0x27')]],'group':_0xbbfa('0x26'),'where':{'role':{'$or':[_0xbbfa('0x28'),_0xbbfa('0x29'),_0xbbfa('0x2a')]}},'raw':!![]})[_0xbbfa('0xd')](function(_0x28d03f){var _0x15b876={'user':_0x8810e0['users']||0x0,'telephone':_0x8810e0[_0xbbfa('0x2b')]||0x0};_0x28d03f[_0xbbfa('0x2c')](function(_0x10f4fb){var _0xc696ae=_0x10f4fb[_0xbbfa('0x26')]==='admin'?_0xbbfa('0x29'):_0x10f4fb['role'];_0x15b876[_0xc696ae]-=_0x10f4fb['count'];if(_0x15b876[_0xc696ae]<0x0)_0x15b876[_0xc696ae]=0x0;});_0x321378(_0x15b876);return;});})[_0xbbfa('0xe')](function(_0x34f35e){_0x1e28c7(_0x34f35e);});});}function checkUserLimits(_0x299e16){return new BPromise(function(_0x585733,_0x2ec41c){getLimits()[_0xbbfa('0xd')](function(_0x204d7a){var _0xf0e32b=_[_0xbbfa('0x2d')](_[_0xbbfa('0x2e')](_0x299e16,'role'),[_0xbbfa('0x28'),'user',_0xbbfa('0x2a')]);var _0x22f000=(_0xf0e32b[_0xbbfa('0x28')]||0x0)+(_0xf0e32b[_0xbbfa('0x29')]||0x0);var _0x2b7a78=_0xf0e32b[_0xbbfa('0x2a')]||0x0;if(_0x22f000>_0x204d7a[_0xbbfa('0x29')])return _0x2ec41c('License\x20limit\x20reached\x20for\x20users');if(_0x2b7a78>_0x204d7a[_0xbbfa('0x2a')])return _0x2ec41c(_0xbbfa('0x2f'));return _0x585733();})['catch'](function(_0x50c6ec){_0x2ec41c(_0x50c6ec);});});}module[_0xbbfa('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xefce=['parse','demo','uuid','gray','deadline','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s'];(function(_0x403b7c,_0x5d1d4d){var _0x34e519=function(_0x96866b){while(--_0x96866b){_0x403b7c['push'](_0x403b7c['shift']());}};_0x34e519(++_0x5d1d4d);}(_0xefce,0x10d));var _0xeefc=function(_0x348860,_0x4531f6){_0x348860=_0x348860-0x0;var _0x2fc2ad=_0xefce[_0x348860];return _0x2fc2ad;};'use strict';var util=require(_0xeefc('0x0'));var _=require(_0xeefc('0x1'));var moment=require('moment');var BPromise=require(_0xeefc('0x2'));var hardware=require(_0xeefc('0x3'));var encryptor=require(_0xeefc('0x4'));var db=require(_0xeefc('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xeefc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xeefc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xeefc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xeefc('0x8'),'machineUuid':hardware[_0xeefc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4d761a){return new BPromise(function(_0x524452,_0x4c02bc){return db['License'][_0xeefc('0x9')](_['defaults'](_0x4d761a,{'raw':!![],'where':{'id':0x1}}))[_0xeefc('0xa')](function(_0x5b04f4){return checkLicense(_0x5b04f4,null);})['then'](function(_0x24e78d){_0x524452(_0x24e78d);return;})[_0xeefc('0xb')](function(_0x5f15ad){_0x4c02bc(_0x5f15ad);});});}function checkLicense(_0x381387,_0x4df8fe){if(!_0x381387){demoLicense['uuid']=_0x381387[_0xeefc('0xc')];return demoLicense;}try{var _0x16d6c6=_0x4df8fe||_0x381387['license'];if(_[_0xeefc('0xd')](_0x16d6c6)){throw new Error(_0xeefc('0xe'));}var _0x5a52e6=_0x381387['data1'];var _0x4d98c0=_0x381387['data2'];var _0x14eb56=_0x5a52e6[_0xeefc('0xf')]('-')[0x4];var _0x4f7aff=_0x5a52e6[_0xeefc('0xf')]('-')[0x0];var _0x50f7d2=encryptor[_0xeefc('0x10')](_0x16d6c6,util[_0xeefc('0x11')](_0xeefc('0x12'),_0x14eb56,_0x5a52e6,_0x4f7aff));var _0x19601d=JSON[_0xeefc('0x13')](_0x50f7d2);_0x19601d[_0xeefc('0x14')]=![];_0x19601d[_0xeefc('0x15')]=_0x5a52e6;_0x19601d['machineUuid']=hardware[_0xeefc('0x7')]();if(_0x4d98c0){var _0x56b5b7=encryptor['decryptString'](_0x4d98c0);_0x19601d[_0xeefc('0x16')]=_0x56b5b7;_0x19601d[_0xeefc('0x17')]=moment(_0x56b5b7)['add'](0x7,_0xeefc('0x18'))[_0xeefc('0x11')]();_0x19601d[_0xeefc('0x19')]=_0x19601d[_0xeefc('0x15')]!=_0x19601d[_0xeefc('0x1a')]?_0xeefc('0x1b'):_0xeefc('0x1c');}return _0x19601d;}catch(_0x23d55d){breakingLicense[_0xeefc('0x15')]=_0x381387['data1'];breakingLicense[_0xeefc('0x1d')]=_0x23d55d[_0xeefc('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4ca2ba,_0x3755f4){getLicense()[_0xeefc('0xa')](function(_0x5a1668){return db[_0xeefc('0x1e')][_0xeefc('0x1f')]({'attributes':[_0xeefc('0x20'),[db[_0xeefc('0x21')]['fn'](_0xeefc('0x22'),db['sequelize'][_0xeefc('0x23')](_0xeefc('0x20'))),_0xeefc('0x24')]],'group':'role','where':{'role':{'$or':[_0xeefc('0x25'),_0xeefc('0x26'),_0xeefc('0x27')]}},'raw':!![]})['then'](function(_0x5eb9ec){var _0x2941a8={'user':_0x5a1668[_0xeefc('0x28')]||0x0,'telephone':_0x5a1668[_0xeefc('0x29')]||0x0};_0x5eb9ec[_0xeefc('0x2a')](function(_0x1dbb48){var _0x162b57=_0x1dbb48[_0xeefc('0x20')]===_0xeefc('0x25')?_0xeefc('0x26'):_0x1dbb48['role'];_0x2941a8[_0x162b57]-=_0x1dbb48['count'];if(_0x2941a8[_0x162b57]<0x0)_0x2941a8[_0x162b57]=0x0;});_0x4ca2ba(_0x2941a8);return;});})[_0xeefc('0xb')](function(_0x59fbf8){_0x3755f4(_0x59fbf8);});});}function checkUserLimits(_0x2fa78f){return new BPromise(function(_0xbf8d0e,_0xf70503){getLimits()[_0xeefc('0xa')](function(_0x5d2694){var _0x3c0d9b=_[_0xeefc('0x2b')](_[_0xeefc('0x2c')](_0x2fa78f,_0xeefc('0x20')),[_0xeefc('0x25'),_0xeefc('0x26'),_0xeefc('0x27')]);var _0xf48f26=(_0x3c0d9b['admin']||0x0)+(_0x3c0d9b[_0xeefc('0x26')]||0x0);var _0x591bee=_0x3c0d9b[_0xeefc('0x27')]||0x0;if(_0xf48f26>_0x5d2694[_0xeefc('0x26')])return _0xf70503(_0xeefc('0x2d'));if(_0x591bee>_0x5d2694[_0xeefc('0x27')])return _0xf70503(_0xeefc('0x2e'));return _0xbf8d0e();})[_0xeefc('0xb')](function(_0x4b3a1f){_0xf70503(_0x4b3a1f);});});}module[_0xeefc('0x2f')]={'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 f8ca16f..af97207 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 _0x3423=['app-id','secret','myappanuglar-secret'];(function(_0x4e93e6,_0x52ee21){var _0x36c917=function(_0x29518f){while(--_0x29518f){_0x4e93e6['push'](_0x4e93e6['shift']());}};_0x36c917(++_0x52ee21);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3342('0x0'),'GOOGLE_ID':_0x3342('0x1'),'GOOGLE_SECRET':_0x3342('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xea28=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x2a7dc6,_0x18a639){var _0x37d9c8=function(_0x4fafd0){while(--_0x4fafd0){_0x2a7dc6['push'](_0x2a7dc6['shift']());}};_0x37d9c8(++_0x18a639);}(_0xea28,0x13a));var _0x8ea2=function(_0xe3ca76,_0x171373){_0xe3ca76=_0xe3ca76-0x0;var _0x19e26f=_0xea28[_0xe3ca76];return _0x19e26f;};'use strict';module[_0x8ea2('0x0')]={'DOMAIN':_0x8ea2('0x1'),'SESSION_SECRET':_0x8ea2('0x2'),'GOOGLE_ID':_0x8ea2('0x3'),'GOOGLE_SECRET':_0x8ea2('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 305f0ab..10e5ae9 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fbf=['../utils/loggers','fileLogger'];(function(_0x54a260,_0x5c7359){var _0x54ae11=function(_0x34b0a6){while(--_0x34b0a6){_0x54a260['push'](_0x54a260['shift']());}};_0x54ae11(++_0x5c7359);}(_0x5fbf,0x150));var _0xf5fb=function(_0x114036,_0x11041e){_0x114036=_0x114036-0x0;var _0x396971=_0x5fbf[_0x114036];return _0x396971;};'use strict';var fileLogger=require(_0xf5fb('0x0'))[_0xf5fb('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x9f9c=['../utils/loggers','fileLogger'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x9f9c,0x18c));var _0xc9f9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9f9c[_0x3e5086];return _0xfeb102;};'use strict';var fileLogger=require(_0xc9f9('0x0'))[_0xc9f9('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b3b50c5..4c76cf2 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 _0xd152=['join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve'];(function(_0x483f56,_0x4b6339){var _0x31a5b8=function(_0x57a50b){while(--_0x57a50b){_0x483f56['push'](_0x483f56['shift']());}};_0x31a5b8(++_0x4b6339);}(_0xd152,0x75));var _0x2d15=function(_0x236774,_0x185886){_0x236774=_0x236774-0x0;var _0x4c67a1=_0xd152[_0x236774];return _0x4c67a1;};'use strict';var path=require(_0x2d15('0x0'));var cfg=require(_0x2d15('0x1'));var env={'NODE_PATH':path[_0x2d15('0x2')](path[_0x2d15('0x3')](cfg[_0x2d15('0x4')],_0x2d15('0x5')))};var pm2config={'apps':[{'name':_0x2d15('0x6'),'script':path[_0x2d15('0x3')](__dirname,_0x2d15('0x7')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x2d15('0x8')),'env':env},{'name':'agi','script':path[_0x2d15('0x3')](__dirname,_0x2d15('0x9')),'env':env},{'name':'email','script':path[_0x2d15('0x3')](__dirname,_0x2d15('0xa')),'env':env},{'name':_0x2d15('0xb'),'script':path['join'](__dirname,_0x2d15('0xc')),'env':env},{'name':_0x2d15('0xd'),'script':path[_0x2d15('0x3')](__dirname,_0x2d15('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x514f=['path','../../config/environment','resolve','join','root','legacy-libs','express','ami','../../services/ami/index.js','agi','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x2ea0eb,_0xa8327c){var _0x232df1=function(_0x16167b){while(--_0x16167b){_0x2ea0eb['push'](_0x2ea0eb['shift']());}};_0x232df1(++_0xa8327c);}(_0x514f,0x120));var _0xf514=function(_0x5f418c,_0x470146){_0x5f418c=_0x5f418c-0x0;var _0x3681eb=_0x514f[_0x5f418c];return _0x3681eb;};'use strict';var path=require(_0xf514('0x0'));var cfg=require(_0xf514('0x1'));var env={'NODE_PATH':path[_0xf514('0x2')](path[_0xf514('0x3')](cfg[_0xf514('0x4')],_0xf514('0x5')))};var pm2config={'apps':[{'name':_0xf514('0x6'),'script':path[_0xf514('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xf514('0x7'),'script':path[_0xf514('0x3')](__dirname,_0xf514('0x8')),'env':env},{'name':_0xf514('0x9'),'script':path[_0xf514('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0xf514('0x3')](__dirname,_0xf514('0xa')),'env':env},{'name':_0xf514('0xb'),'script':path[_0xf514('0x3')](__dirname,_0xf514('0xc')),'env':env},{'name':_0xf514('0xd'),'script':path['join'](__dirname,_0xf514('0xe')),'env':env}]};module[_0xf514('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 327893f..6f93c10 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 _0x1b8b=['saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x160f07,_0x4ed237){var _0x4e9e71=function(_0xb5d7d5){while(--_0xb5d7d5){_0x160f07['push'](_0x160f07['shift']());}};_0x4e9e71(++_0x4ed237);}(_0x1b8b,0x1eb));var _0xb1b8=function(_0x324e0e,_0x3e3ff1){_0x324e0e=_0x324e0e-0x0;var _0x223778=_0x1b8b[_0x324e0e];return _0x223778;};'use strict';var pm2=require(_0xb1b8('0x0'));var BPromise=require(_0xb1b8('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x579464,_0x285f25){return pm2[_0xb1b8('0x2')](function(_0x18b0e5){if(_0x18b0e5){return _0x285f25(_0x18b0e5);}return _0x579464(_0xb1b8('0x3'));});});};exports[_0xb1b8('0x4')]=function(_0x3628a6){return connect()[_0xb1b8('0x5')](function(){return new BPromise(function(_0x5cb70a,_0x5a6196){return pm2[_0xb1b8('0x4')](_0x3628a6,function(_0x2cf987,_0x48eab1){if(_0x2cf987){return _0x5a6196(_0x2cf987);}pm2[_0xb1b8('0x6')]();return _0x5cb70a(_0x48eab1);});});});};exports[_0xb1b8('0x7')]=function(_0x19f60b){return connect()['then'](function(){return new BPromise(function(_0x177959,_0x232f5a){return pm2[_0xb1b8('0x7')](_0x19f60b,function(_0x4dd815,_0x212c7c){if(_0x4dd815){return _0x232f5a(_0x4dd815);}pm2[_0xb1b8('0x6')]();return _0x177959(_0x212c7c);});});});};exports['restart']=function(_0x74c1e){return connect()[_0xb1b8('0x5')](function(){return new BPromise(function(_0x4ab07e,_0x2863bc){return pm2[_0xb1b8('0x8')](_0x74c1e,function(_0x5368e1,_0x26fba7){if(_0x5368e1){return _0x2863bc(_0x5368e1);}pm2[_0xb1b8('0x6')]();return _0x4ab07e(_0x26fba7);});});});};exports[_0xb1b8('0x9')]=function(){return connect()[_0xb1b8('0x5')](function(){return new BPromise(function(_0x1c22d4,_0x17c90f){return pm2[_0xb1b8('0x9')](function(_0x1f9c67,_0x58d7ce){if(_0x1f9c67){return _0x17c90f(_0x1f9c67);}pm2['disconnect']();return _0x1c22d4(_0x58d7ce);});});});};exports[_0xb1b8('0xa')]=function(_0x2bbb84){return connect()[_0xb1b8('0x5')](function(){return new BPromise(function(_0x4bef2b,_0x2d9e83){return pm2[_0xb1b8('0xa')](_0x2bbb84,function(_0x1495c1,_0x3a9601){if(_0x1495c1){return _0x2d9e83(_0x1495c1);}pm2[_0xb1b8('0x6')]();return _0x4bef2b(_0x3a9601);});});});};exports[_0xb1b8('0xb')]=function(_0x36c213){return connect()[_0xb1b8('0x5')](function(){return new BPromise(function(_0x538d1e,_0x80b6c){return pm2[_0xb1b8('0xb')](_0x36c213,function(_0x59bcb8,_0x33a759){if(_0x59bcb8){return _0x80b6c(_0x59bcb8);}pm2['disconnect']();return _0x538d1e(_0x33a759);});});});};exports[_0xb1b8('0xc')]=function(){return connect()[_0xb1b8('0x5')](function(){return new BPromise(function(_0x5bcf40,_0x233e35){return pm2[_0xb1b8('0xc')](function(_0x3b69f0){if(_0x3b69f0){return _0x233e35(_0x3b69f0);}return _0x5bcf40(_0xb1b8('0xd'));});});});}; \ No newline at end of file +var _0x925b=['connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x925b,0xec));var _0xb925=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x925b[_0x3e3bee];return _0x3ae14c;};'use strict';var pm2=require(_0xb925('0x0'));var BPromise=require(_0xb925('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x297fab,_0x49567d){return pm2[_0xb925('0x2')](function(_0x3cec33){if(_0x3cec33){return _0x49567d(_0x3cec33);}return _0x297fab(_0xb925('0x3'));});});};exports[_0xb925('0x4')]=function(_0x1d04dc){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0xb4d163,_0x4d961e){return pm2[_0xb925('0x4')](_0x1d04dc,function(_0x116ee9,_0x5b3eda){if(_0x116ee9){return _0x4d961e(_0x116ee9);}pm2['disconnect']();return _0xb4d163(_0x5b3eda);});});});};exports[_0xb925('0x6')]=function(_0x187f38){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0x5b3d07,_0x2c03b2){return pm2['stop'](_0x187f38,function(_0x420c93,_0x5be526){if(_0x420c93){return _0x2c03b2(_0x420c93);}pm2[_0xb925('0x7')]();return _0x5b3d07(_0x5be526);});});});};exports[_0xb925('0x8')]=function(_0xa3cee){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0x263388,_0x3a5e2a){return pm2[_0xb925('0x8')](_0xa3cee,function(_0x57dd53,_0x4d0ea9){if(_0x57dd53){return _0x3a5e2a(_0x57dd53);}pm2[_0xb925('0x7')]();return _0x263388(_0x4d0ea9);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x3cbae9,_0x3fba60){return pm2[_0xb925('0x9')](function(_0x59ff2e,_0x25297d){if(_0x59ff2e){return _0x3fba60(_0x59ff2e);}pm2[_0xb925('0x7')]();return _0x3cbae9(_0x25297d);});});});};exports[_0xb925('0xa')]=function(_0x1c6583){return connect()['then'](function(){return new BPromise(function(_0x63c7c3,_0x3fe487){return pm2['describe'](_0x1c6583,function(_0x5d80b3,_0xc41ae1){if(_0x5d80b3){return _0x3fe487(_0x5d80b3);}pm2[_0xb925('0x7')]();return _0x63c7c3(_0xc41ae1);});});});};exports['delete']=function(_0x16b6dd){return connect()[_0xb925('0x5')](function(){return new BPromise(function(_0x4c5c97,_0x6b62c0){return pm2[_0xb925('0xb')](_0x16b6dd,function(_0x374ef3,_0x4d7077){if(_0x374ef3){return _0x6b62c0(_0x374ef3);}pm2[_0xb925('0x7')]();return _0x4c5c97(_0x4d7077);});});});};exports[_0xb925('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x183a6f,_0x32f938){return pm2[_0xb925('0xc')](function(_0x41c7bf){if(_0x41c7bf){return _0x32f938(_0x41c7bf);}return _0x183a6f(_0xb925('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d60aa24..4447421 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 _0x2427=['subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','then','chatTimeout','ChatInteraction','findAll'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x2427,0x9f));var _0x7242=function(_0x32eee7,_0x4dc5f0){_0x32eee7=_0x32eee7-0x0;var _0x3363b4=_0x2427[_0x32eee7];return _0x3363b4;};'use strict';var _=require(_0x7242('0x0'));var moment=require('moment');var Redis=require(_0x7242('0x1'));var util=require('util');var config=require(_0x7242('0x2'));var db=require(_0x7242('0x3'))['db'];var logger=require(_0x7242('0x4'))(_0x7242('0x5'));config['redis']=_[_0x7242('0x6')](config[_0x7242('0x7')],{'host':_0x7242('0x8'),'port':0x18eb});var io=require(_0x7242('0x9'))(new Redis(config[_0x7242('0x7')]));function closeInteractions(){var _0x542a35=0x0;var _0x5104ba=[];return db[_0x7242('0xa')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x7242('0xb')](function(_0x2e002c){_0x542a35=_0x2e002c[_0x7242('0xc')];if(_0x542a35){return db[_0x7242('0xd')][_0x7242('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7242('0xf')](_0x2e002c['chatTimeout'],_0x7242('0x10'))}}});}else{return[];}})[_0x7242('0xb')](function(_0x408106){if(_0x408106&&_0x408106[_0x7242('0x11')]){_0x5104ba=_['map'](_0x408106||[],'id');logger[_0x7242('0x12')](_0x7242('0x13'),_0x5104ba['join']());return db[_0x7242('0xd')][_0x7242('0x14')]({'closeReason':'system','disposition':_0x7242('0x15'),'closed':!![],'closedAt':moment()[_0x7242('0x16')](_0x7242('0x17'))},{'where':{'id':_0x5104ba}});}})[_0x7242('0xb')](function(){if(_0x5104ba&&_0x5104ba[_0x7242('0x11')]){logger['info'](_0x7242('0x18'),_0x5104ba[_0x7242('0x19')]());for(var _0x589993=0x0;_0x589993<_0x5104ba['length'];_0x589993++){io['emit'](_0x7242('0x1a'),{'id':_0x5104ba[_0x589993],'closed':!![]});}}})['catch'](function(_0x58ee0c){logger[_0x7242('0x1b')](_0x7242('0x1c'),_0x58ee0c?util['inspect'](_0x58ee0c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdf45=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','../../config/environment','redis','defaults','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','length','map'];(function(_0x26f518,_0x5a6c2d){var _0x3666d=function(_0x38ef7f){while(--_0x38ef7f){_0x26f518['push'](_0x26f518['shift']());}};_0x3666d(++_0x5a6c2d);}(_0xdf45,0x79));var _0x5df4=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0xdf45[_0x1b91c7];return _0xbbe014;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x5df4('0x0'));var util=require('util');var config=require(_0x5df4('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x5df4('0x2')]=_[_0x5df4('0x3')](config[_0x5df4('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5df4('0x2')]));function closeInteractions(){var _0x46c767=0x0;var _0x54df6f=[];return db[_0x5df4('0x4')][_0x5df4('0x5')]({'raw':!![],'attributes':['id',_0x5df4('0x6')],'where':{'id':0x1}})['then'](function(_0x2dd9c8){_0x46c767=_0x2dd9c8['chatTimeout'];if(_0x46c767){return db[_0x5df4('0x7')]['findAll']({'raw':!![],'attributes':['id',_0x5df4('0x8')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5df4('0x9')](_0x2dd9c8['chatTimeout'],_0x5df4('0xa'))}}});}else{return[];}})[_0x5df4('0xb')](function(_0x63fb4d){if(_0x63fb4d&&_0x63fb4d[_0x5df4('0xc')]){_0x54df6f=_[_0x5df4('0xd')](_0x63fb4d||[],'id');logger[_0x5df4('0xe')](_0x5df4('0xf'),_0x54df6f[_0x5df4('0x10')]());return db[_0x5df4('0x7')][_0x5df4('0x11')]({'closeReason':_0x5df4('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5df4('0x13')](_0x5df4('0x14'))},{'where':{'id':_0x54df6f}});}})['then'](function(){if(_0x54df6f&&_0x54df6f[_0x5df4('0xc')]){logger[_0x5df4('0xe')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x54df6f['join']());for(var _0x42443c=0x0;_0x42443c<_0x54df6f[_0x5df4('0xc')];_0x42443c++){io[_0x5df4('0x15')](_0x5df4('0x16'),{'id':_0x54df6f[_0x42443c],'closed':!![]});}}})['catch'](function(_0x5eac01){logger[_0x5df4('0x17')](_0x5df4('0x18'),_0x5eac01?util[_0x5df4('0x19')](_0x5eac01,{'showHidden':![],'depth':null}):'');});}exports[_0x5df4('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index a080d5c..4be9665 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36da=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x377b59,_0x1f167d){var _0x2cae54=function(_0x292df1){while(--_0x292df1){_0x377b59['push'](_0x377b59['shift']());}};_0x2cae54(++_0x1f167d);}(_0x36da,0x195));var _0xa36d=function(_0x2f202e,_0x5ed293){_0x2f202e=_0x2f202e-0x0;var _0x398ac6=_0x36da[_0x2f202e];return _0x398ac6;};'use strict';function start(){var _0x47c7ce=require(_0xa36d('0x0'));return _0x47c7ce[_0xa36d('0x1')]();}module[_0xa36d('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xd466=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4ed546,_0x244bd0){var _0x10bfcc=function(_0x2e2caa){while(--_0x2e2caa){_0x4ed546['push'](_0x4ed546['shift']());}};_0x10bfcc(++_0x244bd0);}(_0xd466,0x1a8));var _0x6d46=function(_0x3881a5,_0x1f0d08){_0x3881a5=_0x3881a5-0x0;var _0xea1dff=_0xd466[_0x3881a5];return _0xea1dff;};'use strict';function start(){var _0xd7f3d9=require(_0x6d46('0x0'));return _0xd7f3d9[_0x6d46('0x1')]();}module[_0x6d46('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 161020e..ecb20b8 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 _0xff5e=['exists','stop','deleteJob','toRun','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','add\x20cron','stop\x20cron','active','update','update\x20cron','run','start','util','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','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','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','stringify','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','CloudProvider','keys','toString','difference','length'];(function(_0x11deeb,_0x2a6c34){var _0x42220b=function(_0x409476){while(--_0x409476){_0x11deeb['push'](_0x11deeb['shift']());}};_0x42220b(++_0x2a6c34);}(_0xff5e,0xb6));var _0xeff5=function(_0x5b9eef,_0x1e8c28){_0x5b9eef=_0x5b9eef-0x0;var _0x101228=_0xff5e[_0x5b9eef];return _0x101228;};'use strict';var fs=require('fs');var util=require(_0xeff5('0x0'));var path=require('path');var _=require(_0xeff5('0x1'));var moment=require(_0xeff5('0x2'));var CronJobManager=require(_0xeff5('0x3'));var jayson=require(_0xeff5('0x4'));var BPromise=require('bluebird');var logger=require(_0xeff5('0x5'))(_0xeff5('0x6'));var db=require(_0xeff5('0x7'))['db'];var analyticCustomReportController=require(_0xeff5('0x8'));var analyticDefaultReportController=require(_0xeff5('0x9'));var client=jayson[_0xeff5('0xa')][_0xeff5('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2942e4,_0x1e190b){return function(){logger[_0xeff5('0xc')](_0xeff5('0xd'),_0x2942e4[_0xeff5('0xe')]);var _0x3e2c0f=!![];var _0x5de3e3=_0x2942e4['MailAccount']['getSmtpOptions']();var _0x52ada3={'account':_0x5de3e3,'message':{'from':util['format'](_0xeff5('0xf'),_0x2942e4[_0xeff5('0x10')][_0xeff5('0x11')],_0x2942e4[_0xeff5('0x10')][_0xeff5('0xe')]||_0x2942e4[_0xeff5('0x10')][_0xeff5('0x12')][_0xeff5('0x13')]),'to':_0x2942e4[_0xeff5('0xe')],'cc':_0x2942e4['cc'],'bcc':_0x2942e4[_0xeff5('0x14')],'subject':util[_0xeff5('0x15')](_0xeff5('0x16'),_0x1e190b[_0xeff5('0x11')],_0x2942e4[_0xeff5('0x17')],_0x2942e4[_0xeff5('0x18')])}};var _0x32f981=path[_0xeff5('0x19')](__dirname,_0xeff5('0x1a'));var _0x2fbd8b=_0x1e190b[_0xeff5('0x1b')];var _0x40fd45=util[_0xeff5('0x15')](_0xeff5('0x1c'),path[_0xeff5('0x1d')](_0x1e190b['savename'],path[_0xeff5('0x1e')](_0x1e190b[_0xeff5('0x1b')])),'zip');var _0x2a4dff=path[_0xeff5('0x19')](_0x32f981,_0x2fbd8b);var _0x4856ea=path[_0xeff5('0x19')](_0x32f981,_0x40fd45);if(fs[_0xeff5('0x1f')](_0x2a4dff)){_0x1e190b['status']=_0xeff5('0x20');_0x52ada3[_0xeff5('0x21')][_0xeff5('0x22')]=[{'filename':_0x2fbd8b,'path':_0x2a4dff}];_0x52ada3['message'][_0xeff5('0x23')]=util[_0xeff5('0x15')](_0xeff5('0x24'),JSON['stringify'](_0x1e190b,null,0x2));}else if(fs[_0xeff5('0x1f')](_0x4856ea)){_0x1e190b[_0xeff5('0x25')]=_0xeff5('0x20');_0x52ada3[_0xeff5('0x21')]['attachments']=[{'filename':_0x40fd45,'path':_0x4856ea}];}else{_0x52ada3[_0xeff5('0x21')][_0xeff5('0x23')]=_0xeff5('0x26');if(!_0x2942e4[_0xeff5('0x27')]){_0x3e2c0f=![];logger[_0xeff5('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3e2c0f){return client[_0xeff5('0x28')](_0xeff5('0x29'),_0x52ada3)[_0xeff5('0x2a')](function(_0x1b20f8){if(_0x1b20f8[_0xeff5('0x2b')]){return logger[_0xeff5('0x2b')]('error\x20mail',JSON[_0xeff5('0x2c')](_0x1b20f8));}return logger[_0xeff5('0xc')]('email\x20sent');})['catch'](function(_0x3f6187){return logger['error'](_0xeff5('0x2d'),JSON[_0xeff5('0x2c')](_0x3f6187));});}};}function handleError(){return function(_0x289624){return logger[_0xeff5('0x2b')](JSON[_0xeff5('0x2c')](_0x289624));};}function handleResult(_0x460196){return function(_0x290491){logger[_0xeff5('0xc')](_0xeff5('0x2e'),JSON[_0xeff5('0x2c')](_0x290491));if(_0x460196[_0xeff5('0x10')]&&_0x460196[_0xeff5('0x10')]['Smtp']&&!_[_0xeff5('0x2f')](_0x460196['email'])){setTimeout(handleSendEmail(_0x460196,_0x290491),0x3c*0x3e8);}};}function handleJob(_0x47d472){return function(){try{if(_['isNil'](_0x47d472['subtractNumber'])){return logger[_0xeff5('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xeff5('0x2f')](_0x47d472[_0xeff5('0x18')])){return logger[_0xeff5('0xc')](_0xeff5('0x30'));}var _0x456c5f={'startDate':moment()[_0xeff5('0x31')](_0x47d472['subtractNumber'],_0x47d472[_0xeff5('0x18')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xeff5('0x32')),'type':_0xeff5('0x33'),'output':_0x47d472[_0xeff5('0x34')],'name':_0x47d472[_0xeff5('0x11')]};if(!_[_0xeff5('0x2f')](_0x47d472[_0xeff5('0x35')])){logger[_0xeff5('0xc')](_0xeff5('0x36'),_0x47d472[_0xeff5('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x47d472[_0xeff5('0x35')]},_0x456c5f)['then'](handleResult(_0x47d472))[_0xeff5('0x37')](handleError());}if(!_[_0xeff5('0x2f')](_0x47d472['CustomReportId'])){logger['info'](_0xeff5('0x38'),_0x47d472['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x47d472[_0xeff5('0x39')]},_0x456c5f)[_0xeff5('0x2a')](handleResult(_0x47d472))[_0xeff5('0x37')](handleError());}}catch(_0x4c5e22){logger[_0xeff5('0x2b')](JSON['stringify'](_0x4c5e22));}return logger[_0xeff5('0xc')](_0xeff5('0x3a'));};}function getJobs(_0x594af9){var _0x58c802={};if(_0x594af9){_0x58c802['id']=_0x594af9;}return db['Schedule']['findAll']({'where':_0x58c802,'include':[{'model':db[_0xeff5('0x10')],'attributes':['id',_0xeff5('0x11'),_0xeff5('0xe')],'include':[{'model':db['MailServerOut'],'as':_0xeff5('0x12'),'include':[{'model':db[_0xeff5('0x3b')],'as':_0xeff5('0x3b')}]}]}]})[_0xeff5('0x2a')](function(_0x2411f3){var _0x3ff641=_[_0xeff5('0x3c')](manager['jobs']);var _0x2f93a4=_['map'](_0x2411f3,function(_0x2423bf){return _0x2423bf['id'][_0xeff5('0x3d')]();});var _0x4f5991=_['keyBy'](_0x2411f3,function(_0x4af35b){return _0x4af35b['id'][_0xeff5('0x3d')]();});var _0x22daa4=_0x594af9?_0x2f93a4:_['difference'](_0x2f93a4,_0x3ff641);var _0x1025ae=_['intersection'](_0x2f93a4,_0x3ff641);var _0x512ea7=_[_0xeff5('0x3e')](_0x3ff641,_0x2f93a4);var _0x84c44d;var _0x4e961f;for(_0x84c44d=0x0;_0x84c44d<_0x512ea7[_0xeff5('0x3f')]&&!_0x594af9;_0x84c44d+=0x1){_0x4e961f=_0x512ea7[_0x84c44d][_0xeff5('0x3d')]();if(manager[_0xeff5('0x40')](_0x4e961f)){manager[_0xeff5('0x41')](_0x4e961f);manager[_0xeff5('0x42')](_0x4e961f);logger[_0xeff5('0xc')]('delete\x20cron',_0x4e961f);}}logger['info'](_0xeff5('0x43'),JSON[_0xeff5('0x2c')](_0x22daa4));for(_0x84c44d=0x0;_0x84c44d<_0x22daa4[_0xeff5('0x3f')];_0x84c44d+=0x1){_0x4e961f=_0x22daa4[_0x84c44d][_0xeff5('0x3d')]();logger[_0xeff5('0xc')]('index',_0x4e961f);if(_0x594af9){logger[_0xeff5('0xc')](_0xeff5('0x44'),_0x594af9);logger[_0xeff5('0xc')](JSON[_0xeff5('0x2c')](_0x4f5991[_0x4e961f]));BPromise[_0xeff5('0x45')]()[_0xeff5('0x2a')](handleJob(_0x4f5991[_0x4e961f]));logger[_0xeff5('0xc')](_0xeff5('0x46'),_0x4f5991[_0x4e961f][_0xeff5('0x11')],_0x4f5991[_0x4e961f][_0xeff5('0x47')]);}else if(_0x4f5991[_0x4e961f][_0xeff5('0x47')]&&_0x4f5991[_0x4e961f]['active']&&moment()[_0xeff5('0x48')](_0x4f5991[_0x4e961f][_0xeff5('0x49')],_0x4f5991[_0x4e961f]['endAt'])){manager[_0xeff5('0x4a')](_0x4e961f,_0x4f5991[_0x4e961f][_0xeff5('0x47')],handleJob(_0x4f5991[_0x4e961f]));manager['start'](_0x4e961f);logger['info'](_0xeff5('0x4b'),_0x4f5991[_0x4e961f][_0xeff5('0x11')],_0x4f5991[_0x4e961f][_0xeff5('0x47')]);}else if(manager[_0xeff5('0x40')](_0x4e961f)){manager[_0xeff5('0x41')](_0x4e961f);manager[_0xeff5('0x42')](_0x4e961f);logger['info'](_0xeff5('0x4c'),_0x4f5991[_0x4e961f][_0xeff5('0x11')],_0x4f5991[_0x4e961f][_0xeff5('0x47')]);}}for(_0x84c44d=0x0,_0x4e961f;_0x84c44d<_0x1025ae['length']&&!_0x594af9;_0x84c44d+=0x1){_0x4e961f=_0x1025ae[_0x84c44d][_0xeff5('0x3d')]();if(manager[_0xeff5('0x40')](_0x4e961f)){if(_0x4f5991[_0x4e961f][_0xeff5('0x47')]&&_0x4f5991[_0x4e961f][_0xeff5('0x4d')]&&moment()[_0xeff5('0x48')](_0x4f5991[_0x4e961f][_0xeff5('0x49')],_0x4f5991[_0x4e961f]['endAt'])){manager[_0xeff5('0x4e')](_0x4e961f,_0x4f5991[_0x4e961f][_0xeff5('0x47')],handleJob(_0x4f5991[_0x4e961f]));logger['info'](_0xeff5('0x4f'),_0x4f5991[_0x4e961f][_0xeff5('0x11')],_0x4f5991[_0x4e961f][_0xeff5('0x47')]);}else{manager[_0xeff5('0x41')](_0x4e961f);manager[_0xeff5('0x42')](_0x4e961f);logger[_0xeff5('0xc')](_0xeff5('0x4c'),_0x4f5991[_0x4e961f][_0xeff5('0x11')],_0x4f5991[_0x4e961f][_0xeff5('0x47')]);}}}})[_0xeff5('0x37')](function(_0x4c72e1){logger['error'](JSON[_0xeff5('0x2c')](_0x4c72e1));});}exports[_0xeff5('0x50')]=function(_0x766b5c){return getJobs(_0x766b5c);};exports[_0xeff5('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0d0f=['moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','exists','deleteJob','toRun','length','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','add\x20cron','stop','stop\x20cron','active','update','update\x20cron','run','start','util','path'];(function(_0x13d78f,_0x58e3e7){var _0x31c4fb=function(_0x1356c7){while(--_0x1356c7){_0x13d78f['push'](_0x13d78f['shift']());}};_0x31c4fb(++_0x58e3e7);}(_0x0d0f,0x166));var _0xf0d0=function(_0x51cc75,_0x7f40c3){_0x51cc75=_0x51cc75-0x0;var _0x3c3111=_0x0d0f[_0x51cc75];return _0x3c3111;};'use strict';var fs=require('fs');var util=require(_0xf0d0('0x0'));var path=require(_0xf0d0('0x1'));var _=require('lodash');var moment=require(_0xf0d0('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xf0d0('0x3'));var BPromise=require(_0xf0d0('0x4'));var logger=require(_0xf0d0('0x5'))(_0xf0d0('0x6'));var db=require(_0xf0d0('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xf0d0('0x8'));var client=jayson['client'][_0xf0d0('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4a3213,_0x51c6f9){return function(){logger[_0xf0d0('0xa')](_0xf0d0('0xb'),_0x4a3213[_0xf0d0('0xc')]);var _0x4a09e8=!![];var _0x394ace=_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0xe')]();var _0x45a373={'account':_0x394ace,'message':{'from':util[_0xf0d0('0xf')](_0xf0d0('0x10'),_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0x11')],_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0xc')]||_0x4a3213[_0xf0d0('0xd')][_0xf0d0('0x12')][_0xf0d0('0x13')]),'to':_0x4a3213[_0xf0d0('0xc')],'cc':_0x4a3213['cc'],'bcc':_0x4a3213[_0xf0d0('0x14')],'subject':util[_0xf0d0('0xf')](_0xf0d0('0x15'),_0x51c6f9[_0xf0d0('0x11')],_0x4a3213[_0xf0d0('0x16')],_0x4a3213[_0xf0d0('0x17')])}};var _0xc4ff00=path['join'](__dirname,'../../files/reports');var _0x11f0e2=_0x51c6f9[_0xf0d0('0x18')];var _0xa1d29f=util[_0xf0d0('0xf')](_0xf0d0('0x19'),path[_0xf0d0('0x1a')](_0x51c6f9['savename'],path[_0xf0d0('0x1b')](_0x51c6f9[_0xf0d0('0x18')])),_0xf0d0('0x1c'));var _0x2b6984=path[_0xf0d0('0x1d')](_0xc4ff00,_0x11f0e2);var _0xab6906=path[_0xf0d0('0x1d')](_0xc4ff00,_0xa1d29f);if(fs[_0xf0d0('0x1e')](_0x2b6984)){_0x51c6f9[_0xf0d0('0x1f')]=_0xf0d0('0x20');_0x45a373[_0xf0d0('0x21')][_0xf0d0('0x22')]=[{'filename':_0x11f0e2,'path':_0x2b6984}];_0x45a373[_0xf0d0('0x21')][_0xf0d0('0x23')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xf0d0('0x24')](_0x51c6f9,null,0x2));}else if(fs[_0xf0d0('0x1e')](_0xab6906)){_0x51c6f9[_0xf0d0('0x1f')]='Sent';_0x45a373['message'][_0xf0d0('0x22')]=[{'filename':_0xa1d29f,'path':_0xab6906}];}else{_0x45a373[_0xf0d0('0x21')][_0xf0d0('0x23')]=_0xf0d0('0x25');if(!_0x4a3213[_0xf0d0('0x26')]){_0x4a09e8=![];logger[_0xf0d0('0xa')](_0xf0d0('0x27'));}}if(_0x4a09e8){return client[_0xf0d0('0x28')](_0xf0d0('0x29'),_0x45a373)['then'](function(_0x530cb6){if(_0x530cb6[_0xf0d0('0x2a')]){return logger['error'](_0xf0d0('0x2b'),JSON['stringify'](_0x530cb6));}return logger[_0xf0d0('0xa')](_0xf0d0('0x2c'));})[_0xf0d0('0x2d')](function(_0x31e69a){return logger[_0xf0d0('0x2a')](_0xf0d0('0x2b'),JSON[_0xf0d0('0x24')](_0x31e69a));});}};}function handleError(){return function(_0x36b76d){return logger[_0xf0d0('0x2a')](JSON[_0xf0d0('0x24')](_0x36b76d));};}function handleResult(_0xd9e167){return function(_0x2ff535){logger[_0xf0d0('0xa')](_0xf0d0('0x2e'),JSON['stringify'](_0x2ff535));if(_0xd9e167['MailAccount']&&_0xd9e167[_0xf0d0('0xd')]['Smtp']&&!_[_0xf0d0('0x2f')](_0xd9e167['email'])){setTimeout(handleSendEmail(_0xd9e167,_0x2ff535),0x3c*0x3e8);}};}function handleJob(_0x5a67e2){return function(){try{if(_['isNil'](_0x5a67e2[_0xf0d0('0x16')])){return logger[_0xf0d0('0xa')](_0xf0d0('0x30'));}if(_['isNil'](_0x5a67e2[_0xf0d0('0x17')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x2d1bb6={'startDate':moment()[_0xf0d0('0x31')](_0x5a67e2[_0xf0d0('0x16')],_0x5a67e2[_0xf0d0('0x17')])[_0xf0d0('0xf')](_0xf0d0('0x32')),'endDate':moment()[_0xf0d0('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x5a67e2[_0xf0d0('0x33')],'name':_0x5a67e2['name']};if(!_[_0xf0d0('0x2f')](_0x5a67e2[_0xf0d0('0x34')])){logger[_0xf0d0('0xa')](_0xf0d0('0x35'),_0x5a67e2[_0xf0d0('0x34')]);return analyticDefaultReportController[_0xf0d0('0x36')]({'id':_0x5a67e2[_0xf0d0('0x34')]},_0x2d1bb6)[_0xf0d0('0x37')](handleResult(_0x5a67e2))['catch'](handleError());}if(!_[_0xf0d0('0x2f')](_0x5a67e2['CustomReportId'])){logger[_0xf0d0('0xa')](_0xf0d0('0x38'),_0x5a67e2[_0xf0d0('0x39')]);return analyticCustomReportController[_0xf0d0('0x36')]({'id':_0x5a67e2[_0xf0d0('0x39')]},_0x2d1bb6)[_0xf0d0('0x37')](handleResult(_0x5a67e2))[_0xf0d0('0x2d')](handleError());}}catch(_0x264180){logger['error'](JSON['stringify'](_0x264180));}return logger[_0xf0d0('0xa')](_0xf0d0('0x3a'));};}function getJobs(_0x2e43d6){var _0x484414={};if(_0x2e43d6){_0x484414['id']=_0x2e43d6;}return db[_0xf0d0('0x3b')][_0xf0d0('0x3c')]({'where':_0x484414,'include':[{'model':db[_0xf0d0('0xd')],'attributes':['id','name',_0xf0d0('0xc')],'include':[{'model':db[_0xf0d0('0x3d')],'as':_0xf0d0('0x12'),'include':[{'model':db[_0xf0d0('0x3e')],'as':_0xf0d0('0x3e')}]}]}]})['then'](function(_0x3f8b25){var _0x125125=_[_0xf0d0('0x3f')](manager[_0xf0d0('0x40')]);var _0x3d0cb8=_[_0xf0d0('0x41')](_0x3f8b25,function(_0xaed01d){return _0xaed01d['id'][_0xf0d0('0x42')]();});var _0x2fdc14=_[_0xf0d0('0x43')](_0x3f8b25,function(_0x51b598){return _0x51b598['id'][_0xf0d0('0x42')]();});var _0x318c33=_0x2e43d6?_0x3d0cb8:_['difference'](_0x3d0cb8,_0x125125);var _0x3b7e0c=_[_0xf0d0('0x44')](_0x3d0cb8,_0x125125);var _0x1b1e90=_[_0xf0d0('0x45')](_0x125125,_0x3d0cb8);var _0x4291f3;var _0x2b32a3;for(_0x4291f3=0x0;_0x4291f3<_0x1b1e90['length']&&!_0x2e43d6;_0x4291f3+=0x1){_0x2b32a3=_0x1b1e90[_0x4291f3][_0xf0d0('0x42')]();if(manager[_0xf0d0('0x46')](_0x2b32a3)){manager['stop'](_0x2b32a3);manager[_0xf0d0('0x47')](_0x2b32a3);logger[_0xf0d0('0xa')]('delete\x20cron',_0x2b32a3);}}logger[_0xf0d0('0xa')](_0xf0d0('0x48'),JSON[_0xf0d0('0x24')](_0x318c33));for(_0x4291f3=0x0;_0x4291f3<_0x318c33[_0xf0d0('0x49')];_0x4291f3+=0x1){_0x2b32a3=_0x318c33[_0x4291f3][_0xf0d0('0x42')]();logger[_0xf0d0('0xa')](_0xf0d0('0x4a'),_0x2b32a3);if(_0x2e43d6){logger['info'](_0xf0d0('0x4b'),_0x2e43d6);logger['info'](JSON[_0xf0d0('0x24')](_0x2fdc14[_0x2b32a3]));BPromise[_0xf0d0('0x4c')]()[_0xf0d0('0x37')](handleJob(_0x2fdc14[_0x2b32a3]));logger[_0xf0d0('0xa')](_0xf0d0('0x4d'),_0x2fdc14[_0x2b32a3][_0xf0d0('0x11')],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}else if(_0x2fdc14[_0x2b32a3]['cron']&&_0x2fdc14[_0x2b32a3]['active']&&moment()[_0xf0d0('0x4f')](_0x2fdc14[_0x2b32a3]['startAt'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x50')])){manager[_0xf0d0('0x51')](_0x2b32a3,_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')],handleJob(_0x2fdc14[_0x2b32a3]));manager['start'](_0x2b32a3);logger['info'](_0xf0d0('0x52'),_0x2fdc14[_0x2b32a3][_0xf0d0('0x11')],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}else if(manager['exists'](_0x2b32a3)){manager[_0xf0d0('0x53')](_0x2b32a3);manager['deleteJob'](_0x2b32a3);logger[_0xf0d0('0xa')](_0xf0d0('0x54'),_0x2fdc14[_0x2b32a3]['name'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}}for(_0x4291f3=0x0,_0x2b32a3;_0x4291f3<_0x3b7e0c['length']&&!_0x2e43d6;_0x4291f3+=0x1){_0x2b32a3=_0x3b7e0c[_0x4291f3][_0xf0d0('0x42')]();if(manager[_0xf0d0('0x46')](_0x2b32a3)){if(_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]&&_0x2fdc14[_0x2b32a3][_0xf0d0('0x55')]&&moment()[_0xf0d0('0x4f')](_0x2fdc14[_0x2b32a3]['startAt'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x50')])){manager[_0xf0d0('0x56')](_0x2b32a3,_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')],handleJob(_0x2fdc14[_0x2b32a3]));logger[_0xf0d0('0xa')](_0xf0d0('0x57'),_0x2fdc14[_0x2b32a3]['name'],_0x2fdc14[_0x2b32a3][_0xf0d0('0x4e')]);}else{manager[_0xf0d0('0x53')](_0x2b32a3);manager[_0xf0d0('0x47')](_0x2b32a3);logger[_0xf0d0('0xa')](_0xf0d0('0x54'),_0x2fdc14[_0x2b32a3][_0xf0d0('0x11')],_0x2fdc14[_0x2b32a3]['cron']);}}}})[_0xf0d0('0x2d')](function(_0x579ac0){logger[_0xf0d0('0x2a')](JSON[_0xf0d0('0x24')](_0x579ac0));});}exports[_0xf0d0('0x58')]=function(_0x14c076){return getJobs(_0x14c076);};exports[_0xf0d0('0x59')]=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 b10bce9..e21cb05 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 _0x6b72=['fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','Positive','Mixed','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeAccountId','transcribeRegion','forEach','push','all','catch','lodash','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b72,0x19d));var _0x26b7=function(_0x5d5709,_0x3df571){_0x5d5709=_0x5d5709-0x0;var _0x3fcaf8=_0x6b72[_0x5d5709];return _0x3fcaf8;};var _=require(_0x26b7('0x0'));var AWS=require('aws-sdk');var rp=require(_0x26b7('0x1'));var util=require(_0x26b7('0x2'));var BPromise=require('bluebird');var db=require(_0x26b7('0x3'))['db'];var logger=require(_0x26b7('0x4'))('transcribe');function getTranscriptionJob(_0x4a5437,_0x496950,_0x997ba6,_0x44d910){return new Promise(function(_0x5bf038,_0x26ac11){var _0x1d2a56=new AWS[(_0x26b7('0x5'))]({'accessKeyId':_0x496950,'secretAccessKey':_0x4a5437,'region':_0x997ba6});_0x1d2a56[_0x26b7('0x6')]({'TranscriptionJobName':_0x44d910},function(_0x20eff5,_0x10c2b3){if(_0x20eff5){return _0x26ac11(_0x20eff5);}else{return _0x5bf038(_0x10c2b3);}});});}function sentiment(_0xc25a24,_0x50dfb8,_0x2ba81e,_0x5d181d,_0x39daec){return new Promise(function(_0x527ca2,_0xa7b6ac){var _0x5e268d=new AWS[(_0x26b7('0x7'))]({'accessKeyId':_0x50dfb8,'secretAccessKey':_0xc25a24,'region':_0x2ba81e});_0x5e268d['detectSentiment']({'Text':_0x5d181d,'LanguageCode':_0x39daec[_0x26b7('0x8')](0x0,0x2)},function(_0x7f53db,_0x44691b){if(_0x7f53db){return _0xa7b6ac(_0x7f53db);}else{return _0x527ca2(_0x44691b);}});});}function checkTranscribeJob(_0x77fa3,_0x5dc52a,_0x2d1fd1){var _0x3def02;return new BPromise(function(_0x28cf6d,_0x3a8d9d){logger[_0x26b7('0x9')](util[_0x26b7('0xa')](_0x26b7('0xb'),_0x77fa3['id'],_0x77fa3[_0x26b7('0xc')]));return getTranscriptionJob(_0x2d1fd1[_0x26b7('0xd')],_0x2d1fd1[_0x26b7('0xe')],_0x5dc52a['transcribeRegion'],_0x77fa3[_0x26b7('0xc')])[_0x26b7('0xf')](function(_0x1ed5c0){logger[_0x26b7('0x9')](util['format'](_0x26b7('0x10'),_0x77fa3['id'],_0x77fa3[_0x26b7('0xc')],_0x1ed5c0[_0x26b7('0x11')][_0x26b7('0x12')]));if(!_0x77fa3[_0x26b7('0x13')]){switch(_0x1ed5c0['TranscriptionJob'][_0x26b7('0x12')]){case _0x26b7('0x14'):var _0x1cf4b8={'transcribeStatus':_0x1ed5c0['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x1ed5c0[_0x26b7('0x11')][_0x26b7('0x15')][_0x26b7('0x16')]};logger[_0x26b7('0x9')](util['format'](_0x26b7('0x17'),_0x77fa3['id']));return rp({'uri':_0x1ed5c0[_0x26b7('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0x515609){logger[_0x26b7('0x9')](util[_0x26b7('0xa')](_0x26b7('0x18'),_0x77fa3['id']));if(_0x515609&&_0x515609[_0x26b7('0x19')]&&_0x515609['results']['transcripts']&&_0x515609['results'][_0x26b7('0x1a')][_0x26b7('0x1b')]){_0x1cf4b8[_0x26b7('0x13')]='';for(var _0x2f751b=0x0;_0x2f751b<_0x515609[_0x26b7('0x19')][_0x26b7('0x1a')][_0x26b7('0x1b')];_0x2f751b++){_0x1cf4b8[_0x26b7('0x13')]+=_0x515609[_0x26b7('0x19')]['transcripts'][_0x2f751b]['transcript']+'';}}return _0x77fa3[_0x26b7('0x1c')](_0x1cf4b8);})['then'](function(){logger[_0x26b7('0x9')](util[_0x26b7('0xa')](_0x26b7('0x1d'),_0x77fa3['id']));if(!_0x77fa3[_0x26b7('0x1e')]){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))](_0x26b7('0x21'));}if(!_0x5dc52a[_0x26b7('0x22')]||!_0x5dc52a['sentimentAccountId']||!_0x5dc52a['sentimentRegion']||!_0x5dc52a[_0x26b7('0x23')]||!_0x5dc52a[_0x26b7('0x24')]){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))](_0x26b7('0x25'));}if(!_0x1cf4b8[_0x26b7('0x13')]){throw new Error(_0x26b7('0x26'));}if(_0x5dc52a[_0x26b7('0x27')]===_0x2d1fd1['id']){return _0x2d1fd1;}else{return db[_0x26b7('0x28')][_0x26b7('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x26b7('0xf')](function(_0x9822c6){if(!_0x9822c6){throw new db['Sequelize'][(_0x26b7('0x20'))](_0x26b7('0x2a'));}if(!_0x9822c6[_0x26b7('0xd')]||!_0x9822c6[_0x26b7('0xe')]){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x3def02=_0x9822c6;logger['info'](util[_0x26b7('0xa')](_0x26b7('0x2b'),_0x77fa3['id']));return sentiment(_0x3def02[_0x26b7('0xd')],_0x3def02['data2'],_0x5dc52a[_0x26b7('0x2c')],_0x1cf4b8[_0x26b7('0x13')],_0x5dc52a[_0x26b7('0x23')]);})[_0x26b7('0xf')](function(_0x3c530f){logger[_0x26b7('0x9')](util[_0x26b7('0xa')](_0x26b7('0x2d'),_0x77fa3['id']));return _0x77fa3[_0x26b7('0x1c')]({'sentiment':_0x3c530f[_0x26b7('0x2e')],'sPositive':_0x3c530f[_0x26b7('0x2f')]['Positive'],'sNegative':_0x3c530f['SentimentScore'][_0x26b7('0x30')],'sMixed':_0x3c530f['SentimentScore']['Mixed'],'sNeutral':_0x3c530f[_0x26b7('0x2f')][_0x26b7('0x31')]});})[_0x26b7('0xf')](function(){logger['info'](util[_0x26b7('0xa')](_0x26b7('0x1d'),_0x77fa3['id']));_0x28cf6d();});case'FAILED':return _0x77fa3['update']({'transcribeStatus':'FAILED','failureReason':_0x1ed5c0[_0x26b7('0x11')]['FailureReason']})[_0x26b7('0xf')](function(){logger[_0x26b7('0x9')](util[_0x26b7('0xa')](_0x26b7('0x1d'),_0x77fa3['id']));_0x28cf6d();});default:logger[_0x26b7('0x9')](util['format'](_0x26b7('0x32'),_0x77fa3['id']));break;}}else{return BPromise[_0x26b7('0x33')]()[_0x26b7('0xf')](function(){if(!_0x77fa3['tempSentiment']){throw new db['Sequelize'][(_0x26b7('0x20'))](_0x26b7('0x21'));}if(!_0x5dc52a['sentiment']||!_0x5dc52a[_0x26b7('0x27')]||!_0x5dc52a[_0x26b7('0x2c')]||!_0x5dc52a[_0x26b7('0x23')]||!_0x5dc52a[_0x26b7('0x24')]){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))](_0x26b7('0x25'));}if(!_0x77fa3[_0x26b7('0x13')]){throw new Error(_0x26b7('0x26'));}if(_0x5dc52a[_0x26b7('0x27')]===_0x2d1fd1['id']){return _0x2d1fd1;}else{return db[_0x26b7('0x28')][_0x26b7('0x29')]({'where':{'id':_settings[_0x26b7('0x27')]}});}})[_0x26b7('0xf')](function(_0x5153ad){if(!_0x5153ad){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))](_0x26b7('0x2a'));}if(!_0x5153ad[_0x26b7('0xd')]||!_0x5153ad[_0x26b7('0xe')]){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))](_0x26b7('0x34'));}_0x3def02=_0x5153ad;logger['info'](util[_0x26b7('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x77fa3['id']));return sentiment(_0x3def02['data1'],_0x3def02[_0x26b7('0xe')],_0x5dc52a[_0x26b7('0x2c')],_0x77fa3[_0x26b7('0x13')],_0x5dc52a[_0x26b7('0x23')]);})['then'](function(_0x1fd279){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x77fa3['id']));return _0x77fa3[_0x26b7('0x1c')]({'sentiment':_0x1fd279[_0x26b7('0x2e')],'sPositive':_0x1fd279[_0x26b7('0x2f')][_0x26b7('0x35')],'sNegative':_0x1fd279[_0x26b7('0x2f')][_0x26b7('0x30')],'sMixed':_0x1fd279[_0x26b7('0x2f')][_0x26b7('0x36')],'sNeutral':_0x1fd279[_0x26b7('0x2f')]['Neutral'],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x26b7('0x9')](util['format'](_0x26b7('0x1d'),_0x77fa3['id']));_0x28cf6d();});}})['catch'](function(_0x4c18c8){if(_0x4c18c8){if(!_0x4c18c8[_0x26b7('0x37')]||_0x4c18c8[_0x26b7('0x37')]!==_0x26b7('0x38')){logger[_0x26b7('0x39')](util[_0x26b7('0xa')](_0x26b7('0x3a'),_0x77fa3['id']),util[_0x26b7('0x3b')](_0x4c18c8,{'showHidden':![],'depth':null}));}}_0x28cf6d();});});}function checkTranscribe(){var _0x4f65ec;var _0x444eba;var _0x17747b;return db[_0x26b7('0x3c')][_0x26b7('0x3d')]({'where':{'transcribeStatus':_0x26b7('0x3e')}})['then'](function(_0x129a7b){if(!_0x129a7b||!_0x129a7b[_0x26b7('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x26b7('0x3f'));}_0x4f65ec=_0x129a7b;return db[_0x26b7('0x40')][_0x26b7('0x29')]({'where':{'id':0x1}});})[_0x26b7('0xf')](function(_0x1ae010){if(!_0x1ae010){throw new db[(_0x26b7('0x1f'))]['ValidationError']('Settings\x20not\x20available');}_0x444eba=_0x1ae010;if(!_0x444eba[_0x26b7('0x41')]||!_0x444eba[_0x26b7('0x42')]||!_0x444eba[_0x26b7('0x43')]||!_0x444eba[_0x26b7('0x23')]||!_0x444eba[_0x26b7('0x24')]){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))]('Transcribe\x20not\x20configured');}return db[_0x26b7('0x28')][_0x26b7('0x29')]({'where':{'id':_0x444eba[_0x26b7('0x42')]}});})[_0x26b7('0xf')](function(_0x5ba4fa){if(!_0x5ba4fa){throw new db[(_0x26b7('0x1f'))][(_0x26b7('0x20'))](_0x26b7('0x2a'));}if(!_0x5ba4fa[_0x26b7('0xd')]||!_0x5ba4fa[_0x26b7('0xe')]){throw new db['Sequelize'][(_0x26b7('0x20'))](_0x26b7('0x34'));}_0x17747b=_0x5ba4fa;var _0x2b7b0e=[];_0x4f65ec[_0x26b7('0x44')](function(_0x319a3f){_0x2b7b0e[_0x26b7('0x45')](checkTranscribeJob(_0x319a3f,_0x444eba,_0x17747b));});return BPromise[_0x26b7('0x46')](_0x2b7b0e);})[_0x26b7('0x47')](function(_0x47458a){if(_0x47458a){if(!_0x47458a[_0x26b7('0x37')]||_0x47458a[_0x26b7('0x37')]!==_0x26b7('0x38')){logger[_0x26b7('0x39')](util[_0x26b7('0x3b')](_0x47458a,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1120=['getTranscriptionJob','detectSentiment','substring','format','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','bucket','fileText','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','language','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','push','lodash','aws-sdk','request-promise','transcribe','TranscribeService'];(function(_0x57d85d,_0x46e3ac){var _0x39be34=function(_0x2a3d47){while(--_0x2a3d47){_0x57d85d['push'](_0x57d85d['shift']());}};_0x39be34(++_0x46e3ac);}(_0x1120,0x140));var _0x0112=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x1120[_0x1ca9e9];return _0x309f3c;};var _=require(_0x0112('0x0'));var AWS=require(_0x0112('0x1'));var rp=require(_0x0112('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x0112('0x3'));function getTranscriptionJob(_0x395145,_0x1d9e34,_0xa78633,_0x419307){return new Promise(function(_0x10fdca,_0x408230){var _0x40ad0d=new AWS[(_0x0112('0x4'))]({'accessKeyId':_0x1d9e34,'secretAccessKey':_0x395145,'region':_0xa78633});_0x40ad0d[_0x0112('0x5')]({'TranscriptionJobName':_0x419307},function(_0x2fd18c,_0x1e87af){if(_0x2fd18c){return _0x408230(_0x2fd18c);}else{return _0x10fdca(_0x1e87af);}});});}function sentiment(_0x4bf145,_0x126262,_0x26fd2e,_0x2f9a7d,_0x31d6c5){return new Promise(function(_0x1e74f2,_0x707684){var _0x2c0680=new AWS['Comprehend']({'accessKeyId':_0x126262,'secretAccessKey':_0x4bf145,'region':_0x26fd2e});_0x2c0680[_0x0112('0x6')]({'Text':_0x2f9a7d,'LanguageCode':_0x31d6c5[_0x0112('0x7')](0x0,0x2)},function(_0x5fee9c,_0x762578){if(_0x5fee9c){return _0x707684(_0x5fee9c);}else{return _0x1e74f2(_0x762578);}});});}function checkTranscribeJob(_0x58b431,_0x95d441,_0x394926){var _0xb58a0b;return new BPromise(function(_0x140750,_0x5a47d5){logger['info'](util[_0x0112('0x8')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x58b431['id'],_0x58b431[_0x0112('0x9')]));return getTranscriptionJob(_0x394926['data1'],_0x394926[_0x0112('0xa')],_0x95d441[_0x0112('0xb')],_0x58b431[_0x0112('0x9')])[_0x0112('0xc')](function(_0x54269a){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0xe'),_0x58b431['id'],_0x58b431['transcribeName'],_0x54269a['TranscriptionJob'][_0x0112('0xf')]));if(!_0x58b431['fileText']){switch(_0x54269a[_0x0112('0x10')]['TranscriptionJobStatus']){case _0x0112('0x11'):var _0x2b952d={'transcribeStatus':_0x54269a['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x54269a[_0x0112('0x10')][_0x0112('0x12')]['TranscriptFileUri']};logger[_0x0112('0xd')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x58b431['id']));return rp({'uri':_0x54269a['TranscriptionJob'][_0x0112('0x12')][_0x0112('0x13')],'json':!![]})[_0x0112('0xc')](function(_0x53f19c){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x14'),_0x58b431['id']));if(_0x53f19c&&_0x53f19c[_0x0112('0x15')]&&_0x53f19c['results'][_0x0112('0x16')]&&_0x53f19c[_0x0112('0x15')][_0x0112('0x16')][_0x0112('0x17')]){_0x2b952d['fileText']='';for(var _0x1e0f71=0x0;_0x1e0f71<_0x53f19c['results']['transcripts'][_0x0112('0x17')];_0x1e0f71++){_0x2b952d['fileText']+=_0x53f19c[_0x0112('0x15')]['transcripts'][_0x1e0f71][_0x0112('0x18')]+'';}}return _0x58b431[_0x0112('0x19')](_0x2b952d);})[_0x0112('0xc')](function(){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x1a'),_0x58b431['id']));if(!_0x58b431[_0x0112('0x1b')]){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x1e'));}if(!_0x95d441[_0x0112('0x1f')]||!_0x95d441['sentimentAccountId']||!_0x95d441[_0x0112('0x20')]||!_0x95d441['language']||!_0x95d441[_0x0112('0x21')]){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2b952d[_0x0112('0x22')]){throw new Error('Transcript\x20not\x20available');}if(_0x95d441[_0x0112('0x23')]===_0x394926['id']){return _0x394926;}else{return db[_0x0112('0x24')][_0x0112('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x4aa32b){if(!_0x4aa32b){throw new db[(_0x0112('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4aa32b['data1']||!_0x4aa32b['data2']){throw new db['Sequelize'][(_0x0112('0x1d'))](_0x0112('0x26'));}_0xb58a0b=_0x4aa32b;logger[_0x0112('0xd')](util['format'](_0x0112('0x27'),_0x58b431['id']));return sentiment(_0xb58a0b[_0x0112('0x28')],_0xb58a0b['data2'],_0x95d441[_0x0112('0x20')],_0x2b952d['fileText'],_0x95d441[_0x0112('0x29')]);})['then'](function(_0x17152b){logger[_0x0112('0xd')](util[_0x0112('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x58b431['id']));return _0x58b431['update']({'sentiment':_0x17152b['Sentiment'],'sPositive':_0x17152b['SentimentScore'][_0x0112('0x2a')],'sNegative':_0x17152b[_0x0112('0x2b')][_0x0112('0x2c')],'sMixed':_0x17152b[_0x0112('0x2b')][_0x0112('0x2d')],'sNeutral':_0x17152b[_0x0112('0x2b')][_0x0112('0x2e')]});})[_0x0112('0xc')](function(){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x1a'),_0x58b431['id']));_0x140750();});case _0x0112('0x2f'):return _0x58b431[_0x0112('0x19')]({'transcribeStatus':_0x0112('0x2f'),'failureReason':_0x54269a['TranscriptionJob']['FailureReason']})['then'](function(){logger['info'](util[_0x0112('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x58b431['id']));_0x140750();});default:logger[_0x0112('0xd')](util['format'](_0x0112('0x30'),_0x58b431['id']));break;}}else{return BPromise[_0x0112('0x31')]()[_0x0112('0xc')](function(){if(!_0x58b431[_0x0112('0x1b')]){throw new db['Sequelize'][(_0x0112('0x1d'))](_0x0112('0x1e'));}if(!_0x95d441[_0x0112('0x1f')]||!_0x95d441[_0x0112('0x23')]||!_0x95d441['sentimentRegion']||!_0x95d441['language']||!_0x95d441['bucket']){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x32'));}if(!_0x58b431[_0x0112('0x22')]){throw new Error('Transcript\x20not\x20available');}if(_0x95d441[_0x0112('0x23')]===_0x394926['id']){return _0x394926;}else{return db[_0x0112('0x24')][_0x0112('0x25')]({'where':{'id':_settings[_0x0112('0x23')]}});}})['then'](function(_0x117d4d){if(!_0x117d4d){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x117d4d[_0x0112('0x28')]||!_0x117d4d[_0x0112('0xa')]){throw new db[(_0x0112('0x1c'))]['ValidationError'](_0x0112('0x26'));}_0xb58a0b=_0x117d4d;logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x27'),_0x58b431['id']));return sentiment(_0xb58a0b[_0x0112('0x28')],_0xb58a0b[_0x0112('0xa')],_0x95d441['sentimentRegion'],_0x58b431[_0x0112('0x22')],_0x95d441['language']);})[_0x0112('0xc')](function(_0x8cb36c){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x33'),_0x58b431['id']));return _0x58b431['update']({'sentiment':_0x8cb36c['Sentiment'],'sPositive':_0x8cb36c['SentimentScore']['Positive'],'sNegative':_0x8cb36c[_0x0112('0x2b')][_0x0112('0x2c')],'sMixed':_0x8cb36c['SentimentScore'][_0x0112('0x2d')],'sNeutral':_0x8cb36c[_0x0112('0x2b')][_0x0112('0x2e')],'transcribeStatus':_0x0112('0x11')});})['then'](function(){logger[_0x0112('0xd')](util[_0x0112('0x8')](_0x0112('0x1a'),_0x58b431['id']));_0x140750();});}})[_0x0112('0x34')](function(_0x59f7e3){if(_0x59f7e3){if(!_0x59f7e3['name']||_0x59f7e3[_0x0112('0x35')]!==_0x0112('0x36')){logger[_0x0112('0x37')](util['format'](_0x0112('0x38'),_0x58b431['id']),util[_0x0112('0x39')](_0x59f7e3,{'showHidden':![],'depth':null}));}}_0x140750();});});}function checkTranscribe(){var _0x39a7e6;var _0x3e525c;var _0x4d7d63;return db[_0x0112('0x3a')][_0x0112('0x3b')]({'where':{'transcribeStatus':_0x0112('0x3c')}})['then'](function(_0x13cc93){if(!_0x13cc93||!_0x13cc93[_0x0112('0x17')]){throw new db['Sequelize'][(_0x0112('0x1d'))](_0x0112('0x3d'));}_0x39a7e6=_0x13cc93;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x288ae7){if(!_0x288ae7){throw new db['Sequelize'][(_0x0112('0x1d'))]('Settings\x20not\x20available');}_0x3e525c=_0x288ae7;if(!_0x3e525c['transcribe']||!_0x3e525c['transcribeAccountId']||!_0x3e525c[_0x0112('0xb')]||!_0x3e525c[_0x0112('0x29')]||!_0x3e525c['bucket']){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x3e'));}return db[_0x0112('0x24')][_0x0112('0x25')]({'where':{'id':_0x3e525c['transcribeAccountId']}});})['then'](function(_0x5c0a67){if(!_0x5c0a67){throw new db[(_0x0112('0x1c'))]['ValidationError'](_0x0112('0x3f'));}if(!_0x5c0a67[_0x0112('0x28')]||!_0x5c0a67[_0x0112('0xa')]){throw new db[(_0x0112('0x1c'))][(_0x0112('0x1d'))](_0x0112('0x26'));}_0x4d7d63=_0x5c0a67;var _0x4c730f=[];_0x39a7e6['forEach'](function(_0x1ceaf3){_0x4c730f[_0x0112('0x40')](checkTranscribeJob(_0x1ceaf3,_0x3e525c,_0x4d7d63));});return BPromise['all'](_0x4c730f);})[_0x0112('0x34')](function(_0x286f3a){if(_0x286f3a){if(!_0x286f3a[_0x0112('0x35')]||_0x286f3a['name']!==_0x0112('0x36')){logger[_0x0112('0x37')](util[_0x0112('0x39')](_0x286f3a,{'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 e87a6e4..3c29d8f 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 _0xe41d=['util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','subtract','hours','then','map','info','join','update','system','timeout','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x16a958,_0x5d0d42){var _0x57d9e7=function(_0x107651){while(--_0x107651){_0x16a958['push'](_0x16a958['shift']());}};_0x57d9e7(++_0x5d0d42);}(_0xe41d,0x13d));var _0xde41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe41d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xde41('0x0'));var moment=require(_0xde41('0x1'));var Redis=require('ioredis');var util=require(_0xde41('0x2'));var config=require('../../config/environment');var db=require(_0xde41('0x3'))['db'];var logger=require(_0xde41('0x4'))('schedule');config[_0xde41('0x5')]=_[_0xde41('0x6')](config[_0xde41('0x5')],{'host':_0xde41('0x7'),'port':0x18eb});var io=require(_0xde41('0x8'))(new Redis(config[_0xde41('0x5')]));function closeInteractions(){var _0x34c7b4=[];return db[_0xde41('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xde41('0xa')](0x18,_0xde41('0xb'))}}})[_0xde41('0xc')](function(_0x589c02){if(_0x589c02&&_0x589c02['length']){_0x34c7b4=_[_0xde41('0xd')](_0x589c02||[],'id');logger[_0xde41('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x34c7b4[_0xde41('0xf')]());return db[_0xde41('0x9')][_0xde41('0x10')]({'closeReason':_0xde41('0x11'),'disposition':_0xde41('0x12'),'closed':!![],'closedAt':moment()[_0xde41('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x34c7b4}});}})['then'](function(){if(_0x34c7b4&&_0x34c7b4[_0xde41('0x14')]){logger[_0xde41('0xe')](_0xde41('0x15'),_0x34c7b4[_0xde41('0xf')]());for(var _0x10aab2=0x0;_0x10aab2<_0x34c7b4[_0xde41('0x14')];_0x10aab2++){io[_0xde41('0x16')](_0xde41('0x17'),{'id':_0x34c7b4[_0x10aab2],'closed':!![]});}}})[_0xde41('0x18')](function(_0x5e1dfb){logger[_0xde41('0x19')](_0xde41('0x1a'),_0x5e1dfb?util[_0xde41('0x1b')](_0x5e1dfb,{'showHidden':![],'depth':null}):'');});}exports[_0xde41('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe32b=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment'];(function(_0x4c6095,_0x2c9c9f){var _0x322848=function(_0x5012e6){while(--_0x5012e6){_0x4c6095['push'](_0x4c6095['shift']());}};_0x322848(++_0x2c9c9f);}(_0xe32b,0x1e9));var _0xbe32=function(_0x340dca,_0x2140bd){_0x340dca=_0x340dca-0x0;var _0x1e5d2f=_0xe32b[_0x340dca];return _0x1e5d2f;};'use strict';var _=require(_0xbe32('0x0'));var moment=require(_0xbe32('0x1'));var Redis=require(_0xbe32('0x2'));var util=require(_0xbe32('0x3'));var config=require(_0xbe32('0x4'));var db=require(_0xbe32('0x5'))['db'];var logger=require(_0xbe32('0x6'))(_0xbe32('0x7'));config[_0xbe32('0x8')]=_[_0xbe32('0x9')](config[_0xbe32('0x8')],{'host':_0xbe32('0xa'),'port':0x18eb});var io=require(_0xbe32('0xb'))(new Redis(config[_0xbe32('0x8')]));function closeInteractions(){var _0xf1bdcb=[];return db[_0xbe32('0xc')][_0xbe32('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x23323c){if(_0x23323c&&_0x23323c['length']){_0xf1bdcb=_[_0xbe32('0xe')](_0x23323c||[],'id');logger[_0xbe32('0xf')](_0xbe32('0x10'),_0xf1bdcb[_0xbe32('0x11')]());return db[_0xbe32('0xc')][_0xbe32('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xbe32('0x13')](_0xbe32('0x14'))},{'where':{'id':_0xf1bdcb}});}})['then'](function(){if(_0xf1bdcb&&_0xf1bdcb[_0xbe32('0x15')]){logger[_0xbe32('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xf1bdcb[_0xbe32('0x11')]());for(var _0x52eb7b=0x0;_0x52eb7b<_0xf1bdcb[_0xbe32('0x15')];_0x52eb7b++){io[_0xbe32('0x16')](_0xbe32('0x17'),{'id':_0xf1bdcb[_0x52eb7b],'closed':!![]});}}})[_0xbe32('0x18')](function(_0x5bf06f){logger['error'](_0xbe32('0x19'),_0x5bf06f?util['inspect'](_0x5bf06f,{'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 e842024..c30855e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddd0=['innocenzo.biondo','push','now','Biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xddd0,0x129));var _0x0ddd=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xddd0[_0x102ff9];return _0x24fa97;};'use strict';var util=require(_0x0ddd('0x0'));var db=require(_0x0ddd('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0ddd('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x0ddd('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0ddd('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0ddd('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0ddd('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0ddd('0x4')]({'id':i,'firstName':_0x0ddd('0x2')+i,'lastName':_0x0ddd('0x6')+i,'phone':0xf879fb460+i,'email':_0x0ddd('0x3')+i+_0x0ddd('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0ddd('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0ddd('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0ddd('0x5')](),'updatedAt':Date[_0x0ddd('0x5')]()});}db[_0x0ddd('0x8')][_0x0ddd('0x9')]({'where':{}})[_0x0ddd('0xa')](function(){return db[_0x0ddd('0x8')][_0x0ddd('0xb')](contacts);})[_0x0ddd('0xa')](function(){console[_0x0ddd('0xc')](_0x0ddd('0xd'),_0x0ddd('0xe'));return db[_0x0ddd('0xf')][_0x0ddd('0x9')]({'where':{}});})['then'](function(){return db[_0x0ddd('0xf')][_0x0ddd('0xb')](hopper);})[_0x0ddd('0xa')](function(){console[_0x0ddd('0xc')](_0x0ddd('0xd'),_0x0ddd('0x10'));return db[_0x0ddd('0x8')][_0x0ddd('0xb')](contacts2);})['then'](function(){console['log'](_0x0ddd('0xd'),_0x0ddd('0x11'));return db[_0x0ddd('0xf')][_0x0ddd('0xb')](hopper2);})[_0x0ddd('0xa')](function(){console[_0x0ddd('0xc')]('finished\x20populating',_0x0ddd('0x12'));})[_0x0ddd('0x13')](function(_0x5bdfd6){console[_0x0ddd('0xc')](_0x5bdfd6);}); \ No newline at end of file +var _0xd003=['destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','CmContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd003,0x108));var _0x3d00=function(_0x5dc8c7,_0x5c0a8f){_0x5dc8c7=_0x5dc8c7-0x0;var _0x1e64ef=_0xd003[_0x5dc8c7];return _0x1e64ef;};'use strict';var util=require(_0x3d00('0x0'));var db=require(_0x3d00('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3d00('0x2')]({'id':i,'firstName':_0x3d00('0x3')+i,'lastName':_0x3d00('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3d00('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3d00('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x3d00('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3d00('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3d00('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3d00('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3d00('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x3d00('0x6')]()});}db[_0x3d00('0x7')][_0x3d00('0x8')]({'where':{}})[_0x3d00('0x9')](function(){return db[_0x3d00('0x7')][_0x3d00('0xa')](contacts);})[_0x3d00('0x9')](function(){console[_0x3d00('0xb')](_0x3d00('0xc'),_0x3d00('0xd'));return db[_0x3d00('0xe')]['destroy']({'where':{}});})[_0x3d00('0x9')](function(){return db['CmHopper'][_0x3d00('0xa')](hopper);})[_0x3d00('0x9')](function(){console['log'](_0x3d00('0xc'),_0x3d00('0xf'));return db[_0x3d00('0x7')][_0x3d00('0xa')](contacts2);})[_0x3d00('0x9')](function(){console['log'](_0x3d00('0xc'),_0x3d00('0x10'));return db[_0x3d00('0xe')][_0x3d00('0xa')](hopper2);})['then'](function(){console[_0x3d00('0xb')](_0x3d00('0xc'),'hopper2');})['catch'](function(_0x4a71a9){console[_0x3d00('0xb')](_0x4a71a9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a823ff7..901c10a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc101=['\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','wss','all','yes','/etc/pki/tls/private/motion.key','actpass'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xc101,0x1f2));var _0x1c10=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0xc101[_0x3b0c9d];return _0xcfc8d7;};'use strict';var util=require(_0x1c10('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1c10('0x1')]({'name':util[_0x1c10('0x2')](_0x1c10('0x3'),_0x1c10('0x4'),i),'fullname':util[_0x1c10('0x2')](_0x1c10('0x3'),_0x1c10('0x4'),i),'email':util[_0x1c10('0x2')](_0x1c10('0x5'),_0x1c10('0x4'),i),'role':_0x1c10('0x4'),'password':_0x1c10('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x1c10('0x7')],'disallow':[_0x1c10('0x8')],'allow':['ulaw'],'defaultuser':util['format'](_0x1c10('0x3'),'agent',i),'encryption':'yes','avpf':_0x1c10('0x9'),'force_avp':'yes','icesupport':_0x1c10('0x9'),'dtlsenable':_0x1c10('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x1c10('0xa'),'dtlssetup':_0x1c10('0xb'),'callerid':util[_0x1c10('0x2')](_0x1c10('0xc'),util['format'](_0x1c10('0x3'),_0x1c10('0x4'),i),0xfa0+i)});}db['User'][_0x1c10('0xd')](users)['then'](function(){console[_0x1c10('0xe')](_0x1c10('0xf'));})[_0x1c10('0x10')](function(_0x1d7970){console[_0x1c10('0xe')](_0x1d7970);}); \ No newline at end of file +var _0x3cc4=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','%s%s','format','agent','%s%s@xcally.com','udp','wss'];(function(_0xcb56d2,_0x18c194){var _0x57bed4=function(_0x194ed8){while(--_0x194ed8){_0xcb56d2['push'](_0xcb56d2['shift']());}};_0x57bed4(++_0x18c194);}(_0x3cc4,0x75));var _0x43cc=function(_0x407c0c,_0x36f968){_0x407c0c=_0x407c0c-0x0;var _0x5beb35=_0x3cc4[_0x407c0c];return _0x5beb35;};'use strict';var util=require(_0x43cc('0x0'));var db=require(_0x43cc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x43cc('0x2')]({'name':util['format'](_0x43cc('0x3'),'agent',i),'fullname':util[_0x43cc('0x4')]('%s%s',_0x43cc('0x5'),i),'email':util['format'](_0x43cc('0x6'),_0x43cc('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x43cc('0x7'),'ws',_0x43cc('0x8')],'disallow':[_0x43cc('0x9')],'allow':[_0x43cc('0xa')],'defaultuser':util[_0x43cc('0x4')](_0x43cc('0x3'),_0x43cc('0x5'),i),'encryption':_0x43cc('0xb'),'avpf':_0x43cc('0xb'),'force_avp':'yes','icesupport':_0x43cc('0xb'),'dtlsenable':_0x43cc('0xb'),'dtlsverify':'no','dtlscertfile':_0x43cc('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x43cc('0xd'),'callerid':util[_0x43cc('0x4')](_0x43cc('0xe'),util[_0x43cc('0x4')](_0x43cc('0x3'),_0x43cc('0x5'),i),0xfa0+i)});}db[_0x43cc('0xf')][_0x43cc('0x10')](users)[_0x43cc('0x11')](function(){console['log'](_0x43cc('0x12'));})[_0x43cc('0x13')](function(_0x5d64c7){console[_0x43cc('0x14')](_0x5d64c7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c787401..c92798e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd448=['../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','FaxQueue','getVoiceQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','sms','mail','openchannel','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird'];(function(_0x8627b0,_0x30dbf7){var _0x1bffbb=function(_0x1e6160){while(--_0x1e6160){_0x8627b0['push'](_0x8627b0['shift']());}};_0x1bffbb(++_0x30dbf7);}(_0xd448,0x172));var _0x8d44=function(_0x334c50,_0x1f11d0){_0x334c50=_0x334c50-0x0;var _0x524766=_0xd448[_0x334c50];return _0x524766;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var BPromise=require(_0x8d44('0x1'));var db=require(_0x8d44('0x2'))['db'];var config=require(_0x8d44('0x3'));var queryQueues={'attributes':['id',_0x8d44('0x4')],'include':[{'as':_0x8d44('0x5'),'model':db[_0x8d44('0x6')],'attributes':['id',_0x8d44('0x4'),_0x8d44('0x7')],'raw':!![],'where':{'role':_0x8d44('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8d44('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8d44('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8d44('0x4'),_0x8d44('0xa')],'where':{'type':_0x8d44('0xb')}};function getAssociatedResources(_0x51e368,_0x320046,_0x2a5da6){return db['UserProfileSection']['findOne']({'where':{'name':_0x51e368,'userProfileId':_0x320046},'raw':!![]})[_0x8d44('0xc')](function(_0x362ed8){if(_0x362ed8){if(_0x362ed8[_0x8d44('0xd')]){switch(_0x51e368){case'VoiceQueues':case _0x8d44('0xe'):case _0x8d44('0xf'):case _0x8d44('0x10'):case _0x8d44('0x11'):case'OpenchannelQueues':case _0x8d44('0x12'):return db[_0x2a5da6][_0x8d44('0x13')](queryQueues);case _0x8d44('0x14'):return db[_0x2a5da6][_0x8d44('0x13')](queryTelephones);case _0x8d44('0x15'):return db[_0x2a5da6]['findAll'](queryTrunks);case _0x8d44('0x16'):return db[_0x2a5da6][_0x8d44('0x13')](queryCampaigns);}}else{return db[_0x8d44('0x17')][_0x8d44('0x13')]({'attributes':[_0x8d44('0x18')],'where':{'sectionId':_0x362ed8['id']},'raw':!![]})['then'](function(_0x407d70){if(_0x407d70){var _0x54aa00={'where':{'id':_[_0x8d44('0x19')](_0x407d70,_0x8d44('0x18'))},'raw':!![]};switch(_0x2a5da6){case _0x8d44('0x6'):_0x54aa00[_0x8d44('0x1a')][_0x8d44('0x7')]=_0x8d44('0x9');break;case _0x8d44('0x1b'):_0x54aa00[_0x8d44('0x1a')]['type']=_0x8d44('0xb');break;}return db[_0x2a5da6][_0x8d44('0x13')](_0x54aa00);}else{return[];}});}}else{return[];}})['then'](function(_0x4499f6){return _0x4499f6;});}function joinOrLeaveQueues(_0x12c37a,_0x3a9a17,_0x482455,_0x5f6fcb){_0x12c37a[_0x3a9a17](util[_0x8d44('0x1c')](_0x8d44('0x1d'),_0x482455,_0x5f6fcb[_0x8d44('0x4')]));if(_0x5f6fcb['Agents']){for(var _0x31f991=0x0;_0x31f991<_0x5f6fcb[_0x8d44('0x5')][_0x8d44('0x1e')];_0x31f991+=0x1){_0x12c37a[_0x3a9a17](util['format'](_0x8d44('0x1f'),_0x5f6fcb[_0x8d44('0x5')][_0x31f991][_0x8d44('0x4')]));}}}function joinOrLeave(_0x119998,_0x1f78c4,_0x4b5eb8){var _0x45251a;if(_0x119998[_0x8d44('0x20')][_0x8d44('0x21')]['id']){db['User']['find']({'attributes':['id',_0x8d44('0x4'),_0x8d44('0x7'),_0x8d44('0x22')],'where':{'id':_0x119998[_0x8d44('0x20')][_0x8d44('0x21')]['id']},'include':[{'model':db[_0x8d44('0x23')],'as':_0x8d44('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8d44('0x25')],'as':_0x8d44('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8d44('0x27')],'as':_0x8d44('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x8d44('0x29')],'as':_0x8d44('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8d44('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x8d44('0xc')](function(_0x5eb0c5){if(_0x5eb0c5){_0x45251a=_0x5eb0c5;_0x119998[_0x1f78c4](util['format'](_0x8d44('0x1f'),_0x5eb0c5[_0x8d44('0x4')]));var _0x2b4391=[];switch(_0x5eb0c5[_0x8d44('0x7')]){case _0x8d44('0x2c'):_0x119998[_0x1f78c4](_0x8d44('0x2d'));_0x119998[_0x1f78c4](_0x8d44('0x2e'));if(queryQueues['hasOwnProperty'](_0x8d44('0x2f'))){delete queryQueues['include'];}_0x2b4391['push'](db['VoiceQueue']['findAll'](queryQueues));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x31')][_0x8d44('0x13')](queryQueues));_0x2b4391[_0x8d44('0x30')](db['FaxQueue'][_0x8d44('0x13')](queryQueues));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x32')][_0x8d44('0x13')](queryQueues));_0x2b4391['push'](db[_0x8d44('0x33')][_0x8d44('0x13')](queryQueues));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x34')][_0x8d44('0x13')](queryQueues));_0x2b4391[_0x8d44('0x30')](db['WhatsappQueue'][_0x8d44('0x13')](queryQueues));_0x2b4391['push'](db[_0x8d44('0x6')][_0x8d44('0x13')](queryTelephones));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x35')][_0x8d44('0x13')](queryTrunks));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x1b')][_0x8d44('0x13')](queryCampaigns));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x6')][_0x8d44('0x13')](queryAgents));break;case _0x8d44('0x36'):_0x119998[_0x1f78c4](_0x8d44('0x2d'));_0x119998[_0x1f78c4](_0x8d44('0x2e'));_0x2b4391['push'](getAssociatedResources('VoiceQueues',_0x5eb0c5[_0x8d44('0x22')],'VoiceQueue'));_0x2b4391[_0x8d44('0x30')](getAssociatedResources(_0x8d44('0xe'),_0x5eb0c5[_0x8d44('0x22')],_0x8d44('0x31')));_0x2b4391[_0x8d44('0x30')](getAssociatedResources(_0x8d44('0xf'),_0x5eb0c5[_0x8d44('0x22')],_0x8d44('0x37')));_0x2b4391[_0x8d44('0x30')](getAssociatedResources(_0x8d44('0x10'),_0x5eb0c5['userProfileId'],_0x8d44('0x32')));_0x2b4391[_0x8d44('0x30')](getAssociatedResources('MailQueues',_0x5eb0c5['userProfileId'],_0x8d44('0x33')));_0x2b4391[_0x8d44('0x30')](getAssociatedResources('OpenchannelQueues',_0x5eb0c5[_0x8d44('0x22')],_0x8d44('0x34')));_0x2b4391[_0x8d44('0x30')](getAssociatedResources(_0x8d44('0x12'),_0x5eb0c5['userProfileId'],'WhatsappQueue'));_0x2b4391['push'](getAssociatedResources(_0x8d44('0x14'),_0x5eb0c5['userProfileId'],_0x8d44('0x6')));_0x2b4391['push'](getAssociatedResources(_0x8d44('0x15'),_0x5eb0c5[_0x8d44('0x22')],_0x8d44('0x35')));_0x2b4391[_0x8d44('0x30')](getAssociatedResources(_0x8d44('0x16'),_0x5eb0c5[_0x8d44('0x22')],'Campaign'));_0x2b4391[_0x8d44('0x30')](db[_0x8d44('0x6')][_0x8d44('0x13')](queryAgents));break;case _0x8d44('0x8'):_0x119998[_0x1f78c4](_0x8d44('0x2d'));_0x119998[_0x1f78c4](_0x8d44('0x2e'));_0x2b4391[_0x8d44('0x30')](_0x5eb0c5[_0x8d44('0x38')]({'attributes':['id',_0x8d44('0x4')]}));_0x2b4391[_0x8d44('0x30')](_0x5eb0c5['getChatQueues']({'attributes':['id',_0x8d44('0x4')]}));_0x2b4391[_0x8d44('0x30')](_0x5eb0c5['getFaxQueues']({'attributes':['id','name']}));_0x2b4391[_0x8d44('0x30')](_0x5eb0c5[_0x8d44('0x39')]({'attributes':['id',_0x8d44('0x4')]}));_0x2b4391[_0x8d44('0x30')](_0x5eb0c5['getMailQueues']({'attributes':['id',_0x8d44('0x4')]}));_0x2b4391['push'](_0x5eb0c5[_0x8d44('0x3a')]({'attributes':['id',_0x8d44('0x4')]}));_0x2b4391[_0x8d44('0x30')](_0x5eb0c5[_0x8d44('0x3b')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x2b4391);}})[_0x8d44('0xc')](function(_0x28dac1){if(_0x28dac1&&_0x28dac1[_0x8d44('0x1e')]){for(var _0x45a83d=0x0;_0x45a83d<_0x28dac1[_0x8d44('0x1e')];_0x45a83d+=0x1){for(var _0x181044=0x0;_0x181044<_0x28dac1[_0x45a83d][_0x8d44('0x1e')];_0x181044+=0x1){switch(_0x45a83d){case 0x0:joinOrLeaveQueues(_0x119998,_0x1f78c4,_0x8d44('0x3c'),_0x28dac1[_0x45a83d][_0x181044]);break;case 0x1:joinOrLeaveQueues(_0x119998,_0x1f78c4,'chat',_0x28dac1[_0x45a83d][_0x181044]);break;case 0x2:joinOrLeaveQueues(_0x119998,_0x1f78c4,'fax',_0x28dac1[_0x45a83d][_0x181044]);break;case 0x3:joinOrLeaveQueues(_0x119998,_0x1f78c4,_0x8d44('0x3d'),_0x28dac1[_0x45a83d][_0x181044]);break;case 0x4:joinOrLeaveQueues(_0x119998,_0x1f78c4,_0x8d44('0x3e'),_0x28dac1[_0x45a83d][_0x181044]);break;case 0x5:joinOrLeaveQueues(_0x119998,_0x1f78c4,_0x8d44('0x3f'),_0x28dac1[_0x45a83d][_0x181044]);break;case 0x6:joinOrLeaveQueues(_0x119998,_0x1f78c4,'whatsapp',_0x28dac1[_0x45a83d][_0x181044]);break;case 0x7:if(_0x45251a[_0x8d44('0x7')]!==_0x8d44('0x8'))_0x119998[_0x1f78c4](util[_0x8d44('0x1c')](_0x8d44('0x40'),_0x28dac1[_0x45a83d][_0x181044][_0x8d44('0x4')]));break;case 0x8:if(_0x45251a[_0x8d44('0x7')]!=='agent')_0x119998[_0x1f78c4](util['format'](_0x8d44('0x41'),_0x28dac1[_0x45a83d][_0x181044][_0x8d44('0x4')]));break;case 0x9:if(_0x45251a['role']!==_0x8d44('0x8'))_0x119998[_0x1f78c4](util[_0x8d44('0x1c')]('campaign:%s:%s',_0x28dac1[_0x45a83d][_0x181044][_0x8d44('0xa')],_0x28dac1[_0x45a83d][_0x181044]['name']));break;case 0xa:_0x119998[_0x1f78c4](util[_0x8d44('0x1c')](_0x8d44('0x1f'),_0x28dac1[_0x45a83d][_0x181044][_0x8d44('0x4')]));break;}}}}})[_0x8d44('0xc')](function(){if(_0x1f78c4==='leave'){var _0x2031b3=_[_0x8d44('0x19')](_0x45251a[_0x8d44('0x24')],'id');return _0x45251a[_0x8d44('0x42')](_0x2031b3)[_0x8d44('0xc')](function(){for(var _0xac206b=0x0;_0xac206b<_0x2031b3[_0x8d44('0x1e')];_0xac206b+=0x1){_0x4b5eb8[_0x8d44('0x43')](_0x8d44('0x44'),{'ChatInteractionId':Number(_0x2031b3[_0xac206b]),'UserId':Number(_0x45251a['id'])});}});}})[_0x8d44('0xc')](function(){if(_0x1f78c4===_0x8d44('0x45')){var _0xb860f7=_[_0x8d44('0x19')](_0x45251a[_0x8d44('0x46')],'id');return _0x45251a['removeMailInteractions'](_0xb860f7)['then'](function(){for(var _0x1a031f=0x0;_0x1a031f<_0xb860f7[_0x8d44('0x1e')];_0x1a031f+=0x1){_0x4b5eb8[_0x8d44('0x43')](_0x8d44('0x47'),{'MailInteractionId':Number(_0xb860f7[_0x1a031f]),'UserId':Number(_0x45251a['id'])});}});}})[_0x8d44('0xc')](function(){if(_0x1f78c4===_0x8d44('0x45')){var _0x5aed5=_[_0x8d44('0x19')](_0x45251a[_0x8d44('0x26')],'id');return _0x45251a[_0x8d44('0x48')](_0x5aed5)['then'](function(){for(var _0x3e4ff0=0x0;_0x3e4ff0<_0x5aed5[_0x8d44('0x1e')];_0x3e4ff0+=0x1){_0x4b5eb8[_0x8d44('0x43')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5aed5[_0x3e4ff0]),'UserId':Number(_0x45251a['id'])});}});}})[_0x8d44('0xc')](function(){if(_0x1f78c4===_0x8d44('0x45')){var _0x4a7cb3=_['map'](_0x45251a[_0x8d44('0x28')],'id');return _0x45251a[_0x8d44('0x49')](_0x4a7cb3)['then'](function(){for(var _0x647962=0x0;_0x647962<_0x4a7cb3[_0x8d44('0x1e')];_0x647962+=0x1){_0x4b5eb8[_0x8d44('0x43')](_0x8d44('0x4a'),{'SmsInteractionId':Number(_0x4a7cb3[_0x647962]),'UserId':Number(_0x45251a['id'])});}});}})[_0x8d44('0xc')](function(){if(_0x1f78c4===_0x8d44('0x45')){var _0x2774fc=_['map'](_0x45251a[_0x8d44('0x2a')],'id');return _0x45251a[_0x8d44('0x4b')](_0x2774fc)['then'](function(){for(var _0x2588d8=0x0;_0x2588d8<_0x2774fc['length'];_0x2588d8+=0x1){_0x4b5eb8[_0x8d44('0x43')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2774fc[_0x2588d8]),'UserId':Number(_0x45251a['id'])});}});}})[_0x8d44('0xc')](function(){if(_0x1f78c4===_0x8d44('0x45')){var _0x4449e8=_[_0x8d44('0x19')](_0x45251a[_0x8d44('0x4c')],'id');return _0x45251a[_0x8d44('0x4d')](_0x4449e8)[_0x8d44('0xc')](function(){for(var _0x41bf55=0x0;_0x41bf55<_0x4449e8[_0x8d44('0x1e')];_0x41bf55+=0x1){_0x4b5eb8[_0x8d44('0x43')](_0x8d44('0x4e'),{'WhatsappInteractionId':Number(_0x4449e8[_0x41bf55]),'UserId':Number(_0x45251a['id'])});}});}})[_0x8d44('0x4f')](function(_0x34e4b2){_0x119998[_0x8d44('0x50')](_0x34e4b2);});}}function onDisconnect(_0x36e583,_0x32f879){joinOrLeave(_0x36e583,_0x8d44('0x45'),_0x32f879);}function onConnect(_0x5093f0){joinOrLeave(_0x5093f0,_0x8d44('0x51'));}exports[_0x8d44('0x52')]=function(_0x593eb3){_0x593eb3['on'](_0x8d44('0x53'),function(_0x1b26be){_0x1b26be['setMaxListeners'](0x0);_0x1b26be[_0x8d44('0x54')]=_0x1b26be[_0x8d44('0x55')][_0x8d44('0x53')][_0x8d44('0x56')]+':'+_0x1b26be[_0x8d44('0x55')]['connection']['remotePort'];_0x1b26be[_0x8d44('0x57')]=new Date();_0x1b26be[_0x8d44('0x50')]=function(_0x81fc0b){console[_0x8d44('0x50')](_0x8d44('0x58')+_0x1b26be[_0x8d44('0x59')][_0x8d44('0x4')]+'['+_0x1b26be[_0x8d44('0x54')]+']',_0x81fc0b);};_0x1b26be['on'](_0x8d44('0x5a'),function(){onDisconnect(_0x1b26be,_0x593eb3);_0x1b26be[_0x8d44('0x50')](_0x8d44('0x5b'));});onConnect(_0x1b26be);_0x1b26be[_0x8d44('0x50')](_0x8d44('0x5c'));});}; \ No newline at end of file +var _0x3c04=['role','agent','type','UserProfileSection','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','ivr','then','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Campaign','user','voice:inbound','userProfileId','SmsQueues','SmsQueue','OpenchannelQueue','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','Agents','User'];(function(_0x398480,_0x5b5e3a){var _0x965f42=function(_0x3019c7){while(--_0x3019c7){_0x398480['push'](_0x398480['shift']());}};_0x965f42(++_0x5b5e3a);}(_0x3c04,0x192));var _0x43c0=function(_0x412085,_0x435fe6){_0x412085=_0x412085-0x0;var _0x51e670=_0x3c04[_0x412085];return _0x51e670;};'use strict';var _=require('lodash');var util=require(_0x43c0('0x0'));var BPromise=require('bluebird');var db=require(_0x43c0('0x1'))['db'];var config=require(_0x43c0('0x2'));var queryQueues={'attributes':['id',_0x43c0('0x3')],'include':[{'as':_0x43c0('0x4'),'model':db[_0x43c0('0x5')],'attributes':['id',_0x43c0('0x3'),_0x43c0('0x6')],'raw':!![],'where':{'role':_0x43c0('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x43c0('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x43c0('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x43c0('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x43c0('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x100fb8,_0x3efc14,_0x1b54f2){return db[_0x43c0('0x9')]['findOne']({'where':{'name':_0x100fb8,'userProfileId':_0x3efc14},'raw':!![]})['then'](function(_0x2c4153){if(_0x2c4153){if(_0x2c4153['autoAssociation']){switch(_0x100fb8){case _0x43c0('0xa'):case _0x43c0('0xb'):case _0x43c0('0xc'):case'SmsQueues':case _0x43c0('0xd'):case _0x43c0('0xe'):case _0x43c0('0xf'):return db[_0x1b54f2][_0x43c0('0x10')](queryQueues);case _0x43c0('0x11'):return db[_0x1b54f2]['findAll'](queryTelephones);case _0x43c0('0x12'):return db[_0x1b54f2][_0x43c0('0x10')](queryTrunks);case _0x43c0('0x13'):return db[_0x1b54f2][_0x43c0('0x10')](queryCampaigns);}}else{return db[_0x43c0('0x14')]['findAll']({'attributes':[_0x43c0('0x15')],'where':{'sectionId':_0x2c4153['id']},'raw':!![]})['then'](function(_0x1e35d0){if(_0x1e35d0){var _0x47aade={'where':{'id':_[_0x43c0('0x16')](_0x1e35d0,_0x43c0('0x15'))},'raw':!![]};switch(_0x1b54f2){case _0x43c0('0x5'):_0x47aade[_0x43c0('0x17')][_0x43c0('0x6')]='telephone';break;case'Campaign':_0x47aade['where'][_0x43c0('0x8')]=_0x43c0('0x18');break;}return db[_0x1b54f2][_0x43c0('0x10')](_0x47aade);}else{return[];}});}}else{return[];}})[_0x43c0('0x19')](function(_0x333f60){return _0x333f60;});}function joinOrLeaveQueues(_0x31aa65,_0x5c3c68,_0xe1e717,_0x2aed3d){_0x31aa65[_0x5c3c68](util[_0x43c0('0x1a')](_0x43c0('0x1b'),_0xe1e717,_0x2aed3d[_0x43c0('0x3')]));if(_0x2aed3d[_0x43c0('0x4')]){for(var _0x3d5aad=0x0;_0x3d5aad<_0x2aed3d[_0x43c0('0x4')][_0x43c0('0x1c')];_0x3d5aad+=0x1){_0x31aa65[_0x5c3c68](util[_0x43c0('0x1a')](_0x43c0('0x1d'),_0x2aed3d[_0x43c0('0x4')][_0x3d5aad][_0x43c0('0x3')]));}}}function joinOrLeave(_0x115395,_0x4a3723,_0xf3ff3e){var _0x4aab88;if(_0x115395[_0x43c0('0x1e')][_0x43c0('0x1f')]['id']){db[_0x43c0('0x5')][_0x43c0('0x20')]({'attributes':['id','name',_0x43c0('0x6'),'userProfileId'],'where':{'id':_0x115395[_0x43c0('0x1e')][_0x43c0('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x43c0('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x22')],'as':_0x43c0('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x24')],'as':_0x43c0('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x26')],'as':_0x43c0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x43c0('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x43c0('0x19')](function(_0x34530e){if(_0x34530e){_0x4aab88=_0x34530e;_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x1d'),_0x34530e[_0x43c0('0x3')]));var _0x7dfd38=[];switch(_0x34530e['role']){case _0x43c0('0x2a'):_0x115395[_0x4a3723]('voice:inbound');_0x115395[_0x4a3723](_0x43c0('0x2b'));if(queryQueues[_0x43c0('0x2c')](_0x43c0('0x2d'))){delete queryQueues['include'];}_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x2f')]['findAll'](queryQueues));_0x7dfd38['push'](db[_0x43c0('0x30')][_0x43c0('0x10')](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x31')][_0x43c0('0x10')](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db['SmsQueue'][_0x43c0('0x10')](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x32')][_0x43c0('0x10')](queryQueues));_0x7dfd38['push'](db['OpenchannelQueue'][_0x43c0('0x10')](queryQueues));_0x7dfd38['push'](db[_0x43c0('0x33')]['findAll'](queryQueues));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x5')][_0x43c0('0x10')](queryTelephones));_0x7dfd38['push'](db['Trunk'][_0x43c0('0x10')](queryTrunks));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x34')][_0x43c0('0x10')](queryCampaigns));_0x7dfd38['push'](db[_0x43c0('0x5')][_0x43c0('0x10')](queryAgents));break;case _0x43c0('0x35'):_0x115395[_0x4a3723](_0x43c0('0x36'));_0x115395[_0x4a3723](_0x43c0('0x2b'));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0xa'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x2f')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0xb'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x30')));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0xc'),_0x34530e['userProfileId'],_0x43c0('0x31')));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0x38'),_0x34530e['userProfileId'],_0x43c0('0x39')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0xd'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x32')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0xe'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x3a')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources('WhatsappQueues',_0x34530e['userProfileId'],_0x43c0('0x33')));_0x7dfd38['push'](getAssociatedResources('Telephones',_0x34530e[_0x43c0('0x37')],_0x43c0('0x5')));_0x7dfd38['push'](getAssociatedResources(_0x43c0('0x12'),_0x34530e['userProfileId'],_0x43c0('0x3b')));_0x7dfd38[_0x43c0('0x2e')](getAssociatedResources(_0x43c0('0x13'),_0x34530e[_0x43c0('0x37')],_0x43c0('0x34')));_0x7dfd38[_0x43c0('0x2e')](db[_0x43c0('0x5')][_0x43c0('0x10')](queryAgents));break;case _0x43c0('0x7'):_0x115395[_0x4a3723](_0x43c0('0x36'));_0x115395[_0x4a3723](_0x43c0('0x2b'));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x3c')]({'attributes':['id','name']}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x3d')]({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e['getFaxQueues']({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38['push'](_0x34530e[_0x43c0('0x3e')]({'attributes':['id','name']}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x3f')]({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38['push'](_0x34530e[_0x43c0('0x40')]({'attributes':['id',_0x43c0('0x3')]}));_0x7dfd38[_0x43c0('0x2e')](_0x34530e[_0x43c0('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x43c0('0x42')](_0x7dfd38);}})[_0x43c0('0x19')](function(_0xea2cc2){if(_0xea2cc2&&_0xea2cc2['length']){for(var _0x195961=0x0;_0x195961<_0xea2cc2[_0x43c0('0x1c')];_0x195961+=0x1){for(var _0x496f84=0x0;_0x496f84<_0xea2cc2[_0x195961][_0x43c0('0x1c')];_0x496f84+=0x1){switch(_0x195961){case 0x0:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x43'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x1:joinOrLeaveQueues(_0x115395,_0x4a3723,'chat',_0xea2cc2[_0x195961][_0x496f84]);break;case 0x2:joinOrLeaveQueues(_0x115395,_0x4a3723,'fax',_0xea2cc2[_0x195961][_0x496f84]);break;case 0x3:joinOrLeaveQueues(_0x115395,_0x4a3723,'sms',_0xea2cc2[_0x195961][_0x496f84]);break;case 0x4:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x44'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x5:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x45'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x6:joinOrLeaveQueues(_0x115395,_0x4a3723,_0x43c0('0x46'),_0xea2cc2[_0x195961][_0x496f84]);break;case 0x7:if(_0x4aab88['role']!==_0x43c0('0x7'))_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x47'),_0xea2cc2[_0x195961][_0x496f84][_0x43c0('0x3')]));break;case 0x8:if(_0x4aab88[_0x43c0('0x6')]!==_0x43c0('0x7'))_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x48'),_0xea2cc2[_0x195961][_0x496f84][_0x43c0('0x3')]));break;case 0x9:if(_0x4aab88[_0x43c0('0x6')]!==_0x43c0('0x7'))_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x49'),_0xea2cc2[_0x195961][_0x496f84][_0x43c0('0x8')],_0xea2cc2[_0x195961][_0x496f84]['name']));break;case 0xa:_0x115395[_0x4a3723](util[_0x43c0('0x1a')](_0x43c0('0x1d'),_0xea2cc2[_0x195961][_0x496f84]['name']));break;}}}}})['then'](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x54fe69=_[_0x43c0('0x16')](_0x4aab88[_0x43c0('0x21')],'id');return _0x4aab88[_0x43c0('0x4b')](_0x54fe69)['then'](function(){for(var _0x5aa2c3=0x0;_0x5aa2c3<_0x54fe69[_0x43c0('0x1c')];_0x5aa2c3+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x4d'),{'ChatInteractionId':Number(_0x54fe69[_0x5aa2c3]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0xc2fdfc=_[_0x43c0('0x16')](_0x4aab88['MailInteractions'],'id');return _0x4aab88['removeMailInteractions'](_0xc2fdfc)[_0x43c0('0x19')](function(){for(var _0x516680=0x0;_0x516680<_0xc2fdfc[_0x43c0('0x1c')];_0x516680+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x4e'),{'MailInteractionId':Number(_0xc2fdfc[_0x516680]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x4689da=_[_0x43c0('0x16')](_0x4aab88[_0x43c0('0x25')],'id');return _0x4aab88[_0x43c0('0x4f')](_0x4689da)[_0x43c0('0x19')](function(){for(var _0x5954b5=0x0;_0x5954b5<_0x4689da[_0x43c0('0x1c')];_0x5954b5+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x50'),{'FaxInteractionId':Number(_0x4689da[_0x5954b5]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x34344d=_[_0x43c0('0x16')](_0x4aab88[_0x43c0('0x27')],'id');return _0x4aab88[_0x43c0('0x51')](_0x34344d)[_0x43c0('0x19')](function(){for(var _0x523c25=0x0;_0x523c25<_0x34344d['length'];_0x523c25+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x52'),{'SmsInteractionId':Number(_0x34344d[_0x523c25]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x551ed5=_['map'](_0x4aab88[_0x43c0('0x53')],'id');return _0x4aab88[_0x43c0('0x54')](_0x551ed5)[_0x43c0('0x19')](function(){for(var _0x12f98e=0x0;_0x12f98e<_0x551ed5[_0x43c0('0x1c')];_0x12f98e+=0x1){_0xf3ff3e[_0x43c0('0x4c')](_0x43c0('0x55'),{'OpenchannelInteractionId':Number(_0x551ed5[_0x12f98e]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x19')](function(){if(_0x4a3723===_0x43c0('0x4a')){var _0x54e773=_[_0x43c0('0x16')](_0x4aab88['WhatsappInteractions'],'id');return _0x4aab88[_0x43c0('0x56')](_0x54e773)[_0x43c0('0x19')](function(){for(var _0x43d9c2=0x0;_0x43d9c2<_0x54e773[_0x43c0('0x1c')];_0x43d9c2+=0x1){_0xf3ff3e[_0x43c0('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x54e773[_0x43d9c2]),'UserId':Number(_0x4aab88['id'])});}});}})[_0x43c0('0x57')](function(_0x27b84a){_0x115395[_0x43c0('0x58')](_0x27b84a);});}}function onDisconnect(_0x2b0545,_0x3599de){joinOrLeave(_0x2b0545,'leave',_0x3599de);}function onConnect(_0x3b174a){joinOrLeave(_0x3b174a,_0x43c0('0x59'));}exports[_0x43c0('0x5a')]=function(_0xca6361){_0xca6361['on'](_0x43c0('0x5b'),function(_0x222a93){_0x222a93[_0x43c0('0x5c')](0x0);_0x222a93[_0x43c0('0x5d')]=_0x222a93[_0x43c0('0x5e')][_0x43c0('0x5b')][_0x43c0('0x5f')]+':'+_0x222a93['request'][_0x43c0('0x5b')][_0x43c0('0x60')];_0x222a93['connectedAt']=new Date();_0x222a93['log']=function(_0x480886){console[_0x43c0('0x58')](_0x43c0('0x61')+_0x222a93[_0x43c0('0x62')][_0x43c0('0x3')]+'['+_0x222a93[_0x43c0('0x5d')]+']',_0x480886);};_0x222a93['on'](_0x43c0('0x63'),function(){onDisconnect(_0x222a93,_0xca6361);_0x222a93[_0x43c0('0x58')](_0x43c0('0x64'));});onConnect(_0x222a93);_0x222a93['log'](_0x43c0('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8750e71..4a22a11 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 _0x7857=['OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','resolve','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','agent','AfterCreate','changed','closed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','condition','util','../../mysqldb','jayson/promise','triggers','client','Chat','ChatInteraction','afterUpdate','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','newinteraction','SmsInteraction','WhatsappInteraction','Whatsapp','closedinteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction'];(function(_0x2bd1eb,_0x32acb9){var _0x5dea89=function(_0x1dc097){while(--_0x1dc097){_0x2bd1eb['push'](_0x2bd1eb['shift']());}};_0x5dea89(++_0x32acb9);}(_0x7857,0x154));var _0x7785=function(_0x9ae740,_0x2d00f7){_0x9ae740=_0x9ae740-0x0;var _0xc767b1=_0x7857[_0x9ae740];return _0xc767b1;};'use strict';var util=require(_0x7785('0x0'));var db=require(_0x7785('0x1'))['db'];var jayson=require(_0x7785('0x2'));var logger=require('../logger')(_0x7785('0x3'));var client=jayson[_0x7785('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x7785('0x5'),'model':_0x7785('0x6'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x7785('0x5'),'model':'ChatInteraction','event':_0x7785('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7785('0x5'),'model':_0x7785('0x8'),'event':_0x7785('0x9'),'condition':_0x7785('0xa'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x7785('0xb'),'event':'afterCreate','condition':_0x7785('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x7785('0xc'),'model':'SmsInteraction','event':_0x7785('0x9'),'condition':_0x7785('0xd'),'callback':afterCreate},{'channel':'Sms','model':_0x7785('0xe'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7785('0xc'),'model':'SmsMessage','event':_0x7785('0x9'),'condition':_0x7785('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x7785('0xf'),'event':_0x7785('0x9'),'condition':_0x7785('0xd'),'callback':afterCreate},{'channel':_0x7785('0x10'),'model':_0x7785('0xf'),'event':_0x7785('0x7'),'condition':_0x7785('0x11'),'callback':afterUpdate},{'channel':_0x7785('0x10'),'model':'WhatsappMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7785('0x12'),'model':'FaxInteraction','event':_0x7785('0x9'),'condition':_0x7785('0xd'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x7785('0x7'),'condition':_0x7785('0x11'),'callback':afterUpdate},{'channel':_0x7785('0x12'),'model':_0x7785('0x13'),'event':_0x7785('0x9'),'condition':_0x7785('0xa'),'callback':afterCreateMessage},{'channel':_0x7785('0x14'),'model':_0x7785('0x15'),'event':_0x7785('0x9'),'condition':_0x7785('0xd'),'callback':afterCreate},{'channel':'Mail','model':_0x7785('0x15'),'event':'afterUpdate','condition':_0x7785('0x11'),'callback':afterUpdate},{'channel':'Mail','model':_0x7785('0x16'),'event':_0x7785('0x9'),'condition':_0x7785('0xa'),'callback':afterCreateMessage},{'channel':_0x7785('0x17'),'model':_0x7785('0x18'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x7785('0x17'),'model':_0x7785('0x18'),'event':_0x7785('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7785('0x17'),'model':_0x7785('0x19'),'event':_0x7785('0x9'),'condition':_0x7785('0xa'),'callback':afterCreateMessage}];function request(_0x23f0cb){return client[_0x7785('0x1a')](_0x7785('0x1b'),_0x23f0cb)[_0x7785('0x1c')](function(_0x1f5b91){logger[_0x7785('0x1d')](_0x7785('0x1e'),_0x7785('0x1b'),_0x1f5b91);if(_0x1f5b91[_0x7785('0x1f')]){if(_0x1f5b91[_0x7785('0x1f')][_0x7785('0x20')]===0x1f4){logger['error'](_0x7785('0x1e'),'EventManager',_0x1f5b91[_0x7785('0x1f')]);}}})[_0x7785('0x21')](function(_0x9f7528){logger[_0x7785('0x1f')]('Trigger,\x20%s',_0x7785('0x1b'),_0x9f7528);});}function afterCreateMessage(_0xab6f4c){return function(_0x22cbe3){_0x22cbe3=_0x22cbe3[_0x7785('0x22')]({'plain':!![]});_0x22cbe3[_0x7785('0x23')]=_0xab6f4c;_0x22cbe3[_0x7785('0x24')]=_0xab6f4c;_0x22cbe3[_0x7785('0x25')]=_0x22cbe3['direction'];Promise[_0x7785('0x26')]()[_0x7785('0x1c')](function(){if(typeof _0x22cbe3[_0x7785('0x27')]===_0x7785('0x28'))return null;var _0x3569c8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x22cbe3[_0x7785('0x27')];return db[_0x7785('0x29')][_0x7785('0x2a')](_0x3569c8,{'type':db[_0x7785('0x2b')][_0x7785('0x2c')][_0x7785('0x2d')],'raw':!![]});})['then'](function(_0x1130d1){if(_0x1130d1){_0x22cbe3[_0x7785('0x2e')]=_0x1130d1[0x0];}if(typeof _0x22cbe3['UserId']===_0x7785('0x28'))return;return getAgent(_0x22cbe3[_0x7785('0x2f')]);})['then'](function(_0xf5acb8){if(_0xf5acb8){_0x22cbe3[_0x7785('0x30')]=util[_0x7785('0x31')](_0x7785('0x32'),_0xf5acb8[_0x7785('0x33')]);_0x22cbe3['agent']=_0xf5acb8;_0x22cbe3[_0x7785('0x23')]=_0xab6f4c;return request({'event':_0x7785('0x34'),'message':_0x22cbe3});}else{return request({'event':_0x7785('0x35'),'message':_0x22cbe3});}})['catch'](function(_0x2e934a){logger[_0x7785('0x1f')](_0x7785('0x1e'),_0x7785('0x36'),_0x2e934a);});};}function afterCreateOfflineMessage(_0x1fcbbd){return function(_0x3e3f79){_0x3e3f79=_0x3e3f79[_0x7785('0x22')]({'plain':!![]});_0x3e3f79[_0x7785('0x23')]=_0x1fcbbd;_0x3e3f79[_0x7785('0x24')]=_0x1fcbbd;_0x3e3f79[_0x7785('0x25')]=_0x7785('0x37');return request({'event':_0x3e3f79[_0x7785('0x25')],'message':_0x3e3f79});};}function afterCreate(_0x45a7e4,_0x5dbccf){return function(_0x52ba36){_0x52ba36=_0x52ba36[_0x7785('0x22')]({'plain':!![]});_0x52ba36[_0x7785('0x23')]=_0x45a7e4;_0x52ba36[_0x7785('0x24')]=_0x45a7e4;_0x52ba36['event']='opened';Promise[_0x7785('0x26')]()['then'](function(){var _0x8b7c64='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52ba36[_0x7785('0x27')];return db['sequelize'][_0x7785('0x2a')](_0x8b7c64,{'type':db[_0x7785('0x2b')][_0x7785('0x2c')][_0x7785('0x2d')],'raw':!![]});})[_0x7785('0x1c')](function(_0x316db8){if(_0x316db8){_0x52ba36['contact']=_0x316db8[0x0];}if(typeof _0x52ba36['UserId']==='undefined')return;return getAgent(_0x52ba36[_0x7785('0x2f')]);})['then'](function(_0x116be7){if(_0x116be7){_0x52ba36[_0x7785('0x30')]=util[_0x7785('0x31')](_0x7785('0x32'),_0x116be7[_0x7785('0x33')]);_0x52ba36[_0x7785('0x38')]=_0x116be7;}return request({'event':_0x5dbccf,'message':_0x52ba36});})[_0x7785('0x21')](function(_0x28beeb){logger[_0x7785('0x1f')]('Trigger,\x20%s',_0x7785('0x39'),_0x28beeb);});};}function afterUpdate(_0x3df5f5){return function(_0x58d83c){var _0x5bc18b=_0x58d83c[_0x7785('0x3a')](_0x7785('0x3b'))&&_0x58d83c[_0x7785('0x3b')];var _0x21b6ce=_0x58d83c[_0x7785('0x3a')](_0x7785('0x3c'));if(_0x5bc18b||_0x21b6ce){var _0x7b4b15=_0x5bc18b?'closedinteraction':_0x7785('0x3c');var _0x463ea4=_0x58d83c[_0x7785('0x22')]({'plain':!![]});_0x463ea4[_0x7785('0x23')]=_0x3df5f5;_0x463ea4[_0x7785('0x24')]=_0x3df5f5;_0x463ea4[_0x7785('0x25')]=_0x5bc18b?_0x7785('0x3b'):_0x7785('0x3c');var _0x16e206=_0x7785('0x3d')+_0x463ea4[_0x7785('0x27')];return db[_0x7785('0x29')][_0x7785('0x2a')](_0x16e206,{'type':db[_0x7785('0x2b')][_0x7785('0x2c')][_0x7785('0x2d')],'raw':!![]})[_0x7785('0x1c')](function(_0x5d665f){if(_0x5d665f){_0x463ea4[_0x7785('0x2e')]=_0x5d665f[0x0];}if(typeof _0x463ea4[_0x7785('0x2f')]===_0x7785('0x28'))return;return getAgent(_0x463ea4[_0x7785('0x2f')]);})[_0x7785('0x1c')](function(_0x9cbe60){if(_0x9cbe60){_0x463ea4[_0x7785('0x30')]=util[_0x7785('0x31')](_0x7785('0x32'),_0x9cbe60[_0x7785('0x33')]);_0x463ea4[_0x7785('0x38')]=_0x9cbe60;}return request({'event':_0x7b4b15,'message':_0x463ea4});})[_0x7785('0x21')](function(_0x259b41){logger['error']('Trigger,\x20%s',_0x7785('0x3e'),_0x259b41);});}};}function getAgent(_0x24d2bb){return db[_0x7785('0x3f')][_0x7785('0x40')]({'where':{'id':_0x24d2bb},'attributes':['id',_0x7785('0x33'),_0x7785('0x41'),'email',_0x7785('0x42')],'raw':!![]})[_0x7785('0x1c')](function(_0x4d873d){return _0x4d873d;});}exports[_0x7785('0x43')]=function(){for(var _0x884387=0x0;_0x884387=_0x5036e2[_0xbf55('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x464dc5(_0xc41e09);})[_0xbf55('0x16')](function(_0x4feff0){_0x32afe7(_0x4feff0);});});}; \ No newline at end of file +var _0xd24e=['whatsapp','openchannel','getChannels','toLowerCase','includes','blockedAt','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','mail','fax','sms'];(function(_0x1ce23d,_0x25a351){var _0x4338d9=function(_0xf8d3a9){while(--_0xf8d3a9){_0x1ce23d['push'](_0x1ce23d['shift']());}};_0x4338d9(++_0x25a351);}(_0xd24e,0x1b0));var _0xed24=function(_0x128522,_0x53e1bc){_0x128522=_0x128522-0x0;var _0x11d754=_0xd24e[_0x128522];return _0x11d754;};'use strict';var _=require(_0xed24('0x0'));var BPromise=require(_0xed24('0x1'));var db=require(_0xed24('0x2'))['db'];var util=require(_0xed24('0x3'));var channels=[_0xed24('0x4'),_0xed24('0x5'),'chat',_0xed24('0x6'),_0xed24('0x7'),_0xed24('0x8'),_0xed24('0x9')];exports[_0xed24('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x5099ea){_0x5099ea=_0x5099ea[_0xed24('0xb')]();return _[_0xed24('0xc')](channels,_0x5099ea);};exports['clearBlockUser']=function(_0x581308,_0x1029bd,_0x553664,_0xd83e29){var _0xb23230={'loginAttempts':_0x1029bd,'blocked':_0x553664};if(!_['isUndefined'](_0xd83e29)){_0xb23230[_0xed24('0xd')]=_0xd83e29;}return _0x581308['updateAttributes'](_0xb23230);};exports[_0xed24('0xe')]=function(_0x57ce9e){return new BPromise(function(_0x177239,_0x57fc98){var _0x295446=0x0;if(_0x57ce9e['role']!==_0xed24('0xf')){_0x177239(_0x57ce9e);}db['User'][_0xed24('0x10')]({'where':{'role':_0xed24('0xf'),'online':!![],'id':{'$ne':_0x57ce9e['id']}}})[_0xed24('0x11')](function(_0xdeb18d){_0x295446=_0xdeb18d;return util[_0xed24('0xe')]();})[_0xed24('0x11')](function(_0x5586d5){if(_0x5586d5&&_0x5586d5[_0xed24('0x12')]&&_0x295446>=_0x5586d5[_0xed24('0x12')]){throw Error(_0xed24('0x13'));}_0x177239(_0x57ce9e);})['catch'](function(_0xbb78a2){_0x57fc98(_0xbb78a2);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 1ac0b9b..2ad4f12 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8235=['Not\x20Found','Out\x20Of\x20Interval','OutOfInterval','Resource\x20Conflict','Conflict','stack','statusMessage','send','exports','api','message','Internal\x20Server\x20Error','Error','Bad\x20Request','name','Forbidden','inherits','Entity\x20not\x20found'];(function(_0x514cea,_0x29c73c){var _0x43681d=function(_0xe9dd9d){while(--_0xe9dd9d){_0x514cea['push'](_0x514cea['shift']());}};_0x43681d(++_0x29c73c);}(_0x8235,0x1dd));var _0x5823=function(_0x1d7a53,_0x1b698f){_0x1d7a53=_0x1d7a53-0x0;var _0x369ca0=_0x8235[_0x1d7a53];return _0x369ca0;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x5823('0x0'));var APIError=function(_0x25b124,_0x1b2420){this[_0x5823('0x1')]=_0x25b124||_0x5823('0x2');this['name']=_0x1b2420||_0x5823('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x2a8186){this['message']=_0x2a8186||_0x5823('0x4');this[_0x5823('0x5')]='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x201f32){this[_0x5823('0x1')]=_0x201f32||_0x5823('0x6');this[_0x5823('0x5')]=_0x5823('0x6');util[_0x5823('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x2bfdc5){this[_0x5823('0x1')]=_0x2bfdc5||_0x5823('0x8');this['name']=_0x5823('0x9');util[_0x5823('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2d799c){this['message']=_0x2d799c||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x5823('0x5')]=_0x5823('0xa');this['code']=0x193;this['details']={'type':_0x5823('0xb')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4b8a18){this[_0x5823('0x1')]=_0x4b8a18||_0x5823('0xc');this[_0x5823('0x5')]=_0x5823('0xd');util[_0x5823('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0xfa18e1){switch(_0xfa18e1){case _0x5823('0x4'):return 0x190;case _0x5823('0x6'),_0x5823('0xa'):return 0x193;case _0x5823('0x9'):return 0x194;case _0x5823('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x30120b){if(_0x30120b===_0x5823('0xa'))return _0x30120b;return null;}function handleError(_0x5ccc53){return function(_0x920437){logger['error'](_0x920437[_0x5823('0xe')]);var _0x4c56b1=getStatusCode(_0x920437[_0x5823('0x5')]);var _0x39ec4f=getCustomStatusMessage(_0x920437[_0x5823('0x5')]);if(_0x920437[_0x5823('0x5')]){delete _0x920437[_0x5823('0x5')];}if(_0x39ec4f){_0x5ccc53[_0x5823('0xf')]=_0x39ec4f;}return _0x5ccc53['status'](_0x4c56b1)[_0x5823('0x10')](_0x920437);};}module[_0x5823('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x81f5=['exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Forbidden','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','Resource\x20Conflict','Conflict','error','stack','send'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x81f5,0xde));var _0x581f=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x81f5[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x581f('0x0'));var logger=require(_0x581f('0x1'))(_0x581f('0x2'));var APIError=function(_0x32bc7a,_0xcfcce2){this[_0x581f('0x3')]=_0x32bc7a||_0x581f('0x4');this[_0x581f('0x5')]=_0xcfcce2||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x2068d3){this[_0x581f('0x3')]=_0x2068d3||'Bad\x20Request';this[_0x581f('0x5')]=_0x581f('0x6');util[_0x581f('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1c2914){this[_0x581f('0x3')]=_0x1c2914||_0x581f('0x8');this[_0x581f('0x5')]=_0x581f('0x8');util[_0x581f('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x10340d){this[_0x581f('0x3')]=_0x10340d||'Entity\x20not\x20found';this[_0x581f('0x5')]='Not\x20Found';util[_0x581f('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3e0de0){this[_0x581f('0x3')]=_0x3e0de0||_0x581f('0x9');this['name']=_0x581f('0xa');this['code']=0x193;this['details']={'type':'OutOfInterval'};util[_0x581f('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1af694){this['message']=_0x1af694||_0x581f('0xb');this[_0x581f('0x5')]=_0x581f('0xc');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x499d89){switch(_0x499d89){case _0x581f('0x6'):return 0x190;case'Forbidden',_0x581f('0xa'):return 0x193;case'Not\x20Found':return 0x194;case _0x581f('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4ccf70){if(_0x4ccf70===_0x581f('0xa'))return _0x4ccf70;return null;}function handleError(_0x199928){return function(_0xfa78c0){logger[_0x581f('0xd')](_0xfa78c0[_0x581f('0xe')]);var _0x57ac58=getStatusCode(_0xfa78c0[_0x581f('0x5')]);var _0x217204=getCustomStatusMessage(_0xfa78c0[_0x581f('0x5')]);if(_0xfa78c0[_0x581f('0x5')]){delete _0xfa78c0[_0x581f('0x5')];}if(_0x217204){_0x199928['statusMessage']=_0x217204;}return _0x199928['status'](_0x57ac58)[_0x581f('0xf')](_0xfa78c0);};}module[_0x581f('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index eb78f48..aab7c0f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2426=['404','status','render','json','send','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2426,0x155));var _0x6242=function(_0x3c35e6,_0x17e5a7){_0x3c35e6=_0x3c35e6-0x0;var _0xfa197e=_0x2426[_0x3c35e6];return _0xfa197e;};'use strict';module[_0x6242('0x0')][0x194]=function pageNotFound(_0x28ece4,_0xa09a37){var _0x4179a3=_0x6242('0x1');var _0x40170b=0x194;var _0x32662e={'status':_0x40170b};_0xa09a37['status'](_0x32662e[_0x6242('0x2')]);_0xa09a37[_0x6242('0x3')](_0x4179a3,{},function(_0x528bfa,_0x560217){if(_0x528bfa){return _0xa09a37[_0x6242('0x2')](_0x32662e[_0x6242('0x2')])[_0x6242('0x4')](_0x32662e);}_0xa09a37[_0x6242('0x5')](_0x560217);});}; \ No newline at end of file +var _0xf042=['404','status','render','json','exports'];(function(_0x325679,_0x2781cd){var _0x3766b5=function(_0x4862c0){while(--_0x4862c0){_0x325679['push'](_0x325679['shift']());}};_0x3766b5(++_0x2781cd);}(_0xf042,0xfe));var _0x2f04=function(_0x2bb900,_0x4692de){_0x2bb900=_0x2bb900-0x0;var _0x45e67d=_0xf042[_0x2bb900];return _0x45e67d;};'use strict';module[_0x2f04('0x0')][0x194]=function pageNotFound(_0x26caf9,_0x2b7457){var _0x4c1001=_0x2f04('0x1');var _0x4a3849=0x194;var _0x34389f={'status':_0x4a3849};_0x2b7457[_0x2f04('0x2')](_0x34389f[_0x2f04('0x2')]);_0x2b7457[_0x2f04('0x3')](_0x4c1001,{},function(_0x14503d,_0x492a1c){if(_0x14503d){return _0x2b7457[_0x2f04('0x2')](_0x34389f[_0x2f04('0x2')])[_0x2f04('0x4')](_0x34389f);}_0x2b7457['send'](_0x492a1c);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index abca90d..9157bad 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3896=['UserVoiceQueue','Team','Teams','BlackLists','VoiceMailMessage','Messages','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','List','Pause','mandatoryDispositionPause','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsite','DashboardItem','Items','FaxAccountId','Answers','Interactions','Exntensions','ListId','TagId','fax_interaction_has_tags','FaxInteractionId','AttachmentId','SmsAccountId','SmsApplication','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CmCompany','CompanyId','Phones','CmContactId','JscriptySessions','MailInteractions','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticFieldReport','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','DescriptionId','Field','VariableId','Description','DeskConfiguration','DeskField','ZohoAccount','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesField','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_mail_queues','team_has_fax_queues','FaxQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','UserId','User','VoiceQueuesRt','hasMany','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','UserNotifications','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','TrunkId','IntervalId','mandatoryDispositionPauseId','Lists','Agents'];(function(_0x443259,_0xc2b511){var _0x4cf216=function(_0x5ec5c6){while(--_0x5ec5c6){_0x443259['push'](_0x443259['shift']());}};_0x4cf216(++_0xc2b511);}(_0x3896,0xb5));var _0x6389=function(_0x3a730d,_0x7c6df8){_0x3a730d=_0x3a730d-0x0;var _0x2af367=_0x3896[_0x3a730d];return _0x2af367;};'use strict';var config=require(_0x6389('0x0'));var Sequelize=require(_0x6389('0x1'));var _=require(_0x6389('0x2'));var jstz=require(_0x6389('0x3'));var timezone=jstz[_0x6389('0x4')]();config[_0x6389('0x1')]=_[_0x6389('0x5')](config[_0x6389('0x1')],{'database':_0x6389('0x6'),'username':_0x6389('0x7'),'password':_0x6389('0x8'),'options':{'host':_0x6389('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6389('0xa')},'logging':![],'timezone':timezone[_0x6389('0xb')](),'define':{'charset':_0x6389('0xc'),'collate':_0x6389('0xd')}}});config[_0x6389('0xe')]=_['defaultsDeep'](config[_0x6389('0xe')],{'database':_0x6389('0x6'),'username':_0x6389('0x7'),'password':'xC@LL1234','options':{'host':_0x6389('0x9'),'port':0xcea,'dialect':_0x6389('0xf'),'dialectOptions':{'charset':_0x6389('0xa')},'logging':![],'timezone':timezone[_0x6389('0xb')](),'define':{'charset':'utf8','collate':_0x6389('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x6389('0x10')],config[_0x6389('0x1')][_0x6389('0x11')],config[_0x6389('0x1')][_0x6389('0x12')],config[_0x6389('0x1')][_0x6389('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x6389('0x10')],config[_0x6389('0xe')][_0x6389('0x11')],config[_0x6389('0xe')]['password'],config[_0x6389('0xe')][_0x6389('0x13')])};db['User']=db['sequelize'][_0x6389('0x14')](_0x6389('0x15'));db[_0x6389('0x16')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x6389('0x17')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/voiceContext/voiceContext.model');db[_0x6389('0x18')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x19'));db[_0x6389('0x1a')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x6389('0x1b')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x1c'));db[_0x6389('0x1d')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x6389('0x1e')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x1f'));db[_0x6389('0x20')]=db[_0x6389('0x1')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x6389('0x1')]['import'](_0x6389('0x21'));db[_0x6389('0x22')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x23'));db['VoiceAgentReport']=db[_0x6389('0x1')]['import'](_0x6389('0x24'));db['VoiceQueueReport']=db[_0x6389('0x1')]['import'](_0x6389('0x25'));db[_0x6389('0x26')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x27'));db[_0x6389('0x28')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/trunk/trunk.model');db[_0x6389('0x29')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x2a'));db[_0x6389('0x2b')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x2c'));db[_0x6389('0x2d')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x2e'));db[_0x6389('0x2f')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x30'));db[_0x6389('0x31')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x32'));db['UserSmsQueue']=db[_0x6389('0x1')]['import'](_0x6389('0x33'));db['UserOpenchannelQueue']=db['sequelize'][_0x6389('0x14')](_0x6389('0x34'));db[_0x6389('0x35')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x36'));db['MailServerIn']=db[_0x6389('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db[_0x6389('0x37')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x38'));db[_0x6389('0x39')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x3a'));db[_0x6389('0x3b')]=db[_0x6389('0x1')]['import'](_0x6389('0x3c'));db['MailSubstatus']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x3d'));db['MailInteraction']=db['sequelize'][_0x6389('0x14')](_0x6389('0x3e'));db[_0x6389('0x3f')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x40'));db[_0x6389('0x41')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x42'));db[_0x6389('0x43')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0x6389('0x44')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x45'));db[_0x6389('0x46')]=db[_0x6389('0x1')]['import'](_0x6389('0x47'));db[_0x6389('0x48')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/faxApplication/faxApplication.model');db[_0x6389('0x49')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x4a'));db[_0x6389('0x4b')]=db[_0x6389('0x1')]['import'](_0x6389('0x4c'));db[_0x6389('0x4d')]=db[_0x6389('0x1')]['import'](_0x6389('0x4e'));db[_0x6389('0x4f')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x50'));db[_0x6389('0x51')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x52'));db['SmsApplication']=db[_0x6389('0x1')]['import'](_0x6389('0x53'));db['SmsInteraction']=db[_0x6389('0x1')][_0x6389('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0x6389('0x54')]=db[_0x6389('0x1')]['import'](_0x6389('0x55'));db[_0x6389('0x56')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x57'));db[_0x6389('0x58')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x59'));db[_0x6389('0x5a')]=db['sequelize'][_0x6389('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x6389('0x5b')]=db[_0x6389('0x1')]['import'](_0x6389('0x5c'));db[_0x6389('0x5d')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x5e'));db[_0x6389('0x5f')]=db[_0x6389('0x1')]['import'](_0x6389('0x60'));db['ChatWebsite']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x61'));db['OpenchannelQueueReport']=db[_0x6389('0x1')]['import'](_0x6389('0x62'));db[_0x6389('0x63')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x64'));db[_0x6389('0x65')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x66'));db[_0x6389('0x67')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x68'));db[_0x6389('0x69')]=db[_0x6389('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize']['import']('../api/chatQueue/chatQueue.model');db[_0x6389('0x6a')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x6b'));db[_0x6389('0x6c')]=db[_0x6389('0x1')]['import'](_0x6389('0x6d'));db['CmCompany']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x6e'));db[_0x6389('0x6f')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/cmContact/cmContact.model');db[_0x6389('0x70')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x71'));db[_0x6389('0x72')]=db['sequelize']['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6389('0x73')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x74'));db[_0x6389('0x75')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x76'));db['ReportAgentPreview']=db[_0x6389('0x1')]['import'](_0x6389('0x77'));db[_0x6389('0x78')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x79'));db[_0x6389('0x7a')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x7b'));db[_0x6389('0x7c')]=db[_0x6389('0x1')]['import']('../api/automation/automation.model');db[_0x6389('0x7d')]=db[_0x6389('0x1')]['import'](_0x6389('0x7e'));db['Disposition']=db[_0x6389('0x1')][_0x6389('0x14')]('../api/disposition/disposition.model');db[_0x6389('0x7f')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/condition/condition.model');db[_0x6389('0x80')]=db[_0x6389('0x1')]['import'](_0x6389('0x81'));db['Pause']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x82'));db['Cdr']=db['sequelize'][_0x6389('0x14')]('../api/cdr/cdr.model');db[_0x6389('0x83')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x84'));db[_0x6389('0x85')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x86'));db[_0x6389('0x87')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/sound/sound.model');db[_0x6389('0x88')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x89'));db[_0x6389('0x8a')]=db[_0x6389('0x1')]['import'](_0x6389('0x8b'));db[_0x6389('0x8c')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x8d'));db[_0x6389('0x8e')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x8f'));db[_0x6389('0x90')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x91'));db[_0x6389('0x92')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x93'));db[_0x6389('0x94')]=db[_0x6389('0x1')]['import']('../api/variable/variable.model');db[_0x6389('0x95')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x96'));db['IntegrationReport']=db['sequelize']['import']('../api/integrationReport/integrationReport.model');db[_0x6389('0x97')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x98'));db[_0x6389('0x99')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x9a'));db['AnalyticExtractedReport']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x9b'));db[_0x6389('0x9c')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x9d'));db['AnalyticFieldReport']=db[_0x6389('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x6389('0x9e')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x9f'));db[_0x6389('0xa0')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xa1'));db[_0x6389('0xa2')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x6389('0xa3')]=db['sequelize'][_0x6389('0x14')](_0x6389('0xa4'));db[_0x6389('0xa5')]=db['sequelize'][_0x6389('0x14')](_0x6389('0xa6'));db[_0x6389('0xa7')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6389('0xa8')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xa9'));db[_0x6389('0xaa')]=db[_0x6389('0x1')]['import'](_0x6389('0xab'));db['DeskConfiguration']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xac'));db['DeskField']=db[_0x6389('0x1')][_0x6389('0x14')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xad'));db[_0x6389('0xae')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xaf'));db[_0x6389('0xb0')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xb1'));db['ZendeskAccount']=db[_0x6389('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x6389('0xb2')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xb3'));db['ZendeskField']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xb4'));db['FreshdeskAccount']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xb5'));db[_0x6389('0xb6')]=db[_0x6389('0x1')]['import'](_0x6389('0xb7'));db[_0x6389('0xb8')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xb9'));db['VtigerAccount']=db[_0x6389('0x1')]['import'](_0x6389('0xba'));db[_0x6389('0xbb')]=db[_0x6389('0x1')]['import'](_0x6389('0xbc'));db[_0x6389('0xbd')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x6389('0xbe')]=db[_0x6389('0x1')]['import'](_0x6389('0xbf'));db[_0x6389('0xc0')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xc1'));db[_0x6389('0xc2')]=db[_0x6389('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x6389('0xc3')]=db['sequelize'][_0x6389('0x14')](_0x6389('0xc4'));db['Dynamics365Configuration']=db['sequelize'][_0x6389('0x14')](_0x6389('0xc5'));db['Dynamics365Field']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xc6'));db[_0x6389('0xc7')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xc8'));db[_0x6389('0xc9')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xca'));db['FreshsalesField']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xcb'));db['Integration']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x96'));db[_0x6389('0xcc')]=db['sequelize'][_0x6389('0x14')]('../api/network/network.model');db[_0x6389('0xcd')]=db[_0x6389('0x1')]['import'](_0x6389('0xce'));db['ChatInternalMessage']=db[_0x6389('0x1')]['import'](_0x6389('0xcf'));db[_0x6389('0xd0')]=db['sequelize'][_0x6389('0x14')](_0x6389('0xd1'));db['JscriptyQuestionReport']=db[_0x6389('0x1')]['import'](_0x6389('0xd2'));db['JscriptySessionReport']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xd3'));db[_0x6389('0xd4')]=db['sequelize'][_0x6389('0x14')](_0x6389('0xd5'));db['SquareReport']=db[_0x6389('0x1')]['import'](_0x6389('0xd6'));db[_0x6389('0xd7')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xd8'));db[_0x6389('0xd9')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xda'));db[_0x6389('0xdb')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xdc'));db[_0x6389('0xdd')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xde'));db[_0x6389('0xdf')]=db[_0x6389('0x1')]['import'](_0x6389('0xe0'));db['SquareRecording']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xe1'));db['SquareMessage']=db['sequelize']['import'](_0x6389('0xe2'));db['Team']=db['sequelize'][_0x6389('0x14')](_0x6389('0xe3'));db[_0x6389('0xe4')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xe5'));db['Campaign']=db['sequelize'][_0x6389('0x14')](_0x6389('0xe6'));db[_0x6389('0xe7')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/migration/migration.model');db[_0x6389('0xe8')]=db[_0x6389('0x1')]['import'](_0x6389('0xe9'));db[_0x6389('0xea')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/plugin/plugin.model');db[_0x6389('0xeb')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xec'));db['ChatTransferReport']=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xed'));db[_0x6389('0xee')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xef'));db[_0x6389('0xf0')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x6389('0xf1')]=db[_0x6389('0x1')]['import'](_0x6389('0xf2'));db[_0x6389('0xf3')]=db[_0x6389('0x1')]['import'](_0x6389('0xf4'));db[_0x6389('0xf5')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xf6'));db[_0x6389('0xf7')]=db['sequelize'][_0x6389('0x14')]('../api/userProfile/userProfile.model');db[_0x6389('0xf8')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xf9'));db[_0x6389('0xfa')]=db[_0x6389('0x1')]['import'](_0x6389('0xfb'));db['UserNotification']=db[_0x6389('0x1')][_0x6389('0x14')]('../api/userNotification/userNotification.model');db[_0x6389('0xfc')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0xfd'));db[_0x6389('0xfe')]=db[_0x6389('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x6389('0xff')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x100'));db[_0x6389('0x101')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x102'));db[_0x6389('0x103')]=db[_0x6389('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x6389('0x104')]=db[_0x6389('0x1')]['import'](_0x6389('0x105'));db['WhatsappQueue']=db[_0x6389('0x1')]['import'](_0x6389('0x106'));db['CloudProvider']=db[_0x6389('0x1')]['import'](_0x6389('0x107'));db[_0x6389('0x108')]=db[_0x6389('0x1')]['import'](_0x6389('0x109'));db[_0x6389('0x10a')]=db[_0x6389('0x1')][_0x6389('0x14')](_0x6389('0x10b'));db[_0x6389('0x10c')]=db['sequelize'][_0x6389('0x14')](_0x6389('0x10d'));db[_0x6389('0x10e')]=db[_0x6389('0x1')][_0x6389('0x14')]('../api/user-setting/user-setting.model');db['User'][_0x6389('0x10f')](db[_0x6389('0x20')],{'as':_0x6389('0x20'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')][_0x6389('0x10f')](db[_0x6389('0x10e')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x6389('0x111')});db[_0x6389('0x112')]['hasMany'](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x6389('0x111')});db[_0x6389('0x112')]['hasMany'](db[_0x6389('0x2b')],{'as':_0x6389('0x113'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x18')],{'as':'Extensions','onDelete':_0x6389('0x110'),'hooks':!![]});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x73')],{'as':_0x6389('0x115'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x75')],{'as':'HopperHistory','foreignKey':_0x6389('0x111')});db[_0x6389('0x112')]['hasMany'](db[_0x6389('0x116')],{'as':_0x6389('0x116'),'foreignKey':'UserId'});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x5b')],{'as':_0x6389('0x117'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x65')],{'as':_0x6389('0x118'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')]['hasMany'](db[_0x6389('0x119')],{'as':_0x6389('0x11a'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x49')],{'as':_0x6389('0x11b'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x112')][_0x6389('0x114')](db[_0x6389('0x11c')],{'as':'MailInteractions','foreignKey':_0x6389('0x111')});db[_0x6389('0x112')]['hasMany'](db[_0x6389('0xff')],{'as':_0x6389('0x11d'),'foreignKey':_0x6389('0x111')});db['User'][_0x6389('0x114')](db['UserNotification'],{'as':_0x6389('0x11e'),'foreignKey':'SenderId'});db[_0x6389('0x112')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x6389('0x111'),'onDelete':_0x6389('0x11f')});db['User'][_0x6389('0x120')](db[_0x6389('0xf7')],{'as':_0x6389('0xf7'),'foreignKey':_0x6389('0x121')});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x6a')],{'as':_0x6389('0x123'),'through':_0x6389('0x124')});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x6f')],{'as':_0x6389('0x125'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0x6389('0xf3')],{'as':'Lists','through':_0x6389('0x126')});db[_0x6389('0x112')][_0x6389('0x122')](db['Team'],{'through':_0x6389('0x127')});db[_0x6389('0x112')][_0x6389('0x122')](db['MailInteraction'],{'as':'MailInteractions','through':_0x6389('0x128')});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x65')],{'as':_0x6389('0x118'),'through':'user_has_chat_interactions'});db['User'][_0x6389('0x122')](db[_0x6389('0x49')],{'as':'FaxInteractions','through':_0x6389('0x129')});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x119')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x5b')],{'as':_0x6389('0x117'),'through':_0x6389('0x12a')});db['User'][_0x6389('0x122')](db[_0x6389('0xff')],{'as':_0x6389('0x11d'),'through':_0x6389('0x12b')});db['User'][_0x6389('0x122')](db[_0x6389('0x1b')],{'as':_0x6389('0x12c'),'through':'UserVoiceQueue','required':![]});db['User'][_0x6389('0x122')](db['VoicePrefix'],{'as':_0x6389('0x12d'),'through':_0x6389('0x10c'),'required':![]});db['User'][_0x6389('0x122')](db['MailQueue'],{'as':_0x6389('0x12e'),'through':_0x6389('0x2f'),'required':![]});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x12f')],{'as':_0x6389('0x130'),'through':_0x6389('0x2d'),'required':![],'hooks':!![]});db[_0x6389('0x112')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x56')],{'as':_0x6389('0x131'),'through':_0x6389('0x132'),'required':![]});db['User'][_0x6389('0x122')](db[_0x6389('0x5f')],{'as':_0x6389('0x133'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x6389('0x134')],{'as':_0x6389('0x135'),'through':_0x6389('0x35'),'required':![]});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0xf3')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['ChatWebsite'],{'as':_0x6389('0x136'),'through':_0x6389('0x137')});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x46')],{'as':_0x6389('0x138'),'through':'user_has_fax_accounts'});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x39')],{'as':_0x6389('0x139'),'through':_0x6389('0x13a')});db[_0x6389('0x112')][_0x6389('0x122')](db[_0x6389('0x58')],{'as':_0x6389('0x13b'),'through':'user_has_openchannel_accounts'});db['User'][_0x6389('0x122')](db[_0x6389('0x51')],{'as':'SmsAccounts','through':_0x6389('0x13c')});db[_0x6389('0x112')][_0x6389('0x122')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x6389('0x16')][_0x6389('0x114')](db[_0x6389('0x18')],{'as':_0x6389('0x13d'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x13e')});db['VoiceContext']['hasMany'](db[_0x6389('0x18')],{'onDelete':_0x6389('0x110')});db[_0x6389('0x18')]['hasMany'](db[_0x6389('0x18')],{'as':_0x6389('0x13f'),'onDelete':'cascade'});db[_0x6389('0x1a')][_0x6389('0x122')](db[_0x6389('0x87')],{'as':_0x6389('0x140'),'through':'moh_has_sounds'});db[_0x6389('0x1b')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x6389('0x141'),'foreignKey':_0x6389('0x142')});db['VoiceQueue'][_0x6389('0x114')](db[_0x6389('0x70')],{'as':_0x6389('0x143'),'foreignKey':_0x6389('0x142')});db[_0x6389('0x1b')][_0x6389('0x114')](db['CmHopperFinal'],{'as':_0x6389('0x115'),'foreignKey':_0x6389('0x142')});db['VoiceQueue']['hasMany'](db[_0x6389('0x75')],{'as':_0x6389('0x144'),'foreignKey':_0x6389('0x142')});db[_0x6389('0x1b')][_0x6389('0x114')](db[_0x6389('0x116')],{'as':'ReportAgentPreview','foreignKey':_0x6389('0x142')});db[_0x6389('0x1b')]['hasMany'](db[_0x6389('0x72')],{'as':_0x6389('0x145'),'foreignKey':_0x6389('0x142')});db[_0x6389('0x1b')][_0x6389('0x114')](db[_0x6389('0x146')],{'as':'JscriptySessions','foreignKey':_0x6389('0x142')});db[_0x6389('0x1b')]['belongsTo'](db[_0x6389('0x28')],{'as':_0x6389('0x28'),'foreignKey':_0x6389('0x147')});db[_0x6389('0x1b')]['belongsTo'](db[_0x6389('0x28')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x6389('0x1b')][_0x6389('0x120')](db[_0x6389('0x80')],{'as':_0x6389('0x80'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x1b')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6389('0x149')});db[_0x6389('0x1b')]['belongsToMany'](db['CmList'],{'as':_0x6389('0x14a'),'through':'voice_queues_has_cm_lists'});db[_0x6389('0x1b')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x14c')});db[_0x6389('0x1b')][_0x6389('0x122')](db[_0x6389('0x14d')],{'as':_0x6389('0x14e'),'through':_0x6389('0x108')});db[_0x6389('0x1b')][_0x6389('0x122')](db['CmList'],{'as':_0x6389('0x14f'),'through':'voice_queues_has_cm_blacklists'});db[_0x6389('0x1d')][_0x6389('0x120')](db['User'],{'as':'User','foreignKey':_0x6389('0x111')});db['ScreenRecording'][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x112'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x20')][_0x6389('0x114')](db[_0x6389('0x150')],{'as':_0x6389('0x151'),'onDelete':_0x6389('0x110'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x6389('0x150')][_0x6389('0x120')](db[_0x6389('0x20')],{'foreignKey':_0x6389('0x152'),'targetKey':'mailbox'});db[_0x6389('0x22')][_0x6389('0x114')](db['VoiceQueueReport'],{'as':_0x6389('0x153'),'foreignKey':_0x6389('0x154'),'constraints':![]});db[_0x6389('0x22')][_0x6389('0x114')](db[_0x6389('0x155')],{'as':_0x6389('0x156'),'foreignKey':_0x6389('0x154'),'constraints':![]});db['VoiceCallReport'][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x112'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x22')][_0x6389('0x120')](db['CmContact'],{'as':'Contact','foreignKey':_0x6389('0x157')});db['MailServerIn'][_0x6389('0x120')](db[_0x6389('0x39')],{'as':'MailAccount','foreignKey':_0x6389('0x158')});db[_0x6389('0x159')][_0x6389('0x120')](db[_0x6389('0x15a')],{'as':_0x6389('0x15a'),'foreignKey':_0x6389('0x15b'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x37')][_0x6389('0x120')](db[_0x6389('0x39')],{'as':_0x6389('0x39'),'foreignKey':'MailAccountId'});db[_0x6389('0x37')][_0x6389('0x120')](db['CloudProvider'],{'as':_0x6389('0x15a'),'foreignKey':_0x6389('0x15b'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x39')][_0x6389('0x10f')](db[_0x6389('0x159')],{'as':_0x6389('0x15d'),'onDelete':_0x6389('0x110')});db[_0x6389('0x39')][_0x6389('0x10f')](db[_0x6389('0x37')],{'as':_0x6389('0x15e'),'onDelete':_0x6389('0x110')});db['MailAccount'][_0x6389('0x114')](db[_0x6389('0x15f')],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x158'),'onDelete':_0x6389('0x110')});db['MailAccount'][_0x6389('0x114')](db[_0x6389('0x7d')],{'as':'Answers','foreignKey':_0x6389('0x158')});db[_0x6389('0x39')][_0x6389('0x114')](db[_0x6389('0x3f')],{'as':'Messages','foreignKey':_0x6389('0x158')});db[_0x6389('0x39')][_0x6389('0x114')](db[_0x6389('0x11c')],{'as':'Interactions'});db[_0x6389('0x39')][_0x6389('0x114')](db[_0x6389('0x41')],{'as':'Applications','foreignKey':_0x6389('0x158'),'onDelete':'cascade'});db[_0x6389('0x39')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':'ListId'});db[_0x6389('0x39')][_0x6389('0x120')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x6389('0x39')][_0x6389('0x120')](db[_0x6389('0x162')],{'as':_0x6389('0x163'),'foreignKey':_0x6389('0x149')});db[_0x6389('0x39')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x13a')});db[_0x6389('0x3b')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':'Agents','through':'UserMailQueue'});db[_0x6389('0x3b')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6389('0x11c')][_0x6389('0x114')](db['MailMessage'],{'as':_0x6389('0x151'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x164')});db[_0x6389('0x11c')]['belongsTo'](db[_0x6389('0x39')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x158')});db[_0x6389('0x11c')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':'ContactId'});db[_0x6389('0x11c')][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x167'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x11c')][_0x6389('0x122')](db[_0x6389('0x88')],{'through':_0x6389('0x168'),'as':_0x6389('0x169')});db[_0x6389('0x11c')]['belongsToMany'](db[_0x6389('0x88')],{'through':_0x6389('0x168'),'as':_0x6389('0x16a')});db[_0x6389('0x11c')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x16b'),'through':_0x6389('0x128'),'foreignKey':_0x6389('0x164')});db['MailMessage'][_0x6389('0x114')](db[_0x6389('0xe8')],{'as':_0x6389('0x16c'),'onDelete':_0x6389('0x110')});db['MailMessage'][_0x6389('0x120')](db['User'],{'as':_0x6389('0x112')});db['MailMessage'][_0x6389('0x120')](db[_0x6389('0x6f')],{'onDelete':'cascade','as':_0x6389('0x166')});db['MailMessage']['belongsTo'](db[_0x6389('0x11c')],{'as':_0x6389('0x16d'),'foreignKey':'MailInteractionId'});db['MailMessage']['belongsTo'](db[_0x6389('0x39')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x158')});db[_0x6389('0x3f')][_0x6389('0x120')](db[_0x6389('0x16e')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x6389('0x3f')][_0x6389('0x120')](db[_0x6389('0x69')],{'as':_0x6389('0x69'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x6389('0x120')](db['User'],{'onDelete':_0x6389('0x15c')});db['MailApplication'][_0x6389('0x120')](db['MailQueue'],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x41')][_0x6389('0x120')](db[_0x6389('0x39')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x41')][_0x6389('0x120')](db[_0x6389('0x80')],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x41')][_0x6389('0x120')](db[_0x6389('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x6389('0x43')][_0x6389('0x120')](db[_0x6389('0x39')],{});db[_0x6389('0x43')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':'ListId'});db[_0x6389('0x43')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x43')][_0x6389('0x120')](db[_0x6389('0x11c')],{});db[_0x6389('0x43')][_0x6389('0x120')](db[_0x6389('0x3f')],{});db[_0x6389('0x43')][_0x6389('0x120')](db[_0x6389('0x112')],{});db[_0x6389('0x43')]['belongsTo'](db['MailQueue'],{});db[_0x6389('0x44')][_0x6389('0x114')](db[_0x6389('0x16f')],{'as':_0x6389('0x170'),'onDelete':_0x6389('0x110')});db['FaxAccount'][_0x6389('0x114')](db[_0x6389('0x15f')],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x171'),'onDelete':_0x6389('0x110')});db[_0x6389('0x46')][_0x6389('0x114')](db[_0x6389('0x7d')],{'as':_0x6389('0x172'),'foreignKey':_0x6389('0x171')});db[_0x6389('0x46')][_0x6389('0x114')](db[_0x6389('0x49')],{'as':_0x6389('0x173')});db[_0x6389('0x46')][_0x6389('0x114')](db['FaxApplication'],{'as':_0x6389('0x13f'),'foreignKey':_0x6389('0x171'),'onDelete':_0x6389('0x110')});db['FaxAccount'][_0x6389('0x114')](db[_0x6389('0x18')],{'as':_0x6389('0x174'),'onDelete':'cascade'});db[_0x6389('0x46')][_0x6389('0x114')](db[_0x6389('0x4b')],{'as':_0x6389('0x151')});db[_0x6389('0x46')]['belongsTo'](db['Trunk'],{'as':'Trunk'});db[_0x6389('0x46')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175')});db[_0x6389('0x46')][_0x6389('0x120')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6389('0x46')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x6389('0x48')]['belongsTo'](db[_0x6389('0x112')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x48')][_0x6389('0x120')](db[_0x6389('0x4d')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x48')]['belongsTo'](db[_0x6389('0x46')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x48')][_0x6389('0x120')](db[_0x6389('0x88')],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x176')});db['FaxInteraction'][_0x6389('0x114')](db[_0x6389('0x4b')],{'as':_0x6389('0x151'),'onDelete':_0x6389('0x110'),'foreignKey':'FaxInteractionId'});db[_0x6389('0x49')]['belongsTo'](db[_0x6389('0x46')],{'as':_0x6389('0x165'),'foreignKey':'FaxAccountId'});db[_0x6389('0x49')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0x6389('0x167'),'foreignKey':_0x6389('0x111')});db['FaxInteraction'][_0x6389('0x122')](db['Tag'],{'through':_0x6389('0x177'),'as':_0x6389('0x169')});db[_0x6389('0x49')][_0x6389('0x122')](db['Tag'],{'through':_0x6389('0x177'),'as':'ThroughTags'});db['FaxInteraction'][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x16b'),'through':_0x6389('0x129'),'foreignKey':_0x6389('0x178')});db[_0x6389('0x4b')][_0x6389('0x120')](db[_0x6389('0x112')],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x112')});db[_0x6389('0x4b')]['belongsTo'](db[_0x6389('0x49')],{'as':_0x6389('0x16d'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x6389('0x120')](db[_0x6389('0x6f')],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x166')});db['FaxMessage'][_0x6389('0x120')](db[_0x6389('0xe8')],{'as':_0x6389('0xe8'),'foreignKey':_0x6389('0x179')});db[_0x6389('0x4b')]['belongsTo'](db[_0x6389('0x46')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x171')});db['FaxQueue']['belongsToMany'](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x31')});db[_0x6389('0x4d')][_0x6389('0x122')](db[_0x6389('0x14d')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x6389('0x4f')][_0x6389('0x120')](db[_0x6389('0x46')],{});db[_0x6389('0x4f')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':'List','foreignKey':_0x6389('0x175')});db[_0x6389('0x4f')]['belongsTo'](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x4f')][_0x6389('0x120')](db[_0x6389('0x49')],{});db[_0x6389('0x4f')][_0x6389('0x120')](db[_0x6389('0x4b')],{});db[_0x6389('0x4f')][_0x6389('0x120')](db[_0x6389('0x112')],{});db[_0x6389('0x4f')]['belongsTo'](db[_0x6389('0x4d')],{});db['SmsAccount'][_0x6389('0x114')](db[_0x6389('0x15f')],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x17a'),'onDelete':'cascade'});db[_0x6389('0x51')][_0x6389('0x114')](db[_0x6389('0x7d')],{'as':_0x6389('0x172'),'foreignKey':_0x6389('0x17a')});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':_0x6389('0x151'),'foreignKey':_0x6389('0x17a')});db[_0x6389('0x51')]['hasMany'](db[_0x6389('0x119')],{'as':_0x6389('0x173')});db['SmsAccount'][_0x6389('0x114')](db[_0x6389('0x17b')],{'as':_0x6389('0x13f'),'foreignKey':_0x6389('0x17a'),'onDelete':_0x6389('0x110')});db[_0x6389('0x51')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175')});db['SmsAccount'][_0x6389('0x120')](db['Pause'],{'as':_0x6389('0x163'),'foreignKey':_0x6389('0x149')});db['SmsAccount'][_0x6389('0x122')](db['User'],{'as':_0x6389('0x14b'),'through':'user_has_sms_accounts'});db[_0x6389('0x17b')][_0x6389('0x120')](db['User'],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x17b')][_0x6389('0x120')](db[_0x6389('0x56')],{'onDelete':'restrict'});db['SmsApplication'][_0x6389('0x120')](db[_0x6389('0x51')],{'onDelete':'restrict'});db[_0x6389('0x17b')][_0x6389('0x120')](db[_0x6389('0x80')],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x148')});db['SmsApplication'][_0x6389('0x120')](db[_0x6389('0x88')],{'onDelete':_0x6389('0x15c'),'foreignKey':'TagId'});db[_0x6389('0x119')][_0x6389('0x114')](db[_0x6389('0x54')],{'as':_0x6389('0x151'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x6389('0x119')][_0x6389('0x120')](db[_0x6389('0x51')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x17a')});db['SmsInteraction'][_0x6389('0x120')](db['CmContact'],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db['SmsInteraction'][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x167'),'foreignKey':_0x6389('0x111')});db[_0x6389('0x119')][_0x6389('0x122')](db[_0x6389('0x88')],{'through':'sms_interaction_has_tags','as':_0x6389('0x169')});db[_0x6389('0x119')]['belongsToMany'](db[_0x6389('0x88')],{'through':_0x6389('0x17c'),'as':_0x6389('0x16a')});db[_0x6389('0x119')]['belongsToMany'](db[_0x6389('0x112')],{'as':_0x6389('0x16b'),'through':_0x6389('0x17d'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x6389('0x112')],{'as':_0x6389('0x112')});db[_0x6389('0x54')][_0x6389('0x120')](db[_0x6389('0x6f')],{'onDelete':_0x6389('0x110'),'as':'Contact'});db[_0x6389('0x54')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x16d'),'foreignKey':_0x6389('0x17e')});db[_0x6389('0x54')]['belongsTo'](db[_0x6389('0x51')],{'as':'Account','foreignKey':_0x6389('0x17a')});db['SmsQueue'][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x132'),'foreignKey':_0x6389('0x17f')});db[_0x6389('0x56')][_0x6389('0x122')](db[_0x6389('0x14d')],{'through':_0x6389('0x180'),'as':_0x6389('0x14e')});db[_0x6389('0x58')][_0x6389('0x114')](db[_0x6389('0x15f')],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x181'),'onDelete':_0x6389('0x110')});db[_0x6389('0x58')]['hasMany'](db[_0x6389('0x7d')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x6389('0x58')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x6389('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0x6389('0x58')][_0x6389('0x114')](db[_0x6389('0x5d')],{'as':_0x6389('0x151'),'foreignKey':'OpenchannelAccountId'});db[_0x6389('0x58')][_0x6389('0x114')](db[_0x6389('0x5a')],{'as':_0x6389('0x13f'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0x6389('0x58')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':'ListId'});db[_0x6389('0x58')][_0x6389('0x120')](db[_0x6389('0x162')],{'as':_0x6389('0x163'),'foreignKey':_0x6389('0x149')});db['OpenchannelAccount'][_0x6389('0x122')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x6389('0x120')](db[_0x6389('0x112')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0x5a')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x6389('0x182')});db[_0x6389('0x5a')][_0x6389('0x120')](db[_0x6389('0x58')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x6389('0x120')](db['Interval'],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x5a')]['belongsTo'](db[_0x6389('0x88')],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x176')});db[_0x6389('0x5b')]['hasMany'](db[_0x6389('0x5d')],{'as':_0x6389('0x151'),'onDelete':'cascade','foreignKey':_0x6389('0x183')});db[_0x6389('0x5b')][_0x6389('0x120')](db[_0x6389('0x58')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x181')});db[_0x6389('0x5b')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x6389('0x5b')][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x167'),'foreignKey':_0x6389('0x111')});db['OpenchannelInteraction'][_0x6389('0x122')](db['Tag'],{'through':_0x6389('0x184'),'as':_0x6389('0x169')});db[_0x6389('0x5b')]['belongsToMany'](db['Tag'],{'through':_0x6389('0x184'),'as':_0x6389('0x16a')});db[_0x6389('0x5b')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x16b'),'through':_0x6389('0x12a'),'foreignKey':_0x6389('0x183')});db[_0x6389('0x5d')][_0x6389('0x120')](db[_0x6389('0x112')],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x112')});db[_0x6389('0x5d')][_0x6389('0x120')](db[_0x6389('0x6f')],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x166')});db[_0x6389('0x5d')]['belongsTo'](db[_0x6389('0x5b')],{'onDelete':'cascade','as':_0x6389('0x16d'),'foreignKey':_0x6389('0x183')});db[_0x6389('0x5d')][_0x6389('0x120')](db[_0x6389('0xe8')],{'as':_0x6389('0xe8'),'foreignKey':'AttachmentId'});db[_0x6389('0x5d')][_0x6389('0x120')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x6389('0x181')});db[_0x6389('0x5f')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':'Agents','through':_0x6389('0x185'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0x6389('0x14d')],{'through':_0x6389('0x186'),'as':_0x6389('0x14e')});db[_0x6389('0x16e')][_0x6389('0x114')](db['Disposition'],{'as':_0x6389('0x160'),'foreignKey':'ChatWebsiteId','onDelete':_0x6389('0x110')});db[_0x6389('0x16e')][_0x6389('0x114')](db[_0x6389('0x7d')],{'as':_0x6389('0x172'),'foreignKey':_0x6389('0x187')});db['ChatWebsite'][_0x6389('0x114')](db[_0x6389('0x6c')],{'as':_0x6389('0x188')});db[_0x6389('0x16e')]['hasMany'](db[_0x6389('0x65')],{'as':'Interactions'});db[_0x6389('0x16e')][_0x6389('0x114')](db[_0x6389('0x63')],{'as':'Applications','foreignKey':_0x6389('0x187'),'onDelete':'cascade'});db[_0x6389('0x16e')]['hasMany'](db[_0x6389('0x67')],{'as':'Messages'});db[_0x6389('0x16e')][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175')});db[_0x6389('0x16e')][_0x6389('0x120')](db[_0x6389('0x80')],{'as':_0x6389('0x80'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x16e')][_0x6389('0x120')](db[_0x6389('0x39')],{'as':_0x6389('0x39'),'foreignKey':'MailAccountId'});db[_0x6389('0x16e')][_0x6389('0x120')](db[_0x6389('0x162')],{'as':_0x6389('0x163'),'foreignKey':_0x6389('0x149')});db[_0x6389('0x16e')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':'Agents','through':_0x6389('0x137')});db[_0x6389('0x189')]['belongsTo'](db[_0x6389('0x58')],{});db['OpenchannelQueueReport'][_0x6389('0x120')](db['CmList'],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175')});db['OpenchannelQueueReport'][_0x6389('0x120')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x6389('0x189')]['belongsTo'](db[_0x6389('0x5b')],{});db[_0x6389('0x189')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x6389('0x189')]['belongsTo'](db[_0x6389('0x112')],{});db[_0x6389('0x189')][_0x6389('0x120')](db[_0x6389('0x5f')],{});db['ChatApplication'][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x18a'),'foreignKey':_0x6389('0x111'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x63')]['belongsTo'](db[_0x6389('0x12f')],{'as':_0x6389('0x18b'),'foreignKey':_0x6389('0x18c'),'onDelete':'restrict'});db[_0x6389('0x63')]['belongsTo'](db[_0x6389('0x16e')],{'as':'Website','foreignKey':_0x6389('0x187'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x63')][_0x6389('0x120')](db[_0x6389('0x88')],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x176')});db[_0x6389('0x65')][_0x6389('0x114')](db[_0x6389('0x67')],{'as':_0x6389('0x151'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x18d')});db[_0x6389('0x65')][_0x6389('0x120')](db[_0x6389('0x16e')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x187')});db[_0x6389('0x65')]['belongsTo'](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x65')][_0x6389('0x120')](db[_0x6389('0x112')],{'as':'Owner','foreignKey':_0x6389('0x111')});db[_0x6389('0x65')]['belongsToMany'](db[_0x6389('0x88')],{'through':_0x6389('0x18e'),'as':_0x6389('0x169')});db['ChatInteraction'][_0x6389('0x122')](db['Tag'],{'through':_0x6389('0x18e'),'as':_0x6389('0x16a')});db['ChatInteraction'][_0x6389('0x122')](db['User'],{'as':'Users','through':_0x6389('0x18f'),'foreignKey':_0x6389('0x18d')});db[_0x6389('0x67')]['belongsTo'](db[_0x6389('0x112')],{'onDelete':_0x6389('0x110'),'as':'User'});db['ChatMessage'][_0x6389('0x120')](db[_0x6389('0x6f')],{'onDelete':'cascade','as':_0x6389('0x166'),'foreignKey':'ContactId'});db[_0x6389('0x67')][_0x6389('0x120')](db[_0x6389('0x65')],{'onDelete':_0x6389('0x110'),'as':'Interaction','foreignKey':_0x6389('0x18d')});db[_0x6389('0x67')][_0x6389('0x120')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x6389('0x67')][_0x6389('0x120')](db[_0x6389('0x16e')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x187')});db[_0x6389('0x69')][_0x6389('0x114')](db[_0x6389('0xe8')],{'as':_0x6389('0x16c'),'foreignKey':_0x6389('0x190'),'onDelete':_0x6389('0x110'),'hooks':!![]});db[_0x6389('0x69')][_0x6389('0x120')](db['CmContact'],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x166'),'foreignKey':'ContactId'});db[_0x6389('0x69')][_0x6389('0x120')](db['ChatWebsite'],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x187')});db[_0x6389('0x12f')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x2d'),'hooks':!![]});db[_0x6389('0x12f')][_0x6389('0x122')](db['Team'],{'through':_0x6389('0x191'),'as':'Teams'});db[_0x6389('0x6a')][_0x6389('0x114')](db[_0x6389('0x192')],{'as':'Messages','foreignKey':_0x6389('0x193'),'onDelete':_0x6389('0x110')});db['ChatGroup'][_0x6389('0x122')](db[_0x6389('0x112')],{'as':'Members','through':_0x6389('0x124')});db[_0x6389('0x6c')]['belongsTo'](db[_0x6389('0x16e')],{'as':'Website','foreignKey':_0x6389('0x187')});db[_0x6389('0x194')][_0x6389('0x114')](db[_0x6389('0x6f')],{'as':'Contacts','foreignKey':_0x6389('0x195')});db[_0x6389('0x6f')][_0x6389('0x114')](db[_0x6389('0x8c')],{'as':_0x6389('0x196'),'foreignKey':_0x6389('0x197')});db['CmContact'][_0x6389('0x114')](db[_0x6389('0x70')],{'as':_0x6389('0x143'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x6f')]['hasMany'](db[_0x6389('0x73')],{'as':_0x6389('0x115'),'foreignKey':'ContactId'});db['CmContact'][_0x6389('0x114')](db[_0x6389('0x75')],{'as':_0x6389('0x144'),'foreignKey':'ContactId'});db[_0x6389('0x6f')][_0x6389('0x114')](db[_0x6389('0x116')],{'as':_0x6389('0x116'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x6f')][_0x6389('0x114')](db[_0x6389('0x146')],{'as':_0x6389('0x198'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x6f')][_0x6389('0x114')](db['OpenchannelInteraction'],{'as':_0x6389('0x117'),'foreignKey':_0x6389('0x157'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x6f')][_0x6389('0x114')](db[_0x6389('0x65')],{'as':_0x6389('0x118'),'foreignKey':'ContactId','onDelete':_0x6389('0x15c')});db['CmContact'][_0x6389('0x114')](db[_0x6389('0x119')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['hasMany'](db['FaxInteraction'],{'as':_0x6389('0x11b'),'foreignKey':_0x6389('0x157'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x6f')][_0x6389('0x114')](db[_0x6389('0x11c')],{'as':_0x6389('0x199'),'foreignKey':_0x6389('0x157'),'onDelete':'restrict'});db[_0x6389('0x6f')][_0x6389('0x120')](db['CmCompany'],{'as':'Company','foreignKey':_0x6389('0x195')});db['CmContact']['belongsTo'](db['CmList'],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175'),'onDelete':_0x6389('0x110')});db['CmContact'][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x16b'),'through':_0x6389('0x19a')});db[_0x6389('0x6f')][_0x6389('0x122')](db[_0x6389('0x88')],{'as':'Tags','through':_0x6389('0x19b')});db[_0x6389('0x6f')]['belongsToMany'](db[_0x6389('0x88')],{'through':_0x6389('0x19b'),'as':_0x6389('0x16a')});db[_0x6389('0x70')][_0x6389('0x114')](db['CmHopperAdditionalPhone'],{'as':_0x6389('0x19c'),'foreignKey':'CmHopperId'});db[_0x6389('0x70')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':'ContactId','onDelete':_0x6389('0x110')});db[_0x6389('0x70')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6389('0x175'),'onDelete':_0x6389('0x110')});db[_0x6389('0x70')]['belongsTo'](db[_0x6389('0x112')],{'as':_0x6389('0x18a'),'foreignKey':_0x6389('0x111')});db['CmHopper']['belongsTo'](db[_0x6389('0x1b')],{'as':_0x6389('0x18b'),'foreignKey':_0x6389('0x142'),'onDelete':_0x6389('0x110')});db[_0x6389('0x70')]['belongsTo'](db['Campaign'],{'as':_0x6389('0x19d'),'foreignKey':_0x6389('0x19e'),'onDelete':_0x6389('0x110')});db[_0x6389('0x70')][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x167'),'foreignKey':_0x6389('0x19f')});db[_0x6389('0x72')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157'),'onDelete':'cascade'});db[_0x6389('0x72')]['belongsTo'](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':'ListId','onDelete':_0x6389('0x110')});db[_0x6389('0x72')]['belongsTo'](db['VoiceQueue'],{'as':_0x6389('0x18b'),'foreignKey':_0x6389('0x142'),'onDelete':_0x6389('0x110')});db['CmHopperBlack']['belongsTo'](db['Campaign'],{'as':_0x6389('0x19d'),'foreignKey':_0x6389('0x19e'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x6389('0x7f')],{'as':{'plural':_0x6389('0x1a0'),'singular':_0x6389('0x1a1')},'foreignKey':_0x6389('0x1a2'),'onDelete':_0x6389('0x110'),'hooks':!![]});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x6389('0x1a3'),'singular':_0x6389('0x1a4')},'foreignKey':_0x6389('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x6389('0x7c')][_0x6389('0x114')](db[_0x6389('0x7a')],{'as':_0x6389('0x1a6'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x6389('0x15f')][_0x6389('0x114')](db[_0x6389('0x15f')],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x1a7'),'onDelete':_0x6389('0x110')});db[_0x6389('0x80')][_0x6389('0x114')](db[_0x6389('0x80')],{'as':_0x6389('0x1a8'),'foreignKey':_0x6389('0x148'),'onDelete':_0x6389('0x110'),'hooks':!![],'required':![]});db[_0x6389('0x80')][_0x6389('0x114')](db[_0x6389('0x18')],{'as':_0x6389('0x1a9'),'foreignKey':'IntervalId','onDelete':_0x6389('0x15c')});db[_0x6389('0x80')][_0x6389('0x114')](db[_0x6389('0x41')],{'as':_0x6389('0x1aa'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x80')][_0x6389('0x114')](db['ChatApplication'],{'as':_0x6389('0x1ab'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x80')][_0x6389('0x114')](db[_0x6389('0x48')],{'as':_0x6389('0x1ac'),'foreignKey':_0x6389('0x148')});db['Interval'][_0x6389('0x114')](db[_0x6389('0x17b')],{'as':_0x6389('0x1ad'),'foreignKey':'IntervalId'});db[_0x6389('0x85')][_0x6389('0x120')](db[_0x6389('0x39')],{});db['Schedule']['belongsTo'](db[_0x6389('0x99')],{'foreignKey':_0x6389('0x1ae')});db[_0x6389('0x85')][_0x6389('0x120')](db[_0x6389('0x97')],{'foreignKey':'CustomReportId'});db[_0x6389('0x87')][_0x6389('0x122')](db[_0x6389('0x1a')],{'as':_0x6389('0x1af'),'through':_0x6389('0x1b0'),'onDelete':'restrict'});db[_0x6389('0x88')][_0x6389('0x122')](db[_0x6389('0x6f')],{'through':_0x6389('0x19b')});db[_0x6389('0x88')]['belongsToMany'](db[_0x6389('0x65')],{'through':'chat_interaction_has_tags'});db[_0x6389('0x88')][_0x6389('0x122')](db[_0x6389('0x11c')],{'through':_0x6389('0x168')});db[_0x6389('0x88')][_0x6389('0x122')](db[_0x6389('0x119')],{'through':_0x6389('0x17c')});db[_0x6389('0x88')][_0x6389('0x122')](db[_0x6389('0x49')],{'through':_0x6389('0x177')});db['Tag'][_0x6389('0x122')](db[_0x6389('0x5b')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x6389('0x122')](db[_0x6389('0xff')],{'through':_0x6389('0x1b1')});db['CmContactHasItem'][_0x6389('0x120')](db[_0x6389('0x8a')],{'as':_0x6389('0x1b2'),'foreignKey':_0x6389('0x1b3')});db['CmHopperAdditionalPhone'][_0x6389('0x120')](db[_0x6389('0x70')],{'as':_0x6389('0x1b4'),'foreignKey':_0x6389('0x1b5')});db['CmContactHasItem'][_0x6389('0x120')](db['CmContact'],{'as':'Contact','foreignKey':_0x6389('0x197')});db[_0x6389('0x92')][_0x6389('0x114')](db[_0x6389('0x7f')],{'as':{'plural':_0x6389('0x1b6'),'singular':_0x6389('0x1b7')},'foreignKey':'TriggerAllId','onDelete':_0x6389('0x110'),'hooks':!![]});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0x6389('0x1b8'),'singular':_0x6389('0x1b9')},'foreignKey':_0x6389('0x1ba'),'onDelete':_0x6389('0x110'),'hooks':!![]});db[_0x6389('0x92')]['hasMany'](db['Action'],{'as':_0x6389('0x1a6'),'foreignKey':'TriggerId','onDelete':_0x6389('0x110'),'hooks':!![]});db[_0x6389('0x97')][_0x6389('0x114')](db['AnalyticFieldReport'],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x6389('0x99')]['hasMany'](db[_0x6389('0x1bc')],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1ae')});db['AnalyticMetric']['hasMany'](db[_0x6389('0x1bc')],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bd')});db[_0x6389('0x1bc')][_0x6389('0x120')](db[_0x6389('0x9c')],{'foreignKey':_0x6389('0x1bd')});db[_0x6389('0xa0')][_0x6389('0x114')](db[_0x6389('0xa2')],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0xa2')]['hasMany'](db[_0x6389('0xa3')],{'as':_0x6389('0x1c0'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c1')});db['SalesforceConfiguration'][_0x6389('0x114')](db[_0x6389('0xa3')],{'as':_0x6389('0x1c2'),'onDelete':_0x6389('0x110'),'foreignKey':'DescriptionId'});db[_0x6389('0xa2')][_0x6389('0x114')](db[_0x6389('0xa3')],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xa2')][_0x6389('0x120')](db[_0x6389('0xa0')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0xa3')]['hasMany'](db[_0x6389('0xa3')],{'as':_0x6389('0x1c4'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0xa3')][_0x6389('0x114')](db['SalesforceField'],{'as':'Description','foreignKey':_0x6389('0x1c5')});db['SalesforceField'][_0x6389('0x114')](db[_0x6389('0xa3')],{'as':_0x6389('0x1c6'),'foreignKey':'FieldId'});db['SalesforceField']['belongsTo'](db[_0x6389('0x94')],{'as':'Variable','foreignKey':_0x6389('0x1c7')});db[_0x6389('0xa5')]['hasMany'](db[_0x6389('0xa7')],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0xa7')][_0x6389('0x114')](db[_0x6389('0xa8')],{'as':_0x6389('0x1c0'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0xa7')][_0x6389('0x114')](db['SugarcrmField'],{'as':_0x6389('0x1c2'),'onDelete':'cascade','foreignKey':_0x6389('0x1c5')});db[_0x6389('0xa7')][_0x6389('0x114')](db[_0x6389('0xa8')],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c3')});db['SugarcrmConfiguration'][_0x6389('0x120')](db[_0x6389('0xa5')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0xa8')][_0x6389('0x114')](db[_0x6389('0xa8')],{'as':_0x6389('0x1c4'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0xa8')][_0x6389('0x114')](db[_0x6389('0xa8')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db['SugarcrmField'][_0x6389('0x114')](db['SugarcrmField'],{'as':_0x6389('0x1c6'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xa8')][_0x6389('0x120')](db[_0x6389('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6389('0xaa')][_0x6389('0x114')](db[_0x6389('0x1c9')],{'as':'Configurations','onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0x1c9')][_0x6389('0x114')](db[_0x6389('0x1ca')],{'as':'Subjects','onDelete':_0x6389('0x110'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x6389('0x114')](db[_0x6389('0x1ca')],{'as':'Descriptions','onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0x1c9')][_0x6389('0x114')](db['DeskField'],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0x1c9')]['belongsTo'](db[_0x6389('0xaa')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0x1c9')][_0x6389('0x122')](db[_0x6389('0x88')],{'through':'int_desk_configuration_has_tags'});db[_0x6389('0x1ca')]['hasMany'](db['DeskField'],{'as':_0x6389('0x1c4'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0x1ca')][_0x6389('0x114')](db[_0x6389('0x1ca')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0x1ca')][_0x6389('0x114')](db['DeskField'],{'as':_0x6389('0x1c6'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0x1ca')][_0x6389('0x120')](db[_0x6389('0x94')],{'as':_0x6389('0x94'),'foreignKey':_0x6389('0x1c7')});db[_0x6389('0x1cb')][_0x6389('0x114')](db[_0x6389('0xae')],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0xae')][_0x6389('0x114')](db['ZohoField'],{'as':_0x6389('0x1c0'),'onDelete':'cascade','foreignKey':_0x6389('0x1c1')});db[_0x6389('0xae')][_0x6389('0x114')](db[_0x6389('0xb0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6389('0x1c5')});db['ZohoConfiguration'][_0x6389('0x114')](db['ZohoField'],{'as':'Fields','onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c3')});db['ZohoConfiguration'][_0x6389('0x120')](db['ZohoAccount'],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x1bf')});db['ZohoField']['hasMany'](db[_0x6389('0xb0')],{'as':_0x6389('0x1c4'),'foreignKey':'SubjectId'});db[_0x6389('0xb0')][_0x6389('0x114')](db[_0x6389('0xb0')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0xb0')][_0x6389('0x114')](db[_0x6389('0xb0')],{'as':_0x6389('0x1c6'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xb0')][_0x6389('0x120')](db[_0x6389('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6389('0x1cc')][_0x6389('0x114')](db[_0x6389('0xb2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6389('0x1bf')});db[_0x6389('0xb2')]['hasMany'](db[_0x6389('0x1cd')],{'as':'Subjects','foreignKey':_0x6389('0x1c1')});db[_0x6389('0xb2')][_0x6389('0x114')](db[_0x6389('0x1cd')],{'as':'Descriptions','foreignKey':_0x6389('0x1c5')});db[_0x6389('0xb2')]['hasMany'](db[_0x6389('0x1cd')],{'as':_0x6389('0x1bb'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xb2')]['belongsTo'](db[_0x6389('0x1cc')],{'as':'Account','foreignKey':_0x6389('0x1bf')});db[_0x6389('0xb2')][_0x6389('0x122')](db['Tag'],{'through':_0x6389('0x1ce')});db['ZendeskField'][_0x6389('0x114')](db[_0x6389('0x1cd')],{'as':_0x6389('0x1c4'),'foreignKey':'SubjectId'});db[_0x6389('0x1cd')][_0x6389('0x114')](db[_0x6389('0x1cd')],{'as':_0x6389('0x1c8'),'foreignKey':'DescriptionId'});db[_0x6389('0x1cd')][_0x6389('0x114')](db['ZendeskField'],{'as':_0x6389('0x1c6'),'foreignKey':_0x6389('0x1c3')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0x6389('0x94'),'foreignKey':_0x6389('0x1c7')});db[_0x6389('0x1cf')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db['FreshdeskConfiguration'][_0x6389('0x114')](db[_0x6389('0xb8')],{'as':_0x6389('0x1c0'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0xb6')][_0x6389('0x114')](db[_0x6389('0xb8')],{'as':_0x6389('0x1c2'),'onDelete':_0x6389('0x110'),'foreignKey':'DescriptionId'});db[_0x6389('0xb6')][_0x6389('0x114')](db[_0x6389('0xb8')],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':'FieldId'});db[_0x6389('0xb6')][_0x6389('0x120')](db[_0x6389('0x1cf')],{'as':'Account','foreignKey':'AccountId'});db[_0x6389('0xb6')][_0x6389('0x122')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x6389('0xb8')][_0x6389('0x114')](db[_0x6389('0xb8')],{'as':_0x6389('0x1c4'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0xb8')][_0x6389('0x114')](db[_0x6389('0xb8')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0xb8')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x6389('0x1c3')});db[_0x6389('0xb8')][_0x6389('0x120')](db['Variable'],{'as':_0x6389('0x94'),'foreignKey':'VariableId'});db[_0x6389('0x1d0')]['hasMany'](db[_0x6389('0xbb')],{'as':_0x6389('0x1be'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x6389('0x114')](db[_0x6389('0xbd')],{'as':_0x6389('0x1c0'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0xbb')][_0x6389('0x114')](db['VtigerField'],{'as':_0x6389('0x1c2'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0xbb')][_0x6389('0x114')](db[_0x6389('0xbd')],{'as':_0x6389('0x1bb'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xbb')][_0x6389('0x120')](db[_0x6389('0x1d0')],{'as':_0x6389('0x165'),'foreignKey':'AccountId'});db[_0x6389('0xbd')][_0x6389('0x114')](db[_0x6389('0xbd')],{'as':'Subject','foreignKey':_0x6389('0x1c1')});db[_0x6389('0xbd')][_0x6389('0x114')](db[_0x6389('0xbd')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db['VtigerField'][_0x6389('0x114')](db[_0x6389('0xbd')],{'as':_0x6389('0x1c6'),'foreignKey':'FieldId'});db[_0x6389('0xbd')]['belongsTo'](db[_0x6389('0x94')],{'as':_0x6389('0x94'),'foreignKey':_0x6389('0x1c7')});db['ServicenowAccount'][_0x6389('0x114')](db['ServicenowConfiguration'],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db[_0x6389('0xc0')][_0x6389('0x114')](db[_0x6389('0xc2')],{'as':'Subjects','foreignKey':_0x6389('0x1c1')});db[_0x6389('0xc0')]['hasMany'](db[_0x6389('0xc2')],{'as':_0x6389('0x1c2'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0xc0')][_0x6389('0x114')](db[_0x6389('0xc2')],{'as':_0x6389('0x1bb'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xc0')][_0x6389('0x120')](db[_0x6389('0xbe')],{'as':'Account','foreignKey':'AccountId'});db[_0x6389('0xc2')][_0x6389('0x114')](db['ServicenowField'],{'as':_0x6389('0x1c4'),'foreignKey':'SubjectId'});db[_0x6389('0xc2')][_0x6389('0x114')](db[_0x6389('0xc2')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0xc2')][_0x6389('0x114')](db['ServicenowField'],{'as':_0x6389('0x1c6'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0xc2')]['belongsTo'](db[_0x6389('0x94')],{'as':_0x6389('0x94'),'foreignKey':_0x6389('0x1c7')});db[_0x6389('0xc3')][_0x6389('0x114')](db[_0x6389('0x1d1')],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1bf')});db['Dynamics365Account'][_0x6389('0x120')](db[_0x6389('0x15a')],{'as':_0x6389('0x15a'),'foreignKey':_0x6389('0x15b')});db[_0x6389('0x1d1')][_0x6389('0x114')](db['Dynamics365Field'],{'as':_0x6389('0x1c0'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c1')});db[_0x6389('0x1d1')][_0x6389('0x114')](db[_0x6389('0x1d2')],{'as':'Descriptions','onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0x1d1')]['hasMany'](db['Dynamics365Field'],{'as':_0x6389('0x1bb'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0x1d1')][_0x6389('0x120')](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x6389('0x1d2')][_0x6389('0x114')](db['Dynamics365Field'],{'as':_0x6389('0x1c4'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0x6389('0x114')](db[_0x6389('0x1d2')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0x1d2')][_0x6389('0x114')](db[_0x6389('0x1d2')],{'as':_0x6389('0x1c6'),'foreignKey':_0x6389('0x1c3')});db[_0x6389('0x1d2')][_0x6389('0x120')](db[_0x6389('0x94')],{'as':_0x6389('0x94'),'foreignKey':_0x6389('0x1c7')});db[_0x6389('0xc7')][_0x6389('0x114')](db['FreshsalesConfiguration'],{'as':_0x6389('0x1be'),'onDelete':_0x6389('0x110'),'foreignKey':'AccountId'});db[_0x6389('0xc9')][_0x6389('0x114')](db[_0x6389('0x1d3')],{'as':_0x6389('0x1c0'),'foreignKey':_0x6389('0x1c1')});db['FreshsalesConfiguration']['hasMany'](db[_0x6389('0x1d3')],{'as':_0x6389('0x1c2'),'foreignKey':_0x6389('0x1c5')});db[_0x6389('0xc9')]['hasMany'](db[_0x6389('0x1d3')],{'as':'Fields','foreignKey':_0x6389('0x1c3')});db[_0x6389('0xc9')][_0x6389('0x120')](db[_0x6389('0xc7')],{'as':_0x6389('0x165'),'foreignKey':'AccountId'});db[_0x6389('0x1d3')]['hasMany'](db[_0x6389('0x1d3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6389('0x1d3')][_0x6389('0x114')](db[_0x6389('0x1d3')],{'as':_0x6389('0x1c8'),'foreignKey':_0x6389('0x1c5')});db['FreshsalesField'][_0x6389('0x114')](db[_0x6389('0x1d3')],{'as':'Field','foreignKey':'FieldId'});db[_0x6389('0x1d3')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x6389('0x1c7')});db[_0x6389('0xcd')][_0x6389('0x120')](db[_0x6389('0x16e')],{});db['ChatQueueReport'][_0x6389('0x120')](db['CmList'],{'as':'List','foreignKey':_0x6389('0x175')});db[_0x6389('0xcd')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db['ChatQueueReport']['belongsTo'](db[_0x6389('0x65')],{});db[_0x6389('0xcd')]['belongsTo'](db[_0x6389('0x67')],{});db[_0x6389('0xcd')]['belongsTo'](db[_0x6389('0x112')],{});db['ChatQueueReport']['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0x6389('0x120')](db[_0x6389('0x112')],{'onDelete':_0x6389('0x110'),'foreignKey':'FromId'});db[_0x6389('0x192')][_0x6389('0x120')](db['User'],{'onDelete':'cascade','foreignKey':_0x6389('0x1d4')});db[_0x6389('0x146')][_0x6389('0x114')](db[_0x6389('0x1d5')],{'foreignKey':'SessionId','onDelete':_0x6389('0x110')});db['JscriptySessionReport'][_0x6389('0x114')](db[_0x6389('0xd0')],{'foreignKey':_0x6389('0x1d6'),'onDelete':_0x6389('0x110')});db[_0x6389('0xd4')]['belongsTo'](db[_0x6389('0x51')],{});db[_0x6389('0xd4')][_0x6389('0x120')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x6389('0xd4')][_0x6389('0x120')](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db[_0x6389('0xd4')][_0x6389('0x120')](db[_0x6389('0x119')],{});db[_0x6389('0xd4')]['belongsTo'](db[_0x6389('0x54')],{});db['SmsQueueReport']['belongsTo'](db['User'],{});db[_0x6389('0xd4')][_0x6389('0x120')](db[_0x6389('0x56')],{});db[_0x6389('0xd9')][_0x6389('0x114')](db[_0x6389('0x146')],{'foreignKey':_0x6389('0x1d7')});db['JscriptyProject'][_0x6389('0x114')](db[_0x6389('0x1d5')],{'foreignKey':_0x6389('0x1d7')});db[_0x6389('0xd9')]['hasMany'](db[_0x6389('0xd0')],{'foreignKey':_0x6389('0x1d7')});db[_0x6389('0x14d')][_0x6389('0x122')](db['User'],{'as':'Agents','through':_0x6389('0x127')});db['Team'][_0x6389('0x122')](db[_0x6389('0x1b')],{'through':_0x6389('0x108'),'as':_0x6389('0x12c')});db[_0x6389('0x14d')][_0x6389('0x122')](db[_0x6389('0x3b')],{'through':_0x6389('0x1d8'),'as':_0x6389('0x12e')});db['Team'][_0x6389('0x122')](db[_0x6389('0x12f')],{'through':_0x6389('0x191'),'as':'ChatQueues'});db[_0x6389('0x14d')][_0x6389('0x122')](db[_0x6389('0x4d')],{'through':_0x6389('0x1d9'),'as':_0x6389('0x1da')});db[_0x6389('0x14d')][_0x6389('0x122')](db['SmsQueue'],{'through':_0x6389('0x180'),'as':_0x6389('0x131')});db[_0x6389('0x14d')][_0x6389('0x122')](db[_0x6389('0x5f')],{'through':_0x6389('0x186'),'as':'OpenchannelQueues'});db[_0x6389('0x14d')][_0x6389('0x122')](db[_0x6389('0x134')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db['Team'][_0x6389('0x122')](db[_0x6389('0xf5')],{'through':_0x6389('0x10a'),'as':_0x6389('0x12d')});db[_0x6389('0x19d')][_0x6389('0x114')](db['CmHopper'],{'as':_0x6389('0x143'),'foreignKey':'CampaignId'});db[_0x6389('0x19d')][_0x6389('0x114')](db[_0x6389('0x73')],{'as':_0x6389('0x115'),'foreignKey':_0x6389('0x19e')});db[_0x6389('0x19d')][_0x6389('0x114')](db[_0x6389('0x75')],{'as':_0x6389('0x144'),'foreignKey':'CampaignId'});db[_0x6389('0x19d')][_0x6389('0x114')](db[_0x6389('0x72')],{'as':_0x6389('0x145'),'foreignKey':_0x6389('0x19e')});db['Campaign']['belongsTo'](db[_0x6389('0x28')],{'as':_0x6389('0x28'),'foreignKey':_0x6389('0x147')});db[_0x6389('0x19d')][_0x6389('0x120')](db[_0x6389('0x28')],{'as':_0x6389('0x1db'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x6389('0x120')](db['Interval'],{'as':_0x6389('0x80'),'foreignKey':_0x6389('0x148')});db[_0x6389('0x19d')]['belongsTo'](db['SquareProject'],{'as':_0x6389('0xdf'),'foreignKey':_0x6389('0x1dc')});db['Campaign'][_0x6389('0x122')](db[_0x6389('0xf3')],{'as':_0x6389('0x14a'),'through':_0x6389('0x1dd')});db[_0x6389('0x19d')]['belongsToMany'](db[_0x6389('0xf3')],{'as':_0x6389('0x14f'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x6389('0x120')](db[_0x6389('0x69')],{'as':_0x6389('0x69'),'foreignKey':_0x6389('0x190')});db[_0x6389('0xeb')][_0x6389('0x120')](db['MailMessage'],{});db['MailTransferReport'][_0x6389('0x120')](db[_0x6389('0x11c')],{});db[_0x6389('0xeb')]['belongsTo'](db[_0x6389('0x39')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x6389('0xeb')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1de'),'as':_0x6389('0x1df')});db[_0x6389('0xeb')][_0x6389('0x120')](db['User'],{'foreignKey':_0x6389('0x1e0'),'as':_0x6389('0x1e1')});db[_0x6389('0xeb')][_0x6389('0x120')](db['MailQueue'],{'foreignKey':_0x6389('0x1e2'),'as':'ToQueue'});db[_0x6389('0xeb')][_0x6389('0x120')](db[_0x6389('0x39')],{'foreignKey':_0x6389('0x1e3'),'as':_0x6389('0x1e4')});db[_0x6389('0x1e5')][_0x6389('0x120')](db['ChatMessage'],{});db[_0x6389('0x1e5')][_0x6389('0x120')](db[_0x6389('0x65')],{});db[_0x6389('0x1e5')][_0x6389('0x120')](db['ChatWebsite'],{'foreignKey':_0x6389('0x1e6'),'as':'FromAccount'});db[_0x6389('0x1e5')]['belongsTo'](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1de'),'as':_0x6389('0x1df')});db[_0x6389('0x1e5')][_0x6389('0x120')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x6389('0x1e5')][_0x6389('0x120')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x6389('0x1e7')});db[_0x6389('0x1e5')]['belongsTo'](db[_0x6389('0x16e')],{'foreignKey':_0x6389('0x1e8'),'as':'ToAccount'});db[_0x6389('0xee')][_0x6389('0x120')](db[_0x6389('0x4b')],{});db[_0x6389('0xee')][_0x6389('0x120')](db[_0x6389('0x49')],{});db['FaxTransferReport']['belongsTo'](db[_0x6389('0x46')],{'foreignKey':_0x6389('0x1e9'),'as':_0x6389('0x1ea')});db[_0x6389('0xee')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':'FromUserId','as':_0x6389('0x1df')});db[_0x6389('0xee')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1e0'),'as':_0x6389('0x1e1')});db['FaxTransferReport'][_0x6389('0x120')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x6389('0x1e7')});db['FaxTransferReport'][_0x6389('0x120')](db[_0x6389('0x46')],{'foreignKey':_0x6389('0x1eb'),'as':_0x6389('0x1e4')});db[_0x6389('0xf0')]['belongsTo'](db[_0x6389('0x5d')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x6389('0x5b')],{});db[_0x6389('0xf0')]['belongsTo'](db[_0x6389('0x58')],{'foreignKey':_0x6389('0x1ec'),'as':'FromAccount'});db[_0x6389('0xf0')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1de'),'as':'FromAgent'});db[_0x6389('0xf0')][_0x6389('0x120')](db['User'],{'foreignKey':'ToUserId','as':_0x6389('0x1e1')});db[_0x6389('0xf0')][_0x6389('0x120')](db[_0x6389('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':_0x6389('0x1e7')});db[_0x6389('0xf0')][_0x6389('0x120')](db[_0x6389('0x58')],{'foreignKey':_0x6389('0x1ed'),'as':_0x6389('0x1e4')});db[_0x6389('0xf1')][_0x6389('0x120')](db['SmsMessage'],{});db[_0x6389('0xf1')][_0x6389('0x120')](db[_0x6389('0x119')],{});db[_0x6389('0xf1')][_0x6389('0x120')](db[_0x6389('0x51')],{'foreignKey':_0x6389('0x1ee'),'as':_0x6389('0x1ea')});db['SmsTransferReport']['belongsTo'](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1de'),'as':_0x6389('0x1df')});db[_0x6389('0xf1')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':'ToUserId','as':_0x6389('0x1e1')});db[_0x6389('0xf1')]['belongsTo'](db[_0x6389('0x56')],{'foreignKey':_0x6389('0x1ef'),'as':_0x6389('0x1e7')});db[_0x6389('0xf1')][_0x6389('0x120')](db[_0x6389('0x51')],{'foreignKey':_0x6389('0x1f0'),'as':'ToAccount'});db[_0x6389('0xf3')]['hasMany'](db[_0x6389('0x15f')],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x175'),'onDelete':_0x6389('0x110')});db['CmList'][_0x6389('0x114')](db[_0x6389('0x78')],{'as':_0x6389('0x1f1'),'foreignKey':_0x6389('0x175')});db[_0x6389('0xf3')][_0x6389('0x114')](db[_0x6389('0x6f')],{'as':_0x6389('0x125'),'onDelete':'cascade','foreignKey':_0x6389('0x175')});db[_0x6389('0xf3')]['hasMany'](db[_0x6389('0x73')],{'as':_0x6389('0x115'),'foreignKey':_0x6389('0x175')});db[_0x6389('0xf3')][_0x6389('0x114')](db[_0x6389('0x75')],{'as':_0x6389('0x1f2'),'foreignKey':'ListId'});db['CmList'][_0x6389('0x114')](db['ReportAgentPreview'],{'as':_0x6389('0x116'),'foreignKey':_0x6389('0x175')});db['CmList'][_0x6389('0x122')](db[_0x6389('0x1b')],{'as':_0x6389('0x1f3'),'through':_0x6389('0x1f4')});db[_0x6389('0xf3')][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x126')});db[_0x6389('0xf5')][_0x6389('0x114')](db[_0x6389('0x18')],{'as':_0x6389('0x1a9'),'onDelete':'cascade'});db[_0x6389('0xf5')][_0x6389('0x122')](db['User'],{'as':_0x6389('0x14b'),'through':'UserVoicePrefix'});db[_0x6389('0xf5')][_0x6389('0x122')](db['Team'],{'through':_0x6389('0x10a'),'as':_0x6389('0x14e')});db[_0x6389('0xf7')][_0x6389('0x114')](db[_0x6389('0x112')],{'as':_0x6389('0x16b'),'foreignKey':_0x6389('0x121')});db[_0x6389('0xf7')][_0x6389('0x114')](db[_0x6389('0xf8')],{'as':_0x6389('0x1f5'),'foreignKey':_0x6389('0x121'),'onDelete':_0x6389('0x110')});db['UserProfileSection'][_0x6389('0x114')](db['UserProfileResource'],{'as':_0x6389('0x1f6'),'foreignKey':_0x6389('0x1f7'),'onDelete':_0x6389('0x110')});db[_0x6389('0xfc')][_0x6389('0x114')](db['Disposition'],{'as':_0x6389('0x160'),'foreignKey':_0x6389('0x1f8'),'onDelete':'cascade'});db[_0x6389('0xfc')][_0x6389('0x114')](db[_0x6389('0x7d')],{'as':_0x6389('0x172'),'foreignKey':_0x6389('0x1f8')});db[_0x6389('0xfc')][_0x6389('0x114')](db[_0x6389('0x101')],{'as':_0x6389('0x151'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x6389('0x114')](db[_0x6389('0xff')],{'as':'Interactions'});db[_0x6389('0xfc')][_0x6389('0x114')](db[_0x6389('0xfe')],{'as':_0x6389('0x13f'),'foreignKey':_0x6389('0x1f8'),'onDelete':'cascade'});db[_0x6389('0xfc')][_0x6389('0x120')](db['CmList'],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175')});db[_0x6389('0xfc')][_0x6389('0x120')](db[_0x6389('0x162')],{'as':_0x6389('0x163'),'foreignKey':_0x6389('0x149')});db['WhatsappAccount'][_0x6389('0x122')](db[_0x6389('0x112')],{'as':_0x6389('0x14b'),'through':_0x6389('0x1f9')});db[_0x6389('0xfe')][_0x6389('0x120')](db[_0x6389('0x112')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0xfe')][_0x6389('0x120')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0x6389('0xfe')][_0x6389('0x120')](db[_0x6389('0xfc')],{'onDelete':_0x6389('0x15c')});db[_0x6389('0xfe')][_0x6389('0x120')](db[_0x6389('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x6389('0xfe')][_0x6389('0x120')](db[_0x6389('0x88')],{'onDelete':_0x6389('0x15c'),'foreignKey':_0x6389('0x176')});db[_0x6389('0xff')]['hasMany'](db[_0x6389('0x101')],{'as':_0x6389('0x151'),'onDelete':_0x6389('0x110'),'foreignKey':_0x6389('0x1fa')});db[_0x6389('0xff')][_0x6389('0x120')](db[_0x6389('0xfc')],{'as':_0x6389('0x165'),'foreignKey':_0x6389('0x1f8')});db[_0x6389('0xff')]['belongsTo'](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':_0x6389('0x167'),'foreignKey':_0x6389('0x111')});db['WhatsappInteraction'][_0x6389('0x122')](db[_0x6389('0x88')],{'through':_0x6389('0x1b1'),'as':_0x6389('0x169')});db[_0x6389('0xff')]['belongsToMany'](db[_0x6389('0x88')],{'through':_0x6389('0x1b1'),'as':_0x6389('0x16a')});db[_0x6389('0xff')]['belongsToMany'](db['User'],{'as':_0x6389('0x16b'),'through':'user_has_whatsapp_interactions','foreignKey':_0x6389('0x1fa')});db[_0x6389('0x101')][_0x6389('0x120')](db['User'],{'as':_0x6389('0x112')});db[_0x6389('0x101')][_0x6389('0x120')](db[_0x6389('0x6f')],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x166')});db[_0x6389('0x101')]['belongsTo'](db[_0x6389('0xff')],{'onDelete':_0x6389('0x110'),'as':_0x6389('0x16d'),'foreignKey':_0x6389('0x1fa')});db[_0x6389('0x101')][_0x6389('0x120')](db[_0x6389('0xfc')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x6389('0x103')][_0x6389('0x120')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x6389('0x120')](db[_0x6389('0xf3')],{'as':_0x6389('0x161'),'foreignKey':_0x6389('0x175')});db[_0x6389('0x103')]['belongsTo'](db[_0x6389('0x6f')],{'as':_0x6389('0x166'),'foreignKey':_0x6389('0x157')});db[_0x6389('0x103')]['belongsTo'](db[_0x6389('0xff')],{});db[_0x6389('0x103')][_0x6389('0x120')](db[_0x6389('0x134')],{});db[_0x6389('0x103')][_0x6389('0x120')](db[_0x6389('0x101')],{});db[_0x6389('0x103')][_0x6389('0x120')](db[_0x6389('0x112')],{});db[_0x6389('0x104')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x6389('0x120')](db[_0x6389('0xff')],{});db[_0x6389('0x104')][_0x6389('0x120')](db[_0x6389('0xfc')],{'foreignKey':_0x6389('0x1fb'),'as':_0x6389('0x1ea')});db['WhatsappTransferReport']['belongsTo'](db[_0x6389('0xfc')],{'foreignKey':_0x6389('0x1fc'),'as':_0x6389('0x1e4')});db['WhatsappTransferReport'][_0x6389('0x120')](db[_0x6389('0x134')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x6389('0x104')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1de'),'as':_0x6389('0x1df')});db[_0x6389('0x104')][_0x6389('0x120')](db[_0x6389('0x112')],{'foreignKey':_0x6389('0x1e0'),'as':_0x6389('0x1e1')});db[_0x6389('0x134')][_0x6389('0x122')](db['User'],{'as':_0x6389('0x14b'),'through':_0x6389('0x35'),'foreignKey':_0x6389('0x1fd')});db[_0x6389('0x134')][_0x6389('0x122')](db['Team'],{'through':_0x6389('0x1fe'),'as':'Teams'});db[_0x6389('0x10e')][_0x6389('0x120')](db[_0x6389('0x112')],{'as':_0x6389('0x1ff'),'foreignKey':_0x6389('0x111'),'onDelete':_0x6389('0x110'),'hooks':!![]});db[_0x6389('0x15a')][_0x6389('0x10f')](db[_0x6389('0xc3')],{'as':_0x6389('0xc3'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x15a')][_0x6389('0x10f')](db[_0x6389('0x159')],{'as':_0x6389('0x15d'),'onDelete':_0x6389('0x15c')});db[_0x6389('0x15a')][_0x6389('0x10f')](db[_0x6389('0x37')],{'as':_0x6389('0x15e'),'onDelete':_0x6389('0x15c')});module[_0x6389('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xdcdc=['ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','List','Items','FaxAccountId','Interactions','Exntensions','FaxApplication','FaxQueue','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','ChatOfflineMessage','team_has_chat_queues','ChatInternalMessage','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','OneAny','AutomationAnyId','Action','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemTypeId','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','SugarcrmField','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','ServicenowField','FreshsalesField','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','ChatQueues','team_has_whatsapp_queues','TeamVoicePrefix','TrunkBackupId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_interactions','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','database','password','options','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','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','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.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','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxMessage','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','FaxInteraction','MailInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','belongsTo','userProfileId','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','UserChatQueue','SmsQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','mandatoryDispositionPause','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailMessage','Interaction'];(function(_0xc358e8,_0x46a6e0){var _0x4b214d=function(_0x27f751){while(--_0x27f751){_0xc358e8['push'](_0xc358e8['shift']());}};_0x4b214d(++_0x46a6e0);}(_0xdcdc,0x8f));var _0xcdcd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcdc[_0x502c7d];return _0x30b7ed;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xcdcd('0x0'));var _=require(_0xcdcd('0x1'));var jstz=require(_0xcdcd('0x2'));var timezone=jstz[_0xcdcd('0x3')]();config[_0xcdcd('0x0')]=_[_0xcdcd('0x4')](config[_0xcdcd('0x0')],{'database':_0xcdcd('0x5'),'username':_0xcdcd('0x6'),'password':_0xcdcd('0x7'),'options':{'host':_0xcdcd('0x8'),'port':0xcea,'dialect':_0xcdcd('0x9'),'dialectOptions':{'charset':_0xcdcd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xcdcd('0xb')}}});config[_0xcdcd('0xc')]=_[_0xcdcd('0x4')](config[_0xcdcd('0xc')],{'database':_0xcdcd('0x5'),'username':_0xcdcd('0x6'),'password':'xC@LL1234','options':{'host':_0xcdcd('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xcdcd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdcd('0x0')][_0xcdcd('0xd')],config[_0xcdcd('0x0')]['username'],config[_0xcdcd('0x0')][_0xcdcd('0xe')],config[_0xcdcd('0x0')][_0xcdcd('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdcd('0xc')][_0xcdcd('0xd')],config['sequelizeHistory'][_0xcdcd('0x10')],config['sequelizeHistory'][_0xcdcd('0xe')],config[_0xcdcd('0xc')]['options'])};db['User']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x12'));db[_0xcdcd('0x13')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x14'));db[_0xcdcd('0x15')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/voiceContext/voiceContext.model');db[_0xcdcd('0x16')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0xcdcd('0x17')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xcdcd('0x18')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x19'));db[_0xcdcd('0x1a')]=db['sequelize']['import']('../api/voiceRecording/voiceRecording.model');db[_0xcdcd('0x1b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/screenRecording/screenRecording.model');db[_0xcdcd('0x1c')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x1d'));db[_0xcdcd('0x1e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x1f'));db[_0xcdcd('0x20')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x21'));db[_0xcdcd('0x22')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x23'));db[_0xcdcd('0x24')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x25'));db[_0xcdcd('0x26')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x27'));db[_0xcdcd('0x28')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x29'));db[_0xcdcd('0x2a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x2b'));db[_0xcdcd('0x2c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x2d'));db[_0xcdcd('0x2e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x2f'));db['UserVoiceQueue']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x30'));db['UserChatQueue']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x31'));db[_0xcdcd('0x32')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x33'));db[_0xcdcd('0x34')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x35'));db[_0xcdcd('0x36')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x37'));db[_0xcdcd('0x38')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x39'));db[_0xcdcd('0x3a')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x3b'));db[_0xcdcd('0x3c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x3d'));db[_0xcdcd('0x3e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x3f'));db[_0xcdcd('0x40')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x41'));db['MailQueue']=db[_0xcdcd('0x0')]['import']('../api/mailQueue/mailQueue.model');db[_0xcdcd('0x42')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x43'));db[_0xcdcd('0x44')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x45'));db['MailMessage']=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x46'));db[_0xcdcd('0x47')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x48'));db['MailQueueReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x49'));db[_0xcdcd('0x4a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/dashboard/dashboard.model');db[_0xcdcd('0x4b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x4c'));db[_0xcdcd('0x4d')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x4e'));db['FaxApplication']=db['sequelize'][_0xcdcd('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0xcdcd('0x4f')]=db['sequelize'][_0xcdcd('0x11')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/faxQueue/faxQueue.model');db[_0xcdcd('0x50')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x51'));db['SmsAccount']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x52'));db[_0xcdcd('0x53')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x54'));db[_0xcdcd('0x55')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0xcdcd('0x0')]['import']('../api/smsMessage/smsMessage.model');db[_0xcdcd('0x56')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x57'));db[_0xcdcd('0x58')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x59'));db['OpenchannelApplication']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x5a'));db['OpenchannelInteraction']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x5b'));db[_0xcdcd('0x5c')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x5d'));db[_0xcdcd('0x5e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x5f'));db['ChatWebsite']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x60'));db[_0xcdcd('0x61')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x62'));db[_0xcdcd('0x63')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x64'));db[_0xcdcd('0x65')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xcdcd('0x66')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x67'));db[_0xcdcd('0x68')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x69'));db[_0xcdcd('0x6a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x6b'));db[_0xcdcd('0x6c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x6d'));db[_0xcdcd('0x6e')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x6f'));db['CmHopper']=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x70'));db[_0xcdcd('0x71')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x72'));db[_0xcdcd('0x73')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x74'));db[_0xcdcd('0x75')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x76'));db[_0xcdcd('0x77')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x78'));db[_0xcdcd('0x79')]=db['sequelize']['import'](_0xcdcd('0x7a'));db['Action']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/action/action.model');db[_0xcdcd('0x7b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x7c'));db[_0xcdcd('0x7d')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x7e'));db[_0xcdcd('0x7f')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x80'));db['Condition']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x81'));db[_0xcdcd('0x82')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x83'));db[_0xcdcd('0x84')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x85'));db['Cdr']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x86'));db[_0xcdcd('0x87')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xcdcd('0x88')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x89'));db[_0xcdcd('0x8a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x8b'));db[_0xcdcd('0x8c')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x8d'));db[_0xcdcd('0x8e')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x8f'));db[_0xcdcd('0x90')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0x91'));db[_0xcdcd('0x92')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x93'));db[_0xcdcd('0x94')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x95'));db[_0xcdcd('0x96')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x97'));db[_0xcdcd('0x98')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x99'));db[_0xcdcd('0x9a')]=db[_0xcdcd('0x0')]['import']('../api/integration/integration.model');db[_0xcdcd('0x9b')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x9c'));db['AnalyticCustomReport']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x9d'));db['AnalyticDefaultReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x9e'));db['AnalyticExtractedReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x9f'));db[_0xcdcd('0xa0')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xa1'));db[_0xcdcd('0xa2')]=db['sequelize']['import'](_0xcdcd('0xa3'));db[_0xcdcd('0xa4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xa5'));db[_0xcdcd('0xa6')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xa7'));db[_0xcdcd('0xa8')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xa9'));db[_0xcdcd('0xaa')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intSalesforceField/intSalesforceField.model');db[_0xcdcd('0xab')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xac'));db[_0xcdcd('0xad')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xae'));db['SugarcrmField']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xaf'));db[_0xcdcd('0xb0')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0xcdcd('0xb1')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xcdcd('0xb2')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xb3'));db[_0xcdcd('0xb4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xb5'));db['ZohoConfiguration']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xb6'));db[_0xcdcd('0xb7')]=db[_0xcdcd('0x0')]['import']('../api/intZohoField/intZohoField.model');db[_0xcdcd('0xb8')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xb9'));db[_0xcdcd('0xba')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xbb'));db[_0xcdcd('0xbc')]=db['sequelize'][_0xcdcd('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0xcdcd('0xbd')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xbe'));db[_0xcdcd('0xbf')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xc0'));db[_0xcdcd('0xc1')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xc2'));db['VtigerAccount']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xc3'));db[_0xcdcd('0xc4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xc5'));db[_0xcdcd('0xc6')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xc7'));db[_0xcdcd('0xc8')]=db['sequelize'][_0xcdcd('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0xcdcd('0x0')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xcdcd('0xc9')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xca'));db[_0xcdcd('0xcb')]=db['sequelize']['import'](_0xcdcd('0xcc'));db[_0xcdcd('0xcd')]=db['sequelize'][_0xcdcd('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xcdcd('0xce')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xcf'));db[_0xcdcd('0xd0')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xd1'));db['FreshsalesField']=db[_0xcdcd('0x0')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xcdcd('0x9a')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xd2'));db[_0xcdcd('0xd3')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/network/network.model');db[_0xcdcd('0xd4')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xd5'));db['ChatInternalMessage']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xcdcd('0xd6')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xcdcd('0xd7')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xd8'));db[_0xcdcd('0xd9')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xcdcd('0xda')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xdb'));db[_0xcdcd('0xdc')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xdd'));db[_0xcdcd('0xde')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0xcdcd('0xdf')]=db['sequelize'][_0xcdcd('0x11')]('../api/setting/setting.model');db[_0xcdcd('0xe0')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xe1'));db[_0xcdcd('0xe2')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xe3'));db['SquareRecording']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/squareRecording/squareRecording.model');db[_0xcdcd('0xe4')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xe5'));db[_0xcdcd('0xe6')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xe7'));db['License']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xe8'));db[_0xcdcd('0xe9')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/campaign/campaign.model');db['Migration']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xea'));db[_0xcdcd('0xeb')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xec'));db['Plugin']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xed'));db[_0xcdcd('0xee')]=db[_0xcdcd('0x0')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xcdcd('0xef')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf0'));db['FaxTransferReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf1'));db['OpenchannelTransferReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xcdcd('0xf2')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xcdcd('0xf3')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf4'));db[_0xcdcd('0xf5')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xf6'));db[_0xcdcd('0xf7')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/userProfile/userProfile.model');db[_0xcdcd('0xf8')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0xf9'));db[_0xcdcd('0xfa')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xfb'));db[_0xcdcd('0xfc')]=db[_0xcdcd('0x0')]['import'](_0xcdcd('0xfd'));db[_0xcdcd('0xfe')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0xff'));db['WhatsappApplication']=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x100'));db[_0xcdcd('0x101')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x102'));db[_0xcdcd('0x103')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x104'));db['WhatsappQueueReport']=db[_0xcdcd('0x0')][_0xcdcd('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xcdcd('0x105')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x106'));db[_0xcdcd('0x107')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x108'));db[_0xcdcd('0x109')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x10a'));db[_0xcdcd('0x10b')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x10c'));db['TeamVoicePrefix']=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x10d'));db[_0xcdcd('0x10e')]=db[_0xcdcd('0x0')][_0xcdcd('0x11')](_0xcdcd('0x10f'));db[_0xcdcd('0x110')]=db['sequelize'][_0xcdcd('0x11')](_0xcdcd('0x111'));db[_0xcdcd('0x112')][_0xcdcd('0x113')](db[_0xcdcd('0x1c')],{'as':_0xcdcd('0x1c'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x113')](db[_0xcdcd('0x110')],{'as':_0xcdcd('0x116'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x1a')],{'as':_0xcdcd('0x117'),'foreignKey':'UserId'});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x2e')],{'as':_0xcdcd('0x119'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':_0xcdcd('0x11a'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x73')],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x115')});db['User'][_0xcdcd('0x118')](db[_0xcdcd('0x75')],{'as':_0xcdcd('0x11c'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x77')],{'as':_0xcdcd('0x77'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x11d')],{'as':_0xcdcd('0x11e'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x63')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x11f'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x120')],{'as':'FaxInteractions','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')]['hasMany'](db[_0xcdcd('0x44')],{'as':_0xcdcd('0x121'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x101')],{'as':'WhatsappInteractions','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0xfc')],{'as':_0xcdcd('0x122'),'foreignKey':_0xcdcd('0x123')});db[_0xcdcd('0x112')][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':'Hoppers','foreignKey':_0xcdcd('0x115'),'onDelete':_0xcdcd('0x125')});db[_0xcdcd('0x112')][_0xcdcd('0x126')](db[_0xcdcd('0xf7')],{'as':_0xcdcd('0xf7'),'foreignKey':_0xcdcd('0x127')});db[_0xcdcd('0x112')]['belongsToMany'](db[_0xcdcd('0x68')],{'as':'Groups','through':_0xcdcd('0x128')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x12a'),'through':_0xcdcd('0x12b')});db[_0xcdcd('0x112')]['belongsToMany'](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x12c'),'through':_0xcdcd('0x12d')});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x12e')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['MailInteraction'],{'as':'MailInteractions','through':_0xcdcd('0x12f')});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0x63')],{'as':_0xcdcd('0x130'),'through':'user_has_chat_interactions'});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['FaxInteraction'],{'as':_0xcdcd('0x131'),'through':_0xcdcd('0x132')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x11f'),'through':_0xcdcd('0x133')});db['User']['belongsToMany'](db[_0xcdcd('0x11d')],{'as':_0xcdcd('0x11e'),'through':_0xcdcd('0x134')});db['User']['belongsToMany'](db[_0xcdcd('0x101')],{'as':_0xcdcd('0x135'),'through':'user_has_whatsapp_interactions'});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0x18')],{'as':_0xcdcd('0x136'),'through':_0xcdcd('0x137'),'required':![]});db[_0xcdcd('0x112')]['belongsToMany'](db[_0xcdcd('0xf5')],{'as':_0xcdcd('0x138'),'through':'UserVoicePrefix','required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x139')],{'as':_0xcdcd('0x13a'),'through':_0xcdcd('0x32'),'required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['ChatQueue'],{'as':'ChatQueues','through':_0xcdcd('0x13b'),'required':![],'hooks':!![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['FaxQueue'],{'as':'FaxQueues','through':_0xcdcd('0x34'),'required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db['SmsQueue'],{'as':_0xcdcd('0x13c'),'through':_0xcdcd('0x36'),'required':![]});db['User']['belongsToMany'](db[_0xcdcd('0x5e')],{'as':'OpenchannelQueues','through':_0xcdcd('0x38'),'required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x107')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'through':_0xcdcd('0x12d')});db[_0xcdcd('0x112')]['belongsToMany'](db['ChatWebsite'],{'as':_0xcdcd('0x13d'),'through':_0xcdcd('0x13e')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x4d')],{'as':'FaxAccounts','through':_0xcdcd('0x13f')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x40')],{'as':'MailAccounts','through':_0xcdcd('0x140')});db['User'][_0xcdcd('0x129')](db[_0xcdcd('0x58')],{'as':_0xcdcd('0x141'),'through':'user_has_openchannel_accounts'});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0x142')],{'as':_0xcdcd('0x143'),'through':_0xcdcd('0x144')});db[_0xcdcd('0x112')][_0xcdcd('0x129')](db[_0xcdcd('0xfe')],{'as':_0xcdcd('0x145'),'through':_0xcdcd('0x146')});db[_0xcdcd('0x13')]['hasMany'](db['VoiceExtension'],{'as':_0xcdcd('0x147'),'onDelete':'cascade','foreignKey':_0xcdcd('0x148')});db[_0xcdcd('0x15')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x16')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':_0xcdcd('0x149'),'onDelete':'cascade'});db[_0xcdcd('0x17')][_0xcdcd('0x129')](db[_0xcdcd('0x8a')],{'as':_0xcdcd('0x14a'),'through':'moh_has_sounds'});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db['UserVoiceQueueRt'],{'as':_0xcdcd('0x14b'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':_0xcdcd('0x14d'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db['CmHopperFinal'],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x14c')});db['VoiceQueue'][_0xcdcd('0x118')](db[_0xcdcd('0x75')],{'as':_0xcdcd('0x14e'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')]['hasMany'](db[_0xcdcd('0x77')],{'as':_0xcdcd('0x77'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db[_0xcdcd('0x71')],{'as':_0xcdcd('0x14f'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')][_0xcdcd('0x118')](db[_0xcdcd('0xd9')],{'as':_0xcdcd('0x150'),'foreignKey':_0xcdcd('0x14c')});db[_0xcdcd('0x18')]['belongsTo'](db[_0xcdcd('0x2a')],{'as':_0xcdcd('0x2a'),'foreignKey':_0xcdcd('0x151')});db[_0xcdcd('0x18')][_0xcdcd('0x126')](db['Trunk'],{'as':_0xcdcd('0x152'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xcdcd('0x126')](db['Interval'],{'as':_0xcdcd('0x82'),'foreignKey':_0xcdcd('0x153')});db['VoiceQueue'][_0xcdcd('0x126')](db[_0xcdcd('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xcdcd('0x154')});db['VoiceQueue'][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x12c'),'through':_0xcdcd('0x155')});db['VoiceQueue']['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x137')});db[_0xcdcd('0x18')][_0xcdcd('0x129')](db['Team'],{'as':_0xcdcd('0x157'),'through':_0xcdcd('0x10b')});db[_0xcdcd('0x18')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xcdcd('0x1a')][_0xcdcd('0x126')](db['User'],{'as':_0xcdcd('0x112'),'foreignKey':_0xcdcd('0x115')});db['ScreenRecording'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'User','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x1c')][_0xcdcd('0x118')](db['VoiceMailMessage'],{'as':_0xcdcd('0x158'),'onDelete':_0xcdcd('0x114'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xcdcd('0x159'),'targetKey':_0xcdcd('0x15a')});db[_0xcdcd('0x20')][_0xcdcd('0x118')](db['VoiceQueueReport'],{'as':_0xcdcd('0x15b'),'foreignKey':_0xcdcd('0x15c'),'constraints':![]});db[_0xcdcd('0x20')][_0xcdcd('0x118')](db[_0xcdcd('0x24')],{'as':_0xcdcd('0x15d'),'foreignKey':_0xcdcd('0x15c'),'constraints':![]});db['VoiceCallReport'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x112'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x20')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x3c')][_0xcdcd('0x126')](db['MailAccount'],{'as':_0xcdcd('0x40'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x3c')][_0xcdcd('0x126')](db['CloudProvider'],{'as':_0xcdcd('0x109'),'foreignKey':_0xcdcd('0x161'),'onDelete':_0xcdcd('0x162')});db['MailServerOut']['belongsTo'](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x40'),'foreignKey':'MailAccountId'});db[_0xcdcd('0x3e')][_0xcdcd('0x126')](db['CloudProvider'],{'as':_0xcdcd('0x109'),'foreignKey':'CloudProviderId','onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x40')]['hasOne'](db['MailServerIn'],{'as':_0xcdcd('0x163'),'onDelete':'cascade'});db['MailAccount'][_0xcdcd('0x113')](db['MailServerOut'],{'as':_0xcdcd('0x164'),'onDelete':'cascade'});db[_0xcdcd('0x40')][_0xcdcd('0x118')](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':'MailAccountId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x40')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x40')][_0xcdcd('0x118')](db['MailMessage'],{'as':_0xcdcd('0x158'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xcdcd('0x118')](db[_0xcdcd('0x44')],{'as':'Interactions'});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x160'),'onDelete':_0xcdcd('0x114')});db['MailAccount'][_0xcdcd('0x126')](db['CmList'],{'as':'List','foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x40')][_0xcdcd('0x126')](db[_0xcdcd('0x94')],{'as':'Template','foreignKey':_0xcdcd('0x168')});db[_0xcdcd('0x40')][_0xcdcd('0x126')](db[_0xcdcd('0x84')],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x140')});db['MailQueue'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':'UserMailQueue'});db[_0xcdcd('0x139')][_0xcdcd('0x129')](db[_0xcdcd('0xe6')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xcdcd('0x44')]['hasMany'](db['MailMessage'],{'as':_0xcdcd('0x158'),'onDelete':'cascade','foreignKey':_0xcdcd('0x16a')});db[_0xcdcd('0x44')][_0xcdcd('0x126')](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x44')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db['MailInteraction'][_0xcdcd('0x126')](db['User'],{'as':_0xcdcd('0x16c'),'foreignKey':_0xcdcd('0x115')});db['MailInteraction'][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x16d'),'as':_0xcdcd('0x16e')});db['MailInteraction'][_0xcdcd('0x129')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xcdcd('0x16f')});db['MailInteraction'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x12f'),'foreignKey':'MailInteractionId'});db[_0xcdcd('0x171')]['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0xcdcd('0x171')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x112')});db['MailMessage']['belongsTo'](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db[_0xcdcd('0x171')][_0xcdcd('0x126')](db[_0xcdcd('0x44')],{'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x16a')});db['MailMessage']['belongsTo'](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x160')});db[_0xcdcd('0x171')][_0xcdcd('0x126')](db['ChatWebsite'],{'as':_0xcdcd('0x173'),'foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x171')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xcdcd('0x175')});db['MailApplication']['belongsTo'](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x47')][_0xcdcd('0x126')](db[_0xcdcd('0x139')],{'onDelete':'restrict'});db[_0xcdcd('0x47')]['belongsTo'](db['MailAccount'],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x47')][_0xcdcd('0x126')](db['Interval'],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x47')]['belongsTo'](db[_0xcdcd('0x8c')],{'onDelete':'restrict','foreignKey':_0xcdcd('0x176')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db['CmList'],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db['MailQueueReport'][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x177')]['belongsTo'](db[_0xcdcd('0x44')],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db['MailMessage'],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x177')][_0xcdcd('0x126')](db[_0xcdcd('0x139')],{});db[_0xcdcd('0x4a')][_0xcdcd('0x118')](db['DashboardItem'],{'as':_0xcdcd('0x179'),'onDelete':_0xcdcd('0x114')});db['FaxAccount'][_0xcdcd('0x118')](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':_0xcdcd('0x17a')});db[_0xcdcd('0x4d')]['hasMany'](db[_0xcdcd('0x120')],{'as':_0xcdcd('0x17b')});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db['FaxApplication'],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x17a'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db['VoiceExtension'],{'as':_0xcdcd('0x17c'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x4d')][_0xcdcd('0x118')](db[_0xcdcd('0x4f')],{'as':'Messages'});db[_0xcdcd('0x4d')][_0xcdcd('0x126')](db[_0xcdcd('0x2a')],{'as':_0xcdcd('0x2a')});db[_0xcdcd('0x4d')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db['FaxAccount'][_0xcdcd('0x126')](db['Pause'],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdcd('0x4d')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x13f')});db[_0xcdcd('0x17d')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x17d')][_0xcdcd('0x126')](db[_0xcdcd('0x17e')],{'onDelete':'restrict'});db[_0xcdcd('0x17d')][_0xcdcd('0x126')](db[_0xcdcd('0x4d')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x17d')]['belongsTo'](db[_0xcdcd('0x8c')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db[_0xcdcd('0x120')]['hasMany'](db[_0xcdcd('0x4f')],{'as':'Messages','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x17f')});db['FaxInteraction'][_0xcdcd('0x126')](db['FaxAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x17a')});db[_0xcdcd('0x120')][_0xcdcd('0x126')](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x120')]['belongsTo'](db[_0xcdcd('0x112')],{'as':'Owner','foreignKey':_0xcdcd('0x115')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xcdcd('0x16e')});db[_0xcdcd('0x120')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x180'),'as':'ThroughTags'});db['FaxInteraction'][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x132'),'foreignKey':_0xcdcd('0x17f')});db[_0xcdcd('0x4f')]['belongsTo'](db[_0xcdcd('0x112')],{'onDelete':'cascade','as':_0xcdcd('0x112')});db[_0xcdcd('0x4f')]['belongsTo'](db[_0xcdcd('0x120')],{'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x17f')});db[_0xcdcd('0x4f')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db['FaxMessage']['belongsTo'](db[_0xcdcd('0xeb')],{'as':_0xcdcd('0xeb'),'foreignKey':_0xcdcd('0x181')});db[_0xcdcd('0x4f')][_0xcdcd('0x126')](db['FaxAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x17a')});db[_0xcdcd('0x17e')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x34')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0xcdcd('0x182'),'as':_0xcdcd('0x157')});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x4d')],{});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':'ContactId'});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x120')],{});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x4f')],{});db[_0xcdcd('0x50')]['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x50')][_0xcdcd('0x126')](db[_0xcdcd('0x17e')],{});db[_0xcdcd('0x142')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x183'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x142')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xcdcd('0x142')][_0xcdcd('0x118')](db[_0xcdcd('0x184')],{'as':_0xcdcd('0x158'),'foreignKey':_0xcdcd('0x183')});db[_0xcdcd('0x142')][_0xcdcd('0x118')](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x17b')});db[_0xcdcd('0x142')]['hasMany'](db['SmsApplication'],{'as':'Applications','foreignKey':_0xcdcd('0x183'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x142')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x142')][_0xcdcd('0x126')](db['Pause'],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdcd('0x142')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x144')});db['SmsApplication'][_0xcdcd('0x126')](db['User'],{'onDelete':'restrict'});db[_0xcdcd('0x53')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x53')]['belongsTo'](db[_0xcdcd('0x142')],{'onDelete':'restrict'});db[_0xcdcd('0x53')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x53')][_0xcdcd('0x126')](db['Tag'],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db['SmsInteraction'][_0xcdcd('0x118')](db[_0xcdcd('0x184')],{'as':_0xcdcd('0x158'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x185')});db['SmsInteraction'][_0xcdcd('0x126')](db[_0xcdcd('0x142')],{'as':'Account','foreignKey':_0xcdcd('0x183')});db[_0xcdcd('0x55')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x55')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x16c'),'foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x55')][_0xcdcd('0x129')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xcdcd('0x16e')});db[_0xcdcd('0x55')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x186'),'as':_0xcdcd('0x16f')});db[_0xcdcd('0x55')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':'user_has_sms_interactions','foreignKey':_0xcdcd('0x185')});db[_0xcdcd('0x184')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x112')});db[_0xcdcd('0x184')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db['SmsMessage'][_0xcdcd('0x126')](db['SmsInteraction'],{'onDelete':_0xcdcd('0x114'),'as':'Interaction','foreignKey':_0xcdcd('0x185')});db[_0xcdcd('0x184')][_0xcdcd('0x126')](db[_0xcdcd('0x142')],{'as':'Account','foreignKey':_0xcdcd('0x183')});db[_0xcdcd('0x56')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x36'),'foreignKey':_0xcdcd('0x187')});db['SmsQueue']['belongsToMany'](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x188'),'as':_0xcdcd('0x157')});db[_0xcdcd('0x58')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x189'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x58')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':'OpenchannelAccountId'});db[_0xcdcd('0x58')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x58')]['hasMany'](db[_0xcdcd('0x5c')],{'as':_0xcdcd('0x158'),'foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x58')][_0xcdcd('0x118')](db[_0xcdcd('0x18a')],{'as':'Applications','foreignKey':_0xcdcd('0x189'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x58')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x58')]['belongsTo'](db[_0xcdcd('0x84')],{'as':_0xcdcd('0x169'),'foreignKey':_0xcdcd('0x154')});db[_0xcdcd('0x58')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x18b')});db['OpenchannelApplication'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x18a')][_0xcdcd('0x126')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x18a')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x18a')][_0xcdcd('0x126')](db[_0xcdcd('0x8c')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db['OpenchannelInteraction'][_0xcdcd('0x118')](db[_0xcdcd('0x5c')],{'as':'Messages','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x18c')});db['OpenchannelInteraction']['belongsTo'](db[_0xcdcd('0x58')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x189')});db[_0xcdcd('0x11d')]['belongsTo'](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x11d')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x16c'),'foreignKey':'UserId'});db[_0xcdcd('0x11d')]['belongsToMany'](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x18d'),'as':_0xcdcd('0x16e')});db[_0xcdcd('0x11d')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0xcdcd('0x16f')});db[_0xcdcd('0x11d')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x134'),'foreignKey':_0xcdcd('0x18c')});db[_0xcdcd('0x5c')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x112')});db[_0xcdcd('0x5c')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db[_0xcdcd('0x5c')][_0xcdcd('0x126')](db[_0xcdcd('0x11d')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x18c')});db[_0xcdcd('0x5c')]['belongsTo'](db[_0xcdcd('0xeb')],{'as':_0xcdcd('0xeb'),'foreignKey':_0xcdcd('0x181')});db['OpenchannelMessage'][_0xcdcd('0x126')](db['OpenchannelAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0xcdcd('0x5e')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0xcdcd('0x5e')][_0xcdcd('0x129')](db['Team'],{'through':_0xcdcd('0x18e'),'as':'Teams'});db[_0xcdcd('0x173')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x174'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x173')]['hasMany'](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x173')][_0xcdcd('0x118')](db[_0xcdcd('0x6a')],{'as':_0xcdcd('0x18f')});db[_0xcdcd('0x173')]['hasMany'](db['ChatInteraction'],{'as':_0xcdcd('0x17b')});db['ChatWebsite']['hasMany'](db[_0xcdcd('0x61')],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x174'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x173')]['hasMany'](db[_0xcdcd('0x65')],{'as':_0xcdcd('0x158')});db[_0xcdcd('0x173')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x173')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'as':_0xcdcd('0x82'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x173')][_0xcdcd('0x126')](db[_0xcdcd('0x40')],{'as':_0xcdcd('0x40'),'foreignKey':_0xcdcd('0x160')});db['ChatWebsite'][_0xcdcd('0x126')](db[_0xcdcd('0x84')],{'as':_0xcdcd('0x169'),'foreignKey':_0xcdcd('0x154')});db[_0xcdcd('0x173')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':'Agents','through':_0xcdcd('0x13e')});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':'ListId'});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db[_0xcdcd('0x11d')],{});db[_0xcdcd('0x190')][_0xcdcd('0x126')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x190')]['belongsTo'](db['OpenchannelQueue'],{});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x191'),'foreignKey':_0xcdcd('0x115'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x66')],{'as':_0xcdcd('0x192'),'foreignKey':_0xcdcd('0x193'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':_0xcdcd('0x194'),'foreignKey':'ChatWebsiteId','onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x61')][_0xcdcd('0x126')](db[_0xcdcd('0x8c')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db['ChatInteraction'][_0xcdcd('0x118')](db[_0xcdcd('0x65')],{'as':_0xcdcd('0x158'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x195')});db[_0xcdcd('0x63')]['belongsTo'](db[_0xcdcd('0x173')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x63')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x63')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'Owner','foreignKey':'UserId'});db[_0xcdcd('0x63')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xcdcd('0x63')][_0xcdcd('0x129')](db['Tag'],{'through':_0xcdcd('0x196'),'as':'ThroughTags'});db[_0xcdcd('0x63')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x197'),'foreignKey':_0xcdcd('0x195')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':'cascade','as':_0xcdcd('0x112')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x65')]['belongsTo'](db[_0xcdcd('0x63')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x195')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db['Attachment'],{'as':_0xcdcd('0xeb'),'foreignKey':_0xcdcd('0x181')});db[_0xcdcd('0x65')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x174')});db['ChatOfflineMessage'][_0xcdcd('0x118')](db['Attachment'],{'as':_0xcdcd('0x198'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x199')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':'Contact','foreignKey':'ContactId'});db[_0xcdcd('0x199')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':'Account','foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x66')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xcdcd('0x66')][_0xcdcd('0x129')](db['Team'],{'through':_0xcdcd('0x19a'),'as':_0xcdcd('0x157')});db[_0xcdcd('0x68')][_0xcdcd('0x118')](db[_0xcdcd('0x19b')],{'as':_0xcdcd('0x158'),'foreignKey':'ChatGroupId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x68')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x14b'),'through':_0xcdcd('0x128')});db[_0xcdcd('0x6a')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'as':'Website','foreignKey':_0xcdcd('0x174')});db[_0xcdcd('0x6c')][_0xcdcd('0x118')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x12a'),'foreignKey':_0xcdcd('0x19c')});db[_0xcdcd('0x6e')]['hasMany'](db[_0xcdcd('0x90')],{'as':_0xcdcd('0x19d'),'foreignKey':_0xcdcd('0x19e')});db[_0xcdcd('0x6e')][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':_0xcdcd('0x14d'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xcdcd('0x73')],{'as':'HopperFinals','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x6e')][_0xcdcd('0x118')](db['CmHopperHistory'],{'as':_0xcdcd('0x14e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x6e')][_0xcdcd('0x118')](db[_0xcdcd('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xcdcd('0x15f')});db['CmContact'][_0xcdcd('0x118')](db[_0xcdcd('0xd9')],{'as':_0xcdcd('0x150'),'foreignKey':_0xcdcd('0x15f')});db['CmContact'][_0xcdcd('0x118')](db[_0xcdcd('0x11d')],{'as':_0xcdcd('0x11e'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db['CmContact'][_0xcdcd('0x118')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x6e')]['hasMany'](db[_0xcdcd('0x55')],{'as':_0xcdcd('0x11f'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x6e')]['hasMany'](db[_0xcdcd('0x120')],{'as':_0xcdcd('0x131'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x6e')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xcdcd('0x6e')][_0xcdcd('0x126')](db['CmCompany'],{'as':_0xcdcd('0x19f'),'foreignKey':_0xcdcd('0x19c')});db[_0xcdcd('0x6e')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':'ListId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x6e')]['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x12b')});db[_0xcdcd('0x6e')][_0xcdcd('0x129')](db['Tag'],{'as':_0xcdcd('0x16e'),'through':'cm_contact_has_tags'});db[_0xcdcd('0x6e')][_0xcdcd('0x129')](db['Tag'],{'through':_0xcdcd('0x1a0'),'as':'ThroughTags'});db['CmHopper'][_0xcdcd('0x118')](db[_0xcdcd('0x92')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'Agent','foreignKey':_0xcdcd('0x115')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0x18')],{'as':_0xcdcd('0x192'),'foreignKey':_0xcdcd('0x14c'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0xe9')],{'as':'Campaign','foreignKey':_0xcdcd('0x1a1'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x124')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':'Owner','foreignKey':_0xcdcd('0x1a2')});db[_0xcdcd('0x71')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':'Contact','foreignKey':_0xcdcd('0x15f'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x71')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':'ListId','onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x71')][_0xcdcd('0x126')](db[_0xcdcd('0x18')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xcdcd('0x114')});db['CmHopperBlack'][_0xcdcd('0x126')](db[_0xcdcd('0xe9')],{'as':_0xcdcd('0xe9'),'foreignKey':_0xcdcd('0x1a1'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0x7b')]['hasMany'](db[_0xcdcd('0x1a3')],{'as':{'plural':_0xcdcd('0x1a4'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x7b')]['hasMany'](db[_0xcdcd('0x1a3')],{'as':{'plural':'Any','singular':_0xcdcd('0x1a5')},'foreignKey':_0xcdcd('0x1a6'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xcdcd('0x118')](db[_0xcdcd('0x1a7')],{'as':'Actions','foreignKey':_0xcdcd('0x1a8'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x7f')][_0xcdcd('0x118')](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':'ParentId','onDelete':_0xcdcd('0x114')});db['Interval'][_0xcdcd('0x118')](db[_0xcdcd('0x82')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':_0xcdcd('0x11a'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0xcdcd('0x82')]['hasMany'](db[_0xcdcd('0x47')],{'as':_0xcdcd('0x1a9'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x82')][_0xcdcd('0x118')](db['ChatApplication'],{'as':_0xcdcd('0x1aa'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x82')][_0xcdcd('0x118')](db[_0xcdcd('0x17d')],{'as':_0xcdcd('0x1ab'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x82')][_0xcdcd('0x118')](db[_0xcdcd('0x53')],{'as':_0xcdcd('0x1ac'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x88')]['belongsTo'](db[_0xcdcd('0x40')],{});db[_0xcdcd('0x88')][_0xcdcd('0x126')](db[_0xcdcd('0x1ad')],{'foreignKey':'DefaultReportId'});db[_0xcdcd('0x88')][_0xcdcd('0x126')](db[_0xcdcd('0x1ae')],{'foreignKey':_0xcdcd('0x1af')});db['Sound'][_0xcdcd('0x129')](db[_0xcdcd('0x17')],{'as':_0xcdcd('0x1b0'),'through':_0xcdcd('0x1b1'),'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x8c')]['belongsToMany'](db['CmContact'],{'through':_0xcdcd('0x1a0')});db[_0xcdcd('0x8c')]['belongsToMany'](db[_0xcdcd('0x63')],{'through':_0xcdcd('0x196')});db[_0xcdcd('0x8c')][_0xcdcd('0x129')](db[_0xcdcd('0x44')],{'through':_0xcdcd('0x16d')});db['Tag'][_0xcdcd('0x129')](db[_0xcdcd('0x55')],{'through':'sms_interaction_has_tags'});db[_0xcdcd('0x8c')][_0xcdcd('0x129')](db[_0xcdcd('0x120')],{'through':_0xcdcd('0x180')});db['Tag'][_0xcdcd('0x129')](db[_0xcdcd('0x11d')],{'through':_0xcdcd('0x18d')});db[_0xcdcd('0x8c')][_0xcdcd('0x129')](db[_0xcdcd('0x101')],{'through':_0xcdcd('0x1b2')});db[_0xcdcd('0x90')][_0xcdcd('0x126')](db[_0xcdcd('0x8e')],{'as':'ItemType','foreignKey':_0xcdcd('0x1b3')});db[_0xcdcd('0x92')][_0xcdcd('0x126')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xcdcd('0x1b4')});db[_0xcdcd('0x90')]['belongsTo'](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x19e')});db['Trigger'][_0xcdcd('0x118')](db[_0xcdcd('0x1a3')],{'as':{'plural':_0xcdcd('0x1b5'),'singular':_0xcdcd('0x1b6')},'foreignKey':_0xcdcd('0x1b7'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xcdcd('0x1a3')],{'as':{'plural':_0xcdcd('0x1b8'),'singular':_0xcdcd('0x1b9')},'foreignKey':'TriggerAnyId','onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x96')][_0xcdcd('0x118')](db[_0xcdcd('0x1a7')],{'as':_0xcdcd('0x1ba'),'foreignKey':_0xcdcd('0x1bb'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x1ae')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xcdcd('0x1bc'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1af'),'hooks':!![]});db[_0xcdcd('0x1ad')][_0xcdcd('0x118')](db[_0xcdcd('0xa2')],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1bd')});db[_0xcdcd('0xa0')][_0xcdcd('0x118')](db[_0xcdcd('0xa2')],{'as':'Fields','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1be')});db[_0xcdcd('0xa2')]['belongsTo'](db[_0xcdcd('0xa0')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0xcdcd('0xa8')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xa8')][_0xcdcd('0x118')](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1c1'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xa8')]['hasMany'](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xa8')][_0xcdcd('0x118')](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1bc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xcdcd('0xa8')][_0xcdcd('0x126')](db[_0xcdcd('0xa6')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xaa')][_0xcdcd('0x118')](db[_0xcdcd('0xaa')],{'as':_0xcdcd('0x1c5'),'foreignKey':_0xcdcd('0x1c2')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xaa')]['hasMany'](db['SalesforceField'],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db['SalesforceField'][_0xcdcd('0x126')](db['Variable'],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xab')][_0xcdcd('0x118')](db['SugarcrmConfiguration'],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':'AccountId'});db[_0xcdcd('0xad')][_0xcdcd('0x118')](db['SugarcrmField'],{'as':_0xcdcd('0x1c1'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db['SugarcrmConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0x1ca')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xad')]['hasMany'](db[_0xcdcd('0x1ca')],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c8')});db['SugarcrmConfiguration']['belongsTo'](db[_0xcdcd('0xab')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0x1ca')]['hasMany'](db['SugarcrmField'],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db[_0xcdcd('0x1ca')][_0xcdcd('0x118')](db[_0xcdcd('0x1ca')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db['SugarcrmField'][_0xcdcd('0x118')](db[_0xcdcd('0x1ca')],{'as':'Field','foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0x1ca')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xb0')]['hasMany'](db[_0xcdcd('0xb1')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xb1')][_0xcdcd('0x118')](db['DeskField'],{'as':'Subjects','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xb1')][_0xcdcd('0x118')](db[_0xcdcd('0xb2')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xb1')][_0xcdcd('0x118')](db['DeskField'],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c8')});db['DeskConfiguration'][_0xcdcd('0x126')](db[_0xcdcd('0xb0')],{'as':'Account','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xb1')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1cb')});db[_0xcdcd('0xb2')][_0xcdcd('0x118')](db['DeskField'],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xb2')]['hasMany'](db[_0xcdcd('0xb2')],{'as':_0xcdcd('0x1c6'),'foreignKey':'DescriptionId'});db[_0xcdcd('0xb2')]['hasMany'](db[_0xcdcd('0xb2')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xb2')][_0xcdcd('0x126')](db['Variable'],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db['ZohoAccount'][_0xcdcd('0x118')](db[_0xcdcd('0x1cc')],{'as':_0xcdcd('0x1bf'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0x1cc')][_0xcdcd('0x118')](db['ZohoField'],{'as':'Subjects','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db['ZohoConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db['ZohoConfiguration'][_0xcdcd('0x118')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xcdcd('0x1c8')});db['ZohoConfiguration']['belongsTo'](db[_0xcdcd('0xb4')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xb7')][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c5'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xb7')][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xb7')][_0xcdcd('0x118')](db[_0xcdcd('0xb7')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xb7')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xb8')][_0xcdcd('0x118')](db[_0xcdcd('0xba')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xba')][_0xcdcd('0x118')](db[_0xcdcd('0xbc')],{'as':'Subjects','foreignKey':_0xcdcd('0x1c2')});db['ZendeskConfiguration']['hasMany'](db[_0xcdcd('0xbc')],{'as':_0xcdcd('0x1c3'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xba')][_0xcdcd('0x118')](db['ZendeskField'],{'as':_0xcdcd('0x1bc'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xba')][_0xcdcd('0x126')](db[_0xcdcd('0xb8')],{'as':'Account','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xba')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1cd')});db[_0xcdcd('0xbc')][_0xcdcd('0x118')](db[_0xcdcd('0xbc')],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xbc')][_0xcdcd('0x118')](db[_0xcdcd('0xbc')],{'as':_0xcdcd('0x1c6'),'foreignKey':'DescriptionId'});db[_0xcdcd('0xbc')]['hasMany'](db['ZendeskField'],{'as':_0xcdcd('0x1c7'),'foreignKey':'FieldId'});db[_0xcdcd('0xbc')]['belongsTo'](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xbd')][_0xcdcd('0x118')](db[_0xcdcd('0xbf')],{'as':_0xcdcd('0x1bf'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1c0')});db['FreshdeskConfiguration']['hasMany'](db[_0xcdcd('0xc1')],{'as':'Subjects','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xbf')][_0xcdcd('0x118')](db[_0xcdcd('0xc1')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xbf')][_0xcdcd('0x118')](db['FreshdeskField'],{'as':_0xcdcd('0x1bc'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xbf')][_0xcdcd('0x126')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xbf')][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1ce')});db['FreshdeskField'][_0xcdcd('0x118')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db['FreshdeskField'][_0xcdcd('0x118')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xcdcd('0x1c4')});db['FreshdeskField'][_0xcdcd('0x118')](db[_0xcdcd('0xc1')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xc1')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0x1cf')][_0xcdcd('0x118')](db[_0xcdcd('0xc4')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db['VtigerConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c1'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xc4')][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c3'),'foreignKey':_0xcdcd('0x1c4')});db['VtigerConfiguration']['hasMany'](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1bc'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xc4')][_0xcdcd('0x126')](db[_0xcdcd('0x1cf')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xc6')][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db['VtigerField'][_0xcdcd('0x118')](db[_0xcdcd('0xc6')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xc6')][_0xcdcd('0x118')](db['VtigerField'],{'as':'Field','foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xc6')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':'VariableId'});db['ServicenowAccount']['hasMany'](db[_0xcdcd('0x1d0')],{'as':'Configurations','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0x1d0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c1'),'foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0x1d0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c3'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0x1d0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1bc'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0x1d0')][_0xcdcd('0x126')](db['ServicenowAccount'],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db['ServicenowField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db['ServicenowField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d1')],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0x1d1')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcdcd('0xc9')][_0xcdcd('0x118')](db[_0xcdcd('0xcb')],{'as':'Configurations','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xc9')][_0xcdcd('0x126')](db['CloudProvider'],{'as':_0xcdcd('0x109'),'foreignKey':_0xcdcd('0x161')});db[_0xcdcd('0xcb')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1c1'),'onDelete':'cascade','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xcb')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1c3'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xcb')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1bc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xcdcd('0xcb')]['belongsTo'](db[_0xcdcd('0xc9')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db[_0xcdcd('0xcd')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':'Subject','foreignKey':_0xcdcd('0x1c2')});db[_0xcdcd('0xcd')][_0xcdcd('0x118')](db[_0xcdcd('0xcd')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0xcd')][_0xcdcd('0x118')](db['Dynamics365Field'],{'as':_0xcdcd('0x1c7'),'foreignKey':_0xcdcd('0x1c8')});db[_0xcdcd('0xcd')]['belongsTo'](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xce')][_0xcdcd('0x118')](db[_0xcdcd('0xd0')],{'as':_0xcdcd('0x1bf'),'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1c0')});db['FreshsalesConfiguration'][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xcdcd('0xd0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1c3'),'foreignKey':'DescriptionId'});db[_0xcdcd('0xd0')][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1bc'),'foreignKey':'FieldId'});db[_0xcdcd('0xd0')][_0xcdcd('0x126')](db[_0xcdcd('0xce')],{'as':_0xcdcd('0x16b'),'foreignKey':_0xcdcd('0x1c0')});db['FreshsalesField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1c5'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0xcdcd('0x118')](db[_0xcdcd('0x1d2')],{'as':_0xcdcd('0x1c6'),'foreignKey':_0xcdcd('0x1c4')});db[_0xcdcd('0x1d2')]['hasMany'](db[_0xcdcd('0x1d2')],{'as':'Field','foreignKey':'FieldId'});db[_0xcdcd('0x1d2')][_0xcdcd('0x126')](db[_0xcdcd('0x98')],{'as':_0xcdcd('0x98'),'foreignKey':_0xcdcd('0x1c9')});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db['ChatQueueReport'][_0xcdcd('0x126')](db['CmContact'],{'as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db[_0xcdcd('0x63')],{});db[_0xcdcd('0xd4')]['belongsTo'](db[_0xcdcd('0x65')],{});db[_0xcdcd('0xd4')]['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0xd4')][_0xcdcd('0x126')](db['ChatQueue'],{});db[_0xcdcd('0x19b')][_0xcdcd('0x126')](db['User'],{'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1d3')});db[_0xcdcd('0x19b')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x1d4')});db[_0xcdcd('0xd9')][_0xcdcd('0x118')](db[_0xcdcd('0xd7')],{'foreignKey':_0xcdcd('0x1d5'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xd9')][_0xcdcd('0x118')](db[_0xcdcd('0xd6')],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport'][_0xcdcd('0x126')](db['SmsAccount'],{});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':'Contact','foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db[_0xcdcd('0x55')],{});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db['SmsMessage'],{});db[_0xcdcd('0xda')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{});db[_0xcdcd('0xda')]['belongsTo'](db[_0xcdcd('0x56')],{});db['JscriptyProject'][_0xcdcd('0x118')](db[_0xcdcd('0xd9')],{'foreignKey':_0xcdcd('0x1d6')});db[_0xcdcd('0xde')][_0xcdcd('0x118')](db['JscriptyQuestionReport'],{'foreignKey':_0xcdcd('0x1d6')});db[_0xcdcd('0xde')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xcdcd('0x1d6')});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db['User'],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x12e')});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db[_0xcdcd('0x18')],{'through':_0xcdcd('0x10b'),'as':_0xcdcd('0x136')});db['Team'][_0xcdcd('0x129')](db[_0xcdcd('0x139')],{'through':_0xcdcd('0x1d7'),'as':'MailQueues'});db[_0xcdcd('0xe6')]['belongsToMany'](db['ChatQueue'],{'through':_0xcdcd('0x19a'),'as':_0xcdcd('0x1d8')});db[_0xcdcd('0xe6')]['belongsToMany'](db[_0xcdcd('0x17e')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xcdcd('0xe6')]['belongsToMany'](db[_0xcdcd('0x56')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db[_0xcdcd('0x5e')],{'through':_0xcdcd('0x18e'),'as':'OpenchannelQueues'});db[_0xcdcd('0xe6')][_0xcdcd('0x129')](db[_0xcdcd('0x107')],{'through':_0xcdcd('0x1d9'),'as':'WhatsappQueues'});db[_0xcdcd('0xe6')]['belongsToMany'](db[_0xcdcd('0xf5')],{'through':_0xcdcd('0x1da'),'as':_0xcdcd('0x138')});db['Campaign'][_0xcdcd('0x118')](db[_0xcdcd('0x124')],{'as':_0xcdcd('0x14d'),'foreignKey':_0xcdcd('0x1a1')});db['Campaign'][_0xcdcd('0x118')](db['CmHopperFinal'],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x1a1')});db[_0xcdcd('0xe9')]['hasMany'](db[_0xcdcd('0x75')],{'as':_0xcdcd('0x14e'),'foreignKey':'CampaignId'});db[_0xcdcd('0xe9')]['hasMany'](db['CmHopperBlack'],{'as':_0xcdcd('0x14f'),'foreignKey':_0xcdcd('0x1a1')});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db['Trunk'],{'as':_0xcdcd('0x2a'),'foreignKey':'TrunkId'});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db[_0xcdcd('0x2a')],{'as':_0xcdcd('0x152'),'foreignKey':_0xcdcd('0x1db')});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db[_0xcdcd('0x82')],{'as':_0xcdcd('0x82'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0xe9')][_0xcdcd('0x126')](db[_0xcdcd('0xe2')],{'as':_0xcdcd('0xe2'),'foreignKey':'SquareProjectId'});db[_0xcdcd('0xe9')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x12c'),'through':_0xcdcd('0x1dc')});db[_0xcdcd('0xe9')][_0xcdcd('0x129')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x1dd'),'through':_0xcdcd('0x1de')});db[_0xcdcd('0xeb')]['belongsTo'](db[_0xcdcd('0x199')],{'as':_0xcdcd('0x199'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport']['belongsTo'](db[_0xcdcd('0x171')],{});db[_0xcdcd('0xee')][_0xcdcd('0x126')](db['MailInteraction'],{});db['MailTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x40')],{'foreignKey':_0xcdcd('0x1df'),'as':_0xcdcd('0x1e0')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0xee')][_0xcdcd('0x126')](db['User'],{'foreignKey':'ToUserId','as':_0xcdcd('0x1e3')});db['MailTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x139')],{'foreignKey':_0xcdcd('0x1e4'),'as':'ToQueue'});db[_0xcdcd('0xee')][_0xcdcd('0x126')](db['MailAccount'],{'foreignKey':_0xcdcd('0x1e5'),'as':_0xcdcd('0x1e6')});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x65')],{});db['ChatTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x63')],{});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'foreignKey':_0xcdcd('0x1e7'),'as':'FromAccount'});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0xef')]['belongsTo'](db['User'],{'foreignKey':_0xcdcd('0x1e8'),'as':'ToAgent'});db['ChatTransferReport'][_0xcdcd('0x126')](db['ChatQueue'],{'foreignKey':_0xcdcd('0x1e9'),'as':_0xcdcd('0x1ea')});db[_0xcdcd('0xef')][_0xcdcd('0x126')](db[_0xcdcd('0x173')],{'foreignKey':_0xcdcd('0x1eb'),'as':_0xcdcd('0x1e6')});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db['FaxMessage'],{});db['FaxTransferReport'][_0xcdcd('0x126')](db['FaxInteraction'],{});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db[_0xcdcd('0x4d')],{'foreignKey':_0xcdcd('0x1ed'),'as':_0xcdcd('0x1e0')});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0x1ec')][_0xcdcd('0x126')](db['User'],{'foreignKey':_0xcdcd('0x1e8'),'as':_0xcdcd('0x1e3')});db[_0xcdcd('0x1ec')]['belongsTo'](db[_0xcdcd('0x17e')],{'foreignKey':_0xcdcd('0x1ee'),'as':_0xcdcd('0x1ea')});db['FaxTransferReport']['belongsTo'](db[_0xcdcd('0x4d')],{'foreignKey':'ToFaxAccountId','as':_0xcdcd('0x1e6')});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db[_0xcdcd('0x5c')],{});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{'foreignKey':_0xcdcd('0x1f0'),'as':'FromAccount'});db[_0xcdcd('0x1ef')]['belongsTo'](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db['OpenchannelTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db[_0xcdcd('0x5e')],{'foreignKey':_0xcdcd('0x1f1'),'as':'ToQueue'});db[_0xcdcd('0x1ef')][_0xcdcd('0x126')](db[_0xcdcd('0x58')],{'foreignKey':_0xcdcd('0x1f2'),'as':_0xcdcd('0x1e6')});db['SmsTransferReport']['belongsTo'](db[_0xcdcd('0x184')],{});db[_0xcdcd('0xf2')]['belongsTo'](db[_0xcdcd('0x55')],{});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db['SmsAccount'],{'foreignKey':_0xcdcd('0x1f3'),'as':_0xcdcd('0x1e0')});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db['User'],{'foreignKey':_0xcdcd('0x1e1'),'as':_0xcdcd('0x1e2')});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':_0xcdcd('0x1e8'),'as':'ToAgent'});db[_0xcdcd('0xf2')][_0xcdcd('0x126')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xcdcd('0x1ea')});db['SmsTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x142')],{'foreignKey':_0xcdcd('0x1f4'),'as':_0xcdcd('0x1e6')});db['CmList']['hasMany'](db['Disposition'],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x167'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xf3')]['hasMany'](db[_0xcdcd('0x79')],{'as':_0xcdcd('0x1f5'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')][_0xcdcd('0x118')](db['CmContact'],{'as':'Contacts','onDelete':_0xcdcd('0x114'),'foreignKey':_0xcdcd('0x167')});db['CmList'][_0xcdcd('0x118')](db[_0xcdcd('0x73')],{'as':_0xcdcd('0x11b'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')]['hasMany'](db['CmHopperHistory'],{'as':_0xcdcd('0x11c'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')][_0xcdcd('0x118')](db[_0xcdcd('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0xf3')][_0xcdcd('0x129')](db[_0xcdcd('0x18')],{'as':'Queues','through':_0xcdcd('0x155')});db['CmList'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':_0xcdcd('0x12d')});db[_0xcdcd('0xf5')][_0xcdcd('0x118')](db[_0xcdcd('0x16')],{'as':'Extensions','onDelete':_0xcdcd('0x114')});db['VoicePrefix']['belongsToMany'](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':'UserVoicePrefix'});db[_0xcdcd('0xf5')]['belongsToMany'](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x1da'),'as':_0xcdcd('0x157')});db[_0xcdcd('0xf7')][_0xcdcd('0x118')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'foreignKey':_0xcdcd('0x127')});db[_0xcdcd('0xf7')]['hasMany'](db[_0xcdcd('0xf8')],{'as':_0xcdcd('0x1f6'),'foreignKey':_0xcdcd('0x127'),'onDelete':_0xcdcd('0x114')});db['UserProfileSection'][_0xcdcd('0x118')](db[_0xcdcd('0xfa')],{'as':_0xcdcd('0x1f7'),'foreignKey':_0xcdcd('0x1f8'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db[_0xcdcd('0x7f')],{'as':_0xcdcd('0x165'),'foreignKey':_0xcdcd('0x1f9'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db[_0xcdcd('0x7d')],{'as':_0xcdcd('0x166'),'foreignKey':'WhatsappAccountId'});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db['WhatsappMessage'],{'as':_0xcdcd('0x158'),'foreignKey':_0xcdcd('0x1f9')});db[_0xcdcd('0xfe')]['hasMany'](db[_0xcdcd('0x101')],{'as':'Interactions'});db[_0xcdcd('0xfe')][_0xcdcd('0x118')](db[_0xcdcd('0x1fa')],{'as':_0xcdcd('0x149'),'foreignKey':_0xcdcd('0x1f9'),'onDelete':_0xcdcd('0x114')});db[_0xcdcd('0xfe')]['belongsTo'](db['CmList'],{'as':_0xcdcd('0x178'),'foreignKey':'ListId'});db[_0xcdcd('0xfe')][_0xcdcd('0x126')](db['Pause'],{'as':_0xcdcd('0x169'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdcd('0xfe')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x156'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x1fa')][_0xcdcd('0x126')](db[_0xcdcd('0x107')],{'onDelete':_0xcdcd('0x162')});db[_0xcdcd('0x1fa')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'onDelete':_0xcdcd('0x162')});db['WhatsappApplication']['belongsTo'](db[_0xcdcd('0x82')],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x153')});db[_0xcdcd('0x1fa')]['belongsTo'](db['Tag'],{'onDelete':_0xcdcd('0x162'),'foreignKey':_0xcdcd('0x176')});db[_0xcdcd('0x101')][_0xcdcd('0x118')](db['WhatsappMessage'],{'as':_0xcdcd('0x158'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0xcdcd('0x101')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'as':_0xcdcd('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0xcdcd('0x101')][_0xcdcd('0x126')](db[_0xcdcd('0x6e')],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x101')][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x16c'),'foreignKey':_0xcdcd('0x115')});db['WhatsappInteraction'][_0xcdcd('0x129')](db[_0xcdcd('0x8c')],{'through':_0xcdcd('0x1b2'),'as':_0xcdcd('0x16e')});db[_0xcdcd('0x101')]['belongsToMany'](db[_0xcdcd('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0xcdcd('0x16f')});db[_0xcdcd('0x101')][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':_0xcdcd('0x170'),'through':_0xcdcd('0x1fb'),'foreignKey':_0xcdcd('0x1fc')});db[_0xcdcd('0x103')]['belongsTo'](db[_0xcdcd('0x112')],{'as':'User'});db[_0xcdcd('0x103')]['belongsTo'](db[_0xcdcd('0x6e')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x15e')});db[_0xcdcd('0x103')]['belongsTo'](db[_0xcdcd('0x101')],{'onDelete':_0xcdcd('0x114'),'as':_0xcdcd('0x172'),'foreignKey':_0xcdcd('0x1fc')});db[_0xcdcd('0x103')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'as':_0xcdcd('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db[_0xcdcd('0xf3')],{'as':_0xcdcd('0x178'),'foreignKey':_0xcdcd('0x167')});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db['CmContact'],{'as':_0xcdcd('0x15e'),'foreignKey':_0xcdcd('0x15f')});db[_0xcdcd('0x1fd')]['belongsTo'](db[_0xcdcd('0x101')],{});db['WhatsappQueueReport'][_0xcdcd('0x126')](db['WhatsappQueue'],{});db[_0xcdcd('0x1fd')][_0xcdcd('0x126')](db[_0xcdcd('0x103')],{});db[_0xcdcd('0x1fd')]['belongsTo'](db[_0xcdcd('0x112')],{});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db[_0xcdcd('0x103')],{});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db['WhatsappInteraction'],{});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'foreignKey':_0xcdcd('0x1fe'),'as':_0xcdcd('0x1e0')});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db[_0xcdcd('0xfe')],{'foreignKey':_0xcdcd('0x1ff'),'as':_0xcdcd('0x1e6')});db[_0xcdcd('0x105')][_0xcdcd('0x126')](db['WhatsappQueue'],{'foreignKey':_0xcdcd('0x200'),'as':_0xcdcd('0x1ea')});db[_0xcdcd('0x105')]['belongsTo'](db[_0xcdcd('0x112')],{'foreignKey':'FromUserId','as':'FromAgent'});db['WhatsappTransferReport'][_0xcdcd('0x126')](db[_0xcdcd('0x112')],{'foreignKey':_0xcdcd('0x1e8'),'as':_0xcdcd('0x1e3')});db['WhatsappQueue'][_0xcdcd('0x129')](db[_0xcdcd('0x112')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xcdcd('0x107')]['belongsToMany'](db[_0xcdcd('0xe6')],{'through':_0xcdcd('0x1d9'),'as':'Teams'});db[_0xcdcd('0x110')][_0xcdcd('0x126')](db['User'],{'as':_0xcdcd('0x201'),'foreignKey':_0xcdcd('0x115'),'onDelete':_0xcdcd('0x114'),'hooks':!![]});db[_0xcdcd('0x109')][_0xcdcd('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0xcdcd('0x162')});db['CloudProvider'][_0xcdcd('0x113')](db[_0xcdcd('0x3c')],{'as':_0xcdcd('0x163'),'onDelete':_0xcdcd('0x162')});db['CloudProvider']['hasOne'](db[_0xcdcd('0x3e')],{'as':_0xcdcd('0x164'),'onDelete':_0xcdcd('0x162')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f3e62eb..3427b11 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd33=['/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.8.1','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue'];(function(_0x53d816,_0x1d1594){var _0x17c9ed=function(_0x5ad6b4){while(--_0x5ad6b4){_0x53d816['push'](_0x53d816['shift']());}};_0x17c9ed(++_0x1d1594);}(_0xfd33,0xd0));var _0x3fd3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xfd33[_0x160c73];return _0xd9302;};'use strict';var path=require(_0x3fd3('0x0'));var express=require(_0x3fd3('0x1'));var errors=require('./errors');var config=require(_0x3fd3('0x2'));var setupLoggers=require(_0x3fd3('0x3'))[_0x3fd3('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x3fd3('0x5')]=function(_0x55813c){return setupLoggers(_0x55813c)[_0x3fd3('0x6')](function(){_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x8'),require(_0x3fd3('0x9')));_0x55813c[_0x3fd3('0x7')]('/api/voice/chanspy',require(_0x3fd3('0xa')));_0x55813c['use']('/api/voice/contexts',require(_0x3fd3('0xb')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xc'),require(_0x3fd3('0xd')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xe'),require('./api/voiceMusicOnHold'));_0x55813c[_0x3fd3('0x7')]('/api/voice/queues',require(_0x3fd3('0xf')));_0x55813c['use']('/api/voice/recordings',require('./api/voiceRecording'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x10'),require(_0x3fd3('0x11')));_0x55813c['use'](_0x3fd3('0x12'),require(_0x3fd3('0x13')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x14'),require(_0x3fd3('0x15')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x16'),require(_0x3fd3('0x17')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x18'),require('./api/voiceDialReport'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x19'),require(_0x3fd3('0x1a')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x1b'),require(_0x3fd3('0x1c')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x1d'),require(_0x3fd3('0x1e')));_0x55813c[_0x3fd3('0x7')]('/api/trunks',require(_0x3fd3('0x1f')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x20'),require(_0x3fd3('0x21')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x22'),require(_0x3fd3('0x23')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x24'),require(_0x3fd3('0x25')));_0x55813c['use'](_0x3fd3('0x26'),require(_0x3fd3('0x27')));_0x55813c[_0x3fd3('0x7')]('/api/mail/substatuses',require(_0x3fd3('0x28')));_0x55813c['use'](_0x3fd3('0x29'),require(_0x3fd3('0x2a')));_0x55813c[_0x3fd3('0x7')]('/api/mail/messages',require(_0x3fd3('0x2b')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x2c'),require(_0x3fd3('0x2d')));_0x55813c['use'](_0x3fd3('0x2e'),require(_0x3fd3('0x2f')));_0x55813c['use']('/api/dashboards',require(_0x3fd3('0x30')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x31'),require(_0x3fd3('0x32')));_0x55813c['use'](_0x3fd3('0x33'),require('./api/faxAccount'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x34'),require(_0x3fd3('0x35')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x36'),require(_0x3fd3('0x37')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x38'),require('./api/faxMessage'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x39'),require('./api/faxQueue'));_0x55813c['use'](_0x3fd3('0x3a'),require(_0x3fd3('0x3b')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x3c'),require(_0x3fd3('0x3d')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x3e'),require(_0x3fd3('0x3f')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x40'),require(_0x3fd3('0x41')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x42'),require(_0x3fd3('0x43')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x44'),require(_0x3fd3('0x45')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x46'),require(_0x3fd3('0x47')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x48'),require(_0x3fd3('0x49')));_0x55813c[_0x3fd3('0x7')]('/api/openchannel/interactions',require(_0x3fd3('0x4a')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x4b'),require('./api/openchannelMessage'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x4c'),require('./api/openchannelQueue'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x4d'),require(_0x3fd3('0x4e')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x4f'),require('./api/openchannelQueueReport'));_0x55813c['use']('/api/chat/applications',require(_0x3fd3('0x50')));_0x55813c[_0x3fd3('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x55813c['use']('/api/chat/messages',require(_0x3fd3('0x51')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x52'),require(_0x3fd3('0x53')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x54'),require(_0x3fd3('0x55')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x56'),require('./api/chatGroup'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x57'),require(_0x3fd3('0x58')));_0x55813c['use']('/api/cm/companies',require(_0x3fd3('0x59')));_0x55813c[_0x3fd3('0x7')]('/api/cm/contacts',require(_0x3fd3('0x5a')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x5b'),require(_0x3fd3('0x5c')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x5d'),require(_0x3fd3('0x5e')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x5f'),require(_0x3fd3('0x60')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x61'),require(_0x3fd3('0x62')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x63'),require(_0x3fd3('0x64')));_0x55813c['use'](_0x3fd3('0x65'),require(_0x3fd3('0x66')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x67'),require(_0x3fd3('0x68')));_0x55813c['use'](_0x3fd3('0x69'),require(_0x3fd3('0x6a')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x6b'),require(_0x3fd3('0x6c')));_0x55813c['use'](_0x3fd3('0x6d'),require(_0x3fd3('0x6e')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x6f'),require(_0x3fd3('0x70')));_0x55813c['use']('/api/pauses',require('./api/pause'));_0x55813c[_0x3fd3('0x7')]('/api/cdr',require(_0x3fd3('0x71')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x72'),require(_0x3fd3('0x73')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x74'),require(_0x3fd3('0x75')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x76'),require(_0x3fd3('0x77')));_0x55813c['use'](_0x3fd3('0x78'),require('./api/tag'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x79'),require(_0x3fd3('0x7a')));_0x55813c[_0x3fd3('0x7')]('/api/cm_contact_has_items',require(_0x3fd3('0x7b')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x7c'),require(_0x3fd3('0x7d')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x7e'),require('./api/template'));_0x55813c['use'](_0x3fd3('0x7f'),require(_0x3fd3('0x80')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x81'),require('./api/variable'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x82'),require('./api/integration'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x83'),require('./api/integrationReport'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x84'),require('./api/analyticCustomReport'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x85'),require(_0x3fd3('0x86')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x87'),require(_0x3fd3('0x88')));_0x55813c['use'](_0x3fd3('0x89'),require('./api/analyticMetric'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x8a'),require(_0x3fd3('0x8b')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x8c'),require(_0x3fd3('0x8d')));_0x55813c['use']('/api/integrations/salesforce/accounts',require(_0x3fd3('0x8e')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x8f'),require(_0x3fd3('0x90')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x91'),require('./api/intSalesforceField'));_0x55813c['use'](_0x3fd3('0x92'),require(_0x3fd3('0x93')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x94'),require('./api/intSugarcrmConfiguration'));_0x55813c['use'](_0x3fd3('0x95'),require(_0x3fd3('0x96')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x97'),require('./api/intDeskAccount'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x98'),require(_0x3fd3('0x99')));_0x55813c[_0x3fd3('0x7')]('/api/integrations/desk/fields',require(_0x3fd3('0x9a')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x9b'),require(_0x3fd3('0x9c')));_0x55813c['use'](_0x3fd3('0x9d'),require('./api/intZohoConfiguration'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x9e'),require('./api/intZohoField'));_0x55813c[_0x3fd3('0x7')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x9f'),require('./api/intZendeskConfiguration'));_0x55813c['use'](_0x3fd3('0xa0'),require(_0x3fd3('0xa1')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xa2'),require(_0x3fd3('0xa3')));_0x55813c[_0x3fd3('0x7')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xa4'),require('./api/intFreshdeskField'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xa5'),require(_0x3fd3('0xa6')));_0x55813c[_0x3fd3('0x7')]('/api/integrations/vtiger/configurations',require(_0x3fd3('0xa7')));_0x55813c['use'](_0x3fd3('0xa8'),require(_0x3fd3('0xa9')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xaa'),require('./api/intServicenowAccount'));_0x55813c['use']('/api/integrations/servicenow/configurations',require(_0x3fd3('0xab')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xac'),require(_0x3fd3('0xad')));_0x55813c['use']('/api/integrations/dynamics365/accounts',require(_0x3fd3('0xae')));_0x55813c['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x55813c['use'](_0x3fd3('0xaf'),require('./api/intDynamics365Field'));_0x55813c['use'](_0x3fd3('0xb0'),require(_0x3fd3('0xb1')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xb2'),require(_0x3fd3('0xb3')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xb4'),require(_0x3fd3('0xb5')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xb6'),require('./api/network'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xb7'),require('./api/chatQueueReport'));_0x55813c['use'](_0x3fd3('0xb8'),require(_0x3fd3('0xb9')));_0x55813c[_0x3fd3('0x7')]('/api/jscripty/answers/reports',require(_0x3fd3('0xba')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xbb'),require(_0x3fd3('0xbc')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xbd'),require('./api/jscriptySessionReport'));_0x55813c[_0x3fd3('0x7')]('/api/sms/reports/queue',require(_0x3fd3('0xbe')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xbf'),require(_0x3fd3('0xc0')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xc1'),require(_0x3fd3('0xc2')));_0x55813c[_0x3fd3('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xc3'),require(_0x3fd3('0xc4')));_0x55813c['use'](_0x3fd3('0xc5'),require(_0x3fd3('0xc6')));_0x55813c[_0x3fd3('0x7')]('/api/square/projects',require('./api/squareProject'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xc7'),require(_0x3fd3('0xc8')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xc9'),require(_0x3fd3('0xca')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xcb'),require(_0x3fd3('0xcc')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xcd'),require('./api/license'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xce'),require(_0x3fd3('0xcf')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xd0'),require(_0x3fd3('0xd1')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xd2'),require(_0x3fd3('0xd3')));_0x55813c['use'](_0x3fd3('0xd4'),require(_0x3fd3('0xd5')));_0x55813c['use']('/api/mail/reports/transfer',require(_0x3fd3('0xd6')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xd7'),require(_0x3fd3('0xd8')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xd9'),require(_0x3fd3('0xda')));_0x55813c[_0x3fd3('0x7')]('/api/openchannel/reports/transfer',require(_0x3fd3('0xdb')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xdc'),require(_0x3fd3('0xdd')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xde'),require('./api/cmList'));_0x55813c[_0x3fd3('0x7')]('/api/voice/prefixes',require(_0x3fd3('0xdf')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xe0'),require(_0x3fd3('0xe1')));_0x55813c['use'](_0x3fd3('0xe2'),require(_0x3fd3('0xe3')));_0x55813c['use'](_0x3fd3('0xe4'),require(_0x3fd3('0xe5')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xe6'),require(_0x3fd3('0xe7')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xe8'),require(_0x3fd3('0xe9')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xea'),require(_0x3fd3('0xeb')));_0x55813c[_0x3fd3('0x7')]('/api/whatsapp/interactions',require(_0x3fd3('0xec')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xed'),require(_0x3fd3('0xee')));_0x55813c['use']('/api/whatsapp/reports/queue',require(_0x3fd3('0xef')));_0x55813c['use'](_0x3fd3('0xf0'),require(_0x3fd3('0xf1')));_0x55813c['use'](_0x3fd3('0xf2'),require(_0x3fd3('0xf3')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xf4'),require(_0x3fd3('0xf5')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xf6'),require(_0x3fd3('0xf7')));_0x55813c['use']('/api/user-settings',require('./api/user-setting'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xf8'),require(_0x3fd3('0xf9')));_0x55813c['use']('/api/auth/google',require(_0x3fd3('0xfa')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xfb'),require(_0x3fd3('0xfc')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0xfd'),require(_0x3fd3('0xfe')));_0x55813c['use'](_0x3fd3('0xff'),require(_0x3fd3('0x100')));_0x55813c['use'](_0x3fd3('0x101'),require('./api/version'));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x102'),require(_0x3fd3('0x103')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x104'),require(_0x3fd3('0x105')));_0x55813c[_0x3fd3('0x7')]('/api/webbar',require('./api/webbar'));_0x55813c['use'](_0x3fd3('0x106'),clientSideLogs);_0x55813c['use'](_0x3fd3('0x107'),express['static'](path[_0x3fd3('0x108')](config[_0x3fd3('0x109')],'/apidoc')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x10a'),express[_0x3fd3('0x10b')](path['join'](config[_0x3fd3('0x109')],'/www')));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x10c'),express[_0x3fd3('0x10b')](path[_0x3fd3('0x108')](config[_0x3fd3('0x109')],_0x3fd3('0x10c'))));_0x55813c['use'](_0x3fd3('0x10d'),express[_0x3fd3('0x10b')](path[_0x3fd3('0x108')](config[_0x3fd3('0x109')],_0x3fd3('0x10e'),_0x3fd3('0x10f'))));_0x55813c[_0x3fd3('0x7')](_0x3fd3('0x110'),express['static'](path[_0x3fd3('0x108')](config[_0x3fd3('0x109')],'/server/files/plugins')));_0x55813c[_0x3fd3('0x111')](_0x3fd3('0x112'))[_0x3fd3('0x113')](errors[0x194]);_0x55813c[_0x3fd3('0x111')]('/*')[_0x3fd3('0x113')](function(_0x4607bd,_0x36daf8){_0x36daf8[_0x3fd3('0x114')](path['resolve'](_0x55813c['get'](_0x3fd3('0x115'))+'/index.html'));});return _0x55813c;});}; \ No newline at end of file +var _0xb1ae=['./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/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/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime'];(function(_0x461e08,_0x32ea15){var _0x19a69c=function(_0x571759){while(--_0x571759){_0x461e08['push'](_0x461e08['shift']());}};_0x19a69c(++_0x32ea15);}(_0xb1ae,0x139));var _0xeb1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb1ae[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0xeb1a('0x0'));var express=require('express');var errors=require(_0xeb1a('0x1'));var config=require(_0xeb1a('0x2'));var setupLoggers=require(_0xeb1a('0x3'))['setupLoggers'];var clientSideLogs=require(_0xeb1a('0x4'));exports['default']=function(_0x2ab13f){return setupLoggers(_0x2ab13f)[_0xeb1a('0x5')](function(){_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7'),require(_0xeb1a('0x8')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x9'),require(_0xeb1a('0xa')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb'),require('./api/voiceContext'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc'),require(_0xeb1a('0xd')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe'),require(_0xeb1a('0xf')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x10'),require(_0xeb1a('0x11')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x12'),require(_0xeb1a('0x13')));_0x2ab13f[_0xeb1a('0x6')]('/api/screen/recordings',require(_0xeb1a('0x14')));_0x2ab13f['use'](_0xeb1a('0x15'),require('./api/voiceMail'));_0x2ab13f[_0xeb1a('0x6')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x16'),require(_0xeb1a('0x17')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x18'),require(_0xeb1a('0x19')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x1a'),require('./api/voiceAgentReport'));_0x2ab13f['use'](_0xeb1a('0x1b'),require(_0xeb1a('0x1c')));_0x2ab13f['use'](_0xeb1a('0x1d'),require(_0xeb1a('0x1e')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x1f'),require(_0xeb1a('0x20')));_0x2ab13f['use'](_0xeb1a('0x21'),require(_0xeb1a('0x22')));_0x2ab13f[_0xeb1a('0x6')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x2ab13f['use'](_0xeb1a('0x23'),require('./api/mailAccount'));_0x2ab13f['use'](_0xeb1a('0x24'),require('./api/mailQueue'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x25'),require(_0xeb1a('0x26')));_0x2ab13f['use']('/api/mail/interactions',require(_0xeb1a('0x27')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x28'),require(_0xeb1a('0x29')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x2a'),require('./api/mailApplication'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x2b'),require(_0xeb1a('0x2c')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x2d'),require(_0xeb1a('0x2e')));_0x2ab13f['use']('/api/dashboards/items',require(_0xeb1a('0x2f')));_0x2ab13f['use']('/api/fax/accounts',require('./api/faxAccount'));_0x2ab13f['use'](_0xeb1a('0x30'),require(_0xeb1a('0x31')));_0x2ab13f['use']('/api/fax/interactions',require(_0xeb1a('0x32')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x33'),require(_0xeb1a('0x34')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x35'),require(_0xeb1a('0x36')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x37'),require(_0xeb1a('0x38')));_0x2ab13f[_0xeb1a('0x6')]('/api/sms/accounts',require(_0xeb1a('0x39')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x3a'),require('./api/smsApplication'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x3b'),require(_0xeb1a('0x3c')));_0x2ab13f[_0xeb1a('0x6')]('/api/sms/messages',require(_0xeb1a('0x3d')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x3e'),require(_0xeb1a('0x3f')));_0x2ab13f['use'](_0xeb1a('0x40'),require(_0xeb1a('0x41')));_0x2ab13f['use'](_0xeb1a('0x42'),require(_0xeb1a('0x43')));_0x2ab13f['use'](_0xeb1a('0x44'),require(_0xeb1a('0x45')));_0x2ab13f[_0xeb1a('0x6')]('/api/openchannel/messages',require(_0xeb1a('0x46')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x47'),require(_0xeb1a('0x48')));_0x2ab13f['use']('/api/chat/websites',require(_0xeb1a('0x49')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4a'),require(_0xeb1a('0x4b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4c'),require('./api/chatApplication'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4d'),require('./api/chatInteraction'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x4e'),require(_0xeb1a('0x4f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x50'),require(_0xeb1a('0x51')));_0x2ab13f['use'](_0xeb1a('0x52'),require(_0xeb1a('0x53')));_0x2ab13f['use']('/api/chat/groups',require('./api/chatGroup'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x54'),require(_0xeb1a('0x55')));_0x2ab13f[_0xeb1a('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x56'),require('./api/cmContact'));_0x2ab13f['use']('/api/cm/hopper',require('./api/cmHopper'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x57'),require(_0xeb1a('0x58')));_0x2ab13f['use'](_0xeb1a('0x59'),require('./api/cmHopperFinal'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x5a'),require(_0xeb1a('0x5b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x5c'),require('./api/cmCustomField'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x5d'),require(_0xeb1a('0x5e')));_0x2ab13f['use']('/api/automations',require(_0xeb1a('0x5f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x60'),require(_0xeb1a('0x61')));_0x2ab13f['use'](_0xeb1a('0x62'),require('./api/disposition'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x63'),require(_0xeb1a('0x64')));_0x2ab13f[_0xeb1a('0x6')]('/api/intervals',require(_0xeb1a('0x65')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x66'),require(_0xeb1a('0x67')));_0x2ab13f['use'](_0xeb1a('0x68'),require(_0xeb1a('0x69')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x6a'),require(_0xeb1a('0x6b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x6c'),require('./api/schedule'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x6d'),require(_0xeb1a('0x6e')));_0x2ab13f['use'](_0xeb1a('0x6f'),require(_0xeb1a('0x70')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x71'),require(_0xeb1a('0x72')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x73'),require(_0xeb1a('0x74')));_0x2ab13f['use']('/api/cm_hopper_additional_phones',require(_0xeb1a('0x75')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x76'),require('./api/template'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x77'),require('./api/trigger'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x78'),require(_0xeb1a('0x79')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7a'),require(_0xeb1a('0x7b')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7c'),require(_0xeb1a('0x7d')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x7e'),require(_0xeb1a('0x7f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x80'),require(_0xeb1a('0x81')));_0x2ab13f['use']('/api/analytics/extracted_reports',require(_0xeb1a('0x82')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x83'),require(_0xeb1a('0x84')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x85'),require('./api/analyticFieldReport'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x86'),require('./api/analyticTreeReport'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x87'),require('./api/intSalesforceAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x88'),require(_0xeb1a('0x89')));_0x2ab13f[_0xeb1a('0x6')]('/api/integrations/salesforce/fields',require(_0xeb1a('0x8a')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x8b'),require(_0xeb1a('0x8c')));_0x2ab13f['use']('/api/integrations/sugarcrm/configurations',require(_0xeb1a('0x8d')));_0x2ab13f[_0xeb1a('0x6')]('/api/integrations/sugarcrm/fields',require(_0xeb1a('0x8e')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x8f'),require('./api/intDeskAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x90'),require(_0xeb1a('0x91')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x92'),require(_0xeb1a('0x93')));_0x2ab13f['use'](_0xeb1a('0x94'),require(_0xeb1a('0x95')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x96'),require('./api/intZohoConfiguration'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x97'),require('./api/intZohoField'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x98'),require('./api/intZendeskAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x99'),require(_0xeb1a('0x9a')));_0x2ab13f['use'](_0xeb1a('0x9b'),require(_0xeb1a('0x9c')));_0x2ab13f[_0xeb1a('0x6')]('/api/integrations/freshdesk/accounts',require(_0xeb1a('0x9d')));_0x2ab13f['use'](_0xeb1a('0x9e'),require(_0xeb1a('0x9f')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa0'),require(_0xeb1a('0xa1')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa2'),require('./api/intVtigerAccount'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa3'),require(_0xeb1a('0xa4')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa5'),require(_0xeb1a('0xa6')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xa7'),require(_0xeb1a('0xa8')));_0x2ab13f['use'](_0xeb1a('0xa9'),require(_0xeb1a('0xaa')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xab'),require(_0xeb1a('0xac')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xad'),require(_0xeb1a('0xae')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xaf'),require(_0xeb1a('0xb0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb1'),require(_0xeb1a('0xb2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb3'),require(_0xeb1a('0xb4')));_0x2ab13f['use'](_0xeb1a('0xb5'),require(_0xeb1a('0xb6')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb7'),require(_0xeb1a('0xb8')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xb9'),require('./api/network'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xba'),require(_0xeb1a('0xbb')));_0x2ab13f[_0xeb1a('0x6')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xbc'),require(_0xeb1a('0xbd')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xbe'),require('./api/jscriptyQuestionReport'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xbf'),require(_0xeb1a('0xc0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc1'),require(_0xeb1a('0xc2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc3'),require('./api/squareReport'));_0x2ab13f['use'](_0xeb1a('0xc4'),require('./api/squareReportDetail'));_0x2ab13f[_0xeb1a('0x6')]('/api/jscripty/projects',require(_0xeb1a('0xc5')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc6'),require(_0xeb1a('0xc7')));_0x2ab13f[_0xeb1a('0x6')]('/api/square/odbc',require('./api/squareOdbc'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xc8'),require(_0xeb1a('0xc9')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xca'),require(_0xeb1a('0xcb')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xcc'),require(_0xeb1a('0xcd')));_0x2ab13f['use'](_0xeb1a('0xce'),require('./api/team'));_0x2ab13f[_0xeb1a('0x6')]('/api/license',require(_0xeb1a('0xcf')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xd0'),require(_0xeb1a('0xd1')));_0x2ab13f['use'](_0xeb1a('0xd2'),require(_0xeb1a('0xd3')));_0x2ab13f['use'](_0xeb1a('0xd4'),require(_0xeb1a('0xd5')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xd6'),require(_0xeb1a('0xd7')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xd8'),require(_0xeb1a('0xd9')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xda'),require(_0xeb1a('0xdb')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xdc'),require(_0xeb1a('0xdd')));_0x2ab13f[_0xeb1a('0x6')]('/api/openchannel/reports/transfer',require(_0xeb1a('0xde')));_0x2ab13f[_0xeb1a('0x6')]('/api/sms/reports/transfer',require(_0xeb1a('0xdf')));_0x2ab13f[_0xeb1a('0x6')]('/api/cm/lists',require(_0xeb1a('0xe0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe1'),require(_0xeb1a('0xe2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe3'),require(_0xeb1a('0xe4')));_0x2ab13f[_0xeb1a('0x6')]('/api/userProfile/sections',require(_0xeb1a('0xe5')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe6'),require(_0xeb1a('0xe7')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xe8'),require(_0xeb1a('0xe9')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xea'),require(_0xeb1a('0xeb')));_0x2ab13f['use']('/api/whatsapp/applications',require(_0xeb1a('0xec')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xed'),require('./api/whatsappInteraction'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xee'),require(_0xeb1a('0xef')));_0x2ab13f[_0xeb1a('0x6')]('/api/whatsapp/reports/queue',require(_0xeb1a('0xf0')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xf1'),require(_0xeb1a('0xf2')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xf3'),require(_0xeb1a('0xf4')));_0x2ab13f['use'](_0xeb1a('0xf5'),require('./api/cloudProvider'));_0x2ab13f['use'](_0xeb1a('0xf6'),require(_0xeb1a('0xf7')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xf8'),require('./api/user-setting'));_0x2ab13f['use'](_0xeb1a('0xf9'),require(_0xeb1a('0xfa')));_0x2ab13f['use'](_0xeb1a('0xfb'),require(_0xeb1a('0xfc')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0xfd'),require(_0xeb1a('0xfe')));_0x2ab13f[_0xeb1a('0x6')]('/api/jira',require(_0xeb1a('0xff')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x100'),require('./api/rpc'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x101'),require('./api/version'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x102'),require('./api/system'));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x103'),require(_0xeb1a('0x104')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x105'),require(_0xeb1a('0x106')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x107'),clientSideLogs);_0x2ab13f['use']('/apidoc',express[_0xeb1a('0x108')](path[_0xeb1a('0x109')](config['root'],_0xeb1a('0x10a'))));_0x2ab13f['use'](_0xeb1a('0x10b'),express[_0xeb1a('0x108')](path[_0xeb1a('0x109')](config[_0xeb1a('0x10c')],_0xeb1a('0x10b'))));_0x2ab13f['use'](_0xeb1a('0x10d'),express[_0xeb1a('0x108')](path[_0xeb1a('0x109')](config[_0xeb1a('0x10c')],_0xeb1a('0x10d'))));_0x2ab13f['use'](_0xeb1a('0x10e'),express[_0xeb1a('0x108')](path['join'](config['root'],_0xeb1a('0x10f'),'3.8.1')));_0x2ab13f[_0xeb1a('0x6')](_0xeb1a('0x110'),express[_0xeb1a('0x108')](path['join'](config[_0xeb1a('0x10c')],'/server/files/plugins')));_0x2ab13f[_0xeb1a('0x111')](_0xeb1a('0x112'))['get'](errors[0x194]);_0x2ab13f['route']('/*')[_0xeb1a('0x113')](function(_0x2a0db1,_0x37de4e){_0x37de4e[_0xeb1a('0x114')](path[_0xeb1a('0x115')](_0x2ab13f['get'](_0xeb1a('0x116'))+_0xeb1a('0x117')));});return _0x2ab13f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9297c66..545bc4a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a1d=['../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/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/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc'];(function(_0x5cd675,_0x352cca){var _0x2379b0=function(_0x2e510b){while(--_0x2e510b){_0x5cd675['push'](_0x5cd675['shift']());}};_0x2379b0(++_0x352cca);}(_0x4a1d,0x113));var _0xd4a1=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x4a1d[_0x122096];return _0x3d1966;};'use strict';var jayson=require(_0xd4a1('0x0'));var _=require(_0xd4a1('0x1'));var config=require(_0xd4a1('0x2'));exports['listen']=function(){return new Promise(function(_0x48ce0e,_0x5aa7b2){var _0x4564f2={};_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x3')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x5')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x6')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/voiceRecording/voiceRecording.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x7')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x8')));_0x4564f2=_['merge'](_0x4564f2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x9')));_0x4564f2=_['merge'](_0x4564f2,require('../api/trunk/trunk.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0xa')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0xb')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0xc')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0xd')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0xe')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0xf')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x10')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x11')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x12')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x13')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x14')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x15')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/faxQueue/faxQueue.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x16')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/smsAccount/smsAccount.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x17')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x18')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x19')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x1a')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x1b')));_0x4564f2=_['merge'](_0x4564f2,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x1c')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x1d')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x1e')));_0x4564f2=_['merge'](_0x4564f2,require('../api/chatMessage/chatMessage.rpc'));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x1f')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x20')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x21')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x22')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x23')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x24')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x25')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x26')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x27')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/sound/sound.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x28')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/template/template.rpc'));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x29')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x2a')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x2b')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x2c')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x2d')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x2e')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x2f')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x30')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x31')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x32')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x33')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x34')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x35')));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x36')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x37')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x38')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x39')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/squareMessage/squareMessage.rpc'));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x3a')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/attachment/attachment.rpc'));_0x4564f2=_['merge'](_0x4564f2,require(_0xd4a1('0x3b')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x3c')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x3d')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x3e')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require(_0xd4a1('0x3f')));_0x4564f2=_[_0xd4a1('0x4')](_0x4564f2,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4affc5=jayson[_0xd4a1('0x40')](_0x4564f2)[_0xd4a1('0x41')]();var _0x401240=config[_0xd4a1('0x42')][_0xd4a1('0x43')]||config['port']+0x1;var _0xc62e60=config['rpc']['ip']||_0xd4a1('0x44');_0x4affc5['on'](_0xd4a1('0x45'),function(_0x3d964f){return _0x5aa7b2(_0x3d964f);});_0x4affc5[_0xd4a1('0x46')](_0x401240,_0xc62e60,function(){console[_0xd4a1('0x47')](_0xd4a1('0x48'),_0xc62e60,_0x401240);require(_0xd4a1('0x49'))[_0xd4a1('0x4a')]();return _0x48ce0e('RPC\x20listening\x20on\x20'+_0xc62e60+':'+_0x401240);});});}; \ No newline at end of file +var _0x2675=['../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x2be833,_0x200402){var _0xfc793a=function(_0x5e06c3){while(--_0x5e06c3){_0x2be833['push'](_0x2be833['shift']());}};_0xfc793a(++_0x200402);}(_0x2675,0x75));var _0x5267=function(_0x282c12,_0x551a59){_0x282c12=_0x282c12-0x0;var _0x3c9fe2=_0x2675[_0x282c12];return _0x3c9fe2;};'use strict';var jayson=require(_0x5267('0x0'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x1da342,_0x2ae442){var _0x57c95a={};_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x3')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x4')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x5')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x6')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x7')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x8')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x9')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0xa')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0xb')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0xc')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0xd')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0xe')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0xf')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x10')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x11')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x12')));_0x57c95a=_['merge'](_0x57c95a,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x13')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x14')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x15')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x16')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x17')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x18')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x19')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/smsInteraction/smsInteraction.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/smsMessage/smsMessage.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1a')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1b')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1c')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x57c95a=_['merge'](_0x57c95a,require('../api/chatInteraction/chatInteraction.rpc'));_0x57c95a=_['merge'](_0x57c95a,require('../api/chatMessage/chatMessage.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1d')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1e')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x1f')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x20')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x21')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/interval/interval.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x22')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x23')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x24')));_0x57c95a=_['merge'](_0x57c95a,require('../api/template/template.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x25')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/variable/variable.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x26')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x27')));_0x57c95a=_['merge'](_0x57c95a,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x28')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x29')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x2a')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2b')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2c')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x2d')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x2e')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x2f')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x30')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x31')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x32')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x33')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x34')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x35')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x36')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x37')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x38')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x39')));_0x57c95a=_['merge'](_0x57c95a,require(_0x5267('0x3a')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x3b')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x3c')));_0x57c95a=_[_0x5267('0x1')](_0x57c95a,require(_0x5267('0x3d')));var _0x487dfc=jayson[_0x5267('0x3e')](_0x57c95a)['http']();var _0x3db34d=config['rpc']['port']||config['port']+0x1;var _0x46bfcc=config['rpc']['ip']||_0x5267('0x3f');_0x487dfc['on'](_0x5267('0x40'),function(_0x3d4b19){return _0x2ae442(_0x3d4b19);});_0x487dfc[_0x5267('0x41')](_0x3db34d,_0x46bfcc,function(){console['log'](_0x5267('0x42'),_0x46bfcc,_0x3db34d);require(_0x5267('0x43'))['default']();return _0x1da342('RPC\x20listening\x20on\x20'+_0x46bfcc+':'+_0x3db34d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 0fe457c..b673ae4 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 _0xb796=['E_AGI_SOCKET_TIMEOUT','destroy','function','write','inherits','prototype','command','sync','answer','getData','beep','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','label','exports','util','lodash','events','./error','call','setTimeout','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x14bf63,_0xdbd373){var _0x410d22=function(_0x2e5e3a){while(--_0x2e5e3a){_0x14bf63['push'](_0x14bf63['shift']());}};_0x410d22(++_0xdbd373);}(_0xb796,0xd2));var _0x6b79=function(_0x5636a5,_0x2c6a23){_0x5636a5=_0x5636a5-0x0;var _0x2c774b=_0xb796[_0x5636a5];return _0x2c774b;};'use strict';var util=require(_0x6b79('0x0'));var _=require(_0x6b79('0x1'));var EventEmitter=require(_0x6b79('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x6b79('0x3'));function AGIChannel(_0x229129){var _0x17af53=this,_0x3ff52c=new AGIReply(),_0x3b4114=![],_0x16c2f4={};EventEmitter[_0x6b79('0x4')](_0x17af53);_0x229129['setEncoding']('utf8');_0x229129[_0x6b79('0x5')](0x8*0x3c*0x3c*0x3e8);_0x3ff52c[_0x6b79('0x6')](_0x6b79('0x7'));_0x3ff52c['on'](_0x6b79('0x8'),function(_0x246171){for(var _0x45d1bc in _0x246171){_0x17af53[_0x45d1bc]=_0x246171[_0x45d1bc];}_0x17af53[_0x6b79('0x9')](_0x6b79('0xa'));});_0x3ff52c['on'](_0x6b79('0xb'),function(_0x3263ce){if(_0x3263ce[_0x6b79('0xc')]()==_0x6b79('0xd')){_0x17af53[_0x6b79('0x9')]('hangup');return;}if(_0x3263ce[_0x6b79('0xe')](0x0,0xb)==_0x6b79('0xf')){_0x3b4114=!![];}if(_0x3b4114){_0x16c2f4['rx']+=_0x3263ce+'\x0a';if(_0x3263ce[_0x6b79('0x10')](_0x6b79('0x11'))!=-0x1){_0x3b4114=![];}}else{_0x16c2f4['rx']=_0x3263ce;}if(_0x3b4114){return;}if(typeof _0x16c2f4['cb']=='function'){var _0x3795b4=_0x16c2f4['rx'][_0x6b79('0xe')](0x0,0x3),_0x4863f8=null,_0x2d4526=null;_0x3795b4=parseInt(_0x3795b4);if(isNaN(_0x3795b4)){_0x16c2f4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6b79('0x12')});return;}if(_0x3795b4!=0xc8){_0x16c2f4['cb'](null,{'code':_0x3795b4,'result':-0x1,'extra':'KO'});return;}_0x4863f8=_0x16c2f4['rx'][_0x6b79('0xe')](0x4)[_0x6b79('0x13')](_0x6b79('0x14'),'');if(_0x4863f8[_0x6b79('0x15')]('\x20')!=-0x1){_0x4863f8=_0x4863f8[_0x6b79('0x16')](0x0,_0x4863f8['indexOf']('\x20'));}if(_['startsWith'](_0x4863f8,'-1')){_0x4863f8=parseInt(_0x4863f8);}_0x2d4526=_0x16c2f4['rx']['split']('\x20');if(_0x2d4526[_0x6b79('0x17')]==0x3){_0x2d4526=_0x2d4526[0x2]['substring'](0x1,_0x2d4526[0x2][_0x6b79('0x17')]-0x1);}else if(_0x2d4526[_0x6b79('0x17')]>0x3){var _0x406141=/\((.+)\)/;var _0x515404=_0x16c2f4['rx']['match'](_0x406141);if(_0x515404){_0x2d4526=_0x515404[0x1];}else{_0x2d4526=null;}}else{_0x2d4526=null;}_0x16c2f4['cb'](null,{'code':_0x3795b4,'result':_0x4863f8,'extra':_0x2d4526});}});_0x229129['on'](_0x6b79('0x18'),function(_0x404466){_0x17af53[_0x6b79('0x9')](_0x6b79('0x18'),new AGIError(_0x6b79('0x19'),_0x404466[_0x6b79('0x1a')]));});_0x229129['on'](_0x6b79('0x1b'),function(){_0x17af53[_0x6b79('0x9')](_0x6b79('0x1b'),new AGIError(_0x6b79('0x1c')));});_0x229129['on'](_0x6b79('0x1d'),function(){_0x17af53[_0x6b79('0x9')](_0x6b79('0x1d'),new AGIError(_0x6b79('0x1e')));_0x229129[_0x6b79('0x1f')]();});_0x229129['pipe'](_0x3ff52c);this['command']=function(_0x381456,_0xaa11ec){var _0x381456=_0x381456||'',_0xaa11ec=typeof _0xaa11ec==_0x6b79('0x20')?_0xaa11ec:new Function();_0x16c2f4={'tx':_0x381456,'rx':'','cb':_0xaa11ec};_0x229129[_0x6b79('0x21')](_0x381456+'\x0a');},this[_0x6b79('0x1b')]=function(){_0x229129[_0x6b79('0x1f')]();};}util[_0x6b79('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x6b79('0x23')]['sendRequest']=function(_0x54e135){return this[_0x6b79('0x24')][_0x6b79('0x25')](this,_0x54e135);};AGIChannel['prototype'][_0x6b79('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x6b79('0x23')][_0x6b79('0x27')]=function(_0x18d0fd,_0x308368,_0x36d5d4){_0x18d0fd=_0x18d0fd===undefined?_0x6b79('0x28'):_0x18d0fd;_0x308368=_0x308368===undefined?'5':_0x308368;_0x36d5d4=_0x36d5d4===undefined?'1':_0x36d5d4;return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x2b'),_0x18d0fd,_0x308368*0x3e8,_0x36d5d4));};AGIChannel[_0x6b79('0x23')]['noop']=function(_0x3be081){_0x3be081=_0x3be081||_0x6b79('0x2c');return this['sendRequest'](util[_0x6b79('0x2a')](_0x6b79('0x2d'),_0x3be081));};AGIChannel['prototype'][_0x6b79('0x2e')]=function(_0xf24c6,_0x3c9eb6){if(_[_0x6b79('0x2f')](_0x3c9eb6)){return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x30'),_0xf24c6,_0x3c9eb6['join'](',')));}return this[_0x6b79('0x29')](util[_0x6b79('0x2a')]('EXEC\x20%s\x20%s',_0xf24c6,_0x3c9eb6));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x31')]=function(_0xdad1c3){return this['sendRequest'](util[_0x6b79('0x2a')](_0x6b79('0x32'),_0xdad1c3));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x33')]=function(_0x250955){return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x34'),_0x250955));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x35')]=function(_0x4f06b6){return this[_0x6b79('0x29')](util['format'](_0x6b79('0x36'),_0x4f06b6));};AGIChannel[_0x6b79('0x23')][_0x6b79('0xd')]=function(){return this[_0x6b79('0x29')](_0x6b79('0x37'));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x38')]=function(_0x1b22a4,_0x2104c6){var _0x26f4e8=_[_0x6b79('0x39')](_0x2104c6)||_[_0x6b79('0x3a')](_0x2104c6)?_0x2104c6[_0x6b79('0x3b')]():_0x2104c6;return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x3c'),_0x1b22a4,_0x26f4e8?_0x26f4e8[_0x6b79('0x3b')]()[_0x6b79('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x3d')]=function(_0x1eb115,_0x5cde30){return this[_0x6b79('0x29')](util[_0x6b79('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x1eb115,_0x5cde30));};AGIChannel[_0x6b79('0x23')]['sayDigits']=function(_0x68577d,_0x48b51f){return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x3e'),_0x68577d,_0x48b51f));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x3f')]=function(_0x115812,_0x4fee78){return this['sendRequest'](util[_0x6b79('0x2a')](_0x6b79('0x40'),_0x115812,_0x4fee78));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x41')]=function(_0xeea26a,_0x353c86,_0xabae45){_0x353c86=_0x353c86||this[_0x6b79('0x42')];_0xabae45=_0xabae45||0x1;this[_0x6b79('0x31')](_0xeea26a);this['setExtension'](_0x353c86);this[_0x6b79('0x35')](_0xabae45);return this[_0x6b79('0x43')](util[_0x6b79('0x2a')](_0x6b79('0x44'),_0xeea26a,_0x353c86,_0xabae45));};AGIChannel['prototype'][_0x6b79('0x45')]=function(_0x55aeb2){return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x46'),_0x55aeb2));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x47')]=function(_0xa5d8f5,_0x564bb2,_0x271bf1,_0x156855,_0x458e9d,_0x434a51){_0x564bb2=_0x564bb2||'wav';_0x271bf1=_0x271bf1||'';_0x156855=_0x156855===undefined?-0x1:_0x156855==='-1'?-0x1:_0x156855*0x3e8;_0x458e9d=_0x458e9d===undefined?'':'s='+_0x458e9d;_0x434a51=_0x434a51?_0x6b79('0x48'):'';return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x49'),_0xa5d8f5,_0x564bb2,_0x271bf1,_0x156855,_0x434a51,_0x458e9d));};AGIChannel[_0x6b79('0x23')]['streamFile']=function(_0x228857,_0x37f5c3){_0x37f5c3=_0x37f5c3||'';return this[_0x6b79('0x29')](util[_0x6b79('0x2a')](_0x6b79('0x4a'),_0x228857,_0x37f5c3));};AGIChannel[_0x6b79('0x23')][_0x6b79('0x4b')]=function(_0x1b5873){return this[_0x6b79('0x2e')](_0x6b79('0x4c'),_0x1b5873);};AGIChannel[_0x6b79('0x23')][_0x6b79('0x4d')]=function(_0x2d49e0){return this[_0x6b79('0x2e')]('WAIT',_0x2d49e0);};AGIChannel[_0x6b79('0x23')][_0x6b79('0x18')]=function(_0x4bc29f,_0x531f36){this[_0x6b79('0x43')](util[_0x6b79('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4bc29f['id'],_0x4bc29f[_0x6b79('0x4e')],_0x531f36));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6b79('0x4f')]=AGIChannel; \ No newline at end of file +var _0xc6ac=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4f9d52,_0x3938f9){_0x4f9d52=_0x4f9d52-0x0;var _0x61f98=_0xc6ac[_0x4f9d52];return _0x61f98;};'use strict';var util=require(_0xcc6a('0x0'));var _=require(_0xcc6a('0x1'));var EventEmitter=require(_0xcc6a('0x2'))[_0xcc6a('0x3')];var AGIReply=require(_0xcc6a('0x4'));var AGIError=require(_0xcc6a('0x5'));function AGIChannel(_0x17d786){var _0x31bbcd=this,_0x297643=new AGIReply(),_0x22ee99=![],_0x2f26ab={};EventEmitter[_0xcc6a('0x6')](_0x31bbcd);_0x17d786[_0xcc6a('0x7')](_0xcc6a('0x8'));_0x17d786['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x297643[_0xcc6a('0x7')](_0xcc6a('0x8'));_0x297643['on'](_0xcc6a('0x9'),function(_0x560cc4){for(var _0x43e3bf in _0x560cc4){_0x31bbcd[_0x43e3bf]=_0x560cc4[_0x43e3bf];}_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0xb'));});_0x297643['on'](_0xcc6a('0xc'),function(_0x3eb04a){if(_0x3eb04a['toLowerCase']()==_0xcc6a('0xd')){_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0xd'));return;}if(_0x3eb04a['substring'](0x0,0xb)==_0xcc6a('0xe')){_0x22ee99=!![];}if(_0x22ee99){_0x2f26ab['rx']+=_0x3eb04a+'\x0a';if(_0x3eb04a[_0xcc6a('0xf')](_0xcc6a('0x10'))!=-0x1){_0x22ee99=![];}}else{_0x2f26ab['rx']=_0x3eb04a;}if(_0x22ee99){return;}if(typeof _0x2f26ab['cb']=='function'){var _0x59ce6d=_0x2f26ab['rx'][_0xcc6a('0x11')](0x0,0x3),_0xf0f6d5=null,_0x211444=null;_0x59ce6d=parseInt(_0x59ce6d);if(isNaN(_0x59ce6d)){_0x2f26ab['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x59ce6d!=0xc8){_0x2f26ab['cb'](null,{'code':_0x59ce6d,'result':-0x1,'extra':'KO'});return;}_0xf0f6d5=_0x2f26ab['rx']['substring'](0x4)[_0xcc6a('0x12')](_0xcc6a('0x13'),'');if(_0xf0f6d5[_0xcc6a('0x14')]('\x20')!=-0x1){_0xf0f6d5=_0xf0f6d5[_0xcc6a('0x15')](0x0,_0xf0f6d5[_0xcc6a('0x14')]('\x20'));}if(_[_0xcc6a('0x16')](_0xf0f6d5,'-1')){_0xf0f6d5=parseInt(_0xf0f6d5);}_0x211444=_0x2f26ab['rx'][_0xcc6a('0x17')]('\x20');if(_0x211444[_0xcc6a('0x18')]==0x3){_0x211444=_0x211444[0x2]['substring'](0x1,_0x211444[0x2]['length']-0x1);}else if(_0x211444['length']>0x3){var _0x395a55=/\((.+)\)/;var _0x44910f=_0x2f26ab['rx'][_0xcc6a('0x19')](_0x395a55);if(_0x44910f){_0x211444=_0x44910f[0x1];}else{_0x211444=null;}}else{_0x211444=null;}_0x2f26ab['cb'](null,{'code':_0x59ce6d,'result':_0xf0f6d5,'extra':_0x211444});}});_0x17d786['on'](_0xcc6a('0x1a'),function(_0x33079c){_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0x1a'),new AGIError(_0xcc6a('0x1b'),_0x33079c[_0xcc6a('0x1c')]));});_0x17d786['on'](_0xcc6a('0x1d'),function(){_0x31bbcd[_0xcc6a('0xa')]('close',new AGIError(_0xcc6a('0x1e')));});_0x17d786['on'](_0xcc6a('0x1f'),function(){_0x31bbcd[_0xcc6a('0xa')](_0xcc6a('0x1f'),new AGIError(_0xcc6a('0x20')));_0x17d786[_0xcc6a('0x21')]();});_0x17d786[_0xcc6a('0x22')](_0x297643);this[_0xcc6a('0x23')]=function(_0x2254a8,_0x19d32c){var _0x2254a8=_0x2254a8||'',_0x19d32c=typeof _0x19d32c=='function'?_0x19d32c:new Function();_0x2f26ab={'tx':_0x2254a8,'rx':'','cb':_0x19d32c};_0x17d786[_0xcc6a('0x24')](_0x2254a8+'\x0a');},this[_0xcc6a('0x1d')]=function(){_0x17d786[_0xcc6a('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x26')]=function(_0x3a00e5){return this[_0xcc6a('0x23')][_0xcc6a('0x27')](this,_0x3a00e5);};AGIChannel[_0xcc6a('0x25')]['answer']=function(){return this[_0xcc6a('0x26')](_0xcc6a('0x28'));};AGIChannel[_0xcc6a('0x25')]['getData']=function(_0x3afb3a,_0x3dad72,_0x4da301){_0x3afb3a=_0x3afb3a===undefined?_0xcc6a('0x29'):_0x3afb3a;_0x3dad72=_0x3dad72===undefined?'5':_0x3dad72;_0x4da301=_0x4da301===undefined?'1':_0x4da301;return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x3afb3a,_0x3dad72*0x3e8,_0x4da301));};AGIChannel['prototype'][_0xcc6a('0x2c')]=function(_0x3cf14c){_0x3cf14c=_0x3cf14c||_0xcc6a('0x2d');return this['sendRequest'](util[_0xcc6a('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3cf14c));};AGIChannel['prototype'][_0xcc6a('0x2e')]=function(_0x2e9f41,_0x3aa315){if(_[_0xcc6a('0x2f')](_0x3aa315)){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')]('EXEC\x20%s\x20%s',_0x2e9f41,_0x3aa315[_0xcc6a('0x30')](',')));}return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x31'),_0x2e9f41,_0x3aa315));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x32')]=function(_0x2030a6){return this[_0xcc6a('0x26')](util['format'](_0xcc6a('0x33'),_0x2030a6));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x34')]=function(_0x1538bc){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x35'),_0x1538bc));};AGIChannel['prototype'][_0xcc6a('0x36')]=function(_0x5a41b4){return this['sendRequest'](util['format'](_0xcc6a('0x37'),_0x5a41b4));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0xd')]=function(){return this[_0xcc6a('0x26')](_0xcc6a('0x38'));};AGIChannel['prototype']['setVariable']=function(_0x10f47d,_0x11173a){var _0x4598a8=_['isBoolean'](_0x11173a)||_[_0xcc6a('0x39')](_0x11173a)?_0x11173a[_0xcc6a('0x3a')]():_0x11173a;return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x3b'),_0x10f47d,_0x4598a8?_0x4598a8[_0xcc6a('0x3a')]()[_0xcc6a('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x3c')]=function(_0x373d5b,_0x5b11c8){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x3d'),_0x373d5b,_0x5b11c8));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x3e')]=function(_0x11e5b1,_0x386cbc){return this['sendRequest'](util['format'](_0xcc6a('0x3f'),_0x11e5b1,_0x386cbc));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x40')]=function(_0x1fd8e1,_0x1e628b){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x41'),_0x1fd8e1,_0x1e628b));};AGIChannel['prototype']['continueAt']=function(_0x470e3b,_0x4a4c4d,_0x578525){_0x4a4c4d=_0x4a4c4d||this['extension'];_0x578525=_0x578525||0x1;this[_0xcc6a('0x32')](_0x470e3b);this[_0xcc6a('0x34')](_0x4a4c4d);this[_0xcc6a('0x36')](_0x578525);return this[_0xcc6a('0x2c')](util[_0xcc6a('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x470e3b,_0x4a4c4d,_0x578525));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x42')]=function(_0x17e5a0){return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x43'),_0x17e5a0));};AGIChannel['prototype'][_0xcc6a('0x44')]=function(_0xa4d48a,_0x103eee,_0x11c137,_0x494904,_0x1fe723,_0x4a9cea){_0x103eee=_0x103eee||_0xcc6a('0x45');_0x11c137=_0x11c137||'';_0x494904=_0x494904===undefined?-0x1:_0x494904==='-1'?-0x1:_0x494904*0x3e8;_0x1fe723=_0x1fe723===undefined?'':'s='+_0x1fe723;_0x4a9cea=_0x4a9cea?_0xcc6a('0x46'):'';return this[_0xcc6a('0x26')](util['format'](_0xcc6a('0x47'),_0xa4d48a,_0x103eee,_0x11c137,_0x494904,_0x4a9cea,_0x1fe723));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x48')]=function(_0x56f3e5,_0x590678){_0x590678=_0x590678||'';return this[_0xcc6a('0x26')](util[_0xcc6a('0x2a')](_0xcc6a('0x49'),_0x56f3e5,_0x590678));};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x4a')]=function(_0x5e59af){return this[_0xcc6a('0x2e')](_0xcc6a('0x4b'),_0x5e59af);};AGIChannel['prototype'][_0xcc6a('0x4c')]=function(_0xa45d06){return this[_0xcc6a('0x2e')](_0xcc6a('0x4d'),_0xa45d06);};AGIChannel[_0xcc6a('0x25')][_0xcc6a('0x1a')]=function(_0x5c88e5,_0x4e1a0b){this['noop'](util[_0xcc6a('0x2a')](_0xcc6a('0x4e'),_0x5c88e5['id'],_0x5c88e5[_0xcc6a('0x4f')],_0x4e1a0b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcc6a('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 8a56760..c9a8edc 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 _0x10d1=['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\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x10d1,0x1a7));var _0x110d=function(_0x1446fb,_0x5eb9de){_0x1446fb=_0x1446fb-0x0;var _0x1e1777=_0x10d1[_0x1446fb];return _0x1e1777;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x110d('0x0'),'E_AGI_ARGUMENT_PORT':_0x110d('0x1'),'E_AGI_SERVER_ERROR':_0x110d('0x2'),'E_AGI_SERVER_CLOSE':_0x110d('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x110d('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x110d('0x5'),'E_AGI_SOCKET_ERROR':_0x110d('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x110d('0x7'),'E_AGI_COMMAND_EMPTY':_0x110d('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x110d('0x9'),'E_AGI_IVR_ENTRY':_0x110d('0xa')};function AGIError(_0x181bc3){var _0x181bc3=_0x181bc3||null,_0x3d7378=_0x3d7378||[],_0x27ff16=0x1,_0x4e4506='';if(!error[_0x181bc3]){_0x181bc3=_0x110d('0xb');}_0x3d7378[_0x110d('0xc')](error[_0x181bc3]);while(arguments[_0x27ff16]){_0x3d7378['push'](arguments[_0x27ff16]);_0x27ff16++;}_0x4e4506=util[_0x110d('0xd')][_0x110d('0xe')](util,_0x3d7378);this[_0x110d('0xf')]=_0x4e4506;this['name']=_0x181bc3;}module[_0x110d('0x10')]=AGIError; \ No newline at end of file +var _0x8613=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.'];(function(_0x4b298c,_0x5e4000){var _0x388abf=function(_0x7c024a){while(--_0x7c024a){_0x4b298c['push'](_0x4b298c['shift']());}};_0x388abf(++_0x5e4000);}(_0x8613,0x135));var _0x3861=function(_0x11a566,_0x4b82c5){_0x11a566=_0x11a566-0x0;var _0x2395ac=_0x8613[_0x11a566];return _0x2395ac;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x3861('0x0'),'E_AGI_ARGUMENT_PORT':_0x3861('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3861('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3861('0x3'),'E_AGI_SOCKET_ERROR':_0x3861('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x3861('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3861('0x6'),'E_AGI_IVR_ENTRY':_0x3861('0x7')};function AGIError(_0x1e773f){var _0x1e773f=_0x1e773f||null,_0x145317=_0x145317||[],_0x294eab=0x1,_0x5e93f3='';if(!error[_0x1e773f]){_0x1e773f='E_AGI_UNDEFINED';}_0x145317[_0x3861('0x8')](error[_0x1e773f]);while(arguments[_0x294eab]){_0x145317[_0x3861('0x8')](arguments[_0x294eab]);_0x294eab++;}_0x5e93f3=util[_0x3861('0x9')]['apply'](util,_0x145317);this[_0x3861('0xa')]=_0x5e93f3;this[_0x3861('0xb')]=_0x1e773f;}module[_0x3861('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index f08fc35..5fffb38 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f48=['redis','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','agi','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis','../../config/environment'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x1f48,0x73));var _0x81f4=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x1f48[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x81f4('0x0'));var EventEmitter=require(_0x81f4('0x1'))[_0x81f4('0x2')];var Redis=require(_0x81f4('0x3'));var AGIError=require('./error');var config=require(_0x81f4('0x4'));config[_0x81f4('0x5')]=_['defaults'](config[_0x81f4('0x5')],{'host':_0x81f4('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x81f4('0x7')]('agi',function(_0x24017a){if(_0x24017a)return eventEmitter[_0x81f4('0x8')](_0x81f4('0x9'),new AGIError(_0x81f4('0xa'),_0x24017a));});sub['on']('message',function(_0x474292,_0x287e2e){if(_0x474292!==_0x81f4('0xb'))return;try{var _0x387038=JSON[_0x81f4('0xc')](_0x287e2e);eventEmitter[_0x81f4('0x8')](_0x81f4('0xd'),_0x387038);}catch(_0x27c322){eventEmitter['emit'](_0x81f4('0x9'),new AGIError(_0x81f4('0xa'),_0x27c322));}});module[_0x81f4('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa182=['ioredis','./error','../../config/environment','defaults','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter'];(function(_0x2beeed,_0x5df914){var _0x446258=function(_0x40fc7c){while(--_0x40fc7c){_0x2beeed['push'](_0x2beeed['shift']());}};_0x446258(++_0x5df914);}(_0xa182,0x1eb));var _0x2a18=function(_0x4afd17,_0x85902e){_0x4afd17=_0x4afd17-0x0;var _0x13b64f=_0xa182[_0x4afd17];return _0x13b64f;};'use strict';var _=require(_0x2a18('0x0'));var EventEmitter=require('events')[_0x2a18('0x1')];var Redis=require(_0x2a18('0x2'));var AGIError=require(_0x2a18('0x3'));var config=require(_0x2a18('0x4'));config['redis']=_[_0x2a18('0x5')](config[_0x2a18('0x6')],{'host':_0x2a18('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2a18('0x6')]);sub[_0x2a18('0x8')](_0x2a18('0x9'),function(_0x3228e2){if(_0x3228e2)return eventEmitter[_0x2a18('0xa')](_0x2a18('0xb'),new AGIError(_0x2a18('0xc'),_0x3228e2));});sub['on'](_0x2a18('0xd'),function(_0x38a3d3,_0x27562a){if(_0x38a3d3!==_0x2a18('0x9'))return;try{var _0x46518d=JSON[_0x2a18('0xe')](_0x27562a);eventEmitter[_0x2a18('0xa')](_0x2a18('0xf'),_0x46518d);}catch(_0x2be4de){eventEmitter[_0x2a18('0xa')](_0x2a18('0xb'),new AGIError(_0x2a18('0xc'),_0x2be4de));}});module[_0x2a18('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index de3e7f1..cc8a731 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 _0x2e97=['numberOfEdges','size','vertices','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','exports','../../../config/logger','menu','edges','prototype','addEdge'];(function(_0x1afb3b,_0x12c98a){var _0x22d859=function(_0x285c38){while(--_0x285c38){_0x1afb3b['push'](_0x1afb3b['shift']());}};_0x22d859(++_0x12c98a);}(_0x2e97,0x13d));var _0x72e9=function(_0x2f4d8d,_0x5827c2){_0x2f4d8d=_0x2f4d8d-0x0;var _0x2773a9=_0x2e97[_0x2f4d8d];return _0x2773a9;};'use strict';var _=require('lodash');var logger=require(_0x72e9('0x0'))('agi');var verticesWithRetry=[_0x72e9('0x1'),'getdigits','getsecretdigits'];var Graph=function(){this['vertices']={};this[_0x72e9('0x2')]={};this['numberOfEdges']=0x0;};Graph[_0x72e9('0x3')]['addVertex']=function(_0x5102c9){this['vertices'][_0x5102c9['id']]=_0x5102c9;this[_0x72e9('0x2')][_0x5102c9['id']]=[];};Graph['prototype'][_0x72e9('0x4')]=function(_0x588a75,_0xbde7cf,_0x5cb154){this[_0x72e9('0x2')][_0x588a75]['push']({'target':_0xbde7cf,'condition':_0x5cb154});this[_0x72e9('0x5')]+=0x1;};Graph[_0x72e9('0x3')][_0x72e9('0x6')]=function(){return _[_0x72e9('0x6')](this[_0x72e9('0x7')]);};Graph[_0x72e9('0x3')][_0x72e9('0x8')]=function(){return this[_0x72e9('0x5')];};Graph[_0x72e9('0x3')][_0x72e9('0x9')]=function(_0x354d76){return this[_0x72e9('0x7')][_0x354d76];};Graph[_0x72e9('0x3')][_0x72e9('0xa')]=function(_0x1ba939,_0x3719c5){if(!this[_0x72e9('0x7')][_0x1ba939]){return logger[_0x72e9('0xb')](_0x72e9('0xc'));}var _0x2b1bb8=_0x3719c5(this[_0x72e9('0x7')][_0x1ba939]);if(!_0x2b1bb8){return logger[_0x72e9('0xb')](_0x72e9('0xd'));}if(this[_0x72e9('0x2')][_0x1ba939][_0x72e9('0xe')]===0x0){return logger['info'](_0x72e9('0xf'));}for(var _0x48d1a8=0x0,_0xef09a0=[],_0x401c95=![];_0x48d1a8\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','then','[LICENSE]','finally','listening','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','defaults','127.0.0.1','projectUpdate','nextTick','error','findIndex','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','calleridname','callerid','arg_1','evtHangup','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x7f85,0xb0));var _0x57f8=function(_0x31a16a,_0x1d60e3){_0x31a16a=_0x31a16a-0x0;var _0x21c892=_0x7f85[_0x31a16a];return _0x21c892;};'use strict';var _=require(_0x57f8('0x0'));var syncho=require(_0x57f8('0x1'));var util=require(_0x57f8('0x2'));var config=require(_0x57f8('0x3'));var logger=require(_0x57f8('0x4'))(_0x57f8('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x57f8('0x6'));var Project=require(_0x57f8('0x7'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config['agi']=_[_0x57f8('0x8')](config[_0x57f8('0x5')],{'ip':_0x57f8('0x9'),'port':0x11dd});AGIEmitter['on'](_0x57f8('0xa'),projectUpdateHandler);function connectionHandler(_0x597fd0){process[_0x57f8('0xb')](function(){syncho(function(){try{setChannelVariables(_0x597fd0);agiHandler(_0x597fd0);}catch(_0x386984){logger[_0x57f8('0xc')](_0x386984['stack']);}});});}function projectUpdateHandler(_0x2f8f37){try{var _0x57cacf=_[_0x57f8('0xd')](projects,['id',_0x2f8f37['id']]);if(_0x57cacf>-0x1){if(_0x2f8f37['deleted']===!![]){projects['splice'](_0x57cacf,0x1);}else{projects[_0x57cacf]=_0x2f8f37;}}else{projects['push'](_0x2f8f37);}}catch(_0x59dc4e){logger['error'](_0x59dc4e['stack']);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x57f8('0x5')][_0x57f8('0xe')]);logger['info'](util[_0x57f8('0xf')](_0x57f8('0x10'),config['agi']['ip'],config[_0x57f8('0x5')][_0x57f8('0xe')]));}function errorHandler(_0x3c36ce){if(_0x3c36ce&&_0x3c36ce[_0x57f8('0x11')]&&_0x3c36ce[_0x57f8('0x12')]){logger[_0x57f8('0xc')](util[_0x57f8('0xf')](_0x57f8('0x13'),_0x3c36ce[_0x57f8('0x11')],_0x3c36ce['message']));}else{logger[_0x57f8('0xc')](util[_0x57f8('0xf')](_0x57f8('0x14'),_0x3c36ce['stack']));}}function closeHandler(){logger[_0x57f8('0x15')](util[_0x57f8('0xf')](_0x57f8('0x16'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x57f8('0x17')],this[_0x57f8('0x18')]));try{createSquareReport(this);}catch(_0x53bdc0){logger['error'](_0x53bdc0['stack']);}}function timeoutHandler(){logger[_0x57f8('0x15')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x57f8('0x19')],this[_0x57f8('0x1a')],this[_0x57f8('0x17')],this[_0x57f8('0x18')]));}function hangupHandler(){logger[_0x57f8('0x15')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x57f8('0x1b')],this[_0x57f8('0x19')],this[_0x57f8('0x1a')],this[_0x57f8('0x17')],this[_0x57f8('0x18')]));this[_0x57f8('0x1c')]=!![];}function createSquareReport(_0x1c478f,_0x38395a){rpc['createSquareReport'](_0x1c478f)['then'](function(_0x18369b){if(_0x38395a){_0x38395a(null,_0x18369b);}})[_0x57f8('0x1d')](function(_0x26d4ad){if(_0x38395a){_0x38395a(null,_0x26d4ad);}});}function setChannelVariables(_0x4738bc){for(var _0x3889db in _0x4738bc){if(_0x4738bc[_0x57f8('0x1e')](_0x3889db)){if(_0x3889db[_0x57f8('0x1f')](_0x57f8('0x20'))===0x0){_0x4738bc[_0x3889db[_0x57f8('0x21')](0x4)]=_0x4738bc[_0x3889db];delete _0x4738bc[_0x3889db];}}}}function agiHandler(_0x2ec779){logger['debug'](_0x57f8('0x22'),JSON[_0x57f8('0x23')](_0x2ec779,null,0x2));logger['info'](util[_0x57f8('0xf')](_0x57f8('0x24'),_0x2ec779['arg_1'],_0x2ec779[_0x57f8('0x19')],_0x2ec779[_0x57f8('0x1a')],_0x2ec779['dnid'],_0x2ec779['uniqueid']));_0x2ec779['on']('error',errorHandler);_0x2ec779['on'](_0x57f8('0x25'),closeHandler);_0x2ec779['on'](_0x57f8('0x26'),timeoutHandler);_0x2ec779[_0x57f8('0x1c')]=![];_0x2ec779['on'](_0x57f8('0x27'),hangupHandler);var _0x539948=_[_0x57f8('0x28')](projects,[_0x57f8('0x11'),_0x2ec779[_0x57f8('0x1b')]]);if(!_0x539948)return Project[_0x57f8('0x29')](_0x2ec779);if(!_0x539948[_0x57f8('0x2a')])return Project[_0x57f8('0x2b')](_0x2ec779);return Project[_0x57f8('0x2c')](_0x539948,_0x2ec779);}function main(){var _0x557cc7;return utilLicense[_0x57f8('0x2d')]()['then'](function(_0x128168){if(!_0x128168)return;if(_0x128168[_0x57f8('0x2e')]){if(_0x128168[_0x57f8('0x2f')]&&_0x128168['callysquare']>0x0){logger['info'](util[_0x57f8('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0x128168[_0x57f8('0x2f')]));_0x557cc7=_0x128168['callysquare'];}else{logger[_0x57f8('0x15')](_0x57f8('0x30'));}}else{logger[_0x57f8('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x557cc7=-0x1;}})[_0x57f8('0x31')](function(){return Project['getAll']();})['then'](function(_0x4c1626){projects=_0x4c1626;return;})[_0x57f8('0x1d')](function(_0x26e506){logger[_0x57f8('0xc')](_0x57f8('0x32'),_0x26e506['stack']);})[_0x57f8('0x33')](function(){var _0x1d5798=require('./server')(config[_0x57f8('0x5')]['port'],config[_0x57f8('0x5')]['ip'],_0x557cc7);_0x1d5798['on'](_0x57f8('0xc'),errorHandler);_0x1d5798['on'](_0x57f8('0x34'),listeningHandler);_0x1d5798['on']('connection',connectionHandler);_0x1d5798['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x45e2=['agi','../../config/license/util','./project','./events','defaults','127.0.0.1','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hasOwnProperty','indexOf','substring','debug','variables','close','timeout','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/logger'];(function(_0x606cdd,_0x2a4b20){var _0x3acd54=function(_0x75af7e){while(--_0x75af7e){_0x606cdd['push'](_0x606cdd['shift']());}};_0x3acd54(++_0x2a4b20);}(_0x45e2,0x18b));var _0x245e=function(_0x3b9f32,_0xedc868){_0x3b9f32=_0x3b9f32-0x0;var _0x4d8bd0=_0x45e2[_0x3b9f32];return _0x4d8bd0;};'use strict';var _=require(_0x245e('0x0'));var syncho=require(_0x245e('0x1'));var util=require(_0x245e('0x2'));var config=require('../../config/environment');var logger=require(_0x245e('0x3'))(_0x245e('0x4'));var utilLicense=require(_0x245e('0x5'));var rpc=require('./rpc');var Project=require(_0x245e('0x6'));var AGIEmitter=require(_0x245e('0x7'))['EventEmitter'];var projects=[];config[_0x245e('0x4')]=_[_0x245e('0x8')](config['agi'],{'ip':_0x245e('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x2c060f){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2c060f);agiHandler(_0x2c060f);}catch(_0x5d2ab3){logger[_0x245e('0xa')](_0x5d2ab3[_0x245e('0xb')]);}});});}function projectUpdateHandler(_0xaf4cc6){try{var _0x7af81e=_[_0x245e('0xc')](projects,['id',_0xaf4cc6['id']]);if(_0x7af81e>-0x1){if(_0xaf4cc6[_0x245e('0xd')]===!![]){projects[_0x245e('0xe')](_0x7af81e,0x1);}else{projects[_0x7af81e]=_0xaf4cc6;}}else{projects[_0x245e('0xf')](_0xaf4cc6);}}catch(_0x5a1163){logger[_0x245e('0xa')](_0x5a1163[_0x245e('0xb')]);}}function listeningHandler(){console[_0x245e('0x10')](_0x245e('0x11'),config[_0x245e('0x4')][_0x245e('0x12')]);logger[_0x245e('0x13')](util[_0x245e('0x14')](_0x245e('0x15'),config[_0x245e('0x4')]['ip'],config['agi']['port']));}function errorHandler(_0x37749a){if(_0x37749a&&_0x37749a[_0x245e('0x16')]&&_0x37749a[_0x245e('0x17')]){logger[_0x245e('0xa')](util['format'](_0x245e('0x18'),_0x37749a[_0x245e('0x16')],_0x37749a[_0x245e('0x17')]));}else{logger['error'](util['format'](_0x245e('0x19'),_0x37749a[_0x245e('0xb')]));}}function closeHandler(){logger['info'](util[_0x245e('0x14')](_0x245e('0x1a'),this[_0x245e('0x1b')],this[_0x245e('0x1c')],this[_0x245e('0x1d')],this[_0x245e('0x1e')],this[_0x245e('0x1f')]));try{createSquareReport(this);}catch(_0x2763b1){logger[_0x245e('0xa')](_0x2763b1[_0x245e('0xb')]);}}function timeoutHandler(){logger[_0x245e('0x13')](util[_0x245e('0x14')](_0x245e('0x20'),this[_0x245e('0x1b')],this[_0x245e('0x1c')],this[_0x245e('0x1d')],this[_0x245e('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0x245e('0x13')](util['format'](_0x245e('0x21'),this[_0x245e('0x1b')],this[_0x245e('0x1c')],this[_0x245e('0x1d')],this['dnid'],this[_0x245e('0x1f')]));this[_0x245e('0x22')]=!![];}function createSquareReport(_0x228b8b,_0x44ab15){rpc['createSquareReport'](_0x228b8b)['then'](function(_0x4bb2dc){if(_0x44ab15){_0x44ab15(null,_0x4bb2dc);}})['catch'](function(_0x3e18b4){if(_0x44ab15){_0x44ab15(null,_0x3e18b4);}});}function setChannelVariables(_0x2aa043){for(var _0x1b3a73 in _0x2aa043){if(_0x2aa043[_0x245e('0x23')](_0x1b3a73)){if(_0x1b3a73[_0x245e('0x24')]('agi_')===0x0){_0x2aa043[_0x1b3a73[_0x245e('0x25')](0x4)]=_0x2aa043[_0x1b3a73];delete _0x2aa043[_0x1b3a73];}}}}function agiHandler(_0x36af95){logger[_0x245e('0x26')](_0x245e('0x27'),JSON['stringify'](_0x36af95,null,0x2));logger[_0x245e('0x13')](util[_0x245e('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36af95[_0x245e('0x1b')],_0x36af95[_0x245e('0x1c')],_0x36af95[_0x245e('0x1d')],_0x36af95['dnid'],_0x36af95[_0x245e('0x1f')]));_0x36af95['on'](_0x245e('0xa'),errorHandler);_0x36af95['on'](_0x245e('0x28'),closeHandler);_0x36af95['on'](_0x245e('0x29'),timeoutHandler);_0x36af95['evtHangup']=![];_0x36af95['on']('hangup',hangupHandler);var _0x8bcc36=_[_0x245e('0x2a')](projects,['name',_0x36af95['arg_1']]);if(!_0x8bcc36)return Project[_0x245e('0x2b')](_0x36af95);if(!_0x8bcc36[_0x245e('0x2c')])return Project['handleUnpublished'](_0x36af95);return Project[_0x245e('0x2d')](_0x8bcc36,_0x36af95);}function main(){var _0x6f73dd;return utilLicense[_0x245e('0x2e')]()['then'](function(_0x56203f){if(!_0x56203f)return;if(_0x56203f[_0x245e('0x2f')]){if(_0x56203f[_0x245e('0x30')]&&_0x56203f[_0x245e('0x30')]>0x0){logger[_0x245e('0x13')](util[_0x245e('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x56203f['callysquare']));_0x6f73dd=_0x56203f[_0x245e('0x30')];}else{logger[_0x245e('0x13')](_0x245e('0x31'));}}else{logger[_0x245e('0x13')](_0x245e('0x32'));_0x6f73dd=-0x1;}})[_0x245e('0x33')](function(){return Project[_0x245e('0x34')]();})['then'](function(_0x2c753b){projects=_0x2c753b;return;})['catch'](function(_0x24a17e){logger[_0x245e('0xa')](_0x245e('0x35'),_0x24a17e[_0x245e('0xb')]);})[_0x245e('0x36')](function(){var _0x24dd33=require(_0x245e('0x37'))(config[_0x245e('0x4')]['port'],config[_0x245e('0x4')]['ip'],_0x6f73dd);_0x24dd33['on'](_0x245e('0xa'),errorHandler);_0x24dd33['on']('listening',listeningHandler);_0x24dd33['on'](_0x245e('0x38'),connectionHandler);_0x24dd33['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 2f7b571..71b2319 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 _0x8d74=['SendMail','request','then','error','message','catch'];(function(_0x2ae78d,_0x4bdc21){var _0xb84c6a=function(_0x30c0c7){while(--_0x30c0c7){_0x2ae78d['push'](_0x2ae78d['shift']());}};_0xb84c6a(++_0x4bdc21);}(_0x8d74,0xb5));var _0x48d7=function(_0x568856,_0x2601dd){_0x568856=_0x568856-0x0;var _0x451979=_0x8d74[_0x568856];return _0x451979;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x89ee1a,_0x3d3e2d){return new BPromise(function(_0x262914,_0x14ffc6){return client[_0x48d7('0x0')](_0x89ee1a,_0x3d3e2d)[_0x48d7('0x1')](function(_0x4fec0a){if(_0x4fec0a[_0x48d7('0x2')]){return _0x14ffc6(_0x4fec0a[_0x48d7('0x2')][_0x48d7('0x3')]);}else{return _0x262914(_0x4fec0a['result']);}})[_0x48d7('0x4')](function(_0x4e7490){return _0x14ffc6(_0x4e7490);});});}exports['sendMailMessage']=function(_0x4f5718,_0x1e678e){return request(_0x48d7('0x5'),{'account':_0x4f5718,'message':_0x1e678e});}; \ No newline at end of file +var _0xbf3c=['then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x6bc04e,_0x51fd73){var _0x576dd3=function(_0x1ef000){while(--_0x1ef000){_0x6bc04e['push'](_0x6bc04e['shift']());}};_0x576dd3(++_0x51fd73);}(_0xbf3c,0xb6));var _0xcbf3=function(_0x1754d9,_0x537663){_0x1754d9=_0x1754d9-0x0;var _0x369f81=_0xbf3c[_0x1754d9];return _0x369f81;};'use strict';var BPromise=require(_0xcbf3('0x0'));var jayson=require(_0xcbf3('0x1'));var client=jayson[_0xcbf3('0x2')][_0xcbf3('0x3')]({'port':0x232b});function request(_0x50f809,_0x484565){return new BPromise(function(_0x3586c2,_0x2ec0cf){return client[_0xcbf3('0x4')](_0x50f809,_0x484565)[_0xcbf3('0x5')](function(_0x12676c){if(_0x12676c[_0xcbf3('0x6')]){return _0x2ec0cf(_0x12676c[_0xcbf3('0x6')]['message']);}else{return _0x3586c2(_0x12676c[_0xcbf3('0x7')]);}})[_0xcbf3('0x8')](function(_0x3bdff6){return _0x2ec0cf(_0x3bdff6);});});}exports[_0xcbf3('0x9')]=function(_0x3b34e8,_0x566402){return request(_0xcbf3('0xa'),{'account':_0x3b34e8,'message':_0x566402});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 9318309..bfa19c5 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7d6=['agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson','mxGraphModel','inspect','production','start','root','stringify','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xd7d6,0x75));var _0x6d7d=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xd7d6[_0x58db4e];return _0x40139a;};'use strict';var _=require(_0x6d7d('0x0'));var moment=require(_0x6d7d('0x1'));var parser=require(_0x6d7d('0x2'));var util=require(_0x6d7d('0x3'));var logger=require(_0x6d7d('0x4'))(_0x6d7d('0x5'));var rpc=require(_0x6d7d('0x6'));var mailRpc=require(_0x6d7d('0x7'));var Graph=require(_0x6d7d('0x8'));var Vertices=require(_0x6d7d('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6d7d('0xa')]()[_0x6d7d('0xb')](function(_0x46aade){logger[_0x6d7d('0xc')](_0x6d7d('0xd'),_0x46aade[_0x6d7d('0xe')]);return[];});}function addVertex(_0x5e342c,_0x274337,_0x4dd2b7){_0x274337[_0x6d7d('0xf')]=_0x4dd2b7;if(_0x274337[_0x6d7d('0x10')](_0x6d7d('0x11'))){_0x274337[_0x6d7d('0x12')]=parseInt(_0x274337['retry'],0xa);}_0x5e342c[_0x6d7d('0x13')](_[_0x6d7d('0x14')](_0x274337,_0x6d7d('0x15')));}function initGraph(_0x5dfe5d,_0x7d31bd){var _0x56e574=new Graph();for(var _0x413477 in _0x5dfe5d){if(_0x5dfe5d[_0x6d7d('0x10')](_0x413477)){if(_[_0x6d7d('0x16')](_0x5dfe5d[_0x413477])){for(var _0xee06bb=0x0;_0xee06bb<_0x5dfe5d[_0x413477]['length'];_0xee06bb+=0x1){addVertex(_0x56e574,_0x5dfe5d[_0x413477][_0xee06bb],_0x413477);}}else{addVertex(_0x56e574,_0x5dfe5d[_0x413477],_0x413477);}}}for(var _0x1a1575=0x0;_0x1a1575<_0x7d31bd[_0x6d7d('0x17')];_0x1a1575+=0x1){if(_0x7d31bd[_0x1a1575]['source']&&_0x7d31bd[_0x1a1575][_0x6d7d('0x18')]){_0x56e574[_0x6d7d('0x19')](_0x7d31bd[_0x1a1575][_0x6d7d('0x1a')],_0x7d31bd[_0x1a1575][_0x6d7d('0x18')],_0x7d31bd[_0x1a1575][_0x6d7d('0x1b')]);}}return _0x56e574;}function getRoot(_0x4e237d){return parser[_0x6d7d('0x1c')](_0x4e237d,{'object':!![]})[_0x6d7d('0x1d')]['root'];}function inspect(_0x19f637){return util[_0x6d7d('0x1e')](_0x19f637,{'showHidden':![],'depth':null});}function initialize(_0x4a3c12,_0x3d93f7){var _0x34a1dc=getRoot(_0x4a3c12[_0x6d7d('0x1f')]);if(!_0x34a1dc||!_0x34a1dc[_0x6d7d('0x20')])return;var _0x38095f,_0x22a0ab,_0x37862c;logger['debug'](_0x6d7d('0x21'),JSON[_0x6d7d('0x22')](_0x34a1dc,null,0x2));_0x3d93f7['joinAt']=moment()[_0x6d7d('0x23')]('YYYY-MM-DD\x20HH:mm:ss');_0x38095f=initGraph(_[_0x6d7d('0x14')](_0x34a1dc,_0x6d7d('0x15')),_0x34a1dc[_0x6d7d('0x15')]);_0x22a0ab=new Vertices(_0x3d93f7,rpc,mailRpc);logger[_0x6d7d('0x24')](util[_0x6d7d('0x23')](_0x6d7d('0x25'),_0x3d93f7[_0x6d7d('0x26')],_0x3d93f7[_0x6d7d('0x27')],_0x3d93f7[_0x6d7d('0x28')],_0x3d93f7[_0x6d7d('0x29')],_0x3d93f7['uniqueid']));_0x38095f['traverseBFS'](_0x34a1dc[_0x6d7d('0x20')]['id'],function(_0xa9d0fc){try{_0xa9d0fc=_0x22a0ab['clear'](_0xa9d0fc);logger[_0x6d7d('0x2a')](_0x6d7d('0x2b'),JSON[_0x6d7d('0x22')](_0xa9d0fc,null,0x2));if(_0xa9d0fc[_0x6d7d('0xf')]===_0x6d7d('0x2c')){logger[_0x6d7d('0x24')](_0x6d7d('0x2d'));_0x3d93f7['context']=_0xa9d0fc[_0x6d7d('0x2e')]||_0x3d93f7[_0x6d7d('0x2e')];_0x3d93f7['extension']=_0xa9d0fc[_0x6d7d('0x2f')];_0x3d93f7[_0x6d7d('0x30')]=_0xa9d0fc[_0x6d7d('0x30')]?_0xa9d0fc[_0x6d7d('0x30')]-0x1:0x1;return null;}else if(_0xa9d0fc&&_0x22a0ab[_0xa9d0fc['agicommand']]){_0x37862c=_0x22a0ab[_0xa9d0fc[_0x6d7d('0xf')]](_0xa9d0fc);logger[_0x6d7d('0x24')](_0x6d7d('0x31'),JSON[_0x6d7d('0x22')](_0x37862c,null,0x2));if(_0x37862c&&_0x37862c['code']===AGI_CODE_SUCCESS&&_0x37862c['result']!==AGI_RESULT_ERROR&&!_0x3d93f7[_0x6d7d('0x32')]){logger[_0x6d7d('0x2a')]('response',inspect(_0x37862c));return _['isUndefined'](_0x37862c[_0x6d7d('0x33')])?null:_0x37862c[_0x6d7d('0x33')][_0x6d7d('0x34')]();}else{logger[_0x6d7d('0xc')](_0x6d7d('0x31'),inspect(_0x37862c));return null;}}else{logger['error'](_0x6d7d('0x35'));return null;}}catch(_0x2d13e7){logger[_0x6d7d('0xc')](_0x2d13e7[_0x6d7d('0xe')]);return null;}});if(_0x34a1dc['finally']){logger['info'](util[_0x6d7d('0x23')](_0x6d7d('0x36'),_0x3d93f7[_0x6d7d('0x26')],_0x3d93f7[_0x6d7d('0x27')],_0x3d93f7['callerid'],_0x3d93f7[_0x6d7d('0x29')],_0x3d93f7['uniqueid']));_0x38095f[_0x6d7d('0x37')](_0x34a1dc[_0x6d7d('0x38')]['id'],function(_0x4ad906){try{_0x4ad906=_0x22a0ab[_0x6d7d('0x39')](_0x4ad906);logger[_0x6d7d('0x2a')](_0x6d7d('0x2b'),JSON[_0x6d7d('0x22')](_0x4ad906,null,0x2));if(_0x4ad906&&_0x22a0ab[_0x4ad906[_0x6d7d('0xf')]]){_0x37862c=_0x22a0ab[_0x4ad906[_0x6d7d('0xf')]](_0x4ad906);if(_0x37862c){logger[_0x6d7d('0x2a')](_0x6d7d('0x31'),inspect(_0x37862c));return _[_0x6d7d('0x3a')](_0x37862c[_0x6d7d('0x33')])?null:_0x37862c[_0x6d7d('0x33')][_0x6d7d('0x34')]();}else{logger[_0x6d7d('0xc')](_0x6d7d('0x31'),inspect(_0x37862c));return null;}}else{logger[_0x6d7d('0xc')](_0x6d7d('0x35'));return null;}}catch(_0x4f2134){logger[_0x6d7d('0xc')](_0x4f2134['stack']);return null;}});}logger[_0x6d7d('0x24')](util[_0x6d7d('0x23')](_0x6d7d('0x3b'),_0x3d93f7['arg_1'],_0x3d93f7[_0x6d7d('0x27')],_0x3d93f7[_0x6d7d('0x28')],_0x3d93f7['dnid'],_0x3d93f7[_0x6d7d('0x3c')]));logger[_0x6d7d('0x24')](util[_0x6d7d('0x23')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3d93f7['context'],_0x3d93f7[_0x6d7d('0x2f')],parseInt(_0x3d93f7['priority'],0xa)+0x1));_0x3d93f7[_0x6d7d('0x3d')](_0x3d93f7['context'],_0x3d93f7['extension'],parseInt(_0x3d93f7[_0x6d7d('0x30')],0xa)+0x1);_0x3d93f7['close']();}function handleNotFound(_0x3cd3d2){logger[_0x6d7d('0xc')](util[_0x6d7d('0x23')](_0x6d7d('0x3e'),_0x3cd3d2[_0x6d7d('0x26')]));_0x3cd3d2[_0x6d7d('0x3d')](_0x3cd3d2[_0x6d7d('0x2e')],_0x3cd3d2[_0x6d7d('0x2f')],parseInt(_0x3cd3d2['priority'],0xa)+0x1);_0x3cd3d2[_0x6d7d('0x3f')]();}function handleUnpublished(_0x31d8a3){logger['error'](util[_0x6d7d('0x23')](_0x6d7d('0x40'),_0x31d8a3[_0x6d7d('0x26')]));_0x31d8a3[_0x6d7d('0x3d')](_0x31d8a3[_0x6d7d('0x2e')],_0x31d8a3[_0x6d7d('0x2f')],parseInt(_0x31d8a3[_0x6d7d('0x30')],0xa)+0x1);_0x31d8a3[_0x6d7d('0x3f')]();}module[_0x6d7d('0x41')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xd9ed=['format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','clear','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','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','continueAt','close','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','info'];(function(_0x20620f,_0x37c815){var _0x593a2f=function(_0x25479a){while(--_0x25479a){_0x20620f['push'](_0x20620f['shift']());}};_0x593a2f(++_0x37c815);}(_0xd9ed,0x153));var _0xdd9e=function(_0x2534b3,_0x43d9f4){_0x2534b3=_0x2534b3-0x0;var _0x307115=_0xd9ed[_0x2534b3];return _0x307115;};'use strict';var _=require('lodash');var moment=require(_0xdd9e('0x0'));var parser=require(_0xdd9e('0x1'));var util=require(_0xdd9e('0x2'));var logger=require(_0xdd9e('0x3'))('agi');var rpc=require(_0xdd9e('0x4'));var mailRpc=require(_0xdd9e('0x5'));var Graph=require(_0xdd9e('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xdd9e('0x7')]()[_0xdd9e('0x8')](function(_0x273711){logger[_0xdd9e('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x273711[_0xdd9e('0xa')]);return[];});}function addVertex(_0x54bf23,_0x30e250,_0x37df77){_0x30e250[_0xdd9e('0xb')]=_0x37df77;if(_0x30e250[_0xdd9e('0xc')](_0xdd9e('0xd'))){_0x30e250['maxRetry']=parseInt(_0x30e250[_0xdd9e('0xd')],0xa);}_0x54bf23[_0xdd9e('0xe')](_[_0xdd9e('0xf')](_0x30e250,'mxCell'));}function initGraph(_0xa05320,_0xa36e1a){var _0xfe3e6f=new Graph();for(var _0x4e4cae in _0xa05320){if(_0xa05320[_0xdd9e('0xc')](_0x4e4cae)){if(_[_0xdd9e('0x10')](_0xa05320[_0x4e4cae])){for(var _0x1ff57d=0x0;_0x1ff57d<_0xa05320[_0x4e4cae]['length'];_0x1ff57d+=0x1){addVertex(_0xfe3e6f,_0xa05320[_0x4e4cae][_0x1ff57d],_0x4e4cae);}}else{addVertex(_0xfe3e6f,_0xa05320[_0x4e4cae],_0x4e4cae);}}}for(var _0x1798fb=0x0;_0x1798fb<_0xa36e1a[_0xdd9e('0x11')];_0x1798fb+=0x1){if(_0xa36e1a[_0x1798fb][_0xdd9e('0x12')]&&_0xa36e1a[_0x1798fb][_0xdd9e('0x13')]){_0xfe3e6f[_0xdd9e('0x14')](_0xa36e1a[_0x1798fb][_0xdd9e('0x12')],_0xa36e1a[_0x1798fb][_0xdd9e('0x13')],_0xa36e1a[_0x1798fb][_0xdd9e('0x15')]);}}return _0xfe3e6f;}function getRoot(_0x2714c3){return parser[_0xdd9e('0x16')](_0x2714c3,{'object':!![]})[_0xdd9e('0x17')][_0xdd9e('0x18')];}function inspect(_0x1a5b78){return util[_0xdd9e('0x19')](_0x1a5b78,{'showHidden':![],'depth':null});}function initialize(_0x242edf,_0x59b862){var _0x2774de=getRoot(_0x242edf[_0xdd9e('0x1a')]);if(!_0x2774de||!_0x2774de[_0xdd9e('0x1b')])return;var _0x32d41d,_0x59a891,_0x2b5806;logger[_0xdd9e('0x1c')](_0xdd9e('0x18'),JSON['stringify'](_0x2774de,null,0x2));_0x59b862[_0xdd9e('0x1d')]=moment()['format'](_0xdd9e('0x1e'));_0x32d41d=initGraph(_[_0xdd9e('0xf')](_0x2774de,_0xdd9e('0x1f')),_0x2774de['mxCell']);_0x59a891=new Vertices(_0x59b862,rpc,mailRpc);logger[_0xdd9e('0x20')](util[_0xdd9e('0x21')](_0xdd9e('0x22'),_0x59b862[_0xdd9e('0x23')],_0x59b862[_0xdd9e('0x24')],_0x59b862[_0xdd9e('0x25')],_0x59b862[_0xdd9e('0x26')],_0x59b862[_0xdd9e('0x27')]));_0x32d41d['traverseBFS'](_0x2774de[_0xdd9e('0x1b')]['id'],function(_0x14319d){try{_0x14319d=_0x59a891[_0xdd9e('0x28')](_0x14319d);logger[_0xdd9e('0x1c')]('vertex',JSON[_0xdd9e('0x29')](_0x14319d,null,0x2));if(_0x14319d[_0xdd9e('0xb')]==='gotoc'){logger[_0xdd9e('0x20')](_0xdd9e('0x2a'));_0x59b862[_0xdd9e('0x2b')]=_0x14319d[_0xdd9e('0x2b')]||_0x59b862[_0xdd9e('0x2b')];_0x59b862[_0xdd9e('0x2c')]=_0x14319d[_0xdd9e('0x2c')];_0x59b862['priority']=_0x14319d[_0xdd9e('0x2d')]?_0x14319d[_0xdd9e('0x2d')]-0x1:0x1;return null;}else if(_0x14319d&&_0x59a891[_0x14319d['agicommand']]){_0x2b5806=_0x59a891[_0x14319d[_0xdd9e('0xb')]](_0x14319d);logger[_0xdd9e('0x20')](_0xdd9e('0x2e'),JSON[_0xdd9e('0x29')](_0x2b5806,null,0x2));if(_0x2b5806&&_0x2b5806[_0xdd9e('0x2f')]===AGI_CODE_SUCCESS&&_0x2b5806[_0xdd9e('0x30')]!==AGI_RESULT_ERROR&&!_0x59b862[_0xdd9e('0x31')]){logger[_0xdd9e('0x1c')](_0xdd9e('0x2e'),inspect(_0x2b5806));return _['isUndefined'](_0x2b5806[_0xdd9e('0x30')])?null:_0x2b5806[_0xdd9e('0x30')]['toString']();}else{logger[_0xdd9e('0x9')]('response',inspect(_0x2b5806));return null;}}else{logger[_0xdd9e('0x9')](_0xdd9e('0x32'));return null;}}catch(_0x3ea0ae){logger['error'](_0x3ea0ae[_0xdd9e('0xa')]);return null;}});if(_0x2774de[_0xdd9e('0x33')]){logger[_0xdd9e('0x20')](util['format'](_0xdd9e('0x34'),_0x59b862[_0xdd9e('0x23')],_0x59b862[_0xdd9e('0x24')],_0x59b862[_0xdd9e('0x25')],_0x59b862[_0xdd9e('0x26')],_0x59b862[_0xdd9e('0x27')]));_0x32d41d[_0xdd9e('0x35')](_0x2774de[_0xdd9e('0x33')]['id'],function(_0x5e85ba){try{_0x5e85ba=_0x59a891[_0xdd9e('0x28')](_0x5e85ba);logger[_0xdd9e('0x1c')](_0xdd9e('0x36'),JSON['stringify'](_0x5e85ba,null,0x2));if(_0x5e85ba&&_0x59a891[_0x5e85ba[_0xdd9e('0xb')]]){_0x2b5806=_0x59a891[_0x5e85ba[_0xdd9e('0xb')]](_0x5e85ba);if(_0x2b5806){logger[_0xdd9e('0x1c')](_0xdd9e('0x2e'),inspect(_0x2b5806));return _['isUndefined'](_0x2b5806[_0xdd9e('0x30')])?null:_0x2b5806[_0xdd9e('0x30')][_0xdd9e('0x37')]();}else{logger[_0xdd9e('0x9')](_0xdd9e('0x2e'),inspect(_0x2b5806));return null;}}else{logger[_0xdd9e('0x9')](_0xdd9e('0x32'));return null;}}catch(_0x4abd97){logger[_0xdd9e('0x9')](_0x4abd97[_0xdd9e('0xa')]);return null;}});}logger[_0xdd9e('0x20')](util[_0xdd9e('0x21')](_0xdd9e('0x38'),_0x59b862[_0xdd9e('0x23')],_0x59b862['calleridname'],_0x59b862[_0xdd9e('0x25')],_0x59b862[_0xdd9e('0x26')],_0x59b862[_0xdd9e('0x27')]));logger['info'](util['format'](_0xdd9e('0x39'),_0x59b862[_0xdd9e('0x2b')],_0x59b862[_0xdd9e('0x2c')],parseInt(_0x59b862[_0xdd9e('0x2d')],0xa)+0x1));_0x59b862[_0xdd9e('0x3a')](_0x59b862[_0xdd9e('0x2b')],_0x59b862[_0xdd9e('0x2c')],parseInt(_0x59b862[_0xdd9e('0x2d')],0xa)+0x1);_0x59b862['close']();}function handleNotFound(_0x4d60e2){logger[_0xdd9e('0x9')](util[_0xdd9e('0x21')]('Project\x20%s\x20not\x20found',_0x4d60e2['arg_1']));_0x4d60e2['continueAt'](_0x4d60e2[_0xdd9e('0x2b')],_0x4d60e2[_0xdd9e('0x2c')],parseInt(_0x4d60e2[_0xdd9e('0x2d')],0xa)+0x1);_0x4d60e2[_0xdd9e('0x3b')]();}function handleUnpublished(_0xba86e5){logger[_0xdd9e('0x9')](util[_0xdd9e('0x21')](_0xdd9e('0x3c'),_0xba86e5['arg_1']));_0xba86e5['continueAt'](_0xba86e5[_0xdd9e('0x2b')],_0xba86e5[_0xdd9e('0x2c')],parseInt(_0xba86e5[_0xdd9e('0x2d')],0xa)+0x1);_0xba86e5[_0xdd9e('0x3b')]();}module[_0xdd9e('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 643d6df..ffe6212 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 _0xf91d=['stream','Transform','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf','substring','length','split','slice','trim','headers','line','exports','util'];(function(_0xaffff3,_0x363f42){var _0x18cc86=function(_0x38968b){while(--_0x38968b){_0xaffff3['push'](_0xaffff3['shift']());}};_0x18cc86(++_0x363f42);}(_0xf91d,0x155));var _0xdf91=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf91d[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0xdf91('0x0'));var Transform=require(_0xdf91('0x1'))[_0xdf91('0x2')];function AGIReply(_0x95d77d){Transform[_0xdf91('0x3')](this,_0x95d77d);this[_0xdf91('0x4')]='';this[_0xdf91('0x5')]=![];}util[_0xdf91('0x6')](AGIReply,Transform);AGIReply[_0xdf91('0x7')]['_transform']=function(_0x9e88e5,_0x293539,_0x224ff8){var _0x487cb8='\x0a',_0x71f381=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5cc25a=-0x1,_0x482672=-0x1,_0x460774='',_0x40d9eb=0x0,_0x5d710a='',_0x32f329='';this[_0xdf91('0x4')]+=_0x9e88e5[_0xdf91('0x8')]();_0x5d710a=this[_0xdf91('0x4')];if(!this['_inBody']){_0x40d9eb=0x0;while(_0x71f381[_0x40d9eb]){while((_0x482672=_0x5d710a[_0xdf91('0x9')](_0x71f381[_0x40d9eb]))!=-0x1){_0x460774=_0x71f381[_0x40d9eb];_0x32f329=_0x5d710a[_0xdf91('0xa')](0x0,_0x482672);_0x5d710a=_0x5d710a[_0xdf91('0xa')](_0x482672+_0x460774[_0xdf91('0xb')]);var _0x59868e=_0x32f329[_0xdf91('0xc')](_0x487cb8),_0x52646d=0x0,_0x5b7a10={},_0x469cc3='',_0x4bad36='',_0x39a056=-0x1;while(_0x59868e[_0x52646d]){_0x39a056=_0x59868e[_0x52646d][_0xdf91('0x9')](':');if(_0x39a056!=-0x1){_0x469cc3=_0x59868e[_0x52646d][_0xdf91('0xd')](0x0,_0x39a056)[_0xdf91('0xe')]();_0x4bad36=_0x59868e[_0x52646d][_0xdf91('0xd')](_0x39a056+0x1)['trim']();if(_0x469cc3[_0xdf91('0xb')]>0x0){_0x5b7a10[_0x469cc3]=_0x4bad36;}}else{}_0x52646d++;}this['emit'](_0xdf91('0xf'),_0x5b7a10);this['_inBody']=!![];}_0x40d9eb++;}this['_localBuffer']=_0x5d710a;}else{while((_0x5cc25a=_0x5d710a[_0xdf91('0x9')](_0x487cb8))!=-0x1){_0x32f329=_0x5d710a[_0xdf91('0xa')](0x0,_0x5cc25a);this['emit'](_0xdf91('0x10'),_0x32f329);_0x5d710a=_0x5d710a[_0xdf91('0xa')](_0x5cc25a+_0x487cb8[_0xdf91('0xb')]);}this[_0xdf91('0x4')]=_0x5d710a;}_0x224ff8();};module[_0xdf91('0x11')]=AGIReply; \ No newline at end of file +var _0x4ab7=['indexOf','substring','length','split','slice','trim','headers','line','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x4488f1,_0x1830c6){var _0x50ba40=function(_0x30b611){while(--_0x30b611){_0x4488f1['push'](_0x4488f1['shift']());}};_0x50ba40(++_0x1830c6);}(_0x4ab7,0x75));var _0x74ab=function(_0x51df4b,_0x4aa1e4){_0x51df4b=_0x51df4b-0x0;var _0x1e2f75=_0x4ab7[_0x51df4b];return _0x1e2f75;};'use strict';var util=require(_0x74ab('0x0'));var Transform=require('stream')[_0x74ab('0x1')];function AGIReply(_0x27a902){Transform[_0x74ab('0x2')](this,_0x27a902);this[_0x74ab('0x3')]='';this[_0x74ab('0x4')]=![];}util[_0x74ab('0x5')](AGIReply,Transform);AGIReply[_0x74ab('0x6')][_0x74ab('0x7')]=function(_0x237ce0,_0x15404a,_0x32321c){var _0x2acdfe='\x0a',_0x50b206=['\x0a\x0a',_0x74ab('0x8')],_0x1277f1=-0x1,_0x2871b6=-0x1,_0x517405='',_0x27e20b=0x0,_0x3dd194='',_0x429183='';this[_0x74ab('0x3')]+=_0x237ce0['toString']();_0x3dd194=this[_0x74ab('0x3')];if(!this[_0x74ab('0x4')]){_0x27e20b=0x0;while(_0x50b206[_0x27e20b]){while((_0x2871b6=_0x3dd194[_0x74ab('0x9')](_0x50b206[_0x27e20b]))!=-0x1){_0x517405=_0x50b206[_0x27e20b];_0x429183=_0x3dd194['substring'](0x0,_0x2871b6);_0x3dd194=_0x3dd194[_0x74ab('0xa')](_0x2871b6+_0x517405[_0x74ab('0xb')]);var _0x32cfa7=_0x429183[_0x74ab('0xc')](_0x2acdfe),_0x4a545d=0x0,_0x2a49bb={},_0x582829='',_0x28946e='',_0x289655=-0x1;while(_0x32cfa7[_0x4a545d]){_0x289655=_0x32cfa7[_0x4a545d][_0x74ab('0x9')](':');if(_0x289655!=-0x1){_0x582829=_0x32cfa7[_0x4a545d][_0x74ab('0xd')](0x0,_0x289655)[_0x74ab('0xe')]();_0x28946e=_0x32cfa7[_0x4a545d][_0x74ab('0xd')](_0x289655+0x1)[_0x74ab('0xe')]();if(_0x582829[_0x74ab('0xb')]>0x0){_0x2a49bb[_0x582829]=_0x28946e;}}else{}_0x4a545d++;}this['emit'](_0x74ab('0xf'),_0x2a49bb);this['_inBody']=!![];}_0x27e20b++;}this[_0x74ab('0x3')]=_0x3dd194;}else{while((_0x1277f1=_0x3dd194[_0x74ab('0x9')](_0x2acdfe))!=-0x1){_0x429183=_0x3dd194[_0x74ab('0xa')](0x0,_0x1277f1);this['emit'](_0x74ab('0x10'),_0x429183);_0x3dd194=_0x3dd194[_0x74ab('0xa')](_0x1277f1+_0x2acdfe[_0x74ab('0xb')]);}this['_localBuffer']=_0x3dd194;}_0x32321c();};module[_0x74ab('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 331bc71..4e41316 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 _0x1629=['catch','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','phone','ListId','then','CreateCmContact','agentLogin','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','error','message','result'];(function(_0xca6c14,_0xff6f6c){var _0x5d1096=function(_0x5276e6){while(--_0x5276e6){_0xca6c14['push'](_0xca6c14['shift']());}};_0x5d1096(++_0xff6f6c);}(_0x1629,0x1d8));var _0x9162=function(_0x21b798,_0x45a4bd){_0x21b798=_0x21b798-0x0;var _0xcdae9f=_0x1629[_0x21b798];return _0xcdae9f;};'use strict';var _=require(_0x9162('0x0'));var moment=require(_0x9162('0x1'));var jayson=require(_0x9162('0x2'));var client=jayson[_0x9162('0x3')]['http']({'port':0x2329});function request(_0x31e5fc,_0x567431){return new Promise(function(_0x5380c8,_0x16bc88){return client[_0x9162('0x4')](_0x31e5fc,_0x567431)['then'](function(_0x5c6863){if(_0x5c6863[_0x9162('0x5')]){return _0x16bc88(_0x5c6863[_0x9162('0x5')][_0x9162('0x6')]);}else{return _0x5380c8(_0x5c6863[_0x9162('0x7')]);}})[_0x9162('0x8')](function(_0x168267){return _0x16bc88(_0x168267);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x9162('0x9')]}});};exports[_0x9162('0xa')]=function(_0x5900c2){return request(_0x9162('0xb'),{'options':{'raw':![],'where':{'name':_0x5900c2},'attributes':['production']}});};exports[_0x9162('0xc')]=function(_0x35e7bd){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x35e7bd},'include':[{'model':_0x9162('0xd'),'as':_0x9162('0xe'),'include':[{'model':'CloudProvider','as':_0x9162('0xf')}]}],'attributes':['id',_0x9162('0x10'),_0x9162('0x11')],'smtp':!![]}});};exports[_0x9162('0x12')]=function(_0x1a1fcf){return request(_0x9162('0xb'),{'options':{'where':{'id':_0x1a1fcf},'attributes':[_0x9162('0x10')]}});};exports[_0x9162('0x13')]=function(_0x2c2fd1){return request(_0x9162('0x14'),{'options':{'where':{'id':_0x2c2fd1},'attributes':[_0x9162('0x10')]}});};exports['getVariableById']=function(_0x1bc9aa){return request(_0x9162('0x15'),{'options':{'where':{'id':_0x1bc9aa},'attributes':['name']}});};exports[_0x9162('0x16')]=function(_0x2585d0){return request(_0x9162('0x17'),{'options':{'where':{'id':_0x2585d0},'attributes':[_0x9162('0x18')]}});};exports[_0x9162('0x19')]=function(_0xa259c2){return request(_0x9162('0x1a'),{'options':{'where':{'id':_0xa259c2},'attributes':[_0x9162('0x10')]}});};exports[_0x9162('0x1b')]=function(_0x26afe3){return request('GetContactByPhone',{'options':{'where':{'phone':_0x26afe3['phone']},'attributes':['id']}});};exports[_0x9162('0x1c')]=function(_0x3c2cae){return request(_0x9162('0x1d'),{'options':{'where':{'id':_0x3c2cae},'attributes':['name']}});};exports[_0x9162('0x1e')]=function(_0x4fbd09){return request('ShowSound',{'options':{'where':{'id':_0x4fbd09},'attributes':[_0x9162('0x1f')]}});};exports[_0x9162('0x20')]=function(_0x403ee1){return request(_0x9162('0x21'),{'options':{'raw':![],'where':{'id':_0x403ee1},'include':[{'model':_0x9162('0x22'),'as':_0x9162('0x23')}]}});};exports[_0x9162('0x24')]=function(_0x2bfc85){return request(_0x9162('0x25'),{'options':{'where':{'id':_0x2bfc85},'attributes':['id',_0x9162('0x10')]}});};exports[_0x9162('0x26')]=function(_0xb8adf5){return request(_0x9162('0x27'),{'body':_0xb8adf5});};exports[_0x9162('0x28')]=function(_0x37973e){return request(_0x9162('0x29'),{'body':_0x37973e});};exports[_0x9162('0x2a')]=function(_0x19fd2b){return request(_0x9162('0x2b'),{'body':_[_0x9162('0x2c')](_0x19fd2b,{'project_name':_0x19fd2b[_0x9162('0x2d')],'prev_project_name':_0x19fd2b[_0x9162('0x2e')]||'','is_subproject':_0x19fd2b[_0x9162('0x2e')]?!![]:![],'leaveAt':moment()[_0x9162('0x2f')](_0x9162('0x30'))})});};exports['createSquareRecording']=function(_0x25599d){return request(_0x9162('0x31'),{'body':_0x25599d});};exports[_0x9162('0x32')]=function(_0x39d2af){return request('CreateSquareMessage',{'body':_0x39d2af});};exports['createCmContact']=function(_0x1511ff){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1511ff[_0x9162('0x33')],'ListId':_0x1511ff[_0x9162('0x34')]}}})[_0x9162('0x35')](function(_0x19bfa3){if(_0x19bfa3){return _0x19bfa3;}return request(_0x9162('0x36'),{'body':_0x1511ff});});};exports['getPauseById']=function(_0x208235){return request('ShowPause',{'options':{'where':{'id':_0x208235},'attributes':[_0x9162('0x10')]}});};exports[_0x9162('0x37')]=function(_0x1a2d17,_0x54abdc){return request('LoginUser',{'body':{'interface':_0x54abdc},'options':{'where':_0x1a2d17}});};exports['agentPause']=function(_0x192c3b,_0xfb9d60,_0xee7764){return request(_0x9162('0x38'),{'body':{'type':_0xfb9d60,'uniqueid':_0xee7764},'options':{'where':_0x192c3b}});};exports['agentUnpause']=function(_0x2faf71){return request(_0x9162('0x39'),{'body':{},'options':{'where':_0x2faf71}});};exports[_0x9162('0x3a')]=function(_0x2aafdb){return request(_0x9162('0x3b'),{'body':{},'options':{'where':_0x2aafdb}});}; \ No newline at end of file +var _0xde9d=['ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','result','catch','getSquareProjects','name','ShowSquareProject','production','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById'];(function(_0x2a707e,_0x510b87){var _0x2b3a97=function(_0x3e471b){while(--_0x3e471b){_0x2a707e['push'](_0x2a707e['shift']());}};_0x2b3a97(++_0x510b87);}(_0xde9d,0x156));var _0xdde9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde9d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdde9('0x0'));var moment=require(_0xdde9('0x1'));var jayson=require(_0xdde9('0x2'));var client=jayson[_0xdde9('0x3')][_0xdde9('0x4')]({'port':0x2329});function request(_0x49fbbe,_0x2a7fa7){return new Promise(function(_0x28cc44,_0x1aebe6){return client['request'](_0x49fbbe,_0x2a7fa7)[_0xdde9('0x5')](function(_0x2b705a){if(_0x2b705a[_0xdde9('0x6')]){return _0x1aebe6(_0x2b705a['error'][_0xdde9('0x7')]);}else{return _0x28cc44(_0x2b705a[_0xdde9('0x8')]);}})[_0xdde9('0x9')](function(_0x3be8c1){return _0x1aebe6(_0x3be8c1);});});}exports[_0xdde9('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xdde9('0xb'),'production']}});};exports['getSquareProject']=function(_0x259849){return request(_0xdde9('0xc'),{'options':{'raw':![],'where':{'name':_0x259849},'attributes':[_0xdde9('0xd')]}});};exports['getMailAccountById']=function(_0x15f74d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x15f74d},'include':[{'model':'MailServerOut','as':_0xdde9('0xe'),'include':[{'model':_0xdde9('0xf'),'as':_0xdde9('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0xdde9('0x10')]=function(_0x36c9a0){return request('ShowSquareProject',{'options':{'where':{'id':_0x36c9a0},'attributes':['name']}});};exports[_0xdde9('0x11')]=function(_0x1a1f1a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1a1f1a},'attributes':[_0xdde9('0xb')]}});};exports[_0xdde9('0x12')]=function(_0x456f27){return request('ShowVariable',{'options':{'where':{'id':_0x456f27},'attributes':[_0xdde9('0xb')]}});};exports['getSquareOdbcById']=function(_0x554246){return request(_0xdde9('0x13'),{'options':{'where':{'id':_0x554246},'attributes':['dsn']}});};exports['getUserById']=function(_0x4b690f){return request(_0xdde9('0x14'),{'options':{'where':{'id':_0x4b690f},'attributes':[_0xdde9('0xb')]}});};exports[_0xdde9('0x15')]=function(_0x2e4b89){return request(_0xdde9('0x16'),{'options':{'where':{'phone':_0x2e4b89[_0xdde9('0x17')]},'attributes':['id']}});};exports[_0xdde9('0x18')]=function(_0x145075){return request(_0xdde9('0x19'),{'options':{'where':{'id':_0x145075},'attributes':['name']}});};exports['getSoundById']=function(_0x71a5bf){return request(_0xdde9('0x1a'),{'options':{'where':{'id':_0x71a5bf},'attributes':[_0xdde9('0x1b')]}});};exports[_0xdde9('0x1c')]=function(_0x25f71e){return request(_0xdde9('0x1d'),{'options':{'raw':![],'where':{'id':_0x25f71e},'include':[{'model':_0xdde9('0x1e'),'as':'Intervals'}]}});};exports[_0xdde9('0x1f')]=function(_0xf48a7){return request(_0xdde9('0x20'),{'options':{'where':{'id':_0xf48a7},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x1ac564){return request(_0xdde9('0x21'),{'body':_0x1ac564});};exports[_0xdde9('0x22')]=function(_0x4df03a){return request(_0xdde9('0x23'),{'body':_0x4df03a});};exports[_0xdde9('0x24')]=function(_0x13ca89){return request(_0xdde9('0x25'),{'body':_['merge'](_0x13ca89,{'project_name':_0x13ca89['arg_1'],'prev_project_name':_0x13ca89['arg_2']||'','is_subproject':_0x13ca89[_0xdde9('0x26')]?!![]:![],'leaveAt':moment()['format'](_0xdde9('0x27'))})});};exports[_0xdde9('0x28')]=function(_0x4ea896){return request('CreateSquareRecording',{'body':_0x4ea896});};exports[_0xdde9('0x29')]=function(_0x29322c){return request(_0xdde9('0x2a'),{'body':_0x29322c});};exports['createCmContact']=function(_0x4461db){return request(_0xdde9('0x2b'),{'options':{'raw':![],'where':{'phone':_0x4461db[_0xdde9('0x17')],'ListId':_0x4461db[_0xdde9('0x2c')]}}})[_0xdde9('0x5')](function(_0x2e2fb4){if(_0x2e2fb4){return _0x2e2fb4;}return request(_0xdde9('0x2d'),{'body':_0x4461db});});};exports[_0xdde9('0x2e')]=function(_0x4338a9){return request('ShowPause',{'options':{'where':{'id':_0x4338a9},'attributes':[_0xdde9('0xb')]}});};exports['agentLogin']=function(_0x28723f,_0x251eba){return request(_0xdde9('0x2f'),{'body':{'interface':_0x251eba},'options':{'where':_0x28723f}});};exports['agentPause']=function(_0x47f07a,_0x58bed6,_0xbe4b9c){return request(_0xdde9('0x30'),{'body':{'type':_0x58bed6,'uniqueid':_0xbe4b9c},'options':{'where':_0x47f07a}});};exports[_0xdde9('0x31')]=function(_0x1b252e){return request(_0xdde9('0x32'),{'body':{},'options':{'where':_0x1b252e}});};exports[_0xdde9('0x33')]=function(_0x3e9ae6){return request(_0xdde9('0x34'),{'body':{},'options':{'where':_0x3e9ae6}});}; \ 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 ade6d7f..7a0f981 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 _0xa498=['./lex','exports','./polly'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xa498,0x179));var _0x8a49=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xa498[_0x54d4a8];return _0x3b321b;};var polly=require(_0x8a49('0x0'));var lex=require(_0x8a49('0x1'));module[_0x8a49('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xad5f=['exports','./polly','./lex'];(function(_0xeb901,_0x3e292e){var _0x645bad=function(_0x46961b){while(--_0x46961b){_0xeb901['push'](_0xeb901['shift']());}};_0x645bad(++_0x3e292e);}(_0xad5f,0x1a8));var _0xfad5=function(_0x2851f2,_0x3d6113){_0x2851f2=_0x2851f2-0x0;var _0x4984db=_0xad5f[_0x2851f2];return _0x4984db;};var polly=require(_0xfad5('0x0'));var lex=require(_0xfad5('0x1'));module[_0xfad5('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index b77bc51..4cedfa7 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 _0xbdb7=['./lib/api','exports'];(function(_0x37ae49,_0x4baae9){var _0x1e51b8=function(_0x113d28){while(--_0x113d28){_0x37ae49['push'](_0x37ae49['shift']());}};_0x1e51b8(++_0x4baae9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3f4027,_0x221cbb){_0x3f4027=_0x3f4027-0x0;var _0x4aea2e=_0xbdb7[_0x3f4027];return _0x4aea2e;};'use strict';var lex=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]=function(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07){return lex(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07);}; \ No newline at end of file +var _0x6f0d=['exports'];(function(_0xeceecb,_0x1e6af5){var _0x1a3756=function(_0x11150f){while(--_0x11150f){_0xeceecb['push'](_0xeceecb['shift']());}};_0x1a3756(++_0x1e6af5);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x13ae45,_0xf1e998){_0x13ae45=_0x13ae45-0x0;var _0xc2b7d4=_0x6f0d[_0x13ae45];return _0xc2b7d4;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ 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 c586fc5..9b4af97 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(_0x1d13bd,_0x5e2d05){var _0x426b13=function(_0x53fec8){while(--_0x53fec8){_0x1d13bd['push'](_0x1d13bd['shift']());}};_0x426b13(++_0x5e2d05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x21128a,_0x1a10c7){var _0x829031=function(_0x17f3c9){while(--_0x17f3c9){_0x21128a['push'](_0x21128a['shift']());}};_0x829031(++_0x1a10c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 a62dae1..57365ab 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x327f=['exports','./lib/api'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x327f,0x161));var _0xf327=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x327f[_0x19950b];return _0x3c6b41;};'use strict';var polly=require(_0xf327('0x0'));module[_0xf327('0x1')]=function(_0x31eed8,_0x25206f,_0x4f0174,_0x86f3a,_0x4fcc12,_0xb5604,_0x32230c){return polly(_0x31eed8,_0x25206f,_0x4f0174,_0x86f3a,_0x4fcc12,_0xb5604,_0x32230c);}; \ No newline at end of file +var _0x5f43=['./lib/api','exports'];(function(_0x1b5bff,_0x54f978){var _0x48165a=function(_0x1fac98){while(--_0x1fac98){_0x1b5bff['push'](_0x1b5bff['shift']());}};_0x48165a(++_0x54f978);}(_0x5f43,0x116));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0x35f4('0x0'));module[_0x35f4('0x1')]=function(_0x43abb7,_0x2438bc,_0x410c66,_0x42d9a1,_0x465735,_0x275574,_0x90dcf9){return polly(_0x43abb7,_0x2438bc,_0x410c66,_0x42d9a1,_0x465735,_0x275574,_0x90dcf9);}; \ 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 d55eb8a..48820b0 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 _0xfc45=['exports','Polly','text','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1e99bc,_0x3a0006){var _0x281232=function(_0x11c8cb){while(--_0x11c8cb){_0x1e99bc['push'](_0x1e99bc['shift']());}};_0x281232(++_0x3a0006);}(_0xfc45,0x19d));var _0x5fc4=function(_0x158391,_0x4adafa){_0x158391=_0x158391-0x0;var _0x53c7f2=_0xfc45[_0x158391];return _0x53c7f2;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5fc4('0x0'));var rs=require(_0x5fc4('0x1'));var AWS=require(_0x5fc4('0x2'));function pollyResult(_0x325a4a,_0x102c96,_0xc8ca0f){return new BPromise(function(_0x8935b1,_0x1243c9){_0x325a4a['synthesizeSpeech'](_0x102c96,function(_0x49b38f,_0x1bb5eb){if(_0x49b38f){_0x1243c9(_0x49b38f);}else if(_0x1bb5eb){if(_0x1bb5eb[_0x5fc4('0x3')]instanceof Buffer){fs[_0x5fc4('0x4')](_0xc8ca0f,_0x1bb5eb['AudioStream'],function(_0x422887){if(_0x422887){_0x1243c9(_0x422887);}else{_0x8935b1();}});}else{_0x1243c9(new Error(_0x5fc4('0x5')));}}else{_0x1243c9(new Error(_0x5fc4('0x6')));}});});}module[_0x5fc4('0x7')]=function(_0x24af3d,_0x1d4b01,_0x49a03b,_0x34ad5b,_0x46f768,_0xc9a167,_0x1e131e){var _0x5271cb=new AWS[(_0x5fc4('0x8'))]({'accessKeyId':_0x24af3d,'secretAccessKey':_0x1d4b01,'region':_0x49a03b});var _0x37ac9d={'Text':_0x46f768,'TextType':_0xc9a167||_0x5fc4('0x9'),'OutputFormat':'mp3','VoiceId':_0x34ad5b};return pollyResult(_0x5271cb,_0x37ac9d,_0x1e131e);}; \ No newline at end of file +var _0xcf77=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x17e4fb,_0xb18021){var _0x18c91f=function(_0x5dc4d0){while(--_0x5dc4d0){_0x17e4fb['push'](_0x17e4fb['shift']());}};_0x18c91f(++_0xb18021);}(_0xcf77,0x1d3));var _0x7cf7=function(_0x2cac79,_0x4933ed){_0x2cac79=_0x2cac79-0x0;var _0x353569=_0xcf77[_0x2cac79];return _0x353569;};'use strict';var fs=require('fs');var path=require(_0x7cf7('0x0'));var BPromise=require(_0x7cf7('0x1'));var rs=require(_0x7cf7('0x2'));var AWS=require(_0x7cf7('0x3'));function pollyResult(_0x376def,_0x4637e7,_0x3d3b3c){return new BPromise(function(_0x28313d,_0x23e156){_0x376def[_0x7cf7('0x4')](_0x4637e7,function(_0x50b123,_0x31071e){if(_0x50b123){_0x23e156(_0x50b123);}else if(_0x31071e){if(_0x31071e[_0x7cf7('0x5')]instanceof Buffer){fs['writeFile'](_0x3d3b3c,_0x31071e[_0x7cf7('0x5')],function(_0xf1fddb){if(_0xf1fddb){_0x23e156(_0xf1fddb);}else{_0x28313d();}});}else{_0x23e156(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x23e156(new Error(_0x7cf7('0x6')));}});});}module[_0x7cf7('0x7')]=function(_0x261476,_0x3faaf0,_0x59f8c9,_0x234e8b,_0x544c7c,_0x18c5f2,_0x159ba0){var _0x207a83=new AWS[(_0x7cf7('0x8'))]({'accessKeyId':_0x261476,'secretAccessKey':_0x3faaf0,'region':_0x59f8c9});var _0x27b3da={'Text':_0x544c7c,'TextType':_0x18c5f2||_0x7cf7('0x9'),'OutputFormat':_0x7cf7('0xa'),'VoiceId':_0x234e8b};return pollyResult(_0x207a83,_0x27b3da,_0x159ba0);}; \ 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 4d4e7d8..7b01041 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 _0x38bb=['./lib/api'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x38bb,0x1df));var _0xb38b=function(_0x1c4424,_0x53bca6){_0x1c4424=_0x1c4424-0x0;var _0x3ce1c5=_0x38bb[_0x1c4424];return _0x3ce1c5;};'use strict';var asr=require(_0xb38b('0x0'));module['exports']=function(_0x339ae6,_0x5a9090,_0x3c9d59,_0x287811){return asr(_0x339ae6,_0x5a9090,_0x3c9d59);}; \ No newline at end of file +var _0x1ebe=['exports','./lib/api'];(function(_0x68359d,_0x51477f){var _0x15d875=function(_0x5efef8){while(--_0x5efef8){_0x68359d['push'](_0x68359d['shift']());}};_0x15d875(++_0x51477f);}(_0x1ebe,0x171));var _0xe1eb=function(_0x334d05,_0x20b1ef){_0x334d05=_0x334d05-0x0;var _0x30440f=_0x1ebe[_0x334d05];return _0x30440f;};'use strict';var asr=require(_0xe1eb('0x0'));module[_0xe1eb('0x1')]=function(_0xab2cfd,_0x35f93c,_0x772f38,_0x194a3b){return asr(_0xab2cfd,_0x35f93c,_0x772f38);}; \ 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 db0475f..21690e7 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 _0x207d=['base64','POST','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0xbac3f,_0x5f1b57){var _0x485930=function(_0x4705a6){while(--_0x4705a6){_0xbac3f['push'](_0xbac3f['shift']());}};_0x485930(++_0x5f1b57);}(_0x207d,0x10d));var _0xd207=function(_0x3c4916,_0x3f59e4){_0x3c4916=_0x3c4916-0x0;var _0x3deff3=_0x207d[_0x3c4916];return _0x3deff3;};'use strict';var url=require(_0xd207('0x0'));var BPromise=require(_0xd207('0x1'));var fs=require('fs');var host=_0xd207('0x2');module[_0xd207('0x3')]=function(_0x562f74,_0xbc74a3,_0x5f1be4){return new BPromise(function(_0x4505f2,_0x422501){var _0x5351ed;if(typeof _0x562f74!==_0xd207('0x4')||_0x562f74[_0xd207('0x5')]===0x0){return _0x422501(_0xd207('0x6'));}if(typeof _0xbc74a3!==_0xd207('0x4')||_0xbc74a3[_0xd207('0x5')]===0x0){return _0x422501(_0xd207('0x7'));}if(typeof _0x5f1be4!==_0xd207('0x8')&&(typeof _0x5f1be4!==_0xd207('0x4')||_0x5f1be4[_0xd207('0x5')]===0x0)){return _0x422501(_0xd207('0x9'));}try{_0x5351ed=fs[_0xd207('0xa')](_0x562f74)['toString'](_0xd207('0xb'));}catch(_0x22c934){return _0x422501(_0x22c934);}return _0x4505f2({'method':_0xd207('0xc'),'uri':host+'/v1/speech:recognize?key='+_0xbc74a3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xd207('0xd'),'languageCode':_0x5f1be4},'audio':{'content':_0x5351ed}},'json':!![]});});}; \ No newline at end of file +var _0x55ea=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','key\x20should\x20be\x20a\x20string','undefined','length'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0x55ea,0xc9));var _0xa55e=function(_0x508028,_0x3a4b4a){_0x508028=_0x508028-0x0;var _0x50a1df=_0x55ea[_0x508028];return _0x50a1df;};'use strict';var url=require(_0xa55e('0x0'));var BPromise=require(_0xa55e('0x1'));var fs=require('fs');var host=_0xa55e('0x2');module['exports']=function(_0x2b5bc7,_0x26b2ef,_0x17dd4d){return new BPromise(function(_0x1325cc,_0x95af3d){var _0x54f178;if(typeof _0x2b5bc7!==_0xa55e('0x3')||_0x2b5bc7['length']===0x0){return _0x95af3d('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x26b2ef!=='string'||_0x26b2ef['length']===0x0){return _0x95af3d(_0xa55e('0x4'));}if(typeof _0x17dd4d!==_0xa55e('0x5')&&(typeof _0x17dd4d!==_0xa55e('0x3')||_0x17dd4d[_0xa55e('0x6')]===0x0)){return _0x95af3d(_0xa55e('0x7'));}try{_0x54f178=fs[_0xa55e('0x8')](_0x2b5bc7)[_0xa55e('0x9')](_0xa55e('0xa'));}catch(_0xe58ede){return _0x95af3d(_0xe58ede);}return _0x1325cc({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x26b2ef,'body':{'config':{'encoding':_0xa55e('0xb'),'sampleRateHertz':_0xa55e('0xc'),'languageCode':_0x17dd4d},'audio':{'content':_0x54f178}},'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 5042e26..5e32062 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 _0xc66f=['./asr'];(function(_0xa8829d,_0x41e7a1){var _0x3c726d=function(_0x16aee2){while(--_0x16aee2){_0xa8829d['push'](_0xa8829d['shift']());}};_0x3c726d(++_0x41e7a1);}(_0xc66f,0x1ee));var _0xfc66=function(_0x3eca62,_0x35e7a3){_0x3eca62=_0x3eca62-0x0;var _0x2686c4=_0xc66f[_0x3eca62];return _0x2686c4;};var asr=require(_0xfc66('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4ca6=['./asr','exports'];(function(_0x3f8eda,_0x20fa7d){var _0x37d14f=function(_0x31ab3c){while(--_0x31ab3c){_0x3f8eda['push'](_0x3f8eda['shift']());}};_0x37d14f(++_0x20fa7d);}(_0x4ca6,0x6a));var _0x64ca=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x4ca6[_0x1b6c6d];return _0x290d9d;};var asr=require(_0x64ca('0x0'));module[_0x64ca('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 649c20a..99df44e 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 _0xc53f=['end','WHAT_EVER','error\x20convert','resolve','generate','.wav','base64','then','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','tmp','.mp3','audioContent','writeFile','chmodSync','unlink','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','results','map','transcript','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','speech','score','status','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','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','nda','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','bluebird','http','https','md5','querystring','request-promise','sox','url','parse','util','./aws','./google','./tilde','agi','protocol','https:','host','path','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close'];(function(_0x2cbd6d,_0x165f45){var _0x51956e=function(_0x1ee182){while(--_0x1ee182){_0x2cbd6d['push'](_0x2cbd6d['shift']());}};_0x51956e(++_0x165f45);}(_0xc53f,0x64));var _0xfc53=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc53f[_0x5b561d];return _0x431060;};'use strict';var apiai=require(_0xfc53('0x0'));var BPromise=require(_0xfc53('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xfc53('0x2'));var https=require(_0xfc53('0x3'));var md5=require(_0xfc53('0x4'));var path=require('path');var querystring=require(_0xfc53('0x5'));var rp=require(_0xfc53('0x6'));var rs=require('randomstring');var sox=require(_0xfc53('0x7'));var tts=require('google-tts-api');var urlParse=require(_0xfc53('0x8'))[_0xfc53('0x9')];var util=require(_0xfc53('0xa'));var aws=require(_0xfc53('0xb'));var google=require(_0xfc53('0xc'));var sestek=require('./sestek');var tilde=require(_0xfc53('0xd'));var logger=require('../../../config/logger')(_0xfc53('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x542777,_0x4b89b9){return new BPromise(function(_0x2c5051,_0x440097){var _0x32ce3e=urlParse(_0x542777);var _0x3eb1be=_0x32ce3e[_0xfc53('0xf')]===_0xfc53('0x10')?https:http;var _0x50cf69={'host':_0x32ce3e[_0xfc53('0x11')],'path':_0x32ce3e[_0xfc53('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x3eb1be['get'](_0x50cf69,function(_0x46512e){if(_0x46512e[_0xfc53('0x13')]!==0xc8){logger[_0xfc53('0x14')](_0xfc53('0x15')+_0x542777+_0xfc53('0x16')+_0x46512e[_0xfc53('0x13')]+'\x20('+_0x46512e[_0xfc53('0x17')]+')');_0x440097(new Error(_0xfc53('0x15')+_0x542777+_0xfc53('0x16')+_0x46512e[_0xfc53('0x13')]+'\x20('+_0x46512e[_0xfc53('0x17')]+')'));return;}var _0xef3e8e=fs[_0xfc53('0x18')](_0x4b89b9);_0xef3e8e['on'](_0xfc53('0x19'),function(){logger[_0xfc53('0x1a')](_0xfc53('0x1b'));_0xef3e8e[_0xfc53('0x1c')](_0x2c5051);});_0xef3e8e['on']('error',function(_0x45b1dd){fs['unlink'](_0x4b89b9);logger[_0xfc53('0x14')]('download\x20error',_0x45b1dd);_0x440097(_0x45b1dd);});_0x46512e['pipe'](_0xef3e8e);})['on'](_0xfc53('0x14'),function(_0x47281e){logger[_0xfc53('0x14')](_0x47281e);_0x440097(_0x47281e);})[_0xfc53('0x1d')]();});}function uploadFile(_0x95f667){return new BPromise(function(_0x4506b9,_0x2a2683){var _0x5213e9=urlParse(_0x95f667);var _0x559de3=_0x5213e9[_0xfc53('0xf')]===_0xfc53('0x10')?https:http;var _0xde28e2={'host':_0x5213e9['host'],'path':_0x5213e9['path'],'headers':{'user-agent':_0xfc53('0x1e')}};_0x559de3['get'](_0xde28e2,function(_0x16c6e5){if(_0x16c6e5[_0xfc53('0x13')]!==0xc8){_0x2a2683(new Error(_0xfc53('0x15')+_0x95f667+'\x20failed,\x20status\x20code\x20=\x20'+_0x16c6e5[_0xfc53('0x13')]+'\x20('+_0x16c6e5[_0xfc53('0x17')]+')'));return;}var _0x1cc30f='';_0x16c6e5['on']('data',function(_0x424622){_0x1cc30f+=_0x424622;});_0x16c6e5['on']('end',function(){_0x4506b9(_0x1cc30f);});})['on'](_0xfc53('0x14'),function(_0x391b26){_0x2a2683(_0x391b26);})[_0xfc53('0x1d')]();});}function convertFile(_0xedce22,_0xb37e5){return new BPromise(function(_0x4bdf65,_0x52ca70){var _0x5d4060=sox['transcode'](_0xedce22,_0xb37e5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d4060['on'](_0xfc53('0x14'),function(_0x44fa36){logger[_0xfc53('0x14')](_0xfc53('0x1f'),_0x44fa36);_0x52ca70(_0x44fa36);});_0x5d4060['on'](_0xfc53('0x1d'),function(){logger[_0xfc53('0x1a')]('finish\x20to\x20convert');_0x4bdf65();});_0x5d4060['start']();});}function base64Decode(_0x504415,_0x392c5b){var _0x14bfe0=path[_0xfc53('0x20')](__dirname,'tmp',rs[_0xfc53('0x21')](0x4)+_0xfc53('0x22'));fs['writeFileSync'](_0x14bfe0,_0x504415,_0xfc53('0x23'));return convertFile(_0x14bfe0,_0x392c5b)[_0xfc53('0x24')](function(){try{fs['unlink'](_0x14bfe0);fs['chmodSync'](_0x392c5b,_0xfc53('0x25'));}catch(_0xf5c042){logger[_0xfc53('0x14')](_0xf5c042);}return _0x392c5b['split']('.')[0x0];});}function base64Encode(_0x132a86){var _0x5eaa01=fs[_0xfc53('0x26')](_0x132a86);return new Buffer(_0x5eaa01)[_0xfc53('0x27')]('base64');}exports[_0xfc53('0x28')]=function(_0x48917f,_0x1f0f37,_0x4aac82,_0x16bdca,_0x449116,_0xd0ef0){var _0xac06a3,_0x3da1eb;var _0x3b8b08=_0xfc53('0x29');var _0x469546=_0xfc53('0x2a')+_0x48917f;var _0x91945c={};if(_0x1f0f37==='ssml'){_0x91945c[_0xfc53('0x2b')]={'ssml':_0x4aac82};}else{_0x91945c[_0xfc53('0x2b')]={'text':_0x4aac82};};_0x91945c['voice']={'languageCode':_0x16bdca,'ssmlGender':_0x449116};_0x91945c[_0xfc53('0x2c')]={'audioEncoding':_0xfc53('0x2d'),'sampleRateHertz':0x1f40};var _0x286dcb={'url':_0x3b8b08+_0xfc53('0x2e')+_0x469546,'method':'POST','json':!![],'body':_0x91945c};return rp(_0x286dcb)[_0xfc53('0x24')](function(_0x3200f0){return new BPromise(function(_0x55a5fb,_0xb3cca2){_0xac06a3=path[_0xfc53('0x20')](__dirname,_0xfc53('0x2f'),rs[_0xfc53('0x21')](0x4)+_0xfc53('0x30'));var _0x910986=Buffer['from'](_0x3200f0[_0xfc53('0x31')],_0xfc53('0x23'));return fs[_0xfc53('0x32')](_0xac06a3,_0x910986,function(_0x52e386){_0xb3cca2(_0x52e386);},function(_0x2ff698){fs[_0xfc53('0x33')](_0xac06a3,_0xfc53('0x25'));_0x55a5fb(_0x2ff698);});});})['then'](function(_0xfd8a8d){_0x3da1eb=path[_0xfc53('0x20')](__dirname,'tmp',rs[_0xfc53('0x21')](0x4)+_0xfc53('0x22'));return convertFile(_0xac06a3,_0x3da1eb);})[_0xfc53('0x24')](function(){try{fs[_0xfc53('0x34')](_0xac06a3);fs[_0xfc53('0x33')](_0x3da1eb,_0xfc53('0x25'));}catch(_0x147a8b){logger[_0xfc53('0x14')](_0x147a8b);}logger[_0xfc53('0x1a')](_0xfc53('0x35'),_0x3da1eb[_0xfc53('0x36')]('.')[0x0]);return _0x3da1eb[_0xfc53('0x36')]('.')[0x0];});};exports[_0xfc53('0x37')]=function(_0x3051b0,_0xda1e26){var _0x4d6602=_0xfc53('0x38');var _0x1015be,_0x1e2d40;var _0x25389b;var _0x115d36={'encoding':'utf8','method':_0xfc53('0x39'),'timeout':0x2710,'url':_0x4d6602,'headers':{'Content-Type':_0xfc53('0x3a')},'body':_0xfc53('0x3b')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0xfc53('0x3c')]([_0x3051b0,_0xda1e26||'en',![],_0xfc53('0x3d')]),null,_0xfc53('0x3e')]]]))};return rp(_0x115d36)[_0xfc53('0x24')](function(_0x206095){try{_0x25389b=eval(_0x206095[_0xfc53('0x3f')](0x5))[0x0][0x2];}catch(_0x5a7f22){throw new Error(_0xfc53('0x40')+_0x206095[_0xfc53('0x41')]);}if(!_0x25389b){if(_0x3051b0[_0xfc53('0x42')]>0xc8){throw new Error(_0xfc53('0x43'));}else{throw new Error('lang\x20\x22'+_0xda1e26+_0xfc53('0x44'));}}try{_0x25389b=eval(_0x25389b)[0x0];}catch(_0x1f8efd){throw new Error(_0xfc53('0x40')+res[_0xfc53('0x41')]);}const _0x107f6a=_0x25389b;_0x1015be=path[_0xfc53('0x20')](__dirname,_0xfc53('0x2f'),rs[_0xfc53('0x21')](0x4)+_0xfc53('0x30'));fs[_0xfc53('0x45')](_0x1015be,_0x25389b,{'encoding':'base64'});_0x1e2d40=path['resolve'](__dirname,'tmp',rs[_0xfc53('0x21')](0x4)+_0xfc53('0x22'));return convertFile(_0x1015be,_0x1e2d40);})[_0xfc53('0x24')](function(){try{fs['unlink'](_0x1015be);fs[_0xfc53('0x33')](_0x1e2d40,_0xfc53('0x25'));}catch(_0xa434a8){logger[_0xfc53('0x14')](_0xa434a8);}logger[_0xfc53('0x1a')](_0xfc53('0x46'),_0x1e2d40['split']('.')[0x0]);return _0x1e2d40[_0xfc53('0x36')]('.')[0x0];});};exports['googleASR']=function(_0x32c260,_0x8e23d6,_0x142e2d){return google['asr'](_0x32c260,_0x8e23d6,_0x142e2d)[_0xfc53('0x24')](function(_0x4aec11){logger[_0xfc53('0x1a')](_0x4aec11['uri']);return rp(_0x4aec11);})[_0xfc53('0x24')](function(_0x5422b8){var _0x36bbd1='';var _0x1417a4=0x0;try{fs[_0xfc53('0x34')](_0x32c260);}catch(_0x3042c0){logger[_0xfc53('0x14')](_0x3042c0);}if(_0x5422b8&&_0x5422b8[_0xfc53('0x47')]){_0x36bbd1=_0x5422b8[_0xfc53('0x47')][_0xfc53('0x48')](function(_0x52f284){return _0x52f284&&_0x52f284['alternatives'][0x0]&&_0x52f284['alternatives'][0x0][_0xfc53('0x49')]?_0x52f284[_0xfc53('0x4a')][0x0][_0xfc53('0x49')]:'';})[_0xfc53('0x4b')]('\x0a');_0x1417a4=_0x5422b8['results'][_0xfc53('0x48')](function(_0x3ad4a2){return _0x3ad4a2&&_0x3ad4a2['alternatives'][0x0]&&_0x3ad4a2[_0xfc53('0x4a')][0x0]['confidence']?_0x3ad4a2['alternatives'][0x0][_0xfc53('0x4c')]:0x0;})[_0xfc53('0x4b')]('\x0a');}logger[_0xfc53('0x1a')](_0xfc53('0x4d'),_0x36bbd1);logger[_0xfc53('0x1a')](_0xfc53('0x4e'),_0x1417a4);return{'transcript':_0x36bbd1,'confidence':_0x1417a4};})[_0xfc53('0x4f')](function(_0x36ef6d){logger[_0xfc53('0x14')]('[%s]\x20%s:%s',_0x36ef6d[_0xfc53('0x13')],_0x36ef6d[_0xfc53('0x50')],_0x36ef6d[_0xfc53('0x51')]);});};exports[_0xfc53('0x52')]=function(_0x21905f,_0x2d52af,_0x4c245d,_0x97b76f){var _0x4ba7e2=apiai(_0x2d52af,{'language':_0x97b76f||'en'});return _0x4ba7e2[_0xfc53('0x53')](_0x4c245d,{'sessionId':md5(_0x21905f)})[_0xfc53('0x24')](function(_0x564367){logger['info'](JSON[_0xfc53('0x3c')](_0x564367));return{'source':_0x564367[_0xfc53('0x54')]['source'],'resolvedQuery':_0x564367['result']['resolvedQuery'],'action':_0x564367[_0xfc53('0x54')][_0xfc53('0x55')],'actionIncomplete':_0x564367['result'][_0xfc53('0x56')],'speech':_0x564367[_0xfc53('0x54')][_0xfc53('0x57')][_0xfc53('0x58')],'score':_0x564367['result'][_0xfc53('0x59')],'statusCode':_0x564367[_0xfc53('0x5a')]['code'],'endConversation':_0x564367[_0xfc53('0x54')][_0xfc53('0x5b')]['endConversation']||![],'isFallbackIntent':_0x564367['result']['metadata'][_0xfc53('0x5c')]};});};exports['googleDialogflowV2']=function(_0x615464,_0x4189a1,_0x309af2,_0x34cb8b,_0x568212,_0x91dc74){var _0x1be331=_0x34cb8b[_0xfc53('0x5d')](/\\n/g,'\x0a');var _0x15e930={'credentials':{'private_key':_0x1be331,'client_email':_0x309af2}};var _0x4cd3bd=new dialogflow[(_0xfc53('0x5e'))](_0x15e930);var _0x453b0c=_0x4cd3bd[_0xfc53('0x5f')](_0x4189a1,md5(_0x615464));var _0x31fcc7={'session':_0x453b0c,'queryInput':{'text':{'text':_0x568212,'languageCode':_0x91dc74}}};return _0x4cd3bd[_0xfc53('0x60')](_0x31fcc7)[_0xfc53('0x24')](function(_0x383fbf){if(_0x383fbf&&_0x383fbf[_0xfc53('0x42')]){logger['info'](_0xfc53('0x61'),JSON[_0xfc53('0x3c')](_0x383fbf));var _0x26c93e=_0x383fbf[0x0];if(_0x26c93e){var _0x2ef27b={'action':_0x26c93e[_0xfc53('0x62')]['action'],'allRequiredParamsPresent':_0x26c93e['queryResult'][_0xfc53('0x63')],'endConversation':_0x26c93e[_0xfc53('0x62')][_0xfc53('0x64')]&&_0x26c93e[_0xfc53('0x62')][_0xfc53('0x64')][_0xfc53('0x65')]?_0x26c93e[_0xfc53('0x62')]['diagnosticInfo'][_0xfc53('0x65')][_0xfc53('0x66')]['boolValue']:![],'fulfillmentText':_0x26c93e[_0xfc53('0x62')][_0xfc53('0x67')],'intentName':_0x26c93e[_0xfc53('0x62')][_0xfc53('0x68')]['name'],'intentDisplayName':_0x26c93e[_0xfc53('0x62')][_0xfc53('0x68')][_0xfc53('0x69')],'isFallbackIntent':_0x26c93e[_0xfc53('0x62')][_0xfc53('0x68')][_0xfc53('0x6a')],'languageCode':_0x26c93e[_0xfc53('0x62')]['languageCode'],'queryText':_0x26c93e['queryResult'][_0xfc53('0x6b')],'responseId':_0x26c93e['responseId'],'score':_0x26c93e['queryResult'][_0xfc53('0x6c')],'speech':_0x26c93e[_0xfc53('0x62')][_0xfc53('0x67')],'providerResponse':JSON[_0xfc53('0x3c')](_0x383fbf)};return _0x2ef27b;}}});};exports[_0xfc53('0x6d')]=function(_0x22f633,_0x43ad1d,_0x5e9b92,_0xd7a08e){return tilde['asr'](_0x22f633,_0x43ad1d,_0x5e9b92,_0xd7a08e)[_0xfc53('0x24')](function(_0x36f9fc){try{fs[_0xfc53('0x34')](_0x22f633);}catch(_0x5a6a1e){logger['error'](_0x5a6a1e);}logger[_0xfc53('0x1a')](_0xfc53('0x6e'),_0x36f9fc['transcript']);logger[_0xfc53('0x1a')](_0xfc53('0x6f'),_0x36f9fc[_0xfc53('0x4c')]);return _0x36f9fc;});};exports[_0xfc53('0x70')]=function(_0x2aa018,_0x51a37b,_0x2b703b,_0x124c76,_0x58d4ec,_0x41e635){var _0x52c1ab=path[_0xfc53('0x20')](__dirname,_0xfc53('0x2f'),rs['generate'](0x4)+_0xfc53('0x30'));var _0x4539a1;return aws[_0xfc53('0x71')](_0x2aa018,_0x51a37b,_0x2b703b,_0x124c76,_0x58d4ec,_0x41e635,_0x52c1ab)[_0xfc53('0x24')](function(){_0x4539a1=path['resolve'](__dirname,_0xfc53('0x2f'),rs[_0xfc53('0x21')](0x4)+_0xfc53('0x22'));return convertFile(_0x52c1ab,_0x4539a1);})[_0xfc53('0x24')](function(){try{fs[_0xfc53('0x34')](_0x52c1ab);fs[_0xfc53('0x33')](_0x4539a1,_0xfc53('0x25'));}catch(_0x325fb2){logger['error'](_0x325fb2);}return _0x4539a1['split']('.')[0x0];});};exports[_0xfc53('0x72')]=function(_0x3371fa,_0x8727d6,_0x33e754,_0x6b2562,_0x28a53b,_0x58c136){return aws[_0xfc53('0x73')](_0x3371fa,_0x8727d6,_0x33e754,_0x6b2562,_0x28a53b,_0x58c136)[_0xfc53('0x24')](function(_0x519c56){logger[_0xfc53('0x1a')](JSON[_0xfc53('0x3c')](_0x519c56));return _0x519c56;});};exports[_0xfc53('0x74')]=function(_0x4a65cd,_0x1d7d4e,_0x3a1a43,_0x57192c){var _0x5ee512=util['format'](_0xfc53('0x75'),ISPEECH_API,_0x4a65cd,encodeURIComponent(_0x1d7d4e),_0x3a1a43,_0x57192c);var _0xbe2396=path[_0xfc53('0x20')](__dirname,_0xfc53('0x2f'),rs['generate'](0x4)+_0xfc53('0x30'));var _0x48278c;return downloadFile(_0x5ee512,_0xbe2396)[_0xfc53('0x24')](function(){_0x48278c=path['resolve'](__dirname,_0xfc53('0x2f'),rs[_0xfc53('0x21')](0x4)+'.wav');return convertFile(_0xbe2396,_0x48278c);})[_0xfc53('0x24')](function(){try{fs[_0xfc53('0x34')](_0xbe2396);fs[_0xfc53('0x33')](_0x48278c,'777');}catch(_0x52171e){logger['error'](_0x52171e);}return _0x48278c[_0xfc53('0x36')]('.')[0x0];});};exports[_0xfc53('0x76')]=function(_0x3d9680,_0x29248c,_0xb34836,_0x47f184){var _0x13912d=util[_0xfc53('0x77')](_0xfc53('0x78'),ISPEECH_API,_0x29248c,_0xb34836,base64Encode(_0x3d9680),_0x47f184?util[_0xfc53('0x77')](_0xfc53('0x79'),encodeURIComponent(_0x47f184)):_0xfc53('0x7a'));return uploadFile(_0x13912d)['then'](function(_0x5bd042){return querystring[_0xfc53('0x9')](_0x5bd042);});};exports['sestekNDA']=function(_0x3776ad,_0x3b7a76){return sestek[_0xfc53('0x7b')](_0x3776ad,_0x3b7a76)[_0xfc53('0x24')](function(_0x3af688){logger[_0xfc53('0x1a')](JSON['stringify'](_0x3af688));var _0x5464b7={'speech':_0x3af688['text'],'action':_0x3af688[_0xfc53('0x7c')]?_0x3af688[_0xfc53('0x7c')][_0xfc53('0x7d')]:undefined,'actiondata':_0x3af688[_0xfc53('0x7c')]?_0x3af688[_0xfc53('0x7c')]['CustomActionData']:undefined};if(_0x3af688[_0xfc53('0x7c')]&&_0x3af688['channelData'][_0xfc53('0x7e')]){return base64Decode(_0x3af688['channelData'][_0xfc53('0x7e')][_0xfc53('0x7f')],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xfc53('0x22')))['then'](function(_0x2147b6){_0x5464b7['audiofile']=_0x2147b6;return _0x5464b7;});}return _0x5464b7;});};exports[_0xfc53('0x80')]=function(){return __dirname;}; \ No newline at end of file +var _0x1dd8=['textRequest','source','resolvedQuery','result','action','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','google-tts-api','parse','util','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','POST','tmp','.mp3','from','audioContent','writeFile','resolve','generate','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence'];(function(_0x2731c3,_0x398e1e){var _0x197199=function(_0x11af2e){while(--_0x11af2e){_0x2731c3['push'](_0x2731c3['shift']());}};_0x197199(++_0x398e1e);}(_0x1dd8,0xb8));var _0x81dd=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x1dd8[_0x36da00];return _0x4b72c5;};'use strict';var apiai=require(_0x81dd('0x0'));var BPromise=require(_0x81dd('0x1'));var dialogflow=require(_0x81dd('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x81dd('0x3'));var md5=require('md5');var path=require(_0x81dd('0x4'));var querystring=require(_0x81dd('0x5'));var rp=require(_0x81dd('0x6'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x81dd('0x7'));var urlParse=require('url')[_0x81dd('0x8')];var util=require(_0x81dd('0x9'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x81dd('0xa'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x81dd('0xb'));var ISPEECH_API=_0x81dd('0xc');function downloadFile(_0x3319a8,_0x139148){return new BPromise(function(_0x143608,_0x11b35a){var _0xcbb56c=urlParse(_0x3319a8);var _0x424bdd=_0xcbb56c[_0x81dd('0xd')]===_0x81dd('0xe')?https:http;var _0x5eaa68={'host':_0xcbb56c[_0x81dd('0xf')],'path':_0xcbb56c[_0x81dd('0x4')],'headers':{'user-agent':_0x81dd('0x10')}};_0x424bdd[_0x81dd('0x11')](_0x5eaa68,function(_0x201b86){if(_0x201b86[_0x81dd('0x12')]!==0xc8){logger[_0x81dd('0x13')](_0x81dd('0x14')+_0x3319a8+_0x81dd('0x15')+_0x201b86[_0x81dd('0x12')]+'\x20('+_0x201b86[_0x81dd('0x16')]+')');_0x11b35a(new Error(_0x81dd('0x14')+_0x3319a8+_0x81dd('0x15')+_0x201b86[_0x81dd('0x12')]+'\x20('+_0x201b86['statusMessage']+')'));return;}var _0x2e3bdc=fs[_0x81dd('0x17')](_0x139148);_0x2e3bdc['on'](_0x81dd('0x18'),function(){logger[_0x81dd('0x19')](_0x81dd('0x1a'));_0x2e3bdc[_0x81dd('0x1b')](_0x143608);});_0x2e3bdc['on']('error',function(_0x36335d){fs[_0x81dd('0x1c')](_0x139148);logger[_0x81dd('0x13')](_0x81dd('0x1d'),_0x36335d);_0x11b35a(_0x36335d);});_0x201b86[_0x81dd('0x1e')](_0x2e3bdc);})['on'](_0x81dd('0x13'),function(_0xbe2842){logger[_0x81dd('0x13')](_0xbe2842);_0x11b35a(_0xbe2842);})[_0x81dd('0x1f')]();});}function uploadFile(_0x164c2f){return new BPromise(function(_0x3f4431,_0x2d2d69){var _0x4daa72=urlParse(_0x164c2f);var _0x5308d2=_0x4daa72[_0x81dd('0xd')]==='https:'?https:http;var _0x785e71={'host':_0x4daa72[_0x81dd('0xf')],'path':_0x4daa72[_0x81dd('0x4')],'headers':{'user-agent':_0x81dd('0x10')}};_0x5308d2[_0x81dd('0x11')](_0x785e71,function(_0x9e108d){if(_0x9e108d[_0x81dd('0x12')]!==0xc8){_0x2d2d69(new Error('request\x20to\x20'+_0x164c2f+'\x20failed,\x20status\x20code\x20=\x20'+_0x9e108d[_0x81dd('0x12')]+'\x20('+_0x9e108d['statusMessage']+')'));return;}var _0x31c6bd='';_0x9e108d['on']('data',function(_0x9472cb){_0x31c6bd+=_0x9472cb;});_0x9e108d['on'](_0x81dd('0x1f'),function(){_0x3f4431(_0x31c6bd);});})['on'](_0x81dd('0x13'),function(_0x2f91ac){_0x2d2d69(_0x2f91ac);})[_0x81dd('0x1f')]();});}function convertFile(_0x12facf,_0x593f85){return new BPromise(function(_0x3cf3f9,_0x20c22d){var _0x167248=sox[_0x81dd('0x20')](_0x12facf,_0x593f85,{'sampleRate':0x1f40,'format':_0x81dd('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x167248['on'](_0x81dd('0x13'),function(_0x5564e3){logger[_0x81dd('0x13')](_0x81dd('0x22'),_0x5564e3);_0x20c22d(_0x5564e3);});_0x167248['on']('end',function(){logger[_0x81dd('0x19')](_0x81dd('0x23'));_0x3cf3f9();});_0x167248[_0x81dd('0x24')]();});}function base64Decode(_0x17c93a,_0xbd0c3b){var _0x471c2d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x81dd('0x25'));fs[_0x81dd('0x26')](_0x471c2d,_0x17c93a,_0x81dd('0x27'));return convertFile(_0x471c2d,_0xbd0c3b)[_0x81dd('0x28')](function(){try{fs[_0x81dd('0x1c')](_0x471c2d);fs[_0x81dd('0x29')](_0xbd0c3b,_0x81dd('0x2a'));}catch(_0x3915ea){logger['error'](_0x3915ea);}return _0xbd0c3b[_0x81dd('0x2b')]('.')[0x0];});}function base64Encode(_0x192284){var _0x266b16=fs[_0x81dd('0x2c')](_0x192284);return new Buffer(_0x266b16)[_0x81dd('0x2d')](_0x81dd('0x27'));}exports[_0x81dd('0x2e')]=function(_0x592d40,_0xf6c2a3,_0x526a6f,_0xd1b26,_0x1858f6,_0x17fc03){var _0x7b3cd8,_0x10c2a4;var _0x17c8ff=_0x81dd('0x2f');var _0x536572=_0x81dd('0x30')+_0x592d40;var _0x50c8d3={};if(_0xf6c2a3===_0x81dd('0x31')){_0x50c8d3['input']={'ssml':_0x526a6f};}else{_0x50c8d3[_0x81dd('0x32')]={'text':_0x526a6f};};_0x50c8d3[_0x81dd('0x33')]={'languageCode':_0xd1b26,'ssmlGender':_0x1858f6};_0x50c8d3[_0x81dd('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5905d9={'url':_0x17c8ff+'text:synthesize'+_0x536572,'method':_0x81dd('0x35'),'json':!![],'body':_0x50c8d3};return rp(_0x5905d9)[_0x81dd('0x28')](function(_0x291d32){return new BPromise(function(_0x5c169d,_0x3538b5){_0x7b3cd8=path['resolve'](__dirname,_0x81dd('0x36'),rs['generate'](0x4)+_0x81dd('0x37'));var _0x5bab36=Buffer[_0x81dd('0x38')](_0x291d32[_0x81dd('0x39')],_0x81dd('0x27'));return fs[_0x81dd('0x3a')](_0x7b3cd8,_0x5bab36,function(_0x59dae4){_0x3538b5(_0x59dae4);},function(_0x23870a){fs[_0x81dd('0x29')](_0x7b3cd8,_0x81dd('0x2a'));_0x5c169d(_0x23870a);});});})[_0x81dd('0x28')](function(_0x13fadf){_0x10c2a4=path[_0x81dd('0x3b')](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+'.wav');return convertFile(_0x7b3cd8,_0x10c2a4);})[_0x81dd('0x28')](function(){try{fs['unlink'](_0x7b3cd8);fs['chmodSync'](_0x10c2a4,_0x81dd('0x2a'));}catch(_0x54e0f1){logger[_0x81dd('0x13')](_0x54e0f1);}logger['info'](_0x81dd('0x3d'),_0x10c2a4[_0x81dd('0x2b')]('.')[0x0]);return _0x10c2a4[_0x81dd('0x2b')]('.')[0x0];});};exports['googleTTS']=function(_0x414ad4,_0x1f59d2){var _0x58866e=_0x81dd('0x3e');var _0x59d36e,_0x46028b;var _0xaa84a5;var _0x45c02b={'encoding':_0x81dd('0x3f'),'method':'POST','timeout':0x2710,'url':_0x58866e,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x81dd('0x40')+encodeURIComponent(JSON[_0x81dd('0x41')]([[[_0x81dd('0x42'),JSON[_0x81dd('0x41')]([_0x414ad4,_0x1f59d2||'en',![],'null']),null,_0x81dd('0x43')]]]))};return rp(_0x45c02b)[_0x81dd('0x28')](function(_0x258937){try{_0xaa84a5=eval(_0x258937[_0x81dd('0x44')](0x5))[0x0][0x2];}catch(_0x4f25f3){throw new Error(_0x81dd('0x45')+_0x258937[_0x81dd('0x46')]);}if(!_0xaa84a5){if(_0x414ad4[_0x81dd('0x47')]>0xc8){throw new Error(_0x81dd('0x48'));}else{throw new Error('lang\x20\x22'+_0x1f59d2+_0x81dd('0x49'));}}try{_0xaa84a5=eval(_0xaa84a5)[0x0];}catch(_0x4085f7){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0xfa9a4c=_0xaa84a5;_0x59d36e=path[_0x81dd('0x3b')](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x37'));fs['writeFileSync'](_0x59d36e,_0xaa84a5,{'encoding':'base64'});_0x46028b=path['resolve'](__dirname,'tmp',rs[_0x81dd('0x3c')](0x4)+'.wav');return convertFile(_0x59d36e,_0x46028b);})[_0x81dd('0x28')](function(){try{fs[_0x81dd('0x1c')](_0x59d36e);fs[_0x81dd('0x29')](_0x46028b,_0x81dd('0x2a'));}catch(_0x50e2f9){logger[_0x81dd('0x13')](_0x50e2f9);}logger[_0x81dd('0x19')](_0x81dd('0x4a'),_0x46028b['split']('.')[0x0]);return _0x46028b['split']('.')[0x0];});};exports[_0x81dd('0x4b')]=function(_0xba911a,_0x5e0ff2,_0x5d12bf){return google[_0x81dd('0x4c')](_0xba911a,_0x5e0ff2,_0x5d12bf)[_0x81dd('0x28')](function(_0x5c70b4){logger['info'](_0x5c70b4[_0x81dd('0x4d')]);return rp(_0x5c70b4);})[_0x81dd('0x28')](function(_0x3ed805){var _0x56ad63='';var _0x4a1808=0x0;try{fs['unlink'](_0xba911a);}catch(_0x284890){logger[_0x81dd('0x13')](_0x284890);}if(_0x3ed805&&_0x3ed805[_0x81dd('0x4e')]){_0x56ad63=_0x3ed805[_0x81dd('0x4e')][_0x81dd('0x4f')](function(_0x4d29a7){return _0x4d29a7&&_0x4d29a7['alternatives'][0x0]&&_0x4d29a7[_0x81dd('0x50')][0x0][_0x81dd('0x51')]?_0x4d29a7[_0x81dd('0x50')][0x0]['transcript']:'';})[_0x81dd('0x52')]('\x0a');_0x4a1808=_0x3ed805[_0x81dd('0x4e')][_0x81dd('0x4f')](function(_0x45a66e){return _0x45a66e&&_0x45a66e['alternatives'][0x0]&&_0x45a66e[_0x81dd('0x50')][0x0]['confidence']?_0x45a66e['alternatives'][0x0][_0x81dd('0x53')]:0x0;})[_0x81dd('0x52')]('\x0a');}logger['info'](_0x81dd('0x54'),_0x56ad63);logger['info'](_0x81dd('0x55'),_0x4a1808);return{'transcript':_0x56ad63,'confidence':_0x4a1808};})['catch'](function(_0x27412b){logger[_0x81dd('0x13')]('[%s]\x20%s:%s',_0x27412b[_0x81dd('0x12')],_0x27412b['name'],_0x27412b['message']);});};exports['googleDialogflow']=function(_0x1bd1d7,_0x277649,_0x5b9802,_0x77d010){var _0x15d798=apiai(_0x277649,{'language':_0x77d010||'en'});return _0x15d798[_0x81dd('0x56')](_0x5b9802,{'sessionId':md5(_0x1bd1d7)})['then'](function(_0x1b32dc){logger[_0x81dd('0x19')](JSON['stringify'](_0x1b32dc));return{'source':_0x1b32dc['result'][_0x81dd('0x57')],'resolvedQuery':_0x1b32dc['result'][_0x81dd('0x58')],'action':_0x1b32dc[_0x81dd('0x59')][_0x81dd('0x5a')],'actionIncomplete':_0x1b32dc[_0x81dd('0x59')]['actionIncomplete'],'speech':_0x1b32dc[_0x81dd('0x59')]['fulfillment'][_0x81dd('0x5b')],'score':_0x1b32dc['result'][_0x81dd('0x5c')],'statusCode':_0x1b32dc[_0x81dd('0x5d')][_0x81dd('0x5e')],'endConversation':_0x1b32dc[_0x81dd('0x59')][_0x81dd('0x5f')][_0x81dd('0x60')]||![],'isFallbackIntent':_0x1b32dc[_0x81dd('0x59')][_0x81dd('0x5f')][_0x81dd('0x61')]};});};exports['googleDialogflowV2']=function(_0x225128,_0x4512dc,_0x1cd8fc,_0x131937,_0x36a26e,_0x538a1e){var _0x127994=_0x131937[_0x81dd('0x62')](/\\n/g,'\x0a');var _0x376791={'credentials':{'private_key':_0x127994,'client_email':_0x1cd8fc}};var _0x4e9665=new dialogflow[(_0x81dd('0x63'))](_0x376791);var _0x18ff0c=_0x4e9665['sessionPath'](_0x4512dc,md5(_0x225128));var _0x35d61d={'session':_0x18ff0c,'queryInput':{'text':{'text':_0x36a26e,'languageCode':_0x538a1e}}};return _0x4e9665[_0x81dd('0x64')](_0x35d61d)[_0x81dd('0x28')](function(_0x2a8ba5){if(_0x2a8ba5&&_0x2a8ba5['length']){logger[_0x81dd('0x19')](_0x81dd('0x65'),JSON[_0x81dd('0x41')](_0x2a8ba5));var _0xa765f2=_0x2a8ba5[0x0];if(_0xa765f2){var _0x2a8765={'action':_0xa765f2['queryResult'][_0x81dd('0x5a')],'allRequiredParamsPresent':_0xa765f2[_0x81dd('0x66')]['allRequiredParamsPresent'],'endConversation':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x67')]&&_0xa765f2[_0x81dd('0x66')][_0x81dd('0x67')][_0x81dd('0x68')]?_0xa765f2['queryResult'][_0x81dd('0x67')][_0x81dd('0x68')][_0x81dd('0x69')]['boolValue']:![],'fulfillmentText':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6a')],'intentName':_0xa765f2[_0x81dd('0x66')]['intent'][_0x81dd('0x6b')],'intentDisplayName':_0xa765f2[_0x81dd('0x66')]['intent'][_0x81dd('0x6c')],'isFallbackIntent':_0xa765f2[_0x81dd('0x66')]['intent'][_0x81dd('0x6d')],'languageCode':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6e')],'queryText':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6f')],'responseId':_0xa765f2[_0x81dd('0x70')],'score':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x71')],'speech':_0xa765f2[_0x81dd('0x66')][_0x81dd('0x6a')],'providerResponse':JSON['stringify'](_0x2a8ba5)};return _0x2a8765;}}});};exports['tildeASR']=function(_0x45c953,_0x32d01c,_0x4ff049,_0x51f53b){return tilde['asr'](_0x45c953,_0x32d01c,_0x4ff049,_0x51f53b)[_0x81dd('0x28')](function(_0x488d9a){try{fs[_0x81dd('0x1c')](_0x45c953);}catch(_0xd41826){logger[_0x81dd('0x13')](_0xd41826);}logger[_0x81dd('0x19')](_0x81dd('0x72'),_0x488d9a['transcript']);logger[_0x81dd('0x19')](_0x81dd('0x73'),_0x488d9a[_0x81dd('0x53')]);return _0x488d9a;});};exports[_0x81dd('0x74')]=function(_0x28b89a,_0x2a7765,_0x2271f1,_0x47d889,_0x5e9acc,_0x764f4e){var _0x5961d3=path['resolve'](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x37'));var _0x2a0447;return aws[_0x81dd('0x75')](_0x28b89a,_0x2a7765,_0x2271f1,_0x47d889,_0x5e9acc,_0x764f4e,_0x5961d3)[_0x81dd('0x28')](function(){_0x2a0447=path['resolve'](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x25'));return convertFile(_0x5961d3,_0x2a0447);})[_0x81dd('0x28')](function(){try{fs['unlink'](_0x5961d3);fs[_0x81dd('0x29')](_0x2a0447,_0x81dd('0x2a'));}catch(_0x479735){logger[_0x81dd('0x13')](_0x479735);}return _0x2a0447[_0x81dd('0x2b')]('.')[0x0];});};exports[_0x81dd('0x76')]=function(_0x2725b0,_0x19f4a7,_0x945cd,_0x486c17,_0x4ac1e8,_0x5d59ca){return aws[_0x81dd('0x77')](_0x2725b0,_0x19f4a7,_0x945cd,_0x486c17,_0x4ac1e8,_0x5d59ca)['then'](function(_0x38e923){logger[_0x81dd('0x19')](JSON[_0x81dd('0x41')](_0x38e923));return _0x38e923;});};exports[_0x81dd('0x78')]=function(_0x4bcb5f,_0x843784,_0x5ae2ab,_0x551f4a){var _0x33e366=util['format'](_0x81dd('0x79'),ISPEECH_API,_0x4bcb5f,encodeURIComponent(_0x843784),_0x5ae2ab,_0x551f4a);var _0x532134=path['resolve'](__dirname,_0x81dd('0x36'),rs['generate'](0x4)+_0x81dd('0x37'));var _0x18287a;return downloadFile(_0x33e366,_0x532134)['then'](function(){_0x18287a=path[_0x81dd('0x3b')](__dirname,_0x81dd('0x36'),rs['generate'](0x4)+_0x81dd('0x25'));return convertFile(_0x532134,_0x18287a);})['then'](function(){try{fs[_0x81dd('0x1c')](_0x532134);fs[_0x81dd('0x29')](_0x18287a,_0x81dd('0x2a'));}catch(_0x5766cd){logger[_0x81dd('0x13')](_0x5766cd);}return _0x18287a[_0x81dd('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x178eb0,_0x54ebd1,_0x1101ed,_0x2dc394){var _0x15bd46=util['format'](_0x81dd('0x7a'),ISPEECH_API,_0x54ebd1,_0x1101ed,base64Encode(_0x178eb0),_0x2dc394?util[_0x81dd('0x7b')](_0x81dd('0x7c'),encodeURIComponent(_0x2dc394)):_0x81dd('0x7d'));return uploadFile(_0x15bd46)[_0x81dd('0x28')](function(_0x491ae1){return querystring[_0x81dd('0x8')](_0x491ae1);});};exports[_0x81dd('0x7e')]=function(_0x50c7cb,_0x29b973){return sestek[_0x81dd('0x7f')](_0x50c7cb,_0x29b973)[_0x81dd('0x28')](function(_0x4b9a63){logger[_0x81dd('0x19')](JSON[_0x81dd('0x41')](_0x4b9a63));var _0x4b9cdc={'speech':_0x4b9a63[_0x81dd('0x80')],'action':_0x4b9a63[_0x81dd('0x81')]?_0x4b9a63[_0x81dd('0x81')]['CustomAction']:undefined,'actiondata':_0x4b9a63[_0x81dd('0x81')]?_0x4b9a63['channelData'][_0x81dd('0x82')]:undefined};if(_0x4b9a63[_0x81dd('0x81')]&&_0x4b9a63[_0x81dd('0x81')][_0x81dd('0x83')]){return base64Decode(_0x4b9a63[_0x81dd('0x81')][_0x81dd('0x83')][_0x81dd('0x84')],path['resolve'](__dirname,_0x81dd('0x36'),rs[_0x81dd('0x3c')](0x4)+_0x81dd('0x25')))[_0x81dd('0x28')](function(_0x4c57e6){_0x4b9cdc[_0x81dd('0x85')]=_0x4c57e6;return _0x4b9cdc;});}return _0x4b9cdc;});};exports[_0x81dd('0x86')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 4951505..afde558 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 _0xee62=['./nda','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xee62,0x1b0));var _0x2ee6=function(_0xb78b06,_0x1a7642){_0xb78b06=_0xb78b06-0x0;var _0x146832=_0xee62[_0xb78b06];return _0x146832;};var nda=require(_0x2ee6('0x0'));module[_0x2ee6('0x1')]={'nda':nda}; \ No newline at end of file +var _0xa6d2=['./nda','exports'];(function(_0x3cfaa3,_0x34f6c9){var _0x55a02c=function(_0x2606fd){while(--_0x2606fd){_0x3cfaa3['push'](_0x3cfaa3['shift']());}};_0x55a02c(++_0x34f6c9);}(_0xa6d2,0x1be));var _0x2a6d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6d2[_0x502c7d];return _0x30b7ed;};var nda=require(_0x2a6d('0x0'));module[_0x2a6d('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 07b608d..b1b05ee 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 _0x4065=['ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','agi','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','ProjectName'];(function(_0xd465d2,_0x16e176){var _0x2b909d=function(_0x341450){while(--_0x341450){_0xd465d2['push'](_0xd465d2['shift']());}};_0x2b909d(++_0x16e176);}(_0x4065,0xdc));var _0x5406=function(_0x40f0a9,_0x3619a9){_0x40f0a9=_0x40f0a9-0x0;var _0x1a234=_0x4065[_0x40f0a9];return _0x1a234;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0x5406('0x0'));module['exports']=function(_0x43096a,_0x46186c){var _0x3bed8a={'method':'POST','uri':url[_0x5406('0x1')](_0x46186c[_0x5406('0x2')],'/token'),'form':{'grant_type':_0x5406('0x3'),'username':_0x46186c[_0x5406('0x4')],'password':_0x46186c[_0x5406('0x3')]},'json':!![]};return rp(_0x3bed8a)[_0x5406('0x5')](function(_0x44f868){var _0x3acd44={'method':'POST','uri':url[_0x5406('0x1')](_0x46186c[_0x5406('0x6')],_0x5406('0x7')),'body':{'type':_0x46186c[_0x5406('0x8')]||_0x5406('0x9'),'channelId':_0x5406('0xa'),'conversation':{'id':_0x43096a['uniqueid']},'from':{'id':_0x43096a[_0x5406('0xb')],'name':_0x43096a[_0x5406('0xc')]},'recipient':{'id':_0x43096a[_0x5406('0xd')],'name':_0x43096a[_0x5406('0xe')]},'text':_0x46186c[_0x5406('0xf')],'channelData':{}},'headers':{'Authorization':_0x5406('0x10')+_0x44f868['access_token']},'json':!![]};if(_0x46186c[_0x5406('0x11')]){_0x3acd44[_0x5406('0x12')]['channelData'][_0x5406('0x13')]=_0x46186c[_0x5406('0x11')];}if(_0x46186c[_0x5406('0x14')]=='1'){_0x3acd44[_0x5406('0x12')][_0x5406('0x15')][_0x5406('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5406('0x17')};}if(_0x46186c[_0x5406('0x18')]){_0x3acd44[_0x5406('0x12')]['channelData'][_0x5406('0x19')]=_0x46186c[_0x5406('0x18')];if(_0x46186c[_0x5406('0x1a')]){_0x3acd44[_0x5406('0x12')]['channelData'][_0x5406('0x1b')]=_0x46186c[_0x5406('0x1a')];}}logger[_0x5406('0x1c')](JSON[_0x5406('0x1d')](_0x3acd44));return rp(_0x3acd44);});}; \ No newline at end of file +var _0x8d53=['calleridname','dnid','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','ndaactivity_type','message','uniqueid','callerid'];(function(_0x4ab2a8,_0xe36a6e){var _0x1537e2=function(_0x2fc2cb){while(--_0x2fc2cb){_0x4ab2a8['push'](_0x4ab2a8['shift']());}};_0x1537e2(++_0xe36a6e);}(_0x8d53,0x1c2));var _0x38d5=function(_0x56d20e,_0x217c31){_0x56d20e=_0x56d20e-0x0;var _0x18b27a=_0x8d53[_0x56d20e];return _0x18b27a;};'use strict';var rp=require(_0x38d5('0x0'));var url=require(_0x38d5('0x1'));var logger=require('../../../../../config/logger')(_0x38d5('0x2'));module[_0x38d5('0x3')]=function(_0x108137,_0x453bf8){var _0x3a7660={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x6')],'/token'),'form':{'grant_type':_0x38d5('0x7'),'username':_0x453bf8[_0x38d5('0x8')],'password':_0x453bf8[_0x38d5('0x7')]},'json':!![]};return rp(_0x3a7660)['then'](function(_0x5ebf9a){var _0x284f7b={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x453bf8[_0x38d5('0xa')]||_0x38d5('0xb'),'channelId':'Nda','conversation':{'id':_0x108137[_0x38d5('0xc')]},'from':{'id':_0x108137[_0x38d5('0xd')],'name':_0x108137[_0x38d5('0xe')]},'recipient':{'id':_0x108137[_0x38d5('0xf')],'name':_0x108137['extension']},'text':_0x453bf8['text'],'channelData':{}},'headers':{'Authorization':_0x38d5('0x10')+_0x5ebf9a[_0x38d5('0x11')]},'json':!![]};if(_0x453bf8['project']){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x13')]=_0x453bf8[_0x38d5('0x14')];}if(_0x453bf8[_0x38d5('0x15')]=='1'){_0x284f7b[_0x38d5('0x12')][_0x38d5('0x16')][_0x38d5('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x453bf8[_0x38d5('0x18')]){_0x284f7b['body'][_0x38d5('0x16')]['CustomAction']=_0x453bf8[_0x38d5('0x18')];if(_0x453bf8[_0x38d5('0x19')]){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x1a')]=_0x453bf8[_0x38d5('0x19')];}}logger[_0x38d5('0x1b')](JSON[_0x38d5('0x1c')](_0x284f7b));return rp(_0x284f7b);});}; \ 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 95f034c..8806c62 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 _0xd5a9=['./lib/api','exports'];(function(_0x36e12f,_0x3ed5c4){var _0x47e7d0=function(_0x3fd75c){while(--_0x3fd75c){_0x36e12f['push'](_0x36e12f['shift']());}};_0x47e7d0(++_0x3ed5c4);}(_0xd5a9,0x6a));var _0x9d5a=function(_0x57edf6,_0x340818){_0x57edf6=_0x57edf6-0x0;var _0x258e2e=_0xd5a9[_0x57edf6];return _0x258e2e;};'use strict';var asr=require(_0x9d5a('0x0'));module[_0x9d5a('0x1')]=function(_0x49a276,_0x25a5d5,_0x375cf5,_0x2adef6){return asr(_0x49a276,_0x25a5d5,_0x375cf5,_0x2adef6);}; \ No newline at end of file +var _0x2a35=['./lib/api'];(function(_0x41ab06,_0x1e4404){var _0x30c50c=function(_0x551783){while(--_0x551783){_0x41ab06['push'](_0x41ab06['shift']());}};_0x30c50c(++_0x1e4404);}(_0x2a35,0x1bd));var _0x52a3=function(_0x31c37d,_0x31a3c9){_0x31c37d=_0x31c37d-0x0;var _0x17ccc7=_0x2a35[_0x31c37d];return _0x17ccc7;};'use strict';var asr=require(_0x52a3('0x0'));module['exports']=function(_0x592441,_0x2f07d6,_0xc159fa,_0x39a87d){return asr(_0x592441,_0x2f07d6,_0xc159fa,_0x39a87d);}; \ 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 c8b1ac0..6bcff84 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 _0x147b=['status','result','final','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','close','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','terminate','parse'];(function(_0x59abc0,_0x2bcee9){var _0x2e7e0a=function(_0x49a10b){while(--_0x49a10b){_0x59abc0['push'](_0x59abc0['shift']());}};_0x2e7e0a(++_0x2bcee9);}(_0x147b,0x16d));var _0xb147=function(_0x492d4a,_0x33804c){_0x492d4a=_0x492d4a-0x0;var _0x38056d=_0x147b[_0x492d4a];return _0x38056d;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb147('0x0'));var crypto=require(_0xb147('0x1'));var logger=require(_0xb147('0x2'))(_0xb147('0x3'));module[_0xb147('0x4')]=function(_0x524568,_0x535eae,_0xbf75b7,_0x5b4f20){return new BPromise(function(_0xe510e8,_0x34ee78){logger[_0xb147('0x5')]('Tilde\x20URI',_0x5b4f20||_0xb147('0x6'));var _0x2f95c8=new WebSocket(_0x5b4f20||_0xb147('0x6'),{'perMessageDeflate':![]});var _0x2a5e52='';var _0x1ffcac='0';var _0x35fe86='1';var _0x1105a9=_0xb147('0x7');function _0xdb5ee9(_0x6d8bc2){var _0x520b23=crypto[_0xb147('0x8')]('sha1');_0x520b23[_0xb147('0x9')](_0x6d8bc2);return _0x520b23[_0xb147('0xa')]('hex');}function _0x34fa80(){try{logger[_0xb147('0x5')](_0xb147('0xb'));var _0x3affdf=moment()[_0xb147('0xc')]();var _0x2b162d=_0xdb5ee9(_0x3affdf+_0x535eae+_0xbf75b7);_0x2f95c8[_0xb147('0xd')](JSON[_0xb147('0xe')]({'appID':_0x535eae,'timestamp':_0x3affdf,'appKey':_0x2b162d}));var _0x604e43=fs[_0xb147('0xf')](_0x524568);_0x604e43['on'](_0xb147('0x10'),function(_0x3c3080){_0x2f95c8['send'](_0x3c3080);});_0x604e43['on']('close',function(){_0x2f95c8[_0xb147('0xd')](_0xb147('0x11'));});}catch(_0x2f9bcf){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xb147('0xe')](_0x2f9bcf));_0x2f95c8[_0xb147('0x12')]();}}function _0x3735a6(_0x3391da){try{if(_0x3391da){var _0x20b51e=JSON[_0xb147('0x13')](_0x3391da);switch(_0x20b51e[_0xb147('0x14')]){case 0x0:if(_0x20b51e[_0xb147('0x15')]){if(_0x20b51e[_0xb147('0x15')][_0xb147('0x16')]){logger[_0xb147('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0xb147('0xe')](_0x20b51e['result'][_0xb147('0x17')]));_0x2a5e52=_0x20b51e[_0xb147('0x15')][_0xb147('0x17')][0x0][_0xb147('0x18')];_0x1ffcac=_0x20b51e['result'][_0xb147('0x17')][0x0][_0xb147('0x19')];_0x35fe86='0';_0x1105a9='Success.';_0x2f95c8[_0xb147('0x12')]();}}break;case 0x1:logger[_0xb147('0x5')](_0xb147('0x7'));_0x35fe86='1';_0x1105a9=_0xb147('0x7');break;case 0x2:logger[_0xb147('0x5')](_0xb147('0x1a'));_0x35fe86='2';_0x1105a9='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xb147('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x35fe86='9';_0x1105a9='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xb147('0x5')](_0xb147('0x1b'));_0x35fe86='10';_0x1105a9=_0xb147('0x1b');break;case 0xb:logger[_0xb147('0x5')](_0xb147('0x1c'));_0x35fe86='11';_0x1105a9=_0xb147('0x1c');}}}catch(_0x18364a){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xb147('0xe')](_0x18364a));_0x2f95c8[_0xb147('0x12')]();}}function _0x3bbbee(){logger[_0xb147('0x5')](_0xb147('0x1d'));_0xe510e8({'transcript':_0x2a5e52,'confidence':_0x1ffcac,'status':_0x35fe86,'status_message':_0x1105a9});}function _0x39a4cd(_0x17a2d9){logger[_0xb147('0x1e')](_0xb147('0x1f'));if(!_[_0xb147('0x20')](_0x17a2d9)){logger[_0xb147('0x1e')](_[_0xb147('0x21')](_0x17a2d9)?JSON[_0xb147('0xe')](_0x17a2d9):_0x17a2d9);}}_0x2f95c8['on']('open',_0x34fa80);_0x2f95c8['on']('message',_0x3735a6);_0x2f95c8['on'](_0xb147('0x22'),_0x3bbbee);_0x2f95c8['on'](_0xb147('0x1e'),_0x39a4cd);});}; \ No newline at end of file +var _0xe45d=['createReadStream','data','close','EOS','error','terminate','parse','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x3e03da,_0x38b42e){var _0x1e04f9=function(_0x443eb5){while(--_0x443eb5){_0x3e03da['push'](_0x3e03da['shift']());}};_0x1e04f9(++_0x38b42e);}(_0xe45d,0x19d));var _0xde45=function(_0x129821,_0xc3a286){_0x129821=_0x129821-0x0;var _0x40c393=_0xe45d[_0x129821];return _0x40c393;};'use strict';var BPromise=require(_0xde45('0x0'));var _=require(_0xde45('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xde45('0x2'))(_0xde45('0x3'));module[_0xde45('0x4')]=function(_0x4dad72,_0x1d2350,_0x42c637,_0x2e520b){return new BPromise(function(_0x512f06,_0x331151){logger[_0xde45('0x5')](_0xde45('0x6'),_0x2e520b||_0xde45('0x7'));var _0x37a9c4=new WebSocket(_0x2e520b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x403e82='';var _0x6d5979='0';var _0x2b83e2='1';var _0x44c4f9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x290e86(_0x155e38){var _0x359a67=crypto[_0xde45('0x8')]('sha1');_0x359a67[_0xde45('0x9')](_0x155e38);return _0x359a67[_0xde45('0xa')](_0xde45('0xb'));}function _0x1bba56(){try{logger[_0xde45('0x5')](_0xde45('0xc'));var _0x8f3684=moment()[_0xde45('0xd')]();var _0x188650=_0x290e86(_0x8f3684+_0x1d2350+_0x42c637);_0x37a9c4[_0xde45('0xe')](JSON[_0xde45('0xf')]({'appID':_0x1d2350,'timestamp':_0x8f3684,'appKey':_0x188650}));var _0x4727c9=fs[_0xde45('0x10')](_0x4dad72);_0x4727c9['on'](_0xde45('0x11'),function(_0x32dffe){_0x37a9c4[_0xde45('0xe')](_0x32dffe);});_0x4727c9['on'](_0xde45('0x12'),function(){_0x37a9c4[_0xde45('0xe')](_0xde45('0x13'));});}catch(_0x32a66c){logger[_0xde45('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0xde45('0xf')](_0x32a66c));_0x37a9c4[_0xde45('0x15')]();}}function _0x2fa0e7(_0x2a7de0){try{if(_0x2a7de0){var _0x48da75=JSON[_0xde45('0x16')](_0x2a7de0);switch(_0x48da75['status']){case 0x0:if(_0x48da75['result']){if(_0x48da75['result'][_0xde45('0x17')]){logger['info'](_0xde45('0x18'),JSON[_0xde45('0xf')](_0x48da75[_0xde45('0x19')][_0xde45('0x1a')]));_0x403e82=_0x48da75[_0xde45('0x19')][_0xde45('0x1a')][0x0]['transcript'];_0x6d5979=_0x48da75[_0xde45('0x19')][_0xde45('0x1a')][0x0][_0xde45('0x1b')];_0x2b83e2='0';_0x44c4f9=_0xde45('0x1c');_0x37a9c4[_0xde45('0x15')]();}}break;case 0x1:logger[_0xde45('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2b83e2='1';_0x44c4f9=_0xde45('0x1d');break;case 0x2:logger[_0xde45('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2b83e2='2';_0x44c4f9='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xde45('0x5')](_0xde45('0x1e'));_0x2b83e2='9';_0x44c4f9=_0xde45('0x1e');break;case 0xa:logger[_0xde45('0x5')](_0xde45('0x1f'));_0x2b83e2='10';_0x44c4f9=_0xde45('0x1f');break;case 0xb:logger[_0xde45('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2b83e2='11';_0x44c4f9=_0xde45('0x20');}}}catch(_0x3d89e7){logger[_0xde45('0x14')](_0xde45('0x21'),JSON[_0xde45('0xf')](_0x3d89e7));_0x37a9c4['terminate']();}}function _0x502d78(){logger['info'](_0xde45('0x22'));_0x512f06({'transcript':_0x403e82,'confidence':_0x6d5979,'status':_0x2b83e2,'status_message':_0x44c4f9});}function _0x4bcd24(_0x1da783){logger[_0xde45('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xde45('0x23')](_0x1da783)){logger[_0xde45('0x14')](_[_0xde45('0x24')](_0x1da783)?JSON[_0xde45('0xf')](_0x1da783):_0x1da783);}}_0x37a9c4['on'](_0xde45('0x25'),_0x1bba56);_0x37a9c4['on'](_0xde45('0x26'),_0x2fa0e7);_0x37a9c4['on'](_0xde45('0x12'),_0x502d78);_0x37a9c4['on'](_0xde45('0x14'),_0x4bcd24);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index b32a585..697beb7 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x851b=['exports','./asr'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x851b,0x189));var _0xb851=function(_0x436019,_0x3030a5){_0x436019=_0x436019-0x0;var _0x387dda=_0x851b[_0x436019];return _0x387dda;};var asr=require(_0xb851('0x0'));module[_0xb851('0x1')]={'asr':asr}; \ No newline at end of file +var _0xba2d=['./asr'];(function(_0x5df61f,_0x482dc8){var _0x4caed9=function(_0x395e27){while(--_0x395e27){_0x5df61f['push'](_0x5df61f['shift']());}};_0x4caed9(++_0x482dc8);}(_0xba2d,0x11f));var _0xdba2=function(_0x18572f,_0x2a5a3a){_0x18572f=_0x18572f-0x0;var _0x6978fc=_0xba2d[_0x18572f];return _0x6978fc;};var asr=require(_0xdba2('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 58bf8d6..8efd92b 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 6b90dd6..f6e42ae 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 _0x31af=['DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','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','recordFile','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','debug','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','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','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','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','moment','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbc','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','exec','replace','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','out','dialogflowV2'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x31af,0xde));var _0xf31a=function(_0x4b4e21,_0x4b841d){_0x4b4e21=_0x4b4e21-0x0;var _0x287412=_0x31af[_0x4b4e21];return _0x287412;};'use strict';var fs=require('fs');var util=require(_0xf31a('0x0'));var _=require(_0xf31a('0x1'));var sh=require(_0xf31a('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xf31a('0x3'));var Mustache=require('mustache');var rp=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xf31a('0x8');var recursiveMapAttributes=[_0xf31a('0x9'),_0xf31a('0xa')];var verticesWithRetry=[_0xf31a('0xb'),'getdigits',_0xf31a('0xc')];var AGIVertices=function(_0xe5778a,_0x410d44,_0xee6b4a){this['channel']=_0xe5778a;this[_0xf31a('0xd')]=_0x410d44;this[_0xf31a('0xe')]=_0xee6b4a;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x10')]=function(_0xf2e284,_0x5165aa){this[_0xf31a('0xd')][_0xf31a('0x11')](_0xf2e284)[_0xf31a('0x12')](function(_0x3f0cc8){_0x5165aa(null,_0x3f0cc8?_0x3f0cc8['name']:![]);})[_0xf31a('0x13')](function(_0x26b85e){_0x5165aa(_0x26b85e);});};AGIVertices['prototype'][_0xf31a('0x14')]=function(_0x46345c,_0x46bdd3){this[_0xf31a('0xd')][_0xf31a('0x15')](_0x46345c)[_0xf31a('0x12')](function(_0x1d2d07){_0x46bdd3(null,_0x1d2d07?_0x1d2d07[_0xf31a('0x16')]:![]);})[_0xf31a('0x13')](function(_0x22522c){_0x46bdd3(_0x22522c);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x17')]=function(_0x3439ba,_0xccfd8b){this[_0xf31a('0xd')]['getSquareProjectById'](_0x3439ba)[_0xf31a('0x12')](function(_0x27e161){_0xccfd8b(null,_0x27e161?_0x27e161[_0xf31a('0x16')]:![]);})[_0xf31a('0x13')](function(_0x4c3589){_0xccfd8b(_0x4c3589);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x18')]=function(_0x204dc2,_0x208da3){this[_0xf31a('0xd')]['getSquareOdbcById'](_0x204dc2)[_0xf31a('0x12')](function(_0xd3ac94){_0x208da3(null,_0xd3ac94?_0xd3ac94['dsn']:![]);})[_0xf31a('0x13')](function(_0x504d13){_0x208da3(_0x504d13);});};AGIVertices['prototype'][_0xf31a('0x19')]=function(_0x7ce891,_0x54f9b5){this['rpc']['getUserById'](_0x7ce891)[_0xf31a('0x12')](function(_0x1e4dea){_0x54f9b5(null,_0x1e4dea?_0x1e4dea['name']:![]);})[_0xf31a('0x13')](function(_0x2a8a22){_0x54f9b5(_0x2a8a22);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1a')]=function(_0x4c46d9,_0x5d8083){this[_0xf31a('0xd')][_0xf31a('0x1b')](_0x4c46d9)['then'](function(_0x4e115c){_0x5d8083(null,_0x4e115c?_0x4e115c['name']:![]);})['catch'](function(_0x14c82e){_0x5d8083(_0x14c82e);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1c')]=function(_0x595db6,_0x2281c5){var _0x2ace06=this;this[_0xf31a('0xd')][_0xf31a('0x1d')](_0x595db6)[_0xf31a('0x12')](function(_0x5a55c6){_0x2281c5(null,_0x5a55c6?_0x2ace06[_0xf31a('0x1e')](_0x5a55c6[_0xf31a('0x1f')]):![]);})['catch'](function(_0x52da7d){_0x2281c5(_0x52da7d);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x20')]=function(_0x5c842e,_0x1bcfe6){this[_0xf31a('0xd')][_0xf31a('0x21')](_0x5c842e)['then'](function(_0x1d4d9b){_0x1bcfe6(null,_0x1d4d9b?_0x1d4d9b:![]);})[_0xf31a('0x13')](function(_0x289f27){_0x1bcfe6(_0x289f27);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x22')]=function(_0x19807c,_0x53ffb6,_0xcdf92){this[_0xf31a('0xe')][_0xf31a('0x22')](_0x19807c,_0x53ffb6)[_0xf31a('0x12')](function(){_0xcdf92(null);})[_0xf31a('0x13')](function(_0x42d1a6){_0xcdf92(_0x42d1a6);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x23')]=function(_0x17c5dc,_0x137ea4){this[_0xf31a('0xd')][_0xf31a('0x24')](_0x17c5dc)[_0xf31a('0x12')](function(_0x25cd42){if(_0x25cd42){if(_0x25cd42[_0xf31a('0x25')]){_0x137ea4(null,[_0x25cd42[_0xf31a('0x26')]]);}else{_0x137ea4(null,_[_0xf31a('0x27')](_0x25cd42[_0xf31a('0x28')],_0xf31a('0x26')));}}else{_0x137ea4(null,![]);}})['catch'](function(_0x2d81f3){_0x137ea4(_0x2d81f3);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1e')]=function(_0x424db8){return util[_0xf31a('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x424db8);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x2a')]=function(_0xe8e0e0,_0x5820e6,_0x474cfc){odbc[_0xf31a('0x2b')](_0xe8e0e0,function(_0xe141dd){if(_0xe141dd){logger[_0xf31a('0x2c')](_0xf31a('0x2d'),_0xe141dd);_0x474cfc(_0xe141dd);}else{logger['info'](_0xf31a('0x2e'));odbc['query'](_0x5820e6,function(_0x44321d,_0x129409){if(_0x44321d){logger['info'](_0xf31a('0x2f'),_0x5820e6);_0x474cfc(_0x44321d);}else{logger[_0xf31a('0x30')](_0xf31a('0x31'),_0x5820e6);odbc['close'](function(_0x5d1176){if(_0x5d1176){logger[_0xf31a('0x2c')](_0xf31a('0x32'),_0x5d1176);}_0x474cfc(null,_0x129409);});}});}});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x33')]=function(_0x2a240d,_0x46587e){this[_0xf31a('0xd')][_0xf31a('0x34')](_0x2a240d)['then'](function(_0x3b4aef){_0x46587e(null,_0x3b4aef?_0x3b4aef:![]);})[_0xf31a('0x13')](function(_0x4ac009){_0x46587e(_0x4ac009);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x35')]=function(_0x1085c2,_0x44b30b){this['rpc'][_0xf31a('0x35')](_0x1085c2)[_0xf31a('0x12')](function(_0x306415){_0x44b30b(null,_0x306415);})[_0xf31a('0x13')](function(_0x529814){_0x44b30b(_0x529814);});};AGIVertices[_0xf31a('0xf')]['createSquareDetailsReport']=function(_0x303066,_0x172e1c,_0x1ef487){this['rpc'][_0xf31a('0x36')]({'uniqueid':this['channel'][_0xf31a('0x37')],'node':_0x303066[_0xf31a('0x38')],'application':_0x303066[_0xf31a('0x39')],'data':_0x172e1c||null,'project_name':this[_0xf31a('0x3a')][_0xf31a('0x3b')],'callerid':this[_0xf31a('0x3a')][_0xf31a('0x3c')]})[_0xf31a('0x12')](function(_0x344649){if(_0x1ef487){_0x1ef487(null,_0x344649);}})['catch'](function(_0x1a9f36){if(_0x1ef487){_0x1ef487(_0x1a9f36);}});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x3d')]=function(_0x38d568,_0x82885d,_0x12cf9b,_0x2a2459){this['rpc']['createSquareRecording']({'uniqueid':this[_0xf31a('0x3a')][_0xf31a('0x37')],'callerid':this[_0xf31a('0x3a')][_0xf31a('0x3c')],'calleridname':this[_0xf31a('0x3a')][_0xf31a('0x3e')],'context':this['channel'][_0xf31a('0x3f')],'extension':this[_0xf31a('0x3a')][_0xf31a('0x40')],'priority':this[_0xf31a('0x3a')][_0xf31a('0x41')],'accountcode':this[_0xf31a('0x3a')]['accountcode'],'dnid':this[_0xf31a('0x3a')][_0xf31a('0x42')],'projectName':this[_0xf31a('0x3a')][_0xf31a('0x3b')],'saveName':_0x82885d,'filename':_0x38d568[_0xf31a('0x43')]||_0x82885d,'savePath':_0x12cf9b})[_0xf31a('0x12')](function(_0x20bd0c){_0x2a2459(null,_0x20bd0c);})[_0xf31a('0x13')](function(_0x1f8161){_0x2a2459(_0x1f8161);});};AGIVertices[_0xf31a('0xf')]['createSquareMessage']=function(_0x2f1b64,_0x4d17fc,_0x423768,_0x3f8b9b,_0xa9b74c){this[_0xf31a('0xd')][_0xf31a('0x44')]({'uniqueid':this[_0xf31a('0x3a')][_0xf31a('0x37')],'body':_0x2f1b64,'direction':_0x4d17fc,'providerName':_0x423768,'providerResponse':_0x3f8b9b})[_0xf31a('0x12')](function(_0x4aaa57){if(_0xa9b74c){_0xa9b74c(null,_0x4aaa57);}})[_0xf31a('0x13')](function(_0x416227){if(_0xa9b74c){_0xa9b74c(_0x416227);}});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x45')]=function(_0x3877f8,_0x8c6795){this['rpc'][_0xf31a('0x45')]({'firstName':_[_0xf31a('0x46')](_0x3877f8[_0xf31a('0x16')])||_[_0xf31a('0x47')](_0x3877f8[_0xf31a('0x16')])?_0xf31a('0x48')+Math[_0xf31a('0x49')]():_0x3877f8[_0xf31a('0x16')],'lastName':_[_0xf31a('0x46')](_0x3877f8[_0xf31a('0x4a')])||_[_0xf31a('0x47')](_0x3877f8[_0xf31a('0x4a')])?null:_0x3877f8['lastName'],'phone':_0x3877f8[_0xf31a('0x4b')],'ListId':_0x3877f8[_0xf31a('0x4c')],'scheduledat':_0x3877f8[_0xf31a('0x4d')],'callbackUniqueid':this['channel'][_0xf31a('0x37')],'tags':'callback','description':_0xf31a('0x4e')+_0x3877f8[_0xf31a('0x4d')][_0xf31a('0x4f')](),'priority':_0x3877f8[_0xf31a('0x50')]})['then'](function(_0x89bdd){_0x8c6795(null,_0x89bdd);})[_0xf31a('0x13')](function(_0x2ebd69){_0x8c6795(_0x2ebd69);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x51')]=function(_0x10eb82,_0x5579c6){this[_0xf31a('0xd')]['getPauseById'](_0x10eb82)['then'](function(_0x5d2700){_0x5579c6(null,_0x5d2700?_0x5d2700[_0xf31a('0x16')]:![]);})[_0xf31a('0x13')](function(_0x501409){_0x5579c6(_0x501409);});};AGIVertices['prototype'][_0xf31a('0x52')]=function(_0x292b58,_0xfd1cf7,_0x4bc18c){var _0x4b9586={'role':_0xf31a('0x53')};_0x4b9586[_0x292b58]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];this[_0xf31a('0xd')][_0xf31a('0x52')](_0x4b9586,_0xfd1cf7,this[_0xf31a('0x3a')]['uniqueid'])[_0xf31a('0x12')](function(_0x4e8669){_0x4bc18c(null,_[_0xf31a('0x47')](_0x4e8669)?![]:!![]);})[_0xf31a('0x13')](function(_0x73c0a1){logger['error'](_0x73c0a1);_0x4bc18c(null,![]);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x54')]=function(_0x24be18,_0xcf0f0b){var _0x122b6d={'role':_0xf31a('0x53')};_0x122b6d[_0x24be18]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];this['rpc'][_0xf31a('0x54')](_0x122b6d)['then'](function(_0x29aeb9){_0xcf0f0b(null,_['isNil'](_0x29aeb9)?![]:!![]);})[_0xf31a('0x13')](function(_0x11cd2b){logger[_0xf31a('0x2c')](_0x11cd2b);_0xcf0f0b(null,![]);});};AGIVertices[_0xf31a('0xf')]['agentLogout']=function(_0x3e109a,_0x21548d){var _0x694196={'role':_0xf31a('0x53')};_0x694196[_0x3e109a]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];this[_0xf31a('0xd')][_0xf31a('0x55')](_0x694196)[_0xf31a('0x12')](function(_0xb2e809){_0x21548d(null,_[_0xf31a('0x47')](_0xb2e809)?![]:!![]);})[_0xf31a('0x13')](function(_0x41f206){logger['error'](_0x41f206);_0x21548d(null,![]);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x56')]=function(_0x55695a,_0x4558d8){var _0x37b704={'role':'agent'};_0x37b704[_0x55695a]=this[_0xf31a('0x3a')][_0xf31a('0x3c')];var _0x50e484=_0x55695a!='internal'?util['format']('%s/%s@from-sip/n',_0xf31a('0x57'),this[_0xf31a('0x3a')][_0xf31a('0x3c')]):undefined;this[_0xf31a('0xd')][_0xf31a('0x56')](_0x37b704,_0x50e484)[_0xf31a('0x12')](function(_0x560b8d){_0x4558d8(null,_[_0xf31a('0x47')](_0x560b8d)?![]:!![]);})[_0xf31a('0x13')](function(_0x12e5a1){logger[_0xf31a('0x2c')](_0x12e5a1);_0x4558d8(null,![]);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x58')]=function(_0x12dca4,_0x2bcc4f){sh[_0xf31a('0x59')](_['trim'](_0x12dca4),function(_0x7e978c,_0x53b8e0){var _0x293e14=_0x53b8e0[_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'');_0x2bcc4f(null,_0x293e14);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x5e7abf,_0x81361f){scripts['googleCloudTTS'](_0x5e7abf[_0xf31a('0x5b')],_0x5e7abf[_0xf31a('0x5c')]||'text',_0x5e7abf[_0xf31a('0x5d')],_0x5e7abf[_0xf31a('0x5e')]||'en-US',_0x5e7abf['ssmlGender']||_0xf31a('0x5f'),_0x5e7abf['audioEncoding']||_0xf31a('0x60'))[_0xf31a('0x12')](function(_0x4eab0e){_0x81361f(null,_0x4eab0e);})['catch'](function(_0x3fc2bb){_0x81361f(_0x3fc2bb);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x61')]=function(_0x5787e8,_0x49986e){scripts['googleTTS'](_0x5787e8[_0xf31a('0x5d')],_0x5787e8['google_tts_language']||'en',0x1)['then'](function(_0x49435b){_0x49986e(null,_0x49435b);})[_0xf31a('0x13')](function(_0x48de0c){_0x49986e(_0x48de0c);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x62')]=function(_0x38e3c7,_0x22bb77){var _0x4452a6={'uri':_0x38e3c7[_0xf31a('0x63')],'method':_0x38e3c7[_0xf31a('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x38e3c7[_0xf31a('0x65')])===_0xf31a('0x66')&&parseInt(_0x38e3c7[_0xf31a('0x65')])>=0x1?parseInt(_0x38e3c7[_0xf31a('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xf31a('0x67'),'PUT'],_0x4452a6['method'][_0xf31a('0x68')]())){try{_0x4452a6[_0xf31a('0x69')]=_0x38e3c7[_0xf31a('0xa')]?JSON[_0xf31a('0x6a')](_0x38e3c7[_0xf31a('0xa')]):{};}catch(_0x2b3019){logger[_0xf31a('0x2c')](_0xf31a('0x6b'),_0x2b3019);}}try{_0x4452a6['headers']=_0x38e3c7[_0xf31a('0x9')]?JSON[_0xf31a('0x6a')](_0x38e3c7[_0xf31a('0x9')]):{};}catch(_0x4933e0){logger[_0xf31a('0x2c')](_0xf31a('0x6c'),_0x4933e0);}if(_0x38e3c7['computedVariables']){try{var _0x31b51a=require(_0x38e3c7[_0xf31a('0x6d')])[_0xf31a('0x6e')](this,_0x4452a6);_0x4452a6[_0xf31a('0x6f')]=Mustache[_0xf31a('0x70')](_0x38e3c7[_0xf31a('0x63')],_0x31b51a,{},['$$','$$']);if(_0x4452a6['headers']){_0x4452a6[_0xf31a('0x71')]=JSON[_0xf31a('0x6a')](Mustache[_0xf31a('0x70')](JSON[_0xf31a('0x72')](_0x4452a6['headers']),_0x31b51a,{},['$$','$$']));}if(_0x4452a6['body']){_0x4452a6[_0xf31a('0x69')]=JSON[_0xf31a('0x6a')](Mustache[_0xf31a('0x70')](JSON[_0xf31a('0x72')](_0x4452a6[_0xf31a('0x69')]),_0x31b51a,{},['$$','$$']));}}catch(_0x3a772d){logger['error'](_0xf31a('0x73'),_0x3a772d);}}rp(_0x4452a6)[_0xf31a('0x12')](function(_0x1fd44e){var _0xba3819={'statusCode':_0x1fd44e[_0xf31a('0x74')]||0xc8,'statusMessage':_0x1fd44e[_0xf31a('0x75')]||'OK','headers':_0x1fd44e[_0xf31a('0x71')]||{},'body':_0x1fd44e[_0xf31a('0x69')]||{}};_0x22bb77(null,_0xba3819);})['catch'](function(_0x583d4a){var _0x55a76e={'statusCode':_0x583d4a[_0xf31a('0x74')]||0x1f4,'statusMessage':_0x583d4a[_0xf31a('0x76')]||_0xf31a('0x77'),'headers':_0x583d4a['options'][_0xf31a('0x71')]||{},'body':_0x583d4a[_0xf31a('0x78')][_0xf31a('0x69')]||{}};_0x22bb77(null,_0x55a76e);});};AGIVertices[_0xf31a('0xf')]['googleDialogflow']=function(_0x573fbd,_0x381d42){scripts['googleDialogflow'](this[_0xf31a('0x3a')]['uniqueid'],_0x573fbd[_0xf31a('0x79')],_0x573fbd[_0xf31a('0x5d')],_0x573fbd[_0xf31a('0x7a')]||'en')[_0xf31a('0x12')](function(_0xd21867){_0x381d42(null,_0xd21867);})['catch'](function(_0x351733){_0x381d42(_0x351733);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x7b')]=function(_0x50bbba,_0x1fdb59){scripts[_0xf31a('0x7b')](this[_0xf31a('0x3a')]['uniqueid'],_0x50bbba[_0xf31a('0x7c')],_0x50bbba[_0xf31a('0x7d')],_0x50bbba[_0xf31a('0x7e')],_0x50bbba[_0xf31a('0x5d')],_0x50bbba['dialogflowV2_language']||'en')[_0xf31a('0x12')](function(_0x31b6ee){_0x1fdb59(null,_0x31b6ee);})['catch'](function(_0x512855){_0x1fdb59(_0x512855);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x7f')]=function(_0x5515e6,_0x1b5c7e){scripts['sestekNDA'](this[_0xf31a('0x3a')],_0x5515e6)[_0xf31a('0x12')](function(_0x3bf3f4){_0x1b5c7e(null,_0x3bf3f4);})['catch'](function(_0x3c7519){_0x1b5c7e(_0x3c7519);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x80')]=function(_0xbf3985,_0x1b28c5){scripts[_0xf31a('0x80')](_0xbf3985[_0xf31a('0x79')],_0xbf3985['text'],_0xbf3985['ispeech_tts_language']||'en-US',_0xbf3985[_0xf31a('0x81')])[_0xf31a('0x12')](function(_0x2bba06){_0x1b28c5(null,_0x2bba06);})[_0xf31a('0x13')](function(_0x360baf){_0x1b28c5(_0x360baf);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x82')]=function(_0xe178c3,_0x163780,_0x4bd014){scripts[_0xf31a('0x82')](_0x163780,_0xe178c3[_0xf31a('0x79')],_0xe178c3[_0xf31a('0x83')]||_0xf31a('0x84'),this[_0xf31a('0x85')](_0xe178c3[_0xf31a('0x86')])?_0xe178c3[_0xf31a('0x86')]:undefined)[_0xf31a('0x12')](function(_0x168ebe){_0x4bd014(null,_0x168ebe);})[_0xf31a('0x13')](function(_0x394a38){_0x4bd014(_0x394a38);});};AGIVertices[_0xf31a('0xf')][_0xf31a('0x87')]=function(_0x4e3223,_0x3849d9){scripts[_0xf31a('0x87')](_0x4e3223['aws_access_key_id'],_0x4e3223[_0xf31a('0x88')],_0x4e3223[_0xf31a('0x89')],_0x4e3223[_0xf31a('0x8a')]||_0xf31a('0x8b'),_0x4e3223['text'],_0x4e3223['aws_text_type']||_0xf31a('0x5d'))[_0xf31a('0x12')](function(_0x11d390){_0x3849d9(null,_0x11d390);})[_0xf31a('0x13')](function(_0x4ea997){_0x3849d9(_0x4ea997);});};AGIVertices['prototype']['awsLex']=function(_0x5815f3,_0x46d39a){scripts[_0xf31a('0x8c')](this[_0xf31a('0x3a')][_0xf31a('0x37')],_0x5815f3[_0xf31a('0x8d')],_0x5815f3[_0xf31a('0x88')],_0x5815f3[_0xf31a('0x8e')],_0x5815f3[_0xf31a('0x5d')],_0x5815f3[_0xf31a('0x8f')])[_0xf31a('0x12')](function(_0x17183b){_0x46d39a(null,_0x17183b);})[_0xf31a('0x13')](function(_0x109b70){_0x46d39a(_0x109b70);});};AGIVertices['prototype'][_0xf31a('0x90')]=function(_0x1452e0,_0x4a3959,_0x4c79bd){scripts['googleASR'](_0x4a3959,_0x1452e0[_0xf31a('0x79')],_0x1452e0[_0xf31a('0x91')]||'en-US')[_0xf31a('0x12')](function(_0x524d15){_0x4c79bd(null,_0x524d15);})[_0xf31a('0x13')](function(_0x41a9f9){_0x4c79bd(_0x41a9f9);});};AGIVertices[_0xf31a('0xf')]['tildeASR']=function(_0x1b7365,_0x2f00d0,_0x43015d){scripts['tildeASR'](_0x2f00d0,_0x1b7365[_0xf31a('0x92')],_0x1b7365[_0xf31a('0x93')],_0x1b7365['uri'])[_0xf31a('0x12')](function(_0x9b47e5){_0x43015d(null,_0x9b47e5);})[_0xf31a('0x13')](function(_0x5c0ce2){_0x43015d(_0x5c0ce2);});};AGIVertices['prototype'][_0xf31a('0x94')]=function(_0x5a6036){var _0x26dcc3=_[_0xf31a('0x95')](verticesWithRetry,_0x5a6036['agicommand'])?_0x5a6036:_[_0xf31a('0x96')](_0x5a6036);for(var _0x44e8dc in _0x26dcc3){if(_0x26dcc3[_0xf31a('0x97')](_0x44e8dc)){if(_0x26dcc3[_0x44e8dc]&&_['isString'](_0x26dcc3[_0x44e8dc])){if(_['includes'](recursiveMapAttributes,_0x44e8dc)){_0x26dcc3[_0x44e8dc]=this[_0xf31a('0x98')](_0x26dcc3[_0x44e8dc]);}else{_0x26dcc3[_0x44e8dc]=this['replaceAllVariables'](_0x26dcc3[_0x44e8dc]);}}}}return _0x26dcc3;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x99')]=function(_0x48c0f6){for(var _0x340d5a in _0x48c0f6){if(_0x48c0f6[_0xf31a('0x97')](_0x340d5a)){if(_[_0xf31a('0x9a')](_0x48c0f6[_0x340d5a])){this[_0xf31a('0x99')](_0x48c0f6[_0x340d5a]);}else if(_[_0xf31a('0x9b')](_0x48c0f6[_0x340d5a])){for(var _0x24de43=0x0;_0x24de43<_0x48c0f6[_0x340d5a][_0xf31a('0x9c')];_0x24de43++){this[_0xf31a('0x99')](_0x48c0f6[_0x340d5a][_0x24de43]);}}else if(_['isString'](_0x48c0f6[_0x340d5a])){_0x48c0f6[_0x340d5a]=this[_0xf31a('0x9d')](_0x48c0f6[_0x340d5a]);}}}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x9e')]=function(_0x5ae195,_0x47fa1e){for(var _0x44872a in _0x5ae195){if(_0x5ae195[_0xf31a('0x97')](_0x44872a)){if(_[_0xf31a('0x9a')](_0x5ae195[_0x44872a])){if(!_[_0xf31a('0x46')](_0x5ae195[_0x44872a])){this['saveRestApiResult'](_0x5ae195[_0x44872a],util[_0xf31a('0x29')]('%s.%s',_0x47fa1e,_0x44872a));}}else if(_[_0xf31a('0x9b')](_0x5ae195[_0x44872a])){for(var _0x1b9f29=0x0;_0x1b9f29<_0x5ae195[_0x44872a][_0xf31a('0x9c')];_0x1b9f29++){this[_0xf31a('0x9e')](_0x5ae195[_0x44872a][_0x1b9f29],util['format'](_0xf31a('0x9f'),_0x47fa1e,_0x44872a+'['+_0x1b9f29+']'));}}else{if(!_['isNil'](_0x5ae195[_0x44872a])){this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x9f'),_0x47fa1e,_0x44872a),_0x5ae195[_0x44872a]);}}}}};AGIVertices[_0xf31a('0xf')]['replaceObjectAllVariables']=function(_0x1a08bb){try{var _0x84220=JSON[_0xf31a('0x6a')](_0x1a08bb);this['recursiveNodeIndex'](_0x84220);return JSON[_0xf31a('0x72')](_0x84220);}catch(_0x1c5fc1){return this[_0xf31a('0x9d')](_0x1a08bb);}};AGIVertices[_0xf31a('0xf')]['replaceAllVariables']=function(_0x2adb41){var _0x2bb68e=_0x2adb41['split']('{');for(var _0x54de42=0x1;_0x54de42<_0x2bb68e['length'];_0x54de42+=0x1){var _0x24f3f2=_0x2bb68e[_0x54de42][_0xf31a('0xa1')]('}');if(_0x24f3f2[_0xf31a('0x9c')]>0x1){_0x2adb41=_0x2adb41[_0xf31a('0xa2')]('{'+_0x24f3f2[0x0]+'}',this[_0xf31a('0x3a')]['getVariable'](_0x24f3f2[0x0])[_0xf31a('0xa3')]||_0x24f3f2[0x0]);}}if(_0x2bb68e[_0xf31a('0x9c')]===0x1){return _0x2adb41[_0xf31a('0x4f')]();}return this['replaceAllVariables'](_0x2adb41);};AGIVertices[_0xf31a('0xf')][_0xf31a('0xa4')]=function(_0x1008c4,_0x109240){var _0x4c6cb0=this['channel']['getVariable'](_0x1008c4);if(_0x4c6cb0[_0xf31a('0xa5')]===-0x1){return _0x4c6cb0;}logger[_0xf31a('0x30')](util['format'](_0xf31a('0xa6'),_0x109240,_0x4c6cb0[_0xf31a('0xa3')]));return this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x109240,_0x4c6cb0['extra']);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x85')]=function(_0x15d0bf){return _0x15d0bf&&_0x15d0bf!=='0'&&_0x15d0bf!=='-1'&&_0x15d0bf!=='';};AGIVertices[_0xf31a('0xf')][_0xf31a('0xa7')]=function(_0x15702f){this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x15702f,'-');_0x15702f['retry']=_0x15702f[_0xf31a('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf31a('0xf')][_0xf31a('0xa8')]=function(_0x4a4945){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xa9'),_0x4a4945[_0xf31a('0x38')]));if(!this['isConfigured'](_0x4a4945[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}var _0x5fa7c9='\x22'+_0x4a4945['text']+'\x22';if(this['isConfigured'](_0x4a4945[_0xf31a('0x78')])){_0x5fa7c9+=','+_0x4a4945[_0xf31a('0x78')];}var _0x3a5582=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xac'),_0x5fa7c9);if(_0x3a5582[_0xf31a('0xa5')]===-0x1){return _0x3a5582;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xad'),_0x5fa7c9));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xae')]=function(_0x15ba20){logger['info'](util[_0xf31a('0x29')](_0xf31a('0xaf'),_0x15ba20[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x15ba20[_0xf31a('0xb0')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xb1'));}var _0x443594=_0x15ba20[_0xf31a('0xb0')];if(this[_0xf31a('0x85')](_0x15ba20[_0xf31a('0x78')])){_0x443594+=','+_0x15ba20['options'];}var _0x31dea5=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xb2'),_0x443594);if(_0x31dea5[_0xf31a('0xa5')]===-0x1){return _0x31dea5;}var _0x32837f=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xf31a('0xb3'));if(_0x32837f[_0xf31a('0xa5')]===-0x1){return _0x32837f;}var _0x589f59=this[_0xf31a('0xa4')](_0xf31a('0xb4'),_0xf31a('0xb5'));if(_0x589f59[_0xf31a('0xa5')]===-0x1){return _0x589f59;}var _0x537cf9=this[_0xf31a('0xa4')](_0xf31a('0xb6'),_0xf31a('0xb7'));if(_0x537cf9[_0xf31a('0xa5')]===-0x1){return _0x537cf9;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xb8'),_0x443594));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x6')]=function(_0xa357eb){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xb9'),_0xa357eb['label']));return this['channel'][_0xf31a('0x6')]([_0xa357eb['command'],_0xa357eb['args']]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0xba')]=function(_0x179f62){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xbb'),_0x179f62['label']));if(this[_0xf31a('0x85')](_0x179f62['timeout'])){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xbc'),_0x179f62[_0xf31a('0x65')]));var _0x3637c2=this['channel'][_0xf31a('0xbd')](_0x179f62[_0xf31a('0x65')]);if(_0x3637c2[_0xf31a('0xa5')]===-0x1){return _0x3637c2;}}return this[_0xf31a('0x3a')][_0xf31a('0xba')]();};AGIVertices['prototype'][_0xf31a('0xbe')]=function(_0x8cce99){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xbf'),_0x8cce99[_0xf31a('0x38')]));if(!this['isConfigured'](_0x8cce99['list_id'])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x8cce99,'no\x20list\x20selected');}_0x8cce99[_0xf31a('0x4d')]=moment();if(this[_0xf31a('0x85')](_0x8cce99[_0xf31a('0xc0')])){_0x8cce99[_0xf31a('0x4d')]=moment()[_0xf31a('0xc1')](_0x8cce99['delay'],_0xf31a('0xc2'));}if(!this['isConfigured'](_0x8cce99[_0xf31a('0x50')])){_0x8cce99[_0xf31a('0x50')]=0x2;}this['createCmContact'][_0xf31a('0x6e')](this,_0x8cce99);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0xc3'),_0x8cce99[_0xf31a('0x4b')],_0x8cce99['list_id'],_0x8cce99[_0xf31a('0x4d')]));};AGIVertices['prototype']['custom_app']=function(_0x3c8549){logger['info'](util[_0xf31a('0x29')](_0xf31a('0xc4'),_0x3c8549[_0xf31a('0x38')]));var _0x89fcd4=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0x3c8549['application'],_0x3c8549['options']);if(_0x89fcd4[_0xf31a('0xa5')]===-0x1){return _0x89fcd4;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0xc5'),_0x3c8549[_0xf31a('0xc6')],_0x3c8549[_0xf31a('0x78')]));};AGIVertices[_0xf31a('0xf')]['lumenvoxtts']=function(_0x476865){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xc7'),_0x476865[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x476865[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}var _0xc49c9f='\x22'+_0x476865['text']+'\x22';if(this[_0xf31a('0x85')](_0x476865['options'])){_0xc49c9f+=','+_0x476865[_0xf31a('0x78')];}var _0x246d4f=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xac'),_0xc49c9f);if(_0x246d4f[_0xf31a('0xa5')]===-0x1){return _0x246d4f;}return this['channel'][_0xf31a('0xaa')](util['format'](_0xf31a('0xad'),_0xc49c9f));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xc8')]=function(_0x519b33){logger['info'](util[_0xf31a('0x29')](_0xf31a('0xc9'),_0x519b33['label']));if(!this['isConfigured'](_0x519b33['text'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}var _0x17e99c='\x22'+_0x519b33[_0xf31a('0x5d')]+'\x22';if(this[_0xf31a('0x85')](_0x519b33[_0xf31a('0x78')])){_0x17e99c+=','+_0x519b33[_0xf31a('0x78')];}var _0x5d833a=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0xac'),_0x17e99c);if(_0x5d833a['result']===-0x1){return _0x5d833a;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xad'),_0x17e99c));};AGIVertices[_0xf31a('0xf')]['lumenvoxasr']=function(_0x45fac1){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x45fac1[_0xf31a('0x38')]));if(!this['isConfigured'](_0x45fac1[_0xf31a('0xb0')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xb1'));}var _0x742459=_0x45fac1[_0xf31a('0xb0')];if(this[_0xf31a('0x85')](_0x45fac1[_0xf31a('0x78')])){_0x742459+=','+_0x45fac1[_0xf31a('0x78')];}var _0x4bfd2f=this['channel'][_0xf31a('0x59')](_0xf31a('0xb2'),_0x742459);if(_0x4bfd2f[_0xf31a('0xa5')]===-0x1){return _0x4bfd2f;}var _0x111e1c=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xf31a('0xca'));if(_0x111e1c[_0xf31a('0xa5')]===-0x1){return _0x111e1c;}var _0x4ad44e=this['getAndSetVariable'](_0xf31a('0xb4'),_0xf31a('0xcb'));if(_0x4ad44e['result']===-0x1){return _0x4ad44e;}var _0x5853a2=this[_0xf31a('0xa4')](_0xf31a('0xb6'),_0xf31a('0xcc'));if(_0x5853a2[_0xf31a('0xa5')]===-0x1){return _0x5853a2;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xb8'),_0x742459));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xcd')]=function(_0x220e22){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xce'),_0x220e22[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x220e22['grammar'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xb1'));}var _0x18fd3a=_0x220e22[_0xf31a('0xb0')];if(this[_0xf31a('0x85')](_0x220e22[_0xf31a('0x78')])){_0x18fd3a+=','+_0x220e22['options'];}var _0x4dfd79=this['channel'][_0xf31a('0x59')](_0xf31a('0xb2'),_0x18fd3a);if(_0x4dfd79[_0xf31a('0xa5')]===-0x1){return _0x4dfd79;}var _0x4d7636=this[_0xf31a('0xa4')](_0xf31a('0xcf'),_0xf31a('0xd0'));if(_0x4d7636[_0xf31a('0xa5')]===-0x1){return _0x4d7636;}var _0x41a050=this[_0xf31a('0xa4')](_0xf31a('0xb4'),_0xf31a('0xd1'));if(_0x41a050[_0xf31a('0xa5')]===-0x1){return _0x41a050;}var _0x3b5e73=this[_0xf31a('0xa4')](_0xf31a('0xb6'),'SESTEK_ASR_INSTANCE');if(_0x3b5e73[_0xf31a('0xa5')]===-0x1){return _0x3b5e73;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xb8'),_0x18fd3a));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xd2')]=function(_0x464b28){logger[_0xf31a('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x464b28[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x464b28['odbc_id'])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x464b28,_0xf31a('0xd3'));}var _0xb6a6bf=this[_0xf31a('0x18')][_0xf31a('0x6e')](this,_0x464b28[_0xf31a('0xd4')]);if(!_0xb6a6bf){return this['channel']['error'](_0x464b28,_0xf31a('0xd5'));}if(!this[_0xf31a('0x85')](_0x464b28['query'])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x464b28,_0xf31a('0xd6'));}var _0x4b5097=_0x464b28['query'][_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xd7'),_0x4b5097));var _0x5a2e07=this[_0xf31a('0x2a')][_0xf31a('0x6e')](this,_0xb6a6bf,_0x4b5097);this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x464b28,_0x4b5097);if(!this['isConfigured'](_0x464b28[_0xf31a('0xd8')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18ffef=this[_0xf31a('0x10')]['sync'](this,_0x464b28['variable_id']);if(!_0x18ffef){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x464b28,_0xf31a('0xd9'));}var _0xee640c=this;_0x5a2e07['forEach'](function(_0xaa6e9c,_0x1ab500){Object[_0xf31a('0xda')](_0xaa6e9c)[_0xf31a('0xdb')](function(_0x446a40){_0xee640c['channel'][_0xf31a('0xa0')](util['format'](_0xf31a('0xdc'),_0x18ffef,_0x1ab500,_0x446a40),_0xaa6e9c[_0x446a40]);});});this['channel'][_0xf31a('0xa0')](util['format'](_0xf31a('0xdd'),_0x18ffef),_0x5a2e07[_0xf31a('0x9c')]);return this[_0xf31a('0x3a')]['noop'](util['format'](_0xf31a('0xde'),_0x18ffef));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xdf')]=function(_0x46ef98){logger['debug'](util['format'](_0xf31a('0xe0'),_0x46ef98[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x46ef98['sip_id'])){return this['channel'][_0xf31a('0x2c')](_0x46ef98,_0xf31a('0xe1'));}var _0x5a85bd=this['getUser'][_0xf31a('0x6e')](this,_0x46ef98[_0xf31a('0xe2')]);if(!_0x5a85bd){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x46ef98,_0xf31a('0xe3'));}var _0x3665f9=this['channel'][_0xf31a('0x59')](_0xf31a('0xe4'),[util[_0xf31a('0x29')](_0xf31a('0xe5'),_0x5a85bd),_0x46ef98[_0xf31a('0x65')],_0x46ef98[_0xf31a('0xe6')],_0x46ef98[_0xf31a('0x63')]]);if(_0x3665f9[_0xf31a('0xa5')]===-0x1){return _0x3665f9;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xe7'),_0xf31a('0xe4')));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xe8')]=function(_0x485b7e){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xe9'),_0x485b7e[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x485b7e[_0xf31a('0x79')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xea'));}if(!this['isConfigured'](_0x485b7e[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20text\x20configured');}this[_0xf31a('0x3a')][_0xf31a('0xeb')]=!![];this['createSquareDetailsReport'](_0x485b7e);this[_0xf31a('0x44')](_0x485b7e[_0xf31a('0x5d')],'in','','');this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xec'),_0x485b7e[_0xf31a('0x5d')]));var _0x29e6ef=this['googleDialogflow'][_0xf31a('0x6e')](this,_0x485b7e);if(_0x29e6ef){for(var _0x3cb272 in _0x29e6ef){if(_0x29e6ef[_0xf31a('0x97')](_0x3cb272)){this['channel'][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0xed'),_0x3cb272[_0xf31a('0x68')]()),_0x29e6ef[_0x3cb272]);}}this[_0xf31a('0x44')](_0x29e6ef[_0xf31a('0xee')],'out',_0xf31a('0xe8'),'');return this[_0xf31a('0x3a')]['noop'](util['format']('Dialogflow\x20Result\x20%s',_0x29e6ef[_0xf31a('0xee')]));}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x485b7e,_0xf31a('0xef'));};AGIVertices[_0xf31a('0xf')]['dialogflowV2']=function(_0x299697){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x299697[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0x7c')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xf0'));}if(!this[_0xf31a('0x85')](_0x299697['client_email'])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xf1'));}if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0x7e')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xf2'));}if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0xf3')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20anguage\x20configured');}if(!this[_0xf31a('0x85')](_0x299697[_0xf31a('0x5d')])){return this['channel']['noop'](_0xf31a('0xab'));}this['channel']['bot']=!![];this[_0xf31a('0x36')](_0x299697);this[_0xf31a('0x44')](_0x299697[_0xf31a('0x5d')],'in','','');this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0xf4'),_0x299697[_0xf31a('0x5d')]));var _0x4cabb4=this['googleDialogflowV2'][_0xf31a('0x6e')](this,_0x299697);if(_0x4cabb4){for(var _0x3dcfad in _0x4cabb4){if(_0x4cabb4[_0xf31a('0x97')](_0x3dcfad)){if(_0x3dcfad!=='providerResponse'){this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')]('DIALOGFLOW_%s',_0x3dcfad[_0xf31a('0x68')]()),_0x4cabb4[_0x3dcfad]);}}}this['createSquareMessage'](_0x4cabb4[_0xf31a('0xee')],_0xf31a('0xf5'),_0xf31a('0xf6'),_0x4cabb4['providerResponse']);return this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')]('DialogflowV2\x20Result\x20%s',_0x4cabb4['speech']));}return this[_0xf31a('0x3a')]['error'](_0x299697,_0xf31a('0xf7'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0xf8')]=function(_0x5bcf58){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0xf9'),_0x5bcf58[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x5bcf58[_0xf31a('0xfa')])){return this['channel'][_0xf31a('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xf31a('0x85')](_0x5bcf58[_0xf31a('0xfb')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xfc'));}if(!this['isConfigured'](_0x5bcf58['password'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xfd'));}if(!this[_0xf31a('0x85')](_0x5bcf58[_0xf31a('0xfe')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xab'));}this[_0xf31a('0x3a')][_0xf31a('0xeb')]=!![];this[_0xf31a('0x36')](_0x5bcf58);this[_0xf31a('0x44')](_0x5bcf58['text'],'in','','');this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xff'),_0x5bcf58['text']));var _0x459b01=this['sestekNDA'][_0xf31a('0x6e')](this,_0x5bcf58);if(_0x459b01){for(var _0x4a9818 in _0x459b01){if(_0x459b01[_0xf31a('0x97')](_0x4a9818)){this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x100'),_0x4a9818[_0xf31a('0x68')]()),_0x459b01[_0x4a9818]);}}this[_0xf31a('0x44')](_0x459b01['speech'],'out','sesteknda','');if(_0x459b01[_0xf31a('0x101')]){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x102'),_0x459b01[_0xf31a('0x101')]));var _0x194566=this[_0xf31a('0x3a')][_0xf31a('0x103')](_0x459b01[_0xf31a('0x101')]);try{fs['unlink'](_0x459b01[_0xf31a('0x101')]+_0xf31a('0x104'));}catch(_0x587685){logger['error'](_0x587685);}return _0x194566;}else{return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('SestekNDA\x20Result\x20%s',_0x459b01[_0xf31a('0xee')]));}}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x5bcf58,_0xf31a('0x105'));};AGIVertices[_0xf31a('0xf')]['end']=function(_0x102b28){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x106'),_0x102b28[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x107'));};AGIVertices[_0xf31a('0xf')]['ext_dial']=function(_0x53ea86){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x108'),_0x53ea86[_0xf31a('0x38')]));var _0x225b0b='';if(_0x53ea86['trunk_id']){if(!this[_0xf31a('0x85')](_0x53ea86[_0xf31a('0x109')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x53ea86,_0xf31a('0x10a'));}else{var _0x3a5b8e=parseInt(_0x53ea86['trunk_id'],0xa);if(isNaN(_0x3a5b8e)){_0x225b0b=_0x53ea86[_0xf31a('0x109')];}else{_0x225b0b=this[_0xf31a('0x1a')][_0xf31a('0x6e')](this,_0x53ea86[_0xf31a('0x109')]);if(!_0x225b0b){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x53ea86,_0xf31a('0x10b'));}}}}else if(_0x53ea86['trunk_name']){_0x225b0b=_0x53ea86[_0xf31a('0x10c')];}else{return this[_0xf31a('0x3a')]['error'](_0x53ea86,_0xf31a('0x10a'));}var _0x28a62b=this['channel']['exec'](_0xf31a('0xe4'),[util[_0xf31a('0x29')](_0xf31a('0x10d'),_0x225b0b,_0x53ea86['phone']),_0x53ea86[_0xf31a('0x65')],_0x53ea86['opts'],_0x53ea86[_0xf31a('0x63')]]);if(_0x28a62b[_0xf31a('0xa5')]===-0x1){return _0x28a62b;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xe7'),_0xf31a('0xe4')));};AGIVertices['prototype']['finally']=function(_0x34693f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x10e'),_0x34693f['label']));return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x10f'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x110')]=function(_0x24e01e){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x111'),_0x24e01e[_0xf31a('0x38')]));if(_0x24e01e[_0xf31a('0x112')]===0x0){return this[_0xf31a('0xa7')](_0x24e01e);}_0x24e01e[_0xf31a('0x112')]-=0x1;if(!this[_0xf31a('0x85')](_0x24e01e[_0xf31a('0x113')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x24e01e,_0xf31a('0x114'));}var _0x1735fa=this[_0xf31a('0x1c')][_0xf31a('0x6e')](this,_0x24e01e[_0xf31a('0x113')]);if(!_0x1735fa){return this[_0xf31a('0x3a')]['error'](_0x24e01e,_0xf31a('0x115'));}if(!this[_0xf31a('0x85')](_0x24e01e['variable_id'])){return this['channel'][_0xf31a('0x2c')](_0xf31a('0x116'));}var _0x3563aa=this[_0xf31a('0x3a')][_0xf31a('0x117')](_0x1735fa,_0x24e01e[_0xf31a('0x118')],_0x24e01e[_0xf31a('0x119')]);var _0x4a79c6=_0x3563aa['result']?_0x3563aa[_0xf31a('0xa5')][_0xf31a('0x4f')]():'';logger[_0xf31a('0x30')](_0xf31a('0x11a'),JSON[_0xf31a('0x72')](_0x3563aa));if(_0x3563aa[_0xf31a('0xa5')]===-0x1){this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x24e01e,_0x4a79c6);return _0x3563aa;}else if(_0x3563aa[_0xf31a('0xa3')]===_0xf31a('0x65')){_0x3563aa[_0xf31a('0xa5')]=_0x4a79c6['length']>=parseInt(_0x24e01e[_0xf31a('0x11b')])?'x':'i';}else{_0x3563aa[_0xf31a('0xa5')]=_0x4a79c6['length']>=parseInt(_0x24e01e[_0xf31a('0x11b')])&&_0x4a79c6[_0xf31a('0x9c')]<=parseInt(_0x24e01e[_0xf31a('0x119')])?'x':'i';}var _0x4191bf=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x24e01e[_0xf31a('0xd8')]);if(!_0x4191bf){return this['channel'][_0xf31a('0x2c')](_0x24e01e,_0xf31a('0xd9'));}this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x4191bf,_0x4a79c6);if(this[_0xf31a('0x85')](_0x24e01e[_0xf31a('0x11c')])){var _0x6f634f=parseInt(_0x24e01e[_0xf31a('0x11c')],0xa);var _0x43eff1=rs[_0xf31a('0x11d')]({'charset':'*','length':_0x6f634f});var _0x28b525=_0x4a79c6[_0xf31a('0x9c')];if(_0x28b525>0x0){if(_0x28b525>_0x6f634f){this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x24e01e,_0x24e01e[_0xf31a('0x11e')]===_0xf31a('0x11f')?_0x43eff1+_0x4a79c6[_0xf31a('0x120')](_0x6f634f):_0x4a79c6['substr'](0x0,_0x28b525-_0x6f634f)+_0x43eff1);}else{this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x24e01e,rs[_0xf31a('0x11d')]({'charset':'*','length':_0x28b525}));}}else{this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x24e01e,'');}}else{this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x24e01e,_0x4a79c6);}return _0x3563aa;};AGIVertices[_0xf31a('0xf')][_0xf31a('0xc')]=function(_0x46adac){logger[_0xf31a('0x30')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x46adac[_0xf31a('0x38')]));return this['getdigits'](_0x46adac);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x121')]=function(_0x3fc459){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x122'),_0x3fc459[_0xf31a('0x38')]));this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x3fc459,_0x3fc459[_0xf31a('0x123')]);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x124'),_0x3fc459[_0xf31a('0x123')]));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x125')]=function(_0x3a5748){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x126'),_0x3a5748[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x3a5748['aws_access_key_id'])||!this['isConfigured'](_0x3a5748[_0xf31a('0x88')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x127'));}if(!this[_0xf31a('0x85')](_0x3a5748[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xab'));}this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('Trying\x20aws\x20Polly\x20%s',_0x3a5748['text']));var _0x1381b7=this[_0xf31a('0x87')][_0xf31a('0x6e')](this,_0x3a5748);if(_0x1381b7){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x1381b7));var _0x3165a3=this['channel'][_0xf31a('0x103')](_0x1381b7);try{fs[_0xf31a('0x128')](_0x1381b7+_0xf31a('0x104'));}catch(_0x4db0ca){logger[_0xf31a('0x2c')](_0x4db0ca);}return _0x3165a3;}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x3a5748,_0xf31a('0x129'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x12a')]=function(_0x67e4c8){logger['info'](util['format'](_0xf31a('0x12b'),_0x67e4c8[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x67e4c8[_0xf31a('0x8d')])||!this['isConfigured'](_0x67e4c8[_0xf31a('0x88')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0x127'));}if(!this[_0xf31a('0x85')](_0x67e4c8[_0xf31a('0x8f')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x12c'));}if(!this[_0xf31a('0x85')](_0x67e4c8[_0xf31a('0x5d')])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xab'));}this['channel'][_0xf31a('0xeb')]=!![];this[_0xf31a('0x36')](_0x67e4c8);this[_0xf31a('0x44')](_0x67e4c8[_0xf31a('0x5d')],'in','','');this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')]('Trying\x20Amazon\x20Lex:\x20%s',_0x67e4c8[_0xf31a('0x5d')]));var _0x531ad4=this['awsLex'][_0xf31a('0x6e')](this,_0x67e4c8);if(_0x531ad4){for(var _0x50bb77 in _0x531ad4){if(_0x531ad4[_0xf31a('0x97')](_0x50bb77)&&_['isString'](_0x531ad4[_0x50bb77])){this['channel'][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x12d'),_0x50bb77[_0xf31a('0x68')]()),_0x531ad4[_0x50bb77]);}}if(_[_0xf31a('0x47')](_0x531ad4[_0xf31a('0x76')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x12e'));}else{this[_0xf31a('0x44')](_0x531ad4[_0xf31a('0x76')],_0xf31a('0xf5'),_0xf31a('0x12f'),'');return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x531ad4[_0xf31a('0x76')]));}}return this[_0xf31a('0x3a')]['error'](_0x67e4c8,_0xf31a('0x130'));};AGIVertices[_0xf31a('0xf')]['googleasr']=function(_0x886812){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x131'),_0x886812['label'],_0x886812['timeout']));if(!this[_0xf31a('0x85')](_0x886812[_0xf31a('0x79')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xea'));}var _0x84479f=_0xf31a('0x132');var _0x1dc508=util['format'](_0xf31a('0x133'),FILES_PATH,rs[_0xf31a('0x11d')](0x4));var _0x129676=util[_0xf31a('0x29')](_0xf31a('0x9f'),_0x1dc508,_0x84479f);var _0x8ea211=!![];if(_0x886812['beep']===_0xf31a('0x134')){_0x8ea211=![];}var _0x3f15c0=this[_0xf31a('0x3a')]['recordFile'](_0x1dc508,_0x84479f,_0x886812[_0xf31a('0x135')],_0x886812[_0xf31a('0x65')],undefined,_0x8ea211);if(_0x3f15c0[_0xf31a('0xa5')]!==-0x1){this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x136'),_0x129676));var _0xf62ad7=this[_0xf31a('0x90')]['sync'](this,_0x886812,_0x129676);if(_0xf62ad7){for(var _0x511a35 in _0xf62ad7){if(_0xf62ad7[_0xf31a('0x97')](_0x511a35)){this['channel']['setVariable'](util[_0xf31a('0x29')](_0xf31a('0x137'),_0x511a35[_0xf31a('0x68')]()),_0xf62ad7[_0x511a35]);}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x138'),JSON['stringify'](_0xf62ad7)));}}return _0x3f15c0;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x139')]=function(_0x5512ca){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x13a'),_0x5512ca['label']));if(!this['isConfigured'](_0x5512ca[_0xf31a('0x92')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x13b'));}if(!this['isConfigured'](_0x5512ca[_0xf31a('0x93')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x13c'));}var _0xf9267b=_0xf31a('0x132');var _0xb9e2b3=util[_0xf31a('0x29')](_0xf31a('0x133'),FILES_PATH,rs['generate'](0x4));var _0x3a2b4f=util[_0xf31a('0x29')]('%s.%s',_0xb9e2b3,_0xf9267b);var _0x5e2c5b=!![];if(_0x5512ca['beep']===_0xf31a('0x134')){_0x5e2c5b=![];}var _0x215363=this[_0xf31a('0x3a')][_0xf31a('0x13d')](_0xb9e2b3,_0xf9267b,_0x5512ca[_0xf31a('0x135')],_0x5512ca['timeout'],undefined,_0x5e2c5b);if(_0x215363[_0xf31a('0xa5')]!==-0x1){this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x13e'),_0x3a2b4f));var _0x2fd020=this[_0xf31a('0x13f')][_0xf31a('0x6e')](this,_0x5512ca,_0x3a2b4f);if(_0x2fd020){for(var _0x2f0da1 in _0x2fd020){if(_0x2fd020[_0xf31a('0x97')](_0x2f0da1)){this['channel'][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x140'),_0x2f0da1['toUpperCase']()),_0x2fd020[_0x2f0da1]);}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x141'),JSON[_0xf31a('0x72')](_0x2fd020)));}}return _0x215363;};AGIVertices[_0xf31a('0xf')][_0xf31a('0x142')]=function(_0x58e32b){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x143'),_0x58e32b['label']));return this[_0xf31a('0x3a')][_0xf31a('0x144')](_0x58e32b[_0xf31a('0x3f')],_0x58e32b[_0xf31a('0x40')],_0x58e32b[_0xf31a('0x41')]);};AGIVertices['prototype']['gotoif']=function(_0xffbaf5){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x145'),_0xffbaf5[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0xffbaf5[_0xf31a('0x146')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0xffbaf5,'no\x20condition\x20configured');}try{var _0x26f96e=eval(_0xffbaf5[_0xf31a('0x146')])?_0xf31a('0x147'):_0xf31a('0x148');this['channel'][_0xf31a('0xaa')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0xffbaf5['condition'],_0x26f96e));return{'code':0xc8,'result':_0x26f96e};}catch(_0x28adf3){return{'code':0xc8,'result':_0xf31a('0x148')};}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x149')]=function(_0x21be35){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x14a'),_0x21be35[_0xf31a('0x38')]));if(!this['isConfigured'](_0x21be35[_0xf31a('0x14b')])){return this[_0xf31a('0x3a')]['error'](_0x21be35,'no\x20interval\x20configured');}var _0x3307c8=this['getIntervals'][_0xf31a('0x6e')](this,_0x21be35['interval_id']);if(!_0x3307c8){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x21be35,_0xf31a('0x14c'));}for(var _0x30fa6b=0x0;_0x30fa6b<_0x3307c8[_0xf31a('0x9c')];_0x30fa6b+=0x1){var _0x272237=this[_0xf31a('0x3a')][_0xf31a('0x10')](util[_0xf31a('0x29')](_0xf31a('0x14d'),_0x3307c8[_0x30fa6b]));if(_0x272237[_0xf31a('0xa5')]===-0x1){return _0x272237;}logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0x272237['extra']));if(_0x272237[_0xf31a('0xa3')]===_0xf31a('0x147')){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('IFTIME\x20%s\x20%s',_0x3307c8[_0x30fa6b],_0xf31a('0x147')));this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0xf31a('0x147')));return{'code':0xc8,'result':_0xf31a('0x147')};}else{logger['info'](util[_0xf31a('0x29')](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0xf31a('0x148')));this[_0xf31a('0x3a')][_0xf31a('0xaa')](util['format'](_0xf31a('0x14e'),_0x3307c8[_0x30fa6b],_0xf31a('0x148')));}}return{'code':0xc8,'result':_0xf31a('0x148')};};AGIVertices[_0xf31a('0xf')][_0xf31a('0x14f')]=function(_0x5c1261){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x150'),_0x5c1261[_0xf31a('0x38')]));return this[_0xf31a('0x3a')]['hangup']();};AGIVertices[_0xf31a('0xf')]['ispeechasr']=function(_0x2051b8){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x151'),_0x2051b8['label']));if(!this[_0xf31a('0x85')](_0x2051b8[_0xf31a('0x79')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0xea'));}var _0xb15a4=_0xf31a('0x132');var _0x40350d=util[_0xf31a('0x29')](_0xf31a('0x133'),FILES_PATH,rs[_0xf31a('0x11d')](0x4));var _0x183cad=util[_0xf31a('0x29')](_0xf31a('0x9f'),_0x40350d,_0xb15a4);var _0x5d710d=!![];if(_0x2051b8[_0xf31a('0x152')]===_0xf31a('0x134')){_0x5d710d=![];}var _0x490c16=this[_0xf31a('0x3a')][_0xf31a('0x13d')](_0x40350d,_0xb15a4,_0x2051b8[_0xf31a('0x135')],_0x2051b8[_0xf31a('0x65')],undefined,_0x5d710d);if(_0x490c16[_0xf31a('0xa5')]!==-0x1){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x153'),_0x183cad));var _0x29b2f3=this[_0xf31a('0x82')]['sync'](this,_0x2051b8,_0x183cad);if(_0x29b2f3){for(var _0x36c8e7 in _0x29b2f3){if(_0x29b2f3[_0xf31a('0x97')](_0x36c8e7)){this[_0xf31a('0x3a')]['setVariable'](util['format'](_0xf31a('0x154'),_0x36c8e7['toUpperCase']()),_0x29b2f3[_0x36c8e7]);}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x155'),JSON['stringify'](_0x29b2f3)));}}return _0x490c16;};AGIVertices['prototype'][_0xf31a('0x156')]=function(_0x3cfe88){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3cfe88[_0xf31a('0x38')]));if(!this['isConfigured'](_0x3cfe88[_0xf31a('0x79')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0xea'));}if(!this[_0xf31a('0x85')](_0x3cfe88['text'])){return this[_0xf31a('0x3a')]['noop'](_0xf31a('0xab'));}this['channel'][_0xf31a('0xaa')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x3cfe88[_0xf31a('0x5d')]));var _0x3119c8=this['ispeechTTS'][_0xf31a('0x6e')](this,_0x3cfe88);if(_0x3119c8){this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x153'),_0x3119c8));var _0x28ab2b=this[_0xf31a('0x3a')]['streamFile'](_0x3119c8,_0x3cfe88[_0xf31a('0x135')]);try{fs[_0xf31a('0x128')](_0x3119c8+'.wav');}catch(_0x10b685){logger[_0xf31a('0x2c')](_0x10b685);}return _0x28ab2b;}return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x3cfe88,_0xf31a('0x157'));};AGIVertices['prototype']['login']=function(_0x4d45cc){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x158'),_0x4d45cc[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x4d45cc[_0xf31a('0x159')])){return this[_0xf31a('0x3a')]['error'](_0x4d45cc,_0xf31a('0x15a'));}logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15b'),this[_0xf31a('0x3a')]['callerid'],_0x4d45cc[_0xf31a('0x159')]));var _0x50fdac=this['agentLogin'][_0xf31a('0x6e')](this,_0x4d45cc[_0xf31a('0x159')]);if(_0x50fdac){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x15c'),this[_0xf31a('0x3a')]['callerid'],_0x4d45cc[_0xf31a('0x159')]));this['channel']['noop'](util['format'](_0xf31a('0x15c'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x4d45cc['findBy']));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util['format'](_0xf31a('0x15e'),this['channel'][_0xf31a('0x3c')],_0x4d45cc['findBy']));this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf31a('0x3a')]['callerid'],_0x4d45cc[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15f')};}};AGIVertices[_0xf31a('0xf')]['logout']=function(_0x21f4fa){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x160'),_0x21f4fa[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x21f4fa[_0xf31a('0x159')])){return this[_0xf31a('0x3a')]['error'](_0x21f4fa,_0xf31a('0x15a'));}logger['info'](util[_0xf31a('0x29')](_0xf31a('0x15b'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x21f4fa[_0xf31a('0x159')]));var _0x40cba5=this[_0xf31a('0x55')][_0xf31a('0x6e')](this,_0x21f4fa[_0xf31a('0x159')]);if(_0x40cba5){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x15c'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x21f4fa['findBy']));this[_0xf31a('0x3a')]['noop'](util['format'](_0xf31a('0x15c'),this['channel'][_0xf31a('0x3c')],_0x21f4fa[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15e'),this['channel'][_0xf31a('0x3c')],_0x21f4fa[_0xf31a('0x159')]));this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x21f4fa['findBy']));return{'code':0xc8,'result':_0xf31a('0x15f')};}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x161')]=function(_0x1558f3){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x162'),_0x1558f3[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x1558f3[_0xf31a('0x163')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x1558f3,_0xf31a('0x164'));}this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x165'),_0x1558f3[_0xf31a('0x163')]));var _0x2cb546=eval(_0x1558f3[_0xf31a('0x163')]);if(!this['isConfigured'](_0x1558f3[_0xf31a('0xd8')])){return this['channel'][_0xf31a('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x19e610=this['getVariable'][_0xf31a('0x6e')](this,_0x1558f3[_0xf31a('0xd8')]);if(!_0x19e610){return this[_0xf31a('0x3a')]['error'](_0x1558f3,_0xf31a('0xd9'));}if(_[_0xf31a('0x9b')](_0x2cb546)){var _0x2ef83a=this;_0x2cb546['forEach'](function(_0x459ca3,_0x410a61){_0x2ef83a[_0xf31a('0x3a')][_0xf31a('0xa0')](util['format']('%s[%s]',_0x19e610,_0x410a61),_0x459ca3);});return this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x166'),_0x19e610));}else{return this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x19e610,_0x2cb546);}};AGIVertices['prototype'][_0xf31a('0xb')]=function(_0x31615d){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x167'),_0x31615d[_0xf31a('0x38')]));if(_0x31615d['retry']===0x0){return this[_0xf31a('0xa7')](_0x31615d);}_0x31615d[_0xf31a('0x112')]-=0x1;if(!this[_0xf31a('0x85')](_0x31615d[_0xf31a('0x113')])){return this['channel'][_0xf31a('0x2c')](_0x31615d,_0xf31a('0x114'));}var _0x2b156c=this[_0xf31a('0x1c')][_0xf31a('0x6e')](this,_0x31615d[_0xf31a('0x113')]);if(!_0x2b156c){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x31615d,'no\x20file\x20audio\x20found');}var _0x2e2369=this[_0xf31a('0x3a')]['getData'](_0x2b156c,_0x31615d[_0xf31a('0x118')],_0x31615d['digit']);var _0x1933c4=_0x2e2369['result'];if(_0x2e2369['result']===-0x1){this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x31615d,'-1');return _0x2e2369;}else if(_0x2e2369[_0xf31a('0xa3')]==='timeout'){_0x2e2369[_0xf31a('0xa5')]=_0x2e2369[_0xf31a('0xa5')]['length']>0x0?_0x2e2369[_0xf31a('0xa5')]:'t';}else if(_[_0xf31a('0x46')](_0x2e2369[_0xf31a('0xa5')])){_0x2e2369[_0xf31a('0xa5')]='#';_0x1933c4='#';}if(!this[_0xf31a('0x85')](_0x31615d['variable_id'])){this['channel'][_0xf31a('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x18de39=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x31615d['variable_id']);if(!_0x18de39){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x31615d,_0xf31a('0xd9'));}this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0x18de39,_0x1933c4);}this[_0xf31a('0x36')]['sync'](this,_0x31615d,_0x1933c4);return _0x2e2369;};AGIVertices[_0xf31a('0xf')][_0xf31a('0xaa')]=function(_0x2618f7){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x168'),_0x2618f7[_0xf31a('0x38')]));return this['channel']['noop'](_0x2618f7[_0xf31a('0x169')]||_0x2618f7[_0xf31a('0x38')]);};AGIVertices['prototype'][_0xf31a('0x16a')]=function(_0x2693c9){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x16b'),_0x2693c9[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x2693c9[_0xf31a('0x159')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x2693c9,_0xf31a('0x15a'));}logger[_0xf31a('0x30')](util['format'](_0xf31a('0x15b'),this[_0xf31a('0x3a')]['callerid'],_0x2693c9[_0xf31a('0x159')]));var _0x5412da=this[_0xf31a('0x51')]['sync'](this,_0x2693c9[_0xf31a('0x16c')]);var _0x1aa5dd=this[_0xf31a('0x52')][_0xf31a('0x6e')](this,_0x2693c9[_0xf31a('0x159')],_0x5412da);if(_0x1aa5dd){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf31a('0x3a')]['callerid'],_0x2693c9['findBy']));this['channel'][_0xf31a('0xaa')](util['format'](_0xf31a('0x15c'),this['channel']['callerid'],_0x2693c9[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15e'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x2693c9[_0xf31a('0x159')]));this['channel'][_0xf31a('0xaa')](util['format'](_0xf31a('0x15c'),this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x2693c9[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15f')};}};AGIVertices['prototype']['playback']=function(_0x66ee66){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x16d'),_0x66ee66['label']));if(!this['isConfigured'](_0x66ee66['file_id'])){return this[_0xf31a('0x3a')]['error'](_0x66ee66,_0xf31a('0x114'));}var _0x3e5147=this[_0xf31a('0x1c')]['sync'](this,_0x66ee66[_0xf31a('0x113')]);if(!_0x3e5147){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x66ee66,_0xf31a('0x115'));}var _0x128e6c=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0x16e'),[_0x3e5147,_0x66ee66[_0xf31a('0xe6')]]);if(_0x128e6c['result']===-0x1){return _0x128e6c;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('Executed\x20command\x20%s\x20%s',_0xf31a('0x16e'),_0x3e5147));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x16f')]=function(_0x59caf0){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x59caf0[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x59caf0[_0xf31a('0x170')])){return this['channel'][_0xf31a('0x2c')](_0x59caf0,_0xf31a('0x171'));}var _0x23708e='';var _0x309517=parseInt(_0x59caf0[_0xf31a('0x170')],0xa);if(isNaN(_0x309517)){_0x23708e=_0x59caf0['queue_id'];}else{_0x23708e=this[_0xf31a('0x14')][_0xf31a('0x6e')](this,_0x59caf0['queue_id']);if(!_0x23708e){return this['channel'][_0xf31a('0x2c')](_0x59caf0,_0xf31a('0x172'));}}var _0x4fb692='';if(this[_0xf31a('0x85')](_0x59caf0[_0xf31a('0x113')])){var _0x1a7e26=this[_0xf31a('0x1c')][_0xf31a('0x6e')](this,_0x59caf0[_0xf31a('0x113')]);if(_0x1a7e26){_0x4fb692=_0x1a7e26;}}this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x59caf0,_0x23708e);if(_0x59caf0[_0xf31a('0xe6')][_0xf31a('0x173')]('x')<0x0){_0x59caf0[_0xf31a('0xe6')]+='x';}if(_0x59caf0['opts']['indexOf']('X')<0x0){_0x59caf0[_0xf31a('0xe6')]+='X';}this[_0xf31a('0x3a')]['setVariable'](_0xf31a('0x174'),_0x23708e?_0x23708e[_0xf31a('0x175')]():'');var _0x569ebc=this[_0xf31a('0x3a')][_0xf31a('0x59')](_0xf31a('0x176'),[_0x23708e,_0x59caf0[_0xf31a('0xe6')],_0x59caf0[_0xf31a('0x63')],_0x4fb692,_0x59caf0[_0xf31a('0x65')],_0x59caf0[_0xf31a('0x6')],_0x59caf0[_0xf31a('0x177')],_0x59caf0[_0xf31a('0x178')],'',_0x59caf0[_0xf31a('0x179')]]);if(_0x569ebc[_0xf31a('0xa5')]===-0x1){return _0x569ebc;}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0xc5'),_0xf31a('0x176'),_0x23708e));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x17a')]=function(_0x5b6262){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x17b'),_0x5b6262['label']));var _0x9731aa=_0x5b6262[_0xf31a('0x17c')]||_0xf31a('0x132');var _0x4f3510=util['format'](_0xf31a('0x17d'),this[_0xf31a('0x3a')]['uniqueid'],rs[_0xf31a('0x11d')](0x5));var _0x94a2cc=util[_0xf31a('0x29')](_0xf31a('0x17e'),FILES_PATH,_0x4f3510,_0x9731aa);var _0x1099a6=util[_0xf31a('0x29')](_0xf31a('0x133'),FILES_PATH,_0x4f3510);this[_0xf31a('0x3d')][_0xf31a('0x6e')](this,_0x5b6262,_0x4f3510,_0x94a2cc);this['channel'][_0xf31a('0xa0')](_0xf31a('0x17f'),_0x4f3510);logger[_0xf31a('0x30')](_0xf31a('0x180'),_0x1099a6,_0x9731aa,_0x5b6262[_0xf31a('0x181')],_0x5b6262[_0xf31a('0x65')]);return this['channel'][_0xf31a('0x13d')](_0x1099a6,_0x9731aa,_0x5b6262['escape_digits'],_0x5b6262[_0xf31a('0x65')],undefined,!![]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x182')]=function(_0x34e20e){logger['info'](util['format'](_0xf31a('0x183'),_0x34e20e['label']));if(!this[_0xf31a('0x85')](_0x34e20e[_0xf31a('0x63')])){return this['channel']['noop'](_0xf31a('0x184'));}var _0x2488c8=this[_0xf31a('0x62')]['sync'](this,_0x34e20e);logger['info'](util[_0xf31a('0x29')](_0xf31a('0x185'),util[_0xf31a('0x186')](_0x2488c8,{'showHidden':![],'depth':null})));if(!this[_0xf31a('0x85')](_0x34e20e[_0xf31a('0xd8')])){return this['channel'][_0xf31a('0xaa')](_0xf31a('0x187'));}var _0x45dc76=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x34e20e[_0xf31a('0xd8')]);if(!_0x45dc76){return this['channel'][_0xf31a('0x2c')](_0x34e20e,_0xf31a('0xd9'));}this[_0xf31a('0x3a')][_0xf31a('0xa0')](util[_0xf31a('0x29')](_0xf31a('0x188'),_0x45dc76),_0x2488c8[_0xf31a('0x74')]?_0x2488c8['statusCode']:_0xf31a('0x189'));this[_0xf31a('0x3a')]['setVariable'](util[_0xf31a('0x29')]('%s_STATUS_MESSAGE',_0x45dc76),_0x2488c8[_0xf31a('0x75')]?_0x2488c8[_0xf31a('0x75')]:'OK');if(_0x2488c8[_0xf31a('0x69')]){try{this['saveRestApiResult'](_0x2488c8[_0xf31a('0x69')],_0x45dc76);}catch(_0x109201){logger[_0xf31a('0x2c')](util[_0xf31a('0x29')](_0xf31a('0x18a'),_0x45dc76));}}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xde'),_0x45dc76));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x18b')]=function(_0x4c7384){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x18c'),_0x4c7384[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0x18d')](_0x4c7384['digits']['replace'](/\s+/g,''),_0x4c7384['escape_digits']);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x18e')]=function(_0x15d31b){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x18f'),_0x15d31b[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0x190')](_0x15d31b[_0xf31a('0x66')][_0xf31a('0x5a')](/\s+/g,''),_0x15d31b['escape_digits']);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x191')]=function(_0x39cc18){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x192'),_0x39cc18[_0xf31a('0x38')]));return this[_0xf31a('0x3a')][_0xf31a('0x193')](_0x39cc18[_0xf31a('0x5d')],_0x39cc18[_0xf31a('0x181')]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x194')]=function(_0x440ba7){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x195'),_0x440ba7['label']));if(!this['isConfigured'](_0x440ba7[_0xf31a('0x196')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x197'));}var _0x418d07=this[_0xf31a('0x20')]['sync'](this,_0x440ba7[_0xf31a('0x196')]);if(!_0x418d07||!_0x418d07[_0xf31a('0x198')]){return this['channel'][_0xf31a('0x2c')](_0x440ba7,_0xf31a('0x199'));}var _0x557249={'from':util[_0xf31a('0x29')](_0xf31a('0x19a'),_0x418d07[_0xf31a('0x16')],_0x418d07[_0xf31a('0x19b')]||_0x418d07[_0xf31a('0x198')]['user']),'to':_0x440ba7['to']||'','cc':_0x440ba7['cc']||'','bcc':_0x440ba7['bcc']||'','subject':_0x440ba7[_0xf31a('0x19c')],'html':_0x440ba7[_0xf31a('0x5d')],'text':_0x440ba7[_0xf31a('0x5d')]};if(this[_0xf31a('0x85')](_0x440ba7[_0xf31a('0x19d')])){}logger['debug'](_0xf31a('0x19e'),JSON[_0xf31a('0x72')](_0x557249));this[_0xf31a('0x36')]['sync'](this,_0x440ba7,_0x440ba7[_0xf31a('0x196')]);this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x19f'),_0x418d07[_0xf31a('0x16')]));this[_0xf31a('0x22')][_0xf31a('0x6e')](this,_0x418d07['smtpOptions'],_0x557249);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1a0'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1a1')]=function(_0x569a6b){logger['info'](util['format'](_0xf31a('0x1a2'),_0x569a6b['label']));return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1a3'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1a4')]=function(_0x296075){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1a5'),_0x296075[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x296075[_0xf31a('0x1a6')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1a7'));}var _0x3cd5ac=this['getSmsAccount'][_0xf31a('0x6e')](this,_0x296075[_0xf31a('0x1a6')]);if(!_0x3cd5ac){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x296075,'no\x20sms\x20account\x20found');}var _0x514362={'body':_0x296075[_0xf31a('0x1a8')],'phone':_0x296075['to']||'','SmsAccountId':_0x3cd5ac['id']};logger[_0xf31a('0x1a9')]('sendSMS\x20message',JSON['stringify'](_0x514362));this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x296075,_0x296075['sms_account_id']);this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1aa'),_0x3cd5ac['name']));this[_0xf31a('0x35')][_0xf31a('0x6e')](this,_0x514362);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1ab'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1ac')]=function(_0x2ae0e0){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1ad'),_0x2ae0e0[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x2ae0e0[_0xf31a('0xd8')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x2ae0e0,_0xf31a('0x1ae'));}var _0x8e81dc=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x2ae0e0[_0xf31a('0xd8')]);if(!_0x8e81dc){return this[_0xf31a('0x3a')]['error'](_0x2ae0e0,_0xf31a('0xd9'));}return this[_0xf31a('0x3a')]['setVariable'](_0x8e81dc,_0x2ae0e0[_0xf31a('0x1af')]);};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1b0')]=function(_0x5bbccd){logger[_0xf31a('0x30')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x5bbccd[_0xf31a('0x38')]));this[_0xf31a('0x3a')]['noop'](_0xf31a('0x1b1'));var _0x1192f3=this[_0xf31a('0x3a')][_0xf31a('0x10')](_0xf31a('0x1b2'));if(!_['isEmpty'](_0x1192f3['extra'])){this['channel'][_0xf31a('0x37')]=_0x1192f3['extra'];}if(_0x5bbccd[_0xf31a('0xba')]===_0xf31a('0x1b3')){this[_0xf31a('0x3a')][_0xf31a('0xaa')]('Answer');return this[_0xf31a('0x3a')][_0xf31a('0xba')]();}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1b4'));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1b5')]=function(_0x294cf8){logger[_0xf31a('0x30')](util['format'](_0xf31a('0x1b6'),_0x294cf8[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x294cf8[_0xf31a('0x1b7')])){return this[_0xf31a('0x3a')]['error'](_0x294cf8,_0xf31a('0x1b8'));}var _0x42ffd6=this[_0xf31a('0x17')][_0xf31a('0x6e')](this,_0x294cf8[_0xf31a('0x1b7')]);if(!this['isConfigured'](_0x42ffd6)){return this['channel'][_0xf31a('0x2c')](_0x294cf8,util['format'](_0xf31a('0x1b9'),_0x294cf8[_0xf31a('0x1b7')]));}if(_0x42ffd6===this[_0xf31a('0x3a')][_0xf31a('0x3b')]){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x294cf8,_0xf31a('0x1ba'));}this['createSquareDetailsReport'][_0xf31a('0x6e')](this,_0x294cf8,_0x42ffd6);var _0x126901=this['channel'][_0xf31a('0x59')](_0xf31a('0x1bb'),util['format'](_0xf31a('0x1bc'),config['agi'][_0xf31a('0x1bd')]||'127.0.0.1',_0x42ffd6,this[_0xf31a('0x3a')][_0xf31a('0x3b')]));if(_0x126901[_0xf31a('0xa5')]===-0x1){return _0x126901;}return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xc5'),_0xf31a('0x1bb'),_0x42ffd6));};AGIVertices['prototype'][_0xf31a('0x1be')]=function(_0x2ea979){logger['info'](util[_0xf31a('0x29')](_0xf31a('0x1bf'),_0x2ea979[_0xf31a('0x38')]));var _0x383f01=this['shellCommand'][_0xf31a('0x6e')](this,_0x2ea979['command']);this[_0xf31a('0x36')][_0xf31a('0x6e')](this,_0x2ea979,_0x2ea979[_0xf31a('0x1c0')]);if(this[_0xf31a('0x85')](_0x2ea979[_0xf31a('0xd8')])){var _0xe930da=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x2ea979[_0xf31a('0xd8')]);if(_0xe930da){this[_0xf31a('0x3a')][_0xf31a('0xa0')](_0xe930da,_0x383f01);return this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1c1'),_0x2ea979[_0xf31a('0x1c0')],_0xe930da));}}return this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x1c2'),_0x2ea979[_0xf31a('0x1c0')]));};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1c3')]=function(_0x51b382){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1c4'),_0x51b382['label']));_0x51b382[_0xf31a('0x5d')]=_0x51b382['text'][_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf31a('0x85')](_0x51b382[_0xf31a('0x5b')])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')](_0xf31a('0x1c5'));}if(!this['isConfigured'](_0x51b382['text'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20text\x20configured');}this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x51b382[_0xf31a('0x5d')]));var _0xc942ee=this[_0xf31a('0x1c6')][_0xf31a('0x6e')](this,_0x51b382);if(_0xc942ee){this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1c7'),_0xc942ee));var _0x3d5b41=this[_0xf31a('0x3a')][_0xf31a('0x103')](_0xc942ee);try{fs[_0xf31a('0x128')](_0xc942ee+_0xf31a('0x104'));}catch(_0x32ff03){logger[_0xf31a('0x2c')](_0x32ff03);}return _0x3d5b41;}return this['channel']['error'](_0x51b382,_0xf31a('0x1c8'));};AGIVertices['prototype']['tts']=function(_0x3cfd1f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3cfd1f[_0xf31a('0x38')]));_0x3cfd1f[_0xf31a('0x5d')]=_0x3cfd1f['text'][_0xf31a('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf31a('0x85')](_0x3cfd1f['text'])){return this[_0xf31a('0x3a')][_0xf31a('0xaa')]('no\x20text\x20configured');}this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0x1c9'),_0x3cfd1f['text']));var _0xfccba=this[_0xf31a('0x61')][_0xf31a('0x6e')](this,_0x3cfd1f);if(_0xfccba){this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x1ca'),_0xfccba));var _0x2c6bfb=this['channel'][_0xf31a('0x103')](_0xfccba);try{fs[_0xf31a('0x128')](_0xfccba+_0xf31a('0x104'));}catch(_0x19bf75){logger['error'](_0x19bf75);}return _0x2c6bfb;}return this['channel'][_0xf31a('0x2c')](_0x3cfd1f,_0xf31a('0x1cb'));};AGIVertices['prototype'][_0xf31a('0x1cc')]=function(_0x4c18d8){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1cd'),_0x4c18d8[_0xf31a('0x38')]));if(!this[_0xf31a('0x85')](_0x4c18d8[_0xf31a('0x159')])){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x4c18d8,'no\x20find\x20by\x20configured');}logger['info'](util[_0xf31a('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x4c18d8['findBy']));var _0x20a68f=this[_0xf31a('0x54')]['sync'](this,_0x4c18d8[_0xf31a('0x159')]);if(_0x20a68f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x15c'),this['channel'][_0xf31a('0x3c')],_0x4c18d8[_0xf31a('0x159')]));this[_0xf31a('0x3a')]['noop'](util[_0xf31a('0x29')](_0xf31a('0x15c'),this[_0xf31a('0x3a')]['callerid'],_0x4c18d8[_0xf31a('0x159')]));return{'code':0xc8,'result':_0xf31a('0x15d')};}else{logger[_0xf31a('0x30')](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf31a('0x3a')][_0xf31a('0x3c')],_0x4c18d8[_0xf31a('0x159')]));this[_0xf31a('0x3a')][_0xf31a('0xaa')](util[_0xf31a('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf31a('0x3c')],_0x4c18d8[_0xf31a('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf31a('0xf')][_0xf31a('0x1ce')]=function(_0x1ce36f){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1cf'),_0x1ce36f[_0xf31a('0x38')]));var _0x2bc116=this[_0xf31a('0x3a')][_0xf31a('0x59')]('VOICEMAIL',[_0x1ce36f[_0xf31a('0x1d0')],_0x1ce36f[_0xf31a('0x78')]]);if(_0x2bc116['result']===-0x1){return _0x2bc116;}return this['channel'][_0xf31a('0xaa')](util[_0xf31a('0x29')](_0xf31a('0xc5'),_0xf31a('0x1d1'),_0x1ce36f[_0xf31a('0x1d0')]));};AGIVertices['prototype'][_0xf31a('0x1d2')]=function(_0x18e356){logger[_0xf31a('0x30')](util[_0xf31a('0x29')](_0xf31a('0x1d3'),_0x18e356[_0xf31a('0x38')]));if(!this['isConfigured'](_0x18e356[_0xf31a('0xd8')])){return this[_0xf31a('0x3a')]['error'](_0x18e356,_0xf31a('0x1ae'));}var _0x490496=this[_0xf31a('0x10')][_0xf31a('0x6e')](this,_0x18e356[_0xf31a('0xd8')]);if(!_0x490496){return this[_0xf31a('0x3a')][_0xf31a('0x2c')](_0x18e356,_0xf31a('0xd9'));}var _0x133263=this[_0xf31a('0x3a')]['getVariable'](_0x490496);return{'code':0xc8,'result':_0x133263[_0xf31a('0xa3')]?_0x133263['extra']:'-'};};String[_0xf31a('0xf')][_0xf31a('0xa2')]=function(_0x30d5bc,_0x66eb48){return this[_0xf31a('0xa1')](_0x30d5bc)['join'](_0x66eb48);};module[_0xf31a('0x1d4')]=AGIVertices; \ No newline at end of file +var _0x950a=['Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','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','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','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://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','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','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawHeaders','rawBody','getsecretdigits','channel','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','includes','POST','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','clone','isString','isPlainObject','isArray','length','recursiveNodeIndex','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','getVariable','getAndSetVariable','extra','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x950a,0x111));var _0xa950=function(_0x417600,_0x2439fe){_0x417600=_0x417600-0x0;var _0x1b9bb3=_0x950a[_0x417600];return _0x1b9bb3;};'use strict';var fs=require('fs');var util=require(_0xa950('0x0'));var _=require(_0xa950('0x1'));var sh=require(_0xa950('0x2'));var odbc=require(_0xa950('0x3'))();var rs=require('randomstring');var moment=require(_0xa950('0x4'));var Mustache=require(_0xa950('0x5'));var rp=require(_0xa950('0x6'));var logger=require(_0xa950('0x7'))('agi');var config=require(_0xa950('0x8'));var scripts=require(_0xa950('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xa950('0xa'),_0xa950('0xb')];var verticesWithRetry=['menu','getdigits',_0xa950('0xc')];var AGIVertices=function(_0x12ef5a,_0x7d87b2,_0x2c77da){this[_0xa950('0xd')]=_0x12ef5a;this[_0xa950('0xe')]=_0x7d87b2;this['mailRpc']=_0x2c77da;};AGIVertices['prototype']['getVariable']=function(_0x2bccea,_0x48c1b5){this[_0xa950('0xe')][_0xa950('0xf')](_0x2bccea)[_0xa950('0x10')](function(_0x524c56){_0x48c1b5(null,_0x524c56?_0x524c56[_0xa950('0x11')]:![]);})['catch'](function(_0x10e64a){_0x48c1b5(_0x10e64a);});};AGIVertices[_0xa950('0x12')][_0xa950('0x13')]=function(_0x4c217c,_0xf1582){this[_0xa950('0xe')][_0xa950('0x14')](_0x4c217c)['then'](function(_0x24fb36){_0xf1582(null,_0x24fb36?_0x24fb36[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x5d5f4c){_0xf1582(_0x5d5f4c);});};AGIVertices[_0xa950('0x12')][_0xa950('0x16')]=function(_0x1598a8,_0x4df9d1){this[_0xa950('0xe')][_0xa950('0x17')](_0x1598a8)[_0xa950('0x10')](function(_0x1021da){_0x4df9d1(null,_0x1021da?_0x1021da[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x2b0e44){_0x4df9d1(_0x2b0e44);});};AGIVertices[_0xa950('0x12')][_0xa950('0x18')]=function(_0x18266c,_0x28fedf){this[_0xa950('0xe')][_0xa950('0x19')](_0x18266c)['then'](function(_0x3c7f18){_0x28fedf(null,_0x3c7f18?_0x3c7f18[_0xa950('0x1a')]:![]);})['catch'](function(_0x1f9894){_0x28fedf(_0x1f9894);});};AGIVertices[_0xa950('0x12')]['getUser']=function(_0x2e6f72,_0x5ad191){this[_0xa950('0xe')][_0xa950('0x1b')](_0x2e6f72)[_0xa950('0x10')](function(_0x36a16c){_0x5ad191(null,_0x36a16c?_0x36a16c['name']:![]);})[_0xa950('0x15')](function(_0x3f4633){_0x5ad191(_0x3f4633);});};AGIVertices[_0xa950('0x12')][_0xa950('0x1c')]=function(_0x292c73,_0x22e2c1){this[_0xa950('0xe')][_0xa950('0x1d')](_0x292c73)[_0xa950('0x10')](function(_0xc4894b){_0x22e2c1(null,_0xc4894b?_0xc4894b[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x43f8c8){_0x22e2c1(_0x43f8c8);});};AGIVertices['prototype'][_0xa950('0x1e')]=function(_0x288934,_0x3f37f8){var _0x1aa96a=this;this[_0xa950('0xe')][_0xa950('0x1f')](_0x288934)[_0xa950('0x10')](function(_0x52e133){_0x3f37f8(null,_0x52e133?_0x1aa96a[_0xa950('0x20')](_0x52e133[_0xa950('0x21')]):![]);})['catch'](function(_0x44ee6e){_0x3f37f8(_0x44ee6e);});};AGIVertices[_0xa950('0x12')][_0xa950('0x22')]=function(_0x1875eb,_0x152f53){this[_0xa950('0xe')][_0xa950('0x23')](_0x1875eb)[_0xa950('0x10')](function(_0x203703){_0x152f53(null,_0x203703?_0x203703:![]);})[_0xa950('0x15')](function(_0x4de9f0){_0x152f53(_0x4de9f0);});};AGIVertices[_0xa950('0x12')]['sendMailMessage']=function(_0x565933,_0x26ee82,_0x5db455){this[_0xa950('0x24')][_0xa950('0x25')](_0x565933,_0x26ee82)[_0xa950('0x10')](function(){_0x5db455(null);})[_0xa950('0x15')](function(_0x55f3da){_0x5db455(_0x55f3da);});};AGIVertices[_0xa950('0x12')]['getIntervals']=function(_0x45846c,_0x2306f8){this['rpc']['getIntervalById'](_0x45846c)[_0xa950('0x10')](function(_0x1ccbed){if(_0x1ccbed){if(_0x1ccbed[_0xa950('0x26')]){_0x2306f8(null,[_0x1ccbed[_0xa950('0x27')]]);}else{_0x2306f8(null,_[_0xa950('0x28')](_0x1ccbed[_0xa950('0x29')],'interval'));}}else{_0x2306f8(null,![]);}})['catch'](function(_0x356258){_0x2306f8(_0x356258);});};AGIVertices['prototype'][_0xa950('0x20')]=function(_0x11a061){return util[_0xa950('0x2a')](_0xa950('0x2b'),FILES_PATH,_0x11a061);};AGIVertices[_0xa950('0x12')][_0xa950('0x2c')]=function(_0xd7f55d,_0x3cc798,_0x1ba2fd){odbc[_0xa950('0x2d')](_0xd7f55d,function(_0x55d7d9){if(_0x55d7d9){logger[_0xa950('0x2e')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x55d7d9);_0x1ba2fd(_0x55d7d9);}else{logger[_0xa950('0x2f')](_0xa950('0x30'));odbc['query'](_0x3cc798,function(_0x4c6588,_0x3d49f4){if(_0x4c6588){logger[_0xa950('0x2f')]('Error\x20executing\x20query\x20%s',_0x3cc798);_0x1ba2fd(_0x4c6588);}else{logger[_0xa950('0x2f')](_0xa950('0x31'),_0x3cc798);odbc['close'](function(_0x213a58){if(_0x213a58){logger[_0xa950('0x2e')](_0xa950('0x32'),_0x213a58);}_0x1ba2fd(null,_0x3d49f4);});}});}});};AGIVertices[_0xa950('0x12')][_0xa950('0x33')]=function(_0x35cfcc,_0x4253ce){this[_0xa950('0xe')]['getSmsAccountById'](_0x35cfcc)[_0xa950('0x10')](function(_0x1764b2){_0x4253ce(null,_0x1764b2?_0x1764b2:![]);})['catch'](function(_0x732bc1){_0x4253ce(_0x732bc1);});};AGIVertices[_0xa950('0x12')][_0xa950('0x34')]=function(_0x57205b,_0x25c9f3){this[_0xa950('0xe')][_0xa950('0x34')](_0x57205b)['then'](function(_0x545090){_0x25c9f3(null,_0x545090);})[_0xa950('0x15')](function(_0x75ff6c){_0x25c9f3(_0x75ff6c);});};AGIVertices[_0xa950('0x12')]['createSquareDetailsReport']=function(_0x49a235,_0x51f5a5,_0x41619f){this[_0xa950('0xe')][_0xa950('0x35')]({'uniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'node':_0x49a235['label'],'application':_0x49a235[_0xa950('0x37')],'data':_0x51f5a5||null,'project_name':this[_0xa950('0xd')]['arg_1'],'callerid':this['channel'][_0xa950('0x38')]})[_0xa950('0x10')](function(_0x4f34b2){if(_0x41619f){_0x41619f(null,_0x4f34b2);}})['catch'](function(_0x5040c1){if(_0x41619f){_0x41619f(_0x5040c1);}});};AGIVertices['prototype'][_0xa950('0x39')]=function(_0x3cc04b,_0x5ae175,_0x5672c3,_0x286881){this['rpc'][_0xa950('0x39')]({'uniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'callerid':this[_0xa950('0xd')][_0xa950('0x38')],'calleridname':this[_0xa950('0xd')][_0xa950('0x3a')],'context':this[_0xa950('0xd')]['context'],'extension':this[_0xa950('0xd')]['extension'],'priority':this[_0xa950('0xd')][_0xa950('0x3b')],'accountcode':this[_0xa950('0xd')][_0xa950('0x3c')],'dnid':this[_0xa950('0xd')][_0xa950('0x3d')],'projectName':this[_0xa950('0xd')][_0xa950('0x3e')],'saveName':_0x5ae175,'filename':_0x3cc04b[_0xa950('0x3f')]||_0x5ae175,'savePath':_0x5672c3})['then'](function(_0x3cf01c){_0x286881(null,_0x3cf01c);})[_0xa950('0x15')](function(_0x36ddb8){_0x286881(_0x36ddb8);});};AGIVertices[_0xa950('0x12')][_0xa950('0x40')]=function(_0x5a2b2f,_0x237152,_0xde68b2,_0x3f0bb5,_0x84a54){this[_0xa950('0xe')][_0xa950('0x40')]({'uniqueid':this[_0xa950('0xd')]['uniqueid'],'body':_0x5a2b2f,'direction':_0x237152,'providerName':_0xde68b2,'providerResponse':_0x3f0bb5})[_0xa950('0x10')](function(_0x13a66d){if(_0x84a54){_0x84a54(null,_0x13a66d);}})[_0xa950('0x15')](function(_0x4a163f){if(_0x84a54){_0x84a54(_0x4a163f);}});};AGIVertices['prototype'][_0xa950('0x41')]=function(_0x26216c,_0x38c370){this[_0xa950('0xe')][_0xa950('0x41')]({'firstName':_[_0xa950('0x42')](_0x26216c[_0xa950('0x11')])||_[_0xa950('0x43')](_0x26216c['name'])?_0xa950('0x44')+Math[_0xa950('0x45')]():_0x26216c[_0xa950('0x11')],'lastName':_[_0xa950('0x42')](_0x26216c[_0xa950('0x46')])||_['isNil'](_0x26216c[_0xa950('0x46')])?null:_0x26216c['lastName'],'phone':_0x26216c[_0xa950('0x47')],'ListId':_0x26216c[_0xa950('0x48')],'scheduledat':_0x26216c[_0xa950('0x49')],'callbackUniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'tags':_0xa950('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x26216c['scheduledAt']['toString'](),'priority':_0x26216c[_0xa950('0x4b')]})[_0xa950('0x10')](function(_0x1303a9){_0x38c370(null,_0x1303a9);})[_0xa950('0x15')](function(_0x447459){_0x38c370(_0x447459);});};AGIVertices[_0xa950('0x12')][_0xa950('0x4c')]=function(_0x18700a,_0x5e16e7){this[_0xa950('0xe')]['getPauseById'](_0x18700a)[_0xa950('0x10')](function(_0x4e0fdc){_0x5e16e7(null,_0x4e0fdc?_0x4e0fdc[_0xa950('0x11')]:![]);})['catch'](function(_0x292de6){_0x5e16e7(_0x292de6);});};AGIVertices['prototype'][_0xa950('0x4d')]=function(_0x3e536e,_0x3ead91,_0x3d6e1b){var _0x46cfe4={'role':'agent'};_0x46cfe4[_0x3e536e]=this[_0xa950('0xd')][_0xa950('0x38')];this[_0xa950('0xe')][_0xa950('0x4d')](_0x46cfe4,_0x3ead91,this[_0xa950('0xd')]['uniqueid'])[_0xa950('0x10')](function(_0x117a56){_0x3d6e1b(null,_[_0xa950('0x43')](_0x117a56)?![]:!![]);})[_0xa950('0x15')](function(_0x35e7dc){logger['error'](_0x35e7dc);_0x3d6e1b(null,![]);});};AGIVertices[_0xa950('0x12')]['agentUnpause']=function(_0x5a32c1,_0x2eff92){var _0xcb3b8d={'role':_0xa950('0x4e')};_0xcb3b8d[_0x5a32c1]=this[_0xa950('0xd')]['callerid'];this['rpc'][_0xa950('0x4f')](_0xcb3b8d)[_0xa950('0x10')](function(_0x32ed18){_0x2eff92(null,_['isNil'](_0x32ed18)?![]:!![]);})[_0xa950('0x15')](function(_0x47697b){logger[_0xa950('0x2e')](_0x47697b);_0x2eff92(null,![]);});};AGIVertices[_0xa950('0x12')][_0xa950('0x50')]=function(_0x8972fb,_0x302500){var _0x3d10a8={'role':_0xa950('0x4e')};_0x3d10a8[_0x8972fb]=this['channel'][_0xa950('0x38')];this['rpc'][_0xa950('0x50')](_0x3d10a8)[_0xa950('0x10')](function(_0x285eaa){_0x302500(null,_[_0xa950('0x43')](_0x285eaa)?![]:!![]);})[_0xa950('0x15')](function(_0x2cca83){logger[_0xa950('0x2e')](_0x2cca83);_0x302500(null,![]);});};AGIVertices[_0xa950('0x12')][_0xa950('0x51')]=function(_0x2e6663,_0x120ea9){var _0x15301e={'role':_0xa950('0x4e')};_0x15301e[_0x2e6663]=this['channel']['callerid'];var _0x15e399=_0x2e6663!=_0xa950('0x52')?util[_0xa950('0x2a')](_0xa950('0x53'),_0xa950('0x54'),this[_0xa950('0xd')][_0xa950('0x38')]):undefined;this['rpc'][_0xa950('0x51')](_0x15301e,_0x15e399)[_0xa950('0x10')](function(_0x297be4){_0x120ea9(null,_[_0xa950('0x43')](_0x297be4)?![]:!![]);})[_0xa950('0x15')](function(_0x2cf13f){logger[_0xa950('0x2e')](_0x2cf13f);_0x120ea9(null,![]);});};AGIVertices[_0xa950('0x12')]['shellCommand']=function(_0x386a16,_0x3d4ed6){sh[_0xa950('0x55')](_[_0xa950('0x56')](_0x386a16),function(_0x3a0060,_0x5b79cf){var _0x2b7744=_0x5b79cf[_0xa950('0x57')](/(\r\n|\n|\r)/gm,'');_0x3d4ed6(null,_0x2b7744);});};AGIVertices[_0xa950('0x12')][_0xa950('0x58')]=function(_0x123bf6,_0x579378){scripts[_0xa950('0x58')](_0x123bf6[_0xa950('0x59')],_0x123bf6[_0xa950('0x5a')]||'text',_0x123bf6[_0xa950('0x5b')],_0x123bf6[_0xa950('0x5c')]||_0xa950('0x5d'),_0x123bf6[_0xa950('0x5e')]||'MALE',_0x123bf6[_0xa950('0x5f')]||_0xa950('0x60'))['then'](function(_0xda1471){_0x579378(null,_0xda1471);})[_0xa950('0x15')](function(_0x23a645){_0x579378(_0x23a645);});};AGIVertices[_0xa950('0x12')][_0xa950('0x61')]=function(_0x1215bb,_0x17b60c){scripts[_0xa950('0x61')](_0x1215bb[_0xa950('0x5b')],_0x1215bb[_0xa950('0x62')]||'en',0x1)[_0xa950('0x10')](function(_0x14fb0c){_0x17b60c(null,_0x14fb0c);})[_0xa950('0x15')](function(_0x59ef65){_0x17b60c(_0x59ef65);});};AGIVertices['prototype']['restAPI']=function(_0x5b88c9,_0xd6b04f){var _0x22066c={'uri':_0x5b88c9[_0xa950('0x63')],'method':_0x5b88c9['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b88c9[_0xa950('0x64')])===_0xa950('0x65')&&parseInt(_0x5b88c9[_0xa950('0x64')])>=0x1?parseInt(_0x5b88c9[_0xa950('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xa950('0x66')]([_0xa950('0x67'),_0xa950('0x68')],_0x22066c['method'][_0xa950('0x69')]())){try{_0x22066c[_0xa950('0x6a')]=_0x5b88c9[_0xa950('0xb')]?JSON[_0xa950('0x6b')](_0x5b88c9[_0xa950('0xb')]):{};}catch(_0x14f3bb){logger[_0xa950('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x14f3bb);}}try{_0x22066c[_0xa950('0x6c')]=_0x5b88c9[_0xa950('0xa')]?JSON['parse'](_0x5b88c9[_0xa950('0xa')]):{};}catch(_0x15f4c3){logger[_0xa950('0x2e')](_0xa950('0x6d'),_0x15f4c3);}if(_0x5b88c9[_0xa950('0x6e')]){try{var _0x2cdfe8=require(_0x5b88c9[_0xa950('0x6e')])['sync'](this,_0x22066c);_0x22066c[_0xa950('0x6f')]=Mustache[_0xa950('0x70')](_0x5b88c9[_0xa950('0x63')],_0x2cdfe8,{},['$$','$$']);if(_0x22066c[_0xa950('0x6c')]){_0x22066c[_0xa950('0x6c')]=JSON[_0xa950('0x6b')](Mustache['render'](JSON[_0xa950('0x71')](_0x22066c[_0xa950('0x6c')]),_0x2cdfe8,{},['$$','$$']));}if(_0x22066c['body']){_0x22066c['body']=JSON['parse'](Mustache['render'](JSON[_0xa950('0x71')](_0x22066c[_0xa950('0x6a')]),_0x2cdfe8,{},['$$','$$']));}}catch(_0x4925f5){logger[_0xa950('0x2e')](_0xa950('0x72'),_0x4925f5);}}rp(_0x22066c)['then'](function(_0x2760ef){var _0x98722={'statusCode':_0x2760ef[_0xa950('0x73')]||0xc8,'statusMessage':_0x2760ef['statusMessage']||'OK','headers':_0x2760ef['headers']||{},'body':_0x2760ef[_0xa950('0x6a')]||{}};_0xd6b04f(null,_0x98722);})[_0xa950('0x15')](function(_0x3210e5){var _0xdddf1f={'statusCode':_0x3210e5[_0xa950('0x73')]||0x1f4,'statusMessage':_0x3210e5[_0xa950('0x74')]||_0xa950('0x75'),'headers':_0x3210e5[_0xa950('0x76')][_0xa950('0x6c')]||{},'body':_0x3210e5[_0xa950('0x76')][_0xa950('0x6a')]||{}};_0xd6b04f(null,_0xdddf1f);});};AGIVertices[_0xa950('0x12')]['googleDialogflow']=function(_0x40133e,_0x56822f){scripts[_0xa950('0x77')](this[_0xa950('0xd')]['uniqueid'],_0x40133e[_0xa950('0x78')],_0x40133e[_0xa950('0x5b')],_0x40133e['dialogflow_language']||'en')[_0xa950('0x10')](function(_0x1924c0){_0x56822f(null,_0x1924c0);})['catch'](function(_0x2b6fb0){_0x56822f(_0x2b6fb0);});};AGIVertices['prototype'][_0xa950('0x79')]=function(_0x459323,_0x5bef31){scripts[_0xa950('0x79')](this[_0xa950('0xd')][_0xa950('0x36')],_0x459323[_0xa950('0x7a')],_0x459323[_0xa950('0x7b')],_0x459323[_0xa950('0x7c')],_0x459323[_0xa950('0x5b')],_0x459323[_0xa950('0x7d')]||'en')['then'](function(_0x462803){_0x5bef31(null,_0x462803);})[_0xa950('0x15')](function(_0x3de108){_0x5bef31(_0x3de108);});};AGIVertices[_0xa950('0x12')][_0xa950('0x7e')]=function(_0x1fb819,_0x52b0ad){scripts[_0xa950('0x7e')](this[_0xa950('0xd')],_0x1fb819)['then'](function(_0x5e0d1f){_0x52b0ad(null,_0x5e0d1f);})[_0xa950('0x15')](function(_0x2bbd70){_0x52b0ad(_0x2bbd70);});};AGIVertices[_0xa950('0x12')][_0xa950('0x7f')]=function(_0x54cb84,_0x5e0732){scripts[_0xa950('0x7f')](_0x54cb84[_0xa950('0x78')],_0x54cb84[_0xa950('0x5b')],_0x54cb84[_0xa950('0x80')]||_0xa950('0x5d'),_0x54cb84[_0xa950('0x81')])[_0xa950('0x10')](function(_0x32cc2c){_0x5e0732(null,_0x32cc2c);})['catch'](function(_0x281eca){_0x5e0732(_0x281eca);});};AGIVertices[_0xa950('0x12')]['ispeechASR']=function(_0x18fe7a,_0x153953,_0x11f20b){scripts[_0xa950('0x82')](_0x153953,_0x18fe7a[_0xa950('0x78')],_0x18fe7a['ispeech_asr_language']||'en-US',this[_0xa950('0x83')](_0x18fe7a[_0xa950('0x84')])?_0x18fe7a['model']:undefined)[_0xa950('0x10')](function(_0x4fe3e3){_0x11f20b(null,_0x4fe3e3);})[_0xa950('0x15')](function(_0x2db6de){_0x11f20b(_0x2db6de);});};AGIVertices[_0xa950('0x12')]['awsPolly']=function(_0x5027e4,_0x13f325){scripts['awsPolly'](_0x5027e4[_0xa950('0x85')],_0x5027e4[_0xa950('0x86')],_0x5027e4[_0xa950('0x87')],_0x5027e4[_0xa950('0x88')]||'Amy',_0x5027e4[_0xa950('0x5b')],_0x5027e4['aws_text_type']||_0xa950('0x5b'))[_0xa950('0x10')](function(_0x4c0b9c){_0x13f325(null,_0x4c0b9c);})[_0xa950('0x15')](function(_0x5c5d80){_0x13f325(_0x5c5d80);});};AGIVertices[_0xa950('0x12')][_0xa950('0x89')]=function(_0x5839f7,_0x3afbfc){scripts[_0xa950('0x89')](this[_0xa950('0xd')][_0xa950('0x36')],_0x5839f7['aws_access_key_id'],_0x5839f7['aws_secret_access_key'],_0x5839f7[_0xa950('0x8a')],_0x5839f7[_0xa950('0x5b')],_0x5839f7[_0xa950('0x8b')])[_0xa950('0x10')](function(_0x26db07){_0x3afbfc(null,_0x26db07);})[_0xa950('0x15')](function(_0xdf4b31){_0x3afbfc(_0xdf4b31);});};AGIVertices[_0xa950('0x12')]['googleASR']=function(_0x487daa,_0x5e70e9,_0x4091f7){scripts[_0xa950('0x8c')](_0x5e70e9,_0x487daa[_0xa950('0x78')],_0x487daa['google_asr_language']||_0xa950('0x5d'))['then'](function(_0x1adfc8){_0x4091f7(null,_0x1adfc8);})[_0xa950('0x15')](function(_0x4b1ad5){_0x4091f7(_0x4b1ad5);});};AGIVertices[_0xa950('0x12')]['tildeASR']=function(_0x168840,_0x2c8e76,_0x3b746e){scripts[_0xa950('0x8d')](_0x2c8e76,_0x168840['appid'],_0x168840[_0xa950('0x8e')],_0x168840[_0xa950('0x6f')])['then'](function(_0x8f32eb){_0x3b746e(null,_0x8f32eb);})[_0xa950('0x15')](function(_0x27a22){_0x3b746e(_0x27a22);});};AGIVertices[_0xa950('0x12')][_0xa950('0x8f')]=function(_0x54166e){var _0x3b5afe=_[_0xa950('0x66')](verticesWithRetry,_0x54166e[_0xa950('0x37')])?_0x54166e:_[_0xa950('0x90')](_0x54166e);for(var _0x52b82d in _0x3b5afe){if(_0x3b5afe['hasOwnProperty'](_0x52b82d)){if(_0x3b5afe[_0x52b82d]&&_[_0xa950('0x91')](_0x3b5afe[_0x52b82d])){if(_['includes'](recursiveMapAttributes,_0x52b82d)){_0x3b5afe[_0x52b82d]=this['replaceObjectAllVariables'](_0x3b5afe[_0x52b82d]);}else{_0x3b5afe[_0x52b82d]=this['replaceAllVariables'](_0x3b5afe[_0x52b82d]);}}}}return _0x3b5afe;};AGIVertices[_0xa950('0x12')]['recursiveNodeIndex']=function(_0x2bf63d){for(var _0x399a54 in _0x2bf63d){if(_0x2bf63d['hasOwnProperty'](_0x399a54)){if(_[_0xa950('0x92')](_0x2bf63d[_0x399a54])){this['recursiveNodeIndex'](_0x2bf63d[_0x399a54]);}else if(_[_0xa950('0x93')](_0x2bf63d[_0x399a54])){for(var _0x2c1701=0x0;_0x2c1701<_0x2bf63d[_0x399a54][_0xa950('0x94')];_0x2c1701++){this[_0xa950('0x95')](_0x2bf63d[_0x399a54][_0x2c1701]);}}else if(_[_0xa950('0x91')](_0x2bf63d[_0x399a54])){_0x2bf63d[_0x399a54]=this['replaceAllVariables'](_0x2bf63d[_0x399a54]);}}}};AGIVertices[_0xa950('0x12')][_0xa950('0x96')]=function(_0x4ead40,_0x5a2f9d){for(var _0xec6116 in _0x4ead40){if(_0x4ead40[_0xa950('0x97')](_0xec6116)){if(_['isPlainObject'](_0x4ead40[_0xec6116])){if(!_['isEmpty'](_0x4ead40[_0xec6116])){this[_0xa950('0x96')](_0x4ead40[_0xec6116],util['format'](_0xa950('0x98'),_0x5a2f9d,_0xec6116));}}else if(_['isArray'](_0x4ead40[_0xec6116])){for(var _0x44ea18=0x0;_0x44ea18<_0x4ead40[_0xec6116][_0xa950('0x94')];_0x44ea18++){this[_0xa950('0x96')](_0x4ead40[_0xec6116][_0x44ea18],util[_0xa950('0x2a')](_0xa950('0x98'),_0x5a2f9d,_0xec6116+'['+_0x44ea18+']'));}}else{if(!_[_0xa950('0x43')](_0x4ead40[_0xec6116])){this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x98'),_0x5a2f9d,_0xec6116),_0x4ead40[_0xec6116]);}}}}};AGIVertices[_0xa950('0x12')][_0xa950('0x9a')]=function(_0x457e05){try{var _0x424558=JSON[_0xa950('0x6b')](_0x457e05);this['recursiveNodeIndex'](_0x424558);return JSON[_0xa950('0x71')](_0x424558);}catch(_0x4fa226){return this['replaceAllVariables'](_0x457e05);}};AGIVertices[_0xa950('0x12')][_0xa950('0x9b')]=function(_0x16dd29){var _0x57d6c3=_0x16dd29[_0xa950('0x9c')]('{');for(var _0x2804c7=0x1;_0x2804c7<_0x57d6c3['length'];_0x2804c7+=0x1){var _0x1d8746=_0x57d6c3[_0x2804c7]['split']('}');if(_0x1d8746[_0xa950('0x94')]>0x1){_0x16dd29=_0x16dd29[_0xa950('0x9d')]('{'+_0x1d8746[0x0]+'}',this[_0xa950('0xd')][_0xa950('0x9e')](_0x1d8746[0x0])['extra']||_0x1d8746[0x0]);}}if(_0x57d6c3[_0xa950('0x94')]===0x1){return _0x16dd29['toString']();}return this['replaceAllVariables'](_0x16dd29);};AGIVertices[_0xa950('0x12')][_0xa950('0x9f')]=function(_0x4c03ea,_0x54af7a){var _0x545b45=this['channel'][_0xa950('0x9e')](_0x4c03ea);if(_0x545b45['result']===-0x1){return _0x545b45;}logger[_0xa950('0x2f')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x54af7a,_0x545b45[_0xa950('0xa0')]));return this['channel'][_0xa950('0x99')](_0x54af7a,_0x545b45[_0xa950('0xa0')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x83')]=function(_0x5a07bc){return _0x5a07bc&&_0x5a07bc!=='0'&&_0x5a07bc!=='-1'&&_0x5a07bc!=='';};AGIVertices[_0xa950('0x12')][_0xa950('0xa1')]=function(_0x540f41){this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x540f41,'-');_0x540f41[_0xa950('0xa3')]=_0x540f41[_0xa950('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa950('0x12')]['mrcpsynth']=function(_0xde9b99){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xa4'),_0xde9b99[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0xde9b99[_0xa950('0x5b')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xa6'));}var _0x475266='\x22'+_0xde9b99[_0xa950('0x5b')]+'\x22';if(this[_0xa950('0x83')](_0xde9b99[_0xa950('0x76')])){_0x475266+=','+_0xde9b99[_0xa950('0x76')];}var _0x450843=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x475266);if(_0x450843[_0xa950('0xa8')]===-0x1){return _0x450843;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xaa'),_0x475266));};AGIVertices['prototype'][_0xa950('0xab')]=function(_0x55cee6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xac'),_0x55cee6['label']));if(!this['isConfigured'](_0x55cee6[_0xa950('0xad')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xae'));}var _0x529118=_0x55cee6[_0xa950('0xad')];if(this['isConfigured'](_0x55cee6['options'])){_0x529118+=','+_0x55cee6[_0xa950('0x76')];}var _0x5e2ae6=this[_0xa950('0xd')]['exec']('MRCPRecog',_0x529118);if(_0x5e2ae6['result']===-0x1){return _0x5e2ae6;}var _0x30a200=this[_0xa950('0x9f')](_0xa950('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x30a200[_0xa950('0xa8')]===-0x1){return _0x30a200;}var _0x524dcf=this[_0xa950('0x9f')](_0xa950('0xb0'),_0xa950('0xb1'));if(_0x524dcf[_0xa950('0xa8')]===-0x1){return _0x524dcf;}var _0x4e77e4=this[_0xa950('0x9f')](_0xa950('0xb2'),_0xa950('0xb3'));if(_0x4e77e4['result']===-0x1){return _0x4e77e4;}return this['channel']['noop'](util[_0xa950('0x2a')](_0xa950('0xb4'),_0x529118));};AGIVertices[_0xa950('0x12')][_0xa950('0xb5')]=function(_0x955cc2){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xb6'),_0x955cc2[_0xa950('0xa5')]));return this[_0xa950('0xd')]['agi']([_0x955cc2[_0xa950('0xb7')],_0x955cc2[_0xa950('0xb8')]]);};AGIVertices[_0xa950('0x12')][_0xa950('0xb9')]=function(_0x458e7b){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xba'),_0x458e7b[_0xa950('0xa5')]));if(this[_0xa950('0x83')](_0x458e7b[_0xa950('0x64')])){logger[_0xa950('0x2f')](util['format'](_0xa950('0xbb'),_0x458e7b['timeout']));var _0x5600d3=this[_0xa950('0xd')][_0xa950('0xbc')](_0x458e7b[_0xa950('0x64')]);if(_0x5600d3['result']===-0x1){return _0x5600d3;}}return this[_0xa950('0xd')][_0xa950('0xb9')]();};AGIVertices[_0xa950('0x12')][_0xa950('0x4a')]=function(_0x5b5eb6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xbd'),_0x5b5eb6[_0xa950('0xa5')]));if(!this['isConfigured'](_0x5b5eb6['list_id'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x5b5eb6,_0xa950('0xbe'));}_0x5b5eb6[_0xa950('0x49')]=moment();if(this[_0xa950('0x83')](_0x5b5eb6[_0xa950('0xbf')])){_0x5b5eb6[_0xa950('0x49')]=moment()['add'](_0x5b5eb6[_0xa950('0xbf')],_0xa950('0xc0'));}if(!this[_0xa950('0x83')](_0x5b5eb6['callback_priority'])){_0x5b5eb6[_0xa950('0x4b')]=0x2;}this[_0xa950('0x41')]['sync'](this,_0x5b5eb6);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc1'),_0x5b5eb6[_0xa950('0x47')],_0x5b5eb6[_0xa950('0x48')],_0x5b5eb6[_0xa950('0x49')]));};AGIVertices[_0xa950('0x12')][_0xa950('0xc2')]=function(_0x4232d7){logger[_0xa950('0x2f')](util['format'](_0xa950('0xc3'),_0x4232d7[_0xa950('0xa5')]));var _0x5b2375=this['channel'][_0xa950('0x55')](_0x4232d7['application'],_0x4232d7['options']);if(_0x5b2375[_0xa950('0xa8')]===-0x1){return _0x5b2375;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),_0x4232d7['application'],_0x4232d7[_0xa950('0x76')]));};AGIVertices[_0xa950('0x12')][_0xa950('0xc5')]=function(_0x327581){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xc6'),_0x327581[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x327581[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}var _0x939bba='\x22'+_0x327581['text']+'\x22';if(this[_0xa950('0x83')](_0x327581[_0xa950('0x76')])){_0x939bba+=','+_0x327581[_0xa950('0x76')];}var _0x2f7b03=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x939bba);if(_0x2f7b03['result']===-0x1){return _0x2f7b03;}return this[_0xa950('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x939bba));};AGIVertices[_0xa950('0x12')][_0xa950('0xc7')]=function(_0x3348b1){logger['info'](util[_0xa950('0x2a')](_0xa950('0xc8'),_0x3348b1['label']));if(!this[_0xa950('0x83')](_0x3348b1[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}var _0x20612c='\x22'+_0x3348b1['text']+'\x22';if(this[_0xa950('0x83')](_0x3348b1[_0xa950('0x76')])){_0x20612c+=','+_0x3348b1[_0xa950('0x76')];}var _0x3bf03b=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x20612c);if(_0x3bf03b[_0xa950('0xa8')]===-0x1){return _0x3bf03b;}return this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xaa'),_0x20612c));};AGIVertices[_0xa950('0x12')]['lumenvoxasr']=function(_0x49e653){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x49e653[_0xa950('0xa5')]));if(!this['isConfigured'](_0x49e653[_0xa950('0xad')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20grammar\x20configured');}var _0x42cbb6=_0x49e653[_0xa950('0xad')];if(this[_0xa950('0x83')](_0x49e653[_0xa950('0x76')])){_0x42cbb6+=','+_0x49e653[_0xa950('0x76')];}var _0x52409a=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xc9'),_0x42cbb6);if(_0x52409a[_0xa950('0xa8')]===-0x1){return _0x52409a;}var _0x276b1c=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xa950('0xca'));if(_0x276b1c[_0xa950('0xa8')]===-0x1){return _0x276b1c;}var _0xaf6083=this['getAndSetVariable'](_0xa950('0xb0'),_0xa950('0xcb'));if(_0xaf6083[_0xa950('0xa8')]===-0x1){return _0xaf6083;}var _0x1af0cb=this[_0xa950('0x9f')](_0xa950('0xb2'),_0xa950('0xcc'));if(_0x1af0cb[_0xa950('0xa8')]===-0x1){return _0x1af0cb;}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x42cbb6));};AGIVertices[_0xa950('0x12')][_0xa950('0xcd')]=function(_0x38f32e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x38f32e[_0xa950('0xa5')]));if(!this['isConfigured'](_0x38f32e[_0xa950('0xad')])){return this['channel'][_0xa950('0xa9')]('no\x20grammar\x20configured');}var _0x5926ae=_0x38f32e[_0xa950('0xad')];if(this[_0xa950('0x83')](_0x38f32e['options'])){_0x5926ae+=','+_0x38f32e[_0xa950('0x76')];}var _0x3b34e6=this['channel'][_0xa950('0x55')](_0xa950('0xc9'),_0x5926ae);if(_0x3b34e6[_0xa950('0xa8')]===-0x1){return _0x3b34e6;}var _0x11a270=this[_0xa950('0x9f')]('RECOG_CONFIDENCE()',_0xa950('0xce'));if(_0x11a270[_0xa950('0xa8')]===-0x1){return _0x11a270;}var _0x3cd57b=this[_0xa950('0x9f')](_0xa950('0xb0'),_0xa950('0xcf'));if(_0x3cd57b[_0xa950('0xa8')]===-0x1){return _0x3cd57b;}var _0x2aab5f=this['getAndSetVariable'](_0xa950('0xb2'),_0xa950('0xd0'));if(_0x2aab5f[_0xa950('0xa8')]===-0x1){return _0x2aab5f;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xb4'),_0x5926ae));};AGIVertices[_0xa950('0x12')][_0xa950('0xd1')]=function(_0x2be65d){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xd2'),_0x2be65d['label']));if(!this[_0xa950('0x83')](_0x2be65d[_0xa950('0xd3')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,_0xa950('0xd4'));}var _0x1b0269=this[_0xa950('0x18')][_0xa950('0xa2')](this,_0x2be65d[_0xa950('0xd3')]);if(!_0x1b0269){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,'no\x20odbc\x20database\x20found');}if(!this[_0xa950('0x83')](_0x2be65d['query'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,'no\x20query\x20configured');}var _0x4edb28=_0x2be65d[_0xa950('0xd5')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xd6'),_0x4edb28));var _0x277cf8=this[_0xa950('0x2c')][_0xa950('0xa2')](this,_0x1b0269,_0x4edb28);this[_0xa950('0x35')]['sync'](this,_0x2be65d,_0x4edb28);if(!this[_0xa950('0x83')](_0x2be65d[_0xa950('0xd7')])){return this['channel'][_0xa950('0xa9')](_0xa950('0xd8'));}var _0x1ad303=this[_0xa950('0x9e')]['sync'](this,_0x2be65d['variable_id']);if(!_0x1ad303){return this[_0xa950('0xd')]['error'](_0x2be65d,_0xa950('0xd9'));}var _0x2a3ba0=this;_0x277cf8[_0xa950('0xda')](function(_0x1e845f,_0xcf25eb){Object['keys'](_0x1e845f)[_0xa950('0xda')](function(_0x22a08f){_0x2a3ba0['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xdb'),_0x1ad303,_0xcf25eb,_0x22a08f),_0x1e845f[_0x22a08f]);});});this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xdc'),_0x1ad303),_0x277cf8[_0xa950('0x94')]);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xdd'),_0x1ad303));};AGIVertices[_0xa950('0x12')][_0xa950('0xde')]=function(_0x1b35f8){logger[_0xa950('0xdf')](util[_0xa950('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1b35f8[_0xa950('0xa5')]));if(!this['isConfigured'](_0x1b35f8[_0xa950('0xe0')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1b35f8,_0xa950('0xe1'));}var _0x2014ef=this[_0xa950('0xe2')]['sync'](this,_0x1b35f8[_0xa950('0xe0')]);if(!_0x2014ef){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1b35f8,_0xa950('0xe3'));}var _0x556b80=this[_0xa950('0xd')]['exec'](_0xa950('0xe4'),[util[_0xa950('0x2a')](_0xa950('0xe5'),_0x2014ef),_0x1b35f8['timeout'],_0x1b35f8[_0xa950('0xe6')],_0x1b35f8[_0xa950('0x63')]]);if(_0x556b80[_0xa950('0xa8')]===-0x1){return _0x556b80;}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0xe7'),_0xa950('0xe4')));};AGIVertices[_0xa950('0x12')][_0xa950('0xe8')]=function(_0x91e6cb){logger[_0xa950('0x2f')](util['format'](_0xa950('0xe9'),_0x91e6cb[_0xa950('0xa5')]));if(!this['isConfigured'](_0x91e6cb['key'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xea'));}if(!this['isConfigured'](_0x91e6cb[_0xa950('0x5b')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xa6'));}this['channel'][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x91e6cb);this['createSquareMessage'](_0x91e6cb[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xec'),_0x91e6cb[_0xa950('0x5b')]));var _0x1c6cd9=this[_0xa950('0x77')][_0xa950('0xa2')](this,_0x91e6cb);if(_0x1c6cd9){for(var _0x6a45e8 in _0x1c6cd9){if(_0x1c6cd9['hasOwnProperty'](_0x6a45e8)){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xed'),_0x6a45e8[_0xa950('0x69')]()),_0x1c6cd9[_0x6a45e8]);}}this[_0xa950('0x40')](_0x1c6cd9[_0xa950('0xee')],'out','dialogflow','');return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('Dialogflow\x20Result\x20%s',_0x1c6cd9[_0xa950('0xee')]));}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x91e6cb,_0xa950('0xef'));};AGIVertices[_0xa950('0x12')]['dialogflowV2']=function(_0x6b17a8){logger['info'](util['format'](_0xa950('0xf0'),_0x6b17a8[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x6b17a8['dialogflowV2_project_id'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xf1'));}if(!this[_0xa950('0x83')](_0x6b17a8['client_email'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xf2'));}if(!this[_0xa950('0x83')](_0x6b17a8[_0xa950('0x7c')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xf3'));}if(!this[_0xa950('0x83')](_0x6b17a8[_0xa950('0x7d')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20anguage\x20configured');}if(!this[_0xa950('0x83')](_0x6b17a8['text'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xeb')]=!![];this['createSquareDetailsReport'](_0x6b17a8);this['createSquareMessage'](_0x6b17a8[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0xf4'),_0x6b17a8[_0xa950('0x5b')]));var _0x2a219e=this[_0xa950('0x79')][_0xa950('0xa2')](this,_0x6b17a8);if(_0x2a219e){for(var _0x497e47 in _0x2a219e){if(_0x2a219e[_0xa950('0x97')](_0x497e47)){if(_0x497e47!=='providerResponse'){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xed'),_0x497e47[_0xa950('0x69')]()),_0x2a219e[_0x497e47]);}}}this[_0xa950('0x40')](_0x2a219e[_0xa950('0xee')],_0xa950('0xf5'),'dialogflowV2',_0x2a219e[_0xa950('0xf6')]);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xf7'),_0x2a219e[_0xa950('0xee')]));}return this['channel']['error'](_0x6b17a8,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xa950('0x12')][_0xa950('0xf8')]=function(_0x2ac74f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xf9'),_0x2ac74f['label']));if(!this['isConfigured'](_0x2ac74f['ndauth_url'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xfa'));}if(!this[_0xa950('0x83')](_0x2ac74f[_0xa950('0xfb')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20username\x20configured');}if(!this[_0xa950('0x83')](_0x2ac74f[_0xa950('0xfc')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x2ac74f[_0xa950('0xfd')])){return this['channel'][_0xa950('0xa9')](_0xa950('0xa6'));}this['channel'][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x2ac74f);this['createSquareMessage'](_0x2ac74f[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xfe'),_0x2ac74f['text']));var _0x5e8902=this[_0xa950('0x7e')][_0xa950('0xa2')](this,_0x2ac74f);if(_0x5e8902){for(var _0x1aef67 in _0x5e8902){if(_0x5e8902[_0xa950('0x97')](_0x1aef67)){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')]('SESTEK_NDA_%s',_0x1aef67[_0xa950('0x69')]()),_0x5e8902[_0x1aef67]);}}this[_0xa950('0x40')](_0x5e8902[_0xa950('0xee')],'out','sesteknda','');if(_0x5e8902[_0xa950('0xff')]){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x100'),_0x5e8902['audiofile']));var _0x2a831d=this[_0xa950('0xd')][_0xa950('0x101')](_0x5e8902[_0xa950('0xff')]);try{fs['unlink'](_0x5e8902[_0xa950('0xff')]+_0xa950('0x102'));}catch(_0x55fe1e){logger[_0xa950('0x2e')](_0x55fe1e);}return _0x2a831d;}else{return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x103'),_0x5e8902[_0xa950('0xee')]));}}return this[_0xa950('0xd')]['error'](_0x2ac74f,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa950('0x12')]['end']=function(_0x39e818){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x104'),_0x39e818[_0xa950('0xa5')]));return this[_0xa950('0xd')]['noop'](_0xa950('0x105'));};AGIVertices[_0xa950('0x12')][_0xa950('0x106')]=function(_0x41b90c){logger['info'](util[_0xa950('0x2a')](_0xa950('0x107'),_0x41b90c['label']));var _0x2718e5='';if(_0x41b90c[_0xa950('0x108')]){if(!this[_0xa950('0x83')](_0x41b90c[_0xa950('0x108')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x41b90c,_0xa950('0x109'));}else{var _0x1ff9e3=parseInt(_0x41b90c['trunk_id'],0xa);if(isNaN(_0x1ff9e3)){_0x2718e5=_0x41b90c[_0xa950('0x108')];}else{_0x2718e5=this[_0xa950('0x1c')][_0xa950('0xa2')](this,_0x41b90c[_0xa950('0x108')]);if(!_0x2718e5){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x41b90c,'no\x20trunk\x20found');}}}}else if(_0x41b90c[_0xa950('0x10a')]){_0x2718e5=_0x41b90c[_0xa950('0x10a')];}else{return this[_0xa950('0xd')]['error'](_0x41b90c,_0xa950('0x109'));}var _0x3a765b=this[_0xa950('0xd')][_0xa950('0x55')]('DIAL',[util[_0xa950('0x2a')]('SIP/%s/%s',_0x2718e5,_0x41b90c[_0xa950('0x47')]),_0x41b90c[_0xa950('0x64')],_0x41b90c[_0xa950('0xe6')],_0x41b90c[_0xa950('0x63')]]);if(_0x3a765b[_0xa950('0xa8')]===-0x1){return _0x3a765b;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Executed\x20command\x20%s',_0xa950('0xe4')));};AGIVertices[_0xa950('0x12')][_0xa950('0x10b')]=function(_0x4e4edf){logger['info'](util[_0xa950('0x2a')](_0xa950('0x10c'),_0x4e4edf[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0xa9')]('finally');};AGIVertices[_0xa950('0x12')][_0xa950('0x10d')]=function(_0x16f8e8){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x10e'),_0x16f8e8[_0xa950('0xa5')]));if(_0x16f8e8['retry']===0x0){return this[_0xa950('0xa1')](_0x16f8e8);}_0x16f8e8['retry']-=0x1;if(!this['isConfigured'](_0x16f8e8['file_id'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0x10f'));}var _0x1f149e=this[_0xa950('0x1e')]['sync'](this,_0x16f8e8[_0xa950('0x110')]);if(!_0x1f149e){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0x111'));}if(!this['isConfigured'](_0x16f8e8['variable_id'])){return this[_0xa950('0xd')]['error'](_0xa950('0xd8'));}var _0x388cb7=this[_0xa950('0xd')]['getData'](_0x1f149e,_0x16f8e8[_0xa950('0x112')],_0x16f8e8[_0xa950('0x113')]);var _0x224209=_0x388cb7['result']?_0x388cb7[_0xa950('0xa8')][_0xa950('0x114')]():'';logger[_0xa950('0x2f')](_0xa950('0x115'),JSON[_0xa950('0x71')](_0x388cb7));if(_0x388cb7['result']===-0x1){this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,_0x224209);return _0x388cb7;}else if(_0x388cb7[_0xa950('0xa0')]===_0xa950('0x64')){_0x388cb7[_0xa950('0xa8')]=_0x224209[_0xa950('0x94')]>=parseInt(_0x16f8e8[_0xa950('0x116')])?'x':'i';}else{_0x388cb7[_0xa950('0xa8')]=_0x224209[_0xa950('0x94')]>=parseInt(_0x16f8e8[_0xa950('0x116')])&&_0x224209[_0xa950('0x94')]<=parseInt(_0x16f8e8[_0xa950('0x113')])?'x':'i';}var _0x227aa4=this['getVariable']['sync'](this,_0x16f8e8[_0xa950('0xd7')]);if(!_0x227aa4){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](_0x227aa4,_0x224209);if(this[_0xa950('0x83')](_0x16f8e8[_0xa950('0x117')])){var _0x3d4b1d=parseInt(_0x16f8e8[_0xa950('0x117')],0xa);var _0x18013d=rs[_0xa950('0x118')]({'charset':'*','length':_0x3d4b1d});var _0x1b249b=_0x224209[_0xa950('0x94')];if(_0x1b249b>0x0){if(_0x1b249b>_0x3d4b1d){this['createSquareDetailsReport']['sync'](this,_0x16f8e8,_0x16f8e8['hiddendigitspos']===_0xa950('0x119')?_0x18013d+_0x224209['substr'](_0x3d4b1d):_0x224209[_0xa950('0x11a')](0x0,_0x1b249b-_0x3d4b1d)+_0x18013d);}else{this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x16f8e8,rs[_0xa950('0x118')]({'charset':'*','length':_0x1b249b}));}}else{this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,'');}}else{this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,_0x224209);}return _0x388cb7;};AGIVertices[_0xa950('0x12')][_0xa950('0xc')]=function(_0x164826){logger[_0xa950('0x2f')](util['format'](_0xa950('0x11b'),_0x164826[_0xa950('0xa5')]));return this[_0xa950('0x10d')](_0x164826);};AGIVertices[_0xa950('0x12')][_0xa950('0x11c')]=function(_0x4906a9){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x11d'),_0x4906a9['label']));this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x4906a9,_0x4906a9['goalname']);return this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x11e'),_0x4906a9[_0xa950('0x11f')]));};AGIVertices['prototype'][_0xa950('0x120')]=function(_0x2bd873){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x121'),_0x2bd873[_0xa950('0xa5')]));if(!this['isConfigured'](_0x2bd873[_0xa950('0x85')])||!this[_0xa950('0x83')](_0x2bd873[_0xa950('0x86')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x122'));}if(!this[_0xa950('0x83')](_0x2bd873['text'])){return this[_0xa950('0xd')]['noop']('no\x20text\x20configured');}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x123'),_0x2bd873[_0xa950('0x5b')]));var _0x1e48db=this['awsPolly'][_0xa950('0xa2')](this,_0x2bd873);if(_0x1e48db){this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x124'),_0x1e48db));var _0x44b70e=this['channel'][_0xa950('0x101')](_0x1e48db);try{fs[_0xa950('0x125')](_0x1e48db+_0xa950('0x102'));}catch(_0x2356a0){logger[_0xa950('0x2e')](_0x2356a0);}return _0x44b70e;}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2bd873,_0xa950('0x126'));};AGIVertices['prototype']['awslex']=function(_0x19c7a6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x127'),_0x19c7a6[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x19c7a6[_0xa950('0x85')])||!this[_0xa950('0x83')](_0x19c7a6[_0xa950('0x86')])){return this[_0xa950('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xa950('0x83')](_0x19c7a6['aws_bot_name'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x128'));}if(!this[_0xa950('0x83')](_0x19c7a6['text'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x19c7a6);this[_0xa950('0x40')](_0x19c7a6[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x19c7a6[_0xa950('0x5b')]));var _0x4e0373=this[_0xa950('0x89')]['sync'](this,_0x19c7a6);if(_0x4e0373){for(var _0x48d853 in _0x4e0373){if(_0x4e0373['hasOwnProperty'](_0x48d853)&&_['isString'](_0x4e0373[_0x48d853])){this[_0xa950('0xd')]['setVariable'](util[_0xa950('0x2a')](_0xa950('0x129'),_0x48d853[_0xa950('0x69')]()),_0x4e0373[_0x48d853]);}}if(_[_0xa950('0x43')](_0x4e0373[_0xa950('0x74')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x12a'));}else{this[_0xa950('0x40')](_0x4e0373[_0xa950('0x74')],_0xa950('0xf5'),_0xa950('0x12b'),'');return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x12c'),_0x4e0373['message']));}}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x19c7a6,_0xa950('0x12d'));};AGIVertices['prototype'][_0xa950('0x12e')]=function(_0x5d3662){logger[_0xa950('0x2f')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5d3662[_0xa950('0xa5')],_0x5d3662[_0xa950('0x64')]));if(!this['isConfigured'](_0x5d3662[_0xa950('0x78')])){return this['channel'][_0xa950('0xa9')]('no\x20key\x20configured');}var _0x48a3c4=_0xa950('0x12f');var _0x151ccb=util[_0xa950('0x2a')](_0xa950('0x130'),FILES_PATH,rs[_0xa950('0x118')](0x4));var _0xc95f7e=util[_0xa950('0x2a')](_0xa950('0x98'),_0x151ccb,_0x48a3c4);var _0x2cf752=!![];if(_0x5d3662[_0xa950('0x131')]==='NOBEEP'){_0x2cf752=![];}var _0x57876f=this[_0xa950('0xd')][_0xa950('0x132')](_0x151ccb,_0x48a3c4,_0x5d3662[_0xa950('0x133')],_0x5d3662[_0xa950('0x64')],undefined,_0x2cf752);if(_0x57876f[_0xa950('0xa8')]!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x134'),_0xc95f7e));var _0x22819d=this[_0xa950('0x8c')][_0xa950('0xa2')](this,_0x5d3662,_0xc95f7e);if(_0x22819d){for(var _0x174082 in _0x22819d){if(_0x22819d[_0xa950('0x97')](_0x174082)){this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')]('GOOGLE_ASR_%s',_0x174082[_0xa950('0x69')]()),_0x22819d[_0x174082]);}}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x135'),JSON['stringify'](_0x22819d)));}}return _0x57876f;};AGIVertices[_0xa950('0x12')]['tildeasr']=function(_0x4d016c){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x136'),_0x4d016c['label']));if(!this[_0xa950('0x83')](_0x4d016c[_0xa950('0x137')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x138'));}if(!this[_0xa950('0x83')](_0x4d016c[_0xa950('0x8e')])){return this['channel']['noop'](_0xa950('0x139'));}var _0x53347b=_0xa950('0x12f');var _0x157f90=util[_0xa950('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2df3c8=util[_0xa950('0x2a')](_0xa950('0x98'),_0x157f90,_0x53347b);var _0x4322a4=!![];if(_0x4d016c[_0xa950('0x131')]===_0xa950('0x13a')){_0x4322a4=![];}var _0x3ccf59=this['channel'][_0xa950('0x132')](_0x157f90,_0x53347b,_0x4d016c[_0xa950('0x133')],_0x4d016c[_0xa950('0x64')],undefined,_0x4322a4);if(_0x3ccf59['result']!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x13b'),_0x2df3c8));var _0x1f4aa3=this[_0xa950('0x8d')][_0xa950('0xa2')](this,_0x4d016c,_0x2df3c8);if(_0x1f4aa3){for(var _0x36a987 in _0x1f4aa3){if(_0x1f4aa3[_0xa950('0x97')](_0x36a987)){this[_0xa950('0xd')]['setVariable'](util[_0xa950('0x2a')]('TILDE_ASR_%s',_0x36a987[_0xa950('0x69')]()),_0x1f4aa3[_0x36a987]);}}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x13c'),JSON[_0xa950('0x71')](_0x1f4aa3)));}}return _0x3ccf59;};AGIVertices[_0xa950('0x12')][_0xa950('0x13d')]=function(_0x275f28){logger['info'](util[_0xa950('0x2a')](_0xa950('0x13e'),_0x275f28[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x13f')](_0x275f28[_0xa950('0x140')],_0x275f28[_0xa950('0x141')],_0x275f28[_0xa950('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x4566d4){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4566d4[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x4566d4[_0xa950('0x142')])){return this[_0xa950('0xd')]['error'](_0x4566d4,'no\x20condition\x20configured');}try{var _0x14ce6b=eval(_0x4566d4['condition'])?_0xa950('0x143'):_0xa950('0x144');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4566d4[_0xa950('0x142')],_0x14ce6b));return{'code':0xc8,'result':_0x14ce6b};}catch(_0x4b7a2c){return{'code':0xc8,'result':_0xa950('0x144')};}};AGIVertices['prototype'][_0xa950('0x145')]=function(_0x18203b){logger[_0xa950('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x18203b[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x18203b[_0xa950('0x146')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x18203b,_0xa950('0x147'));}var _0x240f85=this[_0xa950('0x148')][_0xa950('0xa2')](this,_0x18203b[_0xa950('0x146')]);if(!_0x240f85){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x18203b,_0xa950('0x149'));}for(var _0x4feeca=0x0;_0x4feeca<_0x240f85['length'];_0x4feeca+=0x1){var _0x4d2a33=this['channel'][_0xa950('0x9e')](util['format']('IFTIME(%s?true:false)',_0x240f85[_0x4feeca]));if(_0x4d2a33[_0xa950('0xa8')]===-0x1){return _0x4d2a33;}logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0x4d2a33['extra']));if(_0x4d2a33['extra']===_0xa950('0x143')){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14a'),_0x240f85[_0x4feeca],'true'));this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0xa950('0x143')));return{'code':0xc8,'result':_0xa950('0x143')};}else{logger[_0xa950('0x2f')](util['format'](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0xa950('0x144')));this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('IFTIME\x20%s\x20%s',_0x240f85[_0x4feeca],_0xa950('0x144')));}}return{'code':0xc8,'result':_0xa950('0x144')};};AGIVertices[_0xa950('0x12')][_0xa950('0x14b')]=function(_0x541098){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14c'),_0x541098[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x14b')]();};AGIVertices[_0xa950('0x12')][_0xa950('0x14d')]=function(_0x335494){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14e'),_0x335494[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x335494['key'])){return this[_0xa950('0xd')]['noop'](_0xa950('0xea'));}var _0xeb6aaf=_0xa950('0x12f');var _0x4ce1a7=util[_0xa950('0x2a')](_0xa950('0x130'),FILES_PATH,rs[_0xa950('0x118')](0x4));var _0x4f1cab=util[_0xa950('0x2a')](_0xa950('0x98'),_0x4ce1a7,_0xeb6aaf);var _0x3da5d5=!![];if(_0x335494[_0xa950('0x131')]==='NOBEEP'){_0x3da5d5=![];}var _0x47c82b=this['channel'][_0xa950('0x132')](_0x4ce1a7,_0xeb6aaf,_0x335494['intKey'],_0x335494[_0xa950('0x64')],undefined,_0x3da5d5);if(_0x47c82b[_0xa950('0xa8')]!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x14f'),_0x4f1cab));var _0x2c5307=this[_0xa950('0x82')][_0xa950('0xa2')](this,_0x335494,_0x4f1cab);if(_0x2c5307){for(var _0x81789a in _0x2c5307){if(_0x2c5307[_0xa950('0x97')](_0x81789a)){this[_0xa950('0xd')][_0xa950('0x99')](util['format'](_0xa950('0x150'),_0x81789a[_0xa950('0x69')]()),_0x2c5307[_0x81789a]);}}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x151'),JSON[_0xa950('0x71')](_0x2c5307)));}}return _0x47c82b;};AGIVertices[_0xa950('0x12')][_0xa950('0x152')]=function(_0x3287c7){logger[_0xa950('0x2f')](util['format'](_0xa950('0x153'),_0x3287c7[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x3287c7[_0xa950('0x78')])){return this['channel'][_0xa950('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x3287c7[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x154'),_0x3287c7[_0xa950('0x5b')]));var _0xeec1de=this[_0xa950('0x7f')][_0xa950('0xa2')](this,_0x3287c7);if(_0xeec1de){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x14f'),_0xeec1de));var _0x3d5eaa=this['channel'][_0xa950('0x101')](_0xeec1de,_0x3287c7[_0xa950('0x133')]);try{fs[_0xa950('0x125')](_0xeec1de+_0xa950('0x102'));}catch(_0x1938ee){logger['error'](_0x1938ee);}return _0x3d5eaa;}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x3287c7,_0xa950('0x155'));};AGIVertices['prototype']['login']=function(_0x38785d){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x156'),_0x38785d[_0xa950('0xa5')]));if(!this['isConfigured'](_0x38785d['findBy'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x38785d,_0xa950('0x157'));}logger[_0xa950('0x2f')](util['format'](_0xa950('0x158'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));var _0x2a67cd=this['agentLogin'][_0xa950('0xa2')](this,_0x38785d['findBy']);if(_0x2a67cd){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel'][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));this[_0xa950('0xd')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15d')};}};AGIVertices[_0xa950('0x12')][_0xa950('0x15e')]=function(_0x4b97bb){logger[_0xa950('0x2f')](util['format'](_0xa950('0x15f'),_0x4b97bb[_0xa950('0xa5')]));if(!this['isConfigured'](_0x4b97bb[_0xa950('0x159')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x4b97bb,_0xa950('0x157'));}logger['info'](util[_0xa950('0x2a')](_0xa950('0x158'),this['channel'][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));var _0x254458=this[_0xa950('0x50')][_0xa950('0xa2')](this,_0x4b97bb[_0xa950('0x159')]);if(_0x254458){logger['info'](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')]['callerid'],_0x4b97bb['findBy']));this['channel']['noop'](util['format'](_0xa950('0x15a'),this[_0xa950('0xd')]['callerid'],_0x4b97bb[_0xa950('0x159')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa950('0x2a')](_0xa950('0x15c'),this[_0xa950('0xd')][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel'][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa950('0x160')]=function(_0x57f37e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x161'),_0x57f37e[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x57f37e['operation'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x57f37e,_0xa950('0x162'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x163'),_0x57f37e[_0xa950('0x164')]));var _0x4918c9=eval(_0x57f37e['operation']);if(!this[_0xa950('0x83')](_0x57f37e['variable_id'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xd8'));}var _0x122912=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x57f37e[_0xa950('0xd7')]);if(!_0x122912){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x57f37e,_0xa950('0xd9'));}if(_[_0xa950('0x93')](_0x4918c9)){var _0x2b8df0=this;_0x4918c9[_0xa950('0xda')](function(_0x1b1586,_0x54cf35){_0x2b8df0[_0xa950('0xd')]['setVariable'](util['format'](_0xa950('0x165'),_0x122912,_0x54cf35),_0x1b1586);});return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x166'),_0x122912));}else{return this[_0xa950('0xd')]['setVariable'](_0x122912,_0x4918c9);}};AGIVertices[_0xa950('0x12')][_0xa950('0x167')]=function(_0x74da7f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x168'),_0x74da7f['label']));if(_0x74da7f[_0xa950('0xa3')]===0x0){return this[_0xa950('0xa1')](_0x74da7f);}_0x74da7f[_0xa950('0xa3')]-=0x1;if(!this[_0xa950('0x83')](_0x74da7f[_0xa950('0x110')])){return this['channel'][_0xa950('0x2e')](_0x74da7f,'no\x20file\x20audio\x20selected');}var _0x630382=this['getSound'][_0xa950('0xa2')](this,_0x74da7f[_0xa950('0x110')]);if(!_0x630382){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x74da7f,_0xa950('0x111'));}var _0x11f9ce=this[_0xa950('0xd')][_0xa950('0x169')](_0x630382,_0x74da7f[_0xa950('0x112')],_0x74da7f[_0xa950('0x16a')]);var _0x48d6bf=_0x11f9ce[_0xa950('0xa8')];if(_0x11f9ce[_0xa950('0xa8')]===-0x1){this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x74da7f,'-1');return _0x11f9ce;}else if(_0x11f9ce[_0xa950('0xa0')]===_0xa950('0x64')){_0x11f9ce['result']=_0x11f9ce[_0xa950('0xa8')][_0xa950('0x94')]>0x0?_0x11f9ce[_0xa950('0xa8')]:'t';}else if(_[_0xa950('0x42')](_0x11f9ce['result'])){_0x11f9ce['result']='#';_0x48d6bf='#';}if(!this[_0xa950('0x83')](_0x74da7f['variable_id'])){this[_0xa950('0xd')]['noop'](_0xa950('0xd8'));}else{var _0x21b6ad=this['getVariable']['sync'](this,_0x74da7f[_0xa950('0xd7')]);if(!_0x21b6ad){return this[_0xa950('0xd')]['error'](_0x74da7f,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](_0x21b6ad,_0x48d6bf);}this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x74da7f,_0x48d6bf);return _0x11f9ce;};AGIVertices[_0xa950('0x12')]['noop']=function(_0x7ac442){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x16b'),_0x7ac442[_0xa950('0xa5')]));return this['channel'][_0xa950('0xa9')](_0x7ac442[_0xa950('0x16c')]||_0x7ac442[_0xa950('0xa5')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x16d')]=function(_0x519d96){logger[_0xa950('0x2f')](util['format'](_0xa950('0x16e'),_0x519d96[_0xa950('0xa5')]));if(!this['isConfigured'](_0x519d96[_0xa950('0x159')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x519d96,_0xa950('0x157'));}logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));var _0x125fb1=this[_0xa950('0x4c')][_0xa950('0xa2')](this,_0x519d96[_0xa950('0x16f')]);var _0x5d1a40=this[_0xa950('0x4d')][_0xa950('0xa2')](this,_0x519d96[_0xa950('0x159')],_0x125fb1);if(_0x5d1a40){logger['info'](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this['channel'][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15d')};}};AGIVertices[_0xa950('0x12')][_0xa950('0x170')]=function(_0x46e29f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x171'),_0x46e29f[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x46e29f[_0xa950('0x110')])){return this['channel'][_0xa950('0x2e')](_0x46e29f,_0xa950('0x10f'));}var _0x52260d=this['getSound'][_0xa950('0xa2')](this,_0x46e29f[_0xa950('0x110')]);if(!_0x52260d){return this[_0xa950('0xd')]['error'](_0x46e29f,_0xa950('0x111'));}var _0x188542=this[_0xa950('0xd')][_0xa950('0x55')]('PLAYBACK',[_0x52260d,_0x46e29f[_0xa950('0xe6')]]);if(_0x188542[_0xa950('0xa8')]===-0x1){return _0x188542;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),'PLAYBACK',_0x52260d));};AGIVertices[_0xa950('0x12')][_0xa950('0x172')]=function(_0x50bbef){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x173'),_0x50bbef['label']));if(!this['isConfigured'](_0x50bbef['queue_id'])){return this[_0xa950('0xd')]['error'](_0x50bbef,'no\x20queue\x20selected');}var _0x56c3d5='';var _0x19b738=parseInt(_0x50bbef['queue_id'],0xa);if(isNaN(_0x19b738)){_0x56c3d5=_0x50bbef[_0xa950('0x174')];}else{_0x56c3d5=this[_0xa950('0x13')]['sync'](this,_0x50bbef[_0xa950('0x174')]);if(!_0x56c3d5){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x50bbef,_0xa950('0x175'));}}var _0x437554='';if(this[_0xa950('0x83')](_0x50bbef[_0xa950('0x110')])){var _0x1705c6=this['getSound'][_0xa950('0xa2')](this,_0x50bbef[_0xa950('0x110')]);if(_0x1705c6){_0x437554=_0x1705c6;}}this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x50bbef,_0x56c3d5);if(_0x50bbef[_0xa950('0xe6')]['indexOf']('x')<0x0){_0x50bbef[_0xa950('0xe6')]+='x';}if(_0x50bbef[_0xa950('0xe6')][_0xa950('0x176')]('X')<0x0){_0x50bbef[_0xa950('0xe6')]+='X';}this[_0xa950('0xd')]['setVariable'](_0xa950('0x177'),_0x56c3d5?_0x56c3d5[_0xa950('0x178')]():'');var _0x40c38f=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0x179'),[_0x56c3d5,_0x50bbef['opts'],_0x50bbef[_0xa950('0x63')],_0x437554,_0x50bbef['timeout'],_0x50bbef[_0xa950('0xb5')],_0x50bbef[_0xa950('0x17a')],_0x50bbef[_0xa950('0x17b')],'',_0x50bbef[_0xa950('0x17c')]]);if(_0x40c38f[_0xa950('0xa8')]===-0x1){return _0x40c38f;}return this['channel'][_0xa950('0xa9')](util['format'](_0xa950('0xc4'),_0xa950('0x179'),_0x56c3d5));};AGIVertices[_0xa950('0x12')][_0xa950('0x17d')]=function(_0x261d33){logger[_0xa950('0x2f')](util['format'](_0xa950('0x17e'),_0x261d33['label']));var _0x2cf67c=_0x261d33[_0xa950('0x17f')]||_0xa950('0x12f');var _0x55f3ad=util['format'](_0xa950('0x180'),this[_0xa950('0xd')][_0xa950('0x36')],rs[_0xa950('0x118')](0x5));var _0x5e8d50=util[_0xa950('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x55f3ad,_0x2cf67c);var _0x28818e=util[_0xa950('0x2a')]('%s/recordings/%s',FILES_PATH,_0x55f3ad);this[_0xa950('0x39')]['sync'](this,_0x261d33,_0x55f3ad,_0x5e8d50);this[_0xa950('0xd')][_0xa950('0x99')]('RECORDING_SAVENAME',_0x55f3ad);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x28818e,_0x2cf67c,_0x261d33['escape_digits'],_0x261d33[_0xa950('0x64')]);return this['channel'][_0xa950('0x132')](_0x28818e,_0x2cf67c,_0x261d33[_0xa950('0x181')],_0x261d33[_0xa950('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xa950('0x182')]=function(_0x528888){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x183'),_0x528888[_0xa950('0xa5')]));if(!this['isConfigured'](_0x528888[_0xa950('0x63')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x184'));}var _0x14865d=this[_0xa950('0x185')][_0xa950('0xa2')](this,_0x528888);logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x186'),util[_0xa950('0x187')](_0x14865d,{'showHidden':![],'depth':null})));if(!this[_0xa950('0x83')](_0x528888[_0xa950('0xd7')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x188'));}var _0x1a2f1e=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x528888[_0xa950('0xd7')]);if(!_0x1a2f1e){return this[_0xa950('0xd')]['error'](_0x528888,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x189'),_0x1a2f1e),_0x14865d['statusCode']?_0x14865d['statusCode']:_0xa950('0x18a'));this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x18b'),_0x1a2f1e),_0x14865d[_0xa950('0x18c')]?_0x14865d[_0xa950('0x18c')]:'OK');if(_0x14865d[_0xa950('0x6a')]){try{this['saveRestApiResult'](_0x14865d[_0xa950('0x6a')],_0x1a2f1e);}catch(_0x334d24){logger[_0xa950('0x2e')](util[_0xa950('0x2a')](_0xa950('0x18d'),_0x1a2f1e));}}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('variable\x20%s\x20set',_0x1a2f1e));};AGIVertices['prototype']['saydigits']=function(_0x52f7b0){logger[_0xa950('0x2f')](util['format'](_0xa950('0x18e'),_0x52f7b0[_0xa950('0xa5')]));return this[_0xa950('0xd')]['sayDigits'](_0x52f7b0['digits'][_0xa950('0x57')](/\s+/g,''),_0x52f7b0[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x18f')]=function(_0x3050c0){logger['info'](util[_0xa950('0x2a')](_0xa950('0x190'),_0x3050c0[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x191')](_0x3050c0[_0xa950('0x65')]['replace'](/\s+/g,''),_0x3050c0[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x192')]=function(_0x5dc882){logger['info'](util[_0xa950('0x2a')](_0xa950('0x193'),_0x5dc882[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x194')](_0x5dc882['text'],_0x5dc882[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')]['sendMail']=function(_0x14cefb){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x195'),_0x14cefb['label']));if(!this[_0xa950('0x83')](_0x14cefb[_0xa950('0x196')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x197'));}var _0x3bdc61=this[_0xa950('0x22')]['sync'](this,_0x14cefb['account_id']);if(!_0x3bdc61||!_0x3bdc61[_0xa950('0x198')]){return this[_0xa950('0xd')]['error'](_0x14cefb,'no\x20mail\x20account\x20found');}var _0x24f031={'from':util[_0xa950('0x2a')](_0xa950('0x199'),_0x3bdc61[_0xa950('0x11')],_0x3bdc61[_0xa950('0x19a')]||_0x3bdc61[_0xa950('0x198')][_0xa950('0x19b')]),'to':_0x14cefb['to']||'','cc':_0x14cefb['cc']||'','bcc':_0x14cefb['bcc']||'','subject':_0x14cefb[_0xa950('0x19c')],'html':_0x14cefb[_0xa950('0x5b')],'text':_0x14cefb[_0xa950('0x5b')]};if(this['isConfigured'](_0x14cefb[_0xa950('0x19d')])){}logger[_0xa950('0xdf')](_0xa950('0x19e'),JSON[_0xa950('0x71')](_0x24f031));this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x14cefb,_0x14cefb[_0xa950('0x196')]);this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3bdc61[_0xa950('0x11')]));this[_0xa950('0x25')][_0xa950('0xa2')](this,_0x3bdc61['smtpOptions'],_0x24f031);return this['channel'][_0xa950('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa950('0x12')][_0xa950('0x19f')]=function(_0x5a7fa9){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1a0'),_0x5a7fa9['label']));return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1a1'));};AGIVertices[_0xa950('0x12')]['sendSMS']=function(_0x1a1909){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1a2'),_0x1a1909[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x1a1909['sms_account_id'])){return this[_0xa950('0xd')]['noop']('no\x20sms\x20account\x20configured');}var _0x653f3b=this[_0xa950('0x33')][_0xa950('0xa2')](this,_0x1a1909['sms_account_id']);if(!_0x653f3b){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1a1909,_0xa950('0x1a3'));}var _0x494532={'body':_0x1a1909[_0xa950('0x1a4')],'phone':_0x1a1909['to']||'','SmsAccountId':_0x653f3b['id']};logger[_0xa950('0xdf')]('sendSMS\x20message',JSON[_0xa950('0x71')](_0x494532));this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x1a1909,_0x1a1909[_0xa950('0x1a5')]);this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1a6'),_0x653f3b['name']));this[_0xa950('0x34')][_0xa950('0xa2')](this,_0x494532);return this[_0xa950('0xd')][_0xa950('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa950('0x12')][_0xa950('0x1a7')]=function(_0x1a72e5){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1a72e5['label']));if(!this[_0xa950('0x83')](_0x1a72e5[_0xa950('0xd7')])){return this[_0xa950('0xd')]['error'](_0x1a72e5,'no\x20variable\x20selected');}var _0x2b52bf=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x1a72e5['variable_id']);if(!_0x2b52bf){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1a72e5,_0xa950('0xd9'));}return this['channel']['setVariable'](_0x2b52bf,_0x1a72e5[_0xa950('0x1a8')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x1a9')]=function(_0x4b0b90){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1aa'),_0x4b0b90['label']));this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ab'));var _0x5161bd=this[_0xa950('0xd')][_0xa950('0x9e')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x5161bd[_0xa950('0xa0')])){this[_0xa950('0xd')][_0xa950('0x36')]=_0x5161bd[_0xa950('0xa0')];}if(_0x4b0b90[_0xa950('0xb9')]===_0xa950('0x1ac')){this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ad'));return this['channel'][_0xa950('0xb9')]();}return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ae'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1af')]=function(_0x2e3868){logger['info'](util['format'](_0xa950('0x1b0'),_0x2e3868[_0xa950('0xa5')]));if(!this['isConfigured'](_0x2e3868[_0xa950('0x1b1')])){return this[_0xa950('0xd')]['error'](_0x2e3868,_0xa950('0x1b2'));}var _0x844d71=this['getSquareProject']['sync'](this,_0x2e3868['project_id']);if(!this[_0xa950('0x83')](_0x844d71)){return this['channel'][_0xa950('0x2e')](_0x2e3868,util['format'](_0xa950('0x1b3'),_0x2e3868[_0xa950('0x1b1')]));}if(_0x844d71===this[_0xa950('0xd')][_0xa950('0x3e')]){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2e3868,_0xa950('0x1b4'));}this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x2e3868,_0x844d71);var _0x412e04=this['channel'][_0xa950('0x55')]('AGI',util[_0xa950('0x2a')](_0xa950('0x1b5'),config[_0xa950('0xb5')][_0xa950('0x1b6')]||'127.0.0.1',_0x844d71,this['channel'][_0xa950('0x3e')]));if(_0x412e04[_0xa950('0xa8')]===-0x1){return _0x412e04;}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')]('Executed\x20command\x20%s\x20%s',_0xa950('0x1b7'),_0x844d71));};AGIVertices[_0xa950('0x12')][_0xa950('0x1b8')]=function(_0x1f65be){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1b9'),_0x1f65be[_0xa950('0xa5')]));var _0x20f540=this['shellCommand'][_0xa950('0xa2')](this,_0x1f65be['command']);this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x1f65be,_0x1f65be[_0xa950('0xb7')]);if(this[_0xa950('0x83')](_0x1f65be[_0xa950('0xd7')])){var _0x568c83=this['getVariable'][_0xa950('0xa2')](this,_0x1f65be[_0xa950('0xd7')]);if(_0x568c83){this[_0xa950('0xd')][_0xa950('0x99')](_0x568c83,_0x20f540);return this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1ba'),_0x1f65be['command'],_0x568c83));}}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x1bb'),_0x1f65be[_0xa950('0xb7')]));};AGIVertices[_0xa950('0x12')]['google_cloud_tts']=function(_0x2b0cac){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1bc'),_0x2b0cac[_0xa950('0xa5')]));_0x2b0cac[_0xa950('0x5b')]=_0x2b0cac[_0xa950('0x5b')][_0xa950('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa950('0x83')](_0x2b0cac[_0xa950('0x59')])){return this[_0xa950('0xd')]['noop'](_0xa950('0x1bd'));}if(!this[_0xa950('0x83')](_0x2b0cac['text'])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20text\x20configured');}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1be'),_0x2b0cac[_0xa950('0x5b')]));var _0x2ec3b0=this['googleCloudTTS'][_0xa950('0xa2')](this,_0x2b0cac);if(_0x2ec3b0){this[_0xa950('0xd')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2ec3b0));var _0x34886b=this[_0xa950('0xd')]['streamFile'](_0x2ec3b0);try{fs[_0xa950('0x125')](_0x2ec3b0+_0xa950('0x102'));}catch(_0x42ad6f){logger[_0xa950('0x2e')](_0x42ad6f);}return _0x34886b;}return this['channel']['error'](_0x2b0cac,_0xa950('0x1bf'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1c0')]=function(_0x4dbffd){logger['info'](util[_0xa950('0x2a')](_0xa950('0x1c1'),_0x4dbffd[_0xa950('0xa5')]));_0x4dbffd[_0xa950('0x5b')]=_0x4dbffd[_0xa950('0x5b')][_0xa950('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa950('0x83')](_0x4dbffd[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1c2'),_0x4dbffd['text']));var _0x31a58e=this[_0xa950('0x61')][_0xa950('0xa2')](this,_0x4dbffd);if(_0x31a58e){this['channel'][_0xa950('0xa9')](util['format'](_0xa950('0x1c3'),_0x31a58e));var _0x37505c=this[_0xa950('0xd')][_0xa950('0x101')](_0x31a58e);try{fs[_0xa950('0x125')](_0x31a58e+_0xa950('0x102'));}catch(_0x583e66){logger[_0xa950('0x2e')](_0x583e66);}return _0x37505c;}return this['channel'][_0xa950('0x2e')](_0x4dbffd,_0xa950('0x1c4'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1c5')]=function(_0x1eb94e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1c6'),_0x1eb94e[_0xa950('0xa5')]));if(!this['isConfigured'](_0x1eb94e['findBy'])){return this['channel'][_0xa950('0x2e')](_0x1eb94e,_0xa950('0x157'));}logger[_0xa950('0x2f')](util['format'](_0xa950('0x158'),this[_0xa950('0xd')]['callerid'],_0x1eb94e[_0xa950('0x159')]));var _0x42b76e=this['agentUnpause'][_0xa950('0xa2')](this,_0x1eb94e[_0xa950('0x159')]);if(_0x42b76e){logger[_0xa950('0x2f')](util['format'](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e['findBy']));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel']['callerid'],_0x1eb94e[_0xa950('0x159')]));this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x15c'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e[_0xa950('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa950('0x12')]['voicemail']=function(_0x18f68a){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1c7'),_0x18f68a[_0xa950('0xa5')]));var _0x551740=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0x1c8'),[_0x18f68a[_0xa950('0x1c9')],_0x18f68a['options']]);if(_0x551740[_0xa950('0xa8')]===-0x1){return _0x551740;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),_0xa950('0x1c8'),_0x18f68a[_0xa950('0x1c9')]));};AGIVertices[_0xa950('0x12')][_0xa950('0x1ca')]=function(_0x3b4065){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1cb'),_0x3b4065[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x3b4065[_0xa950('0xd7')])){return this[_0xa950('0xd')]['error'](_0x3b4065,'no\x20variable\x20selected');}var _0x2746e1=this['getVariable']['sync'](this,_0x3b4065[_0xa950('0xd7')]);if(!_0x2746e1){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x3b4065,_0xa950('0xd9'));}var _0x13ed62=this[_0xa950('0xd')][_0xa950('0x9e')](_0x2746e1);return{'code':0xc8,'result':_0x13ed62[_0xa950('0xa0')]?_0x13ed62[_0xa950('0xa0')]:'-'};};String[_0xa950('0x12')][_0xa950('0x9d')]=function(_0x3d02b8,_0x542c32){return this['split'](_0x3d02b8)[_0xa950('0x1cc')](_0x542c32);};module[_0xa950('0x1cd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 5eaeef2..bf04208 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 _0xa251=['startAcw','interface','queue','ACW','mandatoryDispositionPause','name','resolve','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','catch','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','update','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','diff','seconds','lastPauseAt','timer','uniqueid','then','info','error','[%s][UPDATE][ERRORS:%s]','finally','prototype'];(function(_0x399671,_0x21dd0a){var _0x3792b3=function(_0xfd7ea4){while(--_0xfd7ea4){_0x399671['push'](_0x399671['shift']());}};_0x3792b3(++_0x21dd0a);}(_0xa251,0xdb));var _0x1a25=function(_0x2c0bad,_0x68a26b){_0x2c0bad=_0x2c0bad-0x0;var _0x4c3417=_0xa251[_0x2c0bad];return _0x4c3417;};'use strict';var _=require('lodash');var moment=require(_0x1a25('0x0'));var ami=require(_0x1a25('0x1'));var logger=require(_0x1a25('0x2'))(_0x1a25('0x3'));var RpcUser=require(_0x1a25('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5b14a9){this[_0x1a25('0x5')]=_0x5b14a9[_0x1a25('0x5')];this[_0x1a25('0x6')]=_0x5b14a9['agents'];this[_0x1a25('0x7')]=_0x5b14a9[_0x1a25('0x7')];this[_0x1a25('0x8')]={};ami['on'](_0x1a25('0x9'),this[_0x1a25('0xa')][_0x1a25('0xb')](this));ami['on'](_0x1a25('0xc'),this[_0x1a25('0xd')][_0x1a25('0xb')](this));ami['on'](_0x1a25('0xe'),this[_0x1a25('0xf')][_0x1a25('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x1a25('0xb')](this));ami['on'](_0x1a25('0x10'),this[_0x1a25('0x11')][_0x1a25('0xb')](this));ami['on']('blindtransfer',this[_0x1a25('0x12')][_0x1a25('0xb')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x2c8de7){var _0x408156=moment()['milliseconds'](0x0);var _0x3de5f0=moment(_0x2c8de7)['milliseconds'](0x0);return _0x408156[_0x1a25('0x13')](_0x3de5f0,_0x1a25('0x14'));}Acw['prototype']['updateAcw']=function(_0x313fec,_0x34d9d6){var _0x359d09=this;var _0x56d4cc=getDiff(_0x359d09['timers'][_0x313fec][_0x1a25('0x15')]);clearTimeout(_0x359d09[_0x1a25('0x7')][_0x313fec][_0x1a25('0x16')]);_0x359d09[_0x1a25('0x7')][_0x313fec][_0x1a25('0x16')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x56d4cc},_0x359d09[_0x1a25('0x7')][_0x313fec][_0x1a25('0x17')],_0x313fec)[_0x1a25('0x18')](function(_0x392699){logger[_0x1a25('0x19')]('[%s][UPDATE][ACWTIME:%s]',_0x34d9d6,_0x56d4cc,_0x392699);})['catch'](function(_0x5903e6){logger[_0x1a25('0x1a')](_0x1a25('0x1b'),_0x34d9d6,_0x5903e6);})[_0x1a25('0x1c')](function(){delete _0x359d09[_0x1a25('0x7')][_0x313fec];});};Acw[_0x1a25('0x1d')][_0x1a25('0x1e')]=function(_0xb9735a){try{var _0x47a9e9=this;var _0x383476=this['channels'][_0xb9735a][_0x1a25('0x1f')];var _0x2c654e=this[_0x1a25('0x8')][_0xb9735a][_0x1a25('0x20')];var _0x241149=this[_0x1a25('0x5')][_0x2c654e];var _0x5441e9=![];var _0x797a4f=_0x1a25('0x21');if(_0x241149['mandatoryDisposition']&&_0x241149[_0x1a25('0x22')][_0x1a25('0x23')]){_0x5441e9=!![];_0x797a4f=_0x241149[_0x1a25('0x22')][_0x1a25('0x23')];}if(!_0x47a9e9[_0x1a25('0x6')][_0x383476]){return Promise[_0x1a25('0x24')]();}return RpcUser['getAgent'](_0x47a9e9[_0x1a25('0x6')][_0x383476]['id'])[_0x1a25('0x18')](function(_0xa20bab){if(!_0xa20bab||_0xa20bab['voicePause']){logger[_0x1a25('0x19')](_0x1a25('0x25'),_0xb9735a,_0x383476,_0x2c654e);return;}logger['info'](_0x1a25('0x26'),_0xb9735a,_0x383476,_0x2c654e);var _0x47a469=_0x47a9e9[_0x1a25('0x8')][_0xb9735a][_0x1a25('0x27')]&&_0x47a9e9[_0x1a25('0x8')][_0xb9735a]['destlinkedid']?_0x47a9e9[_0x1a25('0x8')][_0xb9735a][_0x1a25('0x28')]:_0xb9735a;return RpcUser[_0x1a25('0x29')](_0x47a9e9[_0x1a25('0x6')][_0x383476],_0x797a4f,_0x47a469)[_0x1a25('0x18')](function(_0x334478){_0x47a9e9[_0x1a25('0x5')][_0x2c654e][_0x1a25('0x2a')]-=0x1;_0x47a9e9[_0x1a25('0x5')][_0x2c654e][_0x1a25('0x2b')]+=0x1;return _0x334478;});})[_0x1a25('0x18')](function(_0x4816db){if(_0x5441e9||!_0x4816db){return;}_0x47a9e9['timers'][_0x383476]={};logger[_0x1a25('0x19')](_0x1a25('0x2c'),_0xb9735a,_0x47a9e9['voiceQueues'][_0x2c654e]['acwTimeout'],_0x383476,_0x2c654e);_0x47a9e9[_0x1a25('0x7')][_0x383476][_0x1a25('0x16')]=setTimeout(_0x47a9e9[_0x1a25('0x2d')][_0x1a25('0xb')](_0x47a9e9,_0x383476),_0x47a9e9[_0x1a25('0x5')][_0x2c654e][_0x1a25('0x2e')]*0x3e8);_0x47a9e9[_0x1a25('0x7')][_0x383476][_0x1a25('0x15')]=moment()[_0x1a25('0x2f')](_0x1a25('0x30'));_0x47a9e9['timers'][_0x383476][_0x1a25('0x17')]=_0xb9735a;_0x47a9e9[_0x1a25('0x7')][_0x383476][_0x1a25('0x20')]=_0x2c654e;_0x47a9e9[_0x1a25('0x7')][_0x383476]['updateAcw']=_0x47a9e9['updateAcw']['bind'](_0x47a9e9,_0x383476,_0xb9735a);})[_0x1a25('0x31')](function(){logger[_0x1a25('0x1a')](_0x1a25('0x2c'),_0xb9735a,_0x47a9e9[_0x1a25('0x5')][_0x2c654e]['acwTimeout'],_0x383476,_0x2c654e);})['finally'](function(){delete _0x47a9e9[_0x1a25('0x8')][_0xb9735a];});}catch(_0x600aad){logger[_0x1a25('0x1a')](_0x1a25('0x32'),_0x600aad[_0x1a25('0x33')]);}};Acw[_0x1a25('0x1d')][_0x1a25('0x2d')]=function(_0x279489){try{var _0x3c13a3=this;if(_0x3c13a3[_0x1a25('0x7')][_0x279489]){_0x3c13a3[_0x1a25('0x7')][_0x279489][_0x1a25('0x16')]=![];var _0x53946f=_0x3c13a3[_0x1a25('0x7')][_0x279489][_0x1a25('0x17')];var _0x37c14=_0x3c13a3[_0x1a25('0x7')][_0x279489][_0x1a25('0x20')];var _0xab6179=_0x3c13a3['voiceQueues'][_0x37c14][_0x1a25('0x2e')];logger[_0x1a25('0x19')](_0x1a25('0x34'),_0x53946f,_0x279489);RpcUser['getAgent'](this['agents'][_0x279489]['id'])[_0x1a25('0x18')](function(_0x49b7d4){if(_0x49b7d4['pauseType']===_0x1a25('0x21')){return RpcUser['saveUnpause'](_0x3c13a3[_0x1a25('0x6')][_0x279489]);}});RpcVoiceAgentReport[_0x1a25('0x35')]({'acwtime':_0xab6179,'agentacw':!![]},_0x53946f,_0x279489)[_0x1a25('0x18')](function(_0x4c0a28){logger[_0x1a25('0x19')](_0x1a25('0x36'),_0x53946f,_0xab6179,_0x4c0a28);})['catch'](function(_0x5f119c){logger[_0x1a25('0x1a')](_0x1a25('0x1b'),_0x53946f,_0x5f119c);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x279489);if(_0x3c13a3[_0x1a25('0x7')]){logger[_0x1a25('0x19')](_0x1a25('0x37'),JSON['stringify'](_0x3c13a3[_0x1a25('0x7')]));}}}catch(_0x1f9d8c){logger[_0x1a25('0x1a')]('[ACW][STOP]\x20%s',_0x1f9d8c['message']);}};Acw[_0x1a25('0x1d')]['syncAgentConnect']=function(_0x10c9a8){try{if(this['voiceQueues'][_0x10c9a8[_0x1a25('0x20')]]&&(this['voiceQueues'][_0x10c9a8[_0x1a25('0x20')]][_0x1a25('0x3')]||this[_0x1a25('0x5')][_0x10c9a8[_0x1a25('0x20')]][_0x1a25('0x38')])){if(this[_0x1a25('0x6')][_0x10c9a8['interface']]){this['channels'][_0x10c9a8['uniqueid']]={'queue':_0x10c9a8[_0x1a25('0x20')],'interface':_0x10c9a8[_0x1a25('0x1f')],'destlinkedid':_0x10c9a8[_0x1a25('0x28')]};}}}catch(_0x26b253){logger['error'](_0x1a25('0x39'),_0x26b253['message']);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x39fa72){try{if(this['voiceQueues'][_0x39fa72['queue']]&&(this[_0x1a25('0x5')][_0x39fa72[_0x1a25('0x20')]]['acw']||this[_0x1a25('0x5')][_0x39fa72['queue']][_0x1a25('0x38')])){if(this['agents'][_0x39fa72['interface']]){this[_0x1a25('0x8')][_0x39fa72[_0x1a25('0x17')]]={'queue':_0x39fa72[_0x1a25('0x20')],'interface':_0x39fa72[_0x1a25('0x1f')]};}}}catch(_0xed1960){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0xed1960[_0x1a25('0x33')]);}};Acw[_0x1a25('0x1d')][_0x1a25('0xd')]=function(_0x4742a6){try{if(this[_0x1a25('0x8')][_0x4742a6[_0x1a25('0x17')]]&&_[_0x1a25('0x3a')](this[_0x1a25('0x8')][_0x4742a6[_0x1a25('0x17')]]['attended'])){logger['info'](_0x1a25('0x3b'),_0x4742a6[_0x1a25('0x17')]);this[_0x1a25('0x1e')](_0x4742a6[_0x1a25('0x17')]);}else if(this[_0x1a25('0x8')][_0x4742a6[_0x1a25('0x3c')]]&&_[_0x1a25('0x3a')](this['channels'][_0x4742a6[_0x1a25('0x3c')]][_0x1a25('0x27')])){logger['info'](_0x1a25('0x3d'),_0x4742a6[_0x1a25('0x3c')]);this['startAcw'](_0x4742a6[_0x1a25('0x3c')]);}}catch(_0x1a7153){logger['error'](_0x1a25('0x3e'),_0x1a7153['message']);}};Acw[_0x1a25('0x1d')][_0x1a25('0xf')]=function(_0x1e420d){try{if(this[_0x1a25('0x8')][_0x1e420d[_0x1a25('0x17')]]&&this[_0x1a25('0x8')][_0x1e420d[_0x1a25('0x17')]][_0x1a25('0x27')]){logger['info'](_0x1a25('0x3f'),_0x1e420d[_0x1a25('0x17')]);this[_0x1a25('0x1e')](_0x1e420d[_0x1a25('0x17')]);}else if(this[_0x1a25('0x8')][_0x1e420d[_0x1a25('0x3c')]]&&this[_0x1a25('0x8')][_0x1e420d['linkedid']][_0x1a25('0x27')]){logger[_0x1a25('0x19')](_0x1a25('0x40'),_0x1e420d[_0x1a25('0x3c')]);this[_0x1a25('0x1e')](_0x1e420d[_0x1a25('0x3c')]);}}catch(_0x2c90df){logger[_0x1a25('0x1a')](_0x1a25('0x41'),_0x2c90df[_0x1a25('0x33')]);}};Acw[_0x1a25('0x1d')][_0x1a25('0x11')]=function(_0x2822d1){try{if(!_[_0x1a25('0x42')](this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x43')]])){this[_0x1a25('0x1e')](_0x2822d1[_0x1a25('0x43')]);if(this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x44')]]){this['channels'][_0x2822d1[_0x1a25('0x44')]]['attended']=!![];this[_0x1a25('0x8')][_0x2822d1['transfertargetuniqueid']]=this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x44')]];delete this['channels'][_0x2822d1[_0x1a25('0x44')]];}}else if(!_['isNil'](this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x45')]])){this[_0x1a25('0x1e')](_0x2822d1[_0x1a25('0x45')]);if(this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x46')]]){this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x46')]][_0x1a25('0x27')]=!![];this['channels'][_0x2822d1[_0x1a25('0x43')]]=this[_0x1a25('0x8')][_0x2822d1[_0x1a25('0x46')]];delete this[_0x1a25('0x8')][_0x2822d1['origtransfereruniqueid']];}}}catch(_0x444bb1){logger['error'](_0x1a25('0x47'),_0x444bb1['message']);}};Acw[_0x1a25('0x1d')][_0x1a25('0x12')]=function(_0xfa7c57){try{if(this['channels'][_0xfa7c57[_0x1a25('0x48')]]){logger[_0x1a25('0x19')](_0x1a25('0x49'),JSON[_0x1a25('0x4a')](_0xfa7c57[_0x1a25('0x48')]));this['startAcw'](_0xfa7c57[_0x1a25('0x48')]);}else if(this['channels'][_0xfa7c57[_0x1a25('0x4b')]]){logger[_0x1a25('0x19')](_0x1a25('0x4c'),JSON[_0x1a25('0x4a')](_0xfa7c57[_0x1a25('0x4b')]));this[_0x1a25('0x1e')](_0xfa7c57[_0x1a25('0x4b')]);}}catch(_0x2edac7){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x2edac7[_0x1a25('0x33')]);}};Acw['prototype'][_0x1a25('0x4d')]=function(_0x51dca9){try{if(this[_0x1a25('0x5')][_0x51dca9[_0x1a25('0x20')]]&&this[_0x1a25('0x5')][_0x51dca9[_0x1a25('0x20')]][_0x1a25('0x4e')]==='all'){if(this[_0x1a25('0x6')][_0x51dca9[_0x1a25('0x1f')]]){logger[_0x1a25('0x19')](_0x1a25('0x4f'),_0x51dca9[_0x1a25('0x17')],_0x51dca9['interface'],_0x51dca9[_0x1a25('0x20')]);return RpcUser[_0x1a25('0x29')](this['agents'][_0x51dca9['interface']],_0x1a25('0x50'),_0x51dca9[_0x1a25('0x17')]);}}}catch(_0xb78cea){logger['error'](_0x1a25('0x51'),_0xb78cea[_0x1a25('0x33')]);}};module[_0x1a25('0x52')]=Acw; \ No newline at end of file +var _0x3752=['syncAgentConnectPreview','milliseconds','diff','seconds','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','interface','queue','ACW','mandatoryDispositionPause','resolve','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview'];(function(_0x4c6b10,_0x42e824){var _0x458f1c=function(_0x47a5af){while(--_0x47a5af){_0x4c6b10['push'](_0x4c6b10['shift']());}};_0x458f1c(++_0x42e824);}(_0x3752,0x95));var _0x2375=function(_0x4d4696,_0x1ab3a2){_0x4d4696=_0x4d4696-0x0;var _0x455048=_0x3752[_0x4d4696];return _0x455048;};'use strict';var _=require(_0x2375('0x0'));var moment=require(_0x2375('0x1'));var ami=require(_0x2375('0x2'));var logger=require('../../../config/logger')(_0x2375('0x3'));var RpcUser=require(_0x2375('0x4'));var RpcVoiceAgentReport=require(_0x2375('0x5'));function Acw(_0x1d062c){this[_0x2375('0x6')]=_0x1d062c['voiceQueues'];this[_0x2375('0x7')]=_0x1d062c[_0x2375('0x7')];this[_0x2375('0x8')]=_0x1d062c[_0x2375('0x8')];this[_0x2375('0x9')]={};ami['on'](_0x2375('0xa'),this[_0x2375('0xb')][_0x2375('0xc')](this));ami['on'](_0x2375('0xd'),this[_0x2375('0xe')][_0x2375('0xc')](this));ami['on'](_0x2375('0xf'),this[_0x2375('0x10')][_0x2375('0xc')](this));ami['on'](_0x2375('0x11'),this['syncAgentRingNoAnswer'][_0x2375('0xc')](this));ami['on']('attendedtransfer',this[_0x2375('0x12')][_0x2375('0xc')](this));ami['on'](_0x2375('0x13'),this['syncBlindTransfer'][_0x2375('0xc')](this));ami['on'](_0x2375('0x14'),this[_0x2375('0x15')]['bind'](this));}function getDiff(_0x587f44){var _0x432dba=moment()[_0x2375('0x16')](0x0);var _0x57dd2b=moment(_0x587f44)[_0x2375('0x16')](0x0);return _0x432dba[_0x2375('0x17')](_0x57dd2b,_0x2375('0x18'));}Acw['prototype']['updateAcw']=function(_0x14e90d,_0x594e6e){var _0x4070a5=this;var _0x5b7ccb=getDiff(_0x4070a5[_0x2375('0x8')][_0x14e90d][_0x2375('0x19')]);clearTimeout(_0x4070a5[_0x2375('0x8')][_0x14e90d][_0x2375('0x1a')]);_0x4070a5[_0x2375('0x8')][_0x14e90d]['timer']=![];return RpcVoiceAgentReport[_0x2375('0x1b')]({'acwtime':_0x5b7ccb},_0x4070a5['timers'][_0x14e90d][_0x2375('0x1c')],_0x14e90d)[_0x2375('0x1d')](function(_0x10297e){logger['info'](_0x2375('0x1e'),_0x594e6e,_0x5b7ccb,_0x10297e);})[_0x2375('0x1f')](function(_0xc5b83c){logger[_0x2375('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x594e6e,_0xc5b83c);})[_0x2375('0x21')](function(){delete _0x4070a5[_0x2375('0x8')][_0x14e90d];});};Acw['prototype']['startAcw']=function(_0x39e6f5){try{var _0x523196=this;var _0x26ea78=this[_0x2375('0x9')][_0x39e6f5][_0x2375('0x22')];var _0x510eed=this[_0x2375('0x9')][_0x39e6f5][_0x2375('0x23')];var _0x43a82e=this[_0x2375('0x6')][_0x510eed];var _0x352242=![];var _0x309cd5=_0x2375('0x24');if(_0x43a82e['mandatoryDisposition']&&_0x43a82e[_0x2375('0x25')]['name']){_0x352242=!![];_0x309cd5=_0x43a82e[_0x2375('0x25')]['name'];}if(!_0x523196['agents'][_0x26ea78]){return Promise[_0x2375('0x26')]();}return RpcUser[_0x2375('0x27')](_0x523196['agents'][_0x26ea78]['id'])[_0x2375('0x1d')](function(_0x3570ba){if(!_0x3570ba||_0x3570ba[_0x2375('0x28')]){logger[_0x2375('0x29')](_0x2375('0x2a'),_0x39e6f5,_0x26ea78,_0x510eed);return;}logger[_0x2375('0x29')](_0x2375('0x2b'),_0x39e6f5,_0x26ea78,_0x510eed);var _0x4b5082=_0x523196[_0x2375('0x9')][_0x39e6f5][_0x2375('0x2c')]&&_0x523196[_0x2375('0x9')][_0x39e6f5][_0x2375('0x2d')]?_0x523196['channels'][_0x39e6f5][_0x2375('0x2d')]:_0x39e6f5;return RpcUser[_0x2375('0x2e')](_0x523196[_0x2375('0x7')][_0x26ea78],_0x309cd5,_0x4b5082)['then'](function(_0xfd031f){_0x523196[_0x2375('0x6')][_0x510eed][_0x2375('0x2f')]-=0x1;_0x523196[_0x2375('0x6')][_0x510eed]['paused']+=0x1;return _0xfd031f;});})['then'](function(_0x2ed799){if(_0x352242||!_0x2ed799){return;}_0x523196[_0x2375('0x8')][_0x26ea78]={};logger['info'](_0x2375('0x30'),_0x39e6f5,_0x523196['voiceQueues'][_0x510eed][_0x2375('0x31')],_0x26ea78,_0x510eed);_0x523196[_0x2375('0x8')][_0x26ea78][_0x2375('0x1a')]=setTimeout(_0x523196[_0x2375('0x32')]['bind'](_0x523196,_0x26ea78),_0x523196[_0x2375('0x6')][_0x510eed][_0x2375('0x31')]*0x3e8);_0x523196[_0x2375('0x8')][_0x26ea78]['lastPauseAt']=moment()['format'](_0x2375('0x33'));_0x523196[_0x2375('0x8')][_0x26ea78][_0x2375('0x1c')]=_0x39e6f5;_0x523196[_0x2375('0x8')][_0x26ea78][_0x2375('0x23')]=_0x510eed;_0x523196[_0x2375('0x8')][_0x26ea78]['updateAcw']=_0x523196[_0x2375('0x34')][_0x2375('0xc')](_0x523196,_0x26ea78,_0x39e6f5);})['catch'](function(){logger[_0x2375('0x20')](_0x2375('0x30'),_0x39e6f5,_0x523196['voiceQueues'][_0x510eed][_0x2375('0x31')],_0x26ea78,_0x510eed);})[_0x2375('0x21')](function(){delete _0x523196[_0x2375('0x9')][_0x39e6f5];});}catch(_0x3b1601){logger[_0x2375('0x20')](_0x2375('0x35'),_0x3b1601[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0x32')]=function(_0x2161b9){try{var _0x34fd32=this;if(_0x34fd32[_0x2375('0x8')][_0x2161b9]){_0x34fd32['timers'][_0x2161b9][_0x2375('0x1a')]=![];var _0x4cd7ab=_0x34fd32[_0x2375('0x8')][_0x2161b9][_0x2375('0x1c')];var _0x22d038=_0x34fd32['timers'][_0x2161b9][_0x2375('0x23')];var _0x31f709=_0x34fd32[_0x2375('0x6')][_0x22d038][_0x2375('0x31')];logger[_0x2375('0x29')](_0x2375('0x38'),_0x4cd7ab,_0x2161b9);RpcUser[_0x2375('0x27')](this['agents'][_0x2161b9]['id'])[_0x2375('0x1d')](function(_0x515837){if(_0x515837[_0x2375('0x39')]===_0x2375('0x24')){return RpcUser[_0x2375('0x3a')](_0x34fd32[_0x2375('0x7')][_0x2161b9]);}});RpcVoiceAgentReport[_0x2375('0x1b')]({'acwtime':_0x31f709,'agentacw':!![]},_0x4cd7ab,_0x2161b9)[_0x2375('0x1d')](function(_0x387a44){logger[_0x2375('0x29')](_0x2375('0x1e'),_0x4cd7ab,_0x31f709,_0x387a44);})[_0x2375('0x1f')](function(_0x1fcf01){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x4cd7ab,_0x1fcf01);});}else{logger[_0x2375('0x20')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2161b9);if(_0x34fd32[_0x2375('0x8')]){logger[_0x2375('0x29')](_0x2375('0x3b'),JSON[_0x2375('0x3c')](_0x34fd32[_0x2375('0x8')]));}}}catch(_0x3a5a29){logger[_0x2375('0x20')](_0x2375('0x3d'),_0x3a5a29[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0xb')]=function(_0x3a3d7c){try{if(this[_0x2375('0x6')][_0x3a3d7c[_0x2375('0x23')]]&&(this['voiceQueues'][_0x3a3d7c[_0x2375('0x23')]]['acw']||this[_0x2375('0x6')][_0x3a3d7c['queue']][_0x2375('0x3e')])){if(this['agents'][_0x3a3d7c['interface']]){this['channels'][_0x3a3d7c[_0x2375('0x1c')]]={'queue':_0x3a3d7c[_0x2375('0x23')],'interface':_0x3a3d7c['interface'],'destlinkedid':_0x3a3d7c['destlinkedid']};}}}catch(_0x7f8c8f){logger['error'](_0x2375('0x3f'),_0x7f8c8f[_0x2375('0x36')]);}};Acw[_0x2375('0x37')]['syncAgentConnectPreview']=function(_0x24d642){try{if(this[_0x2375('0x6')][_0x24d642[_0x2375('0x23')]]&&(this['voiceQueues'][_0x24d642[_0x2375('0x23')]]['acw']||this['voiceQueues'][_0x24d642[_0x2375('0x23')]][_0x2375('0x3e')])){if(this['agents'][_0x24d642[_0x2375('0x22')]]){this[_0x2375('0x9')][_0x24d642['uniqueid']]={'queue':_0x24d642['queue'],'interface':_0x24d642[_0x2375('0x22')]};}}}catch(_0x5e25ff){logger[_0x2375('0x20')](_0x2375('0x40'),_0x5e25ff[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0xe')]=function(_0x4b0169){try{if(this[_0x2375('0x9')][_0x4b0169[_0x2375('0x1c')]]&&_[_0x2375('0x41')](this['channels'][_0x4b0169[_0x2375('0x1c')]]['attended'])){logger[_0x2375('0x29')]('[%s][HANGUP:UNIQUEID]',_0x4b0169[_0x2375('0x1c')]);this[_0x2375('0x42')](_0x4b0169[_0x2375('0x1c')]);}else if(this[_0x2375('0x9')][_0x4b0169[_0x2375('0x43')]]&&_[_0x2375('0x41')](this['channels'][_0x4b0169['linkedid']][_0x2375('0x2c')])){logger[_0x2375('0x29')]('[%s][HANGUP:LINKEDID]',_0x4b0169[_0x2375('0x43')]);this[_0x2375('0x42')](_0x4b0169[_0x2375('0x43')]);}}catch(_0x31bbca){logger[_0x2375('0x20')](_0x2375('0x44'),_0x31bbca['message']);}};Acw[_0x2375('0x37')][_0x2375('0x10')]=function(_0x2e4a56){try{if(this[_0x2375('0x9')][_0x2e4a56[_0x2375('0x1c')]]&&this[_0x2375('0x9')][_0x2e4a56[_0x2375('0x1c')]][_0x2375('0x2c')]){logger[_0x2375('0x29')](_0x2375('0x45'),_0x2e4a56[_0x2375('0x1c')]);this['startAcw'](_0x2e4a56[_0x2375('0x1c')]);}else if(this[_0x2375('0x9')][_0x2e4a56['linkedid']]&&this['channels'][_0x2e4a56[_0x2375('0x43')]][_0x2375('0x2c')]){logger[_0x2375('0x29')](_0x2375('0x46'),_0x2e4a56['linkedid']);this[_0x2375('0x42')](_0x2e4a56['linkedid']);}}catch(_0x366396){logger[_0x2375('0x20')]('[ACW][syncHangup]\x20%s',_0x366396[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0x12')]=function(_0x45af9e){try{if(!_[_0x2375('0x47')](this['channels'][_0x45af9e[_0x2375('0x48')]])){this[_0x2375('0x42')](_0x45af9e[_0x2375('0x48')]);if(this[_0x2375('0x9')][_0x45af9e[_0x2375('0x49')]]){this[_0x2375('0x9')][_0x45af9e['secondtransfereruniqueid']][_0x2375('0x2c')]=!![];this[_0x2375('0x9')][_0x45af9e[_0x2375('0x4a')]]=this[_0x2375('0x9')][_0x45af9e[_0x2375('0x49')]];delete this['channels'][_0x45af9e[_0x2375('0x49')]];}}else if(!_['isNil'](this[_0x2375('0x9')][_0x45af9e[_0x2375('0x4a')]])){this[_0x2375('0x42')](_0x45af9e[_0x2375('0x4a')]);if(this[_0x2375('0x9')][_0x45af9e['origtransfereruniqueid']]){this['channels'][_0x45af9e[_0x2375('0x4b')]][_0x2375('0x2c')]=!![];this[_0x2375('0x9')][_0x45af9e['transfereeuniqueid']]=this[_0x2375('0x9')][_0x45af9e[_0x2375('0x4b')]];delete this['channels'][_0x45af9e[_0x2375('0x4b')]];}}}catch(_0x4e4f88){logger[_0x2375('0x20')](_0x2375('0x4c'),_0x4e4f88[_0x2375('0x36')]);}};Acw[_0x2375('0x37')]['syncBlindTransfer']=function(_0x1411c0){try{if(this[_0x2375('0x9')][_0x1411c0[_0x2375('0x4d')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x2375('0x3c')](_0x1411c0[_0x2375('0x4d')]));this[_0x2375('0x42')](_0x1411c0[_0x2375('0x4d')]);}else if(this['channels'][_0x1411c0['transfererlinkedid']]){logger['info'](_0x2375('0x4e'),JSON[_0x2375('0x3c')](_0x1411c0[_0x2375('0x4f')]));this[_0x2375('0x42')](_0x1411c0[_0x2375('0x4f')]);}}catch(_0x11c869){logger['error'](_0x2375('0x50'),_0x11c869[_0x2375('0x36')]);}};Acw[_0x2375('0x37')][_0x2375('0x51')]=function(_0x2c592c){try{if(this[_0x2375('0x6')][_0x2c592c[_0x2375('0x23')]]&&this[_0x2375('0x6')][_0x2c592c['queue']][_0x2375('0x52')]==='all'){if(this[_0x2375('0x7')][_0x2c592c['interface']]){logger[_0x2375('0x29')](_0x2375('0x53'),_0x2c592c[_0x2375('0x1c')],_0x2c592c[_0x2375('0x22')],_0x2c592c['queue']);return RpcUser[_0x2375('0x2e')](this[_0x2375('0x7')][_0x2c592c['interface']],'Auto-Pause',_0x2c592c[_0x2375('0x1c')]);}}}catch(_0x562781){logger[_0x2375('0x20')](_0x2375('0x54'),_0x562781[_0x2375('0x36')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 35938d5..d73cb9c 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 _0xe688=['actionDeviceStateList','Action','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','info','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','port','username','asterisk','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry'];(function(_0x6aa33c,_0xdb398d){var _0x4f5612=function(_0x3aa346){while(--_0x3aa346){_0x6aa33c['push'](_0x6aa33c['shift']());}};_0x4f5612(++_0xdb398d);}(_0xe688,0x127));var _0x8e68=function(_0x64fed0,_0x2a6968){_0x64fed0=_0x64fed0-0x0;var _0x14a934=_0xe688[_0x64fed0];return _0x14a934;};'use strict';var Manager=require(_0x8e68('0x0'));var BPromise=require(_0x8e68('0x1'));var util=require(_0x8e68('0x2'));var logger=require(_0x8e68('0x3'))('ami');var config=require(_0x8e68('0x4'));var ami=new Manager(config['asterisk'][_0x8e68('0x5')],config['asterisk']['ip'],config['asterisk'][_0x8e68('0x6')],config[_0x8e68('0x7')]['password'],!![]);ami[_0x8e68('0x8')]();ami['Action']=BPromise[_0x8e68('0x9')](ami[_0x8e68('0xa')]);function error(_0x4b4817){logger['error'](util[_0x8e68('0xb')](_0x8e68('0xc'),config['asterisk'][_0x8e68('0x6')],config['asterisk']['ip'],config[_0x8e68('0x7')][_0x8e68('0x5')],util['inspect'](_0x4b4817,![],null)));}function close(){logger[_0x8e68('0xd')](util[_0x8e68('0xb')](_0x8e68('0xe'),config[_0x8e68('0x7')][_0x8e68('0x6')],config[_0x8e68('0x7')]['ip'],config['asterisk'][_0x8e68('0x5')]));}ami[_0x8e68('0xf')]=function(){return function(){return ami['Action']({'action':_0x8e68('0x10')});};};ami[_0x8e68('0x11')]=function(){return function(){return ami[_0x8e68('0x12')]({'action':_0x8e68('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x8e68('0x12')]({'action':_0x8e68('0x14')});};};ami[_0x8e68('0x15')]=function(){return function(){return ami[_0x8e68('0x12')]({'action':_0x8e68('0x16')});};};ami[_0x8e68('0x17')]=function(){return function(){return ami['Action']({'action':_0x8e68('0x18')});};};function connect(){logger['info'](util[_0x8e68('0xb')](_0x8e68('0x19'),config[_0x8e68('0x7')][_0x8e68('0x6')],config[_0x8e68('0x7')]['ip'],config[_0x8e68('0x7')][_0x8e68('0x5')]));ami['once']('error',error);ami[_0x8e68('0x1a')]('close',close);}ami['on']('connect',connect);ami['on'](_0x8e68('0x1b'),function(_0x2960b8){logger[_0x8e68('0x1c')](util[_0x8e68('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x8e68('0x6')],config[_0x8e68('0x7')]['ip'],config[_0x8e68('0x7')][_0x8e68('0x5')],util[_0x8e68('0x1d')](_0x2960b8,![],null)));});ami['on'](_0x8e68('0x1e'),function(){logger[_0x8e68('0x1c')](util['format'](_0x8e68('0x1f'),config['asterisk'][_0x8e68('0x6')],config[_0x8e68('0x7')]['ip'],config[_0x8e68('0x7')][_0x8e68('0x5')]));return Promise[_0x8e68('0x20')]()[_0x8e68('0x21')](ami['actionSipShowRegistry']())[_0x8e68('0x21')](ami[_0x8e68('0x11')]())[_0x8e68('0x21')](ami[_0x8e68('0x22')]())[_0x8e68('0x21')](ami[_0x8e68('0x15')]())[_0x8e68('0x21')](ami[_0x8e68('0x17')]())[_0x8e68('0x23')](function(_0x3d0025){logger['error'](_0x8e68('0x24'),util[_0x8e68('0x1d')](_0x3d0025,{'showHidden':![],'depth':null}));});});ami['once'](_0x8e68('0xd'),error);ami[_0x8e68('0x1a')](_0x8e68('0x25'),close);module[_0x8e68('0x26')]=ami; \ No newline at end of file +var _0x0b4e=['actionDeviceStateList','devicestatelist','sippeerstatus','queuesummary','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','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipPeerStatus','exports','asterisk-manager','bluebird','util','port','asterisk','username','password','keepConnected','Action','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x0b4e,0x1be));var _0xe0b4=function(_0x4a1e0a,_0x51a512){_0x4a1e0a=_0x4a1e0a-0x0;var _0x15c865=_0x0b4e[_0x4a1e0a];return _0x15c865;};'use strict';var Manager=require(_0xe0b4('0x0'));var BPromise=require(_0xe0b4('0x1'));var util=require(_0xe0b4('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0xe0b4('0x3')],config[_0xe0b4('0x4')]['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x5')],config[_0xe0b4('0x4')][_0xe0b4('0x6')],!![]);ami[_0xe0b4('0x7')]();ami[_0xe0b4('0x8')]=BPromise['promisify'](ami[_0xe0b4('0x9')]);function error(_0x367cca){logger[_0xe0b4('0xa')](util[_0xe0b4('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe0b4('0x4')][_0xe0b4('0x5')],config[_0xe0b4('0x4')]['ip'],config['asterisk'][_0xe0b4('0x3')],util[_0xe0b4('0xc')](_0x367cca,![],null)));}function close(){logger['error'](util[_0xe0b4('0xb')](_0xe0b4('0xd'),config[_0xe0b4('0x4')][_0xe0b4('0x5')],config[_0xe0b4('0x4')]['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')]));}ami[_0xe0b4('0xe')]=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0xf')});};};ami[_0xe0b4('0x10')]=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x13')});};};ami[_0xe0b4('0x14')]=function(){return function(){return ami[_0xe0b4('0x8')]({'action':_0xe0b4('0x15')});};};function connect(){logger[_0xe0b4('0x16')](util['format'](_0xe0b4('0x17'),config['asterisk'][_0xe0b4('0x5')],config[_0xe0b4('0x4')]['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')]));ami[_0xe0b4('0x18')](_0xe0b4('0xa'),error);ami[_0xe0b4('0x18')](_0xe0b4('0x19'),close);}ami['on']('connect',connect);ami['on'](_0xe0b4('0x1a'),function(_0x28ebb4){logger[_0xe0b4('0x16')](util[_0xe0b4('0xb')](_0xe0b4('0x1b'),config[_0xe0b4('0x4')][_0xe0b4('0x5')],config['asterisk']['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')],util['inspect'](_0x28ebb4,![],null)));});ami['on'](_0xe0b4('0x1c'),function(){logger[_0xe0b4('0x16')](util[_0xe0b4('0xb')](_0xe0b4('0x1d'),config['asterisk'][_0xe0b4('0x5')],config['asterisk']['ip'],config[_0xe0b4('0x4')][_0xe0b4('0x3')]));return Promise['resolve']()[_0xe0b4('0x1e')](ami[_0xe0b4('0xe')]())[_0xe0b4('0x1e')](ami['actionDeviceStateList']())['then'](ami[_0xe0b4('0x1f')]())[_0xe0b4('0x1e')](ami['actionQueueSummary']())['then'](ami[_0xe0b4('0x14')]())['catch'](function(_0x1627d8){logger[_0xe0b4('0xa')]('[ami.js][fullybooted]',util[_0xe0b4('0xc')](_0x1627d8,{'showHidden':![],'depth':null}));});});ami[_0xe0b4('0x18')]('error',error);ami['once'](_0xe0b4('0x19'),close);module[_0xe0b4('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 783db92..b67bf65 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x123421,_0x17155c){var _0x9a2fac=function(_0x1731ac){while(--_0x1731ac){_0x123421['push'](_0x123421['shift']());}};_0x9a2fac(++_0x17155c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0xbdb7[_0x48df04];return _0x4de5fa;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x143fcb,_0x1064c7){var _0x3889bc=function(_0x14b1ee){while(--_0x14b1ee){_0x143fcb['push'](_0x143fcb['shift']());}};_0x3889bc(++_0x1064c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 91e4724..6c3534e 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 _0x407b=['outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','state','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','additional','dialAbandonedRetryFrequency','CampaignId','[rescheduleContact][Abandoned]','createHistory','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','pick','syncQueueStatusComplete','idHopper','[Catch][Preview][syncQueueStatusComplete]','ListId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','buildObj','saveInDb','[syncHangupInAMD]','MACHINE','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr][createHistory]','Machine','countnosuchnumberretry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','reachable','length','resolve','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','talking','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','checkIsBlackList','[getContactDialer2]','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','hangup','newexten','varset','queuemember','syncQueueMember','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','startProgressive','debug','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','[booked][unlockQueueStatus]','stringify','queueStatusComplete','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','campaign:save','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','content','then','indexOf','true','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Failure','Global:\x20','\x20Interval\x20is\x20overtime:\x20','catch','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','sendMessageOneNotActive','dialGlobalInterval','dialTimezone','Interval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Timezone:\x20','isGlobal','AMI\x20IfTime','voiceQueues','uniqueid','ivr','queue','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout'];(function(_0x2609c1,_0x532dd6){var _0x2f26c1=function(_0x374188){while(--_0x374188){_0x2609c1['push'](_0x2609c1['shift']());}};_0x2f26c1(++_0x532dd6);}(_0x407b,0x157));var _0xb407=function(_0x12b2b3,_0x401ba7){_0x12b2b3=_0x12b2b3-0x0;var _0xe3813=_0x407b[_0x12b2b3];return _0xe3813;};'use strict';var util=require(_0xb407('0x0'));var _=require(_0xb407('0x1'));var uuid=require(_0xb407('0x2'));var moment=require(_0xb407('0x3'));var rr=require('rr');var Redis=require(_0xb407('0x4'));var utils=require(_0xb407('0x5'));var hopperUtils=require(_0xb407('0x6'));var ut=require(_0xb407('0x7'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0xb407('0x8'));var loggerBooked=require(_0xb407('0x9'))(_0xb407('0xa'));var loggerPredictive=require(_0xb407('0x9'))(_0xb407('0xb'));var loggerPredictiveCalls=require(_0xb407('0x9'))(_0xb407('0xc'));var loggerSyncQueueSummary=require(_0xb407('0x9'))(_0xb407('0xd'));var ami=require(_0xb407('0xe'));config[_0xb407('0xf')]=_[_0xb407('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb407('0x11'))(new Redis(config[_0xb407('0xf')]));var cmHopper=require(_0xb407('0x12'));var voiceQueueRt=require(_0xb407('0x13'));var RpcSetting=require(_0xb407('0x14'));var Interval=require('../rpc/interval');var Action=require(_0xb407('0x15'));var History=require(_0xb407('0x16'));var Final=require(_0xb407('0x17'));var AgentComplete=require(_0xb407('0x18'));var QueueCallerAbandon=require(_0xb407('0x19'));var Hangup=require(_0xb407('0x1a'));var ipAgi=process[_0xb407('0x1b')]['XCALLY_IP_AGI']||_0xb407('0x1c');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb407('0x1d')][_0xb407('0x1e')]=function(_0xc0686c){this[_0xb407('0x1f')]=this[_0xb407('0x1f')]?this[_0xb407('0x1f')][_0xb407('0x20')](_0xc0686c):_0xc0686c();};function Dialer(_0x153bd1,_0x5aaeaa){this[_0xb407('0x21')]=new Sequence();this[_0xb407('0x22')]=_0x5aaeaa;this['voiceQueues']=_0x153bd1['voiceQueues'];this[_0xb407('0x23')]=_0x153bd1[_0xb407('0x23')];this['agents']=_0x153bd1[_0xb407('0x24')];this[_0xb407('0x25')]=_0x153bd1[_0xb407('0x25')];this['maxNumberOriginate']=config[_0xb407('0x26')]||0x2;this[_0xb407('0x27')]={};this[_0xb407('0x28')]={};this[_0xb407('0x29')]={};this[_0xb407('0x2a')]={};this[_0xb407('0x2b')]={};this[_0xb407('0x2c')]={};this['startProgressive']={};this[_0xb407('0x2d')]={};this[_0xb407('0x2e')]={};this['queueBookedRR']={};this[_0xb407('0x2f')]={};ami['on'](_0xb407('0x30'),this[_0xb407('0x31')][_0xb407('0x32')](this));ami['on'](_0xb407('0x33'),this[_0xb407('0x34')][_0xb407('0x32')](this));ami['on']('originateresponse',this[_0xb407('0x35')][_0xb407('0x32')](this));ami['on'](_0xb407('0x36'),this[_0xb407('0x37')][_0xb407('0x32')](this));ami['on']('custom:queuesummary',this[_0xb407('0xd')][_0xb407('0x32')](this));ami['on'](_0xb407('0x38'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xb407('0x39'),this['syncHangup'][_0xb407('0x32')](this));ami['on'](_0xb407('0x3a'),this['syncNewExten'][_0xb407('0x32')](this));ami['on'](_0xb407('0x3b'),this['syncVarSet'][_0xb407('0x32')](this));ami['on'](_0xb407('0x3c'),this[_0xb407('0x3d')][_0xb407('0x32')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xb407('0x32')](this));this['loopCampaigns']();this[_0xb407('0x3e')]();RpcSetting[_0xb407('0x3f')]()['then'](function(_0x76a803){previewRecallmeReminderInterval=_0x76a803[_0xb407('0x40')];});}function isNotNull(_0x1bbfb8){return _0x1bbfb8!==null&&!_['isUndefined'](_0x1bbfb8);}function msgResponse(_0x19589e,_0x106aed,_0x255f3d){return{'action':_0x19589e,'response':_0x106aed,'message':_0x255f3d,'stack':_0x255f3d};}function emit(_0x364f92,_0x409c90,_0x2106dd){io['to'](_0x364f92)['emit'](_0x409c90,_0x2106dd);}function emitOutboundVoiceQueueSummary(_0x1f47fd){if(_0x1f47fd[_0xb407('0x41')]===_0xb407('0x42')){logger['debug'](_0xb407('0x43'),util['inspect'](_0x1f47fd,{'showHidden':![],'depth':null}));emit(util[_0xb407('0x44')](_0xb407('0x45'),_0x1f47fd['name']),_0xb407('0x46'),_0x1f47fd);}}function checkGetDataPredictive(_0x49c20e){if(isNotNull(_0x49c20e)&&!_[_0xb407('0x47')](_0x49c20e)){loggerPredictive[_0xb407('0x48')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xb407('0x48')](_0xb407('0x49'),_0x49c20e[_0xb407('0x4a')]);loggerPredictive['info'](_0xb407('0x4b'),_0x49c20e[_0xb407('0x4c')]);loggerPredictive[_0xb407('0x48')](_0xb407('0x4d'),_0x49c20e['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xb407('0x48')](_0xb407('0x4e'),_0x49c20e['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xb407('0x4f'),_0x49c20e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xb407('0x48')](_0xb407('0x50'),_0x49c20e['predictiveIntervalAvgTalktime']);loggerPredictive[_0xb407('0x48')](_0xb407('0x51'));if(_0x49c20e[_0xb407('0x4a')]>0x0){if(!_[_0xb407('0x52')](_0x49c20e[_0xb407('0x53')])&&_0x49c20e[_0xb407('0x53')]>0x0){return!![];}loggerPredictive[_0xb407('0x48')](_0xb407('0x54'));if(!_['isUndefined'](_0x49c20e[_0xb407('0x55')])&&_0x49c20e[_0xb407('0x55')]>0x0){return!![];}loggerPredictive[_0xb407('0x48')](_0xb407('0x56'));}else{loggerPredictive[_0xb407('0x48')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xb407('0x48')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x923f2){return function(_0x22f42c){loggerPredictive[_0xb407('0x48')](_0xb407('0x57'));loggerPredictive[_0xb407('0x48')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22f42c[_0xb407('0x58')]);loggerPredictive[_0xb407('0x48')](_0xb407('0x59'),_0x22f42c[_0xb407('0x5a')]);loggerPredictive[_0xb407('0x48')](_0xb407('0x5b'),_0x22f42c['erlangAbandonmentRate']);loggerPredictive[_0xb407('0x48')](_0xb407('0x5c'),_0x22f42c[_0xb407('0x5d')]);loggerPredictive[_0xb407('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22f42c['erlangAbandonmentRate']);loggerPredictive[_0xb407('0x48')](_0xb407('0x51'));_['merge'](_0x923f2,_0x22f42c);};}function ifInterval(_0x8115bd,_0x3495a7){if(_[_0xb407('0x52')](_0x3495a7)){return![];}return utils[_0xb407('0x5e')](undefined,_0x3495a7)<_0x8115bd*0x3c;}function clearPredictiveAttributes(_0x56bf01){if(_0x56bf01['startProgressive']){_0x56bf01[_0xb407('0x5f')]=undefined;loggerPredictive[_0xb407('0x60')](_0x56bf01[_0xb407('0x61')],'startProgressive\x20value\x20cleared');}if(_0x56bf01[_0xb407('0x2c')]){_0x56bf01[_0xb407('0x2c')]=undefined;loggerPredictive['debug'](_0x56bf01[_0xb407('0x61')],_0xb407('0x62'));}if(_0x56bf01[_0xb407('0x63')]){clearInterval(_0x56bf01[_0xb407('0x63')]);_0x56bf01[_0xb407('0x63')]=undefined;loggerPredictive[_0xb407('0x60')](_0x56bf01[_0xb407('0x61')],_0xb407('0x64'));}}function loggerCatchPredictive(_0x1a0328,_0x14441f){return function(_0x54d42b){loggerPredictive[_0xb407('0x65')](_0x14441f['name'],_0x1a0328);loggerPredictive['error'](_0x54d42b[_0xb407('0x66')]);clearPredictiveAttributes(_0x14441f);};}function loggerCatch(_0x24b763){return function(_0x270b9d){logger[_0xb407('0x65')](_0x24b763,util[_0xb407('0x67')](_0x270b9d,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x34f527,_0x28991a,_0x35d0af){return function(_0x48823f){utils[_0xb407('0x68')](_0x28991a,_0x35d0af,0x0);_0x28991a['temp']=0x0;logger['error'](_0x34f527,util['inspect'](_0x48823f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4a7c91){return function(_0x3239a2){if(isNotNull(_0x3239a2)&&isNotNull(_0x3239a2[0x0])){if(_0x3239a2[0x0]['contactsRescheduled']>0x0){_0x4a7c91[_0xb407('0x69')]=utils[_0xb407('0x6a')]['CONTACTS_RESCHEDULED'];logger[_0xb407('0x48')](_0xb407('0x6b')+_0x4a7c91['name'],_0x3239a2[0x0][_0xb407('0x6c')],_0xb407('0x6d'));}else{_0x4a7c91[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x6e')];logger['info'](_0xb407('0x6f')+_0x4a7c91[_0xb407('0x61')]);}}};}function createObjHistory(_0x2985d0,_0x2c87ec,_0x88557d,_0x23487f,_0x545288){_0x2985d0['message']=_0x88557d;var _0x2ef0d6=new Action(_0x2985d0,_0x2c87ec);var _0x584894=new History(_0x2ef0d6);_0x584894['state']=_0x23487f;_0x584894[_0xb407('0x70')]=_0x545288;_0x584894[_0xb407('0x71')]=_0x2ef0d6[_0xb407('0x72')];return _0x584894;}function unlockQueueStatus(_0x4171f8,_0x6fd4c2){setTimeout(function(){if(_[_0xb407('0x52')](_0x4171f8['queueStatusComplete'])){loggerBooked[_0xb407('0x65')]('[unlockQueueStatus][undefined]',_0x6fd4c2);}_0x4171f8['queueStatusComplete']=!![];loggerBooked[_0xb407('0x48')](_0xb407('0x73'),_0x6fd4c2,JSON[_0xb407('0x74')](_['pick'](_0x4171f8,[_0xb407('0x61'),_0xb407('0x75')])));},0x1f3);}function checkInterval(_0x251393){return function(){if(!isNotNull(_0x251393['Interval'])){_0x251393[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x76')];throw _0x251393[_0xb407('0x61')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x251393['Interval'][_0xb407('0x77')])){_0x251393[_0xb407('0x69')]=utils[_0xb407('0x6a')]['NULL_INTERVAL'];throw _0x251393[_0xb407('0x61')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x251393['Interval'][_0xb407('0x77')]))){_0x251393[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x76')];throw _0x251393[_0xb407('0x61')]+_0xb407('0x78');}};}function checkIsIVRCampaignActive(_0x24e48d){return function(){if(!utils[_0xb407('0x79')](_0x24e48d)){_0x24e48d[_0xb407('0x69')]=utils[_0xb407('0x6a')]['INACTIVE'];throw _0x24e48d[_0xb407('0x61')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x21409d){if(utils[_0xb407('0x7a')](_0x21409d)){emit(util[_0xb407('0x44')](_0xb407('0x7b'),_0x21409d['name']),_0xb407('0x7c'),_0x21409d);}}function loggerCatchQueueSummary(_0xdff531,_0x151e92){return function(_0x3e653d){clearPredictiveAttributes(_0x151e92);emitCampaignSummary(_0x151e92);loggerSyncQueueSummary['debug'](_0xdff531,util[_0xb407('0x67')](_0x3e653d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3f1aba){if(_0x3f1aba['sendMessageOneNotActive']){if(_0x3f1aba['originated']===0x0){_0x3f1aba['sendMessageOneNotActive']=![];_0x3f1aba[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x7d')];loggerSyncQueueSummary[_0xb407('0x60')](_0xb407('0x7e'),_0x3f1aba[_0xb407('0x61')],_0xb407('0x7f'));}else{_0x3f1aba[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x80')];loggerSyncQueueSummary[_0xb407('0x60')](_0xb407('0x7e'),_0x3f1aba[_0xb407('0x61')],'is\x20disactive');}emitCampaignSummary(_0x3f1aba);}}function myreject(_0x48af7e){return function(_0xc05049){return _0x48af7e(msgResponse(_0xb407('0x81'),_0xb407('0x82'),JSON[_0xb407('0x74')](_0xc05049)));};}Dialer[_0xb407('0x1d')][_0xb407('0x83')]=function(_0x13fc95){return!_[_0xb407('0x52')](_0x13fc95)&&_0x13fc95&&!_[_0xb407('0x52')](_0x13fc95[_0xb407('0x61')])&&!_[_0xb407('0x52')](_0x13fc95[_0xb407('0x84')])&&_0x13fc95[_0xb407('0x84')]&&(this[_0xb407('0x25')][util[_0xb407('0x44')](_0xb407('0x85'),_0x13fc95[_0xb407('0x61')])][_0xb407('0x86')]==='reachable'||this[_0xb407('0x25')][util['format']('SIP/%s',_0x13fc95[_0xb407('0x61')])][_0xb407('0x86')]==='unmonitored');};Dialer[_0xb407('0x1d')][_0xb407('0x87')]=function(_0x28e968){var _0x481aa5=this;return function(){if(!_0x481aa5[_0xb407('0x83')](_0x28e968[_0xb407('0x88')])){if(!_0x481aa5['isTrunkReachable'](_0x28e968[_0xb407('0x89')])){_0x28e968[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x8a')];throw _0x28e968[_0xb407('0x61')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xb407('0x1d')][_0xb407('0x8b')]=function(_0x1058c6,_0x585bb0,_0x315143,_0x4544c3){var _0x187342=this;return function(){var _0x4a5af8=!![];return _0x187342['ifTimeIvr'](_0x1058c6,_0x585bb0,_0x315143,_0x4544c3,_0x4a5af8);};};Dialer[_0xb407('0x1d')][_0xb407('0x8c')]=function(_0x264827,_0x2fd203,_0xeddf51,_0x46d1b8){var _0x3ff1db=this;return function(){var _0x3073bd=![];return _0x3ff1db['ifTimeIvr'](_0x264827['Intervals'],_0x2fd203,_0xeddf51,_0x46d1b8,_0x3073bd);};};Dialer['prototype'][_0xb407('0x8d')]=function(_0x3a3369,_0x4efa88,_0x4c582c,_0x47b152,_0x56a061){var _0x389427=[];return new Promise(function(_0x1fe720,_0x3c0f59){if(!isNotNull(_0x3a3369)){_0x47b152[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x76')];return _0x3c0f59(msgResponse(_0xb407('0x8e'),'Failure',_0x4c582c+_0xb407('0x8f')));}if(_[_0xb407('0x47')](_0x3a3369)){_0x47b152[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x90')];return _0x3c0f59(msgResponse(_0xb407('0x8e'),'Failure',_0x4c582c+_0xb407('0x91')));}if(_0x4efa88&&_[_0xb407('0x52')](config[_0xb407('0x92')][_0x4efa88])){_0x47b152[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x93')];return _0x3c0f59(msgResponse(_0xb407('0x8e'),'Failure',_0x4c582c+_0xb407('0x94')+_0x4efa88));}if(_[_0xb407('0x95')](_0x3a3369)){for(var _0x1c43f5=0x0;_0x1c43f5<_0x3a3369['length'];_0x1c43f5+=0x1){_0x389427[_0xb407('0x96')](ami[_0xb407('0x97')]({'action':_0xb407('0x98'),'command':util['format'](_0xb407('0x99'),_0x3a3369[_0x1c43f5][_0xb407('0x9a')],!_[_0xb407('0x52')](config['timezones'][_0x4efa88])?_0x4efa88:'')})['then'](function(_0x2a8aad){return _0x2a8aad[_0xb407('0x9b')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x3c0f59)));}}else{_0x389427['push'](ami['Action']({'action':_0xb407('0x98'),'command':util[_0xb407('0x44')](_0xb407('0x99'),_0x3a3369,!_[_0xb407('0x52')](config[_0xb407('0x92')][_0x4efa88])?_0x4efa88:'')})[_0xb407('0x9c')](function(_0x2c8a74){return _0x2c8a74[_0xb407('0x9b')][_0xb407('0x9d')](_0xb407('0x9e'))>=0x0;})['catch'](myreject(_0x3c0f59)));}Promise[_0xb407('0x9f')](_0x389427)[_0xb407('0x9c')](function(_0x2118ad){var _0xa685cc=_['some'](_0x2118ad);if(_0xa685cc){return _0x1fe720(_0xa685cc);}else{_0x47b152[_0xb407('0x69')]=_0x56a061?utils[_0xb407('0x6a')][_0xb407('0xa0')]:utils[_0xb407('0x6a')][_0xb407('0xa1')];return _0x3c0f59(msgResponse(_0xb407('0xa2'),_0xb407('0xa3'),_0xb407('0xa4')+_0x56a061+'\x20'+_0x4c582c+_0xb407('0xa5')+util[_0xb407('0x67')](_0x3a3369,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4efa88));}})[_0xb407('0xa6')](function(_0x1a8eb0){return _0x3c0f59(msgResponse(_0xb407('0x8e'),_0xb407('0xa3'),JSON[_0xb407('0x74')](_0x1a8eb0)));});});};Dialer[_0xb407('0x1d')][_0xb407('0xa7')]=function(){var _0x232a8c=this;return cmHopper[_0xb407('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0xb407('0x9c')](function(){setInterval(function(){_0x232a8c[_0xb407('0xa9')]();},0x3e8);});};Dialer[_0xb407('0x1d')][_0xb407('0xa9')]=function(){var _0x350b65=this;var _0x1dcfd0;for(var _0x53cc96 in this['campaigns']){if(typeof this[_0xb407('0x23')][_0x53cc96]!==_0xb407('0xaa')){_0x1dcfd0=this[_0xb407('0x23')][_0x53cc96];if(utils[_0xb407('0x7a')](_0x1dcfd0)&&utils[_0xb407('0x79')](_0x1dcfd0)){_0x1dcfd0[_0xb407('0xab')]=!![];Promise['resolve']()[_0xb407('0x9c')](checkIsIVRCampaignActive(_0x1dcfd0))[_0xb407('0x9c')](checkInterval(_0x1dcfd0))['then'](_0x350b65['checkIsTrunkReachable'](_0x1dcfd0))[_0xb407('0x9c')](_0x350b65[_0xb407('0x8b')](_0x1dcfd0[_0xb407('0xac')],_0x1dcfd0[_0xb407('0xad')],_0x1dcfd0[_0xb407('0x61')],_0x1dcfd0))[_0xb407('0x9c')](_0x350b65[_0xb407('0x8c')](_0x1dcfd0[_0xb407('0xae')],_0x1dcfd0[_0xb407('0xad')],_0x1dcfd0[_0xb407('0x61')],_0x1dcfd0))['then'](_0x350b65[_0xb407('0xaf')](_0x1dcfd0))[_0xb407('0xa6')](loggerCatchQueueSummary(_0xb407('0xb0'),_0x1dcfd0));}else{notSendMessagesCampaign(_0x1dcfd0);}}}};Dialer['prototype'][_0xb407('0xb1')]=function(_0x3c9db3){if(_0x3c9db3[_0xb407('0xb2')]!==_0xb407('0xb')){clearPredictiveAttributes(_0x3c9db3);}switch(_0x3c9db3[_0xb407('0xb2')]){case _0xb407('0xb3'):this['handlePower'](_0x3c9db3,0x1);break;case _0xb407('0xb4'):this[_0xb407('0xb5')](_0x3c9db3,_0x3c9db3[_0xb407('0xb6')]);break;case _0xb407('0xb'):this['predictive'](_0x3c9db3);break;case _0xb407('0xa'):this[_0xb407('0xb5')](_0x3c9db3,0x1);break;default:logger[_0xb407('0x65')]('Queue',_0x3c9db3[_0xb407('0x61')],_0xb407('0xb7'));}};Dialer[_0xb407('0x1d')][_0xb407('0x8e')]=function(_0x20e91d,_0x2e0e9c){var _0xa63c67=_0x20e91d[_0xb407('0xad')];var _0x46ba20=_0x2e0e9c?_0x20e91d[_0xb407('0xac')]:_0x20e91d[_0xb407('0xae')][_0xb407('0x77')];logger[_0xb407('0xb8')](_0xb407('0xb9'),_0x46ba20,_0xa63c67,_0x20e91d[_0xb407('0x61')],util['format'](_0xb407('0xba'),_0x20e91d[_0xb407('0x61')],_0x20e91d['id']));var _0x64af30=null;return Interval['intervalIftime'](_0x46ba20,_0xa63c67)['then'](function(_0x342543){if(_0x342543===!![]){return _0x342543;}else{_0x20e91d[_0xb407('0x69')]=_0x2e0e9c?utils[_0xb407('0x6a')][_0xb407('0xa0')]:utils[_0xb407('0x6a')][_0xb407('0xa1')];_0x64af30=msgResponse(_0xb407('0xa2'),_0xb407('0xa3'),'Global:\x20'+_0x2e0e9c+'\x20'+_0x20e91d[_0xb407('0x61')]+_0xb407('0xa5')+util[_0xb407('0x67')](_0x46ba20,{'showHidden':![],'depth':null})+_0xb407('0xbb')+_0xa63c67);}if(_0x64af30!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x64af30);_0x64af30[_0xb407('0xbc')]=_0x2e0e9c;throw _0x64af30;}})[_0xb407('0xa6')](function(_0x42a03c){logger[_0xb407('0x65')](_0xb407('0xbd'),_0x42a03c);throw msgResponse(_0xb407('0x81'),_0xb407('0x82'),util[_0xb407('0x67')](_0x42a03c,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xb407('0x31')]=function(_0x288fce){if(this[_0xb407('0xbe')][_0x288fce['queue']]){if(this[_0xb407('0x2a')][_0x288fce[_0xb407('0xbf')]]&&this[_0xb407('0x2a')][_0x288fce['uniqueid']][_0xb407('0x41')]!==_0xb407('0xc0')){this['updateOriginated'](this[_0xb407('0xbe')][_0x288fce[_0xb407('0xc1')]]);this['uniqueId'][_0x288fce[_0xb407('0xbf')]]['answertime']=moment()[_0xb407('0x44')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xb407('0x1d')]['syncAgentComplete']=function(_0x4d4da5){var _0x5d0bdc=this[_0xb407('0x2a')][_0x4d4da5['uniqueid']];if(this[_0xb407('0xbe')][_0x4d4da5['queue']]){if(_0x5d0bdc&&_0x5d0bdc[_0xb407('0x41')]!==_0xb407('0xc0')){delete this['uniqueId'][_0x4d4da5[_0xb407('0xbf')]];this['voiceQueues'][_0x4d4da5[_0xb407('0xc1')]][_0xb407('0xc2')]+=0x1;var _0x5d1a07=new AgentComplete(_0x5d0bdc,_0x4d4da5);if(_0x4d4da5[_0xb407('0xc3')]==='agent'){_0x5d1a07[_0xb407('0xc4')]=this[_0xb407('0xbe')][_0x4d4da5[_0xb407('0xc1')]][_0xb407('0xc5')]&&this[_0xb407('0xbe')][_0x4d4da5['queue']]['dialAgiAfterHangupAgent']?moment()['format'](_0xb407('0xc6')):undefined;}hopperUtils['createHistory'](_0x5d1a07)[_0xb407('0xa6')](loggerCatch(_0xb407('0xc7')));hopperUtils[_0xb407('0xc8')](_0x5d1a07)[_0xb407('0xa6')](loggerCatch(_0xb407('0xc9')));}}};Dialer[_0xb407('0x1d')][_0xb407('0x34')]=function(_0x159c12){var _0x48f15d=this[_0xb407('0x2a')][_0x159c12['uniqueid']];var _0x7dc3f0=this;var _0x422a9e=![];var _0x255c05;var _0x46d2ea;if(this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]]){if(_0x48f15d&&_0x48f15d['type']!=='ivr'){delete this['uniqueId'][_0x159c12[_0xb407('0xbf')]];this[_0xb407('0xca')](this[_0xb407('0xbe')][_0x159c12['queue']]);_0x48f15d['droptime']=moment()[_0xb407('0x44')](_0xb407('0xc6'));var _0x5a2304=new QueueCallerAbandon(_0x48f15d,_0x159c12);if(utils[_0xb407('0x5e')](_0x48f15d[_0xb407('0xcb')],_0x48f15d[_0xb407('0xcc')])>=_0x48f15d[_0xb407('0xcd')]){this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xce')]+=0x1;this[_0xb407('0xbe')][_0x159c12['queue']][_0xb407('0xcf')]+=0x1;this[_0xb407('0xbe')][_0x159c12['queue']][_0xb407('0xd0')]+=0x1;_0x5a2304['state']=0xa;_0x5a2304[_0xb407('0x70')]=_0xb407('0xd1');_0x5a2304[_0xb407('0xd2')]='TIMEOUT';_0x5a2304[_0xb407('0xc4')]=this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xc5')]?moment()[_0xb407('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5a2304[_0xb407('0xd3')]+=0x1;_0x5a2304[_0xb407('0xd4')]+=0x1;_0x255c05=this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xd5')];_0x46d2ea=this[_0xb407('0xbe')][_0x159c12['queue']][_0xb407('0xd6')];hopperUtils[_0xb407('0xd7')](_0x5a2304,_0x5a2304[_0xb407('0xd8')],_0x48f15d[_0xb407('0xd9')])[_0xb407('0x9c')](function(_0x31c429){_0x422a9e=_0x31c429['additional']==0x1;if(_0x5a2304[_0xb407('0xd3')]>=_0x7dc3f0[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xda')]){_0x7dc3f0[_0xb407('0xdb')](_0x5a2304,_0x31c429['additional']);}else{hopperUtils[_0xb407('0xdc')]({'active':![],'countdropretry':_0x5a2304[_0xb407('0xd3')],'scheduledat':moment()[_0xb407('0xdd')](_0x7dc3f0[_0xb407('0xbe')][_0x159c12['queue']][_0xb407('0xd5')],_0xb407('0xde'))[_0xb407('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48f15d[_0xb407('0xdf')],'ListId':_0x48f15d['ListId'],'VoiceQueueId':_0x48f15d[_0xb407('0xe0')]||undefined,'CampaignId':_0x48f15d['CampaignId']||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0xe1')));var _0x53aa2f=new History(_0x5a2304);_0x53aa2f[_0xb407('0xd8')]=0xa;_0x53aa2f[_0xb407('0x70')]=_0xb407('0xd1');_0x53aa2f['starttime']=moment()['format'](_0xb407('0xc6'));_0x53aa2f[_0xb407('0x71')]=_0x53aa2f['starttime'];_0x53aa2f[_0xb407('0xe2')]=_0x5a2304[_0xb407('0xe2')];_0x53aa2f[_0xb407('0xe3')]=_0x5a2304['calleridnum'];hopperUtils['createHistory'](_0x53aa2f)[_0xb407('0xa6')](loggerCatch(_0xb407('0xe4')));}})[_0xb407('0x9c')](function(){if(_0x422a9e)hopperUtils[_0xb407('0xe5')](_0x5a2304,_0x255c05,_0x46d2ea)[_0xb407('0x9c')](function(){return 0x1;});});}else{this['voiceQueues'][_0x159c12[_0xb407('0xc1')]][_0xb407('0xe6')]+=0x1;this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xe7')]+=0x1;_0x5a2304[_0xb407('0xd8')]=0xb;_0x5a2304['statedesc']=_0xb407('0xe8');_0x5a2304[_0xb407('0xd2')]='CALLEREXIT';_0x5a2304['countabandonedretry']+=0x1;_0x5a2304[_0xb407('0xd4')]+=0x1;_0x255c05=this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]]['dialAbandonedRetryFrequency'];_0x46d2ea=this[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xd6')];hopperUtils[_0xb407('0xd7')](_0x5a2304,_0x5a2304[_0xb407('0xd8')],_0x48f15d['voiceQueue'])[_0xb407('0x9c')](function(_0x5891b2){if(_0x5a2304[_0xb407('0xe9')]>=_0x7dc3f0[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]]['dialAbandonedMaxRetry']){_0x7dc3f0['queueCallerAbandonCreateState'](_0x5a2304,_0x5891b2[_0xb407('0xea')]);}else{hopperUtils[_0xb407('0xdc')]({'active':![],'countabandonedretry':_0x5a2304[_0xb407('0xe9')],'scheduledat':moment()[_0xb407('0xdd')](_0x7dc3f0[_0xb407('0xbe')][_0x159c12[_0xb407('0xc1')]][_0xb407('0xeb')],_0xb407('0xde'))[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x48f15d[_0xb407('0xdf')],'ListId':_0x48f15d['ListId'],'VoiceQueueId':_0x48f15d[_0xb407('0xe0')]||undefined,'CampaignId':_0x48f15d[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0xed')));var _0x2a6459=new History(_0x5a2304);_0x2a6459[_0xb407('0xd8')]=0xb;_0x2a6459[_0xb407('0x70')]=_0xb407('0xe8');_0x2a6459[_0xb407('0x72')]=moment()[_0xb407('0x44')](_0xb407('0xc6'));_0x2a6459['endtime']=_0x2a6459[_0xb407('0x72')];_0x2a6459['calleridname']=_0x5a2304[_0xb407('0xe2')];_0x2a6459[_0xb407('0xe3')]=_0x5a2304[_0xb407('0xe3')];hopperUtils[_0xb407('0xee')](_0x2a6459)['catch'](loggerCatch(_0xb407('0xef')));}})[_0xb407('0x9c')](function(){if(_0x422a9e)hopperUtils[_0xb407('0xe5')](_0x5a2304,_0x255c05,_0x46d2ea)[_0xb407('0x9c')](function(){return 0x1;});});}}}};Dialer[_0xb407('0x1d')][_0xb407('0xf0')]=function(_0x475264){if(this[_0xb407('0x28')][_0x475264['uniqueid']]){this[_0xb407('0x28')][_0x475264['uniqueid']][_0xb407('0xf1')]=_0x475264[_0xb407('0xf1')];}if(this['uniqueId'][_0x475264['uniqueid']]){this[_0xb407('0x2a')][_0x475264[_0xb407('0xbf')]]['channel']=_0x475264['channel'];}};Dialer[_0xb407('0x1d')][_0xb407('0x3d')]=function(_0x21f89c){if(!this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]]){return;}var _0x47648e=this[_0xb407('0xbe')][this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]][_0xb407('0xc1')]][_0xb407('0xf3')]||_0xb407('0xf4');if(_0x47648e===_0xb407('0xf5')){if(this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]]&&_[_0xb407('0xf6')](this['actions'][_0x21f89c[_0xb407('0xf2')]][_0xb407('0xf7')])&&_0x21f89c[_0xb407('0x86')]==='1'&&_0x21f89c[_0xb407('0xf8')]==='0'){if(this[_0xb407('0x24')][_0x21f89c[_0xb407('0xf9')]]){if(!this[_0xb407('0x24')][_0x21f89c[_0xb407('0xf9')]][_0xb407('0xf7')]){this['agents'][_0x21f89c[_0xb407('0xf9')]][_0xb407('0xf7')]=!![];this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]]['locked']=!![];this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]][_0xb407('0xf9')]=_0x21f89c[_0xb407('0xf9')];}}}}else if(_0x47648e==='rrmemory'){if(this['actions'][_0x21f89c[_0xb407('0xf2')]]){if(this[_0xb407('0x24')][_0x21f89c['stateinterface']]){this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]][_0xb407('0xf9')]=_0x21f89c[_0xb407('0xf9')];if(_['isNil'](this[_0xb407('0x2e')][this['actions'][_0x21f89c['actionid']][_0xb407('0xc1')]])){this[_0xb407('0x2e')][this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]]['queue']]=[];}this[_0xb407('0x2e')][this['actions'][_0x21f89c[_0xb407('0xf2')]][_0xb407('0xc1')]][_0xb407('0x96')](_['merge'](_[_0xb407('0xfa')](this[_0xb407('0x28')][_0x21f89c[_0xb407('0xf2')]],['idHopper','stateinterface']),{'status':_0x21f89c[_0xb407('0x86')],'paused':_0x21f89c[_0xb407('0xf8')]}));}}}};Dialer['prototype'][_0xb407('0xfb')]=function(_0x3fda6c){if(!this['actions'][_0x3fda6c[_0xb407('0xf2')]]){return;}var _0x152a76=this;var _0x11da30=this['voiceQueues'][this[_0xb407('0x28')][_0x3fda6c['actionid']]['queue']];var _0x36ca06=_0x11da30[_0xb407('0xf3')]||_0xb407('0xf4');if(_0x36ca06===_0xb407('0xf5')){if(this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]]&&this[_0xb407('0x28')][_0x3fda6c['actionid']]['stateinterface']){this[_0xb407('0x22')]['run'](this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xfc')],this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xf9')])[_0xb407('0xa6')](function(_0x2a593b){logger['error'](_0xb407('0xfd'),util[_0xb407('0x67')](_0x2a593b,{'showHidden':![],'depth':null}));})['finally'](function(){_0x152a76[_0xb407('0xca')](_0x152a76[_0xb407('0xbe')][_0x152a76[_0xb407('0x28')][_0x3fda6c['actionid']]['queue']]);_0x152a76['agents'][_0x152a76['actions'][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xf9')]][_0xb407('0xf7')]=![];delete _0x152a76['actions'][_0x3fda6c[_0xb407('0xf2')]];unlockQueueStatus(_0x11da30);});}else{this[_0xb407('0xca')](this['voiceQueues'][this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xc1')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xb407('0x28')][_0x3fda6c['actionid']][_0xb407('0xdf')],'ListId':this['actions'][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xfe')],'VoiceQueueId':this['actions'][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xe0')]||undefined,'CampaignId':this[_0xb407('0x28')][_0x3fda6c['actionid']][_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0xff')));delete this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]];unlockQueueStatus(_0x11da30);}}else if(_0x36ca06===_0xb407('0xf4')){var _0x23b1ed;if(this[_0xb407('0x28')][_0x3fda6c['actionid']]&&!_[_0xb407('0x47')](this[_0xb407('0x2e')][this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xc1')]])){if(this[_0xb407('0x100')][_0x152a76[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]]['queue']]){this[_0xb407('0x100')][_0x152a76[_0xb407('0x28')][_0x3fda6c['actionid']][_0xb407('0xc1')]]=this[_0xb407('0x100')][this[_0xb407('0x28')][_0x3fda6c['actionid']][_0xb407('0xc1')]]?this[_0xb407('0x100')][this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]]['queue']]:this[_0xb407('0x2e')][this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xc1')]]?this[_0xb407('0x2e')][this[_0xb407('0x28')][_0x3fda6c['actionid']]['queue']][_0xb407('0x101')]||0x0:0x0;}this[_0xb407('0x2e')][this['actions'][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xc1')]][_0xb407('0x101')]=this[_0xb407('0x100')][this[_0xb407('0x28')][_0x3fda6c[_0xb407('0xf2')]][_0xb407('0xc1')]];for(var _0x5c9a35=0x0;_0x5c9a35=_0x2f9c9f[_0xb407('0x127')]){_0x190c6d[_0xb407('0x128')](_0x4b6ea2,_0x18ea03,_0x17ef3c,_0xb407('0x129'));}else{if(_0x4b6ea2[_0xb407('0x120')]>=_0x2f9c9f[_0xb407('0x12a')]){_0x190c6d[_0xb407('0x12b')](_0x4b6ea2,_0x18ea03,_0x17ef3c,_0xb407('0x12c'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4b6ea2[_0xb407('0x120')],'scheduledat':moment()[_0xb407('0xdd')](_0x2f9c9f['dialMachineRetryFrequency'],_0xb407('0xde'))[_0xb407('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b6ea2['ContactId'],'ListId':_0x4b6ea2[_0xb407('0xfe')],'VoiceQueueId':_0x4b6ea2['VoiceQueueId']||undefined,'CampaignId':_0x4b6ea2[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x12d')));_0x18ea03({'reschedule':0x1});}}});}if(_0x380ad0['type']==='ivr'&&this[_0xb407('0x23')][_0x380ad0[_0xb407('0xc1')]][_0xb407('0x114')]&&_0x2281a9[_0xb407('0x115')]===_0xb407('0x116')){delete this[_0xb407('0x2a')][_0x2281a9[_0xb407('0xbf')]];this['updateOriginated'](this[_0xb407('0x23')][_0x380ad0[_0xb407('0xc1')]]);_0x5a7f79=new Hangup(_0x380ad0,_0x2281a9);_0x5a7f79[_0xb407('0xd8')]=0x12;_0x5a7f79[_0xb407('0x70')]=_0xb407('0x118');_0x5a7f79[_0xb407('0x119')]=_0xb407('0x11a');ami[_0xb407('0x11b')](_0xb407('0x12e'),ut[_0xb407('0x11c')](_0x5a7f79,_0xb407('0x121')));this[_0xb407('0x11d')](_0x5a7f79,_0xb407('0x12f'),'[syncHangupInAMDIvr]');}if(_0x380ad0[_0xb407('0x41')]===_0xb407('0xc0')&&this[_0xb407('0x23')][_0x380ad0[_0xb407('0xc1')]][_0xb407('0x114')]&&_0x2281a9[_0xb407('0x115')]==='MACHINE'){return new Promise(function(_0x34b53e,_0x59df17){delete _0x190c6d[_0xb407('0x2a')][_0x2281a9[_0xb407('0xbf')]];_0x190c6d[_0xb407('0xca')](_0x190c6d['campaigns'][_0x380ad0[_0xb407('0xc1')]]);_0x190c6d[_0xb407('0x23')][_0x380ad0['queue']][_0xb407('0xc2')]+=0x1;_0x190c6d[_0xb407('0x23')][_0x380ad0[_0xb407('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x56baa8=_0x190c6d[_0xb407('0x23')][_0x380ad0[_0xb407('0xc1')]];var _0x5b0726=new Hangup(_0x380ad0,_0x2281a9);_0x5b0726[_0xb407('0xd8')]=0x13;_0x5b0726[_0xb407('0x70')]=_0xb407('0x130');_0x5b0726[_0xb407('0x119')]=_0xb407('0x11a');_0x5b0726[_0xb407('0x120')]+=0x1;_0x5b0726[_0xb407('0xd4')]+=0x1;_0x5b0726[_0xb407('0x121')]=!![];ami[_0xb407('0x11b')](_0xb407('0x12e'),ut[_0xb407('0x11c')](_0x5b0726,_0xb407('0x121')));hopperUtils[_0xb407('0xee')](_0x5b0726)[_0xb407('0xa6')](loggerCatch(_0xb407('0x122')));if(_0x5b0726[_0xb407('0x123')]+_0x5b0726[_0xb407('0x124')]+_0x5b0726[_0xb407('0x125')]+_0x5b0726[_0xb407('0x131')]+_0x5b0726[_0xb407('0xd3')]+_0x5b0726['countabandonedretry']+_0x5b0726['countmachineretry']+_0x5b0726[_0xb407('0x126')]>=_0x56baa8[_0xb407('0x127')]){_0x190c6d[_0xb407('0x128')](_0x5b0726,_0x34b53e,_0x59df17,_0xb407('0x129'));}else{if(_0x5b0726[_0xb407('0x120')]>=_0x56baa8[_0xb407('0x12a')]){_0x190c6d['createStateFinal'](_0x5b0726,_0x34b53e,_0x59df17,_0xb407('0x12c'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5b0726[_0xb407('0x120')],'scheduledat':moment()[_0xb407('0xdd')](_0x56baa8['dialMachineRetryFrequency'],_0xb407('0xde'))[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x5b0726[_0xb407('0xdf')],'ListId':_0x5b0726['ListId'],'VoiceQueueId':_0x5b0726[_0xb407('0xe0')]||undefined,'CampaignId':_0x5b0726[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x12d')));_0x34b53e({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x2248d1){var _0x5b336a=this[_0xb407('0x2a')][_0x2248d1['uniqueid']];var _0x2cd9ba;if(_0x5b336a&&_0x5b336a[_0xb407('0x41')]===_0xb407('0xc0')){delete this[_0xb407('0x2a')][_0x2248d1[_0xb407('0xbf')]];this[_0xb407('0xca')](this[_0xb407('0x23')][_0x5b336a['queue']]);this[_0xb407('0x23')][_0x5b336a[_0xb407('0xc1')]]['ivrAnswerCallsDay']+=0x1;_0x2cd9ba=new Hangup(_0x5b336a,_0x2248d1);hopperUtils[_0xb407('0xee')](_0x2cd9ba)[_0xb407('0xa6')](loggerCatch(_0xb407('0x132')));hopperUtils[_0xb407('0xc8')](_0x2cd9ba)[_0xb407('0xa6')](loggerCatch(_0xb407('0x133')));}if(_0x5b336a&&_0x5b336a['type']!==_0xb407('0xc0')&&isNotNull(this['voiceQueues'][_0x5b336a[_0xb407('0xc1')]][_0xb407('0x134')])){delete this['uniqueId'][_0x2248d1[_0xb407('0xbf')]];this[_0xb407('0xca')](this[_0xb407('0xbe')][_0x5b336a['queue']]);this[_0xb407('0xbe')][_0x5b336a[_0xb407('0xc1')]]['outboundAnswerCallsDay']+=0x1;this[_0xb407('0xbe')][_0x5b336a[_0xb407('0xc1')]][_0xb407('0x117')]+=0x1;_0x2cd9ba=new Hangup(_0x5b336a,_0x2248d1);_0x2cd9ba[_0xb407('0xd8')]=0x10;_0x2cd9ba[_0xb407('0x70')]=_0xb407('0x135');_0x2cd9ba[_0xb407('0x119')]=_0xb407('0x136');hopperUtils[_0xb407('0xee')](_0x2cd9ba)['catch'](loggerCatch(_0xb407('0x132')));hopperUtils[_0xb407('0xc8')](_0x2cd9ba)[_0xb407('0xa6')](loggerCatch('[syncHangupIvr]'));}if(_0x5b336a&&_0x5b336a[_0xb407('0x41')]!==_0xb407('0xc0')&&!isNotNull(this['voiceQueues'][_0x5b336a[_0xb407('0xc1')]][_0xb407('0x134')])){if(_0x2248d1[_0xb407('0x137')]==='Normal\x20Clearing'){delete this[_0xb407('0x2a')][_0x2248d1[_0xb407('0xbf')]];this[_0xb407('0xbe')][_0x5b336a[_0xb407('0xc1')]]['outboundAnswerCallsDay']+=0x1;const _0x15cfa8=new AgentComplete(_0x5b336a,_0x2248d1);_0x15cfa8[_0xb407('0xec')]=this[_0xb407('0xbe')][_0x5b336a[_0xb407('0xc1')]]['id'];hopperUtils[_0xb407('0xee')](_0x15cfa8)[_0xb407('0xa6')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xb407('0xc8')](_0x15cfa8)['catch'](loggerCatch(_0xb407('0xc9')));}else{delete this[_0xb407('0x2a')][_0x2248d1[_0xb407('0xbf')]];this['updateOriginated'](this[_0xb407('0xbe')][_0x5b336a[_0xb407('0xc1')]]);this[_0xb407('0xbe')][_0x5b336a[_0xb407('0xc1')]][_0xb407('0x138')]+=0x1;_0x2cd9ba=new Hangup(_0x5b336a,_0x2248d1);_0x2cd9ba[_0xb407('0xd8')]=0xc;_0x2cd9ba[_0xb407('0x70')]=_0x2248d1[_0xb407('0x137')];_0x2cd9ba[_0xb407('0x119')]=_0xb407('0x139');hopperUtils[_0xb407('0xee')](_0x2cd9ba)[_0xb407('0xa6')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2cd9ba)[_0xb407('0xa6')](loggerCatch(_0xb407('0x133')));}}};Dialer['prototype'][_0xb407('0xd')]=function(_0x201517){var _0x59955e=this;if(!_0x59955e['queuesSummary'][_0x201517[_0xb407('0x61')]]){_0x59955e[_0xb407('0x2f')][_0x201517[_0xb407('0x61')]]={'running':![]};}else if(_0x59955e[_0xb407('0x2f')][_0x201517[_0xb407('0x61')]][_0xb407('0x13a')]===!![]){return;}else if(_0x59955e['queuesSummary'][_0x201517[_0xb407('0x61')]][_0xb407('0x13a')]===![]){_0x59955e[_0xb407('0x2f')][_0x201517['name']]['running']=!![];}var _0x55bbdb=_0x59955e[_0xb407('0xbe')][_0x201517[_0xb407('0x61')]];var _0x23569c=_0x55bbdb['message']!==utils[_0xb407('0x6a')][_0xb407('0x7d')];var _0x5bec47=utils[_0xb407('0x13b')](_0x55bbdb);_0x55bbdb['statusMessage']=utils[_0xb407('0x13c')](_0x55bbdb,_0x59955e[_0xb407('0x25')]);Promise['resolve']()[_0xb407('0x9c')](function(){if(_0x55bbdb[_0xb407('0x13d')]===utils[_0xb407('0x6a')][_0xb407('0x7d')]){if(_0x23569c){clearPredictiveAttributes(_0x55bbdb);_0x201517['startPredictive']=undefined;_0x201517[_0xb407('0x5f')]=undefined;}if(_0x55bbdb[_0xb407('0x13d')]===utils[_0xb407('0x6a')][_0xb407('0x7d')]){_0x201517['available']=0x0;_0x201517[_0xb407('0xf8')]=0x0;_0x201517['inUse']=0x0;_0x201517['talking']=0x0;_0x201517[_0xb407('0x13e')]=0x0;}}else if(_0x55bbdb[_0xb407('0x13d')]===utils[_0xb407('0x6a')][_0xb407('0x13f')]&&!_0x5bec47){return _0x59955e[_0xb407('0x8e')](_0x55bbdb,!![])[_0xb407('0x9c')](function(){return _0x59955e['ifTime'](_0x55bbdb,![]);})[_0xb407('0x9c')](function(){return _0x59955e[_0xb407('0xb1')](_0x55bbdb);})[_0xb407('0xa6')](function(_0xcc83fc){loggerSyncQueueSummary[_0xb407('0x60')](_0xb407('0x140'),util[_0xb407('0x67')](_0xcc83fc,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x55bbdb);});}else{clearPredictiveAttributes(_0x55bbdb);}})['then'](function(){var _0x247d4f=_0x201517[_0xb407('0x141')](_0x55bbdb);if(_0x247d4f||_0x55bbdb[_0xb407('0x142')]){_0x55bbdb[_0xb407('0x142')]=![];_0x201517[_0xb407('0x143')](_0x55bbdb);Object[_0xb407('0x144')](_0x55bbdb,_0x201517);emitOutboundVoiceQueueSummary(_0x201517);}_0x59955e['queuesSummary'][_0x55bbdb[_0xb407('0x61')]][_0xb407('0x13a')]=![];})['catch'](function(_0x91a7d8){logger[_0xb407('0x65')](_0xb407('0x140'),util[_0xb407('0x67')](_0x91a7d8,{'showHidden':![],'depth':null}));_0x59955e[_0xb407('0x2f')][_0x55bbdb['name']][_0xb407('0x13a')]=![];});};Dialer[_0xb407('0x1d')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x179183=_[_0xb407('0x145')](this['voiceQueues'],function(_0x2837fa){return _0x2837fa['dialPreviewRecallmeReminder'];});var _0x171dc0=_['filter'](this['agents'],function(_0x14576d){return _0x14576d['online']&&_0x14576d[_0xb407('0x86')]===_0xb407('0x146');});if(_0x179183['length']>0x0&&_0x171dc0[_0xb407('0x147')]>0x0){return Promise[_0xb407('0x148')]()[_0xb407('0x9c')](cmHopper['handlePreviewRecallNotifications'](_[_0xb407('0x149')](_0x179183,'id'),previewRecallmeReminderInterval,_['map'](_0x171dc0,'id')))[_0xb407('0x9c')](function(_0x145ea7){for(var _0x1985f5=0x0;_0x1985f5<_0x145ea7[_0xb407('0x147')];_0x1985f5++){var _0x4e07e2=_0x145ea7[_0x1985f5][_0xb407('0x14a')]['name'];if(_0x4e07e2)io['to'](util[_0xb407('0x44')](_0xb407('0x14b'),_0x4e07e2))[_0xb407('0x11b')]('user:dialPreviewRecallReminder',{'hopper':_0x145ea7[_0x1985f5]});}})[_0xb407('0xa6')](function(_0x407ffa){logger[_0xb407('0x65')](_0xb407('0x14c'),_0x407ffa);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb407('0x1d')][_0xb407('0x3e')]=function(){var _0x2aad33=this;setInterval(function(){_0x2aad33[_0xb407('0x14d')](_0x2aad33[_0xb407('0x2a')],_0xb407('0x14e'));_0x2aad33[_0xb407('0x14d')](_0x2aad33['actions'],_0xb407('0x14f'));},0x32c8);};Dialer['prototype'][_0xb407('0x14d')]=function(_0xed9a8a,_0x12b630){var _0x314b98=this;for(var _0x17cdbb in _0xed9a8a){if(typeof _0xed9a8a[_0x17cdbb]!==_0xb407('0xaa')){this[_0xb407('0x21')]['enqueue'](function(){if(!_['isNil'](_0xed9a8a[_0x17cdbb])){return ami[_0xb407('0x97')]({'action':'status','channel':_0xed9a8a[_0x17cdbb][_0xb407('0xf1')]})[_0xb407('0xa6')](function(_0x4bc502){if(_0x4bc502['message']===_0xb407('0x150')){setTimeout(function(){if(_0xed9a8a[_0x17cdbb]&&_0xed9a8a[_0x17cdbb]['type']!==_0xb407('0xc0')){_0x314b98[_0xb407('0xca')](_0x314b98[_0xb407('0xbe')][_0xed9a8a[_0x17cdbb][_0xb407('0xc1')]]);logger[_0xb407('0x65')](_0xb407('0x151'),_0x12b630,_0x17cdbb,_0xed9a8a[_0x17cdbb][_0xb407('0xc1')]);delete _0xed9a8a[_0x17cdbb];}if(_0xed9a8a[_0x17cdbb]&&_0xed9a8a[_0x17cdbb][_0xb407('0x41')]===_0xb407('0xc0')){_0x314b98['updateOriginated'](_0x314b98[_0xb407('0x23')][_0xed9a8a[_0x17cdbb][_0xb407('0xc1')]]);logger[_0xb407('0x65')]('[Dialer][checkChannel][ivr]',_0x12b630,_0x17cdbb,_0xed9a8a[_0x17cdbb][_0xb407('0xc1')]);delete _0xed9a8a[_0x17cdbb];}},0x2328);}});}});}}};Dialer[_0xb407('0x1d')][_0xb407('0x152')]=function(_0x45aa84){return Promise[_0xb407('0x148')]()[_0xb407('0x9c')](voiceQueueRt[_0xb407('0x152')](_0x45aa84))[_0xb407('0xa6')](loggerCatch(_0xb407('0x153')));};Dialer[_0xb407('0x1d')][_0xb407('0xca')]=function(_0x19db80){if(!_['isUndefined'](_0x19db80)&&_0x19db80!==null){if(typeof _0x19db80[_0xb407('0x154')]!=='undefined'){if(_0x19db80['originated']>0x0){_0x19db80['originated']-=0x1;}else{logger[_0xb407('0x65')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xb407('0x155'));}};Dialer[_0xb407('0x1d')][_0xb407('0x156')]=function(_0x345835,_0x5038fa){var _0x6a8911=this;return function(_0x5956ce){_0x6a8911[_0xb407('0xca')](_0x5038fa);logger[_0xb407('0x65')](_0x345835,util['inspect'](_0x5956ce,{'showHidden':![],'depth':null}));};};Dialer[_0xb407('0x1d')][_0xb407('0x157')]=function(_0x11006d,_0x15344b,_0x19c54){var _0xe8f026={'state':0x19,'statedesc':_0xb407('0x158')};this['updateOriginated'](_0x15344b);this[_0xb407('0x11d')](_[_0xb407('0x159')](_0xe8f026,_['pick'](_0x19c54,[_0xb407('0xdf'),_0xb407('0xfe'),_0xb407('0x15a'),_0xb407('0xe0'),'CampaignId'])),_0xb407('0x15b'),'[emptyContact]');logger['error'](_0x11006d);};Dialer[_0xb407('0x1d')]['saveInDb']=function(_0x1ba0e9,_0x104985,_0x5c28b7){hopperUtils[_0xb407('0xee')](_0x1ba0e9)[_0xb407('0xa6')](loggerCatch(_0x104985));hopperUtils['moveContactManagedDialer'](_0x1ba0e9)[_0xb407('0xa6')](loggerCatch(_0x5c28b7));};Dialer[_0xb407('0x1d')][_0xb407('0xdb')]=function(_0x3e78c8,_0x88107b){hopperUtils[_0xb407('0xee')](_0x3e78c8)[_0xb407('0xa6')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x88107b==0x0){hopperUtils['moveContactManagedDialer'](_0x3e78c8)['catch'](loggerCatch(_0xb407('0x15c')));}};Dialer[_0xb407('0x1d')][_0xb407('0x14c')]=function(_0x24d232){return Promise['resolve']()[_0xb407('0x9c')](cmHopper[_0xb407('0x15d')](_0x24d232['id'],previewRecallmeReminderInterval))[_0xb407('0x9c')](function(_0x4fdabc){for(var _0x5472d5=0x0;_0x5472d5<_0x4fdabc[_0xb407('0x147')];_0x5472d5++){var _0x4c5b24=_0x4fdabc[_0x5472d5]['Agent'][_0xb407('0x61')];if(_0x4c5b24)io['to'](util[_0xb407('0x44')]('user:%s',_0x4c5b24))['emit'](_0xb407('0x15e'),{'hopper':_0x4fdabc[_0x5472d5]});}})[_0xb407('0xa6')](function(){});};Dialer[_0xb407('0x1d')][_0xb407('0xaf')]=function(_0x56ce8d){var _0x34c1cd=this;return function(){_0x34c1cd[_0xb407('0x15f')](_0x56ce8d);};};Dialer['prototype'][_0xb407('0x160')]=function(_0x5bee61,_0x1cb2f9){var _0x1f91c2=this;var _0xe856f4=uuid['v4']();this['actions'][_0xe856f4]=new Action(_0x5bee61,_0x1cb2f9,_0xe856f4);return new Promise(function(_0x1b9dd9,_0x347c2a){if(_[_0xb407('0x52')](_0x5bee61)&&typeof _0x5bee61!=='object'){return _0x347c2a(msgResponse(_0xb407('0x161'),'Failure',_0xb407('0x162')));}if(_[_0xb407('0x52')](_0x1cb2f9[_0xb407('0x163')])||_0x1cb2f9[_0xb407('0x163')]===null){return _0x347c2a(msgResponse('originate',_0xb407('0xa3'),_0xb407('0x164')));}var _0x3320ea={'XMD-CALLERID':_0x1f91c2[_0xb407('0x28')][_0xe856f4][_0xb407('0x165')](),'XMD-AGI':_0x5bee61['dialQueueProject']?util['format'](_0xb407('0x166'),ipAgi,_0x5bee61[_0xb407('0x134')]):_0xb407('0x167'),'XMD-AGIAFTER':_0x5bee61['dialQueueProject2']?util[_0xb407('0x44')](_0xb407('0x166'),ipAgi,_0x5bee61['dialQueueProject2']):_0xb407('0x167'),'XMD-QUEUE':utils[_0xb407('0x168')](_0x5bee61)?util[_0xb407('0x44')](_0xb407('0x169'),_0x5bee61['name'],_0x5bee61['dialQueueOptions']||'',_0x5bee61['dialAgiAfterHangupAgent']?'c':'',_0x5bee61[_0xb407('0xcd')]||0x3):_0xb407('0x167'),'XMD-CONTACTID':_0x1cb2f9[_0xb407('0xdf')],'XMD-CDRTYPE':_0xb407('0x8'),'CALLERID(all)':_0x1f91c2[_0xb407('0x28')][_0xe856f4][_0xb407('0x165')](),'XMD-AMD':_0x5bee61[_0xb407('0x114')]?'ACTIVE':_0xb407('0x167'),'XMD-DESTINATION':_0xb407('0x113')};if(_0x5bee61['dialAMDActive']){_0x3320ea[_0xb407('0x16a')]=_0x5bee61[_0xb407('0x16b')]||0x9c4;_0x3320ea[_0xb407('0x16c')]=_0x5bee61['dialAMDGreeting']||0x5dc;_0x3320ea[_0xb407('0x16d')]=_0x5bee61[_0xb407('0x16e')]||0x320;_0x3320ea[_0xb407('0x16f')]=_0x5bee61[_0xb407('0x170')]||0x1388;_0x3320ea[_0xb407('0x171')]=_0x5bee61['dialAMDMinWordLength']||0x64;_0x3320ea[_0xb407('0x172')]=_0x5bee61[_0xb407('0x173')]||0x32;_0x3320ea[_0xb407('0x174')]=_0x5bee61[_0xb407('0x175')]||0x3;_0x3320ea['XMD-AMDSILENCETHRESHOLD']=_0x5bee61[_0xb407('0x176')]||0x100;_0x3320ea['XMD-AMDMAXIMUMWORDLENGTH']=_0x5bee61[_0xb407('0x177')]||0x1388;}if(utils['isOutboundQueue'](_0x5bee61)){_0x3320ea[_0xb407('0x178')]=_0x1cb2f9['VoiceQueueId'];}else{_0x3320ea[_0xb407('0x179')]=_0x1cb2f9['CampaignId'];}var _0x183400=utils['setXMDContactVariables'](_0x1cb2f9[_0xb407('0x17a')]);Object['assign'](_0x3320ea,_0x183400);var _0xebaecf=_0x1f91c2[_0xb407('0x83')](_0x5bee61[_0xb407('0x88')])?utils[_0xb407('0x17b')](_0x5bee61['Trunk'][_0xb407('0x17c')],_0x5bee61[_0xb407('0x17d')],_0x5bee61['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x5bee61[_0xb407('0x17e')],_0x5bee61[_0xb407('0x17f')]):_0x5bee61[_0xb407('0x17e')]):utils[_0xb407('0x17b')](_[_0xb407('0xf6')](_0x5bee61[_0xb407('0x89')])?_0x5bee61['Trunk']['callerid']:_0x5bee61[_0xb407('0x89')]['callerid'],_0x5bee61[_0xb407('0x17d')],_0x5bee61[_0xb407('0x17f')]>0x0?utils[_0xb407('0x180')](_0x5bee61[_0xb407('0x17e')],_0x5bee61[_0xb407('0x17f')]):_0x5bee61[_0xb407('0x17e')]);if(_0xebaecf){_0x3320ea[_0xb407('0x181')]=_0x1f91c2[_0xb407('0x28')][_0xe856f4][_0xb407('0x182')]=utils['extractCalleridName'](_0xebaecf);_0x3320ea['XMD-ORIGINATECALLERIDNUM']=_0x1cb2f9[_0xb407('0x163')];}_0x5bee61[_0xb407('0x183')]=_0x3320ea;return ami[_0xb407('0x97')]({'actionid':_0xe856f4,'action':_0xb407('0x161'),'channel':_0x1f91c2[_0xb407('0x83')](_0x5bee61[_0xb407('0x88')])?util[_0xb407('0x44')]('SIP/%s/%s%s',_0x5bee61[_0xb407('0x88')]['name'],isNotNull(_0x5bee61[_0xb407('0x184')])?_0x5bee61[_0xb407('0x184')][_0xb407('0x185')]()||'':'',_0x5bee61[_0xb407('0x186')]>0x0?_0x1cb2f9[_0xb407('0x163')][_0xb407('0x187')](_0x5bee61[_0xb407('0x186')]):_0x1cb2f9['phone']):util['format'](_0xb407('0x188'),_['isNil'](_0x5bee61['TrunkBackup'])?_0x5bee61[_0xb407('0x88')][_0xb407('0x61')]:_0x5bee61[_0xb407('0x89')][_0xb407('0x61')],isNotNull(_0x5bee61[_0xb407('0x184')])?_0x5bee61[_0xb407('0x184')][_0xb407('0x185')]()||'':'',_0x5bee61['dialCutDigit']>0x0?_0x1cb2f9['phone'][_0xb407('0x187')](_0x5bee61['dialCutDigit']):_0x1cb2f9['phone']),'callerid':_0xebaecf,'Exten':'xcally-motion-dialer','Context':_0xb407('0x189'),'Priority':'1','variable':_0x3320ea,'timeout':(_0x5bee61[_0xb407('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xe856f4})['then'](function(_0xae1376){return _0x1b9dd9(_0xae1376);})[_0xb407('0xa6')](function(_0xa735c0){_0x5bee61[_0xb407('0x18b')]+=0x1;var _0x4a47f4=new History(_0x1f91c2[_0xb407('0x28')][_0xe856f4]);logger[_0xb407('0x65')](util[_0xb407('0x44')](_0xb407('0x18c'),JSON[_0xb407('0x74')](_0xa735c0)));_0x4a47f4['state']=0xe;_0x4a47f4[_0xb407('0x70')]=_0xb407('0x18d');_0x4a47f4[_0xb407('0x72')]=moment()[_0xb407('0x44')](_0xb407('0xc6'));_0x4a47f4[_0xb407('0x71')]=_0x4a47f4['starttime'];hopperUtils[_0xb407('0xee')](_0x4a47f4)[_0xb407('0xa6')](loggerCatch(_0xb407('0x18e')));_0x1f91c2['moveContactManagedDialer'](_0x4a47f4)['catch'](loggerCatch(_0xb407('0x18e')))['finally'](function(){delete _0x1f91c2[_0xb407('0x28')][_0xe856f4];return _0x347c2a(msgResponse('originate',_0xb407('0x82'),'originate\x20action\x20Error'));});});});};Dialer[_0xb407('0x1d')][_0xb407('0x18f')]=function(_0x376403,_0x2019b7,_0x3356db){var _0x1ad0bc=new History(_0x2019b7);if(_0x1ad0bc[_0xb407('0x123')]+_0x1ad0bc[_0xb407('0x124')]+_0x1ad0bc['countnoanswerretry']+_0x1ad0bc[_0xb407('0x131')]+_0x1ad0bc['countdropretry']+_0x1ad0bc[_0xb407('0xe9')]+_0x1ad0bc[_0xb407('0x120')]+_0x1ad0bc[_0xb407('0x126')]>=_0x3356db[_0xb407('0x127')]-0x1){return!![];}switch(_0x376403){case 0x3:if(_0x1ad0bc[_0xb407('0x125')]>=_0x3356db[_0xb407('0x190')]-0x1){return!![];}hopperUtils[_0xb407('0xdc')]({'active':![],'countnoanswerretry':_0x1ad0bc[_0xb407('0x125')]+=0x1,'scheduledat':moment()[_0xb407('0xdd')](_0x3356db[_0xb407('0x191')],_0xb407('0xde'))[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x1ad0bc[_0xb407('0xdf')],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})['catch'](loggerCatch(_0xb407('0x192')));break;case 0x5:if(_0x1ad0bc[_0xb407('0x123')]>=_0x3356db[_0xb407('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1ad0bc[_0xb407('0x123')]+=0x1,'scheduledat':moment()[_0xb407('0xdd')](_0x3356db[_0xb407('0x194')],_0xb407('0xde'))[_0xb407('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ad0bc['ContactId'],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1ad0bc['countcongestionretry']>=_0x3356db[_0xb407('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1ad0bc['countcongestionretry']+=0x1,'scheduledat':moment()[_0xb407('0xdd')](_0x3356db[_0xb407('0x196')],_0xb407('0xde'))[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x1ad0bc[_0xb407('0xdf')],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})['catch'](loggerCatch(_0xb407('0x197')));break;case 0x0:if(_0x1ad0bc['countnosuchnumberretry']>=_0x3356db[_0xb407('0x198')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1ad0bc[_0xb407('0x131')]+=0x1,'scheduledat':moment()['add'](_0x3356db[_0xb407('0x199')],_0xb407('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ad0bc['ContactId'],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x19a')));}break;case 0xa:if(_0x1ad0bc[_0xb407('0xd3')]>=_0x3356db['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xb407('0xdc')]({'active':![],'countdropretry':_0x1ad0bc[_0xb407('0xd3')]+=0x1,'scheduledat':moment()['add'](_0x3356db[_0xb407('0xd5')],'minutes')[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x1ad0bc[_0xb407('0xdf')],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1ad0bc[_0xb407('0xe9')]>=_0x3356db[_0xb407('0x19b')]-0x1){return!![];}hopperUtils[_0xb407('0xdc')]({'active':![],'countabandonedretry':_0x1ad0bc[_0xb407('0xe9')]+=0x1,'scheduledat':moment()[_0xb407('0xdd')](_0x3356db['dialAbandonedRetryFrequency'],_0xb407('0xde'))[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x1ad0bc[_0xb407('0xdf')],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0xed')));break;case 0x13:if(_0x1ad0bc[_0xb407('0x120')]>=_0x3356db[_0xb407('0x12a')]-0x1){return!![];}hopperUtils[_0xb407('0xdc')]({'active':![],'countmachineretry':_0x1ad0bc[_0xb407('0x120')]+=0x1,'scheduledat':moment()[_0xb407('0xdd')](_0x3356db[_0xb407('0x19c')],_0xb407('0xde'))['format'](_0xb407('0xc6')),'ContactId':_0x1ad0bc[_0xb407('0xdf')],'ListId':_0x1ad0bc['ListId'],'VoiceQueueId':_0x1ad0bc[_0xb407('0xe0')]||undefined,'CampaignId':_0x1ad0bc['CampaignId']||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x12d')));break;case 0x14:if(_0x1ad0bc['countagentrejectretry']>=_0x3356db[_0xb407('0x19d')]-0x1){return!![];}hopperUtils[_0xb407('0xdc')]({'active':![],'countagentrejectretry':_0x1ad0bc[_0xb407('0x126')]+=0x1,'scheduledat':moment()[_0xb407('0xdd')](_0x3356db[_0xb407('0x19e')],_0xb407('0xde'))[_0xb407('0x44')](_0xb407('0xc6')),'ContactId':_0x1ad0bc[_0xb407('0xdf')],'ListId':_0x1ad0bc[_0xb407('0xfe')],'VoiceQueueId':_0x1ad0bc['VoiceQueueId']||undefined,'CampaignId':_0x1ad0bc[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xb407('0x10d')]=function(_0x21102f,_0x517f70,_0xc64a63){var _0x530501=this;var _0x1172bd=new History(_0x21102f);var _0x4bd8c0=![];var _0x165d1f;var _0x48ef3a;return new Promise(function(_0x27c615,_0x4989a5){if(_['isUndefined'](_0x517f70)&&typeof _0x517f70!==_0xb407('0x19f')){return _0x4989a5(msgResponse(_0xb407('0x1a0'),_0xb407('0xa3'),_0xb407('0x1a1')));}if(_[_0xb407('0x52')](_0xc64a63)&&typeof _0xc64a63!=='object'){return _0x4989a5(msgResponse('[callProgressDetecting]','Failure',_0xb407('0x1a2')));}hopperUtils['verifyAdditionalPhones'](_0x1172bd,_0xc64a63[_0xb407('0xc3')],_0x517f70)[_0xb407('0x9c')](function(_0x166151){if(_0x166151[_0xb407('0xea')]==0x1)_0x4bd8c0=!![];switch(_0xc64a63[_0xb407('0xc3')]){case'0':_0x517f70[_0xb407('0x1a3')]+=0x1;_0x1172bd[_0xb407('0xd8')]=0x0;_0x1172bd[_0xb407('0x70')]='NoSuchNumber';_0x1172bd[_0xb407('0x131')]+=0x1;_0x1172bd['countglobal']+=0x1;ami[_0xb407('0x11b')](_0xb407('0x1a4'),ut['buildObj'](_0x21102f,_0xb407('0x1a5')));_0x165d1f=_0x517f70[_0xb407('0x199')];_0x48ef3a=_0x517f70[_0xb407('0xd6')];hopperUtils['createHistory'](_0x1172bd)[_0xb407('0xa6')](loggerCatch(_0xb407('0x122')));if(_0x530501['checkRetriveMax'](0x0,_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd[_0xb407('0x131')]>=_0x517f70['dialNoSuchNumberMaxRetry']){_0x530501[_0xb407('0x12b')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1a6'));}else{_0x530501[_0xb407('0x128')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1a6'));}}break;case'3':_0x517f70[_0xb407('0x1a7')]+=0x1;_0x1172bd[_0xb407('0xd8')]=0x3;_0x1172bd[_0xb407('0x70')]=_0xb407('0x1a8');_0x1172bd[_0xb407('0x125')]+=0x1;_0x1172bd['countglobal']+=0x1;var _0x3cade7=ut[_0xb407('0x1a9')](_0x21102f,_0x517f70);ami[_0xb407('0x11b')](_0xb407('0x1aa'),_0x3cade7);_0x165d1f=_0x517f70[_0xb407('0x191')];_0x48ef3a=_0x517f70['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1172bd)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x530501[_0xb407('0x18f')](0x3,_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd[_0xb407('0x125')]>=_0x517f70['dialNoAnswerMaxRetry']){_0x530501['createStateFinal'](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1ab'));}else{_0x530501[_0xb407('0x128')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1ab'));}}break;case'5':_0x517f70[_0xb407('0x1ac')]+=0x1;_0x1172bd['state']=0x5;_0x1172bd['statedesc']=_0xb407('0x1ad');_0x1172bd[_0xb407('0x123')]+=0x1;_0x1172bd[_0xb407('0xd4')]+=0x1;ami['emit'](_0xb407('0x1ae'),ut[_0xb407('0x11c')](_0x21102f,_0xb407('0x1af')));_0x165d1f=_0x517f70['dialBusyRetryFrequency'];_0x48ef3a=_0x517f70[_0xb407('0xd6')];hopperUtils[_0xb407('0xee')](_0x1172bd)[_0xb407('0xa6')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x530501[_0xb407('0x18f')](0x5,_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd[_0xb407('0x123')]>=_0x517f70[_0xb407('0x193')]){_0x530501[_0xb407('0x12b')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1b0'));}else{_0x530501[_0xb407('0x128')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1b0'));}}break;case'8':_0x517f70[_0xb407('0x1b1')]+=0x1;_0x1172bd[_0xb407('0xd8')]=0x8;_0x1172bd[_0xb407('0x70')]='Congestion';_0x1172bd[_0xb407('0x124')]+=0x1;_0x1172bd[_0xb407('0xd4')]+=0x1;_0x165d1f=_0x517f70['dialCongestionRetryFrequency'];_0x48ef3a=_0x517f70[_0xb407('0xd6')];ami[_0xb407('0x11b')](_0xb407('0x1b2'),ut[_0xb407('0x11c')](_0x21102f,_0xb407('0x1b3')));hopperUtils[_0xb407('0xee')](_0x1172bd)[_0xb407('0xa6')](loggerCatch(_0xb407('0x1b4')));if(_0x530501[_0xb407('0x18f')](0x8,_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd[_0xb407('0x124')]>=_0x517f70['dialCongestionMaxRetry']){_0x530501[_0xb407('0x12b')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1b5'));}else{_0x530501['stateGlobal'](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1b5'));}}break;case'11':_0x517f70[_0xb407('0x1b6')]+=0x1;_0x1172bd[_0xb407('0xd8')]=0xb;_0x1172bd[_0xb407('0x70')]=_0xb407('0xe8');_0x1172bd[_0xb407('0xe9')]+=0x1;_0x1172bd[_0xb407('0xd4')]+=0x1;_0x165d1f=_0x517f70['dialAbandonedRetryFrequency'];_0x48ef3a=_0x517f70[_0xb407('0xd6')];hopperUtils[_0xb407('0xee')](_0x1172bd)[_0xb407('0xa6')](loggerCatch(_0xb407('0xef')));if(_0x530501[_0xb407('0x18f')](0xb,_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd[_0xb407('0xe9')]>=_0x517f70[_0xb407('0x19b')]){_0x530501[_0xb407('0x12b')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1b7'));}else{_0x530501[_0xb407('0x128')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1b7'));}}break;case'20':_0x517f70[_0xb407('0x1b8')]+=0x1;_0x1172bd[_0xb407('0xd8')]=0x14;_0x1172bd[_0xb407('0x70')]=_0xb407('0x1b9');_0x1172bd[_0xb407('0x126')]+=0x1;_0x1172bd['countglobal']+=0x1;_0x165d1f=_0x517f70['dialAgentRejectRetryFrequency'];_0x48ef3a=_0x517f70['callAdditionalPhoneAfterMin'];ami[_0xb407('0x11b')](_0xb407('0x1ba'),ut[_0xb407('0x11c')](_0x21102f,'agentreject'));hopperUtils['createHistory'](_0x1172bd)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x530501[_0xb407('0x18f')](0x14,_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd[_0xb407('0x126')]>=_0x517f70['dialAgentRejectMaxRetry']){_0x530501[_0xb407('0x12b')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1bb'));}else{_0x530501[_0xb407('0x128')](_0x1172bd,_0x27c615,_0x4989a5,_0xb407('0x1bb'));}}break;default:_0x517f70['outboundUnknownCallsDay']+=0x1;_0x1172bd[_0xb407('0xd8')]=0xc;_0x1172bd['statedesc']=_0xc64a63[_0xb407('0xc3')];_0x165d1f=_0x517f70[_0xb407('0x19e')];_0x48ef3a=_0x517f70['callAdditionalPhoneAfterMin'];hopperUtils[_0xb407('0xee')](_0x1172bd)[_0xb407('0xa6')](loggerCatch(_0xb407('0x1bc')));if(_0x530501[_0xb407('0x18f')](_0xc64a63[_0xb407('0xc3')],_0x21102f,_0x517f70)&&!_0x4bd8c0){if(_0x1172bd['countbusyretry']+_0x1172bd[_0xb407('0x124')]+_0x1172bd[_0xb407('0x125')]+_0x1172bd[_0xb407('0x131')]+_0x1172bd[_0xb407('0xd3')]+_0x1172bd[_0xb407('0xe9')]+_0x1172bd[_0xb407('0x120')]+_0x1172bd[_0xb407('0x126')]>=_0x517f70[_0xb407('0x127')]){_0x530501[_0xb407('0x128')](_0x1172bd,_0x27c615,_0x4989a5,_0xc64a63[_0xb407('0xc3')]);}else{_0x530501['createStateFinal'](_0x1172bd,_0x27c615,_0x4989a5,_0xc64a63['reason']);}}}})[_0xb407('0x9c')](function(){if(_0x4bd8c0){hopperUtils[_0xb407('0xe5')](_0x1172bd,_0x165d1f,_0x48ef3a)[_0xb407('0x9c')](function(){return _0x27c615(0x1);});}});});};Dialer[_0xb407('0x1d')][_0xb407('0x128')]=function(_0x1853cb,_0x5af2fc,_0x49d399,_0x4c71c3){var _0xbce213=new Final(_0x1853cb);_0xbce213[_0xb407('0xd8')]=0xf;_0xbce213[_0xb407('0x70')]='Global';this[_0xb407('0x12b')](_0xbce213,_0x5af2fc,_0x49d399,_0x4c71c3);};Dialer[_0xb407('0x1d')][_0xb407('0x12b')]=function(_0x4f2b76,_0x4b78ed,_0x42ec53,_0x305229){hopperUtils[_0xb407('0xc8')](_0x4f2b76)[_0xb407('0x9c')](function(){return _0x4b78ed(msgResponse(_0xb407('0x1a0'),'Success',_0x305229));})[_0xb407('0xa6')](function(){return _0x42ec53(msgResponse(_0xb407('0x1bd'),_0xb407('0xa3'),_0xb407('0x1be')));});};Dialer[_0xb407('0x1d')][_0xb407('0xb')]=function(_0x3431bb){var _0x197dd1=_0x3431bb['dialPredictiveOptimizationPercentage']/0x64;var _0x165a3e=_0x3431bb[_0xb407('0xcf')]/(_0x3431bb[_0xb407('0xcf')]+_0x3431bb[_0xb407('0xc2')]);var _0x4a5522=Math[_0xb407('0x1bf')](_0x3431bb[_0xb407('0x1c0')]*(_0x3431bb[_0xb407('0x1c1')]/0x64));var _0x15afe6=Math[_0xb407('0x1bf')](_0x3431bb[_0xb407('0x1c0')]*(_0x3431bb[_0xb407('0x1c2')]/0x64));var _0x5f385f=_0x3431bb[_0xb407('0x1c3')]+_0x3431bb[_0xb407('0x1c4')];var _0x3937b1=Math['floor'](_0x3431bb[_0xb407('0x58')]*_0x3431bb[_0xb407('0x1c5')]*_0x3431bb[_0xb407('0x1c6')]*_0x3431bb[_0xb407('0x1c7')]);if(_['isUndefined'](_0x3431bb[_0xb407('0x5f')])){if(!_['isUndefined'](_0x3431bb['startPredictive'])){_0x3431bb[_0xb407('0x2c')]=undefined;loggerPredictive[_0xb407('0x65')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xb407('0x52')](_0x3431bb['handlePredictive'])){loggerPredictive[_0xb407('0x65')](_0xb407('0x1c8'),_0xb407('0x1c9'));clearInterval(_0x3431bb[_0xb407('0x63')]);_0x3431bb[_0xb407('0x63')]=undefined;}_0x3431bb[_0xb407('0x5f')]=moment()[_0xb407('0x44')](_0xb407('0xc6'));loggerPredictive['info'](_0x3431bb[_0xb407('0x61')],_0xb407('0x1ca'),_0x3431bb[_0xb407('0x5f')]);this[_0xb407('0xb5')](_0x3431bb,0x1);}else if(ifInterval(_0x3431bb['dialPredictiveInterval'],_0x3431bb['startProgressive'])){this[_0xb407('0xb5')](_0x3431bb,0x1);loggerPredictiveCalls[_0xb407('0x48')](_0xb407('0x1cb'),_0x3431bb['startProgressive'],_0x3431bb[_0xb407('0x61')]);_0x3431bb[_0xb407('0x58')]=0x0;_0x3431bb[_0xb407('0xd0')]=0x0;}else if(_0x197dd1<_0x165a3e&&_0x3431bb[_0xb407('0x1cc')]===_0xb407('0x1cd')){clearPredictiveAttributes(_0x3431bb);loggerPredictive[_0xb407('0x48')](_0xb407('0x1ce'),_0xb407('0x1cf'),_0x165a3e,_0xb407('0x5f'),_0x3431bb[_0xb407('0x61')]);}else if(_0x3937b1<_0x3431bb[_0xb407('0xd0')]&&_0x3431bb[_0xb407('0x1cc')]===_0xb407('0x1cd')){clearPredictiveAttributes(_0x3431bb);loggerPredictive[_0xb407('0x48')](_0xb407('0x1d0'),'Max\x20Drop\x20',_0x3937b1,_0xb407('0x1d1'),_0x3431bb[_0xb407('0xd0')],_0xb407('0x5f'),_0x3431bb[_0xb407('0x61')]);}else if(!ifInterval(_0x3431bb[_0xb407('0x1d2')],_0x3431bb[_0xb407('0x5f')])&&_[_0xb407('0x52')](_0x3431bb[_0xb407('0x2c')])&&!_['isUndefined'](_0x3431bb[_0xb407('0x5f')])){_0x3431bb[_0xb407('0x2c')]=moment()[_0xb407('0x44')](_0xb407('0xc6'));loggerPredictive['info'](_0x3431bb[_0xb407('0x61')],_0xb407('0x1d3'),_0x3431bb['startPredictive']);hopperUtils[_0xb407('0x1d4')](_0x3431bb[_0xb407('0x1d2')])[_0xb407('0x9c')](this['getDataPredictive'](_0x3431bb))['then'](mergeDataErlangB(_0x3431bb))[_0xb407('0x9c')](this[_0xb407('0x1d5')](_0x3431bb))[_0xb407('0xa6')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3431bb));}else if(!ifInterval(_0x3431bb[_0xb407('0x1d2')],_0x3431bb[_0xb407('0x2c')])){_0x3431bb[_0xb407('0xd0')]=0x0;_0x3431bb['startPredictive']=moment()[_0xb407('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xb407('0x48')](_0x3431bb[_0xb407('0x61')],'recalculate\x20predictive\x20at',_0x3431bb[_0xb407('0x2c')]);clearInterval(_0x3431bb[_0xb407('0x63')]);_0x3431bb[_0xb407('0x63')]=undefined;hopperUtils[_0xb407('0x1d4')](_0x3431bb['dialPredictiveInterval'])[_0xb407('0x9c')](this[_0xb407('0x1d6')](_0x3431bb))[_0xb407('0x9c')](mergeDataErlangB(_0x3431bb))[_0xb407('0x9c')](this['startMethodPredictive'](_0x3431bb))[_0xb407('0xa6')](loggerCatchPredictive(_0xb407('0x1d7'),_0x3431bb));}else if(_0x3431bb[_0xb407('0x1c0')]&&_0x5f385f<_0x3431bb[_0xb407('0x1c0')]-_0x15afe6){clearPredictiveAttributes(_0x3431bb);loggerPredictive[_0xb407('0x48')](_0x3431bb['name'],_0xb407('0x1d8'),_0x5f385f,_0xb407('0x1d9'),_0x3431bb[_0xb407('0x1c0')],'-',_0x15afe6,'=',_0x3431bb[_0xb407('0x1c0')]-_0x15afe6,')');}else if(_0x3431bb[_0xb407('0x1c0')]&&_0x5f385f>_0x3431bb[_0xb407('0x1c0')]+_0x4a5522){clearPredictiveAttributes(_0x3431bb);loggerPredictive['info'](_0x3431bb[_0xb407('0x61')],_0xb407('0x1d8'),_0x5f385f,')\x20are\x20more\x20than\x20threshold\x20(',_0x3431bb['predictiveIntervalAvailable'],'+',_0x4a5522,'=',_0x3431bb[_0xb407('0x1c0')]+_0x4a5522,')');}};Dialer['prototype']['getDataPredictive']=function(_0x367091){var _0x44b37c=this;return function(_0x1d6f90){return new Promise(function(_0x22efcb,_0x6505b1){_[_0xb407('0x159')](_0x367091,_0x1d6f90[0x0]);if(checkGetDataPredictive(_0x1d6f90[0x0])){var _0x4bec18=_0x367091[_0xb407('0x1c0')]=_0x367091['talking']+_0x367091[_0xb407('0x1c3')];var _0x57707d=_0x367091[_0xb407('0x1d2')]*0x3c;var _0x5cf7d2=_0x1d6f90[0x0][_0xb407('0x53')]+_0x1d6f90[0x0][_0xb407('0x55')];var _0x152b9f=(_0x1d6f90[0x0][_0xb407('0x4c')]+_0x1d6f90[0x0][_0xb407('0xce')]+_0x1d6f90[0x0][_0xb407('0xe6')])/_0x1d6f90[0x0][_0xb407('0x4a')];_0x367091[_0xb407('0x1c6')]=_0x152b9f>0x0?_0x152b9f:0x1;switch(_0x367091[_0xb407('0x1cc')]){case _0xb407('0x1cd'):var _0x3188ac=_0x367091['dialPredictiveOptimizationPercentage']/0x64;return _0x44b37c['abandonmentRate'](_0x4bec18,_0x57707d,_0x5cf7d2,_0x152b9f,_0x3188ac)[_0xb407('0x9c')](function(_0x143fb8){return _0x22efcb(_0x143fb8);});case'agentBusyFactor':var _0x977243=_0x367091[_0xb407('0x1da')]/0x64;return _0x44b37c[_0xb407('0x1db')](_0x4bec18,_0x57707d,_0x5cf7d2,_0x152b9f,_0x977243)[_0xb407('0x9c')](function(_0x1c52d8){return _0x22efcb(_0x1c52d8);});default:return _0x6505b1(msgResponse(_0xb407('0x1dc'),_0xb407('0xa3'),_0xb407('0x1dd')));}}else{return _0x6505b1(msgResponse(_0xb407('0x1dc'),'Failure',_0xb407('0x1de')));}});};};Dialer[_0xb407('0x1d')][_0xb407('0x1df')]=function(_0x3ba237){var _0x45a9d2=this;return function(_0x3d9a05){return new Promise(function(_0x1a815b,_0x1ac31f){_[_0xb407('0x159')](_0x3ba237,_0x3d9a05[0x0]);if(checkGetDataPredictive(_0x3d9a05[0x0])){loggerPredictive[_0xb407('0x48')](JSON['stringify'](_0x3d9a05[0x0]));if(_0x3ba237['dialPredictiveOptimization']==='dropRate'){return _0x45a9d2['getVoiceQueueRtPauses'](_0x3ba237['id'])[_0xb407('0x9c')](function(_0x4368e1){var _0x2f747e=_0x3ba237[_0xb407('0x1e0')]-_0x4368e1[0x0]['outboundQueuePauses'];var _0x1e32b8=_0x3ba237[_0xb407('0x1d2')]*0x3c;var _0x47b7d6=_0x3d9a05[0x0]['predictiveIntervalAvgTalktime']+_0x3d9a05[0x0][_0xb407('0x55')];var _0x517775=(_0x3d9a05[0x0][_0xb407('0x4c')]+_0x3d9a05[0x0][_0xb407('0xce')]+_0x3d9a05[0x0][_0xb407('0xe6')])/_0x3d9a05[0x0][_0xb407('0x4a')];var _0x3745b9=_0x3ba237[_0xb407('0x1da')]/0x64;_0x3ba237['predictiveIntervalPauses']=_0x4368e1[0x0][_0xb407('0x1e1')]||0x0;_0x3ba237['predictiveIntervalHitRate']=_0x517775>0x0?_0x517775:0x1;return _0x45a9d2[_0xb407('0x1e2')](_0x2f747e,_0x1e32b8,_0x47b7d6,_0x517775,_0x3745b9);})[_0xb407('0x9c')](function(_0x59c40e){return _0x1a815b(_0x59c40e);})[_0xb407('0xa6')](function(_0x2b4a54){return _0x1ac31f(msgResponse(_0xb407('0x1e3'),_0xb407('0xa3'),JSON[_0xb407('0x74')](_0x2b4a54)));});}if(_0x3ba237[_0xb407('0x1cc')]===_0xb407('0x1e4')){return _0x45a9d2[_0xb407('0x152')](_0x3ba237['id'])[_0xb407('0x9c')](function(_0x5f50bb){var _0x47e04b=_0x3ba237[_0xb407('0x1e0')]-_0x5f50bb[0x0]['outboundQueuePauses'];var _0x2ce7d2=_0x3ba237[_0xb407('0x1d2')]*0x3c;var _0x326be=_0x3d9a05[0x0][_0xb407('0x53')]+_0x3d9a05[0x0][_0xb407('0x55')];var _0x32960d=(_0x3d9a05[0x0]['predictiveIntervalAnsweredCalls']+_0x3d9a05[0x0][_0xb407('0xce')]+_0x3d9a05[0x0][_0xb407('0xe6')])/_0x3d9a05[0x0][_0xb407('0x4a')];var _0x388fee=_0x3ba237[_0xb407('0x1da')]/0x64;_0x3ba237['predictiveIntervalPauses']=_0x5f50bb[0x0][_0xb407('0x1e1')]||0x0;_0x3ba237[_0xb407('0x1c6')]=_0x32960d>0x0?_0x32960d:0x1;return _0x45a9d2[_0xb407('0x1db')](_0x47e04b,_0x2ce7d2,_0x326be,_0x32960d,_0x388fee);})['then'](function(_0xcf8376){return _0x1a815b(_0xcf8376);})[_0xb407('0xa6')](function(_0x233784){return _0x1ac31f(msgResponse('[CatchErlangB]',_0xb407('0xa3'),JSON[_0xb407('0x74')](_0x233784)));});}}else{return _0x1ac31f(msgResponse(_0xb407('0x1dc'),_0xb407('0xa3'),_0xb407('0x1de')));}});};};Dialer['prototype'][_0xb407('0x1d5')]=function(_0x15b1dd){var _0x4d122e=this;return function(){var _0x4c7c2c=0x0;var _0x4eef08=Math[_0xb407('0x1e5')](_0x15b1dd['erlangCallToSecond']*0x3e8);if(_0x4eef08>0x0){_0x4eef08=_0x4eef08<0x64?0x64:_0x4eef08;loggerPredictive[_0xb407('0x48')](_0x15b1dd['name'],_0xb407('0x1e6'),_0x4eef08,_0xb407('0x1e7'));_0x15b1dd[_0xb407('0x63')]=setInterval(function(){_0x4d122e[_0xb407('0x63')](_0x15b1dd);loggerPredictiveCalls[_0xb407('0x48')](_0xb407('0x1e8'),_0x4c7c2c+=0x1);},_0x4eef08);}else{loggerPredictive[_0xb407('0x48')](_0x15b1dd[_0xb407('0x61')],_0xb407('0x1e9'));}};};Dialer['prototype']['checkContactBlack']=function(_0x1165f9,_0xc14b2b){var _0x1a2e26=this;return function(_0x3ed80e){if(_['isEmpty'](_0x3ed80e)){if(_['isNil'](_0xc14b2b[_0xb407('0x15a')])||!_0xc14b2b[_0xb407('0x1ea')]){if(_0x1165f9['dialMethod']===_0xb407('0xa')){_0x1165f9[_0xb407('0x75')]=_[_0xb407('0x52')](_0x1165f9[_0xb407('0x75')])?!![]:_0x1165f9[_0xb407('0x75')];var _0x52ec5b=uuid['v4']();_0x1a2e26[_0xb407('0x28')][_0x52ec5b]=new Action(_0x1165f9,_0xc14b2b,_0x52ec5b);loggerBooked[_0xb407('0x48')](_0xb407('0x1eb'),_0x52ec5b,_0xb407('0x1ec'),JSON[_0xb407('0x74')](_0x1165f9[_0xb407('0x75')]),'Queue:\x20',_0x1165f9[_0xb407('0x61')]);if(_0x1165f9[_0xb407('0x75')]){_0x1165f9[_0xb407('0x75')]=![];_0x1a2e26[_0xb407('0x2e')][_0x1a2e26[_0xb407('0x28')][_0x52ec5b][_0xb407('0xc1')]]=[];ami[_0xb407('0x97')]({'actionid':_0x52ec5b,'action':_0xb407('0x1ed'),'queue':_0x1165f9[_0xb407('0x61')]})[_0xb407('0xa6')](function(){_0x1a2e26['updateOriginated'](_0x1165f9);hopperUtils[_0xb407('0xdc')]({'active':![],'ContactId':_0x1a2e26['actions'][_0x52ec5b][_0xb407('0xdf')],'ListId':_0x1a2e26[_0xb407('0x28')][_0x52ec5b][_0xb407('0xfe')],'VoiceQueueId':_0x1a2e26['actions'][_0x52ec5b][_0xb407('0xe0')]||undefined,'CampaignId':_0x1a2e26['actions'][_0x52ec5b][_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x1ee')));delete _0x1a2e26[_0xb407('0x28')][_0x52ec5b];});}else{loggerBooked[_0xb407('0x48')](_0xb407('0x1ef'),JSON[_0xb407('0x74')](_0x1165f9[_0xb407('0x75')]),_0xb407('0x1f0'),_0x1165f9[_0xb407('0x61')]);_0x1a2e26['updateOriginated'](_0x1165f9);hopperUtils[_0xb407('0xdc')]({'active':![],'ContactId':_0x1a2e26[_0xb407('0x28')][_0x52ec5b][_0xb407('0xdf')],'ListId':_0x1a2e26[_0xb407('0x28')][_0x52ec5b]['ListId'],'VoiceQueueId':_0x1a2e26[_0xb407('0x28')][_0x52ec5b][_0xb407('0xe0')]||undefined,'CampaignId':_0x1a2e26[_0xb407('0x28')][_0x52ec5b]['CampaignId']||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x1ee')));delete _0x1a2e26['actions'][_0x52ec5b];}}else{return _0x1a2e26[_0xb407('0x160')](_0x1165f9,_0xc14b2b);}}else{if(utils[_0xb407('0x5e')](undefined,_0xc14b2b[_0xb407('0x1f1')])<_0x1165f9['dialRecallMeTimeout']*0x3c){if(_0xc14b2b[_0xb407('0x14a')]&&!_0xc14b2b[_0xb407('0x14a')][_0xb407('0x1f2')]){_0x1a2e26[_0xb407('0x22')][_0xb407('0x105')](_0xc14b2b['id'])[_0xb407('0x20')](function(){_0x1a2e26[_0xb407('0xca')](_0x1165f9);});}else{hopperUtils[_0xb407('0x1f3')]({'active':![]},_0xc14b2b['id'],0x1)[_0xb407('0x20')](function(){_0x1a2e26[_0xb407('0xca')](_0x1165f9);});}}else{_0x1165f9[_0xb407('0x1f4')]+=0x1;_0x1a2e26[_0xb407('0xca')](_0x1165f9);if(_0x1165f9[_0xb407('0x1f5')]){hopperUtils[_0xb407('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xc14b2b[_0xb407('0xdf')],'ListId':_0xc14b2b['ListId'],'VoiceQueueId':_0xc14b2b['VoiceQueueId']||undefined,'CampaignId':_0xc14b2b[_0xb407('0xec')]||undefined})[_0xb407('0xa6')](loggerCatch(_0xb407('0x1f6')));hopperUtils['createHistory'](createObjHistory(_0x1165f9,_0xc14b2b,utils[_0xb407('0x6a')][_0xb407('0x1f7')],0x17,_0xb407('0x1f8')))[_0xb407('0xa6')](loggerCatch(_0xb407('0x1f9')));}else{_0x1a2e26[_0xb407('0x11d')](createObjHistory(_0x1165f9,_0xc14b2b,utils['CAMPAIGN_STATUS'][_0xb407('0x1fa')],0x16,_0xb407('0x1fb')),_0xb407('0x1fc'),_0xb407('0x1fd'));}}}}else{_0x1165f9[_0xb407('0x1fe')]+=0x1;_0x1a2e26['saveInDb'](createObjHistory(_0x1165f9,_0xc14b2b,utils[_0xb407('0x6a')][_0xb407('0x1ff')],0xd,_0xb407('0x200')),_0xb407('0x201'),'[Originate][MoveBlacklist]');throw _0xb407('0x202');}};};Dialer[_0xb407('0x1d')]['handleIvr']=function(_0x3ee1aa){var _0x47fbb9=this;var _0x78c1dd=_0x3ee1aa['limitCalls']-_0x3ee1aa[_0xb407('0x154')];emitCampaignSummary(_0x3ee1aa);if(_0x78c1dd>0x0&&_0x3ee1aa[_0xb407('0x203')]==0x0){if(_0x78c1dd>this[_0xb407('0x26')]){_0x78c1dd=this[_0xb407('0x26')];}_0x3ee1aa[_0xb407('0x203')]=0x1;hopperUtils[_0xb407('0x204')](_0x3ee1aa,_0x78c1dd)[_0xb407('0x9c')](function(_0x18e07c){_0x3ee1aa[_0xb407('0x203')]=0x0;if(_0x18e07c){if(!utils[_0xb407('0x205')](_0x18e07c)){_0x3ee1aa[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x6e')];logger[_0xb407('0x48')](_0xb407('0x206')+_0x3ee1aa[_0xb407('0x61')]);}else{_0x3ee1aa[_0xb407('0x154')]+=_0x18e07c[_0xb407('0x147')];_0x3ee1aa['message']=utils[_0xb407('0x6a')][_0xb407('0x207')];for(var _0x16f1f2=0x0;_0x16f1f2<_0x18e07c[_0xb407('0x147')];_0x16f1f2+=0x1){_0x3ee1aa[_0xb407('0x208')]+=0x1;if(_[_0xb407('0xf6')](_0x18e07c[_0x16f1f2])||_['isNil'](_0x18e07c[_0x16f1f2][_0xb407('0x17a')])||_[_0xb407('0xf6')](_0x18e07c[_0x16f1f2][_0xb407('0x163')])){_0x47fbb9['emptyContact'](_0xb407('0x209'),_0x3ee1aa,_0x18e07c[_0x16f1f2]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xb407('0xfa')](_0x18e07c[_0x16f1f2],[_0xb407('0xec'),_0xb407('0x163')]))[_0xb407('0x9c')](_0x47fbb9[_0xb407('0x20a')](_0x3ee1aa,_0x18e07c[_0x16f1f2]))['catch'](_0x47fbb9[_0xb407('0x156')](_0xb407('0x20b'),_0x3ee1aa));}}}}})[_0xb407('0xa6')](loggerGetContactDialer(_0xb407('0x20c'),_0x3ee1aa,_0x78c1dd));}};Dialer[_0xb407('0x1d')][_0xb407('0xb5')]=function(_0x37c0d3,_0x4736f8){var _0x5cca6a=this;var _0x571288=[];if(_0x4736f8<0x1||_0x37c0d3['dialMethod']===_0xb407('0xa')){_0x4736f8=0x1;}var _0x39b603=Math[_0xb407('0x1e5')](_0x37c0d3['available']*_0x4736f8)-_0x37c0d3['originated'];if(_0x37c0d3['dialLimitQueue']>0x0){var _0x4ca537=_0x37c0d3[_0xb407('0x20d')]-_0x37c0d3[_0xb407('0x154')]-_0x37c0d3[_0xb407('0x1c4')]-_0x37c0d3[_0xb407('0x13e')];if(_0x39b603>_0x4ca537){_0x39b603=_0x4ca537;}}if(_0x39b603>0x0&&_0x37c0d3['temp']==0x0){if(_0x37c0d3[_0xb407('0xb2')]==='booked'){_0x39b603=0x1;}if(_0x39b603>this['maxNumberOriginate']){_0x39b603=this[_0xb407('0x26')];}for(var _0x4a1bb8 in this[_0xb407('0x24')]){if(typeof this['agents'][_0x4a1bb8]!=='undefined'){if(this[_0xb407('0x24')][_0x4a1bb8][_0xb407('0xd8')]===_0xb407('0x20e')&&this['agents'][_0x4a1bb8]['status']===_0xb407('0x146')){_0x571288[_0xb407('0x96')](this[_0xb407('0x24')][_0x4a1bb8]['id']);}}}_0x37c0d3[_0xb407('0x203')]=0x1;hopperUtils[_0xb407('0x20f')](_0x37c0d3,_0x571288,_0x39b603)[_0xb407('0x9c')](function(_0x2df246){_0x37c0d3[_0xb407('0x203')]=0x0;if(_0x2df246){if(!utils[_0xb407('0x205')](_0x2df246)){hopperUtils['countReScheduled'](_0x37c0d3)[_0xb407('0x9c')](sendMessageReschedule(_0x37c0d3))[_0xb407('0xa6')](loggerCatch('[countReScheduled]\x20'));}else{_0x37c0d3[_0xb407('0x154')]+=_0x2df246['length'];_0x37c0d3['message']=_0x37c0d3['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0xb407('0x13f')]:utils[_0xb407('0x6a')][_0xb407('0x207')];for(var _0x4be9d3=0x0;_0x4be9d3<_0x2df246[_0xb407('0x147')];_0x4be9d3+=0x1){if(_['isNil'](_0x2df246[_0x4be9d3])||_[_0xb407('0xf6')](_0x2df246[_0x4be9d3]['Contact'])||_[_0xb407('0xf6')](_0x2df246[_0x4be9d3][_0xb407('0x163')])){_0x5cca6a[_0xb407('0x157')](_0xb407('0x209'),_0x37c0d3,_0x2df246[_0x4be9d3]);}else{hopperUtils[_0xb407('0x210')](_['pick'](_0x2df246[_0x4be9d3],[_0xb407('0xe0'),_0xb407('0x163')]))[_0xb407('0x9c')](_0x5cca6a[_0xb407('0x20a')](_0x37c0d3,_0x2df246[_0x4be9d3]))[_0xb407('0xa6')](_0x5cca6a[_0xb407('0x156')](_0xb407('0x209'),_0x37c0d3));}}}}})[_0xb407('0xa6')](loggerGetContactDialer(_0xb407('0x211'),_0x37c0d3,_0x39b603));}};Dialer[_0xb407('0x1d')][_0xb407('0x63')]=function(_0x1cb6ec){if(_0x1cb6ec[_0xb407('0x20d')]>0x0){var _0x1b95ea=_0x1cb6ec['dialLimitQueue']-_0x1cb6ec[_0xb407('0x154')]-_0x1cb6ec[_0xb407('0x1c4')];if(_0x1b95ea>0x0&&_0x1cb6ec['temp']==0x0){this['tryOriginatePredictive'](_0x1cb6ec);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x1cb6ec);}};Dialer[_0xb407('0x1d')]['tryOriginatePredictive']=function(_0x3b33ac){var _0x15883f=this;var _0x2fb13d=[];_0x3b33ac[_0xb407('0x154')]+=0x1;for(var _0x16c5ad in this[_0xb407('0x24')]){if(typeof this['agents'][_0x16c5ad]!==_0xb407('0xaa')){if(this['agents'][_0x16c5ad][_0xb407('0xd8')]===_0xb407('0x20e')&&this[_0xb407('0x24')][_0x16c5ad][_0xb407('0x86')]==='reachable'){_0x2fb13d['push'](this[_0xb407('0x24')][_0x16c5ad]['id']);}}}_0x3b33ac[_0xb407('0x203')]=0x1;return this[_0xb407('0x20f')](_0x3b33ac['id'],_0x2fb13d,0x1,_0x3b33ac[_0xb407('0x212')],_0x3b33ac)[_0xb407('0x9c')](function(_0x516f53){_0x3b33ac[_0xb407('0x203')]=0x1;if(_0x516f53){if(!utils['checkContactEmpty'](_0x516f53)){utils[_0xb407('0x68')](_0x3b33ac,0x1,0x0);return hopperUtils[_0xb407('0x213')](_0x3b33ac)['then'](sendMessageReschedule(_0x3b33ac))[_0xb407('0xa6')](loggerCatch(_0xb407('0x214')));}else{_0x3b33ac[_0xb407('0x69')]=utils[_0xb407('0x6a')][_0xb407('0x207')];if(_[_0xb407('0xf6')](_0x516f53[0x0])||_[_0xb407('0xf6')](_0x516f53[0x0]['Contact'])||_[_0xb407('0xf6')](_0x516f53[0x0][_0xb407('0x163')])){_0x15883f[_0xb407('0x157')]('[actionOriginate]\x20',_0x3b33ac,_0x516f53[0x0]);}else{return hopperUtils[_0xb407('0x210')](_[_0xb407('0xfa')](_0x516f53[0x0],[_0xb407('0xe0'),_0xb407('0x163')]))[_0xb407('0x9c')](_0x15883f[_0xb407('0x20a')](_0x3b33ac,_0x516f53[0x0]))['catch'](_0x15883f[_0xb407('0x156')](_0xb407('0x215'),_0x3b33ac));}}}})[_0xb407('0xa6')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3b33ac,0x1));};Dialer['prototype'][_0xb407('0x1e2')]=function(_0x251df8,_0x572581,_0x5d49c7,_0xe7d3b0,_0x1fe32c,_0x262a6b){loggerPredictive[_0xb407('0x48')](_0xb407('0x216'));loggerPredictive[_0xb407('0x48')](_0xb407('0x217'),_0x251df8);loggerPredictive[_0xb407('0x48')](_0xb407('0x218'),_0x572581);loggerPredictive[_0xb407('0x48')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d49c7);loggerPredictive[_0xb407('0x48')](_0xb407('0x219'),_0xe7d3b0);loggerPredictive[_0xb407('0x48')](_0xb407('0x21a'),_0x1fe32c);loggerPredictive[_0xb407('0x48')](_0xb407('0x51'));return new Promise(function(_0x136431,_0x13967b){if(_0x251df8<=0x0||isNaN(_0x251df8)){return _0x13967b(msgResponse('[abandonmentRate]','Error',_0xb407('0x21b')+_0x251df8));}if(_0x5d49c7<=0x0||isNaN(_0x5d49c7)){return _0x13967b(msgResponse(_0xb407('0x21c'),_0xb407('0x82'),'Ts\x20=\x20'+_0x5d49c7));}if(_0xe7d3b0<=0x0||isNaN(_0xe7d3b0)){return _0x13967b(msgResponse(_0xb407('0x21c'),_0xb407('0x82'),_0xb407('0x21d')+_0xe7d3b0));}if(_0x572581<=0x0||isNaN(_0x572581)){return _0x13967b(msgResponse(_0xb407('0x21c'),_0xb407('0x82'),_0xb407('0x21e')+_0x572581));}if(_0x1fe32c<=0x0||isNaN(_0x1fe32c)){return _0x13967b(msgResponse(_0xb407('0x21c'),_0xb407('0x82'),_0xb407('0x21f')+_0x1fe32c));}_0x262a6b=_0x262a6b||0x0;var _0x70c13f=0x1/_0x5d49c7;var _0x35184c=0x0;var _0x31c4c1=0x0;var _0xdc382f=0x0;var _0x58085d=0x0;for(var _0x43a21d=0x0;_0xdc382f<_0x1fe32c;_0x43a21d+=0x1){_0x31c4c1=_0x43a21d/_0x572581;_0x35184c=(_0xe7d3b0*_0x31c4c1+_0x262a6b)/_0x70c13f;_0xdc382f=utils[_0xb407('0x220')](_0x35184c,_0x251df8);_0x58085d=_0x35184c/_0x251df8*(0x1-utils['erlangb'](_0x35184c,_0x251df8));}return _0x136431({'erlangCalls':_0x43a21d,'erlangCallToSecond':_0x572581/_0x43a21d,'erlangAbandonmentRate':_0xdc382f,'erlangBusyFactor':_0x58085d});});};Dialer[_0xb407('0x1d')][_0xb407('0x1db')]=function(_0x544ea7,_0x21d3fe,_0x59d1f2,_0x5bb7a0,_0x5dc091,_0x526251){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xb407('0x217'),_0x544ea7);loggerPredictive[_0xb407('0x48')](_0xb407('0x218'),_0x21d3fe);loggerPredictive[_0xb407('0x48')](_0xb407('0x221'),_0x59d1f2);loggerPredictive[_0xb407('0x48')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bb7a0);loggerPredictive[_0xb407('0x48')](_0xb407('0x222'),_0x5dc091);loggerPredictive[_0xb407('0x48')]('---------------------------');return new Promise(function(_0x5a62cd,_0x35ea5d){if(_0x544ea7<=0x0||isNaN(_0x544ea7)){return _0x35ea5d(msgResponse(_0xb407('0x223'),_0xb407('0x82'),_0xb407('0x21b')+_0x544ea7));}if(_0x59d1f2<=0x0||isNaN(_0x59d1f2)){return _0x35ea5d(msgResponse(_0xb407('0x223'),_0xb407('0x82'),'Ts\x20=\x20'+_0x59d1f2));}if(_0x5bb7a0<=0x0||isNaN(_0x5bb7a0)){return _0x35ea5d(msgResponse(_0xb407('0x223'),_0xb407('0x82'),_0xb407('0x21d')+_0x5bb7a0));}if(_0x21d3fe<=0x0||isNaN(_0x21d3fe)){return _0x35ea5d(msgResponse('[busyFactor]',_0xb407('0x82'),_0xb407('0x21e')+_0x21d3fe));}if(_0x5dc091<=0x0||isNaN(_0x5dc091)){return _0x35ea5d(msgResponse(_0xb407('0x223'),_0xb407('0x82'),_0xb407('0x224')+_0x5dc091));}_0x526251=_0x526251||0x0;var _0x191567=0x1/_0x59d1f2;var _0x45b727=0x0;var _0x192af5=0x0;var _0x4579b0=0x0;var _0x5b05b2=0x0;for(var _0x11c493=0x0;_0x5b05b2<_0x5dc091;_0x11c493+=0x1){_0x192af5=_0x11c493/_0x21d3fe;_0x45b727=(_0x5bb7a0*_0x192af5+_0x526251)/_0x191567;_0x4579b0=utils[_0xb407('0x220')](_0x45b727,_0x544ea7);_0x5b05b2=_0x45b727/_0x544ea7*(0x1-utils['erlangb'](_0x45b727,_0x544ea7));}return _0x5a62cd({'erlangCalls':_0x11c493,'erlangCallToSecond':_0x21d3fe/_0x11c493,'erlangAbandonmentRate':_0x4579b0,'erlangBusyFactor':_0x5b05b2});});};module[_0xb407('0x225')]=Dialer; \ No newline at end of file +var _0x45e5=['membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countagentrejectretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','cause-txt','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknow','running','statusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','dialQueueProject','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','handlePredictive','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','Predictive\x20after\x20first\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangb','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','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','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','queuestatuscomplete','syncQueueStatusComplete','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','getSeconds','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','message','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','timezones','content','indexOf','Action','true','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','isIVRCampaignActive','sendMessageOneNotActive','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueId','uniqueid','type','ivr','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','CampaignId','starttime','calleridname','calleridnum','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','actions','channel','syncQueueMember','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','idHopper','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD'];(function(_0x1cae02,_0x1de149){var _0x51d6bd=function(_0x12dd9c){while(--_0x12dd9c){_0x1cae02['push'](_0x1cae02['shift']());}};_0x51d6bd(++_0x1de149);}(_0x45e5,0x115));var _0x545e=function(_0x57dd0a,_0x3a2345){_0x57dd0a=_0x57dd0a-0x0;var _0x44a23e=_0x45e5[_0x57dd0a];return _0x44a23e;};'use strict';var util=require(_0x545e('0x0'));var _=require(_0x545e('0x1'));var uuid=require(_0x545e('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x545e('0x3'));var utils=require(_0x545e('0x4'));var hopperUtils=require(_0x545e('0x5'));var ut=require(_0x545e('0x6'));var config=require(_0x545e('0x7'));var logger=require('../../../config/logger')(_0x545e('0x8'));var loggerBooked=require(_0x545e('0x9'))(_0x545e('0xa'));var loggerPredictive=require(_0x545e('0x9'))(_0x545e('0xb'));var loggerPredictiveCalls=require(_0x545e('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x545e('0xc'));var ami=require(_0x545e('0xd'));config[_0x545e('0xe')]=_[_0x545e('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x545e('0x10'))(new Redis(config[_0x545e('0xe')]));var cmHopper=require(_0x545e('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x545e('0x12'));var Interval=require(_0x545e('0x13'));var Action=require(_0x545e('0x14'));var History=require(_0x545e('0x15'));var Final=require('./models/final');var AgentComplete=require(_0x545e('0x16'));var QueueCallerAbandon=require(_0x545e('0x17'));var Hangup=require(_0x545e('0x18'));var ipAgi=process['env'][_0x545e('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5a55c4){this[_0x545e('0x1a')]=this[_0x545e('0x1a')]?this[_0x545e('0x1a')][_0x545e('0x1b')](_0x5a55c4):_0x5a55c4();};function Dialer(_0x177cf7,_0x263120){this['sequence']=new Sequence();this[_0x545e('0x1c')]=_0x263120;this[_0x545e('0x1d')]=_0x177cf7[_0x545e('0x1d')];this[_0x545e('0x1e')]=_0x177cf7[_0x545e('0x1e')];this[_0x545e('0x1f')]=_0x177cf7[_0x545e('0x1f')];this['trunks']=_0x177cf7[_0x545e('0x20')];this[_0x545e('0x21')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x545e('0x22')]={};this[_0x545e('0x23')]={};this[_0x545e('0x24')]={};this['queueBookedRR']={};this[_0x545e('0x25')]={};ami['on'](_0x545e('0x26'),this[_0x545e('0x27')]['bind'](this));ami['on'](_0x545e('0x28'),this[_0x545e('0x29')][_0x545e('0x2a')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2b'),this['syncAgentComplete'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2c'),this[_0x545e('0xc')][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2d'),this[_0x545e('0x2e')][_0x545e('0x2a')](this));ami['on'](_0x545e('0x2f'),this[_0x545e('0x30')][_0x545e('0x2a')](this));ami['on'](_0x545e('0x31'),this[_0x545e('0x32')][_0x545e('0x2a')](this));ami['on']('varset',this['syncVarSet'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x33'),this['syncQueueMember'][_0x545e('0x2a')](this));ami['on'](_0x545e('0x34'),this[_0x545e('0x35')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x545e('0x36')](function(_0x44f3c7){previewRecallmeReminderInterval=_0x44f3c7[_0x545e('0x37')];});}function isNotNull(_0x2a3643){return _0x2a3643!==null&&!_[_0x545e('0x38')](_0x2a3643);}function msgResponse(_0x5d121f,_0x5b951a,_0x2bfb3e){return{'action':_0x5d121f,'response':_0x5b951a,'message':_0x2bfb3e,'stack':_0x2bfb3e};}function emit(_0x9b3a1,_0x271913,_0x568d2c){io['to'](_0x9b3a1)[_0x545e('0x39')](_0x271913,_0x568d2c);}function emitOutboundVoiceQueueSummary(_0x2b52f3){if(_0x2b52f3['type']===_0x545e('0x3a')){logger['debug'](_0x545e('0x3b'),util[_0x545e('0x3c')](_0x2b52f3,{'showHidden':![],'depth':null}));emit(util[_0x545e('0x3d')](_0x545e('0x3e'),_0x2b52f3[_0x545e('0x3f')]),_0x545e('0x40'),_0x2b52f3);}}function checkGetDataPredictive(_0x22bfbb){if(isNotNull(_0x22bfbb)&&!_[_0x545e('0x41')](_0x22bfbb)){loggerPredictive[_0x545e('0x42')](_0x545e('0x43'));loggerPredictive[_0x545e('0x42')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22bfbb[_0x545e('0x44')]);loggerPredictive[_0x545e('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22bfbb['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22bfbb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x545e('0x42')](_0x545e('0x45'),_0x22bfbb[_0x545e('0x46')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x47'),_0x22bfbb['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x545e('0x42')](_0x545e('0x48'),_0x22bfbb[_0x545e('0x49')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x4a'));if(_0x22bfbb[_0x545e('0x44')]>0x0){if(!_[_0x545e('0x38')](_0x22bfbb[_0x545e('0x49')])&&_0x22bfbb[_0x545e('0x49')]>0x0){return!![];}loggerPredictive[_0x545e('0x42')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x545e('0x38')](_0x22bfbb[_0x545e('0x4b')])&&_0x22bfbb[_0x545e('0x4b')]>0x0){return!![];}loggerPredictive[_0x545e('0x42')](_0x545e('0x4c'));}else{loggerPredictive[_0x545e('0x42')](_0x545e('0x4d'));}}else{loggerPredictive[_0x545e('0x42')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x8ba5c2){return function(_0x1678a7){loggerPredictive[_0x545e('0x42')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x545e('0x4e'),_0x1678a7[_0x545e('0x4f')]);loggerPredictive[_0x545e('0x42')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1678a7[_0x545e('0x50')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x51'),_0x1678a7['erlangAbandonmentRate']);loggerPredictive[_0x545e('0x42')](_0x545e('0x52'),_0x1678a7[_0x545e('0x53')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x51'),_0x1678a7[_0x545e('0x54')]);loggerPredictive[_0x545e('0x42')](_0x545e('0x4a'));_[_0x545e('0x55')](_0x8ba5c2,_0x1678a7);};}function ifInterval(_0x24c3cb,_0x3db2fb){if(_[_0x545e('0x38')](_0x3db2fb)){return![];}return utils[_0x545e('0x56')](undefined,_0x3db2fb)<_0x24c3cb*0x3c;}function clearPredictiveAttributes(_0x3d3d6b){if(_0x3d3d6b[_0x545e('0x22')]){_0x3d3d6b[_0x545e('0x22')]=undefined;loggerPredictive[_0x545e('0x57')](_0x3d3d6b[_0x545e('0x3f')],_0x545e('0x58'));}if(_0x3d3d6b[_0x545e('0x59')]){_0x3d3d6b[_0x545e('0x59')]=undefined;loggerPredictive['debug'](_0x3d3d6b[_0x545e('0x3f')],_0x545e('0x5a'));}if(_0x3d3d6b['handlePredictive']){clearInterval(_0x3d3d6b['handlePredictive']);_0x3d3d6b['handlePredictive']=undefined;loggerPredictive[_0x545e('0x57')](_0x3d3d6b[_0x545e('0x3f')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x37b386,_0x5c4249){return function(_0x68cd38){loggerPredictive[_0x545e('0x5b')](_0x5c4249[_0x545e('0x3f')],_0x37b386);loggerPredictive[_0x545e('0x5b')](_0x68cd38[_0x545e('0x5c')]);clearPredictiveAttributes(_0x5c4249);};}function loggerCatch(_0xc95b0f){return function(_0x41ac2f){logger[_0x545e('0x5b')](_0xc95b0f,util['inspect'](_0x41ac2f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xccd874,_0x3a72b7,_0x4427ec){return function(_0x1c0c04){utils[_0x545e('0x5d')](_0x3a72b7,_0x4427ec,0x0);_0x3a72b7[_0x545e('0x5e')]=0x0;logger[_0x545e('0x5b')](_0xccd874,util[_0x545e('0x3c')](_0x1c0c04,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x495c34){return function(_0x59002c){if(isNotNull(_0x59002c)&&isNotNull(_0x59002c[0x0])){if(_0x59002c[0x0][_0x545e('0x5f')]>0x0){_0x495c34['message']=utils[_0x545e('0x60')][_0x545e('0x61')];logger[_0x545e('0x42')]('[getContactDialer2][ReScheduled]'+_0x495c34[_0x545e('0x3f')],_0x59002c[0x0][_0x545e('0x5f')],_0x545e('0x62'));}else{_0x495c34['message']=utils[_0x545e('0x60')]['NO_AVAILABLE_CONTACTS'];logger[_0x545e('0x42')]('[getContactDialer2][Empty]'+_0x495c34['name']);}}};}function createObjHistory(_0x285a8f,_0x4ae63b,_0xf46a6d,_0x182faa,_0x1fd572){_0x285a8f[_0x545e('0x63')]=_0xf46a6d;var _0x2d6f14=new Action(_0x285a8f,_0x4ae63b);var _0x51448d=new History(_0x2d6f14);_0x51448d[_0x545e('0x64')]=_0x182faa;_0x51448d[_0x545e('0x65')]=_0x1fd572;_0x51448d[_0x545e('0x66')]=_0x2d6f14['starttime'];return _0x51448d;}function unlockQueueStatus(_0x5d28e8,_0x50e63e){setTimeout(function(){if(_[_0x545e('0x38')](_0x5d28e8[_0x545e('0x67')])){loggerBooked[_0x545e('0x5b')](_0x545e('0x68'),_0x50e63e);}_0x5d28e8['queueStatusComplete']=!![];loggerBooked[_0x545e('0x42')]('[booked][unlockQueueStatus]',_0x50e63e,JSON[_0x545e('0x69')](_[_0x545e('0x6a')](_0x5d28e8,[_0x545e('0x3f'),_0x545e('0x67')])));},0x1f3);}function checkInterval(_0x3b8504){return function(){if(!isNotNull(_0x3b8504[_0x545e('0x6b')])){_0x3b8504[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];throw _0x3b8504['name']+_0x545e('0x6d');}if(!isNotNull(_0x3b8504[_0x545e('0x6b')][_0x545e('0x6e')])){_0x3b8504[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];throw _0x3b8504[_0x545e('0x3f')]+_0x545e('0x6d');}if(!isNotNull(_[_0x545e('0x41')](_0x3b8504['Interval'][_0x545e('0x6e')]))){_0x3b8504[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];throw _0x3b8504[_0x545e('0x3f')]+_0x545e('0x6d');}};}function checkIsIVRCampaignActive(_0x98575c){return function(){if(!utils['isIVRCampaignActive'](_0x98575c)){_0x98575c['message']=utils[_0x545e('0x60')][_0x545e('0x6f')];throw _0x98575c[_0x545e('0x3f')]+_0x545e('0x70');}};}function emitCampaignSummary(_0x21bcd1){if(utils[_0x545e('0x71')](_0x21bcd1)){emit(util[_0x545e('0x3d')]('campaign:ivr:%s',_0x21bcd1[_0x545e('0x3f')]),'campaign:save',_0x21bcd1);}}function loggerCatchQueueSummary(_0x5f51fe,_0x3aaa31){return function(_0x35174f){clearPredictiveAttributes(_0x3aaa31);emitCampaignSummary(_0x3aaa31);loggerSyncQueueSummary[_0x545e('0x57')](_0x5f51fe,util['inspect'](_0x35174f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1f59c9){if(_0x1f59c9['sendMessageOneNotActive']){if(_0x1f59c9['originated']===0x0){_0x1f59c9['sendMessageOneNotActive']=![];_0x1f59c9['message']=utils[_0x545e('0x60')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x545e('0x72'),_0x1f59c9[_0x545e('0x3f')],_0x545e('0x73'));}else{_0x1f59c9[_0x545e('0x63')]=utils['CAMPAIGN_STATUS'][_0x545e('0x74')];loggerSyncQueueSummary[_0x545e('0x57')](_0x545e('0x72'),_0x1f59c9[_0x545e('0x3f')],_0x545e('0x75'));}emitCampaignSummary(_0x1f59c9);}}function myreject(_0x21c3b2){return function(_0x533e93){return _0x21c3b2(msgResponse('[ifTime][Action]',_0x545e('0x76'),JSON['stringify'](_0x533e93)));};}Dialer[_0x545e('0x77')][_0x545e('0x78')]=function(_0xcc85a2){return!_['isUndefined'](_0xcc85a2)&&_0xcc85a2&&!_[_0x545e('0x38')](_0xcc85a2[_0x545e('0x3f')])&&!_[_0x545e('0x38')](_0xcc85a2[_0x545e('0x79')])&&_0xcc85a2[_0x545e('0x79')]&&(this[_0x545e('0x20')][util[_0x545e('0x3d')](_0x545e('0x7a'),_0xcc85a2[_0x545e('0x3f')])][_0x545e('0x7b')]===_0x545e('0x7c')||this['trunks'][util[_0x545e('0x3d')](_0x545e('0x7a'),_0xcc85a2['name'])][_0x545e('0x7b')]===_0x545e('0x7d'));};Dialer['prototype'][_0x545e('0x7e')]=function(_0x2f7ecc){var _0x28f72a=this;return function(){if(!_0x28f72a['isTrunkReachable'](_0x2f7ecc[_0x545e('0x7f')])){if(!_0x28f72a[_0x545e('0x78')](_0x2f7ecc[_0x545e('0x80')])){_0x2f7ecc[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x81')];throw _0x2f7ecc[_0x545e('0x3f')]+_0x545e('0x82');}}};};Dialer['prototype'][_0x545e('0x83')]=function(_0x30af45,_0xc68084,_0x260574,_0x41127f){var _0x2d42b7=this;return function(){var _0x471214=!![];return _0x2d42b7[_0x545e('0x84')](_0x30af45,_0xc68084,_0x260574,_0x41127f,_0x471214);};};Dialer[_0x545e('0x77')][_0x545e('0x85')]=function(_0x3ef20c,_0x11fe9e,_0xfde0a,_0x29a226){var _0x2eaa9b=this;return function(){var _0x399251=![];return _0x2eaa9b[_0x545e('0x84')](_0x3ef20c[_0x545e('0x6e')],_0x11fe9e,_0xfde0a,_0x29a226,_0x399251);};};Dialer[_0x545e('0x77')][_0x545e('0x84')]=function(_0x481347,_0xef0997,_0x4eeea0,_0xdd4492,_0x32370a){var _0x4800d8=[];return new Promise(function(_0x2ad4c2,_0x4a4d84){if(!isNotNull(_0x481347)){_0xdd4492[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x6c')];return _0x4a4d84(msgResponse(_0x545e('0x86'),_0x545e('0x87'),_0x4eeea0+_0x545e('0x88')));}if(_[_0x545e('0x41')](_0x481347)){_0xdd4492[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x89')];return _0x4a4d84(msgResponse('ifTime',_0x545e('0x87'),_0x4eeea0+_0x545e('0x8a')));}if(_0xef0997&&_['isUndefined'](config['timezones'][_0xef0997])){_0xdd4492[_0x545e('0x63')]=utils[_0x545e('0x60')]['UNKNOWN_TIMEZONE'];return _0x4a4d84(msgResponse('ifTime',_0x545e('0x87'),_0x4eeea0+_0x545e('0x8b')+_0xef0997));}if(_[_0x545e('0x8c')](_0x481347)){for(var _0x5bb111=0x0;_0x5bb111<_0x481347[_0x545e('0x8d')];_0x5bb111+=0x1){_0x4800d8[_0x545e('0x8e')](ami['Action']({'action':_0x545e('0x8f'),'command':util[_0x545e('0x3d')](_0x545e('0x90'),_0x481347[_0x5bb111][_0x545e('0x91')],!_[_0x545e('0x38')](config[_0x545e('0x92')][_0xef0997])?_0xef0997:'')})[_0x545e('0x36')](function(_0x2ad694){return _0x2ad694[_0x545e('0x93')][_0x545e('0x94')]('true')>=0x0;})['catch'](myreject(_0x4a4d84)));}}else{_0x4800d8[_0x545e('0x8e')](ami[_0x545e('0x95')]({'action':'command','command':util['format'](_0x545e('0x90'),_0x481347,!_[_0x545e('0x38')](config[_0x545e('0x92')][_0xef0997])?_0xef0997:'')})[_0x545e('0x36')](function(_0x115f16){return _0x115f16[_0x545e('0x93')][_0x545e('0x94')](_0x545e('0x96'))>=0x0;})[_0x545e('0x97')](myreject(_0x4a4d84)));}Promise[_0x545e('0x98')](_0x4800d8)['then'](function(_0x59b0ae){var _0x82bde5=_[_0x545e('0x99')](_0x59b0ae);if(_0x82bde5){return _0x2ad4c2(_0x82bde5);}else{_0xdd4492['message']=_0x32370a?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x545e('0x9a')];return _0x4a4d84(msgResponse(_0x545e('0x9b'),_0x545e('0x87'),_0x545e('0x9c')+_0x32370a+'\x20'+_0x4eeea0+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x481347,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xef0997));}})[_0x545e('0x97')](function(_0x10eafe){return _0x4a4d84(msgResponse(_0x545e('0x86'),_0x545e('0x87'),JSON[_0x545e('0x69')](_0x10eafe)));});});};Dialer['prototype'][_0x545e('0x9d')]=function(){var _0x8ab7b5=this;return cmHopper[_0x545e('0x9e')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x8ab7b5['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x545e('0x9f')]=function(){var _0x2e7839=this;var _0x419967;for(var _0x5e8c68 in this[_0x545e('0x1e')]){if(typeof this[_0x545e('0x1e')][_0x5e8c68]!=='undefined'){_0x419967=this[_0x545e('0x1e')][_0x5e8c68];if(utils['isIVRCampaign'](_0x419967)&&utils[_0x545e('0xa0')](_0x419967)){_0x419967[_0x545e('0xa1')]=!![];Promise[_0x545e('0xa2')]()['then'](checkIsIVRCampaignActive(_0x419967))[_0x545e('0x36')](checkInterval(_0x419967))['then'](_0x2e7839['checkIsTrunkReachable'](_0x419967))[_0x545e('0x36')](_0x2e7839[_0x545e('0x83')](_0x419967['dialGlobalInterval'],_0x419967[_0x545e('0xa3')],_0x419967['name'],_0x419967))[_0x545e('0x36')](_0x2e7839[_0x545e('0x85')](_0x419967['Interval'],_0x419967[_0x545e('0xa3')],_0x419967['name'],_0x419967))[_0x545e('0x36')](_0x2e7839[_0x545e('0xa4')](_0x419967))[_0x545e('0x97')](loggerCatchQueueSummary(_0x545e('0xa5'),_0x419967));}else{notSendMessagesCampaign(_0x419967);}}}};Dialer[_0x545e('0x77')][_0x545e('0xa6')]=function(_0x3a834d){if(_0x3a834d[_0x545e('0xa7')]!==_0x545e('0xb')){clearPredictiveAttributes(_0x3a834d);}switch(_0x3a834d[_0x545e('0xa7')]){case _0x545e('0xa8'):this[_0x545e('0xa9')](_0x3a834d,0x1);break;case'power':this[_0x545e('0xa9')](_0x3a834d,_0x3a834d['dialPowerLevel']);break;case'predictive':this[_0x545e('0xb')](_0x3a834d);break;case _0x545e('0xa'):this[_0x545e('0xa9')](_0x3a834d,0x1);break;default:logger['error']('Queue',_0x3a834d[_0x545e('0x3f')],_0x545e('0xaa'));}};Dialer['prototype']['ifTime']=function(_0x2b7f46,_0x1fd320){var _0x1be992=_0x2b7f46[_0x545e('0xa3')];var _0x55c790=_0x1fd320?_0x2b7f46[_0x545e('0xab')]:_0x2b7f46['Interval'][_0x545e('0x6e')];logger['silly'](_0x545e('0xac'),_0x55c790,_0x1be992,_0x2b7f46[_0x545e('0x3f')],util[_0x545e('0x3d')](_0x545e('0xad'),_0x2b7f46['name'],_0x2b7f46['id']));var _0x572376=null;return Interval['intervalIftime'](_0x55c790,_0x1be992)[_0x545e('0x36')](function(_0x418c24){if(_0x418c24===!![]){return _0x418c24;}else{_0x2b7f46[_0x545e('0x63')]=_0x1fd320?utils[_0x545e('0x60')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x545e('0x60')]['OVERTIME_INTERVAL'];_0x572376=msgResponse(_0x545e('0x9b'),'Failure',_0x545e('0x9c')+_0x1fd320+'\x20'+_0x2b7f46[_0x545e('0x3f')]+_0x545e('0xae')+util[_0x545e('0x3c')](_0x55c790,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1be992);}if(_0x572376!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x572376);_0x572376[_0x545e('0xaf')]=_0x1fd320;throw _0x572376;}})[_0x545e('0x97')](function(_0x3f78b4){logger[_0x545e('0x5b')](_0x545e('0xb0'),_0x3f78b4);throw msgResponse(_0x545e('0xb1'),'Error',util[_0x545e('0x3c')](_0x3f78b4,{'showHidden':![],'depth':null}));});};Dialer[_0x545e('0x77')][_0x545e('0x27')]=function(_0x31dd01){if(this[_0x545e('0x1d')][_0x31dd01[_0x545e('0xb2')]]){if(this[_0x545e('0xb3')][_0x31dd01[_0x545e('0xb4')]]&&this['uniqueId'][_0x31dd01[_0x545e('0xb4')]][_0x545e('0xb5')]!==_0x545e('0xb6')){this['updateOriginated'](this['voiceQueues'][_0x31dd01['queue']]);this[_0x545e('0xb3')][_0x31dd01[_0x545e('0xb4')]]['answertime']=moment()['format'](_0x545e('0xb7'));}}};Dialer[_0x545e('0x77')][_0x545e('0xb8')]=function(_0x46071a){var _0x53c0b3=this[_0x545e('0xb3')][_0x46071a[_0x545e('0xb4')]];if(this[_0x545e('0x1d')][_0x46071a[_0x545e('0xb2')]]){if(_0x53c0b3&&_0x53c0b3['type']!=='ivr'){delete this[_0x545e('0xb3')][_0x46071a['uniqueid']];this[_0x545e('0x1d')][_0x46071a[_0x545e('0xb2')]][_0x545e('0xb9')]+=0x1;var _0x2caec8=new AgentComplete(_0x53c0b3,_0x46071a);if(_0x46071a[_0x545e('0xba')]===_0x545e('0xbb')){_0x2caec8[_0x545e('0xbc')]=this[_0x545e('0x1d')][_0x46071a[_0x545e('0xb2')]][_0x545e('0xbd')]&&this['voiceQueues'][_0x46071a['queue']]['dialAgiAfterHangupAgent']?moment()[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x545e('0xbe')](_0x2caec8)[_0x545e('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x545e('0xbf')](_0x2caec8)[_0x545e('0x97')](loggerCatch(_0x545e('0xc0')));}}};Dialer[_0x545e('0x77')]['syncQueueCallerAbandon']=function(_0xfbd226){var _0x4d2536=this[_0x545e('0xb3')][_0xfbd226[_0x545e('0xb4')]];var _0x5d3aa6=this;var _0x27034f=![];var _0x52bb75;var _0x1ac345;if(this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]]){if(_0x4d2536&&_0x4d2536[_0x545e('0xb5')]!==_0x545e('0xb6')){delete this['uniqueId'][_0xfbd226['uniqueid']];this[_0x545e('0xc1')](this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]]);_0x4d2536[_0x545e('0xc2')]=moment()[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4621e9=new QueueCallerAbandon(_0x4d2536,_0xfbd226);if(utils[_0x545e('0x56')](_0x4d2536['droptime'],_0x4d2536[_0x545e('0xc3')])>=_0x4d2536[_0x545e('0xc4')]){this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xc5')]+=0x1;this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xc6')]+=0x1;_0x4621e9['state']=0xa;_0x4621e9[_0x545e('0x65')]=_0x545e('0xc7');_0x4621e9[_0x545e('0xc8')]='TIMEOUT';_0x4621e9[_0x545e('0xbc')]=this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xbd')]?moment()['format'](_0x545e('0xb7')):undefined;_0x4621e9[_0x545e('0xc9')]+=0x1;_0x4621e9[_0x545e('0xca')]+=0x1;_0x52bb75=this[_0x545e('0x1d')][_0xfbd226['queue']][_0x545e('0xcb')];_0x1ac345=this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xcc')];hopperUtils[_0x545e('0xcd')](_0x4621e9,_0x4621e9[_0x545e('0x64')],_0x4d2536[_0x545e('0xce')])['then'](function(_0x498ad5){_0x27034f=_0x498ad5[_0x545e('0xcf')]==0x1;if(_0x4621e9[_0x545e('0xc9')]>=_0x5d3aa6[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]]['dialDropMaxRetry']){_0x5d3aa6[_0x545e('0xd0')](_0x4621e9,_0x498ad5[_0x545e('0xcf')]);}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countdropretry':_0x4621e9['countdropretry'],'scheduledat':moment()[_0x545e('0xd2')](_0x5d3aa6[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xcb')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x4d2536[_0x545e('0xd4')],'ListId':_0x4d2536['ListId'],'VoiceQueueId':_0x4d2536['VoiceQueueId']||undefined,'CampaignId':_0x4d2536[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][Drop]'));var _0x3b73db=new History(_0x4621e9);_0x3b73db[_0x545e('0x64')]=0xa;_0x3b73db[_0x545e('0x65')]='Drop';_0x3b73db[_0x545e('0xd6')]=moment()[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b73db[_0x545e('0x66')]=_0x3b73db[_0x545e('0xd6')];_0x3b73db['calleridname']=_0x4621e9[_0x545e('0xd7')];_0x3b73db[_0x545e('0xd8')]=_0x4621e9[_0x545e('0xd8')];hopperUtils['createHistory'](_0x3b73db)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x545e('0x36')](function(){if(_0x27034f)hopperUtils['swapAdditionalPhones'](_0x4621e9,_0x52bb75,_0x1ac345)[_0x545e('0x36')](function(){return 0x1;});});}else{this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0x46')]+=0x1;this['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xd9')]+=0x1;_0x4621e9[_0x545e('0x64')]=0xb;_0x4621e9[_0x545e('0x65')]='Abandoned';_0x4621e9[_0x545e('0xc8')]=_0x545e('0xda');_0x4621e9[_0x545e('0xdb')]+=0x1;_0x4621e9['countglobal']+=0x1;_0x52bb75=this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xdc')];_0x1ac345=this[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xcc')];hopperUtils[_0x545e('0xcd')](_0x4621e9,_0x4621e9['state'],_0x4d2536[_0x545e('0xce')])[_0x545e('0x36')](function(_0x59f22e){if(_0x4621e9[_0x545e('0xdb')]>=_0x5d3aa6[_0x545e('0x1d')][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xdd')]){_0x5d3aa6[_0x545e('0xd0')](_0x4621e9,_0x59f22e[_0x545e('0xcf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4621e9['countabandonedretry'],'scheduledat':moment()[_0x545e('0xd2')](_0x5d3aa6['voiceQueues'][_0xfbd226[_0x545e('0xb2')]][_0x545e('0xdc')],'minutes')[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4d2536['ContactId'],'ListId':_0x4d2536[_0x545e('0xde')],'VoiceQueueId':_0x4d2536[_0x545e('0xdf')]||undefined,'CampaignId':_0x4d2536[_0x545e('0xd5')]||undefined})['catch'](loggerCatch(_0x545e('0xe0')));var _0x54685a=new History(_0x4621e9);_0x54685a[_0x545e('0x64')]=0xb;_0x54685a[_0x545e('0x65')]='Abandoned';_0x54685a['starttime']=moment()[_0x545e('0x3d')](_0x545e('0xb7'));_0x54685a[_0x545e('0x66')]=_0x54685a[_0x545e('0xd6')];_0x54685a[_0x545e('0xd7')]=_0x4621e9[_0x545e('0xd7')];_0x54685a[_0x545e('0xd8')]=_0x4621e9[_0x545e('0xd8')];hopperUtils[_0x545e('0xbe')](_0x54685a)[_0x545e('0x97')](loggerCatch(_0x545e('0xe1')));}})[_0x545e('0x36')](function(){if(_0x27034f)hopperUtils[_0x545e('0xe2')](_0x4621e9,_0x52bb75,_0x1ac345)[_0x545e('0x36')](function(){return 0x1;});});}}}};Dialer[_0x545e('0x77')]['syncNewExten']=function(_0xb80f22){if(this[_0x545e('0xe3')][_0xb80f22['uniqueid']]){this[_0x545e('0xe3')][_0xb80f22['uniqueid']][_0x545e('0xe4')]=_0xb80f22[_0x545e('0xe4')];}if(this['uniqueId'][_0xb80f22['uniqueid']]){this['uniqueId'][_0xb80f22[_0x545e('0xb4')]][_0x545e('0xe4')]=_0xb80f22[_0x545e('0xe4')];}};Dialer[_0x545e('0x77')][_0x545e('0xe5')]=function(_0x1243ff){if(!this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]){return;}var _0x381a0d=this[_0x545e('0x1d')][this[_0x545e('0xe3')][_0x1243ff['actionid']][_0x545e('0xb2')]][_0x545e('0xe7')]||_0x545e('0xe8');if(_0x381a0d==='roundrobin'){if(this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]&&_[_0x545e('0xe9')](this['actions'][_0x1243ff['actionid']][_0x545e('0xea')])&&_0x1243ff[_0x545e('0x7b')]==='1'&&_0x1243ff[_0x545e('0xeb')]==='0'){if(this[_0x545e('0x1f')][_0x1243ff[_0x545e('0xec')]]){if(!this['agents'][_0x1243ff[_0x545e('0xec')]]['locked']){this[_0x545e('0x1f')][_0x1243ff[_0x545e('0xec')]]['locked']=!![];this['actions'][_0x1243ff[_0x545e('0xe6')]]['locked']=!![];this['actions'][_0x1243ff[_0x545e('0xe6')]]['stateinterface']=_0x1243ff[_0x545e('0xec')];}}}}else if(_0x381a0d==='rrmemory'){if(this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]){if(this['agents'][_0x1243ff[_0x545e('0xec')]]){this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]][_0x545e('0xec')]=_0x1243ff[_0x545e('0xec')];if(_['isNil'](this[_0x545e('0x24')][this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]][_0x545e('0xb2')]])){this['queueBooked'][this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]]['queue']]=[];}this[_0x545e('0x24')][this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]][_0x545e('0xb2')]]['push'](_[_0x545e('0x55')](_[_0x545e('0x6a')](this[_0x545e('0xe3')][_0x1243ff[_0x545e('0xe6')]],[_0x545e('0xed'),_0x545e('0xec')]),{'status':_0x1243ff['status'],'paused':_0x1243ff[_0x545e('0xeb')]}));}}}};Dialer[_0x545e('0x77')][_0x545e('0x35')]=function(_0xaadc21){if(!this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]){return;}var _0x5e1eb2=this;var _0x5567ef=this['voiceQueues'][this['actions'][_0xaadc21[_0x545e('0xe6')]]['queue']];var _0xd96b37=_0x5567ef['strategy']||_0x545e('0xe8');if(_0xd96b37===_0x545e('0xee')){if(this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]&&this['actions'][_0xaadc21[_0x545e('0xe6')]]['stateinterface']){this[_0x545e('0x1c')][_0x545e('0xef')](this['actions'][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xed')],this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xec')])['catch'](function(_0x2b31aa){logger[_0x545e('0x5b')](_0x545e('0xf0'),util[_0x545e('0x3c')](_0x2b31aa,{'showHidden':![],'depth':null}));})[_0x545e('0x1b')](function(){_0x5e1eb2[_0x545e('0xc1')](_0x5e1eb2[_0x545e('0x1d')][_0x5e1eb2[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]);_0x5e1eb2['agents'][_0x5e1eb2['actions'][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xec')]][_0x545e('0xea')]=![];delete _0x5e1eb2[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]];unlockQueueStatus(_0x5567ef);});}else{this['updateOriginated'](this[_0x545e('0x1d')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]);hopperUtils[_0x545e('0xd1')]({'active':![],'ContactId':this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]['ContactId'],'ListId':this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]['ListId'],'VoiceQueueId':this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xdf')]||undefined,'CampaignId':this[_0x545e('0xe3')][_0xaadc21['actionid']][_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0xf1')));delete this[_0x545e('0xe3')][_0xaadc21['actionid']];unlockQueueStatus(_0x5567ef);}}else if(_0xd96b37===_0x545e('0xe8')){var _0x544cc3;if(this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]]&&!_[_0x545e('0x41')](this['queueBooked'][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]])){if(this[_0x545e('0xf2')][_0x5e1eb2['actions'][_0xaadc21['actionid']][_0x545e('0xb2')]]){this[_0x545e('0xf2')][_0x5e1eb2['actions'][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]=this[_0x545e('0xf2')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]?this[_0x545e('0xf2')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]]:this[_0x545e('0x24')][this[_0x545e('0xe3')][_0xaadc21['actionid']][_0x545e('0xb2')]]?this[_0x545e('0x24')][this[_0x545e('0xe3')][_0xaadc21['actionid']][_0x545e('0xb2')]][_0x545e('0xf3')]||0x0:0x0;}this[_0x545e('0x24')][this['actions'][_0xaadc21['actionid']][_0x545e('0xb2')]][_0x545e('0xf3')]=this[_0x545e('0xf2')][this[_0x545e('0xe3')][_0xaadc21[_0x545e('0xe6')]][_0x545e('0xb2')]];for(var _0x2bda06=0x0;_0x2bda06=_0xf31db8[_0x545e('0x118')]){_0x39ce03['stateGlobal'](_0x2699ee,_0x2ecbce,_0x27a549,'reason19\x20machine....');}else{if(_0x2699ee['countmachineretry']>=_0xf31db8[_0x545e('0x119')]){_0x39ce03[_0x545e('0x11a')](_0x2699ee,_0x2ecbce,_0x27a549,_0x545e('0x11b'));}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countmachineretry':_0x2699ee[_0x545e('0x111')],'scheduledat':moment()['add'](_0xf31db8[_0x545e('0x11c')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x2699ee[_0x545e('0xd4')],'ListId':_0x2699ee[_0x545e('0xde')],'VoiceQueueId':_0x2699ee[_0x545e('0xdf')]||undefined,'CampaignId':_0x2699ee[_0x545e('0xd5')]||undefined})['catch'](loggerCatch(_0x545e('0x11d')));_0x2ecbce({'reschedule':0x1});}}});}if(_0x31cb55[_0x545e('0xb5')]===_0x545e('0xb6')&&this[_0x545e('0x1e')][_0x31cb55[_0x545e('0xb2')]][_0x545e('0x10e')]&&_0x506607['value']===_0x545e('0x106')){delete this[_0x545e('0xb3')][_0x506607['uniqueid']];this[_0x545e('0xc1')](this[_0x545e('0x1e')][_0x31cb55[_0x545e('0xb2')]]);_0x55ad68=new Hangup(_0x31cb55,_0x506607);_0x55ad68['state']=0x12;_0x55ad68[_0x545e('0x65')]=_0x545e('0x108');_0x55ad68[_0x545e('0x109')]=_0x545e('0x10a');ami[_0x545e('0x39')](_0x545e('0x112'),ut[_0x545e('0x10b')](_0x55ad68,_0x545e('0x10c')));this[_0x545e('0x11e')](_0x55ad68,_0x545e('0x11f'),_0x545e('0x120'));}if(_0x31cb55['type']==='ivr'&&this['campaigns'][_0x31cb55['queue']]['dialAMDActive']&&_0x506607[_0x545e('0x10f')]==='MACHINE'){return new Promise(function(_0x53eb7b,_0x5b502a){delete _0x39ce03['uniqueId'][_0x506607[_0x545e('0xb4')]];_0x39ce03[_0x545e('0xc1')](_0x39ce03['campaigns'][_0x31cb55[_0x545e('0xb2')]]);_0x39ce03[_0x545e('0x1e')][_0x31cb55['queue']]['outboundAnswerCallsDay']+=0x1;_0x39ce03[_0x545e('0x1e')][_0x31cb55[_0x545e('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xcacd78=_0x39ce03['campaigns'][_0x31cb55['queue']];var _0x917127=new Hangup(_0x31cb55,_0x506607);_0x917127[_0x545e('0x64')]=0x13;_0x917127[_0x545e('0x65')]=_0x545e('0x121');_0x917127[_0x545e('0x109')]='AMD';_0x917127[_0x545e('0x111')]+=0x1;_0x917127[_0x545e('0xca')]+=0x1;_0x917127['amd']=!![];ami[_0x545e('0x39')](_0x545e('0x112'),ut[_0x545e('0x10b')](_0x917127,_0x545e('0x10c')));hopperUtils[_0x545e('0xbe')](_0x917127)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x917127[_0x545e('0x114')]+_0x917127['countcongestionretry']+_0x917127['countnoanswerretry']+_0x917127[_0x545e('0x117')]+_0x917127[_0x545e('0xc9')]+_0x917127[_0x545e('0xdb')]+_0x917127[_0x545e('0x111')]+_0x917127[_0x545e('0x122')]>=_0xcacd78[_0x545e('0x118')]){_0x39ce03[_0x545e('0x123')](_0x917127,_0x53eb7b,_0x5b502a,'reason19\x20machine....');}else{if(_0x917127['countmachineretry']>=_0xcacd78[_0x545e('0x119')]){_0x39ce03[_0x545e('0x11a')](_0x917127,_0x53eb7b,_0x5b502a,_0x545e('0x11b'));}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countmachineretry':_0x917127['countmachineretry'],'scheduledat':moment()[_0x545e('0xd2')](_0xcacd78[_0x545e('0x11c')],'minutes')[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x917127[_0x545e('0xd4')],'ListId':_0x917127[_0x545e('0xde')],'VoiceQueueId':_0x917127[_0x545e('0xdf')]||undefined,'CampaignId':_0x917127['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][Machine]'));_0x53eb7b({'reschedule':0x1});}}});}}};Dialer[_0x545e('0x77')]['syncHangup']=function(_0x4a82c0){var _0x11b3a6=this[_0x545e('0xb3')][_0x4a82c0[_0x545e('0xb4')]];var _0x575d23;if(_0x11b3a6&&_0x11b3a6[_0x545e('0xb5')]===_0x545e('0xb6')){delete this['uniqueId'][_0x4a82c0['uniqueid']];this[_0x545e('0xc1')](this['campaigns'][_0x11b3a6[_0x545e('0xb2')]]);this['campaigns'][_0x11b3a6[_0x545e('0xb2')]][_0x545e('0x124')]+=0x1;_0x575d23=new Hangup(_0x11b3a6,_0x4a82c0);hopperUtils[_0x545e('0xbe')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x125')));hopperUtils[_0x545e('0xbf')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x126')));}if(_0x11b3a6&&_0x11b3a6[_0x545e('0xb5')]!==_0x545e('0xb6')&&isNotNull(this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]['dialQueueProject'])){delete this['uniqueId'][_0x4a82c0[_0x545e('0xb4')]];this[_0x545e('0xc1')](this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]);this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]][_0x545e('0xb9')]+=0x1;this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x575d23=new Hangup(_0x11b3a6,_0x4a82c0);_0x575d23[_0x545e('0x64')]=0x10;_0x575d23[_0x545e('0x65')]=_0x545e('0x127');_0x575d23[_0x545e('0x109')]='AGI';hopperUtils['createHistory'](_0x575d23)['catch'](loggerCatch(_0x545e('0x125')));hopperUtils['moveContactManagedDialer'](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x126')));}if(_0x11b3a6&&_0x11b3a6[_0x545e('0xb5')]!==_0x545e('0xb6')&&!isNotNull(this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]]['dialQueueProject'])){if(_0x4a82c0[_0x545e('0x128')]==='Normal\x20Clearing'){delete this['uniqueId'][_0x4a82c0['uniqueid']];this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]['outboundAnswerCallsDay']+=0x1;const _0xde5777=new AgentComplete(_0x11b3a6,_0x4a82c0);_0xde5777[_0x545e('0xd5')]=this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]]['id'];hopperUtils[_0x545e('0xbe')](_0xde5777)['catch'](loggerCatch(_0x545e('0x129')));hopperUtils[_0x545e('0xbf')](_0xde5777)['catch'](loggerCatch(_0x545e('0xc0')));}else{delete this[_0x545e('0xb3')][_0x4a82c0[_0x545e('0xb4')]];this[_0x545e('0xc1')](this['voiceQueues'][_0x11b3a6[_0x545e('0xb2')]]);this[_0x545e('0x1d')][_0x11b3a6[_0x545e('0xb2')]][_0x545e('0x12a')]+=0x1;_0x575d23=new Hangup(_0x11b3a6,_0x4a82c0);_0x575d23[_0x545e('0x64')]=0xc;_0x575d23[_0x545e('0x65')]=_0x4a82c0['cause-txt'];_0x575d23[_0x545e('0x109')]=_0x545e('0x12b');hopperUtils[_0x545e('0xbe')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x125')));hopperUtils[_0x545e('0xbf')](_0x575d23)[_0x545e('0x97')](loggerCatch(_0x545e('0x126')));}}};Dialer[_0x545e('0x77')][_0x545e('0xc')]=function(_0x1406a6){var _0x35e01b=this;if(!_0x35e01b['queuesSummary'][_0x1406a6['name']]){_0x35e01b[_0x545e('0x25')][_0x1406a6[_0x545e('0x3f')]]={'running':![]};}else if(_0x35e01b[_0x545e('0x25')][_0x1406a6['name']][_0x545e('0x12c')]===!![]){return;}else if(_0x35e01b[_0x545e('0x25')][_0x1406a6[_0x545e('0x3f')]][_0x545e('0x12c')]===![]){_0x35e01b[_0x545e('0x25')][_0x1406a6[_0x545e('0x3f')]][_0x545e('0x12c')]=!![];}var _0x5c0bad=_0x35e01b['voiceQueues'][_0x1406a6['name']];var _0x1a4d45=_0x5c0bad['message']!==utils[_0x545e('0x60')][_0x545e('0x6f')];var _0x2d7b94=utils['isPreviewCampaign'](_0x5c0bad);_0x5c0bad['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x5c0bad,_0x35e01b[_0x545e('0x20')]);Promise['resolve']()[_0x545e('0x36')](function(){if(_0x5c0bad[_0x545e('0x12d')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x1a4d45){clearPredictiveAttributes(_0x5c0bad);_0x1406a6[_0x545e('0x59')]=undefined;_0x1406a6[_0x545e('0x22')]=undefined;}if(_0x5c0bad[_0x545e('0x12d')]===utils[_0x545e('0x60')][_0x545e('0x6f')]){_0x1406a6[_0x545e('0x12e')]=0x0;_0x1406a6[_0x545e('0xeb')]=0x0;_0x1406a6[_0x545e('0x12f')]=0x0;_0x1406a6[_0x545e('0x130')]=0x0;_0x1406a6['pTalking']=0x0;}}else if(_0x5c0bad[_0x545e('0x12d')]===utils[_0x545e('0x60')][_0x545e('0x131')]&&!_0x2d7b94){return _0x35e01b['ifTime'](_0x5c0bad,!![])[_0x545e('0x36')](function(){return _0x35e01b[_0x545e('0x86')](_0x5c0bad,![]);})['then'](function(){return _0x35e01b[_0x545e('0xa6')](_0x5c0bad);})[_0x545e('0x97')](function(_0x2695f8){loggerSyncQueueSummary['debug'](_0x545e('0x132'),util[_0x545e('0x3c')](_0x2695f8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5c0bad);});}else{clearPredictiveAttributes(_0x5c0bad);}})['then'](function(){var _0x3f6434=_0x1406a6[_0x545e('0x133')](_0x5c0bad);if(_0x3f6434||_0x5c0bad[_0x545e('0x134')]){_0x5c0bad['queueSummaryCountersUpdated']=![];_0x1406a6[_0x545e('0x135')](_0x5c0bad);Object[_0x545e('0x136')](_0x5c0bad,_0x1406a6);emitOutboundVoiceQueueSummary(_0x1406a6);}_0x35e01b['queuesSummary'][_0x5c0bad[_0x545e('0x3f')]][_0x545e('0x12c')]=![];})['catch'](function(_0x497626){logger[_0x545e('0x5b')](_0x545e('0x132'),util[_0x545e('0x3c')](_0x497626,{'showHidden':![],'depth':null}));_0x35e01b['queuesSummary'][_0x5c0bad['name']][_0x545e('0x12c')]=![];});};Dialer[_0x545e('0x77')][_0x545e('0x2e')]=_[_0x545e('0x137')](function(){var _0x403fef=_[_0x545e('0x138')](this['voiceQueues'],function(_0x19e475){return _0x19e475['dialPreviewRecallmeReminder'];});var _0x52219a=_['filter'](this[_0x545e('0x1f')],function(_0x56a508){return _0x56a508['online']&&_0x56a508['status']===_0x545e('0x7c');});if(_0x403fef[_0x545e('0x8d')]>0x0&&_0x52219a[_0x545e('0x8d')]>0x0){return Promise[_0x545e('0xa2')]()[_0x545e('0x36')](cmHopper[_0x545e('0x139')](_[_0x545e('0x13a')](_0x403fef,'id'),previewRecallmeReminderInterval,_[_0x545e('0x13a')](_0x52219a,'id')))[_0x545e('0x36')](function(_0x3b36b5){for(var _0x4542af=0x0;_0x4542af<_0x3b36b5[_0x545e('0x8d')];_0x4542af++){var _0x2ea2d7=_0x3b36b5[_0x4542af][_0x545e('0x13b')][_0x545e('0x3f')];if(_0x2ea2d7)io['to'](util[_0x545e('0x3d')](_0x545e('0x13c'),_0x2ea2d7))[_0x545e('0x39')](_0x545e('0x13d'),{'hopper':_0x3b36b5[_0x4542af]});}})[_0x545e('0x97')](function(_0x573486){logger[_0x545e('0x5b')](_0x545e('0x13e'),_0x573486);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x545e('0x13f')]=function(){var _0x436009=this;setInterval(function(){_0x436009[_0x545e('0x140')](_0x436009[_0x545e('0xb3')],_0x545e('0x141'));_0x436009[_0x545e('0x140')](_0x436009[_0x545e('0xe3')],_0x545e('0x142'));},0x32c8);};Dialer['prototype'][_0x545e('0x140')]=function(_0x2a032e,_0x4f3ac8){var _0xccb435=this;for(var _0x1109be in _0x2a032e){if(typeof _0x2a032e[_0x1109be]!==_0x545e('0x143')){this[_0x545e('0x144')][_0x545e('0x145')](function(){if(!_[_0x545e('0xe9')](_0x2a032e[_0x1109be])){return ami[_0x545e('0x95')]({'action':_0x545e('0x7b'),'channel':_0x2a032e[_0x1109be][_0x545e('0xe4')]})[_0x545e('0x97')](function(_0x24d5da){if(_0x24d5da[_0x545e('0x63')]===_0x545e('0x146')){setTimeout(function(){if(_0x2a032e[_0x1109be]&&_0x2a032e[_0x1109be][_0x545e('0xb5')]!==_0x545e('0xb6')){_0xccb435[_0x545e('0xc1')](_0xccb435[_0x545e('0x1d')][_0x2a032e[_0x1109be][_0x545e('0xb2')]]);logger[_0x545e('0x5b')](_0x545e('0x147'),_0x4f3ac8,_0x1109be,_0x2a032e[_0x1109be][_0x545e('0xb2')]);delete _0x2a032e[_0x1109be];}if(_0x2a032e[_0x1109be]&&_0x2a032e[_0x1109be][_0x545e('0xb5')]===_0x545e('0xb6')){_0xccb435[_0x545e('0xc1')](_0xccb435[_0x545e('0x1e')][_0x2a032e[_0x1109be][_0x545e('0xb2')]]);logger['error'](_0x545e('0x148'),_0x4f3ac8,_0x1109be,_0x2a032e[_0x1109be]['queue']);delete _0x2a032e[_0x1109be];}},0x2328);}});}});}}};Dialer[_0x545e('0x77')][_0x545e('0x149')]=function(_0x2b4949){return Promise[_0x545e('0xa2')]()['then'](voiceQueueRt[_0x545e('0x149')](_0x2b4949))[_0x545e('0x97')](loggerCatch(_0x545e('0x14a')));};Dialer[_0x545e('0x77')][_0x545e('0xc1')]=function(_0x5c91cb){if(!_[_0x545e('0x38')](_0x5c91cb)&&_0x5c91cb!==null){if(typeof _0x5c91cb['originated']!==_0x545e('0x143')){if(_0x5c91cb[_0x545e('0x14b')]>0x0){_0x5c91cb[_0x545e('0x14b')]-=0x1;}else{logger[_0x545e('0x5b')](_0x545e('0x14c'));}}}else{logger[_0x545e('0x5b')](_0x545e('0x14d'));}};Dialer[_0x545e('0x77')]['loggerHandler']=function(_0x36088f,_0x279a01){var _0x5ea5cf=this;return function(_0x1cffc1){_0x5ea5cf[_0x545e('0xc1')](_0x279a01);logger[_0x545e('0x5b')](_0x36088f,util[_0x545e('0x3c')](_0x1cffc1,{'showHidden':![],'depth':null}));};};Dialer[_0x545e('0x77')][_0x545e('0x14e')]=function(_0x643e41,_0x37d9a2,_0x5324a5){var _0x2e0c37={'state':0x19,'statedesc':_0x545e('0x14f')};this[_0x545e('0xc1')](_0x37d9a2);this['saveInDb'](_[_0x545e('0x55')](_0x2e0c37,_[_0x545e('0x6a')](_0x5324a5,['ContactId',_0x545e('0xde'),'UserId',_0x545e('0xdf'),'CampaignId'])),_0x545e('0x150'),_0x545e('0x151'));logger[_0x545e('0x5b')](_0x643e41);};Dialer[_0x545e('0x77')][_0x545e('0x11e')]=function(_0x50371a,_0x576d12,_0x3a5d02){hopperUtils[_0x545e('0xbe')](_0x50371a)[_0x545e('0x97')](loggerCatch(_0x576d12));hopperUtils[_0x545e('0xbf')](_0x50371a)[_0x545e('0x97')](loggerCatch(_0x3a5d02));};Dialer[_0x545e('0x77')][_0x545e('0xd0')]=function(_0x339459,_0x55250e){hopperUtils[_0x545e('0xbe')](_0x339459)[_0x545e('0x97')](loggerCatch(_0x545e('0x129')));if(_0x55250e==0x0){hopperUtils[_0x545e('0xbf')](_0x339459)[_0x545e('0x97')](loggerCatch(_0x545e('0x152')));}};Dialer['prototype'][_0x545e('0x13e')]=function(_0xaae781){return Promise[_0x545e('0xa2')]()[_0x545e('0x36')](cmHopper[_0x545e('0x139')](_0xaae781['id'],previewRecallmeReminderInterval))[_0x545e('0x36')](function(_0x426c93){for(var _0x367fc6=0x0;_0x367fc6<_0x426c93['length'];_0x367fc6++){var _0x3989bf=_0x426c93[_0x367fc6][_0x545e('0x13b')]['name'];if(_0x3989bf)io['to'](util[_0x545e('0x3d')]('user:%s',_0x3989bf))[_0x545e('0x39')]('user:dialPreviewRecallReminder',{'hopper':_0x426c93[_0x367fc6]});}})[_0x545e('0x97')](function(){});};Dialer['prototype'][_0x545e('0xa4')]=function(_0x20f3d3){var _0x589c52=this;return function(){_0x589c52[_0x545e('0x153')](_0x20f3d3);};};Dialer[_0x545e('0x77')][_0x545e('0x154')]=function(_0x4ae9dc,_0x3869de){var _0x568c89=this;var _0x20ea8a=uuid['v4']();this[_0x545e('0xe3')][_0x20ea8a]=new Action(_0x4ae9dc,_0x3869de,_0x20ea8a);return new Promise(function(_0x2e8fdf,_0x41943a){if(_[_0x545e('0x38')](_0x4ae9dc)&&typeof _0x4ae9dc!==_0x545e('0x155')){return _0x41943a(msgResponse('originate','Failure',_0x545e('0x156')));}if(_[_0x545e('0x38')](_0x3869de[_0x545e('0x157')])||_0x3869de['phone']===null){return _0x41943a(msgResponse(_0x545e('0x158'),'Failure',_0x545e('0x159')));}var _0x56ff07={'XMD-CALLERID':_0x568c89['actions'][_0x20ea8a][_0x545e('0x15a')](),'XMD-AGI':_0x4ae9dc[_0x545e('0x15b')]?util[_0x545e('0x3d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4ae9dc['dialQueueProject']):_0x545e('0x15c'),'XMD-AGIAFTER':_0x4ae9dc[_0x545e('0xbd')]?util[_0x545e('0x3d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4ae9dc[_0x545e('0xbd')]):'NONE','XMD-QUEUE':utils[_0x545e('0x15d')](_0x4ae9dc)?util[_0x545e('0x3d')](_0x545e('0x15e'),_0x4ae9dc['name'],_0x4ae9dc[_0x545e('0x15f')]||'',_0x4ae9dc[_0x545e('0x160')]?'c':'',_0x4ae9dc['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3869de['ContactId'],'XMD-CDRTYPE':_0x545e('0x8'),'CALLERID(all)':_0x568c89[_0x545e('0xe3')][_0x20ea8a]['getCaller'](),'XMD-AMD':_0x4ae9dc[_0x545e('0x10e')]?_0x545e('0x131'):_0x545e('0x15c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4ae9dc[_0x545e('0x10e')]){_0x56ff07[_0x545e('0x161')]=_0x4ae9dc[_0x545e('0x162')]||0x9c4;_0x56ff07['XMD-AMDGREETING']=_0x4ae9dc[_0x545e('0x163')]||0x5dc;_0x56ff07['XMD-AMDAFTERGREETINGSILENCE']=_0x4ae9dc[_0x545e('0x164')]||0x320;_0x56ff07[_0x545e('0x165')]=_0x4ae9dc[_0x545e('0x166')]||0x1388;_0x56ff07[_0x545e('0x167')]=_0x4ae9dc[_0x545e('0x168')]||0x64;_0x56ff07[_0x545e('0x169')]=_0x4ae9dc['dialAMDBetweenWordsSilence']||0x32;_0x56ff07[_0x545e('0x16a')]=_0x4ae9dc[_0x545e('0x16b')]||0x3;_0x56ff07[_0x545e('0x16c')]=_0x4ae9dc[_0x545e('0x16d')]||0x100;_0x56ff07[_0x545e('0x16e')]=_0x4ae9dc[_0x545e('0x16f')]||0x1388;}if(utils['isOutboundQueue'](_0x4ae9dc)){_0x56ff07[_0x545e('0x170')]=_0x3869de[_0x545e('0xdf')];}else{_0x56ff07[_0x545e('0x171')]=_0x3869de[_0x545e('0xd5')];}var _0x404f3c=utils[_0x545e('0x172')](_0x3869de[_0x545e('0x173')]);Object[_0x545e('0x136')](_0x56ff07,_0x404f3c);var _0x10831c=_0x568c89[_0x545e('0x78')](_0x4ae9dc[_0x545e('0x7f')])?utils[_0x545e('0x174')](_0x4ae9dc[_0x545e('0x7f')][_0x545e('0x175')],_0x4ae9dc[_0x545e('0x176')],_0x4ae9dc[_0x545e('0x177')]>0x0?utils['getCallerIdRandom'](_0x4ae9dc[_0x545e('0x178')],_0x4ae9dc['dialRandomLastDigitCallerIdNumber']):_0x4ae9dc[_0x545e('0x178')]):utils['getCallerId'](_['isNil'](_0x4ae9dc[_0x545e('0x80')])?_0x4ae9dc['Trunk'][_0x545e('0x175')]:_0x4ae9dc[_0x545e('0x80')]['callerid'],_0x4ae9dc[_0x545e('0x176')],_0x4ae9dc[_0x545e('0x177')]>0x0?utils[_0x545e('0x179')](_0x4ae9dc[_0x545e('0x178')],_0x4ae9dc[_0x545e('0x177')]):_0x4ae9dc['dialOriginateCallerIdNumber']);if(_0x10831c){_0x56ff07[_0x545e('0x17a')]=_0x568c89['actions'][_0x20ea8a]['originatecalleridname']=utils[_0x545e('0x17b')](_0x10831c);_0x56ff07['XMD-ORIGINATECALLERIDNUM']=_0x3869de['phone'];}_0x4ae9dc[_0x545e('0x17c')]=_0x56ff07;return ami[_0x545e('0x95')]({'actionid':_0x20ea8a,'action':_0x545e('0x158'),'channel':_0x568c89[_0x545e('0x78')](_0x4ae9dc[_0x545e('0x7f')])?util[_0x545e('0x3d')]('SIP/%s/%s%s',_0x4ae9dc['Trunk']['name'],isNotNull(_0x4ae9dc[_0x545e('0x17d')])?_0x4ae9dc['dialPrefix'][_0x545e('0x17e')]()||'':'',_0x4ae9dc[_0x545e('0x17f')]>0x0?_0x3869de[_0x545e('0x157')]['substring'](_0x4ae9dc[_0x545e('0x17f')]):_0x3869de[_0x545e('0x157')]):util['format'](_0x545e('0x180'),_[_0x545e('0xe9')](_0x4ae9dc['TrunkBackup'])?_0x4ae9dc[_0x545e('0x7f')][_0x545e('0x3f')]:_0x4ae9dc[_0x545e('0x80')][_0x545e('0x3f')],isNotNull(_0x4ae9dc[_0x545e('0x17d')])?_0x4ae9dc[_0x545e('0x17d')][_0x545e('0x17e')]()||'':'',_0x4ae9dc[_0x545e('0x17f')]>0x0?_0x3869de[_0x545e('0x157')][_0x545e('0x181')](_0x4ae9dc[_0x545e('0x17f')]):_0x3869de[_0x545e('0x157')]),'callerid':_0x10831c,'Exten':_0x545e('0x182'),'Context':_0x545e('0x183'),'Priority':'1','variable':_0x56ff07,'timeout':(_0x4ae9dc[_0x545e('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20ea8a})[_0x545e('0x36')](function(_0x499de9){return _0x2e8fdf(_0x499de9);})[_0x545e('0x97')](function(_0x4e86e0){_0x4ae9dc[_0x545e('0x185')]+=0x1;var _0x18ad5a=new History(_0x568c89[_0x545e('0xe3')][_0x20ea8a]);logger[_0x545e('0x5b')](util[_0x545e('0x3d')](_0x545e('0x186'),JSON['stringify'](_0x4e86e0)));_0x18ad5a[_0x545e('0x64')]=0xe;_0x18ad5a[_0x545e('0x65')]='OriginateError';_0x18ad5a['starttime']=moment()['format'](_0x545e('0xb7'));_0x18ad5a[_0x545e('0x66')]=_0x18ad5a[_0x545e('0xd6')];hopperUtils['createHistory'](_0x18ad5a)[_0x545e('0x97')](loggerCatch('[originate][error]'));_0x568c89[_0x545e('0xbf')](_0x18ad5a)[_0x545e('0x97')](loggerCatch('[originate][error]'))[_0x545e('0x1b')](function(){delete _0x568c89[_0x545e('0xe3')][_0x20ea8a];return _0x41943a(msgResponse('originate','Error',_0x545e('0x187')));});});});};Dialer[_0x545e('0x77')]['checkRetriveMax']=function(_0x340310,_0x2fe3c7,_0x470562){var _0x5c496f=new History(_0x2fe3c7);if(_0x5c496f[_0x545e('0x114')]+_0x5c496f['countcongestionretry']+_0x5c496f[_0x545e('0x116')]+_0x5c496f[_0x545e('0x117')]+_0x5c496f[_0x545e('0xc9')]+_0x5c496f[_0x545e('0xdb')]+_0x5c496f[_0x545e('0x111')]+_0x5c496f[_0x545e('0x122')]>=_0x470562[_0x545e('0x118')]-0x1){return!![];}switch(_0x340310){case 0x3:if(_0x5c496f[_0x545e('0x116')]>=_0x470562[_0x545e('0x188')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countnoanswerretry':_0x5c496f[_0x545e('0x116')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x189')],'minutes')[_0x545e('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f['VoiceQueueId']||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})['catch'](loggerCatch(_0x545e('0x18a')));break;case 0x5:if(_0x5c496f[_0x545e('0x114')]>=_0x470562[_0x545e('0x18b')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countbusyretry':_0x5c496f[_0x545e('0x114')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x18c')],_0x545e('0xd3'))['format'](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x18d')));break;case 0x8:if(_0x5c496f[_0x545e('0x115')]>=_0x470562[_0x545e('0x18e')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countcongestionretry':_0x5c496f[_0x545e('0x115')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562['dialCongestionRetryFrequency'],'minutes')[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f['ContactId'],'ListId':_0x5c496f['ListId'],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x18f')));break;case 0x0:if(_0x5c496f[_0x545e('0x117')]>=_0x470562[_0x545e('0x190')]-0x1){return!![];}else{hopperUtils[_0x545e('0xd1')]({'active':![],'countnosuchnumberretry':_0x5c496f[_0x545e('0x117')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x191')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f['ListId'],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x5c496f[_0x545e('0xc9')]>=_0x470562[_0x545e('0x192')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countdropretry':_0x5c496f[_0x545e('0xc9')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562['dialDropRetryFrequency'],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f['ContactId'],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f['VoiceQueueId']||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x193')));break;case 0xb:if(_0x5c496f[_0x545e('0xdb')]>=_0x470562[_0x545e('0xdd')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5c496f[_0x545e('0xdb')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0xdc')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f['ListId'],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0xe0')));break;case 0x13:if(_0x5c496f['countmachineretry']>=_0x470562[_0x545e('0x119')]-0x1){return!![];}hopperUtils[_0x545e('0xd1')]({'active':![],'countmachineretry':_0x5c496f[_0x545e('0x111')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x11c')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f['VoiceQueueId']||undefined,'CampaignId':_0x5c496f['CampaignId']||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x11d')));break;case 0x14:if(_0x5c496f[_0x545e('0x122')]>=_0x470562[_0x545e('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x5c496f[_0x545e('0x122')]+=0x1,'scheduledat':moment()[_0x545e('0xd2')](_0x470562[_0x545e('0x195')],_0x545e('0xd3'))[_0x545e('0x3d')](_0x545e('0xb7')),'ContactId':_0x5c496f[_0x545e('0xd4')],'ListId':_0x5c496f[_0x545e('0xde')],'VoiceQueueId':_0x5c496f[_0x545e('0xdf')]||undefined,'CampaignId':_0x5c496f[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x545e('0x77')][_0x545e('0x101')]=function(_0x4fa293,_0x53be37,_0xee4a4e){var _0x1ac65c=this;var _0x9a062f=new History(_0x4fa293);var _0x5e7ed6=![];var _0x44b4d9;var _0xe6e331;return new Promise(function(_0x52b0d4,_0x34d5fe){if(_[_0x545e('0x38')](_0x53be37)&&typeof _0x53be37!==_0x545e('0x155')){return _0x34d5fe(msgResponse('[callProgressDetecting]',_0x545e('0x87'),'entity\x20is\x20undefine'));}if(_[_0x545e('0x38')](_0xee4a4e)&&typeof _0xee4a4e!==_0x545e('0x155')){return _0x34d5fe(msgResponse(_0x545e('0x196'),'Failure',_0x545e('0x197')));}hopperUtils[_0x545e('0xcd')](_0x9a062f,_0xee4a4e['reason'],_0x53be37)['then'](function(_0x2983a2){if(_0x2983a2[_0x545e('0xcf')]==0x1)_0x5e7ed6=!![];switch(_0xee4a4e['reason']){case'0':_0x53be37[_0x545e('0x198')]+=0x1;_0x9a062f[_0x545e('0x64')]=0x0;_0x9a062f[_0x545e('0x65')]=_0x545e('0x199');_0x9a062f[_0x545e('0x117')]+=0x1;_0x9a062f['countglobal']+=0x1;ami[_0x545e('0x39')](_0x545e('0x19a'),ut['buildObj'](_0x4fa293,_0x545e('0x19b')));_0x44b4d9=_0x53be37['dialNoSuchNumberRetryFrequency'];_0xe6e331=_0x53be37[_0x545e('0xcc')];hopperUtils[_0x545e('0xbe')](_0x9a062f)['catch'](loggerCatch(_0x545e('0x113')));if(_0x1ac65c[_0x545e('0x19c')](0x0,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f['countnosuchnumberretry']>=_0x53be37[_0x545e('0x190')]){_0x1ac65c['createStateFinal'](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x19d'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x19d'));}}break;case'3':_0x53be37[_0x545e('0x19e')]+=0x1;_0x9a062f[_0x545e('0x64')]=0x3;_0x9a062f['statedesc']=_0x545e('0x19f');_0x9a062f['countnoanswerretry']+=0x1;_0x9a062f['countglobal']+=0x1;var _0x37d7bf=ut[_0x545e('0x1a0')](_0x4fa293,_0x53be37);ami[_0x545e('0x39')]('custom:agentnoanswer',_0x37d7bf);_0x44b4d9=_0x53be37['dialNoAnswerRetryFrequency'];_0xe6e331=_0x53be37['callAdditionalPhoneAfterMin'];hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1ac65c[_0x545e('0x19c')](0x3,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x116')]>=_0x53be37[_0x545e('0x188')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a1'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a1'));}}break;case'5':_0x53be37[_0x545e('0x1a2')]+=0x1;_0x9a062f[_0x545e('0x64')]=0x5;_0x9a062f[_0x545e('0x65')]=_0x545e('0x1a3');_0x9a062f[_0x545e('0x114')]+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x4fa293,_0x545e('0x1a4')));_0x44b4d9=_0x53be37['dialBusyRetryFrequency'];_0xe6e331=_0x53be37[_0x545e('0xcc')];hopperUtils['createHistory'](_0x9a062f)['catch'](loggerCatch(_0x545e('0x1a5')));if(_0x1ac65c[_0x545e('0x19c')](0x5,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x114')]>=_0x53be37[_0x545e('0x18b')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a6'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1a6'));}}break;case'8':_0x53be37['outboundCongestionCallsDay']+=0x1;_0x9a062f[_0x545e('0x64')]=0x8;_0x9a062f[_0x545e('0x65')]='Congestion';_0x9a062f[_0x545e('0x115')]+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;_0x44b4d9=_0x53be37[_0x545e('0x1a7')];_0xe6e331=_0x53be37['callAdditionalPhoneAfterMin'];ami[_0x545e('0x39')](_0x545e('0x1a8'),ut[_0x545e('0x10b')](_0x4fa293,_0x545e('0x1a9')));hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0x1aa')));if(_0x1ac65c[_0x545e('0x19c')](0x8,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x115')]>=_0x53be37[_0x545e('0x18e')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ab'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ab'));}}break;case'11':_0x53be37[_0x545e('0x1ac')]+=0x1;_0x9a062f['state']=0xb;_0x9a062f['statedesc']=_0x545e('0x1ad');_0x9a062f['countabandonedretry']+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;_0x44b4d9=_0x53be37['dialAbandonedRetryFrequency'];_0xe6e331=_0x53be37[_0x545e('0xcc')];hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0xe1')));if(_0x1ac65c[_0x545e('0x19c')](0xb,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0xdb')]>=_0x53be37[_0x545e('0xdd')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ae'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1ae'));}}break;case'20':_0x53be37['outboundRejectCallsDay']+=0x1;_0x9a062f['state']=0x14;_0x9a062f[_0x545e('0x65')]=_0x545e('0x1af');_0x9a062f[_0x545e('0x122')]+=0x1;_0x9a062f[_0x545e('0xca')]+=0x1;_0x44b4d9=_0x53be37[_0x545e('0x195')];_0xe6e331=_0x53be37[_0x545e('0xcc')];ami[_0x545e('0x39')](_0x545e('0x1b0'),ut[_0x545e('0x10b')](_0x4fa293,_0x545e('0x1b1')));hopperUtils['createHistory'](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0x1b2')));if(_0x1ac65c[_0x545e('0x19c')](0x14,_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f[_0x545e('0x122')]>=_0x53be37[_0x545e('0x194')]){_0x1ac65c[_0x545e('0x11a')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1b3'));}else{_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0x545e('0x1b3'));}}break;default:_0x53be37[_0x545e('0x12a')]+=0x1;_0x9a062f[_0x545e('0x64')]=0xc;_0x9a062f[_0x545e('0x65')]=_0xee4a4e[_0x545e('0xba')];_0x44b4d9=_0x53be37[_0x545e('0x195')];_0xe6e331=_0x53be37['callAdditionalPhoneAfterMin'];hopperUtils[_0x545e('0xbe')](_0x9a062f)[_0x545e('0x97')](loggerCatch(_0x545e('0x1b4')));if(_0x1ac65c[_0x545e('0x19c')](_0xee4a4e[_0x545e('0xba')],_0x4fa293,_0x53be37)&&!_0x5e7ed6){if(_0x9a062f['countbusyretry']+_0x9a062f[_0x545e('0x115')]+_0x9a062f[_0x545e('0x116')]+_0x9a062f[_0x545e('0x117')]+_0x9a062f[_0x545e('0xc9')]+_0x9a062f[_0x545e('0xdb')]+_0x9a062f['countmachineretry']+_0x9a062f[_0x545e('0x122')]>=_0x53be37[_0x545e('0x118')]){_0x1ac65c[_0x545e('0x123')](_0x9a062f,_0x52b0d4,_0x34d5fe,_0xee4a4e[_0x545e('0xba')]);}else{_0x1ac65c['createStateFinal'](_0x9a062f,_0x52b0d4,_0x34d5fe,_0xee4a4e[_0x545e('0xba')]);}}}})[_0x545e('0x36')](function(){if(_0x5e7ed6){hopperUtils[_0x545e('0xe2')](_0x9a062f,_0x44b4d9,_0xe6e331)[_0x545e('0x36')](function(){return _0x52b0d4(0x1);});}});});};Dialer['prototype'][_0x545e('0x123')]=function(_0x1a6b5e,_0x5d57a5,_0xb98581,_0x1c7a39){var _0x4b3f78=new Final(_0x1a6b5e);_0x4b3f78[_0x545e('0x64')]=0xf;_0x4b3f78['statedesc']='Global';this['createStateFinal'](_0x4b3f78,_0x5d57a5,_0xb98581,_0x1c7a39);};Dialer[_0x545e('0x77')]['createStateFinal']=function(_0x2c77c9,_0x4d77ce,_0x212036,_0x286b2e){hopperUtils[_0x545e('0xbf')](_0x2c77c9)[_0x545e('0x36')](function(){return _0x4d77ce(msgResponse(_0x545e('0x196'),_0x545e('0x100'),_0x286b2e));})['catch'](function(){return _0x212036(msgResponse('[moveContactManagedDialer][0]',_0x545e('0x87'),_0x545e('0x1b5')));});};Dialer['prototype'][_0x545e('0xb')]=function(_0x4cc266){var _0x360593=_0x4cc266[_0x545e('0x1b6')]/0x64;var _0x7b7503=_0x4cc266[_0x545e('0xc5')]/(_0x4cc266[_0x545e('0xc5')]+_0x4cc266[_0x545e('0xb9')]);var _0x61b808=Math['round'](_0x4cc266[_0x545e('0x1b7')]*(_0x4cc266['predictiveIntervalMaxThreshold']/0x64));var _0xd166fe=Math[_0x545e('0x1b8')](_0x4cc266[_0x545e('0x1b7')]*(_0x4cc266[_0x545e('0x1b9')]/0x64));var _0x2d6ce7=_0x4cc266[_0x545e('0x12e')]+_0x4cc266[_0x545e('0x130')];var _0x11bfe3=Math['floor'](_0x4cc266['erlangCalls']*_0x4cc266[_0x545e('0x54')]*_0x4cc266[_0x545e('0x1ba')]*_0x4cc266[_0x545e('0x1bb')]);if(_[_0x545e('0x38')](_0x4cc266['startProgressive'])){if(!_[_0x545e('0x38')](_0x4cc266[_0x545e('0x59')])){_0x4cc266['startPredictive']=undefined;loggerPredictive[_0x545e('0x5b')](_0x545e('0x1bc'),_0x545e('0x1bd'));}if(!_[_0x545e('0x38')](_0x4cc266[_0x545e('0x1be')])){loggerPredictive[_0x545e('0x5b')](_0x545e('0x1bc'),_0x545e('0x1bf'));clearInterval(_0x4cc266[_0x545e('0x1be')]);_0x4cc266[_0x545e('0x1be')]=undefined;}_0x4cc266['startProgressive']=moment()[_0x545e('0x3d')](_0x545e('0xb7'));loggerPredictive[_0x545e('0x42')](_0x4cc266['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4cc266[_0x545e('0x22')]);this[_0x545e('0xa9')](_0x4cc266,0x1);}else if(ifInterval(_0x4cc266[_0x545e('0x1c0')],_0x4cc266[_0x545e('0x22')])){this[_0x545e('0xa9')](_0x4cc266,0x1);loggerPredictiveCalls[_0x545e('0x42')](_0x545e('0x1c1'),_0x4cc266[_0x545e('0x22')],_0x4cc266[_0x545e('0x3f')]);_0x4cc266['erlangCalls']=0x0;_0x4cc266['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x360593<_0x7b7503&&_0x4cc266[_0x545e('0x1c2')]===_0x545e('0x1c3')){clearPredictiveAttributes(_0x4cc266);loggerPredictive[_0x545e('0x42')](_0x545e('0x1c4'),'Dropped\x20calls\x20day',_0x7b7503,_0x545e('0x22'),_0x4cc266[_0x545e('0x3f')]);}else if(_0x11bfe3<_0x4cc266[_0x545e('0xc6')]&&_0x4cc266[_0x545e('0x1c2')]===_0x545e('0x1c3')){clearPredictiveAttributes(_0x4cc266);loggerPredictive['info'](_0x545e('0x1c5'),_0x545e('0x1c6'),_0x11bfe3,_0x545e('0x1c7'),_0x4cc266[_0x545e('0xc6')],'startProgressive',_0x4cc266['name']);}else if(!ifInterval(_0x4cc266[_0x545e('0x1c0')],_0x4cc266['startProgressive'])&&_['isUndefined'](_0x4cc266[_0x545e('0x59')])&&!_[_0x545e('0x38')](_0x4cc266['startProgressive'])){_0x4cc266['startPredictive']=moment()[_0x545e('0x3d')](_0x545e('0xb7'));loggerPredictive[_0x545e('0x42')](_0x4cc266[_0x545e('0x3f')],'started\x20in\x20predictive\x20at',_0x4cc266[_0x545e('0x59')]);hopperUtils[_0x545e('0x1c8')](_0x4cc266['dialPredictiveInterval'])[_0x545e('0x36')](this['getDataPredictive'](_0x4cc266))[_0x545e('0x36')](mergeDataErlangB(_0x4cc266))[_0x545e('0x36')](this['startMethodPredictive'](_0x4cc266))[_0x545e('0x97')](loggerCatchPredictive(_0x545e('0x1c9'),_0x4cc266));}else if(!ifInterval(_0x4cc266[_0x545e('0x1c0')],_0x4cc266['startPredictive'])){_0x4cc266[_0x545e('0xc6')]=0x0;_0x4cc266[_0x545e('0x59')]=moment()[_0x545e('0x3d')](_0x545e('0xb7'));loggerPredictive[_0x545e('0x42')](_0x4cc266[_0x545e('0x3f')],'recalculate\x20predictive\x20at',_0x4cc266['startPredictive']);clearInterval(_0x4cc266[_0x545e('0x1be')]);_0x4cc266['handlePredictive']=undefined;hopperUtils[_0x545e('0x1c8')](_0x4cc266['dialPredictiveInterval'])[_0x545e('0x36')](this[_0x545e('0x1ca')](_0x4cc266))[_0x545e('0x36')](mergeDataErlangB(_0x4cc266))[_0x545e('0x36')](this[_0x545e('0x1cb')](_0x4cc266))['catch'](loggerCatchPredictive(_0x545e('0x1cc'),_0x4cc266));}else if(_0x4cc266[_0x545e('0x1b7')]&&_0x2d6ce7<_0x4cc266[_0x545e('0x1b7')]-_0xd166fe){clearPredictiveAttributes(_0x4cc266);loggerPredictive[_0x545e('0x42')](_0x4cc266['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2d6ce7,_0x545e('0x1cd'),_0x4cc266[_0x545e('0x1b7')],'-',_0xd166fe,'=',_0x4cc266['predictiveIntervalAvailable']-_0xd166fe,')');}else if(_0x4cc266[_0x545e('0x1b7')]&&_0x2d6ce7>_0x4cc266[_0x545e('0x1b7')]+_0x61b808){clearPredictiveAttributes(_0x4cc266);loggerPredictive['info'](_0x4cc266['name'],_0x545e('0x1ce'),_0x2d6ce7,_0x545e('0x1cf'),_0x4cc266[_0x545e('0x1b7')],'+',_0x61b808,'=',_0x4cc266[_0x545e('0x1b7')]+_0x61b808,')');}};Dialer[_0x545e('0x77')][_0x545e('0x1ca')]=function(_0x4b7515){var _0x7cbc11=this;return function(_0x39d7db){return new Promise(function(_0x5631a2,_0x4b6c7c){_[_0x545e('0x55')](_0x4b7515,_0x39d7db[0x0]);if(checkGetDataPredictive(_0x39d7db[0x0])){var _0x42b9d5=_0x4b7515['predictiveIntervalAvailable']=_0x4b7515['talking']+_0x4b7515['available'];var _0x29433c=_0x4b7515[_0x545e('0x1c0')]*0x3c;var _0x567f1f=_0x39d7db[0x0]['predictiveIntervalAvgTalktime']+_0x39d7db[0x0]['predictiveIntervalAvgHoldtime'];var _0x1c61df=(_0x39d7db[0x0][_0x545e('0x1d0')]+_0x39d7db[0x0][_0x545e('0x1d1')]+_0x39d7db[0x0][_0x545e('0x46')])/_0x39d7db[0x0][_0x545e('0x44')];_0x4b7515[_0x545e('0x1ba')]=_0x1c61df>0x0?_0x1c61df:0x1;switch(_0x4b7515[_0x545e('0x1c2')]){case _0x545e('0x1c3'):var _0xf0840=_0x4b7515['dialPredictiveOptimizationPercentage']/0x64;return _0x7cbc11[_0x545e('0x1d2')](_0x42b9d5,_0x29433c,_0x567f1f,_0x1c61df,_0xf0840)['then'](function(_0x47e304){return _0x5631a2(_0x47e304);});case _0x545e('0x1d3'):var _0x425c90=_0x4b7515[_0x545e('0x1b6')]/0x64;return _0x7cbc11[_0x545e('0x1d4')](_0x42b9d5,_0x29433c,_0x567f1f,_0x1c61df,_0x425c90)['then'](function(_0x2c74a5){return _0x5631a2(_0x2c74a5);});default:return _0x4b6c7c(msgResponse(_0x545e('0x1d5'),_0x545e('0x87'),_0x545e('0x1d6')));}}else{return _0x4b6c7c(msgResponse(_0x545e('0x1d5'),'Failure',_0x545e('0x1d7')));}});};};Dialer[_0x545e('0x77')][_0x545e('0x1d8')]=function(_0x162f29){var _0x34c5d6=this;return function(_0x362fb2){return new Promise(function(_0x458c97,_0x4dfd86){_[_0x545e('0x55')](_0x162f29,_0x362fb2[0x0]);if(checkGetDataPredictive(_0x362fb2[0x0])){loggerPredictive[_0x545e('0x42')](JSON[_0x545e('0x69')](_0x362fb2[0x0]));if(_0x162f29['dialPredictiveOptimization']===_0x545e('0x1c3')){return _0x34c5d6['getVoiceQueueRtPauses'](_0x162f29['id'])[_0x545e('0x36')](function(_0x4e9e8){var _0x2ed9de=_0x162f29[_0x545e('0x1d9')]-_0x4e9e8[0x0][_0x545e('0x1da')];var _0x4fdc12=_0x162f29[_0x545e('0x1c0')]*0x3c;var _0x2b880b=_0x362fb2[0x0][_0x545e('0x49')]+_0x362fb2[0x0]['predictiveIntervalAvgHoldtime'];var _0x545cad=(_0x362fb2[0x0][_0x545e('0x1d0')]+_0x362fb2[0x0][_0x545e('0x1d1')]+_0x362fb2[0x0][_0x545e('0x46')])/_0x362fb2[0x0]['predictiveIntervalTotalCalls'];var _0x3b3d70=_0x162f29['dialPredictiveOptimizationPercentage']/0x64;_0x162f29[_0x545e('0x1db')]=_0x4e9e8[0x0][_0x545e('0x1da')]||0x0;_0x162f29[_0x545e('0x1ba')]=_0x545cad>0x0?_0x545cad:0x1;return _0x34c5d6[_0x545e('0x1d2')](_0x2ed9de,_0x4fdc12,_0x2b880b,_0x545cad,_0x3b3d70);})[_0x545e('0x36')](function(_0x598f60){return _0x458c97(_0x598f60);})[_0x545e('0x97')](function(_0x1deab5){return _0x4dfd86(msgResponse(_0x545e('0x1dc'),'Failure',JSON['stringify'](_0x1deab5)));});}if(_0x162f29['dialPredictiveOptimization']==='agentBusyFactor'){return _0x34c5d6[_0x545e('0x149')](_0x162f29['id'])[_0x545e('0x36')](function(_0x12d2a7){var _0x21ff4b=_0x162f29['loggedIn']-_0x12d2a7[0x0][_0x545e('0x1da')];var _0x3928dc=_0x162f29[_0x545e('0x1c0')]*0x3c;var _0x34d2a3=_0x362fb2[0x0]['predictiveIntervalAvgTalktime']+_0x362fb2[0x0][_0x545e('0x4b')];var _0x49bce2=(_0x362fb2[0x0][_0x545e('0x1d0')]+_0x362fb2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x362fb2[0x0][_0x545e('0x46')])/_0x362fb2[0x0][_0x545e('0x44')];var _0x3cccfd=_0x162f29['dialPredictiveOptimizationPercentage']/0x64;_0x162f29[_0x545e('0x1db')]=_0x12d2a7[0x0][_0x545e('0x1da')]||0x0;_0x162f29[_0x545e('0x1ba')]=_0x49bce2>0x0?_0x49bce2:0x1;return _0x34c5d6[_0x545e('0x1d4')](_0x21ff4b,_0x3928dc,_0x34d2a3,_0x49bce2,_0x3cccfd);})[_0x545e('0x36')](function(_0x8852eb){return _0x458c97(_0x8852eb);})[_0x545e('0x97')](function(_0x210b32){return _0x4dfd86(msgResponse(_0x545e('0x1dc'),_0x545e('0x87'),JSON[_0x545e('0x69')](_0x210b32)));});}}else{return _0x4dfd86(msgResponse('[getDataPredictive]',_0x545e('0x87'),_0x545e('0x1d7')));}});};};Dialer[_0x545e('0x77')][_0x545e('0x1cb')]=function(_0x1cbe03){var _0x2cda14=this;return function(){var _0x32579d=0x0;var _0x2ded6f=Math[_0x545e('0x1dd')](_0x1cbe03[_0x545e('0x50')]*0x3e8);if(_0x2ded6f>0x0){_0x2ded6f=_0x2ded6f<0x64?0x64:_0x2ded6f;loggerPredictive['info'](_0x1cbe03[_0x545e('0x3f')],_0x545e('0x1de'),_0x2ded6f,_0x545e('0x1df'));_0x1cbe03[_0x545e('0x1be')]=setInterval(function(){_0x2cda14[_0x545e('0x1be')](_0x1cbe03);loggerPredictiveCalls[_0x545e('0x42')](_0x545e('0x1e0'),_0x32579d+=0x1);},_0x2ded6f);}else{loggerPredictive['info'](_0x1cbe03[_0x545e('0x3f')],_0x545e('0x1e1'));}};};Dialer['prototype'][_0x545e('0x1e2')]=function(_0x2be0c8,_0x577a6d){var _0x236b0c=this;return function(_0x5cce2f){if(_[_0x545e('0x41')](_0x5cce2f)){if(_[_0x545e('0xe9')](_0x577a6d[_0x545e('0x1e3')])||!_0x577a6d[_0x545e('0x1e4')]){if(_0x2be0c8['dialMethod']===_0x545e('0xa')){_0x2be0c8['queueStatusComplete']=_[_0x545e('0x38')](_0x2be0c8[_0x545e('0x67')])?!![]:_0x2be0c8[_0x545e('0x67')];var _0x44683d=uuid['v4']();_0x236b0c['actions'][_0x44683d]=new Action(_0x2be0c8,_0x577a6d,_0x44683d);loggerBooked[_0x545e('0x42')](_0x545e('0x1e5'),_0x44683d,_0x545e('0x1e6'),JSON[_0x545e('0x69')](_0x2be0c8[_0x545e('0x67')]),_0x545e('0x1e7'),_0x2be0c8[_0x545e('0x3f')]);if(_0x2be0c8['queueStatusComplete']){_0x2be0c8[_0x545e('0x67')]=![];_0x236b0c['queueBooked'][_0x236b0c['actions'][_0x44683d][_0x545e('0xb2')]]=[];ami[_0x545e('0x95')]({'actionid':_0x44683d,'action':_0x545e('0x1e8'),'queue':_0x2be0c8[_0x545e('0x3f')]})[_0x545e('0x97')](function(){_0x236b0c[_0x545e('0xc1')](_0x2be0c8);hopperUtils[_0x545e('0xd1')]({'active':![],'ContactId':_0x236b0c[_0x545e('0xe3')][_0x44683d]['ContactId'],'ListId':_0x236b0c['actions'][_0x44683d][_0x545e('0xde')],'VoiceQueueId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xdf')]||undefined,'CampaignId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x1e9')));delete _0x236b0c[_0x545e('0xe3')][_0x44683d];});}else{loggerBooked[_0x545e('0x42')](_0x545e('0x1ea'),JSON[_0x545e('0x69')](_0x2be0c8['queueStatusComplete']),_0x545e('0x1e7'),_0x2be0c8['name']);_0x236b0c['updateOriginated'](_0x2be0c8);hopperUtils[_0x545e('0xd1')]({'active':![],'ContactId':_0x236b0c['actions'][_0x44683d][_0x545e('0xd4')],'ListId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xde')],'VoiceQueueId':_0x236b0c['actions'][_0x44683d][_0x545e('0xdf')]||undefined,'CampaignId':_0x236b0c[_0x545e('0xe3')][_0x44683d][_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch(_0x545e('0x1e9')));delete _0x236b0c[_0x545e('0xe3')][_0x44683d];}}else{return _0x236b0c[_0x545e('0x154')](_0x2be0c8,_0x577a6d);}}else{if(utils[_0x545e('0x56')](undefined,_0x577a6d[_0x545e('0x1eb')])<_0x2be0c8['dialRecallMeTimeout']*0x3c){if(_0x577a6d['Agent']&&!_0x577a6d['Agent']['voicePause']){_0x236b0c['preview'][_0x545e('0xef')](_0x577a6d['id'])[_0x545e('0x1b')](function(){_0x236b0c[_0x545e('0xc1')](_0x2be0c8);});}else{hopperUtils[_0x545e('0x1ec')]({'active':![]},_0x577a6d['id'],0x1)[_0x545e('0x1b')](function(){_0x236b0c[_0x545e('0xc1')](_0x2be0c8);});}}else{_0x2be0c8[_0x545e('0x1ed')]+=0x1;_0x236b0c['updateOriginated'](_0x2be0c8);if(_0x2be0c8['dialRecallInQueue']){hopperUtils[_0x545e('0xd1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x577a6d[_0x545e('0xd4')],'ListId':_0x577a6d['ListId'],'VoiceQueueId':_0x577a6d[_0x545e('0xdf')]||undefined,'CampaignId':_0x577a6d[_0x545e('0xd5')]||undefined})[_0x545e('0x97')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x2be0c8,_0x577a6d,utils[_0x545e('0x60')][_0x545e('0x1ee')],0x17,_0x545e('0x1ef')))[_0x545e('0x97')](loggerCatch(_0x545e('0x1f0')));}else{_0x236b0c[_0x545e('0x11e')](createObjHistory(_0x2be0c8,_0x577a6d,utils[_0x545e('0x60')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),_0x545e('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x2be0c8[_0x545e('0x1f2')]+=0x1;_0x236b0c[_0x545e('0x11e')](createObjHistory(_0x2be0c8,_0x577a6d,utils['CAMPAIGN_STATUS'][_0x545e('0x1f3')],0xd,_0x545e('0x1f4')),'[Originate][historyBlacklist]',_0x545e('0x1f5'));throw'inBlackList';}};};Dialer[_0x545e('0x77')][_0x545e('0x153')]=function(_0x53d865){var _0x5050bf=this;var _0xbb437e=_0x53d865[_0x545e('0x1f6')]-_0x53d865['originated'];emitCampaignSummary(_0x53d865);if(_0xbb437e>0x0&&_0x53d865[_0x545e('0x5e')]==0x0){if(_0xbb437e>this[_0x545e('0x21')]){_0xbb437e=this[_0x545e('0x21')];}_0x53d865[_0x545e('0x5e')]=0x1;hopperUtils[_0x545e('0x1f7')](_0x53d865,_0xbb437e)[_0x545e('0x36')](function(_0x5b6199){_0x53d865['temp']=0x0;if(_0x5b6199){if(!utils[_0x545e('0x1f8')](_0x5b6199)){_0x53d865[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x1f9')];logger[_0x545e('0x42')](_0x545e('0x1fa')+_0x53d865[_0x545e('0x3f')]);}else{_0x53d865[_0x545e('0x14b')]+=_0x5b6199[_0x545e('0x8d')];_0x53d865[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x1fb')];for(var _0x7c29b0=0x0;_0x7c29b0<_0x5b6199[_0x545e('0x8d')];_0x7c29b0+=0x1){_0x53d865[_0x545e('0x1fc')]+=0x1;if(_[_0x545e('0xe9')](_0x5b6199[_0x7c29b0])||_['isNil'](_0x5b6199[_0x7c29b0][_0x545e('0x173')])||_['isNil'](_0x5b6199[_0x7c29b0]['phone'])){_0x5050bf['emptyContact'](_0x545e('0x1fd'),_0x53d865,_0x5b6199[_0x7c29b0]);}else{hopperUtils[_0x545e('0x1fe')](_[_0x545e('0x6a')](_0x5b6199[_0x7c29b0],[_0x545e('0xd5'),_0x545e('0x157')]))['then'](_0x5050bf[_0x545e('0x1e2')](_0x53d865,_0x5b6199[_0x7c29b0]))['catch'](_0x5050bf[_0x545e('0x1ff')](_0x545e('0x200'),_0x53d865));}}}}})[_0x545e('0x97')](loggerGetContactDialer(_0x545e('0x201'),_0x53d865,_0xbb437e));}};Dialer[_0x545e('0x77')][_0x545e('0xa9')]=function(_0x4b72fc,_0x2581e1){var _0x13b0c6=this;var _0x379fab=[];if(_0x2581e1<0x1||_0x4b72fc['dialMethod']===_0x545e('0xa')){_0x2581e1=0x1;}var _0x352865=Math['floor'](_0x4b72fc[_0x545e('0x12e')]*_0x2581e1)-_0x4b72fc[_0x545e('0x14b')];if(_0x4b72fc[_0x545e('0x202')]>0x0){var _0x1fa8d5=_0x4b72fc['dialLimitQueue']-_0x4b72fc[_0x545e('0x14b')]-_0x4b72fc['talking']-_0x4b72fc[_0x545e('0x203')];if(_0x352865>_0x1fa8d5){_0x352865=_0x1fa8d5;}}if(_0x352865>0x0&&_0x4b72fc[_0x545e('0x5e')]==0x0){if(_0x4b72fc[_0x545e('0xa7')]===_0x545e('0xa')){_0x352865=0x1;}if(_0x352865>this[_0x545e('0x21')]){_0x352865=this['maxNumberOriginate'];}for(var _0x5a81d8 in this[_0x545e('0x1f')]){if(typeof this[_0x545e('0x1f')][_0x5a81d8]!==_0x545e('0x143')){if(this[_0x545e('0x1f')][_0x5a81d8]['state']===_0x545e('0x204')&&this[_0x545e('0x1f')][_0x5a81d8][_0x545e('0x7b')]===_0x545e('0x7c')){_0x379fab['push'](this[_0x545e('0x1f')][_0x5a81d8]['id']);}}}_0x4b72fc[_0x545e('0x5e')]=0x1;hopperUtils[_0x545e('0x205')](_0x4b72fc,_0x379fab,_0x352865)[_0x545e('0x36')](function(_0x107c49){_0x4b72fc[_0x545e('0x5e')]=0x0;if(_0x107c49){if(!utils[_0x545e('0x1f8')](_0x107c49)){hopperUtils[_0x545e('0x206')](_0x4b72fc)[_0x545e('0x36')](sendMessageReschedule(_0x4b72fc))[_0x545e('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x4b72fc[_0x545e('0x14b')]+=_0x107c49[_0x545e('0x8d')];_0x4b72fc[_0x545e('0x63')]=_0x4b72fc[_0x545e('0xa7')]===_0x545e('0xa')?utils[_0x545e('0x60')][_0x545e('0x131')]:utils[_0x545e('0x60')][_0x545e('0x1fb')];for(var _0x126496=0x0;_0x126496<_0x107c49[_0x545e('0x8d')];_0x126496+=0x1){if(_[_0x545e('0xe9')](_0x107c49[_0x126496])||_[_0x545e('0xe9')](_0x107c49[_0x126496][_0x545e('0x173')])||_['isNil'](_0x107c49[_0x126496]['phone'])){_0x13b0c6[_0x545e('0x14e')](_0x545e('0x1fd'),_0x4b72fc,_0x107c49[_0x126496]);}else{hopperUtils[_0x545e('0x207')](_[_0x545e('0x6a')](_0x107c49[_0x126496],[_0x545e('0xdf'),'phone']))[_0x545e('0x36')](_0x13b0c6[_0x545e('0x1e2')](_0x4b72fc,_0x107c49[_0x126496]))[_0x545e('0x97')](_0x13b0c6['loggerHandler']('[actionOriginate]\x20',_0x4b72fc));}}}}})[_0x545e('0x97')](loggerGetContactDialer('[getContactDialer2]',_0x4b72fc,_0x352865));}};Dialer['prototype'][_0x545e('0x1be')]=function(_0x5fc583){if(_0x5fc583[_0x545e('0x202')]>0x0){var _0xd706c3=_0x5fc583[_0x545e('0x202')]-_0x5fc583[_0x545e('0x14b')]-_0x5fc583[_0x545e('0x130')];if(_0xd706c3>0x0&&_0x5fc583['temp']==0x0){this['tryOriginatePredictive'](_0x5fc583);}else{loggerPredictiveCalls[_0x545e('0x42')](_0x545e('0x208'));}}else{this[_0x545e('0x209')](_0x5fc583);}};Dialer[_0x545e('0x77')][_0x545e('0x209')]=function(_0x1c8e75){var _0x5ee96a=this;var _0x1eac26=[];_0x1c8e75['originated']+=0x1;for(var _0xdb6223 in this[_0x545e('0x1f')]){if(typeof this['agents'][_0xdb6223]!=='undefined'){if(this['agents'][_0xdb6223]['state']===_0x545e('0x204')&&this[_0x545e('0x1f')][_0xdb6223][_0x545e('0x7b')]===_0x545e('0x7c')){_0x1eac26[_0x545e('0x8e')](this[_0x545e('0x1f')][_0xdb6223]['id']);}}}_0x1c8e75[_0x545e('0x5e')]=0x1;return this[_0x545e('0x205')](_0x1c8e75['id'],_0x1eac26,0x1,_0x1c8e75[_0x545e('0x20a')],_0x1c8e75)['then'](function(_0x1d234f){_0x1c8e75[_0x545e('0x5e')]=0x1;if(_0x1d234f){if(!utils[_0x545e('0x1f8')](_0x1d234f)){utils[_0x545e('0x5d')](_0x1c8e75,0x1,0x0);return hopperUtils[_0x545e('0x206')](_0x1c8e75)[_0x545e('0x36')](sendMessageReschedule(_0x1c8e75))[_0x545e('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x1c8e75[_0x545e('0x63')]=utils[_0x545e('0x60')][_0x545e('0x1fb')];if(_[_0x545e('0xe9')](_0x1d234f[0x0])||_[_0x545e('0xe9')](_0x1d234f[0x0][_0x545e('0x173')])||_[_0x545e('0xe9')](_0x1d234f[0x0][_0x545e('0x157')])){_0x5ee96a[_0x545e('0x14e')]('[actionOriginate]\x20',_0x1c8e75,_0x1d234f[0x0]);}else{return hopperUtils[_0x545e('0x207')](_[_0x545e('0x6a')](_0x1d234f[0x0],['VoiceQueueId',_0x545e('0x157')]))[_0x545e('0x36')](_0x5ee96a[_0x545e('0x1e2')](_0x1c8e75,_0x1d234f[0x0]))['catch'](_0x5ee96a[_0x545e('0x1ff')](_0x545e('0x20b'),_0x1c8e75));}}}})[_0x545e('0x97')](loggerGetContactDialer(_0x545e('0x20c'),_0x1c8e75,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x1a3941,_0x3995dc,_0x57f6db,_0x2b71ed,_0x39d306,_0x70098){loggerPredictive[_0x545e('0x42')](_0x545e('0x20d'));loggerPredictive[_0x545e('0x42')](_0x545e('0x20e'),_0x1a3941);loggerPredictive[_0x545e('0x42')](_0x545e('0x20f'),_0x3995dc);loggerPredictive[_0x545e('0x42')]('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',_0x57f6db);loggerPredictive[_0x545e('0x42')](_0x545e('0x210'),_0x2b71ed);loggerPredictive[_0x545e('0x42')](_0x545e('0x211'),_0x39d306);loggerPredictive[_0x545e('0x42')]('---------------------------');return new Promise(function(_0x3ab2a4,_0x3699f5){if(_0x1a3941<=0x0||isNaN(_0x1a3941)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),_0x545e('0x213')+_0x1a3941));}if(_0x57f6db<=0x0||isNaN(_0x57f6db)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),'Ts\x20=\x20'+_0x57f6db));}if(_0x2b71ed<=0x0||isNaN(_0x2b71ed)){return _0x3699f5(msgResponse(_0x545e('0x212'),'Error',_0x545e('0x214')+_0x2b71ed));}if(_0x3995dc<=0x0||isNaN(_0x3995dc)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),_0x545e('0x215')+_0x3995dc));}if(_0x39d306<=0x0||isNaN(_0x39d306)){return _0x3699f5(msgResponse(_0x545e('0x212'),_0x545e('0x76'),_0x545e('0x216')+_0x39d306));}_0x70098=_0x70098||0x0;var _0x45cc11=0x1/_0x57f6db;var _0x2b1fe5=0x0;var _0x1839c9=0x0;var _0x3f4126=0x0;var _0x4fd8aa=0x0;for(var _0x493b1b=0x0;_0x3f4126<_0x39d306;_0x493b1b+=0x1){_0x1839c9=_0x493b1b/_0x3995dc;_0x2b1fe5=(_0x2b71ed*_0x1839c9+_0x70098)/_0x45cc11;_0x3f4126=utils[_0x545e('0x217')](_0x2b1fe5,_0x1a3941);_0x4fd8aa=_0x2b1fe5/_0x1a3941*(0x1-utils[_0x545e('0x217')](_0x2b1fe5,_0x1a3941));}return _0x3ab2a4({'erlangCalls':_0x493b1b,'erlangCallToSecond':_0x3995dc/_0x493b1b,'erlangAbandonmentRate':_0x3f4126,'erlangBusyFactor':_0x4fd8aa});});};Dialer[_0x545e('0x77')][_0x545e('0x1d4')]=function(_0x4f8a79,_0x40483b,_0x2cff32,_0x13f96d,_0x5e5eb0,_0x3cb256){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x545e('0x42')](_0x545e('0x20e'),_0x4f8a79);loggerPredictive[_0x545e('0x42')](_0x545e('0x20f'),_0x40483b);loggerPredictive['info'](_0x545e('0x218'),_0x2cff32);loggerPredictive[_0x545e('0x42')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13f96d);loggerPredictive['info'](_0x545e('0x219'),_0x5e5eb0);loggerPredictive[_0x545e('0x42')](_0x545e('0x4a'));return new Promise(function(_0x4f1cbb,_0x4bbfe0){if(_0x4f8a79<=0x0||isNaN(_0x4f8a79)){return _0x4bbfe0(msgResponse(_0x545e('0x21a'),_0x545e('0x76'),_0x545e('0x213')+_0x4f8a79));}if(_0x2cff32<=0x0||isNaN(_0x2cff32)){return _0x4bbfe0(msgResponse('[busyFactor]','Error',_0x545e('0x21b')+_0x2cff32));}if(_0x13f96d<=0x0||isNaN(_0x13f96d)){return _0x4bbfe0(msgResponse(_0x545e('0x21a'),_0x545e('0x76'),'p\x20=\x20'+_0x13f96d));}if(_0x40483b<=0x0||isNaN(_0x40483b)){return _0x4bbfe0(msgResponse(_0x545e('0x21a'),_0x545e('0x76'),_0x545e('0x215')+_0x40483b));}if(_0x5e5eb0<=0x0||isNaN(_0x5e5eb0)){return _0x4bbfe0(msgResponse('[busyFactor]',_0x545e('0x76'),_0x545e('0x21c')+_0x5e5eb0));}_0x3cb256=_0x3cb256||0x0;var _0x3d264b=0x1/_0x2cff32;var _0x405ec4=0x0;var _0x4b148c=0x0;var _0xeabdd6=0x0;var _0x567b32=0x0;for(var _0x1456d8=0x0;_0x567b32<_0x5e5eb0;_0x1456d8+=0x1){_0x4b148c=_0x1456d8/_0x40483b;_0x405ec4=(_0x13f96d*_0x4b148c+_0x3cb256)/_0x3d264b;_0xeabdd6=utils['erlangb'](_0x405ec4,_0x4f8a79);_0x567b32=_0x405ec4/_0x4f8a79*(0x1-utils[_0x545e('0x217')](_0x405ec4,_0x4f8a79));}return _0x4f1cbb({'erlangCalls':_0x1456d8,'erlangCallToSecond':_0x40483b/_0x1456d8,'erlangAbandonmentRate':_0xeabdd6,'erlangBusyFactor':_0x567b32});});};module[_0x545e('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 0bb55c8..e1a10e8 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ba4=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','getCaller','name','voiceQueue','dialCutDigit','prototype','queue','exports','util','lodash','moment','isNil','uniqueid','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x37597b,_0x46e807){var _0x1b10a4=function(_0x3c2f82){while(--_0x3c2f82){_0x37597b['push'](_0x37597b['shift']());}};_0x1b10a4(++_0x46e807);}(_0x3ba4,0x9b));var _0x43ba=function(_0x2f04ff,_0x21a5dc){_0x2f04ff=_0x2f04ff-0x0;var _0x518ea8=_0x3ba4[_0x2f04ff];return _0x518ea8;};'use strict';var util=require(_0x43ba('0x0'));var _=require(_0x43ba('0x1'));var moment=require(_0x43ba('0x2'));function checkNameSurname(_0x3c7829,_0x48554,_0x3e84c9){var _0x3044c5='';if(!_[_0x43ba('0x3')](_0x48554)&&'string'===typeof _0x48554){_0x3044c5+=_0x48554;}if(!_[_0x43ba('0x3')](_0x3e84c9)&&'string'===typeof _0x3e84c9){_0x3044c5+='\x20'+_0x3e84c9;}if(_0x3044c5!==''){return _0x3044c5;}return _0x3c7829;}function Action(_0x39c45d,_0x6a69e0,_0x1b39b3){this['voiceQueue']=_0x39c45d;this[_0x43ba('0x4')]=_0x1b39b3||undefined;this['name']=checkNameSurname(_0x6a69e0[_0x43ba('0x5')][_0x43ba('0x6')],_0x6a69e0[_0x43ba('0x5')][_0x43ba('0x7')],_0x6a69e0[_0x43ba('0x5')][_0x43ba('0x8')]);this[_0x43ba('0x9')]=_0x6a69e0['phone'];this['queue']=_0x39c45d['name'];this[_0x43ba('0xa')]=_0x6a69e0['active']||![];this[_0x43ba('0xb')]=_0x39c45d[_0x43ba('0xb')];this[_0x43ba('0xc')]=_0x39c45d[_0x43ba('0xc')]||0x3;this['scheduledat']=_0x6a69e0[_0x43ba('0xd')];this[_0x43ba('0xe')]=_0x6a69e0['countbusyretry'];this[_0x43ba('0xf')]=_0x6a69e0['countcongestionretry'];this[_0x43ba('0x10')]=_0x6a69e0[_0x43ba('0x10')];this['countnosuchnumberretry']=_0x6a69e0[_0x43ba('0x11')];this[_0x43ba('0x12')]=_0x6a69e0[_0x43ba('0x12')];this[_0x43ba('0x13')]=_0x6a69e0[_0x43ba('0x13')];this[_0x43ba('0x14')]=_0x6a69e0[_0x43ba('0x14')];this[_0x43ba('0x15')]=_0x6a69e0['countagentrejectretry'];this[_0x43ba('0x16')]=_0x6a69e0[_0x43ba('0x16')];this[_0x43ba('0x17')]=_0x6a69e0['ListId'];this[_0x43ba('0x18')]=_0x6a69e0[_0x43ba('0x18')];this[_0x43ba('0x19')]=_0x6a69e0[_0x43ba('0x19')];this[_0x43ba('0x1a')]=_0x6a69e0['CampaignId'];this[_0x43ba('0x1b')]=_0x6a69e0['id'];this[_0x43ba('0x1c')]=_0x6a69e0[_0x43ba('0x5')]['firstName']||'';this[_0x43ba('0x1d')]=moment()[_0x43ba('0x1e')](_0x43ba('0x1f'));this[_0x43ba('0x20')]=_0x6a69e0[_0x43ba('0x20')];this[_0x43ba('0x21')]=_0x6a69e0[_0x43ba('0x21')];this[_0x43ba('0x22')]=_0x6a69e0[_0x43ba('0x22')];this['recallme']=_0x6a69e0['recallme'];this[_0x43ba('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0x43ba('0x24')]=function(){return util[_0x43ba('0x1e')]('\x22%s\x22\x20<%s>',this[_0x43ba('0x25')],this[_0x43ba('0x26')][_0x43ba('0x27')]>0x0?this['number']['substring'](this['voiceQueue']['dialCutDigit']):this[_0x43ba('0x9')]);};Action[_0x43ba('0x28')]['getQueue']=function(){return this[_0x43ba('0x29')];};module[_0x43ba('0x2a')]=Action; \ No newline at end of file +var _0xfc4a=['VoiceQueueId','CampaignId','idHopper','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','substring','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0xfc4a,0x18a));var _0xafc4=function(_0x25fd4c,_0x69a1a3){_0x25fd4c=_0x25fd4c-0x0;var _0x51bfd5=_0xfc4a[_0x25fd4c];return _0x51bfd5;};'use strict';var util=require('util');var _=require(_0xafc4('0x0'));var moment=require(_0xafc4('0x1'));function checkNameSurname(_0x5ebd90,_0xab449d,_0x557ca3){var _0x17bec0='';if(!_[_0xafc4('0x2')](_0xab449d)&&_0xafc4('0x3')===typeof _0xab449d){_0x17bec0+=_0xab449d;}if(!_['isNil'](_0x557ca3)&&_0xafc4('0x3')===typeof _0x557ca3){_0x17bec0+='\x20'+_0x557ca3;}if(_0x17bec0!==''){return _0x17bec0;}return _0x5ebd90;}function Action(_0x5e5db6,_0x3fff00,_0x18d1e0){this[_0xafc4('0x4')]=_0x5e5db6;this[_0xafc4('0x5')]=_0x18d1e0||undefined;this[_0xafc4('0x6')]=checkNameSurname(_0x3fff00['Contact'][_0xafc4('0x7')],_0x3fff00[_0xafc4('0x8')]['firstName'],_0x3fff00[_0xafc4('0x8')][_0xafc4('0x9')]);this[_0xafc4('0xa')]=_0x3fff00[_0xafc4('0x7')];this['queue']=_0x5e5db6[_0xafc4('0x6')];this[_0xafc4('0xb')]=_0x3fff00[_0xafc4('0xb')]||![];this[_0xafc4('0xc')]=_0x5e5db6[_0xafc4('0xc')];this[_0xafc4('0xd')]=_0x5e5db6[_0xafc4('0xd')]||0x3;this[_0xafc4('0xe')]=_0x3fff00[_0xafc4('0xe')];this[_0xafc4('0xf')]=_0x3fff00['countbusyretry'];this[_0xafc4('0x10')]=_0x3fff00['countcongestionretry'];this[_0xafc4('0x11')]=_0x3fff00[_0xafc4('0x11')];this[_0xafc4('0x12')]=_0x3fff00[_0xafc4('0x12')];this[_0xafc4('0x13')]=_0x3fff00[_0xafc4('0x13')];this['countabandonedretry']=_0x3fff00[_0xafc4('0x14')];this[_0xafc4('0x15')]=_0x3fff00[_0xafc4('0x15')];this[_0xafc4('0x16')]=_0x3fff00[_0xafc4('0x16')];this['ContactId']=_0x3fff00[_0xafc4('0x17')];this['ListId']=_0x3fff00[_0xafc4('0x18')];this[_0xafc4('0x19')]=_0x3fff00[_0xafc4('0x19')];this[_0xafc4('0x1a')]=_0x3fff00[_0xafc4('0x1a')];this[_0xafc4('0x1b')]=_0x3fff00[_0xafc4('0x1b')];this[_0xafc4('0x1c')]=_0x3fff00['id'];this['ContactFirstName']=_0x3fff00[_0xafc4('0x8')][_0xafc4('0x1d')]||'';this['starttime']=moment()[_0xafc4('0x1e')](_0xafc4('0x1f'));this[_0xafc4('0x20')]=_0x3fff00[_0xafc4('0x20')];this['callbackuniqueid']=_0x3fff00[_0xafc4('0x21')];this['callbackat']=_0x3fff00[_0xafc4('0x22')];this[_0xafc4('0x23')]=_0x3fff00['recallme'];this[_0xafc4('0x24')]='';this['originatecalleridname']='';}Action[_0xafc4('0x25')][_0xafc4('0x26')]=function(){return util[_0xafc4('0x1e')](_0xafc4('0x27'),this['name'],this[_0xafc4('0x4')]['dialCutDigit']>0x0?this[_0xafc4('0xa')][_0xafc4('0x28')](this['voiceQueue']['dialCutDigit']):this[_0xafc4('0xa')]);};Action[_0xafc4('0x25')]['getQueue']=function(){return this['queue'];};module[_0xafc4('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index f78a0b9..ebf6dd2 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc413=['endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc413,0x97));var _0x3c41=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc413[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x3c41('0x0'));var utils=require(_0x3c41('0x1'));function AgentComplete(_0xd630d1,_0x461da9){this[_0x3c41('0x2')]=0x4;this[_0x3c41('0x3')]=_0x3c41('0x4');this[_0x3c41('0x5')]=_0xd630d1['scheduledat'];this[_0x3c41('0x6')]=_0xd630d1[_0x3c41('0x6')];this[_0x3c41('0x7')]=_0xd630d1[_0x3c41('0x6')]==='outbound'?_0x3c41('0x8'):_0xd630d1['type'];this[_0x3c41('0x9')]=_0xd630d1[_0x3c41('0x9')];this[_0x3c41('0xa')]=_0xd630d1['countcongestionretry'];this['countnoanswerretry']=_0xd630d1[_0x3c41('0xb')];this[_0x3c41('0xc')]=_0xd630d1['countbusyretry']+_0xd630d1[_0x3c41('0xa')]+_0xd630d1[_0x3c41('0xb')]+_0xd630d1[_0x3c41('0xd')]+_0xd630d1[_0x3c41('0xe')]+_0xd630d1[_0x3c41('0xf')]+_0xd630d1['countmachineretry']+_0xd630d1[_0x3c41('0x10')];this[_0x3c41('0xd')]=_0xd630d1['countnosuchnumberretry'];this[_0x3c41('0xe')]=_0xd630d1[_0x3c41('0xe')];this[_0x3c41('0xf')]=_0xd630d1[_0x3c41('0xf')];this[_0x3c41('0x11')]=_0xd630d1['countmachineretry'];this[_0x3c41('0x10')]=_0xd630d1['countagentrejectretry'];this[_0x3c41('0x12')]=_0x461da9[_0x3c41('0x12')];this[_0x3c41('0x13')]=_0xd630d1[_0x3c41('0x14')];this[_0x3c41('0x15')]=_0xd630d1['number'];this[_0x3c41('0x16')]=_0xd630d1[_0x3c41('0x16')];this[_0x3c41('0x17')]=_0xd630d1[_0x3c41('0x17')];this[_0x3c41('0x18')]=_0xd630d1['answertime'];this[_0x3c41('0x19')]=moment()['format'](_0x3c41('0x1a'));this['ringtime']=utils['getSeconds'](_0xd630d1[_0x3c41('0x17')],_0xd630d1['starttime']);this[_0x3c41('0x1b')]=utils[_0x3c41('0x1c')](_0xd630d1[_0x3c41('0x18')],_0xd630d1[_0x3c41('0x17')]);this[_0x3c41('0x1d')]=utils['getSeconds'](this['endtime'],_0xd630d1[_0x3c41('0x18')]);this['queue']=_0x461da9[_0x3c41('0x8')];this[_0x3c41('0x1e')]=_0x461da9[_0x3c41('0x1e')];this[_0x3c41('0x1f')]=_0x461da9[_0x3c41('0x1f')];this[_0x3c41('0x20')]=_0xd630d1[_0x3c41('0x20')];this[_0x3c41('0x21')]=_0xd630d1[_0x3c41('0x21')];this[_0x3c41('0x22')]=_0xd630d1[_0x3c41('0x22')];this[_0x3c41('0x23')]=_0xd630d1['recallme'];this['ContactId']=_0xd630d1[_0x3c41('0x24')];this[_0x3c41('0x25')]=_0xd630d1[_0x3c41('0x25')];this['UserId']=_0xd630d1[_0x3c41('0x26')];this[_0x3c41('0x27')]=_0xd630d1[_0x3c41('0x27')];this['CampaignId']=_0xd630d1['CampaignId'];this['originatecalleridnum']=_0xd630d1[_0x3c41('0x28')]||'';this[_0x3c41('0x29')]=_0xd630d1[_0x3c41('0x29')]||'';this['agiafterat']=_0xd630d1[_0x3c41('0x2a')];}module[_0x3c41('0x2b')]=AgentComplete; \ No newline at end of file +var _0x89eb=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','getSeconds','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1c26d1,_0x3b247b){var _0x10fdb7=function(_0x4dbe30){while(--_0x4dbe30){_0x1c26d1['push'](_0x1c26d1['shift']());}};_0x10fdb7(++_0x3b247b);}(_0x89eb,0x181));var _0xb89e=function(_0x5c93cd,_0x1da315){_0x5c93cd=_0x5c93cd-0x0;var _0x563412=_0x89eb[_0x5c93cd];return _0x563412;};'use strict';var moment=require(_0xb89e('0x0'));var utils=require(_0xb89e('0x1'));function AgentComplete(_0x329e40,_0x29cff8){this[_0xb89e('0x2')]=0x4;this[_0xb89e('0x3')]='Answer';this[_0xb89e('0x4')]=_0x329e40[_0xb89e('0x4')];this['type']=_0x329e40[_0xb89e('0x5')];this['campaigntype']=_0x329e40[_0xb89e('0x5')]==='outbound'?'queue':_0x329e40[_0xb89e('0x5')];this[_0xb89e('0x6')]=_0x329e40['countbusyretry'];this[_0xb89e('0x7')]=_0x329e40[_0xb89e('0x7')];this['countnoanswerretry']=_0x329e40[_0xb89e('0x8')];this[_0xb89e('0x9')]=_0x329e40[_0xb89e('0x6')]+_0x329e40[_0xb89e('0x7')]+_0x329e40[_0xb89e('0x8')]+_0x329e40[_0xb89e('0xa')]+_0x329e40[_0xb89e('0xb')]+_0x329e40[_0xb89e('0xc')]+_0x329e40[_0xb89e('0xd')]+_0x329e40[_0xb89e('0xe')];this[_0xb89e('0xa')]=_0x329e40['countnosuchnumberretry'];this[_0xb89e('0xb')]=_0x329e40['countdropretry'];this[_0xb89e('0xc')]=_0x329e40[_0xb89e('0xc')];this[_0xb89e('0xd')]=_0x329e40[_0xb89e('0xd')];this[_0xb89e('0xe')]=_0x329e40[_0xb89e('0xe')];this['uniqueid']=_0x29cff8['uniqueid'];this[_0xb89e('0xf')]=_0x329e40[_0xb89e('0x10')];this[_0xb89e('0x11')]=_0x329e40[_0xb89e('0x12')];this[_0xb89e('0x13')]=_0x329e40[_0xb89e('0x13')];this['responsetime']=_0x329e40[_0xb89e('0x14')];this[_0xb89e('0x15')]=_0x329e40[_0xb89e('0x15')];this['endtime']=moment()[_0xb89e('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb89e('0x17')]=utils[_0xb89e('0x18')](_0x329e40['responsetime'],_0x329e40['starttime']);this['holdtime']=utils[_0xb89e('0x18')](_0x329e40[_0xb89e('0x15')],_0x329e40[_0xb89e('0x14')]);this['talktime']=utils[_0xb89e('0x18')](this[_0xb89e('0x19')],_0x329e40[_0xb89e('0x15')]);this[_0xb89e('0x1a')]=_0x29cff8[_0xb89e('0x1a')];this[_0xb89e('0x1b')]=_0x29cff8[_0xb89e('0x1b')];this['reason']=_0x29cff8[_0xb89e('0x1c')];this[_0xb89e('0x1d')]=_0x329e40[_0xb89e('0x1d')];this[_0xb89e('0x1e')]=_0x329e40[_0xb89e('0x1e')];this[_0xb89e('0x1f')]=_0x329e40['callbackat'];this[_0xb89e('0x20')]=_0x329e40[_0xb89e('0x20')];this[_0xb89e('0x21')]=_0x329e40['ContactId'];this[_0xb89e('0x22')]=_0x329e40[_0xb89e('0x22')];this['UserId']=_0x329e40[_0xb89e('0x23')];this[_0xb89e('0x24')]=_0x329e40[_0xb89e('0x24')];this[_0xb89e('0x25')]=_0x329e40[_0xb89e('0x25')];this['originatecalleridnum']=_0x329e40[_0xb89e('0x26')]||'';this[_0xb89e('0x27')]=_0x329e40[_0xb89e('0x27')]||'';this['agiafterat']=_0x329e40[_0xb89e('0x28')];}module[_0xb89e('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index c9976e0..17c04a3 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f1d=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue'];(function(_0x14d7df,_0x3fe7aa){var _0x91dede=function(_0x50b23d){while(--_0x50b23d){_0x14d7df['push'](_0x14d7df['shift']());}};_0x91dede(++_0x3fe7aa);}(_0x1f1d,0x83));var _0xd1f1=function(_0x2449f2,_0x378679){_0x2449f2=_0x2449f2-0x0;var _0x430bdb=_0x1f1d[_0x2449f2];return _0x430bdb;};'use strict';function Final(_0x3ed798){this[_0xd1f1('0x0')]=_0x3ed798[_0xd1f1('0x0')];this[_0xd1f1('0x1')]=_0x3ed798[_0xd1f1('0x1')];this[_0xd1f1('0x2')]=_0x3ed798[_0xd1f1('0x2')];this['campaigntype']=_0x3ed798[_0xd1f1('0x2')]===_0xd1f1('0x3')?_0xd1f1('0x4'):_0x3ed798[_0xd1f1('0x2')];this[_0xd1f1('0x5')]=_0x3ed798[_0xd1f1('0x5')];this[_0xd1f1('0x6')]=_0x3ed798[_0xd1f1('0x6')];this['countnoanswerretry']=_0x3ed798[_0xd1f1('0x7')];this[_0xd1f1('0x8')]=_0x3ed798['countbusyretry']+_0x3ed798[_0xd1f1('0x6')]+_0x3ed798[_0xd1f1('0x7')]+_0x3ed798[_0xd1f1('0x9')]+_0x3ed798['countdropretry']+_0x3ed798[_0xd1f1('0xa')]+_0x3ed798['countmachineretry']+_0x3ed798[_0xd1f1('0xb')];this['countnosuchnumberretry']=_0x3ed798[_0xd1f1('0x9')];this[_0xd1f1('0xc')]=_0x3ed798['countdropretry'];this['countabandonedretry']=_0x3ed798[_0xd1f1('0xa')];this['countmachineretry']=_0x3ed798['countmachineretry'];this['countagentrejectretry']=_0x3ed798[_0xd1f1('0xb')];this[_0xd1f1('0x4')]=_0x3ed798[_0xd1f1('0x4')];this['calleridname']=_0x3ed798[_0xd1f1('0xd')];this[_0xd1f1('0xe')]=_0x3ed798[_0xd1f1('0xe')];this[_0xd1f1('0xf')]=_0x3ed798['starttime'];this[_0xd1f1('0x10')]=_0x3ed798[_0xd1f1('0x10')];this[_0xd1f1('0x11')]=_0x3ed798['responsetime'];this[_0xd1f1('0x12')]=_0x3ed798[_0xd1f1('0x12')]||0x0;this[_0xd1f1('0x13')]=_0x3ed798[_0xd1f1('0x13')]||0x0;this[_0xd1f1('0x14')]=_0x3ed798[_0xd1f1('0x14')]||0x0;this[_0xd1f1('0x15')]=_0x3ed798[_0xd1f1('0x15')];this[_0xd1f1('0x16')]=_0x3ed798[_0xd1f1('0x16')];this[_0xd1f1('0x17')]=_0x3ed798[_0xd1f1('0x17')];this[_0xd1f1('0x18')]=_0x3ed798['recallme'];this[_0xd1f1('0x19')]=_0x3ed798[_0xd1f1('0x19')];this['ListId']=_0x3ed798[_0xd1f1('0x1a')];this[_0xd1f1('0x1b')]=_0x3ed798[_0xd1f1('0x1b')];this[_0xd1f1('0x1c')]=_0x3ed798['VoiceQueueId'];this['CampaignId']=_0x3ed798['CampaignId'];this[_0xd1f1('0x1d')]=_0x3ed798[_0xd1f1('0x1d')]||'';this[_0xd1f1('0x1e')]=_0x3ed798[_0xd1f1('0x1e')]||'';this[_0xd1f1('0x1f')]=_0x3ed798[_0xd1f1('0x1f')];this[_0xd1f1('0x20')]=_0x3ed798['statedesc'];}module[_0xd1f1('0x21')]=Final; \ No newline at end of file +var _0x65bc=['calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname'];(function(_0x5d180a,_0x403fba){var _0x3089eb=function(_0x4d76bd){while(--_0x4d76bd){_0x5d180a['push'](_0x5d180a['shift']());}};_0x3089eb(++_0x403fba);}(_0x65bc,0x173));var _0xc65b=function(_0x9fe643,_0x8622b4){_0x9fe643=_0x9fe643-0x0;var _0x41800d=_0x65bc[_0x9fe643];return _0x41800d;};'use strict';function Final(_0x2e8e50){this[_0xc65b('0x0')]=_0x2e8e50[_0xc65b('0x0')];this[_0xc65b('0x1')]=_0x2e8e50[_0xc65b('0x1')];this[_0xc65b('0x2')]=_0x2e8e50[_0xc65b('0x2')];this['campaigntype']=_0x2e8e50[_0xc65b('0x2')]==='outbound'?_0xc65b('0x3'):_0x2e8e50[_0xc65b('0x2')];this[_0xc65b('0x4')]=_0x2e8e50[_0xc65b('0x4')];this[_0xc65b('0x5')]=_0x2e8e50[_0xc65b('0x5')];this[_0xc65b('0x6')]=_0x2e8e50['countnoanswerretry'];this[_0xc65b('0x7')]=_0x2e8e50[_0xc65b('0x4')]+_0x2e8e50['countcongestionretry']+_0x2e8e50[_0xc65b('0x6')]+_0x2e8e50[_0xc65b('0x8')]+_0x2e8e50['countdropretry']+_0x2e8e50['countabandonedretry']+_0x2e8e50[_0xc65b('0x9')]+_0x2e8e50[_0xc65b('0xa')];this[_0xc65b('0x8')]=_0x2e8e50[_0xc65b('0x8')];this['countdropretry']=_0x2e8e50[_0xc65b('0xb')];this[_0xc65b('0xc')]=_0x2e8e50[_0xc65b('0xc')];this['countmachineretry']=_0x2e8e50[_0xc65b('0x9')];this[_0xc65b('0xa')]=_0x2e8e50[_0xc65b('0xa')];this[_0xc65b('0x3')]=_0x2e8e50[_0xc65b('0x3')];this['calleridname']=_0x2e8e50[_0xc65b('0xd')];this[_0xc65b('0xe')]=_0x2e8e50[_0xc65b('0xe')];this[_0xc65b('0xf')]=_0x2e8e50['starttime'];this['responsetime']=_0x2e8e50[_0xc65b('0x10')];this[_0xc65b('0x11')]=_0x2e8e50[_0xc65b('0x10')];this['ringtime']=_0x2e8e50[_0xc65b('0x12')]||0x0;this[_0xc65b('0x13')]=_0x2e8e50['holdtime']||0x0;this[_0xc65b('0x14')]=_0x2e8e50[_0xc65b('0x14')]||0x0;this[_0xc65b('0x15')]=_0x2e8e50['callback'];this[_0xc65b('0x16')]=_0x2e8e50[_0xc65b('0x16')];this[_0xc65b('0x17')]=_0x2e8e50[_0xc65b('0x17')];this[_0xc65b('0x18')]=_0x2e8e50[_0xc65b('0x18')];this[_0xc65b('0x19')]=_0x2e8e50[_0xc65b('0x19')];this[_0xc65b('0x1a')]=_0x2e8e50['ListId'];this[_0xc65b('0x1b')]=_0x2e8e50[_0xc65b('0x1b')];this[_0xc65b('0x1c')]=_0x2e8e50[_0xc65b('0x1c')];this[_0xc65b('0x1d')]=_0x2e8e50['CampaignId'];this[_0xc65b('0x1e')]=_0x2e8e50[_0xc65b('0x1e')]||'';this[_0xc65b('0x1f')]=_0x2e8e50['originatecalleridname']||'';this[_0xc65b('0x20')]=_0x2e8e50[_0xc65b('0x20')];this[_0xc65b('0x21')]=_0x2e8e50[_0xc65b('0x21')];}module[_0xc65b('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index d12d1a9..bf5f8f6 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3c5=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry'];(function(_0x1baf8f,_0x45b651){var _0x6af11e=function(_0x3edaec){while(--_0x3edaec){_0x1baf8f['push'](_0x1baf8f['shift']());}};_0x6af11e(++_0x45b651);}(_0xf3c5,0x178));var _0x5f3c=function(_0x4e221e,_0x22329a){_0x4e221e=_0x4e221e-0x0;var _0x2297eb=_0xf3c5[_0x4e221e];return _0x2297eb;};'use strict';var moment=require(_0x5f3c('0x0'));var utils=require(_0x5f3c('0x1'));function Hangup(_0xd87224,_0x4cb60e){this['state']=0x4;this[_0x5f3c('0x2')]=_0x5f3c('0x3');this[_0x5f3c('0x4')]=_0xd87224[_0x5f3c('0x4')];this[_0x5f3c('0x5')]=_0xd87224['type'];this[_0x5f3c('0x6')]=_0xd87224[_0x5f3c('0x5')]===_0x5f3c('0x7')?_0x5f3c('0x8'):_0xd87224[_0x5f3c('0x5')];this[_0x5f3c('0x9')]=_0xd87224[_0x5f3c('0x9')]||![];this[_0x5f3c('0xa')]=_0xd87224[_0x5f3c('0xa')];this[_0x5f3c('0xb')]=_0xd87224[_0x5f3c('0xb')];this[_0x5f3c('0xc')]=_0xd87224[_0x5f3c('0xc')];this['countglobal']=_0xd87224['countbusyretry']+_0xd87224[_0x5f3c('0xb')]+_0xd87224['countnoanswerretry']+_0xd87224[_0x5f3c('0xd')]+_0xd87224[_0x5f3c('0xe')]+_0xd87224[_0x5f3c('0xf')]+_0xd87224[_0x5f3c('0x10')]+_0xd87224[_0x5f3c('0x11')];this[_0x5f3c('0xd')]=_0xd87224[_0x5f3c('0xd')];this[_0x5f3c('0xe')]=_0xd87224[_0x5f3c('0xe')];this['countabandonedretry']=_0xd87224[_0x5f3c('0xf')];this['countmachineretry']=_0xd87224[_0x5f3c('0x10')];this[_0x5f3c('0x11')]=_0xd87224[_0x5f3c('0x11')];this[_0x5f3c('0x12')]=_0x4cb60e[_0x5f3c('0x12')];this['calleridname']=_0xd87224['name'];this[_0x5f3c('0x13')]=_0xd87224[_0x5f3c('0x14')];this['starttime']=_0xd87224[_0x5f3c('0x15')];this[_0x5f3c('0x16')]=_0xd87224['responsetime'];this[_0x5f3c('0x17')]=moment()[_0x5f3c('0x18')](_0x5f3c('0x19'));this[_0x5f3c('0x1a')]=utils[_0x5f3c('0x1b')](_0xd87224[_0x5f3c('0x16')],_0xd87224[_0x5f3c('0x15')]);this[_0x5f3c('0x1c')]=0x0;this[_0x5f3c('0x1d')]=utils['getSeconds'](this[_0x5f3c('0x17')],_0xd87224['responsetime']);this[_0x5f3c('0x8')]=_0xd87224[_0x5f3c('0x8')];this[_0x5f3c('0x1e')]=_0x5f3c('0x1f');this[_0x5f3c('0x20')]=_0x4cb60e[_0x5f3c('0x21')];this[_0x5f3c('0x22')]=_0xd87224[_0x5f3c('0x22')];this[_0x5f3c('0x23')]=_0xd87224['callbackuniqueid'];this[_0x5f3c('0x24')]=_0xd87224[_0x5f3c('0x24')];this[_0x5f3c('0x25')]=_0xd87224[_0x5f3c('0x25')];this['ContactId']=_0xd87224['ContactId'];this[_0x5f3c('0x26')]=_0xd87224[_0x5f3c('0x26')];this[_0x5f3c('0x27')]=_0xd87224[_0x5f3c('0x27')];this['VoiceQueueId']=_0xd87224[_0x5f3c('0x28')];this['CampaignId']=_0xd87224[_0x5f3c('0x29')];}module[_0x5f3c('0x2a')]=Hangup; \ No newline at end of file +var _0x7edf=['moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','membername','IVR','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports'];(function(_0x165ca9,_0x36e359){var _0x25f49a=function(_0x3da5e5){while(--_0x3da5e5){_0x165ca9['push'](_0x165ca9['shift']());}};_0x25f49a(++_0x36e359);}(_0x7edf,0x17a));var _0xf7ed=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x7edf[_0x50aa2e];return _0x5e07f0;};'use strict';var moment=require(_0xf7ed('0x0'));var utils=require(_0xf7ed('0x1'));function Hangup(_0x3bc981,_0x57be7e){this[_0xf7ed('0x2')]=0x4;this[_0xf7ed('0x3')]=_0xf7ed('0x4');this[_0xf7ed('0x5')]=_0x3bc981['scheduledat'];this[_0xf7ed('0x6')]=_0x3bc981[_0xf7ed('0x6')];this[_0xf7ed('0x7')]=_0x3bc981['type']===_0xf7ed('0x8')?_0xf7ed('0x9'):_0x3bc981[_0xf7ed('0x6')];this[_0xf7ed('0xa')]=_0x3bc981[_0xf7ed('0xa')]||![];this[_0xf7ed('0xb')]=_0x3bc981[_0xf7ed('0xb')];this['countcongestionretry']=_0x3bc981[_0xf7ed('0xc')];this[_0xf7ed('0xd')]=_0x3bc981[_0xf7ed('0xd')];this['countglobal']=_0x3bc981[_0xf7ed('0xb')]+_0x3bc981['countcongestionretry']+_0x3bc981[_0xf7ed('0xd')]+_0x3bc981['countnosuchnumberretry']+_0x3bc981[_0xf7ed('0xe')]+_0x3bc981['countabandonedretry']+_0x3bc981['countmachineretry']+_0x3bc981[_0xf7ed('0xf')];this[_0xf7ed('0x10')]=_0x3bc981[_0xf7ed('0x10')];this[_0xf7ed('0xe')]=_0x3bc981[_0xf7ed('0xe')];this['countabandonedretry']=_0x3bc981[_0xf7ed('0x11')];this[_0xf7ed('0x12')]=_0x3bc981[_0xf7ed('0x12')];this[_0xf7ed('0xf')]=_0x3bc981['countagentrejectretry'];this['uniqueid']=_0x57be7e[_0xf7ed('0x13')];this['calleridname']=_0x3bc981['name'];this[_0xf7ed('0x14')]=_0x3bc981[_0xf7ed('0x15')];this[_0xf7ed('0x16')]=_0x3bc981[_0xf7ed('0x16')];this['responsetime']=_0x3bc981['responsetime'];this[_0xf7ed('0x17')]=moment()[_0xf7ed('0x18')](_0xf7ed('0x19'));this[_0xf7ed('0x1a')]=utils[_0xf7ed('0x1b')](_0x3bc981[_0xf7ed('0x1c')],_0x3bc981['starttime']);this[_0xf7ed('0x1d')]=0x0;this['talktime']=utils['getSeconds'](this['endtime'],_0x3bc981[_0xf7ed('0x1c')]);this[_0xf7ed('0x9')]=_0x3bc981[_0xf7ed('0x9')];this[_0xf7ed('0x1e')]=_0xf7ed('0x1f');this[_0xf7ed('0x20')]=_0x57be7e['cause-txt'];this['callback']=_0x3bc981['callback'];this[_0xf7ed('0x21')]=_0x3bc981[_0xf7ed('0x21')];this['callbackat']=_0x3bc981[_0xf7ed('0x22')];this[_0xf7ed('0x23')]=_0x3bc981['recallme'];this[_0xf7ed('0x24')]=_0x3bc981[_0xf7ed('0x24')];this[_0xf7ed('0x25')]=_0x3bc981['ListId'];this[_0xf7ed('0x26')]=_0x3bc981[_0xf7ed('0x26')];this[_0xf7ed('0x27')]=_0x3bc981[_0xf7ed('0x27')];this['CampaignId']=_0x3bc981[_0xf7ed('0x28')];}module[_0xf7ed('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 9f2200c..51e43a0 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8871=['countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x44fa89,_0x463cc7){var _0x406256=function(_0x45aeb7){while(--_0x45aeb7){_0x44fa89['push'](_0x44fa89['shift']());}};_0x406256(++_0x463cc7);}(_0x8871,0xe1));var _0x1887=function(_0x23ac30,_0x2a1d00){_0x23ac30=_0x23ac30-0x0;var _0x208fec=_0x8871[_0x23ac30];return _0x208fec;};'use strict';var utils=require(_0x1887('0x0'));function History(_0x533baf){this[_0x1887('0x1')]=_0x533baf['uniqueid'];this['scheduledat']=_0x533baf[_0x1887('0x2')]||undefined;this[_0x1887('0x3')]=_0x533baf[_0x1887('0x3')];this['campaigntype']=_0x533baf[_0x1887('0x3')]===_0x1887('0x4')?_0x1887('0x5'):_0x533baf[_0x1887('0x3')];this['countbusyretry']=_0x533baf['countbusyretry'];this[_0x1887('0x6')]=_0x533baf[_0x1887('0x6')];this[_0x1887('0x7')]=_0x533baf['countnoanswerretry'];this[_0x1887('0x8')]=_0x533baf[_0x1887('0x9')]+_0x533baf[_0x1887('0x6')]+_0x533baf[_0x1887('0x7')]+_0x533baf[_0x1887('0xa')]+_0x533baf[_0x1887('0xb')]+_0x533baf[_0x1887('0xc')]+_0x533baf[_0x1887('0xd')]+_0x533baf[_0x1887('0xe')];this[_0x1887('0xa')]=_0x533baf[_0x1887('0xa')];this[_0x1887('0xb')]=_0x533baf['countdropretry'];this[_0x1887('0xc')]=_0x533baf[_0x1887('0xc')];this[_0x1887('0xd')]=_0x533baf['countmachineretry'];this[_0x1887('0xe')]=_0x533baf[_0x1887('0xe')];this[_0x1887('0x5')]=_0x533baf['queue'];this[_0x1887('0xf')]=_0x533baf[_0x1887('0x10')];this[_0x1887('0x11')]=_0x533baf[_0x1887('0x12')];this[_0x1887('0x13')]=_0x533baf[_0x1887('0x13')];this[_0x1887('0x14')]=_0x533baf[_0x1887('0x14')];this[_0x1887('0x15')]=_0x533baf[_0x1887('0x14')];this['ringtime']=utils[_0x1887('0x16')](_0x533baf[_0x1887('0x14')],_0x533baf[_0x1887('0x13')]);this[_0x1887('0x17')]=0x0;this[_0x1887('0x18')]=0x0;this['callback']=_0x533baf[_0x1887('0x19')];this[_0x1887('0x1a')]=_0x533baf[_0x1887('0x1a')];this['callbackat']=_0x533baf[_0x1887('0x1b')];this[_0x1887('0x1c')]=_0x533baf[_0x1887('0x1c')];this[_0x1887('0x1d')]=_0x533baf['ContactId'];this[_0x1887('0x1e')]=_0x533baf[_0x1887('0x1e')];this[_0x1887('0x1f')]=_0x533baf[_0x1887('0x1f')];this[_0x1887('0x20')]=_0x533baf['VoiceQueueId'];this['CampaignId']=_0x533baf[_0x1887('0x21')];this[_0x1887('0x22')]=_0x533baf[_0x1887('0x22')]||'';this[_0x1887('0x23')]=_0x533baf[_0x1887('0x23')]||'';this['state']=_0x533baf[_0x1887('0x24')];this[_0x1887('0x25')]=_0x533baf[_0x1887('0x25')];}module[_0x1887('0x26')]=History; \ No newline at end of file +var _0x10c6=['name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x10c6,0x122));var _0x610c=function(_0x3a0100,_0x507e94){_0x3a0100=_0x3a0100-0x0;var _0x38d8db=_0x10c6[_0x3a0100];return _0x38d8db;};'use strict';var utils=require(_0x610c('0x0'));function History(_0x15d410){this[_0x610c('0x1')]=_0x15d410[_0x610c('0x1')];this[_0x610c('0x2')]=_0x15d410[_0x610c('0x2')]||undefined;this[_0x610c('0x3')]=_0x15d410[_0x610c('0x3')];this[_0x610c('0x4')]=_0x15d410[_0x610c('0x3')]===_0x610c('0x5')?_0x610c('0x6'):_0x15d410['type'];this[_0x610c('0x7')]=_0x15d410[_0x610c('0x7')];this[_0x610c('0x8')]=_0x15d410[_0x610c('0x8')];this[_0x610c('0x9')]=_0x15d410[_0x610c('0x9')];this[_0x610c('0xa')]=_0x15d410['countbusyretry']+_0x15d410['countcongestionretry']+_0x15d410[_0x610c('0x9')]+_0x15d410[_0x610c('0xb')]+_0x15d410['countdropretry']+_0x15d410[_0x610c('0xc')]+_0x15d410[_0x610c('0xd')]+_0x15d410[_0x610c('0xe')];this[_0x610c('0xb')]=_0x15d410[_0x610c('0xb')];this[_0x610c('0xf')]=_0x15d410['countdropretry'];this[_0x610c('0xc')]=_0x15d410[_0x610c('0xc')];this[_0x610c('0xd')]=_0x15d410[_0x610c('0xd')];this[_0x610c('0xe')]=_0x15d410[_0x610c('0xe')];this[_0x610c('0x6')]=_0x15d410[_0x610c('0x6')];this['calleridname']=_0x15d410[_0x610c('0x10')];this[_0x610c('0x11')]=_0x15d410[_0x610c('0x12')];this[_0x610c('0x13')]=_0x15d410[_0x610c('0x13')];this[_0x610c('0x14')]=_0x15d410[_0x610c('0x14')];this[_0x610c('0x15')]=_0x15d410['responsetime'];this['ringtime']=utils['getSeconds'](_0x15d410['responsetime'],_0x15d410['starttime']);this['holdtime']=0x0;this[_0x610c('0x16')]=0x0;this['callback']=_0x15d410[_0x610c('0x17')];this[_0x610c('0x18')]=_0x15d410[_0x610c('0x18')];this['callbackat']=_0x15d410['callbackat'];this[_0x610c('0x19')]=_0x15d410[_0x610c('0x19')];this[_0x610c('0x1a')]=_0x15d410['ContactId'];this['ListId']=_0x15d410[_0x610c('0x1b')];this[_0x610c('0x1c')]=_0x15d410[_0x610c('0x1c')];this['VoiceQueueId']=_0x15d410['VoiceQueueId'];this[_0x610c('0x1d')]=_0x15d410['CampaignId'];this[_0x610c('0x1e')]=_0x15d410[_0x610c('0x1e')]||'';this[_0x610c('0x1f')]=_0x15d410[_0x610c('0x1f')]||'';this[_0x610c('0x20')]=_0x15d410[_0x610c('0x20')];this[_0x610c('0x21')]=_0x15d410[_0x610c('0x21')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index e29d5f9..9283263 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85b0=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId'];(function(_0x8e23b1,_0x4909b6){var _0x124448=function(_0x25538f){while(--_0x25538f){_0x8e23b1['push'](_0x8e23b1['shift']());}};_0x124448(++_0x4909b6);}(_0x85b0,0x7f));var _0x085b=function(_0x125cb4,_0xd3bfd8){_0x125cb4=_0x125cb4-0x0;var _0x22579d=_0x85b0[_0x125cb4];return _0x22579d;};'use strict';var utils=require(_0x085b('0x0'));function QueueCallerAbandon(_0x2d4140,_0x500229){this[_0x085b('0x1')]=_0x2d4140[_0x085b('0x1')];this[_0x085b('0x2')]=_0x2d4140[_0x085b('0x2')];this[_0x085b('0x3')]=_0x2d4140[_0x085b('0x2')]===_0x085b('0x4')?_0x085b('0x5'):_0x2d4140[_0x085b('0x2')];this['countbusyretry']=_0x2d4140[_0x085b('0x6')];this['countcongestionretry']=_0x2d4140[_0x085b('0x7')];this[_0x085b('0x8')]=_0x2d4140[_0x085b('0x8')];this['countglobal']=_0x2d4140[_0x085b('0x6')]+_0x2d4140[_0x085b('0x7')]+_0x2d4140[_0x085b('0x8')]+_0x2d4140['countnosuchnumberretry']+_0x2d4140['countdropretry']+_0x2d4140[_0x085b('0x9')]+_0x2d4140[_0x085b('0xa')]+_0x2d4140[_0x085b('0xb')];this[_0x085b('0xc')]=_0x2d4140[_0x085b('0xc')];this[_0x085b('0xd')]=_0x2d4140[_0x085b('0xd')];this[_0x085b('0x9')]=_0x2d4140['countabandonedretry'];this[_0x085b('0xa')]=_0x2d4140[_0x085b('0xa')];this['countagentrejectretry']=_0x2d4140[_0x085b('0xb')];this['uniqueid']=_0x500229['uniqueid'];this[_0x085b('0xe')]=_0x2d4140['name'];this[_0x085b('0xf')]=_0x2d4140[_0x085b('0x10')];this['starttime']=_0x2d4140[_0x085b('0x11')];this[_0x085b('0x12')]=_0x2d4140[_0x085b('0x12')];this['droptime']=_0x2d4140[_0x085b('0x13')];this[_0x085b('0x14')]=_0x2d4140[_0x085b('0x14')];this[_0x085b('0x15')]=this['droptime'];this['ringtime']=utils[_0x085b('0x16')](_0x2d4140[_0x085b('0x12')],_0x2d4140[_0x085b('0x11')]);this[_0x085b('0x17')]=utils[_0x085b('0x16')](this[_0x085b('0x13')],_0x2d4140[_0x085b('0x12')]);this['talktime']=0x0;this[_0x085b('0x5')]=_0x500229[_0x085b('0x5')];this['membername']=_0x500229[_0x085b('0x18')];this[_0x085b('0x19')]=_0x500229[_0x085b('0x19')];this[_0x085b('0x1a')]=_0x2d4140['callback'];this[_0x085b('0x1b')]=_0x2d4140[_0x085b('0x1b')];this['callbackat']=_0x2d4140[_0x085b('0x1c')];this[_0x085b('0x1d')]=_0x2d4140[_0x085b('0x1d')];this['ContactId']=_0x2d4140['ContactId'];this['ListId']=_0x2d4140[_0x085b('0x1e')];this[_0x085b('0x1f')]=_0x2d4140['UserId'];this[_0x085b('0x20')]=_0x2d4140[_0x085b('0x20')];this[_0x085b('0x21')]=_0x2d4140[_0x085b('0x21')];this[_0x085b('0x22')]=_0x2d4140[_0x085b('0x22')]||'';this[_0x085b('0x23')]=_0x2d4140[_0x085b('0x23')]||'';this[_0x085b('0x24')]=_0x2d4140[_0x085b('0x24')];this[_0x085b('0x25')]=_0x2d4140['state'];this[_0x085b('0x26')]=_0x2d4140[_0x085b('0x26')];}module[_0x085b('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x3233=['ringtime','holdtime','getSeconds','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime'];(function(_0xc4c171,_0x5eebe5){var _0x45e4cc=function(_0x287b90){while(--_0x287b90){_0xc4c171['push'](_0xc4c171['shift']());}};_0x45e4cc(++_0x5eebe5);}(_0x3233,0xc5));var _0x3323=function(_0x30ae11,_0x140efc){_0x30ae11=_0x30ae11-0x0;var _0x22a0f3=_0x3233[_0x30ae11];return _0x22a0f3;};'use strict';var utils=require(_0x3323('0x0'));function QueueCallerAbandon(_0x36fb8c,_0x401830){this[_0x3323('0x1')]=_0x36fb8c[_0x3323('0x1')];this[_0x3323('0x2')]=_0x36fb8c[_0x3323('0x2')];this['campaigntype']=_0x36fb8c[_0x3323('0x2')]===_0x3323('0x3')?'queue':_0x36fb8c[_0x3323('0x2')];this['countbusyretry']=_0x36fb8c[_0x3323('0x4')];this[_0x3323('0x5')]=_0x36fb8c['countcongestionretry'];this[_0x3323('0x6')]=_0x36fb8c[_0x3323('0x6')];this[_0x3323('0x7')]=_0x36fb8c[_0x3323('0x4')]+_0x36fb8c[_0x3323('0x5')]+_0x36fb8c[_0x3323('0x6')]+_0x36fb8c['countnosuchnumberretry']+_0x36fb8c[_0x3323('0x8')]+_0x36fb8c[_0x3323('0x9')]+_0x36fb8c['countmachineretry']+_0x36fb8c['countagentrejectretry'];this[_0x3323('0xa')]=_0x36fb8c[_0x3323('0xa')];this[_0x3323('0x8')]=_0x36fb8c[_0x3323('0x8')];this[_0x3323('0x9')]=_0x36fb8c[_0x3323('0x9')];this[_0x3323('0xb')]=_0x36fb8c['countmachineretry'];this[_0x3323('0xc')]=_0x36fb8c[_0x3323('0xc')];this[_0x3323('0xd')]=_0x401830[_0x3323('0xd')];this[_0x3323('0xe')]=_0x36fb8c[_0x3323('0xf')];this[_0x3323('0x10')]=_0x36fb8c[_0x3323('0x11')];this[_0x3323('0x12')]=_0x36fb8c['starttime'];this[_0x3323('0x13')]=_0x36fb8c[_0x3323('0x13')];this[_0x3323('0x14')]=_0x36fb8c[_0x3323('0x14')];this[_0x3323('0x15')]=_0x36fb8c['dropreason'];this[_0x3323('0x16')]=this[_0x3323('0x14')];this[_0x3323('0x17')]=utils['getSeconds'](_0x36fb8c[_0x3323('0x13')],_0x36fb8c['starttime']);this[_0x3323('0x18')]=utils[_0x3323('0x19')](this[_0x3323('0x14')],_0x36fb8c[_0x3323('0x13')]);this[_0x3323('0x1a')]=0x0;this[_0x3323('0x1b')]=_0x401830[_0x3323('0x1b')];this['membername']=_0x401830[_0x3323('0x1c')];this[_0x3323('0x1d')]=_0x401830['reason'];this[_0x3323('0x1e')]=_0x36fb8c[_0x3323('0x1e')];this[_0x3323('0x1f')]=_0x36fb8c[_0x3323('0x1f')];this[_0x3323('0x20')]=_0x36fb8c['callbackat'];this['recallme']=_0x36fb8c['recallme'];this['ContactId']=_0x36fb8c[_0x3323('0x21')];this[_0x3323('0x22')]=_0x36fb8c[_0x3323('0x22')];this['UserId']=_0x36fb8c[_0x3323('0x23')];this[_0x3323('0x24')]=_0x36fb8c[_0x3323('0x24')];this[_0x3323('0x25')]=_0x36fb8c[_0x3323('0x25')];this[_0x3323('0x26')]=_0x36fb8c['originatecalleridnum']||'';this[_0x3323('0x27')]=_0x36fb8c[_0x3323('0x27')]||'';this['agiafterat']=_0x36fb8c[_0x3323('0x28')];this['state']=_0x36fb8c[_0x3323('0x29')];this[_0x3323('0x2a')]=_0x36fb8c[_0x3323('0x2a')];}module[_0x3323('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 1447229..65dd92b 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a55=['temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','util','../../rpc/cmHopperAdditionalPhone','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x6a55,0xdb));var _0x56a5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6a55[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x56a5('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x56a5('0x1'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x116199){return util['inspect'](_0x116199,{'showHidden':![],'depth':null});}function getContactDialer(_0x3ff76a,_0x5171fa,_0x28bb2b){return cmHopper[_0x56a5('0x2')](_0x3ff76a['id'],_0x5171fa,_0x28bb2b,_0x3ff76a[_0x56a5('0x3')])[_0x56a5('0x4')](function(_0x444c65){_0x3ff76a[_0x56a5('0x5')]=0x0;logger[_0x56a5('0x6')](_0x56a5('0x7'),inspectError(_0x444c65));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c9e7a,_0xf15490){return cmHopper[_0x56a5('0x8')](_0x1c9e7a['id'],_0xf15490,_0x1c9e7a[_0x56a5('0x3')])[_0x56a5('0x4')](function(_0x3a721d){_0x1c9e7a[_0x56a5('0x5')]=0x0;logger[_0x56a5('0x6')](_0x56a5('0x9'),inspectError(_0x3a721d));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x49711d){return cmHopper[_0x56a5('0xa')](_0x49711d)[_0x56a5('0x4')](function(_0x2b9d7d){logger[_0x56a5('0x6')](_0x56a5('0xb'),inspectError(_0x2b9d7d));});}exports[_0x56a5('0xa')]=countReScheduled;function rescheduleContact(_0x4db11b){return cmHopper['rescheduleContact'](_0x4db11b)[_0x56a5('0x4')](function(_0x1e416f){logger[_0x56a5('0x6')](_0x56a5('0xc'),inspectError(_0x1e416f));});}exports[_0x56a5('0xd')]=rescheduleContact;function unlockContact(_0x2db112,_0xe3091f,_0x5c4028){return cmHopper[_0x56a5('0xe')](_0x2db112,_0xe3091f,_0x5c4028)['catch'](function(_0x41e8b6){logger['error'](_0x56a5('0xf'),inspectError(_0x41e8b6));});}exports[_0x56a5('0xe')]=unlockContact;function moveContactManagedDialer(_0x173c65){return cmHopper[_0x56a5('0x10')](_0x173c65)[_0x56a5('0x4')](function(_0x143f3d){logger[_0x56a5('0x6')]('[moveContactManagedDialer]',inspectError(_0x143f3d));});}exports[_0x56a5('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x3db687){return cmHopperBlack[_0x56a5('0x11')](_0x3db687)[_0x56a5('0x4')](function(_0x52eee2){logger[_0x56a5('0x6')](_0x56a5('0x12'),inspectError(_0x52eee2));});}exports[_0x56a5('0x11')]=checkIsBlackList;function checkIsBlackListIvr(_0x15e469){return cmHopperBlack[_0x56a5('0x13')](_0x15e469)['catch'](function(_0x55579d){logger[_0x56a5('0x6')](_0x56a5('0x14'),inspectError(_0x55579d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1556eb,_0x309fa5,_0x615d49){return cmHopperAdditionalPhone[_0x56a5('0x15')](_0x1556eb,_0x309fa5,_0x615d49)[_0x56a5('0x4')](function(_0x616922){logger[_0x56a5('0x6')](_0x56a5('0x16'),inspectError(_0x616922));});}exports[_0x56a5('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2035c7,_0xcf212,_0x2f203f){return cmHopperAdditionalPhone[_0x56a5('0x17')](_0x2035c7,_0xcf212,_0x2f203f)['catch'](function(_0x5c76a7){logger[_0x56a5('0x6')](_0x56a5('0x18'),inspectError(_0x5c76a7));});}exports[_0x56a5('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x43a815){return cmHopperHistory['avgHandleTime'](_0x43a815)[_0x56a5('0x4')](function(_0x54ec36){logger[_0x56a5('0x6')](_0x56a5('0x19'),inspectError(_0x54ec36));});}exports[_0x56a5('0x1a')]=avgHandleTime;function createHistory(_0x284ee5){return cmHopperHistory['createHistory'](_0x284ee5)[_0x56a5('0x4')](function(_0x1f7aeb){logger[_0x56a5('0x6')]('[createHistory]',inspectError(_0x1f7aeb));});}exports[_0x56a5('0x1b')]=createHistory; \ No newline at end of file +var _0x687b=['checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]'];(function(_0xf91413,_0xd22eab){var _0x193c80=function(_0x4f9f90){while(--_0x4f9f90){_0xf91413['push'](_0xf91413['shift']());}};_0x193c80(++_0xd22eab);}(_0x687b,0x14a));var _0xb687=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x687b[_0x3598bb];return _0x13c837;};'use strict';var util=require(_0xb687('0x0'));var logger=require(_0xb687('0x1'))(_0xb687('0x2'));var cmHopper=require(_0xb687('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xb687('0x4'));function inspectError(_0x2a4a7c){return util[_0xb687('0x5')](_0x2a4a7c,{'showHidden':![],'depth':null});}function getContactDialer(_0x31bd0d,_0x46e5b3,_0x194c55){return cmHopper[_0xb687('0x6')](_0x31bd0d['id'],_0x46e5b3,_0x194c55,_0x31bd0d[_0xb687('0x7')])[_0xb687('0x8')](function(_0x27b750){_0x31bd0d['temp']=0x0;logger[_0xb687('0x9')](_0xb687('0xa'),inspectError(_0x27b750));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1a99c5,_0x21e3ab){return cmHopper[_0xb687('0xb')](_0x1a99c5['id'],_0x21e3ab,_0x1a99c5[_0xb687('0x7')])[_0xb687('0x8')](function(_0x309d84){_0x1a99c5[_0xb687('0xc')]=0x0;logger[_0xb687('0x9')](_0xb687('0xd'),inspectError(_0x309d84));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x226e56){return cmHopper[_0xb687('0xe')](_0x226e56)[_0xb687('0x8')](function(_0x12a0be){logger['error']('[countReScheduled]',inspectError(_0x12a0be));});}exports[_0xb687('0xe')]=countReScheduled;function rescheduleContact(_0x155ebe){return cmHopper['rescheduleContact'](_0x155ebe)[_0xb687('0x8')](function(_0x2f1ac0){logger[_0xb687('0x9')](_0xb687('0xf'),inspectError(_0x2f1ac0));});}exports[_0xb687('0x10')]=rescheduleContact;function unlockContact(_0x3ab914,_0x30622f,_0x141375){return cmHopper[_0xb687('0x11')](_0x3ab914,_0x30622f,_0x141375)[_0xb687('0x8')](function(_0x25124a){logger[_0xb687('0x9')]('[unlockContact]',inspectError(_0x25124a));});}exports[_0xb687('0x11')]=unlockContact;function moveContactManagedDialer(_0x328301){return cmHopper[_0xb687('0x12')](_0x328301)['catch'](function(_0x48958d){logger[_0xb687('0x9')](_0xb687('0x13'),inspectError(_0x48958d));});}exports[_0xb687('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x4b593b){return cmHopperBlack[_0xb687('0x14')](_0x4b593b)['catch'](function(_0x1bd2bf){logger[_0xb687('0x9')](_0xb687('0x15'),inspectError(_0x1bd2bf));});}exports[_0xb687('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x49d5a1){return cmHopperBlack[_0xb687('0x16')](_0x49d5a1)['catch'](function(_0x335541){logger[_0xb687('0x9')](_0xb687('0x17'),inspectError(_0x335541));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1dc06b,_0x491623,_0xa95e91){return cmHopperAdditionalPhone[_0xb687('0x18')](_0x1dc06b,_0x491623,_0xa95e91)[_0xb687('0x8')](function(_0x38866c){logger[_0xb687('0x9')](_0xb687('0x19'),inspectError(_0x38866c));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xf45db0,_0x129347,_0x1c1585){return cmHopperAdditionalPhone[_0xb687('0x1a')](_0xf45db0,_0x129347,_0x1c1585)[_0xb687('0x8')](function(_0x4136c9){logger[_0xb687('0x9')](_0xb687('0x1b'),inspectError(_0x4136c9));});}exports[_0xb687('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x2e6185){return cmHopperHistory['avgHandleTime'](_0x2e6185)[_0xb687('0x8')](function(_0x192966){logger[_0xb687('0x9')](_0xb687('0x1c'),inspectError(_0x192966));});}exports[_0xb687('0x1d')]=avgHandleTime;function createHistory(_0x173c58){return cmHopperHistory['createHistory'](_0x173c58)[_0xb687('0x8')](function(_0x5143af){logger[_0xb687('0x9')](_0xb687('0x1e'),inspectError(_0x5143af));});}exports[_0xb687('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 4559d1f..07ae191 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89d7=['reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','NO_AGENTS_LOGGED','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','erlangb','checkContactLowerLimitOriginate','updatedAt','undefined','XMD-','substring','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','isPreviewCampaign','type','ivr','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x89d7,0x171));var _0x789d=function(_0x1022ed,_0x2ac525){_0x1022ed=_0x1022ed-0x0;var _0x959b70=_0x89d7[_0x1022ed];return _0x959b70;};'use strict';var _=require(_0x789d('0x0'));var moment=require(_0x789d('0x1'));var util=require(_0x789d('0x2'));var logger=require(_0x789d('0x3'))(_0x789d('0x4'));var timezones=require(_0x789d('0x5'))[_0x789d('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x789d('0x7'),'DEACTIVATED':_0x789d('0x8'),'DISACTIVED':_0x789d('0x9'),'EMPTY_INTERVAL':_0x789d('0xa'),'INACTIVE':_0x789d('0xb'),'NO_AGENTS_LOGGED':_0x789d('0xc'),'NO_AVAILABLE_CONTACTS':_0x789d('0xd'),'NULL_INTERVAL':_0x789d('0xe'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x789d('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x789d('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xcdfe91){return _0xcdfe91['dialMethod']==='preview';}exports[_0x789d('0x11')]=isPreviewCampaign;function isIVRCampaign(_0xdad7f7){return _0xdad7f7[_0x789d('0x12')]===_0x789d('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x7cdcdb){return _0x7cdcdb[_0x789d('0x12')]==='outbound';}exports[_0x789d('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x60c15f){return _0x60c15f[_0x789d('0x15')];}exports[_0x789d('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4eb9e0){return _0x4eb9e0[_0x789d('0x17')];}exports[_0x789d('0x18')]=isIVRCampaignActive;function getSeconds(_0x16f5c1,_0x4a004b){var _0x2e0859=moment(_0x16f5c1)[_0x789d('0x19')](0x0);var _0x578524=moment(_0x4a004b)[_0x789d('0x19')](0x0);return _0x2e0859[_0x789d('0x1a')](_0x578524,_0x789d('0x1b'));}exports[_0x789d('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x2c9947,_0x20e851){var _0x438191=![];var _0x2a5374=_0x2c9947['dialMethod']!==_0x20e851['dialMethod']||_0x2c9947[_0x789d('0x15')]!==_0x20e851[_0x789d('0x15')]||_0x2c9947[_0x789d('0x1d')]!==_0x20e851[_0x789d('0x1d')];var _0x4c8cde=_0x2c9947[_0x789d('0x1e')]!==_0x20e851[_0x789d('0x1e')]||_0x2c9947[_0x789d('0x1f')]!==_0x20e851[_0x789d('0x1f')]||_0x2c9947[_0x789d('0x20')]!==_0x20e851['loggedInDb']||_0x2c9947['paused']!==_0x20e851[_0x789d('0x21')]||_0x2c9947[_0x789d('0x22')]!==_0x20e851[_0x789d('0x22')]||_0x2c9947[_0x789d('0x23')]!==_0x20e851[_0x789d('0x23')]||_0x2c9947['waiting']!==_0x20e851[_0x789d('0x24')]||_0x2c9947['inUse']!==_0x20e851[_0x789d('0x25')]||_0x2c9947[_0x789d('0x26')]!==_0x20e851[_0x789d('0x26')];if(_0x2c9947[_0x789d('0x27')]&&_0x20e851[_0x789d('0x27')]){_0x438191=_0x2c9947['Trunk'][_0x789d('0x28')]!==_0x20e851[_0x789d('0x27')][_0x789d('0x28')]||_0x2c9947['Trunk']['active']!==_0x20e851['Trunk']['active'];}return _0x2a5374||_0x4c8cde||_0x438191;}exports[_0x789d('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5661a8){var _0x515daa=null;var _0x2ec358=_0x5661a8['dialTimezone'];if(_[_0x789d('0x2a')](_0x5661a8[_0x789d('0x2b')])||_[_0x789d('0x2a')](_0x5661a8[_0x789d('0x2c')])||_[_0x789d('0x2a')](_0x5661a8[_0x789d('0x2c')][_0x789d('0x2d')])){_0x515daa=CAMPAIGN_STATUS[_0x789d('0x2e')];}else if(_[_0x789d('0x2f')](_0x5661a8['dialGlobalInterval'])||_[_0x789d('0x2f')](_0x5661a8[_0x789d('0x2c')][_0x789d('0x2d')])){_0x515daa=CAMPAIGN_STATUS[_0x789d('0x30')];}else if(_0x2ec358&&!timezones[_0x2ec358]){_0x515daa=CAMPAIGN_STATUS[_0x789d('0x31')];}return _0x515daa;}function checkAnyValidTrunk(_0x5861cb,_0x5bc36c){var _0x4b5dfc=null;var _0x2e9f5d=_0x789d('0x32');var _0x44a8ec=[_0x789d('0x33'),_0x789d('0x34')];var _0x1791e5=!![];if(_0x5861cb[_0x789d('0x27')]&&_0x5861cb[_0x789d('0x27')]['active']){_0x2e9f5d+=_0x5861cb[_0x789d('0x27')]['name'];_0x4b5dfc=_0x5bc36c[_0x2e9f5d];_0x1791e5=_0x44a8ec[_0x789d('0x35')](_0x4b5dfc[_0x789d('0x36')]);}else if(_0x5861cb[_0x789d('0x37')]&&_0x5861cb[_0x789d('0x37')][_0x789d('0x17')]){_0x2e9f5d+=_0x5861cb['TrunkBackup'][_0x789d('0x28')];_0x4b5dfc=_0x5bc36c[_0x2e9f5d];_0x1791e5=_0x44a8ec['includes'](_0x4b5dfc[_0x789d('0x36')]);}return _0x1791e5;}function getQueueCampaignStatusMessage(_0x519cee,_0x33404e){var _0x3f83b0=CAMPAIGN_STATUS[_0x789d('0x38')];var _0x1206df=isPreviewCampaign(_0x519cee);if(!isQueueCampaignActive(_0x519cee)){if(_0x1206df){_0x3f83b0=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x519cee[_0x789d('0x26')]===0x0&&_0x519cee[_0x789d('0x22')]===0x0&&_0x519cee[_0x789d('0x24')]===0x0&&(_0x519cee[_0x789d('0x23')]||0x0)===0x0){_0x3f83b0=CAMPAIGN_STATUS[_0x789d('0x39')];}else{_0x3f83b0=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x519cee[_0x789d('0x1f')]===0x0){_0x3f83b0=CAMPAIGN_STATUS[_0x789d('0x3a')];}else if(!checkAnyValidTrunk(_0x519cee,_0x33404e)){_0x3f83b0=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x519cee)){var _0x6d9baf=checkAnyValidQueueCampaignInterval(_0x519cee);if(_0x6d9baf){_0x3f83b0=_0x6d9baf;}}return _0x3f83b0;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa32b3f){var _0x28f002=CAMPAIGN_STATUS[_0x789d('0x3b')];if(_0xa32b3f[_0x789d('0x26')]===0x0&&_0xa32b3f[_0x789d('0x22')]===0x0&&_0xa32b3f[_0x789d('0x24')]===0x0&&(_0xa32b3f[_0x789d('0x23')]||0x0)===0x0){_0x28f002=CAMPAIGN_STATUS[_0x789d('0x39')];}return _0x28f002;}exports[_0x789d('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x869f5c){var _0x4acfee=_0x869f5c['match'](/"(.*?)"/);return _0x4acfee?_0x4acfee[0x1]:_0x869f5c;}exports[_0x789d('0x3d')]=extractCalleridName;function getCallerId(_0x487b49,_0x3922ff,_0x21c74a){if(!_[_0x789d('0x3e')](_0x21c74a)&&typeof _0x21c74a===_0x789d('0x3f')&&!_[_0x789d('0x2f')](_0x21c74a)){if(!_[_0x789d('0x3e')](_0x3922ff)&&typeof _0x3922ff===_0x789d('0x3f')&&!_[_0x789d('0x2f')](_0x3922ff)){return util[_0x789d('0x40')](_0x789d('0x41'),_0x3922ff,_0x21c74a);}return util[_0x789d('0x40')](_0x789d('0x41'),_0x21c74a,_0x21c74a);}if(!_['isUndefined'](_0x487b49)&&typeof _0x487b49==='string'&&!_[_0x789d('0x2f')](_0x487b49)){return _0x487b49;}return'\x22\x22\x20<>';}exports[_0x789d('0x42')]=getCallerId;function getCallerIdRandom(_0x4588fc,_0x2f1b50){var _0x170093;var _0x25ac44;var _0x86e831;if(_0x2f1b50<=0x0){_0x2f1b50=0x1;}_0x170093=new RegExp(_0x789d('0x43')+_0x2f1b50+'}$');_0x25ac44=Math[_0x789d('0x44')](0xa,_0x2f1b50-0x1);_0x86e831=Math[_0x789d('0x44')](0xa,_0x2f1b50)-0x1;return util[_0x789d('0x40')]('%s',_[_0x789d('0x45')](_0x4588fc,_0x170093,_[_0x789d('0x46')](_0x25ac44,_0x86e831)[_0x789d('0x47')]()));}exports[_0x789d('0x48')]=getCallerIdRandom;function decrementOriginate(_0x5825a3){if(_0x5825a3[_0x789d('0x26')]&&_0x5825a3[_0x789d('0x26')]>0x0){_0x5825a3[_0x789d('0x26')]-=0x1;}else{logger[_0x789d('0x49')](_0x789d('0x4a'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x204fbd){return _0x204fbd&&_0x204fbd[_0x789d('0x4b')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0xaf7201,_0x1ba548){if(_0x1ba548===0x0){return 0x0;}var _0x5e7df0=0x1;for(var _0x27c4b7=0x1;_0x27c4b7<=_0x1ba548;_0x27c4b7+=0x1){_0x5e7df0=0x1+_0x5e7df0*_0x27c4b7/_0xaf7201;}return 0x1/_0x5e7df0;}exports[_0x789d('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x39ea8d,_0x5340ce,_0x1b25af){if(_0x5340ce>_0x1b25af){for(var _0x1e1c3f=0x0;_0x1e1c3f<_0x5340ce-_0x1b25af;_0x1e1c3f+=0x1){decrementOriginate(_0x39ea8d);}}}exports[_0x789d('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2ff044){var _0x2bcf32={};var _0x2a0510=['id','createdAt','tags',_0x789d('0x4e')];const _0x2f91d6=0xfa;if(_0x2ff044){for(var _0x2fdfb6 in _0x2ff044){if(typeof _0x2ff044[_0x2fdfb6]!==_0x789d('0x4f')){if(!_[_0x789d('0x2a')](_0x2ff044[_0x2fdfb6])&&!_0x2a0510[_0x789d('0x35')](_0x2fdfb6)){if(_0x2fdfb6==='description'&&_0x2ff044[_0x2fdfb6][_0x789d('0x4b')]>_0x2f91d6){_0x2bcf32[_0x789d('0x50')+_0x2fdfb6['toUpperCase']()]=_0x2ff044[_0x2fdfb6][_0x789d('0x47')]()[_0x789d('0x51')](0x0,_0x2f91d6);}else{_0x2bcf32['XMD-'+_0x2fdfb6[_0x789d('0x52')]()]=_0x2ff044[_0x2fdfb6];}}}}}return _0x2bcf32;}exports[_0x789d('0x53')]=setXMDContactVariables; \ No newline at end of file +var _0xa38b=['RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isIVRCampaign','type','isOutboundQueue','isIVRCampaignActive','milliseconds','diff','seconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','substring','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME'];(function(_0x4d17e8,_0x1deb64){var _0x1868d4=function(_0x46ea22){while(--_0x46ea22){_0x4d17e8['push'](_0x4d17e8['shift']());}};_0x1868d4(++_0x1deb64);}(_0xa38b,0x13e));var _0xba38=function(_0x398828,_0x52119b){_0x398828=_0x398828-0x0;var _0x399ce8=_0xa38b[_0x398828];return _0x399ce8;};'use strict';var _=require(_0xba38('0x0'));var moment=require(_0xba38('0x1'));var util=require(_0xba38('0x2'));var logger=require(_0xba38('0x3'))(_0xba38('0x4'));var timezones=require('../../../../config/environment/shared')[_0xba38('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xba38('0x6'),'BLACKLIST':_0xba38('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xba38('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xba38('0x9'),'NO_AGENTS_LOGGED':_0xba38('0xa'),'NO_AVAILABLE_CONTACTS':_0xba38('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xba38('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xba38('0xd'),'QUEUE_RECALL':_0xba38('0xe'),'RECALL_TIMEOUT':_0xba38('0xf'),'RUNNING':_0xba38('0x10'),'UNKNOWN_TIMEZONE':_0xba38('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xba38('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xc2d83a){return _0xc2d83a[_0xba38('0x13')]===_0xba38('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x4af04a){return _0x4af04a['type']==='ivr';}exports[_0xba38('0x15')]=isIVRCampaign;function isOutboundQueue(_0x4998f8){return _0x4998f8[_0xba38('0x16')]==='outbound';}exports[_0xba38('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x4c0934){return _0x4c0934['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x34058c){return _0x34058c['active'];}exports[_0xba38('0x18')]=isIVRCampaignActive;function getSeconds(_0x5bb715,_0x3f1242){var _0x29fa44=moment(_0x5bb715)[_0xba38('0x19')](0x0);var _0x3e233b=moment(_0x3f1242)[_0xba38('0x19')](0x0);return _0x29fa44[_0xba38('0x1a')](_0x3e233b,_0xba38('0x1b'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x37444d,_0x203f0e){var _0xf19a08=![];var _0x31ceda=_0x37444d['dialMethod']!==_0x203f0e[_0xba38('0x13')]||_0x37444d[_0xba38('0x1c')]!==_0x203f0e['dialActive']||_0x37444d[_0xba38('0x1d')]!==_0x203f0e[_0xba38('0x1d')];var _0x4e2708=_0x37444d[_0xba38('0x1e')]!==_0x203f0e[_0xba38('0x1e')]||_0x37444d[_0xba38('0x1f')]!==_0x203f0e['loggedIn']||_0x37444d[_0xba38('0x20')]!==_0x203f0e[_0xba38('0x20')]||_0x37444d[_0xba38('0x21')]!==_0x203f0e['paused']||_0x37444d['talking']!==_0x203f0e[_0xba38('0x22')]||_0x37444d[_0xba38('0x23')]!==_0x203f0e['pTalking']||_0x37444d[_0xba38('0x24')]!==_0x203f0e[_0xba38('0x24')]||_0x37444d[_0xba38('0x25')]!==_0x203f0e['inUse']||_0x37444d[_0xba38('0x26')]!==_0x203f0e[_0xba38('0x26')];if(_0x37444d[_0xba38('0x27')]&&_0x203f0e[_0xba38('0x27')]){_0xf19a08=_0x37444d[_0xba38('0x27')][_0xba38('0x28')]!==_0x203f0e['Trunk']['name']||_0x37444d[_0xba38('0x27')]['active']!==_0x203f0e[_0xba38('0x27')][_0xba38('0x29')];}return _0x31ceda||_0x4e2708||_0xf19a08;}exports[_0xba38('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x54a6bf){var _0x3942f6=null;var _0xddf813=_0x54a6bf['dialTimezone'];if(_[_0xba38('0x2b')](_0x54a6bf[_0xba38('0x2c')])||_[_0xba38('0x2b')](_0x54a6bf[_0xba38('0x2d')])||_[_0xba38('0x2b')](_0x54a6bf['Interval'][_0xba38('0x2e')])){_0x3942f6=CAMPAIGN_STATUS[_0xba38('0x2f')];}else if(_['isEmpty'](_0x54a6bf[_0xba38('0x2c')])||_[_0xba38('0x30')](_0x54a6bf['Interval'][_0xba38('0x2e')])){_0x3942f6=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0xddf813&&!timezones[_0xddf813]){_0x3942f6=CAMPAIGN_STATUS[_0xba38('0x31')];}return _0x3942f6;}function checkAnyValidTrunk(_0x5d966c,_0x285978){var _0x4fcb5e=null;var _0x3272a4='SIP/';var _0x4e63f3=['reachable',_0xba38('0x32')];var _0x5d7716=!![];if(_0x5d966c[_0xba38('0x27')]&&_0x5d966c[_0xba38('0x27')][_0xba38('0x29')]){_0x3272a4+=_0x5d966c[_0xba38('0x27')][_0xba38('0x28')];_0x4fcb5e=_0x285978[_0x3272a4];_0x5d7716=_0x4e63f3[_0xba38('0x33')](_0x4fcb5e[_0xba38('0x34')]);}else if(_0x5d966c[_0xba38('0x35')]&&_0x5d966c[_0xba38('0x35')][_0xba38('0x29')]){_0x3272a4+=_0x5d966c['TrunkBackup'][_0xba38('0x28')];_0x4fcb5e=_0x285978[_0x3272a4];_0x5d7716=_0x4e63f3[_0xba38('0x33')](_0x4fcb5e['status']);}return _0x5d7716;}function getQueueCampaignStatusMessage(_0x2cdf5c,_0x2d6b9f){var _0x55cd80=CAMPAIGN_STATUS[_0xba38('0x6')];var _0x58d486=isPreviewCampaign(_0x2cdf5c);if(!isQueueCampaignActive(_0x2cdf5c)){if(_0x58d486){_0x55cd80=CAMPAIGN_STATUS[_0xba38('0x36')];}else{if(_0x2cdf5c[_0xba38('0x26')]===0x0&&_0x2cdf5c['talking']===0x0&&_0x2cdf5c[_0xba38('0x24')]===0x0&&(_0x2cdf5c[_0xba38('0x23')]||0x0)===0x0){_0x55cd80=CAMPAIGN_STATUS['INACTIVE'];}else{_0x55cd80=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x2cdf5c['loggedIn']===0x0){_0x55cd80=CAMPAIGN_STATUS[_0xba38('0x37')];}else if(!checkAnyValidTrunk(_0x2cdf5c,_0x2d6b9f)){_0x55cd80=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2cdf5c)){var _0x288097=checkAnyValidQueueCampaignInterval(_0x2cdf5c);if(_0x288097){_0x55cd80=_0x288097;}}return _0x55cd80;}exports[_0xba38('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa74a60){var _0x1a466c=CAMPAIGN_STATUS['DISACTIVED'];if(_0xa74a60[_0xba38('0x26')]===0x0&&_0xa74a60[_0xba38('0x22')]===0x0&&_0xa74a60[_0xba38('0x24')]===0x0&&(_0xa74a60[_0xba38('0x23')]||0x0)===0x0){_0x1a466c=CAMPAIGN_STATUS[_0xba38('0x36')];}return _0x1a466c;}exports[_0xba38('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x424aa7){var _0x5af337=_0x424aa7['match'](/"(.*?)"/);return _0x5af337?_0x5af337[0x1]:_0x424aa7;}exports[_0xba38('0x3a')]=extractCalleridName;function getCallerId(_0x358fa1,_0x403ff0,_0x141242){if(!_[_0xba38('0x3b')](_0x141242)&&typeof _0x141242===_0xba38('0x3c')&&!_[_0xba38('0x30')](_0x141242)){if(!_['isUndefined'](_0x403ff0)&&typeof _0x403ff0===_0xba38('0x3c')&&!_[_0xba38('0x30')](_0x403ff0)){return util['format']('\x22%s\x22\x20<%s>',_0x403ff0,_0x141242);}return util[_0xba38('0x3d')](_0xba38('0x3e'),_0x141242,_0x141242);}if(!_[_0xba38('0x3b')](_0x358fa1)&&typeof _0x358fa1==='string'&&!_[_0xba38('0x30')](_0x358fa1)){return _0x358fa1;}return _0xba38('0x3f');}exports[_0xba38('0x40')]=getCallerId;function getCallerIdRandom(_0x4425d2,_0xcdc0ba){var _0x397882;var _0x3d24f3;var _0x413cc7;if(_0xcdc0ba<=0x0){_0xcdc0ba=0x1;}_0x397882=new RegExp('\x5cw{0,'+_0xcdc0ba+'}$');_0x3d24f3=Math['pow'](0xa,_0xcdc0ba-0x1);_0x413cc7=Math[_0xba38('0x41')](0xa,_0xcdc0ba)-0x1;return util[_0xba38('0x3d')]('%s',_[_0xba38('0x42')](_0x4425d2,_0x397882,_[_0xba38('0x43')](_0x3d24f3,_0x413cc7)[_0xba38('0x44')]()));}exports[_0xba38('0x45')]=getCallerIdRandom;function decrementOriginate(_0x1e2276){if(_0x1e2276[_0xba38('0x26')]&&_0x1e2276[_0xba38('0x26')]>0x0){_0x1e2276[_0xba38('0x26')]-=0x1;}else{logger[_0xba38('0x46')](_0xba38('0x47'));}}exports[_0xba38('0x48')]=decrementOriginate;function checkContactEmpty(_0x89bd94){return _0x89bd94&&_0x89bd94[_0xba38('0x49')]>0x0;}exports[_0xba38('0x4a')]=checkContactEmpty;function erlangb(_0x53286a,_0x227d76){if(_0x227d76===0x0){return 0x0;}var _0x2f056a=0x1;for(var _0xda81ef=0x1;_0xda81ef<=_0x227d76;_0xda81ef+=0x1){_0x2f056a=0x1+_0x2f056a*_0xda81ef/_0x53286a;}return 0x1/_0x2f056a;}exports[_0xba38('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x33f401,_0x461d81,_0x458974){if(_0x461d81>_0x458974){for(var _0x14f99c=0x0;_0x14f99c<_0x461d81-_0x458974;_0x14f99c+=0x1){decrementOriginate(_0x33f401);}}}exports[_0xba38('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x16a06f){var _0x144225={};var _0x18410d=['id',_0xba38('0x4d'),_0xba38('0x4e'),_0xba38('0x4f')];const _0x269287=0xfa;if(_0x16a06f){for(var _0xe646ab in _0x16a06f){if(typeof _0x16a06f[_0xe646ab]!=='undefined'){if(!_['isNil'](_0x16a06f[_0xe646ab])&&!_0x18410d[_0xba38('0x33')](_0xe646ab)){if(_0xe646ab==='description'&&_0x16a06f[_0xe646ab][_0xba38('0x49')]>_0x269287){_0x144225['XMD-'+_0xe646ab['toUpperCase']()]=_0x16a06f[_0xe646ab]['toString']()[_0xba38('0x50')](0x0,_0x269287);}else{_0x144225['XMD-'+_0xe646ab[_0xba38('0x51')]()]=_0x16a06f[_0xe646ab];}}}}}return _0x144225;}exports[_0xba38('0x52')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8b2e100..10113e7 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(_0x551df6,_0xb10c52){var _0x4187b8=function(_0x5f18a2){while(--_0x5f18a2){_0x551df6['push'](_0x551df6['shift']());}};_0x4187b8(++_0xb10c52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x4628c6,_0x212c5e){var _0x181ddc=function(_0x36280a){while(--_0x36280a){_0x4628c6['push'](_0x4628c6['shift']());}};_0x181ddc(++_0x212c5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 4b4a49c..3dad377 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 _0xe15e=['./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','syncOriginateResponse','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','uuid','moment','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel'];(function(_0x3ec085,_0x5abeca){var _0x4cbef9=function(_0x7a8460){while(--_0x7a8460){_0x3ec085['push'](_0x3ec085['shift']());}};_0x4cbef9(++_0x5abeca);}(_0xe15e,0x6e));var _0xee15=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xe15e[_0x3e29df];return _0x3e3ba9;};'use strict';var util=require('util');var _=require(_0xee15('0x0'));var BPromise=require(_0xee15('0x1'));var uuid=require(_0xee15('0x2'));var moment=require(_0xee15('0x3'));var path=require('path');var tiff2pdf=require(_0xee15('0x4'));var gs=require('./util/gs');var logger=require(_0xee15('0x5'))(_0xee15('0x6'));var ami=require(_0xee15('0x7'));var rpcDb=require(_0xee15('0x8'));var Channel=require(_0xee15('0x9'));var ut=require(_0xee15('0xa'));var Action=require(_0xee15('0xb'));var faxAccount=require(_0xee15('0xc'));var attachment=require(_0xee15('0xd'));var faxMessage=require(_0xee15('0xe'));function Fax(_0x76525e){this[_0xee15('0xf')]={};this[_0xee15('0x10')]=_0x76525e[_0xee15('0x10')];this['trunks']=_0x76525e[_0xee15('0x11')];this[_0xee15('0x12')]={};ami['on'](_0xee15('0x13'),this[_0xee15('0x14')][_0xee15('0x15')](this));ami['on'](_0xee15('0x16'),this[_0xee15('0x17')][_0xee15('0x15')](this));ami['on'](_0xee15('0x18'),this[_0xee15('0x19')][_0xee15('0x15')](this));ami['on'](_0xee15('0x1a'),this['syncNewExten'][_0xee15('0x15')](this));ami['on']('faxstatus',this[_0xee15('0x1b')][_0xee15('0x15')](this));ami['on'](_0xee15('0x1c'),this[_0xee15('0x1d')][_0xee15('0x15')](this));ami['on'](_0xee15('0x1e'),this['syncHangup']['bind'](this));ami['on'](_0xee15('0x1f'),this['syncOriginateResponse'][_0xee15('0x15')](this));}Fax['prototype'][_0xee15('0x14')]=function(_0x4f8517){if(_0x4f8517['context']===_0xee15('0x20')){for(var _0x5ade09 in this[_0xee15('0x10')]){if(this[_0xee15('0x10')][_0xee15('0x21')](_0x5ade09)){if(_0x4f8517[_0xee15('0x22')]===this[_0xee15('0x10')][_0x5ade09][_0xee15('0x23')]){this[_0xee15('0xf')][_0x4f8517[_0xee15('0x24')]]={};this['channels'][_0x4f8517[_0xee15('0x24')]][_0xee15('0x25')]=_0x4f8517['channel'];this[_0xee15('0xf')][_0x4f8517[_0xee15('0x24')]]['id']=this['faxAccounts'][_0x5ade09]['id'];this['channels'][_0x4f8517[_0xee15('0x24')]][_0xee15('0x26')]=this[_0xee15('0x10')][_0x5ade09][_0xee15('0x26')];logger['info'](_0x4f8517[_0xee15('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0xee15('0x12')][_0x4f8517[_0xee15('0x24')]]){this[_0xee15('0xf')][_0x4f8517[_0xee15('0x24')]]={};this[_0xee15('0xf')][_0x4f8517[_0xee15('0x24')]][_0xee15('0x25')]=_0x4f8517[_0xee15('0x25')];logger[_0xee15('0x27')](_0x4f8517[_0xee15('0x24')],_0xee15('0x28'));}};Fax[_0xee15('0x29')][_0xee15('0x17')]=function(_0x28e9a5){if(this[_0xee15('0xf')][_0x28e9a5[_0xee15('0x24')]]){for(var _0x58986c in _0x28e9a5[_0xee15('0x2a')]){if(_0x28e9a5['variable'][_0xee15('0x21')](_0x58986c)){this[_0xee15('0xf')][_0x28e9a5[_0xee15('0x24')]][_0x58986c]=_0x28e9a5['value'];}}}};Fax[_0xee15('0x29')][_0xee15('0x19')]=function(_0x40d8b1){if(this[_0xee15('0xf')][_0x40d8b1[_0xee15('0x24')]]){this['channels'][_0x40d8b1[_0xee15('0x24')]][_0xee15('0x2b')]=_0x40d8b1[_0xee15('0x2b')];this['channels'][_0x40d8b1[_0xee15('0x24')]][_0xee15('0x2c')]=_0x40d8b1[_0xee15('0x2c')];}};Fax[_0xee15('0x29')][_0xee15('0x2d')]=function(_0x518dda){if(this[_0xee15('0xf')][_0x518dda[_0xee15('0x24')]]){for(var _0x143eb5 in _0x518dda[_0xee15('0x2a')]){if(_0x518dda[_0xee15('0x2a')][_0xee15('0x21')](_0x143eb5)){this['channels'][_0x518dda[_0xee15('0x24')]][_0x143eb5]=_0x518dda[_0xee15('0x2e')];}}}};Fax[_0xee15('0x29')]['syncFaxStatus']=function(_0x50147c){if(this['channels'][_0x50147c[_0xee15('0x24')]]){this[_0xee15('0xf')][_0x50147c['uniqueid']][_0xee15('0x2f')]=_0x50147c[_0xee15('0x2f')];this[_0xee15('0xf')][_0x50147c[_0xee15('0x24')]][_0xee15('0x30')]=_0x50147c[_0xee15('0x30')];this[_0xee15('0xf')][_0x50147c[_0xee15('0x24')]][_0xee15('0x23')]=_0x50147c[_0xee15('0x23')];this[_0xee15('0xf')][_0x50147c[_0xee15('0x24')]][_0xee15('0x31')]=_0x50147c[_0xee15('0x31')];logger[_0xee15('0x27')](_0x50147c[_0xee15('0x24')],_0xee15('0x32'));}};Fax[_0xee15('0x29')]['syncReceiveFax']=function(_0x417833){var _0x47bc3b=this;if(this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]]){var _0x38fc77=this[_0xee15('0xf')][_0x417833['uniqueid']]['id'];this['channels'][_0x417833[_0xee15('0x24')]][_0xee15('0x33')]=_0x417833[_0xee15('0x33')];this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]][_0xee15('0x34')]=_0x417833['pagestransferred'];this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]][_0xee15('0x23')]=_0x417833[_0xee15('0x23')];this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]][_0xee15('0x35')]=_0x417833[_0xee15('0x35')];this[_0xee15('0xf')][_0x417833['uniqueid']]['transferrate']=_0x417833[_0xee15('0x36')];this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]]['filename']=_0x417833[_0xee15('0x31')];this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]]['calleridnum']=_0x417833[_0xee15('0x37')];if(this[_0xee15('0xf')][_0x417833[_0xee15('0x24')]][_0xee15('0x34')]>0x0){tiff2pdf(_0x417833[_0xee15('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x41e03b){logger[_0xee15('0x27')](_0x417833['uniqueid'],_0xee15('0x38'),_0x41e03b[_0xee15('0x39')]);attachment[_0xee15('0x3a')]({'name':path[_0xee15('0x3b')](_0x417833[_0xee15('0x31')])[_0xee15('0x26')],'basename':path[_0xee15('0x3b')](_0x417833[_0xee15('0x31')])['name']+_0xee15('0x3c'),'type':'application/pdf'})['then'](function(_0x200106){faxAccount[_0xee15('0x3d')](_0x38fc77,{'from':_0x417833[_0xee15('0x37')],'mapKey':'fax','body':path[_0xee15('0x3b')](_0x417833[_0xee15('0x31')])[_0xee15('0x26')]+'.pdf','AttachmentId':_0x200106['id']})[_0xee15('0x3e')](function(_0x2f6c30){logger[_0xee15('0x3f')](_0x417833[_0xee15('0x24')],_0xee15('0x40'),JSON['stringify'](_0x2f6c30));});})['catch'](function(_0x4ed7a2){logger[_0xee15('0x3f')](_0x417833['uniqueid'],_0xee15('0x41'),JSON[_0xee15('0x42')](_0x4ed7a2));});});}logger[_0xee15('0x27')](_0x417833[_0xee15('0x24')],_0xee15('0x41'));}};Fax[_0xee15('0x29')][_0xee15('0x43')]=function(_0x3e7706){if(this[_0xee15('0x12')][_0x3e7706[_0xee15('0x24')]]){_[_0xee15('0x44')](this[_0xee15('0xf')][_0x3e7706[_0xee15('0x24')]],_[_0xee15('0x45')](_0x3e7706,['response',_0xee15('0x46')]));}};function updateStatus(_0x7821cb){if(_0x7821cb[_0xee15('0x47')]){faxMessage[_0xee15('0x48')](_0x7821cb[_0xee15('0x47')],{'failMessage':_0xee15('0x49')})[_0xee15('0x4a')](function(_0x589d72){ut[_0xee15('0x4b')](_0xee15('0x4c'),_0x589d72);})[_0xee15('0x3e')](function(_0x36cdbc){ut[_0xee15('0x4b')](_0xee15('0x4d'),_0x36cdbc);});}else{ut[_0xee15('0x4b')](_0xee15('0x4e'));}}Fax[_0xee15('0x29')][_0xee15('0x4f')]=function(_0x5c3ae5,_0x3f7818,_0x140ec0){var _0x8b3cd6=this;var _0x5f5a2b={};if(_0x3f7818){_0x5f5a2b={'read':_0x3f7818};}else{_0x5f5a2b={'failMessage':_0x140ec0};}if(this[_0xee15('0x12')][_0x5c3ae5][_0xee15('0x47')]){faxMessage[_0xee15('0x48')](this[_0xee15('0x12')][_0x5c3ae5]['AttachmentId'],_0x5f5a2b)[_0xee15('0x4a')](function(_0x355849){ut[_0xee15('0x4b')](_0xee15('0x50'),_0x355849);})[_0xee15('0x3e')](function(_0x21087d){ut[_0xee15('0x4b')](_0xee15('0x51'),_0x21087d);})['finally'](function(){delete _0x8b3cd6[_0xee15('0xf')][_0x5c3ae5];delete _0x8b3cd6['actions'][_0x5c3ae5];});}else{ut[_0xee15('0x4b')](_0xee15('0x52'));delete this['channels'][_0x5c3ae5];delete this[_0xee15('0x12')][_0x5c3ae5];}};Fax[_0xee15('0x29')][_0xee15('0x53')]=function(_0x3cf405){var _0x54921e=this;if(this[_0xee15('0xf')][_0x3cf405[_0xee15('0x24')]]){if(this[_0xee15('0x12')][_0x3cf405[_0xee15('0x24')]]){this['channels'][_0x3cf405['uniqueid']]['id']=this[_0xee15('0x12')][_0x3cf405[_0xee15('0x24')]]['id'];this[_0xee15('0xf')][_0x3cf405[_0xee15('0x24')]][_0xee15('0x26')]=this['actions'][_0x3cf405[_0xee15('0x24')]][_0xee15('0x26')];}logger[_0xee15('0x27')](_0x3cf405[_0xee15('0x24')],this[_0xee15('0x12')][_0x3cf405[_0xee15('0x24')]]?_0xee15('0x54'):_0xee15('0x55'),JSON[_0xee15('0x42')](this[_0xee15('0xf')][_0x3cf405[_0xee15('0x24')]]));if(this[_0xee15('0x12')][_0x3cf405['uniqueid']]){if(this[_0xee15('0xf')][_0x3cf405[_0xee15('0x24')]][_0xee15('0x56')]>0x0&&this[_0xee15('0xf')][_0x3cf405[_0xee15('0x24')]][_0xee15('0x57')]===_0xee15('0x58')){this[_0xee15('0x4f')](_0x3cf405[_0xee15('0x24')],!![]);}else{this[_0xee15('0x4f')](_0x3cf405[_0xee15('0x24')],![],this[_0xee15('0xf')][_0x3cf405[_0xee15('0x24')]][_0xee15('0x59')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x3cf405['uniqueid']][_0xee15('0x59')]:_0xee15('0x5a'));}}}};Fax[_0xee15('0x29')][_0xee15('0x5b')]=function(_0x21382d){var _0xc3b5de=this;return new BPromise(function(_0xd5f500,_0x1990ea){_0xc3b5de[_0xee15('0x5c')](_0x21382d,_0xc3b5de['faxAccounts'][_0x21382d[_0xee15('0x5d')]])[_0xee15('0x4a')](function(_0x1c760f){ut[_0xee15('0x4b')]('[Fax][execOriginate][success]',_0x1c760f);_0xd5f500(ut[_0xee15('0x39')](_0xee15('0x5e')));})[_0xee15('0x3e')](function(_0x4ded8e){ut[_0xee15('0x4b')](_0xee15('0x5f'),_0x4ded8e);updateStatus(_0x21382d);_0x1990ea(ut[_0xee15('0x39')]('Fax\x20failed'));});});};Fax[_0xee15('0x29')][_0xee15('0x60')]=function(_0x154ca5){var _0x115c39=this;return new BPromise(function(_0x403c60,_0x5e5649){var _0x9d0bb6=_0x115c39[_0xee15('0x61')](_0x115c39['faxAccounts'][_0x154ca5['FaxAccountId']][_0xee15('0x62')],_0x154ca5);if(_0x9d0bb6[_0xee15('0x63')]){_0x403c60(ut[_0xee15('0x39')](_0xee15('0x64')));}else{_0x5e5649(ut['message'](_0x9d0bb6['message']));}});};function originate(_0x5556dc,_0x3fd388,_0xe02afd){return new BPromise(function(_0x1d168d,_0xc2f12f){if(_0xe02afd){var _0x371d93=util[_0xee15('0x65')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xee15('0x3b')](_0x5556dc['path'])[_0xee15('0x26')],_0x5556dc[_0xee15('0x66')]);gs['execute'](_0x371d93)[_0xee15('0x4a')](function(){_0x5556dc[_0xee15('0x66')]=util[_0xee15('0x65')](_0xee15('0x67'),path[_0xee15('0x3b')](_0x5556dc[_0xee15('0x66')])['dir'],path[_0xee15('0x3b')](_0x5556dc[_0xee15('0x66')])[_0xee15('0x26')]);_0x3fd388['XMF-PATH']=_0x5556dc[_0xee15('0x66')];ut[_0xee15('0x4b')](_0xee15('0x68'),'');ami[_0xee15('0x69')](ut[_0xee15('0x6a')](_0x5556dc,_0x3fd388))[_0xee15('0x4a')](function(_0x37f10e){_0x1d168d(_0x37f10e);})[_0xee15('0x3e')](function(_0x5043c6){_0xc2f12f(_0x5043c6);});})[_0xee15('0x3e')](function(_0x2a282c){_0xc2f12f(_0x2a282c);});}else{ami[_0xee15('0x69')](ut['variablesAction'](_0x5556dc,_0x3fd388))[_0xee15('0x4a')](function(_0x350c63){_0x1d168d(_0x350c63);})[_0xee15('0x3e')](function(_0x3d39c0){_0xc2f12f(_0x3d39c0);});}});}Fax[_0xee15('0x29')][_0xee15('0x5c')]=function(_0x3a8799,_0x3d59e8){var _0x91c23a=this;return new BPromise(function(_0x308771,_0x3b99d3){var _0x6156d9=uuid['v4']();var _0x26f1d3=ut[_0xee15('0x6b')](_0x3a8799,_0x3d59e8);_0x91c23a[_0xee15('0x12')][_0x6156d9]=new Action(_0x6156d9,_0x3d59e8,_0x3a8799);var _0x3d3692=_0x91c23a['actions'][_0x6156d9];if(path[_0xee15('0x3b')](_0x3a8799[_0xee15('0x66')])[_0xee15('0x6c')]===_0xee15('0x3c')){originate(_0x3d3692,_0x26f1d3,!![])[_0xee15('0x4a')](function(_0x1a2701){_0x308771(_0x1a2701);})[_0xee15('0x3e')](function(_0x34c172){_0x3b99d3(_0x34c172);});}else{originate(_0x3d3692,_0x26f1d3,![])[_0xee15('0x4a')](function(_0x4c4c88){_0x308771(_0x4c4c88);})[_0xee15('0x3e')](function(_0x369944){_0x3b99d3(_0x369944);});}});};Fax[_0xee15('0x29')]['isTrunkReachable']=function(_0x15682a){return!_['isNil'](_0x15682a)&&!_[_0xee15('0x6d')](_0x15682a[_0xee15('0x26')])&&!_[_0xee15('0x6d')](_0x15682a['active'])&&_0x15682a[_0xee15('0x6e')]&&!_[_0xee15('0x6d')](this[_0xee15('0x11')][util[_0xee15('0x65')]('SIP/%s',_0x15682a['name'])])&&!_[_0xee15('0x6d')](this[_0xee15('0x11')][util[_0xee15('0x65')](_0xee15('0x6f'),_0x15682a[_0xee15('0x26')])]['status'])&&(this[_0xee15('0x11')][util['format'](_0xee15('0x6f'),_0x15682a[_0xee15('0x26')])][_0xee15('0x30')]===_0xee15('0x70')||this[_0xee15('0x11')][util['format']('SIP/%s',_0x15682a[_0xee15('0x26')])][_0xee15('0x30')]===_0xee15('0x71'));};Fax['prototype'][_0xee15('0x61')]=function(_0x39be27,_0xda9c24){if(!this['isTrunkReachable'](_0x39be27)){ut[_0xee15('0x4b')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x39be27)?'':_0x39be27[_0xee15('0x26')]+_0xee15('0x72'));return{'isValid':![],'message':_0xee15('0x73')};}if(_[_0xee15('0x6d')](_0xda9c24[_0xee15('0x6')])){ut[_0xee15('0x4b')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xee15('0x42')](_0xda9c24));return{'isValid':![],'message':_0xee15('0x74')};}if(_[_0xee15('0x6d')](_0xda9c24[_0xee15('0x66')])){ut[_0xee15('0x4b')](_0xee15('0x75'),JSON[_0xee15('0x42')](_0xda9c24));return{'isValid':![],'message':_0xee15('0x76')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xee15('0x77')]=Fax; \ No newline at end of file +var _0x962f=['syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','uniqueid','\x20syncNewchannel\x20','channel','info','syncVarSet','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','name','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','then','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','path','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset'];(function(_0x3c9cf4,_0x44bde0){var _0xc0cca7=function(_0x28b0a6){while(--_0x28b0a6){_0x3c9cf4['push'](_0x3c9cf4['shift']());}};_0xc0cca7(++_0x44bde0);}(_0x962f,0xc0));var _0xf962=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x962f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf962('0x0'));var _=require(_0xf962('0x1'));var BPromise=require(_0xf962('0x2'));var uuid=require('uuid');var moment=require(_0xf962('0x3'));var path=require('path');var tiff2pdf=require(_0xf962('0x4'));var gs=require(_0xf962('0x5'));var logger=require(_0xf962('0x6'))(_0xf962('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xf962('0x8'));var ut=require(_0xf962('0x9'));var Action=require('./action');var faxAccount=require(_0xf962('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xf962('0xb'));function Fax(_0x10faa7){this[_0xf962('0xc')]={};this[_0xf962('0xd')]=_0x10faa7['faxAccounts'];this['trunks']=_0x10faa7[_0xf962('0xe')];this[_0xf962('0xf')]={};ami['on'](_0xf962('0x10'),this[_0xf962('0x11')][_0xf962('0x12')](this));ami['on'](_0xf962('0x13'),this['syncVarSet'][_0xf962('0x12')](this));ami['on']('newstate',this[_0xf962('0x14')][_0xf962('0x12')](this));ami['on']('newexten',this[_0xf962('0x15')][_0xf962('0x12')](this));ami['on'](_0xf962('0x16'),this[_0xf962('0x17')]['bind'](this));ami['on']('receivefax',this[_0xf962('0x18')][_0xf962('0x12')](this));ami['on']('hangup',this[_0xf962('0x19')][_0xf962('0x12')](this));ami['on']('originateresponse',this[_0xf962('0x1a')][_0xf962('0x12')](this));}Fax[_0xf962('0x1b')]['syncNewchannel']=function(_0x282323){if(_0x282323[_0xf962('0x1c')]===_0xf962('0x1d')){for(var _0x4a34da in this[_0xf962('0xd')]){if(this[_0xf962('0xd')][_0xf962('0x1e')](_0x4a34da)){if(_0x282323['exten']===this[_0xf962('0xd')][_0x4a34da]['localstationid']){this[_0xf962('0xc')][_0x282323['uniqueid']]={};this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]]['channel']=_0x282323['channel'];this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]]['id']=this[_0xf962('0xd')][_0x4a34da]['id'];this['channels'][_0x282323['uniqueid']]['name']=this[_0xf962('0xd')][_0x4a34da]['name'];logger['info'](_0x282323[_0xf962('0x1f')],_0xf962('0x20'));}}}}if(this[_0xf962('0xf')][_0x282323[_0xf962('0x1f')]]){this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]]={};this[_0xf962('0xc')][_0x282323[_0xf962('0x1f')]][_0xf962('0x21')]=_0x282323['channel'];logger[_0xf962('0x22')](_0x282323['uniqueid'],_0xf962('0x20'));}};Fax[_0xf962('0x1b')][_0xf962('0x23')]=function(_0x2c6900){if(this['channels'][_0x2c6900[_0xf962('0x1f')]]){for(var _0xcedebb in _0x2c6900['variable']){if(_0x2c6900['variable'][_0xf962('0x1e')](_0xcedebb)){this[_0xf962('0xc')][_0x2c6900[_0xf962('0x1f')]][_0xcedebb]=_0x2c6900['value'];}}}};Fax['prototype'][_0xf962('0x14')]=function(_0x17bdbb){if(this[_0xf962('0xc')][_0x17bdbb[_0xf962('0x1f')]]){this[_0xf962('0xc')][_0x17bdbb['uniqueid']][_0xf962('0x24')]=_0x17bdbb[_0xf962('0x24')];this[_0xf962('0xc')][_0x17bdbb['uniqueid']][_0xf962('0x25')]=_0x17bdbb[_0xf962('0x25')];}};Fax[_0xf962('0x1b')][_0xf962('0x15')]=function(_0xb0d4c3){if(this['channels'][_0xb0d4c3[_0xf962('0x1f')]]){for(var _0x242379 in _0xb0d4c3['variable']){if(_0xb0d4c3['variable']['hasOwnProperty'](_0x242379)){this[_0xf962('0xc')][_0xb0d4c3[_0xf962('0x1f')]][_0x242379]=_0xb0d4c3[_0xf962('0x26')];}}}};Fax[_0xf962('0x1b')]['syncFaxStatus']=function(_0x3065fb){if(this[_0xf962('0xc')][_0x3065fb[_0xf962('0x1f')]]){this[_0xf962('0xc')][_0x3065fb['uniqueid']][_0xf962('0x27')]=_0x3065fb[_0xf962('0x27')];this[_0xf962('0xc')][_0x3065fb[_0xf962('0x1f')]][_0xf962('0x28')]=_0x3065fb[_0xf962('0x28')];this[_0xf962('0xc')][_0x3065fb['uniqueid']][_0xf962('0x29')]=_0x3065fb[_0xf962('0x29')];this[_0xf962('0xc')][_0x3065fb[_0xf962('0x1f')]][_0xf962('0x2a')]=_0x3065fb['filename'];logger['info'](_0x3065fb[_0xf962('0x1f')],_0xf962('0x2b'));}};Fax['prototype'][_0xf962('0x18')]=function(_0x5087a4){var _0x5ae19d=this;if(this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]){var _0xc251f=this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]['id'];this[_0xf962('0xc')][_0x5087a4['uniqueid']][_0xf962('0x2c')]=_0x5087a4[_0xf962('0x2c')];this['channels'][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x2d')]=_0x5087a4[_0xf962('0x2d')];this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x29')]=_0x5087a4[_0xf962('0x29')];this[_0xf962('0xc')][_0x5087a4['uniqueid']]['resolution']=_0x5087a4['resolution'];this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]['transferrate']=_0x5087a4[_0xf962('0x2e')];this[_0xf962('0xc')][_0x5087a4[_0xf962('0x1f')]]['filename']=_0x5087a4['filename'];this['channels'][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x2f')]=_0x5087a4[_0xf962('0x2f')];if(this['channels'][_0x5087a4[_0xf962('0x1f')]][_0xf962('0x2d')]>0x0){tiff2pdf(_0x5087a4[_0xf962('0x2a')],_0xf962('0x30'),function(_0x392efe){logger[_0xf962('0x22')](_0x5087a4[_0xf962('0x1f')],'\x20result\x20conversion\x20file\x20',_0x392efe[_0xf962('0x31')]);attachment[_0xf962('0x32')]({'name':path[_0xf962('0x33')](_0x5087a4[_0xf962('0x2a')])[_0xf962('0x34')],'basename':path[_0xf962('0x33')](_0x5087a4[_0xf962('0x2a')])[_0xf962('0x34')]+_0xf962('0x35'),'type':'application/pdf'})['then'](function(_0x1708c1){faxAccount['notify'](_0xc251f,{'from':_0x5087a4[_0xf962('0x2f')],'mapKey':_0xf962('0x7'),'body':path[_0xf962('0x33')](_0x5087a4['filename'])['name']+'.pdf','AttachmentId':_0x1708c1['id']})[_0xf962('0x36')](function(_0x4562c6){logger['error'](_0x5087a4[_0xf962('0x1f')],_0xf962('0x37'),JSON[_0xf962('0x38')](_0x4562c6));});})['catch'](function(_0x4d1f60){logger[_0xf962('0x39')](_0x5087a4[_0xf962('0x1f')],_0xf962('0x3a'),JSON[_0xf962('0x38')](_0x4d1f60));});});}logger[_0xf962('0x22')](_0x5087a4['uniqueid'],_0xf962('0x3a'));}};Fax[_0xf962('0x1b')][_0xf962('0x1a')]=function(_0x29489a){if(this[_0xf962('0xf')][_0x29489a[_0xf962('0x1f')]]){_['merge'](this['channels'][_0x29489a[_0xf962('0x1f')]],_[_0xf962('0x3b')](_0x29489a,[_0xf962('0x3c'),_0xf962('0x3d')]));}};function updateStatus(_0x1988d3){if(_0x1988d3[_0xf962('0x3e')]){faxMessage[_0xf962('0x3f')](_0x1988d3[_0xf962('0x3e')],{'failMessage':_0xf962('0x40')})['then'](function(_0x53f2e5){ut[_0xf962('0x41')]('[Fax][Message][Error][Updated]',_0x53f2e5);})[_0xf962('0x36')](function(_0x58fd22){ut['logger'](_0xf962('0x42'),_0x58fd22);});}else{ut[_0xf962('0x41')](_0xf962('0x43'));}}Fax[_0xf962('0x1b')][_0xf962('0x44')]=function(_0x1617f3,_0x57436a,_0x436438){var _0x3a1ae8=this;var _0x4e8dac={};if(_0x57436a){_0x4e8dac={'read':_0x57436a};}else{_0x4e8dac={'failMessage':_0x436438};}if(this[_0xf962('0xf')][_0x1617f3][_0xf962('0x3e')]){faxMessage[_0xf962('0x3f')](this[_0xf962('0xf')][_0x1617f3][_0xf962('0x3e')],_0x4e8dac)['then'](function(_0x425575){ut['logger']('[Fax][Message][Updated]',_0x425575);})['catch'](function(_0x209783){ut[_0xf962('0x41')](_0xf962('0x45'),_0x209783);})['finally'](function(){delete _0x3a1ae8[_0xf962('0xc')][_0x1617f3];delete _0x3a1ae8[_0xf962('0xf')][_0x1617f3];});}else{ut[_0xf962('0x41')](_0xf962('0x46'));delete this[_0xf962('0xc')][_0x1617f3];delete this[_0xf962('0xf')][_0x1617f3];}};Fax['prototype'][_0xf962('0x19')]=function(_0x6cb6c1){var _0xd09c80=this;if(this['channels'][_0x6cb6c1[_0xf962('0x1f')]]){if(this['actions'][_0x6cb6c1[_0xf962('0x1f')]]){this['channels'][_0x6cb6c1['uniqueid']]['id']=this[_0xf962('0xf')][_0x6cb6c1[_0xf962('0x1f')]]['id'];this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['name']=this[_0xf962('0xf')][_0x6cb6c1['uniqueid']][_0xf962('0x34')];}logger[_0xf962('0x22')](_0x6cb6c1[_0xf962('0x1f')],this[_0xf962('0xf')][_0x6cb6c1['uniqueid']]?_0xf962('0x47'):_0xf962('0x48'),JSON[_0xf962('0x38')](this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]));if(this[_0xf962('0xf')][_0x6cb6c1[_0xf962('0x1f')]]){if(this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['faxpages']>0x0&&this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['faxstatus']===_0xf962('0x49')){this[_0xf962('0x44')](_0x6cb6c1[_0xf962('0x1f')],!![]);}else{this[_0xf962('0x44')](_0x6cb6c1[_0xf962('0x1f')],![],this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]]['faxstatusstring']?_0xf962('0x4a')+this[_0xf962('0xc')][_0x6cb6c1[_0xf962('0x1f')]][_0xf962('0x4b')]:_0xf962('0x4c'));}}}};Fax[_0xf962('0x1b')]['send']=function(_0x5a653d){var _0x441454=this;return new BPromise(function(_0x2037de,_0xed71ae){_0x441454[_0xf962('0x4d')](_0x5a653d,_0x441454[_0xf962('0xd')][_0x5a653d[_0xf962('0x4e')]])[_0xf962('0x4f')](function(_0x47e564){ut[_0xf962('0x41')](_0xf962('0x50'),_0x47e564);_0x2037de(ut[_0xf962('0x31')](_0xf962('0x51')));})[_0xf962('0x36')](function(_0x2a638d){ut['logger'](_0xf962('0x52'),_0x2a638d);updateStatus(_0x5a653d);_0xed71ae(ut[_0xf962('0x31')](_0xf962('0x53')));});});};Fax[_0xf962('0x1b')][_0xf962('0x54')]=function(_0x1e7e2f){var _0x300d6a=this;return new BPromise(function(_0x53e23b,_0x2a4041){var _0x456700=_0x300d6a[_0xf962('0x55')](_0x300d6a[_0xf962('0xd')][_0x1e7e2f[_0xf962('0x4e')]][_0xf962('0x56')],_0x1e7e2f);if(_0x456700[_0xf962('0x57')]){_0x53e23b(ut[_0xf962('0x31')]('Trunk\x20Reachable'));}else{_0x2a4041(ut['message'](_0x456700[_0xf962('0x31')]));}});};function originate(_0xc10f89,_0x4bb9e4,_0x4ca5c4){return new BPromise(function(_0x20d161,_0x35ad9e){if(_0x4ca5c4){var _0x489bfb=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0xc10f89[_0xf962('0x58')])['name'],_0xc10f89[_0xf962('0x58')]);gs['execute'](_0x489bfb)['then'](function(){_0xc10f89[_0xf962('0x58')]=util[_0xf962('0x59')](_0xf962('0x5a'),path[_0xf962('0x33')](_0xc10f89[_0xf962('0x58')])[_0xf962('0x5b')],path[_0xf962('0x33')](_0xc10f89['path'])['name']);_0x4bb9e4[_0xf962('0x5c')]=_0xc10f89[_0xf962('0x58')];ut[_0xf962('0x41')](_0xf962('0x5d'),'');ami[_0xf962('0x5e')](ut[_0xf962('0x5f')](_0xc10f89,_0x4bb9e4))[_0xf962('0x4f')](function(_0x290d60){_0x20d161(_0x290d60);})[_0xf962('0x36')](function(_0x5ea1c7){_0x35ad9e(_0x5ea1c7);});})[_0xf962('0x36')](function(_0x20aa57){_0x35ad9e(_0x20aa57);});}else{ami[_0xf962('0x5e')](ut[_0xf962('0x5f')](_0xc10f89,_0x4bb9e4))[_0xf962('0x4f')](function(_0x408aa6){_0x20d161(_0x408aa6);})['catch'](function(_0x34fa29){_0x35ad9e(_0x34fa29);});}});}Fax[_0xf962('0x1b')][_0xf962('0x4d')]=function(_0x2085fb,_0x53fca1){var _0x4394bd=this;return new BPromise(function(_0x26d0eb,_0x326b29){var _0x367f2c=uuid['v4']();var _0x32f7d0=ut['addVariables'](_0x2085fb,_0x53fca1);_0x4394bd[_0xf962('0xf')][_0x367f2c]=new Action(_0x367f2c,_0x53fca1,_0x2085fb);var _0x1acf9e=_0x4394bd[_0xf962('0xf')][_0x367f2c];if(path['parse'](_0x2085fb[_0xf962('0x58')])[_0xf962('0x60')]===_0xf962('0x35')){originate(_0x1acf9e,_0x32f7d0,!![])[_0xf962('0x4f')](function(_0x4460a9){_0x26d0eb(_0x4460a9);})[_0xf962('0x36')](function(_0x4d295d){_0x326b29(_0x4d295d);});}else{originate(_0x1acf9e,_0x32f7d0,![])['then'](function(_0x4a3565){_0x26d0eb(_0x4a3565);})[_0xf962('0x36')](function(_0x1939a7){_0x326b29(_0x1939a7);});}});};Fax[_0xf962('0x1b')][_0xf962('0x61')]=function(_0x33b17e){return!_[_0xf962('0x62')](_0x33b17e)&&!_[_0xf962('0x62')](_0x33b17e[_0xf962('0x34')])&&!_[_0xf962('0x62')](_0x33b17e['active'])&&_0x33b17e[_0xf962('0x63')]&&!_[_0xf962('0x62')](this[_0xf962('0xe')][util['format']('SIP/%s',_0x33b17e[_0xf962('0x34')])])&&!_[_0xf962('0x62')](this[_0xf962('0xe')][util['format'](_0xf962('0x64'),_0x33b17e[_0xf962('0x34')])][_0xf962('0x28')])&&(this[_0xf962('0xe')][util[_0xf962('0x59')](_0xf962('0x64'),_0x33b17e['name'])][_0xf962('0x28')]==='reachable'||this[_0xf962('0xe')][util['format']('SIP/%s',_0x33b17e['name'])][_0xf962('0x28')]==='unmonitored');};Fax[_0xf962('0x1b')][_0xf962('0x55')]=function(_0x52084a,_0x17b53e){if(!this[_0xf962('0x61')](_0x52084a)){ut[_0xf962('0x41')](_0xf962('0x65'),_[_0xf962('0x62')](_0x52084a)?'':_0x52084a[_0xf962('0x34')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xf962('0x66')};}if(_[_0xf962('0x62')](_0x17b53e[_0xf962('0x7')])){ut['logger'](_0xf962('0x67'),JSON[_0xf962('0x38')](_0x17b53e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xf962('0x62')](_0x17b53e['path'])){ut['logger'](_0xf962('0x68'),JSON[_0xf962('0x38')](_0x17b53e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xf962('0x69')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c5c5547..459a57d 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 _0x17a8=['../../../config/logger','preview','lodash','../rpc/faxAccount','notify','then','catch','util','bluebird'];(function(_0x4e787b,_0x402927){var _0x1b638b=function(_0x304f47){while(--_0x304f47){_0x4e787b['push'](_0x4e787b['shift']());}};_0x1b638b(++_0x402927);}(_0x17a8,0xfa));var _0x817a=function(_0x3403d5,_0x3d99fc){_0x3403d5=_0x3403d5-0x0;var _0xf9df4f=_0x17a8[_0x3403d5];return _0xf9df4f;};'use strict';var util=require(_0x817a('0x0'));var BPromise=require(_0x817a('0x1'));var logger=require(_0x817a('0x2'))(_0x817a('0x3'));var _=require(_0x817a('0x4'));var faxAccount=require(_0x817a('0x5'));function loggerCatch(_0x461fc2){return function(_0x1f3022){logger['error'](_0x461fc2,util['inspect'](_0x1f3022,{'showHidden':![],'depth':null}));};}exports[_0x817a('0x6')]=function(_0x45deac,_0x17e351){return BPromise['resolve']()[_0x817a('0x7')](faxAccount[_0x817a('0x6')](_0x45deac,_0x17e351))[_0x817a('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xab61=['error','inspect','then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xab61,0x74));var _0x1ab6=function(_0x22084f,_0x38bf02){_0x22084f=_0x22084f-0x0;var _0x48d702=_0xab61[_0x22084f];return _0x48d702;};'use strict';var util=require(_0x1ab6('0x0'));var BPromise=require(_0x1ab6('0x1'));var logger=require(_0x1ab6('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x1ab6('0x3'));function loggerCatch(_0x4e50d8){return function(_0x2c490a){logger[_0x1ab6('0x4')](_0x4e50d8,util[_0x1ab6('0x5')](_0x2c490a,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x22c15e,_0x547a66){return BPromise['resolve']()[_0x1ab6('0x6')](faxAccount[_0x1ab6('0x7')](_0x22c15e,_0x547a66))[_0x1ab6('0x8')](loggerCatch(_0x1ab6('0x9')));}; \ 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 2e5e4f5..3a782f5 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 _0x39a3=['util','../../../../config/logger','fax','bluebird','child_process','info','Exec\x20gs'];(function(_0x563263,_0x1cf0c9){var _0x29f63b=function(_0x3ec82f){while(--_0x3ec82f){_0x563263['push'](_0x563263['shift']());}};_0x29f63b(++_0x1cf0c9);}(_0x39a3,0x93));var _0x339a=function(_0x5c7c31,_0x22aa86){_0x5c7c31=_0x5c7c31-0x0;var _0x193fdf=_0x39a3[_0x5c7c31];return _0x193fdf;};'use strict';var util=require(_0x339a('0x0'));var logger=require(_0x339a('0x1'))(_0x339a('0x2'));var BPromise=require(_0x339a('0x3'));var exec=require(_0x339a('0x4'))['exec'];exports['execute']=function(_0x2fb0f9){return new BPromise(function(_0x22da81,_0x412366){exec(_0x2fb0f9,function(_0xd1be76,_0x1bd83e,_0x187d33){logger[_0x339a('0x5')](_0x339a('0x6'),_0x1bd83e);if(_0xd1be76){logger['info'](_0x339a('0x6'),'\x20Error\x20:',util['inspect'](_0xd1be76,{'showHidden':![],'depth':null}),_0x1bd83e,_0x187d33);_0x412366(_0xd1be76);}_0x22da81(_0x1bd83e);});});}; \ No newline at end of file +var _0x6a0c=['execute','info','inspect','util','bluebird','child_process','exec'];(function(_0x1f5e61,_0xbfa7bf){var _0x3ceb35=function(_0x1dc7ff){while(--_0x1dc7ff){_0x1f5e61['push'](_0x1f5e61['shift']());}};_0x3ceb35(++_0xbfa7bf);}(_0x6a0c,0x161));var _0xc6a0=function(_0x233a59,_0x1e7693){_0x233a59=_0x233a59-0x0;var _0x25845a=_0x6a0c[_0x233a59];return _0x25845a;};'use strict';var util=require(_0xc6a0('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xc6a0('0x1'));var exec=require(_0xc6a0('0x2'))[_0xc6a0('0x3')];exports[_0xc6a0('0x4')]=function(_0x48f428){return new BPromise(function(_0x4037c3,_0x1b5323){exec(_0x48f428,function(_0x5dc5f9,_0x46bc83,_0x5c8312){logger[_0xc6a0('0x5')]('Exec\x20gs',_0x46bc83);if(_0x5dc5f9){logger[_0xc6a0('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0xc6a0('0x6')](_0x5dc5f9,{'showHidden':![],'depth':null}),_0x46bc83,_0x5c8312);_0x1b5323(_0x5dc5f9);}_0x4037c3(_0x46bc83);});});}; \ 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 18d0620..f643b26 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 _0x6922=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','fax','message','logger','info','addVariables','headerinfo','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout'];(function(_0x447cc2,_0x276966){var _0x17c0ee=function(_0x162ac9){while(--_0x162ac9){_0x447cc2['push'](_0x447cc2['shift']());}};_0x17c0ee(++_0x276966);}(_0x6922,0x179));var _0x2692=function(_0x156514,_0x10cc0f){_0x156514=_0x156514-0x0;var _0x5d601e=_0x6922[_0x156514];return _0x5d601e;};'use strict';var util=require('util');var _=require(_0x2692('0x0'));var moment=require(_0x2692('0x1'));var logger=require('../../../../config/logger')(_0x2692('0x2'));exports[_0x2692('0x3')]=function(_0x2745de){return{'message':_0x2745de};};exports[_0x2692('0x4')]=function(_0x108c86,_0x15d5db){logger[_0x2692('0x5')](_0x108c86,util['inspect'](_0x15d5db,{'showHidden':![],'depth':null}));};exports[_0x2692('0x6')]=function(_0x4e4595,_0x4a7f8a){var _0x1530df={'XMF-ECM':_0x4a7f8a['ecm'],'XMF-HEADERINFO':_0x4a7f8a[_0x2692('0x7')],'XMF-MINRATE':_0x4a7f8a['minrate'],'XMF-MAXRATE':_0x4a7f8a['maxrate'],'XMF-MODEM':util[_0x2692('0x8')](_0x2692('0x9'),_0x4a7f8a[_0x2692('0xa')]),'XMF-GATEWAY':_0x4a7f8a[_0x2692('0xb')],'XMF-FAXDETECT':_0x4a7f8a[_0x2692('0xc')],'XMF-T38TIMEOUT':_0x4a7f8a[_0x2692('0xd')],'XMF-LOCALSTATIONID':_0x4a7f8a[_0x2692('0xe')],'XMF-PATH':_0x4e4595[_0x2692('0xf')]};return _0x1530df;};exports[_0x2692('0x10')]=function(_0x49a4ff,_0x3abcca){return{'actionid':_0x49a4ff[_0x2692('0x11')],'action':_0x2692('0x12'),'channel':_0x49a4ff[_0x2692('0x13')],'Exten':_0x2692('0x14'),'Context':_0x2692('0x15'),'Priority':'1','callerid':util[_0x2692('0x8')](_0x2692('0x16'),_0x49a4ff[_0x2692('0x7')]?_0x49a4ff[_0x2692('0x7')]:'',_0x49a4ff[_0x2692('0xe')]),'variable':_0x3abcca,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x49a4ff[_0x2692('0x11')]};}; \ No newline at end of file +var _0x0830=['modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','message','logger','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22'];(function(_0x401c74,_0x5b5774){var _0xd2982c=function(_0x2f8d43){while(--_0x2f8d43){_0x401c74['push'](_0x401c74['shift']());}};_0xd2982c(++_0x5b5774);}(_0x0830,0xd0));var _0x0083=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0x0830[_0x2226c1];return _0x178716;};'use strict';var util=require(_0x0083('0x0'));var _=require(_0x0083('0x1'));var moment=require('moment');var logger=require(_0x0083('0x2'))('fax');exports[_0x0083('0x3')]=function(_0x4530e8){return{'message':_0x4530e8};};exports[_0x0083('0x4')]=function(_0x487be8,_0x36248c){logger['info'](_0x487be8,util[_0x0083('0x5')](_0x36248c,{'showHidden':![],'depth':null}));};exports[_0x0083('0x6')]=function(_0x325a7a,_0x6c6d03){var _0x58db2f={'XMF-ECM':_0x6c6d03[_0x0083('0x7')],'XMF-HEADERINFO':_0x6c6d03[_0x0083('0x8')],'XMF-MINRATE':_0x6c6d03[_0x0083('0x9')],'XMF-MAXRATE':_0x6c6d03['maxrate'],'XMF-MODEM':util[_0x0083('0xa')](_0x0083('0xb'),_0x6c6d03[_0x0083('0xc')]),'XMF-GATEWAY':_0x6c6d03[_0x0083('0xd')],'XMF-FAXDETECT':_0x6c6d03[_0x0083('0xe')],'XMF-T38TIMEOUT':_0x6c6d03[_0x0083('0xf')],'XMF-LOCALSTATIONID':_0x6c6d03['localstationid'],'XMF-PATH':_0x325a7a[_0x0083('0x10')]};return _0x58db2f;};exports[_0x0083('0x11')]=function(_0x15f21e,_0x129646){return{'actionid':_0x15f21e[_0x0083('0x12')],'action':_0x0083('0x13'),'channel':_0x15f21e[_0x0083('0x14')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x0083('0xa')](_0x0083('0x15'),_0x15f21e[_0x0083('0x8')]?_0x15f21e['headerinfo']:'',_0x15f21e['localstationid']),'variable':_0x129646,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x15f21e[_0x0083('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6f60788..500a4a4 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 _0xa2a8=['./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initCampaigns','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','listen','sync','[index.js][main]','moment','./server'];(function(_0x426c9c,_0x2304a2){var _0x3c84b7=function(_0x746c93){while(--_0x746c93){_0x426c9c['push'](_0x426c9c['shift']());}};_0x3c84b7(++_0x2304a2);}(_0xa2a8,0x84));var _0x8a2a=function(_0x56184d,_0x46f246){_0x56184d=_0x56184d-0x0;var _0x4dc838=_0xa2a8[_0x56184d];return _0x4dc838;};'use strict';var util=require('util');var moment=require(_0x8a2a('0x0'));var server=require(_0x8a2a('0x1'));var Realtime=require(_0x8a2a('0x2'));var Report=require(_0x8a2a('0x3'));var Acw=require(_0x8a2a('0x4'));var Trigger=require(_0x8a2a('0x5'));var Dialer=require(_0x8a2a('0x6'));var Preview=require(_0x8a2a('0x7'));var Fax=require(_0x8a2a('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x8a2a('0x9'));var voiceQueueReport=require(_0x8a2a('0xa'));var voiceCallReport=require(_0x8a2a('0xb'));var trunk=require(_0x8a2a('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x8a2a('0xd'));var cmHopperHistory=require(_0x8a2a('0xe'));var campaign=require(_0x8a2a('0xf'));var voiceExtension=require(_0x8a2a('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x8a2a('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8a2a('0x12'));var desk=require(_0x8a2a('0x13'));var zoho=require(_0x8a2a('0x14'));var vtiger=require(_0x8a2a('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x8a2a('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x8a2a('0x17'))(_0x8a2a('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8a2a('0x19')](_0x8a2a('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8a2a('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x8a2a('0x1b')]()[_0x8a2a('0x1c')](user[_0x8a2a('0x1d')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x1e')]())[_0x8a2a('0x1c')](user[_0x8a2a('0x1f')]())['then'](realtime['initTelephones']())[_0x8a2a('0x1c')](trunk[_0x8a2a('0x20')]())[_0x8a2a('0x1c')](realtime['initTrunks']())[_0x8a2a('0x1c')](voiceQueue[_0x8a2a('0x21')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x22')]())[_0x8a2a('0x1c')](trigger[_0x8a2a('0x23')]())['then'](realtime[_0x8a2a('0x24')]())[_0x8a2a('0x1c')](template[_0x8a2a('0x25')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x26')]())[_0x8a2a('0x1c')](zendesk[_0x8a2a('0x27')]())[_0x8a2a('0x1c')](realtime['initZendeskAccounts']())[_0x8a2a('0x1c')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x8a2a('0x28')]())[_0x8a2a('0x1c')](sugarcrm[_0x8a2a('0x29')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x2a')]())[_0x8a2a('0x1c')](freshdesk[_0x8a2a('0x2b')]())[_0x8a2a('0x1c')](realtime['initFreshdeskAccounts']())[_0x8a2a('0x1c')](desk['getDeskAccounts']())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x2c')]())[_0x8a2a('0x1c')](zoho[_0x8a2a('0x2d')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x2e')]())['then'](vtiger[_0x8a2a('0x2f')]())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0x8a2a('0x30')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x31')]())[_0x8a2a('0x1c')](servicenow[_0x8a2a('0x32')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x33')]())[_0x8a2a('0x1c')](dynamics365['getDynamics365Accounts']())[_0x8a2a('0x1c')](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())['then'](realtime[_0x8a2a('0x34')]())[_0x8a2a('0x1c')](voiceExtension['getVoiceExtensions']())[_0x8a2a('0x1c')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x35')]())[_0x8a2a('0x1c')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x8a2a('0x1c')](voiceQueueReport[_0x8a2a('0x36')]())['then'](realtime[_0x8a2a('0x37')]())[_0x8a2a('0x1c')](cmHopperHistory[_0x8a2a('0x38')]())['then'](realtime[_0x8a2a('0x39')]())[_0x8a2a('0x1c')](cmHopperHistory[_0x8a2a('0x3a')]())['then'](realtime[_0x8a2a('0x3b')]())[_0x8a2a('0x1c')](voiceCallReport[_0x8a2a('0x3c')]())[_0x8a2a('0x1c')](realtime[_0x8a2a('0x3d')]())['catch'](function(_0x25fe9d){logger[_0x8a2a('0x3e')]('[index.js][initParams]',util[_0x8a2a('0x3f')](_0x25fe9d,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8a2a('0x40')](realtime,preview,fax)[_0x8a2a('0x1c')](function(){return initRealtime();})[_0x8a2a('0x1c')](function(){return initParams();})[_0x8a2a('0x1c')](function(){report[_0x8a2a('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1d5cc0){logger[_0x8a2a('0x3e')](_0x8a2a('0x42'),util[_0x8a2a('0x3f')](_0x1d5cc0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x85b3=['getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./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/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x3da9e9,_0x594346){var _0x1a3aee=function(_0x4d0771){while(--_0x4d0771){_0x3da9e9['push'](_0x3da9e9['shift']());}};_0x1a3aee(++_0x594346);}(_0x85b3,0xe9));var _0x385b=function(_0x3b8ec4,_0x483b74){_0x3b8ec4=_0x3b8ec4-0x0;var _0x28b9f7=_0x85b3[_0x3b8ec4];return _0x28b9f7;};'use strict';var util=require(_0x385b('0x0'));var moment=require(_0x385b('0x1'));var server=require(_0x385b('0x2'));var Realtime=require(_0x385b('0x3'));var Report=require(_0x385b('0x4'));var Acw=require(_0x385b('0x5'));var Trigger=require(_0x385b('0x6'));var Dialer=require(_0x385b('0x7'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x385b('0x8'));var voiceQueue=require(_0x385b('0x9'));var voiceQueueReport=require(_0x385b('0xa'));var voiceCallReport=require(_0x385b('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x385b('0xc'));var cmHopperHistory=require(_0x385b('0xd'));var campaign=require(_0x385b('0xe'));var voiceExtension=require(_0x385b('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x385b('0x10'));var salesforce=require(_0x385b('0x11'));var sugarcrm=require(_0x385b('0x12'));var freshdesk=require(_0x385b('0x13'));var desk=require(_0x385b('0x14'));var zoho=require(_0x385b('0x15'));var vtiger=require(_0x385b('0x16'));var freshsales=require(_0x385b('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x385b('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x385b('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x385b('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x385b('0x1a')](_0x385b('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x385b('0x1c')]()[_0x385b('0x1d')](user[_0x385b('0x1e')]())[_0x385b('0x1d')](realtime[_0x385b('0x1f')]())['then'](user['getTelephones']())[_0x385b('0x1d')](realtime['initTelephones']())[_0x385b('0x1d')](trunk[_0x385b('0x20')]())[_0x385b('0x1d')](realtime['initTrunks']())[_0x385b('0x1d')](voiceQueue[_0x385b('0x21')]())['then'](realtime[_0x385b('0x22')]())['then'](trigger[_0x385b('0x23')]())[_0x385b('0x1d')](realtime[_0x385b('0x24')]())[_0x385b('0x1d')](template[_0x385b('0x25')]())[_0x385b('0x1d')](realtime['initTemplates']())[_0x385b('0x1d')](zendesk[_0x385b('0x26')]())[_0x385b('0x1d')](realtime['initZendeskAccounts']())['then'](salesforce[_0x385b('0x27')]())[_0x385b('0x1d')](realtime[_0x385b('0x28')]())[_0x385b('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x385b('0x1d')](realtime[_0x385b('0x29')]())[_0x385b('0x1d')](freshdesk[_0x385b('0x2a')]())['then'](realtime['initFreshdeskAccounts']())[_0x385b('0x1d')](desk[_0x385b('0x2b')]())[_0x385b('0x1d')](realtime[_0x385b('0x2c')]())[_0x385b('0x1d')](zoho['getZohoAccounts']())[_0x385b('0x1d')](realtime[_0x385b('0x2d')]())['then'](vtiger[_0x385b('0x2e')]())[_0x385b('0x1d')](realtime[_0x385b('0x2f')]())['then'](freshsales[_0x385b('0x30')]())[_0x385b('0x1d')](realtime[_0x385b('0x31')]())[_0x385b('0x1d')](servicenow[_0x385b('0x32')]())['then'](realtime['initServicenowAccounts']())[_0x385b('0x1d')](dynamics365[_0x385b('0x33')]())[_0x385b('0x1d')](realtime['initDynamics365Accounts']())['then'](campaign[_0x385b('0x34')]())[_0x385b('0x1d')](realtime['initCampaigns']())[_0x385b('0x1d')](voiceExtension[_0x385b('0x35')]())[_0x385b('0x1d')](realtime[_0x385b('0x36')]())[_0x385b('0x1d')](faxAccount['getFaxAccounts']())[_0x385b('0x1d')](realtime[_0x385b('0x37')]())[_0x385b('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x385b('0x1c')]()['then'](voiceQueueReport[_0x385b('0x38')]())[_0x385b('0x1d')](realtime[_0x385b('0x39')]())[_0x385b('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x385b('0x1d')](realtime[_0x385b('0x3a')]())[_0x385b('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x385b('0x1d')](realtime[_0x385b('0x3b')]())[_0x385b('0x1d')](voiceCallReport[_0x385b('0x3c')]())['then'](realtime[_0x385b('0x3d')]())[_0x385b('0x3e')](function(_0x29a319){logger[_0x385b('0x3f')](_0x385b('0x40'),util[_0x385b('0x41')](_0x29a319,{'showHidden':![],'depth':null}));});}function main(){return server[_0x385b('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x385b('0x1d')](function(){return initParams();})[_0x385b('0x1d')](function(){report[_0x385b('0x43')]();setInterval(initRealtime,0x1388);})[_0x385b('0x3e')](function(_0x19fcb1){logger[_0x385b('0x3f')](_0x385b('0x44'),util['inspect'](_0x19fcb1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6a2e77f..cdfb01d 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 _0x192a=['voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','toLowerCase','not_inuse','idle','talking','statePause','toNumber','format','status','stringify','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','accountcode','fullname','state','stateTime','unknown','address','phone','mobile','interface','online','voiceStatus'];(function(_0x4aa915,_0x11e94a){var _0x5254e9=function(_0x3db6f4){while(--_0x3db6f4){_0x4aa915['push'](_0x4aa915['shift']());}};_0x5254e9(++_0x11e94a);}(_0x192a,0x17b));var _0xa192=function(_0x26ace9,_0x1beb6e){_0x26ace9=_0x26ace9-0x0;var _0x5c9697=_0x192a[_0x26ace9];return _0x5c9697;};'use strict';var _=require(_0xa192('0x0'));var util=require(_0xa192('0x1'));var moment=require(_0xa192('0x2'));var md5=require(_0xa192('0x3'));var Redis=require('ioredis');var config=require(_0xa192('0x4'));config[_0xa192('0x5')]=_[_0xa192('0x6')](config[_0xa192('0x5')],{'host':_0xa192('0x7'),'port':0x18eb});var io=require(_0xa192('0x8'))(new Redis(config[_0xa192('0x5')]));function Agent(_0x4e8ccf){this['id']=_0x4e8ccf['id']||0x0;this[_0xa192('0x9')]=_0x4e8ccf[_0xa192('0x9')]||'';this['email']=_0x4e8ccf['email']||'';this[_0xa192('0xa')]=_0x4e8ccf[_0xa192('0xa')]||'';this[_0xa192('0xb')]=_0x4e8ccf[_0xa192('0xb')]||'';this[_0xa192('0xc')]='unknown';this[_0xa192('0xd')]=0x0;this['status']=_0xa192('0xe');this[_0xa192('0xf')]='';this[_0xa192('0x10')]='';this[_0xa192('0x11')]='';this[_0xa192('0x12')]='';this[_0xa192('0x13')]=_0x4e8ccf[_0xa192('0x13')]||![];this[_0xa192('0x14')]='unknown';this[_0xa192('0x15')]=0x0;this[_0xa192('0x16')]='';this[_0xa192('0x17')]='';this[_0xa192('0x18')]=![];this[_0xa192('0x19')]=![];this[_0xa192('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0xe830bc){var _0x4aa04e;if(_0xe830bc&&_0xe830bc[_0xa192('0xc')]){_0x4aa04e=_0xe830bc[_0xa192('0xc')][_0xa192('0x1a')]();switch(_0x4aa04e){case _0xa192('0x1b'):_0x4aa04e=_0xa192('0x1c');break;case'inuse':_0x4aa04e=_0xa192('0x1d');break;}}if(_0x4aa04e&&this['voiceStatus']!==_0x4aa04e||_0xe830bc[_0xa192('0x1e')]){this[_0xa192('0x15')]=_[_0xa192('0x1f')](moment()[_0xa192('0x20')]('x'));}if(_0x4aa04e){this['voiceStatus']=_0x4aa04e;}var _0x251ed1={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0xa192('0xc')],'stateTime':this[_0xa192('0xd')],'status':this[_0xa192('0x21')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0xa192('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xa192('0x17')],'interface':this['interface'],'onhold':this[_0xa192('0x18')]};var _0x264b1c=md5(JSON[_0xa192('0x22')](_0x251ed1));if(this[_0xa192('0x3')]!==_0x264b1c){this[_0xa192('0x3')]=_0x264b1c;io['to'](util[_0xa192('0x20')](_0xa192('0x23'),_0x251ed1[_0xa192('0x9')]))[_0xa192('0x24')](_0xa192('0x25'),_['omit'](_0x251ed1,[_0xa192('0x13')]));io[_0xa192('0x24')](_0xa192('0x26'),_0x251ed1);}};module[_0xa192('0x27')]=Agent; \ No newline at end of file +var _0x9a59=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','online','onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','voiceStatusTime','format','voiceStatusCallerIdNumber','voiceStatusQueue','interface','stringify','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','ioredis'];(function(_0x27faf7,_0x203c55){var _0xc69b2d=function(_0x5acecf){while(--_0x5acecf){_0x27faf7['push'](_0x27faf7['shift']());}};_0xc69b2d(++_0x203c55);}(_0x9a59,0x9c));var _0x99a5=function(_0x34e97a,_0x14c75e){_0x34e97a=_0x34e97a-0x0;var _0x407057=_0x9a59[_0x34e97a];return _0x407057;};'use strict';var _=require(_0x99a5('0x0'));var util=require(_0x99a5('0x1'));var moment=require(_0x99a5('0x2'));var md5=require('md5');var Redis=require(_0x99a5('0x3'));var config=require(_0x99a5('0x4'));config[_0x99a5('0x5')]=_[_0x99a5('0x6')](config[_0x99a5('0x5')],{'host':_0x99a5('0x7'),'port':0x18eb});var io=require(_0x99a5('0x8'))(new Redis(config[_0x99a5('0x5')]));function Agent(_0x5a46cc){this['id']=_0x5a46cc['id']||0x0;this[_0x99a5('0x9')]=_0x5a46cc[_0x99a5('0x9')]||'';this['email']=_0x5a46cc['email']||'';this[_0x99a5('0xa')]=_0x5a46cc[_0x99a5('0xa')]||'';this[_0x99a5('0xb')]=_0x5a46cc[_0x99a5('0xb')]||'';this[_0x99a5('0xc')]='unknown';this[_0x99a5('0xd')]=0x0;this[_0x99a5('0xe')]=_0x99a5('0xf');this[_0x99a5('0x10')]='';this[_0x99a5('0x11')]='';this[_0x99a5('0x12')]='';this['interface']='';this['online']=_0x5a46cc[_0x99a5('0x13')]||![];this['voiceStatus']='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x99a5('0x14')]=![];this['local']=![];this[_0x99a5('0x15')]='';}Agent[_0x99a5('0x16')][_0x99a5('0x17')]=function(_0x20a4c6){var _0x1db7b0;if(_0x20a4c6&&_0x20a4c6[_0x99a5('0xc')]){_0x1db7b0=_0x20a4c6[_0x99a5('0xc')][_0x99a5('0x18')]();switch(_0x1db7b0){case _0x99a5('0x19'):_0x1db7b0='idle';break;case _0x99a5('0x1a'):_0x1db7b0=_0x99a5('0x1b');break;}}if(_0x1db7b0&&this[_0x99a5('0x1c')]!==_0x1db7b0||_0x20a4c6['statePause']){this[_0x99a5('0x1d')]=_['toNumber'](moment()[_0x99a5('0x1e')]('x'));}if(_0x1db7b0){this['voiceStatus']=_0x1db7b0;}var _0x2c9d65={'id':this['id'],'name':this[_0x99a5('0x9')],'email':this['email'],'accountcode':this[_0x99a5('0xa')],'fullname':this['fullname'],'state':this[_0x99a5('0xc')],'stateTime':this[_0x99a5('0xd')],'status':this[_0x99a5('0xe')],'address':this[_0x99a5('0x10')],'online':this[_0x99a5('0x13')],'voiceStatus':this[_0x99a5('0x1c')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x99a5('0x1f')],'voiceStatusQueue':this[_0x99a5('0x20')],'interface':this[_0x99a5('0x21')],'onhold':this[_0x99a5('0x14')]};var _0x6a6e03=md5(JSON[_0x99a5('0x22')](_0x2c9d65));if(this[_0x99a5('0x15')]!==_0x6a6e03){this[_0x99a5('0x15')]=_0x6a6e03;io['to'](util[_0x99a5('0x1e')]('user:%s',_0x2c9d65[_0x99a5('0x9')]))[_0x99a5('0x23')](_0x99a5('0x24'),_[_0x99a5('0x25')](_0x2c9d65,['online']));io[_0x99a5('0x23')](_0x99a5('0x26'),_0x2c9d65);}};module[_0x99a5('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 595739d..d22feff 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 _0xe84f=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x115bf5,_0x3450d9){var _0x33b98e=function(_0x42056e){while(--_0x42056e){_0x115bf5['push'](_0x115bf5['shift']());}};_0x33b98e(++_0x3450d9);}(_0xe84f,0x7b));var _0xfe84=function(_0x19539f,_0x5208b6){_0x19539f=_0x19539f-0x0;var _0x1cecd0=_0xe84f[_0x19539f];return _0x1cecd0;};'use strict';function Campaign(_0x569a2b){this['id']=_0x569a2b['id']||0x0;this['name']=_0x569a2b[_0xfe84('0x0')]||'';this[_0xfe84('0x1')]=_0x569a2b[_0xfe84('0x1')]||_0xfe84('0x2');this['originated']=0x0;this[_0xfe84('0x3')]=0x0;this[_0xfe84('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xfe84('0x5')]=!![];this['active']=_0x569a2b[_0xfe84('0x6')];this[_0xfe84('0x7')]=_0x569a2b[_0xfe84('0x7')];this[_0xfe84('0x8')]=_0x569a2b['dialTimezone']||null;this['dialGlobalInterval']=_0x569a2b['dialGlobalInterval']?_0x569a2b[_0xfe84('0x9')]:null;this['dialOriginateCallerIdName']=_0x569a2b[_0xfe84('0xa')];this['dialOriginateCallerIdNumber']=_0x569a2b[_0xfe84('0xb')];this[_0xfe84('0xc')]=_0x569a2b[_0xfe84('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x569a2b['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x569a2b['dialCongestionRetryFrequency'];this[_0xfe84('0xd')]=_0x569a2b['dialBusyMaxRetry'];this[_0xfe84('0xe')]=_0x569a2b[_0xfe84('0xe')];this['dialNoAnswerMaxRetry']=_0x569a2b['dialNoAnswerMaxRetry'];this[_0xfe84('0xf')]=_0x569a2b['dialNoAnswerRetryFrequency'];this[_0xfe84('0x10')]=_0x569a2b[_0xfe84('0x10')];this['dialNoSuchNumberMaxRetry']=_0x569a2b[_0xfe84('0x11')]||0x3;this[_0xfe84('0x12')]=_0x569a2b['dialNoSuchNumberRetryFrequency']||0x96;this[_0xfe84('0x13')]=_0x569a2b['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x569a2b['dialDropRetryFrequency']||0x96;this[_0xfe84('0x14')]=_0x569a2b[_0xfe84('0x14')]||0x3;this['dialAbandonedRetryFrequency']=_0x569a2b[_0xfe84('0x15')]||0x96;this[_0xfe84('0x16')]=_0x569a2b[_0xfe84('0x16')]||0x3;this[_0xfe84('0x17')]=_0x569a2b[_0xfe84('0x17')]||0x96;this[_0xfe84('0x18')]=_0x569a2b[_0xfe84('0x18')]||0x3;this[_0xfe84('0x19')]=_0x569a2b[_0xfe84('0x19')]||0x96;this[_0xfe84('0x1a')]=_0x569a2b[_0xfe84('0x1a')]||_0xfe84('0x1b');this[_0xfe84('0x1c')]=_0x569a2b[_0xfe84('0x1c')]||undefined;this[_0xfe84('0x1d')]=_0x569a2b[_0xfe84('0x1d')]||undefined;this['dialCutDigit']=_0x569a2b[_0xfe84('0x1e')]||undefined;this['TrunkBackup']=_0x569a2b['TrunkBackup']?_0x569a2b[_0xfe84('0x1f')]:undefined;this[_0xfe84('0x20')]=_0x569a2b[_0xfe84('0x20')]?_0x569a2b[_0xfe84('0x20')]:undefined;this[_0xfe84('0x21')]=_0x569a2b[_0xfe84('0x21')]?_0x569a2b['Interval']:undefined;this['SquareProject']=_0x569a2b[_0xfe84('0x22')]?_0x569a2b[_0xfe84('0x22')]:undefined;this[_0xfe84('0x23')]=_0x569a2b[_0xfe84('0x22')]?_0x569a2b['SquareProject'][_0xfe84('0x0')]:undefined;this['dialAMDActive']=_0x569a2b[_0xfe84('0x24')]||![];this[_0xfe84('0x25')]=_0x569a2b[_0xfe84('0x25')];this[_0xfe84('0x26')]=_0x569a2b['dialAMDGreeting'];this[_0xfe84('0x27')]=_0x569a2b[_0xfe84('0x27')];this[_0xfe84('0x28')]=_0x569a2b['dialAMDTotalAnalysisTime'];this[_0xfe84('0x29')]=_0x569a2b[_0xfe84('0x29')];this[_0xfe84('0x2a')]=_0x569a2b[_0xfe84('0x2a')];this[_0xfe84('0x2b')]=_0x569a2b['dialAMDMaximumNumberOfWords'];this[_0xfe84('0x2c')]=_0x569a2b[_0xfe84('0x2c')];this[_0xfe84('0x2d')]=_0x569a2b[_0xfe84('0x2d')];}module[_0xfe84('0x2e')]=Campaign; \ No newline at end of file +var _0xa26f=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','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','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0xa26f,0x131));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x308a5f){this['id']=_0x308a5f['id']||0x0;this[_0xfa26('0x0')]=_0x308a5f['name']||'';this[_0xfa26('0x1')]=_0x308a5f[_0xfa26('0x1')]||_0xfa26('0x2');this[_0xfa26('0x3')]=0x0;this['temp']=0x0;this[_0xfa26('0x4')]=0x0;this[_0xfa26('0x5')]=0x0;this[_0xfa26('0x6')]='';this[_0xfa26('0x7')]=!![];this['active']=_0x308a5f[_0xfa26('0x8')];this[_0xfa26('0x9')]=_0x308a5f[_0xfa26('0x9')];this[_0xfa26('0xa')]=_0x308a5f[_0xfa26('0xa')]||null;this[_0xfa26('0xb')]=_0x308a5f[_0xfa26('0xb')]?_0x308a5f[_0xfa26('0xb')]:null;this[_0xfa26('0xc')]=_0x308a5f['dialOriginateCallerIdName'];this[_0xfa26('0xd')]=_0x308a5f[_0xfa26('0xd')];this[_0xfa26('0xe')]=_0x308a5f[_0xfa26('0xe')]||0x1e;this[_0xfa26('0xf')]=_0x308a5f[_0xfa26('0xf')];this[_0xfa26('0x10')]=_0x308a5f['dialCongestionRetryFrequency'];this[_0xfa26('0x11')]=_0x308a5f[_0xfa26('0x11')];this[_0xfa26('0x12')]=_0x308a5f[_0xfa26('0x12')];this[_0xfa26('0x13')]=_0x308a5f[_0xfa26('0x13')];this[_0xfa26('0x14')]=_0x308a5f['dialNoAnswerRetryFrequency'];this[_0xfa26('0x15')]=_0x308a5f[_0xfa26('0x15')];this[_0xfa26('0x16')]=_0x308a5f[_0xfa26('0x16')]||0x3;this[_0xfa26('0x17')]=_0x308a5f[_0xfa26('0x17')]||0x96;this[_0xfa26('0x18')]=_0x308a5f['dialDropMaxRetry']||0x3;this[_0xfa26('0x19')]=_0x308a5f[_0xfa26('0x19')]||0x96;this[_0xfa26('0x1a')]=_0x308a5f[_0xfa26('0x1a')]||0x3;this[_0xfa26('0x1b')]=_0x308a5f[_0xfa26('0x1b')]||0x96;this[_0xfa26('0x1c')]=_0x308a5f[_0xfa26('0x1c')]||0x3;this[_0xfa26('0x1d')]=_0x308a5f[_0xfa26('0x1d')]||0x96;this[_0xfa26('0x1e')]=_0x308a5f[_0xfa26('0x1e')]||0x3;this[_0xfa26('0x1f')]=_0x308a5f[_0xfa26('0x1f')]||0x96;this[_0xfa26('0x20')]=_0x308a5f['dialOrderByScheduledAt']||_0xfa26('0x21');this[_0xfa26('0x22')]=_0x308a5f[_0xfa26('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x308a5f[_0xfa26('0x23')]||undefined;this['dialCutDigit']=_0x308a5f['dialCutDigit']||undefined;this[_0xfa26('0x24')]=_0x308a5f['TrunkBackup']?_0x308a5f[_0xfa26('0x24')]:undefined;this[_0xfa26('0x25')]=_0x308a5f[_0xfa26('0x25')]?_0x308a5f['Trunk']:undefined;this[_0xfa26('0x26')]=_0x308a5f[_0xfa26('0x26')]?_0x308a5f[_0xfa26('0x26')]:undefined;this['SquareProject']=_0x308a5f[_0xfa26('0x27')]?_0x308a5f[_0xfa26('0x27')]:undefined;this[_0xfa26('0x28')]=_0x308a5f['SquareProject']?_0x308a5f[_0xfa26('0x27')][_0xfa26('0x0')]:undefined;this['dialAMDActive']=_0x308a5f[_0xfa26('0x29')]||![];this[_0xfa26('0x2a')]=_0x308a5f[_0xfa26('0x2a')];this[_0xfa26('0x2b')]=_0x308a5f['dialAMDGreeting'];this[_0xfa26('0x2c')]=_0x308a5f['dialAMDAfterGreetingSilence'];this[_0xfa26('0x2d')]=_0x308a5f[_0xfa26('0x2d')];this[_0xfa26('0x2e')]=_0x308a5f[_0xfa26('0x2e')];this[_0xfa26('0x2f')]=_0x308a5f[_0xfa26('0x2f')];this[_0xfa26('0x30')]=_0x308a5f[_0xfa26('0x30')];this[_0xfa26('0x31')]=_0x308a5f[_0xfa26('0x31')];this['dialAMDMaximumWordLength']=_0x308a5f[_0xfa26('0x32')];}module[_0xfa26('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 71c41fb..044282c 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 _0xb8de=['linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','type','tag','disposition','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid'];(function(_0x237150,_0x5e4d95){var _0x1bb42f=function(_0x35402e){while(--_0x35402e){_0x237150['push'](_0x237150['shift']());}};_0x1bb42f(++_0x5e4d95);}(_0xb8de,0x152));var _0xeb8d=function(_0x16e0e7,_0x17dd5e){_0x16e0e7=_0x16e0e7-0x0;var _0x53164e=_0xb8de[_0x16e0e7];return _0x53164e;};'use strict';function Channel(){this[_0xeb8d('0x0')]=null;this[_0xeb8d('0x1')]='';this[_0xeb8d('0x2')]='';this[_0xeb8d('0x3')]=0x0;this[_0xeb8d('0x4')]='';this[_0xeb8d('0x5')]=undefined;this[_0xeb8d('0x6')]=undefined;this[_0xeb8d('0x7')]=0x0;this[_0xeb8d('0x8')]='';this[_0xeb8d('0x9')]=0x0;this[_0xeb8d('0xa')]=0x0;this[_0xeb8d('0xb')]=0x0;this[_0xeb8d('0xc')]=![];this[_0xeb8d('0xd')]=null;this[_0xeb8d('0xe')]=null;this[_0xeb8d('0xf')]=![];this[_0xeb8d('0x10')]=![];this[_0xeb8d('0x11')]='';this[_0xeb8d('0x12')]='';this[_0xeb8d('0x13')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xeb8d('0x14')]=null;this[_0xeb8d('0x15')]=null;this[_0xeb8d('0x16')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xeb8d('0x17')]=null;this[_0xeb8d('0x18')]=[];this['transfercalleridnum']=undefined;this[_0xeb8d('0x19')]=undefined;this[_0xeb8d('0x1a')]=undefined;this[_0xeb8d('0x1b')]=0x0;}module[_0xeb8d('0x1c')]=Channel; \ No newline at end of file +var _0x0699=['endtime','unmanaged','abandoned','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime'];(function(_0x439b36,_0x5d6d64){var _0x5b7ace=function(_0x5e657c){while(--_0x5e657c){_0x439b36['push'](_0x439b36['shift']());}};_0x5b7ace(++_0x5d6d64);}(_0x0699,0x1db));var _0x9069=function(_0x45b329,_0x3dca4f){_0x45b329=_0x45b329-0x0;var _0x320361=_0x0699[_0x45b329];return _0x320361;};'use strict';function Channel(){this[_0x9069('0x0')]=null;this['channel']='';this[_0x9069('0x1')]='';this['calleridnum']=0x0;this[_0x9069('0x2')]='';this[_0x9069('0x3')]=undefined;this[_0x9069('0x4')]=undefined;this[_0x9069('0x5')]=0x0;this['context']='';this[_0x9069('0x6')]=0x0;this[_0x9069('0x7')]=0x0;this[_0x9069('0x8')]=0x0;this[_0x9069('0x9')]=![];this[_0x9069('0xa')]=null;this[_0x9069('0xb')]=null;this[_0x9069('0xc')]=![];this[_0x9069('0xd')]=![];this['lastapplication']='';this['lastdata']='';this[_0x9069('0xe')]=0x0;this[_0x9069('0xf')]=0x0;this[_0x9069('0x10')]=0x0;this[_0x9069('0x11')]=null;this['tag']=null;this[_0x9069('0x12')]=null;this[_0x9069('0x13')]=![];this[_0x9069('0x14')]=null;this[_0x9069('0x15')]=null;this[_0x9069('0x16')]=[];this[_0x9069('0x17')]=undefined;this[_0x9069('0x18')]=undefined;this[_0x9069('0x19')]=undefined;this[_0x9069('0x1a')]=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 d924548..63505b7 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 _0xe2cd=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0xdbf77b,_0xc83a7c){var _0x7af774=function(_0x5e4d3a){while(--_0x5e4d3a){_0xdbf77b['push'](_0xdbf77b['shift']());}};_0x7af774(++_0xc83a7c);}(_0xe2cd,0xa0));var _0xde2c=function(_0x1bf654,_0x13632f){_0x1bf654=_0x1bf654-0x0;var _0x3f83a8=_0xe2cd[_0x1bf654];return _0x3f83a8;};'use strict';function DeskAccount(_0x356c52){this['id']=_0x356c52['id']||0x0;this[_0xde2c('0x0')]=_0x356c52[_0xde2c('0x0')]||'';this[_0xde2c('0x1')]=_0x356c52[_0xde2c('0x1')]||'';this[_0xde2c('0x2')]=_0x356c52[_0xde2c('0x2')]||'';this[_0xde2c('0x3')]=_0x356c52[_0xde2c('0x3')]||'';this['password']=_0x356c52[_0xde2c('0x4')]||'';this['consumerKey']=_0x356c52[_0xde2c('0x5')]||'';this[_0xde2c('0x6')]=_0x356c52[_0xde2c('0x6')]||'';this[_0xde2c('0x7')]=_0x356c52[_0xde2c('0x7')]||'';this['tokenSecret']=_0x356c52[_0xde2c('0x8')]||'';this[_0xde2c('0x9')]=_0x356c52[_0xde2c('0x9')]||'';this[_0xde2c('0xa')]=_0x356c52[_0xde2c('0xa')]||'';this[_0xde2c('0xb')]=_0x356c52[_0xde2c('0xb')]||{};}module[_0xde2c('0xc')]=DeskAccount; \ No newline at end of file +var _0x00ca=['tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x00ca,0xa1));var _0xa00c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x00ca[_0x3947c9];return _0x2e7871;};'use strict';function DeskAccount(_0x30c5ee){this['id']=_0x30c5ee['id']||0x0;this[_0xa00c('0x0')]=_0x30c5ee[_0xa00c('0x0')]||'';this['username']=_0x30c5ee['username']||'';this[_0xa00c('0x1')]=_0x30c5ee[_0xa00c('0x1')]||'';this[_0xa00c('0x2')]=_0x30c5ee[_0xa00c('0x2')]||'';this[_0xa00c('0x3')]=_0x30c5ee['password']||'';this['consumerKey']=_0x30c5ee[_0xa00c('0x4')]||'';this['consumerSecret']=_0x30c5ee[_0xa00c('0x5')]||'';this['token']=_0x30c5ee[_0xa00c('0x6')]||'';this['tokenSecret']=_0x30c5ee[_0xa00c('0x7')]||'';this[_0xa00c('0x8')]=_0x30c5ee[_0xa00c('0x8')]||'';this[_0xa00c('0x9')]=_0x30c5ee[_0xa00c('0x9')]||'';this[_0xa00c('0xa')]=_0x30c5ee[_0xa00c('0xa')]||{};}module[_0xa00c('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 5558c91..60c0138 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 _0x5392=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x358bd1,_0x139ccf){var _0x40bdbb=function(_0x3069e7){while(--_0x3069e7){_0x358bd1['push'](_0x358bd1['shift']());}};_0x40bdbb(++_0x139ccf);}(_0x5392,0x10d));var _0x2539=function(_0x580d3a,_0x59762f){_0x580d3a=_0x580d3a-0x0;var _0x12210f=_0x5392[_0x580d3a];return _0x12210f;};'use strict';function Dynamics365Account(_0x3c4661){this['id']=_0x3c4661['id']||0x0;this['name']=_0x3c4661[_0x2539('0x0')]||'';this[_0x2539('0x1')]=_0x3c4661[_0x2539('0x1')]||'';this[_0x2539('0x2')]=_0x3c4661[_0x2539('0x2')]||'';this[_0x2539('0x3')]=_0x3c4661['remoteUri']||'';this['tenantId']=_0x3c4661[_0x2539('0x4')]||'';this[_0x2539('0x5')]=_0x3c4661[_0x2539('0x5')]||'';this[_0x2539('0x6')]=_0x3c4661['clientSecret']||{};this[_0x2539('0x7')]=_0x3c4661['serverUrl']||'';this[_0x2539('0x8')]=_0x3c4661[_0x2539('0x8')]||![];this[_0x2539('0x9')]=_0x3c4661['Configurations']||{};this[_0x2539('0xa')]=_0x3c4661['CloudProvider']||{};}module[_0x2539('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x24fb=['clientSecret','serverUrl','modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0xf45356,_0x4b231b){var _0x4a609c=function(_0x258d53){while(--_0x258d53){_0xf45356['push'](_0xf45356['shift']());}};_0x4a609c(++_0x4b231b);}(_0x24fb,0x10d));var _0xb24f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24fb[_0xa464c9];return _0x3d73c4;};'use strict';function Dynamics365Account(_0x44943f){this['id']=_0x44943f['id']||0x0;this['name']=_0x44943f[_0xb24f('0x0')]||'';this[_0xb24f('0x1')]=_0x44943f['username']||'';this[_0xb24f('0x2')]=_0x44943f['password']||'';this[_0xb24f('0x3')]=_0x44943f[_0xb24f('0x3')]||'';this[_0xb24f('0x4')]=_0x44943f[_0xb24f('0x4')]||'';this[_0xb24f('0x5')]=_0x44943f[_0xb24f('0x5')]||'';this['clientSecret']=_0x44943f[_0xb24f('0x6')]||{};this['serverUrl']=_0x44943f[_0xb24f('0x7')]||'';this[_0xb24f('0x8')]=_0x44943f[_0xb24f('0x8')]||![];this['Configurations']=_0x44943f[_0xb24f('0x9')]||{};this['CloudProvider']=_0x44943f['CloudProvider']||{};}module[_0xb24f('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ef10a75..f915bdc 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 _0x6608=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29'];(function(_0x4b4b33,_0x58c677){var _0x274e29=function(_0x144d15){while(--_0x144d15){_0x4b4b33['push'](_0x4b4b33['shift']());}};_0x274e29(++_0x58c677);}(_0x6608,0x16e));var _0x8660=function(_0x4c66a4,_0x588f4d){_0x4c66a4=_0x4c66a4-0x0;var _0x43280f=_0x6608[_0x4c66a4];return _0x43280f;};'use strict';function FaxAccount(_0x8d5355){this['id']=_0x8d5355['id']||0x0;this[_0x8660('0x0')]=_0x8d5355[_0x8660('0x0')]||'';this[_0x8660('0x1')]=_0x8d5355[_0x8660('0x1')];this['ecm']=_0x8d5355[_0x8660('0x2')];this[_0x8660('0x3')]=_0x8d5355[_0x8660('0x3')];this['localstationid']=_0x8d5355['localstationid'];this[_0x8660('0x4')]=_0x8d5355['minrate']||0x960;this[_0x8660('0x5')]=_0x8d5355[_0x8660('0x5')]||0x3840;this[_0x8660('0x6')]=_0x8d5355[_0x8660('0x6')]||_0x8660('0x7');this[_0x8660('0x8')]=_0x8d5355[_0x8660('0x8')]||'no';this['faxdetect']=_0x8d5355[_0x8660('0x9')]||'no';this[_0x8660('0xa')]=_0x8d5355[_0x8660('0xa')]||0x1388;this[_0x8660('0xb')]=_0x8d5355[_0x8660('0xb')]||_0x8660('0xc');this[_0x8660('0xd')]=_0x8d5355[_0x8660('0xd')]?_0x8d5355[_0x8660('0xd')]:undefined;this[_0x8660('0xe')]=_0x8d5355[_0x8660('0xe')];this[_0x8660('0xf')]=_0x8d5355[_0x8660('0xf')];}module[_0x8660('0x10')]=FaxAccount; \ No newline at end of file +var _0x591c=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x32f9e6,_0x55ed80){var _0x11a5ea=function(_0x1862ab){while(--_0x1862ab){_0x32f9e6['push'](_0x32f9e6['shift']());}};_0x11a5ea(++_0x55ed80);}(_0x591c,0x141));var _0xc591=function(_0x550326,_0x155be3){_0x550326=_0x550326-0x0;var _0x3c09df=_0x591c[_0x550326];return _0x3c09df;};'use strict';function FaxAccount(_0x112df4){this['id']=_0x112df4['id']||0x0;this['name']=_0x112df4[_0xc591('0x0')]||'';this['description']=_0x112df4[_0xc591('0x1')];this['ecm']=_0x112df4[_0xc591('0x2')];this[_0xc591('0x3')]=_0x112df4['headerinfo'];this[_0xc591('0x4')]=_0x112df4[_0xc591('0x4')];this[_0xc591('0x5')]=_0x112df4['minrate']||0x960;this[_0xc591('0x6')]=_0x112df4[_0xc591('0x6')]||0x3840;this['modem']=_0x112df4[_0xc591('0x7')]||_0xc591('0x8');this[_0xc591('0x9')]=_0x112df4[_0xc591('0x9')]||'no';this[_0xc591('0xa')]=_0x112df4[_0xc591('0xa')]||'no';this[_0xc591('0xb')]=_0x112df4[_0xc591('0xb')]||0x1388;this[_0xc591('0xc')]=_0x112df4['tech']||_0xc591('0xd');this[_0xc591('0xe')]=_0x112df4['Trunk']?_0x112df4['Trunk']:undefined;this[_0xc591('0xf')]=_0x112df4[_0xc591('0xf')];this['key']=_0x112df4[_0xc591('0x10')];}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 946062f..830b291 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 _0x887b=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x155a70,_0x141371){var _0x3819d2=function(_0x274c80){while(--_0x274c80){_0x155a70['push'](_0x155a70['shift']());}};_0x3819d2(++_0x141371);}(_0x887b,0x111));var _0xb887=function(_0x7070f0,_0x285b06){_0x7070f0=_0x7070f0-0x0;var _0xd2e884=_0x887b[_0x7070f0];return _0xd2e884;};'use strict';function FreshdeskAccount(_0x274bcb){this['id']=_0x274bcb['id']||0x0;this[_0xb887('0x0')]=_0x274bcb['name']||'';this[_0xb887('0x1')]=_0x274bcb[_0xb887('0x1')]||'';this[_0xb887('0x2')]=_0x274bcb['token']||'';this[_0xb887('0x3')]=_0x274bcb[_0xb887('0x3')]||'';this['serverUrl']=_0x274bcb[_0xb887('0x4')]||'';this[_0xb887('0x5')]=_0x274bcb[_0xb887('0x5')]||{};}module[_0xb887('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x8bef=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1a8f90,_0x4d8c68){var _0x307707=function(_0x48df41){while(--_0x48df41){_0x1a8f90['push'](_0x1a8f90['shift']());}};_0x307707(++_0x4d8c68);}(_0x8bef,0x72));var _0xf8be=function(_0xbab353,_0x37e159){_0xbab353=_0xbab353-0x0;var _0x56871e=_0x8bef[_0xbab353];return _0x56871e;};'use strict';function FreshdeskAccount(_0x2fa399){this['id']=_0x2fa399['id']||0x0;this[_0xf8be('0x0')]=_0x2fa399['name']||'';this[_0xf8be('0x1')]=_0x2fa399[_0xf8be('0x1')]||'';this[_0xf8be('0x2')]=_0x2fa399[_0xf8be('0x3')]||'';this['remoteUri']=_0x2fa399[_0xf8be('0x4')]||'';this['serverUrl']=_0x2fa399[_0xf8be('0x5')]||'';this['Configurations']=_0x2fa399[_0xf8be('0x6')]||{};}module[_0xf8be('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 2310e99..2a296f5 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 _0xdc97=['remoteUri','serverUrl','Configurations','name','username','token'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x26cbc2,_0x3ea8e1){_0x26cbc2=_0x26cbc2-0x0;var _0x5134fd=_0xdc97[_0x26cbc2];return _0x5134fd;};'use strict';function FreshsalesAccount(_0x3579b7){this['id']=_0x3579b7['id']||0x0;this[_0x7dc9('0x0')]=_0x3579b7[_0x7dc9('0x0')]||'';this['username']=_0x3579b7[_0x7dc9('0x1')]||'';this['apiKey']=_0x3579b7[_0x7dc9('0x2')]||'';this[_0x7dc9('0x3')]=_0x3579b7['remoteUri']||'';this[_0x7dc9('0x4')]=_0x3579b7[_0x7dc9('0x4')]||'';this[_0x7dc9('0x5')]=_0x3579b7[_0x7dc9('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xfc46=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x1b889c,_0x54d817){var _0x326180=function(_0x3cdd5c){while(--_0x3cdd5c){_0x1b889c['push'](_0x1b889c['shift']());}};_0x326180(++_0x54d817);}(_0xfc46,0x9a));var _0x6fc4=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xfc46[_0x5c2c7c];return _0xea7ffe;};'use strict';function FreshsalesAccount(_0x9cd497){this['id']=_0x9cd497['id']||0x0;this['name']=_0x9cd497[_0x6fc4('0x0')]||'';this[_0x6fc4('0x1')]=_0x9cd497[_0x6fc4('0x1')]||'';this['apiKey']=_0x9cd497[_0x6fc4('0x2')]||'';this[_0x6fc4('0x3')]=_0x9cd497[_0x6fc4('0x3')]||'';this[_0x6fc4('0x4')]=_0x9cd497['serverUrl']||'';this[_0x6fc4('0x5')]=_0x9cd497[_0x6fc4('0x5')]||{};}module[_0x6fc4('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8351279..811ed79 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 _0x32b6=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','holdtime','lastAssignedTo','routealias','variables','exports','type','inbound','uniqueid','calleridname','queue'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x32b6,0x10f));var _0x632b=function(_0x465b9d,_0xae2617){_0x465b9d=_0x465b9d-0x0;var _0x4512f7=_0x32b6[_0x465b9d];return _0x4512f7;};'use strict';function QueueReport(){this[_0x632b('0x0')]=_0x632b('0x1');this[_0x632b('0x2')]='';this['calleridnum']='';this[_0x632b('0x3')]='';this[_0x632b('0x4')]='';this['queuecallerjoinAt']=null;this[_0x632b('0x5')]=null;this[_0x632b('0x6')]=0x1;this[_0x632b('0x7')]=0x1;this[_0x632b('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x632b('0x9')]=![];this[_0x632b('0xa')]=null;this[_0x632b('0xb')]=![];this[_0x632b('0xc')]=null;this[_0x632b('0xd')]=0x1;this[_0x632b('0xe')]='';this[_0x632b('0xf')]='';this['connectedlinename']='';this['accountcode']='';this[_0x632b('0x10')]='';this[_0x632b('0x11')]='';this['priority']='';this[_0x632b('0x12')]=0x0;this['assigned']=![];this[_0x632b('0x13')]='';this['motionChannel']='voice';this[_0x632b('0x14')]=null;this['mohtime']=0x0;this[_0x632b('0x15')]={};}module[_0x632b('0x16')]=QueueReport; \ No newline at end of file +var _0x6d76=['assigned','lastAssignedTo','voice','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename','context','exten','priority','holdtime'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x6d76,0x181));var _0x66d7=function(_0x1b8b27,_0x204b53){_0x1b8b27=_0x1b8b27-0x0;var _0x257755=_0x6d76[_0x1b8b27];return _0x257755;};'use strict';function QueueReport(){this[_0x66d7('0x0')]=_0x66d7('0x1');this['uniqueid']='';this[_0x66d7('0x2')]='';this[_0x66d7('0x3')]='';this[_0x66d7('0x4')]='';this['queuecallerjoinAt']=null;this[_0x66d7('0x5')]=null;this[_0x66d7('0x6')]=0x1;this[_0x66d7('0x7')]=0x1;this[_0x66d7('0x8')]=![];this[_0x66d7('0x9')]=null;this[_0x66d7('0xa')]=![];this[_0x66d7('0xb')]=null;this[_0x66d7('0xc')]=![];this[_0x66d7('0xd')]=null;this['originalposition']=0x1;this[_0x66d7('0xe')]='';this['connectedlinenum']='';this[_0x66d7('0xf')]='';this['accountcode']='';this[_0x66d7('0x10')]='';this[_0x66d7('0x11')]='';this[_0x66d7('0x12')]='';this[_0x66d7('0x13')]=0x0;this[_0x66d7('0x14')]=![];this[_0x66d7('0x15')]='';this['motionChannel']=_0x66d7('0x16');this[_0x66d7('0x17')]=null;this[_0x66d7('0x18')]=0x0;this[_0x66d7('0x19')]={};}module[_0x66d7('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 63bc58e..63d794b 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 _0x323a=['Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken','type','serverUrl'];(function(_0x12874d,_0x1db656){var _0x2d19cc=function(_0x2251e6){while(--_0x2251e6){_0x12874d['push'](_0x12874d['shift']());}};_0x2d19cc(++_0x1db656);}(_0x323a,0x1b0));var _0xa323=function(_0x3a01e9,_0x17b221){_0x3a01e9=_0x3a01e9-0x0;var _0x2a8d5e=_0x323a[_0x3a01e9];return _0x2a8d5e;};'use strict';function SalesforceAccount(_0x3d9665){this['id']=_0x3d9665['id']||0x0;this[_0xa323('0x0')]=_0x3d9665[_0xa323('0x0')]||'';this[_0xa323('0x1')]=_0x3d9665[_0xa323('0x1')]||'';this[_0xa323('0x2')]=_0x3d9665[_0xa323('0x2')]||'';this[_0xa323('0x3')]=_0x3d9665[_0xa323('0x3')]||'';this['clientId']=_0x3d9665['clientId']||'';this[_0xa323('0x4')]=_0x3d9665[_0xa323('0x4')]||'';this[_0xa323('0x5')]=_0x3d9665[_0xa323('0x5')]||'';this['type']=_0x3d9665[_0xa323('0x6')]||'integrationTab';this[_0xa323('0x7')]=_0x3d9665[_0xa323('0x7')]||'';this['Configurations']=_0x3d9665[_0xa323('0x8')]||{};}module[_0xa323('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x5032=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x5032,0x90));var _0x2503=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5032[_0x5ddb1c];return _0x354adc;};'use strict';function SalesforceAccount(_0x1f0a42){this['id']=_0x1f0a42['id']||0x0;this[_0x2503('0x0')]=_0x1f0a42[_0x2503('0x0')]||'';this[_0x2503('0x1')]=_0x1f0a42[_0x2503('0x1')]||'';this[_0x2503('0x2')]=_0x1f0a42['remoteUri']||'';this[_0x2503('0x3')]=_0x1f0a42['password']||'';this[_0x2503('0x4')]=_0x1f0a42[_0x2503('0x4')]||'';this[_0x2503('0x5')]=_0x1f0a42[_0x2503('0x5')]||'';this[_0x2503('0x6')]=_0x1f0a42['securityToken']||'';this[_0x2503('0x7')]=_0x1f0a42[_0x2503('0x7')]||_0x2503('0x8');this[_0x2503('0x9')]=_0x1f0a42[_0x2503('0x9')]||'';this[_0x2503('0xa')]=_0x1f0a42[_0x2503('0xa')]||{};}module[_0x2503('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ba50a98..b67f739 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 _0xf23f=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1015d6,_0x51e6ba){var _0x5b3c96=function(_0x759c5b){while(--_0x759c5b){_0x1015d6['push'](_0x1015d6['shift']());}};_0x5b3c96(++_0x51e6ba);}(_0xf23f,0x1ed));var _0xff23=function(_0xc93556,_0x840f41){_0xc93556=_0xc93556-0x0;var _0x4453a1=_0xf23f[_0xc93556];return _0x4453a1;};'use strict';function ServicenowAccount(_0x26c7f0){this['id']=_0x26c7f0['id']||0x0;this[_0xff23('0x0')]=_0x26c7f0[_0xff23('0x0')]||'';this[_0xff23('0x1')]=_0x26c7f0[_0xff23('0x1')]||'';this[_0xff23('0x2')]=_0x26c7f0[_0xff23('0x2')]||'';this[_0xff23('0x3')]=_0x26c7f0[_0xff23('0x3')]||'';this[_0xff23('0x4')]=_0x26c7f0[_0xff23('0x4')]||'';this[_0xff23('0x5')]=_0x26c7f0[_0xff23('0x5')]||{};}module[_0xff23('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x708a=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x1ec552,_0x3c1f1e){var _0x286185=function(_0x372867){while(--_0x372867){_0x1ec552['push'](_0x1ec552['shift']());}};_0x286185(++_0x3c1f1e);}(_0x708a,0x13f));var _0xa708=function(_0x3e1f80,_0x52471c){_0x3e1f80=_0x3e1f80-0x0;var _0x2d3a67=_0x708a[_0x3e1f80];return _0x2d3a67;};'use strict';function ServicenowAccount(_0x23c735){this['id']=_0x23c735['id']||0x0;this['name']=_0x23c735[_0xa708('0x0')]||'';this[_0xa708('0x1')]=_0x23c735['username']||'';this['password']=_0x23c735[_0xa708('0x2')]||'';this[_0xa708('0x3')]=_0x23c735[_0xa708('0x3')]||'';this[_0xa708('0x4')]=_0x23c735[_0xa708('0x4')]||'';this[_0xa708('0x5')]=_0x23c735[_0xa708('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 7178814..dd53d31 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 _0x399a=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2b668a,_0x5ced15){var _0x110034=function(_0x454af7){while(--_0x454af7){_0x2b668a['push'](_0x2b668a['shift']());}};_0x110034(++_0x5ced15);}(_0x399a,0x194));var _0xa399=function(_0x3e5595,_0xbe4275){_0x3e5595=_0x3e5595-0x0;var _0x3fd3a6=_0x399a[_0x3e5595];return _0x3fd3a6;};'use strict';function SugarcrmAccount(_0x12b97e){this['id']=_0x12b97e['id']||0x0;this[_0xa399('0x0')]=_0x12b97e['name']||'';this[_0xa399('0x1')]=_0x12b97e[_0xa399('0x1')]||'';this[_0xa399('0x2')]=_0x12b97e['password']||'';this[_0xa399('0x3')]=_0x12b97e[_0xa399('0x3')]||'';this['serverUrl']=_0x12b97e[_0xa399('0x4')]||'';this[_0xa399('0x5')]=_0x12b97e[_0xa399('0x5')]||{};}module[_0xa399('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x605e=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x35929b,_0x42c1db){var _0x44f9c0=function(_0x3041c2){while(--_0x3041c2){_0x35929b['push'](_0x35929b['shift']());}};_0x44f9c0(++_0x42c1db);}(_0x605e,0x1b8));var _0xe605=function(_0x529c0b,_0x23c6a8){_0x529c0b=_0x529c0b-0x0;var _0xd78059=_0x605e[_0x529c0b];return _0xd78059;};'use strict';function SugarcrmAccount(_0x4f9273){this['id']=_0x4f9273['id']||0x0;this[_0xe605('0x0')]=_0x4f9273['name']||'';this[_0xe605('0x1')]=_0x4f9273[_0xe605('0x1')]||'';this['password']=_0x4f9273['password']||'';this['remoteUri']=_0x4f9273[_0xe605('0x2')]||'';this[_0xe605('0x3')]=_0x4f9273[_0xe605('0x3')]||'';this['Configurations']=_0x4f9273[_0xe605('0x4')]||{};}module[_0xe605('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 87efc75..fc1bf7f 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 _0xbaf3=['stateTime','address','exports','name','accountcode','state','unknown'];(function(_0x2a431b,_0x2f5780){var _0x28501c=function(_0x510ce3){while(--_0x510ce3){_0x2a431b['push'](_0x2a431b['shift']());}};_0x28501c(++_0x2f5780);}(_0xbaf3,0x1df));var _0x3baf=function(_0x449e3e,_0x3e113e){_0x449e3e=_0x449e3e-0x0;var _0x6cc58a=_0xbaf3[_0x449e3e];return _0x6cc58a;};'use strict';function Telephone(_0x552df7){this['id']=_0x552df7['id']||0x0;this[_0x3baf('0x0')]=_0x552df7[_0x3baf('0x0')]||'';this[_0x3baf('0x1')]=_0x552df7['accountcode']||'';this[_0x3baf('0x2')]=_0x3baf('0x3');this[_0x3baf('0x4')]=0x0;this['status']=_0x3baf('0x3');this[_0x3baf('0x5')]='';}module[_0x3baf('0x6')]=Telephone; \ No newline at end of file +var _0xbe62=['stateTime','status','exports','name','unknown'];(function(_0x2a550b,_0x2ddce3){var _0x35480c=function(_0x153446){while(--_0x153446){_0x2a550b['push'](_0x2a550b['shift']());}};_0x35480c(++_0x2ddce3);}(_0xbe62,0x9e));var _0x2be6=function(_0x3ccca1,_0xe0ed0){_0x3ccca1=_0x3ccca1-0x0;var _0x2a26b3=_0xbe62[_0x3ccca1];return _0x2a26b3;};'use strict';function Telephone(_0x8c85de){this['id']=_0x8c85de['id']||0x0;this[_0x2be6('0x0')]=_0x8c85de['name']||'';this['accountcode']=_0x8c85de['accountcode']||'';this['state']=_0x2be6('0x1');this[_0x2be6('0x2')]=0x0;this[_0x2be6('0x3')]=_0x2be6('0x1');this['address']='';}module[_0x2be6('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5009aaf..1b63d1d 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x2ebaff,_0x611579){var _0x2c38de=function(_0x15ee84){while(--_0x15ee84){_0x2ebaff['push'](_0x2ebaff['shift']());}};_0x2c38de(++_0x611579);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bac50,_0x540d00){_0x5bac50=_0x5bac50-0x0;var _0x28afd5=_0xb10b[_0x5bac50];return _0x28afd5;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3324e6,_0x3ed3b3){var _0x18252b=function(_0x4c29b8){while(--_0x4c29b8){_0x3324e6['push'](_0x3324e6['shift']());}};_0x18252b(++_0x3ed3b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index b24b838..eed252b 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(_0x5a3347,_0x2d7b9d){var _0x1b1662=function(_0x32a088){while(--_0x32a088){_0x5a3347['push'](_0x5a3347['shift']());}};_0x1b1662(++_0x2d7b9d);}(_0x757a,0xde));var _0xa757=function(_0x4c90a6,_0x5b723b){_0x4c90a6=_0x4c90a6-0x0;var _0x2e1bfb=_0x757a[_0x4c90a6];return _0x2e1bfb;};'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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x5cc5a8,_0x41b354){var _0x35f52c=function(_0x365552){while(--_0x365552){_0x5cc5a8['push'](_0x5cc5a8['shift']());}};_0x35f52c(++_0x41b354);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5e6ad4,_0x1f7d6c){_0x5e6ad4=_0x5e6ad4-0x0;var _0x43febd=_0x9ffd[_0x5e6ad4];return _0x43febd;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d99fd96..4c53bb1 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 _0x3558=['active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x3558,0xc6));var _0x8355=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x3558[_0x5eef05];return _0x56d4b8;};'use strict';function Trunk(_0x282cb9){this['id']=_0x282cb9['id']||0x0;this[_0x8355('0x0')]=_0x282cb9[_0x8355('0x0')]||![];this[_0x8355('0x1')]=_0x282cb9['name']||'';this['state']=_0x8355('0x2');this[_0x8355('0x3')]=0x0;this[_0x8355('0x4')]='unknown';this['registry']=_0x282cb9[_0x8355('0x5')]&&_0x282cb9[_0x8355('0x5')][_0x8355('0x6')](':')?_0x282cb9['registry'][_0x8355('0x7')](':')[0x0]:'';this[_0x8355('0x8')]='';this[_0x8355('0x9')]='';this[_0x8355('0xa')]='';this[_0x8355('0xb')]='';this[_0x8355('0xc')]='';this[_0x8355('0xd')]='unknown';this[_0x8355('0xe')]='';this[_0x8355('0xf')]='';this[_0x8355('0x10')]=_0x282cb9[_0x8355('0x10')]||'';}module[_0x8355('0x11')]=Trunk; \ No newline at end of file +var _0x4fb5=['address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x5386e4,_0x3f17c0){var _0x3af1bc=function(_0x191f9d){while(--_0x191f9d){_0x5386e4['push'](_0x5386e4['shift']());}};_0x3af1bc(++_0x3f17c0);}(_0x4fb5,0x1e8));var _0x54fb=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x4fb5[_0x38537f];return _0x141e23;};'use strict';function Trunk(_0x553126){this['id']=_0x553126['id']||0x0;this['active']=_0x553126[_0x54fb('0x0')]||![];this[_0x54fb('0x1')]=_0x553126['name']||'';this[_0x54fb('0x2')]=_0x54fb('0x3');this[_0x54fb('0x4')]=0x0;this[_0x54fb('0x5')]=_0x54fb('0x3');this[_0x54fb('0x6')]=_0x553126['registry']&&_0x553126[_0x54fb('0x6')][_0x54fb('0x7')](':')?_0x553126[_0x54fb('0x6')][_0x54fb('0x8')](':')[0x0]:'';this[_0x54fb('0x9')]='';this[_0x54fb('0xa')]='';this[_0x54fb('0xb')]='';this[_0x54fb('0xc')]='';this[_0x54fb('0xd')]='';this[_0x54fb('0xe')]='unknown';this[_0x54fb('0xf')]='';this[_0x54fb('0x10')]='';this['defaultuser']=_0x553126['defaultuser']||'';}module[_0x54fb('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 8b490fa..79a57ac 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 _0x799e=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0xe4386b,_0x501561){var _0x2cb75a=function(_0x433e85){while(--_0x433e85){_0xe4386b['push'](_0xe4386b['shift']());}};_0x2cb75a(++_0x501561);}(_0x799e,0x128));var _0xe799=function(_0x457542,_0x2c0843){_0x457542=_0x457542-0x0;var _0x56521a=_0x799e[_0x457542];return _0x56521a;};'use strict';function voiceExtension(_0x8a5595){this['id']=_0x8a5595['id']||0x0;this[_0xe799('0x0')]=_0x8a5595[_0xe799('0x0')]||'';this['recordingFormat']=_0x8a5595[_0xe799('0x1')]||_0xe799('0x2');this[_0xe799('0x3')]=_0x8a5595[_0xe799('0x3')]||![];}module[_0xe799('0x4')]=voiceExtension; \ No newline at end of file +var _0x9263=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x9263,0xc9));var _0x3926=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9263[_0x4b2863];return _0x567d67;};'use strict';function voiceExtension(_0x6f0325){this['id']=_0x6f0325['id']||0x0;this[_0x3926('0x0')]=_0x6f0325[_0x3926('0x0')]||'';this[_0x3926('0x1')]=_0x6f0325[_0x3926('0x1')]||'none';this['mandatoryDisposition']=_0x6f0325[_0x3926('0x2')]||![];}module[_0x3926('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 0480c1f..8ba2d8c 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 _0xc69b=['dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','linear','random','roundrobin','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','loggedIn','notInUse','paused','ringInUse','unavailable','unknown','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive'];(function(_0x364852,_0x17691e){var _0x2ec071=function(_0x5608a1){while(--_0x5608a1){_0x364852['push'](_0x364852['shift']());}};_0x2ec071(++_0x17691e);}(_0xc69b,0xcf));var _0xbc69=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xc69b[_0x1c9c24];return _0x349c69;};'use strict';var monitorFormat={'wav':_0xbc69('0x0'),'wav49':'wav49','gsm':_0xbc69('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xbc69('0x2'),'linear':_0xbc69('0x3'),'random':_0xbc69('0x4'),'ringall':'ringall','rr':_0xbc69('0x5'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0xbc69('0x6')};function VoiceQueue(_0x4754f0){this['id']=_0x4754f0['id']||0x0;this['name']=_0x4754f0[_0xbc69('0x7')]||'';this[_0xbc69('0x8')]=_0x4754f0[_0xbc69('0x8')]||'';this['type']=_0x4754f0[_0xbc69('0x9')]||_0xbc69('0xa');this[_0xbc69('0xb')]=0x0;this[_0xbc69('0xc')]=0x0;this[_0xbc69('0xd')]=0x0;this['sumDuration']=0x0;this[_0xbc69('0xe')]=0x0;this[_0xbc69('0xf')]=0x0;this[_0xbc69('0x10')]=0x0;this[_0xbc69('0x11')]=0x0;this[_0xbc69('0x12')]=0x0;this['busy']=0x0;this[_0xbc69('0x13')]=0x0;this[_0xbc69('0x14')]=0x0;this[_0xbc69('0x15')]=0x0;this[_0xbc69('0x16')]=0x0;this['onHold']=0x0;this[_0xbc69('0x17')]=0x0;this['ringing']=0x0;this[_0xbc69('0x18')]=0x0;this['talking']=0x0;this[_0xbc69('0x19')]=0x0;this[_0xbc69('0x1a')]=0x0;this['acw']=_0x4754f0['acw']||![];this[_0xbc69('0x1b')]=_0x4754f0[_0xbc69('0x1b')]||0xa;this[_0xbc69('0x1c')]=_0x4754f0[_0xbc69('0x1c')]||'no';this[_0xbc69('0x1d')]=!![];this[_0xbc69('0x1e')]='';this[_0xbc69('0x1f')]='';this[_0xbc69('0x20')]=0x0;this[_0xbc69('0x21')]=0x0;this['dialTimezone']=_0x4754f0[_0xbc69('0x22')]||null;this[_0xbc69('0x23')]=_0x4754f0[_0xbc69('0x23')]?_0x4754f0[_0xbc69('0x23')]:null;this[_0xbc69('0x24')]=_0x4754f0['dialActive'];this[_0xbc69('0x25')]=_0x4754f0[_0xbc69('0x25')]||_0xbc69('0x26');this[_0xbc69('0x27')]=_0x4754f0[_0xbc69('0x27')]||0x0;this[_0xbc69('0x28')]=_0x4754f0['dialLimitQueue']||0x0;this[_0xbc69('0x29')]=_0x4754f0[_0xbc69('0x29')]||0x1;this[_0xbc69('0x2a')]=_0x4754f0[_0xbc69('0x2a')]||_0xbc69('0x2b');this[_0xbc69('0x2c')]=_0x4754f0[_0xbc69('0x2c')]||0.03;this[_0xbc69('0x2d')]=_0x4754f0[_0xbc69('0x2d')]||0x258;this[_0xbc69('0x2e')]=_0x4754f0[_0xbc69('0x2e')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x4754f0[_0xbc69('0x2f')]||'anonymous';this[_0xbc69('0x30')]=_0x4754f0['dialOriginateTimeout']||0x1e;this[_0xbc69('0x31')]=_0x4754f0[_0xbc69('0x31')]||'tTxX';this[_0xbc69('0x32')]=_0x4754f0[_0xbc69('0x32')]||0x3;this[_0xbc69('0x33')]=_0x4754f0['dialQueueProject']||undefined;this[_0xbc69('0x34')]=_0x4754f0['dialCongestionMaxRetry']||0x3;this[_0xbc69('0x35')]=_0x4754f0[_0xbc69('0x35')]||0x96;this[_0xbc69('0x36')]=_0x4754f0['dialBusyMaxRetry']||0x3;this[_0xbc69('0x37')]=_0x4754f0[_0xbc69('0x37')]||0x96;this['dialNoAnswerMaxRetry']=_0x4754f0[_0xbc69('0x38')]||0x3;this[_0xbc69('0x39')]=_0x4754f0[_0xbc69('0x39')]||0x96;this[_0xbc69('0x3a')]=_0x4754f0[_0xbc69('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4754f0['dialNoSuchNumberRetryFrequency']||0x96;this[_0xbc69('0x3b')]=_0x4754f0[_0xbc69('0x3b')]||0x3;this[_0xbc69('0x3c')]=_0x4754f0[_0xbc69('0x3c')]||0x96;this[_0xbc69('0x3d')]=_0x4754f0[_0xbc69('0x3d')]||0x3;this[_0xbc69('0x3e')]=_0x4754f0[_0xbc69('0x3e')]||0x96;this[_0xbc69('0x3f')]=_0x4754f0[_0xbc69('0x3f')]||0x3;this[_0xbc69('0x40')]=_0x4754f0['dialMachineRetryFrequency']||0x96;this[_0xbc69('0x41')]=_0x4754f0['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x4754f0[_0xbc69('0x42')]||0x96;this[_0xbc69('0x43')]=_0x4754f0[_0xbc69('0x43')]||0x3;this['dialGlobalMaxRetry']=_0x4754f0['dialGlobalMaxRetry']||0x4;this[_0xbc69('0x44')]=_0x4754f0[_0xbc69('0x44')]?_0x4754f0[_0xbc69('0x44')]:undefined;this['TrunkBackup']=_0x4754f0[_0xbc69('0x45')]?_0x4754f0[_0xbc69('0x45')]:undefined;this[_0xbc69('0x46')]=_0x4754f0[_0xbc69('0x46')]||undefined;this[_0xbc69('0x47')]=_0x4754f0[_0xbc69('0x47')]?_0x4754f0['Interval']:undefined;this[_0xbc69('0x48')]=_0x4754f0[_0xbc69('0x48')]||_0xbc69('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x4754f0[_0xbc69('0x4a')]||undefined;this[_0xbc69('0x4b')]=_0x4754f0[_0xbc69('0x4b')]||undefined;this[_0xbc69('0x4c')]=strategy[_0x4754f0[_0xbc69('0x4c')]];this['queueStatusComplete']=!![];this[_0xbc69('0x4d')]=_0x4754f0[_0xbc69('0x4d')]||![];this[_0xbc69('0x4e')]=_0x4754f0[_0xbc69('0x4e')];this[_0xbc69('0x4f')]=_0x4754f0['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4754f0[_0xbc69('0x50')];this[_0xbc69('0x51')]=_0x4754f0[_0xbc69('0x51')];this['dialAMDMinWordLength']=_0x4754f0[_0xbc69('0x52')];this[_0xbc69('0x53')]=_0x4754f0[_0xbc69('0x53')];this[_0xbc69('0x54')]=_0x4754f0[_0xbc69('0x54')];this[_0xbc69('0x55')]=_0x4754f0[_0xbc69('0x55')];this['dialAMDMaximumWordLength']=_0x4754f0['dialAMDMaximumWordLength'];this[_0xbc69('0x56')]=0x0;this[_0xbc69('0x57')]=0x0;this['timeout']=_0x4754f0[_0xbc69('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0xbc69('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xbc69('0x5a')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xbc69('0x5b')]=0x0;this[_0xbc69('0x5c')]=0x0;this[_0xbc69('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xbc69('0x5e')]=0x0;this[_0xbc69('0x5f')]=0x0;this[_0xbc69('0x60')]=0x0;this[_0xbc69('0x61')]=0x0;this[_0xbc69('0x62')]=undefined;this['startPredictive']=undefined;this[_0xbc69('0x63')]=undefined;this[_0xbc69('0x64')]=1.05;this[_0xbc69('0x65')]=0x0;this[_0xbc69('0x66')]=0x0;this[_0xbc69('0x67')]=0x0;this[_0xbc69('0x68')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xbc69('0x69')]=0x0;this[_0xbc69('0x6a')]=0x0;this[_0xbc69('0x6b')]=_0x4754f0['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xbc69('0x6c')]=_0x4754f0[_0xbc69('0x6d')]||0xa;this[_0xbc69('0x6e')]=0x0;this[_0xbc69('0x6f')]=0x0;this[_0xbc69('0x70')]=0x1;this[_0xbc69('0x71')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xbc69('0x72')]=_0x4754f0['dialRecallMeTimeout']||0x1e;this[_0xbc69('0x73')]=_0x4754f0[_0xbc69('0x73')]||![];this['dialPreviewAutoRecallMe']=!!_0x4754f0['dialPreviewAutoRecallMe']||![];this[_0xbc69('0x74')]=!!_0x4754f0[_0xbc69('0x74')]||![];this['dialQueueProject2']=_0x4754f0[_0xbc69('0x75')]||undefined;this[_0xbc69('0x76')]=_0x4754f0[_0xbc69('0x76')]||![];this[_0xbc69('0x77')]=_0x4754f0[_0xbc69('0x77')]||![];this[_0xbc69('0x8')]=monitorFormat[_0x4754f0[_0xbc69('0x8')]]?monitorFormat[_0x4754f0[_0xbc69('0x8')]]:undefined;this['mandatoryDisposition']=_0x4754f0[_0xbc69('0x78')]||![];this['mandatoryDispositionPause']=_0x4754f0['mandatoryDispositionPause']?_0x4754f0['mandatoryDispositionPause']:undefined;this[_0xbc69('0x79')]=![];}module[_0xbc69('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x3cc7=['outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','roundrobin','rrordered','wrandom','name','monitor_format','waiting','total','sumHoldTime','sumBillable','abandoned','invalid','loggedIn','notInUse','onHold','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3cc7,0x11f));var _0x73cc=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0x3cc7[_0x36940e];return _0x3283f2;};'use strict';var monitorFormat={'wav':_0x73cc('0x0'),'wav49':_0x73cc('0x1'),'gsm':_0x73cc('0x2')};var strategy={'fewestcalls':_0x73cc('0x3'),'leastrecent':_0x73cc('0x4'),'linear':'linear','random':_0x73cc('0x5'),'ringall':'ringall','rr':_0x73cc('0x6'),'rrmemory':'rrmemory','rrordered':_0x73cc('0x7'),'wrandom':_0x73cc('0x8')};function VoiceQueue(_0x343002){this['id']=_0x343002['id']||0x0;this['name']=_0x343002[_0x73cc('0x9')]||'';this[_0x73cc('0xa')]=_0x343002[_0x73cc('0xa')]||'';this['type']=_0x343002['type']||'inbound';this[_0x73cc('0xb')]=0x0;this[_0x73cc('0xc')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x73cc('0xd')]=0x0;this[_0x73cc('0xe')]=0x0;this['unmanaged']=0x0;this[_0x73cc('0xf')]=0x0;this['available']=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0x73cc('0x10')]=0x0;this[_0x73cc('0x11')]=0x0;this[_0x73cc('0x12')]=0x0;this[_0x73cc('0x13')]=0x0;this['paused']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x73cc('0x14')]=0x0;this[_0x73cc('0x15')]=0x0;this['unknown']=0x0;this[_0x73cc('0x16')]=_0x343002['acw']||![];this[_0x73cc('0x17')]=_0x343002[_0x73cc('0x17')]||0xa;this[_0x73cc('0x18')]=_0x343002[_0x73cc('0x18')]||'no';this[_0x73cc('0x19')]=!![];this['message']='';this[_0x73cc('0x1a')]='';this[_0x73cc('0x1b')]=0x0;this[_0x73cc('0x1c')]=0x0;this[_0x73cc('0x1d')]=_0x343002[_0x73cc('0x1d')]||null;this[_0x73cc('0x1e')]=_0x343002[_0x73cc('0x1e')]?_0x343002[_0x73cc('0x1e')]:null;this[_0x73cc('0x1f')]=_0x343002['dialActive'];this[_0x73cc('0x20')]=_0x343002[_0x73cc('0x20')]||_0x73cc('0x21');this[_0x73cc('0x22')]=_0x343002[_0x73cc('0x22')]||0x0;this[_0x73cc('0x23')]=_0x343002['dialLimitQueue']||0x0;this[_0x73cc('0x24')]=_0x343002['dialPowerLevel']||0x1;this[_0x73cc('0x25')]=_0x343002[_0x73cc('0x25')]||_0x73cc('0x26');this[_0x73cc('0x27')]=_0x343002[_0x73cc('0x27')]||0.03;this[_0x73cc('0x28')]=_0x343002[_0x73cc('0x28')]||0x258;this[_0x73cc('0x29')]=_0x343002['dialOriginateCallerIdName']||_0x73cc('0x2a');this[_0x73cc('0x2b')]=_0x343002['dialOriginateCallerIdNumber']||_0x73cc('0x2a');this[_0x73cc('0x2c')]=_0x343002[_0x73cc('0x2c')]||0x1e;this[_0x73cc('0x2d')]=_0x343002[_0x73cc('0x2d')]||_0x73cc('0x2e');this[_0x73cc('0x2f')]=_0x343002[_0x73cc('0x2f')]||0x3;this['dialQueueProject']=_0x343002['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x343002['dialCongestionMaxRetry']||0x3;this[_0x73cc('0x30')]=_0x343002[_0x73cc('0x30')]||0x96;this[_0x73cc('0x31')]=_0x343002[_0x73cc('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x343002[_0x73cc('0x32')]||0x96;this[_0x73cc('0x33')]=_0x343002[_0x73cc('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x343002['dialNoAnswerRetryFrequency']||0x96;this[_0x73cc('0x34')]=_0x343002[_0x73cc('0x34')]||0x3;this[_0x73cc('0x35')]=_0x343002['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x343002[_0x73cc('0x36')]||0x3;this[_0x73cc('0x37')]=_0x343002[_0x73cc('0x37')]||0x96;this[_0x73cc('0x38')]=_0x343002[_0x73cc('0x38')]||0x3;this[_0x73cc('0x39')]=_0x343002[_0x73cc('0x39')]||0x96;this[_0x73cc('0x3a')]=_0x343002[_0x73cc('0x3a')]||0x3;this[_0x73cc('0x3b')]=_0x343002[_0x73cc('0x3b')]||0x96;this[_0x73cc('0x3c')]=_0x343002[_0x73cc('0x3c')]||0x3;this[_0x73cc('0x3d')]=_0x343002[_0x73cc('0x3d')]||0x96;this[_0x73cc('0x3e')]=_0x343002['callAdditionalPhoneAfterMin']||0x3;this[_0x73cc('0x3f')]=_0x343002[_0x73cc('0x3f')]||0x4;this[_0x73cc('0x40')]=_0x343002[_0x73cc('0x40')]?_0x343002[_0x73cc('0x40')]:undefined;this[_0x73cc('0x41')]=_0x343002[_0x73cc('0x41')]?_0x343002[_0x73cc('0x41')]:undefined;this[_0x73cc('0x42')]=_0x343002[_0x73cc('0x42')]||undefined;this[_0x73cc('0x43')]=_0x343002[_0x73cc('0x43')]?_0x343002[_0x73cc('0x43')]:undefined;this[_0x73cc('0x44')]=_0x343002[_0x73cc('0x44')]||_0x73cc('0x45');this[_0x73cc('0x46')]=_0x343002[_0x73cc('0x46')]||undefined;this[_0x73cc('0x47')]=_0x343002[_0x73cc('0x47')]||undefined;this[_0x73cc('0x48')]=strategy[_0x343002[_0x73cc('0x48')]];this['queueStatusComplete']=!![];this[_0x73cc('0x49')]=_0x343002[_0x73cc('0x49')]||![];this[_0x73cc('0x4a')]=_0x343002[_0x73cc('0x4a')];this[_0x73cc('0x4b')]=_0x343002[_0x73cc('0x4b')];this[_0x73cc('0x4c')]=_0x343002[_0x73cc('0x4c')];this[_0x73cc('0x4d')]=_0x343002[_0x73cc('0x4d')];this['dialAMDMinWordLength']=_0x343002[_0x73cc('0x4e')];this[_0x73cc('0x4f')]=_0x343002['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x343002[_0x73cc('0x50')];this['dialAMDSilenceThreshold']=_0x343002[_0x73cc('0x51')];this[_0x73cc('0x52')]=_0x343002[_0x73cc('0x52')];this[_0x73cc('0x53')]=0x0;this[_0x73cc('0x54')]=0x0;this[_0x73cc('0x55')]=_0x343002[_0x73cc('0x55')];this[_0x73cc('0x56')]=0x0;this[_0x73cc('0x57')]=0x0;this[_0x73cc('0x58')]=0x0;this[_0x73cc('0x59')]=0x0;this[_0x73cc('0x5a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x73cc('0x5b')]=0x0;this[_0x73cc('0x5c')]=0x0;this[_0x73cc('0x5d')]=0x0;this[_0x73cc('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x73cc('0x5f')]=0x0;this[_0x73cc('0x60')]=undefined;this[_0x73cc('0x61')]=undefined;this[_0x73cc('0x62')]=undefined;this[_0x73cc('0x63')]=1.05;this[_0x73cc('0x64')]=0x0;this[_0x73cc('0x65')]=0x0;this[_0x73cc('0x66')]=0x0;this[_0x73cc('0x67')]=0x0;this[_0x73cc('0x68')]=0x0;this[_0x73cc('0x69')]=0x0;this[_0x73cc('0x6a')]=0x0;this[_0x73cc('0x6b')]=0x0;this[_0x73cc('0x6c')]=_0x343002['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x73cc('0x6d')]=_0x343002['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x73cc('0x6e')]=0x0;this[_0x73cc('0x6f')]=0x0;this[_0x73cc('0x70')]=0x1;this[_0x73cc('0x71')]=0x0;this[_0x73cc('0x72')]=0x0;this[_0x73cc('0x73')]=0x0;this[_0x73cc('0x74')]=0x0;this[_0x73cc('0x75')]=_0x343002[_0x73cc('0x75')]||0x1e;this[_0x73cc('0x76')]=_0x343002[_0x73cc('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x343002[_0x73cc('0x77')]||![];this[_0x73cc('0x78')]=!!_0x343002[_0x73cc('0x78')]||![];this[_0x73cc('0x79')]=_0x343002[_0x73cc('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x343002['dialAgiAfterHangupClient']||![];this[_0x73cc('0x7a')]=_0x343002['dialAgiAfterHangupAgent']||![];this[_0x73cc('0xa')]=monitorFormat[_0x343002[_0x73cc('0xa')]]?monitorFormat[_0x343002[_0x73cc('0xa')]]:undefined;this[_0x73cc('0x7b')]=_0x343002[_0x73cc('0x7b')]||![];this[_0x73cc('0x7c')]=_0x343002[_0x73cc('0x7c')]?_0x343002[_0x73cc('0x7c')]:undefined;this[_0x73cc('0x7d')]=![];}module[_0x73cc('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 9fb7f6c..2281739 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb13b=['predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','onHold','loggedin','callers','SIP/','online','incall','includes','status','booked','keys','length','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','available','loggedIn','loggedInDb','paused','ringing','waiting','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor'];(function(_0x6bfe5c,_0x31a59e){var _0x25c5f2=function(_0x2a352e){while(--_0x2a352e){_0x6bfe5c['push'](_0x6bfe5c['shift']());}};_0x25c5f2(++_0x31a59e);}(_0xb13b,0x1de));var _0xbb13=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb13b[_0x20a584];return _0x4b41a8;};'use strict';var INBOUND_COUNTERS=[_0xbb13('0x0'),_0xbb13('0x1'),_0xbb13('0x2'),_0xbb13('0x3'),_0xbb13('0x4'),'talking',_0xbb13('0x5')];var OUTBOUND_COUNTERS=[_0xbb13('0x0'),'answered',_0xbb13('0x6'),_0xbb13('0x1'),_0xbb13('0x2'),_0xbb13('0x7'),_0xbb13('0x8'),_0xbb13('0x9'),_0xbb13('0xa'),_0xbb13('0xb'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xbb13('0xc'),_0xbb13('0xd'),_0xbb13('0xe'),_0xbb13('0xf'),_0xbb13('0x3'),_0xbb13('0x10'),_0xbb13('0x11'),'sumBillable',_0xbb13('0x12'),_0xbb13('0x13'),_0xbb13('0x5')];function VoiceQueueSummary(_0x4d97f0){this['id']=_0x4d97f0['id'];this[_0xbb13('0x14')]=_0x4d97f0['name'];this['strategy']=_0x4d97f0[_0xbb13('0x15')];this[_0xbb13('0x16')]=_0x4d97f0[_0xbb13('0x16')]||0x0;this[_0xbb13('0x17')]=_0x4d97f0['answered']||0x0;this[_0xbb13('0x0')]=_0x4d97f0[_0xbb13('0x0')]||0x0;this[_0xbb13('0x18')]=_0x4d97f0['busy']||0x0;this[_0xbb13('0x6')]=_0x4d97f0['inUse']||0x0;this[_0xbb13('0x19')]=_0x4d97f0['invalid']||0x0;this[_0xbb13('0x1')]=_0x4d97f0[_0xbb13('0x1')]||0x0;this[_0xbb13('0x2')]=_0x4d97f0['loggedInDb']||0x0;this['onHold']=_0x4d97f0['onHold']||0x0;this[_0xbb13('0x1a')]=_0x4d97f0['notInUse']||0x0;this['paused']=_0x4d97f0['paused']||0x0;this[_0xbb13('0x4')]=_0x4d97f0[_0xbb13('0x4')]||0x0;this[_0xbb13('0x1b')]=_0x4d97f0[_0xbb13('0x1b')];this[_0xbb13('0x1c')]=_0x4d97f0[_0xbb13('0x1c')];this['sumDuration']=_0x4d97f0[_0xbb13('0x12')];this[_0xbb13('0x1d')]=_0x4d97f0[_0xbb13('0x1d')]||0x0;this[_0xbb13('0x11')]=_0x4d97f0['talking']||0x0;this['total']=_0x4d97f0[_0xbb13('0x13')]||0x0;this[_0xbb13('0x1e')]=_0x4d97f0[_0xbb13('0x1e')];this[_0xbb13('0x1f')]=_0x4d97f0['unavailable']||0x0;this[_0xbb13('0x20')]=_0x4d97f0[_0xbb13('0x20')]||0x0;this[_0xbb13('0x21')]=_0x4d97f0['unmanaged']||0x0;this[_0xbb13('0x5')]=_0x4d97f0['waiting']||0x0;if(_0x4d97f0['type']===_0xbb13('0x22')){this[_0xbb13('0x10')]=_0x4d97f0[_0xbb13('0x10')]||0x0;this[_0xbb13('0x23')]=_0x4d97f0[_0xbb13('0x23')];this[_0xbb13('0x24')]=_0x4d97f0[_0xbb13('0x24')];this[_0xbb13('0x25')]=_0x4d97f0[_0xbb13('0x25')];this[_0xbb13('0x26')]=_0x4d97f0[_0xbb13('0x26')];this['dialOriginateTimeout']=_0x4d97f0['dialOriginateTimeout'];this['dialPrefix']=_0x4d97f0[_0xbb13('0x27')];this[_0xbb13('0x28')]=_0x4d97f0[_0xbb13('0x28')];this[_0xbb13('0x29')]=_0x4d97f0[_0xbb13('0x29')];this[_0xbb13('0x9')]=_0x4d97f0[_0xbb13('0x9')];this[_0xbb13('0xa')]=_0x4d97f0[_0xbb13('0xa')];this['outboundBusyCallsDay']=_0x4d97f0[_0xbb13('0xb')];this[_0xbb13('0x2a')]=_0x4d97f0[_0xbb13('0x2a')];this[_0xbb13('0x2b')]=_0x4d97f0['outboundDropCallsDayACS'];this[_0xbb13('0x2c')]=_0x4d97f0['outboundDropCallsDayCallersExit'];this[_0xbb13('0x2d')]=_0x4d97f0[_0xbb13('0x2d')];this['outboundNoAnswerCallsDay']=_0x4d97f0[_0xbb13('0x2e')];this['outboundNoSuchCallsDay']=_0x4d97f0[_0xbb13('0xc')];this[_0xbb13('0x2f')]=_0x4d97f0[_0xbb13('0x2f')];this[_0xbb13('0xd')]=_0x4d97f0[_0xbb13('0xd')];this[_0xbb13('0xe')]=_0x4d97f0['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x4d97f0[_0xbb13('0xf')];this[_0xbb13('0x30')]=_0x4d97f0[_0xbb13('0x30')];this[_0xbb13('0x31')]=_0x4d97f0['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x4d97f0[_0xbb13('0x32')];this[_0xbb13('0x33')]=_0x4d97f0['predictiveIntervalDroppedCallsCallersExit'];this[_0xbb13('0x34')]=_0x4d97f0['predictiveIntervalDroppedCallsTimeout'];this[_0xbb13('0x35')]=_0x4d97f0[_0xbb13('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x4d97f0['predictiveIntervalErlangCallsDroppedCalls'];this[_0xbb13('0x36')]=_0x4d97f0[_0xbb13('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x4d97f0[_0xbb13('0x37')];this[_0xbb13('0x38')]=_0x4d97f0[_0xbb13('0x38')];this[_0xbb13('0x39')]=_0x4d97f0[_0xbb13('0x39')];this[_0xbb13('0x3a')]=_0x4d97f0[_0xbb13('0x3a')];this[_0xbb13('0x7')]=_0x4d97f0[_0xbb13('0x7')];this[_0xbb13('0x3b')]=_0x4d97f0[_0xbb13('0x3b')];this[_0xbb13('0x3c')]=_0x4d97f0[_0xbb13('0x3c')];this['erlangAbandonmentRate']=_0x4d97f0[_0xbb13('0x3d')];this['erlangBusyFactor']=_0x4d97f0['erlangBusyFactor'];this[_0xbb13('0x3e')]=_0x4d97f0[_0xbb13('0x3e')];this[_0xbb13('0x3f')]=_0x4d97f0[_0xbb13('0x3f')];this['message']=_0x4d97f0[_0xbb13('0x40')];this['statusMessage']=_0x4d97f0[_0xbb13('0x41')];}if(_0x4d97f0[_0xbb13('0x42')]){this[_0xbb13('0x42')]={'id':_0x4d97f0[_0xbb13('0x42')]['id'],'name':_0x4d97f0[_0xbb13('0x42')][_0xbb13('0x14')],'active':_0x4d97f0[_0xbb13('0x42')][_0xbb13('0x43')],'callerid':_0x4d97f0[_0xbb13('0x42')][_0xbb13('0x44')]};}}VoiceQueueSummary[_0xbb13('0x45')]['createReport']=function(_0x5d62c9,_0x22bb89,_0x113b7b,_0x370799){this[_0xbb13('0x2')]=0x0;this['talking']=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0xbb13('0x1a')]=0x0;this[_0xbb13('0x6')]=0x0;this[_0xbb13('0x18')]=0x0;this[_0xbb13('0x19')]=0x0;this['unavailable']=0x0;this[_0xbb13('0x4')]=0x0;this['ringInUse']=0x0;this[_0xbb13('0x46')]=0x0;if(_0x113b7b){if(_0x113b7b[_0xbb13('0x0')]){this['available']=Number(_0x113b7b[_0xbb13('0x0')]);}if(_0x113b7b[_0xbb13('0x47')]){this[_0xbb13('0x1')]=Number(_0x113b7b[_0xbb13('0x47')]);}if(_0x113b7b['callers']){this[_0xbb13('0x5')]=Number(_0x113b7b[_0xbb13('0x48')]);}}for(var _0x22c645=0x0;_0x22c645<_0x5d62c9['length'];_0x22c645++){var _0x1b136e=_0x22bb89[_0xbb13('0x49')+_0x5d62c9[_0x22c645][_0xbb13('0x14')]];if(_0x1b136e&&_0x1b136e[_0xbb13('0x4a')]){this[_0xbb13('0x2')]+=0x1;}if(_0x5d62c9[_0x22c645][_0xbb13('0x4b')]==='1'){this[_0xbb13('0x11')]+=0x1;}if(_0x5d62c9[_0x22c645][_0xbb13('0x3')]==='1'&&!['2','7','8'][_0xbb13('0x4c')](_0x5d62c9[_0x22c645][_0xbb13('0x4d')])){this[_0xbb13('0x3')]+=0x1;}switch(_0x5d62c9[_0x22c645][_0xbb13('0x4d')]){case'0':this[_0xbb13('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xbb13('0x6')]+=0x1;break;case'3':this[_0xbb13('0x18')]+=0x1;break;case'4':this[_0xbb13('0x19')]+=0x1;break;case'5':this[_0xbb13('0x1f')]+=0x1;break;case'6':this[_0xbb13('0x4')]+=0x1;break;case'7':this[_0xbb13('0x1b')]+=0x1;break;case'8':this[_0xbb13('0x46')]+=0x1;break;}}if(this['dialMethod']===_0xbb13('0x4e')){var _0x225f31=Object[_0xbb13('0x4f')](_0x370799);for(var _0x2d7716=0x0;_0x2d7716<_0x225f31[_0xbb13('0x50')];_0x2d7716++){var _0x2cc0af=_0x225f31[_0x2d7716];var _0x279f99=_0x370799[_0x2cc0af];if(_0x279f99[_0xbb13('0x51')]===this[_0xbb13('0x14')]&&_0x279f99[_0xbb13('0x1e')]===_0xbb13('0x52')&&_0x279f99[_0xbb13('0x53')]===_0xbb13('0x54')){this[_0xbb13('0x11')]+=0x1;}}if(this[_0xbb13('0x11')]>this[_0xbb13('0x6')]){this[_0xbb13('0x11')]=this['inUse'];}this[_0xbb13('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xbb13('0x45')][_0xbb13('0x55')]=function(_0x26c7a4){var _0xb3dd0d=![];if(_0x26c7a4){_0xb3dd0d=INBOUND_COUNTERS[_0xbb13('0x56')](function(_0x461e6d){return this[_0x461e6d]!==_0x26c7a4[_0x461e6d];},this);}return _0xb3dd0d;};VoiceQueueSummary[_0xbb13('0x45')][_0xbb13('0x57')]=function(_0x5a3cb8){var _0x4567f2=![];var _0x149ab6=![];var _0xd8a20d=![];if(_0x5a3cb8){_0x4567f2=this[_0xbb13('0x24')]!==_0x5a3cb8[_0xbb13('0x24')]||this['dialActive']!==_0x5a3cb8[_0xbb13('0x23')]||this['message']!==_0x5a3cb8['message']||this[_0xbb13('0x41')]!==_0x5a3cb8[_0xbb13('0x41')];_0x149ab6=OUTBOUND_COUNTERS[_0xbb13('0x56')](function(_0x56fb7f){return this[_0x56fb7f]!==_0x5a3cb8[_0x56fb7f];},this);if(this['Trunk']&&_0x5a3cb8['Trunk']){_0xd8a20d=this[_0xbb13('0x42')][_0xbb13('0x14')]!==_0x5a3cb8['Trunk'][_0xbb13('0x14')]||this[_0xbb13('0x42')][_0xbb13('0x43')]!==_0x5a3cb8[_0xbb13('0x42')][_0xbb13('0x43')];}}return _0x4567f2||_0x149ab6||_0xd8a20d;};VoiceQueueSummary['prototype'][_0xbb13('0x58')]=function(_0x590a9f){this['answered']=_0x590a9f[_0xbb13('0x17')];this[_0xbb13('0x40')]=_0x590a9f[_0xbb13('0x40')];this[_0xbb13('0x41')]=_0x590a9f[_0xbb13('0x41')];this[_0xbb13('0x7')]=_0x590a9f['originated'];this[_0xbb13('0x8')]=_0x590a9f[_0xbb13('0x8')];this[_0xbb13('0x9')]=_0x590a9f[_0xbb13('0x9')];this[_0xbb13('0xa')]=_0x590a9f[_0xbb13('0xa')];this[_0xbb13('0xb')]=_0x590a9f[_0xbb13('0xb')];this['outboundCongestionCallsDay']=_0x590a9f[_0xbb13('0x2a')];this['outboundNoAnswerCallsDay']=_0x590a9f['outboundNoAnswerCallsDay'];this[_0xbb13('0xc')]=_0x590a9f[_0xbb13('0xc')];this['outboundReCallsDay']=_0x590a9f[_0xbb13('0xd')];this[_0xbb13('0xe')]=_0x590a9f[_0xbb13('0xe')];this['outboundUnknownCallsDay']=_0x590a9f[_0xbb13('0xf')];this[_0xbb13('0x1c')]=_0x590a9f[_0xbb13('0x1c')];this[_0xbb13('0x12')]=_0x590a9f['sumDuration'];this[_0xbb13('0x13')]=_0x590a9f[_0xbb13('0x13')];if(this[_0xbb13('0x24')]==='preview'){this['pTalking']=_0x590a9f['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x308a=['startProgressive','statusMessage','Trunk','callerid','prototype','createReport','callers','length','SIP/','incall','status','booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','message','active','updateReportFromOutboundQueue','outboundRejectCallsDay','preview','available','loggedInDb','paused','ringing','talking','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','total','type','unavailable','unknown','unmanaged','waiting','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive'];(function(_0x23e3b0,_0x5f2901){var _0x13c675=function(_0x4be356){while(--_0x4be356){_0x23e3b0['push'](_0x23e3b0['shift']());}};_0x13c675(++_0x5f2901);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var INBOUND_COUNTERS=[_0xa308('0x0'),'loggedIn',_0xa308('0x1'),_0xa308('0x2'),_0xa308('0x3'),_0xa308('0x4'),'waiting'];var OUTBOUND_COUNTERS=['available',_0xa308('0x5'),_0xa308('0x6'),_0xa308('0x7'),_0xa308('0x1'),_0xa308('0x8'),_0xa308('0x9'),_0xa308('0xa'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0xa308('0xb'),_0xa308('0xc'),'outboundNoSuchCallsDay',_0xa308('0xd'),'outboundRejectCallsDay',_0xa308('0xe'),'paused',_0xa308('0xf'),_0xa308('0x4'),'sumBillable',_0xa308('0x10'),'total','waiting'];function VoiceQueueSummary(_0x34061b){this['id']=_0x34061b['id'];this[_0xa308('0x11')]=_0x34061b[_0xa308('0x11')];this[_0xa308('0x12')]=_0x34061b[_0xa308('0x12')];this[_0xa308('0x13')]=_0x34061b['abandoned']||0x0;this[_0xa308('0x5')]=_0x34061b[_0xa308('0x5')]||0x0;this[_0xa308('0x0')]=_0x34061b[_0xa308('0x0')]||0x0;this[_0xa308('0x14')]=_0x34061b['busy']||0x0;this['inUse']=_0x34061b[_0xa308('0x6')]||0x0;this[_0xa308('0x15')]=_0x34061b[_0xa308('0x15')]||0x0;this[_0xa308('0x7')]=_0x34061b[_0xa308('0x7')]||0x0;this['loggedInDb']=_0x34061b[_0xa308('0x1')]||0x0;this[_0xa308('0x16')]=_0x34061b[_0xa308('0x16')]||0x0;this[_0xa308('0x17')]=_0x34061b[_0xa308('0x17')]||0x0;this[_0xa308('0x2')]=_0x34061b['paused']||0x0;this[_0xa308('0x3')]=_0x34061b[_0xa308('0x3')]||0x0;this[_0xa308('0x18')]=_0x34061b['ringInUse'];this[_0xa308('0x19')]=_0x34061b[_0xa308('0x19')];this[_0xa308('0x10')]=_0x34061b[_0xa308('0x10')];this[_0xa308('0x1a')]=_0x34061b[_0xa308('0x1a')]||0x0;this[_0xa308('0x4')]=_0x34061b['talking']||0x0;this[_0xa308('0x1b')]=_0x34061b[_0xa308('0x1b')]||0x0;this[_0xa308('0x1c')]=_0x34061b[_0xa308('0x1c')];this[_0xa308('0x1d')]=_0x34061b['unavailable']||0x0;this[_0xa308('0x1e')]=_0x34061b[_0xa308('0x1e')]||0x0;this[_0xa308('0x1f')]=_0x34061b[_0xa308('0x1f')]||0x0;this['waiting']=_0x34061b[_0xa308('0x20')]||0x0;if(_0x34061b[_0xa308('0x1c')]===_0xa308('0x21')){this['pTalking']=_0x34061b[_0xa308('0xf')]||0x0;this['dialActive']=_0x34061b['dialActive'];this[_0xa308('0x22')]=_0x34061b['dialMethod'];this['dialOriginateCallerIdName']=_0x34061b[_0xa308('0x23')];this[_0xa308('0x24')]=_0x34061b[_0xa308('0x24')];this['dialOriginateTimeout']=_0x34061b[_0xa308('0x25')];this[_0xa308('0x26')]=_0x34061b[_0xa308('0x26')];this[_0xa308('0x27')]=_0x34061b[_0xa308('0x27')];this[_0xa308('0x28')]=_0x34061b['outboundAnswerAgiCallsDay'];this[_0xa308('0xa')]=_0x34061b[_0xa308('0xa')];this[_0xa308('0x29')]=_0x34061b[_0xa308('0x29')];this[_0xa308('0x2a')]=_0x34061b[_0xa308('0x2a')];this['outboundCongestionCallsDay']=_0x34061b[_0xa308('0xb')];this[_0xa308('0x2b')]=_0x34061b[_0xa308('0x2b')];this['outboundDropCallsDayCallersExit']=_0x34061b[_0xa308('0x2c')];this['outboundDropCallsDayTimeout']=_0x34061b[_0xa308('0x2d')];this[_0xa308('0xc')]=_0x34061b[_0xa308('0xc')];this[_0xa308('0x2e')]=_0x34061b['outboundNoSuchCallsDay'];this[_0xa308('0x2f')]=_0x34061b[_0xa308('0x2f')];this[_0xa308('0xd')]=_0x34061b[_0xa308('0xd')];this['outboundRejectCallsDay']=_0x34061b['outboundRejectCallsDay'];this[_0xa308('0xe')]=_0x34061b[_0xa308('0xe')];this[_0xa308('0x30')]=_0x34061b['predictiveIntervalAnsweredCalls'];this[_0xa308('0x31')]=_0x34061b['predictiveIntervalAvgHoldtime'];this[_0xa308('0x32')]=_0x34061b[_0xa308('0x32')];this[_0xa308('0x33')]=_0x34061b[_0xa308('0x33')];this[_0xa308('0x34')]=_0x34061b[_0xa308('0x34')];this['predictiveIntervalErlangCalls']=_0x34061b[_0xa308('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x34061b['predictiveIntervalErlangCallsDroppedCalls'];this[_0xa308('0x36')]=_0x34061b['predictiveIntervalHitRate'];this[_0xa308('0x37')]=_0x34061b[_0xa308('0x37')];this[_0xa308('0x38')]=_0x34061b['predictiveIntervalPauses'];this[_0xa308('0x39')]=_0x34061b[_0xa308('0x39')];this[_0xa308('0x3a')]=_0x34061b[_0xa308('0x3a')];this[_0xa308('0x8')]=_0x34061b[_0xa308('0x8')];this[_0xa308('0x3b')]=_0x34061b[_0xa308('0x3b')];this[_0xa308('0x3c')]=_0x34061b['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x34061b[_0xa308('0x3d')];this['erlangBusyFactor']=_0x34061b['erlangBusyFactor'];this[_0xa308('0x3e')]=_0x34061b[_0xa308('0x3e')];this[_0xa308('0x3f')]=_0x34061b[_0xa308('0x3f')];this['message']=_0x34061b['message'];this[_0xa308('0x40')]=_0x34061b['statusMessage'];}if(_0x34061b[_0xa308('0x41')]){this[_0xa308('0x41')]={'id':_0x34061b[_0xa308('0x41')]['id'],'name':_0x34061b[_0xa308('0x41')]['name'],'active':_0x34061b['Trunk']['active'],'callerid':_0x34061b['Trunk'][_0xa308('0x42')]};}}VoiceQueueSummary[_0xa308('0x43')][_0xa308('0x44')]=function(_0x35eac0,_0x55c49e,_0x59fb00,_0x218e4b){this['loggedInDb']=0x0;this[_0xa308('0x4')]=0x0;this[_0xa308('0x2')]=0x0;this[_0xa308('0x1e')]=0x0;this[_0xa308('0x17')]=0x0;this[_0xa308('0x6')]=0x0;this['busy']=0x0;this[_0xa308('0x15')]=0x0;this[_0xa308('0x1d')]=0x0;this[_0xa308('0x3')]=0x0;this[_0xa308('0x18')]=0x0;this['onHold']=0x0;if(_0x59fb00){if(_0x59fb00[_0xa308('0x0')]){this[_0xa308('0x0')]=Number(_0x59fb00[_0xa308('0x0')]);}if(_0x59fb00['loggedin']){this[_0xa308('0x7')]=Number(_0x59fb00['loggedin']);}if(_0x59fb00[_0xa308('0x45')]){this[_0xa308('0x20')]=Number(_0x59fb00[_0xa308('0x45')]);}}for(var _0x3e81b9=0x0;_0x3e81b9<_0x35eac0[_0xa308('0x46')];_0x3e81b9++){var _0x201781=_0x55c49e[_0xa308('0x47')+_0x35eac0[_0x3e81b9][_0xa308('0x11')]];if(_0x201781&&_0x201781['online']){this[_0xa308('0x1')]+=0x1;}if(_0x35eac0[_0x3e81b9][_0xa308('0x48')]==='1'){this[_0xa308('0x4')]+=0x1;}if(_0x35eac0[_0x3e81b9][_0xa308('0x2')]==='1'&&!['2','7','8']['includes'](_0x35eac0[_0x3e81b9]['status'])){this[_0xa308('0x2')]+=0x1;}switch(_0x35eac0[_0x3e81b9][_0xa308('0x49')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xa308('0x17')]+=0x1;break;case'2':this[_0xa308('0x6')]+=0x1;break;case'3':this[_0xa308('0x14')]+=0x1;break;case'4':this[_0xa308('0x15')]+=0x1;break;case'5':this[_0xa308('0x1d')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xa308('0x18')]+=0x1;break;case'8':this[_0xa308('0x16')]+=0x1;break;}}if(this[_0xa308('0x22')]===_0xa308('0x4a')){var _0x3a5de0=Object[_0xa308('0x4b')](_0x218e4b);for(var _0x234938=0x0;_0x234938<_0x3a5de0['length'];_0x234938++){var _0x406841=_0x3a5de0[_0x234938];var _0x54465d=_0x218e4b[_0x406841];if(_0x54465d[_0xa308('0x4c')]===this['name']&&_0x54465d[_0xa308('0x1c')]==='dialer'&&_0x54465d[_0xa308('0x4d')]===_0xa308('0x4e')){this['talking']+=0x1;}}if(this['talking']>this[_0xa308('0x6')]){this[_0xa308('0x4')]=this[_0xa308('0x6')];}this[_0xa308('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xa308('0x43')][_0xa308('0x4f')]=function(_0x5d05a4){var _0x4239c4=![];if(_0x5d05a4){_0x4239c4=INBOUND_COUNTERS[_0xa308('0x50')](function(_0x20719f){return this[_0x20719f]!==_0x5d05a4[_0x20719f];},this);}return _0x4239c4;};VoiceQueueSummary['prototype'][_0xa308('0x51')]=function(_0x5e3778){var _0x1ac955=![];var _0x419ede=![];var _0x15739e=![];if(_0x5e3778){_0x1ac955=this['dialMethod']!==_0x5e3778[_0xa308('0x22')]||this[_0xa308('0x52')]!==_0x5e3778[_0xa308('0x52')]||this[_0xa308('0x53')]!==_0x5e3778[_0xa308('0x53')]||this[_0xa308('0x40')]!==_0x5e3778[_0xa308('0x40')];_0x419ede=OUTBOUND_COUNTERS[_0xa308('0x50')](function(_0x2107aa){return this[_0x2107aa]!==_0x5e3778[_0x2107aa];},this);if(this[_0xa308('0x41')]&&_0x5e3778[_0xa308('0x41')]){_0x15739e=this[_0xa308('0x41')][_0xa308('0x11')]!==_0x5e3778[_0xa308('0x41')]['name']||this['Trunk']['active']!==_0x5e3778[_0xa308('0x41')][_0xa308('0x54')];}}return _0x1ac955||_0x419ede||_0x15739e;};VoiceQueueSummary[_0xa308('0x43')][_0xa308('0x55')]=function(_0x15f13b){this[_0xa308('0x5')]=_0x15f13b['answered'];this[_0xa308('0x53')]=_0x15f13b[_0xa308('0x53')];this[_0xa308('0x40')]=_0x15f13b[_0xa308('0x40')];this[_0xa308('0x8')]=_0x15f13b[_0xa308('0x8')];this[_0xa308('0x9')]=_0x15f13b[_0xa308('0x9')];this[_0xa308('0xa')]=_0x15f13b['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x15f13b['outboundBlacklistCallsDay'];this[_0xa308('0x2a')]=_0x15f13b[_0xa308('0x2a')];this[_0xa308('0xb')]=_0x15f13b['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x15f13b['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x15f13b['outboundNoSuchCallsDay'];this[_0xa308('0xd')]=_0x15f13b['outboundReCallsDay'];this[_0xa308('0x56')]=_0x15f13b[_0xa308('0x56')];this['outboundUnknownCallsDay']=_0x15f13b[_0xa308('0xe')];this[_0xa308('0x19')]=_0x15f13b[_0xa308('0x19')];this[_0xa308('0x10')]=_0x15f13b[_0xa308('0x10')];this[_0xa308('0x1b')]=_0x15f13b['total'];if(this[_0xa308('0x22')]===_0xa308('0x57')){this[_0xa308('0xf')]=_0x15f13b[_0xa308('0xf')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3594b4a..c1dcf7e 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 _0x1b31=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x2105c7,_0x46e620){var _0x367796=function(_0x2fded0){while(--_0x2fded0){_0x2105c7['push'](_0x2105c7['shift']());}};_0x367796(++_0x46e620);}(_0x1b31,0x7e));var _0x11b3=function(_0x3c290c,_0x42eec2){_0x3c290c=_0x3c290c-0x0;var _0x57713d=_0x1b31[_0x3c290c];return _0x57713d;};'use strict';function VtigerAccount(_0xc6cc17){this['id']=_0xc6cc17['id']||0x0;this[_0x11b3('0x0')]=_0xc6cc17[_0x11b3('0x0')]||'';this[_0x11b3('0x1')]=_0xc6cc17[_0x11b3('0x1')]||'';this[_0x11b3('0x2')]=_0xc6cc17[_0x11b3('0x2')]||'';this[_0x11b3('0x3')]=_0xc6cc17[_0x11b3('0x3')]||'';this['serverUrl']=_0xc6cc17[_0x11b3('0x4')]||'';this[_0x11b3('0x5')]=_0xc6cc17[_0x11b3('0x5')]||{};}module[_0x11b3('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa412=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x450082,_0x405da5){var _0x8308c0=function(_0x139fc4){while(--_0x139fc4){_0x450082['push'](_0x450082['shift']());}};_0x8308c0(++_0x405da5);}(_0xa412,0x1c3));var _0x2a41=function(_0x258bc6,_0x3fe539){_0x258bc6=_0x258bc6-0x0;var _0x19d493=_0xa412[_0x258bc6];return _0x19d493;};'use strict';function VtigerAccount(_0x1ea84c){this['id']=_0x1ea84c['id']||0x0;this[_0x2a41('0x0')]=_0x1ea84c[_0x2a41('0x0')]||'';this['username']=_0x1ea84c[_0x2a41('0x1')]||'';this['accessKey']=_0x1ea84c[_0x2a41('0x2')]||'';this[_0x2a41('0x3')]=_0x1ea84c[_0x2a41('0x3')]||'';this['serverUrl']=_0x1ea84c[_0x2a41('0x4')]||'';this[_0x2a41('0x5')]=_0x1ea84c[_0x2a41('0x5')]||{};}module[_0x2a41('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a0c5b1e..2647624 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 _0xdb13=['integrationTab','exports','name','username','token','remoteUri','authType','type'];(function(_0x49c7a4,_0x135402){var _0x5f20c2=function(_0xb78560){while(--_0xb78560){_0x49c7a4['push'](_0x49c7a4['shift']());}};_0x5f20c2(++_0x135402);}(_0xdb13,0xb2));var _0x3db1=function(_0x4e4481,_0x51925d){_0x4e4481=_0x4e4481-0x0;var _0x109948=_0xdb13[_0x4e4481];return _0x109948;};'use strict';function ZendeskAccount(_0x29f91b){this['id']=_0x29f91b['id']||0x0;this[_0x3db1('0x0')]=_0x29f91b[_0x3db1('0x0')]||'';this[_0x3db1('0x1')]=_0x29f91b[_0x3db1('0x1')]||'';this['password']=_0x29f91b['password']||'';this[_0x3db1('0x2')]=_0x29f91b[_0x3db1('0x2')]||'';this[_0x3db1('0x3')]=_0x29f91b[_0x3db1('0x3')]||'';this[_0x3db1('0x4')]=_0x29f91b[_0x3db1('0x4')]||'';this[_0x3db1('0x5')]=_0x29f91b[_0x3db1('0x5')]||_0x3db1('0x6');this['serverUrl']=_0x29f91b['serverUrl']||'';this['Configurations']=_0x29f91b['Configurations']||{};}module[_0x3db1('0x7')]=ZendeskAccount; \ No newline at end of file +var _0x5899=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5899,0x85));var _0x9589=function(_0x2c1693,_0x12055){_0x2c1693=_0x2c1693-0x0;var _0x1605bc=_0x5899[_0x2c1693];return _0x1605bc;};'use strict';function ZendeskAccount(_0x5a6a3d){this['id']=_0x5a6a3d['id']||0x0;this[_0x9589('0x0')]=_0x5a6a3d[_0x9589('0x0')]||'';this[_0x9589('0x1')]=_0x5a6a3d[_0x9589('0x1')]||'';this[_0x9589('0x2')]=_0x5a6a3d[_0x9589('0x2')]||'';this[_0x9589('0x3')]=_0x5a6a3d[_0x9589('0x3')]||'';this['remoteUri']=_0x5a6a3d[_0x9589('0x4')]||'';this[_0x9589('0x5')]=_0x5a6a3d[_0x9589('0x5')]||'';this[_0x9589('0x6')]=_0x5a6a3d[_0x9589('0x6')]||_0x9589('0x7');this[_0x9589('0x8')]=_0x5a6a3d[_0x9589('0x8')]||'';this[_0x9589('0x9')]=_0x5a6a3d['Configurations']||{};}module[_0x9589('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 c71847a..a239038 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 _0x2eb8=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x503378,_0x1b9cdc){var _0x11f65c=function(_0x4d8de2){while(--_0x4d8de2){_0x503378['push'](_0x503378['shift']());}};_0x11f65c(++_0x1b9cdc);}(_0x2eb8,0xa6));var _0x82eb=function(_0x39ce72,_0x3e31e3){_0x39ce72=_0x39ce72-0x0;var _0x457ab6=_0x2eb8[_0x39ce72];return _0x457ab6;};'use strict';function ZohoAccount(_0x1f0770){this['id']=_0x1f0770['id']||0x0;this['name']=_0x1f0770[_0x82eb('0x0')]||'';this['description']=_0x1f0770[_0x82eb('0x1')]||'';this['host']=_0x1f0770[_0x82eb('0x2')]||'';this[_0x82eb('0x3')]=_0x1f0770['zone']||'';this['clientId']=_0x1f0770[_0x82eb('0x4')]||'';this[_0x82eb('0x5')]=_0x1f0770[_0x82eb('0x5')]||'';this[_0x82eb('0x6')]=_0x1f0770['serverUrl']||'';this[_0x82eb('0x7')]=_0x1f0770[_0x82eb('0x7')]||'';this['refreshToken']=_0x1f0770[_0x82eb('0x8')]||'';this[_0x82eb('0x9')]=_0x1f0770[_0x82eb('0x9')]||{};}module[_0x82eb('0xa')]=ZohoAccount; \ No newline at end of file +var _0x2d17=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x38bcdb,_0x36175e){var _0x25e102=function(_0x2d1372){while(--_0x2d1372){_0x38bcdb['push'](_0x38bcdb['shift']());}};_0x25e102(++_0x36175e);}(_0x2d17,0x147));var _0x72d1=function(_0x296487,_0x14eab5){_0x296487=_0x296487-0x0;var _0x4c7af7=_0x2d17[_0x296487];return _0x4c7af7;};'use strict';function ZohoAccount(_0x47174d){this['id']=_0x47174d['id']||0x0;this[_0x72d1('0x0')]=_0x47174d[_0x72d1('0x0')]||'';this[_0x72d1('0x1')]=_0x47174d[_0x72d1('0x1')]||'';this[_0x72d1('0x2')]=_0x47174d['host']||'';this[_0x72d1('0x3')]=_0x47174d['zone']||'';this[_0x72d1('0x4')]=_0x47174d[_0x72d1('0x4')]||'';this[_0x72d1('0x5')]=_0x47174d['clientSecret']||'';this[_0x72d1('0x6')]=_0x47174d['serverUrl']||'';this['code']=_0x47174d[_0x72d1('0x7')]||'';this[_0x72d1('0x8')]=_0x47174d[_0x72d1('0x8')]||'';this[_0x72d1('0x9')]=_0x47174d['Configurations']||{};}module[_0x72d1('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index edb190e..4795db2 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 _0xdd4f=['SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','isNil','string','idContact','name','type','queue','membername','Agent','channelAgent','format'];(function(_0x20a394,_0x5c4e0c){var _0x8a454f=function(_0x26d21c){while(--_0x26d21c){_0x20a394['push'](_0x20a394['shift']());}};_0x8a454f(++_0x5c4e0c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xd52277,_0x3cb373){_0xd52277=_0xd52277-0x0;var _0x1f0f21=_0xdd4f[_0xd52277];return _0x1f0f21;};'use strict';var util=require(_0xfdd4('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x55d8f9,_0x291ae7,_0x19cda7){var _0x5918d1='';if(!_[_0xfdd4('0x1')](_0x291ae7)&&_0xfdd4('0x2')===typeof _0x291ae7){_0x5918d1+=_0x291ae7;}if(!_[_0xfdd4('0x1')](_0x19cda7)&&'string'===typeof _0x19cda7){_0x5918d1+='\x20'+_0x19cda7;}if(_0x5918d1!==''){return _0x5918d1;}return _0x55d8f9;}function Action(_0x398015,_0x43cbcf,_0x30e080,_0x307ac6,_0x3c72d4){this['uniqueid']=_0x30e080||undefined;this[_0xfdd4('0x3')]=_0x398015['id'];this['queue']=_0x43cbcf[_0xfdd4('0x4')];this[_0xfdd4('0x5')]=_0x43cbcf[_0xfdd4('0x5')];this['campaigntype']=_0xfdd4('0x6');this['dialAnswer']=![];this[_0xfdd4('0x7')]=_[_0xfdd4('0x1')](_0x398015[_0xfdd4('0x8')])?undefined:_0x398015[_0xfdd4('0x8')][_0xfdd4('0x4')];this[_0xfdd4('0x9')]=this[_0xfdd4('0x7')]?util[_0xfdd4('0xa')](_0xfdd4('0xb'),this[_0xfdd4('0x7')]):_0x307ac6||undefined;this[_0xfdd4('0xc')]=checkNameSurname(_0x398015['Contact'][_0xfdd4('0xd')],_0x398015[_0xfdd4('0xe')][_0xfdd4('0xf')],_0x398015['Contact'][_0xfdd4('0x10')]);this['active']=_0x398015[_0xfdd4('0x11')]||![];this[_0xfdd4('0x12')]=_0x398015[_0xfdd4('0xd')];this[_0xfdd4('0x13')]=_0x398015[_0xfdd4('0x13')];this['countbusyretry']=_0x398015['countbusyretry']||0x0;this['countcongestionretry']=_0x398015[_0xfdd4('0x14')]||0x0;this[_0xfdd4('0x15')]=_0x398015[_0xfdd4('0x15')]||0x0;this[_0xfdd4('0x16')]=(_0x398015[_0xfdd4('0x17')]||0x0)+(_0x398015[_0xfdd4('0x14')]||0x0)+(_0x398015[_0xfdd4('0x15')]||0x0)+(_0x398015[_0xfdd4('0x18')]||0x0)+(_0x398015[_0xfdd4('0x19')]||0x0)+(_0x398015['countabandonedretry']||0x0)+(_0x398015[_0xfdd4('0x1a')]||0x0)+(_0x398015[_0xfdd4('0x1b')]||0x0);this[_0xfdd4('0x18')]=_0x398015[_0xfdd4('0x18')]||0x0;this[_0xfdd4('0x19')]=_0x398015[_0xfdd4('0x19')]||0x0;this[_0xfdd4('0x1c')]=_0x398015[_0xfdd4('0x1c')]||0x0;this['countmachineretry']=_0x398015[_0xfdd4('0x1a')]||0x0;this[_0xfdd4('0x1b')]=_0x398015[_0xfdd4('0x1b')]||0x0;this[_0xfdd4('0x1d')]=_0x398015[_0xfdd4('0x1d')];this[_0xfdd4('0x1e')]=_0x398015[_0xfdd4('0x1e')];this[_0xfdd4('0x1f')]=_0x398015['callbackat'];this[_0xfdd4('0x20')]=_0x398015[_0xfdd4('0x20')];this[_0xfdd4('0x21')]=_0x398015['ContactId'];this[_0xfdd4('0x22')]=_0x398015[_0xfdd4('0x22')];this[_0xfdd4('0x23')]=_[_0xfdd4('0x1')](_0x398015[_0xfdd4('0x8')])?_0x398015['UserId']:_0x398015[_0xfdd4('0x8')]['id'];this[_0xfdd4('0x24')]=_0x398015[_0xfdd4('0x24')];this[_0xfdd4('0x25')]='';this[_0xfdd4('0x26')]='';}Action[_0xfdd4('0x27')][_0xfdd4('0x28')]=function(){return util[_0xfdd4('0xa')]('\x22%s\x22\x20<%s>',this[_0xfdd4('0xc')],this[_0xfdd4('0x29')]);};module[_0xfdd4('0x2a')]=Action; \ No newline at end of file +var _0xe511=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','number','util','lodash','string','isNil','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0x5e0edb,_0x356b7f){var _0x7453b0=function(_0x97b222){while(--_0x97b222){_0x5e0edb['push'](_0x5e0edb['shift']());}};_0x7453b0(++_0x356b7f);}(_0xe511,0x16f));var _0x1e51=function(_0x1b982d,_0x184357){_0x1b982d=_0x1b982d-0x0;var _0x26e916=_0xe511[_0x1b982d];return _0x26e916;};'use strict';var util=require(_0x1e51('0x0'));var _=require(_0x1e51('0x1'));var moment=require('moment');function checkNameSurname(_0x2a5905,_0x5b9e45,_0x253e96){var _0xb75a96='';if(!_['isNil'](_0x5b9e45)&&_0x1e51('0x2')===typeof _0x5b9e45){_0xb75a96+=_0x5b9e45;}if(!_[_0x1e51('0x3')](_0x253e96)&&_0x1e51('0x2')===typeof _0x253e96){_0xb75a96+='\x20'+_0x253e96;}if(_0xb75a96!==''){return _0xb75a96;}return _0x2a5905;}function Action(_0x16ec99,_0x480cca,_0x26b22c,_0x21ed6b,_0x5c4590){this['uniqueid']=_0x26b22c||undefined;this[_0x1e51('0x4')]=_0x16ec99['id'];this[_0x1e51('0x5')]=_0x480cca['name'];this['type']=_0x480cca[_0x1e51('0x6')];this[_0x1e51('0x7')]=_0x1e51('0x5');this[_0x1e51('0x8')]=![];this[_0x1e51('0x9')]=_[_0x1e51('0x3')](_0x16ec99['Agent'])?undefined:_0x16ec99[_0x1e51('0xa')][_0x1e51('0xb')];this[_0x1e51('0xc')]=this[_0x1e51('0x9')]?util[_0x1e51('0xd')](_0x1e51('0xe'),this['membername']):_0x21ed6b||undefined;this[_0x1e51('0xf')]=checkNameSurname(_0x16ec99[_0x1e51('0x10')][_0x1e51('0x11')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x12')],_0x16ec99[_0x1e51('0x10')][_0x1e51('0x13')]);this[_0x1e51('0x14')]=_0x16ec99[_0x1e51('0x14')]||![];this[_0x1e51('0x15')]=_0x16ec99['phone'];this[_0x1e51('0x16')]=_0x16ec99[_0x1e51('0x16')];this[_0x1e51('0x17')]=_0x16ec99['countbusyretry']||0x0;this[_0x1e51('0x18')]=_0x16ec99['countcongestionretry']||0x0;this['countnoanswerretry']=_0x16ec99[_0x1e51('0x19')]||0x0;this[_0x1e51('0x1a')]=(_0x16ec99[_0x1e51('0x17')]||0x0)+(_0x16ec99[_0x1e51('0x18')]||0x0)+(_0x16ec99[_0x1e51('0x19')]||0x0)+(_0x16ec99[_0x1e51('0x1b')]||0x0)+(_0x16ec99['countdropretry']||0x0)+(_0x16ec99[_0x1e51('0x1c')]||0x0)+(_0x16ec99['countmachineretry']||0x0)+(_0x16ec99[_0x1e51('0x1d')]||0x0);this[_0x1e51('0x1b')]=_0x16ec99[_0x1e51('0x1b')]||0x0;this[_0x1e51('0x1e')]=_0x16ec99['countdropretry']||0x0;this['countabandonedretry']=_0x16ec99['countabandonedretry']||0x0;this['countmachineretry']=_0x16ec99[_0x1e51('0x1f')]||0x0;this['countagentrejectretry']=_0x16ec99[_0x1e51('0x1d')]||0x0;this[_0x1e51('0x20')]=_0x16ec99[_0x1e51('0x20')];this[_0x1e51('0x21')]=_0x16ec99[_0x1e51('0x21')];this[_0x1e51('0x22')]=_0x16ec99[_0x1e51('0x22')];this[_0x1e51('0x23')]=_0x16ec99['recallme'];this['ContactId']=_0x16ec99[_0x1e51('0x24')];this[_0x1e51('0x25')]=_0x16ec99[_0x1e51('0x25')];this[_0x1e51('0x26')]=_['isNil'](_0x16ec99['Agent'])?_0x16ec99['UserId']:_0x16ec99[_0x1e51('0xa')]['id'];this[_0x1e51('0x27')]=_0x16ec99[_0x1e51('0x27')];this['originatecalleridnum']='';this[_0x1e51('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x1e51('0xd')]('\x22%s\x22\x20<%s>',this[_0x1e51('0xf')],this[_0x1e51('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e4021fa..106ae1c 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x30bb1d,_0x1d2bbc){var _0x1da085=function(_0x3ad444){while(--_0x3ad444){_0x30bb1d['push'](_0x30bb1d['shift']());}};_0x1da085(++_0x1d2bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x22bac1,_0x38b20e){var _0x41ef2d=function(_0x2a0e0d){while(--_0x2a0e0d){_0x22bac1['push'](_0x22bac1['shift']());}};_0x41ef2d(++_0x38b20e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3bdf988..cf87032 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 _0xe82a=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','[createHistory]\x20','resolve','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','catch','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe82a,0x123));var _0xae82=function(_0x8248b8,_0x51b7c1){_0x8248b8=_0x8248b8-0x0;var _0x2b6274=_0xe82a[_0x8248b8];return _0x2b6274;};'use strict';var util=require(_0xae82('0x0'));var BPromise=require(_0xae82('0x1'));var logger=require('../../../config/logger')(_0xae82('0x2'));var cmHopper=require(_0xae82('0x3'));var cmHopperHistory=require(_0xae82('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xae82('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x358cbc){return function(_0x18d17c){logger[_0xae82('0x6')](_0x358cbc,util['inspect'](_0x18d17c,{'showHidden':![],'depth':null}));};}function create(_0x11b904){return cmHopperHistory['createHistory'](_0x11b904)['catch'](loggerCatch(_0xae82('0x7')));}function createAgent(_0x4b552c){return BPromise[_0xae82('0x8')]()['then'](agentReportPreview[_0xae82('0x9')](_0x4b552c))['catch'](loggerCatch(_0xae82('0x7')));}function moveContact(_0x1f2c4a){return cmHopper['moveContactManagedDialer'](_0x1f2c4a,!![])['catch'](loggerCatch(_0xae82('0xa')));}exports[_0xae82('0xb')]=function(_0x426014){return cmHopperBlack[_0xae82('0xb')](_0x426014)['catch'](loggerCatch(_0xae82('0xc')));};exports[_0xae82('0xd')]=function(_0x594aac){return BPromise[_0xae82('0x8')]()[_0xae82('0xe')](cmHopper[_0xae82('0xd')](_0x594aac))['catch'](loggerCatch(_0xae82('0xf')));};exports[_0xae82('0x9')]=function(_0x5b977c,_0x746373){create(_0x5b977c)['catch'](loggerCatch(_0x746373));moveContact(_0x5b977c)[_0xae82('0x10')](loggerCatch(_0x746373));};exports[_0xae82('0x11')]=function(_0x19fac3,_0x58fec6){createAgent(_0x19fac3)['catch'](loggerCatch(_0x58fec6));};exports[_0xae82('0x12')]=function(_0x13cd2c,_0x5efec3){create(_0x13cd2c)[_0xae82('0x10')](loggerCatch(_0x5efec3));};exports[_0xae82('0x13')]=function(_0x323f72,_0x2a1472){moveContact(_0x323f72)[_0xae82('0x10')](loggerCatch(_0x2a1472));};exports[_0xae82('0x14')]=function(_0x3a1fb3,_0x3180dd,_0x5b23c1){if(_0x3180dd){_0x3a1fb3['UserId']=null;}if(_0x5b23c1){_0x3a1fb3[_0xae82('0x15')]=![];}return cmHopper[_0xae82('0x14')](_0x3a1fb3)['catch'](loggerCatch(_0xae82('0x16')));};exports[_0xae82('0x17')]=function(_0x5ce128){return cmHopper[_0xae82('0x17')](_0x5ce128)[_0xae82('0x10')](loggerCatch('[countReScheduled]\x20'));};exports[_0xae82('0x18')]=function(_0x6e982c){return cmHopper['unlockContact']({'UserId':null},_0x6e982c,0x1)[_0xae82('0x10')](loggerCatch(_0xae82('0x19')));};exports[_0xae82('0x1a')]=function(_0x5a7fd1){return cmHopper['unlockContact']({'active':![]},_0x5a7fd1,0x1)[_0xae82('0x10')](loggerCatch(_0xae82('0x1b')));};exports[_0xae82('0x1c')]=function(_0xde3525){var _0x4b29e5={};_0x4b29e5[_0xae82('0x1d')]=_0xde3525[_0xae82('0x1d')];_0x4b29e5[_0xae82('0x1e')]=_0xde3525[_0xae82('0x1e')];_0x4b29e5['calleridnum']=_0xde3525[_0xae82('0x1f')];_0x4b29e5[_0xae82('0x20')]=_0xde3525[_0xae82('0x20')];_0x4b29e5[_0xae82('0x21')]=_0xde3525['queue'];_0x4b29e5[_0xae82('0x22')]=_0xde3525[_0xae82('0x23')];_0x4b29e5['queuecallerleaveAt']=_0xde3525[_0xae82('0x23')];_0x4b29e5[_0xae82('0x24')]=0x1;_0x4b29e5[_0xae82('0x25')]=_0xde3525['endtime'];_0x4b29e5[_0xae82('0x26')]=_0xde3525[_0xae82('0x27')];_0x4b29e5['context']=_0xae82('0x28');_0x4b29e5[_0xae82('0x29')]=_0xae82('0x2a');_0x4b29e5[_0xae82('0x2b')]=0x0;_0x4b29e5['assigned']=0x1;_0x4b29e5[_0xae82('0x2c')]=_0xde3525['membername'];_0x4b29e5[_0xae82('0x2d')]=_0xae82('0x2e');return BPromise[_0xae82('0x8')]()[_0xae82('0xe')](voiceQueueReport[_0xae82('0x2f')](_0x4b29e5))['catch'](loggerCatch(_0xae82('0x30')));};exports[_0xae82('0x31')]=function(_0x11d97a,_0x363f3e){return BPromise[_0xae82('0x8')]()[_0xae82('0xe')](cmHopper[_0xae82('0x31')](_0x11d97a,_0x363f3e))[_0xae82('0x10')](loggerCatch(_0xae82('0x32')));};exports[_0xae82('0x33')]=function(_0x3add6b){return cmHopper['rescheduleContact'](_0x3add6b,!![],!![])['catch'](loggerCatch(_0xae82('0x34')));}; \ No newline at end of file +var _0x689e=['then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x29ff8f,_0x4c4f8b){var _0x39c3ff=function(_0x4aa5cf){while(--_0x4aa5cf){_0x29ff8f['push'](_0x29ff8f['shift']());}};_0x39c3ff(++_0x4c4f8b);}(_0x689e,0x19b));var _0xe689=function(_0x1ef2d0,_0x4bdfbd){_0x1ef2d0=_0x1ef2d0-0x0;var _0x28f855=_0x689e[_0x1ef2d0];return _0x28f855;};'use strict';var util=require(_0xe689('0x0'));var BPromise=require('bluebird');var logger=require(_0xe689('0x1'))('preview');var cmHopper=require(_0xe689('0x2'));var cmHopperHistory=require(_0xe689('0x3'));var cmHopperBlack=require(_0xe689('0x4'));var agentReportPreview=require(_0xe689('0x5'));var voiceQueueReport=require(_0xe689('0x6'));function loggerCatch(_0x68b37c){return function(_0x1b7ea1){logger[_0xe689('0x7')](_0x68b37c,util[_0xe689('0x8')](_0x1b7ea1,{'showHidden':![],'depth':null}));};}function create(_0x3b94dd){return cmHopperHistory[_0xe689('0x9')](_0x3b94dd)[_0xe689('0xa')](loggerCatch(_0xe689('0xb')));}function createAgent(_0x5b37dd){return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](agentReportPreview[_0xe689('0x9')](_0x5b37dd))[_0xe689('0xa')](loggerCatch(_0xe689('0xb')));}function moveContact(_0x412b8c){return cmHopper[_0xe689('0xe')](_0x412b8c,!![])[_0xe689('0xa')](loggerCatch(_0xe689('0xf')));}exports[_0xe689('0x10')]=function(_0x30a228){return cmHopperBlack[_0xe689('0x10')](_0x30a228)[_0xe689('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xe689('0x11')]=function(_0x87fbfb){return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](cmHopper[_0xe689('0x11')](_0x87fbfb))['catch'](loggerCatch(_0xe689('0x12')));};exports['createHistory']=function(_0x12a2f1,_0xd98908){create(_0x12a2f1)[_0xe689('0xa')](loggerCatch(_0xd98908));moveContact(_0x12a2f1)[_0xe689('0xa')](loggerCatch(_0xd98908));};exports[_0xe689('0x13')]=function(_0x50ae08,_0x95c784){createAgent(_0x50ae08)['catch'](loggerCatch(_0x95c784));};exports[_0xe689('0x14')]=function(_0x33965b,_0x481cae){create(_0x33965b)[_0xe689('0xa')](loggerCatch(_0x481cae));};exports[_0xe689('0x15')]=function(_0x18deba,_0x21f682){moveContact(_0x18deba)[_0xe689('0xa')](loggerCatch(_0x21f682));};exports[_0xe689('0x16')]=function(_0x39a905,_0x427e90,_0x23821e){if(_0x427e90){_0x39a905[_0xe689('0x17')]=null;}if(_0x23821e){_0x39a905[_0xe689('0x18')]=![];}return cmHopper['rescheduleContact'](_0x39a905)[_0xe689('0xa')](loggerCatch(_0xe689('0x19')));};exports[_0xe689('0x1a')]=function(_0x5ca860){return cmHopper[_0xe689('0x1a')](_0x5ca860)[_0xe689('0xa')](loggerCatch(_0xe689('0x1b')));};exports[_0xe689('0x1c')]=function(_0x3cbdf6){return cmHopper['unlockContact']({'UserId':null},_0x3cbdf6,0x1)['catch'](loggerCatch(_0xe689('0x1d')));};exports['disableContact']=function(_0x3bf37d){return cmHopper['unlockContact']({'active':![]},_0x3bf37d,0x1)[_0xe689('0xa')](loggerCatch(_0xe689('0x1e')));};exports[_0xe689('0x1f')]=function(_0x38ff89){var _0x122f5e={};_0x122f5e[_0xe689('0x20')]=_0x38ff89['type'];_0x122f5e['uniqueid']=_0x38ff89[_0xe689('0x21')];_0x122f5e[_0xe689('0x22')]=_0x38ff89[_0xe689('0x22')];_0x122f5e['calleridname']=_0x38ff89['calleridname'];_0x122f5e[_0xe689('0x23')]=_0x38ff89[_0xe689('0x23')];_0x122f5e[_0xe689('0x24')]=_0x38ff89[_0xe689('0x25')];_0x122f5e[_0xe689('0x26')]=_0x38ff89[_0xe689('0x25')];_0x122f5e['queuecallercomplete']=0x1;_0x122f5e['queuecallercompleteAt']=_0x38ff89[_0xe689('0x27')];_0x122f5e['connectedlinename']=_0x38ff89['membername'];_0x122f5e[_0xe689('0x28')]=_0xe689('0x29');_0x122f5e[_0xe689('0x2a')]=_0xe689('0x2b');_0x122f5e['holdtime']=0x0;_0x122f5e[_0xe689('0x2c')]=0x1;_0x122f5e[_0xe689('0x2d')]=_0x38ff89[_0xe689('0x2e')];_0x122f5e[_0xe689('0x2f')]=_0xe689('0x30');return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](voiceQueueReport[_0xe689('0x31')](_0x122f5e))[_0xe689('0xa')](loggerCatch(_0xe689('0x32')));};exports[_0xe689('0x33')]=function(_0x50a548,_0x317817){return BPromise[_0xe689('0xc')]()[_0xe689('0xd')](cmHopper[_0xe689('0x33')](_0x50a548,_0x317817))[_0xe689('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xe689('0x34')]=function(_0x41c608){return cmHopper[_0xe689('0x16')](_0x41c608,!![],!![])[_0xe689('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 75ff933..3cd517a 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 _0xbc50=['_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','getSeconds','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','motionChannel','voice','mandatoryDisposition','not_inuse','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','callback','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','moment','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','inspect','info','loggerError','error','message','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc50,0xea));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0bc5('0x0'));var _=require('lodash');var moment=require(_0x0bc5('0x1'));var logger=require('../../../../config/logger')(_0x0bc5('0x2'));var ipAgi=process[_0x0bc5('0x3')]['XCALLY_IP_AGI']||_0x0bc5('0x4');var utils=require(_0x0bc5('0x5'));exports[_0x0bc5('0x6')]=function(_0x110c5d){return function(_0x5028bb){logger['error'](_0x110c5d,util[_0x0bc5('0x7')](_0x5028bb,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x128604,_0x89e146){logger[_0x0bc5('0x8')](_0x128604,util[_0x0bc5('0x7')](_0x89e146,{'showHidden':![],'depth':null}));};exports[_0x0bc5('0x9')]=function(_0x8d64f8,_0x439e89){logger[_0x0bc5('0xa')](_0x8d64f8,util[_0x0bc5('0x7')](_0x439e89,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4fb49a){return function(_0x243b1d){logger['info'](_0x4fb49a,util[_0x0bc5('0x7')](_0x243b1d,{'showHidden':![],'depth':null}));};};exports[_0x0bc5('0xb')]=function(_0xb04067,_0x27d5df,_0x2f97a2){return{'message':_0xb04067,'unlock':_0x27d5df,'active':_0x2f97a2};};exports['getCallerId']=function(_0x53ccc0,_0xa40dfc,_0x269696){if(!_['isUndefined'](_0x269696)&&'string'===typeof _0x269696&&!_['isEmpty'](_0x269696)){if(!_['isUndefined'](_0xa40dfc)&&_0x0bc5('0xc')===typeof _0xa40dfc&&!_[_0x0bc5('0xd')](_0xa40dfc)){return util[_0x0bc5('0xe')](_0x0bc5('0xf'),_0xa40dfc,_0x269696);}return util[_0x0bc5('0xe')]('\x22%s\x22\x20<%s>',_0x269696,_0x269696);}if(!_['isUndefined'](_0x53ccc0)&&_0x0bc5('0xc')===typeof _0x53ccc0&&!_['isEmpty'](_0x53ccc0)){return _0x53ccc0;}return _0x0bc5('0x10');};exports['isActive']=function(_0x276195){if(_[_0x0bc5('0x11')](_0x276195)){return![];}return _0x276195;};exports['addVariables']=function(_0x412628,_0x2e7cad,_0x42ee21,_0x4bfc5c,_0xc233e6,_0xdb2b97){var _0x42a9bb={'XMD-QUEUE':_0x2e7cad[_0x0bc5('0x12')]?_0x2e7cad[_0x0bc5('0x12')][_0x0bc5('0x13')]:'','XMD-CALLERID':_0x4bfc5c,'XMD-CALLERID-PREVIEW':_0xdb2b97?util[_0x0bc5('0xe')]('\x22%s\x22\x20<%s>',_0xdb2b97[_0x0bc5('0x14')],_0xdb2b97[_0x0bc5('0x15')]):_0x4bfc5c,'XMD-DIALID':_0xc233e6,'XMD-CONTACTID':_0x2e7cad[_0x0bc5('0x16')],'XMD-CDRTYPE':_0x0bc5('0x17'),'CALLERID(all)':_0x4bfc5c,'XMD-VOICEQUEUEID':_0x2e7cad[_0x0bc5('0x18')],'XMD-DIALCHANNEL':_0x42ee21,'XMD-DIALTIMEOUT':_0x412628[_0x0bc5('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x0bc5('0x1a'),_0x412628[_0x0bc5('0x1b')]?'g':'',_[_0x0bc5('0xd')](_0x412628[_0x0bc5('0x1c')])?'':_0x0bc5('0x1d')),'XMD-DIALURL':_0x412628[_0x0bc5('0x1e')]||'','XMD-AGI':_0x412628[_0x0bc5('0x1f')]?util[_0x0bc5('0xe')](_0x0bc5('0x20'),ipAgi,_0x412628[_0x0bc5('0x1f')]):_0x0bc5('0x21'),'XMD-AGIAFTER':_0x412628[_0x0bc5('0x1b')]?util['format'](_0x0bc5('0x20'),ipAgi,_0x412628[_0x0bc5('0x1b')]):_0x0bc5('0x21'),'XMD-ORIGINATECALLERIDNUM':_0xdb2b97?_0xdb2b97[_0x0bc5('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0xdb2b97?_0xdb2b97[_0x0bc5('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x0bc5('0x24')};if(!_['isEmpty'](_0x412628[_0x0bc5('0x1c')])){_0x42a9bb[util[_0x0bc5('0xe')]('%s',_0x0bc5('0x25'))]=_0x412628[_0x0bc5('0x1c')];_0x42a9bb[util[_0x0bc5('0xe')]('%s',_0x0bc5('0x26'))]=_0xc233e6;}return _0x42a9bb;};exports[_0x0bc5('0x27')]=function(_0x51763b){var _0x57984e={};for(var _0x185c0a in _0x51763b){if(_0x51763b[_0x0bc5('0x28')](_0x185c0a)){_0x57984e[util[_0x0bc5('0xe')]('%s',_[_0x0bc5('0x29')](_0x185c0a))]=_0x51763b[_0x185c0a];}}return{'variables':_0x57984e};};exports['updateOriginated']=function(_0x319534,_0x465862){if(!_[_0x0bc5('0x11')](_0x319534)){if(_0x319534[_0x0bc5('0x28')](_0x0bc5('0x2a'))){if(_0x319534[_0x0bc5('0x2a')]>0x0){_0x319534[_0x0bc5('0x2a')]-=0x1;}else{logger[_0x0bc5('0xa')](_0x0bc5('0x2b'),_0x465862);}}}else{logger['error'](_0x0bc5('0x2c'),_0x465862);}};exports['logBlacklist']=function(_0x57309f){var _0x4fe68f=moment()['format'](_0x0bc5('0x2d'));_0x57309f[_0x0bc5('0x2e')]=0xd;_0x57309f[_0x0bc5('0x2f')]=_0x0bc5('0x30');_0x57309f[_0x0bc5('0x31')]=_0x4fe68f;_0x57309f[_0x0bc5('0x32')]=_0x4fe68f;_0x57309f[_0x0bc5('0x33')]=_0x4fe68f;};exports['logAgent']=function(_0x1ea988,_0x5d61ed,_0xda56da){var _0x169175=moment()[_0x0bc5('0xe')](_0x0bc5('0x2d'));_0x1ea988[_0x0bc5('0x2e')]=_0x5d61ed;_0x1ea988[_0x0bc5('0x2f')]=_0xda56da;_0x1ea988[_0x0bc5('0x32')]=_0x169175;_0x1ea988[_0x0bc5('0x34')]=utils['getSeconds'](_0x1ea988['responsetime'],_0x1ea988[_0x0bc5('0x31')]);};exports[_0x0bc5('0x35')]=function(_0x417d93,_0xbbab80,_0x145621){_0x417d93[_0x0bc5('0x36')]=_0xbbab80;_0x417d93[_0x0bc5('0x37')]=_0x145621;};exports['logCustomer']=function(_0x6fdda1,_0x304807,_0x8f1985){var _0x1217b8=moment()[_0x0bc5('0xe')](_0x0bc5('0x2d'));_0x6fdda1[_0x0bc5('0x2e')]=_0x304807;_0x6fdda1[_0x0bc5('0x2f')]=_0x8f1985;_0x6fdda1['responsetime']=_0x6fdda1[_0x0bc5('0x32')]?_0x6fdda1[_0x0bc5('0x32')]:_0x1217b8;_0x6fdda1[_0x0bc5('0x33')]=_0x6fdda1[_0x0bc5('0x33')]?_0x6fdda1[_0x0bc5('0x33')]:_0x1217b8;_0x6fdda1[_0x0bc5('0x34')]=utils[_0x0bc5('0x38')](_0x6fdda1[_0x0bc5('0x32')]||0x0,_0x6fdda1[_0x0bc5('0x31')]||0x0);_0x6fdda1[_0x0bc5('0x39')]=_0x6fdda1[_0x0bc5('0x3a')]?utils[_0x0bc5('0x38')](_0x6fdda1[_0x0bc5('0x33')],_0x6fdda1[_0x0bc5('0x3a')]):0x0;};exports[_0x0bc5('0x3b')]=function(_0x249593){return _0x249593===_0x0bc5('0x3c');};exports['variablesAction']=function(_0x4b4d4b,_0x473f8b,_0x220a5a,_0x3ff314,_0x1c969c){var _0x380917=_0x3ff314?_0x0bc5('0x3d'):_0x4b4d4b[_0x0bc5('0x14')];_0x380917=_0x1c969c?_0x0bc5('0x3e'):_0x380917;return{'actionid':_0x4b4d4b[_0x0bc5('0x3f')],'action':_0x0bc5('0x40'),'channel':_0x4b4d4b[_0x0bc5('0x41')],'callerid':util[_0x0bc5('0xe')](_0x0bc5('0xf'),_0x380917,_0x4b4d4b[_0x0bc5('0x15')]),'Exten':_0x0bc5('0x42'),'Context':_0x0bc5('0x43'),'Priority':'1','variable':_0x220a5a,'timeout':(_0x473f8b[_0x0bc5('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4b4d4b['uniqueid']};};exports[_0x0bc5('0x45')]=function(_0xa12286){return _0xa12286[_0x0bc5('0x46')]+_0xa12286['countcongestionretry']+_0xa12286[_0x0bc5('0x47')]+_0xa12286[_0x0bc5('0x48')]+_0xa12286['countnosuchnumberretry'];};exports[_0x0bc5('0x49')]=function(_0x4dd441){var _0x36598a=_[_0x0bc5('0x4a')](_0x4dd441);_0x36598a['state']=0xf;_0x36598a[_0x0bc5('0x2f')]=_0x0bc5('0x4b');return _0x36598a;};exports[_0x0bc5('0x4c')]=function(_0x4961a3,_0x50a267,_0x1972a7){var _0x5abb39={};_0x5abb39[_0x50a267]=_0x4961a3[_0x50a267];_0x5abb39[_0x0bc5('0x4d')]=![];_0x5abb39['scheduledat']=moment()[_0x0bc5('0x4e')](_0x1972a7,_0x0bc5('0x4f'))[_0x0bc5('0xe')](_0x0bc5('0x2d'));_0x5abb39['ContactId']=_0x4961a3[_0x0bc5('0x16')];_0x5abb39[_0x0bc5('0x50')]=_0x4961a3[_0x0bc5('0x50')];_0x5abb39[_0x0bc5('0x18')]=_0x4961a3[_0x0bc5('0x18')]||undefined;return _0x5abb39;};exports[_0x0bc5('0x51')]=function(_0x249f74,_0x35d957){if(!_[_0x0bc5('0x11')](_0x249f74)){if(_0x249f74['pTalking']>0x0){_0x249f74['pTalking']-=0x1;}else{logger['error'](_0x35d957,_0x0bc5('0x52'));}}else{logger['error'](_0x35d957,_0x0bc5('0x53'));}};exports['IsNotLoggedIn']=function(_0xe91a69){if(_0xe91a69<=0x0){return!![];}return![];};function buildObj(_0x43d098,_0x56e944,_0x50cb30){_0x43d098[_0x0bc5('0x54')]=_0x56e944;_0x43d098['name']=_0x43d098[_0x0bc5('0x55')];_0x43d098['interface']=_0x43d098[_0x0bc5('0x41')];_0x43d098[_0x0bc5('0x56')]=_0x0bc5('0x57');if(_0x50cb30){_0x43d098[_0x0bc5('0x58')]=_0x50cb30[_0x0bc5('0x58')];}return _0x43d098;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0xde697d){var _0x2428dc=[];for(var _0x215139 in _0xde697d){if(_0xde697d[_0x0bc5('0x28')](_0x215139)){if(!_['isNil'](_0xde697d[_0x215139])&&_0xde697d[_0x215139][_0x0bc5('0x2e')]===_0x0bc5('0x59')&&_0xde697d[_0x215139][_0x0bc5('0x5a')]===_0x0bc5('0x5b')){_0x2428dc[_0x0bc5('0x5c')](_0xde697d[_0x215139]['id']);}}}return _0x2428dc;};exports[_0x0bc5('0x5d')]=function(_0x532d41){var _0x1c2068=moment()['milliseconds'](0x0);var _0x5cbf40=moment(_0x532d41)[_0x0bc5('0x5e')](0x0);return _0x1c2068[_0x0bc5('0x5f')](_0x5cbf40,'seconds');};exports[_0x0bc5('0x60')]=function(_0x5a8aec){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a8aec['ContactId'],'ListId':_0x5a8aec[_0x0bc5('0x50')],'VoiceQueueId':_0x5a8aec[_0x0bc5('0x18')]||undefined,'CampaignId':_0x5a8aec[_0x0bc5('0x61')]||undefined};};exports[_0x0bc5('0x62')]=function(_0x44f932){if(_0x44f932===_0x0bc5('0x3f')||_0x44f932===_0x0bc5('0x63')||_0x44f932===_0x0bc5('0x55')||_0x44f932===_0x0bc5('0x64')||_0x44f932===_0x0bc5('0x65')||_0x44f932==='dialAnswer'||_0x44f932===_0x0bc5('0x36')||_0x44f932===_0x0bc5('0x41')||_0x44f932===_0x0bc5('0x14')||_0x44f932===_0x0bc5('0x4d')||_0x44f932===_0x0bc5('0x15')||_0x44f932===_0x0bc5('0x66')||_0x44f932===_0x0bc5('0x46')||_0x44f932==='countcongestionretry'||_0x44f932===_0x0bc5('0x47')||_0x44f932==='countglobal'||_0x44f932===_0x0bc5('0x67')||_0x44f932==='callbackuniqueid'||_0x44f932===_0x0bc5('0x68')||_0x44f932===_0x0bc5('0x69')||_0x44f932===_0x0bc5('0x16')||_0x44f932==='ListId'||_0x44f932===_0x0bc5('0x37')||_0x44f932===_0x0bc5('0x18')||_0x44f932==='sipcallid'||_0x44f932==='xmd-voicequeueid'||_0x44f932===_0x0bc5('0x6a')||_0x44f932===_0x0bc5('0x6b')||_0x44f932===_0x0bc5('0x6c')||_0x44f932===_0x0bc5('0x6d')||_0x44f932==='xmd-dialtimeout'||_0x44f932===_0x0bc5('0x6e')||_0x44f932===_0x0bc5('0x6f')||_0x44f932===_0x0bc5('0x70')||_0x44f932===_0x0bc5('0x71')||_0x44f932===_0x0bc5('0x72')||_0x44f932==='xmd-callerid'||_0x44f932===_0x0bc5('0x73')||_0x44f932==='xmd-agi'||_0x44f932===_0x0bc5('0x74')||_0x44f932===_0x0bc5('0x75')||_0x44f932===_0x0bc5('0x76')||_0x44f932===_0x0bc5('0x77')||_0x44f932==='rtpaudioqosloss'||_0x44f932===_0x0bc5('0x78')||_0x44f932===_0x0bc5('0x79')||_0x44f932===_0x0bc5('0x7a')||_0x44f932==='rtpaudioqos'||_0x44f932===_0x0bc5('0x75')||_0x44f932===_0x0bc5('0x76')||_0x44f932===_0x0bc5('0x77')||_0x44f932==='rtpaudioqosloss'||_0x44f932===_0x0bc5('0x78')||_0x44f932==='rtpaudioqosrtt'||_0x44f932===_0x0bc5('0x7a')||_0x44f932==='bridgepeer'||_0x44f932===_0x0bc5('0x7b')||_0x44f932===_0x0bc5('0x2e')||_0x44f932==='statedesc'){return![];}return!![];};exports[_0x0bc5('0x7c')]=function(_0x429f40,_0x4ec7e0){var _0x365483,_0x28d792,_0xe9a6b8;if(_0x4ec7e0<=0x0){_0x4ec7e0=0x1;}_0x365483=new RegExp(_0x0bc5('0x7d')+_0x4ec7e0+'}$');_0x28d792=Math[_0x0bc5('0x7e')](0xa,_0x4ec7e0-0x1);_0xe9a6b8=Math[_0x0bc5('0x7e')](0xa,_0x4ec7e0)-0x1;return util[_0x0bc5('0xe')]('%s',_[_0x0bc5('0x7f')](_0x429f40,_0x365483,_[_0x0bc5('0x80')](_0x28d792,_0xe9a6b8)));};exports['extractCalleridName']=function(_0x1b1126){var _0xf2392f=_0x1b1126[_0x0bc5('0x81')](/"(.*?)"/);return _0xf2392f?_0xf2392f[0x1]:_0x1b1126;};exports[_0x0bc5('0x82')]=function(_0x580dde){var _0x1ed15b=_0x580dde[_0x0bc5('0x81')](/<(.*?)>/);return _0x1ed15b?_0x1ed15b[0x1]:_0x580dde;};function buildNoAnswerEventPayload(_0x3394cd,_0x5c7fc2){var _0x4dab8a=buildObj(_0x3394cd,_0x0bc5('0x83'));if(!_[_0x0bc5('0xd')](_0x5c7fc2[_0x0bc5('0x84')])){Object[_0x0bc5('0x85')](_0x5c7fc2[_0x0bc5('0x84')])[_0x0bc5('0x86')](function(_0x23eff6){_0x4dab8a[_0x23eff6['toLowerCase']()]=_0x5c7fc2[_0x0bc5('0x84')][_0x23eff6];});}return _0x4dab8a;}exports[_0x0bc5('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xc5ba=['rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','pow','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','logAgent','state','statedesc','ringtime','getSeconds','logLookAgent','logCustomer','endtime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','queue','type','dialAnswer','membername','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0xc5ba,0x134));var _0xac5b=function(_0x65d13d,_0x49e929){_0x65d13d=_0x65d13d-0x0;var _0x309bb3=_0xc5ba[_0x65d13d];return _0x309bb3;};'use strict';var util=require(_0xac5b('0x0'));var _=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var logger=require(_0xac5b('0x3'))(_0xac5b('0x4'));var ipAgi=process[_0xac5b('0x5')][_0xac5b('0x6')]||_0xac5b('0x7');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x5a6b1a){return function(_0x334f67){logger[_0xac5b('0x8')](_0x5a6b1a,util[_0xac5b('0x9')](_0x334f67,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3967fb,_0xfef92f){logger[_0xac5b('0xa')](_0x3967fb,util[_0xac5b('0x9')](_0xfef92f,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x479afb,_0x1f6ff5){logger[_0xac5b('0x8')](_0x479afb,util['inspect'](_0x1f6ff5,{'showHidden':![],'depth':null}));};exports[_0xac5b('0xb')]=function(_0x155e03){return function(_0x2711a2){logger[_0xac5b('0xa')](_0x155e03,util[_0xac5b('0x9')](_0x2711a2,{'showHidden':![],'depth':null}));};};exports[_0xac5b('0xc')]=function(_0x3c75da,_0x11ef6d,_0x24b94e){return{'message':_0x3c75da,'unlock':_0x11ef6d,'active':_0x24b94e};};exports['getCallerId']=function(_0x5e12f5,_0x12f1d5,_0x1e347e){if(!_[_0xac5b('0xd')](_0x1e347e)&&_0xac5b('0xe')===typeof _0x1e347e&&!_[_0xac5b('0xf')](_0x1e347e)){if(!_['isUndefined'](_0x12f1d5)&&'string'===typeof _0x12f1d5&&!_['isEmpty'](_0x12f1d5)){return util[_0xac5b('0x10')](_0xac5b('0x11'),_0x12f1d5,_0x1e347e);}return util[_0xac5b('0x10')](_0xac5b('0x11'),_0x1e347e,_0x1e347e);}if(!_['isUndefined'](_0x5e12f5)&&'string'===typeof _0x5e12f5&&!_[_0xac5b('0xf')](_0x5e12f5)){return _0x5e12f5;}return _0xac5b('0x12');};exports[_0xac5b('0x13')]=function(_0x19ce6e){if(_[_0xac5b('0x14')](_0x19ce6e)){return![];}return _0x19ce6e;};exports[_0xac5b('0x15')]=function(_0x1cb764,_0x41685c,_0x13476f,_0x373f43,_0x11b6b7,_0x3a46af){var _0x5a7fd8={'XMD-QUEUE':_0x41685c[_0xac5b('0x16')]?_0x41685c['Queue'][_0xac5b('0x17')]:'','XMD-CALLERID':_0x373f43,'XMD-CALLERID-PREVIEW':_0x3a46af?util[_0xac5b('0x10')](_0xac5b('0x11'),_0x3a46af[_0xac5b('0x18')],_0x3a46af[_0xac5b('0x19')]):_0x373f43,'XMD-DIALID':_0x11b6b7,'XMD-CONTACTID':_0x41685c[_0xac5b('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x373f43,'XMD-VOICEQUEUEID':_0x41685c[_0xac5b('0x1b')],'XMD-DIALCHANNEL':_0x13476f,'XMD-DIALTIMEOUT':_0x1cb764[_0xac5b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xac5b('0x10')]('\x22rtTxX%s%s\x22',_0x1cb764['dialQueueProject2']?'g':'',_['isEmpty'](_0x1cb764['monitor_format'])?'':_0xac5b('0x1d')),'XMD-DIALURL':_0x1cb764[_0xac5b('0x1e')]||'','XMD-AGI':_0x1cb764[_0xac5b('0x1f')]?util[_0xac5b('0x10')](_0xac5b('0x20'),ipAgi,_0x1cb764[_0xac5b('0x1f')]):_0xac5b('0x21'),'XMD-AGIAFTER':_0x1cb764[_0xac5b('0x22')]?util[_0xac5b('0x10')](_0xac5b('0x20'),ipAgi,_0x1cb764[_0xac5b('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3a46af?_0x3a46af[_0xac5b('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a46af?_0x3a46af[_0xac5b('0x24')]:'','XMD-DESTINATION':_0xac5b('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x1cb764[_0xac5b('0x26')])){_0x5a7fd8[util[_0xac5b('0x10')]('%s',_0xac5b('0x27'))]=_0x1cb764[_0xac5b('0x26')];_0x5a7fd8[util[_0xac5b('0x10')]('%s',_0xac5b('0x28'))]=_0x11b6b7;}return _0x5a7fd8;};exports['toLowerVariables']=function(_0xf30ca){var _0x2df5d0={};for(var _0x89f0f8 in _0xf30ca){if(_0xf30ca['hasOwnProperty'](_0x89f0f8)){_0x2df5d0[util[_0xac5b('0x10')]('%s',_[_0xac5b('0x29')](_0x89f0f8))]=_0xf30ca[_0x89f0f8];}}return{'variables':_0x2df5d0};};exports[_0xac5b('0x2a')]=function(_0x1dece5,_0x341b67){if(!_[_0xac5b('0x14')](_0x1dece5)){if(_0x1dece5[_0xac5b('0x2b')](_0xac5b('0x2c'))){if(_0x1dece5[_0xac5b('0x2c')]>0x0){_0x1dece5['originated']-=0x1;}else{logger[_0xac5b('0x8')](_0xac5b('0x2d'),_0x341b67);}}}else{logger[_0xac5b('0x8')](_0xac5b('0x2e'),_0x341b67);}};exports['logBlacklist']=function(_0x2f6bbb){var _0x34b5e0=moment()[_0xac5b('0x10')](_0xac5b('0x2f'));_0x2f6bbb['state']=0xd;_0x2f6bbb['statedesc']=_0xac5b('0x30');_0x2f6bbb[_0xac5b('0x31')]=_0x34b5e0;_0x2f6bbb[_0xac5b('0x32')]=_0x34b5e0;_0x2f6bbb['endtime']=_0x34b5e0;};exports[_0xac5b('0x33')]=function(_0x5adc94,_0x3c325d,_0x33e4ec){var _0x216ab8=moment()['format'](_0xac5b('0x2f'));_0x5adc94[_0xac5b('0x34')]=_0x3c325d;_0x5adc94[_0xac5b('0x35')]=_0x33e4ec;_0x5adc94[_0xac5b('0x32')]=_0x216ab8;_0x5adc94[_0xac5b('0x36')]=utils[_0xac5b('0x37')](_0x5adc94['responsetime'],_0x5adc94[_0xac5b('0x31')]);};exports[_0xac5b('0x38')]=function(_0x13cbe8,_0x3d636a,_0x519fac){_0x13cbe8['membername']=_0x3d636a;_0x13cbe8['UserId']=_0x519fac;};exports[_0xac5b('0x39')]=function(_0x3d1a07,_0x1acd05,_0x87bfe6){var _0xe642b=moment()['format'](_0xac5b('0x2f'));_0x3d1a07[_0xac5b('0x34')]=_0x1acd05;_0x3d1a07[_0xac5b('0x35')]=_0x87bfe6;_0x3d1a07[_0xac5b('0x32')]=_0x3d1a07[_0xac5b('0x32')]?_0x3d1a07[_0xac5b('0x32')]:_0xe642b;_0x3d1a07[_0xac5b('0x3a')]=_0x3d1a07[_0xac5b('0x3a')]?_0x3d1a07[_0xac5b('0x3a')]:_0xe642b;_0x3d1a07[_0xac5b('0x36')]=utils[_0xac5b('0x37')](_0x3d1a07[_0xac5b('0x32')]||0x0,_0x3d1a07['starttime']||0x0);_0x3d1a07['talktime']=_0x3d1a07[_0xac5b('0x3b')]?utils[_0xac5b('0x37')](_0x3d1a07[_0xac5b('0x3a')],_0x3d1a07[_0xac5b('0x3b')]):0x0;};exports[_0xac5b('0x3c')]=function(_0x5ce1e2){return _0x5ce1e2===_0xac5b('0x3d');};exports[_0xac5b('0x3e')]=function(_0x58900b,_0x435e4a,_0x45c891,_0x1572bf,_0x569fdf){var _0x83c9e1=_0x1572bf?_0xac5b('0x3f'):_0x58900b[_0xac5b('0x18')];_0x83c9e1=_0x569fdf?'BOOKED':_0x83c9e1;return{'actionid':_0x58900b[_0xac5b('0x40')],'action':'originate','channel':_0x58900b[_0xac5b('0x41')],'callerid':util[_0xac5b('0x10')](_0xac5b('0x11'),_0x83c9e1,_0x58900b[_0xac5b('0x19')]),'Exten':'xcally-motion-preview','Context':_0xac5b('0x42'),'Priority':'1','variable':_0x45c891,'timeout':(_0x435e4a[_0xac5b('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58900b[_0xac5b('0x40')]};};exports[_0xac5b('0x44')]=function(_0x24ff64){return _0x24ff64['countbusyretry']+_0x24ff64[_0xac5b('0x45')]+_0x24ff64[_0xac5b('0x46')]+_0x24ff64[_0xac5b('0x47')]+_0x24ff64[_0xac5b('0x48')];};exports['cloneAction']=function(_0x2f45d1){var _0x140b92=_[_0xac5b('0x49')](_0x2f45d1);_0x140b92[_0xac5b('0x34')]=0xf;_0x140b92[_0xac5b('0x35')]=_0xac5b('0x4a');return _0x140b92;};exports[_0xac5b('0x4b')]=function(_0x412333,_0x2c3b58,_0x217092){var _0x8e472c={};_0x8e472c[_0x2c3b58]=_0x412333[_0x2c3b58];_0x8e472c[_0xac5b('0x4c')]=![];_0x8e472c[_0xac5b('0x4d')]=moment()[_0xac5b('0x4e')](_0x217092,_0xac5b('0x4f'))[_0xac5b('0x10')](_0xac5b('0x2f'));_0x8e472c[_0xac5b('0x1a')]=_0x412333[_0xac5b('0x1a')];_0x8e472c[_0xac5b('0x50')]=_0x412333[_0xac5b('0x50')];_0x8e472c[_0xac5b('0x1b')]=_0x412333['VoiceQueueId']||undefined;return _0x8e472c;};exports[_0xac5b('0x51')]=function(_0x3b0a64,_0x3e1ff6){if(!_[_0xac5b('0x14')](_0x3b0a64)){if(_0x3b0a64[_0xac5b('0x52')]>0x0){_0x3b0a64[_0xac5b('0x52')]-=0x1;}else{logger[_0xac5b('0x8')](_0x3e1ff6,_0xac5b('0x53'));}}else{logger[_0xac5b('0x8')](_0x3e1ff6,_0xac5b('0x54'));}};exports[_0xac5b('0x55')]=function(_0x3ce419){if(_0x3ce419<=0x0){return!![];}return![];};function buildObj(_0x3f4ecc,_0xa1dac9,_0x16e9b5){_0x3f4ecc['lastevent']=_0xa1dac9;_0x3f4ecc[_0xac5b('0x17')]=_0x3f4ecc['queue'];_0x3f4ecc[_0xac5b('0x56')]=_0x3f4ecc[_0xac5b('0x41')];_0x3f4ecc[_0xac5b('0x57')]=_0xac5b('0x58');if(_0x16e9b5){_0x3f4ecc[_0xac5b('0x59')]=_0x16e9b5[_0xac5b('0x59')];}return _0x3f4ecc;}exports[_0xac5b('0x5a')]=buildObj;exports[_0xac5b('0x5b')]=function(_0x5bee1){var _0x1ba822=[];for(var _0x5a3abc in _0x5bee1){if(_0x5bee1['hasOwnProperty'](_0x5a3abc)){if(!_[_0xac5b('0x14')](_0x5bee1[_0x5a3abc])&&_0x5bee1[_0x5a3abc]['state']===_0xac5b('0x5c')&&_0x5bee1[_0x5a3abc][_0xac5b('0x5d')]===_0xac5b('0x5e')){_0x1ba822[_0xac5b('0x5f')](_0x5bee1[_0x5a3abc]['id']);}}}return _0x1ba822;};exports[_0xac5b('0x60')]=function(_0x5f326a){var _0x369b76=moment()[_0xac5b('0x61')](0x0);var _0x6883ad=moment(_0x5f326a)[_0xac5b('0x61')](0x0);return _0x369b76[_0xac5b('0x62')](_0x6883ad,_0xac5b('0x63'));};exports[_0xac5b('0x64')]=function(_0x4fa2b5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fa2b5[_0xac5b('0x1a')],'ListId':_0x4fa2b5[_0xac5b('0x50')],'VoiceQueueId':_0x4fa2b5['VoiceQueueId']||undefined,'CampaignId':_0x4fa2b5[_0xac5b('0x65')]||undefined};};exports[_0xac5b('0x66')]=function(_0x331e04){if(_0x331e04===_0xac5b('0x40')||_0x331e04==='idContact'||_0x331e04===_0xac5b('0x67')||_0x331e04===_0xac5b('0x68')||_0x331e04==='campaigntype'||_0x331e04===_0xac5b('0x69')||_0x331e04===_0xac5b('0x6a')||_0x331e04===_0xac5b('0x41')||_0x331e04===_0xac5b('0x18')||_0x331e04===_0xac5b('0x4c')||_0x331e04===_0xac5b('0x19')||_0x331e04===_0xac5b('0x4d')||_0x331e04===_0xac5b('0x6b')||_0x331e04===_0xac5b('0x45')||_0x331e04===_0xac5b('0x46')||_0x331e04===_0xac5b('0x6c')||_0x331e04===_0xac5b('0x6d')||_0x331e04===_0xac5b('0x6e')||_0x331e04===_0xac5b('0x6f')||_0x331e04===_0xac5b('0x70')||_0x331e04===_0xac5b('0x1a')||_0x331e04===_0xac5b('0x50')||_0x331e04===_0xac5b('0x71')||_0x331e04===_0xac5b('0x1b')||_0x331e04===_0xac5b('0x72')||_0x331e04===_0xac5b('0x73')||_0x331e04===_0xac5b('0x74')||_0x331e04===_0xac5b('0x75')||_0x331e04===_0xac5b('0x76')||_0x331e04===_0xac5b('0x77')||_0x331e04==='xmd-dialtimeout'||_0x331e04===_0xac5b('0x78')||_0x331e04==='xmd-dialid'||_0x331e04===_0xac5b('0x79')||_0x331e04===_0xac5b('0x7a')||_0x331e04===_0xac5b('0x7b')||_0x331e04===_0xac5b('0x7c')||_0x331e04==='xmd-agiafter'||_0x331e04===_0xac5b('0x7d')||_0x331e04===_0xac5b('0x7e')||_0x331e04===_0xac5b('0x7f')||_0x331e04===_0xac5b('0x80')||_0x331e04===_0xac5b('0x81')||_0x331e04===_0xac5b('0x82')||_0x331e04===_0xac5b('0x83')||_0x331e04==='rtpaudioqosrtt'||_0x331e04===_0xac5b('0x84')||_0x331e04==='rtpaudioqos'||_0x331e04===_0xac5b('0x7f')||_0x331e04===_0xac5b('0x80')||_0x331e04===_0xac5b('0x81')||_0x331e04===_0xac5b('0x82')||_0x331e04===_0xac5b('0x83')||_0x331e04===_0xac5b('0x85')||_0x331e04===_0xac5b('0x84')||_0x331e04===_0xac5b('0x86')||_0x331e04==='bridgepvtcallid'||_0x331e04===_0xac5b('0x34')||_0x331e04===_0xac5b('0x35')){return![];}return!![];};exports[_0xac5b('0x87')]=function(_0x5e29a8,_0x64bb65){var _0x202f24,_0x1f49a8,_0x5589bf;if(_0x64bb65<=0x0){_0x64bb65=0x1;}_0x202f24=new RegExp('\x5cw{0,'+_0x64bb65+'}$');_0x1f49a8=Math[_0xac5b('0x88')](0xa,_0x64bb65-0x1);_0x5589bf=Math['pow'](0xa,_0x64bb65)-0x1;return util['format']('%s',_['replace'](_0x5e29a8,_0x202f24,_['random'](_0x1f49a8,_0x5589bf)));};exports[_0xac5b('0x89')]=function(_0x495608){var _0x436cd5=_0x495608[_0xac5b('0x8a')](/"(.*?)"/);return _0x436cd5?_0x436cd5[0x1]:_0x495608;};exports[_0xac5b('0x8b')]=function(_0x117ddf){var _0x44637b=_0x117ddf[_0xac5b('0x8a')](/<(.*?)>/);return _0x44637b?_0x44637b[0x1]:_0x117ddf;};function buildNoAnswerEventPayload(_0x1f29c5,_0x465110){var _0x1eff57=buildObj(_0x1f29c5,_0xac5b('0x8c'));if(!_[_0xac5b('0xf')](_0x465110[_0xac5b('0x8d')])){Object[_0xac5b('0x8e')](_0x465110[_0xac5b('0x8d')])[_0xac5b('0x8f')](function(_0x37165c){_0x1eff57[_0x37165c['toLowerCase']()]=_0x465110[_0xac5b('0x8d')][_0x37165c];});}return _0x1eff57;}exports[_0xac5b('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c1d0ce2..ba7fa1b 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 _0x4c38=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x4c38,0x1c3));var _0x84c3=function(_0x2351c6,_0x13d107){_0x2351c6=_0x2351c6-0x0;var _0x2c46e4=_0x4c38[_0x2351c6];return _0x2c46e4;};'use strict';exports[_0x84c3('0x0')]={'queue':{'type':_0x84c3('0x1'),'required':!![]},'interface':{'type':_0x84c3('0x1'),'required':!![]},'membername':{'type':_0x84c3('0x1'),'required':!![]},'penalty':{'type':_0x84c3('0x2'),'required':![]},'paused':{'type':_0x84c3('0x3'),'required':![]}};exports[_0x84c3('0x4')]={'queue':{'type':_0x84c3('0x1'),'required':!![]},'interface':{'type':_0x84c3('0x1'),'required':!![]}};exports[_0x84c3('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x84c3('0x3')},'reason':{'type':_0x84c3('0x1'),'required':![]}};exports[_0x84c3('0x6')]={'module':{'type':_0x84c3('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x84c3('0x1'),'required':!![]}};exports[_0x84c3('0x7')]={'uniqueid':{'type':_0x84c3('0x1'),'required':!![]},'filename':{'type':_0x84c3('0x1')},'format':{'type':_0x84c3('0x1')},'mixmonitorid':{'type':_0x84c3('0x1')}};exports[_0x84c3('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x84c3('0x9')]={'uniqueid':{'type':_0x84c3('0x1'),'required':!![]},'exten':{'type':_0x84c3('0x1'),'required':!![]},'context':{'type':_0x84c3('0x1')}}; \ No newline at end of file +var _0x9620=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x9620,0x17c));var _0x0962=function(_0x1573ec,_0x38d0c6){_0x1573ec=_0x1573ec-0x0;var _0x27e321=_0x9620[_0x1573ec];return _0x27e321;};'use strict';exports[_0x0962('0x0')]={'queue':{'type':_0x0962('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x0962('0x1'),'required':!![]},'penalty':{'type':_0x0962('0x2'),'required':![]},'paused':{'type':_0x0962('0x3'),'required':![]}};exports[_0x0962('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0962('0x1'),'required':!![]}};exports[_0x0962('0x5')]={'interface':{'type':_0x0962('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x0962('0x1'),'required':![]}};exports[_0x0962('0x6')]={'module':{'type':_0x0962('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0962('0x1'),'required':!![]}};exports[_0x0962('0x7')]={'uniqueid':{'type':_0x0962('0x1'),'required':!![]},'filename':{'type':_0x0962('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0962('0x1')}};exports[_0x0962('0x8')]={'uniqueid':{'type':_0x0962('0x1'),'required':!![]}};exports[_0x0962('0x9')]={'uniqueid':{'type':_0x0962('0x1'),'required':!![]},'exten':{'type':_0x0962('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8ed60ea..b978574 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0xd65550,_0x3b157d){var _0x127154=function(_0x2cf677){while(--_0x2cf677){_0xd65550['push'](_0xd65550['shift']());}};_0x127154(++_0x3b157d);}(_0xadb5,0xad));var _0x5adb=function(_0x397b07,_0x7a802b){_0x397b07=_0x397b07-0x0;var _0x211758=_0xadb5[_0x397b07];return _0x211758;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x0b0e[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index a41da30..efcb1ce 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7693=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x7693,0x66));var _0x3769=function(_0x37a776,_0x307424){_0x37a776=_0x37a776-0x0;var _0x308b10=_0x7693[_0x37a776];return _0x308b10;};'use strict';function mergeDBDataToRealtime(_0x204470,_0x59e143){var _0x15a87d=Object[_0x3769('0x0')]({},_0x204470);for(var _0x54876d in _0x59e143){if(_0x15a87d[_0x3769('0x1')](_0x54876d)){_0x15a87d[_0x54876d]=_0x59e143[_0x54876d];}}return _0x15a87d;}exports[_0x3769('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xe5ac=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x427214,_0xaa01af){var _0x4a9fe0=function(_0x6ab42){while(--_0x6ab42){_0x427214['push'](_0x427214['shift']());}};_0x4a9fe0(++_0xaa01af);}(_0xe5ac,0x133));var _0xce5a=function(_0x3762e8,_0x2e116a){_0x3762e8=_0x3762e8-0x0;var _0x4503e9=_0xe5ac[_0x3762e8];return _0x4503e9;};'use strict';function mergeDBDataToRealtime(_0x232e63,_0x181811){var _0x204c5c=Object[_0xce5a('0x0')]({},_0x232e63);for(var _0x33284d in _0x181811){if(_0x204c5c[_0xce5a('0x1')](_0x33284d)){_0x204c5c[_0x33284d]=_0x181811[_0x33284d];}}return _0x204c5c;}exports[_0xce5a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ceb7467..5697ef8 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 _0xcf45=['queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','isArray','forEach','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','lodash','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo'];(function(_0x1dc640,_0x13b156){var _0x2762c5=function(_0x2442da){while(--_0x2442da){_0x1dc640['push'](_0x1dc640['shift']());}};_0x2762c5(++_0x13b156);}(_0xcf45,0x1ad));var _0x5cf4=function(_0x5aa363,_0x5d4efb){_0x5aa363=_0x5aa363-0x0;var _0x3f14c7=_0xcf45[_0x5aa363];return _0x3f14c7;};'use strict';var _=require(_0x5cf4('0x0'));var moment=require(_0x5cf4('0x1'));var util=require('util');var config=require(_0x5cf4('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x5cf4('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x5cf4('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x5cf4('0x5'));var RpcVoiceTransferReport=require(_0x5cf4('0x6'));var VoiceQueueReport=require(_0x5cf4('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x5cf4('0x8'));var VoiceDialReport=require(_0x5cf4('0x9'));var UserReport=require(_0x5cf4('0xa'));function Report(_0xf64ccf){this[_0x5cf4('0xb')]=_0xf64ccf;this[_0x5cf4('0xc')]=_0xf64ccf[_0x5cf4('0xc')];this['telephones']=_0xf64ccf[_0x5cf4('0xd')];}Report[_0x5cf4('0xe')][_0x5cf4('0xf')]=function(_0x5b3354){var _0x9bb524=new VoiceQueueReport(this['realtime']);var _0x1a5312=new VoiceAgentReport(this[_0x5cf4('0xb')]);var _0x3b6a24=new VoiceDialReport(this[_0x5cf4('0xb')]);var _0x41386f=new VoiceCallReport(this['realtime']);var _0x2bc408=new UserReport(this[_0x5cf4('0xb')]);if(config[_0x5cf4('0x10')]&&config[_0x5cf4('0x10')][_0x5cf4('0x11')]){ami['on'](_0x5cf4('0x12'),this['voiceQueueReport']['bind'](this));ami['on'](_0x5cf4('0x13'),this[_0x5cf4('0x14')][_0x5cf4('0x15')](this));ami['on'](_0x5cf4('0x16'),this[_0x5cf4('0x17')][_0x5cf4('0x15')](this));ami['on'](_0x5cf4('0x18'),this[_0x5cf4('0x19')][_0x5cf4('0x15')](this));ami['on'](_0x5cf4('0x1a'),this[_0x5cf4('0x1b')]['bind'](this));ami['on'](_0x5cf4('0x1c'),this[_0x5cf4('0x1d')]['bind'](this));}};Report[_0x5cf4('0xe')][_0x5cf4('0x1e')]=function(_0x2f8850){var _0x8f0613;_0x8f0613=_[_0x5cf4('0x1f')](this[_0x5cf4('0xc')],function(_0x411cc6){return _0x411cc6[_0x5cf4('0x20')]==_0x2f8850||_0x411cc6[_0x5cf4('0x21')]==_0x2f8850;});if(_[_0x5cf4('0x22')](_0x8f0613)){var _0x5378ba=_[_0x5cf4('0x1f')](this[_0x5cf4('0xd')],function(_0x20790b){return _0x20790b[_0x5cf4('0x20')]==_0x2f8850||_0x20790b['name']==_0x2f8850;});if(_0x5378ba){_0x8f0613=_['find'](this['agents'],function(_0x2b975d){return _0x2b975d[_0x5cf4('0x23')]==util[_0x5cf4('0x24')](_0x5cf4('0x25'),_0x5378ba[_0x5cf4('0x21')]);});}}return _0x8f0613;};Report[_0x5cf4('0xe')]['voiceQueueReport']=function(_0x28182c){for(var _0x9eb920=0x0;_0x9eb920<_0x28182c[_0x5cf4('0x26')];_0x9eb920+=0x1){var _0xf3a57c=this[_0x5cf4('0x1e')](_0x28182c[_0x9eb920][_0x5cf4('0x27')]);if(_0xf3a57c){_0x28182c[_0x9eb920][_0x5cf4('0x20')]=_0xf3a57c['accountcode'];_0x28182c[_0x9eb920]['assigned']=!![];_0x28182c[_0x9eb920][_0x5cf4('0x28')]=_0xf3a57c[_0x5cf4('0x21')];_0x28182c[_0x9eb920][_0x5cf4('0x23')]=_[_0x5cf4('0x22')](_0xf3a57c['interface'])?util['format'](_0x5cf4('0x25'),_0xf3a57c['name']):_0xf3a57c['interface'];if(_0x28182c[_0x9eb920][_0x5cf4('0x29')]){_0x28182c[_0x9eb920][_0x5cf4('0x2a')]=moment()[_0x5cf4('0x24')](_0x5cf4('0x2b'));}if(_0x28182c[_0x9eb920][_0x5cf4('0x2c')]){_0x28182c[_0x9eb920][_0x5cf4('0x2d')]=moment()['format'](_0x5cf4('0x2b'));}RpcMemberReport[_0x5cf4('0x2e')](_0x28182c[_0x9eb920]);}RpcVoiceQueueReport[_0x5cf4('0x2f')](_0x28182c[_0x9eb920]);}};function extractCalleridNumber(_0x51a5b0){var _0x4b108e=_0x51a5b0[_0x5cf4('0x30')](/<(.*?)>/);return _0x4b108e?_0x4b108e[0x1]:_0x51a5b0;}Report[_0x5cf4('0xe')][_0x5cf4('0x31')]=function(_0x4cd29){for(var _0x26f2ac=0x0;_0x26f2ac','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','getAgentByInternal','membername','create','length','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode'];(function(_0x427f56,_0x3cee2b){var _0xdaf7e3=function(_0xee2ec4){while(--_0xee2ec4){_0x427f56['push'](_0x427f56['shift']());}};_0xdaf7e3(++_0x3cee2b);}(_0x01c9,0x1bd));var _0x901c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01c9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901c('0x0'));var moment=require('moment');var util=require(_0x901c('0x1'));var config=require(_0x901c('0x2'));var ami=require(_0x901c('0x3'));var RpcVoiceAgentReport=require(_0x901c('0x4'));var RpcVoiceCallReport=require(_0x901c('0x5'));var RpcVoiceDialReport=require(_0x901c('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x901c('0x7'));var RpcVoiceTransferReport=require(_0x901c('0x8'));var VoiceQueueReport=require(_0x901c('0x9'));var VoiceCallReport=require(_0x901c('0xa'));var VoiceAgentReport=require(_0x901c('0xb'));var VoiceDialReport=require(_0x901c('0xc'));var UserReport=require(_0x901c('0xd'));function Report(_0x9a403){this[_0x901c('0xe')]=_0x9a403;this[_0x901c('0xf')]=_0x9a403[_0x901c('0xf')];this[_0x901c('0x10')]=_0x9a403['telephones'];}Report[_0x901c('0x11')][_0x901c('0x12')]=function(_0x3b06fa){var _0x36496e=new VoiceQueueReport(this[_0x901c('0xe')]);var _0x3ad636=new VoiceAgentReport(this[_0x901c('0xe')]);var _0x95db88=new VoiceDialReport(this[_0x901c('0xe')]);var _0x33960b=new VoiceCallReport(this['realtime']);var _0x193900=new UserReport(this['realtime']);if(config['xdr']&&config[_0x901c('0x13')]['disabled']){ami['on'](_0x901c('0x14'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x901c('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x901c('0x16')][_0x901c('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x901c('0x17')]['bind'](this));ami['on'](_0x901c('0x18'),this[_0x901c('0x19')][_0x901c('0x15')](this));ami['on'](_0x901c('0x1a'),this[_0x901c('0x1b')][_0x901c('0x15')](this));}};Report[_0x901c('0x11')][_0x901c('0x1c')]=function(_0x34c6e2){var _0x3e3962;_0x3e3962=_['find'](this[_0x901c('0xf')],function(_0x4c0371){return _0x4c0371[_0x901c('0x1d')]==_0x34c6e2||_0x4c0371[_0x901c('0x1e')]==_0x34c6e2;});if(_['isNil'](_0x3e3962)){var _0x5d9b1d=_[_0x901c('0x1f')](this[_0x901c('0x10')],function(_0x1fe7b0){return _0x1fe7b0[_0x901c('0x1d')]==_0x34c6e2||_0x1fe7b0[_0x901c('0x1e')]==_0x34c6e2;});if(_0x5d9b1d){_0x3e3962=_[_0x901c('0x1f')](this[_0x901c('0xf')],function(_0xbffe0e){return _0xbffe0e[_0x901c('0x20')]==util['format'](_0x901c('0x21'),_0x5d9b1d[_0x901c('0x1e')]);});}}return _0x3e3962;};Report['prototype']['voiceQueueReport']=function(_0x1cb2cf){for(var _0x5243d8=0x0;_0x5243d8<_0x1cb2cf['length'];_0x5243d8+=0x1){var _0x481cff=this[_0x901c('0x1c')](_0x1cb2cf[_0x5243d8]['connectedlinenum']);if(_0x481cff){_0x1cb2cf[_0x5243d8][_0x901c('0x1d')]=_0x481cff[_0x901c('0x1d')];_0x1cb2cf[_0x5243d8][_0x901c('0x22')]=!![];_0x1cb2cf[_0x5243d8][_0x901c('0x23')]=_0x481cff[_0x901c('0x1e')];_0x1cb2cf[_0x5243d8][_0x901c('0x20')]=_[_0x901c('0x24')](_0x481cff[_0x901c('0x20')])?util[_0x901c('0x25')](_0x901c('0x21'),_0x481cff[_0x901c('0x1e')]):_0x481cff[_0x901c('0x20')];if(_0x1cb2cf[_0x5243d8][_0x901c('0x26')]){_0x1cb2cf[_0x5243d8][_0x901c('0x27')]=moment()[_0x901c('0x25')](_0x901c('0x28'));}if(_0x1cb2cf[_0x5243d8][_0x901c('0x29')]){_0x1cb2cf[_0x5243d8][_0x901c('0x2a')]=moment()['format'](_0x901c('0x28'));}RpcMemberReport[_0x901c('0x2b')](_0x1cb2cf[_0x5243d8]);}RpcVoiceQueueReport['create'](_0x1cb2cf[_0x5243d8]);}};function extractCalleridNumber(_0x779da8){var _0x59526b=_0x779da8[_0x901c('0x2c')](/<(.*?)>/);return _0x59526b?_0x59526b[0x1]:_0x779da8;}Report['prototype']['getAgentByInternal']=function(_0x2919d0){for(var _0x2d0b77=0x0;_0x2d0b770x0?!![]:![];if(!_0x3d2b62){return this[_0x5c7f('0x19')](this[_0x5c7f('0x15')][_0x5c7f('0x6c')]);}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x6d')]=function(_0x17cae9){var _0x1512b2=this[_0x5c7f('0x15')]['id'];if(this[_0x5c7f('0x15')][_0x5c7f('0x62')][_0x1512b2]&&this[_0x5c7f('0x15')][_0x5c7f('0x62')][_0x1512b2][_0x17cae9[_0x5c7f('0x6a')]]){this[_0x5c7f('0x15')][_0x5c7f('0x62')][_0x1512b2][_0x17cae9[_0x5c7f('0x6a')]]['agents'][_0x5c7f('0x6e')](_0x17cae9);}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x18')]=function(_0x3cf031){var _0x317d89=this;try{if(this[_0x5c7f('0x5c')](_0x3cf031)&&this[_0x5c7f('0x5c')](_0x3cf031[_0x5c7f('0x50')])){logger[_0x5c7f('0x4a')](_0x5c7f('0x6f'),util[_0x5c7f('0x42')](_0x3cf031,{'showHidden':![],'depth':null}));var _0x2b2f04=this[_0x5c7f('0x13')][_0x3cf031['queue']];if(_0x2b2f04){logger[_0x5c7f('0x4a')](_0x5c7f('0x70'),_0x2b2f04['name']);this[_0x5c7f('0x15')][_0x5c7f('0x65')][_0x2b2f04[_0x5c7f('0x5a')]]={'summaryEvent':_0x3cf031};this[_0x5c7f('0x15')][_0x5c7f('0x6b')]+=0x1;return ami[_0x5c7f('0x3b')]({'action':_0x5c7f('0x62'),'queue':_0x2b2f04[_0x5c7f('0x5a')]})['then'](function(_0x569f46){if(!_0x317d89[_0x5c7f('0x15')][_0x5c7f('0x62')][_0x3cf031[_0x5c7f('0x6a')]]){_0x317d89[_0x5c7f('0x15')]['queuestatus'][_0x3cf031[_0x5c7f('0x6a')]]={};}_0x317d89['summary'][_0x5c7f('0x62')][_0x3cf031[_0x5c7f('0x6a')]][_0x569f46[_0x5c7f('0x6a')]]={'queue':_0x2b2f04[_0x5c7f('0x5a')],'agents':[]};})['catch'](function(_0x1ac458){throw _0x1ac458;});}}}catch(_0xdd4944){logger[_0x5c7f('0x41')](_0x5c7f('0x63'),util['inspect'](_0xdd4944,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x19')]=function(_0x569779){if(this['summary']['statusRequests']>0x0){this['summary'][_0x5c7f('0x6c')]=_0x569779;return;}logger[_0x5c7f('0x4a')](_0x5c7f('0x71'),util[_0x5c7f('0x42')](_0x569779,{'showHidden':![],'depth':null}));this[_0x5c7f('0x15')]=initializeSummary();ami[_0x5c7f('0x48')](_0x5c7f('0x72'),{});};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x1e')]=function(_0x2676e3){try{if(this[_0x5c7f('0x5c')](_0x2676e3)){logger[_0x5c7f('0x4a')](_0x5c7f('0x73'),_0x2676e3[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x2676e3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5c7f('0x43')][_0x2676e3[_0x5c7f('0x4d')]])){this[_0x5c7f('0x43')][_0x2676e3[_0x5c7f('0x4d')]]=[];}if(_[_0x5c7f('0x5d')](this['channels'][_0x2676e3[_0x5c7f('0x4d')]])){this['channels'][_0x2676e3[_0x5c7f('0x4d')]]={};}var _0x10e8ed=new QueueReport();_0x10e8ed[_0x5c7f('0x50')]=_0x2676e3[_0x5c7f('0x50')];_0x10e8ed['type']=this[_0x5c7f('0x13')][_0x10e8ed[_0x5c7f('0x50')]]&&this['voiceQueues'][_0x10e8ed[_0x5c7f('0x50')]][_0x5c7f('0x57')]?this[_0x5c7f('0x13')][_0x10e8ed['queue']][_0x5c7f('0x57')]||_0x5c7f('0x58'):_0x5c7f('0x58');_0x10e8ed[_0x5c7f('0x74')]=moment()[_0x5c7f('0x4e')](_0x5c7f('0x75'));_0x10e8ed[_0x5c7f('0x76')]=_0x2676e3[_0x5c7f('0x76')];_0x10e8ed[_0x5c7f('0x77')]=_0x2676e3[_0x5c7f('0x77')];_0x10e8ed[_0x5c7f('0x4d')]=_0x2676e3[_0x5c7f('0x4d')];_0x10e8ed['routealias']=this[_0x5c7f('0x11')][_0x2676e3['uniqueid']][_0x5c7f('0x78')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x10e8ed[_0x5c7f('0x50')],_0x10e8ed[_0x5c7f('0x57')]);Object['assign'](_0x10e8ed,_[_0x5c7f('0x79')](_0x2676e3,_[_0x5c7f('0x7a')](_0x10e8ed)));this[_0x5c7f('0x43')][_0x2676e3[_0x5c7f('0x4d')]][_0x5c7f('0x6e')](_0x10e8ed);this[_0x5c7f('0x11')][_0x2676e3[_0x5c7f('0x4d')]]=_0x10e8ed;this[_0x5c7f('0x49')](_0x10e8ed,_0x5c7f('0x1d'));}}catch(_0x5bc54b){logger[_0x5c7f('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2676e3[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x5bc54b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x7b')]=function(_0x35d497){try{if(this['isNotNull'](_0x35d497)){logger[_0x5c7f('0x4a')]('[%s][voiceQueueReport][queuecallerabandon]',_0x35d497['uniqueid'],util[_0x5c7f('0x42')](_0x35d497,{'showHidden':![],'depth':null}));if(this[_0x5c7f('0x43')][_0x35d497[_0x5c7f('0x4d')]]){var _0x5a96cc=_[_0x5c7f('0x7c')](this[_0x5c7f('0x43')][_0x35d497['uniqueid']]);_0x5a96cc[_0x5c7f('0x37')]=![];_0x5a96cc['queuecallercompleteAt']=null;_0x5a96cc['holdtime']=_0x35d497['holdtime'];_0x5a96cc[_0x5c7f('0x7d')]=_0x35d497[_0x5c7f('0x7d')];_0x5a96cc[_0x5c7f('0x1f')]=!![];_0x5a96cc[_0x5c7f('0x7e')]=moment()[_0x5c7f('0x4e')](_0x5c7f('0x75'));_0x5a96cc['queuecallerexitreason']=_0x5c7f('0x7f');_0x5a96cc['lastAssignedTo']=null;logger[_0x5c7f('0x80')](_0x5c7f('0x81'),_0x5a96cc[_0x5c7f('0x50')],_0x5a96cc['type']);this['channels'][_0x35d497[_0x5c7f('0x4d')]]=_0x5a96cc;this[_0x5c7f('0x46')](_0x5a96cc,_0x5c7f('0x1f'));}}}catch(_0x39dd5c){logger[_0x5c7f('0x41')](_0x5c7f('0x82'),_0x35d497[_0x5c7f('0x4d')],util['inspect'](_0x39dd5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5c7f('0x21')]=function(_0x283081){try{if(this[_0x5c7f('0x5c')](_0x283081)){logger[_0x5c7f('0x4a')]('[%s][voiceQueueReport][queuecallerleave]',_0x283081[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x283081,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x283081[_0x5c7f('0x4d')]]){var _0x5c0114=_[_0x5c7f('0x7c')](this[_0x5c7f('0x43')][_0x283081['uniqueid']]);_0x5c0114[_0x5c7f('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c0114[_0x5c7f('0x84')]=_0x283081[_0x5c7f('0x84')];_0x5c0114[_0x5c7f('0x85')]=_0x283081[_0x5c7f('0x85')];logger[_0x5c7f('0x80')](_0x5c7f('0x86'),_0x5c0114[_0x5c7f('0x50')],_0x5c0114[_0x5c7f('0x57')],_0x283081[_0x5c7f('0x84')],_0x283081[_0x5c7f('0x85')]);this[_0x5c7f('0x11')][_0x283081['uniqueid']]=_0x5c0114;this['emitVoiceQueueChannelSave'](_0x5c0114,_0x5c7f('0x20'));}}}catch(_0x19819b){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x283081[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x19819b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x23')]=function(_0x3c9a27){try{if(this['isNotNull'](_0x3c9a27)){logger[_0x5c7f('0x4a')](_0x5c7f('0x87'),_0x3c9a27['uniqueid'],util[_0x5c7f('0x42')](_0x3c9a27,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3c9a27[_0x5c7f('0x4d')]]){var _0x35af8d=_['last'](this['queueReports'][_0x3c9a27[_0x5c7f('0x4d')]]);_0x35af8d['queuecallercomplete']=!![];_0x35af8d[_0x5c7f('0x88')]=_0x5c7f('0x89');logger[_0x5c7f('0x80')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x35af8d['queue'],_0x35af8d[_0x5c7f('0x57')]);}}}catch(_0x364308){logger['error'](_0x5c7f('0x87'),_0x3c9a27[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x364308,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0x8a')]=function(_0x414351){try{if(this['isNotNull'](_0x414351)){logger['debug'](_0x5c7f('0x8b'),_0x414351['uniqueid'],util[_0x5c7f('0x42')](_0x414351,{'showHidden':![],'depth':null}));if(this[_0x5c7f('0x43')][_0x414351['uniqueid']]){var _0x4ebde8=_[_0x5c7f('0x7c')](this[_0x5c7f('0x43')][_0x414351[_0x5c7f('0x4d')]]);_0x4ebde8[_0x5c7f('0x1f')]=![];_0x4ebde8[_0x5c7f('0x7e')]=null;_0x4ebde8[_0x5c7f('0x8c')]=!![];_0x4ebde8[_0x5c7f('0x8d')]=_0x414351[_0x5c7f('0x8e')];_0x4ebde8[_0x5c7f('0x8f')]=_0x414351['holdtime'];_0x4ebde8[_0x5c7f('0x37')]=!![];_0x4ebde8['queuecallerexit']=![];_0x4ebde8[_0x5c7f('0x90')]=null;if(!_0x4ebde8['transfer']){if(_0x414351[_0x5c7f('0x91')]=='transfer'){_0x4ebde8[_0x5c7f('0x88')]=_0x5c7f('0x92');logger[_0x5c7f('0x80')](_0x5c7f('0x93'),_0x4ebde8[_0x5c7f('0x50')],_0x4ebde8[_0x5c7f('0x57')]);}else{if(_[_0x5c7f('0x94')](_0x414351[_0x5c7f('0x3d')]['toLowerCase'](),_0x5c7f('0x95'))){if(this[_0x5c7f('0x43')][_0x414351[_0x5c7f('0x96')]]){var _0x4c8b28=_['last'](this[_0x5c7f('0x43')][_0x414351['linkedid']]);_0x4c8b28[_0x5c7f('0x37')]=![];_0x4c8b28[_0x5c7f('0x36')]=!![];_0x4c8b28['queuecallerexitAt']=moment(_0x4ebde8[_0x5c7f('0x74')])[_0x5c7f('0x97')](_0x414351[_0x5c7f('0x8f')],_0x5c7f('0x98'))[_0x5c7f('0x4e')](_0x5c7f('0x75'));_0x4c8b28[_0x5c7f('0x88')]=_0x5c7f('0x99');_0x4c8b28['transfer']=!![];_0x4c8b28[_0x5c7f('0x9a')]='FORWARD';_0x4c8b28[_0x5c7f('0x9b')]=_0x414351['destexten'];_0x4c8b28[_0x5c7f('0x9c')]=_0x414351[_0x5c7f('0x4d')];logger[_0x5c7f('0x80')](_0x5c7f('0x9d'),_0x4c8b28[_0x5c7f('0x50')],_0x4c8b28['type']);var _0x4a1822=this[_0x5c7f('0x43')][_0x414351[_0x5c7f('0x96')]];this[_0x5c7f('0x43')][_0x414351[_0x5c7f('0x96')]]=this[_0x5c7f('0x43')][_0x414351[_0x5c7f('0x4d')]];this[_0x5c7f('0x43')][_0x414351[_0x5c7f('0x4d')]]=_0x4a1822;}}else{_0x4ebde8[_0x5c7f('0x88')]=_0x5c7f('0x9e')+_0x414351[_0x5c7f('0x91')][_0x5c7f('0x9f')]();logger[_0x5c7f('0x80')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4ebde8['queue'],_0x4ebde8[_0x5c7f('0x57')],_0x4ebde8[_0x5c7f('0x88')]);}}}this['channels'][_0x414351['uniqueid']]=_0x4ebde8;}}}catch(_0x35a746){logger[_0x5c7f('0x41')](_0x5c7f('0x8b'),_0x414351['uniqueid'],util['inspect'](_0x35a746,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0xa0')]=function(_0x5f19cf){try{if(this[_0x5c7f('0x5c')](_0x5f19cf)){logger[_0x5c7f('0x4a')](_0x5c7f('0xa1'),_0x5f19cf[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x5f19cf,{'showHidden':![],'depth':null}));this['addVariable'](_0x5f19cf[_0x5c7f('0x4d')],_[_0x5c7f('0x7a')](_0x5f19cf['variable'])[0x0],_0x5f19cf[_0x5c7f('0xa2')]);if(this[_0x5c7f('0x43')][_0x5f19cf['uniqueid']]){var _0x4f037d=_[_0x5c7f('0x7c')](this['queueReports'][_0x5f19cf[_0x5c7f('0x4d')]]);if(_0x4f037d){if(this[_0x5c7f('0x5c')](_0x5f19cf[_0x5c7f('0xa3')])&&this['isNotNull'](_0x5f19cf['variable'][_0x5c7f('0x62')])){switch(_0x5f19cf[_0x5c7f('0xa2')]){case _0x5c7f('0xa4'):_0x4f037d[_0x5c7f('0x36')]=![];_0x4f037d[_0x5c7f('0x90')]=null;break;case _0x5c7f('0xa5'):_0x4f037d['lastevent']='timeout';_0x4f037d['queuecallerexit']=!![];_0x4f037d['queuecallerexitAt']=moment()['format'](_0x5c7f('0x75'));_0x4f037d[_0x5c7f('0x83')]=moment()[_0x5c7f('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x5c7f('0x4a')](_0x5c7f('0xa6'),_0x5f19cf[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x4f037d,{'showHidden':![],'depth':null}));ami[_0x5c7f('0x48')](_0x5c7f('0xa7'),_0x4f037d);break;default:_0x4f037d[_0x5c7f('0x36')]=!![];_0x4f037d[_0x5c7f('0x90')]=moment()[_0x5c7f('0x4e')](_0x5c7f('0x75'));_0x4f037d[_0x5c7f('0x83')]=moment()[_0x5c7f('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f037d['queuecallerabandon']=![];_0x4f037d[_0x5c7f('0x7e')]=null;_0x4f037d['queuecallerexitreason']=_0x5f19cf[_0x5c7f('0xa2')];this['channels'][_0x5f19cf[_0x5c7f('0x4d')]]=_0x4f037d;this[_0x5c7f('0x46')](_0x4f037d,'varset');}else if(this[_0x5c7f('0x5c')](_0x5f19cf['variable'])&&this[_0x5c7f('0x5c')](_0x5f19cf[_0x5c7f('0xa3')][_0x5c7f('0xa8')])){if(!_0x4f037d['queuecallerabandon']){_0x4f037d[_0x5c7f('0x36')]=!![];_0x4f037d[_0x5c7f('0x90')]=moment()[_0x5c7f('0x4e')](_0x5c7f('0x75'));_0x4f037d[_0x5c7f('0x88')]=_0x5c7f('0xa9');_0x4f037d[_0x5c7f('0x83')]=moment()['format'](_0x5c7f('0x75'));this[_0x5c7f('0x11')][_0x5f19cf['uniqueid']]=_0x4f037d;}}logger[_0x5c7f('0x80')](_0x5c7f('0xaa'),_0x5f19cf[_0x5c7f('0x4d')],_0x4f037d['queue'],_0x4f037d[_0x5c7f('0x57')],_[_0x5c7f('0x7a')](_0x5f19cf[_0x5c7f('0xa3')])[0x0],_0x5f19cf[_0x5c7f('0xa2')]);_0x4f037d[_0x5c7f('0x16')]=this[_0x5c7f('0x16')][_0x5f19cf['uniqueid']];}}}}catch(_0x382756){logger[_0x5c7f('0x41')]('[%s][voiceQueueReport][varset]',_0x5f19cf[_0x5c7f('0x4d')],util[_0x5c7f('0x42')](_0x382756,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c7f('0xb')]['addVariable']=function(_0x4a6f15,_0x431d74,_0x40878a){var _0x14538c=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0x5c7f('0xab'),_0x5c7f('0xac'),_0x5c7f('0xad'),_0x5c7f('0xae'),'rtpaudioqosrttbridged',_0x5c7f('0xaf'),'sipuri',_0x5c7f('0xb0'),_0x5c7f('0xb1'),'membercalls',_0x5c7f('0xb2'),_0x5c7f('0xb3'),_0x5c7f('0xb4'),_0x5c7f('0x8e'),_0x5c7f('0xb5'),_0x5c7f('0xb6')];if(!_[_0x5c7f('0x3a')](_0x431d74)&&!_['includes'](_0x14538c,_0x431d74)){if(_[_0x5c7f('0x5d')](this[_0x5c7f('0x16')][_0x4a6f15])){this[_0x5c7f('0x16')][_0x4a6f15]={};}this[_0x5c7f('0x16')][_0x4a6f15][_0x431d74]=_0x40878a;}};VoiceQueueReport[_0x5c7f('0xb')][_0x5c7f('0xb7')]=function(_0x668161,_0x540f49,_0xdd6e3){try{var _0x3b100b={};if(this[_0x5c7f('0x43')][_0x668161]){for(var _0x38d506=0x0;_0x38d5060x0?!![]:![];if(!_0x371c29){return this[_0x9dc1('0x14')](this[_0x9dc1('0x49')][_0x9dc1('0x74')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x2a5a6f){var _0x4d5068=this[_0x9dc1('0x49')]['id'];if(this[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x4d5068]&&this[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x4d5068][_0x2a5a6f[_0x9dc1('0x65')]]){this[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x4d5068][_0x2a5a6f[_0x9dc1('0x65')]]['agents'][_0x9dc1('0x75')](_0x2a5a6f);}};VoiceQueueReport['prototype'][_0x9dc1('0x76')]=function(_0x2115fd){var _0x3d5e89=this;try{if(this[_0x9dc1('0x61')](_0x2115fd)&&this[_0x9dc1('0x61')](_0x2115fd[_0x9dc1('0x52')])){logger[_0x9dc1('0x55')](_0x9dc1('0x77'),util[_0x9dc1('0x40')](_0x2115fd,{'showHidden':![],'depth':null}));var _0x2bdecf=this[_0x9dc1('0x48')][_0x2115fd[_0x9dc1('0x52')]];if(_0x2bdecf){logger[_0x9dc1('0x55')](_0x9dc1('0x78'),_0x2bdecf[_0x9dc1('0x5f')]);this[_0x9dc1('0x49')][_0x9dc1('0x6a')][_0x2bdecf[_0x9dc1('0x5f')]]={'summaryEvent':_0x2115fd};this['summary']['statusRequests']+=0x1;return ami[_0x9dc1('0x39')]({'action':'queuestatus','queue':_0x2bdecf[_0x9dc1('0x5f')]})['then'](function(_0x4a6e90){if(!_0x3d5e89['summary'][_0x9dc1('0x67')][_0x2115fd[_0x9dc1('0x65')]]){_0x3d5e89[_0x9dc1('0x49')]['queuestatus'][_0x2115fd[_0x9dc1('0x65')]]={};}_0x3d5e89[_0x9dc1('0x49')][_0x9dc1('0x67')][_0x2115fd[_0x9dc1('0x65')]][_0x4a6e90[_0x9dc1('0x65')]]={'queue':_0x2bdecf[_0x9dc1('0x5f')],'agents':[]};})[_0x9dc1('0x63')](function(_0x577070){throw _0x577070;});}}}catch(_0x212360){logger[_0x9dc1('0x3e')](_0x9dc1('0x68'),util[_0x9dc1('0x40')](_0x212360,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')][_0x9dc1('0x14')]=function(_0x2d6090){if(this['summary'][_0x9dc1('0x73')]>0x0){this[_0x9dc1('0x49')]['completeEvent']=_0x2d6090;return;}logger[_0x9dc1('0x55')](_0x9dc1('0x79'),util[_0x9dc1('0x40')](_0x2d6090,{'showHidden':![],'depth':null}));this[_0x9dc1('0x49')]=initializeSummary();ami['emit'](_0x9dc1('0x7a'),{});};VoiceQueueReport['prototype'][_0x9dc1('0x1b')]=function(_0x5c8397){try{if(this[_0x9dc1('0x61')](_0x5c8397)){logger['debug'](_0x9dc1('0x7b'),_0x5c8397['uniqueid'],util[_0x9dc1('0x40')](_0x5c8397,{'showHidden':![],'depth':null}));if(_[_0x9dc1('0x62')](this['queueReports'][_0x5c8397[_0x9dc1('0x50')]])){this[_0x9dc1('0x41')][_0x5c8397[_0x9dc1('0x50')]]=[];}if(_[_0x9dc1('0x62')](this[_0x9dc1('0x37')][_0x5c8397[_0x9dc1('0x50')]])){this[_0x9dc1('0x37')][_0x5c8397[_0x9dc1('0x50')]]={};}var _0x462a8b=new QueueReport();_0x462a8b[_0x9dc1('0x52')]=_0x5c8397[_0x9dc1('0x52')];_0x462a8b[_0x9dc1('0x70')]=this['voiceQueues'][_0x462a8b[_0x9dc1('0x52')]]&&this['voiceQueues'][_0x462a8b['queue']][_0x9dc1('0x70')]?this[_0x9dc1('0x48')][_0x462a8b[_0x9dc1('0x52')]][_0x9dc1('0x70')]||_0x9dc1('0x5d'):_0x9dc1('0x5d');_0x462a8b[_0x9dc1('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x462a8b[_0x9dc1('0x7d')]=_0x5c8397[_0x9dc1('0x7d')];_0x462a8b['count']=_0x5c8397['count'];_0x462a8b['uniqueid']=_0x5c8397[_0x9dc1('0x50')];_0x462a8b[_0x9dc1('0x7e')]=this[_0x9dc1('0x37')][_0x5c8397[_0x9dc1('0x50')]][_0x9dc1('0x7e')];logger[_0x9dc1('0x7f')](_0x9dc1('0x80'),_0x462a8b[_0x9dc1('0x52')],_0x462a8b['type']);Object[_0x9dc1('0x6f')](_0x462a8b,_[_0x9dc1('0x81')](_0x5c8397,_[_0x9dc1('0x82')](_0x462a8b)));this['queueReports'][_0x5c8397[_0x9dc1('0x50')]][_0x9dc1('0x75')](_0x462a8b);this[_0x9dc1('0x37')][_0x5c8397['uniqueid']]=_0x462a8b;this[_0x9dc1('0x4d')](_0x462a8b,_0x9dc1('0x1a'));}}catch(_0x3b7fab){logger[_0x9dc1('0x3e')](_0x9dc1('0x7b'),_0x5c8397[_0x9dc1('0x50')],util['inspect'](_0x3b7fab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')][_0x9dc1('0x1d')]=function(_0x39179c){try{if(this[_0x9dc1('0x61')](_0x39179c)){logger[_0x9dc1('0x55')](_0x9dc1('0x83'),_0x39179c[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x39179c,{'showHidden':![],'depth':null}));if(this[_0x9dc1('0x41')][_0x39179c[_0x9dc1('0x50')]]){var _0x32b70a=_['last'](this['queueReports'][_0x39179c[_0x9dc1('0x50')]]);_0x32b70a[_0x9dc1('0x84')]=![];_0x32b70a[_0x9dc1('0x85')]=null;_0x32b70a['holdtime']=_0x39179c['holdtime'];_0x32b70a[_0x9dc1('0x86')]=_0x39179c[_0x9dc1('0x86')];_0x32b70a[_0x9dc1('0x1c')]=!![];_0x32b70a['queuecallerabandonAt']=moment()[_0x9dc1('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x32b70a['queuecallerexitreason']='ABANDONED';_0x32b70a[_0x9dc1('0x87')]=null;logger[_0x9dc1('0x7f')](_0x9dc1('0x88'),_0x32b70a[_0x9dc1('0x52')],_0x32b70a['type']);this['channels'][_0x39179c[_0x9dc1('0x50')]]=_0x32b70a;this['emitVoiceQueueChannelRemove'](_0x32b70a,_0x9dc1('0x1c'));}}}catch(_0x56b116){logger[_0x9dc1('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x39179c['uniqueid'],util[_0x9dc1('0x40')](_0x56b116,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')]['syncQueueCallerLeave']=function(_0xc1dcf1){try{if(this[_0x9dc1('0x61')](_0xc1dcf1)){logger[_0x9dc1('0x55')](_0x9dc1('0x89'),_0xc1dcf1[_0x9dc1('0x50')],util['inspect'](_0xc1dcf1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xc1dcf1[_0x9dc1('0x50')]]){var _0x197f33=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0xc1dcf1[_0x9dc1('0x50')]]);_0x197f33[_0x9dc1('0x8b')]=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));_0x197f33[_0x9dc1('0x8d')]=_0xc1dcf1[_0x9dc1('0x8d')];_0x197f33[_0x9dc1('0x8e')]=_0xc1dcf1[_0x9dc1('0x8e')];logger['info'](_0x9dc1('0x8f'),_0x197f33[_0x9dc1('0x52')],_0x197f33[_0x9dc1('0x70')],_0xc1dcf1[_0x9dc1('0x8d')],_0xc1dcf1[_0x9dc1('0x8e')]);this[_0x9dc1('0x37')][_0xc1dcf1[_0x9dc1('0x50')]]=_0x197f33;this['emitVoiceQueueChannelSave'](_0x197f33,'queuecallerleave');}}}catch(_0x400181){logger[_0x9dc1('0x3e')](_0x9dc1('0x89'),_0xc1dcf1[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x400181,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9dc1('0x22')]=function(_0x1fe08e){try{if(this[_0x9dc1('0x61')](_0x1fe08e)){logger[_0x9dc1('0x55')](_0x9dc1('0x90'),_0x1fe08e['uniqueid'],util[_0x9dc1('0x40')](_0x1fe08e,{'showHidden':![],'depth':null}));if(this[_0x9dc1('0x41')][_0x1fe08e['uniqueid']]){var _0x4881de=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x1fe08e[_0x9dc1('0x50')]]);_0x4881de['queuecallercomplete']=!![];_0x4881de[_0x9dc1('0x57')]=_0x9dc1('0x91');logger[_0x9dc1('0x7f')](_0x9dc1('0x92'),_0x4881de[_0x9dc1('0x52')],_0x4881de[_0x9dc1('0x70')]);}}}catch(_0x34be2f){logger[_0x9dc1('0x3e')](_0x9dc1('0x90'),_0x1fe08e[_0x9dc1('0x50')],util['inspect'](_0x34be2f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x5bac96){try{if(this[_0x9dc1('0x61')](_0x5bac96)){logger[_0x9dc1('0x55')](_0x9dc1('0x93'),_0x5bac96[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x5bac96,{'showHidden':![],'depth':null}));if(this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x50')]]){var _0x5408ed=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x50')]]);_0x5408ed[_0x9dc1('0x1c')]=![];_0x5408ed[_0x9dc1('0x94')]=null;_0x5408ed['assigned']=!![];_0x5408ed[_0x9dc1('0x87')]=_0x5bac96['membername'];_0x5408ed[_0x9dc1('0x95')]=_0x5bac96[_0x9dc1('0x95')];_0x5408ed[_0x9dc1('0x84')]=!![];_0x5408ed['queuecallerexit']=![];_0x5408ed[_0x9dc1('0x96')]=null;if(!_0x5408ed[_0x9dc1('0x97')]){if(_0x5bac96[_0x9dc1('0x98')]==_0x9dc1('0x97')){_0x5408ed[_0x9dc1('0x57')]='COMPLETED';logger[_0x9dc1('0x7f')](_0x9dc1('0x99'),_0x5408ed[_0x9dc1('0x52')],_0x5408ed['type']);}else{if(_[_0x9dc1('0x9a')](_0x5bac96[_0x9dc1('0x3b')][_0x9dc1('0x9b')](),_0x9dc1('0x9c'))){if(this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]]){var _0x213e81=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]]);_0x213e81['queuecallercomplete']=![];_0x213e81[_0x9dc1('0x9e')]=!![];_0x213e81[_0x9dc1('0x96')]=moment(_0x5408ed[_0x9dc1('0x7c')])['add'](_0x5bac96[_0x9dc1('0x95')],_0x9dc1('0x9f'))['format'](_0x9dc1('0x8c'));_0x213e81[_0x9dc1('0x57')]='FORWARDTRANSFER';_0x213e81[_0x9dc1('0x97')]=!![];_0x213e81[_0x9dc1('0xa0')]='FORWARD';_0x213e81[_0x9dc1('0xa1')]=_0x5bac96[_0x9dc1('0xa2')];_0x213e81[_0x9dc1('0xa3')]=_0x5bac96['uniqueid'];logger[_0x9dc1('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x213e81[_0x9dc1('0x52')],_0x213e81[_0x9dc1('0x70')]);var _0x315acf=this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]];this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x9d')]]=this[_0x9dc1('0x41')][_0x5bac96[_0x9dc1('0x50')]];this[_0x9dc1('0x41')][_0x5bac96['uniqueid']]=_0x315acf;}}else{_0x5408ed[_0x9dc1('0x57')]=_0x9dc1('0xa4')+_0x5bac96['reason'][_0x9dc1('0xa5')]();logger[_0x9dc1('0x7f')](_0x9dc1('0xa6'),_0x5408ed['queue'],_0x5408ed['type'],_0x5408ed[_0x9dc1('0x57')]);}}}this[_0x9dc1('0x37')][_0x5bac96[_0x9dc1('0x50')]]=_0x5408ed;}}}catch(_0x1bf93a){logger['error'](_0x9dc1('0x93'),_0x5bac96['uniqueid'],util[_0x9dc1('0x40')](_0x1bf93a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9dc1('0xa')][_0x9dc1('0x24')]=function(_0x3761f5){try{if(this['isNotNull'](_0x3761f5)){logger[_0x9dc1('0x55')](_0x9dc1('0xa7'),_0x3761f5[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x3761f5,{'showHidden':![],'depth':null}));this[_0x9dc1('0xa8')](_0x3761f5[_0x9dc1('0x50')],_[_0x9dc1('0x82')](_0x3761f5[_0x9dc1('0xa9')])[0x0],_0x3761f5['value']);if(this[_0x9dc1('0x41')][_0x3761f5['uniqueid']]){var _0x4a5a59=_[_0x9dc1('0x8a')](this[_0x9dc1('0x41')][_0x3761f5[_0x9dc1('0x50')]]);if(_0x4a5a59){if(this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')])&&this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')][_0x9dc1('0x67')])){switch(_0x3761f5[_0x9dc1('0xaa')]){case'CONTINUE':_0x4a5a59['queuecallerexit']=![];_0x4a5a59[_0x9dc1('0x96')]=null;break;case _0x9dc1('0xab'):_0x4a5a59[_0x9dc1('0xac')]=_0x9dc1('0xad');_0x4a5a59[_0x9dc1('0x9e')]=!![];_0x4a5a59[_0x9dc1('0x96')]=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));_0x4a5a59['queuecallerleaveAt']=moment()['format'](_0x9dc1('0x8c'));logger['debug'](_0x9dc1('0xae'),_0x3761f5[_0x9dc1('0x50')],util[_0x9dc1('0x40')](_0x4a5a59,{'showHidden':![],'depth':null}));ami['emit'](_0x9dc1('0xaf'),_0x4a5a59);break;default:_0x4a5a59[_0x9dc1('0x9e')]=!![];_0x4a5a59['queuecallerexitAt']=moment()['format'](_0x9dc1('0x8c'));_0x4a5a59[_0x9dc1('0x8b')]=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));}_0x4a5a59[_0x9dc1('0x1c')]=![];_0x4a5a59['queuecallerabandonAt']=null;_0x4a5a59['queuecallerexitreason']=_0x3761f5['value'];this[_0x9dc1('0x37')][_0x3761f5[_0x9dc1('0x50')]]=_0x4a5a59;this['emitVoiceQueueChannelRemove'](_0x4a5a59,'varset');}else if(this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')])&&this[_0x9dc1('0x61')](_0x3761f5[_0x9dc1('0xa9')]['queueposition'])){if(!_0x4a5a59[_0x9dc1('0x1c')]){_0x4a5a59[_0x9dc1('0x9e')]=!![];_0x4a5a59[_0x9dc1('0x96')]=moment()[_0x9dc1('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a5a59[_0x9dc1('0x57')]=_0x9dc1('0xb0');_0x4a5a59['queuecallerleaveAt']=moment()[_0x9dc1('0x51')](_0x9dc1('0x8c'));this[_0x9dc1('0x37')][_0x3761f5[_0x9dc1('0x50')]]=_0x4a5a59;}}logger[_0x9dc1('0x7f')](_0x9dc1('0xb1'),_0x3761f5[_0x9dc1('0x50')],_0x4a5a59['queue'],_0x4a5a59[_0x9dc1('0x70')],_['keys'](_0x3761f5[_0x9dc1('0xa9')])[0x0],_0x3761f5['value']);_0x4a5a59[_0x9dc1('0x43')]=this['variables'][_0x3761f5[_0x9dc1('0x50')]];}}}}catch(_0x11053f){logger[_0x9dc1('0x3e')](_0x9dc1('0xa7'),_0x3761f5[_0x9dc1('0x50')],util['inspect'](_0x11053f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9dc1('0xa8')]=function(_0x3554eb,_0x3b9b93,_0x54252a){var _0x5eb264=['rtpaudioqos',_0x9dc1('0xb2'),_0x9dc1('0xb3'),_0x9dc1('0xb4'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x9dc1('0xb5'),_0x9dc1('0xb6'),'sipcallid',_0x9dc1('0xb7'),_0x9dc1('0xb8'),_0x9dc1('0xb9'),'membercalls',_0x9dc1('0xba'),'memberinterface',_0x9dc1('0xbb'),_0x9dc1('0xbc'),_0x9dc1('0xbd'),_0x9dc1('0xbe')];if(!_[_0x9dc1('0xbf')](_0x3b9b93)&&!_[_0x9dc1('0xc0')](_0x5eb264,_0x3b9b93)){if(_[_0x9dc1('0x62')](this[_0x9dc1('0x43')][_0x3554eb])){this['variables'][_0x3554eb]={};}this[_0x9dc1('0x43')][_0x3554eb][_0x3b9b93]=_0x54252a;}};VoiceQueueReport[_0x9dc1('0xa')]['handleHangup']=function(_0x3d98c8,_0x31f353,_0x32d43b){try{var _0x2ab5ce={};if(this[_0x9dc1('0x41')][_0x3d98c8]){for(var _0x49175f=0x0;_0x49175f=0x0?moment(_0x556bb9[_0x806a('0x18')])[_0x806a('0xc')](_0x556bb9[_0x806a('0x19')],_0x806a('0xd')):null,'data1':'outbound','data2':_0x556bb9[_0x806a('0x13')],'data3':_0x556bb9[_0x806a('0x10')],'data4':_0x556bb9['dialstring']||null,'role':_0x806a('0x12'),'internal':_0x556bb9[_0x806a('0x13')]?_[_0x806a('0x1a')](_0x556bb9['accountcode']):undefined,'uniqueid':_0x556bb9['uniqueid']},'log':_0x806a('0x7')});}; \ No newline at end of file +var _0x18cb=['uniqueid','CreateMemberReport','voice','membername','starttime','endtime','diff','seconds','dialstring','toNumber','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','Request','isNil','interface','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','accountcode'];(function(_0x507128,_0x330353){var _0x58f8f4=function(_0x551123){while(--_0x551123){_0x507128['push'](_0x507128['shift']());}};_0x58f8f4(++_0x330353);}(_0x18cb,0x1de));var _0xb18c=function(_0x44bb11,_0x124d86){_0x44bb11=_0x44bb11-0x0;var _0x3544dc=_0x18cb[_0x44bb11];return _0x3544dc;};'use strict';var moment=require(_0xb18c('0x0'));var _=require(_0xb18c('0x1'));var util=require('util');var client=require(_0xb18c('0x2'));exports[_0xb18c('0x3')]=function(_0x7de465){var _0x42166e=_0x7de465[_0xb18c('0x4')]||_0x7de465['queuecallerexitAt'];return client[_0xb18c('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x7de465['lastAssignedTo'],'interface':_[_0xb18c('0x6')](_0x7de465[_0xb18c('0x7')])?util['format'](_0xb18c('0x8'),_0x7de465[_0xb18c('0x9')]):_0x7de465['interface'],'type':_0xb18c('0xa'),'enterAt':_0x7de465[_0xb18c('0xb')],'exitAt':_0x42166e,'duration':moment(_0x42166e)['diff'](_0x7de465[_0xb18c('0xb')],'seconds'),'data1':_0xb18c('0xc'),'data2':_0x7de465[_0xb18c('0xd')],'data3':_0x7de465[_0xb18c('0xe')],'data4':null,'data5':_0x7de465['queue'],'role':'agent','internal':_0x7de465[_0xb18c('0xf')]?_['toNumber'](_0x7de465[_0xb18c('0xf')]):undefined,'uniqueid':_0x7de465[_0xb18c('0x10')]},'log':_0xb18c('0x11')});};exports['voiceDialReport']=function(_0x129f40){return client[_0xb18c('0x5')](_0xb18c('0x11'),{'body':{'channel':_0xb18c('0x12'),'membername':_0x129f40[_0xb18c('0x13')],'interface':_0x129f40[_0xb18c('0x7')],'type':'TALKING','enterAt':_0x129f40[_0xb18c('0x14')],'exitAt':_0x129f40['endtime'],'duration':moment(_0x129f40[_0xb18c('0x15')])[_0xb18c('0x16')](_0x129f40['starttime'],'seconds')>=0x0?moment(_0x129f40[_0xb18c('0x15')])['diff'](_0x129f40['starttime'],_0xb18c('0x17')):null,'data1':'outbound','data2':_0x129f40[_0xb18c('0xf')],'data3':_0x129f40['exten'],'data4':_0x129f40[_0xb18c('0x18')]||null,'role':'agent','internal':_0x129f40[_0xb18c('0xf')]?_[_0xb18c('0x19')](_0x129f40[_0xb18c('0xf')]):undefined,'uniqueid':_0x129f40[_0xb18c('0x10')]},'log':_0xb18c('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 503eb4e..2de24b9 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 _0x58cc=['stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings','Request','ShowSetting'];(function(_0xdc0ba3,_0x589af7){var _0x1e76ea=function(_0x46678b){while(--_0x46678b){_0xdc0ba3['push'](_0xdc0ba3['shift']());}};_0x1e76ea(++_0x589af7);}(_0x58cc,0x7a));var _0xc58c=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x58cc[_0x4b174a];return _0x3cd7bf;};'use strict';var client=require(_0xc58c('0x0'));exports[_0xc58c('0x1')]=function(){return client[_0xc58c('0x2')](_0xc58c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc58c('0x4'),_0xc58c('0x5')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xc222=['previewRecallmeReminderInterval','../client','getSettings','ShowSetting'];(function(_0x5930f9,_0x4c0de3){var _0x4e9d74=function(_0x2896a0){while(--_0x2896a0){_0x5930f9['push'](_0x5930f9['shift']());}};_0x4e9d74(++_0x4c0de3);}(_0xc222,0x75));var _0x2c22=function(_0x2ad588,_0x17e951){_0x2ad588=_0x2ad588-0x0;var _0x37ab25=_0xc222[_0x2ad588];return _0x37ab25;};'use strict';var client=require(_0x2c22('0x0'));exports[_0x2c22('0x1')]=function(){return client['Request'](_0x2c22('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2c22('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c2623d4..b47acc8 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 _0x93f1=['../client','Request','GetTemplate','html'];(function(_0x6c1f9c,_0x5a7cf3){var _0x3fdb87=function(_0x463d83){while(--_0x463d83){_0x6c1f9c['push'](_0x6c1f9c['shift']());}};_0x3fdb87(++_0x5a7cf3);}(_0x93f1,0x7c));var _0x193f=function(_0x469d84,_0xd8d8fb){_0x469d84=_0x469d84-0x0;var _0x4eadd8=_0x93f1[_0x469d84];return _0x4eadd8;};'use strict';var client=require(_0x193f('0x0'));exports['getTemplates']=function(_0x117d4b){return function(_0xff1a07){return client[_0x193f('0x1')](_0x193f('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x193f('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x5480=['GetTemplate','html','../client','getTemplates'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x5480,0x18a));var _0x0548=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x5480[_0xd39959];return _0x1ff69c;};'use strict';var client=require(_0x0548('0x0'));exports[_0x0548('0x1')]=function(_0x20544f){return function(_0x5d22f8){return client['Request'](_0x0548('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x0548('0x3')]},'log':_0x0548('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 9ff88f6..622b460 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 _0x564e=['GetTrigger','name','channel','status','Condition','AllConditions','AnyConditions','operator','value','Action','Actions','action','data1','data2','data4','data7','../client','getTriggers','Request'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x564e,0x6f));var _0xe564=function(_0x324ea8,_0x4a1706){_0x324ea8=_0x324ea8-0x0;var _0x55954e=_0x564e[_0x324ea8];return _0x55954e;};'use strict';var client=require(_0xe564('0x0'));exports[_0xe564('0x1')]=function(_0x31611d){return function(_0x30b8a6){return client[_0xe564('0x2')](_0xe564('0x3'),{'options':{'raw':![],'attributes':['id',_0xe564('0x4'),_0xe564('0x5'),_0xe564('0x6')],'include':[{'model':_0xe564('0x7'),'as':_0xe564('0x8'),'attributes':['id','field','operator','value']},{'model':_0xe564('0x7'),'as':_0xe564('0x9'),'attributes':['id','field',_0xe564('0xa'),_0xe564('0xb')]},{'model':_0xe564('0xc'),'as':_0xe564('0xd'),'attributes':['id',_0xe564('0xe'),_0xe564('0xf'),_0xe564('0x10'),'data3',_0xe564('0x11'),'data5','data6',_0xe564('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xf56e=['Actions','data1','data3','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf56e,0x1ba));var _0xef56=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0xf56e[_0x14ec1f];return _0x5cecb3;};'use strict';var client=require(_0xef56('0x0'));exports[_0xef56('0x1')]=function(_0x4717bd){return function(_0x5a581e){return client[_0xef56('0x2')](_0xef56('0x3'),{'options':{'raw':![],'attributes':['id',_0xef56('0x4'),_0xef56('0x5'),_0xef56('0x6')],'include':[{'model':_0xef56('0x7'),'as':_0xef56('0x8'),'attributes':['id','field',_0xef56('0x9'),_0xef56('0xa')]},{'model':_0xef56('0x7'),'as':_0xef56('0xb'),'attributes':['id',_0xef56('0xc'),_0xef56('0x9'),_0xef56('0xa')]},{'model':_0xef56('0xd'),'as':_0xef56('0xe'),'attributes':['id','action',_0xef56('0xf'),'data2',_0xef56('0x10'),'data4','data5',_0xef56('0x11'),_0xef56('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7586632..b7560e7 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 _0xac4a=['../client','Request','GetTrunk','registry'];(function(_0x321830,_0x17874a){var _0x3b027f=function(_0x130785){while(--_0x130785){_0x321830['push'](_0x321830['shift']());}};_0x3b027f(++_0x17874a);}(_0xac4a,0xa0));var _0xaac4=function(_0x3714b0,_0x2e192d){_0x3714b0=_0x3714b0-0x0;var _0x7a635d=_0xac4a[_0x3714b0];return _0x7a635d;};'use strict';var client=require(_0xaac4('0x0'));exports['getTrunks']=function(_0x5caf8b){return function(_0x2496e6){return client[_0xaac4('0x1')](_0xaac4('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xaac4('0x3'),'defaultuser']},'log':_0xaac4('0x2')});};}; \ No newline at end of file +var _0x6737=['registry','getTrunks','Request','GetTrunk','name'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x6737,0xe2));var _0x7673=function(_0x143db0,_0x542e28){_0x143db0=_0x143db0-0x0;var _0x38080b=_0x6737[_0x143db0];return _0x38080b;};'use strict';var client=require('../client');exports[_0x7673('0x0')]=function(_0x2634c4){return function(_0x5aa730){return client[_0x7673('0x1')](_0x7673('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7673('0x3'),_0x7673('0x4'),'defaultuser']},'log':_0x7673('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e7f735b..ed4e6f9 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x3aea91,_0x1e8d79){var _0x59fbf2=function(_0x3ce6ba){while(--_0x3ce6ba){_0x3aea91['push'](_0x3aea91['shift']());}};_0x59fbf2(++_0x1e8d79);}(_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 +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x17e017,_0x5b6cd3){var _0x1c0650=function(_0x240248){while(--_0x240248){_0x17e017['push'](_0x17e017['shift']());}};_0x1c0650(++_0x5b6cd3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xcb91[_0x6cf19c];return _0xce14f3;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b039fdd..d92d7c1 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 _0xed59=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xed59,0x14a));var _0x9ed5=function(_0x2a5568,_0x353f3d){_0x2a5568=_0x2a5568-0x0;var _0x5d38a1=_0xed59[_0x2a5568];return _0x5d38a1;};'use strict';var client=require(_0x9ed5('0x0'));exports[_0x9ed5('0x1')]=function(_0x5f5599){return client[_0x9ed5('0x2')](_0x9ed5('0x3'),{'body':_0x5f5599,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x16b9e,_0x22570d,_0x9cd766){return client[_0x9ed5('0x2')]('UpdateVoiceAgentReport',{'body':_0x16b9e,'options':{'where':{'uniqueid':_0x22570d,'interface':_0x9cd766,'agentcomplete':!![]}},'log':_0x9ed5('0x4')});}; \ No newline at end of file +var _0xbe40=['update','UpdateVoiceAgentReport','Request','CreateVoiceAgentReport'];(function(_0x1e1ce6,_0x328143){var _0x5b0248=function(_0x104213){while(--_0x104213){_0x1e1ce6['push'](_0x1e1ce6['shift']());}};_0x5b0248(++_0x328143);}(_0xbe40,0x136));var _0x0be4=function(_0x4d14cf,_0x3e82f3){_0x4d14cf=_0x4d14cf-0x0;var _0x27bd03=_0xbe40[_0x4d14cf];return _0x27bd03;};'use strict';var client=require('../client');exports['create']=function(_0x22b7b6){return client[_0x0be4('0x0')]('CreateVoiceAgentReport',{'body':_0x22b7b6,'log':_0x0be4('0x1')});};exports[_0x0be4('0x2')]=function(_0xa849e6,_0x2a0b59,_0x1b1f9e){return client[_0x0be4('0x0')](_0x0be4('0x3'),{'body':_0xa849e6,'options':{'where':{'uniqueid':_0x2a0b59,'interface':_0x1b1f9e,'agentcomplete':!![]}},'log':_0x0be4('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 75c03c1..7955f39 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 _0x62e7=['moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0x62e7,0x1e3));var _0x762e=function(_0xbb09c2,_0x2e07f6){_0xbb09c2=_0xbb09c2-0x0;var _0x1f1fd4=_0x62e7[_0xbb09c2];return _0x1f1fd4;};'use strict';var moment=require(_0x762e('0x0'));var util=require('util');var _=require(_0x762e('0x1'));var client=require(_0x762e('0x2'));exports[_0x762e('0x3')]=function(_0x235e9e){return client[_0x762e('0x4')](_0x762e('0x5'),{'body':_[_0x762e('0x6')](_0x235e9e,{'source':_0x235e9e[_0x762e('0x7')],'destinationcontext':_0x235e9e[_0x762e('0x8')],'callerid':_0x235e9e[_0x762e('0x9')],'amaflags':_0x762e('0xa')}),'log':_0x762e('0x5')});};exports[_0x762e('0xb')]=function(){return function(){return client[_0x762e('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x762e('0xc')]('day')[_0x762e('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x762e('0xe')](_0x762e('0xf'))[_0x762e('0xd')](_0x762e('0x10'))]}},'attributes':[_0x762e('0x11'),_0x762e('0x12'),'duration',_0x762e('0x13')]},'log':_0x762e('0x14')});};}; \ No newline at end of file +var _0x7b9c=['disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x1bf839,_0x3c51a1){var _0x2ceb01=function(_0x133226){while(--_0x133226){_0x1bf839['push'](_0x1bf839['shift']());}};_0x2ceb01(++_0x3c51a1);}(_0x7b9c,0x154));var _0xc7b9=function(_0x4a70ce,_0x4c70ef){_0x4a70ce=_0x4a70ce-0x0;var _0x477b48=_0x7b9c[_0x4a70ce];return _0x477b48;};'use strict';var moment=require(_0xc7b9('0x0'));var util=require(_0xc7b9('0x1'));var _=require(_0xc7b9('0x2'));var client=require(_0xc7b9('0x3'));exports['create']=function(_0x56a7b4){return client[_0xc7b9('0x4')](_0xc7b9('0x5'),{'body':_['merge'](_0x56a7b4,{'source':_0x56a7b4[_0xc7b9('0x6')],'destinationcontext':_0x56a7b4[_0xc7b9('0x7')],'callerid':_0x56a7b4[_0xc7b9('0x8')],'amaflags':_0xc7b9('0x9')}),'log':_0xc7b9('0x5')});};exports[_0xc7b9('0xa')]=function(){return function(){return client[_0xc7b9('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xc7b9('0xb')],'createdAt':{'$between':[moment()[_0xc7b9('0xc')](_0xc7b9('0xd'))[_0xc7b9('0xe')](_0xc7b9('0xf')),moment()[_0xc7b9('0x10')]('day')[_0xc7b9('0xe')](_0xc7b9('0xf'))]}},'attributes':['type',_0xc7b9('0x11'),_0xc7b9('0x12'),_0xc7b9('0x13')]},'log':_0xc7b9('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d79694f..bb067ff 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 _0x738b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x484ca1,_0x235ec){var _0x117dba=function(_0xa6de27){while(--_0xa6de27){_0x484ca1['push'](_0x484ca1['shift']());}};_0x117dba(++_0x235ec);}(_0x738b,0x140));var _0xb738=function(_0x538839,_0x10cc1b){_0x538839=_0x538839-0x0;var _0x34b80b=_0x738b[_0x538839];return _0x34b80b;};'use strict';var client=require(_0xb738('0x0'));exports[_0xb738('0x1')]=function(_0x2b82e0){return client[_0xb738('0x2')]('CreateVoiceDialReport',{'body':_0x2b82e0,'log':_0xb738('0x3')});}; \ No newline at end of file +var _0x67a3=['Request','CreateVoiceDialReport','create'];(function(_0x410986,_0x54606e){var _0x5d5031=function(_0x59778e){while(--_0x59778e){_0x410986['push'](_0x410986['shift']());}};_0x5d5031(++_0x54606e);}(_0x67a3,0x17c));var _0x367a=function(_0x27cfc5,_0x630ac4){_0x27cfc5=_0x27cfc5-0x0;var _0x21eb36=_0x67a3[_0x27cfc5];return _0x21eb36;};'use strict';var client=require('../client');exports[_0x367a('0x0')]=function(_0x2fd0a2){return client[_0x367a('0x1')]('CreateVoiceDialReport',{'body':_0x2fd0a2,'log':_0x367a('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 3dc5e2c..5292175 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 _0xb332=['recordingFormat','../client','Request','GetVoiceExtension'];(function(_0x58cd78,_0x3e3ae5){var _0x5905c5=function(_0x3b0731){while(--_0x3b0731){_0x58cd78['push'](_0x58cd78['shift']());}};_0x5905c5(++_0x3e3ae5);}(_0xb332,0xd9));var _0x2b33=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0xb332[_0xc36d01];return _0xecb231;};'use strict';var client=require(_0x2b33('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x2b33('0x1')](_0x2b33('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x2b33('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xb248=['GetVoiceExtension','exten','recordingFormat','../client','Request'];(function(_0x3901b1,_0x58e36a){var _0x5f300f=function(_0x256ef0){while(--_0x256ef0){_0x3901b1['push'](_0x3901b1['shift']());}};_0x5f300f(++_0x58e36a);}(_0xb248,0xc6));var _0x8b24=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb248[_0x45d55e];return _0x29812a;};'use strict';var client=require(_0x8b24('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x8b24('0x1')](_0x8b24('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8b24('0x3'),_0x8b24('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7c54e00..34309b5 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 _0x0819=['interval','getVoiceQueues','Request','acw','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0819,0x182));var _0x9081=function(_0x4fda25,_0x261537){_0x4fda25=_0x4fda25-0x0;var _0x521a5f=_0x0819[_0x4fda25];return _0x521a5f;};'use strict';var client=require('../client');exports[_0x9081('0x0')]=function(){return function(){return client[_0x9081('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x9081('0x2'),'acwTimeout','autopause','monitor_format','type',_0x9081('0x3'),_0x9081('0x4'),_0x9081('0x5'),_0x9081('0x6'),_0x9081('0x7'),_0x9081('0x8'),_0x9081('0x9'),'dialPredictiveInterval',_0x9081('0xa'),_0x9081('0xb'),_0x9081('0xc'),_0x9081('0xd'),_0x9081('0xe'),_0x9081('0xf'),'dialCongestionMaxRetry',_0x9081('0x10'),_0x9081('0x11'),_0x9081('0x12'),_0x9081('0x13'),_0x9081('0x14'),_0x9081('0x15'),_0x9081('0x16'),_0x9081('0x17'),'dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0x9081('0x18'),_0x9081('0x19'),_0x9081('0x1a'),_0x9081('0x1b'),_0x9081('0x1c'),'dialAMDMaximumNumberOfWords',_0x9081('0x1d'),'dialAMDMaximumWordLength',_0x9081('0x1e'),_0x9081('0x1f'),'dialRecallInQueue',_0x9081('0x20'),_0x9081('0x21'),'dialAgiAfterHangupClient','dialQueueProject2',_0x9081('0x22'),_0x9081('0x23'),_0x9081('0x24'),_0x9081('0x25'),_0x9081('0x26'),_0x9081('0x27'),_0x9081('0x28'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x9081('0x29'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x9081('0x2a'),_0x9081('0x2b'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x9081('0x2c'),'dialPreviewAutoRecallMe',_0x9081('0x2d')],'include':[{'model':_0x9081('0x2e'),'as':_0x9081('0x2e'),'attributes':['id',_0x9081('0x2f'),_0x9081('0x30'),_0x9081('0x31')]},{'model':_0x9081('0x32'),'as':_0x9081('0x33'),'attributes':['id','name']},{'model':_0x9081('0x2e'),'as':'TrunkBackup','attributes':['id',_0x9081('0x2f'),'callerid',_0x9081('0x31')]},{'model':_0x9081('0x34'),'as':_0x9081('0x34'),'attributes':['id',_0x9081('0x2f')],'include':[{'model':_0x9081('0x34'),'as':_0x9081('0x35'),'attributes':['id',_0x9081('0x2f'),_0x9081('0x36')]}]}]},'log':_0x9081('0x0')});};}; \ No newline at end of file +var _0xfb8c=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0xfb8c,0x14d));var _0xcfb8=function(_0x45820d,_0x1775a8){_0x45820d=_0x45820d-0x0;var _0x48a392=_0xfb8c[_0x45820d];return _0x48a392;};'use strict';var client=require(_0xcfb8('0x0'));exports[_0xcfb8('0x1')]=function(){return function(){return client[_0xcfb8('0x2')](_0xcfb8('0x3'),{'options':{'raw':![],'attributes':['id',_0xcfb8('0x4'),_0xcfb8('0x5'),'acwTimeout',_0xcfb8('0x6'),_0xcfb8('0x7'),_0xcfb8('0x8'),_0xcfb8('0x9'),'dialMethod',_0xcfb8('0xa'),'dialLimitQueue',_0xcfb8('0xb'),_0xcfb8('0xc'),'dialPredictiveOptimizationPercentage',_0xcfb8('0xd'),_0xcfb8('0xe'),_0xcfb8('0xf'),_0xcfb8('0x10'),_0xcfb8('0x11'),'dialQueueTimeout',_0xcfb8('0x12'),_0xcfb8('0x13'),_0xcfb8('0x14'),_0xcfb8('0x15'),_0xcfb8('0x16'),_0xcfb8('0x17'),_0xcfb8('0x18'),_0xcfb8('0x19'),_0xcfb8('0x1a'),_0xcfb8('0x1b'),_0xcfb8('0x1c'),'dialCheckDuplicateType',_0xcfb8('0x1d'),_0xcfb8('0x1e'),'dialAMDGreeting',_0xcfb8('0x1f'),_0xcfb8('0x20'),_0xcfb8('0x21'),'dialAMDBetweenWordsSilence',_0xcfb8('0x22'),_0xcfb8('0x23'),_0xcfb8('0x24'),_0xcfb8('0x25'),_0xcfb8('0x26'),_0xcfb8('0x27'),_0xcfb8('0x28'),'dialAgiAfterHangupAgent',_0xcfb8('0x29'),_0xcfb8('0x2a'),_0xcfb8('0x7'),_0xcfb8('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xcfb8('0x2c'),'dialNoSuchNumberRetryFrequency',_0xcfb8('0x2d'),_0xcfb8('0x2e'),_0xcfb8('0x2f'),'dialAbandonedRetryFrequency',_0xcfb8('0x30'),_0xcfb8('0x31'),'dialAgentRejectMaxRetry',_0xcfb8('0x32'),_0xcfb8('0x33'),_0xcfb8('0x34'),_0xcfb8('0x35'),_0xcfb8('0x36'),_0xcfb8('0x37')],'include':[{'model':_0xcfb8('0x38'),'as':_0xcfb8('0x38'),'attributes':['id','name','callerid',_0xcfb8('0x39')]},{'model':_0xcfb8('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0xcfb8('0x4')]},{'model':'Trunk','as':_0xcfb8('0x3b'),'attributes':['id',_0xcfb8('0x4'),_0xcfb8('0x3c'),_0xcfb8('0x39')]},{'model':_0xcfb8('0x3d'),'as':_0xcfb8('0x3d'),'attributes':['id',_0xcfb8('0x4')],'include':[{'model':_0xcfb8('0x3d'),'as':_0xcfb8('0x3e'),'attributes':['id','name',_0xcfb8('0x3f')]}]}]},'log':_0xcfb8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 85d0e3f..f1b8f56 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(_0x45309b,_0x2316f9){var _0x5da0c6=function(_0x4bb3d9){while(--_0x4bb3d9){_0x45309b['push'](_0x45309b['shift']());}};_0x5da0c6(++_0x2316f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x2252b9,_0x48bba6){var _0x1d2db9=function(_0x2557e9){while(--_0x2557e9){_0x2252b9['push'](_0x2252b9['shift']());}};_0x1d2db9(++_0x48bba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 c3a0f8f..c50edfc 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 _0x7823=['Request','getVoiceQueueRtPauses'];(function(_0x51eb9f,_0x1b83a1){var _0x5c004b=function(_0x3a91b8){while(--_0x3a91b8){_0x51eb9f['push'](_0x51eb9f['shift']());}};_0x5c004b(++_0x1b83a1);}(_0x7823,0x65));var _0x3782=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7823[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0x3782('0x0')]=function(_0x40a2c7){return function(){return client[_0x3782('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x40a2c7,'paused':!![]},'raw':!![]},'log':_0x3782('0x0')});};}; \ No newline at end of file +var _0xdf40=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x469bae,_0x1e34f4){var _0x563ad6=function(_0x91ba7){while(--_0x91ba7){_0x469bae['push'](_0x469bae['shift']());}};_0x563ad6(++_0x1e34f4);}(_0xdf40,0x19f));var _0x0df4=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xdf40[_0x2e53e1];return _0x3a23de;};'use strict';var client=require(_0x0df4('0x0'));exports[_0x0df4('0x1')]=function(_0x698ae9){return function(){return client[_0x0df4('0x2')](_0x0df4('0x3'),{'options':{'where':{'VoiceQueueId':_0x698ae9,'paused':!![]},'raw':!![]},'log':_0x0df4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 9f03425..5fb6003 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x360f4b,_0xacdc29){var _0x5a28d3=function(_0x39f7c3){while(--_0x39f7c3){_0x360f4b['push'](_0x360f4b['shift']());}};_0x5a28d3(++_0xacdc29);}(_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 +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x12b97a,_0x1c95d7){var _0x3e6453=function(_0x107049){while(--_0x107049){_0x12b97a['push'](_0x12b97a['shift']());}};_0x3e6453(++_0x1c95d7);}(_0x7a54,0x106));var _0x47a5=function(_0x44ec44,_0x1326cb){_0x44ec44=_0x44ec44-0x0;var _0x112f2a=_0x7a54[_0x44ec44];return _0x112f2a;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4fac0ca..e6efd0b 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 _0xec07=['transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','blind','attendedTransfer','Request','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum'];(function(_0x586256,_0x3b0e98){var _0x1e2dc9=function(_0x2ad672){while(--_0x2ad672){_0x586256['push'](_0x586256['shift']());}};_0x1e2dc9(++_0x3b0e98);}(_0xec07,0x95));var _0x7ec0=function(_0x3cfafc,_0x3e7c92){_0x3cfafc=_0x3cfafc-0x0;var _0x4fcc06=_0xec07[_0x3cfafc];return _0x4fcc06;};'use strict';var client=require(_0x7ec0('0x0'));exports[_0x7ec0('0x1')]={};exports[_0x7ec0('0x2')]=function(_0x126afc){return client['Request'](_0x7ec0('0x3'),{'body':{'result':_0x126afc[_0x7ec0('0x4')],'transfererchannel':_0x126afc['transfererchannel'],'transferercalleridnum':_0x126afc[_0x7ec0('0x5')],'transferercalleridname':_0x126afc['transferercalleridname'],'transfererconnectedlinenum':_0x126afc[_0x7ec0('0x6')],'transfererconnectedlinename':_0x126afc['transfererconnectedlinename'],'transfereraccountcode':_0x126afc['transfereraccountcode'],'transferercontext':_0x126afc[_0x7ec0('0x7')],'transfererexten':_0x126afc['transfererexten'],'transfererlinkedid':_0x126afc['transfererlinkedid'],'transfereechannel':_0x126afc[_0x7ec0('0x8')],'transfereecalleridnum':_0x126afc[_0x7ec0('0x9')],'transfereecalleridname':_0x126afc[_0x7ec0('0xa')],'transfereeconnectedlinenum':_0x126afc[_0x7ec0('0xb')],'transfereeconnectedlinename':_0x126afc[_0x7ec0('0xc')],'transfereeaccountcode':_0x126afc[_0x7ec0('0xd')],'transfereecontext':_0x126afc[_0x7ec0('0xe')],'transfereeexten':_0x126afc[_0x7ec0('0xf')],'transfereelinkedid':_0x126afc[_0x7ec0('0x10')],'isexternal':_0x126afc['isexternal'],'context':_0x126afc['context'],'extension':_0x126afc[_0x7ec0('0x11')],'type':_0x7ec0('0x12')},'log':_0x7ec0('0x3')});};exports[_0x7ec0('0x13')]=function(_0x49ce9c){return client[_0x7ec0('0x14')](_0x7ec0('0x3'),{'body':{'result':_0x49ce9c['result'],'transfererchannel':_0x49ce9c['origtransfererchannel'],'transferercalleridnum':_0x49ce9c[_0x7ec0('0x15')],'transferercalleridname':_0x49ce9c['origtransferercalleridname'],'transfererconnectedlinenum':_0x49ce9c[_0x7ec0('0x16')],'transfererconnectedlinename':_0x49ce9c[_0x7ec0('0x17')],'transfereraccountcode':_0x49ce9c['origtransfereraccountcode'],'transferercontext':_0x49ce9c[_0x7ec0('0x18')],'transfererexten':_0x49ce9c[_0x7ec0('0x19')],'transfererlinkedid':_0x49ce9c[_0x7ec0('0x1a')],'transfereechannel':_0x49ce9c['transfertargetchannel'],'transfereecalleridnum':_0x49ce9c[_0x7ec0('0x1b')],'transfereecalleridname':_0x49ce9c[_0x7ec0('0x1c')],'transfereeconnectedlinenum':_0x49ce9c[_0x7ec0('0x1d')],'transfereeconnectedlinename':_0x49ce9c[_0x7ec0('0x1e')],'transfereeaccountcode':_0x49ce9c[_0x7ec0('0x1f')],'transfereecontext':_0x49ce9c[_0x7ec0('0x20')],'transfereeexten':_0x49ce9c[_0x7ec0('0x21')],'transfereelinkedid':_0x49ce9c[_0x7ec0('0x22')],'isexternal':_0x49ce9c[_0x7ec0('0x23')],'context':_0x49ce9c[_0x7ec0('0x24')],'extension':_0x49ce9c[_0x7ec0('0x25')],'type':_0x7ec0('0x26')},'log':_0x7ec0('0x3')});}; \ No newline at end of file +var _0x4a9e=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x4a9e,0xfe));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe4a9('0x0'));exports['transfers']={};exports[_0xe4a9('0x1')]=function(_0x219d48){return client[_0xe4a9('0x2')](_0xe4a9('0x3'),{'body':{'result':_0x219d48[_0xe4a9('0x4')],'transfererchannel':_0x219d48[_0xe4a9('0x5')],'transferercalleridnum':_0x219d48[_0xe4a9('0x6')],'transferercalleridname':_0x219d48[_0xe4a9('0x7')],'transfererconnectedlinenum':_0x219d48[_0xe4a9('0x8')],'transfererconnectedlinename':_0x219d48['transfererconnectedlinename'],'transfereraccountcode':_0x219d48['transfereraccountcode'],'transferercontext':_0x219d48[_0xe4a9('0x9')],'transfererexten':_0x219d48[_0xe4a9('0xa')],'transfererlinkedid':_0x219d48[_0xe4a9('0xb')],'transfereechannel':_0x219d48[_0xe4a9('0xc')],'transfereecalleridnum':_0x219d48[_0xe4a9('0xd')],'transfereecalleridname':_0x219d48[_0xe4a9('0xe')],'transfereeconnectedlinenum':_0x219d48['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x219d48[_0xe4a9('0xf')],'transfereeaccountcode':_0x219d48[_0xe4a9('0x10')],'transfereecontext':_0x219d48[_0xe4a9('0x11')],'transfereeexten':_0x219d48[_0xe4a9('0x12')],'transfereelinkedid':_0x219d48[_0xe4a9('0x13')],'isexternal':_0x219d48[_0xe4a9('0x14')],'context':_0x219d48[_0xe4a9('0x15')],'extension':_0x219d48[_0xe4a9('0x16')],'type':_0xe4a9('0x17')},'log':_0xe4a9('0x3')});};exports[_0xe4a9('0x18')]=function(_0x524223){return client[_0xe4a9('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x524223['result'],'transfererchannel':_0x524223['origtransfererchannel'],'transferercalleridnum':_0x524223[_0xe4a9('0x19')],'transferercalleridname':_0x524223[_0xe4a9('0x1a')],'transfererconnectedlinenum':_0x524223[_0xe4a9('0x1b')],'transfererconnectedlinename':_0x524223[_0xe4a9('0x1c')],'transfereraccountcode':_0x524223[_0xe4a9('0x1d')],'transferercontext':_0x524223[_0xe4a9('0x1e')],'transfererexten':_0x524223['secondtransfererexten'],'transfererlinkedid':_0x524223[_0xe4a9('0x1f')],'transfereechannel':_0x524223['transfertargetchannel'],'transfereecalleridnum':_0x524223[_0xe4a9('0x20')],'transfereecalleridname':_0x524223[_0xe4a9('0x21')],'transfereeconnectedlinenum':_0x524223[_0xe4a9('0x22')],'transfereeconnectedlinename':_0x524223[_0xe4a9('0x23')],'transfereeaccountcode':_0x524223[_0xe4a9('0x24')],'transfereecontext':_0x524223[_0xe4a9('0x25')],'transfereeexten':_0x524223['transfertargetexten'],'transfereelinkedid':_0x524223[_0xe4a9('0x26')],'isexternal':_0x524223[_0xe4a9('0x14')],'context':_0x524223['origtransferercontext'],'extension':_0x524223[_0xe4a9('0x27')],'type':'attended'},'log':_0xe4a9('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index bbc9dac..123a3fb 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x500571,_0x2d90b5){var _0x153e8b=function(_0x48494e){while(--_0x48494e){_0x500571['push'](_0x500571['shift']());}};_0x153e8b(++_0x2d90b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1eaf5e,_0x333d16){_0x1eaf5e=_0x1eaf5e-0x0;var _0x409fa2=_0xb10b[_0x1eaf5e];return _0x409fa2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0xab2890,_0xefb07c){var _0x2a348c=function(_0x386270){while(--_0x386270){_0xab2890['push'](_0xab2890['shift']());}};_0x2a348c(++_0xefb07c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0xb10b[_0x2226c1];return _0x178716;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index bdef683..fa921eb 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 _0xd7a1=['lastName','phone','mobile','fax','createdAt','scheduledAt','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','defaults','localhost','socket.io-emitter','redis','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','map','routeId','calleridnum','firstName'];(function(_0x50f44b,_0x385976){var _0x389128=function(_0x3a2818){while(--_0x3a2818){_0x50f44b['push'](_0x50f44b['shift']());}};_0x389128(++_0x385976);}(_0xd7a1,0x136));var _0x1d7a=function(_0x50818c,_0x4dbf5c){_0x50818c=_0x50818c-0x0;var _0x46fe84=_0xd7a1[_0x50818c];return _0x46fe84;};'use strict';var _=require(_0x1d7a('0x0'));var BPromise=require('bluebird');var Redis=require(_0x1d7a('0x1'));var util=require(_0x1d7a('0x2'));var config=require(_0x1d7a('0x3'));var logger=require(_0x1d7a('0x4'))(_0x1d7a('0x5'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x1d7a('0x6')](config['redis'],{'host':_0x1d7a('0x7'),'port':0x18eb});var io=require(_0x1d7a('0x8'))(new Redis(config[_0x1d7a('0x9')]));function emit(_0x1fdacf,_0x342a49,_0x4a5733,_0x3719c1,_0x17f287){logger[_0x1d7a('0xa')](_0x1d7a('0xb'),_0x1fdacf,_0x342a49['id'],_0x4a5733,_0x3719c1,JSON[_0x1d7a('0xc')](_0x17f287));io['to'](_0x4a5733)[_0x1d7a('0xd')](_0x3719c1,_0x17f287);}exports[_0x1d7a('0xe')]=function(_0x5b6f8b,_0x1b3cac,_0x520844,_0x5d778a){var _0x2a1668,_0x396d92;var _0x42286e={};var _0x3d18a4;var _0x517fb1=Number(_0x520844[_0x1d7a('0xf')]);var _0x3df15a=_0x520844['data2']?Boolean(Number(_0x520844[_0x1d7a('0x10')])):![];var _0x4378cf;var _0xd7cded=![];if(!_[_0x1d7a('0x11')](_0x520844[_0x1d7a('0x12')])){if(_0x520844[_0x1d7a('0x12')]=='1')_0xd7cded=!![];}if(!_0xd7cded){if(_0x5d778a['xmd-contactid']){_0x42286e['id']=_0x5d778a[_0x1d7a('0x13')];}}if(!_0x42286e['id']){_0x42286e[_0x1d7a('0x14')]=_0x517fb1;_0x4378cf=_0x520844[_0x1d7a('0x15')]&&_0x520844[_0x1d7a('0x15')]!=='0'?_0x520844[_0x1d7a('0x15')]['split'](','):['phone'];_0x42286e['$or']=_[_0x1d7a('0x16')](_0x4378cf,function(_0x399c48){var _0x3df33c={};_0x3df33c[_0x399c48]=_0x5d778a[_0x1d7a('0x17')]?_0x5d778a['destcalleridnum']:_0x5d778a[_0x1d7a('0x18')];return _0x3df33c;});_0x3d18a4=_0x5d778a[_0x1d7a('0x17')]?_0x5d778a['destcalleridnum']:_0x5d778a[_0x1d7a('0x18')];}var _0x18da18=['id',_0x1d7a('0x19'),_0x1d7a('0x1a'),_0x1d7a('0x1b'),_0x1d7a('0x1c'),_0x1d7a('0x1d'),'ListId',_0x1d7a('0x1e'),_0x1d7a('0x1f'),'updatedAt'];var _0x64e3c2=_['union'](_0x18da18,_0x4378cf);BPromise['resolve']()[_0x1d7a('0x20')](cmContactRpc[_0x1d7a('0x21')]({'attributes':_0x64e3c2,'where':_0x42286e,'phone':_0x3d18a4}))[_0x1d7a('0x20')](function(_0x5acf95){_0x396d92=_0x5acf95;if(!_[_0x1d7a('0x22')](_0x396d92)){if(_0x396d92[_0x1d7a('0x23')]===0x1){_0x2a1668=_0x396d92[0x0];logger[_0x1d7a('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x5d778a[_0x1d7a('0x24')],_0x1b3cac['id'],_0x2a1668['id']);}else{logger[_0x1d7a('0xa')](_0x1d7a('0x25'),_0x5d778a[_0x1d7a('0x24')],_0x1b3cac['id'],_[_0x1d7a('0x16')](_0x396d92,'id')[_0x1d7a('0x26')](','));}return;}else{logger[_0x1d7a('0xa')](_0x1d7a('0x27'),_0x5d778a['uniqueid'],_0x1b3cac['id']);var _0x128a4e={'ListId':_0x517fb1};var _0x61699f=_0x520844[_0x1d7a('0x28')]&&_0x520844[_0x1d7a('0x28')]!=='0'?_0x520844[_0x1d7a('0x28')]:_0x1d7a('0x1b');if(_0x3df15a){logger[_0x1d7a('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x5d778a[_0x1d7a('0x24')],_0x1b3cac['id']);_0x128a4e[_0x61699f]=_[_0x1d7a('0x11')](_0x5d778a[_0x1d7a('0x17')])?_0x5d778a['calleridnum']:_0x5d778a[_0x1d7a('0x29')];if(_[_0x1d7a('0x11')](_0x5d778a['routeId'])){_0x128a4e[_0x1d7a('0x19')]=_0x5d778a[_0x1d7a('0x2a')]&&_0x5d778a[_0x1d7a('0x2a')]!==_0x1d7a('0x2b')?_0x5d778a[_0x1d7a('0x2a')]:_0x1d7a('0x2c');}else{_0x128a4e[_0x1d7a('0x19')]=_0x5d778a['destcalleridname']&&_0x5d778a[_0x1d7a('0x2d')]!==_0x1d7a('0x2b')?_0x5d778a['destcalleridname']:'Unknown';}return BPromise[_0x1d7a('0x2e')]()[_0x1d7a('0x20')](cmContactRpc[_0x1d7a('0x2f')](_0x128a4e))[_0x1d7a('0x20')](function(_0x1242a0){_0x2a1668=_0x1242a0;_0x396d92[_0x1d7a('0x30')](_0x1242a0);if(_0x2a1668){logger[_0x1d7a('0xa')](_0x1d7a('0x31'),_0x5d778a[_0x1d7a('0x24')],_0x1b3cac['id'],_0x2a1668['id']);}return;});}else{logger[_0x1d7a('0xa')](_0x1d7a('0x32'),_0x5d778a[_0x1d7a('0x24')],_0x1b3cac['id']);_0x128a4e[_0x61699f]=_[_0x1d7a('0x11')](_0x5d778a[_0x1d7a('0x17')])?_0x5d778a[_0x1d7a('0x18')]:_0x5d778a[_0x1d7a('0x29')];if(_[_0x1d7a('0x11')](_0x5d778a[_0x1d7a('0x17')])){_0x128a4e[_0x1d7a('0x19')]=_0x5d778a[_0x1d7a('0x2a')]&&_0x5d778a[_0x1d7a('0x2a')]!==_0x1d7a('0x2b')?_0x5d778a['calleridname']:_0x1d7a('0x2c');}else{_0x128a4e[_0x1d7a('0x19')]=_0x5d778a['destcalleridname']&&_0x5d778a[_0x1d7a('0x2d')]!==_0x1d7a('0x2b')?_0x5d778a[_0x1d7a('0x2d')]:_0x1d7a('0x2c');}_0x2a1668=_0x128a4e;_0x396d92[_0x1d7a('0x30')](_0x128a4e);return;}}})[_0x1d7a('0x20')](function(){if(_0x5b6f8b){emit(_0x5d778a['uniqueid'],_0x1b3cac,util[_0x1d7a('0x33')]('user:%s',_0x5b6f8b['name']),util[_0x1d7a('0x33')](_0x1d7a('0x34'),_0x520844[_0x1d7a('0x35')][_0x1d7a('0x36')]()),{'evt':_[_0x1d7a('0x37')](_0x5d778a,{'autoCreate':_0x3df15a}),'contact':_0x2a1668===undefined?{}:_0x2a1668,'contacts':_0x396d92[_0x1d7a('0x23')]===0x0?undefined:_0x396d92});}});}; \ No newline at end of file +var _0xa5cd=['[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','info','push','user:%s','trigger:%s','toLowerCase','merge','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter'];(function(_0x34f3a7,_0x29557e){var _0x499f15=function(_0x5b41a7){while(--_0x5b41a7){_0x34f3a7['push'](_0x34f3a7['shift']());}};_0x499f15(++_0x29557e);}(_0xa5cd,0xd3));var _0xda5c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa5cd[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xda5c('0x0'));var util=require(_0xda5c('0x1'));var config=require(_0xda5c('0x2'));var logger=require('../../../../config/logger')(_0xda5c('0x3'));var cmContactRpc=require(_0xda5c('0x4'));config[_0xda5c('0x5')]=_[_0xda5c('0x6')](config[_0xda5c('0x5')],{'host':_0xda5c('0x7'),'port':0x18eb});var io=require(_0xda5c('0x8'))(new Redis(config['redis']));function emit(_0x7006b3,_0x3c2094,_0x2df01d,_0xa18ef3,_0x4ee173){logger['info'](_0xda5c('0x9'),_0x7006b3,_0x3c2094['id'],_0x2df01d,_0xa18ef3,JSON[_0xda5c('0xa')](_0x4ee173));io['to'](_0x2df01d)[_0xda5c('0xb')](_0xa18ef3,_0x4ee173);}exports['exec']=function(_0x260deb,_0x379589,_0x589607,_0x58711f){var _0x8bcbd4,_0x34fdf4;var _0x19064e={};var _0x4e88da;var _0x365102=Number(_0x589607[_0xda5c('0xc')]);var _0x5bf7b9=_0x589607[_0xda5c('0xd')]?Boolean(Number(_0x589607[_0xda5c('0xd')])):![];var _0x8197a6;var _0x5b5c68=![];if(!_[_0xda5c('0xe')](_0x589607[_0xda5c('0xf')])){if(_0x589607[_0xda5c('0xf')]=='1')_0x5b5c68=!![];}if(!_0x5b5c68){if(_0x58711f[_0xda5c('0x10')]){_0x19064e['id']=_0x58711f['xmd-contactid'];}}if(!_0x19064e['id']){_0x19064e[_0xda5c('0x11')]=_0x365102;_0x8197a6=_0x589607['data3']&&_0x589607[_0xda5c('0x12')]!=='0'?_0x589607['data3'][_0xda5c('0x13')](','):['phone'];_0x19064e[_0xda5c('0x14')]=_['map'](_0x8197a6,function(_0x236ad5){var _0x44dae0={};_0x44dae0[_0x236ad5]=_0x58711f[_0xda5c('0x15')]?_0x58711f[_0xda5c('0x16')]:_0x58711f[_0xda5c('0x17')];return _0x44dae0;});_0x4e88da=_0x58711f['routeId']?_0x58711f[_0xda5c('0x16')]:_0x58711f[_0xda5c('0x17')];}var _0x1ab310=['id',_0xda5c('0x18'),_0xda5c('0x19'),_0xda5c('0x1a'),_0xda5c('0x1b'),_0xda5c('0x1c'),_0xda5c('0x11'),_0xda5c('0x1d'),_0xda5c('0x1e'),_0xda5c('0x1f')];var _0x5dea88=_[_0xda5c('0x20')](_0x1ab310,_0x8197a6);BPromise['resolve']()['then'](cmContactRpc['getContacts']({'attributes':_0x5dea88,'where':_0x19064e,'phone':_0x4e88da}))[_0xda5c('0x21')](function(_0xe03191){_0x34fdf4=_0xe03191;if(!_[_0xda5c('0x22')](_0x34fdf4)){if(_0x34fdf4[_0xda5c('0x23')]===0x1){_0x8bcbd4=_0x34fdf4[0x0];logger['info'](_0xda5c('0x24'),_0x58711f[_0xda5c('0x25')],_0x379589['id'],_0x8bcbd4['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x58711f[_0xda5c('0x25')],_0x379589['id'],_[_0xda5c('0x26')](_0x34fdf4,'id')[_0xda5c('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x58711f['uniqueid'],_0x379589['id']);var _0x190a6f={'ListId':_0x365102};var _0x14e06f=_0x589607[_0xda5c('0x28')]&&_0x589607['data4']!=='0'?_0x589607[_0xda5c('0x28')]:_0xda5c('0x1a');if(_0x5bf7b9){logger['info'](_0xda5c('0x29'),_0x58711f[_0xda5c('0x25')],_0x379589['id']);_0x190a6f[_0x14e06f]=_[_0xda5c('0xe')](_0x58711f['routeId'])?_0x58711f[_0xda5c('0x17')]:_0x58711f['destcalleridnum'];if(_[_0xda5c('0xe')](_0x58711f[_0xda5c('0x15')])){_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2a')]&&_0x58711f[_0xda5c('0x2a')]!==_0xda5c('0x2b')?_0x58711f[_0xda5c('0x2a')]:'Unknown';}else{_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2c')]&&_0x58711f[_0xda5c('0x2c')]!==_0xda5c('0x2b')?_0x58711f[_0xda5c('0x2c')]:_0xda5c('0x2d');}return BPromise[_0xda5c('0x2e')]()[_0xda5c('0x21')](cmContactRpc[_0xda5c('0x2f')](_0x190a6f))[_0xda5c('0x21')](function(_0x235a9f){_0x8bcbd4=_0x235a9f;_0x34fdf4['push'](_0x235a9f);if(_0x8bcbd4){logger['info'](_0xda5c('0x30'),_0x58711f['uniqueid'],_0x379589['id'],_0x8bcbd4['id']);}return;});}else{logger[_0xda5c('0x31')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x58711f['uniqueid'],_0x379589['id']);_0x190a6f[_0x14e06f]=_[_0xda5c('0xe')](_0x58711f[_0xda5c('0x15')])?_0x58711f['calleridnum']:_0x58711f[_0xda5c('0x16')];if(_[_0xda5c('0xe')](_0x58711f[_0xda5c('0x15')])){_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2a')]&&_0x58711f[_0xda5c('0x2a')]!==_0xda5c('0x2b')?_0x58711f['calleridname']:'Unknown';}else{_0x190a6f[_0xda5c('0x18')]=_0x58711f[_0xda5c('0x2c')]&&_0x58711f[_0xda5c('0x2c')]!==''?_0x58711f['destcalleridname']:_0xda5c('0x2d');}_0x8bcbd4=_0x190a6f;_0x34fdf4[_0xda5c('0x32')](_0x190a6f);return;}}})[_0xda5c('0x21')](function(){if(_0x260deb){emit(_0x58711f[_0xda5c('0x25')],_0x379589,util['format'](_0xda5c('0x33'),_0x260deb['name']),util['format'](_0xda5c('0x34'),_0x589607['action'][_0xda5c('0x35')]()),{'evt':_[_0xda5c('0x36')](_0x58711f,{'autoCreate':_0x5bf7b9}),'contact':_0x8bcbd4===undefined?{}:_0x8bcbd4,'contacts':_0x34fdf4['length']===0x0?undefined:_0x34fdf4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8d4e598..ef6ab9a 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 _0x14ae=['600','winApplication','winArguments','data3','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','merge','integration','exec','urlforward','script','parse','query','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','some','checkTrigger:\x20trigger','evt','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','url','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','prototype','emit','info','stringify','motionChannel','debug','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','render','templates','template\x20not\x20found','uri','isNil','data4','location','uriLocation','windowWidth','data5','800','data6'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x14ae,0x1b0));var _0xe14a=function(_0x128326,_0x2b36a0){_0x128326=_0x128326-0x0;var _0x3c623d=_0x14ae[_0x128326];return _0x3c623d;};'use strict';var util=require(_0xe14a('0x0'));var _=require(_0xe14a('0x1'));var url=require('url');var Mustache=require(_0xe14a('0x2'));var Redis=require(_0xe14a('0x3'));var urlforward=require(_0xe14a('0x4'));var integration=require(_0xe14a('0x5'));var cmContact=require(_0xe14a('0x6'));var script=require('./script');var config=require(_0xe14a('0x7'));var logger=require(_0xe14a('0x8'))(_0xe14a('0x9'));var ami=require(_0xe14a('0xa'));config[_0xe14a('0xb')]=_['defaults'](config['redis'],{'host':_0xe14a('0xc'),'port':0x18eb});var io=require(_0xe14a('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x5396f0,_0x358ef0){return _0x5396f0==_0x358ef0;},'not_equals':function(_0x152539,_0x11eeb0){return _0x152539!=_0x11eeb0;}};var barAndWebActions=[_0xe14a('0xe'),_0xe14a('0xf'),'winapp'];function Trigger(_0x4743a8){this[_0xe14a('0x10')]=_0x4743a8[_0xe14a('0x10')];this[_0xe14a('0x11')]=_0x4743a8[_0xe14a('0x11')];this[_0xe14a('0x12')]=_0x4743a8[_0xe14a('0x12')];this['templates']=_0x4743a8['templates'];this['voiceExtensions']=_0x4743a8[_0xe14a('0x13')];this[_0xe14a('0x14')]=_0x4743a8[_0xe14a('0x14')];this[_0xe14a('0x15')]=_0x4743a8[_0xe14a('0x15')];this[_0xe14a('0x16')]=_0x4743a8[_0xe14a('0x16')];this['sugarcrmAccounts']=_0x4743a8[_0xe14a('0x17')];this[_0xe14a('0x18')]=_0x4743a8[_0xe14a('0x18')];this[_0xe14a('0x19')]=_0x4743a8[_0xe14a('0x19')];this[_0xe14a('0x1a')]=_0x4743a8[_0xe14a('0x1a')];this[_0xe14a('0x1b')]=_0x4743a8['servicenowAccounts'];this[_0xe14a('0x1c')]=_0x4743a8[_0xe14a('0x1c')];this[_0xe14a('0x1d')]=_0x4743a8[_0xe14a('0x1d')];this[_0xe14a('0x1e')]={'zendesk':this[_0xe14a('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe14a('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xe14a('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xe14a('0x1d')],'servicenow':this[_0xe14a('0x1b')]};ami['on']('custom:agentcalled',this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x21'),this['syncCustomEvent'][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x22'),this['syncCustomEvent'][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x23'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x24'),this['syncCustomEvent'][_0xe14a('0x20')](this));ami['on']('custom:agentcongestion',this[_0xe14a('0x1f')]['bind'](this));ami['on'](_0xe14a('0x25'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x26'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x27'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x28'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on'](_0xe14a('0x29'),this[_0xe14a('0x2a')][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x2b'),this['syncAgentDial'][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x2c'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x2d'),this['syncCustomEvent'][_0xe14a('0x20')](this));ami['on']('custom:substatus',this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:incomingmessage',this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on'](_0xe14a('0x2e'),this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:acceptmessage',this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:rejectmessage',this[_0xe14a('0x1f')][_0xe14a('0x20')](this));ami['on']('custom:offlineMessage',this[_0xe14a('0x1f')]['bind'](this));}Trigger[_0xe14a('0x2f')][_0xe14a('0x30')]=function(_0x107071,_0x1ac4bd,_0x2b8d7c){logger[_0xe14a('0x31')](_0x107071,_0x1ac4bd,JSON[_0xe14a('0x32')](_0x2b8d7c));io['to'](_0x107071)['emit'](_0x1ac4bd,_0x2b8d7c);};Trigger[_0xe14a('0x2f')]['syncCustomEvent']=function(_0x826bb4){var _0x43e244=_['clone'](_0x826bb4);if(typeof _0x43e244['motionChannel']==='undefined'){_0x43e244[_0xe14a('0x33')]='voice';}logger[_0xe14a('0x34')]('syncCustomEvent',util[_0xe14a('0x35')](_0x43e244,{'showHidden':!![],'depth':null}));this[_0xe14a('0x36')](_0x43e244);};Trigger[_0xe14a('0x2f')][_0xe14a('0x2a')]=function(_0x44a16f){if(this['agents'][_0x44a16f[_0xe14a('0x37')]]){this[_0xe14a('0x1f')](_0x44a16f);}};Trigger['prototype'][_0xe14a('0x36')]=function(_0x44debc){var _0x5924b6;for(var _0x11192f in this[_0xe14a('0x10')]){if(this['triggers'][_0xe14a('0x38')](_0x11192f)){if(this[_0xe14a('0x10')][_0x11192f]['status']){_0x5924b6=this[_0xe14a('0x39')](this[_0xe14a('0x10')][_0x11192f],_0x44debc);if(_0x5924b6){_['merge'](_0x44debc,_0x44debc['variables']);for(var _0x56ca2a=0x0,_0x1b66a7,_0x2c8cf2,_0x10b051;_0x56ca2a0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x1e3e94,_0x3658af){var _0x5204f5=function(_0x48de55){while(--_0x48de55){_0x1e3e94['push'](_0x1e3e94['shift']());}};_0x5204f5(++_0x3658af);}(_0x814b,0x1a2));var _0xb814=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x814b[_0x575057];return _0x49dbc8;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1ff777c..62080ab 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 _0x3567=['calleridnum','contacts','/systemusers(','4.0','body','headers','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','nameField','indexOf','content','incident','assign','Subjects','getString','Descriptions','/contacts(','Fields','ticketType','queue','callDirection','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','dynamics365','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','tenantId','CloudProvider','resolve','data5','POST','clientId','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','then','value','validateEmail','email','userEmail','internalemailaddress','isdisabled','info','systemuserid','length','userId','catch','toLowerCase','outbound','destcalleridnum'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3567,0x113));var _0x7356=function(_0x3e7606,_0x208252){_0x3e7606=_0x3e7606-0x0;var _0x594d8b=_0x3567[_0x3e7606];return _0x594d8b;};'use strict';var _=require(_0x7356('0x0'));var rp=require(_0x7356('0x1'));var util=require(_0x7356('0x2'));var intUtil=require(_0x7356('0x3'));var md5=require('md5');var Redis=require(_0x7356('0x4'));var logger=require('../../../../config/logger')(_0x7356('0x5'));var config=require('../../../../config/environment');config['redis']=_[_0x7356('0x6')](config[_0x7356('0x7')],{'host':_0x7356('0x8'),'port':0x18eb});var io=require(_0x7356('0x9'))(new Redis(config['redis']));function getAuthToken(_0x5a5a19,_0x3a1c2e,_0xda906){if(_0x5a5a19[_0x7356('0xa')]){_0x5a5a19[_0x7356('0xb')]=_0x5a5a19['CloudProvider']['data7'];_0x5a5a19[_0x7356('0xc')]=_0x5a5a19[_0x7356('0xd')]['data2'];return Promise[_0x7356('0xe')](_0x5a5a19[_0x7356('0xd')][_0x7356('0xf')]);}var _0x202d80={'method':_0x7356('0x10'),'uri':_0x3a1c2e,'form':{'client_id':_0x5a5a19[_0x7356('0x11')],'resource':_0x5a5a19['remoteUri'],'username':_0x5a5a19[_0x7356('0x12')],'password':_0x5a5a19[_0x7356('0x13')],'grant_type':_0x7356('0x13'),'client_secret':_0x5a5a19[_0x7356('0x14')]},'json':!![]};return rp(_0x202d80)['then'](function(_0x507335){return _0x507335[_0x7356('0x15')];})['catch'](function(_0x3e3002){logger[_0x7356('0x16')]('['+[_0xda906[_0x7356('0x17')]()]+_0x7356('0x18'));return _0x3e3002[_0x7356('0x19')];});}function getUser(_0x2cb4e2,_0x8a3c7d,_0x334ebb,_0x26d34f,_0x4bdb64,_0x32eeb3){return new Promise(function(_0x2a0fd9,_0x284acd){return getAuthToken(_0x8a3c7d,_0x26d34f,_0x32eeb3)['then'](function(_0x361cab){var _0x479dc6={'method':'GET','uri':_0x4bdb64+_0x7356('0x1a'),'headers':{'Authorization':_0x7356('0x1b')+_0x361cab,'OData-Version':'4.0'},'json':!![]};return rp(_0x479dc6);})[_0x7356('0x1c')](function(_0x1bbb69){var _0x4603bd=_0x1bbb69[_0x7356('0x1d')];var _0x153d10=![];var _0x169e4c=null;if(!_['isNil'](_0x334ebb)){if(intUtil[_0x7356('0x1e')](_0x334ebb[_0x7356('0x1f')])){_0x2cb4e2[_0x7356('0x20')]=_0x334ebb[_0x7356('0x1f')];for(_0x169e4c=0x0;_0x169e4c<_0x4603bd['length'];_0x169e4c++){if(_0x4603bd[_0x169e4c][_0x7356('0x21')]===_0x334ebb[_0x7356('0x1f')]&&!_0x4603bd[_0x169e4c][_0x7356('0x22')]){_0x153d10=!![];logger[_0x7356('0x23')]('['+[_0x32eeb3[_0x7356('0x17')]()]+']\x20Agent\x20found\x20'+_0x4603bd[_0x169e4c][_0x7356('0x24')]+'!');_0x2cb4e2['userId']=_0x4603bd[_0x169e4c][_0x7356('0x24')];}}}}if(!_0x153d10){logger[_0x7356('0x23')]('['+[_0x32eeb3['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2cb4e2['userEmail']=_0x8a3c7d[_0x7356('0x12')];for(_0x169e4c=0x0;_0x169e4c<_0x4603bd[_0x7356('0x25')];_0x169e4c++){if(_0x4603bd[_0x169e4c][_0x7356('0x21')]===_0x8a3c7d[_0x7356('0x12')]){_0x2cb4e2[_0x7356('0x26')]=_0x4603bd[_0x169e4c]['systemuserid'];}}}_0x2a0fd9(_0x2cb4e2);})[_0x7356('0x27')](function(_0x4da2e4){_0x284acd(_0x4da2e4[_0x7356('0x19')]);});});}function createEndUser(_0x257609,_0x2371cc,_0x33995a,_0x357a22,_0x571c57,_0x1e5ef6,_0x2b263f){return new Promise(function(_0x238b78,_0x4fa4f5){return getAuthToken(_0x2371cc,_0x33995a,_0x1e5ef6)[_0x7356('0x1c')](function(_0xc45452){var _0x26d5f1=_0x1e5ef6[_0x7356('0x28')]()===_0x7356('0x29')?_0x571c57[_0x7356('0x2a')]:_0x571c57[_0x7356('0x2b')];var _0x4d757c={'method':_0x7356('0x10'),'uri':_0x357a22+_0x7356('0x2c'),'body':{'fullname':_0x26d5f1,'firstname':_0x26d5f1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7356('0x2d')+_0x257609[_0x7356('0x26')]+')'},'headers':{'Authorization':_0x7356('0x1b')+_0xc45452,'OData-Version':_0x7356('0x2e')},'json':!![],'resolveWithFullResponse':!![]};_0x4d757c[_0x7356('0x2f')][_0x2b263f]=_0x26d5f1;return rp(_0x4d757c);})[_0x7356('0x1c')](function(_0x5e7918){var _0x1561ca=_0x5e7918[_0x7356('0x30')]['odata-entityid'];var _0x11ddbf=_0x1561ca[_0x7356('0x31')](_0x1561ca['lastIndexOf']('(')+0x1,_0x1561ca[_0x7356('0x32')](')'));_0x257609[_0x7356('0x33')]=_0x11ddbf;_0x238b78(_0x257609);})['catch'](function(_0x5c3629){_0x4fa4f5(_0x5c3629[_0x7356('0x19')]);});});}function getEndUser(_0x42a219,_0x398d36,_0x4c177f,_0x40f8d2,_0x4bf91b,_0x4dd6d9,_0x4dee94,_0xf98c7e){var _0x3644ed=_0x4dd6d9[_0x7356('0x28')]()===_0x7356('0x29')?_0x4bf91b[_0x7356('0x2a')]:_0x4bf91b[_0x7356('0x2b')];return getAuthToken(_0x398d36,_0x4c177f,_0x4dd6d9)[_0x7356('0x1c')](function(_0x5d55bd){_0xf98c7e=_0xf98c7e?_0xf98c7e:_0x7356('0x34');var _0x46f768={'method':_0x7356('0x35'),'uri':_0x40f8d2+_0x7356('0x36')+_0xf98c7e+'&$filter='+_0xf98c7e+_0x7356('0x37')+_0x3644ed['replace']('+',_0x7356('0x38'))+'\x27','headers':{'Authorization':_0x7356('0x1b')+_0x5d55bd,'If-None-Match':null,'OData-Version':_0x7356('0x2e')},'json':!![]};return rp(_0x46f768);})[_0x7356('0x1c')](function(_0x50f673){var _0xff4ad0=![];if(!_0x50f673)return _0xff4ad0;var _0x3fbf5c=_0x50f673[_0x7356('0x1d')];for(var _0x5748a2=0x0;_0x5748a2<_0x3fbf5c[_0x7356('0x25')];_0x5748a2++){if(_0x3fbf5c[_0x5748a2][_0xf98c7e]===_0x3644ed){_0xff4ad0=!![];_0x42a219[_0x7356('0x33')]=_0x3fbf5c[_0x5748a2][_0x7356('0x39')];}}return _0xff4ad0;})[_0x7356('0x1c')](function(_0x18d806){if(_0x18d806)return _0x42a219;if(_0x4dee94===_0x7356('0x3a')){logger[_0x7356('0x23')]('['+[_0x4dd6d9[_0x7356('0x17')]()]+_0x7356('0x3b'));return _0x42a219;}return createEndUser(_0x42a219,_0x398d36,_0x4c177f,_0x40f8d2,_0x4bf91b,_0x4dd6d9,_0xf98c7e)[_0x7356('0x1c')](function(_0x5847f1){logger[_0x7356('0x23')]('['+[_0x4dd6d9[_0x7356('0x17')]()]+_0x7356('0x3c'),_0x5847f1['enduserId']);return _0x5847f1;});});}function getCustomFields(_0xffef6a,_0x50d047,_0x2f1347){var _0x596a64={};if(_0xffef6a[_0x7356('0x25')]>0x0){_[_0x7356('0x3d')](_0xffef6a,function(_0x2556bf){if(_['includes']([_0x7356('0x3e'),_0x7356('0x3f')],_0x2556bf['type'])&&_0x2556bf[_0x7356('0x40')]&&!_0x2556bf['customField']){var _0x12547e=_0x2556bf['idField'][_0x7356('0x28')]();var _0x4bd577=_0x12547e[_0x7356('0x31')](0x0,_0x12547e[_0x7356('0x41')]('_'));var _0x3dde79=_0x12547e[_0x7356('0x31')](_0x12547e['indexOf']('_')+0x1);if(_0x4bd577===_0x2f1347){_0x596a64[_0x3dde79]=_0x2556bf[_0x7356('0x42')];}}});}return _0x596a64;}function getTicket(_0x364348,_0x14533d,_0x17c347,_0x544696,_0x1ca677,_0x4b1c35,_0x219a0f){return new Promise(function(_0x5d0f6c,_0x4b1b9c){var _0x22f407;return getAuthToken(_0x14533d,_0x17c347,_0x219a0f)[_0x7356('0x1c')](function(_0x302d3c){if(_0x4b1c35['ticketType']===_0x7356('0x43')){_0x22f407={'method':'POST','uri':_0x544696+'incidents','body':Object[_0x7356('0x44')]({},{'title':intUtil['getString'](_0x4b1c35[_0x7356('0x45')],_0x1ca677,'\x20'),'description':intUtil[_0x7356('0x46')](_0x4b1c35[_0x7356('0x47')],_0x1ca677,'\x0a'),'customerid_contact@odata.bind':_0x364348[_0x7356('0x33')]?_0x7356('0x48')+_0x364348[_0x7356('0x33')]+')':undefined,'ownerid@odata.bind':_0x7356('0x2d')+_0x364348['userId']+')','caseorigincode':'1'},getCustomFields(_0x4b1c35[_0x7356('0x49')],_0x1ca677,_0x4b1c35['ticketType'])),'headers':{'Authorization':_0x7356('0x1b')+_0x302d3c,'OData-Version':_0x7356('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4b1c35[_0x7356('0x4a')]==='phonecall'){var _0x48f946=_0x364348[_0x7356('0x33')]?[{'partyid_systemuser@odata.bind':_0x7356('0x2d')+_0x364348[_0x7356('0x26')]+')','participationtypemask':_0x364348['callDirection']===_0x7356('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x7356('0x48')+_0x364348['enduserId']+')','participationtypemask':_0x364348[_0x7356('0x4c')]===_0x7356('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x364348[_0x7356('0x26')]+')','participationtypemask':_0x364348[_0x7356('0x4c')]===_0x7356('0x4b')?0x2:0x1}];_0x22f407={'method':_0x7356('0x10'),'uri':_0x544696+_0x7356('0x4d'),'body':Object[_0x7356('0x44')]({},{'subject':intUtil[_0x7356('0x46')](_0x4b1c35[_0x7356('0x45')],_0x1ca677,'\x20'),'phonenumber':String(_0x1ca677['calleridnum']),'description':intUtil[_0x7356('0x46')](_0x4b1c35['Descriptions'],_0x1ca677,'\x0a'),'regardingobjectid_contact@odata.bind':_0x364348[_0x7356('0x33')]?_0x7356('0x48')+_0x364348[_0x7356('0x33')]+')':undefined,'ownerid@odata.bind':_0x7356('0x2d')+_0x364348[_0x7356('0x26')]+')','directioncode':_0x364348[_0x7356('0x4c')]===_0x7356('0x4b')?![]:!![],'phonecall_activity_parties':_0x48f946},getCustomFields(_0x4b1c35['Fields'],_0x1ca677,_0x4b1c35[_0x7356('0x4a')])),'headers':{'Authorization':_0x7356('0x1b')+_0x302d3c,'OData-Version':_0x7356('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x22f407);})[_0x7356('0x1c')](function(_0x59c765){var _0x4c4d81=_0x59c765[_0x7356('0x30')]['odata-entityid'];var _0x2a4b83=_0x4c4d81[_0x7356('0x31')](_0x4c4d81['lastIndexOf']('(')+0x1,_0x4c4d81[_0x7356('0x32')](')'));_0x364348[_0x7356('0x4e')]=_0x2a4b83;_0x5d0f6c(_0x364348);})[_0x7356('0x27')](function(_0x4a9342){_0x4b1b9c(_0x4a9342[_0x7356('0x19')]);});});}function emit(_0x42aec2,_0x540378,_0x1903f8,_0xe6d006){var _0x3290ed={'uri':util['format'](_0x7356('0x4f'),_0x42aec2,_0x1903f8,_0xe6d006)};io['to'](util[_0x7356('0x50')](_0x7356('0x51'),_0x540378))[_0x7356('0x52')](_0x7356('0x53'),_0x3290ed);}exports['cs']=function(_0xde5351,_0x4d86d0,_0x4ec45b,_0x24c261,_0x4d32ef,_0x2b6ede,_0x14cd46,_0x4f8212){var _0x4a9d56={};_0x2b6ede['remoteUri']=_0x2b6ede['modernAuthentication']?intUtil[_0x7356('0x54')](_0x2b6ede[_0x7356('0xd')][_0x7356('0x55')]):intUtil[_0x7356('0x54')](_0x2b6ede['remoteUri']);_0x2b6ede['serverUrl']=intUtil[_0x7356('0x54')](_0x2b6ede[_0x7356('0x56')]);_0x4a9d56[_0x7356('0x4c')]=_0x4f8212===_0x7356('0x4b')||_0x4f8212==='unmanaged'?_0x7356('0x4b'):'outbound';var _0x3405fb=_0x2b6ede[_0x7356('0xa')]?util['format'](_0x7356('0x57'),_0x2b6ede[_0x7356('0xd')][_0x7356('0x55')]):util['format'](_0x7356('0x57'),_0x2b6ede[_0x7356('0xb')]);var _0x1a1ff4=util[_0x7356('0x50')](_0x7356('0x58'),_0x2b6ede[_0x7356('0xc')]);var _0x31d691=util[_0x7356('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b6ede[_0x7356('0x56')],_0x4d86d0[_0x7356('0x59')],md5(_0x4d86d0[_0x7356('0x59')]));if(_0x4d32ef&&_0x4d32ef[_0x7356('0x5a')]){logger['info']('[QUEUE]',_0x7356('0x5b'));_0x4d86d0['recordingURL']=_0x31d691;}else if(_0x14cd46&&_0x14cd46[_0x7356('0x5c')]&&_0x14cd46[_0x7356('0x5c')]!==_0x7356('0x5d')){logger['info'](_0x7356('0x5e'),_0x7356('0x5b'));_0x4d86d0['recordingURL']=_0x31d691;}else{_0x4d86d0[_0x7356('0x5f')]='';}return getUser(_0x4a9d56,_0x2b6ede,_0x24c261,_0x1a1ff4,_0x3405fb,_0x4f8212)['then'](function(_0x26a6e6){logger[_0x7356('0x23')]('['+_0x4f8212['toUpperCase']()+_0x7356('0x60'),_0x26a6e6[_0x7356('0x26')]);logger[_0x7356('0x23')]('['+_0x4f8212[_0x7356('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x26a6e6[_0x7356('0x20')]);return getEndUser(_0x26a6e6,_0x2b6ede,_0x1a1ff4,_0x3405fb,_0x4d86d0,_0x4f8212,_0x4ec45b['moduleCreate'],_0x4ec45b[_0x7356('0x61')]);})[_0x7356('0x1c')](function(_0x17689e){logger[_0x7356('0x23')]('['+_0x4f8212[_0x7356('0x17')]()+_0x7356('0x62'),_0x17689e[_0x7356('0x33')]);logger['info']('['+_0x4f8212['toUpperCase']()+_0x7356('0x63'),_0x4d86d0['calleridnum']);return getTicket(_0x17689e,_0x2b6ede,_0x1a1ff4,_0x3405fb,_0x4d86d0,_0x4ec45b,_0x4f8212);})[_0x7356('0x1c')](function(_0x3acb12){logger['info'](util['format']('['+_0x4f8212[_0x7356('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4ec45b[_0x7356('0x4a')],_0x3acb12[_0x7356('0x4e')]));logger[_0x7356('0x23')](util[_0x7356('0x50')]('['+_0x4f8212[_0x7356('0x17')]()+_0x7356('0x64'),_0x4f8212));if(_0x4f8212!==_0x7356('0x65')&&_0x4ec45b['openNewTab']){logger[_0x7356('0x23')]('['+_0x4f8212['toUpperCase']()+']',_0x7356('0x66'));emit(_0x2b6ede['remoteUri'],_0x24c261[_0x7356('0x67')],_0x4ec45b[_0x7356('0x4a')],_0x3acb12['ticketId']);}})[_0x7356('0x27')](function(_0x3ab765){logger['error']('['+_0x4f8212['toUpperCase']()+_0x7356('0x68'),_0x3ab765[_0x7356('0x19')]);console[_0x7356('0x16')](_0x7356('0x69'),_0x3ab765);});}; \ No newline at end of file +var _0xe4a8=['type','nameField','customField','idField','substring','indexOf','incident','assign','getString','Descriptions','Fields','ticketType','phonecall','callDirection','queue','/contacts(','phonecalls','Subjects','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','data2','CloudProvider','data5','POST','password','then','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','catch','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing','toUpperCase',']\x20Enduser\x20created!','forEach','includes','string','picklist'];(function(_0x1634b7,_0xa6002c){var _0x28f3c4=function(_0x4c00df){while(--_0x4c00df){_0x1634b7['push'](_0x1634b7['shift']());}};_0x28f3c4(++_0xa6002c);}(_0xe4a8,0x186));var _0x8e4a=function(_0x4f8b2b,_0x1dc8dd){_0x4f8b2b=_0x4f8b2b-0x0;var _0x2f230a=_0xe4a8[_0x4f8b2b];return _0x2f230a;};'use strict';var _=require(_0x8e4a('0x0'));var rp=require(_0x8e4a('0x1'));var util=require(_0x8e4a('0x2'));var intUtil=require(_0x8e4a('0x3'));var md5=require('md5');var Redis=require(_0x8e4a('0x4'));var logger=require(_0x8e4a('0x5'))(_0x8e4a('0x6'));var config=require(_0x8e4a('0x7'));config[_0x8e4a('0x8')]=_[_0x8e4a('0x9')](config[_0x8e4a('0x8')],{'host':_0x8e4a('0xa'),'port':0x18eb});var io=require(_0x8e4a('0xb'))(new Redis(config[_0x8e4a('0x8')]));function getAuthToken(_0x3682e5,_0x3762c5,_0x4465bb){if(_0x3682e5[_0x8e4a('0xc')]){_0x3682e5[_0x8e4a('0xd')]=_0x3682e5['CloudProvider'][_0x8e4a('0xe')];_0x3682e5[_0x8e4a('0xf')]=_0x3682e5['CloudProvider'][_0x8e4a('0x10')];return Promise['resolve'](_0x3682e5[_0x8e4a('0x11')][_0x8e4a('0x12')]);}var _0x2ee4df={'method':_0x8e4a('0x13'),'uri':_0x3762c5,'form':{'client_id':_0x3682e5['clientId'],'resource':_0x3682e5[_0x8e4a('0xd')],'username':_0x3682e5['username'],'password':_0x3682e5[_0x8e4a('0x14')],'grant_type':'password','client_secret':_0x3682e5['clientSecret']},'json':!![]};return rp(_0x2ee4df)[_0x8e4a('0x15')](function(_0x21ea10){return _0x21ea10['access_token'];})['catch'](function(_0x57d825){logger[_0x8e4a('0x16')]('['+[_0x4465bb['toUpperCase']()]+_0x8e4a('0x17'));return _0x57d825[_0x8e4a('0x18')];});}function getUser(_0x4d3681,_0xfa2d71,_0x1fdcf4,_0x2bc62d,_0x3615ca,_0x17d7d7){return new Promise(function(_0x397add,_0x2339df){return getAuthToken(_0xfa2d71,_0x2bc62d,_0x17d7d7)[_0x8e4a('0x15')](function(_0x50145b){var _0x1e0a24={'method':_0x8e4a('0x19'),'uri':_0x3615ca+_0x8e4a('0x1a'),'headers':{'Authorization':_0x8e4a('0x1b')+_0x50145b,'OData-Version':_0x8e4a('0x1c')},'json':!![]};return rp(_0x1e0a24);})[_0x8e4a('0x15')](function(_0x521bfa){var _0x2e57ba=_0x521bfa[_0x8e4a('0x1d')];var _0x27e51c=![];var _0x5ec4ae=null;if(!_[_0x8e4a('0x1e')](_0x1fdcf4)){if(intUtil[_0x8e4a('0x1f')](_0x1fdcf4[_0x8e4a('0x20')])){_0x4d3681['userEmail']=_0x1fdcf4['email'];for(_0x5ec4ae=0x0;_0x5ec4ae<_0x2e57ba[_0x8e4a('0x21')];_0x5ec4ae++){if(_0x2e57ba[_0x5ec4ae][_0x8e4a('0x22')]===_0x1fdcf4[_0x8e4a('0x20')]&&!_0x2e57ba[_0x5ec4ae][_0x8e4a('0x23')]){_0x27e51c=!![];logger[_0x8e4a('0x24')]('['+[_0x17d7d7['toUpperCase']()]+_0x8e4a('0x25')+_0x2e57ba[_0x5ec4ae][_0x8e4a('0x26')]+'!');_0x4d3681['userId']=_0x2e57ba[_0x5ec4ae]['systemuserid'];}}}}if(!_0x27e51c){logger[_0x8e4a('0x24')]('['+[_0x17d7d7['toUpperCase']()]+_0x8e4a('0x27'));_0x4d3681['userEmail']=_0xfa2d71[_0x8e4a('0x28')];for(_0x5ec4ae=0x0;_0x5ec4ae<_0x2e57ba[_0x8e4a('0x21')];_0x5ec4ae++){if(_0x2e57ba[_0x5ec4ae]['internalemailaddress']===_0xfa2d71['username']){_0x4d3681[_0x8e4a('0x29')]=_0x2e57ba[_0x5ec4ae][_0x8e4a('0x26')];}}}_0x397add(_0x4d3681);})['catch'](function(_0x353d7a){_0x2339df(_0x353d7a['message']);});});}function createEndUser(_0x557bd2,_0x200ec1,_0x2c9b8e,_0x205662,_0x49314a,_0x2fcabc,_0x1d9015){return new Promise(function(_0x172efc,_0x2797fa){return getAuthToken(_0x200ec1,_0x2c9b8e,_0x2fcabc)[_0x8e4a('0x15')](function(_0x5a6415){var _0x2d2c39=_0x2fcabc['toLowerCase']()===_0x8e4a('0x2a')?_0x49314a[_0x8e4a('0x2b')]:_0x49314a['calleridnum'];var _0x52388f={'method':'POST','uri':_0x205662+_0x8e4a('0x2c'),'body':{'fullname':_0x2d2c39,'firstname':_0x2d2c39,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8e4a('0x2d')+_0x557bd2[_0x8e4a('0x29')]+')'},'headers':{'Authorization':_0x8e4a('0x1b')+_0x5a6415,'OData-Version':_0x8e4a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x52388f['body'][_0x1d9015]=_0x2d2c39;return rp(_0x52388f);})[_0x8e4a('0x15')](function(_0x1f38ff){var _0x1d45c6=_0x1f38ff[_0x8e4a('0x2e')][_0x8e4a('0x2f')];var _0x5759f5=_0x1d45c6['substring'](_0x1d45c6[_0x8e4a('0x30')]('(')+0x1,_0x1d45c6[_0x8e4a('0x30')](')'));_0x557bd2[_0x8e4a('0x31')]=_0x5759f5;_0x172efc(_0x557bd2);})[_0x8e4a('0x32')](function(_0x4f2580){_0x2797fa(_0x4f2580[_0x8e4a('0x18')]);});});}function getEndUser(_0x8100d4,_0x161c30,_0x387d3d,_0x28d344,_0x34e8e3,_0x2eaa42,_0x5e94fb,_0x186322){var _0x1c6a69=_0x2eaa42[_0x8e4a('0x33')]()==='outbound'?_0x34e8e3[_0x8e4a('0x2b')]:_0x34e8e3['calleridnum'];return getAuthToken(_0x161c30,_0x387d3d,_0x2eaa42)[_0x8e4a('0x15')](function(_0x2117dd){_0x186322=_0x186322?_0x186322:_0x8e4a('0x34');var _0x1e0199={'method':'GET','uri':_0x28d344+_0x8e4a('0x35')+_0x186322+_0x8e4a('0x36')+_0x186322+_0x8e4a('0x37')+_0x1c6a69[_0x8e4a('0x38')]('+',_0x8e4a('0x39'))+'\x27','headers':{'Authorization':_0x8e4a('0x1b')+_0x2117dd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e0199);})[_0x8e4a('0x15')](function(_0xeb953a){var _0x2d0139=![];if(!_0xeb953a)return _0x2d0139;var _0x2b9520=_0xeb953a[_0x8e4a('0x1d')];for(var _0x581115=0x0;_0x581115<_0x2b9520[_0x8e4a('0x21')];_0x581115++){if(_0x2b9520[_0x581115][_0x186322]===_0x1c6a69){_0x2d0139=!![];_0x8100d4['enduserId']=_0x2b9520[_0x581115][_0x8e4a('0x3a')];}}return _0x2d0139;})[_0x8e4a('0x15')](function(_0x198f24){if(_0x198f24)return _0x8100d4;if(_0x5e94fb===_0x8e4a('0x3b')){logger[_0x8e4a('0x24')]('['+[_0x2eaa42[_0x8e4a('0x3c')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x8100d4;}return createEndUser(_0x8100d4,_0x161c30,_0x387d3d,_0x28d344,_0x34e8e3,_0x2eaa42,_0x186322)[_0x8e4a('0x15')](function(_0x400df4){logger[_0x8e4a('0x24')]('['+[_0x2eaa42['toUpperCase']()]+_0x8e4a('0x3d'),_0x400df4['enduserId']);return _0x400df4;});});}function getCustomFields(_0x3677e0,_0x3c0460,_0xea8c85){var _0x77487e={};if(_0x3677e0['length']>0x0){_[_0x8e4a('0x3e')](_0x3677e0,function(_0x1cffd4){if(_[_0x8e4a('0x3f')]([_0x8e4a('0x40'),_0x8e4a('0x41')],_0x1cffd4[_0x8e4a('0x42')])&&_0x1cffd4[_0x8e4a('0x43')]&&!_0x1cffd4[_0x8e4a('0x44')]){var _0xd0ed4f=_0x1cffd4[_0x8e4a('0x45')][_0x8e4a('0x33')]();var _0x14c902=_0xd0ed4f[_0x8e4a('0x46')](0x0,_0xd0ed4f[_0x8e4a('0x47')]('_'));var _0x21fc6=_0xd0ed4f[_0x8e4a('0x46')](_0xd0ed4f[_0x8e4a('0x47')]('_')+0x1);if(_0x14c902===_0xea8c85){_0x77487e[_0x21fc6]=_0x1cffd4['content'];}}});}return _0x77487e;}function getTicket(_0x221fd8,_0x5b44ed,_0x5f520d,_0x54cd78,_0x448981,_0x339536,_0x4c89d9){return new Promise(function(_0x49a2e6,_0x12984d){var _0x1f8098;return getAuthToken(_0x5b44ed,_0x5f520d,_0x4c89d9)[_0x8e4a('0x15')](function(_0x4d21b4){if(_0x339536['ticketType']===_0x8e4a('0x48')){_0x1f8098={'method':_0x8e4a('0x13'),'uri':_0x54cd78+'incidents','body':Object[_0x8e4a('0x49')]({},{'title':intUtil[_0x8e4a('0x4a')](_0x339536['Subjects'],_0x448981,'\x20'),'description':intUtil[_0x8e4a('0x4a')](_0x339536[_0x8e4a('0x4b')],_0x448981,'\x0a'),'customerid_contact@odata.bind':_0x221fd8['enduserId']?'/contacts('+_0x221fd8['enduserId']+')':undefined,'ownerid@odata.bind':_0x8e4a('0x2d')+_0x221fd8[_0x8e4a('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x339536[_0x8e4a('0x4c')],_0x448981,_0x339536['ticketType'])),'headers':{'Authorization':_0x8e4a('0x1b')+_0x4d21b4,'OData-Version':_0x8e4a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x339536[_0x8e4a('0x4d')]===_0x8e4a('0x4e')){var _0x2190fb=_0x221fd8[_0x8e4a('0x31')]?[{'partyid_systemuser@odata.bind':_0x8e4a('0x2d')+_0x221fd8[_0x8e4a('0x29')]+')','participationtypemask':_0x221fd8[_0x8e4a('0x4f')]===_0x8e4a('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x8e4a('0x51')+_0x221fd8[_0x8e4a('0x31')]+')','participationtypemask':_0x221fd8[_0x8e4a('0x4f')]===_0x8e4a('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8e4a('0x2d')+_0x221fd8[_0x8e4a('0x29')]+')','participationtypemask':_0x221fd8[_0x8e4a('0x4f')]===_0x8e4a('0x50')?0x2:0x1}];_0x1f8098={'method':_0x8e4a('0x13'),'uri':_0x54cd78+_0x8e4a('0x52'),'body':Object[_0x8e4a('0x49')]({},{'subject':intUtil[_0x8e4a('0x4a')](_0x339536[_0x8e4a('0x53')],_0x448981,'\x20'),'phonenumber':String(_0x448981[_0x8e4a('0x54')]),'description':intUtil[_0x8e4a('0x4a')](_0x339536[_0x8e4a('0x4b')],_0x448981,'\x0a'),'regardingobjectid_contact@odata.bind':_0x221fd8['enduserId']?_0x8e4a('0x51')+_0x221fd8['enduserId']+')':undefined,'ownerid@odata.bind':_0x8e4a('0x2d')+_0x221fd8['userId']+')','directioncode':_0x221fd8['callDirection']===_0x8e4a('0x50')?![]:!![],'phonecall_activity_parties':_0x2190fb},getCustomFields(_0x339536['Fields'],_0x448981,_0x339536[_0x8e4a('0x4d')])),'headers':{'Authorization':_0x8e4a('0x1b')+_0x4d21b4,'OData-Version':_0x8e4a('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1f8098);})['then'](function(_0x36e994){var _0x2d544d=_0x36e994[_0x8e4a('0x2e')][_0x8e4a('0x2f')];var _0xd6213a=_0x2d544d[_0x8e4a('0x46')](_0x2d544d[_0x8e4a('0x30')]('(')+0x1,_0x2d544d[_0x8e4a('0x30')](')'));_0x221fd8[_0x8e4a('0x55')]=_0xd6213a;_0x49a2e6(_0x221fd8);})[_0x8e4a('0x32')](function(_0x3e87da){_0x12984d(_0x3e87da[_0x8e4a('0x18')]);});});}function emit(_0x5a25f7,_0x12bc29,_0x336f65,_0x453a89){var _0x2fdfaa={'uri':util[_0x8e4a('0x56')](_0x8e4a('0x57'),_0x5a25f7,_0x336f65,_0x453a89)};io['to'](util['format'](_0x8e4a('0x58'),_0x12bc29))['emit'](_0x8e4a('0x59'),_0x2fdfaa);}exports['cs']=function(_0x15581c,_0x1df5b8,_0x887c73,_0x44613f,_0xf904a9,_0x180454,_0x582b08,_0x2364d9){var _0x43bd90={};_0x180454[_0x8e4a('0xd')]=_0x180454[_0x8e4a('0xc')]?intUtil[_0x8e4a('0x5a')](_0x180454[_0x8e4a('0x11')][_0x8e4a('0xe')]):intUtil[_0x8e4a('0x5a')](_0x180454[_0x8e4a('0xd')]);_0x180454['serverUrl']=intUtil[_0x8e4a('0x5a')](_0x180454['serverUrl']);_0x43bd90[_0x8e4a('0x4f')]=_0x2364d9===_0x8e4a('0x50')||_0x2364d9==='unmanaged'?_0x8e4a('0x50'):'outbound';var _0x23608b=_0x180454[_0x8e4a('0xc')]?util[_0x8e4a('0x56')](_0x8e4a('0x5b'),_0x180454[_0x8e4a('0x11')][_0x8e4a('0xe')]):util[_0x8e4a('0x56')](_0x8e4a('0x5b'),_0x180454[_0x8e4a('0xd')]);var _0x2a51dc=util[_0x8e4a('0x56')](_0x8e4a('0x5c'),_0x180454['tenantId']);var _0x2bae16=util[_0x8e4a('0x56')](_0x8e4a('0x5d'),_0x180454[_0x8e4a('0x5e')],_0x1df5b8[_0x8e4a('0x5f')],md5(_0x1df5b8[_0x8e4a('0x5f')]));if(_0xf904a9&&_0xf904a9[_0x8e4a('0x60')]){logger[_0x8e4a('0x24')](_0x8e4a('0x61'),_0x8e4a('0x62'));_0x1df5b8[_0x8e4a('0x63')]=_0x2bae16;}else if(_0x582b08&&_0x582b08[_0x8e4a('0x64')]&&_0x582b08[_0x8e4a('0x64')]!==_0x8e4a('0x65')){logger['info'](_0x8e4a('0x66'),'Recording\x20is\x20enabled!');_0x1df5b8[_0x8e4a('0x63')]=_0x2bae16;}else{_0x1df5b8[_0x8e4a('0x63')]='';}return getUser(_0x43bd90,_0x180454,_0x44613f,_0x2a51dc,_0x23608b,_0x2364d9)['then'](function(_0x44b705){logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x67'),_0x44b705['userId']);logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x68'),_0x44b705[_0x8e4a('0x69')]);return getEndUser(_0x44b705,_0x180454,_0x2a51dc,_0x23608b,_0x1df5b8,_0x2364d9,_0x887c73[_0x8e4a('0x6a')],_0x887c73[_0x8e4a('0x6b')]);})[_0x8e4a('0x15')](function(_0x58ace4){logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x6c'),_0x58ace4[_0x8e4a('0x31')]);logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1df5b8['calleridnum']);return getTicket(_0x58ace4,_0x180454,_0x2a51dc,_0x23608b,_0x1df5b8,_0x887c73,_0x2364d9);})[_0x8e4a('0x15')](function(_0x1fefc1){logger['info'](util[_0x8e4a('0x56')]('['+_0x2364d9[_0x8e4a('0x3c')]()+_0x8e4a('0x6d'),_0x887c73[_0x8e4a('0x4d')],_0x1fefc1[_0x8e4a('0x55')]));logger[_0x8e4a('0x24')](util[_0x8e4a('0x56')]('['+_0x2364d9['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x2364d9));if(_0x2364d9!=='unmanaged'&&_0x887c73[_0x8e4a('0x6e')]){logger[_0x8e4a('0x24')]('['+_0x2364d9[_0x8e4a('0x3c')]()+']',_0x8e4a('0x6f'));emit(_0x180454[_0x8e4a('0xd')],_0x44613f[_0x8e4a('0x70')],_0x887c73[_0x8e4a('0x4d')],_0x1fefc1[_0x8e4a('0x55')]);}})[_0x8e4a('0x32')](function(_0x238db4){logger[_0x8e4a('0x16')]('['+_0x2364d9[_0x8e4a('0x3c')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x238db4[_0x8e4a('0x18')]);console[_0x8e4a('0x16')](_0x8e4a('0x71'),_0x238db4);});}; \ 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 7bcdfac..22ca5d8 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 _0x4276=['remoteUri','POST','validateEmail','then','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','defaults','forEach','includes','string','picklist','type','nameField','toLowerCase','content','variableName','idField','customField','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','error','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','getString','Subjects','Tags','name','custom_fields','keyBy','%s/api/v2/tickets'];(function(_0x19787d,_0x365c7b){var _0xd6f47f=function(_0x16f907){while(--_0x16f907){_0x19787d['push'](_0x19787d['shift']());}};_0xd6f47f(++_0x365c7b);}(_0x4276,0x1a6));var _0x6427=function(_0x303ea7,_0x1fd43d){_0x303ea7=_0x303ea7-0x0;var _0x165caa=_0x4276[_0x303ea7];return _0x165caa;};'use strict';var _=require(_0x6427('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x6427('0x1'));var Redis=require(_0x6427('0x2'));var intUtil=require(_0x6427('0x3'));var config=require(_0x6427('0x4'));var logger=require(_0x6427('0x5'))(_0x6427('0x6'));config['redis']=_['defaults'](config[_0x6427('0x7')],{'host':_0x6427('0x8'),'port':0x18eb});var io=require(_0x6427('0x9'))(new Redis(config[_0x6427('0x7')]));var headers={'Content-Type':_0x6427('0xa'),'Accept':_0x6427('0xa')};function emit(_0x4abd2c,_0x4dd67e,_0x10f3b1){io['to'](_0x4abd2c)[_0x6427('0xb')](_0x4dd67e,_0x10f3b1);}function getTicket(_0x3ddd19,_0x147038,_0x2099ac,_0xd325c,_0x4f4e51){logger[_0x6427('0xc')]('Creating\x20new\x20ticket...');var _0x18fc5e=_[_0x6427('0xd')]({'responder_id':_0x147038['id'],'requester_id':_0x2099ac['id'],'name':util[_0x6427('0xe')](_0x6427('0xf'),_0x4f4e51['calleridname']),'phone':_0x4f4e51['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6427('0x10')](_0xd325c[_0x6427('0x11')],_0x4f4e51,'\x20'),'description':intUtil['getString'](_0xd325c['Descriptions'],_0x4f4e51,'
'),'tags':getTags(_0xd325c[_0x6427('0x12')],_0x6427('0x13'))},getCustomFields(_0xd325c['Fields'],_0x4f4e51));_0x18fc5e[_0x6427('0x14')]=_['mapValues'](_[_0x6427('0x15')](_0x18fc5e[_0x6427('0x14')],'id'),'value');return request({'uri':util[_0x6427('0xe')](_0x6427('0x16'),_0x3ddd19[_0x6427('0x17')]),'method':_0x6427('0x18'),'body':_0x18fc5e})['then'](function(_0x1c6bd0){logger[_0x6427('0xc')]('Ticket\x20created!');return _0x1c6bd0;});}function getUser(_0x19ff0a,_0x4d2f4c){if(intUtil[_0x6427('0x19')](_0x4d2f4c)){return request({'uri':util[_0x6427('0xe')]('%s/api/v2/agents',_0x19ff0a[_0x6427('0x17')]),'qs':{'email':_0x4d2f4c}})[_0x6427('0x1a')](function(_0x448909){if(_0x448909[_0x6427('0x1b')]){logger[_0x6427('0xc')]('Agent\x20found!');return _[_0x6427('0x1c')](_0x448909,function(_0x33409b){return _0x33409b[_0x6427('0x1d')]['email']===_0x4d2f4c;});}else{logger[_0x6427('0xc')](_0x6427('0x1e'));return request({'uri':util[_0x6427('0xe')]('%s/api/v2/agents/me',_0x19ff0a[_0x6427('0x17')])})[_0x6427('0x1a')](function(_0x5be912){logger[_0x6427('0xc')](_0x6427('0x1f'));return _0x5be912;});}});}else{logger['info'](_0x6427('0x20'));return request({'uri':util[_0x6427('0xe')]('%s/api/v2/agents/me',_0x19ff0a[_0x6427('0x17')])})[_0x6427('0x1a')](function(_0x2ab8e7){logger[_0x6427('0xc')](_0x6427('0x1f'));return _0x2ab8e7;});}}function getEndUser(_0x7e336c,_0x397313,_0x417b34){logger[_0x6427('0xc')](_0x6427('0x21'),_0x417b34);return request({'uri':util['format'](_0x6427('0x22'),_0x7e336c['remoteUri']),'qs':{'phone':_0x417b34}})[_0x6427('0x1a')](function(_0x34e23a){if(_0x34e23a[_0x6427('0x1b')]){logger[_0x6427('0xc')](_0x6427('0x23'));return _[_0x6427('0x1c')](_0x34e23a,{'phone':_0x417b34});}else{logger['info'](_0x6427('0x24'));return request({'uri':util[_0x6427('0xe')]('%s/api/v2/contacts',_0x7e336c[_0x6427('0x17')]),'method':_0x6427('0x18'),'body':{'name':_0x397313,'phone':_0x417b34}})[_0x6427('0x1a')](function(_0x16b2ec){logger[_0x6427('0xc')](_0x6427('0x25'));return _0x16b2ec;});}});}function getAuth(_0x191b0f){return util[_0x6427('0xe')](_0x6427('0x26'),new Buffer(_0x191b0f[_0x6427('0x27')]+':X')[_0x6427('0x28')]('base64'));}function request(_0xc15764){logger[_0x6427('0x29')](_0x6427('0x2a'),JSON[_0x6427('0x2b')](_0xc15764));return rp(_[_0x6427('0x2c')](_0xc15764,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x6d659b,_0x39137b){var _0x2bba12=[];if(_0x6d659b&&_0x6d659b[_0x6427('0x1b')]>0x0){_0x2bba12=_['map'](_0x6d659b,_0x39137b);}return _0x2bba12;}function getCustomFields(_0x157d06,_0x5e31fc){var _0xcbee8c=[];var _0xd2b14d={'custom_fields':[]};if(_0x157d06[_0x6427('0x1b')]>0x0){_[_0x6427('0x2d')](_0x157d06,function(_0x166c41){if(_[_0x6427('0x2e')]([_0x6427('0x2f'),_0x6427('0x30')],_0x166c41[_0x6427('0x31')])&&_0x166c41[_0x6427('0x32')]&&!_0x166c41['customField']){_0xd2b14d[_0x166c41['nameField'][_0x6427('0x33')]()]=_0x166c41[_0x6427('0x34')][_0x6427('0x28')]();}else if(_[_0x6427('0x2e')]([_0x6427('0x2f'),_0x6427('0x30')],_0x166c41['type'])&&_0x166c41['idField']&&_0x166c41['customField']){_0xd2b14d[_0x6427('0x14')]['push']({'id':_0x166c41['idField'],'value':_0x166c41[_0x6427('0x34')][_0x6427('0x28')]()});}else if(_0x166c41[_0x6427('0x31')]==='variable'&&_0x166c41[_0x6427('0x35')]&&_0x166c41[_0x6427('0x36')]&&_0x166c41[_0x6427('0x37')]){_0x5e31fc[_0x166c41[_0x6427('0x35')]]&&_0xd2b14d['custom_fields'][_0x6427('0x38')]({'id':_0x166c41[_0x6427('0x36')],'value':_0x5e31fc[_0x166c41[_0x6427('0x35')]][_0x6427('0x28')]()});}else if(_0x166c41[_0x6427('0x31')]===_0x6427('0x39')&&_0x166c41[_0x6427('0x3a')]&&_0x166c41[_0x6427('0x3a')][_0x6427('0x13')]&&_0x166c41[_0x6427('0x36')]&&_0x166c41['customField']){_0x5e31fc[_0x166c41[_0x6427('0x3a')][_0x6427('0x13')][_0x6427('0x33')]()]&&_0xd2b14d[_0x6427('0x14')][_0x6427('0x38')]({'id':_0x166c41[_0x6427('0x36')],'value':_0x5e31fc[_0x166c41[_0x6427('0x3a')][_0x6427('0x13')]['toLowerCase']()][_0x6427('0x28')]()});}});}return _0xd2b14d;}exports[_0x6427('0x3b')]=function(_0x2fb4cf,_0x5b2be4,_0x3a3f5c,_0x5b4af9,_0x32b709,_0x21e366){var _0x477308,_0x1872e6;_0x21e366[_0x6427('0x17')]=intUtil[_0x6427('0x3c')](_0x21e366['remoteUri']);_0x21e366[_0x6427('0x3d')]=intUtil[_0x6427('0x3c')](_0x21e366[_0x6427('0x3d')]);if(_0x32b709&&_0x32b709[_0x6427('0x3e')]){logger[_0x6427('0xc')]('[QUEUE]',_0x6427('0x3f'));_0x5b2be4['recordingURL']=util[_0x6427('0xe')](_0x6427('0x40'),_0x21e366[_0x6427('0x3d')],_0x5b2be4[_0x6427('0x41')],md5(_0x5b2be4[_0x6427('0x41')]));}else{_0x5b2be4[_0x6427('0x42')]='';}headers[_0x6427('0x43')]=getAuth(_0x21e366);return getUser(_0x21e366,_0x5b4af9['email'])[_0x6427('0x1a')](function(_0x40e9bc){_0x477308=_0x40e9bc;logger[_0x6427('0xc')](_0x6427('0x44'),_0x477308['id']);return getEndUser(_0x21e366,_0x5b2be4[_0x6427('0x45')],_0x5b2be4[_0x6427('0x46')]);})[_0x6427('0x1a')](function(_0x52c6ab){_0x1872e6=_0x52c6ab;logger['info'](_0x6427('0x47'),_0x1872e6['id']);return getTicket(_0x21e366,_0x477308,_0x1872e6,_0x3a3f5c,_0x5b2be4);})['then'](function(_0x3c2d5e){if(_0x3c2d5e&&_0x3c2d5e['id']){logger[_0x6427('0xc')](_0x6427('0x48'));logger[_0x6427('0xc')](_0x6427('0x49'),_0x3c2d5e['id']);logger[_0x6427('0xc')](_0x6427('0x4a'),_0x6427('0x4b'));emit(util[_0x6427('0xe')](_0x6427('0x4c'),_0x5b4af9[_0x6427('0x13')]),_0x6427('0x4d'),{'uri':util[_0x6427('0xe')]('%s/helpdesk/tickets/%d',_0x21e366[_0x6427('0x17')],_0x3c2d5e['id'])});}})[_0x6427('0x4e')](function(_0x3cdaf8){logger['error'](_0x6427('0x4a'),JSON['stringify'](_0x3cdaf8));});};exports[_0x6427('0x4f')]=function(_0x3d46d8,_0x1882b9,_0x2d9ede,_0x2ff667,_0x4984b1,_0x18cafb,_0x3af068){var _0x53e25e,_0x979e3d;_0x18cafb[_0x6427('0x17')]=intUtil[_0x6427('0x3c')](_0x18cafb[_0x6427('0x17')]);_0x18cafb[_0x6427('0x3d')]=intUtil[_0x6427('0x3c')](_0x18cafb[_0x6427('0x3d')]);if(_0x3af068&&_0x3af068[_0x6427('0x50')]&&_0x3af068['recordingFormat']!==_0x6427('0x51')){logger[_0x6427('0xc')](_0x6427('0x52'),_0x6427('0x3f'));_0x1882b9[_0x6427('0x42')]=util[_0x6427('0xe')](_0x6427('0x40'),_0x18cafb[_0x6427('0x3d')],_0x1882b9[_0x6427('0x41')],md5(_0x1882b9[_0x6427('0x41')]));}headers[_0x6427('0x43')]=getAuth(_0x18cafb);return getUser(_0x18cafb,_0x2ff667['email'])['then'](function(_0x5d1092){_0x53e25e=_0x5d1092;logger[_0x6427('0xc')](_0x6427('0x44'),_0x53e25e['id']);return getEndUser(_0x18cafb,_0x1882b9[_0x6427('0x53')],_0x1882b9[_0x6427('0x54')]);})['then'](function(_0x5d0efc){_0x979e3d=_0x5d0efc;logger[_0x6427('0xc')](_0x6427('0x47'),_0x979e3d['id']);return getTicket(_0x18cafb,_0x53e25e,_0x979e3d,_0x2d9ede,_0x1882b9);})[_0x6427('0x1a')](function(_0xff2fbf){if(_0xff2fbf&&_0xff2fbf['id']){logger[_0x6427('0xc')](_0x6427('0x48'));logger['info']('The\x20Ticket\x20ID\x20is:',_0xff2fbf['id']);logger[_0x6427('0xc')](_0x6427('0x52'),_0x6427('0x4b'));emit(util[_0x6427('0xe')](_0x6427('0x4c'),_0x2ff667[_0x6427('0x13')]),_0x6427('0x4d'),{'uri':util[_0x6427('0xe')]('%s/helpdesk/tickets/%d',_0x18cafb['remoteUri'],_0xff2fbf['id'])});}})['catch'](function(_0x54d18e){logger[_0x6427('0x55')](_0x6427('0x52'),JSON[_0x6427('0x2b')](_0x54d18e));});};exports[_0x6427('0x56')]=function(_0x245c36,_0x500d6e,_0x83f93a,_0x3713b8,_0x127e4e,_0x97ab74){var _0x713005,_0x18936c;_0x97ab74[_0x6427('0x17')]=intUtil[_0x6427('0x3c')](_0x97ab74[_0x6427('0x17')]);_0x97ab74['serverUrl']=intUtil[_0x6427('0x3c')](_0x97ab74[_0x6427('0x3d')]);if(_0x127e4e&&_0x127e4e[_0x6427('0x3e')]){logger[_0x6427('0xc')]('['+_0x500d6e[_0x6427('0x57')][_0x6427('0x58')]()+']',_0x6427('0x3f'));_0x500d6e[_0x6427('0x42')]=util[_0x6427('0xe')](_0x6427('0x40'),_0x97ab74[_0x6427('0x3d')],_0x500d6e[_0x6427('0x41')],md5(_0x500d6e[_0x6427('0x41')]));}else{_0x500d6e[_0x6427('0x42')]='';}headers[_0x6427('0x43')]=getAuth(_0x97ab74);return getUser(_0x97ab74,'')[_0x6427('0x1a')](function(_0xe34fa8){_0x713005=_0xe34fa8;logger[_0x6427('0xc')](_0x6427('0x44'),_0x713005['id']);return getEndUser(_0x97ab74,_0x500d6e[_0x6427('0x45')],_0x500d6e[_0x6427('0x46')]);})[_0x6427('0x1a')](function(_0x1121a4){_0x18936c=_0x1121a4;logger[_0x6427('0xc')](_0x6427('0x47'),_0x18936c['id']);return getTicket(_0x97ab74,_0x713005,_0x18936c,_0x83f93a,_0x500d6e);})[_0x6427('0x1a')](function(_0x1830f3){if(_0x1830f3){logger['info'](_0x6427('0x48'));logger[_0x6427('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1830f3['id']);}})[_0x6427('0x4e')](function(_0x3c405f){logger[_0x6427('0x55')]('['+_0x500d6e[_0x6427('0x57')][_0x6427('0x58')]()+']',JSON['stringify'](_0x3c405f));});}; \ No newline at end of file +var _0xb393=['Authorization','calleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','stringify','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','
','name','Fields','custom_fields','keyBy','remoteUri','POST','then','Ticket\x20created!','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','string','idField','content','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x4adb7f,_0x3634fa){var _0x238df9=function(_0x14f6a8){while(--_0x14f6a8){_0x4adb7f['push'](_0x4adb7f['shift']());}};_0x238df9(++_0x3634fa);}(_0xb393,0xcc));var _0x3b39=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb393[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b39('0x0'));var rp=require(_0x3b39('0x1'));var md5=require(_0x3b39('0x2'));var util=require(_0x3b39('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3b39('0x4'));var config=require(_0x3b39('0x5'));var logger=require(_0x3b39('0x6'))(_0x3b39('0x7'));config[_0x3b39('0x8')]=_['defaults'](config[_0x3b39('0x8')],{'host':_0x3b39('0x9'),'port':0x18eb});var io=require(_0x3b39('0xa'))(new Redis(config[_0x3b39('0x8')]));var headers={'Content-Type':_0x3b39('0xb'),'Accept':_0x3b39('0xb')};function emit(_0xd05dc5,_0x57e3ba,_0xa197c1){io['to'](_0xd05dc5)[_0x3b39('0xc')](_0x57e3ba,_0xa197c1);}function getTicket(_0x4c3340,_0x113cd2,_0x4054c7,_0x4305b2,_0x1ba5e1){logger[_0x3b39('0xd')](_0x3b39('0xe'));var _0x1e8b21=_[_0x3b39('0xf')]({'responder_id':_0x113cd2['id'],'requester_id':_0x4054c7['id'],'name':util[_0x3b39('0x10')](_0x3b39('0x11'),_0x1ba5e1['calleridname']),'phone':_0x1ba5e1['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3b39('0x12')](_0x4305b2[_0x3b39('0x13')],_0x1ba5e1,'\x20'),'description':intUtil[_0x3b39('0x12')](_0x4305b2['Descriptions'],_0x1ba5e1,_0x3b39('0x14')),'tags':getTags(_0x4305b2['Tags'],_0x3b39('0x15'))},getCustomFields(_0x4305b2[_0x3b39('0x16')],_0x1ba5e1));_0x1e8b21[_0x3b39('0x17')]=_['mapValues'](_[_0x3b39('0x18')](_0x1e8b21[_0x3b39('0x17')],'id'),'value');return request({'uri':util[_0x3b39('0x10')]('%s/api/v2/tickets',_0x4c3340[_0x3b39('0x19')]),'method':_0x3b39('0x1a'),'body':_0x1e8b21})[_0x3b39('0x1b')](function(_0x359dbb){logger[_0x3b39('0xd')](_0x3b39('0x1c'));return _0x359dbb;});}function getUser(_0x248ea5,_0x5c0de7){if(intUtil['validateEmail'](_0x5c0de7)){return request({'uri':util['format']('%s/api/v2/agents',_0x248ea5[_0x3b39('0x19')]),'qs':{'email':_0x5c0de7}})[_0x3b39('0x1b')](function(_0x3dc5bd){if(_0x3dc5bd[_0x3b39('0x1d')]){logger[_0x3b39('0xd')](_0x3b39('0x1e'));return _[_0x3b39('0x1f')](_0x3dc5bd,function(_0x15afa1){return _0x15afa1['contact'][_0x3b39('0x20')]===_0x5c0de7;});}else{logger[_0x3b39('0xd')](_0x3b39('0x21'));return request({'uri':util[_0x3b39('0x10')](_0x3b39('0x22'),_0x248ea5[_0x3b39('0x19')])})[_0x3b39('0x1b')](function(_0x49d756){logger[_0x3b39('0xd')](_0x3b39('0x23'));return _0x49d756;});}});}else{logger['info'](_0x3b39('0x24'));return request({'uri':util['format'](_0x3b39('0x22'),_0x248ea5['remoteUri'])})[_0x3b39('0x1b')](function(_0x9d274a){logger['info'](_0x3b39('0x23'));return _0x9d274a;});}}function getEndUser(_0x3b6089,_0x539e0c,_0x1ed6a6){logger[_0x3b39('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1ed6a6);return request({'uri':util[_0x3b39('0x10')](_0x3b39('0x25'),_0x3b6089['remoteUri']),'qs':{'phone':_0x1ed6a6}})['then'](function(_0x403e80){if(_0x403e80[_0x3b39('0x1d')]){logger[_0x3b39('0xd')]('Enduser\x20found!');return _[_0x3b39('0x1f')](_0x403e80,{'phone':_0x1ed6a6});}else{logger['info'](_0x3b39('0x26'));return request({'uri':util[_0x3b39('0x10')](_0x3b39('0x25'),_0x3b6089['remoteUri']),'method':'POST','body':{'name':_0x539e0c,'phone':_0x1ed6a6}})[_0x3b39('0x1b')](function(_0x1da36e){logger['info'](_0x3b39('0x27'));return _0x1da36e;});}});}function getAuth(_0x5a9019){return util[_0x3b39('0x10')]('Basic\x20%s',new Buffer(_0x5a9019[_0x3b39('0x28')]+':X')[_0x3b39('0x29')](_0x3b39('0x2a')));}function request(_0x3768e2){logger[_0x3b39('0x2b')]('[HTTP]',JSON['stringify'](_0x3768e2));return rp(_['defaults'](_0x3768e2,{'method':_0x3b39('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x4b52a7,_0x1b090f){var _0x59022d=[];if(_0x4b52a7&&_0x4b52a7['length']>0x0){_0x59022d=_[_0x3b39('0x2d')](_0x4b52a7,_0x1b090f);}return _0x59022d;}function getCustomFields(_0x5bb3f0,_0x1f8ed6){var _0x2cbbb2=[];var _0x435124={'custom_fields':[]};if(_0x5bb3f0['length']>0x0){_[_0x3b39('0x2e')](_0x5bb3f0,function(_0x44298c){if(_[_0x3b39('0x2f')](['string',_0x3b39('0x30')],_0x44298c[_0x3b39('0x31')])&&_0x44298c[_0x3b39('0x32')]&&!_0x44298c[_0x3b39('0x33')]){_0x435124[_0x44298c[_0x3b39('0x32')][_0x3b39('0x34')]()]=_0x44298c['content'][_0x3b39('0x29')]();}else if(_[_0x3b39('0x2f')]([_0x3b39('0x35'),_0x3b39('0x30')],_0x44298c[_0x3b39('0x31')])&&_0x44298c[_0x3b39('0x36')]&&_0x44298c[_0x3b39('0x33')]){_0x435124[_0x3b39('0x17')]['push']({'id':_0x44298c['idField'],'value':_0x44298c[_0x3b39('0x37')]['toString']()});}else if(_0x44298c['type']===_0x3b39('0x38')&&_0x44298c['variableName']&&_0x44298c[_0x3b39('0x36')]&&_0x44298c[_0x3b39('0x33')]){_0x1f8ed6[_0x44298c[_0x3b39('0x39')]]&&_0x435124[_0x3b39('0x17')][_0x3b39('0x3a')]({'id':_0x44298c[_0x3b39('0x36')],'value':_0x1f8ed6[_0x44298c[_0x3b39('0x39')]][_0x3b39('0x29')]()});}else if(_0x44298c[_0x3b39('0x31')]===_0x3b39('0x3b')&&_0x44298c[_0x3b39('0x3c')]&&_0x44298c[_0x3b39('0x3c')][_0x3b39('0x15')]&&_0x44298c['idField']&&_0x44298c[_0x3b39('0x33')]){_0x1f8ed6[_0x44298c['Variable'][_0x3b39('0x15')]['toLowerCase']()]&&_0x435124[_0x3b39('0x17')]['push']({'id':_0x44298c[_0x3b39('0x36')],'value':_0x1f8ed6[_0x44298c[_0x3b39('0x3c')][_0x3b39('0x15')][_0x3b39('0x34')]()][_0x3b39('0x29')]()});}});}return _0x435124;}exports[_0x3b39('0x3d')]=function(_0x47b6e7,_0x4bd81f,_0x5dfe8d,_0x502366,_0x51f4af,_0x504e38){var _0x21ca3f,_0x33c045;_0x504e38[_0x3b39('0x19')]=intUtil[_0x3b39('0x3e')](_0x504e38['remoteUri']);_0x504e38[_0x3b39('0x3f')]=intUtil[_0x3b39('0x3e')](_0x504e38['serverUrl']);if(_0x51f4af&&_0x51f4af[_0x3b39('0x40')]){logger[_0x3b39('0xd')](_0x3b39('0x41'),_0x3b39('0x42'));_0x4bd81f[_0x3b39('0x43')]=util[_0x3b39('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x504e38[_0x3b39('0x3f')],_0x4bd81f[_0x3b39('0x44')],md5(_0x4bd81f[_0x3b39('0x44')]));}else{_0x4bd81f[_0x3b39('0x43')]='';}headers[_0x3b39('0x45')]=getAuth(_0x504e38);return getUser(_0x504e38,_0x502366[_0x3b39('0x20')])[_0x3b39('0x1b')](function(_0x12b0d2){_0x21ca3f=_0x12b0d2;logger[_0x3b39('0xd')]('The\x20User\x20ID\x20is:',_0x21ca3f['id']);return getEndUser(_0x504e38,_0x4bd81f[_0x3b39('0x46')],_0x4bd81f['calleridnum']);})[_0x3b39('0x1b')](function(_0x39bbc3){_0x33c045=_0x39bbc3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x33c045['id']);return getTicket(_0x504e38,_0x21ca3f,_0x33c045,_0x5dfe8d,_0x4bd81f);})['then'](function(_0x4b448f){if(_0x4b448f&&_0x4b448f['id']){logger['info'](_0x3b39('0x1c'));logger[_0x3b39('0xd')](_0x3b39('0x47'),_0x4b448f['id']);logger[_0x3b39('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x502366[_0x3b39('0x15')]),_0x3b39('0x48'),{'uri':util[_0x3b39('0x10')](_0x3b39('0x49'),_0x504e38[_0x3b39('0x19')],_0x4b448f['id'])});}})[_0x3b39('0x4a')](function(_0xfb56e3){logger[_0x3b39('0x4b')](_0x3b39('0x41'),JSON['stringify'](_0xfb56e3));});};exports[_0x3b39('0x4c')]=function(_0x48acbc,_0x2a5a79,_0x2ac215,_0x270ed9,_0x4ba9ba,_0x597418,_0x32f889){var _0x48c5eb,_0x43a6a6;_0x597418['remoteUri']=intUtil[_0x3b39('0x3e')](_0x597418[_0x3b39('0x19')]);_0x597418[_0x3b39('0x3f')]=intUtil[_0x3b39('0x3e')](_0x597418[_0x3b39('0x3f')]);if(_0x32f889&&_0x32f889[_0x3b39('0x4d')]&&_0x32f889[_0x3b39('0x4d')]!==_0x3b39('0x4e')){logger[_0x3b39('0xd')](_0x3b39('0x4f'),_0x3b39('0x42'));_0x2a5a79[_0x3b39('0x43')]=util[_0x3b39('0x10')](_0x3b39('0x50'),_0x597418['serverUrl'],_0x2a5a79[_0x3b39('0x44')],md5(_0x2a5a79['uniqueid']));}headers[_0x3b39('0x45')]=getAuth(_0x597418);return getUser(_0x597418,_0x270ed9[_0x3b39('0x20')])['then'](function(_0x58da3c){_0x48c5eb=_0x58da3c;logger['info'](_0x3b39('0x51'),_0x48c5eb['id']);return getEndUser(_0x597418,_0x2a5a79[_0x3b39('0x52')],_0x2a5a79[_0x3b39('0x53')]);})[_0x3b39('0x1b')](function(_0x5291ff){_0x43a6a6=_0x5291ff;logger[_0x3b39('0xd')](_0x3b39('0x54'),_0x43a6a6['id']);return getTicket(_0x597418,_0x48c5eb,_0x43a6a6,_0x2ac215,_0x2a5a79);})[_0x3b39('0x1b')](function(_0x32464d){if(_0x32464d&&_0x32464d['id']){logger[_0x3b39('0xd')](_0x3b39('0x1c'));logger[_0x3b39('0xd')](_0x3b39('0x47'),_0x32464d['id']);logger[_0x3b39('0xd')]('[OUTBOUND]',_0x3b39('0x55'));emit(util[_0x3b39('0x10')](_0x3b39('0x56'),_0x270ed9['name']),_0x3b39('0x48'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x597418[_0x3b39('0x19')],_0x32464d['id'])});}})['catch'](function(_0x555c43){logger[_0x3b39('0x4b')]('[OUTBOUND]',JSON[_0x3b39('0x57')](_0x555c43));});};exports['unmanaged']=function(_0xca0b54,_0x1391ed,_0x1ee355,_0x5e73a3,_0x5cc839,_0x5b389a){var _0x3eeaed,_0x101993;_0x5b389a['remoteUri']=intUtil[_0x3b39('0x3e')](_0x5b389a['remoteUri']);_0x5b389a[_0x3b39('0x3f')]=intUtil[_0x3b39('0x3e')](_0x5b389a['serverUrl']);if(_0x5cc839&&_0x5cc839[_0x3b39('0x40')]){logger[_0x3b39('0xd')]('['+_0x1391ed[_0x3b39('0x58')][_0x3b39('0x59')]()+']',_0x3b39('0x42'));_0x1391ed[_0x3b39('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b389a[_0x3b39('0x3f')],_0x1391ed[_0x3b39('0x44')],md5(_0x1391ed[_0x3b39('0x44')]));}else{_0x1391ed['recordingURL']='';}headers[_0x3b39('0x45')]=getAuth(_0x5b389a);return getUser(_0x5b389a,'')[_0x3b39('0x1b')](function(_0x250869){_0x3eeaed=_0x250869;logger[_0x3b39('0xd')](_0x3b39('0x51'),_0x3eeaed['id']);return getEndUser(_0x5b389a,_0x1391ed[_0x3b39('0x46')],_0x1391ed[_0x3b39('0x5a')]);})['then'](function(_0x3f5ebc){_0x101993=_0x3f5ebc;logger[_0x3b39('0xd')]('The\x20Enduser\x20ID\x20is:',_0x101993['id']);return getTicket(_0x5b389a,_0x3eeaed,_0x101993,_0x1ee355,_0x1391ed);})[_0x3b39('0x1b')](function(_0x176b80){if(_0x176b80){logger['info'](_0x3b39('0x1c'));logger[_0x3b39('0xd')](_0x3b39('0x47'),_0x176b80['id']);}})['catch'](function(_0x36adcf){logger[_0x3b39('0x4b')]('['+_0x1391ed[_0x3b39('0x58')][_0x3b39('0x59')]()+']',JSON['stringify'](_0x36adcf));});}; \ 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 0707e42..82c6ba4 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 _0xba3c=['POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:'];(function(_0x45f67d,_0x310b80){var _0x516063=function(_0x44f0e0){while(--_0x44f0e0){_0x45f67d['push'](_0x45f67d['shift']());}};_0x516063(++_0x310b80);}(_0xba3c,0x77));var _0xcba3=function(_0x42a3b0,_0x17457b){_0x42a3b0=_0x42a3b0-0x0;var _0xac15f1=_0xba3c[_0x42a3b0];return _0xac15f1;};'use strict';var _=require(_0xcba3('0x0'));var rp=require(_0xcba3('0x1'));var md5=require(_0xcba3('0x2'));var util=require(_0xcba3('0x3'));var moment=require(_0xcba3('0x4'));var Promise=require(_0xcba3('0x5'));var Redis=require(_0xcba3('0x6'));var intUtil=require(_0xcba3('0x7'));var config=require(_0xcba3('0x8'));var logger=require(_0xcba3('0x9'))(_0xcba3('0xa'));config['redis']=_['defaults'](config[_0xcba3('0xb')],{'host':_0xcba3('0xc'),'port':0x18eb});var io=require(_0xcba3('0xd'))(new Redis(config[_0xcba3('0xb')]));function getAdminId(_0x1bc456,_0x39349c,_0x12107f,_0x1a5cc7){return new Promise(function(_0xcb8a57,_0x4c7672){var _0x287dd2=![];var _0x15edfe={'method':_0xcba3('0xe'),'uri':_0x1a5cc7+_0xcba3('0xf'),'json':!![]};_0x15edfe[_0xcba3('0x10')]=_0x12107f;logger[_0xcba3('0x11')](_0xcba3('0x12'));return rp(_0x15edfe)[_0xcba3('0x13')](function(_0x41af93){if(_0x41af93){var _0x3e8e49=_0x41af93[_0xcba3('0x14')];var _0x51f690=null;for(_0x51f690=0x0;_0x51f690<_0x3e8e49[_0xcba3('0x15')];_0x51f690++){if(_0x3e8e49[_0x51f690][_0xcba3('0x16')]===_0x1bc456['adminEmail']){_0x1bc456[_0xcba3('0x17')]=_0x3e8e49[_0x51f690]['id'];_0x287dd2=!![];}}if(_0x287dd2){logger['info'](_0xcba3('0x18'),_0x1bc456[_0xcba3('0x17')]);_0xcb8a57(_0x1bc456);}else{_0x4c7672({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4c7672({'statusCode':0x194,'message':_0xcba3('0x19')});}})[_0xcba3('0x1a')](function(_0x1abdf0){logger[_0xcba3('0x1b')]('['+[_0x39349c[_0xcba3('0x1c')]()]+']',_0x1abdf0[_0xcba3('0x1d')]);_0x4c7672(_0x1abdf0);});});}function getUser(_0x5730d2,_0x5a50fb,_0x118675){return function(_0x5aea0a){return new Promise(function(_0x2e0b54,_0x13ad33){var _0x5f238e={'method':_0xcba3('0xe'),'uri':_0x118675+'/api/selector/owners','json':!![]};_0x5f238e[_0xcba3('0x10')]=_0x5a50fb;logger[_0xcba3('0x11')](_0xcba3('0x1e'));return rp(_0x5f238e)[_0xcba3('0x13')](function(_0x254787){if(_0x254787){var _0x1dc79b=_0x254787['users'];var _0x46a9b9=![];var _0x364f91=null;if(_0x5aea0a[_0xcba3('0x1f')]!==null){logger[_0xcba3('0x11')]('Getting\x20user\x20with\x20email',_0x5aea0a[_0xcba3('0x1f')]);_0x5aea0a['userEmail']=_0x5aea0a['agentEmail'];for(_0x364f91=0x0;_0x364f91<_0x1dc79b[_0xcba3('0x15')];_0x364f91++){if(_0x1dc79b[_0x364f91][_0xcba3('0x16')]===_0x5aea0a['agentEmail']){_0x46a9b9=!![];_0x5aea0a[_0xcba3('0x20')]=_0x1dc79b[_0x364f91]['id'];logger['info'](_0xcba3('0x21'),_0x5aea0a[_0xcba3('0x20')]);}}}if(!_0x46a9b9){logger[_0xcba3('0x11')](_0xcba3('0x22'));_0x5aea0a['userEmail']=_0x5aea0a[_0xcba3('0x23')];_0x5aea0a['userId']=_0x5aea0a[_0xcba3('0x17')];_0x46a9b9=!![];}if(_0x46a9b9){_0x2e0b54(_0x5aea0a);}else{_0x13ad33({'statusCode':0x194,'message':_0xcba3('0x19')});}}else{_0x13ad33({'statusCode':0x194,'message':_0xcba3('0x19')});}})[_0xcba3('0x1a')](function(_0x1da607){logger[_0xcba3('0x1b')]('['+[_0x5730d2[_0xcba3('0x1c')]()]+']',_0x1da607[_0xcba3('0x1d')]);_0x13ad33(_0x1da607);});});};}function searchContact(_0x3771d2,_0xe5c230,_0x489aae,_0x426bdf){return new Promise(function(_0xd2977,_0x46edcb){var _0x2c6f30={'method':_0xcba3('0xe'),'headers':_0xe5c230,'uri':_0x3771d2+_0xcba3('0x24')+_0x426bdf+'&f='+_0x489aae+_0xcba3('0x25'),'json':!![]};rp(_0x2c6f30)[_0xcba3('0x13')](function(_0x558de8){var _0x4363a1=_['find'](_0x558de8['contacts'][_0xcba3('0x26')],[_0x489aae,_0x426bdf]);_0xd2977(_0x4363a1);})[_0xcba3('0x1a')](function(_0x18c792){_0x46edcb(_0x18c792);});});}function getEndUser(_0x2df821,_0x17d648,_0x3e29d1){return function(_0x14d84a){return new Promise(function(_0x35c472,_0xe22283){logger[_0xcba3('0x11')](util[_0xcba3('0x27')](_0xcba3('0x28'),_0x14d84a[_0xcba3('0x29')]));searchContact(_0x3e29d1,_0x17d648,_0xcba3('0x2a'),_0x14d84a[_0xcba3('0x29')])['then'](function(_0x34ca43){if(_0x34ca43){_0x14d84a[_0xcba3('0x2b')]=_0x34ca43['id'];logger[_0xcba3('0x11')](_0xcba3('0x2c'),_0x14d84a[_0xcba3('0x2b')]);return _0x35c472(_0x14d84a);}searchContact(_0x3e29d1,_0x17d648,_0xcba3('0x2d'),_0x14d84a['contactNumber'])[_0xcba3('0x13')](function(_0x2648d4){if(_0x2648d4){_0x14d84a['endUserId']=_0x2648d4['id'];logger[_0xcba3('0x11')](_0xcba3('0x2e'),_0x14d84a[_0xcba3('0x2b')]);return _0x35c472(_0x14d84a);}createEndUser(_0x14d84a,_0x2df821,_0x17d648,_0x3e29d1)[_0xcba3('0x13')](function(_0x8f0e0e){logger['info']('Contact\x20created:',_0x8f0e0e['endUserId']);return _0x35c472(_0x8f0e0e);});});})[_0xcba3('0x1a')](function(_0x385006){_0xe22283(_0x385006);});});};}function createEndUser(_0x1d6027,_0x381b41,_0x5e0321,_0x3b1790){return new Promise(function(_0x5adecd,_0x135557){var _0x326b60=moment();var _0xb24ca9={'method':_0xcba3('0x2f'),'uri':_0x3b1790+_0xcba3('0x30'),'body':{'contact':{'last_name':_0x1d6027[_0xcba3('0x29')],'work_number':_0x1d6027[_0xcba3('0x29')],'mobile_number':_0x1d6027['contactNumber'],'owner_id':_0x1d6027[_0xcba3('0x20')],'created_at':_0x326b60[_0xcba3('0x27')](_0xcba3('0x31'))}},'json':!![]};_0xb24ca9[_0xcba3('0x10')]=_0x5e0321;logger['info'](_0xcba3('0x32'));return rp(_0xb24ca9)[_0xcba3('0x13')](function(_0xa37915){_0x1d6027[_0xcba3('0x2b')]=_0xa37915['contact']['id'];_0x5adecd(_0x1d6027);})[_0xcba3('0x1a')](function(_0x3781be){logger[_0xcba3('0x1b')]('['+[_0x381b41[_0xcba3('0x1c')]()]+']',_0x3781be[_0xcba3('0x1d')]);_0x135557(_0x3781be['message']);});});}function getTicket(_0x40ff7f,_0x2cb5b8,_0x1a78b4,_0xd92a1d,_0x477249){return function(_0x55c0bd){logger[_0xcba3('0x11')]('Creating\x20new\x20task');return new Promise(function(_0x278ec9,_0x3614f7){var _0x1db234=moment();var _0x47c0b7={'method':_0xcba3('0x2f'),'uri':_0x1a78b4+_0xcba3('0x33'),'body':{'title':intUtil[_0xcba3('0x34')](_0xd92a1d[_0xcba3('0x35')],_0x477249,'\x20'),'description':intUtil[_0xcba3('0x34')](_0xd92a1d[_0xcba3('0x36')],_0x477249,'\x0a'),'owner_id':_0x55c0bd[_0xcba3('0x20')],'creater_id':_0x55c0bd[_0xcba3('0x17')],'targetable_id':_0x55c0bd['endUserId'],'targetable_type':_0xcba3('0x37'),'created_at':_0x1db234[_0xcba3('0x27')](_0xcba3('0x31')),'due_date':_0x1db234[_0xcba3('0x38')](0x1e,'m')[_0xcba3('0x27')](_0xcba3('0x31'))},'json':!![]};_0x47c0b7['headers']=_0x2cb5b8;return rp(_0x47c0b7)[_0xcba3('0x13')](function(_0x2b9df1){_0x55c0bd[_0xcba3('0x39')]=_0x2b9df1['task']['id'];logger[_0xcba3('0x11')](_0xcba3('0x3a'),_0x55c0bd['ticketId']);_0x278ec9(_0x55c0bd);})[_0xcba3('0x1a')](function(_0x22fa65){logger[_0xcba3('0x1b')]('['+[_0x40ff7f[_0xcba3('0x1c')]()]+']',_0x22fa65[_0xcba3('0x1d')]);_0x3614f7(_0x22fa65['message']);});});};}function emit(_0x2eaca1,_0x40cc94,_0x35427a){var _0x1cb7ba={'uri':_0x2eaca1+'/contacts/'+_0x35427a};io['to'](util[_0xcba3('0x27')](_0xcba3('0x3b'),_0x40cc94))[_0xcba3('0x3c')]('trigger:browser:url',_0x1cb7ba);}exports['cs']=function(_0x19764a,_0x141942,_0x134de1,_0x13d6f6,_0x28484f,_0x4acae5,_0x3f37e3,_0x24ad4f){var _0x5509ad={};var _0x2bf396={'Authorization':_0xcba3('0x3d')+_0x4acae5[_0xcba3('0x3e')]};_0x4acae5[_0xcba3('0x3f')]=intUtil[_0xcba3('0x40')](_0x4acae5[_0xcba3('0x3f')]);_0x4acae5['serverUrl']=intUtil['stripTrailingSlash'](_0x4acae5[_0xcba3('0x41')]);var _0x19b73b=_0x4acae5[_0xcba3('0x3f')];_0x5509ad[_0xcba3('0x23')]=_0x4acae5[_0xcba3('0x42')];_0x5509ad[_0xcba3('0x29')]=_0x24ad4f['toLowerCase']()==='outbound'?_0x141942[_0xcba3('0x43')]:_0x141942['calleridnum'];_0x5509ad[_0xcba3('0x44')]=_0x24ad4f==='queue'||_0x24ad4f===_0xcba3('0x45')?_0xcba3('0x46'):_0xcba3('0x47');if(_0x13d6f6){_0x5509ad['agentEmail']=_0x13d6f6[_0xcba3('0x16')];}var _0x3b59a8=util[_0xcba3('0x27')](_0xcba3('0x48'),_0x4acae5[_0xcba3('0x41')],_0x141942['uniqueid'],md5(_0x141942['uniqueid']));if(_0x28484f&&_0x28484f['monitor_format']){logger['info'](_0xcba3('0x49'),_0xcba3('0x4a'));_0x141942[_0xcba3('0x4b')]=_0x3b59a8;}else if(_0x3f37e3&&_0x3f37e3[_0xcba3('0x4c')]&&_0x3f37e3['recordingFormat']!==_0xcba3('0x4d')){logger['info'](_0xcba3('0x4e'),'Recording\x20is\x20enabled!');_0x141942[_0xcba3('0x4b')]=_0x3b59a8;}else{_0x141942[_0xcba3('0x4b')]='';}return getAdminId(_0x5509ad,_0x24ad4f,_0x2bf396,_0x19b73b)[_0xcba3('0x13')](getUser(_0x24ad4f,_0x2bf396,_0x19b73b))[_0xcba3('0x13')](getEndUser(_0x24ad4f,_0x2bf396,_0x19b73b))[_0xcba3('0x13')](getTicket(_0x24ad4f,_0x2bf396,_0x19b73b,_0x134de1,_0x141942))['then'](function(_0x1f47fd){logger[_0xcba3('0x11')](util[_0xcba3('0x27')](_0xcba3('0x4f'),_0x1f47fd['ticketId']));if(_0x24ad4f!==_0xcba3('0x45')){logger[_0xcba3('0x11')]('['+[_0x24ad4f[_0xcba3('0x1c')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x19b73b,_0x13d6f6[_0xcba3('0x50')],_0x1f47fd['endUserId']);}})[_0xcba3('0x1a')](function(_0x98dad9){logger['error']('['+[_0x24ad4f[_0xcba3('0x1c')]()]+_0xcba3('0x51'),util[_0xcba3('0x52')](_0x98dad9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2c34=['Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','email','userId','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number'];(function(_0x285b5e,_0x5cf0ac){var _0x13fa28=function(_0x3d9e3a){while(--_0x3d9e3a){_0x285b5e['push'](_0x285b5e['shift']());}};_0x13fa28(++_0x5cf0ac);}(_0x2c34,0x1bb));var _0x42c3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2c34[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x42c3('0x0'));var rp=require(_0x42c3('0x1'));var md5=require('md5');var util=require(_0x42c3('0x2'));var moment=require('moment');var Promise=require(_0x42c3('0x3'));var Redis=require('ioredis');var intUtil=require(_0x42c3('0x4'));var config=require(_0x42c3('0x5'));var logger=require(_0x42c3('0x6'))(_0x42c3('0x7'));config[_0x42c3('0x8')]=_[_0x42c3('0x9')](config['redis'],{'host':_0x42c3('0xa'),'port':0x18eb});var io=require(_0x42c3('0xb'))(new Redis(config[_0x42c3('0x8')]));function getAdminId(_0x32f058,_0x290e74,_0x57224f,_0x5c13eb){return new Promise(function(_0x136402,_0x2b876e){var _0x35003e=![];var _0x2b4109={'method':_0x42c3('0xc'),'uri':_0x5c13eb+'/api/selector/owners','json':!![]};_0x2b4109[_0x42c3('0xd')]=_0x57224f;logger[_0x42c3('0xe')]('Getting\x20admin\x20information');return rp(_0x2b4109)[_0x42c3('0xf')](function(_0x55e878){if(_0x55e878){var _0x41af2e=_0x55e878[_0x42c3('0x10')];var _0x5ede25=null;for(_0x5ede25=0x0;_0x5ede25<_0x41af2e[_0x42c3('0x11')];_0x5ede25++){if(_0x41af2e[_0x5ede25]['email']===_0x32f058[_0x42c3('0x12')]){_0x32f058[_0x42c3('0x13')]=_0x41af2e[_0x5ede25]['id'];_0x35003e=!![];}}if(_0x35003e){logger['info'](_0x42c3('0x14'),_0x32f058['adminId']);_0x136402(_0x32f058);}else{_0x2b876e({'statusCode':0x194,'message':_0x42c3('0x15')});}}else{_0x2b876e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x42c3('0x16')](function(_0x1a496d){logger[_0x42c3('0x17')]('['+[_0x290e74[_0x42c3('0x18')]()]+']',_0x1a496d[_0x42c3('0x19')]);_0x2b876e(_0x1a496d);});});}function getUser(_0x777f8,_0x187c62,_0x2257ab){return function(_0x422641){return new Promise(function(_0x3a2145,_0x4eb389){var _0x22f8ff={'method':'GET','uri':_0x2257ab+_0x42c3('0x1a'),'json':!![]};_0x22f8ff[_0x42c3('0xd')]=_0x187c62;logger[_0x42c3('0xe')](_0x42c3('0x1b'));return rp(_0x22f8ff)['then'](function(_0x1b64c1){if(_0x1b64c1){var _0x44a8fe=_0x1b64c1[_0x42c3('0x10')];var _0x101686=![];var _0x5f3db5=null;if(_0x422641[_0x42c3('0x1c')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x422641[_0x42c3('0x1c')]);_0x422641[_0x42c3('0x1d')]=_0x422641[_0x42c3('0x1c')];for(_0x5f3db5=0x0;_0x5f3db5<_0x44a8fe[_0x42c3('0x11')];_0x5f3db5++){if(_0x44a8fe[_0x5f3db5][_0x42c3('0x1e')]===_0x422641[_0x42c3('0x1c')]){_0x101686=!![];_0x422641[_0x42c3('0x1f')]=_0x44a8fe[_0x5f3db5]['id'];logger['info']('User\x20found:',_0x422641[_0x42c3('0x1f')]);}}}if(!_0x101686){logger[_0x42c3('0xe')]('Admin\x20selected');_0x422641[_0x42c3('0x1d')]=_0x422641[_0x42c3('0x12')];_0x422641[_0x42c3('0x1f')]=_0x422641['adminId'];_0x101686=!![];}if(_0x101686){_0x3a2145(_0x422641);}else{_0x4eb389({'statusCode':0x194,'message':_0x42c3('0x15')});}}else{_0x4eb389({'statusCode':0x194,'message':_0x42c3('0x15')});}})[_0x42c3('0x16')](function(_0x44761d){logger[_0x42c3('0x17')]('['+[_0x777f8['toUpperCase']()]+']',_0x44761d[_0x42c3('0x19')]);_0x4eb389(_0x44761d);});});};}function searchContact(_0x30b894,_0x36e5a2,_0x470793,_0x44d8a6){return new Promise(function(_0x2e85fb,_0x2b503a){var _0x2fe695={'method':_0x42c3('0xc'),'headers':_0x36e5a2,'uri':_0x30b894+_0x42c3('0x20')+_0x44d8a6+_0x42c3('0x21')+_0x470793+'&entities=contact','json':!![]};rp(_0x2fe695)[_0x42c3('0xf')](function(_0x467629){var _0x3a818e=_[_0x42c3('0x22')](_0x467629[_0x42c3('0x23')][_0x42c3('0x23')],[_0x470793,_0x44d8a6]);_0x2e85fb(_0x3a818e);})[_0x42c3('0x16')](function(_0x3a4cc1){_0x2b503a(_0x3a4cc1);});});}function getEndUser(_0x119d85,_0x5b5ca4,_0x4f3990){return function(_0x41303c){return new Promise(function(_0x4f72ad,_0x301869){logger[_0x42c3('0xe')](util[_0x42c3('0x24')](_0x42c3('0x25'),_0x41303c[_0x42c3('0x26')]));searchContact(_0x4f3990,_0x5b5ca4,_0x42c3('0x27'),_0x41303c[_0x42c3('0x26')])[_0x42c3('0xf')](function(_0x2a4380){if(_0x2a4380){_0x41303c['endUserId']=_0x2a4380['id'];logger[_0x42c3('0xe')](_0x42c3('0x28'),_0x41303c[_0x42c3('0x29')]);return _0x4f72ad(_0x41303c);}searchContact(_0x4f3990,_0x5b5ca4,_0x42c3('0x2a'),_0x41303c['contactNumber'])[_0x42c3('0xf')](function(_0x516125){if(_0x516125){_0x41303c[_0x42c3('0x29')]=_0x516125['id'];logger[_0x42c3('0xe')](_0x42c3('0x2b'),_0x41303c[_0x42c3('0x29')]);return _0x4f72ad(_0x41303c);}createEndUser(_0x41303c,_0x119d85,_0x5b5ca4,_0x4f3990)[_0x42c3('0xf')](function(_0x141d3f){logger[_0x42c3('0xe')]('Contact\x20created:',_0x141d3f[_0x42c3('0x29')]);return _0x4f72ad(_0x141d3f);});});})['catch'](function(_0x758abd){_0x301869(_0x758abd);});});};}function createEndUser(_0x10d1ae,_0x936731,_0x4a8b3b,_0x287a12){return new Promise(function(_0x35a637,_0x51f3e5){var _0x3fa6b9=moment();var _0x54f020={'method':'POST','uri':_0x287a12+_0x42c3('0x2c'),'body':{'contact':{'last_name':_0x10d1ae[_0x42c3('0x26')],'work_number':_0x10d1ae[_0x42c3('0x26')],'mobile_number':_0x10d1ae[_0x42c3('0x26')],'owner_id':_0x10d1ae['userId'],'created_at':_0x3fa6b9[_0x42c3('0x24')](_0x42c3('0x2d'))}},'json':!![]};_0x54f020['headers']=_0x4a8b3b;logger['info'](_0x42c3('0x2e'));return rp(_0x54f020)['then'](function(_0x2a52ec){_0x10d1ae[_0x42c3('0x29')]=_0x2a52ec[_0x42c3('0x2f')]['id'];_0x35a637(_0x10d1ae);})[_0x42c3('0x16')](function(_0x5c2f5c){logger[_0x42c3('0x17')]('['+[_0x936731[_0x42c3('0x18')]()]+']',_0x5c2f5c[_0x42c3('0x19')]);_0x51f3e5(_0x5c2f5c[_0x42c3('0x19')]);});});}function getTicket(_0x4d28d9,_0x23ba8a,_0x3b8c15,_0x52f9d1,_0x55a056){return function(_0x3e37cc){logger[_0x42c3('0xe')](_0x42c3('0x30'));return new Promise(function(_0x1cf282,_0x44d2b8){var _0x115250=moment();var _0x1ef090={'method':_0x42c3('0x31'),'uri':_0x3b8c15+_0x42c3('0x32'),'body':{'title':intUtil[_0x42c3('0x33')](_0x52f9d1[_0x42c3('0x34')],_0x55a056,'\x20'),'description':intUtil['getString'](_0x52f9d1[_0x42c3('0x35')],_0x55a056,'\x0a'),'owner_id':_0x3e37cc[_0x42c3('0x1f')],'creater_id':_0x3e37cc['adminId'],'targetable_id':_0x3e37cc[_0x42c3('0x29')],'targetable_type':_0x42c3('0x36'),'created_at':_0x115250[_0x42c3('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x115250[_0x42c3('0x37')](0x1e,'m')[_0x42c3('0x24')](_0x42c3('0x2d'))},'json':!![]};_0x1ef090[_0x42c3('0xd')]=_0x23ba8a;return rp(_0x1ef090)[_0x42c3('0xf')](function(_0xf32997){_0x3e37cc['ticketId']=_0xf32997[_0x42c3('0x38')]['id'];logger[_0x42c3('0xe')](_0x42c3('0x39'),_0x3e37cc[_0x42c3('0x3a')]);_0x1cf282(_0x3e37cc);})[_0x42c3('0x16')](function(_0x2361f0){logger[_0x42c3('0x17')]('['+[_0x4d28d9[_0x42c3('0x18')]()]+']',_0x2361f0[_0x42c3('0x19')]);_0x44d2b8(_0x2361f0['message']);});});};}function emit(_0x2bf3a1,_0x3cb583,_0x1ae556){var _0x1dd8e7={'uri':_0x2bf3a1+'/contacts/'+_0x1ae556};io['to'](util['format']('user:%s',_0x3cb583))[_0x42c3('0x3b')]('trigger:browser:url',_0x1dd8e7);}exports['cs']=function(_0xcef7c5,_0x52b191,_0xac0871,_0x46e3e9,_0x44e6a7,_0x336726,_0xea88bd,_0x377316){var _0x2887d1={};var _0x4d529c={'Authorization':_0x42c3('0x3c')+_0x336726[_0x42c3('0x3d')]};_0x336726[_0x42c3('0x3e')]=intUtil[_0x42c3('0x3f')](_0x336726['remoteUri']);_0x336726[_0x42c3('0x40')]=intUtil[_0x42c3('0x3f')](_0x336726[_0x42c3('0x40')]);var _0x457c9e=_0x336726[_0x42c3('0x3e')];_0x2887d1[_0x42c3('0x12')]=_0x336726[_0x42c3('0x41')];_0x2887d1[_0x42c3('0x26')]=_0x377316[_0x42c3('0x42')]()===_0x42c3('0x43')?_0x52b191['destcalleridnum']:_0x52b191[_0x42c3('0x44')];_0x2887d1[_0x42c3('0x45')]=_0x377316===_0x42c3('0x46')||_0x377316===_0x42c3('0x47')?_0x42c3('0x46'):'outbound';if(_0x46e3e9){_0x2887d1['agentEmail']=_0x46e3e9['email'];}var _0x332f68=util[_0x42c3('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x336726[_0x42c3('0x40')],_0x52b191[_0x42c3('0x48')],md5(_0x52b191['uniqueid']));if(_0x44e6a7&&_0x44e6a7['monitor_format']){logger[_0x42c3('0xe')]('[QUEUE]',_0x42c3('0x49'));_0x52b191[_0x42c3('0x4a')]=_0x332f68;}else if(_0xea88bd&&_0xea88bd[_0x42c3('0x4b')]&&_0xea88bd[_0x42c3('0x4b')]!=='none'){logger[_0x42c3('0xe')]('[OUTBOUND]',_0x42c3('0x49'));_0x52b191[_0x42c3('0x4a')]=_0x332f68;}else{_0x52b191[_0x42c3('0x4a')]='';}return getAdminId(_0x2887d1,_0x377316,_0x4d529c,_0x457c9e)[_0x42c3('0xf')](getUser(_0x377316,_0x4d529c,_0x457c9e))['then'](getEndUser(_0x377316,_0x4d529c,_0x457c9e))[_0x42c3('0xf')](getTicket(_0x377316,_0x4d529c,_0x457c9e,_0xac0871,_0x52b191))[_0x42c3('0xf')](function(_0x64b65c){logger['info'](util[_0x42c3('0x24')](_0x42c3('0x4c'),_0x64b65c['ticketId']));if(_0x377316!==_0x42c3('0x47')){logger['info']('['+[_0x377316[_0x42c3('0x18')]()]+']',_0x42c3('0x4d'));emit(_0x457c9e,_0x46e3e9[_0x42c3('0x4e')],_0x64b65c[_0x42c3('0x29')]);}})['catch'](function(_0x1e9279){logger[_0x42c3('0x17')]('['+[_0x377316[_0x42c3('0x18')]()]+_0x42c3('0x4f'),util[_0x42c3('0x50')](_0x1e9279,{'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 c43b61a..9f9089e 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 _0xa5bd=['./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','data3','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','sugarcrm','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365'];(function(_0x34361b,_0x9642d4){var _0x1de9c5=function(_0x41bc3f){while(--_0x41bc3f){_0x34361b['push'](_0x34361b['shift']());}};_0x1de9c5(++_0x9642d4);}(_0xa5bd,0x13c));var _0xda5b=function(_0x437546,_0x334f47){_0x437546=_0x437546-0x0;var _0x36b04f=_0xa5bd[_0x437546];return _0x36b04f;};'use strict';var _=require('lodash');var util=require(_0xda5b('0x0'));var zendesk=require(_0xda5b('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xda5b('0x2'));var freshdesk=require(_0xda5b('0x3'));var zoho=require(_0xda5b('0x4'));var desk=require(_0xda5b('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0xda5b('0x6'));var dynamics365=require(_0xda5b('0x7'));var freshsales=require(_0xda5b('0x8'));var integrations=['zendesk',_0xda5b('0x9'),'sugarcrm',_0xda5b('0xa'),_0xda5b('0xb'),_0xda5b('0xc'),_0xda5b('0xd'),_0xda5b('0xe'),_0xda5b('0xf'),'servicenow'];exports[_0xda5b('0x10')]=function(_0x13c508,_0x5b6e9e,_0x3bc63a,_0x580427,_0x519d3f,_0x96b26f){if(_0x3bc63a){if(_[_0xda5b('0x11')](integrations,_0x13c508[_0xda5b('0x12')]['toLowerCase']())){try{var _0x14d487=null;var _0x1a8d82='';var _0x40fa59=_0x3bc63a[_0x13c508['data1'][_0xda5b('0x13')]()];if(_0x40fa59){var _0x188bea=_0x40fa59[_0x13c508[_0xda5b('0x14')]];if(_0x188bea){var _0x993929=_[_0xda5b('0x15')](_0x188bea['Configurations'],{'id':parseInt(_0x13c508[_0xda5b('0x16')],0xa)});if(_0x993929){if(_0x580427){if(_0x519d3f&&_0x5b6e9e['queue']){_0x1a8d82='queue';}else if(_0x5b6e9e['routeId']){_0x1a8d82=_0xda5b('0x17');}else{console[_0xda5b('0x18')](_0xda5b('0x19'),_0x5b6e9e);}}else{_0x1a8d82=_0xda5b('0x1a');}switch(_0x13c508[_0xda5b('0x12')][_0xda5b('0x13')]()){case _0xda5b('0x1b'):zendesk[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case _0xda5b('0x9'):salesforce[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case _0xda5b('0x1c'):sugarcrm[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case'freshdesk':freshdesk[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case _0xda5b('0xb'):zoho[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case'desk':desk[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case'vtiger':vtiger[_0x1a8d82](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f);break;case'freshsales':freshsales['cs'](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f,_0x1a8d82);break;case _0xda5b('0x1d'):servicenow['cs'](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f,_0x1a8d82);break;case _0xda5b('0xe'):dynamics365['cs'](_0x13c508,_0x5b6e9e,_0x993929,_0x580427,_0x519d3f,_0x188bea,_0x96b26f,_0x1a8d82);break;default:console[_0xda5b('0x18')](_0xda5b('0x1e'));}}else{_0x14d487=require(_0xda5b('0x1f'))(_0x13c508['data1']['toLowerCase']());_0x14d487[_0xda5b('0x20')](_0xda5b('0x21'),util[_0xda5b('0x22')](_0xda5b('0x23'),_0x13c508[_0xda5b('0x12')]['toLowerCase'](),_0x13c508[_0xda5b('0x16')]));}}else{_0x14d487=require(_0xda5b('0x1f'))(_0x13c508[_0xda5b('0x12')][_0xda5b('0x13')]());_0x14d487['error'](_0xda5b('0x21'),util[_0xda5b('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x13c508['data1'][_0xda5b('0x13')](),_0x13c508[_0xda5b('0x14')]));}}else{}}catch(_0x172c48){console[_0xda5b('0x20')](_0x172c48);}}}}; \ No newline at end of file +var _0x6fe1=['zoho','desk','vtiger','servicenow','exec','toLowerCase','data1','find','Configurations','data3','routeId','outbound','log','unmanaged','sugarcrm','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk'];(function(_0x1d6371,_0xbed0c2){var _0x186a8f=function(_0x1bcdcb){while(--_0x1bcdcb){_0x1d6371['push'](_0x1d6371['shift']());}};_0x186a8f(++_0xbed0c2);}(_0x6fe1,0x1b0));var _0x16fe=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x6fe1[_0x3a78a0];return _0x48e917;};'use strict';var _=require(_0x16fe('0x0'));var util=require('util');var zendesk=require(_0x16fe('0x1'));var salesforce=require(_0x16fe('0x2'));var sugarcrm=require(_0x16fe('0x3'));var freshdesk=require(_0x16fe('0x4'));var zoho=require(_0x16fe('0x5'));var desk=require('./desk');var vtiger=require(_0x16fe('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x16fe('0x7'));var freshsales=require(_0x16fe('0x8'));var integrations=[_0x16fe('0x9'),_0x16fe('0xa'),'sugarcrm',_0x16fe('0xb'),_0x16fe('0xc'),_0x16fe('0xd'),_0x16fe('0xe'),'dynamics365','freshsales',_0x16fe('0xf')];exports[_0x16fe('0x10')]=function(_0x5c8aa1,_0x5f0cc4,_0x4b6ef1,_0x3ba86c,_0x3c5930,_0x6fa85){if(_0x4b6ef1){if(_['includes'](integrations,_0x5c8aa1['data1'][_0x16fe('0x11')]())){try{var _0x3ce559=null;var _0x3baf36='';var _0x1aaadf=_0x4b6ef1[_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')]()];if(_0x1aaadf){var _0x4e0919=_0x1aaadf[_0x5c8aa1['data2']];if(_0x4e0919){var _0x26d3cb=_[_0x16fe('0x13')](_0x4e0919[_0x16fe('0x14')],{'id':parseInt(_0x5c8aa1[_0x16fe('0x15')],0xa)});if(_0x26d3cb){if(_0x3ba86c){if(_0x3c5930&&_0x5f0cc4['queue']){_0x3baf36='queue';}else if(_0x5f0cc4[_0x16fe('0x16')]){_0x3baf36=_0x16fe('0x17');}else{console[_0x16fe('0x18')]('EVENT\x20UNKNOWN',_0x5f0cc4);}}else{_0x3baf36=_0x16fe('0x19');}switch(_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')]()){case _0x16fe('0x9'):zendesk[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xa'):salesforce[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0x1a'):sugarcrm[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xb'):freshdesk[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case'zoho':zoho[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xd'):desk[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0xe'):vtiger[_0x3baf36](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85);break;case _0x16fe('0x1b'):freshsales['cs'](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85,_0x3baf36);break;case _0x16fe('0xf'):servicenow['cs'](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85,_0x3baf36);break;case _0x16fe('0x1c'):dynamics365['cs'](_0x5c8aa1,_0x5f0cc4,_0x26d3cb,_0x3ba86c,_0x3c5930,_0x4e0919,_0x6fa85,_0x3baf36);break;default:console[_0x16fe('0x18')](_0x16fe('0x1d'));}}else{_0x3ce559=require(_0x16fe('0x1e'))(_0x5c8aa1[_0x16fe('0x12')]['toLowerCase']());_0x3ce559['error'](_0x16fe('0x1f'),util['format'](_0x16fe('0x20'),_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')](),_0x5c8aa1[_0x16fe('0x15')]));}}else{_0x3ce559=require(_0x16fe('0x1e'))(_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')]());_0x3ce559[_0x16fe('0x21')]('[EXEC]',util[_0x16fe('0x22')](_0x16fe('0x23'),_0x5c8aa1[_0x16fe('0x12')][_0x16fe('0x11')](),_0x5c8aa1[_0x16fe('0x24')]));}}else{}}catch(_0x398ab6){console[_0x16fe('0x21')](_0x398ab6);}}}}; \ 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 0d86f88..b33d45e 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 _0x88ab=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','[OUTBOUND]','catch','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','execute','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','find','account_contact_lead','additionalSearchAccount','Lead','Account','Phone','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','LastName','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl'];(function(_0x152b03,_0x2b427f){var _0x5a5d4b=function(_0x3037a3){while(--_0x3037a3){_0x152b03['push'](_0x152b03['shift']());}};_0x5a5d4b(++_0x2b427f);}(_0x88ab,0x193));var _0xb88a=function(_0x5e1541,_0x581ce2){_0x5e1541=_0x5e1541-0x0;var _0x1b3014=_0x88ab[_0x5e1541];return _0x1b3014;};'use strict';var _=require(_0xb88a('0x0'));var rp=require('request-promise');var moment=require(_0xb88a('0x1'));var BPromise=require(_0xb88a('0x2'));var md5=require(_0xb88a('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xb88a('0x4'));var intUtil=require(_0xb88a('0x5'));var config=require(_0xb88a('0x6'));var logger=require(_0xb88a('0x7'))(_0xb88a('0x8'));config[_0xb88a('0x9')]=_['defaults'](config[_0xb88a('0x9')],{'host':_0xb88a('0xa'),'port':0x18eb});var io=require(_0xb88a('0xb'))(new Redis(config[_0xb88a('0x9')]));function emit(_0x3b4476,_0x1ef394,_0xe2cd4f){io['to'](_0x3b4476)['emit'](_0x1ef394,_0xe2cd4f);}function getTicket(_0xe80190,_0xf579d4,_0x2b2f16,_0x46d4ba,_0x1ecd90,_0x1052b1,_0x4e1ad3,_0x383fc2){var _0x49859c=Object[_0xb88a('0xc')]({},{'OwnerId':_0xf579d4['id'],'Subject':intUtil[_0xb88a('0xd')](_0x46d4ba['Subjects'],_0x1ecd90,'\x20'),'Description':intUtil['getString'](_0x46d4ba['Descriptions'],_0x1ecd90,'\x0a')},getCustomFields(_0x1052b1,_0x1ecd90));if(_0x2b2f16){if(_0x46d4ba[_0xb88a('0xe')]===_0xb88a('0xf')){_0x49859c[_0xb88a('0x10')]=moment[_0xb88a('0x11')]();_0x49859c['IsReminderSet']=![];_0x49859c[_0xb88a('0x12')]=![];if(_0x2b2f16[_0xb88a('0x13')]===_0xb88a('0x14')||_0x2b2f16[_0xb88a('0x13')]===_0xb88a('0x15')){_0x49859c['WhoId']=_0x2b2f16['id'];}else if(_0x2b2f16['endUserType']===_0xb88a('0x16')){_0x49859c[_0xb88a('0x17')]=_0x2b2f16['id'];}}else if(_0x46d4ba[_0xb88a('0xe')]===_0xb88a('0x18')){if(_0x2b2f16[_0xb88a('0x13')]===_0xb88a('0x14')){_0x49859c['ContactId']=_0x2b2f16['id'];}else if(_0x2b2f16[_0xb88a('0x13')]===_0xb88a('0x16')){_0x49859c[_0xb88a('0x19')]=_0x2b2f16['id'];}else if(_0x2b2f16['endUserType']==='lead'&&_0x46d4ba[_0xb88a('0x1a')]){_0x49859c[_0x46d4ba[_0xb88a('0x1a')]]=_0x2b2f16['id'];}else{logger[_0xb88a('0x1b')](_0xb88a('0x1c'));}}}return _0x4e1ad3[_0xb88a('0x1d')](_0x46d4ba[_0xb88a('0xe')])[_0xb88a('0x1e')](_0x49859c);}function getUser(_0x9e2505,_0x597fe0,_0x15f9d6){if(!_['isNil'](_0x597fe0)&&intUtil[_0xb88a('0x1f')](_0x597fe0)){var _0x423e4d={'Email':_0x597fe0};var _0x4bfb12={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x15f9d6[_0xb88a('0x1d')]('User')['find'](_0x423e4d,_0x4bfb12)[_0xb88a('0x20')]()['then'](function(_0x562f1d){if(_0x562f1d['length']){var _0x586e7f=_['find'](_0x562f1d,function(_0x50173e){return _0x50173e[_0xb88a('0x21')]===_0x597fe0;});if(_0x586e7f){logger['info'](_0xb88a('0x22'),_0x597fe0);return BPromise['resolve']({'id':_0x586e7f['Id'],'name':_0x586e7f[_0xb88a('0x23')]});}}else{logger['info'](_0xb88a('0x24'),_0x597fe0);return _0x15f9d6[_0xb88a('0x25')]()['then'](function(_0x382c61){return BPromise[_0xb88a('0x26')]({'id':_0x382c61[_0xb88a('0x27')],'name':_0x382c61[_0xb88a('0x28')]});});}});}else{logger['info'](_0xb88a('0x24'),_0x597fe0);return _0x15f9d6['identity']()[_0xb88a('0x29')](function(_0x3df8dc){return BPromise[_0xb88a('0x26')]({'id':_0x3df8dc[_0xb88a('0x27')],'name':_0x3df8dc[_0xb88a('0x28')]});});}}function getEndUser(_0x5a4ef8,_0x172449,_0x4117c9,_0x49ad2a,_0x10c5f3){var _0x29ff10={'$or':{'Phone':_0x49ad2a}};var _0x531659={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb88a('0x26')]()[_0xb88a('0x29')](function(){logger['info'](_0xb88a('0x2a'),_0x49ad2a,_0x172449['moduleSearch']);switch(_0x172449[_0xb88a('0x2b')]){case _0xb88a('0x2c'):var _0x57c855=_[_0xb88a('0x2d')](_0x29ff10);if(_0x172449[_0xb88a('0x2e')]){var _0x2082cf={};_0x2082cf[_0x172449[_0xb88a('0x2e')]]=_0x49ad2a;_[_0xb88a('0x2f')](_0x57c855[_0xb88a('0x30')],_0x2082cf);}return _0x10c5f3[_0xb88a('0x1d')](_0xb88a('0x31'))['find'](_0x57c855,_0x531659)['execute']()[_0xb88a('0x29')](function(_0x4d3b66){if(_0x4d3b66&&_0x4d3b66[_0xb88a('0x32')]){return _0x4d3b66;}else{var _0x2727c4=_['cloneDeep'](_0x29ff10);if(_0x172449[_0xb88a('0x33')]){var _0x35e50e={};_0x35e50e[_0x172449[_0xb88a('0x33')]]=_0x49ad2a;_[_0xb88a('0x2f')](_0x2727c4[_0xb88a('0x30')],_0x35e50e);}return _0x10c5f3[_0xb88a('0x1d')]('Lead')[_0xb88a('0x34')](_0x2727c4,_0x531659);}});case _0xb88a('0x35'):var _0x3e9c33=_['cloneDeep'](_0x29ff10);if(_0x172449[_0xb88a('0x36')]){var _0x2082cf={};_0x2082cf[_0x172449[_0xb88a('0x36')]]=_0x49ad2a;_[_0xb88a('0x2f')](_0x3e9c33['$or'],_0x2082cf);}return _0x10c5f3['sobject']('Account')['find'](_0x3e9c33,_0x531659)['execute']()['then'](function(_0xfeaeb7){if(_0xfeaeb7&&_0xfeaeb7[_0xb88a('0x32')]){return _0xfeaeb7;}else{var _0x2f7e18=_[_0xb88a('0x2d')](_0x29ff10);if(_0x172449[_0xb88a('0x2e')]){var _0x57dcf0={};_0x57dcf0[_0x172449[_0xb88a('0x2e')]]=_0x49ad2a;_[_0xb88a('0x2f')](_0x2f7e18[_0xb88a('0x30')],_0x57dcf0);}return _0x10c5f3[_0xb88a('0x1d')](_0xb88a('0x31'))[_0xb88a('0x34')](_0x2f7e18,_0x531659)['then'](function(_0x4f1db3){if(_0x4f1db3&&_0x4f1db3[_0xb88a('0x32')]){return _0x4f1db3;}else{var _0x1408f4=_['cloneDeep'](_0x29ff10);if(_0x172449[_0xb88a('0x33')]){var _0x5a4ce0={};_0x5a4ce0[_0x172449[_0xb88a('0x33')]]=_0x49ad2a;_[_0xb88a('0x2f')](_0x1408f4[_0xb88a('0x30')],_0x5a4ce0);}return _0x10c5f3[_0xb88a('0x1d')]('Lead')[_0xb88a('0x34')](_0x1408f4,_0x531659);}});}});case _0xb88a('0x14'):var _0x57c855=_[_0xb88a('0x2d')](_0x29ff10);if(_0x172449['additionalSearchContact']){var _0x2082cf={};_0x2082cf[_0x172449['additionalSearchContact']]=_0x49ad2a;_[_0xb88a('0x2f')](_0x57c855[_0xb88a('0x30')],_0x2082cf);}return _0x10c5f3['sobject'](_0xb88a('0x31'))[_0xb88a('0x34')](_0x57c855,_0x531659)[_0xb88a('0x20')]();case _0xb88a('0x15'):var _0x2fdfb9=_[_0xb88a('0x2d')](_0x29ff10);if(_0x172449['additionalSearchLead']){var _0x2082cf={};_0x2082cf[_0x172449['additionalSearchLead']]=_0x49ad2a;_[_0xb88a('0x2f')](_0x2fdfb9['$or'],_0x2082cf);}return _0x10c5f3[_0xb88a('0x1d')](_0xb88a('0x37'))['find'](_0x2fdfb9,_0x531659);case _0xb88a('0x16'):var _0x3e9c33=_[_0xb88a('0x2d')](_0x29ff10);if(_0x172449[_0xb88a('0x36')]){var _0x2082cf={};_0x2082cf[_0x172449[_0xb88a('0x36')]]=_0x49ad2a;_[_0xb88a('0x2f')](_0x3e9c33[_0xb88a('0x30')],_0x2082cf);}return _0x10c5f3['sobject'](_0xb88a('0x38'))[_0xb88a('0x34')](_0x3e9c33,_0x531659);default:return null;}})['then'](function(_0x29c0ba){if(_0x29c0ba&&_0x29c0ba['length']){var _0x35cc45=_['first'](_0x29c0ba);if(_0x35cc45){return BPromise[_0xb88a('0x26')]({'id':_0x35cc45['Id'],'name':_0x35cc45[_0xb88a('0x23')],'phone':_0x35cc45[_0xb88a('0x39')],'endUserType':_0x35cc45['attributes']['type'][_0xb88a('0x3a')]()});}}})[_0xb88a('0x29')](function(_0xff77e1){if(_0xff77e1){logger[_0xb88a('0x1b')](_0xb88a('0x3b'),_0xff77e1[_0xb88a('0x13')],_0x49ad2a);return BPromise[_0xb88a('0x26')](_0xff77e1);}else{logger['info'](_0xb88a('0x3c'),_0x49ad2a);var _0x25a318={'Phone':_0x49ad2a};if(_0x172449[_0xb88a('0x3d')]){if(_0x172449[_0xb88a('0x3d')]===_0xb88a('0x14')){logger['info'](_0xb88a('0x3e'),_0x49ad2a,_0x172449[_0xb88a('0x3d')]);_0x25a318['LastName']=_0x4117c9!==_0xb88a('0x3f')?_0x4117c9:util[_0xb88a('0x40')](_0xb88a('0x41'),_0x49ad2a);}else if(_0x172449[_0xb88a('0x3d')]===_0xb88a('0x15')){logger['info'](_0xb88a('0x3e'),_0x49ad2a,_0x172449[_0xb88a('0x3d')]);_0x25a318[_0xb88a('0x42')]=_0x4117c9!==_0xb88a('0x3f')?_0x4117c9:util[_0xb88a('0x40')]('Caller\x20-\x20%s',_0x49ad2a);_0x25a318[_0xb88a('0x43')]=_0xb88a('0x44');}else if(_0x172449[_0xb88a('0x3d')]===_0xb88a('0x16')){logger[_0xb88a('0x1b')](_0xb88a('0x3e'),_0x49ad2a,_0x172449[_0xb88a('0x3d')]);_0x25a318['Name']=_0x4117c9!==_0xb88a('0x3f')?_0x4117c9:util[_0xb88a('0x40')](_0xb88a('0x41'),_0x49ad2a);}else{return null;}}return _0x10c5f3[_0xb88a('0x1d')](_[_0xb88a('0x45')](_0x172449['moduleCreate']))[_0xb88a('0x1e')](_0x25a318)[_0xb88a('0x29')](function(_0xa0b383){return BPromise['resolve']({'id':_0xa0b383['id'],'endUserType':_0x172449[_0xb88a('0x3d')]});});}});}function getCustomFields(_0x2a94df,_0x3d6e17){var _0x1b48ef={};if(_0x2a94df[_0xb88a('0x32')]>0x0){_[_0xb88a('0x46')](_0x2a94df,function(_0x511bb9){if(_[_0xb88a('0x47')]([_0xb88a('0x48'),_0xb88a('0x49')],_0x511bb9[_0xb88a('0x4a')])&&_0x511bb9[_0xb88a('0x4b')]){_0x1b48ef[_0x511bb9['idField']]=_0x511bb9['content']['toString']();}else if(_0x511bb9['type']===_0xb88a('0x4c')&&_0x511bb9[_0xb88a('0x4d')]&&_0x511bb9[_0xb88a('0x4b')]){_0x3d6e17[_0x511bb9['variableName']]&&(_0x1b48ef[_0x511bb9[_0xb88a('0x4b')]]=_0x3d6e17[_0x511bb9[_0xb88a('0x4d')]][_0xb88a('0x4e')]());}else if(_0x511bb9['type']===_0xb88a('0x4f')&&_0x511bb9[_0xb88a('0x50')]&&_0x511bb9[_0xb88a('0x50')][_0xb88a('0x51')]&&_0x511bb9['idField']){_0x3d6e17[_0x511bb9[_0xb88a('0x50')]['name']['toLowerCase']()]&&(_0x1b48ef[_0x511bb9['idField']]=_0x3d6e17[_0x511bb9[_0xb88a('0x50')][_0xb88a('0x51')][_0xb88a('0x3a')]()][_0xb88a('0x4e')]());}});}return _0x1b48ef;}function getConnection(_0x341db9){var _0x12d2a6=_0x341db9[_0xb88a('0x52')][_0xb88a('0x53')](_0x341db9[_0xb88a('0x54')]);var _0x4dc068=new jsforce[(_0xb88a('0x55'))]({'oauth2':{'loginUrl':_0x341db9[_0xb88a('0x56')]||'https://login.salesforce.com','clientId':_0x341db9[_0xb88a('0x57')],'clientSecret':_0x341db9['clientSecret']}});return _0x4dc068[_0xb88a('0x58')](_0x341db9['username'],_0x12d2a6)[_0xb88a('0x29')](function(){logger[_0xb88a('0x1b')](_0xb88a('0x59'));return _0x4dc068;});}exports[_0xb88a('0x5a')]=function(_0x15801e,_0x3e4886,_0xe74032,_0x70ad69,_0x35e093,_0x36f489){var _0x279307,_0x290597,_0x145029,_0x50761c;_0x36f489[_0xb88a('0x5b')]=intUtil[_0xb88a('0x5c')](_0x36f489[_0xb88a('0x5b')]);_0x36f489[_0xb88a('0x56')]=intUtil[_0xb88a('0x5c')](_0x36f489[_0xb88a('0x56')]);if(_0x35e093&&_0x35e093[_0xb88a('0x5d')]){logger[_0xb88a('0x1b')](_0xb88a('0x5e'),_0xb88a('0x5f'));_0x3e4886[_0xb88a('0x60')]=util[_0xb88a('0x40')](_0xb88a('0x61'),_0x36f489[_0xb88a('0x5b')],_0x3e4886[_0xb88a('0x62')],md5(_0x3e4886[_0xb88a('0x62')]));}else{_0x3e4886['recordingURL']='';}return getConnection(_0x36f489)[_0xb88a('0x29')](function(_0x190576){_0x50761c=_0x190576;return getUser(_0x36f489,_0x70ad69[_0xb88a('0x63')],_0x50761c);})[_0xb88a('0x29')](function(_0x29fd4e){_0x279307=_0x29fd4e;return getEndUser(_0x36f489,_0xe74032,_0x3e4886[_0xb88a('0x64')],_0x3e4886[_0xb88a('0x65')],_0x50761c);})[_0xb88a('0x29')](function(_0x371c33){_0x290597=_0x371c33;return getTicket(_0x36f489,_0x279307,_0x290597,_0xe74032,_0x3e4886,_0xe74032['Fields'],_0x50761c,_0xb88a('0x5a'));})[_0xb88a('0x29')](function(_0x136396){_0x145029=_0x136396;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x145029['id']);logger[_0xb88a('0x1b')](_0xb88a('0x66'),_0x145029['id'],_0x70ad69[_0xb88a('0x51')],_0x36f489['type']);switch(_0x36f489[_0xb88a('0x4a')]){case'integrationTab':emit(util['format'](_0xb88a('0x67'),_0x70ad69['name']),_0xb88a('0x68'),{'recordId':_0x145029['id']});break;case _0xb88a('0x69'):emit(util[_0xb88a('0x40')]('user:%s',_0x70ad69[_0xb88a('0x51')]),_0xb88a('0x6a'),{'uri':util[_0xb88a('0x40')](_0xb88a('0x6b'),_0x50761c[_0xb88a('0x6c')],_0x145029['id'])});break;default:logger['error'](_0xb88a('0x6d'));}})['catch'](function(_0x25036f){logger[_0xb88a('0x6e')]('[QUEUE]',_0x25036f);});};exports[_0xb88a('0x6f')]=function(_0x534ab8,_0x3e5c2c,_0x1b3a0f,_0x216d97,_0x1aca3e,_0x26f62a,_0xc05be7){var _0x560f55,_0xd7b6a8,_0x5ba37d,_0x1ba647;_0x26f62a[_0xb88a('0x5b')]=intUtil[_0xb88a('0x5c')](_0x26f62a[_0xb88a('0x5b')]);_0x26f62a[_0xb88a('0x56')]=intUtil[_0xb88a('0x5c')](_0x26f62a[_0xb88a('0x56')]);if(_0xc05be7&&_0xc05be7[_0xb88a('0x70')]&&_0xc05be7[_0xb88a('0x70')]!==_0xb88a('0x71')){logger[_0xb88a('0x1b')]('[OUTBOUND]',_0xb88a('0x5f'));_0x3e5c2c[_0xb88a('0x60')]=util[_0xb88a('0x40')](_0xb88a('0x61'),_0x26f62a[_0xb88a('0x5b')],_0x3e5c2c[_0xb88a('0x62')],md5(_0x3e5c2c['uniqueid']));}return getConnection(_0x26f62a)[_0xb88a('0x29')](function(_0x31b6a2){_0x1ba647=_0x31b6a2;return getUser(_0x26f62a,_0x216d97[_0xb88a('0x63')],_0x1ba647);})[_0xb88a('0x29')](function(_0x359d7e){_0x560f55=_0x359d7e;return getEndUser(_0x26f62a,_0x1b3a0f,_0x3e5c2c[_0xb88a('0x72')],_0x3e5c2c[_0xb88a('0x73')],_0x1ba647);})[_0xb88a('0x29')](function(_0x399423){_0xd7b6a8=_0x399423;return getTicket(_0x26f62a,_0x560f55,_0xd7b6a8,_0x1b3a0f,_0x3e5c2c,_0x1b3a0f[_0xb88a('0x74')],_0x1ba647,_0xb88a('0x6f'));})[_0xb88a('0x29')](function(_0x5122ab){_0x5ba37d=_0x5122ab;logger['info'](_0xb88a('0x75'),_0x5ba37d['id']);logger[_0xb88a('0x1b')](_0xb88a('0x76'),_0x5ba37d['id'],_0x216d97['name'],_0x26f62a['type']);switch(_0x26f62a[_0xb88a('0x4a')]){case _0xb88a('0x77'):emit(util[_0xb88a('0x40')]('user:%s',_0x216d97[_0xb88a('0x51')]),_0xb88a('0x68'),{'recordId':_0x5ba37d['id']});break;case _0xb88a('0x69'):emit(util[_0xb88a('0x40')](_0xb88a('0x67'),_0x216d97['name']),_0xb88a('0x6a'),{'uri':util[_0xb88a('0x40')]('%s/%s/e',_0x1ba647[_0xb88a('0x6c')],_0x5ba37d['id'])});break;default:logger[_0xb88a('0x6e')](_0xb88a('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xb88a('0x79')](function(_0x2c36da){logger[_0xb88a('0x6e')](_0xb88a('0x78'),_0x2c36da);});};exports[_0xb88a('0x7a')]=function(_0x4ccc44,_0x47681e,_0x2a8a4d,_0x21c920,_0x24412f,_0x32a231){var _0x496812,_0x411318,_0x132874,_0x443631;_0x32a231[_0xb88a('0x5b')]=intUtil[_0xb88a('0x5c')](_0x32a231[_0xb88a('0x5b')]);_0x32a231[_0xb88a('0x56')]=intUtil[_0xb88a('0x5c')](_0x32a231[_0xb88a('0x56')]);if(_0x24412f&&_0x24412f[_0xb88a('0x5d')]){logger['info']('['+_0x47681e[_0xb88a('0x7b')][_0xb88a('0x7c')]()+']','Recording\x20is\x20enabled!');_0x47681e['recordingURL']=util[_0xb88a('0x40')](_0xb88a('0x61'),_0x32a231['serverUrl'],_0x47681e['uniqueid'],md5(_0x47681e[_0xb88a('0x62')]));}else{_0x47681e[_0xb88a('0x60')]='';}return getConnection(_0x32a231)[_0xb88a('0x29')](function(_0x594b4c){_0x443631=_0x594b4c;if(!_[_0xb88a('0x7d')](_0x21c920)){return getUser(_0x32a231,_0x21c920[_0xb88a('0x51')],_0x443631);}else{return getUser(_0x32a231,null,_0x443631);}})[_0xb88a('0x29')](function(_0x376b46){_0x496812=_0x376b46;return getEndUser(_0x32a231,_0x2a8a4d,_0x47681e[_0xb88a('0x64')],_0x47681e[_0xb88a('0x65')],_0x443631);})[_0xb88a('0x29')](function(_0x1bcd2b){_0x411318=_0x1bcd2b;return getTicket(_0x32a231,_0x496812,_0x411318,_0x2a8a4d,_0x47681e,_0x2a8a4d[_0xb88a('0x74')],_0x443631);})['then'](function(_0x254ba6){_0x132874=_0x254ba6;logger[_0xb88a('0x1b')]('['+_0x47681e[_0xb88a('0x7b')][_0xb88a('0x7c')]()+_0xb88a('0x7e'),_0x132874['id']);logger[_0xb88a('0x1b')]('['+_0x47681e[_0xb88a('0x7b')]['toUpperCase']()+_0xb88a('0x7f'),_0x32a231[_0xb88a('0x4a')]);})['catch'](function(_0x4d1379){logger[_0xb88a('0x6e')]('['+_0x47681e[_0xb88a('0x7b')][_0xb88a('0x7c')]()+']',_0x4d1379);});}; \ No newline at end of file +var _0xd834=['resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','Lead','additionalSearchAccount','Account','additionalSearchLead','Phone','attributes','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','password','concat','securityToken','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','./util','salesforce','redis','localhost','emit','assign','getString','Subjects','Descriptions','Task','utc','IsReminderSet','contact','endUserType','lead','WhoId','WhatId','ticketType','ContactId','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','info'];(function(_0x25a602,_0xa6d233){var _0x4ce791=function(_0x27e7c8){while(--_0x27e7c8){_0x25a602['push'](_0x25a602['shift']());}};_0x4ce791(++_0xa6d233);}(_0xd834,0xd3));var _0x4d83=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd834[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x4d83('0x0'));var rp=require(_0x4d83('0x1'));var moment=require(_0x4d83('0x2'));var BPromise=require(_0x4d83('0x3'));var md5=require('md5');var jsforce=require(_0x4d83('0x4'));var util=require(_0x4d83('0x5'));var Redis=require('ioredis');var intUtil=require(_0x4d83('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4d83('0x7'));config[_0x4d83('0x8')]=_['defaults'](config[_0x4d83('0x8')],{'host':_0x4d83('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4d83('0x8')]));function emit(_0x2132d8,_0x578716,_0x53dde7){io['to'](_0x2132d8)[_0x4d83('0xa')](_0x578716,_0x53dde7);}function getTicket(_0x1d35ca,_0xb131e9,_0x58b986,_0x17624d,_0x2f6bb3,_0x389cbe,_0x12aee8,_0x30bd56){var _0x429ccb=Object[_0x4d83('0xb')]({},{'OwnerId':_0xb131e9['id'],'Subject':intUtil[_0x4d83('0xc')](_0x17624d[_0x4d83('0xd')],_0x2f6bb3,'\x20'),'Description':intUtil['getString'](_0x17624d[_0x4d83('0xe')],_0x2f6bb3,'\x0a')},getCustomFields(_0x389cbe,_0x2f6bb3));if(_0x58b986){if(_0x17624d['ticketType']===_0x4d83('0xf')){_0x429ccb['ActivityDate']=moment[_0x4d83('0x10')]();_0x429ccb[_0x4d83('0x11')]=![];_0x429ccb['IsRecurrence']=![];if(_0x58b986['endUserType']===_0x4d83('0x12')||_0x58b986[_0x4d83('0x13')]===_0x4d83('0x14')){_0x429ccb[_0x4d83('0x15')]=_0x58b986['id'];}else if(_0x58b986[_0x4d83('0x13')]==='account'){_0x429ccb[_0x4d83('0x16')]=_0x58b986['id'];}}else if(_0x17624d[_0x4d83('0x17')]==='Case'){if(_0x58b986[_0x4d83('0x13')]===_0x4d83('0x12')){_0x429ccb[_0x4d83('0x18')]=_0x58b986['id'];}else if(_0x58b986['endUserType']===_0x4d83('0x19')){_0x429ccb[_0x4d83('0x1a')]=_0x58b986['id'];}else if(_0x58b986[_0x4d83('0x13')]==='lead'&&_0x17624d[_0x4d83('0x1b')]){_0x429ccb[_0x17624d[_0x4d83('0x1b')]]=_0x58b986['id'];}else{logger['info'](_0x4d83('0x1c'));}}}return _0x12aee8[_0x4d83('0x1d')](_0x17624d[_0x4d83('0x17')])[_0x4d83('0x1e')](_0x429ccb);}function getUser(_0x3eb31e,_0x2144af,_0x3650db){if(!_[_0x4d83('0x1f')](_0x2144af)&&intUtil[_0x4d83('0x20')](_0x2144af)){var _0x255116={'Email':_0x2144af};var _0x4bbda0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3650db[_0x4d83('0x1d')](_0x4d83('0x21'))[_0x4d83('0x22')](_0x255116,_0x4bbda0)['execute']()[_0x4d83('0x23')](function(_0xbeffee){if(_0xbeffee[_0x4d83('0x24')]){var _0x2eeba2=_[_0x4d83('0x22')](_0xbeffee,function(_0x1a0e14){return _0x1a0e14[_0x4d83('0x25')]===_0x2144af;});if(_0x2eeba2){logger[_0x4d83('0x26')]('Agent\x20%s\x20found.',_0x2144af);return BPromise[_0x4d83('0x27')]({'id':_0x2eeba2['Id'],'name':_0x2eeba2['Name']});}}else{logger[_0x4d83('0x26')](_0x4d83('0x28'),_0x2144af);return _0x3650db[_0x4d83('0x29')]()[_0x4d83('0x23')](function(_0x53069d){return BPromise[_0x4d83('0x27')]({'id':_0x53069d[_0x4d83('0x2a')],'name':_0x53069d['display_name']});});}});}else{logger[_0x4d83('0x26')](_0x4d83('0x28'),_0x2144af);return _0x3650db['identity']()[_0x4d83('0x23')](function(_0x3c61df){return BPromise['resolve']({'id':_0x3c61df[_0x4d83('0x2a')],'name':_0x3c61df[_0x4d83('0x2b')]});});}}function getEndUser(_0x38fa00,_0x439449,_0x4acd50,_0xea5049,_0x338633){var _0x2268b6={'$or':{'Phone':_0xea5049}};var _0x568b4f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x4d83('0x23')](function(){logger['info'](_0x4d83('0x2c'),_0xea5049,_0x439449[_0x4d83('0x2d')]);switch(_0x439449[_0x4d83('0x2d')]){case _0x4d83('0x2e'):var _0x5eae83=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x30')]){var _0x3f5daa={};_0x3f5daa[_0x439449['additionalSearchContact']]=_0xea5049;_[_0x4d83('0x31')](_0x5eae83[_0x4d83('0x32')],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x33'))[_0x4d83('0x22')](_0x5eae83,_0x568b4f)[_0x4d83('0x34')]()['then'](function(_0x371047){if(_0x371047&&_0x371047[_0x4d83('0x24')]){return _0x371047;}else{var _0xe788aa=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449['additionalSearchLead']){var _0x534406={};_0x534406[_0x439449['additionalSearchLead']]=_0xea5049;_[_0x4d83('0x31')](_0xe788aa['$or'],_0x534406);}return _0x338633['sobject'](_0x4d83('0x35'))[_0x4d83('0x22')](_0xe788aa,_0x568b4f);}});case'account_contact_lead':var _0x59a683=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x36')]){var _0x3f5daa={};_0x3f5daa[_0x439449[_0x4d83('0x36')]]=_0xea5049;_[_0x4d83('0x31')](_0x59a683[_0x4d83('0x32')],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x37'))[_0x4d83('0x22')](_0x59a683,_0x568b4f)['execute']()[_0x4d83('0x23')](function(_0x5dfda1){if(_0x5dfda1&&_0x5dfda1['length']){return _0x5dfda1;}else{var _0x308b28=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x30')]){var _0x798d0e={};_0x798d0e[_0x439449['additionalSearchContact']]=_0xea5049;_['merge'](_0x308b28[_0x4d83('0x32')],_0x798d0e);}return _0x338633['sobject'](_0x4d83('0x33'))[_0x4d83('0x22')](_0x308b28,_0x568b4f)[_0x4d83('0x23')](function(_0x3893ed){if(_0x3893ed&&_0x3893ed[_0x4d83('0x24')]){return _0x3893ed;}else{var _0xaafb8c=_['cloneDeep'](_0x2268b6);if(_0x439449['additionalSearchLead']){var _0x480989={};_0x480989[_0x439449[_0x4d83('0x38')]]=_0xea5049;_[_0x4d83('0x31')](_0xaafb8c[_0x4d83('0x32')],_0x480989);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x35'))[_0x4d83('0x22')](_0xaafb8c,_0x568b4f);}});}});case _0x4d83('0x12'):var _0x5eae83=_[_0x4d83('0x2f')](_0x2268b6);if(_0x439449[_0x4d83('0x30')]){var _0x3f5daa={};_0x3f5daa[_0x439449[_0x4d83('0x30')]]=_0xea5049;_[_0x4d83('0x31')](_0x5eae83['$or'],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')](_0x4d83('0x33'))[_0x4d83('0x22')](_0x5eae83,_0x568b4f)[_0x4d83('0x34')]();case _0x4d83('0x14'):var _0x57569d=_['cloneDeep'](_0x2268b6);if(_0x439449[_0x4d83('0x38')]){var _0x3f5daa={};_0x3f5daa[_0x439449[_0x4d83('0x38')]]=_0xea5049;_[_0x4d83('0x31')](_0x57569d['$or'],_0x3f5daa);}return _0x338633['sobject']('Lead')[_0x4d83('0x22')](_0x57569d,_0x568b4f);case _0x4d83('0x19'):var _0x59a683=_['cloneDeep'](_0x2268b6);if(_0x439449[_0x4d83('0x36')]){var _0x3f5daa={};_0x3f5daa[_0x439449['additionalSearchAccount']]=_0xea5049;_[_0x4d83('0x31')](_0x59a683[_0x4d83('0x32')],_0x3f5daa);}return _0x338633[_0x4d83('0x1d')]('Account')[_0x4d83('0x22')](_0x59a683,_0x568b4f);default:return null;}})[_0x4d83('0x23')](function(_0x55beae){if(_0x55beae&&_0x55beae[_0x4d83('0x24')]){var _0xb9e012=_['first'](_0x55beae);if(_0xb9e012){return BPromise[_0x4d83('0x27')]({'id':_0xb9e012['Id'],'name':_0xb9e012['Name'],'phone':_0xb9e012[_0x4d83('0x39')],'endUserType':_0xb9e012[_0x4d83('0x3a')]['type']['toLowerCase']()});}}})['then'](function(_0x2e8cac){if(_0x2e8cac){logger[_0x4d83('0x26')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x2e8cac['endUserType'],_0xea5049);return BPromise[_0x4d83('0x27')](_0x2e8cac);}else{logger[_0x4d83('0x26')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xea5049);var _0x4fc233={'Phone':_0xea5049};if(_0x439449[_0x4d83('0x3b')]){if(_0x439449[_0x4d83('0x3b')]==='contact'){logger['info'](_0x4d83('0x3c'),_0xea5049,_0x439449[_0x4d83('0x3b')]);_0x4fc233[_0x4d83('0x3d')]=_0x4acd50!==''?_0x4acd50:util[_0x4d83('0x3e')](_0x4d83('0x3f'),_0xea5049);}else if(_0x439449[_0x4d83('0x3b')]===_0x4d83('0x14')){logger['info'](_0x4d83('0x3c'),_0xea5049,_0x439449[_0x4d83('0x3b')]);_0x4fc233[_0x4d83('0x3d')]=_0x4acd50!==_0x4d83('0x40')?_0x4acd50:util[_0x4d83('0x3e')]('Caller\x20-\x20%s',_0xea5049);_0x4fc233[_0x4d83('0x41')]=_0x4d83('0x42');}else if(_0x439449['moduleCreate']===_0x4d83('0x19')){logger[_0x4d83('0x26')](_0x4d83('0x3c'),_0xea5049,_0x439449[_0x4d83('0x3b')]);_0x4fc233['Name']=_0x4acd50!==_0x4d83('0x40')?_0x4acd50:util[_0x4d83('0x3e')](_0x4d83('0x3f'),_0xea5049);}else{return null;}}return _0x338633[_0x4d83('0x1d')](_['upperFirst'](_0x439449[_0x4d83('0x3b')]))[_0x4d83('0x1e')](_0x4fc233)[_0x4d83('0x23')](function(_0x458ed1){return BPromise[_0x4d83('0x27')]({'id':_0x458ed1['id'],'endUserType':_0x439449[_0x4d83('0x3b')]});});}});}function getCustomFields(_0x2b5850,_0x14a31d){var _0x3f4142={};if(_0x2b5850[_0x4d83('0x24')]>0x0){_[_0x4d83('0x43')](_0x2b5850,function(_0x4bd0de){if(_[_0x4d83('0x44')]([_0x4d83('0x45'),'picklist'],_0x4bd0de[_0x4d83('0x46')])&&_0x4bd0de['idField']){_0x3f4142[_0x4bd0de[_0x4d83('0x47')]]=_0x4bd0de[_0x4d83('0x48')][_0x4d83('0x49')]();}else if(_0x4bd0de[_0x4d83('0x46')]===_0x4d83('0x4a')&&_0x4bd0de[_0x4d83('0x4b')]&&_0x4bd0de[_0x4d83('0x47')]){_0x14a31d[_0x4bd0de[_0x4d83('0x4b')]]&&(_0x3f4142[_0x4bd0de[_0x4d83('0x47')]]=_0x14a31d[_0x4bd0de[_0x4d83('0x4b')]][_0x4d83('0x49')]());}else if(_0x4bd0de[_0x4d83('0x46')]===_0x4d83('0x4c')&&_0x4bd0de['Variable']&&_0x4bd0de['Variable'][_0x4d83('0x4d')]&&_0x4bd0de[_0x4d83('0x47')]){_0x14a31d[_0x4bd0de[_0x4d83('0x4e')][_0x4d83('0x4d')][_0x4d83('0x4f')]()]&&(_0x3f4142[_0x4bd0de[_0x4d83('0x47')]]=_0x14a31d[_0x4bd0de[_0x4d83('0x4e')][_0x4d83('0x4d')]['toLowerCase']()][_0x4d83('0x49')]());}});}return _0x3f4142;}function getConnection(_0xabf9bf){var _0x174ec1=_0xabf9bf[_0x4d83('0x50')][_0x4d83('0x51')](_0xabf9bf[_0x4d83('0x52')]);var _0x2ed382=new jsforce['Connection']({'oauth2':{'loginUrl':_0xabf9bf['remoteUri']||_0x4d83('0x53'),'clientId':_0xabf9bf['clientId'],'clientSecret':_0xabf9bf[_0x4d83('0x54')]}});return _0x2ed382[_0x4d83('0x55')](_0xabf9bf[_0x4d83('0x56')],_0x174ec1)[_0x4d83('0x23')](function(){logger['info'](_0x4d83('0x57'));return _0x2ed382;});}exports[_0x4d83('0x58')]=function(_0x3afc48,_0x3238fb,_0x433771,_0x23f06b,_0x53bd7d,_0x40cd2a){var _0x128cce,_0x5ca195,_0xc677df,_0x30149f;_0x40cd2a[_0x4d83('0x59')]=intUtil[_0x4d83('0x5a')](_0x40cd2a[_0x4d83('0x59')]);_0x40cd2a[_0x4d83('0x5b')]=intUtil[_0x4d83('0x5a')](_0x40cd2a['remoteUri']);if(_0x53bd7d&&_0x53bd7d[_0x4d83('0x5c')]){logger['info'](_0x4d83('0x5d'),_0x4d83('0x5e'));_0x3238fb[_0x4d83('0x5f')]=util[_0x4d83('0x3e')](_0x4d83('0x60'),_0x40cd2a[_0x4d83('0x59')],_0x3238fb['uniqueid'],md5(_0x3238fb[_0x4d83('0x61')]));}else{_0x3238fb[_0x4d83('0x5f')]='';}return getConnection(_0x40cd2a)[_0x4d83('0x23')](function(_0x1b24ab){_0x30149f=_0x1b24ab;return getUser(_0x40cd2a,_0x23f06b[_0x4d83('0x62')],_0x30149f);})[_0x4d83('0x23')](function(_0x1d17df){_0x128cce=_0x1d17df;return getEndUser(_0x40cd2a,_0x433771,_0x3238fb['calleridname'],_0x3238fb['calleridnum'],_0x30149f);})['then'](function(_0x59bce3){_0x5ca195=_0x59bce3;return getTicket(_0x40cd2a,_0x128cce,_0x5ca195,_0x433771,_0x3238fb,_0x433771[_0x4d83('0x63')],_0x30149f,_0x4d83('0x58'));})[_0x4d83('0x23')](function(_0x418118){_0xc677df=_0x418118;logger['info'](_0x4d83('0x64'),_0xc677df['id']);logger[_0x4d83('0x26')](_0x4d83('0x65'),_0xc677df['id'],_0x23f06b[_0x4d83('0x4d')],_0x40cd2a['type']);switch(_0x40cd2a[_0x4d83('0x46')]){case'integrationTab':emit(util['format']('user:%s',_0x23f06b[_0x4d83('0x4d')]),_0x4d83('0x66'),{'recordId':_0xc677df['id']});break;case _0x4d83('0x67'):emit(util[_0x4d83('0x3e')](_0x4d83('0x68'),_0x23f06b['name']),'trigger:browser:url',{'uri':util[_0x4d83('0x3e')](_0x4d83('0x69'),_0x30149f[_0x4d83('0x6a')],_0xc677df['id'])});break;default:logger[_0x4d83('0x6b')](_0x4d83('0x6c'));}})[_0x4d83('0x6d')](function(_0x31bed5){logger[_0x4d83('0x6b')](_0x4d83('0x5d'),_0x31bed5);});};exports[_0x4d83('0x6e')]=function(_0x17e11a,_0x4314e9,_0x45ee87,_0xcc773d,_0x40daed,_0x4f2eba,_0x28105e){var _0x49c49a,_0x5081a8,_0x48b9d0,_0x2309d7;_0x4f2eba['serverUrl']=intUtil[_0x4d83('0x5a')](_0x4f2eba[_0x4d83('0x59')]);_0x4f2eba[_0x4d83('0x5b')]=intUtil['stripTrailingSlash'](_0x4f2eba['remoteUri']);if(_0x28105e&&_0x28105e[_0x4d83('0x6f')]&&_0x28105e[_0x4d83('0x6f')]!==_0x4d83('0x70')){logger[_0x4d83('0x26')](_0x4d83('0x71'),_0x4d83('0x5e'));_0x4314e9['recordingURL']=util[_0x4d83('0x3e')](_0x4d83('0x60'),_0x4f2eba[_0x4d83('0x59')],_0x4314e9['uniqueid'],md5(_0x4314e9[_0x4d83('0x61')]));}return getConnection(_0x4f2eba)[_0x4d83('0x23')](function(_0x23db53){_0x2309d7=_0x23db53;return getUser(_0x4f2eba,_0xcc773d[_0x4d83('0x62')],_0x2309d7);})['then'](function(_0x13af01){_0x49c49a=_0x13af01;return getEndUser(_0x4f2eba,_0x45ee87,_0x4314e9[_0x4d83('0x72')],_0x4314e9[_0x4d83('0x73')],_0x2309d7);})[_0x4d83('0x23')](function(_0x235b39){_0x5081a8=_0x235b39;return getTicket(_0x4f2eba,_0x49c49a,_0x5081a8,_0x45ee87,_0x4314e9,_0x45ee87[_0x4d83('0x63')],_0x2309d7,_0x4d83('0x6e'));})[_0x4d83('0x23')](function(_0x508420){_0x48b9d0=_0x508420;logger[_0x4d83('0x26')](_0x4d83('0x74'),_0x48b9d0['id']);logger[_0x4d83('0x26')](_0x4d83('0x75'),_0x48b9d0['id'],_0xcc773d[_0x4d83('0x4d')],_0x4f2eba[_0x4d83('0x46')]);switch(_0x4f2eba[_0x4d83('0x46')]){case'integrationTab':emit(util['format'](_0x4d83('0x68'),_0xcc773d[_0x4d83('0x4d')]),'trigger:salesforce:display',{'recordId':_0x48b9d0['id']});break;case _0x4d83('0x67'):emit(util['format'](_0x4d83('0x68'),_0xcc773d[_0x4d83('0x4d')]),_0x4d83('0x76'),{'uri':util['format'](_0x4d83('0x69'),_0x2309d7[_0x4d83('0x6a')],_0x48b9d0['id'])});break;default:logger[_0x4d83('0x6b')](_0x4d83('0x71'),_0x4d83('0x77'));}})[_0x4d83('0x6d')](function(_0x1dea34){logger[_0x4d83('0x6b')](_0x4d83('0x71'),_0x1dea34);});};exports[_0x4d83('0x78')]=function(_0x5e806d,_0x4f4aae,_0x3fa754,_0x14c97f,_0x50370e,_0x2d5c42){var _0x2f41ae,_0x1cdf09,_0x2d87ae,_0x3cffdb;_0x2d5c42[_0x4d83('0x59')]=intUtil[_0x4d83('0x5a')](_0x2d5c42[_0x4d83('0x59')]);_0x2d5c42[_0x4d83('0x5b')]=intUtil[_0x4d83('0x5a')](_0x2d5c42[_0x4d83('0x5b')]);if(_0x50370e&&_0x50370e[_0x4d83('0x5c')]){logger['info']('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+']',_0x4d83('0x5e'));_0x4f4aae[_0x4d83('0x5f')]=util['format'](_0x4d83('0x60'),_0x2d5c42[_0x4d83('0x59')],_0x4f4aae[_0x4d83('0x61')],md5(_0x4f4aae[_0x4d83('0x61')]));}else{_0x4f4aae[_0x4d83('0x5f')]='';}return getConnection(_0x2d5c42)[_0x4d83('0x23')](function(_0x5649f7){_0x3cffdb=_0x5649f7;if(!_['isNil'](_0x14c97f)){return getUser(_0x2d5c42,_0x14c97f['name'],_0x3cffdb);}else{return getUser(_0x2d5c42,null,_0x3cffdb);}})[_0x4d83('0x23')](function(_0x48ca2b){_0x2f41ae=_0x48ca2b;return getEndUser(_0x2d5c42,_0x3fa754,_0x4f4aae[_0x4d83('0x7b')],_0x4f4aae['calleridnum'],_0x3cffdb);})['then'](function(_0x4bf117){_0x1cdf09=_0x4bf117;return getTicket(_0x2d5c42,_0x2f41ae,_0x1cdf09,_0x3fa754,_0x4f4aae,_0x3fa754[_0x4d83('0x63')],_0x3cffdb);})[_0x4d83('0x23')](function(_0x360d8f){_0x2d87ae=_0x360d8f;logger[_0x4d83('0x26')]('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x2d87ae['id']);logger[_0x4d83('0x26')]('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+_0x4d83('0x7c'),_0x2d5c42[_0x4d83('0x46')]);})['catch'](function(_0x46876e){logger[_0x4d83('0x6b')]('['+_0x4f4aae[_0x4d83('0x79')][_0x4d83('0x7a')]()+']',_0x46876e);});}; \ 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 a757bf4..6b8e9e2 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 _0x23a0=['sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','then','result','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','variable','variableName','idField','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','username','sysparm_limit=1'];(function(_0x189939,_0x14343d){var _0x55ff09=function(_0xa7f1cc){while(--_0xa7f1cc){_0x189939['push'](_0x189939['shift']());}};_0x55ff09(++_0x14343d);}(_0x23a0,0x157));var _0x023a=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x23a0[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0x023a('0x0'));var Promise=require(_0x023a('0x1'));var rp=require(_0x023a('0x2'));var util=require(_0x023a('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x023a('0x4'));var config=require(_0x023a('0x5'));var logger=require(_0x023a('0x6'))(_0x023a('0x7'));config[_0x023a('0x8')]=_['defaults'](config['redis'],{'host':_0x023a('0x9'),'port':0x18eb});var io=require(_0x023a('0xa'))(new Redis(config[_0x023a('0x8')]));function getAdminUser(_0x2922ae,_0x486f4e,_0x154550,_0xd79dc4,_0x2876b7,_0x3b1e40){return new Promise(function(_0x3d1a44,_0x30da46){var _0x50bcb3={'method':_0x023a('0xb'),'uri':_0xd79dc4+_0x023a('0xc')+'&'+_0x2876b7+'&'+_0x3b1e40,'auth':_0x486f4e,'json':!![]};return rp(_0x50bcb3)['then'](function(_0x2b0d9f){if(_0x2b0d9f['result'][_0x023a('0xd')]>0x0){_0x154550[_0x023a('0xe')]=_0x2b0d9f['result'][0x0][_0x023a('0xf')];}logger[_0x023a('0x10')]('['+[_0x2922ae[_0x023a('0x11')]()]+_0x023a('0x12'),_0x154550);_0x3d1a44(_0x154550);})['catch'](function(_0x3e0699){logger[_0x023a('0x13')]('['+[_0x2922ae[_0x023a('0x11')]()]+']',_0x3e0699[_0x023a('0x14')]);_0x30da46(_0x3e0699[_0x023a('0x14')]);});});}function getUser(_0x15b7fc,_0x3c91ab,_0x1ddc84,_0x3c50cd,_0x42d3a2){return function(_0xc0388e){logger[_0x023a('0x10')]('['+[_0x15b7fc['toUpperCase']()]+_0x023a('0x15'),_0xc0388e);return new Promise(function(_0x2cdaa0,_0x57d843){if(intUtil[_0x023a('0x16')](_0xc0388e['userEmail'])){var _0x23d21c={'method':_0x023a('0xb'),'uri':_0x1ddc84+_0x023a('0x17')+_0xc0388e[_0x023a('0x18')]+'&'+_0x3c50cd+'&'+_0x42d3a2,'auth':_0x3c91ab,'json':!![]};logger[_0x023a('0x10')]('['+[_0x15b7fc[_0x023a('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x23d21c);return rp(_0x23d21c)[_0x023a('0x19')](function(_0x30a6a1){logger[_0x023a('0x10')]('['+[_0x15b7fc['toUpperCase']()]+'],\x20getUser\x20entity',_0x30a6a1);if(_0x30a6a1[_0x023a('0x1a')]['length']>0x0&&String(_0x30a6a1['result'][0x0][_0x023a('0x1b')])===_0x023a('0x1c')){_0xc0388e[_0x023a('0x1d')]=_0x30a6a1[_0x023a('0x1a')][0x0][_0x023a('0xf')];}else{_0xc0388e[_0x023a('0x1d')]=_0xc0388e[_0x023a('0xe')];_0xc0388e['userEmail']=_0xc0388e[_0x023a('0x1e')];}logger['info']('['+[_0x15b7fc[_0x023a('0x11')]()]+_0x023a('0x1f'),_0xc0388e);_0x2cdaa0(_0xc0388e);})[_0x023a('0x20')](function(_0x254bb3){logger[_0x023a('0x13')]('['+[_0x15b7fc[_0x023a('0x11')]()]+']',_0x254bb3[_0x023a('0x14')]);_0x57d843(_0x254bb3[_0x023a('0x14')]);});}else{logger[_0x023a('0x10')]('['+[_0x15b7fc['toUpperCase']()]+_0x023a('0x21'));_0xc0388e['userId']=_0xc0388e[_0x023a('0xe')];_0xc0388e['userEmail']=_0xc0388e[_0x023a('0x1e')];_0x2cdaa0(_0xc0388e);}});};}function createEndUser(_0x5844e7,_0x33e70d,_0x4ed56c,_0x5b7837,_0x40390c){logger[_0x023a('0x10')]('['+[_0x5844e7['toUpperCase']()]+_0x023a('0x22'),_0x4ed56c);return new Promise(function(_0x5a02b7,_0x15d292){var _0x3724ee={'method':_0x023a('0x23'),'uri':_0x5b7837+_0x023a('0x24')+_0x40390c,'body':{'user_name':_0x4ed56c['endUserNumber'],'roles':_0x023a('0x25'),'first_name':_0x4ed56c[_0x023a('0x26')],'active':_0x023a('0x1c'),'date_format':_0x023a('0x27'),'phone':_0x4ed56c[_0x023a('0x26')]},'auth':_0x33e70d,'json':!![]};return rp(_0x3724ee)['then'](function(_0x1addb1){logger['info']('['+[_0x5844e7[_0x023a('0x11')]()]+_0x023a('0x28'),_0x1addb1[_0x023a('0x1a')]);_0x4ed56c[_0x023a('0x29')]=_0x1addb1['result']['sys_id'];_0x5a02b7(_0x4ed56c);})[_0x023a('0x20')](function(_0x268a5c){logger['error']('['+[_0x5844e7[_0x023a('0x11')]()]+']',_0x268a5c['message']);_0x15d292(_0x268a5c[_0x023a('0x14')]);});});}function getEndUser(_0x416065,_0x26b32e,_0x4242bf,_0x42a8b5,_0x48b8a0){return function(_0x378453){logger[_0x023a('0x10')]('['+[_0x416065[_0x023a('0x11')]()]+_0x023a('0x2a'),_0x378453);return new Promise(function(_0x357005,_0x186fd3){var _0x4704e0={'method':_0x023a('0xb'),'uri':_0x4242bf+_0x023a('0x2b')+_0x378453['endUserNumber']+'&'+_0x42a8b5+'&'+_0x48b8a0,'auth':_0x26b32e,'json':!![]};return rp(_0x4704e0)[_0x023a('0x19')](function(_0xd005e5){if(_0xd005e5[_0x023a('0x1a')][_0x023a('0xd')]>0x0){_0x378453['endUserId']=_0xd005e5[_0x023a('0x1a')][0x0][_0x023a('0xf')];logger[_0x023a('0x10')]('['+[_0x416065['toUpperCase']()]+_0x023a('0x2c'),_0x378453);_0x357005(_0x378453);}else{return createEndUser(_0x416065,_0x26b32e,_0x378453,_0x4242bf,_0x42a8b5)[_0x023a('0x19')](function(_0x15d568){logger[_0x023a('0x10')]('['+[_0x416065[_0x023a('0x11')]()]+'],\x20createEndUser\x20crm',_0x15d568);_0x357005(_0x15d568);});}})[_0x023a('0x20')](function(_0x4e011c){logger[_0x023a('0x13')]('['+[_0x416065[_0x023a('0x11')]()]+']',_0x4e011c[_0x023a('0x14')]);_0x186fd3(_0x4e011c['message']);});});};}function getCustomFields(_0x282d48,_0x252064){var _0x31977f={};if(_0x282d48['length']>0x0){_[_0x023a('0x2d')](_0x282d48,function(_0x2b7eec){if(_[_0x023a('0x2e')](['string',_0x023a('0x2f')],_0x2b7eec[_0x023a('0x30')])&&_0x2b7eec[_0x023a('0x31')]&&!_0x2b7eec[_0x023a('0x32')]){_0x31977f[_0x2b7eec[_0x023a('0x31')][_0x023a('0x33')]()]=_0x2b7eec[_0x023a('0x34')][_0x023a('0x35')]();}else if(_[_0x023a('0x2e')]([_0x023a('0x36'),'picklist'],_0x2b7eec[_0x023a('0x30')])&&_0x2b7eec['idField']&&_0x2b7eec['customField']){_0x31977f[_0x2b7eec['idField'][_0x023a('0x33')]()]=_0x2b7eec['content'][_0x023a('0x35')]();}else if(_0x2b7eec[_0x023a('0x30')]===_0x023a('0x37')&&_0x2b7eec[_0x023a('0x38')]&&_0x2b7eec[_0x023a('0x39')]&&_0x2b7eec[_0x023a('0x32')]){_0x31977f[_0x2b7eec[_0x023a('0x39')]['toLowerCase']()]=_0x252064[_0x2b7eec['variableName']]['toString']();}else if(_0x2b7eec[_0x023a('0x30')]==='customVariable'&&_0x2b7eec[_0x023a('0x3a')]&&_0x2b7eec['Variable'][_0x023a('0x3b')]&&_0x2b7eec[_0x023a('0x39')]&&_0x2b7eec['customField']){_0x31977f[_0x2b7eec[_0x023a('0x39')]['toLowerCase']()]=_0x252064[_0x2b7eec[_0x023a('0x3a')][_0x023a('0x3b')][_0x023a('0x33')]()][_0x023a('0x35')]();}});}return _0x31977f;}function getTicket(_0x202d46,_0xeb0304,_0x726ff2,_0x195a82,_0x3740d4,_0x2aa69e){return function(_0xc9ebc6){logger[_0x023a('0x10')]('['+[_0x202d46['toUpperCase']()]+_0x023a('0x3c'),_0xc9ebc6);return new Promise(function(_0x3c4da3,_0x3fbada){var _0xd45469=_0x202d46[_0x023a('0x33')]()==='outbound'?_0xc9ebc6[_0x023a('0x1d')]:_0xc9ebc6['endUserId'];var _0x16011d={'method':_0x023a('0x23'),'uri':_0x726ff2+_0x023a('0x3d')+'?'+_0x2aa69e,'body':Object[_0x023a('0x3e')]({},{'active':_0x023a('0x1c'),'caller_id':_0xd45469,'assigned_to':_0xc9ebc6[_0x023a('0x1d')],'short_description':intUtil[_0x023a('0x3f')](_0x195a82['Subjects'],_0x3740d4,'\x20'),'description':intUtil[_0x023a('0x3f')](_0x195a82[_0x023a('0x40')],_0x3740d4,'\x0a')},getCustomFields(_0x195a82[_0x023a('0x41')],_0x3740d4)),'auth':_0xeb0304,'json':!![]};return rp(_0x16011d)[_0x023a('0x19')](function(_0x105e48){logger['info']('['+[_0x202d46[_0x023a('0x11')]()]+_0x023a('0x42'),_0x105e48[_0x023a('0x1a')]);_0xc9ebc6[_0x023a('0x43')]=_0x105e48[_0x023a('0x1a')][_0x023a('0xf')];_0xc9ebc6[_0x023a('0x44')]=_0x105e48[_0x023a('0x1a')][_0x023a('0x45')];logger['info']('['+[_0x202d46['toUpperCase']()]+_0x023a('0x46'),_0xc9ebc6);_0x3c4da3(_0xc9ebc6);})[_0x023a('0x20')](function(_0x4d2207){logger['error']('['+[_0x202d46[_0x023a('0x11')]()]+']',_0x4d2207[_0x023a('0x14')]);_0x3fbada(_0x4d2207[_0x023a('0x14')]);});});};}function createRemoteTag(_0x541c1a,_0x38da21,_0x103280,_0x3aa419){return new Promise(function(_0x1c727e,_0x3fc860){var _0xfeaf36={'method':_0x023a('0x23'),'uri':_0x103280+_0x023a('0x47')+'?'+_0x3aa419,'body':{'short_description':_0x541c1a,'global':!![],'active':!![],'name':_0x541c1a},'auth':_0x38da21,'json':!![]};return rp(_0xfeaf36)[_0x023a('0x19')](function(_0x193f47){var _0x46f003=_0x193f47[_0x023a('0x1a')][_0x023a('0xf')];_0x1c727e(_0x46f003);});});}function getRemoteTag(_0x40e5f2,_0x211a26,_0x361cc0,_0x2f649a,_0x478e7c){return new Promise(function(_0xaedcee,_0x3d30a6){var _0x202f6b={'method':_0x023a('0xb'),'uri':_0x361cc0+_0x023a('0x47')+_0x023a('0x48')+_0x40e5f2+'&'+_0x2f649a,'auth':_0x211a26,'json':!![]};return rp(_0x202f6b)[_0x023a('0x19')](function(_0x1b561d){if(_0x1b561d[_0x023a('0x1a')][_0x023a('0xd')]>0x0){var _0x1561a4=_0x1b561d[_0x023a('0x1a')][0x0][_0x023a('0xf')];_0xaedcee(_0x1561a4);}else{return createRemoteTag(_0x40e5f2,_0x211a26,_0x361cc0,_0x2f649a)[_0x023a('0x19')](function(_0x4f0288){_0xaedcee(_0x4f0288);});}});});}function assignTagToIncident(_0xc9129a,_0x19805d,_0x537071,_0x3c999c,_0x514963){return new Promise(function(_0x513584,_0x7bddb0){var _0x30de9c={'method':_0x023a('0x23'),'uri':_0x537071+_0x023a('0x49')+'?'+_0x514963,'body':{'label':_0xc9129a,'table':_0x023a('0x3d'),'id_type':'Incident','table_key':_0x3c999c['ticketId'],'title':_0x023a('0x4a')+_0x3c999c[_0x023a('0x44')],'id_display':_0x3c999c[_0x023a('0x44')]},'auth':_0x19805d,'json':!![]};return rp(_0x30de9c)[_0x023a('0x19')](function(_0x527a0f){_0x513584();})[_0x023a('0x20')](function(){_0x513584();});});}function manageTags(_0x3e24eb,_0x98a0cf,_0x51fa11,_0xa78b88,_0x77901a,_0x103fe3,_0xd150b1){return new Promise(function(_0x24189b,_0x489a7e){var _0x1ec69b=[];_0x98a0cf[_0x023a('0x2d')](function(_0x3f12fd){_0x1ec69b['push'](getRemoteTag(_0x3f12fd,_0x51fa11,_0xa78b88,_0x103fe3,_0xd150b1));});return Promise['all'](_0x1ec69b)[_0x023a('0x19')](function(_0x5c5608){if(_0x5c5608['length']){logger[_0x023a('0x10')]('['+[_0x3e24eb[_0x023a('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5c5608);var _0x9792e4=[];_0x5c5608[_0x023a('0x2d')](function(_0x597b34){_0x9792e4[_0x023a('0x4b')](assignTagToIncident(_0x597b34,_0x51fa11,_0xa78b88,_0x77901a,_0x103fe3));});return Promise[_0x023a('0x4c')](_0x9792e4)[_0x023a('0x19')](function(){_0x24189b();})[_0x023a('0x20')](function(){_0x24189b();});}else{_0x24189b();}});});}function getTags(_0x168ef7,_0x4de492,_0x6914b4,_0x198291,_0x317b09,_0x15b127){return function(_0x33df10){return new Promise(function(_0x4a9b58,_0x4e7c31){var _0x2f984c=[];var _0x200293=_0x198291['Tags'];if(_0x200293&&_0x200293[_0x023a('0xd')]>0x0){_0x2f984c=_['map'](_0x200293,_0x023a('0x3b'));}if(_0x2f984c[_0x023a('0xd')]>0x0){return manageTags(_0x168ef7,_0x2f984c,_0x4de492,_0x6914b4,_0x33df10,_0x317b09,_0x15b127)[_0x023a('0x19')](function(){_0x4a9b58(_0x33df10);});}else{_0x4a9b58(_0x33df10);}});};}function emit(_0xda1e1f,_0x11218b,_0x35e91b){var _0x5702ee=_0x023a('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x023a('0x4e')+_0x023a('0x4f');var _0x1f4c3b={'uri':_0xda1e1f+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x35e91b+_0x5702ee};io['to'](util[_0x023a('0x50')](_0x023a('0x51'),_0x11218b))[_0x023a('0x52')]('trigger:browser:url',_0x1f4c3b);}exports['cs']=function(_0x455ffc,_0x442d9a,_0x2f38b4,_0x16ee70,_0x18d75c,_0x24e3a0,_0x4a4d46,_0x20d60a){var _0x2cabbe={};var _0x1b147f={'user':_0x24e3a0[_0x023a('0x53')],'pass':_0x24e3a0['password']};var _0x321ac0=_0x023a('0x54');var _0x134f1f=_0x023a('0x55');_0x24e3a0[_0x023a('0x56')]=intUtil['stripTrailingSlash'](_0x24e3a0[_0x023a('0x56')]);_0x24e3a0[_0x023a('0x57')]=intUtil[_0x023a('0x58')](_0x24e3a0[_0x023a('0x57')]);var _0x3cf534=util['format']('%s/api/now/table/',_0x24e3a0['remoteUri']);_0x2cabbe[_0x023a('0x18')]=!_[_0x023a('0x59')](_0x16ee70)?_0x16ee70[_0x023a('0x5a')]:null;_0x2cabbe['adminEmail']=_0x24e3a0['email'];_0x2cabbe[_0x023a('0x26')]=_0x20d60a[_0x023a('0x33')]()===_0x023a('0x5b')?_0x442d9a[_0x023a('0x5c')]:_0x442d9a[_0x023a('0x5d')];_0x2cabbe[_0x023a('0x5e')]=_0x20d60a==='queue'||_0x20d60a===_0x023a('0x5f')?'queue':_0x023a('0x5b');var _0x3e45a5=util[_0x023a('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24e3a0[_0x023a('0x57')],_0x442d9a[_0x023a('0x60')],md5(_0x442d9a[_0x023a('0x60')]));if(_0x18d75c&&_0x18d75c[_0x023a('0x61')]){logger['info'](_0x023a('0x62'),'Recording\x20is\x20enabled!');_0x442d9a[_0x023a('0x63')]=_0x3e45a5;}else if(_0x4a4d46&&_0x4a4d46[_0x023a('0x64')]&&_0x4a4d46['recordingFormat']!=='none'){logger['info'](_0x023a('0x65'),_0x023a('0x66'));_0x442d9a['recordingURL']=_0x3e45a5;}else{_0x442d9a[_0x023a('0x63')]='';}return getAdminUser(_0x20d60a,_0x1b147f,_0x2cabbe,_0x3cf534,_0x134f1f,_0x321ac0)[_0x023a('0x19')](getUser(_0x20d60a,_0x1b147f,_0x3cf534,_0x134f1f,_0x321ac0))[_0x023a('0x19')](getEndUser(_0x20d60a,_0x1b147f,_0x3cf534,_0x134f1f,_0x321ac0))['then'](getTicket(_0x20d60a,_0x1b147f,_0x3cf534,_0x2f38b4,_0x442d9a,_0x134f1f))[_0x023a('0x19')](function(_0x3a0c50){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3a0c50[_0x023a('0x43')]));logger['info'](util[_0x023a('0x50')](_0x023a('0x67'),_0x20d60a));if(_0x20d60a!==_0x023a('0x5f')){logger[_0x023a('0x10')]('['+[_0x20d60a[_0x023a('0x11')]()]+']',_0x023a('0x68'));emit(_0x24e3a0[_0x023a('0x56')],_0x16ee70['name'],_0x3a0c50[_0x023a('0x43')]);}})[_0x023a('0x20')](function(_0xfa120f){logger[_0x023a('0x13')]('['+[_0x20d60a[_0x023a('0x11')]()]+_0x023a('0x69'),util[_0x023a('0x6a')](_0xfa120f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb3c1=['sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','content','toString','string','idField','customField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0xb3c1,0xb5));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var Promise=require(_0x1b3c('0x1'));var rp=require(_0x1b3c('0x2'));var util=require(_0x1b3c('0x3'));var md5=require(_0x1b3c('0x4'));var Redis=require(_0x1b3c('0x5'));var intUtil=require(_0x1b3c('0x6'));var config=require(_0x1b3c('0x7'));var logger=require('../../../../config/logger')(_0x1b3c('0x8'));config[_0x1b3c('0x9')]=_['defaults'](config[_0x1b3c('0x9')],{'host':_0x1b3c('0xa'),'port':0x18eb});var io=require(_0x1b3c('0xb'))(new Redis(config['redis']));function getAdminUser(_0x3a3ef6,_0x45bc8e,_0x2a41c9,_0x287c85,_0x3b1920,_0x2ca6b0){return new Promise(function(_0x118ad9,_0x5e944){var _0xb7018e={'method':'GET','uri':_0x287c85+_0x1b3c('0xc')+'&'+_0x3b1920+'&'+_0x2ca6b0,'auth':_0x45bc8e,'json':!![]};return rp(_0xb7018e)['then'](function(_0x124613){if(_0x124613[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0){_0x2a41c9[_0x1b3c('0xf')]=_0x124613[_0x1b3c('0xd')][0x0][_0x1b3c('0x10')];}logger[_0x1b3c('0x11')]('['+[_0x3a3ef6[_0x1b3c('0x12')]()]+_0x1b3c('0x13'),_0x2a41c9);_0x118ad9(_0x2a41c9);})[_0x1b3c('0x14')](function(_0x526047){logger[_0x1b3c('0x15')]('['+[_0x3a3ef6['toUpperCase']()]+']',_0x526047['message']);_0x5e944(_0x526047[_0x1b3c('0x16')]);});});}function getUser(_0x17ff85,_0x3743d8,_0x202b6f,_0x1b91a6,_0x253dd2){return function(_0x4d7726){logger['info']('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x17'),_0x4d7726);return new Promise(function(_0x4072f8,_0x2c3f16){if(intUtil[_0x1b3c('0x18')](_0x4d7726[_0x1b3c('0x19')])){var _0x5de931={'method':'GET','uri':_0x202b6f+_0x1b3c('0x1a')+_0x4d7726['userEmail']+'&'+_0x1b91a6+'&'+_0x253dd2,'auth':_0x3743d8,'json':!![]};logger['info']('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x1b'),_0x5de931);return rp(_0x5de931)[_0x1b3c('0x1c')](function(_0x4f8d57){logger['info']('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x1d'),_0x4f8d57);if(_0x4f8d57[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0&&String(_0x4f8d57['result'][0x0]['active'])===_0x1b3c('0x1e')){_0x4d7726[_0x1b3c('0x1f')]=_0x4f8d57[_0x1b3c('0xd')][0x0][_0x1b3c('0x10')];}else{_0x4d7726[_0x1b3c('0x1f')]=_0x4d7726['adminId'];_0x4d7726['userEmail']=_0x4d7726[_0x1b3c('0x20')];}logger[_0x1b3c('0x11')]('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x21'),_0x4d7726);_0x4072f8(_0x4d7726);})[_0x1b3c('0x14')](function(_0x201f9f){logger[_0x1b3c('0x15')]('['+[_0x17ff85[_0x1b3c('0x12')]()]+']',_0x201f9f['message']);_0x2c3f16(_0x201f9f[_0x1b3c('0x16')]);});}else{logger[_0x1b3c('0x11')]('['+[_0x17ff85[_0x1b3c('0x12')]()]+_0x1b3c('0x22'));_0x4d7726['userId']=_0x4d7726['adminId'];_0x4d7726[_0x1b3c('0x19')]=_0x4d7726[_0x1b3c('0x20')];_0x4072f8(_0x4d7726);}});};}function createEndUser(_0x504a3d,_0x5e91dd,_0x2e7807,_0x560c0f,_0x545af4){logger[_0x1b3c('0x11')]('['+[_0x504a3d[_0x1b3c('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x2e7807);return new Promise(function(_0x4a5909,_0x1b1145){var _0xe61023={'method':'POST','uri':_0x560c0f+_0x1b3c('0x23')+_0x545af4,'body':{'user_name':_0x2e7807[_0x1b3c('0x24')],'roles':_0x1b3c('0x25'),'first_name':_0x2e7807[_0x1b3c('0x24')],'active':_0x1b3c('0x1e'),'date_format':_0x1b3c('0x26'),'phone':_0x2e7807[_0x1b3c('0x24')]},'auth':_0x5e91dd,'json':!![]};return rp(_0xe61023)[_0x1b3c('0x1c')](function(_0x459e49){logger[_0x1b3c('0x11')]('['+[_0x504a3d[_0x1b3c('0x12')]()]+'],\x20EndUser\x20schema',_0x459e49[_0x1b3c('0xd')]);_0x2e7807[_0x1b3c('0x27')]=_0x459e49[_0x1b3c('0xd')][_0x1b3c('0x10')];_0x4a5909(_0x2e7807);})['catch'](function(_0x3197bf){logger['error']('['+[_0x504a3d['toUpperCase']()]+']',_0x3197bf['message']);_0x1b1145(_0x3197bf['message']);});});}function getEndUser(_0x25424b,_0x431430,_0x1733be,_0x135c0c,_0xd32b17){return function(_0x261eba){logger['info']('['+[_0x25424b[_0x1b3c('0x12')]()]+_0x1b3c('0x28'),_0x261eba);return new Promise(function(_0x8efe95,_0x16e206){var _0x485f63={'method':_0x1b3c('0x29'),'uri':_0x1733be+_0x1b3c('0x2a')+_0x261eba[_0x1b3c('0x24')]+'&'+_0x135c0c+'&'+_0xd32b17,'auth':_0x431430,'json':!![]};return rp(_0x485f63)['then'](function(_0x56df5c){if(_0x56df5c[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0){_0x261eba['endUserId']=_0x56df5c[_0x1b3c('0xd')][0x0][_0x1b3c('0x10')];logger[_0x1b3c('0x11')]('['+[_0x25424b[_0x1b3c('0x12')]()]+_0x1b3c('0x2b'),_0x261eba);_0x8efe95(_0x261eba);}else{return createEndUser(_0x25424b,_0x431430,_0x261eba,_0x1733be,_0x135c0c)[_0x1b3c('0x1c')](function(_0x5e6940){logger[_0x1b3c('0x11')]('['+[_0x25424b['toUpperCase']()]+_0x1b3c('0x2c'),_0x5e6940);_0x8efe95(_0x5e6940);});}})[_0x1b3c('0x14')](function(_0x2dd114){logger[_0x1b3c('0x15')]('['+[_0x25424b[_0x1b3c('0x12')]()]+']',_0x2dd114['message']);_0x16e206(_0x2dd114[_0x1b3c('0x16')]);});});};}function getCustomFields(_0x571957,_0x4890f9){var _0x22768a={};if(_0x571957['length']>0x0){_[_0x1b3c('0x2d')](_0x571957,function(_0x2a9c9e){if(_[_0x1b3c('0x2e')](['string',_0x1b3c('0x2f')],_0x2a9c9e[_0x1b3c('0x30')])&&_0x2a9c9e[_0x1b3c('0x31')]&&!_0x2a9c9e['customField']){_0x22768a[_0x2a9c9e['nameField'][_0x1b3c('0x32')]()]=_0x2a9c9e[_0x1b3c('0x33')][_0x1b3c('0x34')]();}else if(_[_0x1b3c('0x2e')]([_0x1b3c('0x35'),_0x1b3c('0x2f')],_0x2a9c9e[_0x1b3c('0x30')])&&_0x2a9c9e[_0x1b3c('0x36')]&&_0x2a9c9e[_0x1b3c('0x37')]){_0x22768a[_0x2a9c9e[_0x1b3c('0x36')][_0x1b3c('0x32')]()]=_0x2a9c9e[_0x1b3c('0x33')][_0x1b3c('0x34')]();}else if(_0x2a9c9e[_0x1b3c('0x30')]==='variable'&&_0x2a9c9e[_0x1b3c('0x38')]&&_0x2a9c9e[_0x1b3c('0x36')]&&_0x2a9c9e[_0x1b3c('0x37')]){_0x22768a[_0x2a9c9e[_0x1b3c('0x36')][_0x1b3c('0x32')]()]=_0x4890f9[_0x2a9c9e[_0x1b3c('0x38')]][_0x1b3c('0x34')]();}else if(_0x2a9c9e['type']===_0x1b3c('0x39')&&_0x2a9c9e[_0x1b3c('0x3a')]&&_0x2a9c9e[_0x1b3c('0x3a')][_0x1b3c('0x3b')]&&_0x2a9c9e[_0x1b3c('0x36')]&&_0x2a9c9e[_0x1b3c('0x37')]){_0x22768a[_0x2a9c9e[_0x1b3c('0x36')][_0x1b3c('0x32')]()]=_0x4890f9[_0x2a9c9e['Variable'][_0x1b3c('0x3b')][_0x1b3c('0x32')]()][_0x1b3c('0x34')]();}});}return _0x22768a;}function getTicket(_0x23c81b,_0x442298,_0x27abaa,_0x169786,_0x4c25d4,_0x377aa1){return function(_0x590f99){logger[_0x1b3c('0x11')]('['+[_0x23c81b['toUpperCase']()]+_0x1b3c('0x3c'),_0x590f99);return new Promise(function(_0x3d6d17,_0x3029b7){var _0x7ec99a=_0x23c81b['toLowerCase']()===_0x1b3c('0x3d')?_0x590f99['userId']:_0x590f99[_0x1b3c('0x27')];var _0x218fe2={'method':'POST','uri':_0x27abaa+_0x1b3c('0x3e')+'?'+_0x377aa1,'body':Object[_0x1b3c('0x3f')]({},{'active':_0x1b3c('0x1e'),'caller_id':_0x7ec99a,'assigned_to':_0x590f99['userId'],'short_description':intUtil[_0x1b3c('0x40')](_0x169786[_0x1b3c('0x41')],_0x4c25d4,'\x20'),'description':intUtil['getString'](_0x169786[_0x1b3c('0x42')],_0x4c25d4,'\x0a')},getCustomFields(_0x169786[_0x1b3c('0x43')],_0x4c25d4)),'auth':_0x442298,'json':!![]};return rp(_0x218fe2)['then'](function(_0x8330ae){logger[_0x1b3c('0x11')]('['+[_0x23c81b[_0x1b3c('0x12')]()]+_0x1b3c('0x44'),_0x8330ae['result']);_0x590f99[_0x1b3c('0x45')]=_0x8330ae['result']['sys_id'];_0x590f99['ticketNumber']=_0x8330ae[_0x1b3c('0xd')]['number'];logger[_0x1b3c('0x11')]('['+[_0x23c81b[_0x1b3c('0x12')]()]+_0x1b3c('0x46'),_0x590f99);_0x3d6d17(_0x590f99);})['catch'](function(_0x14905c){logger[_0x1b3c('0x15')]('['+[_0x23c81b[_0x1b3c('0x12')]()]+']',_0x14905c[_0x1b3c('0x16')]);_0x3029b7(_0x14905c[_0x1b3c('0x16')]);});});};}function createRemoteTag(_0x3baafc,_0x753dc3,_0x5f2471,_0x3e3306){return new Promise(function(_0x3dacaf,_0x57efe8){var _0x23e460={'method':'POST','uri':_0x5f2471+_0x1b3c('0x47')+'?'+_0x3e3306,'body':{'short_description':_0x3baafc,'global':!![],'active':!![],'name':_0x3baafc},'auth':_0x753dc3,'json':!![]};return rp(_0x23e460)[_0x1b3c('0x1c')](function(_0x479503){var _0x405638=_0x479503[_0x1b3c('0xd')][_0x1b3c('0x10')];_0x3dacaf(_0x405638);});});}function getRemoteTag(_0x2a81da,_0x474904,_0x5cccf2,_0x370ff0,_0x44f184){return new Promise(function(_0x2111e0,_0x12330a){var _0x21765a={'method':'GET','uri':_0x5cccf2+_0x1b3c('0x47')+'?sysparm_query=name%3D'+_0x2a81da+'&'+_0x370ff0,'auth':_0x474904,'json':!![]};return rp(_0x21765a)[_0x1b3c('0x1c')](function(_0x13865e){if(_0x13865e[_0x1b3c('0xd')][_0x1b3c('0xe')]>0x0){var _0x4500c0=_0x13865e['result'][0x0][_0x1b3c('0x10')];_0x2111e0(_0x4500c0);}else{return createRemoteTag(_0x2a81da,_0x474904,_0x5cccf2,_0x370ff0)[_0x1b3c('0x1c')](function(_0x4c4b3f){_0x2111e0(_0x4c4b3f);});}});});}function assignTagToIncident(_0x4797f7,_0x46a0a3,_0x2a1088,_0x208c58,_0x383ce0){return new Promise(function(_0x120d7a,_0x1dcc7c){var _0x4016d7={'method':'POST','uri':_0x2a1088+_0x1b3c('0x48')+'?'+_0x383ce0,'body':{'label':_0x4797f7,'table':_0x1b3c('0x3e'),'id_type':'Incident','table_key':_0x208c58[_0x1b3c('0x45')],'title':_0x1b3c('0x49')+_0x208c58['ticketNumber'],'id_display':_0x208c58[_0x1b3c('0x4a')]},'auth':_0x46a0a3,'json':!![]};return rp(_0x4016d7)['then'](function(_0x1e2968){_0x120d7a();})[_0x1b3c('0x14')](function(){_0x120d7a();});});}function manageTags(_0x1180b9,_0x52a9cf,_0x2dca8a,_0x39e15b,_0x571f77,_0x45ff2b,_0x159c00){return new Promise(function(_0x1dfe0f,_0x5f4f47){var _0x4255e7=[];_0x52a9cf[_0x1b3c('0x2d')](function(_0x245022){_0x4255e7[_0x1b3c('0x4b')](getRemoteTag(_0x245022,_0x2dca8a,_0x39e15b,_0x45ff2b,_0x159c00));});return Promise[_0x1b3c('0x4c')](_0x4255e7)['then'](function(_0x149d67){if(_0x149d67[_0x1b3c('0xe')]){logger[_0x1b3c('0x11')]('['+[_0x1180b9['toUpperCase']()]+_0x1b3c('0x4d'),_0x149d67);var _0xcfad1f=[];_0x149d67['forEach'](function(_0x3cd12e){_0xcfad1f[_0x1b3c('0x4b')](assignTagToIncident(_0x3cd12e,_0x2dca8a,_0x39e15b,_0x571f77,_0x45ff2b));});return Promise[_0x1b3c('0x4c')](_0xcfad1f)['then'](function(){_0x1dfe0f();})[_0x1b3c('0x14')](function(){_0x1dfe0f();});}else{_0x1dfe0f();}});});}function getTags(_0x11c752,_0x3e1931,_0x4c1523,_0x44a520,_0x1fcb06,_0x4d9550){return function(_0x5c796b){return new Promise(function(_0x527bce,_0x1b35e4){var _0x53fb0c=[];var _0x4daaf3=_0x44a520['Tags'];if(_0x4daaf3&&_0x4daaf3[_0x1b3c('0xe')]>0x0){_0x53fb0c=_[_0x1b3c('0x4e')](_0x4daaf3,'name');}if(_0x53fb0c[_0x1b3c('0xe')]>0x0){return manageTags(_0x11c752,_0x53fb0c,_0x3e1931,_0x4c1523,_0x5c796b,_0x1fcb06,_0x4d9550)[_0x1b3c('0x1c')](function(){_0x527bce(_0x5c796b);});}else{_0x527bce(_0x5c796b);}});};}function emit(_0x3a0a03,_0x4b9d92,_0x2b1bd2){var _0x454c30=_0x1b3c('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x1b3c('0x50')+_0x1b3c('0x51');var _0x47856e={'uri':_0x3a0a03+_0x1b3c('0x52')+_0x2b1bd2+_0x454c30};io['to'](util[_0x1b3c('0x53')](_0x1b3c('0x54'),_0x4b9d92))['emit']('trigger:browser:url',_0x47856e);}exports['cs']=function(_0x3a0fdb,_0x447ea5,_0x5f5386,_0x5e7327,_0xe7c518,_0x274b63,_0x4e1739,_0x49710f){var _0x440e2d={};var _0x579230={'user':_0x274b63[_0x1b3c('0x55')],'pass':_0x274b63['password']};var _0xdea741=_0x1b3c('0x56');var _0x459489=_0x1b3c('0x57');_0x274b63[_0x1b3c('0x58')]=intUtil[_0x1b3c('0x59')](_0x274b63[_0x1b3c('0x58')]);_0x274b63['serverUrl']=intUtil['stripTrailingSlash'](_0x274b63['serverUrl']);var _0x475f33=util[_0x1b3c('0x53')](_0x1b3c('0x5a'),_0x274b63['remoteUri']);_0x440e2d[_0x1b3c('0x19')]=!_[_0x1b3c('0x5b')](_0x5e7327)?_0x5e7327[_0x1b3c('0x5c')]:null;_0x440e2d[_0x1b3c('0x20')]=_0x274b63['email'];_0x440e2d[_0x1b3c('0x24')]=_0x49710f['toLowerCase']()==='outbound'?_0x447ea5['destcalleridnum']:_0x447ea5[_0x1b3c('0x5d')];_0x440e2d[_0x1b3c('0x5e')]=_0x49710f==='queue'||_0x49710f===_0x1b3c('0x5f')?_0x1b3c('0x60'):'outbound';var _0x46de13=util[_0x1b3c('0x53')](_0x1b3c('0x61'),_0x274b63['serverUrl'],_0x447ea5[_0x1b3c('0x62')],md5(_0x447ea5[_0x1b3c('0x62')]));if(_0xe7c518&&_0xe7c518['monitor_format']){logger['info'](_0x1b3c('0x63'),_0x1b3c('0x64'));_0x447ea5[_0x1b3c('0x65')]=_0x46de13;}else if(_0x4e1739&&_0x4e1739[_0x1b3c('0x66')]&&_0x4e1739[_0x1b3c('0x66')]!==_0x1b3c('0x67')){logger[_0x1b3c('0x11')](_0x1b3c('0x68'),_0x1b3c('0x64'));_0x447ea5['recordingURL']=_0x46de13;}else{_0x447ea5[_0x1b3c('0x65')]='';}return getAdminUser(_0x49710f,_0x579230,_0x440e2d,_0x475f33,_0x459489,_0xdea741)[_0x1b3c('0x1c')](getUser(_0x49710f,_0x579230,_0x475f33,_0x459489,_0xdea741))[_0x1b3c('0x1c')](getEndUser(_0x49710f,_0x579230,_0x475f33,_0x459489,_0xdea741))['then'](getTicket(_0x49710f,_0x579230,_0x475f33,_0x5f5386,_0x447ea5,_0x459489))[_0x1b3c('0x1c')](function(_0x3fce47){logger[_0x1b3c('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3fce47[_0x1b3c('0x45')]));logger[_0x1b3c('0x11')](util['format'](_0x1b3c('0x69'),_0x49710f));if(_0x49710f!==_0x1b3c('0x5f')){logger[_0x1b3c('0x11')]('['+[_0x49710f['toUpperCase']()]+']',_0x1b3c('0x6a'));emit(_0x274b63[_0x1b3c('0x58')],_0x5e7327[_0x1b3c('0x3b')],_0x3fce47[_0x1b3c('0x45')]);}})[_0x1b3c('0x14')](function(_0x5b4235){logger[_0x1b3c('0x15')]('['+[_0x49710f['toUpperCase']()]+_0x1b3c('0x6b'),util['inspect'](_0x5b4235,{'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 b310d93..b7065d0 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 _0xac08=['date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','variableName','push','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','Agent\x20found!','name_value_list','resolve','user_id','value','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20created.','first_name','merge','map','forEach','type','string','nameField','customField','toLowerCase','idField','content','custom_fields','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','catch','error','unmanaged','lastevent','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions'];(function(_0x3355c3,_0x191595){var _0x2b3294=function(_0x5354fb){while(--_0x5354fb){_0x3355c3['push'](_0x3355c3['shift']());}};_0x2b3294(++_0x191595);}(_0xac08,0x1d7));var _0x8ac0=function(_0x50486a,_0x2b9e6c){_0x50486a=_0x50486a-0x0;var _0x14b91f=_0xac08[_0x50486a];return _0x14b91f;};'use strict';var _=require(_0x8ac0('0x0'));var rp=require(_0x8ac0('0x1'));var BPromise=require(_0x8ac0('0x2'));var md5=require(_0x8ac0('0x3'));var util=require(_0x8ac0('0x4'));var Redis=require(_0x8ac0('0x5'));var intUtil=require('./util');var config=require(_0x8ac0('0x6'));var logger=require('../../../../config/logger')(_0x8ac0('0x7'));config[_0x8ac0('0x8')]=_[_0x8ac0('0x9')](config[_0x8ac0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8ac0('0xa'))(new Redis(config[_0x8ac0('0x8')]));var def={'method':_0x8ac0('0xb'),'json':!![]};function emit(_0x22a713,_0x311e18,_0x2bb4b7){io['to'](_0x22a713)[_0x8ac0('0xc')](_0x311e18,_0x2bb4b7);}function getTicket(_0x302163,_0x505b96,_0x36dbc8,_0x1d2fe5,_0x5885d2,_0x19fab8,_0x2d746a,_0x315d4d){logger[_0x8ac0('0xd')](_0x8ac0('0xe'));var _0x55c988=new Date();var _0x8c7c27=[{'name':'name','value':intUtil[_0x8ac0('0xf')](_0x1d2fe5[_0x8ac0('0x10')],_0x5885d2,'\x20')},{'name':_0x8ac0('0x11'),'value':_0x505b96['id']},{'name':_0x8ac0('0x12'),'value':_0x505b96['id']},{'name':_0x8ac0('0x13'),'value':intUtil['getString'](_0x1d2fe5[_0x8ac0('0x14')],_0x5885d2,'\x0a')},{'name':_0x8ac0('0x15'),'value':_0x55c988[_0x8ac0('0x16')]()[_0x8ac0('0x17')](0x0,0x13)[_0x8ac0('0x18')]('T','\x20')},{'name':_0x8ac0('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x8ac0('0x1a'),'value':_0x36dbc8['id']},{'name':_0x8ac0('0x1b'),'value':_0x8ac0('0x1c')},{'name':_0x8ac0('0x1d'),'value':_0x36dbc8[_0x8ac0('0x1e')]},{'name':_0x8ac0('0x1f'),'value':_0x315d4d}];if(_0x19fab8['length']){_['forEach'](_0x19fab8,function(_0x409067){if(_0x5885d2[_0x409067[_0x8ac0('0x20')]]){_0x8c7c27[_0x8ac0('0x21')]({'name':_0x409067['idField'],'value':_0x5885d2[_0x409067[_0x8ac0('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x8ac0('0x22'),'response_type':_0x8ac0('0x22'),'rest_data':JSON[_0x8ac0('0x23')]({'session':_0x2d746a['id'],'module_name':_0x8ac0('0x24'),'name_value_list':_0x8c7c27})}});}function getAuth(_0x2c6090){return util[_0x8ac0('0x25')](_0x8ac0('0x26'),new Buffer(_0x2c6090[_0x8ac0('0x27')]+':X')[_0x8ac0('0x28')](_0x8ac0('0x29')));}function getServerInfo(_0x419d6a){return request({'form':{'method':_0x8ac0('0x2a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x419d6a['id']})}});}function getUser(_0x4fe417,_0x3cc2b9,_0x42b69a){if(!_[_0x8ac0('0x2b')](_0x3cc2b9)){logger[_0x8ac0('0xd')](_0x8ac0('0x2c'),_0x3cc2b9);return request({'form':{'method':_0x8ac0('0x2d'),'input_type':_0x8ac0('0x22'),'response_type':_0x8ac0('0x22'),'rest_data':JSON['stringify']({'session':_0x42b69a['id'],'module_name':_0x8ac0('0x2e'),'query':util[_0x8ac0('0x25')](_0x8ac0('0x2f'),_0x3cc2b9),'order_by':'','offset':'0','select_fields':['id','name',_0x8ac0('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8ac0('0x31')](function(_0x193011){if(_0x193011[_0x8ac0('0x32')]['length']){var _0x1db649=_[_0x8ac0('0x33')](_0x193011[_0x8ac0('0x32')],function(_0xc23e7b){return _0xc23e7b['name_value_list']['user_name']['value']===_0x3cc2b9;});if(_0x1db649){logger[_0x8ac0('0xd')](_0x8ac0('0x34'));return BPromise['resolve']({'id':_0x1db649[_0x8ac0('0x35')]['id']['value'],'name':_0x1db649[_0x8ac0('0x35')]['name']['value']});}}logger[_0x8ac0('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x8ac0('0x36')]({'id':_0x42b69a['name_value_list'][_0x8ac0('0x37')][_0x8ac0('0x38')],'name':_0x42b69a[_0x8ac0('0x35')]['user_name'][_0x8ac0('0x38')]});});}else{logger[_0x8ac0('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x8ac0('0x36')]({'id':_0x42b69a[_0x8ac0('0x35')][_0x8ac0('0x37')][_0x8ac0('0x38')],'name':_0x42b69a['name_value_list']['user_name']['value']});}}function getEndUser(_0x5a21c2,_0x288933,_0x4fc3b8,_0x588259){logger[_0x8ac0('0xd')](_0x8ac0('0x39'),_0x4fc3b8);return request({'form':{'method':_0x8ac0('0x2d'),'input_type':_0x8ac0('0x22'),'response_type':_0x8ac0('0x22'),'rest_data':JSON[_0x8ac0('0x23')]({'session':_0x588259['id'],'module_name':_0x8ac0('0x1c'),'query':util[_0x8ac0('0x25')](_0x8ac0('0x3a'),_0x4fc3b8),'order_by':'','offset':'0','select_fields':['id','name',_0x8ac0('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8ac0('0x31')](function(_0x956c4d){if(_0x956c4d['entry_list'][_0x8ac0('0x3c')]){var _0x14c22e=_['find'](_0x956c4d[_0x8ac0('0x32')],function(_0xd95fcb){return _0xd95fcb[_0x8ac0('0x35')][_0x8ac0('0x3b')]['value']===_0x4fc3b8;});if(_0x14c22e){logger[_0x8ac0('0xd')](_0x8ac0('0x3d'));return BPromise['resolve']({'id':_0x14c22e['name_value_list']['id']['value'],'name':_0x14c22e[_0x8ac0('0x35')]['name'][_0x8ac0('0x38')],'phone':_0x14c22e[_0x8ac0('0x35')]['phone_home'][_0x8ac0('0x38')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x8ac0('0x22'),'response_type':'JSON','rest_data':JSON[_0x8ac0('0x23')]({'session':_0x588259['id'],'module_name':_0x8ac0('0x1c'),'name_value_list':[{'name':'first_name','value':_0x288933!==''?_0x288933:util['format']('Caller\x20-\x20%s',_0x4fc3b8)},{'name':_0x8ac0('0x3b'),'value':_0x4fc3b8}]})}})[_0x8ac0('0x31')](function(_0x1e8164){logger[_0x8ac0('0xd')](_0x8ac0('0x3e'));return BPromise['resolve']({'id':_0x1e8164['id'],'name':_0x1e8164[_0x8ac0('0x32')][_0x8ac0('0x3f')][_0x8ac0('0x38')],'phone':_0x1e8164[_0x8ac0('0x32')][_0x8ac0('0x3b')][_0x8ac0('0x38')]});});}});}function request(_0x23fe68){logger['debug']('[HTTP]',JSON['stringify'](_0x23fe68));return rp(_[_0x8ac0('0x40')](def,_0x23fe68));}function getTags(_0x39d2af,_0x2e31c8){var _0x593ddb=[];if(_0x39d2af&&_0x39d2af['length']>0x0){_0x593ddb=_[_0x8ac0('0x41')](_0x39d2af,_0x2e31c8);}return _0x593ddb;}function getCustomFields(_0x383ad6,_0x204457){var _0x547b16=[];var _0x4296ac={'custom_fields':[]};if(_0x383ad6[_0x8ac0('0x3c')]>0x0){_[_0x8ac0('0x42')](_0x383ad6,function(_0x571107){if(_0x571107[_0x8ac0('0x43')]===_0x8ac0('0x44')&&_0x571107[_0x8ac0('0x45')]&&!_0x571107[_0x8ac0('0x46')]){_0x4296ac[_0x571107[_0x8ac0('0x45')][_0x8ac0('0x47')]()]=_0x571107['content'][_0x8ac0('0x28')]();}else if(_0x571107[_0x8ac0('0x43')]==='string'&&_0x571107[_0x8ac0('0x48')]&&_0x571107[_0x8ac0('0x46')]){_0x4296ac['custom_fields']['push']({'id':_0x571107['idField'],'value':_0x571107[_0x8ac0('0x49')][_0x8ac0('0x28')]()});}else if(_0x571107[_0x8ac0('0x43')]==='variable'&&_0x571107[_0x8ac0('0x20')]&&_0x571107[_0x8ac0('0x48')]&&_0x571107[_0x8ac0('0x46')]){_0x204457[_0x571107[_0x8ac0('0x20')]]&&_0x4296ac[_0x8ac0('0x4a')][_0x8ac0('0x21')]({'id':_0x571107[_0x8ac0('0x48')],'value':_0x204457[_0x571107['variableName']][_0x8ac0('0x28')]()});}else if(_0x571107[_0x8ac0('0x43')]===_0x8ac0('0x4b')&&_0x571107[_0x8ac0('0x4c')]&&_0x571107[_0x8ac0('0x4c')][_0x8ac0('0x1e')]&&_0x571107[_0x8ac0('0x48')]&&_0x571107[_0x8ac0('0x46')]){_0x204457[_0x571107[_0x8ac0('0x4c')][_0x8ac0('0x1e')][_0x8ac0('0x47')]()]&&_0x4296ac[_0x8ac0('0x4a')]['push']({'id':_0x571107[_0x8ac0('0x48')],'value':_0x204457[_0x571107[_0x8ac0('0x4c')]['name'][_0x8ac0('0x47')]()][_0x8ac0('0x28')]()});}});}return _0x4296ac;}function getConnection(_0x4715ef){return request({'method':_0x8ac0('0xb'),'form':{'method':_0x8ac0('0x4d'),'input_type':'JSON','response_type':_0x8ac0('0x22'),'rest_data':JSON[_0x8ac0('0x23')]({'user_auth':{'user_name':_0x4715ef[_0x8ac0('0x4e')],'password':_0x4715ef[_0x8ac0('0x4f')],'encryption':_0x8ac0('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0xbf5a72){var _0x240a81=_0xbf5a72;if(_0x240a81['id']){def[_0x8ac0('0x51')]=_0x240a81['id'];return BPromise[_0x8ac0('0x36')](_0x240a81);}else{throw new Error(util['format'](_0x8ac0('0x52'),_0x4715ef['id']));}});}function setRelationship(_0x408a91,_0x507429,_0x3b143e,_0xcb66ca){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x8ac0('0x22'),'rest_data':JSON[_0x8ac0('0x23')]({'session':_0x408a91['id'],'module_name':_0x8ac0('0x24'),'module_id':_0x3b143e['id'],'link_field_name':_0xcb66ca,'related_ids':[_0x507429['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8ac0('0x53')]=function(_0x4ab8f0,_0x5f3eb8,_0x33327a,_0x4b447a,_0x2a980d,_0x3b4c35){var _0x3b7065,_0x259021,_0x2e7c76,_0x1c2b18;_0x3b4c35[_0x8ac0('0x54')]=intUtil[_0x8ac0('0x55')](_0x3b4c35[_0x8ac0('0x54')]);_0x3b4c35[_0x8ac0('0x56')]=intUtil['stripTrailingSlash'](_0x3b4c35[_0x8ac0('0x56')]);def[_0x8ac0('0x57')]=util[_0x8ac0('0x25')](_0x8ac0('0x58'),_0x3b4c35[_0x8ac0('0x54')]);if(_0x2a980d&&_0x2a980d[_0x8ac0('0x59')]){logger[_0x8ac0('0xd')]('[QUEUE]',_0x8ac0('0x5a'));_0x5f3eb8[_0x8ac0('0x5b')]=util[_0x8ac0('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b4c35[_0x8ac0('0x56')],_0x5f3eb8['uniqueid'],md5(_0x5f3eb8[_0x8ac0('0x5c')]));}else{_0x5f3eb8[_0x8ac0('0x5b')]='';}return getConnection(_0x3b4c35)[_0x8ac0('0x31')](function(_0xd2293b){_0x1c2b18=_0xd2293b;return getUser(_0x3b4c35,_0x4b447a[_0x8ac0('0x1e')],_0x1c2b18);})[_0x8ac0('0x31')](function(_0x37bcf4){_0x3b7065=_0x37bcf4;logger['info']('The\x20User\x20ID\x20is:',_0x3b7065['id']);return getEndUser(_0x3b4c35,_0x5f3eb8[_0x8ac0('0x5d')],_0x5f3eb8['calleridnum'],_0x1c2b18);})[_0x8ac0('0x31')](function(_0x48c0a2){_0x259021=_0x48c0a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x259021['id']);return getTicket(_0x3b4c35,_0x3b7065,_0x259021,_0x33327a,_0x5f3eb8,_0x33327a[_0x8ac0('0x5e')],_0x1c2b18,_0x8ac0('0x5f'));})['then'](function(_0x8f514b){_0x2e7c76=_0x8f514b;logger[_0x8ac0('0xd')](_0x8ac0('0x60'));logger[_0x8ac0('0xd')](_0x8ac0('0x61'),_0x2e7c76['id']);return setRelationship(_0x1c2b18,_0x3b7065,_0x2e7c76,_0x8ac0('0x62'));})['then'](function(){return setRelationship(_0x1c2b18,_0x259021,_0x2e7c76,_0x8ac0('0x63'));})['then'](function(){return getServerInfo(_0x1c2b18);})[_0x8ac0('0x31')](function(_0x2abd61){var _0x291e3b=parseInt(_0x2abd61[_0x8ac0('0x64')][_0x8ac0('0x65')](0x0));var _0x1dcb4c=util[_0x8ac0('0x25')](_0x8ac0('0x66'),_0x3b4c35[_0x8ac0('0x54')],_0x2e7c76['id']);if(_0x291e3b>0x6){_0x1dcb4c=util[_0x8ac0('0x25')](_0x8ac0('0x67'),_0x3b4c35['remoteUri'],_0x2e7c76['id']);}logger[_0x8ac0('0xd')](_0x8ac0('0x68'),_0x8ac0('0x69'));emit(util['format'](_0x8ac0('0x6a'),_0x4b447a['name']),_0x8ac0('0x6b'),{'uri':_0x1dcb4c});})['catch'](function(_0x51336b){logger['error'](_0x8ac0('0x68'),JSON['stringify'](_0x51336b));});};exports['outbound']=function(_0x3182cb,_0x13d355,_0x3008fa,_0x2bebff,_0x521bbf,_0x4a36d7,_0x43a610){var _0x44d002,_0x4a3d7a,_0x18d200,_0x1cdc73;_0x4a36d7[_0x8ac0('0x54')]=intUtil['stripTrailingSlash'](_0x4a36d7['remoteUri']);_0x4a36d7[_0x8ac0('0x56')]=intUtil[_0x8ac0('0x55')](_0x4a36d7[_0x8ac0('0x56')]);def[_0x8ac0('0x57')]=util[_0x8ac0('0x25')](_0x8ac0('0x58'),_0x4a36d7[_0x8ac0('0x54')]);if(_0x43a610&&_0x43a610['recordingFormat']&&_0x43a610[_0x8ac0('0x6c')]!==_0x8ac0('0x6d')){logger[_0x8ac0('0xd')](_0x8ac0('0x6e'),_0x8ac0('0x5a'));_0x13d355[_0x8ac0('0x5b')]=util[_0x8ac0('0x25')](_0x8ac0('0x6f'),_0x4a36d7[_0x8ac0('0x56')],_0x13d355[_0x8ac0('0x5c')],md5(_0x13d355['uniqueid']));}return getConnection(_0x4a36d7)['then'](function(_0xe573a4){_0x1cdc73=_0xe573a4;return getUser(_0x4a36d7,_0x2bebff[_0x8ac0('0x1e')],_0x1cdc73);})[_0x8ac0('0x31')](function(_0x284c08){_0x44d002=_0x284c08;logger[_0x8ac0('0xd')](_0x8ac0('0x70'),_0x44d002['id']);return getEndUser(_0x4a36d7,_0x13d355[_0x8ac0('0x71')],_0x13d355[_0x8ac0('0x72')],_0x1cdc73);})[_0x8ac0('0x31')](function(_0x57b364){_0x4a3d7a=_0x57b364;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4a3d7a['id']);return getTicket(_0x4a36d7,_0x44d002,_0x4a3d7a,_0x3008fa,_0x13d355,_0x3008fa[_0x8ac0('0x5e')],_0x1cdc73,_0x8ac0('0x73'));})[_0x8ac0('0x31')](function(_0x46ef11){_0x18d200=_0x46ef11;logger[_0x8ac0('0xd')](_0x8ac0('0x60'));logger[_0x8ac0('0xd')](_0x8ac0('0x61'),_0x18d200['id']);return setRelationship(_0x1cdc73,_0x44d002,_0x18d200,_0x8ac0('0x62'));})[_0x8ac0('0x31')](function(){return setRelationship(_0x1cdc73,_0x4a3d7a,_0x18d200,_0x8ac0('0x63'));})[_0x8ac0('0x31')](function(){return getServerInfo(_0x1cdc73);})[_0x8ac0('0x31')](function(_0x347ad4){var _0x4648ac=parseInt(_0x347ad4['version']['charAt'](0x0));var _0x3eb429=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4a36d7[_0x8ac0('0x54')],_0x18d200['id']);if(_0x4648ac>0x6){_0x3eb429=util[_0x8ac0('0x25')](_0x8ac0('0x67'),_0x4a36d7[_0x8ac0('0x54')],_0x18d200['id']);}logger['info'](_0x8ac0('0x6e'),_0x8ac0('0x69'));emit(util[_0x8ac0('0x25')](_0x8ac0('0x6a'),_0x2bebff[_0x8ac0('0x1e')]),_0x8ac0('0x6b'),{'uri':_0x3eb429});})[_0x8ac0('0x74')](function(_0x30a952){logger[_0x8ac0('0x75')](_0x8ac0('0x6e'),JSON[_0x8ac0('0x23')](_0x30a952));});};exports[_0x8ac0('0x76')]=function(_0x4367ad,_0x389a14,_0x3ee740,_0x531a96,_0x176a25,_0x2cf7af){var _0x30d0c0,_0x409d9e,_0x334952,_0x2e2fd5;_0x2cf7af['remoteUri']=intUtil[_0x8ac0('0x55')](_0x2cf7af[_0x8ac0('0x54')]);_0x2cf7af[_0x8ac0('0x56')]=intUtil[_0x8ac0('0x55')](_0x2cf7af[_0x8ac0('0x56')]);def[_0x8ac0('0x57')]=util[_0x8ac0('0x25')](_0x8ac0('0x58'),_0x2cf7af[_0x8ac0('0x54')]);if(_0x176a25&&_0x176a25[_0x8ac0('0x59')]){logger[_0x8ac0('0xd')]('['+_0x389a14[_0x8ac0('0x77')][_0x8ac0('0x78')]()+']',_0x8ac0('0x5a'));_0x389a14[_0x8ac0('0x5b')]=util[_0x8ac0('0x25')](_0x8ac0('0x6f'),_0x2cf7af[_0x8ac0('0x56')],_0x389a14[_0x8ac0('0x5c')],md5(_0x389a14['uniqueid']));}else{_0x389a14['recordingURL']='';}return getConnection(_0x2cf7af)[_0x8ac0('0x31')](function(_0x3b05b2){_0x2e2fd5=_0x3b05b2;if(!_[_0x8ac0('0x2b')](_0x531a96)){return getUser(_0x2cf7af,_0x531a96[_0x8ac0('0x1e')],_0x2e2fd5);}else{return getUser(_0x2cf7af,null,_0x2e2fd5);}})[_0x8ac0('0x31')](function(_0x5eff9c){_0x30d0c0=_0x5eff9c;logger[_0x8ac0('0xd')](_0x8ac0('0x70'),_0x30d0c0['id']);return getEndUser(_0x2cf7af,_0x389a14[_0x8ac0('0x5d')],_0x389a14[_0x8ac0('0x79')],_0x2e2fd5);})[_0x8ac0('0x31')](function(_0xd54776){_0x409d9e=_0xd54776;logger[_0x8ac0('0xd')](_0x8ac0('0x7a'),_0x409d9e['id']);return getTicket(_0x2cf7af,_0x30d0c0,_0x409d9e,_0x3ee740,_0x389a14,_0x3ee740[_0x8ac0('0x5e')],_0x2e2fd5,_0x8ac0('0x5f'));})[_0x8ac0('0x31')](function(_0xed69b3){_0x334952=_0xed69b3;logger['info'](_0x8ac0('0x60'));logger['info'](_0x8ac0('0x61'),_0x334952['id']);return setRelationship(_0x2e2fd5,_0x30d0c0,_0x334952,_0x8ac0('0x62'));})['then'](function(){return setRelationship(_0x2e2fd5,_0x409d9e,_0x334952,_0x8ac0('0x63'));})['then'](function(){return getServerInfo(_0x2e2fd5);})[_0x8ac0('0x74')](function(_0x5024f4){logger[_0x8ac0('0x75')]('['+_0x389a14['lastevent'][_0x8ac0('0x78')]()+']',JSON['stringify'](_0x5024f4));});}; \ No newline at end of file +var _0xbadb=['Calls','format','Basic\x20%s','apiKey','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','toLowerCase','toString','type','custom_fields','content','variable','customField','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','lastevent','toUpperCase','isNil','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','push','idField','variableName','JSON','stringify'];(function(_0x2df578,_0x312ee6){var _0x319a3b=function(_0x1a1a17){while(--_0x1a1a17){_0x2df578['push'](_0x2df578['shift']());}};_0x319a3b(++_0x312ee6);}(_0xbadb,0x153));var _0xbbad=function(_0x1d1953,_0x202abd){_0x1d1953=_0x1d1953-0x0;var _0x188b44=_0xbadb[_0x1d1953];return _0x188b44;};'use strict';var _=require(_0xbbad('0x0'));var rp=require('request-promise');var BPromise=require(_0xbbad('0x1'));var md5=require(_0xbbad('0x2'));var util=require(_0xbbad('0x3'));var Redis=require(_0xbbad('0x4'));var intUtil=require(_0xbbad('0x5'));var config=require(_0xbbad('0x6'));var logger=require(_0xbbad('0x7'))(_0xbbad('0x8'));config[_0xbbad('0x9')]=_[_0xbbad('0xa')](config[_0xbbad('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbbad('0xb'))(new Redis(config[_0xbbad('0x9')]));var def={'method':_0xbbad('0xc'),'json':!![]};function emit(_0x582a6c,_0x341b56,_0x2c0fa2){io['to'](_0x582a6c)[_0xbbad('0xd')](_0x341b56,_0x2c0fa2);}function getTicket(_0xd2f6d9,_0x260a33,_0x22e89a,_0x508549,_0x1d6537,_0x5a3ce5,_0x16d56a,_0x39d5ba){logger[_0xbbad('0xe')](_0xbbad('0xf'));var _0x28750f=new Date();var _0x3e28b9=[{'name':_0xbbad('0x10'),'value':intUtil[_0xbbad('0x11')](_0x508549[_0xbbad('0x12')],_0x1d6537,'\x20')},{'name':_0xbbad('0x13'),'value':_0x260a33['id']},{'name':'created_by','value':_0x260a33['id']},{'name':_0xbbad('0x14'),'value':intUtil['getString'](_0x508549[_0xbbad('0x15')],_0x1d6537,'\x0a')},{'name':'date_start','value':_0x28750f[_0xbbad('0x16')]()['slice'](0x0,0x13)[_0xbbad('0x17')]('T','\x20')},{'name':_0xbbad('0x18'),'value':'0'},{'name':_0xbbad('0x19'),'value':'15'},{'name':_0xbbad('0x1a'),'value':_0x22e89a['id']},{'name':_0xbbad('0x1b'),'value':'Contacts'},{'name':_0xbbad('0x1c'),'value':_0x22e89a[_0xbbad('0x10')]},{'name':_0xbbad('0x1d'),'value':_0x39d5ba}];if(_0x5a3ce5['length']){_[_0xbbad('0x1e')](_0x5a3ce5,function(_0x29214e){if(_0x1d6537[_0x29214e['variableName']]){_0x3e28b9[_0xbbad('0x1f')]({'name':_0x29214e[_0xbbad('0x20')],'value':_0x1d6537[_0x29214e[_0xbbad('0x21')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xbbad('0x22'),'response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x16d56a['id'],'module_name':_0xbbad('0x24'),'name_value_list':_0x3e28b9})}});}function getAuth(_0x2e9353){return util[_0xbbad('0x25')](_0xbbad('0x26'),new Buffer(_0x2e9353[_0xbbad('0x27')]+':X')['toString']('base64'));}function getServerInfo(_0xd0ac4c){return request({'form':{'method':_0xbbad('0x28'),'input_type':'JSON','response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0xd0ac4c['id']})}});}function getUser(_0x3cee36,_0x58554f,_0x368a49){if(!_['isNil'](_0x58554f)){logger['info']('Getting\x20agent\x20with\x20name',_0x58554f);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x368a49['id'],'module_name':_0xbbad('0x29'),'query':util[_0xbbad('0x25')](_0xbbad('0x2a'),_0x58554f),'order_by':'','offset':'0','select_fields':['id',_0xbbad('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbbad('0x2b')](function(_0x4549b2){if(_0x4549b2[_0xbbad('0x2c')][_0xbbad('0x2d')]){var _0x4d1ca1=_[_0xbbad('0x2e')](_0x4549b2['entry_list'],function(_0x475510){return _0x475510[_0xbbad('0x2f')]['user_name'][_0xbbad('0x30')]===_0x58554f;});if(_0x4d1ca1){logger[_0xbbad('0xe')](_0xbbad('0x31'));return BPromise[_0xbbad('0x32')]({'id':_0x4d1ca1[_0xbbad('0x2f')]['id']['value'],'name':_0x4d1ca1['name_value_list'][_0xbbad('0x10')]['value']});}}logger[_0xbbad('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbbad('0x32')]({'id':_0x368a49['name_value_list']['user_id']['value'],'name':_0x368a49[_0xbbad('0x2f')][_0xbbad('0x33')]['value']});});}else{logger[_0xbbad('0xe')](_0xbbad('0x34'));return BPromise[_0xbbad('0x32')]({'id':_0x368a49[_0xbbad('0x2f')][_0xbbad('0x35')]['value'],'name':_0x368a49[_0xbbad('0x2f')]['user_name'][_0xbbad('0x30')]});}}function getEndUser(_0x4eaedc,_0x43b602,_0x4d2959,_0x31b164){logger[_0xbbad('0xe')](_0xbbad('0x36'),_0x4d2959);return request({'form':{'method':_0xbbad('0x37'),'input_type':_0xbbad('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x31b164['id'],'module_name':_0xbbad('0x38'),'query':util[_0xbbad('0x25')](_0xbbad('0x39'),_0x4d2959),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3c34ac){if(_0x3c34ac[_0xbbad('0x2c')][_0xbbad('0x2d')]){var _0x3d7682=_[_0xbbad('0x2e')](_0x3c34ac['entry_list'],function(_0x10b466){return _0x10b466[_0xbbad('0x2f')][_0xbbad('0x3a')][_0xbbad('0x30')]===_0x4d2959;});if(_0x3d7682){logger[_0xbbad('0xe')](_0xbbad('0x3b'));return BPromise[_0xbbad('0x32')]({'id':_0x3d7682[_0xbbad('0x2f')]['id'][_0xbbad('0x30')],'name':_0x3d7682['name_value_list']['name'][_0xbbad('0x30')],'phone':_0x3d7682[_0xbbad('0x2f')]['phone_home']['value']});}}else{logger[_0xbbad('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xbbad('0x3c'),'input_type':_0xbbad('0x22'),'response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x31b164['id'],'module_name':'Contacts','name_value_list':[{'name':_0xbbad('0x3d'),'value':_0x43b602!==''?_0x43b602:util[_0xbbad('0x25')](_0xbbad('0x3e'),_0x4d2959)},{'name':'phone_home','value':_0x4d2959}]})}})['then'](function(_0x4682fc){logger[_0xbbad('0xe')](_0xbbad('0x3f'));return BPromise['resolve']({'id':_0x4682fc['id'],'name':_0x4682fc[_0xbbad('0x2c')][_0xbbad('0x3d')]['value'],'phone':_0x4682fc[_0xbbad('0x2c')][_0xbbad('0x3a')][_0xbbad('0x30')]});});}});}function request(_0x466664){logger[_0xbbad('0x40')](_0xbbad('0x41'),JSON[_0xbbad('0x23')](_0x466664));return rp(_[_0xbbad('0x42')](def,_0x466664));}function getTags(_0x1aef3c,_0x5483d7){var _0x345869=[];if(_0x1aef3c&&_0x1aef3c[_0xbbad('0x2d')]>0x0){_0x345869=_[_0xbbad('0x43')](_0x1aef3c,_0x5483d7);}return _0x345869;}function getCustomFields(_0x2f15fb,_0x55c97d){var _0x3de43a=[];var _0xa183c2={'custom_fields':[]};if(_0x2f15fb[_0xbbad('0x2d')]>0x0){_[_0xbbad('0x1e')](_0x2f15fb,function(_0x5e660c){if(_0x5e660c['type']===_0xbbad('0x44')&&_0x5e660c['nameField']&&!_0x5e660c['customField']){_0xa183c2[_0x5e660c[_0xbbad('0x45')][_0xbbad('0x46')]()]=_0x5e660c['content'][_0xbbad('0x47')]();}else if(_0x5e660c[_0xbbad('0x48')]===_0xbbad('0x44')&&_0x5e660c[_0xbbad('0x20')]&&_0x5e660c['customField']){_0xa183c2[_0xbbad('0x49')][_0xbbad('0x1f')]({'id':_0x5e660c[_0xbbad('0x20')],'value':_0x5e660c[_0xbbad('0x4a')][_0xbbad('0x47')]()});}else if(_0x5e660c[_0xbbad('0x48')]===_0xbbad('0x4b')&&_0x5e660c[_0xbbad('0x21')]&&_0x5e660c[_0xbbad('0x20')]&&_0x5e660c[_0xbbad('0x4c')]){_0x55c97d[_0x5e660c[_0xbbad('0x21')]]&&_0xa183c2['custom_fields'][_0xbbad('0x1f')]({'id':_0x5e660c[_0xbbad('0x20')],'value':_0x55c97d[_0x5e660c[_0xbbad('0x21')]][_0xbbad('0x47')]()});}else if(_0x5e660c[_0xbbad('0x48')]===_0xbbad('0x4d')&&_0x5e660c['Variable']&&_0x5e660c[_0xbbad('0x4e')][_0xbbad('0x10')]&&_0x5e660c['idField']&&_0x5e660c[_0xbbad('0x4c')]){_0x55c97d[_0x5e660c[_0xbbad('0x4e')]['name'][_0xbbad('0x46')]()]&&_0xa183c2[_0xbbad('0x49')]['push']({'id':_0x5e660c['idField'],'value':_0x55c97d[_0x5e660c[_0xbbad('0x4e')][_0xbbad('0x10')][_0xbbad('0x46')]()][_0xbbad('0x47')]()});}});}return _0xa183c2;}function getConnection(_0x4748a1){return request({'method':_0xbbad('0xc'),'form':{'method':_0xbbad('0x4f'),'input_type':_0xbbad('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4748a1['username'],'password':_0x4748a1[_0xbbad('0x50')],'encryption':_0xbbad('0x51')},'application':_0xbbad('0x52')})}})[_0xbbad('0x2b')](function(_0x41ffcb){var _0x5df1a8=_0x41ffcb;if(_0x5df1a8['id']){def[_0xbbad('0x53')]=_0x5df1a8['id'];return BPromise['resolve'](_0x5df1a8);}else{throw new Error(util[_0xbbad('0x25')](_0xbbad('0x54'),_0x4748a1['id']));}});}function setRelationship(_0x458c47,_0x1ce653,_0x3503b3,_0x30a1da){return request({'form':{'method':'set_relationship','input_type':_0xbbad('0x22'),'response_type':_0xbbad('0x22'),'rest_data':JSON[_0xbbad('0x23')]({'session':_0x458c47['id'],'module_name':'Calls','module_id':_0x3503b3['id'],'link_field_name':_0x30a1da,'related_ids':[_0x1ce653['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbbad('0x55')]=function(_0xbe5719,_0x4048fe,_0x3f332a,_0x14c25a,_0x317542,_0x5dfd60){var _0x552e00,_0x3359f3,_0x3caf47,_0x465525;_0x5dfd60[_0xbbad('0x56')]=intUtil[_0xbbad('0x57')](_0x5dfd60[_0xbbad('0x56')]);_0x5dfd60[_0xbbad('0x58')]=intUtil[_0xbbad('0x57')](_0x5dfd60[_0xbbad('0x58')]);def[_0xbbad('0x59')]=util['format'](_0xbbad('0x5a'),_0x5dfd60[_0xbbad('0x56')]);if(_0x317542&&_0x317542[_0xbbad('0x5b')]){logger[_0xbbad('0xe')]('[QUEUE]',_0xbbad('0x5c'));_0x4048fe['recordingURL']=util[_0xbbad('0x25')](_0xbbad('0x5d'),_0x5dfd60[_0xbbad('0x58')],_0x4048fe[_0xbbad('0x5e')],md5(_0x4048fe[_0xbbad('0x5e')]));}else{_0x4048fe[_0xbbad('0x5f')]='';}return getConnection(_0x5dfd60)[_0xbbad('0x2b')](function(_0xedac3d){_0x465525=_0xedac3d;return getUser(_0x5dfd60,_0x14c25a[_0xbbad('0x10')],_0x465525);})[_0xbbad('0x2b')](function(_0x554b0a){_0x552e00=_0x554b0a;logger[_0xbbad('0xe')](_0xbbad('0x60'),_0x552e00['id']);return getEndUser(_0x5dfd60,_0x4048fe[_0xbbad('0x61')],_0x4048fe[_0xbbad('0x62')],_0x465525);})[_0xbbad('0x2b')](function(_0x29f7ce){_0x3359f3=_0x29f7ce;logger[_0xbbad('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3359f3['id']);return getTicket(_0x5dfd60,_0x552e00,_0x3359f3,_0x3f332a,_0x4048fe,_0x3f332a[_0xbbad('0x63')],_0x465525,_0xbbad('0x64'));})[_0xbbad('0x2b')](function(_0x38e774){_0x3caf47=_0x38e774;logger[_0xbbad('0xe')](_0xbbad('0x65'));logger['info'](_0xbbad('0x66'),_0x3caf47['id']);return setRelationship(_0x465525,_0x552e00,_0x3caf47,'users');})[_0xbbad('0x2b')](function(){return setRelationship(_0x465525,_0x3359f3,_0x3caf47,'contacts');})[_0xbbad('0x2b')](function(){return getServerInfo(_0x465525);})[_0xbbad('0x2b')](function(_0x5b5c42){var _0x582895=parseInt(_0x5b5c42[_0xbbad('0x67')][_0xbbad('0x68')](0x0));var _0x31c35f=util[_0xbbad('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5dfd60['remoteUri'],_0x3caf47['id']);if(_0x582895>0x6){_0x31c35f=util[_0xbbad('0x25')](_0xbbad('0x69'),_0x5dfd60['remoteUri'],_0x3caf47['id']);}logger[_0xbbad('0xe')](_0xbbad('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbbad('0x6b'),_0x14c25a[_0xbbad('0x10')]),_0xbbad('0x6c'),{'uri':_0x31c35f});})[_0xbbad('0x6d')](function(_0x176c54){logger[_0xbbad('0x6e')](_0xbbad('0x6a'),JSON['stringify'](_0x176c54));});};exports[_0xbbad('0x6f')]=function(_0x5eacf4,_0x56a6b4,_0x1e0418,_0x23cafd,_0x3bd6a5,_0x585b89,_0x418c7a){var _0x475f81,_0x460dd5,_0x3e286f,_0x2473c2;_0x585b89[_0xbbad('0x56')]=intUtil[_0xbbad('0x57')](_0x585b89['remoteUri']);_0x585b89[_0xbbad('0x58')]=intUtil[_0xbbad('0x57')](_0x585b89[_0xbbad('0x58')]);def[_0xbbad('0x59')]=util[_0xbbad('0x25')](_0xbbad('0x5a'),_0x585b89[_0xbbad('0x56')]);if(_0x418c7a&&_0x418c7a[_0xbbad('0x70')]&&_0x418c7a[_0xbbad('0x70')]!==_0xbbad('0x71')){logger['info'](_0xbbad('0x72'),_0xbbad('0x5c'));_0x56a6b4['recordingURL']=util[_0xbbad('0x25')](_0xbbad('0x5d'),_0x585b89['serverUrl'],_0x56a6b4[_0xbbad('0x5e')],md5(_0x56a6b4['uniqueid']));}return getConnection(_0x585b89)[_0xbbad('0x2b')](function(_0x368aff){_0x2473c2=_0x368aff;return getUser(_0x585b89,_0x23cafd[_0xbbad('0x10')],_0x2473c2);})[_0xbbad('0x2b')](function(_0x3c0064){_0x475f81=_0x3c0064;logger[_0xbbad('0xe')](_0xbbad('0x60'),_0x475f81['id']);return getEndUser(_0x585b89,_0x56a6b4[_0xbbad('0x73')],_0x56a6b4[_0xbbad('0x74')],_0x2473c2);})[_0xbbad('0x2b')](function(_0x494a7d){_0x460dd5=_0x494a7d;logger[_0xbbad('0xe')](_0xbbad('0x75'),_0x460dd5['id']);return getTicket(_0x585b89,_0x475f81,_0x460dd5,_0x1e0418,_0x56a6b4,_0x1e0418['Fields'],_0x2473c2,_0xbbad('0x76'));})[_0xbbad('0x2b')](function(_0x3b1742){_0x3e286f=_0x3b1742;logger[_0xbbad('0xe')]('Ticket\x20created!');logger[_0xbbad('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3e286f['id']);return setRelationship(_0x2473c2,_0x475f81,_0x3e286f,_0xbbad('0x77'));})[_0xbbad('0x2b')](function(){return setRelationship(_0x2473c2,_0x460dd5,_0x3e286f,_0xbbad('0x78'));})['then'](function(){return getServerInfo(_0x2473c2);})[_0xbbad('0x2b')](function(_0xe30165){var _0x3dc3c6=parseInt(_0xe30165[_0xbbad('0x67')]['charAt'](0x0));var _0x3b84fb=util[_0xbbad('0x25')](_0xbbad('0x79'),_0x585b89[_0xbbad('0x56')],_0x3e286f['id']);if(_0x3dc3c6>0x6){_0x3b84fb=util[_0xbbad('0x25')](_0xbbad('0x69'),_0x585b89[_0xbbad('0x56')],_0x3e286f['id']);}logger[_0xbbad('0xe')](_0xbbad('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbbad('0x25')]('user:%s',_0x23cafd[_0xbbad('0x10')]),'trigger:browser:url',{'uri':_0x3b84fb});})[_0xbbad('0x6d')](function(_0x16435a){logger[_0xbbad('0x6e')]('[OUTBOUND]',JSON[_0xbbad('0x23')](_0x16435a));});};exports['unmanaged']=function(_0x3b2c78,_0x5c51ae,_0x396cf8,_0x830fa0,_0x131dda,_0x1d7ab2){var _0x19eef5,_0x39095c,_0x1ed6d0,_0x348dad;_0x1d7ab2[_0xbbad('0x56')]=intUtil[_0xbbad('0x57')](_0x1d7ab2[_0xbbad('0x56')]);_0x1d7ab2['serverUrl']=intUtil[_0xbbad('0x57')](_0x1d7ab2['serverUrl']);def[_0xbbad('0x59')]=util[_0xbbad('0x25')](_0xbbad('0x5a'),_0x1d7ab2['remoteUri']);if(_0x131dda&&_0x131dda[_0xbbad('0x5b')]){logger['info']('['+_0x5c51ae[_0xbbad('0x7a')][_0xbbad('0x7b')]()+']',_0xbbad('0x5c'));_0x5c51ae[_0xbbad('0x5f')]=util[_0xbbad('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d7ab2['serverUrl'],_0x5c51ae[_0xbbad('0x5e')],md5(_0x5c51ae[_0xbbad('0x5e')]));}else{_0x5c51ae[_0xbbad('0x5f')]='';}return getConnection(_0x1d7ab2)[_0xbbad('0x2b')](function(_0xae2cc1){_0x348dad=_0xae2cc1;if(!_[_0xbbad('0x7c')](_0x830fa0)){return getUser(_0x1d7ab2,_0x830fa0[_0xbbad('0x10')],_0x348dad);}else{return getUser(_0x1d7ab2,null,_0x348dad);}})['then'](function(_0x24b16e){_0x19eef5=_0x24b16e;logger['info']('The\x20User\x20ID\x20is:',_0x19eef5['id']);return getEndUser(_0x1d7ab2,_0x5c51ae[_0xbbad('0x61')],_0x5c51ae[_0xbbad('0x62')],_0x348dad);})[_0xbbad('0x2b')](function(_0x5aa425){_0x39095c=_0x5aa425;logger[_0xbbad('0xe')](_0xbbad('0x75'),_0x39095c['id']);return getTicket(_0x1d7ab2,_0x19eef5,_0x39095c,_0x396cf8,_0x5c51ae,_0x396cf8[_0xbbad('0x63')],_0x348dad,'Inbound');})[_0xbbad('0x2b')](function(_0x12db60){_0x1ed6d0=_0x12db60;logger[_0xbbad('0xe')](_0xbbad('0x65'));logger[_0xbbad('0xe')](_0xbbad('0x66'),_0x1ed6d0['id']);return setRelationship(_0x348dad,_0x19eef5,_0x1ed6d0,_0xbbad('0x77'));})['then'](function(){return setRelationship(_0x348dad,_0x39095c,_0x1ed6d0,'contacts');})['then'](function(){return getServerInfo(_0x348dad);})['catch'](function(_0xa645c5){logger[_0xbbad('0x6e')]('['+_0x5c51ae[_0xbbad('0x7a')][_0xbbad('0x7b')]()+']',JSON['stringify'](_0xa645c5));});}; \ 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 e7c03f2..3918a50 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 _0x13f7=['validateEmail','isNil','test','getString','content','type','variable','variableName','push','customVariable','Variable','toLowerCase','name','toString','keyValue','keyType','string','key','format','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x3f16f5,_0x3d67a1){var _0x38c3f1=function(_0x5514ad){while(--_0x5514ad){_0x3f16f5['push'](_0x3f16f5['shift']());}};_0x38c3f1(++_0x3d67a1);}(_0x13f7,0x1e3));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');exports[_0x713f('0x0')]=function(_0x3e829e,_0xfa814d,_0x2fc00d){var _0x177678=[];if(_0x3e829e['length']>0x0){var _0x422abe=_['sortBy'](_0x3e829e,['id']);for(var _0x2033d0=0x0;_0x2033d0<_0x422abe['length'];_0x2033d0++){var _0x945514=_0x422abe[_0x2033d0];if(_0x945514['type']==='string'){_0x177678['push'](_0x945514[_0x713f('0x1')]);}else if(_0x945514[_0x713f('0x2')]===_0x713f('0x3')&&_0x945514[_0x713f('0x4')]){_0xfa814d[_0x945514['variableName']]&&_0x177678[_0x713f('0x5')](_0xfa814d[_0x945514[_0x713f('0x4')]]['toString']());}else if(_0x945514[_0x713f('0x2')]===_0x713f('0x6')&&_0x945514[_0x713f('0x7')]&&_0x945514[_0x713f('0x7')]['name']){_0xfa814d[_0x945514[_0x713f('0x7')]['name'][_0x713f('0x8')]()]&&_0x177678[_0x713f('0x5')](_0xfa814d[_0x945514['Variable'][_0x713f('0x9')][_0x713f('0x8')]()][_0x713f('0xa')]());}else if(_0x945514[_0x713f('0x2')]===_0x713f('0xb')){if(_0x945514[_0x713f('0xc')]===_0x713f('0xd')&&_0x945514[_0x713f('0xe')]){_0x177678['push'](util[_0x713f('0xf')](_0x713f('0x10'),_0x945514[_0x713f('0xe')],_0x945514['keyContent']));}else if(_0x945514[_0x713f('0xc')]==='variable'&&_0x945514[_0x713f('0x4')]&&_0x945514[_0x713f('0xe')]){_0xfa814d[_0x945514[_0x713f('0x4')]]&&_0x177678[_0x713f('0x5')](util[_0x713f('0xf')](_0x713f('0x10'),_0x945514['key'],_0xfa814d[_0x945514[_0x713f('0x4')]]));}else if(_0x945514[_0x713f('0xc')]==='customVariable'&&_0x945514[_0x713f('0x7')]&&_0x945514[_0x713f('0x7')][_0x713f('0x9')]&&_0x945514[_0x713f('0xe')]){_0xfa814d[_0x945514['Variable'][_0x713f('0x9')][_0x713f('0x8')]()]&&_0x177678[_0x713f('0x5')](util[_0x713f('0xf')](_0x713f('0x10'),_0x945514[_0x713f('0xe')],_0xfa814d[_0x945514[_0x713f('0x7')][_0x713f('0x9')]['toLowerCase']()]));}}}}return _0x177678['join'](_0x2fc00d);};exports[_0x713f('0x11')]=function(_0x158dcd){var _0x129c19=_0x158dcd[_0x713f('0x12')](-0x1);if(_0x129c19==='/'){_0x158dcd=_0x158dcd[_0x713f('0x13')](0x0,_0x158dcd[_0x713f('0x14')](_0x129c19));}return _0x158dcd;};exports[_0x713f('0x15')]=function(_0x4624e8){if(!_[_0x713f('0x16')](_0x4624e8)&&_0x4624e8!==''){var _0x2b5f97=/^(([^<>()\[\]\\.,;:\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 _0x2b5f97[_0x713f('0x17')](String(_0x4624e8)[_0x713f('0x8')]());}else{return![];}}; \ No newline at end of file +var _0x7b45=['name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','type','string','content','variable','variableName','push','toString','customVariable','Variable'];(function(_0xa6c837,_0x2eeaa5){var _0x5206dd=function(_0x1fb365){while(--_0x1fb365){_0xa6c837['push'](_0xa6c837['shift']());}};_0x5206dd(++_0x2eeaa5);}(_0x7b45,0x1cf));var _0x57b4=function(_0x5e10f8,_0x3a67bb){_0x5e10f8=_0x5e10f8-0x0;var _0x455320=_0x7b45[_0x5e10f8];return _0x455320;};'use strict';var _=require('lodash');var util=require(_0x57b4('0x0'));exports[_0x57b4('0x1')]=function(_0x2c1872,_0xd055f5,_0x3e76d7){var _0x669b0=[];if(_0x2c1872[_0x57b4('0x2')]>0x0){var _0x1b0f6b=_[_0x57b4('0x3')](_0x2c1872,['id']);for(var _0x1e72ee=0x0;_0x1e72ee<_0x1b0f6b[_0x57b4('0x2')];_0x1e72ee++){var _0x5bbbf1=_0x1b0f6b[_0x1e72ee];if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0x5')){_0x669b0['push'](_0x5bbbf1[_0x57b4('0x6')]);}else if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0x7')&&_0x5bbbf1[_0x57b4('0x8')]){_0xd055f5[_0x5bbbf1[_0x57b4('0x8')]]&&_0x669b0[_0x57b4('0x9')](_0xd055f5[_0x5bbbf1['variableName']][_0x57b4('0xa')]());}else if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0xb')&&_0x5bbbf1[_0x57b4('0xc')]&&_0x5bbbf1[_0x57b4('0xc')][_0x57b4('0xd')]){_0xd055f5[_0x5bbbf1[_0x57b4('0xc')][_0x57b4('0xd')]['toLowerCase']()]&&_0x669b0['push'](_0xd055f5[_0x5bbbf1['Variable'][_0x57b4('0xd')][_0x57b4('0xe')]()][_0x57b4('0xa')]());}else if(_0x5bbbf1[_0x57b4('0x4')]===_0x57b4('0xf')){if(_0x5bbbf1[_0x57b4('0x10')]===_0x57b4('0x5')&&_0x5bbbf1[_0x57b4('0x11')]){_0x669b0[_0x57b4('0x9')](util[_0x57b4('0x12')](_0x57b4('0x13'),_0x5bbbf1[_0x57b4('0x11')],_0x5bbbf1[_0x57b4('0x14')]));}else if(_0x5bbbf1[_0x57b4('0x10')]===_0x57b4('0x7')&&_0x5bbbf1[_0x57b4('0x8')]&&_0x5bbbf1[_0x57b4('0x11')]){_0xd055f5[_0x5bbbf1['variableName']]&&_0x669b0[_0x57b4('0x9')](util[_0x57b4('0x12')]('%s:\x20%s',_0x5bbbf1[_0x57b4('0x11')],_0xd055f5[_0x5bbbf1[_0x57b4('0x8')]]));}else if(_0x5bbbf1[_0x57b4('0x10')]===_0x57b4('0xb')&&_0x5bbbf1[_0x57b4('0xc')]&&_0x5bbbf1[_0x57b4('0xc')]['name']&&_0x5bbbf1[_0x57b4('0x11')]){_0xd055f5[_0x5bbbf1['Variable'][_0x57b4('0xd')][_0x57b4('0xe')]()]&&_0x669b0[_0x57b4('0x9')](util[_0x57b4('0x12')](_0x57b4('0x13'),_0x5bbbf1[_0x57b4('0x11')],_0xd055f5[_0x5bbbf1[_0x57b4('0xc')]['name'][_0x57b4('0xe')]()]));}}}}return _0x669b0['join'](_0x3e76d7);};exports[_0x57b4('0x15')]=function(_0x228fee){var _0x37b2f4=_0x228fee[_0x57b4('0x16')](-0x1);if(_0x37b2f4==='/'){_0x228fee=_0x228fee[_0x57b4('0x17')](0x0,_0x228fee[_0x57b4('0x18')](_0x37b2f4));}return _0x228fee;};exports[_0x57b4('0x19')]=function(_0x3a7c20){if(!_[_0x57b4('0x1a')](_0x3a7c20)&&_0x3a7c20!==''){var _0x2e7b4a=/^(([^<>()\[\]\\.,;:\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 _0x2e7b4a[_0x57b4('0x1b')](String(_0x3a7c20)['toLowerCase']());}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 b6e2d80..d9e905a 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x3a97cd,_0x22b897){var _0x351a04=function(_0x127334){while(--_0x127334){_0x3a97cd['push'](_0x3a97cd['shift']());}};_0x351a04(++_0x22b897);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x58966f,_0x5820f0){var _0xb0ec38=function(_0x5827ce){while(--_0x5827ce){_0x58966f['push'](_0x58966f['shift']());}};_0xb0ec38(++_0x5820f0);}(_0x34e8,0x12c));var _0x834e=function(_0x55f5fe,_0x2ec297){_0x55f5fe=_0x55f5fe-0x0;var _0x24f74f=_0x34e8[_0x55f5fe];return _0x24f74f;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9678809..9817402 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 _0x7fba=['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.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','map','forEach','includes','string','type','customField','nameField','content','picklist','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridnum','integrationTab','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','ioredis','./util','redis','defaults','socket.io-emitter','emit','application/json','format','%s/tickets.json','remoteUri','POST','getString','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x7fba,0xb3));var _0xa7fb=function(_0x19a383,_0x4d9250){_0x19a383=_0x19a383-0x0;var _0x326f2d=_0x7fba[_0x19a383];return _0x326f2d;};'use strict';var _=require(_0xa7fb('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0xa7fb('0x1'));var intUtil=require(_0xa7fb('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zendesk');config[_0xa7fb('0x3')]=_[_0xa7fb('0x4')](config[_0xa7fb('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xa7fb('0x5'))(new Redis(config[_0xa7fb('0x3')]));function emit(_0x5f4734,_0x5c4b20,_0x132488){io['to'](_0x5f4734)[_0xa7fb('0x6')](_0x5c4b20,_0x132488);}var headers={'Content-Type':_0xa7fb('0x7'),'Accept':_0xa7fb('0x7')};function getTicket(_0x140747,_0x39c781,_0x493504,_0x59dad9,_0x217e3a){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xa7fb('0x8')](_0xa7fb('0x9'),_0x140747[_0xa7fb('0xa')]),'method':_0xa7fb('0xb'),'body':{'ticket':_['merge']({'requester_id':_0x493504['id'],'submitter_id':_0x39c781?_0x39c781['id']:undefined,'assignee_id':_0x39c781?_0x39c781['id']:undefined,'tags':getTags(_0x59dad9['Tags'],'name'),'subject':intUtil[_0xa7fb('0xc')](_0x59dad9['Subjects'],_0x217e3a,'\x20'),'description':intUtil[_0xa7fb('0xc')](_0x59dad9['Descriptions'],_0x217e3a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa7fb('0xc')](_0x59dad9['Descriptions'],_0x217e3a,'\x0a')}},getCustomFields(_0x59dad9[_0xa7fb('0xd')],_0x217e3a))}})[_0xa7fb('0xe')](function(_0x10e3ef){logger[_0xa7fb('0xf')](_0xa7fb('0x10'));return _0x10e3ef[_0xa7fb('0x11')];});}function getUser(_0x383d86,_0x245a50){if(intUtil[_0xa7fb('0x12')](_0x245a50)){logger[_0xa7fb('0xf')](_0xa7fb('0x13'),_0x245a50);return request({'uri':util[_0xa7fb('0x8')](_0xa7fb('0x14'),_0x383d86[_0xa7fb('0xa')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x245a50)}})['then'](function(_0x37b41a){if(_0x37b41a['count']){logger[_0xa7fb('0xf')]('Agent\x20found!');return _[_0xa7fb('0x15')](_0x37b41a[_0xa7fb('0x16')],{'email':_0x245a50,'role':_0xa7fb('0x17')});}else{logger[_0xa7fb('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa7fb('0x8')]('%s/users/me.json',_0x383d86[_0xa7fb('0xa')])})[_0xa7fb('0xe')](function(_0x2ceeb6){logger['info'](_0xa7fb('0x18'));return _0x2ceeb6[_0xa7fb('0x19')];});}});}else{logger[_0xa7fb('0xf')](_0xa7fb('0x1a'));return request({'uri':util['format'](_0xa7fb('0x1b'),_0x383d86['remoteUri'])})[_0xa7fb('0xe')](function(_0x37ce4c){logger[_0xa7fb('0xf')](_0xa7fb('0x18'));return _0x37ce4c[_0xa7fb('0x19')];});}}function getEndUser(_0x16fb09,_0x1d466c,_0x229fe3){logger[_0xa7fb('0xf')](_0xa7fb('0x1c'),_0x229fe3);return request({'uri':util[_0xa7fb('0x8')]('%s/search.json',_0x16fb09[_0xa7fb('0xa')]),'qs':{'query':util['format'](_0xa7fb('0x1d'),_0x229fe3)}})[_0xa7fb('0xe')](function(_0x114c2d){var _0xa9bce0;if(_0x114c2d[_0xa7fb('0x16')][_0xa7fb('0x1e')]){_0x114c2d[_0xa7fb('0x16')]=_[_0xa7fb('0x1f')](_0x114c2d[_0xa7fb('0x16')],{'suspended':![],'role':_0xa7fb('0x20')});if(_0x114c2d[_0xa7fb('0x16')][_0xa7fb('0x1e')]){_0xa9bce0=_[_0xa7fb('0x21')](_0x114c2d['results']);}}if(_0xa9bce0){logger[_0xa7fb('0xf')](_0xa7fb('0x22'));return _0xa9bce0;}else{logger['info'](_0xa7fb('0x23'));return request({'uri':util[_0xa7fb('0x8')]('%s/users.json',_0x16fb09['remoteUri']),'method':_0xa7fb('0xb'),'body':{'user':{'role':'end-user','name':util[_0xa7fb('0x8')](_0xa7fb('0x24'),_0x1d466c||_0x229fe3),'phone':_0x229fe3}}})[_0xa7fb('0xe')](function(_0x1c9651){logger[_0xa7fb('0xf')](_0xa7fb('0x25'));return _0x1c9651[_0xa7fb('0x19')];});}});}function getAuth(_0x39fd75){var _0x5983b8;if(_0x39fd75[_0xa7fb('0x26')]===_0xa7fb('0x27')){_0x5983b8=util[_0xa7fb('0x8')](_0xa7fb('0x28'),_0x39fd75[_0xa7fb('0x29')],_0x39fd75['password']);}else if(_0x39fd75[_0xa7fb('0x26')]==='token'){_0x5983b8=util[_0xa7fb('0x8')](_0xa7fb('0x2a'),_0x39fd75[_0xa7fb('0x29')],_0x39fd75['token']);}return util[_0xa7fb('0x8')](_0xa7fb('0x2b'),new Buffer(_0x5983b8)[_0xa7fb('0x2c')]('base64'));}function request(_0x52b21d){logger['debug']('[HTTP]',JSON['stringify'](_0x52b21d));return rp(_[_0xa7fb('0x4')](_0x52b21d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x37d359,_0x5f0019){var _0x236db4=[];if(_0x37d359&&_0x37d359[_0xa7fb('0x1e')]>0x0){_0x236db4=_[_0xa7fb('0x2d')](_0x37d359,_0x5f0019);}return _0x236db4;}function getCustomFields(_0x59a625,_0x3c3c97){var _0x2397a8=[];var _0x3d520a={'custom_fields':[]};if(_0x59a625[_0xa7fb('0x1e')]>0x0){_[_0xa7fb('0x2e')](_0x59a625,function(_0x59fb4a){if(_[_0xa7fb('0x2f')]([_0xa7fb('0x30'),'picklist'],_0x59fb4a[_0xa7fb('0x31')])&&_0x59fb4a['nameField']&&!_0x59fb4a[_0xa7fb('0x32')]){_0x3d520a[_0x59fb4a[_0xa7fb('0x33')]['toLowerCase']()]=_0x59fb4a[_0xa7fb('0x34')][_0xa7fb('0x2c')]();}else if(_[_0xa7fb('0x2f')](['string',_0xa7fb('0x35')],_0x59fb4a[_0xa7fb('0x31')])&&_0x59fb4a[_0xa7fb('0x36')]&&_0x59fb4a['customField']){_0x3d520a[_0xa7fb('0x37')][_0xa7fb('0x38')]({'id':_0x59fb4a[_0xa7fb('0x36')],'value':_0x59fb4a[_0xa7fb('0x34')][_0xa7fb('0x2c')]()});}else if(_0x59fb4a['type']===_0xa7fb('0x39')&&_0x59fb4a[_0xa7fb('0x3a')]&&_0x59fb4a[_0xa7fb('0x36')]&&_0x59fb4a[_0xa7fb('0x32')]){_0x3c3c97[_0x59fb4a['variableName']]&&_0x3d520a['custom_fields']['push']({'id':_0x59fb4a[_0xa7fb('0x36')],'value':_0x3c3c97[_0x59fb4a['variableName']]['toString']()});}else if(_0x59fb4a[_0xa7fb('0x31')]===_0xa7fb('0x3b')&&_0x59fb4a[_0xa7fb('0x3c')]&&_0x59fb4a['Variable']['name']&&_0x59fb4a[_0xa7fb('0x36')]&&_0x59fb4a[_0xa7fb('0x32')]){_0x3c3c97[_0x59fb4a[_0xa7fb('0x3c')][_0xa7fb('0x3d')][_0xa7fb('0x3e')]()]&&_0x3d520a['custom_fields'][_0xa7fb('0x38')]({'id':_0x59fb4a['idField'],'value':_0x3c3c97[_0x59fb4a['Variable']['name'][_0xa7fb('0x3e')]()][_0xa7fb('0x2c')]()});}});}return _0x3d520a;}exports[_0xa7fb('0x3f')]=function(_0x305573,_0x11a424,_0x1bfac1,_0x37523f,_0x4762c7,_0x31852b){var _0x2f7ff7,_0x3e20a9;_0x31852b[_0xa7fb('0xa')]=intUtil[_0xa7fb('0x40')](_0x31852b['remoteUri']);_0x31852b['serverUrl']=intUtil['stripTrailingSlash'](_0x31852b[_0xa7fb('0x41')]);if(_0x4762c7&&_0x4762c7['monitor_format']){logger[_0xa7fb('0xf')](_0xa7fb('0x42'),_0xa7fb('0x43'));_0x11a424[_0xa7fb('0x44')]=util[_0xa7fb('0x8')](_0xa7fb('0x45'),_0x31852b[_0xa7fb('0x41')],_0x11a424[_0xa7fb('0x46')],md5(_0x11a424[_0xa7fb('0x46')]));}else{_0x11a424[_0xa7fb('0x44')]='';}headers[_0xa7fb('0x47')]=getAuth(_0x31852b);return getUser(_0x31852b,_0x37523f['email'])['then'](function(_0x5a468c){_0x2f7ff7=_0x5a468c;logger[_0xa7fb('0xf')](_0xa7fb('0x48'),_0x2f7ff7['id']);return getEndUser(_0x31852b,_0x11a424[_0xa7fb('0x49')],_0x11a424['calleridnum']);})[_0xa7fb('0xe')](function(_0x2490ab){_0x3e20a9=_0x2490ab;logger[_0xa7fb('0xf')](_0xa7fb('0x4a'),_0x3e20a9['id']);return getTicket(_0x31852b,_0x2f7ff7,_0x3e20a9,_0x1bfac1,_0x11a424);})[_0xa7fb('0xe')](function(_0x489c23){if(_0x489c23){logger['info'](_0xa7fb('0x4b'),_0x489c23['id']);switch(_0x31852b[_0xa7fb('0x31')]){case'integrationTab':logger[_0xa7fb('0xf')](_0xa7fb('0x42'),_0xa7fb('0x4c'));return request({'uri':util['format'](_0xa7fb('0x4d'),_0x31852b['remoteUri'],_0x2f7ff7['id'],_0x489c23['id']),'method':_0xa7fb('0xb')});case _0xa7fb('0x4e'):logger['info'](_0xa7fb('0x42'),_0xa7fb('0x4f'));emit(util['format'](_0xa7fb('0x50'),_0x37523f[_0xa7fb('0x3d')]),_0xa7fb('0x51'),{'uri':util[_0xa7fb('0x8')](_0xa7fb('0x52'),_0x31852b[_0xa7fb('0xa')][_0xa7fb('0x53')]('/api/v2',''),_0x489c23['id'])});break;default:logger['error'](_0xa7fb('0x42'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xa7fb('0x54')](function(_0x2d36c2){logger[_0xa7fb('0x55')](_0xa7fb('0x56'),util[_0xa7fb('0x57')](_0x2d36c2,{'showHidden':!![],'depth':null}));});};exports[_0xa7fb('0x58')]=function(_0x4c63d9,_0x1c5c04,_0x3826c4,_0x219a2c,_0x3deecb,_0x279e91,_0x490a07){var _0xb24ca5,_0x33e15e;_0x279e91[_0xa7fb('0xa')]=intUtil[_0xa7fb('0x40')](_0x279e91['remoteUri']);_0x279e91['serverUrl']=intUtil[_0xa7fb('0x40')](_0x279e91[_0xa7fb('0x41')]);if(_0x490a07&&_0x490a07[_0xa7fb('0x59')]&&_0x490a07[_0xa7fb('0x59')]!==_0xa7fb('0x5a')){logger['info'](_0xa7fb('0x5b'),_0xa7fb('0x43'));_0x1c5c04['recordingURL']=util[_0xa7fb('0x8')](_0xa7fb('0x45'),_0x279e91['serverUrl'],_0x1c5c04[_0xa7fb('0x46')],md5(_0x1c5c04['uniqueid']));}headers[_0xa7fb('0x47')]=getAuth(_0x279e91);return getUser(_0x279e91,_0x219a2c[_0xa7fb('0x5c')])[_0xa7fb('0xe')](function(_0x336bc3){_0xb24ca5=_0x336bc3;logger[_0xa7fb('0xf')](_0xa7fb('0x48'),_0xb24ca5['id']);return getEndUser(_0x279e91,_0x1c5c04['destcalleridname'],_0x1c5c04[_0xa7fb('0x5d')]);})['then'](function(_0x4d88c1){_0x33e15e=_0x4d88c1;logger[_0xa7fb('0xf')](_0xa7fb('0x4a'),_0x33e15e['id']);return getTicket(_0x279e91,_0xb24ca5,_0x33e15e,_0x3826c4,_0x1c5c04);})[_0xa7fb('0xe')](function(_0x5d6163){if(_0x5d6163){logger[_0xa7fb('0xf')](_0xa7fb('0x4b'),_0x5d6163['id']);switch(_0x279e91['type']){case _0xa7fb('0x5e'):logger[_0xa7fb('0xf')](_0xa7fb('0x5b'),_0xa7fb('0x4c'));return request({'uri':util[_0xa7fb('0x8')](_0xa7fb('0x4d'),_0x279e91[_0xa7fb('0xa')],_0xb24ca5['id'],_0x5d6163['id']),'method':_0xa7fb('0xb')});case _0xa7fb('0x4e'):logger[_0xa7fb('0xf')](_0xa7fb('0x5b'),_0xa7fb('0x4f'));emit(util['format'](_0xa7fb('0x50'),_0x219a2c[_0xa7fb('0x3d')]),_0xa7fb('0x51'),{'uri':util[_0xa7fb('0x8')](_0xa7fb('0x52'),_0x279e91[_0xa7fb('0xa')][_0xa7fb('0x53')](_0xa7fb('0x5f'),''),_0x5d6163['id'])});break;default:logger[_0xa7fb('0x55')](_0xa7fb('0x5b'),_0xa7fb('0x60'));}}})[_0xa7fb('0x54')](function(_0x27cc22){logger[_0xa7fb('0x55')](_0xa7fb('0x61'),util['inspect'](_0x27cc22,{'showHidden':!![],'depth':null}));});};exports[_0xa7fb('0x62')]=function(_0x6f9010,_0x16e65b,_0x14be92,_0x50f1af,_0x18e0af,_0x5be702){var _0x179c8f,_0x4e2892;_0x5be702[_0xa7fb('0xa')]=intUtil[_0xa7fb('0x40')](_0x5be702[_0xa7fb('0xa')]);_0x5be702['serverUrl']=intUtil[_0xa7fb('0x40')](_0x5be702['serverUrl']);if(_0x18e0af&&_0x18e0af[_0xa7fb('0x63')]){logger['info']('['+_0x16e65b[_0xa7fb('0x64')][_0xa7fb('0x65')]()+']',_0xa7fb('0x43'));_0x16e65b[_0xa7fb('0x44')]=util[_0xa7fb('0x8')](_0xa7fb('0x45'),_0x5be702[_0xa7fb('0x41')],_0x16e65b[_0xa7fb('0x46')],md5(_0x16e65b[_0xa7fb('0x46')]));}else{_0x16e65b[_0xa7fb('0x44')]='';}headers[_0xa7fb('0x47')]=getAuth(_0x5be702);return getUser(_0x5be702)['then'](function(_0x2eb719){_0x179c8f=_0x2eb719;logger[_0xa7fb('0xf')]('The\x20User\x20ID\x20is:',_0x179c8f['id']);return getEndUser(_0x5be702,_0x16e65b['calleridname'],_0x16e65b[_0xa7fb('0x66')]);})[_0xa7fb('0xe')](function(_0x17a131){_0x4e2892=_0x17a131;logger[_0xa7fb('0xf')](_0xa7fb('0x4a'),_0x4e2892['id']);return getTicket(_0x5be702,_0x179c8f,_0x4e2892,_0x14be92,_0x16e65b);})['then'](function(_0x4ffdfe){if(_0x4ffdfe){logger[_0xa7fb('0xf')](_0xa7fb('0x4b'),_0x4ffdfe['id']);}})[_0xa7fb('0x54')](function(_0x585d06){logger[_0xa7fb('0x55')]('['+_0x16e65b[_0xa7fb('0x64')][_0xa7fb('0x65')]()+']'+_0xa7fb('0x67'),util[_0xa7fb('0x57')](_0x585d06,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd889=['application/json','info','%s/tickets.json','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','password','username','token','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','toLowerCase','content','toString','string','idField','customField','push','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x4cd97c,_0x14c3c0){var _0x56cd54=function(_0xb2772a){while(--_0xb2772a){_0x4cd97c['push'](_0x4cd97c['shift']());}};_0x56cd54(++_0x14c3c0);}(_0xd889,0x65));var _0x9d88=function(_0x1782dd,_0x5d7d27){_0x1782dd=_0x1782dd-0x0;var _0x446b7b=_0xd889[_0x1782dd];return _0x446b7b;};'use strict';var _=require(_0x9d88('0x0'));var rp=require(_0x9d88('0x1'));var md5=require(_0x9d88('0x2'));var util=require(_0x9d88('0x3'));var Redis=require(_0x9d88('0x4'));var intUtil=require(_0x9d88('0x5'));var config=require('../../../../config/environment');var logger=require(_0x9d88('0x6'))(_0x9d88('0x7'));config[_0x9d88('0x8')]=_[_0x9d88('0x9')](config[_0x9d88('0x8')],{'host':_0x9d88('0xa'),'port':0x18eb});var io=require(_0x9d88('0xb'))(new Redis(config[_0x9d88('0x8')]));function emit(_0x1cbfed,_0x563b93,_0x5d07d6){io['to'](_0x1cbfed)[_0x9d88('0xc')](_0x563b93,_0x5d07d6);}var headers={'Content-Type':_0x9d88('0xd'),'Accept':'application/json'};function getTicket(_0x45cc93,_0x16db6b,_0x24cd3d,_0x2e7b46,_0x1c79b9){logger[_0x9d88('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x9d88('0xf'),_0x45cc93['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x24cd3d['id'],'submitter_id':_0x16db6b?_0x16db6b['id']:undefined,'assignee_id':_0x16db6b?_0x16db6b['id']:undefined,'tags':getTags(_0x2e7b46['Tags'],_0x9d88('0x10')),'subject':intUtil[_0x9d88('0x11')](_0x2e7b46['Subjects'],_0x1c79b9,'\x20'),'description':intUtil['getString'](_0x2e7b46[_0x9d88('0x12')],_0x1c79b9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9d88('0x11')](_0x2e7b46['Descriptions'],_0x1c79b9,'\x0a')}},getCustomFields(_0x2e7b46[_0x9d88('0x13')],_0x1c79b9))}})[_0x9d88('0x14')](function(_0x9c233a){logger[_0x9d88('0xe')]('Ticket\x20created!');return _0x9c233a[_0x9d88('0x15')];});}function getUser(_0x1c46ca,_0x4b74d3){if(intUtil[_0x9d88('0x16')](_0x4b74d3)){logger[_0x9d88('0xe')](_0x9d88('0x17'),_0x4b74d3);return request({'uri':util[_0x9d88('0x18')]('%s/search.json',_0x1c46ca[_0x9d88('0x19')]),'qs':{'query':util[_0x9d88('0x18')](_0x9d88('0x1a'),_0x4b74d3)}})['then'](function(_0x2fcb49){if(_0x2fcb49[_0x9d88('0x1b')]){logger[_0x9d88('0xe')]('Agent\x20found!');return _[_0x9d88('0x1c')](_0x2fcb49[_0x9d88('0x1d')],{'email':_0x4b74d3,'role':_0x9d88('0x1e')});}else{logger[_0x9d88('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x1f'),_0x1c46ca[_0x9d88('0x19')])})[_0x9d88('0x14')](function(_0x4263dc){logger['info'](_0x9d88('0x20'));return _0x4263dc[_0x9d88('0x21')];});}});}else{logger['info'](_0x9d88('0x22'));return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x1f'),_0x1c46ca[_0x9d88('0x19')])})['then'](function(_0x44ffb2){logger['info']('Admin\x20account\x20selected.');return _0x44ffb2[_0x9d88('0x21')];});}}function getEndUser(_0xd7780a,_0x591996,_0x2ff852){logger[_0x9d88('0xe')](_0x9d88('0x23'),_0x2ff852);return request({'uri':util['format'](_0x9d88('0x24'),_0xd7780a[_0x9d88('0x19')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2ff852)}})[_0x9d88('0x14')](function(_0x1ec647){var _0xa4a16e;if(_0x1ec647['results'][_0x9d88('0x25')]){_0x1ec647[_0x9d88('0x1d')]=_[_0x9d88('0x26')](_0x1ec647[_0x9d88('0x1d')],{'suspended':![],'role':'end-user'});if(_0x1ec647[_0x9d88('0x1d')][_0x9d88('0x25')]){_0xa4a16e=_[_0x9d88('0x27')](_0x1ec647[_0x9d88('0x1d')]);}}if(_0xa4a16e){logger['info'](_0x9d88('0x28'));return _0xa4a16e;}else{logger[_0x9d88('0xe')](_0x9d88('0x29'));return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x2a'),_0xd7780a[_0x9d88('0x19')]),'method':_0x9d88('0x2b'),'body':{'user':{'role':_0x9d88('0x2c'),'name':util[_0x9d88('0x18')](_0x9d88('0x2d'),_0x591996||_0x2ff852),'phone':_0x2ff852}}})[_0x9d88('0x14')](function(_0x85ec76){logger['info'](_0x9d88('0x2e'));return _0x85ec76[_0x9d88('0x21')];});}});}function getAuth(_0x3f5f11){var _0x2e1ccf;if(_0x3f5f11[_0x9d88('0x2f')]==='password'){_0x2e1ccf=util[_0x9d88('0x18')](_0x9d88('0x30'),_0x3f5f11['username'],_0x3f5f11[_0x9d88('0x31')]);}else if(_0x3f5f11[_0x9d88('0x2f')]==='token'){_0x2e1ccf=util[_0x9d88('0x18')]('%s/token:%s',_0x3f5f11[_0x9d88('0x32')],_0x3f5f11[_0x9d88('0x33')]);}return util[_0x9d88('0x18')]('Basic\x20%s',new Buffer(_0x2e1ccf)['toString'](_0x9d88('0x34')));}function request(_0x5eca35){logger[_0x9d88('0x35')](_0x9d88('0x36'),JSON[_0x9d88('0x37')](_0x5eca35));return rp(_[_0x9d88('0x9')](_0x5eca35,{'method':_0x9d88('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4bd2f5,_0x1a6523){var _0x11a0bb=[];if(_0x4bd2f5&&_0x4bd2f5['length']>0x0){_0x11a0bb=_[_0x9d88('0x39')](_0x4bd2f5,_0x1a6523);}return _0x11a0bb;}function getCustomFields(_0x1aef77,_0x467a27){var _0x522792=[];var _0x564fc8={'custom_fields':[]};if(_0x1aef77[_0x9d88('0x25')]>0x0){_[_0x9d88('0x3a')](_0x1aef77,function(_0x19b4fc){if(_[_0x9d88('0x3b')](['string',_0x9d88('0x3c')],_0x19b4fc[_0x9d88('0x3d')])&&_0x19b4fc['nameField']&&!_0x19b4fc['customField']){_0x564fc8[_0x19b4fc['nameField'][_0x9d88('0x3e')]()]=_0x19b4fc[_0x9d88('0x3f')][_0x9d88('0x40')]();}else if(_[_0x9d88('0x3b')]([_0x9d88('0x41'),_0x9d88('0x3c')],_0x19b4fc[_0x9d88('0x3d')])&&_0x19b4fc[_0x9d88('0x42')]&&_0x19b4fc[_0x9d88('0x43')]){_0x564fc8['custom_fields'][_0x9d88('0x44')]({'id':_0x19b4fc[_0x9d88('0x42')],'value':_0x19b4fc[_0x9d88('0x3f')]['toString']()});}else if(_0x19b4fc[_0x9d88('0x3d')]==='variable'&&_0x19b4fc[_0x9d88('0x45')]&&_0x19b4fc[_0x9d88('0x42')]&&_0x19b4fc[_0x9d88('0x43')]){_0x467a27[_0x19b4fc[_0x9d88('0x45')]]&&_0x564fc8[_0x9d88('0x46')][_0x9d88('0x44')]({'id':_0x19b4fc[_0x9d88('0x42')],'value':_0x467a27[_0x19b4fc[_0x9d88('0x45')]][_0x9d88('0x40')]()});}else if(_0x19b4fc['type']===_0x9d88('0x47')&&_0x19b4fc[_0x9d88('0x48')]&&_0x19b4fc['Variable'][_0x9d88('0x10')]&&_0x19b4fc[_0x9d88('0x42')]&&_0x19b4fc[_0x9d88('0x43')]){_0x467a27[_0x19b4fc[_0x9d88('0x48')][_0x9d88('0x10')][_0x9d88('0x3e')]()]&&_0x564fc8['custom_fields']['push']({'id':_0x19b4fc[_0x9d88('0x42')],'value':_0x467a27[_0x19b4fc[_0x9d88('0x48')][_0x9d88('0x10')][_0x9d88('0x3e')]()]['toString']()});}});}return _0x564fc8;}exports[_0x9d88('0x49')]=function(_0x11023f,_0x253c7b,_0x16271e,_0x1f6e9f,_0x4329d9,_0x20d013){var _0x5809df,_0x185625;_0x20d013[_0x9d88('0x19')]=intUtil[_0x9d88('0x4a')](_0x20d013[_0x9d88('0x19')]);_0x20d013['serverUrl']=intUtil['stripTrailingSlash'](_0x20d013[_0x9d88('0x4b')]);if(_0x4329d9&&_0x4329d9[_0x9d88('0x4c')]){logger[_0x9d88('0xe')](_0x9d88('0x4d'),_0x9d88('0x4e'));_0x253c7b[_0x9d88('0x4f')]=util['format'](_0x9d88('0x50'),_0x20d013[_0x9d88('0x4b')],_0x253c7b[_0x9d88('0x51')],md5(_0x253c7b[_0x9d88('0x51')]));}else{_0x253c7b['recordingURL']='';}headers[_0x9d88('0x52')]=getAuth(_0x20d013);return getUser(_0x20d013,_0x1f6e9f[_0x9d88('0x53')])[_0x9d88('0x14')](function(_0x414567){_0x5809df=_0x414567;logger['info'](_0x9d88('0x54'),_0x5809df['id']);return getEndUser(_0x20d013,_0x253c7b[_0x9d88('0x55')],_0x253c7b[_0x9d88('0x56')]);})[_0x9d88('0x14')](function(_0x343766){_0x185625=_0x343766;logger[_0x9d88('0xe')](_0x9d88('0x57'),_0x185625['id']);return getTicket(_0x20d013,_0x5809df,_0x185625,_0x16271e,_0x253c7b);})['then'](function(_0x31f822){if(_0x31f822){logger['info'](_0x9d88('0x58'),_0x31f822['id']);switch(_0x20d013[_0x9d88('0x3d')]){case _0x9d88('0x59'):logger['info'](_0x9d88('0x4d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9d88('0x18')](_0x9d88('0x5a'),_0x20d013['remoteUri'],_0x5809df['id'],_0x31f822['id']),'method':_0x9d88('0x2b')});case _0x9d88('0x5b'):logger[_0x9d88('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d88('0x18')](_0x9d88('0x5c'),_0x1f6e9f[_0x9d88('0x10')]),_0x9d88('0x5d'),{'uri':util[_0x9d88('0x18')](_0x9d88('0x5e'),_0x20d013[_0x9d88('0x19')][_0x9d88('0x5f')](_0x9d88('0x60'),''),_0x31f822['id'])});break;default:logger[_0x9d88('0x61')]('[QUEUE]',_0x9d88('0x62'));}}})[_0x9d88('0x63')](function(_0x5a3336){logger[_0x9d88('0x61')](_0x9d88('0x64'),util['inspect'](_0x5a3336,{'showHidden':!![],'depth':null}));});};exports[_0x9d88('0x65')]=function(_0x2034d9,_0x396a71,_0x4d9dd0,_0xe0ad8d,_0x1b3453,_0x2b3a76,_0x36aa62){var _0x2a74bf,_0x3b9936;_0x2b3a76['remoteUri']=intUtil[_0x9d88('0x4a')](_0x2b3a76[_0x9d88('0x19')]);_0x2b3a76[_0x9d88('0x4b')]=intUtil[_0x9d88('0x4a')](_0x2b3a76[_0x9d88('0x4b')]);if(_0x36aa62&&_0x36aa62[_0x9d88('0x66')]&&_0x36aa62[_0x9d88('0x66')]!==_0x9d88('0x67')){logger[_0x9d88('0xe')]('[OUTBOUND]',_0x9d88('0x4e'));_0x396a71[_0x9d88('0x4f')]=util[_0x9d88('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b3a76[_0x9d88('0x4b')],_0x396a71['uniqueid'],md5(_0x396a71['uniqueid']));}headers[_0x9d88('0x52')]=getAuth(_0x2b3a76);return getUser(_0x2b3a76,_0xe0ad8d[_0x9d88('0x53')])[_0x9d88('0x14')](function(_0x288c94){_0x2a74bf=_0x288c94;logger['info'](_0x9d88('0x54'),_0x2a74bf['id']);return getEndUser(_0x2b3a76,_0x396a71[_0x9d88('0x68')],_0x396a71[_0x9d88('0x69')]);})['then'](function(_0x6158ba){_0x3b9936=_0x6158ba;logger[_0x9d88('0xe')](_0x9d88('0x57'),_0x3b9936['id']);return getTicket(_0x2b3a76,_0x2a74bf,_0x3b9936,_0x4d9dd0,_0x396a71);})[_0x9d88('0x14')](function(_0x682d64){if(_0x682d64){logger[_0x9d88('0xe')](_0x9d88('0x58'),_0x682d64['id']);switch(_0x2b3a76[_0x9d88('0x3d')]){case'integrationTab':logger[_0x9d88('0xe')](_0x9d88('0x6a'),_0x9d88('0x6b'));return request({'uri':util[_0x9d88('0x18')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2b3a76['remoteUri'],_0x2a74bf['id'],_0x682d64['id']),'method':_0x9d88('0x2b')});case _0x9d88('0x5b'):logger[_0x9d88('0xe')](_0x9d88('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d88('0x18')](_0x9d88('0x5c'),_0xe0ad8d[_0x9d88('0x10')]),_0x9d88('0x5d'),{'uri':util[_0x9d88('0x18')](_0x9d88('0x5e'),_0x2b3a76['remoteUri'][_0x9d88('0x5f')](_0x9d88('0x60'),''),_0x682d64['id'])});break;default:logger[_0x9d88('0x61')](_0x9d88('0x6a'),_0x9d88('0x62'));}}})['catch'](function(_0x23f2a1){logger[_0x9d88('0x61')](_0x9d88('0x6c'),util[_0x9d88('0x6d')](_0x23f2a1,{'showHidden':!![],'depth':null}));});};exports[_0x9d88('0x6e')]=function(_0x3299bc,_0xdedb5e,_0x24f56d,_0x24b00f,_0x284ebd,_0x39b2bf){var _0x5e77ad,_0x1e8d79;_0x39b2bf[_0x9d88('0x19')]=intUtil['stripTrailingSlash'](_0x39b2bf[_0x9d88('0x19')]);_0x39b2bf[_0x9d88('0x4b')]=intUtil[_0x9d88('0x4a')](_0x39b2bf[_0x9d88('0x4b')]);if(_0x284ebd&&_0x284ebd[_0x9d88('0x4c')]){logger[_0x9d88('0xe')]('['+_0xdedb5e[_0x9d88('0x6f')][_0x9d88('0x70')]()+']',_0x9d88('0x4e'));_0xdedb5e['recordingURL']=util[_0x9d88('0x18')](_0x9d88('0x50'),_0x39b2bf[_0x9d88('0x4b')],_0xdedb5e[_0x9d88('0x51')],md5(_0xdedb5e[_0x9d88('0x51')]));}else{_0xdedb5e[_0x9d88('0x4f')]='';}headers[_0x9d88('0x52')]=getAuth(_0x39b2bf);return getUser(_0x39b2bf)[_0x9d88('0x14')](function(_0x19e03b){_0x5e77ad=_0x19e03b;logger[_0x9d88('0xe')](_0x9d88('0x54'),_0x5e77ad['id']);return getEndUser(_0x39b2bf,_0xdedb5e['calleridname'],_0xdedb5e['calleridnum']);})[_0x9d88('0x14')](function(_0x3d3410){_0x1e8d79=_0x3d3410;logger[_0x9d88('0xe')](_0x9d88('0x57'),_0x1e8d79['id']);return getTicket(_0x39b2bf,_0x5e77ad,_0x1e8d79,_0x24f56d,_0xdedb5e);})['then'](function(_0x2060f8){if(_0x2060f8){logger[_0x9d88('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2060f8['id']);}})[_0x9d88('0x63')](function(_0x2ed053){logger[_0x9d88('0x61')]('['+_0xdedb5e[_0x9d88('0x6f')][_0x9d88('0x70')]()+']'+_0x9d88('0x71'),util[_0x9d88('0x6d')](_0x2ed053,{'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 8dc7e2f..0349f35 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 _0xee39=['The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','user:%s','monitor_format','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','[HTTP]','length','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','findIndex','users','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','log','GET','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum'];(function(_0xa06aa1,_0x23c659){var _0x471e0a=function(_0x3d8ca3){while(--_0x3d8ca3){_0xa06aa1['push'](_0xa06aa1['shift']());}};_0x471e0a(++_0x23c659);}(_0xee39,0x1e6));var _0x9ee3=function(_0x354cfc,_0x54f2d4){_0x354cfc=_0x354cfc-0x0;var _0x351f3c=_0xee39[_0x354cfc];return _0x351f3c;};'use strict';var _=require(_0x9ee3('0x0'));var rp=require(_0x9ee3('0x1'));var md5=require(_0x9ee3('0x2'));var util=require('util');var intUtil=require(_0x9ee3('0x3'));var moment=require(_0x9ee3('0x4'));var Redis=require(_0x9ee3('0x5'));var BPromise=require(_0x9ee3('0x6'));var config=require(_0x9ee3('0x7'));var logger=require(_0x9ee3('0x8'))(_0x9ee3('0x9'));config[_0x9ee3('0xa')]=_[_0x9ee3('0xb')](config[_0x9ee3('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9ee3('0xc'))(new Redis(config[_0x9ee3('0xa')]));function emit(_0x22c8fc,_0x4d1a57,_0x206442){io['to'](_0x22c8fc)['emit'](_0x4d1a57,_0x206442);}function request(_0x1bde67){logger['debug'](_0x9ee3('0xd'),JSON['stringify'](_0x1bde67));return rp(_0x1bde67);}function getCustomFields(_0x577593,_0x3e89a0){var _0x5d3644={};if(_0x577593[_0x9ee3('0xe')]>0x0){_['forEach'](_0x577593,function(_0x1d5549){if(_[_0x9ee3('0xf')]([_0x9ee3('0x10'),_0x9ee3('0x11')],_0x1d5549[_0x9ee3('0x12')])&&_0x1d5549[_0x9ee3('0x13')]){_0x5d3644[_0x1d5549[_0x9ee3('0x13')]]=_0x1d5549['content'][_0x9ee3('0x14')]();}else if(_0x1d5549[_0x9ee3('0x12')]===_0x9ee3('0x15')&&_0x1d5549['variableName']&&_0x1d5549[_0x9ee3('0x13')]&&_0x3e89a0[_0x1d5549[_0x9ee3('0x16')]]){_0x5d3644[_0x1d5549[_0x9ee3('0x13')]]=_0x3e89a0[_0x1d5549[_0x9ee3('0x16')]]['toString']();}else if(_0x1d5549['type']===_0x9ee3('0x17')&&_0x1d5549[_0x9ee3('0x18')]&&_0x1d5549[_0x9ee3('0x18')][_0x9ee3('0x19')]&&_0x1d5549[_0x9ee3('0x13')]&&_0x3e89a0[_0x1d5549[_0x9ee3('0x18')]['name']['toLowerCase']()]){_0x5d3644[_0x1d5549[_0x9ee3('0x13')]]=_0x3e89a0[_0x1d5549[_0x9ee3('0x18')][_0x9ee3('0x19')][_0x9ee3('0x1a')]()][_0x9ee3('0x14')]();}});}return _0x5d3644;}function getName(_0x25fad6){if(_0x25fad6[_0x9ee3('0x1b')]('\x20')>0x0){var _0x173362=_0x25fad6[_0x9ee3('0x1c')](/ (.+)/);if(_0x173362[0x1]){return _0x173362;}}return[_0x25fad6,_0x25fad6];}var accountsTokens={};function getAccessToken(_0x80671d){return new Promise(function(_0x506040,_0x40f553){if(!_[_0x9ee3('0x1d')](accountsTokens[_0x80671d['id']])&&!_[_0x9ee3('0x1d')](accountsTokens[_0x80671d['id']][_0x9ee3('0x1e')])){if(moment()[_0x9ee3('0x1f')](accountsTokens[_0x80671d['id']][_0x9ee3('0x20')])){_0x506040(accountsTokens[_0x80671d['id']]['access_token']);}}var _0xa34734;switch(_0x80671d[_0x9ee3('0x21')]){case'US':_0xa34734=_0x9ee3('0x22');break;case'AU':_0xa34734=_0x9ee3('0x23');break;case'EU':_0xa34734='https://accounts.zoho.eu';break;case'IN':_0xa34734='https://accounts.zoho.in';break;case'CN':_0xa34734=_0x9ee3('0x24');break;default:_0xa34734=_0x9ee3('0x25');break;}var _0x44f93f={'method':_0x9ee3('0x26'),'uri':_0xa34734+_0x9ee3('0x27'),'qs':{'refresh_token':_0x80671d[_0x9ee3('0x28')],'client_id':_0x80671d[_0x9ee3('0x29')],'client_secret':_0x80671d[_0x9ee3('0x2a')],'grant_type':_0x9ee3('0x2b')},'json':!![]};return rp(_0x44f93f)[_0x9ee3('0x2c')](function(_0x3b17d8){accountsTokens[_0x80671d['id']]={'access_token':_0x3b17d8['access_token'],'expires_in':moment()['add'](_0x3b17d8[_0x9ee3('0x20')],_0x9ee3('0x2d'))};_0x506040(_0x3b17d8[_0x9ee3('0x1e')]);})[_0x9ee3('0x2e')](function(_0x40f06c){logger[_0x9ee3('0x2f')](_0x9ee3('0x30'),_0x40f06c[_0x9ee3('0x31')]);_0x40f553(_0x40f06c);});});}function getUser(_0xe64e6c,_0x5633a3,_0x41037f,_0x182f21){logger[_0x9ee3('0x32')](_0x9ee3('0x33'));return request({'method':'GET','uri':util[_0x9ee3('0x34')](_0x9ee3('0x35'),_0x5633a3),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x9ee3('0x36')+_0xe64e6c},'json':!![]})[_0x9ee3('0x2c')](function(_0x3613b0){if(_0x3613b0['users']){var _0x1af6ae=-0x1;if(_['isArrayLikeObject'](_0x3613b0['users'])){if(!_[_0x9ee3('0x1d')](_0x182f21)){_0x1af6ae=_[_0x9ee3('0x37')](_0x3613b0[_0x9ee3('0x38')],function(_0x279cc4){return _0x279cc4['email']===_0x182f21;});}if(_0x1af6ae>=0x0){logger[_0x9ee3('0x32')](_0x9ee3('0x39'));}else{logger[_0x9ee3('0x32')](_0x9ee3('0x3a'));_0x1af6ae=_['findIndex'](_0x3613b0['users'],function(_0x29c6be){return _0x29c6be[_0x9ee3('0x3b')]['name']===_0x9ee3('0x3c');});}return _0x3613b0[_0x9ee3('0x38')][_0x1af6ae];}else{if(_0x3613b0['user'][_0x9ee3('0x3b')][_0x9ee3('0x19')]===_0x9ee3('0x3c')){logger[_0x9ee3('0x32')]('Using\x20the\x20admin\x20account!');user=_0x3613b0[_0x9ee3('0x3d')];return user;}else{logger[_0x9ee3('0x2f')](_0x9ee3('0x3e'),JSON[_0x9ee3('0x3f')](_0x3613b0));throw new Error(_0x9ee3('0x40')+JSON[_0x9ee3('0x3f')](_0x3613b0));}}}else{logger[_0x9ee3('0x2f')](_0x9ee3('0x3e'),JSON[_0x9ee3('0x3f')](_0x3613b0));throw new Error(_0x9ee3('0x40')+JSON[_0x9ee3('0x3f')](_0x3613b0));}})[_0x9ee3('0x2e')](function(_0xc41207){console[_0x9ee3('0x2f')](_0xc41207);});}function getZohoUser(_0x2d0494,_0x59eb2b){return new BPromise(function(_0x1735e5,_0x25eff4){request(_0x2d0494)['then'](function(_0xc2c10a){var _0x2bbc04=null;if(_0xc2c10a){_0x2bbc04=_0xc2c10a['data'][0x0];_0x2bbc04[_0x9ee3('0x41')]=_0x59eb2b;}_0x1735e5(_0x2bbc04);})[_0x9ee3('0x2e')](function(_0x57b92a){_0x25eff4(_0x57b92a);});});}function createEndUser(_0x3ffe98,_0x330a07,_0x12dcca,_0x5a3acb,_0xa3c974,_0x140797){var _0x12dcca=getName(_0x12dcca);return request({'method':_0x9ee3('0x26'),'uri':_0x9ee3('0x42')+_0x330a07+_0x9ee3('0x43')+_[_0x9ee3('0x44')](_0x140797[_0x9ee3('0x45')])+'s','body':{'data':[{'Last_Name':_0x12dcca[0x1],'First_Name':_0x12dcca[0x0],'Phone':_0x5a3acb,'Owner':{'name':!_[_0x9ee3('0x1d')](_0xa3c974[_0x9ee3('0x46')]['name'])?_0xa3c974[_0x9ee3('0x46')][_0x9ee3('0x19')]:!_[_0x9ee3('0x1d')](_0xa3c974[_0x9ee3('0x47')])?_0xa3c974[_0x9ee3('0x47')]+'\x20'+_0xa3c974[_0x9ee3('0x48')]:_0xa3c974[_0x9ee3('0x48')],'id':_0xa3c974['id']}}]},'headers':{'Authorization':_0x9ee3('0x36')+_0x3ffe98},'json':!![]})[_0x9ee3('0x2c')](function(_0x7b854d){if(_0x7b854d&&_0x7b854d[_0x9ee3('0x49')][0x0][_0x9ee3('0x4a')]===_0x9ee3('0x4b')){var _0xcdf6f6=_0x7b854d['data'][0x0][_0x9ee3('0x4c')];_0xcdf6f6['enduserType']=_[_0x9ee3('0x44')](_0x140797[_0x9ee3('0x45')])+'s';return _0xcdf6f6;}logger[_0x9ee3('0x2f')](_0x9ee3('0x3e'),JSON['stringify'](data));throw new Error(_0x9ee3('0x4d')+JSON['stringify'](data));})['catch'](function(_0x2f4e9e){console[_0x9ee3('0x4e')]('CREATE\x20ERROR',_0x2f4e9e);});}function getEndUser(_0x37a0af,_0x514d15,_0x2ca2be,_0x56a224,_0x116b36,_0x4a3923,_0x4a3a80){var _0x3c9d79={'method':_0x9ee3('0x4f'),'uri':'','headers':{'Authorization':_0x9ee3('0x36')+_0x37a0af},'json':!![]};switch(_0x4a3a80['moduleSearch']){case _0x9ee3('0x50'):_0x3c9d79[_0x9ee3('0x51')]=_0x9ee3('0x42')+_0x514d15+_0x9ee3('0x52')+_0x116b36+'))';return getZohoUser(_0x3c9d79,_0x9ee3('0x53'))[_0x9ee3('0x2c')](function(_0x38d43f){if(_0x38d43f)return _0x38d43f;_0x3c9d79['uri']=_0x9ee3('0x42')+_0x514d15+_0x9ee3('0x54')+_0x116b36+'))';return getZohoUser(_0x3c9d79,_0x9ee3('0x55'))[_0x9ee3('0x2c')](function(_0x4ca2a7){if(_0x4ca2a7)return _0x4ca2a7;if(_0x4a3a80[_0x9ee3('0x45')]!=_0x9ee3('0x56')){return createEndUser(_0x37a0af,_0x514d15,_0x56a224,_0x116b36,_0x4a3923,_0x4a3a80);}else{return{};}});});break;case _0x9ee3('0x57'):_0x3c9d79['uri']=_0x9ee3('0x42')+_0x514d15+_0x9ee3('0x52')+_0x116b36+'))';return getZohoUser(_0x3c9d79,'Contacts')[_0x9ee3('0x2c')](function(_0x1bc694){if(_0x1bc694)return _0x1bc694;if(_0x4a3a80[_0x9ee3('0x45')]!=_0x9ee3('0x56')){return createEndUser(_0x37a0af,_0x514d15,_0x56a224,_0x116b36,_0x4a3923,_0x4a3a80);}else{return{};}});break;case _0x9ee3('0x58'):_0x3c9d79[_0x9ee3('0x51')]='https://www.zohoapis.'+_0x514d15+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x116b36+'))';return getZohoUser(_0x3c9d79,_0x9ee3('0x55'))['then'](function(_0x61279c){if(_0x61279c)return _0x61279c;if(_0x4a3a80[_0x9ee3('0x45')]!='nothing'){return createEndUser(_0x37a0af,_0x514d15,_0x56a224,_0x116b36,_0x4a3923,_0x4a3a80);}else{return{};}});break;}}function getCall(_0x485090,_0xbc5fa5,_0x4e2aac,_0xeb05c1,_0x27def9,_0x1116c0,_0x2643bc,_0x5bae59){logger['info'](_0x9ee3('0x59'));var _0xda4d1d={};_0xda4d1d[_0x9ee3('0x5a')]={'name':!_[_0x9ee3('0x1d')](_0xeb05c1[_0x9ee3('0x46')][_0x9ee3('0x19')])&&!_[_0x9ee3('0x1d')](_0xeb05c1['profile'][_0x9ee3('0x19')])&&_0xeb05c1[_0x9ee3('0x3b')][_0x9ee3('0x19')]===_0x9ee3('0x5b')?_0xeb05c1[_0x9ee3('0x46')][_0x9ee3('0x19')]:!_['isNil'](_0xeb05c1[_0x9ee3('0x47')])?_0xeb05c1['first_name']+'\x20'+_0xeb05c1[_0x9ee3('0x48')]:_0xeb05c1[_0x9ee3('0x48')],'id':_0xeb05c1['id']};_0xda4d1d[_0x9ee3('0x5c')]=intUtil[_0x9ee3('0x5d')](_0x1116c0[_0x9ee3('0x5e')],_0x2643bc,'\x20');_0xda4d1d['Description']=intUtil[_0x9ee3('0x5d')](_0x1116c0[_0x9ee3('0x5f')],_0x2643bc,'\x0a');if(_0x27def9[_0x9ee3('0x41')]==='Contacts'){_0xda4d1d[_0x9ee3('0x60')]={'name':!_[_0x9ee3('0x1d')](_0x27def9['Full_Name'])?_0x27def9[_0x9ee3('0x61')]:!_[_0x9ee3('0x1d')](_0x27def9['First_Name'])?_0x27def9[_0x9ee3('0x62')]+'\x20'+_0x27def9[_0x9ee3('0x63')]:_0x27def9['Last_Name'],'id':_0x27def9['id']};}if(_0x27def9[_0x9ee3('0x41')]===_0x9ee3('0x55')){_0xda4d1d['What_Id']={'name':!_[_0x9ee3('0x1d')](_0x27def9[_0x9ee3('0x61')])?_0x27def9['Full_Name']:!_[_0x9ee3('0x1d')](_0x27def9[_0x9ee3('0x62')])?_0x27def9[_0x9ee3('0x62')]+'\x20'+_0x27def9[_0x9ee3('0x63')]:_0x27def9[_0x9ee3('0x63')],'id':_0x27def9['id']};_0xda4d1d[_0x9ee3('0x64')]=_[_0x9ee3('0x44')](_0x27def9[_0x9ee3('0x41')]);}if(_0x2643bc[_0x9ee3('0x65')]){_0xda4d1d[_0x9ee3('0x66')]=moment[_0x9ee3('0x67')](parseInt(_0x2643bc[_0x9ee3('0x65')])*0x3e8)[_0x9ee3('0x34')](_0x9ee3('0x68'));}else if(_0x2643bc[_0x9ee3('0x69')]&&_0x2643bc['endtime']){_0xda4d1d[_0x9ee3('0x66')]=moment[_0x9ee3('0x67')](moment(_0x2643bc[_0x9ee3('0x6a')],_0x9ee3('0x6b'))[_0x9ee3('0x6c')](moment(_0x2643bc['starttime'],_0x9ee3('0x6b'))))['format'](_0x9ee3('0x68'));}switch(_0x2643bc[_0x9ee3('0x6d')]){case _0x9ee3('0x6e'):_0xda4d1d[_0x9ee3('0x6f')]='Called';break;case'complete':case _0x9ee3('0x70'):_0xda4d1d[_0x9ee3('0x6f')]=_0x9ee3('0x71');break;case _0x9ee3('0x72'):_0xda4d1d['Call_Result']=_0x9ee3('0x73');break;case _0x9ee3('0x74'):_0xda4d1d['Call_Result']='Abandoned';break;case _0x9ee3('0x75'):_0xda4d1d[_0x9ee3('0x6f')]=_0x9ee3('0x76');default:}_0xda4d1d[_0x9ee3('0x77')]=(_0x5bae59===_0x9ee3('0x78')?moment(_0x2643bc[_0x9ee3('0x79')])[_0x9ee3('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2643bc['agentcalledAt'])['format'](_0x9ee3('0x6b')))||moment()['format'](_0x9ee3('0x6b'));_0xda4d1d[_0x9ee3('0x7a')]=_0x5bae59||_0x9ee3('0x7b');_0xda4d1d=_['merge'](_0xda4d1d,getCustomFields(_0x1116c0[_0x9ee3('0x7c')],_0x2643bc));return request({'method':_0x9ee3('0x26'),'uri':_0x9ee3('0x42')+_0xbc5fa5+_0x9ee3('0x7d'),'headers':{'Authorization':_0x9ee3('0x36')+_0x485090},'body':{'data':[_0xda4d1d]},'json':!![]})[_0x9ee3('0x2c')](function(_0x3a2a82){if(_0x3a2a82&&_0x3a2a82['data'][0x0][_0x9ee3('0x4a')]===_0x9ee3('0x4b')){logger['info'](_0x9ee3('0x7e'));return{'id':_0x3a2a82[_0x9ee3('0x49')][0x0][_0x9ee3('0x4c')]['id']};}})[_0x9ee3('0x2e')](function(_0x3ba7d6){logger['info'](_0x9ee3('0x7f'),_0x3ba7d6[_0x9ee3('0x31')]);console['log'](_0x9ee3('0x7f'),_0x3ba7d6);});}exports[_0x9ee3('0x80')]=function(_0x5ae68d,_0x281719,_0x29efd6,_0x938cc7,_0x5c7852,_0x1fec98){var _0x26e860,_0x1c2223,_0x169311;_0x1fec98['host']=intUtil[_0x9ee3('0x81')](_0x1fec98[_0x9ee3('0x82')]);_0x1fec98['serverUrl']=intUtil[_0x9ee3('0x81')](_0x1fec98[_0x9ee3('0x83')]);if(_0x5c7852&&_0x5c7852['monitor_format']){logger[_0x9ee3('0x32')](_0x9ee3('0x84'),_0x9ee3('0x85'));_0x281719['recordingURL']=_0x1fec98[_0x9ee3('0x83')]+_0x9ee3('0x86')+_0x281719['uniqueid']+_0x9ee3('0x87')+md5(_0x281719[_0x9ee3('0x88')]);}else{_0x281719[_0x9ee3('0x89')]='';}var _0x59b3d8=_0x1fec98[_0x9ee3('0x82')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x1fec98)[_0x9ee3('0x2c')](function(_0xceab14){_0x169311=_0xceab14;return getUser(_0x169311,_0x59b3d8,_0x1fec98,_0x938cc7[_0x9ee3('0x8a')]);})[_0x9ee3('0x2c')](function(_0x388d3c){_0x26e860=_0x388d3c;logger[_0x9ee3('0x32')](_0x9ee3('0x8b'),_0x26e860['id']);return getEndUser(_0x169311,_0x59b3d8,_0x1fec98,_0x281719[_0x9ee3('0x8c')],_0x281719[_0x9ee3('0x8d')],_0x26e860,_0x29efd6);})[_0x9ee3('0x2c')](function(_0x2abd20){_0x1c2223=_0x2abd20;return getCall(_0x169311,_0x59b3d8,_0x1fec98,_0x26e860,_0x1c2223,_0x29efd6,_0x281719,_0x9ee3('0x7b'));})['then'](function(_0x22eee6){if(_0x22eee6){logger[_0x9ee3('0x32')](_0x9ee3('0x8e'),_0x22eee6['id']);logger[_0x9ee3('0x32')](_0x9ee3('0x84'),_0x9ee3('0x8f'));emit(util[_0x9ee3('0x34')]('user:%s',_0x938cc7[_0x9ee3('0x19')]),_0x9ee3('0x90'),{'uri':_0x9ee3('0x91')+_0x1fec98[_0x9ee3('0x82')]+_0x9ee3('0x92')+_0x22eee6['id']});}})[_0x9ee3('0x2e')](function(_0x44dfe5){logger[_0x9ee3('0x2f')](_0x9ee3('0x84'),JSON['stringify'](_0x44dfe5));});};exports['outbound']=function(_0x4a1c8,_0xc06799,_0xf28980,_0x306d4a,_0x42d540,_0x5debe4,_0x1a8dc8){var _0x492e6d,_0x443fe4,_0x1107ab;_0x5debe4[_0x9ee3('0x82')]=intUtil[_0x9ee3('0x81')](_0x5debe4[_0x9ee3('0x82')]);_0x5debe4[_0x9ee3('0x83')]=intUtil[_0x9ee3('0x81')](_0x5debe4['serverUrl']);if(_0x1a8dc8&&_0x1a8dc8[_0x9ee3('0x93')]&&_0x1a8dc8[_0x9ee3('0x93')]!=='none'){logger['info'](_0x9ee3('0x94'),_0x9ee3('0x85'));_0xc06799['recordingURL']=_0x5debe4[_0x9ee3('0x83')]+'/api/voice/recordings/'+_0xc06799[_0x9ee3('0x88')]+'/downloads?type=uniqueid&token='+md5(_0xc06799[_0x9ee3('0x88')]);}var _0xc93c9=_0x5debe4[_0x9ee3('0x82')]===_0x9ee3('0x95')?'eu':_0x9ee3('0x96');return getAccessToken(_0x5debe4)['then'](function(_0x3b83cf){_0x1107ab=_0x3b83cf;return getUser(_0x1107ab,_0xc93c9,_0x5debe4,_0x306d4a[_0x9ee3('0x8a')]);})[_0x9ee3('0x2c')](function(_0xeb204d){_0x492e6d=_0xeb204d;logger[_0x9ee3('0x32')](_0x9ee3('0x8b'),_0x492e6d['id']);return getEndUser(_0x1107ab,_0xc93c9,_0x5debe4,_0xc06799[_0x9ee3('0x97')],_0xc06799[_0x9ee3('0x98')],_0x492e6d,_0xf28980);})['then'](function(_0x41026e){_0x443fe4=_0x41026e;return getCall(_0x1107ab,_0xc93c9,_0x5debe4,_0x492e6d,_0x443fe4,_0xf28980,_0xc06799,_0x9ee3('0x99'));})[_0x9ee3('0x2c')](function(_0x666e9d){if(_0x666e9d){logger[_0x9ee3('0x32')](_0x9ee3('0x8e'),_0x666e9d['id']);logger['info']('[OUTBOUND]',_0x9ee3('0x8f'));emit(util[_0x9ee3('0x34')](_0x9ee3('0x9a'),_0x306d4a[_0x9ee3('0x19')]),_0x9ee3('0x90'),{'uri':'https://crm.'+_0x5debe4[_0x9ee3('0x82')]+_0x9ee3('0x92')+_0x666e9d['id']});}})[_0x9ee3('0x2e')](function(_0x5ef0f8){logger['error'](_0x9ee3('0x94'),JSON[_0x9ee3('0x3f')](_0x5ef0f8));});};exports['unmanaged']=function(_0x349d54,_0x2d987e,_0x3f511e,_0x5535fa,_0x3e4ec3,_0x4d0bb7){var _0x44c9a1,_0x3558c6,_0x45a05d;_0x4d0bb7[_0x9ee3('0x82')]=intUtil[_0x9ee3('0x81')](_0x4d0bb7[_0x9ee3('0x82')]);_0x4d0bb7[_0x9ee3('0x83')]=intUtil[_0x9ee3('0x81')](_0x4d0bb7['serverUrl']);if(_0x3e4ec3&&_0x3e4ec3[_0x9ee3('0x9b')]){logger[_0x9ee3('0x32')]('['+_0x2d987e[_0x9ee3('0x6d')]['toUpperCase']()+']',_0x9ee3('0x85'));_0x2d987e[_0x9ee3('0x89')]=_0x4d0bb7[_0x9ee3('0x83')]+_0x9ee3('0x86')+_0x2d987e[_0x9ee3('0x88')]+_0x9ee3('0x87')+md5(_0x2d987e[_0x9ee3('0x88')]);}else{_0x2d987e[_0x9ee3('0x89')]='';}var _0x188ad2=_0x4d0bb7['host']==='zoho.eu'?'eu':_0x9ee3('0x96');return getAccessToken(_0x4d0bb7)['then'](function(_0x544284){_0x45a05d=_0x544284;return getUser(_0x45a05d,_0x188ad2,_0x4d0bb7);})[_0x9ee3('0x2c')](function(_0x2edee4){_0x44c9a1=_0x2edee4;logger[_0x9ee3('0x32')](_0x9ee3('0x8b'),_0x44c9a1['id']);return getEndUser(_0x45a05d,_0x188ad2,_0x4d0bb7,_0x2d987e['calleridname'],_0x2d987e[_0x9ee3('0x8d')],_0x44c9a1,_0x3f511e);})[_0x9ee3('0x2c')](function(_0xaa24a2){_0x3558c6=_0xaa24a2;return getCall(_0x45a05d,_0x188ad2,_0x4d0bb7,_0x44c9a1,_0x3558c6,_0x3f511e,_0x2d987e,_0x9ee3('0x7b'));})[_0x9ee3('0x2c')](function(_0x3c6cd0){if(_0x3c6cd0){logger[_0x9ee3('0x32')](_0x9ee3('0x8e'),_0x3c6cd0['id']);}})[_0x9ee3('0x2e')](function(_0x523bea){logger[_0x9ee3('0x2f')]('['+_0x2d987e[_0x9ee3('0x6d')][_0x9ee3('0x9c')]()+']',JSON[_0x9ee3('0x3f')](_0x523bea));});}; \ No newline at end of file +var _0xa4e9=['/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','user:%s','unmanaged','toUpperCase','calleridnum','lodash','request-promise','./util','ioredis','../../../../config/logger','zoho','socket.io-emitter','[HTTP]','length','forEach','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','POST','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Owner','administrator','first_name','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','abandoned','timeout','Timeout','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x5da1c6,_0x36e363){var _0x1e7b10=function(_0x256fc0){while(--_0x256fc0){_0x5da1c6['push'](_0x5da1c6['shift']());}};_0x1e7b10(++_0x36e363);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x5f5dd3,_0x2ce595){_0x5f5dd3=_0x5f5dd3-0x0;var _0x7ec6bf=_0xa4e9[_0x5f5dd3];return _0x7ec6bf;};'use strict';var _=require(_0x9a4e('0x0'));var rp=require(_0x9a4e('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x9a4e('0x2'));var moment=require('moment');var Redis=require(_0x9a4e('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x9a4e('0x4'))(_0x9a4e('0x5'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9a4e('0x6'))(new Redis(config['redis']));function emit(_0x2c4483,_0x231eff,_0x30b4fe){io['to'](_0x2c4483)['emit'](_0x231eff,_0x30b4fe);}function request(_0xfec7bb){logger['debug'](_0x9a4e('0x7'),JSON['stringify'](_0xfec7bb));return rp(_0xfec7bb);}function getCustomFields(_0x766fd6,_0x462f72){var _0xfbea11={};if(_0x766fd6[_0x9a4e('0x8')]>0x0){_[_0x9a4e('0x9')](_0x766fd6,function(_0x2fd7bb){if(_['includes'](['string',_0x9a4e('0xa')],_0x2fd7bb[_0x9a4e('0xb')])&&_0x2fd7bb[_0x9a4e('0xc')]){_0xfbea11[_0x2fd7bb['idField']]=_0x2fd7bb['content'][_0x9a4e('0xd')]();}else if(_0x2fd7bb[_0x9a4e('0xb')]===_0x9a4e('0xe')&&_0x2fd7bb['variableName']&&_0x2fd7bb['idField']&&_0x462f72[_0x2fd7bb[_0x9a4e('0xf')]]){_0xfbea11[_0x2fd7bb['idField']]=_0x462f72[_0x2fd7bb[_0x9a4e('0xf')]]['toString']();}else if(_0x2fd7bb[_0x9a4e('0xb')]==='customVariable'&&_0x2fd7bb['Variable']&&_0x2fd7bb[_0x9a4e('0x10')]['name']&&_0x2fd7bb[_0x9a4e('0xc')]&&_0x462f72[_0x2fd7bb[_0x9a4e('0x10')][_0x9a4e('0x11')][_0x9a4e('0x12')]()]){_0xfbea11[_0x2fd7bb[_0x9a4e('0xc')]]=_0x462f72[_0x2fd7bb['Variable'][_0x9a4e('0x11')]['toLowerCase']()][_0x9a4e('0xd')]();}});}return _0xfbea11;}function getName(_0x56bf6e){if(_0x56bf6e[_0x9a4e('0x13')]('\x20')>0x0){var _0x498671=_0x56bf6e[_0x9a4e('0x14')](/ (.+)/);if(_0x498671[0x1]){return _0x498671;}}return[_0x56bf6e,_0x56bf6e];}var accountsTokens={};function getAccessToken(_0x315bda){return new Promise(function(_0x4b231b,_0x5af1c2){if(!_['isNil'](accountsTokens[_0x315bda['id']])&&!_[_0x9a4e('0x15')](accountsTokens[_0x315bda['id']][_0x9a4e('0x16')])){if(moment()['isBefore'](accountsTokens[_0x315bda['id']][_0x9a4e('0x17')])){_0x4b231b(accountsTokens[_0x315bda['id']][_0x9a4e('0x16')]);}}var _0x3b10f0;switch(_0x315bda['zone']){case'US':_0x3b10f0=_0x9a4e('0x18');break;case'AU':_0x3b10f0=_0x9a4e('0x19');break;case'EU':_0x3b10f0='https://accounts.zoho.eu';break;case'IN':_0x3b10f0=_0x9a4e('0x1a');break;case'CN':_0x3b10f0=_0x9a4e('0x1b');break;default:_0x3b10f0=_0x9a4e('0x1c');break;}var _0x336994={'method':'POST','uri':_0x3b10f0+_0x9a4e('0x1d'),'qs':{'refresh_token':_0x315bda[_0x9a4e('0x1e')],'client_id':_0x315bda[_0x9a4e('0x1f')],'client_secret':_0x315bda[_0x9a4e('0x20')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x336994)[_0x9a4e('0x21')](function(_0x6f453a){accountsTokens[_0x315bda['id']]={'access_token':_0x6f453a[_0x9a4e('0x16')],'expires_in':moment()[_0x9a4e('0x22')](_0x6f453a[_0x9a4e('0x17')],_0x9a4e('0x23'))};_0x4b231b(_0x6f453a[_0x9a4e('0x16')]);})['catch'](function(_0x57634e){logger[_0x9a4e('0x24')](_0x9a4e('0x25'),_0x57634e[_0x9a4e('0x26')]);_0x5af1c2(_0x57634e);});});}function getUser(_0x3540ac,_0xd45add,_0x3a2b77,_0x53ad39){logger[_0x9a4e('0x27')]('Search\x20user');return request({'method':_0x9a4e('0x28'),'uri':util[_0x9a4e('0x29')]('https://www.zohoapis.%s/crm/v2/users',_0xd45add),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3540ac},'json':!![]})[_0x9a4e('0x21')](function(_0x23d691){if(_0x23d691['users']){var _0x158c85=-0x1;if(_['isArrayLikeObject'](_0x23d691[_0x9a4e('0x2a')])){if(!_[_0x9a4e('0x15')](_0x53ad39)){_0x158c85=_[_0x9a4e('0x2b')](_0x23d691[_0x9a4e('0x2a')],function(_0x19e611){return _0x19e611[_0x9a4e('0x2c')]===_0x53ad39;});}if(_0x158c85>=0x0){logger[_0x9a4e('0x27')](_0x9a4e('0x2d'));}else{logger[_0x9a4e('0x27')](_0x9a4e('0x2e'));_0x158c85=_[_0x9a4e('0x2b')](_0x23d691[_0x9a4e('0x2a')],function(_0x31addd){return _0x31addd[_0x9a4e('0x2f')][_0x9a4e('0x11')]===_0x9a4e('0x30');});}return _0x23d691[_0x9a4e('0x2a')][_0x158c85];}else{if(_0x23d691[_0x9a4e('0x31')]['profile'][_0x9a4e('0x11')]===_0x9a4e('0x30')){logger[_0x9a4e('0x27')]('Using\x20the\x20admin\x20account!');user=_0x23d691[_0x9a4e('0x31')];return user;}else{logger[_0x9a4e('0x24')](_0x9a4e('0x32'),JSON[_0x9a4e('0x33')](_0x23d691));throw new Error(_0x9a4e('0x34')+JSON[_0x9a4e('0x33')](_0x23d691));}}}else{logger[_0x9a4e('0x24')](_0x9a4e('0x32'),JSON[_0x9a4e('0x33')](_0x23d691));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x23d691));}})[_0x9a4e('0x35')](function(_0x5ca614){console[_0x9a4e('0x24')](_0x5ca614);});}function getZohoUser(_0x1936ee,_0x2017f2){return new BPromise(function(_0x144ec0,_0x4004b9){request(_0x1936ee)[_0x9a4e('0x21')](function(_0x3cce83){var _0x357ccf=null;if(_0x3cce83){_0x357ccf=_0x3cce83[_0x9a4e('0x36')][0x0];_0x357ccf['enduserType']=_0x2017f2;}_0x144ec0(_0x357ccf);})['catch'](function(_0x45e954){_0x4004b9(_0x45e954);});});}function createEndUser(_0x205156,_0x419cca,_0x2bcf9a,_0x59caa4,_0x10fdcf,_0x40b5c5){var _0x2bcf9a=getName(_0x2bcf9a);return request({'method':_0x9a4e('0x37'),'uri':_0x9a4e('0x38')+_0x419cca+_0x9a4e('0x39')+_['startCase'](_0x40b5c5[_0x9a4e('0x3a')])+'s','body':{'data':[{'Last_Name':_0x2bcf9a[0x1],'First_Name':_0x2bcf9a[0x0],'Phone':_0x59caa4,'Owner':{'name':!_[_0x9a4e('0x15')](_0x10fdcf[_0x9a4e('0x3b')][_0x9a4e('0x11')])?_0x10fdcf[_0x9a4e('0x3b')][_0x9a4e('0x11')]:!_[_0x9a4e('0x15')](_0x10fdcf['first_name'])?_0x10fdcf['first_name']+'\x20'+_0x10fdcf[_0x9a4e('0x3c')]:_0x10fdcf[_0x9a4e('0x3c')],'id':_0x10fdcf['id']}}]},'headers':{'Authorization':_0x9a4e('0x3d')+_0x205156},'json':!![]})[_0x9a4e('0x21')](function(_0x179598){if(_0x179598&&_0x179598[_0x9a4e('0x36')][0x0][_0x9a4e('0x3e')]===_0x9a4e('0x3f')){var _0x33f5a2=_0x179598[_0x9a4e('0x36')][0x0][_0x9a4e('0x40')];_0x33f5a2[_0x9a4e('0x41')]=_[_0x9a4e('0x42')](_0x40b5c5[_0x9a4e('0x3a')])+'s';return _0x33f5a2;}logger[_0x9a4e('0x24')](_0x9a4e('0x32'),JSON['stringify'](data));throw new Error(_0x9a4e('0x43')+JSON['stringify'](data));})['catch'](function(_0x2d669e){console[_0x9a4e('0x44')](_0x9a4e('0x45'),_0x2d669e);});}function getEndUser(_0x15755c,_0x8553e,_0xef4a58,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0){var _0x1363a1={'method':_0x9a4e('0x28'),'uri':'','headers':{'Authorization':_0x9a4e('0x3d')+_0x15755c},'json':!![]};switch(_0x28a3b0['moduleSearch']){case _0x9a4e('0x46'):_0x1363a1[_0x9a4e('0x47')]='https://www.zohoapis.'+_0x8553e+_0x9a4e('0x48')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x49'))['then'](function(_0x6ba719){if(_0x6ba719)return _0x6ba719;_0x1363a1[_0x9a4e('0x47')]=_0x9a4e('0x38')+_0x8553e+_0x9a4e('0x4a')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x4b'))[_0x9a4e('0x21')](function(_0x4f0d7f){if(_0x4f0d7f)return _0x4f0d7f;if(_0x28a3b0['moduleCreate']!=_0x9a4e('0x4c')){return createEndUser(_0x15755c,_0x8553e,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0);}else{return{};}});});break;case _0x9a4e('0x4d'):_0x1363a1[_0x9a4e('0x47')]='https://www.zohoapis.'+_0x8553e+_0x9a4e('0x48')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x49'))[_0x9a4e('0x21')](function(_0x49157f){if(_0x49157f)return _0x49157f;if(_0x28a3b0[_0x9a4e('0x3a')]!='nothing'){return createEndUser(_0x15755c,_0x8553e,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0);}else{return{};}});break;case'lead':_0x1363a1['uri']=_0x9a4e('0x38')+_0x8553e+_0x9a4e('0x4a')+_0xc4f87c+'))';return getZohoUser(_0x1363a1,_0x9a4e('0x4b'))[_0x9a4e('0x21')](function(_0x21a294){if(_0x21a294)return _0x21a294;if(_0x28a3b0[_0x9a4e('0x3a')]!=_0x9a4e('0x4c')){return createEndUser(_0x15755c,_0x8553e,_0x5a0890,_0xc4f87c,_0x2eb5fc,_0x28a3b0);}else{return{};}});break;}}function getCall(_0x3d4546,_0x2a4526,_0x903c01,_0x1dde34,_0x372242,_0x3a814d,_0x267053,_0x5776aa){logger[_0x9a4e('0x27')]('Creating\x20new\x20call...');var _0x2011c4={};_0x2011c4[_0x9a4e('0x4e')]={'name':!_['isNil'](_0x1dde34[_0x9a4e('0x3b')][_0x9a4e('0x11')])&&!_[_0x9a4e('0x15')](_0x1dde34[_0x9a4e('0x2f')][_0x9a4e('0x11')])&&_0x1dde34[_0x9a4e('0x2f')][_0x9a4e('0x11')]===_0x9a4e('0x4f')?_0x1dde34['role'][_0x9a4e('0x11')]:!_['isNil'](_0x1dde34['first_name'])?_0x1dde34[_0x9a4e('0x50')]+'\x20'+_0x1dde34[_0x9a4e('0x3c')]:_0x1dde34[_0x9a4e('0x3c')],'id':_0x1dde34['id']};_0x2011c4[_0x9a4e('0x51')]=intUtil['getString'](_0x3a814d[_0x9a4e('0x52')],_0x267053,'\x20');_0x2011c4[_0x9a4e('0x53')]=intUtil[_0x9a4e('0x54')](_0x3a814d[_0x9a4e('0x55')],_0x267053,'\x0a');if(_0x372242[_0x9a4e('0x41')]===_0x9a4e('0x49')){_0x2011c4[_0x9a4e('0x56')]={'name':!_[_0x9a4e('0x15')](_0x372242['Full_Name'])?_0x372242[_0x9a4e('0x57')]:!_[_0x9a4e('0x15')](_0x372242[_0x9a4e('0x58')])?_0x372242[_0x9a4e('0x58')]+'\x20'+_0x372242[_0x9a4e('0x59')]:_0x372242[_0x9a4e('0x59')],'id':_0x372242['id']};}if(_0x372242[_0x9a4e('0x41')]==='Leads'){_0x2011c4[_0x9a4e('0x5a')]={'name':!_['isNil'](_0x372242[_0x9a4e('0x57')])?_0x372242[_0x9a4e('0x57')]:!_[_0x9a4e('0x15')](_0x372242['First_Name'])?_0x372242[_0x9a4e('0x58')]+'\x20'+_0x372242[_0x9a4e('0x59')]:_0x372242[_0x9a4e('0x59')],'id':_0x372242['id']};_0x2011c4[_0x9a4e('0x5b')]=_['startCase'](_0x372242['enduserType']);}if(_0x267053[_0x9a4e('0x5c')]){_0x2011c4[_0x9a4e('0x5d')]=moment[_0x9a4e('0x5e')](parseInt(_0x267053[_0x9a4e('0x5c')])*0x3e8)[_0x9a4e('0x29')](_0x9a4e('0x5f'));}else if(_0x267053[_0x9a4e('0x60')]&&_0x267053[_0x9a4e('0x61')]){_0x2011c4[_0x9a4e('0x5d')]=moment[_0x9a4e('0x5e')](moment(_0x267053['endtime'],_0x9a4e('0x62'))[_0x9a4e('0x63')](moment(_0x267053[_0x9a4e('0x64')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x9a4e('0x5f'));}switch(_0x267053[_0x9a4e('0x65')]){case _0x9a4e('0x66'):_0x2011c4[_0x9a4e('0x67')]=_0x9a4e('0x68');break;case _0x9a4e('0x69'):case'connect':_0x2011c4['Call_Result']=_0x9a4e('0x6a');break;case _0x9a4e('0x6b'):_0x2011c4[_0x9a4e('0x67')]='Rejected';break;case _0x9a4e('0x6c'):_0x2011c4[_0x9a4e('0x67')]='Abandoned';break;case _0x9a4e('0x6d'):_0x2011c4[_0x9a4e('0x67')]=_0x9a4e('0x6e');default:}_0x2011c4['Call_Start_Time']=(_0x5776aa==='outbound'?moment(_0x267053[_0x9a4e('0x64')])['format'](_0x9a4e('0x62')):moment(_0x267053['agentcalledAt'])['format'](_0x9a4e('0x62')))||moment()['format'](_0x9a4e('0x62'));_0x2011c4[_0x9a4e('0x6f')]=_0x5776aa||_0x9a4e('0x70');_0x2011c4=_[_0x9a4e('0x71')](_0x2011c4,getCustomFields(_0x3a814d[_0x9a4e('0x72')],_0x267053));return request({'method':_0x9a4e('0x37'),'uri':_0x9a4e('0x38')+_0x2a4526+_0x9a4e('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3d4546},'body':{'data':[_0x2011c4]},'json':!![]})[_0x9a4e('0x21')](function(_0x101135){if(_0x101135&&_0x101135[_0x9a4e('0x36')][0x0][_0x9a4e('0x3e')]===_0x9a4e('0x3f')){logger['info'](_0x9a4e('0x74'));return{'id':_0x101135[_0x9a4e('0x36')][0x0][_0x9a4e('0x40')]['id']};}})['catch'](function(_0x397486){logger[_0x9a4e('0x27')](_0x9a4e('0x75'),_0x397486[_0x9a4e('0x26')]);console['log']('err',_0x397486);});}exports[_0x9a4e('0x76')]=function(_0x317c42,_0x1e0560,_0x5b45ec,_0x91071c,_0x262622,_0x1999b5){var _0x732178,_0x19a8fc,_0xadef92;_0x1999b5[_0x9a4e('0x77')]=intUtil[_0x9a4e('0x78')](_0x1999b5[_0x9a4e('0x77')]);_0x1999b5['serverUrl']=intUtil[_0x9a4e('0x78')](_0x1999b5[_0x9a4e('0x79')]);if(_0x262622&&_0x262622[_0x9a4e('0x7a')]){logger[_0x9a4e('0x27')](_0x9a4e('0x7b'),_0x9a4e('0x7c'));_0x1e0560[_0x9a4e('0x7d')]=_0x1999b5[_0x9a4e('0x79')]+_0x9a4e('0x7e')+_0x1e0560[_0x9a4e('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x1e0560[_0x9a4e('0x7f')]);}else{_0x1e0560[_0x9a4e('0x7d')]='';}var _0x2a691e=_0x1999b5[_0x9a4e('0x77')]===_0x9a4e('0x80')?'eu':_0x9a4e('0x81');return getAccessToken(_0x1999b5)[_0x9a4e('0x21')](function(_0xf2e7a4){_0xadef92=_0xf2e7a4;return getUser(_0xadef92,_0x2a691e,_0x1999b5,_0x91071c[_0x9a4e('0x2c')]);})['then'](function(_0x1e025d){_0x732178=_0x1e025d;logger[_0x9a4e('0x27')]('The\x20User\x20ID\x20is:',_0x732178['id']);return getEndUser(_0xadef92,_0x2a691e,_0x1999b5,_0x1e0560[_0x9a4e('0x82')],_0x1e0560['calleridnum'],_0x732178,_0x5b45ec);})[_0x9a4e('0x21')](function(_0x6c513d){_0x19a8fc=_0x6c513d;return getCall(_0xadef92,_0x2a691e,_0x1999b5,_0x732178,_0x19a8fc,_0x5b45ec,_0x1e0560,_0x9a4e('0x70'));})[_0x9a4e('0x21')](function(_0x459090){if(_0x459090){logger[_0x9a4e('0x27')](_0x9a4e('0x83'),_0x459090['id']);logger[_0x9a4e('0x27')](_0x9a4e('0x7b'),_0x9a4e('0x84'));emit(util['format']('user:%s',_0x91071c['name']),_0x9a4e('0x85'),{'uri':'https://crm.'+_0x1999b5[_0x9a4e('0x77')]+_0x9a4e('0x86')+_0x459090['id']});}})[_0x9a4e('0x35')](function(_0x5c194f){logger[_0x9a4e('0x24')](_0x9a4e('0x7b'),JSON['stringify'](_0x5c194f));});};exports['outbound']=function(_0x5b015c,_0x57294c,_0xbabb5f,_0x2ba019,_0x37e970,_0x18081e,_0x3fda34){var _0x3c6ebc,_0x47607d,_0x425c51;_0x18081e[_0x9a4e('0x77')]=intUtil[_0x9a4e('0x78')](_0x18081e['host']);_0x18081e[_0x9a4e('0x79')]=intUtil[_0x9a4e('0x78')](_0x18081e[_0x9a4e('0x79')]);if(_0x3fda34&&_0x3fda34[_0x9a4e('0x87')]&&_0x3fda34[_0x9a4e('0x87')]!=='none'){logger['info'](_0x9a4e('0x88'),_0x9a4e('0x7c'));_0x57294c[_0x9a4e('0x7d')]=_0x18081e['serverUrl']+_0x9a4e('0x7e')+_0x57294c[_0x9a4e('0x7f')]+_0x9a4e('0x89')+md5(_0x57294c[_0x9a4e('0x7f')]);}var _0x585502=_0x18081e[_0x9a4e('0x77')]===_0x9a4e('0x80')?'eu':'com';return getAccessToken(_0x18081e)[_0x9a4e('0x21')](function(_0x4a6867){_0x425c51=_0x4a6867;return getUser(_0x425c51,_0x585502,_0x18081e,_0x2ba019[_0x9a4e('0x2c')]);})[_0x9a4e('0x21')](function(_0x58c1a5){_0x3c6ebc=_0x58c1a5;logger['info'](_0x9a4e('0x8a'),_0x3c6ebc['id']);return getEndUser(_0x425c51,_0x585502,_0x18081e,_0x57294c['destcalleridname'],_0x57294c[_0x9a4e('0x8b')],_0x3c6ebc,_0xbabb5f);})[_0x9a4e('0x21')](function(_0x1d6910){_0x47607d=_0x1d6910;return getCall(_0x425c51,_0x585502,_0x18081e,_0x3c6ebc,_0x47607d,_0xbabb5f,_0x57294c,_0x9a4e('0x8c'));})[_0x9a4e('0x21')](function(_0x5f3d99){if(_0x5f3d99){logger[_0x9a4e('0x27')](_0x9a4e('0x83'),_0x5f3d99['id']);logger[_0x9a4e('0x27')](_0x9a4e('0x88'),_0x9a4e('0x84'));emit(util['format'](_0x9a4e('0x8d'),_0x2ba019[_0x9a4e('0x11')]),_0x9a4e('0x85'),{'uri':'https://crm.'+_0x18081e[_0x9a4e('0x77')]+_0x9a4e('0x86')+_0x5f3d99['id']});}})[_0x9a4e('0x35')](function(_0x1858c2){logger['error'](_0x9a4e('0x88'),JSON['stringify'](_0x1858c2));});};exports[_0x9a4e('0x8e')]=function(_0x2f9d54,_0x34c0a1,_0x2a66ce,_0x5823ff,_0xe44ba3,_0x5659d6){var _0xbee9b5,_0x38446e,_0x567153;_0x5659d6['host']=intUtil[_0x9a4e('0x78')](_0x5659d6['host']);_0x5659d6[_0x9a4e('0x79')]=intUtil[_0x9a4e('0x78')](_0x5659d6[_0x9a4e('0x79')]);if(_0xe44ba3&&_0xe44ba3['monitor_format']){logger[_0x9a4e('0x27')]('['+_0x34c0a1[_0x9a4e('0x65')][_0x9a4e('0x8f')]()+']',_0x9a4e('0x7c'));_0x34c0a1[_0x9a4e('0x7d')]=_0x5659d6['serverUrl']+_0x9a4e('0x7e')+_0x34c0a1[_0x9a4e('0x7f')]+_0x9a4e('0x89')+md5(_0x34c0a1[_0x9a4e('0x7f')]);}else{_0x34c0a1[_0x9a4e('0x7d')]='';}var _0x499c99=_0x5659d6[_0x9a4e('0x77')]===_0x9a4e('0x80')?'eu':_0x9a4e('0x81');return getAccessToken(_0x5659d6)[_0x9a4e('0x21')](function(_0x41411c){_0x567153=_0x41411c;return getUser(_0x567153,_0x499c99,_0x5659d6);})[_0x9a4e('0x21')](function(_0x25afde){_0xbee9b5=_0x25afde;logger[_0x9a4e('0x27')](_0x9a4e('0x8a'),_0xbee9b5['id']);return getEndUser(_0x567153,_0x499c99,_0x5659d6,_0x34c0a1[_0x9a4e('0x82')],_0x34c0a1[_0x9a4e('0x90')],_0xbee9b5,_0x2a66ce);})[_0x9a4e('0x21')](function(_0x5b03f1){_0x38446e=_0x5b03f1;return getCall(_0x567153,_0x499c99,_0x5659d6,_0xbee9b5,_0x38446e,_0x2a66ce,_0x34c0a1,_0x9a4e('0x70'));})[_0x9a4e('0x21')](function(_0x49e1f8){if(_0x49e1f8){logger['info'](_0x9a4e('0x83'),_0x49e1f8['id']);}})['catch'](function(_0xce0e){logger['error']('['+_0x34c0a1[_0x9a4e('0x65')]['toUpperCase']()+']',JSON[_0x9a4e('0x33')](_0xce0e));});}; \ 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 dd61692..77ae507 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 _0xb148=['Script','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger'];(function(_0x2310b7,_0x2d8c48){var _0xa40bee=function(_0x1118df){while(--_0x1118df){_0x2310b7['push'](_0x2310b7['shift']());}};_0xa40bee(++_0x2d8c48);}(_0xb148,0x11a));var _0x8b14=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0xb148[_0x1b3a5c];return _0x2ae8cb;};'use strict';var util=require(_0x8b14('0x0'));var sh=require(_0x8b14('0x1'));var Mustache=require(_0x8b14('0x2'));var logger=require(_0x8b14('0x3'))('trigger');exports['exec']=function(_0x242ea3,_0x51d08f){var _0x36e8d9=_0x242ea3['data2']?_0x242ea3['data2']:_0x8b14('0x4');var _0x21f37b=_0x242ea3[_0x8b14('0x5')]?Mustache['render'](_0x242ea3['data3'],_0x51d08f):_0x51d08f;sh[_0x8b14('0x6')](_0x21f37b,function(_0x1d4ba8,_0x1e83d9,_0x2949f5){if(_0x1d4ba8!==0x0){logger[_0x8b14('0x7')](util[_0x8b14('0x8')](_0x8b14('0x9'),_0x36e8d9,_0x21f37b,_0x1d4ba8,_0x2949f5));}else{logger['info'](util[_0x8b14('0x8')](_0x8b14('0xa'),_0x36e8d9,_0x21f37b,_0x1e83d9));}});}; \ No newline at end of file +var _0x1c08=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1c08,0x1ee));var _0x81c0=function(_0x2fbb34,_0x358b15){_0x2fbb34=_0x2fbb34-0x0;var _0x26914a=_0x1c08[_0x2fbb34];return _0x26914a;};'use strict';var util=require(_0x81c0('0x0'));var sh=require(_0x81c0('0x1'));var Mustache=require(_0x81c0('0x2'));var logger=require(_0x81c0('0x3'))(_0x81c0('0x4'));exports[_0x81c0('0x5')]=function(_0x5599f7,_0x25f978){var _0x5e3dd2=_0x5599f7[_0x81c0('0x6')]?_0x5599f7[_0x81c0('0x6')]:_0x81c0('0x7');var _0x5b464b=_0x5599f7[_0x81c0('0x8')]?Mustache['render'](_0x5599f7['data3'],_0x25f978):_0x25f978;sh[_0x81c0('0x5')](_0x5b464b,function(_0x2c8fcd,_0x24c1c4,_0xd5efd6){if(_0x2c8fcd!==0x0){logger[_0x81c0('0x9')](util[_0x81c0('0xa')](_0x81c0('0xb'),_0x5e3dd2,_0x5b464b,_0x2c8fcd,_0xd5efd6));}else{logger[_0x81c0('0xc')](util[_0x81c0('0xa')](_0x81c0('0xd'),_0x5e3dd2,_0x5b464b,_0x24c1c4));}});}; \ 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 a1eda76..5644398 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 _0x9bc7=['lodash','trigger','exec','data1','toUpperCase','render','data5','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util'];(function(_0x2820f8,_0x2bdbdc){var _0x1e1413=function(_0x592e45){while(--_0x592e45){_0x2820f8['push'](_0x2820f8['shift']());}};_0x1e1413(++_0x2bdbdc);}(_0x9bc7,0x10f));var _0x79bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bc7[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var util=require(_0x79bc('0x0'));var _=require(_0x79bc('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x79bc('0x2'));exports[_0x79bc('0x3')]=function(_0x12a29d,_0x4a41fa){var _0x1d0eae,_0x2cf7b9;var _0x47d92e={'method':_0x12a29d[_0x79bc('0x4')][_0x79bc('0x5')](),'uri':Mustache[_0x79bc('0x6')](_0x12a29d['data2'],_0x4a41fa),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x12a29d['data5'])==='number'&&parseInt(_0x12a29d[_0x79bc('0x7')])>=0x1&&parseInt(_0x12a29d[_0x79bc('0x7')])<=0xa?parseInt(_0x12a29d['data5'])*0x3e8:0x5*0x3e8};try{_0x47d92e[_0x79bc('0x8')]=_0x12a29d[_0x79bc('0x9')]?JSON[_0x79bc('0xa')](Mustache[_0x79bc('0x6')](_0x12a29d[_0x79bc('0x9')],_0x4a41fa)):{};}catch(_0x339fdc){logger[_0x79bc('0xb')](_0x339fdc[_0x79bc('0xc')]);}switch(_0x12a29d[_0x79bc('0x4')]['toUpperCase']()){case _0x79bc('0xd'):case _0x79bc('0xe'):_0x1d0eae=null;_0x47d92e['qs']=_0x4a41fa;break;case _0x79bc('0xf'):case _0x79bc('0x10'):if(_0x12a29d[_0x79bc('0x11')]){try{_0x1d0eae=JSON[_0x79bc('0xa')](Mustache[_0x79bc('0x6')](_0x12a29d[_0x79bc('0x11')],_0x4a41fa));_0x47d92e[_0x79bc('0x12')]=_0x1d0eae;}catch(_0x327bba){logger[_0x79bc('0xb')](_0x327bba[_0x79bc('0xc')]);logger[_0x79bc('0xb')](_0x79bc('0x13'));}}else{_0x1d0eae=_0x4a41fa;_0x47d92e[_0x79bc('0x12')]=_0x1d0eae;}break;}logger[_0x79bc('0x14')](util[_0x79bc('0x15')](_0x79bc('0x16'),_0x12a29d[_0x79bc('0x4')],_0x12a29d[_0x79bc('0x17')],JSON[_0x79bc('0x18')](_0x47d92e)));rp(_0x47d92e)[_0x79bc('0x19')](function(_0xb83432){_0x1d0eae=!_[_0x79bc('0x1a')](_0x1d0eae)?_0x79bc('0x1b')+_0x1d0eae:'';_0x2cf7b9=typeof _0xb83432[_0x79bc('0x12')]===_0x79bc('0x1c')?JSON[_0x79bc('0x18')](_0xb83432[_0x79bc('0x12')]):_0xb83432[_0x79bc('0x12')];logger[_0x79bc('0x14')](util[_0x79bc('0x15')](_0x79bc('0x1d'),_0x12a29d[_0x79bc('0x4')],_0x12a29d[_0x79bc('0x17')],_0xb83432[_0x79bc('0x1e')],_0x2cf7b9));})[_0x79bc('0x1f')](function(_0x13cd93){logger[_0x79bc('0xb')](util[_0x79bc('0x15')](_0x79bc('0x20'),_0x12a29d[_0x79bc('0x4')],_0x12a29d[_0x79bc('0x17')],_0x13cd93['statusCode'],_0x13cd93[_0x79bc('0x21')],_0x13cd93['message']));});}; \ No newline at end of file +var _0x5781=['lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','catch','name','message','request-promise','util'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x5781,0x127));var _0x1578=function(_0x4a2558,_0x4c0983){_0x4a2558=_0x4a2558-0x0;var _0x4f9ab5=_0x5781[_0x4a2558];return _0x4f9ab5;};'use strict';var rp=require(_0x1578('0x0'));var util=require(_0x1578('0x1'));var _=require(_0x1578('0x2'));var Mustache=require(_0x1578('0x3'));var logger=require('../../../../config/logger')(_0x1578('0x4'));exports[_0x1578('0x5')]=function(_0x3a5920,_0x259d3b){var _0x5163ca,_0x29f1c6;var _0x5eaaeb={'method':_0x3a5920[_0x1578('0x6')][_0x1578('0x7')](),'uri':Mustache[_0x1578('0x8')](_0x3a5920[_0x1578('0x9')],_0x259d3b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3a5920[_0x1578('0xa')])===_0x1578('0xb')&&parseInt(_0x3a5920[_0x1578('0xa')])>=0x1&&parseInt(_0x3a5920[_0x1578('0xa')])<=0xa?parseInt(_0x3a5920[_0x1578('0xa')])*0x3e8:0x5*0x3e8};try{_0x5eaaeb['headers']=_0x3a5920[_0x1578('0xc')]?JSON['parse'](Mustache[_0x1578('0x8')](_0x3a5920[_0x1578('0xc')],_0x259d3b)):{};}catch(_0x7bbf2e){logger[_0x1578('0xd')](_0x7bbf2e[_0x1578('0xe')]);}switch(_0x3a5920['data1'][_0x1578('0x7')]()){case'GET':case _0x1578('0xf'):_0x5163ca=null;_0x5eaaeb['qs']=_0x259d3b;break;case'POST':case _0x1578('0x10'):if(_0x3a5920['data7']){try{_0x5163ca=JSON[_0x1578('0x11')](Mustache[_0x1578('0x8')](_0x3a5920[_0x1578('0x12')],_0x259d3b));_0x5eaaeb[_0x1578('0x13')]=_0x5163ca;}catch(_0x1ab2f9){logger['error'](_0x1ab2f9[_0x1578('0xe')]);logger[_0x1578('0xd')](_0x1578('0x14'));}}else{_0x5163ca=_0x259d3b;_0x5eaaeb['body']=_0x5163ca;}break;}logger[_0x1578('0x15')](util[_0x1578('0x16')](_0x1578('0x17'),_0x3a5920[_0x1578('0x6')],_0x3a5920[_0x1578('0x9')],JSON[_0x1578('0x18')](_0x5eaaeb)));rp(_0x5eaaeb)[_0x1578('0x19')](function(_0x42b345){_0x5163ca=!_[_0x1578('0x1a')](_0x5163ca)?_0x1578('0x1b')+_0x5163ca:'';_0x29f1c6=typeof _0x42b345[_0x1578('0x13')]===_0x1578('0x1c')?JSON[_0x1578('0x18')](_0x42b345[_0x1578('0x13')]):_0x42b345['body'];logger[_0x1578('0x15')](util[_0x1578('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3a5920['data1'],_0x3a5920[_0x1578('0x9')],_0x42b345[_0x1578('0x1d')],_0x29f1c6));})[_0x1578('0x1e')](function(_0xb64d26){logger[_0x1578('0xd')](util[_0x1578('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3a5920['data1'],_0x3a5920[_0x1578('0x9')],_0xb64d26[_0x1578('0x1d')],_0xb64d26[_0x1578('0x1f')],_0xb64d26[_0x1578('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 49869ba..b770f52 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 _0xfb6e=['routing','exports','jayson/promise','bluebird','../../config/logger','http','Request','request','then','debug','rpc','error','message','catch'];(function(_0x16caae,_0x1461ae){var _0x3d2bab=function(_0x453b49){while(--_0x453b49){_0x16caae['push'](_0x16caae['shift']());}};_0x3d2bab(++_0x1461ae);}(_0xfb6e,0x198));var _0xefb6=function(_0x131c71,_0x475529){_0x131c71=_0x131c71-0x0;var _0x2386a2=_0xfb6e[_0x131c71];return _0x2386a2;};'use strict';var jayson=require(_0xefb6('0x0'));var BPromise=require(_0xefb6('0x1'));var logger=require(_0xefb6('0x2'))('routing');var client=jayson['client'][_0xefb6('0x3')]({'port':0x2329});client[_0xefb6('0x4')]=function(_0x3fc3c4,_0x5450f9){return new BPromise(function(_0xc51da2,_0x366fd1){return client[_0xefb6('0x5')](_0x3fc3c4,_0x5450f9)[_0xefb6('0x6')](function(_0x1f1b66){logger[_0xefb6('0x7')](_0xefb6('0x8'),'routing',_0x3fc3c4,_0x5450f9,_0x1f1b66);if(_0x1f1b66[_0xefb6('0x9')]){logger[_0xefb6('0x9')](_0xefb6('0x8'),'routing',_0x3fc3c4,_0x1f1b66[_0xefb6('0x9')][_0xefb6('0xa')],_0x5450f9);return _0x366fd1(_0x1f1b66['error'][_0xefb6('0xa')]);}else{return _0xc51da2(_0x1f1b66['result']);}})[_0xefb6('0xb')](function(_0x5d03ab){logger[_0xefb6('0x9')](_0xefb6('0x8'),_0xefb6('0xc'),_0x3fc3c4,_0x5d03ab,_0x5450f9);return _0x366fd1(_0x5d03ab);});});};module[_0xefb6('0xd')]=client; \ No newline at end of file +var _0xfd6e=['../../config/logger','client','Request','request','debug','rpc','routing','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x315062,_0x3b97d7){var _0x1bea22=function(_0x3ceccb){while(--_0x3ceccb){_0x315062['push'](_0x315062['shift']());}};_0x1bea22(++_0x3b97d7);}(_0xfd6e,0x150));var _0xefd6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfd6e[_0x397e5f];return _0x5302b8;};'use strict';var jayson=require(_0xefd6('0x0'));var BPromise=require(_0xefd6('0x1'));var logger=require(_0xefd6('0x2'))('routing');var client=jayson[_0xefd6('0x3')]['http']({'port':0x2329});client[_0xefd6('0x4')]=function(_0x2392ec,_0x523779){return new BPromise(function(_0x27a4c3,_0x5ec947){return client[_0xefd6('0x5')](_0x2392ec,_0x523779)['then'](function(_0x18ebf1){logger[_0xefd6('0x6')](_0xefd6('0x7'),_0xefd6('0x8'),_0x2392ec,_0x523779,_0x18ebf1);if(_0x18ebf1['error']){logger[_0xefd6('0x9')](_0xefd6('0x7'),_0xefd6('0x8'),_0x2392ec,_0x18ebf1[_0xefd6('0x9')][_0xefd6('0xa')],_0x523779);return _0x5ec947(_0x18ebf1[_0xefd6('0x9')][_0xefd6('0xa')]);}else{return _0x27a4c3(_0x18ebf1['result']);}})[_0xefd6('0xb')](function(_0x30528a){logger[_0xefd6('0x9')]('rpc',_0xefd6('0x8'),_0x2392ec,_0x30528a,_0x523779);return _0x5ec947(_0x30528a);});});};module[_0xefd6('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c70a5ab..07b13d0 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 _0x149a=['getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','refresh','mailAccounts'];(function(_0x4169ed,_0x352deb){var _0x12899c=function(_0x280220){while(--_0x280220){_0x4169ed['push'](_0x4169ed['shift']());}};_0x12899c(++_0x352deb);}(_0x149a,0x148));var _0xa149=function(_0x3d1241,_0x577083){_0x3d1241=_0x3d1241-0x0;var _0x3a7aa9=_0x149a[_0x3d1241];return _0x3a7aa9;};'use strict';var server=require(_0xa149('0x0'));var Realtime=require(_0xa149('0x1'));var EmailChannel=require(_0xa149('0x2'));var mailAccount=require(_0xa149('0x3'));var setting=require(_0xa149('0x4'));var logger=require(_0xa149('0x5'))(_0xa149('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa149('0x7')]()[_0xa149('0x8')](mailAccount['getMailAccounts']())[_0xa149('0x8')](realtime[_0xa149('0x9')]())[_0xa149('0x8')](function(){email[_0xa149('0xa')](realtime[_0xa149('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xa149('0x8')](function(){return initRealtime();})[_0xa149('0x8')](function(){return setting[_0xa149('0xc')]();})[_0xa149('0x8')](function(_0x7fbda6){return setInterval(initRealtime,_0x7fbda6[_0xa149('0xd')]*0x3e8);})[_0xa149('0xe')](function(_0x4cda11){logger[_0xa149('0xf')](_0xa149('0x10'),_0x4cda11);});}main(); \ No newline at end of file +var _0x158c=['./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','./server','./realtime','./rpc/mailAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x158c,0xed));var _0xc158=function(_0x26b7cd,_0x1f07e3){_0x26b7cd=_0x26b7cd-0x0;var _0x345648=_0x158c[_0x26b7cd];return _0x345648;};'use strict';var server=require(_0xc158('0x0'));var Realtime=require(_0xc158('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc158('0x2'));var setting=require(_0xc158('0x3'));var logger=require(_0xc158('0x4'))(_0xc158('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc158('0x6')]()['then'](mailAccount[_0xc158('0x7')]())[_0xc158('0x8')](realtime[_0xc158('0x9')]())['then'](function(){email[_0xc158('0xa')](realtime[_0xc158('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc158('0x8')](function(){return initRealtime();})[_0xc158('0x8')](function(){return setting[_0xc158('0xc')]();})[_0xc158('0x8')](function(_0x410b74){return setInterval(initRealtime,_0x410b74[_0xc158('0xd')]*0x3e8);})[_0xc158('0xe')](function(_0xde3b61){logger[_0xc158('0xf')]('Email\x20service\x20initialization',_0xde3b61);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index be17987..118b033 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 _0xd708=['info','mailAccounts','smtp','prototype','emit','name','status','Imap','messageStatus','stringify','refresh','hasOwnProperty','active','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','error','isNil','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp'];(function(_0xb8564e,_0x5659bd){var _0x358df9=function(_0x107087){while(--_0x107087){_0xb8564e['push'](_0xb8564e['shift']());}};_0x358df9(++_0x5659bd);}(_0xd708,0xd0));var _0x8d70=function(_0x40f72c,_0x26dbe3){_0x40f72c=_0x40f72c-0x0;var _0x48448f=_0xd708[_0x40f72c];return _0x48448f;};'use strict';var _=require(_0x8d70('0x0'));var moment=require(_0x8d70('0x1'));var BPromise=require(_0x8d70('0x2'));var md5=require(_0x8d70('0x3'));var Redis=require(_0x8d70('0x4'));var config=require('../../../config/environment');var logger=require(_0x8d70('0x5'))(_0x8d70('0x6'));config[_0x8d70('0x7')]=_['defaults'](config['redis'],{'host':_0x8d70('0x8'),'port':0x18eb});var io=require(_0x8d70('0x9'))(new Redis(config[_0x8d70('0x7')]));var EmailImap=require(_0x8d70('0xa'));var EmailSmtp=require(_0x8d70('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x172592){logger[_0x8d70('0xc')]('start\x20email\x20channel');this[_0x8d70('0xd')]=_0x172592['mailAccounts'];this['imapAccounts']={};this[_0x8d70('0xe')]=new EmailSmtp();}EmailChannel[_0x8d70('0xf')][_0x8d70('0x10')]=function(_0x5a1578){var _0x59f740=this[_0x8d70('0xd')][_0x5a1578];var _0xc4b952={'id':_0x59f740['id'],'name':_0x59f740[_0x8d70('0x11')],'key':_0x59f740['key'],'active':_0x59f740['active'],'Imap':{'status':_0x59f740['Imap'][_0x8d70('0x12')],'messageStatus':_0x59f740[_0x8d70('0x13')][_0x8d70('0x14')],'total':_0x59f740[_0x8d70('0x13')]['total']}};if(_['isNil'](md5Accounts[_0x5a1578])){md5Accounts[_0x5a1578]={};}var _0x15dc6a=md5(JSON[_0x8d70('0x15')](_0xc4b952));if(md5Accounts[_0x5a1578][_0x8d70('0x3')]!==_0x15dc6a){md5Accounts[_0x5a1578][_0x8d70('0x3')]=_0x15dc6a;io['emit']('mailAccount:update',_0xc4b952);}};EmailChannel[_0x8d70('0xf')][_0x8d70('0x16')]=function(_0x15d2f7){for(var _0x3a3f03 in _0x15d2f7){if(_0x15d2f7[_0x8d70('0x17')](_0x3a3f03)){if(_0x15d2f7[_0x3a3f03]['Imap']&&_0x15d2f7[_0x3a3f03][_0x8d70('0x18')]){var _0xcc4e3b=_0x15d2f7[_0x3a3f03][_0x8d70('0x13')];if(!_0xcc4e3b[_0x8d70('0x19')]&&_0x15d2f7[_0x3a3f03][_0x8d70('0x1a')]!=='custom')_0xcc4e3b[_0x8d70('0x19')]=_0x15d2f7[_0x3a3f03][_0x8d70('0x1a')];if(!this['imapAccounts']['hasOwnProperty'](_0xcc4e3b['id'])){this[_0x8d70('0x1b')][_0xcc4e3b['id']]=new EmailImap(_0xcc4e3b,_0x15d2f7[_0x3a3f03][_0x8d70('0x6')]);this[_0x8d70('0x1b')][_0xcc4e3b['id']]['on'](_0x8d70('0x1c'),this[_0x8d70('0x1d')][_0x8d70('0x1e')](this,_0x3a3f03));this[_0x8d70('0x1b')][_0xcc4e3b['id']]['on'](_0x8d70('0x6'),this[_0x8d70('0x1f')]['bind'](this,_0x3a3f03));this['imapAccounts'][_0xcc4e3b['id']]['on'](_0x8d70('0x20'),this['handleImapEnd'][_0x8d70('0x1e')](this,_0x3a3f03));this['imapAccounts'][_0xcc4e3b['id']]['on'](_0x8d70('0x21'),this['handleImapError'][_0x8d70('0x1e')](this,_0x3a3f03));}}else{if(_[_0x8d70('0x22')](this['mailAccounts'][_0x3a3f03][_0x8d70('0x13')])){this[_0x8d70('0xd')][_0x3a3f03][_0x8d70('0x13')]={};}this['mailAccounts'][_0x3a3f03][_0x8d70('0x13')][_0x8d70('0x12')]=_0x8d70('0x23');this[_0x8d70('0xd')][_0x3a3f03]['Imap']['messageStatus']='';this['emit'](_0x3a3f03);}}}};EmailChannel[_0x8d70('0xf')][_0x8d70('0x1d')]=function(_0x55613b,_0x2dfae7){if(this[_0x8d70('0xd')][_0x55613b]){this['mailAccounts'][_0x55613b]['Imap'][_0x8d70('0x12')]=_0x8d70('0x24');this[_0x8d70('0xd')][_0x55613b][_0x8d70('0x13')][_0x8d70('0x14')]=_0x2dfae7['name'];if(_0x2dfae7[_0x8d70('0x25')]){this[_0x8d70('0xd')][_0x55613b][_0x8d70('0x13')]['total']=_0x2dfae7[_0x8d70('0x25')][_0x8d70('0x26')];}return this['emit'](_0x55613b);}};EmailChannel[_0x8d70('0xf')][_0x8d70('0x1f')]=function(_0x1d02c8,_0x2175a6){logger[_0x8d70('0xc')](_0x8d70('0x27'),_0x2175a6[_0x8d70('0x28')],_0x2175a6[_0x8d70('0x29')],_0x2175a6[_0x8d70('0x2a')],_0x1d02c8);if(this['mailAccounts'][_0x1d02c8]){return mailAccount[_0x8d70('0x2b')](_0x1d02c8,_0x2175a6)['then'](function(_0x3f01e4){if(_0x3f01e4){logger[_0x8d70('0xc')](_0x8d70('0x2c'));}})[_0x8d70('0x2d')](function(_0x21ad3a){logger[_0x8d70('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x8d70('0x15')](_0x21ad3a));});}};EmailChannel['prototype'][_0x8d70('0x2e')]=function(_0x2a471a){if(this['mailAccounts'][_0x2a471a]&&this[_0x8d70('0xd')][_0x2a471a][_0x8d70('0x13')]){if(this['imapAccounts'][this[_0x8d70('0xd')][_0x2a471a][_0x8d70('0x13')]['id']]){delete this['imapAccounts'][this[_0x8d70('0xd')][_0x2a471a]['Imap']['id']];}this[_0x8d70('0xd')][_0x2a471a]['Imap'][_0x8d70('0x2f')]=moment();this[_0x8d70('0x10')](_0x2a471a);}};EmailChannel[_0x8d70('0xf')]['handleImapError']=function(_0x5436be,_0x53a11a){if(this[_0x8d70('0xd')][_0x5436be]){this[_0x8d70('0xd')][_0x5436be][_0x8d70('0x13')]['status']=_0x8d70('0x21');this[_0x8d70('0xd')][_0x5436be]['Imap']['messageStatus']=_0x53a11a;return this['emit'](_0x5436be);}};EmailChannel['prototype'][_0x8d70('0x30')]=function(_0x41fbc6,_0x259eed){return this[_0x8d70('0xe')][_0x8d70('0x31')](_0x41fbc6,_0x259eed);};EmailChannel[_0x8d70('0xf')][_0x8d70('0x32')]=function(_0x3c9de6){var _0x55295=this;if(this[_0x8d70('0xd')][_0x3c9de6['id']]){if(_[_0x8d70('0x22')](this['mailAccounts'][_0x3c9de6['id']][_0x8d70('0x33')])){this[_0x8d70('0xd')][_0x3c9de6['id']][_0x8d70('0x33')]={};}this['mailAccounts'][_0x3c9de6['id']][_0x8d70('0x33')]['lastSync']=moment();return new BPromise(function(_0x558571,_0x9ff6fe){return _0x55295[_0x8d70('0xe')][_0x8d70('0x34')](_0x3c9de6)['then'](function(_0x3deeba){_0x55295[_0x8d70('0xd')][_0x3c9de6['id']][_0x8d70('0x33')][_0x8d70('0x12')]=_0x8d70('0x35');_0x55295['mailAccounts'][_0x3c9de6['id']][_0x8d70('0x33')][_0x8d70('0x14')]='';_0x55295['emit'](_0x3c9de6['id']);_0x558571(_0x3deeba);})[_0x8d70('0x2d')](function(_0x478295){_0x55295[_0x8d70('0xd')][_0x3c9de6['id']][_0x8d70('0x33')]['status']=_0x8d70('0x21');_0x55295['mailAccounts'][_0x3c9de6['id']][_0x8d70('0x33')][_0x8d70('0x14')]=_0x478295;_0x55295[_0x8d70('0x10')](_0x3c9de6['id']);_0x9ff6fe(_0x478295);});});}return this['smtp'][_0x8d70('0x34')](_0x3c9de6);};module[_0x8d70('0x36')]=EmailChannel; \ No newline at end of file +var _0x628a=['active','Imap','status','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x628a,0x105));var _0xa628=function(_0x46e784,_0x5698f4){_0x46e784=_0x46e784-0x0;var _0x380c64=_0x628a[_0x46e784];return _0x380c64;};'use strict';var _=require(_0xa628('0x0'));var moment=require(_0xa628('0x1'));var BPromise=require(_0xa628('0x2'));var md5=require(_0xa628('0x3'));var Redis=require(_0xa628('0x4'));var config=require(_0xa628('0x5'));var logger=require('../../../config/logger')(_0xa628('0x6'));config[_0xa628('0x7')]=_[_0xa628('0x8')](config[_0xa628('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xa628('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xa628('0xa'));var EmailSmtp=require(_0xa628('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x14ad21){logger[_0xa628('0xc')]('start\x20email\x20channel');this[_0xa628('0xd')]=_0x14ad21[_0xa628('0xd')];this[_0xa628('0xe')]={};this[_0xa628('0xf')]=new EmailSmtp();}EmailChannel[_0xa628('0x10')][_0xa628('0x11')]=function(_0x3954cf){var _0xe882e=this[_0xa628('0xd')][_0x3954cf];var _0x551051={'id':_0xe882e['id'],'name':_0xe882e[_0xa628('0x12')],'key':_0xe882e['key'],'active':_0xe882e[_0xa628('0x13')],'Imap':{'status':_0xe882e[_0xa628('0x14')][_0xa628('0x15')],'messageStatus':_0xe882e['Imap'][_0xa628('0x16')],'total':_0xe882e[_0xa628('0x14')][_0xa628('0x17')]}};if(_[_0xa628('0x18')](md5Accounts[_0x3954cf])){md5Accounts[_0x3954cf]={};}var _0x15a0b7=md5(JSON['stringify'](_0x551051));if(md5Accounts[_0x3954cf][_0xa628('0x3')]!==_0x15a0b7){md5Accounts[_0x3954cf][_0xa628('0x3')]=_0x15a0b7;io[_0xa628('0x11')](_0xa628('0x19'),_0x551051);}};EmailChannel['prototype'][_0xa628('0x1a')]=function(_0x25af60){for(var _0x45a145 in _0x25af60){if(_0x25af60[_0xa628('0x1b')](_0x45a145)){if(_0x25af60[_0x45a145]['Imap']&&_0x25af60[_0x45a145][_0xa628('0x13')]){var _0x54260f=_0x25af60[_0x45a145][_0xa628('0x14')];if(!_0x54260f['service']&&_0x25af60[_0x45a145][_0xa628('0x1c')]!==_0xa628('0x1d'))_0x54260f[_0xa628('0x1e')]=_0x25af60[_0x45a145]['provider'];if(!this[_0xa628('0xe')][_0xa628('0x1b')](_0x54260f['id'])){this[_0xa628('0xe')][_0x54260f['id']]=new EmailImap(_0x54260f,_0x25af60[_0x45a145]['email']);this[_0xa628('0xe')][_0x54260f['id']]['on'](_0xa628('0x1f'),this[_0xa628('0x20')]['bind'](this,_0x45a145));this[_0xa628('0xe')][_0x54260f['id']]['on'](_0xa628('0x6'),this[_0xa628('0x21')]['bind'](this,_0x45a145));this['imapAccounts'][_0x54260f['id']]['on'](_0xa628('0x22'),this[_0xa628('0x23')][_0xa628('0x24')](this,_0x45a145));this[_0xa628('0xe')][_0x54260f['id']]['on'](_0xa628('0x25'),this[_0xa628('0x26')][_0xa628('0x24')](this,_0x45a145));}}else{if(_[_0xa628('0x18')](this['mailAccounts'][_0x45a145][_0xa628('0x14')])){this['mailAccounts'][_0x45a145][_0xa628('0x14')]={};}this[_0xa628('0xd')][_0x45a145]['Imap'][_0xa628('0x15')]=_0xa628('0x27');this[_0xa628('0xd')][_0x45a145][_0xa628('0x14')][_0xa628('0x16')]='';this[_0xa628('0x11')](_0x45a145);}}}};EmailChannel[_0xa628('0x10')]['handleImapBox']=function(_0x5dc85c,_0x239b74){if(this[_0xa628('0xd')][_0x5dc85c]){this[_0xa628('0xd')][_0x5dc85c][_0xa628('0x14')][_0xa628('0x15')]=_0xa628('0x28');this[_0xa628('0xd')][_0x5dc85c][_0xa628('0x14')][_0xa628('0x16')]=_0x239b74[_0xa628('0x12')];if(_0x239b74['messages']){this[_0xa628('0xd')][_0x5dc85c][_0xa628('0x14')][_0xa628('0x17')]=_0x239b74[_0xa628('0x29')][_0xa628('0x17')];}return this['emit'](_0x5dc85c);}};EmailChannel[_0xa628('0x10')][_0xa628('0x21')]=function(_0x3c2711,_0x12ea80){logger['info'](_0xa628('0x2a'),_0x12ea80[_0xa628('0x2b')],_0x12ea80[_0xa628('0x2c')],_0x12ea80[_0xa628('0x2d')],_0x3c2711);if(this[_0xa628('0xd')][_0x3c2711]){return mailAccount[_0xa628('0x2e')](_0x3c2711,_0x12ea80)['then'](function(_0x33453b){if(_0x33453b){logger[_0xa628('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xa628('0x2f')](function(_0x3e3ba4){logger[_0xa628('0x25')](_0xa628('0x30'),JSON['stringify'](_0x3e3ba4));});}};EmailChannel[_0xa628('0x10')]['handleImapEnd']=function(_0x1a0489){if(this[_0xa628('0xd')][_0x1a0489]&&this['mailAccounts'][_0x1a0489][_0xa628('0x14')]){if(this[_0xa628('0xe')][this[_0xa628('0xd')][_0x1a0489][_0xa628('0x14')]['id']]){delete this[_0xa628('0xe')][this[_0xa628('0xd')][_0x1a0489][_0xa628('0x14')]['id']];}this[_0xa628('0xd')][_0x1a0489][_0xa628('0x14')][_0xa628('0x31')]=moment();this['emit'](_0x1a0489);}};EmailChannel[_0xa628('0x10')]['handleImapError']=function(_0xa826d8,_0x5c0875){if(this[_0xa628('0xd')][_0xa826d8]){this[_0xa628('0xd')][_0xa826d8][_0xa628('0x14')][_0xa628('0x15')]=_0xa628('0x25');this[_0xa628('0xd')][_0xa826d8][_0xa628('0x14')][_0xa628('0x16')]=_0x5c0875;return this[_0xa628('0x11')](_0xa826d8);}};EmailChannel[_0xa628('0x10')][_0xa628('0x32')]=function(_0x4d5117,_0x442ddf){return this[_0xa628('0xf')]['send'](_0x4d5117,_0x442ddf);};EmailChannel[_0xa628('0x10')]['verifySmtp']=function(_0x46b649){var _0x24081c=this;if(this[_0xa628('0xd')][_0x46b649['id']]){if(_[_0xa628('0x18')](this[_0xa628('0xd')][_0x46b649['id']]['Smtp'])){this[_0xa628('0xd')][_0x46b649['id']]['Smtp']={};}this[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x31')]=moment();return new BPromise(function(_0x186dc3,_0x5e3eed){return _0x24081c[_0xa628('0xf')][_0xa628('0x34')](_0x46b649)[_0xa628('0x35')](function(_0x1357b2){_0x24081c[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x15')]=_0xa628('0x36');_0x24081c[_0xa628('0xd')][_0x46b649['id']]['Smtp'][_0xa628('0x16')]='';_0x24081c[_0xa628('0x11')](_0x46b649['id']);_0x186dc3(_0x1357b2);})['catch'](function(_0x256816){_0x24081c[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x15')]='error';_0x24081c[_0xa628('0xd')][_0x46b649['id']][_0xa628('0x33')][_0xa628('0x16')]=_0x256816;_0x24081c['emit'](_0x46b649['id']);_0x5e3eed(_0x256816);});});}return this[_0xa628('0xf')][_0xa628('0x34')](_0x46b649);};module[_0xa628('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 28b7e9c..a8d18ec 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 _0xb722=['error','handleError','connect','inherits','prototype','authTimeout','service','user','modernAuthentication','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','emit','stringify','textCode','hasOwnProperty','upperFirst','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xb722,0x191));var _0x2b72=function(_0x3e8986,_0xe56400){_0x3e8986=_0x3e8986-0x0;var _0x17200c=_0xb722[_0x3e8986];return _0x17200c;};'use strict';var _=require(_0x2b72('0x0'));var util=require('util');var Imap=require(_0x2b72('0x1'));var simpleParser=require(_0x2b72('0x2'))[_0x2b72('0x3')];var Iconv=require(_0x2b72('0x4'))[_0x2b72('0x5')];var EventEmitter=require(_0x2b72('0x6'))[_0x2b72('0x7')];var utils=require('./utils');var logger=require(_0x2b72('0x8'))(_0x2b72('0x9'));function EmailImap(_0x62f470,_0x1f1bed){this[_0x2b72('0xa')]=_0x62f470[_0x2b72('0xa')];this[_0x2b72('0xb')]=this[_0x2b72('0xc')](_0x62f470,_0x1f1bed);this['imap']=new Imap(this[_0x2b72('0xb')]);this[_0x2b72('0x1')][_0x2b72('0xd')](_0x2b72('0xe'),this[_0x2b72('0xf')][_0x2b72('0x10')](this));this[_0x2b72('0x1')][_0x2b72('0xd')](_0x2b72('0x11'),this[_0x2b72('0x12')]['bind'](this));this[_0x2b72('0x1')]['on'](_0x2b72('0x13'),this[_0x2b72('0x14')][_0x2b72('0x10')](this));this[_0x2b72('0x1')][_0x2b72('0x15')]();}util[_0x2b72('0x16')](EmailImap,EventEmitter);EmailImap[_0x2b72('0x17')][_0x2b72('0xc')]=function(_0x59d414,_0x1c5e93){var _0x51d3e7={'connTimeout':_0x59d414['connTimeout']?_0x59d414['connTimeout']*0x3e8:0x2710,'authTimeout':_0x59d414['authTimeout']?_0x59d414[_0x2b72('0x18')]*0x3e8:0x1388};if(_0x59d414[_0x2b72('0x19')]){_0x51d3e7[_0x2b72('0x1a')]=_0x59d414[_0x2b72('0x1a')];if(_0x59d414[_0x2b72('0x1b')]){_0x51d3e7['xoauth2']=utils['generateXOAuth2Token'](_0x59d414[_0x2b72('0x1c')]['data5'],_0x59d414[_0x2b72('0x1a')]);}else{_0x51d3e7[_0x2b72('0x1d')]=_0x59d414['password'];}}else{if(_0x59d414[_0x2b72('0x1e')]){_0x51d3e7[_0x2b72('0x1a')]=_0x59d414['user'];_0x51d3e7[_0x2b72('0x1d')]=_0x59d414['password'];}}_0x51d3e7['email']=_0x1c5e93||_0x59d414[_0x2b72('0x1a')]||_0x2b72('0x1f');_0x51d3e7[_0x2b72('0x20')]=_0x59d414[_0x2b72('0x20')];_0x51d3e7[_0x2b72('0x21')]=_0x59d414[_0x2b72('0x21')]||0x3e1;if(_0x59d414[_0x2b72('0x22')]){_0x51d3e7[_0x2b72('0x22')]=!![];}else{_0x51d3e7[_0x2b72('0x22')]=![];_0x51d3e7['autotls']=_0x2b72('0x23');}return _0x51d3e7;};EmailImap['prototype'][_0x2b72('0xf')]=function(){this['imap'][_0x2b72('0x24')](this[_0x2b72('0xa')],![],this[_0x2b72('0x25')][_0x2b72('0x10')](this));};EmailImap[_0x2b72('0x17')]['handleOpenBox']=function(_0x57b707,_0x37d8a7){if(_0x57b707){this[_0x2b72('0x14')](_0x57b707,!![]);}else{this['emit']('box',_0x37d8a7);this[_0x2b72('0x26')]();}};EmailImap[_0x2b72('0x17')][_0x2b72('0x27')]=function(_0xcf9b42){if(_0xcf9b42){this[_0x2b72('0x14')](_0xcf9b42,!![]);}else{this[_0x2b72('0x1')][_0x2b72('0x11')]();}};EmailImap[_0x2b72('0x17')]['readUnseen']=function(){this[_0x2b72('0x1')]['search']([_0x2b72('0x28')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x2b72('0x29')]=function(_0x18c53b,_0x401a2c){if(_0x18c53b){this['handleError'](_0x18c53b,!![]);}else{if(_0x401a2c[_0x2b72('0x2a')]){try{var _0x466e79=this[_0x2b72('0x1')][_0x2b72('0x2b')](_0x401a2c,{'bodies':'','markSeen':!![]});_0x466e79['on'](_0x2b72('0x2c'),this[_0x2b72('0x2d')][_0x2b72('0x10')](this));_0x466e79['once'](_0x2b72('0x13'),this[_0x2b72('0x2e')][_0x2b72('0x10')](this));_0x466e79['once'](_0x2b72('0x11'),this[_0x2b72('0x2f')]['bind'](this));}catch(_0x54169f){logger['error'](_0x54169f);}}else{this[_0x2b72('0x1')][_0x2b72('0x30')](!![],this[_0x2b72('0x27')][_0x2b72('0x10')](this));}}};EmailImap['prototype'][_0x2b72('0x2d')]=function(_0x43c948){_0x43c948['on'](_0x2b72('0x31'),this['handleMessageBody']['bind'](this));_0x43c948[_0x2b72('0xd')](_0x2b72('0x32'),this[_0x2b72('0x33')][_0x2b72('0x10')](this));_0x43c948[_0x2b72('0xd')](_0x2b72('0x11'),this[_0x2b72('0x34')][_0x2b72('0x10')](this));};EmailImap['prototype'][_0x2b72('0x35')]=function(_0x1094cd){simpleParser(_0x1094cd,{'Iconv':Iconv},this[_0x2b72('0x36')]['bind'](this));};EmailImap[_0x2b72('0x17')]['handleMessageAttributes']=function(){};EmailImap[_0x2b72('0x17')][_0x2b72('0x34')]=function(){};EmailImap[_0x2b72('0x17')][_0x2b72('0x36')]=function(_0x504add,_0x295ce5){if(_0x504add){logger[_0x2b72('0x13')](_0x504add);}else{var _0x42b94f=this;utils['parser'](this[_0x2b72('0xb')],_0x295ce5,function(_0x21c7a0){_0x42b94f['emit'](_0x2b72('0x9'),_0x21c7a0);});}};EmailImap[_0x2b72('0x17')]['handleFetchEnd']=function(){this[_0x2b72('0x1')][_0x2b72('0x30')](!![],this[_0x2b72('0x27')][_0x2b72('0x10')](this));};EmailImap[_0x2b72('0x17')][_0x2b72('0x2e')]=function(_0x3c788a){this[_0x2b72('0x14')](_0x3c788a);this['imap']['closeBox'](!![],this[_0x2b72('0x27')][_0x2b72('0x10')](this));};EmailImap[_0x2b72('0x17')][_0x2b72('0x12')]=function(){this[_0x2b72('0x37')]('end');};EmailImap[_0x2b72('0x17')][_0x2b72('0x14')]=function(_0xacdc36,_0x17ab59){logger[_0x2b72('0x13')](_0x2b72('0x14'),this[_0x2b72('0xb')][_0x2b72('0x9')],JSON[_0x2b72('0x38')](_0xacdc36));var _0x122781='';if(_0xacdc36){if(_0xacdc36[_0x2b72('0x39')]){_0x122781=_0xacdc36[_0x2b72('0x39')];}else{for(var _0x1163bc in _0xacdc36){if(_0xacdc36[_0x2b72('0x3a')](_0x1163bc)){_0x122781+=_[_0x2b72('0x3b')](_0x1163bc)+':\x20'+_0xacdc36[_0x1163bc]+'\x0a';}}}}if(_0x17ab59){this[_0x2b72('0x1')][_0x2b72('0x11')]();}else{this[_0x2b72('0x37')](_0x2b72('0x13'),_0x122781);this[_0x2b72('0x37')](_0x2b72('0x11'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x0e96=['modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','mailbox','account','getAccount','imap','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x0e96,0x69));var _0x60e9=function(_0x797fab,_0x3bd44f){_0x797fab=_0x797fab-0x0;var _0x502434=_0x0e96[_0x797fab];return _0x502434;};'use strict';var _=require(_0x60e9('0x0'));var util=require(_0x60e9('0x1'));var Imap=require('imap');var simpleParser=require(_0x60e9('0x2'))[_0x60e9('0x3')];var Iconv=require(_0x60e9('0x4'))['Iconv'];var EventEmitter=require(_0x60e9('0x5'))[_0x60e9('0x6')];var utils=require('./utils');var logger=require(_0x60e9('0x7'))('email');function EmailImap(_0x19b040,_0x4438c3){this[_0x60e9('0x8')]=_0x19b040[_0x60e9('0x8')];this[_0x60e9('0x9')]=this[_0x60e9('0xa')](_0x19b040,_0x4438c3);this[_0x60e9('0xb')]=new Imap(this['account']);this['imap']['once']('ready',this[_0x60e9('0xc')][_0x60e9('0xd')](this));this[_0x60e9('0xb')][_0x60e9('0xe')](_0x60e9('0xf'),this[_0x60e9('0x10')][_0x60e9('0xd')](this));this['imap']['on'](_0x60e9('0x11'),this[_0x60e9('0x12')][_0x60e9('0xd')](this));this[_0x60e9('0xb')]['connect']();}util[_0x60e9('0x13')](EmailImap,EventEmitter);EmailImap[_0x60e9('0x14')][_0x60e9('0xa')]=function(_0x1b5bb6,_0x96ecdf){var _0x4934a9={'connTimeout':_0x1b5bb6[_0x60e9('0x15')]?_0x1b5bb6[_0x60e9('0x15')]*0x3e8:0x2710,'authTimeout':_0x1b5bb6['authTimeout']?_0x1b5bb6[_0x60e9('0x16')]*0x3e8:0x1388};if(_0x1b5bb6[_0x60e9('0x17')]){_0x4934a9['user']=_0x1b5bb6[_0x60e9('0x18')];if(_0x1b5bb6[_0x60e9('0x19')]){_0x4934a9['xoauth2']=utils[_0x60e9('0x1a')](_0x1b5bb6[_0x60e9('0x1b')][_0x60e9('0x1c')],_0x1b5bb6['user']);}else{_0x4934a9['password']=_0x1b5bb6[_0x60e9('0x1d')];}}else{if(_0x1b5bb6[_0x60e9('0x1e')]){_0x4934a9[_0x60e9('0x18')]=_0x1b5bb6[_0x60e9('0x18')];_0x4934a9[_0x60e9('0x1d')]=_0x1b5bb6['password'];}}_0x4934a9[_0x60e9('0x1f')]=_0x96ecdf||_0x1b5bb6[_0x60e9('0x18')]||_0x60e9('0x20');_0x4934a9[_0x60e9('0x21')]=_0x1b5bb6['host'];_0x4934a9[_0x60e9('0x22')]=_0x1b5bb6['port']||0x3e1;if(_0x1b5bb6[_0x60e9('0x23')]){_0x4934a9['tls']=!![];}else{_0x4934a9[_0x60e9('0x23')]=![];_0x4934a9[_0x60e9('0x24')]=_0x60e9('0x25');}return _0x4934a9;};EmailImap[_0x60e9('0x14')][_0x60e9('0xc')]=function(){this[_0x60e9('0xb')][_0x60e9('0x26')](this[_0x60e9('0x8')],![],this[_0x60e9('0x27')][_0x60e9('0xd')](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x27')]=function(_0x2e6254,_0x2615a1){if(_0x2e6254){this['handleError'](_0x2e6254,!![]);}else{this['emit']('box',_0x2615a1);this[_0x60e9('0x28')]();}};EmailImap[_0x60e9('0x14')][_0x60e9('0x29')]=function(_0x549ec8){if(_0x549ec8){this[_0x60e9('0x12')](_0x549ec8,!![]);}else{this[_0x60e9('0xb')][_0x60e9('0xf')]();}};EmailImap[_0x60e9('0x14')]['readUnseen']=function(){this[_0x60e9('0xb')][_0x60e9('0x2a')]([_0x60e9('0x2b')],this[_0x60e9('0x2c')]['bind'](this));};EmailImap['prototype'][_0x60e9('0x2c')]=function(_0x1b9ace,_0x567353){if(_0x1b9ace){this[_0x60e9('0x12')](_0x1b9ace,!![]);}else{if(_0x567353[_0x60e9('0x2d')]){try{var _0x5d5097=this['imap'][_0x60e9('0x2e')](_0x567353,{'bodies':'','markSeen':!![]});_0x5d5097['on'](_0x60e9('0x2f'),this[_0x60e9('0x30')][_0x60e9('0xd')](this));_0x5d5097[_0x60e9('0xe')](_0x60e9('0x11'),this[_0x60e9('0x31')][_0x60e9('0xd')](this));_0x5d5097['once'](_0x60e9('0xf'),this[_0x60e9('0x32')]['bind'](this));}catch(_0x1e98ef){logger['error'](_0x1e98ef);}}else{this[_0x60e9('0xb')]['closeBox'](!![],this[_0x60e9('0x29')][_0x60e9('0xd')](this));}}};EmailImap[_0x60e9('0x14')][_0x60e9('0x30')]=function(_0x5ed26f){_0x5ed26f['on'](_0x60e9('0x33'),this[_0x60e9('0x34')][_0x60e9('0xd')](this));_0x5ed26f[_0x60e9('0xe')](_0x60e9('0x35'),this[_0x60e9('0x36')]['bind'](this));_0x5ed26f['once']('end',this[_0x60e9('0x37')][_0x60e9('0xd')](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x34')]=function(_0x41bb37){simpleParser(_0x41bb37,{'Iconv':Iconv},this[_0x60e9('0x38')][_0x60e9('0xd')](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x36')]=function(){};EmailImap[_0x60e9('0x14')][_0x60e9('0x37')]=function(){};EmailImap[_0x60e9('0x14')][_0x60e9('0x38')]=function(_0x39d508,_0x516f30){if(_0x39d508){logger[_0x60e9('0x11')](_0x39d508);}else{var _0x5c4f18=this;utils[_0x60e9('0x39')](this[_0x60e9('0x9')],_0x516f30,function(_0x4d217e){_0x5c4f18['emit'](_0x60e9('0x1f'),_0x4d217e);});}};EmailImap[_0x60e9('0x14')][_0x60e9('0x32')]=function(){this['imap'][_0x60e9('0x3a')](!![],this[_0x60e9('0x29')][_0x60e9('0xd')](this));};EmailImap['prototype'][_0x60e9('0x31')]=function(_0x29fb3e){this[_0x60e9('0x12')](_0x29fb3e);this[_0x60e9('0xb')][_0x60e9('0x3a')](!![],this[_0x60e9('0x29')]['bind'](this));};EmailImap[_0x60e9('0x14')][_0x60e9('0x10')]=function(){this[_0x60e9('0x3b')](_0x60e9('0xf'));};EmailImap['prototype'][_0x60e9('0x12')]=function(_0x818133,_0x3a246d){logger[_0x60e9('0x11')]('handleError',this[_0x60e9('0x9')][_0x60e9('0x1f')],JSON[_0x60e9('0x3c')](_0x818133));var _0x474777='';if(_0x818133){if(_0x818133[_0x60e9('0x3d')]){_0x474777=_0x818133['textCode'];}else{for(var _0x238487 in _0x818133){if(_0x818133[_0x60e9('0x3e')](_0x238487)){_0x474777+=_[_0x60e9('0x3f')](_0x238487)+':\x20'+_0x818133[_0x238487]+'\x0a';}}}}if(_0x3a246d){this[_0x60e9('0xb')]['end']();}else{this[_0x60e9('0x3b')]('error',_0x474777);this['emit']('end');}};module[_0x60e9('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index fa1250f..b50e9cb 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 _0xd80c=['nodemailer-plugin-inline-base64','prototype','use','compile','sendMail','verify','createTransport','toString','exports'];(function(_0x13eec2,_0xe78b42){var _0x46c367=function(_0x3f399a){while(--_0x3f399a){_0x13eec2['push'](_0x13eec2['shift']());}};_0x46c367(++_0xe78b42);}(_0xd80c,0x129));var _0xcd80=function(_0x3f32ca,_0x2212f2){_0x3f32ca=_0x3f32ca-0x0;var _0xf444d=_0xd80c[_0x3f32ca];return _0xf444d;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xcd80('0x0'));function EmailSmtp(){}EmailSmtp[_0xcd80('0x1')]['send']=function(_0x38b494,_0x2a92de){return new Promise(function(_0x4fb768,_0x36a8c4){var _0xf8844c=nodemailer['createTransport'](_0x38b494);_0xf8844c[_0xcd80('0x2')](_0xcd80('0x3'),inlineBase64());_0xf8844c[_0xcd80('0x4')](_0x2a92de,function(_0x176fd1,_0xbe244b){if(_0x176fd1){_0x36a8c4(_0x176fd1['toString']());}else{_0x4fb768(_0xbe244b);}});});};EmailSmtp[_0xcd80('0x1')][_0xcd80('0x5')]=function(_0x36e8db){return new Promise(function(_0x53c395,_0x42eb22){var _0x361f78=nodemailer[_0xcd80('0x6')](_0x36e8db);_0x361f78['verify'](function(_0x35c863,_0x2d5cc1){if(_0x35c863){_0x42eb22(_0x35c863[_0xcd80('0x7')]());}else{if(_0x2d5cc1){_0x53c395(_0x2d5cc1);}else{_0x42eb22('Not\x20verifired');}}});});};module[_0xcd80('0x8')]=EmailSmtp; \ No newline at end of file +var _0x5861=['use','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x37fbee,_0x437603){var _0x1df5ba=function(_0x4ce09f){while(--_0x4ce09f){_0x37fbee['push'](_0x37fbee['shift']());}};_0x1df5ba(++_0x437603);}(_0x5861,0xdc));var _0x1586=function(_0x256f75,_0x3f408b){_0x256f75=_0x256f75-0x0;var _0x4f6e0b=_0x5861[_0x256f75];return _0x4f6e0b;};'use strict';var nodemailer=require(_0x1586('0x0'));var inlineBase64=require(_0x1586('0x1'));function EmailSmtp(){}EmailSmtp[_0x1586('0x2')][_0x1586('0x3')]=function(_0x485d9d,_0xf5523d){return new Promise(function(_0xec2fae,_0x1d7ca4){var _0x5547e6=nodemailer[_0x1586('0x4')](_0x485d9d);_0x5547e6[_0x1586('0x5')]('compile',inlineBase64());_0x5547e6['sendMail'](_0xf5523d,function(_0x32e598,_0x263eee){if(_0x32e598){_0x1d7ca4(_0x32e598[_0x1586('0x6')]());}else{_0xec2fae(_0x263eee);}});});};EmailSmtp[_0x1586('0x2')][_0x1586('0x7')]=function(_0x2e38ef){return new Promise(function(_0x22670a,_0x20ff30){var _0x510716=nodemailer[_0x1586('0x4')](_0x2e38ef);_0x510716['verify'](function(_0x50b9fa,_0x594cc3){if(_0x50b9fa){_0x20ff30(_0x50b9fa[_0x1586('0x6')]());}else{if(_0x594cc3){_0x22670a(_0x594cc3);}else{_0x20ff30('Not\x20verifired');}}});});};module[_0x1586('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 09e4ad6..8ae3f86 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 _0x2306=['Attachments','Title','generateXOAuth2Token','user=','utf-8','lodash','moment','randomstring','path','node-tnef','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','length','slice','join','Anonymous','isEmpty','anonymous','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

'];(function(_0x23aa6c,_0x215c2d){var _0x2e5277=function(_0x21f5a2){while(--_0x21f5a2){_0x23aa6c['push'](_0x23aa6c['shift']());}};_0x2e5277(++_0x215c2d);}(_0x2306,0x17c));var _0x6230=function(_0x4c1672,_0x279631){_0x4c1672=_0x4c1672-0x0;var _0x170dc7=_0x2306[_0x4c1672];return _0x170dc7;};'use strict';var _=require(_0x6230('0x0'));var moment=require(_0x6230('0x1'));var random=require(_0x6230('0x2'));var fs=require('fs');var path=require(_0x6230('0x3'));var util=require('util');var tnef=require(_0x6230('0x4'));var logger=require('../../../config/logger')(_0x6230('0x5'));var config=require(_0x6230('0x6'));function getAddress(_0x12bb61){var _0x5d3bb6=_[_0x6230('0x7')](_0x12bb61[_0x6230('0x8')]);return _0x5d3bb6&&_0x5d3bb6[_0x6230('0x9')]?_0x5d3bb6['address']:'anonymous'+random[_0x6230('0xa')](0x6)+_0x6230('0xb');}function getFirstName(_0x4b57a9){var _0x6625a7=_[_0x6230('0x7')](_0x4b57a9[_0x6230('0x8')]);if(_0x6625a7&&_0x6625a7[_0x6230('0xc')]){if(_0x6625a7['name']==_0x6625a7['address']){return _0x6625a7[_0x6230('0xc')]['substring'](0x0,_0x6625a7[_0x6230('0xc')]['indexOf']('@'));}var _0x3e0dc6=_0x6625a7[_0x6230('0xc')][_0x6230('0xd')](/\s+/);return _0x3e0dc6[_0x6230('0xe')]>0x1?_0x3e0dc6[_0x6230('0xf')](0x0,-0x1)[_0x6230('0x10')]('\x20'):_0x6625a7[_0x6230('0xc')];}return _0x6230('0x11');}function getLastName(_0xfb3bc0){var _0x3f30c9=_[_0x6230('0x7')](_0xfb3bc0[_0x6230('0x8')]);if(_0x3f30c9&&_0x3f30c9[_0x6230('0xc')]){var _0x349a67=_0x3f30c9[_0x6230('0xc')]['split'](/\s+/);return _0x349a67['length']>0x1?_0x349a67['pop']():'';}return'';}function getMails(_0x571132,_0x5d5a8d){var _0xa529ea='';for(var _0x2bf58e=0x0;_0x2bf58e<_0x5d5a8d[_0x6230('0x8')][_0x6230('0xe')];_0x2bf58e+=0x1){if(_0x5d5a8d[_0x6230('0x8')][_0x2bf58e][_0x6230('0x9')]!==_0x571132){if(!_[_0x6230('0x12')](_0xa529ea)){_0xa529ea+=',';}_0xa529ea+=_0x5d5a8d[_0x6230('0x8')][_0x2bf58e]['name']||_0x5d5a8d[_0x6230('0x8')][_0x2bf58e][_0x6230('0x9')]||'';_0xa529ea+='\x20<';_0xa529ea+=_0x5d5a8d[_0x6230('0x8')][_0x2bf58e][_0x6230('0x9')]?_0x5d5a8d[_0x6230('0x8')][_0x2bf58e][_0x6230('0x9')]:_0x6230('0x13')+random[_0x6230('0xa')](0x6)+_0x6230('0xb');_0xa529ea+='>';}}return _0xa529ea;}function parseEmail(_0xa2d19d,_0x598733,_0x37f678){if(_0x598733['html']){var _0x5e06e0=/)<[^<]*)*<\/script>/gi;while(_0x5e06e0[_0x6230('0x14')](_0x598733[_0x6230('0x15')])){_0x598733[_0x6230('0x15')]=_0x598733[_0x6230('0x15')][_0x6230('0x16')](_0x5e06e0,'');}if(_0x598733[_0x6230('0x15')][_0x6230('0x17')](_0x6230('0x18'))){var _0x179109=[];_0x598733['attachments'][_0x6230('0x19')](_0x3572bd=>{_0x179109[_0x6230('0x1a')](_0x3572bd['filename']);});var _0x586fc9=/]+>/g;var _0x36ec88=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2ef095=_0x598733['html'][_0x6230('0x16')](_0x36ec88,_0x6230('0x1b'));var _0x5ce329=_0x2ef095[_0x6230('0x16')](_0x586fc9,_0x6230('0x1c'));for(let _0x4ca39c=0x0;_0x4ca39c<_0x179109['length'];_0x4ca39c++){var _0x4d0507=_0x5ce329[_0x6230('0x16')]('_IMG',_0x6230('0x1d')+_0x179109[_0x4ca39c]+_0x6230('0x1e'));_0x5ce329=_0x4d0507;}_0x598733['html']=_0x5ce329;}_0x37f678[_0x6230('0x1f')]=_0x598733[_0x6230('0x15')];}else{_0x37f678[_0x6230('0x1f')]=_0x598733[_0x6230('0x20')];}if(_0x37f678[_0x6230('0x1f')]){_0x37f678[_0x6230('0x1f')]=_0x37f678['body']['replace'](/0x0){var _0x149940=[_0x6230('0x32'),_0x6230('0x33'),_0x6230('0x34')];for(var _0x2cef0b=0x0;_0x2cef0b<_0x598733[_0x6230('0x31')][_0x6230('0xe')];_0x2cef0b++){var _0x47c1cb=_[_0x6230('0x35')](_0x149940,_0x598733[_0x6230('0x31')][_0x2cef0b]['line']);if(_0x47c1cb>=0x0){_0x37f678[_0x6230('0x36')]=!![];}}}return _0x37f678;}exports[_0x6230('0x37')]=function(_0x2e9132,_0x24fc2a,_0x1b55ea){var _0xc3c5f5={'from':getAddress(_0x24fc2a['from']),'firstName':getFirstName(_0x24fc2a[_0x6230('0x38')]),'lastName':getLastName(_0x24fc2a[_0x6230('0x38')]),'mapKey':_0x6230('0x5'),'message':{'from':getMails(_0x2e9132['email'],_0x24fc2a[_0x6230('0x38')]),'to':_0x2e9132[_0x6230('0x5')],'cc':'','subject':_0x24fc2a[_0x6230('0x39')]||'','messageId':_0x24fc2a[_0x6230('0x3a')],'inReplyTo':_0x24fc2a[_0x6230('0x3b')],'sentAt':moment(_0x24fc2a[_0x6230('0x3c')])[_0x6230('0x2c')](_0x6230('0x3d')),'attach':![],'attachments':[]}};if(!_0x24fc2a[_0x6230('0x15')]&&!_0x24fc2a['textAsHtml']){var _0x5a3701=_[_0x6230('0x3e')](_0x24fc2a['attachments'],{'contentType':_0x6230('0x3f')});if(_0x5a3701[_0x6230('0xe')]){logger[_0x6230('0x40')](util[_0x6230('0x2c')](_0x6230('0x41'),_0x24fc2a[_0x6230('0x3a')]));tnef['parseBuffer'](_[_0x6230('0x42')](_0x5a3701)[_0x6230('0x43')],function(_0x55dbbe,_0x50d5e8){if(_0x50d5e8){_0x24fc2a[_0x6230('0x15')]=_0x50d5e8[_0x6230('0x44')]||_0x6230('0x45');if(_0x50d5e8[_0x6230('0x46')]){for(var _0x41af81=0x0;_0x41af81<_0x50d5e8['Attachments']['length'];_0x41af81++){var _0x2d2389=_0x50d5e8[_0x6230('0x46')][_0x41af81];_0xc3c5f5['message']['attachments'][_0x6230('0x1a')]({'filename':_0x2d2389[_0x6230('0x47')],'content':Buffer[_0x6230('0x38')](_0x2d2389['Data'])});}}}_0x1b55ea(parseEmail(_0x2e9132,_0x24fc2a,_0xc3c5f5));});}else{_0x24fc2a[_0x6230('0x15')]='

Empty\x20message

';_0x1b55ea(parseEmail(_0x2e9132,_0x24fc2a,_0xc3c5f5));}}else{_0x1b55ea(parseEmail(_0x2e9132,_0x24fc2a,_0xc3c5f5));}};exports[_0x6230('0x48')]=function(_0x430999,_0x27b3e3){var _0x109c3a=[_0x6230('0x49')+(_0x27b3e3||''),'auth=Bearer\x20'+_0x430999,'',''];return Buffer[_0x6230('0x38')](_0x109c3a['join'](''),_0x6230('0x4a'))['toString']('base64');}; \ No newline at end of file +var _0x5922=['user=','base64','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','pop','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token'];(function(_0xad39f6,_0x129028){var _0x2eb864=function(_0xfc11bb){while(--_0xfc11bb){_0xad39f6['push'](_0xad39f6['shift']());}};_0x2eb864(++_0x129028);}(_0x5922,0x132));var _0x2592=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x5922[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var moment=require(_0x2592('0x0'));var random=require(_0x2592('0x1'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x2592('0x2'));var logger=require(_0x2592('0x3'))(_0x2592('0x4'));var config=require(_0x2592('0x5'));function getAddress(_0x3d8501){var _0x29eee8=_[_0x2592('0x6')](_0x3d8501[_0x2592('0x7')]);return _0x29eee8&&_0x29eee8[_0x2592('0x8')]?_0x29eee8[_0x2592('0x8')]:_0x2592('0x9')+random[_0x2592('0xa')](0x6)+_0x2592('0xb');}function getFirstName(_0x1b75bb){var _0x1f217d=_[_0x2592('0x6')](_0x1b75bb[_0x2592('0x7')]);if(_0x1f217d&&_0x1f217d[_0x2592('0xc')]){if(_0x1f217d['name']==_0x1f217d[_0x2592('0x8')]){return _0x1f217d[_0x2592('0xc')][_0x2592('0xd')](0x0,_0x1f217d[_0x2592('0xc')][_0x2592('0xe')]('@'));}var _0x51ec41=_0x1f217d[_0x2592('0xc')][_0x2592('0xf')](/\s+/);return _0x51ec41[_0x2592('0x10')]>0x1?_0x51ec41[_0x2592('0x11')](0x0,-0x1)[_0x2592('0x12')]('\x20'):_0x1f217d[_0x2592('0xc')];}return'Anonymous';}function getLastName(_0x38a446){var _0x224418=_['head'](_0x38a446[_0x2592('0x7')]);if(_0x224418&&_0x224418[_0x2592('0xc')]){var _0x2d33e2=_0x224418[_0x2592('0xc')]['split'](/\s+/);return _0x2d33e2['length']>0x1?_0x2d33e2[_0x2592('0x13')]():'';}return'';}function getMails(_0x3452bb,_0x297eb0){var _0x6ef5dc='';for(var _0x34f5c4=0x0;_0x34f5c4<_0x297eb0[_0x2592('0x7')][_0x2592('0x10')];_0x34f5c4+=0x1){if(_0x297eb0[_0x2592('0x7')][_0x34f5c4]['address']!==_0x3452bb){if(!_[_0x2592('0x14')](_0x6ef5dc)){_0x6ef5dc+=',';}_0x6ef5dc+=_0x297eb0[_0x2592('0x7')][_0x34f5c4][_0x2592('0xc')]||_0x297eb0['value'][_0x34f5c4]['address']||'';_0x6ef5dc+='\x20<';_0x6ef5dc+=_0x297eb0[_0x2592('0x7')][_0x34f5c4]['address']?_0x297eb0[_0x2592('0x7')][_0x34f5c4][_0x2592('0x8')]:'anonymous'+random[_0x2592('0xa')](0x6)+_0x2592('0xb');_0x6ef5dc+='>';}}return _0x6ef5dc;}function parseEmail(_0x1a97ca,_0x2f93fd,_0x337996){if(_0x2f93fd['html']){var _0x37dbbd=/)<[^<]*)*<\/script>/gi;while(_0x37dbbd[_0x2592('0x15')](_0x2f93fd[_0x2592('0x16')])){_0x2f93fd[_0x2592('0x16')]=_0x2f93fd[_0x2592('0x16')][_0x2592('0x17')](_0x37dbbd,'');}if(_0x2f93fd[_0x2592('0x16')][_0x2592('0x18')](_0x2592('0x19'))){var _0x5e52c5=[];_0x2f93fd['attachments'][_0x2592('0x1a')](_0x2b4413=>{_0x5e52c5[_0x2592('0x1b')](_0x2b4413[_0x2592('0x1c')]);});var _0x3864fa=/]+>/g;var _0x292f0b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x21c880=_0x2f93fd['html'][_0x2592('0x17')](_0x292f0b,_0x2592('0x1d'));var _0x120bab=_0x21c880['replace'](_0x3864fa,'_IMG');for(let _0xc3dbce=0x0;_0xc3dbce<_0x5e52c5[_0x2592('0x10')];_0xc3dbce++){var _0xe55950=_0x120bab['replace'](_0x2592('0x1e'),_0x2592('0x1f')+_0x5e52c5[_0xc3dbce]+_0x2592('0x20'));_0x120bab=_0xe55950;}_0x2f93fd[_0x2592('0x16')]=_0x120bab;}_0x337996[_0x2592('0x21')]=_0x2f93fd[_0x2592('0x16')];}else{_0x337996['body']=_0x2f93fd[_0x2592('0x22')];}if(_0x337996[_0x2592('0x21')]){_0x337996[_0x2592('0x21')]=_0x337996[_0x2592('0x21')][_0x2592('0x17')](/0x0){var _0x47efa7=[_0x2592('0x34'),_0x2592('0x35'),_0x2592('0x36')];for(var _0x2a05ae=0x0;_0x2a05ae<_0x2f93fd['headerLines'][_0x2592('0x10')];_0x2a05ae++){var _0x3a41bd=_[_0x2592('0xe')](_0x47efa7,_0x2f93fd[_0x2592('0x33')][_0x2a05ae][_0x2592('0x37')]);if(_0x3a41bd>=0x0){_0x337996[_0x2592('0x38')]=!![];}}}return _0x337996;}exports[_0x2592('0x39')]=function(_0x469401,_0x273cee,_0x53daee){var _0x55a4fc={'from':getAddress(_0x273cee[_0x2592('0x3a')]),'firstName':getFirstName(_0x273cee[_0x2592('0x3a')]),'lastName':getLastName(_0x273cee[_0x2592('0x3a')]),'mapKey':'email','message':{'from':getMails(_0x469401['email'],_0x273cee[_0x2592('0x3a')]),'to':_0x469401[_0x2592('0x4')],'cc':'','subject':_0x273cee[_0x2592('0x3b')]||'','messageId':_0x273cee[_0x2592('0x3c')],'inReplyTo':_0x273cee[_0x2592('0x3d')],'sentAt':moment(_0x273cee['date'])[_0x2592('0x2d')](_0x2592('0x3e')),'attach':![],'attachments':[]}};if(!_0x273cee[_0x2592('0x16')]&&!_0x273cee[_0x2592('0x22')]){var _0x3a1740=_[_0x2592('0x3f')](_0x273cee[_0x2592('0x28')],{'contentType':_0x2592('0x40')});if(_0x3a1740[_0x2592('0x10')]){logger[_0x2592('0x41')](util[_0x2592('0x2d')](_0x2592('0x42'),_0x273cee[_0x2592('0x3c')]));tnef[_0x2592('0x43')](_[_0x2592('0x44')](_0x3a1740)['content'],function(_0xba89b0,_0x2b110e){if(_0x2b110e){_0x273cee[_0x2592('0x16')]=_0x2b110e[_0x2592('0x45')]||_0x2592('0x46');if(_0x2b110e['Attachments']){for(var _0x151b1c=0x0;_0x151b1c<_0x2b110e[_0x2592('0x47')][_0x2592('0x10')];_0x151b1c++){var _0xcf4333=_0x2b110e[_0x2592('0x47')][_0x151b1c];_0x55a4fc[_0x2592('0x24')]['attachments']['push']({'filename':_0xcf4333['Title'],'content':Buffer[_0x2592('0x3a')](_0xcf4333[_0x2592('0x48')])});}}}_0x53daee(parseEmail(_0x469401,_0x273cee,_0x55a4fc));});}else{_0x273cee[_0x2592('0x16')]='

Empty\x20message

';_0x53daee(parseEmail(_0x469401,_0x273cee,_0x55a4fc));}}else{_0x53daee(parseEmail(_0x469401,_0x273cee,_0x55a4fc));}};exports[_0x2592('0x49')]=function(_0x3c76db,_0x1ef00b){var _0x2a6272=[_0x2592('0x4a')+(_0x1ef00b||''),'auth=Bearer\x20'+_0x3c76db,'',''];return Buffer['from'](_0x2a6272[_0x2592('0x12')](''),'utf-8')['toString'](_0x2592('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d416c30..b4b3e14 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 _0x219a=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x5c5f69,_0x4d568b){var _0x50c1bc=function(_0x1c6374){while(--_0x1c6374){_0x5c5f69['push'](_0x5c5f69['shift']());}};_0x50c1bc(++_0x4d568b);}(_0x219a,0x147));var _0xa219=function(_0x385958,_0x3aa415){_0x385958=_0x385958-0x0;var _0x4c0a28=_0x219a[_0x385958];return _0x4c0a28;};'use strict';var _=require(_0xa219('0x0'));function MailAccount(_0x27369a){this['id']=_0x27369a['id']||0x0;this[_0xa219('0x1')]=_0x27369a[_0xa219('0x1')]||_0xa219('0x2');this[_0xa219('0x3')]=_0x27369a['key']||_0xa219('0x4');this[_0xa219('0x5')]=_0x27369a['active']||![];this[_0xa219('0x6')]=_0x27369a[_0xa219('0x6')]||[];this['Smtp']=_0x27369a[_0xa219('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xb868=['Imap','Smtp','exports','lodash','key','SERV','active'];(function(_0x24aeb1,_0xb208d9){var _0x555b85=function(_0x35aca9){while(--_0x35aca9){_0x24aeb1['push'](_0x24aeb1['shift']());}};_0x555b85(++_0xb208d9);}(_0xb868,0x1d1));var _0x8b86=function(_0x13696e,_0x150303){_0x13696e=_0x13696e-0x0;var _0x5a24bc=_0xb868[_0x13696e];return _0x5a24bc;};'use strict';var _=require(_0x8b86('0x0'));function MailAccount(_0x348652){this['id']=_0x348652['id']||0x0;this['name']=_0x348652['name']||'Service';this[_0x8b86('0x1')]=_0x348652[_0x8b86('0x1')]||_0x8b86('0x2');this[_0x8b86('0x3')]=_0x348652[_0x8b86('0x3')]||![];this[_0x8b86('0x4')]=_0x348652[_0x8b86('0x4')]||[];this[_0x8b86('0x5')]=_0x348652['Smtp']||[];}module[_0x8b86('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 11a303f..c6e82a8 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 _0xdcbc=['merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xdcbc,0x8d));var _0xcdcb=function(_0x502ccd,_0x42e334){_0x502ccd=_0x502ccd-0x0;var _0x5817cf=_0xdcbc[_0x502ccd];return _0x5817cf;};'use strict';var _=require(_0xcdcb('0x0'));var MailAccount=require(_0xcdcb('0x1'));var Realtime=function(){this[_0xcdcb('0x2')]={};};function freeIsNotKey(_0xd478e5,_0x43d940,_0x6a2f83){var _0x42cbe5=_[_0xcdcb('0x3')](_0xd478e5,function(_0x23c6dc,_0x589186){return _0x23c6dc[_0x6a2f83];});for(var _0x55ad8b in _0x43d940){if(_0x43d940[_0xcdcb('0x4')](_0x55ad8b)){if(!_0x42cbe5[_0x55ad8b]){delete _0x43d940[_0x55ad8b];}}}}Realtime[_0xcdcb('0x5')][_0xcdcb('0x6')]=function(_0x4b3e5c,_0x3610b5){for(var _0xdb774 in _0x3610b5){if(_0x4b3e5c['hasOwnProperty'](_0xdb774)){_0x4b3e5c[_0xdb774]=_0x3610b5[_0xdb774];}}};Realtime['prototype'][_0xcdcb('0x7')]=function(){var _0x221543=this;return function(_0x509277){if(_0x509277){freeIsNotKey(_0x509277,_0x221543[_0xcdcb('0x2')],'id');for(var _0x3ef023=0x0,_0x185f24={},_0x4c3b72={};_0x3ef023<_0x509277[_0xcdcb('0x8')];_0x3ef023+=0x1){_0x185f24=_0x509277[_0x3ef023];if(_['isUndefined'](_0x221543['mailAccounts'][_0x185f24['id']])){_0x221543['mailAccounts'][_0x185f24['id']]=new MailAccount(_0x185f24);}else{_[_0xcdcb('0x9')](_0x221543[_0xcdcb('0x2')][_0x185f24['id']],_0x185f24);}}}return _0x221543[_0xcdcb('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x8a3b=['mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length','isUndefined','exports','../model/mailAccount','mailAccounts'];(function(_0x5784f6,_0x32a486){var _0x3b9711=function(_0x1c5a58){while(--_0x1c5a58){_0x5784f6['push'](_0x5784f6['shift']());}};_0x3b9711(++_0x32a486);}(_0x8a3b,0x1db));var _0xb8a3=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x8a3b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var MailAccount=require(_0xb8a3('0x0'));var Realtime=function(){this[_0xb8a3('0x1')]={};};function freeIsNotKey(_0x141dec,_0x585e1a,_0x230c30){var _0x2775d0=_[_0xb8a3('0x2')](_0x141dec,function(_0x207592,_0x538cfa){return _0x207592[_0x230c30];});for(var _0x499437 in _0x585e1a){if(_0x585e1a['hasOwnProperty'](_0x499437)){if(!_0x2775d0[_0x499437]){delete _0x585e1a[_0x499437];}}}}Realtime[_0xb8a3('0x3')][_0xb8a3('0x4')]=function(_0x10ac98,_0x4aeb3a){for(var _0x3eece9 in _0x4aeb3a){if(_0x10ac98[_0xb8a3('0x5')](_0x3eece9)){_0x10ac98[_0x3eece9]=_0x4aeb3a[_0x3eece9];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x4e2acc=this;return function(_0x409197){if(_0x409197){freeIsNotKey(_0x409197,_0x4e2acc['mailAccounts'],'id');for(var _0x82e243=0x0,_0x130f86={},_0x54211f={};_0x82e243<_0x409197[_0xb8a3('0x6')];_0x82e243+=0x1){_0x130f86=_0x409197[_0x82e243];if(_[_0xb8a3('0x7')](_0x4e2acc[_0xb8a3('0x1')][_0x130f86['id']])){_0x4e2acc[_0xb8a3('0x1')][_0x130f86['id']]=new MailAccount(_0x130f86);}else{_['merge'](_0x4e2acc[_0xb8a3('0x1')][_0x130f86['id']],_0x130f86);}}}return _0x4e2acc[_0xb8a3('0x1')];};};module[_0xb8a3('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 6c340a0..026ffb5 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 _0x9048=['MailServerOut','Smtp','notify','NotifyMailAccount','../client','Request','service','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5'];(function(_0x178483,_0x3751ef){var _0xcc543f=function(_0x42919e){while(--_0x42919e){_0x178483['push'](_0x178483['shift']());}};_0xcc543f(++_0x3751ef);}(_0x9048,0xf2));var _0x8904=function(_0x360a63,_0x4040cf){_0x360a63=_0x360a63-0x0;var _0x6774d8=_0x9048[_0x360a63];return _0x6774d8;};'use strict';var client=require(_0x8904('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x8904('0x1')]('GetMailAccount',{'options':{'attributes':['id','name','provider',_0x8904('0x2'),_0x8904('0x3'),'active',_0x8904('0x4'),_0x8904('0x5'),_0x8904('0x6')],'raw':![],'include':[{'model':_0x8904('0x7'),'as':_0x8904('0x8'),'include':[{'model':_0x8904('0x9'),'attributes':['id',_0x8904('0xa'),_0x8904('0x2'),_0x8904('0xb'),_0x8904('0xc')],'as':_0x8904('0x9')}]},{'model':_0x8904('0xd'),'as':_0x8904('0xe'),'include':[{'model':_0x8904('0x9'),'attributes':['id','name','service',_0x8904('0xb'),'data5'],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x8904('0xf')]=function(_0x548d60,_0x1b1a6e){return client[_0x8904('0x1')](_0x8904('0x10'),{'account':{'id':_0x548d60},'body':_0x1b1a6e,'log':_0x8904('0x10')});}; \ No newline at end of file +var _0xba6f=['data5','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','Smtp'];(function(_0x1f717b,_0x53cc44){var _0x4d3421=function(_0x54d288){while(--_0x54d288){_0x1f717b['push'](_0x1f717b['shift']());}};_0x4d3421(++_0x53cc44);}(_0xba6f,0x1d0));var _0xfba6=function(_0x2d9da3,_0x63174d){_0x2d9da3=_0x2d9da3-0x0;var _0x2a8d6a=_0xba6f[_0x2d9da3];return _0x2a8d6a;};'use strict';var client=require(_0xfba6('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xfba6('0x1')](_0xfba6('0x2'),{'options':{'attributes':['id',_0xfba6('0x3'),_0xfba6('0x4'),_0xfba6('0x5'),_0xfba6('0x6'),_0xfba6('0x7'),_0xfba6('0x8'),_0xfba6('0x9'),_0xfba6('0xa')],'raw':![],'include':[{'model':_0xfba6('0xb'),'as':_0xfba6('0xc'),'include':[{'model':_0xfba6('0xd'),'attributes':['id','name',_0xfba6('0x5'),_0xfba6('0xe'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xfba6('0xf'),'include':[{'model':_0xfba6('0xd'),'attributes':['id',_0xfba6('0x3'),_0xfba6('0x5'),_0xfba6('0xe'),_0xfba6('0x10')],'as':_0xfba6('0xd')}]}]},'log':_0xfba6('0x11')});};};exports[_0xfba6('0x12')]=function(_0x2fc2f4,_0x203456){return client['Request'](_0xfba6('0x13'),{'account':{'id':_0x2fc2f4},'body':_0x203456,'log':_0xfba6('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ea456c5..ba38c65 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 _0xdad2=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0xdad2,0x140));var _0x2dad=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdad2[_0x46e363];return _0x3fb059;};'use strict';var client=require(_0x2dad('0x0'));exports[_0x2dad('0x1')]=function(){return client[_0x2dad('0x2')](_0x2dad('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2dad('0x4')]},'log':_0x2dad('0x5')});}; \ No newline at end of file +var _0x3e43=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x228ef2,_0x31f5ce){var _0x5ddce8=function(_0x4413af){while(--_0x4413af){_0x228ef2['push'](_0x228ef2['shift']());}};_0x5ddce8(++_0x31f5ce);}(_0x3e43,0x1f3));var _0x33e4=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3e43[_0x110c3d];return _0x226d67;};'use strict';var client=require(_0x33e4('0x0'));exports['getSettings']=function(){return client[_0x33e4('0x1')](_0x33e4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x33e4('0x3')]},'log':_0x33e4('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 29d5b40..827e58b 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 c3a3a3b..a4f0e0c 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 _0x0103=['../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','websocket','redis','defaults','adapter','socket.io-redis','../../config/socketio','default'];(function(_0x254635,_0x472b4c){var _0x35293c=function(_0x731a6d){while(--_0x731a6d){_0x254635['push'](_0x254635['shift']());}};_0x35293c(++_0x472b4c);}(_0x0103,0x124));var _0x3010=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x0103[_0x146be0];return _0x1bcc25;};'use strict';var _=require(_0x3010('0x0'));var http=require(_0x3010('0x1'));var express=require(_0x3010('0x2'));var sticky=require(_0x3010('0x3'));var Redis=require(_0x3010('0x4'));var config=require(_0x3010('0x5'));var app=express();var server=http[_0x3010('0x6')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x3010('0x7')])){var socketio=require(_0x3010('0x8'))(server,{'transports':[_0x3010('0x9'),'polling']});config[_0x3010('0xa')]=_[_0x3010('0xb')](config[_0x3010('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x3010('0xc')](require(_0x3010('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3010('0xa')])}));require('../../config/triggers')['default']();require(_0x3010('0xe'))[_0x3010('0xf')](socketio);require('../../config/express')[_0x3010('0xf')](app);require(_0x3010('0x10'))[_0x3010('0xf')](app);}else{server[_0x3010('0x11')](_0x3010('0x12'),function(){console[_0x3010('0x13')](_0x3010('0x14'),config[_0x3010('0x7')]);});}exports=module[_0x3010('0x15')]=app; \ No newline at end of file +var _0xab10=['websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io'];(function(_0x69493b,_0x16f5c1){var _0x5ea445=function(_0x3aee57){while(--_0x3aee57){_0x69493b['push'](_0x69493b['shift']());}};_0x5ea445(++_0x16f5c1);}(_0xab10,0x66));var _0x0ab1=function(_0x4db1c0,_0x593ed8){_0x4db1c0=_0x4db1c0-0x0;var _0xe0fd50=_0xab10[_0x4db1c0];return _0xe0fd50;};'use strict';var _=require('lodash');var http=require(_0x0ab1('0x0'));var express=require('express');var sticky=require(_0x0ab1('0x1'));var Redis=require(_0x0ab1('0x2'));var config=require(_0x0ab1('0x3'));var app=express();var server=http['createServer'](app);server[_0x0ab1('0x4')]=0xdbba0;if(sticky[_0x0ab1('0x5')](server,config[_0x0ab1('0x6')])){var socketio=require(_0x0ab1('0x7'))(server,{'transports':[_0x0ab1('0x8'),_0x0ab1('0x9')]});config[_0x0ab1('0xa')]=_[_0x0ab1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x0ab1('0xc')](require(_0x0ab1('0xd'))({'pubClient':new Redis(config[_0x0ab1('0xa')]),'subClient':new Redis(config[_0x0ab1('0xa')])}));require(_0x0ab1('0xe'))[_0x0ab1('0xf')]();require('../../config/socketio')[_0x0ab1('0xf')](socketio);require(_0x0ab1('0x10'))[_0x0ab1('0xf')](app);require(_0x0ab1('0x11'))['default'](app);}else{server[_0x0ab1('0x12')]('listening',function(){console[_0x0ab1('0x13')](_0x0ab1('0x14'),config[_0x0ab1('0x6')]);});}exports=module[_0x0ab1('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b7f921c..e85592a 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 _0x1bf4=['result','catch','exports','bluebird','routing','http','Request','request','debug','rpc','error','message'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x1bf4,0x6f));var _0x41bf=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x1bf4[_0x32bb6b];return _0x58dcb4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x41bf('0x0'));var logger=require('../../config/logger')(_0x41bf('0x1'));var client=jayson['client'][_0x41bf('0x2')]({'port':0x2329});client[_0x41bf('0x3')]=function(_0x204696,_0x52eb50){return new BPromise(function(_0x55665d,_0x1810f5){return client[_0x41bf('0x4')](_0x204696,_0x52eb50)['then'](function(_0x53b1de){logger[_0x41bf('0x5')](_0x41bf('0x6'),_0x41bf('0x1'),_0x204696,_0x52eb50,_0x53b1de);if(_0x53b1de[_0x41bf('0x7')]){logger[_0x41bf('0x7')]('rpc',_0x41bf('0x1'),_0x204696,_0x53b1de[_0x41bf('0x7')][_0x41bf('0x8')],_0x52eb50);return _0x1810f5(_0x53b1de['error'][_0x41bf('0x8')]);}else{return _0x55665d(_0x53b1de[_0x41bf('0x9')]);}})[_0x41bf('0xa')](function(_0x2cec58){logger['error'](_0x41bf('0x6'),'routing',_0x204696,_0x2cec58,_0x52eb50);return _0x1810f5(_0x2cec58);});});};module[_0x41bf('0xb')]=client; \ No newline at end of file +var _0xd1aa=['routing','client','http','Request','request','then','debug','rpc','error','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xd1aa,0x1a1));var _0xad1a=function(_0x20c205,_0x39bc5e){_0x20c205=_0x20c205-0x0;var _0x3d6cf2=_0xd1aa[_0x20c205];return _0x3d6cf2;};'use strict';var jayson=require(_0xad1a('0x0'));var BPromise=require(_0xad1a('0x1'));var logger=require(_0xad1a('0x2'))(_0xad1a('0x3'));var client=jayson[_0xad1a('0x4')][_0xad1a('0x5')]({'port':0x2329});client[_0xad1a('0x6')]=function(_0x53671e,_0x42d2e4){return new BPromise(function(_0x55370d,_0x1dbd43){return client[_0xad1a('0x7')](_0x53671e,_0x42d2e4)[_0xad1a('0x8')](function(_0x3aefde){logger[_0xad1a('0x9')](_0xad1a('0xa'),'routing',_0x53671e,_0x42d2e4,_0x3aefde);if(_0x3aefde[_0xad1a('0xb')]){logger[_0xad1a('0xb')](_0xad1a('0xa'),_0xad1a('0x3'),_0x53671e,_0x3aefde[_0xad1a('0xb')]['message'],_0x42d2e4);return _0x1dbd43(_0x3aefde[_0xad1a('0xb')]['message']);}else{return _0x55370d(_0x3aefde[_0xad1a('0xc')]);}})[_0xad1a('0xd')](function(_0x541e3d){logger[_0xad1a('0xb')](_0xad1a('0xa'),_0xad1a('0x3'),_0x53671e,_0x541e3d,_0x42d2e4);return _0x1dbd43(_0x541e3d);});});};module[_0xad1a('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9c64d0a..47aa91b 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 _0x0578=['./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval'];(function(_0x524021,_0x25d5ea){var _0x269c3e=function(_0x2418a5){while(--_0x2418a5){_0x524021['push'](_0x524021['shift']());}};_0x269c3e(++_0x25d5ea);}(_0x0578,0x6c));var _0x8057=function(_0x2d27ff,_0x31d5f5){_0x2d27ff=_0x2d27ff-0x0;var _0x16b568=_0x0578[_0x2d27ff];return _0x16b568;};'use strict';var BPromise=require(_0x8057('0x0'));var server=require(_0x8057('0x1'));var Realtime=require(_0x8057('0x2'));var user=require('./rpc/user');var interval=require(_0x8057('0x3'));var openchannelQueue=require(_0x8057('0x4'));var chatQueue=require(_0x8057('0x5'));var smsQueue=require(_0x8057('0x6'));var mailQueue=require(_0x8057('0x7'));var faxQueue=require(_0x8057('0x8'));var whatsappQueue=require(_0x8057('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8057('0xa')]()[_0x8057('0xb')](user[_0x8057('0xc')]())[_0x8057('0xb')](realtime['initAgents']())[_0x8057('0xb')](interval[_0x8057('0xd')]())[_0x8057('0xb')](realtime[_0x8057('0xe')]())[_0x8057('0xb')](openchannelQueue[_0x8057('0xf')]())[_0x8057('0xb')](realtime[_0x8057('0x10')]())[_0x8057('0xb')](chatQueue[_0x8057('0x11')]())['then'](realtime[_0x8057('0x12')]())['then'](smsQueue['getSmsQueues']())[_0x8057('0xb')](realtime[_0x8057('0x13')]())['then'](mailQueue[_0x8057('0x14')]())['then'](realtime[_0x8057('0x15')]())['then'](faxQueue[_0x8057('0x16')]())['then'](realtime[_0x8057('0x17')]())['then'](whatsappQueue[_0x8057('0x18')]())[_0x8057('0xb')](realtime[_0x8057('0x19')]())[_0x8057('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x8057('0xb')](function(_0x5b5548){return initRealtime();})[_0x8057('0xb')](function(_0x1a36a4){return setInterval(initRealtime,0x1388);})[_0x8057('0x1a')](function(_0x55d0d7){console[_0x8057('0x1b')](_0x55d0d7);});}main(); \ No newline at end of file +var _0xef1a=['initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initWhatsappQueues','catch','log','./server','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then'];(function(_0x225b31,_0x2cddcc){var _0x354f03=function(_0x4d343f){while(--_0x4d343f){_0x225b31['push'](_0x225b31['shift']());}};_0x354f03(++_0x2cddcc);}(_0xef1a,0x183));var _0xaef1=function(_0x4d6840,_0x34177f){_0x4d6840=_0x4d6840-0x0;var _0x3f691a=_0xef1a[_0x4d6840];return _0x3f691a;};'use strict';var BPromise=require('bluebird');var server=require(_0xaef1('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xaef1('0x1'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xaef1('0x2'));var smsQueue=require(_0xaef1('0x3'));var mailQueue=require(_0xaef1('0x4'));var faxQueue=require(_0xaef1('0x5'));var whatsappQueue=require(_0xaef1('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xaef1('0x7')]()[_0xaef1('0x8')](user['getAgents']())[_0xaef1('0x8')](realtime[_0xaef1('0x9')]())[_0xaef1('0x8')](interval[_0xaef1('0xa')]())[_0xaef1('0x8')](realtime[_0xaef1('0xb')]())[_0xaef1('0x8')](openchannelQueue['getOpenchannelQueues']())[_0xaef1('0x8')](realtime[_0xaef1('0xc')]())[_0xaef1('0x8')](chatQueue[_0xaef1('0xd')]())[_0xaef1('0x8')](realtime[_0xaef1('0xe')]())[_0xaef1('0x8')](smsQueue[_0xaef1('0xf')]())[_0xaef1('0x8')](realtime[_0xaef1('0x10')]())[_0xaef1('0x8')](mailQueue[_0xaef1('0x11')]())[_0xaef1('0x8')](realtime[_0xaef1('0x12')]())[_0xaef1('0x8')](faxQueue['getFaxQueues']())[_0xaef1('0x8')](realtime['initFaxQueues']())['then'](whatsappQueue['getWhatsappQueues']())[_0xaef1('0x8')](realtime[_0xaef1('0x13')]())[_0xaef1('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x5068c4){return initRealtime();})[_0xaef1('0x8')](function(_0xf4f91b){return setInterval(initRealtime,0x1388);})[_0xaef1('0x14')](function(_0x406f7d){console[_0xaef1('0x15')](_0x406f7d);});}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 03c7a45..571f200 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x36aaad,_0x4123c5){var _0x383ce2=function(_0x49f08b){while(--_0x49f08b){_0x36aaad['push'](_0x36aaad['shift']());}};_0x383ce2(++_0x4123c5);}(_0x7a54,0x106));var _0x47a5=function(_0x4ab344,_0x124692){_0x4ab344=_0x4ab344-0x0;var _0x2dc271=_0x7a54[_0x4ab344];return _0x2dc271;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x37d225,_0x2ed664){var _0x26834b=function(_0x32260c){while(--_0x32260c){_0x37d225['push'](_0x37d225['shift']());}};_0x26834b(++_0x2ed664);}(_0x814b,0x1a2));var _0xb814=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x814b[_0x326d35];return _0xd3f8f3;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index bd4465c..8770dd8 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 _0x294b=['sendMailMessage','SendMail','client','request','then','error','message','result','catch'];(function(_0x39fba9,_0x245311){var _0x3078c5=function(_0x4540ff){while(--_0x4540ff){_0x39fba9['push'](_0x39fba9['shift']());}};_0x3078c5(++_0x245311);}(_0x294b,0x9b));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xb294('0x0')]['http']({'port':0x232b});function request(_0xec9f1f,_0x43ba98){return new BPromise(function(_0x34619f,_0x267885){return client[_0xb294('0x1')](_0xec9f1f,_0x43ba98)[_0xb294('0x2')](function(_0x17e466){if(_0x17e466['error']){return _0x267885(_0x17e466[_0xb294('0x3')][_0xb294('0x4')]);}else{return _0x34619f(_0x17e466[_0xb294('0x5')]);}})[_0xb294('0x6')](function(_0x3d3bfb){return _0x267885(_0x3d3bfb);});});}exports[_0xb294('0x7')]=function(_0x338d6b,_0x364c52){return request(_0xb294('0x8'),{'account':_0x338d6b,'message':_0x364c52});}; \ No newline at end of file +var _0x117c=['sendMailMessage','bluebird','jayson/promise','http','error','result'];(function(_0x288839,_0x137324){var _0x2158e6=function(_0x55703f){while(--_0x55703f){_0x288839['push'](_0x288839['shift']());}};_0x2158e6(++_0x137324);}(_0x117c,0x133));var _0xc117=function(_0xe4f7a3,_0x449042){_0xe4f7a3=_0xe4f7a3-0x0;var _0xb1da7c=_0x117c[_0xe4f7a3];return _0xb1da7c;};'use strict';var BPromise=require(_0xc117('0x0'));var jayson=require(_0xc117('0x1'));var client=jayson['client'][_0xc117('0x2')]({'port':0x232b});function request(_0x175b85,_0x33dfa1){return new BPromise(function(_0x1c7cd2,_0x30599f){return client['request'](_0x175b85,_0x33dfa1)['then'](function(_0x26b760){if(_0x26b760[_0xc117('0x3')]){return _0x30599f(_0x26b760['error']['message']);}else{return _0x1c7cd2(_0x26b760[_0xc117('0x4')]);}})['catch'](function(_0x3dc8f4){return _0x30599f(_0x3dc8f4);});});}exports[_0xc117('0x5')]=function(_0x535b64,_0x579e3a){return request('SendMail',{'account':_0x535b64,'message':_0x579e3a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 7b1e7cd..20ed1bc 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 _0x3a6d=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','mailWaitingInteractions','stringify','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0xe8c178,_0x25b82b){var _0x13c540=function(_0xdeea4f){while(--_0xdeea4f){_0xe8c178['push'](_0xe8c178['shift']());}};_0x13c540(++_0x25b82b);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a6d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xd3a6('0x0'));var md5=require(_0xd3a6('0x1'));var moment=require('moment');var Redis=require(_0xd3a6('0x2'));var config=require(_0xd3a6('0x3'));config[_0xd3a6('0x4')]=_[_0xd3a6('0x5')](config[_0xd3a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd3a6('0x6'))(new Redis(config[_0xd3a6('0x4')]));function Agent(_0x1e44bd){this['id']=_0x1e44bd['id']||0x0;this[_0xd3a6('0x7')]=_0x1e44bd[_0xd3a6('0x7')]||'';this[_0xd3a6('0x8')]=_0x1e44bd['online']||!![];this[_0xd3a6('0x9')]=_0x1e44bd[_0xd3a6('0x9')]||![];this[_0xd3a6('0xa')]=_0x1e44bd[_0xd3a6('0xa')]||![];this[_0xd3a6('0xb')]=_0x1e44bd[_0xd3a6('0xb')]||![];this[_0xd3a6('0xc')]=_0x1e44bd[_0xd3a6('0xc')]||![];this[_0xd3a6('0xd')]=_0x1e44bd['smsPause']||![];this[_0xd3a6('0xe')]=_0x1e44bd[_0xd3a6('0xe')]||![];this[_0xd3a6('0xf')]=_0xd3a6('0x10');this[_0xd3a6('0x11')]=0x0;this['chatCapacity']=_0x1e44bd['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xd3a6('0x12')]=_0xd3a6('0x10');this[_0xd3a6('0x13')]=0x0;this[_0xd3a6('0x14')]=_0x1e44bd[_0xd3a6('0x14')]||0x0;this[_0xd3a6('0x15')]=0x0;this[_0xd3a6('0x16')]='unknown';this[_0xd3a6('0x17')]=0x0;this[_0xd3a6('0x18')]=_0x1e44bd[_0xd3a6('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd3a6('0x19')]=_0xd3a6('0x10');this[_0xd3a6('0x1a')]=0x0;this['smsCapacity']=_0x1e44bd[_0xd3a6('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xd3a6('0x10');this[_0xd3a6('0x1c')]=0x0;this[_0xd3a6('0x1d')]=_0x1e44bd[_0xd3a6('0x1d')]||0x0;this[_0xd3a6('0x1e')]=0x0;this[_0xd3a6('0x1f')]=_0xd3a6('0x10');this['openchannelStatusTime']=0x0;this[_0xd3a6('0x20')]=_0x1e44bd['openchannelCapacity']||0x0;this[_0xd3a6('0x21')]=0x0;this[_0xd3a6('0x22')]=![];this[_0xd3a6('0x23')]=undefined;this[_0xd3a6('0x1')]='';this[_0xd3a6('0x24')]={};this[_0xd3a6('0x25')]={};this['mailWaitingInteractions']={};this[_0xd3a6('0x26')]={};this[_0xd3a6('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x5c9075){if(this[_0x5c9075+_0xd3a6('0x28')]>0x0){if(this[_0x5c9075+_0xd3a6('0x29')]>0x0&&this[_0x5c9075+_0xd3a6('0x28')]>=this[_0x5c9075+'Capacity']){return _0xd3a6('0x2a');}else{return'working';}}else{return _0xd3a6('0x2b');}};Agent[_0xd3a6('0x2c')][_0xd3a6('0x2d')]=function(){var _0x4f6130=[_0xd3a6('0x2e'),_0xd3a6('0x2f'),_0xd3a6('0x30'),_0xd3a6('0x31'),_0xd3a6('0x32'),_0xd3a6('0x33')];for(var _0x5650d1=0x0;_0x5650d1<_0x4f6130[_0xd3a6('0x34')];_0x5650d1+=0x1){var _0x2b5448=this[_0xd3a6('0x35')](_0x4f6130[_0x5650d1]);if(this[_0x4f6130[_0x5650d1]+_0xd3a6('0x36')]!==_0x2b5448){this[_0x4f6130[_0x5650d1]+_0xd3a6('0x37')]=_[_0xd3a6('0x38')](moment()['format']('x'));}this[_0x4f6130[_0x5650d1]+'Status']=_0x2b5448;}var _0x1f4859={'id':this['id'],'name':this[_0xd3a6('0x7')],'online':this[_0xd3a6('0x8')],'voicePause':this[_0xd3a6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xd3a6('0xb')],'smsPause':this[_0xd3a6('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd3a6('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd3a6('0x11')],'chatCapacity':this[_0xd3a6('0x39')],'chatCurrentCapacity':this[_0xd3a6('0x3a')],'mailStatus':this[_0xd3a6('0x12')],'mailStatusTime':this[_0xd3a6('0x13')],'mailCapacity':this[_0xd3a6('0x14')],'mailCurrentCapacity':this[_0xd3a6('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd3a6('0x18')],'faxCurrentCapacity':this[_0xd3a6('0x3b')],'smsStatus':this[_0xd3a6('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd3a6('0x1b')],'smsCurrentCapacity':this[_0xd3a6('0x3c')],'whatsappStatus':this[_0xd3a6('0x3d')],'whatsappStatusTime':this[_0xd3a6('0x1c')],'whatsappCapacity':this[_0xd3a6('0x1d')],'whatsappCurrentCapacity':this[_0xd3a6('0x1e')],'openchannelStatus':this[_0xd3a6('0x1f')],'openchannelStatusTime':this[_0xd3a6('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd3a6('0x21')],'busy':this[_0xd3a6('0x22')],'busyQueue':this[_0xd3a6('0x23')],'chatWaitingInteractions':this[_0xd3a6('0x24')],'faxWaitingInteractions':this[_0xd3a6('0x25')],'mailWaitingInteractions':this[_0xd3a6('0x3f')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd3a6('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x263615=md5(JSON[_0xd3a6('0x40')](_0x1f4859));if(this[_0xd3a6('0x1')]!==_0x263615){this[_0xd3a6('0x1')]=_0x263615;io['emit']('user:routing:update',_[_0xd3a6('0x41')](_0x1f4859,[_0xd3a6('0x8')]));}};module[_0xd3a6('0x42')]=Agent; \ No newline at end of file +var _0x25e7=['exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','prototype','chat','openchannel','sms','whatsapp','length','Status','toNumber','chatStatus','chatCapacity','mailCurrentCapacity','smsStatus','whatsappCurrentCapacity','busy','stringify','emit','user:routing:update','omit'];(function(_0x38f6f1,_0x2c406f){var _0x37ddcd=function(_0x5c80a0){while(--_0x5c80a0){_0x38f6f1['push'](_0x38f6f1['shift']());}};_0x37ddcd(++_0x2c406f);}(_0x25e7,0x1d6));var _0x725e=function(_0x47b63a,_0x3a3c6f){_0x47b63a=_0x47b63a-0x0;var _0x19e9ce=_0x25e7[_0x47b63a];return _0x19e9ce;};'use strict';var _=require(_0x725e('0x0'));var md5=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var Redis=require(_0x725e('0x3'));var config=require(_0x725e('0x4'));config[_0x725e('0x5')]=_[_0x725e('0x6')](config[_0x725e('0x5')],{'host':_0x725e('0x7'),'port':0x18eb});var io=require(_0x725e('0x8'))(new Redis(config['redis']));function Agent(_0x5e17a9){this['id']=_0x5e17a9['id']||0x0;this[_0x725e('0x9')]=_0x5e17a9['name']||'';this['online']=_0x5e17a9[_0x725e('0xa')]||!![];this[_0x725e('0xb')]=_0x5e17a9[_0x725e('0xb')]||![];this[_0x725e('0xc')]=_0x5e17a9[_0x725e('0xc')]||![];this[_0x725e('0xd')]=_0x5e17a9[_0x725e('0xd')]||![];this[_0x725e('0xe')]=_0x5e17a9[_0x725e('0xe')]||![];this[_0x725e('0xf')]=_0x5e17a9[_0x725e('0xf')]||![];this[_0x725e('0x10')]=_0x5e17a9['openchannelPause']||![];this['chatStatus']=_0x725e('0x11');this[_0x725e('0x12')]=0x0;this['chatCapacity']=_0x5e17a9['chatCapacity']||0x0;this[_0x725e('0x13')]=0x0;this[_0x725e('0x14')]='unknown';this[_0x725e('0x15')]=0x0;this[_0x725e('0x16')]=_0x5e17a9[_0x725e('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x725e('0x17')]=_0x725e('0x11');this[_0x725e('0x18')]=0x0;this[_0x725e('0x19')]=_0x5e17a9[_0x725e('0x19')]||0x0;this[_0x725e('0x1a')]=0x0;this['smsStatus']=_0x725e('0x11');this[_0x725e('0x1b')]=0x0;this[_0x725e('0x1c')]=_0x5e17a9['smsCapacity']||0x0;this[_0x725e('0x1d')]=0x0;this[_0x725e('0x1e')]=_0x725e('0x11');this[_0x725e('0x1f')]=0x0;this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x725e('0x21')]=_0x725e('0x11');this[_0x725e('0x22')]=0x0;this[_0x725e('0x23')]=_0x5e17a9[_0x725e('0x23')]||0x0;this[_0x725e('0x24')]=0x0;this['busy']=![];this[_0x725e('0x25')]=undefined;this[_0x725e('0x1')]='';this[_0x725e('0x26')]={};this[_0x725e('0x27')]={};this[_0x725e('0x28')]={};this[_0x725e('0x29')]={};this[_0x725e('0x2a')]={};this[_0x725e('0x2b')]={};this[_0x725e('0x2c')]();}Agent['prototype'][_0x725e('0x2d')]=function(_0x36cbab){if(this[_0x36cbab+_0x725e('0x2e')]>0x0){if(this[_0x36cbab+_0x725e('0x2f')]>0x0&&this[_0x36cbab+'CurrentCapacity']>=this[_0x36cbab+_0x725e('0x2f')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x725e('0x30')][_0x725e('0x2c')]=function(){var _0x2d3c55=['mail',_0x725e('0x31'),_0x725e('0x32'),'fax',_0x725e('0x33'),_0x725e('0x34')];for(var _0x4b0d0c=0x0;_0x4b0d0c<_0x2d3c55[_0x725e('0x35')];_0x4b0d0c+=0x1){var _0x5daa2d=this['getChannelStatus'](_0x2d3c55[_0x4b0d0c]);if(this[_0x2d3c55[_0x4b0d0c]+_0x725e('0x36')]!==_0x5daa2d){this[_0x2d3c55[_0x4b0d0c]+'StatusTime']=_[_0x725e('0x37')](moment()['format']('x'));}this[_0x2d3c55[_0x4b0d0c]+'Status']=_0x5daa2d;}var _0x9b5b7f={'id':this['id'],'name':this[_0x725e('0x9')],'online':this[_0x725e('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x725e('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x725e('0xf')],'faxPause':this[_0x725e('0xe')],'openchannelPause':this[_0x725e('0x10')],'chatStatus':this[_0x725e('0x38')],'chatStatusTime':this[_0x725e('0x12')],'chatCapacity':this[_0x725e('0x39')],'chatCurrentCapacity':this[_0x725e('0x13')],'mailStatus':this[_0x725e('0x14')],'mailStatusTime':this[_0x725e('0x15')],'mailCapacity':this[_0x725e('0x16')],'mailCurrentCapacity':this[_0x725e('0x3a')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x725e('0x18')],'faxCapacity':this[_0x725e('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x725e('0x3b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x725e('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x725e('0x1e')],'whatsappStatusTime':this[_0x725e('0x1f')],'whatsappCapacity':this[_0x725e('0x20')],'whatsappCurrentCapacity':this[_0x725e('0x3c')],'openchannelStatus':this[_0x725e('0x21')],'openchannelStatusTime':this[_0x725e('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x725e('0x3d')],'busyQueue':this[_0x725e('0x25')],'chatWaitingInteractions':this[_0x725e('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x725e('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x725e('0x2a')],'whatsappWaitingInteractions':this[_0x725e('0x2b')]};var _0x386636=md5(JSON[_0x725e('0x3e')](_0x9b5b7f));if(this['md5']!==_0x386636){this['md5']=_0x386636;io[_0x725e('0x3f')](_0x725e('0x40'),_[_0x725e('0x41')](_0x9b5b7f,['online']));}};module[_0x725e('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ef5b97b..3ccfe1d 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 _0x62fb=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','prototype','loggedIn','length','online','chatPause','paused','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x62fb,0xf3));var _0xb62f=function(_0x114824,_0x1fa8dd){_0x114824=_0x114824-0x0;var _0x597064=_0x62fb[_0x114824];return _0x597064;};'use strict';var _=require(_0xb62f('0x0'));var md5=require(_0xb62f('0x1'));var util=require('util');var Redis=require(_0xb62f('0x2'));var config=require(_0xb62f('0x3'));config[_0xb62f('0x4')]=_[_0xb62f('0x5')](config[_0xb62f('0x4')],{'host':_0xb62f('0x6'),'port':0x18eb});var io=require(_0xb62f('0x7'))(new Redis(config[_0xb62f('0x4')]));function ChatQueue(_0x19e673){this['id']=_0x19e673['id']||0x0;this['name']=_0x19e673[_0xb62f('0x8')]||'';this[_0xb62f('0x9')]=_0x19e673[_0xb62f('0x9')]||0xa;this['strategy']=_0x19e673[_0xb62f('0xa')]||_0xb62f('0xb');this[_0xb62f('0xc')]=_0x19e673[_0xb62f('0xc')];this[_0xb62f('0xd')]={};this[_0xb62f('0xe')]=0x0;this[_0xb62f('0x1')]='';this['updateRouting']();this[_0xb62f('0xf')]();}ChatQueue['prototype'][_0xb62f('0x10')]=function(){var _0x3f6acf=this[_0xb62f('0xd')][_0xb62f('0x11')];this[_0xb62f('0xd')]=_[_0xb62f('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3f6acf;};ChatQueue[_0xb62f('0x13')][_0xb62f('0xf')]=function(){this[_0xb62f('0x14')]=0x0;this['paused']=0x0;for(var _0x5dfaf9=0x0;_0x5dfaf9=0x0?this['available']:0x0;var _0x4c6668={'id':this['id'],'available':this[_0xb62f('0x19')],'loggedIn':this[_0xb62f('0x14')],'name':this[_0xb62f('0x8')],'paused':this['paused'],'waiting':this[_0xb62f('0xe')]};var _0xcb5bc4=md5(JSON[_0xb62f('0x1a')](_0x4c6668));if(this[_0xb62f('0x1')]!==_0xcb5bc4){this['md5']=_0xcb5bc4;io['to'](util['format'](_0xb62f('0x1b'),_0x4c6668['name']))[_0xb62f('0x1c')](_0xb62f('0x1d'),_0x4c6668);}};module[_0xb62f('0x1e')]=ChatQueue; \ No newline at end of file +var _0x73da=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','chatPause','available','format','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x442818,_0x494946){var _0x37c9e1=function(_0x6783e1){while(--_0x6783e1){_0x442818['push'](_0x442818['shift']());}};_0x37c9e1(++_0x494946);}(_0x73da,0x10b));var _0xa73d=function(_0x58f8d6,_0x3de6e9){_0x58f8d6=_0x58f8d6-0x0;var _0x249399=_0x73da[_0x58f8d6];return _0x249399;};'use strict';var _=require(_0xa73d('0x0'));var md5=require(_0xa73d('0x1'));var util=require(_0xa73d('0x2'));var Redis=require(_0xa73d('0x3'));var config=require(_0xa73d('0x4'));config['redis']=_[_0xa73d('0x5')](config[_0xa73d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa73d('0x7'))(new Redis(config[_0xa73d('0x6')]));function ChatQueue(_0x27d470){this['id']=_0x27d470['id']||0x0;this[_0xa73d('0x8')]=_0x27d470['name']||'';this[_0xa73d('0x9')]=_0x27d470['timeout']||0xa;this[_0xa73d('0xa')]=_0x27d470['strategy']||_0xa73d('0xb');this[_0xa73d('0xc')]=_0x27d470['Agents'];this[_0xa73d('0xd')]={};this[_0xa73d('0xe')]=0x0;this[_0xa73d('0x1')]='';this[_0xa73d('0xf')]();this[_0xa73d('0x10')]();}ChatQueue['prototype'][_0xa73d('0xf')]=function(){var _0x43c9dd=this[_0xa73d('0xd')][_0xa73d('0x11')];this['mapAgentsId']=_[_0xa73d('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x43c9dd;};ChatQueue[_0xa73d('0x13')][_0xa73d('0x10')]=function(){this[_0xa73d('0x14')]=0x0;this[_0xa73d('0x15')]=0x0;for(var _0x168a4d=0x0;_0x168a4d=0x0?this[_0xa73d('0x18')]:0x0;var _0x18a385={'id':this['id'],'available':this[_0xa73d('0x18')],'loggedIn':this[_0xa73d('0x14')],'name':this[_0xa73d('0x8')],'paused':this[_0xa73d('0x15')],'waiting':this[_0xa73d('0xe')]};var _0x55fe5b=md5(JSON['stringify'](_0x18a385));if(this[_0xa73d('0x1')]!==_0x55fe5b){this[_0xa73d('0x1')]=_0x55fe5b;io['to'](util[_0xa73d('0x19')]('chat:queue:%s',_0x18a385[_0xa73d('0x8')]))[_0xa73d('0x1a')](_0xa73d('0x1b'),_0x18a385);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6682b20..edf6453 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 _0x959a=['fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','format'];(function(_0x1fa576,_0x4f1590){var _0xda3290=function(_0x22d031){while(--_0x22d031){_0x1fa576['push'](_0x1fa576['shift']());}};_0xda3290(++_0x4f1590);}(_0x959a,0x164));var _0xa959=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x959a[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xa959('0x0'));var md5=require(_0xa959('0x1'));var util=require(_0xa959('0x2'));var Redis=require(_0xa959('0x3'));var config=require(_0xa959('0x4'));config[_0xa959('0x5')]=_[_0xa959('0x6')](config[_0xa959('0x5')],{'host':_0xa959('0x7'),'port':0x18eb});var io=require(_0xa959('0x8'))(new Redis(config[_0xa959('0x5')]));function FaxQueue(_0x3fbcd2){this['id']=_0x3fbcd2['id']||0x0;this[_0xa959('0x9')]=_0x3fbcd2[_0xa959('0x9')]||'';this['timeout']=_0x3fbcd2['timeout']||0xa;this[_0xa959('0xa')]=_0x3fbcd2['strategy']||_0xa959('0xb');this[_0xa959('0xc')]=_0x3fbcd2['Agents'];this[_0xa959('0xd')]={};this[_0xa959('0xe')]=0x0;this[_0xa959('0x1')]='';this[_0xa959('0xf')]();this['updateRealtime']();}FaxQueue[_0xa959('0x10')][_0xa959('0xf')]=function(){var _0x127d36=this['mapAgentsId']['_rr'];this[_0xa959('0xd')]=_[_0xa959('0x11')](this['Agents'],'id');this['mapAgentsId'][_0xa959('0x12')]=_0x127d36;};FaxQueue[_0xa959('0x10')][_0xa959('0x13')]=function(){this[_0xa959('0x14')]=0x0;this[_0xa959('0x15')]=0x0;for(var _0xcf68da=0x0;_0xcf68da=0x0?this[_0xa959('0x19')]:0x0;var _0x5064e5={'id':this['id'],'available':this[_0xa959('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xa959('0x9')],'paused':this['paused'],'waiting':this[_0xa959('0xe')]};var _0x16f2bc=md5(JSON[_0xa959('0x1a')](_0x5064e5));if(this[_0xa959('0x1')]!==_0x16f2bc){this['md5']=_0x16f2bc;io['to'](util[_0xa959('0x1b')](_0xa959('0x1c'),_0x5064e5[_0xa959('0x9')]))[_0xa959('0x1d')](_0xa959('0x1e'),_0x5064e5);}};module[_0xa959('0x1f')]=FaxQueue; \ No newline at end of file +var _0x03eb=['online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','length'];(function(_0x4af657,_0x2195c8){var _0x5f2860=function(_0x569984){while(--_0x569984){_0x4af657['push'](_0x4af657['shift']());}};_0x5f2860(++_0x2195c8);}(_0x03eb,0x1ac));var _0xb03e=function(_0x190675,_0x1b21b){_0x190675=_0x190675-0x0;var _0x4ed162=_0x03eb[_0x190675];return _0x4ed162;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xb03e('0x0'));var Redis=require(_0xb03e('0x1'));var config=require(_0xb03e('0x2'));config[_0xb03e('0x3')]=_[_0xb03e('0x4')](config[_0xb03e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xb03e('0x5'))(new Redis(config[_0xb03e('0x3')]));function FaxQueue(_0x27d79b){this['id']=_0x27d79b['id']||0x0;this['name']=_0x27d79b[_0xb03e('0x6')]||'';this[_0xb03e('0x7')]=_0x27d79b[_0xb03e('0x7')]||0xa;this[_0xb03e('0x8')]=_0x27d79b[_0xb03e('0x8')]||_0xb03e('0x9');this[_0xb03e('0xa')]=_0x27d79b[_0xb03e('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb03e('0xb')]='';this[_0xb03e('0xc')]();this[_0xb03e('0xd')]();}FaxQueue['prototype'][_0xb03e('0xc')]=function(){var _0x1bf4b5=this[_0xb03e('0xe')][_0xb03e('0xf')];this[_0xb03e('0xe')]=_[_0xb03e('0x10')](this[_0xb03e('0xa')],'id');this[_0xb03e('0xe')]['_rr']=_0x1bf4b5;};FaxQueue['prototype'][_0xb03e('0xd')]=function(){this[_0xb03e('0x11')]=0x0;this[_0xb03e('0x12')]=0x0;for(var _0x2d1479=0x0;_0x2d1479=0x0?this['available']:0x0;var _0x3806fe={'id':this['id'],'available':this[_0xb03e('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xb03e('0x12')],'waiting':this['waiting']};var _0x244b41=md5(JSON[_0xb03e('0x17')](_0x3806fe));if(this[_0xb03e('0xb')]!==_0x244b41){this[_0xb03e('0xb')]=_0x244b41;io['to'](util[_0xb03e('0x18')](_0xb03e('0x19'),_0x3806fe[_0xb03e('0x6')]))[_0xb03e('0x1a')]('fax_queue:save',_0x3806fe);}};module[_0xb03e('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index ad3f37b..d0db99c 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 _0x3553=['name','Intervals'];(function(_0x3baef7,_0x4aec83){var _0x4dddf0=function(_0x4ac8c0){while(--_0x4ac8c0){_0x3baef7['push'](_0x3baef7['shift']());}};_0x4dddf0(++_0x4aec83);}(_0x3553,0xd8));var _0x3355=function(_0x40592d,_0x84de17){_0x40592d=_0x40592d-0x0;var _0x14c0ac=_0x3553[_0x40592d];return _0x14c0ac;};'use strict';function Interval(_0x5b26f1){this['id']=_0x5b26f1['id']||0x0;this[_0x3355('0x0')]=_0x5b26f1[_0x3355('0x0')]||'';this[_0x3355('0x1')]=_0x5b26f1[_0x3355('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x02af=['exports','name','Intervals'];(function(_0x21d325,_0x497c54){var _0x46b31e=function(_0x37d905){while(--_0x37d905){_0x21d325['push'](_0x21d325['shift']());}};_0x46b31e(++_0x497c54);}(_0x02af,0x106));var _0xf02a=function(_0x307af3,_0x1fb2d2){_0x307af3=_0x307af3-0x0;var _0x3e043d=_0x02af[_0x307af3];return _0x3e043d;};'use strict';function Interval(_0x5e65f5){this['id']=_0x5e65f5['id']||0x0;this[_0xf02a('0x0')]=_0x5e65f5[_0xf02a('0x0')]||'';this['Intervals']=_0x5e65f5[_0xf02a('0x1')]||{};}module[_0xf02a('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 ed0c8ce..a1c153a 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 _0x9b5b=['loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x2f0b82,_0xa07e26){var _0x5d6fb1=function(_0x178f3f){while(--_0x178f3f){_0x2f0b82['push'](_0x2f0b82['shift']());}};_0x5d6fb1(++_0xa07e26);}(_0x9b5b,0x118));var _0xb9b5=function(_0x40f30b,_0x28d0f3){_0x40f30b=_0x40f30b-0x0;var _0x4fb47a=_0x9b5b[_0x40f30b];return _0x4fb47a;};'use strict';var _=require(_0xb9b5('0x0'));var md5=require('md5');var util=require(_0xb9b5('0x1'));var Redis=require(_0xb9b5('0x2'));var config=require(_0xb9b5('0x3'));config['redis']=_[_0xb9b5('0x4')](config[_0xb9b5('0x5')],{'host':_0xb9b5('0x6'),'port':0x18eb});var io=require(_0xb9b5('0x7'))(new Redis(config['redis']));function MailQueue(_0x27d849){this['id']=_0x27d849['id']||0x0;this[_0xb9b5('0x8')]=_0x27d849[_0xb9b5('0x8')]||'';this[_0xb9b5('0x9')]=_0x27d849[_0xb9b5('0x9')]||0xa;this['strategy']=_0x27d849['strategy']||_0xb9b5('0xa');this[_0xb9b5('0xb')]=_0x27d849[_0xb9b5('0xb')];this['mapAgentsId']={};this[_0xb9b5('0xc')]=0x0;this[_0xb9b5('0xd')]='';this[_0xb9b5('0xe')]();this[_0xb9b5('0xf')]();}MailQueue[_0xb9b5('0x10')][_0xb9b5('0xe')]=function(){var _0x23300d=this[_0xb9b5('0x11')][_0xb9b5('0x12')];this['mapAgentsId']=_[_0xb9b5('0x13')](this[_0xb9b5('0xb')],'id');this[_0xb9b5('0x11')][_0xb9b5('0x12')]=_0x23300d;};MailQueue['prototype'][_0xb9b5('0xf')]=function(){this[_0xb9b5('0x14')]=0x0;this[_0xb9b5('0x15')]=0x0;for(var _0x3386f4=0x0;_0x3386f4=0x0?this[_0xb9b5('0x19')]:0x0;var _0x4c31c0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xb9b5('0x15')],'waiting':this['waiting']};var _0x26e347=md5(JSON['stringify'](_0x4c31c0));if(this['md5']!==_0x26e347){this[_0xb9b5('0xd')]=_0x26e347;io['to'](util[_0xb9b5('0x1a')](_0xb9b5('0x1b'),_0x4c31c0[_0xb9b5('0x8')]))['emit'](_0xb9b5('0x1c'),_0x4c31c0);}};module[_0xb9b5('0x1d')]=MailQueue; \ No newline at end of file +var _0xd96e=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost'];(function(_0x7ae629,_0x401741){var _0x46407e=function(_0x13bd42){while(--_0x13bd42){_0x7ae629['push'](_0x7ae629['shift']());}};_0x46407e(++_0x401741);}(_0xd96e,0x112));var _0xed96=function(_0x43d9ff,_0x5c8a80){_0x43d9ff=_0x43d9ff-0x0;var _0x4e038b=_0xd96e[_0x43d9ff];return _0x4e038b;};'use strict';var _=require(_0xed96('0x0'));var md5=require(_0xed96('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xed96('0x2'));config['redis']=_[_0xed96('0x3')](config[_0xed96('0x4')],{'host':_0xed96('0x5'),'port':0x18eb});var io=require(_0xed96('0x6'))(new Redis(config[_0xed96('0x4')]));function MailQueue(_0x5b3ceb){this['id']=_0x5b3ceb['id']||0x0;this[_0xed96('0x7')]=_0x5b3ceb[_0xed96('0x7')]||'';this[_0xed96('0x8')]=_0x5b3ceb['timeout']||0xa;this[_0xed96('0x9')]=_0x5b3ceb[_0xed96('0x9')]||_0xed96('0xa');this[_0xed96('0xb')]=_0x5b3ceb[_0xed96('0xb')];this[_0xed96('0xc')]={};this[_0xed96('0xd')]=0x0;this[_0xed96('0x1')]='';this[_0xed96('0xe')]();this['updateRealtime']();}MailQueue[_0xed96('0xf')][_0xed96('0xe')]=function(){var _0x495ae4=this[_0xed96('0xc')][_0xed96('0x10')];this[_0xed96('0xc')]=_['map'](this[_0xed96('0xb')],'id');this[_0xed96('0xc')][_0xed96('0x10')]=_0x495ae4;};MailQueue['prototype']['updateRealtime']=function(){this[_0xed96('0x11')]=0x0;this[_0xed96('0x12')]=0x0;for(var _0x17967a=0x0;_0x17967a=0x0?this[_0xed96('0x16')]:0x0;var _0x379589={'id':this['id'],'available':this[_0xed96('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xed96('0x7')],'paused':this[_0xed96('0x12')],'waiting':this['waiting']};var _0x24d4cf=md5(JSON['stringify'](_0x379589));if(this[_0xed96('0x1')]!==_0x24d4cf){this[_0xed96('0x1')]=_0x24d4cf;io['to'](util[_0xed96('0x17')](_0xed96('0x18'),_0x379589[_0xed96('0x7')]))[_0xed96('0x19')](_0xed96('0x1a'),_0x379589);}};module[_0xed96('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4c132aa..9f41420 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7a54,0x106));var _0x47a5=function(_0x59bddd,_0x3d3d52){_0x59bddd=_0x59bddd-0x0;var _0x642e25=_0x7a54[_0x59bddd];return _0x642e25;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x326f,0xd1));var _0xf326=function(_0xf82981,_0xc48cad){_0xf82981=_0xf82981-0x0;var _0x1e7d92=_0x326f[_0xf82981];return _0x1e7d92;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 9aac5da..b306e7f 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 _0x7bae=['Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','exports','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x1e11c8,_0x56238b){var _0x208cc6=function(_0x5d387e){while(--_0x5d387e){_0x1e11c8['push'](_0x1e11c8['shift']());}};_0x208cc6(++_0x56238b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x7bae[_0x3de8a4];return _0x4635cf;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe7ba('0x0'));var Redis=require(_0xe7ba('0x1'));var config=require('../../../config/environment');config[_0xe7ba('0x2')]=_['defaults'](config[_0xe7ba('0x2')],{'host':_0xe7ba('0x3'),'port':0x18eb});var io=require(_0xe7ba('0x4'))(new Redis(config[_0xe7ba('0x2')]));function SmsQueue(_0x398a6a){this['id']=_0x398a6a['id']||0x0;this[_0xe7ba('0x5')]=_0x398a6a[_0xe7ba('0x5')]||'';this[_0xe7ba('0x6')]=_0x398a6a[_0xe7ba('0x6')]||0xa;this[_0xe7ba('0x7')]=_0x398a6a[_0xe7ba('0x7')]||_0xe7ba('0x8');this[_0xe7ba('0x9')]=_0x398a6a[_0xe7ba('0x9')];this['mapAgentsId']={};this[_0xe7ba('0xa')]=0x0;this[_0xe7ba('0xb')]='';this[_0xe7ba('0xc')]();this[_0xe7ba('0xd')]();}SmsQueue[_0xe7ba('0xe')][_0xe7ba('0xc')]=function(){var _0x99a86f=this[_0xe7ba('0xf')][_0xe7ba('0x10')];this['mapAgentsId']=_[_0xe7ba('0x11')](this['Agents'],'id');this[_0xe7ba('0xf')][_0xe7ba('0x10')]=_0x99a86f;};SmsQueue[_0xe7ba('0xe')][_0xe7ba('0xd')]=function(){this[_0xe7ba('0x12')]=0x0;this[_0xe7ba('0x13')]=0x0;for(var _0x561dbb=0x0;_0x561dbb=0x0?this['available']:0x0;var _0x5a82b5={'id':this['id'],'available':this[_0xe7ba('0x16')],'loggedIn':this[_0xe7ba('0x12')],'name':this[_0xe7ba('0x5')],'paused':this[_0xe7ba('0x13')],'waiting':this[_0xe7ba('0xa')]};var _0x58550c=md5(JSON[_0xe7ba('0x17')](_0x5a82b5));if(this[_0xe7ba('0xb')]!==_0x58550c){this[_0xe7ba('0xb')]=_0x58550c;io['to'](util[_0xe7ba('0x18')]('sms:queue:%s',_0x5a82b5[_0xe7ba('0x5')]))[_0xe7ba('0x19')]('sms_queue:save',_0x5a82b5);}};module[_0xe7ba('0x1a')]=SmsQueue; \ No newline at end of file +var _0x7764=['updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1e8288,_0x5c6b05){var _0x52c5c5=function(_0x26a9e3){while(--_0x26a9e3){_0x1e8288['push'](_0x1e8288['shift']());}};_0x52c5c5(++_0x5c6b05);}(_0x7764,0xa4));var _0x4776=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x7764[_0x555ebb];return _0x3c0a4a;};'use strict';var _=require(_0x4776('0x0'));var md5=require(_0x4776('0x1'));var util=require(_0x4776('0x2'));var Redis=require(_0x4776('0x3'));var config=require(_0x4776('0x4'));config[_0x4776('0x5')]=_[_0x4776('0x6')](config[_0x4776('0x5')],{'host':_0x4776('0x7'),'port':0x18eb});var io=require(_0x4776('0x8'))(new Redis(config['redis']));function SmsQueue(_0x5a1e38){this['id']=_0x5a1e38['id']||0x0;this[_0x4776('0x9')]=_0x5a1e38[_0x4776('0x9')]||'';this['timeout']=_0x5a1e38[_0x4776('0xa')]||0xa;this[_0x4776('0xb')]=_0x5a1e38['strategy']||'beepall';this[_0x4776('0xc')]=_0x5a1e38['Agents'];this[_0x4776('0xd')]={};this[_0x4776('0xe')]=0x0;this[_0x4776('0x1')]='';this[_0x4776('0xf')]();this[_0x4776('0x10')]();}SmsQueue[_0x4776('0x11')][_0x4776('0xf')]=function(){var _0x3fb889=this[_0x4776('0xd')][_0x4776('0x12')];this[_0x4776('0xd')]=_[_0x4776('0x13')](this[_0x4776('0xc')],'id');this[_0x4776('0xd')][_0x4776('0x12')]=_0x3fb889;};SmsQueue[_0x4776('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4776('0x14')]=0x0;for(var _0x46429e=0x0;_0x46429e=0x0?this[_0x4776('0x19')]:0x0;var _0xed81b5={'id':this['id'],'available':this[_0x4776('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x4776('0x9')],'paused':this[_0x4776('0x14')],'waiting':this['waiting']};var _0x3659fa=md5(JSON[_0x4776('0x1a')](_0xed81b5));if(this[_0x4776('0x1')]!==_0x3659fa){this[_0x4776('0x1')]=_0x3659fa;io['to'](util['format'](_0x4776('0x1b'),_0xed81b5[_0x4776('0x9')]))[_0x4776('0x1c')](_0x4776('0x1d'),_0xed81b5);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 6548bf1..4ecfe68 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 _0x5f26=['name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','whatsappPause','paused','available','waiting','stringify','emit','whatsapp_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0xf60ce3,_0x2ed4f5){var _0x1b40b5=function(_0x52f3b6){while(--_0x52f3b6){_0xf60ce3['push'](_0xf60ce3['shift']());}};_0x1b40b5(++_0x2ed4f5);}(_0x5f26,0x1ac));var _0x65f2=function(_0x34efa6,_0x343fe2){_0x34efa6=_0x34efa6-0x0;var _0x469490=_0x5f26[_0x34efa6];return _0x469490;};'use strict';var _=require('lodash');var md5=require(_0x65f2('0x0'));var util=require('util');var Redis=require(_0x65f2('0x1'));var config=require(_0x65f2('0x2'));config[_0x65f2('0x3')]=_[_0x65f2('0x4')](config[_0x65f2('0x3')],{'host':_0x65f2('0x5'),'port':0x18eb});var io=require(_0x65f2('0x6'))(new Redis(config[_0x65f2('0x3')]));function WhatsappQueue(_0x1d8e1d){this['id']=_0x1d8e1d['id']||0x0;this['name']=_0x1d8e1d[_0x65f2('0x7')]||'';this[_0x65f2('0x8')]=_0x1d8e1d[_0x65f2('0x8')]||0xa;this['strategy']=_0x1d8e1d[_0x65f2('0x9')]||_0x65f2('0xa');this[_0x65f2('0xb')]=_0x1d8e1d[_0x65f2('0xb')];this[_0x65f2('0xc')]={};this['waiting']=0x0;this[_0x65f2('0x0')]='';this[_0x65f2('0xd')]();this[_0x65f2('0xe')]();}WhatsappQueue[_0x65f2('0xf')][_0x65f2('0xd')]=function(){var _0x2d67d4=this[_0x65f2('0xc')]['_rr'];this[_0x65f2('0xc')]=_[_0x65f2('0x10')](this['Agents'],'id');this[_0x65f2('0xc')][_0x65f2('0x11')]=_0x2d67d4;};WhatsappQueue[_0x65f2('0xf')][_0x65f2('0xe')]=function(){this[_0x65f2('0x12')]=0x0;this['paused']=0x0;for(var _0xa9ba0e=0x0;_0xa9ba0e=0x0?this[_0x65f2('0x17')]:0x0;var _0x7ebc32={'id':this['id'],'available':this[_0x65f2('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x65f2('0x18')]};var _0x3e21c7=md5(JSON[_0x65f2('0x19')](_0x7ebc32));if(this['md5']!==_0x3e21c7){this[_0x65f2('0x0')]=_0x3e21c7;io['to'](util['format']('whatsapp:queue:%s',_0x7ebc32[_0x65f2('0x7')]))[_0x65f2('0x1a')](_0x65f2('0x1b'),_0x7ebc32);}};module[_0x65f2('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x6852=['prototype','_rr','map','loggedIn','paused','length','available','stringify','whatsapp_queue:save','exports','lodash','md5','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x114937,_0x45956b){var _0x5350af=function(_0x1cc369){while(--_0x1cc369){_0x114937['push'](_0x114937['shift']());}};_0x5350af(++_0x45956b);}(_0x6852,0x1a2));var _0x2685=function(_0x591450,_0xdbe254){_0x591450=_0x591450-0x0;var _0x3e37d8=_0x6852[_0x591450];return _0x3e37d8;};'use strict';var _=require(_0x2685('0x0'));var md5=require(_0x2685('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2685('0x2')]=_['defaults'](config['redis'],{'host':_0x2685('0x3'),'port':0x18eb});var io=require(_0x2685('0x4'))(new Redis(config[_0x2685('0x2')]));function WhatsappQueue(_0x3f3f4f){this['id']=_0x3f3f4f['id']||0x0;this[_0x2685('0x5')]=_0x3f3f4f[_0x2685('0x5')]||'';this[_0x2685('0x6')]=_0x3f3f4f[_0x2685('0x6')]||0xa;this['strategy']=_0x3f3f4f[_0x2685('0x7')]||_0x2685('0x8');this[_0x2685('0x9')]=_0x3f3f4f[_0x2685('0x9')];this[_0x2685('0xa')]={};this[_0x2685('0xb')]=0x0;this[_0x2685('0x1')]='';this[_0x2685('0xc')]();this[_0x2685('0xd')]();}WhatsappQueue[_0x2685('0xe')][_0x2685('0xc')]=function(){var _0x47189c=this[_0x2685('0xa')][_0x2685('0xf')];this['mapAgentsId']=_[_0x2685('0x10')](this['Agents'],'id');this[_0x2685('0xa')]['_rr']=_0x47189c;};WhatsappQueue[_0x2685('0xe')][_0x2685('0xd')]=function(){this[_0x2685('0x11')]=0x0;this[_0x2685('0x12')]=0x0;for(var _0x5b0140=0x0;_0x5b0140=0x0?this[_0x2685('0x14')]:0x0;var _0x27b3b2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2685('0x11')],'name':this[_0x2685('0x5')],'paused':this[_0x2685('0x12')],'waiting':this['waiting']};var _0x4992b2=md5(JSON[_0x2685('0x15')](_0x27b3b2));if(this[_0x2685('0x1')]!==_0x4992b2){this['md5']=_0x4992b2;io['to'](util['format']('whatsapp:queue:%s',_0x27b3b2['name']))['emit'](_0x2685('0x16'),_0x27b3b2);}};module[_0x2685('0x17')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f273fac..5708909 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(_0x2a4dc3,_0x3eabb3){var _0x2f7989=function(_0x26901e){while(--_0x26901e){_0x2a4dc3['push'](_0x2a4dc3['shift']());}};_0x2f7989(++_0x3eabb3);}(_0xb10b,0x12a));var _0xbb10=function(_0x10cbda,_0x331fd9){_0x10cbda=_0x10cbda-0x0;var _0x10e5d8=_0xb10b[_0x10cbda];return _0x10e5d8;};'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(_0x2659c7,_0x6560f4){var _0x3c5567=function(_0x345486){while(--_0x345486){_0x2659c7['push'](_0x2659c7['shift']());}};_0x3c5567(++_0x6560f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b2e8c,_0x54f172){_0x2b2e8c=_0x2b2e8c-0x0;var _0x4e8fac=_0xb10b[_0x2b2e8c];return _0x4e8fac;};'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 2fc7799..3979824 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 _0xcfd9=['Request','UpdateChatInteraction','updateChatInteraction','addTags','../client','update'];(function(_0x5ad900,_0x35ebe6){var _0x4f9312=function(_0x34ef9a){while(--_0x34ef9a){_0x5ad900['push'](_0x5ad900['shift']());}};_0x4f9312(++_0x35ebe6);}(_0xcfd9,0x190));var _0x9cfd=function(_0x4d770d,_0x5af4ce){_0x4d770d=_0x4d770d-0x0;var _0x11dc7a=_0xcfd9[_0x4d770d];return _0x11dc7a;};'use strict';var client=require(_0x9cfd('0x0'));exports[_0x9cfd('0x1')]=function(_0x1b22cb,_0xf21a8d){return client[_0x9cfd('0x2')](_0x9cfd('0x3'),{'body':_0xf21a8d,'options':{'where':{'id':_0x1b22cb}},'log':_0x9cfd('0x4')});};exports[_0x9cfd('0x5')]=function(_0x4350b1,_0x1ff3f8){return client[_0x9cfd('0x2')]('AddTagsToChatInteraction',{'body':_0x1ff3f8,'options':{'where':{'id':_0x4350b1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xbccc=['updateChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0xbccc,0x9a));var _0xcbcc=function(_0x1e3612,_0x12c432){_0x1e3612=_0x1e3612-0x0;var _0x4e5be2=_0xbccc[_0x1e3612];return _0x4e5be2;};'use strict';var client=require('../client');exports[_0xcbcc('0x0')]=function(_0x464b56,_0x46baa9){return client[_0xcbcc('0x1')]('UpdateChatInteraction',{'body':_0x46baa9,'options':{'where':{'id':_0x464b56}},'log':_0xcbcc('0x2')});};exports['addTags']=function(_0x5d47bb,_0x2e0978){return client['Request']('AddTagsToChatInteraction',{'body':_0x2e0978,'options':{'where':{'id':_0x5d47bb}},'log':_0xcbcc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9a87cde..02245a2 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 _0x5dfe=['create','Request','createChatMessage','../client'];(function(_0xeb7865,_0x4b4d6c){var _0x145190=function(_0x3e10aa){while(--_0x3e10aa){_0xeb7865['push'](_0xeb7865['shift']());}};_0x145190(++_0x4b4d6c);}(_0x5dfe,0xe7));var _0xe5df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5dfe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe5df('0x0'));exports[_0xe5df('0x1')]=function(_0x4cde53){return client[_0xe5df('0x2')]('CreateChatMessage',{'body':_0x4cde53,'log':_0xe5df('0x3')});}; \ No newline at end of file +var _0x3b5d=['../client','create','CreateChatMessage'];(function(_0x3005a6,_0x320826){var _0x2f7399=function(_0x210e82){while(--_0x210e82){_0x3005a6['push'](_0x3005a6['shift']());}};_0x2f7399(++_0x320826);}(_0x3b5d,0x1ce));var _0xd3b5=function(_0x38bce7,_0x366405){_0x38bce7=_0x38bce7-0x0;var _0x4f8b4e=_0x3b5d[_0x38bce7];return _0x4f8b4e;};'use strict';var client=require(_0xd3b5('0x0'));exports[_0xd3b5('0x1')]=function(_0x2d0bd6){return client['Request'](_0xd3b5('0x2'),{'body':_0x2d0bd6,'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 8af8a96..51a8b2b 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 _0xc627=['getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online','chatPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc627,0x14a));var _0x7c62=function(_0x563ac8,_0x307399){_0x563ac8=_0x563ac8-0x0;var _0x357bca=_0xc627[_0x563ac8];return _0x357bca;};'use strict';var client=require('../client');exports[_0x7c62('0x0')]=function(){return function(){return client[_0x7c62('0x1')](_0x7c62('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7c62('0x3'),_0x7c62('0x4')],'include':[{'model':_0x7c62('0x5'),'as':_0x7c62('0x6'),'attributes':['id',_0x7c62('0x7'),_0x7c62('0x8'),_0x7c62('0x9')]}]},'log':_0x7c62('0x0')});};}; \ No newline at end of file +var _0x5447=['getChatQueues','../client','Request','GetChatQueue','timeout','User','Agents','name','online','chatPause'];(function(_0x5cce7f,_0x59e4bc){var _0x2698df=function(_0x219549){while(--_0x219549){_0x5cce7f['push'](_0x5cce7f['shift']());}};_0x2698df(++_0x59e4bc);}(_0x5447,0xf1));var _0x7544=function(_0x14a9fb,_0x82467d){_0x14a9fb=_0x14a9fb-0x0;var _0x2eee9c=_0x5447[_0x14a9fb];return _0x2eee9c;};'use strict';var client=require(_0x7544('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x7544('0x1')](_0x7544('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7544('0x3'),'strategy'],'include':[{'model':_0x7544('0x4'),'as':_0x7544('0x5'),'attributes':['id',_0x7544('0x6'),_0x7544('0x7'),_0x7544('0x8')]}]},'log':_0x7544('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 836340b..1b05326 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 _0x3685=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport','update'];(function(_0x7b546a,_0x116972){var _0x3601a1=function(_0x5b6bb2){while(--_0x5b6bb2){_0x7b546a['push'](_0x7b546a['shift']());}};_0x3601a1(++_0x116972);}(_0x3685,0xf8));var _0x5368=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3685[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x5368('0x0'));exports['create']=function(_0x31ec8e){return client[_0x5368('0x1')](_0x5368('0x2'),{'body':_0x31ec8e,'log':_0x5368('0x2')});};exports[_0x5368('0x3')]=function(_0xf0428a,_0x271e21){return client[_0x5368('0x1')](_0x5368('0x4'),{'body':_0x271e21,'options':{'where':{'uniqueid':_0xf0428a},'order':[['id',_0x5368('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x54f3=['create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x54f3,0x120));var _0x354f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x54f3[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0x354f('0x0')]=function(_0x344fae){return client[_0x354f('0x1')](_0x354f('0x2'),{'body':_0x344fae,'log':_0x354f('0x2')});};exports['update']=function(_0x48d7aa,_0xe4efe){return client[_0x354f('0x1')](_0x354f('0x3'),{'body':_0xe4efe,'options':{'where':{'uniqueid':_0x48d7aa},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3ba47dc..937aced 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0x7a54,0x106));var _0x47a5=function(_0x1af5fc,_0x292004){_0x1af5fc=_0x1af5fc-0x0;var _0x509b39=_0x7a54[_0x1af5fc];return _0x509b39;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4296ec,_0x1354bb){var _0x39147a=function(_0x3b12ae){while(--_0x3b12ae){_0x4296ec['push'](_0x4296ec['shift']());}};_0x39147a(++_0x1354bb);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 1f6deed..af2c472 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 _0xeea6=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x3d4928,_0xe1ec20){var _0x5a9ed7=function(_0x41de06){while(--_0x41de06){_0x3d4928['push'](_0x3d4928['shift']());}};_0x5a9ed7(++_0xe1ec20);}(_0xeea6,0xee));var _0x6eea=function(_0x445fbc,_0x1a17f9){_0x445fbc=_0x445fbc-0x0;var _0x5762a9=_0xeea6[_0x445fbc];return _0x5762a9;};'use strict';var client=require(_0x6eea('0x0'));exports['create']=function(_0x3ead2f){return client[_0x6eea('0x1')](_0x6eea('0x2'),{'body':_0x3ead2f,'log':_0x6eea('0x3')});}; \ No newline at end of file +var _0x094c=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x094c,0x1ec));var _0xc094=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0x094c[_0x1a0557];return _0x1ad015;};'use strict';var client=require('../client');exports['create']=function(_0x620879){return client[_0xc094('0x0')](_0xc094('0x1'),{'body':_0x620879,'log':_0xc094('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9315f85..ecf40e0 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 _0x71ee=['timeout','strategy','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x71ee,0x137));var _0xe71e=function(_0x2e96de,_0x7b3fac){_0x2e96de=_0x2e96de-0x0;var _0x588f95=_0x71ee[_0x2e96de];return _0x588f95;};'use strict';var client=require(_0xe71e('0x0'));exports[_0xe71e('0x1')]=function(){return function(){return client['Request'](_0xe71e('0x2'),{'options':{'raw':![],'attributes':['id',_0xe71e('0x3'),_0xe71e('0x4'),_0xe71e('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xe71e('0x3'),'online',_0xe71e('0x6')]}]},'log':_0xe71e('0x1')});};}; \ No newline at end of file +var _0x8da3=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x560408,_0x45c914){var _0x3fd4da=function(_0x47e9a9){while(--_0x47e9a9){_0x560408['push'](_0x560408['shift']());}};_0x3fd4da(++_0x45c914);}(_0x8da3,0x19c));var _0x38da=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x8da3[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x38da('0x0'));exports[_0x38da('0x1')]=function(){return function(){return client[_0x38da('0x2')](_0x38da('0x3'),{'options':{'raw':![],'attributes':['id',_0x38da('0x4'),_0x38da('0x5'),_0x38da('0x6')],'include':[{'model':_0x38da('0x7'),'as':_0x38da('0x8'),'attributes':['id',_0x38da('0x4'),_0x38da('0x9'),_0x38da('0xa')]}]},'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 d618288..2d3985f 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 _0xf8ef=['DESC','../client','create','Request','UpdateFaxQueueReport'];(function(_0x461a98,_0x5340ff){var _0x579fe9=function(_0x195a33){while(--_0x195a33){_0x461a98['push'](_0x461a98['shift']());}};_0x579fe9(++_0x5340ff);}(_0xf8ef,0x114));var _0xff8e=function(_0x49226a,_0x35a205){_0x49226a=_0x49226a-0x0;var _0x335689=_0xf8ef[_0x49226a];return _0x335689;};'use strict';var client=require(_0xff8e('0x0'));exports[_0xff8e('0x1')]=function(_0x29dd5b){return client[_0xff8e('0x2')]('CreateFaxQueueReport',{'body':_0x29dd5b,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x16c20a,_0x597171){return client[_0xff8e('0x2')](_0xff8e('0x3'),{'body':_0x597171,'options':{'where':{'uniqueid':_0x16c20a},'order':[['id',_0xff8e('0x4')]],'limit':0x1},'log':_0xff8e('0x3')});}; \ No newline at end of file +var _0xa3b4=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x1dbe31,_0x54c4ca){var _0x3ec4b1=function(_0x5c2aeb){while(--_0x5c2aeb){_0x1dbe31['push'](_0x1dbe31['shift']());}};_0x3ec4b1(++_0x54c4ca);}(_0xa3b4,0x130));var _0x4a3b=function(_0x23dae9,_0x4c0cfb){_0x23dae9=_0x23dae9-0x0;var _0x6bb8f0=_0xa3b4[_0x23dae9];return _0x6bb8f0;};'use strict';var client=require('../client');exports[_0x4a3b('0x0')]=function(_0x3fdc16){return client[_0x4a3b('0x1')](_0x4a3b('0x2'),{'body':_0x3fdc16,'log':_0x4a3b('0x2')});};exports[_0x4a3b('0x3')]=function(_0x4f3193,_0x541d47){return client[_0x4a3b('0x1')](_0x4a3b('0x4'),{'body':_0x541d47,'options':{'where':{'uniqueid':_0x4f3193},'order':[['id',_0x4a3b('0x5')]],'limit':0x1},'log':_0x4a3b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 148fdbc..2214932 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 _0x1a9c=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x2d674d,_0x33b36e){var _0x588b6b=function(_0x11cf55){while(--_0x11cf55){_0x2d674d['push'](_0x2d674d['shift']());}};_0x588b6b(++_0x33b36e);}(_0x1a9c,0x83));var _0xc1a9=function(_0xb160bf,_0x4a04a3){_0xb160bf=_0xb160bf-0x0;var _0x4a1e1f=_0x1a9c[_0xb160bf];return _0x4a1e1f;};'use strict';var client=require(_0xc1a9('0x0'));exports[_0xc1a9('0x1')]=function(){return function(){return client[_0xc1a9('0x2')](_0xc1a9('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc1a9('0x4')],'include':[{'model':_0xc1a9('0x5'),'as':_0xc1a9('0x6'),'attributes':['id',_0xc1a9('0x4'),_0xc1a9('0x7')]}]},'log':_0xc1a9('0x1')});};}; \ No newline at end of file +var _0x2b28=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x40dcd1,_0x5cd1da){var _0x5c056b=function(_0x87a3a7){while(--_0x87a3a7){_0x40dcd1['push'](_0x40dcd1['shift']());}};_0x5c056b(++_0x5cd1da);}(_0x2b28,0x130));var _0x82b2=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x2b28[_0x3ce2c4];return _0x4047c1;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x82b2('0x0')](_0x82b2('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x82b2('0x2')],'include':[{'model':_0x82b2('0x3'),'as':_0x82b2('0x4'),'attributes':['id',_0x82b2('0x2'),_0x82b2('0x5')]}]},'log':_0x82b2('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 49b63d0..ae2ebe9 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 _0x5430=['Request','UpdateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5430,0x10c));var _0x0543=function(_0x55acb4,_0x3be385){_0x55acb4=_0x55acb4-0x0;var _0x1ac152=_0x5430[_0x55acb4];return _0x1ac152;};'use strict';var client=require(_0x0543('0x0'));exports[_0x0543('0x1')]=function(_0xa1b1a7,_0x4078bf){return client[_0x0543('0x2')](_0x0543('0x3'),{'body':_0x4078bf,'options':{'where':{'id':_0xa1b1a7}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x1c5ab7,_0x4ee416){return client['Request'](_0x0543('0x4'),{'body':_0x4ee416,'options':{'where':{'id':_0x1c5ab7}},'log':_0x0543('0x5')});}; \ No newline at end of file +var _0x2032=['addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x106a19,_0x519ddb){_0x106a19=_0x106a19-0x0;var _0x1057d6=_0x2032[_0x106a19];return _0x1057d6;};'use strict';var client=require('../client');exports[_0x2203('0x0')]=function(_0x1e103d,_0xcd892f){return client['Request'](_0x2203('0x1'),{'body':_0xcd892f,'options':{'where':{'id':_0x1e103d}},'log':_0x2203('0x2')});};exports['addTags']=function(_0x46c49a,_0x880dcd){return client[_0x2203('0x3')](_0x2203('0x4'),{'body':_0x880dcd,'options':{'where':{'id':_0x46c49a}},'log':_0x2203('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 287e37f..e580875 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 _0xab10=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x40fb3a,_0x45f997){var _0x36c717=function(_0x4c5863){while(--_0x4c5863){_0x40fb3a['push'](_0x40fb3a['shift']());}};_0x36c717(++_0x45f997);}(_0xab10,0x16f));var _0x0ab1=function(_0x164f2b,_0x583270){_0x164f2b=_0x164f2b-0x0;var _0x48af24=_0xab10[_0x164f2b];return _0x48af24;};'use strict';var client=require(_0x0ab1('0x0'));exports[_0x0ab1('0x1')]=function(_0x10ae9c){return client['Request'](_0x0ab1('0x2'),{'body':_0x10ae9c,'log':_0x0ab1('0x3')});}; \ No newline at end of file +var _0xe446=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x3d0882,_0x5c27a5){var _0xaef64=function(_0x297451){while(--_0x297451){_0x3d0882['push'](_0x3d0882['shift']());}};_0xaef64(++_0x5c27a5);}(_0xe446,0xfb));var _0x6e44=function(_0x4bc128,_0x85ba08){_0x4bc128=_0x4bc128-0x0;var _0xc82928=_0xe446[_0x4bc128];return _0xc82928;};'use strict';var client=require(_0x6e44('0x0'));exports['create']=function(_0x3161dc){return client[_0x6e44('0x1')](_0x6e44('0x2'),{'body':_0x3161dc,'log':_0x6e44('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7a7dc04..9dd9146 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 _0xd2fb=['getMailQueues','Request','name','timeout','strategy','User','Agents','mailPause','../client'];(function(_0x1aac7e,_0x5e381b){var _0x29b93a=function(_0x5e4f6e){while(--_0x5e4f6e){_0x1aac7e['push'](_0x1aac7e['shift']());}};_0x29b93a(++_0x5e381b);}(_0xd2fb,0xaa));var _0xbd2f=function(_0x4d1a45,_0x4a5448){_0x4d1a45=_0x4d1a45-0x0;var _0x382185=_0xd2fb[_0x4d1a45];return _0x382185;};'use strict';var client=require(_0xbd2f('0x0'));exports[_0xbd2f('0x1')]=function(){return function(){return client[_0xbd2f('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xbd2f('0x3'),_0xbd2f('0x4'),_0xbd2f('0x5')],'include':[{'model':_0xbd2f('0x6'),'as':_0xbd2f('0x7'),'attributes':['id',_0xbd2f('0x3'),'online',_0xbd2f('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x109a=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x1201a4,_0xcdbe20){var _0x29a1d8=function(_0x1e6247){while(--_0x1e6247){_0x1201a4['push'](_0x1201a4['shift']());}};_0x29a1d8(++_0xcdbe20);}(_0x109a,0xd4));var _0xa109=function(_0x51f584,_0x35221e){_0x51f584=_0x51f584-0x0;var _0x72548b=_0x109a[_0x51f584];return _0x72548b;};'use strict';var client=require(_0xa109('0x0'));exports[_0xa109('0x1')]=function(){return function(){return client[_0xa109('0x2')](_0xa109('0x3'),{'options':{'raw':![],'attributes':['id',_0xa109('0x4'),_0xa109('0x5'),_0xa109('0x6')],'include':[{'model':_0xa109('0x7'),'as':'Agents','attributes':['id',_0xa109('0x4'),_0xa109('0x8'),_0xa109('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6a80b16..acd0a3b 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 _0xe834=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x36f8d6,_0x1b6ce7){var _0x1da344=function(_0x5e6fc0){while(--_0x5e6fc0){_0x36f8d6['push'](_0x36f8d6['shift']());}};_0x1da344(++_0x1b6ce7);}(_0xe834,0x95));var _0x4e83=function(_0x5d897d,_0x8f648e){_0x5d897d=_0x5d897d-0x0;var _0x21a626=_0xe834[_0x5d897d];return _0x21a626;};'use strict';var client=require('../client');exports[_0x4e83('0x0')]=function(_0x3ed68d){return client[_0x4e83('0x1')](_0x4e83('0x2'),{'body':_0x3ed68d,'log':'CreateMailQueueReport'});};exports[_0x4e83('0x3')]=function(_0x2c4fa0,_0x307f9b){return client[_0x4e83('0x1')](_0x4e83('0x4'),{'body':_0x307f9b,'options':{'where':{'uniqueid':_0x2c4fa0},'order':[['id',_0x4e83('0x5')]],'limit':0x1},'log':_0x4e83('0x4')});}; \ No newline at end of file +var _0x275e=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x25997b,_0xeddec4){var _0x43f8e1=function(_0x3a1005){while(--_0x3a1005){_0x25997b['push'](_0x25997b['shift']());}};_0x43f8e1(++_0xeddec4);}(_0x275e,0x13c));var _0xe275=function(_0xa95a5,_0x40586a){_0xa95a5=_0xa95a5-0x0;var _0x4a52c7=_0x275e[_0xa95a5];return _0x4a52c7;};'use strict';var client=require(_0xe275('0x0'));exports[_0xe275('0x1')]=function(_0x25fb4b){return client[_0xe275('0x2')](_0xe275('0x3'),{'body':_0x25fb4b,'log':_0xe275('0x3')});};exports[_0xe275('0x4')]=function(_0x5dd8cb,_0x4658ef){return client[_0xe275('0x2')](_0xe275('0x5'),{'body':_0x4658ef,'options':{'where':{'uniqueid':_0x5dd8cb},'order':[['id',_0xe275('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9620a6e..e970882 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 _0x9657=['addTagsToChatInteraction','addTags'];(function(_0x18fa6c,_0x364bbb){var _0x1b96e3=function(_0x45a33a){while(--_0x45a33a){_0x18fa6c['push'](_0x18fa6c['shift']());}};_0x1b96e3(++_0x364bbb);}(_0x9657,0x6b));var _0x7965=function(_0x15b967,_0x22006a){_0x15b967=_0x15b967-0x0;var _0x52e521=_0x9657[_0x15b967];return _0x52e521;};'use strict';var client=require('../client');exports['update']=function(_0xeeda0,_0x3c0d1c){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x3c0d1c,'options':{'where':{'id':_0xeeda0}},'log':'updateOpenchannelInteraction'});};exports[_0x7965('0x0')]=function(_0x53beeb,_0x3e05b5){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x3e05b5,'options':{'where':{'id':_0x53beeb}},'log':_0x7965('0x1')});}; \ No newline at end of file +var _0xcc92=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client'];(function(_0x239555,_0x59f04e){var _0x224fe3=function(_0x592bb0){while(--_0x592bb0){_0x239555['push'](_0x239555['shift']());}};_0x224fe3(++_0x59f04e);}(_0xcc92,0x1d9));var _0x2cc9=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xcc92[_0x5e36d1];return _0x950b9e;};'use strict';var client=require(_0x2cc9('0x0'));exports[_0x2cc9('0x1')]=function(_0x2ceea2,_0x23f8be){return client[_0x2cc9('0x2')](_0x2cc9('0x3'),{'body':_0x23f8be,'options':{'where':{'id':_0x2ceea2}},'log':_0x2cc9('0x4')});};exports[_0x2cc9('0x5')]=function(_0x4f8363,_0x2cd7d6){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x2cd7d6,'options':{'where':{'id':_0x4f8363}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e570ea0..bca9097 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 _0x6bae=['create','CreateOpenchannelMessage','../client'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x6bae,0x188));var _0xe6ba=function(_0x2db66e,_0x3272e7){_0x2db66e=_0x2db66e-0x0;var _0x4b4b23=_0x6bae[_0x2db66e];return _0x4b4b23;};'use strict';var client=require(_0xe6ba('0x0'));exports[_0xe6ba('0x1')]=function(_0x34b683){return client['Request'](_0xe6ba('0x2'),{'body':_0x34b683,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xda67=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xda67,0x1e9));var _0x7da6=function(_0x4fe708,_0x2bf6d7){_0x4fe708=_0x4fe708-0x0;var _0x5791f3=_0xda67[_0x4fe708];return _0x5791f3;};'use strict';var client=require(_0x7da6('0x0'));exports[_0x7da6('0x1')]=function(_0xa506b4){return client[_0x7da6('0x2')](_0x7da6('0x3'),{'body':_0xa506b4,'log':_0x7da6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6137277..78432c2 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 _0x0d77=['strategy','Agents','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout'];(function(_0x2c0609,_0x2f68ed){var _0x5e2407=function(_0x35d900){while(--_0x35d900){_0x2c0609['push'](_0x2c0609['shift']());}};_0x5e2407(++_0x2f68ed);}(_0x0d77,0x8b));var _0x70d7=function(_0x25ae13,_0x3515f5){_0x25ae13=_0x25ae13-0x0;var _0x372648=_0x0d77[_0x25ae13];return _0x372648;};'use strict';var client=require(_0x70d7('0x0'));exports[_0x70d7('0x1')]=function(){return function(){return client[_0x70d7('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x70d7('0x3'),_0x70d7('0x4'),_0x70d7('0x5')],'include':[{'model':'User','as':_0x70d7('0x6'),'attributes':['id',_0x70d7('0x3'),'online',_0x70d7('0x7')]}]},'log':_0x70d7('0x1')});};}; \ No newline at end of file +var _0xc67a=['Request','GetOpenchannelQueue','timeout','strategy','Agents','name','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3f4dbd,_0x3c20f6){var _0x3015b5=function(_0x5024b3){while(--_0x5024b3){_0x3f4dbd['push'](_0x3f4dbd['shift']());}};_0x3015b5(++_0x3c20f6);}(_0xc67a,0x134));var _0xac67=function(_0x29eff3,_0x35596c){_0x29eff3=_0x29eff3-0x0;var _0x126c5c=_0xc67a[_0x29eff3];return _0x126c5c;};'use strict';var client=require(_0xac67('0x0'));exports[_0xac67('0x1')]=function(){return function(){return client[_0xac67('0x2')](_0xac67('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xac67('0x4'),_0xac67('0x5')],'include':[{'model':'User','as':_0xac67('0x6'),'attributes':['id',_0xac67('0x7'),_0xac67('0x8'),_0xac67('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d311cb6..a61e80b 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 _0x26f9=['DESC','../client','create','Request','update','UpdateOpenchannelQueueReport'];(function(_0x44166f,_0x3e71e2){var _0x5f390a=function(_0x4876fb){while(--_0x4876fb){_0x44166f['push'](_0x44166f['shift']());}};_0x5f390a(++_0x3e71e2);}(_0x26f9,0x16f));var _0x926f=function(_0xb4d928,_0x579093){_0xb4d928=_0xb4d928-0x0;var _0x47166e=_0x26f9[_0xb4d928];return _0x47166e;};'use strict';var client=require(_0x926f('0x0'));exports[_0x926f('0x1')]=function(_0x4fdca2){return client[_0x926f('0x2')]('CreateOpenchannelQueueReport',{'body':_0x4fdca2,'log':'CreateOpenchannelQueueReport'});};exports[_0x926f('0x3')]=function(_0x1c54cc,_0x542c64){return client[_0x926f('0x2')](_0x926f('0x4'),{'body':_0x542c64,'options':{'where':{'uniqueid':_0x1c54cc},'order':[['id',_0x926f('0x5')]],'limit':0x1},'log':_0x926f('0x4')});}; \ No newline at end of file +var _0xaf5c=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','create'];(function(_0x58fb84,_0x507bc5){var _0x19215a=function(_0x5420d5){while(--_0x5420d5){_0x58fb84['push'](_0x58fb84['shift']());}};_0x19215a(++_0x507bc5);}(_0xaf5c,0x161));var _0xcaf5=function(_0x1f2614,_0x2e14e1){_0x1f2614=_0x1f2614-0x0;var _0x62b194=_0xaf5c[_0x1f2614];return _0x62b194;};'use strict';var client=require('../client');exports[_0xcaf5('0x0')]=function(_0x7e5ff4){return client[_0xcaf5('0x1')](_0xcaf5('0x2'),{'body':_0x7e5ff4,'log':'CreateOpenchannelQueueReport'});};exports[_0xcaf5('0x3')]=function(_0x457519,_0x549b40){return client[_0xcaf5('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x549b40,'options':{'where':{'uniqueid':_0x457519},'order':[['id',_0xcaf5('0x4')]],'limit':0x1},'log':_0xcaf5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a70cd78..3fcbea2 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 _0x9b67=['addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x9b67,0xf6));var _0x79b6=function(_0x2c7229,_0x2d1719){_0x2c7229=_0x2c7229-0x0;var _0x3b130a=_0x9b67[_0x2c7229];return _0x3b130a;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(_0xfb9138,_0x1f4b0b){return client[_0x79b6('0x2')]('UpdateSmsInteraction',{'body':_0x1f4b0b,'options':{'where':{'id':_0xfb9138}},'log':_0x79b6('0x3')});};exports[_0x79b6('0x4')]=function(_0x5297d0,_0x4e8794){return client[_0x79b6('0x2')](_0x79b6('0x5'),{'body':_0x4e8794,'options':{'where':{'id':_0x5297d0}},'log':_0x79b6('0x6')});}; \ No newline at end of file +var _0xfb15=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x51e51a,_0x2bfe6c){var _0x1e47cc=function(_0x5db8ec){while(--_0x5db8ec){_0x51e51a['push'](_0x51e51a['shift']());}};_0x1e47cc(++_0x2bfe6c);}(_0xfb15,0x12f));var _0x5fb1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfb15[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x5fb1('0x0'));exports[_0x5fb1('0x1')]=function(_0xecebe1,_0x33922b){return client[_0x5fb1('0x2')](_0x5fb1('0x3'),{'body':_0x33922b,'options':{'where':{'id':_0xecebe1}},'log':'updateSmsInteraction'});};exports[_0x5fb1('0x4')]=function(_0x253775,_0x3a82a1){return client[_0x5fb1('0x2')](_0x5fb1('0x5'),{'body':_0x3a82a1,'options':{'where':{'id':_0x253775}},'log':_0x5fb1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c48e1c4..d2f9f6a 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 _0x6d2e=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x211167,_0x1653ea){var _0x5f1a07=function(_0x34cf13){while(--_0x34cf13){_0x211167['push'](_0x211167['shift']());}};_0x5f1a07(++_0x1653ea);}(_0x6d2e,0x9c));var _0xe6d2=function(_0x53208e,_0x4a1eb8){_0x53208e=_0x53208e-0x0;var _0xa97d9b=_0x6d2e[_0x53208e];return _0xa97d9b;};'use strict';var client=require('../client');exports[_0xe6d2('0x0')]=function(_0x5d58cc){return client[_0xe6d2('0x1')](_0xe6d2('0x2'),{'body':_0x5d58cc,'log':_0xe6d2('0x3')});}; \ No newline at end of file +var _0x97b2=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xe0d603,_0x4b4035){var _0x54ea1d=function(_0x5a0f39){while(--_0x5a0f39){_0xe0d603['push'](_0xe0d603['shift']());}};_0x54ea1d(++_0x4b4035);}(_0x97b2,0x18e));var _0x297b=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x97b2[_0x5b5eb4];return _0x42af53;};'use strict';var client=require(_0x297b('0x0'));exports[_0x297b('0x1')]=function(_0x2ad7d0){return client[_0x297b('0x2')](_0x297b('0x3'),{'body':_0x2ad7d0,'log':_0x297b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9de6925..a8107b3 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x310a5a,_0x3f7774){var _0x503054=function(_0x51b8e2){while(--_0x51b8e2){_0x310a5a['push'](_0x310a5a['shift']());}};_0x503054(++_0x3f7774);}(_0xe706,0xa3));var _0x6e70=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xe706[_0x25bea7];return _0x175952;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x2d29bd,_0x5515bc){var _0x30358e=function(_0x399f6b){while(--_0x399f6b){_0x2d29bd['push'](_0x2d29bd['shift']());}};_0x30358e(++_0x5515bc);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 964dbfd..7492ac9 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2b6a8f,_0x294599){var _0x2d2036=function(_0x1ea077){while(--_0x1ea077){_0x2b6a8f['push'](_0x2b6a8f['shift']());}};_0x2d2036(++_0x294599);}(_0x70e0,0x17b));var _0x070e=function(_0x327a36,_0x4e73e5){_0x327a36=_0x327a36-0x0;var _0x4466fd=_0x70e0[_0x327a36];return _0x4466fd;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3405ba,_0x10b568){var _0x3c4ce4=function(_0x37a551){while(--_0x37a551){_0x3405ba['push'](_0x3405ba['shift']());}};_0x3c4ce4(++_0x10b568);}(_0x70e0,0x17b));var _0x070e=function(_0x1c0b96,_0x382432){_0x1c0b96=_0x1c0b96-0x0;var _0x16a2bb=_0x70e0[_0x1c0b96];return _0x16a2bb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 7a5b773..ac820cb 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(_0x3bbe3d,_0x23ec60){var _0xc719ee=function(_0x24cf6d){while(--_0x24cf6d){_0x3bbe3d['push'](_0x3bbe3d['shift']());}};_0xc719ee(++_0x23ec60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x1cadd2,_0x314b05){var _0x5af1e0=function(_0x20a436){while(--_0x20a436){_0x1cadd2['push'](_0x1cadd2['shift']());}};_0x5af1e0(++_0x314b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 e489926..6bf4fe1 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 _0x5d58=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','UpdateWhatsappInteraction'];(function(_0x3dda9a,_0xa26548){var _0x55c55d=function(_0xfb533c){while(--_0xfb533c){_0x3dda9a['push'](_0x3dda9a['shift']());}};_0x55c55d(++_0xa26548);}(_0x5d58,0x187));var _0x85d5=function(_0x374bde,_0x5d1664){_0x374bde=_0x374bde-0x0;var _0x35cc3c=_0x5d58[_0x374bde];return _0x35cc3c;};'use strict';var client=require('../client');exports['update']=function(_0x5e2da7,_0x54bfc4){return client['Request'](_0x85d5('0x0'),{'body':_0x54bfc4,'options':{'where':{'id':_0x5e2da7}},'log':_0x85d5('0x1')});};exports['addTags']=function(_0x1469fc,_0x30bfe8){return client['Request'](_0x85d5('0x2'),{'body':_0x30bfe8,'options':{'where':{'id':_0x1469fc}},'log':_0x85d5('0x3')});}; \ No newline at end of file +var _0xc7a3=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x3feab4,_0x43e82c){var _0x3bc3c7=function(_0x162ec8){while(--_0x162ec8){_0x3feab4['push'](_0x3feab4['shift']());}};_0x3bc3c7(++_0x43e82c);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x29af9c,_0xe09414){_0x29af9c=_0x29af9c-0x0;var _0x57d077=_0xc7a3[_0x29af9c];return _0x57d077;};'use strict';var client=require('../client');exports[_0x3c7a('0x0')]=function(_0x753b95,_0x73d51f){return client[_0x3c7a('0x1')](_0x3c7a('0x2'),{'body':_0x73d51f,'options':{'where':{'id':_0x753b95}},'log':_0x3c7a('0x3')});};exports['addTags']=function(_0x44fd47,_0x3e1c47){return client['Request'](_0x3c7a('0x4'),{'body':_0x3e1c47,'options':{'where':{'id':_0x44fd47}},'log':_0x3c7a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d068c09..1e968ca 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 _0xd3d2=['Request','../client','create'];(function(_0x390c42,_0x10e1ae){var _0x43894c=function(_0x510bd0){while(--_0x510bd0){_0x390c42['push'](_0x390c42['shift']());}};_0x43894c(++_0x10e1ae);}(_0xd3d2,0x127));var _0x2d3d=function(_0x518a72,_0x367e20){_0x518a72=_0x518a72-0x0;var _0x1fcad1=_0xd3d2[_0x518a72];return _0x1fcad1;};'use strict';var client=require(_0x2d3d('0x0'));exports[_0x2d3d('0x1')]=function(_0x2fff68){return client[_0x2d3d('0x2')]('CreateWhatsappMessage',{'body':_0x2fff68,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xc3b1=['CreateWhatsappMessage','createWhatsappMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3b1,0x154));var _0x1c3b=function(_0x2f99d8,_0x291cbb){_0x2f99d8=_0x2f99d8-0x0;var _0xf81fce=_0xc3b1[_0x2f99d8];return _0xf81fce;};'use strict';var client=require('../client');exports['create']=function(_0x5e2571){return client['Request'](_0x1c3b('0x0'),{'body':_0x5e2571,'log':_0x1c3b('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 4d2d613..e2bcff0 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 _0x76f9=['../client','Request','GetWhatsappQueue','name','strategy','User','Agents','whatsappPause'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x76f9,0x1d0));var _0x976f=function(_0x27c749,_0x6e5a34){_0x27c749=_0x27c749-0x0;var _0x3a0698=_0x76f9[_0x27c749];return _0x3a0698;};'use strict';var client=require(_0x976f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x976f('0x1')](_0x976f('0x2'),{'options':{'raw':![],'attributes':['id',_0x976f('0x3'),'timeout',_0x976f('0x4')],'include':[{'model':_0x976f('0x5'),'as':_0x976f('0x6'),'attributes':['id',_0x976f('0x3'),'online',_0x976f('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xb501=['name','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','User'];(function(_0x553f35,_0x18559e){var _0x1fa650=function(_0x592022){while(--_0x592022){_0x553f35['push'](_0x553f35['shift']());}};_0x1fa650(++_0x18559e);}(_0xb501,0x1d2));var _0x1b50=function(_0x2b190a,_0x14b59f){_0x2b190a=_0x2b190a-0x0;var _0x3b8b5f=_0xb501[_0x2b190a];return _0x3b8b5f;};'use strict';var client=require(_0x1b50('0x0'));exports[_0x1b50('0x1')]=function(){return function(){return client[_0x1b50('0x2')](_0x1b50('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1b50('0x4'),'strategy'],'include':[{'model':_0x1b50('0x5'),'as':'Agents','attributes':['id',_0x1b50('0x6'),'online',_0x1b50('0x7')]}]},'log':_0x1b50('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index de222a9..9e7db0d 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 _0x6181=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x33db4d,_0x27cdb3){var _0x5e2a25=function(_0x498846){while(--_0x498846){_0x33db4d['push'](_0x33db4d['shift']());}};_0x5e2a25(++_0x27cdb3);}(_0x6181,0x8e));var _0x1618=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x6181[_0x364a36];return _0x5cd6fa;};'use strict';var client=require(_0x1618('0x0'));exports[_0x1618('0x1')]=function(_0xb736cf){return client[_0x1618('0x2')]('CreateWhatsappQueueReport',{'body':_0xb736cf,'log':_0x1618('0x3')});};exports[_0x1618('0x4')]=function(_0x51693e,_0x478a63){return client['Request'](_0x1618('0x5'),{'body':_0x478a63,'options':{'where':{'uniqueid':_0x51693e},'order':[['id',_0x1618('0x6')]],'limit':0x1},'log':_0x1618('0x5')});}; \ No newline at end of file +var _0xaa84=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0xa4aad6,_0x44f826){var _0x1acff2=function(_0x5f2704){while(--_0x5f2704){_0xa4aad6['push'](_0xa4aad6['shift']());}};_0x1acff2(++_0x44f826);}(_0xaa84,0x142));var _0x4aa8=function(_0x125223,_0x57ac63){_0x125223=_0x125223-0x0;var _0x30b294=_0xaa84[_0x125223];return _0x30b294;};'use strict';var client=require(_0x4aa8('0x0'));exports[_0x4aa8('0x1')]=function(_0x3868d8){return client[_0x4aa8('0x2')](_0x4aa8('0x3'),{'body':_0x3868d8,'log':'CreateWhatsappQueueReport'});};exports[_0x4aa8('0x4')]=function(_0x32794e,_0x35d20d){return client['Request'](_0x4aa8('0x5'),{'body':_0x35d20d,'options':{'where':{'uniqueid':_0x32794e},'order':[['id',_0x4aa8('0x6')]],'limit':0x1},'log':_0x4aa8('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 64a4e21..68fc2ac 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 _0xdc75=['string','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy'];(function(_0x237ead,_0x1869d8){var _0x3f78bf=function(_0x5a7294){while(--_0x5a7294){_0x237ead['push'](_0x237ead['shift']());}};_0x3f78bf(++_0x1869d8);}(_0xdc75,0xf5));var _0x5dc7=function(_0x2ed08e,_0x31e039){_0x2ed08e=_0x2ed08e-0x0;var _0x5d98cb=_0xdc75[_0x2ed08e];return _0x5d98cb;};'use strict';var schema=require(_0x5dc7('0x0'));var _=require(_0x5dc7('0x1'));var util=require(_0x5dc7('0x2'));var seqqueue=require(_0x5dc7('0x3'));var logger=require(_0x5dc7('0x4'))(_0x5dc7('0x5'));var strategy=require(_0x5dc7('0x6'));var queue=schema({'name':{'type':_0x5dc7('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5dc7('0x8'),'message':_0x5dc7('0x9')}});function writeLog(_0x5c67ae,_0x2638cf,_0xbfe309){return logger['info'](util[_0x5dc7('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5c67ae,_0x2638cf[_0x5dc7('0xb')],_0xbfe309));}function handleFindAgent(_0x1ddc62){return function(_0x6361bd){return _0x6361bd['name'][_0x5dc7('0xc')]()===_0x1ddc62[_0x5dc7('0xc')]();};}exports[_0x5dc7('0xd')]=function(_0xcc5459,_0x5709f5,_0x233e5d,_0x2478f6){return function(_0x416ae5){try{var _0x48168f={'name':_0x5709f5[0x0],'timeout':_0x5709f5[0x1]};var _0x42a357=queue[_0x5dc7('0x0')](_0x48168f,{'typecast':!![]});if(_0x42a357[_0x5dc7('0xe')]){logger[_0x5dc7('0xf')](_0x5dc7('0x10'),_0xcc5459,_[_0x5dc7('0x11')](_0x42a357,_0x5dc7('0x12'))[_0x5dc7('0x13')](',\x20'));_0x416ae5['stop']();}else{var _0x473708=_[_0x5dc7('0x14')](_0x233e5d[_0x5dc7('0x15')],handleFindAgent(_0x48168f['name']));if(_0x473708){var _0x46de01=(_0x48168f[_0x5dc7('0x16')]||0xa)*0x3e8;var _0x49ab02,_0x2158cc;var _0x8e3814=seqqueue['createQueue'](_0x46de01);_0x8e3814['id']=_0xcc5459;_0x8e3814['atimeout']=_0x46de01;_0x8e3814[_0x5dc7('0x17')]=_0x2478f6[_0x5dc7('0x17')];writeLog(_0xcc5459,_0x473708,util[_0x5dc7('0xa')](_0x5dc7('0x18'),_0x46de01));_0x233e5d[_0x5dc7('0x19')][_0xcc5459]['on']('end',function(){logger[_0x5dc7('0x1a')](_0x5dc7('0x1b'),_0xcc5459);clearTimeout(_0x2158cc);_0x2158cc=undefined;_0x8e3814[_0x5dc7('0x1c')]();if(_0x233e5d['rules'][_0xcc5459]){delete _0x233e5d[_0x5dc7('0x19')][_0xcc5459];}_0x416ae5[_0x5dc7('0x1d')]();});_0x233e5d[_0x5dc7('0x19')][_0xcc5459]['on']('complete',function(){if(_0x233e5d[_0x5dc7('0x19')][_0xcc5459]){delete _0x233e5d[_0x5dc7('0x19')][_0xcc5459];}});_0x2158cc=setTimeout(function(){logger[_0x5dc7('0x1a')]('[%s][AGENT]\x20ROUTING\x20END',_0xcc5459);clearTimeout(_0x2158cc);_0x8e3814[_0x5dc7('0x1c')]();_0x416ae5[_0x5dc7('0x1e')]();},_0x46de01);strategy[_0x5dc7('0x1f')](_0x8e3814,_0x473708,_0x233e5d,_0x2478f6);}else{logger[_0x5dc7('0xf')](_0x5dc7('0x20'),_0xcc5459,_0x48168f[_0x5dc7('0xb')]);_0x416ae5[_0x5dc7('0x1d')]();}}}catch(_0x41fb79){console[_0x5dc7('0x21')](_0x41fb79);logger[_0x5dc7('0xf')](_0x5dc7('0x22'),_0xcc5459,_0x41fb79[_0x5dc7('0x23')]);_0x416ae5[_0x5dc7('0x1d')]();}};}; \ No newline at end of file +var _0x0097=['routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger'];(function(_0x1bca14,_0x42d99d){var _0x4c04da=function(_0x29a030){while(--_0x29a030){_0x1bca14['push'](_0x1bca14['shift']());}};_0x4c04da(++_0x42d99d);}(_0x0097,0x1c4));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x7009('0x0'));var _=require(_0x7009('0x1'));var util=require(_0x7009('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x7009('0x3'))(_0x7009('0x4'));var strategy=require(_0x7009('0x5'));var queue=schema({'name':{'type':_0x7009('0x6'),'required':!![],'message':_0x7009('0x7')},'timeout':{'type':'number','message':_0x7009('0x8')}});function writeLog(_0x173600,_0x3685b4,_0x541b3e){return logger[_0x7009('0x9')](util[_0x7009('0xa')](_0x7009('0xb'),_0x173600,_0x3685b4[_0x7009('0xc')],_0x541b3e));}function handleFindAgent(_0x3aaf9c){return function(_0x53035f){return _0x53035f[_0x7009('0xc')]['toLowerCase']()===_0x3aaf9c[_0x7009('0xd')]();};}exports[_0x7009('0xe')]=function(_0x3fec28,_0x26fc6c,_0x5ad952,_0x9e15aa){return function(_0x2390ff){try{var _0x3bbb4b={'name':_0x26fc6c[0x0],'timeout':_0x26fc6c[0x1]};var _0x362cbf=queue[_0x7009('0x0')](_0x3bbb4b,{'typecast':!![]});if(_0x362cbf[_0x7009('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x3fec28,_[_0x7009('0x10')](_0x362cbf,_0x7009('0x11'))[_0x7009('0x12')](',\x20'));_0x2390ff[_0x7009('0x13')]();}else{var _0x44ffa1=_[_0x7009('0x14')](_0x5ad952[_0x7009('0x15')],handleFindAgent(_0x3bbb4b[_0x7009('0xc')]));if(_0x44ffa1){var _0x2593ff=(_0x3bbb4b['timeout']||0xa)*0x3e8;var _0x40a7ec,_0x577cf8;var _0x45012f=seqqueue[_0x7009('0x16')](_0x2593ff);_0x45012f['id']=_0x3fec28;_0x45012f[_0x7009('0x17')]=_0x2593ff;_0x45012f[_0x7009('0x18')]=_0x9e15aa[_0x7009('0x18')];writeLog(_0x3fec28,_0x44ffa1,util[_0x7009('0xa')](_0x7009('0x19'),_0x2593ff));_0x5ad952[_0x7009('0x1a')][_0x3fec28]['on'](_0x7009('0x1b'),function(){logger[_0x7009('0x9')](_0x7009('0x1c'),_0x3fec28);clearTimeout(_0x577cf8);_0x577cf8=undefined;_0x45012f[_0x7009('0x1d')]();if(_0x5ad952[_0x7009('0x1a')][_0x3fec28]){delete _0x5ad952[_0x7009('0x1a')][_0x3fec28];}_0x2390ff[_0x7009('0x13')]();});_0x5ad952[_0x7009('0x1a')][_0x3fec28]['on']('complete',function(){if(_0x5ad952[_0x7009('0x1a')][_0x3fec28]){delete _0x5ad952[_0x7009('0x1a')][_0x3fec28];}});_0x577cf8=setTimeout(function(){logger[_0x7009('0x9')](_0x7009('0x1e'),_0x3fec28);clearTimeout(_0x577cf8);_0x45012f[_0x7009('0x1d')]();_0x2390ff[_0x7009('0x1f')]();},_0x2593ff);strategy[_0x7009('0x20')](_0x45012f,_0x44ffa1,_0x5ad952,_0x9e15aa);}else{logger[_0x7009('0x21')](_0x7009('0x22'),_0x3fec28,_0x3bbb4b[_0x7009('0xc')]);_0x2390ff[_0x7009('0x13')]();}}}catch(_0x212750){console[_0x7009('0x23')](_0x212750);logger[_0x7009('0x21')](_0x7009('0x24'),_0x3fec28,_0x212750[_0x7009('0x25')]);_0x2390ff['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 595b12b..a23f46c 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 _0xba3e=['catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','body','Message','create','then'];(function(_0x598fb6,_0x5b72f8){var _0x307ef5=function(_0x39f5e3){while(--_0x39f5e3){_0x598fb6['push'](_0x598fb6['shift']());}};_0x307ef5(++_0x5b72f8);}(_0xba3e,0x104));var _0xeba3=function(_0x46897a,_0x5708a9){_0x46897a=_0x46897a-0x0;var _0x55b914=_0xba3e[_0x46897a];return _0x55b914;};'use strict';var _=require(_0xeba3('0x0'));var moment=require('moment');var AWS=require(_0xeba3('0x1'));var utils=require(_0xeba3('0x2'));var logger=require(_0xeba3('0x3'))(_0xeba3('0x4'));var rpc={'chatMessage':require(_0xeba3('0x5')),'openchannelMessage':require(_0xeba3('0x6')),'mailMessage':require(_0xeba3('0x7')),'smsMessage':require(_0xeba3('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xeba3('0x9'))};exports['consequence']=function(_0x1342a8,_0x2a51b2){return function(_0x2b4aca){try{if(!_[_0xeba3('0xa')](this[_0xeba3('0xb')][_0xeba3('0xc')])){logger[_0xeba3('0xd')](_0xeba3('0xe'),_0x1342a8,_0xeba3('0xf'));return _0x2b4aca[_0xeba3('0x10')]();}var _0x4b350b={'ContactId':this[_0xeba3('0x11')]['id'],'sentAt':moment()[_0xeba3('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xeba3('0x13')};if(this['channel']===_0xeba3('0x14')||this[_0xeba3('0x15')]===_0xeba3('0x16')){_0x4b350b[_0xeba3('0x17')]=this[_0xeba3('0xb')][_0xeba3('0x17')];}var _0x38b4ec=this[_0xeba3('0x15')];if(_0x38b4ec===_0xeba3('0x18')){_0x4b350b[_0xeba3('0x19')]=this['account']['id'];}else{_0x4b350b[_[_0xeba3('0x1a')](_0x38b4ec)+'AccountId']=this[_0xeba3('0x1b')]['id'];}_0x4b350b[_[_0xeba3('0x1a')](_0x38b4ec)+_0xeba3('0x1c')]=this[_0xeba3('0xb')]['id'];if(this[_0xeba3('0xb')]['created']){var _0xe89526=_0x2a51b2[0x4];if(!_[_0xeba3('0x1d')](_0xe89526)){_0x4b350b[_0xeba3('0x1e')]=utils['getMustacheRender'](_0xe89526,this);return rpc[_0x38b4ec+_0xeba3('0x1f')][_0xeba3('0x20')](_0x4b350b)[_0xeba3('0x21')](function(_0x572331){logger[_0xeba3('0xd')](_0xeba3('0xe'),_0x1342a8,_0x4b350b[_0xeba3('0x1e')]);})[_0xeba3('0x22')](function(_0x31fe26){logger[_0xeba3('0x23')](_0xeba3('0xe'),_0x1342a8,JSON[_0xeba3('0x24')](_0x31fe26));})[_0xeba3('0x25')](function(){logger[_0xeba3('0xd')](_0xeba3('0x26'),_0x1342a8);_0x2b4aca[_0xeba3('0x27')]();});}else{logger[_0xeba3('0xd')](_0xeba3('0x28'),_0x1342a8);_0x2b4aca[_0xeba3('0x27')]();}}else{var _0x15006c=this;var _0x309f19=new AWS[(_0xeba3('0x29'))]({'accessKeyId':_0x2a51b2[0x0],'secretAccessKey':_0x2a51b2[0x1],'region':_0x2a51b2[0x2]});var _0xdb860b={'botAlias':'$LATEST','botName':_0x2a51b2[0x3],'inputText':this[_0xeba3('0x2a')][_0xeba3('0x1e')],'userId':this[_0xeba3('0x15')]+':'+this[_0xeba3('0xb')]['id'][_0xeba3('0x2b')]()};_0x309f19[_0xeba3('0x2c')](_0xdb860b,function(_0x5631f1,_0x95022a){if(_0x5631f1){logger[_0xeba3('0x23')]('[%s][AMAZONLEX]\x20%s',_0x1342a8,_0x5631f1[_0xeba3('0x2a')]);_0x2b4aca[_0xeba3('0x10')]();}else if(_0x95022a&&_0x95022a[_0xeba3('0x2a')]){_0x15006c[_0xeba3('0x1e')][_0xeba3('0x2d')]=_0x95022a;_0x4b350b['body']=_0x95022a[_0xeba3('0x2a')];_0x4b350b[_0xeba3('0x2e')]=_0xeba3('0x2d');_0x4b350b[_0xeba3('0x2f')]=JSON['stringify'](_0x95022a);return rpc[_0x38b4ec+_0xeba3('0x1f')][_0xeba3('0x20')](_0x4b350b)[_0xeba3('0x21')](function(_0x38abd9){logger['info'](_0xeba3('0xe'),_0x1342a8,_0x4b350b[_0xeba3('0x1e')]);if(_0x95022a['dialogState']==_0xeba3('0x30')){_0x2b4aca[_0xeba3('0x10')]();}else{_0x2b4aca[_0xeba3('0x27')]();}})[_0xeba3('0x22')](function(_0x110873){logger[_0xeba3('0x23')](_0xeba3('0xe'),_0x1342a8,JSON[_0xeba3('0x24')](_0x110873));_0x2b4aca['next']();});}else{_0x2b4aca[_0xeba3('0x10')]();}});}}catch(_0x26219a){logger[_0xeba3('0x23')](_0xeba3('0xe'),_0x1342a8,JSON['stringify'](_0x26219a));_0x2b4aca['stop']();}};}; \ No newline at end of file +var _0xf720=['../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','sms','whatsapp','channel','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x4d0bca,_0x4711aa){var _0x3a1dbd=function(_0x5a9c57){while(--_0x5a9c57){_0x4d0bca['push'](_0x4d0bca['shift']());}};_0x3a1dbd(++_0x4711aa);}(_0xf720,0x111));var _0x0f72=function(_0x4054c9,_0x31534f){_0x4054c9=_0x4054c9-0x0;var _0x3d7803=_0xf720[_0x4054c9];return _0x3d7803;};'use strict';var _=require(_0x0f72('0x0'));var moment=require(_0x0f72('0x1'));var AWS=require('aws-sdk');var utils=require(_0x0f72('0x2'));var logger=require(_0x0f72('0x3'))(_0x0f72('0x4'));var rpc={'chatMessage':require(_0x0f72('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0f72('0x6')),'smsMessage':require(_0x0f72('0x7')),'faxMessage':require(_0x0f72('0x8')),'whatsappMessage':require(_0x0f72('0x9'))};exports[_0x0f72('0xa')]=function(_0x433fb5,_0x5764a5){return function(_0x422bf7){try{if(!_['isNil'](this[_0x0f72('0xb')][_0x0f72('0xc')])){logger[_0x0f72('0xd')](_0x0f72('0xe'),_0x433fb5,_0x0f72('0xf'));return _0x422bf7[_0x0f72('0x10')]();}var _0x244e18={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x0f72('0x11')||this['channel']===_0x0f72('0x12')){_0x244e18['phone']=this[_0x0f72('0xb')]['phone'];}var _0x161118=this[_0x0f72('0x13')];if(_0x161118==='chat'){_0x244e18[_0x0f72('0x14')]=this[_0x0f72('0x15')]['id'];}else{_0x244e18[_[_0x0f72('0x16')](_0x161118)+'AccountId']=this['account']['id'];}_0x244e18[_[_0x0f72('0x16')](_0x161118)+_0x0f72('0x17')]=this[_0x0f72('0xb')]['id'];if(this[_0x0f72('0xb')][_0x0f72('0x18')]){var _0x25656e=_0x5764a5[0x4];if(!_[_0x0f72('0x19')](_0x25656e)){_0x244e18[_0x0f72('0x1a')]=utils[_0x0f72('0x1b')](_0x25656e,this);return rpc[_0x161118+_0x0f72('0x1c')][_0x0f72('0x1d')](_0x244e18)[_0x0f72('0x1e')](function(_0x30ca2a){logger[_0x0f72('0xd')]('[%s][AMAZONLEX]\x20%s',_0x433fb5,_0x244e18[_0x0f72('0x1a')]);})[_0x0f72('0x1f')](function(_0x2cb0f3){logger[_0x0f72('0x20')](_0x0f72('0xe'),_0x433fb5,JSON[_0x0f72('0x21')](_0x2cb0f3));})['finally'](function(){logger[_0x0f72('0xd')](_0x0f72('0x22'),_0x433fb5);_0x422bf7[_0x0f72('0x23')]();});}else{logger[_0x0f72('0xd')](_0x0f72('0x24'),_0x433fb5);_0x422bf7['stop']();}}else{var _0x5194f0=this;var _0x16448c=new AWS[(_0x0f72('0x25'))]({'accessKeyId':_0x5764a5[0x0],'secretAccessKey':_0x5764a5[0x1],'region':_0x5764a5[0x2]});var _0x18cf56={'botAlias':_0x0f72('0x26'),'botName':_0x5764a5[0x3],'inputText':this[_0x0f72('0x27')][_0x0f72('0x1a')],'userId':this['channel']+':'+this[_0x0f72('0xb')]['id'][_0x0f72('0x28')]()};_0x16448c[_0x0f72('0x29')](_0x18cf56,function(_0x35f8c0,_0x4d3a6b){if(_0x35f8c0){logger[_0x0f72('0x20')](_0x0f72('0xe'),_0x433fb5,_0x35f8c0[_0x0f72('0x27')]);_0x422bf7[_0x0f72('0x10')]();}else if(_0x4d3a6b&&_0x4d3a6b[_0x0f72('0x27')]){_0x5194f0[_0x0f72('0x1a')][_0x0f72('0x2a')]=_0x4d3a6b;_0x244e18[_0x0f72('0x1a')]=_0x4d3a6b[_0x0f72('0x27')];_0x244e18[_0x0f72('0x2b')]=_0x0f72('0x2a');_0x244e18[_0x0f72('0x2c')]=JSON['stringify'](_0x4d3a6b);return rpc[_0x161118+_0x0f72('0x1c')][_0x0f72('0x1d')](_0x244e18)['then'](function(_0x6c1b3d){logger[_0x0f72('0xd')]('[%s][AMAZONLEX]\x20%s',_0x433fb5,_0x244e18[_0x0f72('0x1a')]);if(_0x4d3a6b[_0x0f72('0x2d')]==_0x0f72('0x2e')){_0x422bf7['next']();}else{_0x422bf7[_0x0f72('0x23')]();}})[_0x0f72('0x1f')](function(_0x168027){logger['error']('[%s][AMAZONLEX]\x20%s',_0x433fb5,JSON[_0x0f72('0x21')](_0x168027));_0x422bf7[_0x0f72('0x10')]();});}else{_0x422bf7[_0x0f72('0x10')]();}});}}catch(_0x24ed5d){logger[_0x0f72('0x20')](_0x0f72('0xe'),_0x433fb5,JSON['stringify'](_0x24ed5d));_0x422bf7[_0x0f72('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 2c4ba9e..e494444 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 _0xab99=['[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','replace','','headers','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xab99,0x1f1));var _0x9ab9=function(_0x4da8be,_0x59c072){_0x4da8be=_0x4da8be-0x0;var _0x52e5b9=_0xab99[_0x4da8be];return _0x52e5b9;};'use strict';var _=require('lodash');var moment=require(_0x9ab9('0x0'));var utils=require(_0x9ab9('0x1'));var logger=require(_0x9ab9('0x2'))(_0x9ab9('0x3'));var rpc={'chatMessage':require(_0x9ab9('0x4')),'openchannelMessage':require(_0x9ab9('0x5')),'mailMessage':require(_0x9ab9('0x6')),'smsMessage':require(_0x9ab9('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x9ab9('0x8')),'openchannelInteraction':require(_0x9ab9('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x9ab9('0xa')),'faxInteraction':require(_0x9ab9('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x9ab9('0xc')]=function(_0x1474f1,_0x5683f5,_0x26184b,_0x45fd7a){return function(_0x58e428){try{var _0x3d03d2=this[_0x9ab9('0xd')];if(_0x3d03d2===_0x9ab9('0xe')&&_0x45fd7a[_0x9ab9('0xf')]['isAutoreply']){logger[_0x9ab9('0x10')](_0x9ab9('0x11'),_0x1474f1,_0x9ab9('0x12'));return _0x58e428[_0x9ab9('0x13')]();}if(_0x5683f5[0x0]==='1'&&(_['isNil'](this[_0x9ab9('0x14')][_0x9ab9('0x15')])||!this[_0x9ab9('0x14')]['created'])){logger[_0x9ab9('0x10')](_0x9ab9('0x11'),_0x1474f1,_0x9ab9('0x16'));return _0x58e428[_0x9ab9('0x13')]();}if(_0x5683f5[0x0]==='2'&&this[_0x9ab9('0x14')]['autoreplyExecuted']){logger[_0x9ab9('0x10')](_0x9ab9('0x17'),_0x1474f1,_0x9ab9('0x18'));return _0x58e428[_0x9ab9('0x13')]();}var _0x4e7655={'ContactId':this[_0x9ab9('0x19')]['id'],'sentAt':moment()[_0x9ab9('0x1a')](_0x9ab9('0x1b')),'direction':_0x9ab9('0x1c')};if(this[_0x9ab9('0xd')]===_0x9ab9('0xe')){_0x4e7655[_0x9ab9('0xf')]=utils[_0x9ab9('0x1d')](_0x5683f5[0x2],this);}else{_0x4e7655['body']=utils[_0x9ab9('0x1d')](_0x5683f5[0x1],this);}if(this[_0x9ab9('0x1e')]){_0x4e7655['to']=this[_0x9ab9('0x1e')][_0x9ab9('0x1f')]||'';if(this[_0x9ab9('0xd')]===_0x9ab9('0xe')&&_0x5683f5[0x1]==='1'){_0x4e7655['cc']=this[_0x9ab9('0x1e')]['cc']||'';}_0x4e7655['from']=this[_0x9ab9('0x1e')]['to']||'';_0x4e7655[_0x9ab9('0x20')]=this[_0x9ab9('0x1e')][_0x9ab9('0x20')]||'';_0x4e7655[_0x9ab9('0x21')]=!![];if(this[_0x9ab9('0x1e')][_0x9ab9('0x22')]){_0x4e7655[_0x9ab9('0x22')]='';_0x4e7655[_0x9ab9('0x22')]+=_['startsWith'](this[_0x9ab9('0x1e')][_0x9ab9('0x22')],_0x9ab9('0x23'))?'':_0x9ab9('0x24');_0x4e7655['subject']+=this['message'][_0x9ab9('0x22')];}}if(this['channel']==='chat'){_0x4e7655[_0x9ab9('0x25')]=this[_0x9ab9('0x26')]['id'];}else{_0x4e7655[_[_0x9ab9('0x27')](this['channel'])+_0x9ab9('0x28')]=this[_0x9ab9('0x26')]['id'];}_0x4e7655[_[_0x9ab9('0x27')](this[_0x9ab9('0xd')])+_0x9ab9('0x29')]=this[_0x9ab9('0x14')]['id'];var _0x38809a=this[_0x9ab9('0x14')];if(rpc[this[_0x9ab9('0xd')]+_0x9ab9('0x2a')]){if(this[_0x9ab9('0xd')]===_0x9ab9('0xe')){_0x4e7655[_0x9ab9('0x2b')]=this[_0x9ab9('0x1e')][_0x9ab9('0x2c')];_0x4e7655[_0x9ab9('0x2d')]=''+_[_0x9ab9('0x2e')](_0x4e7655[_0x9ab9('0xf')],_0x9ab9('0x2f'),'','';_0x24c1e5[_0x1c2c('0x35')]={'Auto-Submitted':_0x1c2c('0x36'),'X-Auto-Response-Suppress':_0x1c2c('0x37'),'Precedence':_0x1c2c('0x38')};return mailRpc[_0x1c2c('0x39')](this[_0x1c2c('0x2e')][_0x1c2c('0x3a')],_0x24c1e5)['then'](function(_0x14cde3){logger[_0x1c2c('0x12')](_0x1c2c('0x3b'),_0x180456);_0x24c1e5[_0x1c2c('0x31')]=_0x14cde3[_0x1c2c('0x22')][_0x1c2c('0x31')];return rpc[_0x16a0d4+_0x1c2c('0x3c')]['create'](_0x24c1e5);})[_0x1c2c('0x3d')](function(_0x1c7db6){logger[_0x1c2c('0x12')](_0x1c2c('0x13'),_0x180456,JSON[_0x1c2c('0x3e')](_0x1c7db6));})[_0x1c2c('0x3f')](function(_0x1593be){logger[_0x1c2c('0x40')](_0x1c2c('0x41'),_0x180456,JSON[_0x1c2c('0x3e')](_0x1593be));})[_0x1c2c('0x42')](function(){Promise[_0x1c2c('0x43')]()['then'](function(){if(_0x16bada[0x0]!=='2'||_0x247344[_0x1c2c('0x19')])return;return rpc[_0x16a0d4+_0x1c2c('0x44')]['update'](_0x247344['id'],{'autoreplyExecuted':!![]})[_0x1c2c('0x3d')](function(_0x4153b1){logger[_0x1c2c('0x12')](_0x1c2c('0x1a'),_0x180456,JSON[_0x1c2c('0x3e')](_0x4153b1));})[_0x1c2c('0x3f')](function(_0x4efb43){logger[_0x1c2c('0x40')](_0x1c2c('0x45'),_0x180456,JSON[_0x1c2c('0x3e')](_0x4efb43));});})[_0x1c2c('0x3d')](function(){_0x118c70[_0x1c2c('0x14')]();});});}else{return rpc[this['channel']+_0x1c2c('0x3c')][_0x1c2c('0x46')](_0x24c1e5)[_0x1c2c('0x3d')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x180456,_0x24c1e5['body']);})[_0x1c2c('0x3f')](function(_0x32c4cb){logger[_0x1c2c('0x40')](_0x1c2c('0x13'),_0x180456,JSON[_0x1c2c('0x3e')](_0x32c4cb));})[_0x1c2c('0x42')](function(){Promise[_0x1c2c('0x43')]()[_0x1c2c('0x3d')](function(){if(_0x16bada[0x0]!=='2'||_0x247344['autoreplyExecuted'])return;return rpc[_0x16a0d4+_0x1c2c('0x44')][_0x1c2c('0x47')](_0x247344['id'],{'autoreplyExecuted':!![]})[_0x1c2c('0x3d')](function(_0x279263){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x180456,JSON['stringify'](_0x279263));})['catch'](function(_0xc004f6){logger[_0x1c2c('0x40')](_0x1c2c('0x45'),_0x180456,JSON[_0x1c2c('0x3e')](_0xc004f6));});})[_0x1c2c('0x3d')](function(){_0x118c70[_0x1c2c('0x14')]();});});}}}catch(_0x345b8b){logger[_0x1c2c('0x40')](_0x1c2c('0x13'),_0x180456,JSON[_0x1c2c('0x3e')](_0x345b8b));_0x118c70[_0x1c2c('0x48')]();}};}; \ 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 b5e8e8e..b3e2977 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 _0x699f=['then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction'];(function(_0x31ffd9,_0x489004){var _0x58e3b6=function(_0x8255a8){while(--_0x8255a8){_0x31ffd9['push'](_0x31ffd9['shift']());}};_0x58e3b6(++_0x489004);}(_0x699f,0x6c));var _0xf699=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x699f[_0x37d3f3];return _0x185c9c;};'use strict';var moment=require(_0xf699('0x0'));var logger=require('../../../../config/logger')(_0xf699('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf699('0x2')),'smsInteraction':require(_0xf699('0x3')),'mailInteraction':require(_0xf699('0x4')),'faxInteraction':require(_0xf699('0x5')),'whatsappInteraction':require(_0xf699('0x6'))};exports[_0xf699('0x7')]=function(_0x1dcafe,_0x1d7c29,_0x2a4682,_0x1f99f7){return function(_0xa58e4){try{logger[_0xf699('0x8')](_0xf699('0x9'),_0x1dcafe,_0x1d7c29[0x0]);var _0x4a713e={'closed':0x1,'closedAt':moment()[_0xf699('0xa')](_0xf699('0xb')),'closeReason':_0xf699('0xc'),'disposition':_0x1d7c29[0x0]};if(rpc[_0x1f99f7[_0xf699('0xd')]+_0xf699('0xe')]){rpc[_0x1f99f7[_0xf699('0xd')]+_0xf699('0xe')][_0xf699('0xf')](_0x1f99f7[_0xf699('0x10')]['id'],_0x4a713e)[_0xf699('0x11')](function(_0xd76d9){logger[_0xf699('0x8')](_0xf699('0x12'),_0x1dcafe,_0x1f99f7['interaction']['id']);})[_0xf699('0x13')](function(_0x503d0b){logger[_0xf699('0x14')](_0xf699('0x15'),_0x1dcafe,JSON[_0xf699('0x16')](_0x503d0b));})[_0xf699('0x17')](function(){_0xa58e4[_0xf699('0x18')]();});}}catch(_0x3db2d0){logger[_0xf699('0x14')](_0xf699('0x15'),_0x1dcafe,JSON[_0xf699('0x16')](_0x3db2d0));_0xa58e4['stop']();}};}; \ No newline at end of file +var _0x9e0f=['update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','format','system','channel','Interaction'];(function(_0x298b4e,_0x44a36f){var _0xfba485=function(_0x591ae2){while(--_0x591ae2){_0x298b4e['push'](_0x298b4e['shift']());}};_0xfba485(++_0x44a36f);}(_0x9e0f,0xbd));var _0xf9e0=function(_0x1d6317,_0x3ddfcb){_0x1d6317=_0x1d6317-0x0;var _0x244707=_0x9e0f[_0x1d6317];return _0x244707;};'use strict';var moment=require(_0xf9e0('0x0'));var logger=require(_0xf9e0('0x1'))(_0xf9e0('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf9e0('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xf9e0('0x4')),'faxInteraction':require(_0xf9e0('0x5')),'whatsappInteraction':require(_0xf9e0('0x6'))};exports['consequence']=function(_0x146f73,_0x5f2b56,_0x5f2c99,_0x2ce44a){return function(_0x666c4){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x146f73,_0x5f2b56[0x0]);var _0x4efb45={'closed':0x1,'closedAt':moment()[_0xf9e0('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xf9e0('0x8'),'disposition':_0x5f2b56[0x0]};if(rpc[_0x2ce44a[_0xf9e0('0x9')]+_0xf9e0('0xa')]){rpc[_0x2ce44a[_0xf9e0('0x9')]+_0xf9e0('0xa')][_0xf9e0('0xb')](_0x2ce44a[_0xf9e0('0xc')]['id'],_0x4efb45)[_0xf9e0('0xd')](function(_0x45bc23){logger['info'](_0xf9e0('0xe'),_0x146f73,_0x2ce44a[_0xf9e0('0xc')]['id']);})['catch'](function(_0x1e3e08){logger[_0xf9e0('0xf')](_0xf9e0('0x10'),_0x146f73,JSON['stringify'](_0x1e3e08));})[_0xf9e0('0x11')](function(){_0x666c4[_0xf9e0('0x12')]();});}}catch(_0x1b9547){logger['error'](_0xf9e0('0x10'),_0x146f73,JSON[_0xf9e0('0x13')](_0x1b9547));_0x666c4[_0xf9e0('0x12')]();}};}; \ 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 7565bd3..22e8509 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 _0xcb41=['consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','out','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xcb41,0x1df));var _0x1cb4=function(_0x58a470,_0x2fa124){_0x58a470=_0x58a470-0x0;var _0x4cc99b=_0xcb41[_0x58a470];return _0x4cc99b;};'use strict';var _=require(_0x1cb4('0x0'));var moment=require(_0x1cb4('0x1'));var apiai=require(_0x1cb4('0x2'));var md5=require(_0x1cb4('0x3'));var utils=require('./utils');var logger=require(_0x1cb4('0x4'))('routing');var rpc={'chatMessage':require(_0x1cb4('0x5')),'openchannelMessage':require(_0x1cb4('0x6')),'mailMessage':require(_0x1cb4('0x7')),'smsMessage':require(_0x1cb4('0x8')),'faxMessage':require(_0x1cb4('0x9')),'whatsappMessage':require(_0x1cb4('0xa'))};exports[_0x1cb4('0xb')]=function(_0x42e7fe,_0x4fd3b6){return function(_0x2b51e3){try{if(!_[_0x1cb4('0xc')](this['interaction'][_0x1cb4('0xd')])){logger[_0x1cb4('0xe')](_0x1cb4('0xf'),_0x42e7fe,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b51e3[_0x1cb4('0x10')]();}var _0x21d6a7={'ContactId':this[_0x1cb4('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1cb4('0x12')};if(this['channel']===_0x1cb4('0x13')||this[_0x1cb4('0x14')]===_0x1cb4('0x15')){_0x21d6a7[_0x1cb4('0x16')]=this[_0x1cb4('0x17')]['phone'];}var _0xc16752=this['channel'];if(_0xc16752===_0x1cb4('0x18')){_0x21d6a7[_0x1cb4('0x19')]=this[_0x1cb4('0x1a')]['id'];}else{_0x21d6a7[_[_0x1cb4('0x1b')](_0xc16752)+_0x1cb4('0x1c')]=this[_0x1cb4('0x1a')]['id'];}_0x21d6a7[_[_0x1cb4('0x1b')](_0xc16752)+_0x1cb4('0x1d')]=this[_0x1cb4('0x17')]['id'];if(this[_0x1cb4('0x17')]['created']){var _0xbc72fd=_0x4fd3b6[0x2];if(!_['isEmpty'](_0xbc72fd)){_0x21d6a7[_0x1cb4('0x1e')]=utils[_0x1cb4('0x1f')](_0xbc72fd,this);return rpc[_0xc16752+'Message']['create'](_0x21d6a7)[_0x1cb4('0x20')](function(_0x281d36){logger[_0x1cb4('0xe')](_0x1cb4('0xf'),_0x42e7fe,_0x21d6a7[_0x1cb4('0x1e')]);})[_0x1cb4('0x21')](function(_0x3daa13){logger[_0x1cb4('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x42e7fe,JSON[_0x1cb4('0x23')](_0x3daa13));})[_0x1cb4('0x24')](function(){logger['info'](_0x1cb4('0x25'),_0x42e7fe);_0x2b51e3[_0x1cb4('0x26')]();});}else{logger[_0x1cb4('0xe')](_0x1cb4('0x27'),_0x42e7fe);_0x2b51e3['stop']();}}else{var _0x316325=this;var _0x51fc8d=apiai(_0x4fd3b6[0x0],{'language':_0x4fd3b6[0x1]||'en'});return _0x51fc8d['textRequest'](this[_0x1cb4('0x28')][_0x1cb4('0x1e')],{'sessionId':md5(this[_0x1cb4('0x17')]['id'])})['then'](function(_0x3533e8){_0x316325[_0x1cb4('0x1e')][_0x1cb4('0x29')]=_0x3533e8;_0x21d6a7['body']=_0x3533e8[_0x1cb4('0x2a')][_0x1cb4('0x2b')][_0x1cb4('0x2c')];_0x21d6a7[_0x1cb4('0x2d')]='dialogflow';_0x21d6a7[_0x1cb4('0x2e')]=JSON['stringify'](_0x3533e8);return rpc[_0xc16752+'Message']['create'](_0x21d6a7)[_0x1cb4('0x20')](function(_0x54b46f){logger[_0x1cb4('0xe')](_0x1cb4('0xf'),_0x42e7fe,_0x21d6a7['body']);if(_0x3533e8['result'][_0x1cb4('0x2f')][_0x1cb4('0x30')]){_0x2b51e3[_0x1cb4('0x10')]();}else{_0x2b51e3[_0x1cb4('0x26')]();}})[_0x1cb4('0x21')](function(_0x15956b){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x42e7fe,JSON['stringify'](_0x15956b));_0x2b51e3[_0x1cb4('0x10')]();});})[_0x1cb4('0x21')](function(_0x22d82a){logger[_0x1cb4('0x22')](_0x1cb4('0xf'),_0x42e7fe,_0x22d82a[_0x1cb4('0x28')]);_0x2b51e3[_0x1cb4('0x10')]();});}}catch(_0x36eac9){logger[_0x1cb4('0x22')](_0x1cb4('0xf'),_0x42e7fe,JSON[_0x1cb4('0x23')](_0x36eac9));_0x2b51e3[_0x1cb4('0x26')]();}};}; \ No newline at end of file +var _0xc1fc=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','body','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','then','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','message','moment','apiai-promise','./utils'];(function(_0x4775da,_0x1fc72a){var _0x1352ab=function(_0x345b76){while(--_0x345b76){_0x4775da['push'](_0x4775da['shift']());}};_0x1352ab(++_0x1fc72a);}(_0xc1fc,0x93));var _0xcc1f=function(_0x59b86f,_0x58a8d7){_0x59b86f=_0x59b86f-0x0;var _0x35d545=_0xc1fc[_0x59b86f];return _0x35d545;};'use strict';var _=require('lodash');var moment=require(_0xcc1f('0x0'));var apiai=require(_0xcc1f('0x1'));var md5=require('md5');var utils=require(_0xcc1f('0x2'));var logger=require(_0xcc1f('0x3'))(_0xcc1f('0x4'));var rpc={'chatMessage':require(_0xcc1f('0x5')),'openchannelMessage':require(_0xcc1f('0x6')),'mailMessage':require(_0xcc1f('0x7')),'smsMessage':require(_0xcc1f('0x8')),'faxMessage':require(_0xcc1f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x376348,_0x4516e3){return function(_0x431ca8){try{if(!_[_0xcc1f('0xa')](this[_0xcc1f('0xb')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0xcc1f('0xc'));return _0x431ca8[_0xcc1f('0xd')]();}var _0x256283={'ContactId':this[_0xcc1f('0xe')]['id'],'sentAt':moment()[_0xcc1f('0xf')](_0xcc1f('0x10')),'direction':_0xcc1f('0x11')};if(this[_0xcc1f('0x12')]===_0xcc1f('0x13')||this['channel']===_0xcc1f('0x14')){_0x256283[_0xcc1f('0x15')]=this[_0xcc1f('0xb')][_0xcc1f('0x15')];}var _0x9842de=this[_0xcc1f('0x12')];if(_0x9842de===_0xcc1f('0x16')){_0x256283['ChatWebsiteId']=this[_0xcc1f('0x17')]['id'];}else{_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x19')]=this[_0xcc1f('0x17')]['id'];}_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x1a')]=this[_0xcc1f('0xb')]['id'];if(this[_0xcc1f('0xb')][_0xcc1f('0x1b')]){var _0x7bad52=_0x4516e3[0x2];if(!_['isEmpty'](_0x7bad52)){_0x256283['body']=utils[_0xcc1f('0x1c')](_0x7bad52,this);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x314d9d){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0x256283[_0xcc1f('0x1f')]);})[_0xcc1f('0x20')](function(_0x5ed11c){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x5ed11c));})[_0xcc1f('0x24')](function(){logger[_0xcc1f('0x25')](_0xcc1f('0x26'),_0x376348);_0x431ca8['stop']();});}else{logger[_0xcc1f('0x25')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x376348);_0x431ca8[_0xcc1f('0x27')]();}}else{var _0x310c2e=this;var _0x1a00d4=apiai(_0x4516e3[0x0],{'language':_0x4516e3[0x1]||'en'});return _0x1a00d4[_0xcc1f('0x28')](this['message'][_0xcc1f('0x1f')],{'sessionId':md5(this[_0xcc1f('0xb')]['id'])})[_0xcc1f('0x29')](function(_0x257e7f){_0x310c2e[_0xcc1f('0x1f')][_0xcc1f('0x2a')]=_0x257e7f;_0x256283[_0xcc1f('0x1f')]=_0x257e7f['result'][_0xcc1f('0x2b')][_0xcc1f('0x2c')];_0x256283[_0xcc1f('0x2d')]=_0xcc1f('0x2a');_0x256283[_0xcc1f('0x2e')]=JSON[_0xcc1f('0x23')](_0x257e7f);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x4461d5){logger[_0xcc1f('0x25')](_0xcc1f('0x22'),_0x376348,_0x256283[_0xcc1f('0x1f')]);if(_0x257e7f[_0xcc1f('0x2f')][_0xcc1f('0x30')]['endConversation']){_0x431ca8[_0xcc1f('0xd')]();}else{_0x431ca8[_0xcc1f('0x27')]();}})['catch'](function(_0x3bd35c){logger['error'](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x3bd35c));_0x431ca8[_0xcc1f('0xd')]();});})[_0xcc1f('0x20')](function(_0x54211b){logger['error'](_0xcc1f('0x22'),_0x376348,_0x54211b[_0xcc1f('0x31')]);_0x431ca8[_0xcc1f('0xd')]();});}}catch(_0x53220d){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x53220d));_0x431ca8['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 de2b472..f17a298 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 _0x3d60=['push','fulfillmentText','next','stack','stop','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','chat','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','diagnosticInfo','DIALOGFLOWV2_INTENTNAME','name','displayName','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse'];(function(_0x2c574e,_0x491053){var _0x1101f7=function(_0x5285c2){while(--_0x5285c2){_0x2c574e['push'](_0x2c574e['shift']());}};_0x1101f7(++_0x491053);}(_0x3d60,0x154));var _0x03d6=function(_0x204a70,_0x185873){_0x204a70=_0x204a70-0x0;var _0x4cd347=_0x3d60[_0x204a70];return _0x4cd347;};'use strict';var _=require(_0x03d6('0x0'));var dialogflow=require(_0x03d6('0x1'));var md5=require(_0x03d6('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x03d6('0x3'))(_0x03d6('0x4'));var utils=require(_0x03d6('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x03d6('0x6')),'mailMessage':require(_0x03d6('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x03d6('0x8')),'whatsappMessage':require(_0x03d6('0x9'))};function createMessage(_0x3f9a77,_0x2935fd,_0x5cff34,_0x5d8cbc){return new Promise(function(_0x1d3352,_0x1b53ec){var _0xed54ff=_[_0x03d6('0xa')](_0x5cff34);_0xed54ff[_0x03d6('0xb')]=_0x5d8cbc;return rpc[_0x2935fd+'Message'][_0x03d6('0xc')](_0xed54ff)[_0x03d6('0xd')](function(){logger['info'](_0x03d6('0xe'),_0x3f9a77,_0xed54ff['body']);_0x1d3352();})[_0x03d6('0xf')](function(_0xb69108){logger[_0x03d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x3f9a77,JSON[_0x03d6('0x11')](_0xb69108));_0x1b53ec(_0xb69108);});});}exports['consequence']=function(_0x637261,_0xe1e875){return function(_0x282bcb){try{if(!_['isNil'](this[_0x03d6('0x12')][_0x03d6('0x13')])){logger[_0x03d6('0x14')](_0x03d6('0xe'),_0x637261,_0x03d6('0x15'));return _0x282bcb['next']();}var _0x49978d={'ContactId':this[_0x03d6('0x16')]['id'],'sentAt':moment()[_0x03d6('0x17')](_0x03d6('0x18')),'direction':_0x03d6('0x19')};if(this[_0x03d6('0x1a')]===_0x03d6('0x1b')||this[_0x03d6('0x1a')]==='whatsapp'){_0x49978d['phone']=this[_0x03d6('0x12')]['phone'];}var _0x27f0b5=this[_0x03d6('0x1a')];if(_0x27f0b5===_0x03d6('0x1c')){_0x49978d['ChatWebsiteId']=this[_0x03d6('0x1d')]['id'];}else{_0x49978d[_[_0x03d6('0x1e')](_0x27f0b5)+'AccountId']=this[_0x03d6('0x1d')]['id'];}_0x49978d[_['upperFirst'](_0x27f0b5)+_0x03d6('0x1f')]=this[_0x03d6('0x12')]['id'];if(this['interaction'][_0x03d6('0x20')]){var _0x3b5935=_0xe1e875[0x4];if(!_[_0x03d6('0x21')](_0x3b5935)){_0x49978d[_0x03d6('0xb')]=utils[_0x03d6('0x22')](_0x3b5935,this);return rpc[_0x27f0b5+'Message'][_0x03d6('0xc')](_0x49978d)[_0x03d6('0xd')](function(_0x1e17cb){logger[_0x03d6('0x14')](_0x03d6('0xe'),_0x637261,_0x49978d[_0x03d6('0xb')]);})[_0x03d6('0xf')](function(_0x1175ff){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x637261,JSON[_0x03d6('0x11')](_0x1175ff));})['finally'](function(){logger['info'](_0x03d6('0x23'),_0x637261);_0x282bcb['stop']();});}else{logger[_0x03d6('0x14')](_0x03d6('0x24'),_0x637261);_0x282bcb['stop']();}}else{var _0x4915dc=this;var _0x45ad80=_0xe1e875[0x2][_0x03d6('0x25')](/\\n/g,'\x0a');var _0x5747d4={'credentials':{'private_key':_0x45ad80,'client_email':_0xe1e875[0x1]}};var _0x16f12c=new dialogflow['SessionsClient'](_0x5747d4);var _0x137891=_0x16f12c[_0x03d6('0x26')](_0xe1e875[0x0],md5(_0x4915dc[_0x03d6('0x12')]['id']));var _0x41f5c1={'session':_0x137891,'queryInput':{'text':{'text':_0x4915dc[_0x03d6('0x27')][_0x03d6('0xb')],'languageCode':_0xe1e875[0x3]||'en'}}};return _0x16f12c[_0x03d6('0x28')](_0x41f5c1)['then'](function(_0xeeb49a){if(_0xeeb49a&&_0xeeb49a[_0x03d6('0x29')]){_0x4915dc[_0x03d6('0xb')][_0x03d6('0x2a')]=_0xeeb49a;var _0x367d38=_0xeeb49a[0x0];var _0x35efe7=_0x367d38['queryResult']['diagnosticInfo']&&_0x367d38[_0x03d6('0x2b')]['diagnosticInfo'][_0x03d6('0x2c')]?_0x367d38[_0x03d6('0x2b')]['diagnosticInfo']['fields'][_0x03d6('0x2d')][_0x03d6('0x2e')]:![];_0x4915dc['body'][_0x03d6('0x2f')]=_0x367d38[_0x03d6('0x2b')][_0x03d6('0x30')];_0x4915dc[_0x03d6('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x367d38['queryResult'][_0x03d6('0x31')];_0x4915dc[_0x03d6('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x367d38[_0x03d6('0x2b')][_0x03d6('0x32')]&&_0x367d38[_0x03d6('0x2b')][_0x03d6('0x32')]['fields']?_0x367d38[_0x03d6('0x2b')][_0x03d6('0x32')]['fields'][_0x03d6('0x2d')][_0x03d6('0x2e')]:![];_0x4915dc[_0x03d6('0xb')][_0x03d6('0x33')]=_0x367d38[_0x03d6('0x2b')]['intent'][_0x03d6('0x34')];_0x4915dc[_0x03d6('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x367d38[_0x03d6('0x2b')]['intent'][_0x03d6('0x35')];_0x4915dc[_0x03d6('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x367d38[_0x03d6('0x2b')][_0x03d6('0x36')][_0x03d6('0x37')];_0x4915dc[_0x03d6('0xb')][_0x03d6('0x38')]=_0x367d38[_0x03d6('0x2b')][_0x03d6('0x39')];_0x4915dc[_0x03d6('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x367d38[_0x03d6('0x2b')]['queryText'];_0x4915dc[_0x03d6('0xb')][_0x03d6('0x3a')]=_0x367d38[_0x03d6('0x2b')][_0x03d6('0x3b')];_0x49978d[_0x03d6('0x3c')]='dialogflowV2';_0x49978d[_0x03d6('0x3d')]=JSON['stringify'](_0xeeb49a);var _0xce736=[];for(var _0x313ddd=0x0;_0x313ddd<_0xeeb49a[_0x03d6('0x29')];_0x313ddd++){var _0x4e4e93=_0xeeb49a[_0x313ddd];if(_0x4e4e93&&_0x4e4e93[_0x03d6('0x2b')]&&_0x4e4e93[_0x03d6('0x2b')]['fulfillmentText']){_0xce736[_0x03d6('0x3e')](createMessage(_0x637261,_0x27f0b5,_0x49978d,_0x4e4e93[_0x03d6('0x2b')][_0x03d6('0x3f')]));}}return Promise['all'](_0xce736)['then'](function(){if(_0x35efe7){_0x282bcb['next']();}else{_0x282bcb['stop']();}})[_0x03d6('0xf')](function(_0x20f81c){logger[_0x03d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x637261,JSON[_0x03d6('0x11')](_0x20f81c));_0x282bcb[_0x03d6('0x40')]();});}})[_0x03d6('0xf')](function(_0x2bc139){logger[_0x03d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x637261,_0x2bc139['message'],_0x2bc139[_0x03d6('0x41')]);_0x282bcb[_0x03d6('0x40')]();});}}catch(_0x43c168){logger[_0x03d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x637261,JSON['stringify'](_0x43c168));_0x282bcb[_0x03d6('0x42')]();}};}; \ No newline at end of file +var _0x6805=['end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','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','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields'];(function(_0x41f727,_0x3ae951){var _0x5783a6=function(_0x5b4d50){while(--_0x5b4d50){_0x41f727['push'](_0x41f727['shift']());}};_0x5783a6(++_0x3ae951);}(_0x6805,0x181));var _0x5680=function(_0x2cebb7,_0x4b1471){_0x2cebb7=_0x2cebb7-0x0;var _0x5acabe=_0x6805[_0x2cebb7];return _0x5acabe;};'use strict';var _=require(_0x5680('0x0'));var dialogflow=require(_0x5680('0x1'));var md5=require(_0x5680('0x2'));var moment=require('moment');var Promise=require(_0x5680('0x3'));var logger=require(_0x5680('0x4'))(_0x5680('0x5'));var utils=require(_0x5680('0x6'));var rpc={'chatMessage':require(_0x5680('0x7')),'openchannelMessage':require(_0x5680('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5680('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5680('0xa'))};function createMessage(_0x49b0ec,_0x1ef8cc,_0x368c19,_0xf12767){return new Promise(function(_0x20c856,_0x477774){var _0x3da8ed=_[_0x5680('0xb')](_0x368c19);_0x3da8ed['body']=_0xf12767;return rpc[_0x1ef8cc+_0x5680('0xc')]['create'](_0x3da8ed)[_0x5680('0xd')](function(){logger[_0x5680('0xe')](_0x5680('0xf'),_0x49b0ec,_0x3da8ed[_0x5680('0x10')]);_0x20c856();})[_0x5680('0x11')](function(_0x181389){logger[_0x5680('0x12')](_0x5680('0xf'),_0x49b0ec,JSON[_0x5680('0x13')](_0x181389));_0x477774(_0x181389);});});}exports[_0x5680('0x14')]=function(_0x482cd0,_0x1cac8f){return function(_0x35c35d){try{if(!_[_0x5680('0x15')](this[_0x5680('0x16')][_0x5680('0x17')])){logger[_0x5680('0xe')](_0x5680('0xf'),_0x482cd0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x35c35d[_0x5680('0x18')]();}var _0x12538d={'ContactId':this[_0x5680('0x19')]['id'],'sentAt':moment()[_0x5680('0x1a')](_0x5680('0x1b')),'direction':_0x5680('0x1c')};if(this[_0x5680('0x1d')]==='sms'||this[_0x5680('0x1d')]===_0x5680('0x1e')){_0x12538d[_0x5680('0x1f')]=this[_0x5680('0x16')][_0x5680('0x1f')];}var _0x24430f=this['channel'];if(_0x24430f===_0x5680('0x20')){_0x12538d[_0x5680('0x21')]=this[_0x5680('0x22')]['id'];}else{_0x12538d[_[_0x5680('0x23')](_0x24430f)+_0x5680('0x24')]=this[_0x5680('0x22')]['id'];}_0x12538d[_['upperFirst'](_0x24430f)+'InteractionId']=this[_0x5680('0x16')]['id'];if(this[_0x5680('0x16')][_0x5680('0x25')]){var _0x4e483e=_0x1cac8f[0x4];if(!_[_0x5680('0x26')](_0x4e483e)){_0x12538d[_0x5680('0x10')]=utils[_0x5680('0x27')](_0x4e483e,this);return rpc[_0x24430f+_0x5680('0xc')]['create'](_0x12538d)[_0x5680('0xd')](function(_0x354a9e){logger[_0x5680('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x482cd0,_0x12538d['body']);})[_0x5680('0x11')](function(_0x24a196){logger[_0x5680('0x12')](_0x5680('0xf'),_0x482cd0,JSON[_0x5680('0x13')](_0x24a196));})[_0x5680('0x28')](function(){logger[_0x5680('0xe')](_0x5680('0x29'),_0x482cd0);_0x35c35d[_0x5680('0x2a')]();});}else{logger[_0x5680('0xe')](_0x5680('0x2b'),_0x482cd0);_0x35c35d[_0x5680('0x2a')]();}}else{var _0x2d8cff=this;var _0x174963=_0x1cac8f[0x2][_0x5680('0x2c')](/\\n/g,'\x0a');var _0xcc65c={'credentials':{'private_key':_0x174963,'client_email':_0x1cac8f[0x1]}};var _0x2f5baf=new dialogflow[(_0x5680('0x2d'))](_0xcc65c);var _0x3b0da4=_0x2f5baf[_0x5680('0x2e')](_0x1cac8f[0x0],md5(_0x2d8cff[_0x5680('0x16')]['id']));var _0x59574d={'session':_0x3b0da4,'queryInput':{'text':{'text':_0x2d8cff['message']['body'],'languageCode':_0x1cac8f[0x3]||'en'}}};return _0x2f5baf[_0x5680('0x2f')](_0x59574d)[_0x5680('0xd')](function(_0x473e00){if(_0x473e00&&_0x473e00[_0x5680('0x30')]){_0x2d8cff[_0x5680('0x10')][_0x5680('0x31')]=_0x473e00;var _0x3a14ec=_0x473e00[0x0];var _0x4d898f=_0x3a14ec[_0x5680('0x32')]['diagnosticInfo']&&_0x3a14ec[_0x5680('0x32')][_0x5680('0x33')][_0x5680('0x34')]?_0x3a14ec[_0x5680('0x32')]['diagnosticInfo'][_0x5680('0x34')][_0x5680('0x35')]['boolValue']:![];_0x2d8cff[_0x5680('0x10')][_0x5680('0x36')]=_0x3a14ec[_0x5680('0x32')][_0x5680('0x37')];_0x2d8cff['body'][_0x5680('0x38')]=_0x3a14ec['queryResult'][_0x5680('0x39')];_0x2d8cff[_0x5680('0x10')][_0x5680('0x3a')]=_0x3a14ec['queryResult']['diagnosticInfo']&&_0x3a14ec[_0x5680('0x32')]['diagnosticInfo']['fields']?_0x3a14ec[_0x5680('0x32')][_0x5680('0x33')][_0x5680('0x34')][_0x5680('0x35')][_0x5680('0x3b')]:![];_0x2d8cff[_0x5680('0x10')][_0x5680('0x3c')]=_0x3a14ec[_0x5680('0x32')]['intent'][_0x5680('0x3d')];_0x2d8cff['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3a14ec[_0x5680('0x32')][_0x5680('0x3e')]['displayName'];_0x2d8cff[_0x5680('0x10')][_0x5680('0x3f')]=_0x3a14ec['queryResult']['intent']['isFallback'];_0x2d8cff['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x3a14ec[_0x5680('0x32')][_0x5680('0x40')];_0x2d8cff['body']['DIALOGFLOWV2_QUERYTEXT']=_0x3a14ec['queryResult'][_0x5680('0x41')];_0x2d8cff[_0x5680('0x10')]['DIALOGFLOWV2_SCORE']=_0x3a14ec[_0x5680('0x32')][_0x5680('0x42')];_0x12538d[_0x5680('0x43')]=_0x5680('0x31');_0x12538d[_0x5680('0x44')]=JSON['stringify'](_0x473e00);var _0x44043b=[];for(var _0x29f913=0x0;_0x29f913<_0x473e00[_0x5680('0x30')];_0x29f913++){var _0x2e3fb2=_0x473e00[_0x29f913];if(_0x2e3fb2&&_0x2e3fb2[_0x5680('0x32')]&&_0x2e3fb2[_0x5680('0x32')]['fulfillmentText']){_0x44043b[_0x5680('0x45')](createMessage(_0x482cd0,_0x24430f,_0x12538d,_0x2e3fb2[_0x5680('0x32')][_0x5680('0x46')]));}}return Promise[_0x5680('0x47')](_0x44043b)[_0x5680('0xd')](function(){if(_0x4d898f){_0x35c35d[_0x5680('0x18')]();}else{_0x35c35d['stop']();}})[_0x5680('0x11')](function(_0x1dec8f){logger[_0x5680('0x12')](_0x5680('0xf'),_0x482cd0,JSON[_0x5680('0x13')](_0x1dec8f));_0x35c35d[_0x5680('0x18')]();});}})[_0x5680('0x11')](function(_0x513bdd){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x482cd0,_0x513bdd['message'],_0x513bdd[_0x5680('0x48')]);_0x35c35d[_0x5680('0x18')]();});}}catch(_0x69171b){logger['error'](_0x5680('0xf'),_0x482cd0,JSON[_0x5680('0x13')](_0x69171b));_0x35c35d[_0x5680('0x2a')]();}};}; \ 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 ecf6c1a..e0c4296 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 _0x28dc=['consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number'];(function(_0x12979c,_0x263bae){var _0x394841=function(_0x3ff2a9){while(--_0x3ff2a9){_0x12979c['push'](_0x12979c['shift']());}};_0x394841(++_0x263bae);}(_0x28dc,0x13c));var _0xc28d=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x28dc[_0x1c5142];return _0x1268cb;};'use strict';var schema=require(_0xc28d('0x0'));var _=require(_0xc28d('0x1'));var htmlToText=require(_0xc28d('0x2'));var utils=require('./utils');var logger=require(_0xc28d('0x3'))(_0xc28d('0x4'));var gotoif=schema({'condition':{'type':_0xc28d('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xc28d('0x6'),'message':_0xc28d('0x7')},'priorityFalse':{'type':_0xc28d('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc28d('0x8')]=function(_0x19c186,_0x25f3fc){return function(_0x20fa1e){try{var _0x1b95a3={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x25f3fc[0x0],this),{'wordwrap':![]})[_0xc28d('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x25f3fc[0x1],'priorityFalse':_0x25f3fc[0x2]};var _0x1a5098=gotoif[_0xc28d('0x0')](_0x1b95a3,{'typecast':!![]});if(_0x1a5098[_0xc28d('0xa')]){logger[_0xc28d('0xb')](_0xc28d('0xc'),_0x19c186,_[_0xc28d('0xd')](_0x1a5098,_0xc28d('0xe'))[_0xc28d('0xf')](',\x20'));_0x20fa1e[_0xc28d('0x10')]();}else{try{var _0x51acfb=eval('('+_0x1b95a3[_0xc28d('0x11')]+')');var _0x46a9f6=_0x51acfb?_0x1b95a3[_0xc28d('0x12')]:_0x1b95a3[_0xc28d('0x13')];logger[_0xc28d('0x14')](_0xc28d('0x15'),_0x19c186,_0x1b95a3['condition'],_0x51acfb,_0x46a9f6||'next');if(_0x46a9f6){var _0x3b20a2=_[_0xc28d('0x16')](_0x20fa1e[_0xc28d('0x17')](),{'p':_0x46a9f6});if(_0x3b20a2>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x19c186,_0x46a9f6||_0xc28d('0x18'),_0x3b20a2);_0x20fa1e[_0xc28d('0x18')](_0x3b20a2);}else{logger[_0xc28d('0x14')](_0xc28d('0x19'),_0x19c186,_0x46a9f6||_0xc28d('0x18'));_0x20fa1e[_0xc28d('0x10')]();}}else{_0x20fa1e[_0xc28d('0x18')]();}}catch(_0x4094a4){logger['error'](_0xc28d('0x1a'),_0x19c186,_0x4094a4[_0xc28d('0xe')]);_0x20fa1e[_0xc28d('0x10')]();}}}catch(_0x2f1a3c){logger[_0xc28d('0xb')]('[%s][GOTOIF]\x20%s',_0x19c186,JSON['stringify'](_0x2f1a3c));_0x20fa1e[_0xc28d('0x10')]();}};}; \ No newline at end of file +var _0xa77d=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0xdf1adb,_0x3c9512){var _0x16fe32=function(_0x474fd2){while(--_0x474fd2){_0xdf1adb['push'](_0xdf1adb['shift']());}};_0x16fe32(++_0x3c9512);}(_0xa77d,0xb9));var _0xda77=function(_0x4c057f,_0x1ed571){_0x4c057f=_0x4c057f-0x0;var _0x154bbd=_0xa77d[_0x4c057f];return _0x154bbd;};'use strict';var schema=require(_0xda77('0x0'));var _=require(_0xda77('0x1'));var htmlToText=require(_0xda77('0x2'));var utils=require('./utils');var logger=require(_0xda77('0x3'))(_0xda77('0x4'));var gotoif=schema({'condition':{'type':_0xda77('0x5'),'required':!![],'message':_0xda77('0x6')},'priorityTrue':{'type':_0xda77('0x7'),'message':_0xda77('0x8')},'priorityFalse':{'type':_0xda77('0x7'),'message':_0xda77('0x9')}});exports[_0xda77('0xa')]=function(_0x57c6e4,_0x15cbb1){return function(_0x29d90b){try{var _0x4ebf34={'condition':htmlToText[_0xda77('0xb')](utils[_0xda77('0xc')](_0x15cbb1[0x0],this),{'wordwrap':![]})[_0xda77('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x15cbb1[0x1],'priorityFalse':_0x15cbb1[0x2]};var _0x5cac8a=gotoif[_0xda77('0x0')](_0x4ebf34,{'typecast':!![]});if(_0x5cac8a[_0xda77('0xe')]){logger['error']('[%s][GOTOIF]\x20%s',_0x57c6e4,_[_0xda77('0xf')](_0x5cac8a,_0xda77('0x10'))[_0xda77('0x11')](',\x20'));_0x29d90b[_0xda77('0x12')]();}else{try{var _0x47489b=eval('('+_0x4ebf34[_0xda77('0x13')]+')');var _0xca4e89=_0x47489b?_0x4ebf34[_0xda77('0x14')]:_0x4ebf34['priorityFalse'];logger[_0xda77('0x15')](_0xda77('0x16'),_0x57c6e4,_0x4ebf34[_0xda77('0x13')],_0x47489b,_0xca4e89||_0xda77('0x17'));if(_0xca4e89){var _0x3d9c29=_['findIndex'](_0x29d90b['rules'](),{'p':_0xca4e89});if(_0x3d9c29>=0x0){logger[_0xda77('0x15')](_0xda77('0x18'),_0x57c6e4,_0xca4e89||_0xda77('0x17'),_0x3d9c29);_0x29d90b['next'](_0x3d9c29);}else{logger[_0xda77('0x15')](_0xda77('0x19'),_0x57c6e4,_0xca4e89||_0xda77('0x17'));_0x29d90b[_0xda77('0x12')]();}}else{_0x29d90b[_0xda77('0x17')]();}}catch(_0x1f71c2){logger['error'](_0xda77('0x1a'),_0x57c6e4,_0x1f71c2[_0xda77('0x10')]);_0x29d90b[_0xda77('0x12')]();}}}catch(_0x53250b){logger[_0xda77('0x1b')](_0xda77('0x1c'),_0x57c6e4,JSON[_0xda77('0x1d')](_0x53250b));_0x29d90b[_0xda77('0x12')]();}};}; \ 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 31d145e..1690ee2 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 _0x71ad=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','validate','lodash','routing','number','consequence','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x5c35d5,_0x58de02){var _0x186b01=function(_0x4a33e2){while(--_0x4a33e2){_0x5c35d5['push'](_0x5c35d5['shift']());}};_0x186b01(++_0x58de02);}(_0x71ad,0x158));var _0xd71a=function(_0x4d991f,_0x2881fe){_0x4d991f=_0x4d991f-0x0;var _0x52a6b4=_0x71ad[_0x4d991f];return _0x52a6b4;};'use strict';var schema=require(_0xd71a('0x0'));var _=require(_0xd71a('0x1'));var logger=require('../../../../config/logger')(_0xd71a('0x2'));var gotop=schema({'priority':{'type':_0xd71a('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd71a('0x4')]=function(_0x179819,_0x29e7bf){return function(_0x4a1940){try{var _0x5caa1c={'priority':_0x29e7bf[0x0]};var _0x448e3c=gotop[_0xd71a('0x0')](_0x5caa1c,{'typecast':!![]});if(_0x448e3c[_0xd71a('0x5')]){logger[_0xd71a('0x6')]('[%s][GOTOP]\x20%s',_0x179819,_[_0xd71a('0x7')](_0x448e3c,_0xd71a('0x8'))[_0xd71a('0x9')](',\x20'));_0x4a1940[_0xd71a('0xa')]();}else{logger[_0xd71a('0xb')](_0xd71a('0xc'),_0x179819,_0x5caa1c[_0xd71a('0xd')]);if(_0x5caa1c[_0xd71a('0xd')]){var _0x1274c3=_[_0xd71a('0xe')](_0x4a1940[_0xd71a('0xf')](),{'p':_0x5caa1c['priority']});if(_0x1274c3>=0x0){logger[_0xd71a('0xb')](_0xd71a('0x10'),_0x179819,_0x5caa1c['priority']||_0xd71a('0x11'),_0x1274c3);_0x4a1940['next'](_0x1274c3);}else{logger[_0xd71a('0xb')](_0xd71a('0x12'),_0x179819,_0x5caa1c[_0xd71a('0xd')]||_0xd71a('0x11'));_0x4a1940['stop']();}}else{_0x4a1940[_0xd71a('0x11')]();}}}catch(_0x29a54e){logger[_0xd71a('0x6')](_0xd71a('0x13'),_0x179819,JSON['stringify'](_0x29a54e));_0x4a1940[_0xd71a('0xa')]();}};}; \ No newline at end of file +var _0xa3a6=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','message','join','stop','info','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','number'];(function(_0x337a1e,_0x2b33ae){var _0x188c38=function(_0x42137d){while(--_0x42137d){_0x337a1e['push'](_0x337a1e['shift']());}};_0x188c38(++_0x2b33ae);}(_0xa3a6,0x174));var _0x6a3a=function(_0x5d2b9b,_0x4163d0){_0x5d2b9b=_0x5d2b9b-0x0;var _0x36cd86=_0xa3a6[_0x5d2b9b];return _0x36cd86;};'use strict';var schema=require('validate');var _=require(_0x6a3a('0x0'));var logger=require(_0x6a3a('0x1'))('routing');var gotop=schema({'priority':{'type':_0x6a3a('0x2'),'required':!![],'message':_0x6a3a('0x3')}});exports[_0x6a3a('0x4')]=function(_0x2e49e0,_0x57d21b){return function(_0x595cf1){try{var _0x432f01={'priority':_0x57d21b[0x0]};var _0x22c1f4=gotop['validate'](_0x432f01,{'typecast':!![]});if(_0x22c1f4['length']){logger[_0x6a3a('0x5')]('[%s][GOTOP]\x20%s',_0x2e49e0,_['map'](_0x22c1f4,_0x6a3a('0x6'))[_0x6a3a('0x7')](',\x20'));_0x595cf1[_0x6a3a('0x8')]();}else{logger[_0x6a3a('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x2e49e0,_0x432f01[_0x6a3a('0xa')]);if(_0x432f01[_0x6a3a('0xa')]){var _0x5f2213=_[_0x6a3a('0xb')](_0x595cf1['rules'](),{'p':_0x432f01[_0x6a3a('0xa')]});if(_0x5f2213>=0x0){logger[_0x6a3a('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2e49e0,_0x432f01[_0x6a3a('0xa')]||_0x6a3a('0xc'),_0x5f2213);_0x595cf1[_0x6a3a('0xc')](_0x5f2213);}else{logger[_0x6a3a('0x9')](_0x6a3a('0xd'),_0x2e49e0,_0x432f01[_0x6a3a('0xa')]||_0x6a3a('0xc'));_0x595cf1[_0x6a3a('0x8')]();}}else{_0x595cf1[_0x6a3a('0xc')]();}}}catch(_0xd56177){logger['error'](_0x6a3a('0xe'),_0x2e49e0,JSON['stringify'](_0xd56177));_0x595cf1['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e94ac7b..badf197 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 _0x730a=['../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils'];(function(_0x400635,_0x49a764){var _0x5b0c61=function(_0x2cb18a){while(--_0x2cb18a){_0x400635['push'](_0x400635['shift']());}};_0x5b0c61(++_0x49a764);}(_0x730a,0x80));var _0xa730=function(_0x47a854,_0x5871dd){_0x47a854=_0x47a854-0x0;var _0x51a0af=_0x730a[_0x47a854];return _0x51a0af;};'use strict';var _=require(_0xa730('0x0'));var utils=require(_0xa730('0x1'));var logger=require(_0xa730('0x2'))('routing');var rpc={'chatMessage':require(_0xa730('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa730('0x4')),'smsMessage':require(_0xa730('0x5')),'faxMessage':require(_0xa730('0x6')),'whatsappMessage':require(_0xa730('0x7'))};exports[_0xa730('0x8')]=function(_0x187db3,_0x14b067){return function(_0x1d72d3){try{var _0x1f30df={'body':utils['getMustacheRender'](_0x14b067[0x0],this),'ContactId':this[_0xa730('0x9')]['id']};if(this[_0xa730('0xa')]===_0xa730('0xb')){_0x1f30df[_0xa730('0xc')]=this[_0xa730('0xd')]['id'];}else{_0x1f30df[_[_0xa730('0xe')](this['channel'])+_0xa730('0xf')]=this['account']['id'];}_0x1f30df[_['upperFirst'](this[_0xa730('0xa')])+_0xa730('0x10')]=this['interaction']['id'];if(rpc[this[_0xa730('0xa')]+_0xa730('0x11')]){return rpc[this['channel']+_0xa730('0x11')][_0xa730('0x12')](_0x1f30df)[_0xa730('0x13')](function(_0x5b3ec9){logger['info'](_0xa730('0x14'),_0x187db3,_0x1f30df[_0xa730('0x15')]);_0x1d72d3[_0xa730('0x16')]();})['catch'](function(_0x5604d5){logger[_0xa730('0x17')](_0xa730('0x14'),_0x187db3,JSON[_0xa730('0x18')](_0x5604d5));_0x1d72d3[_0xa730('0x19')]();});}}catch(_0x6a6d74){logger[_0xa730('0x17')](_0xa730('0x14'),_0x187db3,JSON['stringify'](_0x6a6d74));_0x1d72d3['stop']();}};}; \ No newline at end of file +var _0x53ed=['body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x53ed,0x76));var _0xd53e=function(_0x1d84b1,_0x599872){_0x1d84b1=_0x1d84b1-0x0;var _0x54fa39=_0x53ed[_0x1d84b1];return _0x54fa39;};'use strict';var _=require(_0xd53e('0x0'));var utils=require(_0xd53e('0x1'));var logger=require(_0xd53e('0x2'))(_0xd53e('0x3'));var rpc={'chatMessage':require(_0xd53e('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd53e('0x5')),'smsMessage':require(_0xd53e('0x6')),'faxMessage':require(_0xd53e('0x7')),'whatsappMessage':require(_0xd53e('0x8'))};exports['consequence']=function(_0x3a3666,_0x5079d2){return function(_0x462417){try{var _0xfc0b5a={'body':utils[_0xd53e('0x9')](_0x5079d2[0x0],this),'ContactId':this['contact']['id']};if(this[_0xd53e('0xa')]==='chat'){_0xfc0b5a[_0xd53e('0xb')]=this[_0xd53e('0xc')]['id'];}else{_0xfc0b5a[_['upperFirst'](this[_0xd53e('0xa')])+_0xd53e('0xd')]=this[_0xd53e('0xc')]['id'];}_0xfc0b5a[_[_0xd53e('0xe')](this[_0xd53e('0xa')])+_0xd53e('0xf')]=this[_0xd53e('0x10')]['id'];if(rpc[this[_0xd53e('0xa')]+_0xd53e('0x11')]){return rpc[this[_0xd53e('0xa')]+'Message'][_0xd53e('0x12')](_0xfc0b5a)[_0xd53e('0x13')](function(_0x14dc02){logger[_0xd53e('0x14')](_0xd53e('0x15'),_0x3a3666,_0xfc0b5a[_0xd53e('0x16')]);_0x462417[_0xd53e('0x17')]();})[_0xd53e('0x18')](function(_0x3bcb0b){logger[_0xd53e('0x19')](_0xd53e('0x15'),_0x3a3666,JSON[_0xd53e('0x1a')](_0x3bcb0b));_0x462417[_0xd53e('0x1b')]();});}}catch(_0x48c0f0){logger['error'](_0xd53e('0x15'),_0x3a3666,JSON[_0xd53e('0x1a')](_0x48c0f0));_0x462417[_0xd53e('0x1b')]();}};}; \ 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 f7163f9..c9c7172 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 _0x2a0c=['consequence','[%s][NOOP]\x20%s','getMustacheRender','stringify','stop','./utils','../../../../config/logger'];(function(_0x22f9fb,_0x37fca9){var _0x26b098=function(_0x440191){while(--_0x440191){_0x22f9fb['push'](_0x22f9fb['shift']());}};_0x26b098(++_0x37fca9);}(_0x2a0c,0x10f));var _0xc2a0=function(_0x537a22,_0x109f43){_0x537a22=_0x537a22-0x0;var _0x28fa00=_0x2a0c[_0x537a22];return _0x28fa00;};'use strict';var utils=require(_0xc2a0('0x0'));var logger=require(_0xc2a0('0x1'))('routing');exports[_0xc2a0('0x2')]=function(_0x28a5ab,_0x32e164){return function(_0x2b77a4){try{logger['info'](_0xc2a0('0x3'),_0x28a5ab,utils[_0xc2a0('0x4')](_0x32e164[0x0],this));_0x2b77a4['next']();}catch(_0x5a325b){logger['error']('[%s][NOOP]\x20%s',_0x28a5ab,JSON[_0xc2a0('0x5')](_0x5a325b));_0x2b77a4[_0xc2a0('0x6')]();}};}; \ No newline at end of file +var _0xc5bd=['consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stop','./utils','../../../../config/logger'];(function(_0x8ad4f9,_0x5366ad){var _0x575be6=function(_0x519a02){while(--_0x519a02){_0x8ad4f9['push'](_0x8ad4f9['shift']());}};_0x575be6(++_0x5366ad);}(_0xc5bd,0x1db));var _0xdc5b=function(_0x571877,_0x488521){_0x571877=_0x571877-0x0;var _0x37e2ba=_0xc5bd[_0x571877];return _0x37e2ba;};'use strict';var utils=require(_0xdc5b('0x0'));var logger=require(_0xdc5b('0x1'))('routing');exports[_0xdc5b('0x2')]=function(_0x3888b7,_0x39940d){return function(_0x4f09c4){try{logger[_0xdc5b('0x3')]('[%s][NOOP]\x20%s',_0x3888b7,utils[_0xdc5b('0x4')](_0x39940d[0x0],this));_0x4f09c4[_0xdc5b('0x5')]();}catch(_0x5add58){logger[_0xdc5b('0x6')](_0xdc5b('0x7'),_0x3888b7,JSON['stringify'](_0x5add58));_0x4f09c4[_0xdc5b('0x8')]();}};}; \ 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 d3eccd3..a0f1a3f 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 _0xdba6=['next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','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','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','consequence','[%s][QUEUE]\x20%s','map','stop','find','Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdba6,0x169));var _0x6dba=function(_0x5d333d,_0x38eaf9){_0x5d333d=_0x5d333d-0x0;var _0x3dd4c5=_0xdba6[_0x5d333d];return _0x3dd4c5;};'use strict';var schema=require(_0x6dba('0x0'));var _=require(_0x6dba('0x1'));var util=require(_0x6dba('0x2'));var seqqueue=require(_0x6dba('0x3'));var moment=require('moment');var Redis=require(_0x6dba('0x4'));var config=require(_0x6dba('0x5'));var logger=require(_0x6dba('0x6'))(_0x6dba('0x7'));var strategy=require(_0x6dba('0x8'));config['redis']=_[_0x6dba('0x9')](config[_0x6dba('0xa')],{'host':_0x6dba('0xb'),'port':0x18eb});var io=require(_0x6dba('0xc'))(new Redis(config[_0x6dba('0xa')]));var attributes=['id','queue_id',_0x6dba('0xd'),_0x6dba('0xe'),_0x6dba('0xf'),_0x6dba('0x10')];function emit(_0x18cfb3,_0x3cf66e,_0x4be35f){io['to'](_0x18cfb3)[_0x6dba('0x11')](_0x3cf66e,_0x4be35f);}function emitChannelQueueInteraction(_0x3b0dff,_0xa4c2bc,_0x105d28,_0x520f8b,_0x517fb0,_0x6a1806,_0x569e96,_0x23dd27){var _0xea5e36=_[_0x6dba('0x12')](_0x105d28);_0xea5e36[_0x6dba('0x13')]=_0x23dd27;_0xea5e36[_0x6dba('0xe')]=_0xa4c2bc;_0xea5e36['account']=_0x520f8b;_0xea5e36['id']=_0x517fb0;if(_0x6a1806){attributes[_0x6dba('0x14')](_[_0x6dba('0x15')](_0x3b0dff)+_0x6dba('0x16'));_0x569e96[util[_0x6dba('0x17')](_0x6dba('0x18'),_0x3b0dff)][_0x517fb0]=_[_0x6dba('0x19')](_0xea5e36,attributes);}else{delete _0x569e96[util[_0x6dba('0x17')](_0x6dba('0x18'),_0x3b0dff)][_0x517fb0];}emit(util[_0x6dba('0x17')](_0x6dba('0x1a'),_0x3b0dff,_0xa4c2bc),util[_0x6dba('0x17')](_0x6dba('0x1b'),_0x3b0dff,_0x6a1806?_0x6dba('0x1c'):_0x6dba('0x1d')),_['pick'](_0xea5e36,attributes));}var rpc={'openchannelQueueReport':require(_0x6dba('0x1e')),'mailQueueReport':require(_0x6dba('0x1f')),'chatQueueReport':require(_0x6dba('0x20')),'smsQueueReport':require(_0x6dba('0x21')),'faxQueueReport':require(_0x6dba('0x22')),'whatsappQueueReport':require(_0x6dba('0x23')),'chatInteraction':require(_0x6dba('0x24')),'faxInteraction':require(_0x6dba('0x25')),'mailInteraction':require(_0x6dba('0x26')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6dba('0x27')),'whatsappInteraction':require(_0x6dba('0x28'))};var queue=schema({'name':{'type':_0x6dba('0x29'),'required':!![],'message':_0x6dba('0x2a')},'timeout':{'type':_0x6dba('0x2b'),'message':_0x6dba('0x2c')}});function startRouting(_0x20e7de,_0x38dd5e,_0x30050c,_0x1cb8cb){if(_0x20e7de&&_0x38dd5e&&_0x30050c){_0x38dd5e[_0x6dba('0x2d')]+=0x1;var _0x23f566={'uniqueid':_0x20e7de,'from':_0x30050c[_0x6dba('0x2e')]?_0x30050c[_0x6dba('0x2e')][_0x6dba('0xf')]:'','joinAt':moment()[_0x6dba('0x17')](_0x6dba('0x2f')),'ContactId':_0x30050c[_0x6dba('0x30')]?_0x30050c[_0x6dba('0x30')]['id']:null,'ListId':_0x30050c[_0x6dba('0x31')]?_0x30050c[_0x6dba('0x31')]['id']:null};_0x23f566[_[_0x6dba('0x32')](_0x30050c[_0x6dba('0x33')])+'QueueId']=_0x38dd5e['id']||null;_0x23f566[_['upperFirst'](_0x30050c[_0x6dba('0x33')])+_0x6dba('0x16')]=_0x30050c[_0x6dba('0x34')]?_0x30050c['interaction']['id']:null;_0x23f566[_[_0x6dba('0x32')](_0x30050c['channel'])+'MessageId']=_0x30050c[_0x6dba('0x35')]?_0x30050c[_0x6dba('0x35')]['id']:null;_0x23f566[_['upperFirst'](_0x30050c[_0x6dba('0x33')])+(_0x30050c[_0x6dba('0x33')]!==_0x6dba('0x36')?_0x6dba('0x37'):_0x6dba('0x38'))]=_0x30050c[_0x6dba('0xd')]?_0x30050c[_0x6dba('0xd')]['id']:null;logger[_0x6dba('0x39')](util[_0x6dba('0x17')](_0x6dba('0x3a'),_0x20e7de,_0x38dd5e[_0x6dba('0x3b')]));emitChannelQueueInteraction(_0x30050c[_0x6dba('0x33')],_0x38dd5e[_0x6dba('0x3b')],_0x23f566,_0x30050c[_0x6dba('0xd')]['name'],_0x30050c[_0x6dba('0x35')]['id'],!![],_0x1cb8cb,_0x38dd5e['id']);if(rpc[_0x30050c[_0x6dba('0x33')]+_0x6dba('0x3c')]){return rpc[_0x30050c[_0x6dba('0x33')]+_0x6dba('0x3c')]['create'](_0x23f566)['catch'](function(_0x5f4c39){logger['error']('create\x20queue\x20report',_0x5f4c39);});}}}function stopRouting(_0x1c88d9,_0x5b61ec,_0x53ce2a,_0x1c2d38){if(_0x1c88d9&&_0x5b61ec){_0x5b61ec[_0x6dba('0x2d')]-=0x1;var _0x23e23c={'leaveAt':moment()['format'](_0x6dba('0x2f')),'acceptAt':moment()['format'](_0x6dba('0x2f')),'reason':_0x6dba('0x3d')};logger['info'](util[_0x6dba('0x17')](_0x6dba('0x3e'),_0x1c88d9,_0x5b61ec[_0x6dba('0x3b')]));emitChannelQueueInteraction(_0x53ce2a[_0x6dba('0x33')],_0x5b61ec['name'],_0x53ce2a[_0x6dba('0x2e')],_0x53ce2a[_0x6dba('0xd')][_0x6dba('0x3b')],_0x53ce2a[_0x6dba('0x35')]['id'],![],_0x1c2d38,_0x5b61ec['id']);return rpc[_0x53ce2a[_0x6dba('0x33')]+_0x6dba('0x3f')][_0x6dba('0x40')](_0x53ce2a[_0x6dba('0x34')]['id'],{'queueId':_0x5b61ec['id']})[_0x6dba('0x41')](function(){if(rpc[_0x53ce2a['channel']+'QueueReport']){return rpc[_0x53ce2a[_0x6dba('0x33')]+'QueueReport'][_0x6dba('0x40')](_0x1c88d9,_0x23e23c)[_0x6dba('0x42')](function(_0x2c518e){logger[_0x6dba('0x43')](_0x6dba('0x44'),_0x2c518e);});}});}}function endRouting(_0x16642f,_0x7e5a63,_0x48a5a9,_0x22ea72){if(_0x16642f&&_0x7e5a63){_0x7e5a63[_0x6dba('0x2d')]-=0x1;var _0x36f0f7={'leaveAt':moment()[_0x6dba('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x6dba('0x17')](_0x6dba('0x2f')),'reason':_0x6dba('0x45')};logger[_0x6dba('0x39')](util[_0x6dba('0x17')](_0x6dba('0x46'),_0x16642f,_0x7e5a63[_0x6dba('0x3b')]));emitChannelQueueInteraction(_0x48a5a9[_0x6dba('0x33')],_0x7e5a63[_0x6dba('0x3b')],_0x48a5a9[_0x6dba('0x2e')],_0x48a5a9[_0x6dba('0xd')][_0x6dba('0x3b')],_0x48a5a9[_0x6dba('0x35')]['id'],![],_0x22ea72);if(rpc[_0x48a5a9[_0x6dba('0x33')]+_0x6dba('0x3c')]){return rpc[_0x48a5a9[_0x6dba('0x33')]+'QueueReport'][_0x6dba('0x40')](_0x16642f,_0x36f0f7)[_0x6dba('0x42')](function(_0x4df231){logger[_0x6dba('0x43')]('update\x20queue\x20report',_0x4df231);});}}}function handleFindQueue(_0x480e07){return function(_0x5c9c27){return _0x5c9c27[_0x6dba('0x3b')]['toLowerCase']()===_0x480e07['toLowerCase']();};}exports[_0x6dba('0x47')]=function(_0x306055,_0xab04ef,_0x82d89c,_0x5902a7){return function(_0x2198d5){try{var _0x55fea7={'name':_0xab04ef[0x0],'timeout':_0xab04ef[0x1]};var _0xf47f4d=queue['validate'](_0x55fea7,{'typecast':!![]});if(_0xf47f4d['length']){logger['error'](_0x6dba('0x48'),_0x306055,_[_0x6dba('0x49')](_0xf47f4d,_0x6dba('0x35'))['join'](',\x20'));_0x2198d5[_0x6dba('0x4a')]();}else{var _0x1d9014=_[_0x6dba('0x4b')](_0x82d89c[_0x5902a7[_0x6dba('0x33')]+_0x6dba('0x4c')],handleFindQueue(_0x55fea7['name']));if(_0x1d9014){startRouting(_0x306055,_0x1d9014,_0x5902a7,_0x82d89c);var _0x105c3b=(_0x1d9014['timeout']||0xa)*0x3e8;var _0x5c2f2c=(_0x55fea7['timeout']||0x14)*0x3e8;var _0x4ac48c;if(_0x105c3b>_0x5c2f2c){_0x5c2f2c=_0x105c3b;}var _0x372bdb=seqqueue['createQueue'](_0x105c3b);_0x372bdb['id']=_0x306055;_0x372bdb[_0x6dba('0x4d')]=_0x105c3b;_0x372bdb['qtimeout']=_0x5c2f2c;_0x372bdb[_0x6dba('0x33')]=_0x5902a7[_0x6dba('0x33')];_0x82d89c[_0x6dba('0x4e')][_0x306055]['on'](_0x6dba('0x4f'),function(){logger[_0x6dba('0x39')](_0x6dba('0x50'),_0x306055);stopRouting(_0x306055,_0x1d9014,_0x5902a7,_0x82d89c);clearTimeout(_0x4ac48c);_0x4ac48c=undefined;_0x372bdb[_0x6dba('0x51')](!![]);if(_0x82d89c[_0x6dba('0x4e')][_0x306055]){delete _0x82d89c['rules'][_0x306055];}_0x2198d5[_0x6dba('0x4a')]();});_0x82d89c[_0x6dba('0x4e')][_0x306055]['on'](_0x6dba('0x52'),function(){if(_0x82d89c[_0x6dba('0x4e')][_0x306055]){delete _0x82d89c['rules'][_0x306055];}});_0x4ac48c=setTimeout(function(){logger[_0x6dba('0x39')](_0x6dba('0x53'),_0x306055);endRouting(_0x306055,_0x1d9014,_0x5902a7,_0x82d89c);clearTimeout(_0x4ac48c);_0x372bdb['close'](!![]);_0x2198d5[_0x6dba('0x54')]();},_0x5c2f2c);switch(_0x1d9014[_0x6dba('0x55')]){case _0x6dba('0x56'):strategy[_0x6dba('0x56')](_0x372bdb,_0x1d9014,_0x82d89c,_0x5902a7);break;default:strategy[_0x6dba('0x57')](_0x372bdb,_0x1d9014,_0x82d89c,_0x5902a7);}}else{logger[_0x6dba('0x43')](_0x6dba('0x58'),_0x306055,_0x55fea7['name']);_0x2198d5[_0x6dba('0x4a')]();}}}catch(_0x32a00d){logger[_0x6dba('0x43')](_0x6dba('0x48'),_0x306055,_0x32a00d['stack']);_0x2198d5[_0x6dba('0x4a')]();}};}; \ No newline at end of file +var _0x23ca=['moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','queue_id','account','queue','joinAt','emit','clone','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util'];(function(_0x13bcbb,_0x2eb915){var _0x457c81=function(_0xf44477){while(--_0xf44477){_0x13bcbb['push'](_0x13bcbb['shift']());}};_0x457c81(++_0x2eb915);}(_0x23ca,0x102));var _0xa23c=function(_0x5cb537,_0x574c06){_0x5cb537=_0x5cb537-0x0;var _0x4eb6ec=_0x23ca[_0x5cb537];return _0x4eb6ec;};'use strict';var schema=require(_0xa23c('0x0'));var _=require(_0xa23c('0x1'));var util=require(_0xa23c('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xa23c('0x3'));var Redis=require('ioredis');var config=require(_0xa23c('0x4'));var logger=require(_0xa23c('0x5'))(_0xa23c('0x6'));var strategy=require(_0xa23c('0x7'));config['redis']=_['defaults'](config[_0xa23c('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa23c('0x8')]));var attributes=['id',_0xa23c('0x9'),_0xa23c('0xa'),_0xa23c('0xb'),'from',_0xa23c('0xc')];function emit(_0x271faf,_0x1b02aa,_0x429614){io['to'](_0x271faf)[_0xa23c('0xd')](_0x1b02aa,_0x429614);}function emitChannelQueueInteraction(_0x3785d7,_0xc6467f,_0x40db99,_0x38937a,_0xb0de91,_0xc58536,_0x228603,_0x1efd01){var _0x48e45b=_[_0xa23c('0xe')](_0x40db99);_0x48e45b['queue_id']=_0x1efd01;_0x48e45b[_0xa23c('0xb')]=_0xc6467f;_0x48e45b[_0xa23c('0xa')]=_0x38937a;_0x48e45b['id']=_0xb0de91;if(_0xc58536){attributes[_0xa23c('0xf')](_['capitalize'](_0x3785d7)+_0xa23c('0x10'));_0x228603[util[_0xa23c('0x11')](_0xa23c('0x12'),_0x3785d7)][_0xb0de91]=_[_0xa23c('0x13')](_0x48e45b,attributes);}else{delete _0x228603[util[_0xa23c('0x11')]('%sQueuesWaitingInteractions',_0x3785d7)][_0xb0de91];}emit(util['format'](_0xa23c('0x14'),_0x3785d7,_0xc6467f),util[_0xa23c('0x11')](_0xa23c('0x15'),_0x3785d7,_0xc58536?_0xa23c('0x16'):_0xa23c('0x17')),_[_0xa23c('0x13')](_0x48e45b,attributes));}var rpc={'openchannelQueueReport':require(_0xa23c('0x18')),'mailQueueReport':require(_0xa23c('0x19')),'chatQueueReport':require(_0xa23c('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa23c('0x1b')),'whatsappQueueReport':require(_0xa23c('0x1c')),'chatInteraction':require(_0xa23c('0x1d')),'faxInteraction':require(_0xa23c('0x1e')),'mailInteraction':require(_0xa23c('0x1f')),'openchannelInteraction':require(_0xa23c('0x20')),'smsInteraction':require(_0xa23c('0x21')),'whatsappInteraction':require(_0xa23c('0x22'))};var queue=schema({'name':{'type':_0xa23c('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa23c('0x24'),'message':_0xa23c('0x25')}});function startRouting(_0x5203e1,_0x254241,_0xe00460,_0x30248b){if(_0x5203e1&&_0x254241&&_0xe00460){_0x254241[_0xa23c('0x26')]+=0x1;var _0x245290={'uniqueid':_0x5203e1,'from':_0xe00460['body']?_0xe00460[_0xa23c('0x27')][_0xa23c('0x28')]:'','joinAt':moment()['format'](_0xa23c('0x29')),'ContactId':_0xe00460['contact']?_0xe00460[_0xa23c('0x2a')]['id']:null,'ListId':_0xe00460['list']?_0xe00460[_0xa23c('0x2b')]['id']:null};_0x245290[_[_0xa23c('0x2c')](_0xe00460[_0xa23c('0x2d')])+_0xa23c('0x2e')]=_0x254241['id']||null;_0x245290[_[_0xa23c('0x2c')](_0xe00460[_0xa23c('0x2d')])+_0xa23c('0x10')]=_0xe00460['interaction']?_0xe00460[_0xa23c('0x2f')]['id']:null;_0x245290[_[_0xa23c('0x2c')](_0xe00460['channel'])+_0xa23c('0x30')]=_0xe00460['message']?_0xe00460[_0xa23c('0x31')]['id']:null;_0x245290[_[_0xa23c('0x2c')](_0xe00460[_0xa23c('0x2d')])+(_0xe00460[_0xa23c('0x2d')]!==_0xa23c('0x32')?_0xa23c('0x33'):_0xa23c('0x34'))]=_0xe00460[_0xa23c('0xa')]?_0xe00460[_0xa23c('0xa')]['id']:null;logger['info'](util['format'](_0xa23c('0x35'),_0x5203e1,_0x254241[_0xa23c('0x36')]));emitChannelQueueInteraction(_0xe00460[_0xa23c('0x2d')],_0x254241[_0xa23c('0x36')],_0x245290,_0xe00460[_0xa23c('0xa')][_0xa23c('0x36')],_0xe00460[_0xa23c('0x31')]['id'],!![],_0x30248b,_0x254241['id']);if(rpc[_0xe00460['channel']+_0xa23c('0x37')]){return rpc[_0xe00460[_0xa23c('0x2d')]+_0xa23c('0x37')][_0xa23c('0x38')](_0x245290)[_0xa23c('0x39')](function(_0x50613d){logger[_0xa23c('0x3a')](_0xa23c('0x3b'),_0x50613d);});}}}function stopRouting(_0xebff84,_0xf633c0,_0x740a6e,_0x1e2a47){if(_0xebff84&&_0xf633c0){_0xf633c0['waiting']-=0x1;var _0x32885c={'leaveAt':moment()[_0xa23c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xa23c('0x11')](_0xa23c('0x29')),'reason':'accepted'};logger[_0xa23c('0x3c')](util[_0xa23c('0x11')](_0xa23c('0x3d'),_0xebff84,_0xf633c0[_0xa23c('0x36')]));emitChannelQueueInteraction(_0x740a6e[_0xa23c('0x2d')],_0xf633c0['name'],_0x740a6e[_0xa23c('0x27')],_0x740a6e[_0xa23c('0xa')][_0xa23c('0x36')],_0x740a6e[_0xa23c('0x31')]['id'],![],_0x1e2a47,_0xf633c0['id']);return rpc[_0x740a6e[_0xa23c('0x2d')]+_0xa23c('0x3e')][_0xa23c('0x3f')](_0x740a6e[_0xa23c('0x2f')]['id'],{'queueId':_0xf633c0['id']})[_0xa23c('0x40')](function(){if(rpc[_0x740a6e[_0xa23c('0x2d')]+_0xa23c('0x37')]){return rpc[_0x740a6e[_0xa23c('0x2d')]+_0xa23c('0x37')]['update'](_0xebff84,_0x32885c)[_0xa23c('0x39')](function(_0x25c8ae){logger['error'](_0xa23c('0x41'),_0x25c8ae);});}});}}function endRouting(_0x543f97,_0x56bdc7,_0x135b40,_0x5382e9){if(_0x543f97&&_0x56bdc7){_0x56bdc7[_0xa23c('0x26')]-=0x1;var _0x2ddc2d={'leaveAt':moment()[_0xa23c('0x11')](_0xa23c('0x29')),'exitAt':moment()[_0xa23c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa23c('0x42')};logger[_0xa23c('0x3c')](util[_0xa23c('0x11')](_0xa23c('0x43'),_0x543f97,_0x56bdc7[_0xa23c('0x36')]));emitChannelQueueInteraction(_0x135b40[_0xa23c('0x2d')],_0x56bdc7['name'],_0x135b40['body'],_0x135b40['account']['name'],_0x135b40[_0xa23c('0x31')]['id'],![],_0x5382e9);if(rpc[_0x135b40[_0xa23c('0x2d')]+'QueueReport']){return rpc[_0x135b40[_0xa23c('0x2d')]+_0xa23c('0x37')][_0xa23c('0x3f')](_0x543f97,_0x2ddc2d)[_0xa23c('0x39')](function(_0x33ebcf){logger[_0xa23c('0x3a')](_0xa23c('0x41'),_0x33ebcf);});}}}function handleFindQueue(_0x1012e3){return function(_0x3f7c63){return _0x3f7c63[_0xa23c('0x36')][_0xa23c('0x44')]()===_0x1012e3[_0xa23c('0x44')]();};}exports[_0xa23c('0x45')]=function(_0x309ee9,_0x5aa0e2,_0x1b1afd,_0x2176f2){return function(_0x132bb9){try{var _0x3d7765={'name':_0x5aa0e2[0x0],'timeout':_0x5aa0e2[0x1]};var _0x360b8a=queue[_0xa23c('0x0')](_0x3d7765,{'typecast':!![]});if(_0x360b8a[_0xa23c('0x46')]){logger[_0xa23c('0x3a')](_0xa23c('0x47'),_0x309ee9,_['map'](_0x360b8a,_0xa23c('0x31'))['join'](',\x20'));_0x132bb9[_0xa23c('0x48')]();}else{var _0x1885e7=_[_0xa23c('0x49')](_0x1b1afd[_0x2176f2[_0xa23c('0x2d')]+_0xa23c('0x4a')],handleFindQueue(_0x3d7765['name']));if(_0x1885e7){startRouting(_0x309ee9,_0x1885e7,_0x2176f2,_0x1b1afd);var _0x682989=(_0x1885e7[_0xa23c('0x42')]||0xa)*0x3e8;var _0x3db5ec=(_0x3d7765[_0xa23c('0x42')]||0x14)*0x3e8;var _0x27b212;if(_0x682989>_0x3db5ec){_0x3db5ec=_0x682989;}var _0x2c1792=seqqueue[_0xa23c('0x4b')](_0x682989);_0x2c1792['id']=_0x309ee9;_0x2c1792[_0xa23c('0x4c')]=_0x682989;_0x2c1792['qtimeout']=_0x3db5ec;_0x2c1792[_0xa23c('0x2d')]=_0x2176f2[_0xa23c('0x2d')];_0x1b1afd['rules'][_0x309ee9]['on'](_0xa23c('0x4d'),function(){logger['info'](_0xa23c('0x4e'),_0x309ee9);stopRouting(_0x309ee9,_0x1885e7,_0x2176f2,_0x1b1afd);clearTimeout(_0x27b212);_0x27b212=undefined;_0x2c1792[_0xa23c('0x4f')](!![]);if(_0x1b1afd[_0xa23c('0x50')][_0x309ee9]){delete _0x1b1afd[_0xa23c('0x50')][_0x309ee9];}_0x132bb9[_0xa23c('0x48')]();});_0x1b1afd['rules'][_0x309ee9]['on'](_0xa23c('0x51'),function(){if(_0x1b1afd['rules'][_0x309ee9]){delete _0x1b1afd[_0xa23c('0x50')][_0x309ee9];}});_0x27b212=setTimeout(function(){logger[_0xa23c('0x3c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x309ee9);endRouting(_0x309ee9,_0x1885e7,_0x2176f2,_0x1b1afd);clearTimeout(_0x27b212);_0x2c1792[_0xa23c('0x4f')](!![]);_0x132bb9[_0xa23c('0x52')]();},_0x3db5ec);switch(_0x1885e7['strategy']){case _0xa23c('0x53'):strategy[_0xa23c('0x53')](_0x2c1792,_0x1885e7,_0x1b1afd,_0x2176f2);break;default:strategy[_0xa23c('0x54')](_0x2c1792,_0x1885e7,_0x1b1afd,_0x2176f2);}}else{logger[_0xa23c('0x3a')](_0xa23c('0x55'),_0x309ee9,_0x3d7765['name']);_0x132bb9[_0xa23c('0x48')]();}}}catch(_0xc1bb66){logger[_0xa23c('0x3a')](_0xa23c('0x47'),_0x309ee9,_0xc1bb66[_0xa23c('0x56')]);_0x132bb9[_0xa23c('0x48')]();}};}; \ 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 a36483a..b6266fa 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 _0xd67b=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push'];(function(_0x224f68,_0x46de43){var _0x1876d1=function(_0x16d37c){while(--_0x16d37c){_0x224f68['push'](_0x224f68['shift']());}};_0x1876d1(++_0x46de43);}(_0xd67b,0x133));var _0xbd67=function(_0x28728d,_0x401eb6){_0x28728d=_0x28728d-0x0;var _0x2956b2=_0xd67b[_0x28728d];return _0x2956b2;};'use strict';var _=require('lodash');var uuid=require(_0xbd67('0x0'));var util=require('./util');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var Agent=function(_0x317e33,_0x5e967b,_0x40e384,_0x50da5a){this[_0xbd67('0x3')]=uuid['v4']();this['squeue']=_0x317e33;this[_0xbd67('0x4')]=_0x5e967b;this[_0xbd67('0x5')]=_0x40e384;this[_0xbd67('0x2')]=_0x50da5a;this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this[_0xbd67('0x6')]['on'](_0xbd67('0xb'),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this['squeue']['on']('drained',this[_0xbd67('0xc')]['bind'](this));};Agent[_0xbd67('0xd')][_0xbd67('0x7')]=function(){this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));};Agent[_0xbd67('0xd')][_0xbd67('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xbd67('0xd')][_0xbd67('0x8')]=function(){logger[_0xbd67('0xe')](_0xbd67('0xf'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this[_0xbd67('0x7')]['bind'](this),0x3e8);}else{if(this[_0xbd67('0x2')][_0xbd67('0x12')]||util[_0xbd67('0x13')](this['squeue']['id'],this[_0xbd67('0x5')]['agents'][this[_0xbd67('0x4')]['id']],this[_0xbd67('0x6')][_0xbd67('0x14')],![])){this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=!![];this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']]['busyQueue']=undefined;util[_0xbd67('0x16')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this[_0xbd67('0x6')][_0xbd67('0x14')]);util[_0xbd67('0x17')](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this[_0xbd67('0x2')]);util['writeLog'](this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],_0xbd67('0x18')+(this[_0xbd67('0x2')]['forcedOwnership']?_0xbd67('0x19'):''));}else{logger[_0xbd67('0xe')](_0xbd67('0x1a'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbd67('0xd')][_0xbd67('0xa')]=function(_0x4675ac){if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){return logger[_0xbd67('0xe')](_0xbd67('0x1b'),this[_0xbd67('0x6')]['id'],this['agent']['id']);}else{logger['debug'](_0xbd67('0x1c'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);util['hideNotification'](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this['routing']);this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=![];this['realtime']['agents'][this[_0xbd67('0x4')]['id']][_0xbd67('0x1d')]=undefined;util[_0xbd67('0x1e')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this['squeue'][_0xbd67('0x14')]);util[_0xbd67('0x1f')](this[_0xbd67('0x6')]['id'],this['realtime'][_0xbd67('0x11')][this['agent']['id']],_0x4675ac?_0xbd67('0x20'):_0xbd67('0x21'));}if(!_0x4675ac){setTimeout(this['push'][_0xbd67('0x9')](this),0x3e8);}};function agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777){return new Agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777);}module[_0xbd67('0x22')]=agent; \ No newline at end of file +var _0xa8a8=['./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','drained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x27ebdb,_0x222493){var _0x4eb237=function(_0x240137){while(--_0x240137){_0x27ebdb['push'](_0x27ebdb['shift']());}};_0x4eb237(++_0x222493);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3dffe4,_0x9fbf66){_0x3dffe4=_0x3dffe4-0x0;var _0x5257ec=_0xa8a8[_0x3dffe4];return _0x5257ec;};'use strict';var _=require(_0x8a8a('0x0'));var uuid=require(_0x8a8a('0x1'));var util=require(_0x8a8a('0x2'));var logger=require(_0x8a8a('0x3'))('routing');var Agent=function(_0x2a2676,_0x3296a6,_0xf11a08,_0x3ed1de){this[_0x8a8a('0x4')]=uuid['v4']();this[_0x8a8a('0x5')]=_0x2a2676;this[_0x8a8a('0x6')]=_0x3296a6;this[_0x8a8a('0x7')]=_0xf11a08;this[_0x8a8a('0x8')]=_0x3ed1de;this[_0x8a8a('0x5')][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')][_0x8a8a('0xb')](this));this['squeue']['on']('timeout',this[_0x8a8a('0xc')]['bind'](this));this[_0x8a8a('0x5')]['on'](_0x8a8a('0xd'),this['handleDrained'][_0x8a8a('0xb')](this));};Agent[_0x8a8a('0xe')][_0x8a8a('0x9')]=function(){this['squeue'][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')]['bind'](this));};Agent[_0x8a8a('0xe')]['handleDrained']=function(){this[_0x8a8a('0xc')](!![]);};Agent[_0x8a8a('0xe')][_0x8a8a('0xa')]=function(){logger[_0x8a8a('0xf')](_0x8a8a('0x10'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);if(_['isNil'](this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']])){logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}else{if(this[_0x8a8a('0x8')][_0x8a8a('0x12')]||util[_0x8a8a('0x13')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this['realtime'][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x15')]=!![];this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x17')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x19')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],null,this[_0x8a8a('0x8')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']],_0x8a8a('0x1b')+(this[_0x8a8a('0x8')]['forcedOwnership']?':FORCED':''));}else{logger[_0x8a8a('0xf')](_0x8a8a('0x1c'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}}};Agent['prototype'][_0x8a8a('0xc')]=function(_0xdd6221){if(_['isNil'](this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']])){return logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);}else{logger[_0x8a8a('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x8a8a('0x1d')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']],null,this[_0x8a8a('0x8')]);this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']]['busy']=![];this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x1e')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],_0xdd6221?_0x8a8a('0x1f'):_0x8a8a('0x20'));}if(!_0xdd6221){setTimeout(this[_0x8a8a('0x9')][_0x8a8a('0xb')](this),0x3e8);}};function agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01){return new Agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01);}module[_0x8a8a('0x21')]=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 d0845c1..66f0a55 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 _0xcaa8=['prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','agents','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xcaa8,0x159));var _0x8caa=function(_0x3b7e89,_0x374685){_0x3b7e89=_0x3b7e89-0x0;var _0x1335bd=_0xcaa8[_0x3b7e89];return _0x1335bd;};'use strict';var _=require(_0x8caa('0x0'));var uuid=require('uuid');var util=require(_0x8caa('0x1'));var logger=require(_0x8caa('0x2'))(_0x8caa('0x3'));var Beepall=function(_0x4659e6,_0x22b3ec,_0x15b1e3,_0x48f6af){this[_0x8caa('0x4')]=uuid['v4']();this[_0x8caa('0x5')]=_0x4659e6;this[_0x8caa('0x6')]=_0x22b3ec;this[_0x8caa('0x7')]=_0x15b1e3;this[_0x8caa('0x3')]=_0x48f6af;this['squeue'][_0x8caa('0x8')](this[_0x8caa('0x9')]['bind'](this),this[_0x8caa('0xa')][_0x8caa('0xb')](this));this[_0x8caa('0x5')]['on'](_0x8caa('0xc'),this[_0x8caa('0xa')]['bind'](this));this[_0x8caa('0x5')]['on'](_0x8caa('0xd'),this[_0x8caa('0xe')][_0x8caa('0xb')](this));};Beepall[_0x8caa('0xf')][_0x8caa('0x8')]=function(){this[_0x8caa('0x5')][_0x8caa('0x8')](this[_0x8caa('0x9')]['bind'](this),this[_0x8caa('0xa')][_0x8caa('0xb')](this));};Beepall[_0x8caa('0xf')][_0x8caa('0xe')]=function(){this['handleTimeout'](!![]);};Beepall['prototype']['handleRun']=function(){var _0x4c886e=!![];if(!_['isNil'](this['queue'])&&!_[_0x8caa('0x10')](this[_0x8caa('0x6')][_0x8caa('0x11')])&&this['queue'][_0x8caa('0x11')][_0x8caa('0x12')]>0x0){for(var _0x472bee=0x0,_0x46a914;_0x472bee0x0){for(var _0x5701db=0x0,_0x1d292c;_0x5701db0x0&&_0x490dcb[_0xad863d+_0x8462('0x20')]>=_0x490dcb[_0xad863d+_0x8462('0x21')]){writeLog(_0x49bef5,_0x490dcb,_0xad863d[_0x8462('0x22')]()+_0x8462('0x23'));return![];}}return!![];};exports[_0x8462('0x24')]=function(_0x5ca724,_0x161018,_0x328e71,_0x1e5b0c,_0x412a21){return sendNotification(!![],_0x5ca724,_0x161018,_0x328e71,_0x1e5b0c,_0x412a21);};exports[_0x8462('0x25')]=function(_0x8eb02d,_0x4a6714,_0x5e50a0,_0x593681,_0x3c9d95){return sendNotification(![],_0x8eb02d,_0x4a6714,_0x5e50a0,_0x593681,_0x3c9d95);};exports[_0x8462('0x26')]=function(_0x5efacd,_0x1eac49,_0x3e4e30){var _0xdafc1d=_0x1eac49[_0x8462('0x27')]['UserId'];if(!_0xdafc1d&&_0x3e4e30){_0xdafc1d=_0x3e4e30['id'];}var _0x3d7ee6=_['some'](_0x5efacd[_0x1eac49[_0x8462('0x28')]+'QueuesWaitingInteractions'],function(_0x4541c8){var _0x52d278=_['capitalize'](_0x1eac49[_0x8462('0x28')])+_0x8462('0x29');return _0x4541c8[_0x52d278]===_0x1eac49[_0x8462('0x27')]['id'];});if(!_0x3d7ee6&&_0xdafc1d&&_0x5efacd[_0x8462('0x2a')][_0xdafc1d]){_0x3d7ee6=_['some'](_0x5efacd[_0x8462('0x2a')][_0xdafc1d][_0x1eac49[_0x8462('0x28')]+_0x8462('0x2b')],function(_0x4a7150){return _0x4a7150['id']===_0x1eac49[_0x8462('0x27')]['id'];});}return _0x3d7ee6;};exports[_0x8462('0x2c')]=function(_0x51c206,_0x2256db,_0x45cd1b,_0x2dd1bb){if(_0x45cd1b&&_0x45cd1b['id']&&_0x51c206[_0x8462('0x2a')]&&_0x51c206[_0x8462('0x2a')][_0x45cd1b['id']]){_0x51c206[_0x8462('0x2a')][_0x45cd1b['id']][_0x2dd1bb+_0x8462('0x2b')][_0x2256db[_0x8462('0x2d')]['id']]={'id':_0x2256db['interaction']['id']};}};exports[_0x8462('0x2e')]=function(_0x6c2400,_0x50218a,_0xd5a665,_0x581aa5){if(_0xd5a665&&_0xd5a665['id']&&_0x6c2400[_0x8462('0x2a')]&&_0x6c2400['agents'][_0xd5a665['id']]){delete _0x6c2400[_0x8462('0x2a')][_0xd5a665['id']][_0x581aa5+_0x8462('0x2b')][_0x50218a[_0x8462('0x2d')]['id']];}};exports[_0x8462('0x2f')]=writeLog; \ No newline at end of file +var _0xb8cb=['WaitingInteractions','saveWaitingNotification','interaction','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','split','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x303e24,_0x1e170c){_0x303e24=_0x303e24-0x0;var _0x531f2a=_0xb8cb[_0x303e24];return _0x531f2a;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var utils=require(_0xbb8c('0x2'));var Redis=require(_0xbb8c('0x3'));var config=require(_0xbb8c('0x4'));var logger=require(_0xbb8c('0x5'))(_0xbb8c('0x6'));config['redis']=_[_0xbb8c('0x7')](config[_0xbb8c('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb8c('0x8')]));function sendNotification(_0x27c59e,_0x3eb759,_0x497956,_0x31224b,_0x3eda24,_0x11d365){var _0x823c83=_0x11d365||{};var _0x1d62d4=_0x497956[_0xbb8c('0x9')]('.');var _0x39b95a={'uniqueid':_0x3eb759,'channel':_0x1d62d4[0x0],'id':_0x1d62d4[0x1],'title':_0x1d62d4[0x0]+_0xbb8c('0xa'),'interactionId':_0x1d62d4[0x2],'queue':_0x3eda24?_0x3eda24[_0xbb8c('0xb')]:null,'sound':_0x823c83[_0xbb8c('0xc')][_0xbb8c('0xd')],'shake':_0x823c83[_0xbb8c('0xc')]['notificationShake']};try{if(!_0x823c83[_0xbb8c('0xe')]){_0x823c83[_0xbb8c('0xe')]={};}if(_0x3eda24){_0x823c83[_0xbb8c('0xe')][_0xbb8c('0xf')]=_0x3eda24;}else if(_0x823c83[_0xbb8c('0xe')]['queue']){delete _0x823c83[_0xbb8c('0xe')][_0xbb8c('0xf')];}_0x39b95a[_0xbb8c('0x10')]=utils[_0xbb8c('0x11')](_0x823c83[_0xbb8c('0xc')][_0xbb8c('0x12')],_0x823c83);}catch(_0x1de932){_0x39b95a['msg']=_0xbb8c('0x13');logger[_0xbb8c('0x14')](util[_0xbb8c('0x15')](_0xbb8c('0x16'),_0x3eb759,_0x1de932[_0xbb8c('0x17')]));}io['to'](util[_0xbb8c('0x15')](_0xbb8c('0x18'),_0x31224b[_0xbb8c('0xb')]))[_0xbb8c('0x19')](util[_0xbb8c('0x15')]('notification:%s',_0x27c59e?_0xbb8c('0x1a'):_0xbb8c('0x1b')),_0x39b95a);}function writeLog(_0x2a02c9,_0x171cd8,_0x3bdaca){return logger[_0xbb8c('0x1c')](util['format'](_0xbb8c('0x1d'),_0x2a02c9,_0x171cd8[_0xbb8c('0xb')],_0x3bdaca));}exports['isAgentAvailable']=function(_0x1a1e92,_0x5e2803,_0x44a56e,_0x570c0b){if(_0x5e2803[_0xbb8c('0x1e')]){writeLog(_0x1a1e92,_0x5e2803,_0xbb8c('0x1f'));return![];}if(!_0x5e2803[_0xbb8c('0x20')]){writeLog(_0x1a1e92,_0x5e2803,'OFFLINE');return![];}if(_0x5e2803[_0x44a56e+'Pause']){writeLog(_0x1a1e92,_0x5e2803,_0xbb8c('0x21'));return![];}if(_0x570c0b&&_0x5e2803['hasOwnProperty'](_0x44a56e+_0xbb8c('0x22'))&&_0x5e2803[_0xbb8c('0x23')](_0x44a56e+_0xbb8c('0x24'))){if(_0x5e2803[_0x44a56e+_0xbb8c('0x22')]>0x0&&_0x5e2803[_0x44a56e+_0xbb8c('0x24')]>=_0x5e2803[_0x44a56e+_0xbb8c('0x22')]){writeLog(_0x1a1e92,_0x5e2803,_0x44a56e[_0xbb8c('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xbb8c('0x26')]=function(_0x5f4f96,_0x4a5684,_0xe7475d,_0x4c9d82,_0x47fb37){return sendNotification(!![],_0x5f4f96,_0x4a5684,_0xe7475d,_0x4c9d82,_0x47fb37);};exports[_0xbb8c('0x27')]=function(_0x283ec3,_0x36d351,_0x4928e4,_0x5b8cd1,_0x17576b){return sendNotification(![],_0x283ec3,_0x36d351,_0x4928e4,_0x5b8cd1,_0x17576b);};exports[_0xbb8c('0x28')]=function(_0x4cb223,_0x26c8cd,_0x23bf3d){var _0x292f11=_0x26c8cd['interaction'][_0xbb8c('0x29')];if(!_0x292f11&&_0x23bf3d){_0x292f11=_0x23bf3d['id'];}var _0x1e0e3=_[_0xbb8c('0x2a')](_0x4cb223[_0x26c8cd[_0xbb8c('0x2b')]+_0xbb8c('0x2c')],function(_0x387aa7){var _0x2f3db6=_[_0xbb8c('0x2d')](_0x26c8cd[_0xbb8c('0x2b')])+_0xbb8c('0x2e');return _0x387aa7[_0x2f3db6]===_0x26c8cd['interaction']['id'];});if(!_0x1e0e3&&_0x292f11&&_0x4cb223['agents'][_0x292f11]){_0x1e0e3=_[_0xbb8c('0x2a')](_0x4cb223[_0xbb8c('0x2f')][_0x292f11][_0x26c8cd[_0xbb8c('0x2b')]+_0xbb8c('0x30')],function(_0x3f60fc){return _0x3f60fc['id']===_0x26c8cd['interaction']['id'];});}return _0x1e0e3;};exports[_0xbb8c('0x31')]=function(_0x1e850c,_0x88958d,_0x1bdf52,_0x19f14e){if(_0x1bdf52&&_0x1bdf52['id']&&_0x1e850c[_0xbb8c('0x2f')]&&_0x1e850c[_0xbb8c('0x2f')][_0x1bdf52['id']]){_0x1e850c[_0xbb8c('0x2f')][_0x1bdf52['id']][_0x19f14e+_0xbb8c('0x30')][_0x88958d['message']['id']]={'id':_0x88958d[_0xbb8c('0x32')]['id']};}};exports[_0xbb8c('0x33')]=function(_0x17ea9d,_0x4893ab,_0x5c0d51,_0x25156b){if(_0x5c0d51&&_0x5c0d51['id']&&_0x17ea9d[_0xbb8c('0x2f')]&&_0x17ea9d[_0xbb8c('0x2f')][_0x5c0d51['id']]){delete _0x17ea9d[_0xbb8c('0x2f')][_0x5c0d51['id']][_0x25156b+'WaitingInteractions'][_0x4893ab[_0xbb8c('0x17')]['id']];}};exports[_0xbb8c('0x34')]=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 2ed81b5..1c877ad 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 _0x0ccb=['getMustacheRender','exec','trim','info','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','stringify','validate','shelljs','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x35eca4,_0xc8c267){var _0x58bbd5=function(_0x37d730){while(--_0x37d730){_0x35eca4['push'](_0x35eca4['shift']());}};_0x58bbd5(++_0xc8c267);}(_0x0ccb,0x77));var _0xb0cc=function(_0x102e39,_0x3b7ae9){_0x102e39=_0x102e39-0x0;var _0x5431ca=_0x0ccb[_0x102e39];return _0x5431ca;};'use strict';var schema=require(_0xb0cc('0x0'));var sh=require(_0xb0cc('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xb0cc('0x2'))('routing');var system=schema({'command':{'type':_0xb0cc('0x3'),'required':!![],'message':_0xb0cc('0x4')}});exports[_0xb0cc('0x5')]=function(_0xc2c86d,_0x13ded6){return function(_0x5f41ab){try{var _0x1310c1={'command':_0x13ded6[0x0]};var _0x320268=system[_0xb0cc('0x0')](_0x1310c1,{'typecast':!![]});if(_0x320268[_0xb0cc('0x6')]){logger[_0xb0cc('0x7')](_0xb0cc('0x8'),_0xc2c86d,_[_0xb0cc('0x9')](_0x320268,_0xb0cc('0xa'))[_0xb0cc('0xb')](',\x20'));logger['info'](_0xb0cc('0xc'),_0xc2c86d);_0x5f41ab['next']();}else{var _0x1e7650=this;var _0x52944b=utils[_0xb0cc('0xd')](_0x13ded6[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0xc2c86d,_0x52944b);sh[_0xb0cc('0xe')](_[_0xb0cc('0xf')](_0x52944b),function(_0x290150,_0x18fe8f){logger[_0xb0cc('0x10')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xc2c86d,_0x290150);if(_0x290150==0x0){var _0x3264a9=_0x18fe8f['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xb0cc('0x11')](_0x13ded6[0x1])||_['isEmpty'](_0x13ded6[0x1])){logger[_0xb0cc('0x10')]('[%s][SYSTEM]\x20no\x20variable',_0xc2c86d);_0x1e7650[_0xb0cc('0x12')][_0x13ded6[0x1]]=_0x3264a9;}else{logger[_0xb0cc('0x10')](_0xb0cc('0x13'),_0xc2c86d,_0x13ded6[0x1],_0x3264a9);_0x1e7650[_0xb0cc('0x12')][_0x13ded6[0x1]]=_0x3264a9;}}_0x5f41ab[_0xb0cc('0x14')]();});}}catch(_0x499c6b){logger['error'](_0xb0cc('0x8'),_0xc2c86d,_['isObject'](_0x499c6b)?JSON[_0xb0cc('0x15')](_0x499c6b):_0x499c6b);logger[_0xb0cc('0x10')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xc2c86d);_0x5f41ab[_0xb0cc('0x14')]();}};}; \ No newline at end of file +var _0xc7a2=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','isObject','stringify'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc7a2,0x118));var _0x2c7a=function(_0x347b96,_0x18ba98){_0x347b96=_0x347b96-0x0;var _0x19c17e=_0xc7a2[_0x347b96];return _0x19c17e;};'use strict';var schema=require(_0x2c7a('0x0'));var sh=require(_0x2c7a('0x1'));var _=require(_0x2c7a('0x2'));var utils=require(_0x2c7a('0x3'));var logger=require(_0x2c7a('0x4'))(_0x2c7a('0x5'));var system=schema({'command':{'type':_0x2c7a('0x6'),'required':!![],'message':_0x2c7a('0x7')}});exports[_0x2c7a('0x8')]=function(_0x302266,_0x430345){return function(_0x4b1a5b){try{var _0x1f8b14={'command':_0x430345[0x0]};var _0x241569=system[_0x2c7a('0x0')](_0x1f8b14,{'typecast':!![]});if(_0x241569[_0x2c7a('0x9')]){logger[_0x2c7a('0xa')](_0x2c7a('0xb'),_0x302266,_['map'](_0x241569,_0x2c7a('0xc'))[_0x2c7a('0xd')](',\x20'));logger[_0x2c7a('0xe')](_0x2c7a('0xf'),_0x302266);_0x4b1a5b[_0x2c7a('0x10')]();}else{var _0x43a8e3=this;var _0x4446c6=utils[_0x2c7a('0x11')](_0x430345[0x0],this);logger[_0x2c7a('0xe')](_0x2c7a('0x12'),_0x302266,_0x4446c6);sh[_0x2c7a('0x13')](_[_0x2c7a('0x14')](_0x4446c6),function(_0x47e23b,_0xa9ecc5){logger[_0x2c7a('0xe')](_0x2c7a('0x15'),_0x302266,_0x47e23b);if(_0x47e23b==0x0){var _0x5a5f5f=_0xa9ecc5[_0x2c7a('0x16')](/(\r\n|\n|\r)/gm,'');if(_[_0x2c7a('0x17')](_0x430345[0x1])||_[_0x2c7a('0x18')](_0x430345[0x1])){logger['info'](_0x2c7a('0x19'),_0x302266);_0x43a8e3['body'][_0x430345[0x1]]=_0x5a5f5f;}else{logger[_0x2c7a('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x302266,_0x430345[0x1],_0x5a5f5f);_0x43a8e3['body'][_0x430345[0x1]]=_0x5a5f5f;}}_0x4b1a5b[_0x2c7a('0x10')]();});}}catch(_0xe74d6f){logger['error'](_0x2c7a('0xb'),_0x302266,_[_0x2c7a('0x1a')](_0xe74d6f)?JSON[_0x2c7a('0x1b')](_0xe74d6f):_0xe74d6f);logger[_0x2c7a('0xe')](_0x2c7a('0xf'),_0x302266);_0x4b1a5b[_0x2c7a('0x10')]();}};}; \ 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 a1e1d4c..11b3d3c 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 _0xb89e=['consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','info','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x32056c,_0x1b6db7){var _0x317313=function(_0x6456b6){while(--_0x6456b6){_0x32056c['push'](_0x32056c['shift']());}};_0x317313(++_0x1b6db7);}(_0xb89e,0x1e3));var _0xeb89=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0xb89e[_0x3bb859];return _0x3bf534;};'use strict';var schema=require(_0xeb89('0x0'));var _=require(_0xeb89('0x1'));var rpc={'chatInteraction':require(_0xeb89('0x2')),'openchannelInteraction':require(_0xeb89('0x3')),'smsInteraction':require(_0xeb89('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xeb89('0x5'))};var logger=require(_0xeb89('0x6'))(_0xeb89('0x7'));var tag=schema({'tag':{'type':_0xeb89('0x8'),'required':!![],'message':_0xeb89('0x9')}});exports[_0xeb89('0xa')]=function(_0x9d3d63,_0x3f82be,_0x3b0b05,_0x51ac46){return function(_0xfc36fe){try{var _0x32c858={'tag':_0x3f82be[0x0]};var _0x2ae01a=tag[_0xeb89('0x0')](_0x32c858,{'typecast':!![]});if(_0x2ae01a[_0xeb89('0xb')]){logger[_0xeb89('0xc')](_0xeb89('0xd'),_0x9d3d63,_[_0xeb89('0xe')](_0x2ae01a,_0xeb89('0xf'))[_0xeb89('0x10')](',\x20'));logger['info'](_0xeb89('0x11'),_0x9d3d63);_0xfc36fe[_0xeb89('0x12')]();}else{var _0x1309b7={'ids':[_0x3f82be[0x0]]};if(rpc[_0x51ac46['channel']+_0xeb89('0x13')]){rpc[_0x51ac46[_0xeb89('0x14')]+_0xeb89('0x13')][_0xeb89('0x15')](_0x51ac46[_0xeb89('0x16')]['id'],_0x1309b7)[_0xeb89('0x17')](function(_0x4d762a){logger['info'](_0xeb89('0x18'),_0x9d3d63,_0x3f82be[0x1],_0x51ac46[_0xeb89('0x14')],_0x51ac46[_0xeb89('0x16')]['id']);})[_0xeb89('0x19')](function(_0x2b045c){logger[_0xeb89('0xc')]('[%s][TAG]\x20%s',_0x9d3d63,JSON[_0xeb89('0x1a')](_0x2b045c));logger[_0xeb89('0x1b')](_0xeb89('0x11'),_0x9d3d63);})[_0xeb89('0x1c')](function(){_0xfc36fe[_0xeb89('0x12')]();});}}}catch(_0x4ef52c){logger[_0xeb89('0xc')](_0xeb89('0xd'),_0x9d3d63,_['isObject'](_0x4ef52c)?JSON[_0xeb89('0x1a')](_0x4ef52c):_0x4ef52c);logger[_0xeb89('0x1b')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9d3d63);_0xfc36fe[_0xeb89('0x12')]();}};}; \ No newline at end of file +var _0xeb86=['interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction'];(function(_0x233b17,_0x2a92dd){var _0x2a04a4=function(_0x344cad){while(--_0x344cad){_0x233b17['push'](_0x233b17['shift']());}};_0x2a04a4(++_0x2a92dd);}(_0xeb86,0x19e));var _0x6eb8=function(_0x1bb666,_0x34749a){_0x1bb666=_0x1bb666-0x0;var _0x3e85a8=_0xeb86[_0x1bb666];return _0x3e85a8;};'use strict';var schema=require(_0x6eb8('0x0'));var _=require(_0x6eb8('0x1'));var rpc={'chatInteraction':require(_0x6eb8('0x2')),'openchannelInteraction':require(_0x6eb8('0x3')),'smsInteraction':require(_0x6eb8('0x4')),'mailInteraction':require(_0x6eb8('0x5')),'faxInteraction':require(_0x6eb8('0x6')),'whatsappInteraction':require(_0x6eb8('0x7'))};var logger=require(_0x6eb8('0x8'))(_0x6eb8('0x9'));var tag=schema({'tag':{'type':_0x6eb8('0xa'),'required':!![],'message':_0x6eb8('0xb')}});exports[_0x6eb8('0xc')]=function(_0x215f13,_0x4f90dc,_0x13c9ca,_0x558f12){return function(_0x57c3ae){try{var _0x31a29f={'tag':_0x4f90dc[0x0]};var _0x354abb=tag[_0x6eb8('0x0')](_0x31a29f,{'typecast':!![]});if(_0x354abb[_0x6eb8('0xd')]){logger[_0x6eb8('0xe')]('[%s][TAG]\x20%s',_0x215f13,_['map'](_0x354abb,_0x6eb8('0xf'))[_0x6eb8('0x10')](',\x20'));logger['info'](_0x6eb8('0x11'),_0x215f13);_0x57c3ae[_0x6eb8('0x12')]();}else{var _0x4c836b={'ids':[_0x4f90dc[0x0]]};if(rpc[_0x558f12[_0x6eb8('0x13')]+_0x6eb8('0x14')]){rpc[_0x558f12['channel']+_0x6eb8('0x14')]['addTags'](_0x558f12[_0x6eb8('0x15')]['id'],_0x4c836b)[_0x6eb8('0x16')](function(_0xc307c4){logger[_0x6eb8('0x17')](_0x6eb8('0x18'),_0x215f13,_0x4f90dc[0x1],_0x558f12['channel'],_0x558f12['interaction']['id']);})[_0x6eb8('0x19')](function(_0x311ec8){logger[_0x6eb8('0xe')]('[%s][TAG]\x20%s',_0x215f13,JSON[_0x6eb8('0x1a')](_0x311ec8));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x215f13);})[_0x6eb8('0x1b')](function(){_0x57c3ae[_0x6eb8('0x12')]();});}}}catch(_0x465aba){logger[_0x6eb8('0xe')]('[%s][TAG]\x20%s',_0x215f13,_[_0x6eb8('0x1c')](_0x465aba)?JSON['stringify'](_0x465aba):_0x465aba);logger[_0x6eb8('0x17')](_0x6eb8('0x11'),_0x215f13);_0x57c3ae[_0x6eb8('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 8883633..72c56b0 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dc2=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','POST','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','[%s][TVOX]\x20%s','isObject'];(function(_0x102b81,_0x1672ef){var _0x449000=function(_0x2d771a){while(--_0x2d771a){_0x102b81['push'](_0x102b81['shift']());}};_0x449000(++_0x1672ef);}(_0x5dc2,0x1dd));var _0x25dc=function(_0x3c87c6,_0xebaf63){_0x3c87c6=_0x3c87c6-0x0;var _0x18b3a7=_0x5dc2[_0x3c87c6];return _0x18b3a7;};'use strict';var rp=require(_0x25dc('0x0'));var logger=require('../../../../config/logger')(_0x25dc('0x1'));var _=require(_0x25dc('0x2'));var arr=[];exports[_0x25dc('0x3')]=function(_0x2d8b60,_0x29be35){return function(_0xb61f24){var _0x2d66b4=_0x29be35[0xa];var _0x1c3285=_0x29be35[0xb];var _0x5eef7b=_0x29be35[0xc];var _0x471122=_0x29be35[0xd];var _0x153611=_0x29be35[0xe];var _0x1f965e=_0x29be35[0xf][_0x25dc('0x4')](/\n/g,_0x25dc('0x5'));var _0x1aa774=_0x29be35[0x10][_0x25dc('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x1c3285)){arr[_0x25dc('0x6')](_0x1c3285);var _0xa7bcac=_0x29be35[0x3];var _0x20dbc9=_0x29be35[0x4];var _0x17e47b=_0x29be35[0x1];var _0x489ded=_0x29be35[0x0];var _0x6965f4={};_0x6965f4[_0x25dc('0x7')]=_0x29be35[0x8]+_0x25dc('0x8')+_0x5eef7b+'|'+_0x2d66b4+'|'+_0x471122+'|'+_0x1c3285+'|'+_0x153611;_0x6965f4[_0x25dc('0x9')]=_0x29be35[0x7]+_0x25dc('0x8')+_0x5eef7b+'|'+_0x2d66b4+'|'+_0x471122+'|'+_0x1c3285+'|'+_0x153611+'|'+_0x1f965e+'|'+_0x1aa774;_0x6965f4['title']=_0x29be35[0x9];var _0x3d100f={};_0x3d100f[_0x25dc('0xa')]=_0x25dc('0xb');_0x3d100f[_0x25dc('0xc')]=_0x25dc('0xd');var _0xd50d72=[];_0xd50d72['push'](_0x29be35[0x2]);_0xd50d72[_0x25dc('0x6')](_0x29be35[0x5]);_0xd50d72[_0x25dc('0x6')](_0x29be35[0x6]);_0x3d100f[_0x25dc('0xe')]=_0xd50d72;_0x3d100f['id']=0x1;var _0x4c8648=JSON[_0x25dc('0xf')](_0x3d100f);var _0x10326e={'encoding':'utf8','method':_0x25dc('0x10'),'timeout':0x2710,'url':_0xa7bcac,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4c8648};return rp(_0x10326e)[_0x25dc('0x11')](function(_0x93c56d){const _0x4341f9=JSON[_0x25dc('0x12')](_0x93c56d);if(!_0x4341f9['result'][_0x25dc('0x13')]){throw new Error(_0x25dc('0x14'));}var _0x47c6f4=_0x1c3285;var _0x21fc7f='channelId='+_0x17e47b+'&serviceId='+_0x489ded+'&sessionId='+_0x47c6f4+_0x25dc('0x15')+JSON[_0x25dc('0xf')](_0x6965f4);var _0x41effe=_0x20dbc9+'?'+_0x21fc7f;return rp(_0x41effe);})['then'](function(_0x5978e2){logger[_0x25dc('0x16')](_0x25dc('0x17'),_0x2d8b60,_0x5978e2);_0xb61f24[_0x25dc('0x18')]();})['catch'](function(_0x3cde9b){logger['error'](_0x25dc('0x19'),_0x2d8b60,_[_0x25dc('0x1a')](_0x3cde9b)?JSON[_0x25dc('0xf')](_0x3cde9b):_0x3cde9b);_0xb61f24[_0x25dc('0x18')]();});}else{logger[_0x25dc('0x16')](_0x25dc('0x1b'),_0x2d8b60);_0xb61f24['next']();}};}; \ No newline at end of file +var _0x7c51=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','stringify','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','replace','includes','?params=','urlOnRing','jsonrpc','method','login','push','utf8','POST','application/json-rpc','then','parse','result','logged'];(function(_0x56e310,_0xcfe4fb){var _0x3ad95f=function(_0x2e03aa){while(--_0x2e03aa){_0x56e310['push'](_0x56e310['shift']());}};_0x3ad95f(++_0xcfe4fb);}(_0x7c51,0xae));var _0x17c5=function(_0x517e5d,_0x2c1b7f){_0x517e5d=_0x517e5d-0x0;var _0x2967d8=_0x7c51[_0x517e5d];return _0x2967d8;};'use strict';var rp=require(_0x17c5('0x0'));var logger=require(_0x17c5('0x1'))(_0x17c5('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x2b2520,_0x245e72){return function(_0x407b27){var _0x24a6bb=_0x245e72[0xa];var _0x179d01=_0x245e72[0xb];var _0x57aadf=_0x245e72[0xc];var _0x2893b1=_0x245e72[0xd];var _0x212be6=_0x245e72[0xe];var _0x1b0385=_0x245e72[0xf][_0x17c5('0x3')](/\n/g,'\x20-\x20');var _0xf362d9=_0x245e72[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x17c5('0x4')](_0x179d01)){arr['push'](_0x179d01);var _0x776f49=_0x245e72[0x3];var _0x3ae93b=_0x245e72[0x4];var _0x4841b3=_0x245e72[0x1];var _0x429f61=_0x245e72[0x0];var _0x7962e9={};_0x7962e9['urlOnAnswer']=_0x245e72[0x8]+_0x17c5('0x5')+_0x57aadf+'|'+_0x24a6bb+'|'+_0x2893b1+'|'+_0x179d01+'|'+_0x212be6;_0x7962e9[_0x17c5('0x6')]=_0x245e72[0x7]+_0x17c5('0x5')+_0x57aadf+'|'+_0x24a6bb+'|'+_0x2893b1+'|'+_0x179d01+'|'+_0x212be6+'|'+_0x1b0385+'|'+_0xf362d9;_0x7962e9['title']=_0x245e72[0x9];var _0x524552={};_0x524552[_0x17c5('0x7')]='2.0';_0x524552[_0x17c5('0x8')]=_0x17c5('0x9');var _0x5cf8b6=[];_0x5cf8b6[_0x17c5('0xa')](_0x245e72[0x2]);_0x5cf8b6[_0x17c5('0xa')](_0x245e72[0x5]);_0x5cf8b6[_0x17c5('0xa')](_0x245e72[0x6]);_0x524552['params']=_0x5cf8b6;_0x524552['id']=0x1;var _0x2ac8c6=JSON['stringify'](_0x524552);var _0xe55c3f={'encoding':_0x17c5('0xb'),'method':_0x17c5('0xc'),'timeout':0x2710,'url':_0x776f49,'headers':{'Content-Type':_0x17c5('0xd')},'body':_0x2ac8c6};return rp(_0xe55c3f)[_0x17c5('0xe')](function(_0x220142){const _0x515020=JSON[_0x17c5('0xf')](_0x220142);if(!_0x515020[_0x17c5('0x10')][_0x17c5('0x11')]){throw new Error(_0x17c5('0x12'));}var _0x375775=_0x179d01;var _0x31bce2=_0x17c5('0x13')+_0x4841b3+_0x17c5('0x14')+_0x429f61+_0x17c5('0x15')+_0x375775+_0x17c5('0x16')+JSON['stringify'](_0x7962e9);var _0x5cefc6=_0x3ae93b+'?'+_0x31bce2;return rp(_0x5cefc6);})[_0x17c5('0xe')](function(_0x36514b){logger['info'](_0x17c5('0x17'),_0x2b2520,_0x36514b);_0x407b27[_0x17c5('0x18')]();})[_0x17c5('0x19')](function(_0x5aba55){logger[_0x17c5('0x1a')](_0x17c5('0x1b'),_0x2b2520,_['isObject'](_0x5aba55)?JSON[_0x17c5('0x1c')](_0x5aba55):_0x5aba55);_0x407b27[_0x17c5('0x18')]();});}else{logger[_0x17c5('0x1d')](_0x17c5('0x1e'),_0x2b2520);_0x407b27[_0x17c5('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index ec6b15c..f08b11f 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x20266b,_0x9eeba8){var _0x74f17a=function(_0x3fea3d){while(--_0x3fea3d){_0x20266b['push'](_0x20266b['shift']());}};_0x74f17a(++_0x9eeba8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3ebf88,_0x557ffb){var _0x27be98=function(_0x515b57){while(--_0x515b57){_0x3ebf88['push'](_0x3ebf88['shift']());}};_0x27be98(++_0x557ffb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7c0f8bf..e2642ca 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 _0x80e0=['body','format','./interval','intervals','consequence','priority','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','transfer','applications','isArray','length','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','appdata','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x347045,_0x3936c0){var _0xd5268f=function(_0x458c90){while(--_0x458c90){_0x347045['push'](_0x347045['shift']());}};_0xd5268f(++_0x3936c0);}(_0x80e0,0x9d));var _0x080e=function(_0x4b1575,_0x3aebcd){_0x4b1575=_0x4b1575-0x0;var _0x217f64=_0x80e0[_0x4b1575];return _0x217f64;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x080e('0x0'));var fs=require('fs');var jayson=require(_0x080e('0x1'));var BPromise=require(_0x080e('0x2'));var utils=require('./applications/utils');var sUtils=require(_0x080e('0x3'));var logger=require(_0x080e('0x4'))(_0x080e('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x080e('0x6')),'chatQueueReport':require(_0x080e('0x7')),'smsQueueReport':require(_0x080e('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0xd00ba7,_0x535ebf,_0x2886dd){return util['format'](_0x080e('0x9'),_0xd00ba7,_0x535ebf||0x0,_0x2886dd||0x0);}function getIntervals(_0x1241ec,_0x15ce45){var _0x43d2d5=[];if(!_[_0x080e('0xa')](_0x15ce45['IntervalId'])&&!_['isNil'](_0x1241ec[_0x15ce45[_0x080e('0xb')]])&&!_[_0x080e('0xa')](_0x1241ec[_0x15ce45[_0x080e('0xb')]][_0x080e('0xc')])){_0x43d2d5=_['map'](_0x1241ec[_0x15ce45['IntervalId']][_0x080e('0xc')],_0x080e('0xd'));}else if(!_[_0x080e('0xa')](_0x15ce45['interval'])){_0x43d2d5=[_0x15ce45[_0x080e('0xd')]];}return _0x43d2d5;}exports[_0x080e('0xe')]=function(_0x56c604){_0x56c604['rules']={};return new BPromise(function(_0x53b13c,_0x4a6e2b){var _0x3e49c0={'Start':function(_0x16429a){var _0x5816c8=this;return new Promise(function(_0x4d1a7d,_0x3394c1){if(_0x16429a){try{var _0x51f482=[];var _0x5b895f=getId(_0x16429a[_0x080e('0xf')],_0x16429a['message']?_0x16429a[_0x080e('0x10')]['id']:0x0,_0x16429a[_0x080e('0x11')]?_0x16429a[_0x080e('0x11')]['id']:0x0);var _0x12fb2b=sUtils['checkWaitingNotifications'](_0x56c604,_0x16429a);if(_0x16429a[_0x080e('0x12')]||!_0x12fb2b&&_0x16429a[_0x080e('0x13')]&&_[_0x080e('0x14')](_0x16429a['applications'])&&_0x16429a[_0x080e('0x13')][_0x080e('0x15')]){for(var _0x369d64=0x0;_0x369d64<_0x16429a['applications'][_0x080e('0x15')];_0x369d64+=0x1){var _0x3c3156=_0x16429a[_0x080e('0x13')][_0x369d64];if(fs['existsSync'](path[_0x080e('0x16')](__dirname,'applications',_0x3c3156[_0x080e('0x17')]+_0x080e('0x18')))){var _0x17d77c=[];switch(_0x3c3156[_0x080e('0x17')][_0x080e('0x19')]()){case _0x080e('0x1a'):var _0x309866=_0x3c3156['appdata'][_0x080e('0x1b')](',');if(_0x16429a[_0x080e('0xf')]===_0x080e('0x1c')){_0x17d77c[_0x080e('0x1d')](_0x309866[0x0]);_0x17d77c[_0x080e('0x1d')](_0x309866[0x1]);_0x17d77c[_0x080e('0x1d')](_0x309866[_0x080e('0x1e')](0x2,_0x309866[_0x080e('0x15')])[_0x080e('0x16')](','));}else{_0x17d77c[_0x080e('0x1d')](_0x309866[0x0]);_0x17d77c[_0x080e('0x1d')](_0x309866['slice'](0x1,_0x309866[_0x080e('0x15')])['join'](','));}break;case _0x080e('0x1f'):var _0x185445=_0x3c3156['appdata'][_0x080e('0x1b')](',');_0x17d77c[_0x080e('0x1d')](_0x185445[0x0]);_0x17d77c[_0x080e('0x1d')](_0x185445[0x1]);_0x17d77c[_0x080e('0x1d')](_0x185445[_0x080e('0x1e')](0x2,_0x185445[_0x080e('0x15')])[_0x080e('0x16')](','));break;case _0x080e('0x20'):var _0xae3f62=_0x3c3156['appdata']['split'](',');_0x17d77c[_0x080e('0x1d')](_0xae3f62[0x0]);_0x17d77c[_0x080e('0x1d')](_0xae3f62[0x1]);_0x17d77c[_0x080e('0x1d')](_0xae3f62[0x2]);_0x17d77c[_0x080e('0x1d')](_0xae3f62[0x3]);_0x17d77c[_0x080e('0x1d')](_0xae3f62[_0x080e('0x1e')](0x4,_0xae3f62[_0x080e('0x15')])[_0x080e('0x16')](','));break;case _0x080e('0x21'):var _0x3081c0=_0x3c3156[_0x080e('0x22')][_0x080e('0x1b')](',');_0x17d77c[_0x080e('0x1d')](_0x3081c0[0x0]);_0x17d77c['push'](_0x3081c0[0x1]);_0x17d77c[_0x080e('0x1d')](_0x3081c0[0x2]);_0x17d77c['push'](_0x3081c0[0x3]);_0x17d77c[_0x080e('0x1d')](_0x3081c0[_0x080e('0x1e')](0x4,_0x3081c0[_0x080e('0x15')])[_0x080e('0x16')](','));break;case _0x080e('0x10'):_0x17d77c[_0x080e('0x1d')](_0x3c3156[_0x080e('0x22')]);break;case _0x080e('0x23'):_0x17d77c[_0x080e('0x1d')](_0x3c3156[_0x080e('0x24')]);_0x17d77c[_0x080e('0x1d')](_0x3c3156[_0x080e('0x22')]);break;case _0x080e('0x25'):var _0x5f50ec=utils[_0x080e('0x26')](_0x16429a[_0x080e('0x27')][_0x080e('0x28')],_0x16429a);var _0x5f24ea=_0x3c3156[_0x080e('0x22')][_0x080e('0x1b')](',');_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x0]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x1]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x2]);_0x17d77c['push'](_0x5f24ea[0x3]);_0x17d77c['push'](_0x5f24ea[0x4]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x5]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x6]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x7]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x8]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0x9]);_0x17d77c[_0x080e('0x1d')](_0x5f24ea[0xa]);_0x17d77c[_0x080e('0x1d')](_0x16429a[_0x080e('0x11')]['id']);_0x17d77c['push'](_0x16429a[_0x080e('0x10')]['id']);_0x17d77c['push'](_0x3c3156[_0x080e('0x29')]);_0x17d77c[_0x080e('0x1d')](_0x16429a[_0x080e('0x11')][_0x080e('0x2a')]);_0x17d77c[_0x080e('0x1d')](_0x16429a[_0x080e('0x2b')][_0x080e('0x2b')]);_0x17d77c[_0x080e('0x1d')](_0x5f50ec);break;default:_0x17d77c=_[_0x080e('0xa')](_0x3c3156[_0x080e('0x22')])?[]:_0x3c3156[_0x080e('0x22')][_0x080e('0x1b')](',');}var _0x8938be={'id':util[_0x080e('0x2c')]('%s:%s:%s',_0x5b895f,_0x3c3156['id'],_0x3c3156[_0x080e('0x17')]),'condition':require(_0x080e('0x2d'))['condition'](_0x5b895f,getIntervals(_0x56c604[_0x080e('0x2e')],_0x3c3156),_0x56c604),'consequence':require('./applications/'+_0x3c3156[_0x080e('0x17')])[_0x080e('0x2f')](_0x5b895f,_0x17d77c,_0x56c604,_0x16429a),'p':_0x3c3156[_0x080e('0x30')]||0x0};logger['info']('Push\x20new\x20rule',_0x8938be['id'],'on\x20interval',getIntervals(_0x56c604['intervals'],_0x3c3156)[_0x080e('0x16')](_0x080e('0x31')));_0x51f482[_0x080e('0x1d')](_0x8938be);}else{logger[_0x080e('0x32')](_0x080e('0x33'),path[_0x080e('0x16')](__dirname,_0x080e('0x13'),_0x3c3156[_0x080e('0x17')]+_0x080e('0x18')));}}_0x56c604['rules'][_0x5b895f]=new RuleEngine(_0x51f482);_0x56c604[_0x080e('0x34')][_0x5b895f][_0x080e('0x35')](_0x16429a,function(_0x52847b){logger[_0x080e('0x36')](_0x080e('0x37'),JSON[_0x080e('0x38')](_0x52847b[_0x080e('0x39')]));if(_0x56c604[_0x080e('0x34')][_0x5b895f]){_0x56c604[_0x080e('0x34')][_0x5b895f][_0x080e('0x3a')](_0x080e('0x3b'));}});return _0x4d1a7d({'code':0xc8,'message':_0x16429a});}else{if(_0x12fb2b){logger[_0x080e('0x36')](util['format']('Skipped\x20routing\x20for\x20%s',_0x5b895f));}else{logger[_0x080e('0x36')]('No\x20applications\x20to\x20execute');}return _0x4d1a7d({'code':0xc8,'message':_0x16429a});}}catch(_0x1d4a13){logger[_0x080e('0x32')](_0x1d4a13[_0x080e('0x3c')]);return _0x3394c1(_0x5816c8[_0x080e('0x32')](0x1f4,_0x1d4a13));}}return _0x3394c1(_0x080e('0x3d'));});},'AcceptMessage':function(_0x3f6754){var _0x569fcd=this;return new Promise(function(_0x434ab3,_0x130210){if(_0x3f6754['agent']&&_0x3f6754[_0x080e('0x3e')]['id']){if(_0x56c604[_0x080e('0x3f')][_0x3f6754['agent']['id']]){_0x56c604['agents'][_0x3f6754[_0x080e('0x3e')]['id']][_0x080e('0x40')]=![];_0x56c604[_0x080e('0x3f')][_0x3f6754[_0x080e('0x3e')]['id']][_0x080e('0x41')]=undefined;}}if(_0x3f6754[_0x080e('0x10')]&&_0x3f6754['message']['id']){try{var _0x4f9bd2=getId(_0x3f6754[_0x080e('0xf')],_0x3f6754['message']?_0x3f6754['message']['id']:0x0,_0x3f6754['interaction']?_0x3f6754[_0x080e('0x11')]['id']:0x0);if(_0x56c604[_0x080e('0x34')][_0x4f9bd2]){_0x56c604[_0x080e('0x34')][_0x4f9bd2][_0x080e('0x3a')](_0x080e('0x42'));if(rpc[_0x3f6754['channel']+_0x080e('0x43')]){rpc[_0x3f6754[_0x080e('0xf')]+'QueueReport'][_0x080e('0x44')](_0x4f9bd2,{'UserId':_0x3f6754[_0x080e('0x10')][_0x080e('0x45')]})[_0x080e('0x46')](function(){logger[_0x080e('0x32')](_0x080e('0x47'));});}}return _0x434ab3({'code':0xc8,'message':_0x3f6754});}catch(_0x195d1c){logger[_0x080e('0x32')](_0x195d1c[_0x080e('0x3c')]);return _0x130210(_0x569fcd[_0x080e('0x32')](0x1f4,_0x195d1c));}}logger[_0x080e('0x32')](_0x080e('0x48'));return _0x130210(_0x569fcd[_0x080e('0x32')](0x1f4,_0x080e('0x48')));});},'RejectMessage':function(_0x2a7171){var _0xb40664=this;return new Promise(function(_0x38f402,_0x43e52d){if(_0x2a7171['agent']&&_0x2a7171[_0x080e('0x3e')]['id']){try{if(_0x56c604['agents'][_0x2a7171[_0x080e('0x3e')]['id']]){_0x56c604['agents'][_0x2a7171['agent']['id']][_0x080e('0x40')]=![];_0x56c604[_0x080e('0x3f')][_0x2a7171[_0x080e('0x3e')]['id']]['busyQueue']=undefined;}return _0x38f402({'code':0xc8,'message':_0x2a7171});}catch(_0x1fcc65){logger[_0x080e('0x32')](_0x1fcc65[_0x080e('0x3c')]);return _0x43e52d(_0xb40664[_0x080e('0x32')](0x1f4,_0x1fcc65));}}logger[_0x080e('0x32')](_0x080e('0x48'));return _0x43e52d(_0xb40664[_0x080e('0x32')](0x1f4,_0x080e('0x48')));});},'AbandonInteraction':function(_0x41cf3a){var _0x27e7bb=this;return new Promise(function(_0x2e05c1,_0x4dc592){if(_0x41cf3a[_0x080e('0xf')]&&_0x41cf3a[_0x080e('0x11')]&&_0x41cf3a['interaction']['id']){try{var _0x5af035=getId(_0x41cf3a['channel'],_0x41cf3a[_0x080e('0x10')]?_0x41cf3a[_0x080e('0x10')]['id']:0x0,_0x41cf3a['interaction']?_0x41cf3a['interaction']['id']:0x0);if(_0x56c604[_0x080e('0x34')][_0x5af035]){_0x56c604[_0x080e('0x34')][_0x5af035][_0x080e('0x3a')](_0x080e('0x42'));}return _0x2e05c1({'code':0xc8,'message':_0x41cf3a});}catch(_0x2cc161){logger['error'](_0x2cc161[_0x080e('0x3c')]);return _0x4dc592(_0x27e7bb[_0x080e('0x32')](0x1f4,_0x2cc161));}}logger[_0x080e('0x32')]('message\x20is\x20empty');return _0x4dc592(_0x27e7bb[_0x080e('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x51f486){var _0x2213a6=this;return new Promise(function(_0x18dd3c,_0x1a12be){if(_0x56c604[_0x080e('0x3f')]['hasOwnProperty'](_0x51f486['id'])){for(var _0x9459ac in _0x51f486[_0x080e('0x49')]){if(_0x51f486[_0x080e('0x49')][_0x080e('0x4a')](_0x9459ac)){if(_0x56c604[_0x080e('0x3f')][_0x51f486['id']]['hasOwnProperty'](_0x9459ac+_0x080e('0x4b'))){_0x56c604[_0x080e('0x3f')][_0x51f486['id']][_0x9459ac+_0x080e('0x4b')]=parseInt(_0x51f486[_0x080e('0x49')][_0x9459ac],0xa);}}}_0x56c604[_0x080e('0x3f')][_0x51f486['id']]['updateRealtime']();return _0x18dd3c({'code':0xc8,'message':_0x56c604[_0x080e('0x3f')][_0x51f486['id']]});}else{return _0x1a12be(_0x2213a6['error'](0x1f4,_0x080e('0x4c')));}});},'Agents':function(_0x15b521){return new Promise(function(_0x7d6ef0){var _0x49aff6=_[_0x080e('0x4d')](_0x56c604[_0x080e('0x3f')]);if(_0x15b521&&_0x15b521['id']){var _0x450136=_[_0x080e('0x4e')](_0x49aff6,function(_0x1c38bd){return _0x1c38bd['id']===_0x15b521['id'];});_0x7d6ef0(_0x450136);}else{_0x7d6ef0({'count':_0x49aff6['length'],'rows':_0x49aff6});}});},'ChatQueues':function(){return new Promise(function(_0x2b2065){var _0x4dc46c=[];for(var _0x42e380 in _0x56c604[_0x080e('0x4f')]){if(_0x56c604[_0x080e('0x4f')]['hasOwnProperty'](_0x42e380)){var _0x48524c=_0x56c604[_0x080e('0x4f')][_0x42e380];var _0x4e7572={'id':_0x48524c['id'],'available':_0x48524c[_0x080e('0x50')],'loggedIn':_0x48524c[_0x080e('0x51')],'name':_0x48524c[_0x080e('0x52')],'paused':_0x48524c[_0x080e('0x53')],'waiting':_0x48524c[_0x080e('0x54')]};_0x4dc46c['push'](_0x4e7572);}}_0x2b2065({'count':_0x4dc46c[_0x080e('0x15')],'rows':_0x4dc46c});});},'MailQueues':function(){return new Promise(function(_0xea7723){var _0x38ad2e=[];for(var _0x3628d6 in _0x56c604['mailQueues']){if(_0x56c604['mailQueues'][_0x080e('0x4a')](_0x3628d6)){var _0x569654=_0x56c604[_0x080e('0x55')][_0x3628d6];var _0x2769b5={'id':_0x569654['id'],'available':_0x569654[_0x080e('0x50')],'loggedIn':_0x569654[_0x080e('0x51')],'name':_0x569654[_0x080e('0x52')],'paused':_0x569654[_0x080e('0x53')],'waiting':_0x569654['waiting']};_0x38ad2e[_0x080e('0x1d')](_0x2769b5);}}_0xea7723({'count':_0x38ad2e[_0x080e('0x15')],'rows':_0x38ad2e});});},'OpenchannelQueues':function(){return new Promise(function(_0x4c5d67){var _0x460c19=[];for(var _0x2a8cf3 in _0x56c604['openchannelQueues']){if(_0x56c604[_0x080e('0x56')]['hasOwnProperty'](_0x2a8cf3)){var _0x29ed7d=_0x56c604[_0x080e('0x56')][_0x2a8cf3];var _0x2aee7b={'id':_0x29ed7d['id'],'available':_0x29ed7d[_0x080e('0x50')],'loggedIn':_0x29ed7d[_0x080e('0x51')],'name':_0x29ed7d[_0x080e('0x52')],'paused':_0x29ed7d[_0x080e('0x53')],'waiting':_0x29ed7d[_0x080e('0x54')]};_0x460c19[_0x080e('0x1d')](_0x2aee7b);}}_0x4c5d67({'count':_0x460c19[_0x080e('0x15')],'rows':_0x460c19});});},'SmsQueues':function(){return new Promise(function(_0x950423){var _0x8eab68=[];for(var _0x40004e in _0x56c604[_0x080e('0x57')]){if(_0x56c604['smsQueues'][_0x080e('0x4a')](_0x40004e)){var _0x32d8aa=_0x56c604[_0x080e('0x57')][_0x40004e];var _0xbdb9d0={'id':_0x32d8aa['id'],'available':_0x32d8aa[_0x080e('0x50')],'loggedIn':_0x32d8aa[_0x080e('0x51')],'name':_0x32d8aa[_0x080e('0x52')],'paused':_0x32d8aa['paused'],'waiting':_0x32d8aa[_0x080e('0x54')]};_0x8eab68[_0x080e('0x1d')](_0xbdb9d0);}}_0x950423({'count':_0x8eab68[_0x080e('0x15')],'rows':_0x8eab68});});},'FaxQueues':function(){return new Promise(function(_0x279c26){var _0x585e10=[];for(var _0x39289a in _0x56c604[_0x080e('0x58')]){if(_0x56c604['faxQueues']['hasOwnProperty'](_0x39289a)){var _0x5dbe1e=_0x56c604[_0x080e('0x58')][_0x39289a];var _0x1f87cc={'id':_0x5dbe1e['id'],'available':_0x5dbe1e[_0x080e('0x50')],'loggedIn':_0x5dbe1e[_0x080e('0x51')],'name':_0x5dbe1e['name'],'paused':_0x5dbe1e[_0x080e('0x53')],'waiting':_0x5dbe1e[_0x080e('0x54')]};_0x585e10[_0x080e('0x1d')](_0x1f87cc);}}_0x279c26({'count':_0x585e10[_0x080e('0x15')],'rows':_0x585e10});});},'WhatsappQueues':function(){return new Promise(function(_0x1ff0fa){var _0x5b73b1=[];for(var _0x226461 in _0x56c604[_0x080e('0x59')]){if(_0x56c604['whatsappQueues'][_0x080e('0x4a')](_0x226461)){var _0x2160d7=_0x56c604[_0x080e('0x59')][_0x226461];var _0x233d47={'id':_0x2160d7['id'],'available':_0x2160d7[_0x080e('0x50')],'loggedIn':_0x2160d7[_0x080e('0x51')],'name':_0x2160d7['name'],'paused':_0x2160d7['paused'],'waiting':_0x2160d7[_0x080e('0x54')]};_0x5b73b1['push'](_0x233d47);}}_0x1ff0fa({'count':_0x5b73b1[_0x080e('0x15')],'rows':_0x5b73b1});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x50be9e){var _0x3d015c=_['values'](_0x56c604[_0x080e('0x5a')]);_0x50be9e({'count':_0x3d015c[_0x080e('0x15')],'rows':_0x3d015c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x510dfd){var _0x3118f9=_[_0x080e('0x4d')](_0x56c604[_0x080e('0x5b')]);_0x510dfd({'count':_0x3118f9['length'],'rows':_0x3118f9});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x16e4e0){var _0x48057a=_['values'](_0x56c604[_0x080e('0x5c')]);_0x16e4e0({'count':_0x48057a[_0x080e('0x15')],'rows':_0x48057a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3bfa04){var _0x17a609=_[_0x080e('0x4d')](_0x56c604[_0x080e('0x5d')]);_0x3bfa04({'count':_0x17a609[_0x080e('0x15')],'rows':_0x17a609});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1445a2){var _0x7093a1=_[_0x080e('0x4d')](_0x56c604[_0x080e('0x5e')]);_0x1445a2({'count':_0x7093a1[_0x080e('0x15')],'rows':_0x7093a1});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x379266){var _0x4f0831=_['values'](_0x56c604[_0x080e('0x5f')]);_0x379266({'count':_0x4f0831[_0x080e('0x15')],'rows':_0x4f0831});});}};var _0x75ea8c=jayson['server'](_0x3e49c0)[_0x080e('0x60')]();_0x75ea8c['on'](_0x080e('0x32'),function(_0x207c97){logger[_0x080e('0x32')](JSON['stringify'](_0x207c97));return _0x4a6e2b(_0x207c97);});_0x75ea8c['listen'](0x232c,_0x080e('0x61'),function(){console[_0x080e('0x62')](_0x080e('0x63'),0x232c);return _0x53b13c('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x8b8e=['body','format','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','execute','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','appdata','push','slice','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x8b8e,0x108));var _0xe8b8=function(_0x29f905,_0x5d45a2){_0x29f905=_0x29f905-0x0;var _0x562d8a=_0x8b8e[_0x29f905];return _0x562d8a;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var path=require(_0xe8b8('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xe8b8('0x2'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0xe8b8('0x3'))(_0xe8b8('0x4'));var rpc={'openchannelQueueReport':require(_0xe8b8('0x5')),'mailQueueReport':require(_0xe8b8('0x6')),'chatQueueReport':require(_0xe8b8('0x7')),'smsQueueReport':require(_0xe8b8('0x8')),'faxQueueReport':require(_0xe8b8('0x9')),'whatsappQueueReport':require(_0xe8b8('0xa'))};var RuleEngine=require(_0xe8b8('0xb'));function getId(_0x2540e3,_0x4ce796,_0x2a4ccd){return util['format'](_0xe8b8('0xc'),_0x2540e3,_0x4ce796||0x0,_0x2a4ccd||0x0);}function getIntervals(_0x4ea70a,_0x48b59f){var _0x2ccbeb=[];if(!_[_0xe8b8('0xd')](_0x48b59f['IntervalId'])&&!_['isNil'](_0x4ea70a[_0x48b59f[_0xe8b8('0xe')]])&&!_[_0xe8b8('0xd')](_0x4ea70a[_0x48b59f[_0xe8b8('0xe')]][_0xe8b8('0xf')])){_0x2ccbeb=_[_0xe8b8('0x10')](_0x4ea70a[_0x48b59f[_0xe8b8('0xe')]][_0xe8b8('0xf')],_0xe8b8('0x11'));}else if(!_[_0xe8b8('0xd')](_0x48b59f[_0xe8b8('0x11')])){_0x2ccbeb=[_0x48b59f[_0xe8b8('0x11')]];}return _0x2ccbeb;}exports[_0xe8b8('0x12')]=function(_0x30bfc7){_0x30bfc7[_0xe8b8('0x13')]={};return new BPromise(function(_0x4a3e9f,_0x3df267){var _0x52ff32={'Start':function(_0x282ea8){var _0x290c30=this;return new Promise(function(_0x288699,_0x36df40){if(_0x282ea8){try{var _0x3d9e34=[];var _0x2fdd5b=getId(_0x282ea8[_0xe8b8('0x14')],_0x282ea8[_0xe8b8('0x15')]?_0x282ea8[_0xe8b8('0x15')]['id']:0x0,_0x282ea8[_0xe8b8('0x16')]?_0x282ea8['interaction']['id']:0x0);var _0xbaca4a=sUtils[_0xe8b8('0x17')](_0x30bfc7,_0x282ea8);if(_0x282ea8['transfer']||!_0xbaca4a&&_0x282ea8[_0xe8b8('0x18')]&&_[_0xe8b8('0x19')](_0x282ea8[_0xe8b8('0x18')])&&_0x282ea8[_0xe8b8('0x18')][_0xe8b8('0x1a')]){for(var _0x23a0ad=0x0;_0x23a0ad<_0x282ea8[_0xe8b8('0x18')][_0xe8b8('0x1a')];_0x23a0ad+=0x1){var _0x29e96=_0x282ea8[_0xe8b8('0x18')][_0x23a0ad];if(fs[_0xe8b8('0x1b')](path[_0xe8b8('0x1c')](__dirname,_0xe8b8('0x18'),_0x29e96[_0xe8b8('0x1d')]+_0xe8b8('0x1e')))){var _0x838cd4=[];switch(_0x29e96[_0xe8b8('0x1d')]['toLowerCase']()){case'autoreply':var _0x566721=_0x29e96[_0xe8b8('0x1f')]['split'](',');if(_0x282ea8[_0xe8b8('0x14')]==='mail'){_0x838cd4[_0xe8b8('0x20')](_0x566721[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x566721[0x1]);_0x838cd4['push'](_0x566721['slice'](0x2,_0x566721[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));}else{_0x838cd4['push'](_0x566721[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x566721[_0xe8b8('0x21')](0x1,_0x566721[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));}break;case _0xe8b8('0x22'):var _0x4c2f6d=_0x29e96[_0xe8b8('0x1f')]['split'](',');_0x838cd4[_0xe8b8('0x20')](_0x4c2f6d[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x4c2f6d[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x4c2f6d[_0xe8b8('0x21')](0x2,_0x4c2f6d['length'])['join'](','));break;case _0xe8b8('0x23'):var _0x3e6014=_0x29e96[_0xe8b8('0x1f')][_0xe8b8('0x24')](',');_0x838cd4[_0xe8b8('0x20')](_0x3e6014[0x0]);_0x838cd4['push'](_0x3e6014[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x3e6014[0x2]);_0x838cd4[_0xe8b8('0x20')](_0x3e6014[0x3]);_0x838cd4[_0xe8b8('0x20')](_0x3e6014[_0xe8b8('0x21')](0x4,_0x3e6014[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));break;case _0xe8b8('0x25'):var _0x3c32a6=_0x29e96[_0xe8b8('0x1f')][_0xe8b8('0x24')](',');_0x838cd4[_0xe8b8('0x20')](_0x3c32a6[0x0]);_0x838cd4['push'](_0x3c32a6[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x3c32a6[0x2]);_0x838cd4[_0xe8b8('0x20')](_0x3c32a6[0x3]);_0x838cd4[_0xe8b8('0x20')](_0x3c32a6['slice'](0x4,_0x3c32a6[_0xe8b8('0x1a')])[_0xe8b8('0x1c')](','));break;case _0xe8b8('0x15'):_0x838cd4[_0xe8b8('0x20')](_0x29e96[_0xe8b8('0x1f')]);break;case _0xe8b8('0x26'):_0x838cd4[_0xe8b8('0x20')](_0x29e96[_0xe8b8('0x27')]);_0x838cd4[_0xe8b8('0x20')](_0x29e96['appdata']);break;case _0xe8b8('0x28'):var _0x1b74c4=utils['getMustacheRender'](_0x282ea8[_0xe8b8('0x29')][_0xe8b8('0x2a')],_0x282ea8);var _0x332295=_0x29e96[_0xe8b8('0x1f')][_0xe8b8('0x24')](',');_0x838cd4['push'](_0x332295[0x0]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x1]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x2]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x3]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x4]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x5]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x6]);_0x838cd4['push'](_0x332295[0x7]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0x8]);_0x838cd4['push'](_0x332295[0x9]);_0x838cd4[_0xe8b8('0x20')](_0x332295[0xa]);_0x838cd4[_0xe8b8('0x20')](_0x282ea8['interaction']['id']);_0x838cd4['push'](_0x282ea8[_0xe8b8('0x15')]['id']);_0x838cd4[_0xe8b8('0x20')](_0x29e96[_0xe8b8('0x2b')]);_0x838cd4[_0xe8b8('0x20')](_0x282ea8['interaction'][_0xe8b8('0x2c')]);_0x838cd4[_0xe8b8('0x20')](_0x282ea8[_0xe8b8('0x2d')][_0xe8b8('0x2d')]);_0x838cd4[_0xe8b8('0x20')](_0x1b74c4);break;default:_0x838cd4=_[_0xe8b8('0xd')](_0x29e96[_0xe8b8('0x1f')])?[]:_0x29e96[_0xe8b8('0x1f')]['split'](',');}var _0x4d63a0={'id':util[_0xe8b8('0x2e')](_0xe8b8('0x2f'),_0x2fdd5b,_0x29e96['id'],_0x29e96[_0xe8b8('0x1d')]),'condition':require('./interval')[_0xe8b8('0x30')](_0x2fdd5b,getIntervals(_0x30bfc7[_0xe8b8('0x31')],_0x29e96),_0x30bfc7),'consequence':require(_0xe8b8('0x32')+_0x29e96[_0xe8b8('0x1d')])[_0xe8b8('0x33')](_0x2fdd5b,_0x838cd4,_0x30bfc7,_0x282ea8),'p':_0x29e96[_0xe8b8('0x34')]||0x0};logger[_0xe8b8('0x35')]('Push\x20new\x20rule',_0x4d63a0['id'],'on\x20interval',getIntervals(_0x30bfc7['intervals'],_0x29e96)[_0xe8b8('0x1c')](_0xe8b8('0x36')));_0x3d9e34[_0xe8b8('0x20')](_0x4d63a0);}else{logger[_0xe8b8('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe8b8('0x1c')](__dirname,_0xe8b8('0x18'),_0x29e96[_0xe8b8('0x1d')]+_0xe8b8('0x1e')));}}_0x30bfc7['rules'][_0x2fdd5b]=new RuleEngine(_0x3d9e34);_0x30bfc7['rules'][_0x2fdd5b][_0xe8b8('0x38')](_0x282ea8,function(_0x376c8c){logger[_0xe8b8('0x35')]('Applications\x20executed',JSON[_0xe8b8('0x39')](_0x376c8c[_0xe8b8('0x3a')]));if(_0x30bfc7[_0xe8b8('0x13')][_0x2fdd5b]){_0x30bfc7[_0xe8b8('0x13')][_0x2fdd5b]['emit'](_0xe8b8('0x3b'));}});return _0x288699({'code':0xc8,'message':_0x282ea8});}else{if(_0xbaca4a){logger[_0xe8b8('0x35')](util[_0xe8b8('0x2e')](_0xe8b8('0x3c'),_0x2fdd5b));}else{logger[_0xe8b8('0x35')](_0xe8b8('0x3d'));}return _0x288699({'code':0xc8,'message':_0x282ea8});}}catch(_0x1a8380){logger[_0xe8b8('0x37')](_0x1a8380[_0xe8b8('0x3e')]);return _0x36df40(_0x290c30[_0xe8b8('0x37')](0x1f4,_0x1a8380));}}return _0x36df40(_0xe8b8('0x3f'));});},'AcceptMessage':function(_0xb51b61){var _0x562d50=this;return new Promise(function(_0x4e7cc8,_0x442c58){if(_0xb51b61[_0xe8b8('0x40')]&&_0xb51b61[_0xe8b8('0x40')]['id']){if(_0x30bfc7[_0xe8b8('0x41')][_0xb51b61[_0xe8b8('0x40')]['id']]){_0x30bfc7[_0xe8b8('0x41')][_0xb51b61[_0xe8b8('0x40')]['id']]['busy']=![];_0x30bfc7['agents'][_0xb51b61[_0xe8b8('0x40')]['id']][_0xe8b8('0x42')]=undefined;}}if(_0xb51b61['message']&&_0xb51b61[_0xe8b8('0x15')]['id']){try{var _0x1e61eb=getId(_0xb51b61[_0xe8b8('0x14')],_0xb51b61[_0xe8b8('0x15')]?_0xb51b61[_0xe8b8('0x15')]['id']:0x0,_0xb51b61[_0xe8b8('0x16')]?_0xb51b61[_0xe8b8('0x16')]['id']:0x0);if(_0x30bfc7[_0xe8b8('0x13')][_0x1e61eb]){_0x30bfc7[_0xe8b8('0x13')][_0x1e61eb][_0xe8b8('0x43')](_0xe8b8('0x44'));if(rpc[_0xb51b61[_0xe8b8('0x14')]+'QueueReport']){rpc[_0xb51b61[_0xe8b8('0x14')]+'QueueReport'][_0xe8b8('0x45')](_0x1e61eb,{'UserId':_0xb51b61[_0xe8b8('0x15')][_0xe8b8('0x46')]})[_0xe8b8('0x47')](function(){logger['error'](_0xe8b8('0x48'));});}}return _0x4e7cc8({'code':0xc8,'message':_0xb51b61});}catch(_0x250a2c){logger['error'](_0x250a2c[_0xe8b8('0x3e')]);return _0x442c58(_0x562d50[_0xe8b8('0x37')](0x1f4,_0x250a2c));}}logger[_0xe8b8('0x37')](_0xe8b8('0x49'));return _0x442c58(_0x562d50[_0xe8b8('0x37')](0x1f4,_0xe8b8('0x49')));});},'RejectMessage':function(_0x487e3a){var _0x163b6d=this;return new Promise(function(_0x4d9971,_0x53cef6){if(_0x487e3a[_0xe8b8('0x40')]&&_0x487e3a[_0xe8b8('0x40')]['id']){try{if(_0x30bfc7[_0xe8b8('0x41')][_0x487e3a[_0xe8b8('0x40')]['id']]){_0x30bfc7[_0xe8b8('0x41')][_0x487e3a[_0xe8b8('0x40')]['id']][_0xe8b8('0x4a')]=![];_0x30bfc7[_0xe8b8('0x41')][_0x487e3a[_0xe8b8('0x40')]['id']][_0xe8b8('0x42')]=undefined;}return _0x4d9971({'code':0xc8,'message':_0x487e3a});}catch(_0x1230e7){logger['error'](_0x1230e7[_0xe8b8('0x3e')]);return _0x53cef6(_0x163b6d[_0xe8b8('0x37')](0x1f4,_0x1230e7));}}logger[_0xe8b8('0x37')](_0xe8b8('0x49'));return _0x53cef6(_0x163b6d['error'](0x1f4,_0xe8b8('0x49')));});},'AbandonInteraction':function(_0x4c419a){var _0x385e35=this;return new Promise(function(_0x46ff8d,_0x4ab15e){if(_0x4c419a[_0xe8b8('0x14')]&&_0x4c419a['interaction']&&_0x4c419a[_0xe8b8('0x16')]['id']){try{var _0x38a515=getId(_0x4c419a[_0xe8b8('0x14')],_0x4c419a['message']?_0x4c419a[_0xe8b8('0x15')]['id']:0x0,_0x4c419a[_0xe8b8('0x16')]?_0x4c419a[_0xe8b8('0x16')]['id']:0x0);if(_0x30bfc7[_0xe8b8('0x13')][_0x38a515]){_0x30bfc7[_0xe8b8('0x13')][_0x38a515][_0xe8b8('0x43')]('end');}return _0x46ff8d({'code':0xc8,'message':_0x4c419a});}catch(_0xf1c20e){logger[_0xe8b8('0x37')](_0xf1c20e[_0xe8b8('0x3e')]);return _0x4ab15e(_0x385e35[_0xe8b8('0x37')](0x1f4,_0xf1c20e));}}logger[_0xe8b8('0x37')](_0xe8b8('0x49'));return _0x4ab15e(_0x385e35[_0xe8b8('0x37')](0x1f4,_0xe8b8('0x49')));});},'AgentCapacity':function(_0xf897ae){var _0x497844=this;return new Promise(function(_0x54a920,_0x5c880f){if(_0x30bfc7['agents'][_0xe8b8('0x4b')](_0xf897ae['id'])){for(var _0x40cd55 in _0xf897ae[_0xe8b8('0x4c')]){if(_0xf897ae[_0xe8b8('0x4c')][_0xe8b8('0x4b')](_0x40cd55)){if(_0x30bfc7[_0xe8b8('0x41')][_0xf897ae['id']][_0xe8b8('0x4b')](_0x40cd55+_0xe8b8('0x4d'))){_0x30bfc7[_0xe8b8('0x41')][_0xf897ae['id']][_0x40cd55+_0xe8b8('0x4d')]=parseInt(_0xf897ae[_0xe8b8('0x4c')][_0x40cd55],0xa);}}}_0x30bfc7[_0xe8b8('0x41')][_0xf897ae['id']][_0xe8b8('0x4e')]();return _0x54a920({'code':0xc8,'message':_0x30bfc7['agents'][_0xf897ae['id']]});}else{return _0x5c880f(_0x497844[_0xe8b8('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2826cc){return new Promise(function(_0x4e6ae7){var _0x260b5a=_[_0xe8b8('0x4f')](_0x30bfc7[_0xe8b8('0x41')]);if(_0x2826cc&&_0x2826cc['id']){var _0x261af8=_[_0xe8b8('0x50')](_0x260b5a,function(_0x52a434){return _0x52a434['id']===_0x2826cc['id'];});_0x4e6ae7(_0x261af8);}else{_0x4e6ae7({'count':_0x260b5a[_0xe8b8('0x1a')],'rows':_0x260b5a});}});},'ChatQueues':function(){return new Promise(function(_0x39c471){var _0x5ebee9=[];for(var _0x37cc43 in _0x30bfc7[_0xe8b8('0x51')]){if(_0x30bfc7['chatQueues'][_0xe8b8('0x4b')](_0x37cc43)){var _0x12f527=_0x30bfc7[_0xe8b8('0x51')][_0x37cc43];var _0x539e7f={'id':_0x12f527['id'],'available':_0x12f527[_0xe8b8('0x52')],'loggedIn':_0x12f527[_0xe8b8('0x53')],'name':_0x12f527[_0xe8b8('0x54')],'paused':_0x12f527[_0xe8b8('0x55')],'waiting':_0x12f527[_0xe8b8('0x56')]};_0x5ebee9[_0xe8b8('0x20')](_0x539e7f);}}_0x39c471({'count':_0x5ebee9[_0xe8b8('0x1a')],'rows':_0x5ebee9});});},'MailQueues':function(){return new Promise(function(_0x45f72d){var _0x214dbb=[];for(var _0x2b276c in _0x30bfc7[_0xe8b8('0x57')]){if(_0x30bfc7[_0xe8b8('0x57')][_0xe8b8('0x4b')](_0x2b276c)){var _0x118b6a=_0x30bfc7['mailQueues'][_0x2b276c];var _0x3f5a9f={'id':_0x118b6a['id'],'available':_0x118b6a['available'],'loggedIn':_0x118b6a['loggedIn'],'name':_0x118b6a['name'],'paused':_0x118b6a[_0xe8b8('0x55')],'waiting':_0x118b6a[_0xe8b8('0x56')]};_0x214dbb[_0xe8b8('0x20')](_0x3f5a9f);}}_0x45f72d({'count':_0x214dbb[_0xe8b8('0x1a')],'rows':_0x214dbb});});},'OpenchannelQueues':function(){return new Promise(function(_0x47f13e){var _0x3483ed=[];for(var _0x51c7fd in _0x30bfc7[_0xe8b8('0x58')]){if(_0x30bfc7['openchannelQueues'][_0xe8b8('0x4b')](_0x51c7fd)){var _0x26be5=_0x30bfc7[_0xe8b8('0x58')][_0x51c7fd];var _0x18faff={'id':_0x26be5['id'],'available':_0x26be5['available'],'loggedIn':_0x26be5[_0xe8b8('0x53')],'name':_0x26be5[_0xe8b8('0x54')],'paused':_0x26be5['paused'],'waiting':_0x26be5[_0xe8b8('0x56')]};_0x3483ed['push'](_0x18faff);}}_0x47f13e({'count':_0x3483ed['length'],'rows':_0x3483ed});});},'SmsQueues':function(){return new Promise(function(_0xe928e5){var _0x1fc527=[];for(var _0x342e28 in _0x30bfc7[_0xe8b8('0x59')]){if(_0x30bfc7[_0xe8b8('0x59')][_0xe8b8('0x4b')](_0x342e28)){var _0x1a0334=_0x30bfc7[_0xe8b8('0x59')][_0x342e28];var _0x45e0be={'id':_0x1a0334['id'],'available':_0x1a0334[_0xe8b8('0x52')],'loggedIn':_0x1a0334[_0xe8b8('0x53')],'name':_0x1a0334['name'],'paused':_0x1a0334[_0xe8b8('0x55')],'waiting':_0x1a0334[_0xe8b8('0x56')]};_0x1fc527['push'](_0x45e0be);}}_0xe928e5({'count':_0x1fc527[_0xe8b8('0x1a')],'rows':_0x1fc527});});},'FaxQueues':function(){return new Promise(function(_0x4ecc23){var _0x34dd5b=[];for(var _0x31587b in _0x30bfc7[_0xe8b8('0x5a')]){if(_0x30bfc7[_0xe8b8('0x5a')][_0xe8b8('0x4b')](_0x31587b)){var _0x33c765=_0x30bfc7['faxQueues'][_0x31587b];var _0x173236={'id':_0x33c765['id'],'available':_0x33c765[_0xe8b8('0x52')],'loggedIn':_0x33c765['loggedIn'],'name':_0x33c765[_0xe8b8('0x54')],'paused':_0x33c765[_0xe8b8('0x55')],'waiting':_0x33c765[_0xe8b8('0x56')]};_0x34dd5b[_0xe8b8('0x20')](_0x173236);}}_0x4ecc23({'count':_0x34dd5b['length'],'rows':_0x34dd5b});});},'WhatsappQueues':function(){return new Promise(function(_0x8eba01){var _0x486c42=[];for(var _0xa1be9b in _0x30bfc7[_0xe8b8('0x5b')]){if(_0x30bfc7['whatsappQueues'][_0xe8b8('0x4b')](_0xa1be9b)){var _0xd49faf=_0x30bfc7[_0xe8b8('0x5b')][_0xa1be9b];var _0xb3d267={'id':_0xd49faf['id'],'available':_0xd49faf['available'],'loggedIn':_0xd49faf['loggedIn'],'name':_0xd49faf['name'],'paused':_0xd49faf[_0xe8b8('0x55')],'waiting':_0xd49faf[_0xe8b8('0x56')]};_0x486c42[_0xe8b8('0x20')](_0xb3d267);}}_0x8eba01({'count':_0x486c42[_0xe8b8('0x1a')],'rows':_0x486c42});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x163a10){var _0x11550a=_['values'](_0x30bfc7[_0xe8b8('0x5c')]);_0x163a10({'count':_0x11550a['length'],'rows':_0x11550a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xd26530){var _0x279e9f=_['values'](_0x30bfc7[_0xe8b8('0x5d')]);_0xd26530({'count':_0x279e9f[_0xe8b8('0x1a')],'rows':_0x279e9f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x28f1c4){var _0x3268bf=_['values'](_0x30bfc7[_0xe8b8('0x5e')]);_0x28f1c4({'count':_0x3268bf[_0xe8b8('0x1a')],'rows':_0x3268bf});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x8515a9){var _0x536bc3=_['values'](_0x30bfc7['smsQueuesWaitingInteractions']);_0x8515a9({'count':_0x536bc3[_0xe8b8('0x1a')],'rows':_0x536bc3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x106b10){var _0x1a5594=_[_0xe8b8('0x4f')](_0x30bfc7[_0xe8b8('0x5f')]);_0x106b10({'count':_0x1a5594[_0xe8b8('0x1a')],'rows':_0x1a5594});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3d7547){var _0x295f74=_[_0xe8b8('0x4f')](_0x30bfc7[_0xe8b8('0x60')]);_0x3d7547({'count':_0x295f74[_0xe8b8('0x1a')],'rows':_0x295f74});});}};var _0x5cd9f2=jayson[_0xe8b8('0x61')](_0x52ff32)[_0xe8b8('0x62')]();_0x5cd9f2['on'](_0xe8b8('0x37'),function(_0x536fa9){logger[_0xe8b8('0x37')](JSON['stringify'](_0x536fa9));return _0x3df267(_0x536fa9);});_0x5cd9f2[_0xe8b8('0x12')](0x232c,_0xe8b8('0x63'),function(){console[_0xe8b8('0x64')](_0xe8b8('0x65'),0x232c);return _0x4a3e9f(_0xe8b8('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3a96020..476b957 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 _0xd55b=['info','join','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','\x20|\x20','lodash','../../../utils/iftime','../../../config/logger','routing','condition','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xd55b,0x1f1));var _0xbd55=function(_0x24c6fd,_0x31652f){_0x24c6fd=_0x24c6fd-0x0;var _0x2de5c3=_0xd55b[_0x24c6fd];return _0x2de5c3;};'use strict';var _=require(_0xbd55('0x0'));var iftime=require(_0xbd55('0x1'))['iftime'];var logger=require(_0xbd55('0x2'))(_0xbd55('0x3'));exports[_0xbd55('0x4')]=function(_0x139a8b,_0x5d92ad,_0x4e7e5f){return function(_0x150a36){if(_0x4e7e5f['rules']&&!_0x4e7e5f['rules'][_0x139a8b]){logger['info'](_0xbd55('0x5'),_0x139a8b);return _0x150a36[_0xbd55('0x6')]();}var _0x389041=_0x5d92ad['map'](function(_0x358f37){return iftime(_0x358f37);});var _0x581adf=_['some'](_0x389041);if(_0x581adf){logger[_0xbd55('0x7')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x139a8b,_0x5d92ad[_0xbd55('0x8')]('\x20|\x20'),_0x581adf);_0x150a36[_0xbd55('0x9')](_0x581adf);}else{logger[_0xbd55('0x7')](_0xbd55('0xa'),_0x139a8b,_0x5d92ad[_0xbd55('0x8')](_0xbd55('0xb')));_0x150a36['stop']();}};}; \ No newline at end of file +var _0x6097=['[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','../../../config/logger','routing','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x3a8790,_0x462d64){var _0x23b409=function(_0x3da9aa){while(--_0x3da9aa){_0x3a8790['push'](_0x3a8790['shift']());}};_0x23b409(++_0x462d64);}(_0x6097,0x8d));var _0x7609=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x6097[_0x2d48fa];return _0x4645b7;};'use strict';var _=require(_0x7609('0x0'));var iftime=require('../../../utils/iftime')[_0x7609('0x1')];var logger=require(_0x7609('0x2'))(_0x7609('0x3'));exports[_0x7609('0x4')]=function(_0x3bdd0a,_0x5685d9,_0x4962b1){return function(_0x3467e5){if(_0x4962b1['rules']&&!_0x4962b1['rules'][_0x3bdd0a]){logger[_0x7609('0x5')](_0x7609('0x6'),_0x3bdd0a);return _0x3467e5[_0x7609('0x7')]();}var _0xbc1bc=_0x5685d9[_0x7609('0x8')](function(_0x1fce19){return iftime(_0x1fce19);});var _0x405c91=_['some'](_0xbc1bc);if(_0x405c91){logger[_0x7609('0x5')](_0x7609('0x9'),_0x3bdd0a,_0x5685d9[_0x7609('0xa')](_0x7609('0xb')),_0x405c91);_0x3467e5[_0x7609('0xc')](_0x405c91);}else{logger['info'](_0x7609('0xd'),_0x3bdd0a,_0x5685d9[_0x7609('0xa')](_0x7609('0xb')));_0x3467e5[_0x7609('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c597689..cf3d44a 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 _0x7af2=['agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','cause','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','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','getVoiceQueueByName','type','agentcomplete','agentacw','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x304828,_0x154b36){_0x304828=_0x304828-0x0;var _0x1ab51e=_0x7af2[_0x304828];return _0x1ab51e;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var utils=require(_0x27af('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x908794,_0x316e13){utils['info'](util[_0x27af('0x2')](_0x27af('0x3'),_0x908794[_0x27af('0x4')],_0x908794[_0x27af('0x5')],_0x908794[_0x27af('0x6')],_0x908794[_0x27af('0x7')],_0x908794[_0x27af('0x8')],_0x908794[_0x27af('0x9')],_0x908794[_0x27af('0xa')],_0x908794['lastevent']));if(_0x908794[_0x27af('0x6')]){utils[_0x27af('0xb')](_0x908794[_0x27af('0x6')])['then'](function(_0x369a20){if(_0x369a20){_0x908794[_0x27af('0xc')]=_0x369a20[_0x27af('0xc')];_0x908794['agentacw']=_0x908794[_0x27af('0xd')]?_0x369a20['acw']:![];_0x908794['acwtime']=_0x908794[_0x27af('0xe')]?_0x369a20['acwTimeout']:0x0;}utils['request'](_0x27af('0xf'),_0x908794);});}else{utils['request'](_0x27af('0xf'),_0x908794);}if(_0x316e13){delete transfers[_0x908794['uniqueid']];}else{delete agents[_0x908794[_0x27af('0x10')]];}}exports[_0x27af('0x11')]=function(_0x1fd964){try{utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x13'),_0x1fd964[_0x27af('0x4')]),_0x1fd964);agents[_0x1fd964[_0x27af('0x10')]]=_0x1fd964;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x17');agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0xa')]=null;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x18')]=null;utils['info'](util[_0x27af('0x2')](_0x27af('0x19'),_0x1fd964['uniqueid'],agents[_0x1fd964['destuniqueid']][_0x27af('0x7')],_0x1fd964[_0x27af('0x10')]));}catch(_0x351587){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcalled]',_0x1fd964[_0x27af('0x4')]),_0x351587);}};exports[_0x27af('0x1b')]=function(_0xcb4b90){try{if(!_['isNil'](agents[_0xcb4b90[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentringnoanswer]',_0xcb4b90[_0x27af('0x4')]),_0xcb4b90);utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x1d'),_0xcb4b90[_0x27af('0x4')],agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x7')],_0xcb4b90[_0x27af('0x10')]));agents[_0xcb4b90[_0x27af('0x10')]]['agentringnoanswer']=!![];agents[_0xcb4b90['destuniqueid']]['agentringnoanswerAt']=utils[_0x27af('0x15')]();agents[_0xcb4b90['destuniqueid']][_0x27af('0x16')]=_0x27af('0x1e');agents[_0xcb4b90['destuniqueid']][_0x27af('0x1f')]=_0x27af('0x1e');agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x20')]=_0xcb4b90[_0x27af('0x21')]?parseInt(_0xcb4b90[_0x27af('0x21')])/0x3e8:0x0;agents[_0xcb4b90[_0x27af('0x10')]]['talktime']=0x0;unanswered[_0x27af('0x22')](_0xcb4b90[_0x27af('0x10')]);}}catch(_0xadd38e){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x23'),_0xcb4b90[_0x27af('0x4')]),_0xadd38e);}};exports[_0x27af('0x24')]=function(_0x4406e2){try{_[_0x27af('0x25')](agents,function(_0x205e41,_0x4f4955){if(_0x205e41[_0x27af('0x4')]==_0x4406e2[_0x27af('0x4')]&&!_[_0x27af('0x26')](unanswered,_0x205e41[_0x27af('0x10')])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]',_0x4406e2['uniqueid']),_0x4406e2);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4406e2[_0x27af('0x4')],_0x205e41[_0x27af('0x7')],_0x205e41[_0x27af('0x10')]));_0x205e41[_0x27af('0x1b')]=!![];_0x205e41[_0x27af('0x27')]=utils[_0x27af('0x15')]();_0x205e41[_0x27af('0x16')]=_0x27af('0x28');_0x205e41[_0x27af('0x1f')]=_0x27af('0x28');_0x205e41[_0x27af('0x20')]=_0x4406e2['holdtime'];_0x205e41['talktime']=0x0;writeDB(_0x205e41);}});}catch(_0x1de1d0){utils[_0x27af('0x1a')](util['format'](_0x27af('0x29'),_0x4406e2[_0x27af('0x4')]),_0x1de1d0);}};exports['agentconnect']=function(_0x83aa0b){try{if(agents[_0x83aa0b[_0x27af('0x10')]]){utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b['uniqueid']),_0x83aa0b);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x83aa0b['uniqueid'],agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x7')],_0x83aa0b[_0x27af('0x10')]));agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x2b')]=utils[_0x27af('0x15')]();agents[_0x83aa0b['destuniqueid']][_0x27af('0xa')]=_0x83aa0b['connectedlinenum'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x18')]=_0x83aa0b[_0x27af('0x18')];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x20')]=_0x83aa0b['ringtime'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x2c');_[_0x27af('0x25')](agents,function(_0x10c1be,_0x32b558){if(_0x10c1be[_0x27af('0x10')]!=_0x83aa0b[_0x27af('0x10')]&&_0x10c1be[_0x27af('0x4')]==_0x83aa0b[_0x27af('0x4')]){_0x10c1be[_0x27af('0x2d')]=0x0;_0x10c1be[_0x27af('0x20')]=_0x83aa0b[_0x27af('0x21')];_0x10c1be[_0x27af('0x1b')]=!![];_0x10c1be['agentringnoanswerAt']=utils[_0x27af('0x15')]();_0x10c1be[_0x27af('0x16')]=_0x27af('0x2e');_0x10c1be[_0x27af('0x1f')]='answered_elsewhere';_0x10c1be[_0x27af('0x2f')]=_0x83aa0b['destuniqueid'];_0x10c1be['answeredelsewheremembername']=_0x83aa0b[_0x27af('0x7')];writeDB(_0x10c1be);}});}}catch(_0x3c9c81){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b[_0x27af('0x4')]),_0x3c9c81);}};exports[_0x27af('0xd')]=function(_0x26eb28){try{if(!_[_0x27af('0x30')](agents[_0x26eb28[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x26eb28);utils[_0x27af('0x1c')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x26eb28[_0x27af('0x4')],agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x7')],_0x26eb28[_0x27af('0x10')]));agents[_0x26eb28[_0x27af('0x10')]]['agentcomplete']=!![];agents[_0x26eb28[_0x27af('0x10')]]['agentcompleteAt']=utils[_0x27af('0x15')]();agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x2d')]=utils[_0x27af('0x31')](agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x32')],agents[_0x26eb28[_0x27af('0x10')]]['agentconnectAt']);agents[_0x26eb28['destuniqueid']][_0x27af('0x1f')]=_0x26eb28['reason'];agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x33');writeDB(agents[_0x26eb28[_0x27af('0x10')]]);}}catch(_0x37f2fa){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x37f2fa);}};exports[_0x27af('0x34')]=function(_0x20e180){try{if(!_[_0x27af('0x30')](agents[_0x20e180[_0x27af('0x35')]])){utils['debug'](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x20e180);utils['info'](util['format'](_0x27af('0x37'),_0x20e180[_0x27af('0x4')],agents[_0x20e180[_0x27af('0x35')]]['membername'],agents[_0x20e180['transfereruniqueid']][_0x27af('0x4')]));agents[_0x20e180['transfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x39')]=_0x27af('0x3a');agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3b')]=_0x20e180[_0x27af('0x3c')];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3d')]=agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x4')];}}catch(_0x5c02c1){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x5c02c1);}};exports[_0x27af('0x3e')]=function(_0x2ad074){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]',_0x2ad074[_0x27af('0x3f')]),_0x2ad074);if(_0x2ad074['origtransfereruniqueid']==_0x2ad074[_0x27af('0x40')]){if(!_[_0x27af('0x30')](agents[_0x2ad074[_0x27af('0x41')]])){utils['info'](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x7')]));agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x39')]='ATTENDED';agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x42')];agents[_0x2ad074['secondtransfereruniqueid']]['transferuniqueid']=_0x2ad074[_0x27af('0x3f')];}if(_0x2ad074[_0x27af('0x43')]&&agents[_0x2ad074[_0x27af('0x43')]]){agents[_0x2ad074[_0x27af('0x43')]]['agententerreason']=0x1;transfers[_0x2ad074[_0x27af('0x43')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x43')]]);transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x41')]]['calleridnum'];transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x45')];transfers[_0x2ad074['transfereeuniqueid']][_0x27af('0x14')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x2ad074[_0x27af('0x41')]==_0x2ad074[_0x27af('0x46')]){if(!_[_0x27af('0x30')](agents[_0x2ad074['origtransfereruniqueid']])){utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x3f')]]['membername']));agents[_0x2ad074['origtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074[_0x27af('0x3f')]]['transfertype']='ATTENDED';agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x47')];agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3d')]=_0x2ad074[_0x27af('0x41')];}if(_0x2ad074[_0x27af('0x48')]&&agents[_0x2ad074['transfertargetuniqueid']]){agents[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x1;transfers[_0x2ad074[_0x27af('0x48')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x48')]]);transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x9')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x45')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x2;}}}catch(_0x4b0a4){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x4a'),_0x2ad074[_0x27af('0x3f')]),_0x4b0a4);}};exports['hangup']=function(_0x132ed4){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][hangup]',_0x132ed4['uniqueid']),_0x132ed4);if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]===_0x27af('0x1e')){if(_0x132ed4[_0x27af('0x4b')]==='21'){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]='rejected';agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]='rejected';}utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4['uniqueid'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);var _0x5db94f=unanswered[_0x27af('0x4c')](_0x132ed4[_0x27af('0x4')]);if(_0x5db94f>-0x1){unanswered[_0x27af('0x4d')](_0x5db94f,0x1);}}if(transfers[_0x132ed4[_0x27af('0x4')]]){transfers[_0x132ed4['uniqueid']]['agentcomplete']=!![];transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')]=utils[_0x27af('0x15')]();transfers[_0x132ed4[_0x27af('0x4')]]['talktime']=utils['diffTime'](transfers[_0x132ed4['uniqueid']][_0x27af('0x32')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]);transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]=_0x27af('0x4e');transfers[_0x132ed4['uniqueid']]['lastevent']=_0x27af('0x33');utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x4f'),_0x132ed4['uniqueid'],transfers[_0x132ed4['uniqueid']][_0x27af('0x7')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(transfers[_0x132ed4[_0x27af('0x4')]],!![]);}if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0xd')]=!![];agents[_0x132ed4['uniqueid']][_0x27af('0x32')]=utils[_0x27af('0x15')]();agents[_0x132ed4[_0x27af('0x4')]]['talktime']=utils[_0x27af('0x31')](agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')],agents[_0x132ed4['uniqueid']][_0x27af('0x2b')]);agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]=agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x38')]?_0x27af('0x38'):_0x27af('0x4e');agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]=_0x27af('0x33');utils['info'](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4[_0x27af('0x4')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4['uniqueid']]['reason'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);}}catch(_0x48c7eb){utils['error'](util['format'](_0x27af('0x50'),_0x132ed4[_0x27af('0x4')]),_0x48c7eb);}}; \ No newline at end of file +var _0x9ffd=['interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][attendedtransfer]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x50a794,_0x18326d){_0x50a794=_0x50a794-0x0;var _0x118132=_0x9ffd[_0x50a794];return _0x118132;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var utils=require(_0xd9ff('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5802a6,_0x3480c0){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x5'),_0x5802a6['uniqueid'],_0x5802a6[_0xd9ff('0x6')],_0x5802a6[_0xd9ff('0x7')],_0x5802a6['membername'],_0x5802a6[_0xd9ff('0x8')],_0x5802a6[_0xd9ff('0x9')],_0x5802a6[_0xd9ff('0xa')],_0x5802a6[_0xd9ff('0xb')]));if(_0x5802a6[_0xd9ff('0x7')]){utils[_0xd9ff('0xc')](_0x5802a6[_0xd9ff('0x7')])[_0xd9ff('0xd')](function(_0x977487){if(_0x977487){_0x5802a6['type']=_0x977487['type'];_0x5802a6['agentacw']=_0x5802a6['agentcomplete']?_0x977487[_0xd9ff('0xe')]:![];_0x5802a6[_0xd9ff('0xf')]=_0x5802a6[_0xd9ff('0x10')]?_0x977487[_0xd9ff('0x11')]:0x0;}utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);});}else{utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);}if(_0x3480c0){delete transfers[_0x5802a6['uniqueid']];}else{delete agents[_0x5802a6['destuniqueid']];}}exports[_0xd9ff('0x14')]=function(_0x16a0d9){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9['uniqueid']),_0x16a0d9);agents[_0x16a0d9[_0xd9ff('0x17')]]=_0x16a0d9;agents[_0x16a0d9[_0xd9ff('0x17')]]['agentcalledAt']=utils[_0xd9ff('0x18')]();agents[_0x16a0d9['destuniqueid']]['lastevent']='called';agents[_0x16a0d9['destuniqueid']][_0xd9ff('0xa')]=null;agents[_0x16a0d9['destuniqueid']][_0xd9ff('0x19')]=null;utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x1a'),_0x16a0d9[_0xd9ff('0x1b')],agents[_0x16a0d9[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x16a0d9[_0xd9ff('0x17')]));}catch(_0x182775){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9[_0xd9ff('0x1b')]),_0x182775);}};exports['agentringnoanswer']=function(_0x4cf8ec){try{if(!_[_0xd9ff('0x1e')](agents[_0x4cf8ec[_0xd9ff('0x17')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x4cf8ec['uniqueid']),_0x4cf8ec);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x1f'),_0x4cf8ec[_0xd9ff('0x1b')],agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x4cf8ec[_0xd9ff('0x17')]));agents[_0x4cf8ec[_0xd9ff('0x17')]]['agentringnoanswer']=!![];agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x20')]=utils['now']();agents[_0x4cf8ec[_0xd9ff('0x17')]]['lastevent']=_0xd9ff('0x21');agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x21');agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x23')]=_0x4cf8ec['ringtime']?parseInt(_0x4cf8ec[_0xd9ff('0x24')])/0x3e8:0x0;agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x25')]=0x0;unanswered[_0xd9ff('0x26')](_0x4cf8ec['destuniqueid']);}}catch(_0x1d3684){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x27'),_0x4cf8ec[_0xd9ff('0x1b')]),_0x1d3684);}};exports[_0xd9ff('0x28')]=function(_0x420ffa){try{_[_0xd9ff('0x29')](agents,function(_0x3dc443,_0x5706cf){if(_0x3dc443[_0xd9ff('0x1b')]==_0x420ffa['uniqueid']&&!_[_0xd9ff('0x2a')](unanswered,_0x3dc443[_0xd9ff('0x17')])){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2b'),_0x420ffa[_0xd9ff('0x1b')]),_0x420ffa);utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x420ffa[_0xd9ff('0x1b')],_0x3dc443['membername'],_0x3dc443[_0xd9ff('0x17')]));_0x3dc443[_0xd9ff('0x2c')]=!![];_0x3dc443[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x3dc443[_0xd9ff('0xb')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x22')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x23')]=_0x420ffa[_0xd9ff('0x23')];_0x3dc443[_0xd9ff('0x25')]=0x0;writeDB(_0x3dc443);}});}catch(_0x34e9a9){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]',_0x420ffa[_0xd9ff('0x1b')]),_0x34e9a9);}};exports[_0xd9ff('0x2e')]=function(_0x2bde85){try{if(agents[_0x2bde85['destuniqueid']]){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2f'),_0x2bde85['uniqueid']),_0x2bde85);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x30'),_0x2bde85[_0xd9ff('0x1b')],agents[_0x2bde85[_0xd9ff('0x17')]]['membername'],_0x2bde85['destuniqueid']));agents[_0x2bde85['destuniqueid']][_0xd9ff('0x31')]=utils[_0xd9ff('0x18')]();agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xa')]=_0x2bde85[_0xd9ff('0xa')];agents[_0x2bde85[_0xd9ff('0x17')]]['connectedlinename']=_0x2bde85['connectedlinename'];agents[_0x2bde85['destuniqueid']][_0xd9ff('0x23')]=_0x2bde85[_0xd9ff('0x24')];agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xb')]='connect';_[_0xd9ff('0x29')](agents,function(_0x5b8e17,_0x3cff52){if(_0x5b8e17[_0xd9ff('0x17')]!=_0x2bde85[_0xd9ff('0x17')]&&_0x5b8e17[_0xd9ff('0x1b')]==_0x2bde85['uniqueid']){_0x5b8e17[_0xd9ff('0x25')]=0x0;_0x5b8e17[_0xd9ff('0x23')]=_0x2bde85['ringtime'];_0x5b8e17[_0xd9ff('0x2c')]=!![];_0x5b8e17[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x5b8e17[_0xd9ff('0xb')]=_0xd9ff('0x32');_0x5b8e17[_0xd9ff('0x22')]='answered_elsewhere';_0x5b8e17[_0xd9ff('0x33')]=_0x2bde85[_0xd9ff('0x17')];_0x5b8e17[_0xd9ff('0x34')]=_0x2bde85[_0xd9ff('0x1c')];writeDB(_0x5b8e17);}});}}catch(_0x472724){utils['error'](util[_0xd9ff('0x4')](_0xd9ff('0x2f'),_0x2bde85[_0xd9ff('0x1b')]),_0x472724);}};exports['agentcomplete']=function(_0x5d06dd){try{if(!_[_0xd9ff('0x1e')](agents[_0x5d06dd[_0xd9ff('0x17')]])){utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x35'),_0x5d06dd[_0xd9ff('0x1b')]),_0x5d06dd);utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x36'),_0x5d06dd['uniqueid'],agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x5d06dd[_0xd9ff('0x17')]));agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x37')]=!![];agents[_0x5d06dd['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x5d06dd[_0xd9ff('0x17')]]['talktime']=utils[_0xd9ff('0x38')](agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x39')],agents[_0x5d06dd['destuniqueid']][_0xd9ff('0x31')]);agents[_0x5d06dd[_0xd9ff('0x17')]]['reason']=_0x5d06dd[_0xd9ff('0x22')];agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');writeDB(agents[_0x5d06dd['destuniqueid']]);}}catch(_0x38b5b6){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][agentcomplete]',_0x5d06dd[_0xd9ff('0x1b')]),_0x38b5b6);}};exports[_0xd9ff('0x3b')]=function(_0x2bf37a){try{if(!_[_0xd9ff('0x1e')](agents[_0x2bf37a[_0xd9ff('0x3c')]])){utils['debug'](util[_0xd9ff('0x4')](_0xd9ff('0x3d'),_0x2bf37a[_0xd9ff('0x1b')]),_0x2bf37a);utils[_0xd9ff('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2bf37a['uniqueid'],agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1c')],agents[_0x2bf37a[_0xd9ff('0x3c')]]['uniqueid']));agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3e')]=!![];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3f')]=_0xd9ff('0x40');agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x41')]=_0x2bf37a[_0xd9ff('0x42')];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x43')]=agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1b')];}}catch(_0x2533d7){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][blindtransfer]',_0x2bf37a[_0xd9ff('0x1b')]),_0x2533d7);}};exports['attendedtransfer']=function(_0x2953d7){try{utils['debug'](util[_0xd9ff('0x4')]('[%s][agents][attendedtransfer]',_0x2953d7[_0xd9ff('0x44')]),_0x2953d7);if(_0x2953d7['origtransfereruniqueid']==_0x2953d7[_0xd9ff('0x45')]){if(!_['isNil'](agents[_0x2953d7[_0xd9ff('0x46')]])){utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7[_0xd9ff('0x44')],agents[_0x2953d7[_0xd9ff('0x46')]]['membername']));agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x46')]]['transfertype']=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x49')];agents[_0x2953d7[_0xd9ff('0x46')]]['transferuniqueid']=_0x2953d7[_0xd9ff('0x44')];}if(_0x2953d7[_0xd9ff('0x4a')]&&agents[_0x2953d7[_0xd9ff('0x4a')]]){agents[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x4b')]=0x1;transfers[_0x2953d7[_0xd9ff('0x4a')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfereeuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x9')]=agents[_0x2953d7['secondtransfereruniqueid']][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x4d')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentconnectAt']=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4a')]]['agententerreason']=0x2;}}else if(_0x2953d7['secondtransfereruniqueid']==_0x2953d7['secondtransfererlinkedid']){if(!_[_0xd9ff('0x1e')](agents[_0x2953d7[_0xd9ff('0x44')]])){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7['origtransfereruniqueid'],agents[_0x2953d7[_0xd9ff('0x44')]]['membername']));agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3f')]=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x4e')];agents[_0x2953d7['origtransfereruniqueid']][_0xd9ff('0x43')]=_0x2953d7[_0xd9ff('0x46')];}if(_0x2953d7['transfertargetuniqueid']&&agents[_0x2953d7['transfertargetuniqueid']]){agents[_0x2953d7[_0xd9ff('0x4f')]]['agententerreason']=0x1;transfers[_0x2953d7[_0xd9ff('0x4f')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfertargetuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x9')]=agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4f')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x44')]]['calleridname'];transfers[_0x2953d7['transfertargetuniqueid']][_0xd9ff('0x50')]=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x31')]=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x4b')]=0x2;}}}catch(_0x1bb042){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x51'),_0x2953d7['origtransfereruniqueid']),_0x1bb042);}};exports['hangup']=function(_0x5e04d3){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')]('[%s][agents][hangup]',_0x5e04d3[_0xd9ff('0x1b')]),_0x5e04d3);if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]===_0xd9ff('0x21')){if(_0x5e04d3[_0xd9ff('0x52')]==='21'){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]='rejected';agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x53');}utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3['uniqueid']][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);var _0x56a74c=unanswered[_0xd9ff('0x54')](_0x5e04d3[_0xd9ff('0x1b')]);if(_0x56a74c>-0x1){unanswered[_0xd9ff('0x55')](_0x56a74c,0x1);}}if(transfers[_0x5e04d3['uniqueid']]){transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt']=utils[_0xd9ff('0x18')]();transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x25')]=utils[_0xd9ff('0x38')](transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt'],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);transfers[_0x5e04d3['uniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x56');transfers[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(transfers[_0x5e04d3[_0xd9ff('0x1b')]],!![]);}if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]]['agentconnectAt']){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')]=utils[_0xd9ff('0x18')]();agents[_0x5e04d3[_0xd9ff('0x1b')]]['talktime']=utils['diffTime'](agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]=agents[_0x5e04d3['uniqueid']][_0xd9ff('0x3e')]?_0xd9ff('0x3e'):_0xd9ff('0x56');agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x57'),_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);}}catch(_0x4c2ad5){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x58'),_0x5e04d3[_0xd9ff('0x1b')]),_0x4c2ad5);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7fcdfa1..19f3377 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 _0x15d0=['[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','CreateVoiceCallReport','request','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','starttime','endtime','attendedtransfer','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','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','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','gotoif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x15d0,0x137));var _0x015d=function(_0x587783,_0x583dbc){_0x587783=_0x587783-0x0;var _0x5ad04d=_0x15d0[_0x587783];return _0x5ad04d;};'use strict';var _=require('lodash');var util=require(_0x015d('0x0'));var utils=require(_0x015d('0x1'));var dispositions=[_0x015d('0x2'),_0x015d('0x3'),_0x015d('0x3'),_0x015d('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x015d('0x4'),_0x015d('0x5'),_0x015d('0x3'),'FAILED','FAILED'];var channels={};function writeDB(_0x15d6e9){utils[_0x015d('0x6')](util['format'](_0x015d('0x7'),_0x15d6e9[_0x015d('0x8')],_0x15d6e9[_0x015d('0x9')],_0x15d6e9[_0x015d('0xa')],_0x15d6e9[_0x015d('0xb')],_0x15d6e9[_0x015d('0xc')],_0x15d6e9[_0x015d('0xd')],_0x15d6e9[_0x015d('0xe')],_0x15d6e9['lastevent']));if(_0x15d6e9[_0x015d('0xf')]){utils['getUserByInternal'](_0x15d6e9[_0x015d('0xf')])[_0x015d('0x10')](function(_0xef3bbf){if(_0xef3bbf){_0x15d6e9['UserId']=_0xef3bbf['id'];}utils['request'](_0x015d('0x11'),_0x15d6e9);});}else{utils[_0x015d('0x12')](_0x015d('0x11'),_0x15d6e9);}if(channels[_0x15d6e9['uniqueid']]){delete channels[_0x15d6e9['uniqueid']];}}exports[_0x015d('0x13')]=function(_0x4c8ffe){try{utils[_0x015d('0x14')](util[_0x015d('0x15')](_0x015d('0x16'),_0x4c8ffe[_0x015d('0x8')]),_0x4c8ffe);if(_0x4c8ffe[_0x015d('0x8')]==_0x4c8ffe[_0x015d('0x17')]&&_0x4c8ffe[_0x015d('0x9')]!=_0x015d('0x18')){utils[_0x015d('0x6')](util['format'](_0x015d('0x19'),_0x4c8ffe[_0x015d('0x8')],_0x4c8ffe[_0x015d('0x1a')],_0x4c8ffe[_0x015d('0x1b')]));channels[_0x4c8ffe[_0x015d('0x8')]]={'uniqueid':_0x4c8ffe[_0x015d('0x8')],'accountcode':_0x4c8ffe[_0x015d('0xf')],'source':_0x4c8ffe[_0x015d('0xd')],'destination':_0x4c8ffe['exten'],'destinationcontext':_0x4c8ffe[_0x015d('0x1a')],'channel':_0x4c8ffe[_0x015d('0x9')],'starttime':utils[_0x015d('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x015d('0x2'),'amaflags':_0x015d('0x1d')};}}catch(_0x364685){utils[_0x015d('0x1e')](util[_0x015d('0x15')](_0x015d('0x16'),_0x4c8ffe[_0x015d('0x8')]),_0x364685);}};exports['newstate']=function(_0x3e58ee){try{utils['debug'](util['format'](_0x015d('0x1f'),_0x3e58ee[_0x015d('0x8')]),_0x3e58ee);if(!_['isNil'](channels[_0x3e58ee[_0x015d('0x8')]])&&_0x3e58ee[_0x015d('0x20')]==0x6){utils['info'](util[_0x015d('0x15')](_0x015d('0x21'),_0x3e58ee[_0x015d('0x8')],_0x3e58ee['context'],_0x3e58ee[_0x015d('0x9')]));if(_[_0x015d('0x22')](channels[_0x3e58ee[_0x015d('0x8')]][_0x015d('0x23')])){channels[_0x3e58ee['uniqueid']][_0x015d('0x23')]=utils['now']();}}else if(!_[_0x015d('0x22')](channels[_0x3e58ee['linkedid']])&&_0x3e58ee['channelstate']==0x6&&_0x3e58ee[_0x015d('0x1a')]!=_0x015d('0x24')){utils[_0x015d('0x6')](util['format'](_0x015d('0x25'),_0x3e58ee[_0x015d('0x8')],_0x3e58ee[_0x015d('0x17')],_0x3e58ee['context'],_0x3e58ee[_0x015d('0x9')]));channels[_0x3e58ee['linkedid']][_0x015d('0xf')]=_0x3e58ee[_0x015d('0xf')];channels[_0x3e58ee[_0x015d('0x17')]][_0x015d('0x26')]=_0x3e58ee[_0x015d('0x9')];if(_['isNil'](channels[_0x3e58ee[_0x015d('0x17')]][_0x015d('0x27')])){channels[_0x3e58ee[_0x015d('0x17')]][_0x015d('0x27')]=utils[_0x015d('0x1c')]();}channels[_0x3e58ee[_0x015d('0x17')]][_0x015d('0x28')]=dispositions[_[_0x015d('0x29')](_0x3e58ee[_0x015d('0x20')])]||_0x015d('0x4');}}catch(_0xe230d1){utils['error'](util[_0x015d('0x15')](_0x015d('0x1f'),_0x3e58ee[_0x015d('0x8')]),_0xe230d1);}};exports['hangup']=function(_0x3dc64b){try{if(!_['isNil'](channels[_0x3dc64b[_0x015d('0x8')]])){utils[_0x015d('0x14')](util[_0x015d('0x15')](_0x015d('0x2a'),_0x3dc64b[_0x015d('0x8')]),_0x3dc64b);if(_[_0x015d('0x22')](channels[_0x3dc64b[_0x015d('0x8')]][_0x015d('0x2b')])){channels[_0x3dc64b['uniqueid']][_0x015d('0x2b')]=_0x3dc64b[_0x015d('0x2c')]+'\x20<'+_0x3dc64b[_0x015d('0xd')]+'>';}utils['info'](util[_0x015d('0x15')](_0x015d('0x2d'),_0x3dc64b[_0x015d('0x8')],channels[_0x3dc64b[_0x015d('0x8')]][_0x015d('0x2b')],_0x3dc64b['cause-txt']));channels[_0x3dc64b[_0x015d('0x8')]]['endtime']=utils[_0x015d('0x1c')]();channels[_0x3dc64b[_0x015d('0x8')]][_0x015d('0x2e')]=utils[_0x015d('0x2f')](channels[_0x3dc64b[_0x015d('0x8')]]['endtime'],channels[_0x3dc64b[_0x015d('0x8')]][_0x015d('0x30')]);channels[_0x3dc64b[_0x015d('0x8')]]['billableseconds']=channels[_0x3dc64b[_0x015d('0x8')]][_0x015d('0x27')]?utils[_0x015d('0x2f')](channels[_0x3dc64b[_0x015d('0x8')]][_0x015d('0x31')],channels[_0x3dc64b['uniqueid']][_0x015d('0x27')]):0x0;writeDB(channels[_0x3dc64b[_0x015d('0x8')]]);}}catch(_0x41d871){utils['error'](util[_0x015d('0x15')]('[%s][calls][hangup]',_0x3dc64b[_0x015d('0x8')]),_0x41d871);}};exports[_0x015d('0x32')]=function(_0x3a82ed){try{if(!_['isNil'](channels[_0x3a82ed['localtwolinkedid']])){utils[_0x015d('0x14')](util[_0x015d('0x15')](_0x015d('0x33'),_0x3a82ed['origtransfereruniqueid']),_0x3a82ed);if(channels[_0x3a82ed['localtwolinkedid']][_0x015d('0x9')]==_0x3a82ed[_0x015d('0x34')]){utils['info'](util[_0x015d('0x15')](_0x015d('0x35'),_0x3a82ed[_0x015d('0x36')],_0x3a82ed[_0x015d('0x37')],_0x3a82ed[_0x015d('0x38')]));channels[_0x3a82ed[_0x015d('0x37')]]['destinationchannel']=_0x3a82ed[_0x015d('0x38')];channels[_0x3a82ed[_0x015d('0x37')]][_0x015d('0x39')]=_0x015d('0x3a');}else if(channels[_0x3a82ed[_0x015d('0x37')]][_0x015d('0x9')]=_0x3a82ed[_0x015d('0x3b')]){utils[_0x015d('0x6')](util[_0x015d('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3a82ed[_0x015d('0x36')],_0x3a82ed[_0x015d('0x37')],_0x3a82ed['origtransfererchannel']));channels[_0x3a82ed['localtwolinkedid']]['destinationchannel']=_0x3a82ed[_0x015d('0x3c')];channels[_0x3a82ed[_0x015d('0x37')]][_0x015d('0x39')]=_0x015d('0x3a');}}}catch(_0x562daf){utils['error'](util[_0x015d('0x15')](_0x015d('0x33'),_0x3a82ed[_0x015d('0x36')]),_0x562daf);}};exports[_0x015d('0x3d')]=function(_0x566bc1){try{if(!_[_0x015d('0x22')](channels[_0x566bc1[_0x015d('0x8')]])){utils['debug'](util[_0x015d('0x15')]('[%s][calls][musiconholdstart]',_0x566bc1[_0x015d('0x8')]),_0x566bc1);channels[_0x566bc1['uniqueid']][_0x015d('0x3e')]=utils[_0x015d('0x1c')]();utils[_0x015d('0x6')](util['format'](_0x015d('0x3f'),_0x566bc1[_0x015d('0x8')],channels[_0x566bc1[_0x015d('0x8')]][_0x015d('0x3e')]));}}catch(_0x24931b){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x566bc1[_0x015d('0x8')]),_0x24931b);}};exports[_0x015d('0x40')]=function(_0x41a010){try{if(!_['isNil'](channels[_0x41a010['uniqueid']])){utils[_0x015d('0x14')](util[_0x015d('0x15')](_0x015d('0x41'),_0x41a010[_0x015d('0x8')]),_0x41a010);if(!_['isNil'](channels[_0x41a010['uniqueid']][_0x015d('0x3e')])){channels[_0x41a010[_0x015d('0x8')]][_0x015d('0x42')]+=utils['diffTime'](utils[_0x015d('0x1c')](),channels[_0x41a010[_0x015d('0x8')]][_0x015d('0x3e')]);utils[_0x015d('0x6')](util[_0x015d('0x15')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x41a010[_0x015d('0x8')],channels[_0x41a010[_0x015d('0x8')]]['mohtime']));delete channels[_0x41a010[_0x015d('0x8')]][_0x015d('0x3e')];}}}catch(_0x598bb2){utils[_0x015d('0x1e')](util[_0x015d('0x15')](_0x015d('0x41'),_0x41a010[_0x015d('0x8')]),_0x598bb2);}};exports[_0x015d('0x43')]=function(_0x1ba266){try{if(!_[_0x015d('0x22')](channels[_0x1ba266[_0x015d('0x8')]])){utils[_0x015d('0x14')](util['format'](_0x015d('0x44'),_0x1ba266[_0x015d('0x8')]),_0x1ba266);if(!_[_0x015d('0x22')](_0x1ba266['variable'][_0x015d('0x45')])){utils['info'](util[_0x015d('0x15')](_0x015d('0x46'),_0x1ba266['uniqueid'],_0x1ba266[_0x015d('0x47')]));channels[_0x1ba266[_0x015d('0x8')]][_0x015d('0x48')]=_0x1ba266[_0x015d('0x47')];}if(!_[_0x015d('0x22')](_0x1ba266['variable'][_0x015d('0x49')])){utils[_0x015d('0x6')](util[_0x015d('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1ba266['uniqueid'],_0x1ba266[_0x015d('0x47')]));channels[_0x1ba266[_0x015d('0x8')]]['destination']=_0x1ba266[_0x015d('0x47')];channels[_0x1ba266['uniqueid']][_0x015d('0x2b')]='\x22'+_0x1ba266['value']+'\x22\x20<'+_0x1ba266['value']+'>';}if(!_['isNil'](_0x1ba266[_0x015d('0x4a')]['xmd-callerid-preview'])||!_[_0x015d('0x22')](_0x1ba266[_0x015d('0x4a')][_0x015d('0x4b')])){utils['info'](util[_0x015d('0x15')](_0x015d('0x4c'),_0x1ba266['uniqueid'],!_[_0x015d('0x22')](_0x1ba266[_0x015d('0x4a')]['xmd-callerid-preview'])?_0x015d('0x4d'):'xmd-callerid',_0x1ba266['value']));channels[_0x1ba266[_0x015d('0x8')]][_0x015d('0x2b')]=_0x1ba266['value'];}if(!_[_0x015d('0x22')](_0x1ba266[_0x015d('0x4a')][_0x015d('0x4e')])||!_['isNil'](_0x1ba266['variable'][_0x015d('0x4f')])){utils[_0x015d('0x6')](util[_0x015d('0x15')](_0x015d('0x4c'),_0x1ba266[_0x015d('0x8')],!_['isNil'](_0x1ba266[_0x015d('0x4a')][_0x015d('0x4e')])?_0x015d('0x4e'):_0x015d('0x4f'),_0x1ba266[_0x015d('0x47')]));channels[_0x1ba266['uniqueid']][_0x015d('0x50')]=_0x015d('0x51');channels[_0x1ba266['uniqueid']][_0x015d('0x52')]=_0x1ba266[_0x015d('0x47')];channels[_0x1ba266[_0x015d('0x8')]][_0x015d('0xa')]=!![];}if(!_[_0x015d('0x22')](_0x1ba266['variable'][_0x015d('0x53')])){utils['info'](util[_0x015d('0x15')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1ba266[_0x015d('0x8')],_0x1ba266['value']));channels[_0x1ba266[_0x015d('0x8')]]['ContactId']=_0x1ba266[_0x015d('0x47')];}if(!_[_0x015d('0x22')](_0x1ba266[_0x015d('0x4a')][_0x015d('0x54')])){utils['info'](util['format'](_0x015d('0x55'),_0x1ba266['uniqueid'],_0x1ba266[_0x015d('0x47')]));channels[_0x1ba266[_0x015d('0x8')]][_0x015d('0x56')]=_0x1ba266['value'];}if(!_[_0x015d('0x22')](_0x1ba266[_0x015d('0x4a')][_0x015d('0x57')])){utils[_0x015d('0x6')](util['format'](_0x015d('0x58'),_0x1ba266[_0x015d('0x8')],_0x1ba266[_0x015d('0x47')]));channels[_0x1ba266[_0x015d('0x8')]][_0x015d('0x59')]=_0x1ba266[_0x015d('0x47')];}if(!_[_0x015d('0x22')](_0x1ba266[_0x015d('0x4a')][_0x015d('0x5a')])){utils[_0x015d('0x6')](util[_0x015d('0x15')](_0x015d('0x5b'),_0x1ba266[_0x015d('0x8')],_0x1ba266[_0x015d('0x47')]));channels[_0x1ba266[_0x015d('0x8')]][_0x015d('0x5a')]=_0x1ba266[_0x015d('0x47')];}}}catch(_0x2ae1a){utils['error'](util['format']('[%s][calls][varset]',_0x1ba266['uniqueid']),_0x2ae1a);}};exports[_0x015d('0x5c')]=function(_0x104b75){try{if(!_[_0x015d('0x22')](channels[_0x104b75['uniqueid']])){utils['debug'](util[_0x015d('0x15')](_0x015d('0x5d'),_0x104b75['uniqueid']),_0x104b75);utils[_0x015d('0x6')](util[_0x015d('0x15')](_0x015d('0x5e'),_0x104b75['uniqueid'],_0x104b75[_0x015d('0x5f')],_0x104b75[_0x015d('0x60')]));if(_0x104b75[_0x015d('0x5f')][_0x015d('0x61')]()==_0x015d('0x62')&&_[_0x015d('0x63')](_0x104b75['appdata'][_0x015d('0x61')](),_0x015d('0x64'))){var _0x1ed3cb=_0x104b75[_0x015d('0x60')][_0x015d('0x65')]('=');var _0x5c6c0e=_0x1ed3cb[0x0][_0x015d('0x66')](_0x1ed3cb[0x0]['lastIndexOf']('(')+0x1,_0x1ed3cb[0x0][_0x015d('0x67')](')'));var _0x5e3f93=_0x1ed3cb[0x1];channels[_0x104b75[_0x015d('0x8')]][_0x5c6c0e]=_0x5e3f93;}if(!_['includes'](['hangup',_0x015d('0x68'),'execif','set',_0x015d('0x69')],_0x104b75['application'][_0x015d('0x61')]())){channels[_0x104b75['uniqueid']][_0x015d('0x50')]=_0x104b75['application'];channels[_0x104b75[_0x015d('0x8')]]['lastdata']=_0x104b75[_0x015d('0x60')];}}}catch(_0x2877e5){utils[_0x015d('0x1e')](util[_0x015d('0x15')]('[%s][calls][newexten]',_0x104b75[_0x015d('0x8')]),_0x2877e5);}}; \ No newline at end of file +var _0xf59c=['OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','error','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','noop','util','NO\x20ANSWER','BUSY','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','accountcode','UserId','request','CreateVoiceCallReport','linkedid'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf59c,0x188));var _0xcf59=function(_0x5bafd1,_0x3a6991){_0x5bafd1=_0x5bafd1-0x0;var _0x1f0e68=_0xf59c[_0x5bafd1];return _0x1f0e68;};'use strict';var _=require('lodash');var util=require(_0xcf59('0x0'));var utils=require('./utils');var dispositions=[_0xcf59('0x1'),'FAILED','FAILED','NO\x20ANSWER',_0xcf59('0x1'),_0xcf59('0x1'),'ANSWERED',_0xcf59('0x2'),_0xcf59('0x3'),_0xcf59('0x3'),_0xcf59('0x3')];var channels={};function writeDB(_0x34686c){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x6'),_0x34686c[_0xcf59('0x7')],_0x34686c[_0xcf59('0x8')],_0x34686c[_0xcf59('0x9')],_0x34686c['membername'],_0x34686c[_0xcf59('0xa')],_0x34686c['calleridnum'],_0x34686c['connectedlinenum'],_0x34686c['lastevent']));if(_0x34686c[_0xcf59('0xb')]){utils['getUserByInternal'](_0x34686c[_0xcf59('0xb')])['then'](function(_0x52b027){if(_0x52b027){_0x34686c[_0xcf59('0xc')]=_0x52b027['id'];}utils['request']('CreateVoiceCallReport',_0x34686c);});}else{utils[_0xcf59('0xd')](_0xcf59('0xe'),_0x34686c);}if(channels[_0x34686c[_0xcf59('0x7')]]){delete channels[_0x34686c[_0xcf59('0x7')]];}}exports['newchannel']=function(_0x1e4be7){try{utils['debug'](util[_0xcf59('0x5')]('[%s][calls][newchannel]',_0x1e4be7['uniqueid']),_0x1e4be7);if(_0x1e4be7[_0xcf59('0x7')]==_0x1e4be7[_0xcf59('0xf')]&&_0x1e4be7[_0xcf59('0x8')]!=_0xcf59('0x10')){utils['info'](util[_0xcf59('0x5')](_0xcf59('0x11'),_0x1e4be7[_0xcf59('0x7')],_0x1e4be7['context'],_0x1e4be7[_0xcf59('0x12')]));channels[_0x1e4be7[_0xcf59('0x7')]]={'uniqueid':_0x1e4be7['uniqueid'],'accountcode':_0x1e4be7[_0xcf59('0xb')],'source':_0x1e4be7[_0xcf59('0x13')],'destination':_0x1e4be7[_0xcf59('0x12')],'destinationcontext':_0x1e4be7[_0xcf59('0x14')],'channel':_0x1e4be7[_0xcf59('0x8')],'starttime':utils[_0xcf59('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcf59('0x1'),'amaflags':_0xcf59('0x16')};}}catch(_0x295fbb){utils['error'](util[_0xcf59('0x5')](_0xcf59('0x17'),_0x1e4be7[_0xcf59('0x7')]),_0x295fbb);}};exports[_0xcf59('0x18')]=function(_0x1a4fa9){try{utils[_0xcf59('0x19')](util['format'](_0xcf59('0x1a'),_0x1a4fa9[_0xcf59('0x7')]),_0x1a4fa9);if(!_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0x7')]])&&_0x1a4fa9[_0xcf59('0x1c')]==0x6){utils[_0xcf59('0x4')](util[_0xcf59('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1a4fa9['uniqueid'],_0x1a4fa9[_0xcf59('0x14')],_0x1a4fa9[_0xcf59('0x8')]));if(_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0x7')]][_0xcf59('0x1d')])){channels[_0x1a4fa9[_0xcf59('0x7')]][_0xcf59('0x1d')]=utils[_0xcf59('0x15')]();}}else if(!_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0xf')]])&&_0x1a4fa9[_0xcf59('0x1c')]==0x6&&_0x1a4fa9[_0xcf59('0x14')]!=_0xcf59('0x1e')){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x1f'),_0x1a4fa9[_0xcf59('0x7')],_0x1a4fa9[_0xcf59('0xf')],_0x1a4fa9[_0xcf59('0x14')],_0x1a4fa9[_0xcf59('0x8')]));channels[_0x1a4fa9[_0xcf59('0xf')]][_0xcf59('0xb')]=_0x1a4fa9['accountcode'];channels[_0x1a4fa9['linkedid']][_0xcf59('0x20')]=_0x1a4fa9['channel'];if(_[_0xcf59('0x1b')](channels[_0x1a4fa9[_0xcf59('0xf')]][_0xcf59('0x21')])){channels[_0x1a4fa9['linkedid']][_0xcf59('0x21')]=utils['now']();}channels[_0x1a4fa9[_0xcf59('0xf')]][_0xcf59('0x22')]=dispositions[_[_0xcf59('0x23')](_0x1a4fa9[_0xcf59('0x1c')])]||_0xcf59('0x24');}}catch(_0x35f076){utils['error'](util[_0xcf59('0x5')](_0xcf59('0x1a'),_0x1a4fa9['uniqueid']),_0x35f076);}};exports[_0xcf59('0x25')]=function(_0x57fe1e){try{if(!_[_0xcf59('0x1b')](channels[_0x57fe1e[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x26'),_0x57fe1e[_0xcf59('0x7')]),_0x57fe1e);if(_[_0xcf59('0x1b')](channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x27')])){channels[_0x57fe1e['uniqueid']][_0xcf59('0x27')]=_0x57fe1e[_0xcf59('0x28')]+'\x20<'+_0x57fe1e['calleridnum']+'>';}utils[_0xcf59('0x4')](util['format'](_0xcf59('0x29'),_0x57fe1e[_0xcf59('0x7')],channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x27')],_0x57fe1e[_0xcf59('0x2a')]));channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2b')]=utils[_0xcf59('0x15')]();channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2c')]=utils[_0xcf59('0x2d')](channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2b')],channels[_0x57fe1e['uniqueid']][_0xcf59('0x2e')]);channels[_0x57fe1e[_0xcf59('0x7')]]['billableseconds']=channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x21')]?utils['diffTime'](channels[_0x57fe1e[_0xcf59('0x7')]][_0xcf59('0x2b')],channels[_0x57fe1e['uniqueid']][_0xcf59('0x21')]):0x0;writeDB(channels[_0x57fe1e[_0xcf59('0x7')]]);}}catch(_0x1773c4){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x26'),_0x57fe1e[_0xcf59('0x7')]),_0x1773c4);}};exports['attendedtransfer']=function(_0x3a5d1f){try{if(!_[_0xcf59('0x1b')](channels[_0x3a5d1f[_0xcf59('0x30')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x31'),_0x3a5d1f[_0xcf59('0x32')]),_0x3a5d1f);if(channels[_0x3a5d1f[_0xcf59('0x30')]][_0xcf59('0x8')]==_0x3a5d1f[_0xcf59('0x33')]){utils[_0xcf59('0x4')](util['format'](_0xcf59('0x34'),_0x3a5d1f[_0xcf59('0x32')],_0x3a5d1f[_0xcf59('0x30')],_0x3a5d1f[_0xcf59('0x35')]));channels[_0x3a5d1f['localtwolinkedid']][_0xcf59('0x20')]=_0x3a5d1f['secondtransfererchannel'];channels[_0x3a5d1f['localtwolinkedid']][_0xcf59('0x36')]='_attended';}else if(channels[_0x3a5d1f['localtwolinkedid']]['channel']=_0x3a5d1f[_0xcf59('0x37')]){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x34'),_0x3a5d1f[_0xcf59('0x32')],_0x3a5d1f[_0xcf59('0x30')],_0x3a5d1f[_0xcf59('0x38')]));channels[_0x3a5d1f['localtwolinkedid']][_0xcf59('0x20')]=_0x3a5d1f[_0xcf59('0x38')];channels[_0x3a5d1f[_0xcf59('0x30')]]['userfield']=_0xcf59('0x39');}}}catch(_0x118032){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x31'),_0x3a5d1f['origtransfereruniqueid']),_0x118032);}};exports[_0xcf59('0x3a')]=function(_0x5a08e9){try{if(!_[_0xcf59('0x1b')](channels[_0x5a08e9[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x3b'),_0x5a08e9[_0xcf59('0x7')]),_0x5a08e9);channels[_0x5a08e9[_0xcf59('0x7')]][_0xcf59('0x3c')]=utils[_0xcf59('0x15')]();utils[_0xcf59('0x4')](util[_0xcf59('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5a08e9[_0xcf59('0x7')],channels[_0x5a08e9[_0xcf59('0x7')]][_0xcf59('0x3c')]));}}catch(_0x564070){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x3b'),_0x5a08e9['uniqueid']),_0x564070);}};exports['musiconholdstop']=function(_0x3287ef){try{if(!_[_0xcf59('0x1b')](channels[_0x3287ef[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util[_0xcf59('0x5')](_0xcf59('0x3d'),_0x3287ef[_0xcf59('0x7')]),_0x3287ef);if(!_['isNil'](channels[_0x3287ef[_0xcf59('0x7')]][_0xcf59('0x3c')])){channels[_0x3287ef[_0xcf59('0x7')]][_0xcf59('0x3e')]+=utils[_0xcf59('0x2d')](utils[_0xcf59('0x15')](),channels[_0x3287ef[_0xcf59('0x7')]]['musiconholdstartAt']);utils[_0xcf59('0x4')](util[_0xcf59('0x5')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3287ef[_0xcf59('0x7')],channels[_0x3287ef['uniqueid']][_0xcf59('0x3e')]));delete channels[_0x3287ef[_0xcf59('0x7')]][_0xcf59('0x3c')];}}}catch(_0x3ae1c2){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x3d'),_0x3287ef['uniqueid']),_0x3ae1c2);}};exports[_0xcf59('0x3f')]=function(_0x3258b9){try{if(!_['isNil'](channels[_0x3258b9['uniqueid']])){utils['debug'](util[_0xcf59('0x5')](_0xcf59('0x40'),_0x3258b9[_0xcf59('0x7')]),_0x3258b9);if(!_[_0xcf59('0x1b')](_0x3258b9['variable'][_0xcf59('0x41')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x42'),_0x3258b9['uniqueid'],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9['uniqueid']]['source']=_0x3258b9[_0xcf59('0x43')];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x45')])){utils['info'](util[_0xcf59('0x5')](_0xcf59('0x46'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x47')]=_0x3258b9['value'];channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x27')]='\x22'+_0x3258b9['value']+'\x22\x20<'+_0x3258b9['value']+'>';}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')]['xmd-callerid-preview'])||!_['isNil'](_0x3258b9[_0xcf59('0x44')]['xmd-callerid'])){utils[_0xcf59('0x4')](util['format'](_0xcf59('0x48'),_0x3258b9[_0xcf59('0x7')],!_['isNil'](_0x3258b9['variable'][_0xcf59('0x49')])?_0xcf59('0x49'):_0xcf59('0x4a'),_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]]['callerid']=_0x3258b9[_0xcf59('0x43')];}if(!_['isNil'](_0x3258b9[_0xcf59('0x44')]['xmd-queue'])||!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x4b')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x48'),_0x3258b9[_0xcf59('0x7')],!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x4c')])?_0xcf59('0x4c'):_0xcf59('0x4b'),_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]]['lastapplication']=_0xcf59('0x4d');channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x4e')]=_0x3258b9[_0xcf59('0x43')];channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x9')]=!![];}if(!_[_0xcf59('0x1b')](_0x3258b9['variable'][_0xcf59('0x4f')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x50'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9['uniqueid']][_0xcf59('0x51')]=_0x3258b9['value'];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x52')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x53'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x54')]=_0x3258b9[_0xcf59('0x43')];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x55')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x56'),_0x3258b9[_0xcf59('0x7')],_0x3258b9[_0xcf59('0x43')]));channels[_0x3258b9[_0xcf59('0x7')]]['routeid']=_0x3258b9['value'];}if(!_[_0xcf59('0x1b')](_0x3258b9[_0xcf59('0x44')][_0xcf59('0x57')])){utils[_0xcf59('0x4')](util[_0xcf59('0x5')](_0xcf59('0x58'),_0x3258b9[_0xcf59('0x7')],_0x3258b9['value']));channels[_0x3258b9[_0xcf59('0x7')]][_0xcf59('0x57')]=_0x3258b9[_0xcf59('0x43')];}}}catch(_0x29d75e){utils[_0xcf59('0x2f')](util['format'](_0xcf59('0x40'),_0x3258b9[_0xcf59('0x7')]),_0x29d75e);}};exports['newexten']=function(_0x1b3e6d){try{if(!_[_0xcf59('0x1b')](channels[_0x1b3e6d[_0xcf59('0x7')]])){utils[_0xcf59('0x19')](util['format'](_0xcf59('0x59'),_0x1b3e6d[_0xcf59('0x7')]),_0x1b3e6d);utils['info'](util[_0xcf59('0x5')](_0xcf59('0x5a'),_0x1b3e6d['uniqueid'],_0x1b3e6d[_0xcf59('0x5b')],_0x1b3e6d['appdata']));if(_0x1b3e6d[_0xcf59('0x5b')]['toLowerCase']()==_0xcf59('0x5c')&&_[_0xcf59('0x5d')](_0x1b3e6d['appdata'][_0xcf59('0x5e')](),_0xcf59('0x5f'))){var _0x34489d=_0x1b3e6d[_0xcf59('0x60')][_0xcf59('0x61')]('=');var _0x94c69b=_0x34489d[0x0][_0xcf59('0x62')](_0x34489d[0x0][_0xcf59('0x63')]('(')+0x1,_0x34489d[0x0][_0xcf59('0x63')](')'));var _0x174d79=_0x34489d[0x1];channels[_0x1b3e6d[_0xcf59('0x7')]][_0x94c69b]=_0x174d79;}if(!_[_0xcf59('0x64')]([_0xcf59('0x25'),_0xcf59('0x65'),'execif',_0xcf59('0x5c'),'gotoif'],_0x1b3e6d[_0xcf59('0x5b')][_0xcf59('0x5e')]())){channels[_0x1b3e6d[_0xcf59('0x7')]]['lastapplication']=_0x1b3e6d[_0xcf59('0x5b')];channels[_0x1b3e6d[_0xcf59('0x7')]][_0xcf59('0x4e')]=_0x1b3e6d[_0xcf59('0x60')];}}}catch(_0x5139c6){utils[_0xcf59('0x2f')](util[_0xcf59('0x5')](_0xcf59('0x59'),_0x1b3e6d['uniqueid']),_0x5139c6);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e4952f1..d3c0a1d 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 _0xe056=['connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','./utils'];(function(_0x13e16f,_0x351117){var _0x36e74f=function(_0x26205e){while(--_0x26205e){_0x13e16f['push'](_0x13e16f['shift']());}};_0x36e74f(++_0x351117);}(_0xe056,0xc5));var _0x6e05=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xe056[_0x46efd7];return _0x5637e4;};'use strict';var utils=require(_0x6e05('0x0'));exports[_0x6e05('0x1')]=function(){utils[_0x6e05('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x6e05('0x2')](_0x6e05('0x3'));};exports[_0x6e05('0x4')]=function(){utils[_0x6e05('0x2')](_0x6e05('0x5'));};exports['error']=function(_0x10065d){utils[_0x6e05('0x6')](_0x6e05('0x7'),_0x10065d);};exports[_0x6e05('0x8')]=function(){utils[_0x6e05('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x4cc2fe){}; \ No newline at end of file +var _0x5a8f=['fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5a8f,0x1be));var _0xf5a8=function(_0x17bec1,_0x5927a6){_0x17bec1=_0x17bec1-0x0;var _0x1502c8=_0x5a8f[_0x17bec1];return _0x1502c8;};'use strict';var utils=require(_0xf5a8('0x0'));exports[_0xf5a8('0x1')]=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x3'));};exports['shutdown']=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x4'));};exports[_0xf5a8('0x5')]=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x6'));};exports['error']=function(_0x39ce05){utils['error'](_0xf5a8('0x7'),_0x39ce05);};exports[_0xf5a8('0x8')]=function(){utils[_0xf5a8('0x2')](_0xf5a8('0x9'));};exports[_0xf5a8('0xa')]=function(_0x27a31e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 58603bf..a318c13 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 _0xcc36=['starttime','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','cdr(routeid)','error','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime'];(function(_0x29950b,_0x1f817e){var _0x10b8db=function(_0x14fdfd){while(--_0x14fdfd){_0x29950b['push'](_0x29950b['shift']());}};_0x10b8db(++_0x1f817e);}(_0xcc36,0xc1));var _0x6cc3=function(_0x5edfba,_0x1dbfe3){_0x5edfba=_0x5edfba-0x0;var _0x45432a=_0xcc36[_0x5edfba];return _0x45432a;};'use strict';var _=require(_0x6cc3('0x0'));var util=require(_0x6cc3('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2fc817){utils[_0x6cc3('0x2')](util[_0x6cc3('0x3')](_0x6cc3('0x4'),_0x2fc817[_0x6cc3('0x5')],_0x2fc817[_0x6cc3('0x6')],_0x2fc817[_0x6cc3('0x7')],_0x2fc817[_0x6cc3('0x8')],_0x2fc817[_0x6cc3('0x9')],_0x2fc817[_0x6cc3('0xa')]));utils['request']('CreateVoiceDialReport',_0x2fc817);delete dials[_0x2fc817['uniqueid']];}exports[_0x6cc3('0xb')]=function(_0x19725a){try{utils[_0x6cc3('0xc')](util[_0x6cc3('0x3')](_0x6cc3('0xd'),_0x19725a['uniqueid']),_0x19725a);utils[_0x6cc3('0x2')](util[_0x6cc3('0x3')](_0x6cc3('0xe'),_0x19725a['uniqueid'],_0x19725a[_0x6cc3('0xf')],_0x19725a['appdata']));if(_0x19725a[_0x6cc3('0xf')][_0x6cc3('0x10')]()==_0x6cc3('0x11')&&_['startsWith'](_0x19725a['appdata'][_0x6cc3('0x10')](),_0x6cc3('0x12'))){var _0x2da9b9=_0x19725a['appdata']['split']('=');dials[_0x19725a[_0x6cc3('0x5')]]={'routeId':_0x2da9b9[0x1]};}}catch(_0x241993){utils[_0x6cc3('0x13')](util[_0x6cc3('0x3')](_0x6cc3('0xd'),_0x19725a[_0x6cc3('0x5')]),_0x241993);}};exports['varset']=function(_0x3cd606){try{utils[_0x6cc3('0xc')](util[_0x6cc3('0x3')](_0x6cc3('0x14'),_0x3cd606[_0x6cc3('0x5')]),_0x3cd606);if(!_[_0x6cc3('0x15')](_0x3cd606['variable'][_0x6cc3('0x16')])){utils[_0x6cc3('0x2')](util['format'](_0x6cc3('0x17'),_0x3cd606[_0x6cc3('0x5')],_0x3cd606[_0x6cc3('0x18')]));dials[_0x3cd606[_0x6cc3('0x5')]]={'routeId':_0x3cd606[_0x6cc3('0x18')]};}}catch(_0x4a5bc4){utils[_0x6cc3('0x13')](util[_0x6cc3('0x3')](_0x6cc3('0x14'),_0x3cd606[_0x6cc3('0x5')]),_0x4a5bc4);}};exports[_0x6cc3('0x19')]=function(_0x4c832d){try{if(!_['isNil'](dials[_0x4c832d[_0x6cc3('0x5')]])){utils[_0x6cc3('0xc')](util[_0x6cc3('0x3')](_0x6cc3('0x1a'),_0x4c832d['uniqueid']),_0x4c832d);dials[_0x4c832d[_0x6cc3('0x5')]]=_[_0x6cc3('0x1b')](dials[_0x4c832d['uniqueid']],_0x4c832d);dials[_0x4c832d[_0x6cc3('0x5')]]['starttime']=utils['now']();dials[_0x4c832d[_0x6cc3('0x5')]][_0x6cc3('0x1c')]=_0x6cc3('0x1d');utils[_0x6cc3('0x2')](util[_0x6cc3('0x3')](_0x6cc3('0x1e'),_0x4c832d['uniqueid'],dials[_0x4c832d[_0x6cc3('0x5')]]['starttime']));}}catch(_0x30ecfa){utils['error'](util[_0x6cc3('0x3')](_0x6cc3('0x1a'),_0x4c832d[_0x6cc3('0x5')]),_0x30ecfa);}};exports[_0x6cc3('0x1f')]=function(_0x9d639c){try{if(!_[_0x6cc3('0x15')](dials[_0x9d639c[_0x6cc3('0x5')]])){utils[_0x6cc3('0xc')](util[_0x6cc3('0x3')](_0x6cc3('0x20'),_0x9d639c[_0x6cc3('0x5')]),_0x9d639c);dials[_0x9d639c[_0x6cc3('0x5')]][_0x6cc3('0xa')]=_0x9d639c['dialstatus'];if(_0x9d639c[_0x6cc3('0xa')]==_0x6cc3('0x21')){dials[_0x9d639c['uniqueid']]=_[_0x6cc3('0x1b')](dials[_0x9d639c[_0x6cc3('0x5')]],_0x9d639c);dials[_0x9d639c[_0x6cc3('0x5')]][_0x6cc3('0x22')]=utils[_0x6cc3('0x23')]();dials[_0x9d639c[_0x6cc3('0x5')]][_0x6cc3('0x1c')]=_0x6cc3('0x24');utils[_0x6cc3('0x2')](util[_0x6cc3('0x3')](_0x6cc3('0x25'),_0x9d639c[_0x6cc3('0x5')],_0x9d639c[_0x6cc3('0xa')],dials[_0x9d639c[_0x6cc3('0x5')]]['answertime']));}else{utils[_0x6cc3('0x2')](util[_0x6cc3('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x9d639c['uniqueid'],_0x9d639c['dialstatus']));}}}catch(_0x358d32){utils[_0x6cc3('0x13')](util[_0x6cc3('0x3')](_0x6cc3('0x20'),_0x9d639c[_0x6cc3('0x5')]),_0x358d32);}};exports[_0x6cc3('0x26')]=function(_0x26cca2){try{if(!_[_0x6cc3('0x15')](dials[_0x26cca2[_0x6cc3('0x5')]])){utils[_0x6cc3('0xc')](util[_0x6cc3('0x3')](_0x6cc3('0x27'),_0x26cca2[_0x6cc3('0x5')]),_0x26cca2);utils[_0x6cc3('0x2')](util[_0x6cc3('0x3')](_0x6cc3('0x28'),_0x26cca2['uniqueid'],_0x26cca2['calleridnum'],_0x26cca2[_0x6cc3('0x29')],_0x26cca2['cause-txt']));dials[_0x26cca2['uniqueid']]=_[_0x6cc3('0x1b')](dials[_0x26cca2[_0x6cc3('0x5')]],{'endtime':utils[_0x6cc3('0x23')](),'lastevent':_0x6cc3('0x2a')});dials[_0x26cca2[_0x6cc3('0x5')]][_0x6cc3('0x2b')]=utils[_0x6cc3('0x2c')](dials[_0x26cca2['uniqueid']][_0x6cc3('0x2d')],dials[_0x26cca2['uniqueid']]['starttime']);dials[_0x26cca2['uniqueid']][_0x6cc3('0x2e')]=utils[_0x6cc3('0x2c')](dials[_0x26cca2[_0x6cc3('0x5')]]['answertime']||dials[_0x26cca2[_0x6cc3('0x5')]][_0x6cc3('0x2d')],dials[_0x26cca2[_0x6cc3('0x5')]][_0x6cc3('0x2f')]);dials[_0x26cca2['uniqueid']]['billableseconds']=dials[_0x26cca2[_0x6cc3('0x5')]][_0x6cc3('0x22')]?utils[_0x6cc3('0x2c')](dials[_0x26cca2[_0x6cc3('0x5')]][_0x6cc3('0x2d')],dials[_0x26cca2[_0x6cc3('0x5')]][_0x6cc3('0x22')]):0x0;writeDB(dials[_0x26cca2['uniqueid']]);}}catch(_0x1c5555){utils['error'](util[_0x6cc3('0x3')](_0x6cc3('0x27'),_0x26cca2['uniqueid']),_0x1c5555);}}; \ No newline at end of file +var _0xab00=['startsWith','cdr(routeid)','varset','[%s][dials][varset]','variable','outboundrouteid','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','diffTime','endtime','holdtime','billableseconds','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab00,0x108));var _0x0ab0=function(_0x1b1e22,_0x885fd2){_0x1b1e22=_0x1b1e22-0x0;var _0x55939f=_0xab00[_0x1b1e22];return _0x55939f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0ab0('0x0'));var dials={};function writeDB(_0x5d8a52){utils[_0x0ab0('0x1')](util[_0x0ab0('0x2')](_0x0ab0('0x3'),_0x5d8a52[_0x0ab0('0x4')],_0x5d8a52['channel'],_0x5d8a52['dialstring'],_0x5d8a52[_0x0ab0('0x5')],_0x5d8a52[_0x0ab0('0x6')],_0x5d8a52[_0x0ab0('0x7')]));utils[_0x0ab0('0x8')](_0x0ab0('0x9'),_0x5d8a52);delete dials[_0x5d8a52[_0x0ab0('0x4')]];}exports[_0x0ab0('0xa')]=function(_0x1042b0){try{utils[_0x0ab0('0xb')](util[_0x0ab0('0x2')](_0x0ab0('0xc'),_0x1042b0['uniqueid']),_0x1042b0);utils[_0x0ab0('0x1')](util[_0x0ab0('0x2')](_0x0ab0('0xd'),_0x1042b0[_0x0ab0('0x4')],_0x1042b0[_0x0ab0('0xe')],_0x1042b0[_0x0ab0('0xf')]));if(_0x1042b0[_0x0ab0('0xe')][_0x0ab0('0x10')]()==_0x0ab0('0x11')&&_[_0x0ab0('0x12')](_0x1042b0[_0x0ab0('0xf')][_0x0ab0('0x10')](),_0x0ab0('0x13'))){var _0x56ac6a=_0x1042b0[_0x0ab0('0xf')]['split']('=');dials[_0x1042b0['uniqueid']]={'routeId':_0x56ac6a[0x1]};}}catch(_0x3c117e){utils['error'](util['format'](_0x0ab0('0xc'),_0x1042b0['uniqueid']),_0x3c117e);}};exports[_0x0ab0('0x14')]=function(_0x139835){try{utils['debug'](util['format'](_0x0ab0('0x15'),_0x139835[_0x0ab0('0x4')]),_0x139835);if(!_['isNil'](_0x139835[_0x0ab0('0x16')][_0x0ab0('0x17')])){utils[_0x0ab0('0x1')](util[_0x0ab0('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x139835[_0x0ab0('0x4')],_0x139835[_0x0ab0('0x18')]));dials[_0x139835['uniqueid']]={'routeId':_0x139835[_0x0ab0('0x18')]};}}catch(_0x523daa){utils['error'](util[_0x0ab0('0x2')](_0x0ab0('0x15'),_0x139835['uniqueid']),_0x523daa);}};exports['dialbegin']=function(_0x521bb7){try{if(!_[_0x0ab0('0x19')](dials[_0x521bb7[_0x0ab0('0x4')]])){utils['debug'](util['format'](_0x0ab0('0x1a'),_0x521bb7[_0x0ab0('0x4')]),_0x521bb7);dials[_0x521bb7[_0x0ab0('0x4')]]=_[_0x0ab0('0x1b')](dials[_0x521bb7[_0x0ab0('0x4')]],_0x521bb7);dials[_0x521bb7['uniqueid']][_0x0ab0('0x1c')]=utils[_0x0ab0('0x1d')]();dials[_0x521bb7[_0x0ab0('0x4')]][_0x0ab0('0x1e')]='called';utils['info'](util['format'](_0x0ab0('0x1f'),_0x521bb7[_0x0ab0('0x4')],dials[_0x521bb7[_0x0ab0('0x4')]][_0x0ab0('0x1c')]));}}catch(_0xbef9dd){utils[_0x0ab0('0x20')](util['format'](_0x0ab0('0x1a'),_0x521bb7[_0x0ab0('0x4')]),_0xbef9dd);}};exports[_0x0ab0('0x21')]=function(_0x469ad9){try{if(!_[_0x0ab0('0x19')](dials[_0x469ad9[_0x0ab0('0x4')]])){utils['debug'](util['format']('[%s][dials][dialend]',_0x469ad9[_0x0ab0('0x4')]),_0x469ad9);dials[_0x469ad9[_0x0ab0('0x4')]]['dialstatus']=_0x469ad9[_0x0ab0('0x7')];if(_0x469ad9[_0x0ab0('0x7')]==_0x0ab0('0x22')){dials[_0x469ad9[_0x0ab0('0x4')]]=_[_0x0ab0('0x1b')](dials[_0x469ad9[_0x0ab0('0x4')]],_0x469ad9);dials[_0x469ad9[_0x0ab0('0x4')]][_0x0ab0('0x23')]=utils['now']();dials[_0x469ad9[_0x0ab0('0x4')]][_0x0ab0('0x1e')]='connect';utils[_0x0ab0('0x1')](util['format'](_0x0ab0('0x24'),_0x469ad9[_0x0ab0('0x4')],_0x469ad9[_0x0ab0('0x7')],dials[_0x469ad9['uniqueid']][_0x0ab0('0x23')]));}else{utils[_0x0ab0('0x1')](util['format'](_0x0ab0('0x25'),_0x469ad9['uniqueid'],_0x469ad9[_0x0ab0('0x7')]));}}}catch(_0x54072c){utils[_0x0ab0('0x20')](util[_0x0ab0('0x2')](_0x0ab0('0x26'),_0x469ad9[_0x0ab0('0x4')]),_0x54072c);}};exports['hangup']=function(_0x123288){try{if(!_[_0x0ab0('0x19')](dials[_0x123288['uniqueid']])){utils[_0x0ab0('0xb')](util[_0x0ab0('0x2')](_0x0ab0('0x27'),_0x123288['uniqueid']),_0x123288);utils['info'](util['format'](_0x0ab0('0x28'),_0x123288['uniqueid'],_0x123288[_0x0ab0('0x5')],_0x123288[_0x0ab0('0x29')],_0x123288[_0x0ab0('0x2a')]));dials[_0x123288['uniqueid']]=_[_0x0ab0('0x1b')](dials[_0x123288[_0x0ab0('0x4')]],{'endtime':utils[_0x0ab0('0x1d')](),'lastevent':'complete'});dials[_0x123288['uniqueid']]['duration']=utils[_0x0ab0('0x2b')](dials[_0x123288['uniqueid']][_0x0ab0('0x2c')],dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x1c')]);dials[_0x123288['uniqueid']][_0x0ab0('0x2d')]=utils[_0x0ab0('0x2b')](dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x23')]||dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x2c')],dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x1c')]);dials[_0x123288['uniqueid']][_0x0ab0('0x2e')]=dials[_0x123288[_0x0ab0('0x4')]]['answertime']?utils['diffTime'](dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x2c')],dials[_0x123288[_0x0ab0('0x4')]][_0x0ab0('0x23')]):0x0;writeDB(dials[_0x123288[_0x0ab0('0x4')]]);}}catch(_0x18a374){utils[_0x0ab0('0x20')](util[_0x0ab0('0x2')](_0x0ab0('0x27'),_0x123288['uniqueid']),_0x18a374);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a906abb..6c48094 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 _0x5482=['xdr','disabled','env','local','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','error','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x5482,0x11c));var _0x2548=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0x5482[_0x400b6c];return _0x4c4e3e;};var AsteriskManager=require(_0x2548('0x0'));var config=require(_0x2548('0x1'));var utils=require(_0x2548('0x2'));var util=require(_0x2548('0x3'));var isXDREnabled=config[_0x2548('0x4')]&&config[_0x2548('0x4')][_0x2548('0x5')]?!config['xdr'][_0x2548('0x5')]:!![];var isProduction=config[_0x2548('0x6')]==='production'||![];var isLocalAsterisk=config[_0x2548('0x4')]&&config['xdr'][_0x2548('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x2548('0x8')]['port'],config[_0x2548('0x8')]['ip'],config[_0x2548('0x8')][_0x2548('0x9')],config[_0x2548('0x8')][_0x2548('0xa')],!![]);ami[_0x2548('0xb')]();if(!isXDREnabled){utils[_0x2548('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x2548('0xd'));}else{var agents=require(_0x2548('0xe'));var calls=require('./calls.controller');var queues=require(_0x2548('0xf'));var recordings=require(_0x2548('0x10'));var members=require(_0x2548('0x11'));var dials=require(_0x2548('0x12'));var transfers=require(_0x2548('0x13'));var core=require(_0x2548('0x14'));ami['on'](_0x2548('0x15'),core[_0x2548('0x15')]);ami['on'](_0x2548('0x16'),core[_0x2548('0x16')]);ami['on'](_0x2548('0x17'),core[_0x2548('0x17')]);ami['on']('error',core['error']);ami['on'](_0x2548('0x18'),core[_0x2548('0x18')]);ami['on'](_0x2548('0x19'),core[_0x2548('0x19')]);ami['on'](_0x2548('0x1a'),function(_0x4725d1){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x1d'),_0x4725d1[_0x2548('0x1e')]),_0x4725d1);members[_0x2548('0x1a')](_0x4725d1);}catch(_0x2fede7){utils['error'](util[_0x2548('0x1c')](_0x2548('0x1d'),_0x4725d1[_0x2548('0x1e')]),_0x2fede7);}});ami['on'](_0x2548('0x1f'),function(_0x5d2355){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x20'),_0x5d2355[_0x2548('0x21')]),_0x5d2355);agents[_0x2548('0x1f')](_0x5d2355);}catch(_0x2a34eb){utils['error'](util[_0x2548('0x1c')](_0x2548('0x20'),_0x5d2355[_0x2548('0x21')]),_0x2a34eb);}});ami['on'](_0x2548('0x22'),function(_0x5b3a3c){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x23'),_0x5b3a3c[_0x2548('0x21')]),_0x5b3a3c);agents['agentringnoanswer'](_0x5b3a3c);}catch(_0x2ed308){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x23'),_0x5b3a3c[_0x2548('0x21')]),_0x2ed308);}});ami['on'](_0x2548('0x25'),function(_0x915dd0){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x26'),_0x915dd0[_0x2548('0x21')]),_0x915dd0);agents[_0x2548('0x25')](_0x915dd0);queues[_0x2548('0x25')](_0x915dd0);}catch(_0x7af273){utils[_0x2548('0x24')](util[_0x2548('0x1c')]('[%s][index][agentconnect]',_0x915dd0[_0x2548('0x21')]),_0x7af273);}});ami['on'](_0x2548('0x27'),function(_0x49f35c){try{utils['debug'](util['format'](_0x2548('0x28'),_0x49f35c[_0x2548('0x21')]),_0x49f35c);agents[_0x2548('0x27')](_0x49f35c);queues['agentcomplete'](_0x49f35c);members[_0x2548('0x27')](_0x49f35c);}catch(_0x14cd68){utils[_0x2548('0x24')](util[_0x2548('0x1c')]('[%s][index][agentcomplete]',_0x49f35c[_0x2548('0x21')]),_0x14cd68);}});ami['on']('queuecallerabandon',function(_0x576dfa){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x29'),_0x576dfa[_0x2548('0x21')]),_0x576dfa);agents['queuecallerabandon'](_0x576dfa);queues[_0x2548('0x2a')](_0x576dfa);}catch(_0x4528df){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x29'),_0x576dfa[_0x2548('0x21')]),_0x4528df);}});ami['on'](_0x2548('0x2b'),function(_0x35be38){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')]('[%s][index][queuecallerjoin]',_0x35be38[_0x2548('0x21')]),_0x35be38);queues['queuecallerjoin'](_0x35be38);recordings[_0x2548('0x2b')](_0x35be38);}catch(_0x3fad74){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x2c'),_0x35be38['uniqueid']),_0x3fad74);}});ami['on'](_0x2548('0x2d'),function(_0x5d90f7){try{utils[_0x2548('0x1b')](util['format'](_0x2548('0x2e'),_0x5d90f7[_0x2548('0x21')]),_0x5d90f7);queues[_0x2548('0x2d')](_0x5d90f7);}catch(_0x1a23ae){utils['error'](util['format'](_0x2548('0x2e'),_0x5d90f7[_0x2548('0x21')]),_0x1a23ae);}});ami['on'](_0x2548('0x2f'),function(_0x58eda6){try{utils['debug'](util['format'](_0x2548('0x30'),_0x58eda6[_0x2548('0x21')]),_0x58eda6);queues['musiconholdstart'](_0x58eda6);calls['musiconholdstart'](_0x58eda6);}catch(_0x3f8d20){utils[_0x2548('0x24')](util[_0x2548('0x1c')]('[%s][index][musiconholdstart]',_0x58eda6[_0x2548('0x21')]),_0x3f8d20);}});ami['on'](_0x2548('0x31'),function(_0x1dcbb9){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x32'),_0x1dcbb9[_0x2548('0x21')]),_0x1dcbb9);queues[_0x2548('0x31')](_0x1dcbb9);calls[_0x2548('0x31')](_0x1dcbb9);}catch(_0xb0969){utils['error'](util['format'](_0x2548('0x32'),_0x1dcbb9[_0x2548('0x21')]),_0xb0969);}});ami['on']('newstate',function(_0x23e80b){try{utils[_0x2548('0x1b')](util['format'](_0x2548('0x33'),_0x23e80b[_0x2548('0x21')]),_0x23e80b);calls[_0x2548('0x34')](_0x23e80b);recordings[_0x2548('0x34')](_0x23e80b);}catch(_0x11365d){utils['error'](util[_0x2548('0x1c')](_0x2548('0x33'),_0x23e80b[_0x2548('0x21')]),_0x11365d);}});ami['on'](_0x2548('0x35'),function(_0x54ddfe){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x36'),_0x54ddfe['uniqueid']),_0x54ddfe);calls[_0x2548('0x35')](_0x54ddfe);recordings['hangup'](_0x54ddfe);dials['hangup'](_0x54ddfe);agents[_0x2548('0x35')](_0x54ddfe);queues[_0x2548('0x35')](_0x54ddfe);}catch(_0x580d02){utils[_0x2548('0x24')](util[_0x2548('0x1c')]('[%s][index][hangup]',_0x54ddfe['uniqueid']),_0x580d02);}});ami['on']('cdr',function(_0x5a6ab6){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x37'),_0x5a6ab6['uniqueid']),_0x5a6ab6);members['cdr'](_0x5a6ab6);}catch(_0x5789c6){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x37'),_0x5a6ab6[_0x2548('0x21')]),_0x5789c6);}});ami['on'](_0x2548('0x38'),function(_0x5e4b23){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x39'),_0x5e4b23[_0x2548('0x21')]),_0x5e4b23);queues[_0x2548('0x38')](_0x5e4b23);agents[_0x2548('0x38')](_0x5e4b23);transfers[_0x2548('0x38')](_0x5e4b23);}catch(_0x3f603d){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x39'),_0x5e4b23[_0x2548('0x21')]),_0x3f603d);}});ami['on'](_0x2548('0x3a'),function(_0x35f1b5){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')]('[%s][index][attendedtransfer]',_0x35f1b5[_0x2548('0x3b')]),_0x35f1b5);queues[_0x2548('0x3a')](_0x35f1b5);transfers['attendedtransfer'](_0x35f1b5);agents['attendedtransfer'](_0x35f1b5);calls[_0x2548('0x3a')](_0x35f1b5);}catch(_0x14dd8e){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x3c'),_0x35f1b5[_0x2548('0x3b')]),_0x14dd8e);}});ami['on'](_0x2548('0x3d'),function(_0x24a609){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x3e'),_0x24a609[_0x2548('0x21')]),_0x24a609);queues['varset'](_0x24a609);recordings['varset'](_0x24a609);calls[_0x2548('0x3d')](_0x24a609);dials[_0x2548('0x3d')](_0x24a609);}catch(_0x1df1dc){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x3e'),_0x24a609[_0x2548('0x21')]),_0x1df1dc);}});ami['on']('newexten',function(_0x375c1a){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x3f'),_0x375c1a[_0x2548('0x21')]),_0x375c1a);calls[_0x2548('0x40')](_0x375c1a);recordings[_0x2548('0x40')](_0x375c1a);dials[_0x2548('0x40')](_0x375c1a);}catch(_0x3d57cf){utils[_0x2548('0x24')](util[_0x2548('0x1c')]('[%s][index][newexten]',_0x375c1a[_0x2548('0x21')]),_0x3d57cf);}});ami['on']('newchannel',function(_0x2f12af){try{utils[_0x2548('0x1b')](util[_0x2548('0x1c')](_0x2548('0x41'),_0x2f12af[_0x2548('0x21')]),_0x2f12af);calls[_0x2548('0x42')](_0x2f12af);recordings[_0x2548('0x42')](_0x2f12af);}catch(_0x41c944){utils['error'](util[_0x2548('0x1c')](_0x2548('0x41'),_0x2f12af[_0x2548('0x21')]),_0x41c944);}});ami['on'](_0x2548('0x43'),function(_0x567a0d){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x44'),_0x567a0d[_0x2548('0x21')]),_0x567a0d);dials[_0x2548('0x43')](_0x567a0d);}catch(_0x207c6f){utils[_0x2548('0x24')](util[_0x2548('0x1c')](_0x2548('0x45'),_0x567a0d[_0x2548('0x21')]),_0x207c6f);}});ami['on'](_0x2548('0x46'),function(_0x4c6ea0){try{utils['debug'](util[_0x2548('0x1c')](_0x2548('0x47'),_0x4c6ea0[_0x2548('0x21')]),_0x4c6ea0);dials['dialend'](_0x4c6ea0);}catch(_0x5cb171){utils[_0x2548('0x24')](util['format'](_0x2548('0x47'),_0x4c6ea0[_0x2548('0x21')]),_0x5cb171);}});} \ No newline at end of file +var _0xb989=['queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0xb989,0x64));var _0x9b98=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xb989[_0x8de54f];return _0x14cba4;};var AsteriskManager=require(_0x9b98('0x0'));var config=require(_0x9b98('0x1'));var utils=require(_0x9b98('0x2'));var util=require(_0x9b98('0x3'));var isXDREnabled=config[_0x9b98('0x4')]&&config[_0x9b98('0x4')]['disabled']?!config[_0x9b98('0x4')][_0x9b98('0x5')]:!![];var isProduction=config[_0x9b98('0x6')]===_0x9b98('0x7')||![];var isLocalAsterisk=config[_0x9b98('0x4')]&&config[_0x9b98('0x4')][_0x9b98('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x9b98('0x9')]['port'],config[_0x9b98('0x9')]['ip'],config[_0x9b98('0x9')][_0x9b98('0xa')],config['asterisk']['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x9b98('0xb')](_0x9b98('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x9b98('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x9b98('0xd'));var calls=require(_0x9b98('0xe'));var queues=require(_0x9b98('0xf'));var recordings=require(_0x9b98('0x10'));var members=require(_0x9b98('0x11'));var dials=require(_0x9b98('0x12'));var transfers=require(_0x9b98('0x13'));var core=require('./core.controller');ami['on'](_0x9b98('0x14'),core[_0x9b98('0x14')]);ami['on'](_0x9b98('0x15'),core[_0x9b98('0x15')]);ami['on'](_0x9b98('0x16'),core[_0x9b98('0x16')]);ami['on'](_0x9b98('0x17'),core['error']);ami['on'](_0x9b98('0x18'),core['close']);ami['on'](_0x9b98('0x19'),core[_0x9b98('0x19')]);ami['on'](_0x9b98('0x1a'),function(_0x25c717){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x1d'),_0x25c717[_0x9b98('0x1e')]),_0x25c717);members[_0x9b98('0x1a')](_0x25c717);}catch(_0x387721){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][devicestatechange]',_0x25c717['device']),_0x387721);}});ami['on'](_0x9b98('0x1f'),function(_0x366d31){try{utils['debug'](util[_0x9b98('0x1c')]('[%s][index][agentcalled]',_0x366d31[_0x9b98('0x20')]),_0x366d31);agents[_0x9b98('0x1f')](_0x366d31);}catch(_0x4e2175){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x21'),_0x366d31['uniqueid']),_0x4e2175);}});ami['on'](_0x9b98('0x22'),function(_0x285d3b){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x23'),_0x285d3b[_0x9b98('0x20')]),_0x285d3b);agents[_0x9b98('0x22')](_0x285d3b);}catch(_0x3a0662){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x23'),_0x285d3b[_0x9b98('0x20')]),_0x3a0662);}});ami['on'](_0x9b98('0x24'),function(_0x58e06a){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x25'),_0x58e06a[_0x9b98('0x20')]),_0x58e06a);agents[_0x9b98('0x24')](_0x58e06a);queues[_0x9b98('0x24')](_0x58e06a);}catch(_0x405356){utils[_0x9b98('0x17')](util['format']('[%s][index][agentconnect]',_0x58e06a[_0x9b98('0x20')]),_0x405356);}});ami['on'](_0x9b98('0x26'),function(_0x4e0f94){try{utils['debug'](util[_0x9b98('0x1c')](_0x9b98('0x27'),_0x4e0f94[_0x9b98('0x20')]),_0x4e0f94);agents[_0x9b98('0x26')](_0x4e0f94);queues['agentcomplete'](_0x4e0f94);members['agentcomplete'](_0x4e0f94);}catch(_0x31d06b){utils['error'](util[_0x9b98('0x1c')]('[%s][index][agentcomplete]',_0x4e0f94['uniqueid']),_0x31d06b);}});ami['on']('queuecallerabandon',function(_0x49620e){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x28'),_0x49620e['uniqueid']),_0x49620e);agents[_0x9b98('0x29')](_0x49620e);queues[_0x9b98('0x29')](_0x49620e);}catch(_0x50b73f){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][queuecallerabandon]',_0x49620e[_0x9b98('0x20')]),_0x50b73f);}});ami['on'](_0x9b98('0x2a'),function(_0x4ba4df){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x2b'),_0x4ba4df[_0x9b98('0x20')]),_0x4ba4df);queues[_0x9b98('0x2a')](_0x4ba4df);recordings[_0x9b98('0x2a')](_0x4ba4df);}catch(_0x36ec4d){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x2b'),_0x4ba4df[_0x9b98('0x20')]),_0x36ec4d);}});ami['on'](_0x9b98('0x2c'),function(_0x5dda6a){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')]('[%s][index][queuecallerleave]',_0x5dda6a[_0x9b98('0x20')]),_0x5dda6a);queues['queuecallerleave'](_0x5dda6a);}catch(_0x3d89c4){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x2d'),_0x5dda6a[_0x9b98('0x20')]),_0x3d89c4);}});ami['on'](_0x9b98('0x2e'),function(_0x3f9a72){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x2f'),_0x3f9a72[_0x9b98('0x20')]),_0x3f9a72);queues[_0x9b98('0x2e')](_0x3f9a72);calls['musiconholdstart'](_0x3f9a72);}catch(_0x523309){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][musiconholdstart]',_0x3f9a72['uniqueid']),_0x523309);}});ami['on'](_0x9b98('0x30'),function(_0x245019){try{utils['debug'](util[_0x9b98('0x1c')](_0x9b98('0x31'),_0x245019[_0x9b98('0x20')]),_0x245019);queues[_0x9b98('0x30')](_0x245019);calls[_0x9b98('0x30')](_0x245019);}catch(_0x241720){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x31'),_0x245019[_0x9b98('0x20')]),_0x241720);}});ami['on'](_0x9b98('0x32'),function(_0x3ec91b){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x33'),_0x3ec91b[_0x9b98('0x20')]),_0x3ec91b);calls['newstate'](_0x3ec91b);recordings[_0x9b98('0x32')](_0x3ec91b);}catch(_0x52ab79){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x33'),_0x3ec91b[_0x9b98('0x20')]),_0x52ab79);}});ami['on'](_0x9b98('0x34'),function(_0x17b75f){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x35'),_0x17b75f[_0x9b98('0x20')]),_0x17b75f);calls[_0x9b98('0x34')](_0x17b75f);recordings[_0x9b98('0x34')](_0x17b75f);dials['hangup'](_0x17b75f);agents[_0x9b98('0x34')](_0x17b75f);queues[_0x9b98('0x34')](_0x17b75f);}catch(_0x5e6122){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x35'),_0x17b75f[_0x9b98('0x20')]),_0x5e6122);}});ami['on']('cdr',function(_0x53a175){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x36'),_0x53a175['uniqueid']),_0x53a175);members[_0x9b98('0x37')](_0x53a175);}catch(_0x14d77e){utils[_0x9b98('0x17')](util['format'](_0x9b98('0x36'),_0x53a175[_0x9b98('0x20')]),_0x14d77e);}});ami['on'](_0x9b98('0x38'),function(_0x195b00){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x39'),_0x195b00[_0x9b98('0x20')]),_0x195b00);queues[_0x9b98('0x38')](_0x195b00);agents['blindtransfer'](_0x195b00);transfers[_0x9b98('0x38')](_0x195b00);}catch(_0x5da3a4){utils['error'](util['format'](_0x9b98('0x39'),_0x195b00[_0x9b98('0x20')]),_0x5da3a4);}});ami['on'](_0x9b98('0x3a'),function(_0x589abc){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')]('[%s][index][attendedtransfer]',_0x589abc[_0x9b98('0x3b')]),_0x589abc);queues[_0x9b98('0x3a')](_0x589abc);transfers[_0x9b98('0x3a')](_0x589abc);agents[_0x9b98('0x3a')](_0x589abc);calls[_0x9b98('0x3a')](_0x589abc);}catch(_0x3dab16){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')]('[%s][index][attendedtransfer]',_0x589abc[_0x9b98('0x3b')]),_0x3dab16);}});ami['on']('varset',function(_0x11bc3f){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x3c'),_0x11bc3f['uniqueid']),_0x11bc3f);queues[_0x9b98('0x3d')](_0x11bc3f);recordings['varset'](_0x11bc3f);calls[_0x9b98('0x3d')](_0x11bc3f);dials[_0x9b98('0x3d')](_0x11bc3f);}catch(_0xc0162d){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x3c'),_0x11bc3f[_0x9b98('0x20')]),_0xc0162d);}});ami['on'](_0x9b98('0x3e'),function(_0x4edb9e){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x3f'),_0x4edb9e[_0x9b98('0x20')]),_0x4edb9e);calls['newexten'](_0x4edb9e);recordings[_0x9b98('0x3e')](_0x4edb9e);dials[_0x9b98('0x3e')](_0x4edb9e);}catch(_0x30c005){utils['error'](util[_0x9b98('0x1c')](_0x9b98('0x3f'),_0x4edb9e[_0x9b98('0x20')]),_0x30c005);}});ami['on'](_0x9b98('0x40'),function(_0x53a958){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x41'),_0x53a958[_0x9b98('0x20')]),_0x53a958);calls[_0x9b98('0x40')](_0x53a958);recordings[_0x9b98('0x40')](_0x53a958);}catch(_0x46883b){utils['error'](util[_0x9b98('0x1c')]('[%s][index][newchannel]',_0x53a958[_0x9b98('0x20')]),_0x46883b);}});ami['on']('dialbegin',function(_0x2ea963){try{utils[_0x9b98('0x1b')](util['format'](_0x9b98('0x42'),_0x2ea963[_0x9b98('0x20')]),_0x2ea963);dials[_0x9b98('0x43')](_0x2ea963);}catch(_0x29e825){utils[_0x9b98('0x17')](util[_0x9b98('0x1c')](_0x9b98('0x44'),_0x2ea963[_0x9b98('0x20')]),_0x29e825);}});ami['on'](_0x9b98('0x45'),function(_0x34e013){try{utils[_0x9b98('0x1b')](util[_0x9b98('0x1c')](_0x9b98('0x46'),_0x34e013[_0x9b98('0x20')]),_0x34e013);dials[_0x9b98('0x45')](_0x34e013);}catch(_0x2ba69f){utils['error'](util[_0x9b98('0x1c')]('[%s][index][dialend]',_0x34e013[_0x9b98('0x20')]),_0x2ba69f);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 256a8bf..dfaf6c4 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 _0xfdb5=['request','getUserByName','split','catch','error','[%s][members][writeDB]','interface','some','devicestatechange','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','isNil','exitAt','now','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Queue:','info','uniqueid','channel','membername','type','then','name','internal'];(function(_0x4d0030,_0x25760d){var _0x54ed03=function(_0x5980a4){while(--_0x5980a4){_0x4d0030['push'](_0x4d0030['shift']());}};_0x54ed03(++_0x25760d);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xfdb5[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x5fdb('0x0'));var util=require(_0x5fdb('0x1'));var utils=require(_0x5fdb('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x5fdb('0x3')];function writeDB(_0x3067fa){utils[_0x5fdb('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3067fa[_0x5fdb('0x5')],_0x3067fa['interface'],_0x3067fa[_0x5fdb('0x6')],_0x3067fa['data2'],_0x3067fa[_0x5fdb('0x7')],_0x3067fa[_0x5fdb('0x8')]));if(_0x3067fa['interface']){utils['getUserByInterface'](_0x3067fa['interface'])[_0x5fdb('0x9')](function(_0x28ad92){if(_0x28ad92){_0x3067fa[_0x5fdb('0x7')]=_0x28ad92[_0x5fdb('0xa')];_0x3067fa[_0x5fdb('0xb')]=_0x28ad92[_0x5fdb('0xb')];utils[_0x5fdb('0xc')]('CreateMemberReport',_0x3067fa);}else{utils[_0x5fdb('0xd')](_0x3067fa['interface'][_0x5fdb('0xe')]('/')[0x1])[_0x5fdb('0x9')](function(_0x236d28){if(_0x236d28){_0x3067fa['membername']=_0x236d28[_0x5fdb('0xa')];_0x3067fa['internal']=_0x236d28[_0x5fdb('0xb')];utils[_0x5fdb('0xc')]('CreateMemberReport',_0x3067fa);}});}})[_0x5fdb('0xf')](function(_0x13ef76){utils[_0x5fdb('0x10')](util['format'](_0x5fdb('0x11'),_0x3067fa[_0x5fdb('0x5')]),_0x13ef76);});}delete members[_0x3067fa[_0x5fdb('0x12')]];}function startsWith(_0xaf6b0e,_0x40c32d){return _[_0x5fdb('0x13')](_0xaf6b0e,function(_0x58ae27){return _['startsWith'](_0x40c32d,_0x58ae27);});}exports[_0x5fdb('0x14')]=function(_0x5f1ddc){try{utils[_0x5fdb('0x15')](util[_0x5fdb('0x16')](_0x5fdb('0x17'),members[_0x5f1ddc['device']]?members[_0x5f1ddc[_0x5fdb('0x18')]][_0x5fdb('0x5')]:_0x5f1ddc[_0x5fdb('0x18')]),_0x5f1ddc);utils[_0x5fdb('0x4')](util[_0x5fdb('0x16')](_0x5fdb('0x19'),members[_0x5f1ddc['device']]?members[_0x5f1ddc[_0x5fdb('0x18')]]['uniqueid']:_0x5f1ddc['device'],_0x5f1ddc[_0x5fdb('0x1a')],_0x5f1ddc[_0x5fdb('0x18')]));switch(_0x5f1ddc[_0x5fdb('0x1a')]){case'INUSE':case _0x5fdb('0x1b'):if(!startsWith(exclude,_0x5f1ddc[_0x5fdb('0x18')])){members[_0x5f1ddc['device']]={'channel':_0x5fdb('0x1c'),'interface':_0x5f1ddc[_0x5fdb('0x18')],'type':'TALKING','enterAt':utils['now'](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x5fdb('0x1d')](members[_0x5f1ddc['device']])){members[_0x5f1ddc['device']][_0x5fdb('0x1e')]=utils[_0x5fdb('0x1f')]();members[_0x5f1ddc[_0x5fdb('0x18')]]['duration']=utils[_0x5fdb('0x20')](members[_0x5f1ddc[_0x5fdb('0x18')]][_0x5fdb('0x1e')],members[_0x5f1ddc[_0x5fdb('0x18')]]['enterAt']);if(members[_0x5f1ddc[_0x5fdb('0x18')]]['uniqueid']){writeDB(members[_0x5f1ddc[_0x5fdb('0x18')]]);}}break;default:break;}}catch(_0x207e42){utils['error'](util[_0x5fdb('0x16')]('[%s][members][devicestatechange]',members[_0x5f1ddc[_0x5fdb('0x18')]]?members[_0x5f1ddc[_0x5fdb('0x18')]]['uniqueid']:_0x5f1ddc['device']),_0x207e42);}};exports[_0x5fdb('0x21')]=function(_0x1ed46f){try{if(!_[_0x5fdb('0x1d')](members[_0x1ed46f[_0x5fdb('0x12')]])){utils[_0x5fdb('0x15')](util['format']('[%s][members][agentcomplete]',_0x1ed46f[_0x5fdb('0x5')]),_0x1ed46f);utils[_0x5fdb('0x4')](util[_0x5fdb('0x16')](_0x5fdb('0x22'),_0x1ed46f[_0x5fdb('0x5')],_0x1ed46f[_0x5fdb('0x12')],_0x1ed46f[_0x5fdb('0x23')]));members[_0x1ed46f[_0x5fdb('0x12')]]=_[_0x5fdb('0x24')](members[_0x1ed46f[_0x5fdb('0x12')]],{'data4':_0x1ed46f[_0x5fdb('0x23')],'uniqueid':_0x1ed46f[_0x5fdb('0x5')]});}}catch(_0x2b9617){utils[_0x5fdb('0x10')](util[_0x5fdb('0x16')]('[%s][members][agentcomplete]',_0x1ed46f[_0x5fdb('0x5')]),_0x2b9617);}};exports[_0x5fdb('0x25')]=function(_0x2464ee){try{utils[_0x5fdb('0x15')](util[_0x5fdb('0x16')](_0x5fdb('0x26'),_0x2464ee[_0x5fdb('0x5')]),_0x2464ee);if(_0x2464ee[_0x5fdb('0x6')]){var _0x14e219=_0x2464ee[_0x5fdb('0x6')]['split']('-')[0x0];if(!_[_0x5fdb('0x1d')](members[_0x14e219])){members[_0x14e219]=_[_0x5fdb('0x24')](members[_0x14e219],{'data1':members[_0x14e219][_0x5fdb('0x27')]||_0x2464ee[_0x5fdb('0x8')],'data2':members[_0x14e219][_0x5fdb('0x28')]||_0x2464ee[_0x5fdb('0x29')],'data3':members[_0x14e219]['data3']||_0x2464ee['destination'],'uniqueid':members[_0x14e219][_0x5fdb('0x5')]||_0x2464ee[_0x5fdb('0x5')]});utils[_0x5fdb('0x4')](util[_0x5fdb('0x16')](_0x5fdb('0x2a'),_0x2464ee[_0x5fdb('0x5')],members[_0x14e219][_0x5fdb('0x27')],members[_0x14e219]['data2'],members[_0x14e219][_0x5fdb('0x2b')]));if(members[_0x14e219][_0x5fdb('0x1e')]){writeDB(members[_0x14e219]);}}}if(_0x2464ee[_0x5fdb('0x2c')]){var _0x471314=_0x2464ee[_0x5fdb('0x2c')][_0x5fdb('0xe')]('-')[0x0];if(!_[_0x5fdb('0x1d')](members[_0x471314])){members[_0x471314]=_[_0x5fdb('0x24')](members[_0x471314],{'data1':members[_0x471314][_0x5fdb('0x27')]||_0x2464ee['type'],'data2':members[_0x471314]['data2']||_0x2464ee['source'],'data3':members[_0x471314][_0x5fdb('0x2b')]||_0x2464ee['destination'],'uniqueid':members[_0x471314][_0x5fdb('0x5')]||_0x2464ee[_0x5fdb('0x5')]});utils[_0x5fdb('0x4')](util[_0x5fdb('0x16')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2464ee[_0x5fdb('0x5')],members[_0x471314]['data1'],members[_0x471314][_0x5fdb('0x28')],members[_0x471314]['data3']));if(members[_0x471314][_0x5fdb('0x1e')]){writeDB(members[_0x471314]);}}}}catch(_0x9bee6f){utils[_0x5fdb('0x10')](util[_0x5fdb('0x16')](_0x5fdb('0x26'),_0x2464ee['uniqueid']),_0x9bee6f);}}; \ No newline at end of file +var _0x4de5=['split','catch','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent','NOT_INUSE','isNil','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data1','type','data2','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','source','destination','[%s][members][cdr]','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4de5,0xbb));var _0x54de=function(_0x58b4ec,_0x245d9a){_0x58b4ec=_0x58b4ec-0x0;var _0xff3daa=_0x4de5[_0x58b4ec];return _0xff3daa;};'use strict';var _=require('lodash');var util=require(_0x54de('0x0'));var utils=require('./utils');var members={};var exclude=[_0x54de('0x1'),_0x54de('0x2')];function writeDB(_0x3231e5){utils[_0x54de('0x3')](util[_0x54de('0x4')](_0x54de('0x5'),_0x3231e5[_0x54de('0x6')],_0x3231e5[_0x54de('0x7')],_0x3231e5[_0x54de('0x8')],_0x3231e5['data2'],_0x3231e5[_0x54de('0x9')],_0x3231e5['type']));if(_0x3231e5[_0x54de('0x7')]){utils[_0x54de('0xa')](_0x3231e5[_0x54de('0x7')])[_0x54de('0xb')](function(_0x1fa271){if(_0x1fa271){_0x3231e5[_0x54de('0x9')]=_0x1fa271[_0x54de('0xc')];_0x3231e5[_0x54de('0xd')]=_0x1fa271[_0x54de('0xd')];utils[_0x54de('0xe')](_0x54de('0xf'),_0x3231e5);}else{utils[_0x54de('0x10')](_0x3231e5['interface'][_0x54de('0x11')]('/')[0x1])[_0x54de('0xb')](function(_0xd26666){if(_0xd26666){_0x3231e5[_0x54de('0x9')]=_0xd26666['name'];_0x3231e5['internal']=_0xd26666['internal'];utils[_0x54de('0xe')](_0x54de('0xf'),_0x3231e5);}});}})[_0x54de('0x12')](function(_0x43e2e9){utils[_0x54de('0x13')](util['format'](_0x54de('0x14'),_0x3231e5[_0x54de('0x6')]),_0x43e2e9);});}delete members[_0x3231e5[_0x54de('0x7')]];}function startsWith(_0x1d3df9,_0x4adf6c){return _['some'](_0x1d3df9,function(_0x13884c){return _['startsWith'](_0x4adf6c,_0x13884c);});}exports[_0x54de('0x15')]=function(_0x4f7c7d){try{utils[_0x54de('0x16')](util[_0x54de('0x4')](_0x54de('0x17'),members[_0x4f7c7d[_0x54de('0x18')]]?members[_0x4f7c7d['device']][_0x54de('0x6')]:_0x4f7c7d[_0x54de('0x18')]),_0x4f7c7d);utils[_0x54de('0x3')](util[_0x54de('0x4')](_0x54de('0x19'),members[_0x4f7c7d[_0x54de('0x18')]]?members[_0x4f7c7d['device']][_0x54de('0x6')]:_0x4f7c7d['device'],_0x4f7c7d['state'],_0x4f7c7d[_0x54de('0x18')]));switch(_0x4f7c7d[_0x54de('0x1a')]){case _0x54de('0x1b'):case'BUSY':if(!startsWith(exclude,_0x4f7c7d['device'])){members[_0x4f7c7d['device']]={'channel':_0x54de('0x1c'),'interface':_0x4f7c7d[_0x54de('0x18')],'type':'TALKING','enterAt':utils[_0x54de('0x1d')](),'role':_0x54de('0x1e')};}break;case _0x54de('0x1f'):if(!_[_0x54de('0x20')](members[_0x4f7c7d['device']])){members[_0x4f7c7d[_0x54de('0x18')]]['exitAt']=utils[_0x54de('0x1d')]();members[_0x4f7c7d[_0x54de('0x18')]][_0x54de('0x21')]=utils[_0x54de('0x22')](members[_0x4f7c7d[_0x54de('0x18')]]['exitAt'],members[_0x4f7c7d['device']][_0x54de('0x23')]);if(members[_0x4f7c7d[_0x54de('0x18')]][_0x54de('0x6')]){writeDB(members[_0x4f7c7d['device']]);}}break;default:break;}}catch(_0x49d1fc){utils[_0x54de('0x13')](util[_0x54de('0x4')](_0x54de('0x17'),members[_0x4f7c7d[_0x54de('0x18')]]?members[_0x4f7c7d[_0x54de('0x18')]][_0x54de('0x6')]:_0x4f7c7d['device']),_0x49d1fc);}};exports[_0x54de('0x24')]=function(_0x5ef25a){try{if(!_[_0x54de('0x20')](members[_0x5ef25a[_0x54de('0x7')]])){utils[_0x54de('0x16')](util[_0x54de('0x4')](_0x54de('0x25'),_0x5ef25a['uniqueid']),_0x5ef25a);utils['info'](util['format'](_0x54de('0x26'),_0x5ef25a[_0x54de('0x6')],_0x5ef25a[_0x54de('0x7')],_0x5ef25a[_0x54de('0x27')]));members[_0x5ef25a[_0x54de('0x7')]]=_[_0x54de('0x28')](members[_0x5ef25a[_0x54de('0x7')]],{'data4':_0x5ef25a[_0x54de('0x27')],'uniqueid':_0x5ef25a[_0x54de('0x6')]});}}catch(_0x43213a){utils[_0x54de('0x13')](util[_0x54de('0x4')](_0x54de('0x25'),_0x5ef25a[_0x54de('0x6')]),_0x43213a);}};exports['cdr']=function(_0x536a1d){try{utils[_0x54de('0x16')](util[_0x54de('0x4')]('[%s][members][cdr]',_0x536a1d[_0x54de('0x6')]),_0x536a1d);if(_0x536a1d[_0x54de('0x8')]){var _0x54492f=_0x536a1d[_0x54de('0x8')][_0x54de('0x11')]('-')[0x0];if(!_[_0x54de('0x20')](members[_0x54492f])){members[_0x54492f]=_[_0x54de('0x28')](members[_0x54492f],{'data1':members[_0x54492f][_0x54de('0x29')]||_0x536a1d[_0x54de('0x2a')],'data2':members[_0x54492f][_0x54de('0x2b')]||_0x536a1d['source'],'data3':members[_0x54492f][_0x54de('0x2c')]||_0x536a1d['destination'],'uniqueid':members[_0x54492f][_0x54de('0x6')]||_0x536a1d['uniqueid']});utils[_0x54de('0x3')](util['format'](_0x54de('0x2d'),_0x536a1d[_0x54de('0x6')],members[_0x54492f][_0x54de('0x29')],members[_0x54492f][_0x54de('0x2b')],members[_0x54492f][_0x54de('0x2c')]));if(members[_0x54492f][_0x54de('0x2e')]){writeDB(members[_0x54492f]);}}}if(_0x536a1d[_0x54de('0x2f')]){var _0x5794b8=_0x536a1d['destinationchannel']['split']('-')[0x0];if(!_[_0x54de('0x20')](members[_0x5794b8])){members[_0x5794b8]=_['assign'](members[_0x5794b8],{'data1':members[_0x5794b8][_0x54de('0x29')]||_0x536a1d[_0x54de('0x2a')],'data2':members[_0x5794b8]['data2']||_0x536a1d[_0x54de('0x30')],'data3':members[_0x5794b8][_0x54de('0x2c')]||_0x536a1d[_0x54de('0x31')],'uniqueid':members[_0x5794b8][_0x54de('0x6')]||_0x536a1d['uniqueid']});utils[_0x54de('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x536a1d['uniqueid'],members[_0x5794b8][_0x54de('0x29')],members[_0x5794b8]['data2'],members[_0x5794b8][_0x54de('0x2c')]));if(members[_0x5794b8][_0x54de('0x2e')]){writeDB(members[_0x5794b8]);}}}}catch(_0x429de6){utils[_0x54de('0x13')](util[_0x54de('0x4')](_0x54de('0x32'),_0x536a1d[_0x54de('0x6')]),_0x429de6);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 883bcef..2de5b08 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 _0xcc24=['agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','calleridnum','calleridname','[%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','clone','transfertargetuniqueid','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','variable','toUpperCase','CONTINUE','queuecallerabandonAt','now','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum'];(function(_0x4ba491,_0x5ed4bf){var _0x49f9b2=function(_0x162bda){while(--_0x162bda){_0x4ba491['push'](_0x4ba491['shift']());}};_0x49f9b2(++_0x5ed4bf);}(_0xcc24,0x16e));var _0x4cc2=function(_0x3aa518,_0x58ece1){_0x3aa518=_0x3aa518-0x0;var _0x1f2d11=_0xcc24[_0x3aa518];return _0x1f2d11;};'use strict';var _=require(_0x4cc2('0x0'));var util=require(_0x4cc2('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x42f63d){utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x4'),_0x42f63d[_0x4cc2('0x5')],_0x42f63d[_0x4cc2('0x6')],_0x42f63d[_0x4cc2('0x7')],_0x42f63d[_0x4cc2('0x8')],_0x42f63d['calleridnum'],_0x42f63d[_0x4cc2('0x9')],_0x42f63d[_0x4cc2('0xa')]));if(_0x42f63d[_0x4cc2('0x7')]){utils[_0x4cc2('0xb')](_0x42f63d[_0x4cc2('0x7')])[_0x4cc2('0xc')](function(_0x5b6499){if(_0x5b6499){_0x42f63d[_0x4cc2('0xd')]=_0x5b6499[_0x4cc2('0xd')];}utils[_0x4cc2('0xe')](_0x4cc2('0xf'),_0x42f63d);});}else{utils[_0x4cc2('0xe')](_0x4cc2('0xf'),_0x42f63d);}if(_0x42f63d[_0x4cc2('0x10')]){delete queues[_0x42f63d[_0x4cc2('0x10')]];}else{delete queues[_0x42f63d['uniqueid']];}}exports[_0x4cc2('0x11')]=function(_0x368a97){try{utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')](_0x4cc2('0x13'),_0x368a97[_0x4cc2('0x5')]),_0x368a97);utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x14'),_0x368a97[_0x4cc2('0x5')],_0x368a97[_0x4cc2('0x7')],_0x368a97[_0x4cc2('0x15')]));queues[_0x368a97[_0x4cc2('0x5')]]=_[_0x4cc2('0x16')](_0x368a97,{'originalposition':_0x368a97[_0x4cc2('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x336fe1){utils['error'](util[_0x4cc2('0x3')](_0x4cc2('0x13'),_0x368a97[_0x4cc2('0x5')]),_0x336fe1);}};exports[_0x4cc2('0x17')]=function(_0x5d7c53){try{if(!_[_0x4cc2('0x18')](queues[_0x5d7c53[_0x4cc2('0x5')]])){utils[_0x4cc2('0x12')](util['format'](_0x4cc2('0x19'),_0x5d7c53[_0x4cc2('0x5')]),_0x5d7c53);if(queues[_0x5d7c53[_0x4cc2('0x5')]]['queuecallerleaveAt']){if(!queues[_0x5d7c53[_0x4cc2('0x5')]][_0x4cc2('0x1a')]&&!queues[_0x5d7c53['uniqueid']][_0x4cc2('0x1b')]){queues[_0x5d7c53[_0x4cc2('0x5')]][_0x4cc2('0x1c')]=!![];queues[_0x5d7c53['uniqueid']][_0x4cc2('0x1d')]=utils['now']();queues[_0x5d7c53['uniqueid']][_0x4cc2('0xa')]='COMPLETEDBYAGENT';}utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x1e'),_0x5d7c53[_0x4cc2('0x5')],queues[_0x5d7c53['uniqueid']][_0x4cc2('0x1f')],queues[_0x5d7c53[_0x4cc2('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x5d7c53['uniqueid']]);}else if(queues[_0x5d7c53[_0x4cc2('0x5')]]['transfereduniqueid']){utils[_0x4cc2('0x2')](util['format'](_0x4cc2('0x20'),_0x5d7c53[_0x4cc2('0x5')],queues[_0x5d7c53[_0x4cc2('0x5')]][_0x4cc2('0x1f')],queues[_0x5d7c53[_0x4cc2('0x5')]]['transfereduniqueid']));queues[queues[_0x5d7c53[_0x4cc2('0x5')]][_0x4cc2('0x10')]]=queues[_0x5d7c53['uniqueid']];queues[queues[_0x5d7c53[_0x4cc2('0x5')]]['transfereduniqueid']][_0x4cc2('0x21')]=0x2;delete queues[_0x5d7c53['uniqueid']];}}}catch(_0x378591){utils[_0x4cc2('0x22')](util[_0x4cc2('0x3')](_0x4cc2('0x19'),_0x5d7c53['uniqueid']),_0x378591);}};exports[_0x4cc2('0x23')]=function(_0x23129f){try{utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')]('[%s][queues][varset]',_0x23129f[_0x4cc2('0x5')]),_0x23129f);if(!_['isNil'](_0x23129f[_0x4cc2('0x24')]['queuestatus'])&&_0x23129f['value'][_0x4cc2('0x25')]()!==_0x4cc2('0x26')){if(!_[_0x4cc2('0x18')](queues[_0x23129f['uniqueid']])){queues[_0x23129f[_0x4cc2('0x5')]]['queuecallerabandon']=![];queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x27')]=null;queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x1b')]=!![];queues[_0x23129f['uniqueid']]['queuecallerexitAt']=utils[_0x4cc2('0x28')]();queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0xa')]=_0x23129f[_0x4cc2('0x29')][_0x4cc2('0x25')]();utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x2a'),_0x23129f[_0x4cc2('0x5')],queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x1f')],_0x23129f[_0x4cc2('0x29')],queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0xa')]));writeDB(queues[_0x23129f[_0x4cc2('0x5')]]);}}else if(!_['isNil'](_0x23129f[_0x4cc2('0x24')][_0x4cc2('0x2b')])){if(!_[_0x4cc2('0x18')](queues[_0x23129f[_0x4cc2('0x5')]])&&!queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x1a')]){queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x1a')]=![];queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x27')]=null;queues[_0x23129f[_0x4cc2('0x5')]][_0x4cc2('0x1b')]=!![];queues[_0x23129f[_0x4cc2('0x5')]]['queuecallerexitAt']=utils[_0x4cc2('0x28')]();queues[_0x23129f['uniqueid']][_0x4cc2('0xa')]='EXITWITHKEY';utils[_0x4cc2('0x2')](util['format'](_0x4cc2('0x2c'),_0x23129f[_0x4cc2('0x5')],queues[_0x23129f[_0x4cc2('0x5')]]['name'],_0x23129f['value'],queues[_0x23129f[_0x4cc2('0x5')]]['queuecallerexitreason']));}}}catch(_0x4db0c4){utils[_0x4cc2('0x22')](util[_0x4cc2('0x3')](_0x4cc2('0x2d'),_0x23129f[_0x4cc2('0x5')]),_0x4db0c4);}};exports[_0x4cc2('0x1a')]=function(_0x5fc151){try{if(!_[_0x4cc2('0x18')](queues[_0x5fc151['uniqueid']])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x5fc151['uniqueid']),_0x5fc151);queues[_0x5fc151[_0x4cc2('0x5')]]['queuecallerexit']=![];queues[_0x5fc151['uniqueid']][_0x4cc2('0x2e')]=null;queues[_0x5fc151[_0x4cc2('0x5')]][_0x4cc2('0x1a')]=!![];queues[_0x5fc151[_0x4cc2('0x5')]][_0x4cc2('0x27')]=utils['now']();queues[_0x5fc151[_0x4cc2('0x5')]][_0x4cc2('0xa')]=_0x4cc2('0x2f');utils['info'](util[_0x4cc2('0x3')](_0x4cc2('0x30'),_0x5fc151[_0x4cc2('0x5')],queues[_0x5fc151[_0x4cc2('0x5')]]['name'],queues[_0x5fc151[_0x4cc2('0x5')]][_0x4cc2('0xa')]));}}catch(_0x5b2484){utils['error'](util[_0x4cc2('0x3')](_0x4cc2('0x31'),_0x5fc151[_0x4cc2('0x5')]),_0x5b2484);}};exports[_0x4cc2('0x32')]=function(_0x37ef04){try{if(!_['isNil'](queues[_0x37ef04[_0x4cc2('0x5')]])){utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')](_0x4cc2('0x33'),_0x37ef04[_0x4cc2('0x5')]),_0x37ef04);utils['info'](util[_0x4cc2('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x37ef04[_0x4cc2('0x5')],queues[_0x37ef04[_0x4cc2('0x5')]][_0x4cc2('0x1f')],_0x37ef04['connectedlinenum'],_0x37ef04[_0x4cc2('0x34')]));queues[_0x37ef04['uniqueid']][_0x4cc2('0x32')]=!![];queues[_0x37ef04[_0x4cc2('0x5')]]['queuecallerleaveAt']=utils[_0x4cc2('0x28')]();queues[_0x37ef04['uniqueid']]['holdtime']=utils[_0x4cc2('0x35')](queues[_0x37ef04[_0x4cc2('0x5')]][_0x4cc2('0x36')],queues[_0x37ef04[_0x4cc2('0x5')]][_0x4cc2('0x37')]);queues[_0x37ef04[_0x4cc2('0x5')]][_0x4cc2('0x15')]=_0x37ef04[_0x4cc2('0x15')];queues[_0x37ef04[_0x4cc2('0x5')]][_0x4cc2('0x38')]=_0x37ef04[_0x4cc2('0x38')];queues[_0x37ef04[_0x4cc2('0x5')]][_0x4cc2('0x39')]=_0x37ef04[_0x4cc2('0x39')];queues[_0x37ef04['uniqueid']]['connectedlinename']=_0x37ef04[_0x4cc2('0x34')];}}catch(_0x420a2d){utils[_0x4cc2('0x22')](util['format']('[%s][queues][queuecallerleave]',_0x37ef04[_0x4cc2('0x5')]),_0x420a2d);}};exports[_0x4cc2('0x3a')]=function(_0x1862ea){try{if(!_[_0x4cc2('0x18')](queues[_0x1862ea[_0x4cc2('0x5')]])){utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')](_0x4cc2('0x3b'),_0x1862ea[_0x4cc2('0x5')]),_0x1862ea);utils['info'](util[_0x4cc2('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1862ea[_0x4cc2('0x5')],queues[_0x1862ea['uniqueid']]['name'],_0x1862ea['membername'],_0x1862ea[_0x4cc2('0x3c')]));queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x1a')]=![];queues[_0x1862ea['uniqueid']]['queuecallerabandon']=![];queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x27')]=null;queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x1b')]=![];queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0xa')]=null;queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x2e')]=null;queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x3d')]=!![];queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x9')]=_0x1862ea[_0x4cc2('0x3c')];queues[_0x1862ea[_0x4cc2('0x5')]][_0x4cc2('0x8')]=_0x1862ea[_0x4cc2('0x3e')];}}catch(_0x20ebdd){utils[_0x4cc2('0x22')](util[_0x4cc2('0x3')](_0x4cc2('0x3b'),_0x1862ea['uniqueid']),_0x20ebdd);}};exports[_0x4cc2('0x3f')]=function(_0x44bad7){try{if(!_['isNil'](queues[_0x44bad7['uniqueid']])){if(queues[_0x44bad7['uniqueid']][_0x4cc2('0x36')]){utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')](_0x4cc2('0x40'),_0x44bad7[_0x4cc2('0x5')]),_0x44bad7);queues[_0x44bad7[_0x4cc2('0x5')]][_0x4cc2('0x1a')]=![];queues[_0x44bad7['uniqueid']][_0x4cc2('0x1a')]=![];queues[_0x44bad7[_0x4cc2('0x5')]]['queuecallerabandonAt']=null;queues[_0x44bad7[_0x4cc2('0x5')]]['queuecallerexit']=![];queues[_0x44bad7['uniqueid']][_0x4cc2('0x2e')]=null;queues[_0x44bad7['uniqueid']][_0x4cc2('0x3d')]=!![];queues[_0x44bad7['uniqueid']]['lastAssignedTo']=_0x44bad7[_0x4cc2('0x3e')];queues[_0x44bad7['uniqueid']][_0x4cc2('0x1c')]=!![];queues[_0x44bad7['uniqueid']][_0x4cc2('0x1d')]=utils[_0x4cc2('0x28')]();if(_0x44bad7[_0x4cc2('0x41')]==_0x4cc2('0x42')){if(!queues[_0x44bad7[_0x4cc2('0x5')]][_0x4cc2('0x42')]){queues[_0x44bad7['uniqueid']]['queuecallerexitreason']=_0x4cc2('0x43');}}else{queues[_0x44bad7[_0x4cc2('0x5')]]['queuecallerexitreason']=_0x4cc2('0x44')+_0x44bad7[_0x4cc2('0x41')]['toUpperCase']();}utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x44bad7[_0x4cc2('0x5')],queues[_0x44bad7['uniqueid']][_0x4cc2('0x1f')],_0x44bad7[_0x4cc2('0x3e')],queues[_0x44bad7[_0x4cc2('0x5')]][_0x4cc2('0xa')]));writeDB(queues[_0x44bad7[_0x4cc2('0x5')]]);}}}catch(_0x640c88){utils[_0x4cc2('0x22')](util[_0x4cc2('0x3')]('[%s][queues][agentcomplete]',_0x44bad7['uniqueid']),_0x640c88);}};exports[_0x4cc2('0x45')]=function(_0x5adce3){try{if(!_[_0x4cc2('0x18')](queues[_0x5adce3[_0x4cc2('0x46')]])){utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')]('[%s][queues][blindtransfer]',_0x5adce3[_0x4cc2('0x5')]),_0x5adce3);queues[_0x5adce3[_0x4cc2('0x46')]][_0x4cc2('0x42')]=!![];queues[_0x5adce3[_0x4cc2('0x46')]][_0x4cc2('0x47')]=_0x4cc2('0x48');queues[_0x5adce3[_0x4cc2('0x46')]][_0x4cc2('0x49')]=_0x5adce3[_0x4cc2('0x4a')];queues[_0x5adce3[_0x4cc2('0x46')]]['transferuniqueid']=_0x5adce3[_0x4cc2('0x46')];queues[_0x5adce3[_0x4cc2('0x46')]][_0x4cc2('0xa')]=_0x4cc2('0x4b');utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x4c'),_0x5adce3['uniqueid'],queues[_0x5adce3[_0x4cc2('0x46')]][_0x4cc2('0x1f')],_0x5adce3['transfereeuniqueid'],_0x5adce3[_0x4cc2('0x4a')]));}}catch(_0x51ba5a){utils['error'](util[_0x4cc2('0x3')]('[%s][queues][blindtransfer]',_0x5adce3[_0x4cc2('0x5')]),_0x51ba5a);}};exports['attendedtransfer']=function(_0x91bd78){try{utils['debug'](util[_0x4cc2('0x3')](_0x4cc2('0x4d'),_0x91bd78[_0x4cc2('0x4e')]),_0x91bd78);if(_0x91bd78[_0x4cc2('0x4e')]==_0x91bd78['origtransfererlinkedid']){if(!_[_0x4cc2('0x18')](queues[_0x91bd78[_0x4cc2('0x4f')]])){utils['info'](util[_0x4cc2('0x3')](_0x4cc2('0x50'),_0x91bd78[_0x4cc2('0x4e')],queues[_0x91bd78[_0x4cc2('0x4f')]][_0x4cc2('0x1f')],_0x91bd78[_0x4cc2('0x51')]));queues[_0x91bd78[_0x4cc2('0x4f')]][_0x4cc2('0x42')]=!![];queues[_0x91bd78[_0x4cc2('0x4f')]]['transfertype']=_0x4cc2('0x52');queues[_0x91bd78['secondtransfererlinkedid']]['transferexten']=_0x91bd78[_0x4cc2('0x51')];queues[_0x91bd78[_0x4cc2('0x4f')]][_0x4cc2('0x53')]=_0x91bd78[_0x4cc2('0x4e')];queues[_0x91bd78[_0x4cc2('0x4f')]][_0x4cc2('0xa')]=_0x4cc2('0x54');}if(!_[_0x4cc2('0x18')](queues[_0x91bd78[_0x4cc2('0x55')]])){if(_0x91bd78[_0x4cc2('0x56')]&&queues[_0x91bd78['transfereelinkedid']]){queues[_0x91bd78[_0x4cc2('0x56')]][_0x4cc2('0x21')]=0x1;queues[_0x91bd78[_0x4cc2('0x46')]]=_['clone'](queues[_0x91bd78[_0x4cc2('0x56')]]);queues[_0x91bd78[_0x4cc2('0x46')]][_0x4cc2('0x10')]=_0x91bd78['transfertargetuniqueid'];queues[_0x91bd78[_0x4cc2('0x46')]][_0x4cc2('0x21')]=0x2;queues[_0x91bd78[_0x4cc2('0x46')]]['calleridnum']=queues[_0x91bd78['secondtransfererlinkedid']][_0x4cc2('0x57')];queues[_0x91bd78['transfereeuniqueid']][_0x4cc2('0x58')]=queues[_0x91bd78['secondtransfererlinkedid']][_0x4cc2('0x58')];queues[_0x91bd78[_0x4cc2('0x46')]][_0x4cc2('0x37')]=utils['now']();queues[_0x91bd78[_0x4cc2('0x46')]][_0x4cc2('0x36')]=utils['now']();queues[_0x91bd78[_0x4cc2('0x46')]]['holdtime']=0x0;queues[_0x91bd78['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util['format'](_0x4cc2('0x59'),_0x91bd78['origtransfereruniqueid'],queues[_0x91bd78[_0x4cc2('0x46')]][_0x4cc2('0x1f')],queues[_0x91bd78[_0x4cc2('0x46')]][_0x4cc2('0x57')],queues[_0x91bd78[_0x4cc2('0x46')]]['calleridname']));}else{utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x5a'),_0x91bd78[_0x4cc2('0x4e')],queues[_0x91bd78['origtransfererlinkedid']]['name'],_0x91bd78[_0x4cc2('0x4f')]));queues[_0x91bd78[_0x4cc2('0x55')]][_0x4cc2('0x10')]=_0x91bd78['secondtransfererlinkedid'];}}}else if(_0x91bd78[_0x4cc2('0x5b')]==_0x91bd78[_0x4cc2('0x4f')]){if(!_[_0x4cc2('0x18')](queues[_0x91bd78[_0x4cc2('0x55')]])){utils['info'](util['format'](_0x4cc2('0x5c'),_0x91bd78[_0x4cc2('0x4e')],queues[_0x91bd78[_0x4cc2('0x55')]][_0x4cc2('0x1f')],_0x91bd78[_0x4cc2('0x5b')],_0x91bd78[_0x4cc2('0x5d')]));queues[_0x91bd78[_0x4cc2('0x55')]][_0x4cc2('0x42')]=!![];queues[_0x91bd78['origtransfererlinkedid']][_0x4cc2('0x47')]=_0x4cc2('0x52');queues[_0x91bd78[_0x4cc2('0x55')]][_0x4cc2('0x49')]=_0x91bd78[_0x4cc2('0x5d')];queues[_0x91bd78[_0x4cc2('0x55')]][_0x4cc2('0x53')]=_0x91bd78[_0x4cc2('0x5b')];queues[_0x91bd78['origtransfererlinkedid']][_0x4cc2('0xa')]=_0x4cc2('0x54');}if(!_[_0x4cc2('0x18')](queues[_0x91bd78['secondtransfererlinkedid']])){if(_0x91bd78['transfertargetlinkedid']&&queues[_0x91bd78[_0x4cc2('0x5e')]]){queues[_0x91bd78[_0x4cc2('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x91bd78['transfertargetuniqueid']]=_[_0x4cc2('0x5f')](queues[_0x91bd78[_0x4cc2('0x5e')]]);queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x10')]=_0x91bd78['transfertargetuniqueid'];queues[_0x91bd78['transfertargetuniqueid']][_0x4cc2('0x21')]=0x2;queues[_0x91bd78[_0x4cc2('0x60')]]['calleridnum']=queues[_0x91bd78['origtransfererlinkedid']]['calleridnum'];queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x58')]=queues[_0x91bd78[_0x4cc2('0x55')]][_0x4cc2('0x58')];queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x37')]=utils['now']();queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x36')]=utils[_0x4cc2('0x28')]();queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x61')]=0x0;queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x62')]=0x0;utils['info'](util['format'](_0x4cc2('0x63'),_0x91bd78[_0x4cc2('0x4e')],queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x1f')],queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x10')],queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x57')],queues[_0x91bd78[_0x4cc2('0x60')]][_0x4cc2('0x58')]));}else{utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x91bd78['origtransfereruniqueid'],queues[_0x91bd78[_0x4cc2('0x4f')]]['name'],_0x91bd78['origtransfererlinkedid']));queues[_0x91bd78['secondtransfererlinkedid']]['transfereduniqueid']=_0x91bd78[_0x4cc2('0x55')];}}}}catch(_0x1d183c){utils['error'](util[_0x4cc2('0x3')](_0x4cc2('0x4d'),_0x91bd78[_0x4cc2('0x4e')]),_0x1d183c);}};exports['musiconholdstart']=function(_0x3e3b76){try{if(!_['isNil'](queues[_0x3e3b76[_0x4cc2('0x5')]])){utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')](_0x4cc2('0x64'),_0x3e3b76['uniqueid']),_0x3e3b76);queues[_0x3e3b76[_0x4cc2('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x4cc2('0x2')](util[_0x4cc2('0x3')](_0x4cc2('0x65'),_0x3e3b76['uniqueid'],queues[_0x3e3b76[_0x4cc2('0x5')]][_0x4cc2('0x1f')],queues[_0x3e3b76[_0x4cc2('0x5')]][_0x4cc2('0x66')]));}}catch(_0x5d61bb){utils[_0x4cc2('0x22')](util['format'](_0x4cc2('0x64'),_0x3e3b76[_0x4cc2('0x5')]),_0x5d61bb);}};exports[_0x4cc2('0x67')]=function(_0x206b0e){try{if(!_[_0x4cc2('0x18')](queues[_0x206b0e[_0x4cc2('0x5')]])){if(!_[_0x4cc2('0x18')](queues[_0x206b0e[_0x4cc2('0x5')]][_0x4cc2('0x66')])){utils[_0x4cc2('0x12')](util[_0x4cc2('0x3')](_0x4cc2('0x68'),_0x206b0e[_0x4cc2('0x5')]),_0x206b0e);queues[_0x206b0e[_0x4cc2('0x5')]]['mohtime']+=utils['diffTime'](utils[_0x4cc2('0x28')](),queues[_0x206b0e['uniqueid']][_0x4cc2('0x66')]);utils[_0x4cc2('0x2')](util['format'](_0x4cc2('0x69'),_0x206b0e['uniqueid'],queues[_0x206b0e[_0x4cc2('0x5')]][_0x4cc2('0x1f')],queues[_0x206b0e[_0x4cc2('0x5')]][_0x4cc2('0x62')]));delete queues[_0x206b0e[_0x4cc2('0x5')]]['musiconholdstartAt'];}}}catch(_0x4adadd){utils['error'](util['format'](_0x4cc2('0x68'),_0x206b0e['uniqueid']),_0x4adadd);}}; \ No newline at end of file +var _0xf568=['queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','value','toUpperCase','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','queuecallercompleteAt','transfer','reason','[%s][queues][agentcomplete]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','mohtime','lodash','util','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon'];(function(_0x451976,_0x41e3fc){var _0x4b4a2e=function(_0x151c0e){while(--_0x151c0e){_0x451976['push'](_0x451976['shift']());}};_0x4b4a2e(++_0x41e3fc);}(_0xf568,0x116));var _0x8f56=function(_0x5cdea1,_0x19acc8){_0x5cdea1=_0x5cdea1-0x0;var _0x1f1aec=_0xf568[_0x5cdea1];return _0x1f1aec;};'use strict';var _=require(_0x8f56('0x0'));var util=require(_0x8f56('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x11e46b){utils['info'](util[_0x8f56('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x11e46b[_0x8f56('0x3')],_0x11e46b[_0x8f56('0x4')],_0x11e46b[_0x8f56('0x5')],_0x11e46b[_0x8f56('0x6')],_0x11e46b[_0x8f56('0x7')],_0x11e46b[_0x8f56('0x8')],_0x11e46b[_0x8f56('0x9')]));if(_0x11e46b[_0x8f56('0x5')]){utils['getVoiceQueueByName'](_0x11e46b[_0x8f56('0x5')])['then'](function(_0x30f3e1){if(_0x30f3e1){_0x11e46b[_0x8f56('0xa')]=_0x30f3e1['type'];}utils[_0x8f56('0xb')](_0x8f56('0xc'),_0x11e46b);});}else{utils['request'](_0x8f56('0xc'),_0x11e46b);}if(_0x11e46b[_0x8f56('0xd')]){delete queues[_0x11e46b[_0x8f56('0xd')]];}else{delete queues[_0x11e46b[_0x8f56('0x3')]];}}exports[_0x8f56('0xe')]=function(_0x37905b){try{utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x10'),_0x37905b['uniqueid']),_0x37905b);utils['info'](util[_0x8f56('0x2')](_0x8f56('0x11'),_0x37905b[_0x8f56('0x3')],_0x37905b[_0x8f56('0x5')],_0x37905b[_0x8f56('0x12')]));queues[_0x37905b[_0x8f56('0x3')]]=_[_0x8f56('0x13')](_0x37905b,{'originalposition':_0x37905b['position'],'queuecallerjoinAt':utils[_0x8f56('0x14')](),'mohtime':0x0});}catch(_0x45afbe){utils[_0x8f56('0x15')](util[_0x8f56('0x2')](_0x8f56('0x10'),_0x37905b[_0x8f56('0x3')]),_0x45afbe);}};exports['hangup']=function(_0x57c643){try{if(!_['isNil'](queues[_0x57c643[_0x8f56('0x3')]])){utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x16'),_0x57c643[_0x8f56('0x3')]),_0x57c643);if(queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x17')]){if(!queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x18')]&&!queues[_0x57c643['uniqueid']][_0x8f56('0x19')]){queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x1a')]=!![];queues[_0x57c643[_0x8f56('0x3')]]['queuecallercompleteAt']=utils['now']();queues[_0x57c643['uniqueid']][_0x8f56('0x9')]=_0x8f56('0x1b');}utils[_0x8f56('0x1c')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x57c643[_0x8f56('0x3')],queues[_0x57c643[_0x8f56('0x3')]]['name'],queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x9')]));writeDB(queues[_0x57c643['uniqueid']]);}else if(queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0xd')]){utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x1d'),_0x57c643[_0x8f56('0x3')],queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x57c643[_0x8f56('0x3')]][_0x8f56('0xd')]));queues[queues[_0x57c643['uniqueid']][_0x8f56('0xd')]]=queues[_0x57c643[_0x8f56('0x3')]];queues[queues[_0x57c643[_0x8f56('0x3')]]['transfereduniqueid']][_0x8f56('0x1f')]=0x2;delete queues[_0x57c643[_0x8f56('0x3')]];}}}catch(_0x238f28){utils['error'](util[_0x8f56('0x2')]('[%s][queues][hangup]',_0x57c643[_0x8f56('0x3')]),_0x238f28);}};exports[_0x8f56('0x20')]=function(_0x3afeb8){try{utils[_0x8f56('0xf')](util['format'](_0x8f56('0x21'),_0x3afeb8[_0x8f56('0x3')]),_0x3afeb8);if(!_[_0x8f56('0x22')](_0x3afeb8['variable']['queuestatus'])&&_0x3afeb8[_0x8f56('0x23')][_0x8f56('0x24')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x3afeb8[_0x8f56('0x3')]])){queues[_0x3afeb8[_0x8f56('0x3')]]['queuecallerabandon']=![];queues[_0x3afeb8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3afeb8['uniqueid']]['queuecallerexit']=!![];queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x25')]=utils['now']();queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x9')]=_0x3afeb8[_0x8f56('0x23')]['toUpperCase']();utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x26'),_0x3afeb8[_0x8f56('0x3')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x3afeb8[_0x8f56('0x23')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x9')]));writeDB(queues[_0x3afeb8['uniqueid']]);}}else if(!_['isNil'](_0x3afeb8[_0x8f56('0x27')][_0x8f56('0x28')])){if(!_[_0x8f56('0x22')](queues[_0x3afeb8[_0x8f56('0x3')]])&&!queues[_0x3afeb8['uniqueid']][_0x8f56('0x18')]){queues[_0x3afeb8[_0x8f56('0x3')]]['queuecallerabandon']=![];queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x29')]=null;queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x19')]=!![];queues[_0x3afeb8[_0x8f56('0x3')]]['queuecallerexitAt']=utils['now']();queues[_0x3afeb8['uniqueid']][_0x8f56('0x9')]=_0x8f56('0x2a');utils['info'](util[_0x8f56('0x2')](_0x8f56('0x2b'),_0x3afeb8[_0x8f56('0x3')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x3afeb8[_0x8f56('0x23')],queues[_0x3afeb8[_0x8f56('0x3')]][_0x8f56('0x9')]));}}}catch(_0x21696a){utils[_0x8f56('0x15')](util['format'](_0x8f56('0x21'),_0x3afeb8[_0x8f56('0x3')]),_0x21696a);}};exports[_0x8f56('0x18')]=function(_0x35a12){try{if(!_[_0x8f56('0x22')](queues[_0x35a12[_0x8f56('0x3')]])){utils[_0x8f56('0xf')](util['format'](_0x8f56('0x2c'),_0x35a12[_0x8f56('0x3')]),_0x35a12);queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x19')]=![];queues[_0x35a12['uniqueid']][_0x8f56('0x25')]=null;queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x18')]=!![];queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x29')]=utils['now']();queues[_0x35a12['uniqueid']][_0x8f56('0x9')]=_0x8f56('0x2d');utils['info'](util[_0x8f56('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x35a12['uniqueid'],queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x35a12[_0x8f56('0x3')]][_0x8f56('0x9')]));}}catch(_0x4b079b){utils[_0x8f56('0x15')](util['format'](_0x8f56('0x2c'),_0x35a12[_0x8f56('0x3')]),_0x4b079b);}};exports[_0x8f56('0x2e')]=function(_0x2c56a8){try{if(!_[_0x8f56('0x22')](queues[_0x2c56a8[_0x8f56('0x3')]])){utils[_0x8f56('0xf')](util['format'](_0x8f56('0x2f'),_0x2c56a8['uniqueid']),_0x2c56a8);utils[_0x8f56('0x1c')](util[_0x8f56('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2c56a8[_0x8f56('0x3')],queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x2c56a8[_0x8f56('0x30')],_0x2c56a8[_0x8f56('0x31')]));queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x2e')]=!![];queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x17')]=utils[_0x8f56('0x14')]();queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x32')]=utils[_0x8f56('0x33')](queues[_0x2c56a8['uniqueid']]['queuecallerleaveAt'],queues[_0x2c56a8[_0x8f56('0x3')]]['queuecallerjoinAt']);queues[_0x2c56a8[_0x8f56('0x3')]][_0x8f56('0x12')]=_0x2c56a8['position'];queues[_0x2c56a8['uniqueid']][_0x8f56('0x34')]=_0x2c56a8[_0x8f56('0x34')];queues[_0x2c56a8['uniqueid']][_0x8f56('0x30')]=_0x2c56a8['connectedlinenum'];queues[_0x2c56a8[_0x8f56('0x3')]]['connectedlinename']=_0x2c56a8[_0x8f56('0x31')];}}catch(_0x13e326){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x2c56a8[_0x8f56('0x3')]),_0x13e326);}};exports[_0x8f56('0x35')]=function(_0x3a5226){try{if(!_['isNil'](queues[_0x3a5226['uniqueid']])){utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x36'),_0x3a5226['uniqueid']),_0x3a5226);utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x37'),_0x3a5226[_0x8f56('0x3')],queues[_0x3a5226['uniqueid']]['name'],_0x3a5226[_0x8f56('0x38')],_0x3a5226['destaccountcode']));queues[_0x3a5226['uniqueid']][_0x8f56('0x18')]=![];queues[_0x3a5226[_0x8f56('0x3')]][_0x8f56('0x18')]=![];queues[_0x3a5226[_0x8f56('0x3')]]['queuecallerabandonAt']=null;queues[_0x3a5226['uniqueid']][_0x8f56('0x19')]=![];queues[_0x3a5226[_0x8f56('0x3')]]['queuecallerexitreason']=null;queues[_0x3a5226[_0x8f56('0x3')]][_0x8f56('0x25')]=null;queues[_0x3a5226['uniqueid']][_0x8f56('0x39')]=!![];queues[_0x3a5226[_0x8f56('0x3')]][_0x8f56('0x8')]=_0x3a5226[_0x8f56('0x3a')];queues[_0x3a5226['uniqueid']][_0x8f56('0x6')]=_0x3a5226[_0x8f56('0x38')];}}catch(_0x89b460){utils[_0x8f56('0x15')](util[_0x8f56('0x2')]('[%s][queues][agentconnect]',_0x3a5226['uniqueid']),_0x89b460);}};exports[_0x8f56('0x3b')]=function(_0x518fa8){try{if(!_[_0x8f56('0x22')](queues[_0x518fa8['uniqueid']])){if(queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x17')]){utils['debug'](util[_0x8f56('0x2')]('[%s][queues][agentcomplete]',_0x518fa8['uniqueid']),_0x518fa8);queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x18')]=![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x18')]=![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x29')]=null;queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x19')]=![];queues[_0x518fa8[_0x8f56('0x3')]]['queuecallerexitAt']=null;queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x39')]=!![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x6')]=_0x518fa8[_0x8f56('0x38')];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x1a')]=!![];queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x3c')]=utils['now']();if(_0x518fa8['reason']==_0x8f56('0x3d')){if(!queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x3d')]){queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x9')]='TRANSFER';}}else{queues[_0x518fa8[_0x8f56('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x518fa8[_0x8f56('0x3e')]['toUpperCase']();}utils['info'](util[_0x8f56('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x518fa8[_0x8f56('0x3')],queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x1e')],_0x518fa8[_0x8f56('0x38')],queues[_0x518fa8[_0x8f56('0x3')]][_0x8f56('0x9')]));writeDB(queues[_0x518fa8[_0x8f56('0x3')]]);}}}catch(_0x1e603a){utils[_0x8f56('0x15')](util[_0x8f56('0x2')](_0x8f56('0x3f'),_0x518fa8['uniqueid']),_0x1e603a);}};exports['blindtransfer']=function(_0x89e304){try{if(!_['isNil'](queues[_0x89e304[_0x8f56('0x40')]])){utils['debug'](util[_0x8f56('0x2')]('[%s][queues][blindtransfer]',_0x89e304[_0x8f56('0x3')]),_0x89e304);queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x3d')]=!![];queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x41')]=_0x8f56('0x42');queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x43')]=_0x89e304[_0x8f56('0x44')];queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x45')]=_0x89e304['transfereeuniqueid'];queues[_0x89e304[_0x8f56('0x40')]][_0x8f56('0x9')]=_0x8f56('0x46');utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x47'),_0x89e304['uniqueid'],queues[_0x89e304['transfereeuniqueid']]['name'],_0x89e304[_0x8f56('0x40')],_0x89e304['extension']));}}catch(_0x15b90a){utils['error'](util[_0x8f56('0x2')](_0x8f56('0x48'),_0x89e304[_0x8f56('0x3')]),_0x15b90a);}};exports[_0x8f56('0x49')]=function(_0x46a8fa){try{utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x4a'),_0x46a8fa[_0x8f56('0x4b')]),_0x46a8fa);if(_0x46a8fa[_0x8f56('0x4b')]==_0x46a8fa[_0x8f56('0x4c')]){if(!_[_0x8f56('0x22')](queues[_0x46a8fa[_0x8f56('0x4d')]])){utils['info'](util[_0x8f56('0x2')](_0x8f56('0x4e'),_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x1e')],_0x46a8fa[_0x8f56('0x4f')]));queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x3d')]=!![];queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x41')]='ATTENDED';queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x43')]=_0x46a8fa[_0x8f56('0x4f')];queues[_0x46a8fa[_0x8f56('0x4d')]]['transferuniqueid']=_0x46a8fa[_0x8f56('0x4b')];queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x8f56('0x22')](queues[_0x46a8fa['origtransfererlinkedid']])){if(_0x46a8fa['transfereelinkedid']&&queues[_0x46a8fa[_0x8f56('0x50')]]){queues[_0x46a8fa[_0x8f56('0x50')]][_0x8f56('0x1f')]=0x1;queues[_0x46a8fa[_0x8f56('0x40')]]=_['clone'](queues[_0x46a8fa[_0x8f56('0x50')]]);queues[_0x46a8fa[_0x8f56('0x40')]]['transfereduniqueid']=_0x46a8fa[_0x8f56('0x51')];queues[_0x46a8fa['transfereeuniqueid']][_0x8f56('0x1f')]=0x2;queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x7')]=queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x7')];queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x52')]=queues[_0x46a8fa[_0x8f56('0x4d')]][_0x8f56('0x52')];queues[_0x46a8fa['transfereeuniqueid']][_0x8f56('0x53')]=utils[_0x8f56('0x14')]();queues[_0x46a8fa['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x8f56('0x14')]();queues[_0x46a8fa[_0x8f56('0x40')]]['holdtime']=0x0;queues[_0x46a8fa[_0x8f56('0x40')]]['mohtime']=0x0;utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x54'),_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x40')]]['name'],queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x7')],queues[_0x46a8fa[_0x8f56('0x40')]][_0x8f56('0x52')]));}else{utils[_0x8f56('0x1c')](util[_0x8f56('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x4c')]]['name'],_0x46a8fa[_0x8f56('0x4d')]));queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0xd')]=_0x46a8fa[_0x8f56('0x4d')];}}}else if(_0x46a8fa[_0x8f56('0x55')]==_0x46a8fa[_0x8f56('0x4d')]){if(!_[_0x8f56('0x22')](queues[_0x46a8fa[_0x8f56('0x4c')]])){utils['info'](util[_0x8f56('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x1e')],_0x46a8fa['secondtransfereruniqueid'],_0x46a8fa[_0x8f56('0x56')]));queues[_0x46a8fa[_0x8f56('0x4c')]]['transfer']=!![];queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x41')]=_0x8f56('0x57');queues[_0x46a8fa['origtransfererlinkedid']][_0x8f56('0x43')]=_0x46a8fa[_0x8f56('0x56')];queues[_0x46a8fa[_0x8f56('0x4c')]]['transferuniqueid']=_0x46a8fa[_0x8f56('0x55')];queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x9')]=_0x8f56('0x58');}if(!_[_0x8f56('0x22')](queues[_0x46a8fa[_0x8f56('0x4d')]])){if(_0x46a8fa[_0x8f56('0x59')]&&queues[_0x46a8fa[_0x8f56('0x59')]]){queues[_0x46a8fa[_0x8f56('0x59')]][_0x8f56('0x1f')]=0x1;queues[_0x46a8fa[_0x8f56('0x51')]]=_[_0x8f56('0x5a')](queues[_0x46a8fa[_0x8f56('0x59')]]);queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0xd')]=_0x46a8fa[_0x8f56('0x51')];queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x1f')]=0x2;queues[_0x46a8fa[_0x8f56('0x51')]]['calleridnum']=queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x7')];queues[_0x46a8fa['transfertargetuniqueid']][_0x8f56('0x52')]=queues[_0x46a8fa[_0x8f56('0x4c')]][_0x8f56('0x52')];queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x53')]=utils[_0x8f56('0x14')]();queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x17')]=utils['now']();queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x32')]=0x0;queues[_0x46a8fa[_0x8f56('0x51')]]['mohtime']=0x0;utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x5b'),_0x46a8fa[_0x8f56('0x4b')],queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x1e')],queues[_0x46a8fa[_0x8f56('0x51')]]['transfereduniqueid'],queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x7')],queues[_0x46a8fa[_0x8f56('0x51')]][_0x8f56('0x52')]));}else{utils[_0x8f56('0x1c')](util[_0x8f56('0x2')](_0x8f56('0x5c'),_0x46a8fa['origtransfereruniqueid'],queues[_0x46a8fa[_0x8f56('0x4d')]]['name'],_0x46a8fa[_0x8f56('0x4c')]));queues[_0x46a8fa['secondtransfererlinkedid']][_0x8f56('0xd')]=_0x46a8fa['origtransfererlinkedid'];}}}}catch(_0x132a14){utils[_0x8f56('0x15')](util[_0x8f56('0x2')](_0x8f56('0x4a'),_0x46a8fa[_0x8f56('0x4b')]),_0x132a14);}};exports[_0x8f56('0x5d')]=function(_0x32eed0){try{if(!_[_0x8f56('0x22')](queues[_0x32eed0[_0x8f56('0x3')]])){utils['debug'](util['format'](_0x8f56('0x5e'),_0x32eed0[_0x8f56('0x3')]),_0x32eed0);queues[_0x32eed0['uniqueid']]['musiconholdstartAt']=utils[_0x8f56('0x14')]();utils['info'](util['format'](_0x8f56('0x5f'),_0x32eed0[_0x8f56('0x3')],queues[_0x32eed0[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x32eed0[_0x8f56('0x3')]]['musiconholdstartAt']));}}catch(_0x28781e){utils['error'](util[_0x8f56('0x2')]('[%s][queues][musiconholdstart]',_0x32eed0[_0x8f56('0x3')]),_0x28781e);}};exports[_0x8f56('0x60')]=function(_0x41edac){try{if(!_[_0x8f56('0x22')](queues[_0x41edac[_0x8f56('0x3')]])){if(!_['isNil'](queues[_0x41edac['uniqueid']][_0x8f56('0x61')])){utils[_0x8f56('0xf')](util[_0x8f56('0x2')](_0x8f56('0x62'),_0x41edac[_0x8f56('0x3')]),_0x41edac);queues[_0x41edac[_0x8f56('0x3')]]['mohtime']+=utils['diffTime'](utils[_0x8f56('0x14')](),queues[_0x41edac['uniqueid']][_0x8f56('0x61')]);utils[_0x8f56('0x1c')](util['format'](_0x8f56('0x63'),_0x41edac[_0x8f56('0x3')],queues[_0x41edac[_0x8f56('0x3')]][_0x8f56('0x1e')],queues[_0x41edac[_0x8f56('0x3')]][_0x8f56('0x64')]));delete queues[_0x41edac[_0x8f56('0x3')]]['musiconholdstartAt'];}}}catch(_0x2499a5){utils[_0x8f56('0x15')](util['format'](_0x8f56('0x62'),_0x41edac[_0x8f56('0x3')]),_0x2499a5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6e45f5b..fc6f92a 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 _0x5a18=['lodash','./utils','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x326035,_0x2f0cda){var _0x51b195=function(_0x67c5b9){while(--_0x67c5b9){_0x326035['push'](_0x326035['shift']());}};_0x51b195(++_0x2f0cda);}(_0x5a18,0x7e));var _0x85a1=function(_0x57a6b0,_0x39a87f){_0x57a6b0=_0x57a6b0-0x0;var _0xa29a18=_0x5a18[_0x57a6b0];return _0xa29a18;};'use strict';var _=require(_0x85a1('0x0'));var util=require('util');var utils=require(_0x85a1('0x1'));var recordings={};function writeDB(_0x436c74){utils['info'](util[_0x85a1('0x2')](_0x85a1('0x3'),_0x436c74[_0x85a1('0x4')]));if(_0x436c74['accountcode']){utils[_0x85a1('0x5')](_0x436c74[_0x85a1('0x6')])[_0x85a1('0x7')](function(_0x330236){if(_0x330236){_0x436c74[_0x85a1('0x8')]=_0x330236['name'];_0x436c74[_0x85a1('0x9')]=_0x330236['id'];}utils[_0x85a1('0xa')]('CreateVoiceRecording',_0x436c74);});}else{utils[_0x85a1('0xa')](_0x85a1('0xb'),_0x436c74);}}exports[_0x85a1('0xc')]=function(_0x39453f){try{utils[_0x85a1('0xd')](util[_0x85a1('0x2')]('[%s][recordings][newchannel]',_0x39453f['uniqueid']),_0x39453f);if(_0x39453f[_0x85a1('0x4')]==_0x39453f[_0x85a1('0xe')]){utils['info'](util['format'](_0x85a1('0xf'),_0x39453f[_0x85a1('0x4')],_0x39453f[_0x85a1('0x10')],_0x39453f[_0x85a1('0x11')]));recordings[_0x39453f[_0x85a1('0x4')]]={'uniqueid':_0x39453f['uniqueid'],'accountcode':_0x39453f[_0x85a1('0x6')],'exten':_0x39453f[_0x85a1('0x11')],'context':_0x39453f[_0x85a1('0x10')],'channel':_0x39453f[_0x85a1('0x12')],'monitors':[]};}}catch(_0x74cd51){utils[_0x85a1('0x13')](util[_0x85a1('0x2')](_0x85a1('0x14'),_0x39453f[_0x85a1('0x4')]),_0x74cd51);}};exports[_0x85a1('0x15')]=function(_0x1c2e4d){try{utils[_0x85a1('0xd')](util[_0x85a1('0x2')](_0x85a1('0x16'),_0x1c2e4d[_0x85a1('0x4')]),_0x1c2e4d);if(!_[_0x85a1('0x17')](recordings[_0x1c2e4d[_0x85a1('0x4')]])&&_0x1c2e4d[_0x85a1('0x18')]==0x6){utils[_0x85a1('0x19')](util[_0x85a1('0x2')](_0x85a1('0x1a'),_0x1c2e4d[_0x85a1('0x4')],_0x1c2e4d['context'],_0x1c2e4d['channel']));}else if(!_[_0x85a1('0x17')](recordings[_0x1c2e4d[_0x85a1('0xe')]])&&_0x1c2e4d['channelstate']==0x6&&_0x1c2e4d['context']!=_0x85a1('0x1b')){utils[_0x85a1('0x19')](util['format'](_0x85a1('0x1c'),_0x1c2e4d[_0x85a1('0x4')],_0x1c2e4d['linkedid'],_0x1c2e4d[_0x85a1('0x10')],_0x1c2e4d['channel']));recordings[_0x1c2e4d['linkedid']][_0x85a1('0x6')]=_0x1c2e4d['accountcode'];}}catch(_0x458153){utils[_0x85a1('0x13')](util[_0x85a1('0x2')](_0x85a1('0x16'),_0x1c2e4d[_0x85a1('0x4')]),_0x458153);}};exports[_0x85a1('0x1d')]=function(_0xe8de9f){try{if(!_['isNil'](_0xe8de9f['variable'])&&!_[_0x85a1('0x17')](_0xe8de9f[_0x85a1('0x1e')]['mixmonitor_filename'])){utils[_0x85a1('0xd')](util[_0x85a1('0x2')]('[%s][recordings][varset]',_0xe8de9f[_0x85a1('0x4')]),_0xe8de9f);utils[_0x85a1('0x19')](util[_0x85a1('0x2')](_0x85a1('0x1f'),_0xe8de9f['uniqueid'],_0xe8de9f[_0x85a1('0x1e')],_0xe8de9f[_0x85a1('0x20')]));if(_[_0x85a1('0x21')](_0xe8de9f[_0x85a1('0x20')],'.wav49')){_0xe8de9f[_0x85a1('0x20')]=_0xe8de9f[_0x85a1('0x20')][_0x85a1('0x22')]('.wav49','.WAV');}if(recordings[_0xe8de9f[_0x85a1('0xe')]]){var _0x2847df=_[_0x85a1('0x23')](recordings[_0xe8de9f['linkedid']][_0x85a1('0x24')],{'value':_0xe8de9f['value']});if(_[_0x85a1('0x17')](_0x2847df)){recordings[_0xe8de9f[_0x85a1('0xe')]][_0x85a1('0x24')][_0x85a1('0x25')]({'value':_0xe8de9f[_0x85a1('0x20')]});}}}}catch(_0x5e4df4){utils[_0x85a1('0x13')](util[_0x85a1('0x2')](_0x85a1('0x26'),_0xe8de9f['uniqueid']),_0x5e4df4);}};exports['hangup']=function(_0x58d11e){try{if(!_[_0x85a1('0x17')](recordings[_0x58d11e[_0x85a1('0x4')]])){utils[_0x85a1('0xd')](util['format'](_0x85a1('0x27'),_0x58d11e['uniqueid']),_0x58d11e);utils[_0x85a1('0x19')](util[_0x85a1('0x2')](_0x85a1('0x28'),_0x58d11e[_0x85a1('0x4')],_0x58d11e['calleridnum'],_0x58d11e[_0x85a1('0x29')],_0x58d11e[_0x85a1('0x2a')]));recordings[_0x58d11e[_0x85a1('0x4')]]['calleridnum']=_0x58d11e[_0x85a1('0x2b')];recordings[_0x58d11e[_0x85a1('0x4')]][_0x85a1('0x29')]=_0x58d11e['calleridname'];recordings[_0x58d11e[_0x85a1('0x4')]][_0x85a1('0x2c')]=_0x58d11e[_0x85a1('0x2c')];recordings[_0x58d11e[_0x85a1('0x4')]][_0x85a1('0x2d')]=_0x58d11e['connectedlinename'];if(recordings[_0x58d11e['uniqueid']]['type']==_0x85a1('0x2e')&&recordings[_0x58d11e['uniqueid']]['accountcode']){recordings[_0x58d11e[_0x85a1('0x4')]][_0x85a1('0x2c')]=recordings[_0x58d11e[_0x85a1('0x4')]][_0x85a1('0x6')];recordings[_0x58d11e[_0x85a1('0x4')]]['connectedlinename']='';}recordings[_0x58d11e[_0x85a1('0x4')]][_0x85a1('0x24')][_0x85a1('0x2f')](function(_0x1fb5fd){var _0x1271c2=_[_0x85a1('0x30')](recordings[_0x58d11e[_0x85a1('0x4')]]);_0x1271c2['value']=_0x1fb5fd[_0x85a1('0x20')];writeDB(_0x1271c2);});delete recordings[_0x58d11e[_0x85a1('0x4')]];}}catch(_0x2e4381){utils['error'](util['format'](_0x85a1('0x27'),_0x58d11e['uniqueid']),_0x2e4381);}};exports[_0x85a1('0x31')]=function(_0x1e24ff){try{if(!_[_0x85a1('0x17')](recordings[_0x1e24ff[_0x85a1('0x4')]])){utils['debug'](util[_0x85a1('0x2')]('[%s][recordings][newexten]',_0x1e24ff[_0x85a1('0x4')]),_0x1e24ff);utils[_0x85a1('0x19')](util[_0x85a1('0x2')](_0x85a1('0x32'),_0x1e24ff[_0x85a1('0x4')],_0x1e24ff[_0x85a1('0x33')],_0x1e24ff[_0x85a1('0x34')]));if(_0x1e24ff['application'][_0x85a1('0x35')]()=='set'&&_[_0x85a1('0x36')](_0x1e24ff[_0x85a1('0x34')][_0x85a1('0x35')](),'cdr')){var _0x1e45e4=_0x1e24ff[_0x85a1('0x34')][_0x85a1('0x37')]('=');var _0x2a7ccd=_0x1e45e4[0x0][_0x85a1('0x38')](_0x1e45e4[0x0]['lastIndexOf']('(')+0x1,_0x1e45e4[0x0][_0x85a1('0x39')](')'));var _0x46a222=_0x1e45e4[0x1];recordings[_0x1e24ff['uniqueid']][_0x2a7ccd]=_0x46a222;}}}catch(_0x9af22c){utils[_0x85a1('0x13')](util[_0x85a1('0x2')](_0x85a1('0x3a'),_0x1e24ff['uniqueid']),_0x9af22c);}};exports[_0x85a1('0x3b')]=function(_0x4ec77f){try{if(!_[_0x85a1('0x17')](recordings[_0x4ec77f[_0x85a1('0x4')]])){utils[_0x85a1('0xd')](util[_0x85a1('0x2')](_0x85a1('0x3c'),_0x4ec77f['uniqueid']),_0x4ec77f);utils[_0x85a1('0x19')](util[_0x85a1('0x2')](_0x85a1('0x3d'),_0x4ec77f['uniqueid'],_0x4ec77f[_0x85a1('0x3e')]));recordings[_0x4ec77f[_0x85a1('0x4')]]['queue']=_0x4ec77f['queue'];}}catch(_0x4a45e4){utils[_0x85a1('0x13')](util[_0x85a1('0x2')]('[%s][recordings][queuecallerjoin]',_0x4ec77f[_0x85a1('0x4')]),_0x4a45e4);}}; \ No newline at end of file +var _0x63f1=['variable','value','endsWith','.wav49','.WAV','monitors','[%s][recordings][varset]','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset'];(function(_0x510dd7,_0x172971){var _0x375722=function(_0x4c0a1a){while(--_0x4c0a1a){_0x510dd7['push'](_0x510dd7['shift']());}};_0x375722(++_0x172971);}(_0x63f1,0x145));var _0x163f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x63f1[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x163f('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x2eedef){utils[_0x163f('0x1')](util[_0x163f('0x2')](_0x163f('0x3'),_0x2eedef[_0x163f('0x4')]));if(_0x2eedef['accountcode']){utils['getUserByInternal'](_0x2eedef[_0x163f('0x5')])[_0x163f('0x6')](function(_0x3e6040){if(_0x3e6040){_0x2eedef[_0x163f('0x7')]=_0x3e6040[_0x163f('0x8')];_0x2eedef[_0x163f('0x9')]=_0x3e6040['id'];}utils[_0x163f('0xa')]('CreateVoiceRecording',_0x2eedef);});}else{utils[_0x163f('0xa')](_0x163f('0xb'),_0x2eedef);}}exports[_0x163f('0xc')]=function(_0x1e6885){try{utils[_0x163f('0xd')](util[_0x163f('0x2')](_0x163f('0xe'),_0x1e6885[_0x163f('0x4')]),_0x1e6885);if(_0x1e6885[_0x163f('0x4')]==_0x1e6885[_0x163f('0xf')]){utils[_0x163f('0x1')](util[_0x163f('0x2')](_0x163f('0x10'),_0x1e6885[_0x163f('0x4')],_0x1e6885['context'],_0x1e6885[_0x163f('0x11')]));recordings[_0x1e6885[_0x163f('0x4')]]={'uniqueid':_0x1e6885[_0x163f('0x4')],'accountcode':_0x1e6885[_0x163f('0x5')],'exten':_0x1e6885['exten'],'context':_0x1e6885[_0x163f('0x12')],'channel':_0x1e6885[_0x163f('0x13')],'monitors':[]};}}catch(_0x56d009){utils[_0x163f('0x14')](util['format']('[%s][recordings][newchannel]',_0x1e6885[_0x163f('0x4')]),_0x56d009);}};exports[_0x163f('0x15')]=function(_0x9ea649){try{utils[_0x163f('0xd')](util[_0x163f('0x2')](_0x163f('0x16'),_0x9ea649[_0x163f('0x4')]),_0x9ea649);if(!_['isNil'](recordings[_0x9ea649['uniqueid']])&&_0x9ea649[_0x163f('0x17')]==0x6){utils['info'](util[_0x163f('0x2')](_0x163f('0x18'),_0x9ea649[_0x163f('0x4')],_0x9ea649[_0x163f('0x12')],_0x9ea649[_0x163f('0x13')]));}else if(!_[_0x163f('0x19')](recordings[_0x9ea649[_0x163f('0xf')]])&&_0x9ea649[_0x163f('0x17')]==0x6&&_0x9ea649[_0x163f('0x12')]!=_0x163f('0x1a')){utils[_0x163f('0x1')](util['format'](_0x163f('0x1b'),_0x9ea649[_0x163f('0x4')],_0x9ea649[_0x163f('0xf')],_0x9ea649[_0x163f('0x12')],_0x9ea649[_0x163f('0x13')]));recordings[_0x9ea649[_0x163f('0xf')]]['accountcode']=_0x9ea649[_0x163f('0x5')];}}catch(_0x20c2f2){utils['error'](util[_0x163f('0x2')](_0x163f('0x16'),_0x9ea649[_0x163f('0x4')]),_0x20c2f2);}};exports[_0x163f('0x1c')]=function(_0x1a58a8){try{if(!_['isNil'](_0x1a58a8[_0x163f('0x1d')])&&!_['isNil'](_0x1a58a8['variable']['mixmonitor_filename'])){utils[_0x163f('0xd')](util[_0x163f('0x2')]('[%s][recordings][varset]',_0x1a58a8[_0x163f('0x4')]),_0x1a58a8);utils[_0x163f('0x1')](util[_0x163f('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1a58a8[_0x163f('0x4')],_0x1a58a8[_0x163f('0x1d')],_0x1a58a8[_0x163f('0x1e')]));if(_[_0x163f('0x1f')](_0x1a58a8[_0x163f('0x1e')],'.wav49')){_0x1a58a8[_0x163f('0x1e')]=_0x1a58a8[_0x163f('0x1e')]['replace'](_0x163f('0x20'),_0x163f('0x21'));}if(recordings[_0x1a58a8[_0x163f('0xf')]]){var _0x661ede=_['find'](recordings[_0x1a58a8['linkedid']]['monitors'],{'value':_0x1a58a8[_0x163f('0x1e')]});if(_[_0x163f('0x19')](_0x661ede)){recordings[_0x1a58a8[_0x163f('0xf')]][_0x163f('0x22')]['push']({'value':_0x1a58a8[_0x163f('0x1e')]});}}}}catch(_0x20eae1){utils[_0x163f('0x14')](util['format'](_0x163f('0x23'),_0x1a58a8[_0x163f('0x4')]),_0x20eae1);}};exports[_0x163f('0x24')]=function(_0x53ac89){try{if(!_['isNil'](recordings[_0x53ac89['uniqueid']])){utils['debug'](util[_0x163f('0x2')]('[%s][recordings][hangup]',_0x53ac89[_0x163f('0x4')]),_0x53ac89);utils[_0x163f('0x1')](util[_0x163f('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x53ac89['uniqueid'],_0x53ac89[_0x163f('0x25')],_0x53ac89[_0x163f('0x26')],_0x53ac89[_0x163f('0x27')]));recordings[_0x53ac89['uniqueid']]['calleridnum']=_0x53ac89['calleridnum'];recordings[_0x53ac89[_0x163f('0x4')]]['calleridname']=_0x53ac89[_0x163f('0x26')];recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x28')]=_0x53ac89[_0x163f('0x28')];recordings[_0x53ac89['uniqueid']]['connectedlinename']=_0x53ac89[_0x163f('0x29')];if(recordings[_0x53ac89[_0x163f('0x4')]]['type']==_0x163f('0x2a')&&recordings[_0x53ac89['uniqueid']][_0x163f('0x5')]){recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x28')]=recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x5')];recordings[_0x53ac89['uniqueid']][_0x163f('0x29')]='';}recordings[_0x53ac89[_0x163f('0x4')]][_0x163f('0x22')][_0x163f('0x2b')](function(_0x19c3fa){var _0x36cb73=_[_0x163f('0x2c')](recordings[_0x53ac89['uniqueid']]);_0x36cb73[_0x163f('0x1e')]=_0x19c3fa['value'];writeDB(_0x36cb73);});delete recordings[_0x53ac89[_0x163f('0x4')]];}}catch(_0xa7ed2f){utils['error'](util['format'](_0x163f('0x2d'),_0x53ac89['uniqueid']),_0xa7ed2f);}};exports[_0x163f('0x2e')]=function(_0x21e0d9){try{if(!_[_0x163f('0x19')](recordings[_0x21e0d9['uniqueid']])){utils[_0x163f('0xd')](util[_0x163f('0x2')](_0x163f('0x2f'),_0x21e0d9[_0x163f('0x4')]),_0x21e0d9);utils['info'](util[_0x163f('0x2')](_0x163f('0x30'),_0x21e0d9[_0x163f('0x4')],_0x21e0d9[_0x163f('0x31')],_0x21e0d9[_0x163f('0x32')]));if(_0x21e0d9[_0x163f('0x31')][_0x163f('0x33')]()=='set'&&_[_0x163f('0x34')](_0x21e0d9[_0x163f('0x32')][_0x163f('0x33')](),'cdr')){var _0x8d22d=_0x21e0d9[_0x163f('0x32')][_0x163f('0x35')]('=');var _0x47cc82=_0x8d22d[0x0][_0x163f('0x36')](_0x8d22d[0x0][_0x163f('0x37')]('(')+0x1,_0x8d22d[0x0][_0x163f('0x37')](')'));var _0x1cbbc0=_0x8d22d[0x1];recordings[_0x21e0d9[_0x163f('0x4')]][_0x47cc82]=_0x1cbbc0;}}}catch(_0x148257){utils[_0x163f('0x14')](util[_0x163f('0x2')](_0x163f('0x2f'),_0x21e0d9['uniqueid']),_0x148257);}};exports[_0x163f('0x38')]=function(_0x3c3d5c){try{if(!_[_0x163f('0x19')](recordings[_0x3c3d5c[_0x163f('0x4')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x3c3d5c[_0x163f('0x4')]),_0x3c3d5c);utils[_0x163f('0x1')](util[_0x163f('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3c3d5c[_0x163f('0x4')],_0x3c3d5c['queue']));recordings[_0x3c3d5c['uniqueid']][_0x163f('0x39')]=_0x3c3d5c[_0x163f('0x39')];}}catch(_0x4b3819){utils[_0x163f('0x14')](util['format'](_0x163f('0x3a'),_0x3c3d5c[_0x163f('0x4')]),_0x4b3819);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ae06d61..1c6f67c 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 _0xdd6e=['origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x16d50d,_0x2e0726){var _0x22c576=function(_0x3ad993){while(--_0x3ad993){_0x16d50d['push'](_0x16d50d['shift']());}};_0x22c576(++_0x2e0726);}(_0xdd6e,0xe6));var _0xedd6=function(_0xc8665c,_0x2eed4c){_0xc8665c=_0xc8665c-0x0;var _0x4ea8bf=_0xdd6e[_0xc8665c];return _0x4ea8bf;};'use strict';var _=require(_0xedd6('0x0'));var util=require('util');var utils=require(_0xedd6('0x1'));function writeDB(_0x52fc29){utils[_0xedd6('0x2')](util['format'](_0xedd6('0x3'),_0x52fc29[_0xedd6('0x4')]===_0xedd6('0x5')?_0x52fc29[_0xedd6('0x6')]:_0x52fc29[_0xedd6('0x7')],_0x52fc29['type']));utils[_0xedd6('0x8')](_0xedd6('0x9'),_0x52fc29);}exports[_0xedd6('0xa')]=function(_0x31af66){try{utils['debug'](util[_0xedd6('0xb')]('[%s][transfers][blindtransfer]',_0x31af66[_0xedd6('0x7')]),_0x31af66);utils['info'](util['format'](_0xedd6('0xc'),_0x31af66[_0xedd6('0x7')],_0x31af66[_0xedd6('0xd')],_0x31af66[_0xedd6('0xe')],_0x31af66[_0xedd6('0xf')],_0x31af66[_0xedd6('0x10')]));_0x31af66[_0xedd6('0x4')]='blind';writeDB(_0x31af66);}catch(_0x14e6c3){utils['error'](util['format'](_0xedd6('0x11'),_0x31af66[_0xedd6('0x7')]),_0x14e6c3);}};exports[_0xedd6('0x12')]=function(_0x333bb5){try{utils[_0xedd6('0x13')](util[_0xedd6('0xb')](_0xedd6('0x14'),_0x333bb5[_0xedd6('0x6')]),_0x333bb5);utils[_0xedd6('0x2')](util[_0xedd6('0xb')](_0xedd6('0x15'),_0x333bb5[_0xedd6('0x6')],_0x333bb5[_0xedd6('0x16')],_0x333bb5['origtransferercalleridname'],_0x333bb5[_0xedd6('0x17')],_0x333bb5[_0xedd6('0x18')]));_0x333bb5=_[_0xedd6('0x19')](_0x333bb5,{'transfererchannel':_0x333bb5[_0xedd6('0x1a')],'transferercalleridnum':_0x333bb5['origtransferercalleridnum'],'transferercalleridname':_0x333bb5[_0xedd6('0x1b')],'transfererconnectedlinenum':_0x333bb5[_0xedd6('0x1c')],'transfererconnectedlinename':_0x333bb5['secondtransfererconnectedlinename'],'transfereraccountcode':_0x333bb5['origtransfereraccountcode'],'transferercontext':_0x333bb5['secondtransferercontext'],'transfererexten':_0x333bb5[_0xedd6('0x1d')],'transfererlinkedid':_0x333bb5[_0xedd6('0x1e')],'context':_0x333bb5[_0xedd6('0x1f')],'extension':_0x333bb5['origtransfererexten'],'type':_0xedd6('0x5')});if(_[_0xedd6('0x20')](_0x333bb5[_0xedd6('0x21')])){_0x333bb5=_[_0xedd6('0x19')](_0x333bb5,{'transfereechannel':_0x333bb5[_0xedd6('0x22')],'transfereecalleridnum':_0x333bb5[_0xedd6('0x17')],'transfereecalleridname':_0x333bb5[_0xedd6('0x18')],'transfereeconnectedlinenum':_0x333bb5[_0xedd6('0x23')],'transfereeconnectedlinename':_0x333bb5[_0xedd6('0x24')],'transfereeaccountcode':_0x333bb5[_0xedd6('0x25')],'transfereecontext':_0x333bb5[_0xedd6('0x26')],'transfereeexten':_0x333bb5[_0xedd6('0x27')],'transfereelinkedid':_0x333bb5[_0xedd6('0x28')]});}writeDB(_0x333bb5);}catch(_0x46f2d3){utils[_0xedd6('0x29')](util['format'](_0xedd6('0x14'),_0x333bb5[_0xedd6('0x6')]),_0x46f2d3);}}; \ No newline at end of file +var _0x4a45=['transfereecalleridnum','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname'];(function(_0x4ffe90,_0x53b725){var _0x34f3a4=function(_0x213be5){while(--_0x213be5){_0x4ffe90['push'](_0x4ffe90['shift']());}};_0x34f3a4(++_0x53b725);}(_0x4a45,0x6b));var _0x54a4=function(_0x2b0c69,_0x4e1243){_0x2b0c69=_0x2b0c69-0x0;var _0x29e062=_0x4a45[_0x2b0c69];return _0x29e062;};'use strict';var _=require(_0x54a4('0x0'));var util=require(_0x54a4('0x1'));var utils=require(_0x54a4('0x2'));function writeDB(_0x4691b0){utils[_0x54a4('0x3')](util['format'](_0x54a4('0x4'),_0x4691b0[_0x54a4('0x5')]===_0x54a4('0x6')?_0x4691b0[_0x54a4('0x7')]:_0x4691b0[_0x54a4('0x8')],_0x4691b0['type']));utils[_0x54a4('0x9')](_0x54a4('0xa'),_0x4691b0);}exports[_0x54a4('0xb')]=function(_0x5d8ac2){try{utils['debug'](util[_0x54a4('0xc')](_0x54a4('0xd'),_0x5d8ac2[_0x54a4('0x8')]),_0x5d8ac2);utils[_0x54a4('0x3')](util[_0x54a4('0xc')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5d8ac2[_0x54a4('0x8')],_0x5d8ac2[_0x54a4('0xe')],_0x5d8ac2[_0x54a4('0xf')],_0x5d8ac2[_0x54a4('0x10')],_0x5d8ac2['transfereecalleridname']));_0x5d8ac2['type']=_0x54a4('0x11');writeDB(_0x5d8ac2);}catch(_0xd4bec7){utils[_0x54a4('0x12')](util['format'](_0x54a4('0xd'),_0x5d8ac2[_0x54a4('0x8')]),_0xd4bec7);}};exports[_0x54a4('0x13')]=function(_0x497368){try{utils[_0x54a4('0x14')](util[_0x54a4('0xc')](_0x54a4('0x15'),_0x497368[_0x54a4('0x7')]),_0x497368);utils[_0x54a4('0x3')](util['format'](_0x54a4('0x16'),_0x497368[_0x54a4('0x7')],_0x497368['origtransferercalleridnum'],_0x497368[_0x54a4('0x17')],_0x497368[_0x54a4('0x18')],_0x497368[_0x54a4('0x19')]));_0x497368=_[_0x54a4('0x1a')](_0x497368,{'transfererchannel':_0x497368['origtransfererchannel'],'transferercalleridnum':_0x497368[_0x54a4('0x1b')],'transferercalleridname':_0x497368[_0x54a4('0x17')],'transfererconnectedlinenum':_0x497368['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x497368['secondtransfererconnectedlinename'],'transfereraccountcode':_0x497368[_0x54a4('0x1c')],'transferercontext':_0x497368[_0x54a4('0x1d')],'transfererexten':_0x497368[_0x54a4('0x1e')],'transfererlinkedid':_0x497368[_0x54a4('0x1f')],'context':_0x497368[_0x54a4('0x20')],'extension':_0x497368[_0x54a4('0x21')],'type':_0x54a4('0x6')});if(_[_0x54a4('0x22')](_0x497368[_0x54a4('0x23')])){_0x497368=_[_0x54a4('0x1a')](_0x497368,{'transfereechannel':_0x497368[_0x54a4('0x24')],'transfereecalleridnum':_0x497368[_0x54a4('0x18')],'transfereecalleridname':_0x497368[_0x54a4('0x19')],'transfereeconnectedlinenum':_0x497368['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x497368[_0x54a4('0x25')],'transfereeaccountcode':_0x497368['transfertargetaccountcode'],'transfereecontext':_0x497368[_0x54a4('0x26')],'transfereeexten':_0x497368[_0x54a4('0x27')],'transfereelinkedid':_0x497368[_0x54a4('0x28')]});}writeDB(_0x497368);}catch(_0x37d2db){utils['error'](util['format']('[%s][transfers][attendedtransfer]',_0x497368[_0x54a4('0x7')]),_0x37d2db);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 48d3744..ea2a271 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 _0xa65e=['seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','now','isAfter','isBefore','moment','client','http','xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime'];(function(_0x481d3d,_0x44b90d){var _0x24d348=function(_0xcdb360){while(--_0xcdb360){_0x481d3d['push'](_0x481d3d['shift']());}};_0x24d348(++_0x44b90d);}(_0xa65e,0x1ed));var _0xea65=function(_0x551b0a,_0x41348c){_0x551b0a=_0x551b0a-0x0;var _0x5dacb8=_0xa65e[_0x551b0a];return _0x5dacb8;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xea65('0x0'));var util=require('util');var client=jayson[_0xea65('0x1')][_0xea65('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0xea65('0x3'));exports[_0xea65('0x4')]=function(_0x2ca164,_0xeda9b2){logger[_0xea65('0x4')](_0x2ca164,_0xeda9b2?util['inspect'](_0xeda9b2,{'showHidden':![],'depth':null}):'');};exports[_0xea65('0x5')]=function(_0x51d585,_0x48ee72){logger[_0xea65('0x5')](_0x51d585,_0x48ee72?util['inspect'](_0x48ee72,{'showHidden':![],'depth':null}):'');};exports[_0xea65('0x6')]=function(_0x11184f,_0x52c1c7){logger[_0xea65('0x6')](_0x11184f,_0x52c1c7?util[_0xea65('0x7')](_0x52c1c7,{'showHidden':![],'depth':null}):'');};exports[_0xea65('0x8')]=function(_0x5d8eb2,_0x489973){return client[_0xea65('0x8')](_0x5d8eb2,{'body':_0x489973})[_0xea65('0x9')](function(_0x51de14){logger[_0xea65('0x5')](_0xea65('0xa'),_0x5d8eb2,_0x51de14?util[_0xea65('0x7')](_0x51de14,{'showHidden':![],'depth':null}):'');})[_0xea65('0xb')](function(_0x2de5ea){logger['error']('[utils][request]\x20name:%s',_0x5d8eb2,_0x2de5ea?util[_0xea65('0x7')](_0x2de5ea,{'showHidden':![],'depth':null}):'');});};function getUser(_0xcc1e74){return client[_0xea65('0x8')](_0xea65('0xc'),{'options':{'raw':!![],'attributes':['id',_0xea65('0xd'),_0xea65('0xe'),'interface'],'where':_0xcc1e74,'limit':0x1}})['then'](function(_0x29d49b){logger[_0xea65('0x5')](_0xea65('0xf'),JSON[_0xea65('0x10')](_0xcc1e74),_0x29d49b?util[_0xea65('0x7')](_0x29d49b,{'showHidden':![],'depth':null}):'');return _0x29d49b[_0xea65('0x11')]['length']?_0x29d49b[_0xea65('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0xfd2e42){return new BPromise(function(_0x5548f6,_0x2b8db7){if(_0xfd2e42){return getUser({'internal':_0xfd2e42})[_0xea65('0x9')](function(_0x4e97b1){logger['info'](_0xea65('0x12'),_0xfd2e42,_0x4e97b1?_0xea65('0x13'):_0xea65('0x14'));return _0x5548f6(_0x4e97b1);})[_0xea65('0xb')](function(_0x64248e){logger[_0xea65('0x6')](_0xea65('0x15'),_0x64248e?util[_0xea65('0x7')](_0x64248e,{'showHidden':![],'depth':null}):'');return _0x5548f6(null);});}return _0x5548f6(null);});};exports[_0xea65('0x16')]=function(_0x2c657b){return new BPromise(function(_0x9da74,_0x35855f){if(_0x2c657b){return getUser({'interface':_0x2c657b})[_0xea65('0x9')](function(_0x50b77a){logger['info'](_0xea65('0x17'),_0x2c657b,_0x50b77a?_0xea65('0x13'):_0xea65('0x14'));return _0x9da74(_0x50b77a);})[_0xea65('0xb')](function(_0x48a26e){logger[_0xea65('0x6')](_0xea65('0x18'),_0x48a26e?util['inspect'](_0x48a26e,{'showHidden':![],'depth':null}):'');return _0x9da74(null);});}return _0x9da74(null);});};exports[_0xea65('0x19')]=function(_0x39ec0c){return new BPromise(function(_0x25a264,_0x1a172){if(_0x39ec0c){return getUser({'name':_0x39ec0c})['then'](function(_0x43b332){logger[_0xea65('0x4')](_0xea65('0x1a'),_0x39ec0c,_0x43b332?_0xea65('0x13'):_0xea65('0x14'));return _0x25a264(_0x43b332);})['catch'](function(_0x2fa642){logger[_0xea65('0x6')](_0xea65('0x1b'),_0x2fa642?util[_0xea65('0x7')](_0x2fa642,{'showHidden':![],'depth':null}):'');return _0x25a264(null);});}return _0x25a264(null);});};exports[_0xea65('0x1c')]=function(_0x5d4912){return new BPromise(function(_0x9ca5f4,_0x54e8db){if(_0x5d4912){return client['request'](_0xea65('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xea65('0xe'),_0xea65('0x1e'),_0xea65('0x1f'),'acwTimeout'],'where':{'name':_0x5d4912},'limit':0x1}})[_0xea65('0x9')](function(_0x56829d){logger[_0xea65('0x5')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5d4912,_0x56829d?util[_0xea65('0x7')](_0x56829d,{'showHidden':![],'depth':null}):'');logger[_0xea65('0x4')](_0xea65('0x20'),_0x5d4912,_0x56829d?_0xea65('0x13'):_0xea65('0x14'));return _0x9ca5f4(_0x56829d[_0xea65('0x11')][_0xea65('0x21')]?_0x56829d[_0xea65('0x11')][0x0]:null);})[_0xea65('0xb')](function(_0x3b9bc3){logger[_0xea65('0x6')]('[utils][getVoiceQueueByName]',_0x3b9bc3?util[_0xea65('0x7')](_0x3b9bc3,{'showHidden':![],'depth':null}):'');return _0x9ca5f4(null);});}return _0x9ca5f4(null);});};exports[_0xea65('0x22')]=function(_0x1e461c,_0x1cb28f){return moment(_0x1e461c)['add'](_0x1cb28f,_0xea65('0x23'))[_0xea65('0x24')](_0xea65('0x25'));};exports[_0xea65('0x26')]=function(_0x2c336f,_0x8d5ad2){return moment(_0x2c336f)[_0xea65('0x27')](_0x8d5ad2,'seconds')[_0xea65('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xea65('0x28')]=function(_0x29fd8b,_0x3da06b){return moment(_0x29fd8b)['diff'](moment(_0x3da06b),_0xea65('0x23'));};exports['sumTime']=function(_0x446ef4,_0x5e442c){return parseInt(_0x446ef4,0xa)+parseInt(_0x5e442c,0xa);};exports[_0xea65('0x29')]=function(){return moment()[_0xea65('0x24')](_0xea65('0x25'));};exports[_0xea65('0x2a')]=function(_0x21b210,_0x2054fd){if(_0x2054fd){return moment(_0x21b210)['isAfter'](_0x2054fd);}return!![];};exports[_0xea65('0x2b')]=function(_0x4cac08,_0x10bc22){if(_0x10bc22){return moment(_0x4cac08)['isBefore'](_0x10bc22);}else if(_0x4cac08){return!![];}return![];}; \ No newline at end of file +var _0xb22e=['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','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','debug'];(function(_0x2d0e42,_0x1de981){var _0x49a81d=function(_0x17f80b){while(--_0x17f80b){_0x2d0e42['push'](_0x2d0e42['shift']());}};_0x49a81d(++_0x1de981);}(_0xb22e,0x87));var _0xeb22=function(_0x1962aa,_0x282a58){_0x1962aa=_0x1962aa-0x0;var _0x9dd61c=_0xb22e[_0x1962aa];return _0x9dd61c;};'use strict';var BPromise=require(_0xeb22('0x0'));var jayson=require(_0xeb22('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xeb22('0x2')][_0xeb22('0x3')]({'port':0x2329});var logger=require(_0xeb22('0x4'))(_0xeb22('0x5'));exports['info']=function(_0x4ab940,_0x55a7db){logger[_0xeb22('0x6')](_0x4ab940,_0x55a7db?util[_0xeb22('0x7')](_0x55a7db,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x584bba,_0x4ea280){logger[_0xeb22('0x8')](_0x584bba,_0x4ea280?util[_0xeb22('0x7')](_0x4ea280,{'showHidden':![],'depth':null}):'');};exports[_0xeb22('0x9')]=function(_0x31bebd,_0x3d8d4f){logger[_0xeb22('0x9')](_0x31bebd,_0x3d8d4f?util['inspect'](_0x3d8d4f,{'showHidden':![],'depth':null}):'');};exports[_0xeb22('0xa')]=function(_0x5a5447,_0x1d57c4){return client[_0xeb22('0xa')](_0x5a5447,{'body':_0x1d57c4})[_0xeb22('0xb')](function(_0x590d82){logger['debug'](_0xeb22('0xc'),_0x5a5447,_0x590d82?util['inspect'](_0x590d82,{'showHidden':![],'depth':null}):'');})[_0xeb22('0xd')](function(_0x292757){logger[_0xeb22('0x9')](_0xeb22('0xc'),_0x5a5447,_0x292757?util[_0xeb22('0x7')](_0x292757,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1ef0a4){return client[_0xeb22('0xa')](_0xeb22('0xe'),{'options':{'raw':!![],'attributes':['id',_0xeb22('0xf'),_0xeb22('0x10'),_0xeb22('0x11')],'where':_0x1ef0a4,'limit':0x1}})['then'](function(_0xa88d1){logger[_0xeb22('0x8')](_0xeb22('0x12'),JSON[_0xeb22('0x13')](_0x1ef0a4),_0xa88d1?util[_0xeb22('0x7')](_0xa88d1,{'showHidden':![],'depth':null}):'');return _0xa88d1[_0xeb22('0x14')][_0xeb22('0x15')]?_0xa88d1[_0xeb22('0x14')][0x0]:null;});}exports[_0xeb22('0x16')]=function(_0x43c790){return new BPromise(function(_0x2d74d0,_0x26de67){if(_0x43c790){return getUser({'internal':_0x43c790})[_0xeb22('0xb')](function(_0x4deeff){logger['info'](_0xeb22('0x17'),_0x43c790,_0x4deeff?_0xeb22('0x18'):_0xeb22('0x19'));return _0x2d74d0(_0x4deeff);})[_0xeb22('0xd')](function(_0x3dd596){logger[_0xeb22('0x9')]('[utils][getUserByInternal]',_0x3dd596?util[_0xeb22('0x7')](_0x3dd596,{'showHidden':![],'depth':null}):'');return _0x2d74d0(null);});}return _0x2d74d0(null);});};exports[_0xeb22('0x1a')]=function(_0x3e3704){return new BPromise(function(_0x477242,_0x3926bf){if(_0x3e3704){return getUser({'interface':_0x3e3704})['then'](function(_0x52c0a3){logger[_0xeb22('0x6')](_0xeb22('0x1b'),_0x3e3704,_0x52c0a3?_0xeb22('0x18'):'notfound');return _0x477242(_0x52c0a3);})[_0xeb22('0xd')](function(_0x47f456){logger[_0xeb22('0x9')](_0xeb22('0x1c'),_0x47f456?util[_0xeb22('0x7')](_0x47f456,{'showHidden':![],'depth':null}):'');return _0x477242(null);});}return _0x477242(null);});};exports['getUserByName']=function(_0x2d0ccc){return new BPromise(function(_0x41b548,_0x32be46){if(_0x2d0ccc){return getUser({'name':_0x2d0ccc})[_0xeb22('0xb')](function(_0x37dc6b){logger[_0xeb22('0x6')](_0xeb22('0x1d'),_0x2d0ccc,_0x37dc6b?_0xeb22('0x18'):'notfound');return _0x41b548(_0x37dc6b);})[_0xeb22('0xd')](function(_0x5329bd){logger['error'](_0xeb22('0x1e'),_0x5329bd?util[_0xeb22('0x7')](_0x5329bd,{'showHidden':![],'depth':null}):'');return _0x41b548(null);});}return _0x41b548(null);});};exports[_0xeb22('0x1f')]=function(_0x20e02b){return new BPromise(function(_0x364acf,_0x14c751){if(_0x20e02b){return client['request'](_0xeb22('0x20'),{'options':{'raw':!![],'attributes':['id',_0xeb22('0x10'),_0xeb22('0x21'),_0xeb22('0x22'),_0xeb22('0x23')],'where':{'name':_0x20e02b},'limit':0x1}})[_0xeb22('0xb')](function(_0xf75882){logger[_0xeb22('0x8')](_0xeb22('0x24'),_0x20e02b,_0xf75882?util['inspect'](_0xf75882,{'showHidden':![],'depth':null}):'');logger[_0xeb22('0x6')](_0xeb22('0x25'),_0x20e02b,_0xf75882?_0xeb22('0x18'):'notfound');return _0x364acf(_0xf75882[_0xeb22('0x14')][_0xeb22('0x15')]?_0xf75882[_0xeb22('0x14')][0x0]:null);})[_0xeb22('0xd')](function(_0x1d325e){logger[_0xeb22('0x9')]('[utils][getVoiceQueueByName]',_0x1d325e?util[_0xeb22('0x7')](_0x1d325e,{'showHidden':![],'depth':null}):'');return _0x364acf(null);});}return _0x364acf(null);});};exports['addTime']=function(_0x5de785,_0x26b0a9){return moment(_0x5de785)['add'](_0x26b0a9,'seconds')[_0xeb22('0x26')](_0xeb22('0x27'));};exports[_0xeb22('0x28')]=function(_0x3785f0,_0x19ef8f){return moment(_0x3785f0)['subtract'](_0x19ef8f,_0xeb22('0x29'))[_0xeb22('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xeb22('0x2a')]=function(_0x2b8bbb,_0x27a1c8){return moment(_0x2b8bbb)[_0xeb22('0x2b')](moment(_0x27a1c8),_0xeb22('0x29'));};exports[_0xeb22('0x2c')]=function(_0x36e642,_0x6c6315){return parseInt(_0x36e642,0xa)+parseInt(_0x6c6315,0xa);};exports[_0xeb22('0x2d')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xeb22('0x2e')]=function(_0x3b9409,_0x52c995){if(_0x52c995){return moment(_0x3b9409)[_0xeb22('0x2e')](_0x52c995);}return!![];};exports[_0xeb22('0x2f')]=function(_0x506288,_0x4381ac){if(_0x4381ac){return moment(_0x506288)[_0xeb22('0x2f')](_0x4381ac);}else if(_0x506288){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index a693774..d8300c0 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf84=['format','method','headers','x-forwarded-for','connection','remoteAddress','url','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','responseTime','other','agent_id','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','role','name','ensureDir','then','client','catch','user','no-user','timestamp','error','api','auth','set','use','logger','body'];(function(_0x2a60c8,_0x566b5){var _0x6d21a3=function(_0x43c30e){while(--_0x43c30e){_0x2a60c8['push'](_0x2a60c8['shift']());}};_0x6d21a3(++_0x566b5);}(_0xdf84,0xcd));var _0x4df8=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xdf84[_0x255ac0];return _0x437bf1;};var fs=require(_0x4df8('0x0'));var _=require('lodash');var ewinston=require(_0x4df8('0x1'));var path=require(_0x4df8('0x2'));var util=require(_0x4df8('0x3'));var fileLogger=require(_0x4df8('0x4'))[_0x4df8('0x5')];var safeTemplate=require(_0x4df8('0x6'))[_0x4df8('0x7')];var maskSensitiveData=require(_0x4df8('0x8'))[_0x4df8('0x9')];function ClientSideLogger(){function _0x1a7896(_0x55fdcf){var _0x462b0b=path[_0x4df8('0xa')](_0x4df8('0xb'),_0x4df8('0xc'),_0x4df8('0xd'));var _0x49d260=path[_0x4df8('0xa')]('client',_0x55fdcf[_0x4df8('0xe')]+'-'+_0x55fdcf[_0x4df8('0xf')]);return fs[_0x4df8('0x10')](path['join'](_0x462b0b,_0x49d260))[_0x4df8('0x11')](function(){var _0x5f4fd4=fileLogger(_0x4df8('0x12'),path[_0x4df8('0xa')](_0x462b0b,_0x49d260));return _0x5f4fd4;})[_0x4df8('0x13')](function(_0x403a16){throw _0x403a16;});}this[_0x4df8('0xc')]=function(_0x1dcd1c,_0x3340d3,_0x4a0785,_0x48558e){return _0x1a7896(_0x1dcd1c[_0x4df8('0x14')])[_0x4df8('0x11')](function(_0x3c1f56){var _0x4fc682=_0x3c1f56[_0x3340d3];return _0x4fc682;})[_0x4df8('0x11')](function(_0x1a5e7c){var _0x20d46f=_0x1dcd1c[_0x4df8('0x14')]?_0x1dcd1c[_0x4df8('0x14')]['id']:_0x4df8('0x15');var _0x30d14c=_0x48558e['data'];var _0x4d21c6=_0x48558e[_0x4df8('0x16')];var _0x4103c6=new Date(Number(_0x4d21c6));return _0x1a5e7c(_0x20d46f,_0x4103c6,_0x4a0785,_0x30d14c);})['catch'](function(_0x1b018f){fileLogger(_0x4df8('0x12'))[_0x4df8('0x17')](_0x1b018f);});};}function setupLoggers(_0x19b8f8){return new Promise(function(_0x1b713b){var _0x1fe05e=new ClientSideLogger();var _0x24ee62=fileLogger(_0x4df8('0x18'));var _0x410f6f=fileLogger(_0x4df8('0x19'));_0x19b8f8[_0x4df8('0x1a')]('client-side-logger',_0x1fe05e);_0x19b8f8[_0x4df8('0x1b')](ewinston[_0x4df8('0x1c')]({'winstonInstance':_0x24ee62,'meta':![],'statusLevels':!![],'msg':function(_0x3dcdc3,_0x559a59){var _0x20bbd7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x3dcdc3[_0x4df8('0x1d')])){_0x20bbd7+='\x20body=%s';var _0x13cef2=_0x3dcdc3[_0x4df8('0x1d')];maskSensitiveData(_0x13cef2);}return safeTemplate(util[_0x4df8('0x1e')](_0x20bbd7,_0x3dcdc3[_0x4df8('0x1f')],_0x3dcdc3[_0x4df8('0x20')][_0x4df8('0x21')]?_0x3dcdc3[_0x4df8('0x20')][_0x4df8('0x21')]:_0x3dcdc3[_0x4df8('0x22')][_0x4df8('0x23')]||_0x3dcdc3['ip'],_0x3dcdc3[_0x4df8('0x24')],_0x559a59['statusCode'],_0x559a59['responseTime'],_0x3dcdc3[_0x4df8('0x14')]?_0x3dcdc3[_0x4df8('0x14')]['id']:null,_0x3dcdc3['user']?_0x3dcdc3[_0x4df8('0x14')][_0x4df8('0xf')]:null,_0x3dcdc3[_0x4df8('0x14')]?_0x3dcdc3['user']['role']:null,_0x13cef2?util['inspect'](_0x13cef2,![],null):''));}}));_0x19b8f8['use'](ewinston['logger']({'winstonInstance':_0x410f6f,'meta':![],'statusLevels':!![],'msg':function(_0x4fadad,_0xa31b0e){var _0x5d4049=_0x4df8('0x25');if(_0x4fadad[_0x4df8('0x1d')]&&_0x4fadad['body'][_0x4df8('0x26')]&&_0x4fadad[_0x4df8('0x1d')]['agent_id']){_0x5d4049=_0x4df8('0x27');}return util[_0x4df8('0x1e')](_0x5d4049,_0x4fadad[_0x4df8('0x1f')],_0x4fadad[_0x4df8('0x20')][_0x4df8('0x21')]?_0x4fadad[_0x4df8('0x20')][_0x4df8('0x21')]:_0x4fadad[_0x4df8('0x22')][_0x4df8('0x23')]||_0x4fadad['ip'],_0x4fadad[_0x4df8('0x24')],_0xa31b0e[_0x4df8('0x28')],_0xa31b0e[_0x4df8('0x29')],_0x4fadad[_0x4df8('0x14')]?_0x4fadad[_0x4df8('0x14')]['id']:null,_0x4fadad['user']?_0x4fadad[_0x4df8('0x14')][_0x4df8('0xf')]:null,_0x4fadad[_0x4df8('0x14')]?_0x4fadad[_0x4df8('0x14')]['role']:null,_0x4fadad['body']&&_0x4fadad[_0x4df8('0x1d')][_0x4df8('0x26')]?_0x4fadad[_0x4df8('0x1d')]['device']:_0x4df8('0x2a'),_0x4fadad[_0x4df8('0x1d')]&&_0x4fadad[_0x4df8('0x1d')]['agent_id']?_0x4fadad['body'][_0x4df8('0x2b')]:'',_0x4fadad[_0x4df8('0x1d')]&&_0x4fadad[_0x4df8('0x1d')][_0x4df8('0x2c')]?_0x4fadad[_0x4df8('0x1d')][_0x4df8('0x2c')]:'');},'ignoreRoute':function(_0xe599){var _0x464ced=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x464ced[_0x4df8('0x2d')](_0xe599[_0x4df8('0x24')]);}}));return _0x1b713b();});}exports[_0x4df8('0x2e')]=setupLoggers; \ No newline at end of file +var _0xb716=['x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','device','agent_name','setupLoggers','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','join','client','role','name','ensureDir','then','log','user','no-user','data','timestamp','catch','api','client-side-logger','logger','isEmpty','body','\x20body=%s','method','headers'];(function(_0x38e0f7,_0x4f0895){var _0x2a4c31=function(_0x250097){while(--_0x250097){_0x38e0f7['push'](_0x38e0f7['shift']());}};_0x2a4c31(++_0x4f0895);}(_0xb716,0xb5));var _0x6b71=function(_0x20f694,_0x192fd4){_0x20f694=_0x20f694-0x0;var _0x2452e0=_0xb716[_0x20f694];return _0x2452e0;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0x6b71('0x0'));var path=require(_0x6b71('0x1'));var util=require(_0x6b71('0x2'));var fileLogger=require(_0x6b71('0x3'))['fileLogger'];var safeTemplate=require(_0x6b71('0x4'))[_0x6b71('0x5')];var maskSensitiveData=require(_0x6b71('0x6'))[_0x6b71('0x7')];function ClientSideLogger(){function _0x398124(_0x41bc84){var _0x3b1c1=path['join'](_0x6b71('0x8'),'log','xcally');var _0x2507b9=path[_0x6b71('0x9')](_0x6b71('0xa'),_0x41bc84[_0x6b71('0xb')]+'-'+_0x41bc84[_0x6b71('0xc')]);return fs[_0x6b71('0xd')](path['join'](_0x3b1c1,_0x2507b9))[_0x6b71('0xe')](function(){var _0x356b32=fileLogger('client',path[_0x6b71('0x9')](_0x3b1c1,_0x2507b9));return _0x356b32;})['catch'](function(_0x14cbc5){throw _0x14cbc5;});}this[_0x6b71('0xf')]=function(_0x3ea439,_0x407090,_0x15dabc,_0x4780aa){return _0x398124(_0x3ea439[_0x6b71('0x10')])[_0x6b71('0xe')](function(_0x48c0ff){var _0x13f31c=_0x48c0ff[_0x407090];return _0x13f31c;})[_0x6b71('0xe')](function(_0x2dd6e4){var _0x411ad1=_0x3ea439[_0x6b71('0x10')]?_0x3ea439[_0x6b71('0x10')]['id']:_0x6b71('0x11');var _0x53ee15=_0x4780aa[_0x6b71('0x12')];var _0x444b05=_0x4780aa[_0x6b71('0x13')];var _0x2ea398=new Date(Number(_0x444b05));return _0x2dd6e4(_0x411ad1,_0x2ea398,_0x15dabc,_0x53ee15);})[_0x6b71('0x14')](function(_0x5b3c31){fileLogger(_0x6b71('0xa'))['error'](_0x5b3c31);});};}function setupLoggers(_0x1f09d9){return new Promise(function(_0x4ba1dc){var _0x5d8b84=new ClientSideLogger();var _0x5e8b89=fileLogger(_0x6b71('0x15'));var _0x492bf5=fileLogger('auth');_0x1f09d9['set'](_0x6b71('0x16'),_0x5d8b84);_0x1f09d9['use'](ewinston[_0x6b71('0x17')]({'winstonInstance':_0x5e8b89,'meta':![],'statusLevels':!![],'msg':function(_0x4e67d8,_0x7c5980){var _0x1d90b7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x6b71('0x18')](_0x4e67d8[_0x6b71('0x19')])){_0x1d90b7+=_0x6b71('0x1a');var _0x19a25a=_0x4e67d8[_0x6b71('0x19')];maskSensitiveData(_0x19a25a);}return safeTemplate(util['format'](_0x1d90b7,_0x4e67d8[_0x6b71('0x1b')],_0x4e67d8[_0x6b71('0x1c')][_0x6b71('0x1d')]?_0x4e67d8[_0x6b71('0x1c')][_0x6b71('0x1d')]:_0x4e67d8[_0x6b71('0x1e')][_0x6b71('0x1f')]||_0x4e67d8['ip'],_0x4e67d8[_0x6b71('0x20')],_0x7c5980[_0x6b71('0x21')],_0x7c5980[_0x6b71('0x22')],_0x4e67d8[_0x6b71('0x10')]?_0x4e67d8[_0x6b71('0x10')]['id']:null,_0x4e67d8['user']?_0x4e67d8[_0x6b71('0x10')][_0x6b71('0xc')]:null,_0x4e67d8[_0x6b71('0x10')]?_0x4e67d8[_0x6b71('0x10')][_0x6b71('0xb')]:null,_0x19a25a?util[_0x6b71('0x23')](_0x19a25a,![],null):''));}}));_0x1f09d9[_0x6b71('0x24')](ewinston[_0x6b71('0x17')]({'winstonInstance':_0x492bf5,'meta':![],'statusLevels':!![],'msg':function(_0x4613ad,_0x251f2a){var _0x200a04=_0x6b71('0x25');if(_0x4613ad['body']&&_0x4613ad[_0x6b71('0x19')]['device']&&_0x4613ad[_0x6b71('0x19')][_0x6b71('0x26')]){_0x200a04='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x200a04,_0x4613ad[_0x6b71('0x1b')],_0x4613ad[_0x6b71('0x1c')][_0x6b71('0x1d')]?_0x4613ad['headers'][_0x6b71('0x1d')]:_0x4613ad[_0x6b71('0x1e')][_0x6b71('0x1f')]||_0x4613ad['ip'],_0x4613ad['url'],_0x251f2a[_0x6b71('0x21')],_0x251f2a[_0x6b71('0x22')],_0x4613ad['user']?_0x4613ad['user']['id']:null,_0x4613ad[_0x6b71('0x10')]?_0x4613ad['user'][_0x6b71('0xc')]:null,_0x4613ad[_0x6b71('0x10')]?_0x4613ad[_0x6b71('0x10')][_0x6b71('0xb')]:null,_0x4613ad[_0x6b71('0x19')]&&_0x4613ad[_0x6b71('0x19')][_0x6b71('0x27')]?_0x4613ad['body'][_0x6b71('0x27')]:'other',_0x4613ad[_0x6b71('0x19')]&&_0x4613ad[_0x6b71('0x19')][_0x6b71('0x26')]?_0x4613ad[_0x6b71('0x19')]['agent_id']:'',_0x4613ad[_0x6b71('0x19')]&&_0x4613ad[_0x6b71('0x19')]['agent_name']?_0x4613ad[_0x6b71('0x19')][_0x6b71('0x28')]:'');},'ignoreRoute':function(_0x282117){var _0x2860a0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2860a0['test'](_0x282117['url']);}}));return _0x4ba1dc();});}exports[_0x6b71('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 6b1d84c..f427f98 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0150=['minutes','day','endOf','isBetween','timeCompare','format','dowCompare','date','max','min','domCompare','includes','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','source','join','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','slice','concat','exports','indexOf','circularMonthInterval','clone','hours'];(function(_0x149417,_0x336c8f){var _0x3089f9=function(_0x449582){while(--_0x449582){_0x149417['push'](_0x149417['shift']());}};_0x3089f9(++_0x336c8f);}(_0x0150,0x13b));var _0x0015=function(_0x2cb5e7,_0x14db7f){_0x2cb5e7=_0x2cb5e7-0x0;var _0x4d24e8=_0x0150[_0x2cb5e7];return _0x4d24e8;};var _=require(_0x0015('0x0'));var moment=require(_0x0015('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x2f8e3a){return _0x2f8e3a[_0x0015('0x2')];})[_0x0015('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x0015('0x4');function throwIfDateNotValid(_0x1623a8){if(!_0x1623a8[_0x0015('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x16b008){var _0x40d4cf=_0x16b008[_0x0015('0x6')](':')[_0x0015('0x7')](function(_0x91b91e){return parseInt(_0x91b91e,0xa);});var _0x371f8f=_0x40d4cf[0x0];var _0x373f10=_0x40d4cf[0x1];if(_0x371f8f<0x0||_0x371f8f>0x17||_0x373f10<0x0||_0x373f10>0x3b){throw new Error(EINVALID_DATE);}return[_0x371f8f,_0x373f10];}function circularDoWInterval(_0x5ee8a4,_0x22521a){if(_0x5ee8a4===_0x22521a){return[_0x5ee8a4];}else{var _0x36750a=moment[_0x0015('0x8')]();moment[_0x0015('0x8')]('en');var _0x65641d=moment[_0x0015('0x9')]()[_0x0015('0x7')](function(_0x2280ef){return _0x2280ef[_0x0015('0xa')]();});moment[_0x0015('0x8')](_0x36750a);var _0xe2e7de=_0x65641d['indexOf'](_0x5ee8a4);var _0x250e90=_0x65641d['indexOf'](_0x22521a);if(_0x250e90>_0xe2e7de){return _0x65641d[_0x0015('0xb')](_0xe2e7de,_0x250e90+0x1);}else{var _0x2e754c=_0x65641d['slice'](0x0,_0x250e90+0x1);var _0x10c150=_0x65641d[_0x0015('0xb')](_0xe2e7de);return _0x10c150[_0x0015('0xc')](_0x2e754c);}}}module[_0x0015('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0xd9a05b,_0xaeab0){if(_0xd9a05b===_0xaeab0){return[_0xd9a05b];}else{var _0x441aa2=moment[_0x0015('0x8')]();moment['locale']('en');var _0x41d455=moment['monthsShort']()[_0x0015('0x7')](function(_0x180af9){return _0x180af9[_0x0015('0xa')]();});moment[_0x0015('0x8')](_0x441aa2);var _0x47fae3=_0x41d455[_0x0015('0xe')](_0xd9a05b);var _0x320a14=_0x41d455[_0x0015('0xe')](_0xaeab0);if(_0x320a14>_0x47fae3){return _0x41d455[_0x0015('0xb')](_0x47fae3,_0x320a14+0x1);}else{var _0x2cddbf=_0x41d455['slice'](0x0,_0x320a14+0x1);var _0x30b207=_0x41d455[_0x0015('0xb')](_0x47fae3);return _0x30b207[_0x0015('0xc')](_0x2cddbf);}}}module['exports'][_0x0015('0xf')]=circularMonthInterval;function parseDom(_0x4fcf9b){var _0x3c40e5=parseInt(_0x4fcf9b,0xa);if(_0x3c40e5<0x1||_0x3c40e5>0x1f){throw new Error(EINVALID_DATE);}return _0x3c40e5;}function timeCompare(_0x3e40da,_0x35885d,_0x7c994){var _0x5ac1b7=_0x3e40da[_0x0015('0x10')]();var _0x8c12ff=extractTime(_0x35885d);var _0x1348d7=_0x8c12ff[0x0];var _0x45a408=_0x8c12ff[0x1];var _0x348736=_0x3e40da[_0x0015('0x10')]()[_0x0015('0x11')](_0x1348d7)[_0x0015('0x12')](_0x45a408);throwIfDateNotValid(_0x348736);var _0x35c04c=extractTime(_0x7c994);var _0x5d77ad=_0x35c04c[0x0];var _0x3198ed=_0x35c04c[0x1];var _0x235451=_0x3e40da[_0x0015('0x10')]()[_0x0015('0x11')](_0x5d77ad)[_0x0015('0x12')](_0x3198ed);throwIfDateNotValid(_0x235451);if(_0x235451['isBefore'](_0x348736)){var _0x349784=_0x5ac1b7[_0x0015('0x10')]()['startOf'](_0x0015('0x13'));var _0x3bdb8b=_0x5ac1b7[_0x0015('0x10')]()[_0x0015('0x14')](_0x0015('0x13'));return _0x5ac1b7[_0x0015('0x15')](_0x348736,_0x3bdb8b,undefined,'[]')||_0x5ac1b7[_0x0015('0x15')](_0x349784,_0x235451,undefined,'[]');}else{return _0x5ac1b7[_0x0015('0x15')](_0x348736,_0x235451,undefined,'[]');}}module[_0x0015('0xd')][_0x0015('0x16')]=timeCompare;function dowCompare(_0x4c3095,_0x2f4e35,_0x4b3e96){var _0x51fd5a=_0x4c3095['locale']('en')[_0x0015('0x17')]('ddd')[_0x0015('0xa')]();return circularDoWInterval(_0x2f4e35,_0x4b3e96)['includes'](_0x51fd5a);}module[_0x0015('0xd')][_0x0015('0x18')]=dowCompare;function domCompare(_0x18d5eb,_0x4a7241,_0x262296){var _0x3a9508=_0x18d5eb[_0x0015('0x19')]();if(_0x4a7241===_0x262296){return _0x3a9508===_0x4a7241;}else{var _0x15d176=_0x18d5eb['daysInMonth']();var _0x1cf300=_0x4a7241<_0x262296;let _0x4c1a8b=![];var _0x382421=0x0;var _0x32f967=0x0;if(_0x1cf300){_0x382421=Math[_0x0015('0x1a')](0x1,_0x4a7241);_0x32f967=Math[_0x0015('0x1b')](_0x262296,_0x15d176);_0x4c1a8b=_0x3a9508>=_0x382421&&_0x3a9508<=_0x32f967;}else{_0x382421=Math[_0x0015('0x1b')](_0x4a7241,_0x15d176);_0x32f967=Math[_0x0015('0x1a')](0x1,_0x262296);_0x4c1a8b=_0x3a9508>=_0x382421||_0x3a9508<=_0x32f967;}return _0x4c1a8b;}}module[_0x0015('0xd')][_0x0015('0x1c')]=domCompare;function monthCompare(_0x59c05f,_0x1d0675,_0x56a35c){var _0x322670=_0x59c05f[_0x0015('0x8')]('en')[_0x0015('0x17')]('MMM')['toLowerCase']();return circularMonthInterval(_0x1d0675,_0x56a35c)[_0x0015('0x1d')](_0x322670);}module[_0x0015('0xd')][_0x0015('0x1e')]=monthCompare;function iftime(_0x650431,_0x1e01ae=moment['tz'][_0x0015('0x1f')](),_0xab165c=moment()){if(!validateRx[_0x0015('0x20')](_0x650431)){throw new Error(EINVALID_STRING);}else{var _0x53196d=(moment[_0x0015('0x21')](_0xab165c)?_0xab165c[_0x0015('0x10')]():moment(_0xab165c))['tz'](_0x1e01ae)[_0x0015('0x8')]('en');throwIfDateNotValid(_0x53196d);var _0x1e7921=_0x650431[_0x0015('0x6')](',');var _0x5eb2bc=_0x1e7921[0x0];var _0x2de8b6=_0x1e7921[0x1];var _0x3da0ce=_0x1e7921[0x2];var _0x27a388=_0x1e7921[0x3];let _0x3fcce4=!![];if(_0x5eb2bc!=='*'){var _0x4d234f=_0x5eb2bc['split']('-');var _0x3ef8d1=_[_0x0015('0x22')](_0x4d234f[0x0],0x5,'0');var _0x4bfb08=_0x4d234f[_0x0015('0x23')]===0x2?_[_0x0015('0x22')](_0x4d234f[0x1],0x5,'0'):_0x3ef8d1;_0x3fcce4=timeCompare(_0x53196d,_0x3ef8d1,_0x4bfb08);}let _0x471ada=!![];if(_0x2de8b6!=='*'){var _0x599572=_0x2de8b6[_0x0015('0x6')]('-');var _0x1c748d=_0x599572[0x0];var _0x2afaa8=_0x599572[_0x0015('0x23')]===0x2?_0x599572[0x1]:_0x1c748d;_0x471ada=dowCompare(_0x53196d,_0x1c748d,_0x2afaa8);}let _0x2cc754=!![];if(_0x3da0ce!=='*'){var _0x496d10=_0x3da0ce[_0x0015('0x6')]('-');var _0x4a2bae=parseDom(_0x496d10[0x0]);var _0x2ce7f0=_0x496d10[_0x0015('0x23')]===0x2?parseDom(_0x496d10[0x1]):_0x4a2bae;_0x2cc754=domCompare(_0x53196d,_0x4a2bae,_0x2ce7f0);}let _0x568204=!![];if(_0x27a388!=='*'){var _0x5a8231=_0x27a388[_0x0015('0x6')]('-');var _0xfd2bf8=_0x5a8231[0x0];var _0x207535=_0x5a8231[_0x0015('0x23')]===0x2?_0x5a8231[0x1]:_0x5a8231[0x0];_0x568204=monthCompare(_0x53196d,_0xfd2bf8,_0x207535);}return _0x3fcce4&&_0x471ada&&_0x2cc754&&_0x568204;}}module['exports'][_0x0015('0x24')]=iftime; \ No newline at end of file +var _0x30b3=['indexOf','slice','exports','circularDoWInterval','monthsShort','toLowerCase','concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','guess','isMoment','length','padStart','map','source','join','Interval\x20string\x20not\x20valid','split','weekdaysShort','locale'];(function(_0x4a43db,_0x75359){var _0x41d350=function(_0x571851){while(--_0x571851){_0x4a43db['push'](_0x4a43db['shift']());}};_0x41d350(++_0x75359);}(_0x30b3,0x190));var _0x330b=function(_0x3655bd,_0x5da5f1){_0x3655bd=_0x3655bd-0x0;var _0x3a69e4=_0x30b3[_0x3655bd];return _0x3a69e4;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x330b('0x0')](function(_0xc82094){return _0xc82094[_0x330b('0x1')];})[_0x330b('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x330b('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x381095){if(!_0x381095['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x58597b){var _0x320066=_0x58597b[_0x330b('0x4')](':')[_0x330b('0x0')](function(_0x3280ce){return parseInt(_0x3280ce,0xa);});var _0x96c837=_0x320066[0x0];var _0x5a042c=_0x320066[0x1];if(_0x96c837<0x0||_0x96c837>0x17||_0x5a042c<0x0||_0x5a042c>0x3b){throw new Error(EINVALID_DATE);}return[_0x96c837,_0x5a042c];}function circularDoWInterval(_0x979f9d,_0x4065ca){if(_0x979f9d===_0x4065ca){return[_0x979f9d];}else{var _0x354d37=moment['locale']();moment['locale']('en');var _0x40d3f7=moment[_0x330b('0x5')]()[_0x330b('0x0')](function(_0x5eb387){return _0x5eb387['toLowerCase']();});moment[_0x330b('0x6')](_0x354d37);var _0x557b56=_0x40d3f7[_0x330b('0x7')](_0x979f9d);var _0x2fb37c=_0x40d3f7[_0x330b('0x7')](_0x4065ca);if(_0x2fb37c>_0x557b56){return _0x40d3f7[_0x330b('0x8')](_0x557b56,_0x2fb37c+0x1);}else{var _0x2129fd=_0x40d3f7[_0x330b('0x8')](0x0,_0x2fb37c+0x1);var _0x526d8e=_0x40d3f7[_0x330b('0x8')](_0x557b56);return _0x526d8e['concat'](_0x2129fd);}}}module[_0x330b('0x9')][_0x330b('0xa')]=circularDoWInterval;function circularMonthInterval(_0x1ad501,_0x3e551a){if(_0x1ad501===_0x3e551a){return[_0x1ad501];}else{var _0x66b901=moment[_0x330b('0x6')]();moment[_0x330b('0x6')]('en');var _0x56bed2=moment[_0x330b('0xb')]()[_0x330b('0x0')](function(_0x12625d){return _0x12625d[_0x330b('0xc')]();});moment[_0x330b('0x6')](_0x66b901);var _0x115610=_0x56bed2[_0x330b('0x7')](_0x1ad501);var _0x1ab65f=_0x56bed2[_0x330b('0x7')](_0x3e551a);if(_0x1ab65f>_0x115610){return _0x56bed2['slice'](_0x115610,_0x1ab65f+0x1);}else{var _0x29680b=_0x56bed2[_0x330b('0x8')](0x0,_0x1ab65f+0x1);var _0x110631=_0x56bed2[_0x330b('0x8')](_0x115610);return _0x110631[_0x330b('0xd')](_0x29680b);}}}module[_0x330b('0x9')][_0x330b('0xe')]=circularMonthInterval;function parseDom(_0x12e40d){var _0x179dc6=parseInt(_0x12e40d,0xa);if(_0x179dc6<0x1||_0x179dc6>0x1f){throw new Error(EINVALID_DATE);}return _0x179dc6;}function timeCompare(_0x10d764,_0x159af6,_0x556259){var _0x1e7182=_0x10d764[_0x330b('0xf')]();var _0x404471=extractTime(_0x159af6);var _0x3039ce=_0x404471[0x0];var _0xc08444=_0x404471[0x1];var _0xcba000=_0x10d764[_0x330b('0xf')]()[_0x330b('0x10')](_0x3039ce)[_0x330b('0x11')](_0xc08444);throwIfDateNotValid(_0xcba000);var _0x57da20=extractTime(_0x556259);var _0x5017de=_0x57da20[0x0];var _0x2d9eb8=_0x57da20[0x1];var _0x1f430c=_0x10d764[_0x330b('0xf')]()[_0x330b('0x10')](_0x5017de)[_0x330b('0x11')](_0x2d9eb8);throwIfDateNotValid(_0x1f430c);if(_0x1f430c[_0x330b('0x12')](_0xcba000)){var _0x1c0a73=_0x1e7182['clone']()[_0x330b('0x13')](_0x330b('0x14'));var _0x5eab15=_0x1e7182[_0x330b('0xf')]()['endOf'](_0x330b('0x14'));return _0x1e7182[_0x330b('0x15')](_0xcba000,_0x5eab15,undefined,'[]')||_0x1e7182[_0x330b('0x15')](_0x1c0a73,_0x1f430c,undefined,'[]');}else{return _0x1e7182[_0x330b('0x15')](_0xcba000,_0x1f430c,undefined,'[]');}}module[_0x330b('0x9')][_0x330b('0x16')]=timeCompare;function dowCompare(_0x299afd,_0x1f6c24,_0x10d571){var _0x428cfc=_0x299afd[_0x330b('0x6')]('en')[_0x330b('0x17')](_0x330b('0x18'))['toLowerCase']();return circularDoWInterval(_0x1f6c24,_0x10d571)[_0x330b('0x19')](_0x428cfc);}module[_0x330b('0x9')][_0x330b('0x1a')]=dowCompare;function domCompare(_0x1f8780,_0xbe9f9a,_0x2299be){var _0x3dc740=_0x1f8780[_0x330b('0x1b')]();if(_0xbe9f9a===_0x2299be){return _0x3dc740===_0xbe9f9a;}else{var _0x1fd80d=_0x1f8780[_0x330b('0x1c')]();var _0x4e027a=_0xbe9f9a<_0x2299be;let _0xa5e78b=![];var _0x2bc4f4=0x0;var _0x395c5f=0x0;if(_0x4e027a){_0x2bc4f4=Math[_0x330b('0x1d')](0x1,_0xbe9f9a);_0x395c5f=Math[_0x330b('0x1e')](_0x2299be,_0x1fd80d);_0xa5e78b=_0x3dc740>=_0x2bc4f4&&_0x3dc740<=_0x395c5f;}else{_0x2bc4f4=Math[_0x330b('0x1e')](_0xbe9f9a,_0x1fd80d);_0x395c5f=Math[_0x330b('0x1d')](0x1,_0x2299be);_0xa5e78b=_0x3dc740>=_0x2bc4f4||_0x3dc740<=_0x395c5f;}return _0xa5e78b;}}module[_0x330b('0x9')][_0x330b('0x1f')]=domCompare;function monthCompare(_0x15dbe7,_0x50daf8,_0x3fbc7d){var _0x395d6e=_0x15dbe7[_0x330b('0x6')]('en')[_0x330b('0x17')]('MMM')[_0x330b('0xc')]();return circularMonthInterval(_0x50daf8,_0x3fbc7d)[_0x330b('0x19')](_0x395d6e);}module[_0x330b('0x9')][_0x330b('0x20')]=monthCompare;function iftime(_0xe97907,_0x3afe3e=moment['tz'][_0x330b('0x21')](),_0x3c04ed=moment()){if(!validateRx['test'](_0xe97907)){throw new Error(EINVALID_STRING);}else{var _0x1c8e43=(moment[_0x330b('0x22')](_0x3c04ed)?_0x3c04ed[_0x330b('0xf')]():moment(_0x3c04ed))['tz'](_0x3afe3e)[_0x330b('0x6')]('en');throwIfDateNotValid(_0x1c8e43);var _0x2b5317=_0xe97907['split'](',');var _0x570199=_0x2b5317[0x0];var _0xf71083=_0x2b5317[0x1];var _0x3ad1ad=_0x2b5317[0x2];var _0x5c66eb=_0x2b5317[0x3];let _0x5c2d63=!![];if(_0x570199!=='*'){var _0x1ec85a=_0x570199[_0x330b('0x4')]('-');var _0x3b76b3=_['padStart'](_0x1ec85a[0x0],0x5,'0');var _0x3c477f=_0x1ec85a[_0x330b('0x23')]===0x2?_[_0x330b('0x24')](_0x1ec85a[0x1],0x5,'0'):_0x3b76b3;_0x5c2d63=timeCompare(_0x1c8e43,_0x3b76b3,_0x3c477f);}let _0x461342=!![];if(_0xf71083!=='*'){var _0xb443fd=_0xf71083['split']('-');var _0x1fa724=_0xb443fd[0x0];var _0x2c431d=_0xb443fd[_0x330b('0x23')]===0x2?_0xb443fd[0x1]:_0x1fa724;_0x461342=dowCompare(_0x1c8e43,_0x1fa724,_0x2c431d);}let _0x59df84=!![];if(_0x3ad1ad!=='*'){var _0x563688=_0x3ad1ad['split']('-');var _0x2791e0=parseDom(_0x563688[0x0]);var _0x3f186e=_0x563688[_0x330b('0x23')]===0x2?parseDom(_0x563688[0x1]):_0x2791e0;_0x59df84=domCompare(_0x1c8e43,_0x2791e0,_0x3f186e);}let _0x5260fa=!![];if(_0x5c66eb!=='*'){var _0x14e577=_0x5c66eb[_0x330b('0x4')]('-');var _0x3baf80=_0x14e577[0x0];var _0x8046ee=_0x14e577[_0x330b('0x23')]===0x2?_0x14e577[0x1]:_0x14e577[0x0];_0x5260fa=monthCompare(_0x1c8e43,_0x3baf80,_0x8046ee);}return _0x5c2d63&&_0x461342&&_0x59df84&&_0x5260fa;}}module[_0x330b('0x9')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 95203e0..3663614 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e81=['toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','keys','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x7e81,0x181));var _0x17e8=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7e81[_0x164eca];return _0x2ce562;};'use strict';var path=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var moment=require('moment');var winston=require(_0x17e8('0x2'));var config=require(_0x17e8('0x3'));var debugLevel=config[_0x17e8('0x4')]?config['debugLevel'][_0x17e8('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x17e8('0x6'),'error':'red','warn':_0x17e8('0x7'),'info':_0x17e8('0x8'),'print':_0x17e8('0x9'),'success':_0x17e8('0xa'),'http':_0x17e8('0xb'),'verbose':_0x17e8('0xc'),'debug':_0x17e8('0xd'),'silly':_0x17e8('0xe')};winston[_0x17e8('0xf')](XC_LOG_COLORS);function getLogFileName(_0x4ace69,_0x420063,_0x499ee4){var _0x1241c7=_0x4ace69||_0x17e8('0x10');return path[_0x17e8('0x11')](_0x1241c7,util[_0x17e8('0x12')](_0x17e8('0x13'),_0x420063,_0x499ee4));}function formatter(_0x32752b,_0x376834){_0x376834[_0x17e8('0x14')]=_0x376834[_0x17e8('0x14')][_0x17e8('0x15')](/@@{/g,_0x17e8('0x16'))['replace'](/}@@/g,'}}}')[_0x17e8('0x15')](/@{/g,'{{')[_0x17e8('0x15')](/}@/g,'}}');return util[_0x17e8('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x17e8('0x17')),_0x376834[_0x17e8('0x18')][_0x17e8('0x19')](),_0x32752b,_0x376834[_0x17e8('0x14')]);}function fileFormat(_0x4a9bc9,_0x64eb83){_0x64eb83[_0x17e8('0x14')]=_0x64eb83['message']['replace'](/@@{/g,_0x17e8('0x16'))[_0x17e8('0x15')](/}@@/g,_0x17e8('0x1a'))[_0x17e8('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xb33b4b=_0x64eb83['meta']&&Object[_0x17e8('0x1b')](_0x64eb83[_0x17e8('0x1c')])['length']?'\x0a\x09'+JSON['stringify'](_0x64eb83[_0x17e8('0x1c')]):'';return util[_0x17e8('0x12')](_0x17e8('0x1d'),moment()[_0x17e8('0x12')](_0x17e8('0x17')),_0x64eb83['level'][_0x17e8('0x19')](),_0x4a9bc9,_0x64eb83[_0x17e8('0x14')],_0xb33b4b);}function consoleLogger(){var _0x10e23b=new winston[(_0x17e8('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x17e8('0x1f'))][(_0x17e8('0x20'))]({'level':_0x17e8('0x21'),'json':![],'formatter':function(_0x1d3eb4){return formatter('',_0x1d3eb4);}})]});return _0x10e23b;}function fileLogger(_0x554b02,_0x5bf711){var _0x48261c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x17e8('0x1f'))][(_0x17e8('0x22'))]({'name':util[_0x17e8('0x12')](_0x17e8('0x23'),_0x554b02,_0x17e8('0x24')),'filename':getLogFileName(_0x5bf711,_0x554b02,_0x17e8('0x24')),'level':_0x17e8('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1688fe){return fileFormat(_0x554b02,_0x1688fe);}}),new winston[(_0x17e8('0x1f'))]['File']({'name':util['format'](_0x17e8('0x23'),_0x554b02,debugLevel),'filename':getLogFileName(_0x5bf711,_0x554b02,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b0183){return fileFormat(_0x554b02,_0x3b0183);}}),new winston[(_0x17e8('0x1f'))][(_0x17e8('0x20'))]({'level':_0x17e8('0x21'),'json':![],'formatter':function(_0x6a248d){return fileFormat(_0x554b02,_0x6a248d);}})]});return _0x48261c;}exports[_0x17e8('0x25')]=consoleLogger;exports[_0x17e8('0x26')]=fileLogger; \ No newline at end of file +var _0x9b4a=['white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','File','error','%s-%s','Console','warn','consoleLogger','fileLogger','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow'];(function(_0x350dc6,_0x36ab14){var _0x2e5887=function(_0x5370ad){while(--_0x5370ad){_0x350dc6['push'](_0x350dc6['shift']());}};_0x2e5887(++_0x36ab14);}(_0x9b4a,0x175));var _0xa9b4=function(_0x29a8e0,_0x1cfe44){_0x29a8e0=_0x29a8e0-0x0;var _0x42ea7c=_0x9b4a[_0x29a8e0];return _0x42ea7c;};'use strict';var path=require('path');var util=require('util');var moment=require('moment');var winston=require(_0xa9b4('0x0'));var config=require(_0xa9b4('0x1'));var debugLevel=config[_0xa9b4('0x2')]?config[_0xa9b4('0x2')][_0xa9b4('0x3')]():_0xa9b4('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xa9b4('0x5'),'warn':_0xa9b4('0x6'),'info':_0xa9b4('0x7'),'print':_0xa9b4('0x8'),'success':_0xa9b4('0x9'),'http':'gray','verbose':_0xa9b4('0xa'),'debug':_0xa9b4('0xb'),'silly':'bold\x20cyan'};winston[_0xa9b4('0xc')](XC_LOG_COLORS);function getLogFileName(_0x9f0a0f,_0xf19b02,_0x306b41){var _0x2cdd61=_0x9f0a0f||'/var/log/xcally';return path[_0xa9b4('0xd')](_0x2cdd61,util[_0xa9b4('0xe')](_0xa9b4('0xf'),_0xf19b02,_0x306b41));}function formatter(_0xd2cf8f,_0x262ceb){_0x262ceb[_0xa9b4('0x10')]=_0x262ceb[_0xa9b4('0x10')][_0xa9b4('0x11')](/@@{/g,_0xa9b4('0x12'))['replace'](/}@@/g,_0xa9b4('0x13'))[_0xa9b4('0x11')](/@{/g,'{{')[_0xa9b4('0x11')](/}@/g,'}}');return util['format'](_0xa9b4('0x14'),moment()[_0xa9b4('0xe')](_0xa9b4('0x15')),_0x262ceb[_0xa9b4('0x16')][_0xa9b4('0x17')](),_0xd2cf8f,_0x262ceb[_0xa9b4('0x10')]);}function fileFormat(_0x34b469,_0xba0685){_0xba0685[_0xa9b4('0x10')]=_0xba0685[_0xa9b4('0x10')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0xa9b4('0x11')](/@{/g,'{{')[_0xa9b4('0x11')](/}@/g,'}}');var _0x486f59=_0xba0685['meta']&&Object[_0xa9b4('0x18')](_0xba0685[_0xa9b4('0x19')])[_0xa9b4('0x1a')]?'\x0a\x09'+JSON[_0xa9b4('0x1b')](_0xba0685[_0xa9b4('0x19')]):'';return util['format'](_0xa9b4('0x1c'),moment()[_0xa9b4('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),_0xba0685[_0xa9b4('0x16')]['toUpperCase'](),_0x34b469,_0xba0685[_0xa9b4('0x10')],_0x486f59);}function consoleLogger(){var _0x4c116d=new winston[(_0xa9b4('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa9b4('0x1e'))]['Console']({'level':'warn','json':![],'formatter':function(_0x16d908){return formatter('',_0x16d908);}})]});return _0x4c116d;}function fileLogger(_0x2bea3e,_0x34d738){var _0x465488=new winston[(_0xa9b4('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa9b4('0x1f'))]({'name':util['format']('%s-%s',_0x2bea3e,_0xa9b4('0x20')),'filename':getLogFileName(_0x34d738,_0x2bea3e,_0xa9b4('0x20')),'level':_0xa9b4('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48c98c){return fileFormat(_0x2bea3e,_0x48c98c);}}),new winston[(_0xa9b4('0x1e'))][(_0xa9b4('0x1f'))]({'name':util[_0xa9b4('0xe')](_0xa9b4('0x21'),_0x2bea3e,debugLevel),'filename':getLogFileName(_0x34d738,_0x2bea3e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x54f353){return fileFormat(_0x2bea3e,_0x54f353);}}),new winston[(_0xa9b4('0x1e'))][(_0xa9b4('0x22'))]({'level':_0xa9b4('0x23'),'json':![],'formatter':function(_0x89e5c2){return fileFormat(_0x2bea3e,_0x89e5c2);}})]});return _0x465488;}exports[_0xa9b4('0x24')]=consoleLogger;exports[_0xa9b4('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 8140b6a..f9c4f34 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x4fbf6e,_0x4ecc10){var _0x202500=function(_0x490548){while(--_0x490548){_0x4fbf6e['push'](_0x4fbf6e['shift']());}};_0x202500(++_0x4ecc10);}(_0x1261,0x144));var _0x1126=function(_0x3038be,_0x425d69){_0x3038be=_0x3038be-0x0;var _0x581d4e=_0x1261[_0x3038be];return _0x581d4e;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x5950bd,_0x15f6b5){_0x5950bd=_0x5950bd-0x0;var _0x43515e=_0x7a54[_0x5950bd];return _0x43515e;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 1d97f05..10015d8 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xda2d,0x102));var _0xdda2=function(_0x451c70,_0x3daec3){_0x451c70=_0x451c70-0x0;var _0x2a1f50=_0xda2d[_0x451c70];return _0x2a1f50;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file +var _0xb688=['{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x4bac5d,_0x1007cc){var _0x7eb121=function(_0xbec03c){while(--_0xbec03c){_0x4bac5d['push'](_0x4bac5d['shift']());}};_0x7eb121(++_0x1007cc);}(_0xb688,0xcf));var _0x8b68=function(_0x3349c5,_0x31fa66){_0x3349c5=_0x3349c5-0x0;var _0x180bd5=_0xb688[_0x3349c5];return _0x180bd5;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x39c8c5){return _0x39c8c5==='{{'?_0x8b68('0x0'):_0x8b68('0x1');}function safeTemplate(_0x1080e8){var _0x23bbaa=_0x1080e8;if(typeof _0x1080e8===_0x8b68('0x2')){_0x23bbaa=_0x1080e8['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8b68('0x3')](_0x1080e8)){_0x23bbaa=_0x1080e8[_0x8b68('0x4')](function(_0x30f33d){return safeTemplate(_0x30f33d);});}else if(_[_0x8b68('0x5')](_0x1080e8)){_0x23bbaa=Object['keys'](_0x1080e8)[_0x8b68('0x6')](function(_0x57ee56,_0x37677d){_0x57ee56[_0x37677d]=safeTemplate(_0x1080e8[_0x37677d]);return _0x57ee56;},{});}return _0x23bbaa;}module[_0x8b68('0x7')][_0x8b68('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 2209b97..d9d3861 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82bc=['info','Updating\x20app.json','resolve','exports','fs-extra','path','../config/environment','root','server/app.json','legacy-libs','apps','name','motion2','NODE_PATH','env','then','updated'];(function(_0x5614a3,_0x1ebbb3){var _0x15f60c=function(_0x213c69){while(--_0x213c69){_0x5614a3['push'](_0x5614a3['shift']());}};_0x15f60c(++_0x1ebbb3);}(_0x82bc,0x125));var _0xc82b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x82bc[_0x4e676e];return _0x336a3c;};var fs=require(_0xc82b('0x0'));var path=require(_0xc82b('0x1'));var config=require(_0xc82b('0x2'));var root=config[_0xc82b('0x3')];var APP_JSON_PATH=path['resolve'](root,_0xc82b('0x4'));var NODEPATH=path['resolve'](root,_0xc82b('0x5'));function setLegacyLibsNodeEnvPath(_0x128be1){let _0x508c58=![];if(Array['isArray'](_0x128be1['apps'])){var _0x5e564c=_0x128be1[_0xc82b('0x6')]['findIndex'](function(_0x54cc66){return _0x54cc66[_0xc82b('0x7')]===_0xc82b('0x8');});if(_0x5e564c>-0x1){var _0x3aabe9=_0x128be1[_0xc82b('0x6')][_0x5e564c];if(typeof _0x3aabe9['env'][_0xc82b('0x9')]!=='string'){_0x3aabe9[_0xc82b('0xa')]['NODE_PATH']=NODEPATH;_0x508c58=!![];}}return{'appConfig':_0x128be1,'updated':_0x508c58};}}function updateAppConfig(_0x2fdd15){return fs['pathExists'](APP_JSON_PATH)[_0xc82b('0xb')](function(_0xfa7d2a){if(_0xfa7d2a){return fs['readJSON'](APP_JSON_PATH)[_0xc82b('0xb')](function(_0x3a4dab){var _0x4cd838=setLegacyLibsNodeEnvPath(_0x3a4dab);if(_0x4cd838[_0xc82b('0xc')]){_0x2fdd15[_0xc82b('0xd')](_0xc82b('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x3a4dab,{'spaces':0x2});}else{return Promise[_0xc82b('0xf')]();}});}else{return Promise[_0xc82b('0xf')]();}});}module[_0xc82b('0x10')]=updateAppConfig; \ No newline at end of file +var _0xc3d5=['env','string','pathExists','readJSON','then','updated','info','writeJSON','exports','fs-extra','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2'];(function(_0x174710,_0x2ced56){var _0x53d04c=function(_0x48d17e){while(--_0x48d17e){_0x174710['push'](_0x174710['shift']());}};_0x53d04c(++_0x2ced56);}(_0xc3d5,0xbd));var _0x5c3d=function(_0x2d9dab,_0x1a45a6){_0x2d9dab=_0x2d9dab-0x0;var _0x373f8=_0xc3d5[_0x2d9dab];return _0x373f8;};var fs=require(_0x5c3d('0x0'));var path=require('path');var config=require(_0x5c3d('0x1'));var root=config[_0x5c3d('0x2')];var APP_JSON_PATH=path[_0x5c3d('0x3')](root,_0x5c3d('0x4'));var NODEPATH=path['resolve'](root,_0x5c3d('0x5'));function setLegacyLibsNodeEnvPath(_0x517204){let _0x3f862d=![];if(Array[_0x5c3d('0x6')](_0x517204[_0x5c3d('0x7')])){var _0x4b9b6b=_0x517204[_0x5c3d('0x7')][_0x5c3d('0x8')](function(_0x118570){return _0x118570[_0x5c3d('0x9')]===_0x5c3d('0xa');});if(_0x4b9b6b>-0x1){var _0x1b2498=_0x517204[_0x5c3d('0x7')][_0x4b9b6b];if(typeof _0x1b2498[_0x5c3d('0xb')]['NODE_PATH']!==_0x5c3d('0xc')){_0x1b2498[_0x5c3d('0xb')]['NODE_PATH']=NODEPATH;_0x3f862d=!![];}}return{'appConfig':_0x517204,'updated':_0x3f862d};}}function updateAppConfig(_0x35973b){return fs[_0x5c3d('0xd')](APP_JSON_PATH)['then'](function(_0x4347d4){if(_0x4347d4){return fs[_0x5c3d('0xe')](APP_JSON_PATH)[_0x5c3d('0xf')](function(_0x28fbb5){var _0x45aac1=setLegacyLibsNodeEnvPath(_0x28fbb5);if(_0x45aac1[_0x5c3d('0x10')]){_0x35973b[_0x5c3d('0x11')]('Updating\x20app.json');return fs[_0x5c3d('0x12')](APP_JSON_PATH,_0x28fbb5,{'spaces':0x2});}else{return Promise[_0x5c3d('0x3')]();}});}else{return Promise[_0x5c3d('0x3')]();}});}module[_0x5c3d('0x13')]=updateAppConfig; \ No newline at end of file